From: support Date: Tue, 20 Sep 2022 13:44:10 +0000 (+0000) Subject: Built motion from commit 78adc006.|2.6.15 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=e8651d4c5bc21105aa567def8b573b4cb803ed26;p=motion2.git Built motion from commit 78adc006.|2.6.15 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index c09ffe2..3ace969 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-09-20T12:14:18.247Z", + "time": "2022-09-20T13:35:54.889Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index c90a615..ad325b7 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-09-20T12:14:18.247Z", + "time": "2022-09-20T13:35:54.889Z", "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 2c1d3e6..65d862b 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 _0x7548=['browser','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','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[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','urlForward[body]','getDataValue','action','integration','motionbar'];(function(_0x1280f3,_0x2ad19e){var _0x4a6cb0=function(_0x14f7ee){while(--_0x14f7ee){_0x1280f3['push'](_0x1280f3['shift']());}};_0x4a6cb0(++_0x2ad19e);}(_0x7548,0x1d8));var _0x8754=function(_0x40fc76,_0x1f8276){_0x40fc76=_0x40fc76-0x0;var _0x573a14=_0x7548[_0x40fc76];return _0x573a14;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x17f47a){return this[_0x8754('0x0')](_0x8754('0x1'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x8754('0x2'),_0x8754('0x3'),'jscripty','urlForward',_0x8754('0x4'),_0x8754('0x5'),'script']],'msg':_0x8754('0x6')}},'comment':_0x8754('0x6')},'data1':{'type':Sequelize[_0x8754('0x7')](0x1000),'comment':_0x8754('0x8')},'data2':{'type':Sequelize[_0x8754('0x7')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0x8754('0x7')](0x1000),'comment':_0x8754('0x9')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x8754('0xa')},'data5':{'type':Sequelize[_0x8754('0x7')](0x1000),'comments':_0x8754('0xb')},'data6':{'type':Sequelize[_0x8754('0x7')],'comments':_0x8754('0xc')},'data7':{'type':Sequelize['TEXT'],'comments':_0x8754('0xd')}}; \ No newline at end of file +var _0xeb76=['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[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','VIRTUAL','getDataValue','action','integration','motionbar','jscripty','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)]','STRING','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'];(function(_0x233d31,_0xea62e4){var _0x17e46f=function(_0x288323){while(--_0x288323){_0x233d31['push'](_0x233d31['shift']());}};_0x17e46f(++_0xea62e4);}(_0xeb76,0x96));var _0x6eb7=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xeb76[_0x139a3c];return _0x2b375b;};'use strict';var Sequelize=require(_0x6eb7('0x0'));module['exports']={'name':{'type':Sequelize[_0x6eb7('0x1')],'get':function(_0xcd783b){return this[_0x6eb7('0x2')](_0x6eb7('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x6eb7('0x4'),_0x6eb7('0x5'),_0x6eb7('0x6'),'urlForward','browser','bot',_0x6eb7('0x7')]],'msg':_0x6eb7('0x8')}},'comment':_0x6eb7('0x8')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x6eb7('0x9')},'data2':{'type':Sequelize[_0x6eb7('0xa')](0x1000),'comment':_0x6eb7('0xb')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x6eb7('0xc')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x6eb7('0xd')},'data5':{'type':Sequelize[_0x6eb7('0xa')](0x1000),'comments':_0x6eb7('0xe')},'data6':{'type':Sequelize[_0x6eb7('0xa')],'comments':_0x6eb7('0xf')},'data7':{'type':Sequelize[_0x6eb7('0x10')],'comments':_0x6eb7('0x11')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 5dc23e2..db010e8 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 _0x1cf8=['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','json','offset','undefined','limit','count','reject','then','end','sendStatus','stack','name','send','update','body','Action','find','params','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce'];(function(_0xfa3f89,_0x1ec06f){var _0x3a41e2=function(_0x48537a){while(--_0x48537a){_0xfa3f89['push'](_0xfa3f89['shift']());}};_0x3a41e2(++_0x1ec06f);}(_0x1cf8,0x81));var _0x81cf=function(_0x20db6c,_0x4ff24a){_0x20db6c=_0x20db6c-0x0;var _0x30b5d3=_0x1cf8[_0x20db6c];return _0x30b5d3;};'use strict';var emlformat=require(_0x81cf('0x0'));var rimraf=require(_0x81cf('0x1'));var zipdir=require(_0x81cf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x81cf('0x3'));var moment=require(_0x81cf('0x4'));var BPromise=require(_0x81cf('0x5'));var Mustache=require(_0x81cf('0x6'));var util=require(_0x81cf('0x7'));var path=require(_0x81cf('0x8'));var sox=require('sox');var csv=require(_0x81cf('0x9'));var ejs=require(_0x81cf('0xa'));var fs=require('fs');var fs_extra=require(_0x81cf('0xb'));var _=require(_0x81cf('0xc'));var squel=require(_0x81cf('0xd'));var crypto=require('crypto');var jsforce=require(_0x81cf('0xe'));var deskjs=require(_0x81cf('0xf'));var toCsv=require(_0x81cf('0x9'));var querystring=require(_0x81cf('0x10'));var Papa=require(_0x81cf('0x11'));var Redis=require(_0x81cf('0x12'));var authService=require(_0x81cf('0x13'));var qs=require(_0x81cf('0x14'));var as=require(_0x81cf('0x15'));var hardwareService=require(_0x81cf('0x16'));var logger=require(_0x81cf('0x17'))(_0x81cf('0x18'));var utils=require(_0x81cf('0x19'));var config=require(_0x81cf('0x1a'));var licenseUtil=require(_0x81cf('0x1b'));var db=require(_0x81cf('0x1c'))['db'];function respondWithStatusCode(_0x17d4bc,_0x4d3820){_0x4d3820=_0x4d3820||0xcc;return function(_0x2d6e57){if(_0x2d6e57){return _0x17d4bc['sendStatus'](_0x4d3820);}return _0x17d4bc[_0x81cf('0x1d')](_0x4d3820)['end']();};}function respondWithResult(_0xe9e815,_0x3e3258){_0x3e3258=_0x3e3258||0xc8;return function(_0x378f21){if(_0x378f21){return _0xe9e815[_0x81cf('0x1d')](_0x3e3258)[_0x81cf('0x1e')](_0x378f21);}};}function respondWithFilteredResult(_0x13c015,_0x3fde2c){return function(_0x6466e4){if(_0x6466e4){var _0x4528f5=typeof _0x3fde2c[_0x81cf('0x1f')]===_0x81cf('0x20')&&typeof _0x3fde2c[_0x81cf('0x21')]===_0x81cf('0x20');var _0x66fbd1=_0x6466e4[_0x81cf('0x22')];var _0x5260ac=_0x4528f5?0x0:_0x3fde2c[_0x81cf('0x1f')];var _0x5bd47c=_0x4528f5?_0x6466e4['count']:_0x3fde2c[_0x81cf('0x1f')]+_0x3fde2c[_0x81cf('0x21')];var _0x446bfc;if(_0x5bd47c>=_0x66fbd1){_0x5bd47c=_0x66fbd1;_0x446bfc=0xc8;}else{_0x446bfc=0xce;}_0x13c015[_0x81cf('0x1d')](_0x446bfc);return _0x13c015['set']('Content-Range',_0x5260ac+'-'+_0x5bd47c+'/'+_0x66fbd1)[_0x81cf('0x1e')](_0x6466e4);}return null;};}function patchUpdates(_0x4f24d3){return function(_0x131656){try{jsonpatch['apply'](_0x131656,_0x4f24d3,!![]);}catch(_0x2736a0){return BPromise[_0x81cf('0x23')](_0x2736a0);}return _0x131656['save']();};}function saveUpdates(_0x5528d5,_0x179917){return function(_0x37a314){if(_0x37a314){return _0x37a314['update'](_0x5528d5)[_0x81cf('0x24')](function(_0x4fda2c){return _0x4fda2c;});}return null;};}function removeEntity(_0x1f8e30,_0x59c70b){return function(_0x9a7ff4){if(_0x9a7ff4){return _0x9a7ff4['destroy']()[_0x81cf('0x24')](function(){_0x1f8e30[_0x81cf('0x1d')](0xcc)[_0x81cf('0x25')]();});}};}function handleEntityNotFound(_0x3f6ff8,_0x47343d){return function(_0x4d9619){if(!_0x4d9619){_0x3f6ff8[_0x81cf('0x26')](0x194);}return _0x4d9619;};}function handleError(_0x38c572,_0xedd848){_0xedd848=_0xedd848||0x1f4;return function(_0x503549){logger['error'](_0x503549[_0x81cf('0x27')]);if(_0x503549['name']){delete _0x503549[_0x81cf('0x28')];}_0x38c572[_0x81cf('0x1d')](_0xedd848)[_0x81cf('0x29')](_0x503549);};}exports[_0x81cf('0x2a')]=function(_0x40e241,_0x3d21c9){if(_0x40e241[_0x81cf('0x2b')]['id']){delete _0x40e241[_0x81cf('0x2b')]['id'];}return db[_0x81cf('0x2c')][_0x81cf('0x2d')]({'where':{'id':_0x40e241[_0x81cf('0x2e')]['id']}})[_0x81cf('0x24')](handleEntityNotFound(_0x3d21c9,null))[_0x81cf('0x24')](saveUpdates(_0x40e241[_0x81cf('0x2b')],null))['then'](respondWithResult(_0x3d21c9,null))[_0x81cf('0x2f')](handleError(_0x3d21c9,null));};exports['destroy']=function(_0x125c1b,_0x1876a4){return db[_0x81cf('0x2c')]['find']({'where':{'id':_0x125c1b[_0x81cf('0x2e')]['id']}})[_0x81cf('0x24')](handleEntityNotFound(_0x1876a4,null))[_0x81cf('0x24')](removeEntity(_0x1876a4,null))[_0x81cf('0x2f')](handleError(_0x1876a4,null));}; \ No newline at end of file +var _0x8252=['offset','Content-Range','apply','reject','update','then','end','sendStatus','error','name','send','body','Action','find','params','catch','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8252,0x18a));var _0x2825=function(_0x7a87e5,_0x29cb3b){_0x7a87e5=_0x7a87e5-0x0;var _0x56d31e=_0x8252[_0x7a87e5];return _0x56d31e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2825('0x0'));var zipdir=require(_0x2825('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2825('0x2'));var BPromise=require(_0x2825('0x3'));var Mustache=require(_0x2825('0x4'));var util=require(_0x2825('0x5'));var path=require(_0x2825('0x6'));var sox=require(_0x2825('0x7'));var csv=require(_0x2825('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2825('0x9'));var _=require(_0x2825('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2825('0xb'));var deskjs=require(_0x2825('0xc'));var toCsv=require(_0x2825('0x8'));var querystring=require(_0x2825('0xd'));var Papa=require('papaparse');var Redis=require(_0x2825('0xe'));var authService=require(_0x2825('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2825('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x2825('0x11'));var config=require(_0x2825('0x12'));var licenseUtil=require(_0x2825('0x13'));var db=require(_0x2825('0x14'))['db'];function respondWithStatusCode(_0x19827f,_0x492042){_0x492042=_0x492042||0xcc;return function(_0x423ea0){if(_0x423ea0){return _0x19827f['sendStatus'](_0x492042);}return _0x19827f[_0x2825('0x15')](_0x492042)['end']();};}function respondWithResult(_0x569112,_0x2e2945){_0x2e2945=_0x2e2945||0xc8;return function(_0x263bcc){if(_0x263bcc){return _0x569112[_0x2825('0x15')](_0x2e2945)[_0x2825('0x16')](_0x263bcc);}};}function respondWithFilteredResult(_0x338e69,_0x5c50a6){return function(_0xc715e){if(_0xc715e){var _0x23c2a9=typeof _0x5c50a6['offset']===_0x2825('0x17')&&typeof _0x5c50a6[_0x2825('0x18')]===_0x2825('0x17');var _0x5e0aab=_0xc715e[_0x2825('0x19')];var _0x5303fc=_0x23c2a9?0x0:_0x5c50a6[_0x2825('0x1a')];var _0x3d8689=_0x23c2a9?_0xc715e['count']:_0x5c50a6[_0x2825('0x1a')]+_0x5c50a6[_0x2825('0x18')];var _0x4322d1;if(_0x3d8689>=_0x5e0aab){_0x3d8689=_0x5e0aab;_0x4322d1=0xc8;}else{_0x4322d1=0xce;}_0x338e69[_0x2825('0x15')](_0x4322d1);return _0x338e69['set'](_0x2825('0x1b'),_0x5303fc+'-'+_0x3d8689+'/'+_0x5e0aab)[_0x2825('0x16')](_0xc715e);}return null;};}function patchUpdates(_0xe8814b){return function(_0x3dc8a2){try{jsonpatch[_0x2825('0x1c')](_0x3dc8a2,_0xe8814b,!![]);}catch(_0x1f4743){return BPromise[_0x2825('0x1d')](_0x1f4743);}return _0x3dc8a2['save']();};}function saveUpdates(_0x30db06,_0x2b6b35){return function(_0x5575d2){if(_0x5575d2){return _0x5575d2[_0x2825('0x1e')](_0x30db06)[_0x2825('0x1f')](function(_0x389fb5){return _0x389fb5;});}return null;};}function removeEntity(_0x2dba15,_0x21095d){return function(_0x2f9de5){if(_0x2f9de5){return _0x2f9de5['destroy']()[_0x2825('0x1f')](function(){_0x2dba15[_0x2825('0x15')](0xcc)[_0x2825('0x20')]();});}};}function handleEntityNotFound(_0x12d356,_0x11e80b){return function(_0x93f73b){if(!_0x93f73b){_0x12d356[_0x2825('0x21')](0x194);}return _0x93f73b;};}function handleError(_0x20f0a3,_0x3746c3){_0x3746c3=_0x3746c3||0x1f4;return function(_0x527809){logger[_0x2825('0x22')](_0x527809['stack']);if(_0x527809[_0x2825('0x23')]){delete _0x527809[_0x2825('0x23')];}_0x20f0a3['status'](_0x3746c3)[_0x2825('0x24')](_0x527809);};}exports['update']=function(_0x35522a,_0x5de031){if(_0x35522a[_0x2825('0x25')]['id']){delete _0x35522a['body']['id'];}return db[_0x2825('0x26')][_0x2825('0x27')]({'where':{'id':_0x35522a[_0x2825('0x28')]['id']}})['then'](handleEntityNotFound(_0x5de031,null))[_0x2825('0x1f')](saveUpdates(_0x35522a[_0x2825('0x25')],null))[_0x2825('0x1f')](respondWithResult(_0x5de031,null))[_0x2825('0x29')](handleError(_0x5de031,null));};exports['destroy']=function(_0x30714b,_0x45224b){return db[_0x2825('0x26')][_0x2825('0x27')]({'where':{'id':_0x30714b['params']['id']}})['then'](handleEntityNotFound(_0x45224b,null))[_0x2825('0x1f')](removeEntity(_0x45224b,null))[_0x2825('0x29')](handleError(_0x45224b,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 95204ce..23a1979 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 _0x1339=['moment','path','rimraf','./action.attributes','exports','define','lodash','util','api'];(function(_0x521a14,_0x52196a){var _0x2bb1c2=function(_0x71814){while(--_0x71814){_0x521a14['push'](_0x521a14['shift']());}};_0x2bb1c2(++_0x52196a);}(_0x1339,0x1bf));var _0x9133=function(_0x31ac7f,_0x55e873){_0x31ac7f=_0x31ac7f-0x0;var _0x3419d7=_0x1339[_0x31ac7f];return _0x3419d7;};'use strict';var _=require(_0x9133('0x0'));var util=require(_0x9133('0x1'));var logger=require('../../config/logger')(_0x9133('0x2'));var moment=require(_0x9133('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9133('0x4'));var rimraf=require(_0x9133('0x5'));var config=require('../../config/environment');var attributes=require(_0x9133('0x6'));module[_0x9133('0x7')]=function(_0x410765,_0x1534e4){return _0x410765[_0x9133('0x8')]('Action',attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x11ed=['tools_actions','util','api','bluebird','request-promise','path','rimraf','./action.attributes','exports'];(function(_0x5f1f43,_0x5c7675){var _0x539747=function(_0x3f90a2){while(--_0x3f90a2){_0x5f1f43['push'](_0x5f1f43['shift']());}};_0x539747(++_0x5c7675);}(_0x11ed,0x9a));var _0xd11e=function(_0x405913,_0x4fd831){_0x405913=_0x405913-0x0;var _0x34eddb=_0x11ed[_0x405913];return _0x34eddb;};'use strict';var _=require('lodash');var util=require(_0xd11e('0x0'));var logger=require('../../config/logger')(_0xd11e('0x1'));var moment=require('moment');var BPromise=require(_0xd11e('0x2'));var rp=require(_0xd11e('0x3'));var fs=require('fs');var path=require(_0xd11e('0x4'));var rimraf=require(_0xd11e('0x5'));var config=require('../../config/environment');var attributes=require(_0xd11e('0x6'));module[_0xd11e('0x7')]=function(_0x3dacda,_0x3682bf){return _0x3dacda['define']('Action',attributes,{'tableName':_0xd11e('0x8'),'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 ecaf031..cd152c5 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 _0x1261=['then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\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(_0x4f6284,_0x4b90e5){var _0x5d7303=function(_0x4e585f){while(--_0x4e585f){_0x4f6284['push'](_0x4f6284['shift']());}};_0x5d7303(++_0x4b90e5);}(_0x1261,0x144));var _0x1126=function(_0x49c6cc,_0x308bdb){_0x49c6cc=_0x49c6cc-0x0;var _0x22e239=_0x1261[_0x49c6cc];return _0x22e239;};'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')]('Action,\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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','Action,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x2c26c9,_0x3d0ce3){var _0x22ab87=function(_0x34c91d){while(--_0x34c91d){_0x2c26c9['push'](_0x2c26c9['shift']());}};_0x22ab87(++_0x3d0ce3);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xc4aa[_0x4792c8];return _0x35edb1;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('Action,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 20fafa6..35c9ebc 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 _0x9274=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','delete','isAuthenticated','multer'];(function(_0x8338b1,_0x1eb097){var _0x4f4e95=function(_0x19fe46){while(--_0x19fe46){_0x8338b1['push'](_0x8338b1['shift']());}};_0x4f4e95(++_0x1eb097);}(_0x9274,0xed));var _0x4927=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9274[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x4927('0x0'));var util=require(_0x4927('0x1'));var path=require(_0x4927('0x2'));var timeout=require('connect-timeout');var express=require(_0x4927('0x3'));var router=express[_0x4927('0x4')]();var fs_extra=require(_0x4927('0x5'));var auth=require(_0x4927('0x6'));var interaction=require(_0x4927('0x7'));var config=require(_0x4927('0x8'));var controller=require(_0x4927('0x9'));router[_0x4927('0xa')](_0x4927('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x4927('0xc')](_0x4927('0xb'),auth[_0x4927('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf09e=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','delete','isAuthenticated','multer','util','path','connect-timeout'];(function(_0x3bdd81,_0x162076){var _0x4fbdd4=function(_0x145baf){while(--_0x145baf){_0x3bdd81['push'](_0x3bdd81['shift']());}};_0x4fbdd4(++_0x162076);}(_0xf09e,0x6c));var _0xef09=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xf09e[_0x413feb];return _0x40ee88;};'use strict';var multer=require(_0xef09('0x0'));var util=require(_0xef09('0x1'));var path=require(_0xef09('0x2'));var timeout=require(_0xef09('0x3'));var express=require(_0xef09('0x4'));var router=express[_0xef09('0x5')]();var fs_extra=require(_0xef09('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xef09('0x7'));var config=require(_0xef09('0x8'));var controller=require(_0xef09('0x9'));router[_0xef09('0xa')](_0xef09('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xef09('0xc')](_0xef09('0xb'),auth[_0xef09('0xd')](),controller['destroy']);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 1a388a8..a202ad4 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 _0xabce=['exports','STRING','TEXT','sequelize'];(function(_0x48f7e3,_0x2a3feb){var _0x497989=function(_0x4c0ba1){while(--_0x4c0ba1){_0x48f7e3['push'](_0x48f7e3['shift']());}};_0x497989(++_0x2a3feb);}(_0xabce,0x103));var _0xeabc=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xabce[_0x47a7d0];return _0xb9bd08;};'use strict';var Sequelize=require(_0xeabc('0x0'));module[_0xeabc('0x1')]={'name':{'type':Sequelize[_0xeabc('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xeabc('0x2')]},'parent':{'type':Sequelize[_0xeabc('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xeabc('0x3')]}}; \ No newline at end of file +var _0xbd51=['sequelize','STRING'];(function(_0x209575,_0x417ae0){var _0x5b183d=function(_0x353a2c){while(--_0x353a2c){_0x209575['push'](_0x209575['shift']());}};_0x5b183d(++_0x417ae0);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x1226ed,_0x20add0){_0x1226ed=_0x1226ed-0x0;var _0x147c11=_0xbd51[_0x1226ed];return _0x147c11;};'use strict';var Sequelize=require(_0x1bd5('0x0'));module['exports']={'name':{'type':Sequelize[_0x1bd5('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x1bd5('0x1')]},'parent':{'type':Sequelize[_0x1bd5('0x1')]},'table':{'type':Sequelize[_0x1bd5('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 28b2a5e..3aca7ad 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 _0x9dbe=['csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../files/reports','countTable','COUNT(*)','SELECT','runReport','MIN(%s)','MetricId','DESC','parse','debug','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','get','CustomReports','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','include','rows','catch','AnalyticCustomReport','fields','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','autoAssociation','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','operator','rules','group','field','condition','value','params','getFields','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','table','function','replace','format','groupBy','orderBy','alias','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','COUNT(DISTINCT\x20%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','Sequelize','ValidationErrorItem','AnalyticMetric','findAll','output','web','fullPath','randomstring','generate'];(function(_0x1e48e4,_0x1f1d31){var _0x51b402=function(_0x35beec){while(--_0x35beec){_0x1e48e4['push'](_0x1e48e4['shift']());}};_0x51b402(++_0x1f1d31);}(_0x9dbe,0x150));var _0xe9db=function(_0x11e413,_0x343351){_0x11e413=_0x11e413-0x0;var _0x391080=_0x9dbe[_0x11e413];return _0x391080;};'use strict';var emlformat=require(_0xe9db('0x0'));var rimraf=require(_0xe9db('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9db('0x2'));var rp=require(_0xe9db('0x3'));var moment=require('moment');var BPromise=require(_0xe9db('0x4'));var Mustache=require('mustache');var util=require(_0xe9db('0x5'));var path=require(_0xe9db('0x6'));var sox=require(_0xe9db('0x7'));var csv=require(_0xe9db('0x8'));var ejs=require(_0xe9db('0x9'));var fs=require('fs');var fs_extra=require(_0xe9db('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe9db('0xb'));var deskjs=require(_0xe9db('0xc'));var toCsv=require(_0xe9db('0x8'));var querystring=require(_0xe9db('0xd'));var Papa=require('papaparse');var Redis=require(_0xe9db('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe9db('0xf'));var as=require(_0xe9db('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xe9db('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')['dbH'];function respondWithStatusCode(_0x8958bd,_0x4b13ef){_0x4b13ef=_0x4b13ef||0xcc;return function(_0x33caa9){if(_0x33caa9){return _0x8958bd[_0xe9db('0x12')](_0x4b13ef);}return _0x8958bd[_0xe9db('0x13')](_0x4b13ef)['end']();};}function respondWithResult(_0x2f010c,_0x3c0c26){_0x3c0c26=_0x3c0c26||0xc8;return function(_0x231b4e){if(_0x231b4e){return _0x2f010c[_0xe9db('0x13')](_0x3c0c26)[_0xe9db('0x14')](_0x231b4e);}};}function respondWithFilteredResult(_0x3780f2,_0x338d0e){return function(_0x2039ed){if(_0x2039ed){var _0x27b426=typeof _0x338d0e[_0xe9db('0x15')]===_0xe9db('0x16')&&typeof _0x338d0e['limit']===_0xe9db('0x16');var _0xb9464e=_0x2039ed['count'];var _0x3f29f1=_0x27b426?0x0:_0x338d0e[_0xe9db('0x15')];var _0x2a7b9d=_0x27b426?_0x2039ed[_0xe9db('0x17')]:_0x338d0e[_0xe9db('0x15')]+_0x338d0e[_0xe9db('0x18')];var _0x46c1b1;if(_0x2a7b9d>=_0xb9464e){_0x2a7b9d=_0xb9464e;_0x46c1b1=0xc8;}else{_0x46c1b1=0xce;}_0x3780f2['status'](_0x46c1b1);return _0x3780f2[_0xe9db('0x19')](_0xe9db('0x1a'),_0x3f29f1+'-'+_0x2a7b9d+'/'+_0xb9464e)[_0xe9db('0x14')](_0x2039ed);}return null;};}function patchUpdates(_0x3d4cfa){return function(_0x5aed99){try{jsonpatch['apply'](_0x5aed99,_0x3d4cfa,!![]);}catch(_0x218998){return BPromise[_0xe9db('0x1b')](_0x218998);}return _0x5aed99['save']();};}function saveUpdates(_0xa21dc,_0x5df7ce){return function(_0x31e107){if(_0x31e107){return _0x31e107[_0xe9db('0x1c')](_0xa21dc)[_0xe9db('0x1d')](function(_0x39a29){return _0x39a29;});}return null;};}function removeEntity(_0x4e2e0e,_0x103c07){return function(_0x1fe791){if(_0x1fe791){return _0x1fe791[_0xe9db('0x1e')]()[_0xe9db('0x1d')](function(){var _0x2d8f9b=_0x1fe791[_0xe9db('0x1f')]({'plain':!![]});var _0x5b5e10=_0xe9db('0x20');return db[_0xe9db('0x21')][_0xe9db('0x1e')]({'where':{'type':_0x5b5e10,'resourceId':_0x2d8f9b['id']}})['then'](function(){return _0x1fe791;});})['then'](function(){_0x4e2e0e[_0xe9db('0x13')](0xcc)[_0xe9db('0x22')]();});}};}function handleEntityNotFound(_0x1962e5,_0x32a1cd){return function(_0x10ec50){if(!_0x10ec50){_0x1962e5['sendStatus'](0x194);}return _0x10ec50;};}function handleError(_0x304501,_0x598057){_0x598057=_0x598057||0x1f4;return function(_0x6babea){logger[_0xe9db('0x23')](_0x6babea[_0xe9db('0x24')]);if(_0x6babea[_0xe9db('0x25')]){delete _0x6babea['name'];}_0x304501['status'](_0x598057)[_0xe9db('0x26')](_0x6babea);};}exports[_0xe9db('0x27')]=function(_0x6673d,_0x4eb98b){var _0x58ce92={},_0x3a383c={},_0x129871={'count':0x0,'rows':[]};var _0x5271ff=_[_0xe9db('0x28')](db['AnalyticCustomReport'][_0xe9db('0x29')],function(_0x12c308){return{'name':_0x12c308[_0xe9db('0x2a')],'type':_0x12c308[_0xe9db('0x2b')][_0xe9db('0x2c')]};});_0x3a383c[_0xe9db('0x2d')]=_[_0xe9db('0x28')](_0x5271ff,_0xe9db('0x25'));_0x3a383c[_0xe9db('0x2e')]=_[_0xe9db('0x2f')](_0x6673d[_0xe9db('0x2e')]);_0x3a383c[_0xe9db('0x30')]=_[_0xe9db('0x31')](_0x3a383c['model'],_0x3a383c['query']);_0x58ce92[_0xe9db('0x32')]=_[_0xe9db('0x31')](_0x3a383c[_0xe9db('0x2d')],qs['fields'](_0x6673d[_0xe9db('0x2e')]['fields']));_0x58ce92[_0xe9db('0x32')]=_0x58ce92[_0xe9db('0x32')]['length']?_0x58ce92['attributes']:_0x3a383c['model'];if(!_0x6673d[_0xe9db('0x2e')][_0xe9db('0x33')](_0xe9db('0x34'))){_0x58ce92['limit']=qs['limit'](_0x6673d[_0xe9db('0x2e')][_0xe9db('0x18')]);_0x58ce92[_0xe9db('0x15')]=qs[_0xe9db('0x15')](_0x6673d[_0xe9db('0x2e')][_0xe9db('0x15')]);}_0x58ce92[_0xe9db('0x35')]=qs['sort'](_0x6673d[_0xe9db('0x2e')][_0xe9db('0x36')]);_0x58ce92['where']=qs['filters'](_['pick'](_0x6673d[_0xe9db('0x2e')],_0x3a383c[_0xe9db('0x30')]),_0x5271ff);if(_0x6673d['query'][_0xe9db('0x37')]){_0x58ce92[_0xe9db('0x38')]=_[_0xe9db('0x39')](_0x58ce92[_0xe9db('0x38')],{'$or':_[_0xe9db('0x28')](_0x5271ff,function(_0x4aa340){if(_0x4aa340[_0xe9db('0x2b')]!=='VIRTUAL'){var _0xc3c78e={};_0xc3c78e[_0x4aa340[_0xe9db('0x25')]]={'$like':'%'+_0x6673d[_0xe9db('0x2e')]['filter']+'%'};return _0xc3c78e;}})});}_0x58ce92=_['merge']({},_0x58ce92,_0x6673d[_0xe9db('0x3a')]);var _0x3d1e53={'where':_0x58ce92[_0xe9db('0x38')]};return db['AnalyticCustomReport'][_0xe9db('0x17')](_0x3d1e53)[_0xe9db('0x1d')](function(_0x190707){_0x129871[_0xe9db('0x17')]=_0x190707;if(_0x6673d['query'][_0xe9db('0x3b')]){_0x58ce92[_0xe9db('0x3c')]=[{'all':!![]}];}return db['AnalyticCustomReport']['findAll'](_0x58ce92);})[_0xe9db('0x1d')](function(_0x5216c8){_0x129871[_0xe9db('0x3d')]=_0x5216c8;return _0x129871;})[_0xe9db('0x1d')](respondWithFilteredResult(_0x4eb98b,_0x58ce92))[_0xe9db('0x3e')](handleError(_0x4eb98b,null));};exports['show']=function(_0x17badb,_0x2adeb2){var _0x4c6ce3={'raw':![],'where':{'id':_0x17badb['params']['id']}},_0x2cb171={};_0x2cb171[_0xe9db('0x2d')]=_['keys'](db[_0xe9db('0x3f')]['rawAttributes']);_0x2cb171['query']=_[_0xe9db('0x2f')](_0x17badb[_0xe9db('0x2e')]);_0x2cb171[_0xe9db('0x30')]=_[_0xe9db('0x31')](_0x2cb171[_0xe9db('0x2d')],_0x2cb171[_0xe9db('0x2e')]);_0x4c6ce3['attributes']=_[_0xe9db('0x31')](_0x2cb171[_0xe9db('0x2d')],qs['fields'](_0x17badb[_0xe9db('0x2e')][_0xe9db('0x40')]));_0x4c6ce3['attributes']=_0x4c6ce3[_0xe9db('0x32')][_0xe9db('0x41')]?_0x4c6ce3[_0xe9db('0x32')]:_0x2cb171['model'];if(_0x17badb['query'][_0xe9db('0x3b')]){_0x4c6ce3[_0xe9db('0x3c')]=[{'all':!![]}];}_0x4c6ce3=_['merge']({},_0x4c6ce3,_0x17badb[_0xe9db('0x3a')]);return db['AnalyticCustomReport'][_0xe9db('0x42')](_0x4c6ce3)[_0xe9db('0x1d')](handleEntityNotFound(_0x2adeb2,null))[_0xe9db('0x1d')](respondWithResult(_0x2adeb2,null))[_0xe9db('0x3e')](handleError(_0x2adeb2,null));};exports[_0xe9db('0x43')]=function(_0x54a01d,_0x270861){return db[_0xe9db('0x3f')][_0xe9db('0x43')](_0x54a01d[_0xe9db('0x44')],{})[_0xe9db('0x1d')](function(_0x354b9a){var _0x506e37=_0x54a01d[_0xe9db('0x45')]['get']({'plain':!![]});if(!_0x506e37)throw new Error(_0xe9db('0x46'));if(_0x506e37[_0xe9db('0x47')]==='user'){var _0x2b7135=_0x354b9a['get']({'plain':!![]});var _0x115274=_0xe9db('0x48');return db['UserProfileSection'][_0xe9db('0x42')]({'where':{'name':_0x115274,'userProfileId':_0x506e37['userProfileId']},'raw':!![]})[_0xe9db('0x1d')](function(_0x53294c){if(_0x53294c&&_0x53294c[_0xe9db('0x49')]===0x0){return db[_0xe9db('0x21')][_0xe9db('0x43')]({'name':_0x2b7135[_0xe9db('0x25')],'resourceId':_0x2b7135['id'],'type':'CustomReports','sectionId':_0x53294c['id']},{})[_0xe9db('0x1d')](function(){return _0x354b9a;});}else{return _0x354b9a;}})[_0xe9db('0x3e')](function(_0x3dcc20){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3dcc20);throw _0x3dcc20;});}return _0x354b9a;})['then'](respondWithResult(_0x270861,0xc9))[_0xe9db('0x3e')](handleError(_0x270861,null));};exports['update']=function(_0x5eace2,_0x2da606){if(_0x5eace2['body']['id']){delete _0x5eace2[_0xe9db('0x44')]['id'];}return db['AnalyticCustomReport']['find']({'where':{'id':_0x5eace2['params']['id']}})[_0xe9db('0x1d')](handleEntityNotFound(_0x2da606,null))[_0xe9db('0x1d')](saveUpdates(_0x5eace2[_0xe9db('0x44')],null))[_0xe9db('0x1d')](respondWithResult(_0x2da606,null))[_0xe9db('0x3e')](handleError(_0x2da606,null));};exports[_0xe9db('0x1e')]=function(_0x3ab6a0,_0x43c34a){return db['AnalyticCustomReport'][_0xe9db('0x42')]({'where':{'id':_0x3ab6a0['params']['id']}})[_0xe9db('0x1d')](handleEntityNotFound(_0x43c34a,null))['then'](removeEntity(_0x43c34a,null))['catch'](handleError(_0x43c34a,null));};exports[_0xe9db('0x4a')]=function(_0x17759b,_0x1151f6){var _0x2aad91=0xa;var _0x4cfb89=[_0xe9db('0x4b'),_0xe9db('0x4c'),_0xe9db('0x4d'),_0xe9db('0x4e')];var _0x2fb4d1={'SUM':_0xe9db('0x4f'),'COUNT':_0xe9db('0x50'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xe9db('0x51'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xe9db('0x52'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xe9db('0x53')};var _0x45cca5={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xe9db('0x54'),'ROUND':_0xe9db('0x55'),'UNIX_TIMESTAMP':_0xe9db('0x56')};var _0x4ccfe6=function(_0x2bc2f6){return!_[_0xe9db('0x57')](['IS\x20NULL',_0xe9db('0x58'),_0xe9db('0x59'),_0xe9db('0x5a')],_0x2bc2f6);};var _0x5cb8e9=function(_0x2288f7){if(!_0x2288f7||!_0x2288f7['rules'][_0xe9db('0x41')]){return'';}for(var _0x2dae84='(',_0x19bc92=0x0;_0x19bc92<_0x2288f7['rules'][_0xe9db('0x41')];_0x19bc92+=0x1){_0x19bc92>0x0&&(_0x2dae84+='\x20'+_0x2288f7[_0xe9db('0x5b')]+'\x20');_0x2dae84+=_0x2288f7[_0xe9db('0x5c')][_0x19bc92][_0xe9db('0x5d')]?_0x5cb8e9(_0x2288f7['rules'][_0x19bc92][_0xe9db('0x5d')]):_0x2288f7['rules'][_0x19bc92][_0xe9db('0x5e')]+'\x20'+_0x2288f7[_0xe9db('0x5c')][_0x19bc92]['condition']+(_0x4ccfe6(_0x2288f7['rules'][_0x19bc92][_0xe9db('0x5f')])?'\x20'+_0x2288f7[_0xe9db('0x5c')][_0x19bc92][_0xe9db('0x60')]:'');}return _0x2dae84+')';};var _0x57e6af={'where':{'id':_0x17759b[_0xe9db('0x61')]['id']}},_0x2a95dd,_0xf433aa,_0x27ab67,_0x391a6b,_0x793293;_0x57e6af=_[_0xe9db('0x39')]({},_0x57e6af,_0x17759b[_0xe9db('0x3a')]);return db[_0xe9db('0x3f')]['find'](_0x57e6af)[_0xe9db('0x1d')](function(_0x5efd05){if(_0x5efd05){_0x2a95dd=_0x5efd05;return _0x5efd05[_0xe9db('0x62')]();}return null;})['then'](function(_0x1c99e9){if(_0x1c99e9){if(!_0x1c99e9[_0xe9db('0x41')]){throw new db['Sequelize']['ValidationErrorItem'](_0xe9db('0x63'),0x193);}_0xf433aa=_0x1c99e9;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xe9db('0x1d')](function(_0x9852b8){if(_0x9852b8){_0x27ab67=_[_0xe9db('0x64')](_0x9852b8,'id');var _0x2df1c8;var _0x347860=squel[_0xe9db('0x65')]();_0x347860[_0xe9db('0x66')](_0x2a95dd[_0xe9db('0x67')]);for(var _0x3daf6f=0x0;_0x3daf6f<_0xf433aa[_0xe9db('0x41')];_0x3daf6f+=0x1){_0x2df1c8=_0xf433aa[_0x3daf6f]['MetricId']?_0x27ab67[_0xf433aa[_0x3daf6f]['MetricId']]['metric']:_0xf433aa[_0x3daf6f]['field'];_0x2df1c8=_0xf433aa[_0x3daf6f][_0xe9db('0x68')]?_[_0xe9db('0x69')](_0x2fb4d1[_0xf433aa[_0x3daf6f][_0xe9db('0x68')]],'%s',_0x2df1c8):_0x2df1c8;_0x2df1c8=_0xf433aa[_0x3daf6f][_0xe9db('0x6a')]?_[_0xe9db('0x69')](_0x45cca5[_0xf433aa[_0x3daf6f][_0xe9db('0x6a')]],'%s',_0x2df1c8):_0x2df1c8;if(_0xf433aa[_0x3daf6f][_0xe9db('0x6b')]){_0x347860[_0xe9db('0x5d')](_0x2df1c8);}_0xf433aa[_0x3daf6f]['orderBy']&&_0x347860[_0xe9db('0x35')](_0x2df1c8,_0xf433aa[_0x3daf6f][_0xe9db('0x6c')]==='DESC'?![]:!![]);_0x347860[_0xe9db('0x5e')](_0x2df1c8,_0xf433aa[_0x3daf6f][_0xe9db('0x6d')]||_0x2df1c8);}if(_0x2a95dd['joins']){_0x2a95dd[_0xe9db('0x6e')]=JSON['parse'](_0x2a95dd[_0xe9db('0x6e')]);for(var _0x1142cf=0x0;_0x1142cf<_0x2a95dd[_0xe9db('0x6e')][_0xe9db('0x41')];_0x1142cf+=0x1){if(_0x2a95dd['joins'][_0x1142cf][_0xe9db('0x2b')]&&_[_0xe9db('0x57')](_0x4cfb89,_0x2a95dd['joins'][_0x1142cf][_0xe9db('0x2b')])&&_0x2a95dd['joins'][_0x1142cf][_0xe9db('0x6f')]&&_0x2a95dd[_0xe9db('0x6e')][_0x1142cf]['foreignTable']&&_0x2a95dd[_0xe9db('0x6e')][_0x1142cf]['foreignKey']){_0x347860[_0x2a95dd[_0xe9db('0x6e')][_0x1142cf][_0xe9db('0x2b')]](_0x2a95dd[_0xe9db('0x6e')][_0x1142cf][_0xe9db('0x70')],null,util[_0xe9db('0x6a')](_0xe9db('0x71'),_0x2a95dd[_0xe9db('0x67')],_0x2a95dd[_0xe9db('0x6e')][_0x1142cf][_0xe9db('0x6f')],_0x2a95dd[_0xe9db('0x6e')][_0x1142cf][_0xe9db('0x70')],_0x2a95dd[_0xe9db('0x6e')][_0x1142cf][_0xe9db('0x72')]));}}}if(_0x2a95dd['conditions']){_0x2a95dd[_0xe9db('0x73')]=JSON['parse'](_0x2a95dd['conditions']);_0x347860[_0xe9db('0x38')](_0x5cb8e9(_0x2a95dd[_0xe9db('0x73')]['group']));}_0x793293=_0x347860[_0xe9db('0x74')]();_0x347860[_0xe9db('0x18')](_0x2aad91);_0x347860[_0xe9db('0x15')](0x0);logger['debug'](_0xe9db('0x75'),_0x347860[_0xe9db('0x76')]());return dbH[_0xe9db('0x77')][_0xe9db('0x2e')](_0x347860['toString'](),{'type':dbH[_0xe9db('0x77')][_0xe9db('0x78')]['SELECT']});}})[_0xe9db('0x1d')](respondWithResult(_0x1151f6,null))[_0xe9db('0x3e')](handleError(_0x1151f6,null));};function runReport(_0x419af0,_0x424f3e,_0x5dd1b4){var _0x41d521=_0x424f3e['name'];var _0x249e0=0xa;var _0x2f8f79=[_0xe9db('0x4b'),_0xe9db('0x4c'),_0xe9db('0x4d'),'cross_join'];var _0x51f0b2={'SUM':_0xe9db('0x4f'),'COUNT':_0xe9db('0x50'),'COUNT DISTINCT':_0xe9db('0x79'),'MAX':_0xe9db('0x51'),'MIN':'MIN(%s)','AVG':_0xe9db('0x7a'),'GROUP_CONCAT':_0xe9db('0x52'),'GROUP_CONCAT ASC':_0xe9db('0x7b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x576b8c={'SEC_TO_TIME':_0xe9db('0x7c'),'DATE':_0xe9db('0x7d'),'HOUR':_0xe9db('0x54'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xe9db('0x56')};var _0x2fe9e0=function(_0x2ec2a9){return!_[_0xe9db('0x57')](['IS\x20NULL',_0xe9db('0x58'),_0xe9db('0x59'),'IS\x20NOT\x20EMPTY'],_0x2ec2a9);};var _0x401dab=function(_0x4a8d88){if(!_0x4a8d88||!_0x4a8d88[_0xe9db('0x5c')][_0xe9db('0x41')]){return'';}for(var _0x1eaec2='(',_0x57086e=0x0;_0x57086e<_0x4a8d88[_0xe9db('0x5c')][_0xe9db('0x41')];_0x57086e+=0x1){_0x57086e>0x0&&(_0x1eaec2+='\x20'+_0x4a8d88[_0xe9db('0x5b')]+'\x20');_0x1eaec2+=_0x4a8d88[_0xe9db('0x5c')][_0x57086e][_0xe9db('0x5d')]?_0x401dab(_0x4a8d88[_0xe9db('0x5c')][_0x57086e][_0xe9db('0x5d')]):_0x4a8d88['rules'][_0x57086e]['field']+'\x20'+_0x4a8d88[_0xe9db('0x5c')][_0x57086e]['condition']+(_0x2fe9e0(_0x4a8d88[_0xe9db('0x5c')][_0x57086e][_0xe9db('0x5f')])?'\x20'+_0x4a8d88[_0xe9db('0x5c')][_0x57086e]['value']:'');}return _0x1eaec2+')';};var _0x4ad314={'where':{'id':_0x419af0['id']}},_0x384ec0,_0x411c86,_0x1a7de6,_0x12d6f4,_0x266608;_0x4ad314=_[_0xe9db('0x39')]({},_0x4ad314,_0x5dd1b4);return db[_0xe9db('0x3f')][_0xe9db('0x42')](_0x4ad314)[_0xe9db('0x1d')](function(_0x770205){if(_0x770205){_0x384ec0=_0x770205;return _0x770205[_0xe9db('0x62')]();}return null;})['then'](function(_0x15f3ff){if(_0x15f3ff){if(!_0x15f3ff[_0xe9db('0x41')]){throw new db[(_0xe9db('0x7e'))][(_0xe9db('0x7f'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x411c86=_0x15f3ff;return db[_0xe9db('0x80')][_0xe9db('0x81')]({'raw':!![]});}return null;})['then'](function(_0x28eb79){if(_0x28eb79){_0x1a7de6=_[_0xe9db('0x64')](_0x28eb79,'id');var _0x229afb;var _0x164dc7=squel['select']();_0x164dc7[_0xe9db('0x66')](_0x384ec0['table']);for(var _0x272660=0x0;_0x272660<_0x411c86['length'];_0x272660+=0x1){_0x229afb=_0x411c86[_0x272660]['MetricId']?_0x1a7de6[_0x411c86[_0x272660]['MetricId']]['metric']:_0x411c86[_0x272660][_0xe9db('0x5e')];_0x229afb=_0x411c86[_0x272660][_0xe9db('0x68')]?_[_0xe9db('0x69')](_0x51f0b2[_0x411c86[_0x272660][_0xe9db('0x68')]],'%s',_0x229afb):_0x229afb;_0x229afb=_0x411c86[_0x272660][_0xe9db('0x6a')]?_[_0xe9db('0x69')](_0x576b8c[_0x411c86[_0x272660]['format']],'%s',_0x229afb):_0x229afb;if(_0x411c86[_0x272660][_0xe9db('0x6b')]){_0x164dc7[_0xe9db('0x5d')](_0x229afb);}_0x411c86[_0x272660][_0xe9db('0x6c')]&&_0x164dc7['order'](_0x229afb,_0x411c86[_0x272660][_0xe9db('0x6c')]==='DESC'?![]:!![]);_0x164dc7[_0xe9db('0x5e')](_0x229afb,_0x411c86[_0x272660][_0xe9db('0x6d')]||_0x229afb);}if(_0x384ec0[_0xe9db('0x6e')]){_0x384ec0['joins']=JSON['parse'](_0x384ec0[_0xe9db('0x6e')]);for(var _0x28ec84=0x0;_0x28ec84<_0x384ec0[_0xe9db('0x6e')]['length'];_0x28ec84+=0x1){if(_0x384ec0[_0xe9db('0x6e')][_0x28ec84][_0xe9db('0x2b')]&&_[_0xe9db('0x57')](_0x2f8f79,_0x384ec0[_0xe9db('0x6e')][_0x28ec84][_0xe9db('0x2b')])&&_0x384ec0['joins'][_0x28ec84]['parentKey']&&_0x384ec0[_0xe9db('0x6e')][_0x28ec84][_0xe9db('0x70')]&&_0x384ec0[_0xe9db('0x6e')][_0x28ec84][_0xe9db('0x72')]){_0x164dc7[_0x384ec0[_0xe9db('0x6e')][_0x28ec84]['type']](_0x384ec0[_0xe9db('0x6e')][_0x28ec84][_0xe9db('0x70')],null,util[_0xe9db('0x6a')](_0xe9db('0x71'),_0x384ec0[_0xe9db('0x67')],_0x384ec0[_0xe9db('0x6e')][_0x28ec84][_0xe9db('0x6f')],_0x384ec0['joins'][_0x28ec84][_0xe9db('0x70')],_0x384ec0[_0xe9db('0x6e')][_0x28ec84]['foreignKey']));}}}if(_0x384ec0[_0xe9db('0x73')]){_0x384ec0[_0xe9db('0x73')]=JSON['parse'](_0x384ec0[_0xe9db('0x73')]);_0x164dc7[_0xe9db('0x38')](_0x401dab(_0x384ec0[_0xe9db('0x73')][_0xe9db('0x5d')]));}_0x266608=_0x164dc7['clone']();_0x164dc7['limit'](_0x249e0);_0x164dc7['offset'](0x0);return;}})[_0xe9db('0x1d')](function(){if(_0x424f3e[_0xe9db('0x82')]===_0xe9db('0x83')){return null;}var _0x1f99c2=_[_0xe9db('0x39')](_0x424f3e,{'name':_0x424f3e[_0xe9db('0x84')]||_0x424f3e[_0xe9db('0x25')]||_0x384ec0['name'],'basename':_0x41d521,'savename':util[_0xe9db('0x6a')]('%s-%s.%s',_0x424f3e[_0xe9db('0x25')]||_0x384ec0[_0xe9db('0x25')],require(_0xe9db('0x85'))[_0xe9db('0x86')](0x4),_0x424f3e[_0xe9db('0x82')]||_0xe9db('0x87')),'reportId':_0x384ec0['id'],'reportType':_0xe9db('0x88')});return db[_0xe9db('0x89')][_0xe9db('0x43')](_0x1f99c2,{'raw':!![]});})[_0xe9db('0x1d')](function(_0x187a49){if(_0x384ec0[_0xe9db('0x67')]===_0xe9db('0x8a')){_0x266608[_0xe9db('0x38')](_0x384ec0[_0xe9db('0x67')]+_0xe9db('0x8b'),_0x424f3e[_0xe9db('0x8c')],_0x424f3e[_0xe9db('0x8d')]);}else{_0x266608['where'](_0x384ec0[_0xe9db('0x67')]+_0xe9db('0x8e'),_0x424f3e[_0xe9db('0x8c')],_0x424f3e[_0xe9db('0x8d')]);}if(_0x187a49){logger[_0xe9db('0x8f')](_0xe9db('0x90'),_0x266608[_0xe9db('0x76')]());require(_0xe9db('0x91'))[_0xe9db('0x92')](path[_0xe9db('0x4b')](__dirname,'../../components/export/',_0x187a49[_0xe9db('0x82')]),[_0x187a49['id'],_0x266608[_0xe9db('0x76')](),path[_0xe9db('0x4b')](__dirname,_0xe9db('0x93'),_0x187a49['savename']),_0x41d521]);return _0x187a49;}else{var _0x2af14e=squel['select']();_0x2af14e['from']('('+_0x266608[_0xe9db('0x76')]()+')',_0xe9db('0x94'));_0x2af14e[_0xe9db('0x5e')](_0xe9db('0x95'),'count');_0x266608[_0xe9db('0x18')](_0x424f3e['limit']||_0x249e0);_0x266608[_0xe9db('0x15')](_0x424f3e[_0xe9db('0x15')]||0x0);return dbH[_0xe9db('0x77')][_0xe9db('0x2e')](_0x2af14e[_0xe9db('0x76')](),{'type':dbH[_0xe9db('0x77')][_0xe9db('0x78')][_0xe9db('0x96')]})[_0xe9db('0x1d')](function(_0xc9945f){if(!_0xc9945f['length']){_0x12d6f4=0x0;}else{_0x12d6f4=_0xc9945f[0x0][_0xe9db('0x17')]||0x0;}return dbH['sequelize']['query'](_0x266608[_0xe9db('0x76')](),{'type':dbH[_0xe9db('0x77')][_0xe9db('0x78')][_0xe9db('0x96')]});})['then'](function(_0x5e4ab1){return{'rows':_0x5e4ab1||[],'count':_0x12d6f4};});}});}exports['run']=function(_0x45ae63,_0x581ca5){return runReport(_0x45ae63[_0xe9db('0x61')],_0x45ae63[_0xe9db('0x2e')],_0x45ae63[_0xe9db('0x3a')])[_0xe9db('0x1d')](respondWithResult(_0x581ca5,null))[_0xe9db('0x3e')](handleError(_0x581ca5,null));};exports[_0xe9db('0x97')]=runReport;exports[_0xe9db('0x2e')]=function(_0xcc8b4c,_0x525ce4){var _0x1a9a8d=0xa;var _0x3e60b5=[_0xe9db('0x4b'),_0xe9db('0x4c'),_0xe9db('0x4d'),_0xe9db('0x4e')];var _0x2cb280={'SUM':_0xe9db('0x4f'),'COUNT':_0xe9db('0x50'),'COUNT DISTINCT':_0xe9db('0x79'),'MAX':_0xe9db('0x51'),'MIN':_0xe9db('0x98'),'AVG':_0xe9db('0x7a'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xe9db('0x53')};var _0x168415={'SEC_TO_TIME':_0xe9db('0x7c'),'DATE':_0xe9db('0x7d'),'HOUR':'HOUR(%s)','ROUND':_0xe9db('0x55'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x280a56=function(_0x38a9cd){return!_[_0xe9db('0x57')](['IS\x20NULL',_0xe9db('0x58'),'IS\x20EMPTY',_0xe9db('0x5a')],_0x38a9cd);};var _0x3dfc7b=function(_0x41992f){if(!_0x41992f||!_0x41992f[_0xe9db('0x5c')][_0xe9db('0x41')]){return'';}for(var _0x5af3d0='(',_0x1a0943=0x0;_0x1a0943<_0x41992f[_0xe9db('0x5c')][_0xe9db('0x41')];_0x1a0943+=0x1){_0x1a0943>0x0&&(_0x5af3d0+='\x20'+_0x41992f[_0xe9db('0x5b')]+'\x20');_0x5af3d0+=_0x41992f[_0xe9db('0x5c')][_0x1a0943]['group']?_0x3dfc7b(_0x41992f[_0xe9db('0x5c')][_0x1a0943][_0xe9db('0x5d')]):_0x41992f[_0xe9db('0x5c')][_0x1a0943]['field']+'\x20'+_0x41992f[_0xe9db('0x5c')][_0x1a0943]['condition']+(_0x280a56(_0x41992f['rules'][_0x1a0943][_0xe9db('0x5f')])?'\x20'+_0x41992f['rules'][_0x1a0943][_0xe9db('0x60')]:'');}return _0x5af3d0+')';};var _0x35a91c={'where':{'id':_0xcc8b4c[_0xe9db('0x61')]['id']}},_0x2de0a4,_0x2e8e91,_0x5ab572,_0x46562d,_0x2bcff9;_0x35a91c=_[_0xe9db('0x39')]({},_0x35a91c,_0xcc8b4c[_0xe9db('0x3a')]);return db['AnalyticCustomReport'][_0xe9db('0x42')](_0x35a91c)[_0xe9db('0x1d')](function(_0x5bd5b5){if(_0x5bd5b5){_0x2de0a4=_0x5bd5b5;return _0x5bd5b5['getFields']();}return null;})[_0xe9db('0x1d')](function(_0x38b5cd){if(_0x38b5cd){if(!_0x38b5cd[_0xe9db('0x41')]){throw new db['Sequelize'][(_0xe9db('0x7f'))](_0xe9db('0x63'),0x193);}_0x2e8e91=_0x38b5cd;return db[_0xe9db('0x80')][_0xe9db('0x81')]({'raw':!![]});}return null;})[_0xe9db('0x1d')](function(_0x8c7881){if(_0x8c7881){_0x5ab572=_[_0xe9db('0x64')](_0x8c7881,'id');var _0x336532;var _0x1f339c=squel['select']();_0x1f339c['from'](_0x2de0a4['table']);for(var _0x284aef=0x0;_0x284aef<_0x2e8e91['length'];_0x284aef+=0x1){_0x336532=_0x2e8e91[_0x284aef][_0xe9db('0x99')]?_0x5ab572[_0x2e8e91[_0x284aef][_0xe9db('0x99')]]['metric']:_0x2e8e91[_0x284aef]['field'];_0x336532=_0x2e8e91[_0x284aef][_0xe9db('0x68')]?_[_0xe9db('0x69')](_0x2cb280[_0x2e8e91[_0x284aef][_0xe9db('0x68')]],'%s',_0x336532):_0x336532;_0x336532=_0x2e8e91[_0x284aef]['format']?_[_0xe9db('0x69')](_0x168415[_0x2e8e91[_0x284aef][_0xe9db('0x6a')]],'%s',_0x336532):_0x336532;if(_0x2e8e91[_0x284aef][_0xe9db('0x6b')]){_0x1f339c[_0xe9db('0x5d')](_0x336532);}_0x2e8e91[_0x284aef][_0xe9db('0x6c')]&&_0x1f339c[_0xe9db('0x35')](_0x336532,_0x2e8e91[_0x284aef][_0xe9db('0x6c')]===_0xe9db('0x9a')?![]:!![]);_0x1f339c['field'](_0x336532,_0x2e8e91[_0x284aef][_0xe9db('0x6d')]||_0x336532);}if(_0x2de0a4[_0xe9db('0x6e')]){_0x2de0a4['joins']=JSON[_0xe9db('0x9b')](_0x2de0a4[_0xe9db('0x6e')]);for(var _0x5e66d7=0x0;_0x5e66d7<_0x2de0a4[_0xe9db('0x6e')][_0xe9db('0x41')];_0x5e66d7+=0x1){if(_0x2de0a4[_0xe9db('0x6e')][_0x5e66d7]['type']&&_[_0xe9db('0x57')](_0x3e60b5,_0x2de0a4['joins'][_0x5e66d7][_0xe9db('0x2b')])&&_0x2de0a4[_0xe9db('0x6e')][_0x5e66d7][_0xe9db('0x6f')]&&_0x2de0a4[_0xe9db('0x6e')][_0x5e66d7]['foreignTable']&&_0x2de0a4[_0xe9db('0x6e')][_0x5e66d7][_0xe9db('0x72')]){_0x1f339c[_0x2de0a4['joins'][_0x5e66d7]['type']](_0x2de0a4[_0xe9db('0x6e')][_0x5e66d7][_0xe9db('0x70')],null,util[_0xe9db('0x6a')](_0xe9db('0x71'),_0x2de0a4['table'],_0x2de0a4[_0xe9db('0x6e')][_0x5e66d7][_0xe9db('0x6f')],_0x2de0a4[_0xe9db('0x6e')][_0x5e66d7][_0xe9db('0x70')],_0x2de0a4['joins'][_0x5e66d7][_0xe9db('0x72')]));}}}if(_0x2de0a4[_0xe9db('0x73')]){_0x2de0a4['conditions']=JSON[_0xe9db('0x9b')](_0x2de0a4[_0xe9db('0x73')]);_0x1f339c[_0xe9db('0x38')](_0x3dfc7b(_0x2de0a4[_0xe9db('0x73')][_0xe9db('0x5d')]));}_0x2bcff9=_0x1f339c['clone']();_0x1f339c[_0xe9db('0x18')](_0x1a9a8d);_0x1f339c['offset'](0x0);logger[_0xe9db('0x9c')](_0xe9db('0x75'),_0x1f339c['toString']());return dbH[_0xe9db('0x77')][_0xe9db('0x2e')](_0x1f339c['toString'](),{'type':dbH[_0xe9db('0x77')][_0xe9db('0x78')][_0xe9db('0x96')]});}})['then'](function(){return{'sql':_0x2bcff9[_0xe9db('0x76')]()};})[_0xe9db('0x1d')](respondWithResult(_0x525ce4,null))['catch'](handleError(_0x525ce4,null));}; \ No newline at end of file +var _0x5b92=['limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomReports','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','AnalyticCustomReport','findAll','rows','catch','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','userProfileId','preview','join','left_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','MetricId','replace','function','format','groupBy','DESC','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','table','foreignKey','conditions','debug','Limited\x20Query:','toString','sequelize','SELECT','right_join','cross_join','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','ROUND(%s)','IS\x20NOT\x20NULL','IS\x20EMPTY','from','metric','orderBy','clone','web','fullPath','%s-%s.%s','randomstring','output','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','countTable','COUNT(*)','QueryTypes','run','runReport','getFields','ValidationErrorItem','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','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','dbH','sendStatus','status','end','json','undefined'];(function(_0x3b6aaf,_0x4aef36){var _0x295fa9=function(_0x4320d3){while(--_0x4320d3){_0x3b6aaf['push'](_0x3b6aaf['shift']());}};_0x295fa9(++_0x4aef36);}(_0x5b92,0x136));var _0x25b9=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x5b92[_0x4709c0];return _0x13348b;};'use strict';var emlformat=require(_0x25b9('0x0'));var rimraf=require(_0x25b9('0x1'));var zipdir=require(_0x25b9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x25b9('0x3'));var moment=require(_0x25b9('0x4'));var BPromise=require(_0x25b9('0x5'));var Mustache=require(_0x25b9('0x6'));var util=require(_0x25b9('0x7'));var path=require('path');var sox=require(_0x25b9('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x25b9('0x9'));var _=require(_0x25b9('0xa'));var squel=require(_0x25b9('0xb'));var crypto=require(_0x25b9('0xc'));var jsforce=require(_0x25b9('0xd'));var deskjs=require(_0x25b9('0xe'));var toCsv=require('to-csv');var querystring=require(_0x25b9('0xf'));var Papa=require(_0x25b9('0x10'));var Redis=require(_0x25b9('0x11'));var authService=require(_0x25b9('0x12'));var qs=require(_0x25b9('0x13'));var as=require(_0x25b9('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x25b9('0x15'))(_0x25b9('0x16'));var utils=require('../../config/utils');var config=require(_0x25b9('0x17'));var licenseUtil=require(_0x25b9('0x18'));var db=require(_0x25b9('0x19'))['db'];var dbH=require(_0x25b9('0x19'))[_0x25b9('0x1a')];function respondWithStatusCode(_0x3a2142,_0x4fc533){_0x4fc533=_0x4fc533||0xcc;return function(_0x1d707b){if(_0x1d707b){return _0x3a2142[_0x25b9('0x1b')](_0x4fc533);}return _0x3a2142[_0x25b9('0x1c')](_0x4fc533)[_0x25b9('0x1d')]();};}function respondWithResult(_0x167bd4,_0x2a75a1){_0x2a75a1=_0x2a75a1||0xc8;return function(_0x4b3490){if(_0x4b3490){return _0x167bd4['status'](_0x2a75a1)[_0x25b9('0x1e')](_0x4b3490);}};}function respondWithFilteredResult(_0x48d525,_0x3d0060){return function(_0x45dc4e){if(_0x45dc4e){var _0x35480a=typeof _0x3d0060['offset']===_0x25b9('0x1f')&&typeof _0x3d0060[_0x25b9('0x20')]===_0x25b9('0x1f');var _0x5d49e7=_0x45dc4e[_0x25b9('0x21')];var _0x2ea238=_0x35480a?0x0:_0x3d0060[_0x25b9('0x22')];var _0x2823c0=_0x35480a?_0x45dc4e[_0x25b9('0x21')]:_0x3d0060[_0x25b9('0x22')]+_0x3d0060[_0x25b9('0x20')];var _0xebd747;if(_0x2823c0>=_0x5d49e7){_0x2823c0=_0x5d49e7;_0xebd747=0xc8;}else{_0xebd747=0xce;}_0x48d525['status'](_0xebd747);return _0x48d525[_0x25b9('0x23')](_0x25b9('0x24'),_0x2ea238+'-'+_0x2823c0+'/'+_0x5d49e7)['json'](_0x45dc4e);}return null;};}function patchUpdates(_0x4010ad){return function(_0x617037){try{jsonpatch[_0x25b9('0x25')](_0x617037,_0x4010ad,!![]);}catch(_0x566bc6){return BPromise[_0x25b9('0x26')](_0x566bc6);}return _0x617037[_0x25b9('0x27')]();};}function saveUpdates(_0x4a1deb,_0x27216a){return function(_0x48d695){if(_0x48d695){return _0x48d695[_0x25b9('0x28')](_0x4a1deb)[_0x25b9('0x29')](function(_0x40f660){return _0x40f660;});}return null;};}function removeEntity(_0x49bf5a,_0x487c06){return function(_0x187af9){if(_0x187af9){return _0x187af9[_0x25b9('0x2a')]()[_0x25b9('0x29')](function(){var _0x125129=_0x187af9[_0x25b9('0x2b')]({'plain':!![]});var _0x23dd02=_0x25b9('0x2c');return db[_0x25b9('0x2d')][_0x25b9('0x2a')]({'where':{'type':_0x23dd02,'resourceId':_0x125129['id']}})[_0x25b9('0x29')](function(){return _0x187af9;});})['then'](function(){_0x49bf5a['status'](0xcc)[_0x25b9('0x1d')]();});}};}function handleEntityNotFound(_0x1702a5,_0x39033f){return function(_0x520fe3){if(!_0x520fe3){_0x1702a5[_0x25b9('0x1b')](0x194);}return _0x520fe3;};}function handleError(_0xe07f4a,_0x1f38a6){_0x1f38a6=_0x1f38a6||0x1f4;return function(_0x2685da){logger[_0x25b9('0x2e')](_0x2685da['stack']);if(_0x2685da[_0x25b9('0x2f')]){delete _0x2685da['name'];}_0xe07f4a[_0x25b9('0x1c')](_0x1f38a6)[_0x25b9('0x30')](_0x2685da);};}exports[_0x25b9('0x31')]=function(_0x4094b3,_0x3a8a0b){var _0x2efdf6={},_0x1ea9b7={},_0x3c162e={'count':0x0,'rows':[]};var _0x5be3b8=_[_0x25b9('0x32')](db['AnalyticCustomReport'][_0x25b9('0x33')],function(_0x5db662){return{'name':_0x5db662[_0x25b9('0x34')],'type':_0x5db662['type']['key']};});_0x1ea9b7[_0x25b9('0x35')]=_['map'](_0x5be3b8,'name');_0x1ea9b7['query']=_[_0x25b9('0x36')](_0x4094b3[_0x25b9('0x37')]);_0x1ea9b7[_0x25b9('0x38')]=_[_0x25b9('0x39')](_0x1ea9b7[_0x25b9('0x35')],_0x1ea9b7[_0x25b9('0x37')]);_0x2efdf6[_0x25b9('0x3a')]=_[_0x25b9('0x39')](_0x1ea9b7[_0x25b9('0x35')],qs[_0x25b9('0x3b')](_0x4094b3['query'][_0x25b9('0x3b')]));_0x2efdf6[_0x25b9('0x3a')]=_0x2efdf6[_0x25b9('0x3a')]['length']?_0x2efdf6[_0x25b9('0x3a')]:_0x1ea9b7[_0x25b9('0x35')];if(!_0x4094b3[_0x25b9('0x37')][_0x25b9('0x3c')](_0x25b9('0x3d'))){_0x2efdf6[_0x25b9('0x20')]=qs[_0x25b9('0x20')](_0x4094b3[_0x25b9('0x37')][_0x25b9('0x20')]);_0x2efdf6[_0x25b9('0x22')]=qs[_0x25b9('0x22')](_0x4094b3['query'][_0x25b9('0x22')]);}_0x2efdf6[_0x25b9('0x3e')]=qs['sort'](_0x4094b3[_0x25b9('0x37')][_0x25b9('0x3f')]);_0x2efdf6[_0x25b9('0x40')]=qs[_0x25b9('0x38')](_[_0x25b9('0x41')](_0x4094b3[_0x25b9('0x37')],_0x1ea9b7[_0x25b9('0x38')]),_0x5be3b8);if(_0x4094b3[_0x25b9('0x37')]['filter']){_0x2efdf6['where']=_[_0x25b9('0x42')](_0x2efdf6[_0x25b9('0x40')],{'$or':_[_0x25b9('0x32')](_0x5be3b8,function(_0x34e24e){if(_0x34e24e[_0x25b9('0x43')]!==_0x25b9('0x44')){var _0x33fdce={};_0x33fdce[_0x34e24e[_0x25b9('0x2f')]]={'$like':'%'+_0x4094b3[_0x25b9('0x37')][_0x25b9('0x45')]+'%'};return _0x33fdce;}})});}_0x2efdf6=_[_0x25b9('0x42')]({},_0x2efdf6,_0x4094b3[_0x25b9('0x46')]);var _0xeb04b6={'where':_0x2efdf6[_0x25b9('0x40')]};return db['AnalyticCustomReport'][_0x25b9('0x21')](_0xeb04b6)[_0x25b9('0x29')](function(_0x2460d8){_0x3c162e['count']=_0x2460d8;if(_0x4094b3[_0x25b9('0x37')][_0x25b9('0x47')]){_0x2efdf6[_0x25b9('0x48')]=[{'all':!![]}];}return db[_0x25b9('0x49')][_0x25b9('0x4a')](_0x2efdf6);})[_0x25b9('0x29')](function(_0x279fc5){_0x3c162e[_0x25b9('0x4b')]=_0x279fc5;return _0x3c162e;})[_0x25b9('0x29')](respondWithFilteredResult(_0x3a8a0b,_0x2efdf6))[_0x25b9('0x4c')](handleError(_0x3a8a0b,null));};exports['show']=function(_0x35f4e3,_0xcf4e19){var _0x3ce8b3={'raw':![],'where':{'id':_0x35f4e3[_0x25b9('0x4d')]['id']}},_0x4c7e0e={};_0x4c7e0e[_0x25b9('0x35')]=_[_0x25b9('0x36')](db[_0x25b9('0x49')][_0x25b9('0x33')]);_0x4c7e0e[_0x25b9('0x37')]=_[_0x25b9('0x36')](_0x35f4e3['query']);_0x4c7e0e[_0x25b9('0x38')]=_[_0x25b9('0x39')](_0x4c7e0e[_0x25b9('0x35')],_0x4c7e0e['query']);_0x3ce8b3['attributes']=_['intersection'](_0x4c7e0e['model'],qs[_0x25b9('0x3b')](_0x35f4e3[_0x25b9('0x37')][_0x25b9('0x3b')]));_0x3ce8b3[_0x25b9('0x3a')]=_0x3ce8b3[_0x25b9('0x3a')][_0x25b9('0x4e')]?_0x3ce8b3[_0x25b9('0x3a')]:_0x4c7e0e[_0x25b9('0x35')];if(_0x35f4e3[_0x25b9('0x37')][_0x25b9('0x47')]){_0x3ce8b3['include']=[{'all':!![]}];}_0x3ce8b3=_[_0x25b9('0x42')]({},_0x3ce8b3,_0x35f4e3[_0x25b9('0x46')]);return db[_0x25b9('0x49')][_0x25b9('0x4f')](_0x3ce8b3)[_0x25b9('0x29')](handleEntityNotFound(_0xcf4e19,null))[_0x25b9('0x29')](respondWithResult(_0xcf4e19,null))[_0x25b9('0x4c')](handleError(_0xcf4e19,null));};exports[_0x25b9('0x50')]=function(_0x1a9b2a,_0x505c4b){return db[_0x25b9('0x49')]['create'](_0x1a9b2a[_0x25b9('0x51')],{})[_0x25b9('0x29')](function(_0x49936b){var _0x5e2921=_0x1a9b2a[_0x25b9('0x52')]['get']({'plain':!![]});if(!_0x5e2921)throw new Error(_0x25b9('0x53'));if(_0x5e2921['role']===_0x25b9('0x52')){var _0x39cdd9=_0x49936b['get']({'plain':!![]});var _0x5963a4=_0x25b9('0x54');return db[_0x25b9('0x55')][_0x25b9('0x4f')]({'where':{'name':_0x5963a4,'userProfileId':_0x5e2921[_0x25b9('0x56')]},'raw':!![]})[_0x25b9('0x29')](function(_0x10fd17){if(_0x10fd17&&_0x10fd17['autoAssociation']===0x0){return db[_0x25b9('0x2d')][_0x25b9('0x50')]({'name':_0x39cdd9[_0x25b9('0x2f')],'resourceId':_0x39cdd9['id'],'type':_0x25b9('0x2c'),'sectionId':_0x10fd17['id']},{})[_0x25b9('0x29')](function(){return _0x49936b;});}else{return _0x49936b;}})[_0x25b9('0x4c')](function(_0x35b0ab){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x35b0ab);throw _0x35b0ab;});}return _0x49936b;})[_0x25b9('0x29')](respondWithResult(_0x505c4b,0xc9))[_0x25b9('0x4c')](handleError(_0x505c4b,null));};exports['update']=function(_0x4ff0f3,_0x5bb249){if(_0x4ff0f3['body']['id']){delete _0x4ff0f3[_0x25b9('0x51')]['id'];}return db['AnalyticCustomReport'][_0x25b9('0x4f')]({'where':{'id':_0x4ff0f3[_0x25b9('0x4d')]['id']}})[_0x25b9('0x29')](handleEntityNotFound(_0x5bb249,null))[_0x25b9('0x29')](saveUpdates(_0x4ff0f3[_0x25b9('0x51')],null))[_0x25b9('0x29')](respondWithResult(_0x5bb249,null))['catch'](handleError(_0x5bb249,null));};exports[_0x25b9('0x2a')]=function(_0x27a56c,_0x3888d7){return db[_0x25b9('0x49')]['find']({'where':{'id':_0x27a56c['params']['id']}})[_0x25b9('0x29')](handleEntityNotFound(_0x3888d7,null))[_0x25b9('0x29')](removeEntity(_0x3888d7,null))[_0x25b9('0x4c')](handleError(_0x3888d7,null));};exports[_0x25b9('0x57')]=function(_0x3fa419,_0x21ecbd){var _0x59760b=0xa;var _0x437345=[_0x25b9('0x58'),_0x25b9('0x59'),'right_join','cross_join'];var _0x3f2fc7={'SUM':_0x25b9('0x5a'),'COUNT':_0x25b9('0x5b'),'COUNT DISTINCT':_0x25b9('0x5c'),'MAX':'MAX(%s)','MIN':_0x25b9('0x5d'),'AVG':_0x25b9('0x5e'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x25b9('0x5f')};var _0x37eb95={'SEC_TO_TIME':_0x25b9('0x60'),'DATE':_0x25b9('0x61'),'HOUR':_0x25b9('0x62'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x25b9('0x63')};var _0x212b3b=function(_0x5381d4){return!_[_0x25b9('0x64')]([_0x25b9('0x65'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x25b9('0x66')],_0x5381d4);};var _0x4e0864=function(_0xe70ed1){if(!_0xe70ed1||!_0xe70ed1[_0x25b9('0x67')][_0x25b9('0x4e')]){return'';}for(var _0x4a2b3c='(',_0x4c376c=0x0;_0x4c376c<_0xe70ed1['rules'][_0x25b9('0x4e')];_0x4c376c+=0x1){_0x4c376c>0x0&&(_0x4a2b3c+='\x20'+_0xe70ed1[_0x25b9('0x68')]+'\x20');_0x4a2b3c+=_0xe70ed1['rules'][_0x4c376c][_0x25b9('0x69')]?_0x4e0864(_0xe70ed1[_0x25b9('0x67')][_0x4c376c][_0x25b9('0x69')]):_0xe70ed1[_0x25b9('0x67')][_0x4c376c][_0x25b9('0x6a')]+'\x20'+_0xe70ed1[_0x25b9('0x67')][_0x4c376c][_0x25b9('0x6b')]+(_0x212b3b(_0xe70ed1[_0x25b9('0x67')][_0x4c376c][_0x25b9('0x6b')])?'\x20'+_0xe70ed1['rules'][_0x4c376c][_0x25b9('0x6c')]:'');}return _0x4a2b3c+')';};var _0x4a889b={'where':{'id':_0x3fa419['params']['id']}},_0x54adff,_0x37185b,_0x20a799,_0x9717e4,_0x3b0fbb;_0x4a889b=_['merge']({},_0x4a889b,_0x3fa419[_0x25b9('0x46')]);return db[_0x25b9('0x49')]['find'](_0x4a889b)['then'](function(_0x3615bb){if(_0x3615bb){_0x54adff=_0x3615bb;return _0x3615bb['getFields']();}return null;})['then'](function(_0x38cc29){if(_0x38cc29){if(!_0x38cc29['length']){throw new db[(_0x25b9('0x6d'))]['ValidationErrorItem'](_0x25b9('0x6e'),0x193);}_0x37185b=_0x38cc29;return db[_0x25b9('0x6f')]['findAll']({'raw':!![]});}return null;})[_0x25b9('0x29')](function(_0x11c427){if(_0x11c427){_0x20a799=_[_0x25b9('0x70')](_0x11c427,'id');var _0x55fd0e;var _0x3addea=squel[_0x25b9('0x71')]();_0x3addea['from'](_0x54adff['table']);for(var _0x68f84e=0x0;_0x68f84e<_0x37185b['length'];_0x68f84e+=0x1){_0x55fd0e=_0x37185b[_0x68f84e][_0x25b9('0x72')]?_0x20a799[_0x37185b[_0x68f84e][_0x25b9('0x72')]]['metric']:_0x37185b[_0x68f84e]['field'];_0x55fd0e=_0x37185b[_0x68f84e]['function']?_[_0x25b9('0x73')](_0x3f2fc7[_0x37185b[_0x68f84e][_0x25b9('0x74')]],'%s',_0x55fd0e):_0x55fd0e;_0x55fd0e=_0x37185b[_0x68f84e][_0x25b9('0x75')]?_[_0x25b9('0x73')](_0x37eb95[_0x37185b[_0x68f84e][_0x25b9('0x75')]],'%s',_0x55fd0e):_0x55fd0e;if(_0x37185b[_0x68f84e][_0x25b9('0x76')]){_0x3addea[_0x25b9('0x69')](_0x55fd0e);}_0x37185b[_0x68f84e]['orderBy']&&_0x3addea[_0x25b9('0x3e')](_0x55fd0e,_0x37185b[_0x68f84e]['orderBy']===_0x25b9('0x77')?![]:!![]);_0x3addea[_0x25b9('0x6a')](_0x55fd0e,_0x37185b[_0x68f84e][_0x25b9('0x78')]||_0x55fd0e);}if(_0x54adff[_0x25b9('0x79')]){_0x54adff[_0x25b9('0x79')]=JSON[_0x25b9('0x7a')](_0x54adff[_0x25b9('0x79')]);for(var _0x44a9d7=0x0;_0x44a9d7<_0x54adff[_0x25b9('0x79')][_0x25b9('0x4e')];_0x44a9d7+=0x1){if(_0x54adff['joins'][_0x44a9d7]['type']&&_[_0x25b9('0x64')](_0x437345,_0x54adff[_0x25b9('0x79')][_0x44a9d7][_0x25b9('0x43')])&&_0x54adff['joins'][_0x44a9d7][_0x25b9('0x7b')]&&_0x54adff['joins'][_0x44a9d7][_0x25b9('0x7c')]&&_0x54adff[_0x25b9('0x79')][_0x44a9d7]['foreignKey']){_0x3addea[_0x54adff[_0x25b9('0x79')][_0x44a9d7][_0x25b9('0x43')]](_0x54adff[_0x25b9('0x79')][_0x44a9d7]['foreignTable'],null,util[_0x25b9('0x75')](_0x25b9('0x7d'),_0x54adff[_0x25b9('0x7e')],_0x54adff[_0x25b9('0x79')][_0x44a9d7][_0x25b9('0x7b')],_0x54adff['joins'][_0x44a9d7][_0x25b9('0x7c')],_0x54adff[_0x25b9('0x79')][_0x44a9d7][_0x25b9('0x7f')]));}}}if(_0x54adff[_0x25b9('0x80')]){_0x54adff[_0x25b9('0x80')]=JSON[_0x25b9('0x7a')](_0x54adff['conditions']);_0x3addea[_0x25b9('0x40')](_0x4e0864(_0x54adff['conditions']['group']));}_0x3b0fbb=_0x3addea['clone']();_0x3addea['limit'](_0x59760b);_0x3addea[_0x25b9('0x22')](0x0);logger[_0x25b9('0x81')](_0x25b9('0x82'),_0x3addea[_0x25b9('0x83')]());return dbH['sequelize']['query'](_0x3addea['toString'](),{'type':dbH[_0x25b9('0x84')]['QueryTypes'][_0x25b9('0x85')]});}})[_0x25b9('0x29')](respondWithResult(_0x21ecbd,null))[_0x25b9('0x4c')](handleError(_0x21ecbd,null));};function runReport(_0x9f9a83,_0x20fb38,_0x2a9a6d){var _0x1ca6d1=_0x20fb38['name'];var _0x53e621=0xa;var _0x52d224=[_0x25b9('0x58'),_0x25b9('0x59'),_0x25b9('0x86'),_0x25b9('0x87')];var _0x5a8ea1={'SUM':_0x25b9('0x5a'),'COUNT':_0x25b9('0x5b'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x25b9('0x88'),'MIN':'MIN(%s)','AVG':_0x25b9('0x5e'),'GROUP_CONCAT':_0x25b9('0x89'),'GROUP_CONCAT ASC':_0x25b9('0x8a'),'GROUP_CONCAT DESC':_0x25b9('0x5f')};var _0x360bfa={'SEC_TO_TIME':_0x25b9('0x60'),'DATE':_0x25b9('0x61'),'HOUR':_0x25b9('0x62'),'ROUND':_0x25b9('0x8b'),'UNIX_TIMESTAMP':_0x25b9('0x63')};var _0x23ef7f=function(_0x44244e){return!_['includes']([_0x25b9('0x65'),_0x25b9('0x8c'),_0x25b9('0x8d'),_0x25b9('0x66')],_0x44244e);};var _0x4f7e7f=function(_0x3659ea){if(!_0x3659ea||!_0x3659ea[_0x25b9('0x67')][_0x25b9('0x4e')]){return'';}for(var _0x1c43b8='(',_0x108b42=0x0;_0x108b42<_0x3659ea[_0x25b9('0x67')]['length'];_0x108b42+=0x1){_0x108b42>0x0&&(_0x1c43b8+='\x20'+_0x3659ea[_0x25b9('0x68')]+'\x20');_0x1c43b8+=_0x3659ea[_0x25b9('0x67')][_0x108b42][_0x25b9('0x69')]?_0x4f7e7f(_0x3659ea[_0x25b9('0x67')][_0x108b42]['group']):_0x3659ea[_0x25b9('0x67')][_0x108b42][_0x25b9('0x6a')]+'\x20'+_0x3659ea[_0x25b9('0x67')][_0x108b42][_0x25b9('0x6b')]+(_0x23ef7f(_0x3659ea[_0x25b9('0x67')][_0x108b42]['condition'])?'\x20'+_0x3659ea['rules'][_0x108b42]['value']:'');}return _0x1c43b8+')';};var _0x46ee63={'where':{'id':_0x9f9a83['id']}},_0x57f747,_0x107d9a,_0x10a23e,_0x158ea1,_0x5191c1;_0x46ee63=_['merge']({},_0x46ee63,_0x2a9a6d);return db[_0x25b9('0x49')][_0x25b9('0x4f')](_0x46ee63)['then'](function(_0xb7769c){if(_0xb7769c){_0x57f747=_0xb7769c;return _0xb7769c['getFields']();}return null;})[_0x25b9('0x29')](function(_0x3213e4){if(_0x3213e4){if(!_0x3213e4[_0x25b9('0x4e')]){throw new db[(_0x25b9('0x6d'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x107d9a=_0x3213e4;return db[_0x25b9('0x6f')][_0x25b9('0x4a')]({'raw':!![]});}return null;})[_0x25b9('0x29')](function(_0x3c2f3f){if(_0x3c2f3f){_0x10a23e=_['keyBy'](_0x3c2f3f,'id');var _0x5d5463;var _0x5876d7=squel[_0x25b9('0x71')]();_0x5876d7[_0x25b9('0x8e')](_0x57f747['table']);for(var _0x2956ad=0x0;_0x2956ad<_0x107d9a[_0x25b9('0x4e')];_0x2956ad+=0x1){_0x5d5463=_0x107d9a[_0x2956ad][_0x25b9('0x72')]?_0x10a23e[_0x107d9a[_0x2956ad][_0x25b9('0x72')]][_0x25b9('0x8f')]:_0x107d9a[_0x2956ad][_0x25b9('0x6a')];_0x5d5463=_0x107d9a[_0x2956ad][_0x25b9('0x74')]?_[_0x25b9('0x73')](_0x5a8ea1[_0x107d9a[_0x2956ad][_0x25b9('0x74')]],'%s',_0x5d5463):_0x5d5463;_0x5d5463=_0x107d9a[_0x2956ad][_0x25b9('0x75')]?_['replace'](_0x360bfa[_0x107d9a[_0x2956ad][_0x25b9('0x75')]],'%s',_0x5d5463):_0x5d5463;if(_0x107d9a[_0x2956ad][_0x25b9('0x76')]){_0x5876d7[_0x25b9('0x69')](_0x5d5463);}_0x107d9a[_0x2956ad][_0x25b9('0x90')]&&_0x5876d7[_0x25b9('0x3e')](_0x5d5463,_0x107d9a[_0x2956ad][_0x25b9('0x90')]===_0x25b9('0x77')?![]:!![]);_0x5876d7[_0x25b9('0x6a')](_0x5d5463,_0x107d9a[_0x2956ad][_0x25b9('0x78')]||_0x5d5463);}if(_0x57f747[_0x25b9('0x79')]){_0x57f747[_0x25b9('0x79')]=JSON[_0x25b9('0x7a')](_0x57f747[_0x25b9('0x79')]);for(var _0x4e7b11=0x0;_0x4e7b11<_0x57f747[_0x25b9('0x79')][_0x25b9('0x4e')];_0x4e7b11+=0x1){if(_0x57f747[_0x25b9('0x79')][_0x4e7b11][_0x25b9('0x43')]&&_[_0x25b9('0x64')](_0x52d224,_0x57f747[_0x25b9('0x79')][_0x4e7b11][_0x25b9('0x43')])&&_0x57f747[_0x25b9('0x79')][_0x4e7b11]['parentKey']&&_0x57f747[_0x25b9('0x79')][_0x4e7b11]['foreignTable']&&_0x57f747[_0x25b9('0x79')][_0x4e7b11][_0x25b9('0x7f')]){_0x5876d7[_0x57f747[_0x25b9('0x79')][_0x4e7b11][_0x25b9('0x43')]](_0x57f747[_0x25b9('0x79')][_0x4e7b11][_0x25b9('0x7c')],null,util[_0x25b9('0x75')]('%s.%s\x20=\x20%s.%s',_0x57f747['table'],_0x57f747[_0x25b9('0x79')][_0x4e7b11][_0x25b9('0x7b')],_0x57f747[_0x25b9('0x79')][_0x4e7b11][_0x25b9('0x7c')],_0x57f747['joins'][_0x4e7b11][_0x25b9('0x7f')]));}}}if(_0x57f747[_0x25b9('0x80')]){_0x57f747[_0x25b9('0x80')]=JSON['parse'](_0x57f747['conditions']);_0x5876d7['where'](_0x4f7e7f(_0x57f747['conditions'][_0x25b9('0x69')]));}_0x5191c1=_0x5876d7[_0x25b9('0x91')]();_0x5876d7[_0x25b9('0x20')](_0x53e621);_0x5876d7[_0x25b9('0x22')](0x0);return;}})[_0x25b9('0x29')](function(){if(_0x20fb38['output']===_0x25b9('0x92')){return null;}var _0xc876e9=_[_0x25b9('0x42')](_0x20fb38,{'name':_0x20fb38[_0x25b9('0x93')]||_0x20fb38['name']||_0x57f747['name'],'basename':_0x1ca6d1,'savename':util[_0x25b9('0x75')](_0x25b9('0x94'),_0x20fb38[_0x25b9('0x2f')]||_0x57f747[_0x25b9('0x2f')],require(_0x25b9('0x95'))['generate'](0x4),_0x20fb38[_0x25b9('0x96')]||_0x25b9('0x97')),'reportId':_0x57f747['id'],'reportType':_0x25b9('0x98')});return db[_0x25b9('0x99')][_0x25b9('0x50')](_0xc876e9,{'raw':!![]});})[_0x25b9('0x29')](function(_0x5537e1){if(_0x57f747[_0x25b9('0x7e')]===_0x25b9('0x9a')){_0x5191c1[_0x25b9('0x40')](_0x57f747[_0x25b9('0x7e')]+_0x25b9('0x9b'),_0x20fb38[_0x25b9('0x9c')],_0x20fb38[_0x25b9('0x9d')]);}else{_0x5191c1[_0x25b9('0x40')](_0x57f747[_0x25b9('0x7e')]+_0x25b9('0x9e'),_0x20fb38[_0x25b9('0x9c')],_0x20fb38[_0x25b9('0x9d')]);}if(_0x5537e1){logger[_0x25b9('0x9f')](_0x25b9('0xa0'),_0x5191c1[_0x25b9('0x83')]());require(_0x25b9('0xa1'))[_0x25b9('0xa2')](path[_0x25b9('0x58')](__dirname,_0x25b9('0xa3'),_0x5537e1[_0x25b9('0x96')]),[_0x5537e1['id'],_0x5191c1['toString'](),path[_0x25b9('0x58')](__dirname,'../../files/reports',_0x5537e1['savename']),_0x1ca6d1]);return _0x5537e1;}else{var _0x393d32=squel[_0x25b9('0x71')]();_0x393d32['from']('('+_0x5191c1[_0x25b9('0x83')]()+')',_0x25b9('0xa4'));_0x393d32[_0x25b9('0x6a')](_0x25b9('0xa5'),_0x25b9('0x21'));_0x5191c1[_0x25b9('0x20')](_0x20fb38[_0x25b9('0x20')]||_0x53e621);_0x5191c1['offset'](_0x20fb38[_0x25b9('0x22')]||0x0);return dbH[_0x25b9('0x84')]['query'](_0x393d32[_0x25b9('0x83')](),{'type':dbH[_0x25b9('0x84')]['QueryTypes'][_0x25b9('0x85')]})['then'](function(_0x3cf8c1){if(!_0x3cf8c1['length']){_0x158ea1=0x0;}else{_0x158ea1=_0x3cf8c1[0x0][_0x25b9('0x21')]||0x0;}return dbH[_0x25b9('0x84')][_0x25b9('0x37')](_0x5191c1[_0x25b9('0x83')](),{'type':dbH[_0x25b9('0x84')][_0x25b9('0xa6')][_0x25b9('0x85')]});})[_0x25b9('0x29')](function(_0x54d639){return{'rows':_0x54d639||[],'count':_0x158ea1};});}});}exports[_0x25b9('0xa7')]=function(_0x565c99,_0xfcdd90){return runReport(_0x565c99[_0x25b9('0x4d')],_0x565c99[_0x25b9('0x37')],_0x565c99['options'])[_0x25b9('0x29')](respondWithResult(_0xfcdd90,null))[_0x25b9('0x4c')](handleError(_0xfcdd90,null));};exports[_0x25b9('0xa8')]=runReport;exports[_0x25b9('0x37')]=function(_0x4aa71a,_0x229dad){var _0x36d962=0xa;var _0x261d0c=['join','left_join',_0x25b9('0x86'),_0x25b9('0x87')];var _0x109fc1={'SUM':_0x25b9('0x5a'),'COUNT':_0x25b9('0x5b'),'COUNT DISTINCT':_0x25b9('0x5c'),'MAX':_0x25b9('0x88'),'MIN':'MIN(%s)','AVG':_0x25b9('0x5e'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x25b9('0x8a'),'GROUP_CONCAT DESC':_0x25b9('0x5f')};var _0x31b55b={'SEC_TO_TIME':_0x25b9('0x60'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x25b9('0x8b'),'UNIX_TIMESTAMP':_0x25b9('0x63')};var _0x2867f4=function(_0x93f829){return!_['includes'](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY',_0x25b9('0x66')],_0x93f829);};var _0x5d12b6=function(_0xdf066){if(!_0xdf066||!_0xdf066['rules']['length']){return'';}for(var _0x47e2af='(',_0x5ed90f=0x0;_0x5ed90f<_0xdf066[_0x25b9('0x67')][_0x25b9('0x4e')];_0x5ed90f+=0x1){_0x5ed90f>0x0&&(_0x47e2af+='\x20'+_0xdf066[_0x25b9('0x68')]+'\x20');_0x47e2af+=_0xdf066[_0x25b9('0x67')][_0x5ed90f][_0x25b9('0x69')]?_0x5d12b6(_0xdf066['rules'][_0x5ed90f][_0x25b9('0x69')]):_0xdf066[_0x25b9('0x67')][_0x5ed90f][_0x25b9('0x6a')]+'\x20'+_0xdf066['rules'][_0x5ed90f]['condition']+(_0x2867f4(_0xdf066[_0x25b9('0x67')][_0x5ed90f]['condition'])?'\x20'+_0xdf066[_0x25b9('0x67')][_0x5ed90f]['value']:'');}return _0x47e2af+')';};var _0x169b92={'where':{'id':_0x4aa71a[_0x25b9('0x4d')]['id']}},_0x2f4f45,_0xf5fbd6,_0x2e8f01,_0x2b8ff1,_0xc829e6;_0x169b92=_[_0x25b9('0x42')]({},_0x169b92,_0x4aa71a[_0x25b9('0x46')]);return db[_0x25b9('0x49')][_0x25b9('0x4f')](_0x169b92)[_0x25b9('0x29')](function(_0xaa00f7){if(_0xaa00f7){_0x2f4f45=_0xaa00f7;return _0xaa00f7[_0x25b9('0xa9')]();}return null;})[_0x25b9('0x29')](function(_0x45aa6d){if(_0x45aa6d){if(!_0x45aa6d[_0x25b9('0x4e')]){throw new db[(_0x25b9('0x6d'))][(_0x25b9('0xaa'))](_0x25b9('0x6e'),0x193);}_0xf5fbd6=_0x45aa6d;return db[_0x25b9('0x6f')][_0x25b9('0x4a')]({'raw':!![]});}return null;})[_0x25b9('0x29')](function(_0x45b3bb){if(_0x45b3bb){_0x2e8f01=_[_0x25b9('0x70')](_0x45b3bb,'id');var _0x14de18;var _0x35e95c=squel[_0x25b9('0x71')]();_0x35e95c[_0x25b9('0x8e')](_0x2f4f45[_0x25b9('0x7e')]);for(var _0x25ed90=0x0;_0x25ed90<_0xf5fbd6['length'];_0x25ed90+=0x1){_0x14de18=_0xf5fbd6[_0x25ed90][_0x25b9('0x72')]?_0x2e8f01[_0xf5fbd6[_0x25ed90][_0x25b9('0x72')]][_0x25b9('0x8f')]:_0xf5fbd6[_0x25ed90][_0x25b9('0x6a')];_0x14de18=_0xf5fbd6[_0x25ed90][_0x25b9('0x74')]?_[_0x25b9('0x73')](_0x109fc1[_0xf5fbd6[_0x25ed90]['function']],'%s',_0x14de18):_0x14de18;_0x14de18=_0xf5fbd6[_0x25ed90][_0x25b9('0x75')]?_['replace'](_0x31b55b[_0xf5fbd6[_0x25ed90][_0x25b9('0x75')]],'%s',_0x14de18):_0x14de18;if(_0xf5fbd6[_0x25ed90][_0x25b9('0x76')]){_0x35e95c['group'](_0x14de18);}_0xf5fbd6[_0x25ed90][_0x25b9('0x90')]&&_0x35e95c[_0x25b9('0x3e')](_0x14de18,_0xf5fbd6[_0x25ed90][_0x25b9('0x90')]===_0x25b9('0x77')?![]:!![]);_0x35e95c[_0x25b9('0x6a')](_0x14de18,_0xf5fbd6[_0x25ed90][_0x25b9('0x78')]||_0x14de18);}if(_0x2f4f45['joins']){_0x2f4f45[_0x25b9('0x79')]=JSON[_0x25b9('0x7a')](_0x2f4f45['joins']);for(var _0x2e4724=0x0;_0x2e4724<_0x2f4f45[_0x25b9('0x79')][_0x25b9('0x4e')];_0x2e4724+=0x1){if(_0x2f4f45[_0x25b9('0x79')][_0x2e4724]['type']&&_['includes'](_0x261d0c,_0x2f4f45[_0x25b9('0x79')][_0x2e4724][_0x25b9('0x43')])&&_0x2f4f45[_0x25b9('0x79')][_0x2e4724][_0x25b9('0x7b')]&&_0x2f4f45[_0x25b9('0x79')][_0x2e4724][_0x25b9('0x7c')]&&_0x2f4f45[_0x25b9('0x79')][_0x2e4724][_0x25b9('0x7f')]){_0x35e95c[_0x2f4f45[_0x25b9('0x79')][_0x2e4724][_0x25b9('0x43')]](_0x2f4f45['joins'][_0x2e4724][_0x25b9('0x7c')],null,util[_0x25b9('0x75')](_0x25b9('0x7d'),_0x2f4f45[_0x25b9('0x7e')],_0x2f4f45[_0x25b9('0x79')][_0x2e4724][_0x25b9('0x7b')],_0x2f4f45[_0x25b9('0x79')][_0x2e4724][_0x25b9('0x7c')],_0x2f4f45[_0x25b9('0x79')][_0x2e4724][_0x25b9('0x7f')]));}}}if(_0x2f4f45['conditions']){_0x2f4f45[_0x25b9('0x80')]=JSON[_0x25b9('0x7a')](_0x2f4f45[_0x25b9('0x80')]);_0x35e95c[_0x25b9('0x40')](_0x5d12b6(_0x2f4f45[_0x25b9('0x80')]['group']));}_0xc829e6=_0x35e95c['clone']();_0x35e95c['limit'](_0x36d962);_0x35e95c[_0x25b9('0x22')](0x0);logger['debug']('Limited\x20Query:',_0x35e95c[_0x25b9('0x83')]());return dbH[_0x25b9('0x84')][_0x25b9('0x37')](_0x35e95c[_0x25b9('0x83')](),{'type':dbH['sequelize']['QueryTypes'][_0x25b9('0x85')]});}})['then'](function(){return{'sql':_0xc829e6[_0x25b9('0x83')]()};})[_0x25b9('0x29')](respondWithResult(_0x229dad,null))[_0x25b9('0x4c')](handleError(_0x229dad,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 5fe663e..9840563 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 _0x3f28=['exports','define','AnalyticCustomReport','analytics_custom_reports','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3c154f,_0x13ba7e){var _0x157712=function(_0x29fb75){while(--_0x29fb75){_0x3c154f['push'](_0x3c154f['shift']());}};_0x157712(++_0x13ba7e);}(_0x3f28,0x1c7));var _0x83f2=function(_0x37ad30,_0x204a61){_0x37ad30=_0x37ad30-0x0;var _0x2a0654=_0x3f28[_0x37ad30];return _0x2a0654;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x83f2('0x0'))(_0x83f2('0x1'));var moment=require(_0x83f2('0x2'));var BPromise=require(_0x83f2('0x3'));var rp=require(_0x83f2('0x4'));var fs=require('fs');var path=require(_0x83f2('0x5'));var rimraf=require(_0x83f2('0x6'));var config=require('../../config/environment');var attributes=require('./analyticCustomReport.attributes');module[_0x83f2('0x7')]=function(_0x571c09,_0x31845e){return _0x571c09[_0x83f2('0x8')](_0x83f2('0x9'),attributes,{'tableName':_0x83f2('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc617=['define','AnalyticCustomReport','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports'];(function(_0x418601,_0x150290){var _0x5f354f=function(_0x4bf8c5){while(--_0x4bf8c5){_0x418601['push'](_0x418601['shift']());}};_0x5f354f(++_0x150290);}(_0xc617,0x154));var _0x7c61=function(_0x2d2ec8,_0x3f04b1){_0x2d2ec8=_0x2d2ec8-0x0;var _0x30e4e9=_0xc617[_0x2d2ec8];return _0x30e4e9;};'use strict';var _=require(_0x7c61('0x0'));var util=require(_0x7c61('0x1'));var logger=require(_0x7c61('0x2'))(_0x7c61('0x3'));var moment=require('moment');var BPromise=require(_0x7c61('0x4'));var rp=require(_0x7c61('0x5'));var fs=require('fs');var path=require(_0x7c61('0x6'));var rimraf=require(_0x7c61('0x7'));var config=require(_0x7c61('0x8'));var attributes=require(_0x7c61('0x9'));module[_0x7c61('0xa')]=function(_0x957979,_0x25c8fb){return _0x957979[_0x7c61('0xb')](_0x7c61('0xc'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index c7c464c..b14bd3e 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 _0x64f9=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticCustomReport,\x20%s,\x20%s','message','catch','lodash'];(function(_0x1e6b59,_0x5eca5d){var _0x40d7c5=function(_0x2dd544){while(--_0x2dd544){_0x1e6b59['push'](_0x1e6b59['shift']());}};_0x40d7c5(++_0x5eca5d);}(_0x64f9,0x110));var _0x964f=function(_0x2984d0,_0x1a7211){_0x2984d0=_0x2984d0-0x0;var _0x2885f2=_0x64f9[_0x2984d0];return _0x2885f2;};'use strict';var _=require(_0x964f('0x0'));var util=require(_0x964f('0x1'));var moment=require(_0x964f('0x2'));var BPromise=require(_0x964f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x964f('0x4'));var db=require(_0x964f('0x5'))['db'];var utils=require(_0x964f('0x6'));var logger=require(_0x964f('0x7'))(_0x964f('0x8'));var config=require(_0x964f('0x9'));var jayson=require(_0x964f('0xa'));var client=jayson[_0x964f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ac80d,_0x5503e1,_0x9c2f7c){return new BPromise(function(_0x212926,_0x30486b){return client[_0x964f('0xc')](_0x1ac80d,_0x9c2f7c)[_0x964f('0xd')](function(_0x56f940){logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x5503e1,_0x964f('0xe'));logger['debug'](_0x964f('0xf'),_0x5503e1,_0x964f('0xe'),JSON[_0x964f('0x10')](_0x56f940));if(_0x56f940[_0x964f('0x11')]){if(_0x56f940[_0x964f('0x11')]['code']===0x1f4){logger[_0x964f('0x11')](_0x964f('0x12'),_0x5503e1,_0x56f940[_0x964f('0x11')]['message']);return _0x30486b(_0x56f940[_0x964f('0x11')]['message']);}logger[_0x964f('0x11')](_0x964f('0x12'),_0x5503e1,_0x56f940[_0x964f('0x11')][_0x964f('0x13')]);return _0x212926(_0x56f940[_0x964f('0x11')][_0x964f('0x13')]);}else{logger['info'](_0x964f('0x12'),_0x5503e1,_0x964f('0xe'));_0x212926(_0x56f940['result'][_0x964f('0x13')]);}})[_0x964f('0x14')](function(_0x44d3f1){logger['error'](_0x964f('0x12'),_0x5503e1,_0x44d3f1);_0x30486b(_0x44d3f1);});});} \ No newline at end of file +var _0x6ca7=['result','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x27604f,_0x5ae336){var _0x40d189=function(_0xebacde){while(--_0xebacde){_0x27604f['push'](_0x27604f['shift']());}};_0x40d189(++_0x5ae336);}(_0x6ca7,0x1b9));var _0x76ca=function(_0x996bc8,_0x291e01){_0x996bc8=_0x996bc8-0x0;var _0x20b0ea=_0x6ca7[_0x996bc8];return _0x20b0ea;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x76ca('0x0'));var rs=require(_0x76ca('0x1'));var fs=require('fs');var Redis=require(_0x76ca('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x76ca('0x3'));var logger=require(_0x76ca('0x4'))(_0x76ca('0x5'));var config=require(_0x76ca('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x76ca('0x7')][_0x76ca('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x484082,_0x58c87d,_0x5ba4dc){return new BPromise(function(_0x55f53b,_0x157727){return client[_0x76ca('0x9')](_0x484082,_0x5ba4dc)['then'](function(_0x506b3f){logger[_0x76ca('0xa')](_0x76ca('0xb'),_0x58c87d,_0x76ca('0xc'));logger[_0x76ca('0xd')](_0x76ca('0xe'),_0x58c87d,'request\x20sent',JSON[_0x76ca('0xf')](_0x506b3f));if(_0x506b3f[_0x76ca('0x10')]){if(_0x506b3f['error'][_0x76ca('0x11')]===0x1f4){logger[_0x76ca('0x10')](_0x76ca('0xb'),_0x58c87d,_0x506b3f[_0x76ca('0x10')]['message']);return _0x157727(_0x506b3f['error'][_0x76ca('0x12')]);}logger[_0x76ca('0x10')](_0x76ca('0xb'),_0x58c87d,_0x506b3f[_0x76ca('0x10')]['message']);return _0x55f53b(_0x506b3f['error']['message']);}else{logger['info'](_0x76ca('0xb'),_0x58c87d,_0x76ca('0xc'));_0x55f53b(_0x506b3f[_0x76ca('0x13')][_0x76ca('0x12')]);}})['catch'](function(_0x1eb2f7){logger[_0x76ca('0x10')](_0x76ca('0xb'),_0x58c87d,_0x1eb2f7);_0x157727(_0x1eb2f7);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 88e69f2..9c12679 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 _0xb99a=['delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','index','/:id','isAuthenticated','show','preview','/:id/run','run','query','post','update'];(function(_0x33d5a4,_0x58ec9a){var _0x24cb8e=function(_0xf6fd21){while(--_0xf6fd21){_0x33d5a4['push'](_0x33d5a4['shift']());}};_0x24cb8e(++_0x58ec9a);}(_0xb99a,0x16a));var _0xab99=function(_0x3ed8ba,_0x17ed23){_0x3ed8ba=_0x3ed8ba-0x0;var _0x439ebd=_0xb99a[_0x3ed8ba];return _0x439ebd;};'use strict';var multer=require(_0xab99('0x0'));var util=require(_0xab99('0x1'));var path=require(_0xab99('0x2'));var timeout=require(_0xab99('0x3'));var express=require(_0xab99('0x4'));var router=express[_0xab99('0x5')]();var fs_extra=require(_0xab99('0x6'));var auth=require(_0xab99('0x7'));var interaction=require(_0xab99('0x8'));var config=require(_0xab99('0x9'));var controller=require(_0xab99('0xa'));router[_0xab99('0xb')]('/',auth['isAuthenticated'](),controller[_0xab99('0xc')]);router[_0xab99('0xb')](_0xab99('0xd'),auth[_0xab99('0xe')](),controller[_0xab99('0xf')]);router[_0xab99('0xb')]('/:id/preview',auth[_0xab99('0xe')](),controller[_0xab99('0x10')]);router[_0xab99('0xb')](_0xab99('0x11'),auth[_0xab99('0xe')](),controller[_0xab99('0x12')]);router[_0xab99('0xb')]('/:id/query',auth['isAuthenticated'](),controller[_0xab99('0x13')]);router[_0xab99('0x14')]('/',auth[_0xab99('0xe')](),controller['create']);router['put'](_0xab99('0xd'),auth['isAuthenticated'](),controller[_0xab99('0x15')]);router[_0xab99('0x16')](_0xab99('0xd'),auth[_0xab99('0xe')](),controller['destroy']);module[_0xab99('0x17')]=router; \ No newline at end of file +var _0xf544=['run','query','post','create','update','delete','destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','get','index','/:id','isAuthenticated','show','/:id/preview','preview','/:id/run'];(function(_0x1304fa,_0x386387){var _0x471f42=function(_0x59900a){while(--_0x59900a){_0x1304fa['push'](_0x1304fa['shift']());}};_0x471f42(++_0x386387);}(_0xf544,0xe3));var _0x4f54=function(_0x2272b5,_0x362458){_0x2272b5=_0x2272b5-0x0;var _0x110156=_0xf544[_0x2272b5];return _0x110156;};'use strict';var multer=require(_0x4f54('0x0'));var util=require(_0x4f54('0x1'));var path=require('path');var timeout=require(_0x4f54('0x2'));var express=require('express');var router=express[_0x4f54('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4f54('0x4'));var interaction=require(_0x4f54('0x5'));var config=require('../../config/environment');var controller=require(_0x4f54('0x6'));router[_0x4f54('0x7')]('/',auth['isAuthenticated'](),controller[_0x4f54('0x8')]);router[_0x4f54('0x7')](_0x4f54('0x9'),auth[_0x4f54('0xa')](),controller[_0x4f54('0xb')]);router[_0x4f54('0x7')](_0x4f54('0xc'),auth[_0x4f54('0xa')](),controller[_0x4f54('0xd')]);router['get'](_0x4f54('0xe'),auth[_0x4f54('0xa')](),controller[_0x4f54('0xf')]);router[_0x4f54('0x7')]('/:id/query',auth[_0x4f54('0xa')](),controller[_0x4f54('0x10')]);router[_0x4f54('0x11')]('/',auth[_0x4f54('0xa')](),controller[_0x4f54('0x12')]);router['put']('/:id',auth[_0x4f54('0xa')](),controller[_0x4f54('0x13')]);router[_0x4f54('0x14')](_0x4f54('0x9'),auth[_0x4f54('0xa')](),controller[_0x4f54('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 394fdd4..43b2e7e 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 _0x46ed=['sequelize','exports','STRING','TEXT'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0x46ed,0x168));var _0xd46e=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x46ed[_0x11005e];return _0x29338f;};'use strict';var Sequelize=require(_0xd46e('0x0'));module[_0xd46e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xd46e('0x2')]},'parent':{'type':Sequelize[_0xd46e('0x2')]},'table':{'type':Sequelize[_0xd46e('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xd46e('0x3')]}}; \ No newline at end of file +var _0x5fab=['exports','STRING','TEXT','sequelize'];(function(_0x1261c2,_0x3ef819){var _0x3aabd2=function(_0x425d76){while(--_0x425d76){_0x1261c2['push'](_0x1261c2['shift']());}};_0x3aabd2(++_0x3ef819);}(_0x5fab,0x177));var _0xb5fa=function(_0x549278,_0x450754){_0x549278=_0x549278-0x0;var _0x1ea9a1=_0x5fab[_0x549278];return _0x1ea9a1;};'use strict';var Sequelize=require(_0xb5fa('0x0'));module[_0xb5fa('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb5fa('0x2')]},'parent':{'type':Sequelize[_0xb5fa('0x2')]},'table':{'type':Sequelize[_0xb5fa('0x2')]},'conditions':{'type':Sequelize[_0xb5fa('0x3')]},'joins':{'type':Sequelize[_0xb5fa('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 1abf273..a4f3fd7 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 _0x1cb9=['runReport','left_join','SEC_TO_TIME(%s)','IS\x20NULL','clone','debug','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','undefined','count','status','set','apply','reject','then','destroy','get','UserProfileResource','stack','name','send','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','body','user','role','autoAssociation','create','DefaultReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','order','DESC','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','COUNT(%s)','GROUP_CONCAT(%s)','HOUR(%s)','value','groupBy','alias','output','fullPath','%s-%s.%s','randomstring','generate','csv','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)'];(function(_0x2e24db,_0x4df1f2){var _0x5e03f9=function(_0x324e32){while(--_0x324e32){_0x2e24db['push'](_0x2e24db['shift']());}};_0x5e03f9(++_0x4df1f2);}(_0x1cb9,0x14e));var _0x91cb=function(_0x1547ac,_0x1e4416){_0x1547ac=_0x1547ac-0x0;var _0x381b82=_0x1cb9[_0x1547ac];return _0x381b82;};'use strict';var emlformat=require(_0x91cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91cb('0x1'));var jsonpatch=require(_0x91cb('0x2'));var rp=require(_0x91cb('0x3'));var moment=require(_0x91cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91cb('0x5'));var util=require(_0x91cb('0x6'));var path=require('path');var sox=require(_0x91cb('0x7'));var csv=require(_0x91cb('0x8'));var ejs=require(_0x91cb('0x9'));var fs=require('fs');var fs_extra=require(_0x91cb('0xa'));var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x8'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x91cb('0x18'))['db'];var dbH=require(_0x91cb('0x18'))['dbH'];function respondWithStatusCode(_0x20e6e0,_0x3ea707){_0x3ea707=_0x3ea707||0xcc;return function(_0x44f2e9){if(_0x44f2e9){return _0x20e6e0[_0x91cb('0x19')](_0x3ea707);}return _0x20e6e0['status'](_0x3ea707)['end']();};}function respondWithResult(_0x4aae25,_0x3d22b7){_0x3d22b7=_0x3d22b7||0xc8;return function(_0x585470){if(_0x585470){return _0x4aae25['status'](_0x3d22b7)[_0x91cb('0x1a')](_0x585470);}};}function respondWithFilteredResult(_0xc3629e,_0x347980){return function(_0x5ea796){if(_0x5ea796){var _0x238f11=typeof _0x347980[_0x91cb('0x1b')]==='undefined'&&typeof _0x347980[_0x91cb('0x1c')]===_0x91cb('0x1d');var _0x1cd34b=_0x5ea796[_0x91cb('0x1e')];var _0x5cc1c3=_0x238f11?0x0:_0x347980[_0x91cb('0x1b')];var _0x7dcf60=_0x238f11?_0x5ea796['count']:_0x347980[_0x91cb('0x1b')]+_0x347980['limit'];var _0x55042a;if(_0x7dcf60>=_0x1cd34b){_0x7dcf60=_0x1cd34b;_0x55042a=0xc8;}else{_0x55042a=0xce;}_0xc3629e[_0x91cb('0x1f')](_0x55042a);return _0xc3629e[_0x91cb('0x20')]('Content-Range',_0x5cc1c3+'-'+_0x7dcf60+'/'+_0x1cd34b)['json'](_0x5ea796);}return null;};}function patchUpdates(_0x5b385a){return function(_0x438162){try{jsonpatch[_0x91cb('0x21')](_0x438162,_0x5b385a,!![]);}catch(_0x20aff5){return BPromise[_0x91cb('0x22')](_0x20aff5);}return _0x438162['save']();};}function saveUpdates(_0x45c4b3,_0x43881c){return function(_0x1fa837){if(_0x1fa837){return _0x1fa837['update'](_0x45c4b3)[_0x91cb('0x23')](function(_0x1a7a54){return _0x1a7a54;});}return null;};}function removeEntity(_0x2447e7,_0x422d14){return function(_0x3ca500){if(_0x3ca500){return _0x3ca500[_0x91cb('0x24')]()[_0x91cb('0x23')](function(){var _0x423c4f=_0x3ca500[_0x91cb('0x25')]({'plain':!![]});var _0x4c8438='DefaultReports';return db[_0x91cb('0x26')]['destroy']({'where':{'type':_0x4c8438,'resourceId':_0x423c4f['id']}})[_0x91cb('0x23')](function(){return _0x3ca500;});})[_0x91cb('0x23')](function(){_0x2447e7[_0x91cb('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9b26a6,_0x4f5a7b){return function(_0x4572f6){if(!_0x4572f6){_0x9b26a6[_0x91cb('0x19')](0x194);}return _0x4572f6;};}function handleError(_0x3b3ee6,_0x2fb473){_0x2fb473=_0x2fb473||0x1f4;return function(_0x468908){logger['error'](_0x468908[_0x91cb('0x27')]);if(_0x468908['name']){delete _0x468908[_0x91cb('0x28')];}_0x3b3ee6[_0x91cb('0x1f')](_0x2fb473)[_0x91cb('0x29')](_0x468908);};}exports['index']=function(_0x775c25,_0x146e1f){var _0x25bbf9={},_0x361e4c={},_0xf296bc={'count':0x0,'rows':[]};var _0x3dab18=_[_0x91cb('0x2a')](db[_0x91cb('0x2b')][_0x91cb('0x2c')],function(_0x5e6ed3){return{'name':_0x5e6ed3[_0x91cb('0x2d')],'type':_0x5e6ed3[_0x91cb('0x2e')][_0x91cb('0x2f')]};});_0x361e4c[_0x91cb('0x30')]=_[_0x91cb('0x2a')](_0x3dab18,'name');_0x361e4c[_0x91cb('0x31')]=_[_0x91cb('0x32')](_0x775c25[_0x91cb('0x31')]);_0x361e4c[_0x91cb('0x33')]=_[_0x91cb('0x34')](_0x361e4c['model'],_0x361e4c[_0x91cb('0x31')]);_0x25bbf9['attributes']=_['intersection'](_0x361e4c['model'],qs[_0x91cb('0x35')](_0x775c25['query'][_0x91cb('0x35')]));_0x25bbf9['attributes']=_0x25bbf9['attributes'][_0x91cb('0x36')]?_0x25bbf9[_0x91cb('0x37')]:_0x361e4c[_0x91cb('0x30')];if(!_0x775c25[_0x91cb('0x31')][_0x91cb('0x38')]('nolimit')){_0x25bbf9[_0x91cb('0x1c')]=qs[_0x91cb('0x1c')](_0x775c25[_0x91cb('0x31')][_0x91cb('0x1c')]);_0x25bbf9['offset']=qs['offset'](_0x775c25[_0x91cb('0x31')][_0x91cb('0x1b')]);}_0x25bbf9['order']=qs[_0x91cb('0x39')](_0x775c25[_0x91cb('0x31')]['sort']);_0x25bbf9[_0x91cb('0x3a')]=qs[_0x91cb('0x33')](_['pick'](_0x775c25[_0x91cb('0x31')],_0x361e4c['filters']),_0x3dab18);if(_0x775c25[_0x91cb('0x31')][_0x91cb('0x3b')]){_0x25bbf9[_0x91cb('0x3a')]=_[_0x91cb('0x3c')](_0x25bbf9[_0x91cb('0x3a')],{'$or':_[_0x91cb('0x2a')](_0x3dab18,function(_0x5d0e37){if(_0x5d0e37[_0x91cb('0x2e')]!==_0x91cb('0x3d')){var _0x4e5b4b={};_0x4e5b4b[_0x5d0e37[_0x91cb('0x28')]]={'$like':'%'+_0x775c25['query'][_0x91cb('0x3b')]+'%'};return _0x4e5b4b;}})});}_0x25bbf9=_[_0x91cb('0x3c')]({},_0x25bbf9,_0x775c25[_0x91cb('0x3e')]);var _0x174794={'where':_0x25bbf9['where']};return db[_0x91cb('0x2b')][_0x91cb('0x1e')](_0x174794)[_0x91cb('0x23')](function(_0x37e777){_0xf296bc[_0x91cb('0x1e')]=_0x37e777;if(_0x775c25[_0x91cb('0x31')][_0x91cb('0x3f')]){_0x25bbf9[_0x91cb('0x40')]=[{'all':!![]}];}return db[_0x91cb('0x2b')][_0x91cb('0x41')](_0x25bbf9);})['then'](function(_0x16993f){_0xf296bc['rows']=_0x16993f;return _0xf296bc;})[_0x91cb('0x23')](respondWithFilteredResult(_0x146e1f,_0x25bbf9))['catch'](handleError(_0x146e1f,null));};exports[_0x91cb('0x42')]=function(_0x52e82c,_0x138f48){var _0x477131={'raw':!![],'where':{'id':_0x52e82c[_0x91cb('0x43')]['id']}},_0xba99ce={};_0xba99ce['model']=_[_0x91cb('0x32')](db[_0x91cb('0x2b')]['rawAttributes']);_0xba99ce[_0x91cb('0x31')]=_[_0x91cb('0x32')](_0x52e82c[_0x91cb('0x31')]);_0xba99ce[_0x91cb('0x33')]=_[_0x91cb('0x34')](_0xba99ce[_0x91cb('0x30')],_0xba99ce[_0x91cb('0x31')]);_0x477131[_0x91cb('0x37')]=_[_0x91cb('0x34')](_0xba99ce['model'],qs[_0x91cb('0x35')](_0x52e82c[_0x91cb('0x31')][_0x91cb('0x35')]));_0x477131[_0x91cb('0x37')]=_0x477131[_0x91cb('0x37')][_0x91cb('0x36')]?_0x477131[_0x91cb('0x37')]:_0xba99ce[_0x91cb('0x30')];if(_0x52e82c['query'][_0x91cb('0x3f')]){_0x477131[_0x91cb('0x40')]=[{'all':!![]}];}_0x477131=_[_0x91cb('0x3c')]({},_0x477131,_0x52e82c[_0x91cb('0x3e')]);return db['AnalyticDefaultReport'][_0x91cb('0x44')](_0x477131)[_0x91cb('0x23')](handleEntityNotFound(_0x138f48,null))['then'](respondWithResult(_0x138f48,null))[_0x91cb('0x45')](handleError(_0x138f48,null));};exports['create']=function(_0x2c419b,_0x4c0acd){return db['AnalyticDefaultReport']['create'](_0x2c419b[_0x91cb('0x46')],{})[_0x91cb('0x23')](function(_0x3d62c4){var _0x2f8384=_0x2c419b[_0x91cb('0x47')]['get']({'plain':!![]});if(!_0x2f8384)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f8384[_0x91cb('0x48')]===_0x91cb('0x47')){var _0x140994=_0x3d62c4[_0x91cb('0x25')]({'plain':!![]});var _0x57adff='Reports';return db['UserProfileSection'][_0x91cb('0x44')]({'where':{'name':_0x57adff,'userProfileId':_0x2f8384['userProfileId']},'raw':!![]})[_0x91cb('0x23')](function(_0x4aa670){if(_0x4aa670&&_0x4aa670[_0x91cb('0x49')]===0x0){return db[_0x91cb('0x26')][_0x91cb('0x4a')]({'name':_0x140994[_0x91cb('0x28')],'resourceId':_0x140994['id'],'type':_0x91cb('0x4b'),'sectionId':_0x4aa670['id']},{})[_0x91cb('0x23')](function(){return _0x3d62c4;});}else{return _0x3d62c4;}})[_0x91cb('0x45')](function(_0x30fd4e){logger[_0x91cb('0x4c')](_0x91cb('0x4d'),_0x30fd4e);throw _0x30fd4e;});}return _0x3d62c4;})[_0x91cb('0x23')](respondWithResult(_0x4c0acd,0xc9))['catch'](handleError(_0x4c0acd,null));};exports[_0x91cb('0x4e')]=function(_0x1fa45a,_0x4d7a34){if(_0x1fa45a[_0x91cb('0x46')]['id']){delete _0x1fa45a[_0x91cb('0x46')]['id'];}return db['AnalyticDefaultReport'][_0x91cb('0x44')]({'where':{'id':_0x1fa45a[_0x91cb('0x43')]['id']}})[_0x91cb('0x23')](handleEntityNotFound(_0x4d7a34,null))[_0x91cb('0x23')](saveUpdates(_0x1fa45a[_0x91cb('0x46')],null))[_0x91cb('0x23')](respondWithResult(_0x4d7a34,null))[_0x91cb('0x45')](handleError(_0x4d7a34,null));};exports[_0x91cb('0x24')]=function(_0x3320bd,_0x93ef52){return db[_0x91cb('0x2b')]['find']({'where':{'id':_0x3320bd[_0x91cb('0x43')]['id']}})['then'](handleEntityNotFound(_0x93ef52,null))[_0x91cb('0x23')](removeEntity(_0x93ef52,null))['catch'](handleError(_0x93ef52,null));};exports[_0x91cb('0x4f')]=function(_0x1b2fec,_0x1986d7){var _0x47a6cd=0xa;var _0xe49d42=[_0x91cb('0x50'),'left_join',_0x91cb('0x51'),_0x91cb('0x52')];var _0x365afd={'SUM':_0x91cb('0x53'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x91cb('0x58'),'GROUP_CONCAT DESC':_0x91cb('0x59')};var _0x5c2c01={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x91cb('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x91cb('0x5b'),'UNIX_TIMESTAMP':_0x91cb('0x5c')};var _0x5ae0d2=function(_0x4f19c8){return!_[_0x91cb('0x5d')](['IS\x20NULL',_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4f19c8);};var _0x551836=function(_0x22fea8){if(!_0x22fea8||!_0x22fea8['rules'][_0x91cb('0x36')]){return'';}for(var _0xe08233='(',_0xd7be15=0x0;_0xd7be15<_0x22fea8[_0x91cb('0x61')]['length'];_0xd7be15+=0x1){_0xd7be15>0x0&&(_0xe08233+='\x20'+_0x22fea8[_0x91cb('0x62')]+'\x20');_0xe08233+=_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x63')]?_0x551836(_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x63')]):_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x64')]+'\x20'+_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x65')]+(_0x5ae0d2(_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x65')])?'\x20'+_0x22fea8[_0x91cb('0x61')][_0xd7be15]['value']:'');}return _0xe08233+')';};var _0x2cf4d0={'where':{'id':_0x1b2fec[_0x91cb('0x43')]['id']}},_0x2e301a,_0x474682,_0x51ab8a,_0x21c890,_0xca33a2;_0x2cf4d0=_['merge']({},_0x2cf4d0,_0x1b2fec[_0x91cb('0x3e')]);return db['AnalyticDefaultReport'][_0x91cb('0x44')](_0x2cf4d0)[_0x91cb('0x23')](function(_0x80fcc6){if(_0x80fcc6){_0x2e301a=_0x80fcc6;return _0x80fcc6[_0x91cb('0x66')]();}return null;})['then'](function(_0x1c0b66){if(_0x1c0b66){if(!_0x1c0b66[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))][(_0x91cb('0x68'))](_0x91cb('0x69'),0x193);}_0x474682=_0x1c0b66;return db[_0x91cb('0x6a')]['findAll']({'raw':!![]});}return null;})[_0x91cb('0x23')](function(_0x28bfe5){if(_0x28bfe5){_0x51ab8a=_[_0x91cb('0x6b')](_0x28bfe5,'id');var _0x1f0ba2;var _0x891569=squel[_0x91cb('0x6c')]();_0x891569[_0x91cb('0x6d')](_0x2e301a[_0x91cb('0x6e')]);for(var _0x43629b=0x0;_0x43629b<_0x474682[_0x91cb('0x36')];_0x43629b+=0x1){_0x1f0ba2=_0x474682[_0x43629b][_0x91cb('0x6f')]?_0x51ab8a[_0x474682[_0x43629b][_0x91cb('0x6f')]][_0x91cb('0x70')]:_0x474682[_0x43629b][_0x91cb('0x64')];_0x1f0ba2=_0x474682[_0x43629b][_0x91cb('0x71')]?_[_0x91cb('0x72')](_0x365afd[_0x474682[_0x43629b][_0x91cb('0x71')]],'%s',_0x1f0ba2):_0x1f0ba2;_0x1f0ba2=_0x474682[_0x43629b]['format']?_[_0x91cb('0x72')](_0x5c2c01[_0x474682[_0x43629b][_0x91cb('0x73')]],'%s',_0x1f0ba2):_0x1f0ba2;if(_0x474682[_0x43629b]['groupBy']){_0x891569[_0x91cb('0x63')](_0x1f0ba2);}_0x474682[_0x43629b][_0x91cb('0x74')]&&_0x891569[_0x91cb('0x75')](_0x1f0ba2,_0x474682[_0x43629b]['orderBy']===_0x91cb('0x76')?![]:!![]);_0x891569[_0x91cb('0x64')](_0x1f0ba2,_0x474682[_0x43629b]['alias']||_0x1f0ba2);}if(_0x2e301a['joins']){_0x2e301a[_0x91cb('0x77')]=JSON['parse'](_0x2e301a[_0x91cb('0x77')]);for(var _0x376f56=0x0;_0x376f56<_0x2e301a['joins'][_0x91cb('0x36')];_0x376f56+=0x1){if(_0x2e301a['joins'][_0x376f56][_0x91cb('0x2e')]&&_[_0x91cb('0x5d')](_0xe49d42,_0x2e301a['joins'][_0x376f56]['type'])&&_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x78')]&&_0x2e301a[_0x91cb('0x77')][_0x376f56]['foreignTable']&&_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x79')]){_0x891569[_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x2e')]](_0x2e301a['joins'][_0x376f56][_0x91cb('0x7a')],null,util['format'](_0x91cb('0x7b'),_0x2e301a[_0x91cb('0x6e')],_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x78')],_0x2e301a['joins'][_0x376f56]['foreignTable'],_0x2e301a[_0x91cb('0x77')][_0x376f56]['foreignKey']));}}}if(_0x2e301a[_0x91cb('0x7c')]){_0x2e301a[_0x91cb('0x7c')]=JSON[_0x91cb('0x7d')](_0x2e301a[_0x91cb('0x7c')]);_0x891569[_0x91cb('0x3a')](_0x551836(_0x2e301a[_0x91cb('0x7c')][_0x91cb('0x63')]));}_0xca33a2=_0x891569['clone']();_0x891569[_0x91cb('0x1c')](_0x47a6cd);_0x891569[_0x91cb('0x1b')](0x0);logger['debug'](_0x91cb('0x7e'),_0x891569['toString']());return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x891569[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]});}})[_0x91cb('0x23')](respondWithResult(_0x1986d7,null))[_0x91cb('0x45')](handleError(_0x1986d7,null));};function runReport(_0x23380a,_0x14cad8,_0x20a64f){var _0x11411d=_0x14cad8[_0x91cb('0x28')];var _0x14882d=0xa;var _0x22ba54=[_0x91cb('0x50'),'left_join',_0x91cb('0x51'),'cross_join'];var _0x1235c0={'SUM':_0x91cb('0x53'),'COUNT':_0x91cb('0x83'),'COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':_0x91cb('0x84'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x91cb('0x59')};var _0xdee7f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x91cb('0x85'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x95f2de=function(_0x4d777a){return!_[_0x91cb('0x5d')](['IS\x20NULL',_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4d777a);};var _0x443c01=function(_0x4e899c){if(!_0x4e899c||!_0x4e899c[_0x91cb('0x61')][_0x91cb('0x36')]){return'';}for(var _0x42d07b='(',_0x427afd=0x0;_0x427afd<_0x4e899c[_0x91cb('0x61')][_0x91cb('0x36')];_0x427afd+=0x1){_0x427afd>0x0&&(_0x42d07b+='\x20'+_0x4e899c[_0x91cb('0x62')]+'\x20');_0x42d07b+=_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x63')]?_0x443c01(_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x63')]):_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x64')]+'\x20'+_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x65')]+(_0x95f2de(_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x65')])?'\x20'+_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x86')]:'');}return _0x42d07b+')';};var _0x39b5bd={'where':{'id':_0x23380a['id']}},_0x315518,_0x3d944d,_0x43b96c,_0xe4d946,_0x32d426;_0x39b5bd=_['merge']({},_0x39b5bd,_0x20a64f);return db[_0x91cb('0x2b')][_0x91cb('0x44')](_0x39b5bd)[_0x91cb('0x23')](function(_0x1a654b){if(_0x1a654b){_0x315518=_0x1a654b;return _0x1a654b[_0x91cb('0x66')]();}return null;})[_0x91cb('0x23')](function(_0x404457){if(_0x404457){if(!_0x404457[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))][(_0x91cb('0x68'))](_0x91cb('0x69'),0x193);}_0x3d944d=_0x404457;return db['AnalyticMetric'][_0x91cb('0x41')]({'raw':!![]});}return null;})['then'](function(_0x5689ea){if(_0x5689ea){_0x43b96c=_[_0x91cb('0x6b')](_0x5689ea,'id');var _0x265ffb;var _0x4f66f=squel[_0x91cb('0x6c')]();_0x4f66f[_0x91cb('0x6d')](_0x315518[_0x91cb('0x6e')]);for(var _0x210b46=0x0;_0x210b46<_0x3d944d[_0x91cb('0x36')];_0x210b46+=0x1){_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x6f')]?_0x43b96c[_0x3d944d[_0x210b46][_0x91cb('0x6f')]]['metric']:_0x3d944d[_0x210b46][_0x91cb('0x64')];_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x71')]?_['replace'](_0x1235c0[_0x3d944d[_0x210b46][_0x91cb('0x71')]],'%s',_0x265ffb):_0x265ffb;_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x73')]?_['replace'](_0xdee7f[_0x3d944d[_0x210b46][_0x91cb('0x73')]],'%s',_0x265ffb):_0x265ffb;if(_0x3d944d[_0x210b46][_0x91cb('0x87')]){_0x4f66f[_0x91cb('0x63')](_0x265ffb);}_0x3d944d[_0x210b46][_0x91cb('0x74')]&&_0x4f66f[_0x91cb('0x75')](_0x265ffb,_0x3d944d[_0x210b46][_0x91cb('0x74')]===_0x91cb('0x76')?![]:!![]);_0x4f66f[_0x91cb('0x64')](_0x265ffb,_0x3d944d[_0x210b46][_0x91cb('0x88')]||_0x265ffb);}if(_0x315518[_0x91cb('0x77')]){_0x315518[_0x91cb('0x77')]=JSON[_0x91cb('0x7d')](_0x315518['joins']);for(var _0x5c0725=0x0;_0x5c0725<_0x315518[_0x91cb('0x77')][_0x91cb('0x36')];_0x5c0725+=0x1){if(_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')]&&_[_0x91cb('0x5d')](_0x22ba54,_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')])&&_0x315518['joins'][_0x5c0725][_0x91cb('0x78')]&&_0x315518['joins'][_0x5c0725][_0x91cb('0x7a')]&&_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x79')]){_0x4f66f[_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')]](_0x315518['joins'][_0x5c0725][_0x91cb('0x7a')],null,util[_0x91cb('0x73')](_0x91cb('0x7b'),_0x315518[_0x91cb('0x6e')],_0x315518[_0x91cb('0x77')][_0x5c0725]['parentKey'],_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x7a')],_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x79')]));}}}if(_0x315518['conditions']){_0x315518['conditions']=JSON['parse'](_0x315518[_0x91cb('0x7c')]);_0x4f66f[_0x91cb('0x3a')](_0x443c01(_0x315518[_0x91cb('0x7c')][_0x91cb('0x63')]));}_0x32d426=_0x4f66f['clone']();_0x4f66f[_0x91cb('0x1c')](_0x14882d);_0x4f66f[_0x91cb('0x1b')](0x0);return;}})[_0x91cb('0x23')](function(){if(_0x14cad8[_0x91cb('0x89')]==='web'){return null;}var _0x4bf7c7=_[_0x91cb('0x3c')](_0x14cad8,{'name':_0x14cad8[_0x91cb('0x8a')]||_0x14cad8[_0x91cb('0x28')]||_0x315518[_0x91cb('0x28')],'basename':_0x11411d,'savename':util[_0x91cb('0x73')](_0x91cb('0x8b'),_0x14cad8[_0x91cb('0x28')]||_0x315518[_0x91cb('0x28')],require(_0x91cb('0x8c'))[_0x91cb('0x8d')](0x4),_0x14cad8[_0x91cb('0x89')]||_0x91cb('0x8e')),'reportId':_0x315518['id'],'reportType':_0x91cb('0x8f')});return db['AnalyticExtractedReport']['create'](_0x4bf7c7,{'raw':!![]});})[_0x91cb('0x23')](function(_0x48a910){if(_0x315518[_0x91cb('0x6e')]===_0x91cb('0x90')){_0x32d426[_0x91cb('0x3a')](_0x315518[_0x91cb('0x6e')]+_0x91cb('0x91'),_0x14cad8[_0x91cb('0x92')],_0x14cad8[_0x91cb('0x93')]);}else{_0x32d426[_0x91cb('0x3a')](_0x315518['table']+_0x91cb('0x94'),_0x14cad8[_0x91cb('0x92')],_0x14cad8[_0x91cb('0x93')]);}if(_0x48a910){logger[_0x91cb('0x95')](_0x91cb('0x96'),_0x32d426['toString']());require(_0x91cb('0x97'))[_0x91cb('0x98')](path[_0x91cb('0x50')](__dirname,_0x91cb('0x99'),_0x48a910[_0x91cb('0x89')]),[_0x48a910['id'],_0x32d426['toString'](),path[_0x91cb('0x50')](__dirname,_0x91cb('0x9a'),_0x48a910[_0x91cb('0x9b')]),_0x11411d]);return _0x48a910;}else{var _0x22b6d3=squel[_0x91cb('0x6c')]();_0x22b6d3[_0x91cb('0x6d')]('('+_0x32d426[_0x91cb('0x80')]()+')',_0x91cb('0x9c'));_0x22b6d3[_0x91cb('0x64')](_0x91cb('0x9d'),_0x91cb('0x1e'));_0x32d426[_0x91cb('0x1c')](_0x14cad8[_0x91cb('0x1c')]||_0x14882d);_0x32d426[_0x91cb('0x1b')](_0x14cad8[_0x91cb('0x1b')]||0x0);return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x22b6d3[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]})[_0x91cb('0x23')](function(_0x275c80){if(!_0x275c80[_0x91cb('0x36')]){_0xe4d946=0x0;}else{_0xe4d946=_0x275c80[0x0][_0x91cb('0x1e')]||0x0;}return dbH[_0x91cb('0x7f')]['query'](_0x32d426[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]});})[_0x91cb('0x23')](function(_0x5ca377){return{'rows':_0x5ca377||[],'count':_0xe4d946};});}});}exports['run']=function(_0x552490,_0x5174ac){return runReport(_0x552490['params'],_0x552490[_0x91cb('0x31')],_0x552490[_0x91cb('0x3e')])[_0x91cb('0x23')](respondWithResult(_0x5174ac,null))[_0x91cb('0x45')](handleError(_0x5174ac,null));};exports[_0x91cb('0x9e')]=runReport;exports[_0x91cb('0x31')]=function(_0x3462c5,_0x146346){var _0xe3d97f=0xa;var _0x3b93c3=['join',_0x91cb('0x9f'),_0x91cb('0x51'),'cross_join'];var _0x154e6a={'SUM':_0x91cb('0x53'),'COUNT':_0x91cb('0x83'),'COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x91cb('0x58'),'GROUP_CONCAT DESC':_0x91cb('0x59')};var _0x2a05af={'SEC_TO_TIME':_0x91cb('0xa0'),'DATE':_0x91cb('0x5a'),'HOUR':_0x91cb('0x85'),'ROUND':_0x91cb('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x34c1f2=function(_0x4d82b4){return!_[_0x91cb('0x5d')]([_0x91cb('0xa1'),_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4d82b4);};var _0x432099=function(_0x344c95){if(!_0x344c95||!_0x344c95[_0x91cb('0x61')][_0x91cb('0x36')]){return'';}for(var _0x570cf0='(',_0xb3a6c4=0x0;_0xb3a6c4<_0x344c95[_0x91cb('0x61')][_0x91cb('0x36')];_0xb3a6c4+=0x1){_0xb3a6c4>0x0&&(_0x570cf0+='\x20'+_0x344c95[_0x91cb('0x62')]+'\x20');_0x570cf0+=_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x63')]?_0x432099(_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x63')]):_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x64')]+'\x20'+_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x65')]+(_0x34c1f2(_0x344c95[_0x91cb('0x61')][_0xb3a6c4]['condition'])?'\x20'+_0x344c95[_0x91cb('0x61')][_0xb3a6c4]['value']:'');}return _0x570cf0+')';};var _0x39ba62={'where':{'id':_0x3462c5[_0x91cb('0x43')]['id']}},_0x2ab5a3,_0x10a9f6,_0x43ad75,_0x1382ba,_0x12da14;_0x39ba62=_[_0x91cb('0x3c')]({},_0x39ba62,_0x3462c5['options']);return db[_0x91cb('0x2b')]['find'](_0x39ba62)[_0x91cb('0x23')](function(_0x2f7387){if(_0x2f7387){_0x2ab5a3=_0x2f7387;return _0x2f7387[_0x91cb('0x66')]();}return null;})['then'](function(_0x1f2ef8){if(_0x1f2ef8){if(!_0x1f2ef8[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x10a9f6=_0x1f2ef8;return db['AnalyticMetric'][_0x91cb('0x41')]({'raw':!![]});}return null;})[_0x91cb('0x23')](function(_0x3ac830){if(_0x3ac830){_0x43ad75=_['keyBy'](_0x3ac830,'id');var _0x469e62;var _0x1e9441=squel[_0x91cb('0x6c')]();_0x1e9441[_0x91cb('0x6d')](_0x2ab5a3[_0x91cb('0x6e')]);for(var _0x416390=0x0;_0x416390<_0x10a9f6[_0x91cb('0x36')];_0x416390+=0x1){_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x6f')]?_0x43ad75[_0x10a9f6[_0x416390]['MetricId']][_0x91cb('0x70')]:_0x10a9f6[_0x416390][_0x91cb('0x64')];_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x71')]?_[_0x91cb('0x72')](_0x154e6a[_0x10a9f6[_0x416390]['function']],'%s',_0x469e62):_0x469e62;_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x73')]?_['replace'](_0x2a05af[_0x10a9f6[_0x416390][_0x91cb('0x73')]],'%s',_0x469e62):_0x469e62;if(_0x10a9f6[_0x416390][_0x91cb('0x87')]){_0x1e9441[_0x91cb('0x63')](_0x469e62);}_0x10a9f6[_0x416390][_0x91cb('0x74')]&&_0x1e9441[_0x91cb('0x75')](_0x469e62,_0x10a9f6[_0x416390]['orderBy']===_0x91cb('0x76')?![]:!![]);_0x1e9441['field'](_0x469e62,_0x10a9f6[_0x416390]['alias']||_0x469e62);}if(_0x2ab5a3[_0x91cb('0x77')]){_0x2ab5a3[_0x91cb('0x77')]=JSON[_0x91cb('0x7d')](_0x2ab5a3[_0x91cb('0x77')]);for(var _0x286ed7=0x0;_0x286ed7<_0x2ab5a3[_0x91cb('0x77')][_0x91cb('0x36')];_0x286ed7+=0x1){if(_0x2ab5a3[_0x91cb('0x77')][_0x286ed7]['type']&&_[_0x91cb('0x5d')](_0x3b93c3,_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x2e')])&&_0x2ab5a3['joins'][_0x286ed7]['parentKey']&&_0x2ab5a3['joins'][_0x286ed7][_0x91cb('0x7a')]&&_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x79')]){_0x1e9441[_0x2ab5a3['joins'][_0x286ed7][_0x91cb('0x2e')]](_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x7a')],null,util[_0x91cb('0x73')]('%s.%s\x20=\x20%s.%s',_0x2ab5a3[_0x91cb('0x6e')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x78')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x7a')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7]['foreignKey']));}}}if(_0x2ab5a3[_0x91cb('0x7c')]){_0x2ab5a3[_0x91cb('0x7c')]=JSON[_0x91cb('0x7d')](_0x2ab5a3[_0x91cb('0x7c')]);_0x1e9441[_0x91cb('0x3a')](_0x432099(_0x2ab5a3['conditions'][_0x91cb('0x63')]));}_0x12da14=_0x1e9441[_0x91cb('0xa2')]();_0x1e9441[_0x91cb('0x1c')](_0xe3d97f);_0x1e9441[_0x91cb('0x1b')](0x0);logger[_0x91cb('0xa3')](_0x91cb('0x7e'),_0x1e9441['toString']());return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x1e9441[_0x91cb('0x80')](),{'type':dbH['sequelize'][_0x91cb('0x81')]['SELECT']});}})[_0x91cb('0x23')](function(){return{'sql':_0x12da14[_0x91cb('0x80')]()};})[_0x91cb('0x23')](respondWithResult(_0x146346,null))[_0x91cb('0x45')](handleError(_0x146346,null));}; \ No newline at end of file +var _0x5fc3=['QueryTypes','right_join','HOUR(%s)','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','dbH','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','get','DefaultReports','destroy','error','stack','name','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','operator','group','field','condition','value','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','groupBy','orderBy','order','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','format','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','sequelize','toString','SELECT','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20EMPTY','getFields','ValidationErrorItem','fullPath','%s-%s.%s','generate','output','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)'];(function(_0x2be50e,_0x43c278){var _0xe7e79=function(_0x13d69c){while(--_0x13d69c){_0x2be50e['push'](_0x2be50e['shift']());}};_0xe7e79(++_0x43c278);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3438cf,_0x73b174){_0x3438cf=_0x3438cf-0x0;var _0x278698=_0x5fc3[_0x3438cf];return _0x278698;};'use strict';var emlformat=require(_0x35fc('0x0'));var rimraf=require(_0x35fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35fc('0x2'));var rp=require(_0x35fc('0x3'));var moment=require(_0x35fc('0x4'));var BPromise=require(_0x35fc('0x5'));var Mustache=require(_0x35fc('0x6'));var util=require('util');var path=require(_0x35fc('0x7'));var sox=require(_0x35fc('0x8'));var csv=require(_0x35fc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0x9'));var querystring=require(_0x35fc('0xe'));var Papa=require(_0x35fc('0xf'));var Redis=require(_0x35fc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x11'));var as=require(_0x35fc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fc('0x13'))(_0x35fc('0x14'));var utils=require('../../config/utils');var config=require(_0x35fc('0x15'));var licenseUtil=require(_0x35fc('0x16'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x35fc('0x17')];function respondWithStatusCode(_0x5d462a,_0x397738){_0x397738=_0x397738||0xcc;return function(_0x22055e){if(_0x22055e){return _0x5d462a[_0x35fc('0x18')](_0x397738);}return _0x5d462a[_0x35fc('0x19')](_0x397738)[_0x35fc('0x1a')]();};}function respondWithResult(_0x5cfe94,_0x59507a){_0x59507a=_0x59507a||0xc8;return function(_0x5eac0f){if(_0x5eac0f){return _0x5cfe94['status'](_0x59507a)[_0x35fc('0x1b')](_0x5eac0f);}};}function respondWithFilteredResult(_0x229d56,_0x53b898){return function(_0x154958){if(_0x154958){var _0x227a49=typeof _0x53b898[_0x35fc('0x1c')]==='undefined'&&typeof _0x53b898[_0x35fc('0x1d')]===_0x35fc('0x1e');var _0x553677=_0x154958[_0x35fc('0x1f')];var _0x363e47=_0x227a49?0x0:_0x53b898[_0x35fc('0x1c')];var _0x5f56c6=_0x227a49?_0x154958[_0x35fc('0x1f')]:_0x53b898[_0x35fc('0x1c')]+_0x53b898[_0x35fc('0x1d')];var _0x488234;if(_0x5f56c6>=_0x553677){_0x5f56c6=_0x553677;_0x488234=0xc8;}else{_0x488234=0xce;}_0x229d56[_0x35fc('0x19')](_0x488234);return _0x229d56[_0x35fc('0x20')](_0x35fc('0x21'),_0x363e47+'-'+_0x5f56c6+'/'+_0x553677)[_0x35fc('0x1b')](_0x154958);}return null;};}function patchUpdates(_0x20ffde){return function(_0x21f1a9){try{jsonpatch[_0x35fc('0x22')](_0x21f1a9,_0x20ffde,!![]);}catch(_0x3b05b0){return BPromise[_0x35fc('0x23')](_0x3b05b0);}return _0x21f1a9[_0x35fc('0x24')]();};}function saveUpdates(_0x5bd2b8,_0x323aee){return function(_0xd5399f){if(_0xd5399f){return _0xd5399f[_0x35fc('0x25')](_0x5bd2b8)[_0x35fc('0x26')](function(_0x3b4743){return _0x3b4743;});}return null;};}function removeEntity(_0x55e9e7,_0x33f5e8){return function(_0x4c587a){if(_0x4c587a){return _0x4c587a['destroy']()[_0x35fc('0x26')](function(){var _0x5a93df=_0x4c587a[_0x35fc('0x27')]({'plain':!![]});var _0x51cfec=_0x35fc('0x28');return db['UserProfileResource'][_0x35fc('0x29')]({'where':{'type':_0x51cfec,'resourceId':_0x5a93df['id']}})[_0x35fc('0x26')](function(){return _0x4c587a;});})['then'](function(){_0x55e9e7['status'](0xcc)[_0x35fc('0x1a')]();});}};}function handleEntityNotFound(_0x58edb6,_0x274208){return function(_0x1a5d92){if(!_0x1a5d92){_0x58edb6['sendStatus'](0x194);}return _0x1a5d92;};}function handleError(_0x26b7cb,_0x645eac){_0x645eac=_0x645eac||0x1f4;return function(_0x383837){logger[_0x35fc('0x2a')](_0x383837[_0x35fc('0x2b')]);if(_0x383837[_0x35fc('0x2c')]){delete _0x383837[_0x35fc('0x2c')];}_0x26b7cb[_0x35fc('0x19')](_0x645eac)['send'](_0x383837);};}exports[_0x35fc('0x2d')]=function(_0x220931,_0x22af18){var _0x52acc5={},_0xe79f52={},_0x16f067={'count':0x0,'rows':[]};var _0x3822a8=_[_0x35fc('0x2e')](db[_0x35fc('0x2f')][_0x35fc('0x30')],function(_0x222ddb){return{'name':_0x222ddb[_0x35fc('0x31')],'type':_0x222ddb[_0x35fc('0x32')][_0x35fc('0x33')]};});_0xe79f52['model']=_['map'](_0x3822a8,_0x35fc('0x2c'));_0xe79f52['query']=_[_0x35fc('0x34')](_0x220931[_0x35fc('0x35')]);_0xe79f52[_0x35fc('0x36')]=_[_0x35fc('0x37')](_0xe79f52[_0x35fc('0x38')],_0xe79f52[_0x35fc('0x35')]);_0x52acc5['attributes']=_[_0x35fc('0x37')](_0xe79f52[_0x35fc('0x38')],qs[_0x35fc('0x39')](_0x220931[_0x35fc('0x35')][_0x35fc('0x39')]));_0x52acc5[_0x35fc('0x3a')]=_0x52acc5['attributes'][_0x35fc('0x3b')]?_0x52acc5[_0x35fc('0x3a')]:_0xe79f52[_0x35fc('0x38')];if(!_0x220931['query'][_0x35fc('0x3c')]('nolimit')){_0x52acc5[_0x35fc('0x1d')]=qs[_0x35fc('0x1d')](_0x220931[_0x35fc('0x35')][_0x35fc('0x1d')]);_0x52acc5['offset']=qs['offset'](_0x220931['query'][_0x35fc('0x1c')]);}_0x52acc5['order']=qs[_0x35fc('0x3d')](_0x220931['query'][_0x35fc('0x3d')]);_0x52acc5[_0x35fc('0x3e')]=qs[_0x35fc('0x36')](_[_0x35fc('0x3f')](_0x220931[_0x35fc('0x35')],_0xe79f52[_0x35fc('0x36')]),_0x3822a8);if(_0x220931[_0x35fc('0x35')]['filter']){_0x52acc5[_0x35fc('0x3e')]=_[_0x35fc('0x40')](_0x52acc5['where'],{'$or':_[_0x35fc('0x2e')](_0x3822a8,function(_0x1ccc41){if(_0x1ccc41[_0x35fc('0x32')]!==_0x35fc('0x41')){var _0x813866={};_0x813866[_0x1ccc41[_0x35fc('0x2c')]]={'$like':'%'+_0x220931['query'][_0x35fc('0x42')]+'%'};return _0x813866;}})});}_0x52acc5=_[_0x35fc('0x40')]({},_0x52acc5,_0x220931[_0x35fc('0x43')]);var _0x52543b={'where':_0x52acc5[_0x35fc('0x3e')]};return db[_0x35fc('0x2f')]['count'](_0x52543b)[_0x35fc('0x26')](function(_0x280af1){_0x16f067[_0x35fc('0x1f')]=_0x280af1;if(_0x220931[_0x35fc('0x35')][_0x35fc('0x44')]){_0x52acc5[_0x35fc('0x45')]=[{'all':!![]}];}return db[_0x35fc('0x2f')][_0x35fc('0x46')](_0x52acc5);})['then'](function(_0x596e83){_0x16f067[_0x35fc('0x47')]=_0x596e83;return _0x16f067;})[_0x35fc('0x26')](respondWithFilteredResult(_0x22af18,_0x52acc5))['catch'](handleError(_0x22af18,null));};exports['show']=function(_0x4ff202,_0x79677d){var _0x10f98b={'raw':!![],'where':{'id':_0x4ff202[_0x35fc('0x48')]['id']}},_0x4e56ed={};_0x4e56ed[_0x35fc('0x38')]=_[_0x35fc('0x34')](db[_0x35fc('0x2f')]['rawAttributes']);_0x4e56ed['query']=_['keys'](_0x4ff202['query']);_0x4e56ed['filters']=_[_0x35fc('0x37')](_0x4e56ed[_0x35fc('0x38')],_0x4e56ed['query']);_0x10f98b[_0x35fc('0x3a')]=_['intersection'](_0x4e56ed[_0x35fc('0x38')],qs[_0x35fc('0x39')](_0x4ff202[_0x35fc('0x35')][_0x35fc('0x39')]));_0x10f98b[_0x35fc('0x3a')]=_0x10f98b['attributes'][_0x35fc('0x3b')]?_0x10f98b[_0x35fc('0x3a')]:_0x4e56ed['model'];if(_0x4ff202[_0x35fc('0x35')][_0x35fc('0x44')]){_0x10f98b[_0x35fc('0x45')]=[{'all':!![]}];}_0x10f98b=_[_0x35fc('0x40')]({},_0x10f98b,_0x4ff202['options']);return db[_0x35fc('0x2f')]['find'](_0x10f98b)['then'](handleEntityNotFound(_0x79677d,null))[_0x35fc('0x26')](respondWithResult(_0x79677d,null))[_0x35fc('0x49')](handleError(_0x79677d,null));};exports[_0x35fc('0x4a')]=function(_0xca8aef,_0xf2ca20){return db[_0x35fc('0x2f')][_0x35fc('0x4a')](_0xca8aef[_0x35fc('0x4b')],{})['then'](function(_0x3e2961){var _0x91d7c0=_0xca8aef[_0x35fc('0x4c')][_0x35fc('0x27')]({'plain':!![]});if(!_0x91d7c0)throw new Error(_0x35fc('0x4d'));if(_0x91d7c0[_0x35fc('0x4e')]===_0x35fc('0x4c')){var _0x347a4a=_0x3e2961[_0x35fc('0x27')]({'plain':!![]});var _0xe6eb6a=_0x35fc('0x4f');return db[_0x35fc('0x50')][_0x35fc('0x51')]({'where':{'name':_0xe6eb6a,'userProfileId':_0x91d7c0[_0x35fc('0x52')]},'raw':!![]})['then'](function(_0x553ed6){if(_0x553ed6&&_0x553ed6[_0x35fc('0x53')]===0x0){return db[_0x35fc('0x54')][_0x35fc('0x4a')]({'name':_0x347a4a[_0x35fc('0x2c')],'resourceId':_0x347a4a['id'],'type':_0x35fc('0x28'),'sectionId':_0x553ed6['id']},{})[_0x35fc('0x26')](function(){return _0x3e2961;});}else{return _0x3e2961;}})['catch'](function(_0x4f024c){logger[_0x35fc('0x2a')](_0x35fc('0x55'),_0x4f024c);throw _0x4f024c;});}return _0x3e2961;})[_0x35fc('0x26')](respondWithResult(_0xf2ca20,0xc9))[_0x35fc('0x49')](handleError(_0xf2ca20,null));};exports['update']=function(_0x467980,_0x13281f){if(_0x467980['body']['id']){delete _0x467980[_0x35fc('0x4b')]['id'];}return db[_0x35fc('0x2f')]['find']({'where':{'id':_0x467980[_0x35fc('0x48')]['id']}})[_0x35fc('0x26')](handleEntityNotFound(_0x13281f,null))[_0x35fc('0x26')](saveUpdates(_0x467980[_0x35fc('0x4b')],null))['then'](respondWithResult(_0x13281f,null))['catch'](handleError(_0x13281f,null));};exports['destroy']=function(_0x240338,_0x2ea8d6){return db['AnalyticDefaultReport'][_0x35fc('0x51')]({'where':{'id':_0x240338[_0x35fc('0x48')]['id']}})[_0x35fc('0x26')](handleEntityNotFound(_0x2ea8d6,null))[_0x35fc('0x26')](removeEntity(_0x2ea8d6,null))[_0x35fc('0x49')](handleError(_0x2ea8d6,null));};exports['preview']=function(_0x2d9d45,_0x757aa6){var _0x39d470=0xa;var _0x509e77=[_0x35fc('0x56'),_0x35fc('0x57'),'right_join',_0x35fc('0x58')];var _0x164c7b={'SUM':_0x35fc('0x59'),'COUNT':_0x35fc('0x5a'),'COUNT DISTINCT':_0x35fc('0x5b'),'MAX':_0x35fc('0x5c'),'MIN':_0x35fc('0x5d'),'AVG':_0x35fc('0x5e'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x35fc('0x5f'),'GROUP_CONCAT DESC':_0x35fc('0x60')};var _0x303927={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x35fc('0x61'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x23b54f=function(_0xb1c68a){return!_[_0x35fc('0x62')]([_0x35fc('0x63'),_0x35fc('0x64'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0xb1c68a);};var _0x5353ea=function(_0x4faef4){if(!_0x4faef4||!_0x4faef4['rules'][_0x35fc('0x3b')]){return'';}for(var _0x44250b='(',_0xd470e8=0x0;_0xd470e8<_0x4faef4[_0x35fc('0x65')]['length'];_0xd470e8+=0x1){_0xd470e8>0x0&&(_0x44250b+='\x20'+_0x4faef4[_0x35fc('0x66')]+'\x20');_0x44250b+=_0x4faef4[_0x35fc('0x65')][_0xd470e8][_0x35fc('0x67')]?_0x5353ea(_0x4faef4[_0x35fc('0x65')][_0xd470e8][_0x35fc('0x67')]):_0x4faef4[_0x35fc('0x65')][_0xd470e8][_0x35fc('0x68')]+'\x20'+_0x4faef4[_0x35fc('0x65')][_0xd470e8][_0x35fc('0x69')]+(_0x23b54f(_0x4faef4['rules'][_0xd470e8][_0x35fc('0x69')])?'\x20'+_0x4faef4['rules'][_0xd470e8][_0x35fc('0x6a')]:'');}return _0x44250b+')';};var _0x9029e3={'where':{'id':_0x2d9d45['params']['id']}},_0x2ac8e1,_0x2bc76c,_0x4bdde7,_0x465c14,_0x4af592;_0x9029e3=_['merge']({},_0x9029e3,_0x2d9d45[_0x35fc('0x43')]);return db['AnalyticDefaultReport'][_0x35fc('0x51')](_0x9029e3)['then'](function(_0x11717){if(_0x11717){_0x2ac8e1=_0x11717;return _0x11717['getFields']();}return null;})[_0x35fc('0x26')](function(_0x455b84){if(_0x455b84){if(!_0x455b84[_0x35fc('0x3b')]){throw new db[(_0x35fc('0x6b'))]['ValidationErrorItem'](_0x35fc('0x6c'),0x193);}_0x2bc76c=_0x455b84;return db[_0x35fc('0x6d')][_0x35fc('0x46')]({'raw':!![]});}return null;})['then'](function(_0x3aa7fa){if(_0x3aa7fa){_0x4bdde7=_[_0x35fc('0x6e')](_0x3aa7fa,'id');var _0x37764b;var _0x3c1b56=squel[_0x35fc('0x6f')]();_0x3c1b56[_0x35fc('0x70')](_0x2ac8e1[_0x35fc('0x71')]);for(var _0x4464d5=0x0;_0x4464d5<_0x2bc76c['length'];_0x4464d5+=0x1){_0x37764b=_0x2bc76c[_0x4464d5][_0x35fc('0x72')]?_0x4bdde7[_0x2bc76c[_0x4464d5][_0x35fc('0x72')]][_0x35fc('0x73')]:_0x2bc76c[_0x4464d5]['field'];_0x37764b=_0x2bc76c[_0x4464d5][_0x35fc('0x74')]?_[_0x35fc('0x75')](_0x164c7b[_0x2bc76c[_0x4464d5]['function']],'%s',_0x37764b):_0x37764b;_0x37764b=_0x2bc76c[_0x4464d5]['format']?_[_0x35fc('0x75')](_0x303927[_0x2bc76c[_0x4464d5]['format']],'%s',_0x37764b):_0x37764b;if(_0x2bc76c[_0x4464d5][_0x35fc('0x76')]){_0x3c1b56[_0x35fc('0x67')](_0x37764b);}_0x2bc76c[_0x4464d5][_0x35fc('0x77')]&&_0x3c1b56[_0x35fc('0x78')](_0x37764b,_0x2bc76c[_0x4464d5][_0x35fc('0x77')]===_0x35fc('0x79')?![]:!![]);_0x3c1b56[_0x35fc('0x68')](_0x37764b,_0x2bc76c[_0x4464d5][_0x35fc('0x7a')]||_0x37764b);}if(_0x2ac8e1[_0x35fc('0x7b')]){_0x2ac8e1[_0x35fc('0x7b')]=JSON[_0x35fc('0x7c')](_0x2ac8e1[_0x35fc('0x7b')]);for(var _0x29f2b9=0x0;_0x29f2b9<_0x2ac8e1[_0x35fc('0x7b')][_0x35fc('0x3b')];_0x29f2b9+=0x1){if(_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x32')]&&_[_0x35fc('0x62')](_0x509e77,_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x32')])&&_0x2ac8e1['joins'][_0x29f2b9][_0x35fc('0x7d')]&&_0x2ac8e1['joins'][_0x29f2b9][_0x35fc('0x7e')]&&_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x7f')]){_0x3c1b56[_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x32')]](_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x7e')],null,util[_0x35fc('0x80')](_0x35fc('0x81'),_0x2ac8e1[_0x35fc('0x71')],_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9]['parentKey'],_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x7e')],_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x7f')]));}}}if(_0x2ac8e1[_0x35fc('0x82')]){_0x2ac8e1[_0x35fc('0x82')]=JSON['parse'](_0x2ac8e1[_0x35fc('0x82')]);_0x3c1b56[_0x35fc('0x3e')](_0x5353ea(_0x2ac8e1[_0x35fc('0x82')][_0x35fc('0x67')]));}_0x4af592=_0x3c1b56[_0x35fc('0x83')]();_0x3c1b56[_0x35fc('0x1d')](_0x39d470);_0x3c1b56[_0x35fc('0x1c')](0x0);logger[_0x35fc('0x84')](_0x35fc('0x85'),_0x3c1b56['toString']());return dbH[_0x35fc('0x86')]['query'](_0x3c1b56[_0x35fc('0x87')](),{'type':dbH[_0x35fc('0x86')]['QueryTypes'][_0x35fc('0x88')]});}})[_0x35fc('0x26')](respondWithResult(_0x757aa6,null))[_0x35fc('0x49')](handleError(_0x757aa6,null));};function runReport(_0x4274d6,_0x4026cc,_0x1a765f){var _0x42f87e=_0x4026cc[_0x35fc('0x2c')];var _0x25ee61=0xa;var _0x5806bf=['join','left_join','right_join',_0x35fc('0x58')];var _0x23cf84={'SUM':_0x35fc('0x59'),'COUNT':_0x35fc('0x5a'),'COUNT DISTINCT':_0x35fc('0x5b'),'MAX':'MAX(%s)','MIN':_0x35fc('0x5d'),'AVG':_0x35fc('0x5e'),'GROUP_CONCAT':_0x35fc('0x89'),'GROUP_CONCAT ASC':_0x35fc('0x5f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x15e936={'SEC_TO_TIME':_0x35fc('0x8a'),'DATE':_0x35fc('0x61'),'HOUR':'HOUR(%s)','ROUND':_0x35fc('0x8b'),'UNIX_TIMESTAMP':_0x35fc('0x8c')};var _0x319033=function(_0x9fe765){return!_[_0x35fc('0x62')]([_0x35fc('0x63'),_0x35fc('0x64'),_0x35fc('0x8d'),'IS\x20NOT\x20EMPTY'],_0x9fe765);};var _0x2faff7=function(_0xa2c5f8){if(!_0xa2c5f8||!_0xa2c5f8[_0x35fc('0x65')][_0x35fc('0x3b')]){return'';}for(var _0x221c5b='(',_0x1fcd36=0x0;_0x1fcd36<_0xa2c5f8['rules'][_0x35fc('0x3b')];_0x1fcd36+=0x1){_0x1fcd36>0x0&&(_0x221c5b+='\x20'+_0xa2c5f8['operator']+'\x20');_0x221c5b+=_0xa2c5f8['rules'][_0x1fcd36][_0x35fc('0x67')]?_0x2faff7(_0xa2c5f8['rules'][_0x1fcd36][_0x35fc('0x67')]):_0xa2c5f8[_0x35fc('0x65')][_0x1fcd36][_0x35fc('0x68')]+'\x20'+_0xa2c5f8['rules'][_0x1fcd36][_0x35fc('0x69')]+(_0x319033(_0xa2c5f8[_0x35fc('0x65')][_0x1fcd36][_0x35fc('0x69')])?'\x20'+_0xa2c5f8[_0x35fc('0x65')][_0x1fcd36][_0x35fc('0x6a')]:'');}return _0x221c5b+')';};var _0x5abdf9={'where':{'id':_0x4274d6['id']}},_0x5512f6,_0x487cb5,_0x23b261,_0x4c742c,_0x2fae26;_0x5abdf9=_[_0x35fc('0x40')]({},_0x5abdf9,_0x1a765f);return db[_0x35fc('0x2f')][_0x35fc('0x51')](_0x5abdf9)['then'](function(_0x28e80d){if(_0x28e80d){_0x5512f6=_0x28e80d;return _0x28e80d[_0x35fc('0x8e')]();}return null;})[_0x35fc('0x26')](function(_0x47c507){if(_0x47c507){if(!_0x47c507[_0x35fc('0x3b')]){throw new db[(_0x35fc('0x6b'))][(_0x35fc('0x8f'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x487cb5=_0x47c507;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x35fc('0x26')](function(_0x2edb1b){if(_0x2edb1b){_0x23b261=_[_0x35fc('0x6e')](_0x2edb1b,'id');var _0x3858a9;var _0x4859be=squel[_0x35fc('0x6f')]();_0x4859be[_0x35fc('0x70')](_0x5512f6['table']);for(var _0x5849a0=0x0;_0x5849a0<_0x487cb5[_0x35fc('0x3b')];_0x5849a0+=0x1){_0x3858a9=_0x487cb5[_0x5849a0][_0x35fc('0x72')]?_0x23b261[_0x487cb5[_0x5849a0][_0x35fc('0x72')]]['metric']:_0x487cb5[_0x5849a0]['field'];_0x3858a9=_0x487cb5[_0x5849a0][_0x35fc('0x74')]?_[_0x35fc('0x75')](_0x23cf84[_0x487cb5[_0x5849a0]['function']],'%s',_0x3858a9):_0x3858a9;_0x3858a9=_0x487cb5[_0x5849a0][_0x35fc('0x80')]?_[_0x35fc('0x75')](_0x15e936[_0x487cb5[_0x5849a0][_0x35fc('0x80')]],'%s',_0x3858a9):_0x3858a9;if(_0x487cb5[_0x5849a0]['groupBy']){_0x4859be[_0x35fc('0x67')](_0x3858a9);}_0x487cb5[_0x5849a0][_0x35fc('0x77')]&&_0x4859be[_0x35fc('0x78')](_0x3858a9,_0x487cb5[_0x5849a0][_0x35fc('0x77')]==='DESC'?![]:!![]);_0x4859be[_0x35fc('0x68')](_0x3858a9,_0x487cb5[_0x5849a0][_0x35fc('0x7a')]||_0x3858a9);}if(_0x5512f6[_0x35fc('0x7b')]){_0x5512f6['joins']=JSON[_0x35fc('0x7c')](_0x5512f6[_0x35fc('0x7b')]);for(var _0x425f72=0x0;_0x425f72<_0x5512f6['joins'][_0x35fc('0x3b')];_0x425f72+=0x1){if(_0x5512f6[_0x35fc('0x7b')][_0x425f72]['type']&&_[_0x35fc('0x62')](_0x5806bf,_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x32')])&&_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7d')]&&_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7e')]&&_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7f')]){_0x4859be[_0x5512f6['joins'][_0x425f72][_0x35fc('0x32')]](_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7e')],null,util[_0x35fc('0x80')]('%s.%s\x20=\x20%s.%s',_0x5512f6[_0x35fc('0x71')],_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7d')],_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7e')],_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7f')]));}}}if(_0x5512f6[_0x35fc('0x82')]){_0x5512f6['conditions']=JSON['parse'](_0x5512f6[_0x35fc('0x82')]);_0x4859be[_0x35fc('0x3e')](_0x2faff7(_0x5512f6[_0x35fc('0x82')]['group']));}_0x2fae26=_0x4859be[_0x35fc('0x83')]();_0x4859be[_0x35fc('0x1d')](_0x25ee61);_0x4859be[_0x35fc('0x1c')](0x0);return;}})[_0x35fc('0x26')](function(){if(_0x4026cc['output']==='web'){return null;}var _0x379650=_['merge'](_0x4026cc,{'name':_0x4026cc[_0x35fc('0x90')]||_0x4026cc[_0x35fc('0x2c')]||_0x5512f6['name'],'basename':_0x42f87e,'savename':util['format'](_0x35fc('0x91'),_0x4026cc[_0x35fc('0x2c')]||_0x5512f6[_0x35fc('0x2c')],require('randomstring')[_0x35fc('0x92')](0x4),_0x4026cc[_0x35fc('0x93')]||_0x35fc('0x94')),'reportId':_0x5512f6['id'],'reportType':'default'});return db[_0x35fc('0x95')][_0x35fc('0x4a')](_0x379650,{'raw':!![]});})[_0x35fc('0x26')](function(_0x328e90){if(_0x5512f6['table']===_0x35fc('0x96')){_0x2fae26[_0x35fc('0x3e')](_0x5512f6[_0x35fc('0x71')]+_0x35fc('0x97'),_0x4026cc[_0x35fc('0x98')],_0x4026cc[_0x35fc('0x99')]);}else{_0x2fae26['where'](_0x5512f6[_0x35fc('0x71')]+_0x35fc('0x9a'),_0x4026cc['startDate'],_0x4026cc[_0x35fc('0x99')]);}if(_0x328e90){logger[_0x35fc('0x9b')]('Run\x20Query:',_0x2fae26[_0x35fc('0x87')]());require(_0x35fc('0x9c'))[_0x35fc('0x9d')](path[_0x35fc('0x56')](__dirname,_0x35fc('0x9e'),_0x328e90['output']),[_0x328e90['id'],_0x2fae26[_0x35fc('0x87')](),path[_0x35fc('0x56')](__dirname,_0x35fc('0x9f'),_0x328e90['savename']),_0x42f87e]);return _0x328e90;}else{var _0x1224cd=squel['select']();_0x1224cd['from']('('+_0x2fae26[_0x35fc('0x87')]()+')',_0x35fc('0xa0'));_0x1224cd[_0x35fc('0x68')](_0x35fc('0xa1'),_0x35fc('0x1f'));_0x2fae26['limit'](_0x4026cc[_0x35fc('0x1d')]||_0x25ee61);_0x2fae26[_0x35fc('0x1c')](_0x4026cc[_0x35fc('0x1c')]||0x0);return dbH['sequelize'][_0x35fc('0x35')](_0x1224cd[_0x35fc('0x87')](),{'type':dbH[_0x35fc('0x86')][_0x35fc('0xa2')][_0x35fc('0x88')]})['then'](function(_0x1a2d73){if(!_0x1a2d73[_0x35fc('0x3b')]){_0x4c742c=0x0;}else{_0x4c742c=_0x1a2d73[0x0]['count']||0x0;}return dbH['sequelize'][_0x35fc('0x35')](_0x2fae26[_0x35fc('0x87')](),{'type':dbH[_0x35fc('0x86')][_0x35fc('0xa2')][_0x35fc('0x88')]});})[_0x35fc('0x26')](function(_0x8c80ca){return{'rows':_0x8c80ca||[],'count':_0x4c742c};});}});}exports['run']=function(_0x5dc286,_0x146ce1){return runReport(_0x5dc286[_0x35fc('0x48')],_0x5dc286[_0x35fc('0x35')],_0x5dc286[_0x35fc('0x43')])[_0x35fc('0x26')](respondWithResult(_0x146ce1,null))['catch'](handleError(_0x146ce1,null));};exports['runReport']=runReport;exports[_0x35fc('0x35')]=function(_0x2451f2,_0x3fff79){var _0x1c6ce9=0xa;var _0x4b2079=['join',_0x35fc('0x57'),_0x35fc('0xa3'),_0x35fc('0x58')];var _0xd46d64={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x35fc('0x5b'),'MAX':_0x35fc('0x5c'),'MIN':'MIN(%s)','AVG':_0x35fc('0x5e'),'GROUP_CONCAT':_0x35fc('0x89'),'GROUP_CONCAT ASC':_0x35fc('0x5f'),'GROUP_CONCAT DESC':_0x35fc('0x60')};var _0x274337={'SEC_TO_TIME':_0x35fc('0x8a'),'DATE':_0x35fc('0x61'),'HOUR':_0x35fc('0xa4'),'ROUND':_0x35fc('0x8b'),'UNIX_TIMESTAMP':_0x35fc('0x8c')};var _0x19ae76=function(_0x366a3b){return!_[_0x35fc('0x62')]([_0x35fc('0x63'),_0x35fc('0x64'),_0x35fc('0x8d'),'IS\x20NOT\x20EMPTY'],_0x366a3b);};var _0x345026=function(_0x553f7d){if(!_0x553f7d||!_0x553f7d[_0x35fc('0x65')]['length']){return'';}for(var _0x5aa072='(',_0x3c96ef=0x0;_0x3c96ef<_0x553f7d[_0x35fc('0x65')][_0x35fc('0x3b')];_0x3c96ef+=0x1){_0x3c96ef>0x0&&(_0x5aa072+='\x20'+_0x553f7d['operator']+'\x20');_0x5aa072+=_0x553f7d[_0x35fc('0x65')][_0x3c96ef][_0x35fc('0x67')]?_0x345026(_0x553f7d[_0x35fc('0x65')][_0x3c96ef][_0x35fc('0x67')]):_0x553f7d[_0x35fc('0x65')][_0x3c96ef][_0x35fc('0x68')]+'\x20'+_0x553f7d['rules'][_0x3c96ef]['condition']+(_0x19ae76(_0x553f7d[_0x35fc('0x65')][_0x3c96ef]['condition'])?'\x20'+_0x553f7d['rules'][_0x3c96ef][_0x35fc('0x6a')]:'');}return _0x5aa072+')';};var _0x48b826={'where':{'id':_0x2451f2[_0x35fc('0x48')]['id']}},_0x556f9a,_0x5ae83f,_0x450769,_0x5d461c,_0x355154;_0x48b826=_[_0x35fc('0x40')]({},_0x48b826,_0x2451f2[_0x35fc('0x43')]);return db[_0x35fc('0x2f')][_0x35fc('0x51')](_0x48b826)['then'](function(_0x522ff2){if(_0x522ff2){_0x556f9a=_0x522ff2;return _0x522ff2[_0x35fc('0x8e')]();}return null;})['then'](function(_0x233c94){if(_0x233c94){if(!_0x233c94[_0x35fc('0x3b')]){throw new db['Sequelize']['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5ae83f=_0x233c94;return db[_0x35fc('0x6d')][_0x35fc('0x46')]({'raw':!![]});}return null;})[_0x35fc('0x26')](function(_0x135e18){if(_0x135e18){_0x450769=_[_0x35fc('0x6e')](_0x135e18,'id');var _0x28525f;var _0x9116b1=squel[_0x35fc('0x6f')]();_0x9116b1['from'](_0x556f9a['table']);for(var _0x5cefdb=0x0;_0x5cefdb<_0x5ae83f['length'];_0x5cefdb+=0x1){_0x28525f=_0x5ae83f[_0x5cefdb][_0x35fc('0x72')]?_0x450769[_0x5ae83f[_0x5cefdb]['MetricId']][_0x35fc('0x73')]:_0x5ae83f[_0x5cefdb]['field'];_0x28525f=_0x5ae83f[_0x5cefdb][_0x35fc('0x74')]?_[_0x35fc('0x75')](_0xd46d64[_0x5ae83f[_0x5cefdb]['function']],'%s',_0x28525f):_0x28525f;_0x28525f=_0x5ae83f[_0x5cefdb]['format']?_[_0x35fc('0x75')](_0x274337[_0x5ae83f[_0x5cefdb][_0x35fc('0x80')]],'%s',_0x28525f):_0x28525f;if(_0x5ae83f[_0x5cefdb][_0x35fc('0x76')]){_0x9116b1[_0x35fc('0x67')](_0x28525f);}_0x5ae83f[_0x5cefdb][_0x35fc('0x77')]&&_0x9116b1['order'](_0x28525f,_0x5ae83f[_0x5cefdb]['orderBy']===_0x35fc('0x79')?![]:!![]);_0x9116b1['field'](_0x28525f,_0x5ae83f[_0x5cefdb][_0x35fc('0x7a')]||_0x28525f);}if(_0x556f9a['joins']){_0x556f9a[_0x35fc('0x7b')]=JSON[_0x35fc('0x7c')](_0x556f9a[_0x35fc('0x7b')]);for(var _0x10e30e=0x0;_0x10e30e<_0x556f9a['joins'][_0x35fc('0x3b')];_0x10e30e+=0x1){if(_0x556f9a['joins'][_0x10e30e][_0x35fc('0x32')]&&_['includes'](_0x4b2079,_0x556f9a['joins'][_0x10e30e][_0x35fc('0x32')])&&_0x556f9a['joins'][_0x10e30e][_0x35fc('0x7d')]&&_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7e')]&&_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7f')]){_0x9116b1[_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x32')]](_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7e')],null,util['format'](_0x35fc('0x81'),_0x556f9a[_0x35fc('0x71')],_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7d')],_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7e')],_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7f')]));}}}if(_0x556f9a['conditions']){_0x556f9a['conditions']=JSON['parse'](_0x556f9a['conditions']);_0x9116b1['where'](_0x345026(_0x556f9a[_0x35fc('0x82')][_0x35fc('0x67')]));}_0x355154=_0x9116b1[_0x35fc('0x83')]();_0x9116b1[_0x35fc('0x1d')](_0x1c6ce9);_0x9116b1[_0x35fc('0x1c')](0x0);logger['debug'](_0x35fc('0x85'),_0x9116b1[_0x35fc('0x87')]());return dbH[_0x35fc('0x86')][_0x35fc('0x35')](_0x9116b1[_0x35fc('0x87')](),{'type':dbH['sequelize'][_0x35fc('0xa2')][_0x35fc('0x88')]});}})[_0x35fc('0x26')](function(){return{'sql':_0x355154['toString']()};})[_0x35fc('0x26')](respondWithResult(_0x3fff79,null))[_0x35fc('0x49')](handleError(_0x3fff79,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 49ce19d..b8bb30a 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 _0xe619=['analytics_default_reports','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticDefaultReport'];(function(_0x7895e5,_0x54a2a7){var _0x4e9b71=function(_0x4e5a6b){while(--_0x4e5a6b){_0x7895e5['push'](_0x7895e5['shift']());}};_0x4e9b71(++_0x54a2a7);}(_0xe619,0x181));var _0x9e61=function(_0x20f76a,_0x2605e2){_0x20f76a=_0x20f76a-0x0;var _0x30016d=_0xe619[_0x20f76a];return _0x30016d;};'use strict';var _=require(_0x9e61('0x0'));var util=require(_0x9e61('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9e61('0x2'));var BPromise=require(_0x9e61('0x3'));var rp=require(_0x9e61('0x4'));var fs=require('fs');var path=require(_0x9e61('0x5'));var rimraf=require(_0x9e61('0x6'));var config=require(_0x9e61('0x7'));var attributes=require('./analyticDefaultReport.attributes');module[_0x9e61('0x8')]=function(_0x508a26,_0xf733bc){return _0x508a26[_0x9e61('0x9')](_0x9e61('0xa'),attributes,{'tableName':_0x9e61('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f73=['AnalyticDefaultReport','analytics_default_reports','lodash','api','bluebird','request-promise','path','../../config/environment','./analyticDefaultReport.attributes','exports','define'];(function(_0x21a88a,_0x2471c8){var _0x4c95b9=function(_0x41b5e6){while(--_0x41b5e6){_0x21a88a['push'](_0x21a88a['shift']());}};_0x4c95b9(++_0x2471c8);}(_0x1f73,0x1ba));var _0x31f7=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x1f73[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x31f7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x31f7('0x1'));var moment=require('moment');var BPromise=require(_0x31f7('0x2'));var rp=require(_0x31f7('0x3'));var fs=require('fs');var path=require(_0x31f7('0x4'));var rimraf=require('rimraf');var config=require(_0x31f7('0x5'));var attributes=require(_0x31f7('0x6'));module[_0x31f7('0x7')]=function(_0x44ca46,_0x2d5a38){return _0x44ca46[_0x31f7('0x8')](_0x31f7('0x9'),attributes,{'tableName':_0x31f7('0xa'),'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 2ba4714..d4145b2 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 _0x7001=['request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info'];(function(_0xf542d8,_0x5ac926){var _0x1e1e46=function(_0x2fc5fa){while(--_0x2fc5fa){_0xf542d8['push'](_0xf542d8['shift']());}};_0x1e1e46(++_0x5ac926);}(_0x7001,0x12e));var _0x1700=function(_0x37662e,_0x577e86){_0x37662e=_0x37662e-0x0;var _0x2c96a8=_0x7001[_0x37662e];return _0x2c96a8;};'use strict';var _=require('lodash');var util=require(_0x1700('0x0'));var moment=require(_0x1700('0x1'));var BPromise=require(_0x1700('0x2'));var rs=require(_0x1700('0x3'));var fs=require('fs');var Redis=require(_0x1700('0x4'));var db=require(_0x1700('0x5'))['db'];var utils=require(_0x1700('0x6'));var logger=require('../../config/logger')(_0x1700('0x7'));var config=require(_0x1700('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1700('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4590b1,_0x39f4ac,_0x8e4c4b){return new BPromise(function(_0x13dee6,_0x3ea3d6){return client[_0x1700('0xa')](_0x4590b1,_0x8e4c4b)[_0x1700('0xb')](function(_0x38ad2c){logger[_0x1700('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x39f4ac,_0x1700('0xd'));logger['debug'](_0x1700('0xe'),_0x39f4ac,'request\x20sent',JSON['stringify'](_0x38ad2c));if(_0x38ad2c[_0x1700('0xf')]){if(_0x38ad2c['error'][_0x1700('0x10')]===0x1f4){logger['error'](_0x1700('0x11'),_0x39f4ac,_0x38ad2c[_0x1700('0xf')][_0x1700('0x12')]);return _0x3ea3d6(_0x38ad2c['error'][_0x1700('0x12')]);}logger[_0x1700('0xf')](_0x1700('0x11'),_0x39f4ac,_0x38ad2c[_0x1700('0xf')]['message']);return _0x13dee6(_0x38ad2c[_0x1700('0xf')][_0x1700('0x12')]);}else{logger['info'](_0x1700('0x11'),_0x39f4ac,_0x1700('0xd'));_0x13dee6(_0x38ad2c[_0x1700('0x13')][_0x1700('0x12')]);}})[_0x1700('0x14')](function(_0x447b25){logger[_0x1700('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x39f4ac,_0x447b25);_0x3ea3d6(_0x447b25);});});} \ No newline at end of file +var _0xd8b7=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticDefaultReport,\x20%s,\x20%s','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result'];(function(_0x36909d,_0x2795f1){var _0x1fd29d=function(_0x27d0fa){while(--_0x27d0fa){_0x36909d['push'](_0x36909d['shift']());}};_0x1fd29d(++_0x2795f1);}(_0xd8b7,0xf0));var _0x7d8b=function(_0x28ea6e,_0x4b0081){_0x28ea6e=_0x28ea6e-0x0;var _0x4051a2=_0xd8b7[_0x28ea6e];return _0x4051a2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7d8b('0x0'));var BPromise=require(_0x7d8b('0x1'));var rs=require(_0x7d8b('0x2'));var fs=require('fs');var Redis=require(_0x7d8b('0x3'));var db=require(_0x7d8b('0x4'))['db'];var utils=require(_0x7d8b('0x5'));var logger=require(_0x7d8b('0x6'))(_0x7d8b('0x7'));var config=require(_0x7d8b('0x8'));var jayson=require(_0x7d8b('0x9'));var client=jayson[_0x7d8b('0xa')][_0x7d8b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x584605,_0xdc0214,_0x3bc0cc){return new BPromise(function(_0x2219d5,_0x46f9c4){return client[_0x7d8b('0xc')](_0x584605,_0x3bc0cc)[_0x7d8b('0xd')](function(_0x4513fc){logger['info'](_0x7d8b('0xe'),_0xdc0214,'request\x20sent');logger[_0x7d8b('0xf')](_0x7d8b('0x10'),_0xdc0214,_0x7d8b('0x11'),JSON[_0x7d8b('0x12')](_0x4513fc));if(_0x4513fc['error']){if(_0x4513fc[_0x7d8b('0x13')][_0x7d8b('0x14')]===0x1f4){logger[_0x7d8b('0x13')](_0x7d8b('0xe'),_0xdc0214,_0x4513fc[_0x7d8b('0x13')]['message']);return _0x46f9c4(_0x4513fc['error']['message']);}logger[_0x7d8b('0x13')](_0x7d8b('0xe'),_0xdc0214,_0x4513fc['error'][_0x7d8b('0x15')]);return _0x2219d5(_0x4513fc['error'][_0x7d8b('0x15')]);}else{logger[_0x7d8b('0x16')](_0x7d8b('0xe'),_0xdc0214,_0x7d8b('0x11'));_0x2219d5(_0x4513fc[_0x7d8b('0x17')][_0x7d8b('0x15')]);}})['catch'](function(_0x4be11d){logger[_0x7d8b('0x13')](_0x7d8b('0xe'),_0xdc0214,_0x4be11d);_0x46f9c4(_0x4be11d);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index a56f6f4..71b5c65 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 _0x9f20=['path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','show','/:id/preview','/:id/run','post','create','put','/:id','update','destroy','util'];(function(_0x55490d,_0x7b7bdb){var _0x2fb353=function(_0xf6c785){while(--_0xf6c785){_0x55490d['push'](_0x55490d['shift']());}};_0x2fb353(++_0x7b7bdb);}(_0x9f20,0x153));var _0x09f2=function(_0x42714f,_0xf5c000){_0x42714f=_0x42714f-0x0;var _0x3acc8a=_0x9f20[_0x42714f];return _0x3acc8a;};'use strict';var multer=require('multer');var util=require(_0x09f2('0x0'));var path=require(_0x09f2('0x1'));var timeout=require('connect-timeout');var express=require(_0x09f2('0x2'));var router=express[_0x09f2('0x3')]();var fs_extra=require(_0x09f2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x09f2('0x5'));var config=require(_0x09f2('0x6'));var controller=require(_0x09f2('0x7'));router[_0x09f2('0x8')]('/',auth[_0x09f2('0x9')](),controller[_0x09f2('0xa')]);router[_0x09f2('0x8')]('/:id',auth[_0x09f2('0x9')](),controller[_0x09f2('0xb')]);router['get'](_0x09f2('0xc'),auth[_0x09f2('0x9')](),controller['preview']);router[_0x09f2('0x8')](_0x09f2('0xd'),auth[_0x09f2('0x9')](),controller['run']);router[_0x09f2('0x8')]('/:id/query',auth['isAuthenticated'](),controller['query']);router[_0x09f2('0xe')]('/',auth[_0x09f2('0x9')](),controller[_0x09f2('0xf')]);router[_0x09f2('0x10')](_0x09f2('0x11'),auth[_0x09f2('0x9')](),controller[_0x09f2('0x12')]);router['delete'](_0x09f2('0x11'),auth[_0x09f2('0x9')](),controller[_0x09f2('0x13')]);module['exports']=router; \ No newline at end of file +var _0x8d14=['put','update','delete','multer','path','connect-timeout','express','Router','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','/:id/query','query','post'];(function(_0x5d154f,_0x1ea5d3){var _0x48d15a=function(_0x28b611){while(--_0x28b611){_0x5d154f['push'](_0x5d154f['shift']());}};_0x48d15a(++_0x1ea5d3);}(_0x8d14,0x1a7));var _0x48d1=function(_0x44bef2,_0x334d0d){_0x44bef2=_0x44bef2-0x0;var _0x292abc=_0x8d14[_0x44bef2];return _0x292abc;};'use strict';var multer=require(_0x48d1('0x0'));var util=require('util');var path=require(_0x48d1('0x1'));var timeout=require(_0x48d1('0x2'));var express=require(_0x48d1('0x3'));var router=express[_0x48d1('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x48d1('0x5'));var controller=require(_0x48d1('0x6'));router[_0x48d1('0x7')]('/',auth[_0x48d1('0x8')](),controller[_0x48d1('0x9')]);router[_0x48d1('0x7')](_0x48d1('0xa'),auth['isAuthenticated'](),controller[_0x48d1('0xb')]);router[_0x48d1('0x7')](_0x48d1('0xc'),auth['isAuthenticated'](),controller[_0x48d1('0xd')]);router['get'](_0x48d1('0xe'),auth[_0x48d1('0x8')](),controller['run']);router[_0x48d1('0x7')](_0x48d1('0xf'),auth[_0x48d1('0x8')](),controller[_0x48d1('0x10')]);router[_0x48d1('0x11')]('/',auth[_0x48d1('0x8')](),controller['create']);router[_0x48d1('0x12')](_0x48d1('0xa'),auth[_0x48d1('0x8')](),controller[_0x48d1('0x13')]);router[_0x48d1('0x14')](_0x48d1('0xa'),auth[_0x48d1('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 53d39b4..2e15b89 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 _0x8433=['csv','xlsx','DATE','scheduled','manual','UNSIGNED','STRING','ENUM'];(function(_0x44c547,_0x370d86){var _0x19dbad=function(_0x33e96c){while(--_0x33e96c){_0x44c547['push'](_0x44c547['shift']());}};_0x19dbad(++_0x370d86);}(_0x8433,0x66));var _0x3843=function(_0x1fafa5,_0x1aa281){_0x1fafa5=_0x1fafa5-0x0;var _0xcf08c9=_0x8433[_0x1fafa5];return _0xcf08c9;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'name':{'type':Sequelize[_0x3843('0x0')],'allowNull':![]},'basename':{'type':Sequelize[_0x3843('0x0')],'allowNull':![]},'output':{'type':Sequelize[_0x3843('0x1')](_0x3843('0x2'),'pdf',_0x3843('0x3')),'allowNull':![],'defaultValue':_0x3843('0x2')},'savename':{'type':Sequelize[_0x3843('0x0')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x3843('0x4')]},'status':{'type':Sequelize[_0x3843('0x0')],'defaultValue':'Loading'},'type':{'type':Sequelize['ENUM']('manual',_0x3843('0x5')),'allowNull':![],'defaultValue':_0x3843('0x6')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x3843('0x7')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa7a2=['UNSIGNED','sequelize','moment','exports','csv','STRING','DATE','Loading','ENUM','manual','scheduled','INTEGER'];(function(_0x49cee9,_0x28e9de){var _0x5c896d=function(_0x29a2dd){while(--_0x29a2dd){_0x49cee9['push'](_0x49cee9['shift']());}};_0x5c896d(++_0x28e9de);}(_0xa7a2,0x1e1));var _0x2a7a=function(_0x2374a6,_0x2b71f1){_0x2374a6=_0x2374a6-0x0;var _0x21d111=_0xa7a2[_0x2374a6];return _0x21d111;};'use strict';var Sequelize=require(_0x2a7a('0x0'));var moment=require(_0x2a7a('0x1'));module[_0x2a7a('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x2a7a('0x3'),'pdf','xlsx'),'allowNull':![],'defaultValue':_0x2a7a('0x3')},'savename':{'type':Sequelize[_0x2a7a('0x4')],'allowNull':![]},'startDate':{'type':Sequelize[_0x2a7a('0x5')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x2a7a('0x4')],'defaultValue':_0x2a7a('0x6')},'type':{'type':Sequelize[_0x2a7a('0x7')](_0x2a7a('0x8'),_0x2a7a('0x9')),'allowNull':![],'defaultValue':_0x2a7a('0x8')},'reportId':{'type':Sequelize[_0x2a7a('0xa')](0xb)[_0x2a7a('0xb')]},'reportType':{'type':Sequelize[_0x2a7a('0x4')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index ae5efca..5b22ece 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 _0x8aa6=['to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','error','name','index','map','AnalyticExtractedReport','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','includeAll','findAll','catch','keys','rawAttributes','include','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','download','basename','savename','output','existsSync','join','root','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','server/files/reports','toLowerCase','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox'];(function(_0x31dc39,_0x1ed3dd){var _0x4c426c=function(_0x27c291){while(--_0x27c291){_0x31dc39['push'](_0x31dc39['shift']());}};_0x4c426c(++_0x1ed3dd);}(_0x8aa6,0x111));var _0x68aa=function(_0x5c5fb4,_0x2cb903){_0x5c5fb4=_0x5c5fb4-0x0;var _0x4c0813=_0x8aa6[_0x5c5fb4];return _0x4c0813;};'use strict';var emlformat=require(_0x68aa('0x0'));var rimraf=require(_0x68aa('0x1'));var zipdir=require(_0x68aa('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x68aa('0x3'));var BPromise=require(_0x68aa('0x4'));var Mustache=require(_0x68aa('0x5'));var util=require(_0x68aa('0x6'));var path=require(_0x68aa('0x7'));var sox=require(_0x68aa('0x8'));var csv=require(_0x68aa('0x9'));var ejs=require(_0x68aa('0xa'));var fs=require('fs');var fs_extra=require(_0x68aa('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x68aa('0xc'));var deskjs=require(_0x68aa('0xd'));var toCsv=require(_0x68aa('0x9'));var querystring=require(_0x68aa('0xe'));var Papa=require(_0x68aa('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x68aa('0x10'));var as=require(_0x68aa('0x11'));var hardwareService=require(_0x68aa('0x12'));var logger=require(_0x68aa('0x13'))(_0x68aa('0x14'));var utils=require(_0x68aa('0x15'));var config=require(_0x68aa('0x16'));var licenseUtil=require(_0x68aa('0x17'));var db=require(_0x68aa('0x18'))['db'];function respondWithStatusCode(_0x1bbd14,_0x691afa){_0x691afa=_0x691afa||0xcc;return function(_0x372fbd){if(_0x372fbd){return _0x1bbd14[_0x68aa('0x19')](_0x691afa);}return _0x1bbd14[_0x68aa('0x1a')](_0x691afa)[_0x68aa('0x1b')]();};}function respondWithResult(_0x2e045f,_0x495af8){_0x495af8=_0x495af8||0xc8;return function(_0x3bf6ec){if(_0x3bf6ec){return _0x2e045f['status'](_0x495af8)[_0x68aa('0x1c')](_0x3bf6ec);}};}function respondWithFilteredResult(_0x5e6ed5,_0x40ae9f){return function(_0x35dfa5){if(_0x35dfa5){var _0x4a6313=typeof _0x40ae9f['offset']===_0x68aa('0x1d')&&typeof _0x40ae9f[_0x68aa('0x1e')]===_0x68aa('0x1d');var _0x3337e0=_0x35dfa5['count'];var _0x54385d=_0x4a6313?0x0:_0x40ae9f[_0x68aa('0x1f')];var _0xb35ca4=_0x4a6313?_0x35dfa5[_0x68aa('0x20')]:_0x40ae9f[_0x68aa('0x1f')]+_0x40ae9f['limit'];var _0x1d699f;if(_0xb35ca4>=_0x3337e0){_0xb35ca4=_0x3337e0;_0x1d699f=0xc8;}else{_0x1d699f=0xce;}_0x5e6ed5['status'](_0x1d699f);return _0x5e6ed5[_0x68aa('0x21')](_0x68aa('0x22'),_0x54385d+'-'+_0xb35ca4+'/'+_0x3337e0)['json'](_0x35dfa5);}return null;};}function patchUpdates(_0x51ae39){return function(_0x1e72ab){try{jsonpatch[_0x68aa('0x23')](_0x1e72ab,_0x51ae39,!![]);}catch(_0x187cf3){return BPromise[_0x68aa('0x24')](_0x187cf3);}return _0x1e72ab[_0x68aa('0x25')]();};}function saveUpdates(_0x1cc59f,_0x5afedf){return function(_0x28afdf){if(_0x28afdf){return _0x28afdf[_0x68aa('0x26')](_0x1cc59f)[_0x68aa('0x27')](function(_0xe4eb9d){return _0xe4eb9d;});}return null;};}function removeEntity(_0x2378f5,_0x1f316e){return function(_0x2d574a){if(_0x2d574a){return _0x2d574a[_0x68aa('0x28')]()[_0x68aa('0x27')](function(){var _0x4dec2f=_0x2d574a[_0x68aa('0x29')]({'plain':!![]});var _0x40d7bd=_0x68aa('0x2a');return db[_0x68aa('0x2b')][_0x68aa('0x28')]({'where':{'type':_0x40d7bd,'resourceId':_0x4dec2f['id']}})[_0x68aa('0x27')](function(){return _0x2d574a;});})[_0x68aa('0x27')](function(){_0x2378f5['status'](0xcc)[_0x68aa('0x1b')]();});}};}function handleEntityNotFound(_0xec9546,_0x2aa107){return function(_0x2d13a1){if(!_0x2d13a1){_0xec9546[_0x68aa('0x19')](0x194);}return _0x2d13a1;};}function handleError(_0x3986fe,_0x4f30f9){_0x4f30f9=_0x4f30f9||0x1f4;return function(_0x53da83){logger[_0x68aa('0x2c')](_0x53da83['stack']);if(_0x53da83[_0x68aa('0x2d')]){delete _0x53da83[_0x68aa('0x2d')];}_0x3986fe[_0x68aa('0x1a')](_0x4f30f9)['send'](_0x53da83);};}exports[_0x68aa('0x2e')]=function(_0x399483,_0x4fe76a){var _0x844c3d={},_0x1ef13c={},_0x4995ff={'count':0x0,'rows':[]};var _0x4b0534=_[_0x68aa('0x2f')](db[_0x68aa('0x30')]['rawAttributes'],function(_0x292c2c){return{'name':_0x292c2c[_0x68aa('0x31')],'type':_0x292c2c[_0x68aa('0x32')][_0x68aa('0x33')]};});_0x1ef13c[_0x68aa('0x34')]=_[_0x68aa('0x2f')](_0x4b0534,_0x68aa('0x2d'));_0x1ef13c[_0x68aa('0x35')]=_['keys'](_0x399483[_0x68aa('0x35')]);_0x1ef13c['filters']=_['intersection'](_0x1ef13c[_0x68aa('0x34')],_0x1ef13c[_0x68aa('0x35')]);_0x844c3d['attributes']=_[_0x68aa('0x36')](_0x1ef13c[_0x68aa('0x34')],qs[_0x68aa('0x37')](_0x399483['query'][_0x68aa('0x37')]));_0x844c3d[_0x68aa('0x38')]=_0x844c3d[_0x68aa('0x38')][_0x68aa('0x39')]?_0x844c3d[_0x68aa('0x38')]:_0x1ef13c[_0x68aa('0x34')];if(!_0x399483[_0x68aa('0x35')]['hasOwnProperty'](_0x68aa('0x3a'))){_0x844c3d[_0x68aa('0x1e')]=qs['limit'](_0x399483['query'][_0x68aa('0x1e')]);_0x844c3d[_0x68aa('0x1f')]=qs[_0x68aa('0x1f')](_0x399483[_0x68aa('0x35')]['offset']);}_0x844c3d[_0x68aa('0x3b')]=qs[_0x68aa('0x3c')](_0x399483[_0x68aa('0x35')][_0x68aa('0x3c')]);_0x844c3d['where']=qs[_0x68aa('0x3d')](_['pick'](_0x399483[_0x68aa('0x35')],_0x1ef13c['filters']),_0x4b0534);if(_0x399483['query'][_0x68aa('0x3e')]){_0x844c3d[_0x68aa('0x3f')]=_['merge'](_0x844c3d[_0x68aa('0x3f')],{'$or':_['map'](_0x4b0534,function(_0x5ea56c){if(_0x5ea56c[_0x68aa('0x32')]!==_0x68aa('0x40')){var _0x310924={};_0x310924[_0x5ea56c[_0x68aa('0x2d')]]={'$like':'%'+_0x399483['query'][_0x68aa('0x3e')]+'%'};return _0x310924;}})});}_0x844c3d=_[_0x68aa('0x41')]({},_0x844c3d,_0x399483['options']);var _0xb4cc40={'where':_0x844c3d[_0x68aa('0x3f')]};return db['AnalyticExtractedReport'][_0x68aa('0x20')](_0xb4cc40)[_0x68aa('0x27')](function(_0x23e69c){_0x4995ff['count']=_0x23e69c;if(_0x399483['query'][_0x68aa('0x42')]){_0x844c3d['include']=[{'all':!![]}];}return db[_0x68aa('0x30')][_0x68aa('0x43')](_0x844c3d);})[_0x68aa('0x27')](function(_0x21b7aa){_0x4995ff['rows']=_0x21b7aa;return _0x4995ff;})[_0x68aa('0x27')](respondWithFilteredResult(_0x4fe76a,_0x844c3d))[_0x68aa('0x44')](handleError(_0x4fe76a,null));};exports['show']=function(_0x1037de,_0x3b0b52){var _0xdb5ebd={'raw':!![],'where':{'id':_0x1037de['params']['id']}},_0x1d1cdc={};_0x1d1cdc[_0x68aa('0x34')]=_[_0x68aa('0x45')](db[_0x68aa('0x30')][_0x68aa('0x46')]);_0x1d1cdc[_0x68aa('0x35')]=_[_0x68aa('0x45')](_0x1037de['query']);_0x1d1cdc[_0x68aa('0x3d')]=_[_0x68aa('0x36')](_0x1d1cdc[_0x68aa('0x34')],_0x1d1cdc['query']);_0xdb5ebd[_0x68aa('0x38')]=_[_0x68aa('0x36')](_0x1d1cdc['model'],qs[_0x68aa('0x37')](_0x1037de[_0x68aa('0x35')]['fields']));_0xdb5ebd[_0x68aa('0x38')]=_0xdb5ebd[_0x68aa('0x38')][_0x68aa('0x39')]?_0xdb5ebd['attributes']:_0x1d1cdc[_0x68aa('0x34')];if(_0x1037de['query'][_0x68aa('0x42')]){_0xdb5ebd[_0x68aa('0x47')]=[{'all':!![]}];}_0xdb5ebd=_[_0x68aa('0x41')]({},_0xdb5ebd,_0x1037de['options']);return db['AnalyticExtractedReport'][_0x68aa('0x48')](_0xdb5ebd)[_0x68aa('0x27')](handleEntityNotFound(_0x3b0b52,null))['then'](respondWithResult(_0x3b0b52,null))[_0x68aa('0x44')](handleError(_0x3b0b52,null));};exports[_0x68aa('0x49')]=function(_0x49f8f9,_0x163cf9){return db[_0x68aa('0x30')][_0x68aa('0x49')](_0x49f8f9[_0x68aa('0x4a')],{})[_0x68aa('0x27')](function(_0x23a6e1){var _0x35211a=_0x49f8f9[_0x68aa('0x4b')]['get']({'plain':!![]});if(!_0x35211a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x35211a[_0x68aa('0x4c')]==='user'){var _0x401784=_0x23a6e1['get']({'plain':!![]});var _0x32919b=_0x68aa('0x2a');return db[_0x68aa('0x4d')]['find']({'where':{'name':_0x32919b,'userProfileId':_0x35211a[_0x68aa('0x4e')]},'raw':!![]})[_0x68aa('0x27')](function(_0x3c959e){if(_0x3c959e&&_0x3c959e[_0x68aa('0x4f')]===0x0){return db[_0x68aa('0x2b')][_0x68aa('0x49')]({'name':_0x401784[_0x68aa('0x2d')],'resourceId':_0x401784['id'],'type':_0x3c959e['name'],'sectionId':_0x3c959e['id']},{})[_0x68aa('0x27')](function(){return _0x23a6e1;});}else{return _0x23a6e1;}})[_0x68aa('0x44')](function(_0x1efc77){logger[_0x68aa('0x2c')](_0x68aa('0x50'),_0x1efc77);throw _0x1efc77;});}return _0x23a6e1;})[_0x68aa('0x27')](respondWithResult(_0x163cf9,0xc9))[_0x68aa('0x44')](handleError(_0x163cf9,null));};exports[_0x68aa('0x26')]=function(_0x2e6e5c,_0x41cdd1){if(_0x2e6e5c['body']['id']){delete _0x2e6e5c['body']['id'];}return db[_0x68aa('0x30')][_0x68aa('0x48')]({'where':{'id':_0x2e6e5c[_0x68aa('0x51')]['id']}})[_0x68aa('0x27')](handleEntityNotFound(_0x41cdd1,null))[_0x68aa('0x27')](saveUpdates(_0x2e6e5c['body'],null))[_0x68aa('0x27')](respondWithResult(_0x41cdd1,null))[_0x68aa('0x44')](handleError(_0x41cdd1,null));};exports['destroy']=function(_0x496aa3,_0x1a8026){return db[_0x68aa('0x30')][_0x68aa('0x48')]({'where':{'id':_0x496aa3[_0x68aa('0x51')]['id']}})[_0x68aa('0x27')](handleEntityNotFound(_0x1a8026,null))[_0x68aa('0x27')](removeEntity(_0x1a8026,null))[_0x68aa('0x44')](handleError(_0x1a8026,null));};exports[_0x68aa('0x52')]=function(_0x187c9e,_0x2c3a4d,_0x2f62a7){return db[_0x68aa('0x30')][_0x68aa('0x48')]({'where':{'id':_0x187c9e[_0x68aa('0x51')]['id']},'attributes':[_0x68aa('0x2d'),_0x68aa('0x53'),_0x68aa('0x54'),_0x68aa('0x55')],'raw':!![]})[_0x68aa('0x27')](handleEntityNotFound(_0x2c3a4d,null))[_0x68aa('0x27')](function(_0x3d9397){if(_0x3d9397){if(!fs[_0x68aa('0x56')](path[_0x68aa('0x57')](config[_0x68aa('0x58')],'server/files/reports',_0x3d9397['savename']))){throw new db[(_0x68aa('0x59'))][(_0x68aa('0x5a'))](_0x68aa('0x5b'));}if(_0x187c9e[_0x68aa('0x35')]['exists']){return _0x2c3a4d['sendStatus'](0xc8);}return _0x2c3a4d['download'](path[_0x68aa('0x57')](config[_0x68aa('0x58')],_0x68aa('0x5c'),_0x3d9397['savename']),util['format']('%s.%s',_0x3d9397[_0x68aa('0x53')]||_0x3d9397[_0x68aa('0x2d')],_0x3d9397['output'][_0x68aa('0x5d')]()));}})['catch'](handleError(_0x2c3a4d,null));}; \ No newline at end of file +var _0xe52d=['querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','ExtractedReports','error','stack','name','map','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','AnalyticExtractedReport','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce'];(function(_0x2383bc,_0x2d5ec9){var _0x283573=function(_0x157171){while(--_0x157171){_0x2383bc['push'](_0x2383bc['shift']());}};_0x283573(++_0x2d5ec9);}(_0xe52d,0x112));var _0xde52=function(_0x46a1af,_0xc3797a){_0x46a1af=_0x46a1af-0x0;var _0x22ae92=_0xe52d[_0x46a1af];return _0x22ae92;};'use strict';var emlformat=require(_0xde52('0x0'));var rimraf=require(_0xde52('0x1'));var zipdir=require(_0xde52('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xde52('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xde52('0x4'));var util=require(_0xde52('0x5'));var path=require(_0xde52('0x6'));var sox=require(_0xde52('0x7'));var csv=require(_0xde52('0x8'));var ejs=require(_0xde52('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xde52('0xa'));var squel=require(_0xde52('0xb'));var crypto=require(_0xde52('0xc'));var jsforce=require(_0xde52('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xde52('0x8'));var querystring=require(_0xde52('0xe'));var Papa=require(_0xde52('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xde52('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xde52('0x11'));var logger=require('../../config/logger')(_0xde52('0x12'));var utils=require(_0xde52('0x13'));var config=require(_0xde52('0x14'));var licenseUtil=require(_0xde52('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d2ca9,_0xbe19f9){_0xbe19f9=_0xbe19f9||0xcc;return function(_0x1c0aeb){if(_0x1c0aeb){return _0x2d2ca9[_0xde52('0x16')](_0xbe19f9);}return _0x2d2ca9[_0xde52('0x17')](_0xbe19f9)[_0xde52('0x18')]();};}function respondWithResult(_0x45f3ab,_0x1528a7){_0x1528a7=_0x1528a7||0xc8;return function(_0x595838){if(_0x595838){return _0x45f3ab[_0xde52('0x17')](_0x1528a7)[_0xde52('0x19')](_0x595838);}};}function respondWithFilteredResult(_0x3d4e2e,_0x34451f){return function(_0x3e2993){if(_0x3e2993){var _0x72f246=typeof _0x34451f[_0xde52('0x1a')]===_0xde52('0x1b')&&typeof _0x34451f[_0xde52('0x1c')]===_0xde52('0x1b');var _0x1e0562=_0x3e2993[_0xde52('0x1d')];var _0x61697f=_0x72f246?0x0:_0x34451f['offset'];var _0x444d74=_0x72f246?_0x3e2993[_0xde52('0x1d')]:_0x34451f[_0xde52('0x1a')]+_0x34451f['limit'];var _0x48e3fa;if(_0x444d74>=_0x1e0562){_0x444d74=_0x1e0562;_0x48e3fa=0xc8;}else{_0x48e3fa=0xce;}_0x3d4e2e['status'](_0x48e3fa);return _0x3d4e2e[_0xde52('0x1e')](_0xde52('0x1f'),_0x61697f+'-'+_0x444d74+'/'+_0x1e0562)['json'](_0x3e2993);}return null;};}function patchUpdates(_0x23f961){return function(_0x1f83ef){try{jsonpatch[_0xde52('0x20')](_0x1f83ef,_0x23f961,!![]);}catch(_0x12ff26){return BPromise['reject'](_0x12ff26);}return _0x1f83ef[_0xde52('0x21')]();};}function saveUpdates(_0x2d026a,_0xac9cf0){return function(_0x188e6e){if(_0x188e6e){return _0x188e6e[_0xde52('0x22')](_0x2d026a)[_0xde52('0x23')](function(_0x5923dd){return _0x5923dd;});}return null;};}function removeEntity(_0xefaf1,_0x55bbcb){return function(_0x4f668a){if(_0x4f668a){return _0x4f668a[_0xde52('0x24')]()[_0xde52('0x23')](function(){var _0x4750b7=_0x4f668a[_0xde52('0x25')]({'plain':!![]});var _0x48323d=_0xde52('0x26');return db['UserProfileResource'][_0xde52('0x24')]({'where':{'type':_0x48323d,'resourceId':_0x4750b7['id']}})[_0xde52('0x23')](function(){return _0x4f668a;});})[_0xde52('0x23')](function(){_0xefaf1['status'](0xcc)[_0xde52('0x18')]();});}};}function handleEntityNotFound(_0x3ca126,_0x4c3e1b){return function(_0x215f5b){if(!_0x215f5b){_0x3ca126[_0xde52('0x16')](0x194);}return _0x215f5b;};}function handleError(_0x1a24ab,_0x26bf98){_0x26bf98=_0x26bf98||0x1f4;return function(_0x336bb7){logger[_0xde52('0x27')](_0x336bb7[_0xde52('0x28')]);if(_0x336bb7[_0xde52('0x29')]){delete _0x336bb7[_0xde52('0x29')];}_0x1a24ab[_0xde52('0x17')](_0x26bf98)['send'](_0x336bb7);};}exports['index']=function(_0x6a6a9d,_0x4cea28){var _0x3f2d29={},_0x12cfc4={},_0x6ec535={'count':0x0,'rows':[]};var _0x2c86b5=_[_0xde52('0x2a')](db['AnalyticExtractedReport'][_0xde52('0x2b')],function(_0x797e83){return{'name':_0x797e83['fieldName'],'type':_0x797e83[_0xde52('0x2c')][_0xde52('0x2d')]};});_0x12cfc4[_0xde52('0x2e')]=_[_0xde52('0x2a')](_0x2c86b5,_0xde52('0x29'));_0x12cfc4['query']=_[_0xde52('0x2f')](_0x6a6a9d[_0xde52('0x30')]);_0x12cfc4[_0xde52('0x31')]=_['intersection'](_0x12cfc4[_0xde52('0x2e')],_0x12cfc4[_0xde52('0x30')]);_0x3f2d29[_0xde52('0x32')]=_[_0xde52('0x33')](_0x12cfc4[_0xde52('0x2e')],qs['fields'](_0x6a6a9d[_0xde52('0x30')][_0xde52('0x34')]));_0x3f2d29[_0xde52('0x32')]=_0x3f2d29[_0xde52('0x32')]['length']?_0x3f2d29[_0xde52('0x32')]:_0x12cfc4['model'];if(!_0x6a6a9d[_0xde52('0x30')][_0xde52('0x35')](_0xde52('0x36'))){_0x3f2d29[_0xde52('0x1c')]=qs['limit'](_0x6a6a9d[_0xde52('0x30')][_0xde52('0x1c')]);_0x3f2d29[_0xde52('0x1a')]=qs['offset'](_0x6a6a9d[_0xde52('0x30')][_0xde52('0x1a')]);}_0x3f2d29['order']=qs[_0xde52('0x37')](_0x6a6a9d['query'][_0xde52('0x37')]);_0x3f2d29[_0xde52('0x38')]=qs[_0xde52('0x31')](_[_0xde52('0x39')](_0x6a6a9d[_0xde52('0x30')],_0x12cfc4['filters']),_0x2c86b5);if(_0x6a6a9d[_0xde52('0x30')]['filter']){_0x3f2d29[_0xde52('0x38')]=_[_0xde52('0x3a')](_0x3f2d29[_0xde52('0x38')],{'$or':_[_0xde52('0x2a')](_0x2c86b5,function(_0xd0ecd8){if(_0xd0ecd8[_0xde52('0x2c')]!==_0xde52('0x3b')){var _0x1d9f17={};_0x1d9f17[_0xd0ecd8['name']]={'$like':'%'+_0x6a6a9d['query'][_0xde52('0x3c')]+'%'};return _0x1d9f17;}})});}_0x3f2d29=_[_0xde52('0x3a')]({},_0x3f2d29,_0x6a6a9d[_0xde52('0x3d')]);var _0x8f6148={'where':_0x3f2d29[_0xde52('0x38')]};return db[_0xde52('0x3e')][_0xde52('0x1d')](_0x8f6148)[_0xde52('0x23')](function(_0x1c76a1){_0x6ec535[_0xde52('0x1d')]=_0x1c76a1;if(_0x6a6a9d[_0xde52('0x30')][_0xde52('0x3f')]){_0x3f2d29[_0xde52('0x40')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0xde52('0x41')](_0x3f2d29);})[_0xde52('0x23')](function(_0x578001){_0x6ec535[_0xde52('0x42')]=_0x578001;return _0x6ec535;})[_0xde52('0x23')](respondWithFilteredResult(_0x4cea28,_0x3f2d29))[_0xde52('0x43')](handleError(_0x4cea28,null));};exports[_0xde52('0x44')]=function(_0x15a95f,_0xf38dbb){var _0x47bf94={'raw':!![],'where':{'id':_0x15a95f[_0xde52('0x45')]['id']}},_0x4ec7d7={};_0x4ec7d7['model']=_['keys'](db['AnalyticExtractedReport'][_0xde52('0x2b')]);_0x4ec7d7[_0xde52('0x30')]=_[_0xde52('0x2f')](_0x15a95f[_0xde52('0x30')]);_0x4ec7d7[_0xde52('0x31')]=_[_0xde52('0x33')](_0x4ec7d7[_0xde52('0x2e')],_0x4ec7d7[_0xde52('0x30')]);_0x47bf94['attributes']=_['intersection'](_0x4ec7d7[_0xde52('0x2e')],qs['fields'](_0x15a95f[_0xde52('0x30')][_0xde52('0x34')]));_0x47bf94[_0xde52('0x32')]=_0x47bf94[_0xde52('0x32')][_0xde52('0x46')]?_0x47bf94['attributes']:_0x4ec7d7['model'];if(_0x15a95f[_0xde52('0x30')][_0xde52('0x3f')]){_0x47bf94[_0xde52('0x40')]=[{'all':!![]}];}_0x47bf94=_[_0xde52('0x3a')]({},_0x47bf94,_0x15a95f['options']);return db[_0xde52('0x3e')][_0xde52('0x47')](_0x47bf94)[_0xde52('0x23')](handleEntityNotFound(_0xf38dbb,null))[_0xde52('0x23')](respondWithResult(_0xf38dbb,null))[_0xde52('0x43')](handleError(_0xf38dbb,null));};exports[_0xde52('0x48')]=function(_0x500158,_0x355b1f){return db[_0xde52('0x3e')][_0xde52('0x48')](_0x500158[_0xde52('0x49')],{})[_0xde52('0x23')](function(_0x2da649){var _0xbf0691=_0x500158[_0xde52('0x4a')][_0xde52('0x25')]({'plain':!![]});if(!_0xbf0691)throw new Error(_0xde52('0x4b'));if(_0xbf0691[_0xde52('0x4c')]===_0xde52('0x4a')){var _0x46e8a3=_0x2da649[_0xde52('0x25')]({'plain':!![]});var _0x1c7bc4=_0xde52('0x26');return db[_0xde52('0x4d')][_0xde52('0x47')]({'where':{'name':_0x1c7bc4,'userProfileId':_0xbf0691[_0xde52('0x4e')]},'raw':!![]})['then'](function(_0x1c4f37){if(_0x1c4f37&&_0x1c4f37['autoAssociation']===0x0){return db[_0xde52('0x4f')]['create']({'name':_0x46e8a3[_0xde52('0x29')],'resourceId':_0x46e8a3['id'],'type':_0x1c4f37['name'],'sectionId':_0x1c4f37['id']},{})['then'](function(){return _0x2da649;});}else{return _0x2da649;}})[_0xde52('0x43')](function(_0x2c24b2){logger['error'](_0xde52('0x50'),_0x2c24b2);throw _0x2c24b2;});}return _0x2da649;})[_0xde52('0x23')](respondWithResult(_0x355b1f,0xc9))[_0xde52('0x43')](handleError(_0x355b1f,null));};exports['update']=function(_0x3dc147,_0x2fa554){if(_0x3dc147[_0xde52('0x49')]['id']){delete _0x3dc147[_0xde52('0x49')]['id'];}return db[_0xde52('0x3e')][_0xde52('0x47')]({'where':{'id':_0x3dc147[_0xde52('0x45')]['id']}})[_0xde52('0x23')](handleEntityNotFound(_0x2fa554,null))[_0xde52('0x23')](saveUpdates(_0x3dc147[_0xde52('0x49')],null))[_0xde52('0x23')](respondWithResult(_0x2fa554,null))[_0xde52('0x43')](handleError(_0x2fa554,null));};exports[_0xde52('0x24')]=function(_0x374462,_0x336201){return db[_0xde52('0x3e')][_0xde52('0x47')]({'where':{'id':_0x374462[_0xde52('0x45')]['id']}})[_0xde52('0x23')](handleEntityNotFound(_0x336201,null))[_0xde52('0x23')](removeEntity(_0x336201,null))[_0xde52('0x43')](handleError(_0x336201,null));};exports[_0xde52('0x51')]=function(_0x52d001,_0x339e66,_0xdb416f){return db[_0xde52('0x3e')]['find']({'where':{'id':_0x52d001[_0xde52('0x45')]['id']},'attributes':['name',_0xde52('0x52'),_0xde52('0x53'),_0xde52('0x54')],'raw':!![]})[_0xde52('0x23')](handleEntityNotFound(_0x339e66,null))[_0xde52('0x23')](function(_0x3d152d){if(_0x3d152d){if(!fs[_0xde52('0x55')](path[_0xde52('0x56')](config[_0xde52('0x57')],_0xde52('0x58'),_0x3d152d['savename']))){throw new db[(_0xde52('0x59'))][(_0xde52('0x5a'))](_0xde52('0x5b'));}if(_0x52d001[_0xde52('0x30')][_0xde52('0x5c')]){return _0x339e66[_0xde52('0x16')](0xc8);}return _0x339e66[_0xde52('0x51')](path[_0xde52('0x56')](config[_0xde52('0x57')],_0xde52('0x58'),_0x3d152d['savename']),util[_0xde52('0x5d')](_0xde52('0x5e'),_0x3d152d[_0xde52('0x52')]||_0x3d152d[_0xde52('0x29')],_0x3d152d[_0xde52('0x54')][_0xde52('0x5f')]()));}})['catch'](handleError(_0x339e66,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 1fbfa5b..092cc90 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 _0xc19f=['AnalyticExtractedReport','lodash','util','bluebird','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define'];(function(_0x5cac42,_0x4be7a0){var _0x4d6ee0=function(_0x5b5cab){while(--_0x5b5cab){_0x5cac42['push'](_0x5cac42['shift']());}};_0x4d6ee0(++_0x4be7a0);}(_0xc19f,0x19b));var _0xfc19=function(_0x2e2881,_0x30f68e){_0x2e2881=_0x2e2881-0x0;var _0x433217=_0xc19f[_0x2e2881];return _0x433217;};'use strict';var _=require(_0xfc19('0x0'));var util=require(_0xfc19('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xfc19('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfc19('0x3'));var rimraf=require(_0xfc19('0x4'));var config=require(_0xfc19('0x5'));var attributes=require(_0xfc19('0x6'));module[_0xfc19('0x7')]=function(_0x9ddaa9,_0x537a1b){return _0x9ddaa9[_0xfc19('0x8')](_0xfc19('0x9'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x21d1=['AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define'];(function(_0x5d74e8,_0x50706a){var _0x5b5c93=function(_0x200c01){while(--_0x200c01){_0x5d74e8['push'](_0x5d74e8['shift']());}};_0x5b5c93(++_0x50706a);}(_0x21d1,0xaa));var _0x121d=function(_0x4b2184,_0x3b935a){_0x4b2184=_0x4b2184-0x0;var _0x302aa7=_0x21d1[_0x4b2184];return _0x302aa7;};'use strict';var _=require(_0x121d('0x0'));var util=require(_0x121d('0x1'));var logger=require(_0x121d('0x2'))(_0x121d('0x3'));var moment=require(_0x121d('0x4'));var BPromise=require('bluebird');var rp=require(_0x121d('0x5'));var fs=require('fs');var path=require(_0x121d('0x6'));var rimraf=require(_0x121d('0x7'));var config=require(_0x121d('0x8'));var attributes=require(_0x121d('0x9'));module[_0x121d('0xa')]=function(_0x3945a9,_0x598513){return _0x3945a9[_0x121d('0xb')](_0x121d('0xc'),attributes,{'tableName':_0x121d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 5808cf1..41cdafc 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 _0x32d5=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x13bb0d,_0x203cd1){var _0x335409=function(_0x3f0ec7){while(--_0x3f0ec7){_0x13bb0d['push'](_0x13bb0d['shift']());}};_0x335409(++_0x203cd1);}(_0x32d5,0x1aa));var _0x532d=function(_0x33ebf8,_0x36e60e){_0x33ebf8=_0x33ebf8-0x0;var _0x4ed41e=_0x32d5[_0x33ebf8];return _0x4ed41e;};'use strict';var _=require(_0x532d('0x0'));var util=require(_0x532d('0x1'));var moment=require(_0x532d('0x2'));var BPromise=require(_0x532d('0x3'));var rs=require(_0x532d('0x4'));var fs=require('fs');var Redis=require(_0x532d('0x5'));var db=require(_0x532d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x532d('0x7'))(_0x532d('0x8'));var config=require('../../config/environment');var jayson=require(_0x532d('0x9'));var client=jayson[_0x532d('0xa')][_0x532d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x20104e,_0x387c88,_0x5d9535){return new BPromise(function(_0x4f3d4e,_0x445220){return client['request'](_0x20104e,_0x5d9535)[_0x532d('0xc')](function(_0x23ee37){logger[_0x532d('0xd')](_0x532d('0xe'),_0x387c88,_0x532d('0xf'));logger[_0x532d('0x10')](_0x532d('0x11'),_0x387c88,_0x532d('0xf'),JSON[_0x532d('0x12')](_0x23ee37));if(_0x23ee37[_0x532d('0x13')]){if(_0x23ee37[_0x532d('0x13')][_0x532d('0x14')]===0x1f4){logger['error'](_0x532d('0xe'),_0x387c88,_0x23ee37[_0x532d('0x13')][_0x532d('0x15')]);return _0x445220(_0x23ee37[_0x532d('0x13')][_0x532d('0x15')]);}logger['error'](_0x532d('0xe'),_0x387c88,_0x23ee37['error'][_0x532d('0x15')]);return _0x4f3d4e(_0x23ee37[_0x532d('0x13')][_0x532d('0x15')]);}else{logger[_0x532d('0xd')](_0x532d('0xe'),_0x387c88,_0x532d('0xf'));_0x4f3d4e(_0x23ee37[_0x532d('0x16')][_0x532d('0x15')]);}})[_0x532d('0x17')](function(_0x562638){logger[_0x532d('0x13')](_0x532d('0xe'),_0x387c88,_0x562638);_0x445220(_0x562638);});});} \ No newline at end of file +var _0x7892=['error','code','message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3d5f58,_0x1d3dde){var _0x294fcb=function(_0x68cb19){while(--_0x68cb19){_0x3d5f58['push'](_0x3d5f58['shift']());}};_0x294fcb(++_0x1d3dde);}(_0x7892,0xf8));var _0x2789=function(_0x1b9462,_0x49c6ef){_0x1b9462=_0x1b9462-0x0;var _0x4fb066=_0x7892[_0x1b9462];return _0x4fb066;};'use strict';var _=require(_0x2789('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2789('0x1'));var rs=require(_0x2789('0x2'));var fs=require('fs');var Redis=require(_0x2789('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2789('0x4'));var logger=require(_0x2789('0x5'))('rpc');var config=require(_0x2789('0x6'));var jayson=require(_0x2789('0x7'));var client=jayson[_0x2789('0x8')][_0x2789('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4736ea,_0x4ae32e,_0x3612dc){return new BPromise(function(_0x5a91b9,_0xe1223c){return client['request'](_0x4736ea,_0x3612dc)[_0x2789('0xa')](function(_0x5927a1){logger['info'](_0x2789('0xb'),_0x4ae32e,_0x2789('0xc'));logger[_0x2789('0xd')](_0x2789('0xe'),_0x4ae32e,_0x2789('0xc'),JSON[_0x2789('0xf')](_0x5927a1));if(_0x5927a1['error']){if(_0x5927a1[_0x2789('0x10')][_0x2789('0x11')]===0x1f4){logger['error'](_0x2789('0xb'),_0x4ae32e,_0x5927a1[_0x2789('0x10')][_0x2789('0x12')]);return _0xe1223c(_0x5927a1['error'][_0x2789('0x12')]);}logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x4ae32e,_0x5927a1['error'][_0x2789('0x12')]);return _0x5a91b9(_0x5927a1[_0x2789('0x10')][_0x2789('0x12')]);}else{logger[_0x2789('0x13')](_0x2789('0xb'),_0x4ae32e,_0x2789('0xc'));_0x5a91b9(_0x5927a1[_0x2789('0x14')][_0x2789('0x12')]);}})[_0x2789('0x15')](function(_0x2be17c){logger[_0x2789('0x10')](_0x2789('0xb'),_0x4ae32e,_0x2be17c);_0xe1223c(_0x2be17c);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 85519f0..3212242 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 _0x575f=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x575f,0xcc));var _0xf575=function(_0x2729f8,_0x4beb7c){_0x2729f8=_0x2729f8-0x0;var _0x265537=_0x575f[_0x2729f8];return _0x265537;};'use strict';var multer=require(_0xf575('0x0'));var util=require(_0xf575('0x1'));var path=require(_0xf575('0x2'));var timeout=require('connect-timeout');var express=require(_0xf575('0x3'));var router=express['Router']();var fs_extra=require(_0xf575('0x4'));var auth=require(_0xf575('0x5'));var interaction=require(_0xf575('0x6'));var config=require(_0xf575('0x7'));var controller=require('./analyticExtractedReport.controller');router[_0xf575('0x8')]('/',auth[_0xf575('0x9')](),controller[_0xf575('0xa')]);router[_0xf575('0x8')](_0xf575('0xb'),auth['isAuthenticated'](),controller[_0xf575('0xc')]);router[_0xf575('0x8')](_0xf575('0xd'),auth['isAuthenticated'](),controller[_0xf575('0xe')]);router[_0xf575('0xf')]('/',auth[_0xf575('0x9')](),controller[_0xf575('0x10')]);router[_0xf575('0x11')](_0xf575('0xb'),auth[_0xf575('0x9')](),controller['update']);router[_0xf575('0x12')]('/:id',auth[_0xf575('0x9')](),controller[_0xf575('0x13')]);module[_0xf575('0x14')]=router; \ No newline at end of file +var _0xafa2=['create','put','update','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','/:id','show','/:id/download'];(function(_0x11da6f,_0x4b3b6c){var _0x5a8bb8=function(_0x513ac1){while(--_0x513ac1){_0x11da6f['push'](_0x11da6f['shift']());}};_0x5a8bb8(++_0x4b3b6c);}(_0xafa2,0x72));var _0x2afa=function(_0x410455,_0x30f5ef){_0x410455=_0x410455-0x0;var _0x34f21a=_0xafa2[_0x410455];return _0x34f21a;};'use strict';var multer=require('multer');var util=require(_0x2afa('0x0'));var path=require('path');var timeout=require(_0x2afa('0x1'));var express=require(_0x2afa('0x2'));var router=express['Router']();var fs_extra=require(_0x2afa('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2afa('0x4'));var config=require(_0x2afa('0x5'));var controller=require(_0x2afa('0x6'));router[_0x2afa('0x7')]('/',auth[_0x2afa('0x8')](),controller['index']);router['get'](_0x2afa('0x9'),auth[_0x2afa('0x8')](),controller[_0x2afa('0xa')]);router['get'](_0x2afa('0xb'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x2afa('0xc')]);router[_0x2afa('0xd')](_0x2afa('0x9'),auth[_0x2afa('0x8')](),controller[_0x2afa('0xe')]);router[_0x2afa('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x2afa('0x10')]);module[_0x2afa('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index fbfc1e1..6711ec1 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 _0x5822=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x3ae650,_0x4206e6){var _0x1a57d1=function(_0x59d4fa){while(--_0x59d4fa){_0x3ae650['push'](_0x3ae650['shift']());}};_0x1a57d1(++_0x4206e6);}(_0x5822,0x15d));var _0x2582=function(_0x5447aa,_0x3afc00){_0x5447aa=_0x5447aa-0x0;var _0xb21e53=_0x5822[_0x5447aa];return _0xb21e53;};'use strict';var Sequelize=require(_0x2582('0x0'));module[_0x2582('0x1')]={'field':{'type':Sequelize[_0x2582('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x2582('0x3')]},'groupBy':{'type':Sequelize[_0x2582('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x2582('0x3')]},'custom':{'type':Sequelize[_0x2582('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xbb24=['STRING','sequelize','exports'];(function(_0xba2c96,_0x3382f7){var _0x589f48=function(_0x20e286){while(--_0x20e286){_0xba2c96['push'](_0xba2c96['shift']());}};_0x589f48(++_0x3382f7);}(_0xbb24,0x157));var _0x4bb2=function(_0x743346,_0x2b1051){_0x743346=_0x743346-0x0;var _0x2f4e38=_0xbb24[_0x743346];return _0x2f4e38;};'use strict';var Sequelize=require(_0x4bb2('0x0'));module[_0x4bb2('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x4bb2('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x4bb2('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 019ac80..9a1886f 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 _0xb32d=['path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','index','map','AnalyticFieldReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','include','findAll','rows','show','params','includeAll','catch','create','body','bulkCreate','find','bulkDestroy','AnalyticCustomReport','findOne','sequelize','CustomReportId','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util'];(function(_0x2caba8,_0x3da79e){var _0x137dab=function(_0x2299c4){while(--_0x2299c4){_0x2caba8['push'](_0x2caba8['shift']());}};_0x137dab(++_0x3da79e);}(_0xb32d,0x93));var _0xdb32=function(_0x1da6be,_0x5d4e33){_0x1da6be=_0x1da6be-0x0;var _0x1264cf=_0xb32d[_0x1da6be];return _0x1264cf;};'use strict';var emlformat=require(_0xdb32('0x0'));var rimraf=require(_0xdb32('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdb32('0x2'));var rp=require(_0xdb32('0x3'));var moment=require(_0xdb32('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdb32('0x5'));var util=require(_0xdb32('0x6'));var path=require(_0xdb32('0x7'));var sox=require(_0xdb32('0x8'));var csv=require('to-csv');var ejs=require(_0xdb32('0x9'));var fs=require('fs');var fs_extra=require(_0xdb32('0xa'));var _=require('lodash');var squel=require(_0xdb32('0xb'));var crypto=require(_0xdb32('0xc'));var jsforce=require(_0xdb32('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xdb32('0xe'));var querystring=require('querystring');var Papa=require(_0xdb32('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdb32('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdb32('0x11'));var logger=require(_0xdb32('0x12'))(_0xdb32('0x13'));var utils=require('../../config/utils');var config=require(_0xdb32('0x14'));var licenseUtil=require(_0xdb32('0x15'));var db=require(_0xdb32('0x16'))['db'];function respondWithStatusCode(_0x3734a5,_0x5f0c09){_0x5f0c09=_0x5f0c09||0xcc;return function(_0x18a7e7){if(_0x18a7e7){return _0x3734a5[_0xdb32('0x17')](_0x5f0c09);}return _0x3734a5[_0xdb32('0x18')](_0x5f0c09)[_0xdb32('0x19')]();};}function respondWithResult(_0x3b3965,_0x1fcf17){_0x1fcf17=_0x1fcf17||0xc8;return function(_0x5ecc9a){if(_0x5ecc9a){return _0x3b3965[_0xdb32('0x18')](_0x1fcf17)['json'](_0x5ecc9a);}};}function respondWithFilteredResult(_0x16ce5e,_0x4f1487){return function(_0x1a0ae7){if(_0x1a0ae7){var _0x1a234f=typeof _0x4f1487[_0xdb32('0x1a')]===_0xdb32('0x1b')&&typeof _0x4f1487['limit']==='undefined';var _0x4fd26d=_0x1a0ae7[_0xdb32('0x1c')];var _0x41f05a=_0x1a234f?0x0:_0x4f1487['offset'];var _0x5d7d46=_0x1a234f?_0x1a0ae7[_0xdb32('0x1c')]:_0x4f1487[_0xdb32('0x1a')]+_0x4f1487[_0xdb32('0x1d')];var _0x370c82;if(_0x5d7d46>=_0x4fd26d){_0x5d7d46=_0x4fd26d;_0x370c82=0xc8;}else{_0x370c82=0xce;}_0x16ce5e[_0xdb32('0x18')](_0x370c82);return _0x16ce5e[_0xdb32('0x1e')](_0xdb32('0x1f'),_0x41f05a+'-'+_0x5d7d46+'/'+_0x4fd26d)[_0xdb32('0x20')](_0x1a0ae7);}return null;};}function patchUpdates(_0x334faf){return function(_0x2dd555){try{jsonpatch['apply'](_0x2dd555,_0x334faf,!![]);}catch(_0x5aaa65){return BPromise[_0xdb32('0x21')](_0x5aaa65);}return _0x2dd555[_0xdb32('0x22')]();};}function saveUpdates(_0x3fa86b,_0x2efd9b){return function(_0x1adee8){if(_0x1adee8){return _0x1adee8[_0xdb32('0x23')](_0x3fa86b)[_0xdb32('0x24')](function(_0xf2f02){return _0xf2f02;});}return null;};}function removeEntity(_0x4f879c,_0xeac5){return function(_0x448f10){if(_0x448f10){return _0x448f10[_0xdb32('0x25')]()[_0xdb32('0x24')](function(){_0x4f879c[_0xdb32('0x18')](0xcc)[_0xdb32('0x19')]();});}};}function handleEntityNotFound(_0x1adf67,_0x5ceed7){return function(_0x288535){if(!_0x288535){_0x1adf67['sendStatus'](0x194);}return _0x288535;};}function handleError(_0x50add5,_0x4e25a1){_0x4e25a1=_0x4e25a1||0x1f4;return function(_0x2afd2d){logger[_0xdb32('0x26')](_0x2afd2d[_0xdb32('0x27')]);if(_0x2afd2d[_0xdb32('0x28')]){delete _0x2afd2d[_0xdb32('0x28')];}_0x50add5[_0xdb32('0x18')](_0x4e25a1)['send'](_0x2afd2d);};}exports[_0xdb32('0x29')]=function(_0x1b7f65,_0x576d8b){var _0x227538={},_0x5ea954={},_0x14e709={'count':0x0,'rows':[]};var _0x3cf27f=_[_0xdb32('0x2a')](db[_0xdb32('0x2b')][_0xdb32('0x2c')],function(_0x42a56f){return{'name':_0x42a56f[_0xdb32('0x2d')],'type':_0x42a56f['type']['key']};});_0x5ea954[_0xdb32('0x2e')]=_[_0xdb32('0x2a')](_0x3cf27f,_0xdb32('0x28'));_0x5ea954[_0xdb32('0x2f')]=_[_0xdb32('0x30')](_0x1b7f65[_0xdb32('0x2f')]);_0x5ea954[_0xdb32('0x31')]=_[_0xdb32('0x32')](_0x5ea954[_0xdb32('0x2e')],_0x5ea954[_0xdb32('0x2f')]);_0x227538[_0xdb32('0x33')]=_['intersection'](_0x5ea954[_0xdb32('0x2e')],qs[_0xdb32('0x34')](_0x1b7f65[_0xdb32('0x2f')][_0xdb32('0x34')]));_0x227538[_0xdb32('0x33')]=_0x227538[_0xdb32('0x33')][_0xdb32('0x35')]?_0x227538[_0xdb32('0x33')]:_0x5ea954[_0xdb32('0x2e')];if(!_0x1b7f65['query'][_0xdb32('0x36')](_0xdb32('0x37'))){_0x227538[_0xdb32('0x1d')]=qs[_0xdb32('0x1d')](_0x1b7f65[_0xdb32('0x2f')][_0xdb32('0x1d')]);_0x227538[_0xdb32('0x1a')]=qs[_0xdb32('0x1a')](_0x1b7f65[_0xdb32('0x2f')]['offset']);}_0x227538['order']=qs[_0xdb32('0x38')](_0x1b7f65[_0xdb32('0x2f')]['sort']);_0x227538['where']=qs[_0xdb32('0x31')](_['pick'](_0x1b7f65[_0xdb32('0x2f')],_0x5ea954[_0xdb32('0x31')]),_0x3cf27f);if(_0x1b7f65['query'][_0xdb32('0x39')]){_0x227538[_0xdb32('0x3a')]=_[_0xdb32('0x3b')](_0x227538[_0xdb32('0x3a')],{'$or':_[_0xdb32('0x2a')](_0x3cf27f,function(_0xf64e8b){if(_0xf64e8b['type']!==_0xdb32('0x3c')){var _0x1e3d87={};_0x1e3d87[_0xf64e8b[_0xdb32('0x28')]]={'$like':'%'+_0x1b7f65['query'][_0xdb32('0x39')]+'%'};return _0x1e3d87;}})});}_0x227538=_[_0xdb32('0x3b')]({},_0x227538,_0x1b7f65['options']);var _0x2471aa={'where':_0x227538[_0xdb32('0x3a')]};return db[_0xdb32('0x2b')][_0xdb32('0x1c')](_0x2471aa)['then'](function(_0x3b995f){_0x14e709[_0xdb32('0x1c')]=_0x3b995f;if(_0x1b7f65['query']['includeAll']){_0x227538[_0xdb32('0x3d')]=[{'all':!![]}];}return db[_0xdb32('0x2b')][_0xdb32('0x3e')](_0x227538);})[_0xdb32('0x24')](function(_0x323ee3){_0x14e709[_0xdb32('0x3f')]=_0x323ee3;return _0x14e709;})[_0xdb32('0x24')](respondWithFilteredResult(_0x576d8b,_0x227538))['catch'](handleError(_0x576d8b,null));};exports[_0xdb32('0x40')]=function(_0x457240,_0x594a5f){var _0x3e9136={'raw':![],'where':{'id':_0x457240[_0xdb32('0x41')]['id']}},_0x37ee39={};_0x37ee39[_0xdb32('0x2e')]=_[_0xdb32('0x30')](db[_0xdb32('0x2b')][_0xdb32('0x2c')]);_0x37ee39[_0xdb32('0x2f')]=_[_0xdb32('0x30')](_0x457240[_0xdb32('0x2f')]);_0x37ee39[_0xdb32('0x31')]=_['intersection'](_0x37ee39['model'],_0x37ee39[_0xdb32('0x2f')]);_0x3e9136[_0xdb32('0x33')]=_[_0xdb32('0x32')](_0x37ee39['model'],qs[_0xdb32('0x34')](_0x457240[_0xdb32('0x2f')][_0xdb32('0x34')]));_0x3e9136[_0xdb32('0x33')]=_0x3e9136[_0xdb32('0x33')][_0xdb32('0x35')]?_0x3e9136[_0xdb32('0x33')]:_0x37ee39[_0xdb32('0x2e')];if(_0x457240[_0xdb32('0x2f')][_0xdb32('0x42')]){_0x3e9136[_0xdb32('0x3d')]=[{'all':!![]}];}_0x3e9136=_[_0xdb32('0x3b')]({},_0x3e9136,_0x457240['options']);return db['AnalyticFieldReport']['find'](_0x3e9136)[_0xdb32('0x24')](handleEntityNotFound(_0x594a5f,null))[_0xdb32('0x24')](respondWithResult(_0x594a5f,null))[_0xdb32('0x43')](handleError(_0x594a5f,null));};exports[_0xdb32('0x44')]=function(_0x46bbfa,_0x13bfa8){return db['AnalyticFieldReport']['create'](_0x46bbfa[_0xdb32('0x45')],{})[_0xdb32('0x24')](respondWithResult(_0x13bfa8,0xc9))[_0xdb32('0x43')](handleError(_0x13bfa8,null));};exports[_0xdb32('0x46')]=function(_0xe525ec,_0x3a7a6a){return db['AnalyticFieldReport']['bulkCreate'](_0xe525ec[_0xdb32('0x45')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x3a7a6a,0xc9))['catch'](handleError(_0x3a7a6a,null));};exports[_0xdb32('0x23')]=function(_0x184cee,_0x1d59fa){if(_0x184cee['body']['id']){delete _0x184cee[_0xdb32('0x45')]['id'];}return db[_0xdb32('0x2b')][_0xdb32('0x47')]({'where':{'id':_0x184cee[_0xdb32('0x41')]['id']}})[_0xdb32('0x24')](handleEntityNotFound(_0x1d59fa,null))[_0xdb32('0x24')](saveUpdates(_0x184cee[_0xdb32('0x45')],null))[_0xdb32('0x24')](respondWithResult(_0x1d59fa,null))['catch'](handleError(_0x1d59fa,null));};exports[_0xdb32('0x25')]=function(_0x137eed,_0x5c0a76){return db['AnalyticFieldReport'][_0xdb32('0x47')]({'where':{'id':_0x137eed['params']['id']}})[_0xdb32('0x24')](handleEntityNotFound(_0x5c0a76,null))['then'](removeEntity(_0x5c0a76,null))[_0xdb32('0x43')](handleError(_0x5c0a76,null));};exports[_0xdb32('0x48')]=function(_0x58393a,_0x278b67){return db['AnalyticFieldReport'][_0xdb32('0x25')]({'where':{'id':_0x58393a[_0xdb32('0x2f')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0xdb32('0x24')](respondWithResult(_0x278b67,0xcc))[_0xdb32('0x43')](handleError(_0x278b67,null));};exports['addFields']=function(_0x68f286,_0x35b315,_0x3d69f6){return db[_0xdb32('0x49')][_0xdb32('0x4a')]({'where':{'id':_0x68f286[_0xdb32('0x41')]['id']}})[_0xdb32('0x24')](handleEntityNotFound(_0x35b315,null))[_0xdb32('0x24')](function(_0x557457){if(_0x557457){return db[_0xdb32('0x4b')]['transaction'](function(_0x41cb20){return db['AnalyticFieldReport'][_0xdb32('0x25')]({'where':{'CustomReportId':_0x68f286[_0xdb32('0x41')]['id']},'transaction':_0x41cb20})[_0xdb32('0x24')](function(_0x3317a3){var _0x542d2e=_[_0xdb32('0x2a')](_0x68f286['body'],function(_0x37219){delete _0x37219['id'];_0x37219[_0xdb32('0x4c')]=_0x68f286[_0xdb32('0x41')]['id'];return _0x37219;});return db[_0xdb32('0x2b')][_0xdb32('0x46')](_0x542d2e,{'transaction':_0x41cb20});});})['then'](function(){return db[_0xdb32('0x2b')]['findAll']({'where':{'CustomReportId':_0x68f286[_0xdb32('0x41')]['id']}});});}})[_0xdb32('0x24')](respondWithResult(_0x35b315,null))['catch'](handleError(_0x35b315,null));}; \ No newline at end of file +var _0x2510=['limit','count','set','apply','reject','save','then','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','AnalyticFieldReport','include','findAll','rows','show','params','includeAll','find','catch','body','bulkCreate','destroy','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','CustomReportId','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined'];(function(_0x2a67fe,_0x295c09){var _0x57e726=function(_0x280573){while(--_0x280573){_0x2a67fe['push'](_0x2a67fe['shift']());}};_0x57e726(++_0x295c09);}(_0x2510,0x1ce));var _0x0251=function(_0x182de8,_0x37a0aa){_0x182de8=_0x182de8-0x0;var _0x7666de=_0x2510[_0x182de8];return _0x7666de;};'use strict';var emlformat=require(_0x0251('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0251('0x1'));var jsonpatch=require(_0x0251('0x2'));var rp=require(_0x0251('0x3'));var moment=require('moment');var BPromise=require(_0x0251('0x4'));var Mustache=require(_0x0251('0x5'));var util=require('util');var path=require(_0x0251('0x6'));var sox=require(_0x0251('0x7'));var csv=require(_0x0251('0x8'));var ejs=require(_0x0251('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0251('0xa'));var squel=require(_0x0251('0xb'));var crypto=require(_0x0251('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0251('0xd'));var toCsv=require(_0x0251('0x8'));var querystring=require(_0x0251('0xe'));var Papa=require(_0x0251('0xf'));var Redis=require('ioredis');var authService=require(_0x0251('0x10'));var qs=require(_0x0251('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0251('0x12'));var logger=require(_0x0251('0x13'))(_0x0251('0x14'));var utils=require(_0x0251('0x15'));var config=require(_0x0251('0x16'));var licenseUtil=require(_0x0251('0x17'));var db=require(_0x0251('0x18'))['db'];function respondWithStatusCode(_0x36d644,_0x54e0dc){_0x54e0dc=_0x54e0dc||0xcc;return function(_0x3b8a2a){if(_0x3b8a2a){return _0x36d644['sendStatus'](_0x54e0dc);}return _0x36d644['status'](_0x54e0dc)[_0x0251('0x19')]();};}function respondWithResult(_0x56f48a,_0x589855){_0x589855=_0x589855||0xc8;return function(_0x3c2f77){if(_0x3c2f77){return _0x56f48a[_0x0251('0x1a')](_0x589855)[_0x0251('0x1b')](_0x3c2f77);}};}function respondWithFilteredResult(_0x5581fe,_0x3c0eb7){return function(_0x3fe6cd){if(_0x3fe6cd){var _0x20e704=typeof _0x3c0eb7[_0x0251('0x1c')]===_0x0251('0x1d')&&typeof _0x3c0eb7[_0x0251('0x1e')]===_0x0251('0x1d');var _0x2fda6f=_0x3fe6cd['count'];var _0x1b4109=_0x20e704?0x0:_0x3c0eb7[_0x0251('0x1c')];var _0xd30e57=_0x20e704?_0x3fe6cd[_0x0251('0x1f')]:_0x3c0eb7[_0x0251('0x1c')]+_0x3c0eb7[_0x0251('0x1e')];var _0x54023c;if(_0xd30e57>=_0x2fda6f){_0xd30e57=_0x2fda6f;_0x54023c=0xc8;}else{_0x54023c=0xce;}_0x5581fe[_0x0251('0x1a')](_0x54023c);return _0x5581fe[_0x0251('0x20')]('Content-Range',_0x1b4109+'-'+_0xd30e57+'/'+_0x2fda6f)['json'](_0x3fe6cd);}return null;};}function patchUpdates(_0x4014bf){return function(_0x477d68){try{jsonpatch[_0x0251('0x21')](_0x477d68,_0x4014bf,!![]);}catch(_0x1524ae){return BPromise[_0x0251('0x22')](_0x1524ae);}return _0x477d68[_0x0251('0x23')]();};}function saveUpdates(_0x3b54be,_0x52207c){return function(_0x77e1bb){if(_0x77e1bb){return _0x77e1bb['update'](_0x3b54be)['then'](function(_0x479ac0){return _0x479ac0;});}return null;};}function removeEntity(_0x1ea08f,_0xa2891a){return function(_0x35fa5d){if(_0x35fa5d){return _0x35fa5d['destroy']()[_0x0251('0x24')](function(){_0x1ea08f[_0x0251('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x197636,_0x240dcc){return function(_0x2fdcae){if(!_0x2fdcae){_0x197636[_0x0251('0x25')](0x194);}return _0x2fdcae;};}function handleError(_0x2f2297,_0x2fcf36){_0x2fcf36=_0x2fcf36||0x1f4;return function(_0x511f4a){logger['error'](_0x511f4a[_0x0251('0x26')]);if(_0x511f4a['name']){delete _0x511f4a[_0x0251('0x27')];}_0x2f2297['status'](_0x2fcf36)[_0x0251('0x28')](_0x511f4a);};}exports[_0x0251('0x29')]=function(_0x5cee8c,_0x37a749){var _0x76637e={},_0x4a4074={},_0x32bd6f={'count':0x0,'rows':[]};var _0x435e6d=_['map'](db['AnalyticFieldReport'][_0x0251('0x2a')],function(_0x305b96){return{'name':_0x305b96[_0x0251('0x2b')],'type':_0x305b96[_0x0251('0x2c')]['key']};});_0x4a4074['model']=_['map'](_0x435e6d,_0x0251('0x27'));_0x4a4074[_0x0251('0x2d')]=_[_0x0251('0x2e')](_0x5cee8c[_0x0251('0x2d')]);_0x4a4074[_0x0251('0x2f')]=_[_0x0251('0x30')](_0x4a4074[_0x0251('0x31')],_0x4a4074[_0x0251('0x2d')]);_0x76637e[_0x0251('0x32')]=_[_0x0251('0x30')](_0x4a4074[_0x0251('0x31')],qs[_0x0251('0x33')](_0x5cee8c[_0x0251('0x2d')]['fields']));_0x76637e[_0x0251('0x32')]=_0x76637e['attributes'][_0x0251('0x34')]?_0x76637e[_0x0251('0x32')]:_0x4a4074[_0x0251('0x31')];if(!_0x5cee8c['query'][_0x0251('0x35')](_0x0251('0x36'))){_0x76637e[_0x0251('0x1e')]=qs[_0x0251('0x1e')](_0x5cee8c[_0x0251('0x2d')][_0x0251('0x1e')]);_0x76637e[_0x0251('0x1c')]=qs[_0x0251('0x1c')](_0x5cee8c[_0x0251('0x2d')][_0x0251('0x1c')]);}_0x76637e[_0x0251('0x37')]=qs['sort'](_0x5cee8c['query'][_0x0251('0x38')]);_0x76637e[_0x0251('0x39')]=qs['filters'](_[_0x0251('0x3a')](_0x5cee8c['query'],_0x4a4074['filters']),_0x435e6d);if(_0x5cee8c[_0x0251('0x2d')][_0x0251('0x3b')]){_0x76637e['where']=_[_0x0251('0x3c')](_0x76637e[_0x0251('0x39')],{'$or':_[_0x0251('0x3d')](_0x435e6d,function(_0x58bbac){if(_0x58bbac['type']!=='VIRTUAL'){var _0x2a80da={};_0x2a80da[_0x58bbac['name']]={'$like':'%'+_0x5cee8c['query'][_0x0251('0x3b')]+'%'};return _0x2a80da;}})});}_0x76637e=_[_0x0251('0x3c')]({},_0x76637e,_0x5cee8c[_0x0251('0x3e')]);var _0xc87336={'where':_0x76637e[_0x0251('0x39')]};return db[_0x0251('0x3f')][_0x0251('0x1f')](_0xc87336)[_0x0251('0x24')](function(_0x1fb586){_0x32bd6f[_0x0251('0x1f')]=_0x1fb586;if(_0x5cee8c['query']['includeAll']){_0x76637e[_0x0251('0x40')]=[{'all':!![]}];}return db[_0x0251('0x3f')][_0x0251('0x41')](_0x76637e);})[_0x0251('0x24')](function(_0x1dbe36){_0x32bd6f[_0x0251('0x42')]=_0x1dbe36;return _0x32bd6f;})[_0x0251('0x24')](respondWithFilteredResult(_0x37a749,_0x76637e))['catch'](handleError(_0x37a749,null));};exports[_0x0251('0x43')]=function(_0x1bf0af,_0x34fcac){var _0x1005b6={'raw':![],'where':{'id':_0x1bf0af[_0x0251('0x44')]['id']}},_0x175d4={};_0x175d4['model']=_[_0x0251('0x2e')](db[_0x0251('0x3f')][_0x0251('0x2a')]);_0x175d4[_0x0251('0x2d')]=_[_0x0251('0x2e')](_0x1bf0af[_0x0251('0x2d')]);_0x175d4[_0x0251('0x2f')]=_['intersection'](_0x175d4[_0x0251('0x31')],_0x175d4['query']);_0x1005b6[_0x0251('0x32')]=_['intersection'](_0x175d4['model'],qs['fields'](_0x1bf0af['query'][_0x0251('0x33')]));_0x1005b6[_0x0251('0x32')]=_0x1005b6[_0x0251('0x32')][_0x0251('0x34')]?_0x1005b6['attributes']:_0x175d4[_0x0251('0x31')];if(_0x1bf0af['query'][_0x0251('0x45')]){_0x1005b6[_0x0251('0x40')]=[{'all':!![]}];}_0x1005b6=_[_0x0251('0x3c')]({},_0x1005b6,_0x1bf0af['options']);return db[_0x0251('0x3f')][_0x0251('0x46')](_0x1005b6)[_0x0251('0x24')](handleEntityNotFound(_0x34fcac,null))[_0x0251('0x24')](respondWithResult(_0x34fcac,null))[_0x0251('0x47')](handleError(_0x34fcac,null));};exports['create']=function(_0x317f19,_0x575694){return db[_0x0251('0x3f')]['create'](_0x317f19[_0x0251('0x48')],{})[_0x0251('0x24')](respondWithResult(_0x575694,0xc9))[_0x0251('0x47')](handleError(_0x575694,null));};exports['bulkCreate']=function(_0x2fd1a9,_0x2c3b98){return db[_0x0251('0x3f')][_0x0251('0x49')](_0x2fd1a9[_0x0251('0x48')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x2c3b98,0xc9))[_0x0251('0x47')](handleError(_0x2c3b98,null));};exports['update']=function(_0x97d710,_0x383b4b){if(_0x97d710[_0x0251('0x48')]['id']){delete _0x97d710[_0x0251('0x48')]['id'];}return db[_0x0251('0x3f')][_0x0251('0x46')]({'where':{'id':_0x97d710['params']['id']}})[_0x0251('0x24')](handleEntityNotFound(_0x383b4b,null))[_0x0251('0x24')](saveUpdates(_0x97d710[_0x0251('0x48')],null))['then'](respondWithResult(_0x383b4b,null))[_0x0251('0x47')](handleError(_0x383b4b,null));};exports[_0x0251('0x4a')]=function(_0x118f9f,_0x41415c){return db['AnalyticFieldReport'][_0x0251('0x46')]({'where':{'id':_0x118f9f['params']['id']}})[_0x0251('0x24')](handleEntityNotFound(_0x41415c,null))[_0x0251('0x24')](removeEntity(_0x41415c,null))[_0x0251('0x47')](handleError(_0x41415c,null));};exports[_0x0251('0x4b')]=function(_0x2e5358,_0x1ec921){return db[_0x0251('0x3f')]['destroy']({'where':{'id':_0x2e5358['query'][_0x0251('0x4c')]||[]},'raw':![],'individualHooks':!![]})[_0x0251('0x24')](respondWithResult(_0x1ec921,0xcc))['catch'](handleError(_0x1ec921,null));};exports[_0x0251('0x4d')]=function(_0xa44b39,_0x16f3c8,_0x5491df){return db[_0x0251('0x4e')][_0x0251('0x4f')]({'where':{'id':_0xa44b39[_0x0251('0x44')]['id']}})[_0x0251('0x24')](handleEntityNotFound(_0x16f3c8,null))[_0x0251('0x24')](function(_0x5a6a6e){if(_0x5a6a6e){return db[_0x0251('0x50')]['transaction'](function(_0x1e1934){return db[_0x0251('0x3f')]['destroy']({'where':{'CustomReportId':_0xa44b39[_0x0251('0x44')]['id']},'transaction':_0x1e1934})[_0x0251('0x24')](function(_0x10f5ba){var _0x4c773b=_[_0x0251('0x3d')](_0xa44b39['body'],function(_0x156d63){delete _0x156d63['id'];_0x156d63[_0x0251('0x51')]=_0xa44b39[_0x0251('0x44')]['id'];return _0x156d63;});return db[_0x0251('0x3f')]['bulkCreate'](_0x4c773b,{'transaction':_0x1e1934});});})[_0x0251('0x24')](function(){return db[_0x0251('0x3f')]['findAll']({'where':{'CustomReportId':_0xa44b39[_0x0251('0x44')]['id']}});});}})['then'](respondWithResult(_0x16f3c8,null))[_0x0251('0x47')](handleError(_0x16f3c8,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index ad2959b..d650adf 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 _0xccd7=['AnalyticFieldReport','analytics_report_fields','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes'];(function(_0x311909,_0x414bf7){var _0x8d3163=function(_0x226f55){while(--_0x226f55){_0x311909['push'](_0x311909['shift']());}};_0x8d3163(++_0x414bf7);}(_0xccd7,0x86));var _0x7ccd=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xccd7[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require(_0x7ccd('0x0'));var util=require('util');var logger=require(_0x7ccd('0x1'))(_0x7ccd('0x2'));var moment=require('moment');var BPromise=require(_0x7ccd('0x3'));var rp=require(_0x7ccd('0x4'));var fs=require('fs');var path=require(_0x7ccd('0x5'));var rimraf=require(_0x7ccd('0x6'));var config=require(_0x7ccd('0x7'));var attributes=require(_0x7ccd('0x8'));module['exports']=function(_0x445001,_0xf4ff1){return _0x445001['define'](_0x7ccd('0x9'),attributes,{'tableName':_0x7ccd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa0b8=['path','rimraf','./analyticFieldReport.attributes','exports','define','analytics_report_fields','util','api','moment','bluebird','request-promise'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xa0b8,0x1c9));var _0x8a0b=function(_0x475923,_0x25d9ec){_0x475923=_0x475923-0x0;var _0x374030=_0xa0b8[_0x475923];return _0x374030;};'use strict';var _=require('lodash');var util=require(_0x8a0b('0x0'));var logger=require('../../config/logger')(_0x8a0b('0x1'));var moment=require(_0x8a0b('0x2'));var BPromise=require(_0x8a0b('0x3'));var rp=require(_0x8a0b('0x4'));var fs=require('fs');var path=require(_0x8a0b('0x5'));var rimraf=require(_0x8a0b('0x6'));var config=require('../../config/environment');var attributes=require(_0x8a0b('0x7'));module[_0x8a0b('0x8')]=function(_0x3b66a3,_0x5144f1){return _0x3b66a3[_0x8a0b('0x9')]('AnalyticFieldReport',attributes,{'tableName':_0x8a0b('0xa'),'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 406e7aa..81329c2 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 _0x8a07=['AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent'];(function(_0xbd7911,_0x38257b){var _0x4e4183=function(_0x397051){while(--_0x397051){_0xbd7911['push'](_0xbd7911['shift']());}};_0x4e4183(++_0x38257b);}(_0x8a07,0xe3));var _0x78a0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8a07[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x78a0('0x0'));var BPromise=require(_0x78a0('0x1'));var rs=require(_0x78a0('0x2'));var fs=require('fs');var Redis=require(_0x78a0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x78a0('0x4'));var logger=require(_0x78a0('0x5'))(_0x78a0('0x6'));var config=require(_0x78a0('0x7'));var jayson=require(_0x78a0('0x8'));var client=jayson[_0x78a0('0x9')][_0x78a0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ab563,_0x44f1ca,_0x4bc7e4){return new BPromise(function(_0x2d8168,_0x3d9d47){return client['request'](_0x3ab563,_0x4bc7e4)[_0x78a0('0xb')](function(_0x497207){logger[_0x78a0('0xc')](_0x78a0('0xd'),_0x44f1ca,_0x78a0('0xe'));logger['debug'](_0x78a0('0xf'),_0x44f1ca,_0x78a0('0xe'),JSON[_0x78a0('0x10')](_0x497207));if(_0x497207[_0x78a0('0x11')]){if(_0x497207['error'][_0x78a0('0x12')]===0x1f4){logger[_0x78a0('0x11')](_0x78a0('0xd'),_0x44f1ca,_0x497207[_0x78a0('0x11')]['message']);return _0x3d9d47(_0x497207[_0x78a0('0x11')][_0x78a0('0x13')]);}logger[_0x78a0('0x11')](_0x78a0('0xd'),_0x44f1ca,_0x497207[_0x78a0('0x11')]['message']);return _0x2d8168(_0x497207[_0x78a0('0x11')][_0x78a0('0x13')]);}else{logger[_0x78a0('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0x44f1ca,_0x78a0('0xe'));_0x2d8168(_0x497207[_0x78a0('0x14')]['message']);}})[_0x78a0('0x15')](function(_0x54cd10){logger['error'](_0x78a0('0xd'),_0x44f1ca,_0x54cd10);_0x3d9d47(_0x54cd10);});});} \ No newline at end of file +var _0x949e=['stringify','error','code','message','request\x20sent','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x949e,0x9c));var _0xe949=function(_0x4a9a3c,_0x589175){_0x4a9a3c=_0x4a9a3c-0x0;var _0x1925fb=_0x949e[_0x4a9a3c];return _0x1925fb;};'use strict';var _=require('lodash');var util=require(_0xe949('0x0'));var moment=require(_0xe949('0x1'));var BPromise=require(_0xe949('0x2'));var rs=require(_0xe949('0x3'));var fs=require('fs');var Redis=require(_0xe949('0x4'));var db=require(_0xe949('0x5'))['db'];var utils=require(_0xe949('0x6'));var logger=require(_0xe949('0x7'))(_0xe949('0x8'));var config=require(_0xe949('0x9'));var jayson=require(_0xe949('0xa'));var client=jayson[_0xe949('0xb')][_0xe949('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5d4f4d,_0x1b14e3,_0x58dee8){return new BPromise(function(_0x485270,_0x4a51e3){return client[_0xe949('0xd')](_0x5d4f4d,_0x58dee8)[_0xe949('0xe')](function(_0x261b10){logger[_0xe949('0xf')](_0xe949('0x10'),_0x1b14e3,'request\x20sent');logger[_0xe949('0x11')](_0xe949('0x12'),_0x1b14e3,'request\x20sent',JSON[_0xe949('0x13')](_0x261b10));if(_0x261b10[_0xe949('0x14')]){if(_0x261b10[_0xe949('0x14')][_0xe949('0x15')]===0x1f4){logger[_0xe949('0x14')](_0xe949('0x10'),_0x1b14e3,_0x261b10[_0xe949('0x14')][_0xe949('0x16')]);return _0x4a51e3(_0x261b10[_0xe949('0x14')][_0xe949('0x16')]);}logger['error'](_0xe949('0x10'),_0x1b14e3,_0x261b10['error'][_0xe949('0x16')]);return _0x485270(_0x261b10['error']['message']);}else{logger[_0xe949('0xf')](_0xe949('0x10'),_0x1b14e3,_0xe949('0x17'));_0x485270(_0x261b10['result'][_0xe949('0x16')]);}})[_0xe949('0x18')](function(_0x15ead7){logger[_0xe949('0x14')]('AnalyticFieldReport,\x20%s,\x20%s',_0x1b14e3,_0x15ead7);_0x4a51e3(_0x15ead7);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index b3e6a14..88b8029 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(_0x49f25c,_0x1d902f){var _0x206221=function(_0x41ea26){while(--_0x41ea26){_0x49f25c['push'](_0x49f25c['shift']());}};_0x206221(++_0x1d902f);}(_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'));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(_0x28e24b,_0x3a39a1){var _0x408dc7=function(_0x596b7c){while(--_0x596b7c){_0x28e24b['push'](_0x28e24b['shift']());}};_0x408dc7(++_0x3a39a1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var 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 2cad30c..52b73fb 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 _0xc3b0=['STRING','name','sequelize','exports'];(function(_0x1b6015,_0x16e94c){var _0x122e88=function(_0x20f631){while(--_0x20f631){_0x1b6015['push'](_0x1b6015['shift']());}};_0x122e88(++_0x16e94c);}(_0xc3b0,0x166));var _0x0c3b=function(_0x1ecc44,_0x1cecab){_0x1ecc44=_0x1ecc44-0x0;var _0x31bb0b=_0xc3b0[_0x1ecc44];return _0x31bb0b;};'use strict';var Sequelize=require(_0x0c3b('0x0'));module[_0x0c3b('0x1')]={'name':{'type':Sequelize[_0x0c3b('0x2')],'allowNull':![],'unique':_0x0c3b('0x3')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x0c3b('0x2')]}}; \ No newline at end of file +var _0xbd9f=['name','TEXT'];(function(_0x1de1af,_0x2cb740){var _0x21fa0d=function(_0x1a4b11){while(--_0x1a4b11){_0x1de1af['push'](_0x1de1af['shift']());}};_0x21fa0d(++_0x2cb740);}(_0xbd9f,0x98));var _0xfbd9=function(_0x2b4e22,_0x2bfb77){_0x2b4e22=_0x2b4e22-0x0;var _0x226f21=_0xbd9f[_0x2b4e22];return _0x226f21;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xfbd9('0x0')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0xfbd9('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 536c012..c6b9e81 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 _0xe14b=['papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','save','update','then','get','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','keys','length','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','params','eml-format','rimraf','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring'];(function(_0x5dd583,_0x3848c3){var _0x5d6449=function(_0x4d9b9f){while(--_0x4d9b9f){_0x5dd583['push'](_0x5dd583['shift']());}};_0x5d6449(++_0x3848c3);}(_0xe14b,0x93));var _0xbe14=function(_0x53cc5d,_0x10cdbd){_0x53cc5d=_0x53cc5d-0x0;var _0x26089a=_0xe14b[_0x53cc5d];return _0x26089a;};'use strict';var emlformat=require(_0xbe14('0x0'));var rimraf=require(_0xbe14('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbe14('0x2'));var moment=require(_0xbe14('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbe14('0x4'));var util=require('util');var path=require('path');var sox=require(_0xbe14('0x5'));var csv=require(_0xbe14('0x6'));var ejs=require(_0xbe14('0x7'));var fs=require('fs');var fs_extra=require(_0xbe14('0x8'));var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var licenseUtil=require(_0xbe14('0x14'));var db=require(_0xbe14('0x15'))['db'];function respondWithStatusCode(_0x27792f,_0x3b898d){_0x3b898d=_0x3b898d||0xcc;return function(_0x23a730){if(_0x23a730){return _0x27792f[_0xbe14('0x16')](_0x3b898d);}return _0x27792f[_0xbe14('0x17')](_0x3b898d)[_0xbe14('0x18')]();};}function respondWithResult(_0x1e4826,_0x33fd54){_0x33fd54=_0x33fd54||0xc8;return function(_0x813399){if(_0x813399){return _0x1e4826['status'](_0x33fd54)['json'](_0x813399);}};}function respondWithFilteredResult(_0x3f58f5,_0x3dc4a9){return function(_0xf4ac9){if(_0xf4ac9){var _0x37ce4e=typeof _0x3dc4a9['offset']===_0xbe14('0x19')&&typeof _0x3dc4a9[_0xbe14('0x1a')]===_0xbe14('0x19');var _0x123ede=_0xf4ac9[_0xbe14('0x1b')];var _0x29ab73=_0x37ce4e?0x0:_0x3dc4a9[_0xbe14('0x1c')];var _0x5ea1f8=_0x37ce4e?_0xf4ac9[_0xbe14('0x1b')]:_0x3dc4a9[_0xbe14('0x1c')]+_0x3dc4a9[_0xbe14('0x1a')];var _0x433459;if(_0x5ea1f8>=_0x123ede){_0x5ea1f8=_0x123ede;_0x433459=0xc8;}else{_0x433459=0xce;}_0x3f58f5[_0xbe14('0x17')](_0x433459);return _0x3f58f5[_0xbe14('0x1d')]('Content-Range',_0x29ab73+'-'+_0x5ea1f8+'/'+_0x123ede)[_0xbe14('0x1e')](_0xf4ac9);}return null;};}function patchUpdates(_0x4a1bbd){return function(_0x417c8d){try{jsonpatch[_0xbe14('0x1f')](_0x417c8d,_0x4a1bbd,!![]);}catch(_0x188ec4){return BPromise['reject'](_0x188ec4);}return _0x417c8d[_0xbe14('0x20')]();};}function saveUpdates(_0x56d845,_0x3c1c85){return function(_0x56e80c){if(_0x56e80c){return _0x56e80c[_0xbe14('0x21')](_0x56d845)['then'](function(_0x274018){return _0x274018;});}return null;};}function removeEntity(_0x3d3608,_0x505dbd){return function(_0x2da350){if(_0x2da350){return _0x2da350['destroy']()[_0xbe14('0x22')](function(){var _0x4851f8=_0x2da350[_0xbe14('0x23')]({'plain':!![]});var _0x5fa043=_0xbe14('0x24');return db[_0xbe14('0x25')][_0xbe14('0x26')]({'where':{'type':_0x5fa043,'resourceId':_0x4851f8['id']}})[_0xbe14('0x22')](function(){return _0x2da350;});})['then'](function(){_0x3d3608[_0xbe14('0x17')](0xcc)[_0xbe14('0x18')]();});}};}function handleEntityNotFound(_0x391556,_0x169369){return function(_0x5dd475){if(!_0x5dd475){_0x391556[_0xbe14('0x16')](0x194);}return _0x5dd475;};}function handleError(_0x29fc64,_0x59bf34){_0x59bf34=_0x59bf34||0x1f4;return function(_0x3c3613){logger[_0xbe14('0x27')](_0x3c3613[_0xbe14('0x28')]);if(_0x3c3613[_0xbe14('0x29')]){delete _0x3c3613[_0xbe14('0x29')];}_0x29fc64[_0xbe14('0x17')](_0x59bf34)[_0xbe14('0x2a')](_0x3c3613);};}exports[_0xbe14('0x2b')]=function(_0x4168c8,_0x16a159){var _0x40538f={},_0x3bf43c={},_0x39dc0a={'count':0x0,'rows':[]};var _0x10ae36=_[_0xbe14('0x2c')](db[_0xbe14('0x2d')][_0xbe14('0x2e')],function(_0x2ff48e){return{'name':_0x2ff48e[_0xbe14('0x2f')],'type':_0x2ff48e[_0xbe14('0x30')]['key']};});_0x3bf43c[_0xbe14('0x31')]=_['map'](_0x10ae36,'name');_0x3bf43c[_0xbe14('0x32')]=_['keys'](_0x4168c8[_0xbe14('0x32')]);_0x3bf43c[_0xbe14('0x33')]=_['intersection'](_0x3bf43c['model'],_0x3bf43c['query']);_0x40538f[_0xbe14('0x34')]=_[_0xbe14('0x35')](_0x3bf43c['model'],qs[_0xbe14('0x36')](_0x4168c8[_0xbe14('0x32')][_0xbe14('0x36')]));_0x40538f[_0xbe14('0x34')]=_0x40538f[_0xbe14('0x34')]['length']?_0x40538f['attributes']:_0x3bf43c[_0xbe14('0x31')];if(!_0x4168c8['query']['hasOwnProperty']('nolimit')){_0x40538f[_0xbe14('0x1a')]=qs[_0xbe14('0x1a')](_0x4168c8[_0xbe14('0x32')][_0xbe14('0x1a')]);_0x40538f[_0xbe14('0x1c')]=qs[_0xbe14('0x1c')](_0x4168c8[_0xbe14('0x32')][_0xbe14('0x1c')]);}_0x40538f[_0xbe14('0x37')]=qs[_0xbe14('0x38')](_0x4168c8[_0xbe14('0x32')][_0xbe14('0x38')]);_0x40538f['where']=qs['filters'](_[_0xbe14('0x39')](_0x4168c8[_0xbe14('0x32')],_0x3bf43c[_0xbe14('0x33')]),_0x10ae36);if(_0x4168c8['query'][_0xbe14('0x3a')]){_0x40538f[_0xbe14('0x3b')]=_[_0xbe14('0x3c')](_0x40538f[_0xbe14('0x3b')],{'$or':_[_0xbe14('0x2c')](_0x10ae36,function(_0x25ee1f){if(_0x25ee1f[_0xbe14('0x30')]!==_0xbe14('0x3d')){var _0x1b2608={};_0x1b2608[_0x25ee1f['name']]={'$like':'%'+_0x4168c8[_0xbe14('0x32')][_0xbe14('0x3a')]+'%'};return _0x1b2608;}})});}_0x40538f=_[_0xbe14('0x3c')]({},_0x40538f,_0x4168c8[_0xbe14('0x3e')]);var _0x3287b9={'where':_0x40538f[_0xbe14('0x3b')]};return db['AnalyticMetric'][_0xbe14('0x1b')](_0x3287b9)[_0xbe14('0x22')](function(_0x1220c9){_0x39dc0a[_0xbe14('0x1b')]=_0x1220c9;if(_0x4168c8['query']['includeAll']){_0x40538f[_0xbe14('0x3f')]=[{'all':!![]}];}return db[_0xbe14('0x2d')][_0xbe14('0x40')](_0x40538f);})['then'](function(_0x5d5318){_0x39dc0a[_0xbe14('0x41')]=_0x5d5318;return _0x39dc0a;})['then'](respondWithFilteredResult(_0x16a159,_0x40538f))['catch'](handleError(_0x16a159,null));};exports[_0xbe14('0x42')]=function(_0x1f0355,_0x8216c3){var _0x5051e4={'raw':!![],'where':{'id':_0x1f0355['params']['id']}},_0x558525={};_0x558525[_0xbe14('0x31')]=_[_0xbe14('0x43')](db[_0xbe14('0x2d')]['rawAttributes']);_0x558525[_0xbe14('0x32')]=_[_0xbe14('0x43')](_0x1f0355[_0xbe14('0x32')]);_0x558525[_0xbe14('0x33')]=_['intersection'](_0x558525['model'],_0x558525[_0xbe14('0x32')]);_0x5051e4[_0xbe14('0x34')]=_[_0xbe14('0x35')](_0x558525[_0xbe14('0x31')],qs[_0xbe14('0x36')](_0x1f0355['query']['fields']));_0x5051e4[_0xbe14('0x34')]=_0x5051e4[_0xbe14('0x34')][_0xbe14('0x44')]?_0x5051e4[_0xbe14('0x34')]:_0x558525['model'];if(_0x1f0355[_0xbe14('0x32')][_0xbe14('0x45')]){_0x5051e4['include']=[{'all':!![]}];}_0x5051e4=_[_0xbe14('0x3c')]({},_0x5051e4,_0x1f0355[_0xbe14('0x3e')]);return db[_0xbe14('0x2d')][_0xbe14('0x46')](_0x5051e4)['then'](handleEntityNotFound(_0x8216c3,null))['then'](respondWithResult(_0x8216c3,null))[_0xbe14('0x47')](handleError(_0x8216c3,null));};exports[_0xbe14('0x48')]=function(_0x4a1a37,_0x5acf90){return db[_0xbe14('0x2d')][_0xbe14('0x48')](_0x4a1a37[_0xbe14('0x49')],{})[_0xbe14('0x22')](function(_0xdbc6e1){var _0xd04fd5=_0x4a1a37[_0xbe14('0x4a')]['get']({'plain':!![]});if(!_0xd04fd5)throw new Error(_0xbe14('0x4b'));if(_0xd04fd5[_0xbe14('0x4c')]===_0xbe14('0x4a')){var _0x22b1f8=_0xdbc6e1[_0xbe14('0x23')]({'plain':!![]});var _0x494c32=_0xbe14('0x24');return db[_0xbe14('0x4d')][_0xbe14('0x46')]({'where':{'name':_0x494c32,'userProfileId':_0xd04fd5[_0xbe14('0x4e')]},'raw':!![]})[_0xbe14('0x22')](function(_0x2dbeb1){if(_0x2dbeb1&&_0x2dbeb1['autoAssociation']===0x0){return db['UserProfileResource'][_0xbe14('0x48')]({'name':_0x22b1f8[_0xbe14('0x29')],'resourceId':_0x22b1f8['id'],'type':_0x2dbeb1[_0xbe14('0x29')],'sectionId':_0x2dbeb1['id']},{})['then'](function(){return _0xdbc6e1;});}else{return _0xdbc6e1;}})['catch'](function(_0x44fe0d){logger[_0xbe14('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x44fe0d);throw _0x44fe0d;});}return _0xdbc6e1;})[_0xbe14('0x22')](respondWithResult(_0x5acf90,0xc9))[_0xbe14('0x47')](handleError(_0x5acf90,null));};exports['update']=function(_0x28f995,_0x4a40d2){if(_0x28f995[_0xbe14('0x49')]['id']){delete _0x28f995[_0xbe14('0x49')]['id'];}return db[_0xbe14('0x2d')]['find']({'where':{'id':_0x28f995[_0xbe14('0x4f')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x4a40d2,null))['then'](saveUpdates(_0x28f995[_0xbe14('0x49')],null))[_0xbe14('0x22')](respondWithResult(_0x4a40d2,null))[_0xbe14('0x47')](handleError(_0x4a40d2,null));};exports[_0xbe14('0x26')]=function(_0x49322f,_0x4f06a3){return db[_0xbe14('0x2d')][_0xbe14('0x46')]({'where':{'id':_0x49322f[_0xbe14('0x4f')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x4f06a3,null))[_0xbe14('0x22')](removeEntity(_0x4f06a3,null))[_0xbe14('0x47')](handleError(_0x4f06a3,null));}; \ No newline at end of file +var _0xdbf5=['../../components/parsers/advancedSearch','api','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','save','update','then','destroy','get','Metrics','UserProfileResource','end','error','name','send','index','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','VIRTUAL','AnalyticMetric','includeAll','include','findAll','rows','catch','show','keys','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x1628aa,_0x1f1d3e){var _0x3024c4=function(_0x25bc11){while(--_0x25bc11){_0x1628aa['push'](_0x1628aa['shift']());}};_0x3024c4(++_0x1f1d3e);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x300ad8,_0x28c054){_0x300ad8=_0x300ad8-0x0;var _0x2af970=_0xdbf5[_0x300ad8];return _0x2af970;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5dbf('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5dbf('0x1'));var moment=require(_0x5dbf('0x2'));var BPromise=require(_0x5dbf('0x3'));var Mustache=require(_0x5dbf('0x4'));var util=require(_0x5dbf('0x5'));var path=require(_0x5dbf('0x6'));var sox=require(_0x5dbf('0x7'));var csv=require(_0x5dbf('0x8'));var ejs=require(_0x5dbf('0x9'));var fs=require('fs');var fs_extra=require(_0x5dbf('0xa'));var _=require(_0x5dbf('0xb'));var squel=require(_0x5dbf('0xc'));var crypto=require(_0x5dbf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5dbf('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5dbf('0xf'));var Papa=require(_0x5dbf('0x10'));var Redis=require(_0x5dbf('0x11'));var authService=require(_0x5dbf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5dbf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5dbf('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5dbf('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x182cec,_0x2bb7ed){_0x2bb7ed=_0x2bb7ed||0xcc;return function(_0x1453a9){if(_0x1453a9){return _0x182cec[_0x5dbf('0x16')](_0x2bb7ed);}return _0x182cec[_0x5dbf('0x17')](_0x2bb7ed)['end']();};}function respondWithResult(_0x4803ca,_0x2b4e1c){_0x2b4e1c=_0x2b4e1c||0xc8;return function(_0x3480c8){if(_0x3480c8){return _0x4803ca['status'](_0x2b4e1c)[_0x5dbf('0x18')](_0x3480c8);}};}function respondWithFilteredResult(_0x248e3c,_0x23f763){return function(_0x2dfa44){if(_0x2dfa44){var _0x181816=typeof _0x23f763[_0x5dbf('0x19')]===_0x5dbf('0x1a')&&typeof _0x23f763['limit']==='undefined';var _0x16dc82=_0x2dfa44[_0x5dbf('0x1b')];var _0x39c7aa=_0x181816?0x0:_0x23f763[_0x5dbf('0x19')];var _0x20c2b0=_0x181816?_0x2dfa44['count']:_0x23f763[_0x5dbf('0x19')]+_0x23f763['limit'];var _0x565efa;if(_0x20c2b0>=_0x16dc82){_0x20c2b0=_0x16dc82;_0x565efa=0xc8;}else{_0x565efa=0xce;}_0x248e3c['status'](_0x565efa);return _0x248e3c[_0x5dbf('0x1c')](_0x5dbf('0x1d'),_0x39c7aa+'-'+_0x20c2b0+'/'+_0x16dc82)[_0x5dbf('0x18')](_0x2dfa44);}return null;};}function patchUpdates(_0x2ab57c){return function(_0x1e3cce){try{jsonpatch['apply'](_0x1e3cce,_0x2ab57c,!![]);}catch(_0x2764ea){return BPromise['reject'](_0x2764ea);}return _0x1e3cce[_0x5dbf('0x1e')]();};}function saveUpdates(_0x11cc67,_0x14d133){return function(_0x43a612){if(_0x43a612){return _0x43a612[_0x5dbf('0x1f')](_0x11cc67)[_0x5dbf('0x20')](function(_0x58085e){return _0x58085e;});}return null;};}function removeEntity(_0x4027c3,_0x3e3a2d){return function(_0x2d3e1b){if(_0x2d3e1b){return _0x2d3e1b[_0x5dbf('0x21')]()[_0x5dbf('0x20')](function(){var _0x226b93=_0x2d3e1b[_0x5dbf('0x22')]({'plain':!![]});var _0x20ab1b=_0x5dbf('0x23');return db[_0x5dbf('0x24')][_0x5dbf('0x21')]({'where':{'type':_0x20ab1b,'resourceId':_0x226b93['id']}})[_0x5dbf('0x20')](function(){return _0x2d3e1b;});})[_0x5dbf('0x20')](function(){_0x4027c3[_0x5dbf('0x17')](0xcc)[_0x5dbf('0x25')]();});}};}function handleEntityNotFound(_0x17f135,_0x466985){return function(_0x3f8341){if(!_0x3f8341){_0x17f135[_0x5dbf('0x16')](0x194);}return _0x3f8341;};}function handleError(_0x22ec42,_0x6a9757){_0x6a9757=_0x6a9757||0x1f4;return function(_0x471027){logger[_0x5dbf('0x26')](_0x471027['stack']);if(_0x471027[_0x5dbf('0x27')]){delete _0x471027[_0x5dbf('0x27')];}_0x22ec42[_0x5dbf('0x17')](_0x6a9757)[_0x5dbf('0x28')](_0x471027);};}exports[_0x5dbf('0x29')]=function(_0x6a276d,_0x2a65c5){var _0x31d57a={},_0x406ce6={},_0x273b63={'count':0x0,'rows':[]};var _0x294dd7=_['map'](db['AnalyticMetric'][_0x5dbf('0x2a')],function(_0x19015a){return{'name':_0x19015a[_0x5dbf('0x2b')],'type':_0x19015a[_0x5dbf('0x2c')][_0x5dbf('0x2d')]};});_0x406ce6['model']=_['map'](_0x294dd7,_0x5dbf('0x27'));_0x406ce6[_0x5dbf('0x2e')]=_['keys'](_0x6a276d[_0x5dbf('0x2e')]);_0x406ce6[_0x5dbf('0x2f')]=_[_0x5dbf('0x30')](_0x406ce6[_0x5dbf('0x31')],_0x406ce6[_0x5dbf('0x2e')]);_0x31d57a['attributes']=_[_0x5dbf('0x30')](_0x406ce6[_0x5dbf('0x31')],qs[_0x5dbf('0x32')](_0x6a276d[_0x5dbf('0x2e')][_0x5dbf('0x32')]));_0x31d57a['attributes']=_0x31d57a[_0x5dbf('0x33')][_0x5dbf('0x34')]?_0x31d57a[_0x5dbf('0x33')]:_0x406ce6[_0x5dbf('0x31')];if(!_0x6a276d['query'][_0x5dbf('0x35')](_0x5dbf('0x36'))){_0x31d57a[_0x5dbf('0x37')]=qs[_0x5dbf('0x37')](_0x6a276d[_0x5dbf('0x2e')][_0x5dbf('0x37')]);_0x31d57a[_0x5dbf('0x19')]=qs[_0x5dbf('0x19')](_0x6a276d[_0x5dbf('0x2e')][_0x5dbf('0x19')]);}_0x31d57a[_0x5dbf('0x38')]=qs['sort'](_0x6a276d[_0x5dbf('0x2e')][_0x5dbf('0x39')]);_0x31d57a[_0x5dbf('0x3a')]=qs['filters'](_[_0x5dbf('0x3b')](_0x6a276d[_0x5dbf('0x2e')],_0x406ce6[_0x5dbf('0x2f')]),_0x294dd7);if(_0x6a276d['query'][_0x5dbf('0x3c')]){_0x31d57a[_0x5dbf('0x3a')]=_[_0x5dbf('0x3d')](_0x31d57a['where'],{'$or':_[_0x5dbf('0x3e')](_0x294dd7,function(_0x29a62d){if(_0x29a62d[_0x5dbf('0x2c')]!==_0x5dbf('0x3f')){var _0x10537d={};_0x10537d[_0x29a62d[_0x5dbf('0x27')]]={'$like':'%'+_0x6a276d[_0x5dbf('0x2e')][_0x5dbf('0x3c')]+'%'};return _0x10537d;}})});}_0x31d57a=_['merge']({},_0x31d57a,_0x6a276d['options']);var _0x57ee72={'where':_0x31d57a['where']};return db[_0x5dbf('0x40')][_0x5dbf('0x1b')](_0x57ee72)['then'](function(_0x3ef0eb){_0x273b63[_0x5dbf('0x1b')]=_0x3ef0eb;if(_0x6a276d['query'][_0x5dbf('0x41')]){_0x31d57a[_0x5dbf('0x42')]=[{'all':!![]}];}return db[_0x5dbf('0x40')][_0x5dbf('0x43')](_0x31d57a);})[_0x5dbf('0x20')](function(_0x7c390d){_0x273b63[_0x5dbf('0x44')]=_0x7c390d;return _0x273b63;})[_0x5dbf('0x20')](respondWithFilteredResult(_0x2a65c5,_0x31d57a))[_0x5dbf('0x45')](handleError(_0x2a65c5,null));};exports[_0x5dbf('0x46')]=function(_0x50ac70,_0x78aef3){var _0x22f958={'raw':!![],'where':{'id':_0x50ac70['params']['id']}},_0xec1d28={};_0xec1d28[_0x5dbf('0x31')]=_[_0x5dbf('0x47')](db[_0x5dbf('0x40')][_0x5dbf('0x2a')]);_0xec1d28['query']=_[_0x5dbf('0x47')](_0x50ac70['query']);_0xec1d28[_0x5dbf('0x2f')]=_[_0x5dbf('0x30')](_0xec1d28[_0x5dbf('0x31')],_0xec1d28[_0x5dbf('0x2e')]);_0x22f958['attributes']=_['intersection'](_0xec1d28[_0x5dbf('0x31')],qs[_0x5dbf('0x32')](_0x50ac70[_0x5dbf('0x2e')]['fields']));_0x22f958[_0x5dbf('0x33')]=_0x22f958['attributes']['length']?_0x22f958['attributes']:_0xec1d28['model'];if(_0x50ac70[_0x5dbf('0x2e')][_0x5dbf('0x41')]){_0x22f958['include']=[{'all':!![]}];}_0x22f958=_[_0x5dbf('0x3d')]({},_0x22f958,_0x50ac70[_0x5dbf('0x48')]);return db['AnalyticMetric'][_0x5dbf('0x49')](_0x22f958)[_0x5dbf('0x20')](handleEntityNotFound(_0x78aef3,null))['then'](respondWithResult(_0x78aef3,null))[_0x5dbf('0x45')](handleError(_0x78aef3,null));};exports['create']=function(_0x5ab862,_0x337897){return db[_0x5dbf('0x40')][_0x5dbf('0x4a')](_0x5ab862['body'],{})['then'](function(_0x442a43){var _0x3e8612=_0x5ab862[_0x5dbf('0x4b')][_0x5dbf('0x22')]({'plain':!![]});if(!_0x3e8612)throw new Error(_0x5dbf('0x4c'));if(_0x3e8612[_0x5dbf('0x4d')]===_0x5dbf('0x4b')){var _0x319906=_0x442a43['get']({'plain':!![]});var _0x3f38a0=_0x5dbf('0x23');return db[_0x5dbf('0x4e')][_0x5dbf('0x49')]({'where':{'name':_0x3f38a0,'userProfileId':_0x3e8612[_0x5dbf('0x4f')]},'raw':!![]})[_0x5dbf('0x20')](function(_0x328dc5){if(_0x328dc5&&_0x328dc5['autoAssociation']===0x0){return db[_0x5dbf('0x24')]['create']({'name':_0x319906[_0x5dbf('0x27')],'resourceId':_0x319906['id'],'type':_0x328dc5[_0x5dbf('0x27')],'sectionId':_0x328dc5['id']},{})[_0x5dbf('0x20')](function(){return _0x442a43;});}else{return _0x442a43;}})[_0x5dbf('0x45')](function(_0x78ab84){logger[_0x5dbf('0x26')](_0x5dbf('0x50'),_0x78ab84);throw _0x78ab84;});}return _0x442a43;})['then'](respondWithResult(_0x337897,0xc9))['catch'](handleError(_0x337897,null));};exports['update']=function(_0x1e1876,_0xfdacc7){if(_0x1e1876[_0x5dbf('0x51')]['id']){delete _0x1e1876['body']['id'];}return db['AnalyticMetric'][_0x5dbf('0x49')]({'where':{'id':_0x1e1876[_0x5dbf('0x52')]['id']}})[_0x5dbf('0x20')](handleEntityNotFound(_0xfdacc7,null))['then'](saveUpdates(_0x1e1876[_0x5dbf('0x51')],null))['then'](respondWithResult(_0xfdacc7,null))[_0x5dbf('0x45')](handleError(_0xfdacc7,null));};exports[_0x5dbf('0x21')]=function(_0x2145ea,_0x5da14b){return db['AnalyticMetric'][_0x5dbf('0x49')]({'where':{'id':_0x2145ea[_0x5dbf('0x52')]['id']}})[_0x5dbf('0x20')](handleEntityNotFound(_0x5da14b,null))[_0x5dbf('0x20')](removeEntity(_0x5da14b,null))['catch'](handleError(_0x5da14b,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index d744167..9f41958 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 _0x770d=['moment','bluebird','request-promise','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api'];(function(_0xa530fd,_0x4e180d){var _0x33e785=function(_0x3883c3){while(--_0x3883c3){_0xa530fd['push'](_0xa530fd['shift']());}};_0x33e785(++_0x4e180d);}(_0x770d,0x122));var _0xd770=function(_0x405262,_0x17aa97){_0x405262=_0x405262-0x0;var _0x5e21e5=_0x770d[_0x405262];return _0x5e21e5;};'use strict';var _=require(_0xd770('0x0'));var util=require(_0xd770('0x1'));var logger=require(_0xd770('0x2'))(_0xd770('0x3'));var moment=require(_0xd770('0x4'));var BPromise=require(_0xd770('0x5'));var rp=require(_0xd770('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd770('0x7'));var config=require(_0xd770('0x8'));var attributes=require(_0xd770('0x9'));module[_0xd770('0xa')]=function(_0x5d3b18,_0x554c5e){return _0x5d3b18[_0xd770('0xb')](_0xd770('0xc'),attributes,{'tableName':_0xd770('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe451=['../../config/environment','exports','AnalyticMetric','analytics_metrics','../../config/logger','request-promise','path','rimraf'];(function(_0x1d770c,_0x3c859f){var _0xd9833b=function(_0x2a36cd){while(--_0x2a36cd){_0x1d770c['push'](_0x1d770c['shift']());}};_0xd9833b(++_0x3c859f);}(_0xe451,0xec));var _0x1e45=function(_0x10366c,_0x2b99e4){_0x10366c=_0x10366c-0x0;var _0x1165e7=_0xe451[_0x10366c];return _0x1165e7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1e45('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1e45('0x1'));var fs=require('fs');var path=require(_0x1e45('0x2'));var rimraf=require(_0x1e45('0x3'));var config=require(_0x1e45('0x4'));var attributes=require('./analyticMetric.attributes');module[_0x1e45('0x5')]=function(_0x1a163c,_0x115f88){return _0x1a163c['define'](_0x1e45('0x6'),attributes,{'tableName':_0x1e45('0x7'),'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 a25836e..04fdf9f 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 _0x38a7=['result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x38a7,0xfe));var _0x738a=function(_0x234907,_0x293b82){_0x234907=_0x234907-0x0;var _0xdbb6ee=_0x38a7[_0x234907];return _0xdbb6ee;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x738a('0x0'));var BPromise=require(_0x738a('0x1'));var rs=require(_0x738a('0x2'));var fs=require('fs');var Redis=require(_0x738a('0x3'));var db=require(_0x738a('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x738a('0x5'));var jayson=require(_0x738a('0x6'));var client=jayson[_0x738a('0x7')][_0x738a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x51bbb6,_0x59c6c6,_0xd25f6b){return new BPromise(function(_0x531dc8,_0x1190eb){return client[_0x738a('0x9')](_0x51bbb6,_0xd25f6b)[_0x738a('0xa')](function(_0x3e0213){logger['info'](_0x738a('0xb'),_0x59c6c6,_0x738a('0xc'));logger[_0x738a('0xd')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x59c6c6,_0x738a('0xc'),JSON[_0x738a('0xe')](_0x3e0213));if(_0x3e0213[_0x738a('0xf')]){if(_0x3e0213[_0x738a('0xf')][_0x738a('0x10')]===0x1f4){logger[_0x738a('0xf')](_0x738a('0xb'),_0x59c6c6,_0x3e0213[_0x738a('0xf')]['message']);return _0x1190eb(_0x3e0213[_0x738a('0xf')]['message']);}logger[_0x738a('0xf')](_0x738a('0xb'),_0x59c6c6,_0x3e0213['error'][_0x738a('0x11')]);return _0x531dc8(_0x3e0213[_0x738a('0xf')]['message']);}else{logger[_0x738a('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0x59c6c6,_0x738a('0xc'));_0x531dc8(_0x3e0213[_0x738a('0x13')][_0x738a('0x11')]);}})[_0x738a('0x14')](function(_0x325ad6){logger[_0x738a('0xf')](_0x738a('0xb'),_0x59c6c6,_0x325ad6);_0x1190eb(_0x325ad6);});});} \ No newline at end of file +var _0x5827=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticMetric,\x20%s,\x20%s','message','result','catch','lodash','util','moment','../../mysqldb'];(function(_0x175754,_0x7c36e6){var _0x25b006=function(_0x10e650){while(--_0x10e650){_0x175754['push'](_0x175754['shift']());}};_0x25b006(++_0x7c36e6);}(_0x5827,0xce));var _0x7582=function(_0x42f217,_0x113f9f){_0x42f217=_0x42f217-0x0;var _0x2f9817=_0x5827[_0x42f217];return _0x2f9817;};'use strict';var _=require(_0x7582('0x0'));var util=require(_0x7582('0x1'));var moment=require(_0x7582('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7582('0x3'))['db'];var utils=require(_0x7582('0x4'));var logger=require(_0x7582('0x5'))('rpc');var config=require(_0x7582('0x6'));var jayson=require(_0x7582('0x7'));var client=jayson[_0x7582('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x80aa03,_0x2d8f3a,_0x20cbde){return new BPromise(function(_0x136edf,_0x33562e){return client[_0x7582('0x9')](_0x80aa03,_0x20cbde)[_0x7582('0xa')](function(_0x23135e){logger[_0x7582('0xb')]('AnalyticMetric,\x20%s,\x20%s',_0x2d8f3a,_0x7582('0xc'));logger['debug'](_0x7582('0xd'),_0x2d8f3a,'request\x20sent',JSON[_0x7582('0xe')](_0x23135e));if(_0x23135e[_0x7582('0xf')]){if(_0x23135e[_0x7582('0xf')][_0x7582('0x10')]===0x1f4){logger['error'](_0x7582('0x11'),_0x2d8f3a,_0x23135e['error'][_0x7582('0x12')]);return _0x33562e(_0x23135e[_0x7582('0xf')]['message']);}logger[_0x7582('0xf')](_0x7582('0x11'),_0x2d8f3a,_0x23135e[_0x7582('0xf')]['message']);return _0x136edf(_0x23135e[_0x7582('0xf')][_0x7582('0x12')]);}else{logger['info'](_0x7582('0x11'),_0x2d8f3a,_0x7582('0xc'));_0x136edf(_0x23135e[_0x7582('0x13')][_0x7582('0x12')]);}})[_0x7582('0x14')](function(_0x59ae66){logger[_0x7582('0xf')](_0x7582('0x11'),_0x2d8f3a,_0x59ae66);_0x33562e(_0x59ae66);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 76777e4..8cdff13 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 _0x3148=['util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','post','create','put','/:id','delete','destroy','multer'];(function(_0x5a0101,_0x302f5f){var _0xd88870=function(_0x450d52){while(--_0x450d52){_0x5a0101['push'](_0x5a0101['shift']());}};_0xd88870(++_0x302f5f);}(_0x3148,0x1d3));var _0x8314=function(_0x360dc2,_0x843dd0){_0x360dc2=_0x360dc2-0x0;var _0x32817d=_0x3148[_0x360dc2];return _0x32817d;};'use strict';var multer=require(_0x8314('0x0'));var util=require(_0x8314('0x1'));var path=require('path');var timeout=require(_0x8314('0x2'));var express=require(_0x8314('0x3'));var router=express[_0x8314('0x4')]();var fs_extra=require(_0x8314('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8314('0x6'));var config=require(_0x8314('0x7'));var controller=require(_0x8314('0x8'));router[_0x8314('0x9')]('/',auth[_0x8314('0xa')](),controller[_0x8314('0xb')]);router[_0x8314('0x9')]('/:id',auth[_0x8314('0xa')](),controller['show']);router[_0x8314('0xc')]('/',auth[_0x8314('0xa')](),controller[_0x8314('0xd')]);router[_0x8314('0xe')](_0x8314('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x8314('0x10')](_0x8314('0xf'),auth[_0x8314('0xa')](),controller[_0x8314('0x11')]);module['exports']=router; \ No newline at end of file +var _0x6347=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','./analyticMetric.controller','get','/:id','isAuthenticated','show','post','put','delete','destroy','exports','multer','util'];(function(_0x109e39,_0x27f91c){var _0x3b142f=function(_0xec4d82){while(--_0xec4d82){_0x109e39['push'](_0x109e39['shift']());}};_0x3b142f(++_0x27f91c);}(_0x6347,0x1c9));var _0x7634=function(_0x3c2b20,_0x34f60c){_0x3c2b20=_0x3c2b20-0x0;var _0x1e1a70=_0x6347[_0x3c2b20];return _0x1e1a70;};'use strict';var multer=require(_0x7634('0x0'));var util=require(_0x7634('0x1'));var path=require('path');var timeout=require(_0x7634('0x2'));var express=require(_0x7634('0x3'));var router=express[_0x7634('0x4')]();var fs_extra=require(_0x7634('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7634('0x6'));var config=require('../../config/environment');var controller=require(_0x7634('0x7'));router[_0x7634('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7634('0x8')](_0x7634('0x9'),auth[_0x7634('0xa')](),controller[_0x7634('0xb')]);router[_0x7634('0xc')]('/',auth[_0x7634('0xa')](),controller['create']);router[_0x7634('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x7634('0xe')](_0x7634('0x9'),auth[_0x7634('0xa')](),controller[_0x7634('0xf')]);module[_0x7634('0x10')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index e471cb3..c0b9503 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 _0x0b4a=['exports','sequelize'];(function(_0x44aff8,_0x5cd990){var _0x236c30=function(_0x51942a){while(--_0x51942a){_0x44aff8['push'](_0x44aff8['shift']());}};_0x236c30(++_0x5cd990);}(_0x0b4a,0x12d));var _0xa0b4=function(_0x1e8c9e,_0x5ca389){_0x1e8c9e=_0x1e8c9e-0x0;var _0x35cace=_0x0b4a[_0x1e8c9e];return _0x35cace;};'use strict';var Sequelize=require(_0xa0b4('0x0'));module[_0xa0b4('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0x9bde=['exports','sequelize'];(function(_0x5adb04,_0x277e6f){var _0x3cfc7b=function(_0x27b701){while(--_0x27b701){_0x5adb04['push'](_0x5adb04['shift']());}};_0x3cfc7b(++_0x277e6f);}(_0x9bde,0x123));var _0xe9bd=function(_0x5ede10,_0x11013a){_0x5ede10=_0x5ede10-0x0;var _0x1c8586=_0x9bde[_0x5ede10];return _0x1c8586;};'use strict';var Sequelize=require(_0xe9bd('0x0'));module[_0xe9bd('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 68fa53c..3e89c84 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 _0x5210=['../../mysqldb','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','AnalyticTreeReport','rawAttributes','type','key','map','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x903cdd,_0x1ff766){var _0x939e83=function(_0x1a320d){while(--_0x1a320d){_0x903cdd['push'](_0x903cdd['shift']());}};_0x939e83(++_0x1ff766);}(_0x5210,0xc1));var _0x0521=function(_0xca4dc2,_0x1a475c){_0xca4dc2=_0xca4dc2-0x0;var _0x17faa0=_0x5210[_0xca4dc2];return _0x17faa0;};'use strict';var emlformat=require(_0x0521('0x0'));var rimraf=require(_0x0521('0x1'));var zipdir=require(_0x0521('0x2'));var jsonpatch=require(_0x0521('0x3'));var rp=require('request-promise');var moment=require(_0x0521('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0521('0x5'));var util=require(_0x0521('0x6'));var path=require('path');var sox=require(_0x0521('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0521('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0521('0x9'));var toCsv=require(_0x0521('0xa'));var querystring=require(_0x0521('0xb'));var Papa=require(_0x0521('0xc'));var Redis=require(_0x0521('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x0521('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0521('0xf'));var logger=require(_0x0521('0x10'))(_0x0521('0x11'));var utils=require('../../config/utils');var config=require(_0x0521('0x12'));var licenseUtil=require(_0x0521('0x13'));var db=require(_0x0521('0x14'))['db'];function respondWithStatusCode(_0x166ac0,_0x4a3697){_0x4a3697=_0x4a3697||0xcc;return function(_0x2ecd45){if(_0x2ecd45){return _0x166ac0['sendStatus'](_0x4a3697);}return _0x166ac0[_0x0521('0x15')](_0x4a3697)[_0x0521('0x16')]();};}function respondWithResult(_0x37ea6d,_0x622bda){_0x622bda=_0x622bda||0xc8;return function(_0x11e4f5){if(_0x11e4f5){return _0x37ea6d[_0x0521('0x15')](_0x622bda)[_0x0521('0x17')](_0x11e4f5);}};}function respondWithFilteredResult(_0xfe1bca,_0x296a8e){return function(_0x5cce2a){if(_0x5cce2a){var _0x200751=typeof _0x296a8e[_0x0521('0x18')]==='undefined'&&typeof _0x296a8e[_0x0521('0x19')]===_0x0521('0x1a');var _0x40b662=_0x5cce2a[_0x0521('0x1b')];var _0x54bea6=_0x200751?0x0:_0x296a8e[_0x0521('0x18')];var _0xda171d=_0x200751?_0x5cce2a[_0x0521('0x1b')]:_0x296a8e[_0x0521('0x18')]+_0x296a8e['limit'];var _0x36976e;if(_0xda171d>=_0x40b662){_0xda171d=_0x40b662;_0x36976e=0xc8;}else{_0x36976e=0xce;}_0xfe1bca[_0x0521('0x15')](_0x36976e);return _0xfe1bca['set'](_0x0521('0x1c'),_0x54bea6+'-'+_0xda171d+'/'+_0x40b662)[_0x0521('0x17')](_0x5cce2a);}return null;};}function patchUpdates(_0x4452db){return function(_0x1b1fe6){try{jsonpatch[_0x0521('0x1d')](_0x1b1fe6,_0x4452db,!![]);}catch(_0x46a09c){return BPromise[_0x0521('0x1e')](_0x46a09c);}return _0x1b1fe6[_0x0521('0x1f')]();};}function saveUpdates(_0x5f4766,_0x375de6){return function(_0xa50fb4){if(_0xa50fb4){return _0xa50fb4[_0x0521('0x20')](_0x5f4766)[_0x0521('0x21')](function(_0x46ba7a){return _0x46ba7a;});}return null;};}function removeEntity(_0x23ac9,_0x29d8e2){return function(_0x272da5){if(_0x272da5){return _0x272da5[_0x0521('0x22')]()[_0x0521('0x21')](function(){_0x23ac9[_0x0521('0x15')](0xcc)[_0x0521('0x16')]();});}};}function handleEntityNotFound(_0x4fa9ce,_0x1da0d8){return function(_0x36497e){if(!_0x36497e){_0x4fa9ce['sendStatus'](0x194);}return _0x36497e;};}function handleError(_0x301188,_0x5938d2){_0x5938d2=_0x5938d2||0x1f4;return function(_0x1a8bc7){logger[_0x0521('0x23')](_0x1a8bc7[_0x0521('0x24')]);if(_0x1a8bc7['name']){delete _0x1a8bc7[_0x0521('0x25')];}_0x301188[_0x0521('0x15')](_0x5938d2)[_0x0521('0x26')](_0x1a8bc7);};}exports[_0x0521('0x27')]=function(_0x1484f3,_0x3cbd0a){var _0x3383cf={},_0x3d52be={},_0x4e1346={'count':0x0,'rows':[]};var _0x2d9e9e=_['map'](db[_0x0521('0x28')][_0x0521('0x29')],function(_0x56e823){return{'name':_0x56e823['fieldName'],'type':_0x56e823[_0x0521('0x2a')][_0x0521('0x2b')]};});_0x3d52be['model']=_[_0x0521('0x2c')](_0x2d9e9e,_0x0521('0x25'));_0x3d52be['query']=_[_0x0521('0x2d')](_0x1484f3[_0x0521('0x2e')]);_0x3d52be[_0x0521('0x2f')]=_[_0x0521('0x30')](_0x3d52be[_0x0521('0x31')],_0x3d52be[_0x0521('0x2e')]);_0x3383cf['attributes']=_['intersection'](_0x3d52be[_0x0521('0x31')],qs[_0x0521('0x32')](_0x1484f3['query']['fields']));_0x3383cf['attributes']=_0x3383cf[_0x0521('0x33')][_0x0521('0x34')]?_0x3383cf[_0x0521('0x33')]:_0x3d52be[_0x0521('0x31')];if(!_0x1484f3['query'][_0x0521('0x35')](_0x0521('0x36'))){_0x3383cf[_0x0521('0x19')]=qs[_0x0521('0x19')](_0x1484f3['query']['limit']);_0x3383cf['offset']=qs[_0x0521('0x18')](_0x1484f3[_0x0521('0x2e')]['offset']);}_0x3383cf[_0x0521('0x37')]=qs[_0x0521('0x38')](_0x1484f3['query'][_0x0521('0x38')]);_0x3383cf[_0x0521('0x39')]=qs[_0x0521('0x2f')](_[_0x0521('0x3a')](_0x1484f3[_0x0521('0x2e')],_0x3d52be[_0x0521('0x2f')]),_0x2d9e9e);if(_0x1484f3[_0x0521('0x2e')][_0x0521('0x3b')]){_0x3383cf[_0x0521('0x39')]=_[_0x0521('0x3c')](_0x3383cf[_0x0521('0x39')],{'$or':_[_0x0521('0x2c')](_0x2d9e9e,function(_0x5d9d84){if(_0x5d9d84[_0x0521('0x2a')]!==_0x0521('0x3d')){var _0x183e0d={};_0x183e0d[_0x5d9d84[_0x0521('0x25')]]={'$like':'%'+_0x1484f3[_0x0521('0x2e')][_0x0521('0x3b')]+'%'};return _0x183e0d;}})});}_0x3383cf=_[_0x0521('0x3c')]({},_0x3383cf,_0x1484f3['options']);var _0x304fc9={'where':_0x3383cf[_0x0521('0x39')]};return db[_0x0521('0x28')][_0x0521('0x1b')](_0x304fc9)[_0x0521('0x21')](function(_0x105b08){_0x4e1346['count']=_0x105b08;if(_0x1484f3[_0x0521('0x2e')][_0x0521('0x3e')]){_0x3383cf[_0x0521('0x3f')]=[{'all':!![]}];}return db[_0x0521('0x28')][_0x0521('0x40')](_0x3383cf);})[_0x0521('0x21')](function(_0x25fea4){_0x4e1346['rows']=_0x25fea4;return _0x4e1346;})[_0x0521('0x21')](respondWithFilteredResult(_0x3cbd0a,_0x3383cf))[_0x0521('0x41')](handleError(_0x3cbd0a,null));};exports[_0x0521('0x42')]=function(_0x185195,_0x2754a4){var _0x1cac9d={'raw':!![],'where':{'id':_0x185195['params']['id']}},_0x1e1590={};_0x1e1590[_0x0521('0x31')]=_['keys'](db['AnalyticTreeReport']['rawAttributes']);_0x1e1590[_0x0521('0x2e')]=_[_0x0521('0x2d')](_0x185195[_0x0521('0x2e')]);_0x1e1590[_0x0521('0x2f')]=_[_0x0521('0x30')](_0x1e1590[_0x0521('0x31')],_0x1e1590['query']);_0x1cac9d[_0x0521('0x33')]=_[_0x0521('0x30')](_0x1e1590[_0x0521('0x31')],qs[_0x0521('0x32')](_0x185195[_0x0521('0x2e')]['fields']));_0x1cac9d[_0x0521('0x33')]=_0x1cac9d['attributes'][_0x0521('0x34')]?_0x1cac9d[_0x0521('0x33')]:_0x1e1590[_0x0521('0x31')];if(_0x185195[_0x0521('0x2e')][_0x0521('0x3e')]){_0x1cac9d[_0x0521('0x3f')]=[{'all':!![]}];}_0x1cac9d=_[_0x0521('0x3c')]({},_0x1cac9d,_0x185195['options']);return db[_0x0521('0x28')]['find'](_0x1cac9d)[_0x0521('0x21')](handleEntityNotFound(_0x2754a4,null))[_0x0521('0x21')](respondWithResult(_0x2754a4,null))[_0x0521('0x41')](handleError(_0x2754a4,null));};exports[_0x0521('0x43')]=function(_0xc9efed,_0x1c0a48){return db[_0x0521('0x28')][_0x0521('0x43')](_0xc9efed[_0x0521('0x44')],{})[_0x0521('0x21')](respondWithResult(_0x1c0a48,0xc9))[_0x0521('0x41')](handleError(_0x1c0a48,null));};exports[_0x0521('0x20')]=function(_0xa45b03,_0x407b7d){if(_0xa45b03[_0x0521('0x44')]['id']){delete _0xa45b03['body']['id'];}return db['AnalyticTreeReport']['find']({'where':{'id':_0xa45b03['params']['id']}})[_0x0521('0x21')](handleEntityNotFound(_0x407b7d,null))['then'](saveUpdates(_0xa45b03[_0x0521('0x44')],null))[_0x0521('0x21')](respondWithResult(_0x407b7d,null))[_0x0521('0x41')](handleError(_0x407b7d,null));};exports['destroy']=function(_0x6f4f33,_0x12eb40){return db[_0x0521('0x28')][_0x0521('0x45')]({'where':{'id':_0x6f4f33[_0x0521('0x46')]['id']}})[_0x0521('0x21')](handleEntityNotFound(_0x12eb40,null))['then'](removeEntity(_0x12eb40,null))[_0x0521('0x41')](handleError(_0x12eb40,null));}; \ No newline at end of file +var _0x8370=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','error','stack','name','send','index','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','map','query'];(function(_0x3752b5,_0x434425){var _0x160919=function(_0x517e32){while(--_0x517e32){_0x3752b5['push'](_0x3752b5['shift']());}};_0x160919(++_0x434425);}(_0x8370,0xa8));var _0x0837=function(_0x5e254d,_0x237f08){_0x5e254d=_0x5e254d-0x0;var _0x5dd2ac=_0x8370[_0x5e254d];return _0x5dd2ac;};'use strict';var emlformat=require(_0x0837('0x0'));var rimraf=require(_0x0837('0x1'));var zipdir=require(_0x0837('0x2'));var jsonpatch=require(_0x0837('0x3'));var rp=require(_0x0837('0x4'));var moment=require('moment');var BPromise=require(_0x0837('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0837('0x6'));var sox=require(_0x0837('0x7'));var csv=require(_0x0837('0x8'));var ejs=require(_0x0837('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0837('0xa'));var crypto=require('crypto');var jsforce=require(_0x0837('0xb'));var deskjs=require(_0x0837('0xc'));var toCsv=require(_0x0837('0x8'));var querystring=require(_0x0837('0xd'));var Papa=require(_0x0837('0xe'));var Redis=require('ioredis');var authService=require(_0x0837('0xf'));var qs=require(_0x0837('0x10'));var as=require(_0x0837('0x11'));var hardwareService=require(_0x0837('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x0837('0x13'));var config=require(_0x0837('0x14'));var licenseUtil=require(_0x0837('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56dad7,_0x23f78d){_0x23f78d=_0x23f78d||0xcc;return function(_0x51c3a4){if(_0x51c3a4){return _0x56dad7[_0x0837('0x16')](_0x23f78d);}return _0x56dad7[_0x0837('0x17')](_0x23f78d)[_0x0837('0x18')]();};}function respondWithResult(_0x13417d,_0x28256d){_0x28256d=_0x28256d||0xc8;return function(_0x2dc405){if(_0x2dc405){return _0x13417d[_0x0837('0x17')](_0x28256d)[_0x0837('0x19')](_0x2dc405);}};}function respondWithFilteredResult(_0x1d9266,_0x341a80){return function(_0x3be49c){if(_0x3be49c){var _0x657dfd=typeof _0x341a80[_0x0837('0x1a')]===_0x0837('0x1b')&&typeof _0x341a80[_0x0837('0x1c')]===_0x0837('0x1b');var _0x50f89d=_0x3be49c[_0x0837('0x1d')];var _0x45c2f9=_0x657dfd?0x0:_0x341a80[_0x0837('0x1a')];var _0x31445b=_0x657dfd?_0x3be49c[_0x0837('0x1d')]:_0x341a80[_0x0837('0x1a')]+_0x341a80[_0x0837('0x1c')];var _0x566915;if(_0x31445b>=_0x50f89d){_0x31445b=_0x50f89d;_0x566915=0xc8;}else{_0x566915=0xce;}_0x1d9266['status'](_0x566915);return _0x1d9266[_0x0837('0x1e')](_0x0837('0x1f'),_0x45c2f9+'-'+_0x31445b+'/'+_0x50f89d)[_0x0837('0x19')](_0x3be49c);}return null;};}function patchUpdates(_0x23c6bc){return function(_0x49b6b6){try{jsonpatch[_0x0837('0x20')](_0x49b6b6,_0x23c6bc,!![]);}catch(_0x4e2e00){return BPromise['reject'](_0x4e2e00);}return _0x49b6b6['save']();};}function saveUpdates(_0x3cb63,_0x5bbadd){return function(_0x2058a7){if(_0x2058a7){return _0x2058a7[_0x0837('0x21')](_0x3cb63)['then'](function(_0x1d5e2b){return _0x1d5e2b;});}return null;};}function removeEntity(_0x3791ce,_0x5a8d86){return function(_0x29f1c9){if(_0x29f1c9){return _0x29f1c9['destroy']()[_0x0837('0x22')](function(){_0x3791ce[_0x0837('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e9165,_0x4d3fb5){return function(_0x3106b5){if(!_0x3106b5){_0x1e9165[_0x0837('0x16')](0x194);}return _0x3106b5;};}function handleError(_0xda4cb4,_0x23a871){_0x23a871=_0x23a871||0x1f4;return function(_0x2beed7){logger[_0x0837('0x23')](_0x2beed7[_0x0837('0x24')]);if(_0x2beed7[_0x0837('0x25')]){delete _0x2beed7[_0x0837('0x25')];}_0xda4cb4[_0x0837('0x17')](_0x23a871)[_0x0837('0x26')](_0x2beed7);};}exports[_0x0837('0x27')]=function(_0x15d44b,_0x17e5df){var _0xff1269={},_0x37c9de={},_0xaaa163={'count':0x0,'rows':[]};var _0x110c5b=_['map'](db[_0x0837('0x28')][_0x0837('0x29')],function(_0x32cd80){return{'name':_0x32cd80[_0x0837('0x2a')],'type':_0x32cd80[_0x0837('0x2b')][_0x0837('0x2c')]};});_0x37c9de[_0x0837('0x2d')]=_[_0x0837('0x2e')](_0x110c5b,'name');_0x37c9de[_0x0837('0x2f')]=_[_0x0837('0x30')](_0x15d44b[_0x0837('0x2f')]);_0x37c9de[_0x0837('0x31')]=_[_0x0837('0x32')](_0x37c9de[_0x0837('0x2d')],_0x37c9de[_0x0837('0x2f')]);_0xff1269[_0x0837('0x33')]=_[_0x0837('0x32')](_0x37c9de[_0x0837('0x2d')],qs[_0x0837('0x34')](_0x15d44b[_0x0837('0x2f')][_0x0837('0x34')]));_0xff1269[_0x0837('0x33')]=_0xff1269[_0x0837('0x33')][_0x0837('0x35')]?_0xff1269[_0x0837('0x33')]:_0x37c9de[_0x0837('0x2d')];if(!_0x15d44b[_0x0837('0x2f')][_0x0837('0x36')]('nolimit')){_0xff1269[_0x0837('0x1c')]=qs['limit'](_0x15d44b[_0x0837('0x2f')][_0x0837('0x1c')]);_0xff1269[_0x0837('0x1a')]=qs[_0x0837('0x1a')](_0x15d44b[_0x0837('0x2f')][_0x0837('0x1a')]);}_0xff1269[_0x0837('0x37')]=qs['sort'](_0x15d44b[_0x0837('0x2f')][_0x0837('0x38')]);_0xff1269[_0x0837('0x39')]=qs[_0x0837('0x31')](_[_0x0837('0x3a')](_0x15d44b['query'],_0x37c9de[_0x0837('0x31')]),_0x110c5b);if(_0x15d44b[_0x0837('0x2f')][_0x0837('0x3b')]){_0xff1269['where']=_[_0x0837('0x3c')](_0xff1269[_0x0837('0x39')],{'$or':_[_0x0837('0x2e')](_0x110c5b,function(_0xf4306c){if(_0xf4306c[_0x0837('0x2b')]!==_0x0837('0x3d')){var _0x22d23f={};_0x22d23f[_0xf4306c[_0x0837('0x25')]]={'$like':'%'+_0x15d44b['query'][_0x0837('0x3b')]+'%'};return _0x22d23f;}})});}_0xff1269=_[_0x0837('0x3c')]({},_0xff1269,_0x15d44b[_0x0837('0x3e')]);var _0xe5d8a2={'where':_0xff1269['where']};return db['AnalyticTreeReport']['count'](_0xe5d8a2)[_0x0837('0x22')](function(_0x5a899d){_0xaaa163[_0x0837('0x1d')]=_0x5a899d;if(_0x15d44b[_0x0837('0x2f')][_0x0837('0x3f')]){_0xff1269[_0x0837('0x40')]=[{'all':!![]}];}return db[_0x0837('0x28')]['findAll'](_0xff1269);})['then'](function(_0x1ab877){_0xaaa163[_0x0837('0x41')]=_0x1ab877;return _0xaaa163;})[_0x0837('0x22')](respondWithFilteredResult(_0x17e5df,_0xff1269))[_0x0837('0x42')](handleError(_0x17e5df,null));};exports['show']=function(_0xf9a05,_0x2a04b9){var _0x29438c={'raw':!![],'where':{'id':_0xf9a05[_0x0837('0x43')]['id']}},_0x59c379={};_0x59c379[_0x0837('0x2d')]=_[_0x0837('0x30')](db[_0x0837('0x28')]['rawAttributes']);_0x59c379['query']=_['keys'](_0xf9a05[_0x0837('0x2f')]);_0x59c379[_0x0837('0x31')]=_[_0x0837('0x32')](_0x59c379[_0x0837('0x2d')],_0x59c379[_0x0837('0x2f')]);_0x29438c[_0x0837('0x33')]=_[_0x0837('0x32')](_0x59c379[_0x0837('0x2d')],qs[_0x0837('0x34')](_0xf9a05['query'][_0x0837('0x34')]));_0x29438c[_0x0837('0x33')]=_0x29438c[_0x0837('0x33')][_0x0837('0x35')]?_0x29438c[_0x0837('0x33')]:_0x59c379[_0x0837('0x2d')];if(_0xf9a05['query'][_0x0837('0x3f')]){_0x29438c[_0x0837('0x40')]=[{'all':!![]}];}_0x29438c=_[_0x0837('0x3c')]({},_0x29438c,_0xf9a05[_0x0837('0x3e')]);return db[_0x0837('0x28')][_0x0837('0x44')](_0x29438c)['then'](handleEntityNotFound(_0x2a04b9,null))[_0x0837('0x22')](respondWithResult(_0x2a04b9,null))[_0x0837('0x42')](handleError(_0x2a04b9,null));};exports['create']=function(_0xf4a6e1,_0xf5d690){return db[_0x0837('0x28')][_0x0837('0x45')](_0xf4a6e1['body'],{})[_0x0837('0x22')](respondWithResult(_0xf5d690,0xc9))[_0x0837('0x42')](handleError(_0xf5d690,null));};exports[_0x0837('0x21')]=function(_0x4e58d2,_0xd0cbb4){if(_0x4e58d2[_0x0837('0x46')]['id']){delete _0x4e58d2['body']['id'];}return db[_0x0837('0x28')]['find']({'where':{'id':_0x4e58d2[_0x0837('0x43')]['id']}})['then'](handleEntityNotFound(_0xd0cbb4,null))[_0x0837('0x22')](saveUpdates(_0x4e58d2['body'],null))['then'](respondWithResult(_0xd0cbb4,null))[_0x0837('0x42')](handleError(_0xd0cbb4,null));};exports[_0x0837('0x47')]=function(_0x69dfbc,_0x41b6f2){return db['AnalyticTreeReport']['find']({'where':{'id':_0x69dfbc[_0x0837('0x43')]['id']}})[_0x0837('0x22')](handleEntityNotFound(_0x41b6f2,null))[_0x0837('0x22')](removeEntity(_0x41b6f2,null))['catch'](handleError(_0x41b6f2,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 5cb9750..a2af356 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 _0x6251=['exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0x6251,0x1d5));var _0x1625=function(_0x5c16e1,_0x12ea72){_0x5c16e1=_0x5c16e1-0x0;var _0x4f59d0=_0x6251[_0x5c16e1];return _0x4f59d0;};'use strict';var _=require(_0x1625('0x0'));var util=require(_0x1625('0x1'));var logger=require(_0x1625('0x2'))(_0x1625('0x3'));var moment=require(_0x1625('0x4'));var BPromise=require(_0x1625('0x5'));var rp=require(_0x1625('0x6'));var fs=require('fs');var path=require(_0x1625('0x7'));var rimraf=require(_0x1625('0x8'));var config=require(_0x1625('0x9'));var attributes=require(_0x1625('0xa'));module[_0x1625('0xb')]=function(_0x161c02,_0xd86106){return _0x161c02[_0x1625('0xc')](_0x1625('0xd'),attributes,{'tableName':_0x1625('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc299=['../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','moment','bluebird','request-promise','path','rimraf'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xc299,0x103));var _0x9c29=function(_0x490be3,_0xf0fca3){_0x490be3=_0x490be3-0x0;var _0x3f5140=_0xc299[_0x490be3];return _0x3f5140;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x9c29('0x0'));var BPromise=require(_0x9c29('0x1'));var rp=require(_0x9c29('0x2'));var fs=require('fs');var path=require(_0x9c29('0x3'));var rimraf=require(_0x9c29('0x4'));var config=require(_0x9c29('0x5'));var attributes=require(_0x9c29('0x6'));module[_0x9c29('0x7')]=function(_0x7fdfcb,_0x40381f){return _0x7fdfcb[_0x9c29('0x8')](_0x9c29('0x9'),attributes,{'tableName':_0x9c29('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 514585b..72ca74e 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x2cad9a,_0x324913){var _0x4eaade=function(_0x50ba9b){while(--_0x50ba9b){_0x2cad9a['push'](_0x2cad9a['shift']());}};_0x4eaade(++_0x324913);}(_0x5f66,0x1a0));var _0x65f6=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5f66[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('AnalyticTreeReport,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file +var _0x1261=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x11d103,_0x2937e4){var _0x3a5478=function(_0x4d1fc9){while(--_0x4d1fc9){_0x11d103['push'](_0x11d103['shift']());}};_0x3a5478(++_0x2937e4);}(_0x1261,0x144));var _0x1126=function(_0x2be104,_0x4bf5d0){_0x2be104=_0x2be104-0x0;var _0x31c115=_0x1261[_0x2be104];return _0x31c115;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 4c40b46..2f02f78 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 _0xf58e=['./analyticTreeReport.controller','get','index','/:id','isAuthenticated','post','put','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x56e2a8,_0x2cf877){var _0x232412=function(_0x468b7c){while(--_0x468b7c){_0x56e2a8['push'](_0x56e2a8['shift']());}};_0x232412(++_0x2cf877);}(_0xf58e,0x149));var _0xef58=function(_0x413b36,_0x243f4d){_0x413b36=_0x413b36-0x0;var _0x15884e=_0xf58e[_0x413b36];return _0x15884e;};'use strict';var multer=require('multer');var util=require(_0xef58('0x0'));var path=require(_0xef58('0x1'));var timeout=require(_0xef58('0x2'));var express=require(_0xef58('0x3'));var router=express[_0xef58('0x4')]();var fs_extra=require(_0xef58('0x5'));var auth=require(_0xef58('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xef58('0x7'));router[_0xef58('0x8')]('/',auth['isAuthenticated'](),controller[_0xef58('0x9')]);router[_0xef58('0x8')](_0xef58('0xa'),auth[_0xef58('0xb')](),controller['show']);router[_0xef58('0xc')]('/',auth[_0xef58('0xb')](),controller['create']);router[_0xef58('0xd')](_0xef58('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xef58('0xe')](_0xef58('0xa'),auth[_0xef58('0xb')](),controller[_0xef58('0xf')]);module['exports']=router; \ No newline at end of file +var _0x6344=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','index','get','/:id','post','create','put','update','exports','multer'];(function(_0x25e10c,_0x49596a){var _0x5dfd94=function(_0x2f4bfb){while(--_0x2f4bfb){_0x25e10c['push'](_0x25e10c['shift']());}};_0x5dfd94(++_0x49596a);}(_0x6344,0x1c7));var _0x4634=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0x6344[_0x257642];return _0x3d813b;};'use strict';var multer=require(_0x4634('0x0'));var util=require(_0x4634('0x1'));var path=require(_0x4634('0x2'));var timeout=require(_0x4634('0x3'));var express=require(_0x4634('0x4'));var router=express[_0x4634('0x5')]();var fs_extra=require(_0x4634('0x6'));var auth=require(_0x4634('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x4634('0x8'));var controller=require(_0x4634('0x9'));router['get']('/',auth[_0x4634('0xa')](),controller[_0x4634('0xb')]);router[_0x4634('0xc')](_0x4634('0xd'),auth[_0x4634('0xa')](),controller['show']);router[_0x4634('0xe')]('/',auth['isAuthenticated'](),controller[_0x4634('0xf')]);router[_0x4634('0x10')](_0x4634('0xd'),auth[_0x4634('0xa')](),controller[_0x4634('0x11')]);router['delete'](_0x4634('0xd'),auth[_0x4634('0xa')](),controller['destroy']);module[_0x4634('0x12')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index ebd58f4..69d7cb9 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 _0x6fad=['sequelize','exports','STRING'];(function(_0x26b29a,_0x3eeda2){var _0x2c31f4=function(_0x58f3f0){while(--_0x58f3f0){_0x26b29a['push'](_0x26b29a['shift']());}};_0x2c31f4(++_0x3eeda2);}(_0x6fad,0x174));var _0xd6fa=function(_0x1b49ae,_0x4326a6){_0x1b49ae=_0x1b49ae-0x0;var _0x29c4a1=_0x6fad[_0x1b49ae];return _0x29c4a1;};'use strict';var Sequelize=require(_0xd6fa('0x0'));module[_0xd6fa('0x1')]={'name':{'type':Sequelize[_0xd6fa('0x2')]},'basename':{'type':Sequelize[_0xd6fa('0x2')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5640=['STRING','sequelize'];(function(_0x2d1f1b,_0x44c8d2){var _0x509555=function(_0x3f108c){while(--_0x3f108c){_0x2d1f1b['push'](_0x2d1f1b['shift']());}};_0x509555(++_0x44c8d2);}(_0x5640,0x111));var _0x0564=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x5640[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0x0564('0x0'));module['exports']={'name':{'type':Sequelize[_0x0564('0x1')]},'basename':{'type':Sequelize[_0x0564('0x1')]},'type':{'type':Sequelize[_0x0564('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 06f2879..562f249 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 _0xb812=['filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','find','clone','include','get','omit','createdAt','updatedAt','create','body','destroy','file','filename','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','basename','download','rimraf','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','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick'];(function(_0x40cafa,_0x1acd83){var _0x58f26b=function(_0x2948f4){while(--_0x2948f4){_0x40cafa['push'](_0x40cafa['shift']());}};_0x58f26b(++_0x1acd83);}(_0xb812,0x132));var _0x2b81=function(_0x673ae6,_0x59195d){_0x673ae6=_0x673ae6-0x0;var _0x41721=_0xb812[_0x673ae6];return _0x41721;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2b81('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2b81('0x1'));var rp=require(_0x2b81('0x2'));var moment=require(_0x2b81('0x3'));var BPromise=require(_0x2b81('0x4'));var Mustache=require('mustache');var util=require(_0x2b81('0x5'));var path=require(_0x2b81('0x6'));var sox=require(_0x2b81('0x7'));var csv=require(_0x2b81('0x8'));var ejs=require(_0x2b81('0x9'));var fs=require('fs');var fs_extra=require(_0x2b81('0xa'));var _=require(_0x2b81('0xb'));var squel=require(_0x2b81('0xc'));var crypto=require(_0x2b81('0xd'));var jsforce=require(_0x2b81('0xe'));var deskjs=require(_0x2b81('0xf'));var toCsv=require(_0x2b81('0x8'));var querystring=require(_0x2b81('0x10'));var Papa=require(_0x2b81('0x11'));var Redis=require(_0x2b81('0x12'));var authService=require(_0x2b81('0x13'));var qs=require(_0x2b81('0x14'));var as=require(_0x2b81('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2b81('0x16'));var utils=require(_0x2b81('0x17'));var config=require(_0x2b81('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f4484,_0x4098bb){_0x4098bb=_0x4098bb||0xcc;return function(_0x2b9630){if(_0x2b9630){return _0x2f4484[_0x2b81('0x19')](_0x4098bb);}return _0x2f4484[_0x2b81('0x1a')](_0x4098bb)[_0x2b81('0x1b')]();};}function respondWithResult(_0x22e1b9,_0x36c09d){_0x36c09d=_0x36c09d||0xc8;return function(_0x18c708){if(_0x18c708){return _0x22e1b9[_0x2b81('0x1a')](_0x36c09d)['json'](_0x18c708);}};}function respondWithFilteredResult(_0x36e433,_0xd94a0){return function(_0x166dc6){if(_0x166dc6){var _0x143bae=typeof _0xd94a0[_0x2b81('0x1c')]===_0x2b81('0x1d')&&typeof _0xd94a0[_0x2b81('0x1e')]===_0x2b81('0x1d');var _0x2e49d4=_0x166dc6['count'];var _0x140693=_0x143bae?0x0:_0xd94a0['offset'];var _0x5a48bd=_0x143bae?_0x166dc6[_0x2b81('0x1f')]:_0xd94a0[_0x2b81('0x1c')]+_0xd94a0[_0x2b81('0x1e')];var _0x4965e6;if(_0x5a48bd>=_0x2e49d4){_0x5a48bd=_0x2e49d4;_0x4965e6=0xc8;}else{_0x4965e6=0xce;}_0x36e433['status'](_0x4965e6);return _0x36e433[_0x2b81('0x20')](_0x2b81('0x21'),_0x140693+'-'+_0x5a48bd+'/'+_0x2e49d4)[_0x2b81('0x22')](_0x166dc6);}return null;};}function patchUpdates(_0x3c635f){return function(_0x482e4a){try{jsonpatch[_0x2b81('0x23')](_0x482e4a,_0x3c635f,!![]);}catch(_0x286bd4){return BPromise['reject'](_0x286bd4);}return _0x482e4a[_0x2b81('0x24')]();};}function saveUpdates(_0x1fb2ce,_0x1ab83a){return function(_0x51ed7c){if(_0x51ed7c){return _0x51ed7c[_0x2b81('0x25')](_0x1fb2ce)[_0x2b81('0x26')](function(_0x414ef6){return _0x414ef6;});}return null;};}function removeEntity(_0x10a59b,_0x53bd95){return function(_0x958a3d){if(_0x958a3d){return _0x958a3d['destroy']()[_0x2b81('0x26')](function(){_0x10a59b[_0x2b81('0x1a')](0xcc)[_0x2b81('0x1b')]();});}};}function handleEntityNotFound(_0x3a95f5,_0xfecad5){return function(_0x1a6c1d){if(!_0x1a6c1d){_0x3a95f5[_0x2b81('0x19')](0x194);}return _0x1a6c1d;};}function handleError(_0x27c63d,_0x52346a){_0x52346a=_0x52346a||0x1f4;return function(_0x1eb2e7){logger['error'](_0x1eb2e7[_0x2b81('0x27')]);if(_0x1eb2e7[_0x2b81('0x28')]){delete _0x1eb2e7[_0x2b81('0x28')];}_0x27c63d[_0x2b81('0x1a')](_0x52346a)[_0x2b81('0x29')](_0x1eb2e7);};}exports[_0x2b81('0x2a')]=function(_0x3c157c,_0xb5ab2f){var _0x5002e2={},_0x3375f4={},_0x3b0577={'count':0x0,'rows':[]};var _0x2ebd07=_[_0x2b81('0x2b')](db[_0x2b81('0x2c')][_0x2b81('0x2d')],function(_0x36afa3){return{'name':_0x36afa3[_0x2b81('0x2e')],'type':_0x36afa3[_0x2b81('0x2f')][_0x2b81('0x30')]};});_0x3375f4[_0x2b81('0x31')]=_[_0x2b81('0x2b')](_0x2ebd07,_0x2b81('0x28'));_0x3375f4[_0x2b81('0x32')]=_[_0x2b81('0x33')](_0x3c157c[_0x2b81('0x32')]);_0x3375f4[_0x2b81('0x34')]=_[_0x2b81('0x35')](_0x3375f4['model'],_0x3375f4['query']);_0x5002e2[_0x2b81('0x36')]=_['intersection'](_0x3375f4['model'],qs[_0x2b81('0x37')](_0x3c157c[_0x2b81('0x32')][_0x2b81('0x37')]));_0x5002e2['attributes']=_0x5002e2[_0x2b81('0x36')][_0x2b81('0x38')]?_0x5002e2[_0x2b81('0x36')]:_0x3375f4[_0x2b81('0x31')];if(!_0x3c157c[_0x2b81('0x32')][_0x2b81('0x39')](_0x2b81('0x3a'))){_0x5002e2[_0x2b81('0x1e')]=qs[_0x2b81('0x1e')](_0x3c157c[_0x2b81('0x32')][_0x2b81('0x1e')]);_0x5002e2['offset']=qs[_0x2b81('0x1c')](_0x3c157c['query'][_0x2b81('0x1c')]);}_0x5002e2[_0x2b81('0x3b')]=qs['sort'](_0x3c157c[_0x2b81('0x32')]['sort']);_0x5002e2[_0x2b81('0x3c')]=qs[_0x2b81('0x34')](_[_0x2b81('0x3d')](_0x3c157c[_0x2b81('0x32')],_0x3375f4[_0x2b81('0x34')]),_0x2ebd07);if(_0x3c157c[_0x2b81('0x32')][_0x2b81('0x3e')]){_0x5002e2['where']=_[_0x2b81('0x3f')](_0x5002e2[_0x2b81('0x3c')],{'$or':_[_0x2b81('0x2b')](_0x2ebd07,function(_0x56475d){if(_0x56475d[_0x2b81('0x2f')]!==_0x2b81('0x40')){var _0x246965={};_0x246965[_0x56475d['name']]={'$like':'%'+_0x3c157c[_0x2b81('0x32')][_0x2b81('0x3e')]+'%'};return _0x246965;}})});}_0x5002e2=_[_0x2b81('0x3f')]({},_0x5002e2,_0x3c157c[_0x2b81('0x41')]);var _0x40a3c5={'where':_0x5002e2[_0x2b81('0x3c')]};return db[_0x2b81('0x2c')][_0x2b81('0x1f')](_0x40a3c5)[_0x2b81('0x26')](function(_0x6c5098){_0x3b0577['count']=_0x6c5098;if(_0x3c157c[_0x2b81('0x32')][_0x2b81('0x42')]){_0x5002e2['include']=[{'all':!![]}];}return db['Attachment'][_0x2b81('0x43')](_0x5002e2);})['then'](function(_0x3597f0){_0x3b0577[_0x2b81('0x44')]=_0x3597f0;return _0x3b0577;})[_0x2b81('0x26')](respondWithFilteredResult(_0xb5ab2f,_0x5002e2))[_0x2b81('0x45')](handleError(_0xb5ab2f,null));};exports[_0x2b81('0x46')]=function(_0x57f5be,_0x1fb482){var _0xad586f={'raw':!![],'where':{'id':_0x57f5be[_0x2b81('0x47')]['id']}},_0x1e7126={};_0x1e7126[_0x2b81('0x31')]=_[_0x2b81('0x33')](db[_0x2b81('0x2c')][_0x2b81('0x2d')]);_0x1e7126[_0x2b81('0x32')]=_[_0x2b81('0x33')](_0x57f5be[_0x2b81('0x32')]);_0x1e7126[_0x2b81('0x34')]=_[_0x2b81('0x35')](_0x1e7126['model'],_0x1e7126['query']);_0xad586f[_0x2b81('0x36')]=_[_0x2b81('0x35')](_0x1e7126['model'],qs['fields'](_0x57f5be[_0x2b81('0x32')][_0x2b81('0x37')]));_0xad586f[_0x2b81('0x36')]=_0xad586f[_0x2b81('0x36')][_0x2b81('0x38')]?_0xad586f[_0x2b81('0x36')]:_0x1e7126[_0x2b81('0x31')];if(_0x57f5be[_0x2b81('0x32')][_0x2b81('0x42')]){_0xad586f['include']=[{'all':!![]}];}_0xad586f=_['merge']({},_0xad586f,_0x57f5be['options']);return db[_0x2b81('0x2c')][_0x2b81('0x48')](_0xad586f)['then'](handleEntityNotFound(_0x1fb482,null))[_0x2b81('0x26')](respondWithResult(_0x1fb482,null))[_0x2b81('0x45')](handleError(_0x1fb482,null));};exports[_0x2b81('0x49')]=function(_0x13b45c,_0x33bf5a){var _0x2c8123={'where':{'id':_0x13b45c[_0x2b81('0x47')]['id']}},_0x353cb2={};_0x353cb2[_0x2b81('0x31')]=_['keys'](db['Attachment'][_0x2b81('0x2d')]);_0x2c8123[_0x2b81('0x36')]=_['intersection'](_0x353cb2[_0x2b81('0x31')],qs[_0x2b81('0x37')](_0x13b45c['query'][_0x2b81('0x37')]));_0x2c8123[_0x2b81('0x36')]=_0x2c8123['attributes']['length']?_0x2c8123['attributes']:_0x353cb2[_0x2b81('0x31')];if(_0x13b45c[_0x2b81('0x32')][_0x2b81('0x42')]){_0x2c8123[_0x2b81('0x4a')]=[{'all':!![]}];}_0x2c8123=_[_0x2b81('0x3f')]({},_0x2c8123,_0x13b45c[_0x2b81('0x41')]);return db[_0x2b81('0x2c')][_0x2b81('0x48')](_0x2c8123)[_0x2b81('0x26')](handleEntityNotFound(_0x33bf5a,null))['then'](function(_0x2fddce){if(_0x2fddce){var _0x27117e=_0x2fddce[_0x2b81('0x4b')]({'plain':!![]});_0x27117e=qs[_0x2b81('0x4c')](_0x27117e,['id',_0x2b81('0x4d'),_0x2b81('0x4e')]);_0x13b45c['body']=_['omit'](_0x13b45c['body'],['id',_0x2b81('0x4d'),_0x2b81('0x4e')]);return db[_0x2b81('0x2c')][_0x2b81('0x4f')](_['merge'](_0x27117e,_0x13b45c[_0x2b81('0x50')]),{'include':_0x13b45c['query'][_0x2b81('0x42')]?[{'all':!![]}]:undefined});}})[_0x2b81('0x26')](respondWithResult(_0x33bf5a,0xc9))[_0x2b81('0x45')](handleError(_0x33bf5a,null));};exports[_0x2b81('0x25')]=function(_0xcad7a8,_0x405ffa){if(_0xcad7a8[_0x2b81('0x50')]['id']){delete _0xcad7a8['body']['id'];}return db[_0x2b81('0x2c')][_0x2b81('0x48')]({'where':{'id':_0xcad7a8[_0x2b81('0x47')]['id']}})[_0x2b81('0x26')](handleEntityNotFound(_0x405ffa,null))[_0x2b81('0x26')](saveUpdates(_0xcad7a8[_0x2b81('0x50')],null))[_0x2b81('0x26')](respondWithResult(_0x405ffa,null))[_0x2b81('0x45')](handleError(_0x405ffa,null));};exports[_0x2b81('0x51')]=function(_0x14982f,_0x1141cb){return db[_0x2b81('0x2c')][_0x2b81('0x48')]({'where':{'id':_0x14982f[_0x2b81('0x47')]['id']}})[_0x2b81('0x26')](handleEntityNotFound(_0x1141cb,null))[_0x2b81('0x26')](removeEntity(_0x1141cb,null))[_0x2b81('0x45')](handleError(_0x1141cb,null));};exports['create']=function(_0x4968be,_0x1a54f7,_0x158fee){_0x4968be[_0x2b81('0x50')][_0x2b81('0x28')]=_0x4968be[_0x2b81('0x52')]['originalname'];_0x4968be[_0x2b81('0x50')]['basename']=_0x4968be[_0x2b81('0x52')][_0x2b81('0x53')];_0x4968be[_0x2b81('0x50')]['type']=_0x4968be[_0x2b81('0x52')]['mimetype'];return db[_0x2b81('0x2c')][_0x2b81('0x4f')](_0x4968be[_0x2b81('0x50')])[_0x2b81('0x26')](respondWithResult(_0x1a54f7,0xc9))[_0x2b81('0x45')](handleError(_0x1a54f7,null));};exports['download']=function(_0x2d861e,_0x58e4cb,_0x5a9710){return db['Attachment'][_0x2b81('0x54')]({'where':{'id':_0x2d861e['params']['id']},'raw':!![]})[_0x2b81('0x26')](handleEntityNotFound(_0x58e4cb,null))['then'](function(_0x41e70a){if(_0x41e70a){var _0x10cc11=_0x41e70a[_0x2b81('0x55')]!==null;var _0x5da84c=path[_0x2b81('0x56')](config[_0x2b81('0x57')],_0x2b81('0x58'));if(_0x10cc11){_0x5da84c=path['join'](_0x5da84c,_0x2b81('0x59'));}var _0x2dc86a=path[_0x2b81('0x56')](_0x5da84c,_0x41e70a[_0x2b81('0x5a')]);return _0x58e4cb[_0x2b81('0x5b')](_0x2dc86a);}})[_0x2b81('0x45')](handleError(_0x58e4cb,null));}; \ No newline at end of file +var _0x05e2=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','offset','undefined','limit','count','json','apply','save','then','destroy','end','error','stack','name','send','map','rawAttributes','fieldName','type','model','filters','query','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Attachment','include','findAll','catch','show','keys','includeAll','params','find','get','omit','createdAt','updatedAt','body','create','file','originalname','basename','filename','mimetype','findOne','join','root','server/files/attachments/','offline-chat/','download','eml-format'];(function(_0x1e03e4,_0x362f76){var _0x4a887e=function(_0x13f548){while(--_0x13f548){_0x1e03e4['push'](_0x1e03e4['shift']());}};_0x4a887e(++_0x362f76);}(_0x05e2,0x1a8));var _0x205e=function(_0x59bcb1,_0x5a4b6c){_0x59bcb1=_0x59bcb1-0x0;var _0x4a737f=_0x05e2[_0x59bcb1];return _0x4a737f;};'use strict';var emlformat=require(_0x205e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x205e('0x1'));var jsonpatch=require(_0x205e('0x2'));var rp=require(_0x205e('0x3'));var moment=require(_0x205e('0x4'));var BPromise=require(_0x205e('0x5'));var Mustache=require(_0x205e('0x6'));var util=require(_0x205e('0x7'));var path=require('path');var sox=require(_0x205e('0x8'));var csv=require(_0x205e('0x9'));var ejs=require(_0x205e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x205e('0xb'));var squel=require(_0x205e('0xc'));var crypto=require(_0x205e('0xd'));var jsforce=require(_0x205e('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x205e('0xf'));var Redis=require(_0x205e('0x10'));var authService=require(_0x205e('0x11'));var qs=require(_0x205e('0x12'));var as=require(_0x205e('0x13'));var hardwareService=require(_0x205e('0x14'));var logger=require(_0x205e('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x205e('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xcecc3e,_0x38b59){_0x38b59=_0x38b59||0xcc;return function(_0x246df7){if(_0x246df7){return _0xcecc3e[_0x205e('0x17')](_0x38b59);}return _0xcecc3e[_0x205e('0x18')](_0x38b59)['end']();};}function respondWithResult(_0x4d9a53,_0x2e5099){_0x2e5099=_0x2e5099||0xc8;return function(_0x2eef1c){if(_0x2eef1c){return _0x4d9a53[_0x205e('0x18')](_0x2e5099)['json'](_0x2eef1c);}};}function respondWithFilteredResult(_0x3803ab,_0x5d1253){return function(_0x6cd987){if(_0x6cd987){var _0x20783d=typeof _0x5d1253[_0x205e('0x19')]===_0x205e('0x1a')&&typeof _0x5d1253[_0x205e('0x1b')]===_0x205e('0x1a');var _0x1a1318=_0x6cd987[_0x205e('0x1c')];var _0x316dbe=_0x20783d?0x0:_0x5d1253[_0x205e('0x19')];var _0x4fc28b=_0x20783d?_0x6cd987[_0x205e('0x1c')]:_0x5d1253[_0x205e('0x19')]+_0x5d1253[_0x205e('0x1b')];var _0x206827;if(_0x4fc28b>=_0x1a1318){_0x4fc28b=_0x1a1318;_0x206827=0xc8;}else{_0x206827=0xce;}_0x3803ab['status'](_0x206827);return _0x3803ab['set']('Content-Range',_0x316dbe+'-'+_0x4fc28b+'/'+_0x1a1318)[_0x205e('0x1d')](_0x6cd987);}return null;};}function patchUpdates(_0x16bd25){return function(_0x4aed6f){try{jsonpatch[_0x205e('0x1e')](_0x4aed6f,_0x16bd25,!![]);}catch(_0x3a5638){return BPromise['reject'](_0x3a5638);}return _0x4aed6f[_0x205e('0x1f')]();};}function saveUpdates(_0x5162d4,_0x3849f2){return function(_0x4d9036){if(_0x4d9036){return _0x4d9036['update'](_0x5162d4)[_0x205e('0x20')](function(_0x5dc3f8){return _0x5dc3f8;});}return null;};}function removeEntity(_0x3882d5,_0x169edb){return function(_0x1f1875){if(_0x1f1875){return _0x1f1875[_0x205e('0x21')]()[_0x205e('0x20')](function(){_0x3882d5[_0x205e('0x18')](0xcc)[_0x205e('0x22')]();});}};}function handleEntityNotFound(_0xc27ac4,_0x5d29c7){return function(_0x43ca93){if(!_0x43ca93){_0xc27ac4[_0x205e('0x17')](0x194);}return _0x43ca93;};}function handleError(_0x119998,_0x1337a2){_0x1337a2=_0x1337a2||0x1f4;return function(_0x7f8241){logger[_0x205e('0x23')](_0x7f8241[_0x205e('0x24')]);if(_0x7f8241[_0x205e('0x25')]){delete _0x7f8241[_0x205e('0x25')];}_0x119998[_0x205e('0x18')](_0x1337a2)[_0x205e('0x26')](_0x7f8241);};}exports['index']=function(_0x13c84d,_0x53b5d8){var _0x5c04f0={},_0x2d602e={},_0x3d6a61={'count':0x0,'rows':[]};var _0x527db3=_[_0x205e('0x27')](db['Attachment'][_0x205e('0x28')],function(_0xcfc84b){return{'name':_0xcfc84b[_0x205e('0x29')],'type':_0xcfc84b[_0x205e('0x2a')]['key']};});_0x2d602e[_0x205e('0x2b')]=_[_0x205e('0x27')](_0x527db3,_0x205e('0x25'));_0x2d602e['query']=_['keys'](_0x13c84d['query']);_0x2d602e[_0x205e('0x2c')]=_['intersection'](_0x2d602e[_0x205e('0x2b')],_0x2d602e[_0x205e('0x2d')]);_0x5c04f0['attributes']=_[_0x205e('0x2e')](_0x2d602e['model'],qs[_0x205e('0x2f')](_0x13c84d['query'][_0x205e('0x2f')]));_0x5c04f0[_0x205e('0x30')]=_0x5c04f0[_0x205e('0x30')][_0x205e('0x31')]?_0x5c04f0['attributes']:_0x2d602e['model'];if(!_0x13c84d[_0x205e('0x2d')]['hasOwnProperty'](_0x205e('0x32'))){_0x5c04f0[_0x205e('0x1b')]=qs[_0x205e('0x1b')](_0x13c84d[_0x205e('0x2d')][_0x205e('0x1b')]);_0x5c04f0[_0x205e('0x19')]=qs[_0x205e('0x19')](_0x13c84d['query'][_0x205e('0x19')]);}_0x5c04f0[_0x205e('0x33')]=qs[_0x205e('0x34')](_0x13c84d[_0x205e('0x2d')][_0x205e('0x34')]);_0x5c04f0[_0x205e('0x35')]=qs[_0x205e('0x2c')](_[_0x205e('0x36')](_0x13c84d[_0x205e('0x2d')],_0x2d602e['filters']),_0x527db3);if(_0x13c84d[_0x205e('0x2d')][_0x205e('0x37')]){_0x5c04f0[_0x205e('0x35')]=_[_0x205e('0x38')](_0x5c04f0[_0x205e('0x35')],{'$or':_[_0x205e('0x27')](_0x527db3,function(_0x5ae108){if(_0x5ae108[_0x205e('0x2a')]!==_0x205e('0x39')){var _0x5e4c91={};_0x5e4c91[_0x5ae108[_0x205e('0x25')]]={'$like':'%'+_0x13c84d[_0x205e('0x2d')][_0x205e('0x37')]+'%'};return _0x5e4c91;}})});}_0x5c04f0=_[_0x205e('0x38')]({},_0x5c04f0,_0x13c84d[_0x205e('0x3a')]);var _0x3569a8={'where':_0x5c04f0[_0x205e('0x35')]};return db[_0x205e('0x3b')][_0x205e('0x1c')](_0x3569a8)[_0x205e('0x20')](function(_0x122b2b){_0x3d6a61[_0x205e('0x1c')]=_0x122b2b;if(_0x13c84d[_0x205e('0x2d')]['includeAll']){_0x5c04f0[_0x205e('0x3c')]=[{'all':!![]}];}return db[_0x205e('0x3b')][_0x205e('0x3d')](_0x5c04f0);})[_0x205e('0x20')](function(_0x433b6c){_0x3d6a61['rows']=_0x433b6c;return _0x3d6a61;})['then'](respondWithFilteredResult(_0x53b5d8,_0x5c04f0))[_0x205e('0x3e')](handleError(_0x53b5d8,null));};exports[_0x205e('0x3f')]=function(_0xaf71ef,_0xdc4843){var _0x154b1c={'raw':!![],'where':{'id':_0xaf71ef['params']['id']}},_0x331b51={};_0x331b51[_0x205e('0x2b')]=_['keys'](db[_0x205e('0x3b')][_0x205e('0x28')]);_0x331b51[_0x205e('0x2d')]=_[_0x205e('0x40')](_0xaf71ef[_0x205e('0x2d')]);_0x331b51['filters']=_[_0x205e('0x2e')](_0x331b51[_0x205e('0x2b')],_0x331b51[_0x205e('0x2d')]);_0x154b1c[_0x205e('0x30')]=_[_0x205e('0x2e')](_0x331b51['model'],qs[_0x205e('0x2f')](_0xaf71ef[_0x205e('0x2d')][_0x205e('0x2f')]));_0x154b1c[_0x205e('0x30')]=_0x154b1c[_0x205e('0x30')][_0x205e('0x31')]?_0x154b1c['attributes']:_0x331b51[_0x205e('0x2b')];if(_0xaf71ef[_0x205e('0x2d')][_0x205e('0x41')]){_0x154b1c[_0x205e('0x3c')]=[{'all':!![]}];}_0x154b1c=_[_0x205e('0x38')]({},_0x154b1c,_0xaf71ef[_0x205e('0x3a')]);return db['Attachment']['find'](_0x154b1c)[_0x205e('0x20')](handleEntityNotFound(_0xdc4843,null))[_0x205e('0x20')](respondWithResult(_0xdc4843,null))[_0x205e('0x3e')](handleError(_0xdc4843,null));};exports['clone']=function(_0x36a739,_0x40573b){var _0x530737={'where':{'id':_0x36a739[_0x205e('0x42')]['id']}},_0x33c785={};_0x33c785[_0x205e('0x2b')]=_[_0x205e('0x40')](db[_0x205e('0x3b')]['rawAttributes']);_0x530737[_0x205e('0x30')]=_[_0x205e('0x2e')](_0x33c785[_0x205e('0x2b')],qs[_0x205e('0x2f')](_0x36a739['query'][_0x205e('0x2f')]));_0x530737[_0x205e('0x30')]=_0x530737['attributes'][_0x205e('0x31')]?_0x530737[_0x205e('0x30')]:_0x33c785[_0x205e('0x2b')];if(_0x36a739[_0x205e('0x2d')][_0x205e('0x41')]){_0x530737[_0x205e('0x3c')]=[{'all':!![]}];}_0x530737=_[_0x205e('0x38')]({},_0x530737,_0x36a739['options']);return db['Attachment'][_0x205e('0x43')](_0x530737)['then'](handleEntityNotFound(_0x40573b,null))[_0x205e('0x20')](function(_0x298433){if(_0x298433){var _0x26b195=_0x298433[_0x205e('0x44')]({'plain':!![]});_0x26b195=qs[_0x205e('0x45')](_0x26b195,['id',_0x205e('0x46'),_0x205e('0x47')]);_0x36a739[_0x205e('0x48')]=_['omit'](_0x36a739[_0x205e('0x48')],['id',_0x205e('0x46'),_0x205e('0x47')]);return db['Attachment']['create'](_[_0x205e('0x38')](_0x26b195,_0x36a739[_0x205e('0x48')]),{'include':_0x36a739['query']['includeAll']?[{'all':!![]}]:undefined});}})[_0x205e('0x20')](respondWithResult(_0x40573b,0xc9))[_0x205e('0x3e')](handleError(_0x40573b,null));};exports['update']=function(_0x415729,_0x3ae3e1){if(_0x415729[_0x205e('0x48')]['id']){delete _0x415729[_0x205e('0x48')]['id'];}return db[_0x205e('0x3b')]['find']({'where':{'id':_0x415729[_0x205e('0x42')]['id']}})[_0x205e('0x20')](handleEntityNotFound(_0x3ae3e1,null))[_0x205e('0x20')](saveUpdates(_0x415729['body'],null))['then'](respondWithResult(_0x3ae3e1,null))[_0x205e('0x3e')](handleError(_0x3ae3e1,null));};exports[_0x205e('0x21')]=function(_0x48d7ce,_0x520c24){return db['Attachment']['find']({'where':{'id':_0x48d7ce[_0x205e('0x42')]['id']}})[_0x205e('0x20')](handleEntityNotFound(_0x520c24,null))['then'](removeEntity(_0x520c24,null))[_0x205e('0x3e')](handleError(_0x520c24,null));};exports[_0x205e('0x49')]=function(_0x4642e7,_0x193b34,_0x497d06){_0x4642e7[_0x205e('0x48')][_0x205e('0x25')]=_0x4642e7[_0x205e('0x4a')][_0x205e('0x4b')];_0x4642e7[_0x205e('0x48')][_0x205e('0x4c')]=_0x4642e7[_0x205e('0x4a')][_0x205e('0x4d')];_0x4642e7['body'][_0x205e('0x2a')]=_0x4642e7[_0x205e('0x4a')][_0x205e('0x4e')];return db[_0x205e('0x3b')][_0x205e('0x49')](_0x4642e7['body'])['then'](respondWithResult(_0x193b34,0xc9))[_0x205e('0x3e')](handleError(_0x193b34,null));};exports['download']=function(_0x62b335,_0x47687f,_0x570566){return db[_0x205e('0x3b')][_0x205e('0x4f')]({'where':{'id':_0x62b335[_0x205e('0x42')]['id']},'raw':!![]})[_0x205e('0x20')](handleEntityNotFound(_0x47687f,null))[_0x205e('0x20')](function(_0x41ecf4){if(_0x41ecf4){var _0x5ac381=_0x41ecf4['ChatOfflineMessageId']!==null;var _0x4b88c3=path[_0x205e('0x50')](config[_0x205e('0x51')],_0x205e('0x52'));if(_0x5ac381){_0x4b88c3=path[_0x205e('0x50')](_0x4b88c3,_0x205e('0x53'));}var _0x4aa277=path[_0x205e('0x50')](_0x4b88c3,_0x41ecf4['basename']);return _0x47687f[_0x205e('0x54')](_0x4aa277);}})[_0x205e('0x3e')](handleError(_0x47687f,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index a343d96..5d7ef54 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 _0x48d8=['path','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x1a2235,_0x1e9971){var _0x313426=function(_0x5042a3){while(--_0x5042a3){_0x1a2235['push'](_0x1a2235['shift']());}};_0x313426(++_0x1e9971);}(_0x48d8,0x7c));var _0x848d=function(_0x4637ff,_0x412b6c){_0x4637ff=_0x4637ff-0x0;var _0x20af79=_0x48d8[_0x4637ff];return _0x20af79;};'use strict';var _=require(_0x848d('0x0'));var util=require(_0x848d('0x1'));var logger=require(_0x848d('0x2'))(_0x848d('0x3'));var moment=require('moment');var BPromise=require(_0x848d('0x4'));var rp=require(_0x848d('0x5'));var fs=require('fs');var path=require(_0x848d('0x6'));var rimraf=require('rimraf');var config=require(_0x848d('0x7'));var attributes=require(_0x848d('0x8'));module[_0x848d('0x9')]=function(_0x493276,_0x423e71){return _0x493276[_0x848d('0xa')](_0x848d('0xb'),attributes,{'tableName':_0x848d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9dff=['attachments','lodash','../../config/logger','api','bluebird','request-promise','../../config/environment','./attachment.attributes','exports','define'];(function(_0x5e4938,_0xdb1448){var _0x1335c8=function(_0x3c6715){while(--_0x3c6715){_0x5e4938['push'](_0x5e4938['shift']());}};_0x1335c8(++_0xdb1448);}(_0x9dff,0xf1));var _0xf9df=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9dff[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0xf9df('0x0'));var util=require('util');var logger=require(_0xf9df('0x1'))(_0xf9df('0x2'));var moment=require('moment');var BPromise=require(_0xf9df('0x3'));var rp=require(_0xf9df('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf9df('0x5'));var attributes=require(_0xf9df('0x6'));module[_0xf9df('0x7')]=function(_0x56be7e,_0x25eadd){return _0x56be7e[_0xf9df('0x8')]('Attachment',attributes,{'tableName':_0xf9df('0x9'),'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 bb6af4b..b4f54e1 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 _0x6a24=['create','body','options','raw','then','info','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateAttachment','Attachment'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x6a24,0xd1));var _0x46a2=function(_0x58a25c,_0x531733){_0x58a25c=_0x58a25c-0x0;var _0x569330=_0x6a24[_0x58a25c];return _0x569330;};'use strict';var _=require(_0x46a2('0x0'));var util=require(_0x46a2('0x1'));var moment=require('moment');var BPromise=require(_0x46a2('0x2'));var rs=require(_0x46a2('0x3'));var fs=require('fs');var Redis=require(_0x46a2('0x4'));var db=require(_0x46a2('0x5'))['db'];var utils=require(_0x46a2('0x6'));var logger=require('../../config/logger')(_0x46a2('0x7'));var config=require(_0x46a2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x46a2('0x9')][_0x46a2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x506698,_0x49870f,_0x2092f3){return new BPromise(function(_0x321b88,_0x587092){return client[_0x46a2('0xb')](_0x506698,_0x2092f3)['then'](function(_0x395578){logger['info'](_0x46a2('0xc'),_0x49870f,_0x46a2('0xd'));logger[_0x46a2('0xe')](_0x46a2('0xf'),_0x49870f,_0x46a2('0xd'),JSON[_0x46a2('0x10')](_0x395578));if(_0x395578[_0x46a2('0x11')]){if(_0x395578[_0x46a2('0x11')]['code']===0x1f4){logger['error'](_0x46a2('0xc'),_0x49870f,_0x395578[_0x46a2('0x11')]['message']);return _0x587092(_0x395578[_0x46a2('0x11')][_0x46a2('0x12')]);}logger[_0x46a2('0x11')](_0x46a2('0xc'),_0x49870f,_0x395578[_0x46a2('0x11')][_0x46a2('0x12')]);return _0x321b88(_0x395578[_0x46a2('0x11')][_0x46a2('0x12')]);}else{logger['info']('Attachment,\x20%s,\x20%s',_0x49870f,_0x46a2('0xd'));_0x321b88(_0x395578[_0x46a2('0x13')]['message']);}})[_0x46a2('0x14')](function(_0x2d755b){logger['error'](_0x46a2('0xc'),_0x49870f,_0x2d755b);_0x587092(_0x2d755b);});});}exports[_0x46a2('0x15')]=function(_0x577f18){var _0x27250b=this;return new Promise(function(_0x24f75f,_0x529bb5){return db[_0x46a2('0x16')][_0x46a2('0x17')](_0x577f18[_0x46a2('0x18')],{'raw':_0x577f18[_0x46a2('0x19')]?_0x577f18[_0x46a2('0x19')][_0x46a2('0x1a')]===undefined?!![]:![]:!![]})[_0x46a2('0x1b')](function(_0x202294){logger[_0x46a2('0x1c')](_0x46a2('0x15'),_0x577f18);logger[_0x46a2('0xe')](_0x46a2('0x15'),_0x577f18,JSON[_0x46a2('0x10')](_0x202294));_0x24f75f(_0x202294);})['catch'](function(_0xa37d90){logger['error'](_0x46a2('0x15'),_0xa37d90[_0x46a2('0x12')],_0x577f18);_0x529bb5(_0x27250b['error'](0x1f4,_0xa37d90[_0x46a2('0x12')]));});});}; \ No newline at end of file +var _0xe3ee=['Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','Attachment','body','options','raw','CreateAttachment','debug','moment','bluebird','../../mysqldb','rpc','jayson/promise','client','http','then','Attachment,\x20%s,\x20%s','request\x20sent'];(function(_0x3c0260,_0x3ece85){var _0xa9b7cd=function(_0x35db30){while(--_0x35db30){_0x3c0260['push'](_0x3c0260['shift']());}};_0xa9b7cd(++_0x3ece85);}(_0xe3ee,0x116));var _0xee3e=function(_0x41ecfe,_0xfa4301){_0x41ecfe=_0x41ecfe-0x0;var _0x47dc8d=_0xe3ee[_0x41ecfe];return _0x47dc8d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xee3e('0x0'));var BPromise=require(_0xee3e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xee3e('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xee3e('0x3'));var config=require('../../config/environment');var jayson=require(_0xee3e('0x4'));var client=jayson[_0xee3e('0x5')][_0xee3e('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xd893ca,_0x42d135,_0x39a770){return new BPromise(function(_0x43ab67,_0x17fba1){return client['request'](_0xd893ca,_0x39a770)[_0xee3e('0x7')](function(_0x2f6153){logger['info'](_0xee3e('0x8'),_0x42d135,_0xee3e('0x9'));logger['debug'](_0xee3e('0xa'),_0x42d135,_0xee3e('0x9'),JSON[_0xee3e('0xb')](_0x2f6153));if(_0x2f6153[_0xee3e('0xc')]){if(_0x2f6153[_0xee3e('0xc')][_0xee3e('0xd')]===0x1f4){logger[_0xee3e('0xc')](_0xee3e('0x8'),_0x42d135,_0x2f6153['error']['message']);return _0x17fba1(_0x2f6153[_0xee3e('0xc')][_0xee3e('0xe')]);}logger['error'](_0xee3e('0x8'),_0x42d135,_0x2f6153[_0xee3e('0xc')][_0xee3e('0xe')]);return _0x43ab67(_0x2f6153['error'][_0xee3e('0xe')]);}else{logger[_0xee3e('0xf')]('Attachment,\x20%s,\x20%s',_0x42d135,'request\x20sent');_0x43ab67(_0x2f6153[_0xee3e('0x10')][_0xee3e('0xe')]);}})[_0xee3e('0x11')](function(_0x512609){logger['error']('Attachment,\x20%s,\x20%s',_0x42d135,_0x512609);_0x17fba1(_0x512609);});});}exports['CreateAttachment']=function(_0x2589c0){var _0x23cd1f=this;return new Promise(function(_0x372605,_0x253530){return db[_0xee3e('0x12')]['create'](_0x2589c0[_0xee3e('0x13')],{'raw':_0x2589c0[_0xee3e('0x14')]?_0x2589c0[_0xee3e('0x14')][_0xee3e('0x15')]===undefined?!![]:![]:!![]})[_0xee3e('0x7')](function(_0x3b6d40){logger['info'](_0xee3e('0x16'),_0x2589c0);logger[_0xee3e('0x17')](_0xee3e('0x16'),_0x2589c0,JSON[_0xee3e('0xb')](_0x3b6d40));_0x372605(_0x3b6d40);})[_0xee3e('0x11')](function(_0xfbf279){logger[_0xee3e('0xc')](_0xee3e('0x16'),_0xfbf279[_0xee3e('0xe')],_0x2589c0);_0x253530(_0x23cd1f[_0xee3e('0xc')](0x1f4,_0xfbf279['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index f551128..9e23f18 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 _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x1b51e9,_0x26ec02){var _0xe36e04=function(_0x2bf487){while(--_0x2bf487){_0x1b51e9['push'](_0x1b51e9['shift']());}};_0xe36e04(++_0x26ec02);}(_0x5f2f,0x73));var _0xf5f2=function(_0x368fac,_0x2cc5ec){_0x368fac=_0x368fac-0x0;var _0x443c56=_0x5f2f[_0x368fac];return _0x443c56;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router; \ No newline at end of file +var _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x110433,_0x190140){var _0xee291d=function(_0x3cb789){while(--_0x3cb789){_0x110433['push'](_0x110433['shift']());}};_0xee291d(++_0x190140);}(_0x5f2f,0x73));var _0xf5f2=function(_0x75695d,_0x249b69){_0x75695d=_0x75695d-0x0;var _0x131aec=_0x5f2f[_0x75695d];return _0x131aec;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 8fcdda3..e388ef4 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 _0xd9d0=['clearBlockUser','getLicense','catch','status','send','login','authenticate','ad-login','json','online','password','User','passport','passport-local','Strategy','moment','../../mysqldb','../../components/auth/service','../../config/logger','api','activedirectory','url','Error\x20authenticate\x20%s:\x20%s','inspect','error','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','salt','disabled','blockedAt','admin','user','agent','domain','blocked','add','minutes'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd9d0,0x11a));var _0x0d9d=function(_0x14afda,_0x512394){_0x14afda=_0x14afda-0x0;var _0x1923af=_0xd9d0[_0x14afda];return _0x1923af;};'use strict';var passport=require(_0x0d9d('0x0'));var LocalStrategy=require(_0x0d9d('0x1'))[_0x0d9d('0x2')];var moment=require(_0x0d9d('0x3'));var ActiveDirectory=require('activedirectory2');var BPromise=require('bluebird');var util=require('util');var db=require(_0x0d9d('0x4'))['db'];var authService=require(_0x0d9d('0x5'));var utils=require('../../config/utils');var config=require('../../config/environment');var logger=require(_0x0d9d('0x6'))(_0x0d9d('0x7'));function isActiveDirectoryConfigured(_0x19a692){var _0x11bc84=![];if(typeof _0x19a692[_0x0d9d('0x8')]!=='undefined'){_0x11bc84=_0x19a692[_0x0d9d('0x8')]['baseDN']&&_0x19a692[_0x0d9d('0x8')][_0x0d9d('0x9')]&&_0x19a692[_0x0d9d('0x8')]['domain'];}return _0x11bc84;}function adAuthenticate(_0x3e873a,_0x46341b,_0x4f4b54){return new BPromise(function(_0x38d904,_0x4f736d){try{var _0x27ca45=new ActiveDirectory(_0x3e873a);_0x27ca45['authenticate'](_0x46341b,_0x4f4b54,function(_0xdcbbae,_0x3528f2){if(_0xdcbbae){logger['error'](_0x0d9d('0xa'),_0x46341b,util[_0x0d9d('0xb')](_0xdcbbae,{'showHidden':![],'depth':null}));_0x4f736d('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x3528f2){logger[_0x0d9d('0xc')](_0x0d9d('0xd'),_0x46341b);_0x4f736d(_0x0d9d('0xe'));}else{_0x38d904(_0x3528f2);}});}catch(_0x28aa53){_0x4f736d(_0x28aa53);}});}function ActiveDirectoryAuthenticate(_0x4b5325,_0x541bd4,_0x2284f0,_0x527931){var _0x50157e,_0x57af35;if(!isActiveDirectoryConfigured(config)){logger[_0x0d9d('0xc')](_0x0d9d('0xf'),_0x541bd4);return _0x527931(null,![],{'message':_0x0d9d('0xe')});}return db[_0x0d9d('0x10')][_0x0d9d('0x11')]({'where':{'id':0x1},'attributes':[_0x0d9d('0x12'),_0x0d9d('0x13')],'raw':!![]})[_0x0d9d('0x14')](function(_0x15ad94){_0x50157e=_0x15ad94;if(!_0x50157e[_0x0d9d('0x12')]){logger[_0x0d9d('0xc')](_0x0d9d('0x15'),_0x541bd4);throw new Error(_0x0d9d('0xe'));}return _0x4b5325[_0x0d9d('0x11')]({'attributes':['id',_0x0d9d('0x16'),'password',_0x0d9d('0x17'),'role',_0x0d9d('0x18'),'blocked',_0x0d9d('0x19'),'online'],'where':{'name':_0x541bd4,'role':{'$or':[_0x0d9d('0x1a'),_0x0d9d('0x1b'),_0x0d9d('0x1c')]},'adSsoEnabled':!![]}});})[_0x0d9d('0x14')](function(_0x4ed76c){if(!_0x4ed76c||_0x4ed76c&&_0x4ed76c[_0x0d9d('0x16')]!==_0x541bd4){throw new Error(_0x0d9d('0xe'));}_0x57af35=_0x4ed76c;var _0x445e45=_0x57af35[_0x0d9d('0x16')]+'@'+config[_0x0d9d('0x8')][_0x0d9d('0x1d')];return adAuthenticate(config[_0x0d9d('0x8')],_0x445e45,_0x2284f0);})[_0x0d9d('0x14')](function(_0x2f020d){if(_0x57af35['disabled']){throw new Error(_0x0d9d('0xe'));}if(_0x50157e[_0x0d9d('0x13')]>0x0){if(_0x57af35[_0x0d9d('0x1e')]){if(moment(_0x57af35['blockedAt'])[_0x0d9d('0x1f')](_0x50157e[_0x0d9d('0x13')],_0x0d9d('0x20'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0x0d9d('0x21')](_0x57af35,0x0,![],null)[_0x0d9d('0x14')](function(){return utils[_0x0d9d('0x22')](_0x57af35);})[_0x0d9d('0x14')](function(){return _0x527931(null,_0x57af35);});}else{return utils[_0x0d9d('0x22')](_0x57af35)[_0x0d9d('0x14')](function(){return _0x527931(null,_0x57af35);});}}else{return utils['getLicense'](_0x57af35)[_0x0d9d('0x14')](function(){return _0x527931(null,_0x57af35);});}})[_0x0d9d('0x23')](function(_0x5997c0){return _0x527931(null,![],_0x5997c0);});}function handleError(_0x164776,_0x427b01,_0x13b7ea){return _0x164776[_0x0d9d('0x24')](_0x427b01||0x1f4)[_0x0d9d('0x25')]({'message':_0x13b7ea?_0x13b7ea['message']||_0x13b7ea:''});}exports[_0x0d9d('0x26')]=function(_0x2fb4ed,_0x433d67,_0x3dce2a){passport[_0x0d9d('0x27')](_0x0d9d('0x28'),function(_0x8fb519,_0x52912a,_0x213dd0){var _0x977f04=_0x8fb519||_0x213dd0;if(_0x977f04){return handleError(_0x433d67,0x191,_0x977f04);}if(!_0x52912a){return handleError(_0x433d67,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x4d30ee={'payload':{'id':_0x52912a['id'],'role':_0x52912a['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x4d30ee)[_0x0d9d('0x14')](function(_0x4b12e5){_0x433d67[_0x0d9d('0x29')]({'id':_0x52912a['id'],'token':_0x4b12e5,'statusCall':'','isAlreadyLogged':_0x52912a[_0x0d9d('0x2a')]});});}})(_0x2fb4ed,_0x433d67,_0x3dce2a);};passport['use'](_0x0d9d('0x28'),new LocalStrategy({'usernameField':_0x0d9d('0x16'),'passwordField':_0x0d9d('0x2b')},function(_0x3e987a,_0x2a4207,_0x1d405d){return ActiveDirectoryAuthenticate(db[_0x0d9d('0x2c')],_0x3e987a,_0x2a4207,_0x1d405d);})); \ No newline at end of file +var _0xc9e9=['use','password','User','passport','passport-local','Strategy','moment','activedirectory2','../../mysqldb','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','then','name','role','disabled','blocked','blockedAt','online','user','agent','add','minutes','clearBlockUser','getLicense','status','send','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken'];(function(_0xbec8e6,_0x2841b5){var _0x4aa6f2=function(_0x583a0a){while(--_0x583a0a){_0xbec8e6['push'](_0xbec8e6['shift']());}};_0x4aa6f2(++_0x2841b5);}(_0xc9e9,0x117));var _0x9c9e=function(_0x34df4a,_0x209d10){_0x34df4a=_0x34df4a-0x0;var _0x145c69=_0xc9e9[_0x34df4a];return _0x145c69;};'use strict';var passport=require(_0x9c9e('0x0'));var LocalStrategy=require(_0x9c9e('0x1'))[_0x9c9e('0x2')];var moment=require(_0x9c9e('0x3'));var ActiveDirectory=require(_0x9c9e('0x4'));var BPromise=require('bluebird');var util=require('util');var db=require(_0x9c9e('0x5'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x9c9e('0x6'));var config=require(_0x9c9e('0x7'));var logger=require(_0x9c9e('0x8'))(_0x9c9e('0x9'));function isActiveDirectoryConfigured(_0x143147){var _0x12c06a=![];if(typeof _0x143147[_0x9c9e('0xa')]!==_0x9c9e('0xb')){_0x12c06a=_0x143147[_0x9c9e('0xa')][_0x9c9e('0xc')]&&_0x143147[_0x9c9e('0xa')]['url']&&_0x143147[_0x9c9e('0xa')][_0x9c9e('0xd')];}return _0x12c06a;}function adAuthenticate(_0x8cd54a,_0x50ded8,_0xf0f5f8){return new BPromise(function(_0x2166df,_0x38bb19){try{var _0x18e804=new ActiveDirectory(_0x8cd54a);_0x18e804[_0x9c9e('0xe')](_0x50ded8,_0xf0f5f8,function(_0x4723e7,_0x1b4146){if(_0x4723e7){logger[_0x9c9e('0xf')](_0x9c9e('0x10'),_0x50ded8,util[_0x9c9e('0x11')](_0x4723e7,{'showHidden':![],'depth':null}));_0x38bb19(_0x9c9e('0x12'));}else if(!_0x1b4146){logger[_0x9c9e('0xf')](_0x9c9e('0x13'),_0x50ded8);_0x38bb19(_0x9c9e('0x12'));}else{_0x2166df(_0x1b4146);}});}catch(_0x167d1c){_0x38bb19(_0x167d1c);}});}function ActiveDirectoryAuthenticate(_0x2157ef,_0xd24a20,_0x2f10c1,_0x5e6f12){var _0x1f7974,_0x1a4256;if(!isActiveDirectoryConfigured(config)){logger[_0x9c9e('0xf')](_0x9c9e('0x14'),_0xd24a20);return _0x5e6f12(null,![],{'message':_0x9c9e('0x12')});}return db[_0x9c9e('0x15')][_0x9c9e('0x16')]({'where':{'id':0x1},'attributes':[_0x9c9e('0x17'),_0x9c9e('0x18')],'raw':!![]})[_0x9c9e('0x19')](function(_0x45fdee){_0x1f7974=_0x45fdee;if(!_0x1f7974[_0x9c9e('0x17')]){logger[_0x9c9e('0xf')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0xd24a20);throw new Error(_0x9c9e('0x12'));}return _0x2157ef[_0x9c9e('0x16')]({'attributes':['id',_0x9c9e('0x1a'),'password','salt',_0x9c9e('0x1b'),_0x9c9e('0x1c'),_0x9c9e('0x1d'),_0x9c9e('0x1e'),_0x9c9e('0x1f')],'where':{'name':_0xd24a20,'role':{'$or':['admin',_0x9c9e('0x20'),_0x9c9e('0x21')]},'adSsoEnabled':!![]}});})[_0x9c9e('0x19')](function(_0x1f9617){if(!_0x1f9617||_0x1f9617&&_0x1f9617['name']!==_0xd24a20){throw new Error(_0x9c9e('0x12'));}_0x1a4256=_0x1f9617;var _0x45d63f=_0x1a4256[_0x9c9e('0x1a')]+'@'+config['activedirectory'][_0x9c9e('0xd')];return adAuthenticate(config[_0x9c9e('0xa')],_0x45d63f,_0x2f10c1);})[_0x9c9e('0x19')](function(_0x127d05){if(_0x1a4256[_0x9c9e('0x1c')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x1f7974[_0x9c9e('0x18')]>0x0){if(_0x1a4256['blocked']){if(moment(_0x1a4256[_0x9c9e('0x1e')])[_0x9c9e('0x22')](_0x1f7974[_0x9c9e('0x18')],_0x9c9e('0x23'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0x9c9e('0x24')](_0x1a4256,0x0,![],null)['then'](function(){return utils['getLicense'](_0x1a4256);})['then'](function(){return _0x5e6f12(null,_0x1a4256);});}else{return utils[_0x9c9e('0x25')](_0x1a4256)[_0x9c9e('0x19')](function(){return _0x5e6f12(null,_0x1a4256);});}}else{return utils[_0x9c9e('0x25')](_0x1a4256)[_0x9c9e('0x19')](function(){return _0x5e6f12(null,_0x1a4256);});}})['catch'](function(_0xbcd824){return _0x5e6f12(null,![],_0xbcd824);});}function handleError(_0x311cea,_0x2b5c72,_0x4aa6a7){return _0x311cea[_0x9c9e('0x26')](_0x2b5c72||0x1f4)[_0x9c9e('0x27')]({'message':_0x4aa6a7?_0x4aa6a7['message']||_0x4aa6a7:''});}exports['login']=function(_0xc9d059,_0x399cfa,_0x199521){passport[_0x9c9e('0xe')](_0x9c9e('0x28'),function(_0x342432,_0x3cc9f7,_0x3f6ea9){var _0x7d894f=_0x342432||_0x3f6ea9;if(_0x7d894f){return handleError(_0x399cfa,0x191,_0x7d894f);}if(!_0x3cc9f7){return handleError(_0x399cfa,0x194,{'message':_0x9c9e('0x29')});}else{var _0x292979={'payload':{'id':_0x3cc9f7['id'],'role':_0x3cc9f7[_0x9c9e('0x1b')]},'options':{'expiresIn':0x15180}};return authService[_0x9c9e('0x2a')](_0x292979)[_0x9c9e('0x19')](function(_0x39e61b){_0x399cfa['json']({'id':_0x3cc9f7['id'],'token':_0x39e61b,'statusCall':'','isAlreadyLogged':_0x3cc9f7[_0x9c9e('0x1f')]});});}})(_0xc9d059,_0x399cfa,_0x199521);};passport[_0x9c9e('0x2b')](_0x9c9e('0x28'),new LocalStrategy({'usernameField':_0x9c9e('0x1a'),'passwordField':_0x9c9e('0x2c')},function(_0x44ad4c,_0x433a05,_0x309ce0){return ActiveDirectoryAuthenticate(db[_0x9c9e('0x2d')],_0x44ad4c,_0x433a05,_0x309ce0);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 7454f08..8de12b4 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 _0x578e=['post','login','express','Router','./authActiveDirectory.controller'];(function(_0x33b259,_0x2036be){var _0xf95548=function(_0x5b3424){while(--_0x5b3424){_0x33b259['push'](_0x33b259['shift']());}};_0xf95548(++_0x2036be);}(_0x578e,0x1b0));var _0xe578=function(_0x85378f,_0x998d75){_0x85378f=_0x85378f-0x0;var _0x1cbd45=_0x578e[_0x85378f];return _0x1cbd45;};'use strict';var express=require(_0xe578('0x0'));var router=express[_0xe578('0x1')]();var controller=require(_0xe578('0x2'));router[_0xe578('0x3')]('/',controller[_0xe578('0x4')]);module['exports']=router; \ No newline at end of file +var _0xfac8=['express','./authActiveDirectory.controller'];(function(_0x5c86ec,_0x56920d){var _0x4279ab=function(_0xf932d4){while(--_0xf932d4){_0x5c86ec['push'](_0x5c86ec['shift']());}};_0x4279ab(++_0x56920d);}(_0xfac8,0x104));var _0x8fac=function(_0x3ba422,_0x53303c){_0x3ba422=_0x3ba422-0x0;var _0x20b5dd=_0xfac8[_0x3ba422];return _0x20b5dd;};'use strict';var express=require(_0x8fac('0x0'));var router=express['Router']();var controller=require(_0x8fac('0x1'));router['post']('/',controller['login']);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 563a5c3..e3a1fc7 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 _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(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x7a54,0x106));var _0x47a5=function(_0x32e747,_0x1800b9){_0x32e747=_0x32e747-0x0;var _0x55e4a8=_0x7a54[_0x32e747];return _0x55e4a8;};'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 +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(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0x7a54,0x106));var _0x47a5=function(_0xd0f950,_0x4a3266){_0xd0f950=_0xd0f950-0x0;var _0x454848=_0x7a54[_0xd0f950];return _0x454848;};'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 93da370..1e093f1 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 _0x74fe=['setTokenCookie','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js','get','callback','isMiddleware'];(function(_0x2d2077,_0x5e506e){var _0x1d34bf=function(_0x1b87d9){while(--_0x1b87d9){_0x2d2077['push'](_0x2d2077['shift']());}};_0x1d34bf(++_0x5e506e);}(_0x74fe,0xca));var _0xe74f=function(_0x3a3e60,_0x5c2393){_0x3a3e60=_0x3a3e60-0x0;var _0x5cbc88=_0x74fe[_0x3a3e60];return _0x5cbc88;};'use strict';var express=require(_0xe74f('0x0'));var passport=require(_0xe74f('0x1'));var router=express[_0xe74f('0x2')]();var controller=require(_0xe74f('0x3'));var userController=require(_0xe74f('0x4'));var authService=require('../../components/auth/service');router[_0xe74f('0x5')]('/',controller['login']);router[_0xe74f('0x5')]('/callback',controller[_0xe74f('0x6')],authService[_0xe74f('0x7')],userController['login'],authService[_0xe74f('0x8')]);module[_0xe74f('0x9')]=router; \ No newline at end of file +var _0x92e1=['/callback','callback','isMiddleware','setTokenCookie','exports','express','passport','Router','./authGoogle.controller','../../components/auth/service','get','login'];(function(_0x1792ed,_0x4db339){var _0x4b6165=function(_0x48bbbf){while(--_0x48bbbf){_0x1792ed['push'](_0x1792ed['shift']());}};_0x4b6165(++_0x4db339);}(_0x92e1,0x10d));var _0x192e=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0x92e1[_0x5c9307];return _0x373e29;};'use strict';var express=require(_0x192e('0x0'));var passport=require(_0x192e('0x1'));var router=express[_0x192e('0x2')]();var controller=require(_0x192e('0x3'));var userController=require('../user/user.controller.js');var authService=require(_0x192e('0x4'));router[_0x192e('0x5')]('/',controller[_0x192e('0x6')]);router[_0x192e('0x5')](_0x192e('0x7'),controller[_0x192e('0x8')],authService[_0x192e('0x9')],userController[_0x192e('0x6')],authService[_0x192e('0xa')]);module[_0x192e('0xb')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index dd715a5..f75cbbf 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 _0xad2f=['catch','MailAccount','Smtp','CloudProvider','getSmtpOptions','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','authenticate','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','body','email','Email\x20parameter\x20is\x20missing','toLowerCase','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','User','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','password','previousPasswords','validatePasswordHistory','resetPasswordToken','Password\x20reset!','use','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','../../mysqldb','../../components/auth/service','../../config/utils','client','Setting','allowedLoginAttempts','blockDuration','then','findOne','name','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','add','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense'];(function(_0x3ede07,_0x13db92){var _0x17ed06=function(_0x4f0c33){while(--_0x4f0c33){_0x3ede07['push'](_0x3ede07['shift']());}};_0x17ed06(++_0x13db92);}(_0xad2f,0x1ce));var _0xfad2=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xad2f[_0x618414];return _0x21c19a;};'use strict';var util=require('util');var passport=require(_0xfad2('0x0'));var LocalStrategy=require(_0xfad2('0x1'))[_0xfad2('0x2')];var jayson=require(_0xfad2('0x3'));var _=require(_0xfad2('0x4'));var rs=require(_0xfad2('0x5'));var moment=require('moment');var db=require(_0xfad2('0x6'))['db'];var authService=require(_0xfad2('0x7'));var utils=require(_0xfad2('0x8'));var client=jayson[_0xfad2('0x9')]['http']({'port':0x232b});function localAuthenticate(_0x3d518f,_0x4860c4,_0x20ed7d,_0x301d7e){var _0x283026,_0x5aacea;return db[_0xfad2('0xa')]['findOne']({'where':{'id':0x1},'attributes':[_0xfad2('0xb'),_0xfad2('0xc')],'raw':!![]})[_0xfad2('0xd')](function(_0x2bc5ee){_0x283026=_0x2bc5ee;return _0x3d518f[_0xfad2('0xe')]({'attributes':['id',_0xfad2('0xf'),'password',_0xfad2('0x10'),_0xfad2('0x11'),_0xfad2('0x12'),_0xfad2('0x13'),_0xfad2('0x14'),_0xfad2('0x15')],'where':{'name':_0x4860c4,'role':{'$or':[_0xfad2('0x16'),_0xfad2('0x17'),_0xfad2('0x18')]}}});})[_0xfad2('0xd')](function(_0xe11e75){if(!_0xe11e75||_0xe11e75&&_0xe11e75['name']!==_0x4860c4){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x5aacea=_0xe11e75;return _0x5aacea;}})[_0xfad2('0xd')](function(){_0x5aacea['authenticate'](_0x20ed7d,function(_0x4806cc,_0x1eca2a){var _0x4d5689=_0x5aacea[_0xfad2('0x15')]+0x1;if(_0x4806cc){return _0x301d7e(_0x4806cc);}else if(!_0x1eca2a){if(_0x5aacea[_0xfad2('0x12')]){return _0x301d7e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x283026['allowedLoginAttempts']>0x0){if(_0x5aacea[_0xfad2('0x13')]){if(_0x283026[_0xfad2('0xc')]>0x0){if(moment(_0x5aacea[_0xfad2('0x14')])[_0xfad2('0x19')](_0x283026[_0xfad2('0xc')],_0xfad2('0x1a'))>moment()){return _0x301d7e(null,![],{'message':_0xfad2('0x1b')});}else{return utils['clearBlockUser'](_0x5aacea,_0x4d5689,![],null)['then'](function(){return _0x301d7e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x301d7e(null,![],{'message':_0xfad2('0x1b')});}}else{if(_0x4d5689>=_0x283026[_0xfad2('0xb')]){return utils[_0xfad2('0x1c')](_0x5aacea,0x0,!![],moment())[_0xfad2('0xd')](function(){return _0x301d7e(null,![],{'message':_0xfad2('0x1b')});});}else{return utils[_0xfad2('0x1c')](_0x5aacea,_0x4d5689,![],null)[_0xfad2('0xd')](function(){return _0x301d7e(null,![],{'message':_0xfad2('0x1b')});});}}}else{return _0x301d7e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x5aacea[_0xfad2('0x12')]){return _0x301d7e(null,![],{'message':_0xfad2('0x1b')});}else if(_0x283026[_0xfad2('0xb')]>0x0){if(_0x5aacea[_0xfad2('0x13')]){if(_0x283026['blockDuration']>0x0){if(moment(_0x5aacea[_0xfad2('0x14')])['add'](_0x283026[_0xfad2('0xc')],'minutes')>moment()){return _0x301d7e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xfad2('0x1c')](_0x5aacea,0x0,![],null)[_0xfad2('0xd')](function(){return utils[_0xfad2('0x1d')](_0x5aacea);})[_0xfad2('0xd')](function(){return _0x301d7e(null,_0x5aacea);});}}else{return _0x301d7e(null,![],{'message':_0xfad2('0x1b')});}}else{return utils[_0xfad2('0x1c')](_0x5aacea,0x0,![],null)[_0xfad2('0xd')](function(){return utils['getLicense'](_0x5aacea);})[_0xfad2('0xd')](function(){return _0x301d7e(null,_0x5aacea);})[_0xfad2('0x1e')](function(_0x28341d){return _0x301d7e(null,![],_0x28341d);});}}else{if(_0x5aacea['blocked']){return _0x301d7e(null,![],{'message':_0xfad2('0x1b')});}else{return utils[_0xfad2('0x1d')](_0x5aacea)['then'](function(){return _0x301d7e(null,_0x5aacea);});}}}});})[_0xfad2('0x1e')](function(_0x28031c){return _0x301d7e(null,![],_0x28031c);});}function sendServiceMail(_0x30c353){return db[_0xfad2('0x1f')]['find']({'where':{'service':!![]},'attributes':['id',_0xfad2('0xf'),'email'],'include':[{'model':db['MailServerOut'],'as':_0xfad2('0x20'),'include':[{'model':db[_0xfad2('0x21')],'as':_0xfad2('0x21')}]}]})[_0xfad2('0xd')](function(_0x4517a1){if(!_0x4517a1){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x3fc1d5=_0x4517a1[_0xfad2('0x22')]();var _0x31ce65={'account':_0x3fc1d5,'message':_['merge']({'from':util[_0xfad2('0x23')](_0xfad2('0x24'),_0x4517a1[_0xfad2('0xf')],_0x4517a1['email']||_0x4517a1['Smtp'][_0xfad2('0x17')])},_0x30c353)};return client[_0xfad2('0x25')](_0xfad2('0x26'),_0x31ce65);})['then'](function(_0xa0d29b){if(_0xa0d29b[_0xfad2('0x27')]){throw new Error(util['format'](_0xfad2('0x28'),_0xa0d29b[_0xfad2('0x27')][_0xfad2('0x29')]||JSON[_0xfad2('0x2a')](_0xa0d29b[_0xfad2('0x27')])));}return!![];});}function handleError(_0x39eb18,_0x248a37,_0x37da10){return _0x39eb18[_0xfad2('0x2b')](_0x248a37||0x1f4)[_0xfad2('0x2c')]({'message':_0x37da10?_0x37da10[_0xfad2('0x29')]||_0x37da10:''});}exports[_0xfad2('0x2d')]=function(_0x4f5610,_0x36e5e8,_0x5a51d7){passport[_0xfad2('0x2e')](_0xfad2('0x2f'),function(_0x334325,_0x1db616,_0x342f5d){var _0x4bf469=_0x334325||_0x342f5d;if(_0x4bf469){return handleError(_0x36e5e8,0x191,_0x4bf469);}if(!_0x1db616){return handleError(_0x36e5e8,0x194,{'message':_0xfad2('0x30')});}else{var _0x2d3e64={'payload':{'id':_0x1db616['id'],'role':_0x1db616[_0xfad2('0x11')]},'options':{'expiresIn':0x15180}};return authService[_0xfad2('0x31')](_0x2d3e64)[_0xfad2('0xd')](function(_0x169d78){_0x36e5e8[_0xfad2('0x32')]({'id':_0x1db616['id'],'token':_0x169d78,'statusCall':'','isAlreadyLogged':_0x1db616['online']});});}})(_0x4f5610,_0x36e5e8,_0x5a51d7);};exports['forgot']=function(_0xfd7860,_0x42ce9b){if(!_0xfd7860[_0xfad2('0x33')][_0xfad2('0x34')]){return handleError(_0x42ce9b,0x1f4,{'message':_0xfad2('0x35')});}var _0x43de35=rs['generate']();_0xfd7860['body']['email']=_0xfd7860[_0xfad2('0x33')][_0xfad2('0x34')]['trim']()[_0xfad2('0x36')]();var _0x5280cf;return db['Setting'][_0xfad2('0xe')]({'where':{'id':0x1},'attributes':[_0xfad2('0xb'),'blockDuration'],'raw':!![]})[_0xfad2('0xd')](function(_0x34a25c){_0x5280cf=_0x34a25c;return db['User'][_0xfad2('0x37')]({'where':{'email':_0xfd7860[_0xfad2('0x33')][_0xfad2('0x34')]}});})[_0xfad2('0xd')](function(_0x3892ff){if(!_0x3892ff){throw new Error(_0xfad2('0x38'));}if(_0x3892ff[_0xfad2('0x12')]){throw new Error(_0xfad2('0x39'));}if(_0x3892ff[_0xfad2('0x13')]){if(moment(_0x3892ff[_0xfad2('0x14')])[_0xfad2('0x19')](_0x5280cf[_0xfad2('0xc')],_0xfad2('0x1a'))>moment()){throw new Error(_0xfad2('0x3a'));}else{_0x3892ff[_0xfad2('0x13')]=![];_0x3892ff[_0xfad2('0x14')]=null;}}_0x3892ff['resetPasswordToken']=_0x43de35;_0x3892ff[_0xfad2('0x3b')]=Date[_0xfad2('0x3c')]()+0x36ee80;return _0x3892ff[_0xfad2('0x3d')]();})[_0xfad2('0xd')](function(){return sendServiceMail({'to':_0xfd7860[_0xfad2('0x33')][_0xfad2('0x34')],'subject':_0xfad2('0x3e'),'text':_0xfad2('0x3f')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+'https://'+_0xfd7860[_0xfad2('0x40')][_0xfad2('0x41')]+_0xfad2('0x42')+_0x43de35+'\x0a\x0a'+_0xfad2('0x43')});})[_0xfad2('0xd')](function(){_0x42ce9b[_0xfad2('0x2b')](0xc8)[_0xfad2('0x2c')]({'message':'Reset\x20Email\x20sent!'});})['catch'](function(_0x52ad70){return handleError(_0x42ce9b,0x1f4,_0x52ad70);});};exports[_0xfad2('0x44')]=function(_0x52bd10,_0x2e60cb){return db[_0xfad2('0x45')][_0xfad2('0x37')]({'where':{'resetPasswordToken':_0x52bd10[_0xfad2('0x46')][_0xfad2('0x47')],'resetPasswordExpires':{'$gt':Date['now']()}}})['then'](function(_0x20ef4c){if(!_0x20ef4c){throw new Error(_0xfad2('0x48'));}return db['Setting'][_0xfad2('0xe')]({'attributes':['id',_0xfad2('0x49'),_0xfad2('0x4a'),_0xfad2('0x4b')]})[_0xfad2('0xd')](function(_0x118acf){if(_0x118acf['securePassword'])authService['validatePasswordPattern'](_0x52bd10[_0xfad2('0x33')][_0xfad2('0x4c')]);if(!_0x118acf[_0xfad2('0x4a')]||!_0x20ef4c[_0xfad2('0x4d')])return _0x20ef4c;authService[_0xfad2('0x4e')](_0x52bd10['body'][_0xfad2('0x4c')],_0x20ef4c['previousPasswords'],_0x118acf[_0xfad2('0x4b')]);return _0x20ef4c;})[_0xfad2('0xd')](function(){_0x20ef4c[_0xfad2('0x4c')]=_0x52bd10[_0xfad2('0x33')][_0xfad2('0x4c')];_0x20ef4c[_0xfad2('0x4f')]=null;_0x20ef4c[_0xfad2('0x3b')]=null;return _0x20ef4c[_0xfad2('0x3d')]();});})['then'](function(){_0x2e60cb[_0xfad2('0x2b')](0xc8)[_0xfad2('0x2c')]({'message':_0xfad2('0x50')});})[_0xfad2('0x1e')](function(_0xa7a90c){return handleError(_0x2e60cb,0x1f4,_0xa7a90c);});};passport[_0xfad2('0x51')](_0xfad2('0x2f'),new LocalStrategy({'usernameField':_0xfad2('0xf'),'passwordField':_0xfad2('0x4c')},function(_0x214a16,_0x54b3ce,_0x2bdab2){return localAuthenticate(db['User'],_0x214a16,_0x54b3ce,_0x2bdab2);})); \ No newline at end of file +var _0x9cc3=['then','name','password','salt','role','disabled','blocked','blockedAt','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','loginAttempts','add','clearBlockUser','getLicense','catch','MailAccount','email','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','\x22%s\x22\x20<%s>','user','SendMail','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','forgot','body','Email\x20parameter\x20is\x20missing','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','send','Reset\x20Email\x20sent!','reset','find','params','token','enforcePasswordHistory','passwordHistoryLimit','securePassword','validatePasswordPattern','previousPasswords','validatePasswordHistory','save','Password\x20reset!','use','util','passport','passport-local','Strategy','lodash','moment','../../mysqldb','../../components/auth/service','../../config/utils','http','Setting','findOne','allowedLoginAttempts','blockDuration'];(function(_0x13b7fd,_0x4eaf7f){var _0x32a74a=function(_0x2c5d80){while(--_0x2c5d80){_0x13b7fd['push'](_0x13b7fd['shift']());}};_0x32a74a(++_0x4eaf7f);}(_0x9cc3,0xeb));var _0x39cc=function(_0x907318,_0x526b71){_0x907318=_0x907318-0x0;var _0x4a6035=_0x9cc3[_0x907318];return _0x4a6035;};'use strict';var util=require(_0x39cc('0x0'));var passport=require(_0x39cc('0x1'));var LocalStrategy=require(_0x39cc('0x2'))[_0x39cc('0x3')];var jayson=require('jayson/promise');var _=require(_0x39cc('0x4'));var rs=require('randomstring');var moment=require(_0x39cc('0x5'));var db=require(_0x39cc('0x6'))['db'];var authService=require(_0x39cc('0x7'));var utils=require(_0x39cc('0x8'));var client=jayson['client'][_0x39cc('0x9')]({'port':0x232b});function localAuthenticate(_0x34ead3,_0x207d08,_0x34a66a,_0x25b129){var _0x1db9a6,_0xbebd69;return db[_0x39cc('0xa')][_0x39cc('0xb')]({'where':{'id':0x1},'attributes':[_0x39cc('0xc'),_0x39cc('0xd')],'raw':!![]})[_0x39cc('0xe')](function(_0x9e497c){_0x1db9a6=_0x9e497c;return _0x34ead3[_0x39cc('0xb')]({'attributes':['id',_0x39cc('0xf'),_0x39cc('0x10'),_0x39cc('0x11'),_0x39cc('0x12'),_0x39cc('0x13'),_0x39cc('0x14'),_0x39cc('0x15'),'loginAttempts'],'where':{'name':_0x207d08,'role':{'$or':['admin','user',_0x39cc('0x16')]}}});})[_0x39cc('0xe')](function(_0x2516b3){if(!_0x2516b3||_0x2516b3&&_0x2516b3[_0x39cc('0xf')]!==_0x207d08){throw new Error(_0x39cc('0x17'));}else{_0xbebd69=_0x2516b3;return _0xbebd69;}})[_0x39cc('0xe')](function(){_0xbebd69['authenticate'](_0x34a66a,function(_0x4e7096,_0x2cafad){var _0x2112a2=_0xbebd69[_0x39cc('0x18')]+0x1;if(_0x4e7096){return _0x25b129(_0x4e7096);}else if(!_0x2cafad){if(_0xbebd69['disabled']){return _0x25b129(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x1db9a6['allowedLoginAttempts']>0x0){if(_0xbebd69[_0x39cc('0x14')]){if(_0x1db9a6[_0x39cc('0xd')]>0x0){if(moment(_0xbebd69[_0x39cc('0x15')])[_0x39cc('0x19')](_0x1db9a6[_0x39cc('0xd')],'minutes')>moment()){return _0x25b129(null,![],{'message':_0x39cc('0x17')});}else{return utils['clearBlockUser'](_0xbebd69,_0x2112a2,![],null)[_0x39cc('0xe')](function(){return _0x25b129(null,![],{'message':_0x39cc('0x17')});});}}else{return _0x25b129(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x2112a2>=_0x1db9a6[_0x39cc('0xc')]){return utils['clearBlockUser'](_0xbebd69,0x0,!![],moment())[_0x39cc('0xe')](function(){return _0x25b129(null,![],{'message':_0x39cc('0x17')});});}else{return utils[_0x39cc('0x1a')](_0xbebd69,_0x2112a2,![],null)[_0x39cc('0xe')](function(){return _0x25b129(null,![],{'message':_0x39cc('0x17')});});}}}else{return _0x25b129(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0xbebd69[_0x39cc('0x13')]){return _0x25b129(null,![],{'message':_0x39cc('0x17')});}else if(_0x1db9a6['allowedLoginAttempts']>0x0){if(_0xbebd69[_0x39cc('0x14')]){if(_0x1db9a6[_0x39cc('0xd')]>0x0){if(moment(_0xbebd69['blockedAt'])[_0x39cc('0x19')](_0x1db9a6[_0x39cc('0xd')],'minutes')>moment()){return _0x25b129(null,![],{'message':_0x39cc('0x17')});}else{return utils[_0x39cc('0x1a')](_0xbebd69,0x0,![],null)['then'](function(){return utils['getLicense'](_0xbebd69);})[_0x39cc('0xe')](function(){return _0x25b129(null,_0xbebd69);});}}else{return _0x25b129(null,![],{'message':_0x39cc('0x17')});}}else{return utils['clearBlockUser'](_0xbebd69,0x0,![],null)[_0x39cc('0xe')](function(){return utils[_0x39cc('0x1b')](_0xbebd69);})['then'](function(){return _0x25b129(null,_0xbebd69);})[_0x39cc('0x1c')](function(_0x1abcf9){return _0x25b129(null,![],_0x1abcf9);});}}else{if(_0xbebd69[_0x39cc('0x14')]){return _0x25b129(null,![],{'message':_0x39cc('0x17')});}else{return utils[_0x39cc('0x1b')](_0xbebd69)[_0x39cc('0xe')](function(){return _0x25b129(null,_0xbebd69);});}}}});})[_0x39cc('0x1c')](function(_0x16cbbe){return _0x25b129(null,![],_0x16cbbe);});}function sendServiceMail(_0x3b589e){return db[_0x39cc('0x1d')]['find']({'where':{'service':!![]},'attributes':['id',_0x39cc('0xf'),_0x39cc('0x1e')],'include':[{'model':db['MailServerOut'],'as':_0x39cc('0x1f'),'include':[{'model':db[_0x39cc('0x20')],'as':_0x39cc('0x20')}]}]})[_0x39cc('0xe')](function(_0x26e115){if(!_0x26e115){throw new Error(_0x39cc('0x21'));}var _0x1876ee=_0x26e115['getSmtpOptions']();var _0xc35dbd={'account':_0x1876ee,'message':_[_0x39cc('0x22')]({'from':util['format'](_0x39cc('0x23'),_0x26e115['name'],_0x26e115[_0x39cc('0x1e')]||_0x26e115[_0x39cc('0x1f')][_0x39cc('0x24')])},_0x3b589e)};return client['request'](_0x39cc('0x25'),_0xc35dbd);})[_0x39cc('0xe')](function(_0x3e2a3c){if(_0x3e2a3c[_0x39cc('0x26')]){throw new Error(util[_0x39cc('0x27')](_0x39cc('0x28'),_0x3e2a3c['error'][_0x39cc('0x29')]||JSON[_0x39cc('0x2a')](_0x3e2a3c[_0x39cc('0x26')])));}return!![];});}function handleError(_0x259e88,_0x19aaf8,_0x4cfa68){return _0x259e88['status'](_0x19aaf8||0x1f4)['send']({'message':_0x4cfa68?_0x4cfa68[_0x39cc('0x29')]||_0x4cfa68:''});}exports[_0x39cc('0x2b')]=function(_0xdb66f2,_0x435b61,_0x201b38){passport['authenticate'](_0x39cc('0x2c'),function(_0x6815c4,_0x50d445,_0x2b298d){var _0x47085a=_0x6815c4||_0x2b298d;if(_0x47085a){return handleError(_0x435b61,0x191,_0x47085a);}if(!_0x50d445){return handleError(_0x435b61,0x194,{'message':_0x39cc('0x2d')});}else{var _0x4b0b6e={'payload':{'id':_0x50d445['id'],'role':_0x50d445[_0x39cc('0x12')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x4b0b6e)[_0x39cc('0xe')](function(_0x1d2162){_0x435b61[_0x39cc('0x2e')]({'id':_0x50d445['id'],'token':_0x1d2162,'statusCall':'','isAlreadyLogged':_0x50d445[_0x39cc('0x2f')]});});}})(_0xdb66f2,_0x435b61,_0x201b38);};exports[_0x39cc('0x30')]=function(_0x31e177,_0x5f280a){if(!_0x31e177[_0x39cc('0x31')][_0x39cc('0x1e')]){return handleError(_0x5f280a,0x1f4,{'message':_0x39cc('0x32')});}var _0x3b2346=rs['generate']();_0x31e177[_0x39cc('0x31')][_0x39cc('0x1e')]=_0x31e177['body'][_0x39cc('0x1e')]['trim']()[_0x39cc('0x33')]();var _0xef4e1c;return db[_0x39cc('0xa')][_0x39cc('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x39cc('0xd')],'raw':!![]})['then'](function(_0x251559){_0xef4e1c=_0x251559;return db[_0x39cc('0x34')]['find']({'where':{'email':_0x31e177[_0x39cc('0x31')][_0x39cc('0x1e')]}});})[_0x39cc('0xe')](function(_0x3add5f){if(!_0x3add5f){throw new Error(_0x39cc('0x35'));}if(_0x3add5f[_0x39cc('0x13')]){throw new Error(_0x39cc('0x36'));}if(_0x3add5f['blocked']){if(moment(_0x3add5f[_0x39cc('0x15')])[_0x39cc('0x19')](_0xef4e1c[_0x39cc('0xd')],'minutes')>moment()){throw new Error(_0x39cc('0x37'));}else{_0x3add5f[_0x39cc('0x14')]=![];_0x3add5f['blockedAt']=null;}}_0x3add5f[_0x39cc('0x38')]=_0x3b2346;_0x3add5f[_0x39cc('0x39')]=Date[_0x39cc('0x3a')]()+0x36ee80;return _0x3add5f['save']();})[_0x39cc('0xe')](function(){return sendServiceMail({'to':_0x31e177[_0x39cc('0x31')][_0x39cc('0x1e')],'subject':_0x39cc('0x3b'),'text':_0x39cc('0x3c')+_0x39cc('0x3d')+_0x39cc('0x3e')+_0x31e177[_0x39cc('0x3f')][_0x39cc('0x40')]+_0x39cc('0x41')+_0x3b2346+'\x0a\x0a'+_0x39cc('0x42')});})[_0x39cc('0xe')](function(){_0x5f280a[_0x39cc('0x43')](0xc8)[_0x39cc('0x44')]({'message':_0x39cc('0x45')});})[_0x39cc('0x1c')](function(_0x3b00d2){return handleError(_0x5f280a,0x1f4,_0x3b00d2);});};exports[_0x39cc('0x46')]=function(_0x1d2747,_0x63f8e7){return db[_0x39cc('0x34')][_0x39cc('0x47')]({'where':{'resetPasswordToken':_0x1d2747[_0x39cc('0x48')][_0x39cc('0x49')],'resetPasswordExpires':{'$gt':Date[_0x39cc('0x3a')]()}}})[_0x39cc('0xe')](function(_0x51baef){if(!_0x51baef){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x39cc('0xa')][_0x39cc('0xb')]({'attributes':['id','securePassword',_0x39cc('0x4a'),_0x39cc('0x4b')]})['then'](function(_0x385be4){if(_0x385be4[_0x39cc('0x4c')])authService[_0x39cc('0x4d')](_0x1d2747[_0x39cc('0x31')]['password']);if(!_0x385be4[_0x39cc('0x4a')]||!_0x51baef[_0x39cc('0x4e')])return _0x51baef;authService[_0x39cc('0x4f')](_0x1d2747[_0x39cc('0x31')][_0x39cc('0x10')],_0x51baef[_0x39cc('0x4e')],_0x385be4[_0x39cc('0x4b')]);return _0x51baef;})[_0x39cc('0xe')](function(){_0x51baef[_0x39cc('0x10')]=_0x1d2747[_0x39cc('0x31')]['password'];_0x51baef[_0x39cc('0x38')]=null;_0x51baef['resetPasswordExpires']=null;return _0x51baef[_0x39cc('0x50')]();});})['then'](function(){_0x63f8e7[_0x39cc('0x43')](0xc8)[_0x39cc('0x44')]({'message':_0x39cc('0x51')});})[_0x39cc('0x1c')](function(_0x104155){return handleError(_0x63f8e7,0x1f4,_0x104155);});};passport[_0x39cc('0x52')]('local-login',new LocalStrategy({'usernameField':'name','passwordField':_0x39cc('0x10')},function(_0xb92405,_0x43d864,_0x2c8d1b){return localAuthenticate(db[_0x39cc('0x34')],_0xb92405,_0x43d864,_0x2c8d1b);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index afdb5da..dc38bae 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 _0x2029=['/forgot','forgot','reset','exports','express','Router','post'];(function(_0xf003d2,_0xacd3a9){var _0x1addbc=function(_0x5cd623){while(--_0x5cd623){_0xf003d2['push'](_0xf003d2['shift']());}};_0x1addbc(++_0xacd3a9);}(_0x2029,0x1ee));var _0x9202=function(_0x3d8bdc,_0x38a796){_0x3d8bdc=_0x3d8bdc-0x0;var _0x2e30a6=_0x2029[_0x3d8bdc];return _0x2e30a6;};'use strict';var express=require(_0x9202('0x0'));var router=express[_0x9202('0x1')]();var controller=require('./authLocal.controller');router[_0x9202('0x2')]('/',controller['login']);router['post'](_0x9202('0x3'),controller[_0x9202('0x4')]);router[_0x9202('0x2')]('/reset/:token',controller[_0x9202('0x5')]);module[_0x9202('0x6')]=router; \ No newline at end of file +var _0x1669=['exports','Router','./authLocal.controller','post','login','/forgot','/reset/:token','reset'];(function(_0x5ac26b,_0x5319a0){var _0x1c2f96=function(_0x36e12d){while(--_0x36e12d){_0x5ac26b['push'](_0x5ac26b['shift']());}};_0x1c2f96(++_0x5319a0);}(_0x1669,0xc1));var _0x9166=function(_0x19705e,_0x569e65){_0x19705e=_0x19705e-0x0;var _0x524bf2=_0x1669[_0x19705e];return _0x524bf2;};'use strict';var express=require('express');var router=express[_0x9166('0x0')]();var controller=require(_0x9166('0x1'));router[_0x9166('0x2')]('/',controller[_0x9166('0x3')]);router['post'](_0x9166('0x4'),controller['forgot']);router[_0x9166('0x2')](_0x9166('0x5'),controller[_0x9166('0x6')]);module[_0x9166('0x7')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 570a15e..6e80e2a 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 _0x97b1=['BOOLEAN','STRING'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x97b1,0xc7));var _0x197b=function(_0x1d04b5,_0x30792c){_0x1d04b5=_0x1d04b5-0x0;var _0x161342=_0x97b1[_0x1d04b5];return _0x161342;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x197b('0x0')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x197b('0x1')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0x0406=['INTEGER','exports','STRING','BOOLEAN'];(function(_0x2fe281,_0x33621f){var _0x57aaf1=function(_0x328e7e){while(--_0x328e7e){_0x2fe281['push'](_0x2fe281['shift']());}};_0x57aaf1(++_0x33621f);}(_0x0406,0x10d));var _0x6040=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0406[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x6040('0x0')]={'name':{'type':Sequelize[_0x6040('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x6040('0x1')]},'description':{'type':Sequelize[_0x6040('0x1')]},'status':{'type':Sequelize[_0x6040('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x6040('0x3')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 50ce58d..19e86eb 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 _0x7be2=['undefined','count','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','Automation','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','find','create','body','addConditions','Condition','ids','omit','getConditions','findOne','addActions','Action','getActions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','limit'];(function(_0x5efb9e,_0x47e288){var _0x571f58=function(_0x3f6a8){while(--_0x3f6a8){_0x5efb9e['push'](_0x5efb9e['shift']());}};_0x571f58(++_0x47e288);}(_0x7be2,0x88));var _0x27be=function(_0xf48e32,_0x5193b1){_0xf48e32=_0xf48e32-0x0;var _0x65b3a4=_0x7be2[_0xf48e32];return _0x65b3a4;};'use strict';var emlformat=require(_0x27be('0x0'));var rimraf=require(_0x27be('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x27be('0x2'));var rp=require(_0x27be('0x3'));var moment=require(_0x27be('0x4'));var BPromise=require(_0x27be('0x5'));var Mustache=require(_0x27be('0x6'));var util=require(_0x27be('0x7'));var path=require(_0x27be('0x8'));var sox=require(_0x27be('0x9'));var csv=require(_0x27be('0xa'));var ejs=require(_0x27be('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x27be('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x27be('0xd'));var deskjs=require(_0x27be('0xe'));var toCsv=require(_0x27be('0xa'));var querystring=require(_0x27be('0xf'));var Papa=require('papaparse');var Redis=require(_0x27be('0x10'));var authService=require(_0x27be('0x11'));var qs=require(_0x27be('0x12'));var as=require(_0x27be('0x13'));var hardwareService=require(_0x27be('0x14'));var logger=require(_0x27be('0x15'))(_0x27be('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x27be('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x265070,_0x4c0572){_0x4c0572=_0x4c0572||0xcc;return function(_0x495900){if(_0x495900){return _0x265070[_0x27be('0x18')](_0x4c0572);}return _0x265070[_0x27be('0x19')](_0x4c0572)[_0x27be('0x1a')]();};}function respondWithResult(_0x5cdcfe,_0x25bc1b){_0x25bc1b=_0x25bc1b||0xc8;return function(_0x128a95){if(_0x128a95){return _0x5cdcfe['status'](_0x25bc1b)[_0x27be('0x1b')](_0x128a95);}};}function respondWithFilteredResult(_0x39d791,_0x33c6df){return function(_0x1dfbdb){if(_0x1dfbdb){var _0x433248=typeof _0x33c6df[_0x27be('0x1c')]==='undefined'&&typeof _0x33c6df[_0x27be('0x1d')]===_0x27be('0x1e');var _0x29a72d=_0x1dfbdb[_0x27be('0x1f')];var _0x4235c4=_0x433248?0x0:_0x33c6df[_0x27be('0x1c')];var _0x26c4e1=_0x433248?_0x1dfbdb['count']:_0x33c6df[_0x27be('0x1c')]+_0x33c6df[_0x27be('0x1d')];var _0x1f9b91;if(_0x26c4e1>=_0x29a72d){_0x26c4e1=_0x29a72d;_0x1f9b91=0xc8;}else{_0x1f9b91=0xce;}_0x39d791['status'](_0x1f9b91);return _0x39d791['set'](_0x27be('0x20'),_0x4235c4+'-'+_0x26c4e1+'/'+_0x29a72d)[_0x27be('0x1b')](_0x1dfbdb);}return null;};}function patchUpdates(_0x2d338b){return function(_0x39ab51){try{jsonpatch[_0x27be('0x21')](_0x39ab51,_0x2d338b,!![]);}catch(_0x3d050d){return BPromise[_0x27be('0x22')](_0x3d050d);}return _0x39ab51['save']();};}function saveUpdates(_0x14fb19,_0x1a34d7){return function(_0x517cad){if(_0x517cad){return _0x517cad['update'](_0x14fb19)[_0x27be('0x23')](function(_0x402673){return _0x402673;});}return null;};}function removeEntity(_0x240de6,_0x5491e4){return function(_0x557c1){if(_0x557c1){return _0x557c1[_0x27be('0x24')]()['then'](function(){_0x240de6[_0x27be('0x19')](0xcc)[_0x27be('0x1a')]();});}};}function handleEntityNotFound(_0x158e07,_0x31ef0f){return function(_0x33c831){if(!_0x33c831){_0x158e07[_0x27be('0x18')](0x194);}return _0x33c831;};}function handleError(_0x3bacb9,_0x39d101){_0x39d101=_0x39d101||0x1f4;return function(_0x1e2c86){logger[_0x27be('0x25')](_0x1e2c86[_0x27be('0x26')]);if(_0x1e2c86[_0x27be('0x27')]){delete _0x1e2c86['name'];}_0x3bacb9[_0x27be('0x19')](_0x39d101)[_0x27be('0x28')](_0x1e2c86);};}exports[_0x27be('0x29')]=function(_0x4ce74e,_0x169a5b){var _0x124aee={},_0x222a1c={},_0x133685={'count':0x0,'rows':[]};var _0x244361=_[_0x27be('0x2a')](db[_0x27be('0x2b')][_0x27be('0x2c')],function(_0x410798){return{'name':_0x410798[_0x27be('0x2d')],'type':_0x410798[_0x27be('0x2e')][_0x27be('0x2f')]};});_0x222a1c[_0x27be('0x30')]=_[_0x27be('0x2a')](_0x244361,_0x27be('0x27'));_0x222a1c[_0x27be('0x31')]=_[_0x27be('0x32')](_0x4ce74e['query']);_0x222a1c[_0x27be('0x33')]=_[_0x27be('0x34')](_0x222a1c[_0x27be('0x30')],_0x222a1c['query']);_0x124aee['attributes']=_[_0x27be('0x34')](_0x222a1c[_0x27be('0x30')],qs['fields'](_0x4ce74e[_0x27be('0x31')][_0x27be('0x35')]));_0x124aee['attributes']=_0x124aee[_0x27be('0x36')][_0x27be('0x37')]?_0x124aee[_0x27be('0x36')]:_0x222a1c[_0x27be('0x30')];if(!_0x4ce74e[_0x27be('0x31')][_0x27be('0x38')](_0x27be('0x39'))){_0x124aee[_0x27be('0x1d')]=qs[_0x27be('0x1d')](_0x4ce74e[_0x27be('0x31')][_0x27be('0x1d')]);_0x124aee[_0x27be('0x1c')]=qs[_0x27be('0x1c')](_0x4ce74e[_0x27be('0x31')][_0x27be('0x1c')]);}_0x124aee[_0x27be('0x3a')]=qs[_0x27be('0x3b')](_0x4ce74e[_0x27be('0x31')][_0x27be('0x3b')]);_0x124aee[_0x27be('0x3c')]=qs[_0x27be('0x33')](_[_0x27be('0x3d')](_0x4ce74e[_0x27be('0x31')],_0x222a1c[_0x27be('0x33')]),_0x244361);if(_0x4ce74e[_0x27be('0x31')][_0x27be('0x3e')]){_0x124aee[_0x27be('0x3c')]=_[_0x27be('0x3f')](_0x124aee[_0x27be('0x3c')],{'$or':_[_0x27be('0x2a')](_0x244361,function(_0x245523){if(_0x245523[_0x27be('0x2e')]!==_0x27be('0x40')){var _0x43c5a4={};_0x43c5a4[_0x245523[_0x27be('0x27')]]={'$like':'%'+_0x4ce74e['query']['filter']+'%'};return _0x43c5a4;}})});}_0x124aee=_[_0x27be('0x3f')]({},_0x124aee,_0x4ce74e[_0x27be('0x41')]);var _0x433349={'where':_0x124aee[_0x27be('0x3c')]};return db['Automation'][_0x27be('0x1f')](_0x433349)[_0x27be('0x23')](function(_0x3877f2){_0x133685['count']=_0x3877f2;if(_0x4ce74e[_0x27be('0x31')]['includeAll']){_0x124aee[_0x27be('0x42')]=[{'all':!![]}];}return db[_0x27be('0x2b')]['findAll'](_0x124aee);})[_0x27be('0x23')](function(_0x4192d9){_0x133685[_0x27be('0x43')]=_0x4192d9;return _0x133685;})[_0x27be('0x23')](respondWithFilteredResult(_0x169a5b,_0x124aee))[_0x27be('0x44')](handleError(_0x169a5b,null));};exports[_0x27be('0x45')]=function(_0x508ccc,_0x4fd789){var _0x4b620c={'raw':![],'where':{'id':_0x508ccc[_0x27be('0x46')]['id']}},_0x48fc17={};_0x48fc17['model']=_['keys'](db[_0x27be('0x2b')][_0x27be('0x2c')]);_0x48fc17[_0x27be('0x31')]=_[_0x27be('0x32')](_0x508ccc[_0x27be('0x31')]);_0x48fc17[_0x27be('0x33')]=_[_0x27be('0x34')](_0x48fc17[_0x27be('0x30')],_0x48fc17[_0x27be('0x31')]);_0x4b620c['attributes']=_[_0x27be('0x34')](_0x48fc17['model'],qs[_0x27be('0x35')](_0x508ccc['query'][_0x27be('0x35')]));_0x4b620c[_0x27be('0x36')]=_0x4b620c[_0x27be('0x36')][_0x27be('0x37')]?_0x4b620c[_0x27be('0x36')]:_0x48fc17[_0x27be('0x30')];if(_0x508ccc[_0x27be('0x31')]['includeAll']){_0x4b620c['include']=[{'all':!![]}];}_0x4b620c=_[_0x27be('0x3f')]({},_0x4b620c,_0x508ccc['options']);return db['Automation'][_0x27be('0x47')](_0x4b620c)['then'](handleEntityNotFound(_0x4fd789,null))[_0x27be('0x23')](respondWithResult(_0x4fd789,null))[_0x27be('0x44')](handleError(_0x4fd789,null));};exports[_0x27be('0x48')]=function(_0xf5c824,_0x4b8e16){return db[_0x27be('0x2b')][_0x27be('0x48')](_0xf5c824[_0x27be('0x49')],{})[_0x27be('0x23')](respondWithResult(_0x4b8e16,0xc9))[_0x27be('0x44')](handleError(_0x4b8e16,null));};exports['update']=function(_0x525dbe,_0x15772a){if(_0x525dbe[_0x27be('0x49')]['id']){delete _0x525dbe['body']['id'];}return db['Automation']['find']({'where':{'id':_0x525dbe['params']['id']}})[_0x27be('0x23')](handleEntityNotFound(_0x15772a,null))[_0x27be('0x23')](saveUpdates(_0x525dbe[_0x27be('0x49')],null))[_0x27be('0x23')](respondWithResult(_0x15772a,null))[_0x27be('0x44')](handleError(_0x15772a,null));};exports['destroy']=function(_0x942b43,_0x309981){return db['Automation'][_0x27be('0x47')]({'where':{'id':_0x942b43['params']['id']}})[_0x27be('0x23')](handleEntityNotFound(_0x309981,null))['then'](removeEntity(_0x309981,null))[_0x27be('0x44')](handleError(_0x309981,null));};exports[_0x27be('0x4a')]=function(_0x3a5941,_0x598cc2,_0xcedc4a){return db[_0x27be('0x4b')]['find']({'where':{'id':_0x3a5941['params']['id']}})[_0x27be('0x23')](handleEntityNotFound(_0x598cc2,null))[_0x27be('0x23')](function(_0x293d4c){if(_0x293d4c){return _0x293d4c[_0x27be('0x4a')](_0x3a5941[_0x27be('0x49')][_0x27be('0x4c')],_[_0x27be('0x4d')](_0x3a5941['body'],[_0x27be('0x4c'),'id'])||{});}})[_0x27be('0x23')](respondWithResult(_0x598cc2,null))['catch'](handleError(_0x598cc2,null));};exports[_0x27be('0x4e')]=function(_0xde69e7,_0x265e62,_0x139559){var _0x114fd1={};var _0x19ab65={};var _0xec304;var _0x303134;return db[_0x27be('0x2b')][_0x27be('0x4f')]({'where':{'id':_0xde69e7['params']['id']}})[_0x27be('0x23')](handleEntityNotFound(_0x265e62,null))[_0x27be('0x23')](function(_0x2c844a){if(_0x2c844a){_0xec304=_0x2c844a;_0x19ab65[_0x27be('0x30')]=_[_0x27be('0x32')](db[_0x27be('0x4b')][_0x27be('0x2c')]);_0x19ab65[_0x27be('0x31')]=_[_0x27be('0x32')](_0xde69e7[_0x27be('0x31')]);_0x19ab65['filters']=_[_0x27be('0x34')](_0x19ab65[_0x27be('0x30')],_0x19ab65[_0x27be('0x31')]);_0x114fd1['attributes']=_[_0x27be('0x34')](_0x19ab65['model'],qs[_0x27be('0x35')](_0xde69e7[_0x27be('0x31')][_0x27be('0x35')]));_0x114fd1[_0x27be('0x36')]=_0x114fd1[_0x27be('0x36')][_0x27be('0x37')]?_0x114fd1[_0x27be('0x36')]:_0x19ab65['model'];_0x114fd1[_0x27be('0x3a')]=qs[_0x27be('0x3b')](_0xde69e7['query'][_0x27be('0x3b')]);_0x114fd1[_0x27be('0x3c')]=qs[_0x27be('0x33')](_[_0x27be('0x3d')](_0xde69e7[_0x27be('0x31')],_0x19ab65[_0x27be('0x33')]));if(_0xde69e7[_0x27be('0x31')][_0x27be('0x3e')]){_0x114fd1[_0x27be('0x3c')]=_[_0x27be('0x3f')](_0x114fd1['where'],{'$or':_['map'](_0x114fd1[_0x27be('0x36')],function(_0x1917ed){var _0x3f6913={};_0x3f6913[_0x1917ed]={'$like':'%'+_0xde69e7['query'][_0x27be('0x3e')]+'%'};return _0x3f6913;})});}_0x114fd1=_[_0x27be('0x3f')]({},_0x114fd1,_0xde69e7['options']);return _0xec304[_0x27be('0x4e')](_0x114fd1);}})[_0x27be('0x23')](function(_0x20a571){if(_0x20a571){_0x303134=_0x20a571[_0x27be('0x37')];if(!_0xde69e7[_0x27be('0x31')][_0x27be('0x38')]('nolimit')){_0x114fd1[_0x27be('0x1d')]=qs['limit'](_0xde69e7[_0x27be('0x31')]['limit']);_0x114fd1[_0x27be('0x1c')]=qs[_0x27be('0x1c')](_0xde69e7[_0x27be('0x31')][_0x27be('0x1c')]);}return _0xec304['getConditions'](_0x114fd1);}})[_0x27be('0x23')](function(_0x31701a){if(_0x31701a){return _0x31701a?{'count':_0x303134,'rows':_0x31701a}:null;}})[_0x27be('0x23')](respondWithResult(_0x265e62,null))[_0x27be('0x44')](handleError(_0x265e62,null));};exports[_0x27be('0x50')]=function(_0x3eb23a,_0x52b3c7,_0x1ac06d){return db[_0x27be('0x51')][_0x27be('0x47')]({'where':{'id':_0x3eb23a['params']['id']}})[_0x27be('0x23')](handleEntityNotFound(_0x52b3c7,null))['then'](function(_0x2b4de3){if(_0x2b4de3){return _0x2b4de3[_0x27be('0x50')](_0x3eb23a['body'][_0x27be('0x4c')],_[_0x27be('0x4d')](_0x3eb23a[_0x27be('0x49')],[_0x27be('0x4c'),'id'])||{});}})[_0x27be('0x23')](respondWithResult(_0x52b3c7,null))['catch'](handleError(_0x52b3c7,null));};exports[_0x27be('0x52')]=function(_0x4c5a9a,_0xac5ce5,_0x4dfdb0){var _0x59b7a0={};var _0x39fb00={};var _0x5da4dc;var _0x4a1ac0;return db[_0x27be('0x2b')]['findOne']({'where':{'id':_0x4c5a9a[_0x27be('0x46')]['id']}})[_0x27be('0x23')](handleEntityNotFound(_0xac5ce5,null))[_0x27be('0x23')](function(_0x4666e3){if(_0x4666e3){_0x5da4dc=_0x4666e3;_0x39fb00[_0x27be('0x30')]=_[_0x27be('0x32')](db[_0x27be('0x51')][_0x27be('0x2c')]);_0x39fb00[_0x27be('0x31')]=_[_0x27be('0x32')](_0x4c5a9a[_0x27be('0x31')]);_0x39fb00[_0x27be('0x33')]=_[_0x27be('0x34')](_0x39fb00[_0x27be('0x30')],_0x39fb00[_0x27be('0x31')]);_0x59b7a0[_0x27be('0x36')]=_['intersection'](_0x39fb00['model'],qs['fields'](_0x4c5a9a[_0x27be('0x31')][_0x27be('0x35')]));_0x59b7a0['attributes']=_0x59b7a0[_0x27be('0x36')][_0x27be('0x37')]?_0x59b7a0[_0x27be('0x36')]:_0x39fb00['model'];_0x59b7a0[_0x27be('0x3a')]=qs[_0x27be('0x3b')](_0x4c5a9a[_0x27be('0x31')][_0x27be('0x3b')]);_0x59b7a0[_0x27be('0x3c')]=qs[_0x27be('0x33')](_[_0x27be('0x3d')](_0x4c5a9a[_0x27be('0x31')],_0x39fb00[_0x27be('0x33')]));if(_0x4c5a9a['query'][_0x27be('0x3e')]){_0x59b7a0['where']=_[_0x27be('0x3f')](_0x59b7a0[_0x27be('0x3c')],{'$or':_[_0x27be('0x2a')](_0x59b7a0[_0x27be('0x36')],function(_0x5569fb){var _0x70efcc={};_0x70efcc[_0x5569fb]={'$like':'%'+_0x4c5a9a[_0x27be('0x31')]['filter']+'%'};return _0x70efcc;})});}_0x59b7a0=_[_0x27be('0x3f')]({},_0x59b7a0,_0x4c5a9a[_0x27be('0x41')]);return _0x5da4dc[_0x27be('0x52')](_0x59b7a0);}})[_0x27be('0x23')](function(_0x414059){if(_0x414059){_0x4a1ac0=_0x414059[_0x27be('0x37')];if(!_0x4c5a9a[_0x27be('0x31')][_0x27be('0x38')](_0x27be('0x39'))){_0x59b7a0[_0x27be('0x1d')]=qs[_0x27be('0x1d')](_0x4c5a9a[_0x27be('0x31')][_0x27be('0x1d')]);_0x59b7a0[_0x27be('0x1c')]=qs[_0x27be('0x1c')](_0x4c5a9a[_0x27be('0x31')]['offset']);}return _0x5da4dc[_0x27be('0x52')](_0x59b7a0);}})[_0x27be('0x23')](function(_0x1314ac){if(_0x1314ac){return _0x1314ac?{'count':_0x4a1ac0,'rows':_0x1314ac}:null;}})[_0x27be('0x23')](respondWithResult(_0xac5ce5,null))[_0x27be('0x44')](handleError(_0xac5ce5,null));}; \ No newline at end of file +var _0x66ab=['lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','send','index','Automation','rawAttributes','fieldName','type','key','map','name','query','keys','filters','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','params','intersection','find','create','body','Condition','addConditions','ids','omit','getConditions','findOne','order','options','hasOwnProperty','Action','getActions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x19b84f,_0x48765e){var _0x18067b=function(_0x1c69aa){while(--_0x1c69aa){_0x19b84f['push'](_0x19b84f['shift']());}};_0x18067b(++_0x48765e);}(_0x66ab,0x1a6));var _0xb66a=function(_0x38f9f6,_0x5c098d){_0x38f9f6=_0x38f9f6-0x0;var _0xadd317=_0x66ab[_0x38f9f6];return _0xadd317;};'use strict';var emlformat=require(_0xb66a('0x0'));var rimraf=require(_0xb66a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb66a('0x2'));var rp=require(_0xb66a('0x3'));var moment=require(_0xb66a('0x4'));var BPromise=require(_0xb66a('0x5'));var Mustache=require(_0xb66a('0x6'));var util=require(_0xb66a('0x7'));var path=require(_0xb66a('0x8'));var sox=require(_0xb66a('0x9'));var csv=require(_0xb66a('0xa'));var ejs=require(_0xb66a('0xb'));var fs=require('fs');var fs_extra=require(_0xb66a('0xc'));var _=require(_0xb66a('0xd'));var squel=require('squel');var crypto=require(_0xb66a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb66a('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb66a('0x10'));var Papa=require(_0xb66a('0x11'));var Redis=require('ioredis');var authService=require(_0xb66a('0x12'));var qs=require(_0xb66a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb66a('0x14'));var logger=require(_0xb66a('0x15'))(_0xb66a('0x16'));var utils=require(_0xb66a('0x17'));var config=require(_0xb66a('0x18'));var licenseUtil=require(_0xb66a('0x19'));var db=require(_0xb66a('0x1a'))['db'];function respondWithStatusCode(_0x2b477a,_0x716e36){_0x716e36=_0x716e36||0xcc;return function(_0xd02309){if(_0xd02309){return _0x2b477a[_0xb66a('0x1b')](_0x716e36);}return _0x2b477a[_0xb66a('0x1c')](_0x716e36)['end']();};}function respondWithResult(_0x4b749f,_0xf1ffd){_0xf1ffd=_0xf1ffd||0xc8;return function(_0x1158cf){if(_0x1158cf){return _0x4b749f[_0xb66a('0x1c')](_0xf1ffd)[_0xb66a('0x1d')](_0x1158cf);}};}function respondWithFilteredResult(_0x1e34d4,_0x4de134){return function(_0x332e8c){if(_0x332e8c){var _0x2cd70f=typeof _0x4de134['offset']===_0xb66a('0x1e')&&typeof _0x4de134['limit']===_0xb66a('0x1e');var _0x1c11ba=_0x332e8c[_0xb66a('0x1f')];var _0x56581a=_0x2cd70f?0x0:_0x4de134[_0xb66a('0x20')];var _0x20a723=_0x2cd70f?_0x332e8c[_0xb66a('0x1f')]:_0x4de134[_0xb66a('0x20')]+_0x4de134[_0xb66a('0x21')];var _0x38e9b7;if(_0x20a723>=_0x1c11ba){_0x20a723=_0x1c11ba;_0x38e9b7=0xc8;}else{_0x38e9b7=0xce;}_0x1e34d4[_0xb66a('0x1c')](_0x38e9b7);return _0x1e34d4['set'](_0xb66a('0x22'),_0x56581a+'-'+_0x20a723+'/'+_0x1c11ba)[_0xb66a('0x1d')](_0x332e8c);}return null;};}function patchUpdates(_0x185f2f){return function(_0x4e2047){try{jsonpatch[_0xb66a('0x23')](_0x4e2047,_0x185f2f,!![]);}catch(_0x5cb192){return BPromise[_0xb66a('0x24')](_0x5cb192);}return _0x4e2047[_0xb66a('0x25')]();};}function saveUpdates(_0x379e37,_0x4032f0){return function(_0x3f7115){if(_0x3f7115){return _0x3f7115[_0xb66a('0x26')](_0x379e37)[_0xb66a('0x27')](function(_0x2c97bb){return _0x2c97bb;});}return null;};}function removeEntity(_0x48c134,_0x4eb417){return function(_0x33c822){if(_0x33c822){return _0x33c822[_0xb66a('0x28')]()['then'](function(){_0x48c134[_0xb66a('0x1c')](0xcc)[_0xb66a('0x29')]();});}};}function handleEntityNotFound(_0x5a1b14,_0x173706){return function(_0x3cd961){if(!_0x3cd961){_0x5a1b14['sendStatus'](0x194);}return _0x3cd961;};}function handleError(_0x2fe9c7,_0x44c461){_0x44c461=_0x44c461||0x1f4;return function(_0x2b96c1){logger[_0xb66a('0x2a')](_0x2b96c1[_0xb66a('0x2b')]);if(_0x2b96c1['name']){delete _0x2b96c1['name'];}_0x2fe9c7['status'](_0x44c461)[_0xb66a('0x2c')](_0x2b96c1);};}exports[_0xb66a('0x2d')]=function(_0x573f09,_0x235a7e){var _0x471fb5={},_0xfdfaaa={},_0x208aa1={'count':0x0,'rows':[]};var _0x225407=_['map'](db[_0xb66a('0x2e')][_0xb66a('0x2f')],function(_0x122095){return{'name':_0x122095[_0xb66a('0x30')],'type':_0x122095[_0xb66a('0x31')][_0xb66a('0x32')]};});_0xfdfaaa['model']=_[_0xb66a('0x33')](_0x225407,_0xb66a('0x34'));_0xfdfaaa[_0xb66a('0x35')]=_[_0xb66a('0x36')](_0x573f09['query']);_0xfdfaaa[_0xb66a('0x37')]=_['intersection'](_0xfdfaaa[_0xb66a('0x38')],_0xfdfaaa[_0xb66a('0x35')]);_0x471fb5[_0xb66a('0x39')]=_['intersection'](_0xfdfaaa[_0xb66a('0x38')],qs[_0xb66a('0x3a')](_0x573f09[_0xb66a('0x35')][_0xb66a('0x3a')]));_0x471fb5[_0xb66a('0x39')]=_0x471fb5[_0xb66a('0x39')][_0xb66a('0x3b')]?_0x471fb5[_0xb66a('0x39')]:_0xfdfaaa[_0xb66a('0x38')];if(!_0x573f09[_0xb66a('0x35')]['hasOwnProperty'](_0xb66a('0x3c'))){_0x471fb5['limit']=qs[_0xb66a('0x21')](_0x573f09[_0xb66a('0x35')]['limit']);_0x471fb5['offset']=qs[_0xb66a('0x20')](_0x573f09[_0xb66a('0x35')][_0xb66a('0x20')]);}_0x471fb5['order']=qs[_0xb66a('0x3d')](_0x573f09[_0xb66a('0x35')][_0xb66a('0x3d')]);_0x471fb5[_0xb66a('0x3e')]=qs[_0xb66a('0x37')](_[_0xb66a('0x3f')](_0x573f09['query'],_0xfdfaaa[_0xb66a('0x37')]),_0x225407);if(_0x573f09['query'][_0xb66a('0x40')]){_0x471fb5[_0xb66a('0x3e')]=_[_0xb66a('0x41')](_0x471fb5['where'],{'$or':_[_0xb66a('0x33')](_0x225407,function(_0x3b00a0){if(_0x3b00a0[_0xb66a('0x31')]!=='VIRTUAL'){var _0x55dfd9={};_0x55dfd9[_0x3b00a0[_0xb66a('0x34')]]={'$like':'%'+_0x573f09[_0xb66a('0x35')][_0xb66a('0x40')]+'%'};return _0x55dfd9;}})});}_0x471fb5=_[_0xb66a('0x41')]({},_0x471fb5,_0x573f09['options']);var _0x113704={'where':_0x471fb5[_0xb66a('0x3e')]};return db[_0xb66a('0x2e')][_0xb66a('0x1f')](_0x113704)[_0xb66a('0x27')](function(_0x1d4eff){_0x208aa1['count']=_0x1d4eff;if(_0x573f09[_0xb66a('0x35')][_0xb66a('0x42')]){_0x471fb5[_0xb66a('0x43')]=[{'all':!![]}];}return db[_0xb66a('0x2e')][_0xb66a('0x44')](_0x471fb5);})['then'](function(_0x1d1b31){_0x208aa1[_0xb66a('0x45')]=_0x1d1b31;return _0x208aa1;})[_0xb66a('0x27')](respondWithFilteredResult(_0x235a7e,_0x471fb5))[_0xb66a('0x46')](handleError(_0x235a7e,null));};exports['show']=function(_0x3bb976,_0x47d618){var _0x4b7e71={'raw':![],'where':{'id':_0x3bb976[_0xb66a('0x47')]['id']}},_0x2607ef={};_0x2607ef[_0xb66a('0x38')]=_['keys'](db[_0xb66a('0x2e')]['rawAttributes']);_0x2607ef[_0xb66a('0x35')]=_[_0xb66a('0x36')](_0x3bb976[_0xb66a('0x35')]);_0x2607ef['filters']=_[_0xb66a('0x48')](_0x2607ef[_0xb66a('0x38')],_0x2607ef[_0xb66a('0x35')]);_0x4b7e71[_0xb66a('0x39')]=_['intersection'](_0x2607ef[_0xb66a('0x38')],qs[_0xb66a('0x3a')](_0x3bb976[_0xb66a('0x35')][_0xb66a('0x3a')]));_0x4b7e71[_0xb66a('0x39')]=_0x4b7e71[_0xb66a('0x39')][_0xb66a('0x3b')]?_0x4b7e71[_0xb66a('0x39')]:_0x2607ef['model'];if(_0x3bb976['query'][_0xb66a('0x42')]){_0x4b7e71[_0xb66a('0x43')]=[{'all':!![]}];}_0x4b7e71=_['merge']({},_0x4b7e71,_0x3bb976['options']);return db[_0xb66a('0x2e')][_0xb66a('0x49')](_0x4b7e71)[_0xb66a('0x27')](handleEntityNotFound(_0x47d618,null))[_0xb66a('0x27')](respondWithResult(_0x47d618,null))['catch'](handleError(_0x47d618,null));};exports[_0xb66a('0x4a')]=function(_0x601157,_0x2eba6c){return db[_0xb66a('0x2e')][_0xb66a('0x4a')](_0x601157[_0xb66a('0x4b')],{})[_0xb66a('0x27')](respondWithResult(_0x2eba6c,0xc9))[_0xb66a('0x46')](handleError(_0x2eba6c,null));};exports[_0xb66a('0x26')]=function(_0x3b0d7a,_0x86990){if(_0x3b0d7a[_0xb66a('0x4b')]['id']){delete _0x3b0d7a[_0xb66a('0x4b')]['id'];}return db[_0xb66a('0x2e')][_0xb66a('0x49')]({'where':{'id':_0x3b0d7a[_0xb66a('0x47')]['id']}})[_0xb66a('0x27')](handleEntityNotFound(_0x86990,null))[_0xb66a('0x27')](saveUpdates(_0x3b0d7a[_0xb66a('0x4b')],null))[_0xb66a('0x27')](respondWithResult(_0x86990,null))[_0xb66a('0x46')](handleError(_0x86990,null));};exports[_0xb66a('0x28')]=function(_0x1d81e1,_0x48031a){return db['Automation']['find']({'where':{'id':_0x1d81e1[_0xb66a('0x47')]['id']}})[_0xb66a('0x27')](handleEntityNotFound(_0x48031a,null))[_0xb66a('0x27')](removeEntity(_0x48031a,null))['catch'](handleError(_0x48031a,null));};exports['addConditions']=function(_0x926910,_0xb77cd3,_0x353e72){return db[_0xb66a('0x4c')][_0xb66a('0x49')]({'where':{'id':_0x926910[_0xb66a('0x47')]['id']}})[_0xb66a('0x27')](handleEntityNotFound(_0xb77cd3,null))[_0xb66a('0x27')](function(_0x1a75b6){if(_0x1a75b6){return _0x1a75b6[_0xb66a('0x4d')](_0x926910['body'][_0xb66a('0x4e')],_[_0xb66a('0x4f')](_0x926910[_0xb66a('0x4b')],[_0xb66a('0x4e'),'id'])||{});}})[_0xb66a('0x27')](respondWithResult(_0xb77cd3,null))[_0xb66a('0x46')](handleError(_0xb77cd3,null));};exports[_0xb66a('0x50')]=function(_0x3c6299,_0x46ba37,_0x43f975){var _0x565ff8={};var _0x3a8f8e={};var _0x247f1f;var _0x238b9f;return db['Automation'][_0xb66a('0x51')]({'where':{'id':_0x3c6299['params']['id']}})['then'](handleEntityNotFound(_0x46ba37,null))[_0xb66a('0x27')](function(_0x4a49e3){if(_0x4a49e3){_0x247f1f=_0x4a49e3;_0x3a8f8e[_0xb66a('0x38')]=_[_0xb66a('0x36')](db[_0xb66a('0x4c')][_0xb66a('0x2f')]);_0x3a8f8e[_0xb66a('0x35')]=_[_0xb66a('0x36')](_0x3c6299[_0xb66a('0x35')]);_0x3a8f8e[_0xb66a('0x37')]=_[_0xb66a('0x48')](_0x3a8f8e[_0xb66a('0x38')],_0x3a8f8e[_0xb66a('0x35')]);_0x565ff8[_0xb66a('0x39')]=_['intersection'](_0x3a8f8e[_0xb66a('0x38')],qs['fields'](_0x3c6299['query']['fields']));_0x565ff8['attributes']=_0x565ff8[_0xb66a('0x39')][_0xb66a('0x3b')]?_0x565ff8[_0xb66a('0x39')]:_0x3a8f8e[_0xb66a('0x38')];_0x565ff8[_0xb66a('0x52')]=qs[_0xb66a('0x3d')](_0x3c6299['query'][_0xb66a('0x3d')]);_0x565ff8[_0xb66a('0x3e')]=qs['filters'](_[_0xb66a('0x3f')](_0x3c6299[_0xb66a('0x35')],_0x3a8f8e[_0xb66a('0x37')]));if(_0x3c6299[_0xb66a('0x35')][_0xb66a('0x40')]){_0x565ff8[_0xb66a('0x3e')]=_[_0xb66a('0x41')](_0x565ff8[_0xb66a('0x3e')],{'$or':_[_0xb66a('0x33')](_0x565ff8[_0xb66a('0x39')],function(_0x7640cc){var _0x2ca086={};_0x2ca086[_0x7640cc]={'$like':'%'+_0x3c6299[_0xb66a('0x35')]['filter']+'%'};return _0x2ca086;})});}_0x565ff8=_[_0xb66a('0x41')]({},_0x565ff8,_0x3c6299[_0xb66a('0x53')]);return _0x247f1f['getConditions'](_0x565ff8);}})[_0xb66a('0x27')](function(_0x132655){if(_0x132655){_0x238b9f=_0x132655[_0xb66a('0x3b')];if(!_0x3c6299['query'][_0xb66a('0x54')](_0xb66a('0x3c'))){_0x565ff8[_0xb66a('0x21')]=qs[_0xb66a('0x21')](_0x3c6299[_0xb66a('0x35')][_0xb66a('0x21')]);_0x565ff8[_0xb66a('0x20')]=qs[_0xb66a('0x20')](_0x3c6299[_0xb66a('0x35')]['offset']);}return _0x247f1f[_0xb66a('0x50')](_0x565ff8);}})['then'](function(_0x336316){if(_0x336316){return _0x336316?{'count':_0x238b9f,'rows':_0x336316}:null;}})[_0xb66a('0x27')](respondWithResult(_0x46ba37,null))[_0xb66a('0x46')](handleError(_0x46ba37,null));};exports['addActions']=function(_0x40cdfb,_0x568117,_0x3e7378){return db[_0xb66a('0x55')][_0xb66a('0x49')]({'where':{'id':_0x40cdfb['params']['id']}})[_0xb66a('0x27')](handleEntityNotFound(_0x568117,null))[_0xb66a('0x27')](function(_0x573c4c){if(_0x573c4c){return _0x573c4c['addActions'](_0x40cdfb[_0xb66a('0x4b')][_0xb66a('0x4e')],_[_0xb66a('0x4f')](_0x40cdfb['body'],[_0xb66a('0x4e'),'id'])||{});}})[_0xb66a('0x27')](respondWithResult(_0x568117,null))[_0xb66a('0x46')](handleError(_0x568117,null));};exports[_0xb66a('0x56')]=function(_0x214845,_0x4ccbfe,_0x533191){var _0x2fb38c={};var _0x3ceb4b={};var _0x5a5ff3;var _0x426ffe;return db['Automation'][_0xb66a('0x51')]({'where':{'id':_0x214845['params']['id']}})[_0xb66a('0x27')](handleEntityNotFound(_0x4ccbfe,null))[_0xb66a('0x27')](function(_0x4278e0){if(_0x4278e0){_0x5a5ff3=_0x4278e0;_0x3ceb4b['model']=_[_0xb66a('0x36')](db[_0xb66a('0x55')][_0xb66a('0x2f')]);_0x3ceb4b['query']=_[_0xb66a('0x36')](_0x214845['query']);_0x3ceb4b[_0xb66a('0x37')]=_[_0xb66a('0x48')](_0x3ceb4b['model'],_0x3ceb4b[_0xb66a('0x35')]);_0x2fb38c[_0xb66a('0x39')]=_['intersection'](_0x3ceb4b[_0xb66a('0x38')],qs[_0xb66a('0x3a')](_0x214845[_0xb66a('0x35')][_0xb66a('0x3a')]));_0x2fb38c['attributes']=_0x2fb38c[_0xb66a('0x39')]['length']?_0x2fb38c['attributes']:_0x3ceb4b[_0xb66a('0x38')];_0x2fb38c[_0xb66a('0x52')]=qs[_0xb66a('0x3d')](_0x214845[_0xb66a('0x35')][_0xb66a('0x3d')]);_0x2fb38c[_0xb66a('0x3e')]=qs['filters'](_[_0xb66a('0x3f')](_0x214845[_0xb66a('0x35')],_0x3ceb4b['filters']));if(_0x214845[_0xb66a('0x35')]['filter']){_0x2fb38c['where']=_[_0xb66a('0x41')](_0x2fb38c[_0xb66a('0x3e')],{'$or':_[_0xb66a('0x33')](_0x2fb38c['attributes'],function(_0x369b28){var _0x25d1a1={};_0x25d1a1[_0x369b28]={'$like':'%'+_0x214845[_0xb66a('0x35')][_0xb66a('0x40')]+'%'};return _0x25d1a1;})});}_0x2fb38c=_[_0xb66a('0x41')]({},_0x2fb38c,_0x214845[_0xb66a('0x53')]);return _0x5a5ff3[_0xb66a('0x56')](_0x2fb38c);}})[_0xb66a('0x27')](function(_0x1e9366){if(_0x1e9366){_0x426ffe=_0x1e9366['length'];if(!_0x214845[_0xb66a('0x35')][_0xb66a('0x54')]('nolimit')){_0x2fb38c[_0xb66a('0x21')]=qs[_0xb66a('0x21')](_0x214845['query']['limit']);_0x2fb38c[_0xb66a('0x20')]=qs[_0xb66a('0x20')](_0x214845['query']['offset']);}return _0x5a5ff3['getActions'](_0x2fb38c);}})[_0xb66a('0x27')](function(_0x14b08d){if(_0x14b08d){return _0x14b08d?{'count':_0x426ffe,'rows':_0x14b08d}:null;}})[_0xb66a('0x27')](respondWithResult(_0x4ccbfe,null))[_0xb66a('0x46')](handleError(_0x4ccbfe,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index a9fe272..9c44f42 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 _0x2e91=['define','Automation','tools_automations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports'];(function(_0x3802d0,_0x29c2f3){var _0x50819b=function(_0x2fa706){while(--_0x2fa706){_0x3802d0['push'](_0x3802d0['shift']());}};_0x50819b(++_0x29c2f3);}(_0x2e91,0x1df));var _0x12e9=function(_0x4bbc3d,_0x2826da){_0x4bbc3d=_0x4bbc3d-0x0;var _0x568ee1=_0x2e91[_0x4bbc3d];return _0x568ee1;};'use strict';var _=require(_0x12e9('0x0'));var util=require(_0x12e9('0x1'));var logger=require(_0x12e9('0x2'))(_0x12e9('0x3'));var moment=require('moment');var BPromise=require(_0x12e9('0x4'));var rp=require(_0x12e9('0x5'));var fs=require('fs');var path=require(_0x12e9('0x6'));var rimraf=require(_0x12e9('0x7'));var config=require(_0x12e9('0x8'));var attributes=require(_0x12e9('0x9'));module[_0x12e9('0xa')]=function(_0x147c11,_0x244213){return _0x147c11[_0x12e9('0xb')](_0x12e9('0xc'),attributes,{'tableName':_0x12e9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x00fa=['rimraf','../../config/environment','exports','define','Automation','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x31a266,_0x4bde2f){var _0x402ae9=function(_0x586e2d){while(--_0x586e2d){_0x31a266['push'](_0x31a266['shift']());}};_0x402ae9(++_0x4bde2f);}(_0x00fa,0xd5));var _0xa00f=function(_0xcfe954,_0x4cb77a){_0xcfe954=_0xcfe954-0x0;var _0x158407=_0x00fa[_0xcfe954];return _0x158407;};'use strict';var _=require(_0xa00f('0x0'));var util=require(_0xa00f('0x1'));var logger=require(_0xa00f('0x2'))(_0xa00f('0x3'));var moment=require(_0xa00f('0x4'));var BPromise=require(_0xa00f('0x5'));var rp=require(_0xa00f('0x6'));var fs=require('fs');var path=require(_0xa00f('0x7'));var rimraf=require(_0xa00f('0x8'));var config=require(_0xa00f('0x9'));var attributes=require('./automation.attributes');module[_0xa00f('0xa')]=function(_0x188634,_0x34a36c){return _0x188634[_0xa00f('0xb')](_0xa00f('0xc'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 208f8cf..063bc1d 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 _0xbee0=['http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client'];(function(_0x366388,_0x4595a6){var _0x41c97e=function(_0x4b9fff){while(--_0x4b9fff){_0x366388['push'](_0x366388['shift']());}};_0x41c97e(++_0x4595a6);}(_0xbee0,0x147));var _0x0bee=function(_0xd93012,_0x2cdc56){_0xd93012=_0xd93012-0x0;var _0x33006c=_0xbee0[_0xd93012];return _0x33006c;};'use strict';var _=require('lodash');var util=require(_0x0bee('0x0'));var moment=require(_0x0bee('0x1'));var BPromise=require(_0x0bee('0x2'));var rs=require(_0x0bee('0x3'));var fs=require('fs');var Redis=require(_0x0bee('0x4'));var db=require(_0x0bee('0x5'))['db'];var utils=require(_0x0bee('0x6'));var logger=require(_0x0bee('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0bee('0x8')][_0x0bee('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e499b,_0x430f89,_0x498d63){return new BPromise(function(_0x163a08,_0x123424){return client[_0x0bee('0xa')](_0x3e499b,_0x498d63)[_0x0bee('0xb')](function(_0x53a9af){logger[_0x0bee('0xc')](_0x0bee('0xd'),_0x430f89,_0x0bee('0xe'));logger[_0x0bee('0xf')](_0x0bee('0x10'),_0x430f89,_0x0bee('0xe'),JSON[_0x0bee('0x11')](_0x53a9af));if(_0x53a9af['error']){if(_0x53a9af[_0x0bee('0x12')]['code']===0x1f4){logger[_0x0bee('0x12')](_0x0bee('0xd'),_0x430f89,_0x53a9af[_0x0bee('0x12')][_0x0bee('0x13')]);return _0x123424(_0x53a9af[_0x0bee('0x12')][_0x0bee('0x13')]);}logger['error']('Automation,\x20%s,\x20%s',_0x430f89,_0x53a9af['error'][_0x0bee('0x13')]);return _0x163a08(_0x53a9af[_0x0bee('0x12')][_0x0bee('0x13')]);}else{logger[_0x0bee('0xc')]('Automation,\x20%s,\x20%s',_0x430f89,'request\x20sent');_0x163a08(_0x53a9af['result'][_0x0bee('0x13')]);}})[_0x0bee('0x14')](function(_0x50786a){logger[_0x0bee('0x12')](_0x0bee('0xd'),_0x430f89,_0x50786a);_0x123424(_0x50786a);});});} \ No newline at end of file +var _0xe785=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','bluebird','randomstring'];(function(_0x3bf831,_0x1690cb){var _0x5b17fb=function(_0x3d05f1){while(--_0x3d05f1){_0x3bf831['push'](_0x3bf831['shift']());}};_0x5b17fb(++_0x1690cb);}(_0xe785,0x128));var _0x5e78=function(_0x190329,_0x13293a){_0x190329=_0x190329-0x0;var _0x3e412a=_0xe785[_0x190329];return _0x3e412a;};'use strict';var _=require(_0x5e78('0x0'));var util=require(_0x5e78('0x1'));var moment=require('moment');var BPromise=require(_0x5e78('0x2'));var rs=require(_0x5e78('0x3'));var fs=require('fs');var Redis=require(_0x5e78('0x4'));var db=require(_0x5e78('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5e78('0x6'));var config=require(_0x5e78('0x7'));var jayson=require(_0x5e78('0x8'));var client=jayson[_0x5e78('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x525cfa,_0x1d32e7,_0x16cc23){return new BPromise(function(_0x441435,_0x5c7d82){return client[_0x5e78('0xa')](_0x525cfa,_0x16cc23)['then'](function(_0x5de5e){logger['info'](_0x5e78('0xb'),_0x1d32e7,_0x5e78('0xc'));logger['debug'](_0x5e78('0xd'),_0x1d32e7,_0x5e78('0xc'),JSON[_0x5e78('0xe')](_0x5de5e));if(_0x5de5e[_0x5e78('0xf')]){if(_0x5de5e[_0x5e78('0xf')][_0x5e78('0x10')]===0x1f4){logger[_0x5e78('0xf')]('Automation,\x20%s,\x20%s',_0x1d32e7,_0x5de5e[_0x5e78('0xf')][_0x5e78('0x11')]);return _0x5c7d82(_0x5de5e[_0x5e78('0xf')]['message']);}logger[_0x5e78('0xf')](_0x5e78('0xb'),_0x1d32e7,_0x5de5e[_0x5e78('0xf')][_0x5e78('0x11')]);return _0x441435(_0x5de5e['error'][_0x5e78('0x11')]);}else{logger[_0x5e78('0x12')](_0x5e78('0xb'),_0x1d32e7,_0x5e78('0xc'));_0x441435(_0x5de5e[_0x5e78('0x13')][_0x5e78('0x11')]);}})['catch'](function(_0x575201){logger[_0x5e78('0xf')](_0x5e78('0xb'),_0x1d32e7,_0x575201);_0x5c7d82(_0x575201);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 2ab06f6..420ff5d 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 _0xd737=['index','get','/:id','show','/:id/conditions','/:id/actions','getActions','create','post','addConditions','addActions','put','destroy','multer','path','express','Router','fs-extra','../../config/environment','isAuthenticated'];(function(_0x151913,_0x15fbbb){var _0x2edb3b=function(_0x5e17f2){while(--_0x5e17f2){_0x151913['push'](_0x151913['shift']());}};_0x2edb3b(++_0x15fbbb);}(_0xd737,0x85));var _0x7d73=function(_0x5ec3e2,_0x5294df){_0x5ec3e2=_0x5ec3e2-0x0;var _0x152654=_0xd737[_0x5ec3e2];return _0x152654;};'use strict';var multer=require(_0x7d73('0x0'));var util=require('util');var path=require(_0x7d73('0x1'));var timeout=require('connect-timeout');var express=require(_0x7d73('0x2'));var router=express[_0x7d73('0x3')]();var fs_extra=require(_0x7d73('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7d73('0x5'));var controller=require('./automation.controller');router['get']('/',auth[_0x7d73('0x6')](),controller[_0x7d73('0x7')]);router[_0x7d73('0x8')](_0x7d73('0x9'),auth[_0x7d73('0x6')](),controller[_0x7d73('0xa')]);router[_0x7d73('0x8')](_0x7d73('0xb'),auth['isAuthenticated'](),controller['getConditions']);router[_0x7d73('0x8')](_0x7d73('0xc'),auth['isAuthenticated'](),controller[_0x7d73('0xd')]);router['post']('/',auth[_0x7d73('0x6')](),controller[_0x7d73('0xe')]);router[_0x7d73('0xf')]('/:id/conditions',auth[_0x7d73('0x6')](),controller[_0x7d73('0x10')]);router['post'](_0x7d73('0xc'),auth[_0x7d73('0x6')](),controller[_0x7d73('0x11')]);router[_0x7d73('0x12')]('/:id',auth[_0x7d73('0x6')](),controller['update']);router['delete'](_0x7d73('0x9'),auth[_0x7d73('0x6')](),controller[_0x7d73('0x13')]);module['exports']=router; \ No newline at end of file +var _0xe131=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','/:id/actions','post','create','addConditions','addActions','update','destroy','exports','multer','util','express'];(function(_0x7538c5,_0xa5d8ac){var _0x8b56be=function(_0x2036c0){while(--_0x2036c0){_0x7538c5['push'](_0x7538c5['shift']());}};_0x8b56be(++_0xa5d8ac);}(_0xe131,0x1b5));var _0x1e13=function(_0x2361cf,_0x286f7f){_0x2361cf=_0x2361cf-0x0;var _0x3484ae=_0xe131[_0x2361cf];return _0x3484ae;};'use strict';var multer=require(_0x1e13('0x0'));var util=require(_0x1e13('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1e13('0x2'));var router=express['Router']();var fs_extra=require(_0x1e13('0x3'));var auth=require(_0x1e13('0x4'));var interaction=require(_0x1e13('0x5'));var config=require(_0x1e13('0x6'));var controller=require(_0x1e13('0x7'));router[_0x1e13('0x8')]('/',auth[_0x1e13('0x9')](),controller[_0x1e13('0xa')]);router[_0x1e13('0x8')](_0x1e13('0xb'),auth[_0x1e13('0x9')](),controller[_0x1e13('0xc')]);router[_0x1e13('0x8')](_0x1e13('0xd'),auth[_0x1e13('0x9')](),controller['getConditions']);router[_0x1e13('0x8')](_0x1e13('0xe'),auth['isAuthenticated'](),controller['getActions']);router[_0x1e13('0xf')]('/',auth[_0x1e13('0x9')](),controller[_0x1e13('0x10')]);router['post'](_0x1e13('0xd'),auth['isAuthenticated'](),controller[_0x1e13('0x11')]);router[_0x1e13('0xf')]('/:id/actions',auth[_0x1e13('0x9')](),controller[_0x1e13('0x12')]);router['put'](_0x1e13('0xb'),auth[_0x1e13('0x9')](),controller[_0x1e13('0x13')]);router['delete'](_0x1e13('0xb'),auth[_0x1e13('0x9')](),controller[_0x1e13('0x14')]);module[_0x1e13('0x15')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 7a1398b..36f619e 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 _0x8b71=['INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign'];(function(_0x20a590,_0x1e8a6d){var _0x2e1b41=function(_0x48359f){while(--_0x48359f){_0x20a590['push'](_0x20a590['shift']());}};_0x2e1b41(++_0x1e8a6d);}(_0x8b71,0x1c0));var _0x18b7=function(_0x2eb540,_0x1a49d9){_0x2eb540=_0x2eb540-0x0;var _0x1fc3e1=_0x8b71[_0x2eb540];return _0x1fc3e1;};'use strict';var Sequelize=require(_0x18b7('0x0'));module[_0x18b7('0x1')]={'name':{'type':Sequelize[_0x18b7('0x2')],'unique':_0x18b7('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x18b7('0x4')](_0x18b7('0x5')),'allowNull':![],'defaultValue':_0x18b7('0x5')},'description':{'type':Sequelize[_0x18b7('0x2')]},'active':{'type':Sequelize[_0x18b7('0x6')],'defaultValue':0x0,'comment':_0x18b7('0x7')},'limitCalls':{'type':Sequelize[_0x18b7('0x8')](0x4)[_0x18b7('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x18b7('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x18b7('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x18b7('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x18b7('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x18b7('0x8')](0x5)[_0x18b7('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x18b7('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0x18b7('0x8')](0x3)[_0x18b7('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x18b7('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0x18b7('0x8')](0x5)[_0x18b7('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x18b7('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x18b7('0xf')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x18b7('0x8')](0x5)[_0x18b7('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x18b7('0x8')](0x3)[_0x18b7('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x18b7('0x10')},'dialTimezone':{'type':Sequelize[_0x18b7('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x18b7('0x2')],'defaultValue':_0x18b7('0x11')},'dialCheckDuplicateType':{'type':Sequelize[_0x18b7('0x4')](_0x18b7('0x12'),'never','onlyIfOpen'),'defaultValue':_0x18b7('0x12')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x18b7('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0x18b7('0x8')](0x9)[_0x18b7('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x18b7('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x18b7('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x18b7('0x8')](0x9)[_0x18b7('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x18b7('0x8')](0x9)[_0x18b7('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x18b7('0x8')](0x9)[_0x18b7('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x18b7('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x18b7('0x8')](0x9)[_0x18b7('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x18b7('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x18b7('0x8')](0x9)[_0x18b7('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x18b7('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x18b7('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x18b7('0x8')](0x9)[_0x18b7('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x18b7('0x18')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x18b7('0x19'),_0x18b7('0x1a')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x18b7('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x18b7('0x8')](0x3)[_0x18b7('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x18b7('0x1b')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x18b7('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x18b7('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x18b7('0x8')](0x3)[_0x18b7('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x18b7('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x18b7('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x18b7('0x1e')},'dialDropMaxRetry':{'type':Sequelize[_0x18b7('0x8')](0x3)[_0x18b7('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x18b7('0x1f')},'dialDropRetryFrequency':{'type':Sequelize[_0x18b7('0x8')](0x5)[_0x18b7('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x18b7('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x18b7('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x18b7('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x18b7('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x18b7('0x22')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x18b7('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x18b7('0x23')},'dialMachineRetryFrequency':{'type':Sequelize[_0x18b7('0x8')](0x5)[_0x18b7('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x18b7('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x18b7('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x18b7('0x8')](0x5)[_0x18b7('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x18b7('0x25')}}; \ No newline at end of file +var _0xd04f=['#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence'];(function(_0x204fbf,_0x27e8ce){var _0x415a60=function(_0x70bd8e){while(--_0x70bd8e){_0x204fbf['push'](_0x204fbf['shift']());}};_0x415a60(++_0x27e8ce);}(_0xd04f,0x1d9));var _0xfd04=function(_0x358d63,_0x181330){_0x358d63=_0x358d63-0x0;var _0x10f0b1=_0xd04f[_0x358d63];return _0x10f0b1;};'use strict';var Sequelize=require(_0xfd04('0x0'));module[_0xfd04('0x1')]={'name':{'type':Sequelize[_0xfd04('0x2')],'unique':_0xfd04('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xfd04('0x4')](_0xfd04('0x5')),'allowNull':![],'defaultValue':_0xfd04('0x5')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xfd04('0x6')],'defaultValue':0x0,'comment':_0xfd04('0x7')},'limitCalls':{'type':Sequelize[_0xfd04('0x8')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0xfd04('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xfd04('0x8')](0x3)[_0xfd04('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xfd04('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfd04('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xfd04('0x8')](0x5)[_0xfd04('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfd04('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0xfd04('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xfd04('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfd04('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xfd04('0x8')](0x3)[_0xfd04('0x9')],'defaultValue':0x3,'comment':_0xfd04('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xfd04('0x8')](0x5)[_0xfd04('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfd04('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0xfd04('0x8')](0x3)[_0xfd04('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xfd04('0xf')},'dialTimezone':{'type':Sequelize[_0xfd04('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xfd04('0x2')],'defaultValue':_0xfd04('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0xfd04('0x4')](_0xfd04('0x11'),'never',_0xfd04('0x12')),'defaultValue':_0xfd04('0x11')},'dialAMDActive':{'type':Sequelize[_0xfd04('0x6')],'defaultValue':0x0,'comment':_0xfd04('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0xfd04('0x8')](0x9)[_0xfd04('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xfd04('0x14')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xfd04('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xfd04('0x8')](0x9)[_0xfd04('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xfd04('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xfd04('0x8')](0x9)[_0xfd04('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xfd04('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0xfd04('0x8')](0x9)[_0xfd04('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xfd04('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xfd04('0x8')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xfd04('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xfd04('0x8')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xfd04('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xfd04('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xfd04('0x1b'),_0xfd04('0x1c')),'defaultValue':_0xfd04('0x1b')},'dialPrefix':{'type':Sequelize[_0xfd04('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xfd04('0x8')](0x3)[_0xfd04('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xfd04('0x1d')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xfd04('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xfd04('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xfd04('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xfd04('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfd04('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0xfd04('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfd04('0x20')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xfd04('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfd04('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfd04('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xfd04('0x8')](0x5)[_0xfd04('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfd04('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0xfd04('0x8')](0x3)[_0xfd04('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfd04('0x24')},'dialMachineRetryFrequency':{'type':Sequelize[_0xfd04('0x8')](0x5)[_0xfd04('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfd04('0x25')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xfd04('0x8')](0x3)[_0xfd04('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xfd04('0x8')](0x5)[_0xfd04('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index e79ba8a..b9d4ea6 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 _0x4ded=['fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','intersection','find','create','body','user','role','IvrCampaigns','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','getHoppers','findOne','CampaignId','CmHopper','getHopperHistories','CmHopperHistory','hasOwnProperty','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','into','cm_hopper','phone','scheduledAt','ContactId','ListId','field','CmListId','toString','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','select','from','CampaignId\x20=\x20?','insert','fromQuery','NOW()','phone\x20IS\x20NOT\x20NULL','COALESCE(phone,\x27\x27)','cm_contacts','cmHopperId','OrderBy','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','sendStatus','status','end','offset','undefined','count','Content-Range','json','apply','reject','update','then','get','destroy','error','stack','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','filters','attributes'];(function(_0x10d4ad,_0x28b9cd){var _0x3aa8e2=function(_0x1ea08b){while(--_0x1ea08b){_0x10d4ad['push'](_0x10d4ad['shift']());}};_0x3aa8e2(++_0x28b9cd);}(_0x4ded,0xf3));var _0xd4de=function(_0x562014,_0x3047e9){_0x562014=_0x562014-0x0;var _0x32c351=_0x4ded[_0x562014];return _0x32c351;};'use strict';var emlformat=require(_0xd4de('0x0'));var rimraf=require(_0xd4de('0x1'));var zipdir=require(_0xd4de('0x2'));var jsonpatch=require(_0xd4de('0x3'));var rp=require(_0xd4de('0x4'));var moment=require(_0xd4de('0x5'));var BPromise=require(_0xd4de('0x6'));var Mustache=require(_0xd4de('0x7'));var util=require(_0xd4de('0x8'));var path=require('path');var sox=require(_0xd4de('0x9'));var csv=require(_0xd4de('0xa'));var ejs=require(_0xd4de('0xb'));var fs=require('fs');var fs_extra=require(_0xd4de('0xc'));var _=require(_0xd4de('0xd'));var squel=require('squel');var crypto=require(_0xd4de('0xe'));var jsforce=require(_0xd4de('0xf'));var deskjs=require(_0xd4de('0x10'));var toCsv=require(_0xd4de('0xa'));var querystring=require('querystring');var Papa=require(_0xd4de('0x11'));var Redis=require(_0xd4de('0x12'));var authService=require(_0xd4de('0x13'));var qs=require(_0xd4de('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd4de('0x15'));var logger=require(_0xd4de('0x16'))(_0xd4de('0x17'));var utils=require(_0xd4de('0x18'));var config=require(_0xd4de('0x19'));var licenseUtil=require(_0xd4de('0x1a'));var db=require(_0xd4de('0x1b'))['db'];function respondWithStatusCode(_0x2c4eb1,_0x49d204){_0x49d204=_0x49d204||0xcc;return function(_0x2415bf){if(_0x2415bf){return _0x2c4eb1[_0xd4de('0x1c')](_0x49d204);}return _0x2c4eb1[_0xd4de('0x1d')](_0x49d204)[_0xd4de('0x1e')]();};}function respondWithResult(_0x38e756,_0x2aa31b){_0x2aa31b=_0x2aa31b||0xc8;return function(_0x2a0c10){if(_0x2a0c10){return _0x38e756[_0xd4de('0x1d')](_0x2aa31b)['json'](_0x2a0c10);}};}function respondWithFilteredResult(_0x5b1740,_0x550f7f){return function(_0x529bcc){if(_0x529bcc){var _0x2def14=typeof _0x550f7f[_0xd4de('0x1f')]==='undefined'&&typeof _0x550f7f['limit']===_0xd4de('0x20');var _0x5f9076=_0x529bcc[_0xd4de('0x21')];var _0x33ecc1=_0x2def14?0x0:_0x550f7f[_0xd4de('0x1f')];var _0x3f5778=_0x2def14?_0x529bcc[_0xd4de('0x21')]:_0x550f7f['offset']+_0x550f7f['limit'];var _0x188207;if(_0x3f5778>=_0x5f9076){_0x3f5778=_0x5f9076;_0x188207=0xc8;}else{_0x188207=0xce;}_0x5b1740['status'](_0x188207);return _0x5b1740['set'](_0xd4de('0x22'),_0x33ecc1+'-'+_0x3f5778+'/'+_0x5f9076)[_0xd4de('0x23')](_0x529bcc);}return null;};}function patchUpdates(_0x29aa85){return function(_0x1903f3){try{jsonpatch[_0xd4de('0x24')](_0x1903f3,_0x29aa85,!![]);}catch(_0xe039f1){return BPromise[_0xd4de('0x25')](_0xe039f1);}return _0x1903f3['save']();};}function saveUpdates(_0x7a8370,_0xa93a8b){return function(_0x3967ee){if(_0x3967ee){return _0x3967ee[_0xd4de('0x26')](_0x7a8370)['then'](function(_0x2a416e){return _0x2a416e;});}return null;};}function removeEntity(_0x53a530,_0x414d4e){return function(_0x599543){if(_0x599543){return _0x599543['destroy']()[_0xd4de('0x27')](function(){var _0x3f18eb=_0x599543[_0xd4de('0x28')]({'plain':!![]});var _0x1d6b5c='IvrCampaigns';return db['UserProfileResource'][_0xd4de('0x29')]({'where':{'type':_0x1d6b5c,'resourceId':_0x3f18eb['id']}})[_0xd4de('0x27')](function(){return _0x599543;});})[_0xd4de('0x27')](function(){_0x53a530[_0xd4de('0x1d')](0xcc)[_0xd4de('0x1e')]();});}};}function handleEntityNotFound(_0x57dd25,_0x4e9ead){return function(_0x41be9b){if(!_0x41be9b){_0x57dd25[_0xd4de('0x1c')](0x194);}return _0x41be9b;};}function handleError(_0x2f4c9c,_0x29f5b1){_0x29f5b1=_0x29f5b1||0x1f4;return function(_0x5d6c4d){logger[_0xd4de('0x2a')](_0x5d6c4d[_0xd4de('0x2b')]);if(_0x5d6c4d[_0xd4de('0x2c')]){delete _0x5d6c4d[_0xd4de('0x2c')];}_0x2f4c9c[_0xd4de('0x1d')](_0x29f5b1)[_0xd4de('0x2d')](_0x5d6c4d);};}exports[_0xd4de('0x2e')]=function(_0x3da9b2,_0x3206d2){var _0x478815={},_0x1d76f0={},_0x286001={'count':0x0,'rows':[]};var _0x16e531=_[_0xd4de('0x2f')](db[_0xd4de('0x30')][_0xd4de('0x31')],function(_0x5d7ea4){return{'name':_0x5d7ea4[_0xd4de('0x32')],'type':_0x5d7ea4[_0xd4de('0x33')][_0xd4de('0x34')]};});_0x1d76f0[_0xd4de('0x35')]=_['map'](_0x16e531,'name');_0x1d76f0[_0xd4de('0x36')]=_['keys'](_0x3da9b2[_0xd4de('0x36')]);_0x1d76f0[_0xd4de('0x37')]=_['intersection'](_0x1d76f0[_0xd4de('0x35')],_0x1d76f0['query']);_0x478815[_0xd4de('0x38')]=_['intersection'](_0x1d76f0['model'],qs[_0xd4de('0x39')](_0x3da9b2[_0xd4de('0x36')][_0xd4de('0x39')]));_0x478815[_0xd4de('0x38')]=_0x478815[_0xd4de('0x38')][_0xd4de('0x3a')]?_0x478815[_0xd4de('0x38')]:_0x1d76f0['model'];if(!_0x3da9b2[_0xd4de('0x36')]['hasOwnProperty'](_0xd4de('0x3b'))){_0x478815[_0xd4de('0x3c')]=qs['limit'](_0x3da9b2['query'][_0xd4de('0x3c')]);_0x478815['offset']=qs[_0xd4de('0x1f')](_0x3da9b2[_0xd4de('0x36')][_0xd4de('0x1f')]);}_0x478815[_0xd4de('0x3d')]=qs['sort'](_0x3da9b2['query'][_0xd4de('0x3e')]);_0x478815[_0xd4de('0x3f')]=qs['filters'](_[_0xd4de('0x40')](_0x3da9b2[_0xd4de('0x36')],_0x1d76f0[_0xd4de('0x37')]),_0x16e531);if(_0x3da9b2['query'][_0xd4de('0x41')]){_0x478815[_0xd4de('0x3f')]=_[_0xd4de('0x42')](_0x478815[_0xd4de('0x3f')],{'$or':_[_0xd4de('0x2f')](_0x16e531,function(_0x3abecb){if(_0x3abecb[_0xd4de('0x33')]!==_0xd4de('0x43')){var _0x14d65c={};_0x14d65c[_0x3abecb[_0xd4de('0x2c')]]={'$like':'%'+_0x3da9b2['query'][_0xd4de('0x41')]+'%'};return _0x14d65c;}})});}_0x478815=_['merge']({},_0x478815,_0x3da9b2[_0xd4de('0x44')]);var _0x5db739={'where':_0x478815[_0xd4de('0x3f')]};return db[_0xd4de('0x30')][_0xd4de('0x21')](_0x5db739)['then'](function(_0x30d8ce){_0x286001[_0xd4de('0x21')]=_0x30d8ce;if(_0x3da9b2['query'][_0xd4de('0x45')]){_0x478815[_0xd4de('0x46')]=[{'all':!![]}];}return db[_0xd4de('0x30')][_0xd4de('0x47')](_0x478815);})[_0xd4de('0x27')](function(_0x3d38a0){_0x286001[_0xd4de('0x48')]=_0x3d38a0;return _0x286001;})[_0xd4de('0x27')](respondWithFilteredResult(_0x3206d2,_0x478815))['catch'](handleError(_0x3206d2,null));};exports[_0xd4de('0x49')]=function(_0x5e5450,_0x25e937){var _0x331cf2={'raw':![],'where':{'id':_0x5e5450[_0xd4de('0x4a')]['id']}},_0x3c1be5={};_0x3c1be5[_0xd4de('0x35')]=_[_0xd4de('0x4b')](db[_0xd4de('0x30')][_0xd4de('0x31')]);_0x3c1be5[_0xd4de('0x36')]=_[_0xd4de('0x4b')](_0x5e5450[_0xd4de('0x36')]);_0x3c1be5[_0xd4de('0x37')]=_[_0xd4de('0x4c')](_0x3c1be5['model'],_0x3c1be5[_0xd4de('0x36')]);_0x331cf2[_0xd4de('0x38')]=_[_0xd4de('0x4c')](_0x3c1be5[_0xd4de('0x35')],qs[_0xd4de('0x39')](_0x5e5450[_0xd4de('0x36')]['fields']));_0x331cf2[_0xd4de('0x38')]=_0x331cf2[_0xd4de('0x38')][_0xd4de('0x3a')]?_0x331cf2['attributes']:_0x3c1be5['model'];if(_0x5e5450['query']['includeAll']){_0x331cf2[_0xd4de('0x46')]=[{'all':!![]}];}_0x331cf2=_[_0xd4de('0x42')]({},_0x331cf2,_0x5e5450[_0xd4de('0x44')]);return db[_0xd4de('0x30')][_0xd4de('0x4d')](_0x331cf2)[_0xd4de('0x27')](handleEntityNotFound(_0x25e937,null))[_0xd4de('0x27')](respondWithResult(_0x25e937,null))['catch'](handleError(_0x25e937,null));};exports[_0xd4de('0x4e')]=function(_0x3ee7b2,_0x4393ee){return db[_0xd4de('0x30')][_0xd4de('0x4e')](_0x3ee7b2[_0xd4de('0x4f')],{})[_0xd4de('0x27')](function(_0x9e47f){var _0x431135=_0x3ee7b2[_0xd4de('0x50')][_0xd4de('0x28')]({'plain':!![]});if(!_0x431135)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x431135[_0xd4de('0x51')]===_0xd4de('0x50')){var _0x5b73f9=_0x9e47f['get']({'plain':!![]});var _0x20d5bd=_0xd4de('0x52');return db['UserProfileSection'][_0xd4de('0x4d')]({'where':{'name':_0x20d5bd,'userProfileId':_0x431135[_0xd4de('0x53')]},'raw':!![]})['then'](function(_0x141a16){if(_0x141a16&&_0x141a16[_0xd4de('0x54')]===0x0){return db[_0xd4de('0x55')][_0xd4de('0x4e')]({'name':_0x5b73f9[_0xd4de('0x2c')],'resourceId':_0x5b73f9['id'],'type':_0x141a16['name'],'sectionId':_0x141a16['id']},{})[_0xd4de('0x27')](function(){return _0x9e47f;});}else{return _0x9e47f;}})[_0xd4de('0x56')](function(_0x73f46b){logger[_0xd4de('0x2a')](_0xd4de('0x57'),_0x73f46b);throw _0x73f46b;});}return _0x9e47f;})[_0xd4de('0x27')](respondWithResult(_0x4393ee,0xc9))[_0xd4de('0x56')](handleError(_0x4393ee,null));};exports[_0xd4de('0x58')]=function(_0x247fc6,_0x14c66e){var _0x3e9038={'where':{'id':_0x247fc6[_0xd4de('0x4a')]['id']}},_0x5a907b={};_0x5a907b[_0xd4de('0x35')]=_[_0xd4de('0x4b')](db[_0xd4de('0x30')]['rawAttributes']);_0x3e9038[_0xd4de('0x38')]=_[_0xd4de('0x4c')](_0x5a907b[_0xd4de('0x35')],qs['fields'](_0x247fc6[_0xd4de('0x36')]['fields']));_0x3e9038[_0xd4de('0x38')]=_0x3e9038[_0xd4de('0x38')][_0xd4de('0x3a')]?_0x3e9038[_0xd4de('0x38')]:_0x5a907b[_0xd4de('0x35')];if(_0x247fc6[_0xd4de('0x36')]['includeAll']){_0x3e9038[_0xd4de('0x46')]=[{'all':!![]}];}_0x3e9038=_[_0xd4de('0x42')]({},_0x3e9038,_0x247fc6[_0xd4de('0x44')]);return db['Campaign'][_0xd4de('0x4d')](_0x3e9038)[_0xd4de('0x27')](handleEntityNotFound(_0x14c66e,null))[_0xd4de('0x27')](function(_0x442ab5){if(_0x442ab5){var _0x594d60=_0x442ab5['get']({'plain':!![]});_0x594d60=qs[_0xd4de('0x59')](_0x594d60,['id',_0xd4de('0x5a'),_0xd4de('0x5b')]);_0x247fc6[_0xd4de('0x4f')]=_[_0xd4de('0x59')](_0x247fc6[_0xd4de('0x4f')],['id',_0xd4de('0x5a'),'updatedAt']);return db['Campaign'][_0xd4de('0x4e')](_['merge'](_0x594d60,_0x247fc6['body']),{'include':_0x247fc6[_0xd4de('0x36')][_0xd4de('0x45')]?[{'all':!![]}]:undefined})[_0xd4de('0x27')](function(_0x291745){var _0x4ff238=_0x247fc6[_0xd4de('0x50')][_0xd4de('0x28')]({'plain':!![]});if(!_0x4ff238)throw new Error(_0xd4de('0x5c'));if(_0x4ff238[_0xd4de('0x51')]===_0xd4de('0x50')){var _0x1e206a=_0x291745[_0xd4de('0x28')]({'plain':!![]});var _0x53427f='IvrCampaigns';return db['UserProfileSection'][_0xd4de('0x4d')]({'where':{'name':_0x53427f,'userProfileId':_0x4ff238[_0xd4de('0x53')]},'raw':!![]})[_0xd4de('0x27')](function(_0x475272){if(_0x475272&&_0x475272[_0xd4de('0x54')]===0x0){return db['UserProfileResource'][_0xd4de('0x4e')]({'name':_0x1e206a['name'],'resourceId':_0x1e206a['id'],'type':_0x475272[_0xd4de('0x2c')],'sectionId':_0x475272['id']},{})[_0xd4de('0x27')](function(){return _0x291745;});}else{return _0x291745;}})[_0xd4de('0x56')](function(_0x4b6929){logger[_0xd4de('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4b6929);throw _0x4b6929;});}return _0x291745;});}})[_0xd4de('0x27')](respondWithResult(_0x14c66e,0xc9))['catch'](handleError(_0x14c66e,null));};exports[_0xd4de('0x26')]=function(_0x15071d,_0x16d7be){if(_0x15071d[_0xd4de('0x4f')]['id']){delete _0x15071d[_0xd4de('0x4f')]['id'];}return db[_0xd4de('0x30')]['find']({'where':{'id':_0x15071d[_0xd4de('0x4a')]['id']}})[_0xd4de('0x27')](handleEntityNotFound(_0x16d7be,null))[_0xd4de('0x27')](saveUpdates(_0x15071d['body'],null))['then'](respondWithResult(_0x16d7be,null))[_0xd4de('0x56')](handleError(_0x16d7be,null));};exports[_0xd4de('0x29')]=function(_0x247a5d,_0x7229cb){return db['Campaign'][_0xd4de('0x4d')]({'where':{'id':_0x247a5d[_0xd4de('0x4a')]['id']}})[_0xd4de('0x27')](handleEntityNotFound(_0x7229cb,null))[_0xd4de('0x27')](removeEntity(_0x7229cb,null))[_0xd4de('0x56')](handleError(_0x7229cb,null));};exports[_0xd4de('0x5d')]=function(_0x48f807,_0x4fad8b,_0x583504){var _0x2eb843={'raw':!![],'where':{}};var _0x58b39e={};var _0x2406b3={'count':0x0,'rows':[]};return db[_0xd4de('0x30')][_0xd4de('0x5e')]({'where':{'id':_0x48f807[_0xd4de('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4fad8b,null))[_0xd4de('0x27')](function(_0x22985f){if(_0x22985f){_0x58b39e[_0xd4de('0x35')]=_['keys'](db['CmHopper']['rawAttributes']);_0x58b39e[_0xd4de('0x36')]=_['keys'](_0x48f807[_0xd4de('0x36')]);_0x58b39e[_0xd4de('0x37')]=_[_0xd4de('0x4c')](_0x58b39e[_0xd4de('0x35')],_0x58b39e[_0xd4de('0x36')]);_0x2eb843['attributes']=_[_0xd4de('0x4c')](_0x58b39e['model'],qs[_0xd4de('0x39')](_0x48f807['query'][_0xd4de('0x39')]));_0x2eb843[_0xd4de('0x38')]=_0x2eb843[_0xd4de('0x38')][_0xd4de('0x3a')]?_0x2eb843[_0xd4de('0x38')]:_0x58b39e[_0xd4de('0x35')];if(!_0x48f807[_0xd4de('0x36')]['hasOwnProperty']('nolimit')){_0x2eb843[_0xd4de('0x3c')]=qs[_0xd4de('0x3c')](_0x48f807['query']['limit']);_0x2eb843[_0xd4de('0x1f')]=qs[_0xd4de('0x1f')](_0x48f807[_0xd4de('0x36')][_0xd4de('0x1f')]);}_0x2eb843[_0xd4de('0x3d')]=qs[_0xd4de('0x3e')](_0x48f807[_0xd4de('0x36')]['sort']);_0x2eb843[_0xd4de('0x3f')]=qs['filters'](_[_0xd4de('0x40')](_0x48f807['query'],_0x58b39e['filters']));_0x2eb843[_0xd4de('0x3f')][_0xd4de('0x5f')]=_0x22985f['id'];if(_0x48f807['query'][_0xd4de('0x41')]){_0x2eb843[_0xd4de('0x3f')]=_[_0xd4de('0x42')](_0x2eb843['where'],{'$or':_[_0xd4de('0x2f')](_0x2eb843[_0xd4de('0x38')],function(_0x215947){var _0x26457b={};_0x26457b[_0x215947]={'$like':'%'+_0x48f807[_0xd4de('0x36')][_0xd4de('0x41')]+'%'};return _0x26457b;})});}_0x2eb843=_[_0xd4de('0x42')]({},_0x2eb843,_0x48f807[_0xd4de('0x44')]);return db[_0xd4de('0x60')]['count']({'where':_0x2eb843[_0xd4de('0x3f')]})[_0xd4de('0x27')](function(_0x2910b7){_0x2406b3['count']=_0x2910b7;if(_0x48f807[_0xd4de('0x36')][_0xd4de('0x45')]){_0x2eb843[_0xd4de('0x46')]=[{'all':!![]}];}return db[_0xd4de('0x60')][_0xd4de('0x47')](_0x2eb843);})[_0xd4de('0x27')](function(_0x3cd5d4){_0x2406b3[_0xd4de('0x48')]=_0x3cd5d4;return _0x2406b3;});}})[_0xd4de('0x27')](respondWithFilteredResult(_0x4fad8b,_0x2eb843))[_0xd4de('0x56')](handleError(_0x4fad8b,null));};exports[_0xd4de('0x61')]=function(_0x3fb47c,_0x320507,_0x21694b){var _0x367349={'raw':!![],'where':{}};var _0x13d4b6={};var _0x414e83={'count':0x0,'rows':[]};return db[_0xd4de('0x30')][_0xd4de('0x5e')]({'where':{'id':_0x3fb47c[_0xd4de('0x4a')]['id']}})[_0xd4de('0x27')](handleEntityNotFound(_0x320507,null))[_0xd4de('0x27')](function(_0x240c98){if(_0x240c98){_0x13d4b6[_0xd4de('0x35')]=_[_0xd4de('0x4b')](db[_0xd4de('0x62')][_0xd4de('0x31')]);_0x13d4b6[_0xd4de('0x36')]=_['keys'](_0x3fb47c[_0xd4de('0x36')]);_0x13d4b6[_0xd4de('0x37')]=_['intersection'](_0x13d4b6['model'],_0x13d4b6['query']);_0x367349[_0xd4de('0x38')]=_[_0xd4de('0x4c')](_0x13d4b6[_0xd4de('0x35')],qs[_0xd4de('0x39')](_0x3fb47c['query'][_0xd4de('0x39')]));_0x367349['attributes']=_0x367349[_0xd4de('0x38')][_0xd4de('0x3a')]?_0x367349[_0xd4de('0x38')]:_0x13d4b6[_0xd4de('0x35')];if(!_0x3fb47c[_0xd4de('0x36')][_0xd4de('0x63')]('nolimit')){_0x367349['limit']=qs[_0xd4de('0x3c')](_0x3fb47c[_0xd4de('0x36')]['limit']);_0x367349[_0xd4de('0x1f')]=qs[_0xd4de('0x1f')](_0x3fb47c[_0xd4de('0x36')]['offset']);}_0x367349[_0xd4de('0x3d')]=qs[_0xd4de('0x3e')](_0x3fb47c[_0xd4de('0x36')]['sort']);_0x367349[_0xd4de('0x3f')]=qs['filters'](_[_0xd4de('0x40')](_0x3fb47c[_0xd4de('0x36')],_0x13d4b6[_0xd4de('0x37')]));_0x367349[_0xd4de('0x3f')][_0xd4de('0x5f')]=_0x240c98['id'];if(_0x3fb47c['query'][_0xd4de('0x41')]){_0x367349[_0xd4de('0x3f')]=_[_0xd4de('0x42')](_0x367349['where'],{'$or':_[_0xd4de('0x2f')](_0x367349[_0xd4de('0x38')],function(_0x274520){var _0x321277={};_0x321277[_0x274520]={'$like':'%'+_0x3fb47c[_0xd4de('0x36')][_0xd4de('0x41')]+'%'};return _0x321277;})});}_0x367349=_['merge']({},_0x367349,_0x3fb47c[_0xd4de('0x44')]);return db[_0xd4de('0x62')]['count']({'where':_0x367349[_0xd4de('0x3f')]})[_0xd4de('0x27')](function(_0x596bd0){_0x414e83['count']=_0x596bd0;if(_0x3fb47c[_0xd4de('0x36')][_0xd4de('0x45')]){_0x367349[_0xd4de('0x46')]=[{'all':!![]}];}return db[_0xd4de('0x62')][_0xd4de('0x47')](_0x367349);})['then'](function(_0x46a3cc){_0x414e83[_0xd4de('0x48')]=_0x46a3cc;return _0x414e83;});}})['then'](respondWithFilteredResult(_0x320507,_0x367349))[_0xd4de('0x56')](handleError(_0x320507,null));};exports[_0xd4de('0x64')]=function(_0xa55161,_0x16d68a,_0x34a724){var _0x44d955={'raw':!![],'where':{}};var _0x408a82={};var _0x5b6a66={'count':0x0,'rows':[]};return db[_0xd4de('0x30')][_0xd4de('0x5e')]({'where':{'id':_0xa55161['params']['id']}})[_0xd4de('0x27')](handleEntityNotFound(_0x16d68a,null))[_0xd4de('0x27')](function(_0x4cd51d){if(_0x4cd51d){_0x408a82[_0xd4de('0x35')]=_['keys'](db[_0xd4de('0x65')][_0xd4de('0x31')]);_0x408a82[_0xd4de('0x36')]=_[_0xd4de('0x4b')](_0xa55161[_0xd4de('0x36')]);_0x408a82['filters']=_[_0xd4de('0x4c')](_0x408a82['model'],_0x408a82['query']);_0x44d955['attributes']=_[_0xd4de('0x4c')](_0x408a82[_0xd4de('0x35')],qs[_0xd4de('0x39')](_0xa55161['query']['fields']));_0x44d955['attributes']=_0x44d955[_0xd4de('0x38')][_0xd4de('0x3a')]?_0x44d955[_0xd4de('0x38')]:_0x408a82[_0xd4de('0x35')];if(!_0xa55161[_0xd4de('0x36')][_0xd4de('0x63')](_0xd4de('0x3b'))){_0x44d955[_0xd4de('0x3c')]=qs[_0xd4de('0x3c')](_0xa55161[_0xd4de('0x36')][_0xd4de('0x3c')]);_0x44d955[_0xd4de('0x1f')]=qs[_0xd4de('0x1f')](_0xa55161[_0xd4de('0x36')][_0xd4de('0x1f')]);}_0x44d955[_0xd4de('0x3d')]=qs[_0xd4de('0x3e')](_0xa55161[_0xd4de('0x36')][_0xd4de('0x3e')]);_0x44d955[_0xd4de('0x3f')]=qs[_0xd4de('0x37')](_[_0xd4de('0x40')](_0xa55161[_0xd4de('0x36')],_0x408a82['filters']));_0x44d955['where'][_0xd4de('0x5f')]=_0x4cd51d['id'];if(_0xa55161[_0xd4de('0x36')][_0xd4de('0x41')]){_0x44d955[_0xd4de('0x3f')]=_['merge'](_0x44d955[_0xd4de('0x3f')],{'$or':_[_0xd4de('0x2f')](_0x44d955[_0xd4de('0x38')],function(_0x5e8ef3){var _0x254b45={};_0x254b45[_0x5e8ef3]={'$like':'%'+_0xa55161[_0xd4de('0x36')][_0xd4de('0x41')]+'%'};return _0x254b45;})});}_0x44d955=_[_0xd4de('0x42')]({},_0x44d955,_0xa55161['options']);return db[_0xd4de('0x65')][_0xd4de('0x21')]({'where':_0x44d955[_0xd4de('0x3f')]})[_0xd4de('0x27')](function(_0x4dfd52){_0x5b6a66['count']=_0x4dfd52;if(_0xa55161[_0xd4de('0x36')][_0xd4de('0x45')]){_0x44d955[_0xd4de('0x46')]=[{'all':!![]}];}return db[_0xd4de('0x65')][_0xd4de('0x47')](_0x44d955);})[_0xd4de('0x27')](function(_0x3432ca){_0x5b6a66['rows']=_0x3432ca;return _0x5b6a66;});}})[_0xd4de('0x27')](respondWithFilteredResult(_0x16d68a,_0x44d955))[_0xd4de('0x56')](handleError(_0x16d68a,null));};exports[_0xd4de('0x66')]=function(_0x1de576,_0x1323c3,_0x16d91e){var _0x3f7f64={'raw':!![],'where':{}};var _0x4fc6bf={};var _0x1764db={'count':0x0,'rows':[]};return db[_0xd4de('0x30')]['findOne']({'where':{'id':_0x1de576[_0xd4de('0x4a')]['id']}})[_0xd4de('0x27')](handleEntityNotFound(_0x1323c3,null))['then'](function(_0x154efe){if(_0x154efe){_0x4fc6bf[_0xd4de('0x35')]=_[_0xd4de('0x4b')](db[_0xd4de('0x67')]['rawAttributes']);_0x4fc6bf[_0xd4de('0x36')]=_[_0xd4de('0x4b')](_0x1de576[_0xd4de('0x36')]);_0x4fc6bf[_0xd4de('0x37')]=_['intersection'](_0x4fc6bf[_0xd4de('0x35')],_0x4fc6bf[_0xd4de('0x36')]);_0x3f7f64[_0xd4de('0x38')]=_[_0xd4de('0x4c')](_0x4fc6bf[_0xd4de('0x35')],qs[_0xd4de('0x39')](_0x1de576[_0xd4de('0x36')][_0xd4de('0x39')]));_0x3f7f64[_0xd4de('0x38')]=_0x3f7f64[_0xd4de('0x38')][_0xd4de('0x3a')]?_0x3f7f64[_0xd4de('0x38')]:_0x4fc6bf[_0xd4de('0x35')];if(!_0x1de576['query'][_0xd4de('0x63')]('nolimit')){_0x3f7f64[_0xd4de('0x3c')]=qs['limit'](_0x1de576[_0xd4de('0x36')][_0xd4de('0x3c')]);_0x3f7f64[_0xd4de('0x1f')]=qs[_0xd4de('0x1f')](_0x1de576['query']['offset']);}_0x3f7f64['order']=qs[_0xd4de('0x3e')](_0x1de576[_0xd4de('0x36')][_0xd4de('0x3e')]);_0x3f7f64['where']=qs[_0xd4de('0x37')](_[_0xd4de('0x40')](_0x1de576['query'],_0x4fc6bf['filters']));_0x3f7f64[_0xd4de('0x3f')][_0xd4de('0x5f')]=_0x154efe['id'];if(_0x1de576[_0xd4de('0x36')]['filter']){_0x3f7f64[_0xd4de('0x3f')]=_['merge'](_0x3f7f64[_0xd4de('0x3f')],{'$or':_['map'](_0x3f7f64['attributes'],function(_0x42f31b){var _0x3bd4be={};_0x3bd4be[_0x42f31b]={'$like':'%'+_0x1de576['query'][_0xd4de('0x41')]+'%'};return _0x3bd4be;})});}_0x3f7f64=_[_0xd4de('0x42')]({},_0x3f7f64,_0x1de576[_0xd4de('0x44')]);return db[_0xd4de('0x67')][_0xd4de('0x21')]({'where':_0x3f7f64[_0xd4de('0x3f')]})[_0xd4de('0x27')](function(_0x201322){_0x1764db[_0xd4de('0x21')]=_0x201322;if(_0x1de576[_0xd4de('0x36')][_0xd4de('0x45')]){_0x3f7f64[_0xd4de('0x46')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x3f7f64);})[_0xd4de('0x27')](function(_0x26a5cb){_0x1764db[_0xd4de('0x48')]=_0x26a5cb;return _0x1764db;});}})[_0xd4de('0x27')](respondWithFilteredResult(_0x1323c3,_0x3f7f64))[_0xd4de('0x56')](handleError(_0x1323c3,null));};exports[_0xd4de('0x68')]=function(_0x50e1bf,_0x4c31a7,_0x48640d){var _0x47439d={};var _0x5cb4ce={};var _0x2da6bc;var _0x3a08e8;return db[_0xd4de('0x30')][_0xd4de('0x5e')]({'where':{'id':_0x50e1bf[_0xd4de('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4c31a7,null))[_0xd4de('0x27')](function(_0x2f73c5){if(_0x2f73c5){_0x2da6bc=_0x2f73c5;_0x5cb4ce[_0xd4de('0x35')]=_[_0xd4de('0x4b')](db[_0xd4de('0x69')]['rawAttributes']);_0x5cb4ce[_0xd4de('0x36')]=_[_0xd4de('0x4b')](_0x50e1bf['query']);_0x5cb4ce['filters']=_[_0xd4de('0x4c')](_0x5cb4ce[_0xd4de('0x35')],_0x5cb4ce[_0xd4de('0x36')]);_0x47439d[_0xd4de('0x38')]=_[_0xd4de('0x4c')](_0x5cb4ce['model'],qs['fields'](_0x50e1bf[_0xd4de('0x36')]['fields']));_0x47439d[_0xd4de('0x38')]=_0x47439d['attributes'][_0xd4de('0x3a')]?_0x47439d[_0xd4de('0x38')]:_0x5cb4ce[_0xd4de('0x35')];_0x47439d[_0xd4de('0x3d')]=qs[_0xd4de('0x3e')](_0x50e1bf['query']['sort']);_0x47439d['where']=qs[_0xd4de('0x37')](_[_0xd4de('0x40')](_0x50e1bf[_0xd4de('0x36')],_0x5cb4ce['filters']));if(_0x50e1bf['query'][_0xd4de('0x41')]){_0x47439d[_0xd4de('0x3f')]=_[_0xd4de('0x42')](_0x47439d[_0xd4de('0x3f')],{'$or':_[_0xd4de('0x2f')](_0x47439d[_0xd4de('0x38')],function(_0x15d481){var _0x44f2a4={};_0x44f2a4[_0x15d481]={'$like':'%'+_0x50e1bf[_0xd4de('0x36')][_0xd4de('0x41')]+'%'};return _0x44f2a4;})});}_0x47439d=_['merge']({},_0x47439d,_0x50e1bf['options']);return _0x2da6bc[_0xd4de('0x68')](_0x47439d);}})[_0xd4de('0x27')](function(_0x4b9f20){if(_0x4b9f20){_0x3a08e8=_0x4b9f20[_0xd4de('0x3a')];if(!_0x50e1bf[_0xd4de('0x36')][_0xd4de('0x63')](_0xd4de('0x3b'))){_0x47439d[_0xd4de('0x3c')]=qs[_0xd4de('0x3c')](_0x50e1bf[_0xd4de('0x36')][_0xd4de('0x3c')]);_0x47439d[_0xd4de('0x1f')]=qs[_0xd4de('0x1f')](_0x50e1bf[_0xd4de('0x36')][_0xd4de('0x1f')]);}return _0x2da6bc[_0xd4de('0x68')](_0x47439d);}})[_0xd4de('0x27')](function(_0x4daaf0){if(_0x4daaf0){return _0x4daaf0?{'count':_0x3a08e8,'rows':_0x4daaf0}:null;}})['then'](respondWithResult(_0x4c31a7,null))[_0xd4de('0x56')](handleError(_0x4c31a7,null));};exports[_0xd4de('0x6a')]=function(_0x3d8ba8,_0x482586,_0x4705a8){var _0x2698f9,_0xecc9c3;var _0x50313c=[];var _0x197446=moment()[_0xd4de('0x6b')](_0xd4de('0x6c'));return db[_0xd4de('0x30')][_0xd4de('0x4d')]({'where':{'id':_0x3d8ba8[_0xd4de('0x4a')]['id']}})['then'](handleEntityNotFound(_0x482586,null))[_0xd4de('0x27')](function(_0x5997ce){if(_0x5997ce){_0xecc9c3=_0x5997ce;return _0x5997ce[_0xd4de('0x6a')](_0x3d8ba8[_0xd4de('0x4f')][_0xd4de('0x6d')],_[_0xd4de('0x59')](_0x3d8ba8[_0xd4de('0x4f')],[_0xd4de('0x6d'),'id'])||{});}return null;})[_0xd4de('0x6e')](function(_0x577776){var _0x4960d0;var _0x15bc7b;_0x2698f9=_0x577776||[];var _0x56226c=[];if(_0x577776){for(var _0x1db14d=0x0;_0x1db14d<_0x577776[_0xd4de('0x3a')];_0x1db14d+=0x1){var _0xb5cf27=_0x577776[_0x1db14d][_0xd4de('0x28')]({'plain':!![]});_0xecc9c3[_0xd4de('0x6f')]=_0x3d8ba8[_0xd4de('0x4f')][_0xd4de('0x6f')]?_0x3d8ba8[_0xd4de('0x4f')]['dialCheckDuplicateType']:_0xecc9c3[_0xd4de('0x6f')];switch(_0xecc9c3[_0xd4de('0x6f')]){case'always':_0x4960d0=squel['insert']()[_0xd4de('0x70')](_0xd4de('0x71'))['fromQuery']([_0xd4de('0x72'),_0xd4de('0x73'),_0xd4de('0x74'),_0xd4de('0x75'),_0xd4de('0x5f'),'createdAt',_0xd4de('0x5b')],squel['select']()[_0xd4de('0x76')](_0xd4de('0x72'),_0xd4de('0x72'))['field']('NOW()',_0xd4de('0x73'))[_0xd4de('0x76')]('id',_0xd4de('0x74'))[_0xd4de('0x76')](_0xb5cf27[_0xd4de('0x77')][_0xd4de('0x78')](),_0xd4de('0x75'))[_0xd4de('0x76')](_0x3d8ba8[_0xd4de('0x4a')]['id']['toString'](),_0xd4de('0x5f'))[_0xd4de('0x76')]('\x27'+_0x197446+'\x27','createdAt')['field']('\x27'+_0x197446+'\x27',_0xd4de('0x5b'))['from']('cm_contacts')['where'](_0xd4de('0x79'))[_0xd4de('0x3f')](_0xd4de('0x7a'),_0xb5cf27[_0xd4de('0x77')]['toString']())[_0xd4de('0x3f')]('phone\x20IS\x20NOT\x20NULL')[_0xd4de('0x3f')](_0xd4de('0x7b'),squel[_0xd4de('0x7c')]()[_0xd4de('0x76')]('COALESCE(calleridnum,\x27\x27)')[_0xd4de('0x7d')]('cm_hopper_final')[_0xd4de('0x3f')]('CampaignId\x20=\x20?',_0x3d8ba8['params']['id'][_0xd4de('0x78')]()))[_0xd4de('0x3f')](_0xd4de('0x7b'),squel['select']()[_0xd4de('0x76')]('COALESCE(phone,\x27\x27)')[_0xd4de('0x7d')](_0xd4de('0x71'))['where'](_0xd4de('0x7e'),_0x3d8ba8[_0xd4de('0x4a')]['id'][_0xd4de('0x78')]())))[_0xd4de('0x78')]();break;case'onlyIfOpen':_0x4960d0=squel[_0xd4de('0x7f')]()['into'](_0xd4de('0x71'))[_0xd4de('0x80')]([_0xd4de('0x72'),_0xd4de('0x73'),_0xd4de('0x74'),_0xd4de('0x75'),'CampaignId',_0xd4de('0x5a'),_0xd4de('0x5b')],squel['select']()[_0xd4de('0x76')](_0xd4de('0x72'),_0xd4de('0x72'))[_0xd4de('0x76')](_0xd4de('0x81'),_0xd4de('0x73'))[_0xd4de('0x76')]('id',_0xd4de('0x74'))[_0xd4de('0x76')](_0xb5cf27[_0xd4de('0x77')][_0xd4de('0x78')](),_0xd4de('0x75'))[_0xd4de('0x76')](_0x3d8ba8['params']['id'][_0xd4de('0x78')](),'CampaignId')['field']('\x27'+_0x197446+'\x27','createdAt')[_0xd4de('0x76')]('\x27'+_0x197446+'\x27',_0xd4de('0x5b'))['from']('cm_contacts')[_0xd4de('0x3f')](_0xd4de('0x79'))[_0xd4de('0x3f')](_0xd4de('0x7a'),_0xb5cf27[_0xd4de('0x77')][_0xd4de('0x78')]())['where'](_0xd4de('0x82'))[_0xd4de('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel[_0xd4de('0x7c')]()[_0xd4de('0x76')](_0xd4de('0x83'))[_0xd4de('0x7d')](_0xd4de('0x71'))['where'](_0xd4de('0x7e'),_0x3d8ba8['params']['id']['toString']())))[_0xd4de('0x78')]();break;default:_0x4960d0=squel[_0xd4de('0x7f')]()['into']('cm_hopper')[_0xd4de('0x80')](['phone',_0xd4de('0x73'),_0xd4de('0x74'),_0xd4de('0x75'),_0xd4de('0x5f'),_0xd4de('0x5a'),'updatedAt'],squel[_0xd4de('0x7c')]()['field'](_0xd4de('0x72'),_0xd4de('0x72'))[_0xd4de('0x76')](_0xd4de('0x81'),_0xd4de('0x73'))[_0xd4de('0x76')]('id',_0xd4de('0x74'))['field'](_0xb5cf27[_0xd4de('0x77')][_0xd4de('0x78')](),_0xd4de('0x75'))[_0xd4de('0x76')](_0x3d8ba8['params']['id'][_0xd4de('0x78')](),_0xd4de('0x5f'))[_0xd4de('0x76')]('\x27'+_0x197446+'\x27',_0xd4de('0x5a'))[_0xd4de('0x76')]('\x27'+_0x197446+'\x27',_0xd4de('0x5b'))[_0xd4de('0x7d')](_0xd4de('0x84'))['where']('deletedAt\x20IS\x20NULL')[_0xd4de('0x3f')](_0xd4de('0x7a'),_0xb5cf27[_0xd4de('0x77')][_0xd4de('0x78')]())['where'](_0xd4de('0x82')))[_0xd4de('0x78')]();}_0x15bc7b=squel[_0xd4de('0x7f')]()['into']('cm_hopper_additional_phones')['fromQuery']([_0xd4de('0x85'),_0xd4de('0x73'),'phone',_0xd4de('0x86'),_0xd4de('0x5a'),'updatedAt'],squel[_0xd4de('0x7c')]()[_0xd4de('0x76')]('h.id','id')[_0xd4de('0x76')](_0xd4de('0x81'),_0xd4de('0x73'))[_0xd4de('0x76')](_0xd4de('0x87'),_0xd4de('0x72'))[_0xd4de('0x76')](_0xd4de('0x88'),_0xd4de('0x86'))[_0xd4de('0x76')]('\x27'+_0x197446+'\x27',_0xd4de('0x5a'))[_0xd4de('0x76')]('\x27'+_0x197446+'\x27','updatedAt')[_0xd4de('0x7d')](_0xd4de('0x89'),'ci')[_0xd4de('0x8a')](_0xd4de('0x71'),'h','h.ContactId\x20=\x20ci.CmContactId')[_0xd4de('0x3f')](_0xd4de('0x8b'),_0xb5cf27[_0xd4de('0x77')][_0xd4de('0x78')]())['where'](_0xd4de('0x8c'),_0x3d8ba8[_0xd4de('0x4a')]['id'][_0xd4de('0x78')]())[_0xd4de('0x3f')](_0xd4de('0x8d'),_0x197446))[_0xd4de('0x78')]();_0x56226c[_0xd4de('0x8e')](db[_0xd4de('0x8f')][_0xd4de('0x36')](_0x4960d0));_0x50313c['push'](db['sequelize']['query'](_0x15bc7b));}return BPromise[_0xd4de('0x90')](_0x56226c);}})[_0xd4de('0x27')](function(){return BPromise[_0xd4de('0x90')](_0x50313c);})[_0xd4de('0x27')](function(){return _0x2698f9;})[_0xd4de('0x27')](respondWithResult(_0x482586,null))[_0xd4de('0x56')](handleError(_0x482586,null));};exports[_0xd4de('0x91')]=function(_0x5dc254,_0x49f604,_0x193201){return db['Campaign'][_0xd4de('0x4d')]({'where':{'id':_0x5dc254[_0xd4de('0x4a')]['id']}})['then'](handleEntityNotFound(_0x49f604,null))[_0xd4de('0x27')](function(_0x127322){if(_0x127322){return _0x127322[_0xd4de('0x91')](_0x5dc254['query'][_0xd4de('0x6d')]);}})[_0xd4de('0x27')](function(_0x5e6ca4){if(_0x5e6ca4){return db[_0xd4de('0x60')][_0xd4de('0x29')]({'where':{'ListId':_0x5dc254[_0xd4de('0x36')][_0xd4de('0x6d')],'CampaignId':_0x5dc254[_0xd4de('0x4a')]['id']}})['then'](function(){return _0x5e6ca4;});}})[_0xd4de('0x27')](respondWithStatusCode(_0x49f604,null))[_0xd4de('0x56')](handleError(_0x49f604,null));};exports[_0xd4de('0x92')]=function(_0x53b6ce,_0x48227c,_0x3705fb){var _0x45d2e3={};var _0x4d6c98={};var _0x5e5ce8;var _0x29c72d;return db[_0xd4de('0x30')]['findOne']({'where':{'id':_0x53b6ce[_0xd4de('0x4a')]['id']}})[_0xd4de('0x27')](handleEntityNotFound(_0x48227c,null))[_0xd4de('0x27')](function(_0x429644){if(_0x429644){_0x5e5ce8=_0x429644;_0x4d6c98['model']=_[_0xd4de('0x4b')](db['CmList'][_0xd4de('0x31')]);_0x4d6c98[_0xd4de('0x36')]=_[_0xd4de('0x4b')](_0x53b6ce[_0xd4de('0x36')]);_0x4d6c98[_0xd4de('0x37')]=_[_0xd4de('0x4c')](_0x4d6c98[_0xd4de('0x35')],_0x4d6c98['query']);_0x45d2e3[_0xd4de('0x38')]=_[_0xd4de('0x4c')](_0x4d6c98[_0xd4de('0x35')],qs['fields'](_0x53b6ce['query'][_0xd4de('0x39')]));_0x45d2e3[_0xd4de('0x38')]=_0x45d2e3[_0xd4de('0x38')][_0xd4de('0x3a')]?_0x45d2e3['attributes']:_0x4d6c98[_0xd4de('0x35')];_0x45d2e3[_0xd4de('0x3d')]=qs[_0xd4de('0x3e')](_0x53b6ce['query'][_0xd4de('0x3e')]);_0x45d2e3[_0xd4de('0x3f')]=qs['filters'](_['pick'](_0x53b6ce['query'],_0x4d6c98[_0xd4de('0x37')]));if(_0x53b6ce[_0xd4de('0x36')][_0xd4de('0x41')]){_0x45d2e3[_0xd4de('0x3f')]=_[_0xd4de('0x42')](_0x45d2e3[_0xd4de('0x3f')],{'$or':_[_0xd4de('0x2f')](_0x45d2e3[_0xd4de('0x38')],function(_0x266e71){var _0x55312e={};_0x55312e[_0x266e71]={'$like':'%'+_0x53b6ce[_0xd4de('0x36')]['filter']+'%'};return _0x55312e;})});}_0x45d2e3=_[_0xd4de('0x42')]({},_0x45d2e3,_0x53b6ce[_0xd4de('0x44')]);return _0x5e5ce8[_0xd4de('0x92')](_0x45d2e3);}})[_0xd4de('0x27')](function(_0x23b864){if(_0x23b864){_0x29c72d=_0x23b864['length'];if(!_0x53b6ce[_0xd4de('0x36')]['hasOwnProperty'](_0xd4de('0x3b'))){_0x45d2e3[_0xd4de('0x3c')]=qs[_0xd4de('0x3c')](_0x53b6ce[_0xd4de('0x36')][_0xd4de('0x3c')]);_0x45d2e3[_0xd4de('0x1f')]=qs[_0xd4de('0x1f')](_0x53b6ce[_0xd4de('0x36')][_0xd4de('0x1f')]);}return _0x5e5ce8[_0xd4de('0x92')](_0x45d2e3);}})[_0xd4de('0x27')](function(_0x363e62){if(_0x363e62){return _0x363e62?{'count':_0x29c72d,'rows':_0x363e62}:null;}})[_0xd4de('0x27')](respondWithResult(_0x48227c,null))[_0xd4de('0x56')](handleError(_0x48227c,null));};exports[_0xd4de('0x93')]=function(_0xdd32b9,_0x5c891e,_0x504fee){var _0x5a475e,_0x4ccd1e;var _0x207955=[];var _0x55148d=moment()['format'](_0xd4de('0x6c'));return db['Campaign'][_0xd4de('0x4d')]({'where':{'id':_0xdd32b9[_0xd4de('0x4a')]['id']}})[_0xd4de('0x27')](handleEntityNotFound(_0x5c891e,null))[_0xd4de('0x27')](function(_0x187ce1){if(_0x187ce1){_0x4ccd1e=_0x187ce1;return _0x187ce1[_0xd4de('0x93')](_0xdd32b9[_0xd4de('0x4f')][_0xd4de('0x6d')],_[_0xd4de('0x59')](_0xdd32b9[_0xd4de('0x4f')],['ids','id'])||{});}return null;})['spread'](function(_0x1bc087){var _0x4a6ca5;var _0x32cf37;_0x5a475e=_0x1bc087||[];var _0x1b6c2a=[];if(_0x1bc087){for(var _0x56c83a=0x0;_0x56c83a<_0x1bc087['length'];_0x56c83a+=0x1){var _0x15dcb0=_0x1bc087[_0x56c83a][_0xd4de('0x28')]({'plain':!![]});_0x4a6ca5=squel[_0xd4de('0x7f')]()['into'](_0xd4de('0x94'))['fromQuery']([_0xd4de('0x72'),'ContactId','ListId',_0xd4de('0x5f'),_0xd4de('0x5a'),_0xd4de('0x5b')],squel[_0xd4de('0x7c')]()[_0xd4de('0x76')](_0xd4de('0x72'),_0xd4de('0x72'))[_0xd4de('0x76')]('id','ContactId')[_0xd4de('0x76')](_0x15dcb0[_0xd4de('0x77')]['toString'](),_0xd4de('0x75'))[_0xd4de('0x76')](_0xdd32b9['params']['id'][_0xd4de('0x78')](),_0xd4de('0x5f'))[_0xd4de('0x76')](_0xd4de('0x81'),'createdAt')[_0xd4de('0x76')](_0xd4de('0x81'),_0xd4de('0x5b'))['from']('cm_contacts')[_0xd4de('0x3f')](_0xd4de('0x79'))[_0xd4de('0x3f')](_0xd4de('0x7a'),_0x15dcb0[_0xd4de('0x77')]['toString']())[_0xd4de('0x3f')](_0xd4de('0x82')))[_0xd4de('0x78')]();_0x1b6c2a['push'](db[_0xd4de('0x8f')]['query'](_0x4a6ca5));}return BPromise[_0xd4de('0x90')](_0x1b6c2a);}})[_0xd4de('0x27')](function(){return _0x5a475e;})[_0xd4de('0x27')](respondWithResult(_0x5c891e,null))[_0xd4de('0x56')](handleError(_0x5c891e,null));};exports[_0xd4de('0x95')]=function(_0x50bdaf,_0x58ec2b,_0x13d1ac){return db[_0xd4de('0x30')][_0xd4de('0x4d')]({'where':{'id':_0x50bdaf[_0xd4de('0x4a')]['id']}})[_0xd4de('0x27')](handleEntityNotFound(_0x58ec2b,null))[_0xd4de('0x27')](function(_0x462e04){if(_0x462e04){return _0x462e04[_0xd4de('0x95')](_0x50bdaf['query'][_0xd4de('0x6d')]);}})[_0xd4de('0x27')](function(_0x21368c){if(_0x21368c){return db[_0xd4de('0x67')][_0xd4de('0x29')]({'where':{'ListId':_0x50bdaf[_0xd4de('0x36')][_0xd4de('0x6d')],'CampaignId':_0x50bdaf[_0xd4de('0x4a')]['id']}})[_0xd4de('0x27')](function(){return _0x21368c;});}})[_0xd4de('0x27')](respondWithStatusCode(_0x58ec2b,null))[_0xd4de('0x56')](handleError(_0x58ec2b,null));}; \ No newline at end of file +var _0xaed4=['type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','filter','where','merge','VIRTUAL','include','findAll','rows','show','rawAttributes','includeAll','options','create','body','user','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','find','get','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','params','getHoppers','findOne','CmHopper','sort','pick','CampaignId','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','select','NOW()','field','CmListId','ListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','CampaignId\x20=\x20?','onlyIfOpen','into','COALESCE(phone,\x27\x27)','phone\x20IS\x20NOT\x20NULL','OrderBy','ci.item','ci.OrderBY','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','removeBlackLists','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','IvrCampaigns','UserProfileResource','error','name','send','map','Campaign','fieldName'];(function(_0x1bec71,_0x3d2c4a){var _0x596365=function(_0x3198fa){while(--_0x3198fa){_0x1bec71['push'](_0x1bec71['shift']());}};_0x596365(++_0x3d2c4a);}(_0xaed4,0xf4));var _0x4aed=function(_0x40e56d,_0x2426b0){_0x40e56d=_0x40e56d-0x0;var _0x51295c=_0xaed4[_0x40e56d];return _0x51295c;};'use strict';var emlformat=require(_0x4aed('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4aed('0x1'));var jsonpatch=require(_0x4aed('0x2'));var rp=require(_0x4aed('0x3'));var moment=require(_0x4aed('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4aed('0x5'));var util=require(_0x4aed('0x6'));var path=require(_0x4aed('0x7'));var sox=require(_0x4aed('0x8'));var csv=require(_0x4aed('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4aed('0xa'));var _=require(_0x4aed('0xb'));var squel=require(_0x4aed('0xc'));var crypto=require(_0x4aed('0xd'));var jsforce=require(_0x4aed('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4aed('0x9'));var querystring=require('querystring');var Papa=require(_0x4aed('0xf'));var Redis=require(_0x4aed('0x10'));var authService=require(_0x4aed('0x11'));var qs=require(_0x4aed('0x12'));var as=require(_0x4aed('0x13'));var hardwareService=require(_0x4aed('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x4aed('0x15'));var config=require(_0x4aed('0x16'));var licenseUtil=require(_0x4aed('0x17'));var db=require(_0x4aed('0x18'))['db'];function respondWithStatusCode(_0x4a4725,_0x3b26ec){_0x3b26ec=_0x3b26ec||0xcc;return function(_0x4a7c7a){if(_0x4a7c7a){return _0x4a4725[_0x4aed('0x19')](_0x3b26ec);}return _0x4a4725[_0x4aed('0x1a')](_0x3b26ec)[_0x4aed('0x1b')]();};}function respondWithResult(_0x4550fb,_0x3f105a){_0x3f105a=_0x3f105a||0xc8;return function(_0x4c21f7){if(_0x4c21f7){return _0x4550fb[_0x4aed('0x1a')](_0x3f105a)[_0x4aed('0x1c')](_0x4c21f7);}};}function respondWithFilteredResult(_0x6cba6d,_0xec855b){return function(_0x4880aa){if(_0x4880aa){var _0x49bd62=typeof _0xec855b[_0x4aed('0x1d')]===_0x4aed('0x1e')&&typeof _0xec855b[_0x4aed('0x1f')]===_0x4aed('0x1e');var _0x134db1=_0x4880aa[_0x4aed('0x20')];var _0xd07a09=_0x49bd62?0x0:_0xec855b['offset'];var _0x5e766b=_0x49bd62?_0x4880aa['count']:_0xec855b[_0x4aed('0x1d')]+_0xec855b[_0x4aed('0x1f')];var _0x3d2d7f;if(_0x5e766b>=_0x134db1){_0x5e766b=_0x134db1;_0x3d2d7f=0xc8;}else{_0x3d2d7f=0xce;}_0x6cba6d[_0x4aed('0x1a')](_0x3d2d7f);return _0x6cba6d[_0x4aed('0x21')](_0x4aed('0x22'),_0xd07a09+'-'+_0x5e766b+'/'+_0x134db1)[_0x4aed('0x1c')](_0x4880aa);}return null;};}function patchUpdates(_0x556598){return function(_0x37a926){try{jsonpatch[_0x4aed('0x23')](_0x37a926,_0x556598,!![]);}catch(_0x18e16c){return BPromise['reject'](_0x18e16c);}return _0x37a926[_0x4aed('0x24')]();};}function saveUpdates(_0x3e3eff,_0x5aed24){return function(_0xa32922){if(_0xa32922){return _0xa32922[_0x4aed('0x25')](_0x3e3eff)[_0x4aed('0x26')](function(_0xa68fdb){return _0xa68fdb;});}return null;};}function removeEntity(_0x3410a4,_0x2453cd){return function(_0x1daea7){if(_0x1daea7){return _0x1daea7[_0x4aed('0x27')]()[_0x4aed('0x26')](function(){var _0x34c213=_0x1daea7['get']({'plain':!![]});var _0x3d388a=_0x4aed('0x28');return db[_0x4aed('0x29')]['destroy']({'where':{'type':_0x3d388a,'resourceId':_0x34c213['id']}})[_0x4aed('0x26')](function(){return _0x1daea7;});})[_0x4aed('0x26')](function(){_0x3410a4[_0x4aed('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56f4d9,_0x1760c2){return function(_0x137eab){if(!_0x137eab){_0x56f4d9['sendStatus'](0x194);}return _0x137eab;};}function handleError(_0x2d6285,_0x1ac50a){_0x1ac50a=_0x1ac50a||0x1f4;return function(_0x620f5f){logger[_0x4aed('0x2a')](_0x620f5f['stack']);if(_0x620f5f[_0x4aed('0x2b')]){delete _0x620f5f['name'];}_0x2d6285[_0x4aed('0x1a')](_0x1ac50a)[_0x4aed('0x2c')](_0x620f5f);};}exports['index']=function(_0x249d7f,_0x299182){var _0x163aa7={},_0x1ca992={},_0x6a53dd={'count':0x0,'rows':[]};var _0x2d0b6c=_[_0x4aed('0x2d')](db[_0x4aed('0x2e')]['rawAttributes'],function(_0x18f0cd){return{'name':_0x18f0cd[_0x4aed('0x2f')],'type':_0x18f0cd[_0x4aed('0x30')]['key']};});_0x1ca992[_0x4aed('0x31')]=_[_0x4aed('0x2d')](_0x2d0b6c,'name');_0x1ca992[_0x4aed('0x32')]=_[_0x4aed('0x33')](_0x249d7f[_0x4aed('0x32')]);_0x1ca992[_0x4aed('0x34')]=_[_0x4aed('0x35')](_0x1ca992[_0x4aed('0x31')],_0x1ca992[_0x4aed('0x32')]);_0x163aa7[_0x4aed('0x36')]=_['intersection'](_0x1ca992[_0x4aed('0x31')],qs[_0x4aed('0x37')](_0x249d7f['query'][_0x4aed('0x37')]));_0x163aa7[_0x4aed('0x36')]=_0x163aa7[_0x4aed('0x36')][_0x4aed('0x38')]?_0x163aa7[_0x4aed('0x36')]:_0x1ca992[_0x4aed('0x31')];if(!_0x249d7f[_0x4aed('0x32')][_0x4aed('0x39')](_0x4aed('0x3a'))){_0x163aa7[_0x4aed('0x1f')]=qs[_0x4aed('0x1f')](_0x249d7f['query']['limit']);_0x163aa7[_0x4aed('0x1d')]=qs[_0x4aed('0x1d')](_0x249d7f[_0x4aed('0x32')][_0x4aed('0x1d')]);}_0x163aa7[_0x4aed('0x3b')]=qs['sort'](_0x249d7f[_0x4aed('0x32')]['sort']);_0x163aa7['where']=qs[_0x4aed('0x34')](_['pick'](_0x249d7f['query'],_0x1ca992[_0x4aed('0x34')]),_0x2d0b6c);if(_0x249d7f[_0x4aed('0x32')][_0x4aed('0x3c')]){_0x163aa7[_0x4aed('0x3d')]=_[_0x4aed('0x3e')](_0x163aa7[_0x4aed('0x3d')],{'$or':_[_0x4aed('0x2d')](_0x2d0b6c,function(_0x41323d){if(_0x41323d[_0x4aed('0x30')]!==_0x4aed('0x3f')){var _0x182b81={};_0x182b81[_0x41323d[_0x4aed('0x2b')]]={'$like':'%'+_0x249d7f[_0x4aed('0x32')][_0x4aed('0x3c')]+'%'};return _0x182b81;}})});}_0x163aa7=_[_0x4aed('0x3e')]({},_0x163aa7,_0x249d7f['options']);var _0x3c02e9={'where':_0x163aa7[_0x4aed('0x3d')]};return db['Campaign']['count'](_0x3c02e9)[_0x4aed('0x26')](function(_0x24ab20){_0x6a53dd[_0x4aed('0x20')]=_0x24ab20;if(_0x249d7f[_0x4aed('0x32')]['includeAll']){_0x163aa7[_0x4aed('0x40')]=[{'all':!![]}];}return db[_0x4aed('0x2e')][_0x4aed('0x41')](_0x163aa7);})[_0x4aed('0x26')](function(_0x1ea7ff){_0x6a53dd[_0x4aed('0x42')]=_0x1ea7ff;return _0x6a53dd;})[_0x4aed('0x26')](respondWithFilteredResult(_0x299182,_0x163aa7))['catch'](handleError(_0x299182,null));};exports[_0x4aed('0x43')]=function(_0x4af896,_0x4d0154){var _0xf301f5={'raw':![],'where':{'id':_0x4af896['params']['id']}},_0x2552ea={};_0x2552ea[_0x4aed('0x31')]=_[_0x4aed('0x33')](db[_0x4aed('0x2e')][_0x4aed('0x44')]);_0x2552ea['query']=_['keys'](_0x4af896[_0x4aed('0x32')]);_0x2552ea[_0x4aed('0x34')]=_[_0x4aed('0x35')](_0x2552ea['model'],_0x2552ea['query']);_0xf301f5['attributes']=_[_0x4aed('0x35')](_0x2552ea[_0x4aed('0x31')],qs[_0x4aed('0x37')](_0x4af896['query'][_0x4aed('0x37')]));_0xf301f5[_0x4aed('0x36')]=_0xf301f5['attributes'][_0x4aed('0x38')]?_0xf301f5[_0x4aed('0x36')]:_0x2552ea['model'];if(_0x4af896[_0x4aed('0x32')][_0x4aed('0x45')]){_0xf301f5[_0x4aed('0x40')]=[{'all':!![]}];}_0xf301f5=_[_0x4aed('0x3e')]({},_0xf301f5,_0x4af896[_0x4aed('0x46')]);return db[_0x4aed('0x2e')]['find'](_0xf301f5)[_0x4aed('0x26')](handleEntityNotFound(_0x4d0154,null))['then'](respondWithResult(_0x4d0154,null))['catch'](handleError(_0x4d0154,null));};exports['create']=function(_0x5ab9da,_0x28adbf){return db[_0x4aed('0x2e')][_0x4aed('0x47')](_0x5ab9da[_0x4aed('0x48')],{})[_0x4aed('0x26')](function(_0x25b3ab){var _0x15fd61=_0x5ab9da['user']['get']({'plain':!![]});if(!_0x15fd61)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15fd61['role']===_0x4aed('0x49')){var _0x538def=_0x25b3ab['get']({'plain':!![]});var _0x2494af='IvrCampaigns';return db[_0x4aed('0x4a')]['find']({'where':{'name':_0x2494af,'userProfileId':_0x15fd61[_0x4aed('0x4b')]},'raw':!![]})['then'](function(_0xe52bc6){if(_0xe52bc6&&_0xe52bc6[_0x4aed('0x4c')]===0x0){return db[_0x4aed('0x29')][_0x4aed('0x47')]({'name':_0x538def[_0x4aed('0x2b')],'resourceId':_0x538def['id'],'type':_0xe52bc6[_0x4aed('0x2b')],'sectionId':_0xe52bc6['id']},{})['then'](function(){return _0x25b3ab;});}else{return _0x25b3ab;}})[_0x4aed('0x4d')](function(_0x52dc29){logger[_0x4aed('0x2a')](_0x4aed('0x4e'),_0x52dc29);throw _0x52dc29;});}return _0x25b3ab;})[_0x4aed('0x26')](respondWithResult(_0x28adbf,0xc9))[_0x4aed('0x4d')](handleError(_0x28adbf,null));};exports[_0x4aed('0x4f')]=function(_0x2a7747,_0x3f39d2){var _0x4a9e90={'where':{'id':_0x2a7747['params']['id']}},_0x149f27={};_0x149f27[_0x4aed('0x31')]=_[_0x4aed('0x33')](db['Campaign'][_0x4aed('0x44')]);_0x4a9e90[_0x4aed('0x36')]=_['intersection'](_0x149f27['model'],qs['fields'](_0x2a7747[_0x4aed('0x32')][_0x4aed('0x37')]));_0x4a9e90['attributes']=_0x4a9e90[_0x4aed('0x36')][_0x4aed('0x38')]?_0x4a9e90['attributes']:_0x149f27[_0x4aed('0x31')];if(_0x2a7747[_0x4aed('0x32')]['includeAll']){_0x4a9e90[_0x4aed('0x40')]=[{'all':!![]}];}_0x4a9e90=_[_0x4aed('0x3e')]({},_0x4a9e90,_0x2a7747[_0x4aed('0x46')]);return db[_0x4aed('0x2e')][_0x4aed('0x50')](_0x4a9e90)[_0x4aed('0x26')](handleEntityNotFound(_0x3f39d2,null))[_0x4aed('0x26')](function(_0x38ef67){if(_0x38ef67){var _0x518799=_0x38ef67[_0x4aed('0x51')]({'plain':!![]});_0x518799=qs[_0x4aed('0x52')](_0x518799,['id',_0x4aed('0x53'),_0x4aed('0x54')]);_0x2a7747[_0x4aed('0x48')]=_['omit'](_0x2a7747[_0x4aed('0x48')],['id',_0x4aed('0x53'),_0x4aed('0x54')]);return db['Campaign'][_0x4aed('0x47')](_[_0x4aed('0x3e')](_0x518799,_0x2a7747[_0x4aed('0x48')]),{'include':_0x2a7747[_0x4aed('0x32')][_0x4aed('0x45')]?[{'all':!![]}]:undefined})[_0x4aed('0x26')](function(_0x4f7b06){var _0x5b9fdd=_0x2a7747['user'][_0x4aed('0x51')]({'plain':!![]});if(!_0x5b9fdd)throw new Error(_0x4aed('0x55'));if(_0x5b9fdd[_0x4aed('0x56')]===_0x4aed('0x49')){var _0x500aec=_0x4f7b06[_0x4aed('0x51')]({'plain':!![]});var _0x2c8b69=_0x4aed('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x2c8b69,'userProfileId':_0x5b9fdd[_0x4aed('0x4b')]},'raw':!![]})[_0x4aed('0x26')](function(_0x49bcb7){if(_0x49bcb7&&_0x49bcb7[_0x4aed('0x4c')]===0x0){return db['UserProfileResource'][_0x4aed('0x47')]({'name':_0x500aec[_0x4aed('0x2b')],'resourceId':_0x500aec['id'],'type':_0x49bcb7[_0x4aed('0x2b')],'sectionId':_0x49bcb7['id']},{})['then'](function(){return _0x4f7b06;});}else{return _0x4f7b06;}})[_0x4aed('0x4d')](function(_0x454ef9){logger['error'](_0x4aed('0x4e'),_0x454ef9);throw _0x454ef9;});}return _0x4f7b06;});}})[_0x4aed('0x26')](respondWithResult(_0x3f39d2,0xc9))[_0x4aed('0x4d')](handleError(_0x3f39d2,null));};exports[_0x4aed('0x25')]=function(_0x50ff20,_0xdf0cd0){if(_0x50ff20[_0x4aed('0x48')]['id']){delete _0x50ff20[_0x4aed('0x48')]['id'];}return db[_0x4aed('0x2e')][_0x4aed('0x50')]({'where':{'id':_0x50ff20[_0x4aed('0x57')]['id']}})[_0x4aed('0x26')](handleEntityNotFound(_0xdf0cd0,null))[_0x4aed('0x26')](saveUpdates(_0x50ff20[_0x4aed('0x48')],null))[_0x4aed('0x26')](respondWithResult(_0xdf0cd0,null))[_0x4aed('0x4d')](handleError(_0xdf0cd0,null));};exports['destroy']=function(_0x3be44e,_0x3f35f3){return db[_0x4aed('0x2e')]['find']({'where':{'id':_0x3be44e[_0x4aed('0x57')]['id']}})[_0x4aed('0x26')](handleEntityNotFound(_0x3f35f3,null))[_0x4aed('0x26')](removeEntity(_0x3f35f3,null))[_0x4aed('0x4d')](handleError(_0x3f35f3,null));};exports[_0x4aed('0x58')]=function(_0x5f1924,_0x4ae2d4,_0x366f22){var _0x4645cb={'raw':!![],'where':{}};var _0x2a7d16={};var _0x314973={'count':0x0,'rows':[]};return db[_0x4aed('0x2e')][_0x4aed('0x59')]({'where':{'id':_0x5f1924[_0x4aed('0x57')]['id']}})[_0x4aed('0x26')](handleEntityNotFound(_0x4ae2d4,null))[_0x4aed('0x26')](function(_0x3696a7){if(_0x3696a7){_0x2a7d16['model']=_['keys'](db[_0x4aed('0x5a')][_0x4aed('0x44')]);_0x2a7d16[_0x4aed('0x32')]=_[_0x4aed('0x33')](_0x5f1924[_0x4aed('0x32')]);_0x2a7d16[_0x4aed('0x34')]=_['intersection'](_0x2a7d16[_0x4aed('0x31')],_0x2a7d16[_0x4aed('0x32')]);_0x4645cb[_0x4aed('0x36')]=_['intersection'](_0x2a7d16[_0x4aed('0x31')],qs['fields'](_0x5f1924['query'][_0x4aed('0x37')]));_0x4645cb['attributes']=_0x4645cb[_0x4aed('0x36')][_0x4aed('0x38')]?_0x4645cb[_0x4aed('0x36')]:_0x2a7d16[_0x4aed('0x31')];if(!_0x5f1924[_0x4aed('0x32')][_0x4aed('0x39')](_0x4aed('0x3a'))){_0x4645cb['limit']=qs[_0x4aed('0x1f')](_0x5f1924['query'][_0x4aed('0x1f')]);_0x4645cb['offset']=qs[_0x4aed('0x1d')](_0x5f1924[_0x4aed('0x32')]['offset']);}_0x4645cb[_0x4aed('0x3b')]=qs['sort'](_0x5f1924['query'][_0x4aed('0x5b')]);_0x4645cb[_0x4aed('0x3d')]=qs[_0x4aed('0x34')](_[_0x4aed('0x5c')](_0x5f1924[_0x4aed('0x32')],_0x2a7d16[_0x4aed('0x34')]));_0x4645cb['where'][_0x4aed('0x5d')]=_0x3696a7['id'];if(_0x5f1924[_0x4aed('0x32')][_0x4aed('0x3c')]){_0x4645cb[_0x4aed('0x3d')]=_['merge'](_0x4645cb[_0x4aed('0x3d')],{'$or':_['map'](_0x4645cb['attributes'],function(_0x383447){var _0x27cc24={};_0x27cc24[_0x383447]={'$like':'%'+_0x5f1924[_0x4aed('0x32')][_0x4aed('0x3c')]+'%'};return _0x27cc24;})});}_0x4645cb=_['merge']({},_0x4645cb,_0x5f1924[_0x4aed('0x46')]);return db[_0x4aed('0x5a')][_0x4aed('0x20')]({'where':_0x4645cb[_0x4aed('0x3d')]})['then'](function(_0x24c97e){_0x314973['count']=_0x24c97e;if(_0x5f1924[_0x4aed('0x32')]['includeAll']){_0x4645cb[_0x4aed('0x40')]=[{'all':!![]}];}return db['CmHopper'][_0x4aed('0x41')](_0x4645cb);})[_0x4aed('0x26')](function(_0x53606a){_0x314973[_0x4aed('0x42')]=_0x53606a;return _0x314973;});}})['then'](respondWithFilteredResult(_0x4ae2d4,_0x4645cb))['catch'](handleError(_0x4ae2d4,null));};exports[_0x4aed('0x5e')]=function(_0x2166ce,_0x2cf983,_0x1ff4c8){var _0x51a4b6={'raw':!![],'where':{}};var _0x341b39={};var _0x214e38={'count':0x0,'rows':[]};return db[_0x4aed('0x2e')][_0x4aed('0x59')]({'where':{'id':_0x2166ce[_0x4aed('0x57')]['id']}})['then'](handleEntityNotFound(_0x2cf983,null))[_0x4aed('0x26')](function(_0x489160){if(_0x489160){_0x341b39['model']=_['keys'](db[_0x4aed('0x5f')][_0x4aed('0x44')]);_0x341b39[_0x4aed('0x32')]=_[_0x4aed('0x33')](_0x2166ce['query']);_0x341b39[_0x4aed('0x34')]=_[_0x4aed('0x35')](_0x341b39['model'],_0x341b39['query']);_0x51a4b6[_0x4aed('0x36')]=_[_0x4aed('0x35')](_0x341b39['model'],qs[_0x4aed('0x37')](_0x2166ce['query'][_0x4aed('0x37')]));_0x51a4b6[_0x4aed('0x36')]=_0x51a4b6[_0x4aed('0x36')][_0x4aed('0x38')]?_0x51a4b6[_0x4aed('0x36')]:_0x341b39[_0x4aed('0x31')];if(!_0x2166ce[_0x4aed('0x32')]['hasOwnProperty'](_0x4aed('0x3a'))){_0x51a4b6[_0x4aed('0x1f')]=qs[_0x4aed('0x1f')](_0x2166ce[_0x4aed('0x32')]['limit']);_0x51a4b6[_0x4aed('0x1d')]=qs[_0x4aed('0x1d')](_0x2166ce[_0x4aed('0x32')][_0x4aed('0x1d')]);}_0x51a4b6[_0x4aed('0x3b')]=qs['sort'](_0x2166ce[_0x4aed('0x32')][_0x4aed('0x5b')]);_0x51a4b6['where']=qs[_0x4aed('0x34')](_[_0x4aed('0x5c')](_0x2166ce['query'],_0x341b39['filters']));_0x51a4b6[_0x4aed('0x3d')][_0x4aed('0x5d')]=_0x489160['id'];if(_0x2166ce[_0x4aed('0x32')][_0x4aed('0x3c')]){_0x51a4b6[_0x4aed('0x3d')]=_['merge'](_0x51a4b6[_0x4aed('0x3d')],{'$or':_['map'](_0x51a4b6[_0x4aed('0x36')],function(_0xa97c53){var _0xe43651={};_0xe43651[_0xa97c53]={'$like':'%'+_0x2166ce[_0x4aed('0x32')][_0x4aed('0x3c')]+'%'};return _0xe43651;})});}_0x51a4b6=_[_0x4aed('0x3e')]({},_0x51a4b6,_0x2166ce['options']);return db['CmHopperHistory'][_0x4aed('0x20')]({'where':_0x51a4b6[_0x4aed('0x3d')]})['then'](function(_0x3149ab){_0x214e38[_0x4aed('0x20')]=_0x3149ab;if(_0x2166ce[_0x4aed('0x32')][_0x4aed('0x45')]){_0x51a4b6[_0x4aed('0x40')]=[{'all':!![]}];}return db[_0x4aed('0x5f')][_0x4aed('0x41')](_0x51a4b6);})[_0x4aed('0x26')](function(_0x22d99a){_0x214e38['rows']=_0x22d99a;return _0x214e38;});}})[_0x4aed('0x26')](respondWithFilteredResult(_0x2cf983,_0x51a4b6))['catch'](handleError(_0x2cf983,null));};exports['getHopperFinals']=function(_0x364088,_0x3a1435,_0x595635){var _0x562b6={'raw':!![],'where':{}};var _0x373e0f={};var _0xace68={'count':0x0,'rows':[]};return db[_0x4aed('0x2e')][_0x4aed('0x59')]({'where':{'id':_0x364088['params']['id']}})[_0x4aed('0x26')](handleEntityNotFound(_0x3a1435,null))[_0x4aed('0x26')](function(_0x513f39){if(_0x513f39){_0x373e0f['model']=_[_0x4aed('0x33')](db[_0x4aed('0x60')][_0x4aed('0x44')]);_0x373e0f[_0x4aed('0x32')]=_[_0x4aed('0x33')](_0x364088['query']);_0x373e0f[_0x4aed('0x34')]=_[_0x4aed('0x35')](_0x373e0f['model'],_0x373e0f[_0x4aed('0x32')]);_0x562b6[_0x4aed('0x36')]=_[_0x4aed('0x35')](_0x373e0f['model'],qs['fields'](_0x364088[_0x4aed('0x32')][_0x4aed('0x37')]));_0x562b6['attributes']=_0x562b6[_0x4aed('0x36')][_0x4aed('0x38')]?_0x562b6[_0x4aed('0x36')]:_0x373e0f[_0x4aed('0x31')];if(!_0x364088[_0x4aed('0x32')]['hasOwnProperty'](_0x4aed('0x3a'))){_0x562b6[_0x4aed('0x1f')]=qs[_0x4aed('0x1f')](_0x364088[_0x4aed('0x32')][_0x4aed('0x1f')]);_0x562b6['offset']=qs[_0x4aed('0x1d')](_0x364088[_0x4aed('0x32')][_0x4aed('0x1d')]);}_0x562b6[_0x4aed('0x3b')]=qs[_0x4aed('0x5b')](_0x364088[_0x4aed('0x32')]['sort']);_0x562b6[_0x4aed('0x3d')]=qs[_0x4aed('0x34')](_[_0x4aed('0x5c')](_0x364088[_0x4aed('0x32')],_0x373e0f[_0x4aed('0x34')]));_0x562b6[_0x4aed('0x3d')][_0x4aed('0x5d')]=_0x513f39['id'];if(_0x364088[_0x4aed('0x32')][_0x4aed('0x3c')]){_0x562b6[_0x4aed('0x3d')]=_[_0x4aed('0x3e')](_0x562b6[_0x4aed('0x3d')],{'$or':_[_0x4aed('0x2d')](_0x562b6[_0x4aed('0x36')],function(_0x128a94){var _0x23c786={};_0x23c786[_0x128a94]={'$like':'%'+_0x364088['query'][_0x4aed('0x3c')]+'%'};return _0x23c786;})});}_0x562b6=_[_0x4aed('0x3e')]({},_0x562b6,_0x364088[_0x4aed('0x46')]);return db['CmHopperFinal'][_0x4aed('0x20')]({'where':_0x562b6[_0x4aed('0x3d')]})[_0x4aed('0x26')](function(_0x14304e){_0xace68['count']=_0x14304e;if(_0x364088[_0x4aed('0x32')]['includeAll']){_0x562b6['include']=[{'all':!![]}];}return db[_0x4aed('0x60')][_0x4aed('0x41')](_0x562b6);})[_0x4aed('0x26')](function(_0x3d0f04){_0xace68['rows']=_0x3d0f04;return _0xace68;});}})[_0x4aed('0x26')](respondWithFilteredResult(_0x3a1435,_0x562b6))[_0x4aed('0x4d')](handleError(_0x3a1435,null));};exports[_0x4aed('0x61')]=function(_0x2c0e1a,_0x1eeab0,_0x5c6c59){var _0x56c31e={'raw':!![],'where':{}};var _0x4cee9c={};var _0x1e8c22={'count':0x0,'rows':[]};return db[_0x4aed('0x2e')][_0x4aed('0x59')]({'where':{'id':_0x2c0e1a[_0x4aed('0x57')]['id']}})[_0x4aed('0x26')](handleEntityNotFound(_0x1eeab0,null))['then'](function(_0x43cfb2){if(_0x43cfb2){_0x4cee9c[_0x4aed('0x31')]=_['keys'](db[_0x4aed('0x62')]['rawAttributes']);_0x4cee9c['query']=_[_0x4aed('0x33')](_0x2c0e1a[_0x4aed('0x32')]);_0x4cee9c[_0x4aed('0x34')]=_[_0x4aed('0x35')](_0x4cee9c['model'],_0x4cee9c['query']);_0x56c31e[_0x4aed('0x36')]=_['intersection'](_0x4cee9c[_0x4aed('0x31')],qs[_0x4aed('0x37')](_0x2c0e1a[_0x4aed('0x32')][_0x4aed('0x37')]));_0x56c31e[_0x4aed('0x36')]=_0x56c31e[_0x4aed('0x36')][_0x4aed('0x38')]?_0x56c31e[_0x4aed('0x36')]:_0x4cee9c['model'];if(!_0x2c0e1a[_0x4aed('0x32')][_0x4aed('0x39')](_0x4aed('0x3a'))){_0x56c31e[_0x4aed('0x1f')]=qs['limit'](_0x2c0e1a['query'][_0x4aed('0x1f')]);_0x56c31e[_0x4aed('0x1d')]=qs['offset'](_0x2c0e1a[_0x4aed('0x32')]['offset']);}_0x56c31e[_0x4aed('0x3b')]=qs['sort'](_0x2c0e1a[_0x4aed('0x32')][_0x4aed('0x5b')]);_0x56c31e[_0x4aed('0x3d')]=qs['filters'](_[_0x4aed('0x5c')](_0x2c0e1a[_0x4aed('0x32')],_0x4cee9c['filters']));_0x56c31e[_0x4aed('0x3d')][_0x4aed('0x5d')]=_0x43cfb2['id'];if(_0x2c0e1a['query']['filter']){_0x56c31e['where']=_[_0x4aed('0x3e')](_0x56c31e[_0x4aed('0x3d')],{'$or':_[_0x4aed('0x2d')](_0x56c31e[_0x4aed('0x36')],function(_0xc129){var _0x531e33={};_0x531e33[_0xc129]={'$like':'%'+_0x2c0e1a[_0x4aed('0x32')][_0x4aed('0x3c')]+'%'};return _0x531e33;})});}_0x56c31e=_[_0x4aed('0x3e')]({},_0x56c31e,_0x2c0e1a[_0x4aed('0x46')]);return db[_0x4aed('0x62')][_0x4aed('0x20')]({'where':_0x56c31e[_0x4aed('0x3d')]})[_0x4aed('0x26')](function(_0x1ea3d8){_0x1e8c22['count']=_0x1ea3d8;if(_0x2c0e1a[_0x4aed('0x32')]['includeAll']){_0x56c31e[_0x4aed('0x40')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x56c31e);})[_0x4aed('0x26')](function(_0x80078a){_0x1e8c22[_0x4aed('0x42')]=_0x80078a;return _0x1e8c22;});}})[_0x4aed('0x26')](respondWithFilteredResult(_0x1eeab0,_0x56c31e))[_0x4aed('0x4d')](handleError(_0x1eeab0,null));};exports['getLists']=function(_0x3e688e,_0x39bc11,_0x439259){var _0x4263d9={};var _0x5cabce={};var _0x1881db;var _0x30b7ea;return db[_0x4aed('0x2e')][_0x4aed('0x59')]({'where':{'id':_0x3e688e[_0x4aed('0x57')]['id']}})[_0x4aed('0x26')](handleEntityNotFound(_0x39bc11,null))[_0x4aed('0x26')](function(_0x50dc73){if(_0x50dc73){_0x1881db=_0x50dc73;_0x5cabce[_0x4aed('0x31')]=_[_0x4aed('0x33')](db[_0x4aed('0x63')][_0x4aed('0x44')]);_0x5cabce[_0x4aed('0x32')]=_[_0x4aed('0x33')](_0x3e688e[_0x4aed('0x32')]);_0x5cabce[_0x4aed('0x34')]=_[_0x4aed('0x35')](_0x5cabce[_0x4aed('0x31')],_0x5cabce[_0x4aed('0x32')]);_0x4263d9[_0x4aed('0x36')]=_[_0x4aed('0x35')](_0x5cabce[_0x4aed('0x31')],qs['fields'](_0x3e688e['query']['fields']));_0x4263d9[_0x4aed('0x36')]=_0x4263d9[_0x4aed('0x36')][_0x4aed('0x38')]?_0x4263d9[_0x4aed('0x36')]:_0x5cabce[_0x4aed('0x31')];_0x4263d9[_0x4aed('0x3b')]=qs[_0x4aed('0x5b')](_0x3e688e[_0x4aed('0x32')][_0x4aed('0x5b')]);_0x4263d9[_0x4aed('0x3d')]=qs[_0x4aed('0x34')](_['pick'](_0x3e688e[_0x4aed('0x32')],_0x5cabce[_0x4aed('0x34')]));if(_0x3e688e[_0x4aed('0x32')][_0x4aed('0x3c')]){_0x4263d9[_0x4aed('0x3d')]=_['merge'](_0x4263d9[_0x4aed('0x3d')],{'$or':_[_0x4aed('0x2d')](_0x4263d9[_0x4aed('0x36')],function(_0x275ee9){var _0x43eed8={};_0x43eed8[_0x275ee9]={'$like':'%'+_0x3e688e['query']['filter']+'%'};return _0x43eed8;})});}_0x4263d9=_[_0x4aed('0x3e')]({},_0x4263d9,_0x3e688e['options']);return _0x1881db[_0x4aed('0x64')](_0x4263d9);}})[_0x4aed('0x26')](function(_0x399f24){if(_0x399f24){_0x30b7ea=_0x399f24['length'];if(!_0x3e688e[_0x4aed('0x32')][_0x4aed('0x39')](_0x4aed('0x3a'))){_0x4263d9[_0x4aed('0x1f')]=qs[_0x4aed('0x1f')](_0x3e688e[_0x4aed('0x32')]['limit']);_0x4263d9['offset']=qs[_0x4aed('0x1d')](_0x3e688e[_0x4aed('0x32')]['offset']);}return _0x1881db[_0x4aed('0x64')](_0x4263d9);}})['then'](function(_0x4664e4){if(_0x4664e4){return _0x4664e4?{'count':_0x30b7ea,'rows':_0x4664e4}:null;}})[_0x4aed('0x26')](respondWithResult(_0x39bc11,null))[_0x4aed('0x4d')](handleError(_0x39bc11,null));};exports[_0x4aed('0x65')]=function(_0x187fcf,_0x5cecfa,_0x47cec2){var _0x2ddf0b,_0x1e7de8;var _0xedd810=[];var _0x3dc96c=moment()[_0x4aed('0x66')](_0x4aed('0x67'));return db['Campaign'][_0x4aed('0x50')]({'where':{'id':_0x187fcf[_0x4aed('0x57')]['id']}})[_0x4aed('0x26')](handleEntityNotFound(_0x5cecfa,null))[_0x4aed('0x26')](function(_0x1bb640){if(_0x1bb640){_0x1e7de8=_0x1bb640;return _0x1bb640['addLists'](_0x187fcf[_0x4aed('0x48')][_0x4aed('0x68')],_[_0x4aed('0x52')](_0x187fcf[_0x4aed('0x48')],[_0x4aed('0x68'),'id'])||{});}return null;})[_0x4aed('0x69')](function(_0x23491e){var _0x1ad015;var _0x258330;_0x2ddf0b=_0x23491e||[];var _0x2f7da9=[];if(_0x23491e){for(var _0x4ae5a3=0x0;_0x4ae5a3<_0x23491e[_0x4aed('0x38')];_0x4ae5a3+=0x1){var _0x582a27=_0x23491e[_0x4ae5a3][_0x4aed('0x51')]({'plain':!![]});_0x1e7de8[_0x4aed('0x6a')]=_0x187fcf[_0x4aed('0x48')]['dialCheckDuplicateType']?_0x187fcf['body']['dialCheckDuplicateType']:_0x1e7de8[_0x4aed('0x6a')];switch(_0x1e7de8['dialCheckDuplicateType']){case _0x4aed('0x6b'):_0x1ad015=squel[_0x4aed('0x6c')]()['into'](_0x4aed('0x6d'))[_0x4aed('0x6e')]([_0x4aed('0x6f'),_0x4aed('0x70'),_0x4aed('0x71'),'ListId',_0x4aed('0x5d'),_0x4aed('0x53'),_0x4aed('0x54')],squel[_0x4aed('0x72')]()['field'](_0x4aed('0x6f'),'phone')['field'](_0x4aed('0x73'),_0x4aed('0x70'))[_0x4aed('0x74')]('id',_0x4aed('0x71'))[_0x4aed('0x74')](_0x582a27[_0x4aed('0x75')]['toString'](),_0x4aed('0x76'))[_0x4aed('0x74')](_0x187fcf[_0x4aed('0x57')]['id'][_0x4aed('0x77')](),'CampaignId')[_0x4aed('0x74')]('\x27'+_0x3dc96c+'\x27',_0x4aed('0x53'))['field']('\x27'+_0x3dc96c+'\x27',_0x4aed('0x54'))['from'](_0x4aed('0x78'))[_0x4aed('0x3d')](_0x4aed('0x79'))[_0x4aed('0x3d')](_0x4aed('0x7a'),_0x582a27[_0x4aed('0x75')][_0x4aed('0x77')]())[_0x4aed('0x3d')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x4aed('0x7b'),squel[_0x4aed('0x72')]()['field'](_0x4aed('0x7c'))[_0x4aed('0x7d')]('cm_hopper_final')[_0x4aed('0x3d')](_0x4aed('0x7e'),_0x187fcf['params']['id'][_0x4aed('0x77')]()))[_0x4aed('0x3d')](_0x4aed('0x7b'),squel[_0x4aed('0x72')]()[_0x4aed('0x74')]('COALESCE(phone,\x27\x27)')[_0x4aed('0x7d')](_0x4aed('0x6d'))[_0x4aed('0x3d')](_0x4aed('0x7e'),_0x187fcf[_0x4aed('0x57')]['id'][_0x4aed('0x77')]())))[_0x4aed('0x77')]();break;case _0x4aed('0x7f'):_0x1ad015=squel[_0x4aed('0x6c')]()[_0x4aed('0x80')](_0x4aed('0x6d'))[_0x4aed('0x6e')]([_0x4aed('0x6f'),_0x4aed('0x70'),_0x4aed('0x71'),_0x4aed('0x76'),_0x4aed('0x5d'),_0x4aed('0x53'),_0x4aed('0x54')],squel[_0x4aed('0x72')]()['field'](_0x4aed('0x6f'),_0x4aed('0x6f'))[_0x4aed('0x74')](_0x4aed('0x73'),_0x4aed('0x70'))['field']('id',_0x4aed('0x71'))[_0x4aed('0x74')](_0x582a27[_0x4aed('0x75')]['toString'](),_0x4aed('0x76'))['field'](_0x187fcf[_0x4aed('0x57')]['id'][_0x4aed('0x77')](),_0x4aed('0x5d'))[_0x4aed('0x74')]('\x27'+_0x3dc96c+'\x27',_0x4aed('0x53'))['field']('\x27'+_0x3dc96c+'\x27','updatedAt')[_0x4aed('0x7d')](_0x4aed('0x78'))[_0x4aed('0x3d')](_0x4aed('0x79'))[_0x4aed('0x3d')](_0x4aed('0x7a'),_0x582a27[_0x4aed('0x75')][_0x4aed('0x77')]())[_0x4aed('0x3d')]('phone\x20IS\x20NOT\x20NULL')[_0x4aed('0x3d')](_0x4aed('0x7b'),squel[_0x4aed('0x72')]()['field'](_0x4aed('0x81'))[_0x4aed('0x7d')]('cm_hopper')[_0x4aed('0x3d')](_0x4aed('0x7e'),_0x187fcf[_0x4aed('0x57')]['id'][_0x4aed('0x77')]())))[_0x4aed('0x77')]();break;default:_0x1ad015=squel[_0x4aed('0x6c')]()[_0x4aed('0x80')]('cm_hopper')[_0x4aed('0x6e')](['phone','scheduledAt',_0x4aed('0x71'),_0x4aed('0x76'),_0x4aed('0x5d'),_0x4aed('0x53'),'updatedAt'],squel['select']()[_0x4aed('0x74')]('phone',_0x4aed('0x6f'))[_0x4aed('0x74')](_0x4aed('0x73'),_0x4aed('0x70'))[_0x4aed('0x74')]('id','ContactId')[_0x4aed('0x74')](_0x582a27[_0x4aed('0x75')][_0x4aed('0x77')](),_0x4aed('0x76'))[_0x4aed('0x74')](_0x187fcf['params']['id'][_0x4aed('0x77')](),_0x4aed('0x5d'))[_0x4aed('0x74')]('\x27'+_0x3dc96c+'\x27',_0x4aed('0x53'))[_0x4aed('0x74')]('\x27'+_0x3dc96c+'\x27',_0x4aed('0x54'))['from'](_0x4aed('0x78'))[_0x4aed('0x3d')](_0x4aed('0x79'))[_0x4aed('0x3d')](_0x4aed('0x7a'),_0x582a27['CmListId']['toString']())[_0x4aed('0x3d')](_0x4aed('0x82')))[_0x4aed('0x77')]();}_0x258330=squel['insert']()[_0x4aed('0x80')]('cm_hopper_additional_phones')['fromQuery'](['cmHopperId',_0x4aed('0x70'),_0x4aed('0x6f'),_0x4aed('0x83'),_0x4aed('0x53'),_0x4aed('0x54')],squel['select']()[_0x4aed('0x74')]('h.id','id')[_0x4aed('0x74')](_0x4aed('0x73'),_0x4aed('0x70'))['field'](_0x4aed('0x84'),'phone')[_0x4aed('0x74')](_0x4aed('0x85'),_0x4aed('0x83'))[_0x4aed('0x74')]('\x27'+_0x3dc96c+'\x27','createdAt')[_0x4aed('0x74')]('\x27'+_0x3dc96c+'\x27','updatedAt')[_0x4aed('0x7d')]('cm_contact_has_items','ci')[_0x4aed('0x86')]('cm_hopper','h',_0x4aed('0x87'))[_0x4aed('0x3d')](_0x4aed('0x88'),_0x582a27[_0x4aed('0x75')][_0x4aed('0x77')]())[_0x4aed('0x3d')](_0x4aed('0x89'),_0x187fcf[_0x4aed('0x57')]['id'][_0x4aed('0x77')]())[_0x4aed('0x3d')](_0x4aed('0x8a'),_0x3dc96c))[_0x4aed('0x77')]();_0x2f7da9[_0x4aed('0x8b')](db[_0x4aed('0x8c')]['query'](_0x1ad015));_0xedd810[_0x4aed('0x8b')](db['sequelize']['query'](_0x258330));}return BPromise[_0x4aed('0x8d')](_0x2f7da9);}})[_0x4aed('0x26')](function(){return BPromise[_0x4aed('0x8d')](_0xedd810);})[_0x4aed('0x26')](function(){return _0x2ddf0b;})[_0x4aed('0x26')](respondWithResult(_0x5cecfa,null))[_0x4aed('0x4d')](handleError(_0x5cecfa,null));};exports[_0x4aed('0x8e')]=function(_0x5c6c56,_0x3600d5,_0x465c1f){return db[_0x4aed('0x2e')][_0x4aed('0x50')]({'where':{'id':_0x5c6c56[_0x4aed('0x57')]['id']}})[_0x4aed('0x26')](handleEntityNotFound(_0x3600d5,null))[_0x4aed('0x26')](function(_0xe67e04){if(_0xe67e04){return _0xe67e04['removeLists'](_0x5c6c56[_0x4aed('0x32')][_0x4aed('0x68')]);}})['then'](function(_0x3ed64a){if(_0x3ed64a){return db[_0x4aed('0x5a')][_0x4aed('0x27')]({'where':{'ListId':_0x5c6c56[_0x4aed('0x32')]['ids'],'CampaignId':_0x5c6c56[_0x4aed('0x57')]['id']}})[_0x4aed('0x26')](function(){return _0x3ed64a;});}})[_0x4aed('0x26')](respondWithStatusCode(_0x3600d5,null))['catch'](handleError(_0x3600d5,null));};exports[_0x4aed('0x8f')]=function(_0x215367,_0x39ee5b,_0x3c51a2){var _0x28bb4d={};var _0x426b75={};var _0x56a595;var _0x1b9f18;return db[_0x4aed('0x2e')]['findOne']({'where':{'id':_0x215367['params']['id']}})[_0x4aed('0x26')](handleEntityNotFound(_0x39ee5b,null))[_0x4aed('0x26')](function(_0x35bc15){if(_0x35bc15){_0x56a595=_0x35bc15;_0x426b75[_0x4aed('0x31')]=_[_0x4aed('0x33')](db[_0x4aed('0x63')]['rawAttributes']);_0x426b75[_0x4aed('0x32')]=_[_0x4aed('0x33')](_0x215367['query']);_0x426b75[_0x4aed('0x34')]=_[_0x4aed('0x35')](_0x426b75[_0x4aed('0x31')],_0x426b75[_0x4aed('0x32')]);_0x28bb4d[_0x4aed('0x36')]=_['intersection'](_0x426b75[_0x4aed('0x31')],qs[_0x4aed('0x37')](_0x215367[_0x4aed('0x32')]['fields']));_0x28bb4d[_0x4aed('0x36')]=_0x28bb4d[_0x4aed('0x36')][_0x4aed('0x38')]?_0x28bb4d[_0x4aed('0x36')]:_0x426b75[_0x4aed('0x31')];_0x28bb4d[_0x4aed('0x3b')]=qs['sort'](_0x215367[_0x4aed('0x32')]['sort']);_0x28bb4d[_0x4aed('0x3d')]=qs['filters'](_[_0x4aed('0x5c')](_0x215367[_0x4aed('0x32')],_0x426b75[_0x4aed('0x34')]));if(_0x215367['query'][_0x4aed('0x3c')]){_0x28bb4d[_0x4aed('0x3d')]=_['merge'](_0x28bb4d[_0x4aed('0x3d')],{'$or':_[_0x4aed('0x2d')](_0x28bb4d[_0x4aed('0x36')],function(_0x5d6f08){var _0x3184a9={};_0x3184a9[_0x5d6f08]={'$like':'%'+_0x215367[_0x4aed('0x32')][_0x4aed('0x3c')]+'%'};return _0x3184a9;})});}_0x28bb4d=_[_0x4aed('0x3e')]({},_0x28bb4d,_0x215367[_0x4aed('0x46')]);return _0x56a595['getBlackLists'](_0x28bb4d);}})['then'](function(_0x340d43){if(_0x340d43){_0x1b9f18=_0x340d43[_0x4aed('0x38')];if(!_0x215367[_0x4aed('0x32')]['hasOwnProperty'](_0x4aed('0x3a'))){_0x28bb4d['limit']=qs[_0x4aed('0x1f')](_0x215367[_0x4aed('0x32')]['limit']);_0x28bb4d['offset']=qs['offset'](_0x215367[_0x4aed('0x32')]['offset']);}return _0x56a595['getBlackLists'](_0x28bb4d);}})[_0x4aed('0x26')](function(_0x479804){if(_0x479804){return _0x479804?{'count':_0x1b9f18,'rows':_0x479804}:null;}})[_0x4aed('0x26')](respondWithResult(_0x39ee5b,null))[_0x4aed('0x4d')](handleError(_0x39ee5b,null));};exports['addBlackLists']=function(_0x218082,_0x57f763,_0x292d6b){var _0x11ca64,_0x4fc0c1;var _0x284a09=[];var _0x167ba3=moment()['format'](_0x4aed('0x67'));return db[_0x4aed('0x2e')][_0x4aed('0x50')]({'where':{'id':_0x218082['params']['id']}})[_0x4aed('0x26')](handleEntityNotFound(_0x57f763,null))['then'](function(_0x5063d2){if(_0x5063d2){_0x4fc0c1=_0x5063d2;return _0x5063d2[_0x4aed('0x90')](_0x218082[_0x4aed('0x48')][_0x4aed('0x68')],_['omit'](_0x218082[_0x4aed('0x48')],[_0x4aed('0x68'),'id'])||{});}return null;})['spread'](function(_0x3c2754){var _0x3e3e1e;var _0x434d37;_0x11ca64=_0x3c2754||[];var _0x4f55fb=[];if(_0x3c2754){for(var _0x534926=0x0;_0x534926<_0x3c2754[_0x4aed('0x38')];_0x534926+=0x1){var _0x277000=_0x3c2754[_0x534926][_0x4aed('0x51')]({'plain':!![]});_0x3e3e1e=squel['insert']()[_0x4aed('0x80')]('cm_hopper_black')[_0x4aed('0x6e')](['phone',_0x4aed('0x71'),_0x4aed('0x76'),_0x4aed('0x5d'),_0x4aed('0x53'),_0x4aed('0x54')],squel[_0x4aed('0x72')]()[_0x4aed('0x74')](_0x4aed('0x6f'),_0x4aed('0x6f'))[_0x4aed('0x74')]('id',_0x4aed('0x71'))[_0x4aed('0x74')](_0x277000['CmListId'][_0x4aed('0x77')](),_0x4aed('0x76'))[_0x4aed('0x74')](_0x218082['params']['id'][_0x4aed('0x77')](),_0x4aed('0x5d'))['field'](_0x4aed('0x73'),_0x4aed('0x53'))[_0x4aed('0x74')](_0x4aed('0x73'),_0x4aed('0x54'))['from'](_0x4aed('0x78'))[_0x4aed('0x3d')](_0x4aed('0x79'))[_0x4aed('0x3d')](_0x4aed('0x7a'),_0x277000[_0x4aed('0x75')][_0x4aed('0x77')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x4aed('0x77')]();_0x4f55fb[_0x4aed('0x8b')](db['sequelize'][_0x4aed('0x32')](_0x3e3e1e));}return BPromise[_0x4aed('0x8d')](_0x4f55fb);}})[_0x4aed('0x26')](function(){return _0x11ca64;})[_0x4aed('0x26')](respondWithResult(_0x57f763,null))[_0x4aed('0x4d')](handleError(_0x57f763,null));};exports[_0x4aed('0x91')]=function(_0x3454d6,_0x192081,_0x1b7a47){return db[_0x4aed('0x2e')]['find']({'where':{'id':_0x3454d6[_0x4aed('0x57')]['id']}})[_0x4aed('0x26')](handleEntityNotFound(_0x192081,null))[_0x4aed('0x26')](function(_0x3787da){if(_0x3787da){return _0x3787da[_0x4aed('0x91')](_0x3454d6['query'][_0x4aed('0x68')]);}})['then'](function(_0x1b932d){if(_0x1b932d){return db[_0x4aed('0x62')][_0x4aed('0x27')]({'where':{'ListId':_0x3454d6['query'][_0x4aed('0x68')],'CampaignId':_0x3454d6[_0x4aed('0x57')]['id']}})[_0x4aed('0x26')](function(){return _0x1b932d;});}})[_0x4aed('0x26')](respondWithStatusCode(_0x192081,null))[_0x4aed('0x4d')](handleError(_0x192081,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 42dcfe7..f2dee17 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_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 logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 1ecc96f..5702b8e 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 _0xda55=['Campaign','findAll','options','raw','where','attributes','limit','map','include','model','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetCampaign'];(function(_0x494ae9,_0x19e61d){var _0x32e42e=function(_0x484ea6){while(--_0x484ea6){_0x494ae9['push'](_0x494ae9['shift']());}};_0x32e42e(++_0x19e61d);}(_0xda55,0x6d));var _0x5da5=function(_0x50aaae,_0xc8323e){_0x50aaae=_0x50aaae-0x0;var _0x43643b=_0xda55[_0x50aaae];return _0x43643b;};'use strict';var _=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5da5('0x2'));var fs=require('fs');var Redis=require(_0x5da5('0x3'));var db=require(_0x5da5('0x4'))['db'];var utils=require(_0x5da5('0x5'));var logger=require(_0x5da5('0x6'))('rpc');var config=require(_0x5da5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5da5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fd877,_0x267469,_0x71b187){return new BPromise(function(_0x46290d,_0x3debdf){return client[_0x5da5('0x9')](_0x2fd877,_0x71b187)[_0x5da5('0xa')](function(_0x302795){logger['info'](_0x5da5('0xb'),_0x267469,_0x5da5('0xc'));logger[_0x5da5('0xd')](_0x5da5('0xe'),_0x267469,_0x5da5('0xc'),JSON[_0x5da5('0xf')](_0x302795));if(_0x302795[_0x5da5('0x10')]){if(_0x302795['error'][_0x5da5('0x11')]===0x1f4){logger[_0x5da5('0x10')]('Campaign,\x20%s,\x20%s',_0x267469,_0x302795[_0x5da5('0x10')][_0x5da5('0x12')]);return _0x3debdf(_0x302795[_0x5da5('0x10')][_0x5da5('0x12')]);}logger[_0x5da5('0x10')](_0x5da5('0xb'),_0x267469,_0x302795['error']['message']);return _0x46290d(_0x302795['error'][_0x5da5('0x12')]);}else{logger[_0x5da5('0x13')](_0x5da5('0xb'),_0x267469,_0x5da5('0xc'));_0x46290d(_0x302795[_0x5da5('0x14')][_0x5da5('0x12')]);}})[_0x5da5('0x15')](function(_0x4a952a){logger[_0x5da5('0x10')](_0x5da5('0xb'),_0x267469,_0x4a952a);_0x3debdf(_0x4a952a);});});}exports[_0x5da5('0x16')]=function(_0x16b11f){var _0x3f7e98=this;return new Promise(function(_0x428b07,_0x547c58){return db[_0x5da5('0x17')][_0x5da5('0x18')]({'raw':_0x16b11f[_0x5da5('0x19')]?_0x16b11f[_0x5da5('0x19')][_0x5da5('0x1a')]===undefined?!![]:![]:!![],'where':_0x16b11f['options']?_0x16b11f[_0x5da5('0x19')][_0x5da5('0x1b')]||null:null,'attributes':_0x16b11f[_0x5da5('0x19')]?_0x16b11f['options'][_0x5da5('0x1c')]||null:null,'limit':_0x16b11f[_0x5da5('0x19')]?_0x16b11f[_0x5da5('0x19')][_0x5da5('0x1d')]||null:null,'include':_0x16b11f[_0x5da5('0x19')]?_0x16b11f[_0x5da5('0x19')]['include']?_[_0x5da5('0x1e')](_0x16b11f['options'][_0x5da5('0x1f')],function(_0x716ab7){return{'model':db[_0x716ab7[_0x5da5('0x20')]],'as':_0x716ab7['as'],'attributes':_0x716ab7['attributes'],'include':_0x716ab7[_0x5da5('0x1f')]?_[_0x5da5('0x1e')](_0x716ab7[_0x5da5('0x1f')],function(_0x21e795){return{'model':db[_0x21e795['model']],'as':_0x21e795['as'],'attributes':_0x21e795['attributes'],'include':_0x21e795['include']?_[_0x5da5('0x1e')](_0x21e795['include'],function(_0x4e8890){return{'model':db[_0x4e8890[_0x5da5('0x20')]],'as':_0x4e8890['as'],'attributes':_0x4e8890[_0x5da5('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1798ae){logger[_0x5da5('0x13')]('GetCampaign',_0x16b11f);logger[_0x5da5('0xd')](_0x5da5('0x16'),_0x16b11f,JSON[_0x5da5('0xf')](_0x1798ae));_0x428b07(_0x1798ae);})[_0x5da5('0x15')](function(_0x766ed9){logger['error'](_0x5da5('0x16'),_0x766ed9[_0x5da5('0x12')],_0x16b11f);_0x547c58(_0x3f7e98[_0x5da5('0x10')](0x1f4,_0x766ed9[_0x5da5('0x12')]));});});}; \ No newline at end of file +var _0x8128=['message','Campaign','findAll','raw','options','where','limit','include','model','attributes','map','then','GetCampaign','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x8128,0x1b1));var _0x8812=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x8128[_0x160c73];return _0xd9302;};'use strict';var _=require(_0x8812('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8812('0x1'));var rs=require(_0x8812('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8812('0x3'));var logger=require(_0x8812('0x4'))(_0x8812('0x5'));var config=require('../../config/environment');var jayson=require(_0x8812('0x6'));var client=jayson[_0x8812('0x7')][_0x8812('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x16bafa,_0x480d1f,_0xfdd696){return new BPromise(function(_0x3d030b,_0x4e5012){return client['request'](_0x16bafa,_0xfdd696)['then'](function(_0x2bc882){logger[_0x8812('0x9')](_0x8812('0xa'),_0x480d1f,_0x8812('0xb'));logger[_0x8812('0xc')](_0x8812('0xd'),_0x480d1f,_0x8812('0xb'),JSON[_0x8812('0xe')](_0x2bc882));if(_0x2bc882[_0x8812('0xf')]){if(_0x2bc882['error'][_0x8812('0x10')]===0x1f4){logger[_0x8812('0xf')](_0x8812('0xa'),_0x480d1f,_0x2bc882[_0x8812('0xf')][_0x8812('0x11')]);return _0x4e5012(_0x2bc882[_0x8812('0xf')]['message']);}logger[_0x8812('0xf')](_0x8812('0xa'),_0x480d1f,_0x2bc882[_0x8812('0xf')]['message']);return _0x3d030b(_0x2bc882['error'][_0x8812('0x11')]);}else{logger[_0x8812('0x9')]('Campaign,\x20%s,\x20%s',_0x480d1f,'request\x20sent');_0x3d030b(_0x2bc882['result']['message']);}})['catch'](function(_0xa2a8cc){logger['error'](_0x8812('0xa'),_0x480d1f,_0xa2a8cc);_0x4e5012(_0xa2a8cc);});});}exports['GetCampaign']=function(_0x447f9b){var _0x38a8ad=this;return new Promise(function(_0x4ae563,_0x23c224){return db[_0x8812('0x12')][_0x8812('0x13')]({'raw':_0x447f9b['options']?_0x447f9b['options'][_0x8812('0x14')]===undefined?!![]:![]:!![],'where':_0x447f9b[_0x8812('0x15')]?_0x447f9b[_0x8812('0x15')][_0x8812('0x16')]||null:null,'attributes':_0x447f9b[_0x8812('0x15')]?_0x447f9b[_0x8812('0x15')]['attributes']||null:null,'limit':_0x447f9b[_0x8812('0x15')]?_0x447f9b[_0x8812('0x15')][_0x8812('0x17')]||null:null,'include':_0x447f9b['options']?_0x447f9b[_0x8812('0x15')][_0x8812('0x18')]?_['map'](_0x447f9b[_0x8812('0x15')]['include'],function(_0x29572a){return{'model':db[_0x29572a[_0x8812('0x19')]],'as':_0x29572a['as'],'attributes':_0x29572a[_0x8812('0x1a')],'include':_0x29572a['include']?_[_0x8812('0x1b')](_0x29572a[_0x8812('0x18')],function(_0x115215){return{'model':db[_0x115215[_0x8812('0x19')]],'as':_0x115215['as'],'attributes':_0x115215['attributes'],'include':_0x115215[_0x8812('0x18')]?_[_0x8812('0x1b')](_0x115215[_0x8812('0x18')],function(_0x2015de){return{'model':db[_0x2015de[_0x8812('0x19')]],'as':_0x2015de['as'],'attributes':_0x2015de[_0x8812('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8812('0x1c')](function(_0x117a24){logger[_0x8812('0x9')](_0x8812('0x1d'),_0x447f9b);logger['debug']('GetCampaign',_0x447f9b,JSON['stringify'](_0x117a24));_0x4ae563(_0x117a24);})['catch'](function(_0x409738){logger[_0x8812('0xf')](_0x8812('0x1d'),_0x409738[_0x8812('0x11')],_0x447f9b);_0x23c224(_0x38a8ad[_0x8812('0xf')](0x1f4,_0x409738['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 3afe0a3..b299bdd 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 _0xbd94=['fs-extra','../../components/auth/service','../../config/environment','./campaign.controller','isAuthenticated','index','/:id','get','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','create','post','clone','addBlackLists','put','update','delete','destroy','removeLists','removeBlackLists','exports','multer','connect-timeout','Router'];(function(_0x1813d6,_0x5d7f16){var _0xcf7342=function(_0x51c572){while(--_0x51c572){_0x1813d6['push'](_0x1813d6['shift']());}};_0xcf7342(++_0x5d7f16);}(_0xbd94,0xfd));var _0x4bd9=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0xbd94[_0x56916d];return _0x2b7f1f;};'use strict';var multer=require(_0x4bd9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4bd9('0x1'));var express=require('express');var router=express[_0x4bd9('0x2')]();var fs_extra=require(_0x4bd9('0x3'));var auth=require(_0x4bd9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4bd9('0x5'));var controller=require(_0x4bd9('0x6'));router['get']('/',auth[_0x4bd9('0x7')](),controller[_0x4bd9('0x8')]);router['get'](_0x4bd9('0x9'),auth[_0x4bd9('0x7')](),controller['show']);router[_0x4bd9('0xa')](_0x4bd9('0xb'),auth[_0x4bd9('0x7')](),controller[_0x4bd9('0xc')]);router[_0x4bd9('0xa')](_0x4bd9('0xd'),auth[_0x4bd9('0x7')](),controller[_0x4bd9('0xe')]);router['get']('/:id/hopper_finals',auth['isAuthenticated'](),controller[_0x4bd9('0xf')]);router['get'](_0x4bd9('0x10'),auth['isAuthenticated'](),controller[_0x4bd9('0x11')]);router[_0x4bd9('0xa')](_0x4bd9('0x12'),auth[_0x4bd9('0x7')](),controller[_0x4bd9('0x13')]);router[_0x4bd9('0xa')](_0x4bd9('0x14'),auth['isAuthenticated'](),controller['getBlackLists']);router['post']('/',auth[_0x4bd9('0x7')](),controller[_0x4bd9('0x15')]);router[_0x4bd9('0x16')]('/:id/clone',auth[_0x4bd9('0x7')](),controller[_0x4bd9('0x17')]);router['post'](_0x4bd9('0x12'),auth['isAuthenticated'](),controller['addLists']);router['post'](_0x4bd9('0x14'),auth['isAuthenticated'](),controller[_0x4bd9('0x18')]);router[_0x4bd9('0x19')](_0x4bd9('0x9'),auth[_0x4bd9('0x7')](),controller[_0x4bd9('0x1a')]);router[_0x4bd9('0x1b')](_0x4bd9('0x9'),auth[_0x4bd9('0x7')](),controller[_0x4bd9('0x1c')]);router['delete'](_0x4bd9('0x12'),auth[_0x4bd9('0x7')](),controller[_0x4bd9('0x1d')]);router[_0x4bd9('0x1b')](_0x4bd9('0x14'),auth['isAuthenticated'](),controller[_0x4bd9('0x1e')]);module[_0x4bd9('0x1f')]=router; \ No newline at end of file +var _0xcb06=['/:id/hopper_black','getHopperBlacks','/:id/lists','/:id/blacklists','getBlackLists','post','/:id/clone','addLists','addBlackLists','put','update','delete','destroy','removeLists','removeBlackLists','exports','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals'];(function(_0x2bedf8,_0x27bf51){var _0x4babff=function(_0x1dbf06){while(--_0x1dbf06){_0x2bedf8['push'](_0x2bedf8['shift']());}};_0x4babff(++_0x27bf51);}(_0xcb06,0x127));var _0x6cb0=function(_0x24741a,_0x36a3f9){_0x24741a=_0x24741a-0x0;var _0x4d57ac=_0xcb06[_0x24741a];return _0x4d57ac;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x6cb0('0x0'));var express=require('express');var router=express[_0x6cb0('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x6cb0('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x6cb0('0x3'));var controller=require('./campaign.controller');router[_0x6cb0('0x4')]('/',auth[_0x6cb0('0x5')](),controller[_0x6cb0('0x6')]);router[_0x6cb0('0x4')](_0x6cb0('0x7'),auth[_0x6cb0('0x5')](),controller[_0x6cb0('0x8')]);router['get'](_0x6cb0('0x9'),auth[_0x6cb0('0x5')](),controller[_0x6cb0('0xa')]);router[_0x6cb0('0x4')](_0x6cb0('0xb'),auth[_0x6cb0('0x5')](),controller[_0x6cb0('0xc')]);router[_0x6cb0('0x4')](_0x6cb0('0xd'),auth[_0x6cb0('0x5')](),controller[_0x6cb0('0xe')]);router[_0x6cb0('0x4')](_0x6cb0('0xf'),auth['isAuthenticated'](),controller[_0x6cb0('0x10')]);router[_0x6cb0('0x4')](_0x6cb0('0x11'),auth[_0x6cb0('0x5')](),controller['getLists']);router[_0x6cb0('0x4')](_0x6cb0('0x12'),auth[_0x6cb0('0x5')](),controller[_0x6cb0('0x13')]);router[_0x6cb0('0x14')]('/',auth[_0x6cb0('0x5')](),controller['create']);router[_0x6cb0('0x14')](_0x6cb0('0x15'),auth[_0x6cb0('0x5')](),controller['clone']);router[_0x6cb0('0x14')](_0x6cb0('0x11'),auth[_0x6cb0('0x5')](),controller[_0x6cb0('0x16')]);router[_0x6cb0('0x14')](_0x6cb0('0x12'),auth['isAuthenticated'](),controller[_0x6cb0('0x17')]);router[_0x6cb0('0x18')](_0x6cb0('0x7'),auth[_0x6cb0('0x5')](),controller[_0x6cb0('0x19')]);router[_0x6cb0('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0x6cb0('0x1b')]);router[_0x6cb0('0x1a')]('/:id/lists',auth['isAuthenticated'](),controller[_0x6cb0('0x1c')]);router[_0x6cb0('0x1a')](_0x6cb0('0x12'),auth['isAuthenticated'](),controller[_0x6cb0('0x1d')]);module[_0x6cb0('0x1e')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index c97471e..e9027ab 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 _0x8d42=['sequelize','exports','STRING','TEXT','VIRTUAL','getDataValue'];(function(_0x489dd1,_0x3d4564){var _0x292b0f=function(_0x227ee6){while(--_0x227ee6){_0x489dd1['push'](_0x489dd1['shift']());}};_0x292b0f(++_0x3d4564);}(_0x8d42,0x1aa));var _0x28d4=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0x8d42[_0x139a3c];return _0x2b375b;};'use strict';var Sequelize=require(_0x28d4('0x0'));module[_0x28d4('0x1')]={'key':{'type':Sequelize[_0x28d4('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x28d4('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x28d4('0x2')]},'name':{'type':Sequelize[_0x28d4('0x4')],'get':function(){return this[_0x28d4('0x5')]('key');}}}; \ No newline at end of file +var _0x6a61=['getDataValue','key','exports','TEXT','STRING','VIRTUAL'];(function(_0xf55384,_0x110e80){var _0x444b0f=function(_0x4160af){while(--_0x4160af){_0xf55384['push'](_0xf55384['shift']());}};_0x444b0f(++_0x110e80);}(_0x6a61,0xb6));var _0x16a6=function(_0x1d9792,_0x329fb4){_0x1d9792=_0x1d9792-0x0;var _0x35a967=_0x6a61[_0x1d9792];return _0x35a967;};'use strict';var Sequelize=require('sequelize');module[_0x16a6('0x0')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x16a6('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x16a6('0x2')]},'name':{'type':Sequelize[_0x16a6('0x3')],'get':function(){return this[_0x16a6('0x4')](_0x16a6('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index d26f88f..f338a2a 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 _0x360f=['../../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','apply','save','then','destroy','CannedAnswers','UserProfileResource','stack','name','index','map','CannedAnswer','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','options','find','update','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis'];(function(_0x339d3c,_0x10d87f){var _0x460720=function(_0x464e8e){while(--_0x464e8e){_0x339d3c['push'](_0x339d3c['shift']());}};_0x460720(++_0x10d87f);}(_0x360f,0x1f3));var _0xf360=function(_0x54cc65,_0x20277a){_0x54cc65=_0x54cc65-0x0;var _0x4cdbcf=_0x360f[_0x54cc65];return _0x4cdbcf;};'use strict';var emlformat=require(_0xf360('0x0'));var rimraf=require(_0xf360('0x1'));var zipdir=require(_0xf360('0x2'));var jsonpatch=require(_0xf360('0x3'));var rp=require(_0xf360('0x4'));var moment=require(_0xf360('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf360('0x6'));var path=require(_0xf360('0x7'));var sox=require(_0xf360('0x8'));var csv=require(_0xf360('0x9'));var ejs=require(_0xf360('0xa'));var fs=require('fs');var fs_extra=require(_0xf360('0xb'));var _=require(_0xf360('0xc'));var squel=require(_0xf360('0xd'));var crypto=require('crypto');var jsforce=require(_0xf360('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf360('0x9'));var querystring=require('querystring');var Papa=require(_0xf360('0xf'));var Redis=require(_0xf360('0x10'));var authService=require(_0xf360('0x11'));var qs=require(_0xf360('0x12'));var as=require(_0xf360('0x13'));var hardwareService=require(_0xf360('0x14'));var logger=require(_0xf360('0x15'))(_0xf360('0x16'));var utils=require(_0xf360('0x17'));var config=require(_0xf360('0x18'));var licenseUtil=require(_0xf360('0x19'));var db=require(_0xf360('0x1a'))['db'];function respondWithStatusCode(_0x1d559b,_0x50bd36){_0x50bd36=_0x50bd36||0xcc;return function(_0x337484){if(_0x337484){return _0x1d559b[_0xf360('0x1b')](_0x50bd36);}return _0x1d559b[_0xf360('0x1c')](_0x50bd36)[_0xf360('0x1d')]();};}function respondWithResult(_0x53a220,_0x24703a){_0x24703a=_0x24703a||0xc8;return function(_0x3509cf){if(_0x3509cf){return _0x53a220[_0xf360('0x1c')](_0x24703a)[_0xf360('0x1e')](_0x3509cf);}};}function respondWithFilteredResult(_0x501526,_0x213664){return function(_0xfc869b){if(_0xfc869b){var _0x491a8a=typeof _0x213664[_0xf360('0x1f')]===_0xf360('0x20')&&typeof _0x213664['limit']==='undefined';var _0x2e241a=_0xfc869b[_0xf360('0x21')];var _0x576e72=_0x491a8a?0x0:_0x213664['offset'];var _0x3e7dd2=_0x491a8a?_0xfc869b[_0xf360('0x21')]:_0x213664[_0xf360('0x1f')]+_0x213664[_0xf360('0x22')];var _0x21212c;if(_0x3e7dd2>=_0x2e241a){_0x3e7dd2=_0x2e241a;_0x21212c=0xc8;}else{_0x21212c=0xce;}_0x501526['status'](_0x21212c);return _0x501526['set']('Content-Range',_0x576e72+'-'+_0x3e7dd2+'/'+_0x2e241a)[_0xf360('0x1e')](_0xfc869b);}return null;};}function patchUpdates(_0x10058f){return function(_0x2746c9){try{jsonpatch[_0xf360('0x23')](_0x2746c9,_0x10058f,!![]);}catch(_0x13f832){return BPromise['reject'](_0x13f832);}return _0x2746c9[_0xf360('0x24')]();};}function saveUpdates(_0x18259e,_0x22bb0e){return function(_0x5ca9d8){if(_0x5ca9d8){return _0x5ca9d8['update'](_0x18259e)[_0xf360('0x25')](function(_0x555e42){return _0x555e42;});}return null;};}function removeEntity(_0x4e5b13,_0x7d4147){return function(_0x2132f3){if(_0x2132f3){return _0x2132f3[_0xf360('0x26')]()[_0xf360('0x25')](function(){var _0x2658fb=_0x2132f3['get']({'plain':!![]});var _0x66ef85=_0xf360('0x27');return db[_0xf360('0x28')][_0xf360('0x26')]({'where':{'type':_0x66ef85,'resourceId':_0x2658fb['id']}})[_0xf360('0x25')](function(){return _0x2132f3;});})[_0xf360('0x25')](function(){_0x4e5b13[_0xf360('0x1c')](0xcc)[_0xf360('0x1d')]();});}};}function handleEntityNotFound(_0x2424a0,_0x72934a){return function(_0x52a01b){if(!_0x52a01b){_0x2424a0[_0xf360('0x1b')](0x194);}return _0x52a01b;};}function handleError(_0x1ece50,_0x4cc9bc){_0x4cc9bc=_0x4cc9bc||0x1f4;return function(_0x38facf){logger['error'](_0x38facf[_0xf360('0x29')]);if(_0x38facf[_0xf360('0x2a')]){delete _0x38facf[_0xf360('0x2a')];}_0x1ece50[_0xf360('0x1c')](_0x4cc9bc)['send'](_0x38facf);};}exports[_0xf360('0x2b')]=function(_0x43b183,_0x5449bd){var _0x53bc82={},_0x256c36={},_0x3f1559={'count':0x0,'rows':[]};var _0x8160fa=_[_0xf360('0x2c')](db[_0xf360('0x2d')][_0xf360('0x2e')],function(_0x419236){return{'name':_0x419236[_0xf360('0x2f')],'type':_0x419236['type'][_0xf360('0x30')]};});_0x256c36[_0xf360('0x31')]=_['map'](_0x8160fa,_0xf360('0x2a'));_0x256c36[_0xf360('0x32')]=_[_0xf360('0x33')](_0x43b183[_0xf360('0x32')]);_0x256c36[_0xf360('0x34')]=_[_0xf360('0x35')](_0x256c36[_0xf360('0x31')],_0x256c36[_0xf360('0x32')]);_0x53bc82['attributes']=_[_0xf360('0x35')](_0x256c36[_0xf360('0x31')],qs[_0xf360('0x36')](_0x43b183[_0xf360('0x32')][_0xf360('0x36')]));_0x53bc82[_0xf360('0x37')]=_0x53bc82[_0xf360('0x37')][_0xf360('0x38')]?_0x53bc82[_0xf360('0x37')]:_0x256c36[_0xf360('0x31')];if(!_0x43b183[_0xf360('0x32')]['hasOwnProperty'](_0xf360('0x39'))){_0x53bc82['limit']=qs[_0xf360('0x22')](_0x43b183['query'][_0xf360('0x22')]);_0x53bc82['offset']=qs[_0xf360('0x1f')](_0x43b183[_0xf360('0x32')][_0xf360('0x1f')]);}_0x53bc82[_0xf360('0x3a')]=qs[_0xf360('0x3b')](_0x43b183[_0xf360('0x32')][_0xf360('0x3b')]);_0x53bc82[_0xf360('0x3c')]=qs[_0xf360('0x34')](_[_0xf360('0x3d')](_0x43b183['query'],_0x256c36['filters']),_0x8160fa);if(_0x43b183['query'][_0xf360('0x3e')]){_0x53bc82[_0xf360('0x3c')]=_[_0xf360('0x3f')](_0x53bc82['where'],{'$or':[{'key':{'$like':'%'+_0x43b183['query'][_0xf360('0x3e')]+'%'}},{'value':{'$like':'%'+_0x43b183['query'][_0xf360('0x3e')]+'%'}}]});}_0x53bc82=_[_0xf360('0x3f')]({},_0x53bc82,_0x43b183['options']);var _0x59c836={'where':_0x53bc82[_0xf360('0x3c')]};return db[_0xf360('0x2d')][_0xf360('0x21')](_0x59c836)[_0xf360('0x25')](function(_0xcfd6ac){_0x3f1559['count']=_0xcfd6ac;if(_0x43b183['query'][_0xf360('0x40')]){_0x53bc82[_0xf360('0x41')]=[{'all':!![]}];}return db[_0xf360('0x2d')]['findAll'](_0x53bc82);})[_0xf360('0x25')](function(_0x24f2a7){_0x3f1559[_0xf360('0x42')]=_0x24f2a7;return _0x3f1559;})[_0xf360('0x25')](respondWithFilteredResult(_0x5449bd,_0x53bc82))[_0xf360('0x43')](handleError(_0x5449bd,null));};exports[_0xf360('0x44')]=function(_0xc76b28,_0x43859a){var _0x4d08d0={'raw':!![],'where':{'id':_0xc76b28['params']['id']}},_0x1302cf={};_0x1302cf[_0xf360('0x31')]=_[_0xf360('0x33')](db[_0xf360('0x2d')]['rawAttributes']);_0x1302cf[_0xf360('0x32')]=_[_0xf360('0x33')](_0xc76b28['query']);_0x1302cf['filters']=_[_0xf360('0x35')](_0x1302cf[_0xf360('0x31')],_0x1302cf['query']);_0x4d08d0[_0xf360('0x37')]=_[_0xf360('0x35')](_0x1302cf['model'],qs[_0xf360('0x36')](_0xc76b28[_0xf360('0x32')][_0xf360('0x36')]));_0x4d08d0[_0xf360('0x37')]=_0x4d08d0[_0xf360('0x37')]['length']?_0x4d08d0['attributes']:_0x1302cf[_0xf360('0x31')];if(_0xc76b28[_0xf360('0x32')][_0xf360('0x40')]){_0x4d08d0[_0xf360('0x41')]=[{'all':!![]}];}_0x4d08d0=_[_0xf360('0x3f')]({},_0x4d08d0,_0xc76b28[_0xf360('0x45')]);return db[_0xf360('0x2d')][_0xf360('0x46')](_0x4d08d0)[_0xf360('0x25')](handleEntityNotFound(_0x43859a,null))[_0xf360('0x25')](respondWithResult(_0x43859a,null))[_0xf360('0x43')](handleError(_0x43859a,null));};exports[_0xf360('0x47')]=function(_0x1ee9d3,_0x5ae05b){if(_0x1ee9d3[_0xf360('0x48')]['id']){delete _0x1ee9d3[_0xf360('0x48')]['id'];}return db[_0xf360('0x2d')]['find']({'where':{'id':_0x1ee9d3['params']['id']}})[_0xf360('0x25')](handleEntityNotFound(_0x5ae05b,null))[_0xf360('0x25')](saveUpdates(_0x1ee9d3[_0xf360('0x48')],null))[_0xf360('0x25')](respondWithResult(_0x5ae05b,null))[_0xf360('0x43')](handleError(_0x5ae05b,null));};exports[_0xf360('0x26')]=function(_0x3653c5,_0x245a53){return db[_0xf360('0x2d')][_0xf360('0x46')]({'where':{'id':_0x3653c5['params']['id']}})['then'](handleEntityNotFound(_0x245a53,null))[_0xf360('0x25')](removeEntity(_0x245a53,null))[_0xf360('0x43')](handleError(_0x245a53,null));};exports['create']=function(_0x512b9b,_0x58c770){var _0x286d5a={'key':_0x512b9b[_0xf360('0x48')][_0xf360('0x30')]};if(_0x512b9b[_0xf360('0x48')][_0xf360('0x49')]){_0x286d5a['MailAccountId']=_0x512b9b['body'][_0xf360('0x49')];}else if(_0x512b9b[_0xf360('0x48')][_0xf360('0x4a')]){_0x286d5a[_0xf360('0x4a')]=_0x512b9b[_0xf360('0x48')][_0xf360('0x4a')];}else if(_0x512b9b[_0xf360('0x48')][_0xf360('0x4b')]){_0x286d5a[_0xf360('0x4b')]=_0x512b9b['body'][_0xf360('0x4b')];}else if(_0x512b9b['body'][_0xf360('0x4c')]){_0x286d5a['ChatWebsiteId']=_0x512b9b[_0xf360('0x48')]['ChatWebsiteId'];}return db[_0xf360('0x2d')][_0xf360('0x46')]({'where':_0x286d5a})[_0xf360('0x25')](function(_0x3ea8ef){if(_0x3ea8ef){throw new db['Sequelize'][(_0xf360('0x4d'))](_0xf360('0x4e'));}return db[_0xf360('0x2d')][_0xf360('0x4f')](_0x512b9b[_0xf360('0x48')]);})[_0xf360('0x25')](function(_0x5f154c){var _0x4ca1ea=_0x512b9b[_0xf360('0x50')][_0xf360('0x51')]({'plain':!![]});if(!_0x4ca1ea)throw new Error(_0xf360('0x52'));if(_0x4ca1ea[_0xf360('0x53')]===_0xf360('0x50')){var _0x24812d=_0x5f154c['get']({'plain':!![]});return db['UserProfileSection'][_0xf360('0x46')]({'where':{'name':_0xf360('0x27'),'userProfileId':_0x4ca1ea[_0xf360('0x54')]},'raw':!![]})['then'](function(_0x2bd5c3){if(_0x2bd5c3&&_0x2bd5c3['autoAssociation']===0x0){return db[_0xf360('0x28')][_0xf360('0x4f')]({'name':_0x24812d[_0xf360('0x2a')],'resourceId':_0x24812d['id'],'type':_0x2bd5c3[_0xf360('0x2a')],'sectionId':_0x2bd5c3['id']},{})[_0xf360('0x25')](function(){return _0x5f154c;});}else{return _0x5f154c;}})[_0xf360('0x43')](function(_0xedd27){logger['error'](_0xf360('0x55'),_0xedd27);throw _0xedd27;});}return _0x5f154c;})['then'](respondWithResult(_0x58c770,0xc9))[_0xf360('0x43')](handleError(_0x58c770,null));}; \ No newline at end of file +var _0xc92a=['update','then','destroy','get','CannedAnswers','UserProfileResource','stack','name','index','map','rawAttributes','fieldName','type','key','filters','model','query','attributes','fields','length','nolimit','order','sort','pick','filter','merge','where','options','CannedAnswer','rows','show','params','keys','intersection','includeAll','include','catch','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','count','offset','Content-Range','apply','save'];(function(_0x14e3cf,_0x4c2a07){var _0x2db962=function(_0x39bc2d){while(--_0x39bc2d){_0x14e3cf['push'](_0x14e3cf['shift']());}};_0x2db962(++_0x4c2a07);}(_0xc92a,0xe7));var _0xac92=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xc92a[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0xac92('0x0'));var rimraf=require(_0xac92('0x1'));var zipdir=require(_0xac92('0x2'));var jsonpatch=require(_0xac92('0x3'));var rp=require(_0xac92('0x4'));var moment=require(_0xac92('0x5'));var BPromise=require(_0xac92('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xac92('0x7'));var sox=require(_0xac92('0x8'));var csv=require(_0xac92('0x9'));var ejs=require(_0xac92('0xa'));var fs=require('fs');var fs_extra=require(_0xac92('0xb'));var _=require(_0xac92('0xc'));var squel=require(_0xac92('0xd'));var crypto=require(_0xac92('0xe'));var jsforce=require(_0xac92('0xf'));var deskjs=require(_0xac92('0x10'));var toCsv=require(_0xac92('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xac92('0x11'));var authService=require(_0xac92('0x12'));var qs=require(_0xac92('0x13'));var as=require(_0xac92('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac92('0x15'))(_0xac92('0x16'));var utils=require('../../config/utils');var config=require(_0xac92('0x17'));var licenseUtil=require(_0xac92('0x18'));var db=require(_0xac92('0x19'))['db'];function respondWithStatusCode(_0x1305fd,_0x4c4033){_0x4c4033=_0x4c4033||0xcc;return function(_0x123924){if(_0x123924){return _0x1305fd['sendStatus'](_0x4c4033);}return _0x1305fd[_0xac92('0x1a')](_0x4c4033)[_0xac92('0x1b')]();};}function respondWithResult(_0x40baeb,_0x241560){_0x241560=_0x241560||0xc8;return function(_0x1eea06){if(_0x1eea06){return _0x40baeb['status'](_0x241560)[_0xac92('0x1c')](_0x1eea06);}};}function respondWithFilteredResult(_0x31cc00,_0x242a3b){return function(_0x1241bf){if(_0x1241bf){var _0x35d040=typeof _0x242a3b['offset']==='undefined'&&typeof _0x242a3b[_0xac92('0x1d')]===_0xac92('0x1e');var _0xc80c09=_0x1241bf[_0xac92('0x1f')];var _0x16c79b=_0x35d040?0x0:_0x242a3b['offset'];var _0x3eb6aa=_0x35d040?_0x1241bf['count']:_0x242a3b[_0xac92('0x20')]+_0x242a3b[_0xac92('0x1d')];var _0x15e419;if(_0x3eb6aa>=_0xc80c09){_0x3eb6aa=_0xc80c09;_0x15e419=0xc8;}else{_0x15e419=0xce;}_0x31cc00[_0xac92('0x1a')](_0x15e419);return _0x31cc00['set'](_0xac92('0x21'),_0x16c79b+'-'+_0x3eb6aa+'/'+_0xc80c09)[_0xac92('0x1c')](_0x1241bf);}return null;};}function patchUpdates(_0x11c1bd){return function(_0x1de9ed){try{jsonpatch[_0xac92('0x22')](_0x1de9ed,_0x11c1bd,!![]);}catch(_0x5f468d){return BPromise['reject'](_0x5f468d);}return _0x1de9ed[_0xac92('0x23')]();};}function saveUpdates(_0x41ff09,_0x5df7f7){return function(_0x3420d2){if(_0x3420d2){return _0x3420d2[_0xac92('0x24')](_0x41ff09)[_0xac92('0x25')](function(_0x52e395){return _0x52e395;});}return null;};}function removeEntity(_0x1312a3,_0x20b3f3){return function(_0x348be7){if(_0x348be7){return _0x348be7[_0xac92('0x26')]()[_0xac92('0x25')](function(){var _0x5aa1e9=_0x348be7[_0xac92('0x27')]({'plain':!![]});var _0x5df8d3=_0xac92('0x28');return db[_0xac92('0x29')][_0xac92('0x26')]({'where':{'type':_0x5df8d3,'resourceId':_0x5aa1e9['id']}})[_0xac92('0x25')](function(){return _0x348be7;});})[_0xac92('0x25')](function(){_0x1312a3['status'](0xcc)[_0xac92('0x1b')]();});}};}function handleEntityNotFound(_0x131e27,_0x33012f){return function(_0x19728a){if(!_0x19728a){_0x131e27['sendStatus'](0x194);}return _0x19728a;};}function handleError(_0x40b839,_0x42b2c7){_0x42b2c7=_0x42b2c7||0x1f4;return function(_0x57764d){logger['error'](_0x57764d[_0xac92('0x2a')]);if(_0x57764d[_0xac92('0x2b')]){delete _0x57764d[_0xac92('0x2b')];}_0x40b839[_0xac92('0x1a')](_0x42b2c7)['send'](_0x57764d);};}exports[_0xac92('0x2c')]=function(_0xec4db5,_0x1a6b09){var _0x59bef3={},_0x2f6df3={},_0xde4410={'count':0x0,'rows':[]};var _0x1cf1b0=_[_0xac92('0x2d')](db['CannedAnswer'][_0xac92('0x2e')],function(_0x5e55da){return{'name':_0x5e55da[_0xac92('0x2f')],'type':_0x5e55da[_0xac92('0x30')][_0xac92('0x31')]};});_0x2f6df3['model']=_[_0xac92('0x2d')](_0x1cf1b0,_0xac92('0x2b'));_0x2f6df3['query']=_['keys'](_0xec4db5['query']);_0x2f6df3[_0xac92('0x32')]=_['intersection'](_0x2f6df3[_0xac92('0x33')],_0x2f6df3[_0xac92('0x34')]);_0x59bef3[_0xac92('0x35')]=_['intersection'](_0x2f6df3[_0xac92('0x33')],qs[_0xac92('0x36')](_0xec4db5[_0xac92('0x34')][_0xac92('0x36')]));_0x59bef3[_0xac92('0x35')]=_0x59bef3[_0xac92('0x35')][_0xac92('0x37')]?_0x59bef3[_0xac92('0x35')]:_0x2f6df3[_0xac92('0x33')];if(!_0xec4db5['query']['hasOwnProperty'](_0xac92('0x38'))){_0x59bef3[_0xac92('0x1d')]=qs['limit'](_0xec4db5[_0xac92('0x34')]['limit']);_0x59bef3[_0xac92('0x20')]=qs[_0xac92('0x20')](_0xec4db5['query'][_0xac92('0x20')]);}_0x59bef3[_0xac92('0x39')]=qs[_0xac92('0x3a')](_0xec4db5['query'][_0xac92('0x3a')]);_0x59bef3['where']=qs[_0xac92('0x32')](_[_0xac92('0x3b')](_0xec4db5[_0xac92('0x34')],_0x2f6df3[_0xac92('0x32')]),_0x1cf1b0);if(_0xec4db5[_0xac92('0x34')][_0xac92('0x3c')]){_0x59bef3['where']=_[_0xac92('0x3d')](_0x59bef3[_0xac92('0x3e')],{'$or':[{'key':{'$like':'%'+_0xec4db5['query']['filter']+'%'}},{'value':{'$like':'%'+_0xec4db5[_0xac92('0x34')][_0xac92('0x3c')]+'%'}}]});}_0x59bef3=_[_0xac92('0x3d')]({},_0x59bef3,_0xec4db5[_0xac92('0x3f')]);var _0x1823a1={'where':_0x59bef3[_0xac92('0x3e')]};return db[_0xac92('0x40')][_0xac92('0x1f')](_0x1823a1)[_0xac92('0x25')](function(_0xdcfee9){_0xde4410['count']=_0xdcfee9;if(_0xec4db5[_0xac92('0x34')]['includeAll']){_0x59bef3['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x59bef3);})['then'](function(_0x5d1c62){_0xde4410[_0xac92('0x41')]=_0x5d1c62;return _0xde4410;})[_0xac92('0x25')](respondWithFilteredResult(_0x1a6b09,_0x59bef3))['catch'](handleError(_0x1a6b09,null));};exports[_0xac92('0x42')]=function(_0x4abeb6,_0x5e272f){var _0x44343c={'raw':!![],'where':{'id':_0x4abeb6[_0xac92('0x43')]['id']}},_0x2020ca={};_0x2020ca[_0xac92('0x33')]=_[_0xac92('0x44')](db[_0xac92('0x40')][_0xac92('0x2e')]);_0x2020ca[_0xac92('0x34')]=_['keys'](_0x4abeb6[_0xac92('0x34')]);_0x2020ca['filters']=_[_0xac92('0x45')](_0x2020ca[_0xac92('0x33')],_0x2020ca[_0xac92('0x34')]);_0x44343c['attributes']=_[_0xac92('0x45')](_0x2020ca[_0xac92('0x33')],qs[_0xac92('0x36')](_0x4abeb6[_0xac92('0x34')][_0xac92('0x36')]));_0x44343c[_0xac92('0x35')]=_0x44343c[_0xac92('0x35')][_0xac92('0x37')]?_0x44343c[_0xac92('0x35')]:_0x2020ca['model'];if(_0x4abeb6['query'][_0xac92('0x46')]){_0x44343c[_0xac92('0x47')]=[{'all':!![]}];}_0x44343c=_['merge']({},_0x44343c,_0x4abeb6[_0xac92('0x3f')]);return db[_0xac92('0x40')]['find'](_0x44343c)[_0xac92('0x25')](handleEntityNotFound(_0x5e272f,null))[_0xac92('0x25')](respondWithResult(_0x5e272f,null))[_0xac92('0x48')](handleError(_0x5e272f,null));};exports[_0xac92('0x24')]=function(_0x3fcc6a,_0x28d5b7){if(_0x3fcc6a[_0xac92('0x49')]['id']){delete _0x3fcc6a[_0xac92('0x49')]['id'];}return db[_0xac92('0x40')][_0xac92('0x4a')]({'where':{'id':_0x3fcc6a[_0xac92('0x43')]['id']}})[_0xac92('0x25')](handleEntityNotFound(_0x28d5b7,null))[_0xac92('0x25')](saveUpdates(_0x3fcc6a[_0xac92('0x49')],null))['then'](respondWithResult(_0x28d5b7,null))['catch'](handleError(_0x28d5b7,null));};exports[_0xac92('0x26')]=function(_0x511a04,_0x36e884){return db['CannedAnswer']['find']({'where':{'id':_0x511a04['params']['id']}})[_0xac92('0x25')](handleEntityNotFound(_0x36e884,null))['then'](removeEntity(_0x36e884,null))[_0xac92('0x48')](handleError(_0x36e884,null));};exports[_0xac92('0x4b')]=function(_0x4bf663,_0x511e21){var _0x2daab9={'key':_0x4bf663['body'][_0xac92('0x31')]};if(_0x4bf663[_0xac92('0x49')][_0xac92('0x4c')]){_0x2daab9['MailAccountId']=_0x4bf663[_0xac92('0x49')][_0xac92('0x4c')];}else if(_0x4bf663[_0xac92('0x49')]['SmsAccountId']){_0x2daab9[_0xac92('0x4d')]=_0x4bf663['body'][_0xac92('0x4d')];}else if(_0x4bf663['body'][_0xac92('0x4e')]){_0x2daab9[_0xac92('0x4e')]=_0x4bf663['body'][_0xac92('0x4e')];}else if(_0x4bf663[_0xac92('0x49')][_0xac92('0x4f')]){_0x2daab9[_0xac92('0x4f')]=_0x4bf663[_0xac92('0x49')][_0xac92('0x4f')];}return db[_0xac92('0x40')][_0xac92('0x4a')]({'where':_0x2daab9})['then'](function(_0x3a6ad8){if(_0x3a6ad8){throw new db['Sequelize'][(_0xac92('0x50'))](_0xac92('0x51'));}return db[_0xac92('0x40')]['create'](_0x4bf663[_0xac92('0x49')]);})[_0xac92('0x25')](function(_0x3abcd0){var _0xe36d4=_0x4bf663['user'][_0xac92('0x27')]({'plain':!![]});if(!_0xe36d4)throw new Error(_0xac92('0x52'));if(_0xe36d4[_0xac92('0x53')]===_0xac92('0x54')){var _0x35ec5f=_0x3abcd0[_0xac92('0x27')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xac92('0x28'),'userProfileId':_0xe36d4[_0xac92('0x55')]},'raw':!![]})['then'](function(_0x4cdab5){if(_0x4cdab5&&_0x4cdab5[_0xac92('0x56')]===0x0){return db[_0xac92('0x29')][_0xac92('0x4b')]({'name':_0x35ec5f[_0xac92('0x2b')],'resourceId':_0x35ec5f['id'],'type':_0x4cdab5['name'],'sectionId':_0x4cdab5['id']},{})[_0xac92('0x25')](function(){return _0x3abcd0;});}else{return _0x3abcd0;}})[_0xac92('0x48')](function(_0x24170d){logger[_0xac92('0x57')](_0xac92('0x58'),_0x24170d);throw _0x24170d;});}return _0x3abcd0;})[_0xac92('0x25')](respondWithResult(_0x511e21,0xc9))[_0xac92('0x48')](handleError(_0x511e21,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index fed9fb2..68b9ee2 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 _0x64e1=['utf8mb4_unicode_ci','lodash','util','bluebird','request-promise','rimraf','../../config/environment','exports','define','CannedAnswer','tools_canned_answers','utf8mb4'];(function(_0x14e55f,_0x59858c){var _0x2a8f28=function(_0x3f6956){while(--_0x3f6956){_0x14e55f['push'](_0x14e55f['shift']());}};_0x2a8f28(++_0x59858c);}(_0x64e1,0x9d));var _0x164e=function(_0x245b57,_0x420f33){_0x245b57=_0x245b57-0x0;var _0x1d07d9=_0x64e1[_0x245b57];return _0x1d07d9;};'use strict';var _=require(_0x164e('0x0'));var util=require(_0x164e('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x164e('0x2'));var rp=require(_0x164e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x164e('0x4'));var config=require(_0x164e('0x5'));var attributes=require('./cannedAnswer.attributes');module[_0x164e('0x6')]=function(_0x67fe94,_0xed8b56){return _0x67fe94[_0x164e('0x7')](_0x164e('0x8'),attributes,{'tableName':_0x164e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x164e('0xa'),'collate':_0x164e('0xb')});}; \ No newline at end of file +var _0x3505=['utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','CannedAnswer','tools_canned_answers'];(function(_0x53454f,_0x4dc272){var _0x2134a2=function(_0x408a51){while(--_0x408a51){_0x53454f['push'](_0x53454f['shift']());}};_0x2134a2(++_0x4dc272);}(_0x3505,0x10a));var _0x5350=function(_0x475a6d,_0x4e1cf6){_0x475a6d=_0x475a6d-0x0;var _0x3d84e5=_0x3505[_0x475a6d];return _0x3d84e5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5350('0x0'))('api');var moment=require(_0x5350('0x1'));var BPromise=require(_0x5350('0x2'));var rp=require(_0x5350('0x3'));var fs=require('fs');var path=require(_0x5350('0x4'));var rimraf=require(_0x5350('0x5'));var config=require(_0x5350('0x6'));var attributes=require('./cannedAnswer.attributes');module['exports']=function(_0x569c07,_0x4af2ba){return _0x569c07[_0x5350('0x7')](_0x5350('0x8'),attributes,{'tableName':_0x5350('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5350('0xa'),'collate':_0x5350('0xb')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 5c4368b..f939733 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(_0x2bd887,_0x598616){var _0x2e3554=function(_0x146678){while(--_0x146678){_0x2bd887['push'](_0x2bd887['shift']());}};_0x2e3554(++_0x598616);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','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(_0x92d13,_0xa5a945){var _0x435c39=function(_0x2beb34){while(--_0x2beb34){_0x92d13['push'](_0x92d13['shift']());}};_0x435c39(++_0xa5a945);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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 15bab8f..ec9b9f6 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 _0x583a=['index','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated'];(function(_0x36f270,_0x852d4){var _0x289124=function(_0x132caf){while(--_0x132caf){_0x36f270['push'](_0x36f270['shift']());}};_0x289124(++_0x852d4);}(_0x583a,0x15d));var _0xa583=function(_0x1488cd,_0x25a893){_0x1488cd=_0x1488cd-0x0;var _0x63fa13=_0x583a[_0x1488cd];return _0x63fa13;};'use strict';var multer=require(_0xa583('0x0'));var util=require(_0xa583('0x1'));var path=require(_0xa583('0x2'));var timeout=require('connect-timeout');var express=require(_0xa583('0x3'));var router=express['Router']();var fs_extra=require(_0xa583('0x4'));var auth=require(_0xa583('0x5'));var interaction=require(_0xa583('0x6'));var config=require(_0xa583('0x7'));var controller=require(_0xa583('0x8'));router[_0xa583('0x9')]('/',auth[_0xa583('0xa')](),controller[_0xa583('0xb')]);router[_0xa583('0x9')](_0xa583('0xc'),auth[_0xa583('0xa')](),controller[_0xa583('0xd')]);router[_0xa583('0xe')]('/',auth[_0xa583('0xa')](),controller[_0xa583('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xa583('0x10')]);router[_0xa583('0x11')](_0xa583('0xc'),auth[_0xa583('0xa')](),controller[_0xa583('0x12')]);module[_0xa583('0x13')]=router; \ No newline at end of file +var _0xcdb5=['../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x21d4c1,_0x254248){var _0x490aae=function(_0x531c66){while(--_0x531c66){_0x21d4c1['push'](_0x21d4c1['shift']());}};_0x490aae(++_0x254248);}(_0xcdb5,0x13d));var _0x5cdb=function(_0x129c27,_0x333c44){_0x129c27=_0x129c27-0x0;var _0x5a8017=_0xcdb5[_0x129c27];return _0x5a8017;};'use strict';var multer=require('multer');var util=require(_0x5cdb('0x0'));var path=require(_0x5cdb('0x1'));var timeout=require(_0x5cdb('0x2'));var express=require(_0x5cdb('0x3'));var router=express['Router']();var fs_extra=require(_0x5cdb('0x4'));var auth=require(_0x5cdb('0x5'));var interaction=require(_0x5cdb('0x6'));var config=require(_0x5cdb('0x7'));var controller=require('./cannedAnswer.controller');router[_0x5cdb('0x8')]('/',auth['isAuthenticated'](),controller[_0x5cdb('0x9')]);router['get'](_0x5cdb('0xa'),auth[_0x5cdb('0xb')](),controller[_0x5cdb('0xc')]);router[_0x5cdb('0xd')]('/',auth['isAuthenticated'](),controller[_0x5cdb('0xe')]);router[_0x5cdb('0xf')](_0x5cdb('0xa'),auth['isAuthenticated'](),controller[_0x5cdb('0x10')]);router[_0x5cdb('0x11')](_0x5cdb('0xa'),auth[_0x5cdb('0xb')](),controller['destroy']);module[_0x5cdb('0x12')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 4ade519..c633092 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 _0xcff8=['INTEGER','sequelize','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x19d350,_0x3c843f){var _0x3bfc8d=function(_0xd89003){while(--_0xd89003){_0x19d350['push'](_0x19d350['shift']());}};_0x3bfc8d(++_0x3c843f);}(_0xcff8,0x14b));var _0x8cff=function(_0x328329,_0x19bd83){_0x328329=_0x328329-0x0;var _0x90eb29=_0xcff8[_0x328329];return _0x90eb29;};'use strict';var Sequelize=require(_0x8cff('0x0'));module['exports']={'calldate':{'type':Sequelize[_0x8cff('0x1')],'allowNull':![],'defaultValue':_0x8cff('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x8cff('0x3')]},'dst':{'type':Sequelize[_0x8cff('0x3')]},'dcontext':{'type':Sequelize[_0x8cff('0x3')]},'channel':{'type':Sequelize[_0x8cff('0x3')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x8cff('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x8cff('0x3')]},'amaflags':{'type':Sequelize[_0x8cff('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x8cff('0x3')]},'userfield':{'type':Sequelize[_0x8cff('0x3')]},'uniqueid':{'type':Sequelize[_0x8cff('0x3')]},'linkedid':{'type':Sequelize[_0x8cff('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x8cff('0x3')]},'type':{'type':Sequelize[_0x8cff('0x3')]},'tag':{'type':Sequelize[_0x8cff('0x3')]}}; \ No newline at end of file +var _0xa83a=['exports','DATE','STRING','INTEGER'];(function(_0x401234,_0xfd4275){var _0x12842c=function(_0x1286df){while(--_0x1286df){_0x401234['push'](_0x401234['shift']());}};_0x12842c(++_0xfd4275);}(_0xa83a,0x88));var _0xaa83=function(_0x2eedc8,_0xcfc090){_0x2eedc8=_0x2eedc8-0x0;var _0x1906b3=_0xa83a[_0x2eedc8];return _0x1906b3;};'use strict';var Sequelize=require('sequelize');module[_0xaa83('0x0')]={'calldate':{'type':Sequelize[_0xaa83('0x1')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0xaa83('0x2')]},'src':{'type':Sequelize[_0xaa83('0x2')]},'dst':{'type':Sequelize[_0xaa83('0x2')]},'dcontext':{'type':Sequelize[_0xaa83('0x2')]},'channel':{'type':Sequelize[_0xaa83('0x2')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0xaa83('0x2')]},'lastdata':{'type':Sequelize[_0xaa83('0x2')]},'duration':{'type':Sequelize[_0xaa83('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xaa83('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xaa83('0x2')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xaa83('0x2')]},'linkedid':{'type':Sequelize[_0xaa83('0x2')]},'sequence':{'type':Sequelize[_0xaa83('0x2')]},'peeraccount':{'type':Sequelize[_0xaa83('0x2')]},'type':{'type':Sequelize[_0xaa83('0x2')]},'tag':{'type':Sequelize[_0xaa83('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index bde4046..7d1706c 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 _0x1dcc=['then','destroy','error','stack','name','send','map','Cdr','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','type','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','limit','offset','set','Content-Range','reject','save','update'];(function(_0x1bca14,_0x2db9d8){var _0x348df5=function(_0x41a801){while(--_0x41a801){_0x1bca14['push'](_0x1bca14['shift']());}};_0x348df5(++_0x2db9d8);}(_0x1dcc,0x1ea));var _0xc1dc=function(_0x34f221,_0x20cdfe){_0x34f221=_0x34f221-0x0;var _0x22666a=_0x1dcc[_0x34f221];return _0x22666a;};'use strict';var emlformat=require(_0xc1dc('0x0'));var rimraf=require(_0xc1dc('0x1'));var zipdir=require(_0xc1dc('0x2'));var jsonpatch=require(_0xc1dc('0x3'));var rp=require('request-promise');var moment=require(_0xc1dc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc1dc('0x5'));var util=require(_0xc1dc('0x6'));var path=require(_0xc1dc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc1dc('0x8'));var fs=require('fs');var fs_extra=require(_0xc1dc('0x9'));var _=require(_0xc1dc('0xa'));var squel=require('squel');var crypto=require(_0xc1dc('0xb'));var jsforce=require(_0xc1dc('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc1dc('0xd'));var querystring=require('querystring');var Papa=require(_0xc1dc('0xe'));var Redis=require('ioredis');var authService=require(_0xc1dc('0xf'));var qs=require(_0xc1dc('0x10'));var as=require(_0xc1dc('0x11'));var hardwareService=require(_0xc1dc('0x12'));var logger=require(_0xc1dc('0x13'))(_0xc1dc('0x14'));var utils=require(_0xc1dc('0x15'));var config=require(_0xc1dc('0x16'));var licenseUtil=require(_0xc1dc('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x226ba3,_0x2c5f41){_0x2c5f41=_0x2c5f41||0xcc;return function(_0xb7e667){if(_0xb7e667){return _0x226ba3['sendStatus'](_0x2c5f41);}return _0x226ba3[_0xc1dc('0x18')](_0x2c5f41)[_0xc1dc('0x19')]();};}function respondWithResult(_0x299520,_0xd51b1e){_0xd51b1e=_0xd51b1e||0xc8;return function(_0x145708){if(_0x145708){return _0x299520[_0xc1dc('0x18')](_0xd51b1e)[_0xc1dc('0x1a')](_0x145708);}};}function respondWithFilteredResult(_0x21aed1,_0x265929){return function(_0x37b23a){if(_0x37b23a){var _0x1cbbfe=typeof _0x265929['offset']===_0xc1dc('0x1b')&&typeof _0x265929[_0xc1dc('0x1c')]===_0xc1dc('0x1b');var _0x3d3315=_0x37b23a['count'];var _0x332400=_0x1cbbfe?0x0:_0x265929[_0xc1dc('0x1d')];var _0x499a42=_0x1cbbfe?_0x37b23a['count']:_0x265929[_0xc1dc('0x1d')]+_0x265929[_0xc1dc('0x1c')];var _0x197941;if(_0x499a42>=_0x3d3315){_0x499a42=_0x3d3315;_0x197941=0xc8;}else{_0x197941=0xce;}_0x21aed1[_0xc1dc('0x18')](_0x197941);return _0x21aed1[_0xc1dc('0x1e')](_0xc1dc('0x1f'),_0x332400+'-'+_0x499a42+'/'+_0x3d3315)[_0xc1dc('0x1a')](_0x37b23a);}return null;};}function patchUpdates(_0xd5a2e){return function(_0x5762e5){try{jsonpatch['apply'](_0x5762e5,_0xd5a2e,!![]);}catch(_0x4efe0d){return BPromise[_0xc1dc('0x20')](_0x4efe0d);}return _0x5762e5[_0xc1dc('0x21')]();};}function saveUpdates(_0x47af1e,_0x367965){return function(_0x19325f){if(_0x19325f){return _0x19325f[_0xc1dc('0x22')](_0x47af1e)[_0xc1dc('0x23')](function(_0x22b80d){return _0x22b80d;});}return null;};}function removeEntity(_0x2944a2,_0x353bf3){return function(_0x18ba56){if(_0x18ba56){return _0x18ba56[_0xc1dc('0x24')]()[_0xc1dc('0x23')](function(){_0x2944a2['status'](0xcc)[_0xc1dc('0x19')]();});}};}function handleEntityNotFound(_0xfeb0b1,_0x17ce2b){return function(_0x52b0b9){if(!_0x52b0b9){_0xfeb0b1['sendStatus'](0x194);}return _0x52b0b9;};}function handleError(_0x296523,_0x109e88){_0x109e88=_0x109e88||0x1f4;return function(_0xfd3f88){logger[_0xc1dc('0x25')](_0xfd3f88[_0xc1dc('0x26')]);if(_0xfd3f88[_0xc1dc('0x27')]){delete _0xfd3f88[_0xc1dc('0x27')];}_0x296523[_0xc1dc('0x18')](_0x109e88)[_0xc1dc('0x28')](_0xfd3f88);};}exports['index']=function(_0x2d5a57,_0x25b7bf){var _0xd77537={},_0x27e54d={},_0x52b0ff={'count':0x0,'rows':[]};var _0x4750a9=_[_0xc1dc('0x29')](db[_0xc1dc('0x2a')][_0xc1dc('0x2b')],function(_0x1182a4){return{'name':_0x1182a4[_0xc1dc('0x2c')],'type':_0x1182a4['type'][_0xc1dc('0x2d')]};});_0x27e54d[_0xc1dc('0x2e')]=_[_0xc1dc('0x29')](_0x4750a9,_0xc1dc('0x27'));_0x27e54d[_0xc1dc('0x2f')]=_[_0xc1dc('0x30')](_0x2d5a57[_0xc1dc('0x2f')]);_0x27e54d[_0xc1dc('0x31')]=_[_0xc1dc('0x32')](_0x27e54d['model'],_0x27e54d['query']);_0xd77537[_0xc1dc('0x33')]=_[_0xc1dc('0x32')](_0x27e54d[_0xc1dc('0x2e')],qs[_0xc1dc('0x34')](_0x2d5a57[_0xc1dc('0x2f')][_0xc1dc('0x34')]));_0xd77537['attributes']=_0xd77537[_0xc1dc('0x33')][_0xc1dc('0x35')]?_0xd77537['attributes']:_0x27e54d[_0xc1dc('0x2e')];if(!_0x2d5a57[_0xc1dc('0x2f')]['hasOwnProperty'](_0xc1dc('0x36'))){_0xd77537[_0xc1dc('0x1c')]=qs[_0xc1dc('0x1c')](_0x2d5a57['query'][_0xc1dc('0x1c')]);_0xd77537[_0xc1dc('0x1d')]=qs[_0xc1dc('0x1d')](_0x2d5a57[_0xc1dc('0x2f')][_0xc1dc('0x1d')]);}_0xd77537[_0xc1dc('0x37')]=qs[_0xc1dc('0x38')](_0x2d5a57[_0xc1dc('0x2f')][_0xc1dc('0x38')]);_0xd77537['where']=qs[_0xc1dc('0x31')](_[_0xc1dc('0x39')](_0x2d5a57[_0xc1dc('0x2f')],_0x27e54d['filters']),_0x4750a9);if(_0x2d5a57[_0xc1dc('0x2f')][_0xc1dc('0x3a')]){_0xd77537[_0xc1dc('0x3b')]=_[_0xc1dc('0x3c')](_0xd77537[_0xc1dc('0x3b')],{'$or':_[_0xc1dc('0x29')](_0x4750a9,function(_0x2e8d34){if(_0x2e8d34[_0xc1dc('0x3d')]!=='VIRTUAL'){var _0x16356d={};_0x16356d[_0x2e8d34[_0xc1dc('0x27')]]={'$like':'%'+_0x2d5a57[_0xc1dc('0x2f')][_0xc1dc('0x3a')]+'%'};return _0x16356d;}})});}_0xd77537=_[_0xc1dc('0x3c')]({},_0xd77537,_0x2d5a57[_0xc1dc('0x3e')]);var _0x503ec8={'where':_0xd77537[_0xc1dc('0x3b')]};return db[_0xc1dc('0x2a')][_0xc1dc('0x3f')](_0x503ec8)[_0xc1dc('0x23')](function(_0x1bcf3d){_0x52b0ff['count']=_0x1bcf3d;if(_0x2d5a57['query'][_0xc1dc('0x40')]){_0xd77537[_0xc1dc('0x41')]=[{'all':!![]}];}return db[_0xc1dc('0x2a')][_0xc1dc('0x42')](_0xd77537);})[_0xc1dc('0x23')](function(_0x2b4190){_0x52b0ff[_0xc1dc('0x43')]=_0x2b4190;return _0x52b0ff;})['then'](respondWithFilteredResult(_0x25b7bf,_0xd77537))[_0xc1dc('0x44')](handleError(_0x25b7bf,null));};exports[_0xc1dc('0x45')]=function(_0xe5c170,_0x4f99ea){var _0x402d3a={'raw':!![],'where':{'id':_0xe5c170[_0xc1dc('0x46')]['id']}},_0x2f52f7={};_0x2f52f7[_0xc1dc('0x2e')]=_['keys'](db['Cdr'][_0xc1dc('0x2b')]);_0x2f52f7[_0xc1dc('0x2f')]=_['keys'](_0xe5c170[_0xc1dc('0x2f')]);_0x2f52f7[_0xc1dc('0x31')]=_[_0xc1dc('0x32')](_0x2f52f7[_0xc1dc('0x2e')],_0x2f52f7[_0xc1dc('0x2f')]);_0x402d3a[_0xc1dc('0x33')]=_[_0xc1dc('0x32')](_0x2f52f7['model'],qs['fields'](_0xe5c170[_0xc1dc('0x2f')]['fields']));_0x402d3a[_0xc1dc('0x33')]=_0x402d3a[_0xc1dc('0x33')][_0xc1dc('0x35')]?_0x402d3a[_0xc1dc('0x33')]:_0x2f52f7[_0xc1dc('0x2e')];if(_0xe5c170[_0xc1dc('0x2f')][_0xc1dc('0x40')]){_0x402d3a[_0xc1dc('0x41')]=[{'all':!![]}];}_0x402d3a=_['merge']({},_0x402d3a,_0xe5c170[_0xc1dc('0x3e')]);return db[_0xc1dc('0x2a')][_0xc1dc('0x47')](_0x402d3a)[_0xc1dc('0x23')](handleEntityNotFound(_0x4f99ea,null))[_0xc1dc('0x23')](respondWithResult(_0x4f99ea,null))[_0xc1dc('0x44')](handleError(_0x4f99ea,null));};exports[_0xc1dc('0x48')]=function(_0x9a48b7,_0x2ca7f1){return db[_0xc1dc('0x2a')]['create'](_0x9a48b7['body'],{})['then'](respondWithResult(_0x2ca7f1,0xc9))[_0xc1dc('0x44')](handleError(_0x2ca7f1,null));};exports[_0xc1dc('0x22')]=function(_0x57b792,_0x129e23){if(_0x57b792[_0xc1dc('0x49')]['id']){delete _0x57b792['body']['id'];}return db[_0xc1dc('0x2a')]['find']({'where':{'id':_0x57b792[_0xc1dc('0x46')]['id']}})[_0xc1dc('0x23')](handleEntityNotFound(_0x129e23,null))[_0xc1dc('0x23')](saveUpdates(_0x57b792[_0xc1dc('0x49')],null))[_0xc1dc('0x23')](respondWithResult(_0x129e23,null))[_0xc1dc('0x44')](handleError(_0x129e23,null));};exports[_0xc1dc('0x24')]=function(_0x34667b,_0x4d4240){return db[_0xc1dc('0x2a')][_0xc1dc('0x47')]({'where':{'id':_0x34667b[_0xc1dc('0x46')]['id']}})[_0xc1dc('0x23')](handleEntityNotFound(_0x4d4240,null))['then'](removeEntity(_0x4d4240,null))[_0xc1dc('0x44')](handleError(_0x4d4240,null));};exports[_0xc1dc('0x4a')]=function(_0x3e3e6c,_0x1755cb){return db[_0xc1dc('0x2a')][_0xc1dc('0x4a')]()[_0xc1dc('0x23')](respondWithResult(_0x1755cb,null))[_0xc1dc('0x44')](handleError(_0x1755cb,null));}; \ No newline at end of file +var _0x3eea=['length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','keys','intersection','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','Cdr','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields'];(function(_0x467cb0,_0x303070){var _0x2153f7=function(_0x51775a){while(--_0x51775a){_0x467cb0['push'](_0x467cb0['shift']());}};_0x2153f7(++_0x303070);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x347491,_0x27c566){_0x347491=_0x347491-0x0;var _0x3532d2=_0x3eea[_0x347491];return _0x3532d2;};'use strict';var emlformat=require(_0xa3ee('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa3ee('0x1'));var jsonpatch=require(_0xa3ee('0x2'));var rp=require(_0xa3ee('0x3'));var moment=require(_0xa3ee('0x4'));var BPromise=require(_0xa3ee('0x5'));var Mustache=require(_0xa3ee('0x6'));var util=require(_0xa3ee('0x7'));var path=require(_0xa3ee('0x8'));var sox=require(_0xa3ee('0x9'));var csv=require(_0xa3ee('0xa'));var ejs=require(_0xa3ee('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa3ee('0xc'));var crypto=require('crypto');var jsforce=require(_0xa3ee('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa3ee('0xa'));var querystring=require('querystring');var Papa=require(_0xa3ee('0xe'));var Redis=require('ioredis');var authService=require(_0xa3ee('0xf'));var qs=require(_0xa3ee('0x10'));var as=require(_0xa3ee('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa3ee('0x12'))(_0xa3ee('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa3ee('0x14'));var db=require(_0xa3ee('0x15'))['db'];function respondWithStatusCode(_0x403518,_0x4363d1){_0x4363d1=_0x4363d1||0xcc;return function(_0x594c88){if(_0x594c88){return _0x403518[_0xa3ee('0x16')](_0x4363d1);}return _0x403518['status'](_0x4363d1)[_0xa3ee('0x17')]();};}function respondWithResult(_0x20535f,_0x2c34cf){_0x2c34cf=_0x2c34cf||0xc8;return function(_0x150e20){if(_0x150e20){return _0x20535f['status'](_0x2c34cf)[_0xa3ee('0x18')](_0x150e20);}};}function respondWithFilteredResult(_0x23df7d,_0x5da681){return function(_0x5358aa){if(_0x5358aa){var _0x4b2c66=typeof _0x5da681[_0xa3ee('0x19')]===_0xa3ee('0x1a')&&typeof _0x5da681[_0xa3ee('0x1b')]===_0xa3ee('0x1a');var _0x4cc8bb=_0x5358aa[_0xa3ee('0x1c')];var _0x40ffdb=_0x4b2c66?0x0:_0x5da681[_0xa3ee('0x19')];var _0x299b1e=_0x4b2c66?_0x5358aa[_0xa3ee('0x1c')]:_0x5da681['offset']+_0x5da681[_0xa3ee('0x1b')];var _0x18b738;if(_0x299b1e>=_0x4cc8bb){_0x299b1e=_0x4cc8bb;_0x18b738=0xc8;}else{_0x18b738=0xce;}_0x23df7d[_0xa3ee('0x1d')](_0x18b738);return _0x23df7d[_0xa3ee('0x1e')](_0xa3ee('0x1f'),_0x40ffdb+'-'+_0x299b1e+'/'+_0x4cc8bb)[_0xa3ee('0x18')](_0x5358aa);}return null;};}function patchUpdates(_0x4f8c56){return function(_0x3f5d70){try{jsonpatch[_0xa3ee('0x20')](_0x3f5d70,_0x4f8c56,!![]);}catch(_0x4b8445){return BPromise[_0xa3ee('0x21')](_0x4b8445);}return _0x3f5d70['save']();};}function saveUpdates(_0x2fab5,_0x29df43){return function(_0x1d3022){if(_0x1d3022){return _0x1d3022[_0xa3ee('0x22')](_0x2fab5)[_0xa3ee('0x23')](function(_0x47108f){return _0x47108f;});}return null;};}function removeEntity(_0x3ce61b,_0x12108e){return function(_0x5ae0a1){if(_0x5ae0a1){return _0x5ae0a1[_0xa3ee('0x24')]()['then'](function(){_0x3ce61b[_0xa3ee('0x1d')](0xcc)[_0xa3ee('0x17')]();});}};}function handleEntityNotFound(_0x157071,_0x1fe4b4){return function(_0x2c48db){if(!_0x2c48db){_0x157071['sendStatus'](0x194);}return _0x2c48db;};}function handleError(_0x3c68f9,_0x1b766e){_0x1b766e=_0x1b766e||0x1f4;return function(_0x146493){logger[_0xa3ee('0x25')](_0x146493[_0xa3ee('0x26')]);if(_0x146493[_0xa3ee('0x27')]){delete _0x146493[_0xa3ee('0x27')];}_0x3c68f9[_0xa3ee('0x1d')](_0x1b766e)[_0xa3ee('0x28')](_0x146493);};}exports[_0xa3ee('0x29')]=function(_0x59c6f9,_0x5ba571){var _0x4abf49={},_0x78e581={},_0x481358={'count':0x0,'rows':[]};var _0x3fa094=_[_0xa3ee('0x2a')](db[_0xa3ee('0x2b')][_0xa3ee('0x2c')],function(_0x26b222){return{'name':_0x26b222[_0xa3ee('0x2d')],'type':_0x26b222[_0xa3ee('0x2e')][_0xa3ee('0x2f')]};});_0x78e581[_0xa3ee('0x30')]=_[_0xa3ee('0x2a')](_0x3fa094,'name');_0x78e581[_0xa3ee('0x31')]=_['keys'](_0x59c6f9[_0xa3ee('0x31')]);_0x78e581[_0xa3ee('0x32')]=_['intersection'](_0x78e581[_0xa3ee('0x30')],_0x78e581['query']);_0x4abf49[_0xa3ee('0x33')]=_['intersection'](_0x78e581[_0xa3ee('0x30')],qs[_0xa3ee('0x34')](_0x59c6f9[_0xa3ee('0x31')][_0xa3ee('0x34')]));_0x4abf49[_0xa3ee('0x33')]=_0x4abf49['attributes'][_0xa3ee('0x35')]?_0x4abf49[_0xa3ee('0x33')]:_0x78e581[_0xa3ee('0x30')];if(!_0x59c6f9['query'][_0xa3ee('0x36')]('nolimit')){_0x4abf49[_0xa3ee('0x1b')]=qs['limit'](_0x59c6f9[_0xa3ee('0x31')]['limit']);_0x4abf49[_0xa3ee('0x19')]=qs[_0xa3ee('0x19')](_0x59c6f9[_0xa3ee('0x31')][_0xa3ee('0x19')]);}_0x4abf49[_0xa3ee('0x37')]=qs[_0xa3ee('0x38')](_0x59c6f9[_0xa3ee('0x31')][_0xa3ee('0x38')]);_0x4abf49[_0xa3ee('0x39')]=qs[_0xa3ee('0x32')](_[_0xa3ee('0x3a')](_0x59c6f9[_0xa3ee('0x31')],_0x78e581[_0xa3ee('0x32')]),_0x3fa094);if(_0x59c6f9['query'][_0xa3ee('0x3b')]){_0x4abf49[_0xa3ee('0x39')]=_[_0xa3ee('0x3c')](_0x4abf49[_0xa3ee('0x39')],{'$or':_['map'](_0x3fa094,function(_0x257627){if(_0x257627[_0xa3ee('0x2e')]!==_0xa3ee('0x3d')){var _0x5b95e3={};_0x5b95e3[_0x257627[_0xa3ee('0x27')]]={'$like':'%'+_0x59c6f9[_0xa3ee('0x31')]['filter']+'%'};return _0x5b95e3;}})});}_0x4abf49=_[_0xa3ee('0x3c')]({},_0x4abf49,_0x59c6f9[_0xa3ee('0x3e')]);var _0x4ef99a={'where':_0x4abf49[_0xa3ee('0x39')]};return db[_0xa3ee('0x2b')][_0xa3ee('0x1c')](_0x4ef99a)[_0xa3ee('0x23')](function(_0x1f0023){_0x481358[_0xa3ee('0x1c')]=_0x1f0023;if(_0x59c6f9[_0xa3ee('0x31')][_0xa3ee('0x3f')]){_0x4abf49[_0xa3ee('0x40')]=[{'all':!![]}];}return db[_0xa3ee('0x2b')][_0xa3ee('0x41')](_0x4abf49);})['then'](function(_0x5aa4b3){_0x481358['rows']=_0x5aa4b3;return _0x481358;})[_0xa3ee('0x23')](respondWithFilteredResult(_0x5ba571,_0x4abf49))[_0xa3ee('0x42')](handleError(_0x5ba571,null));};exports['show']=function(_0xca106f,_0x425f69){var _0x279834={'raw':!![],'where':{'id':_0xca106f[_0xa3ee('0x43')]['id']}},_0x55f47f={};_0x55f47f['model']=_[_0xa3ee('0x44')](db[_0xa3ee('0x2b')][_0xa3ee('0x2c')]);_0x55f47f[_0xa3ee('0x31')]=_[_0xa3ee('0x44')](_0xca106f[_0xa3ee('0x31')]);_0x55f47f[_0xa3ee('0x32')]=_[_0xa3ee('0x45')](_0x55f47f[_0xa3ee('0x30')],_0x55f47f[_0xa3ee('0x31')]);_0x279834[_0xa3ee('0x33')]=_[_0xa3ee('0x45')](_0x55f47f[_0xa3ee('0x30')],qs[_0xa3ee('0x34')](_0xca106f[_0xa3ee('0x31')][_0xa3ee('0x34')]));_0x279834[_0xa3ee('0x33')]=_0x279834[_0xa3ee('0x33')]['length']?_0x279834[_0xa3ee('0x33')]:_0x55f47f[_0xa3ee('0x30')];if(_0xca106f[_0xa3ee('0x31')][_0xa3ee('0x3f')]){_0x279834['include']=[{'all':!![]}];}_0x279834=_[_0xa3ee('0x3c')]({},_0x279834,_0xca106f['options']);return db[_0xa3ee('0x2b')][_0xa3ee('0x46')](_0x279834)[_0xa3ee('0x23')](handleEntityNotFound(_0x425f69,null))[_0xa3ee('0x23')](respondWithResult(_0x425f69,null))[_0xa3ee('0x42')](handleError(_0x425f69,null));};exports[_0xa3ee('0x47')]=function(_0xd723ad,_0xbb0148){return db[_0xa3ee('0x2b')][_0xa3ee('0x47')](_0xd723ad['body'],{})[_0xa3ee('0x23')](respondWithResult(_0xbb0148,0xc9))['catch'](handleError(_0xbb0148,null));};exports['update']=function(_0xaad29c,_0x2f7171){if(_0xaad29c[_0xa3ee('0x48')]['id']){delete _0xaad29c[_0xa3ee('0x48')]['id'];}return db[_0xa3ee('0x2b')][_0xa3ee('0x46')]({'where':{'id':_0xaad29c[_0xa3ee('0x43')]['id']}})['then'](handleEntityNotFound(_0x2f7171,null))[_0xa3ee('0x23')](saveUpdates(_0xaad29c[_0xa3ee('0x48')],null))['then'](respondWithResult(_0x2f7171,null))[_0xa3ee('0x42')](handleError(_0x2f7171,null));};exports[_0xa3ee('0x24')]=function(_0x2f1db4,_0x5ec981){return db['Cdr'][_0xa3ee('0x46')]({'where':{'id':_0x2f1db4[_0xa3ee('0x43')]['id']}})[_0xa3ee('0x23')](handleEntityNotFound(_0x5ec981,null))[_0xa3ee('0x23')](removeEntity(_0x5ec981,null))[_0xa3ee('0x42')](handleError(_0x5ec981,null));};exports['describe']=function(_0x55678e,_0x15b55e){return db[_0xa3ee('0x2b')]['describe']()[_0xa3ee('0x23')](respondWithResult(_0x15b55e,null))[_0xa3ee('0x42')](handleError(_0x15b55e,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index a216692..40512c8 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(_0x44be48,_0x2900fd){var _0x301d0d=function(_0x5c9893){while(--_0x5c9893){_0x44be48['push'](_0x44be48['shift']());}};_0x301d0d(++_0x2900fd);}(_0x7a54,0x106));var _0x47a5=function(_0x366306,_0x2894bf){_0x366306=_0x366306-0x0;var _0x4eac17=_0x7a54[_0x366306];return _0x4eac17;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x3afd09,_0x496caa){var _0x5c6d35=function(_0x4682a2){while(--_0x4682a2){_0x3afd09['push'](_0x3afd09['shift']());}};_0x5c6d35(++_0x496caa);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 2bac8ac..7b24a9b 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 _0x94e3=['message','Cdr,\x20%s,\x20%s','catch','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1e2e8f,_0x2b416d){var _0x1c0425=function(_0x41c0ac){while(--_0x41c0ac){_0x1e2e8f['push'](_0x1e2e8f['shift']());}};_0x1c0425(++_0x2b416d);}(_0x94e3,0x179));var _0x394e=function(_0x3feb4c,_0x1ea929){_0x3feb4c=_0x3feb4c-0x0;var _0x40f54b=_0x94e3[_0x3feb4c];return _0x40f54b;};'use strict';var _=require(_0x394e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x394e('0x1'));var db=require(_0x394e('0x2'))['db'];var utils=require(_0x394e('0x3'));var logger=require(_0x394e('0x4'))(_0x394e('0x5'));var config=require(_0x394e('0x6'));var jayson=require(_0x394e('0x7'));var client=jayson[_0x394e('0x8')][_0x394e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47bda9,_0x3a0c10,_0x1a5ed3){return new BPromise(function(_0x6c286e,_0x4cab90){return client[_0x394e('0xa')](_0x47bda9,_0x1a5ed3)[_0x394e('0xb')](function(_0x39afab){logger[_0x394e('0xc')]('Cdr,\x20%s,\x20%s',_0x3a0c10,_0x394e('0xd'));logger[_0x394e('0xe')](_0x394e('0xf'),_0x3a0c10,_0x394e('0xd'),JSON[_0x394e('0x10')](_0x39afab));if(_0x39afab[_0x394e('0x11')]){if(_0x39afab['error'][_0x394e('0x12')]===0x1f4){logger['error']('Cdr,\x20%s,\x20%s',_0x3a0c10,_0x39afab[_0x394e('0x11')][_0x394e('0x13')]);return _0x4cab90(_0x39afab[_0x394e('0x11')]['message']);}logger[_0x394e('0x11')](_0x394e('0x14'),_0x3a0c10,_0x39afab[_0x394e('0x11')][_0x394e('0x13')]);return _0x6c286e(_0x39afab[_0x394e('0x11')]['message']);}else{logger['info'](_0x394e('0x14'),_0x3a0c10,_0x394e('0xd'));_0x6c286e(_0x39afab['result'][_0x394e('0x13')]);}})[_0x394e('0x15')](function(_0x512b31){logger['error']('Cdr,\x20%s,\x20%s',_0x3a0c10,_0x512b31);_0x4cab90(_0x512b31);});});} \ No newline at end of file +var _0x16d2=['http','request','then','info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','Cdr,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1b8dc8,_0x2d183a){var _0x3f67b3=function(_0x587ed6){while(--_0x587ed6){_0x1b8dc8['push'](_0x1b8dc8['shift']());}};_0x3f67b3(++_0x2d183a);}(_0x16d2,0x6c));var _0x216d=function(_0x59ecf9,_0x9a29d){_0x59ecf9=_0x59ecf9-0x0;var _0x3c68c1=_0x16d2[_0x59ecf9];return _0x3c68c1;};'use strict';var _=require('lodash');var util=require(_0x216d('0x0'));var moment=require(_0x216d('0x1'));var BPromise=require(_0x216d('0x2'));var rs=require(_0x216d('0x3'));var fs=require('fs');var Redis=require(_0x216d('0x4'));var db=require(_0x216d('0x5'))['db'];var utils=require(_0x216d('0x6'));var logger=require(_0x216d('0x7'))(_0x216d('0x8'));var config=require(_0x216d('0x9'));var jayson=require(_0x216d('0xa'));var client=jayson[_0x216d('0xb')][_0x216d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x301bf1,_0x2afaf2,_0x56dae6){return new BPromise(function(_0x1bfc50,_0x4e246f){return client[_0x216d('0xd')](_0x301bf1,_0x56dae6)[_0x216d('0xe')](function(_0x593339){logger[_0x216d('0xf')]('Cdr,\x20%s,\x20%s',_0x2afaf2,_0x216d('0x10'));logger[_0x216d('0x11')](_0x216d('0x12'),_0x2afaf2,_0x216d('0x10'),JSON[_0x216d('0x13')](_0x593339));if(_0x593339[_0x216d('0x14')]){if(_0x593339[_0x216d('0x14')]['code']===0x1f4){logger[_0x216d('0x14')](_0x216d('0x15'),_0x2afaf2,_0x593339[_0x216d('0x14')]['message']);return _0x4e246f(_0x593339[_0x216d('0x14')][_0x216d('0x16')]);}logger['error'](_0x216d('0x15'),_0x2afaf2,_0x593339[_0x216d('0x14')]['message']);return _0x1bfc50(_0x593339[_0x216d('0x14')][_0x216d('0x16')]);}else{logger[_0x216d('0xf')](_0x216d('0x15'),_0x2afaf2,'request\x20sent');_0x1bfc50(_0x593339[_0x216d('0x17')]['message']);}})['catch'](function(_0x574406){logger[_0x216d('0x14')](_0x216d('0x15'),_0x2afaf2,_0x574406);_0x4e246f(_0x574406);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index aa2dfb7..17eef3b 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(_0x339d45,_0x5b91d4){var _0x5e4a60=function(_0x4de526){while(--_0x4de526){_0x339d45['push'](_0x339d45['shift']());}};_0x5e4a60(++_0x5b91d4);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('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 05d5ddb..eeac2fb 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 _0xb150=['INTEGER','STRING','noop','TEXT','*,*,*,*','exports'];(function(_0x246cf9,_0x9fc185){var _0x5aec44=function(_0x10a114){while(--_0x10a114){_0x246cf9['push'](_0x246cf9['shift']());}};_0x5aec44(++_0x9fc185);}(_0xb150,0xd1));var _0x0b15=function(_0x1dc0b9,_0xbf0a0a){_0x1dc0b9=_0x1dc0b9-0x0;var _0x5e7fb8=_0xb150[_0x1dc0b9];return _0x5e7fb8;};'use strict';var Sequelize=require('sequelize');module[_0x0b15('0x0')]={'priority':{'type':Sequelize[_0x0b15('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x0b15('0x2')],'allowNull':![],'defaultValue':_0x0b15('0x3')},'appdata':{'type':Sequelize[_0x0b15('0x4')]()},'description':{'type':Sequelize[_0x0b15('0x2')]},'interval':{'type':Sequelize[_0x0b15('0x2')],'defaultValue':_0x0b15('0x5')}}; \ No newline at end of file +var _0x954f=['TEXT','sequelize','exports','INTEGER','STRING'];(function(_0x5eb0eb,_0x167428){var _0x3d6cf3=function(_0x507fd9){while(--_0x507fd9){_0x5eb0eb['push'](_0x5eb0eb['shift']());}};_0x3d6cf3(++_0x167428);}(_0x954f,0x6a));var _0xf954=function(_0x28fdc2,_0x298889){_0x28fdc2=_0x28fdc2-0x0;var _0x437735=_0x954f[_0x28fdc2];return _0x437735;};'use strict';var Sequelize=require(_0xf954('0x0'));module[_0xf954('0x1')]={'priority':{'type':Sequelize[_0xf954('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf954('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xf954('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 641fe66..e55f001 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 _0xb077=['intersection','fields','length','include','merge','catch','body','find','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','undefined','count','offset','limit','apply','reject','save','update','destroy','then','status','error','stack','name','send','show','params','model','keys','ChatApplication','query','filters','attributes'];(function(_0x10cf75,_0x37b576){var _0x3f03a8=function(_0x50ef34){while(--_0x50ef34){_0x10cf75['push'](_0x10cf75['shift']());}};_0x3f03a8(++_0x37b576);}(_0xb077,0x7a));var _0x7b07=function(_0x40f79c,_0x774c92){_0x40f79c=_0x40f79c-0x0;var _0x3412f2=_0xb077[_0x40f79c];return _0x3412f2;};'use strict';var emlformat=require(_0x7b07('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7b07('0x1'));var rp=require('request-promise');var moment=require(_0x7b07('0x2'));var BPromise=require(_0x7b07('0x3'));var Mustache=require(_0x7b07('0x4'));var util=require(_0x7b07('0x5'));var path=require(_0x7b07('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7b07('0x7'));var fs=require('fs');var fs_extra=require(_0x7b07('0x8'));var _=require(_0x7b07('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7b07('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x7b07('0xb'));var querystring=require(_0x7b07('0xc'));var Papa=require(_0x7b07('0xd'));var Redis=require(_0x7b07('0xe'));var authService=require(_0x7b07('0xf'));var qs=require(_0x7b07('0x10'));var as=require(_0x7b07('0x11'));var hardwareService=require(_0x7b07('0x12'));var logger=require(_0x7b07('0x13'))('api');var utils=require(_0x7b07('0x14'));var config=require(_0x7b07('0x15'));var licenseUtil=require(_0x7b07('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe825c4,_0x3d73c6){_0x3d73c6=_0x3d73c6||0xcc;return function(_0x9f3404){if(_0x9f3404){return _0xe825c4[_0x7b07('0x17')](_0x3d73c6);}return _0xe825c4['status'](_0x3d73c6)[_0x7b07('0x18')]();};}function respondWithResult(_0x10fc29,_0x44cf4c){_0x44cf4c=_0x44cf4c||0xc8;return function(_0x5ded26){if(_0x5ded26){return _0x10fc29['status'](_0x44cf4c)[_0x7b07('0x19')](_0x5ded26);}};}function respondWithFilteredResult(_0x389f3c,_0x2acc2f){return function(_0x2f6e33){if(_0x2f6e33){var _0x4b7d85=typeof _0x2acc2f['offset']==='undefined'&&typeof _0x2acc2f['limit']===_0x7b07('0x1a');var _0x18311b=_0x2f6e33[_0x7b07('0x1b')];var _0x3aab02=_0x4b7d85?0x0:_0x2acc2f[_0x7b07('0x1c')];var _0x282b2f=_0x4b7d85?_0x2f6e33[_0x7b07('0x1b')]:_0x2acc2f[_0x7b07('0x1c')]+_0x2acc2f[_0x7b07('0x1d')];var _0x2d9278;if(_0x282b2f>=_0x18311b){_0x282b2f=_0x18311b;_0x2d9278=0xc8;}else{_0x2d9278=0xce;}_0x389f3c['status'](_0x2d9278);return _0x389f3c['set']('Content-Range',_0x3aab02+'-'+_0x282b2f+'/'+_0x18311b)[_0x7b07('0x19')](_0x2f6e33);}return null;};}function patchUpdates(_0x3d0f65){return function(_0x2e5e24){try{jsonpatch[_0x7b07('0x1e')](_0x2e5e24,_0x3d0f65,!![]);}catch(_0x2f97ab){return BPromise[_0x7b07('0x1f')](_0x2f97ab);}return _0x2e5e24[_0x7b07('0x20')]();};}function saveUpdates(_0x481812,_0xe41126){return function(_0x44e774){if(_0x44e774){return _0x44e774[_0x7b07('0x21')](_0x481812)['then'](function(_0xf43662){return _0xf43662;});}return null;};}function removeEntity(_0x5ed88d,_0x2b81cf){return function(_0x5e858d){if(_0x5e858d){return _0x5e858d[_0x7b07('0x22')]()[_0x7b07('0x23')](function(){_0x5ed88d[_0x7b07('0x24')](0xcc)[_0x7b07('0x18')]();});}};}function handleEntityNotFound(_0x572e32,_0x3a960c){return function(_0x54943d){if(!_0x54943d){_0x572e32[_0x7b07('0x17')](0x194);}return _0x54943d;};}function handleError(_0x343e21,_0x4ded23){_0x4ded23=_0x4ded23||0x1f4;return function(_0x447119){logger[_0x7b07('0x25')](_0x447119[_0x7b07('0x26')]);if(_0x447119[_0x7b07('0x27')]){delete _0x447119[_0x7b07('0x27')];}_0x343e21[_0x7b07('0x24')](_0x4ded23)[_0x7b07('0x28')](_0x447119);};}exports[_0x7b07('0x29')]=function(_0x4777cc,_0x232f70){var _0xcaeb2a={'raw':!![],'where':{'id':_0x4777cc[_0x7b07('0x2a')]['id']}},_0xa78d19={};_0xa78d19[_0x7b07('0x2b')]=_[_0x7b07('0x2c')](db[_0x7b07('0x2d')]['rawAttributes']);_0xa78d19['query']=_[_0x7b07('0x2c')](_0x4777cc[_0x7b07('0x2e')]);_0xa78d19[_0x7b07('0x2f')]=_['intersection'](_0xa78d19[_0x7b07('0x2b')],_0xa78d19[_0x7b07('0x2e')]);_0xcaeb2a[_0x7b07('0x30')]=_[_0x7b07('0x31')](_0xa78d19['model'],qs[_0x7b07('0x32')](_0x4777cc['query'][_0x7b07('0x32')]));_0xcaeb2a['attributes']=_0xcaeb2a[_0x7b07('0x30')][_0x7b07('0x33')]?_0xcaeb2a['attributes']:_0xa78d19['model'];if(_0x4777cc[_0x7b07('0x2e')]['includeAll']){_0xcaeb2a[_0x7b07('0x34')]=[{'all':!![]}];}_0xcaeb2a=_[_0x7b07('0x35')]({},_0xcaeb2a,_0x4777cc['options']);return db[_0x7b07('0x2d')]['find'](_0xcaeb2a)[_0x7b07('0x23')](handleEntityNotFound(_0x232f70,null))[_0x7b07('0x23')](respondWithResult(_0x232f70,null))[_0x7b07('0x36')](handleError(_0x232f70,null));};exports[_0x7b07('0x21')]=function(_0xcfc128,_0x19c41f){if(_0xcfc128[_0x7b07('0x37')]['id']){delete _0xcfc128[_0x7b07('0x37')]['id'];}return db[_0x7b07('0x2d')][_0x7b07('0x38')]({'where':{'id':_0xcfc128[_0x7b07('0x2a')]['id']}})[_0x7b07('0x23')](handleEntityNotFound(_0x19c41f,null))[_0x7b07('0x23')](saveUpdates(_0xcfc128[_0x7b07('0x37')],null))[_0x7b07('0x23')](respondWithResult(_0x19c41f,null))[_0x7b07('0x36')](handleError(_0x19c41f,null));};exports[_0x7b07('0x22')]=function(_0x409f8d,_0x46f5bd){return db[_0x7b07('0x2d')]['find']({'where':{'id':_0x409f8d[_0x7b07('0x2a')]['id']}})[_0x7b07('0x23')](handleEntityNotFound(_0x46f5bd,null))[_0x7b07('0x23')](removeEntity(_0x46f5bd,null))[_0x7b07('0x36')](handleError(_0x46f5bd,null));}; \ No newline at end of file +var _0x67da=['end','sendStatus','error','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','include','merge','options','find','catch','update','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x67da,0x192));var _0xa67d=function(_0x17e39f,_0x1df206){_0x17e39f=_0x17e39f-0x0;var _0x4db647=_0x67da[_0x17e39f];return _0x4db647;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa67d('0x0'));var zipdir=require(_0xa67d('0x1'));var jsonpatch=require(_0xa67d('0x2'));var rp=require(_0xa67d('0x3'));var moment=require(_0xa67d('0x4'));var BPromise=require(_0xa67d('0x5'));var Mustache=require(_0xa67d('0x6'));var util=require(_0xa67d('0x7'));var path=require(_0xa67d('0x8'));var sox=require(_0xa67d('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa67d('0xa'));var _=require('lodash');var squel=require(_0xa67d('0xb'));var crypto=require(_0xa67d('0xc'));var jsforce=require(_0xa67d('0xd'));var deskjs=require(_0xa67d('0xe'));var toCsv=require(_0xa67d('0xf'));var querystring=require(_0xa67d('0x10'));var Papa=require(_0xa67d('0x11'));var Redis=require(_0xa67d('0x12'));var authService=require(_0xa67d('0x13'));var qs=require(_0xa67d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa67d('0x15'));var logger=require(_0xa67d('0x16'))(_0xa67d('0x17'));var utils=require(_0xa67d('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xa67d('0x19'));var db=require(_0xa67d('0x1a'))['db'];function respondWithStatusCode(_0x560485,_0x4e86f6){_0x4e86f6=_0x4e86f6||0xcc;return function(_0x304ee2){if(_0x304ee2){return _0x560485['sendStatus'](_0x4e86f6);}return _0x560485[_0xa67d('0x1b')](_0x4e86f6)['end']();};}function respondWithResult(_0x5d757b,_0x22dcc7){_0x22dcc7=_0x22dcc7||0xc8;return function(_0x3b99e3){if(_0x3b99e3){return _0x5d757b['status'](_0x22dcc7)[_0xa67d('0x1c')](_0x3b99e3);}};}function respondWithFilteredResult(_0x267a67,_0x1cfe81){return function(_0x288e5f){if(_0x288e5f){var _0x5a47de=typeof _0x1cfe81['offset']==='undefined'&&typeof _0x1cfe81['limit']===_0xa67d('0x1d');var _0x553811=_0x288e5f[_0xa67d('0x1e')];var _0xf8422c=_0x5a47de?0x0:_0x1cfe81[_0xa67d('0x1f')];var _0x1b58c3=_0x5a47de?_0x288e5f[_0xa67d('0x1e')]:_0x1cfe81[_0xa67d('0x1f')]+_0x1cfe81[_0xa67d('0x20')];var _0x5538a5;if(_0x1b58c3>=_0x553811){_0x1b58c3=_0x553811;_0x5538a5=0xc8;}else{_0x5538a5=0xce;}_0x267a67[_0xa67d('0x1b')](_0x5538a5);return _0x267a67[_0xa67d('0x21')](_0xa67d('0x22'),_0xf8422c+'-'+_0x1b58c3+'/'+_0x553811)[_0xa67d('0x1c')](_0x288e5f);}return null;};}function patchUpdates(_0x28f38b){return function(_0x1c3498){try{jsonpatch['apply'](_0x1c3498,_0x28f38b,!![]);}catch(_0x3f1898){return BPromise[_0xa67d('0x23')](_0x3f1898);}return _0x1c3498[_0xa67d('0x24')]();};}function saveUpdates(_0xed6c3e,_0x48f240){return function(_0x276ef7){if(_0x276ef7){return _0x276ef7['update'](_0xed6c3e)[_0xa67d('0x25')](function(_0x415141){return _0x415141;});}return null;};}function removeEntity(_0x46bbc8,_0x9c2935){return function(_0x559009){if(_0x559009){return _0x559009[_0xa67d('0x26')]()[_0xa67d('0x25')](function(){_0x46bbc8['status'](0xcc)[_0xa67d('0x27')]();});}};}function handleEntityNotFound(_0x3dd0b9,_0x2b890c){return function(_0xe0c7b2){if(!_0xe0c7b2){_0x3dd0b9[_0xa67d('0x28')](0x194);}return _0xe0c7b2;};}function handleError(_0x1d6e68,_0x5ef92a){_0x5ef92a=_0x5ef92a||0x1f4;return function(_0x435e56){logger[_0xa67d('0x29')](_0x435e56['stack']);if(_0x435e56[_0xa67d('0x2a')]){delete _0x435e56[_0xa67d('0x2a')];}_0x1d6e68[_0xa67d('0x1b')](_0x5ef92a)[_0xa67d('0x2b')](_0x435e56);};}exports[_0xa67d('0x2c')]=function(_0x8793cf,_0x42c858){var _0xf4fc64={'raw':!![],'where':{'id':_0x8793cf[_0xa67d('0x2d')]['id']}},_0x204f83={};_0x204f83[_0xa67d('0x2e')]=_[_0xa67d('0x2f')](db[_0xa67d('0x30')][_0xa67d('0x31')]);_0x204f83['query']=_[_0xa67d('0x2f')](_0x8793cf[_0xa67d('0x32')]);_0x204f83[_0xa67d('0x33')]=_[_0xa67d('0x34')](_0x204f83[_0xa67d('0x2e')],_0x204f83['query']);_0xf4fc64[_0xa67d('0x35')]=_[_0xa67d('0x34')](_0x204f83[_0xa67d('0x2e')],qs[_0xa67d('0x36')](_0x8793cf[_0xa67d('0x32')][_0xa67d('0x36')]));_0xf4fc64[_0xa67d('0x35')]=_0xf4fc64[_0xa67d('0x35')][_0xa67d('0x37')]?_0xf4fc64[_0xa67d('0x35')]:_0x204f83['model'];if(_0x8793cf[_0xa67d('0x32')]['includeAll']){_0xf4fc64[_0xa67d('0x38')]=[{'all':!![]}];}_0xf4fc64=_[_0xa67d('0x39')]({},_0xf4fc64,_0x8793cf[_0xa67d('0x3a')]);return db['ChatApplication'][_0xa67d('0x3b')](_0xf4fc64)[_0xa67d('0x25')](handleEntityNotFound(_0x42c858,null))[_0xa67d('0x25')](respondWithResult(_0x42c858,null))[_0xa67d('0x3c')](handleError(_0x42c858,null));};exports[_0xa67d('0x3d')]=function(_0x199e8f,_0x4ded76){if(_0x199e8f[_0xa67d('0x3e')]['id']){delete _0x199e8f[_0xa67d('0x3e')]['id'];}return db['ChatApplication']['find']({'where':{'id':_0x199e8f['params']['id']}})[_0xa67d('0x25')](handleEntityNotFound(_0x4ded76,null))['then'](saveUpdates(_0x199e8f[_0xa67d('0x3e')],null))[_0xa67d('0x25')](respondWithResult(_0x4ded76,null))[_0xa67d('0x3c')](handleError(_0x4ded76,null));};exports[_0xa67d('0x26')]=function(_0x35a0a0,_0x44310e){return db[_0xa67d('0x30')][_0xa67d('0x3b')]({'where':{'id':_0x35a0a0[_0xa67d('0x2d')]['id']}})[_0xa67d('0x25')](handleEntityNotFound(_0x44310e,null))[_0xa67d('0x25')](removeEntity(_0x44310e,null))[_0xa67d('0x3c')](handleError(_0x44310e,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 930c8d8..dd11b68 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 _0xc46a=['define','chat_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','./chatApplication.attributes'];(function(_0x50621d,_0x219f3d){var _0x5afe6d=function(_0x6bcacf){while(--_0x6bcacf){_0x50621d['push'](_0x50621d['shift']());}};_0x5afe6d(++_0x219f3d);}(_0xc46a,0x10c));var _0xac46=function(_0x56ec52,_0x35e3c3){_0x56ec52=_0x56ec52-0x0;var _0x324eb2=_0xc46a[_0x56ec52];return _0x324eb2;};'use strict';var _=require('lodash');var util=require(_0xac46('0x0'));var logger=require(_0xac46('0x1'))('api');var moment=require(_0xac46('0x2'));var BPromise=require(_0xac46('0x3'));var rp=require(_0xac46('0x4'));var fs=require('fs');var path=require(_0xac46('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xac46('0x6'));module['exports']=function(_0x2ed93e,_0x1b2397){return _0x2ed93e[_0xac46('0x7')]('ChatApplication',attributes,{'tableName':_0xac46('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xac46('0x9'),'collate':_0xac46('0xa')});}; \ No newline at end of file +var _0x31dc=['../../config/environment','exports','define','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','path'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x31dc,0xc3));var _0xc31d=function(_0x6aeb1,_0x9e12f4){_0x6aeb1=_0x6aeb1-0x0;var _0x400758=_0x31dc[_0x6aeb1];return _0x400758;};'use strict';var _=require(_0xc31d('0x0'));var util=require(_0xc31d('0x1'));var logger=require(_0xc31d('0x2'))(_0xc31d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc31d('0x4'));var rimraf=require('rimraf');var config=require(_0xc31d('0x5'));var attributes=require('./chatApplication.attributes');module[_0xc31d('0x6')]=function(_0x5118de,_0x4f6fbe){return _0x5118de[_0xc31d('0x7')]('ChatApplication',attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc31d('0x8'),'collate':_0xc31d('0x9')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 5900da7..aea83ea 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 _0xb524=['client','http','request','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','code','ChatApplication,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x336fee,_0x173fb9){var _0x17aa69=function(_0x1597ee){while(--_0x1597ee){_0x336fee['push'](_0x336fee['shift']());}};_0x17aa69(++_0x173fb9);}(_0xb524,0x12d));var _0x4b52=function(_0x25215d,_0x11ba99){_0x25215d=_0x25215d-0x0;var _0x472ab8=_0xb524[_0x25215d];return _0x472ab8;};'use strict';var _=require(_0x4b52('0x0'));var util=require(_0x4b52('0x1'));var moment=require(_0x4b52('0x2'));var BPromise=require('bluebird');var rs=require(_0x4b52('0x3'));var fs=require('fs');var Redis=require(_0x4b52('0x4'));var db=require(_0x4b52('0x5'))['db'];var utils=require(_0x4b52('0x6'));var logger=require(_0x4b52('0x7'))(_0x4b52('0x8'));var config=require(_0x4b52('0x9'));var jayson=require(_0x4b52('0xa'));var client=jayson[_0x4b52('0xb')][_0x4b52('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2eea56,_0x5b3de4,_0x5cddea){return new BPromise(function(_0x207924,_0x52126b){return client[_0x4b52('0xd')](_0x2eea56,_0x5cddea)[_0x4b52('0xe')](function(_0x3f6a57){logger[_0x4b52('0xf')]('ChatApplication,\x20%s,\x20%s',_0x5b3de4,_0x4b52('0x10'));logger[_0x4b52('0x11')](_0x4b52('0x12'),_0x5b3de4,'request\x20sent',JSON[_0x4b52('0x13')](_0x3f6a57));if(_0x3f6a57['error']){if(_0x3f6a57['error'][_0x4b52('0x14')]===0x1f4){logger['error'](_0x4b52('0x15'),_0x5b3de4,_0x3f6a57[_0x4b52('0x16')][_0x4b52('0x17')]);return _0x52126b(_0x3f6a57[_0x4b52('0x16')]['message']);}logger[_0x4b52('0x16')](_0x4b52('0x15'),_0x5b3de4,_0x3f6a57[_0x4b52('0x16')]['message']);return _0x207924(_0x3f6a57[_0x4b52('0x16')][_0x4b52('0x17')]);}else{logger[_0x4b52('0xf')]('ChatApplication,\x20%s,\x20%s',_0x5b3de4,'request\x20sent');_0x207924(_0x3f6a57[_0x4b52('0x18')][_0x4b52('0x17')]);}})[_0x4b52('0x19')](function(_0x29f194){logger['error']('ChatApplication,\x20%s,\x20%s',_0x5b3de4,_0x29f194);_0x52126b(_0x29f194);});});} \ No newline at end of file +var _0xd13d=['info','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0xfb0cfd,_0x500179){var _0x2fd8aa=function(_0xccb501){while(--_0xccb501){_0xfb0cfd['push'](_0xfb0cfd['shift']());}};_0x2fd8aa(++_0x500179);}(_0xd13d,0x185));var _0xdd13=function(_0x19a9d9,_0x163da5){_0x19a9d9=_0x19a9d9-0x0;var _0x32b70e=_0xd13d[_0x19a9d9];return _0x32b70e;};'use strict';var _=require(_0xdd13('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdd13('0x1'));var rs=require(_0xdd13('0x2'));var fs=require('fs');var Redis=require(_0xdd13('0x3'));var db=require(_0xdd13('0x4'))['db'];var utils=require(_0xdd13('0x5'));var logger=require(_0xdd13('0x6'))(_0xdd13('0x7'));var config=require('../../config/environment');var jayson=require(_0xdd13('0x8'));var client=jayson['client'][_0xdd13('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x384235,_0x806e8a,_0x495eaa){return new BPromise(function(_0x122685,_0x4d41df){return client['request'](_0x384235,_0x495eaa)['then'](function(_0xf2976d){logger[_0xdd13('0xa')](_0xdd13('0xb'),_0x806e8a,_0xdd13('0xc'));logger['debug'](_0xdd13('0xd'),_0x806e8a,_0xdd13('0xc'),JSON['stringify'](_0xf2976d));if(_0xf2976d[_0xdd13('0xe')]){if(_0xf2976d[_0xdd13('0xe')][_0xdd13('0xf')]===0x1f4){logger['error'](_0xdd13('0xb'),_0x806e8a,_0xf2976d['error'][_0xdd13('0x10')]);return _0x4d41df(_0xf2976d['error'][_0xdd13('0x10')]);}logger[_0xdd13('0xe')](_0xdd13('0xb'),_0x806e8a,_0xf2976d[_0xdd13('0xe')][_0xdd13('0x10')]);return _0x122685(_0xf2976d[_0xdd13('0xe')][_0xdd13('0x10')]);}else{logger[_0xdd13('0xa')](_0xdd13('0xb'),_0x806e8a,_0xdd13('0xc'));_0x122685(_0xf2976d[_0xdd13('0x11')][_0xdd13('0x10')]);}})[_0xdd13('0x12')](function(_0x2e07b0){logger['error'](_0xdd13('0xb'),_0x806e8a,_0x2e07b0);_0x4d41df(_0x2e07b0);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 40e1289..4455614 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 _0x7f24=['/:id','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatApplication.controller','get','isAuthenticated','show'];(function(_0x3496cb,_0x20a3b1){var _0x531a07=function(_0x5c3984){while(--_0x5c3984){_0x3496cb['push'](_0x3496cb['shift']());}};_0x531a07(++_0x20a3b1);}(_0x7f24,0x124));var _0x47f2=function(_0x45ac0c,_0x2f8a58){_0x45ac0c=_0x45ac0c-0x0;var _0x4b4074=_0x7f24[_0x45ac0c];return _0x4b4074;};'use strict';var multer=require(_0x47f2('0x0'));var util=require(_0x47f2('0x1'));var path=require('path');var timeout=require(_0x47f2('0x2'));var express=require(_0x47f2('0x3'));var router=express[_0x47f2('0x4')]();var fs_extra=require(_0x47f2('0x5'));var auth=require(_0x47f2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x47f2('0x7'));var controller=require(_0x47f2('0x8'));router[_0x47f2('0x9')]('/:id',auth[_0x47f2('0xa')](),controller[_0x47f2('0xb')]);router['put'](_0x47f2('0xc'),auth[_0x47f2('0xa')](),controller[_0x47f2('0xd')]);router[_0x47f2('0xe')](_0x47f2('0xc'),auth[_0x47f2('0xa')](),controller[_0x47f2('0xf')]);module['exports']=router; \ No newline at end of file +var _0x44ff=['util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','put','delete','destroy','exports','multer'];(function(_0x15457c,_0x52abc1){var _0x55c6d4=function(_0x44cee5){while(--_0x44cee5){_0x15457c['push'](_0x15457c['shift']());}};_0x55c6d4(++_0x52abc1);}(_0x44ff,0x68));var _0xf44f=function(_0x13f7b8,_0xbddb9f){_0x13f7b8=_0x13f7b8-0x0;var _0x174bcd=_0x44ff[_0x13f7b8];return _0x174bcd;};'use strict';var multer=require(_0xf44f('0x0'));var util=require(_0xf44f('0x1'));var path=require(_0xf44f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf44f('0x3')]();var fs_extra=require(_0xf44f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf44f('0x5'));var config=require(_0xf44f('0x6'));var controller=require('./chatApplication.controller');router[_0xf44f('0x7')](_0xf44f('0x8'),auth[_0xf44f('0x9')](),controller[_0xf44f('0xa')]);router[_0xf44f('0xb')](_0xf44f('0x8'),auth[_0xf44f('0x9')](),controller['update']);router[_0xf44f('0xc')]('/:id',auth[_0xf44f('0x9')](),controller[_0xf44f('0xd')]);module[_0xf44f('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index f60bfe7..44b08e8 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 _0x0095=['exports','STRING'];(function(_0x346ea9,_0x23955d){var _0x18b905=function(_0x27d38c){while(--_0x27d38c){_0x346ea9['push'](_0x346ea9['shift']());}};_0x18b905(++_0x23955d);}(_0x0095,0xaa));var _0x5009=function(_0x1c8a0f,_0x3aff6e){_0x1c8a0f=_0x1c8a0f-0x0;var _0x13a546=_0x0095[_0x1c8a0f];return _0x13a546;};'use strict';var Sequelize=require('sequelize');module[_0x5009('0x0')]={'name':{'type':Sequelize[_0x5009('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x5009('0x1')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x0182=['STRING','BOOLEAN','sequelize','exports'];(function(_0x573f83,_0x1f3cd3){var _0xe89cd1=function(_0x317706){while(--_0x317706){_0x573f83['push'](_0x573f83['shift']());}};_0xe89cd1(++_0x1f3cd3);}(_0x0182,0x18a));var _0x2018=function(_0x48f9d2,_0x33ba0d){_0x48f9d2=_0x48f9d2-0x0;var _0x5228da=_0x0182[_0x48f9d2];return _0x5228da;};'use strict';var Sequelize=require(_0x2018('0x0'));module[_0x2018('0x1')]={'name':{'type':Sequelize[_0x2018('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x2018('0x2')]},'write':{'type':Sequelize[_0x2018('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 dae8d72..9cacdee 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 _0xb243=['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','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','ChatGroup','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','length','find','create','body','describe','getUnread','toInteger','addMembers','omit','findOne','User','nolimit','removeMembers','addMessage','ChatGroupId','getMessages','pick','$gte','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x5d464e,_0x38bd68){var _0x4b311f=function(_0x27e4b8){while(--_0x27e4b8){_0x5d464e['push'](_0x5d464e['shift']());}};_0x4b311f(++_0x38bd68);}(_0xb243,0x114));var _0x3b24=function(_0x1300c9,_0x706609){_0x1300c9=_0x1300c9-0x0;var _0x2f9c93=_0xb243[_0x1300c9];return _0x2f9c93;};'use strict';var emlformat=require(_0x3b24('0x0'));var rimraf=require(_0x3b24('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3b24('0x2'));var rp=require('request-promise');var moment=require(_0x3b24('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3b24('0x4'));var util=require(_0x3b24('0x5'));var path=require(_0x3b24('0x6'));var sox=require(_0x3b24('0x7'));var csv=require(_0x3b24('0x8'));var ejs=require(_0x3b24('0x9'));var fs=require('fs');var fs_extra=require(_0x3b24('0xa'));var _=require(_0x3b24('0xb'));var squel=require(_0x3b24('0xc'));var crypto=require(_0x3b24('0xd'));var jsforce=require(_0x3b24('0xe'));var deskjs=require(_0x3b24('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3b24('0x10'));var Redis=require(_0x3b24('0x11'));var authService=require(_0x3b24('0x12'));var qs=require(_0x3b24('0x13'));var as=require(_0x3b24('0x14'));var hardwareService=require(_0x3b24('0x15'));var logger=require(_0x3b24('0x16'))('api');var utils=require(_0x3b24('0x17'));var config=require(_0x3b24('0x18'));var licenseUtil=require(_0x3b24('0x19'));var db=require('../../mysqldb')['db'];config[_0x3b24('0x1a')]=_[_0x3b24('0x1b')](config['redis'],{'host':_0x3b24('0x1c'),'port':0x18eb});var socket=require(_0x3b24('0x1d'))(new Redis(config[_0x3b24('0x1a')]));require(_0x3b24('0x1e'))[_0x3b24('0x1f')](socket);function respondWithStatusCode(_0x21442a,_0x1ac66c){_0x1ac66c=_0x1ac66c||0xcc;return function(_0x270cec){if(_0x270cec){return _0x21442a[_0x3b24('0x20')](_0x1ac66c);}return _0x21442a[_0x3b24('0x21')](_0x1ac66c)[_0x3b24('0x22')]();};}function respondWithResult(_0x395220,_0x2db23e){_0x2db23e=_0x2db23e||0xc8;return function(_0x393dca){if(_0x393dca){return _0x395220[_0x3b24('0x21')](_0x2db23e)[_0x3b24('0x23')](_0x393dca);}};}function respondWithFilteredResult(_0x3525f7,_0x53958a){return function(_0x18713f){if(_0x18713f){var _0x117633=typeof _0x53958a[_0x3b24('0x24')]===_0x3b24('0x25')&&typeof _0x53958a[_0x3b24('0x26')]===_0x3b24('0x25');var _0x18a5d0=_0x18713f[_0x3b24('0x27')];var _0xc4ea50=_0x117633?0x0:_0x53958a['offset'];var _0x49ba17=_0x117633?_0x18713f['count']:_0x53958a[_0x3b24('0x24')]+_0x53958a[_0x3b24('0x26')];var _0xeb980c;if(_0x49ba17>=_0x18a5d0){_0x49ba17=_0x18a5d0;_0xeb980c=0xc8;}else{_0xeb980c=0xce;}_0x3525f7[_0x3b24('0x21')](_0xeb980c);return _0x3525f7[_0x3b24('0x28')](_0x3b24('0x29'),_0xc4ea50+'-'+_0x49ba17+'/'+_0x18a5d0)[_0x3b24('0x23')](_0x18713f);}return null;};}function patchUpdates(_0x3ac7ee){return function(_0x194661){try{jsonpatch[_0x3b24('0x2a')](_0x194661,_0x3ac7ee,!![]);}catch(_0x424267){return BPromise['reject'](_0x424267);}return _0x194661['save']();};}function saveUpdates(_0x4c738a,_0x288c52){return function(_0xfc179b){if(_0xfc179b){return _0xfc179b[_0x3b24('0x2b')](_0x4c738a)[_0x3b24('0x2c')](function(_0xbc3f18){return _0xbc3f18;});}return null;};}function removeEntity(_0x2f395d,_0xe362f9){return function(_0x5c33dd){if(_0x5c33dd){return _0x5c33dd[_0x3b24('0x2d')]()[_0x3b24('0x2c')](function(){_0x2f395d[_0x3b24('0x21')](0xcc)[_0x3b24('0x22')]();});}};}function handleEntityNotFound(_0x4eaf05,_0x147f97){return function(_0x545a46){if(!_0x545a46){_0x4eaf05[_0x3b24('0x20')](0x194);}return _0x545a46;};}function handleError(_0x373407,_0x3f3e79){_0x3f3e79=_0x3f3e79||0x1f4;return function(_0x38cf5d){logger[_0x3b24('0x2e')](_0x38cf5d[_0x3b24('0x2f')]);if(_0x38cf5d[_0x3b24('0x30')]){delete _0x38cf5d[_0x3b24('0x30')];}_0x373407['status'](_0x3f3e79)[_0x3b24('0x31')](_0x38cf5d);};}exports[_0x3b24('0x32')]=function(_0x53719f,_0x3f4bfe){var _0x21adfe={},_0xd956c0={},_0x3ed9d3={'count':0x0,'rows':[]};var _0x1eb549=_[_0x3b24('0x33')](db[_0x3b24('0x34')][_0x3b24('0x35')],function(_0x2654c0){return{'name':_0x2654c0['fieldName'],'type':_0x2654c0[_0x3b24('0x36')][_0x3b24('0x37')]};});_0xd956c0['model']=_[_0x3b24('0x33')](_0x1eb549,_0x3b24('0x30'));_0xd956c0[_0x3b24('0x38')]=_[_0x3b24('0x39')](_0x53719f[_0x3b24('0x38')]);_0xd956c0['filters']=_[_0x3b24('0x3a')](_0xd956c0[_0x3b24('0x3b')],_0xd956c0[_0x3b24('0x38')]);_0x21adfe[_0x3b24('0x3c')]=_[_0x3b24('0x3a')](_0xd956c0[_0x3b24('0x3b')],qs[_0x3b24('0x3d')](_0x53719f[_0x3b24('0x38')][_0x3b24('0x3d')]));_0x21adfe['attributes']=_0x21adfe['attributes']['length']?_0x21adfe[_0x3b24('0x3c')]:_0xd956c0[_0x3b24('0x3b')];if(!_0x53719f[_0x3b24('0x38')][_0x3b24('0x3e')]('nolimit')){_0x21adfe['limit']=qs['limit'](_0x53719f[_0x3b24('0x38')][_0x3b24('0x26')]);_0x21adfe[_0x3b24('0x24')]=qs[_0x3b24('0x24')](_0x53719f['query']['offset']);}_0x21adfe[_0x3b24('0x3f')]=qs[_0x3b24('0x40')](_0x53719f['query'][_0x3b24('0x40')]);_0x21adfe[_0x3b24('0x41')]=qs[_0x3b24('0x42')](_['pick'](_0x53719f[_0x3b24('0x38')],_0xd956c0['filters']),_0x1eb549);if(_0x53719f['query'][_0x3b24('0x43')]){_0x21adfe[_0x3b24('0x41')]=_[_0x3b24('0x44')](_0x21adfe['where'],{'$or':_[_0x3b24('0x33')](_0x1eb549,function(_0x73efe1){if(_0x73efe1[_0x3b24('0x36')]!==_0x3b24('0x45')){var _0x5a281d={};_0x5a281d[_0x73efe1[_0x3b24('0x30')]]={'$like':'%'+_0x53719f['query'][_0x3b24('0x43')]+'%'};return _0x5a281d;}})});}_0x21adfe=_[_0x3b24('0x44')]({},_0x21adfe,_0x53719f[_0x3b24('0x46')]);var _0x27119a={'where':_0x21adfe[_0x3b24('0x41')]};return db[_0x3b24('0x34')][_0x3b24('0x27')](_0x27119a)[_0x3b24('0x2c')](function(_0x26c7d7){_0x3ed9d3[_0x3b24('0x27')]=_0x26c7d7;if(_0x53719f['query'][_0x3b24('0x47')]){_0x21adfe[_0x3b24('0x48')]=[{'all':!![]}];}return db[_0x3b24('0x34')]['findAll'](_0x21adfe);})[_0x3b24('0x2c')](function(_0x206b40){_0x3ed9d3[_0x3b24('0x49')]=_0x206b40;return _0x3ed9d3;})['then'](respondWithFilteredResult(_0x3f4bfe,_0x21adfe))[_0x3b24('0x4a')](handleError(_0x3f4bfe,null));};exports['show']=function(_0x5ae893,_0x13d7a7){var _0x16c8bc={'raw':!![],'where':{'id':_0x5ae893[_0x3b24('0x4b')]['id']}},_0x108d01={};_0x108d01['model']=_[_0x3b24('0x39')](db['ChatGroup']['rawAttributes']);_0x108d01[_0x3b24('0x38')]=_[_0x3b24('0x39')](_0x5ae893[_0x3b24('0x38')]);_0x108d01[_0x3b24('0x42')]=_[_0x3b24('0x3a')](_0x108d01['model'],_0x108d01[_0x3b24('0x38')]);_0x16c8bc[_0x3b24('0x3c')]=_[_0x3b24('0x3a')](_0x108d01['model'],qs[_0x3b24('0x3d')](_0x5ae893[_0x3b24('0x38')][_0x3b24('0x3d')]));_0x16c8bc[_0x3b24('0x3c')]=_0x16c8bc[_0x3b24('0x3c')][_0x3b24('0x4c')]?_0x16c8bc[_0x3b24('0x3c')]:_0x108d01['model'];if(_0x5ae893[_0x3b24('0x38')][_0x3b24('0x47')]){_0x16c8bc[_0x3b24('0x48')]=[{'all':!![]}];}_0x16c8bc=_[_0x3b24('0x44')]({},_0x16c8bc,_0x5ae893[_0x3b24('0x46')]);return db['ChatGroup'][_0x3b24('0x4d')](_0x16c8bc)[_0x3b24('0x2c')](handleEntityNotFound(_0x13d7a7,null))[_0x3b24('0x2c')](respondWithResult(_0x13d7a7,null))[_0x3b24('0x4a')](handleError(_0x13d7a7,null));};exports[_0x3b24('0x4e')]=function(_0x31eb37,_0x290b81){return db[_0x3b24('0x34')][_0x3b24('0x4e')](_0x31eb37[_0x3b24('0x4f')],{})[_0x3b24('0x2c')](respondWithResult(_0x290b81,0xc9))['catch'](handleError(_0x290b81,null));};exports[_0x3b24('0x2b')]=function(_0x7c8132,_0x3badf6){if(_0x7c8132[_0x3b24('0x4f')]['id']){delete _0x7c8132['body']['id'];}return db['ChatGroup'][_0x3b24('0x4d')]({'where':{'id':_0x7c8132[_0x3b24('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3badf6,null))[_0x3b24('0x2c')](saveUpdates(_0x7c8132[_0x3b24('0x4f')],null))['then'](respondWithResult(_0x3badf6,null))[_0x3b24('0x4a')](handleError(_0x3badf6,null));};exports[_0x3b24('0x2d')]=function(_0x2475a4,_0x5c1520){return db[_0x3b24('0x34')][_0x3b24('0x4d')]({'where':{'id':_0x2475a4[_0x3b24('0x4b')]['id']}})[_0x3b24('0x2c')](handleEntityNotFound(_0x5c1520,null))['then'](removeEntity(_0x5c1520,null))[_0x3b24('0x4a')](handleError(_0x5c1520,null));};exports['describe']=function(_0x4f6bb5,_0x173854){return db[_0x3b24('0x34')][_0x3b24('0x50')]()['then'](respondWithResult(_0x173854,null))[_0x3b24('0x4a')](handleError(_0x173854,null));};exports[_0x3b24('0x51')]=function(_0x1f9566,_0x3dfe2a,_0x234956){return db['ChatInternalMessage'][_0x3b24('0x27')]({'where':{'ChatGroupId':_0x1f9566[_0x3b24('0x4b')]['id'],'ToId':_0x1f9566['user']['id'],'read':![]}})['then'](function(_0x18d46f){return{'id':_[_0x3b24('0x52')](_0x1f9566[_0x3b24('0x4b')]['id']),'count':_0x18d46f};})[_0x3b24('0x2c')](respondWithResult(_0x3dfe2a,null))['catch'](handleError(_0x3dfe2a,null));};exports[_0x3b24('0x53')]=function(_0x162153,_0x244cef,_0x7e5c64){return db[_0x3b24('0x34')][_0x3b24('0x4d')]({'where':{'id':_0x162153[_0x3b24('0x4b')]['id']}})['then'](handleEntityNotFound(_0x244cef,null))[_0x3b24('0x2c')](function(_0x1b6f03){if(_0x1b6f03){return _0x1b6f03[_0x3b24('0x53')](_0x162153[_0x3b24('0x4f')]['ids'],_[_0x3b24('0x54')](_0x162153[_0x3b24('0x4f')],['ids','id'])||{});}})[_0x3b24('0x2c')](respondWithResult(_0x244cef,null))[_0x3b24('0x4a')](handleError(_0x244cef,null));};exports['getMembers']=function(_0x4f977a,_0x50a69f,_0x6eeda8){var _0x4fae32={};var _0x3fc4de={};var _0x43bbf4;var _0x27479e;return db[_0x3b24('0x34')][_0x3b24('0x55')]({'where':{'id':_0x4f977a[_0x3b24('0x4b')]['id']}})[_0x3b24('0x2c')](handleEntityNotFound(_0x50a69f,null))[_0x3b24('0x2c')](function(_0xbcd3bb){if(_0xbcd3bb){_0x43bbf4=_0xbcd3bb;_0x3fc4de[_0x3b24('0x3b')]=_['keys'](db[_0x3b24('0x56')][_0x3b24('0x35')]);_0x3fc4de[_0x3b24('0x38')]=_[_0x3b24('0x39')](_0x4f977a[_0x3b24('0x38')]);_0x3fc4de[_0x3b24('0x42')]=_[_0x3b24('0x3a')](_0x3fc4de[_0x3b24('0x3b')],_0x3fc4de[_0x3b24('0x38')]);_0x4fae32[_0x3b24('0x3c')]=_[_0x3b24('0x3a')](_0x3fc4de[_0x3b24('0x3b')],qs[_0x3b24('0x3d')](_0x4f977a['query'][_0x3b24('0x3d')]));_0x4fae32['attributes']=_0x4fae32[_0x3b24('0x3c')]['length']?_0x4fae32['attributes']:_0x3fc4de['model'];_0x4fae32[_0x3b24('0x3f')]=qs['sort'](_0x4f977a['query']['sort']);_0x4fae32[_0x3b24('0x41')]=qs['filters'](_['pick'](_0x4f977a[_0x3b24('0x38')],_0x3fc4de['filters']));if(_0x4f977a[_0x3b24('0x38')]['filter']){_0x4fae32[_0x3b24('0x41')]=_[_0x3b24('0x44')](_0x4fae32['where'],{'$or':_[_0x3b24('0x33')](_0x4fae32['attributes'],function(_0x15a518){var _0x55738a={};_0x55738a[_0x15a518]={'$like':'%'+_0x4f977a[_0x3b24('0x38')][_0x3b24('0x43')]+'%'};return _0x55738a;})});}_0x4fae32=_[_0x3b24('0x44')]({},_0x4fae32,_0x4f977a[_0x3b24('0x46')]);return _0x43bbf4['getMembers'](_0x4fae32);}})[_0x3b24('0x2c')](function(_0x82ca6f){if(_0x82ca6f){_0x27479e=_0x82ca6f[_0x3b24('0x4c')];if(!_0x4f977a['query']['hasOwnProperty'](_0x3b24('0x57'))){_0x4fae32['limit']=qs[_0x3b24('0x26')](_0x4f977a[_0x3b24('0x38')][_0x3b24('0x26')]);_0x4fae32[_0x3b24('0x24')]=qs['offset'](_0x4f977a['query'][_0x3b24('0x24')]);}return _0x43bbf4['getMembers'](_0x4fae32);}})[_0x3b24('0x2c')](function(_0x59e859){if(_0x59e859){return _0x59e859?{'count':_0x27479e,'rows':_0x59e859}:null;}})['then'](respondWithResult(_0x50a69f,null))[_0x3b24('0x4a')](handleError(_0x50a69f,null));};exports[_0x3b24('0x58')]=function(_0x3c0664,_0x5950ad,_0x408083){return db[_0x3b24('0x34')]['find']({'where':{'id':_0x3c0664['params']['id']}})[_0x3b24('0x2c')](handleEntityNotFound(_0x5950ad,null))[_0x3b24('0x2c')](function(_0x54726d){if(_0x54726d){return _0x54726d[_0x3b24('0x58')](_0x3c0664[_0x3b24('0x38')]['ids']);}})[_0x3b24('0x2c')](respondWithStatusCode(_0x5950ad,null))[_0x3b24('0x4a')](handleError(_0x5950ad,null));};exports[_0x3b24('0x59')]=function(_0x26935a,_0x38f996,_0x5a158e){if(_0x26935a[_0x3b24('0x4f')]['id']){delete _0x26935a[_0x3b24('0x4f')]['id'];}return db['ChatGroup'][_0x3b24('0x4d')]({'where':{'id':_0x26935a[_0x3b24('0x4b')]['id']}})['then'](handleEntityNotFound(_0x38f996,null))[_0x3b24('0x2c')](function(_0x4e28dd){if(_0x4e28dd){_0x26935a['body'][_0x3b24('0x5a')]=_0x4e28dd['id'];return db['ChatInternalMessage']['create'](_0x26935a['body']);}})[_0x3b24('0x2c')](respondWithResult(_0x38f996,null))[_0x3b24('0x4a')](handleError(_0x38f996,null));};exports[_0x3b24('0x5b')]=function(_0x1566f9,_0x4ee9e3,_0x29a4d7){var _0x7526b9={};var _0x41e05e={};var _0x41bf6d;var _0x3b27c3;return db[_0x3b24('0x34')][_0x3b24('0x55')]({'where':{'id':_0x1566f9['params']['id']}})[_0x3b24('0x2c')](handleEntityNotFound(_0x4ee9e3,null))['then'](function(_0x36e1d8){if(_0x36e1d8){_0x41bf6d=_0x36e1d8;_0x41e05e[_0x3b24('0x3b')]=_[_0x3b24('0x39')](db['ChatInternalMessage'][_0x3b24('0x35')]);_0x41e05e['query']=_[_0x3b24('0x39')](_0x1566f9[_0x3b24('0x38')]);_0x41e05e[_0x3b24('0x42')]=_[_0x3b24('0x3a')](_0x41e05e['model'],_0x41e05e[_0x3b24('0x38')]);_0x7526b9[_0x3b24('0x3c')]=_[_0x3b24('0x3a')](_0x41e05e[_0x3b24('0x3b')],qs[_0x3b24('0x3d')](_0x1566f9[_0x3b24('0x38')][_0x3b24('0x3d')]));_0x7526b9[_0x3b24('0x3c')]=_0x7526b9['attributes']['length']?_0x7526b9['attributes']:_0x41e05e[_0x3b24('0x3b')];_0x7526b9[_0x3b24('0x3f')]=qs['sort'](_0x1566f9[_0x3b24('0x38')][_0x3b24('0x40')]);_0x7526b9[_0x3b24('0x41')]=qs[_0x3b24('0x42')](_[_0x3b24('0x5c')](_0x1566f9['query'],_0x41e05e[_0x3b24('0x42')]));if(_0x1566f9[_0x3b24('0x38')][_0x3b24('0x43')]){_0x7526b9['where']=_[_0x3b24('0x44')](_0x7526b9[_0x3b24('0x41')],{'$or':_[_0x3b24('0x33')](_0x7526b9[_0x3b24('0x3c')],function(_0x5b069f){var _0x3359ea={};_0x3359ea[_0x5b069f]={'$like':'%'+_0x1566f9['query']['filter']+'%'};return _0x3359ea;})});}if(_0x1566f9[_0x3b24('0x38')][_0x3b24('0x5d')]){var _0x1843e2=_0x1566f9['query']['$gte']['split'](',');var _0x437082={};_0x437082[_0x1843e2[0x0]]={'$gte':moment(_0x1843e2[0x1])[_0x3b24('0x5e')](_0x3b24('0x5f'))};_0x7526b9[_0x3b24('0x41')]=_[_0x3b24('0x44')](_0x7526b9[_0x3b24('0x41')],_0x437082);}_0x7526b9=_[_0x3b24('0x44')]({},_0x7526b9,_0x1566f9[_0x3b24('0x46')]);return _0x41bf6d[_0x3b24('0x5b')](_0x7526b9);}})[_0x3b24('0x2c')](function(_0x5cdbb8){if(_0x5cdbb8){_0x3b27c3=_0x5cdbb8['length'];if(!_0x1566f9[_0x3b24('0x38')][_0x3b24('0x3e')](_0x3b24('0x57'))){_0x7526b9['limit']=qs[_0x3b24('0x26')](_0x1566f9[_0x3b24('0x38')][_0x3b24('0x26')]);_0x7526b9[_0x3b24('0x24')]=qs[_0x3b24('0x24')](_0x1566f9[_0x3b24('0x38')]['offset']);}return _0x41bf6d['getMessages'](_0x7526b9);}})[_0x3b24('0x2c')](function(_0x49c39b){if(_0x49c39b){return _0x49c39b?{'count':_0x3b27c3,'rows':_0x49c39b}:null;}})['then'](respondWithResult(_0x4ee9e3,null))[_0x3b24('0x4a')](handleError(_0x4ee9e3,null));}; \ No newline at end of file +var _0xb2b3=['./chatGroup.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','destroy','error','stack','name','index','map','ChatGroup','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','fields','find','create','body','params','describe','getUnread','ChatInternalMessage','toInteger','addMembers','ids','getMembers','User','removeMembers','addMessage','ChatGroupId','getMessages','findOne','$gte','split','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost'];(function(_0x90ceb7,_0x4c4024){var _0x2fc7cc=function(_0x5460d9){while(--_0x5460d9){_0x90ceb7['push'](_0x90ceb7['shift']());}};_0x2fc7cc(++_0x4c4024);}(_0xb2b3,0xa3));var _0x3b2b=function(_0x138d6e,_0x3b74b6){_0x138d6e=_0x138d6e-0x0;var _0xfa6a15=_0xb2b3[_0x138d6e];return _0xfa6a15;};'use strict';var emlformat=require(_0x3b2b('0x0'));var rimraf=require(_0x3b2b('0x1'));var zipdir=require(_0x3b2b('0x2'));var jsonpatch=require(_0x3b2b('0x3'));var rp=require(_0x3b2b('0x4'));var moment=require('moment');var BPromise=require(_0x3b2b('0x5'));var Mustache=require(_0x3b2b('0x6'));var util=require(_0x3b2b('0x7'));var path=require('path');var sox=require(_0x3b2b('0x8'));var csv=require(_0x3b2b('0x9'));var ejs=require(_0x3b2b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3b2b('0xb'));var squel=require('squel');var crypto=require(_0x3b2b('0xc'));var jsforce=require(_0x3b2b('0xd'));var deskjs=require(_0x3b2b('0xe'));var toCsv=require(_0x3b2b('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3b2b('0xf'));var authService=require(_0x3b2b('0x10'));var qs=require(_0x3b2b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3b2b('0x12'));var logger=require(_0x3b2b('0x13'))(_0x3b2b('0x14'));var utils=require(_0x3b2b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x3b2b('0x16'));var db=require(_0x3b2b('0x17'))['db'];config[_0x3b2b('0x18')]=_[_0x3b2b('0x19')](config[_0x3b2b('0x18')],{'host':_0x3b2b('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3b2b('0x1b'))[_0x3b2b('0x1c')](socket);function respondWithStatusCode(_0x119ac5,_0x4a364b){_0x4a364b=_0x4a364b||0xcc;return function(_0x43b580){if(_0x43b580){return _0x119ac5[_0x3b2b('0x1d')](_0x4a364b);}return _0x119ac5[_0x3b2b('0x1e')](_0x4a364b)[_0x3b2b('0x1f')]();};}function respondWithResult(_0x495b2d,_0x4a4d38){_0x4a4d38=_0x4a4d38||0xc8;return function(_0x5b938b){if(_0x5b938b){return _0x495b2d['status'](_0x4a4d38)[_0x3b2b('0x20')](_0x5b938b);}};}function respondWithFilteredResult(_0x2fe682,_0x244127){return function(_0x4a6d9f){if(_0x4a6d9f){var _0x2fae69=typeof _0x244127[_0x3b2b('0x21')]==='undefined'&&typeof _0x244127[_0x3b2b('0x22')]===_0x3b2b('0x23');var _0x582127=_0x4a6d9f[_0x3b2b('0x24')];var _0x643703=_0x2fae69?0x0:_0x244127[_0x3b2b('0x21')];var _0x24da98=_0x2fae69?_0x4a6d9f[_0x3b2b('0x24')]:_0x244127[_0x3b2b('0x21')]+_0x244127['limit'];var _0x591467;if(_0x24da98>=_0x582127){_0x24da98=_0x582127;_0x591467=0xc8;}else{_0x591467=0xce;}_0x2fe682[_0x3b2b('0x1e')](_0x591467);return _0x2fe682[_0x3b2b('0x25')](_0x3b2b('0x26'),_0x643703+'-'+_0x24da98+'/'+_0x582127)[_0x3b2b('0x20')](_0x4a6d9f);}return null;};}function patchUpdates(_0x2c57cd){return function(_0x1745aa){try{jsonpatch[_0x3b2b('0x27')](_0x1745aa,_0x2c57cd,!![]);}catch(_0x2fd2dd){return BPromise['reject'](_0x2fd2dd);}return _0x1745aa['save']();};}function saveUpdates(_0x4e93ad,_0x2d3933){return function(_0x581bb4){if(_0x581bb4){return _0x581bb4[_0x3b2b('0x28')](_0x4e93ad)[_0x3b2b('0x29')](function(_0x14cb83){return _0x14cb83;});}return null;};}function removeEntity(_0xa64577,_0x5c589b){return function(_0x4c10eb){if(_0x4c10eb){return _0x4c10eb[_0x3b2b('0x2a')]()['then'](function(){_0xa64577[_0x3b2b('0x1e')](0xcc)[_0x3b2b('0x1f')]();});}};}function handleEntityNotFound(_0x16c3ab,_0x7b8b0c){return function(_0x3b61a4){if(!_0x3b61a4){_0x16c3ab[_0x3b2b('0x1d')](0x194);}return _0x3b61a4;};}function handleError(_0x51a5cd,_0x5ed195){_0x5ed195=_0x5ed195||0x1f4;return function(_0x43cb17){logger[_0x3b2b('0x2b')](_0x43cb17[_0x3b2b('0x2c')]);if(_0x43cb17[_0x3b2b('0x2d')]){delete _0x43cb17[_0x3b2b('0x2d')];}_0x51a5cd[_0x3b2b('0x1e')](_0x5ed195)['send'](_0x43cb17);};}exports[_0x3b2b('0x2e')]=function(_0x479c36,_0x59056c){var _0x23e509={},_0x4bebe7={},_0x1e3590={'count':0x0,'rows':[]};var _0x14d18c=_[_0x3b2b('0x2f')](db[_0x3b2b('0x30')][_0x3b2b('0x31')],function(_0x5d07a1){return{'name':_0x5d07a1[_0x3b2b('0x32')],'type':_0x5d07a1[_0x3b2b('0x33')]['key']};});_0x4bebe7[_0x3b2b('0x34')]=_[_0x3b2b('0x2f')](_0x14d18c,_0x3b2b('0x2d'));_0x4bebe7['query']=_['keys'](_0x479c36[_0x3b2b('0x35')]);_0x4bebe7[_0x3b2b('0x36')]=_['intersection'](_0x4bebe7[_0x3b2b('0x34')],_0x4bebe7[_0x3b2b('0x35')]);_0x23e509[_0x3b2b('0x37')]=_[_0x3b2b('0x38')](_0x4bebe7[_0x3b2b('0x34')],qs['fields'](_0x479c36[_0x3b2b('0x35')]['fields']));_0x23e509[_0x3b2b('0x37')]=_0x23e509['attributes'][_0x3b2b('0x39')]?_0x23e509['attributes']:_0x4bebe7[_0x3b2b('0x34')];if(!_0x479c36['query'][_0x3b2b('0x3a')](_0x3b2b('0x3b'))){_0x23e509['limit']=qs[_0x3b2b('0x22')](_0x479c36['query'][_0x3b2b('0x22')]);_0x23e509['offset']=qs['offset'](_0x479c36[_0x3b2b('0x35')]['offset']);}_0x23e509[_0x3b2b('0x3c')]=qs[_0x3b2b('0x3d')](_0x479c36[_0x3b2b('0x35')][_0x3b2b('0x3d')]);_0x23e509[_0x3b2b('0x3e')]=qs['filters'](_[_0x3b2b('0x3f')](_0x479c36[_0x3b2b('0x35')],_0x4bebe7[_0x3b2b('0x36')]),_0x14d18c);if(_0x479c36[_0x3b2b('0x35')][_0x3b2b('0x40')]){_0x23e509['where']=_[_0x3b2b('0x41')](_0x23e509['where'],{'$or':_[_0x3b2b('0x2f')](_0x14d18c,function(_0x47d636){if(_0x47d636[_0x3b2b('0x33')]!==_0x3b2b('0x42')){var _0x1ba9e1={};_0x1ba9e1[_0x47d636[_0x3b2b('0x2d')]]={'$like':'%'+_0x479c36[_0x3b2b('0x35')][_0x3b2b('0x40')]+'%'};return _0x1ba9e1;}})});}_0x23e509=_[_0x3b2b('0x41')]({},_0x23e509,_0x479c36[_0x3b2b('0x43')]);var _0x2c7b05={'where':_0x23e509['where']};return db[_0x3b2b('0x30')][_0x3b2b('0x24')](_0x2c7b05)['then'](function(_0x398710){_0x1e3590[_0x3b2b('0x24')]=_0x398710;if(_0x479c36[_0x3b2b('0x35')][_0x3b2b('0x44')]){_0x23e509[_0x3b2b('0x45')]=[{'all':!![]}];}return db[_0x3b2b('0x30')][_0x3b2b('0x46')](_0x23e509);})[_0x3b2b('0x29')](function(_0x358ee){_0x1e3590[_0x3b2b('0x47')]=_0x358ee;return _0x1e3590;})[_0x3b2b('0x29')](respondWithFilteredResult(_0x59056c,_0x23e509))[_0x3b2b('0x48')](handleError(_0x59056c,null));};exports['show']=function(_0x3cd173,_0x4f70ee){var _0x384fc9={'raw':!![],'where':{'id':_0x3cd173['params']['id']}},_0x41a766={};_0x41a766[_0x3b2b('0x34')]=_[_0x3b2b('0x49')](db[_0x3b2b('0x30')][_0x3b2b('0x31')]);_0x41a766[_0x3b2b('0x35')]=_[_0x3b2b('0x49')](_0x3cd173['query']);_0x41a766['filters']=_[_0x3b2b('0x38')](_0x41a766[_0x3b2b('0x34')],_0x41a766[_0x3b2b('0x35')]);_0x384fc9['attributes']=_[_0x3b2b('0x38')](_0x41a766[_0x3b2b('0x34')],qs[_0x3b2b('0x4a')](_0x3cd173[_0x3b2b('0x35')]['fields']));_0x384fc9[_0x3b2b('0x37')]=_0x384fc9['attributes'][_0x3b2b('0x39')]?_0x384fc9[_0x3b2b('0x37')]:_0x41a766[_0x3b2b('0x34')];if(_0x3cd173[_0x3b2b('0x35')][_0x3b2b('0x44')]){_0x384fc9[_0x3b2b('0x45')]=[{'all':!![]}];}_0x384fc9=_[_0x3b2b('0x41')]({},_0x384fc9,_0x3cd173[_0x3b2b('0x43')]);return db[_0x3b2b('0x30')][_0x3b2b('0x4b')](_0x384fc9)[_0x3b2b('0x29')](handleEntityNotFound(_0x4f70ee,null))['then'](respondWithResult(_0x4f70ee,null))['catch'](handleError(_0x4f70ee,null));};exports['create']=function(_0x40ff47,_0xf1ffe){return db['ChatGroup'][_0x3b2b('0x4c')](_0x40ff47[_0x3b2b('0x4d')],{})['then'](respondWithResult(_0xf1ffe,0xc9))[_0x3b2b('0x48')](handleError(_0xf1ffe,null));};exports[_0x3b2b('0x28')]=function(_0x5db69b,_0x246b5e){if(_0x5db69b['body']['id']){delete _0x5db69b[_0x3b2b('0x4d')]['id'];}return db[_0x3b2b('0x30')]['find']({'where':{'id':_0x5db69b[_0x3b2b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x246b5e,null))['then'](saveUpdates(_0x5db69b[_0x3b2b('0x4d')],null))[_0x3b2b('0x29')](respondWithResult(_0x246b5e,null))[_0x3b2b('0x48')](handleError(_0x246b5e,null));};exports['destroy']=function(_0x191149,_0x31ab81){return db['ChatGroup'][_0x3b2b('0x4b')]({'where':{'id':_0x191149[_0x3b2b('0x4e')]['id']}})[_0x3b2b('0x29')](handleEntityNotFound(_0x31ab81,null))[_0x3b2b('0x29')](removeEntity(_0x31ab81,null))[_0x3b2b('0x48')](handleError(_0x31ab81,null));};exports[_0x3b2b('0x4f')]=function(_0x24e764,_0x3bdbc9){return db[_0x3b2b('0x30')][_0x3b2b('0x4f')]()[_0x3b2b('0x29')](respondWithResult(_0x3bdbc9,null))['catch'](handleError(_0x3bdbc9,null));};exports[_0x3b2b('0x50')]=function(_0x4c5b63,_0x482317,_0x494ffb){return db[_0x3b2b('0x51')]['count']({'where':{'ChatGroupId':_0x4c5b63[_0x3b2b('0x4e')]['id'],'ToId':_0x4c5b63['user']['id'],'read':![]}})['then'](function(_0x293af9){return{'id':_[_0x3b2b('0x52')](_0x4c5b63[_0x3b2b('0x4e')]['id']),'count':_0x293af9};})[_0x3b2b('0x29')](respondWithResult(_0x482317,null))[_0x3b2b('0x48')](handleError(_0x482317,null));};exports[_0x3b2b('0x53')]=function(_0x3744b3,_0x1f3a07,_0x23a265){return db[_0x3b2b('0x30')][_0x3b2b('0x4b')]({'where':{'id':_0x3744b3[_0x3b2b('0x4e')]['id']}})[_0x3b2b('0x29')](handleEntityNotFound(_0x1f3a07,null))[_0x3b2b('0x29')](function(_0x324b2a){if(_0x324b2a){return _0x324b2a[_0x3b2b('0x53')](_0x3744b3[_0x3b2b('0x4d')]['ids'],_['omit'](_0x3744b3[_0x3b2b('0x4d')],[_0x3b2b('0x54'),'id'])||{});}})[_0x3b2b('0x29')](respondWithResult(_0x1f3a07,null))[_0x3b2b('0x48')](handleError(_0x1f3a07,null));};exports[_0x3b2b('0x55')]=function(_0x3f1c8b,_0x24c3e9,_0x20d2b9){var _0x371cbe={};var _0x380370={};var _0x4244dd;var _0x333cf5;return db[_0x3b2b('0x30')]['findOne']({'where':{'id':_0x3f1c8b[_0x3b2b('0x4e')]['id']}})[_0x3b2b('0x29')](handleEntityNotFound(_0x24c3e9,null))[_0x3b2b('0x29')](function(_0x745d15){if(_0x745d15){_0x4244dd=_0x745d15;_0x380370[_0x3b2b('0x34')]=_[_0x3b2b('0x49')](db[_0x3b2b('0x56')][_0x3b2b('0x31')]);_0x380370[_0x3b2b('0x35')]=_['keys'](_0x3f1c8b['query']);_0x380370[_0x3b2b('0x36')]=_['intersection'](_0x380370['model'],_0x380370[_0x3b2b('0x35')]);_0x371cbe[_0x3b2b('0x37')]=_[_0x3b2b('0x38')](_0x380370[_0x3b2b('0x34')],qs[_0x3b2b('0x4a')](_0x3f1c8b[_0x3b2b('0x35')][_0x3b2b('0x4a')]));_0x371cbe[_0x3b2b('0x37')]=_0x371cbe['attributes'][_0x3b2b('0x39')]?_0x371cbe[_0x3b2b('0x37')]:_0x380370[_0x3b2b('0x34')];_0x371cbe[_0x3b2b('0x3c')]=qs[_0x3b2b('0x3d')](_0x3f1c8b[_0x3b2b('0x35')][_0x3b2b('0x3d')]);_0x371cbe[_0x3b2b('0x3e')]=qs[_0x3b2b('0x36')](_[_0x3b2b('0x3f')](_0x3f1c8b[_0x3b2b('0x35')],_0x380370[_0x3b2b('0x36')]));if(_0x3f1c8b[_0x3b2b('0x35')][_0x3b2b('0x40')]){_0x371cbe[_0x3b2b('0x3e')]=_[_0x3b2b('0x41')](_0x371cbe[_0x3b2b('0x3e')],{'$or':_[_0x3b2b('0x2f')](_0x371cbe[_0x3b2b('0x37')],function(_0x17da93){var _0x13644b={};_0x13644b[_0x17da93]={'$like':'%'+_0x3f1c8b[_0x3b2b('0x35')][_0x3b2b('0x40')]+'%'};return _0x13644b;})});}_0x371cbe=_[_0x3b2b('0x41')]({},_0x371cbe,_0x3f1c8b[_0x3b2b('0x43')]);return _0x4244dd[_0x3b2b('0x55')](_0x371cbe);}})['then'](function(_0xd88ed){if(_0xd88ed){_0x333cf5=_0xd88ed['length'];if(!_0x3f1c8b[_0x3b2b('0x35')][_0x3b2b('0x3a')](_0x3b2b('0x3b'))){_0x371cbe[_0x3b2b('0x22')]=qs[_0x3b2b('0x22')](_0x3f1c8b[_0x3b2b('0x35')][_0x3b2b('0x22')]);_0x371cbe['offset']=qs['offset'](_0x3f1c8b['query'][_0x3b2b('0x21')]);}return _0x4244dd[_0x3b2b('0x55')](_0x371cbe);}})['then'](function(_0x1587a4){if(_0x1587a4){return _0x1587a4?{'count':_0x333cf5,'rows':_0x1587a4}:null;}})[_0x3b2b('0x29')](respondWithResult(_0x24c3e9,null))[_0x3b2b('0x48')](handleError(_0x24c3e9,null));};exports[_0x3b2b('0x57')]=function(_0x1276b4,_0x568ccd,_0x3b6d03){return db[_0x3b2b('0x30')]['find']({'where':{'id':_0x1276b4[_0x3b2b('0x4e')]['id']}})[_0x3b2b('0x29')](handleEntityNotFound(_0x568ccd,null))[_0x3b2b('0x29')](function(_0x39835a){if(_0x39835a){return _0x39835a[_0x3b2b('0x57')](_0x1276b4[_0x3b2b('0x35')][_0x3b2b('0x54')]);}})[_0x3b2b('0x29')](respondWithStatusCode(_0x568ccd,null))[_0x3b2b('0x48')](handleError(_0x568ccd,null));};exports[_0x3b2b('0x58')]=function(_0x22b72e,_0x99c360,_0x3a50fb){if(_0x22b72e[_0x3b2b('0x4d')]['id']){delete _0x22b72e['body']['id'];}return db[_0x3b2b('0x30')][_0x3b2b('0x4b')]({'where':{'id':_0x22b72e[_0x3b2b('0x4e')]['id']}})[_0x3b2b('0x29')](handleEntityNotFound(_0x99c360,null))[_0x3b2b('0x29')](function(_0x5b0836){if(_0x5b0836){_0x22b72e[_0x3b2b('0x4d')][_0x3b2b('0x59')]=_0x5b0836['id'];return db['ChatInternalMessage'][_0x3b2b('0x4c')](_0x22b72e[_0x3b2b('0x4d')]);}})[_0x3b2b('0x29')](respondWithResult(_0x99c360,null))[_0x3b2b('0x48')](handleError(_0x99c360,null));};exports[_0x3b2b('0x5a')]=function(_0x1864c4,_0x32c271,_0x4e97c2){var _0x4aefd5={};var _0x1f73b3={};var _0x1bf7ae;var _0x3db389;return db[_0x3b2b('0x30')][_0x3b2b('0x5b')]({'where':{'id':_0x1864c4[_0x3b2b('0x4e')]['id']}})[_0x3b2b('0x29')](handleEntityNotFound(_0x32c271,null))[_0x3b2b('0x29')](function(_0x302400){if(_0x302400){_0x1bf7ae=_0x302400;_0x1f73b3[_0x3b2b('0x34')]=_['keys'](db[_0x3b2b('0x51')][_0x3b2b('0x31')]);_0x1f73b3['query']=_[_0x3b2b('0x49')](_0x1864c4[_0x3b2b('0x35')]);_0x1f73b3[_0x3b2b('0x36')]=_[_0x3b2b('0x38')](_0x1f73b3[_0x3b2b('0x34')],_0x1f73b3[_0x3b2b('0x35')]);_0x4aefd5[_0x3b2b('0x37')]=_[_0x3b2b('0x38')](_0x1f73b3['model'],qs[_0x3b2b('0x4a')](_0x1864c4[_0x3b2b('0x35')][_0x3b2b('0x4a')]));_0x4aefd5[_0x3b2b('0x37')]=_0x4aefd5['attributes'][_0x3b2b('0x39')]?_0x4aefd5[_0x3b2b('0x37')]:_0x1f73b3[_0x3b2b('0x34')];_0x4aefd5[_0x3b2b('0x3c')]=qs[_0x3b2b('0x3d')](_0x1864c4[_0x3b2b('0x35')][_0x3b2b('0x3d')]);_0x4aefd5[_0x3b2b('0x3e')]=qs[_0x3b2b('0x36')](_['pick'](_0x1864c4['query'],_0x1f73b3[_0x3b2b('0x36')]));if(_0x1864c4[_0x3b2b('0x35')]['filter']){_0x4aefd5[_0x3b2b('0x3e')]=_[_0x3b2b('0x41')](_0x4aefd5[_0x3b2b('0x3e')],{'$or':_['map'](_0x4aefd5['attributes'],function(_0x1544b4){var _0x21a357={};_0x21a357[_0x1544b4]={'$like':'%'+_0x1864c4['query'][_0x3b2b('0x40')]+'%'};return _0x21a357;})});}if(_0x1864c4['query'][_0x3b2b('0x5c')]){var _0x2d9f85=_0x1864c4[_0x3b2b('0x35')][_0x3b2b('0x5c')][_0x3b2b('0x5d')](',');var _0x2be373={};_0x2be373[_0x2d9f85[0x0]]={'$gte':moment(_0x2d9f85[0x1])['format'](_0x3b2b('0x5e'))};_0x4aefd5[_0x3b2b('0x3e')]=_[_0x3b2b('0x41')](_0x4aefd5[_0x3b2b('0x3e')],_0x2be373);}_0x4aefd5=_[_0x3b2b('0x41')]({},_0x4aefd5,_0x1864c4[_0x3b2b('0x43')]);return _0x1bf7ae['getMessages'](_0x4aefd5);}})[_0x3b2b('0x29')](function(_0x2afb9c){if(_0x2afb9c){_0x3db389=_0x2afb9c['length'];if(!_0x1864c4['query']['hasOwnProperty']('nolimit')){_0x4aefd5[_0x3b2b('0x22')]=qs[_0x3b2b('0x22')](_0x1864c4[_0x3b2b('0x35')][_0x3b2b('0x22')]);_0x4aefd5['offset']=qs['offset'](_0x1864c4[_0x3b2b('0x35')][_0x3b2b('0x21')]);}return _0x1bf7ae[_0x3b2b('0x5a')](_0x4aefd5);}})[_0x3b2b('0x29')](function(_0x3956f5){if(_0x3956f5){return _0x3956f5?{'count':_0x3db389,'rows':_0x3956f5}:null;}})[_0x3b2b('0x29')](respondWithResult(_0x32c271,null))['catch'](handleError(_0x32c271,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 564da2a..819c7aa 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 _0x5532=['save','remove','hasOwnProperty','hook','events','../../mysqldb','ChatGroup'];(function(_0x2b341f,_0x5bd3b8){var _0x4a4f94=function(_0x2e0c1f){while(--_0x2e0c1f){_0x2b341f['push'](_0x2b341f['shift']());}};_0x4a4f94(++_0x5bd3b8);}(_0x5532,0x19a));var _0x2553=function(_0x1371f0,_0xc9e1f2){_0x1371f0=_0x1371f0-0x0;var _0x359a56=_0x5532[_0x1371f0];return _0x359a56;};'use strict';var EventEmitter=require(_0x2553('0x0'));var ChatGroup=require(_0x2553('0x1'))['db'][_0x2553('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2553('0x3'),'afterUpdate':'update','afterDestroy':_0x2553('0x4')};function emitEvent(_0x17a930){return function(_0x2e4ec0,_0x5233bd,_0x45926c){ChatGroupEvents['emit'](_0x17a930+':'+_0x2e4ec0['id'],_0x2e4ec0);ChatGroupEvents['emit'](_0x17a930,_0x2e4ec0);_0x45926c(null);};}for(var e in events){if(events[_0x2553('0x5')](e)){var event=events[e];ChatGroup[_0x2553('0x6')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x0d64=['setMaxListeners','update','emit','hook','exports','events','../../mysqldb','ChatGroup'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x0d64,0xad));var _0x40d6=function(_0x20e4a7,_0x44787f){_0x20e4a7=_0x20e4a7-0x0;var _0x5108e3=_0x0d64[_0x20e4a7];return _0x5108e3;};'use strict';var EventEmitter=require(_0x40d6('0x0'));var ChatGroup=require(_0x40d6('0x1'))['db'][_0x40d6('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x40d6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x40d6('0x4'),'afterDestroy':'remove'};function emitEvent(_0x139084){return function(_0x2121fa,_0x343245,_0x35beb5){ChatGroupEvents[_0x40d6('0x5')](_0x139084+':'+_0x2121fa['id'],_0x2121fa);ChatGroupEvents[_0x40d6('0x5')](_0x139084,_0x2121fa);_0x35beb5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x40d6('0x6')](e,emitEvent(event));}}module[_0x40d6('0x7')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 462fee9..5a2fe78 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 _0xe4c8=['rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x377338,_0x3955ad){var _0x3b32f2=function(_0x820b43){while(--_0x820b43){_0x377338['push'](_0x377338['shift']());}};_0x3b32f2(++_0x3955ad);}(_0xe4c8,0x166));var _0x8e4c=function(_0x21e952,_0x1bbfc8){_0x21e952=_0x21e952-0x0;var _0x2e6340=_0xe4c8[_0x21e952];return _0x2e6340;};'use strict';var _=require(_0x8e4c('0x0'));var util=require('util');var logger=require(_0x8e4c('0x1'))('api');var moment=require(_0x8e4c('0x2'));var BPromise=require(_0x8e4c('0x3'));var rp=require(_0x8e4c('0x4'));var fs=require('fs');var path=require(_0x8e4c('0x5'));var rimraf=require(_0x8e4c('0x6'));var config=require(_0x8e4c('0x7'));var attributes=require(_0x8e4c('0x8'));module[_0x8e4c('0x9')]=function(_0x216ca6,_0x49ca42){return _0x216ca6[_0x8e4c('0xa')](_0x8e4c('0xb'),attributes,{'tableName':_0x8e4c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b8f=['api','path','rimraf','../../config/environment','./chatGroup.attributes','ChatGroup','chat_groups','lodash','util','../../config/logger'];(function(_0x212fcc,_0x1a8867){var _0x4d8190=function(_0x347f7b){while(--_0x347f7b){_0x212fcc['push'](_0x212fcc['shift']());}};_0x4d8190(++_0x1a8867);}(_0x2b8f,0x93));var _0xf2b8=function(_0x4ebbdd,_0x5612db){_0x4ebbdd=_0x4ebbdd-0x0;var _0x7c48=_0x2b8f[_0x4ebbdd];return _0x7c48;};'use strict';var _=require(_0xf2b8('0x0'));var util=require(_0xf2b8('0x1'));var logger=require(_0xf2b8('0x2'))(_0xf2b8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf2b8('0x4'));var rimraf=require(_0xf2b8('0x5'));var config=require(_0xf2b8('0x6'));var attributes=require(_0xf2b8('0x7'));module['exports']=function(_0x3ece5c,_0x31026e){return _0x3ece5c['define'](_0xf2b8('0x8'),attributes,{'tableName':_0xf2b8('0x9'),'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 5165a5e..5c4f36e 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 _0xb2b5=['result','catch','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./chatGroup.socket','register','request','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatGroup,\x20%s,\x20%s'];(function(_0x3d61b1,_0x2c749d){var _0x1309cb=function(_0x12084e){while(--_0x12084e){_0x3d61b1['push'](_0x3d61b1['shift']());}};_0x1309cb(++_0x2c749d);}(_0xb2b5,0xa3));var _0x5b2b=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xb2b5[_0x3d42d8];return _0x27fc41;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5b2b('0x0'));var fs=require('fs');var Redis=require(_0x5b2b('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5b2b('0x2'))(_0x5b2b('0x3'));var config=require(_0x5b2b('0x4'));var jayson=require(_0x5b2b('0x5'));var client=jayson['client'][_0x5b2b('0x6')]({'port':0x232a});config[_0x5b2b('0x7')]=_['defaults'](config['redis'],{'host':_0x5b2b('0x8'),'port':0x18eb});var socket=require(_0x5b2b('0x9'))(new Redis(config[_0x5b2b('0x7')]));require(_0x5b2b('0xa'))[_0x5b2b('0xb')](socket);function respondWithRpcPromise(_0x29d7be,_0x15425f,_0xa39fc6){return new BPromise(function(_0x52675e,_0x56c260){return client[_0x5b2b('0xc')](_0x29d7be,_0xa39fc6)['then'](function(_0x1290ed){logger[_0x5b2b('0xd')]('ChatGroup,\x20%s,\x20%s',_0x15425f,_0x5b2b('0xe'));logger[_0x5b2b('0xf')](_0x5b2b('0x10'),_0x15425f,_0x5b2b('0xe'),JSON[_0x5b2b('0x11')](_0x1290ed));if(_0x1290ed[_0x5b2b('0x12')]){if(_0x1290ed[_0x5b2b('0x12')]['code']===0x1f4){logger[_0x5b2b('0x12')]('ChatGroup,\x20%s,\x20%s',_0x15425f,_0x1290ed[_0x5b2b('0x12')][_0x5b2b('0x13')]);return _0x56c260(_0x1290ed[_0x5b2b('0x12')][_0x5b2b('0x13')]);}logger['error'](_0x5b2b('0x14'),_0x15425f,_0x1290ed['error'][_0x5b2b('0x13')]);return _0x52675e(_0x1290ed['error']['message']);}else{logger[_0x5b2b('0xd')](_0x5b2b('0x14'),_0x15425f,'request\x20sent');_0x52675e(_0x1290ed[_0x5b2b('0x15')][_0x5b2b('0x13')]);}})[_0x5b2b('0x16')](function(_0xce3474){logger[_0x5b2b('0x12')]('ChatGroup,\x20%s,\x20%s',_0x15425f,_0xce3474);_0x56c260(_0xce3474);});});} \ No newline at end of file +var _0x861c=['info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','ChatGroup,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','then'];(function(_0xf8c29d,_0x1924b9){var _0x1aa975=function(_0x4b6b1c){while(--_0x4b6b1c){_0xf8c29d['push'](_0xf8c29d['shift']());}};_0x1aa975(++_0x1924b9);}(_0x861c,0xdb));var _0xc861=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x861c[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xc861('0x0'));var util=require(_0xc861('0x1'));var moment=require(_0xc861('0x2'));var BPromise=require(_0xc861('0x3'));var rs=require(_0xc861('0x4'));var fs=require('fs');var Redis=require(_0xc861('0x5'));var db=require(_0xc861('0x6'))['db'];var utils=require(_0xc861('0x7'));var logger=require(_0xc861('0x8'))(_0xc861('0x9'));var config=require(_0xc861('0xa'));var jayson=require(_0xc861('0xb'));var client=jayson['client'][_0xc861('0xc')]({'port':0x232a});config[_0xc861('0xd')]=_[_0xc861('0xe')](config[_0xc861('0xd')],{'host':_0xc861('0xf'),'port':0x18eb});var socket=require(_0xc861('0x10'))(new Redis(config[_0xc861('0xd')]));require(_0xc861('0x11'))[_0xc861('0x12')](socket);function respondWithRpcPromise(_0x2dae1e,_0x43a775,_0x12a16e){return new BPromise(function(_0xa3d51b,_0x57382d){return client[_0xc861('0x13')](_0x2dae1e,_0x12a16e)[_0xc861('0x14')](function(_0x2092f0){logger[_0xc861('0x15')]('ChatGroup,\x20%s,\x20%s',_0x43a775,_0xc861('0x16'));logger[_0xc861('0x17')](_0xc861('0x18'),_0x43a775,_0xc861('0x16'),JSON['stringify'](_0x2092f0));if(_0x2092f0['error']){if(_0x2092f0[_0xc861('0x19')][_0xc861('0x1a')]===0x1f4){logger['error'](_0xc861('0x1b'),_0x43a775,_0x2092f0[_0xc861('0x19')]['message']);return _0x57382d(_0x2092f0[_0xc861('0x19')][_0xc861('0x1c')]);}logger[_0xc861('0x19')](_0xc861('0x1b'),_0x43a775,_0x2092f0[_0xc861('0x19')][_0xc861('0x1c')]);return _0xa3d51b(_0x2092f0['error']['message']);}else{logger[_0xc861('0x15')]('ChatGroup,\x20%s,\x20%s',_0x43a775,_0xc861('0x16'));_0xa3d51b(_0x2092f0[_0xc861('0x1d')][_0xc861('0x1c')]);}})['catch'](function(_0x293763){logger['error'](_0xc861('0x1b'),_0x43a775,_0x293763);_0x57382d(_0x293763);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index b9060a4..b5e4778 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 _0x9885=['save','update','register','length','chatGroup:','./chatGroup.events'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9885,0x179));var _0x5988=function(_0x456317,_0x1c5367){_0x456317=_0x456317-0x0;var _0x4ddfc7=_0x9885[_0x456317];return _0x4ddfc7;};'use strict';var ChatGroupEvents=require(_0x5988('0x0'));var events=[_0x5988('0x1'),'remove',_0x5988('0x2')];function createListener(_0x2c6337,_0x134de9){return function(_0x37175f){_0x134de9['emit'](_0x2c6337,_0x37175f);};}function removeListener(_0x34f817,_0x125b02){return function(){ChatGroupEvents['removeListener'](_0x34f817,_0x125b02);};}exports[_0x5988('0x3')]=function(_0x4ef2f9){for(var _0x3d17cc=0x0,_0x174665=events[_0x5988('0x4')];_0x3d17cc<_0x174665;_0x3d17cc++){var _0x5f1659=events[_0x3d17cc];var _0x2f7474=createListener(_0x5988('0x5')+_0x5f1659,_0x4ef2f9);ChatGroupEvents['on'](_0x5f1659,_0x2f7474);}}; \ No newline at end of file +var _0x1881=['save','remove','update','emit','removeListener','register','length'];(function(_0x483181,_0x1496ec){var _0x4f274f=function(_0x5d47a5){while(--_0x5d47a5){_0x483181['push'](_0x483181['shift']());}};_0x4f274f(++_0x1496ec);}(_0x1881,0x1ea));var _0x1188=function(_0x3064a3,_0x20e71a){_0x3064a3=_0x3064a3-0x0;var _0x4319b6=_0x1881[_0x3064a3];return _0x4319b6;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x1188('0x0'),_0x1188('0x1'),_0x1188('0x2')];function createListener(_0x18fe1d,_0x30dc90){return function(_0x45a883){_0x30dc90[_0x1188('0x3')](_0x18fe1d,_0x45a883);};}function removeListener(_0x1ec6ec,_0x234ead){return function(){ChatGroupEvents[_0x1188('0x4')](_0x1ec6ec,_0x234ead);};}exports[_0x1188('0x5')]=function(_0x2e7d26){for(var _0x50c1f1=0x0,_0x171f3a=events[_0x1188('0x6')];_0x50c1f1<_0x171f3a;_0x50c1f1++){var _0x9d26b=events[_0x50c1f1];var _0x47c345=createListener('chatGroup:'+_0x9d26b,_0x2e7d26);ChatGroupEvents['on'](_0x9d26b,_0x47c345);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 3d27d5e..21722ff 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 _0x8fc7=['fs-extra','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/unread','/:id/messages','getMessages','post','/:id/members','addMessage','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x16aaef,_0x410651){var _0x1c82ef=function(_0x3d802b){while(--_0x3d802b){_0x16aaef['push'](_0x16aaef['shift']());}};_0x1c82ef(++_0x410651);}(_0x8fc7,0x133));var _0x78fc=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0x8fc7[_0x11ce46];return _0x368a1e;};'use strict';var multer=require(_0x78fc('0x0'));var util=require(_0x78fc('0x1'));var path=require(_0x78fc('0x2'));var timeout=require(_0x78fc('0x3'));var express=require('express');var router=express[_0x78fc('0x4')]();var fs_extra=require(_0x78fc('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x78fc('0x6'));var config=require(_0x78fc('0x7'));var controller=require(_0x78fc('0x8'));router[_0x78fc('0x9')]('/',auth[_0x78fc('0xa')](),controller[_0x78fc('0xb')]);router[_0x78fc('0x9')](_0x78fc('0xc'),auth[_0x78fc('0xa')](),controller[_0x78fc('0xd')]);router['get'](_0x78fc('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x78fc('0x9')](_0x78fc('0xf'),auth[_0x78fc('0xa')](),controller['getUnread']);router[_0x78fc('0x9')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router['get'](_0x78fc('0x10'),auth[_0x78fc('0xa')](),controller[_0x78fc('0x11')]);router[_0x78fc('0x12')]('/',auth[_0x78fc('0xa')](),controller['create']);router['post'](_0x78fc('0x13'),auth[_0x78fc('0xa')](),controller['addMembers']);router['post'](_0x78fc('0x10'),auth['isAuthenticated'](),controller[_0x78fc('0x14')]);router[_0x78fc('0x15')](_0x78fc('0xe'),auth[_0x78fc('0xa')](),controller[_0x78fc('0x16')]);router[_0x78fc('0x17')]('/:id',auth[_0x78fc('0xa')](),controller[_0x78fc('0x18')]);router[_0x78fc('0x17')]('/:id/members',auth[_0x78fc('0xa')](),controller['removeMembers']);module[_0x78fc('0x19')]=router; \ No newline at end of file +var _0xc72d=['addMessage','put','update','delete','destroy','removeMembers','multer','path','connect-timeout','../../components/interaction/service','./chatGroup.controller','get','isAuthenticated','/describe','describe','/:id','/:id/messages','post','create','/:id/members','addMembers'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc72d,0x156));var _0xdc72=function(_0x4c62d7,_0x180f85){_0x4c62d7=_0x4c62d7-0x0;var _0x4b02d8=_0xc72d[_0x4c62d7];return _0x4b02d8;};'use strict';var multer=require(_0xdc72('0x0'));var util=require('util');var path=require(_0xdc72('0x1'));var timeout=require(_0xdc72('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdc72('0x3'));var config=require('../../config/environment');var controller=require(_0xdc72('0x4'));router[_0xdc72('0x5')]('/',auth[_0xdc72('0x6')](),controller['index']);router[_0xdc72('0x5')](_0xdc72('0x7'),auth[_0xdc72('0x6')](),controller[_0xdc72('0x8')]);router[_0xdc72('0x5')](_0xdc72('0x9'),auth[_0xdc72('0x6')](),controller['show']);router[_0xdc72('0x5')]('/:id/unread',auth[_0xdc72('0x6')](),controller['getUnread']);router[_0xdc72('0x5')]('/:id/members',auth[_0xdc72('0x6')](),controller['getMembers']);router['get'](_0xdc72('0xa'),auth[_0xdc72('0x6')](),controller['getMessages']);router[_0xdc72('0xb')]('/',auth[_0xdc72('0x6')](),controller[_0xdc72('0xc')]);router[_0xdc72('0xb')](_0xdc72('0xd'),auth[_0xdc72('0x6')](),controller[_0xdc72('0xe')]);router[_0xdc72('0xb')](_0xdc72('0xa'),auth[_0xdc72('0x6')](),controller[_0xdc72('0xf')]);router[_0xdc72('0x10')](_0xdc72('0x9'),auth[_0xdc72('0x6')](),controller[_0xdc72('0x11')]);router[_0xdc72('0x12')](_0xdc72('0x9'),auth[_0xdc72('0x6')](),controller[_0xdc72('0x13')]);router[_0xdc72('0x12')](_0xdc72('0xd'),auth[_0xdc72('0x6')](),controller[_0xdc72('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 0b69f0d..6eef4db 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 _0x0cda=['out','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','DATE'];(function(_0x556f09,_0x21cbcb){var _0x478be0=function(_0x13e6ba){while(--_0x13e6ba){_0x556f09['push'](_0x556f09['shift']());}};_0x478be0(++_0x21cbcb);}(_0x0cda,0x14e));var _0xa0cd=function(_0x4ffdfe,_0x4e8734){_0x4ffdfe=_0x4ffdfe-0x0;var _0x304585=_0x0cda[_0x4ffdfe];return _0x304585;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0xa0cd('0x0')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xa0cd('0x1')]},'ratingType':{'type':Sequelize[_0xa0cd('0x2')](_0xa0cd('0x3'),_0xa0cd('0x4')),'defaultValue':_0xa0cd('0x3')},'ratingMessage':{'type':Sequelize[_0xa0cd('0x5')]},'pathTranscript':{'type':Sequelize[_0xa0cd('0x5')]},'mailTranscript':{'type':Sequelize[_0xa0cd('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xa0cd('0x6')]},'thirdDisposition':{'type':Sequelize[_0xa0cd('0x6')]},'note':{'type':Sequelize[_0xa0cd('0x6')]},'browserName':{'type':Sequelize[_0xa0cd('0x6')]},'browserVersion':{'type':Sequelize[_0xa0cd('0x6')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0xa0cd('0x6')]},'deviceModel':{'type':Sequelize[_0xa0cd('0x6')]},'deviceVendor':{'type':Sequelize[_0xa0cd('0x6')]},'deviceType':{'type':Sequelize[_0xa0cd('0x6')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xa0cd('0x5')]('long')},'read1stAt':{'type':Sequelize[_0xa0cd('0x7')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xa0cd('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xa0cd('0x6')]},'customerPort':{'type':Sequelize[_0xa0cd('0x6')]},'vidaooSessionId':{'type':Sequelize[_0xa0cd('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0xa0cd('0x0')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x762e=['DATE','long','ENUM','BOOLEAN','sequelize','exports','INTEGER','thumb','star','TEXT','STRING'];(function(_0x213518,_0x51e022){var _0x1baf75=function(_0x5c8444){while(--_0x5c8444){_0x213518['push'](_0x213518['shift']());}};_0x1baf75(++_0x51e022);}(_0x762e,0x12d));var _0xe762=function(_0x2bacdf,_0x17980a){_0x2bacdf=_0x2bacdf-0x0;var _0x1a4528=_0x762e[_0x2bacdf];return _0x1a4528;};'use strict';var Sequelize=require(_0xe762('0x0'));module[_0xe762('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xe762('0x2')]},'ratingType':{'type':Sequelize['ENUM']('star',_0xe762('0x3')),'defaultValue':_0xe762('0x4')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0xe762('0x5')]},'mailTranscript':{'type':Sequelize[_0xe762('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xe762('0x7')]},'disposition':{'type':Sequelize[_0xe762('0x6')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xe762('0x6')]},'note':{'type':Sequelize[_0xe762('0x6')]},'browserName':{'type':Sequelize[_0xe762('0x6')]},'browserVersion':{'type':Sequelize[_0xe762('0x6')]},'osName':{'type':Sequelize[_0xe762('0x6')]},'osVersion':{'type':Sequelize[_0xe762('0x6')]},'deviceModel':{'type':Sequelize[_0xe762('0x6')]},'deviceVendor':{'type':Sequelize[_0xe762('0x6')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0xe762('0x5')]},'customerIp':{'type':Sequelize[_0xe762('0x6')]},'formData':{'type':Sequelize[_0xe762('0x5')](_0xe762('0x8'))},'read1stAt':{'type':Sequelize[_0xe762('0x7')]},'lastMsgAt':{'type':Sequelize[_0xe762('0x7')]},'lastMsgDirection':{'type':Sequelize[_0xe762('0x9')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xe762('0x6')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0xe762('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0xe762('0xa')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xe762('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 4abe795..a7d90d1 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 _0x2551=['[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailServerOut','CloudProvider','Smtp','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','hasOwnProperty','order','sort','where','pick','filter','$gte','split','rows','getMyMessages','ChatInteractionId','includeAgent','push','includeAll','setTags','spread','findAll','color','removeTags','unix','toString','files','tmp','server','attachments','lastName','createdAt','Account','Owner','get','mkdirSync','N.A.','YYYY-MM-DD\x20HH:mm:ss','browserName','osName','referer','customerIp','customerPort','existsSync','createReadStream','pipe','createWriteStream','firstName','out','read','value','views','downloadInteraction.ejs','transcript-','Chat','createPdfFromHTML','unlinkSync','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','end','undefined','limit','count','offset','status','set','update','destroy','stack','name','send','render','body','agent','interaction','account','index','map','ChatInteraction','rawAttributes','fieldName','type','getOptions','user','catch','show','params','model','keys','query','filters','attributes','intersection','fields','length','include','merge','options','find','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooEscalation','vidaooNote','vidaooApiKey','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooTopic','isNull','follow','vidaooMetadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','AbandonInteraction','attachmentUpload','file','basename','filename','Attachment','json','Unauthorized','attachId','ChatOfflineMessageId','join','download','close','mailTranscript','root','server/files/chat/upload/','format','transcript-%s.txt','now','Messages','User','ContactId','%s%d','agentAlias','System','customer','agent_alias','alias','agent_fullname'];(function(_0x41d81a,_0x32ffc9){var _0x372a1b=function(_0x5e48ac){while(--_0x5e48ac){_0x41d81a['push'](_0x41d81a['shift']());}};_0x372a1b(++_0x32ffc9);}(_0x2551,0x1cf));var _0x1255=function(_0xb6e2ea,_0x3b26e9){_0xb6e2ea=_0xb6e2ea-0x0;var _0x2a57bb=_0x2551[_0xb6e2ea];return _0x2a57bb;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1255('0x0'));var Mustache=require('mustache');var util=require(_0x1255('0x1'));var path=require(_0x1255('0x2'));var ejs=require(_0x1255('0x3'));var fs=require('fs');var _=require(_0x1255('0x4'));var Redis=require(_0x1255('0x5'));var interaction=require(_0x1255('0x6'));var qs=require(_0x1255('0x7'));var pdf=require(_0x1255('0x8'));var logger=require(_0x1255('0x9'))(_0x1255('0xa'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0x1255('0xb')](config[_0x1255('0xc')],{'host':_0x1255('0xd'),'port':0x18eb});var socket=require(_0x1255('0xe'))(new Redis(config['redis']));require(_0x1255('0xf'))[_0x1255('0x10')](socket);var jayson=require(_0x1255('0x11'));var client=jayson[_0x1255('0x12')]['http']({'port':0x232b});var client9004=jayson['client'][_0x1255('0x13')]({'port':0x232c});function respondWithRpcPromise(_0x1dd508,_0x31cac0,_0xcfa655,_0x24b91c){return new BPromise(function(_0x50aba4,_0x3e941a){var _0x39446b=_0x24b91c||client;return _0x39446b[_0x1255('0x14')](_0x1dd508,_0xcfa655)[_0x1255('0x15')](function(_0x561705){logger[_0x1255('0x16')](_0x1255('0x17'),_0x31cac0,_0x1255('0x18'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x31cac0,_0x1255('0x18'),JSON[_0x1255('0x19')](_0x561705));if(_0x561705[_0x1255('0x1a')]){if(_0x561705[_0x1255('0x1a')][_0x1255('0x1b')]===0x1f4){logger[_0x1255('0x1a')]('ChatInteraction,\x20%s,\x20%s',_0x31cac0,_0x561705[_0x1255('0x1a')][_0x1255('0x1c')]);return _0x3e941a(_0x561705['error'][_0x1255('0x1c')]);}logger[_0x1255('0x1a')]('ChatInteraction,\x20%s,\x20%s',_0x31cac0,_0x561705[_0x1255('0x1a')][_0x1255('0x1c')]);return _0x50aba4(_0x561705[_0x1255('0x1a')][_0x1255('0x1c')]);}else{logger[_0x1255('0x16')](_0x1255('0x17'),_0x31cac0,'request\x20sent');_0x50aba4(_0x561705[_0x1255('0x1d')]['message']);}})['catch'](function(_0x5913c3){logger[_0x1255('0x1a')](_0x1255('0x17'),_0x31cac0,_0x5913c3);_0x3e941a(_0x5913c3);});});}function respondWithStatusCode(_0x31035a,_0x5e9424){_0x5e9424=_0x5e9424||0xcc;return function(_0x579a00){if(_0x579a00){return _0x31035a[_0x1255('0x1e')](_0x5e9424);}return _0x31035a['status'](_0x5e9424)[_0x1255('0x1f')]();};}function respondWithResult(_0x3df4c5,_0x15e814){_0x15e814=_0x15e814||0xc8;return function(_0x4ddb35){if(_0x4ddb35){return _0x3df4c5['status'](_0x15e814)['json'](_0x4ddb35);}};}function respondWithFilteredResult(_0x120e5a,_0x4c1492){return function(_0x49ca97){if(_0x49ca97){var _0x1250a2=typeof _0x4c1492['offset']===_0x1255('0x20')&&typeof _0x4c1492[_0x1255('0x21')]===_0x1255('0x20');var _0x444d42=_0x49ca97[_0x1255('0x22')];var _0x2a6b79=_0x1250a2?0x0:_0x4c1492[_0x1255('0x23')];var _0xe581b=_0x1250a2?_0x49ca97[_0x1255('0x22')]:_0x4c1492[_0x1255('0x23')]+_0x4c1492[_0x1255('0x21')];var _0x10a913;if(_0xe581b>=_0x444d42){_0xe581b=_0x444d42;_0x10a913=0xc8;}else{_0x10a913=0xce;}_0x120e5a[_0x1255('0x24')](_0x10a913);return _0x120e5a[_0x1255('0x25')]('Content-Range',_0x2a6b79+'-'+_0xe581b+'/'+_0x444d42)['json'](_0x49ca97);}return null;};}function saveUpdates(_0x1c39ef){return function(_0x570546){if(_0x570546){return _0x570546[_0x1255('0x26')](_0x1c39ef)['then'](function(_0x45b75b){return _0x45b75b;});}return null;};}function removeEntity(_0x1e7d50){return function(_0x5b88cc){if(_0x5b88cc){return _0x5b88cc[_0x1255('0x27')]()[_0x1255('0x15')](function(){_0x1e7d50[_0x1255('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25dfdf){return function(_0x5e285a){if(!_0x5e285a){_0x25dfdf[_0x1255('0x1e')](0x194);}return _0x5e285a;};}function handleError(_0x5b084e,_0x2bf3c4){_0x2bf3c4=_0x2bf3c4||0x1f4;return function(_0x544a36){logger[_0x1255('0x1a')](_0x544a36[_0x1255('0x28')]);if(_0x544a36[_0x1255('0x29')]){delete _0x544a36[_0x1255('0x29')];}_0x5b084e[_0x1255('0x24')](_0x2bf3c4)[_0x1255('0x2a')](_0x544a36);};}function getMustacheRender(_0x387853,_0x590a54){return Mustache[_0x1255('0x2b')](_0x387853,_['merge'](_0x590a54[_0x1255('0x2c')],{'contact':_0x590a54['contact'],'message':_0x590a54[_0x1255('0x1c')],'agent':_0x590a54[_0x1255('0x2d')],'interaction':_0x590a54[_0x1255('0x2e')],'account':_0x590a54[_0x1255('0x2f')]}))||'';}exports[_0x1255('0x30')]=function(_0x3a1c32,_0x5c15c1){var _0x117812={};var _0x2fc10e=_[_0x1255('0x31')](db[_0x1255('0x32')][_0x1255('0x33')],function(_0x139e59){return{'name':_0x139e59[_0x1255('0x34')],'type':_0x139e59[_0x1255('0x35')]['key']};});_0x117812=qs[_0x1255('0x36')](_0x2fc10e,_0x3a1c32);return interaction['findAll']('chat',_0x3a1c32['query'],_0x3a1c32[_0x1255('0x37')],_0x117812,_0x2fc10e)[_0x1255('0x15')](respondWithFilteredResult(_0x5c15c1,_0x117812))[_0x1255('0x38')](handleError(_0x5c15c1,null));};exports[_0x1255('0x39')]=function(_0x3d446c,_0x433c2a){var _0x37120c={'raw':![],'where':{'id':_0x3d446c[_0x1255('0x3a')]['id']}},_0x5f3533={};_0x5f3533[_0x1255('0x3b')]=_[_0x1255('0x3c')](db[_0x1255('0x32')]['rawAttributes']);_0x5f3533[_0x1255('0x3d')]=_[_0x1255('0x3c')](_0x3d446c['query']);_0x5f3533[_0x1255('0x3e')]=_['intersection'](_0x5f3533[_0x1255('0x3b')],_0x5f3533['query']);_0x37120c[_0x1255('0x3f')]=_[_0x1255('0x40')](_0x5f3533[_0x1255('0x3b')],qs[_0x1255('0x41')](_0x3d446c['query'][_0x1255('0x41')]));_0x37120c[_0x1255('0x3f')]=_0x37120c[_0x1255('0x3f')][_0x1255('0x42')]?_0x37120c[_0x1255('0x3f')]:_0x5f3533[_0x1255('0x3b')];if(_0x3d446c['query']['includeAll']){_0x37120c[_0x1255('0x43')]=[{'all':!![]}];}_0x37120c=_[_0x1255('0x44')]({},_0x37120c,_0x3d446c[_0x1255('0x45')]);return db[_0x1255('0x32')][_0x1255('0x46')](_0x37120c)[_0x1255('0x15')](handleEntityNotFound(_0x433c2a,null))['then'](respondWithResult(_0x433c2a,null))[_0x1255('0x38')](handleError(_0x433c2a,null));};exports[_0x1255('0x47')]=function(_0x4c2abb,_0x56190d){return db[_0x1255('0x32')]['create'](_0x4c2abb[_0x1255('0x2c')],{})[_0x1255('0x15')](respondWithResult(_0x56190d,0xc9))['catch'](handleError(_0x56190d,null));};exports[_0x1255('0x26')]=function(_0x422738,_0x458c69){if(_0x422738[_0x1255('0x2c')]['id']){delete _0x422738[_0x1255('0x2c')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x422738[_0x1255('0x3a')]['id']}})[_0x1255('0x15')](handleEntityNotFound(_0x458c69,null))[_0x1255('0x15')](saveUpdates(_0x422738[_0x1255('0x2c')],null))[_0x1255('0x15')](respondWithResult(_0x458c69,null))[_0x1255('0x38')](handleError(_0x458c69,null));};exports[_0x1255('0x27')]=function(_0x507946,_0x526fc6){return db['ChatInteraction']['find']({'where':{'id':_0x507946[_0x1255('0x3a')]['id']}})[_0x1255('0x15')](handleEntityNotFound(_0x526fc6,null))['then'](removeEntity(_0x526fc6,null))[_0x1255('0x38')](handleError(_0x526fc6,null));};exports[_0x1255('0x48')]=function(_0x38ae0d,_0x1231d4){return db[_0x1255('0x32')][_0x1255('0x48')]()['then'](respondWithResult(_0x1231d4,null))['catch'](handleError(_0x1231d4,null));};exports[_0x1255('0x49')]=function(_0x5a3634,_0x271a56){var _0x4fb77c=_0x5a3634[_0x1255('0x3a')]['id'];var _0x5290f2;var _0x1a522e;var _0x32129c;return db['ChatInteraction'][_0x1255('0x4a')]({'where':{'id':_0x4fb77c}})[_0x1255('0x15')](function(_0x153d67){_0x5290f2=_0x153d67;return db[_0x1255('0x4b')]['findOne']({'where':{'id':_0x153d67['ChatWebsiteId']},'attributes':['id','vidaooApiKey',_0x1255('0x4c'),'vidaooTopic',_0x1255('0x4d'),'vidaooMetadata'],'raw':!![]});})[_0x1255('0x15')](function(_0x40ca17){if(_0x40ca17&&_0x40ca17[_0x1255('0x4e')]&&_0x40ca17[_0x1255('0x4c')]){_0x1a522e=_0x40ca17;var _0x3ae66e={'interaction':{'id':_0x4fb77c},'agent':{'id':_0x5a3634['user']['id'],'name':_0x5a3634['user'][_0x1255('0x29')],'fullname':_0x5a3634[_0x1255('0x37')][_0x1255('0x4f')],'email':_0x5a3634[_0x1255('0x37')][_0x1255('0x50')]},'contact':_0x5a3634['body']['contact'],'account':_0x5a3634[_0x1255('0x2c')][_0x1255('0x2f')]};var _0x4f357c={'rejectUnauthorized':![],'method':_0x1255('0x51'),'url':_0x1255('0x52'),'headers':{'X-APIKEY':_0x40ca17[_0x1255('0x4e')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x5a3634[_0x1255('0x37')][_0x1255('0x50')]],'buttons':null,'topic':_0x1a522e[_0x1255('0x53')],'note':_[_0x1255('0x54')](_0x1a522e[_0x1255('0x4d')])?null:getMustacheRender(_0x1a522e[_0x1255('0x4d')],_0x3ae66e),'metadata':null},'redirect':_0x1255('0x55'),'json':!![]};try{if(!_[_0x1255('0x54')](_0x1a522e['vidaooMetadata'])){var _0x276031=getMustacheRender(_0x1a522e[_0x1255('0x56')],_0x3ae66e);var _0x1e9493=JSON['parse'](_0x276031);_0x4f357c['body']['metadata']=_0x1e9493;}}catch(_0x27eb43){throw new db[(_0x1255('0x57'))][(_0x1255('0x58'))](_0x1255('0x59'));}return rp(_0x4f357c);}else{throw new db[(_0x1255('0x57'))][(_0x1255('0x58'))](_0x1255('0x5a'));}})[_0x1255('0x15')](function(_0x11af88){_0x32129c=_0x11af88;if(_0x32129c['id']){var _0x36719a={'body':_0x32129c['join_url'],'ChatWebsiteId':_0x1a522e['id'],'ChatInteractionId':_0x5290f2['id'],'direction':'out','UserId':_0x5a3634[_0x1255('0x37')]['id']};return db[_0x1255('0x5b')][_0x1255('0x47')](_0x36719a,{});}else{throw new db['Sequelize'][(_0x1255('0x58'))](_0x1255('0x5c'));}})[_0x1255('0x15')](function(){return _0x5290f2[_0x1255('0x5d')]({'vidaooSessionId':_0x32129c['id']});})[_0x1255('0x15')](respondWithResult(_0x271a56,null))[_0x1255('0x38')](handleError(_0x271a56,null));};exports['customUpdate']=function(_0x14677f,_0x55e0ba){if(_0x14677f[_0x1255('0x2c')]['id']){delete _0x14677f['body']['id'];}return db[_0x1255('0x32')][_0x1255('0x46')]({'where':{'id':_0x14677f[_0x1255('0x3a')]['id']},'include':[{'model':db[_0x1255('0x5e')],'as':_0x1255('0x5f')}]})[_0x1255('0x15')](handleEntityNotFound(_0x55e0ba,null))[_0x1255('0x15')](saveUpdates(_0x14677f['body'],null))[_0x1255('0x15')](respondWithResult(_0x55e0ba,null))[_0x1255('0x38')](handleError(_0x55e0ba,null));};exports[_0x1255('0x60')]=function(_0x4c577b,_0x13338e){if(_0x4c577b[_0x1255('0x2c')]['id']){delete _0x4c577b[_0x1255('0x2c')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x4c577b[_0x1255('0x3a')]['id']}})['then'](function(_0x5ecf6){if(!_0x5ecf6){logger[_0x1255('0x1a')](_0x1255('0x61'),_0x1255('0x60'),0x194,_0x1255('0x62'));_0x13338e[_0x1255('0x1e')](0x194);}else{if(_0x5ecf6[_0x1255('0x63')]){throw new db[(_0x1255('0x57'))]['ValidationError'](_0x1255('0x64'));}}return _0x5ecf6;})[_0x1255('0x15')](function(_0x4635ea){if(_0x4635ea){return _0x4635ea[_0x1255('0x26')]({'closed':_0x4c577b['body'][_0x1255('0x65')],'disposition':_0x4c577b[_0x1255('0x2c')]['disposition']})[_0x1255('0x15')](function(_0x26568f){return _0x26568f;});}})['then'](function(){return respondWithRpcPromise(_0x1255('0x66'),_0x1255('0x60'),_0x4c577b[_0x1255('0x2c')],client9004);})[_0x1255('0x15')](respondWithResult(_0x13338e,null))[_0x1255('0x38')](handleError(_0x13338e,null));};exports[_0x1255('0x67')]=function(_0x15b1d1,_0x23836e){_0x15b1d1[_0x1255('0x2c')][_0x1255('0x29')]=_0x15b1d1[_0x1255('0x68')]['originalname'];_0x15b1d1[_0x1255('0x2c')][_0x1255('0x69')]=_0x15b1d1['file'][_0x1255('0x6a')];_0x15b1d1[_0x1255('0x2c')][_0x1255('0x35')]=_0x15b1d1[_0x1255('0x68')]['mimetype'];return db[_0x1255('0x6b')]['create'](_0x15b1d1[_0x1255('0x2c')])[_0x1255('0x15')](respondWithResult(_0x23836e,0xc9))[_0x1255('0x38')](handleError(_0x23836e,null));};exports['attachmentDownload']=function(_0x584f42,_0x571303){return db['ChatInteraction'][_0x1255('0x4a')]({'where':{'id':_0x584f42[_0x1255('0x3a')]['id']},'raw':!![]})[_0x1255('0x15')](handleEntityNotFound(_0x571303,null))[_0x1255('0x15')](function(_0xd180bc){if(_0xd180bc){if(_0xd180bc[_0x1255('0x65')]){return _0x571303['status'](0x193)[_0x1255('0x6c')]({'status':0x193,'message':_0x1255('0x6d')});}return db[_0x1255('0x6b')][_0x1255('0x4a')]({'where':{'id':_0x584f42[_0x1255('0x3d')][_0x1255('0x6e')]},'raw':!![]})[_0x1255('0x15')](handleEntityNotFound(_0x571303,null));}})[_0x1255('0x15')](function(_0x35f93c){if(_0x35f93c){var _0x5bfcf3=_0x35f93c[_0x1255('0x6f')]!==null;var _0x36ce6e=path[_0x1255('0x70')](config['root'],'server/files/attachments/');if(_0x5bfcf3){_0x36ce6e=path['join'](_0x36ce6e,'offline-chat/');}var _0x51a085=path[_0x1255('0x70')](_0x36ce6e,_0x35f93c[_0x1255('0x69')]);return _0x571303[_0x1255('0x71')](_0x51a085);}})[_0x1255('0x38')](handleError(_0x571303,null));};exports[_0x1255('0x72')]=function(_0x228217,_0x38ba5b){var _0x24a15b=null;var _0x620edf=null;var _0x12758f=null;if(_0x228217[_0x1255('0x2c')]['id']){delete _0x228217[_0x1255('0x2c')]['id'];}if(_0x228217[_0x1255('0x2c')][_0x1255('0x73')]){_0x12758f=path['join'](config[_0x1255('0x74')],_0x1255('0x75'),util[_0x1255('0x76')](_0x1255('0x77'),Date[_0x1255('0x78')]()));_0x228217['body']['pathTranscript']=_0x12758f;}return db[_0x1255('0x32')][_0x1255('0x46')]({'where':{'id':_0x228217[_0x1255('0x3a')]['id']},'include':[{'model':db['ChatMessage'],'as':_0x1255('0x79'),'include':[{'model':db[_0x1255('0x7a')],'as':_0x1255('0x7a')}]}]})[_0x1255('0x15')](handleEntityNotFound(_0x38ba5b,null))[_0x1255('0x15')](saveUpdates(_0x228217[_0x1255('0x2c')],null))[_0x1255('0x15')](function(_0x2c3f82){if(_0x2c3f82){_0x24a15b=_0x2c3f82;return db['ChatWebsite'][_0x1255('0x46')]({'where':{'id':_0x24a15b['ChatWebsiteId']}});}})['then'](function(_0x2fde9c){if(_0x2fde9c){_0x620edf=_0x2fde9c;return db[_0x1255('0x5e')][_0x1255('0x46')]({'where':{'id':_0x24a15b[_0x1255('0x7b')]}});}})[_0x1255('0x15')](function(_0x274ede){if(_0x274ede){if(_0x12758f){var _0x151cdc=null;for(var _0x4c77e1=0x1;_0x4c77e1<_0x24a15b[_0x1255('0x79')][_0x1255('0x42')];++_0x4c77e1){_0x151cdc=_0x24a15b[_0x1255('0x79')][_0x4c77e1];var _0x4b307a=_0x151cdc[_0x1255('0x63')]?util[_0x1255('0x76')](_0x1255('0x7c'),_0x620edf[_0x1255('0x7d')],_0x151cdc[_0x1255('0x63')]):_0x1255('0x7e');var _0x359a5c=_0x228217[_0x1255('0x2c')][_0x1255('0x7f')]||util[_0x1255('0x76')](_0x1255('0x7c'),'Visitor',_0x151cdc[_0x1255('0x7b')]);switch(_0x620edf['agentIdentifier']){case'website_alias':_0x4b307a=_0x151cdc[_0x1255('0x63')]?util['format'](_0x1255('0x7c'),_0x620edf[_0x1255('0x7d')],_0x151cdc['UserId']):_0x1255('0x7e');break;case _0x1255('0x80'):_0x4b307a=_0x151cdc[_0x1255('0x63')]?_0x151cdc[_0x1255('0x7a')][_0x1255('0x81')]||_0x151cdc[_0x1255('0x7a')]['fullname']:'System';break;case _0x1255('0x82'):_0x4b307a=_0x151cdc[_0x1255('0x63')]?_0x151cdc[_0x1255('0x7a')]['fullname']:'System';break;default:_0x4b307a=_0x151cdc[_0x1255('0x63')]?util[_0x1255('0x76')]('%s%d',_0x620edf[_0x1255('0x7d')],_0x151cdc[_0x1255('0x63')]):_0x1255('0x7e');}var _0x416b30=util['format'](_0x1255('0x83'),moment(_0x151cdc['createdAt'])['format'](_0x1255('0x84')),_0x151cdc[_0x1255('0x85')]==='in'?_0x359a5c:_0x4b307a,_0x151cdc['body']);if(!_0x151cdc[_0x1255('0x86')]){fs[_0x1255('0x87')](_0x12758f,_0x416b30);}}return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x1255('0x88')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x1255('0x89')],'as':_0x1255('0x89'),'raw':!![]}]}]});}}})[_0x1255('0x15')](function(_0x2e2bdb){if(!_0x2e2bdb||!_0x2e2bdb[_0x1255('0x8a')]||!_0x228217[_0x1255('0x2c')])return _0x24a15b;var _0x2c0ef7=_0x2e2bdb[_0x1255('0x8b')]();return respondWithRpcPromise('SendMail',_0x1255('0x8c'),{'account':_0x2c0ef7,'message':{'from':util[_0x1255('0x76')](_0x1255('0x8d'),_0x2e2bdb[_0x1255('0x29')],_0x2e2bdb[_0x1255('0x50')]||_0x2e2bdb[_0x1255('0x8a')][_0x1255('0x37')]),'to':_0x228217[_0x1255('0x2c')][_0x1255('0x73')],'subject':'Mail\x20Transcript','text':util[_0x1255('0x76')](_0x1255('0x8e'),_0x228217[_0x1255('0x2c')]['mailTranscript']),'attachments':[{'path':_0x12758f}]}})['then'](function(){return _0x24a15b;})['catch'](function(_0xc3a703){logger[_0x1255('0x1a')](_0xc3a703);});})[_0x1255('0x15')](respondWithStatusCode(_0x38ba5b,0xc8))[_0x1255('0x38')](handleError(_0x38ba5b,null));};exports[_0x1255('0x8f')]=function(_0x5444bf,_0x13b3c7){return db[_0x1255('0x5b')][_0x1255('0x46')]({'where':{'id':_0x5444bf[_0x1255('0x3a')]['id']}})[_0x1255('0x15')](handleEntityNotFound(_0x13b3c7,null))[_0x1255('0x15')](function(_0x1ba477){if(_0x1ba477){return _0x1ba477[_0x1255('0x8f')](_0x5444bf[_0x1255('0x2c')][_0x1255('0x90')],_[_0x1255('0x91')](_0x5444bf[_0x1255('0x2c')],[_0x1255('0x90'),'id'])||{});}})[_0x1255('0x15')](respondWithResult(_0x13b3c7,null))['catch'](handleError(_0x13b3c7,null));};exports['getMessages']=function(_0x37f4ed,_0x303dc8){var _0x41bc02={'raw':![],'where':{}};var _0x44ab33={};var _0x304cfc={'count':0x0,'rows':[]};return db[_0x1255('0x32')][_0x1255('0x4a')]({'where':{'id':_0x37f4ed[_0x1255('0x3a')]['id']}})[_0x1255('0x15')](handleEntityNotFound(_0x303dc8,null))[_0x1255('0x15')](function(_0x3848a2){if(_0x3848a2){_0x44ab33['model']=_[_0x1255('0x3c')](db[_0x1255('0x5b')][_0x1255('0x33')]);_0x44ab33[_0x1255('0x3d')]=_[_0x1255('0x3c')](_0x37f4ed[_0x1255('0x3d')]);_0x44ab33[_0x1255('0x3e')]=_['intersection'](_0x44ab33['model'],_0x44ab33[_0x1255('0x3d')]);_0x41bc02[_0x1255('0x3f')]=_[_0x1255('0x40')](_0x44ab33[_0x1255('0x3b')],qs[_0x1255('0x41')](_0x37f4ed[_0x1255('0x3d')][_0x1255('0x41')]));_0x41bc02['attributes']=_0x41bc02['attributes'][_0x1255('0x42')]?_0x41bc02['attributes']:_0x44ab33[_0x1255('0x3b')];if(!_0x37f4ed['query'][_0x1255('0x92')]('nolimit')){_0x41bc02[_0x1255('0x21')]=qs[_0x1255('0x21')](_0x37f4ed[_0x1255('0x3d')][_0x1255('0x21')]);_0x41bc02[_0x1255('0x23')]=qs['offset'](_0x37f4ed[_0x1255('0x3d')][_0x1255('0x23')]);}_0x41bc02[_0x1255('0x93')]=qs[_0x1255('0x94')](_0x37f4ed[_0x1255('0x3d')][_0x1255('0x94')]);_0x41bc02[_0x1255('0x95')]=qs[_0x1255('0x3e')](_[_0x1255('0x96')](_0x37f4ed[_0x1255('0x3d')],_0x44ab33[_0x1255('0x3e')]));_0x41bc02[_0x1255('0x95')]['ChatInteractionId']=_0x3848a2['id'];if(_0x37f4ed['query'][_0x1255('0x97')]){_0x41bc02[_0x1255('0x95')]=_['merge'](_0x41bc02['where'],{'$or':_[_0x1255('0x31')](_0x41bc02[_0x1255('0x3f')],function(_0x471583){var _0x237ec={};_0x237ec[_0x471583]={'$like':'%'+_0x37f4ed[_0x1255('0x3d')][_0x1255('0x97')]+'%'};return _0x237ec;})});}if(_0x37f4ed[_0x1255('0x3d')][_0x1255('0x98')]){var _0x34e396=_0x37f4ed[_0x1255('0x3d')]['$gte'][_0x1255('0x99')](',');var _0x1ddb54={};_0x1ddb54[_0x34e396[0x0]]={'$gte':moment(_0x34e396[0x1])[_0x1255('0x76')]('YYYY-MM-DD\x20HH:mm:ss')};_0x41bc02[_0x1255('0x95')]=_[_0x1255('0x44')](_0x41bc02[_0x1255('0x95')],_0x1ddb54);}_0x41bc02=_[_0x1255('0x44')]({},_0x41bc02,_0x37f4ed['options']);return db[_0x1255('0x5b')][_0x1255('0x22')]({'where':_0x41bc02['where']})['then'](function(_0x1608cb){_0x304cfc[_0x1255('0x22')]=_0x1608cb;if(_0x37f4ed[_0x1255('0x3d')]['includeAll']){_0x41bc02[_0x1255('0x43')]=[{'all':!![]}];}return db[_0x1255('0x5b')]['findAll'](_0x41bc02);})[_0x1255('0x15')](function(_0x233ee8){_0x304cfc[_0x1255('0x9a')]=_0x233ee8;return _0x304cfc;});}})[_0x1255('0x15')](respondWithFilteredResult(_0x303dc8,_0x41bc02))['catch'](handleError(_0x303dc8,null));};exports[_0x1255('0x9b')]=function(_0x5ba803,_0x219b7c){var _0x1fa1ac={'where':{}},_0x28bad4={},_0x114d3c={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0x5ba803['params']['id']}})['then'](handleEntityNotFound(_0x219b7c,null))[_0x1255('0x15')](function(_0x3371a5){if(_0x3371a5){_0x28bad4[_0x1255('0x3b')]=_['keys'](db['ChatMessage']['rawAttributes']);_0x28bad4[_0x1255('0x3d')]=_[_0x1255('0x3c')](_0x5ba803['query']);_0x28bad4['filters']=_[_0x1255('0x40')](_0x28bad4[_0x1255('0x3b')],_0x28bad4[_0x1255('0x3d')]);_0x1fa1ac[_0x1255('0x3f')]=_[_0x1255('0x40')](_0x28bad4['model'],qs[_0x1255('0x41')](_0x5ba803[_0x1255('0x3d')][_0x1255('0x41')]));_0x1fa1ac[_0x1255('0x3f')]=_0x1fa1ac[_0x1255('0x3f')][_0x1255('0x42')]?_0x1fa1ac[_0x1255('0x3f')]:_0x28bad4[_0x1255('0x3b')];if(!_0x5ba803[_0x1255('0x3d')][_0x1255('0x92')]('nolimit')){_0x1fa1ac[_0x1255('0x21')]=qs['limit'](_0x5ba803[_0x1255('0x3d')][_0x1255('0x21')]);_0x1fa1ac[_0x1255('0x23')]=qs[_0x1255('0x23')](_0x5ba803['query'][_0x1255('0x23')]);}_0x1fa1ac['order']=qs[_0x1255('0x94')](_0x5ba803['query'][_0x1255('0x94')]);_0x1fa1ac[_0x1255('0x95')]=qs[_0x1255('0x3e')](_['pick'](_0x5ba803[_0x1255('0x3d')],_0x28bad4['filters']));_0x1fa1ac[_0x1255('0x95')][_0x1255('0x9c')]=_0x3371a5['id'];if(_0x5ba803['query'][_0x1255('0x97')]){_0x1fa1ac[_0x1255('0x95')]=_[_0x1255('0x44')](_0x1fa1ac[_0x1255('0x95')],{'$or':_[_0x1255('0x31')](_0x1fa1ac[_0x1255('0x3f')],function(_0x33d824){var _0x3a3e52={};_0x3a3e52[_0x33d824]={'$like':'%'+_0x5ba803[_0x1255('0x3d')]['filter']+'%'};return _0x3a3e52;})});}_0x1fa1ac[_0x1255('0x95')]['secret']=![];if(_0x5ba803[_0x1255('0x3d')]['id']){_0x1fa1ac[_0x1255('0x95')]['id']={'$gt':_0x5ba803['query']['id']};}_0x1fa1ac=_[_0x1255('0x44')]({},_0x1fa1ac,_0x5ba803[_0x1255('0x45')]);return db[_0x1255('0x5b')][_0x1255('0x22')]({'where':_0x1fa1ac[_0x1255('0x95')]})[_0x1255('0x15')](function(_0x3ae698){_0x114d3c[_0x1255('0x22')]=_0x3ae698;_0x1fa1ac['include']=[];if(_0x5ba803[_0x1255('0x3d')][_0x1255('0x9d')]){_0x1fa1ac[_0x1255('0x43')][_0x1255('0x9e')]({'model':db[_0x1255('0x7a')],'as':_0x1255('0x7a'),'attributes':['id',_0x1255('0x4f'),'alias']});}if(_0x5ba803[_0x1255('0x3d')][_0x1255('0x9f')]){_0x1fa1ac['include']=[{'all':!![]}];}return db[_0x1255('0x5b')]['findAll'](_0x1fa1ac);})[_0x1255('0x15')](function(_0x45598b){_0x114d3c[_0x1255('0x9a')]=_0x45598b;return _0x114d3c;});}})[_0x1255('0x15')](respondWithFilteredResult(_0x219b7c,_0x1fa1ac))[_0x1255('0x38')](handleError(_0x219b7c,null));};exports['addTags']=function(_0x4217c3,_0x4acb8e){return db[_0x1255('0x32')][_0x1255('0x46')]({'where':{'id':_0x4217c3[_0x1255('0x3a')]['id']}})[_0x1255('0x15')](handleEntityNotFound(_0x4acb8e,null))['then'](function(_0x5eaa1c){if(_0x5eaa1c){return _0x5eaa1c[_0x1255('0xa0')](_0x4217c3['body']['ids'],_[_0x1255('0x91')](_0x4217c3[_0x1255('0x2c')],[_0x1255('0x90'),'id'])||{})[_0x1255('0xa1')](function(){return db['Tag'][_0x1255('0xa2')]({'attributes':['id','name',_0x1255('0xa3')],'where':{'id':_0x4217c3[_0x1255('0x2c')][_0x1255('0x90')]}});})[_0x1255('0x15')](function(_0x243c5a){socket['emit']('chatInteractionTags:save',{'id':Number(_0x4217c3[_0x1255('0x3a')]['id']),'tags':_0x243c5a||[]});return{'id':Number(_0x4217c3[_0x1255('0x3a')]['id']),'tags':_0x243c5a||[]};});}})['then'](respondWithResult(_0x4acb8e,null))[_0x1255('0x38')](handleError(_0x4acb8e,null));};exports[_0x1255('0xa4')]=function(_0x314f07,_0x4d2025){return db[_0x1255('0x32')][_0x1255('0x46')]({'where':{'id':_0x314f07[_0x1255('0x3a')]['id']}})[_0x1255('0x15')](handleEntityNotFound(_0x4d2025,null))['then'](function(_0xf0a17a){if(_0xf0a17a){return _0xf0a17a['removeTags'](_0x314f07['query'][_0x1255('0x90')]);}})[_0x1255('0x15')](respondWithStatusCode(_0x4d2025,null))[_0x1255('0x38')](handleError(_0x4d2025,null));};exports[_0x1255('0x71')]=function(_0x34ac97,_0x537b5d){var _0x77f4dd=moment()[_0x1255('0xa5')]()[_0x1255('0xa6')]();var _0x734e76=path['join'](config[_0x1255('0x74')],'server',_0x1255('0xa7'),_0x1255('0xa8'));var _0x1a79f4=path[_0x1255('0x70')](config['root'],_0x1255('0xa9'),_0x1255('0xa7'),_0x1255('0xaa'));var _0x392850=path['join'](_0x734e76,_0x77f4dd);var _0x1d9616=util['format']('transcript-%d-%s.zip',_0x34ac97[_0x1255('0x3a')]['id'],_0x77f4dd);var _0x2630cf=path[_0x1255('0x70')](_0x734e76,_0x1d9616);var _0x43a759=[];_0x43a759[_0x1255('0x9e')]({'model':db[_0x1255('0x7a')],'as':_0x1255('0x7a'),'attributes':['id',_0x1255('0x4f')],'raw':!![]});_0x43a759[_0x1255('0x9e')]({'model':db['CmContact'],'as':_0x1255('0x5f'),'attributes':['id','firstName',_0x1255('0xab')],'raw':!![]});if(_0x34ac97['query']['attachments']){_0x43a759[_0x1255('0x9e')]({'model':db[_0x1255('0x6b')],'as':_0x1255('0x6b'),'raw':!![]});}var _0x26276d=[{'model':db['ChatMessage'],'as':_0x1255('0x79'),'attributes':['id',_0x1255('0x2c'),_0x1255('0xac'),'direction',_0x1255('0x86'),'read'],'include':_0x43a759}];_0x26276d['push']({'model':db[_0x1255('0x4b')],'as':_0x1255('0xad'),'attributes':['id',_0x1255('0x29')]});_0x26276d[_0x1255('0x9e')]({'model':db[_0x1255('0x7a')],'as':_0x1255('0xae'),'attributes':['id',_0x1255('0x4f')]});return db[_0x1255('0x32')][_0x1255('0x46')]({'where':{'id':_0x34ac97['params']['id']},'include':_0x26276d})['then'](handleEntityNotFound(_0x537b5d,null))[_0x1255('0x15')](function(_0xc2a8b5){if(_0xc2a8b5){var _0x4647cb=_0xc2a8b5[_0x1255('0xaf')]({'plain':!![]});fs[_0x1255('0xb0')](_0x392850);var _0x55fa2c={'channel':'Chat','account':_0x4647cb[_0x1255('0xad')]['name'],'agent':_0x4647cb[_0x1255('0xae')]?_0x4647cb[_0x1255('0xae')][_0x1255('0x4f')]:_0x1255('0xb1'),'createdAt':moment(_0x4647cb[_0x1255('0xac')])[_0x1255('0x76')](_0x1255('0xb2'))[_0x1255('0xa6')](),'closedAt':_0x4647cb[_0x1255('0x65')]?moment(_0x4647cb['closedAt'])[_0x1255('0x76')](_0x1255('0xb2'))[_0x1255('0xa6')]():'','disposition':_0x4647cb['disposition'],'chatInfo':{'browser':_0x4647cb[_0x1255('0xb3')],'os':_0x4647cb[_0x1255('0xb4')],'referer':_0x4647cb[_0x1255('0xb5')],'customerIp':_0x4647cb[_0x1255('0xb6')],'customerPort':_0x4647cb[_0x1255('0xb7')]?_0x4647cb[_0x1255('0xb7')]:_0x1255('0xb1')},'messages':_(_0x4647cb['Messages'])['tail']()[_0x1255('0x97')]({'secret':![]})['map'](function(_0x10a07e){if(_0x10a07e['Attachment']){var _0xe5f414=path['join'](_0x1a79f4,_0x10a07e['Attachment'][_0x1255('0x69')]);if(fs[_0x1255('0xb8')](_0xe5f414)){fs[_0x1255('0xb9')](_0xe5f414)[_0x1255('0xba')](fs[_0x1255('0xbb')](path[_0x1255('0x70')](_0x392850,_0x10a07e[_0x1255('0x6b')][_0x1255('0x69')])));}}return{'date':moment(_0x10a07e[_0x1255('0xac')])[_0x1255('0x76')](_0x1255('0xb2'))[_0x1255('0xa6')](),'sender':_0x10a07e['direction']==='out'?_0x10a07e[_0x1255('0x7a')]?_0x10a07e[_0x1255('0x7a')]['fullname']:_0x1255('0x7e'):_0x10a07e[_0x1255('0x5f')][_0x1255('0xbc')]+(_0x10a07e['Contact'][_0x1255('0xab')]?'\x20'+_0x10a07e['Contact']['lastName']:''),'body':_0x10a07e[_0x1255('0x6b')]?_0x10a07e[_0x1255('0x6b')][_0x1255('0x69')]:_0x10a07e['body'],'direction':_0x10a07e[_0x1255('0x85')]===_0x1255('0xbd')?'A':'C','secret':_0x10a07e[_0x1255('0x86')],'read':_0x10a07e[_0x1255('0xbe')],'attachment':_0x10a07e[_0x1255('0x6b')]};})[_0x1255('0xbf')]()};return ejs['renderFile'](path['join'](config['root'],_0x1255('0xa9'),_0x1255('0xc0'),_0x1255('0xc1')),{'interaction':_0x55fa2c})[_0x1255('0x15')](function(_0x475e95){var _0xe2c3e2=path[_0x1255('0x70')](_0x392850,_0x1255('0xc2')+_0x4647cb['id']+'-'+_0x77f4dd+'.pdf');var _0x45aec0={'path':_0xe2c3e2,'channel':_0x1255('0xc3'),'interactionId':_0x4647cb['id']};return pdf[_0x1255('0xc4')](_0x475e95,_0x45aec0);})['then'](function(){return new Promise(function(_0x54ab79,_0x48819f){zipdir(_0x392850,{'saveTo':_0x2630cf},function(_0x22da6c,_0x2cc0f2){if(_0x22da6c)return _0x48819f(_0x22da6c);return _0x54ab79(_0x2cc0f2);});})[_0x1255('0x15')](function(){return new BPromise(function(_0x55e664,_0x5c002f){rimraf(_0x392850,function(_0x5bdf88){if(_0x5bdf88)_0x5c002f(_0x5bdf88);return _0x55e664();});});})[_0x1255('0x15')](function(){return _0x537b5d[_0x1255('0x71')](_0x2630cf,_0x1d9616,function(_0x636629){if(_0x636629){logger[_0x1255('0x1a')]('err',_0x636629);}else{fs[_0x1255('0xc5')](_0x2630cf);}});});});}else{return _0x537b5d['sendStatus'](0xc8);}})[_0x1255('0x38')](handleError(_0x537b5d,null));}; \ No newline at end of file +var _0x29db=['http','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','count','set','destroy','stack','name','send','render','merge','body','contact','agent','interaction','account','index','map','rawAttributes','fieldName','type','key','findAll','chat','query','user','model','keys','ChatInteraction','filters','intersection','attributes','fields','length','includeAll','include','options','create','update','find','params','describe','createVidaooSession','ChatWebsite','findOne','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','vidaooMetadata','parse','metadata','Sequelize','ValidationError','join_url','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandon','entity\x20not\x20found','UserId','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','mimetype','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','root','offline-chat/','download','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','User','ChatWebsiteId','ContactId','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailServerOut','CloudProvider','Smtp','SendMail','sendMail','\x22%s\x22\x20<%s>','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','ChatMessage','addMessage','ids','nolimit','limit','sort','where','pick','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','hasOwnProperty','push','alias','addTags','spread','Tag','color','chatInteractionTags:save','removeTags','toString','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','Attachment','read','Account','Owner','mkdirSync','Chat','N.A.','closedAt','osName','referer','customerIp','customerPort','tail','createReadStream','pipe','createWriteStream','value','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','err','rimraf','zip-dir','request-promise','moment','mustache','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x29db,0x190));var _0xb29d=function(_0x4abab2,_0x522a66){_0x4abab2=_0x4abab2-0x0;var _0x3ab266=_0x29db[_0x4abab2];return _0x3ab266;};'use strict';var rimraf=require(_0xb29d('0x0'));var zipdir=require(_0xb29d('0x1'));var rp=require(_0xb29d('0x2'));var moment=require(_0xb29d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb29d('0x4'));var util=require('util');var path=require(_0xb29d('0x5'));var ejs=require(_0xb29d('0x6'));var fs=require('fs');var _=require(_0xb29d('0x7'));var Redis=require(_0xb29d('0x8'));var interaction=require(_0xb29d('0x9'));var qs=require(_0xb29d('0xa'));var pdf=require(_0xb29d('0xb'));var logger=require(_0xb29d('0xc'))(_0xb29d('0xd'));var config=require(_0xb29d('0xe'));var db=require(_0xb29d('0xf'))['db'];config['redis']=_['defaults'](config[_0xb29d('0x10')],{'host':_0xb29d('0x11'),'port':0x18eb});var socket=require(_0xb29d('0x12'))(new Redis(config[_0xb29d('0x10')]));require('./chatInteraction.socket')[_0xb29d('0x13')](socket);var jayson=require(_0xb29d('0x14'));var client=jayson[_0xb29d('0x15')][_0xb29d('0x16')]({'port':0x232b});var client9004=jayson[_0xb29d('0x15')]['http']({'port':0x232c});function respondWithRpcPromise(_0x18e447,_0x34a875,_0x276498,_0x1dd6b4){return new BPromise(function(_0x4657c0,_0xce0459){var _0x467a16=_0x1dd6b4||client;return _0x467a16[_0xb29d('0x17')](_0x18e447,_0x276498)[_0xb29d('0x18')](function(_0x94d293){logger[_0xb29d('0x19')]('ChatInteraction,\x20%s,\x20%s',_0x34a875,_0xb29d('0x1a'));logger[_0xb29d('0x1b')](_0xb29d('0x1c'),_0x34a875,'request\x20sent',JSON[_0xb29d('0x1d')](_0x94d293));if(_0x94d293[_0xb29d('0x1e')]){if(_0x94d293[_0xb29d('0x1e')][_0xb29d('0x1f')]===0x1f4){logger[_0xb29d('0x1e')](_0xb29d('0x20'),_0x34a875,_0x94d293[_0xb29d('0x1e')][_0xb29d('0x21')]);return _0xce0459(_0x94d293['error'][_0xb29d('0x21')]);}logger[_0xb29d('0x1e')](_0xb29d('0x20'),_0x34a875,_0x94d293[_0xb29d('0x1e')][_0xb29d('0x21')]);return _0x4657c0(_0x94d293['error'][_0xb29d('0x21')]);}else{logger['info'](_0xb29d('0x20'),_0x34a875,_0xb29d('0x1a'));_0x4657c0(_0x94d293[_0xb29d('0x22')][_0xb29d('0x21')]);}})[_0xb29d('0x23')](function(_0x3d772b){logger[_0xb29d('0x1e')]('ChatInteraction,\x20%s,\x20%s',_0x34a875,_0x3d772b);_0xce0459(_0x3d772b);});});}function respondWithStatusCode(_0x5e2a57,_0x59805d){_0x59805d=_0x59805d||0xcc;return function(_0x59b84a){if(_0x59b84a){return _0x5e2a57[_0xb29d('0x24')](_0x59805d);}return _0x5e2a57[_0xb29d('0x25')](_0x59805d)[_0xb29d('0x26')]();};}function respondWithResult(_0x3c026b,_0x4f78aa){_0x4f78aa=_0x4f78aa||0xc8;return function(_0x5119d3){if(_0x5119d3){return _0x3c026b[_0xb29d('0x25')](_0x4f78aa)[_0xb29d('0x27')](_0x5119d3);}};}function respondWithFilteredResult(_0x4b3f0b,_0x25a990){return function(_0x69c749){if(_0x69c749){var _0x4805a2=typeof _0x25a990[_0xb29d('0x28')]==='undefined'&&typeof _0x25a990['limit']===_0xb29d('0x29');var _0xf5fd67=_0x69c749[_0xb29d('0x2a')];var _0x2e73da=_0x4805a2?0x0:_0x25a990[_0xb29d('0x28')];var _0x29b734=_0x4805a2?_0x69c749[_0xb29d('0x2a')]:_0x25a990[_0xb29d('0x28')]+_0x25a990['limit'];var _0x56f733;if(_0x29b734>=_0xf5fd67){_0x29b734=_0xf5fd67;_0x56f733=0xc8;}else{_0x56f733=0xce;}_0x4b3f0b['status'](_0x56f733);return _0x4b3f0b[_0xb29d('0x2b')]('Content-Range',_0x2e73da+'-'+_0x29b734+'/'+_0xf5fd67)[_0xb29d('0x27')](_0x69c749);}return null;};}function saveUpdates(_0xb2335a){return function(_0xd70abb){if(_0xd70abb){return _0xd70abb['update'](_0xb2335a)[_0xb29d('0x18')](function(_0x3a9695){return _0x3a9695;});}return null;};}function removeEntity(_0x551c06){return function(_0x388bdc){if(_0x388bdc){return _0x388bdc[_0xb29d('0x2c')]()['then'](function(){_0x551c06['status'](0xcc)[_0xb29d('0x26')]();});}};}function handleEntityNotFound(_0x213316){return function(_0x1bc488){if(!_0x1bc488){_0x213316[_0xb29d('0x24')](0x194);}return _0x1bc488;};}function handleError(_0x379feb,_0x496bbf){_0x496bbf=_0x496bbf||0x1f4;return function(_0x1d82a1){logger['error'](_0x1d82a1[_0xb29d('0x2d')]);if(_0x1d82a1['name']){delete _0x1d82a1[_0xb29d('0x2e')];}_0x379feb[_0xb29d('0x25')](_0x496bbf)[_0xb29d('0x2f')](_0x1d82a1);};}function getMustacheRender(_0x397b6c,_0x204c77){return Mustache[_0xb29d('0x30')](_0x397b6c,_[_0xb29d('0x31')](_0x204c77[_0xb29d('0x32')],{'contact':_0x204c77[_0xb29d('0x33')],'message':_0x204c77[_0xb29d('0x21')],'agent':_0x204c77[_0xb29d('0x34')],'interaction':_0x204c77[_0xb29d('0x35')],'account':_0x204c77[_0xb29d('0x36')]}))||'';}exports[_0xb29d('0x37')]=function(_0x5de137,_0x15725e){var _0x55f6d3={};var _0x2408f4=_[_0xb29d('0x38')](db['ChatInteraction'][_0xb29d('0x39')],function(_0x3eab6b){return{'name':_0x3eab6b[_0xb29d('0x3a')],'type':_0x3eab6b[_0xb29d('0x3b')][_0xb29d('0x3c')]};});_0x55f6d3=qs['getOptions'](_0x2408f4,_0x5de137);return interaction[_0xb29d('0x3d')](_0xb29d('0x3e'),_0x5de137[_0xb29d('0x3f')],_0x5de137[_0xb29d('0x40')],_0x55f6d3,_0x2408f4)[_0xb29d('0x18')](respondWithFilteredResult(_0x15725e,_0x55f6d3))[_0xb29d('0x23')](handleError(_0x15725e,null));};exports['show']=function(_0x587383,_0x2e025c){var _0x1a02aa={'raw':![],'where':{'id':_0x587383['params']['id']}},_0x1c9013={};_0x1c9013[_0xb29d('0x41')]=_[_0xb29d('0x42')](db[_0xb29d('0x43')][_0xb29d('0x39')]);_0x1c9013[_0xb29d('0x3f')]=_[_0xb29d('0x42')](_0x587383[_0xb29d('0x3f')]);_0x1c9013[_0xb29d('0x44')]=_[_0xb29d('0x45')](_0x1c9013[_0xb29d('0x41')],_0x1c9013[_0xb29d('0x3f')]);_0x1a02aa[_0xb29d('0x46')]=_['intersection'](_0x1c9013[_0xb29d('0x41')],qs[_0xb29d('0x47')](_0x587383[_0xb29d('0x3f')][_0xb29d('0x47')]));_0x1a02aa[_0xb29d('0x46')]=_0x1a02aa['attributes'][_0xb29d('0x48')]?_0x1a02aa['attributes']:_0x1c9013[_0xb29d('0x41')];if(_0x587383[_0xb29d('0x3f')][_0xb29d('0x49')]){_0x1a02aa[_0xb29d('0x4a')]=[{'all':!![]}];}_0x1a02aa=_['merge']({},_0x1a02aa,_0x587383[_0xb29d('0x4b')]);return db[_0xb29d('0x43')]['find'](_0x1a02aa)['then'](handleEntityNotFound(_0x2e025c,null))['then'](respondWithResult(_0x2e025c,null))[_0xb29d('0x23')](handleError(_0x2e025c,null));};exports[_0xb29d('0x4c')]=function(_0x424006,_0x52aeee){return db[_0xb29d('0x43')][_0xb29d('0x4c')](_0x424006['body'],{})[_0xb29d('0x18')](respondWithResult(_0x52aeee,0xc9))['catch'](handleError(_0x52aeee,null));};exports[_0xb29d('0x4d')]=function(_0x482996,_0x4e402c){if(_0x482996[_0xb29d('0x32')]['id']){delete _0x482996['body']['id'];}return db['ChatInteraction'][_0xb29d('0x4e')]({'where':{'id':_0x482996[_0xb29d('0x4f')]['id']}})[_0xb29d('0x18')](handleEntityNotFound(_0x4e402c,null))[_0xb29d('0x18')](saveUpdates(_0x482996[_0xb29d('0x32')],null))[_0xb29d('0x18')](respondWithResult(_0x4e402c,null))[_0xb29d('0x23')](handleError(_0x4e402c,null));};exports[_0xb29d('0x2c')]=function(_0x51a8d1,_0x5ae9b0){return db[_0xb29d('0x43')][_0xb29d('0x4e')]({'where':{'id':_0x51a8d1['params']['id']}})[_0xb29d('0x18')](handleEntityNotFound(_0x5ae9b0,null))[_0xb29d('0x18')](removeEntity(_0x5ae9b0,null))['catch'](handleError(_0x5ae9b0,null));};exports['describe']=function(_0xc826ba,_0x3f5dfb){return db[_0xb29d('0x43')][_0xb29d('0x50')]()['then'](respondWithResult(_0x3f5dfb,null))[_0xb29d('0x23')](handleError(_0x3f5dfb,null));};exports[_0xb29d('0x51')]=function(_0x223f16,_0x1426d1){var _0x4ce159=_0x223f16[_0xb29d('0x4f')]['id'];var _0xa29987;var _0x9930ee;var _0xaca143;return db[_0xb29d('0x43')]['findOne']({'where':{'id':_0x4ce159}})[_0xb29d('0x18')](function(_0x49bd96){_0xa29987=_0x49bd96;return db[_0xb29d('0x52')][_0xb29d('0x53')]({'where':{'id':_0x49bd96['ChatWebsiteId']},'attributes':['id',_0xb29d('0x54'),_0xb29d('0x55'),_0xb29d('0x56'),_0xb29d('0x57'),'vidaooMetadata'],'raw':!![]});})[_0xb29d('0x18')](function(_0x1cd72){if(_0x1cd72&&_0x1cd72[_0xb29d('0x54')]&&_0x1cd72[_0xb29d('0x55')]){_0x9930ee=_0x1cd72;var _0x328a73={'interaction':{'id':_0x4ce159},'agent':{'id':_0x223f16['user']['id'],'name':_0x223f16[_0xb29d('0x40')][_0xb29d('0x2e')],'fullname':_0x223f16[_0xb29d('0x40')][_0xb29d('0x58')],'email':_0x223f16[_0xb29d('0x40')][_0xb29d('0x59')]},'contact':_0x223f16[_0xb29d('0x32')][_0xb29d('0x33')],'account':_0x223f16['body'][_0xb29d('0x36')]};var _0x1b8945={'rejectUnauthorized':![],'method':_0xb29d('0x5a'),'url':_0xb29d('0x5b'),'headers':{'X-APIKEY':_0x1cd72[_0xb29d('0x54')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x223f16['user'][_0xb29d('0x59')]],'buttons':null,'topic':_0x9930ee[_0xb29d('0x56')],'note':_[_0xb29d('0x5c')](_0x9930ee[_0xb29d('0x57')])?null:getMustacheRender(_0x9930ee[_0xb29d('0x57')],_0x328a73),'metadata':null},'redirect':_0xb29d('0x5d'),'json':!![]};try{if(!_[_0xb29d('0x5c')](_0x9930ee[_0xb29d('0x5e')])){var _0x4a7c30=getMustacheRender(_0x9930ee['vidaooMetadata'],_0x328a73);var _0xe1f775=JSON[_0xb29d('0x5f')](_0x4a7c30);_0x1b8945[_0xb29d('0x32')][_0xb29d('0x60')]=_0xe1f775;}}catch(_0x3e1912){throw new db[(_0xb29d('0x61'))][(_0xb29d('0x62'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x1b8945);}else{throw new db[(_0xb29d('0x61'))][(_0xb29d('0x62'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0xb29d('0x18')](function(_0x347057){_0xaca143=_0x347057;if(_0xaca143['id']){var _0xc0343={'body':_0xaca143[_0xb29d('0x63')],'ChatWebsiteId':_0x9930ee['id'],'ChatInteractionId':_0xa29987['id'],'direction':_0xb29d('0x64'),'UserId':_0x223f16[_0xb29d('0x40')]['id']};return db['ChatMessage'][_0xb29d('0x4c')](_0xc0343,{});}else{throw new db[(_0xb29d('0x61'))][(_0xb29d('0x62'))](_0xb29d('0x65'));}})[_0xb29d('0x18')](function(){return _0xa29987[_0xb29d('0x66')]({'vidaooSessionId':_0xaca143['id']});})[_0xb29d('0x18')](respondWithResult(_0x1426d1,null))['catch'](handleError(_0x1426d1,null));};exports[_0xb29d('0x67')]=function(_0x356564,_0x1a0c6f){if(_0x356564[_0xb29d('0x32')]['id']){delete _0x356564[_0xb29d('0x32')]['id'];}return db[_0xb29d('0x43')][_0xb29d('0x4e')]({'where':{'id':_0x356564[_0xb29d('0x4f')]['id']},'include':[{'model':db[_0xb29d('0x68')],'as':_0xb29d('0x69')}]})[_0xb29d('0x18')](handleEntityNotFound(_0x1a0c6f,null))[_0xb29d('0x18')](saveUpdates(_0x356564[_0xb29d('0x32')],null))[_0xb29d('0x18')](respondWithResult(_0x1a0c6f,null))[_0xb29d('0x23')](handleError(_0x1a0c6f,null));};exports[_0xb29d('0x6a')]=function(_0x5d42cf,_0x1932ed){if(_0x5d42cf[_0xb29d('0x32')]['id']){delete _0x5d42cf['body']['id'];}return db[_0xb29d('0x43')][_0xb29d('0x4e')]({'where':{'id':_0x5d42cf[_0xb29d('0x4f')]['id']}})[_0xb29d('0x18')](function(_0x53738e){if(!_0x53738e){logger['error']('abandonInteraction,\x20%s,\x20%s,\x20%s',_0xb29d('0x6a'),0x194,_0xb29d('0x6b'));_0x1932ed['sendStatus'](0x194);}else{if(_0x53738e[_0xb29d('0x6c')]){throw new db[(_0xb29d('0x61'))][(_0xb29d('0x62'))]('Interaction\x20already\x20assigned');}}return _0x53738e;})[_0xb29d('0x18')](function(_0x1e0993){if(_0x1e0993){return _0x1e0993['update']({'closed':_0x5d42cf[_0xb29d('0x32')][_0xb29d('0x6d')],'disposition':_0x5d42cf['body'][_0xb29d('0x6e')]})[_0xb29d('0x18')](function(_0x17424b){return _0x17424b;});}})[_0xb29d('0x18')](function(){return respondWithRpcPromise(_0xb29d('0x6f'),_0xb29d('0x6a'),_0x5d42cf['body'],client9004);})[_0xb29d('0x18')](respondWithResult(_0x1932ed,null))[_0xb29d('0x23')](handleError(_0x1932ed,null));};exports[_0xb29d('0x70')]=function(_0x3198ec,_0x42e43f){_0x3198ec['body'][_0xb29d('0x2e')]=_0x3198ec[_0xb29d('0x71')][_0xb29d('0x72')];_0x3198ec[_0xb29d('0x32')][_0xb29d('0x73')]=_0x3198ec['file']['filename'];_0x3198ec['body'][_0xb29d('0x3b')]=_0x3198ec[_0xb29d('0x71')][_0xb29d('0x74')];return db['Attachment'][_0xb29d('0x4c')](_0x3198ec[_0xb29d('0x32')])[_0xb29d('0x18')](respondWithResult(_0x42e43f,0xc9))[_0xb29d('0x23')](handleError(_0x42e43f,null));};exports[_0xb29d('0x75')]=function(_0x41302f,_0x508678){return db[_0xb29d('0x43')][_0xb29d('0x53')]({'where':{'id':_0x41302f[_0xb29d('0x4f')]['id']},'raw':!![]})[_0xb29d('0x18')](handleEntityNotFound(_0x508678,null))[_0xb29d('0x18')](function(_0x18ba9f){if(_0x18ba9f){if(_0x18ba9f[_0xb29d('0x6d')]){return _0x508678[_0xb29d('0x25')](0x193)[_0xb29d('0x27')]({'status':0x193,'message':_0xb29d('0x76')});}return db['Attachment'][_0xb29d('0x53')]({'where':{'id':_0x41302f[_0xb29d('0x3f')][_0xb29d('0x77')]},'raw':!![]})['then'](handleEntityNotFound(_0x508678,null));}})['then'](function(_0x160dc9){if(_0x160dc9){var _0x44bb2e=_0x160dc9[_0xb29d('0x78')]!==null;var _0x32c553=path[_0xb29d('0x79')](config[_0xb29d('0x7a')],'server/files/attachments/');if(_0x44bb2e){_0x32c553=path[_0xb29d('0x79')](_0x32c553,_0xb29d('0x7b'));}var _0xf5b0a3=path[_0xb29d('0x79')](_0x32c553,_0x160dc9[_0xb29d('0x73')]);return _0x508678[_0xb29d('0x7c')](_0xf5b0a3);}})['catch'](handleError(_0x508678,null));};exports['close']=function(_0xb848b1,_0x1136cb){var _0x32c37c=null;var _0x53aae5=null;var _0x5aa673=null;if(_0xb848b1[_0xb29d('0x32')]['id']){delete _0xb848b1[_0xb29d('0x32')]['id'];}if(_0xb848b1[_0xb29d('0x32')]['mailTranscript']){_0x5aa673=path['join'](config[_0xb29d('0x7a')],_0xb29d('0x7d'),util[_0xb29d('0x7e')](_0xb29d('0x7f'),Date[_0xb29d('0x80')]()));_0xb848b1['body'][_0xb29d('0x81')]=_0x5aa673;}return db[_0xb29d('0x43')][_0xb29d('0x4e')]({'where':{'id':_0xb848b1[_0xb29d('0x4f')]['id']},'include':[{'model':db['ChatMessage'],'as':_0xb29d('0x82'),'include':[{'model':db[_0xb29d('0x83')],'as':_0xb29d('0x83')}]}]})['then'](handleEntityNotFound(_0x1136cb,null))['then'](saveUpdates(_0xb848b1[_0xb29d('0x32')],null))[_0xb29d('0x18')](function(_0x18ea67){if(_0x18ea67){_0x32c37c=_0x18ea67;return db[_0xb29d('0x52')]['find']({'where':{'id':_0x32c37c[_0xb29d('0x84')]}});}})[_0xb29d('0x18')](function(_0x499019){if(_0x499019){_0x53aae5=_0x499019;return db[_0xb29d('0x68')][_0xb29d('0x4e')]({'where':{'id':_0x32c37c[_0xb29d('0x85')]}});}})['then'](function(_0x21546d){if(_0x21546d){if(_0x5aa673){var _0x15288b=null;for(var _0x1fef78=0x1;_0x1fef78<_0x32c37c[_0xb29d('0x82')][_0xb29d('0x48')];++_0x1fef78){_0x15288b=_0x32c37c[_0xb29d('0x82')][_0x1fef78];var _0x131b7e=_0x15288b[_0xb29d('0x6c')]?util['format'](_0xb29d('0x86'),_0x53aae5[_0xb29d('0x87')],_0x15288b[_0xb29d('0x6c')]):_0xb29d('0x88');var _0x1c684e=_0xb848b1['body'][_0xb29d('0x89')]||util['format'](_0xb29d('0x86'),_0xb29d('0x8a'),_0x15288b[_0xb29d('0x85')]);switch(_0x53aae5[_0xb29d('0x8b')]){case _0xb29d('0x8c'):_0x131b7e=_0x15288b['UserId']?util['format']('%s%d',_0x53aae5[_0xb29d('0x87')],_0x15288b[_0xb29d('0x6c')]):_0xb29d('0x88');break;case'agent_alias':_0x131b7e=_0x15288b[_0xb29d('0x6c')]?_0x15288b['User']['alias']||_0x15288b['User']['fullname']:_0xb29d('0x88');break;case _0xb29d('0x8d'):_0x131b7e=_0x15288b['UserId']?_0x15288b[_0xb29d('0x83')][_0xb29d('0x58')]:'System';break;default:_0x131b7e=_0x15288b[_0xb29d('0x6c')]?util[_0xb29d('0x7e')](_0xb29d('0x86'),_0x53aae5[_0xb29d('0x87')],_0x15288b['UserId']):_0xb29d('0x88');}var _0xc60739=util[_0xb29d('0x7e')](_0xb29d('0x8e'),moment(_0x15288b[_0xb29d('0x8f')])[_0xb29d('0x7e')](_0xb29d('0x90')),_0x15288b[_0xb29d('0x91')]==='in'?_0x1c684e:_0x131b7e,_0x15288b[_0xb29d('0x32')]);if(!_0x15288b[_0xb29d('0x92')]){fs[_0xb29d('0x93')](_0x5aa673,_0xc60739);}}return db['MailAccount'][_0xb29d('0x53')]({'where':{'service':!![]},'include':[{'model':db[_0xb29d('0x94')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xb29d('0x95')],'as':_0xb29d('0x95'),'raw':!![]}]}]});}}})['then'](function(_0x3a1973){if(!_0x3a1973||!_0x3a1973[_0xb29d('0x96')]||!_0xb848b1[_0xb29d('0x32')])return _0x32c37c;var _0x2493f2=_0x3a1973['getSmtpOptions']();return respondWithRpcPromise(_0xb29d('0x97'),_0xb29d('0x98'),{'account':_0x2493f2,'message':{'from':util[_0xb29d('0x7e')](_0xb29d('0x99'),_0x3a1973[_0xb29d('0x2e')],_0x3a1973[_0xb29d('0x59')]||_0x3a1973['Smtp'][_0xb29d('0x40')]),'to':_0xb848b1['body'][_0xb29d('0x9a')],'subject':_0xb29d('0x9b'),'text':util[_0xb29d('0x7e')](_0xb29d('0x9c'),_0xb848b1[_0xb29d('0x32')][_0xb29d('0x9a')]),'attachments':[{'path':_0x5aa673}]}})[_0xb29d('0x18')](function(){return _0x32c37c;})[_0xb29d('0x23')](function(_0x152cb6){logger[_0xb29d('0x1e')](_0x152cb6);});})['then'](respondWithStatusCode(_0x1136cb,0xc8))[_0xb29d('0x23')](handleError(_0x1136cb,null));};exports['addMessage']=function(_0x554e4e,_0x9ebf2b){return db[_0xb29d('0x9d')]['find']({'where':{'id':_0x554e4e[_0xb29d('0x4f')]['id']}})[_0xb29d('0x18')](handleEntityNotFound(_0x9ebf2b,null))[_0xb29d('0x18')](function(_0x3ced00){if(_0x3ced00){return _0x3ced00[_0xb29d('0x9e')](_0x554e4e[_0xb29d('0x32')]['ids'],_['omit'](_0x554e4e['body'],[_0xb29d('0x9f'),'id'])||{});}})[_0xb29d('0x18')](respondWithResult(_0x9ebf2b,null))['catch'](handleError(_0x9ebf2b,null));};exports['getMessages']=function(_0x5ee72d,_0x3726fc){var _0x4a22f9={'raw':![],'where':{}};var _0x3327e6={};var _0x58dd31={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0x5ee72d[_0xb29d('0x4f')]['id']}})[_0xb29d('0x18')](handleEntityNotFound(_0x3726fc,null))[_0xb29d('0x18')](function(_0x27d705){if(_0x27d705){_0x3327e6[_0xb29d('0x41')]=_[_0xb29d('0x42')](db[_0xb29d('0x9d')][_0xb29d('0x39')]);_0x3327e6['query']=_[_0xb29d('0x42')](_0x5ee72d[_0xb29d('0x3f')]);_0x3327e6[_0xb29d('0x44')]=_[_0xb29d('0x45')](_0x3327e6[_0xb29d('0x41')],_0x3327e6['query']);_0x4a22f9['attributes']=_[_0xb29d('0x45')](_0x3327e6[_0xb29d('0x41')],qs[_0xb29d('0x47')](_0x5ee72d[_0xb29d('0x3f')][_0xb29d('0x47')]));_0x4a22f9[_0xb29d('0x46')]=_0x4a22f9['attributes'][_0xb29d('0x48')]?_0x4a22f9['attributes']:_0x3327e6['model'];if(!_0x5ee72d[_0xb29d('0x3f')]['hasOwnProperty'](_0xb29d('0xa0'))){_0x4a22f9[_0xb29d('0xa1')]=qs['limit'](_0x5ee72d[_0xb29d('0x3f')]['limit']);_0x4a22f9['offset']=qs[_0xb29d('0x28')](_0x5ee72d[_0xb29d('0x3f')]['offset']);}_0x4a22f9['order']=qs[_0xb29d('0xa2')](_0x5ee72d[_0xb29d('0x3f')][_0xb29d('0xa2')]);_0x4a22f9[_0xb29d('0xa3')]=qs[_0xb29d('0x44')](_[_0xb29d('0xa4')](_0x5ee72d[_0xb29d('0x3f')],_0x3327e6[_0xb29d('0x44')]));_0x4a22f9[_0xb29d('0xa3')][_0xb29d('0xa5')]=_0x27d705['id'];if(_0x5ee72d[_0xb29d('0x3f')][_0xb29d('0xa6')]){_0x4a22f9[_0xb29d('0xa3')]=_[_0xb29d('0x31')](_0x4a22f9[_0xb29d('0xa3')],{'$or':_[_0xb29d('0x38')](_0x4a22f9[_0xb29d('0x46')],function(_0xf4645f){var _0x4084e9={};_0x4084e9[_0xf4645f]={'$like':'%'+_0x5ee72d[_0xb29d('0x3f')]['filter']+'%'};return _0x4084e9;})});}if(_0x5ee72d['query']['$gte']){var _0x5801bb=_0x5ee72d[_0xb29d('0x3f')][_0xb29d('0xa7')][_0xb29d('0xa8')](',');var _0x2f5549={};_0x2f5549[_0x5801bb[0x0]]={'$gte':moment(_0x5801bb[0x1])['format'](_0xb29d('0xa9'))};_0x4a22f9[_0xb29d('0xa3')]=_[_0xb29d('0x31')](_0x4a22f9[_0xb29d('0xa3')],_0x2f5549);}_0x4a22f9=_[_0xb29d('0x31')]({},_0x4a22f9,_0x5ee72d[_0xb29d('0x4b')]);return db[_0xb29d('0x9d')][_0xb29d('0x2a')]({'where':_0x4a22f9[_0xb29d('0xa3')]})[_0xb29d('0x18')](function(_0x5d5f58){_0x58dd31[_0xb29d('0x2a')]=_0x5d5f58;if(_0x5ee72d[_0xb29d('0x3f')][_0xb29d('0x49')]){_0x4a22f9[_0xb29d('0x4a')]=[{'all':!![]}];}return db[_0xb29d('0x9d')][_0xb29d('0x3d')](_0x4a22f9);})['then'](function(_0x41d5d4){_0x58dd31[_0xb29d('0xaa')]=_0x41d5d4;return _0x58dd31;});}})[_0xb29d('0x18')](respondWithFilteredResult(_0x3726fc,_0x4a22f9))[_0xb29d('0x23')](handleError(_0x3726fc,null));};exports['getMyMessages']=function(_0x1aa232,_0x321852){var _0x5c4be1={'where':{}},_0x4aa1eb={},_0x34bd1a={'count':0x0,'rows':[]};return db[_0xb29d('0x43')][_0xb29d('0x53')]({'where':{'id':_0x1aa232[_0xb29d('0x4f')]['id']}})[_0xb29d('0x18')](handleEntityNotFound(_0x321852,null))[_0xb29d('0x18')](function(_0x5e29ab){if(_0x5e29ab){_0x4aa1eb[_0xb29d('0x41')]=_[_0xb29d('0x42')](db[_0xb29d('0x9d')][_0xb29d('0x39')]);_0x4aa1eb[_0xb29d('0x3f')]=_['keys'](_0x1aa232[_0xb29d('0x3f')]);_0x4aa1eb[_0xb29d('0x44')]=_['intersection'](_0x4aa1eb[_0xb29d('0x41')],_0x4aa1eb[_0xb29d('0x3f')]);_0x5c4be1[_0xb29d('0x46')]=_['intersection'](_0x4aa1eb[_0xb29d('0x41')],qs[_0xb29d('0x47')](_0x1aa232[_0xb29d('0x3f')][_0xb29d('0x47')]));_0x5c4be1[_0xb29d('0x46')]=_0x5c4be1[_0xb29d('0x46')][_0xb29d('0x48')]?_0x5c4be1['attributes']:_0x4aa1eb[_0xb29d('0x41')];if(!_0x1aa232[_0xb29d('0x3f')][_0xb29d('0xab')](_0xb29d('0xa0'))){_0x5c4be1[_0xb29d('0xa1')]=qs[_0xb29d('0xa1')](_0x1aa232[_0xb29d('0x3f')][_0xb29d('0xa1')]);_0x5c4be1[_0xb29d('0x28')]=qs[_0xb29d('0x28')](_0x1aa232[_0xb29d('0x3f')][_0xb29d('0x28')]);}_0x5c4be1['order']=qs[_0xb29d('0xa2')](_0x1aa232[_0xb29d('0x3f')]['sort']);_0x5c4be1[_0xb29d('0xa3')]=qs[_0xb29d('0x44')](_[_0xb29d('0xa4')](_0x1aa232[_0xb29d('0x3f')],_0x4aa1eb[_0xb29d('0x44')]));_0x5c4be1['where'][_0xb29d('0xa5')]=_0x5e29ab['id'];if(_0x1aa232[_0xb29d('0x3f')]['filter']){_0x5c4be1[_0xb29d('0xa3')]=_[_0xb29d('0x31')](_0x5c4be1[_0xb29d('0xa3')],{'$or':_['map'](_0x5c4be1[_0xb29d('0x46')],function(_0x6a6e97){var _0x38b3b7={};_0x38b3b7[_0x6a6e97]={'$like':'%'+_0x1aa232[_0xb29d('0x3f')][_0xb29d('0xa6')]+'%'};return _0x38b3b7;})});}_0x5c4be1[_0xb29d('0xa3')][_0xb29d('0x92')]=![];if(_0x1aa232[_0xb29d('0x3f')]['id']){_0x5c4be1[_0xb29d('0xa3')]['id']={'$gt':_0x1aa232[_0xb29d('0x3f')]['id']};}_0x5c4be1=_['merge']({},_0x5c4be1,_0x1aa232['options']);return db[_0xb29d('0x9d')][_0xb29d('0x2a')]({'where':_0x5c4be1[_0xb29d('0xa3')]})[_0xb29d('0x18')](function(_0xb2e242){_0x34bd1a[_0xb29d('0x2a')]=_0xb2e242;_0x5c4be1[_0xb29d('0x4a')]=[];if(_0x1aa232[_0xb29d('0x3f')]['includeAgent']){_0x5c4be1[_0xb29d('0x4a')][_0xb29d('0xac')]({'model':db['User'],'as':_0xb29d('0x83'),'attributes':['id',_0xb29d('0x58'),_0xb29d('0xad')]});}if(_0x1aa232[_0xb29d('0x3f')][_0xb29d('0x49')]){_0x5c4be1[_0xb29d('0x4a')]=[{'all':!![]}];}return db[_0xb29d('0x9d')][_0xb29d('0x3d')](_0x5c4be1);})['then'](function(_0x255f20){_0x34bd1a[_0xb29d('0xaa')]=_0x255f20;return _0x34bd1a;});}})[_0xb29d('0x18')](respondWithFilteredResult(_0x321852,_0x5c4be1))[_0xb29d('0x23')](handleError(_0x321852,null));};exports[_0xb29d('0xae')]=function(_0x27e344,_0x3fca74){return db[_0xb29d('0x43')][_0xb29d('0x4e')]({'where':{'id':_0x27e344['params']['id']}})[_0xb29d('0x18')](handleEntityNotFound(_0x3fca74,null))['then'](function(_0x411bd5){if(_0x411bd5){return _0x411bd5['setTags'](_0x27e344[_0xb29d('0x32')]['ids'],_['omit'](_0x27e344['body'],[_0xb29d('0x9f'),'id'])||{})[_0xb29d('0xaf')](function(){return db[_0xb29d('0xb0')][_0xb29d('0x3d')]({'attributes':['id',_0xb29d('0x2e'),_0xb29d('0xb1')],'where':{'id':_0x27e344[_0xb29d('0x32')][_0xb29d('0x9f')]}});})['then'](function(_0x150b24){socket['emit'](_0xb29d('0xb2'),{'id':Number(_0x27e344['params']['id']),'tags':_0x150b24||[]});return{'id':Number(_0x27e344[_0xb29d('0x4f')]['id']),'tags':_0x150b24||[]};});}})[_0xb29d('0x18')](respondWithResult(_0x3fca74,null))[_0xb29d('0x23')](handleError(_0x3fca74,null));};exports[_0xb29d('0xb3')]=function(_0x401a0d,_0x293b80){return db[_0xb29d('0x43')]['find']({'where':{'id':_0x401a0d[_0xb29d('0x4f')]['id']}})['then'](handleEntityNotFound(_0x293b80,null))[_0xb29d('0x18')](function(_0x337235){if(_0x337235){return _0x337235[_0xb29d('0xb3')](_0x401a0d[_0xb29d('0x3f')][_0xb29d('0x9f')]);}})[_0xb29d('0x18')](respondWithStatusCode(_0x293b80,null))[_0xb29d('0x23')](handleError(_0x293b80,null));};exports[_0xb29d('0x7c')]=function(_0x541ca5,_0x67775d){var _0x4f83b1=moment()['unix']()[_0xb29d('0xb4')]();var _0x3af67b=path[_0xb29d('0x79')](config[_0xb29d('0x7a')],_0xb29d('0xb5'),_0xb29d('0xb6'),_0xb29d('0xb7'));var _0x498de5=path[_0xb29d('0x79')](config[_0xb29d('0x7a')],'server',_0xb29d('0xb6'),_0xb29d('0xb8'));var _0x574612=path[_0xb29d('0x79')](_0x3af67b,_0x4f83b1);var _0xfc4589=util[_0xb29d('0x7e')](_0xb29d('0xb9'),_0x541ca5[_0xb29d('0x4f')]['id'],_0x4f83b1);var _0x270f51=path[_0xb29d('0x79')](_0x3af67b,_0xfc4589);var _0x1cd33f=[];_0x1cd33f[_0xb29d('0xac')]({'model':db[_0xb29d('0x83')],'as':_0xb29d('0x83'),'attributes':['id',_0xb29d('0x58')],'raw':!![]});_0x1cd33f[_0xb29d('0xac')]({'model':db[_0xb29d('0x68')],'as':'Contact','attributes':['id',_0xb29d('0xba'),_0xb29d('0xbb')],'raw':!![]});if(_0x541ca5[_0xb29d('0x3f')][_0xb29d('0xb8')]){_0x1cd33f[_0xb29d('0xac')]({'model':db[_0xb29d('0xbc')],'as':_0xb29d('0xbc'),'raw':!![]});}var _0x311809=[{'model':db[_0xb29d('0x9d')],'as':_0xb29d('0x82'),'attributes':['id',_0xb29d('0x32'),_0xb29d('0x8f'),_0xb29d('0x91'),'secret',_0xb29d('0xbd')],'include':_0x1cd33f}];_0x311809[_0xb29d('0xac')]({'model':db[_0xb29d('0x52')],'as':_0xb29d('0xbe'),'attributes':['id','name']});_0x311809['push']({'model':db[_0xb29d('0x83')],'as':_0xb29d('0xbf'),'attributes':['id','fullname']});return db[_0xb29d('0x43')][_0xb29d('0x4e')]({'where':{'id':_0x541ca5['params']['id']},'include':_0x311809})[_0xb29d('0x18')](handleEntityNotFound(_0x67775d,null))[_0xb29d('0x18')](function(_0x5576ec){if(_0x5576ec){var _0x3bb660=_0x5576ec['get']({'plain':!![]});fs[_0xb29d('0xc0')](_0x574612);var _0x4804eb={'channel':_0xb29d('0xc1'),'account':_0x3bb660[_0xb29d('0xbe')]['name'],'agent':_0x3bb660['Owner']?_0x3bb660['Owner']['fullname']:_0xb29d('0xc2'),'createdAt':moment(_0x3bb660['createdAt'])['format'](_0xb29d('0xa9'))[_0xb29d('0xb4')](),'closedAt':_0x3bb660[_0xb29d('0x6d')]?moment(_0x3bb660[_0xb29d('0xc3')])[_0xb29d('0x7e')](_0xb29d('0xa9'))[_0xb29d('0xb4')]():'','disposition':_0x3bb660[_0xb29d('0x6e')],'chatInfo':{'browser':_0x3bb660['browserName'],'os':_0x3bb660[_0xb29d('0xc4')],'referer':_0x3bb660[_0xb29d('0xc5')],'customerIp':_0x3bb660[_0xb29d('0xc6')],'customerPort':_0x3bb660[_0xb29d('0xc7')]?_0x3bb660[_0xb29d('0xc7')]:_0xb29d('0xc2')},'messages':_(_0x3bb660['Messages'])[_0xb29d('0xc8')]()['filter']({'secret':![]})[_0xb29d('0x38')](function(_0x5aadcd){if(_0x5aadcd[_0xb29d('0xbc')]){var _0x14c700=path[_0xb29d('0x79')](_0x498de5,_0x5aadcd[_0xb29d('0xbc')][_0xb29d('0x73')]);if(fs['existsSync'](_0x14c700)){fs[_0xb29d('0xc9')](_0x14c700)[_0xb29d('0xca')](fs[_0xb29d('0xcb')](path[_0xb29d('0x79')](_0x574612,_0x5aadcd[_0xb29d('0xbc')][_0xb29d('0x73')])));}}return{'date':moment(_0x5aadcd[_0xb29d('0x8f')])[_0xb29d('0x7e')](_0xb29d('0xa9'))[_0xb29d('0xb4')](),'sender':_0x5aadcd[_0xb29d('0x91')]===_0xb29d('0x64')?_0x5aadcd[_0xb29d('0x83')]?_0x5aadcd[_0xb29d('0x83')][_0xb29d('0x58')]:_0xb29d('0x88'):_0x5aadcd[_0xb29d('0x69')]['firstName']+(_0x5aadcd[_0xb29d('0x69')][_0xb29d('0xbb')]?'\x20'+_0x5aadcd[_0xb29d('0x69')]['lastName']:''),'body':_0x5aadcd[_0xb29d('0xbc')]?_0x5aadcd[_0xb29d('0xbc')][_0xb29d('0x73')]:_0x5aadcd[_0xb29d('0x32')],'direction':_0x5aadcd['direction']==='out'?'A':'C','secret':_0x5aadcd[_0xb29d('0x92')],'read':_0x5aadcd[_0xb29d('0xbd')],'attachment':_0x5aadcd[_0xb29d('0xbc')]};})[_0xb29d('0xcc')]()};return ejs[_0xb29d('0xcd')](path[_0xb29d('0x79')](config['root'],_0xb29d('0xb5'),_0xb29d('0xce'),_0xb29d('0xcf')),{'interaction':_0x4804eb})['then'](function(_0x537ec9){var _0x25f125=path[_0xb29d('0x79')](_0x574612,_0xb29d('0xd0')+_0x3bb660['id']+'-'+_0x4f83b1+'.pdf');var _0x51cab3={'path':_0x25f125,'channel':_0xb29d('0xc1'),'interactionId':_0x3bb660['id']};return pdf[_0xb29d('0xd1')](_0x537ec9,_0x51cab3);})[_0xb29d('0x18')](function(){return new Promise(function(_0x4b60d4,_0x31c5fe){zipdir(_0x574612,{'saveTo':_0x270f51},function(_0x3a398c,_0x10d476){if(_0x3a398c)return _0x31c5fe(_0x3a398c);return _0x4b60d4(_0x10d476);});})[_0xb29d('0x18')](function(){return new BPromise(function(_0x114d58,_0x3abc52){rimraf(_0x574612,function(_0x1cccc1){if(_0x1cccc1)_0x3abc52(_0x1cccc1);return _0x114d58();});});})[_0xb29d('0x18')](function(){return _0x67775d[_0xb29d('0x7c')](_0x270f51,_0xfc4589,function(_0x46490b){if(_0x46490b){logger[_0xb29d('0x1e')](_0xb29d('0xd2'),_0x46490b);}else{fs['unlinkSync'](_0x270f51);}});});});}else{return _0x67775d[_0xb29d('0x24')](0xc8);}})[_0xb29d('0x23')](handleError(_0x67775d,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 343578a..246b29c 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 _0x07ff=['catch','exports','events','../../mysqldb','ChatMessage','setMaxListeners','remove','then','Users','map','findAll','unreadMessages','length','emit'];(function(_0x4bd2da,_0x4e77b2){var _0xf9a1e7=function(_0x40094a){while(--_0x40094a){_0x4bd2da['push'](_0x4bd2da['shift']());}};_0xf9a1e7(++_0x4e77b2);}(_0x07ff,0x16e));var _0xf07f=function(_0x2ceca0,_0x28f3f7){_0x2ceca0=_0x2ceca0-0x0;var _0x431c54=_0x07ff[_0x2ceca0];return _0x431c54;};'use strict';var EventEmitter=require(_0xf07f('0x0'));var ChatInteraction=require(_0xf07f('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0xf07f('0x1'))['db'][_0xf07f('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xf07f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xf07f('0x4')};function emitEvent(_0x175b3a){return function(_0x14e1f4,_0x52984b,_0x354091){_0x14e1f4['getUsers']({'attributes':['id'],'raw':!![]})[_0xf07f('0x5')](function(_0x3ada1e){_0x14e1f4['setDataValue'](_0xf07f('0x6'),_0x3ada1e[_0xf07f('0x7')](function(_0x58c765){return{'id':_0x58c765['id']};}));return ChatMessage[_0xf07f('0x8')]({'where':{'ChatInteractionId':_0x14e1f4['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf07f('0x5')](function(_0x14b28b){_0x14e1f4['setDataValue'](_0xf07f('0x9'),_0x14b28b[_0xf07f('0xa')]);ChatInteractionEvents[_0xf07f('0xb')](_0x175b3a+':'+_0x14e1f4['id'],_0x14e1f4);ChatInteractionEvents['emit'](_0x175b3a,_0x14e1f4);_0x354091(null);})[_0xf07f('0xc')](_0x354091(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0xf07f('0xd')]=ChatInteractionEvents; \ No newline at end of file +var _0xa24d=['remove','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','setMaxListeners','save','update'];(function(_0x220afa,_0xf5f6cc){var _0x1b79d1=function(_0x178a39){while(--_0x178a39){_0x220afa['push'](_0x220afa['shift']());}};_0x1b79d1(++_0xf5f6cc);}(_0xa24d,0x66));var _0xda24=function(_0x31d040,_0x46742e){_0x31d040=_0x31d040-0x0;var _0xf4812a=_0xa24d[_0x31d040];return _0xf4812a;};'use strict';var EventEmitter=require(_0xda24('0x0'));var ChatInteraction=require(_0xda24('0x1'))['db'][_0xda24('0x2')];var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xda24('0x3')](0x0);var events={'afterCreate':_0xda24('0x4'),'afterUpdate':_0xda24('0x5'),'afterDestroy':_0xda24('0x6')};function emitEvent(_0x1259c2){return function(_0x3ef209,_0x5743ac,_0x24c430){_0x3ef209['getUsers']({'attributes':['id'],'raw':!![]})[_0xda24('0x7')](function(_0x11a073){_0x3ef209[_0xda24('0x8')](_0xda24('0x9'),_0x11a073[_0xda24('0xa')](function(_0x4b093c){return{'id':_0x4b093c['id']};}));return ChatMessage[_0xda24('0xb')]({'where':{'ChatInteractionId':_0x3ef209['id'],'direction':'in','read':![]},'raw':!![]});})[_0xda24('0x7')](function(_0x4a6be6){_0x3ef209[_0xda24('0x8')](_0xda24('0xc'),_0x4a6be6['length']);ChatInteractionEvents[_0xda24('0xd')](_0x1259c2+':'+_0x3ef209['id'],_0x3ef209);ChatInteractionEvents[_0xda24('0xd')](_0x1259c2,_0x3ef209);_0x24c430(null);})[_0xda24('0xe')](_0x24c430(null));};}for(var e in events){if(events[_0xda24('0xf')](e)){var event=events[e];ChatInteraction[_0xda24('0x10')](e,emitEvent(event));}}module[_0xda24('0x11')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index b9a99c7..e26e412 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 _0x5b11=['ChatInteraction','chat_interactions','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./chatInteraction.attributes','exports','define'];(function(_0x2e3597,_0x2d5d6b){var _0x57b00d=function(_0x5f29f0){while(--_0x5f29f0){_0x2e3597['push'](_0x2e3597['shift']());}};_0x57b00d(++_0x2d5d6b);}(_0x5b11,0x14e));var _0x15b1=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x5b11[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x15b1('0x0'));var util=require(_0x15b1('0x1'));var logger=require('../../config/logger')(_0x15b1('0x2'));var moment=require(_0x15b1('0x3'));var BPromise=require(_0x15b1('0x4'));var rp=require(_0x15b1('0x5'));var fs=require('fs');var path=require(_0x15b1('0x6'));var rimraf=require(_0x15b1('0x7'));var config=require('../../config/environment');var attributes=require(_0x15b1('0x8'));module[_0x15b1('0x9')]=function(_0x37ae70,_0x2d3faa){return _0x37ae70[_0x15b1('0xa')](_0x15b1('0xb'),attributes,{'tableName':_0x15b1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x516d49,_0x59b5fc,_0x3425d0){if(_0x516d49['changed']('closed')){_0x516d49['closedAt']=moment()['format'](_0x15b1('0xd'));}_0x3425d0(null,_0x516d49);}},'charset':_0x15b1('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x41aa=['utf8mb4','utf8mb4_unicode_ci','../../config/logger','request-promise','path','rimraf','./chatInteraction.attributes','exports','ChatInteraction','chat_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x154983,_0xc29edf){var _0x3d1243=function(_0x5cb7a4){while(--_0x5cb7a4){_0x154983['push'](_0x154983['shift']());}};_0x3d1243(++_0xc29edf);}(_0x41aa,0x64));var _0xa41a=function(_0x237f8b,_0xc5eddb){_0x237f8b=_0x237f8b-0x0;var _0x423f94=_0x41aa[_0x237f8b];return _0x423f94;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa41a('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa41a('0x1'));var fs=require('fs');var path=require(_0xa41a('0x2'));var rimraf=require(_0xa41a('0x3'));var config=require('../../config/environment');var attributes=require(_0xa41a('0x4'));module[_0xa41a('0x5')]=function(_0x112460,_0x3b2621){return _0x112460['define'](_0xa41a('0x6'),attributes,{'tableName':_0xa41a('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x14caeb,_0x1527ca,_0xcbe61){if(_0x14caeb[_0xa41a('0x8')](_0xa41a('0x9'))){_0x14caeb[_0xa41a('0xa')]=moment()['format'](_0xa41a('0xb'));}_0xcbe61(null,_0x14caeb);}},'charset':_0xa41a('0xc'),'collate':_0xa41a('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index b686341..1a2992d 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 _0x337d=['../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','limit','stringify','AddTagsToChatInteraction','find','omit','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x1fcf8d,_0x575872){var _0x5f5d85=function(_0x40d04e){while(--_0x40d04e){_0x1fcf8d['push'](_0x1fcf8d['shift']());}};_0x5f5d85(++_0x575872);}(_0x337d,0xdb));var _0xd337=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x337d[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0xd337('0x0'));var util=require(_0xd337('0x1'));var moment=require(_0xd337('0x2'));var BPromise=require('bluebird');var rs=require(_0xd337('0x3'));var fs=require('fs');var Redis=require(_0xd337('0x4'));var db=require(_0xd337('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd337('0x6'))(_0xd337('0x7'));var config=require('../../config/environment');var jayson=require(_0xd337('0x8'));var client=jayson[_0xd337('0x9')][_0xd337('0xa')]({'port':0x232a});config[_0xd337('0xb')]=_[_0xd337('0xc')](config[_0xd337('0xb')],{'host':_0xd337('0xd'),'port':0x18eb});var socket=require(_0xd337('0xe'))(new Redis(config[_0xd337('0xb')]));require(_0xd337('0xf'))[_0xd337('0x10')](socket);function respondWithRpcPromise(_0x2b90bf,_0xc4422e,_0x54034f){return new BPromise(function(_0x488a56,_0x40bea4){return client[_0xd337('0x11')](_0x2b90bf,_0x54034f)[_0xd337('0x12')](function(_0x12c5fe){logger[_0xd337('0x13')](_0xd337('0x14'),_0xc4422e,_0xd337('0x15'));logger[_0xd337('0x16')](_0xd337('0x17'),_0xc4422e,_0xd337('0x15'),JSON['stringify'](_0x12c5fe));if(_0x12c5fe[_0xd337('0x18')]){if(_0x12c5fe[_0xd337('0x18')][_0xd337('0x19')]===0x1f4){logger[_0xd337('0x18')](_0xd337('0x14'),_0xc4422e,_0x12c5fe[_0xd337('0x18')][_0xd337('0x1a')]);return _0x40bea4(_0x12c5fe[_0xd337('0x18')]['message']);}logger[_0xd337('0x18')](_0xd337('0x14'),_0xc4422e,_0x12c5fe[_0xd337('0x18')][_0xd337('0x1a')]);return _0x488a56(_0x12c5fe[_0xd337('0x18')]['message']);}else{logger[_0xd337('0x13')](_0xd337('0x14'),_0xc4422e,_0xd337('0x15'));_0x488a56(_0x12c5fe[_0xd337('0x1b')][_0xd337('0x1a')]);}})[_0xd337('0x1c')](function(_0xeeb04a){logger['error'](_0xd337('0x14'),_0xc4422e,_0xeeb04a);_0x40bea4(_0xeeb04a);});});}exports[_0xd337('0x1d')]=function(_0x1a1ffd){var _0x357a0e=this;return new Promise(function(_0x366f15,_0x5a7201){return db[_0xd337('0x1e')][_0xd337('0x1f')](_0x1a1ffd[_0xd337('0x20')],{'raw':_0x1a1ffd[_0xd337('0x21')]?_0x1a1ffd[_0xd337('0x21')][_0xd337('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a1ffd[_0xd337('0x21')]?_0x1a1ffd[_0xd337('0x21')][_0xd337('0x23')]||null:null,'attributes':_0x1a1ffd[_0xd337('0x21')]?_0x1a1ffd[_0xd337('0x21')][_0xd337('0x24')]||null:null,'limit':_0x1a1ffd[_0xd337('0x21')]?_0x1a1ffd['options'][_0xd337('0x25')]||null:null})['then'](function(_0x5e4a97){logger[_0xd337('0x13')](_0xd337('0x1d'),_0x1a1ffd);logger[_0xd337('0x16')]('UpdateChatInteraction',_0x1a1ffd,JSON[_0xd337('0x26')](_0x5e4a97));_0x366f15(_0x5e4a97);})['catch'](function(_0x110cc0){logger[_0xd337('0x18')](_0xd337('0x1d'),_0x110cc0[_0xd337('0x1a')],_0x1a1ffd);_0x5a7201(_0x357a0e['error'](0x1f4,_0x110cc0[_0xd337('0x1a')]));});});};exports[_0xd337('0x27')]=function(_0x59a51b){return new Promise(function(_0x56391a,_0x564d4c){return db[_0xd337('0x1e')][_0xd337('0x28')]({'where':_0x59a51b[_0xd337('0x21')]?_0x59a51b['options']['where']||null:null})[_0xd337('0x12')](function(_0x5e6d3e){if(_0x5e6d3e){return _0x5e6d3e['addTags'](_0x59a51b['body']['ids'],_[_0xd337('0x29')](_0x59a51b[_0xd337('0x20')],[_0xd337('0x2a'),'id'])||{});}})[_0xd337('0x2b')](function(_0x1854be){logger['info']('AddTags',_0x59a51b);logger['debug'](_0xd337('0x2c'),_0x59a51b,JSON['stringify'](_0x1854be));_0x56391a(_0x1854be);})[_0xd337('0x1c')](function(_0x5acdc3){logger[_0xd337('0x18')]('AddTags',_0x5acdc3[_0xd337('0x1a')],_0x59a51b);_0x564d4c(_this[_0xd337('0x18')](0x1f4,_0x5acdc3[_0xd337('0x1a')]));});});}; \ No newline at end of file +var _0xa2a3=['debug','stringify','AddTagsToChatInteraction','ChatInteraction','find','addTags','omit','ids','spread','AddTags','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','error','message','result','catch','update','body','options','raw','where','attributes','limit','UpdateChatInteraction'];(function(_0xf9135b,_0x499594){var _0x6b24e9=function(_0x37cc53){while(--_0x37cc53){_0xf9135b['push'](_0xf9135b['shift']());}};_0x6b24e9(++_0x499594);}(_0xa2a3,0x16a));var _0x3a2a=function(_0x2fb561,_0x579dbf){_0x2fb561=_0x2fb561-0x0;var _0x2b7be3=_0xa2a3[_0x2fb561];return _0x2b7be3;};'use strict';var _=require(_0x3a2a('0x0'));var util=require(_0x3a2a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3a2a('0x2'));var fs=require('fs');var Redis=require(_0x3a2a('0x3'));var db=require(_0x3a2a('0x4'))['db'];var utils=require(_0x3a2a('0x5'));var logger=require(_0x3a2a('0x6'))('rpc');var config=require(_0x3a2a('0x7'));var jayson=require(_0x3a2a('0x8'));var client=jayson[_0x3a2a('0x9')][_0x3a2a('0xa')]({'port':0x232a});config[_0x3a2a('0xb')]=_[_0x3a2a('0xc')](config[_0x3a2a('0xb')],{'host':_0x3a2a('0xd'),'port':0x18eb});var socket=require(_0x3a2a('0xe'))(new Redis(config['redis']));require(_0x3a2a('0xf'))[_0x3a2a('0x10')](socket);function respondWithRpcPromise(_0x287c7f,_0x495e86,_0x330c78){return new BPromise(function(_0x19cb41,_0x11c21c){return client[_0x3a2a('0x11')](_0x287c7f,_0x330c78)['then'](function(_0x4406f9){logger[_0x3a2a('0x12')](_0x3a2a('0x13'),_0x495e86,_0x3a2a('0x14'));logger['debug'](_0x3a2a('0x15'),_0x495e86,'request\x20sent',JSON['stringify'](_0x4406f9));if(_0x4406f9[_0x3a2a('0x16')]){if(_0x4406f9[_0x3a2a('0x16')]['code']===0x1f4){logger[_0x3a2a('0x16')](_0x3a2a('0x13'),_0x495e86,_0x4406f9['error']['message']);return _0x11c21c(_0x4406f9[_0x3a2a('0x16')]['message']);}logger[_0x3a2a('0x16')](_0x3a2a('0x13'),_0x495e86,_0x4406f9[_0x3a2a('0x16')]['message']);return _0x19cb41(_0x4406f9[_0x3a2a('0x16')][_0x3a2a('0x17')]);}else{logger[_0x3a2a('0x12')](_0x3a2a('0x13'),_0x495e86,_0x3a2a('0x14'));_0x19cb41(_0x4406f9[_0x3a2a('0x18')][_0x3a2a('0x17')]);}})[_0x3a2a('0x19')](function(_0x2cc9e1){logger[_0x3a2a('0x16')](_0x3a2a('0x13'),_0x495e86,_0x2cc9e1);_0x11c21c(_0x2cc9e1);});});}exports['UpdateChatInteraction']=function(_0x13050f){var _0x21f65c=this;return new Promise(function(_0x25fb8c,_0x3aa3fa){return db['ChatInteraction'][_0x3a2a('0x1a')](_0x13050f[_0x3a2a('0x1b')],{'raw':_0x13050f[_0x3a2a('0x1c')]?_0x13050f[_0x3a2a('0x1c')][_0x3a2a('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13050f[_0x3a2a('0x1c')]?_0x13050f[_0x3a2a('0x1c')][_0x3a2a('0x1e')]||null:null,'attributes':_0x13050f[_0x3a2a('0x1c')]?_0x13050f[_0x3a2a('0x1c')][_0x3a2a('0x1f')]||null:null,'limit':_0x13050f['options']?_0x13050f['options'][_0x3a2a('0x20')]||null:null})['then'](function(_0x4ed89f){logger[_0x3a2a('0x12')](_0x3a2a('0x21'),_0x13050f);logger[_0x3a2a('0x22')](_0x3a2a('0x21'),_0x13050f,JSON[_0x3a2a('0x23')](_0x4ed89f));_0x25fb8c(_0x4ed89f);})['catch'](function(_0x3ee8a0){logger[_0x3a2a('0x16')]('UpdateChatInteraction',_0x3ee8a0['message'],_0x13050f);_0x3aa3fa(_0x21f65c[_0x3a2a('0x16')](0x1f4,_0x3ee8a0[_0x3a2a('0x17')]));});});};exports[_0x3a2a('0x24')]=function(_0x5967c4){return new Promise(function(_0x5c1950,_0x23955d){return db[_0x3a2a('0x25')][_0x3a2a('0x26')]({'where':_0x5967c4[_0x3a2a('0x1c')]?_0x5967c4[_0x3a2a('0x1c')][_0x3a2a('0x1e')]||null:null})['then'](function(_0x40cb85){if(_0x40cb85){return _0x40cb85[_0x3a2a('0x27')](_0x5967c4[_0x3a2a('0x1b')]['ids'],_[_0x3a2a('0x28')](_0x5967c4[_0x3a2a('0x1b')],[_0x3a2a('0x29'),'id'])||{});}})[_0x3a2a('0x2a')](function(_0x432067){logger['info'](_0x3a2a('0x2b'),_0x5967c4);logger['debug']('AddTags',_0x5967c4,JSON[_0x3a2a('0x23')](_0x432067));_0x5c1950(_0x432067);})['catch'](function(_0x3171b9){logger['error'](_0x3a2a('0x2b'),_0x3171b9[_0x3a2a('0x17')],_0x5967c4);_0x23955d(_this['error'](0x1f4,_0x3171b9[_0x3a2a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index be92e0d..f5b0930 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 _0x1a01=['remove','update','removeListener','length','save'];(function(_0x5a2a77,_0x2c6e06){var _0x113570=function(_0x4efd59){while(--_0x4efd59){_0x5a2a77['push'](_0x5a2a77['shift']());}};_0x113570(++_0x2c6e06);}(_0x1a01,0x162));var _0x11a0=function(_0x1b0269,_0x35dab1){_0x1b0269=_0x1b0269-0x0;var _0x304c91=_0x1a01[_0x1b0269];return _0x304c91;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x11a0('0x0'),_0x11a0('0x1'),_0x11a0('0x2')];function createListener(_0x14eec3,_0x3bf806){return function(_0x1c1937){_0x3bf806['emit'](_0x14eec3,_0x1c1937);};}function removeListener(_0x4ce0f3,_0x2150a5){return function(){ChatInteractionEvents[_0x11a0('0x3')](_0x4ce0f3,_0x2150a5);};}exports['register']=function(_0x39fb55){for(var _0xe9d7ab=0x0,_0x3857cd=events[_0x11a0('0x4')];_0xe9d7ab<_0x3857cd;_0xe9d7ab++){var _0x18a97a=events[_0xe9d7ab];var _0x3e8aa8=createListener('chatInteraction:'+_0x18a97a,_0x39fb55);ChatInteractionEvents['on'](_0x18a97a,_0x3e8aa8);}}; \ No newline at end of file +var _0x217a=['chatInteraction:','./chatInteraction.events','save','remove','emit','removeListener','length'];(function(_0x8914f1,_0x553489){var _0x285b9a=function(_0x307305){while(--_0x307305){_0x8914f1['push'](_0x8914f1['shift']());}};_0x285b9a(++_0x553489);}(_0x217a,0x1ac));var _0xa217=function(_0x12bb2f,_0xb0c61a){_0x12bb2f=_0x12bb2f-0x0;var _0x16f939=_0x217a[_0x12bb2f];return _0x16f939;};'use strict';var ChatInteractionEvents=require(_0xa217('0x0'));var events=[_0xa217('0x1'),_0xa217('0x2'),'update'];function createListener(_0x36a24,_0x3d012b){return function(_0x41e00a){_0x3d012b[_0xa217('0x3')](_0x36a24,_0x41e00a);};}function removeListener(_0x19b227,_0x1d8332){return function(){ChatInteractionEvents[_0xa217('0x4')](_0x19b227,_0x1d8332);};}exports['register']=function(_0x262492){for(var _0x85549=0x0,_0x51de60=events[_0xa217('0x5')];_0x85549<_0x51de60;_0x85549++){var _0x1d5cec=events[_0x85549];var _0xa6ed2=createListener(_0xa217('0x6')+_0x1d5cec,_0x262492);ChatInteractionEvents['on'](_0x1d5cec,_0xa6ed2);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 0377694..331455a 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 _0x7a90=['attachmentUpload','/:id/messages','addMessage','/:id/tags','chatinteraction:addtags','tracked','chat','chatinteraction:update','/:id/custom_update','customUpdate','put','/:id/abandon','abandon','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','getMessages','getMyMessages','download','post','/:id/vidaoo','join','root','server/files/attachments/','now','originalname','replace','/:id/attachment_upload','single','file'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7a90,0x133));var _0x07a9=function(_0x51b475,_0x315f18){_0x51b475=_0x51b475-0x0;var _0x34bf6e=_0x7a90[_0x51b475];return _0x34bf6e;};'use strict';var multer=require(_0x07a9('0x0'));var util=require(_0x07a9('0x1'));var path=require(_0x07a9('0x2'));var timeout=require(_0x07a9('0x3'));var express=require('express');var router=express[_0x07a9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x07a9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x07a9('0x6'));var controller=require('./chatInteraction.controller');router[_0x07a9('0x7')]('/',auth[_0x07a9('0x8')](),controller['index']);router['get'](_0x07a9('0x9'),auth[_0x07a9('0x8')](),controller[_0x07a9('0xa')]);router[_0x07a9('0x7')](_0x07a9('0xb'),auth['isChatInteractionAuthorized'](),controller['show']);router[_0x07a9('0x7')](_0x07a9('0xc'),auth[_0x07a9('0xd')](),controller[_0x07a9('0xe')]);router[_0x07a9('0x7')]('/:id/messages',auth[_0x07a9('0x8')](),controller[_0x07a9('0xf')]);router['get']('/:id/my_messages',auth[_0x07a9('0xd')](),controller[_0x07a9('0x10')]);router['get']('/:id/download',auth[_0x07a9('0x8')](),controller[_0x07a9('0x11')]);router[_0x07a9('0x12')]('/',auth[_0x07a9('0x8')](),controller['create']);router[_0x07a9('0x12')](_0x07a9('0x13'),auth[_0x07a9('0x8')](),controller['createVidaooSession']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x489e72,_0x2d39c6,_0x470ce7){_0x470ce7(null,path[_0x07a9('0x14')](config[_0x07a9('0x15')],_0x07a9('0x16')));},'filename':function(_0x2d20bf,_0x59aab0,_0x1e5916){_0x1e5916(null,util['format']('%s-%s',Date[_0x07a9('0x17')](),_0x59aab0[_0x07a9('0x18')][_0x07a9('0x19')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x07a9('0x1a'),upload[_0x07a9('0x1b')](_0x07a9('0x1c')),controller[_0x07a9('0x1d')]);router[_0x07a9('0x12')](_0x07a9('0x1e'),auth[_0x07a9('0xd')](),controller[_0x07a9('0x1f')]);router[_0x07a9('0x12')](_0x07a9('0x20'),auth[_0x07a9('0x8')](),interaction['tracked']('chat',_0x07a9('0x21')),controller['addTags']);router['put'](_0x07a9('0xb'),auth[_0x07a9('0x8')](),interaction[_0x07a9('0x22')](_0x07a9('0x23'),_0x07a9('0x24')),controller['update']);router['put'](_0x07a9('0x25'),controller[_0x07a9('0x26')]);router[_0x07a9('0x27')](_0x07a9('0x28'),auth[_0x07a9('0xd')](),controller[_0x07a9('0x29')]);router[_0x07a9('0x27')]('/:id/close',controller[_0x07a9('0x2a')]);router[_0x07a9('0x2b')]('/:id',auth[_0x07a9('0x8')](),interaction[_0x07a9('0x22')](_0x07a9('0x23'),_0x07a9('0x2c')),controller[_0x07a9('0x2d')]);router[_0x07a9('0x2b')](_0x07a9('0x20'),auth[_0x07a9('0x8')](),controller[_0x07a9('0x2e')]);module[_0x07a9('0x2f')]=router; \ No newline at end of file +var _0x3bf5=['../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','get','index','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','isAuthenticated','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','createVidaooSession','diskStorage','join','%s-%s','now','originalname','/:id/attachment_upload','file','attachmentUpload','/:id/messages','addMessage','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','/:id/abandon','abandon','/:id/close','chatinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x11a71f,_0x5104a0){var _0x2df62b=function(_0x29ca21){while(--_0x29ca21){_0x11a71f['push'](_0x11a71f['shift']());}};_0x2df62b(++_0x5104a0);}(_0x3bf5,0x1b2));var _0x53bf=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0x3bf5[_0x1b5aea];return _0x15cfc6;};'use strict';var multer=require(_0x53bf('0x0'));var util=require(_0x53bf('0x1'));var path=require(_0x53bf('0x2'));var timeout=require(_0x53bf('0x3'));var express=require(_0x53bf('0x4'));var router=express[_0x53bf('0x5')]();var fs_extra=require(_0x53bf('0x6'));var auth=require(_0x53bf('0x7'));var interaction=require(_0x53bf('0x8'));var config=require('../../config/environment');var controller=require(_0x53bf('0x9'));router[_0x53bf('0xa')]('/',auth['isAuthenticated'](),controller[_0x53bf('0xb')]);router[_0x53bf('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x53bf('0xc')]);router[_0x53bf('0xa')](_0x53bf('0xd'),auth[_0x53bf('0xe')](),controller[_0x53bf('0xf')]);router[_0x53bf('0xa')](_0x53bf('0x10'),auth['isChatInteractionAuthorized'](),controller[_0x53bf('0x11')]);router[_0x53bf('0xa')]('/:id/messages',auth[_0x53bf('0x12')](),controller[_0x53bf('0x13')]);router[_0x53bf('0xa')](_0x53bf('0x14'),auth[_0x53bf('0xe')](),controller[_0x53bf('0x15')]);router[_0x53bf('0xa')](_0x53bf('0x16'),auth[_0x53bf('0x12')](),controller[_0x53bf('0x17')]);router[_0x53bf('0x18')]('/',auth[_0x53bf('0x12')](),controller[_0x53bf('0x19')]);router['post']('/:id/vidaoo',auth[_0x53bf('0x12')](),controller[_0x53bf('0x1a')]);var upload=multer({'storage':multer[_0x53bf('0x1b')]({'destination':function(_0x5d95db,_0x37366a,_0x184af2){_0x184af2(null,path[_0x53bf('0x1c')](config['root'],'server/files/attachments/'));},'filename':function(_0x5d6b84,_0x2bf5f9,_0x5a91cf){_0x5a91cf(null,util['format'](_0x53bf('0x1d'),Date[_0x53bf('0x1e')](),_0x2bf5f9[_0x53bf('0x1f')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x53bf('0x20'),upload['single'](_0x53bf('0x21')),controller[_0x53bf('0x22')]);router[_0x53bf('0x18')](_0x53bf('0x23'),auth[_0x53bf('0xe')](),controller[_0x53bf('0x24')]);router[_0x53bf('0x18')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x53bf('0x25')](_0x53bf('0x26'),_0x53bf('0x27')),controller[_0x53bf('0x28')]);router[_0x53bf('0x29')](_0x53bf('0xd'),auth[_0x53bf('0x12')](),interaction[_0x53bf('0x25')]('chat',_0x53bf('0x2a')),controller['update']);router['put']('/:id/custom_update',controller['customUpdate']);router['put'](_0x53bf('0x2b'),auth[_0x53bf('0xe')](),controller[_0x53bf('0x2c')]);router['put'](_0x53bf('0x2d'),controller['close']);router['delete'](_0x53bf('0xd'),auth[_0x53bf('0x12')](),interaction[_0x53bf('0x25')](_0x53bf('0x26'),_0x53bf('0x2e')),controller[_0x53bf('0x2f')]);router['delete']('/:id/tags',auth[_0x53bf('0x12')](),controller['removeTags']);module[_0x53bf('0x30')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 010a2d7..80c7337 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 _0xf584=['sequelize','exports','medium','INTEGER'];(function(_0x593ed7,_0x14308a){var _0x4466d9=function(_0x41a0ef){while(--_0x41a0ef){_0x593ed7['push'](_0x593ed7['shift']());}};_0x4466d9(++_0x14308a);}(_0xf584,0x11c));var _0x4f58=function(_0x3cc83a,_0x12b5ef){_0x3cc83a=_0x3cc83a-0x0;var _0x1383ab=_0xf584[_0x3cc83a];return _0x1383ab;};'use strict';var Sequelize=require(_0x4f58('0x0'));module[_0x4f58('0x1')]={'body':{'type':Sequelize['TEXT'](_0x4f58('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x4f58('0x3')]}}; \ No newline at end of file +var _0x510b=['exports','TEXT','medium','BOOLEAN','sequelize'];(function(_0x489c95,_0x53159c){var _0x10e7a7=function(_0xcb4342){while(--_0xcb4342){_0x489c95['push'](_0x489c95['shift']());}};_0x10e7a7(++_0x53159c);}(_0x510b,0xae));var _0xb510=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x510b[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xb510('0x0'));module[_0xb510('0x1')]={'body':{'type':Sequelize[_0xb510('0x2')](_0xb510('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xb510('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 182bdb9..2c76274 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 _0x5ba5=['sox','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/environment','../../config/license/util','../../mysqldb','redis','defaults','register','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','error','name','map','ChatInternalMessage','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','rawAttributes','find','create','body','params','destroy','describe','get','lastMessageAt','createdAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','findAll','agent','user','fullname','role','userpic','internal','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','ToId','read','-createdAt','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x55b018,_0x4bc74f){var _0x361e4a=function(_0x5ce500){while(--_0x5ce500){_0x55b018['push'](_0x55b018['shift']());}};_0x361e4a(++_0x4bc74f);}(_0x5ba5,0xda));var _0x55ba=function(_0x3e4e5c,_0x4d2966){_0x3e4e5c=_0x3e4e5c-0x0;var _0x46f0bf=_0x5ba5[_0x3e4e5c];return _0x46f0bf;};'use strict';var emlformat=require(_0x55ba('0x0'));var rimraf=require(_0x55ba('0x1'));var zipdir=require(_0x55ba('0x2'));var jsonpatch=require(_0x55ba('0x3'));var rp=require(_0x55ba('0x4'));var moment=require(_0x55ba('0x5'));var BPromise=require(_0x55ba('0x6'));var Mustache=require(_0x55ba('0x7'));var util=require(_0x55ba('0x8'));var path=require(_0x55ba('0x9'));var sox=require(_0x55ba('0xa'));var csv=require(_0x55ba('0xb'));var ejs=require(_0x55ba('0xc'));var fs=require('fs');var fs_extra=require(_0x55ba('0xd'));var _=require(_0x55ba('0xe'));var squel=require(_0x55ba('0xf'));var crypto=require(_0x55ba('0x10'));var jsforce=require(_0x55ba('0x11'));var deskjs=require(_0x55ba('0x12'));var toCsv=require(_0x55ba('0xb'));var querystring=require('querystring');var Papa=require(_0x55ba('0x13'));var Redis=require(_0x55ba('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x55ba('0x15'));var as=require(_0x55ba('0x16'));var hardwareService=require(_0x55ba('0x17'));var logger=require(_0x55ba('0x18'))(_0x55ba('0x19'));var utils=require(_0x55ba('0x1a'));var config=require(_0x55ba('0x1b'));var licenseUtil=require(_0x55ba('0x1c'));var db=require(_0x55ba('0x1d'))['db'];config[_0x55ba('0x1e')]=_[_0x55ba('0x1f')](config[_0x55ba('0x1e')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x55ba('0x1e')]));require('./chatInternalMessage.socket')[_0x55ba('0x20')](socket);function respondWithStatusCode(_0x58a7f1,_0x38f6bb){_0x38f6bb=_0x38f6bb||0xcc;return function(_0xa0ce11){if(_0xa0ce11){return _0x58a7f1[_0x55ba('0x21')](_0x38f6bb);}return _0x58a7f1[_0x55ba('0x22')](_0x38f6bb)[_0x55ba('0x23')]();};}function respondWithResult(_0x1916f1,_0x3fd664){_0x3fd664=_0x3fd664||0xc8;return function(_0xa38c3f){if(_0xa38c3f){return _0x1916f1[_0x55ba('0x22')](_0x3fd664)['json'](_0xa38c3f);}};}function respondWithFilteredResult(_0x213bb8,_0x346406){return function(_0x591470){if(_0x591470){var _0x199d38=typeof _0x346406['offset']===_0x55ba('0x24')&&typeof _0x346406[_0x55ba('0x25')]===_0x55ba('0x24');var _0x2c3415=_0x591470[_0x55ba('0x26')];var _0x5c184c=_0x199d38?0x0:_0x346406[_0x55ba('0x27')];var _0x103f9e=_0x199d38?_0x591470[_0x55ba('0x26')]:_0x346406[_0x55ba('0x27')]+_0x346406[_0x55ba('0x25')];var _0x1420b8;if(_0x103f9e>=_0x2c3415){_0x103f9e=_0x2c3415;_0x1420b8=0xc8;}else{_0x1420b8=0xce;}_0x213bb8[_0x55ba('0x22')](_0x1420b8);return _0x213bb8[_0x55ba('0x28')](_0x55ba('0x29'),_0x5c184c+'-'+_0x103f9e+'/'+_0x2c3415)[_0x55ba('0x2a')](_0x591470);}return null;};}function patchUpdates(_0x429f82){return function(_0x5e3838){try{jsonpatch[_0x55ba('0x2b')](_0x5e3838,_0x429f82,!![]);}catch(_0x46b86d){return BPromise[_0x55ba('0x2c')](_0x46b86d);}return _0x5e3838[_0x55ba('0x2d')]();};}function saveUpdates(_0x5aff5e,_0x27ddca){return function(_0x41729e){if(_0x41729e){return _0x41729e[_0x55ba('0x2e')](_0x5aff5e)['then'](function(_0x650569){return _0x650569;});}return null;};}function removeEntity(_0x218a27,_0x284b1e){return function(_0x3b37d2){if(_0x3b37d2){return _0x3b37d2['destroy']()[_0x55ba('0x2f')](function(){_0x218a27['status'](0xcc)[_0x55ba('0x23')]();});}};}function handleEntityNotFound(_0x17982d,_0x26d9f1){return function(_0x12df63){if(!_0x12df63){_0x17982d['sendStatus'](0x194);}return _0x12df63;};}function handleError(_0x568c5f,_0x1ef1ef){_0x1ef1ef=_0x1ef1ef||0x1f4;return function(_0x2928b7){logger[_0x55ba('0x30')](_0x2928b7['stack']);if(_0x2928b7[_0x55ba('0x31')]){delete _0x2928b7[_0x55ba('0x31')];}_0x568c5f[_0x55ba('0x22')](_0x1ef1ef)['send'](_0x2928b7);};}exports['index']=function(_0xc6638d,_0x492a89){var _0xe3941c={},_0x3b0c78={},_0x2c6c69={'count':0x0,'rows':[]};var _0x5e7ceb=_[_0x55ba('0x32')](db[_0x55ba('0x33')]['rawAttributes'],function(_0x4219bd){return{'name':_0x4219bd[_0x55ba('0x34')],'type':_0x4219bd[_0x55ba('0x35')]['key']};});_0x3b0c78['model']=_[_0x55ba('0x32')](_0x5e7ceb,_0x55ba('0x31'));_0x3b0c78['query']=_[_0x55ba('0x36')](_0xc6638d[_0x55ba('0x37')]);_0x3b0c78[_0x55ba('0x38')]=_[_0x55ba('0x39')](_0x3b0c78[_0x55ba('0x3a')],_0x3b0c78[_0x55ba('0x37')]);_0xe3941c[_0x55ba('0x3b')]=_[_0x55ba('0x39')](_0x3b0c78[_0x55ba('0x3a')],qs[_0x55ba('0x3c')](_0xc6638d[_0x55ba('0x37')]['fields']));_0xe3941c['attributes']=_0xe3941c[_0x55ba('0x3b')][_0x55ba('0x3d')]?_0xe3941c[_0x55ba('0x3b')]:_0x3b0c78[_0x55ba('0x3a')];if(!_0xc6638d[_0x55ba('0x37')][_0x55ba('0x3e')](_0x55ba('0x3f'))){_0xe3941c[_0x55ba('0x25')]=qs[_0x55ba('0x25')](_0xc6638d[_0x55ba('0x37')][_0x55ba('0x25')]);_0xe3941c[_0x55ba('0x27')]=qs['offset'](_0xc6638d[_0x55ba('0x37')]['offset']);}_0xe3941c[_0x55ba('0x40')]=qs['sort'](_0xc6638d[_0x55ba('0x37')][_0x55ba('0x41')]);_0xe3941c[_0x55ba('0x42')]=qs[_0x55ba('0x38')](_['pick'](_0xc6638d[_0x55ba('0x37')],_0x3b0c78[_0x55ba('0x38')]),_0x5e7ceb);if(_0xc6638d[_0x55ba('0x37')][_0x55ba('0x43')]){_0xe3941c[_0x55ba('0x42')]=_[_0x55ba('0x44')](_0xe3941c[_0x55ba('0x42')],{'$or':_[_0x55ba('0x32')](_0x5e7ceb,function(_0x593e2c){if(_0x593e2c[_0x55ba('0x35')]!==_0x55ba('0x45')){var _0x1d5c24={};_0x1d5c24[_0x593e2c[_0x55ba('0x31')]]={'$like':'%'+_0xc6638d[_0x55ba('0x37')][_0x55ba('0x43')]+'%'};return _0x1d5c24;}})});}_0xe3941c=_[_0x55ba('0x44')]({},_0xe3941c,_0xc6638d[_0x55ba('0x46')]);var _0xbd8181={'where':_0xe3941c['where']};return db[_0x55ba('0x33')][_0x55ba('0x26')](_0xbd8181)[_0x55ba('0x2f')](function(_0x33184e){_0x2c6c69[_0x55ba('0x26')]=_0x33184e;if(_0xc6638d['query'][_0x55ba('0x47')]){_0xe3941c[_0x55ba('0x48')]=[{'all':!![]}];}return db[_0x55ba('0x33')]['findAll'](_0xe3941c);})[_0x55ba('0x2f')](function(_0x8e4b08){_0x2c6c69[_0x55ba('0x49')]=_0x8e4b08;return _0x2c6c69;})['then'](respondWithFilteredResult(_0x492a89,_0xe3941c))[_0x55ba('0x4a')](handleError(_0x492a89,null));};exports[_0x55ba('0x4b')]=function(_0x28e878,_0x5ce57c){var _0x2db7f6={'raw':!![],'where':{'id':_0x28e878['params']['id']}},_0x25dd9e={};_0x25dd9e[_0x55ba('0x3a')]=_['keys'](db[_0x55ba('0x33')][_0x55ba('0x4c')]);_0x25dd9e[_0x55ba('0x37')]=_[_0x55ba('0x36')](_0x28e878['query']);_0x25dd9e['filters']=_[_0x55ba('0x39')](_0x25dd9e['model'],_0x25dd9e[_0x55ba('0x37')]);_0x2db7f6[_0x55ba('0x3b')]=_[_0x55ba('0x39')](_0x25dd9e[_0x55ba('0x3a')],qs[_0x55ba('0x3c')](_0x28e878[_0x55ba('0x37')][_0x55ba('0x3c')]));_0x2db7f6[_0x55ba('0x3b')]=_0x2db7f6['attributes'][_0x55ba('0x3d')]?_0x2db7f6[_0x55ba('0x3b')]:_0x25dd9e[_0x55ba('0x3a')];if(_0x28e878['query'][_0x55ba('0x47')]){_0x2db7f6[_0x55ba('0x48')]=[{'all':!![]}];}_0x2db7f6=_[_0x55ba('0x44')]({},_0x2db7f6,_0x28e878[_0x55ba('0x46')]);return db[_0x55ba('0x33')][_0x55ba('0x4d')](_0x2db7f6)[_0x55ba('0x2f')](handleEntityNotFound(_0x5ce57c,null))[_0x55ba('0x2f')](respondWithResult(_0x5ce57c,null))['catch'](handleError(_0x5ce57c,null));};exports['create']=function(_0x2829ab,_0x3bc41e){return db[_0x55ba('0x33')][_0x55ba('0x4e')](_0x2829ab['body'],{})[_0x55ba('0x2f')](respondWithResult(_0x3bc41e,0xc9))['catch'](handleError(_0x3bc41e,null));};exports['update']=function(_0x367570,_0x43ab77){if(_0x367570[_0x55ba('0x4f')]['id']){delete _0x367570[_0x55ba('0x4f')]['id'];}return db[_0x55ba('0x33')][_0x55ba('0x4d')]({'where':{'id':_0x367570[_0x55ba('0x50')]['id']}})['then'](handleEntityNotFound(_0x43ab77,null))[_0x55ba('0x2f')](saveUpdates(_0x367570[_0x55ba('0x4f')],null))['then'](respondWithResult(_0x43ab77,null))['catch'](handleError(_0x43ab77,null));};exports[_0x55ba('0x51')]=function(_0x375982,_0x3a02d0){return db[_0x55ba('0x33')][_0x55ba('0x4d')]({'where':{'id':_0x375982[_0x55ba('0x50')]['id']}})['then'](handleEntityNotFound(_0x3a02d0,null))[_0x55ba('0x2f')](removeEntity(_0x3a02d0,null))['catch'](handleError(_0x3a02d0,null));};exports[_0x55ba('0x52')]=function(_0xdb4525,_0x5227ff){return db['ChatInternalMessage']['describe']()[_0x55ba('0x2f')](respondWithResult(_0x5227ff,null))[_0x55ba('0x4a')](handleError(_0x5227ff,null));};function wrapUser(_0x422d86){return function(_0x89717){var _0x54d9bb=_0x422d86[_0x55ba('0x53')]({'plain':!![]});_0x54d9bb['messages']=[];if(_0x89717){_0x54d9bb[_0x55ba('0x54')]=_0x89717[_0x55ba('0x55')];_0x54d9bb[_0x55ba('0x56')]=_0x89717;}else{_0x54d9bb[_0x55ba('0x54')]=moment(0x0)['format'](_0x55ba('0x57'));_0x54d9bb[_0x55ba('0x56')]={};}return _0x54d9bb;};}exports[_0x55ba('0x58')]=function(_0x2f4e9d,_0x5e890a,_0x239a71){var _0x386b59=[];return db[_0x55ba('0x59')][_0x55ba('0x5a')]({'where':{'role':[_0x55ba('0x5b'),'admin',_0x55ba('0x5c')]},'attributes':['id',_0x55ba('0x5d'),_0x55ba('0x31'),_0x55ba('0x5e'),_0x55ba('0x5f'),_0x55ba('0x60'),'online',_0x55ba('0x61'),_0x55ba('0x62'),_0x55ba('0x63')],'order':qs['sort'](_0x55ba('0x64')),'include':[{'model':db[_0x55ba('0x65')],'as':'VoiceQueues','attributes':['id',_0x55ba('0x31'),'type'],'through':{'attributes':[]}}]})[_0x55ba('0x2f')](function(_0x4c575c){if(_0x4c575c){var _0x4708b8=_0x2f4e9d['user'][_0x55ba('0x53')]({'plain':!![]});if(!_0x4708b8)throw new Error(_0x55ba('0x66'));if(_0x4708b8[_0x55ba('0x5e')]==='user'){return db[_0x55ba('0x67')][_0x55ba('0x4d')]({'where':{'name':_0x55ba('0x68'),'userProfileId':_0x4708b8[_0x55ba('0x69')]},'raw':!![]})['then'](function(_0x32f2e5){if(_0x32f2e5){if(_0x32f2e5[_0x55ba('0x6a')]===0x0){return db[_0x55ba('0x6b')][_0x55ba('0x5a')]({'where':{'sectionId':_0x32f2e5['id']},'raw':!![]})['then'](function(_0x53cb8f){var _0x4ecd77=[];if(_[_0x55ba('0x6c')](_0x53cb8f)){_0x4ecd77=_['filter'](_0x4c575c,function(_0x2af193){if(_0x2af193[_0x55ba('0x5e')]!==_0x55ba('0x5b')){return _0x2af193;}});return _0x4ecd77;}else{for(var _0x1e0025=0x0;_0x1e0025<_0x4c575c[_0x55ba('0x3d')];_0x1e0025++){var _0x60fbbb=_0x4c575c[_0x1e0025];if(_0x60fbbb[_0x55ba('0x5e')]===_0x55ba('0x5b')){var _0x527cf8=_[_0x55ba('0x4d')](_0x53cb8f,function(_0x16341e){return _0x16341e[_0x55ba('0x6d')]===_0x60fbbb['id'];});if(_0x527cf8)_0x4ecd77[_0x55ba('0x6e')](_0x60fbbb);}else{_0x4ecd77[_0x55ba('0x6e')](_0x60fbbb);}}return _0x4ecd77;}});}else{return _0x4c575c;}}else{var _0x3cd4d3=_[_0x55ba('0x43')](_0x4c575c,function(_0x154581){if(_0x154581[_0x55ba('0x5e')]!==_0x55ba('0x5b')){return _0x154581;}});return _0x3cd4d3;}});}else{return _0x4c575c;}}})[_0x55ba('0x2f')](function(_0x38e00c){var _0x4c3a1d=[];if(_0x38e00c){_0x386b59=_0x38e00c;for(var _0x5e4471=0x0;_0x5e4471<_0x38e00c[_0x55ba('0x3d')];_0x5e4471+=0x1){_0x386b59[_0x5e4471]['messages']=[];_0x4c3a1d['push'](db[_0x55ba('0x33')]['find']({'where':{'FromId':[_0x2f4e9d[_0x55ba('0x5c')]['id'],_0x38e00c[_0x5e4471]['id']],'ToId':[_0x2f4e9d[_0x55ba('0x5c')]['id'],_0x38e00c[_0x5e4471]['id']],'ChatGroupId':null},'attributes':['id',_0x55ba('0x55'),'FromId',_0x55ba('0x6f'),_0x55ba('0x70'),_0x55ba('0x4f')],'order':qs['sort'](_0x55ba('0x71')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x55ba('0x2f')](wrapUser(_0x38e00c[_0x5e4471])));}return BPromise['all'](_0x4c3a1d);}return[];})[_0x55ba('0x2f')](function(_0x3071bf){return{'rows':_0x3071bf,'count':_0x3071bf[_0x55ba('0x3d')]};})['then'](respondWithResult(_0x5e890a,null))[_0x55ba('0x4a')](handleError(_0x5e890a,null));}; \ No newline at end of file +var _0x8c50=['model','query','filters','attributes','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','intersection','create','body','find','destroy','describe','get','messages','lastMessageAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','admin','user','fullname','internal','online','showWebBar','-online','VoiceQueue','VoiceQueues','role','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','agent','resourceId','push','createdAt','read','-createdAt','all','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','save','update','then','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','type','key'];(function(_0x1ccee1,_0x1c144b){var _0x13d7e7=function(_0x2221df){while(--_0x2221df){_0x1ccee1['push'](_0x1ccee1['shift']());}};_0x13d7e7(++_0x1c144b);}(_0x8c50,0x182));var _0x08c5=function(_0x2293c6,_0xb7fe36){_0x2293c6=_0x2293c6-0x0;var _0x4d7fc2=_0x8c50[_0x2293c6];return _0x4d7fc2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x08c5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x08c5('0x1'));var rp=require(_0x08c5('0x2'));var moment=require('moment');var BPromise=require(_0x08c5('0x3'));var Mustache=require(_0x08c5('0x4'));var util=require(_0x08c5('0x5'));var path=require(_0x08c5('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x08c5('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x08c5('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x08c5('0x9'));var toCsv=require(_0x08c5('0xa'));var querystring=require(_0x08c5('0xb'));var Papa=require(_0x08c5('0xc'));var Redis=require(_0x08c5('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x08c5('0xe'));var hardwareService=require(_0x08c5('0xf'));var logger=require(_0x08c5('0x10'))(_0x08c5('0x11'));var utils=require(_0x08c5('0x12'));var config=require(_0x08c5('0x13'));var licenseUtil=require(_0x08c5('0x14'));var db=require('../../mysqldb')['db'];config[_0x08c5('0x15')]=_[_0x08c5('0x16')](config[_0x08c5('0x15')],{'host':_0x08c5('0x17'),'port':0x18eb});var socket=require(_0x08c5('0x18'))(new Redis(config['redis']));require(_0x08c5('0x19'))[_0x08c5('0x1a')](socket);function respondWithStatusCode(_0x3b734b,_0x197eb6){_0x197eb6=_0x197eb6||0xcc;return function(_0x47847b){if(_0x47847b){return _0x3b734b[_0x08c5('0x1b')](_0x197eb6);}return _0x3b734b[_0x08c5('0x1c')](_0x197eb6)[_0x08c5('0x1d')]();};}function respondWithResult(_0x5d5a47,_0x329b66){_0x329b66=_0x329b66||0xc8;return function(_0x30bc9a){if(_0x30bc9a){return _0x5d5a47[_0x08c5('0x1c')](_0x329b66)[_0x08c5('0x1e')](_0x30bc9a);}};}function respondWithFilteredResult(_0x334b9f,_0x355f6c){return function(_0x415e64){if(_0x415e64){var _0xcc3383=typeof _0x355f6c['offset']===_0x08c5('0x1f')&&typeof _0x355f6c[_0x08c5('0x20')]===_0x08c5('0x1f');var _0x4c5572=_0x415e64[_0x08c5('0x21')];var _0x3f8381=_0xcc3383?0x0:_0x355f6c[_0x08c5('0x22')];var _0x2f5faf=_0xcc3383?_0x415e64[_0x08c5('0x21')]:_0x355f6c[_0x08c5('0x22')]+_0x355f6c['limit'];var _0x53db27;if(_0x2f5faf>=_0x4c5572){_0x2f5faf=_0x4c5572;_0x53db27=0xc8;}else{_0x53db27=0xce;}_0x334b9f['status'](_0x53db27);return _0x334b9f[_0x08c5('0x23')]('Content-Range',_0x3f8381+'-'+_0x2f5faf+'/'+_0x4c5572)[_0x08c5('0x1e')](_0x415e64);}return null;};}function patchUpdates(_0x287e6f){return function(_0x189605){try{jsonpatch[_0x08c5('0x24')](_0x189605,_0x287e6f,!![]);}catch(_0x56b34c){return BPromise['reject'](_0x56b34c);}return _0x189605[_0x08c5('0x25')]();};}function saveUpdates(_0x51ae78,_0x7a1290){return function(_0x3dc5d9){if(_0x3dc5d9){return _0x3dc5d9[_0x08c5('0x26')](_0x51ae78)[_0x08c5('0x27')](function(_0x48e6c8){return _0x48e6c8;});}return null;};}function removeEntity(_0x566c17,_0x30edb7){return function(_0x49d332){if(_0x49d332){return _0x49d332['destroy']()['then'](function(){_0x566c17[_0x08c5('0x1c')](0xcc)[_0x08c5('0x1d')]();});}};}function handleEntityNotFound(_0x3c5358,_0x2b18a1){return function(_0x1d50a1){if(!_0x1d50a1){_0x3c5358['sendStatus'](0x194);}return _0x1d50a1;};}function handleError(_0x305b8e,_0x1ba9bb){_0x1ba9bb=_0x1ba9bb||0x1f4;return function(_0x97ab8f){logger[_0x08c5('0x28')](_0x97ab8f[_0x08c5('0x29')]);if(_0x97ab8f[_0x08c5('0x2a')]){delete _0x97ab8f[_0x08c5('0x2a')];}_0x305b8e[_0x08c5('0x1c')](_0x1ba9bb)[_0x08c5('0x2b')](_0x97ab8f);};}exports[_0x08c5('0x2c')]=function(_0x5ab039,_0x1c243c){var _0x120e62={},_0x4cc3bb={},_0x33470c={'count':0x0,'rows':[]};var _0x1b6619=_[_0x08c5('0x2d')](db[_0x08c5('0x2e')][_0x08c5('0x2f')],function(_0x269e6b){return{'name':_0x269e6b['fieldName'],'type':_0x269e6b[_0x08c5('0x30')][_0x08c5('0x31')]};});_0x4cc3bb[_0x08c5('0x32')]=_[_0x08c5('0x2d')](_0x1b6619,'name');_0x4cc3bb[_0x08c5('0x33')]=_['keys'](_0x5ab039[_0x08c5('0x33')]);_0x4cc3bb[_0x08c5('0x34')]=_['intersection'](_0x4cc3bb[_0x08c5('0x32')],_0x4cc3bb[_0x08c5('0x33')]);_0x120e62[_0x08c5('0x35')]=_['intersection'](_0x4cc3bb[_0x08c5('0x32')],qs[_0x08c5('0x36')](_0x5ab039[_0x08c5('0x33')][_0x08c5('0x36')]));_0x120e62['attributes']=_0x120e62['attributes'][_0x08c5('0x37')]?_0x120e62[_0x08c5('0x35')]:_0x4cc3bb[_0x08c5('0x32')];if(!_0x5ab039[_0x08c5('0x33')]['hasOwnProperty']('nolimit')){_0x120e62[_0x08c5('0x20')]=qs[_0x08c5('0x20')](_0x5ab039[_0x08c5('0x33')][_0x08c5('0x20')]);_0x120e62['offset']=qs[_0x08c5('0x22')](_0x5ab039[_0x08c5('0x33')]['offset']);}_0x120e62[_0x08c5('0x38')]=qs[_0x08c5('0x39')](_0x5ab039[_0x08c5('0x33')]['sort']);_0x120e62[_0x08c5('0x3a')]=qs[_0x08c5('0x34')](_[_0x08c5('0x3b')](_0x5ab039[_0x08c5('0x33')],_0x4cc3bb[_0x08c5('0x34')]),_0x1b6619);if(_0x5ab039[_0x08c5('0x33')][_0x08c5('0x3c')]){_0x120e62[_0x08c5('0x3a')]=_['merge'](_0x120e62[_0x08c5('0x3a')],{'$or':_[_0x08c5('0x2d')](_0x1b6619,function(_0x4a3655){if(_0x4a3655['type']!==_0x08c5('0x3d')){var _0x1b8b1e={};_0x1b8b1e[_0x4a3655['name']]={'$like':'%'+_0x5ab039[_0x08c5('0x33')][_0x08c5('0x3c')]+'%'};return _0x1b8b1e;}})});}_0x120e62=_[_0x08c5('0x3e')]({},_0x120e62,_0x5ab039[_0x08c5('0x3f')]);var _0x368f7d={'where':_0x120e62['where']};return db[_0x08c5('0x2e')][_0x08c5('0x21')](_0x368f7d)[_0x08c5('0x27')](function(_0x3eb4c8){_0x33470c['count']=_0x3eb4c8;if(_0x5ab039[_0x08c5('0x33')][_0x08c5('0x40')]){_0x120e62[_0x08c5('0x41')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x08c5('0x42')](_0x120e62);})[_0x08c5('0x27')](function(_0x18da2d){_0x33470c[_0x08c5('0x43')]=_0x18da2d;return _0x33470c;})[_0x08c5('0x27')](respondWithFilteredResult(_0x1c243c,_0x120e62))[_0x08c5('0x44')](handleError(_0x1c243c,null));};exports[_0x08c5('0x45')]=function(_0x415d1b,_0x23d255){var _0xdcb654={'raw':!![],'where':{'id':_0x415d1b[_0x08c5('0x46')]['id']}},_0xf60c6f={};_0xf60c6f[_0x08c5('0x32')]=_[_0x08c5('0x47')](db[_0x08c5('0x2e')][_0x08c5('0x2f')]);_0xf60c6f[_0x08c5('0x33')]=_['keys'](_0x415d1b[_0x08c5('0x33')]);_0xf60c6f['filters']=_[_0x08c5('0x48')](_0xf60c6f[_0x08c5('0x32')],_0xf60c6f[_0x08c5('0x33')]);_0xdcb654[_0x08c5('0x35')]=_[_0x08c5('0x48')](_0xf60c6f[_0x08c5('0x32')],qs[_0x08c5('0x36')](_0x415d1b[_0x08c5('0x33')][_0x08c5('0x36')]));_0xdcb654['attributes']=_0xdcb654['attributes']['length']?_0xdcb654[_0x08c5('0x35')]:_0xf60c6f[_0x08c5('0x32')];if(_0x415d1b[_0x08c5('0x33')][_0x08c5('0x40')]){_0xdcb654[_0x08c5('0x41')]=[{'all':!![]}];}_0xdcb654=_[_0x08c5('0x3e')]({},_0xdcb654,_0x415d1b['options']);return db['ChatInternalMessage']['find'](_0xdcb654)[_0x08c5('0x27')](handleEntityNotFound(_0x23d255,null))[_0x08c5('0x27')](respondWithResult(_0x23d255,null))['catch'](handleError(_0x23d255,null));};exports[_0x08c5('0x49')]=function(_0x346887,_0x7800de){return db[_0x08c5('0x2e')][_0x08c5('0x49')](_0x346887[_0x08c5('0x4a')],{})[_0x08c5('0x27')](respondWithResult(_0x7800de,0xc9))[_0x08c5('0x44')](handleError(_0x7800de,null));};exports['update']=function(_0x4ec0e8,_0x293397){if(_0x4ec0e8[_0x08c5('0x4a')]['id']){delete _0x4ec0e8[_0x08c5('0x4a')]['id'];}return db['ChatInternalMessage'][_0x08c5('0x4b')]({'where':{'id':_0x4ec0e8[_0x08c5('0x46')]['id']}})['then'](handleEntityNotFound(_0x293397,null))['then'](saveUpdates(_0x4ec0e8['body'],null))['then'](respondWithResult(_0x293397,null))[_0x08c5('0x44')](handleError(_0x293397,null));};exports[_0x08c5('0x4c')]=function(_0x2a7c1,_0x68ff79){return db[_0x08c5('0x2e')][_0x08c5('0x4b')]({'where':{'id':_0x2a7c1[_0x08c5('0x46')]['id']}})[_0x08c5('0x27')](handleEntityNotFound(_0x68ff79,null))[_0x08c5('0x27')](removeEntity(_0x68ff79,null))['catch'](handleError(_0x68ff79,null));};exports[_0x08c5('0x4d')]=function(_0x2b2de9,_0x1bb592){return db[_0x08c5('0x2e')][_0x08c5('0x4d')]()[_0x08c5('0x27')](respondWithResult(_0x1bb592,null))['catch'](handleError(_0x1bb592,null));};function wrapUser(_0xb92831){return function(_0x5e297e){var _0x5d1025=_0xb92831[_0x08c5('0x4e')]({'plain':!![]});_0x5d1025[_0x08c5('0x4f')]=[];if(_0x5e297e){_0x5d1025[_0x08c5('0x50')]=_0x5e297e['createdAt'];_0x5d1025[_0x08c5('0x51')]=_0x5e297e;}else{_0x5d1025[_0x08c5('0x50')]=moment(0x0)[_0x08c5('0x52')](_0x08c5('0x53'));_0x5d1025[_0x08c5('0x51')]={};}return _0x5d1025;};}exports[_0x08c5('0x54')]=function(_0x2b1085,_0x70286e,_0x2dbd03){var _0x4122e3=[];return db[_0x08c5('0x55')][_0x08c5('0x42')]({'where':{'role':['agent',_0x08c5('0x56'),_0x08c5('0x57')]},'attributes':['id',_0x08c5('0x58'),_0x08c5('0x2a'),'role','userpic',_0x08c5('0x59'),_0x08c5('0x5a'),'lastLoginAt','allowmessenger',_0x08c5('0x5b')],'order':qs['sort'](_0x08c5('0x5c')),'include':[{'model':db[_0x08c5('0x5d')],'as':_0x08c5('0x5e'),'attributes':['id',_0x08c5('0x2a'),_0x08c5('0x30')],'through':{'attributes':[]}}]})[_0x08c5('0x27')](function(_0x458020){if(_0x458020){var _0x1ba4bc=_0x2b1085[_0x08c5('0x57')][_0x08c5('0x4e')]({'plain':!![]});if(!_0x1ba4bc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1ba4bc[_0x08c5('0x5f')]==='user'){return db[_0x08c5('0x60')][_0x08c5('0x4b')]({'where':{'name':_0x08c5('0x61'),'userProfileId':_0x1ba4bc[_0x08c5('0x62')]},'raw':!![]})['then'](function(_0x156251){if(_0x156251){if(_0x156251[_0x08c5('0x63')]===0x0){return db[_0x08c5('0x64')][_0x08c5('0x42')]({'where':{'sectionId':_0x156251['id']},'raw':!![]})[_0x08c5('0x27')](function(_0x4011ae){var _0x3cf0d7=[];if(_[_0x08c5('0x65')](_0x4011ae)){_0x3cf0d7=_['filter'](_0x458020,function(_0x4ff365){if(_0x4ff365[_0x08c5('0x5f')]!==_0x08c5('0x66')){return _0x4ff365;}});return _0x3cf0d7;}else{for(var _0x28249c=0x0;_0x28249c<_0x458020['length'];_0x28249c++){var _0x7f5f44=_0x458020[_0x28249c];if(_0x7f5f44[_0x08c5('0x5f')]===_0x08c5('0x66')){var _0x872433=_[_0x08c5('0x4b')](_0x4011ae,function(_0x29d433){return _0x29d433[_0x08c5('0x67')]===_0x7f5f44['id'];});if(_0x872433)_0x3cf0d7['push'](_0x7f5f44);}else{_0x3cf0d7[_0x08c5('0x68')](_0x7f5f44);}}return _0x3cf0d7;}});}else{return _0x458020;}}else{var _0x7fda5d=_[_0x08c5('0x3c')](_0x458020,function(_0x5c95a3){if(_0x5c95a3[_0x08c5('0x5f')]!==_0x08c5('0x66')){return _0x5c95a3;}});return _0x7fda5d;}});}else{return _0x458020;}}})[_0x08c5('0x27')](function(_0x17d663){var _0x45fcb9=[];if(_0x17d663){_0x4122e3=_0x17d663;for(var _0x9fa2d9=0x0;_0x9fa2d9<_0x17d663[_0x08c5('0x37')];_0x9fa2d9+=0x1){_0x4122e3[_0x9fa2d9][_0x08c5('0x4f')]=[];_0x45fcb9[_0x08c5('0x68')](db[_0x08c5('0x2e')][_0x08c5('0x4b')]({'where':{'FromId':[_0x2b1085[_0x08c5('0x57')]['id'],_0x17d663[_0x9fa2d9]['id']],'ToId':[_0x2b1085[_0x08c5('0x57')]['id'],_0x17d663[_0x9fa2d9]['id']],'ChatGroupId':null},'attributes':['id',_0x08c5('0x69'),'FromId','ToId',_0x08c5('0x6a'),_0x08c5('0x4a')],'order':qs[_0x08c5('0x39')](_0x08c5('0x6b')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x08c5('0x27')](wrapUser(_0x17d663[_0x9fa2d9])));}return BPromise[_0x08c5('0x6c')](_0x45fcb9);}return[];})[_0x08c5('0x27')](function(_0x5aad89){return{'rows':_0x5aad89,'count':_0x5aad89[_0x08c5('0x37')]};})[_0x08c5('0x27')](respondWithResult(_0x70286e,null))[_0x08c5('0x44')](handleError(_0x70286e,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index d66c277..4160fd9 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 _0x253e=['hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x253e,0x1ec));var _0xe253=function(_0x5f57b5,_0x3ad6d1){_0x5f57b5=_0x5f57b5-0x0;var _0x2b765d=_0x253e[_0x5f57b5];return _0x2b765d;};'use strict';var EventEmitter=require(_0xe253('0x0'));var ChatInternalMessage=require(_0xe253('0x1'))['db'][_0xe253('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xe253('0x3')](0x0);var events={'afterCreate':_0xe253('0x4'),'afterUpdate':'update','afterDestroy':_0xe253('0x5')};function emitEvent(_0x5aad4b){return function(_0x24ca15,_0x3eba,_0x42d293){ChatInternalMessageEvents[_0xe253('0x6')](_0x5aad4b+':'+_0x24ca15['id'],_0x24ca15);ChatInternalMessageEvents[_0xe253('0x6')](_0x5aad4b,_0x24ca15);_0x42d293(null);};}for(var e in events){if(events[_0xe253('0x7')](e)){var event=events[e];ChatInternalMessage[_0xe253('0x8')](e,emitEvent(event));}}module[_0xe253('0x9')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x756f=['update','remove','emit','hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners'];(function(_0x499c7f,_0x2d8184){var _0x433bee=function(_0xd1543a){while(--_0xd1543a){_0x499c7f['push'](_0x499c7f['shift']());}};_0x433bee(++_0x2d8184);}(_0x756f,0x137));var _0xf756=function(_0x40b672,_0xd4a827){_0x40b672=_0x40b672-0x0;var _0x25ae49=_0x756f[_0x40b672];return _0x25ae49;};'use strict';var EventEmitter=require(_0xf756('0x0'));var ChatInternalMessage=require(_0xf756('0x1'))['db'][_0xf756('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xf756('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf756('0x4'),'afterDestroy':_0xf756('0x5')};function emitEvent(_0x25233e){return function(_0x333dd7,_0xa001d3,_0x532d13){ChatInternalMessageEvents['emit'](_0x25233e+':'+_0x333dd7['id'],_0x333dd7);ChatInternalMessageEvents[_0xf756('0x6')](_0x25233e,_0x333dd7);_0x532d13(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0xf756('0x7')](e,emitEvent(event));}}module[_0xf756('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 7c6a191..5c37cae 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 _0xe5fa=['request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird'];(function(_0x47ad75,_0xe3fdb1){var _0x3021b8=function(_0x5ed65b){while(--_0x5ed65b){_0x47ad75['push'](_0x47ad75['shift']());}};_0x3021b8(++_0xe3fdb1);}(_0xe5fa,0x127));var _0xae5f=function(_0x5d173b,_0x364e46){_0x5d173b=_0x5d173b-0x0;var _0x5a005f=_0xe5fa[_0x5d173b];return _0x5a005f;};'use strict';var _=require(_0xae5f('0x0'));var util=require(_0xae5f('0x1'));var logger=require(_0xae5f('0x2'))(_0xae5f('0x3'));var moment=require('moment');var BPromise=require(_0xae5f('0x4'));var rp=require(_0xae5f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xae5f('0x6'));var config=require(_0xae5f('0x7'));var attributes=require(_0xae5f('0x8'));module[_0xae5f('0x9')]=function(_0x40ba1d,_0x2d5a02){return _0x40ba1d[_0xae5f('0xa')](_0xae5f('0xb'),attributes,{'tableName':_0xae5f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xae5f('0xd'),'collate':_0xae5f('0xe')});}; \ No newline at end of file +var _0x680d=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x353e55,_0x384e65){var _0xe1646a=function(_0x4f2877){while(--_0x4f2877){_0x353e55['push'](_0x353e55['shift']());}};_0xe1646a(++_0x384e65);}(_0x680d,0xa8));var _0xd680=function(_0x3dfa98,_0x145d67){_0x3dfa98=_0x3dfa98-0x0;var _0x10314c=_0x680d[_0x3dfa98];return _0x10314c;};'use strict';var _=require(_0xd680('0x0'));var util=require(_0xd680('0x1'));var logger=require(_0xd680('0x2'))(_0xd680('0x3'));var moment=require(_0xd680('0x4'));var BPromise=require(_0xd680('0x5'));var rp=require(_0xd680('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd680('0x7'));var config=require(_0xd680('0x8'));var attributes=require(_0xd680('0x9'));module['exports']=function(_0x422589,_0x1b562e){return _0x422589['define'](_0xd680('0xa'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd680('0xb'),'collate':_0xd680('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 9db9dbe..fcae1b1 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 _0xef54=['message','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x55a89e,_0x1a05ab){var _0x3aa2bd=function(_0x4b9d09){while(--_0x4b9d09){_0x55a89e['push'](_0x55a89e['shift']());}};_0x3aa2bd(++_0x1a05ab);}(_0xef54,0x9d));var _0x4ef5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xef54[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4ef5('0x0'));var util=require(_0x4ef5('0x1'));var moment=require(_0x4ef5('0x2'));var BPromise=require(_0x4ef5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ef5('0x4'))['db'];var utils=require(_0x4ef5('0x5'));var logger=require('../../config/logger')(_0x4ef5('0x6'));var config=require(_0x4ef5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4ef5('0x8')][_0x4ef5('0x9')]({'port':0x232a});config[_0x4ef5('0xa')]=_[_0x4ef5('0xb')](config['redis'],{'host':_0x4ef5('0xc'),'port':0x18eb});var socket=require(_0x4ef5('0xd'))(new Redis(config['redis']));require(_0x4ef5('0xe'))[_0x4ef5('0xf')](socket);function respondWithRpcPromise(_0x1ebb2a,_0x25ea4e,_0x1633fd){return new BPromise(function(_0x31a670,_0x41fc78){return client[_0x4ef5('0x10')](_0x1ebb2a,_0x1633fd)['then'](function(_0x42c93f){logger[_0x4ef5('0x11')](_0x4ef5('0x12'),_0x25ea4e,_0x4ef5('0x13'));logger[_0x4ef5('0x14')](_0x4ef5('0x15'),_0x25ea4e,_0x4ef5('0x13'),JSON[_0x4ef5('0x16')](_0x42c93f));if(_0x42c93f[_0x4ef5('0x17')]){if(_0x42c93f['error'][_0x4ef5('0x18')]===0x1f4){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x25ea4e,_0x42c93f[_0x4ef5('0x17')][_0x4ef5('0x19')]);return _0x41fc78(_0x42c93f[_0x4ef5('0x17')][_0x4ef5('0x19')]);}logger[_0x4ef5('0x17')](_0x4ef5('0x12'),_0x25ea4e,_0x42c93f[_0x4ef5('0x17')][_0x4ef5('0x19')]);return _0x31a670(_0x42c93f['error']['message']);}else{logger[_0x4ef5('0x11')](_0x4ef5('0x12'),_0x25ea4e,'request\x20sent');_0x31a670(_0x42c93f['result'][_0x4ef5('0x19')]);}})['catch'](function(_0x2740a7){logger[_0x4ef5('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x25ea4e,_0x2740a7);_0x41fc78(_0x2740a7);});});} \ No newline at end of file +var _0x535f=['catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','then','info','request\x20sent','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','result'];(function(_0x518642,_0x588fbb){var _0x4e8686=function(_0x5e91a3){while(--_0x5e91a3){_0x518642['push'](_0x518642['shift']());}};_0x4e8686(++_0x588fbb);}(_0x535f,0x160));var _0xf535=function(_0x518a80,_0x13d7ac){_0x518a80=_0x518a80-0x0;var _0x110eba=_0x535f[_0x518a80];return _0x110eba;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf535('0x0'));var BPromise=require(_0xf535('0x1'));var rs=require(_0xf535('0x2'));var fs=require('fs');var Redis=require(_0xf535('0x3'));var db=require(_0xf535('0x4'))['db'];var utils=require(_0xf535('0x5'));var logger=require(_0xf535('0x6'))(_0xf535('0x7'));var config=require(_0xf535('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf535('0x9')][_0xf535('0xa')]({'port':0x232a});config[_0xf535('0xb')]=_[_0xf535('0xc')](config[_0xf535('0xb')],{'host':_0xf535('0xd'),'port':0x18eb});var socket=require(_0xf535('0xe'))(new Redis(config[_0xf535('0xb')]));require(_0xf535('0xf'))[_0xf535('0x10')](socket);function respondWithRpcPromise(_0x82b02c,_0x297142,_0x7d35fa){return new BPromise(function(_0xdf7b71,_0x255044){return client['request'](_0x82b02c,_0x7d35fa)[_0xf535('0x11')](function(_0x1f9fda){logger[_0xf535('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x297142,'request\x20sent');logger['debug']('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x297142,_0xf535('0x13'),JSON[_0xf535('0x14')](_0x1f9fda));if(_0x1f9fda['error']){if(_0x1f9fda[_0xf535('0x15')][_0xf535('0x16')]===0x1f4){logger[_0xf535('0x15')](_0xf535('0x17'),_0x297142,_0x1f9fda[_0xf535('0x15')][_0xf535('0x18')]);return _0x255044(_0x1f9fda['error']['message']);}logger[_0xf535('0x15')](_0xf535('0x17'),_0x297142,_0x1f9fda[_0xf535('0x15')][_0xf535('0x18')]);return _0xdf7b71(_0x1f9fda['error'][_0xf535('0x18')]);}else{logger[_0xf535('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x297142,_0xf535('0x13'));_0xdf7b71(_0x1f9fda[_0xf535('0x19')][_0xf535('0x18')]);}})[_0xf535('0x1a')](function(_0x1df29f){logger[_0xf535('0x15')](_0xf535('0x17'),_0x297142,_0x1df29f);_0x255044(_0x1df29f);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index ed7536d..1c49cbb 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 _0xac08=['chatInternalMessage:','save','remove','update','emit','removeListener','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xac08,0x120));var _0x8ac0=function(_0x4d4945,_0x365e06){_0x4d4945=_0x4d4945-0x0;var _0x862f84=_0xac08[_0x4d4945];return _0x862f84;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x8ac0('0x0'),_0x8ac0('0x1'),_0x8ac0('0x2')];function createListener(_0x1e8d79,_0x38bac1){return function(_0x14f940){_0x38bac1[_0x8ac0('0x3')](_0x1e8d79,_0x14f940);};}function removeListener(_0x30486d,_0x4d811b){return function(){ChatInternalMessageEvents[_0x8ac0('0x4')](_0x30486d,_0x4d811b);};}exports[_0x8ac0('0x5')]=function(_0x30e984){for(var _0x5e8437=0x0,_0x4d93f5=events['length'];_0x5e8437<_0x4d93f5;_0x5e8437++){var _0x1b3954=events[_0x5e8437];var _0x2a9853=createListener(_0x8ac0('0x6')+_0x1b3954,_0x30e984);ChatInternalMessageEvents['on'](_0x1b3954,_0x2a9853);}}; \ No newline at end of file +var _0xd592=['removeListener','register','length','chatInternalMessage:','save','emit'];(function(_0x1488e0,_0x6fb240){var _0x251ce3=function(_0x603657){while(--_0x603657){_0x1488e0['push'](_0x1488e0['shift']());}};_0x251ce3(++_0x6fb240);}(_0xd592,0x124));var _0x2d59=function(_0x140a11,_0x1761cf){_0x140a11=_0x140a11-0x0;var _0x4199ab=_0xd592[_0x140a11];return _0x4199ab;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x2d59('0x0'),'remove','update'];function createListener(_0x56fc2d,_0x2c961c){return function(_0x230aba){_0x2c961c[_0x2d59('0x1')](_0x56fc2d,_0x230aba);};}function removeListener(_0x311f1e,_0x2ed816){return function(){ChatInternalMessageEvents[_0x2d59('0x2')](_0x311f1e,_0x2ed816);};}exports[_0x2d59('0x3')]=function(_0x541462){for(var _0x5161e7=0x0,_0x5b8d18=events[_0x2d59('0x4')];_0x5161e7<_0x5b8d18;_0x5161e7++){var _0x580805=events[_0x5161e7];var _0x1fce75=createListener(_0x2d59('0x5')+_0x580805,_0x541462);ChatInternalMessageEvents['on'](_0x580805,_0x1fce75);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 9d997f7..cf2b537 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 _0x9ea7=['../../components/interaction/service','./chatInternalMessage.controller','get','isAuthenticated','describe','/users','/:id','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x674c80,_0x47377f){var _0x4c2cbd=function(_0xc177fe){while(--_0xc177fe){_0x674c80['push'](_0x674c80['shift']());}};_0x4c2cbd(++_0x47377f);}(_0x9ea7,0x175));var _0x79ea=function(_0x187718,_0x427383){_0x187718=_0x187718-0x0;var _0x29ddf4=_0x9ea7[_0x187718];return _0x29ddf4;};'use strict';var multer=require(_0x79ea('0x0'));var util=require(_0x79ea('0x1'));var path=require(_0x79ea('0x2'));var timeout=require(_0x79ea('0x3'));var express=require(_0x79ea('0x4'));var router=express['Router']();var fs_extra=require(_0x79ea('0x5'));var auth=require(_0x79ea('0x6'));var interaction=require(_0x79ea('0x7'));var config=require('../../config/environment');var controller=require(_0x79ea('0x8'));router[_0x79ea('0x9')]('/',auth[_0x79ea('0xa')](),controller['index']);router[_0x79ea('0x9')]('/describe',auth[_0x79ea('0xa')](),controller[_0x79ea('0xb')]);router[_0x79ea('0x9')](_0x79ea('0xc'),auth[_0x79ea('0xa')](),controller['getUsers']);router['get'](_0x79ea('0xd'),auth[_0x79ea('0xa')](),controller['show']);router[_0x79ea('0xe')]('/',auth[_0x79ea('0xa')](),controller[_0x79ea('0xf')]);router[_0x79ea('0x10')]('/:id',controller[_0x79ea('0x11')]);router['delete'](_0x79ea('0xd'),auth['isAuthenticated'](),controller[_0x79ea('0x12')]);module[_0x79ea('0x13')]=router; \ No newline at end of file +var _0x2c41=['show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','describe','/users','getUsers','/:id'];(function(_0x1546ad,_0x180d27){var _0x100a7c=function(_0x21cb1b){while(--_0x21cb1b){_0x1546ad['push'](_0x1546ad['shift']());}};_0x100a7c(++_0x180d27);}(_0x2c41,0x1eb));var _0x12c4=function(_0x3b6648,_0x2d723a){_0x3b6648=_0x3b6648-0x0;var _0x5a0a0d=_0x2c41[_0x3b6648];return _0x5a0a0d;};'use strict';var multer=require(_0x12c4('0x0'));var util=require(_0x12c4('0x1'));var path=require(_0x12c4('0x2'));var timeout=require(_0x12c4('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x12c4('0x4'));var interaction=require(_0x12c4('0x5'));var config=require(_0x12c4('0x6'));var controller=require(_0x12c4('0x7'));router[_0x12c4('0x8')]('/',auth[_0x12c4('0x9')](),controller['index']);router[_0x12c4('0x8')](_0x12c4('0xa'),auth[_0x12c4('0x9')](),controller[_0x12c4('0xb')]);router[_0x12c4('0x8')](_0x12c4('0xc'),auth[_0x12c4('0x9')](),controller[_0x12c4('0xd')]);router[_0x12c4('0x8')](_0x12c4('0xe'),auth['isAuthenticated'](),controller[_0x12c4('0xf')]);router[_0x12c4('0x10')]('/',auth[_0x12c4('0x9')](),controller['create']);router[_0x12c4('0x11')]('/:id',controller[_0x12c4('0x12')]);router[_0x12c4('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x12c4('0x14')]);module[_0x12c4('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index ad59a4a..1e140b4 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 _0x0fd9=['DATE','STRING','exports','TEXT','medium','BOOLEAN','out'];(function(_0x152bc1,_0x1d857c){var _0x3a84f5=function(_0x18e472){while(--_0x18e472){_0x152bc1['push'](_0x152bc1['shift']());}};_0x3a84f5(++_0x1d857c);}(_0x0fd9,0xa3));var _0x90fd=function(_0x5a79e2,_0x319b1a){_0x5a79e2=_0x5a79e2-0x0;var _0x266c45=_0x0fd9[_0x5a79e2];return _0x266c45;};'use strict';var Sequelize=require('sequelize');module[_0x90fd('0x0')]={'body':{'type':Sequelize[_0x90fd('0x1')](_0x90fd('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x90fd('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x90fd('0x4')),'defaultValue':_0x90fd('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x90fd('0x5')]},'providerName':{'type':Sequelize[_0x90fd('0x6')]},'providerResponse':{'type':Sequelize[_0x90fd('0x1')]}}; \ No newline at end of file +var _0xf3e2=['sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x5937b8,_0x1c642f){var _0xfa1285=function(_0x433224){while(--_0x433224){_0x5937b8['push'](_0x5937b8['shift']());}};_0xfa1285(++_0x1c642f);}(_0xf3e2,0x168));var _0x2f3e=function(_0x397843,_0xa7173e){_0x397843=_0x397843-0x0;var _0x2ba028=_0xf3e2[_0x397843];return _0x2ba028;};'use strict';var Sequelize=require(_0x2f3e('0x0'));module[_0x2f3e('0x1')]={'body':{'type':Sequelize[_0x2f3e('0x2')](_0x2f3e('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x2f3e('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x2f3e('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2f3e('0x5')]('in',_0x2f3e('0x6')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x2f3e('0x7')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x2f3e('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index afdc854..78fcce2 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 _0xa0aa=['stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','show','params','keys','find','create','body','update','destroy','describe','chat-interactions','accept','chat','read','readAt','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','User','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','parse','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','sequelize','contact','interface','rejectmessage','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','then','end'];(function(_0x4b688f,_0x4c60e6){var _0x5cfad2=function(_0x582e2b){while(--_0x582e2b){_0x4b688f['push'](_0x4b688f['shift']());}};_0x5cfad2(++_0x4c60e6);}(_0xa0aa,0xda));var _0xaa0a=function(_0x247e37,_0x248605){_0x247e37=_0x247e37-0x0;var _0x5140d4=_0xa0aa[_0x247e37];return _0x5140d4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaa0a('0x0'));var zipdir=require(_0xaa0a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaa0a('0x2'));var moment=require(_0xaa0a('0x3'));var BPromise=require(_0xaa0a('0x4'));var Mustache=require(_0xaa0a('0x5'));var util=require('util');var path=require(_0xaa0a('0x6'));var sox=require(_0xaa0a('0x7'));var csv=require('to-csv');var ejs=require(_0xaa0a('0x8'));var fs=require('fs');var fs_extra=require(_0xaa0a('0x9'));var _=require('lodash');var squel=require(_0xaa0a('0xa'));var crypto=require(_0xaa0a('0xb'));var jsforce=require(_0xaa0a('0xc'));var deskjs=require(_0xaa0a('0xd'));var toCsv=require('to-csv');var querystring=require(_0xaa0a('0xe'));var Papa=require(_0xaa0a('0xf'));var Redis=require('ioredis');var authService=require(_0xaa0a('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa0a('0x11'));var logger=require(_0xaa0a('0x12'))(_0xaa0a('0x13'));var utils=require(_0xaa0a('0x14'));var config=require(_0xaa0a('0x15'));var licenseUtil=require(_0xaa0a('0x16'));var db=require(_0xaa0a('0x17'))['db'];config[_0xaa0a('0x18')]=_[_0xaa0a('0x19')](config[_0xaa0a('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xaa0a('0x1a'))(new Redis(config[_0xaa0a('0x18')]));require(_0xaa0a('0x1b'))[_0xaa0a('0x1c')](socket);var jayson=require(_0xaa0a('0x1d'));var client=jayson[_0xaa0a('0x1e')][_0xaa0a('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0xaa0a('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x3a3ff1,_0x23fe10,_0xc6611e,_0x20f427){return new BPromise(function(_0x240757,_0x567f65){var _0x101a76=_0x20f427||client;return _0x101a76[_0xaa0a('0x20')](_0x3a3ff1,_0xc6611e)['then'](function(_0x1f5fe0){logger[_0xaa0a('0x21')](_0xaa0a('0x22'),_0x23fe10,'request\x20sent');logger[_0xaa0a('0x23')](_0xaa0a('0x24'),_0x23fe10,_0xaa0a('0x25'),JSON[_0xaa0a('0x26')](_0x1f5fe0));if(_0x1f5fe0[_0xaa0a('0x27')]){if(_0x1f5fe0[_0xaa0a('0x27')][_0xaa0a('0x28')]===0x1f4){logger[_0xaa0a('0x27')]('ChatMessage,\x20%s,\x20%s',_0x23fe10,_0x1f5fe0[_0xaa0a('0x27')]['message']);return _0x567f65(_0x1f5fe0[_0xaa0a('0x27')][_0xaa0a('0x29')]);}logger[_0xaa0a('0x27')](_0xaa0a('0x22'),_0x23fe10,_0x1f5fe0['error'][_0xaa0a('0x29')]);return _0x240757(_0x1f5fe0[_0xaa0a('0x27')][_0xaa0a('0x29')]);}else{logger['info'](_0xaa0a('0x22'),_0x23fe10,_0xaa0a('0x25'));_0x240757(_0x1f5fe0[_0xaa0a('0x2a')][_0xaa0a('0x29')]);}})[_0xaa0a('0x2b')](function(_0x4d3bc6){logger[_0xaa0a('0x27')](_0xaa0a('0x22'),_0x23fe10,_0x4d3bc6);_0x567f65(_0x4d3bc6);});});}function respondWithStatusCode(_0x38b7be,_0x2b7c4b){_0x2b7c4b=_0x2b7c4b||0xcc;return function(_0x92c8d5){if(_0x92c8d5){return _0x38b7be[_0xaa0a('0x2c')](_0x2b7c4b);}return _0x38b7be[_0xaa0a('0x2d')](_0x2b7c4b)['end']();};}function respondWithResult(_0xfef109,_0x224fb1){_0x224fb1=_0x224fb1||0xc8;return function(_0x4698d3){if(_0x4698d3){return _0xfef109[_0xaa0a('0x2d')](_0x224fb1)[_0xaa0a('0x2e')](_0x4698d3);}};}function respondWithFilteredResult(_0x729905,_0x57f669){return function(_0x156533){if(_0x156533){var _0x118d7f=typeof _0x57f669['offset']==='undefined'&&typeof _0x57f669[_0xaa0a('0x2f')]===_0xaa0a('0x30');var _0x540e83=_0x156533['count'];var _0x263c4f=_0x118d7f?0x0:_0x57f669[_0xaa0a('0x31')];var _0x144f2e=_0x118d7f?_0x156533[_0xaa0a('0x32')]:_0x57f669[_0xaa0a('0x31')]+_0x57f669[_0xaa0a('0x2f')];var _0x3b314e;if(_0x144f2e>=_0x540e83){_0x144f2e=_0x540e83;_0x3b314e=0xc8;}else{_0x3b314e=0xce;}_0x729905[_0xaa0a('0x2d')](_0x3b314e);return _0x729905[_0xaa0a('0x33')](_0xaa0a('0x34'),_0x263c4f+'-'+_0x144f2e+'/'+_0x540e83)[_0xaa0a('0x2e')](_0x156533);}return null;};}function patchUpdates(_0x10264a){return function(_0x42b979){try{jsonpatch[_0xaa0a('0x35')](_0x42b979,_0x10264a,!![]);}catch(_0x425dbc){return BPromise[_0xaa0a('0x36')](_0x425dbc);}return _0x42b979[_0xaa0a('0x37')]();};}function saveUpdates(_0x1e9c8e,_0x38db0f){return function(_0x4cbc42){if(_0x4cbc42){return _0x4cbc42['update'](_0x1e9c8e)[_0xaa0a('0x38')](function(_0x32691f){return _0x32691f;});}return null;};}function removeEntity(_0x1f76ab,_0x4444b5){return function(_0x30352d){if(_0x30352d){return _0x30352d['destroy']()[_0xaa0a('0x38')](function(){_0x1f76ab['status'](0xcc)[_0xaa0a('0x39')]();});}};}function handleEntityNotFound(_0xfbdaf4,_0x20cfa9){return function(_0x4debfd){if(!_0x4debfd){_0xfbdaf4[_0xaa0a('0x2c')](0x194);}return _0x4debfd;};}function handleError(_0x2e3852,_0x2e9382){_0x2e9382=_0x2e9382||0x1f4;return function(_0x41bd2c){logger[_0xaa0a('0x27')](_0x41bd2c[_0xaa0a('0x3a')]);if(_0x41bd2c[_0xaa0a('0x3b')]){delete _0x41bd2c['name'];}_0x2e3852['status'](_0x2e9382)[_0xaa0a('0x3c')](_0x41bd2c);};}exports[_0xaa0a('0x3d')]=function(_0x57d27e,_0x1e9d72){var _0x347277={},_0x3d3695={},_0x4da6e8={'count':0x0,'rows':[]};var _0x1c0b88=_[_0xaa0a('0x3e')](db[_0xaa0a('0x3f')][_0xaa0a('0x40')],function(_0x2d51d8){return{'name':_0x2d51d8[_0xaa0a('0x41')],'type':_0x2d51d8[_0xaa0a('0x42')][_0xaa0a('0x43')]};});_0x3d3695[_0xaa0a('0x44')]=_[_0xaa0a('0x3e')](_0x1c0b88,_0xaa0a('0x3b'));_0x3d3695[_0xaa0a('0x45')]=_['keys'](_0x57d27e[_0xaa0a('0x45')]);_0x3d3695[_0xaa0a('0x46')]=_[_0xaa0a('0x47')](_0x3d3695[_0xaa0a('0x44')],_0x3d3695[_0xaa0a('0x45')]);_0x347277['attributes']=_[_0xaa0a('0x47')](_0x3d3695['model'],qs[_0xaa0a('0x48')](_0x57d27e[_0xaa0a('0x45')][_0xaa0a('0x48')]));_0x347277[_0xaa0a('0x49')]=_0x347277['attributes'][_0xaa0a('0x4a')]?_0x347277[_0xaa0a('0x49')]:_0x3d3695[_0xaa0a('0x44')];if(!_0x57d27e[_0xaa0a('0x45')]['hasOwnProperty'](_0xaa0a('0x4b'))){_0x347277[_0xaa0a('0x2f')]=qs[_0xaa0a('0x2f')](_0x57d27e[_0xaa0a('0x45')][_0xaa0a('0x2f')]);_0x347277[_0xaa0a('0x31')]=qs[_0xaa0a('0x31')](_0x57d27e['query'][_0xaa0a('0x31')]);}_0x347277[_0xaa0a('0x4c')]=qs[_0xaa0a('0x4d')](_0x57d27e[_0xaa0a('0x45')][_0xaa0a('0x4d')]);_0x347277[_0xaa0a('0x4e')]=qs[_0xaa0a('0x46')](_[_0xaa0a('0x4f')](_0x57d27e[_0xaa0a('0x45')],_0x3d3695[_0xaa0a('0x46')]),_0x1c0b88);if(_0x57d27e[_0xaa0a('0x45')][_0xaa0a('0x50')]){_0x347277[_0xaa0a('0x4e')]=_[_0xaa0a('0x51')](_0x347277['where'],{'$or':_[_0xaa0a('0x3e')](_0x1c0b88,function(_0x5d8c9f){if(_0x5d8c9f[_0xaa0a('0x42')]!=='VIRTUAL'){var _0x407545={};_0x407545[_0x5d8c9f[_0xaa0a('0x3b')]]={'$like':'%'+_0x57d27e[_0xaa0a('0x45')]['filter']+'%'};return _0x407545;}})});}_0x347277=_[_0xaa0a('0x51')]({},_0x347277,_0x57d27e[_0xaa0a('0x52')]);var _0x279972={'where':_0x347277['where']};return db[_0xaa0a('0x3f')][_0xaa0a('0x32')](_0x279972)[_0xaa0a('0x38')](function(_0x35d23c){_0x4da6e8[_0xaa0a('0x32')]=_0x35d23c;if(_0x57d27e[_0xaa0a('0x45')][_0xaa0a('0x53')]){_0x347277[_0xaa0a('0x54')]=[{'all':!![]}];}return db[_0xaa0a('0x3f')]['findAll'](_0x347277);})[_0xaa0a('0x38')](function(_0x3c7358){_0x4da6e8[_0xaa0a('0x55')]=_0x3c7358;return _0x4da6e8;})[_0xaa0a('0x38')](respondWithFilteredResult(_0x1e9d72,_0x347277))['catch'](handleError(_0x1e9d72,null));};exports[_0xaa0a('0x56')]=function(_0x51a729,_0x34ad56){var _0x47ad50={'raw':!![],'where':{'id':_0x51a729[_0xaa0a('0x57')]['id']}},_0xd6325a={};_0xd6325a[_0xaa0a('0x44')]=_[_0xaa0a('0x58')](db[_0xaa0a('0x3f')][_0xaa0a('0x40')]);_0xd6325a[_0xaa0a('0x45')]=_[_0xaa0a('0x58')](_0x51a729[_0xaa0a('0x45')]);_0xd6325a[_0xaa0a('0x46')]=_[_0xaa0a('0x47')](_0xd6325a[_0xaa0a('0x44')],_0xd6325a[_0xaa0a('0x45')]);_0x47ad50[_0xaa0a('0x49')]=_[_0xaa0a('0x47')](_0xd6325a[_0xaa0a('0x44')],qs[_0xaa0a('0x48')](_0x51a729[_0xaa0a('0x45')][_0xaa0a('0x48')]));_0x47ad50['attributes']=_0x47ad50[_0xaa0a('0x49')][_0xaa0a('0x4a')]?_0x47ad50[_0xaa0a('0x49')]:_0xd6325a[_0xaa0a('0x44')];if(_0x51a729[_0xaa0a('0x45')][_0xaa0a('0x53')]){_0x47ad50[_0xaa0a('0x54')]=[{'all':!![]}];}_0x47ad50=_['merge']({},_0x47ad50,_0x51a729['options']);return db[_0xaa0a('0x3f')][_0xaa0a('0x59')](_0x47ad50)['then'](handleEntityNotFound(_0x34ad56,null))[_0xaa0a('0x38')](respondWithResult(_0x34ad56,null))['catch'](handleError(_0x34ad56,null));};exports['create']=function(_0x4a1588,_0x1664fa){return db['ChatMessage'][_0xaa0a('0x5a')](_0x4a1588[_0xaa0a('0x5b')],{})[_0xaa0a('0x38')](respondWithResult(_0x1664fa,0xc9))[_0xaa0a('0x2b')](handleError(_0x1664fa,null));};exports[_0xaa0a('0x5c')]=function(_0x58f2a9,_0x4b90e2){if(_0x58f2a9[_0xaa0a('0x5b')]['id']){delete _0x58f2a9['body']['id'];}return db[_0xaa0a('0x3f')][_0xaa0a('0x59')]({'where':{'id':_0x58f2a9[_0xaa0a('0x57')]['id']}})['then'](handleEntityNotFound(_0x4b90e2,null))[_0xaa0a('0x38')](saveUpdates(_0x58f2a9['body'],null))[_0xaa0a('0x38')](respondWithResult(_0x4b90e2,null))[_0xaa0a('0x2b')](handleError(_0x4b90e2,null));};exports[_0xaa0a('0x5d')]=function(_0x4dbfec,_0x3d4785){return db[_0xaa0a('0x3f')][_0xaa0a('0x59')]({'where':{'id':_0x4dbfec[_0xaa0a('0x57')]['id']}})[_0xaa0a('0x38')](handleEntityNotFound(_0x3d4785,null))[_0xaa0a('0x38')](removeEntity(_0x3d4785,null))['catch'](handleError(_0x3d4785,null));};exports[_0xaa0a('0x5e')]=function(_0xfe346a,_0x260183){return db[_0xaa0a('0x3f')][_0xaa0a('0x5e')]()[_0xaa0a('0x38')](respondWithResult(_0x260183,null))['catch'](handleError(_0x260183,null));};var interaction_log=require(_0xaa0a('0x12'))(_0xaa0a('0x5f'));exports[_0xaa0a('0x60')]=function(_0x11666b,_0x2b88fb,_0x47c6a8){var _0x239546={'agent':{},'channel':_0xaa0a('0x61')};if(_0x11666b['body']['id']){delete _0x11666b[_0xaa0a('0x5b')]['id'];}_0x11666b[_0xaa0a('0x5b')][_0xaa0a('0x62')]=!![];_0x11666b[_0xaa0a('0x5b')][_0xaa0a('0x63')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x11666b[_0xaa0a('0x5b')][_0xaa0a('0x64')]=_0x11666b[_0xaa0a('0x5b')][_0xaa0a('0x64')]||_0x11666b[_0xaa0a('0x65')]['id'];_0x239546[_0xaa0a('0x66')]['id']=_0x11666b['body'][_0xaa0a('0x64')];return db[_0xaa0a('0x3f')][_0xaa0a('0x59')]({'where':{'id':_0x11666b['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2b88fb,null))[_0xaa0a('0x38')](saveUpdates(_0x11666b[_0xaa0a('0x5b')],null))['then'](function(_0x4fee6c){if(_0x4fee6c){_0x239546[_0xaa0a('0x29')]=_0x4fee6c[_0xaa0a('0x67')]({'plain':!![]});return db[_0xaa0a('0x68')][_0xaa0a('0x59')]({'where':{'id':_0x4fee6c[_0xaa0a('0x69')]}});}return null;})[_0xaa0a('0x38')](handleEntityNotFound(_0x2b88fb,null))['then'](function(_0x4cf807){if(_0x4cf807){return _0x4cf807[_0xaa0a('0x5c')]({'UserId':_0x11666b[_0xaa0a('0x5b')]['UserId'],'read1stAt':_[_0xaa0a('0x6a')](_0x4cf807[_0xaa0a('0x6b')])?moment()[_0xaa0a('0x6c')](_0xaa0a('0x6d')):undefined});}return null;})[_0xaa0a('0x38')](function(_0x4848ad){if(_0x4848ad){_0x239546[_0xaa0a('0x6e')]=_0x4848ad[_0xaa0a('0x67')]({'plain':!![]});interaction_log[_0xaa0a('0x21')](_0xaa0a('0x6f'),_0x11666b[_0xaa0a('0x65')]['id'],_0x11666b[_0xaa0a('0x65')][_0xaa0a('0x3b')],_0x11666b[_0xaa0a('0x65')]['role'],_0x239546['interaction']['id'],_0x11666b[_0xaa0a('0x5b')]?JSON[_0xaa0a('0x26')](_0x11666b[_0xaa0a('0x5b')]):_0xaa0a('0x70'));return respondWithRpcPromise(_0xaa0a('0x71'),_0xaa0a('0x72'),_0x239546);}return null;})[_0xaa0a('0x38')](function(_0x2b2f2b){var _0x249f45=_0xaa0a('0x73')+_0x2b2f2b[_0xaa0a('0x29')][_0xaa0a('0x74')];return db['sequelize'][_0xaa0a('0x45')](_0x249f45,{'type':db[_0xaa0a('0x75')][_0xaa0a('0x76')][_0xaa0a('0x77')],'raw':!![]})[_0xaa0a('0x38')](function(_0x3c91a4){return _0x3c91a4;});})[_0xaa0a('0x38')](function(_0xc519e8){if(_0xc519e8){_0x239546[_0xaa0a('0x29')]['contact']=_0xc519e8[0x0];if(!_0x11666b['body'][_0xaa0a('0x64')])return;return db[_0xaa0a('0x78')]['find']({'where':{'id':_0x11666b[_0xaa0a('0x5b')][_0xaa0a('0x64')],'role':_0xaa0a('0x66')},'attributes':['id','name','fullname',_0xaa0a('0x79'),_0xaa0a('0x7a')],'raw':!![]});}return null;})[_0xaa0a('0x38')](function(_0x4010c3){if(!_0x4010c3)return null;_0x239546['message'][_0xaa0a('0x66')]=_0x4010c3;return _0x239546;})[_0xaa0a('0x38')](function(_0x125ac5){if(_0x125ac5){if(_0x11666b[_0xaa0a('0x5b')][_0xaa0a('0x7b')]){_0x239546[_0xaa0a('0x29')]['interface']=util['format'](_0xaa0a('0x7c'),_0x11666b['user']['name']);_0x239546[_0xaa0a('0x29')]['channel']=_0x239546[_0xaa0a('0x7d')];_0x239546[_0xaa0a('0x29')][_0xaa0a('0x7e')]=_0x239546['channel'];_0x239546[_0xaa0a('0x29')][_0xaa0a('0x7f')]='accept';return respondWithRpcPromise(_0xaa0a('0x80'),_0xaa0a('0x80'),{'event':'acceptmessage','message':_['merge'](_0x239546[_0xaa0a('0x29')],JSON[_0xaa0a('0x81')](_0x239546['interaction'][_0xaa0a('0x82')]))},client9002)[_0xaa0a('0x38')](function(){return _0x239546;});}return _0x239546;}return null;})['then'](respondWithResult(_0x2b88fb,null))[_0xaa0a('0x2b')](handleError(_0x2b88fb,null));};var interaction_log=require(_0xaa0a('0x12'))('chat-interactions');exports['reject']=function(_0x1ec3ca,_0x366b76,_0x49f79c){var _0x20836d={'agent':{},'channel':_0xaa0a('0x61')};if(_0x1ec3ca[_0xaa0a('0x5b')]['id']){delete _0x1ec3ca[_0xaa0a('0x5b')]['id'];}_0x1ec3ca[_0xaa0a('0x5b')][_0xaa0a('0x64')]=_0x1ec3ca['body'][_0xaa0a('0x64')]||_0x1ec3ca[_0xaa0a('0x65')]['id'];_0x20836d[_0xaa0a('0x66')]['id']=_0x1ec3ca[_0xaa0a('0x5b')]['UserId'];return db[_0xaa0a('0x3f')][_0xaa0a('0x59')]({'where':{'id':_0x1ec3ca[_0xaa0a('0x57')]['id'],'UserId':null}})[_0xaa0a('0x38')](handleEntityNotFound(_0x366b76,null))[_0xaa0a('0x38')](function(_0x2e6ce9){if(_0x2e6ce9){_0x20836d[_0xaa0a('0x29')]=_0x2e6ce9[_0xaa0a('0x67')]({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x2e6ce9['ChatInteractionId']}});}return null;})[_0xaa0a('0x38')](handleEntityNotFound(_0x366b76,null))[_0xaa0a('0x38')](function(_0x475057){if(_0x475057){_0x20836d[_0xaa0a('0x6e')]=_0x475057[_0xaa0a('0x67')]({'plain':!![]});interaction_log['info'](_0xaa0a('0x83'),_0x1ec3ca[_0xaa0a('0x65')]['id'],_0x1ec3ca[_0xaa0a('0x65')]['name'],_0x1ec3ca[_0xaa0a('0x65')][_0xaa0a('0x84')],_0x20836d[_0xaa0a('0x6e')]['id'],_0x1ec3ca[_0xaa0a('0x5b')]?JSON[_0xaa0a('0x26')](_0x1ec3ca[_0xaa0a('0x5b')]):_0xaa0a('0x70'));return respondWithRpcPromise(_0xaa0a('0x85'),'rejectMessage',_0x20836d);}return null;})['then'](function(_0x253023){var _0xb627a7=_0xaa0a('0x73')+_0x253023['message']['ContactId'];return db[_0xaa0a('0x86')]['query'](_0xb627a7,{'type':db[_0xaa0a('0x75')][_0xaa0a('0x76')][_0xaa0a('0x77')],'raw':!![]})['then'](function(_0x5c2854){return _0x5c2854;});})[_0xaa0a('0x38')](function(_0x18a4f2){if(_0x18a4f2){_0x20836d[_0xaa0a('0x29')][_0xaa0a('0x87')]=_0x18a4f2[0x0];if(!_0x1ec3ca[_0xaa0a('0x5b')][_0xaa0a('0x64')])return;return db['User']['find']({'where':{'id':_0x1ec3ca[_0xaa0a('0x5b')][_0xaa0a('0x64')],'role':_0xaa0a('0x66')},'attributes':['id',_0xaa0a('0x3b'),'fullname',_0xaa0a('0x79'),_0xaa0a('0x7a')],'raw':!![]});}return null;})[_0xaa0a('0x38')](function(_0x53f3dc){if(!_0x53f3dc)return null;_0x20836d[_0xaa0a('0x29')]['agent']=_0x53f3dc;return _0x20836d;})['then'](function(_0x4ddb79){if(_0x4ddb79){_0x4ddb79[_0xaa0a('0x29')][_0xaa0a('0x88')]=util[_0xaa0a('0x6c')](_0xaa0a('0x7c'),_0x1ec3ca[_0xaa0a('0x65')][_0xaa0a('0x3b')]);_0x4ddb79[_0xaa0a('0x29')][_0xaa0a('0x7d')]=_0x20836d['channel'];_0x4ddb79[_0xaa0a('0x29')][_0xaa0a('0x7e')]=_0x20836d[_0xaa0a('0x7d')];_0x4ddb79[_0xaa0a('0x29')][_0xaa0a('0x7f')]=_0xaa0a('0x36');respondWithRpcPromise('EventManager','EventManager',{'event':_0xaa0a('0x89'),'message':_['merge'](_0x20836d[_0xaa0a('0x29')],JSON['parse'](_0x20836d[_0xaa0a('0x6e')][_0xaa0a('0x82')]))},client9002);return _0x20836d;}return null;})[_0xaa0a('0x38')](respondWithResult(_0x366b76,null))['catch'](handleError(_0x366b76,null));}; \ No newline at end of file +var _0xebcf=['lodash','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatMessage.socket','register','jayson/promise','http','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','where','pick','filter','merge','options','ChatMessage','then','includeAll','rows','catch','show','params','find','create','body','chat-interactions','chat','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','read1stAt','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','motionChannel','channel','event','accept','EventManager','parse','formData','../../config/logger','RejectMessage','sequelize','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0xebcf,0xf4));var _0xfebc=function(_0x4e04bc,_0x43bd78){_0x4e04bc=_0x4e04bc-0x0;var _0x29393d=_0xebcf[_0x4e04bc];return _0x29393d;};'use strict';var emlformat=require(_0xfebc('0x0'));var rimraf=require(_0xfebc('0x1'));var zipdir=require(_0xfebc('0x2'));var jsonpatch=require(_0xfebc('0x3'));var rp=require(_0xfebc('0x4'));var moment=require(_0xfebc('0x5'));var BPromise=require(_0xfebc('0x6'));var Mustache=require(_0xfebc('0x7'));var util=require(_0xfebc('0x8'));var path=require(_0xfebc('0x9'));var sox=require('sox');var csv=require(_0xfebc('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfebc('0xb'));var _=require(_0xfebc('0xc'));var squel=require('squel');var crypto=require(_0xfebc('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xfebc('0xe'));var toCsv=require(_0xfebc('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfebc('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xfebc('0x10'));var as=require(_0xfebc('0x11'));var hardwareService=require(_0xfebc('0x12'));var logger=require('../../config/logger')(_0xfebc('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfebc('0x14'));var db=require(_0xfebc('0x15'))['db'];config[_0xfebc('0x16')]=_[_0xfebc('0x17')](config[_0xfebc('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xfebc('0x18'))(new Redis(config['redis']));require(_0xfebc('0x19'))[_0xfebc('0x1a')](socket);var jayson=require(_0xfebc('0x1b'));var client=jayson['client'][_0xfebc('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0xfebc('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5d4435,_0x52d1d3,_0x5ace9a,_0x5423bc){return new BPromise(function(_0x20fcc5,_0x58baba){var _0x34488f=_0x5423bc||client;return _0x34488f[_0xfebc('0x1d')](_0x5d4435,_0x5ace9a)['then'](function(_0x402446){logger[_0xfebc('0x1e')](_0xfebc('0x1f'),_0x52d1d3,_0xfebc('0x20'));logger[_0xfebc('0x21')](_0xfebc('0x22'),_0x52d1d3,_0xfebc('0x20'),JSON[_0xfebc('0x23')](_0x402446));if(_0x402446[_0xfebc('0x24')]){if(_0x402446[_0xfebc('0x24')][_0xfebc('0x25')]===0x1f4){logger[_0xfebc('0x24')](_0xfebc('0x1f'),_0x52d1d3,_0x402446[_0xfebc('0x24')][_0xfebc('0x26')]);return _0x58baba(_0x402446[_0xfebc('0x24')]['message']);}logger[_0xfebc('0x24')](_0xfebc('0x1f'),_0x52d1d3,_0x402446['error']['message']);return _0x20fcc5(_0x402446[_0xfebc('0x24')]['message']);}else{logger[_0xfebc('0x1e')]('ChatMessage,\x20%s,\x20%s',_0x52d1d3,_0xfebc('0x20'));_0x20fcc5(_0x402446[_0xfebc('0x27')][_0xfebc('0x26')]);}})['catch'](function(_0x2d2d47){logger[_0xfebc('0x24')](_0xfebc('0x1f'),_0x52d1d3,_0x2d2d47);_0x58baba(_0x2d2d47);});});}function respondWithStatusCode(_0x1aa093,_0x442361){_0x442361=_0x442361||0xcc;return function(_0x392788){if(_0x392788){return _0x1aa093[_0xfebc('0x28')](_0x442361);}return _0x1aa093[_0xfebc('0x29')](_0x442361)[_0xfebc('0x2a')]();};}function respondWithResult(_0x402ee1,_0x594686){_0x594686=_0x594686||0xc8;return function(_0x30c8e6){if(_0x30c8e6){return _0x402ee1[_0xfebc('0x29')](_0x594686)[_0xfebc('0x2b')](_0x30c8e6);}};}function respondWithFilteredResult(_0x5775f3,_0x1b5f98){return function(_0x20c1cb){if(_0x20c1cb){var _0x1b4fc2=typeof _0x1b5f98['offset']==='undefined'&&typeof _0x1b5f98[_0xfebc('0x2c')]===_0xfebc('0x2d');var _0x2fed78=_0x20c1cb[_0xfebc('0x2e')];var _0x4f0380=_0x1b4fc2?0x0:_0x1b5f98[_0xfebc('0x2f')];var _0x4ea2f7=_0x1b4fc2?_0x20c1cb[_0xfebc('0x2e')]:_0x1b5f98['offset']+_0x1b5f98[_0xfebc('0x2c')];var _0x113f94;if(_0x4ea2f7>=_0x2fed78){_0x4ea2f7=_0x2fed78;_0x113f94=0xc8;}else{_0x113f94=0xce;}_0x5775f3[_0xfebc('0x29')](_0x113f94);return _0x5775f3['set'](_0xfebc('0x30'),_0x4f0380+'-'+_0x4ea2f7+'/'+_0x2fed78)[_0xfebc('0x2b')](_0x20c1cb);}return null;};}function patchUpdates(_0x1ad9bf){return function(_0xf51a24){try{jsonpatch[_0xfebc('0x31')](_0xf51a24,_0x1ad9bf,!![]);}catch(_0x553ed7){return BPromise[_0xfebc('0x32')](_0x553ed7);}return _0xf51a24[_0xfebc('0x33')]();};}function saveUpdates(_0x27d6bc,_0x3a7102){return function(_0x559a45){if(_0x559a45){return _0x559a45[_0xfebc('0x34')](_0x27d6bc)['then'](function(_0x57536c){return _0x57536c;});}return null;};}function removeEntity(_0x30f8bd,_0x4b34a8){return function(_0x14deee){if(_0x14deee){return _0x14deee[_0xfebc('0x35')]()['then'](function(){_0x30f8bd[_0xfebc('0x29')](0xcc)[_0xfebc('0x2a')]();});}};}function handleEntityNotFound(_0x277611,_0x5d7578){return function(_0x2ac3bc){if(!_0x2ac3bc){_0x277611[_0xfebc('0x28')](0x194);}return _0x2ac3bc;};}function handleError(_0x4c83f9,_0x37890f){_0x37890f=_0x37890f||0x1f4;return function(_0x1d09f9){logger[_0xfebc('0x24')](_0x1d09f9[_0xfebc('0x36')]);if(_0x1d09f9[_0xfebc('0x37')]){delete _0x1d09f9['name'];}_0x4c83f9[_0xfebc('0x29')](_0x37890f)[_0xfebc('0x38')](_0x1d09f9);};}exports[_0xfebc('0x39')]=function(_0x3790d0,_0x3e8c68){var _0x19275d={},_0x1516ae={},_0x65ff55={'count':0x0,'rows':[]};var _0x456ede=_[_0xfebc('0x3a')](db['ChatMessage'][_0xfebc('0x3b')],function(_0x29de79){return{'name':_0x29de79[_0xfebc('0x3c')],'type':_0x29de79[_0xfebc('0x3d')][_0xfebc('0x3e')]};});_0x1516ae[_0xfebc('0x3f')]=_['map'](_0x456ede,_0xfebc('0x37'));_0x1516ae[_0xfebc('0x40')]=_[_0xfebc('0x41')](_0x3790d0[_0xfebc('0x40')]);_0x1516ae[_0xfebc('0x42')]=_[_0xfebc('0x43')](_0x1516ae[_0xfebc('0x3f')],_0x1516ae[_0xfebc('0x40')]);_0x19275d[_0xfebc('0x44')]=_[_0xfebc('0x43')](_0x1516ae['model'],qs[_0xfebc('0x45')](_0x3790d0['query'][_0xfebc('0x45')]));_0x19275d[_0xfebc('0x44')]=_0x19275d['attributes'][_0xfebc('0x46')]?_0x19275d['attributes']:_0x1516ae[_0xfebc('0x3f')];if(!_0x3790d0[_0xfebc('0x40')]['hasOwnProperty'](_0xfebc('0x47'))){_0x19275d[_0xfebc('0x2c')]=qs[_0xfebc('0x2c')](_0x3790d0[_0xfebc('0x40')][_0xfebc('0x2c')]);_0x19275d[_0xfebc('0x2f')]=qs[_0xfebc('0x2f')](_0x3790d0[_0xfebc('0x40')][_0xfebc('0x2f')]);}_0x19275d['order']=qs['sort'](_0x3790d0[_0xfebc('0x40')]['sort']);_0x19275d[_0xfebc('0x48')]=qs[_0xfebc('0x42')](_[_0xfebc('0x49')](_0x3790d0[_0xfebc('0x40')],_0x1516ae[_0xfebc('0x42')]),_0x456ede);if(_0x3790d0[_0xfebc('0x40')]['filter']){_0x19275d[_0xfebc('0x48')]=_['merge'](_0x19275d[_0xfebc('0x48')],{'$or':_[_0xfebc('0x3a')](_0x456ede,function(_0x2b0d88){if(_0x2b0d88[_0xfebc('0x3d')]!=='VIRTUAL'){var _0x58b148={};_0x58b148[_0x2b0d88['name']]={'$like':'%'+_0x3790d0[_0xfebc('0x40')][_0xfebc('0x4a')]+'%'};return _0x58b148;}})});}_0x19275d=_[_0xfebc('0x4b')]({},_0x19275d,_0x3790d0[_0xfebc('0x4c')]);var _0x11409c={'where':_0x19275d['where']};return db[_0xfebc('0x4d')][_0xfebc('0x2e')](_0x11409c)[_0xfebc('0x4e')](function(_0x29be8e){_0x65ff55['count']=_0x29be8e;if(_0x3790d0[_0xfebc('0x40')][_0xfebc('0x4f')]){_0x19275d['include']=[{'all':!![]}];}return db[_0xfebc('0x4d')]['findAll'](_0x19275d);})[_0xfebc('0x4e')](function(_0x2056de){_0x65ff55[_0xfebc('0x50')]=_0x2056de;return _0x65ff55;})[_0xfebc('0x4e')](respondWithFilteredResult(_0x3e8c68,_0x19275d))[_0xfebc('0x51')](handleError(_0x3e8c68,null));};exports[_0xfebc('0x52')]=function(_0x28226f,_0x3100ab){var _0x20ffc6={'raw':!![],'where':{'id':_0x28226f[_0xfebc('0x53')]['id']}},_0x325ae7={};_0x325ae7[_0xfebc('0x3f')]=_['keys'](db['ChatMessage']['rawAttributes']);_0x325ae7[_0xfebc('0x40')]=_[_0xfebc('0x41')](_0x28226f[_0xfebc('0x40')]);_0x325ae7['filters']=_[_0xfebc('0x43')](_0x325ae7['model'],_0x325ae7[_0xfebc('0x40')]);_0x20ffc6[_0xfebc('0x44')]=_[_0xfebc('0x43')](_0x325ae7['model'],qs[_0xfebc('0x45')](_0x28226f[_0xfebc('0x40')][_0xfebc('0x45')]));_0x20ffc6['attributes']=_0x20ffc6[_0xfebc('0x44')][_0xfebc('0x46')]?_0x20ffc6[_0xfebc('0x44')]:_0x325ae7[_0xfebc('0x3f')];if(_0x28226f['query']['includeAll']){_0x20ffc6['include']=[{'all':!![]}];}_0x20ffc6=_[_0xfebc('0x4b')]({},_0x20ffc6,_0x28226f['options']);return db['ChatMessage'][_0xfebc('0x54')](_0x20ffc6)[_0xfebc('0x4e')](handleEntityNotFound(_0x3100ab,null))[_0xfebc('0x4e')](respondWithResult(_0x3100ab,null))[_0xfebc('0x51')](handleError(_0x3100ab,null));};exports[_0xfebc('0x55')]=function(_0x26fcc0,_0x3c16bb){return db[_0xfebc('0x4d')][_0xfebc('0x55')](_0x26fcc0[_0xfebc('0x56')],{})['then'](respondWithResult(_0x3c16bb,0xc9))['catch'](handleError(_0x3c16bb,null));};exports[_0xfebc('0x34')]=function(_0x2178cf,_0x46cfd0){if(_0x2178cf[_0xfebc('0x56')]['id']){delete _0x2178cf['body']['id'];}return db[_0xfebc('0x4d')][_0xfebc('0x54')]({'where':{'id':_0x2178cf[_0xfebc('0x53')]['id']}})['then'](handleEntityNotFound(_0x46cfd0,null))[_0xfebc('0x4e')](saveUpdates(_0x2178cf[_0xfebc('0x56')],null))[_0xfebc('0x4e')](respondWithResult(_0x46cfd0,null))[_0xfebc('0x51')](handleError(_0x46cfd0,null));};exports[_0xfebc('0x35')]=function(_0x21273d,_0x18adda){return db['ChatMessage']['find']({'where':{'id':_0x21273d[_0xfebc('0x53')]['id']}})[_0xfebc('0x4e')](handleEntityNotFound(_0x18adda,null))[_0xfebc('0x4e')](removeEntity(_0x18adda,null))[_0xfebc('0x51')](handleError(_0x18adda,null));};exports['describe']=function(_0x4fb401,_0x1b98db){return db[_0xfebc('0x4d')]['describe']()[_0xfebc('0x4e')](respondWithResult(_0x1b98db,null))[_0xfebc('0x51')](handleError(_0x1b98db,null));};var interaction_log=require('../../config/logger')(_0xfebc('0x57'));exports['accept']=function(_0x15e912,_0x35988e,_0x142c29){var _0x2b5bd2={'agent':{},'channel':_0xfebc('0x58')};if(_0x15e912[_0xfebc('0x56')]['id']){delete _0x15e912[_0xfebc('0x56')]['id'];}_0x15e912[_0xfebc('0x56')]['read']=!![];_0x15e912[_0xfebc('0x56')][_0xfebc('0x59')]=moment()['format'](_0xfebc('0x5a'));_0x15e912['body'][_0xfebc('0x5b')]=_0x15e912['body']['UserId']||_0x15e912[_0xfebc('0x5c')]['id'];_0x2b5bd2[_0xfebc('0x5d')]['id']=_0x15e912[_0xfebc('0x56')][_0xfebc('0x5b')];return db[_0xfebc('0x4d')][_0xfebc('0x54')]({'where':{'id':_0x15e912['params']['id'],'UserId':null}})[_0xfebc('0x4e')](handleEntityNotFound(_0x35988e,null))['then'](saveUpdates(_0x15e912[_0xfebc('0x56')],null))[_0xfebc('0x4e')](function(_0x5b69d8){if(_0x5b69d8){_0x2b5bd2[_0xfebc('0x26')]=_0x5b69d8[_0xfebc('0x5e')]({'plain':!![]});return db[_0xfebc('0x5f')][_0xfebc('0x54')]({'where':{'id':_0x5b69d8[_0xfebc('0x60')]}});}return null;})[_0xfebc('0x4e')](handleEntityNotFound(_0x35988e,null))[_0xfebc('0x4e')](function(_0x18f690){if(_0x18f690){return _0x18f690[_0xfebc('0x34')]({'UserId':_0x15e912[_0xfebc('0x56')][_0xfebc('0x5b')],'read1stAt':_['isNil'](_0x18f690[_0xfebc('0x61')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x547c09){if(_0x547c09){_0x2b5bd2['interaction']=_0x547c09[_0xfebc('0x5e')]({'plain':!![]});interaction_log[_0xfebc('0x1e')](_0xfebc('0x62'),_0x15e912[_0xfebc('0x5c')]['id'],_0x15e912[_0xfebc('0x5c')][_0xfebc('0x37')],_0x15e912[_0xfebc('0x5c')][_0xfebc('0x63')],_0x2b5bd2[_0xfebc('0x64')]['id'],_0x15e912[_0xfebc('0x56')]?JSON[_0xfebc('0x23')](_0x15e912[_0xfebc('0x56')]):_0xfebc('0x65'));return respondWithRpcPromise(_0xfebc('0x66'),_0xfebc('0x67'),_0x2b5bd2);}return null;})[_0xfebc('0x4e')](function(_0x5bd427){var _0x576cf2=_0xfebc('0x68')+_0x5bd427[_0xfebc('0x26')][_0xfebc('0x69')];return db['sequelize'][_0xfebc('0x40')](_0x576cf2,{'type':db[_0xfebc('0x6a')][_0xfebc('0x6b')][_0xfebc('0x6c')],'raw':!![]})[_0xfebc('0x4e')](function(_0x5712ee){return _0x5712ee;});})['then'](function(_0x30c348){if(_0x30c348){_0x2b5bd2[_0xfebc('0x26')][_0xfebc('0x6d')]=_0x30c348[0x0];if(!_0x15e912[_0xfebc('0x56')]['UserId'])return;return db[_0xfebc('0x6e')]['find']({'where':{'id':_0x15e912[_0xfebc('0x56')]['UserId'],'role':_0xfebc('0x5d')},'attributes':['id',_0xfebc('0x37'),_0xfebc('0x6f'),_0xfebc('0x70'),_0xfebc('0x71')],'raw':!![]});}return null;})[_0xfebc('0x4e')](function(_0x4188c9){if(!_0x4188c9)return null;_0x2b5bd2['message'][_0xfebc('0x5d')]=_0x4188c9;return _0x2b5bd2;})[_0xfebc('0x4e')](function(_0x1ebf53){if(_0x1ebf53){if(_0x15e912[_0xfebc('0x56')][_0xfebc('0x72')]){_0x2b5bd2[_0xfebc('0x26')][_0xfebc('0x73')]=util['format'](_0xfebc('0x74'),_0x15e912[_0xfebc('0x5c')][_0xfebc('0x37')]);_0x2b5bd2[_0xfebc('0x26')]['channel']=_0x2b5bd2['channel'];_0x2b5bd2['message'][_0xfebc('0x75')]=_0x2b5bd2[_0xfebc('0x76')];_0x2b5bd2[_0xfebc('0x26')][_0xfebc('0x77')]=_0xfebc('0x78');return respondWithRpcPromise(_0xfebc('0x79'),_0xfebc('0x79'),{'event':'acceptmessage','message':_[_0xfebc('0x4b')](_0x2b5bd2[_0xfebc('0x26')],JSON[_0xfebc('0x7a')](_0x2b5bd2[_0xfebc('0x64')][_0xfebc('0x7b')]))},client9002)[_0xfebc('0x4e')](function(){return _0x2b5bd2;});}return _0x2b5bd2;}return null;})[_0xfebc('0x4e')](respondWithResult(_0x35988e,null))[_0xfebc('0x51')](handleError(_0x35988e,null));};var interaction_log=require(_0xfebc('0x7c'))(_0xfebc('0x57'));exports[_0xfebc('0x32')]=function(_0x4e1a20,_0xbab2ab,_0x18462b){var _0x56b096={'agent':{},'channel':'chat'};if(_0x4e1a20[_0xfebc('0x56')]['id']){delete _0x4e1a20[_0xfebc('0x56')]['id'];}_0x4e1a20[_0xfebc('0x56')]['UserId']=_0x4e1a20[_0xfebc('0x56')][_0xfebc('0x5b')]||_0x4e1a20[_0xfebc('0x5c')]['id'];_0x56b096[_0xfebc('0x5d')]['id']=_0x4e1a20[_0xfebc('0x56')][_0xfebc('0x5b')];return db[_0xfebc('0x4d')][_0xfebc('0x54')]({'where':{'id':_0x4e1a20[_0xfebc('0x53')]['id'],'UserId':null}})[_0xfebc('0x4e')](handleEntityNotFound(_0xbab2ab,null))['then'](function(_0x1a38e2){if(_0x1a38e2){_0x56b096[_0xfebc('0x26')]=_0x1a38e2['get']({'plain':!![]});return db[_0xfebc('0x5f')][_0xfebc('0x54')]({'where':{'id':_0x1a38e2[_0xfebc('0x60')]}});}return null;})[_0xfebc('0x4e')](handleEntityNotFound(_0xbab2ab,null))[_0xfebc('0x4e')](function(_0x22c021){if(_0x22c021){_0x56b096[_0xfebc('0x64')]=_0x22c021[_0xfebc('0x5e')]({'plain':!![]});interaction_log[_0xfebc('0x1e')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4e1a20[_0xfebc('0x5c')]['id'],_0x4e1a20[_0xfebc('0x5c')][_0xfebc('0x37')],_0x4e1a20['user'][_0xfebc('0x63')],_0x56b096[_0xfebc('0x64')]['id'],_0x4e1a20[_0xfebc('0x56')]?JSON[_0xfebc('0x23')](_0x4e1a20[_0xfebc('0x56')]):'null');return respondWithRpcPromise(_0xfebc('0x7d'),'rejectMessage',_0x56b096);}return null;})[_0xfebc('0x4e')](function(_0x39b59d){var _0xe6c80c=_0xfebc('0x68')+_0x39b59d[_0xfebc('0x26')][_0xfebc('0x69')];return db[_0xfebc('0x7e')][_0xfebc('0x40')](_0xe6c80c,{'type':db['Sequelize'][_0xfebc('0x6b')][_0xfebc('0x6c')],'raw':!![]})['then'](function(_0x56c01b){return _0x56c01b;});})[_0xfebc('0x4e')](function(_0x26a4ea){if(_0x26a4ea){_0x56b096[_0xfebc('0x26')][_0xfebc('0x6d')]=_0x26a4ea[0x0];if(!_0x4e1a20[_0xfebc('0x56')][_0xfebc('0x5b')])return;return db[_0xfebc('0x6e')][_0xfebc('0x54')]({'where':{'id':_0x4e1a20[_0xfebc('0x56')][_0xfebc('0x5b')],'role':'agent'},'attributes':['id',_0xfebc('0x37'),_0xfebc('0x6f'),_0xfebc('0x70'),'internal'],'raw':!![]});}return null;})['then'](function(_0x34ada5){if(!_0x34ada5)return null;_0x56b096[_0xfebc('0x26')]['agent']=_0x34ada5;return _0x56b096;})[_0xfebc('0x4e')](function(_0x50343f){if(_0x50343f){_0x50343f['message'][_0xfebc('0x73')]=util[_0xfebc('0x7f')](_0xfebc('0x74'),_0x4e1a20[_0xfebc('0x5c')][_0xfebc('0x37')]);_0x50343f[_0xfebc('0x26')][_0xfebc('0x76')]=_0x56b096[_0xfebc('0x76')];_0x50343f['message']['motionChannel']=_0x56b096[_0xfebc('0x76')];_0x50343f[_0xfebc('0x26')][_0xfebc('0x77')]=_0xfebc('0x32');respondWithRpcPromise('EventManager',_0xfebc('0x79'),{'event':'rejectmessage','message':_[_0xfebc('0x4b')](_0x56b096[_0xfebc('0x26')],JSON[_0xfebc('0x7a')](_0x56b096[_0xfebc('0x64')][_0xfebc('0x7b')]))},client9002);return _0x56b096;}return null;})[_0xfebc('0x4e')](respondWithResult(_0xbab2ab,null))['catch'](handleError(_0xbab2ab,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 110cba4..b4d7389 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 _0x3222=['setMaxListeners','save','remove','emit','hook','exports','../../mysqldb','ChatMessage'];(function(_0x50a7c4,_0x582aca){var _0x17d784=function(_0x3f13f9){while(--_0x3f13f9){_0x50a7c4['push'](_0x50a7c4['shift']());}};_0x17d784(++_0x582aca);}(_0x3222,0x1d6));var _0x2322=function(_0x3a53fc,_0x129c9c){_0x3a53fc=_0x3a53fc-0x0;var _0x4b1200=_0x3222[_0x3a53fc];return _0x4b1200;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x2322('0x0'))['db'][_0x2322('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x2322('0x2')](0x0);var events={'afterCreate':_0x2322('0x3'),'afterUpdate':'update','afterDestroy':_0x2322('0x4')};function emitEvent(_0x2d1a91){return function(_0x11b8da,_0x246f30,_0x23b47b){ChatMessageEvents['emit'](_0x2d1a91+':'+_0x11b8da['id'],_0x11b8da);ChatMessageEvents[_0x2322('0x5')](_0x2d1a91,_0x11b8da);_0x23b47b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x2322('0x6')](e,emitEvent(event));}}module[_0x2322('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0x92de=['setMaxListeners','save','update','remove','emit','exports','events','../../mysqldb','ChatMessage'];(function(_0xd72bd2,_0x27d251){var _0x2dd884=function(_0x100525){while(--_0x100525){_0xd72bd2['push'](_0xd72bd2['shift']());}};_0x2dd884(++_0x27d251);}(_0x92de,0x8d));var _0xe92d=function(_0x4a4563,_0x2771c3){_0x4a4563=_0x4a4563-0x0;var _0x201be1=_0x92de[_0x4a4563];return _0x201be1;};'use strict';var EventEmitter=require(_0xe92d('0x0'));var ChatMessage=require(_0xe92d('0x1'))['db'][_0xe92d('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xe92d('0x3')](0x0);var events={'afterCreate':_0xe92d('0x4'),'afterUpdate':_0xe92d('0x5'),'afterDestroy':_0xe92d('0x6')};function emitEvent(_0x3a0dd9){return function(_0x398470,_0x43aa76,_0x9e063b){ChatMessageEvents['emit'](_0x3a0dd9+':'+_0x398470['id'],_0x398470);ChatMessageEvents[_0xe92d('0x7')](_0x3a0dd9,_0x398470);_0x9e063b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0xe92d('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 073657b..681c576 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 _0x7e32=['moment','bluebird','request-promise','path','../../config/environment','./chatMessage.attributes','exports','ChatMessage','fti_chat_messages','body','get','direction','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','toLowerCase','error','utf8mb4_unicode_ci','util','../../config/logger','api'];(function(_0x14f5fd,_0xa396f1){var _0x5d1a44=function(_0x4e75c9){while(--_0x4e75c9){_0x14f5fd['push'](_0x14f5fd['shift']());}};_0x5d1a44(++_0xa396f1);}(_0x7e32,0xf0));var _0x27e3=function(_0x65a690,_0x1f839f){_0x65a690=_0x65a690-0x0;var _0x311a37=_0x7e32[_0x65a690];return _0x311a37;};'use strict';var _=require('lodash');var util=require(_0x27e3('0x0'));var logger=require(_0x27e3('0x1'))(_0x27e3('0x2'));var moment=require(_0x27e3('0x3'));var BPromise=require(_0x27e3('0x4'));var rp=require(_0x27e3('0x5'));var fs=require('fs');var path=require(_0x27e3('0x6'));var rimraf=require('rimraf');var config=require(_0x27e3('0x7'));var attributes=require(_0x27e3('0x8'));module[_0x27e3('0x9')]=function(_0x4c4389,_0x52b810){return _0x4c4389['define'](_0x27e3('0xa'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x27e3('0xb'),'fields':[_0x27e3('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x498d7e,_0x131d03,_0x2c6ae7){var _0x576062=_0x4c4389['models'];var _0x19cabb=_0x498d7e[_0x27e3('0xd')]({'plain':!![]});if(_0x19cabb[_0x27e3('0xe')]['toLowerCase']()==='in'||_0x19cabb[_0x27e3('0xe')]['toLowerCase']()==='out'&&!_0x19cabb[_0x27e3('0xf')]&&!_[_0x27e3('0x10')](_0x19cabb[_0x27e3('0x11')])){_0x576062[_0x27e3('0x12')][_0x27e3('0x13')]({'where':{'id':_0x19cabb[_0x27e3('0x14')]}})[_0x27e3('0x15')](function(_0x1f0e0d){if(_0x1f0e0d){_0x1f0e0d[_0x27e3('0x16')]({'lastMsgAt':_0x19cabb[_0x27e3('0x17')],'lastMsgDirection':_0x19cabb[_0x27e3('0xe')][_0x27e3('0x18')]()});}})['catch'](function(_0x34e602){console[_0x27e3('0x19')](_0x34e602);});}_0x2c6ae7();}},'charset':'utf8mb4','collate':_0x27e3('0x1a')});}; \ No newline at end of file +var _0xc43d=['fti_chat_messages','body','models','toLowerCase','direction','secret','isNil','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./chatMessage.attributes','define','ChatMessage'];(function(_0x3e8bb8,_0x199d36){var _0x4860dd=function(_0x43f936){while(--_0x43f936){_0x3e8bb8['push'](_0x3e8bb8['shift']());}};_0x4860dd(++_0x199d36);}(_0xc43d,0xb2));var _0xdc43=function(_0x5f3de3,_0x40f0f5){_0x5f3de3=_0x5f3de3-0x0;var _0x287e0d=_0xc43d[_0x5f3de3];return _0x287e0d;};'use strict';var _=require(_0xdc43('0x0'));var util=require(_0xdc43('0x1'));var logger=require(_0xdc43('0x2'))('api');var moment=require(_0xdc43('0x3'));var BPromise=require(_0xdc43('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdc43('0x5'));var rimraf=require(_0xdc43('0x6'));var config=require(_0xdc43('0x7'));var attributes=require(_0xdc43('0x8'));module['exports']=function(_0x21c2d1,_0x100617){return _0x21c2d1[_0xdc43('0x9')](_0xdc43('0xa'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0xdc43('0xb'),'fields':[_0xdc43('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4d11b7,_0x1620a6,_0xd52f4c){var _0x2a7f43=_0x21c2d1[_0xdc43('0xd')];var _0x1cbbf5=_0x4d11b7['get']({'plain':!![]});if(_0x1cbbf5['direction'][_0xdc43('0xe')]()==='in'||_0x1cbbf5[_0xdc43('0xf')][_0xdc43('0xe')]()==='out'&&!_0x1cbbf5[_0xdc43('0x10')]&&!_[_0xdc43('0x11')](_0x1cbbf5['UserId'])){_0x2a7f43[_0xdc43('0x12')][_0xdc43('0x13')]({'where':{'id':_0x1cbbf5[_0xdc43('0x14')]}})[_0xdc43('0x15')](function(_0xf44528){if(_0xf44528){_0xf44528[_0xdc43('0x16')]({'lastMsgAt':_0x1cbbf5[_0xdc43('0x17')],'lastMsgDirection':_0x1cbbf5['direction']['toLowerCase']()});}})[_0xdc43('0x18')](function(_0x4a9ab3){console[_0xdc43('0x19')](_0x4a9ab3);});}_0xd52f4c();}},'charset':'utf8mb4','collate':_0xdc43('0x1a')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 70465fd..98d085a 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 _0xee7c=['error','code','message','catch','CreateChatMessage','create','body','options','raw','debug','util','moment','bluebird','../../mysqldb','../../config/logger','client','http','defaults','redis','localhost','socket.io-emitter','register','then','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5a4b42,_0x2b9c18){var _0x5e81d6=function(_0x595077){while(--_0x595077){_0x5a4b42['push'](_0x5a4b42['shift']());}};_0x5e81d6(++_0x2b9c18);}(_0xee7c,0x14e));var _0xcee7=function(_0x246272,_0xa8a84b){_0x246272=_0x246272-0x0;var _0x5a40d8=_0xee7c[_0x246272];return _0x5a40d8;};'use strict';var _=require('lodash');var util=require(_0xcee7('0x0'));var moment=require(_0xcee7('0x1'));var BPromise=require(_0xcee7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcee7('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xcee7('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcee7('0x5')][_0xcee7('0x6')]({'port':0x232a});config['redis']=_[_0xcee7('0x7')](config[_0xcee7('0x8')],{'host':_0xcee7('0x9'),'port':0x18eb});var socket=require(_0xcee7('0xa'))(new Redis(config[_0xcee7('0x8')]));require('./chatMessage.socket')[_0xcee7('0xb')](socket);function respondWithRpcPromise(_0x5227cb,_0xa43dc1,_0x132348){return new BPromise(function(_0x2bec80,_0x39e31c){return client['request'](_0x5227cb,_0x132348)[_0xcee7('0xc')](function(_0x566875){logger['info'](_0xcee7('0xd'),_0xa43dc1,_0xcee7('0xe'));logger['debug'](_0xcee7('0xf'),_0xa43dc1,_0xcee7('0xe'),JSON[_0xcee7('0x10')](_0x566875));if(_0x566875[_0xcee7('0x11')]){if(_0x566875[_0xcee7('0x11')][_0xcee7('0x12')]===0x1f4){logger[_0xcee7('0x11')]('ChatMessage,\x20%s,\x20%s',_0xa43dc1,_0x566875['error'][_0xcee7('0x13')]);return _0x39e31c(_0x566875[_0xcee7('0x11')][_0xcee7('0x13')]);}logger[_0xcee7('0x11')](_0xcee7('0xd'),_0xa43dc1,_0x566875[_0xcee7('0x11')]['message']);return _0x2bec80(_0x566875[_0xcee7('0x11')]['message']);}else{logger['info'](_0xcee7('0xd'),_0xa43dc1,_0xcee7('0xe'));_0x2bec80(_0x566875['result']['message']);}})[_0xcee7('0x14')](function(_0x14aac6){logger['error'](_0xcee7('0xd'),_0xa43dc1,_0x14aac6);_0x39e31c(_0x14aac6);});});}exports[_0xcee7('0x15')]=function(_0x2c8a67){var _0x5a668e=this;return new Promise(function(_0x4b07ce,_0x13200d){return db['ChatMessage'][_0xcee7('0x16')](_0x2c8a67[_0xcee7('0x17')],{'raw':_0x2c8a67[_0xcee7('0x18')]?_0x2c8a67[_0xcee7('0x18')][_0xcee7('0x19')]===undefined?!![]:![]:!![]})[_0xcee7('0xc')](function(_0x3e7749){logger['info'](_0xcee7('0x15'),_0x2c8a67);logger[_0xcee7('0x1a')](_0xcee7('0x15'),_0x2c8a67,JSON[_0xcee7('0x10')](_0x3e7749));_0x4b07ce(_0x3e7749);})[_0xcee7('0x14')](function(_0x40e492){logger[_0xcee7('0x11')](_0xcee7('0x15'),_0x40e492[_0xcee7('0x13')],_0x2c8a67);_0x13200d(_0x5a668e['error'](0x1f4,_0x40e492['message']));});});}; \ No newline at end of file +var _0x8c46=['then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','register','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateChatMessage','ChatMessage','create','body','options'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8c46,0x14e));var _0x68c4=function(_0x509f32,_0x1ddd4f){_0x509f32=_0x509f32-0x0;var _0x48be5c=_0x8c46[_0x509f32];return _0x48be5c;};'use strict';var _=require(_0x68c4('0x0'));var util=require(_0x68c4('0x1'));var moment=require(_0x68c4('0x2'));var BPromise=require(_0x68c4('0x3'));var rs=require(_0x68c4('0x4'));var fs=require('fs');var Redis=require(_0x68c4('0x5'));var db=require(_0x68c4('0x6'))['db'];var utils=require(_0x68c4('0x7'));var logger=require(_0x68c4('0x8'))(_0x68c4('0x9'));var config=require(_0x68c4('0xa'));var jayson=require(_0x68c4('0xb'));var client=jayson[_0x68c4('0xc')][_0x68c4('0xd')]({'port':0x232a});config['redis']=_[_0x68c4('0xe')](config[_0x68c4('0xf')],{'host':_0x68c4('0x10'),'port':0x18eb});var socket=require(_0x68c4('0x11'))(new Redis(config[_0x68c4('0xf')]));require(_0x68c4('0x12'))[_0x68c4('0x13')](socket);function respondWithRpcPromise(_0x11027e,_0x4ea614,_0x59d7e0){return new BPromise(function(_0x4a98d3,_0x538249){return client[_0x68c4('0x14')](_0x11027e,_0x59d7e0)['then'](function(_0x8794da){logger[_0x68c4('0x15')](_0x68c4('0x16'),_0x4ea614,_0x68c4('0x17'));logger[_0x68c4('0x18')](_0x68c4('0x19'),_0x4ea614,_0x68c4('0x17'),JSON[_0x68c4('0x1a')](_0x8794da));if(_0x8794da[_0x68c4('0x1b')]){if(_0x8794da['error'][_0x68c4('0x1c')]===0x1f4){logger['error'](_0x68c4('0x16'),_0x4ea614,_0x8794da[_0x68c4('0x1b')][_0x68c4('0x1d')]);return _0x538249(_0x8794da[_0x68c4('0x1b')][_0x68c4('0x1d')]);}logger[_0x68c4('0x1b')](_0x68c4('0x16'),_0x4ea614,_0x8794da[_0x68c4('0x1b')][_0x68c4('0x1d')]);return _0x4a98d3(_0x8794da[_0x68c4('0x1b')][_0x68c4('0x1d')]);}else{logger[_0x68c4('0x15')](_0x68c4('0x16'),_0x4ea614,_0x68c4('0x17'));_0x4a98d3(_0x8794da['result'][_0x68c4('0x1d')]);}})[_0x68c4('0x1e')](function(_0x5572c1){logger[_0x68c4('0x1b')](_0x68c4('0x16'),_0x4ea614,_0x5572c1);_0x538249(_0x5572c1);});});}exports[_0x68c4('0x1f')]=function(_0x5577d2){var _0x1986e9=this;return new Promise(function(_0x2fbb1f,_0x126346){return db[_0x68c4('0x20')][_0x68c4('0x21')](_0x5577d2[_0x68c4('0x22')],{'raw':_0x5577d2[_0x68c4('0x23')]?_0x5577d2['options']['raw']===undefined?!![]:![]:!![]})[_0x68c4('0x24')](function(_0x2f0908){logger['info'](_0x68c4('0x1f'),_0x5577d2);logger[_0x68c4('0x18')](_0x68c4('0x1f'),_0x5577d2,JSON['stringify'](_0x2f0908));_0x2fbb1f(_0x2f0908);})[_0x68c4('0x1e')](function(_0x130be5){logger[_0x68c4('0x1b')]('CreateChatMessage',_0x130be5['message'],_0x5577d2);_0x126346(_0x1986e9[_0x68c4('0x1b')](0x1f4,_0x130be5[_0x68c4('0x1d')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 1144cda..b416712 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 _0x5fd1=['update','emit','register','length','chatMessage:','./chatMessage.events','remove'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x5fd1,0x155));var _0x15fd=function(_0x643a8,_0x47161c){_0x643a8=_0x643a8-0x0;var _0x159201=_0x5fd1[_0x643a8];return _0x159201;};'use strict';var ChatMessageEvents=require(_0x15fd('0x0'));var events=['save',_0x15fd('0x1'),_0x15fd('0x2')];function createListener(_0x45bd54,_0x50fc5a){return function(_0x5d2d77){_0x50fc5a[_0x15fd('0x3')](_0x45bd54,_0x5d2d77);};}function removeListener(_0x3138f3,_0x411b0e){return function(){ChatMessageEvents['removeListener'](_0x3138f3,_0x411b0e);};}exports[_0x15fd('0x4')]=function(_0x386441){for(var _0x18450c=0x0,_0x2e88bf=events[_0x15fd('0x5')];_0x18450c<_0x2e88bf;_0x18450c++){var _0x534e63=events[_0x18450c];var _0x210e90=createListener(_0x15fd('0x6')+_0x534e63,_0x386441);ChatMessageEvents['on'](_0x534e63,_0x210e90);}}; \ No newline at end of file +var _0x2f2e=['emit','length','save','remove'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x2f2e,0x146));var _0xe2f2=function(_0x2ba9ac,_0xa1fdc4){_0x2ba9ac=_0x2ba9ac-0x0;var _0x1b0fc9=_0x2f2e[_0x2ba9ac];return _0x1b0fc9;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0xe2f2('0x0'),_0xe2f2('0x1'),'update'];function createListener(_0xc8150e,_0x5c1823){return function(_0x1d89ba){_0x5c1823[_0xe2f2('0x2')](_0xc8150e,_0x1d89ba);};}function removeListener(_0x2da048,_0x14543c){return function(){ChatMessageEvents['removeListener'](_0x2da048,_0x14543c);};}exports['register']=function(_0x5b202f){for(var _0x3dca30=0x0,_0x23f7a8=events[_0xe2f2('0x3')];_0x3dca30<_0x23f7a8;_0x3dca30++){var _0xc44c89=events[_0x3dca30];var _0x48111c=createListener('chatMessage:'+_0xc44c89,_0x5b202f);ChatMessageEvents['on'](_0xc44c89,_0x48111c);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index f84e40f..176df88 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 _0x9894=['/describe','describe','/:id','show','tracked','chatmessage:create','create','put','update','/:id/accept','accept','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index'];(function(_0x28b0a1,_0x99bd0a){var _0x21470c=function(_0x45bf01){while(--_0x45bf01){_0x28b0a1['push'](_0x28b0a1['shift']());}};_0x21470c(++_0x99bd0a);}(_0x9894,0xf7));var _0x4989=function(_0x315d5f,_0x4fc96f){_0x315d5f=_0x315d5f-0x0;var _0x12f7b4=_0x9894[_0x315d5f];return _0x12f7b4;};'use strict';var multer=require(_0x4989('0x0'));var util=require(_0x4989('0x1'));var path=require(_0x4989('0x2'));var timeout=require(_0x4989('0x3'));var express=require(_0x4989('0x4'));var router=express[_0x4989('0x5')]();var fs_extra=require(_0x4989('0x6'));var auth=require(_0x4989('0x7'));var interaction=require(_0x4989('0x8'));var config=require(_0x4989('0x9'));var controller=require(_0x4989('0xa'));router[_0x4989('0xb')]('/',auth[_0x4989('0xc')](),controller[_0x4989('0xd')]);router[_0x4989('0xb')](_0x4989('0xe'),auth[_0x4989('0xc')](),controller[_0x4989('0xf')]);router[_0x4989('0xb')](_0x4989('0x10'),auth[_0x4989('0xc')](),controller[_0x4989('0x11')]);router['post']('/',auth[_0x4989('0xc')](),interaction[_0x4989('0x12')]('chat',_0x4989('0x13')),controller[_0x4989('0x14')]);router[_0x4989('0x15')](_0x4989('0x10'),controller[_0x4989('0x16')]);router[_0x4989('0x15')](_0x4989('0x17'),auth[_0x4989('0xc')](),controller[_0x4989('0x18')]);router[_0x4989('0x15')]('/:id/reject',auth[_0x4989('0xc')](),controller[_0x4989('0x19')]);router[_0x4989('0x1a')](_0x4989('0x10'),auth['isAuthenticated'](),controller[_0x4989('0x1b')]);module[_0x4989('0x1c')]=router; \ No newline at end of file +var _0x89e1=['isAuthenticated','index','/describe','describe','/:id','show','tracked','chat','put','accept','/:id/reject','exports','path','connect-timeout','express','../../components/auth/service','../../config/environment','./chatMessage.controller','get'];(function(_0x2cc89a,_0x35191a){var _0x35d9b5=function(_0x40b8a9){while(--_0x40b8a9){_0x2cc89a['push'](_0x2cc89a['shift']());}};_0x35d9b5(++_0x35191a);}(_0x89e1,0x6b));var _0x189e=function(_0x166d42,_0x29db05){_0x166d42=_0x166d42-0x0;var _0x532395=_0x89e1[_0x166d42];return _0x532395;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x189e('0x0'));var timeout=require(_0x189e('0x1'));var express=require(_0x189e('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x189e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x189e('0x4'));var controller=require(_0x189e('0x5'));router[_0x189e('0x6')]('/',auth[_0x189e('0x7')](),controller[_0x189e('0x8')]);router[_0x189e('0x6')](_0x189e('0x9'),auth['isAuthenticated'](),controller[_0x189e('0xa')]);router[_0x189e('0x6')](_0x189e('0xb'),auth[_0x189e('0x7')](),controller[_0x189e('0xc')]);router['post']('/',auth[_0x189e('0x7')](),interaction[_0x189e('0xd')](_0x189e('0xe'),'chatmessage:create'),controller['create']);router[_0x189e('0xf')](_0x189e('0xb'),controller['update']);router[_0x189e('0xf')]('/:id/accept',auth[_0x189e('0x7')](),controller[_0x189e('0x10')]);router[_0x189e('0xf')](_0x189e('0x11'),auth[_0x189e('0x7')](),controller['reject']);router['delete'](_0x189e('0xb'),auth[_0x189e('0x7')](),controller['destroy']);module[_0x189e('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 95ac0e3..2058a1d 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 _0x5f66=['medium','TEXT','exports'];(function(_0x512bc1,_0x452372){var _0x5933b6=function(_0x7981c4){while(--_0x7981c4){_0x512bc1['push'](_0x512bc1['shift']());}};_0x5933b6(++_0x452372);}(_0x5f66,0x1a0));var _0x65f6=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x5f66[_0x164eca];return _0x2ce562;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x65f6('0x2')](_0x65f6('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0x0b0e=['medium','sequelize','TEXT'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x0b0e,0x187));var _0xe0b0=function(_0x40df5f,_0x8fd59f){_0x40df5f=_0x40df5f-0x0;var _0x1573f1=_0x0b0e[_0x40df5f];return _0x1573f1;};'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 diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 8abb980..d998be9 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(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x7a54,0x106));var _0x47a5=function(_0x1bfedb,_0x7634d3){_0x1bfedb=_0x1bfedb-0x0;var _0x1554ce=_0x7a54[_0x1bfedb];return _0x1554ce;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x7a54,0x106));var _0x47a5=function(_0x392557,_0x2a455e){_0x392557=_0x392557-0x0;var _0x405cbd=_0x7a54[_0x392557];return _0x405cbd;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 32c4d48..6ed3b7c 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 _0xdc3c=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xdc3c,0x147));var _0xcdc3=function(_0x49cd75,_0x1ed7a2){_0x49cd75=_0x49cd75-0x0;var _0x4d454d=_0xdc3c[_0x49cd75];return _0x4d454d;};'use strict';var EventEmitter=require(_0xcdc3('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xcdc3('0x1')](0x0);var events={'afterCreate':_0xcdc3('0x2'),'afterUpdate':_0xcdc3('0x3'),'afterDestroy':_0xcdc3('0x4')};function emitEvent(_0x346300){return function(_0x3631d6,_0x329daa,_0x1d771a){ChatOfflineMessageEvents[_0xcdc3('0x5')](_0x346300+':'+_0x3631d6['id'],_0x3631d6);ChatOfflineMessageEvents[_0xcdc3('0x5')](_0x346300,_0x3631d6);_0x1d771a(null);};}for(var e in events){if(events[_0xcdc3('0x6')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0xcdc3('0x7')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0xe740=['hook','exports','events','ChatOfflineMessage','setMaxListeners','update','emit'];(function(_0x3c487b,_0x44c5e2){var _0x1d65f6=function(_0x135e6d){while(--_0x135e6d){_0x3c487b['push'](_0x3c487b['shift']());}};_0x1d65f6(++_0x44c5e2);}(_0xe740,0x14b));var _0x0e74=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0xe740[_0x45b034];return _0x509cb0;};'use strict';var EventEmitter=require(_0x0e74('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0x0e74('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x0e74('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0e74('0x3'),'afterDestroy':'remove'};function emitEvent(_0x35bed6){return function(_0x5ed338,_0xe2aea7,_0x41795e){ChatOfflineMessageEvents['emit'](_0x35bed6+':'+_0x5ed338['id'],_0x5ed338);ChatOfflineMessageEvents[_0x0e74('0x4')](_0x35bed6,_0x5ed338);_0x41795e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0x0e74('0x5')](e,emitEvent(event));}}module[_0x0e74('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 40e3b25..c4b5e8a 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 _0x25d5=['exports','define','utf8mb4','utf8mb4_unicode_ci'];(function(_0x42f5bc,_0x49f3b5){var _0x23ab80=function(_0x6b2d94){while(--_0x6b2d94){_0x42f5bc['push'](_0x42f5bc['shift']());}};_0x23ab80(++_0x49f3b5);}(_0x25d5,0x94));var _0x525d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x25d5[_0x3dd15e];return _0x231fd0;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0x525d('0x0')]=function(_0x2392fc){return _0x2392fc[_0x525d('0x1')]('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x525d('0x2'),'collate':_0x525d('0x3')});}; \ No newline at end of file +var _0xc096=['ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','exports'];(function(_0x15da8c,_0x478681){var _0xf9adf=function(_0x337689){while(--_0x337689){_0x15da8c['push'](_0x15da8c['shift']());}};_0xf9adf(++_0x478681);}(_0xc096,0x10d));var _0x6c09=function(_0x4b2b5a,_0x3f7555){_0x4b2b5a=_0x4b2b5a-0x0;var _0x47f812=_0xc096[_0x4b2b5a];return _0x47f812;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0x6c09('0x0')]=function(_0x3f0f05){return _0x3f0f05['define'](_0x6c09('0x1'),attributes,{'tableName':_0x6c09('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6c09('0x3'),'collate':_0x6c09('0x4')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 3c07a3f..fa292e0 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 _0x74cb=['rpc','../../config/environment','client','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x193786,_0x11674c){var _0x11390b=function(_0xfdd634){while(--_0xfdd634){_0x193786['push'](_0x193786['shift']());}};_0x11390b(++_0x11674c);}(_0x74cb,0xf6));var _0xb74c=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x74cb[_0x618414];return _0x21c19a;};'use strict';var _=require('lodash');var util=require(_0xb74c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb74c('0x1'));var fs=require('fs');var Redis=require(_0xb74c('0x2'));var db=require(_0xb74c('0x3'))['db'];var utils=require(_0xb74c('0x4'));var logger=require(_0xb74c('0x5'))(_0xb74c('0x6'));var config=require(_0xb74c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb74c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x318060,_0x38010a,_0x1f6b74){return new BPromise(function(_0x419ea2,_0x484fdd){return client['request'](_0x318060,_0x1f6b74)[_0xb74c('0x9')](function(_0x4d92b5){logger[_0xb74c('0xa')](_0xb74c('0xb'),_0x38010a,'request\x20sent');logger['debug']('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x38010a,_0xb74c('0xc'),JSON[_0xb74c('0xd')](_0x4d92b5));if(_0x4d92b5[_0xb74c('0xe')]){if(_0x4d92b5[_0xb74c('0xe')]['code']===0x1f4){logger[_0xb74c('0xe')](_0xb74c('0xb'),_0x38010a,_0x4d92b5['error'][_0xb74c('0xf')]);return _0x484fdd(_0x4d92b5[_0xb74c('0xe')][_0xb74c('0xf')]);}logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x38010a,_0x4d92b5[_0xb74c('0xe')][_0xb74c('0xf')]);return _0x419ea2(_0x4d92b5[_0xb74c('0xe')][_0xb74c('0xf')]);}else{logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x38010a,_0xb74c('0xc'));_0x419ea2(_0x4d92b5[_0xb74c('0x10')]['message']);}})[_0xb74c('0x11')](function(_0x73dc9a){logger['error'](_0xb74c('0xb'),_0x38010a,_0x73dc9a);_0x484fdd(_0x73dc9a);});});} \ No newline at end of file +var _0xf101=['error','code','message','result','util','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xe256e5,_0x5a3930){var _0x185042=function(_0x17c84a){while(--_0x17c84a){_0xe256e5['push'](_0xe256e5['shift']());}};_0x185042(++_0x5a3930);}(_0xf101,0x12a));var _0x1f10=function(_0x15876a,_0x15383d){_0x15876a=_0x15876a-0x0;var _0xbd900f=_0xf101[_0x15876a];return _0xbd900f;};'use strict';var _=require('lodash');var util=require(_0x1f10('0x0'));var moment=require('moment');var BPromise=require(_0x1f10('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1f10('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x1f10('0x3'));var logger=require('../../config/logger')(_0x1f10('0x4'));var config=require(_0x1f10('0x5'));var jayson=require(_0x1f10('0x6'));var client=jayson[_0x1f10('0x7')][_0x1f10('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1e1a9f,_0x176f8e,_0x2c6f73){return new BPromise(function(_0x54afc4,_0x3c326a){return client[_0x1f10('0x9')](_0x1e1a9f,_0x2c6f73)[_0x1f10('0xa')](function(_0x412b88){logger[_0x1f10('0xb')](_0x1f10('0xc'),_0x176f8e,_0x1f10('0xd'));logger[_0x1f10('0xe')](_0x1f10('0xf'),_0x176f8e,_0x1f10('0xd'),JSON[_0x1f10('0x10')](_0x412b88));if(_0x412b88[_0x1f10('0x11')]){if(_0x412b88[_0x1f10('0x11')][_0x1f10('0x12')]===0x1f4){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x176f8e,_0x412b88[_0x1f10('0x11')][_0x1f10('0x13')]);return _0x3c326a(_0x412b88[_0x1f10('0x11')][_0x1f10('0x13')]);}logger[_0x1f10('0x11')](_0x1f10('0xc'),_0x176f8e,_0x412b88['error'][_0x1f10('0x13')]);return _0x54afc4(_0x412b88[_0x1f10('0x11')]['message']);}else{logger[_0x1f10('0xb')]('ChatOfflineMessage,\x20%s,\x20%s',_0x176f8e,_0x1f10('0xd'));_0x54afc4(_0x412b88[_0x1f10('0x14')][_0x1f10('0x13')]);}})['catch'](function(_0x3a7c6e){logger[_0x1f10('0x11')](_0x1f10('0xc'),_0x176f8e,_0x3a7c6e);_0x3c326a(_0x3a7c6e);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 4a7f7a2..0c7a075 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 _0xc146=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','destroy','exports','multer'];(function(_0x507db2,_0x3a4d21){var _0x2417e6=function(_0x1a75c8){while(--_0x1a75c8){_0x507db2['push'](_0x507db2['shift']());}};_0x2417e6(++_0x3a4d21);}(_0xc146,0x158));var _0x6c14=function(_0x54e924,_0x19fd9d){_0x54e924=_0x54e924-0x0;var _0x384dc6=_0xc146[_0x54e924];return _0x384dc6;};'use strict';var multer=require(_0x6c14('0x0'));var util=require(_0x6c14('0x1'));var path=require(_0x6c14('0x2'));var timeout=require(_0x6c14('0x3'));var express=require(_0x6c14('0x4'));var router=express[_0x6c14('0x5')]();var fs_extra=require(_0x6c14('0x6'));var auth=require(_0x6c14('0x7'));var interaction=require(_0x6c14('0x8'));var config=require(_0x6c14('0x9'));var controller=require(_0x6c14('0xa'));router[_0x6c14('0xb')]('/',auth[_0x6c14('0xc')](),controller[_0x6c14('0xd')]);router[_0x6c14('0xb')](_0x6c14('0xe'),auth['isAuthenticated'](),controller[_0x6c14('0xf')]);router[_0x6c14('0xb')](_0x6c14('0x10'),auth[_0x6c14('0xc')](),controller[_0x6c14('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6c14('0x12')]);router[_0x6c14('0x13')](_0x6c14('0x10'),auth[_0x6c14('0xc')](),controller[_0x6c14('0x14')]);router['delete'](_0x6c14('0x10'),auth[_0x6c14('0xc')](),controller[_0x6c14('0x15')]);module[_0x6c14('0x16')]=router; \ No newline at end of file +var _0xacb4=['/:id','show','post','create','put','update','delete','destroy','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0xacb4,0x197));var _0x4acb=function(_0x12b8ec,_0x1655be){_0x12b8ec=_0x12b8ec-0x0;var _0x21af77=_0xacb4[_0x12b8ec];return _0x21af77;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4acb('0x0'));var timeout=require(_0x4acb('0x1'));var express=require('express');var router=express[_0x4acb('0x2')]();var fs_extra=require(_0x4acb('0x3'));var auth=require(_0x4acb('0x4'));var interaction=require(_0x4acb('0x5'));var config=require(_0x4acb('0x6'));var controller=require('./chatOfflineMessage.controller');router['get']('/',auth[_0x4acb('0x7')](),controller[_0x4acb('0x8')]);router[_0x4acb('0x9')]('/describe',auth[_0x4acb('0x7')](),controller[_0x4acb('0xa')]);router[_0x4acb('0x9')](_0x4acb('0xb'),auth[_0x4acb('0x7')](),controller[_0x4acb('0xc')]);router[_0x4acb('0xd')]('/',auth[_0x4acb('0x7')](),controller[_0x4acb('0xe')]);router[_0x4acb('0xf')](_0x4acb('0xb'),auth[_0x4acb('0x7')](),controller[_0x4acb('0x10')]);router[_0x4acb('0x11')](_0x4acb('0xb'),auth['isAuthenticated'](),controller[_0x4acb('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index fd74b81..3d9bfda 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 _0xf287=['STRING','INTEGER','exports','ENUM','mouseOver','timeout'];(function(_0x4547e9,_0x26ccd6){var _0x424dbc=function(_0x36f6cd){while(--_0x36f6cd){_0x4547e9['push'](_0x4547e9['shift']());}};_0x424dbc(++_0x26ccd6);}(_0xf287,0xb0));var _0x7f28=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xf287[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require('sequelize');module[_0x7f28('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x7f28('0x1')](_0x7f28('0x2'),_0x7f28('0x3')),'defaultValue':_0x7f28('0x2')},'selector':{'type':Sequelize[_0x7f28('0x4')]},'timeout':{'type':Sequelize[_0x7f28('0x5')]}}; \ No newline at end of file +var _0x337a=['mouseOver','timeout','STRING','exports'];(function(_0x152845,_0x189a10){var _0x31b255=function(_0x3ed555){while(--_0x3ed555){_0x152845['push'](_0x152845['shift']());}};_0x31b255(++_0x189a10);}(_0x337a,0x77));var _0xa337=function(_0x2a4576,_0x5137f3){_0x2a4576=_0x2a4576-0x0;var _0x3ad27c=_0x337a[_0x2a4576];return _0x3ad27c;};'use strict';var Sequelize=require('sequelize');module[_0xa337('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xa337('0x1'),_0xa337('0x2')),'defaultValue':_0xa337('0x1')},'selector':{'type':Sequelize[_0xa337('0x3')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 260b110..524f366 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 _0x42b0=['send','show','model','ChatProactiveAction','rawAttributes','query','keys','filters','intersection','attributes','fields','length','includeAll','include','options','catch','create','body','find','params','eml-format','rimraf','fast-json-patch','moment','util','path','sox','to-csv','ejs','squel','crypto','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','json','offset','undefined','limit','set','apply','reject','save','update','destroy','then','stack','name'];(function(_0xa01f68,_0x1354a0){var _0x3deb1e=function(_0x4f2911){while(--_0x4f2911){_0xa01f68['push'](_0xa01f68['shift']());}};_0x3deb1e(++_0x1354a0);}(_0x42b0,0xbc));var _0x042b=function(_0x559aba,_0x392da1){_0x559aba=_0x559aba-0x0;var _0x4a3380=_0x42b0[_0x559aba];return _0x4a3380;};'use strict';var emlformat=require(_0x042b('0x0'));var rimraf=require(_0x042b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x042b('0x2'));var rp=require('request-promise');var moment=require(_0x042b('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x042b('0x4'));var path=require(_0x042b('0x5'));var sox=require(_0x042b('0x6'));var csv=require(_0x042b('0x7'));var ejs=require(_0x042b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x042b('0x9'));var crypto=require(_0x042b('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x042b('0x7'));var querystring=require('querystring');var Papa=require(_0x042b('0xb'));var Redis=require('ioredis');var authService=require(_0x042b('0xc'));var qs=require(_0x042b('0xd'));var as=require(_0x042b('0xe'));var hardwareService=require(_0x042b('0xf'));var logger=require(_0x042b('0x10'))(_0x042b('0x11'));var utils=require(_0x042b('0x12'));var config=require(_0x042b('0x13'));var licenseUtil=require(_0x042b('0x14'));var db=require(_0x042b('0x15'))['db'];function respondWithStatusCode(_0x2c0a6f,_0x35414e){_0x35414e=_0x35414e||0xcc;return function(_0x950ed9){if(_0x950ed9){return _0x2c0a6f['sendStatus'](_0x35414e);}return _0x2c0a6f[_0x042b('0x16')](_0x35414e)['end']();};}function respondWithResult(_0x1e5626,_0x5681bd){_0x5681bd=_0x5681bd||0xc8;return function(_0x31c22e){if(_0x31c22e){return _0x1e5626[_0x042b('0x16')](_0x5681bd)[_0x042b('0x17')](_0x31c22e);}};}function respondWithFilteredResult(_0xf9f4f3,_0x30c86f){return function(_0x183225){if(_0x183225){var _0x4dc4a6=typeof _0x30c86f[_0x042b('0x18')]===_0x042b('0x19')&&typeof _0x30c86f[_0x042b('0x1a')]===_0x042b('0x19');var _0x1e4eee=_0x183225['count'];var _0x2e2cb6=_0x4dc4a6?0x0:_0x30c86f[_0x042b('0x18')];var _0x4b5c25=_0x4dc4a6?_0x183225['count']:_0x30c86f[_0x042b('0x18')]+_0x30c86f[_0x042b('0x1a')];var _0x561d06;if(_0x4b5c25>=_0x1e4eee){_0x4b5c25=_0x1e4eee;_0x561d06=0xc8;}else{_0x561d06=0xce;}_0xf9f4f3[_0x042b('0x16')](_0x561d06);return _0xf9f4f3[_0x042b('0x1b')]('Content-Range',_0x2e2cb6+'-'+_0x4b5c25+'/'+_0x1e4eee)['json'](_0x183225);}return null;};}function patchUpdates(_0x5e6d8a){return function(_0x4eec67){try{jsonpatch[_0x042b('0x1c')](_0x4eec67,_0x5e6d8a,!![]);}catch(_0x23c915){return BPromise[_0x042b('0x1d')](_0x23c915);}return _0x4eec67[_0x042b('0x1e')]();};}function saveUpdates(_0x336c40,_0x50be84){return function(_0x36fabf){if(_0x36fabf){return _0x36fabf[_0x042b('0x1f')](_0x336c40)['then'](function(_0x5bc416){return _0x5bc416;});}return null;};}function removeEntity(_0x434d21,_0x59af51){return function(_0x558889){if(_0x558889){return _0x558889[_0x042b('0x20')]()[_0x042b('0x21')](function(){_0x434d21['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3204fc,_0x2f6e67){return function(_0x3c5491){if(!_0x3c5491){_0x3204fc['sendStatus'](0x194);}return _0x3c5491;};}function handleError(_0xda0462,_0x45d2c6){_0x45d2c6=_0x45d2c6||0x1f4;return function(_0x1b1250){logger['error'](_0x1b1250[_0x042b('0x22')]);if(_0x1b1250[_0x042b('0x23')]){delete _0x1b1250['name'];}_0xda0462[_0x042b('0x16')](_0x45d2c6)[_0x042b('0x24')](_0x1b1250);};}exports[_0x042b('0x25')]=function(_0x39596c,_0x52e467){var _0x5b5fe7={'raw':!![],'where':{'id':_0x39596c['params']['id']}},_0x572d6a={};_0x572d6a[_0x042b('0x26')]=_['keys'](db[_0x042b('0x27')][_0x042b('0x28')]);_0x572d6a[_0x042b('0x29')]=_[_0x042b('0x2a')](_0x39596c[_0x042b('0x29')]);_0x572d6a[_0x042b('0x2b')]=_[_0x042b('0x2c')](_0x572d6a[_0x042b('0x26')],_0x572d6a[_0x042b('0x29')]);_0x5b5fe7[_0x042b('0x2d')]=_[_0x042b('0x2c')](_0x572d6a[_0x042b('0x26')],qs[_0x042b('0x2e')](_0x39596c[_0x042b('0x29')][_0x042b('0x2e')]));_0x5b5fe7[_0x042b('0x2d')]=_0x5b5fe7['attributes'][_0x042b('0x2f')]?_0x5b5fe7[_0x042b('0x2d')]:_0x572d6a[_0x042b('0x26')];if(_0x39596c[_0x042b('0x29')][_0x042b('0x30')]){_0x5b5fe7[_0x042b('0x31')]=[{'all':!![]}];}_0x5b5fe7=_['merge']({},_0x5b5fe7,_0x39596c[_0x042b('0x32')]);return db[_0x042b('0x27')]['find'](_0x5b5fe7)[_0x042b('0x21')](handleEntityNotFound(_0x52e467,null))[_0x042b('0x21')](respondWithResult(_0x52e467,null))[_0x042b('0x33')](handleError(_0x52e467,null));};exports[_0x042b('0x34')]=function(_0x501cf3,_0x1b994a){return db[_0x042b('0x27')][_0x042b('0x34')](_0x501cf3[_0x042b('0x35')],{})[_0x042b('0x21')](respondWithResult(_0x1b994a,0xc9))['catch'](handleError(_0x1b994a,null));};exports[_0x042b('0x1f')]=function(_0x1502a7,_0x1f671d){if(_0x1502a7['body']['id']){delete _0x1502a7[_0x042b('0x35')]['id'];}return db['ChatProactiveAction'][_0x042b('0x36')]({'where':{'id':_0x1502a7[_0x042b('0x37')]['id']}})['then'](handleEntityNotFound(_0x1f671d,null))[_0x042b('0x21')](saveUpdates(_0x1502a7[_0x042b('0x35')],null))['then'](respondWithResult(_0x1f671d,null))['catch'](handleError(_0x1f671d,null));};exports[_0x042b('0x20')]=function(_0x1e8e70,_0x4aa81d){return db[_0x042b('0x27')][_0x042b('0x36')]({'where':{'id':_0x1e8e70[_0x042b('0x37')]['id']}})['then'](handleEntityNotFound(_0x4aa81d,null))['then'](removeEntity(_0x4aa81d,null))[_0x042b('0x33')](handleError(_0x4aa81d,null));}; \ No newline at end of file +var _0xfb15=['catch','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','apply','reject','save','update','destroy','then','sendStatus','error','name','send','show','model','keys','ChatProactiveAction','query','filters','attributes','fields','length','includeAll','include','merge','find'];(function(_0x4c9a10,_0x40bf03){var _0x5240ed=function(_0x47ea8f){while(--_0x47ea8f){_0x4c9a10['push'](_0x4c9a10['shift']());}};_0x5240ed(++_0x40bf03);}(_0xfb15,0x12f));var _0x5fb1=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xfb15[_0x465028];return _0xb783d4;};'use strict';var emlformat=require(_0x5fb1('0x0'));var rimraf=require(_0x5fb1('0x1'));var zipdir=require(_0x5fb1('0x2'));var jsonpatch=require(_0x5fb1('0x3'));var rp=require(_0x5fb1('0x4'));var moment=require(_0x5fb1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5fb1('0x6'));var util=require(_0x5fb1('0x7'));var path=require(_0x5fb1('0x8'));var sox=require(_0x5fb1('0x9'));var csv=require(_0x5fb1('0xa'));var ejs=require(_0x5fb1('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5fb1('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5fb1('0xd'));var deskjs=require(_0x5fb1('0xe'));var toCsv=require(_0x5fb1('0xa'));var querystring=require(_0x5fb1('0xf'));var Papa=require(_0x5fb1('0x10'));var Redis=require(_0x5fb1('0x11'));var authService=require(_0x5fb1('0x12'));var qs=require(_0x5fb1('0x13'));var as=require(_0x5fb1('0x14'));var hardwareService=require(_0x5fb1('0x15'));var logger=require(_0x5fb1('0x16'))(_0x5fb1('0x17'));var utils=require(_0x5fb1('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x5fb1('0x19'));var db=require(_0x5fb1('0x1a'))['db'];function respondWithStatusCode(_0x57593c,_0x173046){_0x173046=_0x173046||0xcc;return function(_0xf8539f){if(_0xf8539f){return _0x57593c['sendStatus'](_0x173046);}return _0x57593c[_0x5fb1('0x1b')](_0x173046)[_0x5fb1('0x1c')]();};}function respondWithResult(_0x348c9f,_0x3256d1){_0x3256d1=_0x3256d1||0xc8;return function(_0xb06b49){if(_0xb06b49){return _0x348c9f[_0x5fb1('0x1b')](_0x3256d1)[_0x5fb1('0x1d')](_0xb06b49);}};}function respondWithFilteredResult(_0x36b516,_0x588543){return function(_0x5332f5){if(_0x5332f5){var _0x55be50=typeof _0x588543[_0x5fb1('0x1e')]===_0x5fb1('0x1f')&&typeof _0x588543[_0x5fb1('0x20')]===_0x5fb1('0x1f');var _0x3e40e2=_0x5332f5[_0x5fb1('0x21')];var _0x547a28=_0x55be50?0x0:_0x588543[_0x5fb1('0x1e')];var _0x38a297=_0x55be50?_0x5332f5[_0x5fb1('0x21')]:_0x588543[_0x5fb1('0x1e')]+_0x588543[_0x5fb1('0x20')];var _0x229700;if(_0x38a297>=_0x3e40e2){_0x38a297=_0x3e40e2;_0x229700=0xc8;}else{_0x229700=0xce;}_0x36b516['status'](_0x229700);return _0x36b516['set']('Content-Range',_0x547a28+'-'+_0x38a297+'/'+_0x3e40e2)[_0x5fb1('0x1d')](_0x5332f5);}return null;};}function patchUpdates(_0x1fa373){return function(_0x592399){try{jsonpatch[_0x5fb1('0x22')](_0x592399,_0x1fa373,!![]);}catch(_0x305ea9){return BPromise[_0x5fb1('0x23')](_0x305ea9);}return _0x592399[_0x5fb1('0x24')]();};}function saveUpdates(_0x3b0303,_0x41e89a){return function(_0x549b56){if(_0x549b56){return _0x549b56[_0x5fb1('0x25')](_0x3b0303)['then'](function(_0x53c791){return _0x53c791;});}return null;};}function removeEntity(_0x1c359e,_0x29638a){return function(_0x3555b5){if(_0x3555b5){return _0x3555b5[_0x5fb1('0x26')]()[_0x5fb1('0x27')](function(){_0x1c359e['status'](0xcc)[_0x5fb1('0x1c')]();});}};}function handleEntityNotFound(_0x252e43,_0x4de924){return function(_0x3681a1){if(!_0x3681a1){_0x252e43[_0x5fb1('0x28')](0x194);}return _0x3681a1;};}function handleError(_0x1b722d,_0x20aa83){_0x20aa83=_0x20aa83||0x1f4;return function(_0x50c25d){logger[_0x5fb1('0x29')](_0x50c25d['stack']);if(_0x50c25d[_0x5fb1('0x2a')]){delete _0x50c25d[_0x5fb1('0x2a')];}_0x1b722d['status'](_0x20aa83)[_0x5fb1('0x2b')](_0x50c25d);};}exports[_0x5fb1('0x2c')]=function(_0x31de2f,_0x496946){var _0x1dad75={'raw':!![],'where':{'id':_0x31de2f['params']['id']}},_0x4fdf6b={};_0x4fdf6b[_0x5fb1('0x2d')]=_[_0x5fb1('0x2e')](db[_0x5fb1('0x2f')]['rawAttributes']);_0x4fdf6b[_0x5fb1('0x30')]=_['keys'](_0x31de2f['query']);_0x4fdf6b[_0x5fb1('0x31')]=_['intersection'](_0x4fdf6b[_0x5fb1('0x2d')],_0x4fdf6b[_0x5fb1('0x30')]);_0x1dad75[_0x5fb1('0x32')]=_['intersection'](_0x4fdf6b['model'],qs[_0x5fb1('0x33')](_0x31de2f[_0x5fb1('0x30')]['fields']));_0x1dad75[_0x5fb1('0x32')]=_0x1dad75[_0x5fb1('0x32')][_0x5fb1('0x34')]?_0x1dad75[_0x5fb1('0x32')]:_0x4fdf6b[_0x5fb1('0x2d')];if(_0x31de2f[_0x5fb1('0x30')][_0x5fb1('0x35')]){_0x1dad75[_0x5fb1('0x36')]=[{'all':!![]}];}_0x1dad75=_[_0x5fb1('0x37')]({},_0x1dad75,_0x31de2f['options']);return db[_0x5fb1('0x2f')][_0x5fb1('0x38')](_0x1dad75)[_0x5fb1('0x27')](handleEntityNotFound(_0x496946,null))[_0x5fb1('0x27')](respondWithResult(_0x496946,null))[_0x5fb1('0x39')](handleError(_0x496946,null));};exports['create']=function(_0x2bc447,_0x2021c7){return db[_0x5fb1('0x2f')]['create'](_0x2bc447['body'],{})['then'](respondWithResult(_0x2021c7,0xc9))[_0x5fb1('0x39')](handleError(_0x2021c7,null));};exports[_0x5fb1('0x25')]=function(_0x3ae827,_0x480d5c){if(_0x3ae827[_0x5fb1('0x3a')]['id']){delete _0x3ae827[_0x5fb1('0x3a')]['id'];}return db[_0x5fb1('0x2f')][_0x5fb1('0x38')]({'where':{'id':_0x3ae827[_0x5fb1('0x3b')]['id']}})[_0x5fb1('0x27')](handleEntityNotFound(_0x480d5c,null))['then'](saveUpdates(_0x3ae827[_0x5fb1('0x3a')],null))[_0x5fb1('0x27')](respondWithResult(_0x480d5c,null))[_0x5fb1('0x39')](handleError(_0x480d5c,null));};exports[_0x5fb1('0x26')]=function(_0x35d97b,_0x2b517e){return db[_0x5fb1('0x2f')][_0x5fb1('0x38')]({'where':{'id':_0x35d97b[_0x5fb1('0x3b')]['id']}})[_0x5fb1('0x27')](handleEntityNotFound(_0x2b517e,null))[_0x5fb1('0x27')](removeEntity(_0x2b517e,null))[_0x5fb1('0x39')](handleError(_0x2b517e,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 12af75d..1cc1b80 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 _0x1f4a=['moment','bluebird','path','rimraf','../../config/environment','ChatProactiveAction','lodash','util','api'];(function(_0x1a9368,_0x1c3183){var _0x1a4ef1=function(_0x409440){while(--_0x409440){_0x1a9368['push'](_0x1a9368['shift']());}};_0x1a4ef1(++_0x1c3183);}(_0x1f4a,0xcc));var _0xa1f4=function(_0x84914d,_0x3c8d7e){_0x84914d=_0x84914d-0x0;var _0x2fcba9=_0x1f4a[_0x84914d];return _0x2fcba9;};'use strict';var _=require(_0xa1f4('0x0'));var util=require(_0xa1f4('0x1'));var logger=require('../../config/logger')(_0xa1f4('0x2'));var moment=require(_0xa1f4('0x3'));var BPromise=require(_0xa1f4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa1f4('0x5'));var rimraf=require(_0xa1f4('0x6'));var config=require(_0xa1f4('0x7'));var attributes=require('./chatProactiveAction.attributes');module['exports']=function(_0x26f0cc,_0x2de09b){return _0x26f0cc['define'](_0xa1f4('0x8'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b57=['define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','./chatProactiveAction.attributes','exports'];(function(_0x1f542c,_0x494813){var _0x544d78=function(_0x56345a){while(--_0x56345a){_0x1f542c['push'](_0x1f542c['shift']());}};_0x544d78(++_0x494813);}(_0x6b57,0x10b));var _0x76b5=function(_0x297d2b,_0x3689a6){_0x297d2b=_0x297d2b-0x0;var _0x40eff9=_0x6b57[_0x297d2b];return _0x40eff9;};'use strict';var _=require(_0x76b5('0x0'));var util=require(_0x76b5('0x1'));var logger=require(_0x76b5('0x2'))(_0x76b5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x76b5('0x4'));var fs=require('fs');var path=require(_0x76b5('0x5'));var rimraf=require('rimraf');var config=require(_0x76b5('0x6'));var attributes=require(_0x76b5('0x7'));module[_0x76b5('0x8')]=function(_0x4c81a4,_0x3009b5){return _0x4c81a4[_0x76b5('0x9')](_0x76b5('0xa'),attributes,{'tableName':_0x76b5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index d2d7df9..c25c9c5 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 _0x410e=['jayson/promise','client','http','request','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x17099c,_0x3cd87f){var _0x4b89d7=function(_0x38ceae){while(--_0x38ceae){_0x17099c['push'](_0x17099c['shift']());}};_0x4b89d7(++_0x3cd87f);}(_0x410e,0x16d));var _0xe410=function(_0x17f94b,_0x5e4605){_0x17f94b=_0x17f94b-0x0;var _0x1ab39b=_0x410e[_0x17f94b];return _0x1ab39b;};'use strict';var _=require(_0xe410('0x0'));var util=require(_0xe410('0x1'));var moment=require(_0xe410('0x2'));var BPromise=require(_0xe410('0x3'));var rs=require(_0xe410('0x4'));var fs=require('fs');var Redis=require(_0xe410('0x5'));var db=require(_0xe410('0x6'))['db'];var utils=require(_0xe410('0x7'));var logger=require('../../config/logger')(_0xe410('0x8'));var config=require(_0xe410('0x9'));var jayson=require(_0xe410('0xa'));var client=jayson[_0xe410('0xb')][_0xe410('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x6d655c,_0x27f18c,_0x18a8ef){return new BPromise(function(_0x3019dd,_0x440de4){return client[_0xe410('0xd')](_0x6d655c,_0x18a8ef)['then'](function(_0x50aef7){logger[_0xe410('0xe')](_0xe410('0xf'),_0x27f18c,_0xe410('0x10'));logger[_0xe410('0x11')](_0xe410('0x12'),_0x27f18c,'request\x20sent',JSON[_0xe410('0x13')](_0x50aef7));if(_0x50aef7[_0xe410('0x14')]){if(_0x50aef7[_0xe410('0x14')][_0xe410('0x15')]===0x1f4){logger[_0xe410('0x14')](_0xe410('0xf'),_0x27f18c,_0x50aef7['error'][_0xe410('0x16')]);return _0x440de4(_0x50aef7[_0xe410('0x14')][_0xe410('0x16')]);}logger['error'](_0xe410('0xf'),_0x27f18c,_0x50aef7[_0xe410('0x14')][_0xe410('0x16')]);return _0x3019dd(_0x50aef7[_0xe410('0x14')][_0xe410('0x16')]);}else{logger[_0xe410('0xe')](_0xe410('0xf'),_0x27f18c,'request\x20sent');_0x3019dd(_0x50aef7[_0xe410('0x17')][_0xe410('0x16')]);}})[_0xe410('0x18')](function(_0x1033e7){logger[_0xe410('0x14')](_0xe410('0xf'),_0x27f18c,_0x1033e7);_0x440de4(_0x1033e7);});});} \ No newline at end of file +var _0x0117=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x69ea92,_0x14506b){var _0x45b8ea=function(_0x2a33c0){while(--_0x2a33c0){_0x69ea92['push'](_0x69ea92['shift']());}};_0x45b8ea(++_0x14506b);}(_0x0117,0x114));var _0x7011=function(_0x5cced6,_0x19734f){_0x5cced6=_0x5cced6-0x0;var _0x4d6e7a=_0x0117[_0x5cced6];return _0x4d6e7a;};'use strict';var _=require(_0x7011('0x0'));var util=require(_0x7011('0x1'));var moment=require('moment');var BPromise=require(_0x7011('0x2'));var rs=require(_0x7011('0x3'));var fs=require('fs');var Redis=require(_0x7011('0x4'));var db=require(_0x7011('0x5'))['db'];var utils=require(_0x7011('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7011('0x7')][_0x7011('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5ecdbc,_0x56acfa,_0x481ce7){return new BPromise(function(_0x42be7a,_0x2a050f){return client[_0x7011('0x9')](_0x5ecdbc,_0x481ce7)[_0x7011('0xa')](function(_0x12c34e){logger[_0x7011('0xb')](_0x7011('0xc'),_0x56acfa,_0x7011('0xd'));logger['debug'](_0x7011('0xe'),_0x56acfa,_0x7011('0xd'),JSON[_0x7011('0xf')](_0x12c34e));if(_0x12c34e[_0x7011('0x10')]){if(_0x12c34e['error'][_0x7011('0x11')]===0x1f4){logger[_0x7011('0x10')](_0x7011('0xc'),_0x56acfa,_0x12c34e[_0x7011('0x10')][_0x7011('0x12')]);return _0x2a050f(_0x12c34e[_0x7011('0x10')][_0x7011('0x12')]);}logger[_0x7011('0x10')](_0x7011('0xc'),_0x56acfa,_0x12c34e[_0x7011('0x10')][_0x7011('0x12')]);return _0x42be7a(_0x12c34e[_0x7011('0x10')][_0x7011('0x12')]);}else{logger[_0x7011('0xb')](_0x7011('0xc'),_0x56acfa,'request\x20sent');_0x42be7a(_0x12c34e[_0x7011('0x13')][_0x7011('0x12')]);}})[_0x7011('0x14')](function(_0x565d14){logger[_0x7011('0x10')](_0x7011('0xc'),_0x56acfa,_0x565d14);_0x2a050f(_0x565d14);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index d1fefbf..ad7fe7d 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 _0x46ed=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports'];(function(_0x11309c,_0xe18a74){var _0x3fea9c=function(_0xeb11c3){while(--_0xeb11c3){_0x11309c['push'](_0x11309c['shift']());}};_0x3fea9c(++_0xe18a74);}(_0x46ed,0x168));var _0xd46e=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x46ed[_0x51020b];return _0x371e47;};'use strict';var multer=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var path=require('path');var timeout=require(_0xd46e('0x2'));var express=require(_0xd46e('0x3'));var router=express[_0xd46e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd46e('0x5'));var interaction=require(_0xd46e('0x6'));var config=require('../../config/environment');var controller=require(_0xd46e('0x7'));router[_0xd46e('0x8')](_0xd46e('0x9'),auth[_0xd46e('0xa')](),controller[_0xd46e('0xb')]);router[_0xd46e('0xc')]('/',auth[_0xd46e('0xa')](),controller[_0xd46e('0xd')]);router[_0xd46e('0xe')](_0xd46e('0x9'),auth[_0xd46e('0xa')](),controller['update']);router[_0xd46e('0xf')](_0xd46e('0x9'),auth['isAuthenticated'](),controller[_0xd46e('0x10')]);module[_0xd46e('0x11')]=router; \ No newline at end of file +var _0x5fc3=['create','put','/:id','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatProactiveAction.controller','get','show','isAuthenticated'];(function(_0x343c13,_0x2ca454){var _0x517577=function(_0x4f0728){while(--_0x4f0728){_0x343c13['push'](_0x343c13['shift']());}};_0x517577(++_0x2ca454);}(_0x5fc3,0xa8));var _0x35fc=function(_0x25fa5c,_0x421141){_0x25fa5c=_0x25fa5c-0x0;var _0x1bade2=_0x5fc3[_0x25fa5c];return _0x1bade2;};'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')]('/:id',auth['isAuthenticated'](),controller[_0x35fc('0xa')]);router['post']('/',auth[_0x35fc('0xb')](),controller[_0x35fc('0xc')]);router[_0x35fc('0xd')](_0x35fc('0xe'),auth[_0x35fc('0xb')](),controller[_0x35fc('0xf')]);router[_0x35fc('0x10')]('/:id',auth[_0x35fc('0xb')](),controller[_0x35fc('0x11')]);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 d1202f2..7f5e39c 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 _0x87ba=['STRING','INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports','name'];(function(_0x37978b,_0x18d645){var _0xcc51db=function(_0x89ff48){while(--_0x89ff48){_0x37978b['push'](_0x37978b['shift']());}};_0xcc51db(++_0x18d645);}(_0x87ba,0x16d));var _0xa87b=function(_0x48f011,_0x4f4a87){_0x48f011=_0x48f011-0x0;var _0x47824e=_0x87ba[_0x48f011];return _0x47824e;};'use strict';var Sequelize=require(_0xa87b('0x0'));module[_0xa87b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xa87b('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa87b('0x3')]},'timeout':{'type':Sequelize[_0xa87b('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa87b('0x5')](_0xa87b('0x6'),'beepall',_0xa87b('0x7'))}}; \ No newline at end of file +var _0x854b=['INTEGER','rrmemory','beepall','roundrobin','STRING'];(function(_0x2bda24,_0x3683ee){var _0x436332=function(_0x4ff0c3){while(--_0x4ff0c3){_0x2bda24['push'](_0x2bda24['shift']());}};_0x436332(++_0x3683ee);}(_0x854b,0x12b));var _0xb854=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x854b[_0xc6be3a];return _0x56a310;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb854('0x0')]},'timeout':{'type':Sequelize[_0xb854('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xb854('0x2'),_0xb854('0x3'),_0xb854('0x4'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 63c52fe..b585efa 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 _0x9dae=['status','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','get','ChatQueues','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','order','sort','filter','where','merge','VIRTUAL','options','ChatQueue','includeAll','include','rows','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','nolimit','pick','findAll','User','findAndCountAll','UserId','agent','chatPause','createdAt','%s/%s','SIP','updatedAt','getTeams','Team','hasOwnProperty','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','select','tq.TeamId','team_has_chat_queues','join','user_has_teams','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','union','value','removeTeams','userChatQueue:remove','addAgents','omit','spread','userChatQueue:save','removeAgents','getAgents','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','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','defaults','localhost','socket.io-emitter','redis','./chatQueue.socket','register','jayson/promise','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','end'];(function(_0x4da196,_0x357dc9){var _0x375df3=function(_0x366603){while(--_0x366603){_0x4da196['push'](_0x4da196['shift']());}};_0x375df3(++_0x357dc9);}(_0x9dae,0x1a7));var _0xe9da=function(_0x5156e7,_0x19da55){_0x5156e7=_0x5156e7-0x0;var _0x3d8b70=_0x9dae[_0x5156e7];return _0x3d8b70;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9da('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9da('0x1'));var rp=require(_0xe9da('0x2'));var moment=require(_0xe9da('0x3'));var BPromise=require(_0xe9da('0x4'));var Mustache=require(_0xe9da('0x5'));var util=require(_0xe9da('0x6'));var path=require(_0xe9da('0x7'));var sox=require('sox');var csv=require(_0xe9da('0x8'));var ejs=require(_0xe9da('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe9da('0xa'));var squel=require(_0xe9da('0xb'));var crypto=require(_0xe9da('0xc'));var jsforce=require(_0xe9da('0xd'));var deskjs=require(_0xe9da('0xe'));var toCsv=require(_0xe9da('0x8'));var querystring=require(_0xe9da('0xf'));var Papa=require(_0xe9da('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe9da('0x11'));var as=require(_0xe9da('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe9da('0x13'))(_0xe9da('0x14'));var utils=require(_0xe9da('0x15'));var config=require(_0xe9da('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe9da('0x17'))['db'];config['redis']=_[_0xe9da('0x18')](config['redis'],{'host':_0xe9da('0x19'),'port':0x18eb});var socket=require(_0xe9da('0x1a'))(new Redis(config[_0xe9da('0x1b')]));require(_0xe9da('0x1c'))[_0xe9da('0x1d')](socket);var jayson=require(_0xe9da('0x1e'));var client=jayson[_0xe9da('0x1f')][_0xe9da('0x20')]({'port':0x232a});function respondWithRpcPromise(_0xdf0847,_0x44dcfe,_0x55253e,_0x4cea7b){return new BPromise(function(_0xb24c51,_0x2083ac){var _0x3106f0=_0x4cea7b||client;return _0x3106f0[_0xe9da('0x21')](_0xdf0847,_0x55253e)[_0xe9da('0x22')](function(_0x36f570){logger[_0xe9da('0x23')](_0xe9da('0x24'),_0x44dcfe,_0xe9da('0x25'));logger['debug'](_0xe9da('0x26'),_0x44dcfe,'request\x20sent',JSON[_0xe9da('0x27')](_0x36f570));if(_0x36f570[_0xe9da('0x28')]){if(_0x36f570[_0xe9da('0x28')]['code']===0x1f4){logger['error'](_0xe9da('0x24'),_0x44dcfe,_0x36f570[_0xe9da('0x28')][_0xe9da('0x29')]);return _0x2083ac(_0x36f570['error'][_0xe9da('0x29')]);}logger[_0xe9da('0x28')](_0xe9da('0x24'),_0x44dcfe,_0x36f570[_0xe9da('0x28')][_0xe9da('0x29')]);return _0xb24c51(_0x36f570[_0xe9da('0x28')][_0xe9da('0x29')]);}else{logger[_0xe9da('0x23')](_0xe9da('0x24'),_0x44dcfe,_0xe9da('0x25'));_0xb24c51(_0x36f570[_0xe9da('0x2a')][_0xe9da('0x29')]);}})['catch'](function(_0x2f1fd){logger['error']('ChatQueue,\x20%s,\x20%s',_0x44dcfe,_0x2f1fd);_0x2083ac(_0x2f1fd);});});}function respondWithStatusCode(_0x2d064c,_0x220953){_0x220953=_0x220953||0xcc;return function(_0x41558e){if(_0x41558e){return _0x2d064c[_0xe9da('0x2b')](_0x220953);}return _0x2d064c['status'](_0x220953)[_0xe9da('0x2c')]();};}function respondWithResult(_0x4ba4f2,_0x3f215f){_0x3f215f=_0x3f215f||0xc8;return function(_0x5aab72){if(_0x5aab72){return _0x4ba4f2[_0xe9da('0x2d')](_0x3f215f)['json'](_0x5aab72);}};}function respondWithFilteredResult(_0x1ef415,_0x44424b){return function(_0x5c1ab8){if(_0x5c1ab8){var _0x3240db=typeof _0x44424b[_0xe9da('0x2e')]===_0xe9da('0x2f')&&typeof _0x44424b['limit']===_0xe9da('0x2f');var _0x846392=_0x5c1ab8[_0xe9da('0x30')];var _0x54f4bc=_0x3240db?0x0:_0x44424b[_0xe9da('0x2e')];var _0x42d85a=_0x3240db?_0x5c1ab8[_0xe9da('0x30')]:_0x44424b[_0xe9da('0x2e')]+_0x44424b[_0xe9da('0x31')];var _0x1641d6;if(_0x42d85a>=_0x846392){_0x42d85a=_0x846392;_0x1641d6=0xc8;}else{_0x1641d6=0xce;}_0x1ef415[_0xe9da('0x2d')](_0x1641d6);return _0x1ef415[_0xe9da('0x32')](_0xe9da('0x33'),_0x54f4bc+'-'+_0x42d85a+'/'+_0x846392)['json'](_0x5c1ab8);}return null;};}function patchUpdates(_0x4e2ec6){return function(_0x36ca61){try{jsonpatch[_0xe9da('0x34')](_0x36ca61,_0x4e2ec6,!![]);}catch(_0x1bc2cd){return BPromise[_0xe9da('0x35')](_0x1bc2cd);}return _0x36ca61[_0xe9da('0x36')]();};}function saveUpdates(_0x3a5650,_0x299086){return function(_0x1f0918){if(_0x1f0918){return _0x1f0918[_0xe9da('0x37')](_0x3a5650)[_0xe9da('0x22')](function(_0x55d603){return _0x55d603;});}return null;};}function removeEntity(_0x93d239,_0x149143){return function(_0x47b36e){if(_0x47b36e){return _0x47b36e[_0xe9da('0x38')]()[_0xe9da('0x22')](function(){var _0x593279=_0x47b36e[_0xe9da('0x39')]({'plain':!![]});var _0x5af42a=_0xe9da('0x3a');return db[_0xe9da('0x3b')]['destroy']({'where':{'type':_0x5af42a,'resourceId':_0x593279['id']}})[_0xe9da('0x22')](function(){return _0x47b36e;});})[_0xe9da('0x22')](function(){_0x93d239[_0xe9da('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e678f,_0x30bcaa){return function(_0x5ca946){if(!_0x5ca946){_0x1e678f[_0xe9da('0x2b')](0x194);}return _0x5ca946;};}function handleError(_0x4b71f5,_0x3af01d){_0x3af01d=_0x3af01d||0x1f4;return function(_0x1b4cc7){logger[_0xe9da('0x28')](_0x1b4cc7[_0xe9da('0x3c')]);if(_0x1b4cc7[_0xe9da('0x3d')]){delete _0x1b4cc7[_0xe9da('0x3d')];}_0x4b71f5[_0xe9da('0x2d')](_0x3af01d)[_0xe9da('0x3e')](_0x1b4cc7);};}exports[_0xe9da('0x3f')]=function(_0x39aac0,_0x9cfc5e){var _0x211b0a={},_0x4bb768={},_0x94344b={'count':0x0,'rows':[]};var _0x4f3f2f=_[_0xe9da('0x40')](db['ChatQueue'][_0xe9da('0x41')],function(_0x160004){return{'name':_0x160004[_0xe9da('0x42')],'type':_0x160004[_0xe9da('0x43')][_0xe9da('0x44')]};});_0x4bb768[_0xe9da('0x45')]=_[_0xe9da('0x40')](_0x4f3f2f,'name');_0x4bb768[_0xe9da('0x46')]=_[_0xe9da('0x47')](_0x39aac0[_0xe9da('0x46')]);_0x4bb768[_0xe9da('0x48')]=_[_0xe9da('0x49')](_0x4bb768[_0xe9da('0x45')],_0x4bb768[_0xe9da('0x46')]);_0x211b0a['attributes']=_['intersection'](_0x4bb768[_0xe9da('0x45')],qs[_0xe9da('0x4a')](_0x39aac0['query'][_0xe9da('0x4a')]));_0x211b0a['attributes']=_0x211b0a[_0xe9da('0x4b')]['length']?_0x211b0a[_0xe9da('0x4b')]:_0x4bb768[_0xe9da('0x45')];if(!_0x39aac0[_0xe9da('0x46')]['hasOwnProperty']('nolimit')){_0x211b0a['limit']=qs[_0xe9da('0x31')](_0x39aac0['query']['limit']);_0x211b0a[_0xe9da('0x2e')]=qs['offset'](_0x39aac0[_0xe9da('0x46')][_0xe9da('0x2e')]);}_0x211b0a[_0xe9da('0x4c')]=qs[_0xe9da('0x4d')](_0x39aac0['query']['sort']);_0x211b0a['where']=qs[_0xe9da('0x48')](_['pick'](_0x39aac0[_0xe9da('0x46')],_0x4bb768[_0xe9da('0x48')]),_0x4f3f2f);if(_0x39aac0[_0xe9da('0x46')][_0xe9da('0x4e')]){_0x211b0a[_0xe9da('0x4f')]=_[_0xe9da('0x50')](_0x211b0a[_0xe9da('0x4f')],{'$or':_['map'](_0x4f3f2f,function(_0x359705){if(_0x359705[_0xe9da('0x43')]!==_0xe9da('0x51')){var _0x8681a9={};_0x8681a9[_0x359705[_0xe9da('0x3d')]]={'$like':'%'+_0x39aac0[_0xe9da('0x46')][_0xe9da('0x4e')]+'%'};return _0x8681a9;}})});}_0x211b0a=_['merge']({},_0x211b0a,_0x39aac0[_0xe9da('0x52')]);var _0x1935c3={'where':_0x211b0a[_0xe9da('0x4f')]};return db[_0xe9da('0x53')][_0xe9da('0x30')](_0x1935c3)[_0xe9da('0x22')](function(_0x357992){_0x94344b[_0xe9da('0x30')]=_0x357992;if(_0x39aac0['query'][_0xe9da('0x54')]){_0x211b0a[_0xe9da('0x55')]=[{'all':!![]}];}return db[_0xe9da('0x53')]['findAll'](_0x211b0a);})[_0xe9da('0x22')](function(_0x38a366){_0x94344b[_0xe9da('0x56')]=_0x38a366;return _0x94344b;})[_0xe9da('0x22')](respondWithFilteredResult(_0x9cfc5e,_0x211b0a))['catch'](handleError(_0x9cfc5e,null));};exports[_0xe9da('0x57')]=function(_0x4dc855,_0x39c5be){var _0x4bb2fb={'raw':!![],'where':{'id':_0x4dc855[_0xe9da('0x58')]['id']}},_0x4bfdb0={};_0x4bfdb0['model']=_[_0xe9da('0x47')](db[_0xe9da('0x53')]['rawAttributes']);_0x4bfdb0[_0xe9da('0x46')]=_[_0xe9da('0x47')](_0x4dc855[_0xe9da('0x46')]);_0x4bfdb0[_0xe9da('0x48')]=_[_0xe9da('0x49')](_0x4bfdb0[_0xe9da('0x45')],_0x4bfdb0[_0xe9da('0x46')]);_0x4bb2fb[_0xe9da('0x4b')]=_['intersection'](_0x4bfdb0[_0xe9da('0x45')],qs[_0xe9da('0x4a')](_0x4dc855[_0xe9da('0x46')]['fields']));_0x4bb2fb[_0xe9da('0x4b')]=_0x4bb2fb[_0xe9da('0x4b')][_0xe9da('0x59')]?_0x4bb2fb[_0xe9da('0x4b')]:_0x4bfdb0[_0xe9da('0x45')];if(_0x4dc855['query'][_0xe9da('0x54')]){_0x4bb2fb['include']=[{'all':!![]}];}_0x4bb2fb=_[_0xe9da('0x50')]({},_0x4bb2fb,_0x4dc855['options']);return db[_0xe9da('0x53')][_0xe9da('0x5a')](_0x4bb2fb)[_0xe9da('0x22')](handleEntityNotFound(_0x39c5be,null))[_0xe9da('0x22')](respondWithResult(_0x39c5be,null))['catch'](handleError(_0x39c5be,null));};exports['create']=function(_0x3084b8,_0x1051bc){return db['ChatQueue'][_0xe9da('0x5b')](_0x3084b8[_0xe9da('0x5c')],{})['then'](function(_0x2f3629){var _0x43d692=_0x3084b8[_0xe9da('0x5d')][_0xe9da('0x39')]({'plain':!![]});if(!_0x43d692)throw new Error(_0xe9da('0x5e'));if(_0x43d692[_0xe9da('0x5f')]===_0xe9da('0x5d')){var _0xd1ea9e=_0x2f3629[_0xe9da('0x39')]({'plain':!![]});var _0x21ac15='ChatQueues';return db['UserProfileSection']['find']({'where':{'name':_0x21ac15,'userProfileId':_0x43d692[_0xe9da('0x60')]},'raw':!![]})[_0xe9da('0x22')](function(_0x5049de){if(_0x5049de&&_0x5049de[_0xe9da('0x61')]===0x0){return db[_0xe9da('0x3b')][_0xe9da('0x5b')]({'name':_0xd1ea9e[_0xe9da('0x3d')],'resourceId':_0xd1ea9e['id'],'type':_0x5049de[_0xe9da('0x3d')],'sectionId':_0x5049de['id']},{})['then'](function(){return _0x2f3629;});}else{return _0x2f3629;}})[_0xe9da('0x62')](function(_0x855804){logger['error'](_0xe9da('0x63'),_0x855804);throw _0x855804;});}return _0x2f3629;})[_0xe9da('0x22')](respondWithResult(_0x1051bc,0xc9))['catch'](handleError(_0x1051bc,null));};exports[_0xe9da('0x37')]=function(_0x3dc3fa,_0x4e031d){if(_0x3dc3fa[_0xe9da('0x5c')]['id']){delete _0x3dc3fa['body']['id'];}return db[_0xe9da('0x53')][_0xe9da('0x5a')]({'where':{'id':_0x3dc3fa[_0xe9da('0x58')]['id']}})[_0xe9da('0x22')](handleEntityNotFound(_0x4e031d,null))['then'](saveUpdates(_0x3dc3fa[_0xe9da('0x5c')],null))[_0xe9da('0x22')](respondWithResult(_0x4e031d,null))['catch'](handleError(_0x4e031d,null));};exports[_0xe9da('0x38')]=function(_0x562bad,_0x19975f){return db[_0xe9da('0x53')][_0xe9da('0x5a')]({'where':{'id':_0x562bad[_0xe9da('0x58')]['id']}})[_0xe9da('0x22')](handleEntityNotFound(_0x19975f,null))[_0xe9da('0x22')](removeEntity(_0x19975f,null))['catch'](handleError(_0x19975f,null));};exports[_0xe9da('0x64')]=function(_0x192902,_0x4142cf){return db[_0xe9da('0x53')][_0xe9da('0x64')]()[_0xe9da('0x22')](respondWithResult(_0x4142cf,null))[_0xe9da('0x62')](handleError(_0x4142cf,null));};exports[_0xe9da('0x65')]=function(_0x13ce26,_0xc2c76c,_0x34752d){var _0x1fd2b0={'raw':!![],'where':{}},_0x2d3f20={},_0x2dd0ea;return db['ChatQueue'][_0xe9da('0x66')]({'where':{'id':_0x13ce26[_0xe9da('0x58')]['id']}})['then'](handleEntityNotFound(_0xc2c76c,null))[_0xe9da('0x22')](function(_0x88eb1c){if(_0x88eb1c){_0x2dd0ea=_0x88eb1c[_0xe9da('0x39')]({'plain':!![]});_0x2d3f20['model']=_[_0xe9da('0x47')](db[_0xe9da('0x67')][_0xe9da('0x41')]);_0x2d3f20['query']=_[_0xe9da('0x47')](_0x13ce26[_0xe9da('0x46')]);_0x2d3f20['filters']=_['intersection'](_0x2d3f20[_0xe9da('0x45')],_0x2d3f20[_0xe9da('0x46')]);_0x1fd2b0[_0xe9da('0x4b')]=_[_0xe9da('0x49')](_0x2d3f20[_0xe9da('0x45')],qs['fields'](_0x13ce26[_0xe9da('0x46')]['fields']));_0x1fd2b0['attributes']=_0x1fd2b0[_0xe9da('0x4b')][_0xe9da('0x59')]?_0x1fd2b0[_0xe9da('0x4b')]:_0x2d3f20[_0xe9da('0x45')];if(!_0x13ce26['query']['hasOwnProperty'](_0xe9da('0x68'))){_0x1fd2b0[_0xe9da('0x31')]=qs['limit'](_0x13ce26[_0xe9da('0x46')][_0xe9da('0x31')]);_0x1fd2b0[_0xe9da('0x2e')]=qs[_0xe9da('0x2e')](_0x13ce26[_0xe9da('0x46')]['offset']);}_0x1fd2b0[_0xe9da('0x4c')]=qs['sort'](_0x13ce26[_0xe9da('0x46')][_0xe9da('0x4d')]);_0x1fd2b0[_0xe9da('0x4f')]=qs[_0xe9da('0x48')](_[_0xe9da('0x69')](_0x13ce26[_0xe9da('0x46')],_0x2d3f20['filters']));_0x1fd2b0[_0xe9da('0x4f')]['ChatQueueId']=_0x88eb1c['id'];if(_0x13ce26[_0xe9da('0x46')][_0xe9da('0x4e')]){_0x1fd2b0[_0xe9da('0x4f')]=_[_0xe9da('0x50')](_0x1fd2b0[_0xe9da('0x4f')],{'$or':_[_0xe9da('0x40')](_0x1fd2b0[_0xe9da('0x4b')],function(_0x2c02f2){var _0x1ba49e={};_0x1ba49e[_0x2c02f2]={'$like':'%'+_0x13ce26[_0xe9da('0x46')][_0xe9da('0x4e')]+'%'};return _0x1ba49e;})});}_0x1fd2b0=_[_0xe9da('0x50')]({},_0x1fd2b0,_0x13ce26[_0xe9da('0x52')]);return db[_0xe9da('0x67')][_0xe9da('0x6a')](_0x1fd2b0);}})[_0xe9da('0x22')](function(_0x3ddf82){if(_0x3ddf82){return db[_0xe9da('0x6b')][_0xe9da('0x6c')]({'where':{'id':_['map'](_0x3ddf82,_0xe9da('0x6d')),'role':_0xe9da('0x6e')},'attributes':['id',_0xe9da('0x3d'),_0xe9da('0x6f'),'updatedAt',_0xe9da('0x70')]});}})['then'](function(_0xae4310){if(_0xae4310){return{'count':_0xae4310['count'],'rows':_[_0xe9da('0x40')](_0xae4310[_0xe9da('0x56')],function(_0x103ba5){return{'membername':_0x103ba5[_0xe9da('0x3d')],'UserId':_0x103ba5['id'],'queue_name':_0x2dd0ea[_0xe9da('0x3d')],'ChatQueueId':_0x2dd0ea['id'],'interface':util['format'](_0xe9da('0x71'),_0xe9da('0x72'),_0x103ba5[_0xe9da('0x3d')]),'penalty':0x0,'paused':_0x103ba5[_0xe9da('0x6f')],'createdAt':_0x103ba5[_0xe9da('0x70')],'updatedAt':_0x103ba5[_0xe9da('0x73')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe9da('0x22')](respondWithFilteredResult(_0xc2c76c,_0x1fd2b0))[_0xe9da('0x62')](handleError(_0xc2c76c,null));};exports[_0xe9da('0x74')]=function(_0x3a792a,_0x4e5557,_0x33c450){var _0x4eb64f={};var _0x272c1e={};var _0x1da574;var _0x38139a;return db[_0xe9da('0x53')][_0xe9da('0x66')]({'where':{'id':_0x3a792a[_0xe9da('0x58')]['id']}})[_0xe9da('0x22')](handleEntityNotFound(_0x4e5557,null))[_0xe9da('0x22')](function(_0x1fecac){if(_0x1fecac){_0x1da574=_0x1fecac;_0x272c1e[_0xe9da('0x45')]=_[_0xe9da('0x47')](db[_0xe9da('0x75')][_0xe9da('0x41')]);_0x272c1e[_0xe9da('0x46')]=_[_0xe9da('0x47')](_0x3a792a[_0xe9da('0x46')]);_0x272c1e[_0xe9da('0x48')]=_[_0xe9da('0x49')](_0x272c1e[_0xe9da('0x45')],_0x272c1e[_0xe9da('0x46')]);_0x4eb64f[_0xe9da('0x4b')]=_[_0xe9da('0x49')](_0x272c1e[_0xe9da('0x45')],qs['fields'](_0x3a792a[_0xe9da('0x46')][_0xe9da('0x4a')]));_0x4eb64f[_0xe9da('0x4b')]=_0x4eb64f['attributes'][_0xe9da('0x59')]?_0x4eb64f['attributes']:_0x272c1e[_0xe9da('0x45')];_0x4eb64f[_0xe9da('0x4c')]=qs['sort'](_0x3a792a['query'][_0xe9da('0x4d')]);_0x4eb64f[_0xe9da('0x4f')]=qs[_0xe9da('0x48')](_[_0xe9da('0x69')](_0x3a792a['query'],_0x272c1e[_0xe9da('0x48')]));if(_0x3a792a[_0xe9da('0x46')][_0xe9da('0x4e')]){_0x4eb64f[_0xe9da('0x4f')]=_['merge'](_0x4eb64f[_0xe9da('0x4f')],{'$or':_[_0xe9da('0x40')](_0x4eb64f[_0xe9da('0x4b')],function(_0x1c705a){var _0x21a31e={};_0x21a31e[_0x1c705a]={'$like':'%'+_0x3a792a[_0xe9da('0x46')][_0xe9da('0x4e')]+'%'};return _0x21a31e;})});}_0x4eb64f=_[_0xe9da('0x50')]({},_0x4eb64f,_0x3a792a['options']);return _0x1da574[_0xe9da('0x74')](_0x4eb64f);}})[_0xe9da('0x22')](function(_0x410342){if(_0x410342){_0x38139a=_0x410342[_0xe9da('0x59')];if(!_0x3a792a['query'][_0xe9da('0x76')](_0xe9da('0x68'))){_0x4eb64f[_0xe9da('0x31')]=qs[_0xe9da('0x31')](_0x3a792a[_0xe9da('0x46')][_0xe9da('0x31')]);_0x4eb64f[_0xe9da('0x2e')]=qs[_0xe9da('0x2e')](_0x3a792a['query']['offset']);}return _0x1da574[_0xe9da('0x74')](_0x4eb64f);}})[_0xe9da('0x22')](function(_0xef6608){if(_0xef6608){return _0xef6608?{'count':_0x38139a,'rows':_0xef6608}:null;}})['then'](respondWithResult(_0x4e5557,null))[_0xe9da('0x62')](handleError(_0x4e5557,null));};exports[_0xe9da('0x77')]=function(_0x232a84,_0x49b0a0,_0x3cff04){var _0x132674=_0x232a84[_0xe9da('0x5c')][_0xe9da('0x78')];return db[_0xe9da('0x75')][_0xe9da('0x6a')]({'where':{'id':_0x132674},'attributes':['id'],'include':[{'model':db[_0xe9da('0x6b')],'as':_0xe9da('0x79'),'attributes':['id','name',_0xe9da('0x7a'),_0xe9da('0x7b'),_0xe9da('0x7c')],'raw':!![]}]})[_0xe9da('0x22')](function(_0x4d56a3){if(_0x4d56a3){var _0x1717cc=_[_0xe9da('0x7d')](_0x4d56a3,function(_0x2553b7){var _0x182ad2=_0x2553b7[_0xe9da('0x39')]({'plain':!![]});return _0x182ad2[_0xe9da('0x79')];});return db['ChatQueue'][_0xe9da('0x5a')]({'where':{'id':_0x232a84[_0xe9da('0x58')]['id']}})[_0xe9da('0x22')](function(_0x5171db){return db[_0xe9da('0x7e')][_0xe9da('0x7f')](function(_0x7fcf23){return _0x5171db[_0xe9da('0x77')](_0x132674,{'transaction':_0x7fcf23})[_0xe9da('0x22')](function(){return BPromise[_0xe9da('0x80')](_0x1717cc,function(_0x13be59){return db[_0xe9da('0x67')][_0xe9da('0x81')]({'where':{'UserId':_0x13be59['id'],'ChatQueueId':_0x232a84[_0xe9da('0x58')]['id']},'transaction':_0x7fcf23});});})[_0xe9da('0x22')](function(){_0x1717cc[_0xe9da('0x82')](function(_0x1c4b17){socket[_0xe9da('0x83')]('userChatQueue:save',{'UserId':_0x1c4b17['id'],'ChatQueueId':_0x5171db['id']});});});});});}})[_0xe9da('0x22')](respondWithStatusCode(_0x49b0a0,null))['catch'](handleError(_0x49b0a0,null));};exports['removeTeams']=function(_0x9735ba,_0x56401f,_0x1114f0){return db[_0xe9da('0x75')][_0xe9da('0x6a')]({'where':{'id':_0x9735ba[_0xe9da('0x46')][_0xe9da('0x78')]},'attributes':['id'],'include':[{'model':db[_0xe9da('0x6b')],'as':_0xe9da('0x79'),'attributes':['id'],'raw':!![]}]})[_0xe9da('0x22')](handleEntityNotFound(_0x56401f,null))[_0xe9da('0x22')](function(_0x49f233){var _0x522ef0=_[_0xe9da('0x40')](_0x49f233,'id');var _0x5ba1c4=[];var _0x20206c=[];var _0x4371fa=squel[_0xe9da('0x84')]();_0x4371fa['field'](_0xe9da('0x85'))['from'](_0xe9da('0x86'),'tq')[_0xe9da('0x87')](_0xe9da('0x88'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xe9da('0x4f')](_0xe9da('0x89'),_0x9735ba['params']['id']);for(var _0x4fed69=0x0;_0x4fed69<_0x49f233[_0xe9da('0x59')];_0x4fed69+=0x1){let _0x2a8b13=_0x49f233[_0x4fed69];for(var _0x1411db=0x0;_0x1411db<_0x2a8b13['Agents'][_0xe9da('0x59')];_0x1411db+=0x1){let _0x3402fc=_0x2a8b13[_0xe9da('0x79')][_0x1411db];var _0x23dfd5=_0x4371fa['clone']();_0x23dfd5[_0xe9da('0x4f')](_0xe9da('0x8a'),_0x3402fc['id']);_0x20206c[_0xe9da('0x8b')](db['sequelize'][_0xe9da('0x46')](_0x23dfd5[_0xe9da('0x8c')](),{'type':db[_0xe9da('0x7e')][_0xe9da('0x8d')]['SELECT']})[_0xe9da('0x22')](function(_0x2a0352){if(_0x2a0352[_0xe9da('0x59')]===0x1){return _0x3402fc['id'];}else{var _0x37fa55=_[_0xe9da('0x8e')](_[_0xe9da('0x40')](_0x2a0352,_0xe9da('0x8f')),function(_0x1e672f){return _[_0xe9da('0x90')](_0x522ef0,_0x1e672f);});if(_0x37fa55){return _0x3402fc['id'];}}}));}}return BPromise[_0xe9da('0x91')](_0x20206c)[_0xe9da('0x22')](function(_0xe8c126){_0x5ba1c4=_(_0x5ba1c4)[_0xe9da('0x92')](_0xe8c126)['compact']()[_0xe9da('0x93')]();return db['ChatQueue'][_0xe9da('0x5a')]({'where':{'id':_0x9735ba['params']['id']}})[_0xe9da('0x22')](function(_0x36e0cd){return db[_0xe9da('0x7e')][_0xe9da('0x7f')](function(_0x3900b9){return _0x36e0cd[_0xe9da('0x94')](_0x9735ba['query'][_0xe9da('0x78')],{'transaction':_0x3900b9})['then'](function(){if(!_['isEmpty'](_0x5ba1c4)){return _0x36e0cd['removeAgents'](_0x5ba1c4,{'transaction':_0x3900b9});}})[_0xe9da('0x22')](function(){_0x5ba1c4['forEach'](function(_0x1c4b20){socket[_0xe9da('0x83')](_0xe9da('0x95'),{'UserId':_0x1c4b20,'ChatQueueId':_0x36e0cd['id']});});});});});});})[_0xe9da('0x22')](respondWithStatusCode(_0x56401f,null))[_0xe9da('0x62')](handleError(_0x56401f,null));};exports[_0xe9da('0x96')]=function(_0x3216be,_0x10819d,_0x4826c0){return db[_0xe9da('0x53')][_0xe9da('0x5a')]({'where':{'id':_0x3216be[_0xe9da('0x58')]['id']}})[_0xe9da('0x22')](handleEntityNotFound(_0x10819d,null))['then'](function(_0x3afc14){if(_0x3afc14){return _0x3afc14[_0xe9da('0x96')](_0x3216be[_0xe9da('0x5c')][_0xe9da('0x78')],_[_0xe9da('0x97')](_0x3216be[_0xe9da('0x5c')],[_0xe9da('0x78'),'id'])||{})[_0xe9da('0x98')](function(_0x403178){for(var _0x5c09dd=0x0;_0x5c09dd<_0x3216be[_0xe9da('0x5c')][_0xe9da('0x78')][_0xe9da('0x59')];_0x5c09dd+=0x1){socket[_0xe9da('0x83')](_0xe9da('0x99'),{'UserId':Number(_0x3216be[_0xe9da('0x5c')][_0xe9da('0x78')][_0x5c09dd]),'ChatQueueId':Number(_0x3216be['params']['id'])});}return _0x403178;});}})[_0xe9da('0x22')](respondWithResult(_0x10819d,null))[_0xe9da('0x62')](handleError(_0x10819d,null));};exports[_0xe9da('0x9a')]=function(_0x107c37,_0x1e05d1,_0x5484bd){return db[_0xe9da('0x53')][_0xe9da('0x5a')]({'where':{'id':_0x107c37[_0xe9da('0x58')]['id']}})[_0xe9da('0x22')](handleEntityNotFound(_0x1e05d1,null))[_0xe9da('0x22')](function(_0xbba64a){if(_0xbba64a){return _0xbba64a[_0xe9da('0x9a')](_0x107c37[_0xe9da('0x46')][_0xe9da('0x78')])['then'](function(){if(_['isArray'](_0x107c37[_0xe9da('0x46')][_0xe9da('0x78')])){for(var _0x591b83=0x0;_0x591b83<_0x107c37[_0xe9da('0x46')]['ids'][_0xe9da('0x59')];_0x591b83+=0x1){socket['emit'](_0xe9da('0x95'),{'UserId':Number(_0x107c37[_0xe9da('0x46')][_0xe9da('0x78')][_0x591b83]),'ChatQueueId':Number(_0x107c37[_0xe9da('0x58')]['id'])});}}else{socket[_0xe9da('0x83')](_0xe9da('0x95'),{'UserId':Number(_0x107c37[_0xe9da('0x46')][_0xe9da('0x78')]),'ChatQueueId':Number(_0x107c37[_0xe9da('0x58')]['id'])});}});}})[_0xe9da('0x22')](respondWithStatusCode(_0x1e05d1,null))[_0xe9da('0x62')](handleError(_0x1e05d1,null));};exports[_0xe9da('0x9b')]=function(_0x11f4d0,_0x3d892a,_0x28a988){var _0x465501={};var _0x482690={};var _0x2ef8d9;var _0x2907eb;return db[_0xe9da('0x53')][_0xe9da('0x66')]({'where':{'id':_0x11f4d0['params']['id']}})[_0xe9da('0x22')](handleEntityNotFound(_0x3d892a,null))['then'](function(_0x20dbf9){if(_0x20dbf9){_0x2ef8d9=_0x20dbf9;_0x482690[_0xe9da('0x45')]=_['keys'](db[_0xe9da('0x6b')][_0xe9da('0x41')]);_0x482690[_0xe9da('0x46')]=_['keys'](_0x11f4d0[_0xe9da('0x46')]);_0x482690[_0xe9da('0x48')]=_[_0xe9da('0x49')](_0x482690[_0xe9da('0x45')],_0x482690[_0xe9da('0x46')]);_0x465501['attributes']=_[_0xe9da('0x49')](_0x482690[_0xe9da('0x45')],qs['fields'](_0x11f4d0['query'][_0xe9da('0x4a')]));_0x465501[_0xe9da('0x4b')]=_0x465501[_0xe9da('0x4b')][_0xe9da('0x59')]?_0x465501[_0xe9da('0x4b')]:_0x482690['model'];_0x465501[_0xe9da('0x4c')]=qs[_0xe9da('0x4d')](_0x11f4d0['query'][_0xe9da('0x4d')]);_0x465501[_0xe9da('0x4f')]=qs[_0xe9da('0x48')](_[_0xe9da('0x69')](_0x11f4d0[_0xe9da('0x46')],_0x482690[_0xe9da('0x48')]));if(_0x11f4d0[_0xe9da('0x46')][_0xe9da('0x4e')]){_0x465501[_0xe9da('0x4f')]=_[_0xe9da('0x50')](_0x465501['where'],{'$or':_[_0xe9da('0x40')](_0x465501[_0xe9da('0x4b')],function(_0x2e52cf){var _0x4635e7={};_0x4635e7[_0x2e52cf]={'$like':'%'+_0x11f4d0[_0xe9da('0x46')][_0xe9da('0x4e')]+'%'};return _0x4635e7;})});}_0x465501=_[_0xe9da('0x50')]({},_0x465501,_0x11f4d0[_0xe9da('0x52')]);return _0x2ef8d9[_0xe9da('0x9b')](_0x465501);}})['then'](function(_0x38facb){if(_0x38facb){_0x2907eb=_0x38facb['length'];if(!_0x11f4d0[_0xe9da('0x46')][_0xe9da('0x76')](_0xe9da('0x68'))){_0x465501[_0xe9da('0x31')]=qs[_0xe9da('0x31')](_0x11f4d0[_0xe9da('0x46')][_0xe9da('0x31')]);_0x465501[_0xe9da('0x2e')]=qs[_0xe9da('0x2e')](_0x11f4d0[_0xe9da('0x46')]['offset']);}return _0x2ef8d9['getAgents'](_0x465501);}})[_0xe9da('0x22')](function(_0xb0f49){if(_0xb0f49){return _0xb0f49?{'count':_0x2907eb,'rows':_0xb0f49}:null;}})[_0xe9da('0x22')](respondWithResult(_0x3d892a,null))[_0xe9da('0x62')](handleError(_0x3d892a,null));}; \ No newline at end of file +var _0x3249=['filter','merge','VIRTUAL','options','findAll','rows','keys','includeAll','include','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','ChatQueueId','UserChatQueue','User','findAndCountAll','UserId','agent','chatPause','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','includes','union','value','isEmpty','removeAgents','emit','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','defaults','redis','localhost','./chatQueue.socket','register','jayson/promise','http','request','then','ChatQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','status','limit','undefined','count','offset','Content-Range','apply','update','get','ChatQueues','destroy','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','model','filters','attributes','intersection','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x31269f,_0x106c91){var _0xa92724=function(_0x376977){while(--_0x376977){_0x31269f['push'](_0x31269f['shift']());}};_0xa92724(++_0x106c91);}(_0x3249,0xdf));var _0x9324=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0x3249[_0x20a558];return _0x53d3f7;};'use strict';var emlformat=require(_0x9324('0x0'));var rimraf=require(_0x9324('0x1'));var zipdir=require(_0x9324('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9324('0x3'));var moment=require('moment');var BPromise=require(_0x9324('0x4'));var Mustache=require('mustache');var util=require(_0x9324('0x5'));var path=require(_0x9324('0x6'));var sox=require('sox');var csv=require(_0x9324('0x7'));var ejs=require(_0x9324('0x8'));var fs=require('fs');var fs_extra=require(_0x9324('0x9'));var _=require(_0x9324('0xa'));var squel=require(_0x9324('0xb'));var crypto=require(_0x9324('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9324('0xd'));var toCsv=require(_0x9324('0x7'));var querystring=require('querystring');var Papa=require(_0x9324('0xe'));var Redis=require(_0x9324('0xf'));var authService=require(_0x9324('0x10'));var qs=require(_0x9324('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9324('0x12'))(_0x9324('0x13'));var utils=require('../../config/utils');var config=require(_0x9324('0x14'));var licenseUtil=require(_0x9324('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x9324('0x16')](config[_0x9324('0x17')],{'host':_0x9324('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9324('0x17')]));require(_0x9324('0x19'))[_0x9324('0x1a')](socket);var jayson=require(_0x9324('0x1b'));var client=jayson['client'][_0x9324('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x158dc0,_0x2edd75,_0xbdf151,_0x3c9a9e){return new BPromise(function(_0x3c2236,_0x4494b6){var _0x49c0da=_0x3c9a9e||client;return _0x49c0da[_0x9324('0x1d')](_0x158dc0,_0xbdf151)[_0x9324('0x1e')](function(_0x578a54){logger['info'](_0x9324('0x1f'),_0x2edd75,'request\x20sent');logger[_0x9324('0x20')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x2edd75,_0x9324('0x21'),JSON[_0x9324('0x22')](_0x578a54));if(_0x578a54['error']){if(_0x578a54[_0x9324('0x23')][_0x9324('0x24')]===0x1f4){logger[_0x9324('0x23')](_0x9324('0x1f'),_0x2edd75,_0x578a54[_0x9324('0x23')]['message']);return _0x4494b6(_0x578a54[_0x9324('0x23')]['message']);}logger[_0x9324('0x23')](_0x9324('0x1f'),_0x2edd75,_0x578a54[_0x9324('0x23')][_0x9324('0x25')]);return _0x3c2236(_0x578a54['error'][_0x9324('0x25')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x2edd75,_0x9324('0x21'));_0x3c2236(_0x578a54[_0x9324('0x26')][_0x9324('0x25')]);}})[_0x9324('0x27')](function(_0x8fffd){logger['error'](_0x9324('0x1f'),_0x2edd75,_0x8fffd);_0x4494b6(_0x8fffd);});});}function respondWithStatusCode(_0x4622c8,_0x3d5235){_0x3d5235=_0x3d5235||0xcc;return function(_0x2c1bc9){if(_0x2c1bc9){return _0x4622c8['sendStatus'](_0x3d5235);}return _0x4622c8[_0x9324('0x28')](_0x3d5235)['end']();};}function respondWithResult(_0x3dda44,_0x2f6f24){_0x2f6f24=_0x2f6f24||0xc8;return function(_0x528a95){if(_0x528a95){return _0x3dda44['status'](_0x2f6f24)['json'](_0x528a95);}};}function respondWithFilteredResult(_0x2b88e9,_0x5846d5){return function(_0x498065){if(_0x498065){var _0x2d2098=typeof _0x5846d5['offset']==='undefined'&&typeof _0x5846d5[_0x9324('0x29')]===_0x9324('0x2a');var _0x47b3d4=_0x498065[_0x9324('0x2b')];var _0x5a7f2f=_0x2d2098?0x0:_0x5846d5[_0x9324('0x2c')];var _0x42aadc=_0x2d2098?_0x498065['count']:_0x5846d5[_0x9324('0x2c')]+_0x5846d5[_0x9324('0x29')];var _0x16acb6;if(_0x42aadc>=_0x47b3d4){_0x42aadc=_0x47b3d4;_0x16acb6=0xc8;}else{_0x16acb6=0xce;}_0x2b88e9[_0x9324('0x28')](_0x16acb6);return _0x2b88e9['set'](_0x9324('0x2d'),_0x5a7f2f+'-'+_0x42aadc+'/'+_0x47b3d4)['json'](_0x498065);}return null;};}function patchUpdates(_0x4337c7){return function(_0x43190c){try{jsonpatch[_0x9324('0x2e')](_0x43190c,_0x4337c7,!![]);}catch(_0x2e3e1d){return BPromise['reject'](_0x2e3e1d);}return _0x43190c['save']();};}function saveUpdates(_0x5c505a,_0x11984a){return function(_0x283d16){if(_0x283d16){return _0x283d16[_0x9324('0x2f')](_0x5c505a)[_0x9324('0x1e')](function(_0x337e19){return _0x337e19;});}return null;};}function removeEntity(_0x39d108,_0x1e256d){return function(_0x192ed4){if(_0x192ed4){return _0x192ed4['destroy']()[_0x9324('0x1e')](function(){var _0x264eee=_0x192ed4[_0x9324('0x30')]({'plain':!![]});var _0x4ed385=_0x9324('0x31');return db['UserProfileResource'][_0x9324('0x32')]({'where':{'type':_0x4ed385,'resourceId':_0x264eee['id']}})[_0x9324('0x1e')](function(){return _0x192ed4;});})[_0x9324('0x1e')](function(){_0x39d108[_0x9324('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x342c1d,_0x468595){return function(_0x1b2aa6){if(!_0x1b2aa6){_0x342c1d['sendStatus'](0x194);}return _0x1b2aa6;};}function handleError(_0x19c343,_0x214af8){_0x214af8=_0x214af8||0x1f4;return function(_0x56cbf8){logger['error'](_0x56cbf8[_0x9324('0x33')]);if(_0x56cbf8['name']){delete _0x56cbf8[_0x9324('0x34')];}_0x19c343[_0x9324('0x28')](_0x214af8)[_0x9324('0x35')](_0x56cbf8);};}exports[_0x9324('0x36')]=function(_0x420650,_0x351b00){var _0x140e98={},_0x3e124c={},_0x996e27={'count':0x0,'rows':[]};var _0x4a68ab=_[_0x9324('0x37')](db[_0x9324('0x38')][_0x9324('0x39')],function(_0xbe8874){return{'name':_0xbe8874[_0x9324('0x3a')],'type':_0xbe8874[_0x9324('0x3b')]['key']};});_0x3e124c[_0x9324('0x3c')]=_[_0x9324('0x37')](_0x4a68ab,_0x9324('0x34'));_0x3e124c['query']=_['keys'](_0x420650['query']);_0x3e124c[_0x9324('0x3d')]=_['intersection'](_0x3e124c[_0x9324('0x3c')],_0x3e124c['query']);_0x140e98[_0x9324('0x3e')]=_[_0x9324('0x3f')](_0x3e124c['model'],qs[_0x9324('0x40')](_0x420650[_0x9324('0x41')][_0x9324('0x40')]));_0x140e98[_0x9324('0x3e')]=_0x140e98[_0x9324('0x3e')][_0x9324('0x42')]?_0x140e98[_0x9324('0x3e')]:_0x3e124c[_0x9324('0x3c')];if(!_0x420650[_0x9324('0x41')][_0x9324('0x43')](_0x9324('0x44'))){_0x140e98['limit']=qs[_0x9324('0x29')](_0x420650[_0x9324('0x41')][_0x9324('0x29')]);_0x140e98['offset']=qs[_0x9324('0x2c')](_0x420650['query']['offset']);}_0x140e98[_0x9324('0x45')]=qs[_0x9324('0x46')](_0x420650[_0x9324('0x41')]['sort']);_0x140e98[_0x9324('0x47')]=qs[_0x9324('0x3d')](_[_0x9324('0x48')](_0x420650[_0x9324('0x41')],_0x3e124c[_0x9324('0x3d')]),_0x4a68ab);if(_0x420650['query'][_0x9324('0x49')]){_0x140e98[_0x9324('0x47')]=_[_0x9324('0x4a')](_0x140e98[_0x9324('0x47')],{'$or':_[_0x9324('0x37')](_0x4a68ab,function(_0x224b24){if(_0x224b24[_0x9324('0x3b')]!==_0x9324('0x4b')){var _0x4db13b={};_0x4db13b[_0x224b24[_0x9324('0x34')]]={'$like':'%'+_0x420650[_0x9324('0x41')][_0x9324('0x49')]+'%'};return _0x4db13b;}})});}_0x140e98=_[_0x9324('0x4a')]({},_0x140e98,_0x420650[_0x9324('0x4c')]);var _0x41dd56={'where':_0x140e98[_0x9324('0x47')]};return db[_0x9324('0x38')][_0x9324('0x2b')](_0x41dd56)[_0x9324('0x1e')](function(_0x2243ae){_0x996e27[_0x9324('0x2b')]=_0x2243ae;if(_0x420650[_0x9324('0x41')]['includeAll']){_0x140e98['include']=[{'all':!![]}];}return db[_0x9324('0x38')][_0x9324('0x4d')](_0x140e98);})[_0x9324('0x1e')](function(_0x4bff6e){_0x996e27[_0x9324('0x4e')]=_0x4bff6e;return _0x996e27;})['then'](respondWithFilteredResult(_0x351b00,_0x140e98))[_0x9324('0x27')](handleError(_0x351b00,null));};exports['show']=function(_0x3ff40f,_0x583ee9){var _0x1084be={'raw':!![],'where':{'id':_0x3ff40f['params']['id']}},_0x4a0181={};_0x4a0181['model']=_[_0x9324('0x4f')](db[_0x9324('0x38')][_0x9324('0x39')]);_0x4a0181['query']=_[_0x9324('0x4f')](_0x3ff40f[_0x9324('0x41')]);_0x4a0181['filters']=_[_0x9324('0x3f')](_0x4a0181[_0x9324('0x3c')],_0x4a0181['query']);_0x1084be[_0x9324('0x3e')]=_['intersection'](_0x4a0181[_0x9324('0x3c')],qs[_0x9324('0x40')](_0x3ff40f[_0x9324('0x41')][_0x9324('0x40')]));_0x1084be[_0x9324('0x3e')]=_0x1084be['attributes']['length']?_0x1084be[_0x9324('0x3e')]:_0x4a0181['model'];if(_0x3ff40f[_0x9324('0x41')][_0x9324('0x50')]){_0x1084be[_0x9324('0x51')]=[{'all':!![]}];}_0x1084be=_[_0x9324('0x4a')]({},_0x1084be,_0x3ff40f[_0x9324('0x4c')]);return db[_0x9324('0x38')][_0x9324('0x52')](_0x1084be)['then'](handleEntityNotFound(_0x583ee9,null))[_0x9324('0x1e')](respondWithResult(_0x583ee9,null))[_0x9324('0x27')](handleError(_0x583ee9,null));};exports['create']=function(_0x1bf5fb,_0x2e8d4e){return db[_0x9324('0x38')]['create'](_0x1bf5fb[_0x9324('0x53')],{})[_0x9324('0x1e')](function(_0xed59af){var _0x3ad6d3=_0x1bf5fb['user'][_0x9324('0x30')]({'plain':!![]});if(!_0x3ad6d3)throw new Error(_0x9324('0x54'));if(_0x3ad6d3[_0x9324('0x55')]===_0x9324('0x56')){var _0x226f35=_0xed59af[_0x9324('0x30')]({'plain':!![]});var _0x52e1d0=_0x9324('0x31');return db[_0x9324('0x57')][_0x9324('0x52')]({'where':{'name':_0x52e1d0,'userProfileId':_0x3ad6d3[_0x9324('0x58')]},'raw':!![]})[_0x9324('0x1e')](function(_0x3d05ea){if(_0x3d05ea&&_0x3d05ea[_0x9324('0x59')]===0x0){return db['UserProfileResource'][_0x9324('0x5a')]({'name':_0x226f35['name'],'resourceId':_0x226f35['id'],'type':_0x3d05ea['name'],'sectionId':_0x3d05ea['id']},{})[_0x9324('0x1e')](function(){return _0xed59af;});}else{return _0xed59af;}})['catch'](function(_0x5a9709){logger[_0x9324('0x23')](_0x9324('0x5b'),_0x5a9709);throw _0x5a9709;});}return _0xed59af;})[_0x9324('0x1e')](respondWithResult(_0x2e8d4e,0xc9))[_0x9324('0x27')](handleError(_0x2e8d4e,null));};exports[_0x9324('0x2f')]=function(_0x5356d7,_0x239fc5){if(_0x5356d7[_0x9324('0x53')]['id']){delete _0x5356d7[_0x9324('0x53')]['id'];}return db[_0x9324('0x38')][_0x9324('0x52')]({'where':{'id':_0x5356d7[_0x9324('0x5c')]['id']}})['then'](handleEntityNotFound(_0x239fc5,null))[_0x9324('0x1e')](saveUpdates(_0x5356d7['body'],null))['then'](respondWithResult(_0x239fc5,null))[_0x9324('0x27')](handleError(_0x239fc5,null));};exports[_0x9324('0x32')]=function(_0x36db26,_0x5ba65f){return db[_0x9324('0x38')][_0x9324('0x52')]({'where':{'id':_0x36db26['params']['id']}})[_0x9324('0x1e')](handleEntityNotFound(_0x5ba65f,null))[_0x9324('0x1e')](removeEntity(_0x5ba65f,null))[_0x9324('0x27')](handleError(_0x5ba65f,null));};exports[_0x9324('0x5d')]=function(_0xd814bd,_0x4db091){return db[_0x9324('0x38')][_0x9324('0x5d')]()[_0x9324('0x1e')](respondWithResult(_0x4db091,null))[_0x9324('0x27')](handleError(_0x4db091,null));};exports[_0x9324('0x5e')]=function(_0x1cade7,_0xe3ff3c,_0x300c22){var _0x24a39f={'raw':!![],'where':{}},_0x57328d={},_0x1539e1;return db['ChatQueue'][_0x9324('0x5f')]({'where':{'id':_0x1cade7[_0x9324('0x5c')]['id']}})['then'](handleEntityNotFound(_0xe3ff3c,null))['then'](function(_0x4003f2){if(_0x4003f2){_0x1539e1=_0x4003f2['get']({'plain':!![]});_0x57328d['model']=_[_0x9324('0x4f')](db['UserChatQueue'][_0x9324('0x39')]);_0x57328d[_0x9324('0x41')]=_[_0x9324('0x4f')](_0x1cade7[_0x9324('0x41')]);_0x57328d[_0x9324('0x3d')]=_[_0x9324('0x3f')](_0x57328d[_0x9324('0x3c')],_0x57328d['query']);_0x24a39f[_0x9324('0x3e')]=_[_0x9324('0x3f')](_0x57328d[_0x9324('0x3c')],qs['fields'](_0x1cade7[_0x9324('0x41')][_0x9324('0x40')]));_0x24a39f[_0x9324('0x3e')]=_0x24a39f[_0x9324('0x3e')][_0x9324('0x42')]?_0x24a39f[_0x9324('0x3e')]:_0x57328d[_0x9324('0x3c')];if(!_0x1cade7[_0x9324('0x41')][_0x9324('0x43')]('nolimit')){_0x24a39f[_0x9324('0x29')]=qs[_0x9324('0x29')](_0x1cade7[_0x9324('0x41')][_0x9324('0x29')]);_0x24a39f['offset']=qs[_0x9324('0x2c')](_0x1cade7[_0x9324('0x41')][_0x9324('0x2c')]);}_0x24a39f[_0x9324('0x45')]=qs[_0x9324('0x46')](_0x1cade7['query'][_0x9324('0x46')]);_0x24a39f[_0x9324('0x47')]=qs['filters'](_['pick'](_0x1cade7[_0x9324('0x41')],_0x57328d[_0x9324('0x3d')]));_0x24a39f['where'][_0x9324('0x60')]=_0x4003f2['id'];if(_0x1cade7['query'][_0x9324('0x49')]){_0x24a39f[_0x9324('0x47')]=_['merge'](_0x24a39f[_0x9324('0x47')],{'$or':_[_0x9324('0x37')](_0x24a39f[_0x9324('0x3e')],function(_0x389b72){var _0xde7d6c={};_0xde7d6c[_0x389b72]={'$like':'%'+_0x1cade7[_0x9324('0x41')]['filter']+'%'};return _0xde7d6c;})});}_0x24a39f=_[_0x9324('0x4a')]({},_0x24a39f,_0x1cade7[_0x9324('0x4c')]);return db[_0x9324('0x61')]['findAll'](_0x24a39f);}})[_0x9324('0x1e')](function(_0x16563e){if(_0x16563e){return db[_0x9324('0x62')][_0x9324('0x63')]({'where':{'id':_[_0x9324('0x37')](_0x16563e,_0x9324('0x64')),'role':_0x9324('0x65')},'attributes':['id','name',_0x9324('0x66'),'updatedAt',_0x9324('0x67')]});}})[_0x9324('0x1e')](function(_0x598ace){if(_0x598ace){return{'count':_0x598ace[_0x9324('0x2b')],'rows':_[_0x9324('0x37')](_0x598ace[_0x9324('0x4e')],function(_0x3238ac){return{'membername':_0x3238ac[_0x9324('0x34')],'UserId':_0x3238ac['id'],'queue_name':_0x1539e1['name'],'ChatQueueId':_0x1539e1['id'],'interface':util[_0x9324('0x68')](_0x9324('0x69'),_0x9324('0x6a'),_0x3238ac['name']),'penalty':0x0,'paused':_0x3238ac['chatPause'],'createdAt':_0x3238ac[_0x9324('0x67')],'updatedAt':_0x3238ac['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x9324('0x1e')](respondWithFilteredResult(_0xe3ff3c,_0x24a39f))['catch'](handleError(_0xe3ff3c,null));};exports[_0x9324('0x6b')]=function(_0x57b741,_0x2f3829,_0x501e4a){var _0x292881={};var _0x1b5705={};var _0x52f6e7;var _0x19d2d9;return db[_0x9324('0x38')][_0x9324('0x5f')]({'where':{'id':_0x57b741['params']['id']}})[_0x9324('0x1e')](handleEntityNotFound(_0x2f3829,null))[_0x9324('0x1e')](function(_0x3b4f02){if(_0x3b4f02){_0x52f6e7=_0x3b4f02;_0x1b5705['model']=_['keys'](db[_0x9324('0x6c')][_0x9324('0x39')]);_0x1b5705['query']=_[_0x9324('0x4f')](_0x57b741[_0x9324('0x41')]);_0x1b5705['filters']=_['intersection'](_0x1b5705['model'],_0x1b5705[_0x9324('0x41')]);_0x292881[_0x9324('0x3e')]=_[_0x9324('0x3f')](_0x1b5705[_0x9324('0x3c')],qs[_0x9324('0x40')](_0x57b741[_0x9324('0x41')][_0x9324('0x40')]));_0x292881['attributes']=_0x292881[_0x9324('0x3e')][_0x9324('0x42')]?_0x292881['attributes']:_0x1b5705[_0x9324('0x3c')];_0x292881[_0x9324('0x45')]=qs[_0x9324('0x46')](_0x57b741[_0x9324('0x41')][_0x9324('0x46')]);_0x292881[_0x9324('0x47')]=qs['filters'](_[_0x9324('0x48')](_0x57b741['query'],_0x1b5705[_0x9324('0x3d')]));if(_0x57b741['query'][_0x9324('0x49')]){_0x292881['where']=_[_0x9324('0x4a')](_0x292881[_0x9324('0x47')],{'$or':_[_0x9324('0x37')](_0x292881[_0x9324('0x3e')],function(_0x215751){var _0x33a118={};_0x33a118[_0x215751]={'$like':'%'+_0x57b741[_0x9324('0x41')][_0x9324('0x49')]+'%'};return _0x33a118;})});}_0x292881=_['merge']({},_0x292881,_0x57b741[_0x9324('0x4c')]);return _0x52f6e7['getTeams'](_0x292881);}})[_0x9324('0x1e')](function(_0x506f46){if(_0x506f46){_0x19d2d9=_0x506f46[_0x9324('0x42')];if(!_0x57b741[_0x9324('0x41')][_0x9324('0x43')](_0x9324('0x44'))){_0x292881[_0x9324('0x29')]=qs[_0x9324('0x29')](_0x57b741[_0x9324('0x41')][_0x9324('0x29')]);_0x292881[_0x9324('0x2c')]=qs[_0x9324('0x2c')](_0x57b741[_0x9324('0x41')][_0x9324('0x2c')]);}return _0x52f6e7[_0x9324('0x6b')](_0x292881);}})[_0x9324('0x1e')](function(_0x2148fc){if(_0x2148fc){return _0x2148fc?{'count':_0x19d2d9,'rows':_0x2148fc}:null;}})['then'](respondWithResult(_0x2f3829,null))['catch'](handleError(_0x2f3829,null));};exports[_0x9324('0x6d')]=function(_0x47527f,_0x2d73cf,_0x171d97){var _0x44b4f7=_0x47527f[_0x9324('0x53')][_0x9324('0x6e')];return db[_0x9324('0x6c')][_0x9324('0x4d')]({'where':{'id':_0x44b4f7},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9324('0x6f'),'attributes':['id',_0x9324('0x34'),_0x9324('0x70'),_0x9324('0x71'),_0x9324('0x72')],'raw':!![]}]})[_0x9324('0x1e')](function(_0x5f339f){if(_0x5f339f){var _0x5147cc=_[_0x9324('0x73')](_0x5f339f,function(_0x50c26e){var _0x2fcb1b=_0x50c26e[_0x9324('0x30')]({'plain':!![]});return _0x2fcb1b[_0x9324('0x6f')];});return db[_0x9324('0x38')][_0x9324('0x52')]({'where':{'id':_0x47527f[_0x9324('0x5c')]['id']}})[_0x9324('0x1e')](function(_0xaae724){return db[_0x9324('0x74')][_0x9324('0x75')](function(_0x3d0239){return _0xaae724['addTeams'](_0x44b4f7,{'transaction':_0x3d0239})[_0x9324('0x1e')](function(){return BPromise[_0x9324('0x76')](_0x5147cc,function(_0x42759e){return db[_0x9324('0x61')][_0x9324('0x77')]({'where':{'UserId':_0x42759e['id'],'ChatQueueId':_0x47527f[_0x9324('0x5c')]['id']},'transaction':_0x3d0239});});})['then'](function(){_0x5147cc[_0x9324('0x78')](function(_0x368422){socket['emit'](_0x9324('0x79'),{'UserId':_0x368422['id'],'ChatQueueId':_0xaae724['id']});});});});});}})['then'](respondWithStatusCode(_0x2d73cf,null))[_0x9324('0x27')](handleError(_0x2d73cf,null));};exports[_0x9324('0x7a')]=function(_0x515968,_0x58d46e,_0x21f782){return db['Team'][_0x9324('0x4d')]({'where':{'id':_0x515968[_0x9324('0x41')][_0x9324('0x6e')]},'attributes':['id'],'include':[{'model':db[_0x9324('0x62')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x9324('0x1e')](handleEntityNotFound(_0x58d46e,null))[_0x9324('0x1e')](function(_0x3e6ecb){var _0x39a3e1=_[_0x9324('0x37')](_0x3e6ecb,'id');var _0x5cb73d=[];var _0x2045c6=[];var _0x57bb35=squel[_0x9324('0x7b')]();_0x57bb35[_0x9324('0x7c')](_0x9324('0x7d'))[_0x9324('0x7e')](_0x9324('0x7f'),'tq')[_0x9324('0x80')](_0x9324('0x81'),'ut',_0x9324('0x82'))[_0x9324('0x47')](_0x9324('0x83'),_0x515968[_0x9324('0x5c')]['id']);for(var _0x480667=0x0;_0x480667<_0x3e6ecb[_0x9324('0x42')];_0x480667+=0x1){let _0x49b41a=_0x3e6ecb[_0x480667];for(var _0x579d99=0x0;_0x579d99<_0x49b41a['Agents'][_0x9324('0x42')];_0x579d99+=0x1){let _0x39e59a=_0x49b41a[_0x9324('0x6f')][_0x579d99];var _0x25f1fe=_0x57bb35['clone']();_0x25f1fe[_0x9324('0x47')](_0x9324('0x84'),_0x39e59a['id']);_0x2045c6[_0x9324('0x85')](db[_0x9324('0x74')][_0x9324('0x41')](_0x25f1fe[_0x9324('0x86')](),{'type':db[_0x9324('0x74')][_0x9324('0x87')]['SELECT']})['then'](function(_0x2105d4){if(_0x2105d4[_0x9324('0x42')]===0x1){return _0x39e59a['id'];}else{var _0x41cf73=_['every'](_['map'](_0x2105d4,'TeamId'),function(_0x3993ec){return _[_0x9324('0x88')](_0x39a3e1,_0x3993ec);});if(_0x41cf73){return _0x39e59a['id'];}}}));}}return BPromise['all'](_0x2045c6)['then'](function(_0x23e2f1){_0x5cb73d=_(_0x5cb73d)[_0x9324('0x89')](_0x23e2f1)['compact']()[_0x9324('0x8a')]();return db[_0x9324('0x38')]['find']({'where':{'id':_0x515968[_0x9324('0x5c')]['id']}})['then'](function(_0x18cfba){return db[_0x9324('0x74')][_0x9324('0x75')](function(_0x414342){return _0x18cfba[_0x9324('0x7a')](_0x515968[_0x9324('0x41')][_0x9324('0x6e')],{'transaction':_0x414342})[_0x9324('0x1e')](function(){if(!_[_0x9324('0x8b')](_0x5cb73d)){return _0x18cfba[_0x9324('0x8c')](_0x5cb73d,{'transaction':_0x414342});}})[_0x9324('0x1e')](function(){_0x5cb73d['forEach'](function(_0x2f79d7){socket[_0x9324('0x8d')](_0x9324('0x8e'),{'UserId':_0x2f79d7,'ChatQueueId':_0x18cfba['id']});});});});});});})[_0x9324('0x1e')](respondWithStatusCode(_0x58d46e,null))[_0x9324('0x27')](handleError(_0x58d46e,null));};exports[_0x9324('0x8f')]=function(_0xeaefdc,_0x50c314,_0x105c36){return db[_0x9324('0x38')][_0x9324('0x52')]({'where':{'id':_0xeaefdc[_0x9324('0x5c')]['id']}})[_0x9324('0x1e')](handleEntityNotFound(_0x50c314,null))[_0x9324('0x1e')](function(_0x553f95){if(_0x553f95){return _0x553f95[_0x9324('0x8f')](_0xeaefdc['body']['ids'],_[_0x9324('0x90')](_0xeaefdc[_0x9324('0x53')],[_0x9324('0x6e'),'id'])||{})[_0x9324('0x91')](function(_0x5d7194){for(var _0x339215=0x0;_0x339215<_0xeaefdc[_0x9324('0x53')]['ids'][_0x9324('0x42')];_0x339215+=0x1){socket[_0x9324('0x8d')](_0x9324('0x79'),{'UserId':Number(_0xeaefdc[_0x9324('0x53')][_0x9324('0x6e')][_0x339215]),'ChatQueueId':Number(_0xeaefdc[_0x9324('0x5c')]['id'])});}return _0x5d7194;});}})['then'](respondWithResult(_0x50c314,null))[_0x9324('0x27')](handleError(_0x50c314,null));};exports['removeAgents']=function(_0x576fbc,_0x3d38bc,_0x46843e){return db[_0x9324('0x38')][_0x9324('0x52')]({'where':{'id':_0x576fbc[_0x9324('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3d38bc,null))[_0x9324('0x1e')](function(_0x4bd6be){if(_0x4bd6be){return _0x4bd6be[_0x9324('0x8c')](_0x576fbc[_0x9324('0x41')][_0x9324('0x6e')])['then'](function(){if(_[_0x9324('0x92')](_0x576fbc[_0x9324('0x41')][_0x9324('0x6e')])){for(var _0xdc7f99=0x0;_0xdc7f99<_0x576fbc[_0x9324('0x41')][_0x9324('0x6e')][_0x9324('0x42')];_0xdc7f99+=0x1){socket[_0x9324('0x8d')](_0x9324('0x8e'),{'UserId':Number(_0x576fbc[_0x9324('0x41')]['ids'][_0xdc7f99]),'ChatQueueId':Number(_0x576fbc[_0x9324('0x5c')]['id'])});}}else{socket['emit']('userChatQueue:remove',{'UserId':Number(_0x576fbc['query']['ids']),'ChatQueueId':Number(_0x576fbc[_0x9324('0x5c')]['id'])});}});}})[_0x9324('0x1e')](respondWithStatusCode(_0x3d38bc,null))['catch'](handleError(_0x3d38bc,null));};exports[_0x9324('0x93')]=function(_0x1be53d,_0x3faf48,_0x47479f){var _0x795b70={};var _0xfe8baa={};var _0x56b78a;var _0xb969c7;return db[_0x9324('0x38')][_0x9324('0x5f')]({'where':{'id':_0x1be53d[_0x9324('0x5c')]['id']}})[_0x9324('0x1e')](handleEntityNotFound(_0x3faf48,null))[_0x9324('0x1e')](function(_0x11d9db){if(_0x11d9db){_0x56b78a=_0x11d9db;_0xfe8baa[_0x9324('0x3c')]=_['keys'](db[_0x9324('0x62')][_0x9324('0x39')]);_0xfe8baa[_0x9324('0x41')]=_[_0x9324('0x4f')](_0x1be53d[_0x9324('0x41')]);_0xfe8baa[_0x9324('0x3d')]=_['intersection'](_0xfe8baa[_0x9324('0x3c')],_0xfe8baa['query']);_0x795b70[_0x9324('0x3e')]=_['intersection'](_0xfe8baa[_0x9324('0x3c')],qs[_0x9324('0x40')](_0x1be53d[_0x9324('0x41')][_0x9324('0x40')]));_0x795b70[_0x9324('0x3e')]=_0x795b70[_0x9324('0x3e')][_0x9324('0x42')]?_0x795b70['attributes']:_0xfe8baa[_0x9324('0x3c')];_0x795b70['order']=qs[_0x9324('0x46')](_0x1be53d['query']['sort']);_0x795b70[_0x9324('0x47')]=qs[_0x9324('0x3d')](_[_0x9324('0x48')](_0x1be53d[_0x9324('0x41')],_0xfe8baa['filters']));if(_0x1be53d[_0x9324('0x41')][_0x9324('0x49')]){_0x795b70[_0x9324('0x47')]=_[_0x9324('0x4a')](_0x795b70[_0x9324('0x47')],{'$or':_[_0x9324('0x37')](_0x795b70['attributes'],function(_0x28c11b){var _0xecbb81={};_0xecbb81[_0x28c11b]={'$like':'%'+_0x1be53d[_0x9324('0x41')][_0x9324('0x49')]+'%'};return _0xecbb81;})});}_0x795b70=_[_0x9324('0x4a')]({},_0x795b70,_0x1be53d['options']);return _0x56b78a[_0x9324('0x93')](_0x795b70);}})[_0x9324('0x1e')](function(_0x81a82f){if(_0x81a82f){_0xb969c7=_0x81a82f[_0x9324('0x42')];if(!_0x1be53d['query'][_0x9324('0x43')](_0x9324('0x44'))){_0x795b70[_0x9324('0x29')]=qs[_0x9324('0x29')](_0x1be53d['query'][_0x9324('0x29')]);_0x795b70[_0x9324('0x2c')]=qs[_0x9324('0x2c')](_0x1be53d['query'][_0x9324('0x2c')]);}return _0x56b78a[_0x9324('0x93')](_0x795b70);}})['then'](function(_0x58c986){if(_0x58c986){return _0x58c986?{'count':_0xb969c7,'rows':_0x58c986}:null;}})[_0x9324('0x1e')](respondWithResult(_0x3faf48,null))[_0x9324('0x27')](handleError(_0x3faf48,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index c39e70d..a2ef52a 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 _0xaaf2=['exports','../../mysqldb','ChatQueue','save','update','remove','emit','hasOwnProperty','hook'];(function(_0xaec2d4,_0x3a1970){var _0x37955f=function(_0x38b4ae){while(--_0x38b4ae){_0xaec2d4['push'](_0xaec2d4['shift']());}};_0x37955f(++_0x3a1970);}(_0xaaf2,0x169));var _0x2aaf=function(_0x5e81c1,_0x2fd6f1){_0x5e81c1=_0x5e81c1-0x0;var _0x4a2940=_0xaaf2[_0x5e81c1];return _0x4a2940;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x2aaf('0x0'))['db'][_0x2aaf('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2aaf('0x2'),'afterUpdate':_0x2aaf('0x3'),'afterDestroy':_0x2aaf('0x4')};function emitEvent(_0x58b8d4){return function(_0x2e17f9,_0x274410,_0x2b189b){ChatQueueEvents['emit'](_0x58b8d4+':'+_0x2e17f9['id'],_0x2e17f9);ChatQueueEvents[_0x2aaf('0x5')](_0x58b8d4,_0x2e17f9);_0x2b189b(null);};}for(var e in events){if(events[_0x2aaf('0x6')](e)){var event=events[e];ChatQueue[_0x2aaf('0x7')](e,emitEvent(event));}}module[_0x2aaf('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0xa920=['update','emit','hook','exports','../../mysqldb','ChatQueue','setMaxListeners','save'];(function(_0x3909f9,_0x19089f){var _0x4f82a6=function(_0x8e278d){while(--_0x8e278d){_0x3909f9['push'](_0x3909f9['shift']());}};_0x4f82a6(++_0x19089f);}(_0xa920,0x7c));var _0x0a92=function(_0xf98445,_0x3fc80d){_0xf98445=_0xf98445-0x0;var _0x5283a9=_0xa920[_0xf98445];return _0x5283a9;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x0a92('0x0'))['db'][_0x0a92('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x0a92('0x2')](0x0);var events={'afterCreate':_0x0a92('0x3'),'afterUpdate':_0x0a92('0x4'),'afterDestroy':'remove'};function emitEvent(_0x44e704){return function(_0x5b9733,_0x2cb645,_0xb34057){ChatQueueEvents[_0x0a92('0x5')](_0x44e704+':'+_0x5b9733['id'],_0x5b9733);ChatQueueEvents[_0x0a92('0x5')](_0x44e704,_0x5b9733);_0xb34057(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x0a92('0x6')](e,emitEvent(event));}}module[_0x0a92('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 1be55bf..b81f42b 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 _0x3d80=['./chatQueue.attributes','exports','ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0xca18be,_0x5bbe40){var _0x2815ad=function(_0x19b785){while(--_0x19b785){_0xca18be['push'](_0xca18be['shift']());}};_0x2815ad(++_0x5bbe40);}(_0x3d80,0xe1));var _0x03d8=function(_0x525996,_0x30fe51){_0x525996=_0x525996-0x0;var _0x43148d=_0x3d80[_0x525996];return _0x43148d;};'use strict';var _=require(_0x03d8('0x0'));var util=require(_0x03d8('0x1'));var logger=require(_0x03d8('0x2'))(_0x03d8('0x3'));var moment=require(_0x03d8('0x4'));var BPromise=require(_0x03d8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x03d8('0x6'));var rimraf=require(_0x03d8('0x7'));var config=require(_0x03d8('0x8'));var attributes=require(_0x03d8('0x9'));module[_0x03d8('0xa')]=function(_0x4ff501,_0x4fb94f){return _0x4ff501['define'](_0x03d8('0xb'),attributes,{'tableName':_0x03d8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e06=['chat_queues','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./chatQueue.attributes','exports','ChatQueue'];(function(_0x103268,_0x314281){var _0x38d1cc=function(_0x436073){while(--_0x436073){_0x103268['push'](_0x103268['shift']());}};_0x38d1cc(++_0x314281);}(_0x6e06,0x181));var _0x66e0=function(_0xda0da5,_0x51508c){_0xda0da5=_0xda0da5-0x0;var _0x2e4970=_0x6e06[_0xda0da5];return _0x2e4970;};'use strict';var _=require(_0x66e0('0x0'));var util=require(_0x66e0('0x1'));var logger=require(_0x66e0('0x2'))(_0x66e0('0x3'));var moment=require(_0x66e0('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x66e0('0x5'));var rimraf=require(_0x66e0('0x6'));var config=require(_0x66e0('0x7'));var attributes=require(_0x66e0('0x8'));module[_0x66e0('0x9')]=function(_0x3ddd91,_0x542f5f){return _0x3ddd91['define'](_0x66e0('0xa'),attributes,{'tableName':_0x66e0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 3695a83..af6a10b 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 _0xb36b=['options','where','attributes','limit','include','map','model','then','catch','find','raw','ShowChatQueue','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatQueue.socket','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetChatQueue','ChatQueue'];(function(_0x2842b4,_0x2b1b7b){var _0x2b9521=function(_0x3613b8){while(--_0x3613b8){_0x2842b4['push'](_0x2842b4['shift']());}};_0x2b9521(++_0x2b1b7b);}(_0xb36b,0xac));var _0xbb36=function(_0x1da029,_0x42465a){_0x1da029=_0x1da029-0x0;var _0xd9230=_0xb36b[_0x1da029];return _0xd9230;};'use strict';var _=require(_0xbb36('0x0'));var util=require('util');var moment=require(_0xbb36('0x1'));var BPromise=require(_0xbb36('0x2'));var rs=require(_0xbb36('0x3'));var fs=require('fs');var Redis=require(_0xbb36('0x4'));var db=require(_0xbb36('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbb36('0x6'))(_0xbb36('0x7'));var config=require(_0xbb36('0x8'));var jayson=require(_0xbb36('0x9'));var client=jayson[_0xbb36('0xa')][_0xbb36('0xb')]({'port':0x232a});config[_0xbb36('0xc')]=_[_0xbb36('0xd')](config[_0xbb36('0xc')],{'host':_0xbb36('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xbb36('0xf'))['register'](socket);function respondWithRpcPromise(_0x4c898e,_0x1018eb,_0xb631ee){return new BPromise(function(_0x3ca4b2,_0x3e28d1){return client[_0xbb36('0x10')](_0x4c898e,_0xb631ee)['then'](function(_0x210f11){logger[_0xbb36('0x11')](_0xbb36('0x12'),_0x1018eb,_0xbb36('0x13'));logger['debug'](_0xbb36('0x14'),_0x1018eb,_0xbb36('0x13'),JSON[_0xbb36('0x15')](_0x210f11));if(_0x210f11[_0xbb36('0x16')]){if(_0x210f11[_0xbb36('0x16')][_0xbb36('0x17')]===0x1f4){logger[_0xbb36('0x16')](_0xbb36('0x12'),_0x1018eb,_0x210f11[_0xbb36('0x16')][_0xbb36('0x18')]);return _0x3e28d1(_0x210f11[_0xbb36('0x16')]['message']);}logger[_0xbb36('0x16')](_0xbb36('0x12'),_0x1018eb,_0x210f11[_0xbb36('0x16')][_0xbb36('0x18')]);return _0x3ca4b2(_0x210f11[_0xbb36('0x16')][_0xbb36('0x18')]);}else{logger[_0xbb36('0x11')](_0xbb36('0x12'),_0x1018eb,_0xbb36('0x13'));_0x3ca4b2(_0x210f11[_0xbb36('0x19')]['message']);}})['catch'](function(_0x416b26){logger[_0xbb36('0x16')](_0xbb36('0x12'),_0x1018eb,_0x416b26);_0x3e28d1(_0x416b26);});});}exports[_0xbb36('0x1a')]=function(_0x3bc201){var _0x17a97b=this;return new Promise(function(_0x217b4d,_0x22d35e){return db[_0xbb36('0x1b')]['findAll']({'raw':_0x3bc201[_0xbb36('0x1c')]?_0x3bc201[_0xbb36('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x3bc201[_0xbb36('0x1c')]?_0x3bc201[_0xbb36('0x1c')][_0xbb36('0x1d')]||null:null,'attributes':_0x3bc201[_0xbb36('0x1c')]?_0x3bc201[_0xbb36('0x1c')][_0xbb36('0x1e')]||null:null,'limit':_0x3bc201['options']?_0x3bc201['options'][_0xbb36('0x1f')]||null:null,'include':_0x3bc201['options']?_0x3bc201[_0xbb36('0x1c')][_0xbb36('0x20')]?_[_0xbb36('0x21')](_0x3bc201[_0xbb36('0x1c')][_0xbb36('0x20')],function(_0x537b24){return{'model':db[_0x537b24[_0xbb36('0x22')]],'as':_0x537b24['as'],'attributes':_0x537b24[_0xbb36('0x1e')],'include':_0x537b24['include']?_[_0xbb36('0x21')](_0x537b24['include'],function(_0x3c9ade){return{'model':db[_0x3c9ade[_0xbb36('0x22')]],'as':_0x3c9ade['as'],'attributes':_0x3c9ade['attributes'],'include':_0x3c9ade[_0xbb36('0x20')]?_['map'](_0x3c9ade[_0xbb36('0x20')],function(_0x7c9948){return{'model':db[_0x7c9948['model']],'as':_0x7c9948['as'],'attributes':_0x7c9948['attributes']};}):[]};}):[]};}):[]:[]})[_0xbb36('0x23')](function(_0x4e417a){logger[_0xbb36('0x11')]('GetChatQueue',_0x3bc201);logger['debug'](_0xbb36('0x1a'),_0x3bc201,JSON[_0xbb36('0x15')](_0x4e417a));_0x217b4d(_0x4e417a);})[_0xbb36('0x24')](function(_0x282f1c){logger[_0xbb36('0x16')]('GetChatQueue',_0x282f1c[_0xbb36('0x18')],_0x3bc201);_0x22d35e(_0x17a97b['error'](0x1f4,_0x282f1c[_0xbb36('0x18')]));});});};exports['ShowChatQueue']=function(_0x1c3ba2){var _0x47d0cd=this;return new Promise(function(_0x2dda9d,_0x117f89){return db[_0xbb36('0x1b')][_0xbb36('0x25')]({'raw':_0x1c3ba2[_0xbb36('0x1c')]?_0x1c3ba2[_0xbb36('0x1c')][_0xbb36('0x26')]===undefined?!![]:![]:!![],'where':_0x1c3ba2['options']?_0x1c3ba2[_0xbb36('0x1c')]['where']||null:null,'attributes':_0x1c3ba2[_0xbb36('0x1c')]?_0x1c3ba2[_0xbb36('0x1c')]['attributes']||null:null,'include':_0x1c3ba2['options']?_0x1c3ba2[_0xbb36('0x1c')][_0xbb36('0x20')]?_[_0xbb36('0x21')](_0x1c3ba2[_0xbb36('0x1c')][_0xbb36('0x20')],function(_0x596f42){return{'model':db[_0x596f42[_0xbb36('0x22')]],'as':_0x596f42['as'],'attributes':_0x596f42[_0xbb36('0x1e')],'include':_0x596f42[_0xbb36('0x20')]?_[_0xbb36('0x21')](_0x596f42['include'],function(_0x3c6808){return{'model':db[_0x3c6808[_0xbb36('0x22')]],'as':_0x3c6808['as'],'attributes':_0x3c6808[_0xbb36('0x1e')],'include':_0x3c6808['include']?_[_0xbb36('0x21')](_0x3c6808[_0xbb36('0x20')],function(_0x53ca18){return{'model':db[_0x53ca18['model']],'as':_0x53ca18['as'],'attributes':_0x53ca18[_0xbb36('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xbb36('0x23')](function(_0x4a5ff8){logger['info']('ShowChatQueue',_0x1c3ba2);logger['debug'](_0xbb36('0x27'),_0x1c3ba2,JSON[_0xbb36('0x15')](_0x4a5ff8));_0x2dda9d(_0x4a5ff8);})['catch'](function(_0x585e28){logger[_0xbb36('0x16')]('ShowChatQueue',_0x585e28[_0xbb36('0x18')],_0x1c3ba2);_0x117f89(_0x47d0cd['error'](0x1f4,_0x585e28[_0xbb36('0x18')]));});});}; \ No newline at end of file +var _0x45d8=['stringify','ShowChatQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','request','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x453cf4,_0x75e200){var _0x34ad69=function(_0x542c22){while(--_0x542c22){_0x453cf4['push'](_0x453cf4['shift']());}};_0x34ad69(++_0x75e200);}(_0x45d8,0x174));var _0x845d=function(_0x209cc0,_0x59bb37){_0x209cc0=_0x209cc0-0x0;var _0x3c5029=_0x45d8[_0x209cc0];return _0x3c5029;};'use strict';var _=require(_0x845d('0x0'));var util=require(_0x845d('0x1'));var moment=require(_0x845d('0x2'));var BPromise=require(_0x845d('0x3'));var rs=require(_0x845d('0x4'));var fs=require('fs');var Redis=require(_0x845d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x845d('0x6'));var logger=require('../../config/logger')(_0x845d('0x7'));var config=require(_0x845d('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x845d('0x9')]({'port':0x232a});config['redis']=_[_0x845d('0xa')](config[_0x845d('0xb')],{'host':_0x845d('0xc'),'port':0x18eb});var socket=require(_0x845d('0xd'))(new Redis(config[_0x845d('0xb')]));require(_0x845d('0xe'))['register'](socket);function respondWithRpcPromise(_0x209d2e,_0x234efb,_0x50b504){return new BPromise(function(_0x5d4128,_0x1a2afb){return client[_0x845d('0xf')](_0x209d2e,_0x50b504)[_0x845d('0x10')](function(_0x10deb0){logger[_0x845d('0x11')]('ChatQueue,\x20%s,\x20%s',_0x234efb,_0x845d('0x12'));logger[_0x845d('0x13')](_0x845d('0x14'),_0x234efb,_0x845d('0x12'),JSON['stringify'](_0x10deb0));if(_0x10deb0['error']){if(_0x10deb0[_0x845d('0x15')][_0x845d('0x16')]===0x1f4){logger[_0x845d('0x15')]('ChatQueue,\x20%s,\x20%s',_0x234efb,_0x10deb0[_0x845d('0x15')]['message']);return _0x1a2afb(_0x10deb0[_0x845d('0x15')]['message']);}logger[_0x845d('0x15')](_0x845d('0x17'),_0x234efb,_0x10deb0[_0x845d('0x15')][_0x845d('0x18')]);return _0x5d4128(_0x10deb0[_0x845d('0x15')]['message']);}else{logger['info'](_0x845d('0x17'),_0x234efb,_0x845d('0x12'));_0x5d4128(_0x10deb0[_0x845d('0x19')][_0x845d('0x18')]);}})[_0x845d('0x1a')](function(_0x523b63){logger[_0x845d('0x15')](_0x845d('0x17'),_0x234efb,_0x523b63);_0x1a2afb(_0x523b63);});});}exports[_0x845d('0x1b')]=function(_0x377998){var _0x4683e1=this;return new Promise(function(_0x4a500a,_0xe5768b){return db[_0x845d('0x1c')][_0x845d('0x1d')]({'raw':_0x377998[_0x845d('0x1e')]?_0x377998[_0x845d('0x1e')][_0x845d('0x1f')]===undefined?!![]:![]:!![],'where':_0x377998['options']?_0x377998[_0x845d('0x1e')][_0x845d('0x20')]||null:null,'attributes':_0x377998[_0x845d('0x1e')]?_0x377998['options'][_0x845d('0x21')]||null:null,'limit':_0x377998[_0x845d('0x1e')]?_0x377998[_0x845d('0x1e')][_0x845d('0x22')]||null:null,'include':_0x377998[_0x845d('0x1e')]?_0x377998['options'][_0x845d('0x23')]?_['map'](_0x377998[_0x845d('0x1e')][_0x845d('0x23')],function(_0x5716cd){return{'model':db[_0x5716cd['model']],'as':_0x5716cd['as'],'attributes':_0x5716cd[_0x845d('0x21')],'include':_0x5716cd[_0x845d('0x23')]?_[_0x845d('0x24')](_0x5716cd[_0x845d('0x23')],function(_0x1ea3a2){return{'model':db[_0x1ea3a2['model']],'as':_0x1ea3a2['as'],'attributes':_0x1ea3a2[_0x845d('0x21')],'include':_0x1ea3a2[_0x845d('0x23')]?_['map'](_0x1ea3a2['include'],function(_0x4c60c8){return{'model':db[_0x4c60c8[_0x845d('0x25')]],'as':_0x4c60c8['as'],'attributes':_0x4c60c8['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f6d5b){logger[_0x845d('0x11')](_0x845d('0x1b'),_0x377998);logger['debug'](_0x845d('0x1b'),_0x377998,JSON[_0x845d('0x26')](_0x1f6d5b));_0x4a500a(_0x1f6d5b);})[_0x845d('0x1a')](function(_0x48e7a0){logger[_0x845d('0x15')]('GetChatQueue',_0x48e7a0[_0x845d('0x18')],_0x377998);_0xe5768b(_0x4683e1[_0x845d('0x15')](0x1f4,_0x48e7a0[_0x845d('0x18')]));});});};exports[_0x845d('0x27')]=function(_0x142c0f){var _0x546d77=this;return new Promise(function(_0x541de4,_0xf2e232){return db[_0x845d('0x1c')][_0x845d('0x28')]({'raw':_0x142c0f[_0x845d('0x1e')]?_0x142c0f['options']['raw']===undefined?!![]:![]:!![],'where':_0x142c0f[_0x845d('0x1e')]?_0x142c0f['options'][_0x845d('0x20')]||null:null,'attributes':_0x142c0f['options']?_0x142c0f[_0x845d('0x1e')][_0x845d('0x21')]||null:null,'include':_0x142c0f[_0x845d('0x1e')]?_0x142c0f['options'][_0x845d('0x23')]?_[_0x845d('0x24')](_0x142c0f['options'][_0x845d('0x23')],function(_0xcedad){return{'model':db[_0xcedad[_0x845d('0x25')]],'as':_0xcedad['as'],'attributes':_0xcedad[_0x845d('0x21')],'include':_0xcedad[_0x845d('0x23')]?_[_0x845d('0x24')](_0xcedad['include'],function(_0x2b87ce){return{'model':db[_0x2b87ce['model']],'as':_0x2b87ce['as'],'attributes':_0x2b87ce[_0x845d('0x21')],'include':_0x2b87ce[_0x845d('0x23')]?_[_0x845d('0x24')](_0x2b87ce[_0x845d('0x23')],function(_0x47c48f){return{'model':db[_0x47c48f[_0x845d('0x25')]],'as':_0x47c48f['as'],'attributes':_0x47c48f[_0x845d('0x21')]};}):[]};}):[]};}):[]:[]})[_0x845d('0x10')](function(_0xd33156){logger[_0x845d('0x11')](_0x845d('0x27'),_0x142c0f);logger[_0x845d('0x13')]('ShowChatQueue',_0x142c0f,JSON['stringify'](_0xd33156));_0x541de4(_0xd33156);})[_0x845d('0x1a')](function(_0x534a2c){logger['error'](_0x845d('0x27'),_0x534a2c[_0x845d('0x18')],_0x142c0f);_0xf2e232(_0x546d77[_0x845d('0x15')](0x1f4,_0x534a2c[_0x845d('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index eb514ca..5ace5a2 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 _0x5ad3=['register','chatQueue:','./chatQueue.events','save','remove','update','emit','removeListener'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x56a871,_0x18b7fe){_0x56a871=_0x56a871-0x0;var _0x124954=_0x5ad3[_0x56a871];return _0x124954;};'use strict';var ChatQueueEvents=require(_0x35ad('0x0'));var events=[_0x35ad('0x1'),_0x35ad('0x2'),_0x35ad('0x3')];function createListener(_0x5543d1,_0x468072){return function(_0x373228){_0x468072[_0x35ad('0x4')](_0x5543d1,_0x373228);};}function removeListener(_0x69a0b3,_0x450f55){return function(){ChatQueueEvents[_0x35ad('0x5')](_0x69a0b3,_0x450f55);};}exports[_0x35ad('0x6')]=function(_0x436dcb){for(var _0x36c606=0x0,_0x31cc6a=events['length'];_0x36c606<_0x31cc6a;_0x36c606++){var _0x292521=events[_0x36c606];var _0x3cec3e=createListener(_0x35ad('0x7')+_0x292521,_0x436dcb);ChatQueueEvents['on'](_0x292521,_0x3cec3e);}}; \ No newline at end of file +var _0x54ef=['remove','emit','removeListener','length','./chatQueue.events','save'];(function(_0x339411,_0x47f05c){var _0x9c19a9=function(_0x94cfe7){while(--_0x94cfe7){_0x339411['push'](_0x339411['shift']());}};_0x9c19a9(++_0x47f05c);}(_0x54ef,0x112));var _0xf54e=function(_0x3c03ff,_0x4d06e8){_0x3c03ff=_0x3c03ff-0x0;var _0x511311=_0x54ef[_0x3c03ff];return _0x511311;};'use strict';var ChatQueueEvents=require(_0xf54e('0x0'));var events=[_0xf54e('0x1'),_0xf54e('0x2'),'update'];function createListener(_0xd936f7,_0x18b7d6){return function(_0x18b1cf){_0x18b7d6[_0xf54e('0x3')](_0xd936f7,_0x18b1cf);};}function removeListener(_0x8b6bb6,_0x431e36){return function(){ChatQueueEvents[_0xf54e('0x4')](_0x8b6bb6,_0x431e36);};}exports['register']=function(_0x55e611){for(var _0x18e84e=0x0,_0x99cf9=events[_0xf54e('0x5')];_0x18e84e<_0x99cf9;_0x18e84e++){var _0x561870=events[_0x18e84e];var _0x27e69b=createListener('chatQueue:'+_0x561870,_0x55e611);ChatQueueEvents['on'](_0x561870,_0x27e69b);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index d7b89a8..3ba9d76 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 _0x7217=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x59e44c,_0x32cbab){var _0x5651e8=function(_0x4fae2b){while(--_0x4fae2b){_0x59e44c['push'](_0x59e44c['shift']());}};_0x5651e8(++_0x32cbab);}(_0x7217,0x19e));var _0x7721=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x7217[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getAgents']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['post'](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['addAgents']);router['put']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);router[_0x7721('0x17')](_0x7721('0xd'),auth['isAuthenticated'](),controller[_0x7721('0x18')]);router['delete'](_0x7721('0x11'),auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x17')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1a')]);module[_0x7721('0x1b')]=router; \ No newline at end of file +var _0x814b=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x3e1b63,_0x23585c){var _0x13379d=function(_0x490382){while(--_0x490382){_0x3e1b63['push'](_0x3e1b63['shift']());}};_0x13379d(++_0x23585c);}(_0x814b,0x1a2));var _0xb814=function(_0x37d3f3,_0xca010f){_0x37d3f3=_0x37d3f3-0x0;var _0x185c9c=_0x814b[_0x37d3f3];return _0x185c9c;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0x16')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0x16')](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x18')]);router[_0xb814('0x16')](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x19')]);router[_0xb814('0x1a')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller['destroy']);router[_0xb814('0x1c')]('/:id/teams',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xb814('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index e9deb0c..418d06e 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 _0x22e4=['STRING','DATE','sequelize'];(function(_0x411289,_0x36dbc8){var _0x5e72ec=function(_0x4d415b){while(--_0x4d415b){_0x411289['push'](_0x411289['shift']());}};_0x5e72ec(++_0x36dbc8);}(_0x22e4,0x1af));var _0x422e=function(_0x30db17,_0x415e95){_0x30db17=_0x30db17-0x0;var _0x43199b=_0x22e4[_0x30db17];return _0x43199b;};'use strict';var moment=require('moment');var Sequelize=require(_0x422e('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x422e('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x422e('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x422e('0x2')]},'reason':{'type':Sequelize[_0x422e('0x1')]}}; \ No newline at end of file +var _0x255a=['exports','DATE','STRING','moment'];(function(_0x51edf9,_0x2fa46a){var _0x58b6c7=function(_0x429d01){while(--_0x429d01){_0x51edf9['push'](_0x51edf9['shift']());}};_0x58b6c7(++_0x2fa46a);}(_0x255a,0x1b7));var _0xa255=function(_0x4adf49,_0x15c051){_0x4adf49=_0x4adf49-0x0;var _0x1cd45f=_0x255a[_0x4adf49];return _0x1cd45f;};'use strict';var moment=require(_0xa255('0x0'));var Sequelize=require('sequelize');module[_0xa255('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xa255('0x2')]},'leaveAt':{'type':Sequelize[_0xa255('0x2')]},'acceptAt':{'type':Sequelize[_0xa255('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xa255('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 6082f44..8a1b94e 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 _0xa423=['fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','count','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','ChatQueueReport','rawAttributes','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filters','filter','merge','VIRTUAL','findAll','rows','show','params','keys','length','includeAll','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs'];(function(_0x4bbdae,_0x58ea9d){var _0x4843c1=function(_0x337a0a){while(--_0x337a0a){_0x4bbdae['push'](_0x4bbdae['shift']());}};_0x4843c1(++_0x58ea9d);}(_0xa423,0x16c));var _0x3a42=function(_0x2441b2,_0x55e94f){_0x2441b2=_0x2441b2-0x0;var _0x24ca0f=_0xa423[_0x2441b2];return _0x24ca0f;};'use strict';var emlformat=require(_0x3a42('0x0'));var rimraf=require(_0x3a42('0x1'));var zipdir=require(_0x3a42('0x2'));var jsonpatch=require(_0x3a42('0x3'));var rp=require(_0x3a42('0x4'));var moment=require('moment');var BPromise=require(_0x3a42('0x5'));var Mustache=require(_0x3a42('0x6'));var util=require('util');var path=require(_0x3a42('0x7'));var sox=require(_0x3a42('0x8'));var csv=require(_0x3a42('0x9'));var ejs=require(_0x3a42('0xa'));var fs=require('fs');var fs_extra=require(_0x3a42('0xb'));var _=require('lodash');var squel=require(_0x3a42('0xc'));var crypto=require(_0x3a42('0xd'));var jsforce=require(_0x3a42('0xe'));var deskjs=require(_0x3a42('0xf'));var toCsv=require(_0x3a42('0x9'));var querystring=require(_0x3a42('0x10'));var Papa=require(_0x3a42('0x11'));var Redis=require(_0x3a42('0x12'));var authService=require(_0x3a42('0x13'));var qs=require(_0x3a42('0x14'));var as=require(_0x3a42('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3a42('0x16'))(_0x3a42('0x17'));var utils=require(_0x3a42('0x18'));var config=require(_0x3a42('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11ccc8,_0x4df153){_0x4df153=_0x4df153||0xcc;return function(_0x4008ea){if(_0x4008ea){return _0x11ccc8[_0x3a42('0x1a')](_0x4df153);}return _0x11ccc8[_0x3a42('0x1b')](_0x4df153)[_0x3a42('0x1c')]();};}function respondWithResult(_0x891963,_0x475602){_0x475602=_0x475602||0xc8;return function(_0x5f5244){if(_0x5f5244){return _0x891963[_0x3a42('0x1b')](_0x475602)['json'](_0x5f5244);}};}function respondWithFilteredResult(_0x469c73,_0x4b1d68){return function(_0x3e5d77){if(_0x3e5d77){var _0x5895a8=typeof _0x4b1d68[_0x3a42('0x1d')]==='undefined'&&typeof _0x4b1d68['limit']==='undefined';var _0x26c844=_0x3e5d77[_0x3a42('0x1e')];var _0x438cf1=_0x5895a8?0x0:_0x4b1d68[_0x3a42('0x1d')];var _0x318526=_0x5895a8?_0x3e5d77['count']:_0x4b1d68[_0x3a42('0x1d')]+_0x4b1d68[_0x3a42('0x1f')];var _0x49f00e;if(_0x318526>=_0x26c844){_0x318526=_0x26c844;_0x49f00e=0xc8;}else{_0x49f00e=0xce;}_0x469c73[_0x3a42('0x1b')](_0x49f00e);return _0x469c73[_0x3a42('0x20')](_0x3a42('0x21'),_0x438cf1+'-'+_0x318526+'/'+_0x26c844)['json'](_0x3e5d77);}return null;};}function patchUpdates(_0x1fcea4){return function(_0x3f4afb){try{jsonpatch[_0x3a42('0x22')](_0x3f4afb,_0x1fcea4,!![]);}catch(_0x477605){return BPromise[_0x3a42('0x23')](_0x477605);}return _0x3f4afb['save']();};}function saveUpdates(_0x34927a,_0x42b40f){return function(_0x379fe6){if(_0x379fe6){return _0x379fe6[_0x3a42('0x24')](_0x34927a)[_0x3a42('0x25')](function(_0x5b41d2){return _0x5b41d2;});}return null;};}function removeEntity(_0xab8ab7,_0x41b374){return function(_0x477cb9){if(_0x477cb9){return _0x477cb9[_0x3a42('0x26')]()[_0x3a42('0x25')](function(){_0xab8ab7[_0x3a42('0x1b')](0xcc)[_0x3a42('0x1c')]();});}};}function handleEntityNotFound(_0x434044,_0x2c4b3a){return function(_0x3a3f87){if(!_0x3a3f87){_0x434044[_0x3a42('0x1a')](0x194);}return _0x3a3f87;};}function handleError(_0x510c93,_0x222f88){_0x222f88=_0x222f88||0x1f4;return function(_0x468ea8){logger['error'](_0x468ea8[_0x3a42('0x27')]);if(_0x468ea8['name']){delete _0x468ea8[_0x3a42('0x28')];}_0x510c93[_0x3a42('0x1b')](_0x222f88)[_0x3a42('0x29')](_0x468ea8);};}exports[_0x3a42('0x2a')]=function(_0x1559cd,_0xaf28ad){var _0x4b8fe7={},_0x175fc4={},_0xdb014d={'count':0x0,'rows':[]};var _0x1dc0c0=_[_0x3a42('0x2b')](db[_0x3a42('0x2c')][_0x3a42('0x2d')],function(_0x41776f){return{'name':_0x41776f['fieldName'],'type':_0x41776f[_0x3a42('0x2e')][_0x3a42('0x2f')]};});_0x175fc4[_0x3a42('0x30')]=_[_0x3a42('0x2b')](_0x1dc0c0,_0x3a42('0x28'));_0x175fc4['query']=_['keys'](_0x1559cd[_0x3a42('0x31')]);_0x175fc4['filters']=_[_0x3a42('0x32')](_0x175fc4[_0x3a42('0x30')],_0x175fc4[_0x3a42('0x31')]);_0x4b8fe7[_0x3a42('0x33')]=_[_0x3a42('0x32')](_0x175fc4[_0x3a42('0x30')],qs['fields'](_0x1559cd[_0x3a42('0x31')][_0x3a42('0x34')]));_0x4b8fe7[_0x3a42('0x33')]=_0x4b8fe7['attributes']['length']?_0x4b8fe7[_0x3a42('0x33')]:_0x175fc4[_0x3a42('0x30')];if(!_0x1559cd[_0x3a42('0x31')][_0x3a42('0x35')](_0x3a42('0x36'))){_0x4b8fe7['limit']=qs['limit'](_0x1559cd[_0x3a42('0x31')][_0x3a42('0x1f')]);_0x4b8fe7[_0x3a42('0x1d')]=qs[_0x3a42('0x1d')](_0x1559cd['query'][_0x3a42('0x1d')]);}_0x4b8fe7[_0x3a42('0x37')]=qs['sort'](_0x1559cd['query']['sort']);_0x4b8fe7[_0x3a42('0x38')]=qs['filters'](_[_0x3a42('0x39')](_0x1559cd[_0x3a42('0x31')],_0x175fc4[_0x3a42('0x3a')]),_0x1dc0c0);if(_0x1559cd[_0x3a42('0x31')][_0x3a42('0x3b')]){_0x4b8fe7[_0x3a42('0x38')]=_[_0x3a42('0x3c')](_0x4b8fe7[_0x3a42('0x38')],{'$or':_[_0x3a42('0x2b')](_0x1dc0c0,function(_0x54004c){if(_0x54004c[_0x3a42('0x2e')]!==_0x3a42('0x3d')){var _0x2541db={};_0x2541db[_0x54004c[_0x3a42('0x28')]]={'$like':'%'+_0x1559cd[_0x3a42('0x31')]['filter']+'%'};return _0x2541db;}})});}_0x4b8fe7=_[_0x3a42('0x3c')]({},_0x4b8fe7,_0x1559cd['options']);var _0x4e9224={'where':_0x4b8fe7['where']};return db['ChatQueueReport'][_0x3a42('0x1e')](_0x4e9224)['then'](function(_0x56e32b){_0xdb014d['count']=_0x56e32b;if(_0x1559cd[_0x3a42('0x31')]['includeAll']){_0x4b8fe7['include']=[{'all':!![]}];}return db[_0x3a42('0x2c')][_0x3a42('0x3e')](_0x4b8fe7);})[_0x3a42('0x25')](function(_0x1f49e9){_0xdb014d[_0x3a42('0x3f')]=_0x1f49e9;return _0xdb014d;})[_0x3a42('0x25')](respondWithFilteredResult(_0xaf28ad,_0x4b8fe7))['catch'](handleError(_0xaf28ad,null));};exports[_0x3a42('0x40')]=function(_0x139593,_0x3e5f89){var _0x52a21c={'raw':!![],'where':{'id':_0x139593[_0x3a42('0x41')]['id']}},_0x167dc3={};_0x167dc3['model']=_[_0x3a42('0x42')](db[_0x3a42('0x2c')][_0x3a42('0x2d')]);_0x167dc3[_0x3a42('0x31')]=_[_0x3a42('0x42')](_0x139593[_0x3a42('0x31')]);_0x167dc3[_0x3a42('0x3a')]=_['intersection'](_0x167dc3[_0x3a42('0x30')],_0x167dc3[_0x3a42('0x31')]);_0x52a21c[_0x3a42('0x33')]=_[_0x3a42('0x32')](_0x167dc3[_0x3a42('0x30')],qs['fields'](_0x139593[_0x3a42('0x31')][_0x3a42('0x34')]));_0x52a21c[_0x3a42('0x33')]=_0x52a21c['attributes'][_0x3a42('0x43')]?_0x52a21c[_0x3a42('0x33')]:_0x167dc3[_0x3a42('0x30')];if(_0x139593[_0x3a42('0x31')][_0x3a42('0x44')]){_0x52a21c['include']=[{'all':!![]}];}_0x52a21c=_[_0x3a42('0x3c')]({},_0x52a21c,_0x139593[_0x3a42('0x45')]);return db[_0x3a42('0x2c')][_0x3a42('0x46')](_0x52a21c)['then'](handleEntityNotFound(_0x3e5f89,null))[_0x3a42('0x25')](respondWithResult(_0x3e5f89,null))[_0x3a42('0x47')](handleError(_0x3e5f89,null));};exports[_0x3a42('0x48')]=function(_0x2d3e3c,_0x8e5316){return db[_0x3a42('0x2c')][_0x3a42('0x48')](_0x2d3e3c['body'],{})[_0x3a42('0x25')](respondWithResult(_0x8e5316,0xc9))[_0x3a42('0x47')](handleError(_0x8e5316,null));};exports[_0x3a42('0x24')]=function(_0x1f9912,_0x34cf64){if(_0x1f9912[_0x3a42('0x49')]['id']){delete _0x1f9912['body']['id'];}return db[_0x3a42('0x2c')]['find']({'where':{'id':_0x1f9912[_0x3a42('0x41')]['id']}})[_0x3a42('0x25')](handleEntityNotFound(_0x34cf64,null))[_0x3a42('0x25')](saveUpdates(_0x1f9912[_0x3a42('0x49')],null))[_0x3a42('0x25')](respondWithResult(_0x34cf64,null))[_0x3a42('0x47')](handleError(_0x34cf64,null));};exports[_0x3a42('0x26')]=function(_0x36dbb3,_0x32552f){return db['ChatQueueReport'][_0x3a42('0x46')]({'where':{'id':_0x36dbb3[_0x3a42('0x41')]['id']}})['then'](handleEntityNotFound(_0x32552f,null))['then'](removeEntity(_0x32552f,null))[_0x3a42('0x47')](handleError(_0x32552f,null));};exports[_0x3a42('0x4a')]=function(_0x4e968d,_0x1fc91c){return db[_0x3a42('0x2c')][_0x3a42('0x4a')]()['then'](respondWithResult(_0x1fc91c,null))[_0x3a42('0x47')](handleError(_0x1fc91c,null));}; \ No newline at end of file +var _0x044a=['describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','limit','count','offset','set','apply','reject','update','then','stack','name','index','map','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','ChatQueueReport','includeAll','include','findAll','rows','catch','show','rawAttributes','keys','options','find','create','body','params','destroy'];(function(_0x35ef6b,_0x53a861){var _0x214afb=function(_0x8a81c7){while(--_0x8a81c7){_0x35ef6b['push'](_0x35ef6b['shift']());}};_0x214afb(++_0x53a861);}(_0x044a,0x173));var _0xa044=function(_0xd5bd85,_0x5f1c23){_0xd5bd85=_0xd5bd85-0x0;var _0x5960ce=_0x044a[_0xd5bd85];return _0x5960ce;};'use strict';var emlformat=require(_0xa044('0x0'));var rimraf=require(_0xa044('0x1'));var zipdir=require(_0xa044('0x2'));var jsonpatch=require(_0xa044('0x3'));var rp=require(_0xa044('0x4'));var moment=require(_0xa044('0x5'));var BPromise=require(_0xa044('0x6'));var Mustache=require(_0xa044('0x7'));var util=require(_0xa044('0x8'));var path=require(_0xa044('0x9'));var sox=require('sox');var csv=require(_0xa044('0xa'));var ejs=require(_0xa044('0xb'));var fs=require('fs');var fs_extra=require(_0xa044('0xc'));var _=require(_0xa044('0xd'));var squel=require('squel');var crypto=require(_0xa044('0xe'));var jsforce=require(_0xa044('0xf'));var deskjs=require(_0xa044('0x10'));var toCsv=require(_0xa044('0xa'));var querystring=require('querystring');var Papa=require(_0xa044('0x11'));var Redis=require(_0xa044('0x12'));var authService=require(_0xa044('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa044('0x14'));var hardwareService=require(_0xa044('0x15'));var logger=require(_0xa044('0x16'))(_0xa044('0x17'));var utils=require('../../config/utils');var config=require(_0xa044('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ee43,_0x3e05cf){_0x3e05cf=_0x3e05cf||0xcc;return function(_0x2b73a1){if(_0x2b73a1){return _0x1ee43[_0xa044('0x19')](_0x3e05cf);}return _0x1ee43[_0xa044('0x1a')](_0x3e05cf)[_0xa044('0x1b')]();};}function respondWithResult(_0xe9a838,_0x4bec52){_0x4bec52=_0x4bec52||0xc8;return function(_0x31c5ae){if(_0x31c5ae){return _0xe9a838['status'](_0x4bec52)[_0xa044('0x1c')](_0x31c5ae);}};}function respondWithFilteredResult(_0x44c658,_0x141d1a){return function(_0x3bc2c9){if(_0x3bc2c9){var _0xeb7e4e=typeof _0x141d1a['offset']==='undefined'&&typeof _0x141d1a[_0xa044('0x1d')]==='undefined';var _0x3ca144=_0x3bc2c9[_0xa044('0x1e')];var _0x1b43c1=_0xeb7e4e?0x0:_0x141d1a[_0xa044('0x1f')];var _0x3ccbd3=_0xeb7e4e?_0x3bc2c9['count']:_0x141d1a['offset']+_0x141d1a['limit'];var _0x39422b;if(_0x3ccbd3>=_0x3ca144){_0x3ccbd3=_0x3ca144;_0x39422b=0xc8;}else{_0x39422b=0xce;}_0x44c658[_0xa044('0x1a')](_0x39422b);return _0x44c658[_0xa044('0x20')]('Content-Range',_0x1b43c1+'-'+_0x3ccbd3+'/'+_0x3ca144)[_0xa044('0x1c')](_0x3bc2c9);}return null;};}function patchUpdates(_0x19854d){return function(_0x4e0202){try{jsonpatch[_0xa044('0x21')](_0x4e0202,_0x19854d,!![]);}catch(_0x40999a){return BPromise[_0xa044('0x22')](_0x40999a);}return _0x4e0202['save']();};}function saveUpdates(_0x2e3468,_0x966548){return function(_0x26747b){if(_0x26747b){return _0x26747b[_0xa044('0x23')](_0x2e3468)[_0xa044('0x24')](function(_0x3f4d03){return _0x3f4d03;});}return null;};}function removeEntity(_0x18af4c,_0x46f14c){return function(_0x36c237){if(_0x36c237){return _0x36c237['destroy']()['then'](function(){_0x18af4c[_0xa044('0x1a')](0xcc)[_0xa044('0x1b')]();});}};}function handleEntityNotFound(_0x228d5e,_0x4c3d4b){return function(_0x418756){if(!_0x418756){_0x228d5e[_0xa044('0x19')](0x194);}return _0x418756;};}function handleError(_0x4e9357,_0x38bdd7){_0x38bdd7=_0x38bdd7||0x1f4;return function(_0x6746e8){logger['error'](_0x6746e8[_0xa044('0x25')]);if(_0x6746e8[_0xa044('0x26')]){delete _0x6746e8['name'];}_0x4e9357['status'](_0x38bdd7)['send'](_0x6746e8);};}exports[_0xa044('0x27')]=function(_0x159519,_0x1362ef){var _0x4c72f3={},_0x267512={},_0x300b6e={'count':0x0,'rows':[]};var _0x485212=_[_0xa044('0x28')](db['ChatQueueReport']['rawAttributes'],function(_0x1cb1be){return{'name':_0x1cb1be['fieldName'],'type':_0x1cb1be[_0xa044('0x29')][_0xa044('0x2a')]};});_0x267512[_0xa044('0x2b')]=_[_0xa044('0x28')](_0x485212,_0xa044('0x26'));_0x267512[_0xa044('0x2c')]=_['keys'](_0x159519[_0xa044('0x2c')]);_0x267512[_0xa044('0x2d')]=_[_0xa044('0x2e')](_0x267512[_0xa044('0x2b')],_0x267512['query']);_0x4c72f3[_0xa044('0x2f')]=_[_0xa044('0x2e')](_0x267512['model'],qs['fields'](_0x159519[_0xa044('0x2c')][_0xa044('0x30')]));_0x4c72f3['attributes']=_0x4c72f3[_0xa044('0x2f')][_0xa044('0x31')]?_0x4c72f3[_0xa044('0x2f')]:_0x267512['model'];if(!_0x159519[_0xa044('0x2c')][_0xa044('0x32')](_0xa044('0x33'))){_0x4c72f3[_0xa044('0x1d')]=qs[_0xa044('0x1d')](_0x159519['query'][_0xa044('0x1d')]);_0x4c72f3[_0xa044('0x1f')]=qs[_0xa044('0x1f')](_0x159519['query'][_0xa044('0x1f')]);}_0x4c72f3[_0xa044('0x34')]=qs['sort'](_0x159519[_0xa044('0x2c')][_0xa044('0x35')]);_0x4c72f3[_0xa044('0x36')]=qs[_0xa044('0x2d')](_[_0xa044('0x37')](_0x159519[_0xa044('0x2c')],_0x267512[_0xa044('0x2d')]),_0x485212);if(_0x159519[_0xa044('0x2c')]['filter']){_0x4c72f3[_0xa044('0x36')]=_[_0xa044('0x38')](_0x4c72f3[_0xa044('0x36')],{'$or':_[_0xa044('0x28')](_0x485212,function(_0x20509c){if(_0x20509c['type']!==_0xa044('0x39')){var _0x529be2={};_0x529be2[_0x20509c[_0xa044('0x26')]]={'$like':'%'+_0x159519[_0xa044('0x2c')]['filter']+'%'};return _0x529be2;}})});}_0x4c72f3=_['merge']({},_0x4c72f3,_0x159519['options']);var _0x22386d={'where':_0x4c72f3[_0xa044('0x36')]};return db[_0xa044('0x3a')][_0xa044('0x1e')](_0x22386d)[_0xa044('0x24')](function(_0x73aa8b){_0x300b6e[_0xa044('0x1e')]=_0x73aa8b;if(_0x159519[_0xa044('0x2c')][_0xa044('0x3b')]){_0x4c72f3[_0xa044('0x3c')]=[{'all':!![]}];}return db['ChatQueueReport'][_0xa044('0x3d')](_0x4c72f3);})[_0xa044('0x24')](function(_0x1e84c1){_0x300b6e[_0xa044('0x3e')]=_0x1e84c1;return _0x300b6e;})[_0xa044('0x24')](respondWithFilteredResult(_0x1362ef,_0x4c72f3))[_0xa044('0x3f')](handleError(_0x1362ef,null));};exports[_0xa044('0x40')]=function(_0xc9246f,_0x2863a5){var _0x1f1c35={'raw':!![],'where':{'id':_0xc9246f['params']['id']}},_0x4b9cf6={};_0x4b9cf6[_0xa044('0x2b')]=_['keys'](db[_0xa044('0x3a')][_0xa044('0x41')]);_0x4b9cf6[_0xa044('0x2c')]=_[_0xa044('0x42')](_0xc9246f[_0xa044('0x2c')]);_0x4b9cf6[_0xa044('0x2d')]=_['intersection'](_0x4b9cf6[_0xa044('0x2b')],_0x4b9cf6['query']);_0x1f1c35[_0xa044('0x2f')]=_[_0xa044('0x2e')](_0x4b9cf6[_0xa044('0x2b')],qs['fields'](_0xc9246f['query'][_0xa044('0x30')]));_0x1f1c35[_0xa044('0x2f')]=_0x1f1c35[_0xa044('0x2f')][_0xa044('0x31')]?_0x1f1c35[_0xa044('0x2f')]:_0x4b9cf6[_0xa044('0x2b')];if(_0xc9246f['query'][_0xa044('0x3b')]){_0x1f1c35[_0xa044('0x3c')]=[{'all':!![]}];}_0x1f1c35=_[_0xa044('0x38')]({},_0x1f1c35,_0xc9246f[_0xa044('0x43')]);return db[_0xa044('0x3a')][_0xa044('0x44')](_0x1f1c35)[_0xa044('0x24')](handleEntityNotFound(_0x2863a5,null))[_0xa044('0x24')](respondWithResult(_0x2863a5,null))[_0xa044('0x3f')](handleError(_0x2863a5,null));};exports[_0xa044('0x45')]=function(_0x13e4e3,_0x3d303a){return db[_0xa044('0x3a')]['create'](_0x13e4e3[_0xa044('0x46')],{})[_0xa044('0x24')](respondWithResult(_0x3d303a,0xc9))[_0xa044('0x3f')](handleError(_0x3d303a,null));};exports[_0xa044('0x23')]=function(_0x6bf8a0,_0x230ecf){if(_0x6bf8a0[_0xa044('0x46')]['id']){delete _0x6bf8a0['body']['id'];}return db['ChatQueueReport'][_0xa044('0x44')]({'where':{'id':_0x6bf8a0[_0xa044('0x47')]['id']}})[_0xa044('0x24')](handleEntityNotFound(_0x230ecf,null))[_0xa044('0x24')](saveUpdates(_0x6bf8a0['body'],null))[_0xa044('0x24')](respondWithResult(_0x230ecf,null))[_0xa044('0x3f')](handleError(_0x230ecf,null));};exports[_0xa044('0x48')]=function(_0x390d24,_0x1b7877){return db[_0xa044('0x3a')]['find']({'where':{'id':_0x390d24[_0xa044('0x47')]['id']}})['then'](handleEntityNotFound(_0x1b7877,null))['then'](removeEntity(_0x1b7877,null))[_0xa044('0x3f')](handleError(_0x1b7877,null));};exports[_0xa044('0x49')]=function(_0x3ea870,_0x187ebd){return db['ChatQueueReport']['describe']()['then'](respondWithResult(_0x187ebd,null))[_0xa044('0x3f')](handleError(_0x187ebd,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 5da71fb..ac60f1d 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xd92849,_0x5dc936){var _0x36ec3c=function(_0x5846f1){while(--_0x5846f1){_0xd92849['push'](_0xd92849['shift']());}};_0x36ec3c(++_0x5dc936);}(_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('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x12d923,_0x3ab3de){var _0x35eab7=function(_0x2f7211){while(--_0x2f7211){_0x12d923['push'](_0x12d923['shift']());}};_0x35eab7(++_0x3ab3de);}(_0x757a,0xde));var _0xa757=function(_0x55ddf4,_0x457f6d){_0x55ddf4=_0x55ddf4-0x0;var _0xafce49=_0x757a[_0x55ddf4];return _0xafce49;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 6025c0b..5094a96 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 _0xfeb0=['error','code','message','create','body','options','raw','debug','CreateChatQueueReport','stringify','catch','UpdateChatQueueReport','ChatQueueReport','update','where','limit','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x1b3a5c,_0x2f9d5f){var _0x2ae8cb=function(_0x549ab8){while(--_0x549ab8){_0x1b3a5c['push'](_0x1b3a5c['shift']());}};_0x2ae8cb(++_0x2f9d5f);}(_0xfeb0,0x1e1));var _0x0feb=function(_0x153e7d,_0x10a35f){_0x153e7d=_0x153e7d-0x0;var _0x3c22dd=_0xfeb0[_0x153e7d];return _0x3c22dd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0feb('0x0'));var BPromise=require(_0x0feb('0x1'));var rs=require(_0x0feb('0x2'));var fs=require('fs');var Redis=require(_0x0feb('0x3'));var db=require(_0x0feb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0feb('0x5'))('rpc');var config=require(_0x0feb('0x6'));var jayson=require(_0x0feb('0x7'));var client=jayson[_0x0feb('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x427b5b,_0x4c32d5,_0x234934){return new BPromise(function(_0x5239ef,_0xbd6651){return client[_0x0feb('0x9')](_0x427b5b,_0x234934)[_0x0feb('0xa')](function(_0x27bb23){logger[_0x0feb('0xb')](_0x0feb('0xc'),_0x4c32d5,_0x0feb('0xd'));logger['debug'](_0x0feb('0xe'),_0x4c32d5,'request\x20sent',JSON['stringify'](_0x27bb23));if(_0x27bb23[_0x0feb('0xf')]){if(_0x27bb23[_0x0feb('0xf')][_0x0feb('0x10')]===0x1f4){logger['error'](_0x0feb('0xc'),_0x4c32d5,_0x27bb23['error'][_0x0feb('0x11')]);return _0xbd6651(_0x27bb23[_0x0feb('0xf')][_0x0feb('0x11')]);}logger[_0x0feb('0xf')](_0x0feb('0xc'),_0x4c32d5,_0x27bb23['error'][_0x0feb('0x11')]);return _0x5239ef(_0x27bb23[_0x0feb('0xf')]['message']);}else{logger[_0x0feb('0xb')](_0x0feb('0xc'),_0x4c32d5,_0x0feb('0xd'));_0x5239ef(_0x27bb23['result'][_0x0feb('0x11')]);}})['catch'](function(_0x4b954d){logger['error'](_0x0feb('0xc'),_0x4c32d5,_0x4b954d);_0xbd6651(_0x4b954d);});});}exports['CreateChatQueueReport']=function(_0x5f3839){var _0x26aeb5=this;return new Promise(function(_0x5cc112,_0x4160c8){return db['ChatQueueReport'][_0x0feb('0x12')](_0x5f3839[_0x0feb('0x13')],{'raw':_0x5f3839[_0x0feb('0x14')]?_0x5f3839['options'][_0x0feb('0x15')]===undefined?!![]:![]:!![]})['then'](function(_0x439f34){logger[_0x0feb('0xb')]('CreateChatQueueReport',_0x5f3839);logger[_0x0feb('0x16')](_0x0feb('0x17'),_0x5f3839,JSON[_0x0feb('0x18')](_0x439f34));_0x5cc112(_0x439f34);})[_0x0feb('0x19')](function(_0x108c8b){logger[_0x0feb('0xf')](_0x0feb('0x17'),_0x108c8b[_0x0feb('0x11')],_0x5f3839);_0x4160c8(_0x26aeb5[_0x0feb('0xf')](0x1f4,_0x108c8b['message']));});});};exports[_0x0feb('0x1a')]=function(_0x47a682){var _0x3c7102=this;return new Promise(function(_0x17248e,_0x49be9a){return db[_0x0feb('0x1b')][_0x0feb('0x1c')](_0x47a682['body'],{'raw':_0x47a682[_0x0feb('0x14')]?_0x47a682[_0x0feb('0x14')][_0x0feb('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47a682[_0x0feb('0x14')]?_0x47a682[_0x0feb('0x14')][_0x0feb('0x1d')]||null:null,'attributes':_0x47a682[_0x0feb('0x14')]?_0x47a682[_0x0feb('0x14')]['attributes']||null:null,'limit':_0x47a682[_0x0feb('0x14')]?_0x47a682[_0x0feb('0x14')][_0x0feb('0x1e')]||null:null})[_0x0feb('0xa')](function(_0x3a7c89){logger['info'](_0x0feb('0x1a'),_0x47a682);logger[_0x0feb('0x16')](_0x0feb('0x1a'),_0x47a682,JSON[_0x0feb('0x18')](_0x3a7c89));_0x17248e(_0x3a7c89);})['catch'](function(_0x5b276e){logger[_0x0feb('0xf')](_0x0feb('0x1a'),_0x5b276e[_0x0feb('0x11')],_0x47a682);_0x49be9a(_0x3c7102['error'](0x1f4,_0x5b276e[_0x0feb('0x11')]));});});}; \ No newline at end of file +var _0x9e26=['../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateChatQueueReport','ChatQueueReport','create','options','raw','catch','UpdateChatQueueReport','update','body','where','attributes','limit','moment','randomstring','ioredis','../../mysqldb'];(function(_0x336a6e,_0x4c454f){var _0x4c0b21=function(_0x3590a0){while(--_0x3590a0){_0x336a6e['push'](_0x336a6e['shift']());}};_0x4c0b21(++_0x4c454f);}(_0x9e26,0x104));var _0x69e2=function(_0x35aba4,_0x13f1d0){_0x35aba4=_0x35aba4-0x0;var _0x4343fe=_0x9e26[_0x35aba4];return _0x4343fe;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x69e2('0x0'));var BPromise=require('bluebird');var rs=require(_0x69e2('0x1'));var fs=require('fs');var Redis=require(_0x69e2('0x2'));var db=require(_0x69e2('0x3'))['db'];var utils=require(_0x69e2('0x4'));var logger=require('../../config/logger')(_0x69e2('0x5'));var config=require(_0x69e2('0x6'));var jayson=require(_0x69e2('0x7'));var client=jayson['client'][_0x69e2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d1183,_0x1e78fa,_0x2f9124){return new BPromise(function(_0x2f0d2d,_0x376baf){return client[_0x69e2('0x9')](_0x1d1183,_0x2f9124)[_0x69e2('0xa')](function(_0x434bc5){logger[_0x69e2('0xb')](_0x69e2('0xc'),_0x1e78fa,_0x69e2('0xd'));logger[_0x69e2('0xe')](_0x69e2('0xf'),_0x1e78fa,_0x69e2('0xd'),JSON[_0x69e2('0x10')](_0x434bc5));if(_0x434bc5[_0x69e2('0x11')]){if(_0x434bc5['error'][_0x69e2('0x12')]===0x1f4){logger[_0x69e2('0x11')](_0x69e2('0xc'),_0x1e78fa,_0x434bc5[_0x69e2('0x11')][_0x69e2('0x13')]);return _0x376baf(_0x434bc5['error'][_0x69e2('0x13')]);}logger[_0x69e2('0x11')](_0x69e2('0xc'),_0x1e78fa,_0x434bc5['error'][_0x69e2('0x13')]);return _0x2f0d2d(_0x434bc5[_0x69e2('0x11')][_0x69e2('0x13')]);}else{logger['info'](_0x69e2('0xc'),_0x1e78fa,_0x69e2('0xd'));_0x2f0d2d(_0x434bc5[_0x69e2('0x14')][_0x69e2('0x13')]);}})['catch'](function(_0x4e3159){logger['error'](_0x69e2('0xc'),_0x1e78fa,_0x4e3159);_0x376baf(_0x4e3159);});});}exports[_0x69e2('0x15')]=function(_0x5ce852){var _0x559158=this;return new Promise(function(_0x4de6d7,_0x37b609){return db[_0x69e2('0x16')][_0x69e2('0x17')](_0x5ce852['body'],{'raw':_0x5ce852[_0x69e2('0x18')]?_0x5ce852['options'][_0x69e2('0x19')]===undefined?!![]:![]:!![]})[_0x69e2('0xa')](function(_0x107459){logger[_0x69e2('0xb')]('CreateChatQueueReport',_0x5ce852);logger[_0x69e2('0xe')](_0x69e2('0x15'),_0x5ce852,JSON[_0x69e2('0x10')](_0x107459));_0x4de6d7(_0x107459);})[_0x69e2('0x1a')](function(_0x344a2e){logger[_0x69e2('0x11')](_0x69e2('0x15'),_0x344a2e[_0x69e2('0x13')],_0x5ce852);_0x37b609(_0x559158['error'](0x1f4,_0x344a2e[_0x69e2('0x13')]));});});};exports[_0x69e2('0x1b')]=function(_0x1af68d){var _0x45dce0=this;return new Promise(function(_0x1ea7fd,_0x362ba6){return db[_0x69e2('0x16')][_0x69e2('0x1c')](_0x1af68d[_0x69e2('0x1d')],{'raw':_0x1af68d[_0x69e2('0x18')]?_0x1af68d[_0x69e2('0x18')][_0x69e2('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1af68d[_0x69e2('0x18')]?_0x1af68d[_0x69e2('0x18')][_0x69e2('0x1e')]||null:null,'attributes':_0x1af68d[_0x69e2('0x18')]?_0x1af68d[_0x69e2('0x18')][_0x69e2('0x1f')]||null:null,'limit':_0x1af68d['options']?_0x1af68d[_0x69e2('0x18')][_0x69e2('0x20')]||null:null})[_0x69e2('0xa')](function(_0x1fbc54){logger[_0x69e2('0xb')]('UpdateChatQueueReport',_0x1af68d);logger[_0x69e2('0xe')](_0x69e2('0x1b'),_0x1af68d,JSON[_0x69e2('0x10')](_0x1fbc54));_0x1ea7fd(_0x1fbc54);})['catch'](function(_0x2ac990){logger['error'](_0x69e2('0x1b'),_0x2ac990['message'],_0x1af68d);_0x362ba6(_0x45dce0[_0x69e2('0x11')](0x1f4,_0x2ac990[_0x69e2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 3ac4c9c..55c69cc 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 _0x2570=['isAuthenticated','index','get','/describe','/:id','show','create','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller'];(function(_0x3827cd,_0x48c417){var _0x43eba7=function(_0xee734c){while(--_0xee734c){_0x3827cd['push'](_0x3827cd['shift']());}};_0x43eba7(++_0x48c417);}(_0x2570,0xb2));var _0x0257=function(_0x300c89,_0x25fcad){_0x300c89=_0x300c89-0x0;var _0x41762e=_0x2570[_0x300c89];return _0x41762e;};'use strict';var multer=require(_0x0257('0x0'));var util=require(_0x0257('0x1'));var path=require(_0x0257('0x2'));var timeout=require(_0x0257('0x3'));var express=require(_0x0257('0x4'));var router=express[_0x0257('0x5')]();var fs_extra=require(_0x0257('0x6'));var auth=require(_0x0257('0x7'));var interaction=require(_0x0257('0x8'));var config=require(_0x0257('0x9'));var controller=require(_0x0257('0xa'));router['get']('/',auth[_0x0257('0xb')](),controller[_0x0257('0xc')]);router[_0x0257('0xd')](_0x0257('0xe'),auth[_0x0257('0xb')](),controller['describe']);router['get'](_0x0257('0xf'),auth['isAuthenticated'](),controller[_0x0257('0x10')]);router['post']('/',auth[_0x0257('0xb')](),controller[_0x0257('0x11')]);router[_0x0257('0x12')]('/:id',auth[_0x0257('0xb')](),controller[_0x0257('0x13')]);router['delete'](_0x0257('0xf'),auth[_0x0257('0xb')](),controller[_0x0257('0x14')]);module['exports']=router; \ No newline at end of file +var _0x00c0=['fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','post','create','put','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x4309ec,_0xc81a29){var _0x40be1f=function(_0x654a7a){while(--_0x654a7a){_0x4309ec['push'](_0x4309ec['shift']());}};_0x40be1f(++_0xc81a29);}(_0x00c0,0x19e));var _0x000c=function(_0xd547cd,_0x3ad91f){_0xd547cd=_0xd547cd-0x0;var _0x1e3cff=_0x00c0[_0xd547cd];return _0x1e3cff;};'use strict';var multer=require(_0x000c('0x0'));var util=require(_0x000c('0x1'));var path=require(_0x000c('0x2'));var timeout=require(_0x000c('0x3'));var express=require(_0x000c('0x4'));var router=express[_0x000c('0x5')]();var fs_extra=require(_0x000c('0x6'));var auth=require(_0x000c('0x7'));var interaction=require(_0x000c('0x8'));var config=require('../../config/environment');var controller=require(_0x000c('0x9'));router[_0x000c('0xa')]('/',auth[_0x000c('0xb')](),controller[_0x000c('0xc')]);router[_0x000c('0xa')](_0x000c('0xd'),auth[_0x000c('0xb')](),controller[_0x000c('0xe')]);router[_0x000c('0xa')]('/:id',auth[_0x000c('0xb')](),controller['show']);router[_0x000c('0xf')]('/',auth[_0x000c('0xb')](),controller[_0x000c('0x10')]);router[_0x000c('0x11')](_0x000c('0x12'),auth[_0x000c('0xb')](),controller['update']);router['delete'](_0x000c('0x12'),auth['isAuthenticated'](),controller[_0x000c('0x13')]);module[_0x000c('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 0fce536..7a3571b 100644 --- a/server/api/chatTransferReport/chatTransferReport.attributes.js +++ b/server/api/chatTransferReport/chatTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x5bf493,_0x3c46bf){var _0x5e69b1=function(_0x39774a){while(--_0x39774a){_0x5bf493['push'](_0x5bf493['shift']());}};_0x5e69b1(++_0x3c46bf);}(_0x008c,0x188));var _0xc008=function(_0x5e5568,_0x300d0d){_0x5e5568=_0x5e5568-0x0;var _0x557045=_0x008c[_0x5e5568];return _0x557045;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x137bb7,_0x5d4b09){var _0x192a90=function(_0x56e3e1){while(--_0x56e3e1){_0x137bb7['push'](_0x137bb7['shift']());}};_0x192a90(++_0x5d4b09);}(_0x70e0,0x17b));var _0x070e=function(_0x3abe07,_0x28f4f7){_0x3abe07=_0x3abe07-0x0;var _0xbd2ab9=_0x70e0[_0x3abe07];return _0xbd2ab9;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index b33eb09..84424f7 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 _0x46f1=['model','query','intersection','attributes','fields','length','limit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','ChatTransferReport','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName'];(function(_0x55ecaf,_0xed9f48){var _0xaee555=function(_0x29ceaf){while(--_0x29ceaf){_0x55ecaf['push'](_0x55ecaf['shift']());}};_0xaee555(++_0xed9f48);}(_0x46f1,0x1da));var _0x146f=function(_0x47a715,_0x19a193){_0x47a715=_0x47a715-0x0;var _0x3e35a4=_0x46f1[_0x47a715];return _0x3e35a4;};'use strict';var emlformat=require(_0x146f('0x0'));var rimraf=require(_0x146f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x146f('0x2'));var rp=require(_0x146f('0x3'));var moment=require(_0x146f('0x4'));var BPromise=require(_0x146f('0x5'));var Mustache=require(_0x146f('0x6'));var util=require(_0x146f('0x7'));var path=require('path');var sox=require(_0x146f('0x8'));var csv=require('to-csv');var ejs=require(_0x146f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x146f('0xa'));var crypto=require(_0x146f('0xb'));var jsforce=require(_0x146f('0xc'));var deskjs=require(_0x146f('0xd'));var toCsv=require(_0x146f('0xe'));var querystring=require(_0x146f('0xf'));var Papa=require('papaparse');var Redis=require(_0x146f('0x10'));var authService=require(_0x146f('0x11'));var qs=require(_0x146f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x146f('0x13'));var logger=require('../../config/logger')(_0x146f('0x14'));var utils=require(_0x146f('0x15'));var config=require(_0x146f('0x16'));var licenseUtil=require(_0x146f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4daafd,_0x47c7dd){_0x47c7dd=_0x47c7dd||0xcc;return function(_0x505685){if(_0x505685){return _0x4daafd[_0x146f('0x18')](_0x47c7dd);}return _0x4daafd[_0x146f('0x19')](_0x47c7dd)[_0x146f('0x1a')]();};}function respondWithResult(_0x3acf2f,_0x336c4f){_0x336c4f=_0x336c4f||0xc8;return function(_0x3128d3){if(_0x3128d3){return _0x3acf2f[_0x146f('0x19')](_0x336c4f)[_0x146f('0x1b')](_0x3128d3);}};}function respondWithFilteredResult(_0x3b07dd,_0x14a2fc){return function(_0x5f53a3){if(_0x5f53a3){var _0x23540a=typeof _0x14a2fc[_0x146f('0x1c')]===_0x146f('0x1d')&&typeof _0x14a2fc['limit']===_0x146f('0x1d');var _0x2ba8f5=_0x5f53a3[_0x146f('0x1e')];var _0x3a39a4=_0x23540a?0x0:_0x14a2fc[_0x146f('0x1c')];var _0x19ab50=_0x23540a?_0x5f53a3[_0x146f('0x1e')]:_0x14a2fc[_0x146f('0x1c')]+_0x14a2fc['limit'];var _0x5d7774;if(_0x19ab50>=_0x2ba8f5){_0x19ab50=_0x2ba8f5;_0x5d7774=0xc8;}else{_0x5d7774=0xce;}_0x3b07dd['status'](_0x5d7774);return _0x3b07dd[_0x146f('0x1f')](_0x146f('0x20'),_0x3a39a4+'-'+_0x19ab50+'/'+_0x2ba8f5)['json'](_0x5f53a3);}return null;};}function patchUpdates(_0x440009){return function(_0x55643d){try{jsonpatch['apply'](_0x55643d,_0x440009,!![]);}catch(_0xb3adf5){return BPromise['reject'](_0xb3adf5);}return _0x55643d[_0x146f('0x21')]();};}function saveUpdates(_0x137303,_0x8b6fdd){return function(_0x57de82){if(_0x57de82){return _0x57de82[_0x146f('0x22')](_0x137303)[_0x146f('0x23')](function(_0x4124d8){return _0x4124d8;});}return null;};}function removeEntity(_0x252af6,_0xf2091d){return function(_0x2e78b7){if(_0x2e78b7){return _0x2e78b7[_0x146f('0x24')]()[_0x146f('0x23')](function(){_0x252af6[_0x146f('0x19')](0xcc)[_0x146f('0x1a')]();});}};}function handleEntityNotFound(_0x19d05c,_0x4ec32d){return function(_0x510c1a){if(!_0x510c1a){_0x19d05c['sendStatus'](0x194);}return _0x510c1a;};}function handleError(_0x3d6895,_0x3d8ef5){_0x3d8ef5=_0x3d8ef5||0x1f4;return function(_0x3b88d8){logger[_0x146f('0x25')](_0x3b88d8[_0x146f('0x26')]);if(_0x3b88d8[_0x146f('0x27')]){delete _0x3b88d8['name'];}_0x3d6895[_0x146f('0x19')](_0x3d8ef5)['send'](_0x3b88d8);};}exports[_0x146f('0x28')]=function(_0xf095e3,_0x135d8e){var _0x5ce693={},_0x1b9fdd={},_0x18ae8e={'count':0x0,'rows':[]};var _0x1b914f=_[_0x146f('0x29')](db['ChatTransferReport'][_0x146f('0x2a')],function(_0x5a1234){return{'name':_0x5a1234[_0x146f('0x2b')],'type':_0x5a1234['type']['key']};});_0x1b9fdd[_0x146f('0x2c')]=_[_0x146f('0x29')](_0x1b914f,_0x146f('0x27'));_0x1b9fdd['query']=_['keys'](_0xf095e3[_0x146f('0x2d')]);_0x1b9fdd['filters']=_[_0x146f('0x2e')](_0x1b9fdd['model'],_0x1b9fdd[_0x146f('0x2d')]);_0x5ce693[_0x146f('0x2f')]=_['intersection'](_0x1b9fdd[_0x146f('0x2c')],qs[_0x146f('0x30')](_0xf095e3[_0x146f('0x2d')][_0x146f('0x30')]));_0x5ce693[_0x146f('0x2f')]=_0x5ce693[_0x146f('0x2f')][_0x146f('0x31')]?_0x5ce693['attributes']:_0x1b9fdd[_0x146f('0x2c')];if(!_0xf095e3['query']['hasOwnProperty']('nolimit')){_0x5ce693[_0x146f('0x32')]=qs[_0x146f('0x32')](_0xf095e3[_0x146f('0x2d')][_0x146f('0x32')]);_0x5ce693[_0x146f('0x1c')]=qs['offset'](_0xf095e3[_0x146f('0x2d')]['offset']);}_0x5ce693[_0x146f('0x33')]=qs[_0x146f('0x34')](_0xf095e3['query']['sort']);_0x5ce693[_0x146f('0x35')]=qs[_0x146f('0x36')](_[_0x146f('0x37')](_0xf095e3[_0x146f('0x2d')],_0x1b9fdd[_0x146f('0x36')]),_0x1b914f);if(_0xf095e3[_0x146f('0x2d')]['filter']){_0x5ce693[_0x146f('0x35')]=_[_0x146f('0x38')](_0x5ce693[_0x146f('0x35')],{'$or':_[_0x146f('0x29')](_0x1b914f,function(_0x5cc97c){if(_0x5cc97c[_0x146f('0x39')]!==_0x146f('0x3a')){var _0x4bc821={};_0x4bc821[_0x5cc97c['name']]={'$like':'%'+_0xf095e3['query'][_0x146f('0x3b')]+'%'};return _0x4bc821;}})});}_0x5ce693=_[_0x146f('0x38')]({},_0x5ce693,_0xf095e3[_0x146f('0x3c')]);var _0x2efa8d={'where':_0x5ce693[_0x146f('0x35')]};return db[_0x146f('0x3d')]['count'](_0x2efa8d)[_0x146f('0x23')](function(_0xfc00a4){_0x18ae8e[_0x146f('0x1e')]=_0xfc00a4;if(_0xf095e3[_0x146f('0x2d')][_0x146f('0x3e')]){_0x5ce693[_0x146f('0x3f')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x146f('0x40')](_0x5ce693);})[_0x146f('0x23')](function(_0x2818ed){_0x18ae8e[_0x146f('0x41')]=_0x2818ed;return _0x18ae8e;})[_0x146f('0x23')](respondWithFilteredResult(_0x135d8e,_0x5ce693))[_0x146f('0x42')](handleError(_0x135d8e,null));};exports[_0x146f('0x43')]=function(_0x2aa55f,_0x170294){var _0x4741a2={'raw':!![],'where':{'id':_0x2aa55f[_0x146f('0x44')]['id']}},_0x2a3332={};_0x2a3332[_0x146f('0x2c')]=_[_0x146f('0x45')](db['ChatTransferReport'][_0x146f('0x2a')]);_0x2a3332[_0x146f('0x2d')]=_['keys'](_0x2aa55f[_0x146f('0x2d')]);_0x2a3332['filters']=_[_0x146f('0x2e')](_0x2a3332[_0x146f('0x2c')],_0x2a3332[_0x146f('0x2d')]);_0x4741a2[_0x146f('0x2f')]=_[_0x146f('0x2e')](_0x2a3332[_0x146f('0x2c')],qs[_0x146f('0x30')](_0x2aa55f[_0x146f('0x2d')]['fields']));_0x4741a2['attributes']=_0x4741a2[_0x146f('0x2f')][_0x146f('0x31')]?_0x4741a2['attributes']:_0x2a3332['model'];if(_0x2aa55f['query'][_0x146f('0x3e')]){_0x4741a2[_0x146f('0x3f')]=[{'all':!![]}];}_0x4741a2=_[_0x146f('0x38')]({},_0x4741a2,_0x2aa55f[_0x146f('0x3c')]);return db[_0x146f('0x3d')]['find'](_0x4741a2)['then'](handleEntityNotFound(_0x170294,null))[_0x146f('0x23')](respondWithResult(_0x170294,null))['catch'](handleError(_0x170294,null));};exports[_0x146f('0x46')]=function(_0x10e28a,_0x4e00a8){return db[_0x146f('0x3d')][_0x146f('0x46')](_0x10e28a[_0x146f('0x47')],{})[_0x146f('0x23')](respondWithResult(_0x4e00a8,0xc9))[_0x146f('0x42')](handleError(_0x4e00a8,null));};exports['update']=function(_0x5dbe9a,_0x1a9b2b){if(_0x5dbe9a['body']['id']){delete _0x5dbe9a['body']['id'];}return db[_0x146f('0x3d')][_0x146f('0x48')]({'where':{'id':_0x5dbe9a[_0x146f('0x44')]['id']}})[_0x146f('0x23')](handleEntityNotFound(_0x1a9b2b,null))[_0x146f('0x23')](saveUpdates(_0x5dbe9a['body'],null))[_0x146f('0x23')](respondWithResult(_0x1a9b2b,null))[_0x146f('0x42')](handleError(_0x1a9b2b,null));};exports['destroy']=function(_0x3c2f23,_0xeb7a58){return db[_0x146f('0x3d')]['find']({'where':{'id':_0x3c2f23[_0x146f('0x44')]['id']}})[_0x146f('0x23')](handleEntityNotFound(_0xeb7a58,null))['then'](removeEntity(_0xeb7a58,null))[_0x146f('0x42')](handleError(_0xeb7a58,null));};exports['describe']=function(_0x3b7acc,_0x7eaea4){return db[_0x146f('0x3d')][_0x146f('0x49')]()[_0x146f('0x23')](respondWithResult(_0x7eaea4,null))[_0x146f('0x42')](handleError(_0x7eaea4,null));}; \ No newline at end of file +var _0x9d2c=['ChatTransferReport','includeAll','include','findAll','catch','params','keys','options','find','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','end','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x5235dd,_0x3f91cf){var _0x13059d=function(_0x355a98){while(--_0x355a98){_0x5235dd['push'](_0x5235dd['shift']());}};_0x13059d(++_0x3f91cf);}(_0x9d2c,0x1c3));var _0xc9d2=function(_0x3c5c7e,_0x4878fc){_0x3c5c7e=_0x3c5c7e-0x0;var _0x3a801e=_0x9d2c[_0x3c5c7e];return _0x3a801e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc9d2('0x0'));var zipdir=require(_0xc9d2('0x1'));var jsonpatch=require(_0xc9d2('0x2'));var rp=require(_0xc9d2('0x3'));var moment=require('moment');var BPromise=require(_0xc9d2('0x4'));var Mustache=require(_0xc9d2('0x5'));var util=require('util');var path=require(_0xc9d2('0x6'));var sox=require('sox');var csv=require(_0xc9d2('0x7'));var ejs=require(_0xc9d2('0x8'));var fs=require('fs');var fs_extra=require(_0xc9d2('0x9'));var _=require(_0xc9d2('0xa'));var squel=require(_0xc9d2('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc9d2('0xc'));var toCsv=require(_0xc9d2('0x7'));var querystring=require(_0xc9d2('0xd'));var Papa=require(_0xc9d2('0xe'));var Redis=require(_0xc9d2('0xf'));var authService=require(_0xc9d2('0x10'));var qs=require(_0xc9d2('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc9d2('0x12'));var logger=require(_0xc9d2('0x13'))(_0xc9d2('0x14'));var utils=require('../../config/utils');var config=require(_0xc9d2('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc9d2('0x16'))['db'];function respondWithStatusCode(_0x40d554,_0x2e28fd){_0x2e28fd=_0x2e28fd||0xcc;return function(_0x1a3925){if(_0x1a3925){return _0x40d554['sendStatus'](_0x2e28fd);}return _0x40d554[_0xc9d2('0x17')](_0x2e28fd)['end']();};}function respondWithResult(_0x52fc1f,_0x50e066){_0x50e066=_0x50e066||0xc8;return function(_0x5b7f52){if(_0x5b7f52){return _0x52fc1f[_0xc9d2('0x17')](_0x50e066)[_0xc9d2('0x18')](_0x5b7f52);}};}function respondWithFilteredResult(_0x360596,_0x402c8c){return function(_0x181b09){if(_0x181b09){var _0x8e2e1a=typeof _0x402c8c[_0xc9d2('0x19')]===_0xc9d2('0x1a')&&typeof _0x402c8c[_0xc9d2('0x1b')]===_0xc9d2('0x1a');var _0x3fa609=_0x181b09['count'];var _0x128aee=_0x8e2e1a?0x0:_0x402c8c[_0xc9d2('0x19')];var _0x497cfd=_0x8e2e1a?_0x181b09[_0xc9d2('0x1c')]:_0x402c8c[_0xc9d2('0x19')]+_0x402c8c[_0xc9d2('0x1b')];var _0x4f30a8;if(_0x497cfd>=_0x3fa609){_0x497cfd=_0x3fa609;_0x4f30a8=0xc8;}else{_0x4f30a8=0xce;}_0x360596['status'](_0x4f30a8);return _0x360596[_0xc9d2('0x1d')]('Content-Range',_0x128aee+'-'+_0x497cfd+'/'+_0x3fa609)[_0xc9d2('0x18')](_0x181b09);}return null;};}function patchUpdates(_0x54c05c){return function(_0x37e1e1){try{jsonpatch[_0xc9d2('0x1e')](_0x37e1e1,_0x54c05c,!![]);}catch(_0x22f9b3){return BPromise[_0xc9d2('0x1f')](_0x22f9b3);}return _0x37e1e1[_0xc9d2('0x20')]();};}function saveUpdates(_0x2bc788,_0x499a79){return function(_0x151dd7){if(_0x151dd7){return _0x151dd7[_0xc9d2('0x21')](_0x2bc788)[_0xc9d2('0x22')](function(_0x56c75e){return _0x56c75e;});}return null;};}function removeEntity(_0x370caa,_0x41ab06){return function(_0x31a7c7){if(_0x31a7c7){return _0x31a7c7['destroy']()['then'](function(){_0x370caa['status'](0xcc)[_0xc9d2('0x23')]();});}};}function handleEntityNotFound(_0x44c51c,_0x4a97b8){return function(_0x281eb8){if(!_0x281eb8){_0x44c51c['sendStatus'](0x194);}return _0x281eb8;};}function handleError(_0x3d2967,_0x4e2c7d){_0x4e2c7d=_0x4e2c7d||0x1f4;return function(_0x59adf9){logger[_0xc9d2('0x24')](_0x59adf9['stack']);if(_0x59adf9[_0xc9d2('0x25')]){delete _0x59adf9[_0xc9d2('0x25')];}_0x3d2967[_0xc9d2('0x17')](_0x4e2c7d)[_0xc9d2('0x26')](_0x59adf9);};}exports[_0xc9d2('0x27')]=function(_0x4b3691,_0x23edee){var _0x281154={},_0x209132={},_0x50bd51={'count':0x0,'rows':[]};var _0x2cd059=_[_0xc9d2('0x28')](db['ChatTransferReport'][_0xc9d2('0x29')],function(_0x20390f){return{'name':_0x20390f[_0xc9d2('0x2a')],'type':_0x20390f[_0xc9d2('0x2b')][_0xc9d2('0x2c')]};});_0x209132[_0xc9d2('0x2d')]=_[_0xc9d2('0x28')](_0x2cd059,_0xc9d2('0x25'));_0x209132[_0xc9d2('0x2e')]=_['keys'](_0x4b3691[_0xc9d2('0x2e')]);_0x209132[_0xc9d2('0x2f')]=_[_0xc9d2('0x30')](_0x209132[_0xc9d2('0x2d')],_0x209132[_0xc9d2('0x2e')]);_0x281154['attributes']=_[_0xc9d2('0x30')](_0x209132[_0xc9d2('0x2d')],qs['fields'](_0x4b3691[_0xc9d2('0x2e')][_0xc9d2('0x31')]));_0x281154['attributes']=_0x281154[_0xc9d2('0x32')][_0xc9d2('0x33')]?_0x281154[_0xc9d2('0x32')]:_0x209132['model'];if(!_0x4b3691['query'][_0xc9d2('0x34')]('nolimit')){_0x281154[_0xc9d2('0x1b')]=qs[_0xc9d2('0x1b')](_0x4b3691[_0xc9d2('0x2e')][_0xc9d2('0x1b')]);_0x281154['offset']=qs[_0xc9d2('0x19')](_0x4b3691[_0xc9d2('0x2e')][_0xc9d2('0x19')]);}_0x281154[_0xc9d2('0x35')]=qs[_0xc9d2('0x36')](_0x4b3691[_0xc9d2('0x2e')][_0xc9d2('0x36')]);_0x281154[_0xc9d2('0x37')]=qs[_0xc9d2('0x2f')](_[_0xc9d2('0x38')](_0x4b3691[_0xc9d2('0x2e')],_0x209132['filters']),_0x2cd059);if(_0x4b3691['query'][_0xc9d2('0x39')]){_0x281154[_0xc9d2('0x37')]=_[_0xc9d2('0x3a')](_0x281154[_0xc9d2('0x37')],{'$or':_[_0xc9d2('0x28')](_0x2cd059,function(_0x5d7338){if(_0x5d7338[_0xc9d2('0x2b')]!==_0xc9d2('0x3b')){var _0x36f7d8={};_0x36f7d8[_0x5d7338[_0xc9d2('0x25')]]={'$like':'%'+_0x4b3691[_0xc9d2('0x2e')][_0xc9d2('0x39')]+'%'};return _0x36f7d8;}})});}_0x281154=_[_0xc9d2('0x3a')]({},_0x281154,_0x4b3691['options']);var _0x2a7ad9={'where':_0x281154[_0xc9d2('0x37')]};return db[_0xc9d2('0x3c')]['count'](_0x2a7ad9)['then'](function(_0x7c6ac7){_0x50bd51['count']=_0x7c6ac7;if(_0x4b3691[_0xc9d2('0x2e')][_0xc9d2('0x3d')]){_0x281154[_0xc9d2('0x3e')]=[{'all':!![]}];}return db[_0xc9d2('0x3c')][_0xc9d2('0x3f')](_0x281154);})[_0xc9d2('0x22')](function(_0x5c7b35){_0x50bd51['rows']=_0x5c7b35;return _0x50bd51;})['then'](respondWithFilteredResult(_0x23edee,_0x281154))[_0xc9d2('0x40')](handleError(_0x23edee,null));};exports['show']=function(_0x28f2e0,_0x1bec81){var _0x2ceb88={'raw':!![],'where':{'id':_0x28f2e0[_0xc9d2('0x41')]['id']}},_0x30f604={};_0x30f604['model']=_[_0xc9d2('0x42')](db[_0xc9d2('0x3c')][_0xc9d2('0x29')]);_0x30f604['query']=_[_0xc9d2('0x42')](_0x28f2e0[_0xc9d2('0x2e')]);_0x30f604[_0xc9d2('0x2f')]=_[_0xc9d2('0x30')](_0x30f604['model'],_0x30f604[_0xc9d2('0x2e')]);_0x2ceb88['attributes']=_['intersection'](_0x30f604[_0xc9d2('0x2d')],qs['fields'](_0x28f2e0[_0xc9d2('0x2e')][_0xc9d2('0x31')]));_0x2ceb88[_0xc9d2('0x32')]=_0x2ceb88[_0xc9d2('0x32')][_0xc9d2('0x33')]?_0x2ceb88[_0xc9d2('0x32')]:_0x30f604['model'];if(_0x28f2e0[_0xc9d2('0x2e')][_0xc9d2('0x3d')]){_0x2ceb88[_0xc9d2('0x3e')]=[{'all':!![]}];}_0x2ceb88=_[_0xc9d2('0x3a')]({},_0x2ceb88,_0x28f2e0[_0xc9d2('0x43')]);return db[_0xc9d2('0x3c')][_0xc9d2('0x44')](_0x2ceb88)[_0xc9d2('0x22')](handleEntityNotFound(_0x1bec81,null))[_0xc9d2('0x22')](respondWithResult(_0x1bec81,null))['catch'](handleError(_0x1bec81,null));};exports[_0xc9d2('0x45')]=function(_0x45c952,_0x1c4416){return db['ChatTransferReport']['create'](_0x45c952[_0xc9d2('0x46')],{})['then'](respondWithResult(_0x1c4416,0xc9))[_0xc9d2('0x40')](handleError(_0x1c4416,null));};exports[_0xc9d2('0x21')]=function(_0x1240b6,_0x19ab80){if(_0x1240b6[_0xc9d2('0x46')]['id']){delete _0x1240b6[_0xc9d2('0x46')]['id'];}return db[_0xc9d2('0x3c')][_0xc9d2('0x44')]({'where':{'id':_0x1240b6[_0xc9d2('0x41')]['id']}})['then'](handleEntityNotFound(_0x19ab80,null))[_0xc9d2('0x22')](saveUpdates(_0x1240b6['body'],null))['then'](respondWithResult(_0x19ab80,null))[_0xc9d2('0x40')](handleError(_0x19ab80,null));};exports[_0xc9d2('0x47')]=function(_0x646fbb,_0x42f56c){return db[_0xc9d2('0x3c')][_0xc9d2('0x44')]({'where':{'id':_0x646fbb[_0xc9d2('0x41')]['id']}})[_0xc9d2('0x22')](handleEntityNotFound(_0x42f56c,null))[_0xc9d2('0x22')](removeEntity(_0x42f56c,null))[_0xc9d2('0x40')](handleError(_0x42f56c,null));};exports['describe']=function(_0x46479c,_0x20a151){return db[_0xc9d2('0x3c')][_0xc9d2('0x48')]()[_0xc9d2('0x22')](respondWithResult(_0x20a151,null))['catch'](handleError(_0x20a151,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 5b804a3..b3a8001 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 _0xbbf9=['api','bluebird','request-promise','rimraf','../../config/environment','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','../../config/logger'];(function(_0xa28b1a,_0x384f4b){var _0x4c9b78=function(_0x3cf640){while(--_0x3cf640){_0xa28b1a['push'](_0xa28b1a['shift']());}};_0x4c9b78(++_0x384f4b);}(_0xbbf9,0xfb));var _0x9bbf=function(_0x51ea24,_0x2a71cd){_0x51ea24=_0x51ea24-0x0;var _0x351016=_0xbbf9[_0x51ea24];return _0x351016;};'use strict';var _=require(_0x9bbf('0x0'));var util=require('util');var logger=require(_0x9bbf('0x1'))(_0x9bbf('0x2'));var moment=require('moment');var BPromise=require(_0x9bbf('0x3'));var rp=require(_0x9bbf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9bbf('0x5'));var config=require(_0x9bbf('0x6'));var attributes=require('./chatTransferReport.attributes');module['exports']=function(_0x4794ff,_0x7cba72){return _0x4794ff[_0x9bbf('0x7')](_0x9bbf('0x8'),attributes,{'tableName':_0x9bbf('0x9'),'paranoid':![],'indexes':[{'name':_0x9bbf('0xa'),'fields':[_0x9bbf('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2a82=['path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','lodash','util','api','moment','bluebird','request-promise'];(function(_0x4b58cc,_0x4e3a23){var _0x582c2f=function(_0xf73a12){while(--_0xf73a12){_0x4b58cc['push'](_0x4b58cc['shift']());}};_0x582c2f(++_0x4e3a23);}(_0x2a82,0x11a));var _0x22a8=function(_0x35b6f6,_0x2fc664){_0x35b6f6=_0x35b6f6-0x0;var _0x353855=_0x2a82[_0x35b6f6];return _0x353855;};'use strict';var _=require(_0x22a8('0x0'));var util=require(_0x22a8('0x1'));var logger=require('../../config/logger')(_0x22a8('0x2'));var moment=require(_0x22a8('0x3'));var BPromise=require(_0x22a8('0x4'));var rp=require(_0x22a8('0x5'));var fs=require('fs');var path=require(_0x22a8('0x6'));var rimraf=require(_0x22a8('0x7'));var config=require(_0x22a8('0x8'));var attributes=require(_0x22a8('0x9'));module[_0x22a8('0xa')]=function(_0x2582cf,_0x51a6e7){return _0x2582cf[_0x22a8('0xb')]('ChatTransferReport',attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 8b04759..972552a 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 _0xa048=['ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x1dac7a,_0x1828ce){var _0x4cb363=function(_0x80f6de){while(--_0x80f6de){_0x1dac7a['push'](_0x1dac7a['shift']());}};_0x4cb363(++_0x1828ce);}(_0xa048,0x1c0));var _0x8a04=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa048[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x8a04('0x0'));var util=require(_0x8a04('0x1'));var moment=require(_0x8a04('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a04('0x3'));var db=require(_0x8a04('0x4'))['db'];var utils=require(_0x8a04('0x5'));var logger=require(_0x8a04('0x6'))(_0x8a04('0x7'));var config=require(_0x8a04('0x8'));var jayson=require(_0x8a04('0x9'));var client=jayson[_0x8a04('0xa')][_0x8a04('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc0904a,_0x5bc8fa,_0x36ae0c){return new BPromise(function(_0x14b051,_0x17e03d){return client[_0x8a04('0xc')](_0xc0904a,_0x36ae0c)[_0x8a04('0xd')](function(_0x4f65c7){logger['info'](_0x8a04('0xe'),_0x5bc8fa,_0x8a04('0xf'));logger['debug'](_0x8a04('0x10'),_0x5bc8fa,_0x8a04('0xf'),JSON['stringify'](_0x4f65c7));if(_0x4f65c7[_0x8a04('0x11')]){if(_0x4f65c7[_0x8a04('0x11')]['code']===0x1f4){logger[_0x8a04('0x11')](_0x8a04('0xe'),_0x5bc8fa,_0x4f65c7['error'][_0x8a04('0x12')]);return _0x17e03d(_0x4f65c7[_0x8a04('0x11')][_0x8a04('0x12')]);}logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x5bc8fa,_0x4f65c7[_0x8a04('0x11')][_0x8a04('0x12')]);return _0x14b051(_0x4f65c7[_0x8a04('0x11')][_0x8a04('0x12')]);}else{logger[_0x8a04('0x13')](_0x8a04('0xe'),_0x5bc8fa,_0x8a04('0xf'));_0x14b051(_0x4f65c7[_0x8a04('0x14')][_0x8a04('0x12')]);}})[_0x8a04('0x15')](function(_0x4652c2){logger[_0x8a04('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x5bc8fa,_0x4652c2);_0x17e03d(_0x4652c2);});});} \ No newline at end of file +var _0xf2fd=['result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xf2fd,0x152));var _0xdf2f=function(_0x5c396d,_0x803210){_0x5c396d=_0x5c396d-0x0;var _0x4a971a=_0xf2fd[_0x5c396d];return _0x4a971a;};'use strict';var _=require(_0xdf2f('0x0'));var util=require('util');var moment=require(_0xdf2f('0x1'));var BPromise=require('bluebird');var rs=require(_0xdf2f('0x2'));var fs=require('fs');var Redis=require(_0xdf2f('0x3'));var db=require(_0xdf2f('0x4'))['db'];var utils=require(_0xdf2f('0x5'));var logger=require(_0xdf2f('0x6'))(_0xdf2f('0x7'));var config=require(_0xdf2f('0x8'));var jayson=require(_0xdf2f('0x9'));var client=jayson[_0xdf2f('0xa')][_0xdf2f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3427b4,_0x35c4e0,_0x28fc95){return new BPromise(function(_0x1d15dd,_0x230b0e){return client['request'](_0x3427b4,_0x28fc95)[_0xdf2f('0xc')](function(_0x50f2b7){logger[_0xdf2f('0xd')](_0xdf2f('0xe'),_0x35c4e0,_0xdf2f('0xf'));logger[_0xdf2f('0x10')](_0xdf2f('0x11'),_0x35c4e0,'request\x20sent',JSON[_0xdf2f('0x12')](_0x50f2b7));if(_0x50f2b7[_0xdf2f('0x13')]){if(_0x50f2b7[_0xdf2f('0x13')][_0xdf2f('0x14')]===0x1f4){logger[_0xdf2f('0x13')](_0xdf2f('0xe'),_0x35c4e0,_0x50f2b7['error']['message']);return _0x230b0e(_0x50f2b7[_0xdf2f('0x13')][_0xdf2f('0x15')]);}logger[_0xdf2f('0x13')](_0xdf2f('0xe'),_0x35c4e0,_0x50f2b7[_0xdf2f('0x13')][_0xdf2f('0x15')]);return _0x1d15dd(_0x50f2b7['error']['message']);}else{logger[_0xdf2f('0xd')]('ChatTransferReport,\x20%s,\x20%s',_0x35c4e0,'request\x20sent');_0x1d15dd(_0x50f2b7[_0xdf2f('0x16')][_0xdf2f('0x15')]);}})[_0xdf2f('0x17')](function(_0x4a9a65){logger[_0xdf2f('0x13')](_0xdf2f('0xe'),_0x35c4e0,_0x4a9a65);_0x230b0e(_0x4a9a65);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 0694dc9..f38be1a 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 _0x9d1d=['delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatTransferReport.controller','index','get','/describe','describe','/:id','isAuthenticated','show','create','put','update'];(function(_0x249a17,_0x398352){var _0x20e6e6=function(_0xc7f51d){while(--_0xc7f51d){_0x249a17['push'](_0x249a17['shift']());}};_0x20e6e6(++_0x398352);}(_0x9d1d,0x129));var _0xd9d1=function(_0x1f5751,_0x3e40eb){_0x1f5751=_0x1f5751-0x0;var _0x2124b8=_0x9d1d[_0x1f5751];return _0x2124b8;};'use strict';var multer=require(_0xd9d1('0x0'));var util=require('util');var path=require(_0xd9d1('0x1'));var timeout=require('connect-timeout');var express=require(_0xd9d1('0x2'));var router=express[_0xd9d1('0x3')]();var fs_extra=require(_0xd9d1('0x4'));var auth=require(_0xd9d1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd9d1('0x6'));var controller=require(_0xd9d1('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xd9d1('0x8')]);router[_0xd9d1('0x9')](_0xd9d1('0xa'),auth['isAuthenticated'](),controller[_0xd9d1('0xb')]);router[_0xd9d1('0x9')](_0xd9d1('0xc'),auth[_0xd9d1('0xd')](),controller[_0xd9d1('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd9d1('0xf')]);router[_0xd9d1('0x10')](_0xd9d1('0xc'),auth[_0xd9d1('0xd')](),controller[_0xd9d1('0x11')]);router[_0xd9d1('0x12')](_0xd9d1('0xc'),auth[_0xd9d1('0xd')](),controller[_0xd9d1('0x13')]);module[_0xd9d1('0x14')]=router; \ No newline at end of file +var _0x7372=['isAuthenticated','index','describe','/:id','show','post','put','destroy','exports','multer','util','path','connect-timeout','express','Router','get'];(function(_0x231b66,_0x27f0f7){var _0x2641d1=function(_0xbacaae){while(--_0xbacaae){_0x231b66['push'](_0x231b66['shift']());}};_0x2641d1(++_0x27f0f7);}(_0x7372,0xe9));var _0x2737=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7372[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x2737('0x0'));var util=require(_0x2737('0x1'));var path=require(_0x2737('0x2'));var timeout=require(_0x2737('0x3'));var express=require(_0x2737('0x4'));var router=express[_0x2737('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatTransferReport.controller');router[_0x2737('0x6')]('/',auth[_0x2737('0x7')](),controller[_0x2737('0x8')]);router[_0x2737('0x6')]('/describe',auth[_0x2737('0x7')](),controller[_0x2737('0x9')]);router['get'](_0x2737('0xa'),auth['isAuthenticated'](),controller[_0x2737('0xb')]);router[_0x2737('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2737('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x2737('0xa'),auth[_0x2737('0x7')](),controller[_0x2737('0xe')]);module[_0x2737('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 9e0f206..01d0daa 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 _0x3666=['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:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','CHAT','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','sequelize','randomstring','STRING','address','email','#011F6A','#ffffff','ENUM','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','BOOLEAN','INTEGER','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','input','name','text','getDataValue','onlineForm','parse','setDataValue','stringify','textarea','Comments','offlineForm'];(function(_0x2b5513,_0x3fe5cd){var _0x578fd2=function(_0x7a9106){while(--_0x7a9106){_0x2b5513['push'](_0x2b5513['shift']());}};_0x578fd2(++_0x3fe5cd);}(_0x3666,0x99));var _0x6366=function(_0x930000,_0x372696){_0x930000=_0x930000-0x0;var _0x21d1c7=_0x3666[_0x930000];return _0x21d1c7;};'use strict';var Sequelize=require(_0x6366('0x0'));var rs=require(_0x6366('0x1'));module['exports']={'name':{'type':Sequelize[_0x6366('0x2')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6366('0x3')},'description':{'type':Sequelize[_0x6366('0x2')]},'mapKey':{'type':Sequelize[_0x6366('0x2')],'defaultValue':_0x6366('0x4')},'mapKeyOffline':{'type':Sequelize[_0x6366('0x2')],'defaultValue':_0x6366('0x4')},'key':{'type':Sequelize[_0x6366('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x6366('0x2')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x6366('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6366('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x6366('0x2')],'allowNull':![],'defaultValue':_0x6366('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x6366('0x2')],'allowNull':![],'defaultValue':_0x6366('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x6366('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x6366('0x7')]('rounded','squared'),'defaultValue':_0x6366('0x8')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x6366('0x9')},'start_chat_button':{'type':Sequelize[_0x6366('0x2')],'defaultValue':_0x6366('0xa')},'offline_chat_button':{'type':Sequelize[_0x6366('0x2')],'defaultValue':_0x6366('0xb')},'header_offline':{'type':Sequelize[_0x6366('0x2')],'defaultValue':_0x6366('0xc')},'download_transcript':{'type':Sequelize[_0x6366('0xd')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x6366('0xe')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x6366('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0x6366('0xd')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x6366('0x10')]},'closingQuestion':{'type':Sequelize[_0x6366('0x2')],'defaultValue':_0x6366('0x11')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x6366('0x2')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x6366('0x2')],'defaultValue':_0x6366('0x12')},'closingMessage':{'type':Sequelize[_0x6366('0x2')],'defaultValue':_0x6366('0x13')},'closingMessageButton':{'type':Sequelize[_0x6366('0x2')],'defaultValue':_0x6366('0xb')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x6366('0x14')},'conditionAgreement':{'type':Sequelize[_0x6366('0xd')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x6366('0xd')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x6366('0xd')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x6366('0x2')],'defaultValue':_0x6366('0x15')},'ratingType':{'type':Sequelize[_0x6366('0x7')](_0x6366('0x16'),_0x6366('0x17')),'defaultValue':_0x6366('0x16')},'ratingStarsNumber':{'type':Sequelize[_0x6366('0xe')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x6366('0x10')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x6366('0x18'),'variable':null,'config':{'placeholder':_0x6366('0x19'),'type':_0x6366('0x1a'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x6366('0x18'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x6366('0x4'),'type':_0x6366('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x6366('0x1b')](_0x6366('0x1c'))?JSON[_0x6366('0x1d')](this[_0x6366('0x1b')](_0x6366('0x1c'))):{};},'set':function(_0xad0bfe){return this[_0x6366('0x1e')](_0x6366('0x1c'),JSON[_0x6366('0x1f')](_0xad0bfe));}},'offlineForm':{'type':Sequelize[_0x6366('0x10')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x6366('0x18'),'props':{'title':_0x6366('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x6366('0x4'),'type':_0x6366('0x4')},'variable':null},{'type':_0x6366('0x20'),'config':{'placeholder':_0x6366('0x21')},'props':{'title':_0x6366('0x21'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0x6366('0x22'))?JSON['parse'](this['getDataValue'](_0x6366('0x22'))):{};},'set':function(_0x38ceb5){return this['setDataValue']('offlineForm',JSON[_0x6366('0x1f')](_0x38ceb5));}},'token':{'type':Sequelize[_0x6366('0x2')],'defaultValue':function(){return rs[_0x6366('0x23')]();}},'autoclose':{'type':Sequelize[_0x6366('0xd')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x6366('0xd')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x6366('0xd')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x6366('0x2')],'defaultValue':_0x6366('0x24')},'waitingMessage':{'type':Sequelize[_0x6366('0x2')],'defaultValue':_0x6366('0x25')},'offlineMessageSubject':{'type':Sequelize[_0x6366('0x2')],'defaultValue':_0x6366('0x26')},'offlineMessageBody':{'type':Sequelize[_0x6366('0x2')],'defaultValue':_0x6366('0x27')},'enableUnmanagedNote':{'type':Sequelize[_0x6366('0xd')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x6366('0x2')],'defaultValue':_0x6366('0x28')},'skipUnmanaged':{'type':Sequelize[_0x6366('0x2')],'defaultValue':_0x6366('0x14')},'sendUnmanaged':{'type':Sequelize[_0x6366('0x2')],'defaultValue':_0x6366('0xb')},'enableCustomerAttachment':{'type':Sequelize[_0x6366('0xd')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x6366('0xd')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x6366('0x10')]},'showAgentAvatar':{'type':Sequelize[_0x6366('0xd')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x6366('0x2')]},'notificationTemplate':{'type':Sequelize[_0x6366('0x10')],'defaultValue':function(){return _0x6366('0x29');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6366('0xd')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x6366('0xd')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x6366('0x2')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0x6366('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x6366('0x2')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x6366('0x2')],'defaultValue':_0x6366('0x2a')},'messagesAlignment':{'type':Sequelize[_0x6366('0x2')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x6366('0x10')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x6366('0xe')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x6366('0x2')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6366('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6366('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':'System'},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6366('0xe')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x6366('0xd')],'defaultValue':![],'comment':_0x6366('0x2b'),'set':function(_0x571df7){if(!_0x571df7)this[_0x6366('0x1e')](_0x6366('0x2c'),null);this[_0x6366('0x1e')](_0x6366('0x2d'),_0x571df7);}},'vidaooEscalation':{'type':Sequelize[_0x6366('0xd')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6366('0x2e')},'vidaooNote':{'type':Sequelize[_0x6366('0x2')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0x6366('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x6366('0xd')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x6366('0x10')]}}; \ No newline at end of file +var _0xa0cf=['Skip','Feedback','star','thumb','name','text','input','getDataValue','parse','onlineForm','setDataValue','stringify','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:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','exports','STRING','address','email','Agent','#011F6A','#ffffff','ENUM','rounded','squared','We\x20are\x20here!','Send','Contact\x20us','BOOLEAN','INTEGER','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!'];(function(_0x1f93a1,_0x103f49){var _0x51d434=function(_0x4e558b){while(--_0x4e558b){_0x1f93a1['push'](_0x1f93a1['shift']());}};_0x51d434(++_0x103f49);}(_0xa0cf,0x127));var _0xfa0c=function(_0x1e440c,_0x3b2ca5){_0x1e440c=_0x1e440c-0x0;var _0x3cfab5=_0xa0cf[_0x1e440c];return _0x3cfab5;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0xfa0c('0x0')]={'name':{'type':Sequelize[_0xfa0c('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0xfa0c('0x1')],'allowNull':![],'unique':_0xfa0c('0x2')},'description':{'type':Sequelize[_0xfa0c('0x1')]},'mapKey':{'type':Sequelize[_0xfa0c('0x1')],'defaultValue':_0xfa0c('0x3')},'mapKeyOffline':{'type':Sequelize[_0xfa0c('0x1')],'defaultValue':'email'},'key':{'type':Sequelize[_0xfa0c('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xfa0c('0x1')],'defaultValue':_0xfa0c('0x4')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0xfa0c('0x1')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xfa0c('0x1')],'allowNull':![],'defaultValue':_0xfa0c('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xfa0c('0x1')],'allowNull':![],'defaultValue':_0xfa0c('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xfa0c('0x1')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0xfa0c('0x1')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xfa0c('0x7')](_0xfa0c('0x8'),_0xfa0c('0x9')),'defaultValue':_0xfa0c('0x8')},'header_online':{'type':Sequelize[_0xfa0c('0x1')],'defaultValue':_0xfa0c('0xa')},'start_chat_button':{'type':Sequelize[_0xfa0c('0x1')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xfa0c('0xb')},'header_offline':{'type':Sequelize[_0xfa0c('0x1')],'defaultValue':_0xfa0c('0xc')},'download_transcript':{'type':Sequelize[_0xfa0c('0xd')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xfa0c('0xe')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xfa0c('0x1')],'defaultValue':_0xfa0c('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0xfa0c('0xd')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xfa0c('0x10')]},'closingQuestion':{'type':Sequelize[_0xfa0c('0x1')],'defaultValue':_0xfa0c('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0xfa0c('0x1')],'defaultValue':_0xfa0c('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0xfa0c('0x1')],'defaultValue':_0xfa0c('0x13')},'noteTitle':{'type':Sequelize[_0xfa0c('0x1')],'defaultValue':_0xfa0c('0x14')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0xfa0c('0x15')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xfa0c('0x16')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xfa0c('0xb')},'skipMessageButton':{'type':Sequelize[_0xfa0c('0x1')],'defaultValue':_0xfa0c('0x17')},'conditionAgreement':{'type':Sequelize[_0xfa0c('0xd')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xfa0c('0xd')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xfa0c('0xd')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xfa0c('0xd')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xfa0c('0x1')],'defaultValue':_0xfa0c('0x18')},'ratingType':{'type':Sequelize[_0xfa0c('0x7')](_0xfa0c('0x19'),_0xfa0c('0x1a')),'defaultValue':_0xfa0c('0x19')},'ratingStarsNumber':{'type':Sequelize[_0xfa0c('0xe')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xfa0c('0x10')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','variable':null,'config':{'placeholder':_0xfa0c('0x1b'),'type':_0xfa0c('0x1c'),'required':!![]},'props':{'title':_0xfa0c('0x1b'),'helpText':''}},{'type':_0xfa0c('0x1d'),'props':{'title':_0xfa0c('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xfa0c('0x3'),'type':_0xfa0c('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xfa0c('0x1e')]('onlineForm')?JSON[_0xfa0c('0x1f')](this[_0xfa0c('0x1e')](_0xfa0c('0x20'))):{};},'set':function(_0x45058d){return this[_0xfa0c('0x21')](_0xfa0c('0x20'),JSON[_0xfa0c('0x22')](_0x45058d));}},'offlineForm':{'type':Sequelize[_0xfa0c('0x10')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xfa0c('0x1d'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xfa0c('0x3'),'type':_0xfa0c('0x3')},'variable':null},{'type':_0xfa0c('0x23'),'config':{'placeholder':_0xfa0c('0x24')},'props':{'title':_0xfa0c('0x24'),'helpText':_0xfa0c('0x25')}}],'fromKey':0x0});},'get':function(){return this[_0xfa0c('0x1e')](_0xfa0c('0x26'))?JSON[_0xfa0c('0x1f')](this[_0xfa0c('0x1e')](_0xfa0c('0x26'))):{};},'set':function(_0x409b45){return this[_0xfa0c('0x21')](_0xfa0c('0x26'),JSON[_0xfa0c('0x22')](_0x409b45));}},'token':{'type':Sequelize[_0xfa0c('0x1')],'defaultValue':function(){return rs[_0xfa0c('0x27')]();}},'autoclose':{'type':Sequelize[_0xfa0c('0xd')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xfa0c('0x1')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xfa0c('0x1')]},'waitingTitle':{'type':Sequelize[_0xfa0c('0x1')],'defaultValue':_0xfa0c('0x28')},'waitingMessage':{'type':Sequelize[_0xfa0c('0x1')],'defaultValue':_0xfa0c('0x29')},'offlineMessageSubject':{'type':Sequelize[_0xfa0c('0x1')],'defaultValue':_0xfa0c('0x2a')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0xfa0c('0x2b')},'enableUnmanagedNote':{'type':Sequelize[_0xfa0c('0xd')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xfa0c('0x1')],'defaultValue':_0xfa0c('0x2c')},'skipUnmanaged':{'type':Sequelize[_0xfa0c('0x1')],'defaultValue':_0xfa0c('0x17')},'sendUnmanaged':{'type':Sequelize[_0xfa0c('0x1')],'defaultValue':_0xfa0c('0xb')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xfa0c('0xd')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xfa0c('0x10')]},'showAgentAvatar':{'type':Sequelize[_0xfa0c('0xd')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xfa0c('0x10')],'defaultValue':function(){return _0xfa0c('0x2d');}},'notificationSound':{'type':Sequelize[_0xfa0c('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xfa0c('0xd')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xfa0c('0xd')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xfa0c('0x1')],'defaultValue':_0xfa0c('0x2e')},'waitForTheAssignedAgent':{'type':Sequelize[_0xfa0c('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xfa0c('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xfa0c('0x1')],'defaultValue':_0xfa0c('0x2f')},'verticalAlignment':{'type':Sequelize[_0xfa0c('0xe')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xfa0c('0x1')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0xfa0c('0x1')],'defaultValue':_0xfa0c('0x30')},'defaultTitle':{'type':Sequelize[_0xfa0c('0x1')]},'customerAvatar':{'type':Sequelize[_0xfa0c('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0xfa0c('0xd')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xfa0c('0xe')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xfa0c('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfa0c('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xfa0c('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xfa0c('0x1')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfa0c('0xe')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xfa0c('0xd')],'defaultValue':![],'comment':_0xfa0c('0x31'),'set':function(_0x24580e){if(!_0x24580e)this[_0xfa0c('0x21')](_0xfa0c('0x32'),null);this[_0xfa0c('0x21')](_0xfa0c('0x33'),_0x24580e);}},'vidaooEscalation':{'type':Sequelize[_0xfa0c('0xd')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xfa0c('0x1')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xfa0c('0x34')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0xfa0c('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xfa0c('0xd')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xfa0c('0x10')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 31985e5..7e99b31 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 _0x7cdc=['EventManager','offline','files','send','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','server','offline-chat','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','originalname','subjectOffline','NotifyMailAccount','notifyMail','addInteraction','omit','getInteractions','Owner','fullname','Tags','tag','Command','getSnippet','iftime\x20%s,%s','iftime\x20%s','interval','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','timezone','No\x20timezone','Interval','Intervals','getProactiveActions','License','increment','chatLicenseExceeded','all','server/files/chat/iframe.ejs','URL','address','3.1.0','remote','x-real-ip','connection','remoteAddress','virtual','replace','color','labelText','textColor','textButtonColor','backgroundColor','hideWhenOffline','IntervalId','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','getApplications','chatProactiveAction','getFields','online','false','offlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','addAgents','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','ejs','fs-extra','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','url','../../mysqldb','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','html-to-text','jayson/promise','http','client','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','get','ChatWebsites','UserProfileResource','sendStatus','stack','name','index','Pause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','hasOwnProperty','nolimit','pick','removeDispositions','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','ids','addLogo','filename','addAvatar','agentAvatar','file','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','../../config/license/util','getLicense','custom','isNil','sitepic','server/files/images/logos/','download','getAvatar','existsSync','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','getResult','chat','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','ChatApplication','Applications','account','applications','list','priority','asc','Contacts','ListId','contact','customerIp','headers','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','format','unknown','%s\x20%s','device','%s\x20%s\x20%s','vendor','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','close','unmanaged','*,*,*,*','ChatMessage','User','UserId','unshift','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','Start','startRouting'];(function(_0x37e2a9,_0x2f47a6){var _0x310322=function(_0x4e6c25){while(--_0x4e6c25){_0x37e2a9['push'](_0x37e2a9['shift']());}};_0x310322(++_0x2f47a6);}(_0x7cdc,0x190));var _0xc7cd=function(_0x3e9a24,_0x20669f){_0x3e9a24=_0x3e9a24-0x0;var _0x57d822=_0x7cdc[_0x3e9a24];return _0x57d822;};'use strict';var BPromise=require('bluebird');var Mustache=require(_0xc7cd('0x0'));var util=require(_0xc7cd('0x1'));var path=require('path');var ejs=require(_0xc7cd('0x2'));var fs=require('fs');var fs_extra=require(_0xc7cd('0x3'));var _=require(_0xc7cd('0x4'));var querystring=require('querystring');var Redis=require(_0xc7cd('0x5'));var qs=require(_0xc7cd('0x6'));var logger=require('../../config/logger')(_0xc7cd('0x7'));var config=require(_0xc7cd('0x8'));var url=require(_0xc7cd('0x9'));var db=require(_0xc7cd('0xa'))['db'];config[_0xc7cd('0xb')]=_[_0xc7cd('0xc')](config[_0xc7cd('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xc7cd('0xd'))(new Redis(config['redis']));require(_0xc7cd('0xe'))[_0xc7cd('0xf')](socket);var htmlToText=require(_0xc7cd('0x10'));var jayson=require(_0xc7cd('0x11'));var client=jayson['client'][_0xc7cd('0x12')]({'port':0x232c});var client9002=jayson[_0xc7cd('0x13')][_0xc7cd('0x12')]({'port':0x232a});var client9003=jayson[_0xc7cd('0x13')]['http']({'port':0x232b});var client9001=jayson[_0xc7cd('0x13')]['http']({'port':0x2329});function respondWithRpcPromise(_0x464334,_0x712437,_0x1e2d07,_0x346e83){return new BPromise(function(_0x508a48,_0x3d43e3){var _0x39427e=_0x346e83||client;return _0x39427e['request'](_0x464334,_0x1e2d07)[_0xc7cd('0x14')](function(_0x5aa9a0){logger[_0xc7cd('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x712437,_0xc7cd('0x16'));logger[_0xc7cd('0x17')](_0xc7cd('0x18'),_0x712437,_0xc7cd('0x16'),JSON['stringify'](_0x5aa9a0));if(_0x5aa9a0[_0xc7cd('0x19')]){if(_0x5aa9a0[_0xc7cd('0x19')][_0xc7cd('0x1a')]===0x1f4){logger[_0xc7cd('0x19')](_0xc7cd('0x1b'),_0x712437,_0x5aa9a0[_0xc7cd('0x19')][_0xc7cd('0x1c')]);return _0x3d43e3(_0x5aa9a0[_0xc7cd('0x19')][_0xc7cd('0x1c')]);}logger['error'](_0xc7cd('0x1b'),_0x712437,_0x5aa9a0['error'][_0xc7cd('0x1c')]);return _0x508a48(_0x5aa9a0[_0xc7cd('0x19')][_0xc7cd('0x1c')]);}else{logger[_0xc7cd('0x15')](_0xc7cd('0x1b'),_0x712437,'request\x20sent');_0x508a48(_0x5aa9a0[_0xc7cd('0x1d')][_0xc7cd('0x1c')]);}})[_0xc7cd('0x1e')](function(_0x20fc95){logger['error'](_0xc7cd('0x1b'),_0x712437,_0x20fc95);_0x3d43e3(_0x20fc95);});});}function respondWithStatusCode(_0x3bbe69,_0x275f0b){_0x275f0b=_0x275f0b||0xcc;return function(_0x388a0d){if(_0x388a0d){return _0x3bbe69['sendStatus'](_0x275f0b);}return _0x3bbe69['status'](_0x275f0b)['end']();};}function respondWithResult(_0x3b92a2,_0x577e4a){_0x577e4a=_0x577e4a||0xc8;return function(_0x2014bb){if(_0x2014bb){return _0x3b92a2[_0xc7cd('0x1f')](_0x577e4a)[_0xc7cd('0x20')](_0x2014bb);}};}function respondWithFilteredResult(_0x2601b8,_0x4450a5){return function(_0x3242a4){if(_0x3242a4){var _0x5d16e3=typeof _0x4450a5[_0xc7cd('0x21')]===_0xc7cd('0x22')&&typeof _0x4450a5[_0xc7cd('0x23')]===_0xc7cd('0x22');var _0x51d040=_0x3242a4[_0xc7cd('0x24')];var _0x3994ae=_0x5d16e3?0x0:_0x4450a5[_0xc7cd('0x21')];var _0x173378=_0x5d16e3?_0x3242a4['count']:_0x4450a5[_0xc7cd('0x21')]+_0x4450a5[_0xc7cd('0x23')];var _0x5ab9a2;if(_0x173378>=_0x51d040){_0x173378=_0x51d040;_0x5ab9a2=0xc8;}else{_0x5ab9a2=0xce;}_0x2601b8['status'](_0x5ab9a2);return _0x2601b8[_0xc7cd('0x25')](_0xc7cd('0x26'),_0x3994ae+'-'+_0x173378+'/'+_0x51d040)[_0xc7cd('0x20')](_0x3242a4);}return null;};}function saveUpdates(_0x34530d){return function(_0x5c177a){if(_0x5c177a){return _0x5c177a[_0xc7cd('0x27')](_0x34530d)[_0xc7cd('0x14')](function(_0x5ed4d5){return _0x5ed4d5;});}return null;};}function removeEntity(_0x1b7f72){return function(_0x4ed12a){if(_0x4ed12a){return _0x4ed12a[_0xc7cd('0x28')]()[_0xc7cd('0x14')](function(){var _0x37df2a=_0x4ed12a[_0xc7cd('0x29')]({'plain':!![]});var _0x15d4cf=_0xc7cd('0x2a');return db[_0xc7cd('0x2b')][_0xc7cd('0x28')]({'where':{'type':_0x15d4cf,'resourceId':_0x37df2a['id']}})['then'](function(){return _0x4ed12a;});})['then'](function(){_0x1b7f72[_0xc7cd('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5dfa8a){return function(_0x68f3b3){if(!_0x68f3b3){_0x5dfa8a[_0xc7cd('0x2c')](0x194);}return _0x68f3b3;};}function handleError(_0x1933a4,_0x1b8e7b){_0x1b8e7b=_0x1b8e7b||0x1f4;return function(_0x4e1582){logger[_0xc7cd('0x19')](_0x4e1582[_0xc7cd('0x2d')]);if(_0x4e1582[_0xc7cd('0x2e')]){delete _0x4e1582[_0xc7cd('0x2e')];}_0x1933a4[_0xc7cd('0x1f')](_0x1b8e7b)['send'](_0x4e1582);};}exports[_0xc7cd('0x2f')]=function(_0x2d2fc7,_0x5c6060){var _0xf0eb98={'include':[{'model':db[_0xc7cd('0x30')],'as':'mandatoryDispositionPause'}]},_0x3fcec9={},_0x1ed44e={'count':0x0,'rows':[]};var _0x15092c=_[_0xc7cd('0x31')](db[_0xc7cd('0x32')][_0xc7cd('0x33')],function(_0x42afee){return{'name':_0x42afee[_0xc7cd('0x34')],'type':_0x42afee[_0xc7cd('0x35')][_0xc7cd('0x36')]};});_0x3fcec9[_0xc7cd('0x37')]=_[_0xc7cd('0x31')](_0x15092c,'name');_0x3fcec9[_0xc7cd('0x38')]=_['keys'](_0x2d2fc7[_0xc7cd('0x38')]);_0x3fcec9[_0xc7cd('0x39')]=_[_0xc7cd('0x3a')](_0x3fcec9[_0xc7cd('0x37')],_0x3fcec9[_0xc7cd('0x38')]);_0xf0eb98[_0xc7cd('0x3b')]=_['intersection'](_0x3fcec9['model'],qs[_0xc7cd('0x3c')](_0x2d2fc7[_0xc7cd('0x38')][_0xc7cd('0x3c')]));_0xf0eb98['attributes']=_0xf0eb98[_0xc7cd('0x3b')][_0xc7cd('0x3d')]?_0xf0eb98[_0xc7cd('0x3b')]:_0x3fcec9[_0xc7cd('0x37')];if(!_0x2d2fc7[_0xc7cd('0x38')]['hasOwnProperty']('nolimit')){_0xf0eb98[_0xc7cd('0x23')]=qs[_0xc7cd('0x23')](_0x2d2fc7[_0xc7cd('0x38')]['limit']);_0xf0eb98[_0xc7cd('0x21')]=qs[_0xc7cd('0x21')](_0x2d2fc7[_0xc7cd('0x38')][_0xc7cd('0x21')]);}_0xf0eb98[_0xc7cd('0x3e')]=qs[_0xc7cd('0x3f')](_0x2d2fc7['query'][_0xc7cd('0x3f')]);_0xf0eb98[_0xc7cd('0x40')]=qs[_0xc7cd('0x39')](_['pick'](_0x2d2fc7['query'],_0x3fcec9[_0xc7cd('0x39')]),_0x15092c);if(_0x2d2fc7[_0xc7cd('0x38')][_0xc7cd('0x41')]){_0xf0eb98[_0xc7cd('0x40')]=_[_0xc7cd('0x42')](_0xf0eb98['where'],{'$or':_['map'](_0x15092c,function(_0x505766){if(_0x505766[_0xc7cd('0x35')]!==_0xc7cd('0x43')){var _0xe3461e={};_0xe3461e[_0x505766[_0xc7cd('0x2e')]]={'$like':'%'+_0x2d2fc7[_0xc7cd('0x38')]['filter']+'%'};return _0xe3461e;}})});}_0xf0eb98=_[_0xc7cd('0x42')]({},_0xf0eb98,_0x2d2fc7[_0xc7cd('0x44')]);var _0x10b314={'where':_0xf0eb98[_0xc7cd('0x40')]};return db[_0xc7cd('0x32')][_0xc7cd('0x24')](_0x10b314)[_0xc7cd('0x14')](function(_0x9e5b30){_0x1ed44e[_0xc7cd('0x24')]=_0x9e5b30;if(_0x2d2fc7[_0xc7cd('0x38')][_0xc7cd('0x45')]){_0xf0eb98[_0xc7cd('0x46')]=[{'all':!![]}];}return db[_0xc7cd('0x32')][_0xc7cd('0x47')](_0xf0eb98);})['then'](function(_0x60a2cd){_0x1ed44e[_0xc7cd('0x48')]=_0x60a2cd;return _0x1ed44e;})['then'](respondWithFilteredResult(_0x5c6060,_0xf0eb98))[_0xc7cd('0x1e')](handleError(_0x5c6060,null));};exports[_0xc7cd('0x49')]=function(_0x3897bb,_0x6e99d9){var _0x1e7093={'raw':![],'where':{'id':_0x3897bb[_0xc7cd('0x4a')]['id']},'include':[{'model':db[_0xc7cd('0x30')],'as':_0xc7cd('0x4b')}]},_0x205d3e={};_0x205d3e[_0xc7cd('0x37')]=_[_0xc7cd('0x4c')](db[_0xc7cd('0x32')][_0xc7cd('0x33')]);_0x205d3e[_0xc7cd('0x38')]=_['keys'](_0x3897bb['query']);_0x205d3e['filters']=_['intersection'](_0x205d3e[_0xc7cd('0x37')],_0x205d3e[_0xc7cd('0x38')]);_0x1e7093[_0xc7cd('0x3b')]=_[_0xc7cd('0x3a')](_0x205d3e[_0xc7cd('0x37')],qs[_0xc7cd('0x3c')](_0x3897bb[_0xc7cd('0x38')][_0xc7cd('0x3c')]));_0x1e7093[_0xc7cd('0x3b')]=_0x1e7093[_0xc7cd('0x3b')][_0xc7cd('0x3d')]?_0x1e7093[_0xc7cd('0x3b')]:_0x205d3e[_0xc7cd('0x37')];if(_0x3897bb[_0xc7cd('0x38')][_0xc7cd('0x45')]){_0x1e7093['include']=[{'all':!![]}];}_0x1e7093=_[_0xc7cd('0x42')]({},_0x1e7093,_0x3897bb[_0xc7cd('0x44')]);return db[_0xc7cd('0x32')]['find'](_0x1e7093)['then'](handleEntityNotFound(_0x6e99d9,null))[_0xc7cd('0x14')](respondWithResult(_0x6e99d9,null))['catch'](handleError(_0x6e99d9,null));};exports['create']=function(_0x5dd5bf,_0x15548d){return db[_0xc7cd('0x32')][_0xc7cd('0x4d')](_0x5dd5bf[_0xc7cd('0x4e')],{})['then'](function(_0x4733a6){var _0x161e09=_0x5dd5bf[_0xc7cd('0x4f')][_0xc7cd('0x29')]({'plain':!![]});if(!_0x161e09)throw new Error(_0xc7cd('0x50'));if(_0x161e09[_0xc7cd('0x51')]===_0xc7cd('0x4f')){var _0x330537=_0x4733a6[_0xc7cd('0x29')]({'plain':!![]});var _0x568d3d=_0xc7cd('0x2a');return db[_0xc7cd('0x52')][_0xc7cd('0x53')]({'where':{'name':_0x568d3d,'userProfileId':_0x161e09['userProfileId']},'raw':!![]})['then'](function(_0x202f7b){if(_0x202f7b&&_0x202f7b[_0xc7cd('0x54')]===0x0){return db[_0xc7cd('0x2b')][_0xc7cd('0x4d')]({'name':_0x330537[_0xc7cd('0x2e')],'resourceId':_0x330537['id'],'type':_0x202f7b[_0xc7cd('0x2e')],'sectionId':_0x202f7b['id']},{})[_0xc7cd('0x14')](function(){return _0x4733a6;});}else{return _0x4733a6;}})['catch'](function(_0x26f2c6){logger['error'](_0xc7cd('0x55'),_0x26f2c6);throw _0x26f2c6;});}return _0x4733a6;})[_0xc7cd('0x14')](respondWithResult(_0x15548d,0xc9))[_0xc7cd('0x1e')](handleError(_0x15548d,null));};exports['update']=function(_0x2cebb1,_0x1307c6){if(_0x2cebb1[_0xc7cd('0x4e')]['id']){delete _0x2cebb1[_0xc7cd('0x4e')]['id'];}return db['ChatWebsite'][_0xc7cd('0x53')]({'where':{'id':_0x2cebb1[_0xc7cd('0x4a')]['id']},'include':[{'model':db[_0xc7cd('0x30')],'as':_0xc7cd('0x4b')}]})['then'](handleEntityNotFound(_0x1307c6,null))[_0xc7cd('0x14')](saveUpdates(_0x2cebb1[_0xc7cd('0x4e')],null))[_0xc7cd('0x14')](respondWithResult(_0x1307c6,null))[_0xc7cd('0x1e')](handleError(_0x1307c6,null));};exports[_0xc7cd('0x28')]=function(_0x4fe62a,_0x4f229e){return db[_0xc7cd('0x32')]['find']({'where':{'id':_0x4fe62a['params']['id']}})['then'](handleEntityNotFound(_0x4f229e,null))[_0xc7cd('0x14')](removeEntity(_0x4f229e,null))['catch'](handleError(_0x4f229e,null));};exports[_0xc7cd('0x56')]=function(_0x105347,_0x74eacf){return db['ChatWebsite'][_0xc7cd('0x56')]()[_0xc7cd('0x14')](respondWithResult(_0x74eacf,null))[_0xc7cd('0x1e')](handleError(_0x74eacf,null));};exports[_0xc7cd('0x57')]=function(_0x1f970c,_0x1046af){if(_0x1f970c['body']['id']){delete _0x1f970c['body']['id'];}return db[_0xc7cd('0x32')]['find']({'where':{'id':_0x1f970c['params']['id']}})[_0xc7cd('0x14')](handleEntityNotFound(_0x1046af,null))[_0xc7cd('0x14')](function(_0x20e997){if(_0x20e997){_0x1f970c[_0xc7cd('0x4e')][_0xc7cd('0x58')]=_0x20e997['id'];return db[_0xc7cd('0x59')]['create'](_0x1f970c[_0xc7cd('0x4e')]);}})[_0xc7cd('0x14')](respondWithResult(_0x1046af,null))[_0xc7cd('0x1e')](handleError(_0x1046af,null));};exports[_0xc7cd('0x5a')]=function(_0x362a41,_0x5bb5fb){var _0xe149ed={'raw':![],'where':{}};var _0xfc0d64={};var _0x49906c={'count':0x0,'rows':[]};return db[_0xc7cd('0x32')]['findOne']({'where':{'id':_0x362a41[_0xc7cd('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5bb5fb,null))[_0xc7cd('0x14')](function(_0x565092){if(_0x565092){_0xfc0d64[_0xc7cd('0x37')]=_[_0xc7cd('0x4c')](db['Disposition'][_0xc7cd('0x33')]);_0xfc0d64['query']=_[_0xc7cd('0x4c')](_0x362a41[_0xc7cd('0x38')]);_0xfc0d64[_0xc7cd('0x39')]=_[_0xc7cd('0x3a')](_0xfc0d64[_0xc7cd('0x37')],_0xfc0d64['query']);_0xe149ed[_0xc7cd('0x3b')]=_[_0xc7cd('0x3a')](_0xfc0d64[_0xc7cd('0x37')],qs[_0xc7cd('0x3c')](_0x362a41['query'][_0xc7cd('0x3c')]));_0xe149ed['attributes']=_0xe149ed[_0xc7cd('0x3b')]['length']?_0xe149ed[_0xc7cd('0x3b')]:_0xfc0d64['model'];if(!_0x362a41[_0xc7cd('0x38')][_0xc7cd('0x5b')](_0xc7cd('0x5c'))){_0xe149ed[_0xc7cd('0x23')]=qs[_0xc7cd('0x23')](_0x362a41[_0xc7cd('0x38')][_0xc7cd('0x23')]);_0xe149ed[_0xc7cd('0x21')]=qs[_0xc7cd('0x21')](_0x362a41[_0xc7cd('0x38')][_0xc7cd('0x21')]);}_0xe149ed[_0xc7cd('0x3e')]=qs['sort'](_0x362a41[_0xc7cd('0x38')][_0xc7cd('0x3f')]);_0xe149ed['where']=qs[_0xc7cd('0x39')](_[_0xc7cd('0x5d')](_0x362a41[_0xc7cd('0x38')],_0xfc0d64[_0xc7cd('0x39')]));_0xe149ed[_0xc7cd('0x40')][_0xc7cd('0x58')]=_0x565092['id'];if(_0x362a41[_0xc7cd('0x38')][_0xc7cd('0x41')]){_0xe149ed[_0xc7cd('0x40')]=_[_0xc7cd('0x42')](_0xe149ed[_0xc7cd('0x40')],{'$or':_[_0xc7cd('0x31')](_0xe149ed[_0xc7cd('0x3b')],function(_0x504742){var _0x2ad717={};_0x2ad717[_0x504742]={'$like':'%'+_0x362a41['query'][_0xc7cd('0x41')]+'%'};return _0x2ad717;})});}_0xe149ed=_[_0xc7cd('0x42')]({},_0xe149ed,_0x362a41[_0xc7cd('0x44')]);return db[_0xc7cd('0x59')][_0xc7cd('0x24')]({'where':_0xe149ed[_0xc7cd('0x40')]})[_0xc7cd('0x14')](function(_0x3aa810){_0x49906c[_0xc7cd('0x24')]=_0x3aa810;if(_0x362a41['query'][_0xc7cd('0x45')]){_0xe149ed[_0xc7cd('0x46')]=[{'all':!![]}];}return db[_0xc7cd('0x59')][_0xc7cd('0x47')](_0xe149ed);})[_0xc7cd('0x14')](function(_0x48e708){_0x49906c['rows']=_0x48e708;return _0x49906c;});}})['then'](respondWithFilteredResult(_0x5bb5fb,_0xe149ed))['catch'](handleError(_0x5bb5fb,null));};exports[_0xc7cd('0x5e')]=function(_0x5a0b77,_0x327de0){return db[_0xc7cd('0x32')][_0xc7cd('0x53')]({'where':{'id':_0x5a0b77['params']['id']}})[_0xc7cd('0x14')](handleEntityNotFound(_0x327de0,null))[_0xc7cd('0x14')](function(_0x18790e){if(_0x18790e){return _0x18790e[_0xc7cd('0x5e')](_0x5a0b77[_0xc7cd('0x38')]['ids']);}})[_0xc7cd('0x14')](respondWithStatusCode(_0x327de0,null))[_0xc7cd('0x1e')](handleError(_0x327de0,null));};exports[_0xc7cd('0x5f')]=function(_0x421a38,_0x3f7945){if(_0x421a38['body']['id']){delete _0x421a38[_0xc7cd('0x4e')]['id'];}return db[_0xc7cd('0x32')][_0xc7cd('0x53')]({'where':{'id':_0x421a38[_0xc7cd('0x4a')]['id']}})[_0xc7cd('0x14')](handleEntityNotFound(_0x3f7945,null))['then'](function(_0x2c459e){if(_0x2c459e){_0x421a38['body'][_0xc7cd('0x58')]=_0x2c459e['id'];return db['CannedAnswer'][_0xc7cd('0x4d')](_0x421a38['body']);}})[_0xc7cd('0x14')](respondWithResult(_0x3f7945,null))[_0xc7cd('0x1e')](handleError(_0x3f7945,null));};exports[_0xc7cd('0x60')]=function(_0x355a99,_0x1dd8c6){var _0x5b22b5={'raw':![],'where':{}};var _0x4e2abe={};var _0x27e3f9={'count':0x0,'rows':[]};return db[_0xc7cd('0x32')][_0xc7cd('0x61')]({'where':{'id':_0x355a99[_0xc7cd('0x4a')]['id']}})[_0xc7cd('0x14')](handleEntityNotFound(_0x1dd8c6,null))[_0xc7cd('0x14')](function(_0x17f986){if(_0x17f986){_0x4e2abe['model']=_[_0xc7cd('0x4c')](db['CannedAnswer'][_0xc7cd('0x33')]);_0x4e2abe[_0xc7cd('0x38')]=_['keys'](_0x355a99[_0xc7cd('0x38')]);_0x4e2abe['filters']=_['intersection'](_0x4e2abe['model'],_0x4e2abe[_0xc7cd('0x38')]);_0x5b22b5[_0xc7cd('0x3b')]=_[_0xc7cd('0x3a')](_0x4e2abe[_0xc7cd('0x37')],qs[_0xc7cd('0x3c')](_0x355a99['query'][_0xc7cd('0x3c')]));_0x5b22b5[_0xc7cd('0x3b')]=_0x5b22b5['attributes'][_0xc7cd('0x3d')]?_0x5b22b5['attributes']:_0x4e2abe[_0xc7cd('0x37')];if(!_0x355a99[_0xc7cd('0x38')][_0xc7cd('0x5b')](_0xc7cd('0x5c'))){_0x5b22b5[_0xc7cd('0x23')]=qs[_0xc7cd('0x23')](_0x355a99[_0xc7cd('0x38')][_0xc7cd('0x23')]);_0x5b22b5[_0xc7cd('0x21')]=qs[_0xc7cd('0x21')](_0x355a99['query']['offset']);}_0x5b22b5[_0xc7cd('0x3e')]=qs[_0xc7cd('0x3f')](_0x355a99[_0xc7cd('0x38')][_0xc7cd('0x3f')]);_0x5b22b5[_0xc7cd('0x40')]=qs['filters'](_[_0xc7cd('0x5d')](_0x355a99[_0xc7cd('0x38')],_0x4e2abe[_0xc7cd('0x39')]));_0x5b22b5[_0xc7cd('0x40')][_0xc7cd('0x58')]=_0x17f986['id'];if(_0x355a99['query']['filter']){_0x5b22b5[_0xc7cd('0x40')]=_[_0xc7cd('0x42')](_0x5b22b5['where'],{'$or':_[_0xc7cd('0x31')](_0x5b22b5[_0xc7cd('0x3b')],function(_0x3adab8){var _0x370f5d={};_0x370f5d[_0x3adab8]={'$like':'%'+_0x355a99[_0xc7cd('0x38')]['filter']+'%'};return _0x370f5d;})});}_0x5b22b5=_[_0xc7cd('0x42')]({},_0x5b22b5,_0x355a99[_0xc7cd('0x44')]);return db['CannedAnswer'][_0xc7cd('0x24')]({'where':_0x5b22b5[_0xc7cd('0x40')]})[_0xc7cd('0x14')](function(_0x3fc99b){_0x27e3f9[_0xc7cd('0x24')]=_0x3fc99b;if(_0x355a99['query']['includeAll']){_0x5b22b5[_0xc7cd('0x46')]=[{'all':!![]}];}return db[_0xc7cd('0x62')]['findAll'](_0x5b22b5);})[_0xc7cd('0x14')](function(_0x593587){_0x27e3f9[_0xc7cd('0x48')]=_0x593587;return _0x27e3f9;});}})[_0xc7cd('0x14')](respondWithFilteredResult(_0x1dd8c6,_0x5b22b5))[_0xc7cd('0x1e')](handleError(_0x1dd8c6,null));};exports[_0xc7cd('0x63')]=function(_0x14be59,_0x18dda4){return db[_0xc7cd('0x32')][_0xc7cd('0x53')]({'where':{'id':_0x14be59[_0xc7cd('0x4a')]['id']}})[_0xc7cd('0x14')](handleEntityNotFound(_0x18dda4,null))[_0xc7cd('0x14')](function(_0x1c2bfb){if(_0x1c2bfb){return _0x1c2bfb[_0xc7cd('0x63')](_0x14be59[_0xc7cd('0x38')][_0xc7cd('0x64')]);}})[_0xc7cd('0x14')](respondWithStatusCode(_0x18dda4,null))[_0xc7cd('0x1e')](handleError(_0x18dda4,null));};exports[_0xc7cd('0x65')]=function(_0x97fa5a,_0x34baec){_0x97fa5a['body']['sitepic']=_0x97fa5a['file'][_0xc7cd('0x66')];return db[_0xc7cd('0x32')]['find']({'where':{'id':_0x97fa5a[_0xc7cd('0x4a')]['id']}})[_0xc7cd('0x14')](handleEntityNotFound(_0x34baec,null))[_0xc7cd('0x14')](saveUpdates(_0x97fa5a[_0xc7cd('0x4e')],null))[_0xc7cd('0x14')](respondWithResult(_0x34baec,null))['catch'](handleError(_0x34baec,null));};exports[_0xc7cd('0x67')]=function(_0x91d8f9,_0x59b862){_0x91d8f9[_0xc7cd('0x4e')][_0xc7cd('0x68')]=_0x91d8f9[_0xc7cd('0x69')]['filename'];return db[_0xc7cd('0x32')]['find']({'where':{'id':_0x91d8f9['params']['id']}})['then'](handleEntityNotFound(_0x59b862,null))[_0xc7cd('0x14')](saveUpdates(_0x91d8f9[_0xc7cd('0x4e')],null))[_0xc7cd('0x14')](respondWithResult(_0x59b862,null))[_0xc7cd('0x1e')](handleError(_0x59b862,null));};exports[_0xc7cd('0x6a')]=function(_0x26f244,_0xb88536){_0x26f244[_0xc7cd('0x4e')][_0xc7cd('0x6b')]=_0x26f244[_0xc7cd('0x69')][_0xc7cd('0x66')];return db['ChatWebsite'][_0xc7cd('0x53')]({'where':{'id':_0x26f244['params']['id']}})['then'](handleEntityNotFound(_0xb88536,null))[_0xc7cd('0x14')](saveUpdates(_0x26f244['body'],null))[_0xc7cd('0x14')](respondWithResult(_0xb88536,null))[_0xc7cd('0x1e')](handleError(_0xb88536,null));};exports[_0xc7cd('0x6c')]=function(_0x3dc57f,_0x12e32e){_0x3dc57f[_0xc7cd('0x4e')][_0xc7cd('0x6d')]=_0x3dc57f[_0xc7cd('0x69')][_0xc7cd('0x66')];return db[_0xc7cd('0x32')]['find']({'where':{'id':_0x3dc57f[_0xc7cd('0x4a')]['id']}})[_0xc7cd('0x14')](handleEntityNotFound(_0x12e32e,null))[_0xc7cd('0x14')](saveUpdates(_0x3dc57f[_0xc7cd('0x4e')],null))[_0xc7cd('0x14')](respondWithResult(_0x12e32e,null))[_0xc7cd('0x1e')](handleError(_0x12e32e,null));};exports[_0xc7cd('0x6e')]=function(_0x1aea7e,_0x133678){var _0x974a2d=path[_0xc7cd('0x6f')](config[_0xc7cd('0x70')],'server/files/images/logos/default_logo.svg');var _0x5f2495={'where':{'id':_0x1aea7e[_0xc7cd('0x4a')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0xda3662=![];return require(_0xc7cd('0x71'))[_0xc7cd('0x72')]()['then'](function(_0x5507cf){if(_0x5507cf){_0xda3662=_0x5507cf[_0xc7cd('0x73')];}})[_0xc7cd('0x14')](function(){return db[_0xc7cd('0x32')][_0xc7cd('0x53')](_0x5f2495);})['then'](handleEntityNotFound(_0x133678,null))['then'](function(_0x13592d){if(_0x13592d){if(!_[_0xc7cd('0x74')](_0x13592d[_0xc7cd('0x75')])){if(fs['existsSync'](path[_0xc7cd('0x6f')](config['root'],_0xc7cd('0x76'),_0x13592d[_0xc7cd('0x75')]))&&_0xda3662){_0x974a2d=path[_0xc7cd('0x6f')](config['root'],_0xc7cd('0x76'),_0x13592d[_0xc7cd('0x75')]);}}return _0x133678[_0xc7cd('0x77')](_0x974a2d);}})[_0xc7cd('0x1e')](handleError(_0x133678,null));};exports[_0xc7cd('0x78')]=function(_0x332a04,_0x40f2b3){var _0x3e210d=path[_0xc7cd('0x6f')](config['root'],'server/files/images/avatars/default_avatar.png');var _0x36879d={'where':{'id':_0x332a04['params']['id']},'attributes':['id',_0xc7cd('0x68')],'raw':!![]};return db['ChatWebsite'][_0xc7cd('0x53')](_0x36879d)['then'](handleEntityNotFound(_0x40f2b3,null))[_0xc7cd('0x14')](function(_0x462a1f){if(_0x462a1f){if(!_[_0xc7cd('0x74')](_0x462a1f[_0xc7cd('0x68')])){if(fs[_0xc7cd('0x79')](path[_0xc7cd('0x6f')](config[_0xc7cd('0x70')],_0xc7cd('0x7a'),_0x462a1f[_0xc7cd('0x68')]))){_0x3e210d=path['join'](config[_0xc7cd('0x70')],'server/files/images/avatars/',_0x462a1f[_0xc7cd('0x68')]);}}return _0x40f2b3['download'](_0x3e210d);}})[_0xc7cd('0x1e')](handleError(_0x40f2b3,null));};exports[_0xc7cd('0x7b')]=function(_0x3bf4cb,_0x31b609){var _0x3045ec=path[_0xc7cd('0x6f')](config[_0xc7cd('0x70')],'server/files/images/avatars/customer_avatar.png');var _0x25dab0={'where':{'id':_0x3bf4cb[_0xc7cd('0x4a')]['id']},'attributes':['id',_0xc7cd('0x6b'),'showCustomerAvatar'],'raw':!![]};return db[_0xc7cd('0x32')][_0xc7cd('0x53')](_0x25dab0)[_0xc7cd('0x14')](handleEntityNotFound(_0x31b609,null))['then'](function(_0x1bb9af){if(_0x1bb9af){if(!_[_0xc7cd('0x74')](_0x1bb9af[_0xc7cd('0x6b')])){if(fs[_0xc7cd('0x79')](path[_0xc7cd('0x6f')](config['root'],_0xc7cd('0x7a'),_0x1bb9af[_0xc7cd('0x6b')]))&&_0x1bb9af[_0xc7cd('0x7c')]){_0x3045ec=path[_0xc7cd('0x6f')](config[_0xc7cd('0x70')],_0xc7cd('0x7a'),_0x1bb9af['customerAvatar']);}}return _0x31b609[_0xc7cd('0x77')](_0x3045ec);}})['catch'](handleError(_0x31b609,null));};exports[_0xc7cd('0x7d')]=function(_0x31a9ac,_0x5af9c1){var _0x1b6585=path[_0xc7cd('0x6f')](config['root'],_0xc7cd('0x7e'));var _0x37ccc4={'where':{'id':_0x31a9ac[_0xc7cd('0x4a')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xc7cd('0x32')][_0xc7cd('0x53')](_0x37ccc4)[_0xc7cd('0x14')](handleEntityNotFound(_0x5af9c1,null))[_0xc7cd('0x14')](function(_0xdd662a){if(_0xdd662a){if(!_[_0xc7cd('0x74')](_0xdd662a[_0xc7cd('0x6d')])){if(fs[_0xc7cd('0x79')](path['join'](config[_0xc7cd('0x70')],_0xc7cd('0x7a'),_0xdd662a[_0xc7cd('0x6d')]))){_0x1b6585=path[_0xc7cd('0x6f')](config['root'],'server/files/images/avatars/',_0xdd662a[_0xc7cd('0x6d')]);}}return _0x5af9c1['download'](_0x1b6585);}})['catch'](handleError(_0x5af9c1,null));};exports[_0xc7cd('0x7f')]=function(_0x352936,_0x5c7dbd){var _0x5cbc31=require(_0xc7cd('0x80'));var _0x408e6d=new _0x5cbc31();var _0xf32974=_0x408e6d[_0xc7cd('0x81')](_0x352936['headers']['user-agent'])[_0xc7cd('0x82')]();var _0x599ef2={'body':_0x352936[_0xc7cd('0x4e')],'channel':_0xc7cd('0x83')};var _0x54bc44=[];var _0x9cf1d8=[];var _0x4af3e4={};var _0x4bda52=![];return db[_0xc7cd('0x84')]['describe']()[_0xc7cd('0x14')](function(_0x590a6d){if(!_0x590a6d){throw new db['Sequelize'][(_0xc7cd('0x85'))](_0xc7cd('0x86'));}_0x54bc44=_[_0xc7cd('0x87')](_[_0xc7cd('0x4c')](_0x590a6d),[_0xc7cd('0x88'),_0xc7cd('0x89')]);_0x9cf1d8=_['difference'](_[_0xc7cd('0x4c')](_0x590a6d),[_0xc7cd('0x88'),_0xc7cd('0x89'),_0xc7cd('0x8a'),'ListId']);if(_0x352936[_0xc7cd('0x4e')]['id']){delete _0x352936[_0xc7cd('0x4e')]['id'];}if(_[_0xc7cd('0x74')](_0x352936['body']['from'])){throw new db[(_0xc7cd('0x8b'))][(_0xc7cd('0x85'))](_0xc7cd('0x8c'));}if(_[_0xc7cd('0x74')](_0x352936['body']['body'])||_0x352936[_0xc7cd('0x4e')][_0xc7cd('0x4e')]===''){throw new db[(_0xc7cd('0x8b'))][(_0xc7cd('0x85'))](_0xc7cd('0x8d'));}if(_[_0xc7cd('0x74')](_0x352936[_0xc7cd('0x4e')]['mapKey'])){throw new db[(_0xc7cd('0x8b'))][(_0xc7cd('0x85'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x9cf1d8);}if(!_['includes'](_0x9cf1d8,_0x352936[_0xc7cd('0x4e')][_0xc7cd('0x8e')])){throw new db[(_0xc7cd('0x8b'))][(_0xc7cd('0x85'))](_0xc7cd('0x8f')+_0x9cf1d8);}_0x4af3e4[_0x352936['body'][_0xc7cd('0x8e')]]=_0x352936[_0xc7cd('0x4e')][_0xc7cd('0x90')];})[_0xc7cd('0x14')](function(){return db['ChatWebsite'][_0xc7cd('0x53')]({'where':{'id':_0x352936[_0xc7cd('0x4a')]['id']},'include':[{'model':db[_0xc7cd('0x91')],'as':_0xc7cd('0x92'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x4af3e4,'limit':0x1,'order':[[_0xc7cd('0x89'),'DESC']]}]},{'model':db[_0xc7cd('0x93')],'as':_0xc7cd('0x94')}]});})[_0xc7cd('0x14')](handleEntityNotFound(_0x5c7dbd,null))[_0xc7cd('0x14')](function(_0x493f8a){if(_0x493f8a&&_0x493f8a[_0xc7cd('0x92')]){_0x599ef2[_0xc7cd('0x95')]=_0x493f8a;_0x599ef2[_0xc7cd('0x96')]=_0x493f8a['Applications'];_0x599ef2[_0xc7cd('0x97')]=_0x493f8a[_0xc7cd('0x92')];_0x599ef2['applications']=_['orderBy'](_0x599ef2[_0xc7cd('0x96')],[_0xc7cd('0x98')],[_0xc7cd('0x99')]);if(_0x599ef2[_0xc7cd('0x95')][_0xc7cd('0x94')]){delete _0x599ef2[_0xc7cd('0x95')][_0xc7cd('0x94')];}if(_0x599ef2['account'][_0xc7cd('0x92')]&&_0x599ef2[_0xc7cd('0x95')]['List'][_0xc7cd('0x9a')][_0xc7cd('0x3d')]){return _0x599ef2['account'][_0xc7cd('0x92')][_0xc7cd('0x9a')][0x0];}var _0x561a41=_[_0xc7cd('0xc')](_0x352936['body'],{'firstName':_0x352936['body'][_0xc7cd('0x90')],'ListId':_0x493f8a[_0xc7cd('0x9b')]});_0x561a41[_0x352936[_0xc7cd('0x4e')][_0xc7cd('0x8e')]]=_0x352936[_0xc7cd('0x4e')]['from'];return db['CmContact'][_0xc7cd('0x4d')](_0x561a41,{'fields':_0x54bc44,'raw':!![]});}})[_0xc7cd('0x14')](handleEntityNotFound(_0x5c7dbd,null))['then'](function(_0x49985f){_0x599ef2[_0xc7cd('0x9c')]=_0x49985f;var _0x59f836=_0x352936['body'][_0xc7cd('0x9d')];if(_0x352936[_0xc7cd('0x9e')]['cf-connecting-ip']){_0x59f836=_0x352936[_0xc7cd('0x9e')][_0xc7cd('0x9f')];}else if(_0x352936[_0xc7cd('0x9e')][_0xc7cd('0xa0')]){_0x59f836=_[_0xc7cd('0xa1')](_0x352936[_0xc7cd('0x9e')][_0xc7cd('0xa0')][_0xc7cd('0xa2')](','));}if(_0x49985f){var _0x318dfb={'ContactId':_0x49985f['id'],'ChatWebsiteId':_0x352936[_0xc7cd('0x4a')]['id'],'from':(_0x49985f[_0xc7cd('0xa3')]||'')+'\x20'+(_0x49985f[_0xc7cd('0xa4')]||''),'customerIp':_0x59f836,'customerPort':_0x352936[_0xc7cd('0x9e')][_0xc7cd('0xa5')]?_0x352936[_0xc7cd('0x9e')][_0xc7cd('0xa5')]:null,'referer':_0x352936[_0xc7cd('0x4e')][_0xc7cd('0xa6')],'browserName':_0xf32974[_0xc7cd('0xa7')][_0xc7cd('0x2e')]&&_0xf32974['browser'][_0xc7cd('0xa8')]?util[_0xc7cd('0xa9')]('%s\x20%s',_0xf32974['browser']['name'],_0xf32974['browser'][_0xc7cd('0xa8')]):_0xc7cd('0xaa'),'browserVersion':_0xf32974['browser']['version']||_0xc7cd('0xaa'),'osName':util[_0xc7cd('0xa9')](_0xc7cd('0xab'),_0xf32974['os'][_0xc7cd('0x2e')],_0xf32974['os'][_0xc7cd('0xa8')]),'osVersion':_0xf32974['os'][_0xc7cd('0xa8')],'deviceModel':_0xf32974['device'][_0xc7cd('0x37')]&&_0xf32974[_0xc7cd('0xac')]['vendor']?util['format'](_0xc7cd('0xad'),_0xf32974[_0xc7cd('0xac')][_0xc7cd('0x37')],_0xf32974[_0xc7cd('0xac')][_0xc7cd('0xae')],_0xf32974[_0xc7cd('0xac')][_0xc7cd('0x35')]):null,'deviceVendor':_0xf32974[_0xc7cd('0xac')][_0xc7cd('0xae')],'deviceType':_0xf32974['device']['type'],'formData':JSON[_0xc7cd('0xaf')](_0x352936[_0xc7cd('0x4e')])};var _0x245cd0={'ChatWebsiteId':_0x352936['params']['id'],'closed':![]};if(_0x352936[_0xc7cd('0x4e')][_0xc7cd('0xb0')]){_0x245cd0[_0xc7cd('0xb0')]=_0x352936[_0xc7cd('0x4e')][_0xc7cd('0xb0')];return db[_0xc7cd('0xb1')][_0xc7cd('0x53')]({'where':_0x245cd0})[_0xc7cd('0x14')](function(_0x107921){if(_0x107921){return[_0x107921,![]];}_0x318dfb[_0xc7cd('0xb0')]=_0x352936[_0xc7cd('0x4e')][_0xc7cd('0xb0')];_0x318dfb[_0xc7cd('0xb2')]=_0x352936[_0xc7cd('0x4e')]['externalUrl'];return db[_0xc7cd('0xb1')][_0xc7cd('0x4d')](_0x318dfb)[_0xc7cd('0x14')](function(_0x1c2d2b){return[_0x1c2d2b,!![]];});});}_0x245cd0[_0xc7cd('0xb3')]=_0x49985f['id'];if(_0x352936[_0xc7cd('0x4e')][_0xc7cd('0xb4')]&&_0x352936[_0xc7cd('0x4e')][_0xc7cd('0xb4')]['id']){_0x245cd0['id']=_0x352936[_0xc7cd('0x4e')][_0xc7cd('0xb4')]['id'];return db['ChatInteraction'][_0xc7cd('0x53')]({'where':_0x245cd0})['then'](function(_0x4e6455){if(_0x4e6455){return[_0x4e6455,![]];}return db[_0xc7cd('0xb1')][_0xc7cd('0x4d')](_0x318dfb)[_0xc7cd('0x14')](function(_0x280029){return[_0x280029,!![]];});});}return db[_0xc7cd('0xb1')]['create'](_0x318dfb)['then'](function(_0x312b1d){return[_0x312b1d,!![]];});}})[_0xc7cd('0xb5')](function(_0x26bddb,_0x3203b2){if(_0x26bddb){_0x4bda52=_0x3203b2;if(!_0x3203b2){var _0x178b25={'from':(_0x599ef2['contact'][_0xc7cd('0xa3')]||'')+'\x20'+(_0x599ef2[_0xc7cd('0x9c')]['lastName']||'')};if(_0x352936[_0xc7cd('0x4e')][_0xc7cd('0xb0')]&&_0x352936['body']['messageId']&&_0x352936[_0xc7cd('0x4e')][_0xc7cd('0xb0')]!=_0x352936[_0xc7cd('0x4e')][_0xc7cd('0xb6')]){_0x178b25[_0xc7cd('0xb0')]=_0x352936[_0xc7cd('0x4e')][_0xc7cd('0xb6')];}return _0x26bddb['update'](_0x178b25);}else{return _0x26bddb;}}})[_0xc7cd('0x14')](function(_0x1d3798){_0x599ef2[_0xc7cd('0xb4')]=_0x1d3798['get']({'plain':!![]});_0x599ef2[_0xc7cd('0xb4')][_0xc7cd('0xb7')]=_0x4bda52;if(_0x599ef2[_0xc7cd('0xb4')][_0xc7cd('0xb7')]){if(_0x599ef2[_0xc7cd('0x95')][_0xc7cd('0xb8')]){_0x599ef2[_0xc7cd('0x96')]['push']({'id':0x0,'priority':_0x599ef2[_0xc7cd('0x96')][_0xc7cd('0x3d')]+0x1,'app':_0xc7cd('0xb9'),'appdata':_0xc7cd('0xba'),'interval':_0xc7cd('0xbb')});}}return db[_0xc7cd('0xbc')][_0xc7cd('0x4d')]({'body':_0x352936['body'][_0xc7cd('0x4e')],'ChatWebsiteId':_0x352936['params']['id'],'ChatInteractionId':_0x1d3798['id'],'direction':'in','ContactId':_0x599ef2[_0xc7cd('0x9c')]['id'],'AttachmentId':_0x352936['body']['AttachmentId']});})[_0xc7cd('0x14')](function(_0x3cffb8){_0x599ef2[_0xc7cd('0x1c')]=_0x3cffb8;if(!_0x599ef2[_0xc7cd('0xb4')]['UserId']){return;}return db[_0xc7cd('0xbd')]['find']({'attributes':['id',_0xc7cd('0x2e')],'where':{'id':_0x599ef2[_0xc7cd('0xb4')][_0xc7cd('0xbe')]}});})['then'](function(_0x596dbd){if(_0x596dbd){_0x599ef2['applications'][_0xc7cd('0xbf')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x596dbd[_0xc7cd('0x2e')]+','+(_0x599ef2[_0xc7cd('0x95')][_0xc7cd('0xc0')]||0xa),'interval':_0xc7cd('0xbb')});_0x599ef2['forcedOwnership']=!![];}if(!_0x599ef2[_0xc7cd('0xb4')][_0xc7cd('0xc1')]){return;}return db['ChatQueue'][_0xc7cd('0x53')]({'attributes':['id',_0xc7cd('0x2e')],'where':{'id':_0x599ef2['interaction']['queueId']}});})[_0xc7cd('0x14')](function(_0x2289bf){if(_0x2289bf){_0x599ef2[_0xc7cd('0x96')][_0xc7cd('0xbf')]({'id':0x0,'priority':0x1,'app':_0xc7cd('0xc2'),'appdata':_0x2289bf[_0xc7cd('0x2e')]+','+(_0x599ef2['account'][_0xc7cd('0xc3')]||0x12c),'interval':_0xc7cd('0xbb')});}return respondWithRpcPromise(_0xc7cd('0xc4'),_0xc7cd('0xc5'),_0x599ef2);})['then'](function(_0x6fb220){respondWithRpcPromise(_0xc7cd('0xc6'),_0xc7cd('0xc6'),{'event':'notify','message':_0x6fb220},client9002);return _0x6fb220;})[_0xc7cd('0x14')](respondWithResult(_0x5c7dbd,null))['catch'](handleError(_0x5c7dbd,null));};exports[_0xc7cd('0xc7')]=function(_0x40825d,_0x37c839){var _0x187ba9,_0x4a23c2,_0xc28439;var _0x356000=[];var _0x5ae638={};var _0x3ac326=_0x40825d[_0xc7cd('0xc8')]||[];var _0x324895=[];var _0x48f44c;return db[_0xc7cd('0x84')]['describe']()[_0xc7cd('0x14')](function(_0x3ca63a){if(!_0x3ca63a){throw new db['Sequelize']['ValidationError'](_0xc7cd('0x86'));}_0x356000=_[_0xc7cd('0x87')](_[_0xc7cd('0x4c')](_0x3ca63a),['createdAt',_0xc7cd('0x89'),_0xc7cd('0x8a'),_0xc7cd('0x9b')]);if(_0x40825d[_0xc7cd('0x4e')]['id']){delete _0x40825d[_0xc7cd('0x4e')]['id'];}if(_[_0xc7cd('0x74')](_0x40825d[_0xc7cd('0x4e')][_0xc7cd('0x90')])){throw _0x37c839[_0xc7cd('0x1f')](0x1f4)['send'](new db[(_0xc7cd('0x8b'))][(_0xc7cd('0x85'))]('from\x20is\x20mandatory'));}if(_[_0xc7cd('0x74')](_0x40825d['body'][_0xc7cd('0x4e')])||_0x40825d[_0xc7cd('0x4e')][_0xc7cd('0x4e')]===''){throw _0x37c839['status'](0x1f4)[_0xc7cd('0xc9')](new db[(_0xc7cd('0x8b'))]['ValidationError'](_0xc7cd('0x8d')));}if(_[_0xc7cd('0x74')](_0x40825d[_0xc7cd('0x4e')]['mapKeyOffline'])){throw _0x37c839[_0xc7cd('0x1f')](0x1f4)[_0xc7cd('0xc9')](new db[(_0xc7cd('0x8b'))][(_0xc7cd('0x85'))](_0xc7cd('0xca')+_0x356000));}if(!_[_0xc7cd('0xcb')](_0x356000,_0x40825d[_0xc7cd('0x4e')][_0xc7cd('0xcc')])){throw _0x37c839[_0xc7cd('0x1f')](0x1f4)[_0xc7cd('0xc9')](new db[(_0xc7cd('0x8b'))][(_0xc7cd('0x85'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x356000));}_0x5ae638[_0x40825d[_0xc7cd('0x4e')]['mapKeyOffline']]=_0x40825d[_0xc7cd('0x4e')][_0xc7cd('0x90')];})[_0xc7cd('0x14')](function(){return db[_0xc7cd('0x32')][_0xc7cd('0x53')]({'where':{'id':_0x40825d[_0xc7cd('0x4a')]['id']},'include':[{'model':db[_0xc7cd('0x91')],'as':_0xc7cd('0x92')},{'model':db['MailAccount'],'as':_0xc7cd('0xcd')}]});})[_0xc7cd('0x14')](handleEntityNotFound(_0x37c839,null))['then'](function(_0x50b18a){if(_0x50b18a&&_0x50b18a['List']){_0x4a23c2=_0x50b18a;var _0x40f00a=_[_0xc7cd('0xc')](_0x40825d[_0xc7cd('0x4e')],{'firstName':_0x40825d['body'][_0xc7cd('0x90')],'phone':_0x40825d['body'][_0xc7cd('0x90')],'ListId':_0x50b18a[_0xc7cd('0x9b')]});_0x40f00a[_0x40825d[_0xc7cd('0x4e')][_0xc7cd('0xcc')]]=_0x40825d[_0xc7cd('0x4e')]['from'];return db[_0xc7cd('0x84')][_0xc7cd('0xce')]({'where':_0x5ae638,'defaults':_0x40f00a});}})[_0xc7cd('0xb5')](function(_0x4ea4a2){if(_0x4ea4a2){_0xc28439=_0x4ea4a2;var _0x5f2f04=fs[_0xc7cd('0xcf')](path[_0xc7cd('0x6f')](config[_0xc7cd('0x70')],_0xc7cd('0xd0')),_0xc7cd('0xd1'));var _0x59e259=ejs[_0xc7cd('0xd2')](_0x5f2f04,{'body':_[_0xc7cd('0xd3')](_0x40825d['body'][_0xc7cd('0x4e')]),'bodyTitle':_0x4a23c2[_0xc7cd('0xd4')]});return db['ChatOfflineMessage'][_0xc7cd('0x4d')]({'body':_0x59e259,'plainBody':htmlToText['fromString'](_0x59e259),'ContactId':_0x4ea4a2['id'],'ChatWebsiteId':_0x4a23c2['id']});}})['then'](function(_0x39777d){_0x48f44c=_0x39777d;if(_0x3ac326[_0xc7cd('0x3d')]){var _0x26b61b=_0x3ac326[_0xc7cd('0x31')](function(_0x1f5d47){return{'name':_0x1f5d47['originalname'],'basename':_0x1f5d47[_0xc7cd('0x66')],'type':_0x1f5d47['mimetype'],'ChatOfflineMessageId':_0x39777d['id']};});_0x324895=_0x26b61b[_0xc7cd('0x31')](_0x576e1a=>{var _0x4e0189={'filename':_0x576e1a[_0xc7cd('0x2e')],'path':path['join'](config['root'],_0xc7cd('0xd5'),_0xc7cd('0xc8'),'attachments',_0xc7cd('0xd6'),_0x576e1a['basename'])};return _0x4e0189;});if(!_0x4a23c2[_0xc7cd('0xd7')]){return db[_0xc7cd('0xd8')][_0xc7cd('0xd9')](function(_0x10776d){return db[_0xc7cd('0xda')][_0xc7cd('0xdb')](_0x26b61b,{'transaction':_0x10776d});});}}})['then'](function(){if(_0x48f44c){_0x187ba9=_0x48f44c;return db[_0xc7cd('0xcd')][_0xc7cd('0x61')]({'where':{'service':!![]},'include':[{'model':db[_0xc7cd('0xdc')],'as':_0xc7cd('0xdd'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xc7cd('0xde'),'raw':!![]}]}]});}})['then'](function(_0x19faa2){if(_0x19faa2&&_0x19faa2[_0xc7cd('0xdd')]&&_0x4a23c2[_0xc7cd('0xdf')]&&_0x4a23c2[_0xc7cd('0xe0')]){var _0x51c037=_0x19faa2[_0xc7cd('0xe1')]();return respondWithRpcPromise(_0xc7cd('0xe2'),_0xc7cd('0xe3'),{'account':_0x51c037,'message':{'from':util[_0xc7cd('0xa9')](_0xc7cd('0xe4'),_0x19faa2[_0xc7cd('0x2e')],_0x19faa2[_0xc7cd('0xe5')]||_0x19faa2[_0xc7cd('0xdd')][_0xc7cd('0x4f')]),'to':_0x4a23c2[_0xc7cd('0xe0')],'subject':_0x4a23c2[_0xc7cd('0xe6')],'html':_0x187ba9[_0xc7cd('0x4e')],'attachments':_0x324895}},client9003)[_0xc7cd('0x14')](function(){return _0x187ba9;})['catch'](function(_0x1bcd91){logger[_0xc7cd('0x19')](_0x1bcd91);});}})[_0xc7cd('0x14')](function(){if(_0x4a23c2&&_0x4a23c2[_0xc7cd('0xd7')]&&_0x4a23c2[_0xc7cd('0xe7')]){var _0x2da504=[];if(_0x3ac326[_0xc7cd('0x3d')]){_0x2da504=_0x3ac326[_0xc7cd('0x31')](function(_0x4d3953){return{'name':_0x4d3953[_0xc7cd('0xe8')],'basename':_0x4d3953['filename'],'type':_0x4d3953['mimetype'],'ChatOfflineMessageId':_0x48f44c['id']};});}var _0x7de4ec;if(!_[_0xc7cd('0x74')](_0x4a23c2[_0xc7cd('0xe9')])){var _0x253e20=_[_0xc7cd('0x31')](_0x40825d['body'],function(_0xaafa11){return _0xaafa11;});var _0x4d0c52=_['toPairsIn'](_0x253e20)[0x0];var _0x412996=_['mapValues'](_0x4d0c52,function(_0x15ee11){return _0x15ee11;});_0x7de4ec=_0x412996[0x1][_0x4a23c2['subjectOffline']];}var _0x437196={'from':_0xc28439[_0xc7cd('0xe5')],'firstName':_0xc28439[_0xc7cd('0xa3')],'lastName':_0xc28439[_0xc7cd('0xa4')],'mapKey':_0xc7cd('0xe5'),'message':{'from':_0xc28439[_0xc7cd('0xe5')],'to':_0x4a23c2[_0xc7cd('0xcd')][_0xc7cd('0xe5')],'cc':'','subject':_[_0xc7cd('0x74')](_0x7de4ec)?_0x4a23c2[_0xc7cd('0xe6')]:_0x7de4ec,'messageId':'','sentAt':new Date(),'attach':_0x2da504[_0xc7cd('0x3d')],'attachments':_0x2da504,'originChannel':'Chat','ChatWebsiteId':_0x4a23c2['id'],'ChatOfflineMessageId':_0x187ba9['id'],'originTo':_0x4a23c2[_0xc7cd('0xcd')][_0xc7cd('0xe5')]},'body':_0x187ba9[_0xc7cd('0x4e')]};var _0x2f990b={'account':{'id':_0x4a23c2[_0xc7cd('0xe7')]},'body':_0x437196,'log':_0xc7cd('0xea')};return respondWithRpcPromise('NotifyMailAccount',_0xc7cd('0xeb'),_0x2f990b,client9001)[_0xc7cd('0x14')](function(){return _0x187ba9;})[_0xc7cd('0x1e')](function(_0x398b72){logger[_0xc7cd('0x19')](_0x398b72);});}return;})[_0xc7cd('0x14')](function(){if(_0x187ba9){return _0x187ba9;}})[_0xc7cd('0x14')](respondWithResult(_0x37c839,null))[_0xc7cd('0x1e')](function(_0x27c919){logger['error'](_0xc7cd('0x1e'),_0x27c919);for(var _0x193583 of _0x3ac326){var _0x554fe7=path['join'](config[_0xc7cd('0x70')],'server','files','attachments',_0xc7cd('0xd6'),_0x193583[_0xc7cd('0x66')]);fs_extra['remove'](_0x554fe7)[_0xc7cd('0x1e')](function(_0x23e963){logger[_0xc7cd('0x19')]('Could\x20not\x20remove\x20attachment\x20file',_0x554fe7,_0x23e963);});}});};exports['addInteraction']=function(_0xd97b77,_0x3e5f75){return db[_0xc7cd('0xb1')]['find']({'where':{'id':_0xd97b77[_0xc7cd('0x4a')]['id']}})[_0xc7cd('0x14')](handleEntityNotFound(_0x3e5f75,null))[_0xc7cd('0x14')](function(_0x5abdde){if(_0x5abdde){return _0x5abdde[_0xc7cd('0xec')](_0xd97b77['body'][_0xc7cd('0x64')],_[_0xc7cd('0xed')](_0xd97b77[_0xc7cd('0x4e')],[_0xc7cd('0x64'),'id'])||{});}})[_0xc7cd('0x14')](respondWithResult(_0x3e5f75,null))[_0xc7cd('0x1e')](handleError(_0x3e5f75,null));};exports[_0xc7cd('0xee')]=function(_0x3af710,_0x18d7e6){var _0x3f0607={'raw':![],'where':{}};var _0x13f1a2={};var _0x5602f6={'count':0x0,'rows':[]};return db[_0xc7cd('0x32')]['findOne']({'where':{'id':_0x3af710[_0xc7cd('0x4a')]['id']}})[_0xc7cd('0x14')](handleEntityNotFound(_0x18d7e6,null))[_0xc7cd('0x14')](function(_0x6e5988){if(_0x6e5988){_0x13f1a2[_0xc7cd('0x37')]=_[_0xc7cd('0x4c')](db[_0xc7cd('0xb1')]['rawAttributes']);_0x13f1a2['query']=_[_0xc7cd('0x4c')](_0x3af710[_0xc7cd('0x38')]);_0x13f1a2[_0xc7cd('0x39')]=_[_0xc7cd('0x3a')](_0x13f1a2[_0xc7cd('0x37')],_0x13f1a2[_0xc7cd('0x38')]);_0x3f0607[_0xc7cd('0x3b')]=_['intersection'](_0x13f1a2[_0xc7cd('0x37')],qs[_0xc7cd('0x3c')](_0x3af710[_0xc7cd('0x38')][_0xc7cd('0x3c')]));_0x3f0607['attributes']=_0x3f0607['attributes'][_0xc7cd('0x3d')]?_0x3f0607[_0xc7cd('0x3b')]:_0x13f1a2[_0xc7cd('0x37')];if(!_0x3af710['query'][_0xc7cd('0x5b')](_0xc7cd('0x5c'))){_0x3f0607[_0xc7cd('0x23')]=qs[_0xc7cd('0x23')](_0x3af710[_0xc7cd('0x38')]['limit']);_0x3f0607[_0xc7cd('0x21')]=qs['offset'](_0x3af710['query']['offset']);}_0x3f0607['order']=qs[_0xc7cd('0x3f')](_0x3af710['query'][_0xc7cd('0x3f')]);_0x3f0607[_0xc7cd('0x40')]=qs[_0xc7cd('0x39')](_['pick'](_0x3af710['query'],_0x13f1a2[_0xc7cd('0x39')]));_0x3f0607[_0xc7cd('0x40')]['ChatWebsiteId']=_0x6e5988['id'];if(_0x3af710[_0xc7cd('0x38')][_0xc7cd('0x41')]){_0x3f0607[_0xc7cd('0x40')]=_[_0xc7cd('0x42')](_0x3f0607[_0xc7cd('0x40')],{'$or':_[_0xc7cd('0x31')](_0x3f0607['attributes'],function(_0x360ea9){var _0xf669c={};_0xf669c[_0x360ea9]={'$like':'%'+_0x3af710['query'][_0xc7cd('0x41')]+'%'};return _0xf669c;})});}_0x3f0607=_[_0xc7cd('0x42')]({},_0x3f0607,_0x3af710[_0xc7cd('0x44')]);return db[_0xc7cd('0xb1')][_0xc7cd('0x24')]({'where':_0x3f0607[_0xc7cd('0x40')]})['then'](function(_0x5cd44d){_0x5602f6[_0xc7cd('0x24')]=_0x5cd44d;if(_0x3af710['query'][_0xc7cd('0x45')]){_0x3f0607[_0xc7cd('0x46')]=[{'model':db[_0xc7cd('0x84')],'as':'Contact','required':![]},{'model':db[_0xc7cd('0xbd')],'as':_0xc7cd('0xef'),'attributes':[_0xc7cd('0x2e'),_0xc7cd('0xf0'),'internal'],'required':![]},{'model':db['Tag'],'as':_0xc7cd('0xf1'),'attributes':['id','name','color'],'where':_0x3af710[_0xc7cd('0x38')][_0xc7cd('0xf2')]?{'id':_0x3af710[_0xc7cd('0x38')][_0xc7cd('0xf2')]}:undefined,'required':_0x3af710[_0xc7cd('0x38')][_0xc7cd('0xf2')]?!![]:![]}];}return db['ChatInteraction'][_0xc7cd('0x47')](_0x3f0607);})['then'](function(_0x50babe){_0x5602f6[_0xc7cd('0x48')]=_0x50babe;return _0x5602f6;});}})['then'](respondWithFilteredResult(_0x18d7e6,_0x3f0607))[_0xc7cd('0x1e')](handleError(_0x18d7e6,null));};function iftimePromise(_0x33255a,_0x530605){return respondWithRpcPromise(_0xc7cd('0xf3'),_0xc7cd('0xf4'),{'command':_0x530605['timezone']?util[_0xc7cd('0xa9')](_0xc7cd('0xf5'),_0x33255a['interval'],_0x530605['timezone']):util['format'](_0xc7cd('0xf6'),_0x33255a[_0xc7cd('0xf7')])},client9002)[_0xc7cd('0x14')](function(_0x8dbce2){var _0x3a0a1a=_0x8dbce2&&_0x8dbce2[_0xc7cd('0xf8')]('true')>=0x0?!![]:![];logger['info'](_0xc7cd('0xf9'),_0x530605['id'],_0x33255a['id'],_0x33255a['interval'],_0x3a0a1a?_0xc7cd('0xfa'):_0xc7cd('0xfb'),_0x530605[_0xc7cd('0xfc')]?_0x530605[_0xc7cd('0xfc')]:_0xc7cd('0xfd'));return _0x3a0a1a;})['catch'](function(_0x14daf6){logger[_0xc7cd('0x19')](_0xc7cd('0xf9'),_0x530605['id'],_0x33255a['id'],_0x33255a[_0xc7cd('0xf7')],util['inspect'](_0x14daf6,{'showHidden':![],'depth':null}),_0x530605[_0xc7cd('0xfc')]?_0x530605[_0xc7cd('0xfc')]:'No\x20timezone');return![];});}exports[_0xc7cd('0xf4')]=function(_0x204d53,_0x5681fc){var _0x54eed6=0x0;var _0x12e42f=0x0;var _0x25be8e=![];var _0x298726;var _0x12bdbf;return db[_0xc7cd('0x32')][_0xc7cd('0x53')]({'where':{'id':_0x204d53[_0xc7cd('0x4a')]['id']},'include':[{'model':db[_0xc7cd('0xfe')],'as':_0xc7cd('0xfe'),'include':[{'model':db[_0xc7cd('0xfe')],'as':_0xc7cd('0xff'),'attributes':['id','interval'],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x5681fc,null))[_0xc7cd('0x14')](function(_0x1c2102){if(_0x1c2102){_0x298726=_0x1c2102;return _0x1c2102[_0xc7cd('0x100')]({'raw':!![]});}})['then'](function(_0x1bb8e8){if(_0x298726){if(_0x1bb8e8){_0x12bdbf=_0x1bb8e8;}}return require('../../config/license/util')[_0xc7cd('0x72')]();})[_0xc7cd('0x14')](function(_0xb7236f){if(_0xb7236f){_0x12e42f=_0xb7236f['virtual'];_0x25be8e=_0xb7236f[_0xc7cd('0x73')];}})[_0xc7cd('0x14')](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})[_0xc7cd('0x14')](function(_0x22c3b4){_0x54eed6=_0x22c3b4;if(_0x12e42f&&_0x22c3b4>_0x12e42f){return db[_0xc7cd('0x101')][_0xc7cd('0x61')]({'where':{'id':0x1}})['then'](function(_0x103270){if(_0x103270){_0x103270[_0xc7cd('0x102')](_0xc7cd('0x103'));}});}})[_0xc7cd('0x14')](function(){if(_0x298726[_0xc7cd('0xfe')]&&_0x298726[_0xc7cd('0xfe')][_0xc7cd('0xff')]){var _0x390f75=[];for(var _0x10a787=0x0;_0x10a787<_0x298726[_0xc7cd('0xfe')]['Intervals'][_0xc7cd('0x3d')];_0x10a787++){var _0x14d875=_0x298726[_0xc7cd('0xfe')][_0xc7cd('0xff')][_0x10a787][_0xc7cd('0x29')]({'plain':!![]});_0x390f75['push'](iftimePromise(_0x14d875,_0x298726));}return BPromise[_0xc7cd('0x104')](_0x390f75)[_0xc7cd('0x14')](function(_0x3921da){return _['some'](_0x3921da);});}else{return!![];}})[_0xc7cd('0x14')](function(_0x2d01a0){var _0x41207a=fs[_0xc7cd('0xcf')](path[_0xc7cd('0x6f')](config[_0xc7cd('0x70')],_0xc7cd('0x105')),_0xc7cd('0xd1'));var _0x1742a3=new url[(_0xc7cd('0x106'))](_0x298726[_0xc7cd('0x107')])['origin'];var _0x4bddce=_0xc7cd('0x108');var _0x39b319=![];var _0x259fe6={'chatVersion':_0x4bddce,'chatWebsiteAddressOrigin':_0x1742a3,'remote':_0x298726[_0xc7cd('0x109')],'query':querystring[_0xc7cd('0xaf')](_[_0xc7cd('0x42')](_0x298726[_0xc7cd('0x29')]({'plain':!![]}),{'customerIp':_0x204d53[_0xc7cd('0x9e')][_0xc7cd('0xa0')]||_0x204d53[_0xc7cd('0x9e')][_0xc7cd('0x10a')]||_0x204d53[_0xc7cd('0x10b')][_0xc7cd('0x10c')]||_0x204d53['ip'],'referer':_0x204d53[_0xc7cd('0x9e')][_0xc7cd('0xa6')],'openedInteractions':_0x54eed6,'maxInteractions':_0x12e42f,'virtual':_0x25be8e[_0xc7cd('0x10d')],'online':_0x2d01a0,'custom':_0x25be8e}))[_0xc7cd('0x10e')](/'/g,'\x5c\x27')};_0x5681fc['send'](ejs[_0xc7cd('0xd2')](Mustache[_0xc7cd('0xd2')](_0x41207a,_0x259fe6),{'proactiveActions':_0x12bdbf,'alignment':_0x298726['alignment'],'verticalAlignment':_0x298726['verticalAlignment'],'div_color':_0x298726[_0xc7cd('0x10f')],'labelText':_0x298726[_0xc7cd('0x110')],'text_color':_0x298726[_0xc7cd('0x111')],'text_button_color':_0x298726[_0xc7cd('0x112')],'button_color':_0x298726['color_button'],'background_color':_0x298726[_0xc7cd('0x113')],'hideWhenOffline':_0x298726[_0xc7cd('0x114')],'intervalId':_0x298726[_0xc7cd('0x115')],'isDevelopment':_0x39b319,'chatVersion':_0x4bddce}));})['catch'](handleError(_0x5681fc,null));};exports[_0xc7cd('0x116')]=function(_0x4d9cab,_0x21ffb3){var _0x507a77=_0x4d9cab[_0xc7cd('0x4a')]['id'];var _0x57d70c=_0x4d9cab['body'];var _0xabd741=0xc8;var _0x49ea1e=null;return db[_0xc7cd('0xd8')][_0xc7cd('0xd9')]({'isolationLevel':db['sequelize'][_0xc7cd('0x117')][_0xc7cd('0x118')][_0xc7cd('0x119')]},function(_0x2e7391){return db['ChatWebsite'][_0xc7cd('0x61')]({'where':{'id':_0x507a77},'transaction':_0x2e7391})[_0xc7cd('0x14')](function(_0x5966ed){if(_0x5966ed){return db['ChatApplication'][_0xc7cd('0x28')]({'where':{'ChatWebsiteId':_0x507a77},'transaction':_0x2e7391})[_0xc7cd('0x14')](function(){var _0x18ce0d=_[_0xc7cd('0x31')](_0x57d70c,function(_0x325c3d){_0x325c3d[_0xc7cd('0x58')]=_0x507a77;return _0x325c3d;});return db['ChatApplication'][_0xc7cd('0xdb')](_0x18ce0d,{'transaction':_0x2e7391});});}else{_0xabd741=0x194;_0x49ea1e=[];}});})['then'](function(){if(_0xabd741!==0x194){return db['ChatApplication'][_0xc7cd('0x11a')]({'where':{'ChatWebsiteId':_0x507a77},'order':_0xc7cd('0x98')})['then'](function(_0x1a2b8b){_0x49ea1e=_0x1a2b8b;});}})[_0xc7cd('0x1e')](function(_0x218acf){_0xabd741=0x1f4;logger[_0xc7cd('0x19')](_0x218acf['stack']);if(_0x218acf['name']){delete _0x218acf[_0xc7cd('0x2e')];}_0x49ea1e=_0x218acf;})['finally'](function(){if(_0x49ea1e===null){_0x21ffb3[_0xc7cd('0x2c')](_0xabd741);}else{if(_0xabd741===0x1f4){_0x21ffb3['status'](_0xabd741)[_0xc7cd('0xc9')](_0x49ea1e);}else{_0x21ffb3['status'](_0xabd741)[_0xc7cd('0x20')](_0x49ea1e);}}});};exports[_0xc7cd('0x11b')]=function(_0x5a7603,_0x29f02e){var _0x619053={};var _0x3a8972={};var _0x41805;var _0x33a973;return db[_0xc7cd('0x32')][_0xc7cd('0x61')]({'where':{'id':_0x5a7603[_0xc7cd('0x4a')]['id']}})[_0xc7cd('0x14')](handleEntityNotFound(_0x29f02e,null))[_0xc7cd('0x14')](function(_0x5f002d){if(_0x5f002d){_0x41805=_0x5f002d;_0x3a8972['model']=_[_0xc7cd('0x4c')](db['ChatApplication']['rawAttributes']);_0x3a8972['query']=_['keys'](_0x5a7603[_0xc7cd('0x38')]);_0x3a8972[_0xc7cd('0x39')]=_[_0xc7cd('0x3a')](_0x3a8972['model'],_0x3a8972[_0xc7cd('0x38')]);_0x619053[_0xc7cd('0x3b')]=_[_0xc7cd('0x3a')](_0x3a8972[_0xc7cd('0x37')],qs[_0xc7cd('0x3c')](_0x5a7603[_0xc7cd('0x38')]['fields']));_0x619053[_0xc7cd('0x3b')]=_0x619053[_0xc7cd('0x3b')][_0xc7cd('0x3d')]?_0x619053[_0xc7cd('0x3b')]:_0x3a8972['model'];_0x619053[_0xc7cd('0x3e')]=qs[_0xc7cd('0x3f')](_0x5a7603[_0xc7cd('0x38')][_0xc7cd('0x3f')]);_0x619053[_0xc7cd('0x40')]=qs[_0xc7cd('0x39')](_[_0xc7cd('0x5d')](_0x5a7603[_0xc7cd('0x38')],_0x3a8972[_0xc7cd('0x39')]));if(_0x5a7603[_0xc7cd('0x38')][_0xc7cd('0x41')]){_0x619053['where']=_[_0xc7cd('0x42')](_0x619053[_0xc7cd('0x40')],{'$or':_[_0xc7cd('0x31')](_0x619053['attributes'],function(_0x3da9f5){var _0x2e596b={};_0x2e596b[_0x3da9f5]={'$like':'%'+_0x5a7603[_0xc7cd('0x38')][_0xc7cd('0x41')]+'%'};return _0x2e596b;})});}_0x619053=_[_0xc7cd('0x42')]({},_0x619053,_0x5a7603[_0xc7cd('0x44')]);return _0x41805['getApplications'](_0x619053);}})[_0xc7cd('0x14')](function(_0x463603){if(_0x463603){_0x33a973=_0x463603['length'];if(!_0x5a7603[_0xc7cd('0x38')]['hasOwnProperty'](_0xc7cd('0x5c'))){_0x619053[_0xc7cd('0x23')]=qs['limit'](_0x5a7603[_0xc7cd('0x38')]['limit']);_0x619053[_0xc7cd('0x21')]=qs[_0xc7cd('0x21')](_0x5a7603[_0xc7cd('0x38')][_0xc7cd('0x21')]);}return _0x41805['getApplications'](_0x619053);}})['then'](function(_0x4019a7){if(_0x4019a7){return _0x4019a7?{'count':_0x33a973,'rows':_0x4019a7}:null;}})[_0xc7cd('0x14')](respondWithResult(_0x29f02e,null))['catch'](handleError(_0x29f02e,null));};exports['addProactiveActions']=function(_0x300d69,_0x53b351){return db[_0xc7cd('0x11c')][_0xc7cd('0x53')]({'where':{'id':_0x300d69[_0xc7cd('0x4a')]['id']}})[_0xc7cd('0x14')](handleEntityNotFound(_0x53b351,null))[_0xc7cd('0x14')](function(_0x13d7d1){if(_0x13d7d1){return _0x13d7d1['addProactiveActions'](_0x300d69[_0xc7cd('0x4e')][_0xc7cd('0x64')],_[_0xc7cd('0xed')](_0x300d69['body'],['ids','id'])||{});}})[_0xc7cd('0x14')](respondWithResult(_0x53b351,null))[_0xc7cd('0x1e')](handleError(_0x53b351,null));};exports[_0xc7cd('0x100')]=function(_0x281a4b,_0x3dd9d8){var _0x395616={};var _0x18d088={};var _0x4f4cfb;var _0x41e4a3;return db[_0xc7cd('0x32')][_0xc7cd('0x61')]({'where':{'id':_0x281a4b['params']['id']}})[_0xc7cd('0x14')](handleEntityNotFound(_0x3dd9d8,null))[_0xc7cd('0x14')](function(_0x3856a8){if(_0x3856a8){_0x4f4cfb=_0x3856a8;_0x18d088['model']=_['keys'](db['ChatProactiveAction'][_0xc7cd('0x33')]);_0x18d088[_0xc7cd('0x38')]=_['keys'](_0x281a4b['query']);_0x18d088[_0xc7cd('0x39')]=_[_0xc7cd('0x3a')](_0x18d088['model'],_0x18d088[_0xc7cd('0x38')]);_0x395616['attributes']=_['intersection'](_0x18d088[_0xc7cd('0x37')],qs['fields'](_0x281a4b[_0xc7cd('0x38')][_0xc7cd('0x3c')]));_0x395616[_0xc7cd('0x3b')]=_0x395616[_0xc7cd('0x3b')][_0xc7cd('0x3d')]?_0x395616[_0xc7cd('0x3b')]:_0x18d088[_0xc7cd('0x37')];_0x395616['order']=qs[_0xc7cd('0x3f')](_0x281a4b[_0xc7cd('0x38')]['sort']);_0x395616[_0xc7cd('0x40')]=qs[_0xc7cd('0x39')](_[_0xc7cd('0x5d')](_0x281a4b[_0xc7cd('0x38')],_0x18d088[_0xc7cd('0x39')]));if(_0x281a4b['query'][_0xc7cd('0x41')]){_0x395616[_0xc7cd('0x40')]=_[_0xc7cd('0x42')](_0x395616[_0xc7cd('0x40')],{'$or':_['map'](_0x395616[_0xc7cd('0x3b')],function(_0x3005c3){var _0x1468b2={};_0x1468b2[_0x3005c3]={'$like':'%'+_0x281a4b[_0xc7cd('0x38')]['filter']+'%'};return _0x1468b2;})});}_0x395616=_[_0xc7cd('0x42')]({},_0x395616,_0x281a4b['options']);return _0x4f4cfb[_0xc7cd('0x100')](_0x395616);}})[_0xc7cd('0x14')](function(_0x53b2c6){if(_0x53b2c6){_0x41e4a3=_0x53b2c6[_0xc7cd('0x3d')];if(!_0x281a4b['query'][_0xc7cd('0x5b')](_0xc7cd('0x5c'))){_0x395616[_0xc7cd('0x23')]=qs[_0xc7cd('0x23')](_0x281a4b['query']['limit']);_0x395616[_0xc7cd('0x21')]=qs[_0xc7cd('0x21')](_0x281a4b[_0xc7cd('0x38')][_0xc7cd('0x21')]);}return _0x4f4cfb[_0xc7cd('0x100')](_0x395616);}})['then'](function(_0x29a0ae){if(_0x29a0ae){return _0x29a0ae?{'count':_0x41e4a3,'rows':_0x29a0ae}:null;}})[_0xc7cd('0x14')](respondWithResult(_0x3dd9d8,null))[_0xc7cd('0x1e')](handleError(_0x3dd9d8,null));};exports[_0xc7cd('0x11d')]=function(_0x1de026,_0x567ad3){var _0x2eeaf2=_0x1de026['query'][_0xc7cd('0x11e')]===_0xc7cd('0x11f')?_0xc7cd('0x120'):'onlineForm';return db[_0xc7cd('0x32')]['find']({'attributes':['id',_0x2eeaf2],'where':{'id':_0x1de026[_0xc7cd('0x4a')]['id']}})[_0xc7cd('0x14')](handleEntityNotFound(_0x567ad3,null))[_0xc7cd('0x14')](function(_0x319495){if(_0x319495){var _0x172c64=_0x319495[_0x2eeaf2];var _0x2e2c10=_0x172c64&&_0x172c64[_0xc7cd('0x121')]?_0x172c64[_0xc7cd('0x121')]:[];_0x567ad3['send']({'fromKey':_['isNil'](_0x172c64[_0xc7cd('0x122')])?undefined:_0x172c64['fromKey'],'count':_0x2e2c10[_0xc7cd('0x3d')],'rows':_0x2e2c10});}})[_0xc7cd('0x1e')](handleError(_0x567ad3,null));};exports[_0xc7cd('0x123')]=function(_0x3fa41a,_0x26494a){var _0x337a5c={'raw':![],'where':{}};var _0x2a679d={};var _0x448ae2={'count':0x0,'rows':[]};return db[_0xc7cd('0x32')]['findOne']({'where':{'id':_0x3fa41a[_0xc7cd('0x4a')]['id']}})[_0xc7cd('0x14')](handleEntityNotFound(_0x26494a,null))[_0xc7cd('0x14')](function(_0x2a224e){if(_0x2a224e){_0x2a679d[_0xc7cd('0x37')]=_['keys'](db['ChatOfflineMessage'][_0xc7cd('0x33')]);_0x2a679d[_0xc7cd('0x38')]=_[_0xc7cd('0x4c')](_0x3fa41a[_0xc7cd('0x38')]);_0x2a679d[_0xc7cd('0x39')]=_[_0xc7cd('0x3a')](_0x2a679d[_0xc7cd('0x37')],_0x2a679d[_0xc7cd('0x38')]);_0x337a5c[_0xc7cd('0x3b')]=_[_0xc7cd('0x3a')](_0x2a679d[_0xc7cd('0x37')],qs[_0xc7cd('0x3c')](_0x3fa41a[_0xc7cd('0x38')][_0xc7cd('0x3c')]));_0x337a5c[_0xc7cd('0x3b')]=_0x337a5c['attributes'][_0xc7cd('0x3d')]?_0x337a5c[_0xc7cd('0x3b')]:_0x2a679d[_0xc7cd('0x37')];if(!_0x3fa41a['query'][_0xc7cd('0x5b')]('nolimit')){_0x337a5c['limit']=qs[_0xc7cd('0x23')](_0x3fa41a['query'][_0xc7cd('0x23')]);_0x337a5c[_0xc7cd('0x21')]=qs[_0xc7cd('0x21')](_0x3fa41a[_0xc7cd('0x38')][_0xc7cd('0x21')]);}_0x337a5c[_0xc7cd('0x3e')]=qs['sort'](_0x3fa41a[_0xc7cd('0x38')][_0xc7cd('0x3f')]);_0x337a5c['where']=qs['filters'](_['pick'](_0x3fa41a[_0xc7cd('0x38')],_0x2a679d[_0xc7cd('0x39')]));_0x337a5c[_0xc7cd('0x40')][_0xc7cd('0x58')]=_0x2a224e['id'];if(_0x3fa41a[_0xc7cd('0x38')][_0xc7cd('0x41')]){_0x337a5c[_0xc7cd('0x40')]=_[_0xc7cd('0x42')](_0x337a5c[_0xc7cd('0x40')],{'$or':_[_0xc7cd('0x31')](_0x337a5c[_0xc7cd('0x3b')],function(_0x3d3175){var _0x2e3492={};_0x2e3492[_0x3d3175]={'$like':'%'+_0x3fa41a[_0xc7cd('0x38')][_0xc7cd('0x41')]+'%'};return _0x2e3492;})});}_0x337a5c=_[_0xc7cd('0x42')]({},_0x337a5c,_0x3fa41a[_0xc7cd('0x44')]);return db[_0xc7cd('0x124')]['count']({'where':_0x337a5c[_0xc7cd('0x40')]})[_0xc7cd('0x14')](function(_0x5044fc){_0x448ae2[_0xc7cd('0x24')]=_0x5044fc;if(_0x3fa41a[_0xc7cd('0x38')][_0xc7cd('0x45')]){_0x337a5c[_0xc7cd('0x46')]=[{'all':!![]}];}else{_0x337a5c[_0xc7cd('0x46')]=[{'model':db[_0xc7cd('0x84')],'as':'Contact','required':![]},{'model':db[_0xc7cd('0xda')],'as':'Attachments','required':![]}];}return db[_0xc7cd('0x124')]['findAll'](_0x337a5c);})[_0xc7cd('0x14')](function(_0x5a109a){_0x448ae2[_0xc7cd('0x48')]=_0x5a109a;return _0x448ae2;});}})[_0xc7cd('0x14')](respondWithFilteredResult(_0x26494a,_0x337a5c))[_0xc7cd('0x1e')](handleError(_0x26494a,null));};exports[_0xc7cd('0x125')]=function(_0x1f6c5c,_0x382010){return db[_0xc7cd('0x32')][_0xc7cd('0x53')]({'where':{'id':_0x1f6c5c[_0xc7cd('0x4a')]['id']}})['then'](handleEntityNotFound(_0x382010,null))[_0xc7cd('0x14')](function(_0x122925){if(_0x122925){return _0x122925[_0xc7cd('0x125')](_0x1f6c5c[_0xc7cd('0x4e')][_0xc7cd('0x64')],_[_0xc7cd('0xed')](_0x1f6c5c[_0xc7cd('0x4e')],[_0xc7cd('0x64'),'id'])||{})[_0xc7cd('0xb5')](function(_0x58ae35){for(var _0x1a711c=0x0;_0x1a711c<_0x1f6c5c[_0xc7cd('0x4e')][_0xc7cd('0x64')][_0xc7cd('0x3d')];_0x1a711c+=0x1){socket[_0xc7cd('0x126')]('userChatWebsite:save',{'UserId':Number(_0x1f6c5c[_0xc7cd('0x4e')][_0xc7cd('0x64')][_0x1a711c]),'ChatWebsiteId':Number(_0x1f6c5c['params']['id'])});}return _0x58ae35;});}})[_0xc7cd('0x14')](respondWithResult(_0x382010,null))['catch'](handleError(_0x382010,null));};exports[_0xc7cd('0x127')]=function(_0x3d816b,_0x441030){return db[_0xc7cd('0x32')][_0xc7cd('0x53')]({'where':{'id':_0x3d816b[_0xc7cd('0x4a')]['id']}})[_0xc7cd('0x14')](handleEntityNotFound(_0x441030,null))[_0xc7cd('0x14')](function(_0x2966d7){if(_0x2966d7){return _0x2966d7['removeAgents'](_0x3d816b[_0xc7cd('0x38')][_0xc7cd('0x64')])[_0xc7cd('0x14')](function(){if(_[_0xc7cd('0x128')](_0x3d816b[_0xc7cd('0x38')][_0xc7cd('0x64')])){for(var _0x5d4b47=0x0;_0x5d4b47<_0x3d816b[_0xc7cd('0x38')][_0xc7cd('0x64')][_0xc7cd('0x3d')];_0x5d4b47+=0x1){socket[_0xc7cd('0x126')](_0xc7cd('0x129'),{'UserId':Number(_0x3d816b[_0xc7cd('0x38')][_0xc7cd('0x64')][_0x5d4b47]),'ChatWebsiteId':Number(_0x3d816b[_0xc7cd('0x4a')]['id'])});}}else{socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x3d816b['query'][_0xc7cd('0x64')]),'ChatWebsiteId':Number(_0x3d816b[_0xc7cd('0x4a')]['id'])});}});}})[_0xc7cd('0x14')](respondWithStatusCode(_0x441030,null))[_0xc7cd('0x1e')](handleError(_0x441030,null));};exports[_0xc7cd('0x12a')]=function(_0x2a87ec,_0x1825d7){var _0x6d0f88={};var _0x1a0f94={};var _0x27f3b5;var _0x4e1c8a;return db[_0xc7cd('0x32')]['findOne']({'where':{'id':_0x2a87ec[_0xc7cd('0x4a')]['id']}})[_0xc7cd('0x14')](handleEntityNotFound(_0x1825d7,null))[_0xc7cd('0x14')](function(_0x542d13){if(_0x542d13){_0x27f3b5=_0x542d13;_0x1a0f94[_0xc7cd('0x37')]=_[_0xc7cd('0x4c')](db[_0xc7cd('0xbd')][_0xc7cd('0x33')]);_0x1a0f94[_0xc7cd('0x38')]=_[_0xc7cd('0x4c')](_0x2a87ec[_0xc7cd('0x38')]);_0x1a0f94[_0xc7cd('0x39')]=_[_0xc7cd('0x3a')](_0x1a0f94['model'],_0x1a0f94[_0xc7cd('0x38')]);_0x6d0f88[_0xc7cd('0x3b')]=_['intersection'](_0x1a0f94[_0xc7cd('0x37')],qs['fields'](_0x2a87ec['query']['fields']));_0x6d0f88[_0xc7cd('0x3b')]=_0x6d0f88[_0xc7cd('0x3b')][_0xc7cd('0x3d')]?_0x6d0f88['attributes']:_0x1a0f94['model'];_0x6d0f88[_0xc7cd('0x3e')]=qs[_0xc7cd('0x3f')](_0x2a87ec['query'][_0xc7cd('0x3f')]);_0x6d0f88[_0xc7cd('0x40')]=qs[_0xc7cd('0x39')](_['pick'](_0x2a87ec[_0xc7cd('0x38')],_0x1a0f94[_0xc7cd('0x39')]));if(_0x2a87ec[_0xc7cd('0x38')][_0xc7cd('0x41')]){_0x6d0f88[_0xc7cd('0x40')]=_[_0xc7cd('0x42')](_0x6d0f88[_0xc7cd('0x40')],{'$or':_[_0xc7cd('0x31')](_0x6d0f88[_0xc7cd('0x3b')],function(_0x4ff056){var _0x3bf3ae={};_0x3bf3ae[_0x4ff056]={'$like':'%'+_0x2a87ec[_0xc7cd('0x38')][_0xc7cd('0x41')]+'%'};return _0x3bf3ae;})});}_0x6d0f88=_[_0xc7cd('0x42')]({},_0x6d0f88,_0x2a87ec[_0xc7cd('0x44')]);return _0x27f3b5[_0xc7cd('0x12a')](_0x6d0f88);}})[_0xc7cd('0x14')](function(_0x176744){if(_0x176744){_0x4e1c8a=_0x176744[_0xc7cd('0x3d')];if(!_0x2a87ec[_0xc7cd('0x38')]['hasOwnProperty'](_0xc7cd('0x5c'))){_0x6d0f88[_0xc7cd('0x23')]=qs[_0xc7cd('0x23')](_0x2a87ec[_0xc7cd('0x38')]['limit']);_0x6d0f88[_0xc7cd('0x21')]=qs[_0xc7cd('0x21')](_0x2a87ec[_0xc7cd('0x38')][_0xc7cd('0x21')]);}return _0x27f3b5[_0xc7cd('0x12a')](_0x6d0f88);}})[_0xc7cd('0x14')](function(_0x5f5102){if(_0x5f5102){return _0x5f5102?{'count':_0x4e1c8a,'rows':_0x5f5102}:null;}})[_0xc7cd('0x14')](respondWithResult(_0x1825d7,null))[_0xc7cd('0x1e')](handleError(_0x1825d7,null));}; \ No newline at end of file +var _0x02ce=['autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','waitForTheAssignedAgent','unshift','queue','waitForTheAssignedQueue','startRouting','EventManager','offline','no\x20available\x20attributes','createdAt','send','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','MailAccount','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','server','files','attachments','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','MailAccountId','mimetype','subjectOffline','mapValues','firstName','offlineMessageSubject','NotifyMailAccount','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Contact','User','fullname','internal','Tag','Tags','color','tag','Command','timezone','iftime\x20%s,%s','interval','iftime\x20%s','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','inspect','No\x20timezone','getSnippet','Interval','Intervals','getProactiveActions','virtual','increment','chatLicenseExceeded','all','some','server/files/chat/iframe.ejs','address','origin','3.1.0','remote','x-real-ip','connection','remoteAddress','replace','alignment','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','addApplications','Transaction','ISOLATION_LEVELS','findAndCountAll','getApplications','addProactiveActions','getFields','online','false','onlineForm','items','fromKey','Attachments','addAgents','emit','removeAgents','userChatWebsite:remove','getAgents','bluebird','mustache','util','ejs','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','url','../../mysqldb','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','html-to-text','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','message','ChatWebsite,\x20%s,\x20%s','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','get','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','ChatWebsite','fieldName','key','keys','query','filters','intersection','model','fields','attributes','order','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','create','user','role','ChatWebsites','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','Disposition','getDispositions','length','hasOwnProperty','sort','removeDispositions','ids','ChatWebsiteId','CannedAnswer','findOne','nolimit','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','join','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','existsSync','root','server/files/images/logos/','getAvatar','server/files/images/avatars/','download','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','systemAvatar','user-agent-parser','setUA','headers','user-agent','getResult','CmContact','ValidationError','updatedAt','difference','CompanyId','ListId','from','Sequelize','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','List','Contacts','DESC','ChatApplication','Applications','applications','list','orderBy','priority','asc','account','defaults','contact','cf-connecting-ip','x-forwarded-for','first','split','lastName','referer','browser','version','format','%s\x20%s','unknown','device','%s\x20%s\x20%s','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','messageId','update','created'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x02ce,0x1ac));var _0xe02c=function(_0x5b2189,_0x383533){_0x5b2189=_0x5b2189-0x0;var _0x45512b=_0x02ce[_0x5b2189];return _0x45512b;};'use strict';var BPromise=require(_0xe02c('0x0'));var Mustache=require(_0xe02c('0x1'));var util=require(_0xe02c('0x2'));var path=require('path');var ejs=require(_0xe02c('0x3'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe02c('0x4'));var querystring=require(_0xe02c('0x5'));var Redis=require(_0xe02c('0x6'));var qs=require(_0xe02c('0x7'));var logger=require(_0xe02c('0x8'))(_0xe02c('0x9'));var config=require(_0xe02c('0xa'));var url=require(_0xe02c('0xb'));var db=require(_0xe02c('0xc'))['db'];config['redis']=_['defaults'](config[_0xe02c('0xd')],{'host':_0xe02c('0xe'),'port':0x18eb});var socket=require(_0xe02c('0xf'))(new Redis(config[_0xe02c('0xd')]));require(_0xe02c('0x10'))[_0xe02c('0x11')](socket);var htmlToText=require(_0xe02c('0x12'));var jayson=require(_0xe02c('0x13'));var client=jayson[_0xe02c('0x14')][_0xe02c('0x15')]({'port':0x232c});var client9002=jayson[_0xe02c('0x14')][_0xe02c('0x15')]({'port':0x232a});var client9003=jayson[_0xe02c('0x14')][_0xe02c('0x15')]({'port':0x232b});var client9001=jayson[_0xe02c('0x14')][_0xe02c('0x15')]({'port':0x2329});function respondWithRpcPromise(_0x23d886,_0x32fc45,_0x5d6d13,_0x43079c){return new BPromise(function(_0x525538,_0x5165f6){var _0x3f4e28=_0x43079c||client;return _0x3f4e28['request'](_0x23d886,_0x5d6d13)[_0xe02c('0x16')](function(_0x59614c){logger[_0xe02c('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x32fc45,_0xe02c('0x18'));logger[_0xe02c('0x19')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x32fc45,_0xe02c('0x18'),JSON[_0xe02c('0x1a')](_0x59614c));if(_0x59614c['error']){if(_0x59614c[_0xe02c('0x1b')][_0xe02c('0x1c')]===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x32fc45,_0x59614c[_0xe02c('0x1b')]['message']);return _0x5165f6(_0x59614c[_0xe02c('0x1b')][_0xe02c('0x1d')]);}logger[_0xe02c('0x1b')](_0xe02c('0x1e'),_0x32fc45,_0x59614c[_0xe02c('0x1b')]['message']);return _0x525538(_0x59614c[_0xe02c('0x1b')]['message']);}else{logger['info'](_0xe02c('0x1e'),_0x32fc45,_0xe02c('0x18'));_0x525538(_0x59614c['result'][_0xe02c('0x1d')]);}})[_0xe02c('0x1f')](function(_0x4ce5ee){logger[_0xe02c('0x1b')](_0xe02c('0x1e'),_0x32fc45,_0x4ce5ee);_0x5165f6(_0x4ce5ee);});});}function respondWithStatusCode(_0x39b00c,_0x359625){_0x359625=_0x359625||0xcc;return function(_0x2d44c8){if(_0x2d44c8){return _0x39b00c[_0xe02c('0x20')](_0x359625);}return _0x39b00c[_0xe02c('0x21')](_0x359625)[_0xe02c('0x22')]();};}function respondWithResult(_0xeae877,_0x18b538){_0x18b538=_0x18b538||0xc8;return function(_0x60b65e){if(_0x60b65e){return _0xeae877['status'](_0x18b538)[_0xe02c('0x23')](_0x60b65e);}};}function respondWithFilteredResult(_0x4411d8,_0x3592ca){return function(_0x14ffba){if(_0x14ffba){var _0x16dfa3=typeof _0x3592ca[_0xe02c('0x24')]===_0xe02c('0x25')&&typeof _0x3592ca[_0xe02c('0x26')]==='undefined';var _0x55e475=_0x14ffba[_0xe02c('0x27')];var _0x148e2b=_0x16dfa3?0x0:_0x3592ca['offset'];var _0x18b572=_0x16dfa3?_0x14ffba[_0xe02c('0x27')]:_0x3592ca[_0xe02c('0x24')]+_0x3592ca[_0xe02c('0x26')];var _0x1e7eab;if(_0x18b572>=_0x55e475){_0x18b572=_0x55e475;_0x1e7eab=0xc8;}else{_0x1e7eab=0xce;}_0x4411d8[_0xe02c('0x21')](_0x1e7eab);return _0x4411d8[_0xe02c('0x28')](_0xe02c('0x29'),_0x148e2b+'-'+_0x18b572+'/'+_0x55e475)[_0xe02c('0x23')](_0x14ffba);}return null;};}function saveUpdates(_0x288004){return function(_0x17d5b3){if(_0x17d5b3){return _0x17d5b3['update'](_0x288004)[_0xe02c('0x16')](function(_0x3c1858){return _0x3c1858;});}return null;};}function removeEntity(_0x22b783){return function(_0x8928f0){if(_0x8928f0){return _0x8928f0[_0xe02c('0x2a')]()[_0xe02c('0x16')](function(){var _0x58bf16=_0x8928f0[_0xe02c('0x2b')]({'plain':!![]});var _0x1e605c='ChatWebsites';return db[_0xe02c('0x2c')][_0xe02c('0x2a')]({'where':{'type':_0x1e605c,'resourceId':_0x58bf16['id']}})[_0xe02c('0x16')](function(){return _0x8928f0;});})[_0xe02c('0x16')](function(){_0x22b783[_0xe02c('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a0350){return function(_0x388063){if(!_0x388063){_0x4a0350[_0xe02c('0x20')](0x194);}return _0x388063;};}function handleError(_0x57928e,_0x1afae6){_0x1afae6=_0x1afae6||0x1f4;return function(_0x58c724){logger[_0xe02c('0x1b')](_0x58c724[_0xe02c('0x2d')]);if(_0x58c724[_0xe02c('0x2e')]){delete _0x58c724[_0xe02c('0x2e')];}_0x57928e[_0xe02c('0x21')](_0x1afae6)['send'](_0x58c724);};}exports[_0xe02c('0x2f')]=function(_0x54da14,_0x5b4c35){var _0x41be11={'include':[{'model':db[_0xe02c('0x30')],'as':_0xe02c('0x31')}]},_0x3d6f3d={},_0x1a4a2e={'count':0x0,'rows':[]};var _0x559bc1=_[_0xe02c('0x32')](db[_0xe02c('0x33')]['rawAttributes'],function(_0xcb664c){return{'name':_0xcb664c[_0xe02c('0x34')],'type':_0xcb664c['type'][_0xe02c('0x35')]};});_0x3d6f3d['model']=_[_0xe02c('0x32')](_0x559bc1,_0xe02c('0x2e'));_0x3d6f3d['query']=_[_0xe02c('0x36')](_0x54da14[_0xe02c('0x37')]);_0x3d6f3d[_0xe02c('0x38')]=_[_0xe02c('0x39')](_0x3d6f3d[_0xe02c('0x3a')],_0x3d6f3d[_0xe02c('0x37')]);_0x41be11['attributes']=_[_0xe02c('0x39')](_0x3d6f3d['model'],qs['fields'](_0x54da14[_0xe02c('0x37')][_0xe02c('0x3b')]));_0x41be11[_0xe02c('0x3c')]=_0x41be11[_0xe02c('0x3c')]['length']?_0x41be11[_0xe02c('0x3c')]:_0x3d6f3d[_0xe02c('0x3a')];if(!_0x54da14[_0xe02c('0x37')]['hasOwnProperty']('nolimit')){_0x41be11[_0xe02c('0x26')]=qs[_0xe02c('0x26')](_0x54da14[_0xe02c('0x37')][_0xe02c('0x26')]);_0x41be11[_0xe02c('0x24')]=qs[_0xe02c('0x24')](_0x54da14[_0xe02c('0x37')][_0xe02c('0x24')]);}_0x41be11[_0xe02c('0x3d')]=qs['sort'](_0x54da14[_0xe02c('0x37')]['sort']);_0x41be11['where']=qs[_0xe02c('0x38')](_[_0xe02c('0x3e')](_0x54da14[_0xe02c('0x37')],_0x3d6f3d[_0xe02c('0x38')]),_0x559bc1);if(_0x54da14[_0xe02c('0x37')][_0xe02c('0x3f')]){_0x41be11[_0xe02c('0x40')]=_[_0xe02c('0x41')](_0x41be11['where'],{'$or':_['map'](_0x559bc1,function(_0x37c7dd){if(_0x37c7dd[_0xe02c('0x42')]!==_0xe02c('0x43')){var _0x52f239={};_0x52f239[_0x37c7dd[_0xe02c('0x2e')]]={'$like':'%'+_0x54da14[_0xe02c('0x37')][_0xe02c('0x3f')]+'%'};return _0x52f239;}})});}_0x41be11=_[_0xe02c('0x41')]({},_0x41be11,_0x54da14[_0xe02c('0x44')]);var _0x4d9267={'where':_0x41be11[_0xe02c('0x40')]};return db[_0xe02c('0x33')][_0xe02c('0x27')](_0x4d9267)[_0xe02c('0x16')](function(_0x598494){_0x1a4a2e[_0xe02c('0x27')]=_0x598494;if(_0x54da14[_0xe02c('0x37')][_0xe02c('0x45')]){_0x41be11[_0xe02c('0x46')]=[{'all':!![]}];}return db[_0xe02c('0x33')][_0xe02c('0x47')](_0x41be11);})[_0xe02c('0x16')](function(_0x3502a5){_0x1a4a2e[_0xe02c('0x48')]=_0x3502a5;return _0x1a4a2e;})[_0xe02c('0x16')](respondWithFilteredResult(_0x5b4c35,_0x41be11))[_0xe02c('0x1f')](handleError(_0x5b4c35,null));};exports[_0xe02c('0x49')]=function(_0x1e955d,_0x48ec5c){var _0x25e790={'raw':![],'where':{'id':_0x1e955d[_0xe02c('0x4a')]['id']},'include':[{'model':db[_0xe02c('0x30')],'as':_0xe02c('0x31')}]},_0x4866e1={};_0x4866e1[_0xe02c('0x3a')]=_[_0xe02c('0x36')](db[_0xe02c('0x33')][_0xe02c('0x4b')]);_0x4866e1[_0xe02c('0x37')]=_[_0xe02c('0x36')](_0x1e955d[_0xe02c('0x37')]);_0x4866e1['filters']=_[_0xe02c('0x39')](_0x4866e1[_0xe02c('0x3a')],_0x4866e1[_0xe02c('0x37')]);_0x25e790['attributes']=_[_0xe02c('0x39')](_0x4866e1['model'],qs[_0xe02c('0x3b')](_0x1e955d['query']['fields']));_0x25e790['attributes']=_0x25e790['attributes']['length']?_0x25e790['attributes']:_0x4866e1[_0xe02c('0x3a')];if(_0x1e955d[_0xe02c('0x37')][_0xe02c('0x45')]){_0x25e790[_0xe02c('0x46')]=[{'all':!![]}];}_0x25e790=_['merge']({},_0x25e790,_0x1e955d[_0xe02c('0x44')]);return db[_0xe02c('0x33')]['find'](_0x25e790)[_0xe02c('0x16')](handleEntityNotFound(_0x48ec5c,null))[_0xe02c('0x16')](respondWithResult(_0x48ec5c,null))[_0xe02c('0x1f')](handleError(_0x48ec5c,null));};exports['create']=function(_0x57a00f,_0x142fc5){return db[_0xe02c('0x33')][_0xe02c('0x4c')](_0x57a00f['body'],{})[_0xe02c('0x16')](function(_0x53765c){var _0x4d6555=_0x57a00f[_0xe02c('0x4d')][_0xe02c('0x2b')]({'plain':!![]});if(!_0x4d6555)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4d6555[_0xe02c('0x4e')]===_0xe02c('0x4d')){var _0x1ead72=_0x53765c['get']({'plain':!![]});var _0x36ebc0=_0xe02c('0x4f');return db['UserProfileSection'][_0xe02c('0x50')]({'where':{'name':_0x36ebc0,'userProfileId':_0x4d6555[_0xe02c('0x51')]},'raw':!![]})[_0xe02c('0x16')](function(_0x1c7206){if(_0x1c7206&&_0x1c7206[_0xe02c('0x52')]===0x0){return db[_0xe02c('0x2c')][_0xe02c('0x4c')]({'name':_0x1ead72[_0xe02c('0x2e')],'resourceId':_0x1ead72['id'],'type':_0x1c7206[_0xe02c('0x2e')],'sectionId':_0x1c7206['id']},{})['then'](function(){return _0x53765c;});}else{return _0x53765c;}})['catch'](function(_0x47f61c){logger[_0xe02c('0x1b')](_0xe02c('0x53'),_0x47f61c);throw _0x47f61c;});}return _0x53765c;})[_0xe02c('0x16')](respondWithResult(_0x142fc5,0xc9))['catch'](handleError(_0x142fc5,null));};exports['update']=function(_0x3b5e1d,_0x383e5b){if(_0x3b5e1d[_0xe02c('0x54')]['id']){delete _0x3b5e1d[_0xe02c('0x54')]['id'];}return db[_0xe02c('0x33')]['find']({'where':{'id':_0x3b5e1d[_0xe02c('0x4a')]['id']},'include':[{'model':db[_0xe02c('0x30')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x383e5b,null))[_0xe02c('0x16')](saveUpdates(_0x3b5e1d['body'],null))['then'](respondWithResult(_0x383e5b,null))['catch'](handleError(_0x383e5b,null));};exports[_0xe02c('0x2a')]=function(_0x28d7a2,_0x44da95){return db[_0xe02c('0x33')][_0xe02c('0x50')]({'where':{'id':_0x28d7a2[_0xe02c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x44da95,null))[_0xe02c('0x16')](removeEntity(_0x44da95,null))['catch'](handleError(_0x44da95,null));};exports['describe']=function(_0x185dc2,_0x46a902){return db[_0xe02c('0x33')][_0xe02c('0x55')]()['then'](respondWithResult(_0x46a902,null))[_0xe02c('0x1f')](handleError(_0x46a902,null));};exports[_0xe02c('0x56')]=function(_0x5d2119,_0xa7133f){if(_0x5d2119[_0xe02c('0x54')]['id']){delete _0x5d2119['body']['id'];}return db[_0xe02c('0x33')][_0xe02c('0x50')]({'where':{'id':_0x5d2119[_0xe02c('0x4a')]['id']}})[_0xe02c('0x16')](handleEntityNotFound(_0xa7133f,null))[_0xe02c('0x16')](function(_0x3a62a2){if(_0x3a62a2){_0x5d2119[_0xe02c('0x54')]['ChatWebsiteId']=_0x3a62a2['id'];return db[_0xe02c('0x57')]['create'](_0x5d2119['body']);}})['then'](respondWithResult(_0xa7133f,null))[_0xe02c('0x1f')](handleError(_0xa7133f,null));};exports[_0xe02c('0x58')]=function(_0x1309b0,_0xa5d1b0){var _0x5a99a3={'raw':![],'where':{}};var _0x32e149={};var _0x327777={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x1309b0['params']['id']}})[_0xe02c('0x16')](handleEntityNotFound(_0xa5d1b0,null))[_0xe02c('0x16')](function(_0x5a3f71){if(_0x5a3f71){_0x32e149['model']=_[_0xe02c('0x36')](db[_0xe02c('0x57')][_0xe02c('0x4b')]);_0x32e149[_0xe02c('0x37')]=_[_0xe02c('0x36')](_0x1309b0['query']);_0x32e149[_0xe02c('0x38')]=_[_0xe02c('0x39')](_0x32e149[_0xe02c('0x3a')],_0x32e149[_0xe02c('0x37')]);_0x5a99a3[_0xe02c('0x3c')]=_[_0xe02c('0x39')](_0x32e149['model'],qs[_0xe02c('0x3b')](_0x1309b0[_0xe02c('0x37')]['fields']));_0x5a99a3[_0xe02c('0x3c')]=_0x5a99a3[_0xe02c('0x3c')][_0xe02c('0x59')]?_0x5a99a3[_0xe02c('0x3c')]:_0x32e149['model'];if(!_0x1309b0[_0xe02c('0x37')][_0xe02c('0x5a')]('nolimit')){_0x5a99a3['limit']=qs['limit'](_0x1309b0[_0xe02c('0x37')][_0xe02c('0x26')]);_0x5a99a3[_0xe02c('0x24')]=qs[_0xe02c('0x24')](_0x1309b0[_0xe02c('0x37')]['offset']);}_0x5a99a3[_0xe02c('0x3d')]=qs[_0xe02c('0x5b')](_0x1309b0[_0xe02c('0x37')]['sort']);_0x5a99a3['where']=qs['filters'](_[_0xe02c('0x3e')](_0x1309b0[_0xe02c('0x37')],_0x32e149[_0xe02c('0x38')]));_0x5a99a3[_0xe02c('0x40')]['ChatWebsiteId']=_0x5a3f71['id'];if(_0x1309b0[_0xe02c('0x37')]['filter']){_0x5a99a3['where']=_[_0xe02c('0x41')](_0x5a99a3[_0xe02c('0x40')],{'$or':_[_0xe02c('0x32')](_0x5a99a3[_0xe02c('0x3c')],function(_0xea4547){var _0x2d132e={};_0x2d132e[_0xea4547]={'$like':'%'+_0x1309b0[_0xe02c('0x37')][_0xe02c('0x3f')]+'%'};return _0x2d132e;})});}_0x5a99a3=_['merge']({},_0x5a99a3,_0x1309b0[_0xe02c('0x44')]);return db[_0xe02c('0x57')][_0xe02c('0x27')]({'where':_0x5a99a3[_0xe02c('0x40')]})[_0xe02c('0x16')](function(_0x737f22){_0x327777[_0xe02c('0x27')]=_0x737f22;if(_0x1309b0[_0xe02c('0x37')][_0xe02c('0x45')]){_0x5a99a3[_0xe02c('0x46')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x5a99a3);})[_0xe02c('0x16')](function(_0x2a5d54){_0x327777[_0xe02c('0x48')]=_0x2a5d54;return _0x327777;});}})[_0xe02c('0x16')](respondWithFilteredResult(_0xa5d1b0,_0x5a99a3))[_0xe02c('0x1f')](handleError(_0xa5d1b0,null));};exports['removeDispositions']=function(_0x405b16,_0x1a6b76){return db[_0xe02c('0x33')][_0xe02c('0x50')]({'where':{'id':_0x405b16[_0xe02c('0x4a')]['id']}})[_0xe02c('0x16')](handleEntityNotFound(_0x1a6b76,null))[_0xe02c('0x16')](function(_0x3a0d9e){if(_0x3a0d9e){return _0x3a0d9e[_0xe02c('0x5c')](_0x405b16[_0xe02c('0x37')][_0xe02c('0x5d')]);}})[_0xe02c('0x16')](respondWithStatusCode(_0x1a6b76,null))['catch'](handleError(_0x1a6b76,null));};exports['addAnswer']=function(_0x34baed,_0x443b2e){if(_0x34baed['body']['id']){delete _0x34baed[_0xe02c('0x54')]['id'];}return db['ChatWebsite'][_0xe02c('0x50')]({'where':{'id':_0x34baed['params']['id']}})[_0xe02c('0x16')](handleEntityNotFound(_0x443b2e,null))[_0xe02c('0x16')](function(_0x43c503){if(_0x43c503){_0x34baed[_0xe02c('0x54')][_0xe02c('0x5e')]=_0x43c503['id'];return db[_0xe02c('0x5f')][_0xe02c('0x4c')](_0x34baed[_0xe02c('0x54')]);}})[_0xe02c('0x16')](respondWithResult(_0x443b2e,null))[_0xe02c('0x1f')](handleError(_0x443b2e,null));};exports['getAnswers']=function(_0x5a118f,_0x4d6753){var _0x364a4f={'raw':![],'where':{}};var _0x23be21={};var _0x6d6e2a={'count':0x0,'rows':[]};return db[_0xe02c('0x33')][_0xe02c('0x60')]({'where':{'id':_0x5a118f[_0xe02c('0x4a')]['id']}})[_0xe02c('0x16')](handleEntityNotFound(_0x4d6753,null))[_0xe02c('0x16')](function(_0x2d14e7){if(_0x2d14e7){_0x23be21[_0xe02c('0x3a')]=_[_0xe02c('0x36')](db[_0xe02c('0x5f')][_0xe02c('0x4b')]);_0x23be21['query']=_['keys'](_0x5a118f[_0xe02c('0x37')]);_0x23be21[_0xe02c('0x38')]=_[_0xe02c('0x39')](_0x23be21['model'],_0x23be21[_0xe02c('0x37')]);_0x364a4f[_0xe02c('0x3c')]=_[_0xe02c('0x39')](_0x23be21[_0xe02c('0x3a')],qs[_0xe02c('0x3b')](_0x5a118f['query'][_0xe02c('0x3b')]));_0x364a4f[_0xe02c('0x3c')]=_0x364a4f[_0xe02c('0x3c')]['length']?_0x364a4f[_0xe02c('0x3c')]:_0x23be21[_0xe02c('0x3a')];if(!_0x5a118f[_0xe02c('0x37')][_0xe02c('0x5a')](_0xe02c('0x61'))){_0x364a4f['limit']=qs[_0xe02c('0x26')](_0x5a118f[_0xe02c('0x37')][_0xe02c('0x26')]);_0x364a4f['offset']=qs[_0xe02c('0x24')](_0x5a118f[_0xe02c('0x37')][_0xe02c('0x24')]);}_0x364a4f[_0xe02c('0x3d')]=qs[_0xe02c('0x5b')](_0x5a118f['query'][_0xe02c('0x5b')]);_0x364a4f[_0xe02c('0x40')]=qs['filters'](_[_0xe02c('0x3e')](_0x5a118f['query'],_0x23be21['filters']));_0x364a4f['where'][_0xe02c('0x5e')]=_0x2d14e7['id'];if(_0x5a118f[_0xe02c('0x37')][_0xe02c('0x3f')]){_0x364a4f[_0xe02c('0x40')]=_[_0xe02c('0x41')](_0x364a4f[_0xe02c('0x40')],{'$or':_[_0xe02c('0x32')](_0x364a4f[_0xe02c('0x3c')],function(_0x14642d){var _0x882f8e={};_0x882f8e[_0x14642d]={'$like':'%'+_0x5a118f[_0xe02c('0x37')][_0xe02c('0x3f')]+'%'};return _0x882f8e;})});}_0x364a4f=_[_0xe02c('0x41')]({},_0x364a4f,_0x5a118f[_0xe02c('0x44')]);return db[_0xe02c('0x5f')][_0xe02c('0x27')]({'where':_0x364a4f['where']})[_0xe02c('0x16')](function(_0x4cfbc0){_0x6d6e2a[_0xe02c('0x27')]=_0x4cfbc0;if(_0x5a118f[_0xe02c('0x37')][_0xe02c('0x45')]){_0x364a4f[_0xe02c('0x46')]=[{'all':!![]}];}return db[_0xe02c('0x5f')][_0xe02c('0x47')](_0x364a4f);})[_0xe02c('0x16')](function(_0xc20f5d){_0x6d6e2a[_0xe02c('0x48')]=_0xc20f5d;return _0x6d6e2a;});}})[_0xe02c('0x16')](respondWithFilteredResult(_0x4d6753,_0x364a4f))[_0xe02c('0x1f')](handleError(_0x4d6753,null));};exports[_0xe02c('0x62')]=function(_0x523ffc,_0x319565){return db[_0xe02c('0x33')]['find']({'where':{'id':_0x523ffc[_0xe02c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x319565,null))['then'](function(_0x2cf30b){if(_0x2cf30b){return _0x2cf30b[_0xe02c('0x62')](_0x523ffc[_0xe02c('0x37')][_0xe02c('0x5d')]);}})['then'](respondWithStatusCode(_0x319565,null))['catch'](handleError(_0x319565,null));};exports[_0xe02c('0x63')]=function(_0xafbea9,_0x48aa34){_0xafbea9[_0xe02c('0x54')][_0xe02c('0x64')]=_0xafbea9[_0xe02c('0x65')][_0xe02c('0x66')];return db[_0xe02c('0x33')][_0xe02c('0x50')]({'where':{'id':_0xafbea9['params']['id']}})[_0xe02c('0x16')](handleEntityNotFound(_0x48aa34,null))[_0xe02c('0x16')](saveUpdates(_0xafbea9[_0xe02c('0x54')],null))[_0xe02c('0x16')](respondWithResult(_0x48aa34,null))[_0xe02c('0x1f')](handleError(_0x48aa34,null));};exports[_0xe02c('0x67')]=function(_0x175ec7,_0x116a6d){_0x175ec7[_0xe02c('0x54')][_0xe02c('0x68')]=_0x175ec7[_0xe02c('0x65')][_0xe02c('0x66')];return db[_0xe02c('0x33')][_0xe02c('0x50')]({'where':{'id':_0x175ec7['params']['id']}})[_0xe02c('0x16')](handleEntityNotFound(_0x116a6d,null))[_0xe02c('0x16')](saveUpdates(_0x175ec7[_0xe02c('0x54')],null))['then'](respondWithResult(_0x116a6d,null))[_0xe02c('0x1f')](handleError(_0x116a6d,null));};exports[_0xe02c('0x69')]=function(_0x1832ad,_0x2127e7){_0x1832ad[_0xe02c('0x54')][_0xe02c('0x6a')]=_0x1832ad[_0xe02c('0x65')]['filename'];return db[_0xe02c('0x33')][_0xe02c('0x50')]({'where':{'id':_0x1832ad[_0xe02c('0x4a')]['id']}})[_0xe02c('0x16')](handleEntityNotFound(_0x2127e7,null))[_0xe02c('0x16')](saveUpdates(_0x1832ad[_0xe02c('0x54')],null))[_0xe02c('0x16')](respondWithResult(_0x2127e7,null))[_0xe02c('0x1f')](handleError(_0x2127e7,null));};exports[_0xe02c('0x6b')]=function(_0x5ed226,_0x4297b2){_0x5ed226[_0xe02c('0x54')]['systemAvatar']=_0x5ed226[_0xe02c('0x65')][_0xe02c('0x66')];return db[_0xe02c('0x33')][_0xe02c('0x50')]({'where':{'id':_0x5ed226[_0xe02c('0x4a')]['id']}})[_0xe02c('0x16')](handleEntityNotFound(_0x4297b2,null))['then'](saveUpdates(_0x5ed226[_0xe02c('0x54')],null))[_0xe02c('0x16')](respondWithResult(_0x4297b2,null))[_0xe02c('0x1f')](handleError(_0x4297b2,null));};exports['getLogo']=function(_0x585914,_0x2a3ecb){var _0x21f827=path[_0xe02c('0x6c')](config['root'],_0xe02c('0x6d'));var _0x35b30c={'where':{'id':_0x585914[_0xe02c('0x4a')]['id']},'attributes':['id',_0xe02c('0x64')],'raw':!![]};var _0x7441e6=![];return require('../../config/license/util')[_0xe02c('0x6e')]()[_0xe02c('0x16')](function(_0x181bf7){if(_0x181bf7){_0x7441e6=_0x181bf7[_0xe02c('0x6f')];}})[_0xe02c('0x16')](function(){return db[_0xe02c('0x33')][_0xe02c('0x50')](_0x35b30c);})[_0xe02c('0x16')](handleEntityNotFound(_0x2a3ecb,null))[_0xe02c('0x16')](function(_0x2ee007){if(_0x2ee007){if(!_[_0xe02c('0x70')](_0x2ee007[_0xe02c('0x64')])){if(fs[_0xe02c('0x71')](path[_0xe02c('0x6c')](config[_0xe02c('0x72')],_0xe02c('0x73'),_0x2ee007[_0xe02c('0x64')]))&&_0x7441e6){_0x21f827=path['join'](config['root'],_0xe02c('0x73'),_0x2ee007['sitepic']);}}return _0x2a3ecb['download'](_0x21f827);}})['catch'](handleError(_0x2a3ecb,null));};exports[_0xe02c('0x74')]=function(_0x4b67e8,_0x889cef){var _0x5c63c3=path[_0xe02c('0x6c')](config['root'],'server/files/images/avatars/default_avatar.png');var _0x3c6593={'where':{'id':_0x4b67e8[_0xe02c('0x4a')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0xe02c('0x33')]['find'](_0x3c6593)['then'](handleEntityNotFound(_0x889cef,null))[_0xe02c('0x16')](function(_0x1fd6e0){if(_0x1fd6e0){if(!_[_0xe02c('0x70')](_0x1fd6e0[_0xe02c('0x68')])){if(fs['existsSync'](path[_0xe02c('0x6c')](config[_0xe02c('0x72')],_0xe02c('0x75'),_0x1fd6e0[_0xe02c('0x68')]))){_0x5c63c3=path[_0xe02c('0x6c')](config[_0xe02c('0x72')],_0xe02c('0x75'),_0x1fd6e0[_0xe02c('0x68')]);}}return _0x889cef[_0xe02c('0x76')](_0x5c63c3);}})[_0xe02c('0x1f')](handleError(_0x889cef,null));};exports[_0xe02c('0x77')]=function(_0x3dd1b2,_0x44889b){var _0x3f35b2=path[_0xe02c('0x6c')](config[_0xe02c('0x72')],_0xe02c('0x78'));var _0x5eecbc={'where':{'id':_0x3dd1b2[_0xe02c('0x4a')]['id']},'attributes':['id',_0xe02c('0x6a'),'showCustomerAvatar'],'raw':!![]};return db[_0xe02c('0x33')][_0xe02c('0x50')](_0x5eecbc)[_0xe02c('0x16')](handleEntityNotFound(_0x44889b,null))['then'](function(_0x3becd8){if(_0x3becd8){if(!_[_0xe02c('0x70')](_0x3becd8[_0xe02c('0x6a')])){if(fs['existsSync'](path[_0xe02c('0x6c')](config[_0xe02c('0x72')],_0xe02c('0x75'),_0x3becd8[_0xe02c('0x6a')]))&&_0x3becd8[_0xe02c('0x79')]){_0x3f35b2=path['join'](config[_0xe02c('0x72')],'server/files/images/avatars/',_0x3becd8[_0xe02c('0x6a')]);}}return _0x44889b['download'](_0x3f35b2);}})[_0xe02c('0x1f')](handleError(_0x44889b,null));};exports['getSystemAvatar']=function(_0x712a60,_0x1bf82a){var _0xa8c2a9=path[_0xe02c('0x6c')](config[_0xe02c('0x72')],'server/files/images/avatars/system_avatar.png');var _0x4bba16={'where':{'id':_0x712a60[_0xe02c('0x4a')]['id']},'attributes':['id',_0xe02c('0x7a')],'raw':!![]};return db[_0xe02c('0x33')][_0xe02c('0x50')](_0x4bba16)[_0xe02c('0x16')](handleEntityNotFound(_0x1bf82a,null))['then'](function(_0x12b8a5){if(_0x12b8a5){if(!_[_0xe02c('0x70')](_0x12b8a5[_0xe02c('0x7a')])){if(fs['existsSync'](path[_0xe02c('0x6c')](config[_0xe02c('0x72')],_0xe02c('0x75'),_0x12b8a5[_0xe02c('0x7a')]))){_0xa8c2a9=path[_0xe02c('0x6c')](config[_0xe02c('0x72')],'server/files/images/avatars/',_0x12b8a5['systemAvatar']);}}return _0x1bf82a[_0xe02c('0x76')](_0xa8c2a9);}})[_0xe02c('0x1f')](handleError(_0x1bf82a,null));};exports['notify']=function(_0x4d8bf0,_0x519b03){var _0x531596=require(_0xe02c('0x7b'));var _0x26e659=new _0x531596();var _0x872c1f=_0x26e659[_0xe02c('0x7c')](_0x4d8bf0[_0xe02c('0x7d')][_0xe02c('0x7e')])[_0xe02c('0x7f')]();var _0x34b88d={'body':_0x4d8bf0[_0xe02c('0x54')],'channel':'chat'};var _0x4937da=[];var _0x38616e=[];var _0x3fd2b2={};var _0xd3af95=![];return db[_0xe02c('0x80')][_0xe02c('0x55')]()[_0xe02c('0x16')](function(_0x2ac19e){if(!_0x2ac19e){throw new db['Sequelize'][(_0xe02c('0x81'))]('no\x20available\x20attributes');}_0x4937da=_['difference'](_[_0xe02c('0x36')](_0x2ac19e),['createdAt',_0xe02c('0x82')]);_0x38616e=_[_0xe02c('0x83')](_[_0xe02c('0x36')](_0x2ac19e),['createdAt','updatedAt',_0xe02c('0x84'),_0xe02c('0x85')]);if(_0x4d8bf0[_0xe02c('0x54')]['id']){delete _0x4d8bf0[_0xe02c('0x54')]['id'];}if(_['isNil'](_0x4d8bf0['body'][_0xe02c('0x86')])){throw new db[(_0xe02c('0x87'))][(_0xe02c('0x81'))](_0xe02c('0x88'));}if(_[_0xe02c('0x70')](_0x4d8bf0['body'][_0xe02c('0x54')])||_0x4d8bf0[_0xe02c('0x54')][_0xe02c('0x54')]===''){throw new db[(_0xe02c('0x87'))]['ValidationError'](_0xe02c('0x89'));}if(_[_0xe02c('0x70')](_0x4d8bf0[_0xe02c('0x54')]['mapKey'])){throw new db['Sequelize'][(_0xe02c('0x81'))](_0xe02c('0x8a')+_0x38616e);}if(!_[_0xe02c('0x8b')](_0x38616e,_0x4d8bf0[_0xe02c('0x54')][_0xe02c('0x8c')])){throw new db['Sequelize'][(_0xe02c('0x81'))](_0xe02c('0x8d')+_0x38616e);}_0x3fd2b2[_0x4d8bf0[_0xe02c('0x54')][_0xe02c('0x8c')]]=_0x4d8bf0[_0xe02c('0x54')]['from'];})['then'](function(){return db[_0xe02c('0x33')][_0xe02c('0x50')]({'where':{'id':_0x4d8bf0[_0xe02c('0x4a')]['id']},'include':[{'model':db[_0xe02c('0x8e')],'as':_0xe02c('0x8f'),'include':[{'model':db[_0xe02c('0x80')],'as':_0xe02c('0x90'),'where':_0x3fd2b2,'limit':0x1,'order':[[_0xe02c('0x82'),_0xe02c('0x91')]]}]},{'model':db[_0xe02c('0x92')],'as':_0xe02c('0x93')}]});})['then'](handleEntityNotFound(_0x519b03,null))['then'](function(_0x492dff){if(_0x492dff&&_0x492dff[_0xe02c('0x8f')]){_0x34b88d['account']=_0x492dff;_0x34b88d[_0xe02c('0x94')]=_0x492dff[_0xe02c('0x93')];_0x34b88d[_0xe02c('0x95')]=_0x492dff['List'];_0x34b88d['applications']=_[_0xe02c('0x96')](_0x34b88d['applications'],[_0xe02c('0x97')],[_0xe02c('0x98')]);if(_0x34b88d[_0xe02c('0x99')][_0xe02c('0x93')]){delete _0x34b88d[_0xe02c('0x99')][_0xe02c('0x93')];}if(_0x34b88d[_0xe02c('0x99')][_0xe02c('0x8f')]&&_0x34b88d[_0xe02c('0x99')][_0xe02c('0x8f')][_0xe02c('0x90')][_0xe02c('0x59')]){return _0x34b88d[_0xe02c('0x99')][_0xe02c('0x8f')][_0xe02c('0x90')][0x0];}var _0x2dd41e=_[_0xe02c('0x9a')](_0x4d8bf0[_0xe02c('0x54')],{'firstName':_0x4d8bf0[_0xe02c('0x54')][_0xe02c('0x86')],'ListId':_0x492dff['ListId']});_0x2dd41e[_0x4d8bf0[_0xe02c('0x54')][_0xe02c('0x8c')]]=_0x4d8bf0[_0xe02c('0x54')][_0xe02c('0x86')];return db[_0xe02c('0x80')][_0xe02c('0x4c')](_0x2dd41e,{'fields':_0x4937da,'raw':!![]});}})[_0xe02c('0x16')](handleEntityNotFound(_0x519b03,null))['then'](function(_0x25ba5b){_0x34b88d[_0xe02c('0x9b')]=_0x25ba5b;var _0x58566b=_0x4d8bf0[_0xe02c('0x54')]['customerIp'];if(_0x4d8bf0[_0xe02c('0x7d')][_0xe02c('0x9c')]){_0x58566b=_0x4d8bf0['headers']['cf-connecting-ip'];}else if(_0x4d8bf0[_0xe02c('0x7d')][_0xe02c('0x9d')]){_0x58566b=_[_0xe02c('0x9e')](_0x4d8bf0[_0xe02c('0x7d')][_0xe02c('0x9d')][_0xe02c('0x9f')](','));}if(_0x25ba5b){var _0x21c87f={'ContactId':_0x25ba5b['id'],'ChatWebsiteId':_0x4d8bf0[_0xe02c('0x4a')]['id'],'from':(_0x25ba5b['firstName']||'')+'\x20'+(_0x25ba5b[_0xe02c('0xa0')]||''),'customerIp':_0x58566b,'customerPort':_0x4d8bf0[_0xe02c('0x7d')]['x-real-port']?_0x4d8bf0['headers']['x-real-port']:null,'referer':_0x4d8bf0[_0xe02c('0x54')][_0xe02c('0xa1')],'browserName':_0x872c1f[_0xe02c('0xa2')][_0xe02c('0x2e')]&&_0x872c1f[_0xe02c('0xa2')][_0xe02c('0xa3')]?util[_0xe02c('0xa4')](_0xe02c('0xa5'),_0x872c1f[_0xe02c('0xa2')][_0xe02c('0x2e')],_0x872c1f['browser'][_0xe02c('0xa3')]):_0xe02c('0xa6'),'browserVersion':_0x872c1f[_0xe02c('0xa2')][_0xe02c('0xa3')]||_0xe02c('0xa6'),'osName':util[_0xe02c('0xa4')](_0xe02c('0xa5'),_0x872c1f['os']['name'],_0x872c1f['os']['version']),'osVersion':_0x872c1f['os']['version'],'deviceModel':_0x872c1f['device'][_0xe02c('0x3a')]&&_0x872c1f[_0xe02c('0xa7')]['vendor']?util[_0xe02c('0xa4')](_0xe02c('0xa8'),_0x872c1f[_0xe02c('0xa7')]['model'],_0x872c1f[_0xe02c('0xa7')][_0xe02c('0xa9')],_0x872c1f[_0xe02c('0xa7')][_0xe02c('0x42')]):null,'deviceVendor':_0x872c1f[_0xe02c('0xa7')]['vendor'],'deviceType':_0x872c1f[_0xe02c('0xa7')][_0xe02c('0x42')],'formData':JSON[_0xe02c('0x1a')](_0x4d8bf0['body'])};var _0x19cc6a={'ChatWebsiteId':_0x4d8bf0['params']['id'],'closed':![]};if(_0x4d8bf0[_0xe02c('0x54')][_0xe02c('0xaa')]){_0x19cc6a['threadId']=_0x4d8bf0[_0xe02c('0x54')][_0xe02c('0xaa')];return db[_0xe02c('0xab')][_0xe02c('0x50')]({'where':_0x19cc6a})[_0xe02c('0x16')](function(_0x344ae6){if(_0x344ae6){return[_0x344ae6,![]];}_0x21c87f[_0xe02c('0xaa')]=_0x4d8bf0[_0xe02c('0x54')][_0xe02c('0xaa')];_0x21c87f[_0xe02c('0xac')]=_0x4d8bf0[_0xe02c('0x54')]['externalUrl'];return db[_0xe02c('0xab')][_0xe02c('0x4c')](_0x21c87f)['then'](function(_0x4ae4f0){return[_0x4ae4f0,!![]];});});}_0x19cc6a[_0xe02c('0xad')]=_0x25ba5b['id'];if(_0x4d8bf0['body']['interaction']&&_0x4d8bf0[_0xe02c('0x54')][_0xe02c('0xae')]['id']){_0x19cc6a['id']=_0x4d8bf0[_0xe02c('0x54')][_0xe02c('0xae')]['id'];return db[_0xe02c('0xab')][_0xe02c('0x50')]({'where':_0x19cc6a})[_0xe02c('0x16')](function(_0x5aa026){if(_0x5aa026){return[_0x5aa026,![]];}return db[_0xe02c('0xab')][_0xe02c('0x4c')](_0x21c87f)['then'](function(_0x55210b){return[_0x55210b,!![]];});});}return db[_0xe02c('0xab')][_0xe02c('0x4c')](_0x21c87f)[_0xe02c('0x16')](function(_0xe60821){return[_0xe60821,!![]];});}})['spread'](function(_0x4c1611,_0x17a78c){if(_0x4c1611){_0xd3af95=_0x17a78c;if(!_0x17a78c){var _0xca1a22={'from':(_0x34b88d[_0xe02c('0x9b')]['firstName']||'')+'\x20'+(_0x34b88d[_0xe02c('0x9b')][_0xe02c('0xa0')]||'')};if(_0x4d8bf0[_0xe02c('0x54')][_0xe02c('0xaa')]&&_0x4d8bf0[_0xe02c('0x54')][_0xe02c('0xaf')]&&_0x4d8bf0[_0xe02c('0x54')]['threadId']!=_0x4d8bf0[_0xe02c('0x54')][_0xe02c('0xaf')]){_0xca1a22[_0xe02c('0xaa')]=_0x4d8bf0[_0xe02c('0x54')][_0xe02c('0xaf')];}return _0x4c1611[_0xe02c('0xb0')](_0xca1a22);}else{return _0x4c1611;}}})[_0xe02c('0x16')](function(_0x5e5618){_0x34b88d[_0xe02c('0xae')]=_0x5e5618['get']({'plain':!![]});_0x34b88d[_0xe02c('0xae')]['created']=_0xd3af95;if(_0x34b88d[_0xe02c('0xae')][_0xe02c('0xb1')]){if(_0x34b88d[_0xe02c('0x99')][_0xe02c('0xb2')]){_0x34b88d['applications'][_0xe02c('0xb3')]({'id':0x0,'priority':_0x34b88d[_0xe02c('0x94')][_0xe02c('0x59')]+0x1,'app':_0xe02c('0xb4'),'appdata':_0xe02c('0xb5'),'interval':_0xe02c('0xb6')});}}return db[_0xe02c('0xb7')][_0xe02c('0x4c')]({'body':_0x4d8bf0[_0xe02c('0x54')][_0xe02c('0x54')],'ChatWebsiteId':_0x4d8bf0[_0xe02c('0x4a')]['id'],'ChatInteractionId':_0x5e5618['id'],'direction':'in','ContactId':_0x34b88d[_0xe02c('0x9b')]['id'],'AttachmentId':_0x4d8bf0[_0xe02c('0x54')][_0xe02c('0xb8')]});})[_0xe02c('0x16')](function(_0x1c9887){_0x34b88d[_0xe02c('0x1d')]=_0x1c9887;if(!_0x34b88d[_0xe02c('0xae')]['UserId']){return;}return db['User'][_0xe02c('0x50')]({'attributes':['id','name'],'where':{'id':_0x34b88d[_0xe02c('0xae')][_0xe02c('0xb9')]}});})[_0xe02c('0x16')](function(_0x31c06b){if(_0x31c06b){_0x34b88d['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x31c06b[_0xe02c('0x2e')]+','+(_0x34b88d[_0xe02c('0x99')][_0xe02c('0xba')]||0xa),'interval':_0xe02c('0xb6')});_0x34b88d['forcedOwnership']=!![];}if(!_0x34b88d[_0xe02c('0xae')]['queueId']){return;}return db['ChatQueue'][_0xe02c('0x50')]({'attributes':['id',_0xe02c('0x2e')],'where':{'id':_0x34b88d[_0xe02c('0xae')]['queueId']}});})[_0xe02c('0x16')](function(_0x1606ae){if(_0x1606ae){_0x34b88d[_0xe02c('0x94')][_0xe02c('0xbb')]({'id':0x0,'priority':0x1,'app':_0xe02c('0xbc'),'appdata':_0x1606ae[_0xe02c('0x2e')]+','+(_0x34b88d[_0xe02c('0x99')][_0xe02c('0xbd')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xe02c('0xbe'),_0x34b88d);})[_0xe02c('0x16')](function(_0x2a6516){respondWithRpcPromise(_0xe02c('0xbf'),'EventManager',{'event':'notify','message':_0x2a6516},client9002);return _0x2a6516;})[_0xe02c('0x16')](respondWithResult(_0x519b03,null))[_0xe02c('0x1f')](handleError(_0x519b03,null));};exports[_0xe02c('0xc0')]=function(_0x30f520,_0x381e14){var _0xab5294,_0x11dc04,_0x2c0255;var _0x2a7389=[];var _0x1ab5b9={};var _0x101e47=_0x30f520['files']||[];var _0x1f8668=[];var _0x421400;return db['CmContact'][_0xe02c('0x55')]()[_0xe02c('0x16')](function(_0x4a9d6c){if(!_0x4a9d6c){throw new db[(_0xe02c('0x87'))][(_0xe02c('0x81'))](_0xe02c('0xc1'));}_0x2a7389=_[_0xe02c('0x83')](_[_0xe02c('0x36')](_0x4a9d6c),[_0xe02c('0xc2'),_0xe02c('0x82'),_0xe02c('0x84'),_0xe02c('0x85')]);if(_0x30f520[_0xe02c('0x54')]['id']){delete _0x30f520[_0xe02c('0x54')]['id'];}if(_[_0xe02c('0x70')](_0x30f520[_0xe02c('0x54')][_0xe02c('0x86')])){throw _0x381e14[_0xe02c('0x21')](0x1f4)[_0xe02c('0xc3')](new db[(_0xe02c('0x87'))][(_0xe02c('0x81'))](_0xe02c('0x88')));}if(_[_0xe02c('0x70')](_0x30f520[_0xe02c('0x54')][_0xe02c('0x54')])||_0x30f520['body'][_0xe02c('0x54')]===''){throw _0x381e14[_0xe02c('0x21')](0x1f4)['send'](new db[(_0xe02c('0x87'))][(_0xe02c('0x81'))](_0xe02c('0x89')));}if(_[_0xe02c('0x70')](_0x30f520['body']['mapKeyOffline'])){throw _0x381e14[_0xe02c('0x21')](0x1f4)['send'](new db[(_0xe02c('0x87'))][(_0xe02c('0x81'))](_0xe02c('0xc4')+_0x2a7389));}if(!_[_0xe02c('0x8b')](_0x2a7389,_0x30f520['body']['mapKeyOffline'])){throw _0x381e14[_0xe02c('0x21')](0x1f4)[_0xe02c('0xc3')](new db[(_0xe02c('0x87'))][(_0xe02c('0x81'))](_0xe02c('0xc5')+_0x2a7389));}_0x1ab5b9[_0x30f520[_0xe02c('0x54')][_0xe02c('0xc6')]]=_0x30f520[_0xe02c('0x54')][_0xe02c('0x86')];})[_0xe02c('0x16')](function(){return db[_0xe02c('0x33')][_0xe02c('0x50')]({'where':{'id':_0x30f520[_0xe02c('0x4a')]['id']},'include':[{'model':db['CmList'],'as':'List'},{'model':db[_0xe02c('0xc7')],'as':_0xe02c('0xc7')}]});})['then'](handleEntityNotFound(_0x381e14,null))[_0xe02c('0x16')](function(_0x29230e){if(_0x29230e&&_0x29230e['List']){_0x11dc04=_0x29230e;var _0x19eaa5=_[_0xe02c('0x9a')](_0x30f520['body'],{'firstName':_0x30f520[_0xe02c('0x54')][_0xe02c('0x86')],'phone':_0x30f520['body']['from'],'ListId':_0x29230e[_0xe02c('0x85')]});_0x19eaa5[_0x30f520[_0xe02c('0x54')][_0xe02c('0xc6')]]=_0x30f520['body'][_0xe02c('0x86')];return db['CmContact'][_0xe02c('0xc8')]({'where':_0x1ab5b9,'defaults':_0x19eaa5});}})[_0xe02c('0xc9')](function(_0x34600d){if(_0x34600d){_0x2c0255=_0x34600d;var _0x1923df=fs[_0xe02c('0xca')](path[_0xe02c('0x6c')](config[_0xe02c('0x72')],_0xe02c('0xcb')),_0xe02c('0xcc'));var _0x1cdbd8=ejs[_0xe02c('0xcd')](_0x1923df,{'body':_[_0xe02c('0xce')](_0x30f520['body']['body']),'bodyTitle':_0x11dc04[_0xe02c('0xcf')]});return db[_0xe02c('0xd0')][_0xe02c('0x4c')]({'body':_0x1cdbd8,'plainBody':htmlToText[_0xe02c('0xd1')](_0x1cdbd8),'ContactId':_0x34600d['id'],'ChatWebsiteId':_0x11dc04['id']});}})[_0xe02c('0x16')](function(_0x412cd3){_0x421400=_0x412cd3;if(_0x101e47[_0xe02c('0x59')]){var _0x3f1149=_0x101e47[_0xe02c('0x32')](function(_0xe3131){return{'name':_0xe3131[_0xe02c('0xd2')],'basename':_0xe3131['filename'],'type':_0xe3131['mimetype'],'ChatOfflineMessageId':_0x412cd3['id']};});_0x1f8668=_0x3f1149['map'](_0x1951fd=>{var _0x5948aa={'filename':_0x1951fd[_0xe02c('0x2e')],'path':path[_0xe02c('0x6c')](config['root'],_0xe02c('0xd3'),_0xe02c('0xd4'),_0xe02c('0xd5'),'offline-chat',_0x1951fd[_0xe02c('0xd6')])};return _0x5948aa;});if(!_0x11dc04[_0xe02c('0xd7')]){return db[_0xe02c('0xd8')][_0xe02c('0xd9')](function(_0x24eefe){return db[_0xe02c('0xda')][_0xe02c('0xdb')](_0x3f1149,{'transaction':_0x24eefe});});}}})['then'](function(){if(_0x421400){_0xab5294=_0x421400;return db[_0xe02c('0xc7')][_0xe02c('0x60')]({'where':{'service':!![]},'include':[{'model':db[_0xe02c('0xdc')],'as':_0xe02c('0xdd'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xe02c('0xde'),'raw':!![]}]}]});}})['then'](function(_0x1e876d){if(_0x1e876d&&_0x1e876d[_0xe02c('0xdd')]&&_0x11dc04[_0xe02c('0xdf')]&&_0x11dc04[_0xe02c('0xe0')]){var _0x3c4421=_0x1e876d[_0xe02c('0xe1')]();return respondWithRpcPromise(_0xe02c('0xe2'),_0xe02c('0xe3'),{'account':_0x3c4421,'message':{'from':util[_0xe02c('0xa4')](_0xe02c('0xe4'),_0x1e876d[_0xe02c('0x2e')],_0x1e876d[_0xe02c('0xe5')]||_0x1e876d[_0xe02c('0xdd')]['user']),'to':_0x11dc04['forwardOfflineAddress'],'subject':_0x11dc04['offlineMessageSubject'],'html':_0xab5294['body'],'attachments':_0x1f8668}},client9003)[_0xe02c('0x16')](function(){return _0xab5294;})[_0xe02c('0x1f')](function(_0x148211){logger[_0xe02c('0x1b')](_0x148211);});}})['then'](function(){if(_0x11dc04&&_0x11dc04['openNewInteraction']&&_0x11dc04[_0xe02c('0xe6')]){var _0x267ca1=[];if(_0x101e47['length']){_0x267ca1=_0x101e47[_0xe02c('0x32')](function(_0x286b6c){return{'name':_0x286b6c['originalname'],'basename':_0x286b6c[_0xe02c('0x66')],'type':_0x286b6c[_0xe02c('0xe7')],'ChatOfflineMessageId':_0x421400['id']};});}var _0x3234c5;if(!_['isNil'](_0x11dc04[_0xe02c('0xe8')])){var _0x5c2296=_[_0xe02c('0x32')](_0x30f520[_0xe02c('0x54')],function(_0x35956f){return _0x35956f;});var _0x26048e=_['toPairsIn'](_0x5c2296)[0x0];var _0x4c1ee3=_[_0xe02c('0xe9')](_0x26048e,function(_0x36ff1f){return _0x36ff1f;});_0x3234c5=_0x4c1ee3[0x1][_0x11dc04[_0xe02c('0xe8')]];}var _0x2f6c93={'from':_0x2c0255[_0xe02c('0xe5')],'firstName':_0x2c0255[_0xe02c('0xea')],'lastName':_0x2c0255[_0xe02c('0xa0')],'mapKey':'email','message':{'from':_0x2c0255[_0xe02c('0xe5')],'to':_0x11dc04['MailAccount'][_0xe02c('0xe5')],'cc':'','subject':_[_0xe02c('0x70')](_0x3234c5)?_0x11dc04[_0xe02c('0xeb')]:_0x3234c5,'messageId':'','sentAt':new Date(),'attach':_0x267ca1[_0xe02c('0x59')],'attachments':_0x267ca1,'originChannel':'Chat','ChatWebsiteId':_0x11dc04['id'],'ChatOfflineMessageId':_0xab5294['id'],'originTo':_0x11dc04[_0xe02c('0xc7')]['email']},'body':_0xab5294['body']};var _0x3e9366={'account':{'id':_0x11dc04[_0xe02c('0xe6')]},'body':_0x2f6c93,'log':_0xe02c('0xec')};return respondWithRpcPromise(_0xe02c('0xec'),'notifyMail',_0x3e9366,client9001)[_0xe02c('0x16')](function(){return _0xab5294;})['catch'](function(_0x43f497){logger[_0xe02c('0x1b')](_0x43f497);});}return;})[_0xe02c('0x16')](function(){if(_0xab5294){return _0xab5294;}})[_0xe02c('0x16')](respondWithResult(_0x381e14,null))[_0xe02c('0x1f')](function(_0x5ca450){logger['error']('catch',_0x5ca450);for(var _0x4bfc4f of _0x101e47){var _0x43fc90=path['join'](config['root'],_0xe02c('0xd3'),_0xe02c('0xd4'),_0xe02c('0xd5'),_0xe02c('0xed'),_0x4bfc4f[_0xe02c('0x66')]);fs_extra[_0xe02c('0xee')](_0x43fc90)[_0xe02c('0x1f')](function(_0x42bb63){logger[_0xe02c('0x1b')](_0xe02c('0xef'),_0x43fc90,_0x42bb63);});}});};exports[_0xe02c('0xf0')]=function(_0x42ed48,_0x285ed9){return db[_0xe02c('0xab')][_0xe02c('0x50')]({'where':{'id':_0x42ed48[_0xe02c('0x4a')]['id']}})[_0xe02c('0x16')](handleEntityNotFound(_0x285ed9,null))[_0xe02c('0x16')](function(_0xa6ed8){if(_0xa6ed8){return _0xa6ed8[_0xe02c('0xf0')](_0x42ed48[_0xe02c('0x54')][_0xe02c('0x5d')],_[_0xe02c('0xf1')](_0x42ed48['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x285ed9,null))[_0xe02c('0x1f')](handleError(_0x285ed9,null));};exports['getInteractions']=function(_0x125536,_0x165ff5){var _0x2e52e0={'raw':![],'where':{}};var _0x3626a0={};var _0x47a6cb={'count':0x0,'rows':[]};return db[_0xe02c('0x33')][_0xe02c('0x60')]({'where':{'id':_0x125536[_0xe02c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x165ff5,null))[_0xe02c('0x16')](function(_0x5ec589){if(_0x5ec589){_0x3626a0[_0xe02c('0x3a')]=_['keys'](db['ChatInteraction'][_0xe02c('0x4b')]);_0x3626a0[_0xe02c('0x37')]=_[_0xe02c('0x36')](_0x125536[_0xe02c('0x37')]);_0x3626a0[_0xe02c('0x38')]=_[_0xe02c('0x39')](_0x3626a0[_0xe02c('0x3a')],_0x3626a0[_0xe02c('0x37')]);_0x2e52e0[_0xe02c('0x3c')]=_[_0xe02c('0x39')](_0x3626a0[_0xe02c('0x3a')],qs[_0xe02c('0x3b')](_0x125536['query'][_0xe02c('0x3b')]));_0x2e52e0['attributes']=_0x2e52e0[_0xe02c('0x3c')][_0xe02c('0x59')]?_0x2e52e0['attributes']:_0x3626a0[_0xe02c('0x3a')];if(!_0x125536['query'][_0xe02c('0x5a')](_0xe02c('0x61'))){_0x2e52e0['limit']=qs[_0xe02c('0x26')](_0x125536[_0xe02c('0x37')][_0xe02c('0x26')]);_0x2e52e0[_0xe02c('0x24')]=qs[_0xe02c('0x24')](_0x125536['query'][_0xe02c('0x24')]);}_0x2e52e0['order']=qs[_0xe02c('0x5b')](_0x125536['query']['sort']);_0x2e52e0[_0xe02c('0x40')]=qs['filters'](_[_0xe02c('0x3e')](_0x125536[_0xe02c('0x37')],_0x3626a0['filters']));_0x2e52e0[_0xe02c('0x40')][_0xe02c('0x5e')]=_0x5ec589['id'];if(_0x125536[_0xe02c('0x37')][_0xe02c('0x3f')]){_0x2e52e0['where']=_[_0xe02c('0x41')](_0x2e52e0['where'],{'$or':_[_0xe02c('0x32')](_0x2e52e0[_0xe02c('0x3c')],function(_0x14c95e){var _0x47b7ff={};_0x47b7ff[_0x14c95e]={'$like':'%'+_0x125536[_0xe02c('0x37')]['filter']+'%'};return _0x47b7ff;})});}_0x2e52e0=_[_0xe02c('0x41')]({},_0x2e52e0,_0x125536[_0xe02c('0x44')]);return db['ChatInteraction'][_0xe02c('0x27')]({'where':_0x2e52e0[_0xe02c('0x40')]})[_0xe02c('0x16')](function(_0x288550){_0x47a6cb['count']=_0x288550;if(_0x125536[_0xe02c('0x37')][_0xe02c('0x45')]){_0x2e52e0['include']=[{'model':db['CmContact'],'as':_0xe02c('0xf2'),'required':![]},{'model':db[_0xe02c('0xf3')],'as':'Owner','attributes':[_0xe02c('0x2e'),_0xe02c('0xf4'),_0xe02c('0xf5')],'required':![]},{'model':db[_0xe02c('0xf6')],'as':_0xe02c('0xf7'),'attributes':['id',_0xe02c('0x2e'),_0xe02c('0xf8')],'where':_0x125536['query'][_0xe02c('0xf9')]?{'id':_0x125536[_0xe02c('0x37')][_0xe02c('0xf9')]}:undefined,'required':_0x125536['query'][_0xe02c('0xf9')]?!![]:![]}];}return db['ChatInteraction']['findAll'](_0x2e52e0);})['then'](function(_0x1209e4){_0x47a6cb[_0xe02c('0x48')]=_0x1209e4;return _0x47a6cb;});}})[_0xe02c('0x16')](respondWithFilteredResult(_0x165ff5,_0x2e52e0))['catch'](handleError(_0x165ff5,null));};function iftimePromise(_0x213775,_0xf43272){return respondWithRpcPromise(_0xe02c('0xfa'),'getSnippet',{'command':_0xf43272[_0xe02c('0xfb')]?util[_0xe02c('0xa4')](_0xe02c('0xfc'),_0x213775[_0xe02c('0xfd')],_0xf43272[_0xe02c('0xfb')]):util['format'](_0xe02c('0xfe'),_0x213775['interval'])},client9002)[_0xe02c('0x16')](function(_0x433b8f){var _0x15684b=_0x433b8f&&_0x433b8f['indexOf'](_0xe02c('0xff'))>=0x0?!![]:![];logger[_0xe02c('0x17')](_0xe02c('0x100'),_0xf43272['id'],_0x213775['id'],_0x213775[_0xe02c('0xfd')],_0x15684b?_0xe02c('0x101'):_0xe02c('0x102'),_0xf43272['timezone']?_0xf43272[_0xe02c('0xfb')]:'No\x20timezone');return _0x15684b;})[_0xe02c('0x1f')](function(_0x3d48c7){logger[_0xe02c('0x1b')](_0xe02c('0x100'),_0xf43272['id'],_0x213775['id'],_0x213775[_0xe02c('0xfd')],util[_0xe02c('0x103')](_0x3d48c7,{'showHidden':![],'depth':null}),_0xf43272[_0xe02c('0xfb')]?_0xf43272['timezone']:_0xe02c('0x104'));return![];});}exports[_0xe02c('0x105')]=function(_0x473bef,_0x3bc894){var _0x1eba43=0x0;var _0x9bf228=0x0;var _0x106630=![];var _0x3a3969;var _0x129314;return db['ChatWebsite'][_0xe02c('0x50')]({'where':{'id':_0x473bef[_0xe02c('0x4a')]['id']},'include':[{'model':db[_0xe02c('0x106')],'as':_0xe02c('0x106'),'include':[{'model':db[_0xe02c('0x106')],'as':_0xe02c('0x107'),'attributes':['id',_0xe02c('0xfd')],'raw':!![]}]}]})[_0xe02c('0x16')](handleEntityNotFound(_0x3bc894,null))['then'](function(_0x3cfbc8){if(_0x3cfbc8){_0x3a3969=_0x3cfbc8;return _0x3cfbc8[_0xe02c('0x108')]({'raw':!![]});}})[_0xe02c('0x16')](function(_0x3b14f6){if(_0x3a3969){if(_0x3b14f6){_0x129314=_0x3b14f6;}}return require('../../config/license/util')[_0xe02c('0x6e')]();})[_0xe02c('0x16')](function(_0x4630aa){if(_0x4630aa){_0x9bf228=_0x4630aa[_0xe02c('0x109')];_0x106630=_0x4630aa[_0xe02c('0x6f')];}})['then'](function(){return db[_0xe02c('0xab')]['count']({'where':{'closed':![]}});})[_0xe02c('0x16')](function(_0x3b7435){_0x1eba43=_0x3b7435;if(_0x9bf228&&_0x3b7435>_0x9bf228){return db['License'][_0xe02c('0x60')]({'where':{'id':0x1}})[_0xe02c('0x16')](function(_0x440261){if(_0x440261){_0x440261[_0xe02c('0x10a')](_0xe02c('0x10b'));}});}})[_0xe02c('0x16')](function(){if(_0x3a3969['Interval']&&_0x3a3969[_0xe02c('0x106')][_0xe02c('0x107')]){var _0x1709b3=[];for(var _0x53a1ec=0x0;_0x53a1ec<_0x3a3969[_0xe02c('0x106')][_0xe02c('0x107')]['length'];_0x53a1ec++){var _0x27fb08=_0x3a3969['Interval']['Intervals'][_0x53a1ec][_0xe02c('0x2b')]({'plain':!![]});_0x1709b3[_0xe02c('0xb3')](iftimePromise(_0x27fb08,_0x3a3969));}return BPromise[_0xe02c('0x10c')](_0x1709b3)[_0xe02c('0x16')](function(_0x22eba2){return _[_0xe02c('0x10d')](_0x22eba2);});}else{return!![];}})[_0xe02c('0x16')](function(_0x20504f){var _0xcfedba=fs[_0xe02c('0xca')](path['join'](config['root'],_0xe02c('0x10e')),_0xe02c('0xcc'));var _0x544a68=new url['URL'](_0x3a3969[_0xe02c('0x10f')])[_0xe02c('0x110')];var _0x1f7493=_0xe02c('0x111');var _0x3a59d9=![];var _0x5417a9={'chatVersion':_0x1f7493,'chatWebsiteAddressOrigin':_0x544a68,'remote':_0x3a3969[_0xe02c('0x112')],'query':querystring[_0xe02c('0x1a')](_[_0xe02c('0x41')](_0x3a3969[_0xe02c('0x2b')]({'plain':!![]}),{'customerIp':_0x473bef[_0xe02c('0x7d')][_0xe02c('0x9d')]||_0x473bef[_0xe02c('0x7d')][_0xe02c('0x113')]||_0x473bef[_0xe02c('0x114')][_0xe02c('0x115')]||_0x473bef['ip'],'referer':_0x473bef[_0xe02c('0x7d')][_0xe02c('0xa1')],'openedInteractions':_0x1eba43,'maxInteractions':_0x9bf228,'virtual':_0x106630[_0xe02c('0x109')],'online':_0x20504f,'custom':_0x106630}))[_0xe02c('0x116')](/'/g,'\x5c\x27')};_0x3bc894[_0xe02c('0xc3')](ejs[_0xe02c('0xcd')](Mustache['render'](_0xcfedba,_0x5417a9),{'proactiveActions':_0x129314,'alignment':_0x3a3969[_0xe02c('0x117')],'verticalAlignment':_0x3a3969['verticalAlignment'],'div_color':_0x3a3969[_0xe02c('0xf8')],'labelText':_0x3a3969['labelText'],'text_color':_0x3a3969[_0xe02c('0x118')],'text_button_color':_0x3a3969[_0xe02c('0x119')],'button_color':_0x3a3969[_0xe02c('0x11a')],'background_color':_0x3a3969[_0xe02c('0x11b')],'hideWhenOffline':_0x3a3969[_0xe02c('0x11c')],'intervalId':_0x3a3969['IntervalId'],'isDevelopment':_0x3a59d9,'chatVersion':_0x1f7493}));})[_0xe02c('0x1f')](handleError(_0x3bc894,null));};exports[_0xe02c('0x11d')]=function(_0x10870f,_0x2cf50c){var _0x1c5d93=_0x10870f[_0xe02c('0x4a')]['id'];var _0x5d3630=_0x10870f['body'];var _0x289b72=0xc8;var _0x393d2e=null;return db[_0xe02c('0xd8')][_0xe02c('0xd9')]({'isolationLevel':db['sequelize'][_0xe02c('0x11e')][_0xe02c('0x11f')]['READ_COMMITTED']},function(_0x5b4214){return db['ChatWebsite'][_0xe02c('0x60')]({'where':{'id':_0x1c5d93},'transaction':_0x5b4214})[_0xe02c('0x16')](function(_0x360d58){if(_0x360d58){return db['ChatApplication']['destroy']({'where':{'ChatWebsiteId':_0x1c5d93},'transaction':_0x5b4214})[_0xe02c('0x16')](function(){var _0x19cd49=_['map'](_0x5d3630,function(_0x5da12d){_0x5da12d[_0xe02c('0x5e')]=_0x1c5d93;return _0x5da12d;});return db[_0xe02c('0x92')]['bulkCreate'](_0x19cd49,{'transaction':_0x5b4214});});}else{_0x289b72=0x194;_0x393d2e=[];}});})[_0xe02c('0x16')](function(){if(_0x289b72!==0x194){return db[_0xe02c('0x92')][_0xe02c('0x120')]({'where':{'ChatWebsiteId':_0x1c5d93},'order':_0xe02c('0x97')})[_0xe02c('0x16')](function(_0x28cea1){_0x393d2e=_0x28cea1;});}})[_0xe02c('0x1f')](function(_0x472bba){_0x289b72=0x1f4;logger[_0xe02c('0x1b')](_0x472bba[_0xe02c('0x2d')]);if(_0x472bba[_0xe02c('0x2e')]){delete _0x472bba[_0xe02c('0x2e')];}_0x393d2e=_0x472bba;})['finally'](function(){if(_0x393d2e===null){_0x2cf50c[_0xe02c('0x20')](_0x289b72);}else{if(_0x289b72===0x1f4){_0x2cf50c[_0xe02c('0x21')](_0x289b72)[_0xe02c('0xc3')](_0x393d2e);}else{_0x2cf50c[_0xe02c('0x21')](_0x289b72)['json'](_0x393d2e);}}});};exports['getApplications']=function(_0x4cf525,_0x9624f8){var _0x11852f={};var _0x1d2616={};var _0x41893d;var _0x13d9f;return db[_0xe02c('0x33')]['findOne']({'where':{'id':_0x4cf525[_0xe02c('0x4a')]['id']}})[_0xe02c('0x16')](handleEntityNotFound(_0x9624f8,null))[_0xe02c('0x16')](function(_0xda4237){if(_0xda4237){_0x41893d=_0xda4237;_0x1d2616[_0xe02c('0x3a')]=_[_0xe02c('0x36')](db[_0xe02c('0x92')]['rawAttributes']);_0x1d2616[_0xe02c('0x37')]=_[_0xe02c('0x36')](_0x4cf525[_0xe02c('0x37')]);_0x1d2616['filters']=_['intersection'](_0x1d2616[_0xe02c('0x3a')],_0x1d2616[_0xe02c('0x37')]);_0x11852f[_0xe02c('0x3c')]=_[_0xe02c('0x39')](_0x1d2616[_0xe02c('0x3a')],qs[_0xe02c('0x3b')](_0x4cf525[_0xe02c('0x37')]['fields']));_0x11852f[_0xe02c('0x3c')]=_0x11852f[_0xe02c('0x3c')]['length']?_0x11852f[_0xe02c('0x3c')]:_0x1d2616[_0xe02c('0x3a')];_0x11852f[_0xe02c('0x3d')]=qs['sort'](_0x4cf525[_0xe02c('0x37')][_0xe02c('0x5b')]);_0x11852f[_0xe02c('0x40')]=qs[_0xe02c('0x38')](_[_0xe02c('0x3e')](_0x4cf525[_0xe02c('0x37')],_0x1d2616[_0xe02c('0x38')]));if(_0x4cf525[_0xe02c('0x37')][_0xe02c('0x3f')]){_0x11852f[_0xe02c('0x40')]=_[_0xe02c('0x41')](_0x11852f['where'],{'$or':_['map'](_0x11852f['attributes'],function(_0x47d304){var _0x484bcb={};_0x484bcb[_0x47d304]={'$like':'%'+_0x4cf525[_0xe02c('0x37')][_0xe02c('0x3f')]+'%'};return _0x484bcb;})});}_0x11852f=_[_0xe02c('0x41')]({},_0x11852f,_0x4cf525[_0xe02c('0x44')]);return _0x41893d[_0xe02c('0x121')](_0x11852f);}})[_0xe02c('0x16')](function(_0x55d871){if(_0x55d871){_0x13d9f=_0x55d871[_0xe02c('0x59')];if(!_0x4cf525[_0xe02c('0x37')]['hasOwnProperty'](_0xe02c('0x61'))){_0x11852f[_0xe02c('0x26')]=qs['limit'](_0x4cf525['query'][_0xe02c('0x26')]);_0x11852f[_0xe02c('0x24')]=qs['offset'](_0x4cf525['query'][_0xe02c('0x24')]);}return _0x41893d[_0xe02c('0x121')](_0x11852f);}})[_0xe02c('0x16')](function(_0x4a0760){if(_0x4a0760){return _0x4a0760?{'count':_0x13d9f,'rows':_0x4a0760}:null;}})[_0xe02c('0x16')](respondWithResult(_0x9624f8,null))[_0xe02c('0x1f')](handleError(_0x9624f8,null));};exports[_0xe02c('0x122')]=function(_0x28f192,_0xf0f2c8){return db['chatProactiveAction'][_0xe02c('0x50')]({'where':{'id':_0x28f192[_0xe02c('0x4a')]['id']}})[_0xe02c('0x16')](handleEntityNotFound(_0xf0f2c8,null))[_0xe02c('0x16')](function(_0x24ebdf){if(_0x24ebdf){return _0x24ebdf[_0xe02c('0x122')](_0x28f192[_0xe02c('0x54')]['ids'],_[_0xe02c('0xf1')](_0x28f192[_0xe02c('0x54')],['ids','id'])||{});}})[_0xe02c('0x16')](respondWithResult(_0xf0f2c8,null))[_0xe02c('0x1f')](handleError(_0xf0f2c8,null));};exports[_0xe02c('0x108')]=function(_0x5e12f1,_0x30c232){var _0x563765={};var _0x2fe1d9={};var _0x2b7cf5;var _0x24f318;return db[_0xe02c('0x33')][_0xe02c('0x60')]({'where':{'id':_0x5e12f1[_0xe02c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x30c232,null))[_0xe02c('0x16')](function(_0x1e6625){if(_0x1e6625){_0x2b7cf5=_0x1e6625;_0x2fe1d9[_0xe02c('0x3a')]=_[_0xe02c('0x36')](db['ChatProactiveAction']['rawAttributes']);_0x2fe1d9['query']=_[_0xe02c('0x36')](_0x5e12f1[_0xe02c('0x37')]);_0x2fe1d9[_0xe02c('0x38')]=_[_0xe02c('0x39')](_0x2fe1d9['model'],_0x2fe1d9['query']);_0x563765[_0xe02c('0x3c')]=_[_0xe02c('0x39')](_0x2fe1d9['model'],qs[_0xe02c('0x3b')](_0x5e12f1[_0xe02c('0x37')][_0xe02c('0x3b')]));_0x563765[_0xe02c('0x3c')]=_0x563765[_0xe02c('0x3c')][_0xe02c('0x59')]?_0x563765[_0xe02c('0x3c')]:_0x2fe1d9[_0xe02c('0x3a')];_0x563765[_0xe02c('0x3d')]=qs[_0xe02c('0x5b')](_0x5e12f1[_0xe02c('0x37')][_0xe02c('0x5b')]);_0x563765[_0xe02c('0x40')]=qs['filters'](_[_0xe02c('0x3e')](_0x5e12f1['query'],_0x2fe1d9[_0xe02c('0x38')]));if(_0x5e12f1['query']['filter']){_0x563765[_0xe02c('0x40')]=_['merge'](_0x563765[_0xe02c('0x40')],{'$or':_['map'](_0x563765[_0xe02c('0x3c')],function(_0x3f9fb7){var _0x3e903e={};_0x3e903e[_0x3f9fb7]={'$like':'%'+_0x5e12f1[_0xe02c('0x37')][_0xe02c('0x3f')]+'%'};return _0x3e903e;})});}_0x563765=_[_0xe02c('0x41')]({},_0x563765,_0x5e12f1[_0xe02c('0x44')]);return _0x2b7cf5[_0xe02c('0x108')](_0x563765);}})['then'](function(_0x4aa9c3){if(_0x4aa9c3){_0x24f318=_0x4aa9c3[_0xe02c('0x59')];if(!_0x5e12f1[_0xe02c('0x37')][_0xe02c('0x5a')]('nolimit')){_0x563765[_0xe02c('0x26')]=qs['limit'](_0x5e12f1[_0xe02c('0x37')][_0xe02c('0x26')]);_0x563765['offset']=qs['offset'](_0x5e12f1['query'][_0xe02c('0x24')]);}return _0x2b7cf5[_0xe02c('0x108')](_0x563765);}})[_0xe02c('0x16')](function(_0x29256c){if(_0x29256c){return _0x29256c?{'count':_0x24f318,'rows':_0x29256c}:null;}})[_0xe02c('0x16')](respondWithResult(_0x30c232,null))[_0xe02c('0x1f')](handleError(_0x30c232,null));};exports[_0xe02c('0x123')]=function(_0x355f3d,_0x27f11e){var _0x26a57d=_0x355f3d[_0xe02c('0x37')][_0xe02c('0x124')]===_0xe02c('0x125')?'offlineForm':_0xe02c('0x126');return db[_0xe02c('0x33')][_0xe02c('0x50')]({'attributes':['id',_0x26a57d],'where':{'id':_0x355f3d[_0xe02c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x27f11e,null))[_0xe02c('0x16')](function(_0x2dca37){if(_0x2dca37){var _0x24ea3a=_0x2dca37[_0x26a57d];var _0x22cbed=_0x24ea3a&&_0x24ea3a['items']?_0x24ea3a[_0xe02c('0x127')]:[];_0x27f11e[_0xe02c('0xc3')]({'fromKey':_[_0xe02c('0x70')](_0x24ea3a['fromKey'])?undefined:_0x24ea3a[_0xe02c('0x128')],'count':_0x22cbed['length'],'rows':_0x22cbed});}})[_0xe02c('0x1f')](handleError(_0x27f11e,null));};exports['getOfflineMessages']=function(_0x9f4b04,_0x1f04fe){var _0x441773={'raw':![],'where':{}};var _0x58b321={};var _0x26569d={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xe02c('0x60')]({'where':{'id':_0x9f4b04[_0xe02c('0x4a')]['id']}})[_0xe02c('0x16')](handleEntityNotFound(_0x1f04fe,null))[_0xe02c('0x16')](function(_0x289fc5){if(_0x289fc5){_0x58b321[_0xe02c('0x3a')]=_[_0xe02c('0x36')](db[_0xe02c('0xd0')]['rawAttributes']);_0x58b321[_0xe02c('0x37')]=_[_0xe02c('0x36')](_0x9f4b04[_0xe02c('0x37')]);_0x58b321['filters']=_[_0xe02c('0x39')](_0x58b321[_0xe02c('0x3a')],_0x58b321[_0xe02c('0x37')]);_0x441773[_0xe02c('0x3c')]=_[_0xe02c('0x39')](_0x58b321['model'],qs[_0xe02c('0x3b')](_0x9f4b04[_0xe02c('0x37')][_0xe02c('0x3b')]));_0x441773[_0xe02c('0x3c')]=_0x441773['attributes']['length']?_0x441773[_0xe02c('0x3c')]:_0x58b321[_0xe02c('0x3a')];if(!_0x9f4b04['query']['hasOwnProperty'](_0xe02c('0x61'))){_0x441773[_0xe02c('0x26')]=qs[_0xe02c('0x26')](_0x9f4b04['query'][_0xe02c('0x26')]);_0x441773[_0xe02c('0x24')]=qs['offset'](_0x9f4b04['query'][_0xe02c('0x24')]);}_0x441773[_0xe02c('0x3d')]=qs['sort'](_0x9f4b04['query']['sort']);_0x441773['where']=qs[_0xe02c('0x38')](_[_0xe02c('0x3e')](_0x9f4b04[_0xe02c('0x37')],_0x58b321['filters']));_0x441773['where']['ChatWebsiteId']=_0x289fc5['id'];if(_0x9f4b04[_0xe02c('0x37')]['filter']){_0x441773[_0xe02c('0x40')]=_['merge'](_0x441773[_0xe02c('0x40')],{'$or':_[_0xe02c('0x32')](_0x441773['attributes'],function(_0x5a1d2f){var _0x4b075d={};_0x4b075d[_0x5a1d2f]={'$like':'%'+_0x9f4b04['query']['filter']+'%'};return _0x4b075d;})});}_0x441773=_[_0xe02c('0x41')]({},_0x441773,_0x9f4b04[_0xe02c('0x44')]);return db['ChatOfflineMessage'][_0xe02c('0x27')]({'where':_0x441773['where']})[_0xe02c('0x16')](function(_0x50591a){_0x26569d[_0xe02c('0x27')]=_0x50591a;if(_0x9f4b04[_0xe02c('0x37')][_0xe02c('0x45')]){_0x441773[_0xe02c('0x46')]=[{'all':!![]}];}else{_0x441773[_0xe02c('0x46')]=[{'model':db['CmContact'],'as':_0xe02c('0xf2'),'required':![]},{'model':db[_0xe02c('0xda')],'as':_0xe02c('0x129'),'required':![]}];}return db[_0xe02c('0xd0')][_0xe02c('0x47')](_0x441773);})[_0xe02c('0x16')](function(_0x39a9ed){_0x26569d[_0xe02c('0x48')]=_0x39a9ed;return _0x26569d;});}})[_0xe02c('0x16')](respondWithFilteredResult(_0x1f04fe,_0x441773))[_0xe02c('0x1f')](handleError(_0x1f04fe,null));};exports[_0xe02c('0x12a')]=function(_0x18f317,_0x11fb44){return db[_0xe02c('0x33')][_0xe02c('0x50')]({'where':{'id':_0x18f317[_0xe02c('0x4a')]['id']}})[_0xe02c('0x16')](handleEntityNotFound(_0x11fb44,null))['then'](function(_0x276cae){if(_0x276cae){return _0x276cae[_0xe02c('0x12a')](_0x18f317[_0xe02c('0x54')][_0xe02c('0x5d')],_['omit'](_0x18f317['body'],[_0xe02c('0x5d'),'id'])||{})[_0xe02c('0xc9')](function(_0x2e8439){for(var _0x194eca=0x0;_0x194eca<_0x18f317['body'][_0xe02c('0x5d')][_0xe02c('0x59')];_0x194eca+=0x1){socket[_0xe02c('0x12b')]('userChatWebsite:save',{'UserId':Number(_0x18f317[_0xe02c('0x54')][_0xe02c('0x5d')][_0x194eca]),'ChatWebsiteId':Number(_0x18f317[_0xe02c('0x4a')]['id'])});}return _0x2e8439;});}})[_0xe02c('0x16')](respondWithResult(_0x11fb44,null))[_0xe02c('0x1f')](handleError(_0x11fb44,null));};exports[_0xe02c('0x12c')]=function(_0x2d588b,_0x2c39e0){return db[_0xe02c('0x33')]['find']({'where':{'id':_0x2d588b['params']['id']}})[_0xe02c('0x16')](handleEntityNotFound(_0x2c39e0,null))[_0xe02c('0x16')](function(_0x349c98){if(_0x349c98){return _0x349c98[_0xe02c('0x12c')](_0x2d588b['query'][_0xe02c('0x5d')])[_0xe02c('0x16')](function(){if(_['isArray'](_0x2d588b[_0xe02c('0x37')]['ids'])){for(var _0x2b681f=0x0;_0x2b681f<_0x2d588b[_0xe02c('0x37')][_0xe02c('0x5d')]['length'];_0x2b681f+=0x1){socket[_0xe02c('0x12b')]('userChatWebsite:remove',{'UserId':Number(_0x2d588b['query'][_0xe02c('0x5d')][_0x2b681f]),'ChatWebsiteId':Number(_0x2d588b[_0xe02c('0x4a')]['id'])});}}else{socket[_0xe02c('0x12b')](_0xe02c('0x12d'),{'UserId':Number(_0x2d588b[_0xe02c('0x37')][_0xe02c('0x5d')]),'ChatWebsiteId':Number(_0x2d588b[_0xe02c('0x4a')]['id'])});}});}})[_0xe02c('0x16')](respondWithStatusCode(_0x2c39e0,null))['catch'](handleError(_0x2c39e0,null));};exports['getAgents']=function(_0x2ad840,_0x310e1b){var _0x5a66c1={};var _0x2a2557={};var _0x2e2772;var _0x579629;return db[_0xe02c('0x33')]['findOne']({'where':{'id':_0x2ad840[_0xe02c('0x4a')]['id']}})[_0xe02c('0x16')](handleEntityNotFound(_0x310e1b,null))[_0xe02c('0x16')](function(_0x497723){if(_0x497723){_0x2e2772=_0x497723;_0x2a2557[_0xe02c('0x3a')]=_[_0xe02c('0x36')](db[_0xe02c('0xf3')][_0xe02c('0x4b')]);_0x2a2557[_0xe02c('0x37')]=_['keys'](_0x2ad840[_0xe02c('0x37')]);_0x2a2557[_0xe02c('0x38')]=_[_0xe02c('0x39')](_0x2a2557[_0xe02c('0x3a')],_0x2a2557[_0xe02c('0x37')]);_0x5a66c1[_0xe02c('0x3c')]=_[_0xe02c('0x39')](_0x2a2557[_0xe02c('0x3a')],qs[_0xe02c('0x3b')](_0x2ad840[_0xe02c('0x37')]['fields']));_0x5a66c1[_0xe02c('0x3c')]=_0x5a66c1['attributes'][_0xe02c('0x59')]?_0x5a66c1[_0xe02c('0x3c')]:_0x2a2557[_0xe02c('0x3a')];_0x5a66c1['order']=qs['sort'](_0x2ad840[_0xe02c('0x37')]['sort']);_0x5a66c1[_0xe02c('0x40')]=qs[_0xe02c('0x38')](_['pick'](_0x2ad840['query'],_0x2a2557[_0xe02c('0x38')]));if(_0x2ad840['query']['filter']){_0x5a66c1[_0xe02c('0x40')]=_[_0xe02c('0x41')](_0x5a66c1['where'],{'$or':_[_0xe02c('0x32')](_0x5a66c1['attributes'],function(_0x222b7a){var _0x373139={};_0x373139[_0x222b7a]={'$like':'%'+_0x2ad840[_0xe02c('0x37')][_0xe02c('0x3f')]+'%'};return _0x373139;})});}_0x5a66c1=_[_0xe02c('0x41')]({},_0x5a66c1,_0x2ad840[_0xe02c('0x44')]);return _0x2e2772[_0xe02c('0x12e')](_0x5a66c1);}})[_0xe02c('0x16')](function(_0x4b392d){if(_0x4b392d){_0x579629=_0x4b392d[_0xe02c('0x59')];if(!_0x2ad840[_0xe02c('0x37')][_0xe02c('0x5a')](_0xe02c('0x61'))){_0x5a66c1[_0xe02c('0x26')]=qs['limit'](_0x2ad840[_0xe02c('0x37')]['limit']);_0x5a66c1[_0xe02c('0x24')]=qs['offset'](_0x2ad840['query'][_0xe02c('0x24')]);}return _0x2e2772[_0xe02c('0x12e')](_0x5a66c1);}})[_0xe02c('0x16')](function(_0x119dc6){if(_0x119dc6){return _0x119dc6?{'count':_0x579629,'rows':_0x119dc6}:null;}})[_0xe02c('0x16')](respondWithResult(_0x310e1b,null))[_0xe02c('0x1f')](handleError(_0x310e1b,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index c9e55aa..fc87b37 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 _0x3308=['hook','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x4c9eb3,_0x39d57c){var _0x545688=function(_0x2b3125){while(--_0x2b3125){_0x4c9eb3['push'](_0x4c9eb3['shift']());}};_0x545688(++_0x39d57c);}(_0x3308,0x12e));var _0x8330=function(_0x137998,_0x1af057){_0x137998=_0x137998-0x0;var _0x54b3f8=_0x3308[_0x137998];return _0x54b3f8;};'use strict';var EventEmitter=require('events');var ChatWebsite=require('../../mysqldb')['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x8330('0x0')](0x0);var events={'afterCreate':_0x8330('0x1'),'afterUpdate':_0x8330('0x2'),'afterDestroy':_0x8330('0x3')};function emitEvent(_0x508fce){return function(_0x5f52e6,_0x28d8af,_0x1e706f){ChatWebsiteEvents[_0x8330('0x4')](_0x508fce+':'+_0x5f52e6['id'],_0x5f52e6);ChatWebsiteEvents[_0x8330('0x4')](_0x508fce,_0x5f52e6);_0x1e706f(null);};}for(var e in events){if(events[_0x8330('0x5')](e)){var event=events[e];ChatWebsite[_0x8330('0x6')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0xf120=['ChatWebsite','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x1246a6,_0x50856e){var _0x201f3f=function(_0x307bd9){while(--_0x307bd9){_0x1246a6['push'](_0x1246a6['shift']());}};_0x201f3f(++_0x50856e);}(_0xf120,0x179));var _0x0f12=function(_0x116e51,_0x701642){_0x116e51=_0x116e51-0x0;var _0x35c38a=_0xf120[_0x116e51];return _0x35c38a;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x0f12('0x0'))['db'][_0x0f12('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x0f12('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0f12('0x3'),'afterDestroy':_0x0f12('0x4')};function emitEvent(_0x163c58){return function(_0x5a263b,_0x1a4043,_0x294e21){ChatWebsiteEvents[_0x0f12('0x5')](_0x163c58+':'+_0x5a263b['id'],_0x5a263b);ChatWebsiteEvents[_0x0f12('0x5')](_0x163c58,_0x5a263b);_0x294e21(null);};}for(var e in events){if(events[_0x0f12('0x6')](e)){var event=events[e];ChatWebsite[_0x0f12('0x7')](e,emitEvent(event));}}module[_0x0f12('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index f8bf585..fd5af5a 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 _0x3449=['util','../../config/logger','bluebird','request-promise','rimraf','exports','ChatWebsite','chat_websites'];(function(_0x4c3dca,_0x28f461){var _0x4a031d=function(_0x1b5736){while(--_0x1b5736){_0x4c3dca['push'](_0x4c3dca['shift']());}};_0x4a031d(++_0x28f461);}(_0x3449,0xd8));var _0x9344=function(_0x5979f5,_0x52ba1f){_0x5979f5=_0x5979f5-0x0;var _0x1f29ae=_0x3449[_0x5979f5];return _0x1f29ae;};'use strict';var _=require('lodash');var util=require(_0x9344('0x0'));var logger=require(_0x9344('0x1'))('api');var moment=require('moment');var BPromise=require(_0x9344('0x2'));var rp=require(_0x9344('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9344('0x4'));var config=require('../../config/environment');var attributes=require('./chatWebsite.attributes');module[_0x9344('0x5')]=function(_0x395ce1,_0x4402e4){return _0x395ce1['define'](_0x9344('0x6'),attributes,{'tableName':_0x9344('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x415e=['chat_websites','lodash','util','moment','request-promise','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite'];(function(_0x24163c,_0xeb21c4){var _0x467e12=function(_0x1bfef3){while(--_0x1bfef3){_0x24163c['push'](_0x24163c['shift']());}};_0x467e12(++_0xeb21c4);}(_0x415e,0x11f));var _0xe415=function(_0x5374cb,_0x5d7b89){_0x5374cb=_0x5374cb-0x0;var _0x2d1581=_0x415e[_0x5374cb];return _0x2d1581;};'use strict';var _=require(_0xe415('0x0'));var util=require(_0xe415('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe415('0x2'));var BPromise=require('bluebird');var rp=require(_0xe415('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe415('0x4'));var config=require(_0xe415('0x5'));var attributes=require(_0xe415('0x6'));module[_0xe415('0x7')]=function(_0x516ff6,_0x456a00){return _0x516ff6[_0xe415('0x8')](_0xe415('0x9'),attributes,{'tableName':_0xe415('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index cd69af4..50b00db 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 _0xf343=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','register','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x22b7ee,_0x4897a9){var _0x23d609=function(_0xb3cb6e){while(--_0xb3cb6e){_0x22b7ee['push'](_0x22b7ee['shift']());}};_0x23d609(++_0x4897a9);}(_0xf343,0x12e));var _0x3f34=function(_0x5b7b30,_0x38b358){_0x5b7b30=_0x5b7b30-0x0;var _0x4faa07=_0xf343[_0x5b7b30];return _0x4faa07;};'use strict';var _=require(_0x3f34('0x0'));var util=require(_0x3f34('0x1'));var moment=require(_0x3f34('0x2'));var BPromise=require(_0x3f34('0x3'));var rs=require(_0x3f34('0x4'));var fs=require('fs');var Redis=require(_0x3f34('0x5'));var db=require(_0x3f34('0x6'))['db'];var utils=require(_0x3f34('0x7'));var logger=require(_0x3f34('0x8'))(_0x3f34('0x9'));var config=require(_0x3f34('0xa'));var jayson=require(_0x3f34('0xb'));var client=jayson[_0x3f34('0xc')]['http']({'port':0x232a});config[_0x3f34('0xd')]=_['defaults'](config[_0x3f34('0xd')],{'host':_0x3f34('0xe'),'port':0x18eb});var socket=require(_0x3f34('0xf'))(new Redis(config[_0x3f34('0xd')]));require('./chatWebsite.socket')[_0x3f34('0x10')](socket);function respondWithRpcPromise(_0x263dc2,_0x1f8dd0,_0x48ab06){return new BPromise(function(_0x58261a,_0x2bf550){return client['request'](_0x263dc2,_0x48ab06)[_0x3f34('0x11')](function(_0x3d9eb8){logger[_0x3f34('0x12')](_0x3f34('0x13'),_0x1f8dd0,_0x3f34('0x14'));logger[_0x3f34('0x15')](_0x3f34('0x16'),_0x1f8dd0,_0x3f34('0x14'),JSON[_0x3f34('0x17')](_0x3d9eb8));if(_0x3d9eb8['error']){if(_0x3d9eb8[_0x3f34('0x18')][_0x3f34('0x19')]===0x1f4){logger['error'](_0x3f34('0x13'),_0x1f8dd0,_0x3d9eb8['error']['message']);return _0x2bf550(_0x3d9eb8[_0x3f34('0x18')][_0x3f34('0x1a')]);}logger['error'](_0x3f34('0x13'),_0x1f8dd0,_0x3d9eb8[_0x3f34('0x18')]['message']);return _0x58261a(_0x3d9eb8[_0x3f34('0x18')]['message']);}else{logger[_0x3f34('0x12')](_0x3f34('0x13'),_0x1f8dd0,'request\x20sent');_0x58261a(_0x3d9eb8['result'][_0x3f34('0x1a')]);}})[_0x3f34('0x1b')](function(_0x3a8f64){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x1f8dd0,_0x3a8f64);_0x2bf550(_0x3a8f64);});});} \ No newline at end of file +var _0x3343=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','moment','bluebird','randomstring'];(function(_0x576a60,_0x55ea9a){var _0x4813a6=function(_0x549936){while(--_0x549936){_0x576a60['push'](_0x576a60['shift']());}};_0x4813a6(++_0x55ea9a);}(_0x3343,0xa5));var _0x3334=function(_0x39efbf,_0x118364){_0x39efbf=_0x39efbf-0x0;var _0xcbd510=_0x3343[_0x39efbf];return _0xcbd510;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3334('0x0'));var BPromise=require(_0x3334('0x1'));var rs=require(_0x3334('0x2'));var fs=require('fs');var Redis=require(_0x3334('0x3'));var db=require(_0x3334('0x4'))['db'];var utils=require(_0x3334('0x5'));var logger=require(_0x3334('0x6'))(_0x3334('0x7'));var config=require(_0x3334('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3334('0x9')][_0x3334('0xa')]({'port':0x232a});config['redis']=_[_0x3334('0xb')](config[_0x3334('0xc')],{'host':_0x3334('0xd'),'port':0x18eb});var socket=require(_0x3334('0xe'))(new Redis(config['redis']));require(_0x3334('0xf'))[_0x3334('0x10')](socket);function respondWithRpcPromise(_0x3645fd,_0x2a1294,_0x3b20fd){return new BPromise(function(_0x3322e1,_0xf5828e){return client[_0x3334('0x11')](_0x3645fd,_0x3b20fd)['then'](function(_0x4937b9){logger[_0x3334('0x12')](_0x3334('0x13'),_0x2a1294,_0x3334('0x14'));logger[_0x3334('0x15')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x2a1294,'request\x20sent',JSON[_0x3334('0x16')](_0x4937b9));if(_0x4937b9[_0x3334('0x17')]){if(_0x4937b9[_0x3334('0x17')][_0x3334('0x18')]===0x1f4){logger['error'](_0x3334('0x13'),_0x2a1294,_0x4937b9['error'][_0x3334('0x19')]);return _0xf5828e(_0x4937b9['error'][_0x3334('0x19')]);}logger[_0x3334('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x2a1294,_0x4937b9['error'][_0x3334('0x19')]);return _0x3322e1(_0x4937b9[_0x3334('0x17')][_0x3334('0x19')]);}else{logger[_0x3334('0x12')](_0x3334('0x13'),_0x2a1294,'request\x20sent');_0x3322e1(_0x4937b9[_0x3334('0x1a')][_0x3334('0x19')]);}})[_0x3334('0x1b')](function(_0x4cfbd6){logger['error'](_0x3334('0x13'),_0x2a1294,_0x4cfbd6);_0xf5828e(_0x4cfbd6);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index ccb5428..8d76b49 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 _0xfab0=['register','length','chatWebsite:','./chatWebsite.events','save','update','emit','removeListener'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xfab0,0xf3));var _0x0fab=function(_0x493df0,_0x3808fe){_0x493df0=_0x493df0-0x0;var _0x4b6a03=_0xfab0[_0x493df0];return _0x4b6a03;};'use strict';var ChatWebsiteEvents=require(_0x0fab('0x0'));var events=[_0x0fab('0x1'),'remove',_0x0fab('0x2')];function createListener(_0x485b9f,_0x55e7e7){return function(_0x518830){_0x55e7e7[_0x0fab('0x3')](_0x485b9f,_0x518830);};}function removeListener(_0x2d6d39,_0x6838ce){return function(){ChatWebsiteEvents[_0x0fab('0x4')](_0x2d6d39,_0x6838ce);};}exports[_0x0fab('0x5')]=function(_0x414642){for(var _0x17f89d=0x0,_0x21cae5=events[_0x0fab('0x6')];_0x17f89d<_0x21cae5;_0x17f89d++){var _0x3f50fe=events[_0x17f89d];var _0xefa202=createListener(_0x0fab('0x7')+_0x3f50fe,_0x414642);ChatWebsiteEvents['on'](_0x3f50fe,_0xefa202);}}; \ No newline at end of file +var _0x7c21=['./chatWebsite.events','save','update','removeListener','register','length'];(function(_0x12a14,_0x2cb297){var _0x5e2c8c=function(_0x130a1f){while(--_0x130a1f){_0x12a14['push'](_0x12a14['shift']());}};_0x5e2c8c(++_0x2cb297);}(_0x7c21,0x186));var _0x17c2=function(_0x2aa948,_0x363cd3){_0x2aa948=_0x2aa948-0x0;var _0x2a4c60=_0x7c21[_0x2aa948];return _0x2a4c60;};'use strict';var ChatWebsiteEvents=require(_0x17c2('0x0'));var events=[_0x17c2('0x1'),'remove',_0x17c2('0x2')];function createListener(_0x32762a,_0xf6add6){return function(_0x1a38f6){_0xf6add6['emit'](_0x32762a,_0x1a38f6);};}function removeListener(_0x8fc30d,_0x4cf8ab){return function(){ChatWebsiteEvents[_0x17c2('0x3')](_0x8fc30d,_0x4cf8ab);};}exports[_0x17c2('0x4')]=function(_0x37a483){for(var _0x4941de=0x0,_0x4b9e27=events[_0x17c2('0x5')];_0x4941de<_0x4b9e27;_0x4941de++){var _0x59c3ad=events[_0x4941de];var _0x2000c8=createListener('chatWebsite:'+_0x59c3ad,_0x37a483);ChatWebsiteEvents['on'](_0x59c3ad,_0x2000c8);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 837379a..efb5e0c 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 _0x7deb=['/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getFields','/:id/offline_messages','/:id/users','getAgents','post','create','addDisposition','diskStorage','root','server/files/images/logos/','format','%s-%s','now','originalname','file','addLogo','join','server/files/images/avatars/','addAvatar','single','server/files','offline-chat','ensureDir','extname','any','offline','addApplications','addProactiveActions','addAgents','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','./chatWebsite.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/dispositions','getDispositions'];(function(_0x38b56e,_0x393912){var _0x1f05c1=function(_0x224cf8){while(--_0x224cf8){_0x38b56e['push'](_0x38b56e['shift']());}};_0x1f05c1(++_0x393912);}(_0x7deb,0x77));var _0xb7de=function(_0xadde88,_0x58ad47){_0xadde88=_0xadde88-0x0;var _0x3b8eb6=_0x7deb[_0xadde88];return _0x3b8eb6;};'use strict';var multer=require(_0xb7de('0x0'));var util=require(_0xb7de('0x1'));var path=require(_0xb7de('0x2'));var timeout=require(_0xb7de('0x3'));var express=require(_0xb7de('0x4'));var router=express[_0xb7de('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb7de('0x6'));router['get']('/',auth[_0xb7de('0x7')](),controller[_0xb7de('0x8')]);router[_0xb7de('0x9')](_0xb7de('0xa'),auth[_0xb7de('0x7')](),controller[_0xb7de('0xb')]);router[_0xb7de('0x9')](_0xb7de('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0xb7de('0xd'),auth[_0xb7de('0x7')](),controller[_0xb7de('0xe')]);router[_0xb7de('0x9')](_0xb7de('0xf'),auth[_0xb7de('0x7')](),controller[_0xb7de('0x10')]);router[_0xb7de('0x9')](_0xb7de('0x11'),controller[_0xb7de('0x12')]);router[_0xb7de('0x9')](_0xb7de('0x13'),controller[_0xb7de('0x14')]);router['get'](_0xb7de('0x15'),controller[_0xb7de('0x16')]);router[_0xb7de('0x9')](_0xb7de('0x17'),controller[_0xb7de('0x18')]);router[_0xb7de('0x9')](_0xb7de('0x19'),auth[_0xb7de('0x7')](),controller[_0xb7de('0x1a')]);router[_0xb7de('0x9')](_0xb7de('0x1b'),controller[_0xb7de('0x1c')]);router[_0xb7de('0x9')](_0xb7de('0x1d'),auth[_0xb7de('0x7')](),controller[_0xb7de('0x1e')]);router[_0xb7de('0x9')](_0xb7de('0x1f'),auth['isAuthenticated'](),controller['getProactiveActions']);router['get']('/:id/fields',controller[_0xb7de('0x20')]);router[_0xb7de('0x9')](_0xb7de('0x21'),auth[_0xb7de('0x7')](),controller['getOfflineMessages']);router['get'](_0xb7de('0x22'),auth['isAuthenticated'](),controller[_0xb7de('0x23')]);router[_0xb7de('0x24')]('/',auth[_0xb7de('0x7')](),controller[_0xb7de('0x25')]);router[_0xb7de('0x24')](_0xb7de('0xd'),auth[_0xb7de('0x7')](),controller[_0xb7de('0x26')]);router[_0xb7de('0x24')](_0xb7de('0xf'),auth['isAuthenticated'](),controller['addAnswer']);var upload=multer({'storage':multer[_0xb7de('0x27')]({'destination':function(_0x19a1a5,_0x3bd935,_0x4e6ac7){_0x4e6ac7(null,path['join'](config[_0xb7de('0x28')],_0xb7de('0x29')));},'filename':function(_0x5c0c02,_0x17b327,_0x429ca3){_0x429ca3(null,util[_0xb7de('0x2a')](_0xb7de('0x2b'),Date[_0xb7de('0x2c')](),_0x17b327[_0xb7de('0x2d')]));}})});router['post']('/:id/logo',upload['single'](_0xb7de('0x2e')),controller[_0xb7de('0x2f')]);var upload=multer({'storage':multer[_0xb7de('0x27')]({'destination':function(_0x248076,_0x5590d9,_0x8444d4){_0x8444d4(null,path[_0xb7de('0x30')](config[_0xb7de('0x28')],_0xb7de('0x31')));},'filename':function(_0x215867,_0xc05ba9,_0xb58ed2){_0xb58ed2(null,util[_0xb7de('0x2a')](_0xb7de('0x2b'),Date[_0xb7de('0x2c')](),_0xc05ba9[_0xb7de('0x2d')]));}})});router[_0xb7de('0x24')]('/:id/avatar',upload['single'](_0xb7de('0x2e')),controller[_0xb7de('0x32')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5e7501,_0x5b5b61,_0x5424e2){_0x5424e2(null,path[_0xb7de('0x30')](config[_0xb7de('0x28')],_0xb7de('0x31')));},'filename':function(_0x213c03,_0x3d20da,_0x37339c){_0x37339c(null,util['format'](_0xb7de('0x2b'),Date[_0xb7de('0x2c')](),_0x3d20da[_0xb7de('0x2d')]));}})});router[_0xb7de('0x24')](_0xb7de('0x15'),upload['single'](_0xb7de('0x2e')),controller['addCustomerAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2ad0bf,_0x3ee38d,_0x79df70){_0x79df70(null,path['join'](config[_0xb7de('0x28')],_0xb7de('0x31')));},'filename':function(_0x59e818,_0x13545a,_0x20aee6){_0x20aee6(null,util['format'](_0xb7de('0x2b'),Date[_0xb7de('0x2c')](),_0x13545a[_0xb7de('0x2d')]));}})});router[_0xb7de('0x24')](_0xb7de('0x17'),upload[_0xb7de('0x33')]('file'),controller['addSystemAvatar']);router[_0xb7de('0x24')]('/:id/notify',controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0xb7de('0x27')]({'destination':function(_0x313e9e,_0x32b6a2,_0x353df7){const _0x379fcb=path[_0xb7de('0x30')](config[_0xb7de('0x28')],_0xb7de('0x34'),'attachments',_0xb7de('0x35'));fs_extra[_0xb7de('0x36')](_0x379fcb,function(){_0x353df7(null,_0x379fcb);});},'filename':function(_0x282c06,_0x4cd443,_0x41a8fb){const _0x3982fa=_0x4cd443[_0xb7de('0x2d')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x5e9af2=path[_0xb7de('0x37')](_0x3982fa);const _0x1f8ad2=Date[_0xb7de('0x2c')]()+'-'+_0x3982fa['replace'](_0x5e9af2,'')+_0x5e9af2;_0x41a8fb(null,_0x1f8ad2);}})});router[_0xb7de('0x24')]('/:id/offline',offlineUploadMulter[_0xb7de('0x38')](),controller[_0xb7de('0x39')]);router['post'](_0xb7de('0x19'),auth[_0xb7de('0x7')](),controller['addInteraction']);router[_0xb7de('0x24')](_0xb7de('0x1d'),auth[_0xb7de('0x7')](),controller[_0xb7de('0x3a')]);router[_0xb7de('0x24')](_0xb7de('0x1f'),auth[_0xb7de('0x7')](),controller[_0xb7de('0x3b')]);router[_0xb7de('0x24')](_0xb7de('0x22'),auth[_0xb7de('0x7')](),controller[_0xb7de('0x3c')]);router['put'](_0xb7de('0xc'),auth[_0xb7de('0x7')](),controller[_0xb7de('0x3d')]);router[_0xb7de('0x3e')](_0xb7de('0xc'),auth[_0xb7de('0x7')](),controller['destroy']);router[_0xb7de('0x3e')](_0xb7de('0xd'),auth['isAuthenticated'](),controller[_0xb7de('0x3f')]);router['delete'](_0xb7de('0xf'),auth['isAuthenticated'](),controller[_0xb7de('0x40')]);router[_0xb7de('0x3e')]('/:id/users',auth[_0xb7de('0x7')](),controller[_0xb7de('0x41')]);module[_0xb7de('0x42')]=router; \ No newline at end of file +var _0xea6c=['addAnswer','diskStorage','join','server/files/images/logos/','format','%s-%s','now','originalname','post','/:id/logo','file','addLogo','root','server/files/images/avatars/','single','addAvatar','/:id/customer_avatar','addSystemAvatar','/:id/notify','notify','attachments','offline-chat','ensureDir','replace','extname','any','offline','addInteraction','addAgents','put','/:id','update','destroy','delete','removeAgents','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getLogo','/:id/avatar','getAvatar','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','create','addDisposition'];(function(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0xea6c,0x1cd));var _0xcea6=function(_0x560623,_0x5c748a){_0x560623=_0x560623-0x0;var _0x2a9089=_0xea6c[_0x560623];return _0x2a9089;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xcea6('0x0'));var timeout=require(_0xcea6('0x1'));var express=require(_0xcea6('0x2'));var router=express[_0xcea6('0x3')]();var fs_extra=require(_0xcea6('0x4'));var auth=require(_0xcea6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xcea6('0x6'));var controller=require('./chatWebsite.controller');router[_0xcea6('0x7')]('/',auth[_0xcea6('0x8')](),controller['index']);router[_0xcea6('0x7')]('/describe',auth[_0xcea6('0x8')](),controller[_0xcea6('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xcea6('0xa')]);router[_0xcea6('0x7')](_0xcea6('0xb'),auth[_0xcea6('0x8')](),controller[_0xcea6('0xc')]);router['get'](_0xcea6('0xd'),auth[_0xcea6('0x8')](),controller[_0xcea6('0xe')]);router['get']('/:id/logo',controller[_0xcea6('0xf')]);router[_0xcea6('0x7')](_0xcea6('0x10'),controller[_0xcea6('0x11')]);router[_0xcea6('0x7')]('/:id/customer_avatar',controller[_0xcea6('0x12')]);router[_0xcea6('0x7')](_0xcea6('0x13'),controller[_0xcea6('0x14')]);router[_0xcea6('0x7')](_0xcea6('0x15'),auth[_0xcea6('0x8')](),controller[_0xcea6('0x16')]);router[_0xcea6('0x7')](_0xcea6('0x17'),controller[_0xcea6('0x18')]);router[_0xcea6('0x7')](_0xcea6('0x19'),auth['isAuthenticated'](),controller[_0xcea6('0x1a')]);router[_0xcea6('0x7')](_0xcea6('0x1b'),auth[_0xcea6('0x8')](),controller[_0xcea6('0x1c')]);router[_0xcea6('0x7')](_0xcea6('0x1d'),controller[_0xcea6('0x1e')]);router[_0xcea6('0x7')](_0xcea6('0x1f'),auth[_0xcea6('0x8')](),controller[_0xcea6('0x20')]);router['get'](_0xcea6('0x21'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0xcea6('0x22')]);router['post'](_0xcea6('0xb'),auth[_0xcea6('0x8')](),controller[_0xcea6('0x23')]);router['post'](_0xcea6('0xd'),auth['isAuthenticated'](),controller[_0xcea6('0x24')]);var upload=multer({'storage':multer[_0xcea6('0x25')]({'destination':function(_0xfc9523,_0x396c70,_0x2a877a){_0x2a877a(null,path[_0xcea6('0x26')](config['root'],_0xcea6('0x27')));},'filename':function(_0x3c5e87,_0x182a6c,_0x39a3c){_0x39a3c(null,util[_0xcea6('0x28')](_0xcea6('0x29'),Date[_0xcea6('0x2a')](),_0x182a6c[_0xcea6('0x2b')]));}})});router[_0xcea6('0x2c')](_0xcea6('0x2d'),upload['single'](_0xcea6('0x2e')),controller[_0xcea6('0x2f')]);var upload=multer({'storage':multer[_0xcea6('0x25')]({'destination':function(_0x5c2049,_0x60c850,_0x4a4cdc){_0x4a4cdc(null,path[_0xcea6('0x26')](config[_0xcea6('0x30')],_0xcea6('0x31')));},'filename':function(_0x2fa03c,_0x40518f,_0x488b77){_0x488b77(null,util[_0xcea6('0x28')](_0xcea6('0x29'),Date[_0xcea6('0x2a')](),_0x40518f[_0xcea6('0x2b')]));}})});router[_0xcea6('0x2c')]('/:id/avatar',upload[_0xcea6('0x32')](_0xcea6('0x2e')),controller[_0xcea6('0x33')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x43fd54,_0x2b1f77,_0x1d1035){_0x1d1035(null,path['join'](config[_0xcea6('0x30')],'server/files/images/avatars/'));},'filename':function(_0x9dcb07,_0x286553,_0x19ca2b){_0x19ca2b(null,util[_0xcea6('0x28')](_0xcea6('0x29'),Date['now'](),_0x286553[_0xcea6('0x2b')]));}})});router[_0xcea6('0x2c')](_0xcea6('0x34'),upload[_0xcea6('0x32')](_0xcea6('0x2e')),controller['addCustomerAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2ebccd,_0x238a56,_0x43a858){_0x43a858(null,path[_0xcea6('0x26')](config[_0xcea6('0x30')],_0xcea6('0x31')));},'filename':function(_0x2d0bbd,_0xfbd4e2,_0x1ab988){_0x1ab988(null,util[_0xcea6('0x28')](_0xcea6('0x29'),Date['now'](),_0xfbd4e2[_0xcea6('0x2b')]));}})});router[_0xcea6('0x2c')](_0xcea6('0x13'),upload[_0xcea6('0x32')](_0xcea6('0x2e')),controller[_0xcea6('0x35')]);router['post'](_0xcea6('0x36'),controller[_0xcea6('0x37')]);const offlineUploadMulter=multer({'storage':multer[_0xcea6('0x25')]({'destination':function(_0x10db1a,_0x391a76,_0x1c3455){const _0x28a540=path['join'](config[_0xcea6('0x30')],'server/files',_0xcea6('0x38'),_0xcea6('0x39'));fs_extra[_0xcea6('0x3a')](_0x28a540,function(){_0x1c3455(null,_0x28a540);});},'filename':function(_0x55e8dc,_0x5d592e,_0x1ea1ed){const _0x13285f=_0x5d592e[_0xcea6('0x2b')][_0xcea6('0x3b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x22335c=path[_0xcea6('0x3c')](_0x13285f);const _0x35716f=Date[_0xcea6('0x2a')]()+'-'+_0x13285f['replace'](_0x22335c,'')+_0x22335c;_0x1ea1ed(null,_0x35716f);}})});router[_0xcea6('0x2c')]('/:id/offline',offlineUploadMulter[_0xcea6('0x3d')](),controller[_0xcea6('0x3e')]);router['post']('/:id/interactions',auth[_0xcea6('0x8')](),controller[_0xcea6('0x3f')]);router[_0xcea6('0x2c')]('/:id/applications',auth[_0xcea6('0x8')](),controller['addApplications']);router[_0xcea6('0x2c')](_0xcea6('0x1b'),auth[_0xcea6('0x8')](),controller['addProactiveActions']);router[_0xcea6('0x2c')](_0xcea6('0x21'),auth[_0xcea6('0x8')](),controller[_0xcea6('0x40')]);router[_0xcea6('0x41')](_0xcea6('0x42'),auth[_0xcea6('0x8')](),controller[_0xcea6('0x43')]);router['delete'](_0xcea6('0x42'),auth['isAuthenticated'](),controller[_0xcea6('0x44')]);router['delete'](_0xcea6('0xb'),auth[_0xcea6('0x8')](),controller['removeDispositions']);router[_0xcea6('0x45')](_0xcea6('0xd'),auth[_0xcea6('0x8')](),controller['removeAnswers']);router[_0xcea6('0x45')](_0xcea6('0x21'),auth[_0xcea6('0x8')](),controller[_0xcea6('0x46')]);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 a22d567..cee003b 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 _0xc12b=['client-side-logger','expressEndpoint','/client-logs','use','isAuthenticated','../components/auth/service','../config/environment','Router','env','production','app','get'];(function(_0x5d879f,_0x467ba4){var _0x55bfa9=function(_0x31f90f){while(--_0x31f90f){_0x5d879f['push'](_0x5d879f['shift']());}};_0x55bfa9(++_0x467ba4);}(_0xc12b,0x16d));var _0xbc12=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc12b[_0x3dd15e];return _0x231fd0;};var beaverLogger=require('beaver-logger/server');var express=require('express');var auth=require(_0xbc12('0x0'));var config=require(_0xbc12('0x1'));var router=express[_0xbc12('0x2')]();var isProduction=config[_0xbc12('0x3')]===_0xbc12('0x4')||![];function clientSideLogs(_0x48d2e5,_0x173613,_0x304567){var _0x22d44e=_0x48d2e5[_0xbc12('0x5')][_0xbc12('0x6')](_0xbc12('0x7'));if(!_0x22d44e){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger[_0xbc12('0x8')]({'uri':_0xbc12('0x9'),'logger':_0x22d44e,'enableCors':!isProduction})(_0x48d2e5,_0x173613,_0x304567);}router[_0xbc12('0xa')](auth[_0xbc12('0xb')](),clientSideLogs);module['exports']=router; \ No newline at end of file +var _0x4d08=['use','exports','beaver-logger/server','express','../components/auth/service','env','production','client-side-logger','Client-Side\x20logger\x20not\x20found!'];(function(_0x17c256,_0x2ca9e4){var _0x594039=function(_0x5205c9){while(--_0x5205c9){_0x17c256['push'](_0x17c256['shift']());}};_0x594039(++_0x2ca9e4);}(_0x4d08,0x119));var _0x84d0=function(_0x2389bc,_0x167cd2){_0x2389bc=_0x2389bc-0x0;var _0x170548=_0x4d08[_0x2389bc];return _0x170548;};var beaverLogger=require(_0x84d0('0x0'));var express=require(_0x84d0('0x1'));var auth=require(_0x84d0('0x2'));var config=require('../config/environment');var router=express['Router']();var isProduction=config[_0x84d0('0x3')]===_0x84d0('0x4')||![];function clientSideLogs(_0x5a9470,_0x5a9331,_0x3bbcf1){var _0x11ca67=_0x5a9470['app']['get'](_0x84d0('0x5'));if(!_0x11ca67){throw new Error(_0x84d0('0x6'));}return beaverLogger['expressEndpoint']({'uri':'/client-logs','logger':_0x11ca67,'enableCors':!isProduction})(_0x5a9470,_0x5a9331,_0x3bbcf1);}router[_0x84d0('0x7')](auth['isAuthenticated'](),clientSideLogs);module[_0x84d0('0x8')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 43c42b2..682cff1 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 _0x4f0f=['MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','AmazonAWS','Google','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x4f0f,0x88));var _0xf4f0=function(_0x5893de,_0x11612c){_0x5893de=_0x5893de-0x0;var _0x334240=_0x4f0f[_0x5893de];return _0x334240;};'use strict';var Sequelize=require(_0xf4f0('0x0'));module[_0xf4f0('0x1')]={'name':{'type':Sequelize[_0xf4f0('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xf4f0('0x3')](_0xf4f0('0x4'),_0xf4f0('0x5'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xf4f0('0x3')](_0xf4f0('0x6'),_0xf4f0('0x7'))},'data1':{'type':Sequelize[_0xf4f0('0x2')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0xf4f0('0x2')],'comment':_0xf4f0('0x8')},'data3':{'type':Sequelize[_0xf4f0('0x2')],'comment':_0xf4f0('0x9')},'data4':{'type':Sequelize[_0xf4f0('0x2')],'comment':_0xf4f0('0xa')},'data5':{'type':Sequelize[_0xf4f0('0xb')],'comment':_0xf4f0('0xc')},'data6':{'type':Sequelize['TEXT'],'comment':_0xf4f0('0xd')},'data7':{'type':Sequelize[_0xf4f0('0xb')],'comment':_0xf4f0('0xe')}}; \ No newline at end of file +var _0xef9e=['Outlook365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','exports','STRING','AmazonAWS','Google','MicrosoftAzure','ENUM'];(function(_0xd9e74b,_0x24422f){var _0x3bb62b=function(_0x49e7bc){while(--_0x49e7bc){_0xd9e74b['push'](_0xd9e74b['shift']());}};_0x3bb62b(++_0x24422f);}(_0xef9e,0xe4));var _0xeef9=function(_0x1c9625,_0x49cd62){_0x1c9625=_0x1c9625-0x0;var _0x3fcef6=_0xef9e[_0x1c9625];return _0x3fcef6;};'use strict';var Sequelize=require('sequelize');module[_0xeef9('0x0')]={'name':{'type':Sequelize[_0xeef9('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0xeef9('0x2'),_0xeef9('0x3'),_0xeef9('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xeef9('0x5')](_0xeef9('0x6'),'Dynamics365')},'data1':{'type':Sequelize[_0xeef9('0x1')],'comment':_0xeef9('0x7')},'data2':{'type':Sequelize[_0xeef9('0x1')],'comment':_0xeef9('0x8')},'data3':{'type':Sequelize[_0xeef9('0x1')],'comment':_0xeef9('0x9')},'data4':{'type':Sequelize[_0xeef9('0x1')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0xeef9('0xa')],'comment':_0xeef9('0xb')},'data6':{'type':Sequelize[_0xeef9('0xa')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0xeef9('0xa')],'comment':_0xeef9('0xc')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 51795cc..e728351 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 _0xa334=['end','json','undefined','offset','count','limit','Content-Range','update','then','error','stack','name','send','padEnd','index','CloudProvider','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','MicrosoftAzure','decryptString','data3','catch','show','params','find','service','create','body','Service\x20parameter\x20not\x20specified','values','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','oauth2MicrosoftAuthorize','generateMicrosoftAuthorizationUrl','oauth2MicrosoftCallback','state','parse','from','base64','toString','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','getOauth2MicrosoftAccessToken','data5','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','stringify','lodash','../../components/parsers/qs','../../config/environment','../../config/logger','../../mysqldb','./cloudProvider.oauth','redis','defaults','socket.io-emitter','sendStatus','status'];(function(_0x124fa8,_0x1da2aa){var _0x416023=function(_0x30a0fe){while(--_0x30a0fe){_0x124fa8['push'](_0x124fa8['shift']());}};_0x416023(++_0x1da2aa);}(_0xa334,0x159));var _0x4a33=function(_0x27d83b,_0x556f95){_0x27d83b=_0x27d83b-0x0;var _0x389926=_0xa334[_0x27d83b];return _0x389926;};'use strict';var _=require(_0x4a33('0x0'));var Redis=require('ioredis');var qs=require(_0x4a33('0x1'));var encryptor=require('../../components/encryptor');var config=require(_0x4a33('0x2'));var logger=require(_0x4a33('0x3'))('api');var db=require(_0x4a33('0x4'))['db'];var oauth=require(_0x4a33('0x5'));config[_0x4a33('0x6')]=_[_0x4a33('0x7')](config[_0x4a33('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x4a33('0x8'))(new Redis(config['redis']));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x5e988f,_0x5b280d){_0x5b280d=_0x5b280d||0xcc;return function(_0x2c86b8){if(_0x2c86b8){return _0x5e988f[_0x4a33('0x9')](_0x5b280d);}return _0x5e988f[_0x4a33('0xa')](_0x5b280d)[_0x4a33('0xb')]();};}function respondWithResult(_0x52c850,_0x450b38){_0x450b38=_0x450b38||0xc8;return function(_0x4afc13){if(_0x4afc13){return _0x52c850[_0x4a33('0xa')](_0x450b38)[_0x4a33('0xc')](_0x4afc13);}};}function respondWithFilteredResult(_0x1fcd95,_0x363489){return function(_0x101f21){if(_0x101f21){var _0x472048=typeof _0x363489['offset']===_0x4a33('0xd')&&typeof _0x363489['limit']==='undefined';var _0x5becd9=_0x101f21['count'];var _0x183d92=_0x472048?0x0:_0x363489[_0x4a33('0xe')];var _0x4f1ad9=_0x472048?_0x101f21[_0x4a33('0xf')]:_0x363489[_0x4a33('0xe')]+_0x363489[_0x4a33('0x10')];var _0x48e40a;if(_0x4f1ad9>=_0x5becd9){_0x4f1ad9=_0x5becd9;_0x48e40a=0xc8;}else{_0x48e40a=0xce;}_0x1fcd95[_0x4a33('0xa')](_0x48e40a);return _0x1fcd95['set'](_0x4a33('0x11'),_0x183d92+'-'+_0x4f1ad9+'/'+_0x5becd9)[_0x4a33('0xc')](_0x101f21);}return null;};}function saveUpdates(_0x18d681){return function(_0x593db5){if(_0x593db5){return _0x593db5[_0x4a33('0x12')](_0x18d681)[_0x4a33('0x13')](function(_0x3e50ce){return _0x3e50ce;});}return null;};}function removeEntity(_0x2d2bf7){return function(_0x199604){if(_0x199604){return _0x199604['destroy']()['then'](function(){_0x2d2bf7[_0x4a33('0xa')](0xcc)[_0x4a33('0xb')]();});}};}function handleEntityNotFound(_0x39c526){return function(_0x45523c){if(!_0x45523c){_0x39c526[_0x4a33('0x9')](0x194);}return _0x45523c;};}function handleError(_0x529946,_0x37ad8f){_0x37ad8f=_0x37ad8f||0x1f4;return function(_0x347206){logger[_0x4a33('0x14')](_0x347206[_0x4a33('0x15')]);if(_0x347206[_0x4a33('0x16')]){delete _0x347206[_0x4a33('0x16')];}_0x529946[_0x4a33('0xa')](_0x37ad8f)[_0x4a33('0x17')](_0x347206);};}function maskClientSecret(_0x185efe){return _[_0x4a33('0x18')](_0x185efe['slice'](0x0,0x3),0x14,'*');}exports[_0x4a33('0x19')]=function(_0x11c0c1,_0x235d2f){var _0xc5d20b={},_0x3937ac={},_0x4f8e55={'count':0x0,'rows':[]};var _0x4ba33c=_['map'](db[_0x4a33('0x1a')][_0x4a33('0x1b')],function(_0x3ff586){return{'name':_0x3ff586[_0x4a33('0x1c')],'type':_0x3ff586[_0x4a33('0x1d')][_0x4a33('0x1e')]};});_0x3937ac[_0x4a33('0x1f')]=_[_0x4a33('0x20')](_0x4ba33c,_0x4a33('0x16'));_0x3937ac[_0x4a33('0x21')]=_[_0x4a33('0x22')](_0x11c0c1[_0x4a33('0x21')]);_0x3937ac[_0x4a33('0x23')]=_[_0x4a33('0x24')](_0x3937ac[_0x4a33('0x1f')],_0x3937ac[_0x4a33('0x21')]);_0xc5d20b[_0x4a33('0x25')]=_[_0x4a33('0x24')](_0x3937ac['model'],qs[_0x4a33('0x26')](_0x11c0c1[_0x4a33('0x21')]['fields']));_0xc5d20b[_0x4a33('0x25')]=_0xc5d20b[_0x4a33('0x25')][_0x4a33('0x27')]?_0xc5d20b[_0x4a33('0x25')]:_0x3937ac[_0x4a33('0x1f')];if(!_0x11c0c1[_0x4a33('0x21')][_0x4a33('0x28')](_0x4a33('0x29'))){_0xc5d20b[_0x4a33('0x10')]=qs['limit'](_0x11c0c1['query'][_0x4a33('0x10')]);_0xc5d20b[_0x4a33('0xe')]=qs[_0x4a33('0xe')](_0x11c0c1['query'][_0x4a33('0xe')]);}_0xc5d20b[_0x4a33('0x2a')]=qs[_0x4a33('0x2b')](_0x11c0c1['query'][_0x4a33('0x2b')]);_0xc5d20b[_0x4a33('0x2c')]=qs[_0x4a33('0x23')](_[_0x4a33('0x2d')](_0x11c0c1['query'],_0x3937ac[_0x4a33('0x23')]),_0x4ba33c);if(_0x11c0c1['query'][_0x4a33('0x2e')]){_0xc5d20b[_0x4a33('0x2c')]=_['merge'](_0xc5d20b['where'],{'$or':_[_0x4a33('0x20')](_0x4ba33c,function(_0x228865){if(_0x228865[_0x4a33('0x1d')]!==_0x4a33('0x2f')){var _0x213a19={};_0x213a19[_0x228865['name']]={'$like':'%'+_0x11c0c1[_0x4a33('0x21')][_0x4a33('0x2e')]+'%'};return _0x213a19;}})});}_0xc5d20b=_[_0x4a33('0x30')]({},_0xc5d20b,_0x11c0c1[_0x4a33('0x31')]);var _0x17899d={'where':_0xc5d20b[_0x4a33('0x2c')]};return db[_0x4a33('0x1a')]['count'](_0x17899d)[_0x4a33('0x13')](function(_0x280868){_0x4f8e55[_0x4a33('0xf')]=_0x280868;if(_0x11c0c1['query'][_0x4a33('0x32')]){_0xc5d20b[_0x4a33('0x33')]=[{'all':!![]}];}return db[_0x4a33('0x1a')]['findAll'](_0xc5d20b);})['then'](function(_0x1932b5){_0x4f8e55[_0x4a33('0x34')]=_['map'](_0x1932b5,function(_0x5a0502){if(_0x5a0502['service']===_0x4a33('0x35')){var _0x44ec9d=encryptor[_0x4a33('0x36')](_0x5a0502[_0x4a33('0x37')]);_0x5a0502[_0x4a33('0x37')]=maskClientSecret(_0x44ec9d);}return _0x5a0502;});return _0x4f8e55;})[_0x4a33('0x13')](respondWithFilteredResult(_0x235d2f,_0xc5d20b))[_0x4a33('0x38')](handleError(_0x235d2f,null));};exports[_0x4a33('0x39')]=function(_0x18f758,_0x452d5e){var _0x32f142={'raw':!![],'where':{'id':_0x18f758[_0x4a33('0x3a')]['id']}},_0x5ae7ac={};_0x5ae7ac[_0x4a33('0x1f')]=_[_0x4a33('0x22')](db[_0x4a33('0x1a')][_0x4a33('0x1b')]);_0x5ae7ac[_0x4a33('0x21')]=_['keys'](_0x18f758[_0x4a33('0x21')]);_0x5ae7ac[_0x4a33('0x23')]=_[_0x4a33('0x24')](_0x5ae7ac[_0x4a33('0x1f')],_0x5ae7ac[_0x4a33('0x21')]);_0x32f142[_0x4a33('0x25')]=_[_0x4a33('0x24')](_0x5ae7ac[_0x4a33('0x1f')],qs['fields'](_0x18f758[_0x4a33('0x21')][_0x4a33('0x26')]));_0x32f142[_0x4a33('0x25')]=_0x32f142[_0x4a33('0x25')]['length']?_0x32f142[_0x4a33('0x25')]:_0x5ae7ac['model'];if(_0x18f758[_0x4a33('0x21')][_0x4a33('0x32')]){_0x32f142[_0x4a33('0x33')]=[{'all':!![]}];}_0x32f142=_['merge']({},_0x32f142,_0x18f758['options']);return db[_0x4a33('0x1a')][_0x4a33('0x3b')](_0x32f142)['then'](handleEntityNotFound(_0x452d5e,null))['then'](function(_0x2f6e97){if(_0x2f6e97[_0x4a33('0x3c')]===_0x4a33('0x35')){var _0x151202=encryptor[_0x4a33('0x36')](_0x2f6e97[_0x4a33('0x37')]);_0x2f6e97[_0x4a33('0x37')]=maskClientSecret(_0x151202);}return _0x2f6e97;})[_0x4a33('0x13')](respondWithResult(_0x452d5e,null))['catch'](handleError(_0x452d5e,null));};exports[_0x4a33('0x3d')]=function(_0x2ef382,_0x217813){if(!_0x2ef382[_0x4a33('0x3e')]['name'])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x2ef382['body'][_0x4a33('0x3c')])throw new Error(_0x4a33('0x3f'));var _0x3433aa=db[_0x4a33('0x1a')][_0x4a33('0x1b')][_0x4a33('0x3c')][_0x4a33('0x40')];if(!_0x3433aa['includes'](_0x2ef382[_0x4a33('0x3e')][_0x4a33('0x3c')]))throw new Error(_0x4a33('0x41')+_0x3433aa['join'](',\x20'));if(_0x2ef382[_0x4a33('0x3e')]['service']===_0x4a33('0x35')&&_0x2ef382[_0x4a33('0x3e')][_0x4a33('0x37')]){_0x2ef382[_0x4a33('0x3e')][_0x4a33('0x37')]=encryptor[_0x4a33('0x42')](_0x2ef382[_0x4a33('0x3e')][_0x4a33('0x37')]);}return db[_0x4a33('0x1a')][_0x4a33('0x3d')](_0x2ef382[_0x4a33('0x3e')],{})[_0x4a33('0x13')](respondWithResult(_0x217813,0xc9))[_0x4a33('0x38')](handleError(_0x217813,null));};exports[_0x4a33('0x12')]=function(_0x5cacaf,_0x4bc5d0){if(_0x5cacaf[_0x4a33('0x3e')]['id']){delete _0x5cacaf[_0x4a33('0x3e')]['id'];}return db[_0x4a33('0x1a')][_0x4a33('0x3b')]({'where':{'id':_0x5cacaf['params']['id']}})[_0x4a33('0x13')](handleEntityNotFound(_0x4bc5d0,null))[_0x4a33('0x13')](function(_0x42e50c){if(_0x42e50c['service']===_0x4a33('0x35')&&_0x5cacaf[_0x4a33('0x3e')][_0x4a33('0x37')]){_0x5cacaf[_0x4a33('0x3e')]['data3']=encryptor[_0x4a33('0x42')](_0x5cacaf['body'][_0x4a33('0x37')]);}return _0x42e50c;})['then'](saveUpdates(_0x5cacaf['body'],null))[_0x4a33('0x13')](respondWithResult(_0x4bc5d0,null))[_0x4a33('0x38')](handleError(_0x4bc5d0,null));};exports['destroy']=function(_0x28703f,_0x22b717){return db[_0x4a33('0x1a')][_0x4a33('0x3b')]({'where':{'id':_0x28703f['params']['id']}})[_0x4a33('0x13')](handleEntityNotFound(_0x22b717,null))['then'](removeEntity(_0x22b717,null))['catch'](handleError(_0x22b717,null));};exports[_0x4a33('0x43')]=function(_0xfedcd1,_0x31076a){return db[_0x4a33('0x1a')]['findOne']({'where':{'id':_0xfedcd1[_0x4a33('0x3a')]['id']},'raw':!![]})['then'](function(_0x4f24c1){if(!_0x4f24c1)return _0x31076a['sendStatus'](0x194);return{'url':oauth[_0x4a33('0x44')](_0x4f24c1,_0xfedcd1['user']['id'])};})['then'](respondWithResult(_0x31076a,null))[_0x4a33('0x38')](handleError(_0x31076a,null));};exports[_0x4a33('0x45')]=function(_0x3f326c,_0x3b9c72){var _0xd24b2f=_0x3f326c[_0x4a33('0x3e')];var _0x58d2d0;var _0x51db78;if(_0xd24b2f[_0x4a33('0x14')])throw _0xd24b2f;redis['get'](_0xd24b2f[_0x4a33('0x46')])['then'](function(_0x41a34f){if(!_0x41a34f)throw new Error('Invalid\x20state\x20parameter');_0x58d2d0=JSON[_0x4a33('0x47')](_0x41a34f);var _0x10730f=Buffer[_0x4a33('0x48')](_0xd24b2f[_0x4a33('0x46')],_0x4a33('0x49'))[_0x4a33('0x4a')]('ascii');_0x51db78=JSON[_0x4a33('0x47')](_0x10730f);if(!oauth[_0x4a33('0x4b')](_0xd24b2f[_0x4a33('0x4c')],_0x58d2d0[_0x4a33('0x4d')]))throw new Error(_0x4a33('0x4e'));redis['del'](_0xd24b2f[_0x4a33('0x46')]);return oauth[_0x4a33('0x4f')](_0xd24b2f['code'],_0x58d2d0);})['then'](function(_0x56ae8d){_0x58d2d0[_0x4a33('0x50')]=_0x56ae8d['access_token'];_0x58d2d0[_0x4a33('0x51')]=_0x56ae8d[_0x4a33('0x52')];return db['CloudProvider'][_0x4a33('0x12')]({'data5':_0x58d2d0[_0x4a33('0x50')],'data6':_0x58d2d0[_0x4a33('0x51')]},{'where':{'id':_0x58d2d0['id']}});})['then'](function(){oauth[_0x4a33('0x53')](_0x58d2d0);socket[_0x4a33('0x54')](_0x4a33('0x55'),{'id':_0x51db78['id']});return;})[_0x4a33('0x13')](respondWithStatusCode(_0x3b9c72,null))[_0x4a33('0x38')](function(_0x251e4b){if(_0x51db78){socket[_0x4a33('0x54')](_0x4a33('0x56'),{'id':_0x51db78['id']});}if(!_0x58d2d0){logger[_0x4a33('0x14')](_0x4a33('0x57'),_0x251e4b);return _0x3b9c72[_0x4a33('0xa')](0x1f4)[_0x4a33('0x17')](_0x251e4b['message']);}logger[_0x4a33('0x14')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x58d2d0['id'],JSON[_0x4a33('0x58')](_0x251e4b));});}; \ No newline at end of file +var _0x08dd=['count','set','update','then','destroy','error','name','send','index','map','CloudProvider','rawAttributes','type','keys','query','filters','intersection','model','fields','attributes','length','order','sort','where','filter','merge','options','includeAll','include','rows','MicrosoftAzure','decryptString','data3','catch','show','params','find','create','body','Name\x20parameter\x20not\x20specified','service','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','oauth2MicrosoftAuthorize','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','from','base64','toString','ascii','oauth2Claims','del','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','../../components/encryptor','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x08dd,0x154));var _0xd08d=function(_0x4bc85b,_0x26505e){_0x4bc85b=_0x4bc85b-0x0;var _0x3bce9c=_0x08dd[_0x4bc85b];return _0x3bce9c;};'use strict';var _=require(_0xd08d('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var encryptor=require(_0xd08d('0x1'));var config=require('../../config/environment');var logger=require(_0xd08d('0x2'))(_0xd08d('0x3'));var db=require(_0xd08d('0x4'))['db'];var oauth=require('./cloudProvider.oauth');config[_0xd08d('0x5')]=_[_0xd08d('0x6')](config[_0xd08d('0x5')],{'host':_0xd08d('0x7'),'port':0x18eb});var socket=require(_0xd08d('0x8'))(new Redis(config[_0xd08d('0x5')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x186cb0,_0xdebcdd){_0xdebcdd=_0xdebcdd||0xcc;return function(_0x388bb8){if(_0x388bb8){return _0x186cb0[_0xd08d('0x9')](_0xdebcdd);}return _0x186cb0[_0xd08d('0xa')](_0xdebcdd)[_0xd08d('0xb')]();};}function respondWithResult(_0x326c15,_0x259df7){_0x259df7=_0x259df7||0xc8;return function(_0x14a3ed){if(_0x14a3ed){return _0x326c15[_0xd08d('0xa')](_0x259df7)[_0xd08d('0xc')](_0x14a3ed);}};}function respondWithFilteredResult(_0x40a6da,_0x17e9c0){return function(_0x4c0063){if(_0x4c0063){var _0x5a7a1c=typeof _0x17e9c0[_0xd08d('0xd')]===_0xd08d('0xe')&&typeof _0x17e9c0[_0xd08d('0xf')]===_0xd08d('0xe');var _0x3cd477=_0x4c0063[_0xd08d('0x10')];var _0x1bda78=_0x5a7a1c?0x0:_0x17e9c0['offset'];var _0x193df3=_0x5a7a1c?_0x4c0063[_0xd08d('0x10')]:_0x17e9c0[_0xd08d('0xd')]+_0x17e9c0['limit'];var _0x4d7daa;if(_0x193df3>=_0x3cd477){_0x193df3=_0x3cd477;_0x4d7daa=0xc8;}else{_0x4d7daa=0xce;}_0x40a6da[_0xd08d('0xa')](_0x4d7daa);return _0x40a6da[_0xd08d('0x11')]('Content-Range',_0x1bda78+'-'+_0x193df3+'/'+_0x3cd477)[_0xd08d('0xc')](_0x4c0063);}return null;};}function saveUpdates(_0x494b75){return function(_0x34ab4e){if(_0x34ab4e){return _0x34ab4e[_0xd08d('0x12')](_0x494b75)[_0xd08d('0x13')](function(_0x586d03){return _0x586d03;});}return null;};}function removeEntity(_0x2a6815){return function(_0x22a695){if(_0x22a695){return _0x22a695[_0xd08d('0x14')]()['then'](function(){_0x2a6815[_0xd08d('0xa')](0xcc)[_0xd08d('0xb')]();});}};}function handleEntityNotFound(_0x20b91a){return function(_0x3b9902){if(!_0x3b9902){_0x20b91a[_0xd08d('0x9')](0x194);}return _0x3b9902;};}function handleError(_0x2318a7,_0x57772a){_0x57772a=_0x57772a||0x1f4;return function(_0x432308){logger[_0xd08d('0x15')](_0x432308['stack']);if(_0x432308[_0xd08d('0x16')]){delete _0x432308[_0xd08d('0x16')];}_0x2318a7[_0xd08d('0xa')](_0x57772a)[_0xd08d('0x17')](_0x432308);};}function maskClientSecret(_0x108d8c){return _['padEnd'](_0x108d8c['slice'](0x0,0x3),0x14,'*');}exports[_0xd08d('0x18')]=function(_0x565d7e,_0x751609){var _0x243864={},_0x1e9f6f={},_0x575815={'count':0x0,'rows':[]};var _0xbc47e8=_[_0xd08d('0x19')](db[_0xd08d('0x1a')][_0xd08d('0x1b')],function(_0x362412){return{'name':_0x362412['fieldName'],'type':_0x362412[_0xd08d('0x1c')]['key']};});_0x1e9f6f['model']=_[_0xd08d('0x19')](_0xbc47e8,_0xd08d('0x16'));_0x1e9f6f['query']=_[_0xd08d('0x1d')](_0x565d7e[_0xd08d('0x1e')]);_0x1e9f6f[_0xd08d('0x1f')]=_[_0xd08d('0x20')](_0x1e9f6f[_0xd08d('0x21')],_0x1e9f6f['query']);_0x243864['attributes']=_[_0xd08d('0x20')](_0x1e9f6f[_0xd08d('0x21')],qs['fields'](_0x565d7e['query'][_0xd08d('0x22')]));_0x243864[_0xd08d('0x23')]=_0x243864['attributes'][_0xd08d('0x24')]?_0x243864[_0xd08d('0x23')]:_0x1e9f6f['model'];if(!_0x565d7e['query']['hasOwnProperty']('nolimit')){_0x243864[_0xd08d('0xf')]=qs[_0xd08d('0xf')](_0x565d7e['query']['limit']);_0x243864[_0xd08d('0xd')]=qs['offset'](_0x565d7e['query']['offset']);}_0x243864[_0xd08d('0x25')]=qs[_0xd08d('0x26')](_0x565d7e[_0xd08d('0x1e')][_0xd08d('0x26')]);_0x243864[_0xd08d('0x27')]=qs['filters'](_['pick'](_0x565d7e['query'],_0x1e9f6f['filters']),_0xbc47e8);if(_0x565d7e['query'][_0xd08d('0x28')]){_0x243864[_0xd08d('0x27')]=_[_0xd08d('0x29')](_0x243864[_0xd08d('0x27')],{'$or':_[_0xd08d('0x19')](_0xbc47e8,function(_0x3603a5){if(_0x3603a5[_0xd08d('0x1c')]!=='VIRTUAL'){var _0x10731e={};_0x10731e[_0x3603a5[_0xd08d('0x16')]]={'$like':'%'+_0x565d7e[_0xd08d('0x1e')][_0xd08d('0x28')]+'%'};return _0x10731e;}})});}_0x243864=_[_0xd08d('0x29')]({},_0x243864,_0x565d7e[_0xd08d('0x2a')]);var _0x5c5dd9={'where':_0x243864['where']};return db[_0xd08d('0x1a')]['count'](_0x5c5dd9)[_0xd08d('0x13')](function(_0x24658b){_0x575815['count']=_0x24658b;if(_0x565d7e['query'][_0xd08d('0x2b')]){_0x243864[_0xd08d('0x2c')]=[{'all':!![]}];}return db['CloudProvider']['findAll'](_0x243864);})['then'](function(_0x333542){_0x575815[_0xd08d('0x2d')]=_[_0xd08d('0x19')](_0x333542,function(_0x15f61e){if(_0x15f61e['service']===_0xd08d('0x2e')){var _0x1632e6=encryptor[_0xd08d('0x2f')](_0x15f61e[_0xd08d('0x30')]);_0x15f61e[_0xd08d('0x30')]=maskClientSecret(_0x1632e6);}return _0x15f61e;});return _0x575815;})[_0xd08d('0x13')](respondWithFilteredResult(_0x751609,_0x243864))[_0xd08d('0x31')](handleError(_0x751609,null));};exports[_0xd08d('0x32')]=function(_0x2bc13e,_0xcc097a){var _0x4070e5={'raw':!![],'where':{'id':_0x2bc13e[_0xd08d('0x33')]['id']}},_0x311b61={};_0x311b61[_0xd08d('0x21')]=_['keys'](db[_0xd08d('0x1a')][_0xd08d('0x1b')]);_0x311b61[_0xd08d('0x1e')]=_['keys'](_0x2bc13e[_0xd08d('0x1e')]);_0x311b61[_0xd08d('0x1f')]=_[_0xd08d('0x20')](_0x311b61[_0xd08d('0x21')],_0x311b61[_0xd08d('0x1e')]);_0x4070e5[_0xd08d('0x23')]=_[_0xd08d('0x20')](_0x311b61['model'],qs[_0xd08d('0x22')](_0x2bc13e[_0xd08d('0x1e')]['fields']));_0x4070e5['attributes']=_0x4070e5[_0xd08d('0x23')][_0xd08d('0x24')]?_0x4070e5[_0xd08d('0x23')]:_0x311b61[_0xd08d('0x21')];if(_0x2bc13e[_0xd08d('0x1e')]['includeAll']){_0x4070e5[_0xd08d('0x2c')]=[{'all':!![]}];}_0x4070e5=_['merge']({},_0x4070e5,_0x2bc13e['options']);return db['CloudProvider'][_0xd08d('0x34')](_0x4070e5)['then'](handleEntityNotFound(_0xcc097a,null))['then'](function(_0x48729b){if(_0x48729b['service']==='MicrosoftAzure'){var _0x1a363e=encryptor[_0xd08d('0x2f')](_0x48729b[_0xd08d('0x30')]);_0x48729b['data3']=maskClientSecret(_0x1a363e);}return _0x48729b;})[_0xd08d('0x13')](respondWithResult(_0xcc097a,null))[_0xd08d('0x31')](handleError(_0xcc097a,null));};exports[_0xd08d('0x35')]=function(_0x24d308,_0x50b8b3){if(!_0x24d308[_0xd08d('0x36')][_0xd08d('0x16')])throw new Error(_0xd08d('0x37'));if(!_0x24d308['body'][_0xd08d('0x38')])throw new Error(_0xd08d('0x39'));var _0xc6dd75=db[_0xd08d('0x1a')][_0xd08d('0x1b')][_0xd08d('0x38')][_0xd08d('0x3a')];if(!_0xc6dd75[_0xd08d('0x3b')](_0x24d308['body']['service']))throw new Error(_0xd08d('0x3c')+_0xc6dd75[_0xd08d('0x3d')](',\x20'));if(_0x24d308[_0xd08d('0x36')][_0xd08d('0x38')]==='MicrosoftAzure'&&_0x24d308[_0xd08d('0x36')][_0xd08d('0x30')]){_0x24d308[_0xd08d('0x36')][_0xd08d('0x30')]=encryptor[_0xd08d('0x3e')](_0x24d308['body']['data3']);}return db[_0xd08d('0x1a')][_0xd08d('0x35')](_0x24d308[_0xd08d('0x36')],{})['then'](respondWithResult(_0x50b8b3,0xc9))[_0xd08d('0x31')](handleError(_0x50b8b3,null));};exports['update']=function(_0x52a317,_0x27690f){if(_0x52a317[_0xd08d('0x36')]['id']){delete _0x52a317[_0xd08d('0x36')]['id'];}return db[_0xd08d('0x1a')]['find']({'where':{'id':_0x52a317['params']['id']}})[_0xd08d('0x13')](handleEntityNotFound(_0x27690f,null))[_0xd08d('0x13')](function(_0x4bd27b){if(_0x4bd27b[_0xd08d('0x38')]==='MicrosoftAzure'&&_0x52a317[_0xd08d('0x36')][_0xd08d('0x30')]){_0x52a317[_0xd08d('0x36')][_0xd08d('0x30')]=encryptor[_0xd08d('0x3e')](_0x52a317[_0xd08d('0x36')][_0xd08d('0x30')]);}return _0x4bd27b;})[_0xd08d('0x13')](saveUpdates(_0x52a317[_0xd08d('0x36')],null))[_0xd08d('0x13')](respondWithResult(_0x27690f,null))[_0xd08d('0x31')](handleError(_0x27690f,null));};exports[_0xd08d('0x14')]=function(_0x496661,_0x4b7e7e){return db[_0xd08d('0x1a')][_0xd08d('0x34')]({'where':{'id':_0x496661['params']['id']}})[_0xd08d('0x13')](handleEntityNotFound(_0x4b7e7e,null))[_0xd08d('0x13')](removeEntity(_0x4b7e7e,null))[_0xd08d('0x31')](handleError(_0x4b7e7e,null));};exports[_0xd08d('0x3f')]=function(_0x2c42e9,_0x4f7bbc){return db[_0xd08d('0x1a')]['findOne']({'where':{'id':_0x2c42e9['params']['id']},'raw':!![]})['then'](function(_0x1dfe9d){if(!_0x1dfe9d)return _0x4f7bbc[_0xd08d('0x9')](0x194);return{'url':oauth[_0xd08d('0x40')](_0x1dfe9d,_0x2c42e9[_0xd08d('0x41')]['id'])};})[_0xd08d('0x13')](respondWithResult(_0x4f7bbc,null))['catch'](handleError(_0x4f7bbc,null));};exports[_0xd08d('0x42')]=function(_0x38d14d,_0x3aeaf4){var _0x3e473c=_0x38d14d[_0xd08d('0x36')];var _0xbd8610;var _0x2d125c;if(_0x3e473c[_0xd08d('0x15')])throw _0x3e473c;redis[_0xd08d('0x43')](_0x3e473c[_0xd08d('0x44')])[_0xd08d('0x13')](function(_0x279a5a){if(!_0x279a5a)throw new Error(_0xd08d('0x45'));_0xbd8610=JSON[_0xd08d('0x46')](_0x279a5a);var _0x3518fc=Buffer[_0xd08d('0x47')](_0x3e473c[_0xd08d('0x44')],_0xd08d('0x48'))[_0xd08d('0x49')](_0xd08d('0x4a'));_0x2d125c=JSON[_0xd08d('0x46')](_0x3518fc);if(!oauth['isValidIdToken'](_0x3e473c['id_token'],_0xbd8610[_0xd08d('0x4b')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0xd08d('0x4c')](_0x3e473c['state']);return oauth[_0xd08d('0x4d')](_0x3e473c[_0xd08d('0x4e')],_0xbd8610);})[_0xd08d('0x13')](function(_0x25556a){_0xbd8610[_0xd08d('0x4f')]=_0x25556a[_0xd08d('0x50')];_0xbd8610[_0xd08d('0x51')]=_0x25556a[_0xd08d('0x52')];return db['CloudProvider'][_0xd08d('0x12')]({'data5':_0xbd8610[_0xd08d('0x4f')],'data6':_0xbd8610[_0xd08d('0x51')]},{'where':{'id':_0xbd8610['id']}});})['then'](function(){oauth[_0xd08d('0x53')](_0xbd8610);socket[_0xd08d('0x54')](_0xd08d('0x55'),{'id':_0x2d125c['id']});return;})[_0xd08d('0x13')](respondWithStatusCode(_0x3aeaf4,null))[_0xd08d('0x31')](function(_0x1db2ca){if(_0x2d125c){socket[_0xd08d('0x54')]('microsoftAuthorization:error',{'id':_0x2d125c['id']});}if(!_0xbd8610){logger['error']('Invalid\x20authentication\x20state\x20parameter',_0x1db2ca);return _0x3aeaf4[_0xd08d('0xa')](0x1f4)[_0xd08d('0x17')](_0x1db2ca[_0xd08d('0x56')]);}logger['error'](_0xd08d('0x57'),_0xbd8610['id'],JSON[_0xd08d('0x58')](_0x1db2ca));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index b4a456e..fde572d 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 _0x9aff=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./cloudProvider.attributes','define','CloudProvider','cloud_providers','lodash','util'];(function(_0x4cd419,_0x56ab7e){var _0x518810=function(_0x3b0a8e){while(--_0x3b0a8e){_0x4cd419['push'](_0x4cd419['shift']());}};_0x518810(++_0x56ab7e);}(_0x9aff,0x76));var _0xf9af=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0x9aff[_0x11ce46];return _0x368a1e;};'use strict';var _=require(_0xf9af('0x0'));var util=require(_0xf9af('0x1'));var logger=require(_0xf9af('0x2'))('api');var moment=require(_0xf9af('0x3'));var BPromise=require(_0xf9af('0x4'));var rp=require(_0xf9af('0x5'));var fs=require('fs');var path=require(_0xf9af('0x6'));var rimraf=require('rimraf');var config=require(_0xf9af('0x7'));var attributes=require(_0xf9af('0x8'));module['exports']=function(_0x2e97f3,_0x5bb04b){return _0x2e97f3[_0xf9af('0x9')](_0xf9af('0xa'),attributes,{'tableName':_0xf9af('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf422=['api','moment','bluebird','request-promise','path','../../config/environment','./cloudProvider.attributes','exports','define','cloud_providers','lodash','util','../../config/logger'];(function(_0x3d73f2,_0xbdb6f2){var _0x259d32=function(_0x5e12ba){while(--_0x5e12ba){_0x3d73f2['push'](_0x3d73f2['shift']());}};_0x259d32(++_0xbdb6f2);}(_0xf422,0x99));var _0x2f42=function(_0x12ae4d,_0x39b174){_0x12ae4d=_0x12ae4d-0x0;var _0x520f4b=_0xf422[_0x12ae4d];return _0x520f4b;};'use strict';var _=require(_0x2f42('0x0'));var util=require(_0x2f42('0x1'));var logger=require(_0x2f42('0x2'))(_0x2f42('0x3'));var moment=require(_0x2f42('0x4'));var BPromise=require(_0x2f42('0x5'));var rp=require(_0x2f42('0x6'));var fs=require('fs');var path=require(_0x2f42('0x7'));var rimraf=require('rimraf');var config=require(_0x2f42('0x8'));var attributes=require(_0x2f42('0x9'));module[_0x2f42('0xa')]=function(_0x4d4716,_0x1c3f18){return _0x4d4716[_0x2f42('0xb')]('CloudProvider',attributes,{'tableName':_0x2f42('0xc'),'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 20467c4..b621437 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 _0x393d=['CloudProvider','findOne','refresh_token','data6','decryptString','POST','data5','access_token','update','catch','error','authorization_code','intervals','bind','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','crypto','jsonwebtoken','moment','request-promise','util','../../config/environment','../../config/logger','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','map','type','push','data7','Outlook365','Dynamics365','/.default','replace','{TENANT_ID}','data2','code','from','stringify','base64','randomBytes','toString','hex','data1','response_type','join','redirect_uri','data4','form_post','state','nonce','prompt','key','value','oauth2/','set','decode','payload','iss','aud','audience','isAfter','exp','then','data3'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x393d,0x143));var _0xd393=function(_0x1e9488,_0x14268e){_0x1e9488=_0x1e9488-0x0;var _0x348fd1=_0x393d[_0x1e9488];return _0x348fd1;};'use strict';var _=require('lodash');var crypto=require(_0xd393('0x0'));var jwt=require(_0xd393('0x1'));var moment=require(_0xd393('0x2'));var Redis=require('ioredis');var rp=require(_0xd393('0x3'));var util=require(_0xd393('0x4'));var encryptor=require('../../components/encryptor');var config=require(_0xd393('0x5'));var logger=require(_0xd393('0x6'))('api');var schedule=require(_0xd393('0x7'));var db=require(_0xd393('0x8'))['db'];config[_0xd393('0x9')]=_[_0xd393('0xa')](config[_0xd393('0x9')],{'host':_0xd393('0xb'),'port':0x18eb});var redis=new Redis(config[_0xd393('0x9')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0xd393('0xc'),_0xd393('0xd'),_0xd393('0xe'),_0xd393('0xf'),_0xd393('0x10'),'https://outlook.office.com/POP.AccessAsUser.All',_0xd393('0x11')],'Dynamics365':[_0xd393('0xc'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0xf519e5){var _0x46ff1c=_[_0xd393('0x12')](AZURE_AUTH_SCOPES[_0xf519e5[_0xd393('0x13')]]);if(_0xf519e5[_0xd393('0x13')]==='Dynamics365')_0x46ff1c[_0xd393('0x14')](_0xf519e5[_0xd393('0x15')]+'/.default');return _0x46ff1c['join']('\x20');}function getAccessTokenScope(_0x568b4d){if(_0x568b4d[_0xd393('0x13')]===_0xd393('0x16'))return _0xd393('0x10');if(_0x568b4d['type']===_0xd393('0x17'))return _0x568b4d[_0xd393('0x15')]+_0xd393('0x18');}function generateMicrosoftAuthorizationUrl(_0x4716d0,_0x491d9f){var _0x48668e=MICROSOFT_AUTH_URL[_0xd393('0x19')](_0xd393('0x1a'),_0x4716d0[_0xd393('0x1b')]);var _0x6d594d=[_0xd393('0x1c'),'id_token'];var _0x521029=Buffer[_0xd393('0x1d')](JSON[_0xd393('0x1e')]({'id':_0x491d9f}))['toString'](_0xd393('0x1f'));var _0x3b7e0e=crypto[_0xd393('0x20')](0x10)[_0xd393('0x21')](_0xd393('0x22'));var _0x42f029=getAuthorizationScopes(_0x4716d0);var _0x28bb30=[{'key':'client_id','value':_0x4716d0[_0xd393('0x23')]},{'key':_0xd393('0x24'),'value':encodeURIComponent(_0x6d594d[_0xd393('0x25')]('\x20'))},{'key':_0xd393('0x26'),'value':_0x4716d0[_0xd393('0x27')]},{'key':'response_mode','value':_0xd393('0x28')},{'key':'scope','value':encodeURIComponent(_0x42f029)},{'key':_0xd393('0x29'),'value':_0x521029},{'key':_0xd393('0x2a'),'value':_0x3b7e0e},{'key':_0xd393('0x2b'),'value':'login'}];var _0xd660c4=_0x48668e+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xd393('0x12')](_0x28bb30,function(_0x4598e1){return _0x4598e1[_0xd393('0x2c')]+'='+_0x4598e1[_0xd393('0x2d')];})['join']('&');_0x4716d0['oauth2Claims']={'issuer':_0x48668e[_0xd393('0x19')](_0xd393('0x2e'),''),'audience':_0x4716d0[_0xd393('0x23')],'state':_0x521029,'nonce':_0x3b7e0e};redis[_0xd393('0x2f')](_0x521029,JSON[_0xd393('0x1e')](_0x4716d0));return _0xd660c4;}function isValidIdToken(_0x52cd31,_0x3f7230){try{var _0x146efe=jwt[_0xd393('0x30')](_0x52cd31,{'complete':!![]});var _0x2e7a93=_0x146efe[_0xd393('0x31')];if(_0x2e7a93[_0xd393('0x32')]!==_0x3f7230['issuer'])return![];if(_0x2e7a93[_0xd393('0x33')]!==_0x3f7230[_0xd393('0x34')])return![];if(_0x2e7a93[_0xd393('0x2a')]!==_0x3f7230[_0xd393('0x2a')])return![];if(moment()[_0xd393('0x35')](moment['unix'](_0x2e7a93[_0xd393('0x36')])))return![];return!![];}catch(_0x335161){throw _0x335161;}}function refreshOauth2MicrosoftAccessToken(_0x4444e6){return Promise['resolve']()[_0xd393('0x37')](function(){if(_0x4444e6[_0xd393('0x38')])return _0x4444e6;return db[_0xd393('0x39')][_0xd393('0x3a')]({'where':{'id':_0x4444e6['id']},'raw':!![]});})[_0xd393('0x37')](function(_0x28ef3a){var _0x397e9a={'grant_type':_0xd393('0x3b'),'refresh_token':_0x28ef3a[_0xd393('0x3c')],'scope':getAccessTokenScope(_0x28ef3a),'redirect_uri':_0x28ef3a[_0xd393('0x27')],'client_id':_0x28ef3a[_0xd393('0x23')],'client_secret':encryptor[_0xd393('0x3d')](_0x28ef3a[_0xd393('0x38')])};var _0x3322a8={'method':_0xd393('0x3e'),'uri':MICROSOFT_AUTH_URL['replace'](_0xd393('0x1a'),_0x28ef3a[_0xd393('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x397e9a,'json':!![]};return rp(_0x3322a8);})[_0xd393('0x37')](function(_0xcc3e54){_0x4444e6[_0xd393('0x3f')]=_0xcc3e54[_0xd393('0x40')];_0x4444e6['data6']=_0xcc3e54[_0xd393('0x3b')];return db[_0xd393('0x39')][_0xd393('0x41')]({'data5':_0x4444e6['data5'],'data6':_0x4444e6[_0xd393('0x3c')]},{'where':{'id':_0x4444e6['id']}});})[_0xd393('0x37')](function(){return _0x4444e6;})[_0xd393('0x42')](function(_0x3e30cc){logger[_0xd393('0x43')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x4444e6['id'],_0x3e30cc);});}function getOauth2MicrosoftAccessToken(_0x5c02c2,_0x279ce4){var _0x53d8e9={'grant_type':_0xd393('0x44'),'code':_0x5c02c2,'scope':getAccessTokenScope(_0x279ce4),'redirect_uri':_0x279ce4[_0xd393('0x27')],'client_id':_0x279ce4['data1'],'client_secret':encryptor[_0xd393('0x3d')](_0x279ce4[_0xd393('0x38')])};var _0x471714={'method':_0xd393('0x3e'),'uri':MICROSOFT_AUTH_URL[_0xd393('0x19')](_0xd393('0x1a'),_0x279ce4['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x53d8e9,'json':!![]};return rp(_0x471714);}function startRefreshInterval(_0x19bfe9){var _0x4ec05e=schedule[_0xd393('0x45')];if(_0x4ec05e[_0x19bfe9['id']])clearInterval(_0x4ec05e[_0x19bfe9['id']]);_0x4ec05e[_0x19bfe9['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xd393('0x46')](this,{'id':_0x19bfe9['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x4ec05e;}function startAllRefreshIntervals(){return db[_0xd393('0x39')][_0xd393('0x47')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xd393('0x37')](function(_0x1c2e6d){var _0x4a02f2=_0x1c2e6d[_0xd393('0x12')](function(_0x3c5c99){return refreshOauth2MicrosoftAccessToken(_0x3c5c99)['then'](function(_0x5565fb){startRefreshInterval(_0x5565fb);});});return Promise[_0xd393('0x48')](_0x4a02f2);})[_0xd393('0x42')](function(_0x3a4e62){var _0xb1c62d=_0x3a4e62?util[_0xd393('0x49')](_0x3a4e62,{'showHidden':![],'depth':null}):'';logger['error'](_0xd393('0x4a'),_0xb1c62d);});}module[_0xd393('0x4b')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xba9e=['response_mode','form_post','scope','nonce','prompt','login','map','key','value','oauth2/','set','decode','payload','iss','issuer','audience','isAfter','unix','exp','resolve','data3','CloudProvider','refresh_token','data6','decryptString','POST','data5','access_token','update','then','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','intervals','bind','findAll','all','catch','lodash','crypto','jsonwebtoken','moment','ioredis','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/token','type','Dynamics365','data7','/.default','join','Outlook365','replace','{TENANT_ID}','data2','stringify','base64','randomBytes','toString','hex','data1','response_type','redirect_uri','data4'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xba9e,0x72));var _0xeba9=function(_0x1e168a,_0x3d8f0a){_0x1e168a=_0x1e168a-0x0;var _0x35885a=_0xba9e[_0x1e168a];return _0x35885a;};'use strict';var _=require(_0xeba9('0x0'));var crypto=require(_0xeba9('0x1'));var jwt=require(_0xeba9('0x2'));var moment=require(_0xeba9('0x3'));var Redis=require(_0xeba9('0x4'));var rp=require('request-promise');var util=require('util');var encryptor=require(_0xeba9('0x5'));var config=require(_0xeba9('0x6'));var logger=require(_0xeba9('0x7'))(_0xeba9('0x8'));var schedule=require(_0xeba9('0x9'));var db=require(_0xeba9('0xa'))['db'];config[_0xeba9('0xb')]=_['defaults'](config[_0xeba9('0xb')],{'host':_0xeba9('0xc'),'port':0x18eb});var redis=new Redis(config[_0xeba9('0xb')]);var MICROSOFT_AUTH_URL=_0xeba9('0xd');var AZURE_AUTH_SCOPES={'Outlook365':[_0xeba9('0xe'),_0xeba9('0xf'),_0xeba9('0x10'),_0xeba9('0x11'),_0xeba9('0x12'),_0xeba9('0x13'),_0xeba9('0x14')],'Dynamics365':['openid','offline_access']};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0xeba9('0x15');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x60e1f1){var _0x29629a=_['map'](AZURE_AUTH_SCOPES[_0x60e1f1[_0xeba9('0x16')]]);if(_0x60e1f1[_0xeba9('0x16')]===_0xeba9('0x17'))_0x29629a['push'](_0x60e1f1[_0xeba9('0x18')]+_0xeba9('0x19'));return _0x29629a[_0xeba9('0x1a')]('\x20');}function getAccessTokenScope(_0x384379){if(_0x384379[_0xeba9('0x16')]===_0xeba9('0x1b'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x384379[_0xeba9('0x16')]==='Dynamics365')return _0x384379[_0xeba9('0x18')]+_0xeba9('0x19');}function generateMicrosoftAuthorizationUrl(_0x2b9817,_0x2c587b){var _0x4b869f=MICROSOFT_AUTH_URL[_0xeba9('0x1c')](_0xeba9('0x1d'),_0x2b9817[_0xeba9('0x1e')]);var _0x24a061=['code','id_token'];var _0x15792b=Buffer['from'](JSON[_0xeba9('0x1f')]({'id':_0x2c587b}))['toString'](_0xeba9('0x20'));var _0x353ce8=crypto[_0xeba9('0x21')](0x10)[_0xeba9('0x22')](_0xeba9('0x23'));var _0x3936a7=getAuthorizationScopes(_0x2b9817);var _0x581953=[{'key':'client_id','value':_0x2b9817[_0xeba9('0x24')]},{'key':_0xeba9('0x25'),'value':encodeURIComponent(_0x24a061['join']('\x20'))},{'key':_0xeba9('0x26'),'value':_0x2b9817[_0xeba9('0x27')]},{'key':_0xeba9('0x28'),'value':_0xeba9('0x29')},{'key':_0xeba9('0x2a'),'value':encodeURIComponent(_0x3936a7)},{'key':'state','value':_0x15792b},{'key':_0xeba9('0x2b'),'value':_0x353ce8},{'key':_0xeba9('0x2c'),'value':_0xeba9('0x2d')}];var _0x2f4561=_0x4b869f+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xeba9('0x2e')](_0x581953,function(_0x2e7724){return _0x2e7724[_0xeba9('0x2f')]+'='+_0x2e7724[_0xeba9('0x30')];})[_0xeba9('0x1a')]('&');_0x2b9817['oauth2Claims']={'issuer':_0x4b869f[_0xeba9('0x1c')](_0xeba9('0x31'),''),'audience':_0x2b9817[_0xeba9('0x24')],'state':_0x15792b,'nonce':_0x353ce8};redis[_0xeba9('0x32')](_0x15792b,JSON[_0xeba9('0x1f')](_0x2b9817));return _0x2f4561;}function isValidIdToken(_0x4e43e9,_0x58d797){try{var _0x5a1982=jwt[_0xeba9('0x33')](_0x4e43e9,{'complete':!![]});var _0x1c99b1=_0x5a1982[_0xeba9('0x34')];if(_0x1c99b1[_0xeba9('0x35')]!==_0x58d797[_0xeba9('0x36')])return![];if(_0x1c99b1['aud']!==_0x58d797[_0xeba9('0x37')])return![];if(_0x1c99b1[_0xeba9('0x2b')]!==_0x58d797[_0xeba9('0x2b')])return![];if(moment()[_0xeba9('0x38')](moment[_0xeba9('0x39')](_0x1c99b1[_0xeba9('0x3a')])))return![];return!![];}catch(_0x2a0d06){throw _0x2a0d06;}}function refreshOauth2MicrosoftAccessToken(_0x53b4f8){return Promise[_0xeba9('0x3b')]()['then'](function(){if(_0x53b4f8[_0xeba9('0x3c')])return _0x53b4f8;return db[_0xeba9('0x3d')]['findOne']({'where':{'id':_0x53b4f8['id']},'raw':!![]});})['then'](function(_0x36029e){var _0x5e7229={'grant_type':_0xeba9('0x3e'),'refresh_token':_0x36029e[_0xeba9('0x3f')],'scope':getAccessTokenScope(_0x36029e),'redirect_uri':_0x36029e[_0xeba9('0x27')],'client_id':_0x36029e[_0xeba9('0x24')],'client_secret':encryptor[_0xeba9('0x40')](_0x36029e[_0xeba9('0x3c')])};var _0x3d62ce={'method':_0xeba9('0x41'),'uri':MICROSOFT_AUTH_URL[_0xeba9('0x1c')]('{TENANT_ID}',_0x36029e['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5e7229,'json':!![]};return rp(_0x3d62ce);})['then'](function(_0x17d08f){_0x53b4f8[_0xeba9('0x42')]=_0x17d08f[_0xeba9('0x43')];_0x53b4f8[_0xeba9('0x3f')]=_0x17d08f[_0xeba9('0x3e')];return db[_0xeba9('0x3d')][_0xeba9('0x44')]({'data5':_0x53b4f8[_0xeba9('0x42')],'data6':_0x53b4f8[_0xeba9('0x3f')]},{'where':{'id':_0x53b4f8['id']}});})[_0xeba9('0x45')](function(){return _0x53b4f8;})['catch'](function(_0x545fc5){logger[_0xeba9('0x46')](_0xeba9('0x47'),_0x53b4f8['id'],_0x545fc5);});}function getOauth2MicrosoftAccessToken(_0x45e8e3,_0x256fba){var _0x493ee4={'grant_type':'authorization_code','code':_0x45e8e3,'scope':getAccessTokenScope(_0x256fba),'redirect_uri':_0x256fba[_0xeba9('0x27')],'client_id':_0x256fba[_0xeba9('0x24')],'client_secret':encryptor['decryptString'](_0x256fba[_0xeba9('0x3c')])};var _0x10cfa1={'method':_0xeba9('0x41'),'uri':MICROSOFT_AUTH_URL[_0xeba9('0x1c')](_0xeba9('0x1d'),_0x256fba[_0xeba9('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x493ee4,'json':!![]};return rp(_0x10cfa1);}function startRefreshInterval(_0x4e4eb4){var _0x33869a=schedule[_0xeba9('0x48')];if(_0x33869a[_0x4e4eb4['id']])clearInterval(_0x33869a[_0x4e4eb4['id']]);_0x33869a[_0x4e4eb4['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xeba9('0x49')](this,{'id':_0x4e4eb4['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xeba9('0x48')]=_0x33869a;}function startAllRefreshIntervals(){return db[_0xeba9('0x3d')][_0xeba9('0x4a')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xeba9('0x45')](function(_0x36d4d2){var _0x309017=_0x36d4d2[_0xeba9('0x2e')](function(_0x4df5f8){return refreshOauth2MicrosoftAccessToken(_0x4df5f8)[_0xeba9('0x45')](function(_0x53e58a){startRefreshInterval(_0x53e58a);});});return Promise[_0xeba9('0x4b')](_0x309017);})[_0xeba9('0x4c')](function(_0x409b32){var _0x62d861=_0x409b32?util['inspect'](_0x409b32,{'showHidden':![],'depth':null}):'';logger['error']('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x62d861);});}module['exports']={'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 b9a3120..5dbaadc 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 _0x2eba=['moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','util'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x2eba,0xc7));var _0xa2eb=function(_0x4c2397,_0x4e7548){_0x4c2397=_0x4c2397-0x0;var _0x51215c=_0x2eba[_0x4c2397];return _0x51215c;};'use strict';var _=require('lodash');var util=require(_0xa2eb('0x0'));var moment=require(_0xa2eb('0x1'));var BPromise=require(_0xa2eb('0x2'));var rs=require(_0xa2eb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa2eb('0x4'));var logger=require('../../config/logger')(_0xa2eb('0x5'));var config=require(_0xa2eb('0x6'));var jayson=require(_0xa2eb('0x7'));var client=jayson[_0xa2eb('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x545db3,_0x56b33a,_0x4ed534){return new BPromise(function(_0x550a3c,_0x56408f){return client[_0xa2eb('0x9')](_0x545db3,_0x4ed534)[_0xa2eb('0xa')](function(_0x5480a1){logger['info'](_0xa2eb('0xb'),_0x56b33a,_0xa2eb('0xc'));logger[_0xa2eb('0xd')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x56b33a,_0xa2eb('0xc'),JSON[_0xa2eb('0xe')](_0x5480a1));if(_0x5480a1['error']){if(_0x5480a1[_0xa2eb('0xf')]['code']===0x1f4){logger[_0xa2eb('0xf')](_0xa2eb('0xb'),_0x56b33a,_0x5480a1[_0xa2eb('0xf')][_0xa2eb('0x10')]);return _0x56408f(_0x5480a1[_0xa2eb('0xf')][_0xa2eb('0x10')]);}logger['error'](_0xa2eb('0xb'),_0x56b33a,_0x5480a1[_0xa2eb('0xf')][_0xa2eb('0x10')]);return _0x550a3c(_0x5480a1[_0xa2eb('0xf')][_0xa2eb('0x10')]);}else{logger[_0xa2eb('0x11')](_0xa2eb('0xb'),_0x56b33a,_0xa2eb('0xc'));_0x550a3c(_0x5480a1[_0xa2eb('0x12')][_0xa2eb('0x10')]);}})[_0xa2eb('0x13')](function(_0x3a02d5){logger['error']('CloudProvider,\x20%s,\x20%s',_0x56b33a,_0x3a02d5);_0x56408f(_0x3a02d5);});});} \ No newline at end of file +var _0x4137=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','CloudProvider,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring'];(function(_0x40911a,_0x55ec99){var _0x27e8e3=function(_0x2ba910){while(--_0x2ba910){_0x40911a['push'](_0x40911a['shift']());}};_0x27e8e3(++_0x55ec99);}(_0x4137,0xf8));var _0x7413=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x4137[_0x1cc8fe];return _0x230054;};'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')]('CloudProvider,\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 diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 1c31792..3319f06 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 _0xadb5=['put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','Router','./cloudProvider.controller','get','isAuthenticated','/:id','post','create'];(function(_0x45e77e,_0x4e22c1){var _0x38d49e=function(_0x14bf69){while(--_0x14bf69){_0x45e77e['push'](_0x45e77e['shift']());}};_0x38d49e(++_0x4e22c1);}(_0xadb5,0xad));var _0x5adb=function(_0x5631f1,_0x1d2a67){_0x5631f1=_0x5631f1-0x0;var _0x108d8c=_0xadb5[_0x5631f1];return _0x108d8c;};'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 +var _0x5f66=['index','post','/:id','update','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','Router','./cloudProvider.controller','get','isAuthenticated'];(function(_0x360696,_0x298aa2){var _0xe5fb3f=function(_0xbb7f43){while(--_0xbb7f43){_0x360696['push'](_0x360696['shift']());}};_0xe5fb3f(++_0x298aa2);}(_0x5f66,0x1a0));var _0x65f6=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5f66[_0x126558];return _0x1f6d14;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);router[_0x65f6('0x2')]('/:id',auth[_0x65f6('0x3')](),controller['show']);router[_0x65f6('0x5')]('/',auth[_0x65f6('0x3')](),controller['create']);router['put'](_0x65f6('0x6'),auth[_0x65f6('0x3')](),controller[_0x65f6('0x7')]);router[_0x65f6('0x8')](_0x65f6('0x6'),auth[_0x65f6('0x3')](),controller['destroy']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x3')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x5')]('/oauth2/microsoft/callback',controller[_0x65f6('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 5a3e4b3..4b2d1e2 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 _0x1dd4=['STRING','name'];(function(_0x3e6d78,_0x376a00){var _0x2edff9=function(_0x359712){while(--_0x359712){_0x3e6d78['push'](_0x3e6d78['shift']());}};_0x2edff9(++_0x376a00);}(_0x1dd4,0x1a9));var _0x41dd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1dd4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x41dd('0x0'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x41dd('0x1')]},'companyId':{'type':Sequelize[_0x41dd('0x1')]},'website':{'type':Sequelize[_0x41dd('0x1')]},'phone':{'type':Sequelize[_0x41dd('0x1')]},'fax':{'type':Sequelize[_0x41dd('0x1')]},'type':{'type':Sequelize[_0x41dd('0x1')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x41dd('0x1')]},'city':{'type':Sequelize[_0x41dd('0x1')]},'country':{'type':Sequelize[_0x41dd('0x1')]},'email':{'type':Sequelize[_0x41dd('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x41dd('0x1')]},'sStreet':{'type':Sequelize[_0x41dd('0x1')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x41dd('0x1')]},'sCountry':{'type':Sequelize[_0x41dd('0x1')]},'description':{'type':Sequelize[_0x41dd('0x1')]}}; \ No newline at end of file +var _0x4a78=['sequelize','exports','STRING','name'];(function(_0x249e96,_0x3ea39d){var _0x17444c=function(_0x1221d0){while(--_0x1221d0){_0x249e96['push'](_0x249e96['shift']());}};_0x17444c(++_0x3ea39d);}(_0x4a78,0x18c));var _0x84a7=function(_0x22c149,_0x348d3d){_0x22c149=_0x22c149-0x0;var _0x247747=_0x4a78[_0x22c149];return _0x247747;};'use strict';var Sequelize=require(_0x84a7('0x0'));module[_0x84a7('0x1')]={'name':{'type':Sequelize[_0x84a7('0x2')],'unique':_0x84a7('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x84a7('0x2')]},'companyId':{'type':Sequelize[_0x84a7('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x84a7('0x2')]},'fax':{'type':Sequelize[_0x84a7('0x2')]},'type':{'type':Sequelize[_0x84a7('0x2')]},'street':{'type':Sequelize[_0x84a7('0x2')]},'postalCode':{'type':Sequelize[_0x84a7('0x2')]},'city':{'type':Sequelize[_0x84a7('0x2')]},'country':{'type':Sequelize[_0x84a7('0x2')]},'email':{'type':Sequelize[_0x84a7('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x84a7('0x2')]},'sStreet':{'type':Sequelize[_0x84a7('0x2')]},'sPostalCode':{'type':Sequelize[_0x84a7('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x84a7('0x2')]},'description':{'type':Sequelize[_0x84a7('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index f69f026..a68beea 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 _0x2762=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','destroy','Companies','UserProfileResource','end','error','stack','name','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','merge','filter','include','rows','catch','show','params','rawAttributes','length','includeAll','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addContacts','ids','omit','getContacts','findOne','pick','map','hasOwnProperty','zip-dir','fast-json-patch'];(function(_0x4b93e6,_0x440101){var _0x2cc7e6=function(_0x22398d){while(--_0x22398d){_0x4b93e6['push'](_0x4b93e6['shift']());}};_0x2cc7e6(++_0x440101);}(_0x2762,0xae));var _0x2276=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2762[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2276('0x0'));var jsonpatch=require(_0x2276('0x1'));var rp=require(_0x2276('0x2'));var moment=require(_0x2276('0x3'));var BPromise=require(_0x2276('0x4'));var Mustache=require(_0x2276('0x5'));var util=require(_0x2276('0x6'));var path=require(_0x2276('0x7'));var sox=require(_0x2276('0x8'));var csv=require(_0x2276('0x9'));var ejs=require(_0x2276('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2276('0xb'));var squel=require('squel');var crypto=require(_0x2276('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2276('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2276('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2276('0xf'));var qs=require(_0x2276('0x10'));var as=require(_0x2276('0x11'));var hardwareService=require(_0x2276('0x12'));var logger=require(_0x2276('0x13'))(_0x2276('0x14'));var utils=require(_0x2276('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2276('0x16'));var db=require(_0x2276('0x17'))['db'];function respondWithStatusCode(_0x5fa646,_0x42f335){_0x42f335=_0x42f335||0xcc;return function(_0x45e31d){if(_0x45e31d){return _0x5fa646[_0x2276('0x18')](_0x42f335);}return _0x5fa646[_0x2276('0x19')](_0x42f335)['end']();};}function respondWithResult(_0x57c413,_0x40465b){_0x40465b=_0x40465b||0xc8;return function(_0x5a1129){if(_0x5a1129){return _0x57c413[_0x2276('0x19')](_0x40465b)[_0x2276('0x1a')](_0x5a1129);}};}function respondWithFilteredResult(_0x37c603,_0x1da8a7){return function(_0x36ad4c){if(_0x36ad4c){var _0x347950=typeof _0x1da8a7[_0x2276('0x1b')]===_0x2276('0x1c')&&typeof _0x1da8a7['limit']==='undefined';var _0x57c689=_0x36ad4c['count'];var _0xfedfcd=_0x347950?0x0:_0x1da8a7['offset'];var _0x170772=_0x347950?_0x36ad4c[_0x2276('0x1d')]:_0x1da8a7['offset']+_0x1da8a7[_0x2276('0x1e')];var _0x74b0af;if(_0x170772>=_0x57c689){_0x170772=_0x57c689;_0x74b0af=0xc8;}else{_0x74b0af=0xce;}_0x37c603[_0x2276('0x19')](_0x74b0af);return _0x37c603[_0x2276('0x1f')](_0x2276('0x20'),_0xfedfcd+'-'+_0x170772+'/'+_0x57c689)[_0x2276('0x1a')](_0x36ad4c);}return null;};}function patchUpdates(_0x1f77d7){return function(_0x4697f3){try{jsonpatch['apply'](_0x4697f3,_0x1f77d7,!![]);}catch(_0x1ba575){return BPromise[_0x2276('0x21')](_0x1ba575);}return _0x4697f3[_0x2276('0x22')]();};}function saveUpdates(_0x2d7391,_0x31249c){return function(_0x8b0e89){if(_0x8b0e89){return _0x8b0e89['update'](_0x2d7391)[_0x2276('0x23')](function(_0x59fb47){return _0x59fb47;});}return null;};}function removeEntity(_0x384365,_0x26ecf5){return function(_0x4bd2df){if(_0x4bd2df){return _0x4bd2df[_0x2276('0x24')]()[_0x2276('0x23')](function(){var _0x1bc58c=_0x4bd2df['get']({'plain':!![]});var _0x52f9c8=_0x2276('0x25');return db[_0x2276('0x26')]['destroy']({'where':{'type':_0x52f9c8,'resourceId':_0x1bc58c['id']}})[_0x2276('0x23')](function(){return _0x4bd2df;});})[_0x2276('0x23')](function(){_0x384365[_0x2276('0x19')](0xcc)[_0x2276('0x27')]();});}};}function handleEntityNotFound(_0x55f335,_0x18436c){return function(_0x21298a){if(!_0x21298a){_0x55f335[_0x2276('0x18')](0x194);}return _0x21298a;};}function handleError(_0xa5b26e,_0x267fbe){_0x267fbe=_0x267fbe||0x1f4;return function(_0x14bad4){logger[_0x2276('0x28')](_0x14bad4[_0x2276('0x29')]);if(_0x14bad4[_0x2276('0x2a')]){delete _0x14bad4[_0x2276('0x2a')];}_0xa5b26e[_0x2276('0x19')](_0x267fbe)['send'](_0x14bad4);};}exports[_0x2276('0x2b')]=function(_0x595612,_0x38dd45){var _0x5ba7c1={},_0x18442e={},_0x2f7910={'count':0x0,'rows':[]};return db[_0x2276('0x2c')][_0x2276('0x2d')]()['then'](function(_0x590cb9){_0x18442e[_0x2276('0x2e')]=_[_0x2276('0x2f')](_0x590cb9);_0x18442e['query']=_['keys'](_0x595612[_0x2276('0x30')]);_0x18442e[_0x2276('0x31')]=_[_0x2276('0x32')](_0x18442e[_0x2276('0x2e')],_0x18442e[_0x2276('0x30')]);_0x5ba7c1[_0x2276('0x33')]=_[_0x2276('0x32')](_0x18442e[_0x2276('0x2e')],qs[_0x2276('0x34')](_0x595612['query'][_0x2276('0x34')]));_0x5ba7c1[_0x2276('0x33')]=_0x5ba7c1[_0x2276('0x33')]['length']?_0x5ba7c1[_0x2276('0x33')]:_0x18442e[_0x2276('0x2e')];if(!_0x595612['query']['hasOwnProperty'](_0x2276('0x35'))){_0x5ba7c1[_0x2276('0x1e')]=qs[_0x2276('0x1e')](_0x595612[_0x2276('0x30')][_0x2276('0x1e')]);_0x5ba7c1[_0x2276('0x1b')]=qs[_0x2276('0x1b')](_0x595612[_0x2276('0x30')]['offset']);}_0x5ba7c1[_0x2276('0x36')]=qs[_0x2276('0x37')](_0x595612['query']['sort']);_0x5ba7c1[_0x2276('0x38')]=qs['filters'](_['pick'](_0x595612[_0x2276('0x30')],_0x18442e[_0x2276('0x31')]),_0x590cb9);if(_0x595612[_0x2276('0x30')]['filter']){_0x5ba7c1['where']=_[_0x2276('0x39')](_0x5ba7c1[_0x2276('0x38')],{'$or':_['map'](_0x5ba7c1[_0x2276('0x33')],function(_0x54b4ce){var _0x1b2ccd={};_0x1b2ccd[_0x54b4ce]={'$like':'%'+_0x595612[_0x2276('0x30')][_0x2276('0x3a')]+'%'};return _0x1b2ccd;})});}_0x5ba7c1=_[_0x2276('0x39')]({},_0x5ba7c1,_0x595612['options']);var _0x53b0bf={'where':_0x5ba7c1[_0x2276('0x38')]};return db[_0x2276('0x2c')]['count'](_0x53b0bf)[_0x2276('0x23')](function(_0x4fabfd){_0x2f7910[_0x2276('0x1d')]=_0x4fabfd;if(_0x595612[_0x2276('0x30')]['includeAll']){_0x5ba7c1[_0x2276('0x3b')]=[{'all':!![]}];}return db[_0x2276('0x2c')]['findAll'](_0x5ba7c1);})[_0x2276('0x23')](function(_0xf04402){_0x2f7910[_0x2276('0x3c')]=_0xf04402;return _0x2f7910;})[_0x2276('0x23')](respondWithFilteredResult(_0x38dd45,_0x5ba7c1))[_0x2276('0x3d')](handleError(_0x38dd45,null));})['catch'](handleError(_0x38dd45,null));};exports[_0x2276('0x3e')]=function(_0x23a589,_0x5915e6){var _0x2ae741={'raw':![],'where':{'id':_0x23a589[_0x2276('0x3f')]['id']}},_0x265248={};_0x265248[_0x2276('0x2e')]=_[_0x2276('0x2f')](db['CmCompany'][_0x2276('0x40')]);_0x265248[_0x2276('0x30')]=_[_0x2276('0x2f')](_0x23a589[_0x2276('0x30')]);_0x265248['filters']=_[_0x2276('0x32')](_0x265248['model'],_0x265248[_0x2276('0x30')]);_0x2ae741[_0x2276('0x33')]=_[_0x2276('0x32')](_0x265248[_0x2276('0x2e')],qs['fields'](_0x23a589[_0x2276('0x30')][_0x2276('0x34')]));_0x2ae741[_0x2276('0x33')]=_0x2ae741[_0x2276('0x33')][_0x2276('0x41')]?_0x2ae741[_0x2276('0x33')]:_0x265248['model'];if(_0x23a589['query'][_0x2276('0x42')]){_0x2ae741[_0x2276('0x3b')]=[{'all':!![]}];}_0x2ae741=_[_0x2276('0x39')]({},_0x2ae741,_0x23a589[_0x2276('0x43')]);return db[_0x2276('0x2c')][_0x2276('0x44')](_0x2ae741)[_0x2276('0x23')](handleEntityNotFound(_0x5915e6,null))[_0x2276('0x23')](respondWithResult(_0x5915e6,null))[_0x2276('0x3d')](handleError(_0x5915e6,null));};exports['create']=function(_0xbc91fd,_0x480e9f){return db[_0x2276('0x2c')][_0x2276('0x45')](_0xbc91fd[_0x2276('0x46')],{})[_0x2276('0x23')](function(_0x194434){var _0x4d09bc=_0xbc91fd[_0x2276('0x47')][_0x2276('0x48')]({'plain':!![]});if(!_0x4d09bc)throw new Error(_0x2276('0x49'));if(_0x4d09bc[_0x2276('0x4a')]==='user'){var _0x1c0c6d=_0x194434[_0x2276('0x48')]({'plain':!![]});var _0x1f0a12=_0x2276('0x25');return db[_0x2276('0x4b')][_0x2276('0x44')]({'where':{'name':_0x1f0a12,'userProfileId':_0x4d09bc[_0x2276('0x4c')]},'raw':!![]})[_0x2276('0x23')](function(_0x5a5919){if(_0x5a5919&&_0x5a5919[_0x2276('0x4d')]===0x0){return db[_0x2276('0x26')]['create']({'name':_0x1c0c6d[_0x2276('0x2a')],'resourceId':_0x1c0c6d['id'],'type':_0x5a5919[_0x2276('0x2a')],'sectionId':_0x5a5919['id']},{})['then'](function(){return _0x194434;});}else{return _0x194434;}})[_0x2276('0x3d')](function(_0xb0de38){logger['error'](_0x2276('0x4e'),_0xb0de38);throw _0xb0de38;});}return _0x194434;})['then'](respondWithResult(_0x480e9f,0xc9))[_0x2276('0x3d')](handleError(_0x480e9f,null));};exports[_0x2276('0x4f')]=function(_0x1239ae,_0x5bf3c1){if(_0x1239ae[_0x2276('0x46')]['id']){delete _0x1239ae[_0x2276('0x46')]['id'];}return db[_0x2276('0x2c')][_0x2276('0x44')]({'where':{'id':_0x1239ae[_0x2276('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5bf3c1,null))[_0x2276('0x23')](saveUpdates(_0x1239ae[_0x2276('0x46')],null))[_0x2276('0x23')](respondWithResult(_0x5bf3c1,null))[_0x2276('0x3d')](handleError(_0x5bf3c1,null));};exports[_0x2276('0x24')]=function(_0x3062c7,_0x1143c5){return db[_0x2276('0x2c')]['find']({'where':{'id':_0x3062c7[_0x2276('0x3f')]['id']}})[_0x2276('0x23')](handleEntityNotFound(_0x1143c5,null))[_0x2276('0x23')](removeEntity(_0x1143c5,null))[_0x2276('0x3d')](handleError(_0x1143c5,null));};exports[_0x2276('0x2d')]=function(_0x5b2402,_0x53ad21){return db['CmCompany'][_0x2276('0x2d')]()[_0x2276('0x23')](respondWithResult(_0x53ad21,null))[_0x2276('0x3d')](handleError(_0x53ad21,null));};exports[_0x2276('0x50')]=function(_0x22eda4,_0x1859df,_0x35c0fb){return db['CmContact'][_0x2276('0x44')]({'where':{'id':_0x22eda4[_0x2276('0x3f')]['id']}})[_0x2276('0x23')](handleEntityNotFound(_0x1859df,null))[_0x2276('0x23')](function(_0xd9a48){if(_0xd9a48){return _0xd9a48[_0x2276('0x50')](_0x22eda4[_0x2276('0x46')][_0x2276('0x51')],_[_0x2276('0x52')](_0x22eda4['body'],[_0x2276('0x51'),'id'])||{});}})[_0x2276('0x23')](respondWithResult(_0x1859df,null))[_0x2276('0x3d')](handleError(_0x1859df,null));};exports[_0x2276('0x53')]=function(_0x43a81c,_0x3989da,_0x69b477){var _0x14e6ee={};var _0x32d6a0={};var _0x5b1e0b;var _0x54ce7a;return db[_0x2276('0x2c')][_0x2276('0x54')]({'where':{'id':_0x43a81c[_0x2276('0x3f')]['id']}})[_0x2276('0x23')](handleEntityNotFound(_0x3989da,null))[_0x2276('0x23')](function(_0x307430){if(_0x307430){_0x5b1e0b=_0x307430;_0x32d6a0['model']=_[_0x2276('0x2f')](db['CmContact'][_0x2276('0x40')]);_0x32d6a0['query']=_['keys'](_0x43a81c[_0x2276('0x30')]);_0x32d6a0[_0x2276('0x31')]=_[_0x2276('0x32')](_0x32d6a0[_0x2276('0x2e')],_0x32d6a0[_0x2276('0x30')]);_0x14e6ee[_0x2276('0x33')]=_[_0x2276('0x32')](_0x32d6a0[_0x2276('0x2e')],qs[_0x2276('0x34')](_0x43a81c[_0x2276('0x30')]['fields']));_0x14e6ee[_0x2276('0x33')]=_0x14e6ee[_0x2276('0x33')][_0x2276('0x41')]?_0x14e6ee['attributes']:_0x32d6a0[_0x2276('0x2e')];_0x14e6ee[_0x2276('0x36')]=qs[_0x2276('0x37')](_0x43a81c['query'][_0x2276('0x37')]);_0x14e6ee[_0x2276('0x38')]=qs[_0x2276('0x31')](_[_0x2276('0x55')](_0x43a81c[_0x2276('0x30')],_0x32d6a0[_0x2276('0x31')]));if(_0x43a81c['query'][_0x2276('0x3a')]){_0x14e6ee['where']=_[_0x2276('0x39')](_0x14e6ee[_0x2276('0x38')],{'$or':_[_0x2276('0x56')](_0x14e6ee['attributes'],function(_0x2f0d89){var _0x4089b2={};_0x4089b2[_0x2f0d89]={'$like':'%'+_0x43a81c[_0x2276('0x30')][_0x2276('0x3a')]+'%'};return _0x4089b2;})});}_0x14e6ee=_['merge']({},_0x14e6ee,_0x43a81c[_0x2276('0x43')]);return _0x5b1e0b[_0x2276('0x53')](_0x14e6ee);}})['then'](function(_0x3fbe0c){if(_0x3fbe0c){_0x54ce7a=_0x3fbe0c[_0x2276('0x41')];if(!_0x43a81c[_0x2276('0x30')][_0x2276('0x57')](_0x2276('0x35'))){_0x14e6ee[_0x2276('0x1e')]=qs[_0x2276('0x1e')](_0x43a81c[_0x2276('0x30')][_0x2276('0x1e')]);_0x14e6ee[_0x2276('0x1b')]=qs['offset'](_0x43a81c[_0x2276('0x30')][_0x2276('0x1b')]);}return _0x5b1e0b[_0x2276('0x53')](_0x14e6ee);}})[_0x2276('0x23')](function(_0x546aa7){if(_0x546aa7){return _0x546aa7?{'count':_0x54ce7a,'rows':_0x546aa7}:null;}})[_0x2276('0x23')](respondWithResult(_0x3989da,null))['catch'](handleError(_0x3989da,null));}; \ No newline at end of file +var _0x688a=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','get','Companies','UserProfileResource','destroy','error','name','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','findAll','rows','catch','show','rawAttributes','length','includeAll','include','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','create','update','body','addContacts','params','ids','omit','getContacts','findOne','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce'];(function(_0x112e2a,_0x364486){var _0x4f8af9=function(_0xa11c0d){while(--_0xa11c0d){_0x112e2a['push'](_0x112e2a['shift']());}};_0x4f8af9(++_0x364486);}(_0x688a,0x156));var _0xa688=function(_0x42c6d7,_0x3632bc){_0x42c6d7=_0x42c6d7-0x0;var _0x122ec9=_0x688a[_0x42c6d7];return _0x122ec9;};'use strict';var emlformat=require(_0xa688('0x0'));var rimraf=require(_0xa688('0x1'));var zipdir=require(_0xa688('0x2'));var jsonpatch=require(_0xa688('0x3'));var rp=require('request-promise');var moment=require(_0xa688('0x4'));var BPromise=require(_0xa688('0x5'));var Mustache=require('mustache');var util=require(_0xa688('0x6'));var path=require(_0xa688('0x7'));var sox=require(_0xa688('0x8'));var csv=require(_0xa688('0x9'));var ejs=require(_0xa688('0xa'));var fs=require('fs');var fs_extra=require(_0xa688('0xb'));var _=require(_0xa688('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa688('0xd'));var deskjs=require(_0xa688('0xe'));var toCsv=require(_0xa688('0x9'));var querystring=require(_0xa688('0xf'));var Papa=require(_0xa688('0x10'));var Redis=require('ioredis');var authService=require(_0xa688('0x11'));var qs=require(_0xa688('0x12'));var as=require(_0xa688('0x13'));var hardwareService=require(_0xa688('0x14'));var logger=require(_0xa688('0x15'))(_0xa688('0x16'));var utils=require(_0xa688('0x17'));var config=require(_0xa688('0x18'));var licenseUtil=require(_0xa688('0x19'));var db=require(_0xa688('0x1a'))['db'];function respondWithStatusCode(_0x568a56,_0x51473f){_0x51473f=_0x51473f||0xcc;return function(_0x354834){if(_0x354834){return _0x568a56[_0xa688('0x1b')](_0x51473f);}return _0x568a56['status'](_0x51473f)[_0xa688('0x1c')]();};}function respondWithResult(_0x8fa265,_0x53270c){_0x53270c=_0x53270c||0xc8;return function(_0xce4d3a){if(_0xce4d3a){return _0x8fa265[_0xa688('0x1d')](_0x53270c)[_0xa688('0x1e')](_0xce4d3a);}};}function respondWithFilteredResult(_0x435caf,_0x2eba6f){return function(_0x33520b){if(_0x33520b){var _0x2ad99d=typeof _0x2eba6f['offset']===_0xa688('0x1f')&&typeof _0x2eba6f[_0xa688('0x20')]===_0xa688('0x1f');var _0x473115=_0x33520b[_0xa688('0x21')];var _0x9aced=_0x2ad99d?0x0:_0x2eba6f['offset'];var _0xcb94bc=_0x2ad99d?_0x33520b[_0xa688('0x21')]:_0x2eba6f[_0xa688('0x22')]+_0x2eba6f[_0xa688('0x20')];var _0x1f038a;if(_0xcb94bc>=_0x473115){_0xcb94bc=_0x473115;_0x1f038a=0xc8;}else{_0x1f038a=0xce;}_0x435caf[_0xa688('0x1d')](_0x1f038a);return _0x435caf[_0xa688('0x23')](_0xa688('0x24'),_0x9aced+'-'+_0xcb94bc+'/'+_0x473115)[_0xa688('0x1e')](_0x33520b);}return null;};}function patchUpdates(_0x3cfc39){return function(_0x4525e9){try{jsonpatch[_0xa688('0x25')](_0x4525e9,_0x3cfc39,!![]);}catch(_0x51d702){return BPromise[_0xa688('0x26')](_0x51d702);}return _0x4525e9[_0xa688('0x27')]();};}function saveUpdates(_0x358afc,_0x3a1050){return function(_0x428041){if(_0x428041){return _0x428041['update'](_0x358afc)[_0xa688('0x28')](function(_0x47c8d8){return _0x47c8d8;});}return null;};}function removeEntity(_0xe5b846,_0x2f33fe){return function(_0x125d5f){if(_0x125d5f){return _0x125d5f['destroy']()['then'](function(){var _0x1f3d6c=_0x125d5f[_0xa688('0x29')]({'plain':!![]});var _0x46b54c=_0xa688('0x2a');return db[_0xa688('0x2b')][_0xa688('0x2c')]({'where':{'type':_0x46b54c,'resourceId':_0x1f3d6c['id']}})[_0xa688('0x28')](function(){return _0x125d5f;});})['then'](function(){_0xe5b846[_0xa688('0x1d')](0xcc)[_0xa688('0x1c')]();});}};}function handleEntityNotFound(_0x28ff68,_0x5c8fd0){return function(_0x3787bd){if(!_0x3787bd){_0x28ff68[_0xa688('0x1b')](0x194);}return _0x3787bd;};}function handleError(_0x5a4710,_0x221033){_0x221033=_0x221033||0x1f4;return function(_0x10f80e){logger[_0xa688('0x2d')](_0x10f80e['stack']);if(_0x10f80e[_0xa688('0x2e')]){delete _0x10f80e[_0xa688('0x2e')];}_0x5a4710[_0xa688('0x1d')](_0x221033)['send'](_0x10f80e);};}exports[_0xa688('0x2f')]=function(_0xb5d238,_0x312661){var _0x1a949d={},_0x1947b1={},_0x55b130={'count':0x0,'rows':[]};return db[_0xa688('0x30')][_0xa688('0x31')]()[_0xa688('0x28')](function(_0x1939a1){_0x1947b1[_0xa688('0x32')]=_[_0xa688('0x33')](_0x1939a1);_0x1947b1['query']=_[_0xa688('0x33')](_0xb5d238[_0xa688('0x34')]);_0x1947b1[_0xa688('0x35')]=_[_0xa688('0x36')](_0x1947b1[_0xa688('0x32')],_0x1947b1[_0xa688('0x34')]);_0x1a949d[_0xa688('0x37')]=_[_0xa688('0x36')](_0x1947b1[_0xa688('0x32')],qs[_0xa688('0x38')](_0xb5d238[_0xa688('0x34')][_0xa688('0x38')]));_0x1a949d[_0xa688('0x37')]=_0x1a949d[_0xa688('0x37')]['length']?_0x1a949d[_0xa688('0x37')]:_0x1947b1[_0xa688('0x32')];if(!_0xb5d238['query'][_0xa688('0x39')](_0xa688('0x3a'))){_0x1a949d[_0xa688('0x20')]=qs['limit'](_0xb5d238[_0xa688('0x34')][_0xa688('0x20')]);_0x1a949d[_0xa688('0x22')]=qs[_0xa688('0x22')](_0xb5d238[_0xa688('0x34')]['offset']);}_0x1a949d[_0xa688('0x3b')]=qs[_0xa688('0x3c')](_0xb5d238[_0xa688('0x34')][_0xa688('0x3c')]);_0x1a949d[_0xa688('0x3d')]=qs[_0xa688('0x35')](_[_0xa688('0x3e')](_0xb5d238['query'],_0x1947b1[_0xa688('0x35')]),_0x1939a1);if(_0xb5d238[_0xa688('0x34')][_0xa688('0x3f')]){_0x1a949d[_0xa688('0x3d')]=_[_0xa688('0x40')](_0x1a949d[_0xa688('0x3d')],{'$or':_[_0xa688('0x41')](_0x1a949d[_0xa688('0x37')],function(_0x323fdb){var _0xd9e1d5={};_0xd9e1d5[_0x323fdb]={'$like':'%'+_0xb5d238[_0xa688('0x34')][_0xa688('0x3f')]+'%'};return _0xd9e1d5;})});}_0x1a949d=_[_0xa688('0x40')]({},_0x1a949d,_0xb5d238[_0xa688('0x42')]);var _0x5440a2={'where':_0x1a949d[_0xa688('0x3d')]};return db[_0xa688('0x30')]['count'](_0x5440a2)[_0xa688('0x28')](function(_0x354701){_0x55b130[_0xa688('0x21')]=_0x354701;if(_0xb5d238[_0xa688('0x34')]['includeAll']){_0x1a949d['include']=[{'all':!![]}];}return db[_0xa688('0x30')][_0xa688('0x43')](_0x1a949d);})[_0xa688('0x28')](function(_0x1282ab){_0x55b130[_0xa688('0x44')]=_0x1282ab;return _0x55b130;})[_0xa688('0x28')](respondWithFilteredResult(_0x312661,_0x1a949d))[_0xa688('0x45')](handleError(_0x312661,null));})[_0xa688('0x45')](handleError(_0x312661,null));};exports[_0xa688('0x46')]=function(_0x420d0f,_0x576127){var _0x30fddf={'raw':![],'where':{'id':_0x420d0f['params']['id']}},_0x5543f2={};_0x5543f2[_0xa688('0x32')]=_['keys'](db[_0xa688('0x30')][_0xa688('0x47')]);_0x5543f2[_0xa688('0x34')]=_[_0xa688('0x33')](_0x420d0f[_0xa688('0x34')]);_0x5543f2[_0xa688('0x35')]=_[_0xa688('0x36')](_0x5543f2[_0xa688('0x32')],_0x5543f2[_0xa688('0x34')]);_0x30fddf[_0xa688('0x37')]=_[_0xa688('0x36')](_0x5543f2[_0xa688('0x32')],qs['fields'](_0x420d0f['query'][_0xa688('0x38')]));_0x30fddf[_0xa688('0x37')]=_0x30fddf['attributes'][_0xa688('0x48')]?_0x30fddf[_0xa688('0x37')]:_0x5543f2[_0xa688('0x32')];if(_0x420d0f[_0xa688('0x34')][_0xa688('0x49')]){_0x30fddf[_0xa688('0x4a')]=[{'all':!![]}];}_0x30fddf=_[_0xa688('0x40')]({},_0x30fddf,_0x420d0f[_0xa688('0x42')]);return db[_0xa688('0x30')][_0xa688('0x4b')](_0x30fddf)[_0xa688('0x28')](handleEntityNotFound(_0x576127,null))['then'](respondWithResult(_0x576127,null))['catch'](handleError(_0x576127,null));};exports['create']=function(_0x46c416,_0x2c6f36){return db[_0xa688('0x30')]['create'](_0x46c416['body'],{})[_0xa688('0x28')](function(_0x15262d){var _0x4b9e22=_0x46c416[_0xa688('0x4c')][_0xa688('0x29')]({'plain':!![]});if(!_0x4b9e22)throw new Error(_0xa688('0x4d'));if(_0x4b9e22[_0xa688('0x4e')]===_0xa688('0x4c')){var _0x4f6633=_0x15262d[_0xa688('0x29')]({'plain':!![]});var _0x1da7d8='Companies';return db['UserProfileSection'][_0xa688('0x4b')]({'where':{'name':_0x1da7d8,'userProfileId':_0x4b9e22[_0xa688('0x4f')]},'raw':!![]})[_0xa688('0x28')](function(_0x2631a9){if(_0x2631a9&&_0x2631a9['autoAssociation']===0x0){return db[_0xa688('0x2b')][_0xa688('0x50')]({'name':_0x4f6633[_0xa688('0x2e')],'resourceId':_0x4f6633['id'],'type':_0x2631a9['name'],'sectionId':_0x2631a9['id']},{})[_0xa688('0x28')](function(){return _0x15262d;});}else{return _0x15262d;}})[_0xa688('0x45')](function(_0x5f5a9a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5f5a9a);throw _0x5f5a9a;});}return _0x15262d;})[_0xa688('0x28')](respondWithResult(_0x2c6f36,0xc9))[_0xa688('0x45')](handleError(_0x2c6f36,null));};exports[_0xa688('0x51')]=function(_0x4d24ec,_0x3912de){if(_0x4d24ec['body']['id']){delete _0x4d24ec[_0xa688('0x52')]['id'];}return db[_0xa688('0x30')][_0xa688('0x4b')]({'where':{'id':_0x4d24ec['params']['id']}})[_0xa688('0x28')](handleEntityNotFound(_0x3912de,null))[_0xa688('0x28')](saveUpdates(_0x4d24ec['body'],null))[_0xa688('0x28')](respondWithResult(_0x3912de,null))['catch'](handleError(_0x3912de,null));};exports[_0xa688('0x2c')]=function(_0x21d916,_0x1a5131){return db[_0xa688('0x30')][_0xa688('0x4b')]({'where':{'id':_0x21d916['params']['id']}})[_0xa688('0x28')](handleEntityNotFound(_0x1a5131,null))[_0xa688('0x28')](removeEntity(_0x1a5131,null))[_0xa688('0x45')](handleError(_0x1a5131,null));};exports[_0xa688('0x31')]=function(_0x5128c1,_0x42cde5){return db[_0xa688('0x30')][_0xa688('0x31')]()[_0xa688('0x28')](respondWithResult(_0x42cde5,null))[_0xa688('0x45')](handleError(_0x42cde5,null));};exports[_0xa688('0x53')]=function(_0x191a8c,_0x1dd2e9,_0x34366e){return db['CmContact'][_0xa688('0x4b')]({'where':{'id':_0x191a8c[_0xa688('0x54')]['id']}})[_0xa688('0x28')](handleEntityNotFound(_0x1dd2e9,null))[_0xa688('0x28')](function(_0x19ee7b){if(_0x19ee7b){return _0x19ee7b[_0xa688('0x53')](_0x191a8c[_0xa688('0x52')][_0xa688('0x55')],_[_0xa688('0x56')](_0x191a8c[_0xa688('0x52')],['ids','id'])||{});}})[_0xa688('0x28')](respondWithResult(_0x1dd2e9,null))[_0xa688('0x45')](handleError(_0x1dd2e9,null));};exports[_0xa688('0x57')]=function(_0x211079,_0x35718a,_0x950c6a){var _0x3e9909={};var _0x291537={};var _0x216275;var _0x26018a;return db[_0xa688('0x30')][_0xa688('0x58')]({'where':{'id':_0x211079[_0xa688('0x54')]['id']}})[_0xa688('0x28')](handleEntityNotFound(_0x35718a,null))[_0xa688('0x28')](function(_0x54117f){if(_0x54117f){_0x216275=_0x54117f;_0x291537['model']=_['keys'](db['CmContact'][_0xa688('0x47')]);_0x291537[_0xa688('0x34')]=_[_0xa688('0x33')](_0x211079[_0xa688('0x34')]);_0x291537[_0xa688('0x35')]=_[_0xa688('0x36')](_0x291537['model'],_0x291537[_0xa688('0x34')]);_0x3e9909['attributes']=_[_0xa688('0x36')](_0x291537[_0xa688('0x32')],qs[_0xa688('0x38')](_0x211079[_0xa688('0x34')][_0xa688('0x38')]));_0x3e9909['attributes']=_0x3e9909['attributes'][_0xa688('0x48')]?_0x3e9909['attributes']:_0x291537[_0xa688('0x32')];_0x3e9909[_0xa688('0x3b')]=qs[_0xa688('0x3c')](_0x211079[_0xa688('0x34')][_0xa688('0x3c')]);_0x3e9909[_0xa688('0x3d')]=qs['filters'](_[_0xa688('0x3e')](_0x211079['query'],_0x291537[_0xa688('0x35')]));if(_0x211079[_0xa688('0x34')]['filter']){_0x3e9909[_0xa688('0x3d')]=_[_0xa688('0x40')](_0x3e9909[_0xa688('0x3d')],{'$or':_['map'](_0x3e9909[_0xa688('0x37')],function(_0x2d3adc){var _0x5ed962={};_0x5ed962[_0x2d3adc]={'$like':'%'+_0x211079[_0xa688('0x34')][_0xa688('0x3f')]+'%'};return _0x5ed962;})});}_0x3e9909=_['merge']({},_0x3e9909,_0x211079['options']);return _0x216275[_0xa688('0x57')](_0x3e9909);}})[_0xa688('0x28')](function(_0x1bed1f){if(_0x1bed1f){_0x26018a=_0x1bed1f['length'];if(!_0x211079[_0xa688('0x34')][_0xa688('0x39')](_0xa688('0x3a'))){_0x3e9909[_0xa688('0x20')]=qs['limit'](_0x211079[_0xa688('0x34')][_0xa688('0x20')]);_0x3e9909['offset']=qs[_0xa688('0x22')](_0x211079[_0xa688('0x34')][_0xa688('0x22')]);}return _0x216275['getContacts'](_0x3e9909);}})['then'](function(_0x58fa6e){if(_0x58fa6e){return _0x58fa6e?{'count':_0x26018a,'rows':_0x58fa6e}:null;}})['then'](respondWithResult(_0x35718a,null))[_0xa688('0x45')](handleError(_0x35718a,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 026ad89..ad7531a 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 _0xb9bf=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','CmCompany','cm_companies','lodash','util'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xb9bf,0x15d));var _0xfb9b=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xb9bf[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xfb9b('0x0'));var util=require(_0xfb9b('0x1'));var logger=require(_0xfb9b('0x2'))('api');var moment=require(_0xfb9b('0x3'));var BPromise=require(_0xfb9b('0x4'));var rp=require(_0xfb9b('0x5'));var fs=require('fs');var path=require(_0xfb9b('0x6'));var rimraf=require(_0xfb9b('0x7'));var config=require(_0xfb9b('0x8'));var attributes=require('./cmCompany.attributes');module[_0xfb9b('0x9')]=function(_0xa80aa5,_0x1cca33){return _0xa80aa5[_0xfb9b('0xa')](_0xfb9b('0xb'),attributes,{'tableName':_0xfb9b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9605=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash'];(function(_0x2b21fe,_0x5b7f23){var _0x3b2333=function(_0x5dfc1b){while(--_0x5dfc1b){_0x2b21fe['push'](_0x2b21fe['shift']());}};_0x3b2333(++_0x5b7f23);}(_0x9605,0xc2));var _0x5960=function(_0x4ee60f,_0x29e505){_0x4ee60f=_0x4ee60f-0x0;var _0x3439f4=_0x9605[_0x4ee60f];return _0x3439f4;};'use strict';var _=require(_0x5960('0x0'));var util=require(_0x5960('0x1'));var logger=require(_0x5960('0x2'))(_0x5960('0x3'));var moment=require(_0x5960('0x4'));var BPromise=require(_0x5960('0x5'));var rp=require(_0x5960('0x6'));var fs=require('fs');var path=require(_0x5960('0x7'));var rimraf=require(_0x5960('0x8'));var config=require(_0x5960('0x9'));var attributes=require(_0x5960('0xa'));module[_0x5960('0xb')]=function(_0x188bb8,_0x14d61b){return _0x188bb8[_0x5960('0xc')](_0x5960('0xd'),attributes,{'tableName':_0x5960('0xe'),'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 e72ed50..5ad23f6 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 _0x15b6=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','CmCompany,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x2b082f,_0x247a5a){var _0x77b763=function(_0x21b7cf){while(--_0x21b7cf){_0x2b082f['push'](_0x2b082f['shift']());}};_0x77b763(++_0x247a5a);}(_0x15b6,0xab));var _0x615b=function(_0x46c4e7,_0x4f0fc0){_0x46c4e7=_0x46c4e7-0x0;var _0xd5f852=_0x15b6[_0x46c4e7];return _0xd5f852;};'use strict';var _=require(_0x615b('0x0'));var util=require(_0x615b('0x1'));var moment=require(_0x615b('0x2'));var BPromise=require('bluebird');var rs=require(_0x615b('0x3'));var fs=require('fs');var Redis=require(_0x615b('0x4'));var db=require(_0x615b('0x5'))['db'];var utils=require(_0x615b('0x6'));var logger=require(_0x615b('0x7'))('rpc');var config=require(_0x615b('0x8'));var jayson=require(_0x615b('0x9'));var client=jayson['client'][_0x615b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29158e,_0xaefa57,_0x332bad){return new BPromise(function(_0x715f91,_0x494704){return client['request'](_0x29158e,_0x332bad)[_0x615b('0xb')](function(_0x59a979){logger['info']('CmCompany,\x20%s,\x20%s',_0xaefa57,'request\x20sent');logger['debug'](_0x615b('0xc'),_0xaefa57,_0x615b('0xd'),JSON[_0x615b('0xe')](_0x59a979));if(_0x59a979['error']){if(_0x59a979['error'][_0x615b('0xf')]===0x1f4){logger[_0x615b('0x10')](_0x615b('0x11'),_0xaefa57,_0x59a979[_0x615b('0x10')]['message']);return _0x494704(_0x59a979['error'][_0x615b('0x12')]);}logger[_0x615b('0x10')](_0x615b('0x11'),_0xaefa57,_0x59a979['error'][_0x615b('0x12')]);return _0x715f91(_0x59a979[_0x615b('0x10')][_0x615b('0x12')]);}else{logger[_0x615b('0x13')](_0x615b('0x11'),_0xaefa57,'request\x20sent');_0x715f91(_0x59a979[_0x615b('0x14')]['message']);}})[_0x615b('0x15')](function(_0x278a43){logger['error']('CmCompany,\x20%s,\x20%s',_0xaefa57,_0x278a43);_0x494704(_0x278a43);});});} \ No newline at end of file +var _0x1415=['../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCompany,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x3c96d0,_0x239293){var _0x5afc68=function(_0x53a771){while(--_0x53a771){_0x3c96d0['push'](_0x3c96d0['shift']());}};_0x5afc68(++_0x239293);}(_0x1415,0x187));var _0x5141=function(_0x165cf5,_0x434402){_0x165cf5=_0x165cf5-0x0;var _0x302e4a=_0x1415[_0x165cf5];return _0x302e4a;};'use strict';var _=require(_0x5141('0x0'));var util=require(_0x5141('0x1'));var moment=require(_0x5141('0x2'));var BPromise=require(_0x5141('0x3'));var rs=require(_0x5141('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5141('0x5'));var logger=require('../../config/logger')(_0x5141('0x6'));var config=require(_0x5141('0x7'));var jayson=require(_0x5141('0x8'));var client=jayson[_0x5141('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e9f2a,_0x4e7935,_0x5c7f44){return new BPromise(function(_0x5edb8d,_0x592180){return client[_0x5141('0xa')](_0x2e9f2a,_0x5c7f44)[_0x5141('0xb')](function(_0x46fc09){logger[_0x5141('0xc')]('CmCompany,\x20%s,\x20%s',_0x4e7935,_0x5141('0xd'));logger[_0x5141('0xe')](_0x5141('0xf'),_0x4e7935,_0x5141('0xd'),JSON[_0x5141('0x10')](_0x46fc09));if(_0x46fc09[_0x5141('0x11')]){if(_0x46fc09[_0x5141('0x11')][_0x5141('0x12')]===0x1f4){logger[_0x5141('0x11')](_0x5141('0x13'),_0x4e7935,_0x46fc09[_0x5141('0x11')][_0x5141('0x14')]);return _0x592180(_0x46fc09[_0x5141('0x11')][_0x5141('0x14')]);}logger[_0x5141('0x11')](_0x5141('0x13'),_0x4e7935,_0x46fc09[_0x5141('0x11')][_0x5141('0x14')]);return _0x5edb8d(_0x46fc09['error'][_0x5141('0x14')]);}else{logger[_0x5141('0xc')](_0x5141('0x13'),_0x4e7935,_0x5141('0xd'));_0x5edb8d(_0x46fc09[_0x5141('0x15')]['message']);}})['catch'](function(_0x526d32){logger[_0x5141('0x11')](_0x5141('0x13'),_0x4e7935,_0x526d32);_0x592180(_0x526d32);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 913b9d8..83f8ec6 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 _0x7f73=['/:id/contacts','getContacts','post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x466076,_0x2baa6e){var _0x163925=function(_0x5b65c5){while(--_0x5b65c5){_0x466076['push'](_0x466076['shift']());}};_0x163925(++_0x2baa6e);}(_0x7f73,0xfa));var _0x37f7=function(_0x232c53,_0x53ecf1){_0x232c53=_0x232c53-0x0;var _0x478553=_0x7f73[_0x232c53];return _0x478553;};'use strict';var multer=require(_0x37f7('0x0'));var util=require(_0x37f7('0x1'));var path=require('path');var timeout=require(_0x37f7('0x2'));var express=require(_0x37f7('0x3'));var router=express[_0x37f7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x37f7('0x5'));var interaction=require(_0x37f7('0x6'));var config=require(_0x37f7('0x7'));var controller=require(_0x37f7('0x8'));router[_0x37f7('0x9')]('/',auth[_0x37f7('0xa')](),controller[_0x37f7('0xb')]);router['get'](_0x37f7('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x37f7('0x9')](_0x37f7('0xd'),auth[_0x37f7('0xa')](),controller['show']);router['get'](_0x37f7('0xe'),auth[_0x37f7('0xa')](),controller[_0x37f7('0xf')]);router[_0x37f7('0x10')]('/',auth[_0x37f7('0xa')](),controller[_0x37f7('0x11')]);router['post']('/:id/contacts',auth[_0x37f7('0xa')](),controller['addContacts']);router[_0x37f7('0x12')](_0x37f7('0xd'),auth[_0x37f7('0xa')](),controller['update']);router[_0x37f7('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x37f7('0x14')]);module[_0x37f7('0x15')]=router; \ No newline at end of file +var _0xc5f8=['destroy','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/contacts','getContacts','post','create','addContacts','put'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0xc5f8,0x109));var _0x8c5f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc5f8[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8c5f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8c5f('0x1'));var express=require(_0x8c5f('0x2'));var router=express['Router']();var fs_extra=require(_0x8c5f('0x3'));var auth=require(_0x8c5f('0x4'));var interaction=require(_0x8c5f('0x5'));var config=require(_0x8c5f('0x6'));var controller=require(_0x8c5f('0x7'));router['get']('/',auth[_0x8c5f('0x8')](),controller[_0x8c5f('0x9')]);router[_0x8c5f('0xa')](_0x8c5f('0xb'),auth[_0x8c5f('0x8')](),controller[_0x8c5f('0xc')]);router['get'](_0x8c5f('0xd'),auth['isAuthenticated'](),controller[_0x8c5f('0xe')]);router[_0x8c5f('0xa')](_0x8c5f('0xf'),auth['isAuthenticated'](),controller[_0x8c5f('0x10')]);router[_0x8c5f('0x11')]('/',auth['isAuthenticated'](),controller[_0x8c5f('0x12')]);router['post'](_0x8c5f('0xf'),auth[_0x8c5f('0x8')](),controller[_0x8c5f('0x13')]);router[_0x8c5f('0x14')](_0x8c5f('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x8c5f('0xd'),auth[_0x8c5f('0x8')](),controller[_0x8c5f('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 42ba161..0e9a8c5 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 _0x6aac=['UNSIGNED','exports','STRING','TEXT','INTEGER'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x6aac,0x1c3));var _0xc6aa=function(_0x420288,_0x49a99d){_0x420288=_0x420288-0x0;var _0x514e86=_0x6aac[_0x420288];return _0x514e86;};'use strict';var _=require('lodash');var Sequelize=require('sequelize');module[_0xc6aa('0x0')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xc6aa('0x1')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xc6aa('0x1')]},'city':{'type':Sequelize[_0xc6aa('0x1')]},'country':{'type':Sequelize[_0xc6aa('0x1')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc6aa('0x2')]},'phone':{'type':Sequelize[_0xc6aa('0x1')]},'mobile':{'type':Sequelize[_0xc6aa('0x1')]},'fax':{'type':Sequelize[_0xc6aa('0x1')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0xc6aa('0x1')]},'facebook':{'type':Sequelize[_0xc6aa('0x1')]},'fb_data':{'type':Sequelize[_0xc6aa('0x1')]},'twitter':{'type':Sequelize[_0xc6aa('0x1')]},'skype':{'type':Sequelize[_0xc6aa('0x1')]},'teams':{'type':Sequelize[_0xc6aa('0x1')]},'viber':{'type':Sequelize[_0xc6aa('0x1')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0xc6aa('0x1')]},'telegram':{'type':Sequelize[_0xc6aa('0x1')]},'UserId':{'type':Sequelize[_0xc6aa('0x3')]},'AdditionalPhones':{'type':Sequelize[_0xc6aa('0x1')]},'priority':{'type':Sequelize[_0xc6aa('0x3')](0x2)[_0xc6aa('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0xc6aa('0x3')]}}; \ No newline at end of file +var _0x4347=['NOW','sequelize','exports','STRING','INTEGER','UNSIGNED','DATE'];(function(_0x9188e4,_0x2a043a){var _0x427abd=function(_0x4d5f06){while(--_0x4d5f06){_0x9188e4['push'](_0x9188e4['shift']());}};_0x427abd(++_0x2a043a);}(_0x4347,0x17b));var _0x7434=function(_0x1f61e6,_0x19f204){_0x1f61e6=_0x1f61e6-0x0;var _0x9e603f=_0x4347[_0x1f61e6];return _0x9e603f;};'use strict';var _=require('lodash');var Sequelize=require(_0x7434('0x0'));module[_0x7434('0x1')]={'firstName':{'type':Sequelize[_0x7434('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x7434('0x2')]},'street':{'type':Sequelize[_0x7434('0x2')]},'postalCode':{'type':Sequelize[_0x7434('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x7434('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x7434('0x2')]},'email':{'type':Sequelize[_0x7434('0x2')]},'url':{'type':Sequelize[_0x7434('0x2')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x7434('0x2')]},'viber':{'type':Sequelize[_0x7434('0x2')]},'line':{'type':Sequelize[_0x7434('0x2')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x7434('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0x7434('0x2')]},'priority':{'type':Sequelize[_0x7434('0x3')](0x2)[_0x7434('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x7434('0x5')],'defaultValue':Sequelize[_0x7434('0x6')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0x7434('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 9504c99..e66a63a 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 _0x4098=['join','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','create','update','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappQueueReport','isNil','dialTimezone','utcOffset','timezones','additionalPhones','bulkCreate','each','duplicates','where','$or','ListId','findOrCreate','spread','hasOwnProperty','push','all','show','Tag','Tags','color','tag','Phones','sequelize','literal','Phones.OrderBy','$and','map','format','cf_%d','find','omit','pickBy','isEmpty','table','setFields','id\x20=\x20?','toParam','text','values','phone','getTags','findOne','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','nolimit','setTags','ids','setAdditionalPhones','ContactItemType','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','ItemType','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','ContactId','options','rows','getHopperHistories','CmHopperHistory','includeAll','include','getHopperFinals','getJscriptySessions','binding_keys','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_values','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','pid','send','upload','parse','meta','agent','binding','../../components/import/cm/csv2','stringify','exit','error\x20child\x20process','importUpdates','User','No\x20ListId\x20specified','../../components/import/cm/csvUpdates','message','start\x20child\x20process\x20correctly!','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','resolve','channel','includes','toLowerCase','range','Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','Invalid\x20createdAt\x20filter','source','destination','callerid','endtime','duration','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','Account','closed','closedAt','note','disposition','thirdDisposition','key','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','substatus','externalUrl','threadId','startCase','Interaction','Owner','flatten','sortBy','reverse','value','slice','util','path','squel','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','./cmContact.socket','json','offset','limit','count','set','Content-Range','then','destroy','status','end','sendStatus','name','index','findAll','query','user','catch','CmContact','params','describe','tags','length','startsWith','columnName','displayName','analytics','CmCustomField','cf_','custom','type','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','keys','merge','body','from','get','isArray'];(function(_0x4249d3,_0x32b4fa){var _0x593a47=function(_0x361771){while(--_0x361771){_0x4249d3['push'](_0x4249d3['shift']());}};_0x593a47(++_0x32b4fa);}(_0x4098,0x1cb));var _0x8409=function(_0x209e05,_0xc489b4){_0x209e05=_0x209e05-0x0;var _0x18ee7f=_0x4098[_0x209e05];return _0x18ee7f;};'use strict';var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x8409('0x0'));var path=require(_0x8409('0x1'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8409('0x2'));var Papa=require(_0x8409('0x3'));var Redis=require(_0x8409('0x4'));var contacts=require('../../components/contacts');var qs=require(_0x8409('0x5'));var logger=require(_0x8409('0x6'))(_0x8409('0x7'));var config=require(_0x8409('0x8'));var shared=require(_0x8409('0x9'));var db=require(_0x8409('0xa'))['db'];config[_0x8409('0xb')]=_[_0x8409('0xc')](config[_0x8409('0xb')],{'host':_0x8409('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8409('0xb')]));require(_0x8409('0xe'))['register'](socket);function respondWithResult(_0x53c731,_0x92ff43){_0x92ff43=_0x92ff43||0xc8;return function(_0x29ecdd){if(_0x29ecdd){return _0x53c731['status'](_0x92ff43)[_0x8409('0xf')](_0x29ecdd);}};}function respondWithFilteredResult(_0x5e78a8,_0x5efbfd){return function(_0x4a4651){if(_0x4a4651){var _0x219cd6=typeof _0x5efbfd[_0x8409('0x10')]==='undefined'&&typeof _0x5efbfd[_0x8409('0x11')]==='undefined';var _0x49b6ce=_0x4a4651[_0x8409('0x12')];var _0x18429c=_0x219cd6?0x0:_0x5efbfd[_0x8409('0x10')];var _0x228377=_0x219cd6?_0x4a4651[_0x8409('0x12')]:_0x5efbfd[_0x8409('0x10')]+_0x5efbfd[_0x8409('0x11')];var _0x3d4fac;if(_0x228377>=_0x49b6ce){_0x228377=_0x49b6ce;_0x3d4fac=0xc8;}else{_0x3d4fac=0xce;}_0x5e78a8['status'](_0x3d4fac);return _0x5e78a8[_0x8409('0x13')](_0x8409('0x14'),_0x18429c+'-'+_0x228377+'/'+_0x49b6ce)[_0x8409('0xf')](_0x4a4651);}return null;};}function saveUpdates(_0x312d7d){return function(_0x14ab31){if(_0x14ab31){return _0x14ab31['update'](_0x312d7d)[_0x8409('0x15')](function(_0x228657){return _0x228657;});}return null;};}function removeEntity(_0x3fb280){return function(_0xbebb49){if(_0xbebb49){return _0xbebb49[_0x8409('0x16')]()['then'](function(){_0x3fb280[_0x8409('0x17')](0xcc)[_0x8409('0x18')]();});}};}function handleEntityNotFound(_0x2d2826){return function(_0x157057){if(!_0x157057){_0x2d2826[_0x8409('0x19')](0x194);}return _0x157057;};}function handleError(_0x2c0c82,_0x3cb973){_0x3cb973=_0x3cb973||0x1f4;return function(_0x1c223b){logger['error'](_0x1c223b['stack']);if(_0x1c223b[_0x8409('0x1a')]){delete _0x1c223b[_0x8409('0x1a')];}_0x2c0c82['status'](_0x3cb973)['send'](_0x1c223b);};}exports[_0x8409('0x1b')]=function(_0x1dee16,_0x4f0295){var _0x5aab8b={};return contacts['describe']()[_0x8409('0x15')](function(_0x304b74){_0x5aab8b=qs['getOptions'](_0x304b74,_0x1dee16);return contacts[_0x8409('0x1c')](_0x1dee16[_0x8409('0x1d')],_0x1dee16[_0x8409('0x1e')],_0x5aab8b,_0x304b74);})[_0x8409('0x15')](respondWithFilteredResult(_0x4f0295,_0x5aab8b))[_0x8409('0x1f')](handleError(_0x4f0295,null));};exports['destroy']=function(_0x271909,_0x1603cb){return db[_0x8409('0x20')]['find']({'where':{'id':_0x271909[_0x8409('0x21')]['id']}})[_0x8409('0x15')](handleEntityNotFound(_0x1603cb,null))[_0x8409('0x15')](removeEntity(_0x1603cb,null))[_0x8409('0x1f')](handleError(_0x1603cb,null));};exports['describe']=function(_0x36ece1,_0x172219){return db['CmContact'][_0x8409('0x22')]()[_0x8409('0x15')](function(_0x29f5c9){delete _0x29f5c9[_0x8409('0x23')];for(var _0x49a5ab=0x0;_0x49a5ab0x0){return new Promise(function(_0x40dad3){var _0x256200=[];for(var _0x48d916=0x0;_0x48d916<_0x484620[_0x8409('0x24')];_0x48d916++){_0x256200[_0x8409('0x5c')](insertAdditionalPhones(_0x484620[_0x48d916]['contact'],_0x484620[_0x48d916][_0x8409('0x52')]));}Promise[_0x8409('0x5d')](_0x256200)['then'](function(){_0x40dad3(0x1);});})[_0x8409('0x15')](function(){return{'success':_0x17884f,'failure':_0x4dd8ab,'duplicates':_0x59847a};});}else{return{'success':_0x17884f,'failure':_0x4dd8ab,'duplicates':_0x59847a};}}})[_0x8409('0x15')](respondWithResult(_0x34c147,0xc9))['catch'](handleError(_0x34c147,null));};exports[_0x8409('0x5e')]=function(_0x4ba692,_0x55cb0a){var _0xcdd22d;return db[_0x8409('0x20')][_0x8409('0x22')]()[_0x8409('0x15')](function(_0x36797b){return db[_0x8409('0x20')]['find']({'where':{'id':_0x4ba692[_0x8409('0x21')]['id']},'include':[{'model':db[_0x8409('0x5f')],'as':_0x8409('0x60'),'attributes':['id',_0x8409('0x1a'),_0x8409('0x61')],'required':_0x4ba692[_0x8409('0x1d')][_0x8409('0x62')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x8409('0x63'),'where':{'CmContactId':_0x4ba692[_0x8409('0x21')]['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':'ItemType'}]}],'order':[db[_0x8409('0x64')][_0x8409('0x65')](_0x8409('0x66'))],'attributes':_[_0x8409('0x2f')](_0x36797b)});})[_0x8409('0x15')](function(_0x4ba6b7){if(!_[_0x8409('0x4e')](_0x4ba6b7)){_0xcdd22d=_0x4ba6b7['get']({'plain':!![]});var _0xebfab6={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4ba6b7&&_0x4ba6b7[_0x8409('0x58')]){if(_0x4ba6b7[_0x8409('0x58')]){_0xebfab6[_0x8409('0x56')][_0x8409('0x67')]['push']({'ListId':{'$ne':_0x4ba6b7['ListId']}});}}return db[_0x8409('0x29')]['findAll'](_0xebfab6);}})['then'](function(_0x3029dc){if(!_[_0x8409('0x4e')](_0x3029dc)){return _['omit'](_0xcdd22d,_[_0x8409('0x68')](_0x3029dc,function(_0x5cae6d){return util[_0x8409('0x69')](_0x8409('0x6a'),_0x5cae6d['id']);}));}})[_0x8409('0x15')](handleEntityNotFound(_0x55cb0a,null))['then'](respondWithResult(_0x55cb0a,null))[_0x8409('0x1f')](handleError(_0x55cb0a,null));};exports[_0x8409('0x3a')]=function(_0x2c45fb,_0x1ff255){var _0x5d1b29;if(_0x2c45fb[_0x8409('0x31')]['id']){delete _0x2c45fb[_0x8409('0x31')]['id'];}if(!_['isNil'](_0x2c45fb[_0x8409('0x31')][_0x8409('0x4f')])){var _0x4a302a=_0x2c45fb[_0x8409('0x31')][_0x8409('0x4f')];if(!_[_0x8409('0x4e')](shared[_0x8409('0x51')][_0x4a302a]))_0x2c45fb['body'][_0x8409('0x50')]=shared[_0x8409('0x51')][_0x4a302a][_0x8409('0x50')];}return db[_0x8409('0x20')][_0x8409('0x6b')]({'where':{'id':_0x2c45fb[_0x8409('0x21')]['id']}})[_0x8409('0x15')](handleEntityNotFound(_0x1ff255,null))[_0x8409('0x15')](saveUpdates(_0x2c45fb[_0x8409('0x31')],null))[_0x8409('0x15')](function(_0x5ab817){_0x5d1b29=_0x5ab817;var _0x30480e={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x5ab817&&_0x5ab817[_0x8409('0x58')]){if(_0x5ab817['ListId']){_0x30480e[_0x8409('0x56')]['$and']['push']({'ListId':{'$ne':_0x5ab817[_0x8409('0x58')]}});}}return db[_0x8409('0x29')][_0x8409('0x1c')](_0x30480e);})[_0x8409('0x15')](function(_0x2c8c01){if(_0x2c8c01){return _[_0x8409('0x6c')](_[_0x8409('0x6d')](_0x2c45fb[_0x8409('0x31')],function(_0x10347f,_0x52f2df){return _[_0x8409('0x25')](_0x52f2df,'cf_');}),_[_0x8409('0x68')](_0x2c8c01,function(_0xfac9e1){return util[_0x8409('0x69')](_0x8409('0x6a'),_0xfac9e1['id']);}));}})['then'](function(_0x3f86ca){if(_0x3f86ca&&!_[_0x8409('0x6e')](_0x3f86ca)){var _0x2820e9=squel['update']()[_0x8409('0x6f')]('cm_contacts')[_0x8409('0x70')](_0x3f86ca)[_0x8409('0x56')](_0x8409('0x71'),_0x2c45fb[_0x8409('0x21')]['id'])[_0x8409('0x72')]();return db[_0x8409('0x64')][_0x8409('0x1d')](_0x2820e9[_0x8409('0x73')],{'replacements':_0x2820e9[_0x8409('0x74')]});}})[_0x8409('0x15')](function(){if(_0x2c45fb[_0x8409('0x31')][_0x8409('0x75')]&&_0x5d1b29){return db[_0x8409('0x36')][_0x8409('0x3a')]({'phone':_0x2c45fb[_0x8409('0x31')][_0x8409('0x75')],'OrderBy':0x0},{'where':{'ContactId':_0x5d1b29['id']}});}})['then'](function(){return _0x5d1b29;})[_0x8409('0x15')](respondWithResult(_0x1ff255,null))['catch'](handleError(_0x1ff255,null));};exports[_0x8409('0x76')]=function(_0x11cee4,_0x4c1762){var _0x2de208={};var _0x322d95={};var _0x2325dc;var _0x5a476e;return db[_0x8409('0x20')][_0x8409('0x77')]({'where':{'id':_0x11cee4['params']['id']}})['then'](handleEntityNotFound(_0x4c1762,null))[_0x8409('0x15')](function(_0x58e2da){if(_0x58e2da){_0x2325dc=_0x58e2da;_0x322d95[_0x8409('0x78')]=_[_0x8409('0x2f')](db['Tag'][_0x8409('0x79')]);_0x322d95['query']=_[_0x8409('0x2f')](_0x11cee4[_0x8409('0x1d')]);_0x322d95[_0x8409('0x7a')]=_[_0x8409('0x7b')](_0x322d95[_0x8409('0x78')],_0x322d95[_0x8409('0x1d')]);_0x2de208[_0x8409('0x7c')]=_[_0x8409('0x7b')](_0x322d95[_0x8409('0x78')],qs[_0x8409('0x7d')](_0x11cee4[_0x8409('0x1d')]['fields']));_0x2de208['attributes']=_0x2de208['attributes'][_0x8409('0x24')]?_0x2de208[_0x8409('0x7c')]:_0x322d95[_0x8409('0x78')];_0x2de208[_0x8409('0x7e')]=qs[_0x8409('0x7f')](_0x11cee4[_0x8409('0x1d')][_0x8409('0x7f')]);_0x2de208[_0x8409('0x56')]=qs[_0x8409('0x7a')](_[_0x8409('0x80')](_0x11cee4[_0x8409('0x1d')],_0x322d95['filters']));if(_0x11cee4['query'][_0x8409('0x81')]){_0x2de208[_0x8409('0x56')]=_[_0x8409('0x30')](_0x2de208[_0x8409('0x56')],{'$or':_['map'](_0x2de208[_0x8409('0x7c')],function(_0x575664){var _0x102064={};_0x102064[_0x575664]={'$like':'%'+_0x11cee4['query'][_0x8409('0x81')]+'%'};return _0x102064;})});}_0x2de208=_[_0x8409('0x30')]({},_0x2de208,_0x11cee4['options']);return _0x2325dc[_0x8409('0x76')](_0x2de208);}})[_0x8409('0x15')](function(_0x5a3b7b){if(_0x5a3b7b){_0x5a476e=_0x5a3b7b[_0x8409('0x24')];if(!_0x11cee4[_0x8409('0x1d')][_0x8409('0x5b')](_0x8409('0x82'))){_0x2de208[_0x8409('0x11')]=qs[_0x8409('0x11')](_0x11cee4[_0x8409('0x1d')][_0x8409('0x11')]);_0x2de208['offset']=qs[_0x8409('0x10')](_0x11cee4[_0x8409('0x1d')][_0x8409('0x10')]);}return _0x2325dc[_0x8409('0x76')](_0x2de208);}})[_0x8409('0x15')](function(_0x2b9d96){if(_0x2b9d96){return _0x2b9d96?{'count':_0x5a476e,'rows':_0x2b9d96}:null;}})[_0x8409('0x15')](respondWithResult(_0x4c1762,null))[_0x8409('0x1f')](handleError(_0x4c1762,null));};exports[_0x8409('0x83')]=function(_0xed3350,_0x4e9549){if(_0xed3350[_0x8409('0x31')]['id']){delete _0xed3350[_0x8409('0x31')]['id'];}return db[_0x8409('0x20')][_0x8409('0x77')]({'where':{'id':_0xed3350[_0x8409('0x21')]['id']}})[_0x8409('0x15')](handleEntityNotFound(_0x4e9549,null))[_0x8409('0x15')](function(_0x19fba9){if(_0x19fba9){return _0x19fba9['setTags'](_0xed3350[_0x8409('0x31')][_0x8409('0x84')]||[]);}return null;})[_0x8409('0x15')](respondWithResult(_0x4e9549,null))['catch'](handleError(_0x4e9549,null));};exports[_0x8409('0x85')]=function(_0x121388,_0x462743){var _0x11ff80=[];_0x11ff80[_0x8409('0x5c')](addAdditionalPhones(_0x121388[_0x8409('0x31')]));Promise['all'](_0x11ff80)['then'](function(){_0x11ff80=[];_0x11ff80[_0x8409('0x5c')](deleteCmHopperPhones(_0x121388[_0x8409('0x31')]['id']));_0x11ff80[_0x8409('0x5c')](addCmHopperPhones(_0x121388['body']['id']));Promise['all'](_0x11ff80)[_0x8409('0x15')](function(){return[0x1];})['then'](respondWithResult(_0x462743,null));});};function addAdditionalPhones(_0x204b99){var _0x28c3c5;return new Promise(function(_0x5b2b5a){return db['CmContactHasItem']['destroy']({'where':{'CmContactId':_0x204b99['id']}})['then'](function(){db[_0x8409('0x86')][_0x8409('0x1c')]({'raw':!![],'attributes':['id',_0x8409('0x87')]})['then'](function(_0x4d8b18){var _0x640434=[];for(var _0x39e03c=0x0;_0x39e03c<_0x204b99[_0x8409('0x88')][_0x8409('0x24')];_0x39e03c++){var _0x769100=_0x204b99[_0x8409('0x89')]?_[_0x8409('0x4e')](_0x204b99[_0x8409('0x89')][_0x39e03c])?'':_0x204b99['item_types'][_0x39e03c]:_0x204b99['items'][_0x39e03c]['ItemTypeId']?_0x204b99['items'][_0x39e03c][_0x8409('0x8a')]:'';var _0x2bb6fa=_['isNil'](_0x204b99[_0x8409('0x88')][_0x39e03c][_0x8409('0x8b')])?'':_0x204b99[_0x8409('0x88')][_0x39e03c][_0x8409('0x8b')];var _0x4c3950=_0x769100+':'+_0x204b99['items'][_0x39e03c][_0x8409('0x75')]+'§'+_0x2bb6fa;if(_[_0x8409('0x4e')](_0x28c3c5))_0x28c3c5=_0x4c3950;else _0x28c3c5+=';'+_0x4c3950;var _0x4d3d85=null;var _0x15f41e=null;if(_0x204b99[_0x8409('0x89')]){if(!_[_0x8409('0x4e')](_0x204b99[_0x8409('0x89')][_0x39e03c])){_0x15f41e=_[_0x8409('0x6b')](_0x4d8b18,function(_0x2231fc){return _0x2231fc['id']===_0x204b99[_0x8409('0x89')][_0x39e03c];});if(!_[_0x8409('0x4e')](_0x15f41e)){_0x4d3d85=_0x15f41e['OrderBy'];}}}else{if(!_[_0x8409('0x4e')](_0x204b99[_0x8409('0x88')][_0x39e03c])){_0x15f41e=_[_0x8409('0x6b')](_0x4d8b18,function(_0x535560){return _0x535560['id']===_0x204b99[_0x8409('0x88')][_0x39e03c][_0x8409('0x8a')];});if(!_['isNil'](_0x15f41e)){_0x4d3d85=_0x39e03c;}}}if(_[_0x8409('0x4e')](_0x4d3d85)){_0x4d3d85=0x64;}_0x640434[_0x8409('0x5c')](addAdditionalPhone(_0x204b99['id'],_0x204b99[_0x8409('0x88')][_0x39e03c][_0x8409('0x75')],_0x204b99[_0x8409('0x89')]?_['isNil'](_0x204b99[_0x8409('0x89')][_0x39e03c])?null:_0x204b99[_0x8409('0x89')][_0x39e03c]:_0x204b99['items'][_0x39e03c]['ItemTypeId']?_0x204b99['items'][_0x39e03c][_0x8409('0x8a')]:null,_0x4d3d85,_0x2bb6fa));}Promise[_0x8409('0x5d')](_0x640434)[_0x8409('0x15')](function(){db[_0x8409('0x20')][_0x8409('0x3a')]({'AdditionalPhones':_0x28c3c5},{'where':{'id':_0x204b99['id']}})[_0x8409('0x15')](function(){_0x5b2b5a(0x1);});});});});});}function addAdditionalPhone(_0x244969,_0x50c400,_0x110de9,_0x5bbd28,_0x1d113d){return db[_0x8409('0x43')][_0x8409('0x6b')]({'where':{'CmContactId':_0x244969,'item':_0x50c400}})['then'](function(_0x587d50){if(_0x587d50)logger[_0x8409('0x2d')](_0x8409('0x8c'),_0x587d50);else{db[_0x8409('0x43')][_0x8409('0x39')]({'CmContactId':_0x244969,'item':_0x50c400,'ItemTypeId':_0x110de9,'OrderBy':_0x5bbd28,'ItemClass':_0x8409('0x8d'),'description':_0x1d113d});}});}function deleteCmHopperPhones(_0x5c37ca){return new Promise(function(_0x2a249f){return db['CmHopper'][_0x8409('0x1c')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x5c37ca}})['then'](function(_0xc3bfdd){db[_0x8409('0x8e')][_0x8409('0x16')]({'where':{'CmHopperId':{'$in':_[_0x8409('0x68')](_0xc3bfdd,'id')}}});})[_0x8409('0x15')](function(){_0x2a249f(0x1);});});}function addCmHopperPhones(_0x1f7138){return new Promise(function(_0x45217d){return db['CmHopper'][_0x8409('0x1c')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1f7138}})[_0x8409('0x15')](function(_0x3f9eba){var _0x25763b=[];_['map'](_0x3f9eba,function(_0x49ef2c){_0x25763b['push'](createCmHopperPhone(_0x1f7138,_0x49ef2c['id']));});Promise[_0x8409('0x5d')](_0x25763b)[_0x8409('0x15')](function(){_0x45217d(0x1);});});});}function createCmHopperPhone(_0x4ba7fd,_0x11fd26){return new Promise(function(_0x339476){db[_0x8409('0x43')][_0x8409('0x1c')]({'raw':!![],'attributes':[_0x8409('0x8f'),_0x8409('0x87')],'where':{'CmContactId':_0x4ba7fd,'ItemClass':'PHONE'},'include':[{'model':db[_0x8409('0x86')],'attributes':[_0x8409('0x87')],'as':_0x8409('0x90')}],'order':['OrderBy',db[_0x8409('0x64')][_0x8409('0x65')](_0x8409('0x91'))]})[_0x8409('0x15')](function(_0x2d90cb){var _0x471f5c=0x1;var _0x38cfd5=_[_0x8409('0x68')](_0x2d90cb,function(_0xb96a5d){_0xb96a5d[_0x8409('0x92')]=_0x11fd26;_0xb96a5d[_0x8409('0x75')]=_0xb96a5d[_0x8409('0x8f')];_0xb96a5d[_0x8409('0x87')]=_0x471f5c;delete _0xb96a5d[_0x8409('0x93')];_0x471f5c=_0x471f5c+0x1;return _0xb96a5d;});return db[_0x8409('0x8e')]['bulkCreate'](_0x38cfd5,{});})[_0x8409('0x15')](function(){_0x339476(0x1);});});}function insertAdditionalPhones(_0x1b695e,_0x1e19a7){return new Promise(function(_0x560663){var _0x375646=[];for(var _0x4f2452=0x0;_0x4f2452<_0x1e19a7['length'];_0x4f2452++){var _0x4bcb04=_0x1e19a7[_0x4f2452];_0x375646[_0x8409('0x5c')](parseContactItemType(_0x4bcb04));}Promise[_0x8409('0x5d')](_0x375646)[_0x8409('0x15')](function(){var _0x283d0a={'id':_0x1b695e['id'],'items':_0x1e19a7};return addAdditionalPhones(_0x283d0a)['then'](function(){return addCmHopperPhones(_0x1b695e['id']);});})[_0x8409('0x15')](function(){_0x560663(_0x1b695e);});});}function parseContactItemType(_0x35cc2a){return new Promise(function(_0x746415){if(_0x35cc2a[_0x8409('0x5b')](_0x8409('0x8a'))){_0x746415(_0x35cc2a);}else{return db[_0x8409('0x86')][_0x8409('0x6b')]({'where':{'name':_0x35cc2a[_0x8409('0x90')]}})[_0x8409('0x15')](function(_0x3ee929){if(_['isNil'](_0x3ee929))_0x35cc2a[_0x8409('0x8a')]=null;else _0x35cc2a[_0x8409('0x8a')]=_0x3ee929['id'];_0x746415(_0x35cc2a);});}});}exports[_0x8409('0x94')]=function(_0x43d142,_0x224645){return db['CmContactHasItem']['findAll']({'raw':!![],'where':{'CmContactId':_0x43d142[_0x8409('0x21')]['id'],'ItemClass':_0x8409('0x8d')},'include':[{'model':db['ContactItemType'],'as':_0x8409('0x90')}],'order':[[_0x8409('0x87')],[db[_0x8409('0x64')][_0x8409('0x65')](_0x8409('0x91'))]]})[_0x8409('0x15')](function(_0x20b0b6){return _0x20b0b6;})[_0x8409('0x15')](respondWithResult(_0x224645,null))[_0x8409('0x1f')](handleError(_0x224645,null));};exports[_0x8409('0x95')]=function(_0x6a557a,_0x15b62d){return db['CmContactHasItem'][_0x8409('0x1c')]({'raw':!![],'where':{'CmContactId':_0x6a557a[_0x8409('0x31')][_0x8409('0x96')]}})[_0x8409('0x15')](function(_0x5ef3ba){var _0x297e5a=_['map'](_0x5ef3ba,function(_0x495d78){_0x495d78[_0x8409('0x97')]=_0x6a557a['body']['toContactId'];return _0x495d78;});return db['CmContactHasItem'][_0x8409('0x53')](_0x297e5a,{});})[_0x8409('0x15')](function(){return addCmHopperPhones(_0x6a557a['body']['toContactId']);})['then'](function(){return['ok'];})['then'](respondWithResult(_0x15b62d,null))[_0x8409('0x1f')](handleError(_0x15b62d,null));};exports['rescheduleAdditionalPhones']=function(_0x473ec9,_0x1fb9d9){var _0x532a6e=[];_0x532a6e[_0x8409('0x5c')](createCmHopperPhone(_0x473ec9[_0x8409('0x31')]['id'],_0x473ec9[_0x8409('0x31')]['hopperId']));Promise[_0x8409('0x5d')](_0x532a6e)[_0x8409('0x15')](function(){return[0x1];})[_0x8409('0x15')](respondWithResult(_0x1fb9d9,null));};exports['getHoppers']=function(_0x1b931b,_0x5dcfc5){var _0x289a7d={'raw':![],'where':{}};var _0x5cdae8={};var _0x2cb420={'count':0x0,'rows':[]};return db[_0x8409('0x20')][_0x8409('0x77')]({'where':{'id':_0x1b931b[_0x8409('0x21')]['id']}})[_0x8409('0x15')](handleEntityNotFound(_0x5dcfc5,null))[_0x8409('0x15')](function(_0x3ab0e9){if(_0x3ab0e9){_0x5cdae8[_0x8409('0x78')]=_[_0x8409('0x2f')](db[_0x8409('0x36')][_0x8409('0x79')]);_0x5cdae8['query']=_[_0x8409('0x2f')](_0x1b931b['query']);_0x5cdae8[_0x8409('0x7a')]=_[_0x8409('0x7b')](_0x5cdae8[_0x8409('0x78')],_0x5cdae8['query']);_0x289a7d['attributes']=_[_0x8409('0x7b')](_0x5cdae8[_0x8409('0x78')],qs[_0x8409('0x7d')](_0x1b931b['query'][_0x8409('0x7d')]));_0x289a7d[_0x8409('0x7c')]=_0x289a7d[_0x8409('0x7c')]['length']?_0x289a7d[_0x8409('0x7c')]:_0x5cdae8['model'];if(!_0x1b931b['query']['hasOwnProperty']('nolimit')){_0x289a7d['limit']=qs[_0x8409('0x11')](_0x1b931b[_0x8409('0x1d')][_0x8409('0x11')]);_0x289a7d['offset']=qs[_0x8409('0x10')](_0x1b931b[_0x8409('0x1d')][_0x8409('0x10')]);}_0x289a7d[_0x8409('0x7e')]=qs[_0x8409('0x7f')](_0x1b931b[_0x8409('0x1d')][_0x8409('0x7f')]);_0x289a7d['where']=qs[_0x8409('0x7a')](_[_0x8409('0x80')](_0x1b931b[_0x8409('0x1d')],_0x5cdae8[_0x8409('0x7a')]));_0x289a7d['where'][_0x8409('0x98')]=_0x3ab0e9['id'];if(_0x1b931b[_0x8409('0x1d')]['filter']){_0x289a7d[_0x8409('0x56')]=_[_0x8409('0x30')](_0x289a7d['where'],{'$or':_['map'](_0x289a7d[_0x8409('0x7c')],function(_0x438f66){var _0xdd8a80={};_0xdd8a80[_0x438f66]={'$like':'%'+_0x1b931b['query'][_0x8409('0x81')]+'%'};return _0xdd8a80;})});}_0x289a7d=_['merge']({},_0x289a7d,_0x1b931b[_0x8409('0x99')]);return db['CmHopper'][_0x8409('0x12')]({'where':_0x289a7d[_0x8409('0x56')]})[_0x8409('0x15')](function(_0x32b254){_0x2cb420[_0x8409('0x12')]=_0x32b254;if(_0x1b931b['query']['includeAll']){_0x289a7d['include']=[{'all':!![]}];}return db[_0x8409('0x36')][_0x8409('0x1c')](_0x289a7d);})[_0x8409('0x15')](function(_0x1ac038){_0x2cb420[_0x8409('0x9a')]=_0x1ac038;return _0x2cb420;});}})[_0x8409('0x15')](respondWithFilteredResult(_0x5dcfc5,_0x289a7d))[_0x8409('0x1f')](handleError(_0x5dcfc5,null));};exports[_0x8409('0x9b')]=function(_0x5123d4,_0x5ad617){var _0x163228={'raw':!![],'where':{}};var _0x3a79a0={};var _0x3f9d4a={'count':0x0,'rows':[]};return db[_0x8409('0x20')][_0x8409('0x77')]({'where':{'id':_0x5123d4['params']['id']}})[_0x8409('0x15')](handleEntityNotFound(_0x5ad617,null))[_0x8409('0x15')](function(_0x165dad){if(_0x165dad){_0x3a79a0['model']=_[_0x8409('0x2f')](db['CmHopperHistory'][_0x8409('0x79')]);_0x3a79a0[_0x8409('0x1d')]=_[_0x8409('0x2f')](_0x5123d4[_0x8409('0x1d')]);_0x3a79a0[_0x8409('0x7a')]=_['intersection'](_0x3a79a0[_0x8409('0x78')],_0x3a79a0[_0x8409('0x1d')]);_0x163228[_0x8409('0x7c')]=_['intersection'](_0x3a79a0[_0x8409('0x78')],qs[_0x8409('0x7d')](_0x5123d4[_0x8409('0x1d')]['fields']));_0x163228[_0x8409('0x7c')]=_0x163228[_0x8409('0x7c')][_0x8409('0x24')]?_0x163228['attributes']:_0x3a79a0[_0x8409('0x78')];if(!_0x5123d4[_0x8409('0x1d')][_0x8409('0x5b')](_0x8409('0x82'))){_0x163228[_0x8409('0x11')]=qs[_0x8409('0x11')](_0x5123d4[_0x8409('0x1d')]['limit']);_0x163228[_0x8409('0x10')]=qs[_0x8409('0x10')](_0x5123d4[_0x8409('0x1d')][_0x8409('0x10')]);}_0x163228['order']=qs[_0x8409('0x7f')](_0x5123d4[_0x8409('0x1d')][_0x8409('0x7f')]);_0x163228[_0x8409('0x56')]=qs[_0x8409('0x7a')](_[_0x8409('0x80')](_0x5123d4[_0x8409('0x1d')],_0x3a79a0['filters']));_0x163228[_0x8409('0x56')][_0x8409('0x98')]=_0x165dad['id'];if(_0x5123d4[_0x8409('0x1d')][_0x8409('0x81')]){_0x163228[_0x8409('0x56')]=_[_0x8409('0x30')](_0x163228['where'],{'$or':_['map'](_0x163228[_0x8409('0x7c')],function(_0x26c64f){var _0x26e24b={};_0x26e24b[_0x26c64f]={'$like':'%'+_0x5123d4[_0x8409('0x1d')][_0x8409('0x81')]+'%'};return _0x26e24b;})});}_0x163228=_['merge']({},_0x163228,_0x5123d4[_0x8409('0x99')]);return db[_0x8409('0x9c')][_0x8409('0x12')]({'where':_0x163228['where']})[_0x8409('0x15')](function(_0x353eb3){_0x3f9d4a[_0x8409('0x12')]=_0x353eb3;if(_0x5123d4[_0x8409('0x1d')][_0x8409('0x9d')]){_0x163228[_0x8409('0x9e')]=[{'all':!![]}];}return db[_0x8409('0x9c')][_0x8409('0x1c')](_0x163228);})[_0x8409('0x15')](function(_0x3d88db){_0x3f9d4a[_0x8409('0x9a')]=_0x3d88db;return _0x3f9d4a;});}})[_0x8409('0x15')](respondWithFilteredResult(_0x5ad617,_0x163228))['catch'](handleError(_0x5ad617,null));};exports[_0x8409('0x9f')]=function(_0x2b9cc5,_0x45c292){var _0x399b1e={'raw':!![],'where':{}};var _0x26f521={};var _0x15bd92={'count':0x0,'rows':[]};return db[_0x8409('0x20')][_0x8409('0x77')]({'where':{'id':_0x2b9cc5['params']['id']}})['then'](handleEntityNotFound(_0x45c292,null))[_0x8409('0x15')](function(_0x3282cf){if(_0x3282cf){_0x26f521[_0x8409('0x78')]=_[_0x8409('0x2f')](db[_0x8409('0x44')][_0x8409('0x79')]);_0x26f521['query']=_[_0x8409('0x2f')](_0x2b9cc5[_0x8409('0x1d')]);_0x26f521[_0x8409('0x7a')]=_[_0x8409('0x7b')](_0x26f521[_0x8409('0x78')],_0x26f521[_0x8409('0x1d')]);_0x399b1e[_0x8409('0x7c')]=_[_0x8409('0x7b')](_0x26f521['model'],qs[_0x8409('0x7d')](_0x2b9cc5['query'][_0x8409('0x7d')]));_0x399b1e[_0x8409('0x7c')]=_0x399b1e[_0x8409('0x7c')][_0x8409('0x24')]?_0x399b1e[_0x8409('0x7c')]:_0x26f521[_0x8409('0x78')];if(!_0x2b9cc5[_0x8409('0x1d')][_0x8409('0x5b')]('nolimit')){_0x399b1e[_0x8409('0x11')]=qs['limit'](_0x2b9cc5[_0x8409('0x1d')][_0x8409('0x11')]);_0x399b1e[_0x8409('0x10')]=qs[_0x8409('0x10')](_0x2b9cc5[_0x8409('0x1d')][_0x8409('0x10')]);}_0x399b1e[_0x8409('0x7e')]=qs['sort'](_0x2b9cc5[_0x8409('0x1d')]['sort']);_0x399b1e[_0x8409('0x56')]=qs[_0x8409('0x7a')](_[_0x8409('0x80')](_0x2b9cc5['query'],_0x26f521[_0x8409('0x7a')]));_0x399b1e[_0x8409('0x56')][_0x8409('0x98')]=_0x3282cf['id'];if(_0x2b9cc5[_0x8409('0x1d')][_0x8409('0x81')]){_0x399b1e[_0x8409('0x56')]=_[_0x8409('0x30')](_0x399b1e[_0x8409('0x56')],{'$or':_[_0x8409('0x68')](_0x399b1e[_0x8409('0x7c')],function(_0x5402cd){var _0x8d7df4={};_0x8d7df4[_0x5402cd]={'$like':'%'+_0x2b9cc5[_0x8409('0x1d')]['filter']+'%'};return _0x8d7df4;})});}_0x399b1e=_[_0x8409('0x30')]({},_0x399b1e,_0x2b9cc5[_0x8409('0x99')]);return db[_0x8409('0x44')][_0x8409('0x12')]({'where':_0x399b1e[_0x8409('0x56')]})['then'](function(_0x22c29d){_0x15bd92[_0x8409('0x12')]=_0x22c29d;if(_0x2b9cc5[_0x8409('0x1d')][_0x8409('0x9d')]){_0x399b1e[_0x8409('0x9e')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x8409('0x1c')](_0x399b1e);})[_0x8409('0x15')](function(_0x300379){_0x15bd92[_0x8409('0x9a')]=_0x300379;return _0x15bd92;});}})[_0x8409('0x15')](respondWithFilteredResult(_0x45c292,_0x399b1e))[_0x8409('0x1f')](handleError(_0x45c292,null));};exports[_0x8409('0xa0')]=function(_0x28f1ce,_0x3998d8){var _0x41c3ab={'raw':!![],'where':{}};var _0x5567b0={};var _0x2837ee={'count':0x0,'rows':[]};return db[_0x8409('0x20')]['findOne']({'where':{'id':_0x28f1ce[_0x8409('0x21')]['id']}})['then'](handleEntityNotFound(_0x3998d8,null))[_0x8409('0x15')](function(_0x5238e6){if(_0x5238e6){_0x5567b0[_0x8409('0x78')]=_[_0x8409('0x2f')](db['JscriptySessionReport'][_0x8409('0x79')]);_0x5567b0[_0x8409('0x1d')]=_[_0x8409('0x2f')](_0x28f1ce[_0x8409('0x1d')]);_0x5567b0[_0x8409('0x7a')]=_[_0x8409('0x7b')](_0x5567b0[_0x8409('0x78')],_0x5567b0[_0x8409('0x1d')]);_0x41c3ab[_0x8409('0x7c')]=_['intersection'](_0x5567b0['model'],qs[_0x8409('0x7d')](_0x28f1ce[_0x8409('0x1d')][_0x8409('0x7d')]));_0x41c3ab[_0x8409('0x7c')]=_0x41c3ab['attributes'][_0x8409('0x24')]?_0x41c3ab[_0x8409('0x7c')]:_0x5567b0[_0x8409('0x78')];if(!_0x28f1ce[_0x8409('0x1d')][_0x8409('0x5b')]('nolimit')){_0x41c3ab[_0x8409('0x11')]=qs[_0x8409('0x11')](_0x28f1ce[_0x8409('0x1d')]['limit']);_0x41c3ab[_0x8409('0x10')]=qs['offset'](_0x28f1ce[_0x8409('0x1d')]['offset']);}_0x41c3ab['order']=qs[_0x8409('0x7f')](_0x28f1ce[_0x8409('0x1d')][_0x8409('0x7f')]);_0x41c3ab[_0x8409('0x56')]=qs['filters'](_[_0x8409('0x80')](_0x28f1ce[_0x8409('0x1d')],_0x5567b0[_0x8409('0x7a')]));_0x41c3ab[_0x8409('0x56')][_0x8409('0x98')]=_0x5238e6['id'];if(_0x28f1ce[_0x8409('0x1d')]['filter']){_0x41c3ab['where']=_[_0x8409('0x30')](_0x41c3ab[_0x8409('0x56')],{'$or':_[_0x8409('0x68')](_0x41c3ab['attributes'],function(_0x5754af){var _0x44a967={};_0x44a967[_0x5754af]={'$like':'%'+_0x28f1ce[_0x8409('0x1d')][_0x8409('0x81')]+'%'};return _0x44a967;})});}_0x41c3ab=_[_0x8409('0x30')]({},_0x41c3ab,_0x28f1ce[_0x8409('0x99')]);return db[_0x8409('0x4c')]['count']({'where':_0x41c3ab['where']})[_0x8409('0x15')](function(_0x2aef52){_0x2837ee[_0x8409('0x12')]=_0x2aef52;if(_0x28f1ce[_0x8409('0x1d')]['includeAll']){_0x41c3ab[_0x8409('0x9e')]=[{'all':!![]}];}return db[_0x8409('0x4c')][_0x8409('0x1c')](_0x41c3ab);})[_0x8409('0x15')](function(_0x2f954f){_0x2837ee[_0x8409('0x9a')]=_0x2f954f;return _0x2837ee;});}})['then'](respondWithFilteredResult(_0x3998d8,_0x41c3ab))[_0x8409('0x1f')](handleError(_0x3998d8,null));};exports['uploadCsv']=function(_0x14e168,_0x5c4310){try{if(!_0x14e168[_0x8409('0x31')][_0x8409('0x58')]){throw new Error('No\x20ListId\x20specified');}if(!_0x14e168['body'][_0x8409('0xa1')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x14e168[_0x8409('0x31')]['binding_values']){throw new Error(_0x8409('0xa2'));}if(!_0x14e168[_0x8409('0x31')][_0x8409('0xa3')]){throw new Error(_0x8409('0xa4'));}var _0x4a6bc2=_0x14e168['body'][_0x8409('0xa1')]['split'](',');var _0x4b6490=_0x14e168[_0x8409('0x31')][_0x8409('0xa5')][_0x8409('0xa6')](',');if(!_0x4a6bc2[_0x8409('0x24')]||!_0x4b6490[_0x8409('0x24')]||_0x4a6bc2[_0x8409('0x24')]!==_0x4b6490[_0x8409('0x24')]){throw new Error(_0x8409('0xa7'));}_0x14e168[_0x8409('0x31')][_0x8409('0x7d')]=_[_0x8409('0xa8')](_0x4a6bc2,_0x4b6490);if(!_0x14e168[_0x8409('0x31')]['fields'][_0x8409('0x75')]){throw new Error(_0x8409('0xa9'));}if(!_0x14e168['body'][_0x8409('0x7d')][_0x8409('0xaa')]){throw new Error(_0x8409('0xab'));}var _0x5973b5=path[_0x8409('0x35')](config[_0x8409('0xac')],_0x8409('0xad'),_0x14e168[_0x8409('0xae')][_0x8409('0xaf')]);fs[_0x8409('0xb0')](_0x5973b5,parseInt(_0x8409('0xb1'),0x8));var _0x14891e=require(_0x8409('0xb2'))[_0x8409('0xb3')](path[_0x8409('0x35')](__dirname,_0x8409('0xb4')),[_0x5973b5,_0x14e168[_0x8409('0x31')]['binding_keys'],_0x14e168[_0x8409('0x31')][_0x8409('0xa5')],_0x14e168[_0x8409('0x31')][_0x8409('0x58')],_0x14e168['body'][_0x8409('0xb5')],_0x14e168[_0x8409('0x31')][_0x8409('0x55')],_0x14e168[_0x8409('0x31')][_0x8409('0xa3')]]);return _0x5c4310[_0x8409('0x17')](0xc8)[_0x8409('0xf')]({'message':'File\x20uploaded\x20correctly!','pid':_0x14891e[_0x8409('0xb6')]});}catch(_0x2c3f19){return _0x5c4310[_0x8409('0x17')](0x1f4)[_0x8409('0xb7')](_0x2c3f19);}};exports[_0x8409('0xb8')]=function(_0x2556b6,_0xe3bcf6){var _0x6a6418=fs['createReadStream'](_0x2556b6[_0x8409('0xae')]['path']);Papa[_0x8409('0xb9')](_0x6a6418,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x36ede6){return _0xe3bcf6[_0x8409('0x17')](0xc8)['json']({'file':_0x2556b6['file'],'fields':_0x36ede6[_0x8409('0xba')][_0x8409('0x7d')]});}});};exports['import']=function(_0x216cd5,_0x3ac449){return db['User'][_0x8409('0x1c')]({'raw':!![],'attributes':['id'],'where':{'role':_0x8409('0xbb')}})[_0x8409('0x15')](function(_0x2a6448){var _0x568eb3=![];if(!_0x216cd5[_0x8409('0x31')]['ListId']){throw new Error('No\x20ListId\x20specified');}if(!_0x216cd5[_0x8409('0x31')][_0x8409('0xbc')][_0x8409('0x75')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x216cd5[_0x8409('0x31')][_0x8409('0xbc')][_0x8409('0xaa')]){throw new Error(_0x8409('0xab'));}if(!_0x216cd5['body'][_0x8409('0xa3')]){throw new Error(_0x8409('0xa4'));}var _0x4415e9=require('child_process')['fork'](path[_0x8409('0x35')](__dirname,_0x8409('0xbd')),[_0x216cd5['params']['id'],JSON[_0x8409('0xbe')](_0x216cd5[_0x8409('0x31')]),JSON[_0x8409('0xbe')](_0x2a6448)]);_0x4415e9['on']('message',function(){_0x568eb3=!![];return _0x3ac449[_0x8409('0x17')](0xc8)['json']({'message':'start\x20child\x20process\x20correctly!','pid':_0x4415e9[_0x8409('0xb6')]});});_0x4415e9['on'](_0x8409('0xbf'),function(_0x1cf395){if(_0x1cf395&&!_0x568eb3){return _0x3ac449[_0x8409('0x17')](0x1f4)[_0x8409('0xf')]({'message':_0x8409('0xc0'),'pid':_0x4415e9[_0x8409('0xb6')]});}});})[_0x8409('0x1f')](handleError(_0x3ac449,null));};exports[_0x8409('0xc1')]=function(_0xc87690,_0x2460b8){return db[_0x8409('0xc2')][_0x8409('0x1c')]({'raw':!![],'attributes':['id'],'where':{'role':_0x8409('0xbb')}})[_0x8409('0x15')](function(_0x3e6127){var _0x42c736=![];if(!_0xc87690[_0x8409('0x31')][_0x8409('0x58')]){throw new Error(_0x8409('0xc3'));}if(!_0xc87690['body'][_0x8409('0xbc')][_0x8409('0x75')]){throw new Error(_0x8409('0xa9'));}if(!_0xc87690['body']['binding'][_0x8409('0xaa')]){throw new Error(_0x8409('0xab'));}if(!_0xc87690[_0x8409('0x31')][_0x8409('0xa3')]){throw new Error(_0x8409('0xa4'));}var _0x251691=require(_0x8409('0xb2'))[_0x8409('0xb3')](path['join'](__dirname,_0x8409('0xc4')),[_0xc87690[_0x8409('0x21')]['id'],JSON[_0x8409('0xbe')](_0xc87690[_0x8409('0x31')]),JSON['stringify'](_0x3e6127)]);_0x251691['on'](_0x8409('0xc5'),function(){_0x42c736=!![];return _0x2460b8['status'](0xc8)[_0x8409('0xf')]({'message':_0x8409('0xc6'),'pid':_0x251691[_0x8409('0xb6')]});});_0x251691['on'](_0x8409('0xbf'),function(_0x576f5b){if(_0x576f5b&&!_0x42c736){return _0x2460b8['status'](0x1f4)[_0x8409('0xf')]({'message':'error\x20child\x20process','pid':_0x251691['pid']});}});})[_0x8409('0x1f')](handleError(_0x2460b8,null));};exports[_0x8409('0xc7')]=function(_0x5eb225,_0x4a516c){var _0x291ae1=[_0x8409('0xc8'),_0x8409('0xc9'),_0x8409('0xca'),_0x8409('0xcb'),_0x8409('0xcc'),_0x8409('0xcd'),_0x8409('0xce')];var _0x48ecd7={'offset':0x0,'order':qs[_0x8409('0x7f')]('-createdAt')},_0x17f618={'count':0x0,'rows':[]};Promise[_0x8409('0xcf')]()['then'](function(){if(_0x5eb225[_0x8409('0x1d')][_0x8409('0xd0')]){if(!_[_0x8409('0xd1')](_0x291ae1,_0x5eb225[_0x8409('0x1d')][_0x8409('0xd0')]['toLowerCase']())){throw new Error('Invalid\x20channel');}_0x291ae1=[_0x5eb225[_0x8409('0x1d')][_0x8409('0xd0')][_0x8409('0xd2')]()];}if(_0x5eb225[_0x8409('0x1d')][_0x8409('0xd3')]){try{var _0x5d6c4a=JSON[_0x8409('0xb9')](_0x5eb225['query'][_0x8409('0xd3')]);if(!moment(_0x5d6c4a[_0x8409('0x32')])['isValid']()){throw new Error(_0x8409('0xd4'));}if(!moment(_0x5d6c4a['to'])[_0x8409('0xd5')]()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x5a01ae){throw new Error(_0x8409('0xd6'));}}if(!_0x5eb225[_0x8409('0x1d')][_0x8409('0x5b')]('nolimit')){_0x48ecd7['limit']=qs[_0x8409('0x11')](_0x5eb225[_0x8409('0x1d')][_0x8409('0x11')]||0xa);_0x48ecd7['offset']=qs[_0x8409('0x10')](_0x5eb225[_0x8409('0x1d')][_0x8409('0x10')]);}var _0x1c2bb2=_0x291ae1['map'](function(_0x45af17){if(_0x45af17==='voice'){var _0x4a67b7={'attributes':['id','uniqueid',_0x8409('0x2c'),_0x8409('0xd7'),_0x8409('0xd8'),_0x8409('0xd9'),'starttime',_0x8409('0xda'),_0x8409('0xdb'),'note',_0x8409('0xdc'),_0x8409('0xdd'),_0x8409('0xde'),_0x8409('0xdf'),_0x8409('0xe0')],'where':{'ContactId':_0x5eb225[_0x8409('0x21')]['id']},'include':[{'model':db[_0x8409('0xc2')],'as':_0x8409('0xc2'),'attributes':['id',_0x8409('0x1a'),_0x8409('0xe1'),_0x8409('0xe2')]}],'order':[[_0x8409('0xdc'),_0x8409('0xe3')]]};if(_0x5eb225[_0x8409('0x1d')][_0x8409('0xd3')]){_0x4a67b7[_0x8409('0x56')]['createdAt']={'$gte':_0x5d6c4a[_0x8409('0x32')],'$lte':_0x5d6c4a['to']};}return db[_0x8409('0x46')][_0x8409('0xe4')](_0x4a67b7)['then'](function(_0x58ce05){_0x17f618[_0x8409('0x12')]+=_0x58ce05[_0x8409('0x12')];return _[_0x8409('0x68')](_0x58ce05[_0x8409('0x9a')],function(_0x109f56){var _0x31337b=_0x109f56[_0x8409('0x33')]({'plain':!![]});_0x31337b[_0x8409('0xd0')]=_0x45af17;if(_0x31337b['User']){_0x31337b['User']={'id':_0x31337b[_0x8409('0xc2')]['id'],'name':_0x31337b[_0x8409('0xc2')]['name'],'fullname':_0x31337b[_0x8409('0xc2')][_0x8409('0xe1')],'alias':_0x31337b[_0x8409('0xc2')][_0x8409('0xe2')]};}return _0x31337b;});});}else{var _0x27634f=_['startCase'](_0x45af17)+(_0x45af17===_0x8409('0xc9')?'Website':_0x8409('0xe5'));var _0x31b971={'attributes':['id',_0x8409('0xe6'),_0x8409('0xe7'),_0x8409('0xdc'),_0x8409('0xe8'),_0x8409('0xe9'),'secondDisposition',_0x8409('0xea'),_0x8409('0xe0'),_0x27634f+'Id'],'where':{'ContactId':_0x5eb225[_0x8409('0x21')]['id']},'include':[{'model':db[_0x27634f],'as':_0x8409('0xe5'),'attributes':['id','name',_0x8409('0xeb')]},{'model':db[_0x8409('0xc2')],'as':'Owner','attributes':['id','name',_0x8409('0xe1')]},{'model':db[_0x8409('0x5f')],'as':'Tags','attributes':['id',_0x8409('0x1a'),'color'],'through':{'attributes':[]}}],'order':[[_0x8409('0xdc'),_0x8409('0xe3')]]};if(_0x5eb225[_0x8409('0x1d')][_0x8409('0xd3')]){_0x31b971[_0x8409('0x56')][_0x8409('0xdc')]={'$gte':_0x5d6c4a[_0x8409('0x32')],'$lte':_0x5d6c4a['to']};}switch(_0x45af17){case _0x8409('0xc9'):_0x31b971[_0x8409('0x7c')][_0x8409('0x5c')](_0x8409('0xec'),_0x8409('0xed'),_0x8409('0xee'),_0x8409('0xef'),_0x8409('0xf0'),_0x8409('0xf1'),_0x8409('0xf2'),_0x8409('0xf3'),_0x8409('0xf4'));break;case _0x8409('0xc8'):_0x31b971['attributes']['push']('subject',_0x8409('0xf5'));break;case _0x8409('0xcb'):_0x31b971[_0x8409('0x7c')][_0x8409('0x5c')](_0x8409('0xf6'),_0x8409('0xf7'));break;}return db[_[_0x8409('0xf8')](_0x45af17)+_0x8409('0xf9')]['findAndCountAll'](_0x31b971)[_0x8409('0x15')](function(_0x1a84dc){_0x17f618[_0x8409('0x12')]+=_0x1a84dc[_0x8409('0x12')];return _[_0x8409('0x68')](_0x1a84dc[_0x8409('0x9a')],function(_0x284a4b){var _0x5e7e61=_0x284a4b[_0x8409('0x33')]({'plain':!![]});_0x5e7e61[_0x8409('0xd0')]=_0x45af17;if(_0x5e7e61[_0x8409('0xfa')]){_0x5e7e61[_0x8409('0xfa')]={'id':_0x5e7e61[_0x8409('0xfa')]['id'],'name':_0x5e7e61['Owner'][_0x8409('0x1a')],'fullname':_0x5e7e61[_0x8409('0xfa')][_0x8409('0xe1')]};}return _0x5e7e61;});});}});return Promise[_0x8409('0x5d')](_0x1c2bb2);})[_0x8409('0x15')](function(_0x58edb1){return _(_0x58edb1)[_0x8409('0xfb')]()[_0x8409('0xfc')]('createdAt')[_0x8409('0xfd')]()[_0x8409('0xfe')]();})[_0x8409('0x15')](function(_0x351c6d){_0x17f618['rows']=_0x48ecd7[_0x8409('0x11')]?_0x351c6d[_0x8409('0xff')](_0x48ecd7[_0x8409('0x10')],_0x48ecd7[_0x8409('0x10')]+_0x48ecd7[_0x8409('0x11')]):_0x351c6d;return _0x17f618;})[_0x8409('0x15')](respondWithFilteredResult(_0x4a516c,_0x48ecd7))[_0x8409('0x1f')](handleError(_0x4a516c,null));}; \ No newline at end of file +var _0xe2dd=['fork','../../components/import/cm/csv2','stringify','message','pid','exit','error\x20child\x20process','importUpdates','start\x20child\x20process\x20correctly!','getJourney','mail','sms','openchannel','fax','whatsapp','voice','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','duration','note','createdAt','userSecondDisposition','UserId','fullname','DESC','findAndCountAll','chat','Website','closed','closedAt','disposition','secondDisposition','thirdDisposition','Account','key','Owner','Tags','browserName','customerPort','deviceModel','ratingMessage','ratingType','ratingValue','subject','substatus','externalUrl','threadId','startCase','Interaction','flatten','reverse','slice','util','lodash','squel','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/environment/shared','redis','localhost','socket.io-emitter','register','json','undefined','count','offset','status','Content-Range','update','destroy','then','sendStatus','stack','name','send','index','describe','findAll','query','user','find','params','CmContact','tags','keys','length','cf_','columnName','displayName','analytics','CmCustomField','alias','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','hasOwnProperty','catch','merge','body','from','get','mergeWith','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','ReportAgentPreview','VoiceCallReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','$or','ListId','findOrCreate','spread','contact','all','show','color','tag','CmContactHasItem','Phones','ContactItemType','ItemType','$and','push','omit','cf_%d','startsWith','map','format','isEmpty','table','cm_contacts','setFields','id\x20=\x20?','sequelize','text','phone','getTags','model','Tag','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','options','nolimit','limit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','literal','`ItemType`.OrderBy','CmHopperId','item','ItemType.OrderBy','getAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','ContactId','include','rows','getHopperHistories','CmHopperHistory','includeAll','getHopperFinals','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','filename','0777','child_process','../../components/import/cm/csv','File\x20uploaded\x20correctly!','createReadStream','path','parse','meta','import','User','agent','binding','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed'];(function(_0x37e62d,_0x502c7d){var _0x330c2f=function(_0x2f0236){while(--_0x2f0236){_0x37e62d['push'](_0x37e62d['shift']());}};_0x330c2f(++_0x502c7d);}(_0xe2dd,0x142));var _0xde2d=function(_0x256422,_0x367394){_0x256422=_0x256422-0x0;var _0x55dddc=_0xe2dd[_0x256422];return _0x55dddc;};'use strict';var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xde2d('0x0'));var path=require('path');var fs=require('fs');var _=require(_0xde2d('0x1'));var squel=require(_0xde2d('0x2'));var Papa=require(_0xde2d('0x3'));var Redis=require(_0xde2d('0x4'));var contacts=require(_0xde2d('0x5'));var qs=require(_0xde2d('0x6'));var logger=require(_0xde2d('0x7'))('api');var config=require(_0xde2d('0x8'));var shared=require(_0xde2d('0x9'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xde2d('0xa')],{'host':_0xde2d('0xb'),'port':0x18eb});var socket=require(_0xde2d('0xc'))(new Redis(config[_0xde2d('0xa')]));require('./cmContact.socket')[_0xde2d('0xd')](socket);function respondWithResult(_0x433e8c,_0x332fb1){_0x332fb1=_0x332fb1||0xc8;return function(_0x45e8cc){if(_0x45e8cc){return _0x433e8c['status'](_0x332fb1)[_0xde2d('0xe')](_0x45e8cc);}};}function respondWithFilteredResult(_0x4e0f5e,_0x49a69c){return function(_0x88084){if(_0x88084){var _0xac6a8e=typeof _0x49a69c['offset']===_0xde2d('0xf')&&typeof _0x49a69c['limit']===_0xde2d('0xf');var _0x63a6d7=_0x88084[_0xde2d('0x10')];var _0x2f1599=_0xac6a8e?0x0:_0x49a69c[_0xde2d('0x11')];var _0x259889=_0xac6a8e?_0x88084['count']:_0x49a69c[_0xde2d('0x11')]+_0x49a69c['limit'];var _0x429685;if(_0x259889>=_0x63a6d7){_0x259889=_0x63a6d7;_0x429685=0xc8;}else{_0x429685=0xce;}_0x4e0f5e[_0xde2d('0x12')](_0x429685);return _0x4e0f5e['set'](_0xde2d('0x13'),_0x2f1599+'-'+_0x259889+'/'+_0x63a6d7)[_0xde2d('0xe')](_0x88084);}return null;};}function saveUpdates(_0x2470b6){return function(_0x267455){if(_0x267455){return _0x267455[_0xde2d('0x14')](_0x2470b6)['then'](function(_0x177411){return _0x177411;});}return null;};}function removeEntity(_0x184ddb){return function(_0x2bd2de){if(_0x2bd2de){return _0x2bd2de[_0xde2d('0x15')]()[_0xde2d('0x16')](function(){_0x184ddb[_0xde2d('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32ff8d){return function(_0x4b34d7){if(!_0x4b34d7){_0x32ff8d[_0xde2d('0x17')](0x194);}return _0x4b34d7;};}function handleError(_0x1d5ce9,_0x1ee90d){_0x1ee90d=_0x1ee90d||0x1f4;return function(_0x30ad37){logger['error'](_0x30ad37[_0xde2d('0x18')]);if(_0x30ad37['name']){delete _0x30ad37[_0xde2d('0x19')];}_0x1d5ce9['status'](_0x1ee90d)[_0xde2d('0x1a')](_0x30ad37);};}exports[_0xde2d('0x1b')]=function(_0x13156c,_0x4ff8d2){var _0x486719={};return contacts[_0xde2d('0x1c')]()[_0xde2d('0x16')](function(_0x3e3749){_0x486719=qs['getOptions'](_0x3e3749,_0x13156c);return contacts[_0xde2d('0x1d')](_0x13156c[_0xde2d('0x1e')],_0x13156c[_0xde2d('0x1f')],_0x486719,_0x3e3749);})[_0xde2d('0x16')](respondWithFilteredResult(_0x4ff8d2,_0x486719))['catch'](handleError(_0x4ff8d2,null));};exports[_0xde2d('0x15')]=function(_0x4d5629,_0x57c0ec){return db['CmContact'][_0xde2d('0x20')]({'where':{'id':_0x4d5629[_0xde2d('0x21')]['id']}})[_0xde2d('0x16')](handleEntityNotFound(_0x57c0ec,null))[_0xde2d('0x16')](removeEntity(_0x57c0ec,null))['catch'](handleError(_0x57c0ec,null));};exports[_0xde2d('0x1c')]=function(_0xeaf32f,_0x2931c3){return db[_0xde2d('0x22')][_0xde2d('0x1c')]()[_0xde2d('0x16')](function(_0x409b66){delete _0x409b66[_0xde2d('0x23')];for(var _0x5788a0=0x0;_0x5788a00x0){return new Promise(function(_0x5e48df){var _0x2cef32=[];for(var _0x39a423=0x0;_0x39a423<_0x385439[_0xde2d('0x25')];_0x39a423++){_0x2cef32['push'](insertAdditionalPhones(_0x385439[_0x39a423][_0xde2d('0x5f')],_0x385439[_0x39a423]['additionalPhones']));}Promise[_0xde2d('0x60')](_0x2cef32)[_0xde2d('0x16')](function(){_0x5e48df(0x1);});})[_0xde2d('0x16')](function(){return{'success':_0x397f4b,'failure':_0x4257cf,'duplicates':_0x4e6ae1};});}else{return{'success':_0x397f4b,'failure':_0x4257cf,'duplicates':_0x4e6ae1};}}})[_0xde2d('0x16')](respondWithResult(_0x300d89,0xc9))[_0xde2d('0x31')](handleError(_0x300d89,null));};exports[_0xde2d('0x61')]=function(_0x25d53d,_0x5279d4){var _0x2a0054;return db[_0xde2d('0x22')]['describe']()[_0xde2d('0x16')](function(_0x2783f8){return db[_0xde2d('0x22')]['find']({'where':{'id':_0x25d53d[_0xde2d('0x21')]['id']},'include':[{'model':db['Tag'],'as':'Tags','attributes':['id',_0xde2d('0x19'),_0xde2d('0x62')],'required':_0x25d53d[_0xde2d('0x1e')][_0xde2d('0x63')]?!![]:![]},{'model':db[_0xde2d('0x64')],'as':_0xde2d('0x65'),'where':{'CmContactId':_0x25d53d['params']['id']},'required':![],'include':[{'model':db[_0xde2d('0x66')],'as':_0xde2d('0x67')}]}],'order':[db['sequelize']['literal']('Phones.OrderBy')],'attributes':_[_0xde2d('0x24')](_0x2783f8)});})[_0xde2d('0x16')](function(_0x1b7b0e){if(!_[_0xde2d('0x52')](_0x1b7b0e)){_0x2a0054=_0x1b7b0e['get']({'plain':!![]});var _0x529728={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x1b7b0e&&_0x1b7b0e['ListId']){if(_0x1b7b0e[_0xde2d('0x5c')]){_0x529728['where'][_0xde2d('0x68')][_0xde2d('0x69')]({'ListId':{'$ne':_0x1b7b0e[_0xde2d('0x5c')]}});}}return db[_0xde2d('0x2a')][_0xde2d('0x1d')](_0x529728);}})[_0xde2d('0x16')](function(_0x451daf){if(!_['isNil'](_0x451daf)){return _[_0xde2d('0x6a')](_0x2a0054,_['map'](_0x451daf,function(_0x47fe68){return util['format'](_0xde2d('0x6b'),_0x47fe68['id']);}));}})[_0xde2d('0x16')](handleEntityNotFound(_0x5279d4,null))[_0xde2d('0x16')](respondWithResult(_0x5279d4,null))[_0xde2d('0x31')](handleError(_0x5279d4,null));};exports[_0xde2d('0x14')]=function(_0x27a8f0,_0x32995a){var _0x4aba02;if(_0x27a8f0[_0xde2d('0x33')]['id']){delete _0x27a8f0[_0xde2d('0x33')]['id'];}if(!_['isNil'](_0x27a8f0[_0xde2d('0x33')][_0xde2d('0x53')])){var _0x96324=_0x27a8f0['body'][_0xde2d('0x53')];if(!_[_0xde2d('0x52')](shared[_0xde2d('0x54')][_0x96324]))_0x27a8f0['body']['utcOffset']=shared[_0xde2d('0x54')][_0x96324][_0xde2d('0x55')];}return db[_0xde2d('0x22')][_0xde2d('0x20')]({'where':{'id':_0x27a8f0['params']['id']}})[_0xde2d('0x16')](handleEntityNotFound(_0x32995a,null))[_0xde2d('0x16')](saveUpdates(_0x27a8f0['body'],null))[_0xde2d('0x16')](function(_0x308658){_0x4aba02=_0x308658;var _0x485668={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x308658&&_0x308658[_0xde2d('0x5c')]){if(_0x308658['ListId']){_0x485668[_0xde2d('0x5a')][_0xde2d('0x68')]['push']({'ListId':{'$ne':_0x308658[_0xde2d('0x5c')]}});}}return db['CmCustomField']['findAll'](_0x485668);})['then'](function(_0x3cda64){if(_0x3cda64){return _[_0xde2d('0x6a')](_['pickBy'](_0x27a8f0[_0xde2d('0x33')],function(_0x274dbf,_0x3f8c77){return _[_0xde2d('0x6c')](_0x3f8c77,_0xde2d('0x26'));}),_[_0xde2d('0x6d')](_0x3cda64,function(_0x1e3fd9){return util[_0xde2d('0x6e')]('cf_%d',_0x1e3fd9['id']);}));}})[_0xde2d('0x16')](function(_0x2294e2){if(_0x2294e2&&!_[_0xde2d('0x6f')](_0x2294e2)){var _0x45d278=squel['update']()[_0xde2d('0x70')](_0xde2d('0x71'))[_0xde2d('0x72')](_0x2294e2)[_0xde2d('0x5a')](_0xde2d('0x73'),_0x27a8f0['params']['id'])['toParam']();return db[_0xde2d('0x74')][_0xde2d('0x1e')](_0x45d278[_0xde2d('0x75')],{'replacements':_0x45d278[_0xde2d('0x2d')]});}})[_0xde2d('0x16')](function(){if(_0x27a8f0[_0xde2d('0x33')][_0xde2d('0x76')]&&_0x4aba02){return db['CmHopper'][_0xde2d('0x14')]({'phone':_0x27a8f0[_0xde2d('0x33')][_0xde2d('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x4aba02['id']}});}})[_0xde2d('0x16')](function(){return _0x4aba02;})[_0xde2d('0x16')](respondWithResult(_0x32995a,null))[_0xde2d('0x31')](handleError(_0x32995a,null));};exports[_0xde2d('0x77')]=function(_0x53c5b8,_0x451adb){var _0x23c1f4={};var _0x5cf50b={};var _0x412ffa;var _0xf963d;return db[_0xde2d('0x22')]['findOne']({'where':{'id':_0x53c5b8[_0xde2d('0x21')]['id']}})[_0xde2d('0x16')](handleEntityNotFound(_0x451adb,null))[_0xde2d('0x16')](function(_0x183049){if(_0x183049){_0x412ffa=_0x183049;_0x5cf50b[_0xde2d('0x78')]=_[_0xde2d('0x24')](db[_0xde2d('0x79')][_0xde2d('0x7a')]);_0x5cf50b[_0xde2d('0x1e')]=_[_0xde2d('0x24')](_0x53c5b8[_0xde2d('0x1e')]);_0x5cf50b[_0xde2d('0x7b')]=_[_0xde2d('0x7c')](_0x5cf50b[_0xde2d('0x78')],_0x5cf50b[_0xde2d('0x1e')]);_0x23c1f4[_0xde2d('0x7d')]=_[_0xde2d('0x7c')](_0x5cf50b[_0xde2d('0x78')],qs['fields'](_0x53c5b8[_0xde2d('0x1e')][_0xde2d('0x7e')]));_0x23c1f4[_0xde2d('0x7d')]=_0x23c1f4[_0xde2d('0x7d')][_0xde2d('0x25')]?_0x23c1f4[_0xde2d('0x7d')]:_0x5cf50b[_0xde2d('0x78')];_0x23c1f4[_0xde2d('0x7f')]=qs[_0xde2d('0x80')](_0x53c5b8[_0xde2d('0x1e')][_0xde2d('0x80')]);_0x23c1f4[_0xde2d('0x5a')]=qs[_0xde2d('0x7b')](_[_0xde2d('0x81')](_0x53c5b8[_0xde2d('0x1e')],_0x5cf50b[_0xde2d('0x7b')]));if(_0x53c5b8[_0xde2d('0x1e')][_0xde2d('0x82')]){_0x23c1f4[_0xde2d('0x5a')]=_[_0xde2d('0x32')](_0x23c1f4[_0xde2d('0x5a')],{'$or':_[_0xde2d('0x6d')](_0x23c1f4[_0xde2d('0x7d')],function(_0x5be837){var _0xec8ffd={};_0xec8ffd[_0x5be837]={'$like':'%'+_0x53c5b8[_0xde2d('0x1e')][_0xde2d('0x82')]+'%'};return _0xec8ffd;})});}_0x23c1f4=_[_0xde2d('0x32')]({},_0x23c1f4,_0x53c5b8[_0xde2d('0x83')]);return _0x412ffa[_0xde2d('0x77')](_0x23c1f4);}})['then'](function(_0x1dc203){if(_0x1dc203){_0xf963d=_0x1dc203[_0xde2d('0x25')];if(!_0x53c5b8['query'][_0xde2d('0x30')](_0xde2d('0x84'))){_0x23c1f4[_0xde2d('0x85')]=qs['limit'](_0x53c5b8[_0xde2d('0x1e')][_0xde2d('0x85')]);_0x23c1f4[_0xde2d('0x11')]=qs['offset'](_0x53c5b8[_0xde2d('0x1e')][_0xde2d('0x11')]);}return _0x412ffa[_0xde2d('0x77')](_0x23c1f4);}})['then'](function(_0x3f3fd2){if(_0x3f3fd2){return _0x3f3fd2?{'count':_0xf963d,'rows':_0x3f3fd2}:null;}})[_0xde2d('0x16')](respondWithResult(_0x451adb,null))[_0xde2d('0x31')](handleError(_0x451adb,null));};exports[_0xde2d('0x86')]=function(_0x3792c9,_0x3a8b9d){if(_0x3792c9[_0xde2d('0x33')]['id']){delete _0x3792c9[_0xde2d('0x33')]['id'];}return db['CmContact'][_0xde2d('0x87')]({'where':{'id':_0x3792c9[_0xde2d('0x21')]['id']}})['then'](handleEntityNotFound(_0x3a8b9d,null))[_0xde2d('0x16')](function(_0x492a71){if(_0x492a71){return _0x492a71[_0xde2d('0x86')](_0x3792c9[_0xde2d('0x33')][_0xde2d('0x88')]||[]);}return null;})[_0xde2d('0x16')](respondWithResult(_0x3a8b9d,null))[_0xde2d('0x31')](handleError(_0x3a8b9d,null));};exports[_0xde2d('0x89')]=function(_0x192ab5,_0x27b763){var _0x38d2ff=[];_0x38d2ff[_0xde2d('0x69')](addAdditionalPhones(_0x192ab5[_0xde2d('0x33')]));Promise['all'](_0x38d2ff)[_0xde2d('0x16')](function(){_0x38d2ff=[];_0x38d2ff['push'](deleteCmHopperPhones(_0x192ab5[_0xde2d('0x33')]['id']));_0x38d2ff[_0xde2d('0x69')](addCmHopperPhones(_0x192ab5[_0xde2d('0x33')]['id']));Promise['all'](_0x38d2ff)[_0xde2d('0x16')](function(){return[0x1];})[_0xde2d('0x16')](respondWithResult(_0x27b763,null));});};function addAdditionalPhones(_0x4fd7ef){var _0xae1ce8;return new Promise(function(_0x59dff2){return db[_0xde2d('0x64')]['destroy']({'where':{'CmContactId':_0x4fd7ef['id']}})[_0xde2d('0x16')](function(){db['ContactItemType'][_0xde2d('0x1d')]({'raw':!![],'attributes':['id',_0xde2d('0x8a')]})[_0xde2d('0x16')](function(_0x40c059){var _0x230113=[];for(var _0x487c79=0x0;_0x487c79<_0x4fd7ef[_0xde2d('0x8b')][_0xde2d('0x25')];_0x487c79++){var _0x47ce59=_0x4fd7ef[_0xde2d('0x8c')]?_['isNil'](_0x4fd7ef[_0xde2d('0x8c')][_0x487c79])?'':_0x4fd7ef[_0xde2d('0x8c')][_0x487c79]:_0x4fd7ef['items'][_0x487c79]['ItemTypeId']?_0x4fd7ef['items'][_0x487c79][_0xde2d('0x8d')]:'';var _0x47d9bf=_['isNil'](_0x4fd7ef[_0xde2d('0x8b')][_0x487c79][_0xde2d('0x8e')])?'':_0x4fd7ef[_0xde2d('0x8b')][_0x487c79][_0xde2d('0x8e')];var _0x371f00=_0x47ce59+':'+_0x4fd7ef['items'][_0x487c79]['phone']+'§'+_0x47d9bf;if(_['isNil'](_0xae1ce8))_0xae1ce8=_0x371f00;else _0xae1ce8+=';'+_0x371f00;var _0x13ee9f=null;var _0x3789ac=null;if(_0x4fd7ef[_0xde2d('0x8c')]){if(!_[_0xde2d('0x52')](_0x4fd7ef[_0xde2d('0x8c')][_0x487c79])){_0x3789ac=_['find'](_0x40c059,function(_0xabc52f){return _0xabc52f['id']===_0x4fd7ef[_0xde2d('0x8c')][_0x487c79];});if(!_[_0xde2d('0x52')](_0x3789ac)){_0x13ee9f=_0x3789ac['OrderBy'];}}}else{if(!_[_0xde2d('0x52')](_0x4fd7ef[_0xde2d('0x8b')][_0x487c79])){_0x3789ac=_['find'](_0x40c059,function(_0x3b852e){return _0x3b852e['id']===_0x4fd7ef[_0xde2d('0x8b')][_0x487c79]['ItemTypeId'];});if(!_[_0xde2d('0x52')](_0x3789ac)){_0x13ee9f=_0x487c79;}}}if(_['isNil'](_0x13ee9f)){_0x13ee9f=0x64;}_0x230113[_0xde2d('0x69')](addAdditionalPhone(_0x4fd7ef['id'],_0x4fd7ef['items'][_0x487c79][_0xde2d('0x76')],_0x4fd7ef[_0xde2d('0x8c')]?_['isNil'](_0x4fd7ef[_0xde2d('0x8c')][_0x487c79])?null:_0x4fd7ef[_0xde2d('0x8c')][_0x487c79]:_0x4fd7ef[_0xde2d('0x8b')][_0x487c79][_0xde2d('0x8d')]?_0x4fd7ef[_0xde2d('0x8b')][_0x487c79][_0xde2d('0x8d')]:null,_0x13ee9f,_0x47d9bf));}Promise[_0xde2d('0x60')](_0x230113)['then'](function(){db['CmContact']['update']({'AdditionalPhones':_0xae1ce8},{'where':{'id':_0x4fd7ef['id']}})['then'](function(){_0x59dff2(0x1);});});});});});}function addAdditionalPhone(_0x1f4c4f,_0x1f9190,_0x3a81ce,_0x53cb00,_0x494976){return db[_0xde2d('0x64')][_0xde2d('0x20')]({'where':{'CmContactId':_0x1f4c4f,'item':_0x1f9190}})[_0xde2d('0x16')](function(_0x51eca1){if(_0x51eca1)logger[_0xde2d('0x2e')](_0xde2d('0x8f'),_0x51eca1);else{db['CmContactHasItem']['create']({'CmContactId':_0x1f4c4f,'item':_0x1f9190,'ItemTypeId':_0x3a81ce,'OrderBy':_0x53cb00,'ItemClass':_0xde2d('0x90'),'description':_0x494976});}});}function deleteCmHopperPhones(_0x1d96ff){return new Promise(function(_0x5d2440){return db[_0xde2d('0x3a')][_0xde2d('0x1d')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d96ff}})['then'](function(_0x20b3b5){db[_0xde2d('0x91')][_0xde2d('0x15')]({'where':{'CmHopperId':{'$in':_['map'](_0x20b3b5,'id')}}});})[_0xde2d('0x16')](function(){_0x5d2440(0x1);});});}function addCmHopperPhones(_0x5acfa6){return new Promise(function(_0x59f4fc){return db[_0xde2d('0x3a')][_0xde2d('0x1d')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x5acfa6}})[_0xde2d('0x16')](function(_0x46d090){var _0x530eb5=[];_[_0xde2d('0x6d')](_0x46d090,function(_0x1d76be){_0x530eb5[_0xde2d('0x69')](createCmHopperPhone(_0x5acfa6,_0x1d76be['id']));});Promise['all'](_0x530eb5)[_0xde2d('0x16')](function(){_0x59f4fc(0x1);});});});}function createCmHopperPhone(_0xc01fe4,_0x395c2a){return new Promise(function(_0x460257){db[_0xde2d('0x64')][_0xde2d('0x1d')]({'raw':!![],'attributes':['item',_0xde2d('0x8a')],'where':{'CmContactId':_0xc01fe4,'ItemClass':_0xde2d('0x90')},'include':[{'model':db[_0xde2d('0x66')],'attributes':[_0xde2d('0x8a')],'as':_0xde2d('0x67')}],'order':[_0xde2d('0x8a'),db['sequelize'][_0xde2d('0x92')](_0xde2d('0x93'))]})[_0xde2d('0x16')](function(_0x1e0946){var _0x1b0e25=0x1;var _0x29aa9b=_['map'](_0x1e0946,function(_0x25ac0b){_0x25ac0b[_0xde2d('0x94')]=_0x395c2a;_0x25ac0b['phone']=_0x25ac0b[_0xde2d('0x95')];_0x25ac0b['OrderBy']=_0x1b0e25;delete _0x25ac0b[_0xde2d('0x96')];_0x1b0e25=_0x1b0e25+0x1;return _0x25ac0b;});return db['CmHopperAdditionalPhone']['bulkCreate'](_0x29aa9b,{});})[_0xde2d('0x16')](function(){_0x460257(0x1);});});}function insertAdditionalPhones(_0xef32b7,_0x362df8){return new Promise(function(_0x44d864){var _0xa22f37=[];for(var _0xd27bcb=0x0;_0xd27bcb<_0x362df8[_0xde2d('0x25')];_0xd27bcb++){var _0x57a16e=_0x362df8[_0xd27bcb];_0xa22f37[_0xde2d('0x69')](parseContactItemType(_0x57a16e));}Promise[_0xde2d('0x60')](_0xa22f37)[_0xde2d('0x16')](function(){var _0x991a94={'id':_0xef32b7['id'],'items':_0x362df8};return addAdditionalPhones(_0x991a94)['then'](function(){return addCmHopperPhones(_0xef32b7['id']);});})['then'](function(){_0x44d864(_0xef32b7);});});}function parseContactItemType(_0x2ef11d){return new Promise(function(_0x300ad9){if(_0x2ef11d['hasOwnProperty']('ItemTypeId')){_0x300ad9(_0x2ef11d);}else{return db[_0xde2d('0x66')][_0xde2d('0x20')]({'where':{'name':_0x2ef11d['ItemType']}})[_0xde2d('0x16')](function(_0x233840){if(_[_0xde2d('0x52')](_0x233840))_0x2ef11d[_0xde2d('0x8d')]=null;else _0x2ef11d[_0xde2d('0x8d')]=_0x233840['id'];_0x300ad9(_0x2ef11d);});}});}exports[_0xde2d('0x97')]=function(_0x271edf,_0x5153d5){return db[_0xde2d('0x64')][_0xde2d('0x1d')]({'raw':!![],'where':{'CmContactId':_0x271edf['params']['id'],'ItemClass':_0xde2d('0x90')},'include':[{'model':db['ContactItemType'],'as':_0xde2d('0x67')}],'order':[[_0xde2d('0x8a')],[db[_0xde2d('0x74')][_0xde2d('0x92')](_0xde2d('0x93'))]]})[_0xde2d('0x16')](function(_0x252bb9){return _0x252bb9;})[_0xde2d('0x16')](respondWithResult(_0x5153d5,null))[_0xde2d('0x31')](handleError(_0x5153d5,null));};exports['duplicateAdditionalPhones']=function(_0x36d008,_0x3066ca){return db[_0xde2d('0x64')][_0xde2d('0x1d')]({'raw':!![],'where':{'CmContactId':_0x36d008[_0xde2d('0x33')][_0xde2d('0x98')]}})[_0xde2d('0x16')](function(_0x53efb6){var _0x21d16d=_[_0xde2d('0x6d')](_0x53efb6,function(_0x136f6d){_0x136f6d[_0xde2d('0x99')]=_0x36d008['body'][_0xde2d('0x9a')];return _0x136f6d;});return db[_0xde2d('0x64')]['bulkCreate'](_0x21d16d,{});})[_0xde2d('0x16')](function(){return addCmHopperPhones(_0x36d008[_0xde2d('0x33')][_0xde2d('0x9a')]);})[_0xde2d('0x16')](function(){return['ok'];})[_0xde2d('0x16')](respondWithResult(_0x3066ca,null))[_0xde2d('0x31')](handleError(_0x3066ca,null));};exports[_0xde2d('0x9b')]=function(_0x8569a,_0x53877c){var _0x53367f=[];_0x53367f[_0xde2d('0x69')](createCmHopperPhone(_0x8569a[_0xde2d('0x33')]['id'],_0x8569a[_0xde2d('0x33')][_0xde2d('0x9c')]));Promise['all'](_0x53367f)[_0xde2d('0x16')](function(){return[0x1];})[_0xde2d('0x16')](respondWithResult(_0x53877c,null));};exports[_0xde2d('0x9d')]=function(_0x591c51,_0x758f60){var _0x26487c={'raw':![],'where':{}};var _0x15a7a0={};var _0x3720fa={'count':0x0,'rows':[]};return db[_0xde2d('0x22')][_0xde2d('0x87')]({'where':{'id':_0x591c51['params']['id']}})[_0xde2d('0x16')](handleEntityNotFound(_0x758f60,null))[_0xde2d('0x16')](function(_0x47396b){if(_0x47396b){_0x15a7a0[_0xde2d('0x78')]=_[_0xde2d('0x24')](db[_0xde2d('0x3a')][_0xde2d('0x7a')]);_0x15a7a0[_0xde2d('0x1e')]=_[_0xde2d('0x24')](_0x591c51[_0xde2d('0x1e')]);_0x15a7a0['filters']=_[_0xde2d('0x7c')](_0x15a7a0[_0xde2d('0x78')],_0x15a7a0[_0xde2d('0x1e')]);_0x26487c[_0xde2d('0x7d')]=_[_0xde2d('0x7c')](_0x15a7a0['model'],qs[_0xde2d('0x7e')](_0x591c51['query'][_0xde2d('0x7e')]));_0x26487c[_0xde2d('0x7d')]=_0x26487c[_0xde2d('0x7d')]['length']?_0x26487c['attributes']:_0x15a7a0[_0xde2d('0x78')];if(!_0x591c51[_0xde2d('0x1e')][_0xde2d('0x30')](_0xde2d('0x84'))){_0x26487c[_0xde2d('0x85')]=qs[_0xde2d('0x85')](_0x591c51[_0xde2d('0x1e')][_0xde2d('0x85')]);_0x26487c['offset']=qs[_0xde2d('0x11')](_0x591c51[_0xde2d('0x1e')][_0xde2d('0x11')]);}_0x26487c[_0xde2d('0x7f')]=qs[_0xde2d('0x80')](_0x591c51[_0xde2d('0x1e')][_0xde2d('0x80')]);_0x26487c[_0xde2d('0x5a')]=qs[_0xde2d('0x7b')](_[_0xde2d('0x81')](_0x591c51[_0xde2d('0x1e')],_0x15a7a0['filters']));_0x26487c['where'][_0xde2d('0x9e')]=_0x47396b['id'];if(_0x591c51[_0xde2d('0x1e')][_0xde2d('0x82')]){_0x26487c[_0xde2d('0x5a')]=_[_0xde2d('0x32')](_0x26487c[_0xde2d('0x5a')],{'$or':_[_0xde2d('0x6d')](_0x26487c[_0xde2d('0x7d')],function(_0x258453){var _0x352f1e={};_0x352f1e[_0x258453]={'$like':'%'+_0x591c51['query'][_0xde2d('0x82')]+'%'};return _0x352f1e;})});}_0x26487c=_[_0xde2d('0x32')]({},_0x26487c,_0x591c51[_0xde2d('0x83')]);return db[_0xde2d('0x3a')]['count']({'where':_0x26487c[_0xde2d('0x5a')]})['then'](function(_0x20eab5){_0x3720fa[_0xde2d('0x10')]=_0x20eab5;if(_0x591c51[_0xde2d('0x1e')]['includeAll']){_0x26487c[_0xde2d('0x9f')]=[{'all':!![]}];}return db[_0xde2d('0x3a')][_0xde2d('0x1d')](_0x26487c);})['then'](function(_0x585797){_0x3720fa[_0xde2d('0xa0')]=_0x585797;return _0x3720fa;});}})[_0xde2d('0x16')](respondWithFilteredResult(_0x758f60,_0x26487c))[_0xde2d('0x31')](handleError(_0x758f60,null));};exports[_0xde2d('0xa1')]=function(_0x198aaa,_0x51a28e){var _0x2d3ce1={'raw':!![],'where':{}};var _0x3ff065={};var _0x1afb5b={'count':0x0,'rows':[]};return db[_0xde2d('0x22')][_0xde2d('0x87')]({'where':{'id':_0x198aaa[_0xde2d('0x21')]['id']}})[_0xde2d('0x16')](handleEntityNotFound(_0x51a28e,null))[_0xde2d('0x16')](function(_0x17e428){if(_0x17e428){_0x3ff065[_0xde2d('0x78')]=_[_0xde2d('0x24')](db[_0xde2d('0xa2')][_0xde2d('0x7a')]);_0x3ff065['query']=_[_0xde2d('0x24')](_0x198aaa[_0xde2d('0x1e')]);_0x3ff065[_0xde2d('0x7b')]=_[_0xde2d('0x7c')](_0x3ff065[_0xde2d('0x78')],_0x3ff065[_0xde2d('0x1e')]);_0x2d3ce1[_0xde2d('0x7d')]=_[_0xde2d('0x7c')](_0x3ff065[_0xde2d('0x78')],qs[_0xde2d('0x7e')](_0x198aaa['query'][_0xde2d('0x7e')]));_0x2d3ce1[_0xde2d('0x7d')]=_0x2d3ce1[_0xde2d('0x7d')]['length']?_0x2d3ce1[_0xde2d('0x7d')]:_0x3ff065[_0xde2d('0x78')];if(!_0x198aaa[_0xde2d('0x1e')][_0xde2d('0x30')]('nolimit')){_0x2d3ce1['limit']=qs[_0xde2d('0x85')](_0x198aaa[_0xde2d('0x1e')]['limit']);_0x2d3ce1['offset']=qs['offset'](_0x198aaa['query'][_0xde2d('0x11')]);}_0x2d3ce1[_0xde2d('0x7f')]=qs[_0xde2d('0x80')](_0x198aaa['query'][_0xde2d('0x80')]);_0x2d3ce1['where']=qs['filters'](_[_0xde2d('0x81')](_0x198aaa[_0xde2d('0x1e')],_0x3ff065['filters']));_0x2d3ce1[_0xde2d('0x5a')][_0xde2d('0x9e')]=_0x17e428['id'];if(_0x198aaa[_0xde2d('0x1e')][_0xde2d('0x82')]){_0x2d3ce1[_0xde2d('0x5a')]=_[_0xde2d('0x32')](_0x2d3ce1[_0xde2d('0x5a')],{'$or':_[_0xde2d('0x6d')](_0x2d3ce1[_0xde2d('0x7d')],function(_0x12e48d){var _0x14ce68={};_0x14ce68[_0x12e48d]={'$like':'%'+_0x198aaa['query'][_0xde2d('0x82')]+'%'};return _0x14ce68;})});}_0x2d3ce1=_[_0xde2d('0x32')]({},_0x2d3ce1,_0x198aaa['options']);return db[_0xde2d('0xa2')]['count']({'where':_0x2d3ce1[_0xde2d('0x5a')]})[_0xde2d('0x16')](function(_0xa5e806){_0x1afb5b['count']=_0xa5e806;if(_0x198aaa['query'][_0xde2d('0xa3')]){_0x2d3ce1[_0xde2d('0x9f')]=[{'all':!![]}];}return db[_0xde2d('0xa2')][_0xde2d('0x1d')](_0x2d3ce1);})[_0xde2d('0x16')](function(_0x491d29){_0x1afb5b['rows']=_0x491d29;return _0x1afb5b;});}})['then'](respondWithFilteredResult(_0x51a28e,_0x2d3ce1))[_0xde2d('0x31')](handleError(_0x51a28e,null));};exports[_0xde2d('0xa4')]=function(_0x3e8e33,_0x99bfe4){var _0x25cd82={'raw':!![],'where':{}};var _0xdfc301={};var _0x54e608={'count':0x0,'rows':[]};return db['CmContact'][_0xde2d('0x87')]({'where':{'id':_0x3e8e33[_0xde2d('0x21')]['id']}})['then'](handleEntityNotFound(_0x99bfe4,null))[_0xde2d('0x16')](function(_0x226224){if(_0x226224){_0xdfc301['model']=_[_0xde2d('0x24')](db['CmHopperFinal']['rawAttributes']);_0xdfc301[_0xde2d('0x1e')]=_[_0xde2d('0x24')](_0x3e8e33[_0xde2d('0x1e')]);_0xdfc301['filters']=_[_0xde2d('0x7c')](_0xdfc301[_0xde2d('0x78')],_0xdfc301[_0xde2d('0x1e')]);_0x25cd82[_0xde2d('0x7d')]=_[_0xde2d('0x7c')](_0xdfc301[_0xde2d('0x78')],qs[_0xde2d('0x7e')](_0x3e8e33[_0xde2d('0x1e')][_0xde2d('0x7e')]));_0x25cd82[_0xde2d('0x7d')]=_0x25cd82[_0xde2d('0x7d')][_0xde2d('0x25')]?_0x25cd82[_0xde2d('0x7d')]:_0xdfc301['model'];if(!_0x3e8e33[_0xde2d('0x1e')]['hasOwnProperty'](_0xde2d('0x84'))){_0x25cd82[_0xde2d('0x85')]=qs[_0xde2d('0x85')](_0x3e8e33['query'][_0xde2d('0x85')]);_0x25cd82['offset']=qs['offset'](_0x3e8e33['query']['offset']);}_0x25cd82[_0xde2d('0x7f')]=qs[_0xde2d('0x80')](_0x3e8e33[_0xde2d('0x1e')][_0xde2d('0x80')]);_0x25cd82[_0xde2d('0x5a')]=qs[_0xde2d('0x7b')](_[_0xde2d('0x81')](_0x3e8e33[_0xde2d('0x1e')],_0xdfc301[_0xde2d('0x7b')]));_0x25cd82[_0xde2d('0x5a')][_0xde2d('0x9e')]=_0x226224['id'];if(_0x3e8e33[_0xde2d('0x1e')][_0xde2d('0x82')]){_0x25cd82['where']=_[_0xde2d('0x32')](_0x25cd82['where'],{'$or':_[_0xde2d('0x6d')](_0x25cd82['attributes'],function(_0x26cf1d){var _0x70ed6c={};_0x70ed6c[_0x26cf1d]={'$like':'%'+_0x3e8e33['query'][_0xde2d('0x82')]+'%'};return _0x70ed6c;})});}_0x25cd82=_[_0xde2d('0x32')]({},_0x25cd82,_0x3e8e33[_0xde2d('0x83')]);return db['CmHopperFinal'][_0xde2d('0x10')]({'where':_0x25cd82[_0xde2d('0x5a')]})[_0xde2d('0x16')](function(_0x145eb6){_0x54e608[_0xde2d('0x10')]=_0x145eb6;if(_0x3e8e33[_0xde2d('0x1e')]['includeAll']){_0x25cd82[_0xde2d('0x9f')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xde2d('0x1d')](_0x25cd82);})[_0xde2d('0x16')](function(_0x26be5e){_0x54e608[_0xde2d('0xa0')]=_0x26be5e;return _0x54e608;});}})[_0xde2d('0x16')](respondWithFilteredResult(_0x99bfe4,_0x25cd82))['catch'](handleError(_0x99bfe4,null));};exports[_0xde2d('0xa5')]=function(_0x1c382b,_0x51ff55){var _0x3dd3b8={'raw':!![],'where':{}};var _0x3b0188={};var _0x399b1a={'count':0x0,'rows':[]};return db[_0xde2d('0x22')][_0xde2d('0x87')]({'where':{'id':_0x1c382b[_0xde2d('0x21')]['id']}})['then'](handleEntityNotFound(_0x51ff55,null))[_0xde2d('0x16')](function(_0x176c39){if(_0x176c39){_0x3b0188[_0xde2d('0x78')]=_[_0xde2d('0x24')](db[_0xde2d('0x4e')][_0xde2d('0x7a')]);_0x3b0188[_0xde2d('0x1e')]=_[_0xde2d('0x24')](_0x1c382b['query']);_0x3b0188[_0xde2d('0x7b')]=_['intersection'](_0x3b0188[_0xde2d('0x78')],_0x3b0188[_0xde2d('0x1e')]);_0x3dd3b8[_0xde2d('0x7d')]=_[_0xde2d('0x7c')](_0x3b0188[_0xde2d('0x78')],qs[_0xde2d('0x7e')](_0x1c382b[_0xde2d('0x1e')]['fields']));_0x3dd3b8[_0xde2d('0x7d')]=_0x3dd3b8[_0xde2d('0x7d')][_0xde2d('0x25')]?_0x3dd3b8[_0xde2d('0x7d')]:_0x3b0188[_0xde2d('0x78')];if(!_0x1c382b[_0xde2d('0x1e')]['hasOwnProperty']('nolimit')){_0x3dd3b8[_0xde2d('0x85')]=qs[_0xde2d('0x85')](_0x1c382b[_0xde2d('0x1e')][_0xde2d('0x85')]);_0x3dd3b8[_0xde2d('0x11')]=qs[_0xde2d('0x11')](_0x1c382b[_0xde2d('0x1e')]['offset']);}_0x3dd3b8[_0xde2d('0x7f')]=qs[_0xde2d('0x80')](_0x1c382b[_0xde2d('0x1e')][_0xde2d('0x80')]);_0x3dd3b8[_0xde2d('0x5a')]=qs['filters'](_['pick'](_0x1c382b[_0xde2d('0x1e')],_0x3b0188[_0xde2d('0x7b')]));_0x3dd3b8['where']['ContactId']=_0x176c39['id'];if(_0x1c382b[_0xde2d('0x1e')][_0xde2d('0x82')]){_0x3dd3b8[_0xde2d('0x5a')]=_[_0xde2d('0x32')](_0x3dd3b8[_0xde2d('0x5a')],{'$or':_['map'](_0x3dd3b8[_0xde2d('0x7d')],function(_0x51bda3){var _0x522f7d={};_0x522f7d[_0x51bda3]={'$like':'%'+_0x1c382b['query'][_0xde2d('0x82')]+'%'};return _0x522f7d;})});}_0x3dd3b8=_[_0xde2d('0x32')]({},_0x3dd3b8,_0x1c382b['options']);return db[_0xde2d('0x4e')]['count']({'where':_0x3dd3b8[_0xde2d('0x5a')]})[_0xde2d('0x16')](function(_0xe9e9aa){_0x399b1a[_0xde2d('0x10')]=_0xe9e9aa;if(_0x1c382b[_0xde2d('0x1e')][_0xde2d('0xa3')]){_0x3dd3b8[_0xde2d('0x9f')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xde2d('0x1d')](_0x3dd3b8);})[_0xde2d('0x16')](function(_0x5b2416){_0x399b1a[_0xde2d('0xa0')]=_0x5b2416;return _0x399b1a;});}})[_0xde2d('0x16')](respondWithFilteredResult(_0x51ff55,_0x3dd3b8))[_0xde2d('0x31')](handleError(_0x51ff55,null));};exports[_0xde2d('0xa6')]=function(_0x346d8d,_0x5dabce){try{if(!_0x346d8d[_0xde2d('0x33')][_0xde2d('0x5c')]){throw new Error(_0xde2d('0xa7'));}if(!_0x346d8d[_0xde2d('0x33')][_0xde2d('0xa8')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x346d8d['body'][_0xde2d('0xa9')]){throw new Error(_0xde2d('0xaa'));}if(!_0x346d8d[_0xde2d('0x33')][_0xde2d('0xab')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x451be8=_0x346d8d[_0xde2d('0x33')]['binding_keys']['split'](',');var _0x2b6bf3=_0x346d8d['body'][_0xde2d('0xa9')][_0xde2d('0xac')](',');if(!_0x451be8[_0xde2d('0x25')]||!_0x2b6bf3[_0xde2d('0x25')]||_0x451be8['length']!==_0x2b6bf3[_0xde2d('0x25')]){throw new Error(_0xde2d('0xad'));}_0x346d8d[_0xde2d('0x33')]['fields']=_[_0xde2d('0xae')](_0x451be8,_0x2b6bf3);if(!_0x346d8d[_0xde2d('0x33')][_0xde2d('0x7e')][_0xde2d('0x76')]){throw new Error(_0xde2d('0xaf'));}if(!_0x346d8d[_0xde2d('0x33')]['fields'][_0xde2d('0xb0')]){throw new Error(_0xde2d('0xb1'));}var _0x46bab3=path['join'](config[_0xde2d('0xb2')],'server/files/tmp',_0x346d8d[_0xde2d('0xb3')][_0xde2d('0xb4')]);fs['chmodSync'](_0x46bab3,parseInt(_0xde2d('0xb5'),0x8));var _0x594ff1=require(_0xde2d('0xb6'))['fork'](path[_0xde2d('0x38')](__dirname,_0xde2d('0xb7')),[_0x46bab3,_0x346d8d[_0xde2d('0x33')]['binding_keys'],_0x346d8d[_0xde2d('0x33')][_0xde2d('0xa9')],_0x346d8d[_0xde2d('0x33')]['ListId'],_0x346d8d[_0xde2d('0x33')]['CompanyId'],_0x346d8d['body']['duplicates'],_0x346d8d['body']['socket_timestamp']]);return _0x5dabce['status'](0xc8)[_0xde2d('0xe')]({'message':_0xde2d('0xb8'),'pid':_0x594ff1['pid']});}catch(_0x5d1aa2){return _0x5dabce[_0xde2d('0x12')](0x1f4)['send'](_0x5d1aa2);}};exports['upload']=function(_0x6d65ee,_0x4c8cd1){var _0x5311bd=fs[_0xde2d('0xb9')](_0x6d65ee[_0xde2d('0xb3')][_0xde2d('0xba')]);Papa[_0xde2d('0xbb')](_0x5311bd,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x547f38){return _0x4c8cd1[_0xde2d('0x12')](0xc8)['json']({'file':_0x6d65ee[_0xde2d('0xb3')],'fields':_0x547f38[_0xde2d('0xbc')]['fields']});}});};exports[_0xde2d('0xbd')]=function(_0x5e755d,_0x562498){return db[_0xde2d('0xbe')][_0xde2d('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0xde2d('0xbf')}})[_0xde2d('0x16')](function(_0x5b126d){var _0x4da5eb=![];if(!_0x5e755d[_0xde2d('0x33')][_0xde2d('0x5c')]){throw new Error(_0xde2d('0xa7'));}if(!_0x5e755d['body']['binding']['phone']){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x5e755d[_0xde2d('0x33')][_0xde2d('0xc0')][_0xde2d('0xb0')]){throw new Error(_0xde2d('0xb1'));}if(!_0x5e755d[_0xde2d('0x33')][_0xde2d('0xab')]){throw new Error(_0xde2d('0xc1'));}var _0x1a83e5=require(_0xde2d('0xb6'))[_0xde2d('0xc2')](path[_0xde2d('0x38')](__dirname,_0xde2d('0xc3')),[_0x5e755d[_0xde2d('0x21')]['id'],JSON['stringify'](_0x5e755d[_0xde2d('0x33')]),JSON[_0xde2d('0xc4')](_0x5b126d)]);_0x1a83e5['on'](_0xde2d('0xc5'),function(){_0x4da5eb=!![];return _0x562498['status'](0xc8)[_0xde2d('0xe')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x1a83e5[_0xde2d('0xc6')]});});_0x1a83e5['on'](_0xde2d('0xc7'),function(_0x3094f2){if(_0x3094f2&&!_0x4da5eb){return _0x562498[_0xde2d('0x12')](0x1f4)[_0xde2d('0xe')]({'message':_0xde2d('0xc8'),'pid':_0x1a83e5['pid']});}});})[_0xde2d('0x31')](handleError(_0x562498,null));};exports[_0xde2d('0xc9')]=function(_0x57d47f,_0x4598bf){return db[_0xde2d('0xbe')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0xde2d('0xbf')}})[_0xde2d('0x16')](function(_0x326975){var _0x4d193c=![];if(!_0x57d47f[_0xde2d('0x33')][_0xde2d('0x5c')]){throw new Error(_0xde2d('0xa7'));}if(!_0x57d47f[_0xde2d('0x33')][_0xde2d('0xc0')][_0xde2d('0x76')]){throw new Error(_0xde2d('0xaf'));}if(!_0x57d47f[_0xde2d('0x33')][_0xde2d('0xc0')]['firstName']){throw new Error(_0xde2d('0xb1'));}if(!_0x57d47f[_0xde2d('0x33')][_0xde2d('0xab')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x7c7759=require(_0xde2d('0xb6'))['fork'](path[_0xde2d('0x38')](__dirname,'../../components/import/cm/csvUpdates'),[_0x57d47f[_0xde2d('0x21')]['id'],JSON[_0xde2d('0xc4')](_0x57d47f[_0xde2d('0x33')]),JSON['stringify'](_0x326975)]);_0x7c7759['on']('message',function(){_0x4d193c=!![];return _0x4598bf['status'](0xc8)[_0xde2d('0xe')]({'message':_0xde2d('0xca'),'pid':_0x7c7759['pid']});});_0x7c7759['on']('exit',function(_0xf97ab1){if(_0xf97ab1&&!_0x4d193c){return _0x4598bf[_0xde2d('0x12')](0x1f4)[_0xde2d('0xe')]({'message':'error\x20child\x20process','pid':_0x7c7759[_0xde2d('0xc6')]});}});})[_0xde2d('0x31')](handleError(_0x4598bf,null));};exports[_0xde2d('0xcb')]=function(_0x565592,_0x135a75){var _0xd7a02e=[_0xde2d('0xcc'),'chat',_0xde2d('0xcd'),_0xde2d('0xce'),_0xde2d('0xcf'),_0xde2d('0xd0'),_0xde2d('0xd1')];var _0x587b0e={'offset':0x0,'order':qs[_0xde2d('0x80')]('-createdAt')},_0x2bbf05={'count':0x0,'rows':[]};Promise[_0xde2d('0xd2')]()[_0xde2d('0x16')](function(){if(_0x565592[_0xde2d('0x1e')][_0xde2d('0xd3')]){if(!_[_0xde2d('0xd4')](_0xd7a02e,_0x565592[_0xde2d('0x1e')][_0xde2d('0xd3')][_0xde2d('0xd5')]())){throw new Error(_0xde2d('0xd6'));}_0xd7a02e=[_0x565592[_0xde2d('0x1e')][_0xde2d('0xd3')][_0xde2d('0xd5')]()];}if(_0x565592[_0xde2d('0x1e')][_0xde2d('0xd7')]){try{var _0x2ccd3c=JSON[_0xde2d('0xbb')](_0x565592['query']['range']);if(!moment(_0x2ccd3c['from'])['isValid']()){throw new Error(_0xde2d('0xd8'));}if(!moment(_0x2ccd3c['to'])['isValid']()){throw new Error(_0xde2d('0xd9'));}}catch(_0x4d3624){throw new Error(_0xde2d('0xda'));}}if(!_0x565592[_0xde2d('0x1e')][_0xde2d('0x30')]('nolimit')){_0x587b0e[_0xde2d('0x85')]=qs[_0xde2d('0x85')](_0x565592[_0xde2d('0x1e')][_0xde2d('0x85')]||0xa);_0x587b0e[_0xde2d('0x11')]=qs['offset'](_0x565592['query'][_0xde2d('0x11')]);}var _0x35054f=_0xd7a02e[_0xde2d('0x6d')](function(_0x4bb881){if(_0x4bb881===_0xde2d('0xd1')){var _0x516166={'attributes':['id',_0xde2d('0xdb'),_0xde2d('0x2c'),_0xde2d('0xdc'),_0xde2d('0xdd'),_0xde2d('0xde'),_0xde2d('0xdf'),'endtime',_0xde2d('0xe0'),_0xde2d('0xe1'),_0xde2d('0xe2'),'userDisposition',_0xde2d('0xe3'),'userThirdDisposition',_0xde2d('0xe4')],'where':{'ContactId':_0x565592[_0xde2d('0x21')]['id']},'include':[{'model':db['User'],'as':_0xde2d('0xbe'),'attributes':['id',_0xde2d('0x19'),_0xde2d('0xe5'),_0xde2d('0x2b')]}],'order':[[_0xde2d('0xe2'),_0xde2d('0xe6')]]};if(_0x565592[_0xde2d('0x1e')][_0xde2d('0xd7')]){_0x516166[_0xde2d('0x5a')][_0xde2d('0xe2')]={'$gte':_0x2ccd3c[_0xde2d('0x34')],'$lte':_0x2ccd3c['to']};}return db[_0xde2d('0x49')][_0xde2d('0xe7')](_0x516166)[_0xde2d('0x16')](function(_0x2fc0b1){_0x2bbf05[_0xde2d('0x10')]+=_0x2fc0b1[_0xde2d('0x10')];return _[_0xde2d('0x6d')](_0x2fc0b1['rows'],function(_0x433706){var _0x9b39d5=_0x433706[_0xde2d('0x35')]({'plain':!![]});_0x9b39d5['channel']=_0x4bb881;if(_0x9b39d5[_0xde2d('0xbe')]){_0x9b39d5[_0xde2d('0xbe')]={'id':_0x9b39d5[_0xde2d('0xbe')]['id'],'name':_0x9b39d5['User'][_0xde2d('0x19')],'fullname':_0x9b39d5[_0xde2d('0xbe')][_0xde2d('0xe5')],'alias':_0x9b39d5[_0xde2d('0xbe')]['alias']};}return _0x9b39d5;});});}else{var _0x3256e1=_['startCase'](_0x4bb881)+(_0x4bb881===_0xde2d('0xe8')?_0xde2d('0xe9'):'Account');var _0x44c02b={'attributes':['id',_0xde2d('0xea'),_0xde2d('0xeb'),'createdAt',_0xde2d('0xe1'),_0xde2d('0xec'),_0xde2d('0xed'),_0xde2d('0xee'),_0xde2d('0xe4'),_0x3256e1+'Id'],'where':{'ContactId':_0x565592[_0xde2d('0x21')]['id']},'include':[{'model':db[_0x3256e1],'as':_0xde2d('0xef'),'attributes':['id',_0xde2d('0x19'),_0xde2d('0xf0')]},{'model':db[_0xde2d('0xbe')],'as':_0xde2d('0xf1'),'attributes':['id',_0xde2d('0x19'),'fullname']},{'model':db['Tag'],'as':_0xde2d('0xf2'),'attributes':['id',_0xde2d('0x19'),'color'],'through':{'attributes':[]}}],'order':[[_0xde2d('0xe2'),_0xde2d('0xe6')]]};if(_0x565592[_0xde2d('0x1e')][_0xde2d('0xd7')]){_0x44c02b[_0xde2d('0x5a')][_0xde2d('0xe2')]={'$gte':_0x2ccd3c['from'],'$lte':_0x2ccd3c['to']};}switch(_0x4bb881){case _0xde2d('0xe8'):_0x44c02b[_0xde2d('0x7d')][_0xde2d('0x69')](_0xde2d('0xf3'),'customerIp',_0xde2d('0xf4'),_0xde2d('0xf5'),'osName',_0xde2d('0xf6'),_0xde2d('0xf7'),_0xde2d('0xf8'),'referer');break;case _0xde2d('0xcc'):_0x44c02b[_0xde2d('0x7d')][_0xde2d('0x69')](_0xde2d('0xf9'),_0xde2d('0xfa'));break;case _0xde2d('0xce'):_0x44c02b['attributes'][_0xde2d('0x69')](_0xde2d('0xfb'),_0xde2d('0xfc'));break;}return db[_[_0xde2d('0xfd')](_0x4bb881)+_0xde2d('0xfe')]['findAndCountAll'](_0x44c02b)['then'](function(_0x2c9c4c){_0x2bbf05[_0xde2d('0x10')]+=_0x2c9c4c['count'];return _[_0xde2d('0x6d')](_0x2c9c4c['rows'],function(_0xfa3ada){var _0x2d7afb=_0xfa3ada['get']({'plain':!![]});_0x2d7afb[_0xde2d('0xd3')]=_0x4bb881;if(_0x2d7afb[_0xde2d('0xf1')]){_0x2d7afb[_0xde2d('0xf1')]={'id':_0x2d7afb[_0xde2d('0xf1')]['id'],'name':_0x2d7afb['Owner'][_0xde2d('0x19')],'fullname':_0x2d7afb[_0xde2d('0xf1')][_0xde2d('0xe5')]};}return _0x2d7afb;});});}});return Promise['all'](_0x35054f);})[_0xde2d('0x16')](function(_0x327683){return _(_0x327683)[_0xde2d('0xff')]()['sortBy']('createdAt')[_0xde2d('0x100')]()['value']();})[_0xde2d('0x16')](function(_0x431563){_0x2bbf05[_0xde2d('0xa0')]=_0x587b0e[_0xde2d('0x85')]?_0x431563[_0xde2d('0x101')](_0x587b0e[_0xde2d('0x11')],_0x587b0e[_0xde2d('0x11')]+_0x587b0e[_0xde2d('0x85')]):_0x431563;return _0x2bbf05;})[_0xde2d('0x16')](respondWithFilteredResult(_0x135a75,_0x587b0e))['catch'](handleError(_0x135a75,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index fab1a23..68562fa 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 _0xe4a1=['save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0xe4a1,0x1de));var _0x1e4a=function(_0xc3601f,_0x2ea821){_0xc3601f=_0xc3601f-0x0;var _0x55dba3=_0xe4a1[_0xc3601f];return _0x55dba3;};'use strict';var EventEmitter=require(_0x1e4a('0x0'));var CmContact=require(_0x1e4a('0x1'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1e4a('0x2'),'afterUpdate':_0x1e4a('0x3'),'afterDestroy':'remove'};function emitEvent(_0x302a65){return function(_0x394316,_0x33e781,_0x142dca){CmContactEvents[_0x1e4a('0x4')](_0x302a65+':'+_0x394316['id'],_0x394316);CmContactEvents[_0x1e4a('0x4')](_0x302a65,_0x394316);_0x142dca(null);};}for(var e in events){if(events[_0x1e4a('0x5')](e)){var event=events[e];CmContact[_0x1e4a('0x6')](e,emitEvent(event));}}module[_0x1e4a('0x7')]=CmContactEvents; \ No newline at end of file +var _0x53fb=['CmContact','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x53fb,0x1ac));var _0xb53f=function(_0x98d1f3,_0x1ceddb){_0x98d1f3=_0x98d1f3-0x0;var _0x54d4da=_0x53fb[_0x98d1f3];return _0x54d4da;};'use strict';var EventEmitter=require(_0xb53f('0x0'));var CmContact=require(_0xb53f('0x1'))['db'][_0xb53f('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xb53f('0x3')](0x0);var events={'afterCreate':_0xb53f('0x4'),'afterUpdate':_0xb53f('0x5'),'afterDestroy':'remove'};function emitEvent(_0x13c977){return function(_0x581187,_0x232294,_0x2c3211){CmContactEvents[_0xb53f('0x6')](_0x13c977+':'+_0x581187['id'],_0x581187);CmContactEvents[_0xb53f('0x6')](_0x13c977,_0x581187);_0x2c3211(null);};}for(var e in events){if(events[_0xb53f('0x7')](e)){var event=events[e];CmContact[_0xb53f('0x8')](e,emitEvent(event));}}module[_0xb53f('0x9')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index bbff79e..2d48734 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 _0x223e=['format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','findOne','timezones','utcOffset','add','minutes','then','ret','CmHopper','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','callbackUniqueid','catch','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','cmContact','inspect','Campaign','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','CmHopperFinal','outbound','dialCheckDuplicateType','CmList','length','get','always','onlyIfOpen','findAll','BlackLists','cmContact,\x20%s,\x20%s','message','Lists','CmHopperBlack','List\x20not\x20found','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','push','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment/shared','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','firstName','lastName','mobile','fax','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','error','afterCreate','scheduledat'];(function(_0x38d4bd,_0x3e5057){var _0x40573e=function(_0x4340d7){while(--_0x4340d7){_0x38d4bd['push'](_0x38d4bd['shift']());}};_0x40573e(++_0x3e5057);}(_0x223e,0x168));var _0xe223=function(_0x4d7f3f,_0x4d2803){_0x4d7f3f=_0x4d7f3f-0x0;var _0x5d67cc=_0x223e[_0x4d7f3f];return _0x5d67cc;};'use strict';var _=require(_0xe223('0x0'));var util=require('util');var logger=require(_0xe223('0x1'))(_0xe223('0x2'));var moment=require('moment');var BPromise=require(_0xe223('0x3'));var rp=require(_0xe223('0x4'));var fs=require('fs');var path=require(_0xe223('0x5'));var rimraf=require(_0xe223('0x6'));var config=require('../../config/environment');var shared=require(_0xe223('0x7'));var attributes=require(_0xe223('0x8'));module[_0xe223('0x9')]=function(_0x1099ed,_0x5d2e7c){return _0x1099ed[_0xe223('0xa')](_0xe223('0xb'),attributes,{'tableName':_0xe223('0xc'),'paranoid':!![],'indexes':[{'name':'phone','fields':[_0xe223('0xd')]},{'name':'fti_cm_contacts','fields':[_0xe223('0xe'),_0xe223('0xf'),_0xe223('0xd'),_0xe223('0x10'),_0xe223('0x11'),'email'],'type':_0xe223('0x12')}],'timestamps':!![],'charset':_0xe223('0x13'),'collate':_0xe223('0x14'),'hooks':{'afterCreate':function(_0xd67362,_0x5de2e4,_0x34845a){var _0x407aea=_0x1099ed[_0xe223('0x15')];var _0x5c34f=_0xd67362['get']({'plain':!![]});function _0x192775(){return function(_0x1e5250){logger[_0xe223('0x16')]('cmContact',_0xe223('0x17'),util['inspect'](_0x1e5250,{'showHidden':![],'depth':null}));};}function _0x4364e3(_0x163696,_0x7b6233){var _0x2c8483=_0x7b6233[_0xe223('0x18')]?_0x7b6233[_0xe223('0x18')]:moment()[_0xe223('0x19')](_0xe223('0x1a'));return new BPromise(function(_0x1cd231,_0x313769){if(_[_0xe223('0x1b')](_0x7b6233[_0xe223('0x1c')])){_0x1cd231({'ret':_0x2c8483});}else{_0x407aea[_0xe223('0x1d')][_0xe223('0x1e')]({'where':{'id':_0x163696['id']}})['then'](function(_0x52091e){if(!_['isNil'](_0x52091e)){var _0x352d27=_0x52091e['dialTimezone'];if(!_[_0xe223('0x1b')](_0x352d27)){var _0x410e17=shared[_0xe223('0x1f')];var _0x2f119a=_0x410e17[_0x352d27];var _0x1213fd=_0x410e17[_0x7b6233[_0xe223('0x1c')]];if(!_[_0xe223('0x1b')](_0x2f119a)&&!_[_0xe223('0x1b')](_0x1213fd)){var _0x5bff92=_0x2f119a[_0xe223('0x20')]-_0x1213fd[_0xe223('0x20')];_0x2c8483=_0x7b6233['scheduledat']?_0x7b6233[_0xe223('0x18')]:moment();var _0x4559ba=moment(_0x2c8483)[_0xe223('0x21')](_0x5bff92,_0xe223('0x22'));_0x1cd231({'ret':_0x4559ba['format'](_0xe223('0x1a'))});}else _0x1cd231({'ret':_0x2c8483});}else _0x1cd231({'ret':_0x2c8483});}else{_0x1cd231({'ret':_0x2c8483});}});}});return 0xa;}var _0x32cfba=function(_0x4190e1){return new BPromise(function(_0x2c4c40,_0x24eccb){_0x4364e3(_0x4190e1,_0x5c34f)[_0xe223('0x23')](function(_0x546d56){_0x5c34f[_0xe223('0x18')]=_0x546d56[_0xe223('0x24')];_0x407aea[_0xe223('0x25')][_0xe223('0x1e')]({'where':{'phone':_0x5c34f[_0xe223('0xd')],'VoiceQueueId':_0x4190e1['id']}})[_0xe223('0x23')](function(_0xfadd00){if(!_['isNil'](_0xfadd00)){throw new Error('cmContact,\x20afterCreate\x20'+_0x5c34f[_0xe223('0xd')]+_0xe223('0x26')+_0x4190e1['id']);}return _0x407aea[_0xe223('0x25')][_0xe223('0x27')]({'phone':_0x5c34f[_0xe223('0xd')],'ContactId':_0x5c34f['id'],'ListId':_0x5c34f[_0xe223('0x28')],'priority':_0x5c34f[_0xe223('0x29')]?_0x5c34f[_0xe223('0x29')]:0x2,'scheduledat':_0x5c34f[_0xe223('0x18')]?_0x5c34f['scheduledat']:moment()[_0xe223('0x19')](_0xe223('0x1a')),'callback':_0x5c34f['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x5c34f[_0xe223('0x2a')]?_0x5c34f['callbackUniqueid']:undefined,'callbackat':_0x5c34f['callbackUniqueid']?moment()[_0xe223('0x19')](_0xe223('0x1a')):undefined,'VoiceQueueId':_0x4190e1['id']});})[_0xe223('0x2b')](function(_0x528a68){_0x24eccb(_0x528a68);});});});};var _0x339ec3=function(_0x3b77cf){return new BPromise(function(_0x397f12,_0x57a562){_0x4364e3(_0x3b77cf,_0x5c34f)['then'](function(_0x39b95a){_0x5c34f['scheduledat']=_0x39b95a[_0xe223('0x24')];_0x407aea[_0xe223('0x25')][_0xe223('0x1e')]({'where':{'phone':_0x5c34f[_0xe223('0xd')],'VoiceQueueId':_0x3b77cf['id']}})[_0xe223('0x23')](function(_0x2228b1){if(!_[_0xe223('0x1b')](_0x2228b1)){throw new Error(_0xe223('0x2c')+_0x5c34f['phone']+_0xe223('0x2d')+_0x3b77cf['id']);}return _0x407aea['CmHopperFinal'][_0xe223('0x1e')]({'where':{'calleridnum':_0x5c34f['phone'],'VoiceQueueId':_0x3b77cf['id']}});})[_0xe223('0x23')](function(_0x46f75b){if(!_[_0xe223('0x1b')](_0x46f75b)){throw new Error(_0xe223('0x2e')+_0x5c34f[_0xe223('0xd')]+_0xe223('0x2f')+_0x3b77cf['id']);}return _0x407aea['CmHopper'][_0xe223('0x27')]({'phone':_0x5c34f[_0xe223('0xd')],'ContactId':_0x5c34f['id'],'ListId':_0x5c34f[_0xe223('0x28')],'priority':_0x5c34f[_0xe223('0x29')]?_0x5c34f[_0xe223('0x29')]:0x2,'scheduledat':_0x5c34f[_0xe223('0x18')]?_0x5c34f[_0xe223('0x18')]:moment()['format'](_0xe223('0x1a')),'callback':_0x5c34f[_0xe223('0x2a')]?!![]:![],'callbackuniqueid':_0x5c34f[_0xe223('0x2a')]?_0x5c34f['callbackUniqueid']:undefined,'callbackat':_0x5c34f['callbackUniqueid']?moment()[_0xe223('0x19')](_0xe223('0x1a')):undefined,'VoiceQueueId':_0x3b77cf['id']});})['catch'](function(_0x28392d){_0x57a562(_0x28392d);});});});};function _0x59685f(){return function(_0x4dcac9){logger[_0xe223('0x16')](_0xe223('0x30'),'afterCreate',util[_0xe223('0x31')](_0x4dcac9,{'showHidden':![],'depth':null}));};}function _0x5377ce(_0x24b76c,_0xe71f92){var _0x3001fd=_0xe71f92['scheduledat']?_0xe71f92[_0xe223('0x18')]:moment()[_0xe223('0x19')](_0xe223('0x1a'));return new BPromise(function(_0x433a91,_0x32d980){if(_[_0xe223('0x1b')](_0xe71f92['dialTimezone'])){_0x433a91({'ret':_0x3001fd});}else{_0x407aea[_0xe223('0x32')]['findOne']({'where':{'id':_0x24b76c['id']}})[_0xe223('0x23')](function(_0x5564c3){if(!_[_0xe223('0x1b')](_0x5564c3)){var _0x143e8e=_0x5564c3[_0xe223('0x1c')];if(!_[_0xe223('0x1b')](_0x143e8e)){var _0x19c154=shared[_0xe223('0x1f')];var _0x5e4df5=_0x19c154[_0x143e8e];var _0x28ad1b=_0x19c154[_0xe71f92[_0xe223('0x1c')]];if(!_[_0xe223('0x1b')](_0x5e4df5)&&!_['isNil'](_0x28ad1b)){var _0x1ea80c=_0x5e4df5[_0xe223('0x20')]-_0x28ad1b[_0xe223('0x20')];_0x3001fd=_0xe71f92[_0xe223('0x18')]?_0xe71f92[_0xe223('0x18')]:moment();var _0x4ba7fe=moment(_0x3001fd)[_0xe223('0x21')](_0x1ea80c,'minutes');_0x433a91({'ret':_0x4ba7fe[_0xe223('0x19')](_0xe223('0x1a'))});}else _0x433a91({'ret':_0x3001fd});}else _0x433a91({'ret':_0x3001fd});}else{_0x433a91({'ret':_0x3001fd});}});}});return 0xa;}var _0x44eae2=function(_0x5d9931){return new BPromise(function(_0x2ca119,_0x55e546){_0x5377ce(_0x5d9931,_0x5c34f)['then'](function(_0x828ab7){_0x5c34f[_0xe223('0x18')]=_0x828ab7[_0xe223('0x24')];_0x407aea['CmHopper'][_0xe223('0x1e')]({'where':{'phone':_0x5c34f[_0xe223('0xd')],'CampaignId':_0x5d9931['id']}})[_0xe223('0x23')](function(_0x5b3536){if(!_[_0xe223('0x1b')](_0x5b3536)){throw new Error(_0xe223('0x2c')+_0x5c34f[_0xe223('0xd')]+_0xe223('0x33')+_0x5d9931['id']);}return _0x407aea[_0xe223('0x25')][_0xe223('0x27')]({'phone':_0x5c34f['phone'],'ContactId':_0x5c34f['id'],'ListId':_0x5c34f[_0xe223('0x28')],'priority':_0x5c34f[_0xe223('0x29')]?_0x5c34f[_0xe223('0x29')]:0x2,'scheduledat':_0x5c34f['scheduledat']?_0x5c34f[_0xe223('0x18')]:moment()[_0xe223('0x19')](_0xe223('0x1a')),'callback':_0x5c34f['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x5c34f[_0xe223('0x2a')]?_0x5c34f['callbackUniqueid']:undefined,'callbackat':_0x5c34f[_0xe223('0x2a')]?moment()[_0xe223('0x19')](_0xe223('0x1a')):undefined,'CampaignId':_0x5d9931['id']});})[_0xe223('0x2b')](function(_0x16e2cc){_0x55e546(_0x16e2cc);});});});};var _0x4df8a7=function(_0x45e557){return new BPromise(function(_0xd716e1,_0x12fa90){_0x5377ce(_0x45e557,_0x5c34f)[_0xe223('0x23')](function(_0x53599f){_0x5c34f[_0xe223('0x18')]=_0x53599f['ret'];_0x407aea['CmHopper'][_0xe223('0x1e')]({'where':{'phone':_0x5c34f[_0xe223('0xd')],'CampaignId':_0x45e557['id']}})['then'](function(_0x2d3255){if(!_[_0xe223('0x1b')](_0x2d3255)){throw new Error(_0xe223('0x2c')+_0x5c34f['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x45e557['id']);}return _0x407aea[_0xe223('0x34')][_0xe223('0x1e')]({'where':{'calleridnum':_0x5c34f[_0xe223('0xd')],'CampaignId':_0x45e557['id']}});})[_0xe223('0x23')](function(_0x5a9d15){if(!_['isNil'](_0x5a9d15)){throw new Error(_0xe223('0x2e')+_0x5c34f[_0xe223('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0x45e557['id']);}return _0x407aea['CmHopper'][_0xe223('0x27')]({'phone':_0x5c34f['phone'],'ContactId':_0x5c34f['id'],'ListId':_0x5c34f[_0xe223('0x28')],'priority':_0x5c34f[_0xe223('0x29')]?_0x5c34f[_0xe223('0x29')]:0x2,'scheduledat':_0x5c34f[_0xe223('0x18')]?_0x5c34f['scheduledat']:moment()[_0xe223('0x19')](_0xe223('0x1a')),'callback':_0x5c34f[_0xe223('0x2a')]?!![]:![],'callbackuniqueid':_0x5c34f['callbackUniqueid']?_0x5c34f[_0xe223('0x2a')]:undefined,'callbackat':_0x5c34f[_0xe223('0x2a')]?moment()['format'](_0xe223('0x1a')):undefined,'CampaignId':_0x45e557['id']});})[_0xe223('0x2b')](function(_0x352717){_0x12fa90(_0x352717);});});});};if(_0x5c34f['ListId']){_0x407aea[_0xe223('0x1d')]['findAll']({'where':{'type':_0xe223('0x35')},'attributes':['id',_0xe223('0x36'),'dialTimezone'],'include':[{'model':_0x407aea[_0xe223('0x37')],'as':'Lists','where':{'id':_0x5c34f[_0xe223('0x28')]}}]})[_0xe223('0x23')](function(_0x2339d5){if(_0x2339d5){var _0x48c3b9=[];for(var _0x5f4c0a=0x0,_0x18a2a0;_0x5f4c0a<_0x2339d5[_0xe223('0x38')];_0x5f4c0a+=0x1){_0x18a2a0=_0x2339d5[_0x5f4c0a][_0xe223('0x39')]({'plain':!![]});switch(_0x18a2a0[_0xe223('0x36')]){case _0xe223('0x3a'):_0x339ec3(_0x18a2a0)[_0xe223('0x2b')](_0x192775());break;case _0xe223('0x3b'):_0x32cfba(_0x18a2a0)[_0xe223('0x2b')](_0x192775());break;default:_0x5377ce(_0x18a2a0,_0x5c34f)[_0xe223('0x23')](function(_0x4b138b){_0x5c34f['scheduledat']=_0x4b138b[_0xe223('0x24')];_0x407aea[_0xe223('0x25')][_0xe223('0x27')]({'phone':_0x5c34f[_0xe223('0xd')],'ContactId':_0x5c34f['id'],'ListId':_0x5c34f['ListId'],'scheduledat':_0x5c34f[_0xe223('0x18')]?_0x5c34f[_0xe223('0x18')]:moment()[_0xe223('0x19')](_0xe223('0x1a')),'priority':_0x5c34f['priority']?_0x5c34f['priority']:0x2,'callback':_0x5c34f[_0xe223('0x2a')]?!![]:![],'callbackuniqueid':_0x5c34f[_0xe223('0x2a')]?_0x5c34f[_0xe223('0x2a')]:undefined,'callbackat':_0x5c34f[_0xe223('0x2a')]?moment()[_0xe223('0x19')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x18a2a0['id']})['catch'](_0x192775());});}}}})[_0xe223('0x23')](function(){return _0x407aea[_0xe223('0x1d')][_0xe223('0x3c')]({'where':{'type':_0xe223('0x35')},'attributes':['id'],'include':[{'model':_0x407aea[_0xe223('0x37')],'as':_0xe223('0x3d'),'where':{'id':_0x5c34f[_0xe223('0x28')]}}]})[_0xe223('0x23')](function(_0x2f0466){if(_0x2f0466){var _0x4d671e=[];for(var _0x1c1ab4=0x0,_0xbee18f;_0x1c1ab4<_0x2f0466['length'];_0x1c1ab4+=0x1){_0xbee18f=_0x2f0466[_0x1c1ab4][_0xe223('0x39')]({'plain':!![]});_0x407aea['CmHopperBlack'][_0xe223('0x27')]({'phone':_0x5c34f['phone'],'ContactId':_0x5c34f['id'],'ListId':_0x5c34f['ListId'],'VoiceQueueId':_0xbee18f['id']})[_0xe223('0x2b')](function(_0xba0ffb){logger[_0xe223('0x16')](_0xe223('0x3e'),'afterCreate',_0xba0ffb[_0xe223('0x3f')]);});}}});})[_0xe223('0x23')](function(){return _0x407aea[_0xe223('0x32')]['findAll']({'attributes':['id','dialCheckDuplicateType',_0xe223('0x1c')],'include':[{'model':_0x407aea[_0xe223('0x37')],'as':_0xe223('0x40'),'where':{'id':_0x5c34f[_0xe223('0x28')]}}]})[_0xe223('0x23')](function(_0x4b8a9a){if(_0x4b8a9a){var _0x4cedaf=[];for(var _0x5b52f3=0x0,_0x1ebae0;_0x5b52f3<_0x4b8a9a[_0xe223('0x38')];_0x5b52f3+=0x1){_0x1ebae0=_0x4b8a9a[_0x5b52f3][_0xe223('0x39')]({'plain':!![]});switch(_0x1ebae0[_0xe223('0x36')]){case'always':_0x4df8a7(_0x1ebae0)[_0xe223('0x2b')](_0x59685f());break;case _0xe223('0x3b'):_0x44eae2(_0x1ebae0)[_0xe223('0x2b')](_0x59685f());break;default:_0x407aea[_0xe223('0x25')][_0xe223('0x27')]({'phone':_0x5c34f[_0xe223('0xd')],'ContactId':_0x5c34f['id'],'ListId':_0x5c34f['ListId'],'scheduledat':_0x5c34f[_0xe223('0x18')]?_0x5c34f['scheduledat']:moment()[_0xe223('0x19')](_0xe223('0x1a')),'priority':_0x5c34f[_0xe223('0x29')]?_0x5c34f[_0xe223('0x29')]:0x2,'callback':_0x5c34f[_0xe223('0x2a')]?!![]:![],'callbackuniqueid':_0x5c34f[_0xe223('0x2a')]?_0x5c34f[_0xe223('0x2a')]:undefined,'callbackat':_0x5c34f[_0xe223('0x2a')]?moment()[_0xe223('0x19')](_0xe223('0x1a')):undefined,'CampaignId':_0x1ebae0['id']})['catch'](_0x59685f());}}}});})[_0xe223('0x23')](function(){return _0x407aea[_0xe223('0x32')]['findAll']({'attributes':['id'],'include':[{'model':_0x407aea['CmList'],'as':_0xe223('0x3d'),'where':{'id':_0x5c34f['ListId']}}]})[_0xe223('0x23')](function(_0x5770da){if(_0x5770da){var _0x2687e6=[];for(var _0x39571b=0x0,_0x593b82;_0x39571b<_0x5770da[_0xe223('0x38')];_0x39571b+=0x1){_0x593b82=_0x5770da[_0x39571b][_0xe223('0x39')]({'plain':!![]});_0x407aea[_0xe223('0x41')]['create']({'phone':_0x5c34f[_0xe223('0xd')],'ContactId':_0x5c34f['id'],'ListId':_0x5c34f[_0xe223('0x28')],'CampaignId':_0x593b82['id']})[_0xe223('0x2b')](function(_0x209e0c){logger[_0xe223('0x16')](_0xe223('0x3e'),_0xe223('0x17'),_0x209e0c[_0xe223('0x3f')]);});}}});})[_0xe223('0x23')](function(){_0x34845a();})[_0xe223('0x2b')](function(_0x3b132f){logger[_0xe223('0x16')](_0xe223('0x3e'),_0xe223('0x17'),_0x3b132f['message']);_0x34845a(_0x3b132f);});}else{_0x34845a(new Error(_0xe223('0x42')));}},'afterDestroy':function(_0x1ba7e0,_0x549338,_0x43ccb5){var _0x2be987=_0x1099ed[_0xe223('0x15')];var _0x39174a=_0x1ba7e0[_0xe223('0x39')]({'plain':!![]});return _0x2be987[_0xe223('0x25')][_0xe223('0x3c')]({'raw':!![],'where':{'ListId':_0x39174a[_0xe223('0x28')],'ContactId':_0x39174a['id']}})[_0xe223('0x23')](function(_0x4adf6c){if(!_[_0xe223('0x43')](_0x4adf6c)){var _0x278b8c=[];for(var _0x4d9d05=0x0;_0x4d9d05<_0x4adf6c[_0xe223('0x38')];_0x4d9d05+=0x1){var _0x45b431=_0x2be987[_0xe223('0x25')][_0xe223('0x44')]({'where':{'ListId':_0x4adf6c[_0x4d9d05][_0xe223('0x28')],'ContactId':_0x4adf6c[_0x4d9d05][_0xe223('0x45')],'VoiceQueueId':_0x4adf6c[_0x4d9d05][_0xe223('0x46')],'CampaignId':_0x4adf6c[_0x4d9d05][_0xe223('0x47')]}});_0x278b8c[_0xe223('0x48')](_0x45b431);}return BPromise[_0xe223('0x49')](_0x278b8c);}})['then'](function(_0x3b5cf6){logger[_0xe223('0x4a')](_0xe223('0x4b'),util[_0xe223('0x31')](_0x3b5cf6,{'showHidden':![],'depth':null}));_0x43ccb5();})[_0xe223('0x2b')](function(_0x47caab){logger['error'](_0xe223('0x4c'),util['inspect'](_0x47caab,{'showHidden':![],'depth':null}));_0x43ccb5(_0x47caab);});}}});}; \ No newline at end of file +var _0x485d=['../../config/environment/shared','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','mobile','fax','email','FULLTEXT','utf8mb4','models','get','afterCreate','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','findOne','then','timezones','utcOffset','add','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','inspect','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\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','CmList','Lists','length','always','BlackLists','CmHopperBlack','error','cmContact,\x20%s,\x20%s','message','Campaign','dialCheckDuplicateType','onlyIfOpen','List\x20not\x20found','destroy','VoiceQueueId','CampaignId','push','all','info','[CmContact][afterDestroy][Succesfull]','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5657d6,_0x15775c){var _0x2f416b=function(_0x34491b){while(--_0x34491b){_0x5657d6['push'](_0x5657d6['shift']());}};_0x2f416b(++_0x15775c);}(_0x485d,0x16f));var _0xd485=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x485d[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0xd485('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd485('0x1'));var moment=require(_0xd485('0x2'));var BPromise=require(_0xd485('0x3'));var rp=require(_0xd485('0x4'));var fs=require('fs');var path=require(_0xd485('0x5'));var rimraf=require(_0xd485('0x6'));var config=require(_0xd485('0x7'));var shared=require(_0xd485('0x8'));var attributes=require(_0xd485('0x9'));module[_0xd485('0xa')]=function(_0x54443d,_0x185037){return _0x54443d[_0xd485('0xb')](_0xd485('0xc'),attributes,{'tableName':_0xd485('0xd'),'paranoid':!![],'indexes':[{'name':_0xd485('0xe'),'fields':[_0xd485('0xe')]},{'name':_0xd485('0xf'),'fields':[_0xd485('0x10'),'lastName',_0xd485('0xe'),_0xd485('0x11'),_0xd485('0x12'),_0xd485('0x13')],'type':_0xd485('0x14')}],'timestamps':!![],'charset':_0xd485('0x15'),'collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0x79047,_0x51f53c,_0x46e595){var _0x94dc80=_0x54443d[_0xd485('0x16')];var _0x253c4e=_0x79047[_0xd485('0x17')]({'plain':!![]});function _0x32305d(){return function(_0x1b6ab9){logger['error']('cmContact',_0xd485('0x18'),util['inspect'](_0x1b6ab9,{'showHidden':![],'depth':null}));};}function _0x35b79d(_0x8f8060,_0x854542){var _0x4b3a6a=_0x854542[_0xd485('0x19')]?_0x854542[_0xd485('0x19')]:moment()[_0xd485('0x1a')](_0xd485('0x1b'));return new BPromise(function(_0xc3f43f,_0x48cbd6){if(_[_0xd485('0x1c')](_0x854542[_0xd485('0x1d')])){_0xc3f43f({'ret':_0x4b3a6a});}else{_0x94dc80[_0xd485('0x1e')][_0xd485('0x1f')]({'where':{'id':_0x8f8060['id']}})[_0xd485('0x20')](function(_0x16a981){if(!_['isNil'](_0x16a981)){var _0x34c351=_0x16a981[_0xd485('0x1d')];if(!_[_0xd485('0x1c')](_0x34c351)){var _0x1696d8=shared[_0xd485('0x21')];var _0x3b2a81=_0x1696d8[_0x34c351];var _0x28be88=_0x1696d8[_0x854542['dialTimezone']];if(!_[_0xd485('0x1c')](_0x3b2a81)&&!_[_0xd485('0x1c')](_0x28be88)){var _0x599869=_0x3b2a81['utcOffset']-_0x28be88[_0xd485('0x22')];_0x4b3a6a=_0x854542[_0xd485('0x19')]?_0x854542[_0xd485('0x19')]:moment();var _0x46f6fe=moment(_0x4b3a6a)[_0xd485('0x23')](_0x599869,_0xd485('0x24'));_0xc3f43f({'ret':_0x46f6fe['format'](_0xd485('0x1b'))});}else _0xc3f43f({'ret':_0x4b3a6a});}else _0xc3f43f({'ret':_0x4b3a6a});}else{_0xc3f43f({'ret':_0x4b3a6a});}});}});return 0xa;}var _0x3eb1c2=function(_0x337076){return new BPromise(function(_0x31f534,_0x481f89){_0x35b79d(_0x337076,_0x253c4e)[_0xd485('0x20')](function(_0x2ffe9c){_0x253c4e[_0xd485('0x19')]=_0x2ffe9c[_0xd485('0x25')];_0x94dc80[_0xd485('0x26')]['findOne']({'where':{'phone':_0x253c4e[_0xd485('0xe')],'VoiceQueueId':_0x337076['id']}})[_0xd485('0x20')](function(_0x3267b8){if(!_[_0xd485('0x1c')](_0x3267b8)){throw new Error(_0xd485('0x27')+_0x253c4e['phone']+_0xd485('0x28')+_0x337076['id']);}return _0x94dc80[_0xd485('0x26')][_0xd485('0x29')]({'phone':_0x253c4e[_0xd485('0xe')],'ContactId':_0x253c4e['id'],'ListId':_0x253c4e[_0xd485('0x2a')],'priority':_0x253c4e[_0xd485('0x2b')]?_0x253c4e[_0xd485('0x2b')]:0x2,'scheduledat':_0x253c4e[_0xd485('0x19')]?_0x253c4e[_0xd485('0x19')]:moment()['format'](_0xd485('0x1b')),'callback':_0x253c4e[_0xd485('0x2c')]?!![]:![],'callbackuniqueid':_0x253c4e[_0xd485('0x2c')]?_0x253c4e['callbackUniqueid']:undefined,'callbackat':_0x253c4e[_0xd485('0x2c')]?moment()[_0xd485('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x337076['id']});})[_0xd485('0x2d')](function(_0x34921f){_0x481f89(_0x34921f);});});});};var _0x35e0b8=function(_0x2921da){return new BPromise(function(_0x2118f2,_0x37d2ca){_0x35b79d(_0x2921da,_0x253c4e)['then'](function(_0x1bda8a){_0x253c4e[_0xd485('0x19')]=_0x1bda8a['ret'];_0x94dc80[_0xd485('0x26')][_0xd485('0x1f')]({'where':{'phone':_0x253c4e[_0xd485('0xe')],'VoiceQueueId':_0x2921da['id']}})[_0xd485('0x20')](function(_0x351de4){if(!_['isNil'](_0x351de4)){throw new Error(_0xd485('0x27')+_0x253c4e[_0xd485('0xe')]+_0xd485('0x2e')+_0x2921da['id']);}return _0x94dc80[_0xd485('0x2f')]['findOne']({'where':{'calleridnum':_0x253c4e[_0xd485('0xe')],'VoiceQueueId':_0x2921da['id']}});})[_0xd485('0x20')](function(_0x1c3131){if(!_['isNil'](_0x1c3131)){throw new Error(_0xd485('0x30')+_0x253c4e[_0xd485('0xe')]+_0xd485('0x31')+_0x2921da['id']);}return _0x94dc80[_0xd485('0x26')][_0xd485('0x29')]({'phone':_0x253c4e[_0xd485('0xe')],'ContactId':_0x253c4e['id'],'ListId':_0x253c4e[_0xd485('0x2a')],'priority':_0x253c4e[_0xd485('0x2b')]?_0x253c4e[_0xd485('0x2b')]:0x2,'scheduledat':_0x253c4e[_0xd485('0x19')]?_0x253c4e[_0xd485('0x19')]:moment()[_0xd485('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x253c4e[_0xd485('0x2c')]?!![]:![],'callbackuniqueid':_0x253c4e[_0xd485('0x2c')]?_0x253c4e[_0xd485('0x2c')]:undefined,'callbackat':_0x253c4e[_0xd485('0x2c')]?moment()[_0xd485('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x2921da['id']});})[_0xd485('0x2d')](function(_0x1d0edd){_0x37d2ca(_0x1d0edd);});});});};function _0x2d8f54(){return function(_0x710a44){logger['error']('cmContact','afterCreate',util[_0xd485('0x32')](_0x710a44,{'showHidden':![],'depth':null}));};}function _0x2db79c(_0x200a72,_0x1ab88e){var _0x5688bd=_0x1ab88e[_0xd485('0x19')]?_0x1ab88e['scheduledat']:moment()[_0xd485('0x1a')](_0xd485('0x1b'));return new BPromise(function(_0x69abe3,_0x3a949e){if(_['isNil'](_0x1ab88e['dialTimezone'])){_0x69abe3({'ret':_0x5688bd});}else{_0x94dc80['Campaign']['findOne']({'where':{'id':_0x200a72['id']}})[_0xd485('0x20')](function(_0xc18005){if(!_['isNil'](_0xc18005)){var _0x1b189a=_0xc18005[_0xd485('0x1d')];if(!_[_0xd485('0x1c')](_0x1b189a)){var _0xcf6498=shared[_0xd485('0x21')];var _0x4f276b=_0xcf6498[_0x1b189a];var _0x321709=_0xcf6498[_0x1ab88e[_0xd485('0x1d')]];if(!_['isNil'](_0x4f276b)&&!_[_0xd485('0x1c')](_0x321709)){var _0x20f8e5=_0x4f276b[_0xd485('0x22')]-_0x321709['utcOffset'];_0x5688bd=_0x1ab88e[_0xd485('0x19')]?_0x1ab88e['scheduledat']:moment();var _0x46ad57=moment(_0x5688bd)[_0xd485('0x23')](_0x20f8e5,_0xd485('0x24'));_0x69abe3({'ret':_0x46ad57['format'](_0xd485('0x1b'))});}else _0x69abe3({'ret':_0x5688bd});}else _0x69abe3({'ret':_0x5688bd});}else{_0x69abe3({'ret':_0x5688bd});}});}});return 0xa;}var _0x565ab4=function(_0x2fc0da){return new BPromise(function(_0x30c277,_0x4d524f){_0x2db79c(_0x2fc0da,_0x253c4e)['then'](function(_0x58560b){_0x253c4e['scheduledat']=_0x58560b[_0xd485('0x25')];_0x94dc80['CmHopper'][_0xd485('0x1f')]({'where':{'phone':_0x253c4e[_0xd485('0xe')],'CampaignId':_0x2fc0da['id']}})[_0xd485('0x20')](function(_0x589b53){if(!_[_0xd485('0x1c')](_0x589b53)){throw new Error(_0xd485('0x27')+_0x253c4e[_0xd485('0xe')]+_0xd485('0x33')+_0x2fc0da['id']);}return _0x94dc80[_0xd485('0x26')][_0xd485('0x29')]({'phone':_0x253c4e[_0xd485('0xe')],'ContactId':_0x253c4e['id'],'ListId':_0x253c4e[_0xd485('0x2a')],'priority':_0x253c4e['priority']?_0x253c4e['priority']:0x2,'scheduledat':_0x253c4e[_0xd485('0x19')]?_0x253c4e[_0xd485('0x19')]:moment()[_0xd485('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x253c4e[_0xd485('0x2c')]?!![]:![],'callbackuniqueid':_0x253c4e[_0xd485('0x2c')]?_0x253c4e[_0xd485('0x2c')]:undefined,'callbackat':_0x253c4e[_0xd485('0x2c')]?moment()[_0xd485('0x1a')](_0xd485('0x1b')):undefined,'CampaignId':_0x2fc0da['id']});})['catch'](function(_0x7ed27a){_0x4d524f(_0x7ed27a);});});});};var _0x1016f1=function(_0x1b6127){return new BPromise(function(_0x449c67,_0x5a4d8e){_0x2db79c(_0x1b6127,_0x253c4e)[_0xd485('0x20')](function(_0xc5ea93){_0x253c4e[_0xd485('0x19')]=_0xc5ea93[_0xd485('0x25')];_0x94dc80[_0xd485('0x26')][_0xd485('0x1f')]({'where':{'phone':_0x253c4e['phone'],'CampaignId':_0x1b6127['id']}})[_0xd485('0x20')](function(_0x9ca457){if(!_['isNil'](_0x9ca457)){throw new Error(_0xd485('0x27')+_0x253c4e['phone']+_0xd485('0x34')+_0x1b6127['id']);}return _0x94dc80[_0xd485('0x2f')]['findOne']({'where':{'calleridnum':_0x253c4e[_0xd485('0xe')],'CampaignId':_0x1b6127['id']}});})[_0xd485('0x20')](function(_0x4c8029){if(!_[_0xd485('0x1c')](_0x4c8029)){throw new Error(_0xd485('0x30')+_0x253c4e['phone']+_0xd485('0x35')+_0x1b6127['id']);}return _0x94dc80[_0xd485('0x26')][_0xd485('0x29')]({'phone':_0x253c4e[_0xd485('0xe')],'ContactId':_0x253c4e['id'],'ListId':_0x253c4e[_0xd485('0x2a')],'priority':_0x253c4e['priority']?_0x253c4e[_0xd485('0x2b')]:0x2,'scheduledat':_0x253c4e[_0xd485('0x19')]?_0x253c4e[_0xd485('0x19')]:moment()[_0xd485('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x253c4e[_0xd485('0x2c')]?!![]:![],'callbackuniqueid':_0x253c4e[_0xd485('0x2c')]?_0x253c4e[_0xd485('0x2c')]:undefined,'callbackat':_0x253c4e['callbackUniqueid']?moment()[_0xd485('0x1a')](_0xd485('0x1b')):undefined,'CampaignId':_0x1b6127['id']});})[_0xd485('0x2d')](function(_0x532af5){_0x5a4d8e(_0x532af5);});});});};if(_0x253c4e['ListId']){_0x94dc80['VoiceQueue'][_0xd485('0x36')]({'where':{'type':'outbound'},'attributes':['id','dialCheckDuplicateType','dialTimezone'],'include':[{'model':_0x94dc80[_0xd485('0x37')],'as':_0xd485('0x38'),'where':{'id':_0x253c4e[_0xd485('0x2a')]}}]})[_0xd485('0x20')](function(_0x10e81b){if(_0x10e81b){var _0x3e8a8a=[];for(var _0x5acd1c=0x0,_0x532887;_0x5acd1c<_0x10e81b[_0xd485('0x39')];_0x5acd1c+=0x1){_0x532887=_0x10e81b[_0x5acd1c]['get']({'plain':!![]});switch(_0x532887['dialCheckDuplicateType']){case _0xd485('0x3a'):_0x35e0b8(_0x532887)[_0xd485('0x2d')](_0x32305d());break;case'onlyIfOpen':_0x3eb1c2(_0x532887)[_0xd485('0x2d')](_0x32305d());break;default:_0x2db79c(_0x532887,_0x253c4e)[_0xd485('0x20')](function(_0x35a37e){_0x253c4e[_0xd485('0x19')]=_0x35a37e[_0xd485('0x25')];_0x94dc80[_0xd485('0x26')][_0xd485('0x29')]({'phone':_0x253c4e[_0xd485('0xe')],'ContactId':_0x253c4e['id'],'ListId':_0x253c4e[_0xd485('0x2a')],'scheduledat':_0x253c4e[_0xd485('0x19')]?_0x253c4e[_0xd485('0x19')]:moment()[_0xd485('0x1a')](_0xd485('0x1b')),'priority':_0x253c4e[_0xd485('0x2b')]?_0x253c4e[_0xd485('0x2b')]:0x2,'callback':_0x253c4e[_0xd485('0x2c')]?!![]:![],'callbackuniqueid':_0x253c4e[_0xd485('0x2c')]?_0x253c4e['callbackUniqueid']:undefined,'callbackat':_0x253c4e[_0xd485('0x2c')]?moment()[_0xd485('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x532887['id']})[_0xd485('0x2d')](_0x32305d());});}}}})[_0xd485('0x20')](function(){return _0x94dc80[_0xd485('0x1e')][_0xd485('0x36')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x94dc80[_0xd485('0x37')],'as':_0xd485('0x3b'),'where':{'id':_0x253c4e['ListId']}}]})['then'](function(_0x4590cc){if(_0x4590cc){var _0xa03538=[];for(var _0x1fa74a=0x0,_0x2dcbee;_0x1fa74a<_0x4590cc['length'];_0x1fa74a+=0x1){_0x2dcbee=_0x4590cc[_0x1fa74a][_0xd485('0x17')]({'plain':!![]});_0x94dc80[_0xd485('0x3c')][_0xd485('0x29')]({'phone':_0x253c4e[_0xd485('0xe')],'ContactId':_0x253c4e['id'],'ListId':_0x253c4e['ListId'],'VoiceQueueId':_0x2dcbee['id']})[_0xd485('0x2d')](function(_0x18dcd3){logger[_0xd485('0x3d')](_0xd485('0x3e'),_0xd485('0x18'),_0x18dcd3[_0xd485('0x3f')]);});}}});})[_0xd485('0x20')](function(){return _0x94dc80[_0xd485('0x40')][_0xd485('0x36')]({'attributes':['id',_0xd485('0x41'),'dialTimezone'],'include':[{'model':_0x94dc80[_0xd485('0x37')],'as':_0xd485('0x38'),'where':{'id':_0x253c4e[_0xd485('0x2a')]}}]})[_0xd485('0x20')](function(_0x2b71eb){if(_0x2b71eb){var _0x192f19=[];for(var _0x1a8b4c=0x0,_0x47e4c3;_0x1a8b4c<_0x2b71eb['length'];_0x1a8b4c+=0x1){_0x47e4c3=_0x2b71eb[_0x1a8b4c]['get']({'plain':!![]});switch(_0x47e4c3['dialCheckDuplicateType']){case _0xd485('0x3a'):_0x1016f1(_0x47e4c3)[_0xd485('0x2d')](_0x2d8f54());break;case _0xd485('0x42'):_0x565ab4(_0x47e4c3)[_0xd485('0x2d')](_0x2d8f54());break;default:_0x94dc80[_0xd485('0x26')][_0xd485('0x29')]({'phone':_0x253c4e[_0xd485('0xe')],'ContactId':_0x253c4e['id'],'ListId':_0x253c4e[_0xd485('0x2a')],'scheduledat':_0x253c4e[_0xd485('0x19')]?_0x253c4e['scheduledat']:moment()[_0xd485('0x1a')](_0xd485('0x1b')),'priority':_0x253c4e['priority']?_0x253c4e[_0xd485('0x2b')]:0x2,'callback':_0x253c4e[_0xd485('0x2c')]?!![]:![],'callbackuniqueid':_0x253c4e[_0xd485('0x2c')]?_0x253c4e[_0xd485('0x2c')]:undefined,'callbackat':_0x253c4e['callbackUniqueid']?moment()[_0xd485('0x1a')](_0xd485('0x1b')):undefined,'CampaignId':_0x47e4c3['id']})['catch'](_0x2d8f54());}}}});})[_0xd485('0x20')](function(){return _0x94dc80[_0xd485('0x40')]['findAll']({'attributes':['id'],'include':[{'model':_0x94dc80[_0xd485('0x37')],'as':_0xd485('0x3b'),'where':{'id':_0x253c4e[_0xd485('0x2a')]}}]})[_0xd485('0x20')](function(_0x11e635){if(_0x11e635){var _0x5ae533=[];for(var _0x18c8a0=0x0,_0x8ccf5c;_0x18c8a0<_0x11e635[_0xd485('0x39')];_0x18c8a0+=0x1){_0x8ccf5c=_0x11e635[_0x18c8a0][_0xd485('0x17')]({'plain':!![]});_0x94dc80[_0xd485('0x3c')][_0xd485('0x29')]({'phone':_0x253c4e[_0xd485('0xe')],'ContactId':_0x253c4e['id'],'ListId':_0x253c4e[_0xd485('0x2a')],'CampaignId':_0x8ccf5c['id']})['catch'](function(_0x45f39b){logger['error'](_0xd485('0x3e'),'afterCreate',_0x45f39b[_0xd485('0x3f')]);});}}});})[_0xd485('0x20')](function(){_0x46e595();})['catch'](function(_0x14989e){logger[_0xd485('0x3d')](_0xd485('0x3e'),_0xd485('0x18'),_0x14989e[_0xd485('0x3f')]);_0x46e595(_0x14989e);});}else{_0x46e595(new Error(_0xd485('0x43')));}},'afterDestroy':function(_0x28df08,_0x53e756,_0x1ac484){var _0x2dd984=_0x54443d[_0xd485('0x16')];var _0x539714=_0x28df08[_0xd485('0x17')]({'plain':!![]});return _0x2dd984[_0xd485('0x26')]['findAll']({'raw':!![],'where':{'ListId':_0x539714[_0xd485('0x2a')],'ContactId':_0x539714['id']}})[_0xd485('0x20')](function(_0x553b9c){if(!_['isEmpty'](_0x553b9c)){var _0x521fd8=[];for(var _0x285928=0x0;_0x285928<_0x553b9c['length'];_0x285928+=0x1){var _0x529afd=_0x2dd984[_0xd485('0x26')][_0xd485('0x44')]({'where':{'ListId':_0x553b9c[_0x285928][_0xd485('0x2a')],'ContactId':_0x553b9c[_0x285928]['ContactId'],'VoiceQueueId':_0x553b9c[_0x285928][_0xd485('0x45')],'CampaignId':_0x553b9c[_0x285928][_0xd485('0x46')]}});_0x521fd8[_0xd485('0x47')](_0x529afd);}return BPromise[_0xd485('0x48')](_0x521fd8);}})[_0xd485('0x20')](function(_0x587c05){logger[_0xd485('0x49')](_0xd485('0x4a'),util['inspect'](_0x587c05,{'showHidden':![],'depth':null}));_0x1ac484();})['catch'](function(_0x53002b){logger[_0xd485('0x3d')]('[CmContact][afterDestroy][Error]',util[_0xd485('0x32')](_0x53002b,{'showHidden':![],'depth':null}));_0x1ac484(_0x53002b);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index d1f00a0..ef561ed 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(_0x331d28,_0x559ee3){var _0x35f401=function(_0x36599c){while(--_0x36599c){_0x331d28['push'](_0x331d28['shift']());}};_0x35f401(++_0x559ee3);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var 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(_0x35a43c,_0x289386){var _0x51edd6=function(_0x2cccec){while(--_0x2cccec){_0x35a43c['push'](_0x35a43c['shift']());}};_0x51edd6(++_0x289386);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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 512d2b8..91cb915 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 _0xf46a=['sequelize','INTEGER','STRING','PHONE'];(function(_0x4ce331,_0x138318){var _0x56309c=function(_0x2e8e97){while(--_0x2e8e97){_0x4ce331['push'](_0x4ce331['shift']());}};_0x56309c(++_0x138318);}(_0xf46a,0xa4));var _0xaf46=function(_0x5a1cf4,_0x5e5e11){_0x5a1cf4=_0x5a1cf4-0x0;var _0x17f692=_0xf46a[_0x5a1cf4];return _0x17f692;};'use strict';var Sequelize=require(_0xaf46('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0xaf46('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0xaf46('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xaf46('0x2')],'defaultValue':_0xaf46('0x3')},'OrderBy':{'type':Sequelize[_0xaf46('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0xaf46('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x5044=['exports','STRING','INTEGER','PHONE'];(function(_0x345ac8,_0x2daa49){var _0x552f86=function(_0x2210b8){while(--_0x2210b8){_0x345ac8['push'](_0x345ac8['shift']());}};_0x552f86(++_0x2daa49);}(_0x5044,0xc8));var _0x4504=function(_0x5e2a4f,_0x3f6624){_0x5e2a4f=_0x5e2a4f-0x0;var _0x80ac92=_0x5044[_0x5e2a4f];return _0x80ac92;};'use strict';var Sequelize=require('sequelize');module[_0x4504('0x0')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x4504('0x1')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x4504('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x4504('0x1')],'defaultValue':_0x4504('0x3')},'OrderBy':{'type':Sequelize[_0x4504('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0x4504('0x1')],'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 2922f81..e2efc52 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 _0xc256=['hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','findAll','rows','show','include','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','rimraf','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','get','CmContactHasItems','UserProfileResource','destroy','end','sendStatus','stack','name','send','index','CmContactHasItem','rawAttributes','type','key','map','query','keys','intersection','model','attributes','fields','length'];(function(_0x275e38,_0x298e24){var _0x533891=function(_0x30ac46){while(--_0x30ac46){_0x275e38['push'](_0x275e38['shift']());}};_0x533891(++_0x298e24);}(_0xc256,0x112));var _0x6c25=function(_0x37f030,_0x1d5e22){_0x37f030=_0x37f030-0x0;var _0x55a37f=_0xc256[_0x37f030];return _0x55a37f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6c25('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6c25('0x1'));var moment=require(_0x6c25('0x2'));var BPromise=require(_0x6c25('0x3'));var Mustache=require('mustache');var util=require(_0x6c25('0x4'));var path=require('path');var sox=require(_0x6c25('0x5'));var csv=require(_0x6c25('0x6'));var ejs=require(_0x6c25('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6c25('0x8'));var squel=require(_0x6c25('0x9'));var crypto=require('crypto');var jsforce=require(_0x6c25('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x6c25('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6c25('0xb'));var authService=require(_0x6c25('0xc'));var qs=require(_0x6c25('0xd'));var as=require(_0x6c25('0xe'));var hardwareService=require(_0x6c25('0xf'));var logger=require(_0x6c25('0x10'))('api');var utils=require(_0x6c25('0x11'));var config=require(_0x6c25('0x12'));var licenseUtil=require(_0x6c25('0x13'));var db=require(_0x6c25('0x14'))['db'];function respondWithStatusCode(_0x37fd65,_0x1cdcb7){_0x1cdcb7=_0x1cdcb7||0xcc;return function(_0xe95f18){if(_0xe95f18){return _0x37fd65['sendStatus'](_0x1cdcb7);}return _0x37fd65['status'](_0x1cdcb7)['end']();};}function respondWithResult(_0x3412da,_0x398479){_0x398479=_0x398479||0xc8;return function(_0x17b255){if(_0x17b255){return _0x3412da[_0x6c25('0x15')](_0x398479)[_0x6c25('0x16')](_0x17b255);}};}function respondWithFilteredResult(_0xdef871,_0x38a82b){return function(_0x3b6f34){if(_0x3b6f34){var _0xe75c11=typeof _0x38a82b[_0x6c25('0x17')]===_0x6c25('0x18')&&typeof _0x38a82b[_0x6c25('0x19')]===_0x6c25('0x18');var _0x56defa=_0x3b6f34['count'];var _0x532500=_0xe75c11?0x0:_0x38a82b['offset'];var _0x51ba80=_0xe75c11?_0x3b6f34['count']:_0x38a82b[_0x6c25('0x17')]+_0x38a82b[_0x6c25('0x19')];var _0x57465f;if(_0x51ba80>=_0x56defa){_0x51ba80=_0x56defa;_0x57465f=0xc8;}else{_0x57465f=0xce;}_0xdef871['status'](_0x57465f);return _0xdef871[_0x6c25('0x1a')](_0x6c25('0x1b'),_0x532500+'-'+_0x51ba80+'/'+_0x56defa)[_0x6c25('0x16')](_0x3b6f34);}return null;};}function patchUpdates(_0x37db8d){return function(_0x5cd0d1){try{jsonpatch[_0x6c25('0x1c')](_0x5cd0d1,_0x37db8d,!![]);}catch(_0x29f92e){return BPromise[_0x6c25('0x1d')](_0x29f92e);}return _0x5cd0d1[_0x6c25('0x1e')]();};}function saveUpdates(_0xb48a68,_0x555d74){return function(_0x337256){if(_0x337256){return _0x337256['update'](_0xb48a68)[_0x6c25('0x1f')](function(_0x48bd6c){return _0x48bd6c;});}return null;};}function removeEntity(_0xf15089,_0x31e51d){return function(_0x30ca4b){if(_0x30ca4b){return _0x30ca4b['destroy']()[_0x6c25('0x1f')](function(){var _0x245be3=_0x30ca4b[_0x6c25('0x20')]({'plain':!![]});var _0x8e77b=_0x6c25('0x21');return db[_0x6c25('0x22')][_0x6c25('0x23')]({'where':{'type':_0x8e77b,'resourceId':_0x245be3['id']}})[_0x6c25('0x1f')](function(){return _0x30ca4b;});})[_0x6c25('0x1f')](function(){_0xf15089[_0x6c25('0x15')](0xcc)[_0x6c25('0x24')]();});}};}function handleEntityNotFound(_0x1899db,_0x3a754f){return function(_0x314c12){if(!_0x314c12){_0x1899db[_0x6c25('0x25')](0x194);}return _0x314c12;};}function handleError(_0xa39f72,_0x562eef){_0x562eef=_0x562eef||0x1f4;return function(_0x475a1f){logger['error'](_0x475a1f[_0x6c25('0x26')]);if(_0x475a1f[_0x6c25('0x27')]){delete _0x475a1f[_0x6c25('0x27')];}_0xa39f72[_0x6c25('0x15')](_0x562eef)[_0x6c25('0x28')](_0x475a1f);};}exports[_0x6c25('0x29')]=function(_0x2c6d69,_0x2b822a){var _0x26583b={},_0x799ef0={},_0x5cfa77={'count':0x0,'rows':[]};var _0x495071=_['map'](db[_0x6c25('0x2a')][_0x6c25('0x2b')],function(_0x5712e2){return{'name':_0x5712e2['fieldName'],'type':_0x5712e2[_0x6c25('0x2c')][_0x6c25('0x2d')]};});_0x799ef0['model']=_[_0x6c25('0x2e')](_0x495071,_0x6c25('0x27'));_0x799ef0[_0x6c25('0x2f')]=_[_0x6c25('0x30')](_0x2c6d69['query']);_0x799ef0['filters']=_[_0x6c25('0x31')](_0x799ef0[_0x6c25('0x32')],_0x799ef0[_0x6c25('0x2f')]);_0x26583b[_0x6c25('0x33')]=_[_0x6c25('0x31')](_0x799ef0[_0x6c25('0x32')],qs['fields'](_0x2c6d69[_0x6c25('0x2f')][_0x6c25('0x34')]));_0x26583b[_0x6c25('0x33')]=_0x26583b[_0x6c25('0x33')][_0x6c25('0x35')]?_0x26583b[_0x6c25('0x33')]:_0x799ef0[_0x6c25('0x32')];if(!_0x2c6d69[_0x6c25('0x2f')][_0x6c25('0x36')](_0x6c25('0x37'))){_0x26583b[_0x6c25('0x19')]=qs[_0x6c25('0x19')](_0x2c6d69[_0x6c25('0x2f')][_0x6c25('0x19')]);_0x26583b['offset']=qs['offset'](_0x2c6d69['query']['offset']);}_0x26583b['order']=qs[_0x6c25('0x38')](_0x2c6d69[_0x6c25('0x2f')][_0x6c25('0x38')]);_0x26583b[_0x6c25('0x39')]=qs['filters'](_[_0x6c25('0x3a')](_0x2c6d69['query'],_0x799ef0['filters']),_0x495071);if(_0x2c6d69[_0x6c25('0x2f')]['filter']){_0x26583b[_0x6c25('0x39')]=_[_0x6c25('0x3b')](_0x26583b[_0x6c25('0x39')],{'$or':_[_0x6c25('0x2e')](_0x495071,function(_0x13fb39){if(_0x13fb39[_0x6c25('0x2c')]!==_0x6c25('0x3c')){var _0x29c5aa={};_0x29c5aa[_0x13fb39[_0x6c25('0x27')]]={'$like':'%'+_0x2c6d69[_0x6c25('0x2f')][_0x6c25('0x3d')]+'%'};return _0x29c5aa;}})});}_0x26583b=_[_0x6c25('0x3b')]({},_0x26583b,_0x2c6d69[_0x6c25('0x3e')]);var _0x245d7c={'where':_0x26583b[_0x6c25('0x39')]};return db[_0x6c25('0x2a')]['count'](_0x245d7c)[_0x6c25('0x1f')](function(_0x90a827){_0x5cfa77[_0x6c25('0x3f')]=_0x90a827;if(_0x2c6d69['query'][_0x6c25('0x40')]){_0x26583b['include']=[{'all':!![]}];}return db[_0x6c25('0x2a')][_0x6c25('0x41')](_0x26583b);})[_0x6c25('0x1f')](function(_0xa3a401){_0x5cfa77[_0x6c25('0x42')]=_0xa3a401;return _0x5cfa77;})[_0x6c25('0x1f')](respondWithFilteredResult(_0x2b822a,_0x26583b))['catch'](handleError(_0x2b822a,null));};exports[_0x6c25('0x43')]=function(_0x3afbe0,_0xb980e0){var _0x56b3ac={'raw':!![],'where':{'id':_0x3afbe0['params']['id']}},_0x36704c={};_0x36704c[_0x6c25('0x32')]=_[_0x6c25('0x30')](db[_0x6c25('0x2a')][_0x6c25('0x2b')]);_0x36704c[_0x6c25('0x2f')]=_[_0x6c25('0x30')](_0x3afbe0[_0x6c25('0x2f')]);_0x36704c['filters']=_[_0x6c25('0x31')](_0x36704c[_0x6c25('0x32')],_0x36704c[_0x6c25('0x2f')]);_0x56b3ac[_0x6c25('0x33')]=_[_0x6c25('0x31')](_0x36704c[_0x6c25('0x32')],qs[_0x6c25('0x34')](_0x3afbe0[_0x6c25('0x2f')]['fields']));_0x56b3ac[_0x6c25('0x33')]=_0x56b3ac[_0x6c25('0x33')][_0x6c25('0x35')]?_0x56b3ac[_0x6c25('0x33')]:_0x36704c['model'];if(_0x3afbe0['query']['includeAll']){_0x56b3ac[_0x6c25('0x44')]=[{'all':!![]}];}_0x56b3ac=_['merge']({},_0x56b3ac,_0x3afbe0[_0x6c25('0x3e')]);return db[_0x6c25('0x2a')][_0x6c25('0x45')](_0x56b3ac)[_0x6c25('0x1f')](handleEntityNotFound(_0xb980e0,null))['then'](respondWithResult(_0xb980e0,null))[_0x6c25('0x46')](handleError(_0xb980e0,null));};exports[_0x6c25('0x47')]=function(_0x2c09cd,_0x57d3ac){return db['CmContactHasItem'][_0x6c25('0x47')](_0x2c09cd[_0x6c25('0x48')],{})['then'](function(_0x401d42){var _0x95066=_0x2c09cd[_0x6c25('0x49')][_0x6c25('0x20')]({'plain':!![]});if(!_0x95066)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x95066[_0x6c25('0x4a')]===_0x6c25('0x49')){var _0x56e562=_0x401d42[_0x6c25('0x20')]({'plain':!![]});var _0x494cfc=_0x6c25('0x21');return db[_0x6c25('0x4b')][_0x6c25('0x45')]({'where':{'name':_0x494cfc,'userProfileId':_0x95066[_0x6c25('0x4c')]},'raw':!![]})[_0x6c25('0x1f')](function(_0x14ab99){if(_0x14ab99&&_0x14ab99[_0x6c25('0x4d')]===0x0){return db[_0x6c25('0x22')][_0x6c25('0x47')]({'name':_0x56e562[_0x6c25('0x27')],'resourceId':_0x56e562['id'],'type':_0x14ab99[_0x6c25('0x27')],'sectionId':_0x14ab99['id']},{})['then'](function(){return _0x401d42;});}else{return _0x401d42;}})[_0x6c25('0x46')](function(_0x3cff4d){logger[_0x6c25('0x4e')](_0x6c25('0x4f'),_0x3cff4d);throw _0x3cff4d;});}return _0x401d42;})[_0x6c25('0x1f')](respondWithResult(_0x57d3ac,0xc9))[_0x6c25('0x46')](handleError(_0x57d3ac,null));};exports[_0x6c25('0x50')]=function(_0x58a930,_0x114f28){if(_0x58a930[_0x6c25('0x48')]['id']){delete _0x58a930[_0x6c25('0x48')]['id'];}return db['CmContactHasItem'][_0x6c25('0x45')]({'where':{'id':_0x58a930[_0x6c25('0x51')]['id']}})['then'](handleEntityNotFound(_0x114f28,null))[_0x6c25('0x1f')](saveUpdates(_0x58a930[_0x6c25('0x48')],null))['then'](respondWithResult(_0x114f28,null))[_0x6c25('0x46')](handleError(_0x114f28,null));};exports[_0x6c25('0x23')]=function(_0x217830,_0x386e1b){return db['CmContactHasItem'][_0x6c25('0x45')]({'where':{'id':_0x217830['params']['id']}})[_0x6c25('0x1f')](handleEntityNotFound(_0x386e1b,null))[_0x6c25('0x1f')](removeEntity(_0x386e1b,null))[_0x6c25('0x46')](handleError(_0x386e1b,null));}; \ No newline at end of file +var _0x4076=['include','rows','show','params','rawAttributes','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','get','CmContactHasItems','UserProfileResource','destroy','error','stack','name','send','index','map','CmContactHasItem','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','sort','filter','where','VIRTUAL','merge','includeAll'];(function(_0x1a9208,_0x6e61b7){var _0x3da0c9=function(_0x33f870){while(--_0x33f870){_0x1a9208['push'](_0x1a9208['shift']());}};_0x3da0c9(++_0x6e61b7);}(_0x4076,0xb3));var _0x6407=function(_0x4b673e,_0x4cc36a){_0x4b673e=_0x4b673e-0x0;var _0x4a978c=_0x4076[_0x4b673e];return _0x4a978c;};'use strict';var emlformat=require(_0x6407('0x0'));var rimraf=require(_0x6407('0x1'));var zipdir=require(_0x6407('0x2'));var jsonpatch=require(_0x6407('0x3'));var rp=require(_0x6407('0x4'));var moment=require(_0x6407('0x5'));var BPromise=require(_0x6407('0x6'));var Mustache=require('mustache');var util=require(_0x6407('0x7'));var path=require(_0x6407('0x8'));var sox=require(_0x6407('0x9'));var csv=require('to-csv');var ejs=require(_0x6407('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6407('0xb'));var squel=require(_0x6407('0xc'));var crypto=require('crypto');var jsforce=require(_0x6407('0xd'));var deskjs=require(_0x6407('0xe'));var toCsv=require(_0x6407('0xf'));var querystring=require(_0x6407('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6407('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6407('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6407('0x13'))(_0x6407('0x14'));var utils=require(_0x6407('0x15'));var config=require(_0x6407('0x16'));var licenseUtil=require(_0x6407('0x17'));var db=require(_0x6407('0x18'))['db'];function respondWithStatusCode(_0x2b92d8,_0x143089){_0x143089=_0x143089||0xcc;return function(_0x50ed1a){if(_0x50ed1a){return _0x2b92d8[_0x6407('0x19')](_0x143089);}return _0x2b92d8[_0x6407('0x1a')](_0x143089)[_0x6407('0x1b')]();};}function respondWithResult(_0xbff9da,_0x6cada3){_0x6cada3=_0x6cada3||0xc8;return function(_0x4b0235){if(_0x4b0235){return _0xbff9da[_0x6407('0x1a')](_0x6cada3)['json'](_0x4b0235);}};}function respondWithFilteredResult(_0x277fd,_0x3ba84e){return function(_0x5678b8){if(_0x5678b8){var _0x5535ac=typeof _0x3ba84e[_0x6407('0x1c')]===_0x6407('0x1d')&&typeof _0x3ba84e[_0x6407('0x1e')]===_0x6407('0x1d');var _0x5be963=_0x5678b8[_0x6407('0x1f')];var _0x119ead=_0x5535ac?0x0:_0x3ba84e[_0x6407('0x1c')];var _0x187194=_0x5535ac?_0x5678b8[_0x6407('0x1f')]:_0x3ba84e['offset']+_0x3ba84e['limit'];var _0xe62edf;if(_0x187194>=_0x5be963){_0x187194=_0x5be963;_0xe62edf=0xc8;}else{_0xe62edf=0xce;}_0x277fd['status'](_0xe62edf);return _0x277fd[_0x6407('0x20')](_0x6407('0x21'),_0x119ead+'-'+_0x187194+'/'+_0x5be963)[_0x6407('0x22')](_0x5678b8);}return null;};}function patchUpdates(_0x331cec){return function(_0x1365ca){try{jsonpatch[_0x6407('0x23')](_0x1365ca,_0x331cec,!![]);}catch(_0x270e8b){return BPromise[_0x6407('0x24')](_0x270e8b);}return _0x1365ca[_0x6407('0x25')]();};}function saveUpdates(_0x233a6a,_0x6343a8){return function(_0x384eb4){if(_0x384eb4){return _0x384eb4[_0x6407('0x26')](_0x233a6a)[_0x6407('0x27')](function(_0x3740b9){return _0x3740b9;});}return null;};}function removeEntity(_0x2a25a1,_0xdd2a1b){return function(_0x1a3eb3){if(_0x1a3eb3){return _0x1a3eb3['destroy']()[_0x6407('0x27')](function(){var _0x121236=_0x1a3eb3[_0x6407('0x28')]({'plain':!![]});var _0x532090=_0x6407('0x29');return db[_0x6407('0x2a')][_0x6407('0x2b')]({'where':{'type':_0x532090,'resourceId':_0x121236['id']}})[_0x6407('0x27')](function(){return _0x1a3eb3;});})[_0x6407('0x27')](function(){_0x2a25a1[_0x6407('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x395178,_0x26aec2){return function(_0x18f0e5){if(!_0x18f0e5){_0x395178[_0x6407('0x19')](0x194);}return _0x18f0e5;};}function handleError(_0x3abb8e,_0x206167){_0x206167=_0x206167||0x1f4;return function(_0x19706f){logger[_0x6407('0x2c')](_0x19706f[_0x6407('0x2d')]);if(_0x19706f[_0x6407('0x2e')]){delete _0x19706f[_0x6407('0x2e')];}_0x3abb8e[_0x6407('0x1a')](_0x206167)[_0x6407('0x2f')](_0x19706f);};}exports[_0x6407('0x30')]=function(_0x360d32,_0x5e62c2){var _0x41cc67={},_0x30e687={},_0x3c2f4a={'count':0x0,'rows':[]};var _0x91b7df=_[_0x6407('0x31')](db[_0x6407('0x32')]['rawAttributes'],function(_0xe17aeb){return{'name':_0xe17aeb[_0x6407('0x33')],'type':_0xe17aeb[_0x6407('0x34')]['key']};});_0x30e687[_0x6407('0x35')]=_[_0x6407('0x31')](_0x91b7df,_0x6407('0x2e'));_0x30e687['query']=_[_0x6407('0x36')](_0x360d32[_0x6407('0x37')]);_0x30e687[_0x6407('0x38')]=_[_0x6407('0x39')](_0x30e687['model'],_0x30e687['query']);_0x41cc67[_0x6407('0x3a')]=_[_0x6407('0x39')](_0x30e687['model'],qs[_0x6407('0x3b')](_0x360d32['query'][_0x6407('0x3b')]));_0x41cc67['attributes']=_0x41cc67[_0x6407('0x3a')][_0x6407('0x3c')]?_0x41cc67[_0x6407('0x3a')]:_0x30e687[_0x6407('0x35')];if(!_0x360d32[_0x6407('0x37')]['hasOwnProperty']('nolimit')){_0x41cc67[_0x6407('0x1e')]=qs[_0x6407('0x1e')](_0x360d32[_0x6407('0x37')]['limit']);_0x41cc67[_0x6407('0x1c')]=qs[_0x6407('0x1c')](_0x360d32[_0x6407('0x37')][_0x6407('0x1c')]);}_0x41cc67['order']=qs[_0x6407('0x3d')](_0x360d32[_0x6407('0x37')][_0x6407('0x3d')]);_0x41cc67['where']=qs[_0x6407('0x38')](_['pick'](_0x360d32[_0x6407('0x37')],_0x30e687['filters']),_0x91b7df);if(_0x360d32[_0x6407('0x37')][_0x6407('0x3e')]){_0x41cc67[_0x6407('0x3f')]=_['merge'](_0x41cc67[_0x6407('0x3f')],{'$or':_[_0x6407('0x31')](_0x91b7df,function(_0x17ce51){if(_0x17ce51[_0x6407('0x34')]!==_0x6407('0x40')){var _0x5d1c68={};_0x5d1c68[_0x17ce51[_0x6407('0x2e')]]={'$like':'%'+_0x360d32[_0x6407('0x37')][_0x6407('0x3e')]+'%'};return _0x5d1c68;}})});}_0x41cc67=_[_0x6407('0x41')]({},_0x41cc67,_0x360d32['options']);var _0x166815={'where':_0x41cc67[_0x6407('0x3f')]};return db['CmContactHasItem']['count'](_0x166815)[_0x6407('0x27')](function(_0x3de2ec){_0x3c2f4a['count']=_0x3de2ec;if(_0x360d32['query'][_0x6407('0x42')]){_0x41cc67[_0x6407('0x43')]=[{'all':!![]}];}return db[_0x6407('0x32')]['findAll'](_0x41cc67);})[_0x6407('0x27')](function(_0x5a3843){_0x3c2f4a[_0x6407('0x44')]=_0x5a3843;return _0x3c2f4a;})[_0x6407('0x27')](respondWithFilteredResult(_0x5e62c2,_0x41cc67))['catch'](handleError(_0x5e62c2,null));};exports[_0x6407('0x45')]=function(_0x514cf6,_0x4c5aea){var _0x3c6d8e={'raw':!![],'where':{'id':_0x514cf6[_0x6407('0x46')]['id']}},_0x146dda={};_0x146dda['model']=_[_0x6407('0x36')](db[_0x6407('0x32')][_0x6407('0x47')]);_0x146dda['query']=_[_0x6407('0x36')](_0x514cf6['query']);_0x146dda['filters']=_[_0x6407('0x39')](_0x146dda['model'],_0x146dda[_0x6407('0x37')]);_0x3c6d8e[_0x6407('0x3a')]=_[_0x6407('0x39')](_0x146dda[_0x6407('0x35')],qs[_0x6407('0x3b')](_0x514cf6[_0x6407('0x37')][_0x6407('0x3b')]));_0x3c6d8e[_0x6407('0x3a')]=_0x3c6d8e[_0x6407('0x3a')][_0x6407('0x3c')]?_0x3c6d8e[_0x6407('0x3a')]:_0x146dda[_0x6407('0x35')];if(_0x514cf6[_0x6407('0x37')]['includeAll']){_0x3c6d8e[_0x6407('0x43')]=[{'all':!![]}];}_0x3c6d8e=_[_0x6407('0x41')]({},_0x3c6d8e,_0x514cf6['options']);return db[_0x6407('0x32')][_0x6407('0x48')](_0x3c6d8e)[_0x6407('0x27')](handleEntityNotFound(_0x4c5aea,null))[_0x6407('0x27')](respondWithResult(_0x4c5aea,null))[_0x6407('0x49')](handleError(_0x4c5aea,null));};exports[_0x6407('0x4a')]=function(_0x23298e,_0x3f57c3){return db['CmContactHasItem']['create'](_0x23298e[_0x6407('0x4b')],{})['then'](function(_0x18efbc){var _0x2a9970=_0x23298e[_0x6407('0x4c')][_0x6407('0x28')]({'plain':!![]});if(!_0x2a9970)throw new Error(_0x6407('0x4d'));if(_0x2a9970[_0x6407('0x4e')]===_0x6407('0x4c')){var _0x1c0162=_0x18efbc['get']({'plain':!![]});var _0x128297=_0x6407('0x29');return db[_0x6407('0x4f')][_0x6407('0x48')]({'where':{'name':_0x128297,'userProfileId':_0x2a9970[_0x6407('0x50')]},'raw':!![]})['then'](function(_0x494e7b){if(_0x494e7b&&_0x494e7b[_0x6407('0x51')]===0x0){return db[_0x6407('0x2a')][_0x6407('0x4a')]({'name':_0x1c0162[_0x6407('0x2e')],'resourceId':_0x1c0162['id'],'type':_0x494e7b[_0x6407('0x2e')],'sectionId':_0x494e7b['id']},{})['then'](function(){return _0x18efbc;});}else{return _0x18efbc;}})['catch'](function(_0x188042){logger[_0x6407('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x188042);throw _0x188042;});}return _0x18efbc;})['then'](respondWithResult(_0x3f57c3,0xc9))[_0x6407('0x49')](handleError(_0x3f57c3,null));};exports[_0x6407('0x26')]=function(_0x1622f1,_0xad3de9){if(_0x1622f1[_0x6407('0x4b')]['id']){delete _0x1622f1[_0x6407('0x4b')]['id'];}return db[_0x6407('0x32')][_0x6407('0x48')]({'where':{'id':_0x1622f1['params']['id']}})[_0x6407('0x27')](handleEntityNotFound(_0xad3de9,null))[_0x6407('0x27')](saveUpdates(_0x1622f1[_0x6407('0x4b')],null))['then'](respondWithResult(_0xad3de9,null))[_0x6407('0x49')](handleError(_0xad3de9,null));};exports['destroy']=function(_0x1a643e,_0x56191c){return db[_0x6407('0x32')][_0x6407('0x48')]({'where':{'id':_0x1a643e[_0x6407('0x46')]['id']}})[_0x6407('0x27')](handleEntityNotFound(_0x56191c,null))[_0x6407('0x27')](removeEntity(_0x56191c,null))[_0x6407('0x49')](handleError(_0x56191c,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 8f4b2b2..e73c88c 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 _0x70ff=['util','../../config/logger','moment','request-promise','path','rimraf','./cmContactHasItem.attributes','exports','define','CmContactHasItem','lodash'];(function(_0x1153c7,_0x37f23f){var _0x2b2e20=function(_0x5d66f8){while(--_0x5d66f8){_0x1153c7['push'](_0x1153c7['shift']());}};_0x2b2e20(++_0x37f23f);}(_0x70ff,0xaf));var _0xf70f=function(_0x4956f2,_0xb602ca){_0x4956f2=_0x4956f2-0x0;var _0x1da579=_0x70ff[_0x4956f2];return _0x1da579;};'use strict';var _=require(_0xf70f('0x0'));var util=require(_0xf70f('0x1'));var logger=require(_0xf70f('0x2'))('api');var moment=require(_0xf70f('0x3'));var BPromise=require('bluebird');var rp=require(_0xf70f('0x4'));var fs=require('fs');var path=require(_0xf70f('0x5'));var rimraf=require(_0xf70f('0x6'));var config=require('../../config/environment');var attributes=require(_0xf70f('0x7'));module[_0xf70f('0x8')]=function(_0x5b0746,_0x590c09){return _0x5b0746[_0xf70f('0x9')](_0xf70f('0xa'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xebc5=['define','CmContactHasItem','lodash','util','api','moment','bluebird','../../config/environment','./cmContactHasItem.attributes','exports'];(function(_0x422311,_0x54125c){var _0x356858=function(_0x283a0f){while(--_0x283a0f){_0x422311['push'](_0x422311['shift']());}};_0x356858(++_0x54125c);}(_0xebc5,0x1ec));var _0x5ebc=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xebc5[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0x5ebc('0x0'));var util=require(_0x5ebc('0x1'));var logger=require('../../config/logger')(_0x5ebc('0x2'));var moment=require(_0x5ebc('0x3'));var BPromise=require(_0x5ebc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5ebc('0x5'));var attributes=require(_0x5ebc('0x6'));module[_0x5ebc('0x7')]=function(_0x545d19,_0x36583f){return _0x545d19[_0x5ebc('0x8')](_0x5ebc('0x9'),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 f464780..4b3c9d3 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 _0x9df2=['jayson/promise','http','request','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9df2,0x150));var _0x29df=function(_0x356cd9,_0x1cc533){_0x356cd9=_0x356cd9-0x0;var _0x5de313=_0x9df2[_0x356cd9];return _0x5de313;};'use strict';var _=require('lodash');var util=require(_0x29df('0x0'));var moment=require('moment');var BPromise=require(_0x29df('0x1'));var rs=require(_0x29df('0x2'));var fs=require('fs');var Redis=require(_0x29df('0x3'));var db=require(_0x29df('0x4'))['db'];var utils=require(_0x29df('0x5'));var logger=require(_0x29df('0x6'))(_0x29df('0x7'));var config=require(_0x29df('0x8'));var jayson=require(_0x29df('0x9'));var client=jayson['client'][_0x29df('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1bbdaa,_0x3d3dca,_0x1b5600){return new BPromise(function(_0x22ea25,_0x4fb272){return client[_0x29df('0xb')](_0x1bbdaa,_0x1b5600)['then'](function(_0x2a2e38){logger[_0x29df('0xc')](_0x29df('0xd'),_0x3d3dca,_0x29df('0xe'));logger[_0x29df('0xf')](_0x29df('0x10'),_0x3d3dca,'request\x20sent',JSON[_0x29df('0x11')](_0x2a2e38));if(_0x2a2e38[_0x29df('0x12')]){if(_0x2a2e38[_0x29df('0x12')][_0x29df('0x13')]===0x1f4){logger[_0x29df('0x12')](_0x29df('0xd'),_0x3d3dca,_0x2a2e38[_0x29df('0x12')]['message']);return _0x4fb272(_0x2a2e38[_0x29df('0x12')][_0x29df('0x14')]);}logger[_0x29df('0x12')]('CmContactHasItem,\x20%s,\x20%s',_0x3d3dca,_0x2a2e38[_0x29df('0x12')][_0x29df('0x14')]);return _0x22ea25(_0x2a2e38[_0x29df('0x12')][_0x29df('0x14')]);}else{logger[_0x29df('0xc')](_0x29df('0xd'),_0x3d3dca,_0x29df('0xe'));_0x22ea25(_0x2a2e38[_0x29df('0x15')][_0x29df('0x14')]);}})[_0x29df('0x16')](function(_0x207239){logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x3d3dca,_0x207239);_0x4fb272(_0x207239);});});} \ No newline at end of file +var _0xc79a=['info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x88d5fe,_0x39bffe){var _0x4761f9=function(_0x1da741){while(--_0x1da741){_0x88d5fe['push'](_0x88d5fe['shift']());}};_0x4761f9(++_0x39bffe);}(_0xc79a,0x14c));var _0xac79=function(_0x543eac,_0x3a39a1){_0x543eac=_0x543eac-0x0;var _0x16c036=_0xc79a[_0x543eac];return _0x16c036;};'use strict';var _=require(_0xac79('0x0'));var util=require(_0xac79('0x1'));var moment=require('moment');var BPromise=require(_0xac79('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac79('0x3'))['db'];var utils=require(_0xac79('0x4'));var logger=require(_0xac79('0x5'))(_0xac79('0x6'));var config=require('../../config/environment');var jayson=require(_0xac79('0x7'));var client=jayson[_0xac79('0x8')][_0xac79('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x518856,_0x274062,_0x32a7e8){return new BPromise(function(_0x3a0691,_0x4288c3){return client['request'](_0x518856,_0x32a7e8)['then'](function(_0x495121){logger[_0xac79('0xa')](_0xac79('0xb'),_0x274062,_0xac79('0xc'));logger[_0xac79('0xd')](_0xac79('0xe'),_0x274062,_0xac79('0xc'),JSON['stringify'](_0x495121));if(_0x495121['error']){if(_0x495121[_0xac79('0xf')][_0xac79('0x10')]===0x1f4){logger[_0xac79('0xf')]('CmContactHasItem,\x20%s,\x20%s',_0x274062,_0x495121['error'][_0xac79('0x11')]);return _0x4288c3(_0x495121['error'][_0xac79('0x11')]);}logger[_0xac79('0xf')](_0xac79('0xb'),_0x274062,_0x495121[_0xac79('0xf')][_0xac79('0x11')]);return _0x3a0691(_0x495121['error'][_0xac79('0x11')]);}else{logger[_0xac79('0xa')](_0xac79('0xb'),_0x274062,_0xac79('0xc'));_0x3a0691(_0x495121[_0xac79('0x12')][_0xac79('0x11')]);}})['catch'](function(_0x544fb7){logger[_0xac79('0xf')](_0xac79('0xb'),_0x274062,_0x544fb7);_0x4288c3(_0x544fb7);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 652a000..3a15057 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 _0x2801=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','util','path'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x2801,0x130));var _0x1280=function(_0x585e39,_0x476e02){_0x585e39=_0x585e39-0x0;var _0x23e396=_0x2801[_0x585e39];return _0x23e396;};'use strict';var multer=require('multer');var util=require(_0x1280('0x0'));var path=require(_0x1280('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1280('0x2')]();var fs_extra=require(_0x1280('0x3'));var auth=require(_0x1280('0x4'));var interaction=require(_0x1280('0x5'));var config=require(_0x1280('0x6'));var controller=require('./cmContactHasItem.controller');router[_0x1280('0x7')]('/',auth[_0x1280('0x8')](),controller['index']);router[_0x1280('0x7')]('/:id',auth[_0x1280('0x8')](),controller[_0x1280('0x9')]);router[_0x1280('0xa')]('/',auth[_0x1280('0x8')](),controller[_0x1280('0xb')]);router[_0x1280('0xc')](_0x1280('0xd'),auth['isAuthenticated'](),controller[_0x1280('0xe')]);router[_0x1280('0xf')]('/:id',auth[_0x1280('0x8')](),controller[_0x1280('0x10')]);module[_0x1280('0x11')]=router; \ No newline at end of file +var _0x0111=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmContactHasItem.controller','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x59680e,_0x297783){var _0x44909f=function(_0x4dbe3b){while(--_0x4dbe3b){_0x59680e['push'](_0x59680e['shift']());}};_0x44909f(++_0x297783);}(_0x0111,0x1cb));var _0x1011=function(_0x2bc35a,_0x4da8fd){_0x2bc35a=_0x2bc35a-0x0;var _0x26b765=_0x0111[_0x2bc35a];return _0x26b765;};'use strict';var multer=require(_0x1011('0x0'));var util=require('util');var path=require(_0x1011('0x1'));var timeout=require(_0x1011('0x2'));var express=require(_0x1011('0x3'));var router=express[_0x1011('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1011('0x5'));var interaction=require(_0x1011('0x6'));var config=require('../../config/environment');var controller=require(_0x1011('0x7'));router['get']('/',auth[_0x1011('0x8')](),controller['index']);router['get'](_0x1011('0x9'),auth[_0x1011('0x8')](),controller[_0x1011('0xa')]);router[_0x1011('0xb')]('/',auth['isAuthenticated'](),controller[_0x1011('0xc')]);router['put'](_0x1011('0x9'),auth['isAuthenticated'](),controller[_0x1011('0xd')]);router[_0x1011('0xe')](_0x1011('0x9'),auth[_0x1011('0x8')](),controller[_0x1011('0xf')]);module[_0x1011('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index d7eade4..0253b4d 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 _0x7906=['lodash','exports','VIRTUAL','alias','STRING','setDataValue','name','TEXT','getDataValue','type','select','parse','values','isArray','stringify','BOOLEAN','sequelize'];(function(_0x3699f3,_0x9a68a7){var _0x144ac7=function(_0xba1d6f){while(--_0xba1d6f){_0x3699f3['push'](_0x3699f3['shift']());}};_0x144ac7(++_0x9a68a7);}(_0x7906,0x175));var _0x6790=function(_0xc97bd7,_0x2a6e65){_0xc97bd7=_0xc97bd7-0x0;var _0x2fbb99=_0x7906[_0xc97bd7];return _0x2fbb99;};'use strict';var Sequelize=require(_0x6790('0x0'));var _=require(_0x6790('0x1'));module[_0x6790('0x2')]={'name':{'type':Sequelize[_0x6790('0x3')],'get':function(_0x42e56e){return this['getDataValue'](_0x6790('0x4'));}},'alias':{'type':Sequelize[_0x6790('0x5')],'allowNull':![],'set':function(_0x25e386){this[_0x6790('0x6')](_0x6790('0x4'),_0x25e386?_0x25e386:this['getDataValue'](_0x6790('0x7')));}},'type':{'type':Sequelize[_0x6790('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0x6790('0x8')]('long'),'get':function(){if(this[_0x6790('0x9')](_0x6790('0xa'))===_0x6790('0xb')){return JSON[_0x6790('0xc')](this['getDataValue'](_0x6790('0xd')));}else{return this['getDataValue'](_0x6790('0xd'));}},'set':function(_0x221afc){if(Array[_0x6790('0xe')](_0x221afc)){this[_0x6790('0x6')](_0x6790('0xd'),JSON[_0x6790('0xf')](_0x221afc));}else{this[_0x6790('0x6')](_0x6790('0xd'),_0x221afc);}}},'required':{'type':Sequelize[_0x6790('0x10')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM']('voice')}}; \ No newline at end of file +var _0xc21f=['lodash','exports','alias','STRING','getDataValue','TEXT','long','select','values','isArray','setDataValue','stringify','BOOLEAN','ENUM','voice'];(function(_0x3b404f,_0xa30e6f){var _0x5ee6d0=function(_0x404209){while(--_0x404209){_0x3b404f['push'](_0x3b404f['shift']());}};_0x5ee6d0(++_0xa30e6f);}(_0xc21f,0x1ef));var _0xfc21=function(_0x5b6fe8,_0x19d1b1){_0x5b6fe8=_0x5b6fe8-0x0;var _0x1ecd00=_0xc21f[_0x5b6fe8];return _0x1ecd00;};'use strict';var Sequelize=require('sequelize');var _=require(_0xfc21('0x0'));module[_0xfc21('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x42e7ea){return this['getDataValue'](_0xfc21('0x2'));}},'alias':{'type':Sequelize[_0xfc21('0x3')],'allowNull':![],'set':function(_0x2b0377){this['setDataValue']('alias',_0x2b0377?_0x2b0377:this[_0xfc21('0x4')]('name'));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0xfc21('0x5')](_0xfc21('0x6')),'get':function(){if(this[_0xfc21('0x4')]('type')===_0xfc21('0x7')){return JSON['parse'](this[_0xfc21('0x4')]('values'));}else{return this[_0xfc21('0x4')](_0xfc21('0x8'));}},'set':function(_0x4ac693){if(Array[_0xfc21('0x9')](_0x4ac693)){this[_0xfc21('0xa')](_0xfc21('0x8'),JSON[_0xfc21('0xb')](_0x4ac693));}else{this['setDataValue'](_0xfc21('0x8'),_0x4ac693);}}},'required':{'type':Sequelize[_0xfc21('0xc')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xfc21('0xc')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xfc21('0xd')](_0xfc21('0xe'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 7c96cff..b7790e9 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 _0x2be9=['key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','body','destroy','create','sequelize','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','rimraf','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','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','offset','undefined','limit','count','set','apply','reject','save','update','then','sendStatus','error','name','send','CmCustomField','rawAttributes','fieldName'];(function(_0x2bb57b,_0x502999){var _0x14c763=function(_0x4c11e6){while(--_0x4c11e6){_0x2bb57b['push'](_0x2bb57b['shift']());}};_0x14c763(++_0x502999);}(_0x2be9,0x187));var _0x92be=function(_0x27f616,_0xf48a6d){_0x27f616=_0x27f616-0x0;var _0x5ebae0=_0x2be9[_0x27f616];return _0x5ebae0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x92be('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x92be('0x1'));var rp=require('request-promise');var moment=require(_0x92be('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x92be('0x3'));var util=require(_0x92be('0x4'));var path=require('path');var sox=require(_0x92be('0x5'));var csv=require(_0x92be('0x6'));var ejs=require(_0x92be('0x7'));var fs=require('fs');var fs_extra=require(_0x92be('0x8'));var _=require(_0x92be('0x9'));var squel=require(_0x92be('0xa'));var crypto=require(_0x92be('0xb'));var jsforce=require(_0x92be('0xc'));var deskjs=require(_0x92be('0xd'));var toCsv=require('to-csv');var querystring=require(_0x92be('0xe'));var Papa=require(_0x92be('0xf'));var Redis=require(_0x92be('0x10'));var authService=require(_0x92be('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x92be('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x92be('0x13'))(_0x92be('0x14'));var utils=require(_0x92be('0x15'));var config=require(_0x92be('0x16'));var licenseUtil=require(_0x92be('0x17'));var db=require(_0x92be('0x18'))['db'];function respondWithStatusCode(_0x11eac9,_0xf5978e){_0xf5978e=_0xf5978e||0xcc;return function(_0x324656){if(_0x324656){return _0x11eac9['sendStatus'](_0xf5978e);}return _0x11eac9[_0x92be('0x19')](_0xf5978e)['end']();};}function respondWithResult(_0x8ef815,_0x5d2698){_0x5d2698=_0x5d2698||0xc8;return function(_0x34c8f0){if(_0x34c8f0){return _0x8ef815[_0x92be('0x19')](_0x5d2698)[_0x92be('0x1a')](_0x34c8f0);}};}function respondWithFilteredResult(_0x301706,_0x29f13f){return function(_0x521b99){if(_0x521b99){var _0x2397ee=typeof _0x29f13f[_0x92be('0x1b')]===_0x92be('0x1c')&&typeof _0x29f13f[_0x92be('0x1d')]===_0x92be('0x1c');var _0xf98fd8=_0x521b99[_0x92be('0x1e')];var _0x28f3d6=_0x2397ee?0x0:_0x29f13f[_0x92be('0x1b')];var _0x507ccc=_0x2397ee?_0x521b99['count']:_0x29f13f[_0x92be('0x1b')]+_0x29f13f[_0x92be('0x1d')];var _0x2d0970;if(_0x507ccc>=_0xf98fd8){_0x507ccc=_0xf98fd8;_0x2d0970=0xc8;}else{_0x2d0970=0xce;}_0x301706['status'](_0x2d0970);return _0x301706[_0x92be('0x1f')]('Content-Range',_0x28f3d6+'-'+_0x507ccc+'/'+_0xf98fd8)[_0x92be('0x1a')](_0x521b99);}return null;};}function patchUpdates(_0xdb2bbd){return function(_0x5679e1){try{jsonpatch[_0x92be('0x20')](_0x5679e1,_0xdb2bbd,!![]);}catch(_0x389f47){return BPromise[_0x92be('0x21')](_0x389f47);}return _0x5679e1[_0x92be('0x22')]();};}function saveUpdates(_0x4bb848,_0x28bf97){return function(_0x5b3a9c){if(_0x5b3a9c){return _0x5b3a9c[_0x92be('0x23')](_0x4bb848)[_0x92be('0x24')](function(_0x2d643f){return _0x2d643f;});}return null;};}function removeEntity(_0x114923,_0x27e972){return function(_0x5a5342){if(_0x5a5342){return _0x5a5342['destroy']()[_0x92be('0x24')](function(){_0x114923[_0x92be('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a5bde,_0x20d838){return function(_0x14c91c){if(!_0x14c91c){_0x1a5bde[_0x92be('0x25')](0x194);}return _0x14c91c;};}function handleError(_0x2c89ba,_0x451c53){_0x451c53=_0x451c53||0x1f4;return function(_0x36d734){logger[_0x92be('0x26')](_0x36d734['stack']);if(_0x36d734['name']){delete _0x36d734[_0x92be('0x27')];}_0x2c89ba[_0x92be('0x19')](_0x451c53)[_0x92be('0x28')](_0x36d734);};}exports['index']=function(_0x1a5b1c,_0xb67d70){var _0x7fd69f={},_0x4fb16f={},_0x484a29={'count':0x0,'rows':[]};var _0x48043d=_['map'](db[_0x92be('0x29')][_0x92be('0x2a')],function(_0x5709a5){return{'name':_0x5709a5[_0x92be('0x2b')],'type':_0x5709a5['type'][_0x92be('0x2c')]};});_0x4fb16f[_0x92be('0x2d')]=_['differenceBy'](_[_0x92be('0x2e')](_0x48043d,_0x92be('0x27')),[_0x92be('0x27')]);_0x4fb16f[_0x92be('0x2f')]=_[_0x92be('0x30')](_0x1a5b1c[_0x92be('0x2f')]);_0x4fb16f[_0x92be('0x31')]=_['intersection'](_0x4fb16f[_0x92be('0x2d')],_0x4fb16f[_0x92be('0x2f')]);_0x7fd69f[_0x92be('0x32')]=_[_0x92be('0x33')](_0x4fb16f[_0x92be('0x2d')],qs['fields'](_0x1a5b1c['query'][_0x92be('0x34')]));_0x7fd69f['attributes']=_0x7fd69f[_0x92be('0x32')][_0x92be('0x35')]?_0x7fd69f[_0x92be('0x32')]:_0x4fb16f['model'];if(!_0x1a5b1c[_0x92be('0x2f')][_0x92be('0x36')]('nolimit')){_0x7fd69f[_0x92be('0x1d')]=qs['limit'](_0x1a5b1c[_0x92be('0x2f')][_0x92be('0x1d')]);_0x7fd69f[_0x92be('0x1b')]=qs['offset'](_0x1a5b1c[_0x92be('0x2f')][_0x92be('0x1b')]);}_0x7fd69f[_0x92be('0x37')]=qs[_0x92be('0x38')](_0x1a5b1c[_0x92be('0x2f')][_0x92be('0x38')]);_0x7fd69f[_0x92be('0x39')]=qs['filters'](_['pick'](_0x1a5b1c[_0x92be('0x2f')],_0x4fb16f['filters']),_0x48043d);if(_0x1a5b1c[_0x92be('0x2f')][_0x92be('0x3a')]){_0x7fd69f[_0x92be('0x39')]=_[_0x92be('0x3b')](_0x7fd69f['where'],{'$or':_['map'](_0x48043d,function(_0x10819f){if(_0x10819f[_0x92be('0x3c')]!==_0x92be('0x3d')){var _0x4e8b98={};_0x4e8b98[_0x10819f['name']]={'$like':'%'+_0x1a5b1c['query'][_0x92be('0x3a')]+'%'};return _0x4e8b98;}})});}_0x7fd69f=_[_0x92be('0x3b')]({},_0x7fd69f,_0x1a5b1c[_0x92be('0x3e')]);var _0x495059={'where':_0x7fd69f[_0x92be('0x39')]};return db[_0x92be('0x29')][_0x92be('0x1e')](_0x495059)[_0x92be('0x24')](function(_0xdd0441){_0x484a29['count']=_0xdd0441;if(_0x1a5b1c['query'][_0x92be('0x3f')]){_0x7fd69f['include']=[{'all':!![]}];}return db[_0x92be('0x29')][_0x92be('0x40')](_0x7fd69f);})['then'](function(_0x15ab04){_0x484a29[_0x92be('0x41')]=_0x15ab04;return _0x484a29;})['then'](respondWithFilteredResult(_0xb67d70,_0x7fd69f))[_0x92be('0x42')](handleError(_0xb67d70,null));};exports['show']=function(_0x181863,_0x1842ab){var _0x550636={'raw':!![],'where':{'id':_0x181863[_0x92be('0x43')]['id']}},_0x464511={};_0x464511[_0x92be('0x2d')]=_[_0x92be('0x30')](db[_0x92be('0x29')][_0x92be('0x2a')]);_0x464511[_0x92be('0x2f')]=_[_0x92be('0x30')](_0x181863[_0x92be('0x2f')]);_0x464511['filters']=_['intersection'](_0x464511[_0x92be('0x2d')],_0x464511[_0x92be('0x2f')]);_0x550636[_0x92be('0x32')]=_['intersection'](_0x464511['model'],qs[_0x92be('0x34')](_0x181863[_0x92be('0x2f')][_0x92be('0x34')]));_0x550636[_0x92be('0x32')]=_0x550636[_0x92be('0x32')]['length']?_0x550636['attributes']:_0x464511[_0x92be('0x2d')];if(_0x181863[_0x92be('0x2f')][_0x92be('0x3f')]){_0x550636[_0x92be('0x44')]=[{'all':!![]}];}_0x550636=_[_0x92be('0x3b')]({},_0x550636,_0x181863[_0x92be('0x3e')]);return db[_0x92be('0x29')][_0x92be('0x45')](_0x550636)[_0x92be('0x24')](handleEntityNotFound(_0x1842ab,null))[_0x92be('0x24')](respondWithResult(_0x1842ab,null))[_0x92be('0x42')](handleError(_0x1842ab,null));};exports[_0x92be('0x23')]=function(_0x13ed3d,_0x4e39a6){if(_0x13ed3d[_0x92be('0x46')]['id']){delete _0x13ed3d[_0x92be('0x46')]['id'];}return db[_0x92be('0x29')]['find']({'where':{'id':_0x13ed3d[_0x92be('0x43')]['id']}})[_0x92be('0x24')](handleEntityNotFound(_0x4e39a6,null))['then'](saveUpdates(_0x13ed3d[_0x92be('0x46')],null))[_0x92be('0x24')](respondWithResult(_0x4e39a6,null))[_0x92be('0x42')](handleError(_0x4e39a6,null));};exports[_0x92be('0x47')]=function(_0x4f9cbb,_0x178f3d){return db[_0x92be('0x29')][_0x92be('0x45')]({'where':{'id':_0x4f9cbb[_0x92be('0x43')]['id']}})[_0x92be('0x24')](handleEntityNotFound(_0x178f3d,null))[_0x92be('0x24')](removeEntity(_0x178f3d,null))[_0x92be('0x42')](handleError(_0x178f3d,null));};exports[_0x92be('0x48')]=function(_0x2bf6bc,_0x3892b6){var _0x3f8806;return db[_0x92be('0x49')]['transaction'](function(_0x3a875b){return db[_0x92be('0x29')]['create'](_0x2bf6bc['body'],{'transaction':_0x3a875b})[_0x92be('0x24')](function(_0x35e6a9){_0x3f8806=_0x35e6a9;var _0x27dfae={'type':db[_0x92be('0x4a')][_0x92be('0x4b')],'transaction':_0x3a875b};switch(_0x2bf6bc[_0x92be('0x46')][_0x92be('0x3c')]){case _0x92be('0x4c'):_0x27dfae[_0x92be('0x3c')]=db[_0x92be('0x4a')]['TEXT'];break;case _0x92be('0x4d'):_0x27dfae[_0x92be('0x3c')]=db[_0x92be('0x4a')][_0x92be('0x4e')];break;case _0x92be('0x4f'):_0x27dfae['type']=db[_0x92be('0x4a')][_0x92be('0x50')];_0x27dfae[_0x92be('0x51')]=![];break;default:}return db[_0x92be('0x49')][_0x92be('0x52')][_0x92be('0x53')](_0x92be('0x54'),util[_0x92be('0x55')](_0x92be('0x56'),_0x3f8806['id']),_0x27dfae);})[_0x92be('0x24')](function(){return _0x3f8806;});})[_0x92be('0x24')](respondWithResult(_0x3892b6,0xc9))['catch'](handleError(_0x3892b6,null));}; \ No newline at end of file +var _0x2380=['jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','CmCustomField','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','body','find','sequelize','transaction','create','Sequelize','TEXT','text','number','BOOLEAN','addColumn','cm_contacts','format','cf_%d','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','ejs','fs-extra','squel'];(function(_0x2df8fe,_0x39d4bb){var _0x5eff59=function(_0x2002bb){while(--_0x2002bb){_0x2df8fe['push'](_0x2df8fe['shift']());}};_0x5eff59(++_0x39d4bb);}(_0x2380,0x14e));var _0x0238=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0x2380[_0x1ae5ab];return _0x1ce001;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0238('0x0'));var zipdir=require(_0x0238('0x1'));var jsonpatch=require(_0x0238('0x2'));var rp=require(_0x0238('0x3'));var moment=require(_0x0238('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x0238('0x5'));var sox=require(_0x0238('0x6'));var csv=require('to-csv');var ejs=require(_0x0238('0x7'));var fs=require('fs');var fs_extra=require(_0x0238('0x8'));var _=require('lodash');var squel=require(_0x0238('0x9'));var crypto=require('crypto');var jsforce=require(_0x0238('0xa'));var deskjs=require(_0x0238('0xb'));var toCsv=require(_0x0238('0xc'));var querystring=require(_0x0238('0xd'));var Papa=require(_0x0238('0xe'));var Redis=require(_0x0238('0xf'));var authService=require(_0x0238('0x10'));var qs=require(_0x0238('0x11'));var as=require(_0x0238('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0238('0x13'))(_0x0238('0x14'));var utils=require(_0x0238('0x15'));var config=require(_0x0238('0x16'));var licenseUtil=require(_0x0238('0x17'));var db=require(_0x0238('0x18'))['db'];function respondWithStatusCode(_0x174452,_0x1bb87b){_0x1bb87b=_0x1bb87b||0xcc;return function(_0x35247e){if(_0x35247e){return _0x174452[_0x0238('0x19')](_0x1bb87b);}return _0x174452[_0x0238('0x1a')](_0x1bb87b)[_0x0238('0x1b')]();};}function respondWithResult(_0x2dc77e,_0x5bb47d){_0x5bb47d=_0x5bb47d||0xc8;return function(_0x1c2ac0){if(_0x1c2ac0){return _0x2dc77e['status'](_0x5bb47d)['json'](_0x1c2ac0);}};}function respondWithFilteredResult(_0x538713,_0x3b670f){return function(_0x3d19a6){if(_0x3d19a6){var _0x1018af=typeof _0x3b670f[_0x0238('0x1c')]===_0x0238('0x1d')&&typeof _0x3b670f[_0x0238('0x1e')]===_0x0238('0x1d');var _0x2a6a55=_0x3d19a6[_0x0238('0x1f')];var _0x3bd1c1=_0x1018af?0x0:_0x3b670f['offset'];var _0x37352e=_0x1018af?_0x3d19a6[_0x0238('0x1f')]:_0x3b670f[_0x0238('0x1c')]+_0x3b670f[_0x0238('0x1e')];var _0x23cd42;if(_0x37352e>=_0x2a6a55){_0x37352e=_0x2a6a55;_0x23cd42=0xc8;}else{_0x23cd42=0xce;}_0x538713['status'](_0x23cd42);return _0x538713[_0x0238('0x20')](_0x0238('0x21'),_0x3bd1c1+'-'+_0x37352e+'/'+_0x2a6a55)['json'](_0x3d19a6);}return null;};}function patchUpdates(_0x1de70e){return function(_0x3e928d){try{jsonpatch[_0x0238('0x22')](_0x3e928d,_0x1de70e,!![]);}catch(_0x2f3a1d){return BPromise[_0x0238('0x23')](_0x2f3a1d);}return _0x3e928d[_0x0238('0x24')]();};}function saveUpdates(_0x21b515,_0x277e38){return function(_0x2b76c6){if(_0x2b76c6){return _0x2b76c6[_0x0238('0x25')](_0x21b515)[_0x0238('0x26')](function(_0x207dfd){return _0x207dfd;});}return null;};}function removeEntity(_0x54747c,_0xcfbfe3){return function(_0x468ba5){if(_0x468ba5){return _0x468ba5[_0x0238('0x27')]()[_0x0238('0x26')](function(){_0x54747c[_0x0238('0x1a')](0xcc)[_0x0238('0x1b')]();});}};}function handleEntityNotFound(_0xa486c6,_0x4c0696){return function(_0x374a56){if(!_0x374a56){_0xa486c6['sendStatus'](0x194);}return _0x374a56;};}function handleError(_0x5ba6f1,_0x3fe968){_0x3fe968=_0x3fe968||0x1f4;return function(_0x7d8671){logger[_0x0238('0x28')](_0x7d8671['stack']);if(_0x7d8671[_0x0238('0x29')]){delete _0x7d8671[_0x0238('0x29')];}_0x5ba6f1[_0x0238('0x1a')](_0x3fe968)[_0x0238('0x2a')](_0x7d8671);};}exports['index']=function(_0x4df6ad,_0x23ebbd){var _0x4e0a48={},_0xb1a801={},_0xebc832={'count':0x0,'rows':[]};var _0x14be75=_['map'](db[_0x0238('0x2b')][_0x0238('0x2c')],function(_0x499ea){return{'name':_0x499ea[_0x0238('0x2d')],'type':_0x499ea[_0x0238('0x2e')][_0x0238('0x2f')]};});_0xb1a801['model']=_['differenceBy'](_[_0x0238('0x30')](_0x14be75,_0x0238('0x29')),[_0x0238('0x29')]);_0xb1a801[_0x0238('0x31')]=_[_0x0238('0x32')](_0x4df6ad[_0x0238('0x31')]);_0xb1a801[_0x0238('0x33')]=_[_0x0238('0x34')](_0xb1a801[_0x0238('0x35')],_0xb1a801[_0x0238('0x31')]);_0x4e0a48[_0x0238('0x36')]=_[_0x0238('0x34')](_0xb1a801[_0x0238('0x35')],qs['fields'](_0x4df6ad['query'][_0x0238('0x37')]));_0x4e0a48[_0x0238('0x36')]=_0x4e0a48['attributes'][_0x0238('0x38')]?_0x4e0a48[_0x0238('0x36')]:_0xb1a801['model'];if(!_0x4df6ad['query'][_0x0238('0x39')]('nolimit')){_0x4e0a48[_0x0238('0x1e')]=qs[_0x0238('0x1e')](_0x4df6ad[_0x0238('0x31')][_0x0238('0x1e')]);_0x4e0a48[_0x0238('0x1c')]=qs[_0x0238('0x1c')](_0x4df6ad[_0x0238('0x31')][_0x0238('0x1c')]);}_0x4e0a48[_0x0238('0x3a')]=qs[_0x0238('0x3b')](_0x4df6ad[_0x0238('0x31')][_0x0238('0x3b')]);_0x4e0a48[_0x0238('0x3c')]=qs[_0x0238('0x33')](_[_0x0238('0x3d')](_0x4df6ad['query'],_0xb1a801['filters']),_0x14be75);if(_0x4df6ad[_0x0238('0x31')][_0x0238('0x3e')]){_0x4e0a48[_0x0238('0x3c')]=_[_0x0238('0x3f')](_0x4e0a48[_0x0238('0x3c')],{'$or':_[_0x0238('0x30')](_0x14be75,function(_0x2378b4){if(_0x2378b4[_0x0238('0x2e')]!==_0x0238('0x40')){var _0x26d242={};_0x26d242[_0x2378b4[_0x0238('0x29')]]={'$like':'%'+_0x4df6ad['query'][_0x0238('0x3e')]+'%'};return _0x26d242;}})});}_0x4e0a48=_['merge']({},_0x4e0a48,_0x4df6ad[_0x0238('0x41')]);var _0x4dcf16={'where':_0x4e0a48[_0x0238('0x3c')]};return db[_0x0238('0x2b')][_0x0238('0x1f')](_0x4dcf16)[_0x0238('0x26')](function(_0x175e8d){_0xebc832[_0x0238('0x1f')]=_0x175e8d;if(_0x4df6ad[_0x0238('0x31')][_0x0238('0x42')]){_0x4e0a48[_0x0238('0x43')]=[{'all':!![]}];}return db[_0x0238('0x2b')][_0x0238('0x44')](_0x4e0a48);})[_0x0238('0x26')](function(_0x593e45){_0xebc832[_0x0238('0x45')]=_0x593e45;return _0xebc832;})[_0x0238('0x26')](respondWithFilteredResult(_0x23ebbd,_0x4e0a48))[_0x0238('0x46')](handleError(_0x23ebbd,null));};exports['show']=function(_0x3e46ca,_0x432073){var _0x10431b={'raw':!![],'where':{'id':_0x3e46ca[_0x0238('0x47')]['id']}},_0x2a47b7={};_0x2a47b7['model']=_[_0x0238('0x32')](db[_0x0238('0x2b')][_0x0238('0x2c')]);_0x2a47b7[_0x0238('0x31')]=_['keys'](_0x3e46ca['query']);_0x2a47b7[_0x0238('0x33')]=_[_0x0238('0x34')](_0x2a47b7['model'],_0x2a47b7[_0x0238('0x31')]);_0x10431b['attributes']=_[_0x0238('0x34')](_0x2a47b7[_0x0238('0x35')],qs['fields'](_0x3e46ca['query'][_0x0238('0x37')]));_0x10431b[_0x0238('0x36')]=_0x10431b['attributes'][_0x0238('0x38')]?_0x10431b[_0x0238('0x36')]:_0x2a47b7[_0x0238('0x35')];if(_0x3e46ca[_0x0238('0x31')][_0x0238('0x42')]){_0x10431b[_0x0238('0x43')]=[{'all':!![]}];}_0x10431b=_[_0x0238('0x3f')]({},_0x10431b,_0x3e46ca['options']);return db[_0x0238('0x2b')]['find'](_0x10431b)[_0x0238('0x26')](handleEntityNotFound(_0x432073,null))[_0x0238('0x26')](respondWithResult(_0x432073,null))['catch'](handleError(_0x432073,null));};exports[_0x0238('0x25')]=function(_0x1beb94,_0x4665c3){if(_0x1beb94[_0x0238('0x48')]['id']){delete _0x1beb94['body']['id'];}return db['CmCustomField'][_0x0238('0x49')]({'where':{'id':_0x1beb94[_0x0238('0x47')]['id']}})['then'](handleEntityNotFound(_0x4665c3,null))['then'](saveUpdates(_0x1beb94[_0x0238('0x48')],null))[_0x0238('0x26')](respondWithResult(_0x4665c3,null))[_0x0238('0x46')](handleError(_0x4665c3,null));};exports[_0x0238('0x27')]=function(_0x375838,_0x29dd88){return db[_0x0238('0x2b')][_0x0238('0x49')]({'where':{'id':_0x375838['params']['id']}})[_0x0238('0x26')](handleEntityNotFound(_0x29dd88,null))['then'](removeEntity(_0x29dd88,null))[_0x0238('0x46')](handleError(_0x29dd88,null));};exports['create']=function(_0x3d5047,_0x283353){var _0x2dd7c2;return db[_0x0238('0x4a')][_0x0238('0x4b')](function(_0x4fa612){return db[_0x0238('0x2b')][_0x0238('0x4c')](_0x3d5047['body'],{'transaction':_0x4fa612})[_0x0238('0x26')](function(_0xa3111e){_0x2dd7c2=_0xa3111e;var _0x2e0d34={'type':db[_0x0238('0x4d')][_0x0238('0x4e')],'transaction':_0x4fa612};switch(_0x3d5047[_0x0238('0x48')]['type']){case _0x0238('0x4f'):_0x2e0d34[_0x0238('0x2e')]=db['Sequelize'][_0x0238('0x4e')];break;case _0x0238('0x50'):_0x2e0d34[_0x0238('0x2e')]=db[_0x0238('0x4d')]['INTEGER'];break;case'switch':_0x2e0d34['type']=db[_0x0238('0x4d')][_0x0238('0x51')];_0x2e0d34['defaultValue']=![];break;default:}return db['sequelize']['queryInterface'][_0x0238('0x52')](_0x0238('0x53'),util[_0x0238('0x54')](_0x0238('0x55'),_0x2dd7c2['id']),_0x2e0d34);})[_0x0238('0x26')](function(){return _0x2dd7c2;});})[_0x0238('0x26')](respondWithResult(_0x283353,0xc9))[_0x0238('0x46')](handleError(_0x283353,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index d9acc5b..fa02c15 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 _0x65bf=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','exports','define','cm_custom_fields','lodash'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x65bf,0x6d));var _0xf65b=function(_0x38fa3f,_0x32e02d){_0x38fa3f=_0x38fa3f-0x0;var _0x351d29=_0x65bf[_0x38fa3f];return _0x351d29;};'use strict';var _=require(_0xf65b('0x0'));var util=require(_0xf65b('0x1'));var logger=require(_0xf65b('0x2'))(_0xf65b('0x3'));var moment=require(_0xf65b('0x4'));var BPromise=require('bluebird');var rp=require(_0xf65b('0x5'));var fs=require('fs');var path=require(_0xf65b('0x6'));var rimraf=require('rimraf');var config=require(_0xf65b('0x7'));var attributes=require('./cmCustomField.attributes');module[_0xf65b('0x8')]=function(_0x4586cd,_0x1b8093){return _0x4586cd[_0xf65b('0x9')]('CmCustomField',attributes,{'tableName':_0xf65b('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5bb8=['../../config/environment','./cmCustomField.attributes','exports','define','cm_custom_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x386af1,_0x2d8d5a){var _0x253f5e=function(_0x57b776){while(--_0x57b776){_0x386af1['push'](_0x386af1['shift']());}};_0x253f5e(++_0x2d8d5a);}(_0x5bb8,0xd7));var _0x85bb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5bb8[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x85bb('0x0'));var util=require(_0x85bb('0x1'));var logger=require(_0x85bb('0x2'))(_0x85bb('0x3'));var moment=require(_0x85bb('0x4'));var BPromise=require(_0x85bb('0x5'));var rp=require(_0x85bb('0x6'));var fs=require('fs');var path=require(_0x85bb('0x7'));var rimraf=require(_0x85bb('0x8'));var config=require(_0x85bb('0x9'));var attributes=require(_0x85bb('0xa'));module[_0x85bb('0xb')]=function(_0x5e8fde,_0x250ed7){return _0x5e8fde[_0x85bb('0xc')]('CmCustomField',attributes,{'tableName':_0x85bb('0xd'),'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 882a83d..7419069 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 _0x91a8=['result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x340380,_0x4bd2a8){var _0x49ce1c=function(_0x4cb9e2){while(--_0x4cb9e2){_0x340380['push'](_0x340380['shift']());}};_0x49ce1c(++_0x4bd2a8);}(_0x91a8,0xd1));var _0x891a=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x91a8[_0x1d9aa0];return _0x226868;};'use strict';var _=require('lodash');var util=require(_0x891a('0x0'));var moment=require(_0x891a('0x1'));var BPromise=require('bluebird');var rs=require(_0x891a('0x2'));var fs=require('fs');var Redis=require(_0x891a('0x3'));var db=require(_0x891a('0x4'))['db'];var utils=require(_0x891a('0x5'));var logger=require(_0x891a('0x6'))('rpc');var config=require(_0x891a('0x7'));var jayson=require(_0x891a('0x8'));var client=jayson[_0x891a('0x9')][_0x891a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41ee1f,_0x31aed4,_0x3ac7d6){return new BPromise(function(_0x3faf5d,_0x46402f){return client[_0x891a('0xb')](_0x41ee1f,_0x3ac7d6)[_0x891a('0xc')](function(_0x18fa46){logger[_0x891a('0xd')](_0x891a('0xe'),_0x31aed4,_0x891a('0xf'));logger['debug'](_0x891a('0x10'),_0x31aed4,_0x891a('0xf'),JSON[_0x891a('0x11')](_0x18fa46));if(_0x18fa46[_0x891a('0x12')]){if(_0x18fa46[_0x891a('0x12')][_0x891a('0x13')]===0x1f4){logger[_0x891a('0x12')](_0x891a('0xe'),_0x31aed4,_0x18fa46['error'][_0x891a('0x14')]);return _0x46402f(_0x18fa46['error']['message']);}logger[_0x891a('0x12')](_0x891a('0xe'),_0x31aed4,_0x18fa46[_0x891a('0x12')][_0x891a('0x14')]);return _0x3faf5d(_0x18fa46['error'][_0x891a('0x14')]);}else{logger[_0x891a('0xd')](_0x891a('0xe'),_0x31aed4,'request\x20sent');_0x3faf5d(_0x18fa46[_0x891a('0x15')][_0x891a('0x14')]);}})[_0x891a('0x16')](function(_0x196688){logger[_0x891a('0x12')]('CmCustomField,\x20%s,\x20%s',_0x31aed4,_0x196688);_0x46402f(_0x196688);});});} \ No newline at end of file +var _0x75fe=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','CmCustomField,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x45e88d,_0x46ef14){var _0x2cb1d3=function(_0x375433){while(--_0x375433){_0x45e88d['push'](_0x45e88d['shift']());}};_0x2cb1d3(++_0x46ef14);}(_0x75fe,0x191));var _0xe75f=function(_0x569ab4,_0x411064){_0x569ab4=_0x569ab4-0x0;var _0x2f5cd0=_0x75fe[_0x569ab4];return _0x2f5cd0;};'use strict';var _=require(_0xe75f('0x0'));var util=require(_0xe75f('0x1'));var moment=require(_0xe75f('0x2'));var BPromise=require(_0xe75f('0x3'));var rs=require(_0xe75f('0x4'));var fs=require('fs');var Redis=require(_0xe75f('0x5'));var db=require(_0xe75f('0x6'))['db'];var utils=require(_0xe75f('0x7'));var logger=require(_0xe75f('0x8'))(_0xe75f('0x9'));var config=require(_0xe75f('0xa'));var jayson=require(_0xe75f('0xb'));var client=jayson['client'][_0xe75f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3e7cc9,_0x5b06fd,_0xb25e60){return new BPromise(function(_0x568abc,_0x1194e5){return client['request'](_0x3e7cc9,_0xb25e60)['then'](function(_0x51ce40){logger[_0xe75f('0xd')](_0xe75f('0xe'),_0x5b06fd,_0xe75f('0xf'));logger['debug']('CmCustomField,\x20%s,\x20%s,\x20%s',_0x5b06fd,'request\x20sent',JSON['stringify'](_0x51ce40));if(_0x51ce40[_0xe75f('0x10')]){if(_0x51ce40[_0xe75f('0x10')][_0xe75f('0x11')]===0x1f4){logger['error'](_0xe75f('0xe'),_0x5b06fd,_0x51ce40[_0xe75f('0x10')][_0xe75f('0x12')]);return _0x1194e5(_0x51ce40[_0xe75f('0x10')]['message']);}logger[_0xe75f('0x10')](_0xe75f('0xe'),_0x5b06fd,_0x51ce40[_0xe75f('0x10')][_0xe75f('0x12')]);return _0x568abc(_0x51ce40[_0xe75f('0x10')]['message']);}else{logger[_0xe75f('0xd')](_0xe75f('0xe'),_0x5b06fd,'request\x20sent');_0x568abc(_0x51ce40['result'][_0xe75f('0x12')]);}})[_0xe75f('0x13')](function(_0x23551d){logger[_0xe75f('0x10')]('CmCustomField,\x20%s,\x20%s',_0x5b06fd,_0x23551d);_0x1194e5(_0x23551d);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 83348d6..e1c79ab 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 _0x131a=['util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x316bac,_0x2d2327){var _0x3e9b24=function(_0x516cb5){while(--_0x516cb5){_0x316bac['push'](_0x316bac['shift']());}};_0x3e9b24(++_0x2d2327);}(_0x131a,0x18b));var _0xa131=function(_0xc042a3,_0xde6877){_0xc042a3=_0xc042a3-0x0;var _0xcbf7d0=_0x131a[_0xc042a3];return _0xcbf7d0;};'use strict';var multer=require(_0xa131('0x0'));var util=require(_0xa131('0x1'));var path=require(_0xa131('0x2'));var timeout=require(_0xa131('0x3'));var express=require(_0xa131('0x4'));var router=express['Router']();var fs_extra=require(_0xa131('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa131('0x6'));var config=require(_0xa131('0x7'));var controller=require('./cmCustomField.controller');router[_0xa131('0x8')]('/',auth[_0xa131('0x9')](),controller[_0xa131('0xa')]);router[_0xa131('0x8')](_0xa131('0xb'),auth[_0xa131('0x9')](),controller[_0xa131('0xc')]);router[_0xa131('0xd')]('/',auth[_0xa131('0x9')](),controller['create']);router[_0xa131('0xe')](_0xa131('0xb'),auth['isAuthenticated'](),controller[_0xa131('0xf')]);router[_0xa131('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xa131('0x11')]=router; \ No newline at end of file +var _0xac47=['isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','get'];(function(_0x25e109,_0x6ab24c){var _0xc0f7d6=function(_0x2fb92b){while(--_0x2fb92b){_0x25e109['push'](_0x25e109['shift']());}};_0xc0f7d6(++_0x6ab24c);}(_0xac47,0x1af));var _0x7ac4=function(_0x3d8eb2,_0x5e58a3){_0x3d8eb2=_0x3d8eb2-0x0;var _0x1bb6bb=_0xac47[_0x3d8eb2];return _0x1bb6bb;};'use strict';var multer=require(_0x7ac4('0x0'));var util=require(_0x7ac4('0x1'));var path=require(_0x7ac4('0x2'));var timeout=require(_0x7ac4('0x3'));var express=require(_0x7ac4('0x4'));var router=express[_0x7ac4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7ac4('0x6'));var interaction=require(_0x7ac4('0x7'));var config=require('../../config/environment');var controller=require(_0x7ac4('0x8'));router[_0x7ac4('0x9')]('/',auth[_0x7ac4('0xa')](),controller[_0x7ac4('0xb')]);router[_0x7ac4('0x9')]('/:id',auth[_0x7ac4('0xa')](),controller[_0x7ac4('0xc')]);router[_0x7ac4('0xd')]('/',auth[_0x7ac4('0xa')](),controller[_0x7ac4('0xe')]);router[_0x7ac4('0xf')](_0x7ac4('0x10'),auth[_0x7ac4('0xa')](),controller[_0x7ac4('0x11')]);router[_0x7ac4('0x12')](_0x7ac4('0x10'),auth['isAuthenticated'](),controller[_0x7ac4('0x13')]);module[_0x7ac4('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 6b2a504..2661402 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 _0x7afc=['DATE','contactListQueue','moment','sequelize','INTEGER','BOOLEAN'];(function(_0x4eab88,_0xcc1ff8){var _0x2042e3=function(_0x221e40){while(--_0x221e40){_0x4eab88['push'](_0x4eab88['shift']());}};_0x2042e3(++_0xcc1ff8);}(_0x7afc,0xf8));var _0xc7af=function(_0x4aefb9,_0x55959c){_0x4aefb9=_0x4aefb9-0x0;var _0x3152dc=_0x7afc[_0x4aefb9];return _0x3152dc;};'use strict';var moment=require(_0xc7af('0x0'));var Sequelize=require(_0xc7af('0x1'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xc7af('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xc7af('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xc7af('0x2')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xc7af('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xc7af('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xc7af('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xc7af('0x2')],'unique':_0xc7af('0x5')},'ListId':{'type':Sequelize[_0xc7af('0x2')],'unique':_0xc7af('0x5')},'UserId':{'type':Sequelize[_0xc7af('0x2')]},'VoiceQueueId':{'type':Sequelize[_0xc7af('0x2')],'unique':_0xc7af('0x5')},'CampaignId':{'type':Sequelize[_0xc7af('0x2')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xc7af('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xc7af('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xc7af('0x2')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0xc7af('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x23bb=['exports','STRING','BOOLEAN','DATE','format','INTEGER','UNSIGNED','contactListQueue'];(function(_0x4ccb03,_0x2c141b){var _0x460170=function(_0x1e8bf9){while(--_0x1e8bf9){_0x4ccb03['push'](_0x4ccb03['shift']());}};_0x460170(++_0x2c141b);}(_0x23bb,0xc0));var _0xb23b=function(_0x2bf6be,_0x5b23f1){_0x2bf6be=_0x2bf6be-0x0;var _0x532ef4=_0x23bb[_0x2bf6be];return _0x532ef4;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xb23b('0x0')]={'phone':{'type':Sequelize[_0xb23b('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0xb23b('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xb23b('0x3')],'defaultValue':moment()[_0xb23b('0x4')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xb23b('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb23b('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb23b('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb23b('0x3')]},'priority':{'type':Sequelize[_0xb23b('0x5')](0x2)[_0xb23b('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xb23b('0x7')},'ListId':{'type':Sequelize[_0xb23b('0x5')],'unique':_0xb23b('0x7')},'UserId':{'type':Sequelize[_0xb23b('0x5')]},'VoiceQueueId':{'type':Sequelize[_0xb23b('0x5')],'unique':_0xb23b('0x7')},'CampaignId':{'type':Sequelize[_0xb23b('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xb23b('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb23b('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb23b('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xb23b('0x5')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xb23b('0x1')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'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 ee7d186..285eba9 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 _0x0309=['destroy','params','VoiceQueueId','CampaignId','Campaign','merge','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','end','getPreview','user','getVoiceQueues','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','hopperIds','priority','scheduledAt','dialOrderByScheduledAt','ASC','isEmpty','DESC','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','UPDATE','CmCompany','CmList','List','VoiceQueue','Queue','findOne','recallme','Company','dialActive','getOpenContacts','outbound','preview','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','timezones','push','utcOffset','getTimezone','moment','../../components/parsers/qs','api','../../config/environment','../../mysqldb','status','offset','limit','undefined','set','Content-Range','json','update','then','sendStatus','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key','query','filters','intersection','model','$and','$or','$gt','$lt','$lte','$ne','$eq','$not','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','count','include','findAll','rows','catch','show','keys','includeAll','find','create','body','describe'];(function(_0x12dd56,_0x883203){var _0x8725b9=function(_0x3188a5){while(--_0x3188a5){_0x12dd56['push'](_0x12dd56['shift']());}};_0x8725b9(++_0x883203);}(_0x0309,0x165));var _0x9030=function(_0x165f61,_0x32771e){_0x165f61=_0x165f61-0x0;var _0x5e682b=_0x0309[_0x165f61];return _0x5e682b;};'use strict';var moment=require(_0x9030('0x0'));var _=require('lodash');var qs=require(_0x9030('0x1'));var logger=require('../../config/logger')(_0x9030('0x2'));var shared=require(_0x9030('0x3'));var db=require(_0x9030('0x4'))['db'];function respondWithResult(_0x4236be,_0x29e331){_0x29e331=_0x29e331||0xc8;return function(_0x2e6276){if(_0x2e6276){return _0x4236be[_0x9030('0x5')](_0x29e331)['json'](_0x2e6276);}};}function respondWithFilteredResult(_0x5a3334,_0x1c9c7b){return function(_0x105c15){if(_0x105c15){var _0x4f2d84=typeof _0x1c9c7b[_0x9030('0x6')]==='undefined'&&typeof _0x1c9c7b[_0x9030('0x7')]===_0x9030('0x8');var _0x289add=_0x105c15['count'];var _0xe2c28b=_0x4f2d84?0x0:_0x1c9c7b[_0x9030('0x6')];var _0x337b86=_0x4f2d84?_0x105c15['count']:_0x1c9c7b[_0x9030('0x6')]+_0x1c9c7b[_0x9030('0x7')];var _0x24d0f4;if(_0x337b86>=_0x289add){_0x337b86=_0x289add;_0x24d0f4=0xc8;}else{_0x24d0f4=0xce;}_0x5a3334[_0x9030('0x5')](_0x24d0f4);return _0x5a3334[_0x9030('0x9')](_0x9030('0xa'),_0xe2c28b+'-'+_0x337b86+'/'+_0x289add)[_0x9030('0xb')](_0x105c15);}return null;};}function saveUpdates(_0x5ee60f,_0x45e28a){return function(_0x3274c9){if(_0x3274c9){return _0x3274c9[_0x9030('0xc')](_0x5ee60f)[_0x9030('0xd')](function(_0x4e1858){return _0x4e1858;});}return null;};}function handleEntityNotFound(_0x28a505,_0x2dc875){return function(_0x4a7465){if(!_0x4a7465){_0x28a505[_0x9030('0xe')](0x194);}return _0x4a7465;};}function handleError(_0x4d697a,_0x1615ab){_0x1615ab=_0x1615ab||0x1f4;return function(_0x111f3b){logger[_0x9030('0xf')](_0x111f3b[_0x9030('0x10')]);if(_0x111f3b['name']){delete _0x111f3b[_0x9030('0x11')];}_0x4d697a[_0x9030('0x5')](_0x1615ab)[_0x9030('0x12')](_0x111f3b);};}exports[_0x9030('0x13')]=function(_0x319db3,_0x1327ec){var _0x229dcd={},_0x28c035={},_0x1f5474={'count':0x0,'rows':[]};var _0x31e196=_[_0x9030('0x14')](db[_0x9030('0x15')][_0x9030('0x16')],function(_0x243e7d){return{'name':_0x243e7d[_0x9030('0x17')],'type':_0x243e7d[_0x9030('0x18')][_0x9030('0x19')]};});_0x28c035['model']=_['map'](_0x31e196,_0x9030('0x11'));_0x28c035[_0x9030('0x1a')]=_['keys'](_0x319db3[_0x9030('0x1a')]);_0x28c035[_0x9030('0x1b')]=_[_0x9030('0x1c')](_0x28c035[_0x9030('0x1d')],_0x28c035['query']);_0x28c035[_0x9030('0x1b')]=_['concat'](_0x28c035['filters'],[_0x9030('0x1e'),_0x9030('0x1f'),_0x9030('0x20'),'$gte',_0x9030('0x21'),_0x9030('0x22'),_0x9030('0x23'),_0x9030('0x24'),_0x9030('0x25'),'$between',_0x9030('0x26'),_0x9030('0x27'),_0x9030('0x28'),_0x9030('0x29'),_0x9030('0x2a'),_0x9030('0x2b'),_0x9030('0x2c'),_0x9030('0x29'),_0x9030('0x2d'),_0x9030('0x2e'),_0x9030('0x2f'),_0x9030('0x30')]);_0x229dcd[_0x9030('0x31')]=_[_0x9030('0x1c')](_0x28c035['model'],qs[_0x9030('0x32')](_0x319db3['query'][_0x9030('0x32')]));_0x229dcd['attributes']=_0x229dcd[_0x9030('0x31')][_0x9030('0x33')]?_0x229dcd[_0x9030('0x31')]:_0x28c035['model'];if(!_0x319db3[_0x9030('0x1a')][_0x9030('0x34')](_0x9030('0x35'))){_0x229dcd[_0x9030('0x7')]=qs[_0x9030('0x7')](_0x319db3[_0x9030('0x1a')][_0x9030('0x7')]);_0x229dcd[_0x9030('0x6')]=qs[_0x9030('0x6')](_0x319db3[_0x9030('0x1a')][_0x9030('0x6')]);}_0x229dcd[_0x9030('0x36')]=qs[_0x9030('0x37')](_0x319db3[_0x9030('0x1a')][_0x9030('0x37')]);_0x229dcd[_0x9030('0x38')]=qs[_0x9030('0x1b')](_[_0x9030('0x39')](_0x319db3['query'],_0x28c035['filters']),_0x31e196);if(_0x319db3[_0x9030('0x1a')][_0x9030('0x3a')]){_0x229dcd['where']=_['merge'](_0x229dcd[_0x9030('0x38')],{'$or':_[_0x9030('0x14')](_0x31e196,function(_0x411077){if(_0x411077[_0x9030('0x18')]!=='VIRTUAL'){var _0xc8123e={};_0xc8123e[_0x411077['name']]={'$like':'%'+_0x319db3[_0x9030('0x1a')][_0x9030('0x3a')]+'%'};return _0xc8123e;}})});}_0x229dcd=_['merge']({},_0x229dcd,_0x319db3[_0x9030('0x3b')]);var _0x19c515={'where':_0x229dcd[_0x9030('0x38')]};return db['CmHopper'][_0x9030('0x3c')](_0x19c515)['then'](function(_0x438828){_0x1f5474['count']=_0x438828;if(_0x319db3[_0x9030('0x1a')]['includeAll']){_0x229dcd[_0x9030('0x3d')]=[{'all':!![]}];}return db[_0x9030('0x15')][_0x9030('0x3e')](_0x229dcd);})[_0x9030('0xd')](function(_0x214f66){_0x1f5474[_0x9030('0x3f')]=_0x214f66;return _0x1f5474;})[_0x9030('0xd')](respondWithFilteredResult(_0x1327ec,_0x229dcd))[_0x9030('0x40')](handleError(_0x1327ec,null));};exports[_0x9030('0x41')]=function(_0x5bd1fb,_0x200ec1){var _0x209aca={'raw':!![],'where':{'id':_0x5bd1fb['params']['id']}},_0x1c8e83={};_0x1c8e83[_0x9030('0x1d')]=_[_0x9030('0x42')](db[_0x9030('0x15')][_0x9030('0x16')]);_0x1c8e83['query']=_[_0x9030('0x42')](_0x5bd1fb[_0x9030('0x1a')]);_0x1c8e83[_0x9030('0x1b')]=_['intersection'](_0x1c8e83[_0x9030('0x1d')],_0x1c8e83[_0x9030('0x1a')]);_0x209aca[_0x9030('0x31')]=_[_0x9030('0x1c')](_0x1c8e83[_0x9030('0x1d')],qs['fields'](_0x5bd1fb[_0x9030('0x1a')]['fields']));_0x209aca[_0x9030('0x31')]=_0x209aca[_0x9030('0x31')][_0x9030('0x33')]?_0x209aca[_0x9030('0x31')]:_0x1c8e83[_0x9030('0x1d')];if(_0x5bd1fb[_0x9030('0x1a')][_0x9030('0x43')]){_0x209aca[_0x9030('0x3d')]=[{'all':!![]}];}_0x209aca=_['merge']({},_0x209aca,_0x5bd1fb[_0x9030('0x3b')]);return db[_0x9030('0x15')][_0x9030('0x44')](_0x209aca)[_0x9030('0xd')](handleEntityNotFound(_0x200ec1,null))[_0x9030('0xd')](respondWithResult(_0x200ec1,null))[_0x9030('0x40')](handleError(_0x200ec1,null));};exports[_0x9030('0x45')]=function(_0x1dc8e6,_0x141f97){return db[_0x9030('0x15')][_0x9030('0x45')](_0x1dc8e6[_0x9030('0x46')],{})[_0x9030('0xd')](respondWithResult(_0x141f97,0xc9))[_0x9030('0x40')](handleError(_0x141f97,null));};exports['update']=function(_0x4725e5,_0x2e0283){if(_0x4725e5['body']['id']){delete _0x4725e5[_0x9030('0x46')]['id'];}return db[_0x9030('0x15')][_0x9030('0x44')]({'where':{'id':_0x4725e5['params']['id']}})['then'](handleEntityNotFound(_0x2e0283,null))[_0x9030('0xd')](saveUpdates(_0x4725e5['body'],null))['then'](respondWithResult(_0x2e0283,null))[_0x9030('0x40')](handleError(_0x2e0283,null));};exports[_0x9030('0x47')]=function(_0x2b3e41,_0x1d9b7e){return db['CmHopper'][_0x9030('0x47')]()['then'](respondWithResult(_0x1d9b7e,null))[_0x9030('0x40')](handleError(_0x1d9b7e,null));};exports[_0x9030('0x48')]=function(_0x42c414,_0x513ee4){var _0x119c2d;var _0xf54697=_0x42c414[_0x9030('0x49')]['id'];return db['CmHopper'][_0x9030('0x44')]({'where':{'id':_0x42c414[_0x9030('0x49')]['id']}})['then'](handleEntityNotFound(_0x513ee4,null))[_0x9030('0xd')](function(_0x4efbfc){if(_0x4efbfc){return _0x4efbfc[_0x9030('0x48')]()['then'](function(_0x2a39ad){return _0x2a39ad;});}})[_0x9030('0xd')](function(_0xce1911){_0x119c2d=_0xce1911;if(_0xce1911){if(_0xce1911[_0x9030('0x4a')]||_0xce1911[_0x9030('0x4b')]){return db[_0xce1911[_0x9030('0x4a')]?'VoiceQueue':_0x9030('0x4c')][_0x9030('0x44')]({'where':{'id':_0xce1911[_0x9030('0x4a')]?_0xce1911[_0x9030('0x4a')]:_0xce1911[_0x9030('0x4b')]},'attributes':['id','name'],'raw':!![]});}}})['then'](function(_0xefbcf4){var _0x16c8f6={};if(_0xefbcf4){_[_0x9030('0x4d')](_0x16c8f6,_[_0x9030('0x4e')](_0x119c2d[_0x9030('0x4f')],[_0x9030('0x50'),_0x9030('0x51'),'id']));_0x16c8f6[_0x9030('0x52')]=0x15;_0x16c8f6[_0x9030('0x53')]=_0x9030('0x54');_0x16c8f6[_0x9030('0x55')]=_0xefbcf4[_0x9030('0x11')];_0x16c8f6[_0x9030('0x56')]=_0x42c414['user'][_0x9030('0x11')];_0x16c8f6[_0x9030('0x57')]=_0x42c414['user']['id'];_0x16c8f6['deleted']=!![];_0x16c8f6[_0x9030('0x58')]=moment()[_0x9030('0x59')](_0x9030('0x5a'));_0x16c8f6[_0x9030('0x5b')]=_0x119c2d[_0x9030('0x5c')];_0x16c8f6[_0x9030('0x5d')]=_0x119c2d['VoiceQueueId']?'queue':_0x9030('0x5e');return db[_0x9030('0x5f')][_0x9030('0x44')]({'where':{'id':_0x16c8f6[_0x9030('0x60')]},'attributes':['firstName',_0x9030('0x61')]})[_0x9030('0xd')](function(_0x1ca30b){if(!_[_0x9030('0x62')](_0x513ee4)&&!_[_0x9030('0x62')](_0x1ca30b['firstName'])){_0x16c8f6['calleridname']=_0x1ca30b[_0x9030('0x63')];if(!_[_0x9030('0x62')](_0x1ca30b[_0x9030('0x61')])){_0x16c8f6[_0x9030('0x64')]+='\x20'+_0x1ca30b[_0x9030('0x61')];}}})[_0x9030('0x65')](function(){return db[_0x9030('0x66')][_0x9030('0x45')](_0x16c8f6);});}})[_0x9030('0xd')](function(_0x11f117){return db['CmHopperAdditionalPhone'][_0x9030('0x48')]({'where':{'CmHopperId':_0xf54697}});})[_0x9030('0xd')](function(){return _0x513ee4[_0x9030('0x5')](0xcc)[_0x9030('0x67')]();})[_0x9030('0x40')](handleError(_0x513ee4,null));};exports[_0x9030('0x68')]=function(_0x3012b9,_0x481e34){var _0x498f7c=[];return db[_0x9030('0x5f')][_0x9030('0x47')]()[_0x9030('0xd')](function(_0x44442f){_0x498f7c=_[_0x9030('0x42')](_0x44442f);return _0x3012b9[_0x9030('0x69')][_0x9030('0x6a')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id','dialOrderByScheduledAt',_0x9030('0x6b')],'raw':!![]});})['then'](function(_0x1cd8f5){if(_0x1cd8f5&&_0x1cd8f5['length']){return db[_0x9030('0x6c')][_0x9030('0x6d')](function(_0x303de3){var _0xb4b84e={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x9030('0x59')](_0x9030('0x5a'))},'VoiceQueueId':{'$in':_[_0x9030('0x14')](_0x1cd8f5,'id')},'$or':[{'UserId':null},{'UserId':_0x3012b9[_0x9030('0x69')]['id']}]};var _0x1a6b62={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x1cd8f5)[_0x9030('0x3a')]([_0x9030('0x6b'),0x0])[_0x9030('0x14')]('id')[_0x9030('0x6e')]()},'$or':[{'UserId':null},{'UserId':_0x3012b9[_0x9030('0x69')]['id']}]};var _0x49bad8={'$or':[_0xb4b84e,_0x1a6b62]};var _0x119835=[];if(_0x3012b9[_0x9030('0x46')][_0x9030('0x6f')]&&_0x3012b9[_0x9030('0x46')][_0x9030('0x6f')]===_0x9030('0x70')){if(!_['isEmpty'](_0x3012b9[_0x9030('0x46')][_0x9030('0x71')])){_0x49bad8['id']={'$in':_0x3012b9[_0x9030('0x46')][_0x9030('0x71')]};}_0x119835=[[_0x9030('0x72'),'ASC'],[_0x9030('0x73'),_0x1cd8f5[0x0][_0x9030('0x74')]===_0x9030('0x75')?'DESC':_0x9030('0x75')],db[_0x9030('0x6c')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id','DESC']];}else{if(!_[_0x9030('0x76')](_0x3012b9[_0x9030('0x46')][_0x9030('0x71')])){_0x49bad8['id']={'$notIn':_0x3012b9[_0x9030('0x46')][_0x9030('0x71')]};}_0x119835=[['priority',_0x9030('0x77')],[_0x9030('0x73'),_0x1cd8f5[0x0][_0x9030('0x74')]],db[_0x9030('0x6c')]['literal'](_0x9030('0x78')),['id',_0x9030('0x75')]];}return db[_0x9030('0x15')]['findOne']({'attributes':['id',_0x9030('0x79'),_0x9030('0x5c'),'recallme'],'where':_0x49bad8,'order':_0x119835,'transaction':_0x303de3,'lock':_0x303de3[_0x9030('0x7a')][_0x9030('0x7b')],'include':[{'model':db[_0x9030('0x5f')],'as':'Contact','attributes':_0x498f7c,'include':[{'model':db[_0x9030('0x7c')],'as':'Company','attributes':['id',_0x9030('0x11')]}]},{'model':db[_0x9030('0x7d')],'as':_0x9030('0x7e'),'attributes':['id',_0x9030('0x11')]},{'model':db[_0x9030('0x7f')],'as':_0x9030('0x80'),'attributes':['id',_0x9030('0x11'),'dialActive']}]})[_0x9030('0xd')](function(_0x51b73f){if(_0x51b73f){return _0x51b73f[_0x9030('0xc')]({'UserId':_0x3012b9[_0x9030('0x69')]['id']},{'transaction':_0x303de3});}});});}})[_0x9030('0xd')](handleEntityNotFound(_0x481e34,null))[_0x9030('0xd')](respondWithResult(_0x481e34,null))[_0x9030('0x40')](handleError(_0x481e34,null));};exports['getPreviewRecall']=function(_0x53e328,_0x563ead,_0x2148e5){var _0x1c7080=[];var _0x3c0b37=_0x53e328['params']['id'];var _0x1d4058=_0x53e328[_0x9030('0x69')]['id'];return db[_0x9030('0x5f')]['describe']()[_0x9030('0xd')](function(_0x3245ee){_0x1c7080=_[_0x9030('0x42')](_0x3245ee);return db[_0x9030('0x6c')][_0x9030('0x6d')](function(_0x588042){const _0x2f30b3={'id':_0x3c0b37};return db[_0x9030('0x15')][_0x9030('0x81')]({'attributes':['id','scheduledat',_0x9030('0x82')],'where':_0x2f30b3,'transaction':_0x588042,'lock':_0x588042[_0x9030('0x7a')][_0x9030('0x7b')],'include':[{'model':db[_0x9030('0x5f')],'as':'Contact','attributes':_0x1c7080,'include':[{'model':db['CmCompany'],'as':_0x9030('0x83'),'attributes':['id',_0x9030('0x11')]}]},{'model':db[_0x9030('0x7d')],'as':_0x9030('0x7e'),'attributes':['id',_0x9030('0x11')]},{'model':db['VoiceQueue'],'as':_0x9030('0x80'),'attributes':['id',_0x9030('0x11'),_0x9030('0x84')]}]})[_0x9030('0xd')](function(_0x2d3aaf){if(_0x2d3aaf){return _0x2d3aaf['update']({'UserId':_0x1d4058},{'transaction':_0x588042});}});});})[_0x9030('0xd')](handleEntityNotFound(_0x563ead,null))['then'](respondWithResult(_0x563ead,null))[_0x9030('0x40')](handleError(_0x563ead,null));};exports[_0x9030('0x85')]=function(_0x351265,_0x5b4d17){return _0x351265['user'][_0x9030('0x6a')]({'where':{'type':_0x9030('0x86'),'dialActive':!![],'dialMethod':_0x9030('0x87')},'attributes':['id'],'raw':!![]})[_0x9030('0xd')](function(_0x43c2d8){if(_0x43c2d8&&_0x43c2d8[_0x9030('0x33')]){return db[_0x9030('0x15')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x9030('0x59')](_0x9030('0x5a'))},'VoiceQueueId':{'$in':_['map'](_0x43c2d8,'id')},'$or':[{'UserId':null},{'UserId':_0x351265[_0x9030('0x69')]['id']}]}});}return 0x0;})[_0x9030('0xd')](function(_0x1a3fa3){if(!_[_0x9030('0x62')](_0x1a3fa3)&&_[_0x9030('0x88')](_0x1a3fa3)){return _0x5b4d17[_0x9030('0x5')](0xc8)[_0x9030('0xb')]({'contacts':_0x1a3fa3});}else{logger[_0x9030('0xf')](_0x9030('0x89'),'getOpenContacts',0x194,_0x9030('0x8a'));_0x5b4d17['sendStatus'](0x194);}})['catch'](handleError(_0x5b4d17,null));};exports['getTimezones']=function(_0x39414f,_0x1f9479){var _0x405e24=shared[_0x9030('0x8b')];var _0x958bf3=[];_[_0x9030('0x14')](_0x405e24,function(_0x55d575){_0x958bf3[_0x9030('0x8c')]({'id':_0x55d575[_0x9030('0x11')],'name':_0x55d575[_0x9030('0x11')],'utcOffset':_0x55d575[_0x9030('0x8d')]});});return _0x1f9479[_0x9030('0x5')](0xc8)[_0x9030('0xb')]({'tz':_0x958bf3});};exports[_0x9030('0x8e')]=function(_0x39e215,_0x208a8d){var _0x14528a=shared[_0x9030('0x8b')];var _0x1fad1b={};if(!_[_0x9030('0x62')](_0x14528a[_0x39e215['body']['id']]))_0x1fad1b=_0x14528a[_0x39e215['body']['id']];return _0x208a8d[_0x9030('0x5')](0xc8)[_0x9030('0xb')](_0x1fad1b);}; \ No newline at end of file +var _0x89c3=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','concat','$or','$gt','$lt','$ne','$eq','$not','$between','$notBetween','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','catch','show','params','find','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','createdAt','updatedAt','statedesc','deleted','campaign','membername','user','UserId','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','ivr','CmContact','ContactId','firstName','isNil','calleridname','lastName','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','outbound','preview','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','dialOrderByScheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','UPDATE','Contact','Company','List','Queue','CmCompany','CmList','dialActive','getOpenContacts','isNumber','entity\x20not\x20found','sendStatus','getTimezones','timezones','push','utcOffset','getTimezone','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','json','undefined','limit','count','offset','status','set','Content-Range','update','stack','name','send','map','CmHopper'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x89c3,0xff));var _0x389c=function(_0x57a6c2,_0x2c0f9f){_0x57a6c2=_0x57a6c2-0x0;var _0xedbc3c=_0x89c3[_0x57a6c2];return _0xedbc3c;};'use strict';var moment=require(_0x389c('0x0'));var _=require(_0x389c('0x1'));var qs=require(_0x389c('0x2'));var logger=require(_0x389c('0x3'))(_0x389c('0x4'));var shared=require(_0x389c('0x5'));var db=require(_0x389c('0x6'))['db'];function respondWithResult(_0x3a2fa4,_0x5c6c68){_0x5c6c68=_0x5c6c68||0xc8;return function(_0x3742ad){if(_0x3742ad){return _0x3a2fa4['status'](_0x5c6c68)[_0x389c('0x7')](_0x3742ad);}};}function respondWithFilteredResult(_0x4bece6,_0x51f5f5){return function(_0x2f3e3f){if(_0x2f3e3f){var _0x4a83ab=typeof _0x51f5f5['offset']===_0x389c('0x8')&&typeof _0x51f5f5[_0x389c('0x9')]===_0x389c('0x8');var _0x2efa82=_0x2f3e3f[_0x389c('0xa')];var _0x1c574b=_0x4a83ab?0x0:_0x51f5f5[_0x389c('0xb')];var _0xd58faa=_0x4a83ab?_0x2f3e3f[_0x389c('0xa')]:_0x51f5f5['offset']+_0x51f5f5[_0x389c('0x9')];var _0xe6852f;if(_0xd58faa>=_0x2efa82){_0xd58faa=_0x2efa82;_0xe6852f=0xc8;}else{_0xe6852f=0xce;}_0x4bece6[_0x389c('0xc')](_0xe6852f);return _0x4bece6[_0x389c('0xd')](_0x389c('0xe'),_0x1c574b+'-'+_0xd58faa+'/'+_0x2efa82)['json'](_0x2f3e3f);}return null;};}function saveUpdates(_0x5d7aa7,_0x2a2d7d){return function(_0x1de33a){if(_0x1de33a){return _0x1de33a[_0x389c('0xf')](_0x5d7aa7)['then'](function(_0x3f2391){return _0x3f2391;});}return null;};}function handleEntityNotFound(_0x4bde6d,_0x36e855){return function(_0x1b1618){if(!_0x1b1618){_0x4bde6d['sendStatus'](0x194);}return _0x1b1618;};}function handleError(_0x1687f2,_0x205e4f){_0x205e4f=_0x205e4f||0x1f4;return function(_0x36c118){logger['error'](_0x36c118[_0x389c('0x10')]);if(_0x36c118[_0x389c('0x11')]){delete _0x36c118[_0x389c('0x11')];}_0x1687f2[_0x389c('0xc')](_0x205e4f)[_0x389c('0x12')](_0x36c118);};}exports['index']=function(_0x5b6ef8,_0x5a2b10){var _0x335c3e={},_0x2e23d2={},_0x55dc03={'count':0x0,'rows':[]};var _0x334f7a=_[_0x389c('0x13')](db[_0x389c('0x14')][_0x389c('0x15')],function(_0xbe8380){return{'name':_0xbe8380[_0x389c('0x16')],'type':_0xbe8380[_0x389c('0x17')][_0x389c('0x18')]};});_0x2e23d2[_0x389c('0x19')]=_['map'](_0x334f7a,_0x389c('0x11'));_0x2e23d2[_0x389c('0x1a')]=_[_0x389c('0x1b')](_0x5b6ef8[_0x389c('0x1a')]);_0x2e23d2[_0x389c('0x1c')]=_[_0x389c('0x1d')](_0x2e23d2['model'],_0x2e23d2[_0x389c('0x1a')]);_0x2e23d2[_0x389c('0x1c')]=_[_0x389c('0x1e')](_0x2e23d2[_0x389c('0x1c')],['$and',_0x389c('0x1f'),_0x389c('0x20'),'$gte',_0x389c('0x21'),'$lte',_0x389c('0x22'),_0x389c('0x23'),_0x389c('0x24'),_0x389c('0x25'),_0x389c('0x26'),'$in',_0x389c('0x27'),_0x389c('0x28'),_0x389c('0x29'),_0x389c('0x2a'),_0x389c('0x2b'),'$like',_0x389c('0x2c'),'$contains',_0x389c('0x2d'),_0x389c('0x2e')]);_0x335c3e[_0x389c('0x2f')]=_[_0x389c('0x1d')](_0x2e23d2['model'],qs[_0x389c('0x30')](_0x5b6ef8[_0x389c('0x1a')]['fields']));_0x335c3e[_0x389c('0x2f')]=_0x335c3e[_0x389c('0x2f')][_0x389c('0x31')]?_0x335c3e[_0x389c('0x2f')]:_0x2e23d2[_0x389c('0x19')];if(!_0x5b6ef8[_0x389c('0x1a')][_0x389c('0x32')](_0x389c('0x33'))){_0x335c3e[_0x389c('0x9')]=qs[_0x389c('0x9')](_0x5b6ef8[_0x389c('0x1a')][_0x389c('0x9')]);_0x335c3e['offset']=qs['offset'](_0x5b6ef8['query'][_0x389c('0xb')]);}_0x335c3e['order']=qs[_0x389c('0x34')](_0x5b6ef8['query'][_0x389c('0x34')]);_0x335c3e[_0x389c('0x35')]=qs[_0x389c('0x1c')](_[_0x389c('0x36')](_0x5b6ef8['query'],_0x2e23d2[_0x389c('0x1c')]),_0x334f7a);if(_0x5b6ef8[_0x389c('0x1a')][_0x389c('0x37')]){_0x335c3e[_0x389c('0x35')]=_[_0x389c('0x38')](_0x335c3e[_0x389c('0x35')],{'$or':_['map'](_0x334f7a,function(_0x5c84f9){if(_0x5c84f9[_0x389c('0x17')]!==_0x389c('0x39')){var _0x342dd9={};_0x342dd9[_0x5c84f9[_0x389c('0x11')]]={'$like':'%'+_0x5b6ef8[_0x389c('0x1a')][_0x389c('0x37')]+'%'};return _0x342dd9;}})});}_0x335c3e=_[_0x389c('0x38')]({},_0x335c3e,_0x5b6ef8[_0x389c('0x3a')]);var _0x22341d={'where':_0x335c3e[_0x389c('0x35')]};return db[_0x389c('0x14')][_0x389c('0xa')](_0x22341d)[_0x389c('0x3b')](function(_0x55841a){_0x55dc03['count']=_0x55841a;if(_0x5b6ef8[_0x389c('0x1a')][_0x389c('0x3c')]){_0x335c3e[_0x389c('0x3d')]=[{'all':!![]}];}return db[_0x389c('0x14')][_0x389c('0x3e')](_0x335c3e);})[_0x389c('0x3b')](function(_0x58a7b1){_0x55dc03['rows']=_0x58a7b1;return _0x55dc03;})[_0x389c('0x3b')](respondWithFilteredResult(_0x5a2b10,_0x335c3e))[_0x389c('0x3f')](handleError(_0x5a2b10,null));};exports[_0x389c('0x40')]=function(_0x4d9ec4,_0x39dcd6){var _0x2884c4={'raw':!![],'where':{'id':_0x4d9ec4[_0x389c('0x41')]['id']}},_0x37f4d7={};_0x37f4d7[_0x389c('0x19')]=_[_0x389c('0x1b')](db['CmHopper'][_0x389c('0x15')]);_0x37f4d7[_0x389c('0x1a')]=_[_0x389c('0x1b')](_0x4d9ec4[_0x389c('0x1a')]);_0x37f4d7['filters']=_[_0x389c('0x1d')](_0x37f4d7['model'],_0x37f4d7[_0x389c('0x1a')]);_0x2884c4[_0x389c('0x2f')]=_[_0x389c('0x1d')](_0x37f4d7[_0x389c('0x19')],qs[_0x389c('0x30')](_0x4d9ec4[_0x389c('0x1a')][_0x389c('0x30')]));_0x2884c4[_0x389c('0x2f')]=_0x2884c4[_0x389c('0x2f')][_0x389c('0x31')]?_0x2884c4[_0x389c('0x2f')]:_0x37f4d7['model'];if(_0x4d9ec4[_0x389c('0x1a')][_0x389c('0x3c')]){_0x2884c4['include']=[{'all':!![]}];}_0x2884c4=_[_0x389c('0x38')]({},_0x2884c4,_0x4d9ec4['options']);return db[_0x389c('0x14')][_0x389c('0x42')](_0x2884c4)[_0x389c('0x3b')](handleEntityNotFound(_0x39dcd6,null))[_0x389c('0x3b')](respondWithResult(_0x39dcd6,null))[_0x389c('0x3f')](handleError(_0x39dcd6,null));};exports[_0x389c('0x43')]=function(_0xc2ef3c,_0x15c23e){return db[_0x389c('0x14')][_0x389c('0x43')](_0xc2ef3c[_0x389c('0x44')],{})[_0x389c('0x3b')](respondWithResult(_0x15c23e,0xc9))[_0x389c('0x3f')](handleError(_0x15c23e,null));};exports['update']=function(_0x575a44,_0x1d8063){if(_0x575a44[_0x389c('0x44')]['id']){delete _0x575a44[_0x389c('0x44')]['id'];}return db['CmHopper'][_0x389c('0x42')]({'where':{'id':_0x575a44[_0x389c('0x41')]['id']}})[_0x389c('0x3b')](handleEntityNotFound(_0x1d8063,null))[_0x389c('0x3b')](saveUpdates(_0x575a44['body'],null))['then'](respondWithResult(_0x1d8063,null))['catch'](handleError(_0x1d8063,null));};exports['describe']=function(_0x425ec4,_0x4a928c){return db['CmHopper'][_0x389c('0x45')]()[_0x389c('0x3b')](respondWithResult(_0x4a928c,null))[_0x389c('0x3f')](handleError(_0x4a928c,null));};exports[_0x389c('0x46')]=function(_0x153db2,_0xd37a48){var _0x3302b8;var _0x556928=_0x153db2[_0x389c('0x41')]['id'];return db[_0x389c('0x14')][_0x389c('0x42')]({'where':{'id':_0x153db2[_0x389c('0x41')]['id']}})[_0x389c('0x3b')](handleEntityNotFound(_0xd37a48,null))[_0x389c('0x3b')](function(_0x483eb8){if(_0x483eb8){return _0x483eb8[_0x389c('0x46')]()['then'](function(_0xf56fb2){return _0xf56fb2;});}})['then'](function(_0x26936d){_0x3302b8=_0x26936d;if(_0x26936d){if(_0x26936d[_0x389c('0x47')]||_0x26936d[_0x389c('0x48')]){return db[_0x26936d[_0x389c('0x47')]?_0x389c('0x49'):_0x389c('0x4a')]['find']({'where':{'id':_0x26936d[_0x389c('0x47')]?_0x26936d[_0x389c('0x47')]:_0x26936d['CampaignId']},'attributes':['id',_0x389c('0x11')],'raw':!![]});}}})[_0x389c('0x3b')](function(_0x8fe5fd){var _0x4a9519={};if(_0x8fe5fd){_[_0x389c('0x38')](_0x4a9519,_[_0x389c('0x4b')](_0x3302b8['dataValues'],[_0x389c('0x4c'),_0x389c('0x4d'),'id']));_0x4a9519['state']=0x15;_0x4a9519[_0x389c('0x4e')]=_0x389c('0x4f');_0x4a9519[_0x389c('0x50')]=_0x8fe5fd[_0x389c('0x11')];_0x4a9519[_0x389c('0x51')]=_0x153db2[_0x389c('0x52')][_0x389c('0x11')];_0x4a9519[_0x389c('0x53')]=_0x153db2[_0x389c('0x52')]['id'];_0x4a9519[_0x389c('0x4f')]=!![];_0x4a9519['deletedat']=moment()[_0x389c('0x54')](_0x389c('0x55'));_0x4a9519[_0x389c('0x56')]=_0x3302b8['phone'];_0x4a9519[_0x389c('0x57')]=_0x3302b8['VoiceQueueId']?'queue':_0x389c('0x58');return db[_0x389c('0x59')][_0x389c('0x42')]({'where':{'id':_0x4a9519[_0x389c('0x5a')]},'attributes':[_0x389c('0x5b'),'lastName']})[_0x389c('0x3b')](function(_0x4a203d){if(!_[_0x389c('0x5c')](_0xd37a48)&&!_['isNil'](_0x4a203d[_0x389c('0x5b')])){_0x4a9519[_0x389c('0x5d')]=_0x4a203d[_0x389c('0x5b')];if(!_[_0x389c('0x5c')](_0x4a203d['lastName'])){_0x4a9519[_0x389c('0x5d')]+='\x20'+_0x4a203d[_0x389c('0x5e')];}}})[_0x389c('0x5f')](function(){return db[_0x389c('0x60')][_0x389c('0x43')](_0x4a9519);});}})['then'](function(_0x5359f5){return db[_0x389c('0x61')]['destroy']({'where':{'CmHopperId':_0x556928}});})[_0x389c('0x3b')](function(){return _0xd37a48[_0x389c('0xc')](0xcc)[_0x389c('0x62')]();})['catch'](handleError(_0xd37a48,null));};exports[_0x389c('0x63')]=function(_0x4bfe42,_0x18d3d7){var _0x5e24a6=[];return db[_0x389c('0x59')]['describe']()[_0x389c('0x3b')](function(_0x1568d4){_0x5e24a6=_[_0x389c('0x1b')](_0x1568d4);return _0x4bfe42[_0x389c('0x52')]['getVoiceQueues']({'where':{'type':_0x389c('0x64'),'dialActive':!![],'dialMethod':_0x389c('0x65')},'attributes':['id','dialOrderByScheduledAt',_0x389c('0x66')],'raw':!![]});})['then'](function(_0x4cbb3d){if(_0x4cbb3d&&_0x4cbb3d[_0x389c('0x31')]){return db[_0x389c('0x67')][_0x389c('0x68')](function(_0x4ce5fd){var _0x4648aa={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x389c('0x54')](_0x389c('0x55'))},'VoiceQueueId':{'$in':_[_0x389c('0x13')](_0x4cbb3d,'id')},'$or':[{'UserId':null},{'UserId':_0x4bfe42['user']['id']}]};var _0x2dcdb7={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x4cbb3d)['filter'](['dialPreviewAutoRecallMe',0x0])[_0x389c('0x13')]('id')[_0x389c('0x69')]()},'$or':[{'UserId':null},{'UserId':_0x4bfe42['user']['id']}]};var _0x2aecff={'$or':[_0x4648aa,_0x2dcdb7]};var _0x15cc59=[];if(_0x4bfe42['body']['direction']&&_0x4bfe42[_0x389c('0x44')][_0x389c('0x6a')]===_0x389c('0x6b')){if(!_[_0x389c('0x6c')](_0x4bfe42[_0x389c('0x44')][_0x389c('0x6d')])){_0x2aecff['id']={'$in':_0x4bfe42[_0x389c('0x44')][_0x389c('0x6d')]};}_0x15cc59=[[_0x389c('0x6e'),_0x389c('0x6f')],[_0x389c('0x70'),_0x4cbb3d[0x0]['dialOrderByScheduledAt']===_0x389c('0x6f')?_0x389c('0x71'):_0x389c('0x6f')],db['sequelize'][_0x389c('0x72')](_0x389c('0x73')),['id',_0x389c('0x71')]];}else{if(!_[_0x389c('0x6c')](_0x4bfe42['body'][_0x389c('0x6d')])){_0x2aecff['id']={'$notIn':_0x4bfe42[_0x389c('0x44')]['hopperIds']};}_0x15cc59=[[_0x389c('0x6e'),_0x389c('0x71')],[_0x389c('0x70'),_0x4cbb3d[0x0][_0x389c('0x74')]],db[_0x389c('0x67')][_0x389c('0x72')](_0x389c('0x75')),['id',_0x389c('0x6f')]];}return db[_0x389c('0x14')][_0x389c('0x76')]({'attributes':['id',_0x389c('0x77'),'phone',_0x389c('0x78')],'where':_0x2aecff,'order':_0x15cc59,'transaction':_0x4ce5fd,'lock':_0x4ce5fd['LOCK'][_0x389c('0x79')],'include':[{'model':db[_0x389c('0x59')],'as':_0x389c('0x7a'),'attributes':_0x5e24a6,'include':[{'model':db['CmCompany'],'as':_0x389c('0x7b'),'attributes':['id',_0x389c('0x11')]}]},{'model':db['CmList'],'as':_0x389c('0x7c'),'attributes':['id','name']},{'model':db['VoiceQueue'],'as':_0x389c('0x7d'),'attributes':['id',_0x389c('0x11'),'dialActive']}]})['then'](function(_0x29dea4){if(_0x29dea4){return _0x29dea4[_0x389c('0xf')]({'UserId':_0x4bfe42[_0x389c('0x52')]['id']},{'transaction':_0x4ce5fd});}});});}})[_0x389c('0x3b')](handleEntityNotFound(_0x18d3d7,null))[_0x389c('0x3b')](respondWithResult(_0x18d3d7,null))[_0x389c('0x3f')](handleError(_0x18d3d7,null));};exports['getPreviewRecall']=function(_0x442696,_0x3c9a56,_0x135ebd){var _0xe3b7b2=[];var _0x58885f=_0x442696[_0x389c('0x41')]['id'];var _0x4ec383=_0x442696[_0x389c('0x52')]['id'];return db[_0x389c('0x59')][_0x389c('0x45')]()[_0x389c('0x3b')](function(_0xa82c9){_0xe3b7b2=_[_0x389c('0x1b')](_0xa82c9);return db['sequelize']['transaction'](function(_0x2ba48e){const _0xd258a5={'id':_0x58885f};return db[_0x389c('0x14')]['findOne']({'attributes':['id',_0x389c('0x77'),_0x389c('0x78')],'where':_0xd258a5,'transaction':_0x2ba48e,'lock':_0x2ba48e['LOCK'][_0x389c('0x79')],'include':[{'model':db[_0x389c('0x59')],'as':_0x389c('0x7a'),'attributes':_0xe3b7b2,'include':[{'model':db[_0x389c('0x7e')],'as':_0x389c('0x7b'),'attributes':['id','name']}]},{'model':db[_0x389c('0x7f')],'as':_0x389c('0x7c'),'attributes':['id','name']},{'model':db[_0x389c('0x49')],'as':_0x389c('0x7d'),'attributes':['id',_0x389c('0x11'),_0x389c('0x80')]}]})[_0x389c('0x3b')](function(_0x255cfd){if(_0x255cfd){return _0x255cfd[_0x389c('0xf')]({'UserId':_0x4ec383},{'transaction':_0x2ba48e});}});});})[_0x389c('0x3b')](handleEntityNotFound(_0x3c9a56,null))['then'](respondWithResult(_0x3c9a56,null))[_0x389c('0x3f')](handleError(_0x3c9a56,null));};exports[_0x389c('0x81')]=function(_0x268d7d,_0x2c21ce){return _0x268d7d[_0x389c('0x52')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x389c('0x65')},'attributes':['id'],'raw':!![]})[_0x389c('0x3b')](function(_0x63cb59){if(_0x63cb59&&_0x63cb59[_0x389c('0x31')]){return db['CmHopper'][_0x389c('0xa')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x389c('0x54')](_0x389c('0x55'))},'VoiceQueueId':{'$in':_[_0x389c('0x13')](_0x63cb59,'id')},'$or':[{'UserId':null},{'UserId':_0x268d7d[_0x389c('0x52')]['id']}]}});}return 0x0;})['then'](function(_0x5dc5fc){if(!_[_0x389c('0x5c')](_0x5dc5fc)&&_[_0x389c('0x82')](_0x5dc5fc)){return _0x2c21ce[_0x389c('0xc')](0xc8)[_0x389c('0x7')]({'contacts':_0x5dc5fc});}else{logger['error']('CmHopper,\x20%s,\x20%s,\x20%s',_0x389c('0x81'),0x194,_0x389c('0x83'));_0x2c21ce[_0x389c('0x84')](0x194);}})[_0x389c('0x3f')](handleError(_0x2c21ce,null));};exports[_0x389c('0x85')]=function(_0x4158d0,_0x589598){var _0x1f8960=shared[_0x389c('0x86')];var _0x3c2a60=[];_[_0x389c('0x13')](_0x1f8960,function(_0x458c31){_0x3c2a60[_0x389c('0x87')]({'id':_0x458c31['name'],'name':_0x458c31[_0x389c('0x11')],'utcOffset':_0x458c31[_0x389c('0x88')]});});return _0x589598[_0x389c('0xc')](0xc8)[_0x389c('0x7')]({'tz':_0x3c2a60});};exports[_0x389c('0x89')]=function(_0x3d2817,_0x2ea6d8){var _0x34adf5=shared[_0x389c('0x86')];var _0x5589b3={};if(!_[_0x389c('0x5c')](_0x34adf5[_0x3d2817[_0x389c('0x44')]['id']]))_0x5589b3=_0x34adf5[_0x3d2817[_0x389c('0x44')]['id']];return _0x2ea6d8[_0x389c('0xc')](0xc8)[_0x389c('0x7')](_0x5589b3);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 80d2fb1..84a868c 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 _0x187d=['moment','bluebird','request-promise','path','../../config/environment','./cmHopper.attributes','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','../../config/logger','api'];(function(_0x575a38,_0x2e83d7){var _0x5a7bdd=function(_0x1bf478){while(--_0x1bf478){_0x575a38['push'](_0x575a38['shift']());}};_0x5a7bdd(++_0x2e83d7);}(_0x187d,0x93));var _0xd187=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x187d[_0x411add];return _0x238242;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var logger=require(_0xd187('0x1'))(_0xd187('0x2'));var moment=require(_0xd187('0x3'));var BPromise=require(_0xd187('0x4'));var rp=require(_0xd187('0x5'));var fs=require('fs');var path=require(_0xd187('0x6'));var rimraf=require('rimraf');var config=require(_0xd187('0x7'));var attributes=require(_0xd187('0x8'));module['exports']=function(_0x1d2533,_0x58ee7){return _0x1d2533[_0xd187('0x9')](_0xd187('0xa'),attributes,{'tableName':_0xd187('0xb'),'paranoid':![],'indexes':[{'name':_0xd187('0xc'),'fields':[_0xd187('0xc')]},{'name':_0xd187('0xd'),'fields':['phone']},{'name':_0xd187('0xe'),'fields':[_0xd187('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xba34=['priority','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./cmHopper.attributes','exports','define','cm_hopper','scheduledat','phone'];(function(_0x503a61,_0x1a48f7){var _0x2202cb=function(_0x4e6fce){while(--_0x4e6fce){_0x503a61['push'](_0x503a61['shift']());}};_0x2202cb(++_0x1a48f7);}(_0xba34,0x119));var _0x4ba3=function(_0x57347f,_0x4961b0){_0x57347f=_0x57347f-0x0;var _0x5d05f6=_0xba34[_0x57347f];return _0x5d05f6;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var logger=require(_0x4ba3('0x2'))(_0x4ba3('0x3'));var moment=require(_0x4ba3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var attributes=require(_0x4ba3('0x7'));module[_0x4ba3('0x8')]=function(_0x3590a1,_0xb88621){return _0x3590a1[_0x4ba3('0x9')]('CmHopper',attributes,{'tableName':_0x4ba3('0xa'),'paranoid':![],'indexes':[{'name':_0x4ba3('0xb'),'fields':[_0x4ba3('0xb')]},{'name':_0x4ba3('0xc'),'fields':[_0x4ba3('0xc')]},{'name':_0x4ba3('0xd'),'fields':[_0x4ba3('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index ab8e52c..e3dd4ad 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 _0xa9e7=['then','info','catch','error','message','raw','ShowCmHopper','debug','CreateCmHopper','create','body','stringify','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','DestroyCmHopper','CmContact','order','LOCK','UPDATE','Contact','User','Agent','name','voicePause','UserId','push','includes','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','active','GetContactDialer','MoveContactManagedDialer','transaction','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','sequelize','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','GetContactRecallMe','describe','length','all','keys','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','availableAgentsIds','literal','NOW()\x20+\x20INTERVAL\x20','NOW()','CmList','lodash','util','moment','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','where','attributes','limit','include','model','map'];(function(_0x54b3ae,_0x594d04){var _0x3d3b5=function(_0x1ce236){while(--_0x1ce236){_0x54b3ae['push'](_0x54b3ae['shift']());}};_0x3d3b5(++_0x594d04);}(_0xa9e7,0x92));var _0x7a9e=function(_0x49760c,_0x2ee176){_0x49760c=_0x49760c-0x0;var _0x50033f=_0xa9e7[_0x49760c];return _0x50033f;};'use strict';var _=require(_0x7a9e('0x0'));var util=require(_0x7a9e('0x1'));var moment=require(_0x7a9e('0x2'));var BPromise=require('bluebird');var db=require(_0x7a9e('0x3'))['db'];var logger=require(_0x7a9e('0x4'))(_0x7a9e('0x5'));exports[_0x7a9e('0x6')]=function(_0x457a5c){var _0x2f760e=this;return new Promise(function(_0x3b9563,_0x40ea9e){return db[_0x7a9e('0x7')][_0x7a9e('0x8')]({'raw':_0x457a5c[_0x7a9e('0x9')]?_0x457a5c['options']['raw']===undefined?!![]:![]:!![],'where':_0x457a5c['options']?_0x457a5c['options'][_0x7a9e('0xa')]||null:null,'attributes':_0x457a5c[_0x7a9e('0x9')]?_0x457a5c[_0x7a9e('0x9')][_0x7a9e('0xb')]||null:null,'limit':_0x457a5c[_0x7a9e('0x9')]?_0x457a5c[_0x7a9e('0x9')][_0x7a9e('0xc')]||null:null,'include':_0x457a5c[_0x7a9e('0x9')]?_0x457a5c['options'][_0x7a9e('0xd')]?_['map'](_0x457a5c[_0x7a9e('0x9')][_0x7a9e('0xd')],function(_0x18469a){return{'model':db[_0x18469a[_0x7a9e('0xe')]],'as':_0x18469a['as'],'attributes':_0x18469a[_0x7a9e('0xb')],'include':_0x18469a[_0x7a9e('0xd')]?_[_0x7a9e('0xf')](_0x18469a['include'],function(_0xba71cf){return{'model':db[_0xba71cf[_0x7a9e('0xe')]],'as':_0xba71cf['as'],'attributes':_0xba71cf[_0x7a9e('0xb')],'include':_0xba71cf[_0x7a9e('0xd')]?_[_0x7a9e('0xf')](_0xba71cf[_0x7a9e('0xd')],function(_0x3c4d05){return{'model':db[_0x3c4d05[_0x7a9e('0xe')]],'as':_0x3c4d05['as'],'attributes':_0x3c4d05['attributes']};}):[]};}):[]};}):[]:[]})[_0x7a9e('0x10')](function(_0xd4e7a8){logger[_0x7a9e('0x11')](_0x7a9e('0x6'),_0x457a5c);logger['debug'](_0x7a9e('0x6'),_0x457a5c,JSON['stringify'](_0xd4e7a8));_0x3b9563(_0xd4e7a8);})[_0x7a9e('0x12')](function(_0x3391fd){logger[_0x7a9e('0x13')]('GetCmHopper',_0x3391fd[_0x7a9e('0x14')],_0x457a5c);_0x40ea9e(_0x2f760e[_0x7a9e('0x13')](0x1f4,_0x3391fd['message']));});});};exports['ShowCmHopper']=function(_0xc7d1da){var _0xab1496=this;return new Promise(function(_0x4bfb01,_0x309442){return db[_0x7a9e('0x7')]['find']({'raw':_0xc7d1da[_0x7a9e('0x9')]?_0xc7d1da[_0x7a9e('0x9')][_0x7a9e('0x15')]===undefined?!![]:![]:!![],'where':_0xc7d1da['options']?_0xc7d1da[_0x7a9e('0x9')][_0x7a9e('0xa')]||null:null,'attributes':_0xc7d1da[_0x7a9e('0x9')]?_0xc7d1da[_0x7a9e('0x9')][_0x7a9e('0xb')]||null:null,'include':_0xc7d1da[_0x7a9e('0x9')]?_0xc7d1da[_0x7a9e('0x9')]['include']?_[_0x7a9e('0xf')](_0xc7d1da[_0x7a9e('0x9')][_0x7a9e('0xd')],function(_0x437e4f){return{'model':db[_0x437e4f[_0x7a9e('0xe')]],'as':_0x437e4f['as'],'attributes':_0x437e4f[_0x7a9e('0xb')],'include':_0x437e4f[_0x7a9e('0xd')]?_[_0x7a9e('0xf')](_0x437e4f[_0x7a9e('0xd')],function(_0x545633){return{'model':db[_0x545633['model']],'as':_0x545633['as'],'attributes':_0x545633[_0x7a9e('0xb')],'include':_0x545633[_0x7a9e('0xd')]?_[_0x7a9e('0xf')](_0x545633[_0x7a9e('0xd')],function(_0x411895){return{'model':db[_0x411895[_0x7a9e('0xe')]],'as':_0x411895['as'],'attributes':_0x411895[_0x7a9e('0xb')]};}):[]};}):[]};}):[]:[]})[_0x7a9e('0x10')](function(_0x52f45c){logger['info'](_0x7a9e('0x16'),_0xc7d1da);logger[_0x7a9e('0x17')](_0x7a9e('0x16'),_0xc7d1da,JSON['stringify'](_0x52f45c));_0x4bfb01(_0x52f45c);})[_0x7a9e('0x12')](function(_0x5b6752){logger['error'](_0x7a9e('0x16'),_0x5b6752[_0x7a9e('0x14')],_0xc7d1da);_0x309442(_0xab1496[_0x7a9e('0x13')](0x1f4,_0x5b6752[_0x7a9e('0x14')]));});});};exports[_0x7a9e('0x18')]=function(_0x5de7e9){var _0x1eb0ba=this;return new Promise(function(_0x15deba,_0x5e7f45){return db[_0x7a9e('0x7')][_0x7a9e('0x19')](_0x5de7e9[_0x7a9e('0x1a')],{'raw':_0x5de7e9[_0x7a9e('0x9')]?_0x5de7e9['options']['raw']===undefined?!![]:![]:!![]})[_0x7a9e('0x10')](function(_0x2ebbd1){logger[_0x7a9e('0x11')]('CreateCmHopper',_0x5de7e9);logger[_0x7a9e('0x17')](_0x7a9e('0x18'),_0x5de7e9,JSON[_0x7a9e('0x1b')](_0x2ebbd1));_0x15deba(_0x2ebbd1);})[_0x7a9e('0x12')](function(_0x68f817){logger[_0x7a9e('0x13')](_0x7a9e('0x18'),_0x68f817[_0x7a9e('0x14')],_0x5de7e9);_0x5e7f45(_0x1eb0ba[_0x7a9e('0x13')](0x1f4,_0x68f817[_0x7a9e('0x14')]));});});};exports[_0x7a9e('0x1c')]=function(_0x441c69){var _0x4a0fbd=this;return new Promise(function(_0x48ad6c,_0x3111bd){return db[_0x7a9e('0x7')][_0x7a9e('0x1d')](_0x441c69[_0x7a9e('0x1a')],{'raw':_0x441c69[_0x7a9e('0x9')]?_0x441c69['options'][_0x7a9e('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x441c69[_0x7a9e('0x9')]?_0x441c69[_0x7a9e('0x9')][_0x7a9e('0xa')]||null:null,'attributes':_0x441c69[_0x7a9e('0x9')]?_0x441c69[_0x7a9e('0x9')][_0x7a9e('0xb')]||null:null,'limit':_0x441c69['options']?_0x441c69[_0x7a9e('0x9')][_0x7a9e('0xc')]||null:null})[_0x7a9e('0x10')](function(_0x15d279){logger[_0x7a9e('0x11')]('UpdateCmHopper',_0x441c69);logger[_0x7a9e('0x11')](_0x7a9e('0x1e'),JSON[_0x7a9e('0x1b')](_0x441c69[_0x7a9e('0x9')][_0x7a9e('0xa')]),_0x441c69[_0x7a9e('0x1a')]['active']);logger[_0x7a9e('0x17')](_0x7a9e('0x1c'),_0x441c69,JSON[_0x7a9e('0x1b')](_0x15d279));_0x48ad6c(_0x15d279);})[_0x7a9e('0x12')](function(_0x2ba668){logger[_0x7a9e('0x13')]('UpdateCmHopper',_0x2ba668[_0x7a9e('0x14')],_0x441c69);_0x3111bd(_0x4a0fbd[_0x7a9e('0x13')](0x1f4,_0x2ba668[_0x7a9e('0x14')]));});});};exports['DestroyCmHopper']=function(_0x1fa158){var _0x447c9d=this;return new Promise(function(_0x2b58b5,_0x1c6026){return db[_0x7a9e('0x7')][_0x7a9e('0x1f')]({'where':_0x1fa158[_0x7a9e('0x9')]?_0x1fa158[_0x7a9e('0x9')]['where']||null:null})[_0x7a9e('0x10')](function(_0x840df4){logger[_0x7a9e('0x11')](_0x7a9e('0x20'),_0x1fa158);logger[_0x7a9e('0x17')](_0x7a9e('0x20'),_0x1fa158,JSON['stringify'](_0x840df4));_0x2b58b5(_0x840df4);})[_0x7a9e('0x12')](function(_0x4acac6){logger[_0x7a9e('0x13')](_0x7a9e('0x20'),_0x4acac6[_0x7a9e('0x14')],_0x1fa158);_0x1c6026(_0x447c9d[_0x7a9e('0x13')](0x1f4,_0x4acac6[_0x7a9e('0x14')]));});});};exports['GetContactDialer']=function(_0x1a1d21){var _0x46d6a9=this;return new Promise(function(_0x60c8b7,_0x2ca191){return db[_0x7a9e('0x21')]['describe']()[_0x7a9e('0x10')](function(_0x184af4){return db['sequelize']['transaction'](function(_0x117643){return db['CmHopper'][_0x7a9e('0x8')]({'where':_0x1a1d21[_0x7a9e('0x9')]?_0x1a1d21[_0x7a9e('0x9')][_0x7a9e('0xa')]||null:null,'attributes':_0x1a1d21[_0x7a9e('0x9')]?_0x1a1d21[_0x7a9e('0x9')]['attributes']||null:null,'limit':_0x1a1d21[_0x7a9e('0x9')]?_0x1a1d21[_0x7a9e('0x9')]['limit']||null:null,'order':_0x1a1d21[_0x7a9e('0x9')]?_0x1a1d21[_0x7a9e('0x9')][_0x7a9e('0x22')]||null:null,'transaction':_0x117643,'lock':_0x117643[_0x7a9e('0x23')][_0x7a9e('0x24')],'include':[{'model':db[_0x7a9e('0x21')],'as':_0x7a9e('0x25'),'attributes':_['keys'](_0x184af4)},{'model':db[_0x7a9e('0x26')],'as':_0x7a9e('0x27'),'attributes':['id',_0x7a9e('0x28'),_0x7a9e('0x29')]}]})[_0x7a9e('0x10')](function(_0x1ac94c){var _0x1adf7e=[];var _0x1361de=[];for(var _0x20423c=0x0;_0x20423c<_0x1ac94c['length'];_0x20423c+=0x1){var _0x2ea16a=_0x1ac94c[_0x20423c][_0x7a9e('0x2a')];if(_0x2ea16a===null){_0x1adf7e[_0x7a9e('0x2b')](_0x1ac94c[_0x20423c]['update'](_0x1a1d21[_0x7a9e('0x1a')],{'transaction':_0x117643}));}else if(!_0x1361de[_0x7a9e('0x2c')](_0x2ea16a)){_0x1361de[_0x7a9e('0x2b')](_0x2ea16a);_0x1adf7e[_0x7a9e('0x2b')](_0x1ac94c[_0x20423c][_0x7a9e('0x1d')](_0x1a1d21[_0x7a9e('0x1a')],{'transaction':_0x117643}));}}return BPromise['all'](_0x1adf7e);});})['then'](function(_0x5ae275){logger[_0x7a9e('0x11')]('GetContactDialer',_0x1a1d21);if(_0x5ae275['length']>0x0){logger[_0x7a9e('0x11')](_0x7a9e('0x2d'),_0x5ae275[0x0]['dataValues']['id'],_0x5ae275[0x0][_0x7a9e('0x2e')][_0x7a9e('0x2f')],_0x5ae275[0x0][_0x7a9e('0x2e')][_0x7a9e('0x30')]);}logger[_0x7a9e('0x17')](_0x7a9e('0x31'),_0x1a1d21,JSON[_0x7a9e('0x1b')](_0x5ae275));_0x60c8b7(_0x5ae275);})[_0x7a9e('0x12')](function(_0x4ff0de){logger[_0x7a9e('0x13')](_0x7a9e('0x31'),_0x4ff0de[_0x7a9e('0x14')],_0x1a1d21);_0x2ca191(_0x46d6a9[_0x7a9e('0x13')](0x1f4,_0x4ff0de[_0x7a9e('0x14')]));});});});};exports[_0x7a9e('0x32')]=function(_0x29f9ac){var _0x53d26d=this;return new Promise(function(_0x48cac5,_0x77ba91){return db['sequelize'][_0x7a9e('0x33')](function(_0x288fe0){return db[_0x7a9e('0x34')]['create'](_0x29f9ac[_0x7a9e('0x1a')],{'raw':_0x29f9ac[_0x7a9e('0x9')]?_0x29f9ac[_0x7a9e('0x9')][_0x7a9e('0x15')]===undefined?!![]:![]:!![],'transaction':_0x288fe0})[_0x7a9e('0x10')](function(){logger[_0x7a9e('0x11')](_0x7a9e('0x35'),JSON['stringify'](_0x29f9ac[_0x7a9e('0x9')][_0x7a9e('0xa')]),_0x29f9ac['options'][_0x7a9e('0xa')][_0x7a9e('0x30')]);return db[_0x7a9e('0x7')][_0x7a9e('0x1f')]({'where':_0x29f9ac['options']?_0x29f9ac[_0x7a9e('0x9')][_0x7a9e('0xa')]||null:null,'transaction':_0x288fe0});});})[_0x7a9e('0x10')](function(_0x383ed2){logger[_0x7a9e('0x11')](_0x7a9e('0x32'),_0x29f9ac);logger[_0x7a9e('0x17')](_0x7a9e('0x32'),_0x29f9ac,JSON[_0x7a9e('0x1b')](_0x383ed2));_0x48cac5(_0x383ed2);})[_0x7a9e('0x12')](function(_0x2a584a){logger['error'](_0x7a9e('0x32'),_0x2a584a[_0x7a9e('0x14')],_0x29f9ac);_0x77ba91(_0x53d26d[_0x7a9e('0x13')](0x1f4,_0x2a584a[_0x7a9e('0x14')]));});});};exports[_0x7a9e('0x36')]=function(_0x44212f){var _0x46ce92=this;return new Promise(function(_0x447af3,_0x33c531){return db[_0x7a9e('0x7')]['findAll']({'raw':_0x44212f[_0x7a9e('0x9')]?_0x44212f[_0x7a9e('0x9')][_0x7a9e('0x15')]===undefined?!![]:![]:!![],'where':_0x44212f[_0x7a9e('0x9')]?_0x44212f[_0x7a9e('0x9')][_0x7a9e('0xa')]||null:null,'attributes':[[db[_0x7a9e('0x37')]['fn'](_0x7a9e('0x38'),db[_0x7a9e('0x37')]['fn']('IF',db[_0x7a9e('0x37')]['literal'](_0x7a9e('0x39')+util[_0x7a9e('0x3a')](_0x7a9e('0x3b'),moment()['format'](_0x7a9e('0x3c')))+_0x7a9e('0x3d')))),'contactsRescheduled']]})[_0x7a9e('0x10')](function(_0x21d8dd){logger['info']('CountReScheduled',_0x44212f);logger['debug'](_0x7a9e('0x36'),_0x44212f,JSON[_0x7a9e('0x1b')](_0x21d8dd));_0x447af3(_0x21d8dd);})[_0x7a9e('0x12')](function(_0x2c339f){logger[_0x7a9e('0x13')](_0x7a9e('0x36'),_0x2c339f[_0x7a9e('0x14')],_0x44212f);_0x33c531(_0x46ce92[_0x7a9e('0x13')](0x1f4,_0x2c339f[_0x7a9e('0x14')]));});});};exports[_0x7a9e('0x3e')]=function(_0x20de1b){var _0x108767=this;return new Promise(function(_0x19d771,_0x466a0e){return db[_0x7a9e('0x21')][_0x7a9e('0x3f')]()[_0x7a9e('0x10')](function(){return db[_0x7a9e('0x37')][_0x7a9e('0x33')](function(_0x383fab){return db['CmHopper'][_0x7a9e('0x8')]({'where':_0x20de1b[_0x7a9e('0x9')]?_0x20de1b[_0x7a9e('0x9')][_0x7a9e('0xa')]||null:null,'attributes':_0x20de1b[_0x7a9e('0x9')]?_0x20de1b['options'][_0x7a9e('0xb')]||null:null,'limit':0x1,'order':_0x20de1b[_0x7a9e('0x9')]?_0x20de1b[_0x7a9e('0x9')][_0x7a9e('0x22')]||null:null,'group':db['CmHopper']['UserId'],'transaction':_0x383fab,'lock':_0x383fab[_0x7a9e('0x23')][_0x7a9e('0x24')],'include':_0x20de1b[_0x7a9e('0x9')]?_0x20de1b[_0x7a9e('0x9')]['include']?_['map'](_0x20de1b[_0x7a9e('0x9')]['include'],function(_0x5d485b){return{'model':db[_0x5d485b[_0x7a9e('0xe')]],'as':_0x5d485b['as'],'attributes':_0x5d485b[_0x7a9e('0xb')],'include':_0x5d485b[_0x7a9e('0xd')]?_[_0x7a9e('0xf')](_0x5d485b['include'],function(_0x1ca7cf){return{'model':db[_0x1ca7cf['model']],'as':_0x1ca7cf['as'],'attributes':_0x1ca7cf[_0x7a9e('0xb')],'include':_0x1ca7cf[_0x7a9e('0xd')]?_[_0x7a9e('0xf')](_0x1ca7cf['include'],function(_0x373ad1){return{'model':db[_0x373ad1['model']],'as':_0x373ad1['as'],'attributes':_0x373ad1[_0x7a9e('0xb')]};}):[]};}):[]};}):[]:[]})[_0x7a9e('0x10')](function(_0x2a1430){var _0x4de4bd=[];for(var _0x309432=0x0;_0x309432<_0x2a1430[_0x7a9e('0x40')];_0x309432+=0x1){_0x4de4bd[_0x7a9e('0x2b')](_0x2a1430[_0x309432][_0x7a9e('0x1d')](_0x20de1b[_0x7a9e('0x1a')],{'transaction':_0x383fab}));}return BPromise[_0x7a9e('0x41')](_0x4de4bd);});})[_0x7a9e('0x10')](function(_0xae8bf5){logger['info'](_0x7a9e('0x3e'),_0x20de1b);logger[_0x7a9e('0x17')](_0x7a9e('0x3e'),_0x20de1b,JSON[_0x7a9e('0x1b')](_0xae8bf5));_0x19d771(_0xae8bf5);})[_0x7a9e('0x12')](function(_0x263e5f){logger[_0x7a9e('0x13')](_0x7a9e('0x3e'),_0x263e5f[_0x7a9e('0x14')],_0x20de1b);_0x466a0e(_0x108767[_0x7a9e('0x13')](0x1f4,_0x263e5f[_0x7a9e('0x14')]));});});});};exports['GetCmHopperPreview']=function(_0x17f8a4){var _0x4a5bd4=this;return new Promise(function(_0x48579e,_0xddef6e){db['CmContact'][_0x7a9e('0x3f')]()[_0x7a9e('0x10')](function(_0x67fc50){return db[_0x7a9e('0x7')][_0x7a9e('0x8')]({'raw':_0x17f8a4[_0x7a9e('0x9')]?_0x17f8a4['options'][_0x7a9e('0x15')]===undefined?!![]:![]:!![],'where':_0x17f8a4[_0x7a9e('0x9')]?_0x17f8a4[_0x7a9e('0x9')]['where']||null:null,'attributes':_0x17f8a4[_0x7a9e('0x9')]?_0x17f8a4[_0x7a9e('0x9')][_0x7a9e('0xb')]||null:null,'limit':_0x17f8a4['options']?_0x17f8a4[_0x7a9e('0x9')][_0x7a9e('0xc')]||null:null,'include':_0x17f8a4[_0x7a9e('0x9')]?_0x17f8a4[_0x7a9e('0x9')][_0x7a9e('0xd')]?_[_0x7a9e('0xf')](_0x17f8a4[_0x7a9e('0x9')][_0x7a9e('0xd')],function(_0x351378){return{'model':db[_0x351378[_0x7a9e('0xe')]],'as':_0x351378['as'],'attributes':_0x351378['as']===_0x7a9e('0x25')?_[_0x7a9e('0x42')](_0x67fc50):_0x351378['attributes'],'include':_0x351378[_0x7a9e('0xd')]?_['map'](_0x351378[_0x7a9e('0xd')],function(_0x2806cd){return{'model':db[_0x2806cd['model']],'as':_0x2806cd['as'],'attributes':_0x2806cd[_0x7a9e('0xb')],'include':_0x2806cd['include']?_[_0x7a9e('0xf')](_0x2806cd[_0x7a9e('0xd')],function(_0x1e3bf5){return{'model':db[_0x1e3bf5[_0x7a9e('0xe')]],'as':_0x1e3bf5['as'],'attributes':_0x1e3bf5[_0x7a9e('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x43cb78){logger[_0x7a9e('0x11')](_0x7a9e('0x6'),_0x17f8a4);logger[_0x7a9e('0x17')](_0x7a9e('0x6'),_0x17f8a4,JSON['stringify'](_0x43cb78));_0x48579e(_0x43cb78);})[_0x7a9e('0x12')](function(_0x4551a2){logger['error'](_0x7a9e('0x6'),_0x4551a2[_0x7a9e('0x14')],_0x17f8a4);_0xddef6e(_0x4a5bd4[_0x7a9e('0x13')](0x1f4,_0x4551a2['message']));});});});};exports[_0x7a9e('0x43')]=function(_0x387654){var _0x45a682=this;return new Promise(function(_0x4877c6,_0x32450c){return db[_0x7a9e('0x21')][_0x7a9e('0x44')]({'raw':!![],'where':{'phone':_0x387654[_0x7a9e('0x9')][_0x7a9e('0xa')][_0x7a9e('0x45')]},'attributes':['id',_0x7a9e('0x46')],'order':[['id',_0x7a9e('0x47')]]})[_0x7a9e('0x10')](function(_0x3aecd8){logger['info'](_0x7a9e('0x48'),_0x387654);logger['debug']('getContactByPhone',_0x387654,JSON[_0x7a9e('0x1b')](_0x3aecd8));_0x4877c6(_0x3aecd8);})[_0x7a9e('0x12')](function(_0x8f83b8){logger[_0x7a9e('0x13')](_0x7a9e('0x48'),_0x8f83b8[_0x7a9e('0x14')],_0x387654);_0x32450c(_0x45a682[_0x7a9e('0x13')](0x1f4,_0x8f83b8[_0x7a9e('0x14')]));});});};exports[_0x7a9e('0x49')]=function(_0x12f919){var _0x56394f=this;return new Promise(function(_0x2b76e9,_0x5a868e){return db[_0x7a9e('0x37')]['transaction'](function(_0xe31b6e){var _0x241f1c=_0x12f919[_0x7a9e('0x9')]&&_0x12f919[_0x7a9e('0x9')]['where']?_0x12f919[_0x7a9e('0x9')][_0x7a9e('0xa')]:{};return db['CmHopper'][_0x7a9e('0x1d')](_0x12f919[_0x7a9e('0x1a')],{'where':_0x241f1c,'transaction':_0xe31b6e})[_0x7a9e('0x10')](function(_0x4b62bf){logger['info'](_0x7a9e('0x49'),_0x12f919);logger[_0x7a9e('0x17')](_0x7a9e('0x49'),_0x12f919,JSON[_0x7a9e('0x1b')](_0x4b62bf));_0x2b76e9(_0x4b62bf);})['catch'](function(_0x262756){logger[_0x7a9e('0x13')](_0x7a9e('0x49'),_0x262756[_0x7a9e('0x14')],_0x12f919);_0x5a868e(_0x56394f[_0x7a9e('0x13')](0x1f4,_0x262756[_0x7a9e('0x14')]));});});});};exports[_0x7a9e('0x4a')]=function(_0x16098e){var _0x2d9cbf=this;var _0x48422a=_0x16098e[_0x7a9e('0x1a')]['where'][_0x7a9e('0x4b')];var _0x84abe6=_0x16098e[_0x7a9e('0x1a')][_0x7a9e('0xa')]['interval'];var _0x122f86=_0x16098e[_0x7a9e('0x1a')]['where'][_0x7a9e('0x4c')];return new Promise(function(_0x234b16,_0x3cbe72){return db[_0x7a9e('0x7')][_0x7a9e('0x8')]({'where':{'voiceQueueId':{'$in':_0x48422a},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x7a9e('0x37')][_0x7a9e('0x4d')](_0x7a9e('0x4e')+_0x84abe6+'\x20MINUTE'),'$gt':db[_0x7a9e('0x37')][_0x7a9e('0x4d')](_0x7a9e('0x4f'))}},'UserId':{'$in':_0x122f86}},'include':[{'model':db[_0x7a9e('0x21')],'as':'Contact'},{'model':db[_0x7a9e('0x26')],'as':_0x7a9e('0x27'),'attributes':['id','name',_0x7a9e('0x29')]},{'model':db[_0x7a9e('0x50')],'as':'List'}]})[_0x7a9e('0x10')](function(_0x4ede8a){if(_0x4ede8a['length']>0x0){return db[_0x7a9e('0x37')][_0x7a9e('0x33')](function(_0x551840){return db[_0x7a9e('0x7')]['update']({'recallmeNotifiedDate':db['sequelize']['literal']('NOW()')},{'where':{'id':{'$in':_['map'](_0x4ede8a,'id')}},'transaction':_0x551840})[_0x7a9e('0x10')](function(){_0x234b16(_0x4ede8a);})[_0x7a9e('0x12')](function(_0x12ee72){logger['error'](_0x7a9e('0x4a'),_0x12ee72[_0x7a9e('0x14')],_0x16098e);_0x3cbe72(_0x2d9cbf[_0x7a9e('0x13')](0x1f4,_0x12ee72[_0x7a9e('0x14')]));});})[_0x7a9e('0x12')](function(_0x4aae69){logger[_0x7a9e('0x13')](_0x7a9e('0x4a'),_0x4aae69[_0x7a9e('0x14')],_0x16098e);_0x3cbe72(_0x2d9cbf[_0x7a9e('0x13')](0x1f4,_0x4aae69[_0x7a9e('0x14')]));});}else{_0x234b16(_0x4ede8a);}});});}; \ No newline at end of file +var _0xf7e2=['literal','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','length','GetCmHopperPreview','keys','GetContactByPhone','phone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','NOW()','CmList','lodash','util','moment','../../mysqldb','../../config/logger','rpc','CmHopper','options','raw','where','attributes','limit','include','map','model','then','info','debug','GetCmHopper','stringify','catch','error','message','ShowCmHopper','find','CreateCmHopper','create','body','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','DestroyCmHopper','describe','sequelize','transaction','order','LOCK','UPDATE','CmContact','Contact','User','Agent','name','voicePause','UserId','push','update','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','active','GetContactDialer','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','MoveContactManagedDialer','CountReScheduled','findAll'];(function(_0x3ed714,_0x148280){var _0x4e13c3=function(_0xa81c7a){while(--_0xa81c7a){_0x3ed714['push'](_0x3ed714['shift']());}};_0x4e13c3(++_0x148280);}(_0xf7e2,0x1e2));var _0x2f7e=function(_0xd2a313,_0xd98999){_0xd2a313=_0xd2a313-0x0;var _0x245a66=_0xf7e2[_0xd2a313];return _0x245a66;};'use strict';var _=require(_0x2f7e('0x0'));var util=require(_0x2f7e('0x1'));var moment=require(_0x2f7e('0x2'));var BPromise=require('bluebird');var db=require(_0x2f7e('0x3'))['db'];var logger=require(_0x2f7e('0x4'))(_0x2f7e('0x5'));exports['GetCmHopper']=function(_0x594744){var _0x59c81b=this;return new Promise(function(_0x2c3f96,_0x2691e8){return db[_0x2f7e('0x6')]['findAll']({'raw':_0x594744[_0x2f7e('0x7')]?_0x594744[_0x2f7e('0x7')][_0x2f7e('0x8')]===undefined?!![]:![]:!![],'where':_0x594744['options']?_0x594744['options'][_0x2f7e('0x9')]||null:null,'attributes':_0x594744[_0x2f7e('0x7')]?_0x594744[_0x2f7e('0x7')][_0x2f7e('0xa')]||null:null,'limit':_0x594744[_0x2f7e('0x7')]?_0x594744[_0x2f7e('0x7')][_0x2f7e('0xb')]||null:null,'include':_0x594744[_0x2f7e('0x7')]?_0x594744[_0x2f7e('0x7')][_0x2f7e('0xc')]?_[_0x2f7e('0xd')](_0x594744[_0x2f7e('0x7')][_0x2f7e('0xc')],function(_0xa6e043){return{'model':db[_0xa6e043[_0x2f7e('0xe')]],'as':_0xa6e043['as'],'attributes':_0xa6e043[_0x2f7e('0xa')],'include':_0xa6e043['include']?_[_0x2f7e('0xd')](_0xa6e043[_0x2f7e('0xc')],function(_0x4090b9){return{'model':db[_0x4090b9[_0x2f7e('0xe')]],'as':_0x4090b9['as'],'attributes':_0x4090b9[_0x2f7e('0xa')],'include':_0x4090b9['include']?_[_0x2f7e('0xd')](_0x4090b9[_0x2f7e('0xc')],function(_0x5ed421){return{'model':db[_0x5ed421['model']],'as':_0x5ed421['as'],'attributes':_0x5ed421[_0x2f7e('0xa')]};}):[]};}):[]};}):[]:[]})[_0x2f7e('0xf')](function(_0x493d12){logger[_0x2f7e('0x10')]('GetCmHopper',_0x594744);logger[_0x2f7e('0x11')](_0x2f7e('0x12'),_0x594744,JSON[_0x2f7e('0x13')](_0x493d12));_0x2c3f96(_0x493d12);})[_0x2f7e('0x14')](function(_0xb61746){logger[_0x2f7e('0x15')](_0x2f7e('0x12'),_0xb61746[_0x2f7e('0x16')],_0x594744);_0x2691e8(_0x59c81b['error'](0x1f4,_0xb61746[_0x2f7e('0x16')]));});});};exports[_0x2f7e('0x17')]=function(_0x27c106){var _0x32eaaa=this;return new Promise(function(_0x42bc36,_0x3cf6a4){return db[_0x2f7e('0x6')][_0x2f7e('0x18')]({'raw':_0x27c106[_0x2f7e('0x7')]?_0x27c106[_0x2f7e('0x7')][_0x2f7e('0x8')]===undefined?!![]:![]:!![],'where':_0x27c106[_0x2f7e('0x7')]?_0x27c106['options']['where']||null:null,'attributes':_0x27c106[_0x2f7e('0x7')]?_0x27c106[_0x2f7e('0x7')][_0x2f7e('0xa')]||null:null,'include':_0x27c106[_0x2f7e('0x7')]?_0x27c106['options'][_0x2f7e('0xc')]?_[_0x2f7e('0xd')](_0x27c106[_0x2f7e('0x7')]['include'],function(_0x135194){return{'model':db[_0x135194['model']],'as':_0x135194['as'],'attributes':_0x135194['attributes'],'include':_0x135194[_0x2f7e('0xc')]?_[_0x2f7e('0xd')](_0x135194[_0x2f7e('0xc')],function(_0x5647ec){return{'model':db[_0x5647ec[_0x2f7e('0xe')]],'as':_0x5647ec['as'],'attributes':_0x5647ec[_0x2f7e('0xa')],'include':_0x5647ec['include']?_[_0x2f7e('0xd')](_0x5647ec[_0x2f7e('0xc')],function(_0xc40227){return{'model':db[_0xc40227[_0x2f7e('0xe')]],'as':_0xc40227['as'],'attributes':_0xc40227[_0x2f7e('0xa')]};}):[]};}):[]};}):[]:[]})[_0x2f7e('0xf')](function(_0x20875a){logger[_0x2f7e('0x10')](_0x2f7e('0x17'),_0x27c106);logger[_0x2f7e('0x11')](_0x2f7e('0x17'),_0x27c106,JSON[_0x2f7e('0x13')](_0x20875a));_0x42bc36(_0x20875a);})[_0x2f7e('0x14')](function(_0x5cf99f){logger[_0x2f7e('0x15')](_0x2f7e('0x17'),_0x5cf99f['message'],_0x27c106);_0x3cf6a4(_0x32eaaa['error'](0x1f4,_0x5cf99f['message']));});});};exports[_0x2f7e('0x19')]=function(_0x19a4b9){var _0x878ac0=this;return new Promise(function(_0x18b4ed,_0x13f3d1){return db[_0x2f7e('0x6')][_0x2f7e('0x1a')](_0x19a4b9[_0x2f7e('0x1b')],{'raw':_0x19a4b9[_0x2f7e('0x7')]?_0x19a4b9['options'][_0x2f7e('0x8')]===undefined?!![]:![]:!![]})[_0x2f7e('0xf')](function(_0x5dbcd5){logger['info'](_0x2f7e('0x19'),_0x19a4b9);logger[_0x2f7e('0x11')]('CreateCmHopper',_0x19a4b9,JSON[_0x2f7e('0x13')](_0x5dbcd5));_0x18b4ed(_0x5dbcd5);})[_0x2f7e('0x14')](function(_0x192ccf){logger[_0x2f7e('0x15')](_0x2f7e('0x19'),_0x192ccf[_0x2f7e('0x16')],_0x19a4b9);_0x13f3d1(_0x878ac0['error'](0x1f4,_0x192ccf['message']));});});};exports['UpdateCmHopper']=function(_0x162f2d){var _0x328360=this;return new Promise(function(_0x100418,_0x13d08f){return db[_0x2f7e('0x6')]['update'](_0x162f2d[_0x2f7e('0x1b')],{'raw':_0x162f2d[_0x2f7e('0x7')]?_0x162f2d[_0x2f7e('0x7')][_0x2f7e('0x8')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x162f2d['options']?_0x162f2d['options']['where']||null:null,'attributes':_0x162f2d['options']?_0x162f2d[_0x2f7e('0x7')]['attributes']||null:null,'limit':_0x162f2d[_0x2f7e('0x7')]?_0x162f2d[_0x2f7e('0x7')]['limit']||null:null})[_0x2f7e('0xf')](function(_0x2aa51b){logger['info'](_0x2f7e('0x1c'),_0x162f2d);logger[_0x2f7e('0x10')](_0x2f7e('0x1d'),JSON[_0x2f7e('0x13')](_0x162f2d[_0x2f7e('0x7')][_0x2f7e('0x9')]),_0x162f2d['body']['active']);logger[_0x2f7e('0x11')](_0x2f7e('0x1c'),_0x162f2d,JSON[_0x2f7e('0x13')](_0x2aa51b));_0x100418(_0x2aa51b);})[_0x2f7e('0x14')](function(_0x3d31e2){logger[_0x2f7e('0x15')](_0x2f7e('0x1c'),_0x3d31e2['message'],_0x162f2d);_0x13d08f(_0x328360[_0x2f7e('0x15')](0x1f4,_0x3d31e2[_0x2f7e('0x16')]));});});};exports[_0x2f7e('0x1e')]=function(_0x52b7fb){var _0x593787=this;return new Promise(function(_0x85c8d6,_0x2e7bfa){return db[_0x2f7e('0x6')]['destroy']({'where':_0x52b7fb['options']?_0x52b7fb[_0x2f7e('0x7')][_0x2f7e('0x9')]||null:null})[_0x2f7e('0xf')](function(_0x5725f6){logger[_0x2f7e('0x10')](_0x2f7e('0x1e'),_0x52b7fb);logger['debug'](_0x2f7e('0x1e'),_0x52b7fb,JSON[_0x2f7e('0x13')](_0x5725f6));_0x85c8d6(_0x5725f6);})['catch'](function(_0x5aaf40){logger[_0x2f7e('0x15')](_0x2f7e('0x1e'),_0x5aaf40['message'],_0x52b7fb);_0x2e7bfa(_0x593787[_0x2f7e('0x15')](0x1f4,_0x5aaf40['message']));});});};exports['GetContactDialer']=function(_0x476291){var _0xabe0e8=this;return new Promise(function(_0x1a6bd3,_0x5207ff){return db['CmContact'][_0x2f7e('0x1f')]()[_0x2f7e('0xf')](function(_0x10b610){return db[_0x2f7e('0x20')][_0x2f7e('0x21')](function(_0x336db3){return db[_0x2f7e('0x6')]['findAll']({'where':_0x476291[_0x2f7e('0x7')]?_0x476291['options'][_0x2f7e('0x9')]||null:null,'attributes':_0x476291[_0x2f7e('0x7')]?_0x476291[_0x2f7e('0x7')][_0x2f7e('0xa')]||null:null,'limit':_0x476291[_0x2f7e('0x7')]?_0x476291[_0x2f7e('0x7')]['limit']||null:null,'order':_0x476291[_0x2f7e('0x7')]?_0x476291[_0x2f7e('0x7')][_0x2f7e('0x22')]||null:null,'transaction':_0x336db3,'lock':_0x336db3[_0x2f7e('0x23')][_0x2f7e('0x24')],'include':[{'model':db[_0x2f7e('0x25')],'as':_0x2f7e('0x26'),'attributes':_['keys'](_0x10b610)},{'model':db[_0x2f7e('0x27')],'as':_0x2f7e('0x28'),'attributes':['id',_0x2f7e('0x29'),_0x2f7e('0x2a')]}]})['then'](function(_0x58b005){var _0x1b98b3=[];var _0x162b7d=[];for(var _0x4368db=0x0;_0x4368db<_0x58b005['length'];_0x4368db+=0x1){var _0x103624=_0x58b005[_0x4368db][_0x2f7e('0x2b')];if(_0x103624===null){_0x1b98b3[_0x2f7e('0x2c')](_0x58b005[_0x4368db][_0x2f7e('0x2d')](_0x476291[_0x2f7e('0x1b')],{'transaction':_0x336db3}));}else if(!_0x162b7d[_0x2f7e('0x2e')](_0x103624)){_0x162b7d[_0x2f7e('0x2c')](_0x103624);_0x1b98b3[_0x2f7e('0x2c')](_0x58b005[_0x4368db][_0x2f7e('0x2d')](_0x476291[_0x2f7e('0x1b')],{'transaction':_0x336db3}));}}return BPromise[_0x2f7e('0x2f')](_0x1b98b3);});})[_0x2f7e('0xf')](function(_0x159f1d){logger[_0x2f7e('0x10')]('GetContactDialer',_0x476291);if(_0x159f1d['length']>0x0){logger[_0x2f7e('0x10')](_0x2f7e('0x30'),_0x159f1d[0x0][_0x2f7e('0x31')]['id'],_0x159f1d[0x0][_0x2f7e('0x31')][_0x2f7e('0x32')],_0x159f1d[0x0]['dataValues'][_0x2f7e('0x33')]);}logger[_0x2f7e('0x11')](_0x2f7e('0x34'),_0x476291,JSON[_0x2f7e('0x13')](_0x159f1d));_0x1a6bd3(_0x159f1d);})['catch'](function(_0x4550aa){logger[_0x2f7e('0x15')](_0x2f7e('0x34'),_0x4550aa['message'],_0x476291);_0x5207ff(_0xabe0e8['error'](0x1f4,_0x4550aa[_0x2f7e('0x16')]));});});});};exports['MoveContactManagedDialer']=function(_0x50d793){var _0x3d53b2=this;return new Promise(function(_0x4d9517,_0x25ff54){return db[_0x2f7e('0x20')][_0x2f7e('0x21')](function(_0x58d7a2){return db['CmHopperFinal'][_0x2f7e('0x1a')](_0x50d793['body'],{'raw':_0x50d793[_0x2f7e('0x7')]?_0x50d793[_0x2f7e('0x7')][_0x2f7e('0x8')]===undefined?!![]:![]:!![],'transaction':_0x58d7a2})[_0x2f7e('0xf')](function(){logger[_0x2f7e('0x10')](_0x2f7e('0x35'),JSON[_0x2f7e('0x13')](_0x50d793[_0x2f7e('0x7')]['where']),_0x50d793[_0x2f7e('0x7')][_0x2f7e('0x9')][_0x2f7e('0x33')]);return db[_0x2f7e('0x6')]['destroy']({'where':_0x50d793['options']?_0x50d793[_0x2f7e('0x7')][_0x2f7e('0x9')]||null:null,'transaction':_0x58d7a2});});})[_0x2f7e('0xf')](function(_0x51e024){logger[_0x2f7e('0x10')](_0x2f7e('0x36'),_0x50d793);logger[_0x2f7e('0x11')](_0x2f7e('0x36'),_0x50d793,JSON[_0x2f7e('0x13')](_0x51e024));_0x4d9517(_0x51e024);})[_0x2f7e('0x14')](function(_0x14cc3b){logger[_0x2f7e('0x15')](_0x2f7e('0x36'),_0x14cc3b[_0x2f7e('0x16')],_0x50d793);_0x25ff54(_0x3d53b2[_0x2f7e('0x15')](0x1f4,_0x14cc3b['message']));});});};exports[_0x2f7e('0x37')]=function(_0x3c2151){var _0x1d37df=this;return new Promise(function(_0x2c295c,_0x353b1a){return db['CmHopper'][_0x2f7e('0x38')]({'raw':_0x3c2151[_0x2f7e('0x7')]?_0x3c2151[_0x2f7e('0x7')][_0x2f7e('0x8')]===undefined?!![]:![]:!![],'where':_0x3c2151[_0x2f7e('0x7')]?_0x3c2151[_0x2f7e('0x7')][_0x2f7e('0x9')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x2f7e('0x20')]['fn']('IF',db[_0x2f7e('0x20')][_0x2f7e('0x39')]('`scheduledat`\x20>=\x20'+util[_0x2f7e('0x3a')]('\x22%s\x22',moment()[_0x2f7e('0x3a')](_0x2f7e('0x3b')))+_0x2f7e('0x3c')))),_0x2f7e('0x3d')]]})['then'](function(_0x141cbd){logger[_0x2f7e('0x10')](_0x2f7e('0x37'),_0x3c2151);logger[_0x2f7e('0x11')](_0x2f7e('0x37'),_0x3c2151,JSON[_0x2f7e('0x13')](_0x141cbd));_0x2c295c(_0x141cbd);})[_0x2f7e('0x14')](function(_0x4fb684){logger[_0x2f7e('0x15')](_0x2f7e('0x37'),_0x4fb684[_0x2f7e('0x16')],_0x3c2151);_0x353b1a(_0x1d37df[_0x2f7e('0x15')](0x1f4,_0x4fb684[_0x2f7e('0x16')]));});});};exports[_0x2f7e('0x3e')]=function(_0x1b91d3){var _0x1402d3=this;return new Promise(function(_0xa30be9,_0x392f26){return db[_0x2f7e('0x25')][_0x2f7e('0x1f')]()[_0x2f7e('0xf')](function(){return db[_0x2f7e('0x20')]['transaction'](function(_0x491278){return db[_0x2f7e('0x6')][_0x2f7e('0x38')]({'where':_0x1b91d3['options']?_0x1b91d3['options'][_0x2f7e('0x9')]||null:null,'attributes':_0x1b91d3[_0x2f7e('0x7')]?_0x1b91d3[_0x2f7e('0x7')][_0x2f7e('0xa')]||null:null,'limit':0x1,'order':_0x1b91d3[_0x2f7e('0x7')]?_0x1b91d3[_0x2f7e('0x7')]['order']||null:null,'group':db[_0x2f7e('0x6')][_0x2f7e('0x2b')],'transaction':_0x491278,'lock':_0x491278['LOCK'][_0x2f7e('0x24')],'include':_0x1b91d3[_0x2f7e('0x7')]?_0x1b91d3['options'][_0x2f7e('0xc')]?_[_0x2f7e('0xd')](_0x1b91d3['options'][_0x2f7e('0xc')],function(_0x1647f2){return{'model':db[_0x1647f2[_0x2f7e('0xe')]],'as':_0x1647f2['as'],'attributes':_0x1647f2['attributes'],'include':_0x1647f2[_0x2f7e('0xc')]?_[_0x2f7e('0xd')](_0x1647f2[_0x2f7e('0xc')],function(_0x426b01){return{'model':db[_0x426b01[_0x2f7e('0xe')]],'as':_0x426b01['as'],'attributes':_0x426b01[_0x2f7e('0xa')],'include':_0x426b01[_0x2f7e('0xc')]?_[_0x2f7e('0xd')](_0x426b01[_0x2f7e('0xc')],function(_0x42884b){return{'model':db[_0x42884b[_0x2f7e('0xe')]],'as':_0x42884b['as'],'attributes':_0x42884b[_0x2f7e('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x977d94){var _0x10e38b=[];for(var _0x45c464=0x0;_0x45c464<_0x977d94[_0x2f7e('0x3f')];_0x45c464+=0x1){_0x10e38b[_0x2f7e('0x2c')](_0x977d94[_0x45c464][_0x2f7e('0x2d')](_0x1b91d3['body'],{'transaction':_0x491278}));}return BPromise[_0x2f7e('0x2f')](_0x10e38b);});})['then'](function(_0x33136c){logger[_0x2f7e('0x10')](_0x2f7e('0x3e'),_0x1b91d3);logger[_0x2f7e('0x11')](_0x2f7e('0x3e'),_0x1b91d3,JSON['stringify'](_0x33136c));_0xa30be9(_0x33136c);})[_0x2f7e('0x14')](function(_0x36a75b){logger[_0x2f7e('0x15')](_0x2f7e('0x3e'),_0x36a75b[_0x2f7e('0x16')],_0x1b91d3);_0x392f26(_0x1402d3[_0x2f7e('0x15')](0x1f4,_0x36a75b[_0x2f7e('0x16')]));});});});};exports[_0x2f7e('0x40')]=function(_0x2897e3){var _0x673a63=this;return new Promise(function(_0x371b0f,_0x2422fa){db['CmContact'][_0x2f7e('0x1f')]()[_0x2f7e('0xf')](function(_0x41fabb){return db[_0x2f7e('0x6')][_0x2f7e('0x38')]({'raw':_0x2897e3['options']?_0x2897e3[_0x2f7e('0x7')][_0x2f7e('0x8')]===undefined?!![]:![]:!![],'where':_0x2897e3[_0x2f7e('0x7')]?_0x2897e3['options'][_0x2f7e('0x9')]||null:null,'attributes':_0x2897e3[_0x2f7e('0x7')]?_0x2897e3['options']['attributes']||null:null,'limit':_0x2897e3[_0x2f7e('0x7')]?_0x2897e3[_0x2f7e('0x7')][_0x2f7e('0xb')]||null:null,'include':_0x2897e3[_0x2f7e('0x7')]?_0x2897e3['options']['include']?_['map'](_0x2897e3[_0x2f7e('0x7')][_0x2f7e('0xc')],function(_0x1e72c5){return{'model':db[_0x1e72c5[_0x2f7e('0xe')]],'as':_0x1e72c5['as'],'attributes':_0x1e72c5['as']===_0x2f7e('0x26')?_[_0x2f7e('0x41')](_0x41fabb):_0x1e72c5[_0x2f7e('0xa')],'include':_0x1e72c5[_0x2f7e('0xc')]?_[_0x2f7e('0xd')](_0x1e72c5[_0x2f7e('0xc')],function(_0x4343ba){return{'model':db[_0x4343ba[_0x2f7e('0xe')]],'as':_0x4343ba['as'],'attributes':_0x4343ba['attributes'],'include':_0x4343ba[_0x2f7e('0xc')]?_['map'](_0x4343ba[_0x2f7e('0xc')],function(_0x47430d){return{'model':db[_0x47430d[_0x2f7e('0xe')]],'as':_0x47430d['as'],'attributes':_0x47430d[_0x2f7e('0xa')]};}):[]};}):[]};}):[]:[]})[_0x2f7e('0xf')](function(_0x6452b9){logger['info'](_0x2f7e('0x12'),_0x2897e3);logger[_0x2f7e('0x11')](_0x2f7e('0x12'),_0x2897e3,JSON[_0x2f7e('0x13')](_0x6452b9));_0x371b0f(_0x6452b9);})['catch'](function(_0x11dea1){logger[_0x2f7e('0x15')](_0x2f7e('0x12'),_0x11dea1['message'],_0x2897e3);_0x2422fa(_0x673a63[_0x2f7e('0x15')](0x1f4,_0x11dea1[_0x2f7e('0x16')]));});});});};exports[_0x2f7e('0x42')]=function(_0x19eb65){var _0x26714b=this;return new Promise(function(_0x223e87,_0x386b5e){return db[_0x2f7e('0x25')]['findOne']({'raw':!![],'where':{'phone':_0x19eb65[_0x2f7e('0x7')]['where'][_0x2f7e('0x43')]},'attributes':['id','dialTimezone'],'order':[['id','DESC']]})[_0x2f7e('0xf')](function(_0x294f0f){logger['info'](_0x2f7e('0x44'),_0x19eb65);logger[_0x2f7e('0x11')](_0x2f7e('0x44'),_0x19eb65,JSON[_0x2f7e('0x13')](_0x294f0f));_0x223e87(_0x294f0f);})['catch'](function(_0x12c997){logger[_0x2f7e('0x15')]('getContactByPhone',_0x12c997[_0x2f7e('0x16')],_0x19eb65);_0x386b5e(_0x26714b[_0x2f7e('0x15')](0x1f4,_0x12c997[_0x2f7e('0x16')]));});});};exports['ResetActiveCalls']=function(_0x3d356b){var _0x57c735=this;return new Promise(function(_0x1f3eec,_0x452115){return db[_0x2f7e('0x20')][_0x2f7e('0x21')](function(_0x192334){var _0x1dabef=_0x3d356b[_0x2f7e('0x7')]&&_0x3d356b['options']['where']?_0x3d356b[_0x2f7e('0x7')][_0x2f7e('0x9')]:{};return db[_0x2f7e('0x6')][_0x2f7e('0x2d')](_0x3d356b[_0x2f7e('0x1b')],{'where':_0x1dabef,'transaction':_0x192334})[_0x2f7e('0xf')](function(_0x347516){logger[_0x2f7e('0x10')](_0x2f7e('0x45'),_0x3d356b);logger[_0x2f7e('0x11')]('ResetActiveCalls',_0x3d356b,JSON[_0x2f7e('0x13')](_0x347516));_0x1f3eec(_0x347516);})['catch'](function(_0x5e8cd8){logger[_0x2f7e('0x15')](_0x2f7e('0x45'),_0x5e8cd8[_0x2f7e('0x16')],_0x3d356b);_0x452115(_0x57c735[_0x2f7e('0x15')](0x1f4,_0x5e8cd8[_0x2f7e('0x16')]));});});});};exports[_0x2f7e('0x46')]=function(_0x15f592){var _0x387fb4=this;var _0x4f0326=_0x15f592['body'][_0x2f7e('0x9')][_0x2f7e('0x47')];var _0x2b03ab=_0x15f592[_0x2f7e('0x1b')]['where'][_0x2f7e('0x48')];var _0x356f6c=_0x15f592[_0x2f7e('0x1b')][_0x2f7e('0x9')][_0x2f7e('0x49')];return new Promise(function(_0x47963d,_0x39ef1c){return db['CmHopper'][_0x2f7e('0x38')]({'where':{'voiceQueueId':{'$in':_0x4f0326},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x2f7e('0x20')]['literal'](_0x2f7e('0x4a')+_0x2b03ab+'\x20MINUTE'),'$gt':db['sequelize']['literal'](_0x2f7e('0x4b'))}},'UserId':{'$in':_0x356f6c}},'include':[{'model':db[_0x2f7e('0x25')],'as':_0x2f7e('0x26')},{'model':db[_0x2f7e('0x27')],'as':_0x2f7e('0x28'),'attributes':['id',_0x2f7e('0x29'),_0x2f7e('0x2a')]},{'model':db[_0x2f7e('0x4c')],'as':'List'}]})[_0x2f7e('0xf')](function(_0x4f58ec){if(_0x4f58ec['length']>0x0){return db[_0x2f7e('0x20')][_0x2f7e('0x21')](function(_0x381c5b){return db['CmHopper']['update']({'recallmeNotifiedDate':db['sequelize'][_0x2f7e('0x39')]('NOW()')},{'where':{'id':{'$in':_[_0x2f7e('0xd')](_0x4f58ec,'id')}},'transaction':_0x381c5b})[_0x2f7e('0xf')](function(){_0x47963d(_0x4f58ec);})[_0x2f7e('0x14')](function(_0x4a3b00){logger[_0x2f7e('0x15')](_0x2f7e('0x46'),_0x4a3b00[_0x2f7e('0x16')],_0x15f592);_0x39ef1c(_0x387fb4[_0x2f7e('0x15')](0x1f4,_0x4a3b00['message']));});})[_0x2f7e('0x14')](function(_0x7a4a46){logger[_0x2f7e('0x15')](_0x2f7e('0x46'),_0x7a4a46[_0x2f7e('0x16')],_0x15f592);_0x39ef1c(_0x387fb4[_0x2f7e('0x15')](0x1f4,_0x7a4a46[_0x2f7e('0x16')]));});}else{_0x47963d(_0x4f58ec);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index a33cdee..4d24506 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 _0x7755=['post','create','getPreview','/timezone','put','update','delete','destroy','exports','express','Router','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','getOpenContacts','/timezones','getTimezones','/:id','show','/:id/previewrecall','getPreviewRecall'];(function(_0x5d672b,_0x28f0e4){var _0x3268fc=function(_0x47aa90){while(--_0x47aa90){_0x5d672b['push'](_0x5d672b['shift']());}};_0x3268fc(++_0x28f0e4);}(_0x7755,0x141));var _0x5775=function(_0x111bd0,_0x34bf7b){_0x111bd0=_0x111bd0-0x0;var _0x30edfa=_0x7755[_0x111bd0];return _0x30edfa;};'use strict';var express=require(_0x5775('0x0'));var router=express[_0x5775('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x5775('0x2'));router[_0x5775('0x3')]('/',auth[_0x5775('0x4')](),controller[_0x5775('0x5')]);router[_0x5775('0x3')](_0x5775('0x6'),auth[_0x5775('0x4')](),controller[_0x5775('0x7')]);router[_0x5775('0x3')]('/opencontacts',auth[_0x5775('0x4')](),controller[_0x5775('0x8')]);router[_0x5775('0x3')](_0x5775('0x9'),auth[_0x5775('0x4')](),controller[_0x5775('0xa')]);router[_0x5775('0x3')](_0x5775('0xb'),auth[_0x5775('0x4')](),controller[_0x5775('0xc')]);router[_0x5775('0x3')](_0x5775('0xd'),auth[_0x5775('0x4')](),controller[_0x5775('0xe')]);router[_0x5775('0xf')]('/',auth['isAuthenticated'](),controller[_0x5775('0x10')]);router[_0x5775('0xf')]('/preview',auth[_0x5775('0x4')](),controller[_0x5775('0x11')]);router[_0x5775('0xf')](_0x5775('0x12'),auth[_0x5775('0x4')](),controller['getTimezone']);router[_0x5775('0x13')]('/:id',auth[_0x5775('0x4')](),controller[_0x5775('0x14')]);router[_0x5775('0x15')](_0x5775('0xb'),auth[_0x5775('0x4')](),controller[_0x5775('0x16')]);module[_0x5775('0x17')]=router; \ No newline at end of file +var _0x6ea2=['isAuthenticated','index','/describe','describe','/timezones','getTimezones','/:id','show','/:id/previewrecall','getPreviewRecall','post','/preview','getTimezone','put','update','exports','../../components/auth/service','./cmHopper.controller','get'];(function(_0x3b79e8,_0x1b6fb4){var _0x5d54a1=function(_0x3db874){while(--_0x3db874){_0x3b79e8['push'](_0x3b79e8['shift']());}};_0x5d54a1(++_0x1b6fb4);}(_0x6ea2,0x12d));var _0x26ea=function(_0x38885a,_0x2ff367){_0x38885a=_0x38885a-0x0;var _0x4923a9=_0x6ea2[_0x38885a];return _0x4923a9;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x26ea('0x0'));var controller=require(_0x26ea('0x1'));router[_0x26ea('0x2')]('/',auth[_0x26ea('0x3')](),controller[_0x26ea('0x4')]);router['get'](_0x26ea('0x5'),auth['isAuthenticated'](),controller[_0x26ea('0x6')]);router[_0x26ea('0x2')]('/opencontacts',auth['isAuthenticated'](),controller['getOpenContacts']);router[_0x26ea('0x2')](_0x26ea('0x7'),auth['isAuthenticated'](),controller[_0x26ea('0x8')]);router[_0x26ea('0x2')](_0x26ea('0x9'),auth[_0x26ea('0x3')](),controller[_0x26ea('0xa')]);router[_0x26ea('0x2')](_0x26ea('0xb'),auth['isAuthenticated'](),controller[_0x26ea('0xc')]);router[_0x26ea('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x26ea('0xe'),auth[_0x26ea('0x3')](),controller['getPreview']);router[_0x26ea('0xd')]('/timezone',auth[_0x26ea('0x3')](),controller[_0x26ea('0xf')]);router[_0x26ea('0x10')](_0x26ea('0x9'),auth[_0x26ea('0x3')](),controller[_0x26ea('0x11')]);router['delete']('/:id',auth[_0x26ea('0x3')](),controller['destroy']);module[_0x26ea('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 224e90d..60f1c36 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 _0x82a0=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','exports','INTEGER'];(function(_0x4a9beb,_0x159482){var _0x2d4c58=function(_0x28dabf){while(--_0x28dabf){_0x4a9beb['push'](_0x4a9beb['shift']());}};_0x2d4c58(++_0x159482);}(_0x82a0,0xf9));var _0x082a=function(_0x15a8fa,_0x4652b2){_0x15a8fa=_0x15a8fa-0x0;var _0x1355c2=_0x82a0[_0x15a8fa];return _0x1355c2;};'use strict';var moment=require(_0x082a('0x0'));var Sequelize=require('sequelize');module[_0x082a('0x1')]={'CmHopperId':{'type':Sequelize[_0x082a('0x2')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x082a('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x082a('0x3')],'defaultValue':moment()[_0x082a('0x4')](_0x082a('0x5'))},'countbusyretry':{'type':Sequelize[_0x082a('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x082a('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x082a('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x082a('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x082a('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x082a('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x082a('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x082a('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdd38=['YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports','INTEGER','STRING','DATE','format'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xdd38,0x161));var _0x8dd3=function(_0x588820,_0x4daf15){_0x588820=_0x588820-0x0;var _0x4d7d77=_0xdd38[_0x588820];return _0x4d7d77;};'use strict';var moment=require(_0x8dd3('0x0'));var Sequelize=require(_0x8dd3('0x1'));module[_0x8dd3('0x2')]={'CmHopperId':{'type':Sequelize[_0x8dd3('0x3')]},'phone':{'type':Sequelize[_0x8dd3('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x8dd3('0x5')],'defaultValue':moment()[_0x8dd3('0x6')](_0x8dd3('0x7'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8dd3('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x8dd3('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8dd3('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'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 7e4bf38..e012517 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 _0xbf48=['UserProfileSection','userProfileId','autoAssociation','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','apply','save','update','then','destroy','CmHopperAdditionalPhones','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','merge','VIRTUAL','filter','options','CmHopperAdditionalPhone','includeAll','include','findAll','rows','catch','show','params','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x1f7ea1,_0x3e128a){var _0x2e618f=function(_0x20d7fc){while(--_0x20d7fc){_0x1f7ea1['push'](_0x1f7ea1['shift']());}};_0x2e618f(++_0x3e128a);}(_0xbf48,0x1cb));var _0x8bf4=function(_0x531da9,_0x14ba36){_0x531da9=_0x531da9-0x0;var _0x1c0352=_0xbf48[_0x531da9];return _0x1c0352;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8bf4('0x0'));var zipdir=require(_0x8bf4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8bf4('0x2'));var moment=require(_0x8bf4('0x3'));var BPromise=require(_0x8bf4('0x4'));var Mustache=require(_0x8bf4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x8bf4('0x6'));var csv=require(_0x8bf4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8bf4('0x8'));var _=require('lodash');var squel=require(_0x8bf4('0x9'));var crypto=require(_0x8bf4('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x8bf4('0xb'));var toCsv=require(_0x8bf4('0x7'));var querystring=require(_0x8bf4('0xc'));var Papa=require('papaparse');var Redis=require(_0x8bf4('0xd'));var authService=require(_0x8bf4('0xe'));var qs=require(_0x8bf4('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8bf4('0x10'));var logger=require(_0x8bf4('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x8bf4('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33eff3,_0x5340c1){_0x5340c1=_0x5340c1||0xcc;return function(_0x1f6b45){if(_0x1f6b45){return _0x33eff3[_0x8bf4('0x13')](_0x5340c1);}return _0x33eff3[_0x8bf4('0x14')](_0x5340c1)['end']();};}function respondWithResult(_0x17ea6d,_0x382fea){_0x382fea=_0x382fea||0xc8;return function(_0x1a0b0b){if(_0x1a0b0b){return _0x17ea6d[_0x8bf4('0x14')](_0x382fea)[_0x8bf4('0x15')](_0x1a0b0b);}};}function respondWithFilteredResult(_0x2b78a4,_0x44f3af){return function(_0x580f15){if(_0x580f15){var _0x5d63ed=typeof _0x44f3af[_0x8bf4('0x16')]===_0x8bf4('0x17')&&typeof _0x44f3af[_0x8bf4('0x18')]===_0x8bf4('0x17');var _0x235e0e=_0x580f15[_0x8bf4('0x19')];var _0x4402cc=_0x5d63ed?0x0:_0x44f3af[_0x8bf4('0x16')];var _0x2635c1=_0x5d63ed?_0x580f15[_0x8bf4('0x19')]:_0x44f3af[_0x8bf4('0x16')]+_0x44f3af['limit'];var _0x2f5b25;if(_0x2635c1>=_0x235e0e){_0x2635c1=_0x235e0e;_0x2f5b25=0xc8;}else{_0x2f5b25=0xce;}_0x2b78a4[_0x8bf4('0x14')](_0x2f5b25);return _0x2b78a4['set']('Content-Range',_0x4402cc+'-'+_0x2635c1+'/'+_0x235e0e)[_0x8bf4('0x15')](_0x580f15);}return null;};}function patchUpdates(_0xee9327){return function(_0x1259e0){try{jsonpatch[_0x8bf4('0x1a')](_0x1259e0,_0xee9327,!![]);}catch(_0x5e90b2){return BPromise['reject'](_0x5e90b2);}return _0x1259e0[_0x8bf4('0x1b')]();};}function saveUpdates(_0x4cab77,_0x35fb66){return function(_0x3376ae){if(_0x3376ae){return _0x3376ae[_0x8bf4('0x1c')](_0x4cab77)[_0x8bf4('0x1d')](function(_0x864b03){return _0x864b03;});}return null;};}function removeEntity(_0x1e7d78,_0x532bf7){return function(_0x5490ed){if(_0x5490ed){return _0x5490ed[_0x8bf4('0x1e')]()[_0x8bf4('0x1d')](function(){var _0x4f9e5f=_0x5490ed['get']({'plain':!![]});var _0x3fb291=_0x8bf4('0x1f');return db[_0x8bf4('0x20')][_0x8bf4('0x1e')]({'where':{'type':_0x3fb291,'resourceId':_0x4f9e5f['id']}})[_0x8bf4('0x1d')](function(){return _0x5490ed;});})['then'](function(){_0x1e7d78[_0x8bf4('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f111c,_0x121037){return function(_0x50bc8e){if(!_0x50bc8e){_0x1f111c[_0x8bf4('0x13')](0x194);}return _0x50bc8e;};}function handleError(_0x302333,_0x55c5b4){_0x55c5b4=_0x55c5b4||0x1f4;return function(_0x252815){logger[_0x8bf4('0x21')](_0x252815[_0x8bf4('0x22')]);if(_0x252815[_0x8bf4('0x23')]){delete _0x252815['name'];}_0x302333['status'](_0x55c5b4)[_0x8bf4('0x24')](_0x252815);};}exports[_0x8bf4('0x25')]=function(_0x4e09ac,_0xbf5602){var _0x36e1ce={},_0x2eb7da={},_0x355fb3={'count':0x0,'rows':[]};var _0x156add=_['map'](db['CmHopperAdditionalPhone'][_0x8bf4('0x26')],function(_0x1163cb){return{'name':_0x1163cb[_0x8bf4('0x27')],'type':_0x1163cb[_0x8bf4('0x28')][_0x8bf4('0x29')]};});_0x2eb7da[_0x8bf4('0x2a')]=_[_0x8bf4('0x2b')](_0x156add,'name');_0x2eb7da[_0x8bf4('0x2c')]=_[_0x8bf4('0x2d')](_0x4e09ac[_0x8bf4('0x2c')]);_0x2eb7da[_0x8bf4('0x2e')]=_[_0x8bf4('0x2f')](_0x2eb7da['model'],_0x2eb7da[_0x8bf4('0x2c')]);_0x36e1ce[_0x8bf4('0x30')]=_['intersection'](_0x2eb7da['model'],qs[_0x8bf4('0x31')](_0x4e09ac['query']['fields']));_0x36e1ce[_0x8bf4('0x30')]=_0x36e1ce[_0x8bf4('0x30')][_0x8bf4('0x32')]?_0x36e1ce['attributes']:_0x2eb7da[_0x8bf4('0x2a')];if(!_0x4e09ac['query'][_0x8bf4('0x33')](_0x8bf4('0x34'))){_0x36e1ce[_0x8bf4('0x18')]=qs[_0x8bf4('0x18')](_0x4e09ac[_0x8bf4('0x2c')][_0x8bf4('0x18')]);_0x36e1ce['offset']=qs[_0x8bf4('0x16')](_0x4e09ac[_0x8bf4('0x2c')][_0x8bf4('0x16')]);}_0x36e1ce['order']=qs['sort'](_0x4e09ac[_0x8bf4('0x2c')]['sort']);_0x36e1ce[_0x8bf4('0x35')]=qs[_0x8bf4('0x2e')](_[_0x8bf4('0x36')](_0x4e09ac[_0x8bf4('0x2c')],_0x2eb7da['filters']),_0x156add);if(_0x4e09ac[_0x8bf4('0x2c')]['filter']){_0x36e1ce['where']=_[_0x8bf4('0x37')](_0x36e1ce['where'],{'$or':_[_0x8bf4('0x2b')](_0x156add,function(_0x58e803){if(_0x58e803[_0x8bf4('0x28')]!==_0x8bf4('0x38')){var _0x37ed24={};_0x37ed24[_0x58e803[_0x8bf4('0x23')]]={'$like':'%'+_0x4e09ac[_0x8bf4('0x2c')][_0x8bf4('0x39')]+'%'};return _0x37ed24;}})});}_0x36e1ce=_['merge']({},_0x36e1ce,_0x4e09ac[_0x8bf4('0x3a')]);var _0x50bf7a={'where':_0x36e1ce['where']};return db[_0x8bf4('0x3b')][_0x8bf4('0x19')](_0x50bf7a)[_0x8bf4('0x1d')](function(_0x149d29){_0x355fb3['count']=_0x149d29;if(_0x4e09ac[_0x8bf4('0x2c')][_0x8bf4('0x3c')]){_0x36e1ce[_0x8bf4('0x3d')]=[{'all':!![]}];}return db[_0x8bf4('0x3b')][_0x8bf4('0x3e')](_0x36e1ce);})[_0x8bf4('0x1d')](function(_0x1081a6){_0x355fb3[_0x8bf4('0x3f')]=_0x1081a6;return _0x355fb3;})[_0x8bf4('0x1d')](respondWithFilteredResult(_0xbf5602,_0x36e1ce))[_0x8bf4('0x40')](handleError(_0xbf5602,null));};exports[_0x8bf4('0x41')]=function(_0x1fa29c,_0x5a62b2){var _0x44a299={'raw':!![],'where':{'id':_0x1fa29c[_0x8bf4('0x42')]['id']}},_0x54a1a3={};_0x54a1a3[_0x8bf4('0x2a')]=_[_0x8bf4('0x2d')](db[_0x8bf4('0x3b')][_0x8bf4('0x26')]);_0x54a1a3[_0x8bf4('0x2c')]=_[_0x8bf4('0x2d')](_0x1fa29c['query']);_0x54a1a3[_0x8bf4('0x2e')]=_['intersection'](_0x54a1a3[_0x8bf4('0x2a')],_0x54a1a3[_0x8bf4('0x2c')]);_0x44a299['attributes']=_[_0x8bf4('0x2f')](_0x54a1a3[_0x8bf4('0x2a')],qs[_0x8bf4('0x31')](_0x1fa29c['query'][_0x8bf4('0x31')]));_0x44a299[_0x8bf4('0x30')]=_0x44a299[_0x8bf4('0x30')][_0x8bf4('0x32')]?_0x44a299['attributes']:_0x54a1a3[_0x8bf4('0x2a')];if(_0x1fa29c[_0x8bf4('0x2c')][_0x8bf4('0x3c')]){_0x44a299[_0x8bf4('0x3d')]=[{'all':!![]}];}_0x44a299=_[_0x8bf4('0x37')]({},_0x44a299,_0x1fa29c[_0x8bf4('0x3a')]);return db[_0x8bf4('0x3b')][_0x8bf4('0x43')](_0x44a299)['then'](handleEntityNotFound(_0x5a62b2,null))['then'](respondWithResult(_0x5a62b2,null))[_0x8bf4('0x40')](handleError(_0x5a62b2,null));};exports[_0x8bf4('0x44')]=function(_0x3fe96f,_0x1505b7){return db[_0x8bf4('0x3b')][_0x8bf4('0x44')](_0x3fe96f[_0x8bf4('0x45')],{})[_0x8bf4('0x1d')](function(_0x4687b6){var _0x19e0b8=_0x3fe96f['user'][_0x8bf4('0x46')]({'plain':!![]});if(!_0x19e0b8)throw new Error(_0x8bf4('0x47'));if(_0x19e0b8[_0x8bf4('0x48')]==='user'){var _0x1d3c08=_0x4687b6[_0x8bf4('0x46')]({'plain':!![]});var _0x589cd4='CmHopperAdditionalPhones';return db[_0x8bf4('0x49')][_0x8bf4('0x43')]({'where':{'name':_0x589cd4,'userProfileId':_0x19e0b8[_0x8bf4('0x4a')]},'raw':!![]})[_0x8bf4('0x1d')](function(_0x135b4b){if(_0x135b4b&&_0x135b4b[_0x8bf4('0x4b')]===0x0){return db[_0x8bf4('0x20')][_0x8bf4('0x44')]({'name':_0x1d3c08['name'],'resourceId':_0x1d3c08['id'],'type':_0x135b4b[_0x8bf4('0x23')],'sectionId':_0x135b4b['id']},{})[_0x8bf4('0x1d')](function(){return _0x4687b6;});}else{return _0x4687b6;}})[_0x8bf4('0x40')](function(_0x50c02b){logger[_0x8bf4('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50c02b);throw _0x50c02b;});}return _0x4687b6;})[_0x8bf4('0x1d')](respondWithResult(_0x1505b7,0xc9))['catch'](handleError(_0x1505b7,null));};exports[_0x8bf4('0x1c')]=function(_0x466229,_0x146d09){if(_0x466229[_0x8bf4('0x45')]['id']){delete _0x466229[_0x8bf4('0x45')]['id'];}return db[_0x8bf4('0x3b')][_0x8bf4('0x43')]({'where':{'id':_0x466229[_0x8bf4('0x42')]['id']}})[_0x8bf4('0x1d')](handleEntityNotFound(_0x146d09,null))['then'](saveUpdates(_0x466229[_0x8bf4('0x45')],null))[_0x8bf4('0x1d')](respondWithResult(_0x146d09,null))[_0x8bf4('0x40')](handleError(_0x146d09,null));};exports[_0x8bf4('0x1e')]=function(_0x23c044,_0x19f53c){return db[_0x8bf4('0x3b')]['find']({'where':{'id':_0x23c044['params']['id']}})[_0x8bf4('0x1d')](handleEntityNotFound(_0x19f53c,null))[_0x8bf4('0x1d')](removeEntity(_0x19f53c,null))[_0x8bf4('0x40')](handleError(_0x19f53c,null));}; \ No newline at end of file +var _0x4d33=['../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','set','json','apply','update','then','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','hasOwnProperty','nolimit','sort','filter','where','VIRTUAL','merge','includeAll','include','findAll','rows','catch','params','intersection','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmHopperAdditionalPhones','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x281c91,_0xbb1fc5){var _0x1f5e83=function(_0x4239a5){while(--_0x4239a5){_0x281c91['push'](_0x281c91['shift']());}};_0x1f5e83(++_0xbb1fc5);}(_0x4d33,0x1da));var _0x34d3=function(_0x2351c4,_0x1dca54){_0x2351c4=_0x2351c4-0x0;var _0x1dd3f8=_0x4d33[_0x2351c4];return _0x1dd3f8;};'use strict';var emlformat=require(_0x34d3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x34d3('0x1'));var jsonpatch=require(_0x34d3('0x2'));var rp=require(_0x34d3('0x3'));var moment=require(_0x34d3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x34d3('0x5'));var util=require(_0x34d3('0x6'));var path=require(_0x34d3('0x7'));var sox=require('sox');var csv=require(_0x34d3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x34d3('0x9'));var squel=require(_0x34d3('0xa'));var crypto=require(_0x34d3('0xb'));var jsforce=require(_0x34d3('0xc'));var deskjs=require(_0x34d3('0xd'));var toCsv=require(_0x34d3('0x8'));var querystring=require(_0x34d3('0xe'));var Papa=require(_0x34d3('0xf'));var Redis=require('ioredis');var authService=require(_0x34d3('0x10'));var qs=require(_0x34d3('0x11'));var as=require(_0x34d3('0x12'));var hardwareService=require(_0x34d3('0x13'));var logger=require(_0x34d3('0x14'))(_0x34d3('0x15'));var utils=require(_0x34d3('0x16'));var config=require(_0x34d3('0x17'));var licenseUtil=require(_0x34d3('0x18'));var db=require(_0x34d3('0x19'))['db'];function respondWithStatusCode(_0x4df862,_0x5e1cd2){_0x5e1cd2=_0x5e1cd2||0xcc;return function(_0x349976){if(_0x349976){return _0x4df862['sendStatus'](_0x5e1cd2);}return _0x4df862['status'](_0x5e1cd2)[_0x34d3('0x1a')]();};}function respondWithResult(_0x146de0,_0x585416){_0x585416=_0x585416||0xc8;return function(_0x46fc6f){if(_0x46fc6f){return _0x146de0[_0x34d3('0x1b')](_0x585416)['json'](_0x46fc6f);}};}function respondWithFilteredResult(_0xebc80e,_0x1eddc9){return function(_0x26792e){if(_0x26792e){var _0x53069b=typeof _0x1eddc9[_0x34d3('0x1c')]===_0x34d3('0x1d')&&typeof _0x1eddc9[_0x34d3('0x1e')]==='undefined';var _0xc88cfc=_0x26792e[_0x34d3('0x1f')];var _0x35805f=_0x53069b?0x0:_0x1eddc9[_0x34d3('0x1c')];var _0xbc3b08=_0x53069b?_0x26792e['count']:_0x1eddc9[_0x34d3('0x1c')]+_0x1eddc9[_0x34d3('0x1e')];var _0x131e3b;if(_0xbc3b08>=_0xc88cfc){_0xbc3b08=_0xc88cfc;_0x131e3b=0xc8;}else{_0x131e3b=0xce;}_0xebc80e['status'](_0x131e3b);return _0xebc80e[_0x34d3('0x20')]('Content-Range',_0x35805f+'-'+_0xbc3b08+'/'+_0xc88cfc)[_0x34d3('0x21')](_0x26792e);}return null;};}function patchUpdates(_0x37bd5d){return function(_0x2e6cf4){try{jsonpatch[_0x34d3('0x22')](_0x2e6cf4,_0x37bd5d,!![]);}catch(_0x2f2e15){return BPromise['reject'](_0x2f2e15);}return _0x2e6cf4['save']();};}function saveUpdates(_0x4f8f15,_0x25d624){return function(_0x2a63a6){if(_0x2a63a6){return _0x2a63a6[_0x34d3('0x23')](_0x4f8f15)['then'](function(_0x2c8c7){return _0x2c8c7;});}return null;};}function removeEntity(_0xf15fb3,_0x56cbf7){return function(_0x5e7456){if(_0x5e7456){return _0x5e7456['destroy']()[_0x34d3('0x24')](function(){var _0x238266=_0x5e7456['get']({'plain':!![]});var _0x3908fa='CmHopperAdditionalPhones';return db[_0x34d3('0x25')][_0x34d3('0x26')]({'where':{'type':_0x3908fa,'resourceId':_0x238266['id']}})[_0x34d3('0x24')](function(){return _0x5e7456;});})[_0x34d3('0x24')](function(){_0xf15fb3[_0x34d3('0x1b')](0xcc)[_0x34d3('0x1a')]();});}};}function handleEntityNotFound(_0x150b76,_0x4f0902){return function(_0x5a56d7){if(!_0x5a56d7){_0x150b76[_0x34d3('0x27')](0x194);}return _0x5a56d7;};}function handleError(_0x9ffa11,_0x47c5e2){_0x47c5e2=_0x47c5e2||0x1f4;return function(_0x4fc6c1){logger[_0x34d3('0x28')](_0x4fc6c1[_0x34d3('0x29')]);if(_0x4fc6c1[_0x34d3('0x2a')]){delete _0x4fc6c1[_0x34d3('0x2a')];}_0x9ffa11[_0x34d3('0x1b')](_0x47c5e2)[_0x34d3('0x2b')](_0x4fc6c1);};}exports[_0x34d3('0x2c')]=function(_0x454181,_0x5937c7){var _0x308715={},_0x50c9f5={},_0x4b2241={'count':0x0,'rows':[]};var _0x2f6523=_[_0x34d3('0x2d')](db[_0x34d3('0x2e')][_0x34d3('0x2f')],function(_0x1ca5cd){return{'name':_0x1ca5cd[_0x34d3('0x30')],'type':_0x1ca5cd[_0x34d3('0x31')][_0x34d3('0x32')]};});_0x50c9f5[_0x34d3('0x33')]=_['map'](_0x2f6523,_0x34d3('0x2a'));_0x50c9f5['query']=_[_0x34d3('0x34')](_0x454181[_0x34d3('0x35')]);_0x50c9f5[_0x34d3('0x36')]=_['intersection'](_0x50c9f5[_0x34d3('0x33')],_0x50c9f5[_0x34d3('0x35')]);_0x308715[_0x34d3('0x37')]=_['intersection'](_0x50c9f5[_0x34d3('0x33')],qs[_0x34d3('0x38')](_0x454181[_0x34d3('0x35')][_0x34d3('0x38')]));_0x308715[_0x34d3('0x37')]=_0x308715['attributes']['length']?_0x308715[_0x34d3('0x37')]:_0x50c9f5['model'];if(!_0x454181[_0x34d3('0x35')][_0x34d3('0x39')](_0x34d3('0x3a'))){_0x308715[_0x34d3('0x1e')]=qs[_0x34d3('0x1e')](_0x454181[_0x34d3('0x35')][_0x34d3('0x1e')]);_0x308715[_0x34d3('0x1c')]=qs['offset'](_0x454181[_0x34d3('0x35')][_0x34d3('0x1c')]);}_0x308715['order']=qs[_0x34d3('0x3b')](_0x454181['query'][_0x34d3('0x3b')]);_0x308715['where']=qs[_0x34d3('0x36')](_['pick'](_0x454181[_0x34d3('0x35')],_0x50c9f5[_0x34d3('0x36')]),_0x2f6523);if(_0x454181[_0x34d3('0x35')][_0x34d3('0x3c')]){_0x308715[_0x34d3('0x3d')]=_['merge'](_0x308715[_0x34d3('0x3d')],{'$or':_[_0x34d3('0x2d')](_0x2f6523,function(_0xdf0e5f){if(_0xdf0e5f[_0x34d3('0x31')]!==_0x34d3('0x3e')){var _0x50de88={};_0x50de88[_0xdf0e5f[_0x34d3('0x2a')]]={'$like':'%'+_0x454181['query']['filter']+'%'};return _0x50de88;}})});}_0x308715=_[_0x34d3('0x3f')]({},_0x308715,_0x454181['options']);var _0x54a712={'where':_0x308715['where']};return db[_0x34d3('0x2e')][_0x34d3('0x1f')](_0x54a712)[_0x34d3('0x24')](function(_0x228cfa){_0x4b2241[_0x34d3('0x1f')]=_0x228cfa;if(_0x454181['query'][_0x34d3('0x40')]){_0x308715[_0x34d3('0x41')]=[{'all':!![]}];}return db[_0x34d3('0x2e')][_0x34d3('0x42')](_0x308715);})[_0x34d3('0x24')](function(_0x29175b){_0x4b2241[_0x34d3('0x43')]=_0x29175b;return _0x4b2241;})[_0x34d3('0x24')](respondWithFilteredResult(_0x5937c7,_0x308715))[_0x34d3('0x44')](handleError(_0x5937c7,null));};exports['show']=function(_0x52e827,_0x2f2295){var _0x4f2d82={'raw':!![],'where':{'id':_0x52e827[_0x34d3('0x45')]['id']}},_0x275c4a={};_0x275c4a[_0x34d3('0x33')]=_[_0x34d3('0x34')](db[_0x34d3('0x2e')][_0x34d3('0x2f')]);_0x275c4a[_0x34d3('0x35')]=_['keys'](_0x52e827[_0x34d3('0x35')]);_0x275c4a[_0x34d3('0x36')]=_['intersection'](_0x275c4a[_0x34d3('0x33')],_0x275c4a['query']);_0x4f2d82['attributes']=_[_0x34d3('0x46')](_0x275c4a[_0x34d3('0x33')],qs[_0x34d3('0x38')](_0x52e827[_0x34d3('0x35')][_0x34d3('0x38')]));_0x4f2d82['attributes']=_0x4f2d82[_0x34d3('0x37')][_0x34d3('0x47')]?_0x4f2d82[_0x34d3('0x37')]:_0x275c4a['model'];if(_0x52e827[_0x34d3('0x35')]['includeAll']){_0x4f2d82[_0x34d3('0x41')]=[{'all':!![]}];}_0x4f2d82=_[_0x34d3('0x3f')]({},_0x4f2d82,_0x52e827[_0x34d3('0x48')]);return db['CmHopperAdditionalPhone'][_0x34d3('0x49')](_0x4f2d82)[_0x34d3('0x24')](handleEntityNotFound(_0x2f2295,null))[_0x34d3('0x24')](respondWithResult(_0x2f2295,null))[_0x34d3('0x44')](handleError(_0x2f2295,null));};exports[_0x34d3('0x4a')]=function(_0x1eda7a,_0x11ab68){return db[_0x34d3('0x2e')][_0x34d3('0x4a')](_0x1eda7a[_0x34d3('0x4b')],{})['then'](function(_0x9ee0ea){var _0x52bbb1=_0x1eda7a[_0x34d3('0x4c')]['get']({'plain':!![]});if(!_0x52bbb1)throw new Error(_0x34d3('0x4d'));if(_0x52bbb1[_0x34d3('0x4e')]===_0x34d3('0x4c')){var _0x5bd586=_0x9ee0ea['get']({'plain':!![]});var _0x267328=_0x34d3('0x4f');return db[_0x34d3('0x50')][_0x34d3('0x49')]({'where':{'name':_0x267328,'userProfileId':_0x52bbb1[_0x34d3('0x51')]},'raw':!![]})[_0x34d3('0x24')](function(_0x5a9b24){if(_0x5a9b24&&_0x5a9b24['autoAssociation']===0x0){return db[_0x34d3('0x25')][_0x34d3('0x4a')]({'name':_0x5bd586[_0x34d3('0x2a')],'resourceId':_0x5bd586['id'],'type':_0x5a9b24[_0x34d3('0x2a')],'sectionId':_0x5a9b24['id']},{})[_0x34d3('0x24')](function(){return _0x9ee0ea;});}else{return _0x9ee0ea;}})['catch'](function(_0x36b5ce){logger[_0x34d3('0x28')](_0x34d3('0x52'),_0x36b5ce);throw _0x36b5ce;});}return _0x9ee0ea;})[_0x34d3('0x24')](respondWithResult(_0x11ab68,0xc9))[_0x34d3('0x44')](handleError(_0x11ab68,null));};exports[_0x34d3('0x23')]=function(_0x239f0a,_0x3e7d2a){if(_0x239f0a[_0x34d3('0x4b')]['id']){delete _0x239f0a[_0x34d3('0x4b')]['id'];}return db[_0x34d3('0x2e')][_0x34d3('0x49')]({'where':{'id':_0x239f0a['params']['id']}})[_0x34d3('0x24')](handleEntityNotFound(_0x3e7d2a,null))[_0x34d3('0x24')](saveUpdates(_0x239f0a['body'],null))['then'](respondWithResult(_0x3e7d2a,null))[_0x34d3('0x44')](handleError(_0x3e7d2a,null));};exports[_0x34d3('0x26')]=function(_0x515a97,_0xc6c763){return db[_0x34d3('0x2e')]['find']({'where':{'id':_0x515a97[_0x34d3('0x45')]['id']}})[_0x34d3('0x24')](handleEntityNotFound(_0xc6c763,null))['then'](removeEntity(_0xc6c763,null))[_0x34d3('0x44')](handleError(_0xc6c763,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 418ec91..2a6e533 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 _0x3b8b=['./cmHopperAdditionalPhone.attributes','exports','define','cm_hopper_additional_phones','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4cc61d,_0x3fd027){var _0x916589=function(_0x3f8b72){while(--_0x3f8b72){_0x4cc61d['push'](_0x4cc61d['shift']());}};_0x916589(++_0x3fd027);}(_0x3b8b,0x146));var _0xb3b8=function(_0x51b0dc,_0x5307b7){_0x51b0dc=_0x51b0dc-0x0;var _0x13fa89=_0x3b8b[_0x51b0dc];return _0x13fa89;};'use strict';var _=require(_0xb3b8('0x0'));var util=require(_0xb3b8('0x1'));var logger=require(_0xb3b8('0x2'))(_0xb3b8('0x3'));var moment=require(_0xb3b8('0x4'));var BPromise=require(_0xb3b8('0x5'));var rp=require(_0xb3b8('0x6'));var fs=require('fs');var path=require(_0xb3b8('0x7'));var rimraf=require(_0xb3b8('0x8'));var config=require(_0xb3b8('0x9'));var attributes=require(_0xb3b8('0xa'));module[_0xb3b8('0xb')]=function(_0x342365,_0x591ce1){return _0x342365[_0xb3b8('0xc')]('CmHopperAdditionalPhone',attributes,{'tableName':_0xb3b8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c36=['define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x2a3578,_0x1ed875){var _0x200fd2=function(_0x10e212){while(--_0x10e212){_0x2a3578['push'](_0x2a3578['shift']());}};_0x200fd2(++_0x1ed875);}(_0x2c36,0x177));var _0x62c3=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0x2c36[_0x17928f];return _0x500b63;};'use strict';var _=require(_0x62c3('0x0'));var util=require('util');var logger=require(_0x62c3('0x1'))(_0x62c3('0x2'));var moment=require('moment');var BPromise=require(_0x62c3('0x3'));var rp=require(_0x62c3('0x4'));var fs=require('fs');var path=require(_0x62c3('0x5'));var rimraf=require(_0x62c3('0x6'));var config=require(_0x62c3('0x7'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0x62c3('0x8')]=function(_0x34fccd,_0x40cd59){return _0x34fccd[_0x62c3('0x9')](_0x62c3('0xa'),attributes,{'tableName':_0x62c3('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 45a5fcf..bcec905 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 _0x9cb4=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','VerifyAdditionalPhones','CmHopper','findOne','body','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','entity','dialGlobalMaxRetry','countbusyretry','countdropretry','countagentrejectretry','catch','SwapAdditionalPhones','ContactId','ListId','duration','waitTime','isNil','scheduledat','minutes','add','phone','createdAt','updatedAt','sequelize','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x9cb4,0x1a6));var _0x49cb=function(_0x584e92,_0x43b07d){_0x584e92=_0x584e92-0x0;var _0x157be8=_0x9cb4[_0x584e92];return _0x157be8;};'use strict';var _=require(_0x49cb('0x0'));var util=require('util');var moment=require(_0x49cb('0x1'));var BPromise=require(_0x49cb('0x2'));var rs=require(_0x49cb('0x3'));var fs=require('fs');var Redis=require(_0x49cb('0x4'));var db=require(_0x49cb('0x5'))['db'];var utils=require(_0x49cb('0x6'));var logger=require(_0x49cb('0x7'))(_0x49cb('0x8'));var config=require(_0x49cb('0x9'));var jayson=require(_0x49cb('0xa'));var client=jayson[_0x49cb('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c2b6b,_0x2533cf,_0x4e2d2e){return new BPromise(function(_0xa56ecf,_0x32eb23){return client[_0x49cb('0xc')](_0x1c2b6b,_0x4e2d2e)[_0x49cb('0xd')](function(_0x1ad98d){logger[_0x49cb('0xe')](_0x49cb('0xf'),_0x2533cf,_0x49cb('0x10'));logger[_0x49cb('0x11')](_0x49cb('0x12'),_0x2533cf,_0x49cb('0x10'),JSON[_0x49cb('0x13')](_0x1ad98d));if(_0x1ad98d[_0x49cb('0x14')]){if(_0x1ad98d['error'][_0x49cb('0x15')]===0x1f4){logger[_0x49cb('0x14')](_0x49cb('0xf'),_0x2533cf,_0x1ad98d['error'][_0x49cb('0x16')]);return _0x32eb23(_0x1ad98d[_0x49cb('0x14')][_0x49cb('0x16')]);}logger[_0x49cb('0x14')](_0x49cb('0xf'),_0x2533cf,_0x1ad98d['error'][_0x49cb('0x16')]);return _0xa56ecf(_0x1ad98d[_0x49cb('0x14')][_0x49cb('0x16')]);}else{logger[_0x49cb('0xe')](_0x49cb('0xf'),_0x2533cf,_0x49cb('0x10'));_0xa56ecf(_0x1ad98d[_0x49cb('0x17')][_0x49cb('0x16')]);}})['catch'](function(_0x59c4b8){logger['error'](_0x49cb('0xf'),_0x2533cf,_0x59c4b8);_0x32eb23(_0x59c4b8);});});}exports[_0x49cb('0x18')]=function(_0x2a086c){var _0x5e213a=this;return new Promise(function(_0x54375b,_0x19fcb0){return db[_0x49cb('0x19')][_0x49cb('0x1a')]({'raw':!![],'where':{'ContactId':_0x2a086c[_0x49cb('0x1b')]['ContactId'],'ListId':_0x2a086c[_0x49cb('0x1b')]['ListId'],'VoiceQueueId':_0x2a086c[_0x49cb('0x1b')][_0x49cb('0x1c')]===undefined?null:_0x2a086c[_0x49cb('0x1b')][_0x49cb('0x1c')],'CampaignId':_0x2a086c[_0x49cb('0x1b')][_0x49cb('0x1d')]===undefined?null:_0x2a086c[_0x49cb('0x1b')][_0x49cb('0x1d')]}})[_0x49cb('0xd')](function(_0x282b9b){if(_0x282b9b!=null){return db[_0x49cb('0x1e')][_0x49cb('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x282b9b['id'],'OrderBy':{'$gt':_0x282b9b[_0x49cb('0x1f')]}},'order':[['OrderBy',_0x49cb('0x20')]]})[_0x49cb('0xd')](function(_0x36c6fb){var _0x230f5b=0x0;if(_0x36c6fb){if(_0x36c6fb['countbusyretry']+_0x36c6fb[_0x49cb('0x21')]+_0x36c6fb[_0x49cb('0x22')]+_0x36c6fb[_0x49cb('0x23')]+_0x36c6fb['countdropretry']+_0x36c6fb[_0x49cb('0x24')]+_0x36c6fb[_0x49cb('0x25')]+_0x36c6fb['countagentrejectretry']<_0x2a086c[_0x49cb('0x26')][_0x49cb('0x27')])_0x230f5b=0x1;_0x54375b({'additional':_0x230f5b});}else{return db[_0x49cb('0x1e')][_0x49cb('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x282b9b['id']},'order':[[_0x49cb('0x1f'),'ASC']]})[_0x49cb('0xd')](function(_0x4ff0fc){var _0x5d7d83=0x0;if(_0x4ff0fc){if(_0x4ff0fc[_0x49cb('0x28')]+_0x4ff0fc[_0x49cb('0x21')]+_0x4ff0fc[_0x49cb('0x22')]+_0x4ff0fc[_0x49cb('0x23')]+_0x4ff0fc[_0x49cb('0x29')]+_0x4ff0fc[_0x49cb('0x24')]+_0x4ff0fc[_0x49cb('0x25')]+_0x4ff0fc[_0x49cb('0x2a')]<_0x2a086c[_0x49cb('0x26')]['dialGlobalMaxRetry'])_0x5d7d83=0x1;_0x54375b({'additional':_0x5d7d83});}else{_0x54375b({'additional':0x0});}})['catch'](function(_0x170f1e){logger[_0x49cb('0x14')](_0x49cb('0x18'),_0x170f1e[_0x49cb('0x16')]);_0x19fcb0(_0x5e213a[_0x49cb('0x14')](0x1f4,_0x170f1e[_0x49cb('0x16')]));});}})[_0x49cb('0x2b')](function(_0x59234a){logger[_0x49cb('0x14')]('VerifyAdditionalPhones',_0x59234a[_0x49cb('0x16')]);_0x19fcb0(_0x5e213a['error'](0x1f4,_0x59234a[_0x49cb('0x16')]));});}else _0x54375b({'additional':0x0});});});};exports[_0x49cb('0x2c')]=function(_0x3e069a){var _0x502642=this;return new Promise(function(_0x2a55ce,_0x168485){return db['CmHopper']['findOne']({'raw':!![],'where':{'ContactId':_0x3e069a[_0x49cb('0x1b')][_0x49cb('0x2d')],'ListId':_0x3e069a[_0x49cb('0x1b')][_0x49cb('0x2e')],'VoiceQueueId':_0x3e069a[_0x49cb('0x1b')][_0x49cb('0x1c')]===undefined?null:_0x3e069a[_0x49cb('0x1b')][_0x49cb('0x1c')],'CampaignId':_0x3e069a[_0x49cb('0x1b')][_0x49cb('0x1d')]===undefined?null:_0x3e069a['body'][_0x49cb('0x1d')]}})['then'](function(_0x35c35d){if(_0x35c35d!=null){return db[_0x49cb('0x1e')][_0x49cb('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x35c35d['id'],'OrderBy':{'$gte':_0x35c35d[_0x49cb('0x1f')]}},'order':[[_0x49cb('0x1f'),_0x49cb('0x20')]]})['then'](function(_0x4d198a){if(_0x4d198a)return activateAdditionalPhone(_0x35c35d,_0x3e069a[_0x49cb('0x1b')],_0x4d198a,_0x3e069a[_0x49cb('0x2f')],_0x3e069a[_0x49cb('0x30')])[_0x49cb('0xd')](function(_0x3b9e4e){_0x2a55ce(_0x3b9e4e);});else{return db['CmHopperAdditionalPhone'][_0x49cb('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x35c35d['id']},'order':[[_0x49cb('0x1f'),_0x49cb('0x20')]]})[_0x49cb('0xd')](function(_0x285ccf){if(_0x285ccf)return activateAdditionalPhone(_0x35c35d,_0x3e069a[_0x49cb('0x1b')],_0x285ccf,_0x3e069a[_0x49cb('0x2f')],_0x3e069a[_0x49cb('0x30')])[_0x49cb('0xd')](function(_0x165780){_0x2a55ce(_0x165780);});else{_0x2a55ce({'id':_0x35c35d['id'],'phone':''});}})[_0x49cb('0x2b')](function(_0x17c3a0){logger[_0x49cb('0x14')](_0x49cb('0x18'),_0x17c3a0[_0x49cb('0x16')]);_0x168485(_0x502642[_0x49cb('0x14')](0x1f4,_0x17c3a0[_0x49cb('0x16')]));});}})[_0x49cb('0x2b')](function(_0x3566f4){logger[_0x49cb('0x14')](_0x49cb('0x18'),_0x3566f4[_0x49cb('0x16')]);_0x168485(_0x502642[_0x49cb('0x14')](0x1f4,_0x3566f4[_0x49cb('0x16')]));});}else _0x2a55ce(0x1);});});};function activateAdditionalPhone(_0x1e05ea,_0x1e0191,_0x2ece5a,_0x5872c2,_0x39191a){return new Promise(function(_0x1e63f6,_0x4a92c3){var _0x141118;if(_[_0x49cb('0x31')](_0x2ece5a[_0x49cb('0x32')])){_0x2ece5a[_0x49cb('0x32')]=moment();}if(moment()>moment(_0x2ece5a[_0x49cb('0x32')])){_0x141118=moment()['add'](_0x39191a||0x3,_0x49cb('0x33'));}else{if(_0x2ece5a[_0x49cb('0x1f')]==0x0){_0x141118=moment(_0x2ece5a[_0x49cb('0x32')]);}else{_0x141118=moment()[_0x49cb('0x34')](_0x39191a||0x3,'minutes');}}if(_[_0x49cb('0x31')](_0x141118)){_0x141118=moment()[_0x49cb('0x34')](_0x39191a||0x3,_0x49cb('0x33'));}var _0x14bf78={'phone':_0x1e05ea[_0x49cb('0x35')],'active':0x0,'OrderBy':_[_0x49cb('0x31')](_0x1e05ea[_0x49cb('0x1f')])?0x0:_0x1e05ea[_0x49cb('0x1f')],'scheduledat':moment()[_0x49cb('0x34')](_0x5872c2||0x1,_0x49cb('0x33')),'countbusyretry':_0x1e0191[_0x49cb('0x28')],'countcongestionretry':_0x1e0191[_0x49cb('0x21')],'countnoanswerretry':_0x1e0191['countnoanswerretry'],'countnosuchnumberretry':_0x1e0191[_0x49cb('0x23')],'countdropretry':_0x1e0191[_0x49cb('0x29')],'countabandonedretry':_0x1e0191[_0x49cb('0x24')],'countmachineretry':_0x1e0191[_0x49cb('0x25')],'countagentrejectretry':_0x1e0191[_0x49cb('0x2a')],'createdAt':_0x1e0191[_0x49cb('0x36')],'updatedAt':_0x1e0191[_0x49cb('0x37')]};var _0x21bac4={'CmHopperId':_0x1e05ea['id'],'phone':_0x2ece5a[_0x49cb('0x35')],'active':0x0,'OrderBy':_[_0x49cb('0x31')](_0x2ece5a[_0x49cb('0x1f')])?0x0:_0x2ece5a[_0x49cb('0x1f')],'scheduledat':_0x141118,'countbusyretry':_0x2ece5a['countbusyretry'],'countcongestionretry':_0x2ece5a[_0x49cb('0x21')],'countnoanswerretry':_0x2ece5a[_0x49cb('0x22')],'countnosuchnumberretry':_0x2ece5a[_0x49cb('0x23')],'countdropretry':_0x2ece5a[_0x49cb('0x29')],'countabandonedretry':_0x2ece5a[_0x49cb('0x24')],'countmachineretry':_0x2ece5a[_0x49cb('0x25')],'countagentrejectretry':_0x2ece5a[_0x49cb('0x2a')],'createdAt':_0x2ece5a[_0x49cb('0x36')],'updatedAt':_0x2ece5a['updatedAt']};return db[_0x49cb('0x38')]['transaction'](function(_0x428c3a){return db[_0x49cb('0x1e')][_0x49cb('0x39')](_0x14bf78,{'where':{'id':_0x2ece5a['id']}},{'transaction':_0x428c3a})[_0x49cb('0xd')](function(){return db[_0x49cb('0x19')][_0x49cb('0x39')](_0x21bac4,{'where':{'id':_0x1e05ea['id']}},{'transaction':_0x428c3a});});})[_0x49cb('0xd')](function(_0x4ad23e){_0x1e63f6({'id':_0x1e05ea['id'],'phone':_0x2ece5a[_0x49cb('0x35')]});})[_0x49cb('0x2b')](function(_0x3f6a0b){logger[_0x49cb('0x14')](_0x49cb('0x3a'),_0x3f6a0b[_0x49cb('0x16')]);_0x4a92c3({'error':_0x3f6a0b[_0x49cb('0x16')]});});});}exports[_0x49cb('0x3b')]=function(_0x3beceb){var _0x321361=this;return new Promise(function(_0x3a0357,_0x32de9f){return db[_0x49cb('0x19')][_0x49cb('0x39')](_0x3beceb[_0x49cb('0x1b')][_0x49cb('0x3c')],{'where':{'id':_0x3beceb[_0x49cb('0x1b')]['id']}})[_0x49cb('0xd')](function(_0x19fa42){_0x3a0357(_0x19fa42);})['catch'](function(_0x15d4b4){logger[_0x49cb('0x14')](_0x49cb('0x3b'),_0x15d4b4[_0x49cb('0x16')]);_0x32de9f(_0x321361[_0x49cb('0x14')](0x1f4,_0x15d4b4[_0x49cb('0x16')]));});});}; \ No newline at end of file +var _0x9ea5=['info','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmHopperAdditionalPhone,\x20%s,\x20%s','catch','body','ListId','VoiceQueueId','CampaignId','findOne','OrderBy','ASC','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','countmachineretry','entity','VerifyAdditionalPhones','SwapAdditionalPhones','CmHopper','waitTime','duration','isNil','scheduledat','add','minutes','phone','countbusyretry','createdAt','updatedAt','sequelize','transaction','CmHopperAdditionalPhone','update','IncrementPreviewCounters','field','util','moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','request','then'];(function(_0x1a5338,_0x15a2cb){var _0x395645=function(_0x50b891){while(--_0x50b891){_0x1a5338['push'](_0x1a5338['shift']());}};_0x395645(++_0x15a2cb);}(_0x9ea5,0x64));var _0x59ea=function(_0x597742,_0x2829d0){_0x597742=_0x597742-0x0;var _0x4ac931=_0x9ea5[_0x597742];return _0x4ac931;};'use strict';var _=require('lodash');var util=require(_0x59ea('0x0'));var moment=require(_0x59ea('0x1'));var BPromise=require(_0x59ea('0x2'));var rs=require(_0x59ea('0x3'));var fs=require('fs');var Redis=require(_0x59ea('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x59ea('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x59ea('0x6'));var client=jayson[_0x59ea('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x338a90,_0x3f9bc4,_0x5e0282){return new BPromise(function(_0x106b74,_0x58172f){return client[_0x59ea('0x8')](_0x338a90,_0x5e0282)[_0x59ea('0x9')](function(_0x103591){logger[_0x59ea('0xa')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x3f9bc4,_0x59ea('0xb'));logger[_0x59ea('0xc')](_0x59ea('0xd'),_0x3f9bc4,_0x59ea('0xb'),JSON[_0x59ea('0xe')](_0x103591));if(_0x103591[_0x59ea('0xf')]){if(_0x103591['error'][_0x59ea('0x10')]===0x1f4){logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x3f9bc4,_0x103591[_0x59ea('0xf')][_0x59ea('0x11')]);return _0x58172f(_0x103591[_0x59ea('0xf')][_0x59ea('0x11')]);}logger['error'](_0x59ea('0x12'),_0x3f9bc4,_0x103591[_0x59ea('0xf')][_0x59ea('0x11')]);return _0x106b74(_0x103591['error']['message']);}else{logger[_0x59ea('0xa')](_0x59ea('0x12'),_0x3f9bc4,'request\x20sent');_0x106b74(_0x103591['result']['message']);}})[_0x59ea('0x13')](function(_0x42a47b){logger[_0x59ea('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x3f9bc4,_0x42a47b);_0x58172f(_0x42a47b);});});}exports['VerifyAdditionalPhones']=function(_0x32aa55){var _0x23b1a2=this;return new Promise(function(_0x224c73,_0x37698c){return db['CmHopper']['findOne']({'raw':!![],'where':{'ContactId':_0x32aa55[_0x59ea('0x14')]['ContactId'],'ListId':_0x32aa55[_0x59ea('0x14')][_0x59ea('0x15')],'VoiceQueueId':_0x32aa55[_0x59ea('0x14')][_0x59ea('0x16')]===undefined?null:_0x32aa55[_0x59ea('0x14')]['VoiceQueueId'],'CampaignId':_0x32aa55[_0x59ea('0x14')][_0x59ea('0x17')]===undefined?null:_0x32aa55[_0x59ea('0x14')][_0x59ea('0x17')]}})[_0x59ea('0x9')](function(_0x41d141){if(_0x41d141!=null){return db['CmHopperAdditionalPhone'][_0x59ea('0x18')]({'raw':!![],'where':{'CmHopperId':_0x41d141['id'],'OrderBy':{'$gt':_0x41d141['OrderBy']}},'order':[[_0x59ea('0x19'),_0x59ea('0x1a')]]})['then'](function(_0x256aa3){var _0x4f49c4=0x0;if(_0x256aa3){if(_0x256aa3['countbusyretry']+_0x256aa3[_0x59ea('0x1b')]+_0x256aa3[_0x59ea('0x1c')]+_0x256aa3[_0x59ea('0x1d')]+_0x256aa3[_0x59ea('0x1e')]+_0x256aa3[_0x59ea('0x1f')]+_0x256aa3['countmachineretry']+_0x256aa3[_0x59ea('0x20')]<_0x32aa55['entity'][_0x59ea('0x21')])_0x4f49c4=0x1;_0x224c73({'additional':_0x4f49c4});}else{return db['CmHopperAdditionalPhone'][_0x59ea('0x18')]({'raw':!![],'where':{'CmHopperId':_0x41d141['id']},'order':[[_0x59ea('0x19'),_0x59ea('0x1a')]]})['then'](function(_0x292ab7){var _0x3feb63=0x0;if(_0x292ab7){if(_0x292ab7['countbusyretry']+_0x292ab7['countcongestionretry']+_0x292ab7['countnoanswerretry']+_0x292ab7['countnosuchnumberretry']+_0x292ab7[_0x59ea('0x1e')]+_0x292ab7['countabandonedretry']+_0x292ab7[_0x59ea('0x22')]+_0x292ab7[_0x59ea('0x20')]<_0x32aa55[_0x59ea('0x23')]['dialGlobalMaxRetry'])_0x3feb63=0x1;_0x224c73({'additional':_0x3feb63});}else{_0x224c73({'additional':0x0});}})[_0x59ea('0x13')](function(_0x4d7cbd){logger['error'](_0x59ea('0x24'),_0x4d7cbd[_0x59ea('0x11')]);_0x37698c(_0x23b1a2[_0x59ea('0xf')](0x1f4,_0x4d7cbd[_0x59ea('0x11')]));});}})[_0x59ea('0x13')](function(_0x5871de){logger[_0x59ea('0xf')](_0x59ea('0x24'),_0x5871de[_0x59ea('0x11')]);_0x37698c(_0x23b1a2[_0x59ea('0xf')](0x1f4,_0x5871de[_0x59ea('0x11')]));});}else _0x224c73({'additional':0x0});});});};exports[_0x59ea('0x25')]=function(_0x33c704){var _0x1c154f=this;return new Promise(function(_0x15489c,_0x15f75a){return db[_0x59ea('0x26')][_0x59ea('0x18')]({'raw':!![],'where':{'ContactId':_0x33c704['body']['ContactId'],'ListId':_0x33c704['body'][_0x59ea('0x15')],'VoiceQueueId':_0x33c704[_0x59ea('0x14')][_0x59ea('0x16')]===undefined?null:_0x33c704[_0x59ea('0x14')][_0x59ea('0x16')],'CampaignId':_0x33c704[_0x59ea('0x14')][_0x59ea('0x17')]===undefined?null:_0x33c704[_0x59ea('0x14')][_0x59ea('0x17')]}})[_0x59ea('0x9')](function(_0x4ec05a){if(_0x4ec05a!=null){return db['CmHopperAdditionalPhone'][_0x59ea('0x18')]({'raw':!![],'where':{'CmHopperId':_0x4ec05a['id'],'OrderBy':{'$gte':_0x4ec05a[_0x59ea('0x19')]}},'order':[[_0x59ea('0x19'),_0x59ea('0x1a')]]})[_0x59ea('0x9')](function(_0x4b01c5){if(_0x4b01c5)return activateAdditionalPhone(_0x4ec05a,_0x33c704[_0x59ea('0x14')],_0x4b01c5,_0x33c704['duration'],_0x33c704[_0x59ea('0x27')])['then'](function(_0x576667){_0x15489c(_0x576667);});else{return db['CmHopperAdditionalPhone'][_0x59ea('0x18')]({'raw':!![],'where':{'CmHopperId':_0x4ec05a['id']},'order':[[_0x59ea('0x19'),'ASC']]})[_0x59ea('0x9')](function(_0x29f89c){if(_0x29f89c)return activateAdditionalPhone(_0x4ec05a,_0x33c704[_0x59ea('0x14')],_0x29f89c,_0x33c704[_0x59ea('0x28')],_0x33c704[_0x59ea('0x27')])[_0x59ea('0x9')](function(_0x274e9e){_0x15489c(_0x274e9e);});else{_0x15489c({'id':_0x4ec05a['id'],'phone':''});}})[_0x59ea('0x13')](function(_0x17f1a0){logger[_0x59ea('0xf')](_0x59ea('0x24'),_0x17f1a0['message']);_0x15f75a(_0x1c154f[_0x59ea('0xf')](0x1f4,_0x17f1a0[_0x59ea('0x11')]));});}})[_0x59ea('0x13')](function(_0x469801){logger[_0x59ea('0xf')](_0x59ea('0x24'),_0x469801['message']);_0x15f75a(_0x1c154f[_0x59ea('0xf')](0x1f4,_0x469801[_0x59ea('0x11')]));});}else _0x15489c(0x1);});});};function activateAdditionalPhone(_0x20a4f2,_0x1daba0,_0x26b1cf,_0x55bd44,_0x399ecf){return new Promise(function(_0x587e22,_0x135370){var _0x52d73a;if(_[_0x59ea('0x29')](_0x26b1cf['scheduledat'])){_0x26b1cf[_0x59ea('0x2a')]=moment();}if(moment()>moment(_0x26b1cf['scheduledat'])){_0x52d73a=moment()[_0x59ea('0x2b')](_0x399ecf||0x3,_0x59ea('0x2c'));}else{if(_0x26b1cf[_0x59ea('0x19')]==0x0){_0x52d73a=moment(_0x26b1cf[_0x59ea('0x2a')]);}else{_0x52d73a=moment()[_0x59ea('0x2b')](_0x399ecf||0x3,_0x59ea('0x2c'));}}if(_[_0x59ea('0x29')](_0x52d73a)){_0x52d73a=moment()[_0x59ea('0x2b')](_0x399ecf||0x3,_0x59ea('0x2c'));}var _0x3866a={'phone':_0x20a4f2[_0x59ea('0x2d')],'active':0x0,'OrderBy':_[_0x59ea('0x29')](_0x20a4f2[_0x59ea('0x19')])?0x0:_0x20a4f2['OrderBy'],'scheduledat':moment()['add'](_0x55bd44||0x1,'minutes'),'countbusyretry':_0x1daba0[_0x59ea('0x2e')],'countcongestionretry':_0x1daba0[_0x59ea('0x1b')],'countnoanswerretry':_0x1daba0[_0x59ea('0x1c')],'countnosuchnumberretry':_0x1daba0[_0x59ea('0x1d')],'countdropretry':_0x1daba0['countdropretry'],'countabandonedretry':_0x1daba0[_0x59ea('0x1f')],'countmachineretry':_0x1daba0['countmachineretry'],'countagentrejectretry':_0x1daba0[_0x59ea('0x20')],'createdAt':_0x1daba0[_0x59ea('0x2f')],'updatedAt':_0x1daba0[_0x59ea('0x30')]};var _0x498a6a={'CmHopperId':_0x20a4f2['id'],'phone':_0x26b1cf[_0x59ea('0x2d')],'active':0x0,'OrderBy':_[_0x59ea('0x29')](_0x26b1cf[_0x59ea('0x19')])?0x0:_0x26b1cf[_0x59ea('0x19')],'scheduledat':_0x52d73a,'countbusyretry':_0x26b1cf[_0x59ea('0x2e')],'countcongestionretry':_0x26b1cf[_0x59ea('0x1b')],'countnoanswerretry':_0x26b1cf[_0x59ea('0x1c')],'countnosuchnumberretry':_0x26b1cf['countnosuchnumberretry'],'countdropretry':_0x26b1cf[_0x59ea('0x1e')],'countabandonedretry':_0x26b1cf['countabandonedretry'],'countmachineretry':_0x26b1cf['countmachineretry'],'countagentrejectretry':_0x26b1cf[_0x59ea('0x20')],'createdAt':_0x26b1cf['createdAt'],'updatedAt':_0x26b1cf[_0x59ea('0x30')]};return db[_0x59ea('0x31')][_0x59ea('0x32')](function(_0x4a746d){return db[_0x59ea('0x33')]['update'](_0x3866a,{'where':{'id':_0x26b1cf['id']}},{'transaction':_0x4a746d})['then'](function(){return db[_0x59ea('0x26')][_0x59ea('0x34')](_0x498a6a,{'where':{'id':_0x20a4f2['id']}},{'transaction':_0x4a746d});});})[_0x59ea('0x9')](function(_0x45c7d0){_0x587e22({'id':_0x20a4f2['id'],'phone':_0x26b1cf[_0x59ea('0x2d')]});})[_0x59ea('0x13')](function(_0x37f4bd){logger[_0x59ea('0xf')]('activateAdditionalPhone',_0x37f4bd[_0x59ea('0x11')]);_0x135370({'error':_0x37f4bd[_0x59ea('0x11')]});});});}exports[_0x59ea('0x35')]=function(_0x1f3b22){var _0x2d30b2=this;return new Promise(function(_0x73a447,_0x56d512){return db[_0x59ea('0x26')][_0x59ea('0x34')](_0x1f3b22[_0x59ea('0x14')][_0x59ea('0x36')],{'where':{'id':_0x1f3b22['body']['id']}})[_0x59ea('0x9')](function(_0x406596){_0x73a447(_0x406596);})[_0x59ea('0x13')](function(_0x3d0592){logger['error'](_0x59ea('0x35'),_0x3d0592[_0x59ea('0x11')]);_0x56d512(_0x2d30b2['error'](0x1f4,_0x3d0592[_0x59ea('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index aac9b9a..227d3d7 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 _0x4065=['../../config/environment','./cmHopperAdditionalPhone.controller','isAuthenticated','index','get','/:id','show','create','put','update','destroy','exports','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x5b3d38,_0x43953e){var _0x153daa=function(_0x483b80){while(--_0x483b80){_0x5b3d38['push'](_0x5b3d38['shift']());}};_0x153daa(++_0x43953e);}(_0x4065,0xdc));var _0x5406=function(_0x19dd5f,_0x2a53d8){_0x19dd5f=_0x19dd5f-0x0;var _0x1b1ad9=_0x4065[_0x19dd5f];return _0x1b1ad9;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x5406('0x0'));var express=require('express');var router=express[_0x5406('0x1')]();var fs_extra=require(_0x5406('0x2'));var auth=require(_0x5406('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x5406('0x4'));var controller=require(_0x5406('0x5'));router['get']('/',auth[_0x5406('0x6')](),controller[_0x5406('0x7')]);router[_0x5406('0x8')](_0x5406('0x9'),auth[_0x5406('0x6')](),controller[_0x5406('0xa')]);router['post']('/',auth[_0x5406('0x6')](),controller[_0x5406('0xb')]);router[_0x5406('0xc')](_0x5406('0x9'),auth[_0x5406('0x6')](),controller[_0x5406('0xd')]);router['delete'](_0x5406('0x9'),auth[_0x5406('0x6')](),controller[_0x5406('0xe')]);module[_0x5406('0xf')]=router; \ No newline at end of file +var _0x5f60=['destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','show','post','create','put','delete'];(function(_0x43a954,_0x1d73d7){var _0x1973f6=function(_0x3de96c){while(--_0x3de96c){_0x43a954['push'](_0x43a954['shift']());}};_0x1973f6(++_0x1d73d7);}(_0x5f60,0x134));var _0x05f6=function(_0x4d247c,_0x3dff9e){_0x4d247c=_0x4d247c-0x0;var _0x42c60c=_0x5f60[_0x4d247c];return _0x42c60c;};'use strict';var multer=require('multer');var util=require(_0x05f6('0x0'));var path=require('path');var timeout=require(_0x05f6('0x1'));var express=require('express');var router=express[_0x05f6('0x2')]();var fs_extra=require(_0x05f6('0x3'));var auth=require(_0x05f6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x05f6('0x5'));var controller=require(_0x05f6('0x6'));router[_0x05f6('0x7')]('/',auth[_0x05f6('0x8')](),controller[_0x05f6('0x9')]);router['get']('/:id',auth[_0x05f6('0x8')](),controller[_0x05f6('0xa')]);router[_0x05f6('0xb')]('/',auth[_0x05f6('0x8')](),controller[_0x05f6('0xc')]);router[_0x05f6('0xd')]('/:id',auth[_0x05f6('0x8')](),controller['update']);router[_0x05f6('0xe')]('/:id',auth[_0x05f6('0x8')](),controller[_0x05f6('0xf')]);module[_0x05f6('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 0e09ed7..a2cf8ea 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 _0xea31=['INTEGER','contactListQueue','moment','exports','STRING'];(function(_0x403409,_0x592809){var _0x34844a=function(_0x501dc2){while(--_0x501dc2){_0x403409['push'](_0x403409['shift']());}};_0x34844a(++_0x592809);}(_0xea31,0x6b));var _0x1ea3=function(_0x24226b,_0x1b6b7e){_0x24226b=_0x24226b-0x0;var _0x4a771e=_0xea31[_0x24226b];return _0x4a771e;};'use strict';var moment=require(_0x1ea3('0x0'));var Sequelize=require('sequelize');module[_0x1ea3('0x1')]={'phone':{'type':Sequelize[_0x1ea3('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x1ea3('0x3')],'unique':_0x1ea3('0x4')},'ListId':{'type':Sequelize[_0x1ea3('0x3')],'unique':_0x1ea3('0x4')},'VoiceQueueId':{'type':Sequelize[_0x1ea3('0x3')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x9a5a=['INTEGER','contactListQueue','moment','sequelize','exports','STRING'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0x9a5a,0x194));var _0xa9a5=function(_0x41bb0e,_0x235372){_0x41bb0e=_0x41bb0e-0x0;var _0x200727=_0x9a5a[_0x41bb0e];return _0x200727;};'use strict';var moment=require(_0xa9a5('0x0'));var Sequelize=require(_0xa9a5('0x1'));module[_0xa9a5('0x2')]={'phone':{'type':Sequelize[_0xa9a5('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xa9a5('0x4')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xa9a5('0x4')],'unique':_0xa9a5('0x5')},'VoiceQueueId':{'type':Sequelize[_0xa9a5('0x4')],'unique':_0xa9a5('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 343d0a9..8953551 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 _0xd84f=['name','index','map','CmHopperBlack','rawAttributes','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','type','VIRTUAL','filter','merge','includeAll','include','findAll','then','rows','show','params','keys','options','body','find','catch','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack'];(function(_0x1d3ccd,_0x3f4b91){var _0x2f7901=function(_0x3e54d9){while(--_0x3e54d9){_0x1d3ccd['push'](_0x1d3ccd['shift']());}};_0x2f7901(++_0x3f4b91);}(_0xd84f,0x199));var _0xfd84=function(_0xca5fe3,_0x5b16b9){_0xca5fe3=_0xca5fe3-0x0;var _0x10b613=_0xd84f[_0xca5fe3];return _0x10b613;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfd84('0x0'));var zipdir=require(_0xfd84('0x1'));var jsonpatch=require(_0xfd84('0x2'));var rp=require('request-promise');var moment=require(_0xfd84('0x3'));var BPromise=require(_0xfd84('0x4'));var Mustache=require(_0xfd84('0x5'));var util=require('util');var path=require(_0xfd84('0x6'));var sox=require(_0xfd84('0x7'));var csv=require(_0xfd84('0x8'));var ejs=require(_0xfd84('0x9'));var fs=require('fs');var fs_extra=require(_0xfd84('0xa'));var _=require(_0xfd84('0xb'));var squel=require(_0xfd84('0xc'));var crypto=require(_0xfd84('0xd'));var jsforce=require(_0xfd84('0xe'));var deskjs=require(_0xfd84('0xf'));var toCsv=require(_0xfd84('0x8'));var querystring=require(_0xfd84('0x10'));var Papa=require(_0xfd84('0x11'));var Redis=require('ioredis');var authService=require(_0xfd84('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xfd84('0x13'));var hardwareService=require(_0xfd84('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xfd84('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xfd84('0x16'));var db=require(_0xfd84('0x17'))['db'];function respondWithStatusCode(_0x565073,_0x566431){_0x566431=_0x566431||0xcc;return function(_0x3982f8){if(_0x3982f8){return _0x565073[_0xfd84('0x18')](_0x566431);}return _0x565073[_0xfd84('0x19')](_0x566431)[_0xfd84('0x1a')]();};}function respondWithResult(_0x140ca1,_0x10e68f){_0x10e68f=_0x10e68f||0xc8;return function(_0x5ae6b4){if(_0x5ae6b4){return _0x140ca1[_0xfd84('0x19')](_0x10e68f)[_0xfd84('0x1b')](_0x5ae6b4);}};}function respondWithFilteredResult(_0x1718b3,_0x1dfa9d){return function(_0x300b24){if(_0x300b24){var _0xee93df=typeof _0x1dfa9d[_0xfd84('0x1c')]===_0xfd84('0x1d')&&typeof _0x1dfa9d[_0xfd84('0x1e')]===_0xfd84('0x1d');var _0x11a431=_0x300b24['count'];var _0x44ffcc=_0xee93df?0x0:_0x1dfa9d[_0xfd84('0x1c')];var _0x250a3a=_0xee93df?_0x300b24[_0xfd84('0x1f')]:_0x1dfa9d['offset']+_0x1dfa9d['limit'];var _0x2733a1;if(_0x250a3a>=_0x11a431){_0x250a3a=_0x11a431;_0x2733a1=0xc8;}else{_0x2733a1=0xce;}_0x1718b3[_0xfd84('0x19')](_0x2733a1);return _0x1718b3[_0xfd84('0x20')](_0xfd84('0x21'),_0x44ffcc+'-'+_0x250a3a+'/'+_0x11a431)[_0xfd84('0x1b')](_0x300b24);}return null;};}function patchUpdates(_0x132ae0){return function(_0x591a68){try{jsonpatch[_0xfd84('0x22')](_0x591a68,_0x132ae0,!![]);}catch(_0x377f61){return BPromise[_0xfd84('0x23')](_0x377f61);}return _0x591a68[_0xfd84('0x24')]();};}function saveUpdates(_0x2cf206,_0x577637){return function(_0x3cb874){if(_0x3cb874){return _0x3cb874[_0xfd84('0x25')](_0x2cf206)['then'](function(_0x26072c){return _0x26072c;});}return null;};}function removeEntity(_0xfa0eee,_0x419109){return function(_0x45346c){if(_0x45346c){return _0x45346c[_0xfd84('0x26')]()['then'](function(){_0xfa0eee[_0xfd84('0x19')](0xcc)[_0xfd84('0x1a')]();});}};}function handleEntityNotFound(_0x2dcda4,_0x273f5c){return function(_0x5d7832){if(!_0x5d7832){_0x2dcda4['sendStatus'](0x194);}return _0x5d7832;};}function handleError(_0x11f6bf,_0x8ce688){_0x8ce688=_0x8ce688||0x1f4;return function(_0x4ba6b4){logger[_0xfd84('0x27')](_0x4ba6b4[_0xfd84('0x28')]);if(_0x4ba6b4[_0xfd84('0x29')]){delete _0x4ba6b4[_0xfd84('0x29')];}_0x11f6bf[_0xfd84('0x19')](_0x8ce688)['send'](_0x4ba6b4);};}exports[_0xfd84('0x2a')]=function(_0x552c5b,_0x51f8b5){var _0x471515={},_0x48d75b={},_0x3594b4={'count':0x0,'rows':[]};var _0xa30e93=_[_0xfd84('0x2b')](db[_0xfd84('0x2c')][_0xfd84('0x2d')],function(_0x39bacd){return{'name':_0x39bacd['fieldName'],'type':_0x39bacd['type'][_0xfd84('0x2e')]};});_0x48d75b[_0xfd84('0x2f')]=_[_0xfd84('0x2b')](_0xa30e93,'name');_0x48d75b[_0xfd84('0x30')]=_['keys'](_0x552c5b[_0xfd84('0x30')]);_0x48d75b['filters']=_[_0xfd84('0x31')](_0x48d75b[_0xfd84('0x2f')],_0x48d75b['query']);_0x471515[_0xfd84('0x32')]=_[_0xfd84('0x31')](_0x48d75b[_0xfd84('0x2f')],qs[_0xfd84('0x33')](_0x552c5b['query'][_0xfd84('0x33')]));_0x471515[_0xfd84('0x32')]=_0x471515[_0xfd84('0x32')][_0xfd84('0x34')]?_0x471515[_0xfd84('0x32')]:_0x48d75b[_0xfd84('0x2f')];if(!_0x552c5b[_0xfd84('0x30')][_0xfd84('0x35')](_0xfd84('0x36'))){_0x471515[_0xfd84('0x1e')]=qs[_0xfd84('0x1e')](_0x552c5b['query'][_0xfd84('0x1e')]);_0x471515[_0xfd84('0x1c')]=qs[_0xfd84('0x1c')](_0x552c5b[_0xfd84('0x30')][_0xfd84('0x1c')]);}_0x471515[_0xfd84('0x37')]=qs[_0xfd84('0x38')](_0x552c5b[_0xfd84('0x30')][_0xfd84('0x38')]);_0x471515[_0xfd84('0x39')]=qs[_0xfd84('0x3a')](_['pick'](_0x552c5b[_0xfd84('0x30')],_0x48d75b['filters']),_0xa30e93);if(_0x552c5b[_0xfd84('0x30')]['filter']){_0x471515[_0xfd84('0x39')]=_['merge'](_0x471515['where'],{'$or':_['map'](_0xa30e93,function(_0x1b47db){if(_0x1b47db[_0xfd84('0x3b')]!==_0xfd84('0x3c')){var _0x4157d6={};_0x4157d6[_0x1b47db['name']]={'$like':'%'+_0x552c5b[_0xfd84('0x30')][_0xfd84('0x3d')]+'%'};return _0x4157d6;}})});}_0x471515=_[_0xfd84('0x3e')]({},_0x471515,_0x552c5b['options']);var _0x371e47={'where':_0x471515[_0xfd84('0x39')]};return db[_0xfd84('0x2c')][_0xfd84('0x1f')](_0x371e47)['then'](function(_0x2c1e44){_0x3594b4[_0xfd84('0x1f')]=_0x2c1e44;if(_0x552c5b[_0xfd84('0x30')][_0xfd84('0x3f')]){_0x471515[_0xfd84('0x40')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xfd84('0x41')](_0x471515);})[_0xfd84('0x42')](function(_0x2c9713){_0x3594b4[_0xfd84('0x43')]=_0x2c9713;return _0x3594b4;})['then'](respondWithFilteredResult(_0x51f8b5,_0x471515))['catch'](handleError(_0x51f8b5,null));};exports[_0xfd84('0x44')]=function(_0x42a899,_0x4f5b1f){var _0x1a45f4={'raw':!![],'where':{'id':_0x42a899[_0xfd84('0x45')]['id']}},_0x484735={};_0x484735[_0xfd84('0x2f')]=_[_0xfd84('0x46')](db[_0xfd84('0x2c')][_0xfd84('0x2d')]);_0x484735[_0xfd84('0x30')]=_[_0xfd84('0x46')](_0x42a899[_0xfd84('0x30')]);_0x484735['filters']=_['intersection'](_0x484735[_0xfd84('0x2f')],_0x484735[_0xfd84('0x30')]);_0x1a45f4[_0xfd84('0x32')]=_[_0xfd84('0x31')](_0x484735[_0xfd84('0x2f')],qs[_0xfd84('0x33')](_0x42a899['query'][_0xfd84('0x33')]));_0x1a45f4[_0xfd84('0x32')]=_0x1a45f4['attributes']['length']?_0x1a45f4[_0xfd84('0x32')]:_0x484735[_0xfd84('0x2f')];if(_0x42a899['query'][_0xfd84('0x3f')]){_0x1a45f4[_0xfd84('0x40')]=[{'all':!![]}];}_0x1a45f4=_['merge']({},_0x1a45f4,_0x42a899[_0xfd84('0x47')]);return db['CmHopperBlack']['find'](_0x1a45f4)[_0xfd84('0x42')](handleEntityNotFound(_0x4f5b1f,null))[_0xfd84('0x42')](respondWithResult(_0x4f5b1f,null))['catch'](handleError(_0x4f5b1f,null));};exports[_0xfd84('0x25')]=function(_0xbc9aa1,_0x544cd2){if(_0xbc9aa1['body']['id']){delete _0xbc9aa1[_0xfd84('0x48')]['id'];}return db['CmHopperBlack'][_0xfd84('0x49')]({'where':{'id':_0xbc9aa1[_0xfd84('0x45')]['id']}})['then'](handleEntityNotFound(_0x544cd2,null))[_0xfd84('0x42')](saveUpdates(_0xbc9aa1[_0xfd84('0x48')],null))['then'](respondWithResult(_0x544cd2,null))['catch'](handleError(_0x544cd2,null));};exports['destroy']=function(_0x535386,_0x4f445b){return db['CmHopperBlack']['find']({'where':{'id':_0x535386[_0xfd84('0x45')]['id']}})[_0xfd84('0x42')](handleEntityNotFound(_0x4f445b,null))['then'](removeEntity(_0x4f445b,null))[_0xfd84('0x4a')](handleError(_0x4f445b,null));};exports['describe']=function(_0x3a4064,_0x56535d){return db[_0xfd84('0x2c')]['describe']()['then'](respondWithResult(_0x56535d,null))[_0xfd84('0x4a')](handleError(_0x56535d,null));}; \ No newline at end of file +var _0x0049=['offset','limit','undefined','count','status','Content-Range','apply','reject','save','then','destroy','sendStatus','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','update','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','end','json'];(function(_0x5a7dd3,_0x26b7cf){var _0x2f4d07=function(_0x280510){while(--_0x280510){_0x5a7dd3['push'](_0x5a7dd3['shift']());}};_0x2f4d07(++_0x26b7cf);}(_0x0049,0x77));var _0x9004=function(_0x814257,_0x5403ed){_0x814257=_0x814257-0x0;var _0x4f9aa0=_0x0049[_0x814257];return _0x4f9aa0;};'use strict';var emlformat=require(_0x9004('0x0'));var rimraf=require(_0x9004('0x1'));var zipdir=require(_0x9004('0x2'));var jsonpatch=require(_0x9004('0x3'));var rp=require('request-promise');var moment=require(_0x9004('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9004('0x5'));var util=require(_0x9004('0x6'));var path=require(_0x9004('0x7'));var sox=require('sox');var csv=require(_0x9004('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9004('0x9'));var _=require(_0x9004('0xa'));var squel=require(_0x9004('0xb'));var crypto=require(_0x9004('0xc'));var jsforce=require(_0x9004('0xd'));var deskjs=require(_0x9004('0xe'));var toCsv=require(_0x9004('0x8'));var querystring=require(_0x9004('0xf'));var Papa=require('papaparse');var Redis=require(_0x9004('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9004('0x11'));var hardwareService=require(_0x9004('0x12'));var logger=require(_0x9004('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x9004('0x14'));var licenseUtil=require(_0x9004('0x15'));var db=require(_0x9004('0x16'))['db'];function respondWithStatusCode(_0x493ae4,_0x604d82){_0x604d82=_0x604d82||0xcc;return function(_0x168edf){if(_0x168edf){return _0x493ae4['sendStatus'](_0x604d82);}return _0x493ae4['status'](_0x604d82)[_0x9004('0x17')]();};}function respondWithResult(_0x4704dc,_0x37c022){_0x37c022=_0x37c022||0xc8;return function(_0x529ea2){if(_0x529ea2){return _0x4704dc['status'](_0x37c022)[_0x9004('0x18')](_0x529ea2);}};}function respondWithFilteredResult(_0x2fd103,_0x500e12){return function(_0x24b1a1){if(_0x24b1a1){var _0xdbdbde=typeof _0x500e12[_0x9004('0x19')]==='undefined'&&typeof _0x500e12[_0x9004('0x1a')]===_0x9004('0x1b');var _0x3d6d81=_0x24b1a1[_0x9004('0x1c')];var _0x1297c5=_0xdbdbde?0x0:_0x500e12[_0x9004('0x19')];var _0x20db50=_0xdbdbde?_0x24b1a1[_0x9004('0x1c')]:_0x500e12[_0x9004('0x19')]+_0x500e12[_0x9004('0x1a')];var _0x121ccf;if(_0x20db50>=_0x3d6d81){_0x20db50=_0x3d6d81;_0x121ccf=0xc8;}else{_0x121ccf=0xce;}_0x2fd103[_0x9004('0x1d')](_0x121ccf);return _0x2fd103['set'](_0x9004('0x1e'),_0x1297c5+'-'+_0x20db50+'/'+_0x3d6d81)[_0x9004('0x18')](_0x24b1a1);}return null;};}function patchUpdates(_0x24844f){return function(_0x10a6f5){try{jsonpatch[_0x9004('0x1f')](_0x10a6f5,_0x24844f,!![]);}catch(_0x3e301d){return BPromise[_0x9004('0x20')](_0x3e301d);}return _0x10a6f5[_0x9004('0x21')]();};}function saveUpdates(_0x6b3920,_0x5df579){return function(_0x3d010c){if(_0x3d010c){return _0x3d010c['update'](_0x6b3920)[_0x9004('0x22')](function(_0x2ca67a){return _0x2ca67a;});}return null;};}function removeEntity(_0x4d3e87,_0x493963){return function(_0x3fc16e){if(_0x3fc16e){return _0x3fc16e[_0x9004('0x23')]()[_0x9004('0x22')](function(){_0x4d3e87[_0x9004('0x1d')](0xcc)[_0x9004('0x17')]();});}};}function handleEntityNotFound(_0x30737c,_0x3c11b8){return function(_0x4db131){if(!_0x4db131){_0x30737c[_0x9004('0x24')](0x194);}return _0x4db131;};}function handleError(_0x64ddc4,_0x3de9a6){_0x3de9a6=_0x3de9a6||0x1f4;return function(_0x9b2557){logger['error'](_0x9b2557[_0x9004('0x25')]);if(_0x9b2557[_0x9004('0x26')]){delete _0x9b2557[_0x9004('0x26')];}_0x64ddc4[_0x9004('0x1d')](_0x3de9a6)[_0x9004('0x27')](_0x9b2557);};}exports[_0x9004('0x28')]=function(_0x26b693,_0xc61a70){var _0x3533b4={},_0xfa116a={},_0x2cb580={'count':0x0,'rows':[]};var _0x178a93=_[_0x9004('0x29')](db[_0x9004('0x2a')][_0x9004('0x2b')],function(_0x4231e6){return{'name':_0x4231e6[_0x9004('0x2c')],'type':_0x4231e6[_0x9004('0x2d')]['key']};});_0xfa116a[_0x9004('0x2e')]=_['map'](_0x178a93,_0x9004('0x26'));_0xfa116a[_0x9004('0x2f')]=_[_0x9004('0x30')](_0x26b693[_0x9004('0x2f')]);_0xfa116a[_0x9004('0x31')]=_[_0x9004('0x32')](_0xfa116a['model'],_0xfa116a[_0x9004('0x2f')]);_0x3533b4[_0x9004('0x33')]=_[_0x9004('0x32')](_0xfa116a[_0x9004('0x2e')],qs[_0x9004('0x34')](_0x26b693['query']['fields']));_0x3533b4[_0x9004('0x33')]=_0x3533b4[_0x9004('0x33')][_0x9004('0x35')]?_0x3533b4['attributes']:_0xfa116a['model'];if(!_0x26b693[_0x9004('0x2f')][_0x9004('0x36')]('nolimit')){_0x3533b4['limit']=qs[_0x9004('0x1a')](_0x26b693['query'][_0x9004('0x1a')]);_0x3533b4['offset']=qs[_0x9004('0x19')](_0x26b693['query'][_0x9004('0x19')]);}_0x3533b4[_0x9004('0x37')]=qs[_0x9004('0x38')](_0x26b693[_0x9004('0x2f')][_0x9004('0x38')]);_0x3533b4[_0x9004('0x39')]=qs['filters'](_[_0x9004('0x3a')](_0x26b693['query'],_0xfa116a[_0x9004('0x31')]),_0x178a93);if(_0x26b693['query'][_0x9004('0x3b')]){_0x3533b4[_0x9004('0x39')]=_['merge'](_0x3533b4[_0x9004('0x39')],{'$or':_[_0x9004('0x29')](_0x178a93,function(_0x5b44e7){if(_0x5b44e7[_0x9004('0x2d')]!==_0x9004('0x3c')){var _0x4aafa7={};_0x4aafa7[_0x5b44e7[_0x9004('0x26')]]={'$like':'%'+_0x26b693[_0x9004('0x2f')]['filter']+'%'};return _0x4aafa7;}})});}_0x3533b4=_[_0x9004('0x3d')]({},_0x3533b4,_0x26b693[_0x9004('0x3e')]);var _0x42afd4={'where':_0x3533b4['where']};return db['CmHopperBlack'][_0x9004('0x1c')](_0x42afd4)[_0x9004('0x22')](function(_0x57e1ec){_0x2cb580['count']=_0x57e1ec;if(_0x26b693['query'][_0x9004('0x3f')]){_0x3533b4[_0x9004('0x40')]=[{'all':!![]}];}return db[_0x9004('0x2a')][_0x9004('0x41')](_0x3533b4);})['then'](function(_0x2b6913){_0x2cb580['rows']=_0x2b6913;return _0x2cb580;})[_0x9004('0x22')](respondWithFilteredResult(_0xc61a70,_0x3533b4))[_0x9004('0x42')](handleError(_0xc61a70,null));};exports['show']=function(_0x12175f,_0x34e8ce){var _0x4e4fca={'raw':!![],'where':{'id':_0x12175f['params']['id']}},_0x30b3d={};_0x30b3d[_0x9004('0x2e')]=_['keys'](db[_0x9004('0x2a')][_0x9004('0x2b')]);_0x30b3d[_0x9004('0x2f')]=_[_0x9004('0x30')](_0x12175f[_0x9004('0x2f')]);_0x30b3d['filters']=_['intersection'](_0x30b3d[_0x9004('0x2e')],_0x30b3d['query']);_0x4e4fca[_0x9004('0x33')]=_['intersection'](_0x30b3d[_0x9004('0x2e')],qs[_0x9004('0x34')](_0x12175f['query'][_0x9004('0x34')]));_0x4e4fca[_0x9004('0x33')]=_0x4e4fca[_0x9004('0x33')][_0x9004('0x35')]?_0x4e4fca[_0x9004('0x33')]:_0x30b3d[_0x9004('0x2e')];if(_0x12175f[_0x9004('0x2f')]['includeAll']){_0x4e4fca[_0x9004('0x40')]=[{'all':!![]}];}_0x4e4fca=_[_0x9004('0x3d')]({},_0x4e4fca,_0x12175f['options']);return db[_0x9004('0x2a')]['find'](_0x4e4fca)[_0x9004('0x22')](handleEntityNotFound(_0x34e8ce,null))['then'](respondWithResult(_0x34e8ce,null))[_0x9004('0x42')](handleError(_0x34e8ce,null));};exports[_0x9004('0x43')]=function(_0x7ebd8c,_0x91f453){if(_0x7ebd8c['body']['id']){delete _0x7ebd8c[_0x9004('0x44')]['id'];}return db[_0x9004('0x2a')][_0x9004('0x45')]({'where':{'id':_0x7ebd8c[_0x9004('0x46')]['id']}})[_0x9004('0x22')](handleEntityNotFound(_0x91f453,null))['then'](saveUpdates(_0x7ebd8c[_0x9004('0x44')],null))[_0x9004('0x22')](respondWithResult(_0x91f453,null))['catch'](handleError(_0x91f453,null));};exports['destroy']=function(_0x308ea0,_0x186c4a){return db[_0x9004('0x2a')][_0x9004('0x45')]({'where':{'id':_0x308ea0[_0x9004('0x46')]['id']}})[_0x9004('0x22')](handleEntityNotFound(_0x186c4a,null))[_0x9004('0x22')](removeEntity(_0x186c4a,null))[_0x9004('0x42')](handleError(_0x186c4a,null));};exports[_0x9004('0x47')]=function(_0x4a5402,_0xb4208b){return db[_0x9004('0x2a')][_0x9004('0x47')]()[_0x9004('0x22')](respondWithResult(_0xb4208b,null))[_0x9004('0x42')](handleError(_0xb4208b,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 09edb54..598fe9f 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 _0x5118=['api','moment','bluebird','request-promise','path','../../config/environment','exports','define','CmHopperBlack','cm_hopper_black','util'];(function(_0x22dc46,_0x4a72c8){var _0x2582d3=function(_0x247e02){while(--_0x247e02){_0x22dc46['push'](_0x22dc46['shift']());}};_0x2582d3(++_0x4a72c8);}(_0x5118,0x175));var _0x8511=function(_0x36f3df,_0x2b1621){_0x36f3df=_0x36f3df-0x0;var _0xcfb7b7=_0x5118[_0x36f3df];return _0xcfb7b7;};'use strict';var _=require('lodash');var util=require(_0x8511('0x0'));var logger=require('../../config/logger')(_0x8511('0x1'));var moment=require(_0x8511('0x2'));var BPromise=require(_0x8511('0x3'));var rp=require(_0x8511('0x4'));var fs=require('fs');var path=require(_0x8511('0x5'));var rimraf=require('rimraf');var config=require(_0x8511('0x6'));var attributes=require('./cmHopperBlack.attributes');module[_0x8511('0x7')]=function(_0x5e9813,_0x2432ef){return _0x5e9813[_0x8511('0x8')](_0x8511('0x9'),attributes,{'tableName':_0x8511('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa735=['./cmHopperBlack.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xdefb87,_0x18c26c){var _0x5a2db2=function(_0x550ad1){while(--_0x550ad1){_0xdefb87['push'](_0xdefb87['shift']());}};_0x5a2db2(++_0x18c26c);}(_0xa735,0x1bd));var _0x5a73=function(_0x18c653,_0x45d522){_0x18c653=_0x18c653-0x0;var _0x27bb81=_0xa735[_0x18c653];return _0x27bb81;};'use strict';var _=require(_0x5a73('0x0'));var util=require(_0x5a73('0x1'));var logger=require(_0x5a73('0x2'))(_0x5a73('0x3'));var moment=require(_0x5a73('0x4'));var BPromise=require(_0x5a73('0x5'));var rp=require(_0x5a73('0x6'));var fs=require('fs');var path=require(_0x5a73('0x7'));var rimraf=require(_0x5a73('0x8'));var config=require(_0x5a73('0x9'));var attributes=require(_0x5a73('0xa'));module[_0x5a73('0xb')]=function(_0x27dce5,_0xfafbc4){return _0x27dce5[_0x5a73('0xc')]('CmHopperBlack',attributes,{'tableName':'cm_hopper_black','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 11c60bb..9e89920 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 _0x2cb1=['error','code','CmHopperBlack,\x20%s,\x20%s','message','catch','GetCmHopperBlack','CmHopperBlack','options','where','attributes','limit','include','map','UpdateCmHopperBlack','body','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','debug','request\x20sent','stringify'];(function(_0x12eb2a,_0x4eda8a){var _0x4c2fbd=function(_0x181fc9){while(--_0x181fc9){_0x12eb2a['push'](_0x12eb2a['shift']());}};_0x4c2fbd(++_0x4eda8a);}(_0x2cb1,0x17c));var _0x12cb=function(_0x27f492,_0x99665e){_0x27f492=_0x27f492-0x0;var _0x5d3d0b=_0x2cb1[_0x27f492];return _0x5d3d0b;};'use strict';var _=require(_0x12cb('0x0'));var util=require(_0x12cb('0x1'));var moment=require(_0x12cb('0x2'));var BPromise=require(_0x12cb('0x3'));var rs=require(_0x12cb('0x4'));var fs=require('fs');var Redis=require(_0x12cb('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x12cb('0x6'));var logger=require(_0x12cb('0x7'))('rpc');var config=require(_0x12cb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x12cb('0x9')][_0x12cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x20404c,_0x3315ba,_0x724eb6){return new BPromise(function(_0x47d905,_0x4a41ae){return client['request'](_0x20404c,_0x724eb6)[_0x12cb('0xb')](function(_0x191120){logger[_0x12cb('0xc')]('CmHopperBlack,\x20%s,\x20%s',_0x3315ba,'request\x20sent');logger[_0x12cb('0xd')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x3315ba,_0x12cb('0xe'),JSON[_0x12cb('0xf')](_0x191120));if(_0x191120[_0x12cb('0x10')]){if(_0x191120[_0x12cb('0x10')][_0x12cb('0x11')]===0x1f4){logger[_0x12cb('0x10')](_0x12cb('0x12'),_0x3315ba,_0x191120['error']['message']);return _0x4a41ae(_0x191120[_0x12cb('0x10')][_0x12cb('0x13')]);}logger[_0x12cb('0x10')](_0x12cb('0x12'),_0x3315ba,_0x191120[_0x12cb('0x10')][_0x12cb('0x13')]);return _0x47d905(_0x191120['error']['message']);}else{logger[_0x12cb('0xc')]('CmHopperBlack,\x20%s,\x20%s',_0x3315ba,_0x12cb('0xe'));_0x47d905(_0x191120['result'][_0x12cb('0x13')]);}})[_0x12cb('0x14')](function(_0x349aee){logger[_0x12cb('0x10')](_0x12cb('0x12'),_0x3315ba,_0x349aee);_0x4a41ae(_0x349aee);});});}exports[_0x12cb('0x15')]=function(_0x53ac06){var _0x3973e5=this;return new Promise(function(_0x3c08fe,_0x3f260f){return db[_0x12cb('0x16')]['findAll']({'raw':_0x53ac06[_0x12cb('0x17')]?_0x53ac06[_0x12cb('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x53ac06[_0x12cb('0x17')]?_0x53ac06[_0x12cb('0x17')][_0x12cb('0x18')]||null:null,'attributes':_0x53ac06['options']?_0x53ac06[_0x12cb('0x17')][_0x12cb('0x19')]||null:null,'limit':_0x53ac06['options']?_0x53ac06['options'][_0x12cb('0x1a')]||null:null,'include':_0x53ac06['options']?_0x53ac06[_0x12cb('0x17')][_0x12cb('0x1b')]?_[_0x12cb('0x1c')](_0x53ac06['options'][_0x12cb('0x1b')],function(_0x3f1642){return{'model':db[_0x3f1642['model']],'as':_0x3f1642['as'],'attributes':_0x3f1642['attributes'],'include':_0x3f1642['include']?_[_0x12cb('0x1c')](_0x3f1642['include'],function(_0x50376c){return{'model':db[_0x50376c['model']],'as':_0x50376c['as'],'attributes':_0x50376c[_0x12cb('0x19')],'include':_0x50376c['include']?_['map'](_0x50376c['include'],function(_0xcf3cde){return{'model':db[_0xcf3cde['model']],'as':_0xcf3cde['as'],'attributes':_0xcf3cde[_0x12cb('0x19')]};}):[]};}):[]};}):[]:[]})[_0x12cb('0xb')](function(_0x2a6a4b){logger[_0x12cb('0xc')](_0x12cb('0x15'),_0x53ac06);logger[_0x12cb('0xd')](_0x12cb('0x15'),_0x53ac06,JSON[_0x12cb('0xf')](_0x2a6a4b));_0x3c08fe(_0x2a6a4b);})[_0x12cb('0x14')](function(_0x2a38a8){logger[_0x12cb('0x10')](_0x12cb('0x15'),_0x2a38a8[_0x12cb('0x13')],_0x53ac06);_0x3f260f(_0x3973e5[_0x12cb('0x10')](0x1f4,_0x2a38a8[_0x12cb('0x13')]));});});};exports[_0x12cb('0x1d')]=function(_0x2a0220){var _0x3ad24c=this;return new Promise(function(_0xef807e,_0x6d5a95){return db[_0x12cb('0x16')]['update'](_0x2a0220[_0x12cb('0x1e')],{'raw':_0x2a0220[_0x12cb('0x17')]?_0x2a0220[_0x12cb('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a0220[_0x12cb('0x17')]?_0x2a0220[_0x12cb('0x17')][_0x12cb('0x18')]||null:null,'attributes':_0x2a0220[_0x12cb('0x17')]?_0x2a0220['options'][_0x12cb('0x19')]||null:null,'limit':_0x2a0220[_0x12cb('0x17')]?_0x2a0220[_0x12cb('0x17')][_0x12cb('0x1a')]||null:null})[_0x12cb('0xb')](function(_0x1f9647){logger['info']('UpdateCmHopperBlack',_0x2a0220);logger[_0x12cb('0xd')](_0x12cb('0x1d'),_0x2a0220,JSON[_0x12cb('0xf')](_0x1f9647));_0xef807e(_0x1f9647);})[_0x12cb('0x14')](function(_0x73cd9d){logger[_0x12cb('0x10')]('UpdateCmHopperBlack',_0x73cd9d['message'],_0x2a0220);_0x6d5a95(_0x3ad24c[_0x12cb('0x10')](0x1f4,_0x73cd9d[_0x12cb('0x13')]));});});};exports[_0x12cb('0x1f')]=function(_0x114da5){var _0x1fd93b=this;return new Promise(function(_0x5a8af9,_0x139095){return db[_0x12cb('0x16')][_0x12cb('0x20')]({'where':_0x114da5[_0x12cb('0x17')]?_0x114da5[_0x12cb('0x17')][_0x12cb('0x18')]||null:null})[_0x12cb('0xb')](function(_0x360537){logger[_0x12cb('0xc')](_0x12cb('0x1f'),_0x114da5);logger['debug'](_0x12cb('0x1f'),_0x114da5,JSON[_0x12cb('0xf')](_0x360537));_0x5a8af9(_0x360537);})[_0x12cb('0x14')](function(_0x37a9ed){logger['error']('DestroyCmHopperBlack',_0x37a9ed[_0x12cb('0x13')],_0x114da5);_0x139095(_0x1fd93b[_0x12cb('0x10')](0x1f4,_0x37a9ed[_0x12cb('0x13')]));});});}; \ No newline at end of file +var _0x6714=['then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','options','where','attributes','include','map','UpdateCmHopperBlack','update','body','raw','limit','stringify','DestroyCmHopperBlack','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0xbf9b86,_0x459857){var _0x76c5db=function(_0x36ea37){while(--_0x36ea37){_0xbf9b86['push'](_0xbf9b86['shift']());}};_0x76c5db(++_0x459857);}(_0x6714,0x139));var _0x4671=function(_0x55d829,_0x43f06c){_0x55d829=_0x55d829-0x0;var _0x52163b=_0x6714[_0x55d829];return _0x52163b;};'use strict';var _=require(_0x4671('0x0'));var util=require(_0x4671('0x1'));var moment=require(_0x4671('0x2'));var BPromise=require(_0x4671('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4671('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4671('0x5'))(_0x4671('0x6'));var config=require(_0x4671('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4671('0x8')][_0x4671('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4432fe,_0x8b5df0,_0x3f7938){return new BPromise(function(_0x1a9e3e,_0x34d02e){return client[_0x4671('0xa')](_0x4432fe,_0x3f7938)[_0x4671('0xb')](function(_0x229b69){logger[_0x4671('0xc')](_0x4671('0xd'),_0x8b5df0,_0x4671('0xe'));logger[_0x4671('0xf')](_0x4671('0x10'),_0x8b5df0,_0x4671('0xe'),JSON['stringify'](_0x229b69));if(_0x229b69[_0x4671('0x11')]){if(_0x229b69[_0x4671('0x11')][_0x4671('0x12')]===0x1f4){logger['error'](_0x4671('0xd'),_0x8b5df0,_0x229b69['error'][_0x4671('0x13')]);return _0x34d02e(_0x229b69[_0x4671('0x11')][_0x4671('0x13')]);}logger[_0x4671('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x8b5df0,_0x229b69[_0x4671('0x11')][_0x4671('0x13')]);return _0x1a9e3e(_0x229b69[_0x4671('0x11')]['message']);}else{logger[_0x4671('0xc')](_0x4671('0xd'),_0x8b5df0,'request\x20sent');_0x1a9e3e(_0x229b69[_0x4671('0x14')][_0x4671('0x13')]);}})[_0x4671('0x15')](function(_0x4ba088){logger[_0x4671('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x8b5df0,_0x4ba088);_0x34d02e(_0x4ba088);});});}exports[_0x4671('0x16')]=function(_0x1dadbc){var _0x2a571e=this;return new Promise(function(_0x54c72d,_0x629e49){return db[_0x4671('0x17')]['findAll']({'raw':_0x1dadbc[_0x4671('0x18')]?_0x1dadbc[_0x4671('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1dadbc[_0x4671('0x18')]?_0x1dadbc[_0x4671('0x18')][_0x4671('0x19')]||null:null,'attributes':_0x1dadbc[_0x4671('0x18')]?_0x1dadbc[_0x4671('0x18')][_0x4671('0x1a')]||null:null,'limit':_0x1dadbc[_0x4671('0x18')]?_0x1dadbc[_0x4671('0x18')]['limit']||null:null,'include':_0x1dadbc[_0x4671('0x18')]?_0x1dadbc[_0x4671('0x18')][_0x4671('0x1b')]?_[_0x4671('0x1c')](_0x1dadbc['options']['include'],function(_0xadeaa6){return{'model':db[_0xadeaa6['model']],'as':_0xadeaa6['as'],'attributes':_0xadeaa6['attributes'],'include':_0xadeaa6[_0x4671('0x1b')]?_[_0x4671('0x1c')](_0xadeaa6[_0x4671('0x1b')],function(_0x1235d1){return{'model':db[_0x1235d1['model']],'as':_0x1235d1['as'],'attributes':_0x1235d1['attributes'],'include':_0x1235d1[_0x4671('0x1b')]?_[_0x4671('0x1c')](_0x1235d1[_0x4671('0x1b')],function(_0x2a77cf){return{'model':db[_0x2a77cf['model']],'as':_0x2a77cf['as'],'attributes':_0x2a77cf['attributes']};}):[]};}):[]};}):[]:[]})[_0x4671('0xb')](function(_0x412c32){logger[_0x4671('0xc')](_0x4671('0x16'),_0x1dadbc);logger[_0x4671('0xf')](_0x4671('0x16'),_0x1dadbc,JSON['stringify'](_0x412c32));_0x54c72d(_0x412c32);})[_0x4671('0x15')](function(_0x2413fd){logger[_0x4671('0x11')](_0x4671('0x16'),_0x2413fd[_0x4671('0x13')],_0x1dadbc);_0x629e49(_0x2a571e[_0x4671('0x11')](0x1f4,_0x2413fd[_0x4671('0x13')]));});});};exports[_0x4671('0x1d')]=function(_0xef1566){var _0x262392=this;return new Promise(function(_0x4632c0,_0x148f5f){return db[_0x4671('0x17')][_0x4671('0x1e')](_0xef1566[_0x4671('0x1f')],{'raw':_0xef1566[_0x4671('0x18')]?_0xef1566['options'][_0x4671('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xef1566[_0x4671('0x18')]?_0xef1566[_0x4671('0x18')][_0x4671('0x19')]||null:null,'attributes':_0xef1566[_0x4671('0x18')]?_0xef1566[_0x4671('0x18')][_0x4671('0x1a')]||null:null,'limit':_0xef1566[_0x4671('0x18')]?_0xef1566['options'][_0x4671('0x21')]||null:null})[_0x4671('0xb')](function(_0x45a72c){logger[_0x4671('0xc')]('UpdateCmHopperBlack',_0xef1566);logger[_0x4671('0xf')]('UpdateCmHopperBlack',_0xef1566,JSON[_0x4671('0x22')](_0x45a72c));_0x4632c0(_0x45a72c);})['catch'](function(_0x275dd9){logger[_0x4671('0x11')](_0x4671('0x1d'),_0x275dd9[_0x4671('0x13')],_0xef1566);_0x148f5f(_0x262392[_0x4671('0x11')](0x1f4,_0x275dd9[_0x4671('0x13')]));});});};exports[_0x4671('0x23')]=function(_0x39765d){var _0x4b5501=this;return new Promise(function(_0x40f3e4,_0x49baad){return db[_0x4671('0x17')]['destroy']({'where':_0x39765d[_0x4671('0x18')]?_0x39765d[_0x4671('0x18')][_0x4671('0x19')]||null:null})[_0x4671('0xb')](function(_0x586d7b){logger[_0x4671('0xc')](_0x4671('0x23'),_0x39765d);logger['debug'](_0x4671('0x23'),_0x39765d,JSON[_0x4671('0x22')](_0x586d7b));_0x40f3e4(_0x586d7b);})[_0x4671('0x15')](function(_0x4b8b62){logger[_0x4671('0x11')](_0x4671('0x23'),_0x4b8b62['message'],_0x39765d);_0x49baad(_0x4b5501['error'](0x1f4,_0x4b8b62['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 44397d7..6a660bf 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 _0x7ee1=['Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','index','isAuthenticated','/:id','delete','destroy','multer','express'];(function(_0x352015,_0x348a8f){var _0x138265=function(_0x14da26){while(--_0x14da26){_0x352015['push'](_0x352015['shift']());}};_0x138265(++_0x348a8f);}(_0x7ee1,0x8d));var _0x17ee=function(_0x5b917b,_0x5dbce8){_0x5b917b=_0x5b917b-0x0;var _0x1ffc12=_0x7ee1[_0x5b917b];return _0x1ffc12;};'use strict';var multer=require(_0x17ee('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x17ee('0x1'));var router=express[_0x17ee('0x2')]();var fs_extra=require(_0x17ee('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x17ee('0x4'));var config=require(_0x17ee('0x5'));var controller=require(_0x17ee('0x6'));router[_0x17ee('0x7')]('/',auth['isAuthenticated'](),controller[_0x17ee('0x8')]);router[_0x17ee('0x7')]('/describe',auth[_0x17ee('0x9')](),controller['describe']);router[_0x17ee('0x7')](_0x17ee('0xa'),auth[_0x17ee('0x9')](),controller['show']);router['put']('/:id',auth[_0x17ee('0x9')](),controller['update']);router[_0x17ee('0xb')](_0x17ee('0xa'),auth[_0x17ee('0x9')](),controller[_0x17ee('0xc')]);module['exports']=router; \ No newline at end of file +var _0xaa3f=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show','put','update','delete','destroy','exports','multer','util'];(function(_0x4f52ca,_0x5cecff){var _0xba3423=function(_0x14b09f){while(--_0x14b09f){_0x4f52ca['push'](_0x4f52ca['shift']());}};_0xba3423(++_0x5cecff);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x2879b1,_0x2ec5f7){_0x2879b1=_0x2879b1-0x0;var _0x5ee9e9=_0xaa3f[_0x2879b1];return _0x5ee9e9;};'use strict';var multer=require(_0xfaa3('0x0'));var util=require(_0xfaa3('0x1'));var path=require(_0xfaa3('0x2'));var timeout=require(_0xfaa3('0x3'));var express=require(_0xfaa3('0x4'));var router=express[_0xfaa3('0x5')]();var fs_extra=require(_0xfaa3('0x6'));var auth=require(_0xfaa3('0x7'));var interaction=require(_0xfaa3('0x8'));var config=require('../../config/environment');var controller=require('./cmHopperBlack.controller');router[_0xfaa3('0x9')]('/',auth['isAuthenticated'](),controller[_0xfaa3('0xa')]);router[_0xfaa3('0x9')](_0xfaa3('0xb'),auth[_0xfaa3('0xc')](),controller[_0xfaa3('0xd')]);router[_0xfaa3('0x9')](_0xfaa3('0xe'),auth['isAuthenticated'](),controller[_0xfaa3('0xf')]);router[_0xfaa3('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xfaa3('0x11')]);router[_0xfaa3('0x12')](_0xfaa3('0xe'),auth[_0xfaa3('0xc')](),controller[_0xfaa3('0x13')]);module[_0xfaa3('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 12ae9e1..c43e369 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 _0xa2e1=['endtime','setDataValue','diff','seconds','BOOLEAN','sequelize','INTEGER','STRING','DATE'];(function(_0x511d4f,_0x43db6b){var _0xd05093=function(_0xcaf5d6){while(--_0xcaf5d6){_0x511d4f['push'](_0x511d4f['shift']());}};_0xd05093(++_0x43db6b);}(_0xa2e1,0xf8));var _0x1a2e=function(_0x3c7692,_0x5d7a2b){_0x3c7692=_0x3c7692-0x0;var _0x3f4c30=_0xa2e1[_0x3c7692];return _0x3f4c30;};'use strict';var Sequelize=require(_0x1a2e('0x0'));var moment=require('moment');module['exports']={'state':{'type':Sequelize[_0x1a2e('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x1a2e('0x2')]},'scheduledat':{'type':Sequelize[_0x1a2e('0x3')]},'countbusyretry':{'type':Sequelize[_0x1a2e('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1a2e('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1a2e('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x1a2e('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x1a2e('0x2')]},'originatecalleridname':{'type':Sequelize[_0x1a2e('0x2')]},'calleridnum':{'type':Sequelize[_0x1a2e('0x2')]},'calleridname':{'type':Sequelize[_0x1a2e('0x2')]},'starttime':{'type':Sequelize[_0x1a2e('0x3')]},'responsetime':{'type':Sequelize[_0x1a2e('0x3')]},'answertime':{'type':Sequelize[_0x1a2e('0x3')]},'droptime':{'type':Sequelize[_0x1a2e('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x1a2e('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x1a2e('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x1a2e('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x1a2e('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x1a2e('0x2')]},'campaign':{'type':Sequelize[_0x1a2e('0x2')]},'campaigntype':{'type':Sequelize[_0x1a2e('0x2')]},'membername':{'type':Sequelize[_0x1a2e('0x2')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x1a2e('0x2')]},'thirdDisposition':{'type':Sequelize[_0x1a2e('0x2')]},'dispositionat':{'type':Sequelize[_0x1a2e('0x3')],'set':function(_0x53741b){var _0x422d11=this['getDataValue'](_0x1a2e('0x4'));if(_0x422d11&&_0x53741b){this[_0x1a2e('0x5')]('followuptime',moment(_0x53741b)[_0x1a2e('0x6')](moment(_0x422d11),_0x1a2e('0x7')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x1a2e('0x8')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x1a2e('0x8')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x1a2e('0x3')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1a2e('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1a2e('0x3')]},'deleted':{'type':Sequelize[_0x1a2e('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x1a2e('0x8')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x1a2e('0x3')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1a2e('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1a2e('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1a2e('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1a2e('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x463c=['BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x463c,0x18d));var _0xc463=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x463c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc463('0x0'));var moment=require(_0xc463('0x1'));module[_0xc463('0x2')]={'state':{'type':Sequelize[_0xc463('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xc463('0x4')]},'scheduledat':{'type':Sequelize[_0xc463('0x5')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xc463('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xc463('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xc463('0x4')]},'calleridnum':{'type':Sequelize[_0xc463('0x4')]},'calleridname':{'type':Sequelize[_0xc463('0x4')]},'starttime':{'type':Sequelize[_0xc463('0x5')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xc463('0x5')]},'endtime':{'type':Sequelize[_0xc463('0x5')]},'ringtime':{'type':Sequelize[_0xc463('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xc463('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xc463('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xc463('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xc463('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xc463('0x4')]},'dispositionat':{'type':Sequelize[_0xc463('0x5')],'set':function(_0xc535cc){var _0x1c6ca8=this[_0xc463('0x6')](_0xc463('0x7'));if(_0x1c6ca8&&_0xc535cc){this[_0xc463('0x8')](_0xc463('0x9'),moment(_0xc535cc)[_0xc463('0xa')](moment(_0x1c6ca8),'seconds'));}}},'amd':{'type':Sequelize[_0xc463('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0xc463('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xc463('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xc463('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xc463('0x5')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xc463('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xc463('0x5')]},'deleted':{'type':Sequelize[_0xc463('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xc463('0x5')]},'recallme':{'type':Sequelize[_0xc463('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0xc463('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xc463('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xc463('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xc463('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index eeb7a1c..c2b281a 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 _0x1623=['reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','dropContacts','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','phone','scheduledAt','ListId','createdAt','select','ANY_VALUE(calleridnum)','field','NOW()','ContactId','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','cm_hopper_final','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','from','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','VoiceQueueId\x20=\x20?','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','updatedAt','ANY_VALUE(ContactId)','ANY_VALUE(CampaignId)','CampaignId','CampaignId\x20=\x20?','checkContactHopper','findOne','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','options','CmHopperFinal','findAll','rows','catch','show','params','length','find','describe','body','uniqueid','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','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','abandonedContacts'];(function(_0x13a46a,_0x563f49){var _0x4405c8=function(_0x23ecd2){while(--_0x23ecd2){_0x13a46a['push'](_0x13a46a['shift']());}};_0x4405c8(++_0x563f49);}(_0x1623,0xab));var _0x3162=function(_0x18ccf2,_0x47188c){_0x18ccf2=_0x18ccf2-0x0;var _0x19d1a9=_0x1623[_0x18ccf2];return _0x19d1a9;};'use strict';var emlformat=require(_0x3162('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3162('0x1'));var rp=require(_0x3162('0x2'));var moment=require(_0x3162('0x3'));var BPromise=require(_0x3162('0x4'));var Mustache=require(_0x3162('0x5'));var util=require('util');var path=require('path');var sox=require(_0x3162('0x6'));var csv=require('to-csv');var ejs=require(_0x3162('0x7'));var fs=require('fs');var fs_extra=require(_0x3162('0x8'));var _=require('lodash');var squel=require(_0x3162('0x9'));var crypto=require(_0x3162('0xa'));var jsforce=require(_0x3162('0xb'));var deskjs=require(_0x3162('0xc'));var toCsv=require(_0x3162('0xd'));var querystring=require(_0x3162('0xe'));var Papa=require(_0x3162('0xf'));var Redis=require(_0x3162('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3162('0x11'));var hardwareService=require(_0x3162('0x12'));var logger=require(_0x3162('0x13'))(_0x3162('0x14'));var utils=require(_0x3162('0x15'));var config=require(_0x3162('0x16'));var licenseUtil=require(_0x3162('0x17'));var db=require(_0x3162('0x18'))['db'];function respondWithStatusCode(_0x157ab8,_0x4c3625){_0x4c3625=_0x4c3625||0xcc;return function(_0x2d11c5){if(_0x2d11c5){return _0x157ab8['sendStatus'](_0x4c3625);}return _0x157ab8[_0x3162('0x19')](_0x4c3625)[_0x3162('0x1a')]();};}function respondWithResult(_0x49d1ad,_0x4a393a){_0x4a393a=_0x4a393a||0xc8;return function(_0x198764){if(_0x198764){return _0x49d1ad[_0x3162('0x19')](_0x4a393a)[_0x3162('0x1b')](_0x198764);}};}function respondWithFilteredResult(_0x4b8a3b,_0x15e348){return function(_0x3d0bea){if(_0x3d0bea){var _0x2705d1=typeof _0x15e348['offset']===_0x3162('0x1c')&&typeof _0x15e348[_0x3162('0x1d')]===_0x3162('0x1c');var _0xc3ee06=_0x3d0bea[_0x3162('0x1e')];var _0x1eed46=_0x2705d1?0x0:_0x15e348[_0x3162('0x1f')];var _0x4b2bf3=_0x2705d1?_0x3d0bea[_0x3162('0x1e')]:_0x15e348[_0x3162('0x1f')]+_0x15e348[_0x3162('0x1d')];var _0x36ca97;if(_0x4b2bf3>=_0xc3ee06){_0x4b2bf3=_0xc3ee06;_0x36ca97=0xc8;}else{_0x36ca97=0xce;}_0x4b8a3b['status'](_0x36ca97);return _0x4b8a3b[_0x3162('0x20')]('Content-Range',_0x1eed46+'-'+_0x4b2bf3+'/'+_0xc3ee06)['json'](_0x3d0bea);}return null;};}function patchUpdates(_0xa5c62b){return function(_0x3e4d23){try{jsonpatch[_0x3162('0x21')](_0x3e4d23,_0xa5c62b,!![]);}catch(_0x523fab){return BPromise['reject'](_0x523fab);}return _0x3e4d23[_0x3162('0x22')]();};}function saveUpdates(_0x396372,_0x32c051){return function(_0x26c90d){if(_0x26c90d){return _0x26c90d[_0x3162('0x23')](_0x396372)[_0x3162('0x24')](function(_0x52ae25){return _0x52ae25;});}return null;};}function removeEntity(_0x1b2713,_0x5a4994){return function(_0xd283d6){if(_0xd283d6){return _0xd283d6[_0x3162('0x25')]()[_0x3162('0x24')](function(){_0x1b2713[_0x3162('0x19')](0xcc)[_0x3162('0x1a')]();});}};}function handleEntityNotFound(_0x3c543e,_0x30552f){return function(_0x5f8f7){if(!_0x5f8f7){_0x3c543e[_0x3162('0x26')](0x194);}return _0x5f8f7;};}function handleError(_0x356c5d,_0x8fa09f){_0x8fa09f=_0x8fa09f||0x1f4;return function(_0x2f62d7){logger[_0x3162('0x27')](_0x2f62d7['stack']);if(_0x2f62d7[_0x3162('0x28')]){delete _0x2f62d7['name'];}_0x356c5d[_0x3162('0x19')](_0x8fa09f)[_0x3162('0x29')](_0x2f62d7);};}exports[_0x3162('0x2a')]=function(_0x57f567,_0x4903e7){var _0xda0389={},_0xaa1f35={},_0x14df16={'count':0x0,'rows':[]};var _0x399148=_[_0x3162('0x2b')](db['CmHopperFinal'][_0x3162('0x2c')],function(_0x4e3cc2){return{'name':_0x4e3cc2[_0x3162('0x2d')],'type':_0x4e3cc2[_0x3162('0x2e')][_0x3162('0x2f')]};});_0xaa1f35[_0x3162('0x30')]=_[_0x3162('0x2b')](_0x399148,_0x3162('0x28'));_0xaa1f35[_0x3162('0x31')]=_[_0x3162('0x32')](_0x57f567['query']);_0xaa1f35[_0x3162('0x33')]=_[_0x3162('0x34')](_0xaa1f35['model'],_0xaa1f35[_0x3162('0x31')]);_0xda0389[_0x3162('0x35')]=_['intersection'](_0xaa1f35['model'],qs[_0x3162('0x36')](_0x57f567['query'][_0x3162('0x36')]));_0xda0389[_0x3162('0x35')]=_0xda0389[_0x3162('0x35')]['length']?_0xda0389['attributes']:_0xaa1f35[_0x3162('0x30')];if(!_0x57f567[_0x3162('0x31')]['hasOwnProperty'](_0x3162('0x37'))){_0xda0389['limit']=qs[_0x3162('0x1d')](_0x57f567[_0x3162('0x31')][_0x3162('0x1d')]);_0xda0389[_0x3162('0x1f')]=qs[_0x3162('0x1f')](_0x57f567[_0x3162('0x31')][_0x3162('0x1f')]);}_0xda0389[_0x3162('0x38')]=qs[_0x3162('0x39')](_0x57f567[_0x3162('0x31')][_0x3162('0x39')]);_0xda0389['where']=qs[_0x3162('0x33')](_[_0x3162('0x3a')](_0x57f567[_0x3162('0x31')],_0xaa1f35['filters']),_0x399148);if(_0x57f567['query'][_0x3162('0x3b')]){_0xda0389[_0x3162('0x3c')]=_[_0x3162('0x3d')](_0xda0389[_0x3162('0x3c')],{'$or':_['map'](_0x399148,function(_0x4186b6){if(_0x4186b6['type']!=='VIRTUAL'){var _0x5dee49={};_0x5dee49[_0x4186b6[_0x3162('0x28')]]={'$like':'%'+_0x57f567[_0x3162('0x31')][_0x3162('0x3b')]+'%'};return _0x5dee49;}})});}_0xda0389=_['merge']({},_0xda0389,_0x57f567[_0x3162('0x3e')]);var _0x2ce9c6={'where':_0xda0389[_0x3162('0x3c')]};return db[_0x3162('0x3f')][_0x3162('0x1e')](_0x2ce9c6)['then'](function(_0x5447d6){_0x14df16[_0x3162('0x1e')]=_0x5447d6;if(_0x57f567[_0x3162('0x31')]['includeAll']){_0xda0389['include']=[{'all':!![]}];}return db[_0x3162('0x3f')][_0x3162('0x40')](_0xda0389);})[_0x3162('0x24')](function(_0x4883ac){_0x14df16[_0x3162('0x41')]=_0x4883ac;return _0x14df16;})[_0x3162('0x24')](respondWithFilteredResult(_0x4903e7,_0xda0389))[_0x3162('0x42')](handleError(_0x4903e7,null));};exports[_0x3162('0x43')]=function(_0x534708,_0x2617d3){var _0x282e3e={'raw':!![],'where':{'id':_0x534708[_0x3162('0x44')]['id']}},_0x522cce={};_0x522cce[_0x3162('0x30')]=_['keys'](db[_0x3162('0x3f')][_0x3162('0x2c')]);_0x522cce['query']=_[_0x3162('0x32')](_0x534708['query']);_0x522cce[_0x3162('0x33')]=_[_0x3162('0x34')](_0x522cce[_0x3162('0x30')],_0x522cce[_0x3162('0x31')]);_0x282e3e[_0x3162('0x35')]=_[_0x3162('0x34')](_0x522cce['model'],qs[_0x3162('0x36')](_0x534708[_0x3162('0x31')][_0x3162('0x36')]));_0x282e3e['attributes']=_0x282e3e[_0x3162('0x35')][_0x3162('0x45')]?_0x282e3e['attributes']:_0x522cce[_0x3162('0x30')];if(_0x534708['query']['includeAll']){_0x282e3e['include']=[{'all':!![]}];}_0x282e3e=_[_0x3162('0x3d')]({},_0x282e3e,_0x534708[_0x3162('0x3e')]);return db[_0x3162('0x3f')][_0x3162('0x46')](_0x282e3e)[_0x3162('0x24')](handleEntityNotFound(_0x2617d3,null))[_0x3162('0x24')](respondWithResult(_0x2617d3,null))[_0x3162('0x42')](handleError(_0x2617d3,null));};exports[_0x3162('0x47')]=function(_0x3d2958,_0x28865c){return db[_0x3162('0x3f')][_0x3162('0x47')]()[_0x3162('0x24')](respondWithResult(_0x28865c,null))['catch'](handleError(_0x28865c,null));};exports[_0x3162('0x23')]=function(_0x48cb8f,_0x4f1dde){if(_0x48cb8f[_0x3162('0x48')][_0x3162('0x49')]){delete _0x48cb8f[_0x3162('0x48')][_0x3162('0x49')];}return db['CmHopperFinal'][_0x3162('0x46')]({'where':{'uniqueid':_0x48cb8f['params']['id']}})[_0x3162('0x24')](handleEntityNotFound(_0x4f1dde,null))[_0x3162('0x24')](saveUpdates(_0x48cb8f['body'],null))[_0x3162('0x24')](respondWithResult(_0x4f1dde,null))['catch'](handleError(_0x4f1dde,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x13e7c4,_0x22c0a2,_0x160364){return db[_0x3162('0x3f')][_0x3162('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x13e7c4[_0x3162('0x44')]['id']},'attributes':[[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x3162('0x4c')))),_0x3162('0x4d')],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')]('`state`\x20=\x203,\x201,\x20null'))),_0x3162('0x4f')],[db['sequelize']['fn'](_0x3162('0x4b'),db['sequelize']['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x50')))),_0x3162('0x51')],[db['sequelize']['fn']('COUNT',db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x52')))),_0x3162('0x53')],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db['sequelize'][_0x3162('0x4e')](_0x3162('0x54')))),'dropContacts'],[db['sequelize']['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x55')))),_0x3162('0x56')],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db['sequelize']['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0x3162('0x57')],[db['sequelize']['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x58')))),_0x3162('0x59')]]})[_0x3162('0x24')](handleEntityNotFound(_0x22c0a2,null))[_0x3162('0x24')](respondWithResult(_0x22c0a2,null))[_0x3162('0x42')](handleError(_0x22c0a2,null));};exports[_0x3162('0x5a')]=function(_0x4b5729,_0x4a42ea,_0x520b1a){return db[_0x3162('0x3f')]['findAll']({'raw':![],'where':{'CampaignId':_0x4b5729[_0x3162('0x44')]['id']},'attributes':[[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0x3162('0x4d')],[db[_0x3162('0x4a')]['fn']('COUNT',db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')](_0x3162('0x5b')))),_0x3162('0x4f')],[db['sequelize']['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')](_0x3162('0x50')))),'busyContacts'],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x52')))),_0x3162('0x53')],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')](_0x3162('0x54')))),_0x3162('0x5c')],[db[_0x3162('0x4a')]['fn']('COUNT',db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x55')))),'abandonedContacts'],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')](_0x3162('0x5d')))),'reCallContacts'],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')](_0x3162('0x58')))),'answeringMachine']]})[_0x3162('0x24')](handleEntityNotFound(_0x4a42ea,null))[_0x3162('0x24')](respondWithResult(_0x4a42ea,null))[_0x3162('0x42')](handleError(_0x4a42ea,null));};exports[_0x3162('0x5e')]=function(_0x8a75ca,_0x33c39d,_0xb3d824){return db['VoiceQueue']['find']({'where':{'id':_0x8a75ca['params']['id']}})[_0x3162('0x24')](handleEntityNotFound(_0x33c39d,null))[_0x3162('0x24')](function(_0x59b3f7){var _0x129005;if(_0x59b3f7){_0x129005=squel[_0x3162('0x5f')]()[_0x3162('0x60')](_0x3162('0x61'))['fromQuery']([_0x3162('0x62'),_0x3162('0x63'),'ContactId',_0x3162('0x64'),'VoiceQueueId',_0x3162('0x65'),'updatedAt'],squel[_0x3162('0x66')]()['field'](_0x3162('0x67'),_0x3162('0x62'))[_0x3162('0x68')](_0x3162('0x69'),_0x3162('0x63'))[_0x3162('0x68')]('ANY_VALUE(ContactId)',_0x3162('0x6a'))[_0x3162('0x68')](_0x3162('0x6b'),'ListId')[_0x3162('0x68')](_0x3162('0x6c'),_0x3162('0x6d'))[_0x3162('0x68')](_0x3162('0x69'),'createdAt')[_0x3162('0x68')](_0x3162('0x69'),'updatedAt')['from'](_0x3162('0x6e'))[_0x3162('0x3c')]('VoiceQueueId\x20=\x20?',_0x8a75ca[_0x3162('0x44')]['id'][_0x3162('0x6f')]())[_0x3162('0x3c')](_0x3162('0x70'),_0x8a75ca[_0x3162('0x48')][_0x3162('0x71')][_0x3162('0x6f')]())[_0x3162('0x3c')](_0x3162('0x72'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x3162('0x66')]()[_0x3162('0x68')]('phone')[_0x3162('0x73')]('cm_hopper')['where']('VoiceQueueId\x20=\x20?',_0x8a75ca[_0x3162('0x44')]['id']['toString']()))[_0x3162('0x3c')](_0x3162('0x74'),squel[_0x3162('0x66')]()[_0x3162('0x68')](_0x3162('0x75'))[_0x3162('0x73')](_0x3162('0x6e'))[_0x3162('0x3c')](_0x3162('0x76'),_0x8a75ca[_0x3162('0x44')]['id'][_0x3162('0x6f')]())['where'](_0x3162('0x77')))[_0x3162('0x78')](_0x3162('0x6a')))[_0x3162('0x6f')]();return db[_0x3162('0x4a')][_0x3162('0x31')](_0x129005);}return[];})[_0x3162('0x24')](respondWithResult(_0x33c39d,null))[_0x3162('0x42')](handleError(_0x33c39d,null));};exports[_0x3162('0x79')]=function(_0x3f37fa,_0x1d242f,_0x190f91){return db['Campaign'][_0x3162('0x46')]({'where':{'id':_0x3f37fa[_0x3162('0x44')]['id']}})[_0x3162('0x24')](handleEntityNotFound(_0x1d242f,null))['then'](function(_0x3d7bd1){var _0x5cdbb0;if(_0x3d7bd1){_0x5cdbb0=squel[_0x3162('0x5f')]()[_0x3162('0x60')]('cm_hopper')['fromQuery']([_0x3162('0x62'),_0x3162('0x63'),'ContactId',_0x3162('0x64'),'CampaignId',_0x3162('0x65'),_0x3162('0x7a')],squel[_0x3162('0x66')]()[_0x3162('0x68')](_0x3162('0x67'),_0x3162('0x62'))[_0x3162('0x68')](_0x3162('0x69'),_0x3162('0x63'))['field'](_0x3162('0x7b'),'ContactId')[_0x3162('0x68')](_0x3162('0x6b'),'ListId')[_0x3162('0x68')](_0x3162('0x7c'),_0x3162('0x7d'))[_0x3162('0x68')](_0x3162('0x69'),_0x3162('0x65'))[_0x3162('0x68')]('NOW()',_0x3162('0x7a'))[_0x3162('0x73')](_0x3162('0x6e'))['where'](_0x3162('0x7e'),_0x3f37fa[_0x3162('0x44')]['id'][_0x3162('0x6f')]())[_0x3162('0x3c')](_0x3162('0x70'),_0x3f37fa[_0x3162('0x48')]['state'][_0x3162('0x6f')]())[_0x3162('0x3c')](_0x3162('0x72'))[_0x3162('0x3c')](_0x3162('0x74'),squel['select']()[_0x3162('0x68')]('phone')[_0x3162('0x73')](_0x3162('0x61'))['where'](_0x3162('0x7e'),_0x3f37fa[_0x3162('0x44')]['id'][_0x3162('0x6f')]()))['where'](_0x3162('0x74'),squel['select']()['field'](_0x3162('0x75'))[_0x3162('0x73')](_0x3162('0x6e'))[_0x3162('0x3c')](_0x3162('0x7e'),_0x3f37fa[_0x3162('0x44')]['id'][_0x3162('0x6f')]())['where']('state\x20=\x204'))['group'](_0x3162('0x6a')))[_0x3162('0x6f')]();return db['sequelize']['query'](_0x5cdbb0);}return[];})[_0x3162('0x24')](respondWithResult(_0x1d242f,null))['catch'](handleError(_0x1d242f,null));};exports[_0x3162('0x7f')]=function(_0x35d9f0,_0x4408db,_0x377edb){return db['CmHopper'][_0x3162('0x80')]({'where':{'VoiceQueueId':_0x35d9f0[_0x3162('0x48')][_0x3162('0x6d')],'CampaignId':_0x35d9f0['body'][_0x3162('0x7d')],'ContactId':_0x35d9f0['body'][_0x3162('0x6a')]}})['then'](handleEntityNotFound(_0x4408db,null))[_0x3162('0x24')](function(_0x3d414f){if(_0x3d414f){return _0x3d414f;}return null;})[_0x3162('0x24')](respondWithResult(_0x4408db,null))['catch'](handleError(_0x4408db,null));}; \ No newline at end of file +var _0x2675=['lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','destroy','then','error','name','send','index','map','CmHopperFinal','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','rows','catch','show','rawAttributes','length','options','find','describe','body','uniqueid','params','findAll','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','noSuchContacts','busyContacts','abandonedContacts','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','VoiceQueueId','createdAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','updatedAt','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','select','phone','from','calleridnum','cm_hopper_final','state\x20=\x204','moveContactsIvrCampaignHopperFinal','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum\x20NOT\x20IN\x20(?)','group','eml-format','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra'];(function(_0x555255,_0x264e4c){var _0x55c4fb=function(_0x117357){while(--_0x117357){_0x555255['push'](_0x555255['shift']());}};_0x55c4fb(++_0x264e4c);}(_0x2675,0x75));var _0x5267=function(_0x360aea,_0x5a7c0b){_0x360aea=_0x360aea-0x0;var _0x331aec=_0x2675[_0x360aea];return _0x331aec;};'use strict';var emlformat=require(_0x5267('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5267('0x1'));var moment=require(_0x5267('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5267('0x3'));var util=require(_0x5267('0x4'));var path=require('path');var sox=require(_0x5267('0x5'));var csv=require(_0x5267('0x6'));var ejs=require(_0x5267('0x7'));var fs=require('fs');var fs_extra=require(_0x5267('0x8'));var _=require(_0x5267('0x9'));var squel=require(_0x5267('0xa'));var crypto=require('crypto');var jsforce=require(_0x5267('0xb'));var deskjs=require(_0x5267('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5267('0xd'));var Papa=require('papaparse');var Redis=require(_0x5267('0xe'));var authService=require(_0x5267('0xf'));var qs=require(_0x5267('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5267('0x11'));var logger=require('../../config/logger')(_0x5267('0x12'));var utils=require('../../config/utils');var config=require(_0x5267('0x13'));var licenseUtil=require(_0x5267('0x14'));var db=require(_0x5267('0x15'))['db'];function respondWithStatusCode(_0x1f9be3,_0x1d7090){_0x1d7090=_0x1d7090||0xcc;return function(_0x1171b9){if(_0x1171b9){return _0x1f9be3[_0x5267('0x16')](_0x1d7090);}return _0x1f9be3[_0x5267('0x17')](_0x1d7090)[_0x5267('0x18')]();};}function respondWithResult(_0x1e2d3b,_0x16e5a7){_0x16e5a7=_0x16e5a7||0xc8;return function(_0x29349a){if(_0x29349a){return _0x1e2d3b[_0x5267('0x17')](_0x16e5a7)['json'](_0x29349a);}};}function respondWithFilteredResult(_0x52e24e,_0xa593fb){return function(_0x40d897){if(_0x40d897){var _0x38a147=typeof _0xa593fb[_0x5267('0x19')]===_0x5267('0x1a')&&typeof _0xa593fb[_0x5267('0x1b')]===_0x5267('0x1a');var _0x6831e0=_0x40d897[_0x5267('0x1c')];var _0xb1c97a=_0x38a147?0x0:_0xa593fb[_0x5267('0x19')];var _0x1ab03=_0x38a147?_0x40d897['count']:_0xa593fb[_0x5267('0x19')]+_0xa593fb[_0x5267('0x1b')];var _0x5069e8;if(_0x1ab03>=_0x6831e0){_0x1ab03=_0x6831e0;_0x5069e8=0xc8;}else{_0x5069e8=0xce;}_0x52e24e[_0x5267('0x17')](_0x5069e8);return _0x52e24e['set'](_0x5267('0x1d'),_0xb1c97a+'-'+_0x1ab03+'/'+_0x6831e0)[_0x5267('0x1e')](_0x40d897);}return null;};}function patchUpdates(_0x39c0c3){return function(_0x2a9f99){try{jsonpatch[_0x5267('0x1f')](_0x2a9f99,_0x39c0c3,!![]);}catch(_0x4dd637){return BPromise[_0x5267('0x20')](_0x4dd637);}return _0x2a9f99['save']();};}function saveUpdates(_0xa32663,_0x420fb8){return function(_0x3b53ac){if(_0x3b53ac){return _0x3b53ac['update'](_0xa32663)['then'](function(_0x5546e2){return _0x5546e2;});}return null;};}function removeEntity(_0x4a17c7,_0x5ea6a6){return function(_0x26c7f8){if(_0x26c7f8){return _0x26c7f8[_0x5267('0x21')]()[_0x5267('0x22')](function(){_0x4a17c7[_0x5267('0x17')](0xcc)[_0x5267('0x18')]();});}};}function handleEntityNotFound(_0x40d1be,_0x126a97){return function(_0x220e03){if(!_0x220e03){_0x40d1be[_0x5267('0x16')](0x194);}return _0x220e03;};}function handleError(_0x59f112,_0x5cb64f){_0x5cb64f=_0x5cb64f||0x1f4;return function(_0x354111){logger[_0x5267('0x23')](_0x354111['stack']);if(_0x354111[_0x5267('0x24')]){delete _0x354111['name'];}_0x59f112['status'](_0x5cb64f)[_0x5267('0x25')](_0x354111);};}exports[_0x5267('0x26')]=function(_0x1f33b7,_0x2d2ace){var _0x33c431={},_0x4f3d4d={},_0x5e87eb={'count':0x0,'rows':[]};var _0x18020c=_[_0x5267('0x27')](db[_0x5267('0x28')]['rawAttributes'],function(_0x58d685){return{'name':_0x58d685[_0x5267('0x29')],'type':_0x58d685[_0x5267('0x2a')][_0x5267('0x2b')]};});_0x4f3d4d['model']=_['map'](_0x18020c,_0x5267('0x24'));_0x4f3d4d[_0x5267('0x2c')]=_[_0x5267('0x2d')](_0x1f33b7[_0x5267('0x2c')]);_0x4f3d4d['filters']=_[_0x5267('0x2e')](_0x4f3d4d[_0x5267('0x2f')],_0x4f3d4d[_0x5267('0x2c')]);_0x33c431[_0x5267('0x30')]=_[_0x5267('0x2e')](_0x4f3d4d[_0x5267('0x2f')],qs[_0x5267('0x31')](_0x1f33b7[_0x5267('0x2c')]['fields']));_0x33c431['attributes']=_0x33c431[_0x5267('0x30')]['length']?_0x33c431[_0x5267('0x30')]:_0x4f3d4d[_0x5267('0x2f')];if(!_0x1f33b7[_0x5267('0x2c')][_0x5267('0x32')]('nolimit')){_0x33c431[_0x5267('0x1b')]=qs[_0x5267('0x1b')](_0x1f33b7[_0x5267('0x2c')][_0x5267('0x1b')]);_0x33c431[_0x5267('0x19')]=qs[_0x5267('0x19')](_0x1f33b7[_0x5267('0x2c')][_0x5267('0x19')]);}_0x33c431['order']=qs[_0x5267('0x33')](_0x1f33b7['query'][_0x5267('0x33')]);_0x33c431[_0x5267('0x34')]=qs[_0x5267('0x35')](_[_0x5267('0x36')](_0x1f33b7[_0x5267('0x2c')],_0x4f3d4d[_0x5267('0x35')]),_0x18020c);if(_0x1f33b7[_0x5267('0x2c')]['filter']){_0x33c431[_0x5267('0x34')]=_[_0x5267('0x37')](_0x33c431[_0x5267('0x34')],{'$or':_[_0x5267('0x27')](_0x18020c,function(_0x82cea7){if(_0x82cea7[_0x5267('0x2a')]!==_0x5267('0x38')){var _0x487dfc={};_0x487dfc[_0x82cea7[_0x5267('0x24')]]={'$like':'%'+_0x1f33b7['query'][_0x5267('0x39')]+'%'};return _0x487dfc;}})});}_0x33c431=_['merge']({},_0x33c431,_0x1f33b7['options']);var _0x51bddd={'where':_0x33c431[_0x5267('0x34')]};return db['CmHopperFinal'][_0x5267('0x1c')](_0x51bddd)[_0x5267('0x22')](function(_0x3d4b19){_0x5e87eb[_0x5267('0x1c')]=_0x3d4b19;if(_0x1f33b7['query'][_0x5267('0x3a')]){_0x33c431[_0x5267('0x3b')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x33c431);})[_0x5267('0x22')](function(_0x560cdf){_0x5e87eb[_0x5267('0x3c')]=_0x560cdf;return _0x5e87eb;})[_0x5267('0x22')](respondWithFilteredResult(_0x2d2ace,_0x33c431))[_0x5267('0x3d')](handleError(_0x2d2ace,null));};exports[_0x5267('0x3e')]=function(_0x36d0f1,_0x3012cb){var _0x27add5={'raw':!![],'where':{'id':_0x36d0f1['params']['id']}},_0x5697b3={};_0x5697b3[_0x5267('0x2f')]=_['keys'](db[_0x5267('0x28')][_0x5267('0x3f')]);_0x5697b3['query']=_[_0x5267('0x2d')](_0x36d0f1[_0x5267('0x2c')]);_0x5697b3[_0x5267('0x35')]=_[_0x5267('0x2e')](_0x5697b3[_0x5267('0x2f')],_0x5697b3[_0x5267('0x2c')]);_0x27add5[_0x5267('0x30')]=_[_0x5267('0x2e')](_0x5697b3[_0x5267('0x2f')],qs['fields'](_0x36d0f1[_0x5267('0x2c')][_0x5267('0x31')]));_0x27add5[_0x5267('0x30')]=_0x27add5[_0x5267('0x30')][_0x5267('0x40')]?_0x27add5['attributes']:_0x5697b3[_0x5267('0x2f')];if(_0x36d0f1['query'][_0x5267('0x3a')]){_0x27add5['include']=[{'all':!![]}];}_0x27add5=_['merge']({},_0x27add5,_0x36d0f1[_0x5267('0x41')]);return db['CmHopperFinal'][_0x5267('0x42')](_0x27add5)[_0x5267('0x22')](handleEntityNotFound(_0x3012cb,null))[_0x5267('0x22')](respondWithResult(_0x3012cb,null))[_0x5267('0x3d')](handleError(_0x3012cb,null));};exports['describe']=function(_0x12d6a8,_0x4ee826){return db['CmHopperFinal'][_0x5267('0x43')]()[_0x5267('0x22')](respondWithResult(_0x4ee826,null))['catch'](handleError(_0x4ee826,null));};exports['update']=function(_0x383ebe,_0xe0439e){if(_0x383ebe[_0x5267('0x44')][_0x5267('0x45')]){delete _0x383ebe[_0x5267('0x44')][_0x5267('0x45')];}return db[_0x5267('0x28')][_0x5267('0x42')]({'where':{'uniqueid':_0x383ebe[_0x5267('0x46')]['id']}})[_0x5267('0x22')](handleEntityNotFound(_0xe0439e,null))[_0x5267('0x22')](saveUpdates(_0x383ebe[_0x5267('0x44')],null))[_0x5267('0x22')](respondWithResult(_0xe0439e,null))[_0x5267('0x3d')](handleError(_0xe0439e,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x8636d0,_0x466d46,_0x371486){return db['CmHopperFinal'][_0x5267('0x47')]({'raw':![],'where':{'VoiceQueueId':_0x8636d0[_0x5267('0x46')]['id']},'attributes':[[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')]['literal'](_0x5267('0x4a')))),'noSuchContacts'],[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')](_0x5267('0x4c')))),_0x5267('0x4d')],[db['sequelize']['fn']('COUNT',db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')]['literal'](_0x5267('0x4e')))),'busyContacts'],[db['sequelize']['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')](_0x5267('0x4f')))),_0x5267('0x50')],[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')]['literal'](_0x5267('0x51')))),_0x5267('0x52')],[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')]['literal'](_0x5267('0x53')))),'abandonedContacts'],[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db['sequelize'][_0x5267('0x4b')](_0x5267('0x54')))),_0x5267('0x55')],[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db['sequelize'][_0x5267('0x4b')](_0x5267('0x56')))),_0x5267('0x57')]]})[_0x5267('0x22')](handleEntityNotFound(_0x466d46,null))['then'](respondWithResult(_0x466d46,null))['catch'](handleError(_0x466d46,null));};exports[_0x5267('0x58')]=function(_0x5393e9,_0x3f5cda,_0x47059c){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x5393e9[_0x5267('0x46')]['id']},'attributes':[[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db['sequelize']['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')](_0x5267('0x4a')))),_0x5267('0x59')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')](_0x5267('0x4c')))),_0x5267('0x4d')],[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')]['literal'](_0x5267('0x4e')))),_0x5267('0x5a')],[db['sequelize']['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')](_0x5267('0x4f')))),_0x5267('0x50')],[db['sequelize']['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')](_0x5267('0x51')))),_0x5267('0x52')],[db['sequelize']['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')](_0x5267('0x53')))),_0x5267('0x5b')],[db['sequelize']['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')]('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db['sequelize']['fn'](_0x5267('0x49'),db['sequelize']['fn']('IF',db[_0x5267('0x48')]['literal'](_0x5267('0x56')))),_0x5267('0x57')]]})[_0x5267('0x22')](handleEntityNotFound(_0x3f5cda,null))[_0x5267('0x22')](respondWithResult(_0x3f5cda,null))[_0x5267('0x3d')](handleError(_0x3f5cda,null));};exports[_0x5267('0x5c')]=function(_0x21338f,_0x1103c5,_0x489b9a){return db['VoiceQueue']['find']({'where':{'id':_0x21338f[_0x5267('0x46')]['id']}})[_0x5267('0x22')](handleEntityNotFound(_0x1103c5,null))[_0x5267('0x22')](function(_0x457d84){var _0x4974d1;if(_0x457d84){_0x4974d1=squel[_0x5267('0x5d')]()[_0x5267('0x5e')](_0x5267('0x5f'))[_0x5267('0x60')](['phone',_0x5267('0x61'),_0x5267('0x62'),'ListId',_0x5267('0x63'),_0x5267('0x64'),'updatedAt'],squel['select']()[_0x5267('0x65')](_0x5267('0x66'),'phone')['field'](_0x5267('0x67'),_0x5267('0x61'))[_0x5267('0x65')](_0x5267('0x68'),_0x5267('0x62'))['field'](_0x5267('0x69'),_0x5267('0x6a'))['field'](_0x5267('0x6b'),_0x5267('0x63'))[_0x5267('0x65')](_0x5267('0x67'),_0x5267('0x64'))[_0x5267('0x65')](_0x5267('0x67'),_0x5267('0x6c'))['from']('cm_hopper_final')[_0x5267('0x34')](_0x5267('0x6d'),_0x21338f[_0x5267('0x46')]['id'][_0x5267('0x6e')]())['where'](_0x5267('0x6f'),_0x21338f['body'][_0x5267('0x70')][_0x5267('0x6e')]())[_0x5267('0x34')](_0x5267('0x71'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x5267('0x72')]()[_0x5267('0x65')](_0x5267('0x73'))[_0x5267('0x74')](_0x5267('0x5f'))[_0x5267('0x34')]('VoiceQueueId\x20=\x20?',_0x21338f[_0x5267('0x46')]['id']['toString']()))[_0x5267('0x34')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x5267('0x72')]()[_0x5267('0x65')](_0x5267('0x75'))[_0x5267('0x74')](_0x5267('0x76'))[_0x5267('0x34')](_0x5267('0x6d'),_0x21338f[_0x5267('0x46')]['id'][_0x5267('0x6e')]())[_0x5267('0x34')](_0x5267('0x77')))['group'](_0x5267('0x62')))[_0x5267('0x6e')]();return db['sequelize'][_0x5267('0x2c')](_0x4974d1);}return[];})[_0x5267('0x22')](respondWithResult(_0x1103c5,null))[_0x5267('0x3d')](handleError(_0x1103c5,null));};exports[_0x5267('0x78')]=function(_0xd18795,_0x37b007,_0x358543){return db['Campaign'][_0x5267('0x42')]({'where':{'id':_0xd18795[_0x5267('0x46')]['id']}})[_0x5267('0x22')](handleEntityNotFound(_0x37b007,null))[_0x5267('0x22')](function(_0x1cdf9f){var _0x4dbaa2;if(_0x1cdf9f){_0x4dbaa2=squel['insert']()[_0x5267('0x5e')](_0x5267('0x5f'))[_0x5267('0x60')]([_0x5267('0x73'),'scheduledAt',_0x5267('0x62'),_0x5267('0x6a'),_0x5267('0x79'),_0x5267('0x64'),_0x5267('0x6c')],squel[_0x5267('0x72')]()[_0x5267('0x65')](_0x5267('0x66'),_0x5267('0x73'))[_0x5267('0x65')](_0x5267('0x67'),_0x5267('0x61'))[_0x5267('0x65')]('ANY_VALUE(ContactId)',_0x5267('0x62'))[_0x5267('0x65')](_0x5267('0x69'),_0x5267('0x6a'))[_0x5267('0x65')](_0x5267('0x7a'),_0x5267('0x79'))[_0x5267('0x65')](_0x5267('0x67'),_0x5267('0x64'))[_0x5267('0x65')](_0x5267('0x67'),_0x5267('0x6c'))[_0x5267('0x74')](_0x5267('0x76'))[_0x5267('0x34')](_0x5267('0x7b'),_0xd18795[_0x5267('0x46')]['id'][_0x5267('0x6e')]())[_0x5267('0x34')](_0x5267('0x6f'),_0xd18795[_0x5267('0x44')][_0x5267('0x70')]['toString']())[_0x5267('0x34')](_0x5267('0x71'))[_0x5267('0x34')](_0x5267('0x7c'),squel[_0x5267('0x72')]()['field'](_0x5267('0x73'))[_0x5267('0x74')]('cm_hopper')['where']('CampaignId\x20=\x20?',_0xd18795[_0x5267('0x46')]['id']['toString']()))[_0x5267('0x34')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x5267('0x65')](_0x5267('0x75'))[_0x5267('0x74')](_0x5267('0x76'))[_0x5267('0x34')]('CampaignId\x20=\x20?',_0xd18795['params']['id'][_0x5267('0x6e')]())[_0x5267('0x34')](_0x5267('0x77')))[_0x5267('0x7d')](_0x5267('0x62')))['toString']();return db[_0x5267('0x48')]['query'](_0x4dbaa2);}return[];})['then'](respondWithResult(_0x37b007,null))[_0x5267('0x3d')](handleError(_0x37b007,null));};exports['checkContactHopper']=function(_0x5da8d6,_0x3ebe63,_0x321322){return db['CmHopper']['findOne']({'where':{'VoiceQueueId':_0x5da8d6['body'][_0x5267('0x63')],'CampaignId':_0x5da8d6['body'][_0x5267('0x79')],'ContactId':_0x5da8d6['body'][_0x5267('0x62')]}})[_0x5267('0x22')](handleEntityNotFound(_0x3ebe63,null))['then'](function(_0x1ae9fe){if(_0x1ae9fe){return _0x1ae9fe;}return null;})[_0x5267('0x22')](respondWithResult(_0x3ebe63,null))[_0x5267('0x3d')](handleError(_0x3ebe63,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 60db6b5..bdf6f38 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 _0xe9f8=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','calleridnum','uniqueid','lodash','../../config/logger','api','moment'];(function(_0x3c308f,_0x2bf716){var _0x2bf80a=function(_0x397c13){while(--_0x397c13){_0x3c308f['push'](_0x3c308f['shift']());}};_0x2bf80a(++_0x2bf716);}(_0xe9f8,0x122));var _0x8e9f=function(_0x2ca9d4,_0x51d5c6){_0x2ca9d4=_0x2ca9d4-0x0;var _0x258956=_0xe9f8[_0x2ca9d4];return _0x258956;};'use strict';var _=require(_0x8e9f('0x0'));var util=require('util');var logger=require(_0x8e9f('0x1'))(_0x8e9f('0x2'));var moment=require(_0x8e9f('0x3'));var BPromise=require(_0x8e9f('0x4'));var rp=require(_0x8e9f('0x5'));var fs=require('fs');var path=require(_0x8e9f('0x6'));var rimraf=require(_0x8e9f('0x7'));var config=require(_0x8e9f('0x8'));var attributes=require(_0x8e9f('0x9'));module[_0x8e9f('0xa')]=function(_0x4f8778,_0x3d6ccc){return _0x4f8778[_0x8e9f('0xb')]('CmHopperFinal',attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x8e9f('0xc'),'fields':[_0x8e9f('0xc')]},{'name':_0x8e9f('0xd'),'fields':[_0x8e9f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xde86=['calleridnum','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final'];(function(_0x539fb2,_0x5b6718){var _0x4d583d=function(_0x55fa69){while(--_0x55fa69){_0x539fb2['push'](_0x539fb2['shift']());}};_0x4d583d(++_0x5b6718);}(_0xde86,0x8e));var _0x6de8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xde86[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6de8('0x0'));var util=require(_0x6de8('0x1'));var logger=require(_0x6de8('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6de8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6de8('0x4'));var rimraf=require(_0x6de8('0x5'));var config=require(_0x6de8('0x6'));var attributes=require(_0x6de8('0x7'));module[_0x6de8('0x8')]=function(_0x4284f0,_0x520109){return _0x4284f0[_0x6de8('0x9')](_0x6de8('0xa'),attributes,{'tableName':_0x6de8('0xb'),'paranoid':![],'indexes':[{'name':_0x6de8('0xc'),'fields':['calleridnum']},{'name':_0x6de8('0xd'),'fields':[_0x6de8('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 440af86..7ce06e3 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(_0x5b3ff2,_0x1473e2){var _0x237f74=function(_0x34b989){while(--_0x34b989){_0x5b3ff2['push'](_0x5b3ff2['shift']());}};_0x237f74(++_0x1473e2);}(_0x7a54,0x106));var _0x47a5=function(_0x4fdb6c,_0x5a9499){_0x4fdb6c=_0x4fdb6c-0x0;var _0x3a1e97=_0x7a54[_0x4fdb6c];return _0x3a1e97;};'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 _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x39b27a,_0x450f20){var _0x260da1=function(_0x412b84){while(--_0x412b84){_0x39b27a['push'](_0x39b27a['shift']());}};_0x260da1(++_0x450f20);}(_0xb10b,0x12a));var _0xbb10=function(_0x4eaa4c,_0x2f7422){_0x4eaa4c=_0x4eaa4c-0x0;var _0x15aec6=_0xb10b[_0x4eaa4c];return _0x15aec6;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index d649a95..53fff1d 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 _0x142c=['../../components/auth/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','describe','/:id','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','update','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x3aa063,_0x22885a){var _0x53b76d=function(_0x1b81d8){while(--_0x1b81d8){_0x3aa063['push'](_0x3aa063['shift']());}};_0x53b76d(++_0x22885a);}(_0x142c,0x8f));var _0xc142=function(_0x8d301,_0x39b4a1){_0x8d301=_0x8d301-0x0;var _0xba93b3=_0x142c[_0x8d301];return _0xba93b3;};'use strict';var multer=require(_0xc142('0x0'));var util=require(_0xc142('0x1'));var path=require(_0xc142('0x2'));var timeout=require(_0xc142('0x3'));var express=require(_0xc142('0x4'));var router=express[_0xc142('0x5')]();var fs_extra=require(_0xc142('0x6'));var auth=require(_0xc142('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xc142('0x8'));var controller=require(_0xc142('0x9'));router[_0xc142('0xa')]('/',auth[_0xc142('0xb')](),controller['index']);router[_0xc142('0xa')]('/describe',auth[_0xc142('0xb')](),controller[_0xc142('0xc')]);router['get'](_0xc142('0xd'),auth[_0xc142('0xb')](),controller[_0xc142('0xe')]);router['get']('/voice/queue/countAttributes/:id',auth[_0xc142('0xb')](),controller[_0xc142('0xf')]);router['get'](_0xc142('0x10'),auth[_0xc142('0xb')](),controller[_0xc142('0x11')]);router['post'](_0xc142('0x12'),auth[_0xc142('0xb')](),controller[_0xc142('0x13')]);router[_0xc142('0x14')]('/voice/campaign/moveContacts/:id',auth[_0xc142('0xb')](),controller[_0xc142('0x15')]);router[_0xc142('0x14')](_0xc142('0x16'),auth[_0xc142('0xb')](),controller['checkContactHopper']);router[_0xc142('0x17')]('/:id',auth[_0xc142('0xb')](),controller[_0xc142('0x18')]);module['exports']=router; \ No newline at end of file +var _0x7ad0=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','index','isAuthenticated','/:id','show','/voice/queue/countAttributes/:id','get','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','post','/checkContactHopper','put','update','multer','path','connect-timeout','express'];(function(_0x214e68,_0x30426f){var _0x389d11=function(_0x21970a){while(--_0x21970a){_0x214e68['push'](_0x214e68['shift']());}};_0x389d11(++_0x30426f);}(_0x7ad0,0x11a));var _0x07ad=function(_0x15da95,_0x2a6b25){_0x15da95=_0x15da95-0x0;var _0x5cfdc5=_0x7ad0[_0x15da95];return _0x5cfdc5;};'use strict';var multer=require(_0x07ad('0x0'));var util=require('util');var path=require(_0x07ad('0x1'));var timeout=require(_0x07ad('0x2'));var express=require(_0x07ad('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x07ad('0x4'));var interaction=require(_0x07ad('0x5'));var config=require(_0x07ad('0x6'));var controller=require(_0x07ad('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x07ad('0x8')]);router['get']('/describe',auth[_0x07ad('0x9')](),controller['describe']);router['get'](_0x07ad('0xa'),auth[_0x07ad('0x9')](),controller[_0x07ad('0xb')]);router['get'](_0x07ad('0xc'),auth[_0x07ad('0x9')](),controller['countContactsQueueCampaignHopperFinal']);router[_0x07ad('0xd')]('/campaign/countAttributes/:id',auth[_0x07ad('0x9')](),controller[_0x07ad('0xe')]);router['post'](_0x07ad('0xf'),auth[_0x07ad('0x9')](),controller[_0x07ad('0x10')]);router['post'](_0x07ad('0x11'),auth[_0x07ad('0x9')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x07ad('0x12')](_0x07ad('0x13'),auth[_0x07ad('0x9')](),controller['checkContactHopper']);router[_0x07ad('0x14')](_0x07ad('0xa'),auth[_0x07ad('0x9')](),controller[_0x07ad('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index e9c4f44..13e3b82 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 _0xe108=['DATE','BOOLEAN','exports','STRING','INTEGER'];(function(_0x331160,_0x410e43){var _0x324617=function(_0x313d8b){while(--_0x313d8b){_0x331160['push'](_0x331160['shift']());}};_0x324617(++_0x410e43);}(_0xe108,0x6b));var _0x8e10=function(_0x22942f,_0x56e2ae){_0x22942f=_0x22942f-0x0;var _0x17dde5=_0xe108[_0x22942f];return _0x17dde5;};'use strict';var Sequelize=require('sequelize');module[_0x8e10('0x0')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x8e10('0x1')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x8e10('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8e10('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8e10('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x8e10('0x1')]},'originatecalleridnum':{'type':Sequelize[_0x8e10('0x1')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x8e10('0x1')]},'calleridname':{'type':Sequelize[_0x8e10('0x1')]},'starttime':{'type':Sequelize[_0x8e10('0x3')]},'responsetime':{'type':Sequelize[_0x8e10('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x8e10('0x3')]},'endtime':{'type':Sequelize[_0x8e10('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x8e10('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x8e10('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x8e10('0x1')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x8e10('0x1')]},'amd':{'type':Sequelize[_0x8e10('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x8e10('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x8e10('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8e10('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x8e10('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x8e10('0x3')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8e10('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8e10('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x8e10('0x1')]}}; \ No newline at end of file +var _0xa282=['STRING','INTEGER','DATE','BOOLEAN','sequelize'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0xa282,0x1f3));var _0x2a28=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xa282[_0x45d55e];return _0x29812a;};'use strict';var Sequelize=require(_0x2a28('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x2a28('0x1')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x2a28('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2a28('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x2a28('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x2a28('0x1')]},'originatecalleridnum':{'type':Sequelize[_0x2a28('0x1')]},'originatecalleridname':{'type':Sequelize[_0x2a28('0x1')]},'calleridnum':{'type':Sequelize[_0x2a28('0x1')]},'calleridname':{'type':Sequelize[_0x2a28('0x1')]},'starttime':{'type':Sequelize[_0x2a28('0x3')]},'responsetime':{'type':Sequelize[_0x2a28('0x3')]},'answertime':{'type':Sequelize[_0x2a28('0x3')]},'droptime':{'type':Sequelize[_0x2a28('0x3')]},'endtime':{'type':Sequelize[_0x2a28('0x3')]},'ringtime':{'type':Sequelize[_0x2a28('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x2a28('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x2a28('0x1')]},'campaign':{'type':Sequelize[_0x2a28('0x1')]},'campaigntype':{'type':Sequelize[_0x2a28('0x1')]},'membername':{'type':Sequelize[_0x2a28('0x1')]},'reason':{'type':Sequelize[_0x2a28('0x1')]},'amd':{'type':Sequelize[_0x2a28('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x2a28('0x4')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x2a28('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x2a28('0x3')]},'edited':{'type':Sequelize[_0x2a28('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x2a28('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x2a28('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x2a28('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x2a28('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 1a4018b..4d6168d 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 _0xd0fc=['create','body','describe','update','uniqueid','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','destroy','then','stack','send','index','map','CmHopperHistory','rawAttributes','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','pick','merge','where','name','filter','options','includeAll','findAll','rows','catch','keys','include','find'];(function(_0x414fcd,_0x156af0){var _0x180120=function(_0x2dd815){while(--_0x2dd815){_0x414fcd['push'](_0x414fcd['shift']());}};_0x180120(++_0x156af0);}(_0xd0fc,0x136));var _0xcd0f=function(_0x9b60a4,_0x2c896d){_0x9b60a4=_0x9b60a4-0x0;var _0x1b9282=_0xd0fc[_0x9b60a4];return _0x1b9282;};'use strict';var emlformat=require(_0xcd0f('0x0'));var rimraf=require(_0xcd0f('0x1'));var zipdir=require(_0xcd0f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xcd0f('0x3'));var BPromise=require(_0xcd0f('0x4'));var Mustache=require(_0xcd0f('0x5'));var util=require(_0xcd0f('0x6'));var path=require(_0xcd0f('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xcd0f('0x8'));var fs=require('fs');var fs_extra=require(_0xcd0f('0x9'));var _=require(_0xcd0f('0xa'));var squel=require(_0xcd0f('0xb'));var crypto=require(_0xcd0f('0xc'));var jsforce=require(_0xcd0f('0xd'));var deskjs=require(_0xcd0f('0xe'));var toCsv=require(_0xcd0f('0xf'));var querystring=require(_0xcd0f('0x10'));var Papa=require(_0xcd0f('0x11'));var Redis=require(_0xcd0f('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcd0f('0x13'));var hardwareService=require(_0xcd0f('0x14'));var logger=require('../../config/logger')(_0xcd0f('0x15'));var utils=require(_0xcd0f('0x16'));var config=require(_0xcd0f('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xcd0f('0x18'))['db'];function respondWithStatusCode(_0x469fd5,_0x13295e){_0x13295e=_0x13295e||0xcc;return function(_0x1782cc){if(_0x1782cc){return _0x469fd5[_0xcd0f('0x19')](_0x13295e);}return _0x469fd5['status'](_0x13295e)[_0xcd0f('0x1a')]();};}function respondWithResult(_0xcf2810,_0x631890){_0x631890=_0x631890||0xc8;return function(_0x1b84d2){if(_0x1b84d2){return _0xcf2810[_0xcd0f('0x1b')](_0x631890)['json'](_0x1b84d2);}};}function respondWithFilteredResult(_0x703c9f,_0x1c0d4d){return function(_0x4e1911){if(_0x4e1911){var _0x598284=typeof _0x1c0d4d[_0xcd0f('0x1c')]==='undefined'&&typeof _0x1c0d4d[_0xcd0f('0x1d')]===_0xcd0f('0x1e');var _0x4e54ba=_0x4e1911['count'];var _0x191f8e=_0x598284?0x0:_0x1c0d4d[_0xcd0f('0x1c')];var _0x461079=_0x598284?_0x4e1911[_0xcd0f('0x1f')]:_0x1c0d4d[_0xcd0f('0x1c')]+_0x1c0d4d['limit'];var _0x367f09;if(_0x461079>=_0x4e54ba){_0x461079=_0x4e54ba;_0x367f09=0xc8;}else{_0x367f09=0xce;}_0x703c9f[_0xcd0f('0x1b')](_0x367f09);return _0x703c9f[_0xcd0f('0x20')](_0xcd0f('0x21'),_0x191f8e+'-'+_0x461079+'/'+_0x4e54ba)[_0xcd0f('0x22')](_0x4e1911);}return null;};}function patchUpdates(_0x3796df){return function(_0x321f02){try{jsonpatch[_0xcd0f('0x23')](_0x321f02,_0x3796df,!![]);}catch(_0x1aa345){return BPromise[_0xcd0f('0x24')](_0x1aa345);}return _0x321f02[_0xcd0f('0x25')]();};}function saveUpdates(_0x11a317,_0x297001){return function(_0x58f8b0){if(_0x58f8b0){return _0x58f8b0['update'](_0x11a317)['then'](function(_0x5e446d){return _0x5e446d;});}return null;};}function removeEntity(_0x3489c5,_0x4c4938){return function(_0x327960){if(_0x327960){return _0x327960[_0xcd0f('0x26')]()[_0xcd0f('0x27')](function(){_0x3489c5['status'](0xcc)[_0xcd0f('0x1a')]();});}};}function handleEntityNotFound(_0x1b4144,_0x876e9){return function(_0x2c297a){if(!_0x2c297a){_0x1b4144[_0xcd0f('0x19')](0x194);}return _0x2c297a;};}function handleError(_0x39894b,_0x48d032){_0x48d032=_0x48d032||0x1f4;return function(_0x18f761){logger['error'](_0x18f761[_0xcd0f('0x28')]);if(_0x18f761['name']){delete _0x18f761['name'];}_0x39894b[_0xcd0f('0x1b')](_0x48d032)[_0xcd0f('0x29')](_0x18f761);};}exports[_0xcd0f('0x2a')]=function(_0x178708,_0x141ea6){var _0x25c8a0={},_0x2da387={},_0x2e7ca1={'count':0x0,'rows':[]};var _0x35e212=_[_0xcd0f('0x2b')](db[_0xcd0f('0x2c')][_0xcd0f('0x2d')],function(_0x20ae9e){return{'name':_0x20ae9e['fieldName'],'type':_0x20ae9e[_0xcd0f('0x2e')]['key']};});_0x2da387[_0xcd0f('0x2f')]=_[_0xcd0f('0x2b')](_0x35e212,'name');_0x2da387[_0xcd0f('0x30')]=_['keys'](_0x178708[_0xcd0f('0x30')]);_0x2da387[_0xcd0f('0x31')]=_[_0xcd0f('0x32')](_0x2da387[_0xcd0f('0x2f')],_0x2da387[_0xcd0f('0x30')]);_0x25c8a0['attributes']=_[_0xcd0f('0x32')](_0x2da387[_0xcd0f('0x2f')],qs['fields'](_0x178708['query'][_0xcd0f('0x33')]));_0x25c8a0[_0xcd0f('0x34')]=_0x25c8a0[_0xcd0f('0x34')][_0xcd0f('0x35')]?_0x25c8a0[_0xcd0f('0x34')]:_0x2da387[_0xcd0f('0x2f')];if(!_0x178708[_0xcd0f('0x30')][_0xcd0f('0x36')](_0xcd0f('0x37'))){_0x25c8a0[_0xcd0f('0x1d')]=qs[_0xcd0f('0x1d')](_0x178708[_0xcd0f('0x30')][_0xcd0f('0x1d')]);_0x25c8a0['offset']=qs[_0xcd0f('0x1c')](_0x178708[_0xcd0f('0x30')][_0xcd0f('0x1c')]);}_0x25c8a0[_0xcd0f('0x38')]=qs['sort'](_0x178708[_0xcd0f('0x30')]['sort']);_0x25c8a0['where']=qs[_0xcd0f('0x31')](_[_0xcd0f('0x39')](_0x178708['query'],_0x2da387['filters']),_0x35e212);if(_0x178708[_0xcd0f('0x30')]['filter']){_0x25c8a0['where']=_[_0xcd0f('0x3a')](_0x25c8a0[_0xcd0f('0x3b')],{'$or':_[_0xcd0f('0x2b')](_0x35e212,function(_0x945169){if(_0x945169[_0xcd0f('0x2e')]!=='VIRTUAL'){var _0x163d02={};_0x163d02[_0x945169[_0xcd0f('0x3c')]]={'$like':'%'+_0x178708[_0xcd0f('0x30')][_0xcd0f('0x3d')]+'%'};return _0x163d02;}})});}_0x25c8a0=_['merge']({},_0x25c8a0,_0x178708[_0xcd0f('0x3e')]);var _0x39ac51={'where':_0x25c8a0[_0xcd0f('0x3b')]};return db[_0xcd0f('0x2c')]['count'](_0x39ac51)['then'](function(_0x2c68aa){_0x2e7ca1[_0xcd0f('0x1f')]=_0x2c68aa;if(_0x178708[_0xcd0f('0x30')][_0xcd0f('0x3f')]){_0x25c8a0['include']=[{'all':!![]}];}return db[_0xcd0f('0x2c')][_0xcd0f('0x40')](_0x25c8a0);})[_0xcd0f('0x27')](function(_0x1827fb){_0x2e7ca1[_0xcd0f('0x41')]=_0x1827fb;return _0x2e7ca1;})[_0xcd0f('0x27')](respondWithFilteredResult(_0x141ea6,_0x25c8a0))[_0xcd0f('0x42')](handleError(_0x141ea6,null));};exports['show']=function(_0x43db59,_0xef0c15){var _0x13bf60={'raw':!![],'where':{'id':_0x43db59['params']['id']}},_0x57df7c={};_0x57df7c[_0xcd0f('0x2f')]=_[_0xcd0f('0x43')](db[_0xcd0f('0x2c')]['rawAttributes']);_0x57df7c['query']=_[_0xcd0f('0x43')](_0x43db59['query']);_0x57df7c[_0xcd0f('0x31')]=_[_0xcd0f('0x32')](_0x57df7c['model'],_0x57df7c['query']);_0x13bf60['attributes']=_[_0xcd0f('0x32')](_0x57df7c['model'],qs['fields'](_0x43db59[_0xcd0f('0x30')][_0xcd0f('0x33')]));_0x13bf60[_0xcd0f('0x34')]=_0x13bf60['attributes'][_0xcd0f('0x35')]?_0x13bf60['attributes']:_0x57df7c['model'];if(_0x43db59[_0xcd0f('0x30')][_0xcd0f('0x3f')]){_0x13bf60[_0xcd0f('0x44')]=[{'all':!![]}];}_0x13bf60=_['merge']({},_0x13bf60,_0x43db59[_0xcd0f('0x3e')]);return db[_0xcd0f('0x2c')][_0xcd0f('0x45')](_0x13bf60)[_0xcd0f('0x27')](handleEntityNotFound(_0xef0c15,null))['then'](respondWithResult(_0xef0c15,null))[_0xcd0f('0x42')](handleError(_0xef0c15,null));};exports[_0xcd0f('0x46')]=function(_0x4bb2a5,_0x482f5f){return db[_0xcd0f('0x2c')][_0xcd0f('0x46')](_0x4bb2a5[_0xcd0f('0x47')],{})[_0xcd0f('0x27')](respondWithResult(_0x482f5f,0xc9))['catch'](handleError(_0x482f5f,null));};exports[_0xcd0f('0x48')]=function(_0x145197,_0x59d4c9){return db['CmHopperHistory'][_0xcd0f('0x48')]()[_0xcd0f('0x27')](respondWithResult(_0x59d4c9,null))[_0xcd0f('0x42')](handleError(_0x59d4c9,null));};exports[_0xcd0f('0x49')]=function(_0x3cf97c,_0x4e341c){if(_0x3cf97c['body'][_0xcd0f('0x4a')]){delete _0x3cf97c[_0xcd0f('0x47')][_0xcd0f('0x4a')];}return db[_0xcd0f('0x2c')][_0xcd0f('0x45')]({'where':{'uniqueid':_0x3cf97c[_0xcd0f('0x4b')]['id']}})[_0xcd0f('0x27')](handleEntityNotFound(_0x4e341c,null))[_0xcd0f('0x27')](saveUpdates(_0x3cf97c[_0xcd0f('0x47')],null))[_0xcd0f('0x27')](respondWithResult(_0x4e341c,null))[_0xcd0f('0x42')](handleError(_0x4e341c,null));}; \ No newline at end of file +var _0xebc2=['util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','update','destroy','then','sendStatus','error','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','name','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','describe','body','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x455958,_0x3664b8){var _0x29e774=function(_0x269812){while(--_0x269812){_0x455958['push'](_0x455958['shift']());}};_0x29e774(++_0x3664b8);}(_0xebc2,0xe2));var _0x2ebc=function(_0x393b3b,_0x3cbec8){_0x393b3b=_0x393b3b-0x0;var _0x1f7189=_0xebc2[_0x393b3b];return _0x1f7189;};'use strict';var emlformat=require(_0x2ebc('0x0'));var rimraf=require(_0x2ebc('0x1'));var zipdir=require(_0x2ebc('0x2'));var jsonpatch=require(_0x2ebc('0x3'));var rp=require(_0x2ebc('0x4'));var moment=require(_0x2ebc('0x5'));var BPromise=require(_0x2ebc('0x6'));var Mustache=require(_0x2ebc('0x7'));var util=require(_0x2ebc('0x8'));var path=require('path');var sox=require(_0x2ebc('0x9'));var csv=require(_0x2ebc('0xa'));var ejs=require(_0x2ebc('0xb'));var fs=require('fs');var fs_extra=require(_0x2ebc('0xc'));var _=require(_0x2ebc('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2ebc('0xe'));var deskjs=require(_0x2ebc('0xf'));var toCsv=require(_0x2ebc('0xa'));var querystring=require(_0x2ebc('0x10'));var Papa=require(_0x2ebc('0x11'));var Redis=require(_0x2ebc('0x12'));var authService=require(_0x2ebc('0x13'));var qs=require(_0x2ebc('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2ebc('0x15'));var logger=require(_0x2ebc('0x16'))(_0x2ebc('0x17'));var utils=require('../../config/utils');var config=require(_0x2ebc('0x18'));var licenseUtil=require(_0x2ebc('0x19'));var db=require(_0x2ebc('0x1a'))['db'];function respondWithStatusCode(_0x3bac6c,_0xcd64df){_0xcd64df=_0xcd64df||0xcc;return function(_0x219ec6){if(_0x219ec6){return _0x3bac6c['sendStatus'](_0xcd64df);}return _0x3bac6c[_0x2ebc('0x1b')](_0xcd64df)[_0x2ebc('0x1c')]();};}function respondWithResult(_0x57035e,_0x39f2f6){_0x39f2f6=_0x39f2f6||0xc8;return function(_0x1534ce){if(_0x1534ce){return _0x57035e['status'](_0x39f2f6)[_0x2ebc('0x1d')](_0x1534ce);}};}function respondWithFilteredResult(_0x31a9a6,_0x128146){return function(_0x176c86){if(_0x176c86){var _0x2f50c1=typeof _0x128146[_0x2ebc('0x1e')]===_0x2ebc('0x1f')&&typeof _0x128146[_0x2ebc('0x20')]==='undefined';var _0x1784e9=_0x176c86[_0x2ebc('0x21')];var _0xce4245=_0x2f50c1?0x0:_0x128146[_0x2ebc('0x1e')];var _0x3daefd=_0x2f50c1?_0x176c86['count']:_0x128146[_0x2ebc('0x1e')]+_0x128146[_0x2ebc('0x20')];var _0x514ff6;if(_0x3daefd>=_0x1784e9){_0x3daefd=_0x1784e9;_0x514ff6=0xc8;}else{_0x514ff6=0xce;}_0x31a9a6[_0x2ebc('0x1b')](_0x514ff6);return _0x31a9a6[_0x2ebc('0x22')]('Content-Range',_0xce4245+'-'+_0x3daefd+'/'+_0x1784e9)[_0x2ebc('0x1d')](_0x176c86);}return null;};}function patchUpdates(_0x3dceee){return function(_0x41e590){try{jsonpatch[_0x2ebc('0x23')](_0x41e590,_0x3dceee,!![]);}catch(_0x5845f5){return BPromise['reject'](_0x5845f5);}return _0x41e590['save']();};}function saveUpdates(_0x5ede68,_0x4667da){return function(_0x55b8ee){if(_0x55b8ee){return _0x55b8ee[_0x2ebc('0x24')](_0x5ede68)['then'](function(_0x4452bf){return _0x4452bf;});}return null;};}function removeEntity(_0x10a8c6,_0x502ef4){return function(_0x42b370){if(_0x42b370){return _0x42b370[_0x2ebc('0x25')]()[_0x2ebc('0x26')](function(){_0x10a8c6['status'](0xcc)[_0x2ebc('0x1c')]();});}};}function handleEntityNotFound(_0x66da20,_0xc28369){return function(_0x2eb418){if(!_0x2eb418){_0x66da20[_0x2ebc('0x27')](0x194);}return _0x2eb418;};}function handleError(_0x525117,_0x1f4779){_0x1f4779=_0x1f4779||0x1f4;return function(_0x4ece5d){logger[_0x2ebc('0x28')](_0x4ece5d['stack']);if(_0x4ece5d['name']){delete _0x4ece5d['name'];}_0x525117['status'](_0x1f4779)[_0x2ebc('0x29')](_0x4ece5d);};}exports[_0x2ebc('0x2a')]=function(_0x454804,_0x117715){var _0x4cd522={},_0x43ca44={},_0x1af00f={'count':0x0,'rows':[]};var _0x3111f9=_[_0x2ebc('0x2b')](db[_0x2ebc('0x2c')][_0x2ebc('0x2d')],function(_0x49cda2){return{'name':_0x49cda2[_0x2ebc('0x2e')],'type':_0x49cda2[_0x2ebc('0x2f')][_0x2ebc('0x30')]};});_0x43ca44['model']=_[_0x2ebc('0x2b')](_0x3111f9,_0x2ebc('0x31'));_0x43ca44[_0x2ebc('0x32')]=_['keys'](_0x454804[_0x2ebc('0x32')]);_0x43ca44[_0x2ebc('0x33')]=_['intersection'](_0x43ca44[_0x2ebc('0x34')],_0x43ca44['query']);_0x4cd522[_0x2ebc('0x35')]=_[_0x2ebc('0x36')](_0x43ca44[_0x2ebc('0x34')],qs[_0x2ebc('0x37')](_0x454804['query'][_0x2ebc('0x37')]));_0x4cd522[_0x2ebc('0x35')]=_0x4cd522['attributes'][_0x2ebc('0x38')]?_0x4cd522[_0x2ebc('0x35')]:_0x43ca44[_0x2ebc('0x34')];if(!_0x454804[_0x2ebc('0x32')][_0x2ebc('0x39')]('nolimit')){_0x4cd522['limit']=qs[_0x2ebc('0x20')](_0x454804[_0x2ebc('0x32')][_0x2ebc('0x20')]);_0x4cd522[_0x2ebc('0x1e')]=qs[_0x2ebc('0x1e')](_0x454804[_0x2ebc('0x32')][_0x2ebc('0x1e')]);}_0x4cd522['order']=qs['sort'](_0x454804[_0x2ebc('0x32')][_0x2ebc('0x3a')]);_0x4cd522[_0x2ebc('0x3b')]=qs[_0x2ebc('0x33')](_[_0x2ebc('0x3c')](_0x454804[_0x2ebc('0x32')],_0x43ca44['filters']),_0x3111f9);if(_0x454804['query'][_0x2ebc('0x3d')]){_0x4cd522[_0x2ebc('0x3b')]=_['merge'](_0x4cd522['where'],{'$or':_['map'](_0x3111f9,function(_0x14a0f3){if(_0x14a0f3['type']!==_0x2ebc('0x3e')){var _0x1d5a32={};_0x1d5a32[_0x14a0f3[_0x2ebc('0x31')]]={'$like':'%'+_0x454804[_0x2ebc('0x32')][_0x2ebc('0x3d')]+'%'};return _0x1d5a32;}})});}_0x4cd522=_[_0x2ebc('0x3f')]({},_0x4cd522,_0x454804[_0x2ebc('0x40')]);var _0x79a52={'where':_0x4cd522[_0x2ebc('0x3b')]};return db[_0x2ebc('0x2c')]['count'](_0x79a52)[_0x2ebc('0x26')](function(_0x4aba7a){_0x1af00f['count']=_0x4aba7a;if(_0x454804[_0x2ebc('0x32')][_0x2ebc('0x41')]){_0x4cd522[_0x2ebc('0x42')]=[{'all':!![]}];}return db[_0x2ebc('0x2c')][_0x2ebc('0x43')](_0x4cd522);})['then'](function(_0x5eb04a){_0x1af00f[_0x2ebc('0x44')]=_0x5eb04a;return _0x1af00f;})[_0x2ebc('0x26')](respondWithFilteredResult(_0x117715,_0x4cd522))['catch'](handleError(_0x117715,null));};exports[_0x2ebc('0x45')]=function(_0xcc36dc,_0x1633b1){var _0x472436={'raw':!![],'where':{'id':_0xcc36dc[_0x2ebc('0x46')]['id']}},_0x2e2d93={};_0x2e2d93[_0x2ebc('0x34')]=_[_0x2ebc('0x47')](db[_0x2ebc('0x2c')][_0x2ebc('0x2d')]);_0x2e2d93[_0x2ebc('0x32')]=_[_0x2ebc('0x47')](_0xcc36dc[_0x2ebc('0x32')]);_0x2e2d93['filters']=_[_0x2ebc('0x36')](_0x2e2d93['model'],_0x2e2d93['query']);_0x472436['attributes']=_['intersection'](_0x2e2d93[_0x2ebc('0x34')],qs[_0x2ebc('0x37')](_0xcc36dc[_0x2ebc('0x32')][_0x2ebc('0x37')]));_0x472436[_0x2ebc('0x35')]=_0x472436[_0x2ebc('0x35')][_0x2ebc('0x38')]?_0x472436[_0x2ebc('0x35')]:_0x2e2d93['model'];if(_0xcc36dc[_0x2ebc('0x32')][_0x2ebc('0x41')]){_0x472436[_0x2ebc('0x42')]=[{'all':!![]}];}_0x472436=_[_0x2ebc('0x3f')]({},_0x472436,_0xcc36dc[_0x2ebc('0x40')]);return db[_0x2ebc('0x2c')][_0x2ebc('0x48')](_0x472436)[_0x2ebc('0x26')](handleEntityNotFound(_0x1633b1,null))[_0x2ebc('0x26')](respondWithResult(_0x1633b1,null))[_0x2ebc('0x49')](handleError(_0x1633b1,null));};exports[_0x2ebc('0x4a')]=function(_0x555f7f,_0x552b00){return db['CmHopperHistory'][_0x2ebc('0x4a')](_0x555f7f['body'],{})['then'](respondWithResult(_0x552b00,0xc9))[_0x2ebc('0x49')](handleError(_0x552b00,null));};exports[_0x2ebc('0x4b')]=function(_0x5cec30,_0xf94577){return db[_0x2ebc('0x2c')]['describe']()['then'](respondWithResult(_0xf94577,null))[_0x2ebc('0x49')](handleError(_0xf94577,null));};exports[_0x2ebc('0x24')]=function(_0x4ab42b,_0x4dbb1b){if(_0x4ab42b[_0x2ebc('0x4c')][_0x2ebc('0x4d')]){delete _0x4ab42b[_0x2ebc('0x4c')][_0x2ebc('0x4d')];}return db[_0x2ebc('0x2c')][_0x2ebc('0x48')]({'where':{'uniqueid':_0x4ab42b[_0x2ebc('0x46')]['id']}})[_0x2ebc('0x26')](handleEntityNotFound(_0x4dbb1b,null))['then'](saveUpdates(_0x4ab42b[_0x2ebc('0x4c')],null))[_0x2ebc('0x26')](respondWithResult(_0x4dbb1b,null))[_0x2ebc('0x49')](handleError(_0x4dbb1b,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index c64d6d1..30e6db8 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 _0x073d=['endtime','uniqueid','util','../../config/logger','api','bluebird','path','rimraf','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history'];(function(_0x2272b5,_0x362458){var _0x110156=function(_0x5c2e32){while(--_0x5c2e32){_0x2272b5['push'](_0x2272b5['shift']());}};_0x110156(++_0x362458);}(_0x073d,0xd2));var _0xd073=function(_0x42c5a2,_0x38a2b9){_0x42c5a2=_0x42c5a2-0x0;var _0xbaf6e1=_0x073d[_0x42c5a2];return _0xbaf6e1;};'use strict';var _=require('lodash');var util=require(_0xd073('0x0'));var logger=require(_0xd073('0x1'))(_0xd073('0x2'));var moment=require('moment');var BPromise=require(_0xd073('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd073('0x4'));var rimraf=require(_0xd073('0x5'));var config=require('../../config/environment');var attributes=require(_0xd073('0x6'));module[_0xd073('0x7')]=function(_0x1799b8,_0x1fdaeb){return _0x1799b8[_0xd073('0x8')](_0xd073('0x9'),attributes,{'tableName':_0xd073('0xa'),'paranoid':![],'indexes':[{'name':_0xd073('0xb'),'fields':[_0xd073('0xb')]},{'name':_0xd073('0xc'),'fields':[_0xd073('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x762e=['exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','api','request-promise','path','rimraf','./cmHopperHistory.attributes'];(function(_0x474cce,_0x5b9719){var _0x410aa1=function(_0x5a036d){while(--_0x5a036d){_0x474cce['push'](_0x474cce['shift']());}};_0x410aa1(++_0x5b9719);}(_0x762e,0xea));var _0xe762=function(_0x5163d9,_0x1b70d6){_0x5163d9=_0x5163d9-0x0;var _0x24b9ba=_0x762e[_0x5163d9];return _0x24b9ba;};'use strict';var _=require(_0xe762('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe762('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe762('0x2'));var fs=require('fs');var path=require(_0xe762('0x3'));var rimraf=require(_0xe762('0x4'));var config=require('../../config/environment');var attributes=require(_0xe762('0x5'));module[_0xe762('0x6')]=function(_0x48995a,_0x4abeb6){return _0x48995a[_0xe762('0x7')](_0xe762('0x8'),attributes,{'tableName':_0xe762('0x9'),'paranoid':![],'indexes':[{'name':_0xe762('0xa'),'fields':[_0xe762('0xa')]},{'name':_0xe762('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index fc125ea..9afb935 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 _0x32f8=['col','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','literal','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetCampaignHopperHistory','name','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','CreateCmHopperHistory','create','body','options','raw','AvgHandleTime','findAll','where','sequelize','COUNT'];(function(_0x36c639,_0x54c87f){var _0x43059d=function(_0xecc879){while(--_0xecc879){_0x36c639['push'](_0x36c639['shift']());}};_0x43059d(++_0x54c87f);}(_0x32f8,0xaf));var _0x832f=function(_0x391277,_0x5c481d){_0x391277=_0x391277-0x0;var _0xcd158a=_0x32f8[_0x391277];return _0xcd158a;};'use strict';var _=require(_0x832f('0x0'));var util=require(_0x832f('0x1'));var moment=require(_0x832f('0x2'));var BPromise=require('bluebird');var rs=require(_0x832f('0x3'));var fs=require('fs');var Redis=require(_0x832f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x832f('0x5'));var logger=require(_0x832f('0x6'))(_0x832f('0x7'));var config=require(_0x832f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x832f('0x9')][_0x832f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x449633,_0x4ebc6f,_0x418e83){return new BPromise(function(_0x34b9de,_0x568d25){return client[_0x832f('0xb')](_0x449633,_0x418e83)[_0x832f('0xc')](function(_0x1dd4ff){logger[_0x832f('0xd')](_0x832f('0xe'),_0x4ebc6f,'request\x20sent');logger[_0x832f('0xf')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x4ebc6f,_0x832f('0x10'),JSON[_0x832f('0x11')](_0x1dd4ff));if(_0x1dd4ff['error']){if(_0x1dd4ff[_0x832f('0x12')][_0x832f('0x13')]===0x1f4){logger[_0x832f('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x4ebc6f,_0x1dd4ff[_0x832f('0x12')][_0x832f('0x14')]);return _0x568d25(_0x1dd4ff[_0x832f('0x12')][_0x832f('0x14')]);}logger[_0x832f('0x12')](_0x832f('0xe'),_0x4ebc6f,_0x1dd4ff[_0x832f('0x12')]['message']);return _0x34b9de(_0x1dd4ff[_0x832f('0x12')][_0x832f('0x14')]);}else{logger[_0x832f('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x4ebc6f,_0x832f('0x10'));_0x34b9de(_0x1dd4ff['result'][_0x832f('0x14')]);}})[_0x832f('0x15')](function(_0x5f4977){logger['error'](_0x832f('0xe'),_0x4ebc6f,_0x5f4977);_0x568d25(_0x5f4977);});});}exports[_0x832f('0x16')]=function(_0xbfb6e6){var _0x50380f=this;return new Promise(function(_0x4af938,_0x54d711){return db['CmHopperHistory'][_0x832f('0x17')](_0xbfb6e6[_0x832f('0x18')],{'raw':_0xbfb6e6[_0x832f('0x19')]?_0xbfb6e6[_0x832f('0x19')][_0x832f('0x1a')]===undefined?!![]:![]:!![]})[_0x832f('0xc')](function(_0x478a57){logger[_0x832f('0xd')](_0x832f('0x16'),_0xbfb6e6);logger['debug'](_0x832f('0x16'),_0xbfb6e6,JSON['stringify'](_0x478a57));_0x4af938(_0x478a57);})[_0x832f('0x15')](function(_0x575c09){logger['error'](_0x832f('0x16'),_0x575c09[_0x832f('0x14')],_0xbfb6e6);_0x54d711(_0x50380f[_0x832f('0x12')](0x1f4,_0x575c09[_0x832f('0x14')]));});});};exports[_0x832f('0x1b')]=function(_0x421952){var _0x3e16d4=this;return new Promise(function(_0x317cae,_0x227202){return db['CmHopperHistory'][_0x832f('0x1c')]({'raw':_0x421952['options']?_0x421952[_0x832f('0x19')][_0x832f('0x1a')]===undefined?!![]:![]:!![],'where':_0x421952[_0x832f('0x19')]?_0x421952['options'][_0x832f('0x1d')]||null:null,'attributes':[[db[_0x832f('0x1e')]['fn'](_0x832f('0x1f'),db[_0x832f('0x1e')][_0x832f('0x20')]('id')),_0x832f('0x21')],[db[_0x832f('0x1e')]['fn'](_0x832f('0x1f'),db[_0x832f('0x1e')]['fn']('IF',db[_0x832f('0x1e')]['literal'](_0x832f('0x22')))),_0x832f('0x23')],[db[_0x832f('0x1e')]['fn'](_0x832f('0x1f'),db[_0x832f('0x1e')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2010,\x201,\x20null'))),_0x832f('0x24')],[db[_0x832f('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x832f('0x1e')][_0x832f('0x25')](_0x832f('0x26')))),_0x832f('0x27')],[db['sequelize']['fn'](_0x832f('0x28'),db['sequelize']['fn']('IF',db[_0x832f('0x1e')][_0x832f('0x25')](_0x832f('0x29')))),_0x832f('0x2a')],[db[_0x832f('0x1e')]['fn'](_0x832f('0x28'),db['sequelize']['fn']('IF',db[_0x832f('0x1e')][_0x832f('0x25')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x832f('0x2b')]]})['then'](function(_0x8ea9eb){logger[_0x832f('0xd')](_0x832f('0x1b'),_0x421952);logger[_0x832f('0xf')](_0x832f('0x1b'),_0x421952,JSON[_0x832f('0x11')](_0x8ea9eb));_0x317cae(_0x8ea9eb);})['catch'](function(_0x404a93){logger[_0x832f('0x12')](_0x832f('0x1b'),_0x404a93[_0x832f('0x14')],_0x421952);_0x227202(_0x3e16d4[_0x832f('0x12')](0x1f4,_0x404a93['message']));});});};exports[_0x832f('0x2c')]=function(_0x23ccfd){var _0x130ee5=this;return new Promise(function(_0x31a085,_0x740850){return db['CmHopperHistory'][_0x832f('0x1c')]({'raw':_0x23ccfd[_0x832f('0x19')]?_0x23ccfd[_0x832f('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x23ccfd[_0x832f('0x19')]?_0x23ccfd[_0x832f('0x19')]['where']||null:null,'attributes':[[_0x832f('0x2d'),'name'],[db[_0x832f('0x1e')]['fn'](_0x832f('0x1f'),db[_0x832f('0x1e')]['fn']('IF',db[_0x832f('0x1e')][_0x832f('0x25')](_0x832f('0x2e')))),_0x832f('0x2f')],[db[_0x832f('0x1e')]['fn'](_0x832f('0x1f'),db[_0x832f('0x1e')]['fn']('IF',db['sequelize'][_0x832f('0x25')]('`state`\x20=\x203,\x201,\x20null'))),_0x832f('0x30')],[db['sequelize']['fn'](_0x832f('0x1f'),db[_0x832f('0x1e')]['fn']('IF',db[_0x832f('0x1e')]['literal'](_0x832f('0x22')))),_0x832f('0x31')],[db[_0x832f('0x1e')]['fn']('COUNT',db[_0x832f('0x1e')]['fn']('IF',db[_0x832f('0x1e')][_0x832f('0x25')](_0x832f('0x32')))),'outboundBusyCallsDay'],[db[_0x832f('0x1e')]['fn']('COUNT',db[_0x832f('0x1e')]['fn']('IF',db[_0x832f('0x1e')][_0x832f('0x25')](_0x832f('0x33')))),_0x832f('0x34')],[db[_0x832f('0x1e')]['fn'](_0x832f('0x1f'),db[_0x832f('0x1e')]['fn']('IF',db[_0x832f('0x1e')]['literal'](_0x832f('0x35')))),'outboundDropCallsDayTimeout'],[db['sequelize']['fn'](_0x832f('0x1f'),db[_0x832f('0x1e')]['fn']('IF',db['sequelize'][_0x832f('0x25')](_0x832f('0x36')))),_0x832f('0x37')],[db[_0x832f('0x1e')]['fn']('COUNT',db[_0x832f('0x1e')]['fn']('IF',db[_0x832f('0x1e')]['literal'](_0x832f('0x38')))),_0x832f('0x39')],[db[_0x832f('0x1e')]['fn'](_0x832f('0x1f'),db[_0x832f('0x1e')]['fn']('IF',db[_0x832f('0x1e')][_0x832f('0x25')](_0x832f('0x3a')))),_0x832f('0x3b')],[db[_0x832f('0x1e')]['fn'](_0x832f('0x1f'),db[_0x832f('0x1e')]['fn']('IF',db[_0x832f('0x1e')][_0x832f('0x25')]('`state`\x20=\x2014,\x201,\x20null'))),'outboundOriginateFailureCallsDay'],[db[_0x832f('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x832f('0x1e')][_0x832f('0x25')](_0x832f('0x3c')))),_0x832f('0x3d')],[db[_0x832f('0x1e')]['fn'](_0x832f('0x1f'),db[_0x832f('0x1e')]['fn']('IF',db[_0x832f('0x1e')][_0x832f('0x25')](_0x832f('0x3e')))),'outboundAnswerAgiCallsDay'],[db[_0x832f('0x1e')]['fn'](_0x832f('0x1f'),db['sequelize']['fn']('IF',db[_0x832f('0x1e')][_0x832f('0x25')](_0x832f('0x3f')))),_0x832f('0x3d')],[db[_0x832f('0x1e')]['fn'](_0x832f('0x1f'),db['sequelize']['fn']('IF',db['sequelize'][_0x832f('0x25')](_0x832f('0x40')))),'outboundReCallsDay']],'group':[_0x832f('0x2d')]})[_0x832f('0xc')](function(_0x5247a6){logger['info'](_0x832f('0x2c'),_0x23ccfd);logger[_0x832f('0xf')](_0x832f('0x2c'),_0x23ccfd,JSON['stringify'](_0x5247a6));_0x31a085(_0x5247a6);})[_0x832f('0x15')](function(_0x4ea0b3){logger[_0x832f('0x12')](_0x832f('0x2c'),_0x4ea0b3[_0x832f('0x14')],_0x23ccfd);_0x740850(_0x130ee5[_0x832f('0x12')](0x1f4,_0x4ea0b3[_0x832f('0x14')]));});});};exports[_0x832f('0x41')]=function(_0xa21ad5){var _0x45f681=this;return new Promise(function(_0x5df8d0,_0x5c5da4){return db['CmHopperHistory'][_0x832f('0x1c')]({'raw':_0xa21ad5['options']?_0xa21ad5[_0x832f('0x19')][_0x832f('0x1a')]===undefined?!![]:![]:!![],'where':_0xa21ad5['options']?_0xa21ad5[_0x832f('0x19')]['where']||null:null,'attributes':[[_0x832f('0x2d'),_0x832f('0x42')],[db['sequelize']['fn']('COUNT',db[_0x832f('0x1e')][_0x832f('0x20')]('id')),_0x832f('0x43')],[db['sequelize']['fn'](_0x832f('0x1f'),db[_0x832f('0x1e')]['fn']('IF',db[_0x832f('0x1e')][_0x832f('0x25')](_0x832f('0x22')))),_0x832f('0x44')]],'group':[_0x832f('0x2d')]})['then'](function(_0x2e13c0){logger[_0x832f('0xd')](_0x832f('0x41'),_0xa21ad5);logger[_0x832f('0xf')](_0x832f('0x41'),_0xa21ad5,JSON[_0x832f('0x11')](_0x2e13c0));_0x5df8d0(_0x2e13c0);})[_0x832f('0x15')](function(_0x261226){logger[_0x832f('0x12')](_0x832f('0x41'),_0x261226[_0x832f('0x14')],_0xa21ad5);_0x5c5da4(_0x45f681[_0x832f('0x12')](0x1f4,_0x261226[_0x832f('0x14')]));});});}; \ No newline at end of file +var _0x7794=['CreateCmHopperHistory','CmHopperHistory','create','options','raw','AvgHandleTime','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','findAll','campaign','name','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','http','request','then','info','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','result','catch'];(function(_0x4c90e1,_0x2bcc12){var _0x28d3ae=function(_0x3a7659){while(--_0x3a7659){_0x4c90e1['push'](_0x4c90e1['shift']());}};_0x28d3ae(++_0x2bcc12);}(_0x7794,0x7b));var _0x4779=function(_0x7d0551,_0x280013){_0x7d0551=_0x7d0551-0x0;var _0x5cf38a=_0x7794[_0x7d0551];return _0x5cf38a;};'use strict';var _=require('lodash');var util=require(_0x4779('0x0'));var moment=require(_0x4779('0x1'));var BPromise=require(_0x4779('0x2'));var rs=require(_0x4779('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4779('0x4'))['db'];var utils=require(_0x4779('0x5'));var logger=require('../../config/logger')(_0x4779('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x4779('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x339512,_0x523c93,_0xb3fe18){return new BPromise(function(_0x13bb66,_0x270a5f){return client[_0x4779('0x8')](_0x339512,_0xb3fe18)[_0x4779('0x9')](function(_0x7179e1){logger[_0x4779('0xa')]('CmHopperHistory,\x20%s,\x20%s',_0x523c93,_0x4779('0xb'));logger[_0x4779('0xc')](_0x4779('0xd'),_0x523c93,_0x4779('0xb'),JSON[_0x4779('0xe')](_0x7179e1));if(_0x7179e1[_0x4779('0xf')]){if(_0x7179e1[_0x4779('0xf')][_0x4779('0x10')]===0x1f4){logger[_0x4779('0xf')](_0x4779('0x11'),_0x523c93,_0x7179e1['error']['message']);return _0x270a5f(_0x7179e1['error'][_0x4779('0x12')]);}logger[_0x4779('0xf')](_0x4779('0x11'),_0x523c93,_0x7179e1[_0x4779('0xf')]['message']);return _0x13bb66(_0x7179e1[_0x4779('0xf')][_0x4779('0x12')]);}else{logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x523c93,_0x4779('0xb'));_0x13bb66(_0x7179e1[_0x4779('0x13')][_0x4779('0x12')]);}})[_0x4779('0x14')](function(_0x56ec51){logger['error'](_0x4779('0x11'),_0x523c93,_0x56ec51);_0x270a5f(_0x56ec51);});});}exports[_0x4779('0x15')]=function(_0x19fbb6){var _0x582e89=this;return new Promise(function(_0x3dbe70,_0x5d9a58){return db[_0x4779('0x16')][_0x4779('0x17')](_0x19fbb6['body'],{'raw':_0x19fbb6[_0x4779('0x18')]?_0x19fbb6['options'][_0x4779('0x19')]===undefined?!![]:![]:!![]})[_0x4779('0x9')](function(_0x143ef6){logger[_0x4779('0xa')](_0x4779('0x15'),_0x19fbb6);logger[_0x4779('0xc')]('CreateCmHopperHistory',_0x19fbb6,JSON[_0x4779('0xe')](_0x143ef6));_0x3dbe70(_0x143ef6);})['catch'](function(_0x4ad246){logger[_0x4779('0xf')](_0x4779('0x15'),_0x4ad246[_0x4779('0x12')],_0x19fbb6);_0x5d9a58(_0x582e89[_0x4779('0xf')](0x1f4,_0x4ad246['message']));});});};exports[_0x4779('0x1a')]=function(_0x29a39a){var _0x21ad21=this;return new Promise(function(_0x4c0053,_0x340648){return db[_0x4779('0x16')]['findAll']({'raw':_0x29a39a[_0x4779('0x18')]?_0x29a39a[_0x4779('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x29a39a[_0x4779('0x18')]?_0x29a39a[_0x4779('0x18')][_0x4779('0x1b')]||null:null,'attributes':[[db[_0x4779('0x1c')]['fn'](_0x4779('0x1d'),db[_0x4779('0x1c')][_0x4779('0x1e')]('id')),_0x4779('0x1f')],[db['sequelize']['fn'](_0x4779('0x1d'),db[_0x4779('0x1c')]['fn']('IF',db[_0x4779('0x1c')][_0x4779('0x20')](_0x4779('0x21')))),_0x4779('0x22')],[db[_0x4779('0x1c')]['fn'](_0x4779('0x1d'),db['sequelize']['fn']('IF',db['sequelize'][_0x4779('0x20')](_0x4779('0x23')))),_0x4779('0x24')],[db[_0x4779('0x1c')]['fn'](_0x4779('0x1d'),db['sequelize']['fn']('IF',db[_0x4779('0x1c')][_0x4779('0x20')](_0x4779('0x25')))),_0x4779('0x26')],[db['sequelize']['fn']('AVG',db[_0x4779('0x1c')]['fn']('IF',db['sequelize'][_0x4779('0x20')](_0x4779('0x27')))),_0x4779('0x28')],[db[_0x4779('0x1c')]['fn'](_0x4779('0x29'),db[_0x4779('0x1c')]['fn']('IF',db[_0x4779('0x1c')][_0x4779('0x20')](_0x4779('0x2a')))),_0x4779('0x2b')]]})[_0x4779('0x9')](function(_0x37cf30){logger['info']('AvgHandleTime',_0x29a39a);logger[_0x4779('0xc')]('AvgHandleTime',_0x29a39a,JSON[_0x4779('0xe')](_0x37cf30));_0x4c0053(_0x37cf30);})['catch'](function(_0x133eb8){logger[_0x4779('0xf')](_0x4779('0x1a'),_0x133eb8[_0x4779('0x12')],_0x29a39a);_0x340648(_0x21ad21[_0x4779('0xf')](0x1f4,_0x133eb8['message']));});});};exports['GetVoiceQueueHopperHistory']=function(_0x444734){var _0x399c09=this;return new Promise(function(_0x1ab842,_0xced32a){return db[_0x4779('0x16')][_0x4779('0x2c')]({'raw':_0x444734[_0x4779('0x18')]?_0x444734[_0x4779('0x18')][_0x4779('0x19')]===undefined?!![]:![]:!![],'where':_0x444734[_0x4779('0x18')]?_0x444734[_0x4779('0x18')][_0x4779('0x1b')]||null:null,'attributes':[[_0x4779('0x2d'),_0x4779('0x2e')],[db[_0x4779('0x1c')]['fn'](_0x4779('0x1d'),db[_0x4779('0x1c')]['fn']('IF',db[_0x4779('0x1c')][_0x4779('0x20')]('`state`\x20=\x200,\x201,\x20null'))),_0x4779('0x2f')],[db['sequelize']['fn'](_0x4779('0x1d'),db[_0x4779('0x1c')]['fn']('IF',db[_0x4779('0x1c')][_0x4779('0x20')](_0x4779('0x30')))),_0x4779('0x31')],[db['sequelize']['fn'](_0x4779('0x1d'),db['sequelize']['fn']('IF',db[_0x4779('0x1c')][_0x4779('0x20')](_0x4779('0x21')))),_0x4779('0x32')],[db[_0x4779('0x1c')]['fn'](_0x4779('0x1d'),db['sequelize']['fn']('IF',db[_0x4779('0x1c')]['literal'](_0x4779('0x33')))),_0x4779('0x34')],[db[_0x4779('0x1c')]['fn']('COUNT',db[_0x4779('0x1c')]['fn']('IF',db[_0x4779('0x1c')][_0x4779('0x20')](_0x4779('0x35')))),_0x4779('0x36')],[db[_0x4779('0x1c')]['fn'](_0x4779('0x1d'),db[_0x4779('0x1c')]['fn']('IF',db[_0x4779('0x1c')][_0x4779('0x20')](_0x4779('0x37')))),_0x4779('0x38')],[db[_0x4779('0x1c')]['fn'](_0x4779('0x1d'),db[_0x4779('0x1c')]['fn']('IF',db['sequelize']['literal'](_0x4779('0x39')))),_0x4779('0x3a')],[db[_0x4779('0x1c')]['fn'](_0x4779('0x1d'),db[_0x4779('0x1c')]['fn']('IF',db[_0x4779('0x1c')][_0x4779('0x20')](_0x4779('0x3b')))),'outboundUnknownCallsDay'],[db[_0x4779('0x1c')]['fn'](_0x4779('0x1d'),db[_0x4779('0x1c')]['fn']('IF',db[_0x4779('0x1c')][_0x4779('0x20')](_0x4779('0x3c')))),'outboundBlacklistCallsDay'],[db[_0x4779('0x1c')]['fn'](_0x4779('0x1d'),db[_0x4779('0x1c')]['fn']('IF',db[_0x4779('0x1c')][_0x4779('0x20')]('`state`\x20=\x2014,\x201,\x20null'))),_0x4779('0x3d')],[db[_0x4779('0x1c')]['fn'](_0x4779('0x1d'),db['sequelize']['fn']('IF',db[_0x4779('0x1c')]['literal'](_0x4779('0x3e')))),_0x4779('0x3f')],[db[_0x4779('0x1c')]['fn']('COUNT',db[_0x4779('0x1c')]['fn']('IF',db['sequelize'][_0x4779('0x20')](_0x4779('0x40')))),_0x4779('0x41')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4779('0x1c')][_0x4779('0x20')]('`state`\x20=\x2020,\x201,\x20null'))),_0x4779('0x3f')],[db[_0x4779('0x1c')]['fn'](_0x4779('0x1d'),db[_0x4779('0x1c')]['fn']('IF',db[_0x4779('0x1c')]['literal'](_0x4779('0x42')))),_0x4779('0x43')]],'group':[_0x4779('0x2d')]})[_0x4779('0x9')](function(_0x15c180){logger[_0x4779('0xa')](_0x4779('0x44'),_0x444734);logger[_0x4779('0xc')]('GetVoiceQueueHopperHistory',_0x444734,JSON['stringify'](_0x15c180));_0x1ab842(_0x15c180);})[_0x4779('0x14')](function(_0x34e951){logger[_0x4779('0xf')](_0x4779('0x44'),_0x34e951['message'],_0x444734);_0xced32a(_0x399c09[_0x4779('0xf')](0x1f4,_0x34e951[_0x4779('0x12')]));});});};exports['GetCampaignHopperHistory']=function(_0x45d103){var _0x288fbb=this;return new Promise(function(_0x3f677e,_0x499924){return db['CmHopperHistory'][_0x4779('0x2c')]({'raw':_0x45d103[_0x4779('0x18')]?_0x45d103['options'][_0x4779('0x19')]===undefined?!![]:![]:!![],'where':_0x45d103[_0x4779('0x18')]?_0x45d103[_0x4779('0x18')][_0x4779('0x1b')]||null:null,'attributes':[[_0x4779('0x2d'),_0x4779('0x2e')],[db[_0x4779('0x1c')]['fn'](_0x4779('0x1d'),db[_0x4779('0x1c')][_0x4779('0x1e')]('id')),_0x4779('0x45')],[db[_0x4779('0x1c')]['fn'](_0x4779('0x1d'),db[_0x4779('0x1c')]['fn']('IF',db['sequelize']['literal'](_0x4779('0x21')))),_0x4779('0x46')]],'group':[_0x4779('0x2d')]})['then'](function(_0x2f21ef){logger[_0x4779('0xa')](_0x4779('0x47'),_0x45d103);logger[_0x4779('0xc')](_0x4779('0x47'),_0x45d103,JSON['stringify'](_0x2f21ef));_0x3f677e(_0x2f21ef);})[_0x4779('0x14')](function(_0x3813d5){logger[_0x4779('0xf')](_0x4779('0x47'),_0x3813d5[_0x4779('0x12')],_0x45d103);_0x499924(_0x288fbb[_0x4779('0xf')](0x1f4,_0x3813d5['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 24a3855..464c471 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 _0xe68c=['get','index','/describe','isAuthenticated','describe','/:id','post','create','put','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./cmHopperHistory.controller'];(function(_0x56eb37,_0x1101ec){var _0x22ae50=function(_0x15cdcd){while(--_0x15cdcd){_0x56eb37['push'](_0x56eb37['shift']());}};_0x22ae50(++_0x1101ec);}(_0xe68c,0x1e6));var _0xce68=function(_0x33df39,_0x4bafac){_0x33df39=_0x33df39-0x0;var _0x4e27ef=_0xe68c[_0x33df39];return _0x4e27ef;};'use strict';var multer=require(_0xce68('0x0'));var util=require(_0xce68('0x1'));var path=require('path');var timeout=require(_0xce68('0x2'));var express=require(_0xce68('0x3'));var router=express[_0xce68('0x4')]();var fs_extra=require(_0xce68('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xce68('0x6'));var config=require('../../config/environment');var controller=require(_0xce68('0x7'));router[_0xce68('0x8')]('/',auth['isAuthenticated'](),controller[_0xce68('0x9')]);router[_0xce68('0x8')](_0xce68('0xa'),auth[_0xce68('0xb')](),controller[_0xce68('0xc')]);router[_0xce68('0x8')](_0xce68('0xd'),auth[_0xce68('0xb')](),controller['show']);router[_0xce68('0xe')]('/',auth[_0xce68('0xb')](),controller[_0xce68('0xf')]);router[_0xce68('0x10')](_0xce68('0xd'),auth[_0xce68('0xb')](),controller[_0xce68('0x11')]);module[_0xce68('0x12')]=router; \ No newline at end of file +var _0xf0fa=['multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','exports'];(function(_0x497826,_0x164921){var _0x4b3ae6=function(_0x1c18e1){while(--_0x1c18e1){_0x497826['push'](_0x497826['shift']());}};_0x4b3ae6(++_0x164921);}(_0xf0fa,0x7e));var _0xaf0f=function(_0x50d86c,_0xa6d91d){_0x50d86c=_0x50d86c-0x0;var _0x2e7ef0=_0xf0fa[_0x50d86c];return _0x2e7ef0;};'use strict';var multer=require(_0xaf0f('0x0'));var util=require('util');var path=require(_0xaf0f('0x1'));var timeout=require(_0xaf0f('0x2'));var express=require('express');var router=express[_0xaf0f('0x3')]();var fs_extra=require(_0xaf0f('0x4'));var auth=require(_0xaf0f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmHopperHistory.controller');router[_0xaf0f('0x6')]('/',auth['isAuthenticated'](),controller[_0xaf0f('0x7')]);router[_0xaf0f('0x6')](_0xaf0f('0x8'),auth[_0xaf0f('0x9')](),controller[_0xaf0f('0xa')]);router[_0xaf0f('0x6')](_0xaf0f('0xb'),auth[_0xaf0f('0x9')](),controller[_0xaf0f('0xc')]);router[_0xaf0f('0xd')]('/',auth['isAuthenticated'](),controller[_0xaf0f('0xe')]);router[_0xaf0f('0xf')]('/:id',auth[_0xaf0f('0x9')](),controller[_0xaf0f('0x10')]);module[_0xaf0f('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 28489a8..46810ca 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 _0xaf9b=['STRING','sequelize'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xaf9b,0x1d7));var _0xbaf9=function(_0x439550,_0x4b4d69){_0x439550=_0x439550-0x0;var _0x2de74b=_0xaf9b[_0x439550];return _0x2de74b;};'use strict';var Sequelize=require(_0xbaf9('0x0'));module['exports']={'name':{'type':Sequelize[_0xbaf9('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xbaf9('0x1')]},'dialPrefix':{'type':Sequelize[_0xbaf9('0x1')]}}; \ No newline at end of file +var _0xc9b9=['name','STRING'];(function(_0x42f3a5,_0x3a4470){var _0x1a7d74=function(_0x43cc36){while(--_0x43cc36){_0x42f3a5['push'](_0x42f3a5['shift']());}};_0x1a7d74(++_0x3a4470);}(_0xc9b9,0x18f));var _0x9c9b=function(_0x1b91c7,_0x539acd){_0x1b91c7=_0x1b91c7-0x0;var _0xbbe014=_0xc9b9[_0x1b91c7];return _0xbbe014;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x9c9b('0x0')],'unique':_0x9c9b('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9c9b('0x0')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index de8ea14..56436b2 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 _0xdc34=['length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','catch','show','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','destroy','params','describe','addDisposition','ListId','Disposition','getDispositions','findOne','rows','removeDispositions','ids','addContacts','tags','isArray','join','each','CmContact','omit','success','push','dataValues','Malformed\x20request\x20syntax','getContacts','rawAttributes','concat','CustomFields','cf_%d','order','raw','getContactsCsv','ContactItemType','OrderBy','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','c.cf_','customField_','alias','field','cm_contact_has_items','CmContactId\x20=\x20c.id','ItemTypeId\x20=\x20?','description_additionalPhone_','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','setHeader','Content-type','text/csv','download','format','addCustomField','sequelize','addCustomFields','TEXT','text','Sequelize','number','addColumn','cf_%s','getCustomFields','CmCustomField','findAndCountAll','getGlobalCustomFields','addAgents','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','spread','message','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../mysqldb','redis','defaults','socket.io-emitter','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','get','Lists','UserProfileResource','error','stack','name','send','index','CmList','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdc34,0x68));var _0x4dc3=function(_0xbe8767,_0x39457f){_0xbe8767=_0xbe8767-0x0;var _0x6ce23f=_0xdc34[_0xbe8767];return _0x6ce23f;};'use strict';var emlformat=require(_0x4dc3('0x0'));var rimraf=require(_0x4dc3('0x1'));var zipdir=require(_0x4dc3('0x2'));var jsonpatch=require(_0x4dc3('0x3'));var rp=require(_0x4dc3('0x4'));var moment=require('moment');var BPromise=require(_0x4dc3('0x5'));var Mustache=require(_0x4dc3('0x6'));var util=require(_0x4dc3('0x7'));var path=require(_0x4dc3('0x8'));var sox=require('sox');var csv=require(_0x4dc3('0x9'));var ejs=require(_0x4dc3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4dc3('0xb'));var squel=require(_0x4dc3('0xc'));var crypto=require(_0x4dc3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4dc3('0xe'));var toCsv=require(_0x4dc3('0x9'));var querystring=require(_0x4dc3('0xf'));var Papa=require(_0x4dc3('0x10'));var Redis=require(_0x4dc3('0x11'));var authService=require(_0x4dc3('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4dc3('0x13'));var logger=require(_0x4dc3('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4dc3('0x15'))['db'];var csv_results;config[_0x4dc3('0x16')]=_[_0x4dc3('0x17')](config[_0x4dc3('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x4dc3('0x18'))(new Redis(config[_0x4dc3('0x16')]));require('./cmList.socket')['register'](socket);function respondWithStatusCode(_0xebf51a,_0x4c9797){_0x4c9797=_0x4c9797||0xcc;return function(_0x5834db){if(_0x5834db){return _0xebf51a[_0x4dc3('0x19')](_0x4c9797);}return _0xebf51a[_0x4dc3('0x1a')](_0x4c9797)[_0x4dc3('0x1b')]();};}function respondWithResult(_0x4b425e,_0x2bae18){_0x2bae18=_0x2bae18||0xc8;return function(_0x3b65d2){if(_0x3b65d2){return _0x4b425e['status'](_0x2bae18)[_0x4dc3('0x1c')](_0x3b65d2);}};}function respondWithFilteredResult(_0x5c0b51,_0xbbf178){return function(_0x361a56){if(_0x361a56){var _0x4acb07=typeof _0xbbf178[_0x4dc3('0x1d')]===_0x4dc3('0x1e')&&typeof _0xbbf178['limit']===_0x4dc3('0x1e');var _0x19b761=_0x361a56[_0x4dc3('0x1f')];var _0x42cf5e=_0x4acb07?0x0:_0xbbf178['offset'];var _0xec464d=_0x4acb07?_0x361a56[_0x4dc3('0x1f')]:_0xbbf178[_0x4dc3('0x1d')]+_0xbbf178[_0x4dc3('0x20')];var _0x42a223;if(_0xec464d>=_0x19b761){_0xec464d=_0x19b761;_0x42a223=0xc8;}else{_0x42a223=0xce;}_0x5c0b51[_0x4dc3('0x1a')](_0x42a223);return _0x5c0b51[_0x4dc3('0x21')]('Content-Range',_0x42cf5e+'-'+_0xec464d+'/'+_0x19b761)[_0x4dc3('0x1c')](_0x361a56);}return null;};}function patchUpdates(_0x2a9c96){return function(_0x629f2e){try{jsonpatch[_0x4dc3('0x22')](_0x629f2e,_0x2a9c96,!![]);}catch(_0x149381){return BPromise[_0x4dc3('0x23')](_0x149381);}return _0x629f2e[_0x4dc3('0x24')]();};}function saveUpdates(_0x15544c,_0x452933){return function(_0x37515f){if(_0x37515f){return _0x37515f[_0x4dc3('0x25')](_0x15544c)[_0x4dc3('0x26')](function(_0x200f87){return _0x200f87;});}return null;};}function removeEntity(_0x1f8640,_0xa75cce){return function(_0x4f10a9){if(_0x4f10a9){return _0x4f10a9['destroy']()[_0x4dc3('0x26')](function(){var _0x1dce2a=_0x4f10a9[_0x4dc3('0x27')]({'plain':!![]});var _0x22ebba=_0x4dc3('0x28');return db[_0x4dc3('0x29')]['destroy']({'where':{'type':_0x22ebba,'resourceId':_0x1dce2a['id']}})[_0x4dc3('0x26')](function(){return _0x4f10a9;});})['then'](function(){_0x1f8640[_0x4dc3('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cb605,_0x31459e){return function(_0x5be1e4){if(!_0x5be1e4){_0x2cb605[_0x4dc3('0x19')](0x194);}return _0x5be1e4;};}function handleError(_0x17c5c7,_0x57f28a){_0x57f28a=_0x57f28a||0x1f4;return function(_0x531aca){logger[_0x4dc3('0x2a')](_0x531aca[_0x4dc3('0x2b')]);if(_0x531aca['name']){delete _0x531aca[_0x4dc3('0x2c')];}_0x17c5c7[_0x4dc3('0x1a')](_0x57f28a)[_0x4dc3('0x2d')](_0x531aca);};}exports[_0x4dc3('0x2e')]=function(_0x3dd4c4,_0xd431ab){var _0x37aed3={},_0x50dc56={},_0x49f04b={'count':0x0,'rows':[]};var _0x416f7d=_['map'](db[_0x4dc3('0x2f')]['rawAttributes'],function(_0x383a38){return{'name':_0x383a38[_0x4dc3('0x30')],'type':_0x383a38[_0x4dc3('0x31')][_0x4dc3('0x32')]};});_0x50dc56[_0x4dc3('0x33')]=_[_0x4dc3('0x34')](_0x416f7d,_0x4dc3('0x2c'));_0x50dc56[_0x4dc3('0x35')]=_[_0x4dc3('0x36')](_0x3dd4c4[_0x4dc3('0x35')]);_0x50dc56[_0x4dc3('0x37')]=_[_0x4dc3('0x38')](_0x50dc56[_0x4dc3('0x33')],_0x50dc56[_0x4dc3('0x35')]);_0x37aed3[_0x4dc3('0x39')]=_['intersection'](_0x50dc56['model'],qs[_0x4dc3('0x3a')](_0x3dd4c4[_0x4dc3('0x35')][_0x4dc3('0x3a')]));_0x37aed3['attributes']=_0x37aed3[_0x4dc3('0x39')][_0x4dc3('0x3b')]?_0x37aed3[_0x4dc3('0x39')]:_0x50dc56['model'];if(!_0x3dd4c4['query'][_0x4dc3('0x3c')](_0x4dc3('0x3d'))){_0x37aed3[_0x4dc3('0x20')]=qs['limit'](_0x3dd4c4[_0x4dc3('0x35')][_0x4dc3('0x20')]);_0x37aed3[_0x4dc3('0x1d')]=qs[_0x4dc3('0x1d')](_0x3dd4c4[_0x4dc3('0x35')][_0x4dc3('0x1d')]);}_0x37aed3['order']=qs[_0x4dc3('0x3e')](_0x3dd4c4[_0x4dc3('0x35')][_0x4dc3('0x3e')]);_0x37aed3['where']=qs['filters'](_[_0x4dc3('0x3f')](_0x3dd4c4['query'],_0x50dc56[_0x4dc3('0x37')]),_0x416f7d);if(_0x3dd4c4['query'][_0x4dc3('0x40')]){_0x37aed3[_0x4dc3('0x41')]=_[_0x4dc3('0x42')](_0x37aed3['where'],{'$or':_[_0x4dc3('0x34')](_0x416f7d,function(_0x298a91){if(_0x298a91['type']!==_0x4dc3('0x43')){var _0x1226d1={};_0x1226d1[_0x298a91[_0x4dc3('0x2c')]]={'$like':'%'+_0x3dd4c4['query'][_0x4dc3('0x40')]+'%'};return _0x1226d1;}})});}_0x37aed3=_[_0x4dc3('0x42')]({},_0x37aed3,_0x3dd4c4[_0x4dc3('0x44')]);var _0x1f986c={'where':_0x37aed3[_0x4dc3('0x41')]};return db['CmList']['count'](_0x1f986c)[_0x4dc3('0x26')](function(_0x2317ff){_0x49f04b[_0x4dc3('0x1f')]=_0x2317ff;if(_0x3dd4c4[_0x4dc3('0x35')][_0x4dc3('0x45')]){_0x37aed3['include']=[{'all':!![]}];}return db['CmList'][_0x4dc3('0x46')](_0x37aed3);})['then'](function(_0x2e476e){_0x49f04b['rows']=_0x2e476e;return _0x49f04b;})[_0x4dc3('0x26')](respondWithFilteredResult(_0xd431ab,_0x37aed3))[_0x4dc3('0x47')](handleError(_0xd431ab,null));};exports[_0x4dc3('0x48')]=function(_0xa06523,_0x2e2752){var _0x288521={'raw':![],'where':{'id':_0xa06523['params']['id']}},_0x5ee1fb={};_0x5ee1fb[_0x4dc3('0x33')]=_[_0x4dc3('0x36')](db[_0x4dc3('0x2f')]['rawAttributes']);_0x5ee1fb['query']=_[_0x4dc3('0x36')](_0xa06523[_0x4dc3('0x35')]);_0x5ee1fb[_0x4dc3('0x37')]=_[_0x4dc3('0x38')](_0x5ee1fb[_0x4dc3('0x33')],_0x5ee1fb[_0x4dc3('0x35')]);_0x288521[_0x4dc3('0x39')]=_['intersection'](_0x5ee1fb[_0x4dc3('0x33')],qs[_0x4dc3('0x3a')](_0xa06523[_0x4dc3('0x35')][_0x4dc3('0x3a')]));_0x288521[_0x4dc3('0x39')]=_0x288521[_0x4dc3('0x39')][_0x4dc3('0x3b')]?_0x288521[_0x4dc3('0x39')]:_0x5ee1fb[_0x4dc3('0x33')];if(_0xa06523[_0x4dc3('0x35')][_0x4dc3('0x45')]){_0x288521[_0x4dc3('0x49')]=[{'all':!![]}];}_0x288521=_['merge']({},_0x288521,_0xa06523[_0x4dc3('0x44')]);return db[_0x4dc3('0x2f')][_0x4dc3('0x4a')](_0x288521)[_0x4dc3('0x26')](handleEntityNotFound(_0x2e2752,null))[_0x4dc3('0x26')](respondWithResult(_0x2e2752,null))[_0x4dc3('0x47')](handleError(_0x2e2752,null));};exports[_0x4dc3('0x4b')]=function(_0x27a179,_0x8c5613){return db[_0x4dc3('0x2f')][_0x4dc3('0x4b')](_0x27a179[_0x4dc3('0x4c')],{})[_0x4dc3('0x26')](function(_0x5e7d6c){var _0x54b65b=_0x27a179[_0x4dc3('0x4d')][_0x4dc3('0x27')]({'plain':!![]});if(!_0x54b65b)throw new Error(_0x4dc3('0x4e'));if(_0x54b65b['role']==='user'){var _0x3b02a7=_0x5e7d6c['get']({'plain':!![]});var _0x5be23c=_0x4dc3('0x28');return db[_0x4dc3('0x4f')][_0x4dc3('0x4a')]({'where':{'name':_0x5be23c,'userProfileId':_0x54b65b[_0x4dc3('0x50')]},'raw':!![]})[_0x4dc3('0x26')](function(_0x6b9469){if(_0x6b9469&&_0x6b9469[_0x4dc3('0x51')]===0x0){return db[_0x4dc3('0x29')][_0x4dc3('0x4b')]({'name':_0x3b02a7['name'],'resourceId':_0x3b02a7['id'],'type':_0x6b9469[_0x4dc3('0x2c')],'sectionId':_0x6b9469['id']},{})[_0x4dc3('0x26')](function(){return _0x5e7d6c;});}else{return _0x5e7d6c;}})[_0x4dc3('0x47')](function(_0x19869d){logger[_0x4dc3('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x19869d);throw _0x19869d;});}return _0x5e7d6c;})[_0x4dc3('0x26')](respondWithResult(_0x8c5613,0xc9))[_0x4dc3('0x47')](handleError(_0x8c5613,null));};exports[_0x4dc3('0x25')]=function(_0x21a0b6,_0x462049){if(_0x21a0b6[_0x4dc3('0x4c')]['id']){delete _0x21a0b6[_0x4dc3('0x4c')]['id'];}return db[_0x4dc3('0x2f')][_0x4dc3('0x4a')]({'where':{'id':_0x21a0b6['params']['id']}})[_0x4dc3('0x26')](handleEntityNotFound(_0x462049,null))['then'](saveUpdates(_0x21a0b6[_0x4dc3('0x4c')],null))[_0x4dc3('0x26')](respondWithResult(_0x462049,null))[_0x4dc3('0x47')](handleError(_0x462049,null));};exports[_0x4dc3('0x52')]=function(_0x2214a0,_0x53de06){return db['CmList']['find']({'where':{'id':_0x2214a0[_0x4dc3('0x53')]['id']}})['then'](handleEntityNotFound(_0x53de06,null))['then'](removeEntity(_0x53de06,null))[_0x4dc3('0x47')](handleError(_0x53de06,null));};exports[_0x4dc3('0x54')]=function(_0x1321cb,_0x431af5){return db['CmList'][_0x4dc3('0x54')]()[_0x4dc3('0x26')](respondWithResult(_0x431af5,null))[_0x4dc3('0x47')](handleError(_0x431af5,null));};exports[_0x4dc3('0x55')]=function(_0x3a881d,_0x4b2a34,_0x123af3){if(_0x3a881d[_0x4dc3('0x4c')]['id']){delete _0x3a881d[_0x4dc3('0x4c')]['id'];}return db[_0x4dc3('0x2f')][_0x4dc3('0x4a')]({'where':{'id':_0x3a881d[_0x4dc3('0x53')]['id']}})[_0x4dc3('0x26')](handleEntityNotFound(_0x4b2a34,null))[_0x4dc3('0x26')](function(_0x567886){if(_0x567886){_0x3a881d[_0x4dc3('0x4c')][_0x4dc3('0x56')]=_0x567886['id'];return db[_0x4dc3('0x57')][_0x4dc3('0x4b')](_0x3a881d['body']);}})['then'](respondWithResult(_0x4b2a34,null))['catch'](handleError(_0x4b2a34,null));};exports[_0x4dc3('0x58')]=function(_0x390b26,_0x4f9e63,_0xb1eaae){var _0x51e959={'raw':![],'where':{}};var _0x49ac7e={};var _0x358423={'count':0x0,'rows':[]};return db[_0x4dc3('0x2f')][_0x4dc3('0x59')]({'where':{'id':_0x390b26['params']['id']}})[_0x4dc3('0x26')](handleEntityNotFound(_0x4f9e63,null))['then'](function(_0x50069a){if(_0x50069a){_0x49ac7e[_0x4dc3('0x33')]=_[_0x4dc3('0x36')](db[_0x4dc3('0x57')]['rawAttributes']);_0x49ac7e[_0x4dc3('0x35')]=_[_0x4dc3('0x36')](_0x390b26[_0x4dc3('0x35')]);_0x49ac7e[_0x4dc3('0x37')]=_[_0x4dc3('0x38')](_0x49ac7e[_0x4dc3('0x33')],_0x49ac7e[_0x4dc3('0x35')]);_0x51e959[_0x4dc3('0x39')]=_[_0x4dc3('0x38')](_0x49ac7e[_0x4dc3('0x33')],qs[_0x4dc3('0x3a')](_0x390b26[_0x4dc3('0x35')][_0x4dc3('0x3a')]));_0x51e959['attributes']=_0x51e959['attributes']['length']?_0x51e959['attributes']:_0x49ac7e[_0x4dc3('0x33')];if(!_0x390b26[_0x4dc3('0x35')][_0x4dc3('0x3c')](_0x4dc3('0x3d'))){_0x51e959[_0x4dc3('0x20')]=qs['limit'](_0x390b26[_0x4dc3('0x35')][_0x4dc3('0x20')]);_0x51e959[_0x4dc3('0x1d')]=qs[_0x4dc3('0x1d')](_0x390b26[_0x4dc3('0x35')][_0x4dc3('0x1d')]);}_0x51e959['order']=qs['sort'](_0x390b26[_0x4dc3('0x35')][_0x4dc3('0x3e')]);_0x51e959[_0x4dc3('0x41')]=qs[_0x4dc3('0x37')](_[_0x4dc3('0x3f')](_0x390b26[_0x4dc3('0x35')],_0x49ac7e['filters']));_0x51e959[_0x4dc3('0x41')][_0x4dc3('0x56')]=_0x50069a['id'];if(_0x390b26[_0x4dc3('0x35')][_0x4dc3('0x40')]){_0x51e959[_0x4dc3('0x41')]=_['merge'](_0x51e959[_0x4dc3('0x41')],{'$or':_['map'](_0x51e959[_0x4dc3('0x39')],function(_0x3ddccf){var _0xfa0fd5={};_0xfa0fd5[_0x3ddccf]={'$like':'%'+_0x390b26['query'][_0x4dc3('0x40')]+'%'};return _0xfa0fd5;})});}_0x51e959=_[_0x4dc3('0x42')]({},_0x51e959,_0x390b26[_0x4dc3('0x44')]);return db[_0x4dc3('0x57')]['count']({'where':_0x51e959['where']})[_0x4dc3('0x26')](function(_0x5a104f){_0x358423[_0x4dc3('0x1f')]=_0x5a104f;if(_0x390b26[_0x4dc3('0x35')]['includeAll']){_0x51e959[_0x4dc3('0x49')]=[{'all':!![]}];}return db['Disposition'][_0x4dc3('0x46')](_0x51e959);})[_0x4dc3('0x26')](function(_0x1fa62d){_0x358423[_0x4dc3('0x5a')]=_0x1fa62d;return _0x358423;});}})['then'](respondWithFilteredResult(_0x4f9e63,_0x51e959))[_0x4dc3('0x47')](handleError(_0x4f9e63,null));};exports[_0x4dc3('0x5b')]=function(_0x14de06,_0x5a46a0,_0x477912){return db[_0x4dc3('0x2f')][_0x4dc3('0x4a')]({'where':{'id':_0x14de06[_0x4dc3('0x53')]['id']}})[_0x4dc3('0x26')](handleEntityNotFound(_0x5a46a0,null))[_0x4dc3('0x26')](function(_0x112de7){if(_0x112de7){return _0x112de7[_0x4dc3('0x5b')](_0x14de06[_0x4dc3('0x35')][_0x4dc3('0x5c')]);}})[_0x4dc3('0x26')](respondWithStatusCode(_0x5a46a0,null))['catch'](handleError(_0x5a46a0,null));};exports[_0x4dc3('0x5d')]=function(_0x3831ac,_0x9e4ceb,_0x4ca6c9){return db[_0x4dc3('0x2f')][_0x4dc3('0x4a')]({'where':{'id':_0x3831ac[_0x4dc3('0x53')]['id']}})[_0x4dc3('0x26')](handleEntityNotFound(_0x9e4ceb,null))[_0x4dc3('0x26')](function(_0x1551b7){if(_0x1551b7){var _0x583bb9=[];var _0x4ea313={'success':[],'errors':[]};return db['CmContact'][_0x4dc3('0x54')]()[_0x4dc3('0x26')](function(_0x11a3ff){if(_0x3831ac['body'][_0x4dc3('0x5e')]&&_[_0x4dc3('0x5f')](_0x3831ac[_0x4dc3('0x4c')][_0x4dc3('0x5e')])){if(_0x3831ac[_0x4dc3('0x4c')]['tags']['length']){_0x3831ac['body'][_0x4dc3('0x5e')]=_0x3831ac[_0x4dc3('0x4c')]['tags'][_0x4dc3('0x60')](';')+';';}else{_0x3831ac['body'][_0x4dc3('0x5e')]=null;}}else{_0x3831ac[_0x4dc3('0x4c')][_0x4dc3('0x5e')]=null;}if(_0x3831ac[_0x4dc3('0x4c')]&&_[_0x4dc3('0x5f')](_0x3831ac[_0x4dc3('0x4c')])){for(var _0x1e7d36=0x0;_0x1e7d36<_0x3831ac[_0x4dc3('0x4c')][_0x4dc3('0x3b')];_0x1e7d36+=0x1){_0x3831ac[_0x4dc3('0x4c')][_0x1e7d36][_0x4dc3('0x56')]=_0x3831ac[_0x4dc3('0x53')]['id'];_0x583bb9['push'](_0x3831ac[_0x4dc3('0x4c')][_0x1e7d36]);}return BPromise[_0x4dc3('0x61')](_0x583bb9,function(_0x2e979b){return db[_0x4dc3('0x62')][_0x4dc3('0x4b')](_[_0x4dc3('0x63')](_0x2e979b,[_0x4dc3('0x5c'),'id'])||{},{'fields':_[_0x4dc3('0x36')](_0x11a3ff),'raw':!![]})[_0x4dc3('0x26')](function(_0x3fb990){_0x4ea313[_0x4dc3('0x64')][_0x4dc3('0x65')](_0x3fb990[_0x4dc3('0x66')]);})[_0x4dc3('0x47')](function(_0x4c7c1b){_0x4ea313['errors'][_0x4dc3('0x65')]({'data':_0x2e979b,'error':_0x4c7c1b['message']});});})[_0x4dc3('0x26')](function(_0x542a6a){return _0x4ea313;})[_0x4dc3('0x47')](function(_0x1a3dce){return _0x1a3dce;});}else{_0x9e4ceb[_0x4dc3('0x1a')](0x190)[_0x4dc3('0x1c')]({'message':_0x4dc3('0x67')});}});}})[_0x4dc3('0x26')](respondWithResult(_0x9e4ceb,null))[_0x4dc3('0x47')](handleError(_0x9e4ceb,null));};exports[_0x4dc3('0x68')]=function(_0x51260e,_0x2a0866,_0x181448){var _0xbd3148;return db[_0x4dc3('0x2f')]['find']({'where':{'id':_0x51260e[_0x4dc3('0x53')]['id']},'include':[{'model':db['CmCustomField'],'as':'CustomFields'}]})['then'](handleEntityNotFound(_0x2a0866,null))[_0x4dc3('0x26')](function(_0x56b365){if(_0x56b365){_0xbd3148=_0x56b365;return db[_0x4dc3('0x62')][_0x4dc3('0x69')];}})[_0x4dc3('0x26')](function(_0x39998f){if(_0x39998f){var _0x3e205a={};var _0x48501b={};_0x48501b[_0x4dc3('0x33')]=_[_0x4dc3('0x6a')](_['keys'](_0x39998f),_[_0x4dc3('0x34')](_0xbd3148[_0x4dc3('0x6b')],function(_0x275b19){return util['format'](_0x4dc3('0x6c'),_0x275b19['id']);}));_0x48501b[_0x4dc3('0x35')]=_['keys'](_0x51260e[_0x4dc3('0x35')]);_0x48501b[_0x4dc3('0x37')]=_[_0x4dc3('0x38')](_0x48501b['model'],_0x48501b[_0x4dc3('0x35')]);_0x3e205a[_0x4dc3('0x39')]=_[_0x4dc3('0x38')](_0x48501b['model'],qs[_0x4dc3('0x3a')](_0x51260e[_0x4dc3('0x35')][_0x4dc3('0x3a')]));_0x3e205a[_0x4dc3('0x39')]=_0x3e205a[_0x4dc3('0x39')][_0x4dc3('0x3b')]?_0x3e205a['attributes']:_0x48501b['model'];if(!_0x51260e[_0x4dc3('0x35')]['hasOwnProperty'](_0x4dc3('0x3d'))){_0x3e205a[_0x4dc3('0x20')]=qs[_0x4dc3('0x20')](_0x51260e[_0x4dc3('0x35')]['limit']);_0x3e205a['offset']=qs[_0x4dc3('0x1d')](_0x51260e['query']['offset']);}_0x3e205a[_0x4dc3('0x6d')]=qs[_0x4dc3('0x3e')](_0x51260e['query'][_0x4dc3('0x3e')]);_0x3e205a['where']=qs[_0x4dc3('0x37')](_[_0x4dc3('0x3f')](_0x51260e[_0x4dc3('0x35')],_0x48501b['filters']));_0x3e205a[_0x4dc3('0x6e')]=!![];if(_0x51260e[_0x4dc3('0x35')][_0x4dc3('0x40')]){_0x3e205a[_0x4dc3('0x41')]=_[_0x4dc3('0x42')](_0x3e205a[_0x4dc3('0x41')],{'$or':_[_0x4dc3('0x34')](_0x3e205a[_0x4dc3('0x39')],function(_0x447f0f){var _0x523805={};_0x523805[_0x447f0f]={'$like':'%'+_0x51260e['query'][_0x4dc3('0x40')]+'%'};return _0x523805;})});}_0x3e205a=_[_0x4dc3('0x42')]({},_0x3e205a,_0x51260e['options']);return _0xbd3148[_0x4dc3('0x68')](_0x3e205a);}})[_0x4dc3('0x26')](respondWithResult(_0x2a0866,null))['catch'](handleError(_0x2a0866,null));};exports[_0x4dc3('0x6f')]=function(_0x4533ef,_0x2c4296,_0x5d4087){var _0x40361b;var _0x31dc95;var _0x44eb52;var _0xb1514a=_0x4533ef['params']['id'];csv_results=[];return db[_0x4dc3('0x70')][_0x4dc3('0x46')]({'attributes':['id',_0x4dc3('0x2c')],'raw':!![],'order':[_0x4dc3('0x71')]})[_0x4dc3('0x26')](function(_0x589aeb){_0x40361b=_0x589aeb;var _0x1c01e6=_[_0x4dc3('0x36')](db[_0x4dc3('0x62')]['rawAttributes']);return db['CmCustomField'][_0x4dc3('0x46')]({'raw':!![],'attributes':['id','alias']})[_0x4dc3('0x26')](function(_0x20ef08){_0x31dc95=_0x20ef08;var _0x55ce0b=squel[_0x4dc3('0x72')]()[_0x4dc3('0x3a')](_0x1c01e6)[_0x4dc3('0x73')](_0x4dc3('0x74'),'c')[_0x4dc3('0x41')](_0x4dc3('0x75'),_0xb1514a)['where'](_0x4dc3('0x76'))[_0x4dc3('0x77')]();for(var _0x45b2a4=0x0;_0x45b2a4<_0x31dc95['length'];_0x45b2a4++){_0x55ce0b['field'](_0x4dc3('0x78')+_0x31dc95[_0x45b2a4]['id'],_0x4dc3('0x79')+_0x31dc95[_0x45b2a4][_0x4dc3('0x7a')]);}for(var _0x45b2a4=0x0;_0x45b2a4<_0x40361b['length'];_0x45b2a4++){_0x55ce0b[_0x4dc3('0x7b')](squel[_0x4dc3('0x72')]()[_0x4dc3('0x7b')]('item')[_0x4dc3('0x73')](_0x4dc3('0x7c'))[_0x4dc3('0x41')]('ItemTypeId\x20=\x20?',_0x40361b[_0x45b2a4]['id'])['where'](_0x4dc3('0x7d')),'additionalPhone_'+_0x40361b[_0x45b2a4][_0x4dc3('0x2c')]);_0x55ce0b[_0x4dc3('0x7b')](squel['select']()[_0x4dc3('0x7b')]('description')[_0x4dc3('0x73')](_0x4dc3('0x7c'))[_0x4dc3('0x41')](_0x4dc3('0x7e'),_0x40361b[_0x45b2a4]['id'])[_0x4dc3('0x41')](_0x4dc3('0x7d')),_0x4dc3('0x7f')+_0x40361b[_0x45b2a4][_0x4dc3('0x2c')]);}var _0x5785b8=[];_0x5785b8['push'](_0x55ce0b[_0x4dc3('0x80')]());BPromise['each'](_0x5785b8,handleQuery)[_0x4dc3('0x26')](function(_0x9d0f27){handleQuery(_0x55ce0b[_0x4dc3('0x80')]());var _0x48ad5b=csv_results[0x0];if(!_[_0x4dc3('0x81')](_0x48ad5b)){var _0x2de4c4=toCsv(_0x48ad5b);var _0x1e9128=Date[_0x4dc3('0x82')]();fs[_0x4dc3('0x83')](util['format'](_0x4dc3('0x84'),_0xb1514a,_0x1e9128),_0x2de4c4);_0x2c4296['setHeader'](_0x4dc3('0x85'),_0x4dc3('0x86')+util['format'](_0x4dc3('0x87'),_0xb1514a,_0x1e9128));_0x2c4296[_0x4dc3('0x88')](_0x4dc3('0x89'),_0x4dc3('0x8a'));return _0x2c4296[_0x4dc3('0x8b')](util[_0x4dc3('0x8c')](_0x4dc3('0x84'),_0xb1514a,_0x1e9128));}else{return _0x2c4296[_0x4dc3('0x19')](0xcc);}});});});};exports[_0x4dc3('0x8d')]=function(_0x3d916d,_0x51c1c3,_0x106a90){var _0x267ffc;delete _0x3d916d[_0x4dc3('0x4c')]['id'];return db[_0x4dc3('0x2f')]['findOne']({'where':{'id':_0x3d916d[_0x4dc3('0x53')]['id']}})['then'](handleEntityNotFound(_0x51c1c3,null))[_0x4dc3('0x26')](function(_0x125cb5){if(_0x125cb5){return db[_0x4dc3('0x8e')]['transaction'](function(_0x3862b2){return db['CmCustomField']['create'](_0x3d916d[_0x4dc3('0x4c')],{'transaction':_0x3862b2})['then'](function(_0x5a839d){_0x267ffc=_0x5a839d;return _0x125cb5[_0x4dc3('0x8f')](_0x5a839d,{'transaction':_0x3862b2});})[_0x4dc3('0x26')](function(){var _0x64e3be={'type':db['Sequelize'][_0x4dc3('0x90')],'transaction':_0x3862b2};switch(_0x3d916d[_0x4dc3('0x4c')][_0x4dc3('0x31')]){case _0x4dc3('0x91'):_0x64e3be['type']=db[_0x4dc3('0x92')][_0x4dc3('0x90')];break;case _0x4dc3('0x93'):_0x64e3be['type']=db[_0x4dc3('0x92')]['INTEGER'];break;case'switch':_0x64e3be['type']=db[_0x4dc3('0x92')]['BOOLEAN'];_0x64e3be['defaultValue']=![];break;default:}return db[_0x4dc3('0x8e')]['queryInterface'][_0x4dc3('0x94')](_0x4dc3('0x74'),util['format'](_0x4dc3('0x95'),_0x267ffc['id']),_0x64e3be);})[_0x4dc3('0x26')](function(){return _0x267ffc;});});}})[_0x4dc3('0x26')](respondWithResult(_0x51c1c3,null))['catch'](handleError(_0x51c1c3,null));};exports[_0x4dc3('0x96')]=function(_0x40d3e3,_0x565bad,_0x3d5cc1){var _0x3b4641={};var _0x4de409={};var _0x59be71;var _0xeb21a9;return db[_0x4dc3('0x2f')][_0x4dc3('0x59')]({'where':{'id':_0x40d3e3[_0x4dc3('0x53')]['id']}})[_0x4dc3('0x26')](handleEntityNotFound(_0x565bad,null))[_0x4dc3('0x26')](function(_0x2df07b){if(_0x2df07b){_0x59be71=_0x2df07b;_0x4de409['model']=_[_0x4dc3('0x36')](db[_0x4dc3('0x97')][_0x4dc3('0x69')]);_0x4de409[_0x4dc3('0x35')]=_['keys'](_0x40d3e3['query']);_0x4de409[_0x4dc3('0x37')]=_[_0x4dc3('0x38')](_0x4de409['model'],_0x4de409[_0x4dc3('0x35')]);_0x3b4641[_0x4dc3('0x39')]=_['intersection'](_0x4de409[_0x4dc3('0x33')],qs['fields'](_0x40d3e3[_0x4dc3('0x35')][_0x4dc3('0x3a')]));_0x3b4641[_0x4dc3('0x39')]=_0x3b4641[_0x4dc3('0x39')][_0x4dc3('0x3b')]?_0x3b4641['attributes']:_0x4de409[_0x4dc3('0x33')];_0x3b4641[_0x4dc3('0x6d')]=qs[_0x4dc3('0x3e')](_0x40d3e3[_0x4dc3('0x35')][_0x4dc3('0x3e')]);_0x3b4641[_0x4dc3('0x41')]=qs[_0x4dc3('0x37')](_[_0x4dc3('0x3f')](_0x40d3e3[_0x4dc3('0x35')],_0x4de409[_0x4dc3('0x37')]));_0x3b4641[_0x4dc3('0x41')]=_['merge'](_0x3b4641[_0x4dc3('0x41')],{'$or':[{'ListId':_0x2df07b['id']},{'ListId':null}]});if(_0x40d3e3['query'][_0x4dc3('0x40')]){_0x3b4641[_0x4dc3('0x41')]=_[_0x4dc3('0x42')](_0x3b4641[_0x4dc3('0x41')],{'$or':_['map'](_0x3b4641[_0x4dc3('0x39')],function(_0x5e06d3){var _0x541003={};_0x541003[_0x5e06d3]={'$like':'%'+_0x40d3e3[_0x4dc3('0x35')][_0x4dc3('0x40')]+'%'};return _0x541003;})});}_0x3b4641=_[_0x4dc3('0x42')]({},_0x3b4641,_0x40d3e3[_0x4dc3('0x44')]);return db[_0x4dc3('0x97')][_0x4dc3('0x98')](_0x3b4641);}})[_0x4dc3('0x26')](respondWithResult(_0x565bad,null))[_0x4dc3('0x47')](handleError(_0x565bad,null));};exports[_0x4dc3('0x99')]=function(_0xb29fb3,_0x4b0c91){return db[_0x4dc3('0x97')][_0x4dc3('0x98')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x4b0c91,null))[_0x4dc3('0x26')](function(_0x1d1758){return _0x1d1758;})[_0x4dc3('0x26')](respondWithResult(_0x4b0c91,null))['catch'](handleError(_0x4b0c91,null));};exports[_0x4dc3('0x9a')]=function(_0x143418,_0x17993c,_0x4a00b7){return db[_0x4dc3('0x2f')]['find']({'where':{'id':_0x143418[_0x4dc3('0x53')]['id']}})['then'](handleEntityNotFound(_0x17993c,null))[_0x4dc3('0x26')](function(_0x97fb5c){if(_0x97fb5c){return _0x97fb5c['addAgents'](_0x143418[_0x4dc3('0x4c')][_0x4dc3('0x5c')],_[_0x4dc3('0x63')](_0x143418[_0x4dc3('0x4c')],['ids','id'])||{})['spread'](function(_0x1807ed){for(var _0xd19d4d=0x0;_0xd19d4d<_0x143418[_0x4dc3('0x4c')][_0x4dc3('0x5c')][_0x4dc3('0x3b')];_0xd19d4d+=0x1){socket[_0x4dc3('0x9b')](_0x4dc3('0x9c'),{'UserId':Number(_0x143418['body'][_0x4dc3('0x5c')][_0xd19d4d]),'CmListId':Number(_0x143418[_0x4dc3('0x53')]['id'])});}return _0x1807ed;});}})[_0x4dc3('0x26')](respondWithResult(_0x17993c,null))[_0x4dc3('0x47')](handleError(_0x17993c,null));};exports[_0x4dc3('0x9d')]=function(_0x42853f,_0x3c952c,_0x255863){return db[_0x4dc3('0x2f')][_0x4dc3('0x4a')]({'where':{'id':_0x42853f[_0x4dc3('0x53')]['id']}})[_0x4dc3('0x26')](handleEntityNotFound(_0x3c952c,null))[_0x4dc3('0x26')](function(_0x2a6836){if(_0x2a6836){return _0x2a6836['removeAgents'](_0x42853f[_0x4dc3('0x35')]['ids'])['then'](function(){if(_[_0x4dc3('0x5f')](_0x42853f[_0x4dc3('0x35')][_0x4dc3('0x5c')])){for(var _0x1478af=0x0;_0x1478af<_0x42853f[_0x4dc3('0x35')]['ids'][_0x4dc3('0x3b')];_0x1478af+=0x1){socket['emit'](_0x4dc3('0x9e'),{'UserId':Number(_0x42853f[_0x4dc3('0x35')][_0x4dc3('0x5c')][_0x1478af]),'CmListId':Number(_0x42853f[_0x4dc3('0x53')]['id'])});}}else{socket[_0x4dc3('0x9b')](_0x4dc3('0x9e'),{'UserId':Number(_0x42853f[_0x4dc3('0x35')]['ids']),'CmListId':Number(_0x42853f[_0x4dc3('0x53')]['id'])});}});}})[_0x4dc3('0x26')](respondWithStatusCode(_0x3c952c,null))[_0x4dc3('0x47')](handleError(_0x3c952c,null));};exports[_0x4dc3('0x9f')]=function(_0x4c6ef4,_0x539598,_0x16e626){var _0x1aa552={};var _0x406dbc={};var _0x4be377;var _0xd58a21;return db[_0x4dc3('0x2f')][_0x4dc3('0x59')]({'where':{'id':_0x4c6ef4[_0x4dc3('0x53')]['id']}})['then'](handleEntityNotFound(_0x539598,null))['then'](function(_0x56c9eb){if(_0x56c9eb){_0x4be377=_0x56c9eb;_0x406dbc[_0x4dc3('0x33')]=_['keys'](db[_0x4dc3('0xa0')][_0x4dc3('0x69')]);_0x406dbc[_0x4dc3('0x35')]=_['keys'](_0x4c6ef4['query']);_0x406dbc[_0x4dc3('0x37')]=_['intersection'](_0x406dbc[_0x4dc3('0x33')],_0x406dbc[_0x4dc3('0x35')]);_0x1aa552[_0x4dc3('0x39')]=_[_0x4dc3('0x38')](_0x406dbc[_0x4dc3('0x33')],qs[_0x4dc3('0x3a')](_0x4c6ef4['query']['fields']));_0x1aa552[_0x4dc3('0x39')]=_0x1aa552[_0x4dc3('0x39')][_0x4dc3('0x3b')]?_0x1aa552[_0x4dc3('0x39')]:_0x406dbc['model'];_0x1aa552[_0x4dc3('0x6d')]=qs[_0x4dc3('0x3e')](_0x4c6ef4[_0x4dc3('0x35')][_0x4dc3('0x3e')]);_0x1aa552['where']=qs['filters'](_[_0x4dc3('0x3f')](_0x4c6ef4[_0x4dc3('0x35')],_0x406dbc[_0x4dc3('0x37')]));if(_0x4c6ef4['query'][_0x4dc3('0x40')]){_0x1aa552[_0x4dc3('0x41')]=_[_0x4dc3('0x42')](_0x1aa552[_0x4dc3('0x41')],{'$or':_['map'](_0x1aa552[_0x4dc3('0x39')],function(_0x14d370){var _0x184e02={};_0x184e02[_0x14d370]={'$like':'%'+_0x4c6ef4[_0x4dc3('0x35')][_0x4dc3('0x40')]+'%'};return _0x184e02;})});}_0x1aa552=_['merge']({},_0x1aa552,_0x4c6ef4[_0x4dc3('0x44')]);return _0x4be377['getAgents'](_0x1aa552);}})[_0x4dc3('0x26')](function(_0x4282d1){if(_0x4282d1){_0xd58a21=_0x4282d1[_0x4dc3('0x3b')];if(!_0x4c6ef4['query']['hasOwnProperty'](_0x4dc3('0x3d'))){_0x1aa552['limit']=qs[_0x4dc3('0x20')](_0x4c6ef4[_0x4dc3('0x35')]['limit']);_0x1aa552[_0x4dc3('0x1d')]=qs['offset'](_0x4c6ef4[_0x4dc3('0x35')]['offset']);}return _0x4be377[_0x4dc3('0x9f')](_0x1aa552);}})['then'](function(_0x51c2c6){if(_0x51c2c6){return _0x51c2c6?{'count':_0xd58a21,'rows':_0x51c2c6}:null;}})[_0x4dc3('0x26')](respondWithResult(_0x539598,null))['catch'](handleError(_0x539598,null));};function handleQuery(_0x2d8e96){logger['info'](_0x2d8e96);return db[_0x4dc3('0x8e')][_0x4dc3('0x35')](_0x2d8e96)[_0x4dc3('0xa1')](function(_0x5be178){csv_results[_0x4dc3('0x65')](_0x5be178);})['catch'](function(_0x4454ed){logger[_0x4dc3('0x2a')](_0x4454ed[_0x4dc3('0xa2')]);});} \ No newline at end of file +var _0x3b2d=['apply','reject','save','update','then','destroy','get','Lists','UserProfileResource','error','name','send','CmList','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','options','include','findAll','rows','show','params','rawAttributes','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','getDispositions','findOne','removeDispositions','CmContact','tags','join','isArray','push','omit','ids','success','dataValues','errors','message','json','Malformed\x20request\x20syntax','getContacts','CmCustomField','concat','CustomFields','format','cf_%d','getContactsCsv','OrderBy','select','from','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','customField_','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','cm_contact_has_items','description_additionalPhone_','each','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','attachment;\x20filename=','setHeader','Content-type','text/csv','download','sequelize','transaction','addCustomFields','TEXT','text','Sequelize','number','switch','BOOLEAN','addColumn','cf_%s','getCustomFields','findAndCountAll','addAgents','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','spread','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range'];(function(_0x408d22,_0x53eef9){var _0x58effd=function(_0x4ab8ee){while(--_0x4ab8ee){_0x408d22['push'](_0x408d22['shift']());}};_0x58effd(++_0x53eef9);}(_0x3b2d,0x1c1));var _0xd3b2=function(_0x3179b3,_0x5cf366){_0x3179b3=_0x3179b3-0x0;var _0x45737e=_0x3b2d[_0x3179b3];return _0x45737e;};'use strict';var emlformat=require(_0xd3b2('0x0'));var rimraf=require(_0xd3b2('0x1'));var zipdir=require(_0xd3b2('0x2'));var jsonpatch=require(_0xd3b2('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd3b2('0x4'));var Mustache=require(_0xd3b2('0x5'));var util=require(_0xd3b2('0x6'));var path=require(_0xd3b2('0x7'));var sox=require(_0xd3b2('0x8'));var csv=require(_0xd3b2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd3b2('0xa'));var _=require(_0xd3b2('0xb'));var squel=require(_0xd3b2('0xc'));var crypto=require('crypto');var jsforce=require(_0xd3b2('0xd'));var deskjs=require(_0xd3b2('0xe'));var toCsv=require(_0xd3b2('0x9'));var querystring=require(_0xd3b2('0xf'));var Papa=require(_0xd3b2('0x10'));var Redis=require(_0xd3b2('0x11'));var authService=require(_0xd3b2('0x12'));var qs=require(_0xd3b2('0x13'));var as=require(_0xd3b2('0x14'));var hardwareService=require(_0xd3b2('0x15'));var logger=require(_0xd3b2('0x16'))(_0xd3b2('0x17'));var utils=require(_0xd3b2('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xd3b2('0x19'));var db=require(_0xd3b2('0x1a'))['db'];var csv_results;config[_0xd3b2('0x1b')]=_[_0xd3b2('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd3b2('0x1d'))(new Redis(config[_0xd3b2('0x1b')]));require('./cmList.socket')[_0xd3b2('0x1e')](socket);function respondWithStatusCode(_0x50db62,_0x4d184b){_0x4d184b=_0x4d184b||0xcc;return function(_0x2cfebe){if(_0x2cfebe){return _0x50db62[_0xd3b2('0x1f')](_0x4d184b);}return _0x50db62[_0xd3b2('0x20')](_0x4d184b)[_0xd3b2('0x21')]();};}function respondWithResult(_0x43fd1e,_0x40b605){_0x40b605=_0x40b605||0xc8;return function(_0x52ebc3){if(_0x52ebc3){return _0x43fd1e[_0xd3b2('0x20')](_0x40b605)['json'](_0x52ebc3);}};}function respondWithFilteredResult(_0x1f318f,_0x55389){return function(_0x19704a){if(_0x19704a){var _0x1d0698=typeof _0x55389[_0xd3b2('0x22')]===_0xd3b2('0x23')&&typeof _0x55389[_0xd3b2('0x24')]===_0xd3b2('0x23');var _0x2b3054=_0x19704a[_0xd3b2('0x25')];var _0x17f895=_0x1d0698?0x0:_0x55389['offset'];var _0x44ff66=_0x1d0698?_0x19704a[_0xd3b2('0x25')]:_0x55389[_0xd3b2('0x22')]+_0x55389[_0xd3b2('0x24')];var _0x992531;if(_0x44ff66>=_0x2b3054){_0x44ff66=_0x2b3054;_0x992531=0xc8;}else{_0x992531=0xce;}_0x1f318f['status'](_0x992531);return _0x1f318f[_0xd3b2('0x26')](_0xd3b2('0x27'),_0x17f895+'-'+_0x44ff66+'/'+_0x2b3054)['json'](_0x19704a);}return null;};}function patchUpdates(_0x3b17a6){return function(_0xa38623){try{jsonpatch[_0xd3b2('0x28')](_0xa38623,_0x3b17a6,!![]);}catch(_0x5ab311){return BPromise[_0xd3b2('0x29')](_0x5ab311);}return _0xa38623[_0xd3b2('0x2a')]();};}function saveUpdates(_0x3b0120,_0x31dacc){return function(_0xfa4490){if(_0xfa4490){return _0xfa4490[_0xd3b2('0x2b')](_0x3b0120)[_0xd3b2('0x2c')](function(_0x4c1d2d){return _0x4c1d2d;});}return null;};}function removeEntity(_0x39418a,_0xeb9c88){return function(_0x34fa87){if(_0x34fa87){return _0x34fa87[_0xd3b2('0x2d')]()['then'](function(){var _0x13781f=_0x34fa87[_0xd3b2('0x2e')]({'plain':!![]});var _0x48944b=_0xd3b2('0x2f');return db[_0xd3b2('0x30')][_0xd3b2('0x2d')]({'where':{'type':_0x48944b,'resourceId':_0x13781f['id']}})[_0xd3b2('0x2c')](function(){return _0x34fa87;});})['then'](function(){_0x39418a['status'](0xcc)[_0xd3b2('0x21')]();});}};}function handleEntityNotFound(_0x574d85,_0x586f73){return function(_0x30eb83){if(!_0x30eb83){_0x574d85[_0xd3b2('0x1f')](0x194);}return _0x30eb83;};}function handleError(_0x22601c,_0x345116){_0x345116=_0x345116||0x1f4;return function(_0x38999a){logger[_0xd3b2('0x31')](_0x38999a['stack']);if(_0x38999a['name']){delete _0x38999a[_0xd3b2('0x32')];}_0x22601c[_0xd3b2('0x20')](_0x345116)[_0xd3b2('0x33')](_0x38999a);};}exports['index']=function(_0x252ba4,_0x1311f2){var _0x325859={},_0x10a2ea={},_0x1f1fcc={'count':0x0,'rows':[]};var _0x38ae94=_['map'](db[_0xd3b2('0x34')]['rawAttributes'],function(_0x2f2928){return{'name':_0x2f2928[_0xd3b2('0x35')],'type':_0x2f2928['type'][_0xd3b2('0x36')]};});_0x10a2ea[_0xd3b2('0x37')]=_[_0xd3b2('0x38')](_0x38ae94,_0xd3b2('0x32'));_0x10a2ea[_0xd3b2('0x39')]=_[_0xd3b2('0x3a')](_0x252ba4[_0xd3b2('0x39')]);_0x10a2ea[_0xd3b2('0x3b')]=_[_0xd3b2('0x3c')](_0x10a2ea[_0xd3b2('0x37')],_0x10a2ea[_0xd3b2('0x39')]);_0x325859[_0xd3b2('0x3d')]=_[_0xd3b2('0x3c')](_0x10a2ea[_0xd3b2('0x37')],qs['fields'](_0x252ba4[_0xd3b2('0x39')][_0xd3b2('0x3e')]));_0x325859[_0xd3b2('0x3d')]=_0x325859[_0xd3b2('0x3d')][_0xd3b2('0x3f')]?_0x325859[_0xd3b2('0x3d')]:_0x10a2ea[_0xd3b2('0x37')];if(!_0x252ba4['query'][_0xd3b2('0x40')](_0xd3b2('0x41'))){_0x325859['limit']=qs[_0xd3b2('0x24')](_0x252ba4[_0xd3b2('0x39')]['limit']);_0x325859[_0xd3b2('0x22')]=qs[_0xd3b2('0x22')](_0x252ba4[_0xd3b2('0x39')][_0xd3b2('0x22')]);}_0x325859[_0xd3b2('0x42')]=qs['sort'](_0x252ba4[_0xd3b2('0x39')][_0xd3b2('0x43')]);_0x325859[_0xd3b2('0x44')]=qs[_0xd3b2('0x3b')](_[_0xd3b2('0x45')](_0x252ba4[_0xd3b2('0x39')],_0x10a2ea['filters']),_0x38ae94);if(_0x252ba4[_0xd3b2('0x39')][_0xd3b2('0x46')]){_0x325859[_0xd3b2('0x44')]=_['merge'](_0x325859[_0xd3b2('0x44')],{'$or':_[_0xd3b2('0x38')](_0x38ae94,function(_0x1b05fc){if(_0x1b05fc[_0xd3b2('0x47')]!=='VIRTUAL'){var _0x470393={};_0x470393[_0x1b05fc['name']]={'$like':'%'+_0x252ba4[_0xd3b2('0x39')][_0xd3b2('0x46')]+'%'};return _0x470393;}})});}_0x325859=_[_0xd3b2('0x48')]({},_0x325859,_0x252ba4[_0xd3b2('0x49')]);var _0x21bdf9={'where':_0x325859[_0xd3b2('0x44')]};return db[_0xd3b2('0x34')][_0xd3b2('0x25')](_0x21bdf9)[_0xd3b2('0x2c')](function(_0x5da82c){_0x1f1fcc[_0xd3b2('0x25')]=_0x5da82c;if(_0x252ba4['query']['includeAll']){_0x325859[_0xd3b2('0x4a')]=[{'all':!![]}];}return db[_0xd3b2('0x34')][_0xd3b2('0x4b')](_0x325859);})[_0xd3b2('0x2c')](function(_0xab72d4){_0x1f1fcc[_0xd3b2('0x4c')]=_0xab72d4;return _0x1f1fcc;})[_0xd3b2('0x2c')](respondWithFilteredResult(_0x1311f2,_0x325859))['catch'](handleError(_0x1311f2,null));};exports[_0xd3b2('0x4d')]=function(_0x2f76cc,_0xd83066){var _0x137a11={'raw':![],'where':{'id':_0x2f76cc[_0xd3b2('0x4e')]['id']}},_0x34ada2={};_0x34ada2[_0xd3b2('0x37')]=_['keys'](db[_0xd3b2('0x34')][_0xd3b2('0x4f')]);_0x34ada2[_0xd3b2('0x39')]=_[_0xd3b2('0x3a')](_0x2f76cc[_0xd3b2('0x39')]);_0x34ada2[_0xd3b2('0x3b')]=_['intersection'](_0x34ada2['model'],_0x34ada2[_0xd3b2('0x39')]);_0x137a11[_0xd3b2('0x3d')]=_[_0xd3b2('0x3c')](_0x34ada2[_0xd3b2('0x37')],qs[_0xd3b2('0x3e')](_0x2f76cc['query'][_0xd3b2('0x3e')]));_0x137a11['attributes']=_0x137a11[_0xd3b2('0x3d')]['length']?_0x137a11[_0xd3b2('0x3d')]:_0x34ada2[_0xd3b2('0x37')];if(_0x2f76cc[_0xd3b2('0x39')][_0xd3b2('0x50')]){_0x137a11[_0xd3b2('0x4a')]=[{'all':!![]}];}_0x137a11=_[_0xd3b2('0x48')]({},_0x137a11,_0x2f76cc[_0xd3b2('0x49')]);return db['CmList'][_0xd3b2('0x51')](_0x137a11)[_0xd3b2('0x2c')](handleEntityNotFound(_0xd83066,null))[_0xd3b2('0x2c')](respondWithResult(_0xd83066,null))[_0xd3b2('0x52')](handleError(_0xd83066,null));};exports[_0xd3b2('0x53')]=function(_0x4c4441,_0x4ed0fe){return db[_0xd3b2('0x34')]['create'](_0x4c4441[_0xd3b2('0x54')],{})[_0xd3b2('0x2c')](function(_0x5e0589){var _0x2baff6=_0x4c4441[_0xd3b2('0x55')][_0xd3b2('0x2e')]({'plain':!![]});if(!_0x2baff6)throw new Error(_0xd3b2('0x56'));if(_0x2baff6[_0xd3b2('0x57')]===_0xd3b2('0x55')){var _0x2cab23=_0x5e0589[_0xd3b2('0x2e')]({'plain':!![]});var _0x335157=_0xd3b2('0x2f');return db[_0xd3b2('0x58')][_0xd3b2('0x51')]({'where':{'name':_0x335157,'userProfileId':_0x2baff6['userProfileId']},'raw':!![]})[_0xd3b2('0x2c')](function(_0x59a6a8){if(_0x59a6a8&&_0x59a6a8['autoAssociation']===0x0){return db[_0xd3b2('0x30')][_0xd3b2('0x53')]({'name':_0x2cab23[_0xd3b2('0x32')],'resourceId':_0x2cab23['id'],'type':_0x59a6a8[_0xd3b2('0x32')],'sectionId':_0x59a6a8['id']},{})[_0xd3b2('0x2c')](function(){return _0x5e0589;});}else{return _0x5e0589;}})[_0xd3b2('0x52')](function(_0xbeeb1e){logger['error'](_0xd3b2('0x59'),_0xbeeb1e);throw _0xbeeb1e;});}return _0x5e0589;})[_0xd3b2('0x2c')](respondWithResult(_0x4ed0fe,0xc9))[_0xd3b2('0x52')](handleError(_0x4ed0fe,null));};exports['update']=function(_0x5c7dac,_0x1957b9){if(_0x5c7dac[_0xd3b2('0x54')]['id']){delete _0x5c7dac[_0xd3b2('0x54')]['id'];}return db[_0xd3b2('0x34')][_0xd3b2('0x51')]({'where':{'id':_0x5c7dac[_0xd3b2('0x4e')]['id']}})[_0xd3b2('0x2c')](handleEntityNotFound(_0x1957b9,null))[_0xd3b2('0x2c')](saveUpdates(_0x5c7dac['body'],null))[_0xd3b2('0x2c')](respondWithResult(_0x1957b9,null))[_0xd3b2('0x52')](handleError(_0x1957b9,null));};exports[_0xd3b2('0x2d')]=function(_0x373d09,_0x285af1){return db['CmList'][_0xd3b2('0x51')]({'where':{'id':_0x373d09[_0xd3b2('0x4e')]['id']}})[_0xd3b2('0x2c')](handleEntityNotFound(_0x285af1,null))[_0xd3b2('0x2c')](removeEntity(_0x285af1,null))[_0xd3b2('0x52')](handleError(_0x285af1,null));};exports['describe']=function(_0x3e05d7,_0x7dbce5){return db[_0xd3b2('0x34')][_0xd3b2('0x5a')]()[_0xd3b2('0x2c')](respondWithResult(_0x7dbce5,null))[_0xd3b2('0x52')](handleError(_0x7dbce5,null));};exports[_0xd3b2('0x5b')]=function(_0x292f95,_0x5ae700,_0x48b6f1){if(_0x292f95[_0xd3b2('0x54')]['id']){delete _0x292f95[_0xd3b2('0x54')]['id'];}return db[_0xd3b2('0x34')]['find']({'where':{'id':_0x292f95[_0xd3b2('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5ae700,null))[_0xd3b2('0x2c')](function(_0xb570c6){if(_0xb570c6){_0x292f95['body'][_0xd3b2('0x5c')]=_0xb570c6['id'];return db[_0xd3b2('0x5d')][_0xd3b2('0x53')](_0x292f95[_0xd3b2('0x54')]);}})['then'](respondWithResult(_0x5ae700,null))['catch'](handleError(_0x5ae700,null));};exports[_0xd3b2('0x5e')]=function(_0x5c6c62,_0x6ff55d,_0xfc785f){var _0x32a712={'raw':![],'where':{}};var _0x3ded9e={};var _0x4014e7={'count':0x0,'rows':[]};return db[_0xd3b2('0x34')][_0xd3b2('0x5f')]({'where':{'id':_0x5c6c62['params']['id']}})[_0xd3b2('0x2c')](handleEntityNotFound(_0x6ff55d,null))[_0xd3b2('0x2c')](function(_0x5976d4){if(_0x5976d4){_0x3ded9e['model']=_[_0xd3b2('0x3a')](db[_0xd3b2('0x5d')][_0xd3b2('0x4f')]);_0x3ded9e[_0xd3b2('0x39')]=_[_0xd3b2('0x3a')](_0x5c6c62[_0xd3b2('0x39')]);_0x3ded9e['filters']=_[_0xd3b2('0x3c')](_0x3ded9e[_0xd3b2('0x37')],_0x3ded9e[_0xd3b2('0x39')]);_0x32a712[_0xd3b2('0x3d')]=_[_0xd3b2('0x3c')](_0x3ded9e[_0xd3b2('0x37')],qs[_0xd3b2('0x3e')](_0x5c6c62[_0xd3b2('0x39')][_0xd3b2('0x3e')]));_0x32a712['attributes']=_0x32a712['attributes'][_0xd3b2('0x3f')]?_0x32a712['attributes']:_0x3ded9e[_0xd3b2('0x37')];if(!_0x5c6c62[_0xd3b2('0x39')][_0xd3b2('0x40')]('nolimit')){_0x32a712[_0xd3b2('0x24')]=qs[_0xd3b2('0x24')](_0x5c6c62[_0xd3b2('0x39')][_0xd3b2('0x24')]);_0x32a712['offset']=qs['offset'](_0x5c6c62[_0xd3b2('0x39')][_0xd3b2('0x22')]);}_0x32a712['order']=qs['sort'](_0x5c6c62[_0xd3b2('0x39')][_0xd3b2('0x43')]);_0x32a712['where']=qs[_0xd3b2('0x3b')](_[_0xd3b2('0x45')](_0x5c6c62['query'],_0x3ded9e[_0xd3b2('0x3b')]));_0x32a712[_0xd3b2('0x44')][_0xd3b2('0x5c')]=_0x5976d4['id'];if(_0x5c6c62['query'][_0xd3b2('0x46')]){_0x32a712[_0xd3b2('0x44')]=_[_0xd3b2('0x48')](_0x32a712['where'],{'$or':_['map'](_0x32a712[_0xd3b2('0x3d')],function(_0x458691){var _0x827ac7={};_0x827ac7[_0x458691]={'$like':'%'+_0x5c6c62['query']['filter']+'%'};return _0x827ac7;})});}_0x32a712=_['merge']({},_0x32a712,_0x5c6c62[_0xd3b2('0x49')]);return db[_0xd3b2('0x5d')][_0xd3b2('0x25')]({'where':_0x32a712['where']})[_0xd3b2('0x2c')](function(_0x542baf){_0x4014e7['count']=_0x542baf;if(_0x5c6c62[_0xd3b2('0x39')][_0xd3b2('0x50')]){_0x32a712[_0xd3b2('0x4a')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x32a712);})['then'](function(_0x46ddd8){_0x4014e7[_0xd3b2('0x4c')]=_0x46ddd8;return _0x4014e7;});}})[_0xd3b2('0x2c')](respondWithFilteredResult(_0x6ff55d,_0x32a712))[_0xd3b2('0x52')](handleError(_0x6ff55d,null));};exports[_0xd3b2('0x60')]=function(_0xf25f8d,_0x41c2e2,_0xa19e48){return db[_0xd3b2('0x34')][_0xd3b2('0x51')]({'where':{'id':_0xf25f8d['params']['id']}})[_0xd3b2('0x2c')](handleEntityNotFound(_0x41c2e2,null))[_0xd3b2('0x2c')](function(_0x5ed5bc){if(_0x5ed5bc){return _0x5ed5bc['removeDispositions'](_0xf25f8d['query']['ids']);}})['then'](respondWithStatusCode(_0x41c2e2,null))[_0xd3b2('0x52')](handleError(_0x41c2e2,null));};exports['addContacts']=function(_0x71fed0,_0x3f2da4,_0x91e97d){return db[_0xd3b2('0x34')][_0xd3b2('0x51')]({'where':{'id':_0x71fed0[_0xd3b2('0x4e')]['id']}})[_0xd3b2('0x2c')](handleEntityNotFound(_0x3f2da4,null))[_0xd3b2('0x2c')](function(_0x48933a){if(_0x48933a){var _0x2f7d8c=[];var _0xeea80d={'success':[],'errors':[]};return db[_0xd3b2('0x61')][_0xd3b2('0x5a')]()['then'](function(_0x118f88){if(_0x71fed0[_0xd3b2('0x54')]['tags']&&_['isArray'](_0x71fed0[_0xd3b2('0x54')][_0xd3b2('0x62')])){if(_0x71fed0[_0xd3b2('0x54')][_0xd3b2('0x62')][_0xd3b2('0x3f')]){_0x71fed0['body'][_0xd3b2('0x62')]=_0x71fed0[_0xd3b2('0x54')][_0xd3b2('0x62')][_0xd3b2('0x63')](';')+';';}else{_0x71fed0['body'][_0xd3b2('0x62')]=null;}}else{_0x71fed0[_0xd3b2('0x54')][_0xd3b2('0x62')]=null;}if(_0x71fed0[_0xd3b2('0x54')]&&_[_0xd3b2('0x64')](_0x71fed0['body'])){for(var _0x5b5e49=0x0;_0x5b5e49<_0x71fed0['body'][_0xd3b2('0x3f')];_0x5b5e49+=0x1){_0x71fed0[_0xd3b2('0x54')][_0x5b5e49][_0xd3b2('0x5c')]=_0x71fed0[_0xd3b2('0x4e')]['id'];_0x2f7d8c[_0xd3b2('0x65')](_0x71fed0[_0xd3b2('0x54')][_0x5b5e49]);}return BPromise['each'](_0x2f7d8c,function(_0x560a71){return db[_0xd3b2('0x61')][_0xd3b2('0x53')](_[_0xd3b2('0x66')](_0x560a71,[_0xd3b2('0x67'),'id'])||{},{'fields':_['keys'](_0x118f88),'raw':!![]})[_0xd3b2('0x2c')](function(_0x1ab2f3){_0xeea80d[_0xd3b2('0x68')]['push'](_0x1ab2f3[_0xd3b2('0x69')]);})[_0xd3b2('0x52')](function(_0x5a1221){_0xeea80d[_0xd3b2('0x6a')][_0xd3b2('0x65')]({'data':_0x560a71,'error':_0x5a1221[_0xd3b2('0x6b')]});});})[_0xd3b2('0x2c')](function(_0x1d0cdf){return _0xeea80d;})[_0xd3b2('0x52')](function(_0x4251dc){return _0x4251dc;});}else{_0x3f2da4[_0xd3b2('0x20')](0x190)[_0xd3b2('0x6c')]({'message':_0xd3b2('0x6d')});}});}})['then'](respondWithResult(_0x3f2da4,null))['catch'](handleError(_0x3f2da4,null));};exports[_0xd3b2('0x6e')]=function(_0x503fea,_0x426f5c,_0x53e561){var _0x2f9555;return db['CmList']['find']({'where':{'id':_0x503fea[_0xd3b2('0x4e')]['id']},'include':[{'model':db[_0xd3b2('0x6f')],'as':'CustomFields'}]})[_0xd3b2('0x2c')](handleEntityNotFound(_0x426f5c,null))[_0xd3b2('0x2c')](function(_0x2a2528){if(_0x2a2528){_0x2f9555=_0x2a2528;return db[_0xd3b2('0x61')]['rawAttributes'];}})['then'](function(_0x9c71d3){if(_0x9c71d3){var _0x12fb5a={};var _0x477a7e={};_0x477a7e[_0xd3b2('0x37')]=_[_0xd3b2('0x70')](_[_0xd3b2('0x3a')](_0x9c71d3),_[_0xd3b2('0x38')](_0x2f9555[_0xd3b2('0x71')],function(_0x16314f){return util[_0xd3b2('0x72')](_0xd3b2('0x73'),_0x16314f['id']);}));_0x477a7e[_0xd3b2('0x39')]=_[_0xd3b2('0x3a')](_0x503fea[_0xd3b2('0x39')]);_0x477a7e['filters']=_[_0xd3b2('0x3c')](_0x477a7e[_0xd3b2('0x37')],_0x477a7e[_0xd3b2('0x39')]);_0x12fb5a[_0xd3b2('0x3d')]=_['intersection'](_0x477a7e[_0xd3b2('0x37')],qs[_0xd3b2('0x3e')](_0x503fea[_0xd3b2('0x39')][_0xd3b2('0x3e')]));_0x12fb5a[_0xd3b2('0x3d')]=_0x12fb5a[_0xd3b2('0x3d')][_0xd3b2('0x3f')]?_0x12fb5a[_0xd3b2('0x3d')]:_0x477a7e['model'];if(!_0x503fea[_0xd3b2('0x39')][_0xd3b2('0x40')](_0xd3b2('0x41'))){_0x12fb5a[_0xd3b2('0x24')]=qs[_0xd3b2('0x24')](_0x503fea['query'][_0xd3b2('0x24')]);_0x12fb5a[_0xd3b2('0x22')]=qs['offset'](_0x503fea[_0xd3b2('0x39')]['offset']);}_0x12fb5a[_0xd3b2('0x42')]=qs[_0xd3b2('0x43')](_0x503fea['query']['sort']);_0x12fb5a['where']=qs[_0xd3b2('0x3b')](_[_0xd3b2('0x45')](_0x503fea[_0xd3b2('0x39')],_0x477a7e[_0xd3b2('0x3b')]));_0x12fb5a['raw']=!![];if(_0x503fea[_0xd3b2('0x39')][_0xd3b2('0x46')]){_0x12fb5a['where']=_[_0xd3b2('0x48')](_0x12fb5a[_0xd3b2('0x44')],{'$or':_[_0xd3b2('0x38')](_0x12fb5a[_0xd3b2('0x3d')],function(_0xa96f25){var _0x5e46b2={};_0x5e46b2[_0xa96f25]={'$like':'%'+_0x503fea['query'][_0xd3b2('0x46')]+'%'};return _0x5e46b2;})});}_0x12fb5a=_[_0xd3b2('0x48')]({},_0x12fb5a,_0x503fea['options']);return _0x2f9555[_0xd3b2('0x6e')](_0x12fb5a);}})[_0xd3b2('0x2c')](respondWithResult(_0x426f5c,null))[_0xd3b2('0x52')](handleError(_0x426f5c,null));};exports[_0xd3b2('0x74')]=function(_0x5e3118,_0x5b8500,_0x44bfdc){var _0x4670e7;var _0x444eb5;var _0xf93fc4;var _0x18e789=_0x5e3118[_0xd3b2('0x4e')]['id'];csv_results=[];return db['ContactItemType'][_0xd3b2('0x4b')]({'attributes':['id',_0xd3b2('0x32')],'raw':!![],'order':[_0xd3b2('0x75')]})[_0xd3b2('0x2c')](function(_0x2329cc){_0x4670e7=_0x2329cc;var _0x3643dc=_[_0xd3b2('0x3a')](db[_0xd3b2('0x61')][_0xd3b2('0x4f')]);return db[_0xd3b2('0x6f')]['findAll']({'raw':!![],'attributes':['id','alias']})[_0xd3b2('0x2c')](function(_0x30c4a7){_0x444eb5=_0x30c4a7;var _0x1e0570=squel[_0xd3b2('0x76')]()['fields'](_0x3643dc)[_0xd3b2('0x77')]('cm_contacts','c')[_0xd3b2('0x44')](_0xd3b2('0x78'),_0x18e789)['where'](_0xd3b2('0x79'))[_0xd3b2('0x7a')]();for(var _0x14aa14=0x0;_0x14aa14<_0x444eb5['length'];_0x14aa14++){_0x1e0570[_0xd3b2('0x7b')]('c.cf_'+_0x444eb5[_0x14aa14]['id'],_0xd3b2('0x7c')+_0x444eb5[_0x14aa14]['alias']);}for(var _0x14aa14=0x0;_0x14aa14<_0x4670e7[_0xd3b2('0x3f')];_0x14aa14++){_0x1e0570[_0xd3b2('0x7b')](squel[_0xd3b2('0x76')]()[_0xd3b2('0x7b')]('item')['from']('cm_contact_has_items')[_0xd3b2('0x44')](_0xd3b2('0x7d'),_0x4670e7[_0x14aa14]['id'])[_0xd3b2('0x44')](_0xd3b2('0x7e')),_0xd3b2('0x7f')+_0x4670e7[_0x14aa14][_0xd3b2('0x32')]);_0x1e0570['field'](squel[_0xd3b2('0x76')]()[_0xd3b2('0x7b')](_0xd3b2('0x80'))[_0xd3b2('0x77')](_0xd3b2('0x81'))[_0xd3b2('0x44')]('ItemTypeId\x20=\x20?',_0x4670e7[_0x14aa14]['id'])[_0xd3b2('0x44')](_0xd3b2('0x7e')),_0xd3b2('0x82')+_0x4670e7[_0x14aa14][_0xd3b2('0x32')]);}var _0x175697=[];_0x175697[_0xd3b2('0x65')](_0x1e0570['toString']());BPromise[_0xd3b2('0x83')](_0x175697,handleQuery)[_0xd3b2('0x2c')](function(_0x2e591){handleQuery(_0x1e0570['toString']());var _0x42e70d=csv_results[0x0];if(!_[_0xd3b2('0x84')](_0x42e70d)){var _0x1d8518=toCsv(_0x42e70d);var _0x499024=Date[_0xd3b2('0x85')]();fs[_0xd3b2('0x86')](util[_0xd3b2('0x72')](_0xd3b2('0x87'),_0x18e789,_0x499024),_0x1d8518);_0x5b8500['setHeader']('Content-disposition',_0xd3b2('0x88')+util[_0xd3b2('0x72')]('list_%d_%s.csv',_0x18e789,_0x499024));_0x5b8500[_0xd3b2('0x89')](_0xd3b2('0x8a'),_0xd3b2('0x8b'));return _0x5b8500[_0xd3b2('0x8c')](util[_0xd3b2('0x72')](_0xd3b2('0x87'),_0x18e789,_0x499024));}else{return _0x5b8500['sendStatus'](0xcc);}});});});};exports['addCustomField']=function(_0x3c0d8d,_0xf857ac,_0x3962c1){var _0x52dd82;delete _0x3c0d8d[_0xd3b2('0x54')]['id'];return db[_0xd3b2('0x34')][_0xd3b2('0x5f')]({'where':{'id':_0x3c0d8d[_0xd3b2('0x4e')]['id']}})[_0xd3b2('0x2c')](handleEntityNotFound(_0xf857ac,null))[_0xd3b2('0x2c')](function(_0x439605){if(_0x439605){return db[_0xd3b2('0x8d')][_0xd3b2('0x8e')](function(_0x506db6){return db[_0xd3b2('0x6f')]['create'](_0x3c0d8d[_0xd3b2('0x54')],{'transaction':_0x506db6})['then'](function(_0x25b466){_0x52dd82=_0x25b466;return _0x439605[_0xd3b2('0x8f')](_0x25b466,{'transaction':_0x506db6});})['then'](function(){var _0x4f03c7={'type':db['Sequelize'][_0xd3b2('0x90')],'transaction':_0x506db6};switch(_0x3c0d8d[_0xd3b2('0x54')][_0xd3b2('0x47')]){case _0xd3b2('0x91'):_0x4f03c7[_0xd3b2('0x47')]=db[_0xd3b2('0x92')]['TEXT'];break;case _0xd3b2('0x93'):_0x4f03c7[_0xd3b2('0x47')]=db[_0xd3b2('0x92')]['INTEGER'];break;case _0xd3b2('0x94'):_0x4f03c7[_0xd3b2('0x47')]=db[_0xd3b2('0x92')][_0xd3b2('0x95')];_0x4f03c7['defaultValue']=![];break;default:}return db[_0xd3b2('0x8d')]['queryInterface'][_0xd3b2('0x96')]('cm_contacts',util[_0xd3b2('0x72')](_0xd3b2('0x97'),_0x52dd82['id']),_0x4f03c7);})[_0xd3b2('0x2c')](function(){return _0x52dd82;});});}})[_0xd3b2('0x2c')](respondWithResult(_0xf857ac,null))[_0xd3b2('0x52')](handleError(_0xf857ac,null));};exports[_0xd3b2('0x98')]=function(_0x396d66,_0x489f5c,_0x2206ef){var _0x3db4b8={};var _0x1cf00d={};var _0x533117;var _0x5d64b6;return db[_0xd3b2('0x34')][_0xd3b2('0x5f')]({'where':{'id':_0x396d66[_0xd3b2('0x4e')]['id']}})[_0xd3b2('0x2c')](handleEntityNotFound(_0x489f5c,null))[_0xd3b2('0x2c')](function(_0x4ebd97){if(_0x4ebd97){_0x533117=_0x4ebd97;_0x1cf00d[_0xd3b2('0x37')]=_['keys'](db[_0xd3b2('0x6f')][_0xd3b2('0x4f')]);_0x1cf00d[_0xd3b2('0x39')]=_[_0xd3b2('0x3a')](_0x396d66[_0xd3b2('0x39')]);_0x1cf00d['filters']=_[_0xd3b2('0x3c')](_0x1cf00d[_0xd3b2('0x37')],_0x1cf00d[_0xd3b2('0x39')]);_0x3db4b8[_0xd3b2('0x3d')]=_[_0xd3b2('0x3c')](_0x1cf00d[_0xd3b2('0x37')],qs[_0xd3b2('0x3e')](_0x396d66[_0xd3b2('0x39')][_0xd3b2('0x3e')]));_0x3db4b8[_0xd3b2('0x3d')]=_0x3db4b8[_0xd3b2('0x3d')][_0xd3b2('0x3f')]?_0x3db4b8[_0xd3b2('0x3d')]:_0x1cf00d[_0xd3b2('0x37')];_0x3db4b8['order']=qs[_0xd3b2('0x43')](_0x396d66[_0xd3b2('0x39')][_0xd3b2('0x43')]);_0x3db4b8['where']=qs['filters'](_['pick'](_0x396d66[_0xd3b2('0x39')],_0x1cf00d[_0xd3b2('0x3b')]));_0x3db4b8[_0xd3b2('0x44')]=_[_0xd3b2('0x48')](_0x3db4b8[_0xd3b2('0x44')],{'$or':[{'ListId':_0x4ebd97['id']},{'ListId':null}]});if(_0x396d66[_0xd3b2('0x39')][_0xd3b2('0x46')]){_0x3db4b8['where']=_[_0xd3b2('0x48')](_0x3db4b8[_0xd3b2('0x44')],{'$or':_[_0xd3b2('0x38')](_0x3db4b8['attributes'],function(_0x483194){var _0x4bfd92={};_0x4bfd92[_0x483194]={'$like':'%'+_0x396d66['query'][_0xd3b2('0x46')]+'%'};return _0x4bfd92;})});}_0x3db4b8=_[_0xd3b2('0x48')]({},_0x3db4b8,_0x396d66[_0xd3b2('0x49')]);return db[_0xd3b2('0x6f')][_0xd3b2('0x99')](_0x3db4b8);}})[_0xd3b2('0x2c')](respondWithResult(_0x489f5c,null))[_0xd3b2('0x52')](handleError(_0x489f5c,null));};exports['getGlobalCustomFields']=function(_0x2bf184,_0x1f0074){return db[_0xd3b2('0x6f')][_0xd3b2('0x99')]({'where':{'ListId':null}})[_0xd3b2('0x2c')](handleEntityNotFound(_0x1f0074,null))[_0xd3b2('0x2c')](function(_0x35be2c){return _0x35be2c;})[_0xd3b2('0x2c')](respondWithResult(_0x1f0074,null))[_0xd3b2('0x52')](handleError(_0x1f0074,null));};exports[_0xd3b2('0x9a')]=function(_0x369af8,_0x425494,_0x259885){return db['CmList']['find']({'where':{'id':_0x369af8[_0xd3b2('0x4e')]['id']}})[_0xd3b2('0x2c')](handleEntityNotFound(_0x425494,null))[_0xd3b2('0x2c')](function(_0x3c4c54){if(_0x3c4c54){return _0x3c4c54[_0xd3b2('0x9a')](_0x369af8[_0xd3b2('0x54')][_0xd3b2('0x67')],_[_0xd3b2('0x66')](_0x369af8['body'],['ids','id'])||{})['spread'](function(_0x462d00){for(var _0x5ca685=0x0;_0x5ca685<_0x369af8['body'][_0xd3b2('0x67')][_0xd3b2('0x3f')];_0x5ca685+=0x1){socket[_0xd3b2('0x9b')](_0xd3b2('0x9c'),{'UserId':Number(_0x369af8[_0xd3b2('0x54')][_0xd3b2('0x67')][_0x5ca685]),'CmListId':Number(_0x369af8[_0xd3b2('0x4e')]['id'])});}return _0x462d00;});}})[_0xd3b2('0x2c')](respondWithResult(_0x425494,null))[_0xd3b2('0x52')](handleError(_0x425494,null));};exports[_0xd3b2('0x9d')]=function(_0x4adad0,_0x1a28e2,_0x3369cd){return db[_0xd3b2('0x34')]['find']({'where':{'id':_0x4adad0[_0xd3b2('0x4e')]['id']}})[_0xd3b2('0x2c')](handleEntityNotFound(_0x1a28e2,null))['then'](function(_0x5a3769){if(_0x5a3769){return _0x5a3769[_0xd3b2('0x9d')](_0x4adad0[_0xd3b2('0x39')][_0xd3b2('0x67')])[_0xd3b2('0x2c')](function(){if(_['isArray'](_0x4adad0[_0xd3b2('0x39')]['ids'])){for(var _0x5e0d7a=0x0;_0x5e0d7a<_0x4adad0[_0xd3b2('0x39')][_0xd3b2('0x67')][_0xd3b2('0x3f')];_0x5e0d7a+=0x1){socket['emit'](_0xd3b2('0x9e'),{'UserId':Number(_0x4adad0[_0xd3b2('0x39')][_0xd3b2('0x67')][_0x5e0d7a]),'CmListId':Number(_0x4adad0['params']['id'])});}}else{socket[_0xd3b2('0x9b')](_0xd3b2('0x9e'),{'UserId':Number(_0x4adad0[_0xd3b2('0x39')][_0xd3b2('0x67')]),'CmListId':Number(_0x4adad0[_0xd3b2('0x4e')]['id'])});}});}})[_0xd3b2('0x2c')](respondWithStatusCode(_0x1a28e2,null))['catch'](handleError(_0x1a28e2,null));};exports[_0xd3b2('0x9f')]=function(_0x2c3038,_0x26e878,_0x280e17){var _0x21da8f={};var _0x5b5330={};var _0x5cc570;var _0x472781;return db[_0xd3b2('0x34')][_0xd3b2('0x5f')]({'where':{'id':_0x2c3038[_0xd3b2('0x4e')]['id']}})[_0xd3b2('0x2c')](handleEntityNotFound(_0x26e878,null))[_0xd3b2('0x2c')](function(_0x389cce){if(_0x389cce){_0x5cc570=_0x389cce;_0x5b5330[_0xd3b2('0x37')]=_[_0xd3b2('0x3a')](db[_0xd3b2('0xa0')][_0xd3b2('0x4f')]);_0x5b5330[_0xd3b2('0x39')]=_[_0xd3b2('0x3a')](_0x2c3038[_0xd3b2('0x39')]);_0x5b5330['filters']=_[_0xd3b2('0x3c')](_0x5b5330['model'],_0x5b5330['query']);_0x21da8f[_0xd3b2('0x3d')]=_[_0xd3b2('0x3c')](_0x5b5330[_0xd3b2('0x37')],qs['fields'](_0x2c3038[_0xd3b2('0x39')][_0xd3b2('0x3e')]));_0x21da8f[_0xd3b2('0x3d')]=_0x21da8f['attributes']['length']?_0x21da8f[_0xd3b2('0x3d')]:_0x5b5330[_0xd3b2('0x37')];_0x21da8f['order']=qs[_0xd3b2('0x43')](_0x2c3038[_0xd3b2('0x39')][_0xd3b2('0x43')]);_0x21da8f[_0xd3b2('0x44')]=qs['filters'](_[_0xd3b2('0x45')](_0x2c3038[_0xd3b2('0x39')],_0x5b5330[_0xd3b2('0x3b')]));if(_0x2c3038[_0xd3b2('0x39')]['filter']){_0x21da8f[_0xd3b2('0x44')]=_[_0xd3b2('0x48')](_0x21da8f[_0xd3b2('0x44')],{'$or':_[_0xd3b2('0x38')](_0x21da8f[_0xd3b2('0x3d')],function(_0x474db5){var _0x252bcc={};_0x252bcc[_0x474db5]={'$like':'%'+_0x2c3038[_0xd3b2('0x39')][_0xd3b2('0x46')]+'%'};return _0x252bcc;})});}_0x21da8f=_[_0xd3b2('0x48')]({},_0x21da8f,_0x2c3038[_0xd3b2('0x49')]);return _0x5cc570[_0xd3b2('0x9f')](_0x21da8f);}})[_0xd3b2('0x2c')](function(_0x398c8f){if(_0x398c8f){_0x472781=_0x398c8f[_0xd3b2('0x3f')];if(!_0x2c3038['query']['hasOwnProperty'](_0xd3b2('0x41'))){_0x21da8f[_0xd3b2('0x24')]=qs[_0xd3b2('0x24')](_0x2c3038[_0xd3b2('0x39')]['limit']);_0x21da8f['offset']=qs[_0xd3b2('0x22')](_0x2c3038[_0xd3b2('0x39')][_0xd3b2('0x22')]);}return _0x5cc570[_0xd3b2('0x9f')](_0x21da8f);}})[_0xd3b2('0x2c')](function(_0x5be131){if(_0x5be131){return _0x5be131?{'count':_0x472781,'rows':_0x5be131}:null;}})['then'](respondWithResult(_0x26e878,null))[_0xd3b2('0x52')](handleError(_0x26e878,null));};function handleQuery(_0x125f25){logger[_0xd3b2('0xa1')](_0x125f25);return db['sequelize'][_0xd3b2('0x39')](_0x125f25)[_0xd3b2('0xa2')](function(_0x29778d){csv_results[_0xd3b2('0x65')](_0x29778d);})[_0xd3b2('0x52')](function(_0x22baea){logger[_0xd3b2('0x31')](_0x22baea[_0xd3b2('0x6b')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 907b6f9..0a42662 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 _0x3e74=['hasOwnProperty','exports','events','CmList','setMaxListeners','save','emit'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3e74,0x175));var _0x43e7=function(_0x1bf716,_0x24e389){_0x1bf716=_0x1bf716-0x0;var _0x3df167=_0x3e74[_0x1bf716];return _0x3df167;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var CmList=require('../../mysqldb')['db'][_0x43e7('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){CmListEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);CmListEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=CmListEvents; \ No newline at end of file +var _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x37a9d7,_0x2b6fde){var _0x1343d3=function(_0x3bde45){while(--_0x3bde45){_0x37a9d7['push'](_0x37a9d7['shift']());}};_0x1343d3(++_0x2b6fde);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5c8827,_0x5bc5d7){_0x5c8827=_0x5c8827-0x0;var _0x50ffd5=_0x5fc3[_0x5c8827];return _0x50ffd5;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var CmList=require(_0x35fc('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){CmListEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);CmListEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index b51cfa5..8ed5a4c 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(_0x3227c1,_0x4318c5){var _0x31fd48=function(_0x5c5850){while(--_0x5c5850){_0x3227c1['push'](_0x3227c1['shift']());}};_0x31fd48(++_0x4318c5);}(_0xa75b,0x170));var _0xba75=function(_0x4270c1,_0x28c716){_0x4270c1=_0x4270c1-0x0;var _0x20d8b3=_0xa75b[_0x4270c1];return _0x20d8b3;};'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 _0x5ff3=['cm_lists','util','api','bluebird','request-promise','path','rimraf','./cmList.attributes','exports','define'];(function(_0x251cc5,_0xf58eea){var _0x142e6a=function(_0x483f79){while(--_0x483f79){_0x251cc5['push'](_0x251cc5['shift']());}};_0x142e6a(++_0xf58eea);}(_0x5ff3,0x17d));var _0x35ff=function(_0x4be475,_0x1c2897){_0x4be475=_0x4be475-0x0;var _0x4b7ac6=_0x5ff3[_0x4be475];return _0x4b7ac6;};'use strict';var _=require('lodash');var util=require(_0x35ff('0x0'));var logger=require('../../config/logger')(_0x35ff('0x1'));var moment=require('moment');var BPromise=require(_0x35ff('0x2'));var rp=require(_0x35ff('0x3'));var fs=require('fs');var path=require(_0x35ff('0x4'));var rimraf=require(_0x35ff('0x5'));var config=require('../../config/environment');var attributes=require(_0x35ff('0x6'));module[_0x35ff('0x7')]=function(_0x2e9873,_0x11e738){return _0x2e9873[_0x35ff('0x8')]('CmList',attributes,{'tableName':_0x35ff('0x9'),'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 61b40d9..8802f62 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 _0x04e3=['debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','error','CmList,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','register','request','then','info'];(function(_0x55ab8b,_0x1d596e){var _0x35ec52=function(_0x328226){while(--_0x328226){_0x55ab8b['push'](_0x55ab8b['shift']());}};_0x35ec52(++_0x1d596e);}(_0x04e3,0x19d));var _0x304e=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x04e3[_0x565c49];return _0x20ca34;};'use strict';var _=require(_0x304e('0x0'));var util=require(_0x304e('0x1'));var moment=require(_0x304e('0x2'));var BPromise=require(_0x304e('0x3'));var rs=require(_0x304e('0x4'));var fs=require('fs');var Redis=require(_0x304e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x304e('0x6'));var logger=require(_0x304e('0x7'))(_0x304e('0x8'));var config=require(_0x304e('0x9'));var jayson=require(_0x304e('0xa'));var client=jayson[_0x304e('0xb')]['http']({'port':0x232a});config[_0x304e('0xc')]=_[_0x304e('0xd')](config['redis'],{'host':_0x304e('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x304e('0xc')]));require('./cmList.socket')[_0x304e('0xf')](socket);function respondWithRpcPromise(_0x334636,_0x39a0b9,_0x314eb7){return new BPromise(function(_0x3c9aaa,_0x3a693c){return client[_0x304e('0x10')](_0x334636,_0x314eb7)[_0x304e('0x11')](function(_0x5aa0da){logger[_0x304e('0x12')]('CmList,\x20%s,\x20%s',_0x39a0b9,'request\x20sent');logger[_0x304e('0x13')](_0x304e('0x14'),_0x39a0b9,_0x304e('0x15'),JSON['stringify'](_0x5aa0da));if(_0x5aa0da[_0x304e('0x16')]){if(_0x5aa0da[_0x304e('0x16')]['code']===0x1f4){logger[_0x304e('0x16')](_0x304e('0x17'),_0x39a0b9,_0x5aa0da[_0x304e('0x16')]['message']);return _0x3a693c(_0x5aa0da[_0x304e('0x16')][_0x304e('0x18')]);}logger[_0x304e('0x16')](_0x304e('0x17'),_0x39a0b9,_0x5aa0da['error'][_0x304e('0x18')]);return _0x3c9aaa(_0x5aa0da[_0x304e('0x16')][_0x304e('0x18')]);}else{logger[_0x304e('0x12')]('CmList,\x20%s,\x20%s',_0x39a0b9,_0x304e('0x15'));_0x3c9aaa(_0x5aa0da[_0x304e('0x19')][_0x304e('0x18')]);}})[_0x304e('0x1a')](function(_0x5066db){logger['error'](_0x304e('0x17'),_0x39a0b9,_0x5066db);_0x3a693c(_0x5066db);});});} \ No newline at end of file +var _0xd59d=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','./cmList.socket','register','request','info','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','CmList,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x1a1715,_0x89b158){var _0x3f54b0=function(_0x14f1aa){while(--_0x14f1aa){_0x1a1715['push'](_0x1a1715['shift']());}};_0x3f54b0(++_0x89b158);}(_0xd59d,0xd3));var _0xdd59=function(_0x4953da,_0x5adaca){_0x4953da=_0x4953da-0x0;var _0x2d3780=_0xd59d[_0x4953da];return _0x2d3780;};'use strict';var _=require('lodash');var util=require(_0xdd59('0x0'));var moment=require(_0xdd59('0x1'));var BPromise=require(_0xdd59('0x2'));var rs=require(_0xdd59('0x3'));var fs=require('fs');var Redis=require(_0xdd59('0x4'));var db=require(_0xdd59('0x5'))['db'];var utils=require(_0xdd59('0x6'));var logger=require('../../config/logger')(_0xdd59('0x7'));var config=require(_0xdd59('0x8'));var jayson=require(_0xdd59('0x9'));var client=jayson[_0xdd59('0xa')]['http']({'port':0x232a});config[_0xdd59('0xb')]=_[_0xdd59('0xc')](config[_0xdd59('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xdd59('0xd'))[_0xdd59('0xe')](socket);function respondWithRpcPromise(_0x114dd8,_0x50ed44,_0x4ab843){return new BPromise(function(_0xb9248e,_0x5dc51b){return client[_0xdd59('0xf')](_0x114dd8,_0x4ab843)['then'](function(_0x41eeb9){logger[_0xdd59('0x10')]('CmList,\x20%s,\x20%s',_0x50ed44,_0xdd59('0x11'));logger[_0xdd59('0x12')](_0xdd59('0x13'),_0x50ed44,_0xdd59('0x11'),JSON[_0xdd59('0x14')](_0x41eeb9));if(_0x41eeb9[_0xdd59('0x15')]){if(_0x41eeb9[_0xdd59('0x15')][_0xdd59('0x16')]===0x1f4){logger['error'](_0xdd59('0x17'),_0x50ed44,_0x41eeb9[_0xdd59('0x15')]['message']);return _0x5dc51b(_0x41eeb9[_0xdd59('0x15')][_0xdd59('0x18')]);}logger[_0xdd59('0x15')](_0xdd59('0x17'),_0x50ed44,_0x41eeb9[_0xdd59('0x15')][_0xdd59('0x18')]);return _0xb9248e(_0x41eeb9[_0xdd59('0x15')][_0xdd59('0x18')]);}else{logger[_0xdd59('0x10')](_0xdd59('0x17'),_0x50ed44,_0xdd59('0x11'));_0xb9248e(_0x41eeb9[_0xdd59('0x19')][_0xdd59('0x18')]);}})[_0xdd59('0x1a')](function(_0x355d9d){logger[_0xdd59('0x15')]('CmList,\x20%s,\x20%s',_0x50ed44,_0x355d9d);_0x5dc51b(_0x355d9d);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 27eb234..f77c8b7 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 _0x1883=['cmList:','save','remove','emit','register','length'];(function(_0x2055b3,_0x1f00ab){var _0x1b3cc1=function(_0x3dd1a1){while(--_0x3dd1a1){_0x2055b3['push'](_0x2055b3['shift']());}};_0x1b3cc1(++_0x1f00ab);}(_0x1883,0x199));var _0x3188=function(_0x1408b4,_0x4fc29a){_0x1408b4=_0x1408b4-0x0;var _0x507ac6=_0x1883[_0x1408b4];return _0x507ac6;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x3188('0x0'),_0x3188('0x1'),'update'];function createListener(_0x396cde,_0x487972){return function(_0x5a95d4){_0x487972[_0x3188('0x2')](_0x396cde,_0x5a95d4);};}function removeListener(_0x14d597,_0x5bd8d1){return function(){CmListEvents['removeListener'](_0x14d597,_0x5bd8d1);};}exports[_0x3188('0x3')]=function(_0x15abd6){for(var _0x59d47c=0x0,_0x400af1=events[_0x3188('0x4')];_0x59d47c<_0x400af1;_0x59d47c++){var _0x5b8e8d=events[_0x59d47c];var _0x3e3cf8=createListener(_0x3188('0x5')+_0x5b8e8d,_0x15abd6);CmListEvents['on'](_0x5b8e8d,_0x3e3cf8);}}; \ No newline at end of file +var _0xee50=['removeListener','register','length','./cmList.events','save','remove'];(function(_0x3f6371,_0x5e8bda){var _0x14041c=function(_0x393830){while(--_0x393830){_0x3f6371['push'](_0x3f6371['shift']());}};_0x14041c(++_0x5e8bda);}(_0xee50,0x1b9));var _0x0ee5=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xee50[_0x199572];return _0x13cfa3;};'use strict';var CmListEvents=require(_0x0ee5('0x0'));var events=[_0x0ee5('0x1'),_0x0ee5('0x2'),'update'];function createListener(_0x438c23,_0x2012f6){return function(_0x1000f3){_0x2012f6['emit'](_0x438c23,_0x1000f3);};}function removeListener(_0x243fd6,_0x2d811e){return function(){CmListEvents[_0x0ee5('0x3')](_0x243fd6,_0x2d811e);};}exports[_0x0ee5('0x4')]=function(_0x227918){for(var _0x1a996e=0x0,_0x4bd636=events[_0x0ee5('0x5')];_0x1a996e<_0x4bd636;_0x1a996e++){var _0x3db9bb=events[_0x1a996e];var _0x590558=createListener('cmList:'+_0x3db9bb,_0x227918);CmListEvents['on'](_0x3db9bb,_0x590558);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 1d41f13..8b67293 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 _0x80df=['removeDispositions','removeAgents','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','/:id/contacts','addContacts','addAgents','update','delete','destroy'];(function(_0x5c6299,_0x11bd28){var _0x23b564=function(_0x329ed6){while(--_0x329ed6){_0x5c6299['push'](_0x5c6299['shift']());}};_0x23b564(++_0x11bd28);}(_0x80df,0x17e));var _0xf80d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x80df[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xf80d('0x0'));var util=require(_0xf80d('0x1'));var path=require(_0xf80d('0x2'));var timeout=require(_0xf80d('0x3'));var express=require('express');var router=express[_0xf80d('0x4')]();var fs_extra=require(_0xf80d('0x5'));var auth=require(_0xf80d('0x6'));var interaction=require(_0xf80d('0x7'));var config=require(_0xf80d('0x8'));var controller=require(_0xf80d('0x9'));router[_0xf80d('0xa')]('/',auth[_0xf80d('0xb')](),controller[_0xf80d('0xc')]);router[_0xf80d('0xa')]('/describe',auth[_0xf80d('0xb')](),controller[_0xf80d('0xd')]);router[_0xf80d('0xa')](_0xf80d('0xe'),auth[_0xf80d('0xb')](),controller[_0xf80d('0xf')]);router[_0xf80d('0xa')](_0xf80d('0x10'),auth[_0xf80d('0xb')](),controller[_0xf80d('0x11')]);router[_0xf80d('0xa')](_0xf80d('0x12'),auth[_0xf80d('0xb')](),controller[_0xf80d('0x13')]);router['get']('/:id/contacts',auth[_0xf80d('0xb')](),controller[_0xf80d('0x14')]);router['get'](_0xf80d('0x15'),auth['isAuthenticated'](),controller[_0xf80d('0x16')]);router['get'](_0xf80d('0x17'),auth['isAuthenticated'](),controller[_0xf80d('0x18')]);router[_0xf80d('0xa')](_0xf80d('0x19'),auth[_0xf80d('0xb')](),controller[_0xf80d('0x1a')]);router[_0xf80d('0x1b')]('/',auth[_0xf80d('0xb')](),controller[_0xf80d('0x1c')]);router[_0xf80d('0x1b')](_0xf80d('0x12'),auth[_0xf80d('0xb')](),controller[_0xf80d('0x1d')]);router[_0xf80d('0x1b')](_0xf80d('0x1e'),auth[_0xf80d('0xb')](),controller[_0xf80d('0x1f')]);router[_0xf80d('0x1b')](_0xf80d('0x17'),auth[_0xf80d('0xb')](),controller['addCustomField']);router[_0xf80d('0x1b')](_0xf80d('0x19'),auth['isAuthenticated'](),controller[_0xf80d('0x20')]);router['put'](_0xf80d('0x10'),auth[_0xf80d('0xb')](),controller[_0xf80d('0x21')]);router[_0xf80d('0x22')](_0xf80d('0x10'),auth[_0xf80d('0xb')](),controller[_0xf80d('0x23')]);router[_0xf80d('0x22')](_0xf80d('0x12'),auth[_0xf80d('0xb')](),controller[_0xf80d('0x24')]);router[_0xf80d('0x22')]('/:id/users',auth[_0xf80d('0xb')](),controller[_0xf80d('0x25')]);module['exports']=router; \ No newline at end of file +var _0x03ce=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','create','addDisposition','addContacts','addCustomField','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','multer'];(function(_0x2b5ad0,_0x1add86){var _0x1c3276=function(_0x2b4740){while(--_0x2b4740){_0x2b5ad0['push'](_0x2b5ad0['shift']());}};_0x1c3276(++_0x1add86);}(_0x03ce,0x1a1));var _0xe03c=function(_0x224723,_0xc7e9ef){_0x224723=_0x224723-0x0;var _0xdb67a0=_0x03ce[_0x224723];return _0xdb67a0;};'use strict';var multer=require(_0xe03c('0x0'));var util=require(_0xe03c('0x1'));var path=require(_0xe03c('0x2'));var timeout=require(_0xe03c('0x3'));var express=require('express');var router=express[_0xe03c('0x4')]();var fs_extra=require(_0xe03c('0x5'));var auth=require(_0xe03c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe03c('0x7'));var controller=require(_0xe03c('0x8'));router[_0xe03c('0x9')]('/',auth[_0xe03c('0xa')](),controller[_0xe03c('0xb')]);router[_0xe03c('0x9')](_0xe03c('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xe03c('0x9')](_0xe03c('0xd'),auth[_0xe03c('0xa')](),controller[_0xe03c('0xe')]);router[_0xe03c('0x9')](_0xe03c('0xf'),auth[_0xe03c('0xa')](),controller[_0xe03c('0x10')]);router['get'](_0xe03c('0x11'),auth[_0xe03c('0xa')](),controller[_0xe03c('0x12')]);router['get'](_0xe03c('0x13'),auth[_0xe03c('0xa')](),controller[_0xe03c('0x14')]);router[_0xe03c('0x9')](_0xe03c('0x15'),auth['isAuthenticated'](),controller[_0xe03c('0x16')]);router[_0xe03c('0x9')](_0xe03c('0x17'),auth['isAuthenticated'](),controller[_0xe03c('0x18')]);router[_0xe03c('0x9')](_0xe03c('0x19'),auth[_0xe03c('0xa')](),controller[_0xe03c('0x1a')]);router['post']('/',auth[_0xe03c('0xa')](),controller[_0xe03c('0x1b')]);router['post'](_0xe03c('0x11'),auth[_0xe03c('0xa')](),controller[_0xe03c('0x1c')]);router['post']('/:id/contacts',auth[_0xe03c('0xa')](),controller[_0xe03c('0x1d')]);router['post'](_0xe03c('0x17'),auth[_0xe03c('0xa')](),controller[_0xe03c('0x1e')]);router['post']('/:id/users',auth[_0xe03c('0xa')](),controller[_0xe03c('0x1f')]);router[_0xe03c('0x20')](_0xe03c('0xf'),auth[_0xe03c('0xa')](),controller[_0xe03c('0x21')]);router[_0xe03c('0x22')](_0xe03c('0xf'),auth['isAuthenticated'](),controller[_0xe03c('0x23')]);router['delete'](_0xe03c('0x11'),auth[_0xe03c('0xa')](),controller[_0xe03c('0x24')]);router[_0xe03c('0x22')](_0xe03c('0x19'),auth[_0xe03c('0xa')](),controller[_0xe03c('0x25')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index aefee9f..1079f5b 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 _0xfdf5=['STRING','sequelize','getDataValue','field'];(function(_0xfd9b19,_0x21d75f){var _0x514918=function(_0x52e212){while(--_0x52e212){_0xfd9b19['push'](_0xfd9b19['shift']());}};_0x514918(++_0x21d75f);}(_0xfdf5,0x69));var _0x5fdf=function(_0x2871da,_0x2a108d){_0x2871da=_0x2871da-0x0;var _0x4a3acb=_0xfdf5[_0x2871da];return _0x4a3acb;};'use strict';var Sequelize=require(_0x5fdf('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x59a456){return this[_0x5fdf('0x1')](_0x5fdf('0x2'));}},'field':{'type':Sequelize[_0x5fdf('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x5fdf('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x5fdf('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0x2c62=['getDataValue','STRING','sequelize','VIRTUAL'];(function(_0x426fd4,_0x444e56){var _0x2b8a85=function(_0x360b9c){while(--_0x360b9c){_0x426fd4['push'](_0x426fd4['shift']());}};_0x2b8a85(++_0x444e56);}(_0x2c62,0xb2));var _0x22c6=function(_0x625543,_0x2663e3){_0x625543=_0x625543-0x0;var _0x32d17d=_0x2c62[_0x625543];return _0x32d17d;};'use strict';var Sequelize=require(_0x22c6('0x0'));module['exports']={'name':{'type':Sequelize[_0x22c6('0x1')],'get':function(_0xf7de28){return this[_0x22c6('0x2')]('field');}},'field':{'type':Sequelize[_0x22c6('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x22c6('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x22c6('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 1a1a652..6d1026e 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x2f2086,_0x19e5b0){var _0x2e8717=function(_0xca36ad){while(--_0xca36ad){_0x2f2086['push'](_0x2f2086['shift']());}};_0x2e8717(++_0x19e5b0);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +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(_0x577749,_0x15ba5e){var _0x17d797=function(_0x498687){while(--_0x498687){_0x577749['push'](_0x577749['shift']());}};_0x17d797(++_0x15ba5e);}(_0x7a54,0x106));var _0x47a5=function(_0x2a2f1c,_0x2809b8){_0x2a2f1c=_0x2a2f1c-0x0;var _0x383b24=_0x7a54[_0x2a2f1c];return _0x383b24;};'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 cffa985..0b49876 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 _0x5873=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes','define','Condition','util'];(function(_0x234577,_0x3b9004){var _0x28fea6=function(_0x59692d){while(--_0x59692d){_0x234577['push'](_0x234577['shift']());}};_0x28fea6(++_0x3b9004);}(_0x5873,0x149));var _0x3587=function(_0x859df3,_0x413f79){_0x859df3=_0x859df3-0x0;var _0xcd015a=_0x5873[_0x859df3];return _0xcd015a;};'use strict';var _=require('lodash');var util=require(_0x3587('0x0'));var logger=require(_0x3587('0x1'))('api');var moment=require(_0x3587('0x2'));var BPromise=require(_0x3587('0x3'));var rp=require(_0x3587('0x4'));var fs=require('fs');var path=require(_0x3587('0x5'));var rimraf=require(_0x3587('0x6'));var config=require(_0x3587('0x7'));var attributes=require(_0x3587('0x8'));module['exports']=function(_0x136b60,_0x1c99a1){return _0x136b60[_0x3587('0x9')](_0x3587('0xa'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e1c=['rimraf','../../config/environment','exports','define','Condition','tools_conditions','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3e1c,0x14a));var _0xc3e1=function(_0x2dc269,_0x3ff548){_0x2dc269=_0x2dc269-0x0;var _0x93c66d=_0x3e1c[_0x2dc269];return _0x93c66d;};'use strict';var _=require(_0xc3e1('0x0'));var util=require('util');var logger=require(_0xc3e1('0x1'))(_0xc3e1('0x2'));var moment=require(_0xc3e1('0x3'));var BPromise=require('bluebird');var rp=require(_0xc3e1('0x4'));var fs=require('fs');var path=require(_0xc3e1('0x5'));var rimraf=require(_0xc3e1('0x6'));var config=require(_0xc3e1('0x7'));var attributes=require('./condition.attributes');module[_0xc3e1('0x8')]=function(_0x1377d7,_0x53a7ed){return _0x1377d7[_0xc3e1('0x9')](_0xc3e1('0xa'),attributes,{'tableName':_0xc3e1('0xb'),'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 d47d2c6..fe79979 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 _0x0211=['message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','Condition,\x20%s,\x20%s'];(function(_0x13d694,_0x2057d8){var _0x57d2d4=function(_0x3d3349){while(--_0x3d3349){_0x13d694['push'](_0x13d694['shift']());}};_0x57d2d4(++_0x2057d8);}(_0x0211,0x1b3));var _0x1021=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x0211[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x1021('0x0'));var util=require(_0x1021('0x1'));var moment=require(_0x1021('0x2'));var BPromise=require('bluebird');var rs=require(_0x1021('0x3'));var fs=require('fs');var Redis=require(_0x1021('0x4'));var db=require(_0x1021('0x5'))['db'];var utils=require(_0x1021('0x6'));var logger=require(_0x1021('0x7'))(_0x1021('0x8'));var config=require(_0x1021('0x9'));var jayson=require(_0x1021('0xa'));var client=jayson['client'][_0x1021('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x518802,_0xdfe6bc,_0x49c457){return new BPromise(function(_0x5005ae,_0x51f14c){return client[_0x1021('0xc')](_0x518802,_0x49c457)['then'](function(_0x21057f){logger[_0x1021('0xd')]('Condition,\x20%s,\x20%s',_0xdfe6bc,_0x1021('0xe'));logger[_0x1021('0xf')](_0x1021('0x10'),_0xdfe6bc,_0x1021('0xe'),JSON[_0x1021('0x11')](_0x21057f));if(_0x21057f[_0x1021('0x12')]){if(_0x21057f[_0x1021('0x12')][_0x1021('0x13')]===0x1f4){logger[_0x1021('0x12')](_0x1021('0x14'),_0xdfe6bc,_0x21057f[_0x1021('0x12')][_0x1021('0x15')]);return _0x51f14c(_0x21057f[_0x1021('0x12')]['message']);}logger[_0x1021('0x12')](_0x1021('0x14'),_0xdfe6bc,_0x21057f['error'][_0x1021('0x15')]);return _0x5005ae(_0x21057f[_0x1021('0x12')][_0x1021('0x15')]);}else{logger['info']('Condition,\x20%s,\x20%s',_0xdfe6bc,'request\x20sent');_0x5005ae(_0x21057f[_0x1021('0x16')][_0x1021('0x15')]);}})[_0x1021('0x17')](function(_0x3352f9){logger['error'](_0x1021('0x14'),_0xdfe6bc,_0x3352f9);_0x51f14c(_0x3352f9);});});} \ No newline at end of file +var _0x47e7=['then','info','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Condition,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x3b1b23,_0x21bccd){var _0x1efc85=function(_0x102a95){while(--_0x102a95){_0x3b1b23['push'](_0x3b1b23['shift']());}};_0x1efc85(++_0x21bccd);}(_0x47e7,0x110));var _0x747e=function(_0xe1935c,_0x105fb8){_0xe1935c=_0xe1935c-0x0;var _0x26bceb=_0x47e7[_0xe1935c];return _0x26bceb;};'use strict';var _=require(_0x747e('0x0'));var util=require(_0x747e('0x1'));var moment=require(_0x747e('0x2'));var BPromise=require(_0x747e('0x3'));var rs=require(_0x747e('0x4'));var fs=require('fs');var Redis=require(_0x747e('0x5'));var db=require(_0x747e('0x6'))['db'];var utils=require(_0x747e('0x7'));var logger=require(_0x747e('0x8'))('rpc');var config=require(_0x747e('0x9'));var jayson=require(_0x747e('0xa'));var client=jayson[_0x747e('0xb')][_0x747e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5657ec,_0x4482ca,_0x51f13f){return new BPromise(function(_0x3e0281,_0x47eba7){return client[_0x747e('0xd')](_0x5657ec,_0x51f13f)[_0x747e('0xe')](function(_0x46f07f){logger[_0x747e('0xf')]('Condition,\x20%s,\x20%s',_0x4482ca,'request\x20sent');logger[_0x747e('0x10')](_0x747e('0x11'),_0x4482ca,_0x747e('0x12'),JSON[_0x747e('0x13')](_0x46f07f));if(_0x46f07f[_0x747e('0x14')]){if(_0x46f07f[_0x747e('0x14')][_0x747e('0x15')]===0x1f4){logger['error'](_0x747e('0x16'),_0x4482ca,_0x46f07f[_0x747e('0x14')][_0x747e('0x17')]);return _0x47eba7(_0x46f07f[_0x747e('0x14')][_0x747e('0x17')]);}logger[_0x747e('0x14')]('Condition,\x20%s,\x20%s',_0x4482ca,_0x46f07f[_0x747e('0x14')][_0x747e('0x17')]);return _0x3e0281(_0x46f07f['error'][_0x747e('0x17')]);}else{logger['info'](_0x747e('0x16'),_0x4482ca,'request\x20sent');_0x3e0281(_0x46f07f[_0x747e('0x18')][_0x747e('0x17')]);}})[_0x747e('0x19')](function(_0x3d608a){logger[_0x747e('0x14')](_0x747e('0x16'),_0x4482ca,_0x3d608a);_0x47eba7(_0x3d608a);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 270590a..9e389bf 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 _0xbd53=['destroy','exports','util','path','express','Router','../../components/auth/service','../../config/environment','/:id','isAuthenticated','update','delete'];(function(_0x57c922,_0x765f23){var _0xf40d91=function(_0x4b9c38){while(--_0x4b9c38){_0x57c922['push'](_0x57c922['shift']());}};_0xf40d91(++_0x765f23);}(_0xbd53,0x7a));var _0x3bd5=function(_0x4a162e,_0xe75ec){_0x4a162e=_0x4a162e-0x0;var _0x5c023d=_0xbd53[_0x4a162e];return _0x5c023d;};'use strict';var multer=require('multer');var util=require(_0x3bd5('0x0'));var path=require(_0x3bd5('0x1'));var timeout=require('connect-timeout');var express=require(_0x3bd5('0x2'));var router=express[_0x3bd5('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3bd5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3bd5('0x5'));var controller=require('./condition.controller');router['put'](_0x3bd5('0x6'),auth[_0x3bd5('0x7')](),controller[_0x3bd5('0x8')]);router[_0x3bd5('0x9')](_0x3bd5('0x6'),auth['isAuthenticated'](),controller[_0x3bd5('0xa')]);module[_0x3bd5('0xb')]=router; \ No newline at end of file +var _0x6ff2=['multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','update','delete','destroy'];(function(_0x1e86ce,_0x338315){var _0xf58e73=function(_0x14ec37){while(--_0x14ec37){_0x1e86ce['push'](_0x1e86ce['shift']());}};_0xf58e73(++_0x338315);}(_0x6ff2,0x1c0));var _0x26ff=function(_0x2e9ae1,_0xe5231d){_0x2e9ae1=_0x2e9ae1-0x0;var _0x20b619=_0x6ff2[_0x2e9ae1];return _0x20b619;};'use strict';var multer=require(_0x26ff('0x0'));var util=require('util');var path=require(_0x26ff('0x1'));var timeout=require('connect-timeout');var express=require(_0x26ff('0x2'));var router=express[_0x26ff('0x3')]();var fs_extra=require(_0x26ff('0x4'));var auth=require(_0x26ff('0x5'));var interaction=require(_0x26ff('0x6'));var config=require(_0x26ff('0x7'));var controller=require('./condition.controller');router[_0x26ff('0x8')](_0x26ff('0x9'),auth[_0x26ff('0xa')](),controller[_0x26ff('0xb')]);router[_0x26ff('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x26ff('0xd')]);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 a177023..2c27b83 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 _0xfaf0=['STRING','name','sequelize'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xfaf0,0x1b8));var _0x0faf=function(_0x567c41,_0x37faa4){_0x567c41=_0x567c41-0x0;var _0x47a655=_0xfaf0[_0x567c41];return _0x47a655;};'use strict';var Sequelize=require(_0x0faf('0x0'));module['exports']={'name':{'type':Sequelize[_0x0faf('0x1')],'allowNull':![],'unique':_0x0faf('0x2')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x0faf('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x4d6e=['exports','STRING','sequelize'];(function(_0x4f219b,_0x841f7e){var _0x8a7718=function(_0x3e8f25){while(--_0x3e8f25){_0x4f219b['push'](_0x4f219b['shift']());}};_0x8a7718(++_0x841f7e);}(_0x4d6e,0x119));var _0xe4d6=function(_0x3038be,_0x425d69){_0x3038be=_0x3038be-0x0;var _0x581d4e=_0x4d6e[_0x3038be];return _0x581d4e;};'use strict';var Sequelize=require(_0xe4d6('0x0'));module[_0xe4d6('0x1')]={'name':{'type':Sequelize[_0xe4d6('0x2')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 84f8d2b..6bec40d 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 _0x4cf8=['moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','ContactItemTypes','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','VIRTUAL','ContactItemType','include','findAll','catch','find','create','body','user','UserProfileSection','userProfileId','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0xea7461,_0x357cdb){var _0x48a33b=function(_0xb714d7){while(--_0xb714d7){_0xea7461['push'](_0xea7461['shift']());}};_0x48a33b(++_0x357cdb);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x136e17,_0x4cc300){_0x136e17=_0x136e17-0x0;var _0x5099c9=_0x4cf8[_0x136e17];return _0x5099c9;};'use strict';var emlformat=require(_0x84cf('0x0'));var rimraf=require(_0x84cf('0x1'));var zipdir=require(_0x84cf('0x2'));var jsonpatch=require(_0x84cf('0x3'));var rp=require(_0x84cf('0x4'));var moment=require(_0x84cf('0x5'));var BPromise=require(_0x84cf('0x6'));var Mustache=require(_0x84cf('0x7'));var util=require(_0x84cf('0x8'));var path=require(_0x84cf('0x9'));var sox=require(_0x84cf('0xa'));var csv=require(_0x84cf('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x84cf('0xc'));var squel=require('squel');var crypto=require(_0x84cf('0xd'));var jsforce=require(_0x84cf('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x84cf('0xb'));var querystring=require(_0x84cf('0xf'));var Papa=require('papaparse');var Redis=require(_0x84cf('0x10'));var authService=require(_0x84cf('0x11'));var qs=require(_0x84cf('0x12'));var as=require(_0x84cf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x84cf('0x14'))(_0x84cf('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x84cf('0x16'));var db=require(_0x84cf('0x17'))['db'];function respondWithStatusCode(_0x35f852,_0x33f83e){_0x33f83e=_0x33f83e||0xcc;return function(_0x172d04){if(_0x172d04){return _0x35f852[_0x84cf('0x18')](_0x33f83e);}return _0x35f852[_0x84cf('0x19')](_0x33f83e)[_0x84cf('0x1a')]();};}function respondWithResult(_0xced48,_0x250a19){_0x250a19=_0x250a19||0xc8;return function(_0x2fc41f){if(_0x2fc41f){return _0xced48[_0x84cf('0x19')](_0x250a19)[_0x84cf('0x1b')](_0x2fc41f);}};}function respondWithFilteredResult(_0x20e79c,_0x27261b){return function(_0x167c3e){if(_0x167c3e){var _0x464e70=typeof _0x27261b[_0x84cf('0x1c')]===_0x84cf('0x1d')&&typeof _0x27261b['limit']===_0x84cf('0x1d');var _0x5d6a93=_0x167c3e[_0x84cf('0x1e')];var _0x1abe2d=_0x464e70?0x0:_0x27261b[_0x84cf('0x1c')];var _0x13ba16=_0x464e70?_0x167c3e[_0x84cf('0x1e')]:_0x27261b['offset']+_0x27261b['limit'];var _0x42d6d4;if(_0x13ba16>=_0x5d6a93){_0x13ba16=_0x5d6a93;_0x42d6d4=0xc8;}else{_0x42d6d4=0xce;}_0x20e79c[_0x84cf('0x19')](_0x42d6d4);return _0x20e79c[_0x84cf('0x1f')](_0x84cf('0x20'),_0x1abe2d+'-'+_0x13ba16+'/'+_0x5d6a93)[_0x84cf('0x1b')](_0x167c3e);}return null;};}function patchUpdates(_0x5dda3f){return function(_0x39a37b){try{jsonpatch[_0x84cf('0x21')](_0x39a37b,_0x5dda3f,!![]);}catch(_0x3ca1be){return BPromise[_0x84cf('0x22')](_0x3ca1be);}return _0x39a37b[_0x84cf('0x23')]();};}function saveUpdates(_0x54405a,_0x42fa45){return function(_0x160f86){if(_0x160f86){return _0x160f86[_0x84cf('0x24')](_0x54405a)[_0x84cf('0x25')](function(_0x3e5e94){return _0x3e5e94;});}return null;};}function removeEntity(_0x29e9e1,_0x7feb4){return function(_0x4c9d1c){if(_0x4c9d1c){return _0x4c9d1c[_0x84cf('0x26')]()[_0x84cf('0x25')](function(){var _0x1c7747=_0x4c9d1c[_0x84cf('0x27')]({'plain':!![]});var _0x1d220a=_0x84cf('0x28');return db[_0x84cf('0x29')][_0x84cf('0x26')]({'where':{'type':_0x1d220a,'resourceId':_0x1c7747['id']}})[_0x84cf('0x25')](function(){return _0x4c9d1c;});})[_0x84cf('0x25')](function(){_0x29e9e1['status'](0xcc)[_0x84cf('0x1a')]();});}};}function handleEntityNotFound(_0x17bc92,_0x2a4973){return function(_0x41a5db){if(!_0x41a5db){_0x17bc92['sendStatus'](0x194);}return _0x41a5db;};}function handleError(_0x1595dd,_0x5a428c){_0x5a428c=_0x5a428c||0x1f4;return function(_0x29455e){logger[_0x84cf('0x2a')](_0x29455e[_0x84cf('0x2b')]);if(_0x29455e[_0x84cf('0x2c')]){delete _0x29455e[_0x84cf('0x2c')];}_0x1595dd[_0x84cf('0x19')](_0x5a428c)[_0x84cf('0x2d')](_0x29455e);};}exports[_0x84cf('0x2e')]=function(_0x1bfa56,_0xb4fc5a){var _0x31dbf5={},_0x308f8f={},_0x18243d={'count':0x0,'rows':[]};var _0x44f16e=_['map'](db['ContactItemType'][_0x84cf('0x2f')],function(_0x25de3a){return{'name':_0x25de3a[_0x84cf('0x30')],'type':_0x25de3a[_0x84cf('0x31')][_0x84cf('0x32')]};});_0x308f8f[_0x84cf('0x33')]=_[_0x84cf('0x34')](_0x44f16e,_0x84cf('0x2c'));_0x308f8f['query']=_[_0x84cf('0x35')](_0x1bfa56[_0x84cf('0x36')]);_0x308f8f['filters']=_[_0x84cf('0x37')](_0x308f8f['model'],_0x308f8f[_0x84cf('0x36')]);_0x31dbf5[_0x84cf('0x38')]=_[_0x84cf('0x37')](_0x308f8f[_0x84cf('0x33')],qs[_0x84cf('0x39')](_0x1bfa56['query'][_0x84cf('0x39')]));_0x31dbf5['attributes']=_0x31dbf5['attributes'][_0x84cf('0x3a')]?_0x31dbf5[_0x84cf('0x38')]:_0x308f8f['model'];if(!_0x1bfa56[_0x84cf('0x36')][_0x84cf('0x3b')](_0x84cf('0x3c'))){_0x31dbf5[_0x84cf('0x3d')]=qs[_0x84cf('0x3d')](_0x1bfa56[_0x84cf('0x36')]['limit']);_0x31dbf5[_0x84cf('0x1c')]=qs[_0x84cf('0x1c')](_0x1bfa56[_0x84cf('0x36')][_0x84cf('0x1c')]);}_0x31dbf5[_0x84cf('0x3e')]=qs[_0x84cf('0x3f')](_0x1bfa56['query'][_0x84cf('0x3f')]);_0x31dbf5['where']=qs[_0x84cf('0x40')](_[_0x84cf('0x41')](_0x1bfa56[_0x84cf('0x36')],_0x308f8f[_0x84cf('0x40')]),_0x44f16e);if(_0x1bfa56[_0x84cf('0x36')][_0x84cf('0x42')]){_0x31dbf5[_0x84cf('0x43')]=_[_0x84cf('0x44')](_0x31dbf5[_0x84cf('0x43')],{'$or':_['map'](_0x44f16e,function(_0x44e6f0){if(_0x44e6f0['type']!==_0x84cf('0x45')){var _0xc75386={};_0xc75386[_0x44e6f0['name']]={'$like':'%'+_0x1bfa56[_0x84cf('0x36')]['filter']+'%'};return _0xc75386;}})});}_0x31dbf5=_[_0x84cf('0x44')]({},_0x31dbf5,_0x1bfa56['options']);var _0x3fc160={'where':_0x31dbf5['where']};return db[_0x84cf('0x46')][_0x84cf('0x1e')](_0x3fc160)['then'](function(_0x847ce9){_0x18243d[_0x84cf('0x1e')]=_0x847ce9;if(_0x1bfa56[_0x84cf('0x36')]['includeAll']){_0x31dbf5[_0x84cf('0x47')]=[{'all':!![]}];}return db['ContactItemType'][_0x84cf('0x48')](_0x31dbf5);})['then'](function(_0x56b0e5){_0x18243d['rows']=_0x56b0e5;return _0x18243d;})[_0x84cf('0x25')](respondWithFilteredResult(_0xb4fc5a,_0x31dbf5))[_0x84cf('0x49')](handleError(_0xb4fc5a,null));};exports['show']=function(_0x2b737e,_0x56b623){var _0x191ad8={'raw':!![],'where':{'id':_0x2b737e['params']['id']}},_0x3fe8c1={};_0x3fe8c1[_0x84cf('0x33')]=_['keys'](db[_0x84cf('0x46')]['rawAttributes']);_0x3fe8c1['query']=_['keys'](_0x2b737e['query']);_0x3fe8c1['filters']=_['intersection'](_0x3fe8c1['model'],_0x3fe8c1[_0x84cf('0x36')]);_0x191ad8[_0x84cf('0x38')]=_[_0x84cf('0x37')](_0x3fe8c1[_0x84cf('0x33')],qs['fields'](_0x2b737e[_0x84cf('0x36')]['fields']));_0x191ad8[_0x84cf('0x38')]=_0x191ad8[_0x84cf('0x38')][_0x84cf('0x3a')]?_0x191ad8[_0x84cf('0x38')]:_0x3fe8c1[_0x84cf('0x33')];if(_0x2b737e[_0x84cf('0x36')]['includeAll']){_0x191ad8[_0x84cf('0x47')]=[{'all':!![]}];}_0x191ad8=_[_0x84cf('0x44')]({},_0x191ad8,_0x2b737e['options']);return db[_0x84cf('0x46')][_0x84cf('0x4a')](_0x191ad8)[_0x84cf('0x25')](handleEntityNotFound(_0x56b623,null))['then'](respondWithResult(_0x56b623,null))['catch'](handleError(_0x56b623,null));};exports['create']=function(_0x1cf3f6,_0x104421){return db[_0x84cf('0x46')][_0x84cf('0x4b')](_0x1cf3f6[_0x84cf('0x4c')],{})[_0x84cf('0x25')](function(_0x51d725){var _0x350985=_0x1cf3f6['user'][_0x84cf('0x27')]({'plain':!![]});if(!_0x350985)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x350985['role']===_0x84cf('0x4d')){var _0xb1c3a8=_0x51d725[_0x84cf('0x27')]({'plain':!![]});var _0x55e24e='ContactItemTypes';return db[_0x84cf('0x4e')][_0x84cf('0x4a')]({'where':{'name':_0x55e24e,'userProfileId':_0x350985[_0x84cf('0x4f')]},'raw':!![]})[_0x84cf('0x25')](function(_0x401ced){if(_0x401ced&&_0x401ced['autoAssociation']===0x0){return db[_0x84cf('0x29')][_0x84cf('0x4b')]({'name':_0xb1c3a8['name'],'resourceId':_0xb1c3a8['id'],'type':_0x401ced[_0x84cf('0x2c')],'sectionId':_0x401ced['id']},{})['then'](function(){return _0x51d725;});}else{return _0x51d725;}})['catch'](function(_0x147194){logger[_0x84cf('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x147194);throw _0x147194;});}return _0x51d725;})['then'](respondWithResult(_0x104421,0xc9))[_0x84cf('0x49')](handleError(_0x104421,null));};exports[_0x84cf('0x24')]=function(_0x2f739a,_0x1e2676){if(_0x2f739a[_0x84cf('0x4c')]['id']){delete _0x2f739a[_0x84cf('0x4c')]['id'];}return db[_0x84cf('0x46')][_0x84cf('0x4a')]({'where':{'id':_0x2f739a['params']['id']}})[_0x84cf('0x25')](handleEntityNotFound(_0x1e2676,null))[_0x84cf('0x25')](saveUpdates(_0x2f739a['body'],null))['then'](respondWithResult(_0x1e2676,null))[_0x84cf('0x49')](handleError(_0x1e2676,null));};exports[_0x84cf('0x26')]=function(_0x3912cb,_0x2a4f20){return db[_0x84cf('0x46')][_0x84cf('0x4a')]({'where':{'id':_0x3912cb[_0x84cf('0x50')]['id']}})['then'](handleEntityNotFound(_0x2a4f20,null))[_0x84cf('0x25')](db['CmContactHasItem'][_0x84cf('0x24')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x3912cb['params']['id']}}))[_0x84cf('0x25')](removeEntity(_0x2a4f20,null))[_0x84cf('0x49')](handleError(_0x2a4f20,null));}; \ No newline at end of file +var _0x3423=['../../components/auth/service','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','ContactItemTypes','error','stack','name','send','index','ContactItemType','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','params','catch','create','role','user','get','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','CmContactHasItem','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'];(function(_0x541895,_0x5b868f){var _0x390ce0=function(_0x1f774b){while(--_0x1f774b){_0x541895['push'](_0x541895['shift']());}};_0x390ce0(++_0x5b868f);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3342('0x0'));var jsonpatch=require(_0x3342('0x1'));var rp=require(_0x3342('0x2'));var moment=require(_0x3342('0x3'));var BPromise=require(_0x3342('0x4'));var Mustache=require(_0x3342('0x5'));var util=require(_0x3342('0x6'));var path=require(_0x3342('0x7'));var sox=require(_0x3342('0x8'));var csv=require(_0x3342('0x9'));var ejs=require(_0x3342('0xa'));var fs=require('fs');var fs_extra=require(_0x3342('0xb'));var _=require(_0x3342('0xc'));var squel=require(_0x3342('0xd'));var crypto=require(_0x3342('0xe'));var jsforce=require(_0x3342('0xf'));var deskjs=require(_0x3342('0x10'));var toCsv=require(_0x3342('0x9'));var querystring=require(_0x3342('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3342('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3342('0x13'));var utils=require(_0x3342('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3342('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x716d80,_0x36e1f4){_0x36e1f4=_0x36e1f4||0xcc;return function(_0x592ba8){if(_0x592ba8){return _0x716d80[_0x3342('0x16')](_0x36e1f4);}return _0x716d80[_0x3342('0x17')](_0x36e1f4)[_0x3342('0x18')]();};}function respondWithResult(_0xe4689e,_0x61fcc0){_0x61fcc0=_0x61fcc0||0xc8;return function(_0x104077){if(_0x104077){return _0xe4689e[_0x3342('0x17')](_0x61fcc0)['json'](_0x104077);}};}function respondWithFilteredResult(_0x3e44f3,_0x19bd71){return function(_0x49afe3){if(_0x49afe3){var _0x40d609=typeof _0x19bd71[_0x3342('0x19')]==='undefined'&&typeof _0x19bd71['limit']===_0x3342('0x1a');var _0x143cf1=_0x49afe3[_0x3342('0x1b')];var _0x2075cb=_0x40d609?0x0:_0x19bd71[_0x3342('0x19')];var _0x156c24=_0x40d609?_0x49afe3[_0x3342('0x1b')]:_0x19bd71[_0x3342('0x19')]+_0x19bd71[_0x3342('0x1c')];var _0x4f4c2a;if(_0x156c24>=_0x143cf1){_0x156c24=_0x143cf1;_0x4f4c2a=0xc8;}else{_0x4f4c2a=0xce;}_0x3e44f3[_0x3342('0x17')](_0x4f4c2a);return _0x3e44f3[_0x3342('0x1d')](_0x3342('0x1e'),_0x2075cb+'-'+_0x156c24+'/'+_0x143cf1)['json'](_0x49afe3);}return null;};}function patchUpdates(_0x3cb86f){return function(_0x463324){try{jsonpatch['apply'](_0x463324,_0x3cb86f,!![]);}catch(_0xe774b7){return BPromise[_0x3342('0x1f')](_0xe774b7);}return _0x463324['save']();};}function saveUpdates(_0x4e1b19,_0x5a0658){return function(_0x3f271c){if(_0x3f271c){return _0x3f271c[_0x3342('0x20')](_0x4e1b19)[_0x3342('0x21')](function(_0x2dbad1){return _0x2dbad1;});}return null;};}function removeEntity(_0xd2b87d,_0x2925a2){return function(_0x26eb87){if(_0x26eb87){return _0x26eb87[_0x3342('0x22')]()['then'](function(){var _0x30ffc9=_0x26eb87['get']({'plain':!![]});var _0x51cf45=_0x3342('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x51cf45,'resourceId':_0x30ffc9['id']}})[_0x3342('0x21')](function(){return _0x26eb87;});})['then'](function(){_0xd2b87d[_0x3342('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x524286,_0x55cddd){return function(_0x1497d9){if(!_0x1497d9){_0x524286[_0x3342('0x16')](0x194);}return _0x1497d9;};}function handleError(_0x1dd607,_0x5eef2b){_0x5eef2b=_0x5eef2b||0x1f4;return function(_0xc275a1){logger[_0x3342('0x24')](_0xc275a1[_0x3342('0x25')]);if(_0xc275a1[_0x3342('0x26')]){delete _0xc275a1['name'];}_0x1dd607[_0x3342('0x17')](_0x5eef2b)[_0x3342('0x27')](_0xc275a1);};}exports[_0x3342('0x28')]=function(_0x301114,_0xf82530){var _0x2cc691={},_0x135760={},_0x47b2a0={'count':0x0,'rows':[]};var _0x2e0bde=_['map'](db[_0x3342('0x29')][_0x3342('0x2a')],function(_0x508f87){return{'name':_0x508f87[_0x3342('0x2b')],'type':_0x508f87[_0x3342('0x2c')][_0x3342('0x2d')]};});_0x135760[_0x3342('0x2e')]=_['map'](_0x2e0bde,_0x3342('0x26'));_0x135760[_0x3342('0x2f')]=_[_0x3342('0x30')](_0x301114[_0x3342('0x2f')]);_0x135760[_0x3342('0x31')]=_[_0x3342('0x32')](_0x135760[_0x3342('0x2e')],_0x135760[_0x3342('0x2f')]);_0x2cc691[_0x3342('0x33')]=_[_0x3342('0x32')](_0x135760[_0x3342('0x2e')],qs[_0x3342('0x34')](_0x301114['query']['fields']));_0x2cc691[_0x3342('0x33')]=_0x2cc691['attributes'][_0x3342('0x35')]?_0x2cc691[_0x3342('0x33')]:_0x135760[_0x3342('0x2e')];if(!_0x301114[_0x3342('0x2f')][_0x3342('0x36')](_0x3342('0x37'))){_0x2cc691[_0x3342('0x1c')]=qs['limit'](_0x301114[_0x3342('0x2f')][_0x3342('0x1c')]);_0x2cc691[_0x3342('0x19')]=qs[_0x3342('0x19')](_0x301114[_0x3342('0x2f')]['offset']);}_0x2cc691[_0x3342('0x38')]=qs['sort'](_0x301114[_0x3342('0x2f')][_0x3342('0x39')]);_0x2cc691[_0x3342('0x3a')]=qs[_0x3342('0x31')](_['pick'](_0x301114[_0x3342('0x2f')],_0x135760['filters']),_0x2e0bde);if(_0x301114[_0x3342('0x2f')][_0x3342('0x3b')]){_0x2cc691[_0x3342('0x3a')]=_[_0x3342('0x3c')](_0x2cc691[_0x3342('0x3a')],{'$or':_[_0x3342('0x3d')](_0x2e0bde,function(_0x32ef9a){if(_0x32ef9a['type']!==_0x3342('0x3e')){var _0x355e83={};_0x355e83[_0x32ef9a['name']]={'$like':'%'+_0x301114[_0x3342('0x2f')][_0x3342('0x3b')]+'%'};return _0x355e83;}})});}_0x2cc691=_['merge']({},_0x2cc691,_0x301114[_0x3342('0x3f')]);var _0x29f0a0={'where':_0x2cc691['where']};return db['ContactItemType']['count'](_0x29f0a0)[_0x3342('0x21')](function(_0x41e727){_0x47b2a0['count']=_0x41e727;if(_0x301114[_0x3342('0x2f')][_0x3342('0x40')]){_0x2cc691[_0x3342('0x41')]=[{'all':!![]}];}return db[_0x3342('0x29')][_0x3342('0x42')](_0x2cc691);})[_0x3342('0x21')](function(_0x34de7b){_0x47b2a0[_0x3342('0x43')]=_0x34de7b;return _0x47b2a0;})['then'](respondWithFilteredResult(_0xf82530,_0x2cc691))['catch'](handleError(_0xf82530,null));};exports[_0x3342('0x44')]=function(_0x7341fa,_0x474196){var _0xee717e={'raw':!![],'where':{'id':_0x7341fa[_0x3342('0x45')]['id']}},_0x717946={};_0x717946['model']=_[_0x3342('0x30')](db[_0x3342('0x29')][_0x3342('0x2a')]);_0x717946[_0x3342('0x2f')]=_[_0x3342('0x30')](_0x7341fa[_0x3342('0x2f')]);_0x717946['filters']=_[_0x3342('0x32')](_0x717946['model'],_0x717946[_0x3342('0x2f')]);_0xee717e[_0x3342('0x33')]=_[_0x3342('0x32')](_0x717946[_0x3342('0x2e')],qs['fields'](_0x7341fa[_0x3342('0x2f')][_0x3342('0x34')]));_0xee717e['attributes']=_0xee717e[_0x3342('0x33')][_0x3342('0x35')]?_0xee717e[_0x3342('0x33')]:_0x717946[_0x3342('0x2e')];if(_0x7341fa['query'][_0x3342('0x40')]){_0xee717e[_0x3342('0x41')]=[{'all':!![]}];}_0xee717e=_['merge']({},_0xee717e,_0x7341fa[_0x3342('0x3f')]);return db['ContactItemType']['find'](_0xee717e)[_0x3342('0x21')](handleEntityNotFound(_0x474196,null))[_0x3342('0x21')](respondWithResult(_0x474196,null))[_0x3342('0x46')](handleError(_0x474196,null));};exports[_0x3342('0x47')]=function(_0x23925e,_0x171387){return db[_0x3342('0x29')]['create'](_0x23925e['body'],{})[_0x3342('0x21')](function(_0x5a9e40){var _0x26251c=_0x23925e['user']['get']({'plain':!![]});if(!_0x26251c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26251c[_0x3342('0x48')]===_0x3342('0x49')){var _0x29ccb6=_0x5a9e40[_0x3342('0x4a')]({'plain':!![]});var _0x5176d7=_0x3342('0x23');return db[_0x3342('0x4b')]['find']({'where':{'name':_0x5176d7,'userProfileId':_0x26251c[_0x3342('0x4c')]},'raw':!![]})[_0x3342('0x21')](function(_0x43c27a){if(_0x43c27a&&_0x43c27a['autoAssociation']===0x0){return db[_0x3342('0x4d')][_0x3342('0x47')]({'name':_0x29ccb6[_0x3342('0x26')],'resourceId':_0x29ccb6['id'],'type':_0x43c27a[_0x3342('0x26')],'sectionId':_0x43c27a['id']},{})[_0x3342('0x21')](function(){return _0x5a9e40;});}else{return _0x5a9e40;}})['catch'](function(_0x2699d2){logger[_0x3342('0x24')](_0x3342('0x4e'),_0x2699d2);throw _0x2699d2;});}return _0x5a9e40;})[_0x3342('0x21')](respondWithResult(_0x171387,0xc9))[_0x3342('0x46')](handleError(_0x171387,null));};exports[_0x3342('0x20')]=function(_0x3db07c,_0x47cf76){if(_0x3db07c[_0x3342('0x4f')]['id']){delete _0x3db07c['body']['id'];}return db[_0x3342('0x29')]['find']({'where':{'id':_0x3db07c[_0x3342('0x45')]['id']}})['then'](handleEntityNotFound(_0x47cf76,null))['then'](saveUpdates(_0x3db07c['body'],null))['then'](respondWithResult(_0x47cf76,null))[_0x3342('0x46')](handleError(_0x47cf76,null));};exports[_0x3342('0x22')]=function(_0x3cd098,_0x476973){return db[_0x3342('0x29')][_0x3342('0x50')]({'where':{'id':_0x3cd098[_0x3342('0x45')]['id']}})[_0x3342('0x21')](handleEntityNotFound(_0x476973,null))[_0x3342('0x21')](db[_0x3342('0x51')][_0x3342('0x20')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x3cd098['params']['id']}}))['then'](removeEntity(_0x476973,null))[_0x3342('0x46')](handleError(_0x476973,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index fc8f780..55750a6 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 _0x3aba=['moment','path','rimraf','../../config/environment','exports','define','ContactItemType','tools_contact_item_types','lodash','api'];(function(_0x27d75e,_0x225160){var _0x321f2e=function(_0x38d8a1){while(--_0x38d8a1){_0x27d75e['push'](_0x27d75e['shift']());}};_0x321f2e(++_0x225160);}(_0x3aba,0x148));var _0xa3ab=function(_0x5eaa0b,_0x433b2f){_0x5eaa0b=_0x5eaa0b-0x0;var _0x28b295=_0x3aba[_0x5eaa0b];return _0x28b295;};'use strict';var _=require(_0xa3ab('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa3ab('0x1'));var moment=require(_0xa3ab('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa3ab('0x3'));var rimraf=require(_0xa3ab('0x4'));var config=require(_0xa3ab('0x5'));var attributes=require('./contactItemType.attributes');module[_0xa3ab('0x6')]=function(_0x25d521,_0x2b4b1d){return _0x25d521[_0xa3ab('0x7')](_0xa3ab('0x8'),attributes,{'tableName':_0xa3ab('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdbeb=['exports','define','tools_contact_item_types','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./contactItemType.attributes'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xdbeb,0x1b0));var _0xbdbe=function(_0x518e34,_0x2cc0dd){_0x518e34=_0x518e34-0x0;var _0x4909ce=_0xdbeb[_0x518e34];return _0x4909ce;};'use strict';var _=require(_0xbdbe('0x0'));var util=require(_0xbdbe('0x1'));var logger=require(_0xbdbe('0x2'))(_0xbdbe('0x3'));var moment=require(_0xbdbe('0x4'));var BPromise=require(_0xbdbe('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbdbe('0x6'));var rimraf=require(_0xbdbe('0x7'));var config=require(_0xbdbe('0x8'));var attributes=require(_0xbdbe('0x9'));module[_0xbdbe('0xa')]=function(_0x27dc4c,_0x36b16c){return _0x27dc4c[_0xbdbe('0xb')]('ContactItemType',attributes,{'tableName':_0xbdbe('0xc'),'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 c0365ed..a2093aa 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 _0xb169=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ContactItemType,\x20%s,\x20%s','debug','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1581fa,_0x17f173){var _0x46784d=function(_0x108cb9){while(--_0x108cb9){_0x1581fa['push'](_0x1581fa['shift']());}};_0x46784d(++_0x17f173);}(_0xb169,0x117));var _0x9b16=function(_0x5448a9,_0x4764da){_0x5448a9=_0x5448a9-0x0;var _0x1924af=_0xb169[_0x5448a9];return _0x1924af;};'use strict';var _=require('lodash');var util=require(_0x9b16('0x0'));var moment=require(_0x9b16('0x1'));var BPromise=require(_0x9b16('0x2'));var rs=require(_0x9b16('0x3'));var fs=require('fs');var Redis=require(_0x9b16('0x4'));var db=require(_0x9b16('0x5'))['db'];var utils=require(_0x9b16('0x6'));var logger=require(_0x9b16('0x7'))(_0x9b16('0x8'));var config=require(_0x9b16('0x9'));var jayson=require(_0x9b16('0xa'));var client=jayson[_0x9b16('0xb')][_0x9b16('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2fa258,_0x30b19c,_0x18a7bf){return new BPromise(function(_0x49d235,_0x217da2){return client[_0x9b16('0xd')](_0x2fa258,_0x18a7bf)[_0x9b16('0xe')](function(_0x12676f){logger[_0x9b16('0xf')](_0x9b16('0x10'),_0x30b19c,'request\x20sent');logger[_0x9b16('0x11')](_0x9b16('0x12'),_0x30b19c,_0x9b16('0x13'),JSON[_0x9b16('0x14')](_0x12676f));if(_0x12676f['error']){if(_0x12676f[_0x9b16('0x15')][_0x9b16('0x16')]===0x1f4){logger[_0x9b16('0x15')]('ContactItemType,\x20%s,\x20%s',_0x30b19c,_0x12676f[_0x9b16('0x15')]['message']);return _0x217da2(_0x12676f['error'][_0x9b16('0x17')]);}logger[_0x9b16('0x15')]('ContactItemType,\x20%s,\x20%s',_0x30b19c,_0x12676f[_0x9b16('0x15')]['message']);return _0x49d235(_0x12676f[_0x9b16('0x15')]['message']);}else{logger[_0x9b16('0xf')]('ContactItemType,\x20%s,\x20%s',_0x30b19c,'request\x20sent');_0x49d235(_0x12676f[_0x9b16('0x18')][_0x9b16('0x17')]);}})[_0x9b16('0x19')](function(_0x4c2bcf){logger[_0x9b16('0x15')](_0x9b16('0x10'),_0x30b19c,_0x4c2bcf);_0x217da2(_0x4c2bcf);});});} \ No newline at end of file +var _0x4bb0=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','error','ContactItemType,\x20%s,\x20%s','message','info','catch'];(function(_0x3a48c9,_0x90b148){var _0x5e9c41=function(_0x83a08f){while(--_0x83a08f){_0x3a48c9['push'](_0x3a48c9['shift']());}};_0x5e9c41(++_0x90b148);}(_0x4bb0,0x73));var _0x04bb=function(_0xcbe787,_0x401e4c){_0xcbe787=_0xcbe787-0x0;var _0x4c78fa=_0x4bb0[_0xcbe787];return _0x4c78fa;};'use strict';var _=require(_0x04bb('0x0'));var util=require(_0x04bb('0x1'));var moment=require(_0x04bb('0x2'));var BPromise=require(_0x04bb('0x3'));var rs=require(_0x04bb('0x4'));var fs=require('fs');var Redis=require(_0x04bb('0x5'));var db=require(_0x04bb('0x6'))['db'];var utils=require(_0x04bb('0x7'));var logger=require(_0x04bb('0x8'))(_0x04bb('0x9'));var config=require(_0x04bb('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x04bb('0xb')][_0x04bb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x453fde,_0x3b8695,_0x152da4){return new BPromise(function(_0x1b6fbd,_0x2f35cc){return client[_0x04bb('0xd')](_0x453fde,_0x152da4)[_0x04bb('0xe')](function(_0x5594d8){logger['info']('ContactItemType,\x20%s,\x20%s',_0x3b8695,_0x04bb('0xf'));logger[_0x04bb('0x10')](_0x04bb('0x11'),_0x3b8695,_0x04bb('0xf'),JSON['stringify'](_0x5594d8));if(_0x5594d8[_0x04bb('0x12')]){if(_0x5594d8[_0x04bb('0x12')]['code']===0x1f4){logger[_0x04bb('0x12')](_0x04bb('0x13'),_0x3b8695,_0x5594d8[_0x04bb('0x12')][_0x04bb('0x14')]);return _0x2f35cc(_0x5594d8['error'][_0x04bb('0x14')]);}logger[_0x04bb('0x12')](_0x04bb('0x13'),_0x3b8695,_0x5594d8['error']['message']);return _0x1b6fbd(_0x5594d8[_0x04bb('0x12')][_0x04bb('0x14')]);}else{logger[_0x04bb('0x15')](_0x04bb('0x13'),_0x3b8695,_0x04bb('0xf'));_0x1b6fbd(_0x5594d8['result'][_0x04bb('0x14')]);}})[_0x04bb('0x16')](function(_0xc000c6){logger['error']('ContactItemType,\x20%s,\x20%s',_0x3b8695,_0xc000c6);_0x2f35cc(_0xc000c6);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 24822a1..2fbf677 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 _0xa246=['multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','index','/:id','isAuthenticated','show','put','delete','destroy','exports'];(function(_0x1dd0c7,_0x55762f){var _0x103446=function(_0x1edba5){while(--_0x1edba5){_0x1dd0c7['push'](_0x1dd0c7['shift']());}};_0x103446(++_0x55762f);}(_0xa246,0xbb));var _0x6a24=function(_0x39917a,_0x2af014){_0x39917a=_0x39917a-0x0;var _0x230421=_0xa246[_0x39917a];return _0x230421;};'use strict';var multer=require(_0x6a24('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6a24('0x1'));var express=require(_0x6a24('0x2'));var router=express['Router']();var fs_extra=require(_0x6a24('0x3'));var auth=require(_0x6a24('0x4'));var interaction=require(_0x6a24('0x5'));var config=require(_0x6a24('0x6'));var controller=require(_0x6a24('0x7'));router[_0x6a24('0x8')]('/',auth['isAuthenticated'](),controller[_0x6a24('0x9')]);router[_0x6a24('0x8')](_0x6a24('0xa'),auth[_0x6a24('0xb')](),controller[_0x6a24('0xc')]);router['post']('/',auth[_0x6a24('0xb')](),controller['create']);router[_0x6a24('0xd')](_0x6a24('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x6a24('0xe')](_0x6a24('0xa'),auth[_0x6a24('0xb')](),controller[_0x6a24('0xf')]);module[_0x6a24('0x10')]=router; \ No newline at end of file +var _0xad78=['fs-extra','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x1fcaf1,_0x21c3c2){var _0x55f464=function(_0x348eb3){while(--_0x348eb3){_0x1fcaf1['push'](_0x1fcaf1['shift']());}};_0x55f464(++_0x21c3c2);}(_0xad78,0x1ee));var _0x8ad7=function(_0x17efc5,_0x1620bf){_0x17efc5=_0x17efc5-0x0;var _0x5cb844=_0xad78[_0x17efc5];return _0x5cb844;};'use strict';var multer=require(_0x8ad7('0x0'));var util=require(_0x8ad7('0x1'));var path=require(_0x8ad7('0x2'));var timeout=require(_0x8ad7('0x3'));var express=require(_0x8ad7('0x4'));var router=express[_0x8ad7('0x5')]();var fs_extra=require(_0x8ad7('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8ad7('0x7'));var config=require(_0x8ad7('0x8'));var controller=require(_0x8ad7('0x9'));router[_0x8ad7('0xa')]('/',auth[_0x8ad7('0xb')](),controller[_0x8ad7('0xc')]);router[_0x8ad7('0xa')](_0x8ad7('0xd'),auth[_0x8ad7('0xb')](),controller['show']);router[_0x8ad7('0xe')]('/',auth['isAuthenticated'](),controller[_0x8ad7('0xf')]);router[_0x8ad7('0x10')](_0x8ad7('0xd'),auth[_0x8ad7('0xb')](),controller[_0x8ad7('0x11')]);router[_0x8ad7('0x12')](_0x8ad7('0xd'),auth[_0x8ad7('0xb')](),controller['destroy']);module[_0x8ad7('0x13')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index ba7e7d2..9a3a3c2 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 _0x0713=['STRING','name'];(function(_0x295727,_0x135c70){var _0xcda60=function(_0x593e87){while(--_0x593e87){_0x295727['push'](_0x295727['shift']());}};_0xcda60(++_0x135c70);}(_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 +var _0x0713=['STRING','name'];(function(_0x54aeb5,_0x1aa3c4){var _0xd30904=function(_0x5f4048){while(--_0x5f4048){_0x54aeb5['push'](_0x54aeb5['shift']());}};_0xd30904(++_0x1aa3c4);}(_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 074f637..a105f30 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 _0xf247=['include','findAll','rows','catch','show','params','rawAttributes','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','user','role','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrWhatsappAccounts','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','./dashboard.socket','sendStatus','status','end','json','offset','limit','count','set','Content-Range','save','update','destroy','get','CustomDashboards','UserProfileResource','then','error','stack','name','send','map','Dashboard','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','options','includeAll'];(function(_0x225cac,_0x5ee6d7){var _0x218772=function(_0xb365bb){while(--_0xb365bb){_0x225cac['push'](_0x225cac['shift']());}};_0x218772(++_0x5ee6d7);}(_0xf247,0x1c4));var _0x7f24=function(_0x644560,_0x1783aa){_0x644560=_0x644560-0x0;var _0x41b76b=_0xf247[_0x644560];return _0x41b76b;};'use strict';var emlformat=require(_0x7f24('0x0'));var rimraf=require(_0x7f24('0x1'));var zipdir=require(_0x7f24('0x2'));var jsonpatch=require(_0x7f24('0x3'));var rp=require(_0x7f24('0x4'));var moment=require(_0x7f24('0x5'));var BPromise=require(_0x7f24('0x6'));var Mustache=require(_0x7f24('0x7'));var util=require(_0x7f24('0x8'));var path=require(_0x7f24('0x9'));var sox=require(_0x7f24('0xa'));var csv=require(_0x7f24('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7f24('0xc'));var squel=require(_0x7f24('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7f24('0xb'));var querystring=require(_0x7f24('0xe'));var Papa=require('papaparse');var Redis=require(_0x7f24('0xf'));var authService=require(_0x7f24('0x10'));var qs=require(_0x7f24('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7f24('0x12'));var logger=require(_0x7f24('0x13'))(_0x7f24('0x14'));var utils=require(_0x7f24('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7f24('0x16'))['db'];config[_0x7f24('0x17')]=_[_0x7f24('0x18')](config[_0x7f24('0x17')],{'host':_0x7f24('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7f24('0x17')]));require(_0x7f24('0x1a'))['register'](socket);function respondWithStatusCode(_0x1add1c,_0x322c5e){_0x322c5e=_0x322c5e||0xcc;return function(_0x1098c5){if(_0x1098c5){return _0x1add1c[_0x7f24('0x1b')](_0x322c5e);}return _0x1add1c[_0x7f24('0x1c')](_0x322c5e)[_0x7f24('0x1d')]();};}function respondWithResult(_0x412522,_0x373102){_0x373102=_0x373102||0xc8;return function(_0x1eb731){if(_0x1eb731){return _0x412522[_0x7f24('0x1c')](_0x373102)[_0x7f24('0x1e')](_0x1eb731);}};}function respondWithFilteredResult(_0x7e45c6,_0x53d45a){return function(_0x543703){if(_0x543703){var _0x31d7c0=typeof _0x53d45a[_0x7f24('0x1f')]==='undefined'&&typeof _0x53d45a[_0x7f24('0x20')]==='undefined';var _0x55911d=_0x543703[_0x7f24('0x21')];var _0x542fd7=_0x31d7c0?0x0:_0x53d45a[_0x7f24('0x1f')];var _0xf890ec=_0x31d7c0?_0x543703[_0x7f24('0x21')]:_0x53d45a[_0x7f24('0x1f')]+_0x53d45a[_0x7f24('0x20')];var _0x3bb8e1;if(_0xf890ec>=_0x55911d){_0xf890ec=_0x55911d;_0x3bb8e1=0xc8;}else{_0x3bb8e1=0xce;}_0x7e45c6['status'](_0x3bb8e1);return _0x7e45c6[_0x7f24('0x22')](_0x7f24('0x23'),_0x542fd7+'-'+_0xf890ec+'/'+_0x55911d)['json'](_0x543703);}return null;};}function patchUpdates(_0x25cb06){return function(_0xadee7f){try{jsonpatch['apply'](_0xadee7f,_0x25cb06,!![]);}catch(_0x2d8e27){return BPromise['reject'](_0x2d8e27);}return _0xadee7f[_0x7f24('0x24')]();};}function saveUpdates(_0xd8e672,_0x5248cd){return function(_0x4c117f){if(_0x4c117f){return _0x4c117f[_0x7f24('0x25')](_0xd8e672)['then'](function(_0x17d80e){return _0x17d80e;});}return null;};}function removeEntity(_0x263e92,_0x54e3a3){return function(_0x147a8d){if(_0x147a8d){return _0x147a8d[_0x7f24('0x26')]()['then'](function(){var _0x18da52=_0x147a8d[_0x7f24('0x27')]({'plain':!![]});var _0x16310d=_0x7f24('0x28');return db[_0x7f24('0x29')]['destroy']({'where':{'type':_0x16310d,'resourceId':_0x18da52['id']}})[_0x7f24('0x2a')](function(){return _0x147a8d;});})['then'](function(){_0x263e92[_0x7f24('0x1c')](0xcc)[_0x7f24('0x1d')]();});}};}function handleEntityNotFound(_0x4fe7e5,_0x148823){return function(_0x13f578){if(!_0x13f578){_0x4fe7e5[_0x7f24('0x1b')](0x194);}return _0x13f578;};}function handleError(_0x14cdea,_0x1d1fa3){_0x1d1fa3=_0x1d1fa3||0x1f4;return function(_0x5f4e6e){logger[_0x7f24('0x2b')](_0x5f4e6e[_0x7f24('0x2c')]);if(_0x5f4e6e[_0x7f24('0x2d')]){delete _0x5f4e6e[_0x7f24('0x2d')];}_0x14cdea['status'](_0x1d1fa3)[_0x7f24('0x2e')](_0x5f4e6e);};}exports['index']=function(_0x2e08d1,_0x50d7f7){var _0x31d21c={},_0x2b5281={},_0x542953={'count':0x0,'rows':[]};var _0x3badfe=_[_0x7f24('0x2f')](db[_0x7f24('0x30')]['rawAttributes'],function(_0x372e6a){return{'name':_0x372e6a[_0x7f24('0x31')],'type':_0x372e6a['type']['key']};});_0x2b5281[_0x7f24('0x32')]=_['map'](_0x3badfe,'name');_0x2b5281[_0x7f24('0x33')]=_[_0x7f24('0x34')](_0x2e08d1[_0x7f24('0x33')]);_0x2b5281[_0x7f24('0x35')]=_[_0x7f24('0x36')](_0x2b5281[_0x7f24('0x32')],_0x2b5281[_0x7f24('0x33')]);_0x31d21c['attributes']=_[_0x7f24('0x36')](_0x2b5281['model'],qs[_0x7f24('0x37')](_0x2e08d1[_0x7f24('0x33')][_0x7f24('0x37')]));_0x31d21c[_0x7f24('0x38')]=_0x31d21c[_0x7f24('0x38')][_0x7f24('0x39')]?_0x31d21c[_0x7f24('0x38')]:_0x2b5281[_0x7f24('0x32')];if(!_0x2e08d1[_0x7f24('0x33')][_0x7f24('0x3a')](_0x7f24('0x3b'))){_0x31d21c['limit']=qs[_0x7f24('0x20')](_0x2e08d1[_0x7f24('0x33')][_0x7f24('0x20')]);_0x31d21c[_0x7f24('0x1f')]=qs['offset'](_0x2e08d1[_0x7f24('0x33')][_0x7f24('0x1f')]);}_0x31d21c[_0x7f24('0x3c')]=qs[_0x7f24('0x3d')](_0x2e08d1[_0x7f24('0x33')]['sort']);_0x31d21c[_0x7f24('0x3e')]=qs['filters'](_['pick'](_0x2e08d1['query'],_0x2b5281[_0x7f24('0x35')]),_0x3badfe);if(_0x2e08d1[_0x7f24('0x33')][_0x7f24('0x3f')]){_0x31d21c[_0x7f24('0x3e')]=_[_0x7f24('0x40')](_0x31d21c[_0x7f24('0x3e')],{'$or':_['map'](_0x3badfe,function(_0x54aea5){if(_0x54aea5[_0x7f24('0x41')]!=='VIRTUAL'){var _0x3539fb={};_0x3539fb[_0x54aea5[_0x7f24('0x2d')]]={'$like':'%'+_0x2e08d1[_0x7f24('0x33')][_0x7f24('0x3f')]+'%'};return _0x3539fb;}})});}_0x31d21c=_[_0x7f24('0x40')]({},_0x31d21c,_0x2e08d1[_0x7f24('0x42')]);var _0x354e47={'where':_0x31d21c[_0x7f24('0x3e')]};return db['Dashboard'][_0x7f24('0x21')](_0x354e47)['then'](function(_0x2409d4){_0x542953['count']=_0x2409d4;if(_0x2e08d1[_0x7f24('0x33')][_0x7f24('0x43')]){_0x31d21c[_0x7f24('0x44')]=[{'all':!![]}];}return db[_0x7f24('0x30')][_0x7f24('0x45')](_0x31d21c);})['then'](function(_0x370b55){_0x542953[_0x7f24('0x46')]=_0x370b55;return _0x542953;})[_0x7f24('0x2a')](respondWithFilteredResult(_0x50d7f7,_0x31d21c))[_0x7f24('0x47')](handleError(_0x50d7f7,null));};exports[_0x7f24('0x48')]=function(_0x5cd188,_0x55559c){var _0x458d94={'raw':![],'where':{'id':_0x5cd188[_0x7f24('0x49')]['id']}},_0x5982ec={};_0x5982ec['model']=_['keys'](db[_0x7f24('0x30')][_0x7f24('0x4a')]);_0x5982ec['query']=_[_0x7f24('0x34')](_0x5cd188[_0x7f24('0x33')]);_0x5982ec[_0x7f24('0x35')]=_[_0x7f24('0x36')](_0x5982ec['model'],_0x5982ec[_0x7f24('0x33')]);_0x458d94[_0x7f24('0x38')]=_[_0x7f24('0x36')](_0x5982ec[_0x7f24('0x32')],qs[_0x7f24('0x37')](_0x5cd188[_0x7f24('0x33')][_0x7f24('0x37')]));_0x458d94['attributes']=_0x458d94[_0x7f24('0x38')][_0x7f24('0x39')]?_0x458d94[_0x7f24('0x38')]:_0x5982ec[_0x7f24('0x32')];if(_0x5cd188[_0x7f24('0x33')]['includeAll']){_0x458d94['include']=[{'all':!![]}];}_0x458d94=_[_0x7f24('0x40')]({},_0x458d94,_0x5cd188['options']);return db[_0x7f24('0x30')][_0x7f24('0x4b')](_0x458d94)[_0x7f24('0x2a')](handleEntityNotFound(_0x55559c,null))[_0x7f24('0x2a')](respondWithResult(_0x55559c,null))[_0x7f24('0x47')](handleError(_0x55559c,null));};exports[_0x7f24('0x4c')]=function(_0x467300,_0x3b94f3){return db[_0x7f24('0x30')][_0x7f24('0x4c')](_0x467300['body'],{})[_0x7f24('0x2a')](function(_0x4ce658){var _0x57cd24=_0x467300['user'][_0x7f24('0x27')]({'plain':!![]});if(!_0x57cd24)throw new Error(_0x7f24('0x4d'));if(_0x57cd24['role']==='user'){var _0x201e08=_0x4ce658['get']({'plain':!![]});var _0x2340b4=_0x7f24('0x28');return db[_0x7f24('0x4e')][_0x7f24('0x4b')]({'where':{'name':_0x2340b4,'userProfileId':_0x57cd24[_0x7f24('0x4f')]},'raw':!![]})[_0x7f24('0x2a')](function(_0x8ed652){if(_0x8ed652&&_0x8ed652[_0x7f24('0x50')]===0x0){return db[_0x7f24('0x29')][_0x7f24('0x4c')]({'name':_0x201e08['name'],'resourceId':_0x201e08['id'],'type':_0x8ed652[_0x7f24('0x2d')],'sectionId':_0x8ed652['id']},{})['then'](function(){return _0x4ce658;});}else{return _0x4ce658;}})[_0x7f24('0x47')](function(_0x3fb2b0){logger[_0x7f24('0x2b')](_0x7f24('0x51'),_0x3fb2b0);throw _0x3fb2b0;});}return _0x4ce658;})[_0x7f24('0x2a')](respondWithResult(_0x3b94f3,0xc9))['catch'](handleError(_0x3b94f3,null));};exports[_0x7f24('0x52')]=function(_0x39cc1c,_0x4cd73c){var _0x23d8f0={'where':{'id':_0x39cc1c[_0x7f24('0x49')]['id']}},_0x5eb2da={};_0x5eb2da['model']=_[_0x7f24('0x34')](db[_0x7f24('0x30')][_0x7f24('0x4a')]);_0x23d8f0['attributes']=_['intersection'](_0x5eb2da[_0x7f24('0x32')],qs[_0x7f24('0x37')](_0x39cc1c[_0x7f24('0x33')][_0x7f24('0x37')]));_0x23d8f0[_0x7f24('0x38')]=_0x23d8f0[_0x7f24('0x38')][_0x7f24('0x39')]?_0x23d8f0['attributes']:_0x5eb2da[_0x7f24('0x32')];if(_0x39cc1c['query'][_0x7f24('0x43')]){_0x23d8f0[_0x7f24('0x44')]=[{'all':!![]}];}_0x23d8f0=_['merge']({},_0x23d8f0,_0x39cc1c[_0x7f24('0x42')]);return db[_0x7f24('0x30')][_0x7f24('0x4b')](_0x23d8f0)[_0x7f24('0x2a')](handleEntityNotFound(_0x4cd73c,null))[_0x7f24('0x2a')](function(_0x2c440b){if(_0x2c440b){var _0x361c42=_0x2c440b[_0x7f24('0x27')]({'plain':!![]});_0x361c42=qs[_0x7f24('0x53')](_0x361c42,['id',_0x7f24('0x54'),_0x7f24('0x55')]);_0x39cc1c[_0x7f24('0x56')]=_[_0x7f24('0x53')](_0x39cc1c['body'],['id',_0x7f24('0x54'),_0x7f24('0x55')]);return db[_0x7f24('0x30')][_0x7f24('0x4c')](_['merge'](_0x361c42,_0x39cc1c[_0x7f24('0x56')]),{'include':_0x39cc1c[_0x7f24('0x33')][_0x7f24('0x43')]?[{'all':!![]}]:undefined})[_0x7f24('0x2a')](function(_0x9a83c9){var _0x3a5ebf=_0x39cc1c[_0x7f24('0x57')][_0x7f24('0x27')]({'plain':!![]});if(!_0x3a5ebf)throw new Error(_0x7f24('0x4d'));if(_0x3a5ebf[_0x7f24('0x58')]===_0x7f24('0x57')){var _0x128264=_0x9a83c9[_0x7f24('0x27')]({'plain':!![]});var _0x1e38ae=_0x7f24('0x28');return db['UserProfileSection'][_0x7f24('0x4b')]({'where':{'name':_0x1e38ae,'userProfileId':_0x3a5ebf[_0x7f24('0x4f')]},'raw':!![]})['then'](function(_0x23d1f3){if(_0x23d1f3&&_0x23d1f3[_0x7f24('0x50')]===0x0){return db['UserProfileResource'][_0x7f24('0x4c')]({'name':_0x128264[_0x7f24('0x2d')],'resourceId':_0x128264['id'],'type':_0x23d1f3[_0x7f24('0x2d')],'sectionId':_0x23d1f3['id']},{})[_0x7f24('0x2a')](function(){return _0x9a83c9;});}else{return _0x9a83c9;}})['catch'](function(_0x209e75){logger[_0x7f24('0x2b')](_0x7f24('0x51'),_0x209e75);throw _0x209e75;});}return _0x9a83c9;});}})[_0x7f24('0x2a')](respondWithResult(_0x4cd73c,0xc9))['catch'](handleError(_0x4cd73c,null));};exports[_0x7f24('0x25')]=function(_0x1427aa,_0x1fccf4){if(_0x1427aa['body']['id']){delete _0x1427aa[_0x7f24('0x56')]['id'];}return db[_0x7f24('0x30')][_0x7f24('0x4b')]({'where':{'id':_0x1427aa[_0x7f24('0x49')]['id']}})[_0x7f24('0x2a')](handleEntityNotFound(_0x1fccf4,null))[_0x7f24('0x2a')](saveUpdates(_0x1427aa[_0x7f24('0x56')],null))[_0x7f24('0x2a')](respondWithResult(_0x1fccf4,null))['catch'](handleError(_0x1fccf4,null));};exports[_0x7f24('0x26')]=function(_0x362ba9,_0x2864c4){return db[_0x7f24('0x30')][_0x7f24('0x4b')]({'where':{'id':_0x362ba9[_0x7f24('0x49')]['id']}})[_0x7f24('0x2a')](handleEntityNotFound(_0x2864c4,null))[_0x7f24('0x2a')](removeEntity(_0x2864c4,null))[_0x7f24('0x47')](handleError(_0x2864c4,null));};function widgetAttributes(_0x472cb4){try{switch(_0x472cb4[_0x7f24('0x41')]){case'iframe':return[{'name':_0x7f24('0x59'),'value':_0x472cb4[_0x7f24('0x59')]||(_0x472cb4[_0x7f24('0x5a')]&&_0x472cb4[_0x7f24('0x5a')][0x0]?_0x472cb4[_0x7f24('0x5a')][0x0][_0x7f24('0x5b')]:undefined)||_0x7f24('0x5c')}];case _0x7f24('0x5d'):return[{'name':_0x7f24('0x5e'),'value':_0x472cb4[_0x7f24('0x5e')]||(_0x472cb4[_0x7f24('0x5a')]&&_0x472cb4[_0x7f24('0x5a')][0x0]?_0x472cb4[_0x7f24('0x5a')][0x0][_0x7f24('0x5b')]:undefined)||''}];case _0x7f24('0x5f'):return[{'name':'attrHourFormat','value':_0x472cb4[_0x7f24('0x60')]||(_0x472cb4['attrs']&&_0x472cb4[_0x7f24('0x5a')][0x0]?_0x472cb4['attrs'][0x0][_0x7f24('0x5b')]:undefined)||_0x7f24('0x61')},{'name':'attrTimezone','value':_0x472cb4[_0x7f24('0x62')]||(_0x472cb4[_0x7f24('0x5a')]&&_0x472cb4[_0x7f24('0x5a')][0x1]?_0x472cb4[_0x7f24('0x5a')][0x1][_0x7f24('0x5b')]:undefined)||_0x7f24('0x63')},{'name':_0x7f24('0x64'),'value':_0x472cb4[_0x7f24('0x64')]||(_0x472cb4[_0x7f24('0x5a')]&&_0x472cb4[_0x7f24('0x5a')][0x2]?_0x472cb4[_0x7f24('0x5a')][0x2]['value']:undefined)||0xc}];case _0x7f24('0x65'):return[{'name':'attrMetric','value':_0x472cb4[_0x7f24('0x66')]||(_0x472cb4[_0x7f24('0x5a')]&&_0x472cb4[_0x7f24('0x5a')][0x0]?_0x472cb4[_0x7f24('0x5a')][0x0][_0x7f24('0x5b')]:undefined)||_0x7f24('0x67')},{'name':_0x7f24('0x68'),'value':_0x472cb4['attrVoiceQueues']||(_0x472cb4[_0x7f24('0x5a')]&&_0x472cb4['attrs'][0x1]?_0x472cb4[_0x7f24('0x5a')][0x1][_0x7f24('0x5b')]:undefined)||[]},{'name':_0x7f24('0x64'),'value':_0x472cb4['attrFontSize']||(_0x472cb4[_0x7f24('0x5a')]&&_0x472cb4['attrs'][0x2]?_0x472cb4[_0x7f24('0x5a')][0x2][_0x7f24('0x5b')]:undefined)||0x14},{'name':_0x7f24('0x69'),'value':_0x472cb4[_0x7f24('0x69')]||(_0x472cb4['attrs']&&_0x472cb4['attrs'][0x3]?_0x472cb4['attrs'][0x3][_0x7f24('0x5b')]:undefined)||_0x7f24('0x6a')},{'name':_0x7f24('0x6b'),'value':_0x472cb4[_0x7f24('0x6b')]||(_0x472cb4[_0x7f24('0x5a')]&&_0x472cb4['attrs'][0x4]?_0x472cb4[_0x7f24('0x5a')][0x4][_0x7f24('0x5b')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x472cb4[_0x7f24('0x6c')]||(_0x472cb4[_0x7f24('0x5a')]&&_0x472cb4[_0x7f24('0x5a')][0x5]?_0x472cb4[_0x7f24('0x5a')][0x5][_0x7f24('0x5b')]:undefined)||''},{'name':_0x7f24('0x6d'),'value':_0x472cb4[_0x7f24('0x6d')]||(_0x472cb4['attrs']&&_0x472cb4[_0x7f24('0x5a')][0x6]?_0x472cb4['attrs'][0x6][_0x7f24('0x5b')]:undefined)||''},{'name':_0x7f24('0x6e'),'value':_0x472cb4[_0x7f24('0x6e')]||(_0x472cb4[_0x7f24('0x5a')]&&_0x472cb4[_0x7f24('0x5a')][0x7]?_0x472cb4[_0x7f24('0x5a')][0x7][_0x7f24('0x5b')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x472cb4['attrWhatsappAccounts']||(_0x472cb4[_0x7f24('0x5a')]&&_0x472cb4[_0x7f24('0x5a')][0x8]?_0x472cb4['attrs'][0x8][_0x7f24('0x5b')]:undefined)||''},{'name':'attrChatWebsites','value':_0x472cb4[_0x7f24('0x6f')]||(_0x472cb4[_0x7f24('0x5a')]&&_0x472cb4[_0x7f24('0x5a')][0x9]?_0x472cb4[_0x7f24('0x5a')][0x9]['value']:undefined)||''}];case _0x7f24('0x70'):case _0x7f24('0x71'):return[{'name':_0x7f24('0x72'),'value':_0x472cb4[_0x7f24('0x72')]||(_0x472cb4['attrs']&&_0x472cb4[_0x7f24('0x5a')][0x0]?_0x472cb4['attrs'][0x0]['value']:undefined)||'total'},{'name':'attrSerie2','value':_0x472cb4[_0x7f24('0x73')]||(_0x472cb4[_0x7f24('0x5a')]&&_0x472cb4[_0x7f24('0x5a')][0x1]?_0x472cb4['attrs'][0x1][_0x7f24('0x5b')]:undefined)||null},{'name':'attrSerie3','value':_0x472cb4[_0x7f24('0x74')]||(_0x472cb4['attrs']&&_0x472cb4['attrs'][0x2]?_0x472cb4[_0x7f24('0x5a')][0x2]['value']:undefined)||null},{'name':_0x7f24('0x68'),'value':_0x472cb4[_0x7f24('0x68')]||(_0x472cb4[_0x7f24('0x5a')]&&_0x472cb4[_0x7f24('0x5a')][0x3]?_0x472cb4[_0x7f24('0x5a')][0x3][_0x7f24('0x5b')]:undefined)||[]},{'name':'attrChannel','value':_0x472cb4[_0x7f24('0x69')]||(_0x472cb4['attrs']&&_0x472cb4[_0x7f24('0x5a')][0x4]?_0x472cb4[_0x7f24('0x5a')][0x4][_0x7f24('0x5b')]:undefined)||_0x7f24('0x6a')},{'name':_0x7f24('0x6b'),'value':_0x472cb4['attrEmailAccounts']||(_0x472cb4[_0x7f24('0x5a')]&&_0x472cb4[_0x7f24('0x5a')][0x5]?_0x472cb4[_0x7f24('0x5a')][0x5][_0x7f24('0x5b')]:undefined)||''},{'name':_0x7f24('0x6c'),'value':_0x472cb4[_0x7f24('0x6c')]||(_0x472cb4[_0x7f24('0x5a')]&&_0x472cb4[_0x7f24('0x5a')][0x6]?_0x472cb4['attrs'][0x6][_0x7f24('0x5b')]:undefined)||''},{'name':_0x7f24('0x6d'),'value':_0x472cb4['attrSmsAccounts']||(_0x472cb4[_0x7f24('0x5a')]&&_0x472cb4['attrs'][0x7]?_0x472cb4[_0x7f24('0x5a')][0x7]['value']:undefined)||''},{'name':_0x7f24('0x6e'),'value':_0x472cb4['attrOpenchannelAccounts']||(_0x472cb4[_0x7f24('0x5a')]&&_0x472cb4[_0x7f24('0x5a')][0x8]?_0x472cb4[_0x7f24('0x5a')][0x8][_0x7f24('0x5b')]:undefined)||''},{'name':_0x7f24('0x75'),'value':_0x472cb4['attrWhatsappAccounts']||(_0x472cb4[_0x7f24('0x5a')]&&_0x472cb4['attrs'][0x9]?_0x472cb4['attrs'][0x9]['value']:undefined)||''},{'name':_0x7f24('0x6f'),'value':_0x472cb4[_0x7f24('0x6f')]||(_0x472cb4[_0x7f24('0x5a')]&&_0x472cb4[_0x7f24('0x5a')][0xa]?_0x472cb4[_0x7f24('0x5a')][0xa][_0x7f24('0x5b')]:undefined)||''}];case _0x7f24('0x76'):return[{'name':_0x7f24('0x77'),'type':_0x472cb4[_0x7f24('0x78')]||(_0x472cb4[_0x7f24('0x5a')]&&_0x472cb4[_0x7f24('0x5a')][0x0]?_0x472cb4[_0x7f24('0x5a')][0x0][_0x7f24('0x41')]:undefined)||null,'value':_0x472cb4[_0x7f24('0x77')]||(_0x472cb4[_0x7f24('0x5a')]&&_0x472cb4['attrs'][0x0]?_0x472cb4['attrs'][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x472cb4[_0x7f24('0x79')]||(_0x472cb4[_0x7f24('0x5a')]&&_0x472cb4[_0x7f24('0x5a')][0x1]?_0x472cb4['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x312cd8){logger[_0x7f24('0x2b')](_0x7f24('0x7a'),JSON[_0x7f24('0x7b')](_0x312cd8));return[];}}exports[_0x7f24('0x7c')]=function(_0x21e945,_0x48f33f,_0x3d1de6){if(_0x21e945['body']['id']){delete _0x21e945[_0x7f24('0x56')]['id'];}return db[_0x7f24('0x30')]['find']({'where':{'id':_0x21e945['params']['id']}})[_0x7f24('0x2a')](handleEntityNotFound(_0x48f33f,null))['then'](function(_0x4cf596){if(_0x4cf596){_0x21e945[_0x7f24('0x56')][_0x7f24('0x7d')]=_0x4cf596['id'];_0x21e945[_0x7f24('0x56')][_0x7f24('0x5a')]=widgetAttributes(_0x21e945['body']);return db[_0x7f24('0x7e')][_0x7f24('0x4c')](_0x21e945[_0x7f24('0x56')]);}})[_0x7f24('0x2a')](respondWithResult(_0x48f33f,null))[_0x7f24('0x47')](handleError(_0x48f33f,null));};exports[_0x7f24('0x7f')]=function(_0x20b0e0,_0x42614c,_0x24f928){var _0x5c523c={};var _0x1d5af6={};var _0x247715;var _0x5472ca;return db[_0x7f24('0x30')][_0x7f24('0x80')]({'where':{'id':_0x20b0e0[_0x7f24('0x49')]['id']}})['then'](handleEntityNotFound(_0x42614c,null))['then'](function(_0x205f79){if(_0x205f79){_0x247715=_0x205f79;_0x1d5af6[_0x7f24('0x32')]=_['keys'](db[_0x7f24('0x7e')][_0x7f24('0x4a')]);_0x1d5af6['query']=_['keys'](_0x20b0e0[_0x7f24('0x33')]);_0x1d5af6[_0x7f24('0x35')]=_[_0x7f24('0x36')](_0x1d5af6[_0x7f24('0x32')],_0x1d5af6['query']);_0x5c523c[_0x7f24('0x38')]=_[_0x7f24('0x36')](_0x1d5af6['model'],qs[_0x7f24('0x37')](_0x20b0e0[_0x7f24('0x33')][_0x7f24('0x37')]));_0x5c523c[_0x7f24('0x38')]=_0x5c523c[_0x7f24('0x38')][_0x7f24('0x39')]?_0x5c523c[_0x7f24('0x38')]:_0x1d5af6['model'];_0x5c523c['order']=qs[_0x7f24('0x3d')](_0x20b0e0['query'][_0x7f24('0x3d')]);_0x5c523c[_0x7f24('0x3e')]=qs['filters'](_[_0x7f24('0x81')](_0x20b0e0['query'],_0x1d5af6[_0x7f24('0x35')]));if(_0x20b0e0[_0x7f24('0x33')][_0x7f24('0x3f')]){_0x5c523c[_0x7f24('0x3e')]=_[_0x7f24('0x40')](_0x5c523c['where'],{'$or':_['map'](_0x5c523c[_0x7f24('0x38')],function(_0x44eedb){var _0xda7749={};_0xda7749[_0x44eedb]={'$like':'%'+_0x20b0e0[_0x7f24('0x33')]['filter']+'%'};return _0xda7749;})});}_0x5c523c=_[_0x7f24('0x40')]({},_0x5c523c,_0x20b0e0['options']);return _0x247715['getItems'](_0x5c523c);}})[_0x7f24('0x2a')](function(_0xb18ae7){if(_0xb18ae7){_0x5472ca=_0xb18ae7[_0x7f24('0x39')];if(!_0x20b0e0[_0x7f24('0x33')][_0x7f24('0x3a')](_0x7f24('0x3b'))){_0x5c523c[_0x7f24('0x20')]=qs[_0x7f24('0x20')](_0x20b0e0[_0x7f24('0x33')][_0x7f24('0x20')]);_0x5c523c['offset']=qs[_0x7f24('0x1f')](_0x20b0e0[_0x7f24('0x33')][_0x7f24('0x1f')]);}return _0x247715['getItems'](_0x5c523c);}})[_0x7f24('0x2a')](function(_0x5e4161){if(_0x5e4161){return _0x5e4161?{'count':_0x5472ca,'rows':_0x5e4161}:null;}})[_0x7f24('0x2a')](respondWithResult(_0x42614c,null))[_0x7f24('0x47')](handleError(_0x42614c,null));}; \ No newline at end of file +var _0x6d24=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','update','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','DashboardId','DashboardItem','getItems','findOne','nolimit','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','get','CustomDashboards','destroy','then','error','stack','name','send','map','Dashboard','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','options','include','findAll','catch','show','includeAll','body','user'];(function(_0x468dac,_0x1ffdb3){var _0x62391=function(_0x4adf43){while(--_0x4adf43){_0x468dac['push'](_0x468dac['shift']());}};_0x62391(++_0x1ffdb3);}(_0x6d24,0x141));var _0x46d2=function(_0x40c043,_0x15ca6f){_0x40c043=_0x40c043-0x0;var _0x193fdb=_0x6d24[_0x40c043];return _0x193fdb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x46d2('0x0'));var zipdir=require(_0x46d2('0x1'));var jsonpatch=require(_0x46d2('0x2'));var rp=require(_0x46d2('0x3'));var moment=require(_0x46d2('0x4'));var BPromise=require(_0x46d2('0x5'));var Mustache=require(_0x46d2('0x6'));var util=require(_0x46d2('0x7'));var path=require(_0x46d2('0x8'));var sox=require(_0x46d2('0x9'));var csv=require(_0x46d2('0xa'));var ejs=require(_0x46d2('0xb'));var fs=require('fs');var fs_extra=require(_0x46d2('0xc'));var _=require(_0x46d2('0xd'));var squel=require(_0x46d2('0xe'));var crypto=require(_0x46d2('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x46d2('0x10'));var toCsv=require(_0x46d2('0xa'));var querystring=require(_0x46d2('0x11'));var Papa=require(_0x46d2('0x12'));var Redis=require('ioredis');var authService=require(_0x46d2('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x46d2('0x14'));var hardwareService=require(_0x46d2('0x15'));var logger=require(_0x46d2('0x16'))(_0x46d2('0x17'));var utils=require(_0x46d2('0x18'));var config=require(_0x46d2('0x19'));var licenseUtil=require(_0x46d2('0x1a'));var db=require(_0x46d2('0x1b'))['db'];config[_0x46d2('0x1c')]=_['defaults'](config[_0x46d2('0x1c')],{'host':_0x46d2('0x1d'),'port':0x18eb});var socket=require(_0x46d2('0x1e'))(new Redis(config[_0x46d2('0x1c')]));require(_0x46d2('0x1f'))[_0x46d2('0x20')](socket);function respondWithStatusCode(_0x211ab2,_0x9af2a1){_0x9af2a1=_0x9af2a1||0xcc;return function(_0x32d484){if(_0x32d484){return _0x211ab2[_0x46d2('0x21')](_0x9af2a1);}return _0x211ab2['status'](_0x9af2a1)[_0x46d2('0x22')]();};}function respondWithResult(_0x5330cd,_0x5cfea6){_0x5cfea6=_0x5cfea6||0xc8;return function(_0x3b42a2){if(_0x3b42a2){return _0x5330cd[_0x46d2('0x23')](_0x5cfea6)[_0x46d2('0x24')](_0x3b42a2);}};}function respondWithFilteredResult(_0x2a53c1,_0x5b8883){return function(_0x460595){if(_0x460595){var _0x5bebf2=typeof _0x5b8883[_0x46d2('0x25')]==='undefined'&&typeof _0x5b8883[_0x46d2('0x26')]===_0x46d2('0x27');var _0x234885=_0x460595[_0x46d2('0x28')];var _0x1b8a86=_0x5bebf2?0x0:_0x5b8883[_0x46d2('0x25')];var _0x2db8b8=_0x5bebf2?_0x460595[_0x46d2('0x28')]:_0x5b8883[_0x46d2('0x25')]+_0x5b8883[_0x46d2('0x26')];var _0x1d740a;if(_0x2db8b8>=_0x234885){_0x2db8b8=_0x234885;_0x1d740a=0xc8;}else{_0x1d740a=0xce;}_0x2a53c1[_0x46d2('0x23')](_0x1d740a);return _0x2a53c1[_0x46d2('0x29')](_0x46d2('0x2a'),_0x1b8a86+'-'+_0x2db8b8+'/'+_0x234885)[_0x46d2('0x24')](_0x460595);}return null;};}function patchUpdates(_0x1779e5){return function(_0x14a257){try{jsonpatch[_0x46d2('0x2b')](_0x14a257,_0x1779e5,!![]);}catch(_0x413d66){return BPromise[_0x46d2('0x2c')](_0x413d66);}return _0x14a257[_0x46d2('0x2d')]();};}function saveUpdates(_0x23c710,_0x165a34){return function(_0x301b1a){if(_0x301b1a){return _0x301b1a['update'](_0x23c710)['then'](function(_0x35745a){return _0x35745a;});}return null;};}function removeEntity(_0xcd299,_0x27651a){return function(_0x19f305){if(_0x19f305){return _0x19f305['destroy']()['then'](function(){var _0x546d52=_0x19f305[_0x46d2('0x2e')]({'plain':!![]});var _0x5c992=_0x46d2('0x2f');return db['UserProfileResource'][_0x46d2('0x30')]({'where':{'type':_0x5c992,'resourceId':_0x546d52['id']}})[_0x46d2('0x31')](function(){return _0x19f305;});})['then'](function(){_0xcd299[_0x46d2('0x23')](0xcc)[_0x46d2('0x22')]();});}};}function handleEntityNotFound(_0x2322ce,_0x4d4d93){return function(_0x554fbd){if(!_0x554fbd){_0x2322ce[_0x46d2('0x21')](0x194);}return _0x554fbd;};}function handleError(_0x56962d,_0x230419){_0x230419=_0x230419||0x1f4;return function(_0xf9154f){logger[_0x46d2('0x32')](_0xf9154f[_0x46d2('0x33')]);if(_0xf9154f[_0x46d2('0x34')]){delete _0xf9154f[_0x46d2('0x34')];}_0x56962d[_0x46d2('0x23')](_0x230419)[_0x46d2('0x35')](_0xf9154f);};}exports['index']=function(_0x2d1a91,_0x83ca90){var _0x4266e4={},_0x2b117e={},_0x4fdbaf={'count':0x0,'rows':[]};var _0x5196b7=_[_0x46d2('0x36')](db[_0x46d2('0x37')][_0x46d2('0x38')],function(_0x44505b){return{'name':_0x44505b['fieldName'],'type':_0x44505b[_0x46d2('0x39')][_0x46d2('0x3a')]};});_0x2b117e[_0x46d2('0x3b')]=_['map'](_0x5196b7,_0x46d2('0x34'));_0x2b117e['query']=_[_0x46d2('0x3c')](_0x2d1a91[_0x46d2('0x3d')]);_0x2b117e['filters']=_[_0x46d2('0x3e')](_0x2b117e['model'],_0x2b117e['query']);_0x4266e4[_0x46d2('0x3f')]=_['intersection'](_0x2b117e['model'],qs['fields'](_0x2d1a91[_0x46d2('0x3d')][_0x46d2('0x40')]));_0x4266e4[_0x46d2('0x3f')]=_0x4266e4[_0x46d2('0x3f')][_0x46d2('0x41')]?_0x4266e4[_0x46d2('0x3f')]:_0x2b117e[_0x46d2('0x3b')];if(!_0x2d1a91['query'][_0x46d2('0x42')]('nolimit')){_0x4266e4[_0x46d2('0x26')]=qs[_0x46d2('0x26')](_0x2d1a91['query'][_0x46d2('0x26')]);_0x4266e4[_0x46d2('0x25')]=qs[_0x46d2('0x25')](_0x2d1a91[_0x46d2('0x3d')]['offset']);}_0x4266e4[_0x46d2('0x43')]=qs['sort'](_0x2d1a91[_0x46d2('0x3d')][_0x46d2('0x44')]);_0x4266e4[_0x46d2('0x45')]=qs[_0x46d2('0x46')](_[_0x46d2('0x47')](_0x2d1a91['query'],_0x2b117e['filters']),_0x5196b7);if(_0x2d1a91['query']['filter']){_0x4266e4[_0x46d2('0x45')]=_[_0x46d2('0x48')](_0x4266e4[_0x46d2('0x45')],{'$or':_[_0x46d2('0x36')](_0x5196b7,function(_0xa4c7f7){if(_0xa4c7f7['type']!=='VIRTUAL'){var _0x3d2052={};_0x3d2052[_0xa4c7f7[_0x46d2('0x34')]]={'$like':'%'+_0x2d1a91[_0x46d2('0x3d')]['filter']+'%'};return _0x3d2052;}})});}_0x4266e4=_[_0x46d2('0x48')]({},_0x4266e4,_0x2d1a91[_0x46d2('0x49')]);var _0x4a68df={'where':_0x4266e4[_0x46d2('0x45')]};return db['Dashboard'][_0x46d2('0x28')](_0x4a68df)[_0x46d2('0x31')](function(_0x462615){_0x4fdbaf[_0x46d2('0x28')]=_0x462615;if(_0x2d1a91[_0x46d2('0x3d')]['includeAll']){_0x4266e4[_0x46d2('0x4a')]=[{'all':!![]}];}return db[_0x46d2('0x37')][_0x46d2('0x4b')](_0x4266e4);})[_0x46d2('0x31')](function(_0x159d21){_0x4fdbaf['rows']=_0x159d21;return _0x4fdbaf;})['then'](respondWithFilteredResult(_0x83ca90,_0x4266e4))[_0x46d2('0x4c')](handleError(_0x83ca90,null));};exports[_0x46d2('0x4d')]=function(_0x2a8f06,_0xfd3b9a){var _0x5cd585={'raw':![],'where':{'id':_0x2a8f06['params']['id']}},_0x2eb6a9={};_0x2eb6a9[_0x46d2('0x3b')]=_['keys'](db[_0x46d2('0x37')]['rawAttributes']);_0x2eb6a9[_0x46d2('0x3d')]=_[_0x46d2('0x3c')](_0x2a8f06['query']);_0x2eb6a9[_0x46d2('0x46')]=_[_0x46d2('0x3e')](_0x2eb6a9[_0x46d2('0x3b')],_0x2eb6a9['query']);_0x5cd585[_0x46d2('0x3f')]=_[_0x46d2('0x3e')](_0x2eb6a9['model'],qs[_0x46d2('0x40')](_0x2a8f06['query'][_0x46d2('0x40')]));_0x5cd585[_0x46d2('0x3f')]=_0x5cd585['attributes'][_0x46d2('0x41')]?_0x5cd585['attributes']:_0x2eb6a9[_0x46d2('0x3b')];if(_0x2a8f06[_0x46d2('0x3d')][_0x46d2('0x4e')]){_0x5cd585['include']=[{'all':!![]}];}_0x5cd585=_[_0x46d2('0x48')]({},_0x5cd585,_0x2a8f06['options']);return db[_0x46d2('0x37')]['find'](_0x5cd585)[_0x46d2('0x31')](handleEntityNotFound(_0xfd3b9a,null))['then'](respondWithResult(_0xfd3b9a,null))[_0x46d2('0x4c')](handleError(_0xfd3b9a,null));};exports['create']=function(_0x5659c3,_0x4befb7){return db[_0x46d2('0x37')]['create'](_0x5659c3[_0x46d2('0x4f')],{})[_0x46d2('0x31')](function(_0x48addc){var _0x2c6350=_0x5659c3[_0x46d2('0x50')][_0x46d2('0x2e')]({'plain':!![]});if(!_0x2c6350)throw new Error(_0x46d2('0x51'));if(_0x2c6350[_0x46d2('0x52')]===_0x46d2('0x50')){var _0x4a3a2f=_0x48addc[_0x46d2('0x2e')]({'plain':!![]});var _0x3e661e=_0x46d2('0x2f');return db[_0x46d2('0x53')][_0x46d2('0x54')]({'where':{'name':_0x3e661e,'userProfileId':_0x2c6350[_0x46d2('0x55')]},'raw':!![]})[_0x46d2('0x31')](function(_0x1cceb6){if(_0x1cceb6&&_0x1cceb6[_0x46d2('0x56')]===0x0){return db[_0x46d2('0x57')][_0x46d2('0x58')]({'name':_0x4a3a2f['name'],'resourceId':_0x4a3a2f['id'],'type':_0x1cceb6[_0x46d2('0x34')],'sectionId':_0x1cceb6['id']},{})[_0x46d2('0x31')](function(){return _0x48addc;});}else{return _0x48addc;}})['catch'](function(_0x39d86e){logger[_0x46d2('0x32')](_0x46d2('0x59'),_0x39d86e);throw _0x39d86e;});}return _0x48addc;})['then'](respondWithResult(_0x4befb7,0xc9))[_0x46d2('0x4c')](handleError(_0x4befb7,null));};exports[_0x46d2('0x5a')]=function(_0x2dd88,_0x24a803){var _0x5c08c1={'where':{'id':_0x2dd88[_0x46d2('0x5b')]['id']}},_0x4be05e={};_0x4be05e['model']=_[_0x46d2('0x3c')](db[_0x46d2('0x37')][_0x46d2('0x38')]);_0x5c08c1[_0x46d2('0x3f')]=_[_0x46d2('0x3e')](_0x4be05e[_0x46d2('0x3b')],qs['fields'](_0x2dd88[_0x46d2('0x3d')][_0x46d2('0x40')]));_0x5c08c1['attributes']=_0x5c08c1[_0x46d2('0x3f')][_0x46d2('0x41')]?_0x5c08c1[_0x46d2('0x3f')]:_0x4be05e[_0x46d2('0x3b')];if(_0x2dd88[_0x46d2('0x3d')]['includeAll']){_0x5c08c1[_0x46d2('0x4a')]=[{'all':!![]}];}_0x5c08c1=_[_0x46d2('0x48')]({},_0x5c08c1,_0x2dd88['options']);return db['Dashboard'][_0x46d2('0x54')](_0x5c08c1)[_0x46d2('0x31')](handleEntityNotFound(_0x24a803,null))[_0x46d2('0x31')](function(_0x359b42){if(_0x359b42){var _0x205f2a=_0x359b42[_0x46d2('0x2e')]({'plain':!![]});_0x205f2a=qs[_0x46d2('0x5c')](_0x205f2a,['id',_0x46d2('0x5d'),_0x46d2('0x5e')]);_0x2dd88[_0x46d2('0x4f')]=_[_0x46d2('0x5c')](_0x2dd88['body'],['id',_0x46d2('0x5d'),'updatedAt']);return db['Dashboard'][_0x46d2('0x58')](_[_0x46d2('0x48')](_0x205f2a,_0x2dd88[_0x46d2('0x4f')]),{'include':_0x2dd88[_0x46d2('0x3d')][_0x46d2('0x4e')]?[{'all':!![]}]:undefined})['then'](function(_0x4529db){var _0x1a7497=_0x2dd88[_0x46d2('0x50')][_0x46d2('0x2e')]({'plain':!![]});if(!_0x1a7497)throw new Error(_0x46d2('0x51'));if(_0x1a7497[_0x46d2('0x52')]===_0x46d2('0x50')){var _0x387ede=_0x4529db[_0x46d2('0x2e')]({'plain':!![]});var _0x478d7d=_0x46d2('0x2f');return db[_0x46d2('0x53')][_0x46d2('0x54')]({'where':{'name':_0x478d7d,'userProfileId':_0x1a7497[_0x46d2('0x55')]},'raw':!![]})['then'](function(_0x5777f7){if(_0x5777f7&&_0x5777f7[_0x46d2('0x56')]===0x0){return db[_0x46d2('0x57')][_0x46d2('0x58')]({'name':_0x387ede['name'],'resourceId':_0x387ede['id'],'type':_0x5777f7['name'],'sectionId':_0x5777f7['id']},{})[_0x46d2('0x31')](function(){return _0x4529db;});}else{return _0x4529db;}})['catch'](function(_0x755cb6){logger['error'](_0x46d2('0x59'),_0x755cb6);throw _0x755cb6;});}return _0x4529db;});}})[_0x46d2('0x31')](respondWithResult(_0x24a803,0xc9))[_0x46d2('0x4c')](handleError(_0x24a803,null));};exports[_0x46d2('0x5f')]=function(_0x46de9c,_0x264030){if(_0x46de9c['body']['id']){delete _0x46de9c[_0x46d2('0x4f')]['id'];}return db[_0x46d2('0x37')][_0x46d2('0x54')]({'where':{'id':_0x46de9c[_0x46d2('0x5b')]['id']}})[_0x46d2('0x31')](handleEntityNotFound(_0x264030,null))[_0x46d2('0x31')](saveUpdates(_0x46de9c[_0x46d2('0x4f')],null))[_0x46d2('0x31')](respondWithResult(_0x264030,null))['catch'](handleError(_0x264030,null));};exports[_0x46d2('0x30')]=function(_0x1073e9,_0xeb4e07){return db[_0x46d2('0x37')][_0x46d2('0x54')]({'where':{'id':_0x1073e9[_0x46d2('0x5b')]['id']}})['then'](handleEntityNotFound(_0xeb4e07,null))['then'](removeEntity(_0xeb4e07,null))[_0x46d2('0x4c')](handleError(_0xeb4e07,null));};function widgetAttributes(_0x53f7b6){try{switch(_0x53f7b6[_0x46d2('0x39')]){case _0x46d2('0x60'):return[{'name':_0x46d2('0x61'),'value':_0x53f7b6[_0x46d2('0x61')]||(_0x53f7b6[_0x46d2('0x62')]&&_0x53f7b6[_0x46d2('0x62')][0x0]?_0x53f7b6[_0x46d2('0x62')][0x0]['value']:undefined)||_0x46d2('0x63')}];case _0x46d2('0x64'):return[{'name':_0x46d2('0x65'),'value':_0x53f7b6[_0x46d2('0x65')]||(_0x53f7b6[_0x46d2('0x62')]&&_0x53f7b6[_0x46d2('0x62')][0x0]?_0x53f7b6[_0x46d2('0x62')][0x0][_0x46d2('0x66')]:undefined)||''}];case _0x46d2('0x67'):return[{'name':_0x46d2('0x68'),'value':_0x53f7b6[_0x46d2('0x68')]||(_0x53f7b6['attrs']&&_0x53f7b6['attrs'][0x0]?_0x53f7b6['attrs'][0x0][_0x46d2('0x66')]:undefined)||'HH:mm:ss'},{'name':_0x46d2('0x69'),'value':_0x53f7b6[_0x46d2('0x69')]||(_0x53f7b6[_0x46d2('0x62')]&&_0x53f7b6[_0x46d2('0x62')][0x1]?_0x53f7b6[_0x46d2('0x62')][0x1][_0x46d2('0x66')]:undefined)||_0x46d2('0x6a')},{'name':_0x46d2('0x6b'),'value':_0x53f7b6['attrFontSize']||(_0x53f7b6[_0x46d2('0x62')]&&_0x53f7b6[_0x46d2('0x62')][0x2]?_0x53f7b6['attrs'][0x2]['value']:undefined)||0xc}];case _0x46d2('0x6c'):return[{'name':_0x46d2('0x6d'),'value':_0x53f7b6[_0x46d2('0x6d')]||(_0x53f7b6[_0x46d2('0x62')]&&_0x53f7b6[_0x46d2('0x62')][0x0]?_0x53f7b6[_0x46d2('0x62')][0x0][_0x46d2('0x66')]:undefined)||'total'},{'name':_0x46d2('0x6e'),'value':_0x53f7b6['attrVoiceQueues']||(_0x53f7b6['attrs']&&_0x53f7b6[_0x46d2('0x62')][0x1]?_0x53f7b6[_0x46d2('0x62')][0x1][_0x46d2('0x66')]:undefined)||[]},{'name':'attrFontSize','value':_0x53f7b6['attrFontSize']||(_0x53f7b6[_0x46d2('0x62')]&&_0x53f7b6[_0x46d2('0x62')][0x2]?_0x53f7b6[_0x46d2('0x62')][0x2][_0x46d2('0x66')]:undefined)||0x14},{'name':_0x46d2('0x6f'),'value':_0x53f7b6['attrChannel']||(_0x53f7b6[_0x46d2('0x62')]&&_0x53f7b6['attrs'][0x3]?_0x53f7b6[_0x46d2('0x62')][0x3][_0x46d2('0x66')]:undefined)||_0x46d2('0x70')},{'name':_0x46d2('0x71'),'value':_0x53f7b6[_0x46d2('0x71')]||(_0x53f7b6['attrs']&&_0x53f7b6['attrs'][0x4]?_0x53f7b6[_0x46d2('0x62')][0x4][_0x46d2('0x66')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x53f7b6[_0x46d2('0x72')]||(_0x53f7b6[_0x46d2('0x62')]&&_0x53f7b6[_0x46d2('0x62')][0x5]?_0x53f7b6['attrs'][0x5]['value']:undefined)||''},{'name':_0x46d2('0x73'),'value':_0x53f7b6[_0x46d2('0x73')]||(_0x53f7b6['attrs']&&_0x53f7b6[_0x46d2('0x62')][0x6]?_0x53f7b6[_0x46d2('0x62')][0x6][_0x46d2('0x66')]:undefined)||''},{'name':_0x46d2('0x74'),'value':_0x53f7b6[_0x46d2('0x74')]||(_0x53f7b6[_0x46d2('0x62')]&&_0x53f7b6[_0x46d2('0x62')][0x7]?_0x53f7b6[_0x46d2('0x62')][0x7][_0x46d2('0x66')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x53f7b6[_0x46d2('0x75')]||(_0x53f7b6[_0x46d2('0x62')]&&_0x53f7b6[_0x46d2('0x62')][0x8]?_0x53f7b6[_0x46d2('0x62')][0x8][_0x46d2('0x66')]:undefined)||''},{'name':'attrChatWebsites','value':_0x53f7b6[_0x46d2('0x76')]||(_0x53f7b6[_0x46d2('0x62')]&&_0x53f7b6[_0x46d2('0x62')][0x9]?_0x53f7b6[_0x46d2('0x62')][0x9][_0x46d2('0x66')]:undefined)||''}];case'multibar-chart':case _0x46d2('0x77'):return[{'name':_0x46d2('0x78'),'value':_0x53f7b6['attrSerie1']||(_0x53f7b6[_0x46d2('0x62')]&&_0x53f7b6[_0x46d2('0x62')][0x0]?_0x53f7b6['attrs'][0x0][_0x46d2('0x66')]:undefined)||_0x46d2('0x79')},{'name':_0x46d2('0x7a'),'value':_0x53f7b6['attrSerie2']||(_0x53f7b6['attrs']&&_0x53f7b6['attrs'][0x1]?_0x53f7b6['attrs'][0x1]['value']:undefined)||null},{'name':_0x46d2('0x7b'),'value':_0x53f7b6['attrSerie3']||(_0x53f7b6[_0x46d2('0x62')]&&_0x53f7b6['attrs'][0x2]?_0x53f7b6[_0x46d2('0x62')][0x2][_0x46d2('0x66')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x53f7b6[_0x46d2('0x6e')]||(_0x53f7b6[_0x46d2('0x62')]&&_0x53f7b6[_0x46d2('0x62')][0x3]?_0x53f7b6[_0x46d2('0x62')][0x3][_0x46d2('0x66')]:undefined)||[]},{'name':_0x46d2('0x6f'),'value':_0x53f7b6[_0x46d2('0x6f')]||(_0x53f7b6[_0x46d2('0x62')]&&_0x53f7b6[_0x46d2('0x62')][0x4]?_0x53f7b6[_0x46d2('0x62')][0x4][_0x46d2('0x66')]:undefined)||_0x46d2('0x70')},{'name':_0x46d2('0x71'),'value':_0x53f7b6[_0x46d2('0x71')]||(_0x53f7b6[_0x46d2('0x62')]&&_0x53f7b6[_0x46d2('0x62')][0x5]?_0x53f7b6[_0x46d2('0x62')][0x5][_0x46d2('0x66')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x53f7b6[_0x46d2('0x72')]||(_0x53f7b6[_0x46d2('0x62')]&&_0x53f7b6[_0x46d2('0x62')][0x6]?_0x53f7b6[_0x46d2('0x62')][0x6][_0x46d2('0x66')]:undefined)||''},{'name':_0x46d2('0x73'),'value':_0x53f7b6[_0x46d2('0x73')]||(_0x53f7b6[_0x46d2('0x62')]&&_0x53f7b6[_0x46d2('0x62')][0x7]?_0x53f7b6[_0x46d2('0x62')][0x7]['value']:undefined)||''},{'name':_0x46d2('0x74'),'value':_0x53f7b6[_0x46d2('0x74')]||(_0x53f7b6['attrs']&&_0x53f7b6['attrs'][0x8]?_0x53f7b6[_0x46d2('0x62')][0x8][_0x46d2('0x66')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x53f7b6[_0x46d2('0x75')]||(_0x53f7b6['attrs']&&_0x53f7b6[_0x46d2('0x62')][0x9]?_0x53f7b6['attrs'][0x9][_0x46d2('0x66')]:undefined)||''},{'name':'attrChatWebsites','value':_0x53f7b6[_0x46d2('0x76')]||(_0x53f7b6[_0x46d2('0x62')]&&_0x53f7b6[_0x46d2('0x62')][0xa]?_0x53f7b6['attrs'][0xa][_0x46d2('0x66')]:undefined)||''}];case _0x46d2('0x7c'):return[{'name':_0x46d2('0x7d'),'type':_0x53f7b6[_0x46d2('0x7e')]||(_0x53f7b6[_0x46d2('0x62')]&&_0x53f7b6[_0x46d2('0x62')][0x0]?_0x53f7b6[_0x46d2('0x62')][0x0][_0x46d2('0x39')]:undefined)||null,'value':_0x53f7b6['attrReport']||(_0x53f7b6[_0x46d2('0x62')]&&_0x53f7b6['attrs'][0x0]?_0x53f7b6['attrs'][0x0][_0x46d2('0x66')]:undefined)||null},{'name':'attrRefresh','value':_0x53f7b6[_0x46d2('0x7f')]||(_0x53f7b6[_0x46d2('0x62')]&&_0x53f7b6['attrs'][0x1]?_0x53f7b6['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0xfa8e23){logger[_0x46d2('0x32')](_0x46d2('0x80'),JSON['stringify'](_0xfa8e23));return[];}}exports['addItem']=function(_0x29e48e,_0x1ce914,_0xd6dca5){if(_0x29e48e[_0x46d2('0x4f')]['id']){delete _0x29e48e[_0x46d2('0x4f')]['id'];}return db[_0x46d2('0x37')][_0x46d2('0x54')]({'where':{'id':_0x29e48e[_0x46d2('0x5b')]['id']}})[_0x46d2('0x31')](handleEntityNotFound(_0x1ce914,null))[_0x46d2('0x31')](function(_0x4de888){if(_0x4de888){_0x29e48e[_0x46d2('0x4f')][_0x46d2('0x81')]=_0x4de888['id'];_0x29e48e['body'][_0x46d2('0x62')]=widgetAttributes(_0x29e48e[_0x46d2('0x4f')]);return db[_0x46d2('0x82')][_0x46d2('0x58')](_0x29e48e[_0x46d2('0x4f')]);}})['then'](respondWithResult(_0x1ce914,null))[_0x46d2('0x4c')](handleError(_0x1ce914,null));};exports[_0x46d2('0x83')]=function(_0x27a029,_0x2eea0b,_0x2962d8){var _0x1f3560={};var _0x3c213d={};var _0x547a07;var _0x312100;return db[_0x46d2('0x37')][_0x46d2('0x84')]({'where':{'id':_0x27a029[_0x46d2('0x5b')]['id']}})[_0x46d2('0x31')](handleEntityNotFound(_0x2eea0b,null))[_0x46d2('0x31')](function(_0x83ebf3){if(_0x83ebf3){_0x547a07=_0x83ebf3;_0x3c213d['model']=_[_0x46d2('0x3c')](db['DashboardItem'][_0x46d2('0x38')]);_0x3c213d['query']=_['keys'](_0x27a029['query']);_0x3c213d[_0x46d2('0x46')]=_[_0x46d2('0x3e')](_0x3c213d[_0x46d2('0x3b')],_0x3c213d[_0x46d2('0x3d')]);_0x1f3560[_0x46d2('0x3f')]=_[_0x46d2('0x3e')](_0x3c213d[_0x46d2('0x3b')],qs[_0x46d2('0x40')](_0x27a029[_0x46d2('0x3d')]['fields']));_0x1f3560[_0x46d2('0x3f')]=_0x1f3560[_0x46d2('0x3f')][_0x46d2('0x41')]?_0x1f3560[_0x46d2('0x3f')]:_0x3c213d['model'];_0x1f3560[_0x46d2('0x43')]=qs[_0x46d2('0x44')](_0x27a029[_0x46d2('0x3d')]['sort']);_0x1f3560[_0x46d2('0x45')]=qs[_0x46d2('0x46')](_['pick'](_0x27a029[_0x46d2('0x3d')],_0x3c213d[_0x46d2('0x46')]));if(_0x27a029[_0x46d2('0x3d')]['filter']){_0x1f3560[_0x46d2('0x45')]=_['merge'](_0x1f3560[_0x46d2('0x45')],{'$or':_[_0x46d2('0x36')](_0x1f3560[_0x46d2('0x3f')],function(_0x3d7907){var _0x593b49={};_0x593b49[_0x3d7907]={'$like':'%'+_0x27a029[_0x46d2('0x3d')]['filter']+'%'};return _0x593b49;})});}_0x1f3560=_[_0x46d2('0x48')]({},_0x1f3560,_0x27a029[_0x46d2('0x49')]);return _0x547a07['getItems'](_0x1f3560);}})[_0x46d2('0x31')](function(_0x1b7e04){if(_0x1b7e04){_0x312100=_0x1b7e04['length'];if(!_0x27a029['query'][_0x46d2('0x42')](_0x46d2('0x85'))){_0x1f3560[_0x46d2('0x26')]=qs[_0x46d2('0x26')](_0x27a029[_0x46d2('0x3d')][_0x46d2('0x26')]);_0x1f3560[_0x46d2('0x25')]=qs[_0x46d2('0x25')](_0x27a029[_0x46d2('0x3d')]['offset']);}return _0x547a07[_0x46d2('0x83')](_0x1f3560);}})[_0x46d2('0x31')](function(_0x542e89){if(_0x542e89){return _0x542e89?{'count':_0x312100,'rows':_0x542e89}:null;}})['then'](respondWithResult(_0x2eea0b,null))[_0x46d2('0x4c')](handleError(_0x2eea0b,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 35630cc..fa13813 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 _0xb7f0=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Dashboard','setMaxListeners'];(function(_0x5f33e1,_0x368deb){var _0x194e2b=function(_0x36a961){while(--_0x36a961){_0x5f33e1['push'](_0x5f33e1['shift']());}};_0x194e2b(++_0x368deb);}(_0xb7f0,0x1eb));var _0x0b7f=function(_0x566622,_0x399507){_0x566622=_0x566622-0x0;var _0x1851dd=_0xb7f0[_0x566622];return _0x1851dd;};'use strict';var EventEmitter=require(_0x0b7f('0x0'));var Dashboard=require(_0x0b7f('0x1'))['db'][_0x0b7f('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x0b7f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x0b7f('0x4')};function emitEvent(_0xa1285e){return function(_0x228377,_0x188ea8,_0x34e188){DashboardEvents[_0x0b7f('0x5')](_0xa1285e+':'+_0x228377['id'],_0x228377);DashboardEvents[_0x0b7f('0x5')](_0xa1285e,_0x228377);_0x34e188(null);};}for(var e in events){if(events[_0x0b7f('0x6')](e)){var event=events[e];Dashboard[_0x0b7f('0x7')](e,emitEvent(event));}}module[_0x0b7f('0x8')]=DashboardEvents; \ No newline at end of file +var _0xf151=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Dashboard'];(function(_0x36b99c,_0x365e75){var _0x450565=function(_0x2501b7){while(--_0x2501b7){_0x36b99c['push'](_0x36b99c['shift']());}};_0x450565(++_0x365e75);}(_0xf151,0x1aa));var _0x1f15=function(_0xda0838,_0x283c97){_0xda0838=_0xda0838-0x0;var _0x2f8250=_0xf151[_0xda0838];return _0x2f8250;};'use strict';var EventEmitter=require(_0x1f15('0x0'));var Dashboard=require(_0x1f15('0x1'))['db'][_0x1f15('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x1f15('0x3')](0x0);var events={'afterCreate':_0x1f15('0x4'),'afterUpdate':_0x1f15('0x5'),'afterDestroy':_0x1f15('0x6')};function emitEvent(_0xc6d0aa){return function(_0x3c3a74,_0x3cbfd0,_0x5b063e){DashboardEvents[_0x1f15('0x7')](_0xc6d0aa+':'+_0x3c3a74['id'],_0x3c3a74);DashboardEvents['emit'](_0xc6d0aa,_0x3c3a74);_0x5b063e(null);};}for(var e in events){if(events[_0x1f15('0x8')](e)){var event=events[e];Dashboard[_0x1f15('0x9')](e,emitEvent(event));}}module[_0x1f15('0xa')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 2d40555..66e2d7f 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 _0x100c=['lodash','util','../../config/logger','request-promise','../../config/environment','./dashboard.attributes','exports','define','Dashboard'];(function(_0x32fe10,_0x3994da){var _0x949c5c=function(_0x262374){while(--_0x262374){_0x32fe10['push'](_0x32fe10['shift']());}};_0x949c5c(++_0x3994da);}(_0x100c,0x15f));var _0xc100=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x100c[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xc100('0x0'));var util=require(_0xc100('0x1'));var logger=require(_0xc100('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc100('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc100('0x4'));var attributes=require(_0xc100('0x5'));module[_0xc100('0x6')]=function(_0x11b23d,_0x257ab7){return _0x11b23d[_0xc100('0x7')](_0xc100('0x8'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf3d=['Dashboard','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./dashboard.attributes','define'];(function(_0x47a955,_0x57f117){var _0x4ad0b=function(_0x20c754){while(--_0x20c754){_0x47a955['push'](_0x47a955['shift']());}};_0x4ad0b(++_0x57f117);}(_0xaf3d,0x135));var _0xdaf3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaf3d[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xdaf3('0x0'));var util=require(_0xdaf3('0x1'));var logger=require(_0xdaf3('0x2'))(_0xdaf3('0x3'));var moment=require('moment');var BPromise=require(_0xdaf3('0x4'));var rp=require(_0xdaf3('0x5'));var fs=require('fs');var path=require(_0xdaf3('0x6'));var rimraf=require(_0xdaf3('0x7'));var config=require('../../config/environment');var attributes=require(_0xdaf3('0x8'));module['exports']=function(_0x5c7389,_0x468ed2){return _0x5c7389[_0xdaf3('0x9')](_0xdaf3('0xa'),attributes,{'tableName':'dashboards','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 80c7cab..029f0bf 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 _0xcfc6=['./dashboard.socket','register','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost'];(function(_0x38c9bb,_0x59d354){var _0x3a6b5c=function(_0x275be1){while(--_0x275be1){_0x38c9bb['push'](_0x38c9bb['shift']());}};_0x3a6b5c(++_0x59d354);}(_0xcfc6,0x79));var _0x6cfc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcfc6[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6cfc('0x0'));var util=require(_0x6cfc('0x1'));var moment=require('moment');var BPromise=require(_0x6cfc('0x2'));var rs=require(_0x6cfc('0x3'));var fs=require('fs');var Redis=require(_0x6cfc('0x4'));var db=require(_0x6cfc('0x5'))['db'];var utils=require(_0x6cfc('0x6'));var logger=require(_0x6cfc('0x7'))(_0x6cfc('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6cfc('0x9')][_0x6cfc('0xa')]({'port':0x232a});config[_0x6cfc('0xb')]=_[_0x6cfc('0xc')](config['redis'],{'host':_0x6cfc('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6cfc('0xb')]));require(_0x6cfc('0xe'))[_0x6cfc('0xf')](socket);function respondWithRpcPromise(_0x4f4f1e,_0x145d1c,_0x572fcb){return new BPromise(function(_0x271d1a,_0x354470){return client['request'](_0x4f4f1e,_0x572fcb)[_0x6cfc('0x10')](function(_0x2d6fe3){logger[_0x6cfc('0x11')](_0x6cfc('0x12'),_0x145d1c,_0x6cfc('0x13'));logger[_0x6cfc('0x14')](_0x6cfc('0x15'),_0x145d1c,_0x6cfc('0x13'),JSON[_0x6cfc('0x16')](_0x2d6fe3));if(_0x2d6fe3[_0x6cfc('0x17')]){if(_0x2d6fe3['error'][_0x6cfc('0x18')]===0x1f4){logger['error'](_0x6cfc('0x12'),_0x145d1c,_0x2d6fe3[_0x6cfc('0x17')][_0x6cfc('0x19')]);return _0x354470(_0x2d6fe3['error']['message']);}logger[_0x6cfc('0x17')](_0x6cfc('0x12'),_0x145d1c,_0x2d6fe3[_0x6cfc('0x17')][_0x6cfc('0x19')]);return _0x271d1a(_0x2d6fe3[_0x6cfc('0x17')][_0x6cfc('0x19')]);}else{logger[_0x6cfc('0x11')](_0x6cfc('0x12'),_0x145d1c,'request\x20sent');_0x271d1a(_0x2d6fe3['result'][_0x6cfc('0x19')]);}})[_0x6cfc('0x1a')](function(_0x2501e3){logger[_0x6cfc('0x17')](_0x6cfc('0x12'),_0x145d1c,_0x2501e3);_0x354470(_0x2501e3);});});} \ No newline at end of file +var _0xa69d=['client','http','defaults','redis','localhost','socket.io-emitter','register','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4df17c,_0x2d2b61){var _0x4e79b5=function(_0x2134a5){while(--_0x2134a5){_0x4df17c['push'](_0x4df17c['shift']());}};_0x4e79b5(++_0x2d2b61);}(_0xa69d,0x15d));var _0xda69=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa69d[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xda69('0x0'));var util=require(_0xda69('0x1'));var moment=require(_0xda69('0x2'));var BPromise=require(_0xda69('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xda69('0x4'));var db=require(_0xda69('0x5'))['db'];var utils=require(_0xda69('0x6'));var logger=require(_0xda69('0x7'))(_0xda69('0x8'));var config=require(_0xda69('0x9'));var jayson=require(_0xda69('0xa'));var client=jayson[_0xda69('0xb')][_0xda69('0xc')]({'port':0x232a});config['redis']=_[_0xda69('0xd')](config[_0xda69('0xe')],{'host':_0xda69('0xf'),'port':0x18eb});var socket=require(_0xda69('0x10'))(new Redis(config[_0xda69('0xe')]));require('./dashboard.socket')[_0xda69('0x11')](socket);function respondWithRpcPromise(_0x1e9702,_0x4eba40,_0x5829cd){return new BPromise(function(_0xa73612,_0x572568){return client['request'](_0x1e9702,_0x5829cd)[_0xda69('0x12')](function(_0x43cdf8){logger[_0xda69('0x13')](_0xda69('0x14'),_0x4eba40,_0xda69('0x15'));logger[_0xda69('0x16')](_0xda69('0x17'),_0x4eba40,'request\x20sent',JSON[_0xda69('0x18')](_0x43cdf8));if(_0x43cdf8[_0xda69('0x19')]){if(_0x43cdf8[_0xda69('0x19')][_0xda69('0x1a')]===0x1f4){logger[_0xda69('0x19')](_0xda69('0x14'),_0x4eba40,_0x43cdf8[_0xda69('0x19')][_0xda69('0x1b')]);return _0x572568(_0x43cdf8[_0xda69('0x19')][_0xda69('0x1b')]);}logger['error'](_0xda69('0x14'),_0x4eba40,_0x43cdf8[_0xda69('0x19')][_0xda69('0x1b')]);return _0xa73612(_0x43cdf8[_0xda69('0x19')][_0xda69('0x1b')]);}else{logger[_0xda69('0x13')](_0xda69('0x14'),_0x4eba40,'request\x20sent');_0xa73612(_0x43cdf8[_0xda69('0x1c')][_0xda69('0x1b')]);}})[_0xda69('0x1d')](function(_0x4bcd31){logger[_0xda69('0x19')](_0xda69('0x14'),_0x4eba40,_0x4bcd31);_0x572568(_0x4bcd31);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index ca5bef3..b87d4c0 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 _0xb4fe=['remove','update','removeListener','register','dashboard:','./dashboard.events','save'];(function(_0x121b1a,_0x42fdb7){var _0x2d89a6=function(_0x1b6027){while(--_0x1b6027){_0x121b1a['push'](_0x121b1a['shift']());}};_0x2d89a6(++_0x42fdb7);}(_0xb4fe,0xd7));var _0xeb4f=function(_0x5222f4,_0x3efa71){_0x5222f4=_0x5222f4-0x0;var _0xf36b54=_0xb4fe[_0x5222f4];return _0xf36b54;};'use strict';var DashboardEvents=require(_0xeb4f('0x0'));var events=[_0xeb4f('0x1'),_0xeb4f('0x2'),_0xeb4f('0x3')];function createListener(_0x2a75ba,_0x319c77){return function(_0x2c0cb8){_0x319c77['emit'](_0x2a75ba,_0x2c0cb8);};}function removeListener(_0x50a628,_0x424c9c){return function(){DashboardEvents[_0xeb4f('0x4')](_0x50a628,_0x424c9c);};}exports[_0xeb4f('0x5')]=function(_0x3f6561){for(var _0x4e406f=0x0,_0x96ce30=events['length'];_0x4e406f<_0x96ce30;_0x4e406f++){var _0x3d0711=events[_0x4e406f];var _0x30063f=createListener(_0xeb4f('0x6')+_0x3d0711,_0x3f6561);DashboardEvents['on'](_0x3d0711,_0x30063f);}}; \ No newline at end of file +var _0x529c=['./dashboard.events','save','remove','update','emit','removeListener','register'];(function(_0x5ec0f6,_0x3e9638){var _0x36505c=function(_0x4fa194){while(--_0x4fa194){_0x5ec0f6['push'](_0x5ec0f6['shift']());}};_0x36505c(++_0x3e9638);}(_0x529c,0x126));var _0xc529=function(_0x161c03,_0x51e669){_0x161c03=_0x161c03-0x0;var _0x5b32be=_0x529c[_0x161c03];return _0x5b32be;};'use strict';var DashboardEvents=require(_0xc529('0x0'));var events=[_0xc529('0x1'),_0xc529('0x2'),_0xc529('0x3')];function createListener(_0x1b6c5e,_0x3302e6){return function(_0x519877){_0x3302e6[_0xc529('0x4')](_0x1b6c5e,_0x519877);};}function removeListener(_0x17db7c,_0x1af9ad){return function(){DashboardEvents[_0xc529('0x5')](_0x17db7c,_0x1af9ad);};}exports[_0xc529('0x6')]=function(_0x52851c){for(var _0x44f7cc=0x0,_0x2fb904=events['length'];_0x44f7cc<_0x2fb904;_0x44f7cc++){var _0x3662ae=events[_0x44f7cc];var _0xea825d=createListener('dashboard:'+_0x3662ae,_0x52851c);DashboardEvents['on'](_0x3662ae,_0xea825d);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 2108f75..36c8958 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 _0xfac1=['clone','addItem','put','update','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','/:id/clone'];(function(_0x5c8c7f,_0x3acfde){var _0x514e60=function(_0x1c7258){while(--_0x1c7258){_0x5c8c7f['push'](_0x5c8c7f['shift']());}};_0x514e60(++_0x3acfde);}(_0xfac1,0x140));var _0x1fac=function(_0xe33b12,_0x2a9761){_0xe33b12=_0xe33b12-0x0;var _0x30699d=_0xfac1[_0xe33b12];return _0x30699d;};'use strict';var multer=require('multer');var util=require(_0x1fac('0x0'));var path=require(_0x1fac('0x1'));var timeout=require('connect-timeout');var express=require(_0x1fac('0x2'));var router=express['Router']();var fs_extra=require(_0x1fac('0x3'));var auth=require(_0x1fac('0x4'));var interaction=require(_0x1fac('0x5'));var config=require(_0x1fac('0x6'));var controller=require('./dashboard.controller');router[_0x1fac('0x7')]('/',auth[_0x1fac('0x8')](),controller[_0x1fac('0x9')]);router[_0x1fac('0x7')](_0x1fac('0xa'),auth['isAuthenticated'](),controller[_0x1fac('0xb')]);router['get'](_0x1fac('0xc'),auth[_0x1fac('0x8')](),controller[_0x1fac('0xd')]);router[_0x1fac('0xe')]('/',auth[_0x1fac('0x8')](),controller['create']);router[_0x1fac('0xe')](_0x1fac('0xf'),auth[_0x1fac('0x8')](),controller[_0x1fac('0x10')]);router['post'](_0x1fac('0xc'),auth[_0x1fac('0x8')](),controller[_0x1fac('0x11')]);router[_0x1fac('0x12')](_0x1fac('0xa'),auth[_0x1fac('0x8')](),controller[_0x1fac('0x13')]);router['delete'](_0x1fac('0xa'),auth[_0x1fac('0x8')](),controller['destroy']);module[_0x1fac('0x14')]=router; \ No newline at end of file +var _0x25e9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','getItems','post','create','addItem','put','update','delete','destroy','multer'];(function(_0x128188,_0x418a16){var _0x4bc209=function(_0x58c891){while(--_0x58c891){_0x128188['push'](_0x128188['shift']());}};_0x4bc209(++_0x418a16);}(_0x25e9,0x1a3));var _0x925e=function(_0x949ea5,_0x47be0d){_0x949ea5=_0x949ea5-0x0;var _0xc8993e=_0x25e9[_0x949ea5];return _0xc8993e;};'use strict';var multer=require(_0x925e('0x0'));var util=require(_0x925e('0x1'));var path=require(_0x925e('0x2'));var timeout=require(_0x925e('0x3'));var express=require(_0x925e('0x4'));var router=express[_0x925e('0x5')]();var fs_extra=require(_0x925e('0x6'));var auth=require(_0x925e('0x7'));var interaction=require(_0x925e('0x8'));var config=require('../../config/environment');var controller=require('./dashboard.controller');router[_0x925e('0x9')]('/',auth[_0x925e('0xa')](),controller[_0x925e('0xb')]);router['get'](_0x925e('0xc'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/items',auth[_0x925e('0xa')](),controller[_0x925e('0xd')]);router[_0x925e('0xe')]('/',auth['isAuthenticated'](),controller[_0x925e('0xf')]);router[_0x925e('0xe')]('/:id/clone',auth[_0x925e('0xa')](),controller['clone']);router[_0x925e('0xe')]('/:id/items',auth[_0x925e('0xa')](),controller[_0x925e('0x10')]);router[_0x925e('0x11')](_0x925e('0xc'),auth['isAuthenticated'](),controller[_0x925e('0x12')]);router[_0x925e('0x13')](_0x925e('0xc'),auth[_0x925e('0xa')](),controller[_0x925e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 7084cba..d8d7878 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 _0xc6ac=['#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER'];(function(_0xb3e877,_0x5c2463){var _0x1db8d0=function(_0x14bca5){while(--_0x14bca5){_0xb3e877['push'](_0xb3e877['shift']());}};_0x1db8d0(++_0x5c2463);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x48ad61,_0x371967){_0x48ad61=_0x48ad61-0x0;var _0x23237a=_0xc6ac[_0x48ad61];return _0x23237a;};'use strict';var Sequelize=require(_0xcc6a('0x0'));var squel=require(_0xcc6a('0x1'));var _=require(_0xcc6a('0x2'));module[_0xcc6a('0x3')]={'title':{'type':Sequelize[_0xcc6a('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xcc6a('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xcc6a('0x5')](_0xcc6a('0x6')),'get':function(){try{return JSON[_0xcc6a('0x7')](this[_0xcc6a('0x8')](_0xcc6a('0x9')));}catch(_0x188b05){return[];}},'set':function(_0x12330e){try{this[_0xcc6a('0xa')]('attrs',JSON[_0xcc6a('0xb')](_0x12330e));}catch(_0x11b919){this[_0xcc6a('0xa')]('attrs',JSON[_0xcc6a('0xb')]([]));}}},'sizeX':{'type':Sequelize[_0xcc6a('0xc')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xcc6a('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xcc6a('0xc')]},'col':{'type':Sequelize[_0xcc6a('0xc')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xcc6a('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xcc6a('0x4')],'allowNull':![],'defaultValue':_0xcc6a('0xe'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0xcc6a('0xc')],'defaultValue':0xc}}; \ No newline at end of file +var _0xba34=['attrs','setDataValue','stringify','INTEGER','#ffffff','sequelize','squel','lodash','exports','STRING','parse','getDataValue'];(function(_0x10a8d8,_0x28f292){var _0x3b2b79=function(_0x55a3fe){while(--_0x55a3fe){_0x10a8d8['push'](_0x10a8d8['shift']());}};_0x3b2b79(++_0x28f292);}(_0xba34,0x119));var _0x4ba3=function(_0x500f66,_0xfdb7ca){_0x500f66=_0x500f66-0x0;var _0x2ae2b9=_0xba34[_0x500f66];return _0x2ae2b9;};'use strict';var Sequelize=require(_0x4ba3('0x0'));var squel=require(_0x4ba3('0x1'));var _=require(_0x4ba3('0x2'));module[_0x4ba3('0x3')]={'title':{'type':Sequelize[_0x4ba3('0x4')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT']('long'),'get':function(){try{return JSON[_0x4ba3('0x5')](this[_0x4ba3('0x6')](_0x4ba3('0x7')));}catch(_0x1011ec){return[];}},'set':function(_0x3590a1){try{this[_0x4ba3('0x8')](_0x4ba3('0x7'),JSON['stringify'](_0x3590a1));}catch(_0x6254fb){this[_0x4ba3('0x8')](_0x4ba3('0x7'),JSON[_0x4ba3('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0x4ba3('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x4ba3('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x4ba3('0xa')]},'col':{'type':Sequelize[_0x4ba3('0xa')]},'background':{'type':Sequelize[_0x4ba3('0x4')],'allowNull':![],'defaultValue':_0x4ba3('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x4ba3('0x4')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x4ba3('0x4')]},'titleFontSize':{'type':Sequelize[_0x4ba3('0xa')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index c5d318f..0fcee5f 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 _0xb138=['fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','../../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','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','destroy','error','stack','name','send','show','params','model','DashboardItem','rawAttributes','query','keys','intersection','attributes','fields','length','include','merge','options','find','then','catch','iframe','attrUrl','attrs','value','https://','custom','attrHourFormat','HH:mm:ss','0.00','attrFontSize','attrMetric','total','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrVoiceQueues','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb138,0x1dd));var _0x8b13=function(_0x51fff3,_0x3d4618){_0x51fff3=_0x51fff3-0x0;var _0x4e27a8=_0xb138[_0x51fff3];return _0x4e27a8;};'use strict';var emlformat=require(_0x8b13('0x0'));var rimraf=require(_0x8b13('0x1'));var zipdir=require(_0x8b13('0x2'));var jsonpatch=require(_0x8b13('0x3'));var rp=require(_0x8b13('0x4'));var moment=require(_0x8b13('0x5'));var BPromise=require(_0x8b13('0x6'));var Mustache=require('mustache');var util=require(_0x8b13('0x7'));var path=require(_0x8b13('0x8'));var sox=require(_0x8b13('0x9'));var csv=require('to-csv');var ejs=require(_0x8b13('0xa'));var fs=require('fs');var fs_extra=require(_0x8b13('0xb'));var _=require('lodash');var squel=require(_0x8b13('0xc'));var crypto=require(_0x8b13('0xd'));var jsforce=require(_0x8b13('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8b13('0xf'));var querystring=require(_0x8b13('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8b13('0x11'));var qs=require(_0x8b13('0x12'));var as=require(_0x8b13('0x13'));var hardwareService=require(_0x8b13('0x14'));var logger=require(_0x8b13('0x15'))('api');var utils=require(_0x8b13('0x16'));var config=require(_0x8b13('0x17'));var licenseUtil=require(_0x8b13('0x18'));var db=require(_0x8b13('0x19'))['db'];config[_0x8b13('0x1a')]=_[_0x8b13('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8b13('0x1c'))(new Redis(config[_0x8b13('0x1a')]));require('./dashboardItem.socket')['register'](socket);function respondWithStatusCode(_0x479773,_0x272cb0){_0x272cb0=_0x272cb0||0xcc;return function(_0x407ef4){if(_0x407ef4){return _0x479773[_0x8b13('0x1d')](_0x272cb0);}return _0x479773[_0x8b13('0x1e')](_0x272cb0)[_0x8b13('0x1f')]();};}function respondWithResult(_0x542357,_0x1c6c99){_0x1c6c99=_0x1c6c99||0xc8;return function(_0xea7881){if(_0xea7881){return _0x542357[_0x8b13('0x1e')](_0x1c6c99)[_0x8b13('0x20')](_0xea7881);}};}function respondWithFilteredResult(_0x3eed21,_0x1fcfe6){return function(_0x10fbde){if(_0x10fbde){var _0x441ddc=typeof _0x1fcfe6['offset']==='undefined'&&typeof _0x1fcfe6[_0x8b13('0x21')]===_0x8b13('0x22');var _0x14a8ac=_0x10fbde[_0x8b13('0x23')];var _0x1e0fe3=_0x441ddc?0x0:_0x1fcfe6[_0x8b13('0x24')];var _0x559442=_0x441ddc?_0x10fbde[_0x8b13('0x23')]:_0x1fcfe6[_0x8b13('0x24')]+_0x1fcfe6[_0x8b13('0x21')];var _0x54a309;if(_0x559442>=_0x14a8ac){_0x559442=_0x14a8ac;_0x54a309=0xc8;}else{_0x54a309=0xce;}_0x3eed21['status'](_0x54a309);return _0x3eed21[_0x8b13('0x25')](_0x8b13('0x26'),_0x1e0fe3+'-'+_0x559442+'/'+_0x14a8ac)['json'](_0x10fbde);}return null;};}function patchUpdates(_0x3187ed){return function(_0x2c3afb){try{jsonpatch[_0x8b13('0x27')](_0x2c3afb,_0x3187ed,!![]);}catch(_0x213280){return BPromise[_0x8b13('0x28')](_0x213280);}return _0x2c3afb['save']();};}function saveUpdates(_0x339271,_0x73614){return function(_0x5f15f0){if(_0x5f15f0){return _0x5f15f0[_0x8b13('0x29')](_0x339271)['then'](function(_0x420772){return _0x420772;});}return null;};}function removeEntity(_0x325d68,_0x54786a){return function(_0x3f1756){if(_0x3f1756){return _0x3f1756[_0x8b13('0x2a')]()['then'](function(){_0x325d68[_0x8b13('0x1e')](0xcc)[_0x8b13('0x1f')]();});}};}function handleEntityNotFound(_0x410122,_0x4048e4){return function(_0x27fef3){if(!_0x27fef3){_0x410122['sendStatus'](0x194);}return _0x27fef3;};}function handleError(_0x6023f5,_0x1b09e2){_0x1b09e2=_0x1b09e2||0x1f4;return function(_0x3475d8){logger[_0x8b13('0x2b')](_0x3475d8[_0x8b13('0x2c')]);if(_0x3475d8[_0x8b13('0x2d')]){delete _0x3475d8['name'];}_0x6023f5[_0x8b13('0x1e')](_0x1b09e2)[_0x8b13('0x2e')](_0x3475d8);};}exports[_0x8b13('0x2f')]=function(_0x9d2377,_0x23fde7){var _0x29946e={'raw':![],'where':{'id':_0x9d2377[_0x8b13('0x30')]['id']}},_0x3304bd={};_0x3304bd[_0x8b13('0x31')]=_['keys'](db[_0x8b13('0x32')][_0x8b13('0x33')]);_0x3304bd[_0x8b13('0x34')]=_[_0x8b13('0x35')](_0x9d2377['query']);_0x3304bd['filters']=_[_0x8b13('0x36')](_0x3304bd['model'],_0x3304bd['query']);_0x29946e[_0x8b13('0x37')]=_['intersection'](_0x3304bd[_0x8b13('0x31')],qs[_0x8b13('0x38')](_0x9d2377[_0x8b13('0x34')][_0x8b13('0x38')]));_0x29946e[_0x8b13('0x37')]=_0x29946e[_0x8b13('0x37')][_0x8b13('0x39')]?_0x29946e[_0x8b13('0x37')]:_0x3304bd[_0x8b13('0x31')];if(_0x9d2377[_0x8b13('0x34')]['includeAll']){_0x29946e[_0x8b13('0x3a')]=[{'all':!![]}];}_0x29946e=_[_0x8b13('0x3b')]({},_0x29946e,_0x9d2377[_0x8b13('0x3c')]);return db[_0x8b13('0x32')][_0x8b13('0x3d')](_0x29946e)[_0x8b13('0x3e')](handleEntityNotFound(_0x23fde7,null))[_0x8b13('0x3e')](respondWithResult(_0x23fde7,null))[_0x8b13('0x3f')](handleError(_0x23fde7,null));};exports['destroy']=function(_0x219bdf,_0x5089c6){return db[_0x8b13('0x32')][_0x8b13('0x3d')]({'where':{'id':_0x219bdf[_0x8b13('0x30')]['id']}})[_0x8b13('0x3e')](handleEntityNotFound(_0x5089c6,null))[_0x8b13('0x3e')](removeEntity(_0x5089c6,null))[_0x8b13('0x3f')](handleError(_0x5089c6,null));};function widgetAttributes(_0x4ec1a5){try{switch(_0x4ec1a5['type']){case _0x8b13('0x40'):return[{'name':'attrUrl','value':_0x4ec1a5[_0x8b13('0x41')]||(_0x4ec1a5['attrs']&&_0x4ec1a5[_0x8b13('0x42')][0x0]?_0x4ec1a5[_0x8b13('0x42')][0x0][_0x8b13('0x43')]:undefined)||_0x8b13('0x44')}];case _0x8b13('0x45'):return[{'name':'attrPath','value':_0x4ec1a5['attrPath']||(_0x4ec1a5[_0x8b13('0x42')]&&_0x4ec1a5['attrs'][0x0]?_0x4ec1a5[_0x8b13('0x42')][0x0][_0x8b13('0x43')]:undefined)||''}];case'clock':return[{'name':_0x8b13('0x46'),'value':_0x4ec1a5[_0x8b13('0x46')]||(_0x4ec1a5[_0x8b13('0x42')]&&_0x4ec1a5[_0x8b13('0x42')][0x0]?_0x4ec1a5[_0x8b13('0x42')][0x0][_0x8b13('0x43')]:undefined)||_0x8b13('0x47')},{'name':'attrTimezone','value':_0x4ec1a5['attrTimezone']||(_0x4ec1a5['attrs']&&_0x4ec1a5[_0x8b13('0x42')][0x1]?_0x4ec1a5[_0x8b13('0x42')][0x1][_0x8b13('0x43')]:undefined)||_0x8b13('0x48')},{'name':_0x8b13('0x49'),'value':_0x4ec1a5[_0x8b13('0x49')]||(_0x4ec1a5['attrs']&&_0x4ec1a5[_0x8b13('0x42')][0x2]?_0x4ec1a5['attrs'][0x2][_0x8b13('0x43')]:undefined)||0xc}];case'counter':return[{'name':_0x8b13('0x4a'),'value':_0x4ec1a5[_0x8b13('0x4a')]||(_0x4ec1a5[_0x8b13('0x42')]&&_0x4ec1a5[_0x8b13('0x42')][0x0]?_0x4ec1a5[_0x8b13('0x42')][0x0][_0x8b13('0x43')]:undefined)||_0x8b13('0x4b')},{'name':'attrVoiceQueues','value':_0x4ec1a5['attrVoiceQueues']||(_0x4ec1a5['attrs']&&_0x4ec1a5[_0x8b13('0x42')][0x1]?_0x4ec1a5[_0x8b13('0x42')][0x1][_0x8b13('0x43')]:undefined)||[]},{'name':_0x8b13('0x49'),'value':_0x4ec1a5['attrFontSize']||(_0x4ec1a5['attrs']&&_0x4ec1a5[_0x8b13('0x42')][0x2]?_0x4ec1a5['attrs'][0x2][_0x8b13('0x43')]:undefined)||0x14},{'name':_0x8b13('0x4c'),'value':_0x4ec1a5[_0x8b13('0x4c')]||(_0x4ec1a5[_0x8b13('0x42')]&&_0x4ec1a5[_0x8b13('0x42')][0x3]?_0x4ec1a5['attrs'][0x3][_0x8b13('0x43')]:undefined)||_0x8b13('0x4d')},{'name':_0x8b13('0x4e'),'value':_0x4ec1a5[_0x8b13('0x4e')]||(_0x4ec1a5[_0x8b13('0x42')]&&_0x4ec1a5[_0x8b13('0x42')][0x4]?_0x4ec1a5[_0x8b13('0x42')][0x4][_0x8b13('0x43')]:undefined)||''},{'name':_0x8b13('0x4f'),'value':_0x4ec1a5['attrFaxAccounts']||(_0x4ec1a5[_0x8b13('0x42')]&&_0x4ec1a5['attrs'][0x5]?_0x4ec1a5[_0x8b13('0x42')][0x5][_0x8b13('0x43')]:undefined)||''},{'name':_0x8b13('0x50'),'value':_0x4ec1a5['attrSmsAccounts']||(_0x4ec1a5[_0x8b13('0x42')]&&_0x4ec1a5[_0x8b13('0x42')][0x6]?_0x4ec1a5[_0x8b13('0x42')][0x6][_0x8b13('0x43')]:undefined)||''},{'name':_0x8b13('0x51'),'value':_0x4ec1a5[_0x8b13('0x51')]||(_0x4ec1a5[_0x8b13('0x42')]&&_0x4ec1a5['attrs'][0x7]?_0x4ec1a5[_0x8b13('0x42')][0x7]['value']:undefined)||''},{'name':_0x8b13('0x52'),'value':_0x4ec1a5[_0x8b13('0x52')]||(_0x4ec1a5[_0x8b13('0x42')]&&_0x4ec1a5[_0x8b13('0x42')][0x8]?_0x4ec1a5[_0x8b13('0x42')][0x8][_0x8b13('0x43')]:undefined)||''},{'name':_0x8b13('0x53'),'value':_0x4ec1a5[_0x8b13('0x53')]||(_0x4ec1a5[_0x8b13('0x42')]&&_0x4ec1a5[_0x8b13('0x42')][0x9]?_0x4ec1a5[_0x8b13('0x42')][0x9][_0x8b13('0x43')]:undefined)||''}];case _0x8b13('0x54'):case _0x8b13('0x55'):return[{'name':_0x8b13('0x56'),'value':_0x4ec1a5[_0x8b13('0x56')]||(_0x4ec1a5[_0x8b13('0x42')]&&_0x4ec1a5['attrs'][0x0]?_0x4ec1a5[_0x8b13('0x42')][0x0][_0x8b13('0x43')]:undefined)||'total'},{'name':_0x8b13('0x57'),'value':_0x4ec1a5[_0x8b13('0x57')]||(_0x4ec1a5[_0x8b13('0x42')]&&_0x4ec1a5[_0x8b13('0x42')][0x1]?_0x4ec1a5[_0x8b13('0x42')][0x1][_0x8b13('0x43')]:undefined)||null},{'name':_0x8b13('0x58'),'value':_0x4ec1a5[_0x8b13('0x58')]||(_0x4ec1a5[_0x8b13('0x42')]&&_0x4ec1a5[_0x8b13('0x42')][0x2]?_0x4ec1a5[_0x8b13('0x42')][0x2][_0x8b13('0x43')]:undefined)||null},{'name':_0x8b13('0x59'),'value':_0x4ec1a5[_0x8b13('0x59')]||(_0x4ec1a5[_0x8b13('0x42')]&&_0x4ec1a5['attrs'][0x3]?_0x4ec1a5[_0x8b13('0x42')][0x3][_0x8b13('0x43')]:undefined)||[]},{'name':'attrChannel','value':_0x4ec1a5[_0x8b13('0x4c')]||(_0x4ec1a5[_0x8b13('0x42')]&&_0x4ec1a5[_0x8b13('0x42')][0x4]?_0x4ec1a5[_0x8b13('0x42')][0x4][_0x8b13('0x43')]:undefined)||'voice'},{'name':_0x8b13('0x4e'),'value':_0x4ec1a5[_0x8b13('0x4e')]||(_0x4ec1a5[_0x8b13('0x42')]&&_0x4ec1a5['attrs'][0x5]?_0x4ec1a5[_0x8b13('0x42')][0x5][_0x8b13('0x43')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x4ec1a5[_0x8b13('0x4f')]||(_0x4ec1a5[_0x8b13('0x42')]&&_0x4ec1a5[_0x8b13('0x42')][0x6]?_0x4ec1a5[_0x8b13('0x42')][0x6]['value']:undefined)||''},{'name':_0x8b13('0x50'),'value':_0x4ec1a5[_0x8b13('0x50')]||(_0x4ec1a5['attrs']&&_0x4ec1a5[_0x8b13('0x42')][0x7]?_0x4ec1a5[_0x8b13('0x42')][0x7][_0x8b13('0x43')]:undefined)||''},{'name':_0x8b13('0x51'),'value':_0x4ec1a5['attrOpenchannelAccounts']||(_0x4ec1a5[_0x8b13('0x42')]&&_0x4ec1a5[_0x8b13('0x42')][0x8]?_0x4ec1a5[_0x8b13('0x42')][0x8][_0x8b13('0x43')]:undefined)||''},{'name':_0x8b13('0x52'),'value':_0x4ec1a5[_0x8b13('0x52')]||(_0x4ec1a5['attrs']&&_0x4ec1a5[_0x8b13('0x42')][0x9]?_0x4ec1a5[_0x8b13('0x42')][0x9][_0x8b13('0x43')]:undefined)||''},{'name':'attrChatWebsites','value':_0x4ec1a5[_0x8b13('0x53')]||(_0x4ec1a5[_0x8b13('0x42')]&&_0x4ec1a5[_0x8b13('0x42')][0xa]?_0x4ec1a5[_0x8b13('0x42')][0xa]['value']:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0x4ec1a5['reportType']||(_0x4ec1a5['attrs']&&_0x4ec1a5[_0x8b13('0x42')][0x0]?_0x4ec1a5[_0x8b13('0x42')][0x0]['type']:undefined)||null,'value':_0x4ec1a5[_0x8b13('0x5a')]||(_0x4ec1a5['attrs']&&_0x4ec1a5[_0x8b13('0x42')][0x0]?_0x4ec1a5[_0x8b13('0x42')][0x0][_0x8b13('0x43')]:undefined)||null},{'name':_0x8b13('0x5b'),'value':_0x4ec1a5[_0x8b13('0x5b')]||(_0x4ec1a5[_0x8b13('0x42')]&&_0x4ec1a5[_0x8b13('0x42')][0x1]?_0x4ec1a5['attrs'][0x1][_0x8b13('0x43')]:undefined)||0x0}];default:return[];}}catch(_0x49ebaa){logger[_0x8b13('0x2b')](_0x8b13('0x5c'),JSON[_0x8b13('0x5d')](_0x49ebaa));return[];}}exports[_0x8b13('0x5e')]=function(_0x3fff75,_0x41a033){if(_0x3fff75[_0x8b13('0x5f')]){_0x3fff75['body'][_0x8b13('0x42')]=widgetAttributes(_0x3fff75['body']);}return db[_0x8b13('0x32')][_0x8b13('0x5e')](_0x3fff75[_0x8b13('0x5f')],{})[_0x8b13('0x3e')](respondWithResult(_0x41a033,0xc9))[_0x8b13('0x3f')](handleError(_0x41a033,null));};exports['update']=function(_0x52b546,_0x319923){if(_0x52b546[_0x8b13('0x5f')]['id']){delete _0x52b546['body']['id'];}_0x52b546[_0x8b13('0x5f')][_0x8b13('0x42')]=widgetAttributes(_0x52b546[_0x8b13('0x5f')]);return db['DashboardItem'][_0x8b13('0x3d')]({'where':{'id':_0x52b546[_0x8b13('0x30')]['id']}})[_0x8b13('0x3e')](handleEntityNotFound(_0x319923,null))[_0x8b13('0x3e')](saveUpdates(_0x52b546['body'],null))[_0x8b13('0x3e')](respondWithResult(_0x319923,null))[_0x8b13('0x3f')](handleError(_0x319923,null));}; \ No newline at end of file +var _0xad5f=['attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','options','catch','find','type','attrUrl','attrs','value','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone'];(function(_0xd554e3,_0x258a91){var _0x414442=function(_0x1607e4){while(--_0x1607e4){_0xd554e3['push'](_0xd554e3['shift']());}};_0x414442(++_0x258a91);}(_0xad5f,0x1a8));var _0xfad5=function(_0x1aefea,_0x39e5fa){_0x1aefea=_0x1aefea-0x0;var _0x33a7a1=_0xad5f[_0x1aefea];return _0x33a7a1;};'use strict';var emlformat=require(_0xfad5('0x0'));var rimraf=require(_0xfad5('0x1'));var zipdir=require(_0xfad5('0x2'));var jsonpatch=require(_0xfad5('0x3'));var rp=require(_0xfad5('0x4'));var moment=require(_0xfad5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfad5('0x6'));var util=require(_0xfad5('0x7'));var path=require(_0xfad5('0x8'));var sox=require(_0xfad5('0x9'));var csv=require(_0xfad5('0xa'));var ejs=require(_0xfad5('0xb'));var fs=require('fs');var fs_extra=require(_0xfad5('0xc'));var _=require('lodash');var squel=require(_0xfad5('0xd'));var crypto=require(_0xfad5('0xe'));var jsforce=require(_0xfad5('0xf'));var deskjs=require(_0xfad5('0x10'));var toCsv=require('to-csv');var querystring=require(_0xfad5('0x11'));var Papa=require(_0xfad5('0x12'));var Redis=require(_0xfad5('0x13'));var authService=require(_0xfad5('0x14'));var qs=require(_0xfad5('0x15'));var as=require(_0xfad5('0x16'));var hardwareService=require(_0xfad5('0x17'));var logger=require('../../config/logger')(_0xfad5('0x18'));var utils=require(_0xfad5('0x19'));var config=require(_0xfad5('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xfad5('0x1b')]=_[_0xfad5('0x1c')](config[_0xfad5('0x1b')],{'host':_0xfad5('0x1d'),'port':0x18eb});var socket=require(_0xfad5('0x1e'))(new Redis(config['redis']));require(_0xfad5('0x1f'))[_0xfad5('0x20')](socket);function respondWithStatusCode(_0x162d27,_0xd65a8a){_0xd65a8a=_0xd65a8a||0xcc;return function(_0x45f731){if(_0x45f731){return _0x162d27[_0xfad5('0x21')](_0xd65a8a);}return _0x162d27[_0xfad5('0x22')](_0xd65a8a)['end']();};}function respondWithResult(_0x5bc9f6,_0x17ba21){_0x17ba21=_0x17ba21||0xc8;return function(_0xf84cc4){if(_0xf84cc4){return _0x5bc9f6[_0xfad5('0x22')](_0x17ba21)[_0xfad5('0x23')](_0xf84cc4);}};}function respondWithFilteredResult(_0x3a5b8a,_0x15c41f){return function(_0x10ae77){if(_0x10ae77){var _0x2fc3ed=typeof _0x15c41f[_0xfad5('0x24')]==='undefined'&&typeof _0x15c41f['limit']===_0xfad5('0x25');var _0x40f087=_0x10ae77['count'];var _0x5a05ff=_0x2fc3ed?0x0:_0x15c41f[_0xfad5('0x24')];var _0x2d58b6=_0x2fc3ed?_0x10ae77['count']:_0x15c41f['offset']+_0x15c41f[_0xfad5('0x26')];var _0x58c3ae;if(_0x2d58b6>=_0x40f087){_0x2d58b6=_0x40f087;_0x58c3ae=0xc8;}else{_0x58c3ae=0xce;}_0x3a5b8a[_0xfad5('0x22')](_0x58c3ae);return _0x3a5b8a[_0xfad5('0x27')](_0xfad5('0x28'),_0x5a05ff+'-'+_0x2d58b6+'/'+_0x40f087)['json'](_0x10ae77);}return null;};}function patchUpdates(_0x354a31){return function(_0x4e6ecc){try{jsonpatch[_0xfad5('0x29')](_0x4e6ecc,_0x354a31,!![]);}catch(_0x75dab5){return BPromise[_0xfad5('0x2a')](_0x75dab5);}return _0x4e6ecc[_0xfad5('0x2b')]();};}function saveUpdates(_0x1205fd,_0x341d85){return function(_0x178894){if(_0x178894){return _0x178894[_0xfad5('0x2c')](_0x1205fd)[_0xfad5('0x2d')](function(_0x45c149){return _0x45c149;});}return null;};}function removeEntity(_0x3ea0d8,_0x503b98){return function(_0x1a9344){if(_0x1a9344){return _0x1a9344[_0xfad5('0x2e')]()[_0xfad5('0x2d')](function(){_0x3ea0d8[_0xfad5('0x22')](0xcc)[_0xfad5('0x2f')]();});}};}function handleEntityNotFound(_0x59e2f4,_0x132d1d){return function(_0x3d9d95){if(!_0x3d9d95){_0x59e2f4[_0xfad5('0x21')](0x194);}return _0x3d9d95;};}function handleError(_0x4e3c29,_0x3f4760){_0x3f4760=_0x3f4760||0x1f4;return function(_0x504ae6){logger[_0xfad5('0x30')](_0x504ae6[_0xfad5('0x31')]);if(_0x504ae6[_0xfad5('0x32')]){delete _0x504ae6['name'];}_0x4e3c29[_0xfad5('0x22')](_0x3f4760)['send'](_0x504ae6);};}exports['show']=function(_0x4c0e11,_0x3fa9b6){var _0x1f5329={'raw':![],'where':{'id':_0x4c0e11[_0xfad5('0x33')]['id']}},_0x3c3f0f={};_0x3c3f0f[_0xfad5('0x34')]=_[_0xfad5('0x35')](db[_0xfad5('0x36')][_0xfad5('0x37')]);_0x3c3f0f[_0xfad5('0x38')]=_[_0xfad5('0x35')](_0x4c0e11['query']);_0x3c3f0f[_0xfad5('0x39')]=_[_0xfad5('0x3a')](_0x3c3f0f[_0xfad5('0x34')],_0x3c3f0f['query']);_0x1f5329[_0xfad5('0x3b')]=_[_0xfad5('0x3a')](_0x3c3f0f[_0xfad5('0x34')],qs[_0xfad5('0x3c')](_0x4c0e11['query'][_0xfad5('0x3c')]));_0x1f5329[_0xfad5('0x3b')]=_0x1f5329[_0xfad5('0x3b')][_0xfad5('0x3d')]?_0x1f5329[_0xfad5('0x3b')]:_0x3c3f0f['model'];if(_0x4c0e11[_0xfad5('0x38')][_0xfad5('0x3e')]){_0x1f5329[_0xfad5('0x3f')]=[{'all':!![]}];}_0x1f5329=_['merge']({},_0x1f5329,_0x4c0e11[_0xfad5('0x40')]);return db[_0xfad5('0x36')]['find'](_0x1f5329)['then'](handleEntityNotFound(_0x3fa9b6,null))[_0xfad5('0x2d')](respondWithResult(_0x3fa9b6,null))[_0xfad5('0x41')](handleError(_0x3fa9b6,null));};exports[_0xfad5('0x2e')]=function(_0x29c15e,_0x232192){return db[_0xfad5('0x36')][_0xfad5('0x42')]({'where':{'id':_0x29c15e['params']['id']}})[_0xfad5('0x2d')](handleEntityNotFound(_0x232192,null))[_0xfad5('0x2d')](removeEntity(_0x232192,null))[_0xfad5('0x41')](handleError(_0x232192,null));};function widgetAttributes(_0x3aa0e2){try{switch(_0x3aa0e2[_0xfad5('0x43')]){case'iframe':return[{'name':_0xfad5('0x44'),'value':_0x3aa0e2[_0xfad5('0x44')]||(_0x3aa0e2['attrs']&&_0x3aa0e2[_0xfad5('0x45')][0x0]?_0x3aa0e2[_0xfad5('0x45')][0x0][_0xfad5('0x46')]:undefined)||'https://'}];case'custom':return[{'name':_0xfad5('0x47'),'value':_0x3aa0e2[_0xfad5('0x47')]||(_0x3aa0e2[_0xfad5('0x45')]&&_0x3aa0e2[_0xfad5('0x45')][0x0]?_0x3aa0e2[_0xfad5('0x45')][0x0][_0xfad5('0x46')]:undefined)||''}];case _0xfad5('0x48'):return[{'name':_0xfad5('0x49'),'value':_0x3aa0e2[_0xfad5('0x49')]||(_0x3aa0e2[_0xfad5('0x45')]&&_0x3aa0e2[_0xfad5('0x45')][0x0]?_0x3aa0e2[_0xfad5('0x45')][0x0][_0xfad5('0x46')]:undefined)||_0xfad5('0x4a')},{'name':_0xfad5('0x4b'),'value':_0x3aa0e2[_0xfad5('0x4b')]||(_0x3aa0e2[_0xfad5('0x45')]&&_0x3aa0e2[_0xfad5('0x45')][0x1]?_0x3aa0e2[_0xfad5('0x45')][0x1][_0xfad5('0x46')]:undefined)||'0.00'},{'name':_0xfad5('0x4c'),'value':_0x3aa0e2[_0xfad5('0x4c')]||(_0x3aa0e2['attrs']&&_0x3aa0e2[_0xfad5('0x45')][0x2]?_0x3aa0e2['attrs'][0x2]['value']:undefined)||0xc}];case _0xfad5('0x4d'):return[{'name':'attrMetric','value':_0x3aa0e2[_0xfad5('0x4e')]||(_0x3aa0e2['attrs']&&_0x3aa0e2[_0xfad5('0x45')][0x0]?_0x3aa0e2[_0xfad5('0x45')][0x0]['value']:undefined)||_0xfad5('0x4f')},{'name':_0xfad5('0x50'),'value':_0x3aa0e2['attrVoiceQueues']||(_0x3aa0e2['attrs']&&_0x3aa0e2[_0xfad5('0x45')][0x1]?_0x3aa0e2['attrs'][0x1]['value']:undefined)||[]},{'name':_0xfad5('0x4c'),'value':_0x3aa0e2['attrFontSize']||(_0x3aa0e2[_0xfad5('0x45')]&&_0x3aa0e2[_0xfad5('0x45')][0x2]?_0x3aa0e2[_0xfad5('0x45')][0x2][_0xfad5('0x46')]:undefined)||0x14},{'name':_0xfad5('0x51'),'value':_0x3aa0e2['attrChannel']||(_0x3aa0e2[_0xfad5('0x45')]&&_0x3aa0e2[_0xfad5('0x45')][0x3]?_0x3aa0e2[_0xfad5('0x45')][0x3]['value']:undefined)||_0xfad5('0x52')},{'name':_0xfad5('0x53'),'value':_0x3aa0e2['attrEmailAccounts']||(_0x3aa0e2[_0xfad5('0x45')]&&_0x3aa0e2[_0xfad5('0x45')][0x4]?_0x3aa0e2['attrs'][0x4]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x3aa0e2[_0xfad5('0x54')]||(_0x3aa0e2[_0xfad5('0x45')]&&_0x3aa0e2[_0xfad5('0x45')][0x5]?_0x3aa0e2[_0xfad5('0x45')][0x5]['value']:undefined)||''},{'name':_0xfad5('0x55'),'value':_0x3aa0e2[_0xfad5('0x55')]||(_0x3aa0e2[_0xfad5('0x45')]&&_0x3aa0e2[_0xfad5('0x45')][0x6]?_0x3aa0e2[_0xfad5('0x45')][0x6][_0xfad5('0x46')]:undefined)||''},{'name':_0xfad5('0x56'),'value':_0x3aa0e2[_0xfad5('0x56')]||(_0x3aa0e2[_0xfad5('0x45')]&&_0x3aa0e2['attrs'][0x7]?_0x3aa0e2[_0xfad5('0x45')][0x7][_0xfad5('0x46')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x3aa0e2[_0xfad5('0x57')]||(_0x3aa0e2[_0xfad5('0x45')]&&_0x3aa0e2[_0xfad5('0x45')][0x8]?_0x3aa0e2[_0xfad5('0x45')][0x8][_0xfad5('0x46')]:undefined)||''},{'name':_0xfad5('0x58'),'value':_0x3aa0e2['attrChatWebsites']||(_0x3aa0e2[_0xfad5('0x45')]&&_0x3aa0e2[_0xfad5('0x45')][0x9]?_0x3aa0e2[_0xfad5('0x45')][0x9][_0xfad5('0x46')]:undefined)||''}];case _0xfad5('0x59'):case _0xfad5('0x5a'):return[{'name':'attrSerie1','value':_0x3aa0e2['attrSerie1']||(_0x3aa0e2[_0xfad5('0x45')]&&_0x3aa0e2[_0xfad5('0x45')][0x0]?_0x3aa0e2[_0xfad5('0x45')][0x0]['value']:undefined)||_0xfad5('0x4f')},{'name':'attrSerie2','value':_0x3aa0e2['attrSerie2']||(_0x3aa0e2[_0xfad5('0x45')]&&_0x3aa0e2[_0xfad5('0x45')][0x1]?_0x3aa0e2[_0xfad5('0x45')][0x1][_0xfad5('0x46')]:undefined)||null},{'name':_0xfad5('0x5b'),'value':_0x3aa0e2[_0xfad5('0x5b')]||(_0x3aa0e2[_0xfad5('0x45')]&&_0x3aa0e2['attrs'][0x2]?_0x3aa0e2[_0xfad5('0x45')][0x2][_0xfad5('0x46')]:undefined)||null},{'name':_0xfad5('0x50'),'value':_0x3aa0e2[_0xfad5('0x50')]||(_0x3aa0e2['attrs']&&_0x3aa0e2['attrs'][0x3]?_0x3aa0e2[_0xfad5('0x45')][0x3][_0xfad5('0x46')]:undefined)||[]},{'name':_0xfad5('0x51'),'value':_0x3aa0e2[_0xfad5('0x51')]||(_0x3aa0e2[_0xfad5('0x45')]&&_0x3aa0e2['attrs'][0x4]?_0x3aa0e2['attrs'][0x4][_0xfad5('0x46')]:undefined)||'voice'},{'name':_0xfad5('0x53'),'value':_0x3aa0e2[_0xfad5('0x53')]||(_0x3aa0e2[_0xfad5('0x45')]&&_0x3aa0e2[_0xfad5('0x45')][0x5]?_0x3aa0e2[_0xfad5('0x45')][0x5]['value']:undefined)||''},{'name':_0xfad5('0x54'),'value':_0x3aa0e2[_0xfad5('0x54')]||(_0x3aa0e2[_0xfad5('0x45')]&&_0x3aa0e2[_0xfad5('0x45')][0x6]?_0x3aa0e2[_0xfad5('0x45')][0x6]['value']:undefined)||''},{'name':_0xfad5('0x55'),'value':_0x3aa0e2['attrSmsAccounts']||(_0x3aa0e2['attrs']&&_0x3aa0e2[_0xfad5('0x45')][0x7]?_0x3aa0e2[_0xfad5('0x45')][0x7][_0xfad5('0x46')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x3aa0e2[_0xfad5('0x56')]||(_0x3aa0e2[_0xfad5('0x45')]&&_0x3aa0e2[_0xfad5('0x45')][0x8]?_0x3aa0e2['attrs'][0x8][_0xfad5('0x46')]:undefined)||''},{'name':_0xfad5('0x57'),'value':_0x3aa0e2[_0xfad5('0x57')]||(_0x3aa0e2[_0xfad5('0x45')]&&_0x3aa0e2[_0xfad5('0x45')][0x9]?_0x3aa0e2[_0xfad5('0x45')][0x9][_0xfad5('0x46')]:undefined)||''},{'name':_0xfad5('0x58'),'value':_0x3aa0e2[_0xfad5('0x58')]||(_0x3aa0e2[_0xfad5('0x45')]&&_0x3aa0e2[_0xfad5('0x45')][0xa]?_0x3aa0e2['attrs'][0xa][_0xfad5('0x46')]:undefined)||''}];case _0xfad5('0x5c'):return[{'name':_0xfad5('0x5d'),'type':_0x3aa0e2[_0xfad5('0x5e')]||(_0x3aa0e2['attrs']&&_0x3aa0e2[_0xfad5('0x45')][0x0]?_0x3aa0e2['attrs'][0x0][_0xfad5('0x43')]:undefined)||null,'value':_0x3aa0e2[_0xfad5('0x5d')]||(_0x3aa0e2[_0xfad5('0x45')]&&_0x3aa0e2[_0xfad5('0x45')][0x0]?_0x3aa0e2[_0xfad5('0x45')][0x0]['value']:undefined)||null},{'name':_0xfad5('0x5f'),'value':_0x3aa0e2[_0xfad5('0x5f')]||(_0x3aa0e2['attrs']&&_0x3aa0e2['attrs'][0x1]?_0x3aa0e2[_0xfad5('0x45')][0x1][_0xfad5('0x46')]:undefined)||0x0}];default:return[];}}catch(_0x214281){logger['error'](_0xfad5('0x60'),JSON[_0xfad5('0x61')](_0x214281));return[];}}exports[_0xfad5('0x62')]=function(_0x19a13f,_0x2f9b88){if(_0x19a13f[_0xfad5('0x63')]){_0x19a13f['body'][_0xfad5('0x45')]=widgetAttributes(_0x19a13f[_0xfad5('0x63')]);}return db[_0xfad5('0x36')][_0xfad5('0x62')](_0x19a13f[_0xfad5('0x63')],{})['then'](respondWithResult(_0x2f9b88,0xc9))[_0xfad5('0x41')](handleError(_0x2f9b88,null));};exports['update']=function(_0x2e5ef2,_0x25739a){if(_0x2e5ef2[_0xfad5('0x63')]['id']){delete _0x2e5ef2[_0xfad5('0x63')]['id'];}_0x2e5ef2[_0xfad5('0x63')][_0xfad5('0x45')]=widgetAttributes(_0x2e5ef2[_0xfad5('0x63')]);return db['DashboardItem'][_0xfad5('0x42')]({'where':{'id':_0x2e5ef2[_0xfad5('0x33')]['id']}})[_0xfad5('0x2d')](handleEntityNotFound(_0x25739a,null))[_0xfad5('0x2d')](saveUpdates(_0x2e5ef2[_0xfad5('0x63')],null))[_0xfad5('0x2d')](respondWithResult(_0x25739a,null))['catch'](handleError(_0x25739a,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 699c270..bf7b7f6 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 _0x9045=['update','remove','emit','hasOwnProperty','hook','events','DashboardItem','setMaxListeners','save'];(function(_0x66c27b,_0xd1b53e){var _0x17cf6b=function(_0x13a17c){while(--_0x13a17c){_0x66c27b['push'](_0x66c27b['shift']());}};_0x17cf6b(++_0xd1b53e);}(_0x9045,0x83));var _0x5904=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x9045[_0xbb091];return _0x467a04;};'use strict';var EventEmitter=require(_0x5904('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x5904('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x5904('0x2')](0x0);var events={'afterCreate':_0x5904('0x3'),'afterUpdate':_0x5904('0x4'),'afterDestroy':_0x5904('0x5')};function emitEvent(_0xdaa86c){return function(_0x52188a,_0x33d32d,_0x409e67){DashboardItemEvents['emit'](_0xdaa86c+':'+_0x52188a['id'],_0x52188a);DashboardItemEvents[_0x5904('0x6')](_0xdaa86c,_0x52188a);_0x409e67(null);};}for(var e in events){if(events[_0x5904('0x7')](e)){var event=events[e];DashboardItem[_0x5904('0x8')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x17b6=['hook','exports','events','DashboardItem','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x4ef378,_0x59767e){var _0x2f84c9=function(_0x34ccb7){while(--_0x34ccb7){_0x4ef378['push'](_0x4ef378['shift']());}};_0x2f84c9(++_0x59767e);}(_0x17b6,0x80));var _0x617b=function(_0x2521aa,_0x1cfad7){_0x2521aa=_0x2521aa-0x0;var _0x38305c=_0x17b6[_0x2521aa];return _0x38305c;};'use strict';var EventEmitter=require(_0x617b('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x617b('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x617b('0x2')](0x0);var events={'afterCreate':_0x617b('0x3'),'afterUpdate':_0x617b('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4801e8){return function(_0x5cc494,_0x1c49c6,_0x4a637d){DashboardItemEvents['emit'](_0x4801e8+':'+_0x5cc494['id'],_0x5cc494);DashboardItemEvents[_0x617b('0x5')](_0x4801e8,_0x5cc494);_0x4a637d(null);};}for(var e in events){if(events[_0x617b('0x6')](e)){var event=events[e];DashboardItem[_0x617b('0x7')](e,emitEvent(event));}}module[_0x617b('0x8')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 783a7ac..1707366 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 _0x5d25=['../../config/environment','./dashboardItem.attributes','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x5d25,0x117));var _0x55d2=function(_0x3de497,_0xe7b89c){_0x3de497=_0x3de497-0x0;var _0xe24328=_0x5d25[_0x3de497];return _0xe24328;};'use strict';var _=require(_0x55d2('0x0'));var util=require(_0x55d2('0x1'));var logger=require(_0x55d2('0x2'))(_0x55d2('0x3'));var moment=require(_0x55d2('0x4'));var BPromise=require(_0x55d2('0x5'));var rp=require(_0x55d2('0x6'));var fs=require('fs');var path=require(_0x55d2('0x7'));var rimraf=require(_0x55d2('0x8'));var config=require(_0x55d2('0x9'));var attributes=require(_0x55d2('0xa'));module['exports']=function(_0x2a21f7,_0x5d248f){return _0x2a21f7[_0x55d2('0xb')]('DashboardItem',attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9222=['define','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./dashboardItem.attributes'];(function(_0x1c7e29,_0x54de44){var _0x590370=function(_0x400f12){while(--_0x400f12){_0x1c7e29['push'](_0x1c7e29['shift']());}};_0x590370(++_0x54de44);}(_0x9222,0x97));var _0x2922=function(_0x3700f5,_0x1bf967){_0x3700f5=_0x3700f5-0x0;var _0x32d8ab=_0x9222[_0x3700f5];return _0x32d8ab;};'use strict';var _=require(_0x2922('0x0'));var util=require(_0x2922('0x1'));var logger=require(_0x2922('0x2'))(_0x2922('0x3'));var moment=require('moment');var BPromise=require(_0x2922('0x4'));var rp=require(_0x2922('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2922('0x6'));var config=require(_0x2922('0x7'));var attributes=require(_0x2922('0x8'));module['exports']=function(_0x3c3ffa,_0xa7877f){return _0x3c3ffa[_0x2922('0x9')]('DashboardItem',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 42a6edf..5eef317 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 _0x6bbd=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./dashboardItem.socket','register','then','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DashboardItem,\x20%s,\x20%s','info','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x6bbd,0xc4));var _0xd6bb=function(_0x24f22d,_0x1f6649){_0x24f22d=_0x24f22d-0x0;var _0x321679=_0x6bbd[_0x24f22d];return _0x321679;};'use strict';var _=require('lodash');var util=require(_0xd6bb('0x0'));var moment=require(_0xd6bb('0x1'));var BPromise=require(_0xd6bb('0x2'));var rs=require(_0xd6bb('0x3'));var fs=require('fs');var Redis=require(_0xd6bb('0x4'));var db=require(_0xd6bb('0x5'))['db'];var utils=require(_0xd6bb('0x6'));var logger=require(_0xd6bb('0x7'))(_0xd6bb('0x8'));var config=require(_0xd6bb('0x9'));var jayson=require(_0xd6bb('0xa'));var client=jayson[_0xd6bb('0xb')][_0xd6bb('0xc')]({'port':0x232a});config['redis']=_[_0xd6bb('0xd')](config[_0xd6bb('0xe')],{'host':_0xd6bb('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd6bb('0x10'))[_0xd6bb('0x11')](socket);function respondWithRpcPromise(_0x4e2cfa,_0xaa91c6,_0x553c4e){return new BPromise(function(_0x2f89f8,_0x1ae61d){return client['request'](_0x4e2cfa,_0x553c4e)[_0xd6bb('0x12')](function(_0x1e43c7){logger['info']('DashboardItem,\x20%s,\x20%s',_0xaa91c6,_0xd6bb('0x13'));logger[_0xd6bb('0x14')](_0xd6bb('0x15'),_0xaa91c6,_0xd6bb('0x13'),JSON[_0xd6bb('0x16')](_0x1e43c7));if(_0x1e43c7[_0xd6bb('0x17')]){if(_0x1e43c7[_0xd6bb('0x17')][_0xd6bb('0x18')]===0x1f4){logger[_0xd6bb('0x17')]('DashboardItem,\x20%s,\x20%s',_0xaa91c6,_0x1e43c7[_0xd6bb('0x17')][_0xd6bb('0x19')]);return _0x1ae61d(_0x1e43c7[_0xd6bb('0x17')]['message']);}logger[_0xd6bb('0x17')](_0xd6bb('0x1a'),_0xaa91c6,_0x1e43c7[_0xd6bb('0x17')][_0xd6bb('0x19')]);return _0x2f89f8(_0x1e43c7[_0xd6bb('0x17')][_0xd6bb('0x19')]);}else{logger[_0xd6bb('0x1b')](_0xd6bb('0x1a'),_0xaa91c6,_0xd6bb('0x13'));_0x2f89f8(_0x1e43c7[_0xd6bb('0x1c')]['message']);}})['catch'](function(_0x2a1082){logger[_0xd6bb('0x17')](_0xd6bb('0x1a'),_0xaa91c6,_0x2a1082);_0x1ae61d(_0x2a1082);});});} \ No newline at end of file +var _0xc277=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','./dashboardItem.socket','register','request','then','DashboardItem,\x20%s,\x20%s','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1c59a2,_0x5ae06f){var _0x3f1303=function(_0x194c23){while(--_0x194c23){_0x1c59a2['push'](_0x1c59a2['shift']());}};_0x3f1303(++_0x5ae06f);}(_0xc277,0xd1));var _0x7c27=function(_0x2d8e85,_0xd77781){_0x2d8e85=_0x2d8e85-0x0;var _0x381739=_0xc277[_0x2d8e85];return _0x381739;};'use strict';var _=require(_0x7c27('0x0'));var util=require(_0x7c27('0x1'));var moment=require(_0x7c27('0x2'));var BPromise=require(_0x7c27('0x3'));var rs=require(_0x7c27('0x4'));var fs=require('fs');var Redis=require(_0x7c27('0x5'));var db=require(_0x7c27('0x6'))['db'];var utils=require(_0x7c27('0x7'));var logger=require(_0x7c27('0x8'))(_0x7c27('0x9'));var config=require(_0x7c27('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x7c27('0xb')][_0x7c27('0xc')]({'port':0x232a});config['redis']=_[_0x7c27('0xd')](config[_0x7c27('0xe')],{'host':_0x7c27('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7c27('0xe')]));require(_0x7c27('0x10'))[_0x7c27('0x11')](socket);function respondWithRpcPromise(_0x122b3e,_0x2d29b9,_0x584e44){return new BPromise(function(_0x383fc1,_0x31b06e){return client[_0x7c27('0x12')](_0x122b3e,_0x584e44)[_0x7c27('0x13')](function(_0x2160c5){logger['info'](_0x7c27('0x14'),_0x2d29b9,'request\x20sent');logger['debug'](_0x7c27('0x15'),_0x2d29b9,_0x7c27('0x16'),JSON['stringify'](_0x2160c5));if(_0x2160c5[_0x7c27('0x17')]){if(_0x2160c5[_0x7c27('0x17')][_0x7c27('0x18')]===0x1f4){logger[_0x7c27('0x17')](_0x7c27('0x14'),_0x2d29b9,_0x2160c5[_0x7c27('0x17')][_0x7c27('0x19')]);return _0x31b06e(_0x2160c5[_0x7c27('0x17')][_0x7c27('0x19')]);}logger[_0x7c27('0x17')]('DashboardItem,\x20%s,\x20%s',_0x2d29b9,_0x2160c5[_0x7c27('0x17')][_0x7c27('0x19')]);return _0x383fc1(_0x2160c5[_0x7c27('0x17')][_0x7c27('0x19')]);}else{logger[_0x7c27('0x1a')](_0x7c27('0x14'),_0x2d29b9,_0x7c27('0x16'));_0x383fc1(_0x2160c5['result'][_0x7c27('0x19')]);}})['catch'](function(_0x3c9443){logger['error'](_0x7c27('0x14'),_0x2d29b9,_0x3c9443);_0x31b06e(_0x3c9443);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 839c8fc..9bb97a9 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 _0x240d=['register','length','dashboardItem:','./dashboardItem.events','remove','update','emit','removeListener'];(function(_0x1a6329,_0x6113fd){var _0x3d5d47=function(_0x2a9bff){while(--_0x2a9bff){_0x1a6329['push'](_0x1a6329['shift']());}};_0x3d5d47(++_0x6113fd);}(_0x240d,0xc3));var _0xd240=function(_0x37db6a,_0x590bc6){_0x37db6a=_0x37db6a-0x0;var _0x3b4661=_0x240d[_0x37db6a];return _0x3b4661;};'use strict';var DashboardItemEvents=require(_0xd240('0x0'));var events=['save',_0xd240('0x1'),_0xd240('0x2')];function createListener(_0xe32c81,_0xef2203){return function(_0x5970b7){_0xef2203[_0xd240('0x3')](_0xe32c81,_0x5970b7);};}function removeListener(_0x4ea9f6,_0x2d8ca3){return function(){DashboardItemEvents[_0xd240('0x4')](_0x4ea9f6,_0x2d8ca3);};}exports[_0xd240('0x5')]=function(_0xdcf94c){for(var _0xedac8b=0x0,_0x5b76ca=events[_0xd240('0x6')];_0xedac8b<_0x5b76ca;_0xedac8b++){var _0x28865d=events[_0xedac8b];var _0x429850=createListener(_0xd240('0x7')+_0x28865d,_0xdcf94c);DashboardItemEvents['on'](_0x28865d,_0x429850);}}; \ No newline at end of file +var _0x62a7=['emit','removeListener','length','dashboardItem:','./dashboardItem.events','save','update'];(function(_0x545dcc,_0x36d627){var _0x2fd84d=function(_0x1c688c){while(--_0x1c688c){_0x545dcc['push'](_0x545dcc['shift']());}};_0x2fd84d(++_0x36d627);}(_0x62a7,0x18c));var _0x762a=function(_0x67e9ca,_0x419250){_0x67e9ca=_0x67e9ca-0x0;var _0x1b81d6=_0x62a7[_0x67e9ca];return _0x1b81d6;};'use strict';var DashboardItemEvents=require(_0x762a('0x0'));var events=[_0x762a('0x1'),'remove',_0x762a('0x2')];function createListener(_0x3bbbc9,_0x38da63){return function(_0x41d1ee){_0x38da63[_0x762a('0x3')](_0x3bbbc9,_0x41d1ee);};}function removeListener(_0x12167e,_0x1041c6){return function(){DashboardItemEvents[_0x762a('0x4')](_0x12167e,_0x1041c6);};}exports['register']=function(_0x5e3281){for(var _0x217256=0x0,_0x56b02d=events[_0x762a('0x5')];_0x217256<_0x56b02d;_0x217256++){var _0x3932be=events[_0x217256];var _0xdb3cac=createListener(_0x762a('0x6')+_0x3932be,_0x5e3281);DashboardItemEvents['on'](_0x3932be,_0xdb3cac);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 016a613..2fcfca0 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 _0x31d3=['multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./dashboardItem.controller','get','/:id','isAuthenticated','show','put','update','delete'];(function(_0x1fc699,_0x41a3cf){var _0x503525=function(_0x2fb8fd){while(--_0x2fb8fd){_0x1fc699['push'](_0x1fc699['shift']());}};_0x503525(++_0x41a3cf);}(_0x31d3,0x1b3));var _0x331d=function(_0x186d17,_0x9fa8ef){_0x186d17=_0x186d17-0x0;var _0x5d4b89=_0x31d3[_0x186d17];return _0x5d4b89;};'use strict';var multer=require(_0x331d('0x0'));var util=require(_0x331d('0x1'));var path=require(_0x331d('0x2'));var timeout=require(_0x331d('0x3'));var express=require('express');var router=express[_0x331d('0x4')]();var fs_extra=require(_0x331d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x331d('0x6'));var config=require('../../config/environment');var controller=require(_0x331d('0x7'));router[_0x331d('0x8')](_0x331d('0x9'),auth[_0x331d('0xa')](),controller[_0x331d('0xb')]);router['post']('/',auth[_0x331d('0xa')](),controller['create']);router[_0x331d('0xc')](_0x331d('0x9'),auth[_0x331d('0xa')](),controller[_0x331d('0xd')]);router[_0x331d('0xe')](_0x331d('0x9'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd5a6=['put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','show','post'];(function(_0x46ecbe,_0x2135e5){var _0x4818a6=function(_0x11e37b){while(--_0x11e37b){_0x46ecbe['push'](_0x46ecbe['shift']());}};_0x4818a6(++_0x2135e5);}(_0xd5a6,0x16e));var _0x6d5a=function(_0x16f661,_0xc4ed88){_0x16f661=_0x16f661-0x0;var _0x4d2c49=_0xd5a6[_0x16f661];return _0x4d2c49;};'use strict';var multer=require(_0x6d5a('0x0'));var util=require('util');var path=require(_0x6d5a('0x1'));var timeout=require(_0x6d5a('0x2'));var express=require(_0x6d5a('0x3'));var router=express[_0x6d5a('0x4')]();var fs_extra=require(_0x6d5a('0x5'));var auth=require(_0x6d5a('0x6'));var interaction=require(_0x6d5a('0x7'));var config=require(_0x6d5a('0x8'));var controller=require('./dashboardItem.controller');router['get']('/:id',auth[_0x6d5a('0x9')](),controller[_0x6d5a('0xa')]);router[_0x6d5a('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6d5a('0xc')](_0x6d5a('0xd'),auth[_0x6d5a('0x9')](),controller[_0x6d5a('0xe')]);router[_0x6d5a('0xf')](_0x6d5a('0xd'),auth[_0x6d5a('0x9')](),controller[_0x6d5a('0x10')]);module[_0x6d5a('0x11')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index f45166c..d01d7f0 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 _0xd324=['second','third','exports','STRING','first'];(function(_0x14eee6,_0x4f77e4){var _0x11e937=function(_0x1ff1db){while(--_0x1ff1db){_0x14eee6['push'](_0x14eee6['shift']());}};_0x11e937(++_0x4f77e4);}(_0xd324,0xa2));var _0x4d32=function(_0x4191bc,_0x3096c5){_0x4191bc=_0x4191bc-0x0;var _0x1ffd4e=_0xd324[_0x4191bc];return _0x1ffd4e;};'use strict';var Sequelize=require('sequelize');module[_0x4d32('0x0')]={'name':{'type':Sequelize[_0x4d32('0x1')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0x4d32('0x2'),_0x4d32('0x3'),_0x4d32('0x4')),'allowNull':![],'defaultValue':_0x4d32('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd9d8=['second','third','first','exports','STRING'];(function(_0x20c47c,_0x443272){var _0x1cfcd7=function(_0x144ced){while(--_0x144ced){_0x20c47c['push'](_0x20c47c['shift']());}};_0x1cfcd7(++_0x443272);}(_0xd9d8,0xe9));var _0x8d9d=function(_0x58ebd2,_0xefcf97){_0x58ebd2=_0x58ebd2-0x0;var _0x3b074e=_0xd9d8[_0x58ebd2];return _0x3b074e;};'use strict';var Sequelize=require('sequelize');module[_0x8d9d('0x0')]={'name':{'type':Sequelize[_0x8d9d('0x1')],'allowNull':![]},'level':{'type':Sequelize['ENUM']('first',_0x8d9d('0x2'),_0x8d9d('0x3')),'allowNull':![],'defaultValue':_0x8d9d('0x4')},'description':{'type':Sequelize[_0x8d9d('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index c470e55..1db474f 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 _0xffde=['bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','then','destroy','Dispositions','UserProfileResource','error','name','map','Disposition','rawAttributes','fieldName','type','key','keys','filters','intersection','query','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','length','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x5c5b2d,_0x1e18f6){var _0x232492=function(_0x5910cc){while(--_0x5910cc){_0x5c5b2d['push'](_0x5c5b2d['shift']());}};_0x232492(++_0x1e18f6);}(_0xffde,0x9f));var _0xeffd=function(_0x207996,_0x36e9b1){_0x207996=_0x207996-0x0;var _0x37e526=_0xffde[_0x207996];return _0x37e526;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeffd('0x0'));var zipdir=require(_0xeffd('0x1'));var jsonpatch=require(_0xeffd('0x2'));var rp=require(_0xeffd('0x3'));var moment=require(_0xeffd('0x4'));var BPromise=require(_0xeffd('0x5'));var Mustache=require(_0xeffd('0x6'));var util=require(_0xeffd('0x7'));var path=require('path');var sox=require(_0xeffd('0x8'));var csv=require(_0xeffd('0x9'));var ejs=require(_0xeffd('0xa'));var fs=require('fs');var fs_extra=require(_0xeffd('0xb'));var _=require(_0xeffd('0xc'));var squel=require(_0xeffd('0xd'));var crypto=require('crypto');var jsforce=require(_0xeffd('0xe'));var deskjs=require(_0xeffd('0xf'));var toCsv=require(_0xeffd('0x9'));var querystring=require(_0xeffd('0x10'));var Papa=require(_0xeffd('0x11'));var Redis=require(_0xeffd('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xeffd('0x13'));var as=require(_0xeffd('0x14'));var hardwareService=require(_0xeffd('0x15'));var logger=require(_0xeffd('0x16'))(_0xeffd('0x17'));var utils=require(_0xeffd('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xeffd('0x19'));var db=require(_0xeffd('0x1a'))['db'];function respondWithStatusCode(_0x13f59a,_0x4945d4){_0x4945d4=_0x4945d4||0xcc;return function(_0x4c0a87){if(_0x4c0a87){return _0x13f59a[_0xeffd('0x1b')](_0x4945d4);}return _0x13f59a['status'](_0x4945d4)[_0xeffd('0x1c')]();};}function respondWithResult(_0x2b53aa,_0x1651a1){_0x1651a1=_0x1651a1||0xc8;return function(_0x346de3){if(_0x346de3){return _0x2b53aa[_0xeffd('0x1d')](_0x1651a1)[_0xeffd('0x1e')](_0x346de3);}};}function respondWithFilteredResult(_0x2f45ba,_0x41f77d){return function(_0x40d2c1){if(_0x40d2c1){var _0x3943b8=typeof _0x41f77d[_0xeffd('0x1f')]==='undefined'&&typeof _0x41f77d[_0xeffd('0x20')]===_0xeffd('0x21');var _0x4bbbe0=_0x40d2c1[_0xeffd('0x22')];var _0x1fd60f=_0x3943b8?0x0:_0x41f77d[_0xeffd('0x1f')];var _0x4625b5=_0x3943b8?_0x40d2c1[_0xeffd('0x22')]:_0x41f77d[_0xeffd('0x1f')]+_0x41f77d[_0xeffd('0x20')];var _0x10e3f7;if(_0x4625b5>=_0x4bbbe0){_0x4625b5=_0x4bbbe0;_0x10e3f7=0xc8;}else{_0x10e3f7=0xce;}_0x2f45ba[_0xeffd('0x1d')](_0x10e3f7);return _0x2f45ba[_0xeffd('0x23')](_0xeffd('0x24'),_0x1fd60f+'-'+_0x4625b5+'/'+_0x4bbbe0)[_0xeffd('0x1e')](_0x40d2c1);}return null;};}function patchUpdates(_0x67efa4){return function(_0x58dc3e){try{jsonpatch[_0xeffd('0x25')](_0x58dc3e,_0x67efa4,!![]);}catch(_0x1f000e){return BPromise['reject'](_0x1f000e);}return _0x58dc3e['save']();};}function saveUpdates(_0x5bbea2,_0x489b0b){return function(_0x47a701){if(_0x47a701){return _0x47a701['update'](_0x5bbea2)[_0xeffd('0x26')](function(_0x4631dd){return _0x4631dd;});}return null;};}function removeEntity(_0x2d053b,_0x2028a1){return function(_0x3b921f){if(_0x3b921f){return _0x3b921f[_0xeffd('0x27')]()[_0xeffd('0x26')](function(){var _0x3774ce=_0x3b921f['get']({'plain':!![]});var _0x3f38a1=_0xeffd('0x28');return db[_0xeffd('0x29')][_0xeffd('0x27')]({'where':{'type':_0x3f38a1,'resourceId':_0x3774ce['id']}})['then'](function(){return _0x3b921f;});})[_0xeffd('0x26')](function(){_0x2d053b[_0xeffd('0x1d')](0xcc)[_0xeffd('0x1c')]();});}};}function handleEntityNotFound(_0x5b8108,_0x543a87){return function(_0x1fe580){if(!_0x1fe580){_0x5b8108[_0xeffd('0x1b')](0x194);}return _0x1fe580;};}function handleError(_0x391aff,_0x3f6b92){_0x3f6b92=_0x3f6b92||0x1f4;return function(_0x5b7084){logger[_0xeffd('0x2a')](_0x5b7084['stack']);if(_0x5b7084[_0xeffd('0x2b')]){delete _0x5b7084['name'];}_0x391aff[_0xeffd('0x1d')](_0x3f6b92)['send'](_0x5b7084);};}exports['index']=function(_0x4831b9,_0x100dc1){var _0x2f2e0f={},_0x3845ac={},_0x30a768={'count':0x0,'rows':[]};var _0x430602=_[_0xeffd('0x2c')](db[_0xeffd('0x2d')][_0xeffd('0x2e')],function(_0x403123){return{'name':_0x403123[_0xeffd('0x2f')],'type':_0x403123[_0xeffd('0x30')][_0xeffd('0x31')]};});_0x3845ac['model']=_[_0xeffd('0x2c')](_0x430602,'name');_0x3845ac['query']=_[_0xeffd('0x32')](_0x4831b9['query']);_0x3845ac[_0xeffd('0x33')]=_[_0xeffd('0x34')](_0x3845ac['model'],_0x3845ac[_0xeffd('0x35')]);_0x2f2e0f[_0xeffd('0x36')]=_[_0xeffd('0x34')](_0x3845ac[_0xeffd('0x37')],qs[_0xeffd('0x38')](_0x4831b9[_0xeffd('0x35')][_0xeffd('0x38')]));_0x2f2e0f[_0xeffd('0x36')]=_0x2f2e0f['attributes']['length']?_0x2f2e0f[_0xeffd('0x36')]:_0x3845ac['model'];if(!_0x4831b9[_0xeffd('0x35')][_0xeffd('0x39')](_0xeffd('0x3a'))){_0x2f2e0f[_0xeffd('0x20')]=qs[_0xeffd('0x20')](_0x4831b9[_0xeffd('0x35')][_0xeffd('0x20')]);_0x2f2e0f[_0xeffd('0x1f')]=qs[_0xeffd('0x1f')](_0x4831b9['query'][_0xeffd('0x1f')]);}_0x2f2e0f[_0xeffd('0x3b')]=qs['sort'](_0x4831b9['query'][_0xeffd('0x3c')]);_0x2f2e0f[_0xeffd('0x3d')]=qs['filters'](_['pick'](_0x4831b9[_0xeffd('0x35')],_0x3845ac[_0xeffd('0x33')]),_0x430602);if(_0x4831b9['query'][_0xeffd('0x3e')]){_0x2f2e0f[_0xeffd('0x3d')]=_['merge'](_0x2f2e0f['where'],{'$or':_[_0xeffd('0x2c')](_0x430602,function(_0xb6f8eb){if(_0xb6f8eb[_0xeffd('0x30')]!==_0xeffd('0x3f')){var _0xc674a7={};_0xc674a7[_0xb6f8eb[_0xeffd('0x2b')]]={'$like':'%'+_0x4831b9[_0xeffd('0x35')][_0xeffd('0x3e')]+'%'};return _0xc674a7;}})});}_0x2f2e0f=_[_0xeffd('0x40')]({},_0x2f2e0f,_0x4831b9['options']);var _0x57d7a3={'where':_0x2f2e0f[_0xeffd('0x3d')]};return db[_0xeffd('0x2d')][_0xeffd('0x22')](_0x57d7a3)[_0xeffd('0x26')](function(_0x3c6dba){_0x30a768[_0xeffd('0x22')]=_0x3c6dba;if(_0x4831b9[_0xeffd('0x35')][_0xeffd('0x41')]){_0x2f2e0f[_0xeffd('0x42')]=[{'all':!![]}];}return db[_0xeffd('0x2d')][_0xeffd('0x43')](_0x2f2e0f);})[_0xeffd('0x26')](function(_0x15ea62){_0x30a768[_0xeffd('0x44')]=_0x15ea62;return _0x30a768;})[_0xeffd('0x26')](respondWithFilteredResult(_0x100dc1,_0x2f2e0f))[_0xeffd('0x45')](handleError(_0x100dc1,null));};exports[_0xeffd('0x46')]=function(_0x2c16b8,_0x411bfc){var _0x4c419a={'raw':!![],'where':{'id':_0x2c16b8['params']['id']}},_0x40d712={};_0x40d712[_0xeffd('0x37')]=_[_0xeffd('0x32')](db[_0xeffd('0x2d')][_0xeffd('0x2e')]);_0x40d712[_0xeffd('0x35')]=_[_0xeffd('0x32')](_0x2c16b8[_0xeffd('0x35')]);_0x40d712[_0xeffd('0x33')]=_['intersection'](_0x40d712[_0xeffd('0x37')],_0x40d712[_0xeffd('0x35')]);_0x4c419a[_0xeffd('0x36')]=_[_0xeffd('0x34')](_0x40d712[_0xeffd('0x37')],qs[_0xeffd('0x38')](_0x2c16b8[_0xeffd('0x35')][_0xeffd('0x38')]));_0x4c419a[_0xeffd('0x36')]=_0x4c419a['attributes'][_0xeffd('0x47')]?_0x4c419a[_0xeffd('0x36')]:_0x40d712[_0xeffd('0x37')];if(_0x2c16b8['query']['includeAll']){_0x4c419a['include']=[{'all':!![]}];}_0x4c419a=_['merge']({},_0x4c419a,_0x2c16b8['options']);return db[_0xeffd('0x2d')][_0xeffd('0x48')](_0x4c419a)['then'](handleEntityNotFound(_0x411bfc,null))['then'](respondWithResult(_0x411bfc,null))[_0xeffd('0x45')](handleError(_0x411bfc,null));};exports['create']=function(_0x57dd3f,_0x185d6b){return db[_0xeffd('0x2d')][_0xeffd('0x49')](_0x57dd3f['body'],{})['then'](function(_0x3822ff){var _0x5d3f73=_0x57dd3f['user']['get']({'plain':!![]});if(!_0x5d3f73)throw new Error(_0xeffd('0x4a'));if(_0x5d3f73[_0xeffd('0x4b')]===_0xeffd('0x4c')){var _0x377d29=_0x3822ff[_0xeffd('0x4d')]({'plain':!![]});var _0x30dc22=_0xeffd('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x30dc22,'userProfileId':_0x5d3f73[_0xeffd('0x4e')]},'raw':!![]})[_0xeffd('0x26')](function(_0x44b01d){if(_0x44b01d&&_0x44b01d['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x377d29[_0xeffd('0x2b')],'resourceId':_0x377d29['id'],'type':_0x44b01d[_0xeffd('0x2b')],'sectionId':_0x44b01d['id']},{})[_0xeffd('0x26')](function(){return _0x3822ff;});}else{return _0x3822ff;}})[_0xeffd('0x45')](function(_0x55bb9e){logger[_0xeffd('0x2a')](_0xeffd('0x4f'),_0x55bb9e);throw _0x55bb9e;});}return _0x3822ff;})['then'](respondWithResult(_0x185d6b,0xc9))[_0xeffd('0x45')](handleError(_0x185d6b,null));};exports['update']=function(_0x5bb85b,_0x4d8750){if(_0x5bb85b[_0xeffd('0x50')]['id']){delete _0x5bb85b[_0xeffd('0x50')]['id'];}return db[_0xeffd('0x2d')][_0xeffd('0x48')]({'where':{'id':_0x5bb85b[_0xeffd('0x51')]['id']}})[_0xeffd('0x26')](handleEntityNotFound(_0x4d8750,null))[_0xeffd('0x26')](saveUpdates(_0x5bb85b[_0xeffd('0x50')],null))[_0xeffd('0x26')](respondWithResult(_0x4d8750,null))[_0xeffd('0x45')](handleError(_0x4d8750,null));};exports[_0xeffd('0x27')]=function(_0x120ec5,_0xd4bb31){return db['Disposition'][_0xeffd('0x48')]({'where':{'id':_0x120ec5[_0xeffd('0x51')]['id']}})[_0xeffd('0x26')](handleEntityNotFound(_0xd4bb31,null))[_0xeffd('0x26')](removeEntity(_0xd4bb31,null))[_0xeffd('0x45')](handleError(_0xd4bb31,null));}; \ No newline at end of file +var _0x0f9f=['body','user','role','UserProfileSection','error','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','get','Dispositions','UserProfileResource','then','end','stack','name','index','map','Disposition','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','merge','find','create'];(function(_0x52a1a7,_0x64af9d){var _0x3c0843=function(_0x596456){while(--_0x596456){_0x52a1a7['push'](_0x52a1a7['shift']());}};_0x3c0843(++_0x64af9d);}(_0x0f9f,0xae));var _0xf0f9=function(_0x22e513,_0x53d375){_0x22e513=_0x22e513-0x0;var _0x55d29b=_0x0f9f[_0x22e513];return _0x55d29b;};'use strict';var emlformat=require(_0xf0f9('0x0'));var rimraf=require(_0xf0f9('0x1'));var zipdir=require(_0xf0f9('0x2'));var jsonpatch=require(_0xf0f9('0x3'));var rp=require(_0xf0f9('0x4'));var moment=require(_0xf0f9('0x5'));var BPromise=require(_0xf0f9('0x6'));var Mustache=require(_0xf0f9('0x7'));var util=require(_0xf0f9('0x8'));var path=require(_0xf0f9('0x9'));var sox=require(_0xf0f9('0xa'));var csv=require('to-csv');var ejs=require(_0xf0f9('0xb'));var fs=require('fs');var fs_extra=require(_0xf0f9('0xc'));var _=require('lodash');var squel=require(_0xf0f9('0xd'));var crypto=require(_0xf0f9('0xe'));var jsforce=require(_0xf0f9('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xf0f9('0x10'));var querystring=require(_0xf0f9('0x11'));var Papa=require('papaparse');var Redis=require(_0xf0f9('0x12'));var authService=require(_0xf0f9('0x13'));var qs=require(_0xf0f9('0x14'));var as=require(_0xf0f9('0x15'));var hardwareService=require(_0xf0f9('0x16'));var logger=require(_0xf0f9('0x17'))(_0xf0f9('0x18'));var utils=require(_0xf0f9('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xf0f9('0x1a'));var db=require(_0xf0f9('0x1b'))['db'];function respondWithStatusCode(_0xc23039,_0x458e1c){_0x458e1c=_0x458e1c||0xcc;return function(_0x5b0fa7){if(_0x5b0fa7){return _0xc23039[_0xf0f9('0x1c')](_0x458e1c);}return _0xc23039[_0xf0f9('0x1d')](_0x458e1c)['end']();};}function respondWithResult(_0x334c39,_0x519adf){_0x519adf=_0x519adf||0xc8;return function(_0x538864){if(_0x538864){return _0x334c39[_0xf0f9('0x1d')](_0x519adf)['json'](_0x538864);}};}function respondWithFilteredResult(_0x3e1587,_0x516717){return function(_0x3c23ec){if(_0x3c23ec){var _0x336483=typeof _0x516717[_0xf0f9('0x1e')]===_0xf0f9('0x1f')&&typeof _0x516717[_0xf0f9('0x20')]===_0xf0f9('0x1f');var _0x10dae6=_0x3c23ec['count'];var _0x44d248=_0x336483?0x0:_0x516717[_0xf0f9('0x1e')];var _0x43de16=_0x336483?_0x3c23ec[_0xf0f9('0x21')]:_0x516717[_0xf0f9('0x1e')]+_0x516717[_0xf0f9('0x20')];var _0x1765ad;if(_0x43de16>=_0x10dae6){_0x43de16=_0x10dae6;_0x1765ad=0xc8;}else{_0x1765ad=0xce;}_0x3e1587[_0xf0f9('0x1d')](_0x1765ad);return _0x3e1587['set'](_0xf0f9('0x22'),_0x44d248+'-'+_0x43de16+'/'+_0x10dae6)['json'](_0x3c23ec);}return null;};}function patchUpdates(_0x3664ff){return function(_0x510119){try{jsonpatch[_0xf0f9('0x23')](_0x510119,_0x3664ff,!![]);}catch(_0x1d5965){return BPromise[_0xf0f9('0x24')](_0x1d5965);}return _0x510119[_0xf0f9('0x25')]();};}function saveUpdates(_0xaff53c,_0x1b9740){return function(_0x49bddc){if(_0x49bddc){return _0x49bddc[_0xf0f9('0x26')](_0xaff53c)['then'](function(_0x2cb8f8){return _0x2cb8f8;});}return null;};}function removeEntity(_0x21dd05,_0x55ba89){return function(_0x217a15){if(_0x217a15){return _0x217a15[_0xf0f9('0x27')]()['then'](function(){var _0xbbccd9=_0x217a15[_0xf0f9('0x28')]({'plain':!![]});var _0xa0b46e=_0xf0f9('0x29');return db[_0xf0f9('0x2a')][_0xf0f9('0x27')]({'where':{'type':_0xa0b46e,'resourceId':_0xbbccd9['id']}})['then'](function(){return _0x217a15;});})[_0xf0f9('0x2b')](function(){_0x21dd05['status'](0xcc)[_0xf0f9('0x2c')]();});}};}function handleEntityNotFound(_0x2e3fbc,_0x2e3c96){return function(_0x14e40f){if(!_0x14e40f){_0x2e3fbc['sendStatus'](0x194);}return _0x14e40f;};}function handleError(_0x100543,_0x423d89){_0x423d89=_0x423d89||0x1f4;return function(_0x477eb0){logger['error'](_0x477eb0[_0xf0f9('0x2d')]);if(_0x477eb0[_0xf0f9('0x2e')]){delete _0x477eb0['name'];}_0x100543[_0xf0f9('0x1d')](_0x423d89)['send'](_0x477eb0);};}exports[_0xf0f9('0x2f')]=function(_0xe6cc2d,_0x280681){var _0x32003e={},_0x1f0c1f={},_0x2d437d={'count':0x0,'rows':[]};var _0x428582=_[_0xf0f9('0x30')](db[_0xf0f9('0x31')][_0xf0f9('0x32')],function(_0x53f109){return{'name':_0x53f109[_0xf0f9('0x33')],'type':_0x53f109[_0xf0f9('0x34')]['key']};});_0x1f0c1f['model']=_[_0xf0f9('0x30')](_0x428582,_0xf0f9('0x2e'));_0x1f0c1f[_0xf0f9('0x35')]=_[_0xf0f9('0x36')](_0xe6cc2d[_0xf0f9('0x35')]);_0x1f0c1f[_0xf0f9('0x37')]=_[_0xf0f9('0x38')](_0x1f0c1f['model'],_0x1f0c1f[_0xf0f9('0x35')]);_0x32003e['attributes']=_[_0xf0f9('0x38')](_0x1f0c1f[_0xf0f9('0x39')],qs[_0xf0f9('0x3a')](_0xe6cc2d['query'][_0xf0f9('0x3a')]));_0x32003e['attributes']=_0x32003e[_0xf0f9('0x3b')]['length']?_0x32003e['attributes']:_0x1f0c1f[_0xf0f9('0x39')];if(!_0xe6cc2d[_0xf0f9('0x35')][_0xf0f9('0x3c')](_0xf0f9('0x3d'))){_0x32003e[_0xf0f9('0x20')]=qs[_0xf0f9('0x20')](_0xe6cc2d['query']['limit']);_0x32003e[_0xf0f9('0x1e')]=qs[_0xf0f9('0x1e')](_0xe6cc2d[_0xf0f9('0x35')]['offset']);}_0x32003e['order']=qs[_0xf0f9('0x3e')](_0xe6cc2d['query'][_0xf0f9('0x3e')]);_0x32003e[_0xf0f9('0x3f')]=qs[_0xf0f9('0x37')](_[_0xf0f9('0x40')](_0xe6cc2d['query'],_0x1f0c1f[_0xf0f9('0x37')]),_0x428582);if(_0xe6cc2d[_0xf0f9('0x35')][_0xf0f9('0x41')]){_0x32003e[_0xf0f9('0x3f')]=_['merge'](_0x32003e['where'],{'$or':_['map'](_0x428582,function(_0x46e91e){if(_0x46e91e[_0xf0f9('0x34')]!==_0xf0f9('0x42')){var _0x1afe68={};_0x1afe68[_0x46e91e[_0xf0f9('0x2e')]]={'$like':'%'+_0xe6cc2d[_0xf0f9('0x35')][_0xf0f9('0x41')]+'%'};return _0x1afe68;}})});}_0x32003e=_['merge']({},_0x32003e,_0xe6cc2d[_0xf0f9('0x43')]);var _0x472264={'where':_0x32003e[_0xf0f9('0x3f')]};return db[_0xf0f9('0x31')][_0xf0f9('0x21')](_0x472264)[_0xf0f9('0x2b')](function(_0x4eb772){_0x2d437d[_0xf0f9('0x21')]=_0x4eb772;if(_0xe6cc2d['query'][_0xf0f9('0x44')]){_0x32003e[_0xf0f9('0x45')]=[{'all':!![]}];}return db[_0xf0f9('0x31')][_0xf0f9('0x46')](_0x32003e);})[_0xf0f9('0x2b')](function(_0x574364){_0x2d437d[_0xf0f9('0x47')]=_0x574364;return _0x2d437d;})['then'](respondWithFilteredResult(_0x280681,_0x32003e))[_0xf0f9('0x48')](handleError(_0x280681,null));};exports[_0xf0f9('0x49')]=function(_0x2c85f3,_0x46408b){var _0x330f10={'raw':!![],'where':{'id':_0x2c85f3['params']['id']}},_0x204751={};_0x204751[_0xf0f9('0x39')]=_[_0xf0f9('0x36')](db[_0xf0f9('0x31')]['rawAttributes']);_0x204751[_0xf0f9('0x35')]=_['keys'](_0x2c85f3[_0xf0f9('0x35')]);_0x204751['filters']=_['intersection'](_0x204751['model'],_0x204751['query']);_0x330f10[_0xf0f9('0x3b')]=_['intersection'](_0x204751[_0xf0f9('0x39')],qs[_0xf0f9('0x3a')](_0x2c85f3['query'][_0xf0f9('0x3a')]));_0x330f10[_0xf0f9('0x3b')]=_0x330f10[_0xf0f9('0x3b')][_0xf0f9('0x4a')]?_0x330f10[_0xf0f9('0x3b')]:_0x204751['model'];if(_0x2c85f3[_0xf0f9('0x35')][_0xf0f9('0x44')]){_0x330f10[_0xf0f9('0x45')]=[{'all':!![]}];}_0x330f10=_[_0xf0f9('0x4b')]({},_0x330f10,_0x2c85f3['options']);return db[_0xf0f9('0x31')][_0xf0f9('0x4c')](_0x330f10)[_0xf0f9('0x2b')](handleEntityNotFound(_0x46408b,null))[_0xf0f9('0x2b')](respondWithResult(_0x46408b,null))[_0xf0f9('0x48')](handleError(_0x46408b,null));};exports[_0xf0f9('0x4d')]=function(_0x3dd389,_0x299cec){return db[_0xf0f9('0x31')][_0xf0f9('0x4d')](_0x3dd389[_0xf0f9('0x4e')],{})[_0xf0f9('0x2b')](function(_0x499129){var _0x7dfb7b=_0x3dd389[_0xf0f9('0x4f')][_0xf0f9('0x28')]({'plain':!![]});if(!_0x7dfb7b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x7dfb7b[_0xf0f9('0x50')]===_0xf0f9('0x4f')){var _0xa003e7=_0x499129[_0xf0f9('0x28')]({'plain':!![]});var _0x25bdcd=_0xf0f9('0x29');return db[_0xf0f9('0x51')][_0xf0f9('0x4c')]({'where':{'name':_0x25bdcd,'userProfileId':_0x7dfb7b['userProfileId']},'raw':!![]})[_0xf0f9('0x2b')](function(_0x14280e){if(_0x14280e&&_0x14280e['autoAssociation']===0x0){return db[_0xf0f9('0x2a')][_0xf0f9('0x4d')]({'name':_0xa003e7[_0xf0f9('0x2e')],'resourceId':_0xa003e7['id'],'type':_0x14280e[_0xf0f9('0x2e')],'sectionId':_0x14280e['id']},{})['then'](function(){return _0x499129;});}else{return _0x499129;}})[_0xf0f9('0x48')](function(_0xee854d){logger[_0xf0f9('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xee854d);throw _0xee854d;});}return _0x499129;})[_0xf0f9('0x2b')](respondWithResult(_0x299cec,0xc9))['catch'](handleError(_0x299cec,null));};exports[_0xf0f9('0x26')]=function(_0x6ea364,_0x364333){if(_0x6ea364[_0xf0f9('0x4e')]['id']){delete _0x6ea364[_0xf0f9('0x4e')]['id'];}return db['Disposition'][_0xf0f9('0x4c')]({'where':{'id':_0x6ea364[_0xf0f9('0x53')]['id']}})[_0xf0f9('0x2b')](handleEntityNotFound(_0x364333,null))[_0xf0f9('0x2b')](saveUpdates(_0x6ea364[_0xf0f9('0x4e')],null))[_0xf0f9('0x2b')](respondWithResult(_0x364333,null))[_0xf0f9('0x48')](handleError(_0x364333,null));};exports[_0xf0f9('0x27')]=function(_0xf24b47,_0x266cca){return db['Disposition'][_0xf0f9('0x4c')]({'where':{'id':_0xf24b47['params']['id']}})[_0xf0f9('0x2b')](handleEntityNotFound(_0x266cca,null))[_0xf0f9('0x2b')](removeEntity(_0x266cca,null))[_0xf0f9('0x48')](handleError(_0x266cca,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 1e89231..556b5bd 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 _0x53aa=['name_chat','name','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','FaxAccountId','name_openchannel','name_whatsapp','WhatsappAccountId','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','ListId'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x53aa,0x19b));var _0xa53a=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x53aa[_0x5f309e];return _0x487b5e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa53a('0x0'))(_0xa53a('0x1'));var moment=require(_0xa53a('0x2'));var BPromise=require('bluebird');var rp=require(_0xa53a('0x3'));var fs=require('fs');var path=require(_0xa53a('0x4'));var rimraf=require(_0xa53a('0x5'));var config=require(_0xa53a('0x6'));var attributes=require(_0xa53a('0x7'));module[_0xa53a('0x8')]=function(_0x2458f3,_0x1d2f58){return _0x2458f3[_0xa53a('0x9')](_0xa53a('0xa'),attributes,{'tableName':_0xa53a('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xa53a('0xc'),'fields':['name',_0xa53a('0xd')]},{'unique':!![],'name':_0xa53a('0xe'),'fields':[_0xa53a('0xf'),_0xa53a('0x10')]},{'unique':!![],'name':_0xa53a('0x11'),'fields':[_0xa53a('0xf'),_0xa53a('0x12')]},{'unique':!![],'name':_0xa53a('0x13'),'fields':[_0xa53a('0xf'),_0xa53a('0x14')]},{'unique':!![],'name':'name_fax','fields':[_0xa53a('0xf'),_0xa53a('0x15')]},{'unique':!![],'name':_0xa53a('0x16'),'fields':['name','OpenchannelAccountId']},{'unique':!![],'name':_0xa53a('0x17'),'fields':[_0xa53a('0xf'),_0xa53a('0x18')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa9f0=['path','rimraf','../../config/environment','./disposition.attributes','define','Disposition','tools_dispositions','name_voice','name','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','FaxAccountId','OpenchannelAccountId','WhatsappAccountId','util','api','bluebird','request-promise'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0xa9f0,0x80));var _0x0a9f=function(_0x4734e0,_0x59425f){_0x4734e0=_0x4734e0-0x0;var _0x5d938c=_0xa9f0[_0x4734e0];return _0x5d938c;};'use strict';var _=require('lodash');var util=require(_0x0a9f('0x0'));var logger=require('../../config/logger')(_0x0a9f('0x1'));var moment=require('moment');var BPromise=require(_0x0a9f('0x2'));var rp=require(_0x0a9f('0x3'));var fs=require('fs');var path=require(_0x0a9f('0x4'));var rimraf=require(_0x0a9f('0x5'));var config=require(_0x0a9f('0x6'));var attributes=require(_0x0a9f('0x7'));module['exports']=function(_0x36704d,_0x3213b1){return _0x36704d[_0x0a9f('0x8')](_0x0a9f('0x9'),attributes,{'tableName':_0x0a9f('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x0a9f('0xb'),'fields':[_0x0a9f('0xc'),'ListId']},{'unique':!![],'name':_0x0a9f('0xd'),'fields':['name',_0x0a9f('0xe')]},{'unique':!![],'name':_0x0a9f('0xf'),'fields':[_0x0a9f('0xc'),_0x0a9f('0x10')]},{'unique':!![],'name':_0x0a9f('0x11'),'fields':[_0x0a9f('0xc'),_0x0a9f('0x12')]},{'unique':!![],'name':'name_fax','fields':[_0x0a9f('0xc'),_0x0a9f('0x13')]},{'unique':!![],'name':'name_openchannel','fields':[_0x0a9f('0xc'),_0x0a9f('0x14')]},{'unique':!![],'name':'name_whatsapp','fields':[_0x0a9f('0xc'),_0x0a9f('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 3ec1091..c51e311 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(_0x311c64,_0x4a72fc){var _0x204ac0=function(_0x2a6e1f){while(--_0x2a6e1f){_0x311c64['push'](_0x311c64['shift']());}};_0x204ac0(++_0x4a72fc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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(_0x10fbfa,_0x17a652){var _0x1a027f=function(_0x1f5348){while(--_0x1f5348){_0x10fbfa['push'](_0x10fbfa['shift']());}};_0x1a027f(++_0x17a652);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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 d4c37cd..36ac70d 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 _0x5962=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','post','create','put','update','delete','util','connect-timeout','express','Router','fs-extra'];(function(_0xc14df7,_0x163f90){var _0x34a445=function(_0x1bbf28){while(--_0x1bbf28){_0xc14df7['push'](_0xc14df7['shift']());}};_0x34a445(++_0x163f90);}(_0x5962,0x193));var _0x2596=function(_0x54de5d,_0x1f8b26){_0x54de5d=_0x54de5d-0x0;var _0x1b349e=_0x5962[_0x54de5d];return _0x1b349e;};'use strict';var multer=require('multer');var util=require(_0x2596('0x0'));var path=require('path');var timeout=require(_0x2596('0x1'));var express=require(_0x2596('0x2'));var router=express[_0x2596('0x3')]();var fs_extra=require(_0x2596('0x4'));var auth=require(_0x2596('0x5'));var interaction=require(_0x2596('0x6'));var config=require(_0x2596('0x7'));var controller=require('./disposition.controller');router['get']('/',auth[_0x2596('0x8')](),controller['index']);router[_0x2596('0x9')](_0x2596('0xa'),auth[_0x2596('0x8')](),controller[_0x2596('0xb')]);router[_0x2596('0xc')]('/',auth[_0x2596('0x8')](),controller[_0x2596('0xd')]);router[_0x2596('0xe')](_0x2596('0xa'),auth[_0x2596('0x8')](),controller[_0x2596('0xf')]);router[_0x2596('0x10')](_0x2596('0xa'),auth[_0x2596('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6132=['../../components/auth/service','../../components/interaction/service','./disposition.controller','index','get','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x3fccd0,_0x135d78){var _0x5a250a=function(_0x1a16b1){while(--_0x1a16b1){_0x3fccd0['push'](_0x3fccd0['shift']());}};_0x5a250a(++_0x135d78);}(_0x6132,0x13a));var _0x2613=function(_0x319b26,_0x16c322){_0x319b26=_0x319b26-0x0;var _0x49cbc4=_0x6132[_0x319b26];return _0x49cbc4;};'use strict';var multer=require(_0x2613('0x0'));var util=require(_0x2613('0x1'));var path=require(_0x2613('0x2'));var timeout=require(_0x2613('0x3'));var express=require('express');var router=express[_0x2613('0x4')]();var fs_extra=require(_0x2613('0x5'));var auth=require(_0x2613('0x6'));var interaction=require(_0x2613('0x7'));var config=require('../../config/environment');var controller=require(_0x2613('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x2613('0x9')]);router[_0x2613('0xa')](_0x2613('0xb'),auth[_0x2613('0xc')](),controller[_0x2613('0xd')]);router['post']('/',auth[_0x2613('0xc')](),controller[_0x2613('0xe')]);router[_0x2613('0xf')]('/:id',auth[_0x2613('0xc')](),controller[_0x2613('0x10')]);router[_0x2613('0x11')](_0x2613('0xb'),auth[_0x2613('0xc')](),controller[_0x2613('0x12')]);module[_0x2613('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 894884b..383166e 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 _0x3914=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','4800','9600','14400','7200','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x3914,0xeb));var _0x4391=function(_0x1168a1,_0xa0d8c9){_0x1168a1=_0x1168a1-0x0;var _0xcc5ad8=_0x3914[_0x1168a1];return _0xcc5ad8;};'use strict';var Sequelize=require(_0x4391('0x0'));module[_0x4391('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4391('0x2')]},'ecm':{'type':Sequelize[_0x4391('0x3')]('yes','no'),'defaultValue':_0x4391('0x4')},'headerinfo':{'type':Sequelize[_0x4391('0x2')],'defaultValue':_0x4391('0x5')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x4391('0x6')},'minrate':{'type':Sequelize[_0x4391('0x3')]('2400',_0x4391('0x7'),'7200',_0x4391('0x8'),'12000',_0x4391('0x9')),'defaultValue':_0x4391('0x7')},'maxrate':{'type':Sequelize['ENUM']('2400',_0x4391('0x7'),_0x4391('0xa'),_0x4391('0x8'),'12000',_0x4391('0x9')),'defaultValue':_0x4391('0x9')},'modem':{'type':Sequelize[_0x4391('0x2')],'defaultValue':_0x4391('0xb')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x4391('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x4391('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x4391('0x3')](_0x4391('0xd'),_0x4391('0xe'),_0x4391('0xf'),_0x4391('0x10')),'defaultValue':_0x4391('0xd')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x4391('0x11')],'defaultValue':function(){return _0x4391('0x12');}},'notificationSound':{'type':Sequelize[_0x4391('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4391('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x4391('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4391('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4391('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4391('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4391('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x4391('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x4391('0x13')],'defaultValue':![],'comment':_0x4391('0x15'),'set':function(_0x19924d){if(!_0x19924d)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x4391('0x16')]('mandatoryDisposition',_0x19924d);}}}; \ No newline at end of file +var _0x85d0=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','yes','STRING','xCALLY\x20Motion\x20Fax','4800','7200','9600','14400','2400','12000','v17,v27,v29','SIP','DADHI','KHOMP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x85d0,0x164));var _0x085d=function(_0xc3e638,_0x319e72){_0xc3e638=_0xc3e638-0x0;var _0x892810=_0x85d0[_0xc3e638];return _0x892810;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x085d('0x0')](_0x085d('0x1'),'no'),'defaultValue':_0x085d('0x1')},'headerinfo':{'type':Sequelize[_0x085d('0x2')],'defaultValue':_0x085d('0x3')},'localstationid':{'type':Sequelize[_0x085d('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x085d('0x0')]('2400',_0x085d('0x4'),_0x085d('0x5'),_0x085d('0x6'),'12000',_0x085d('0x7')),'defaultValue':_0x085d('0x4')},'maxrate':{'type':Sequelize[_0x085d('0x0')](_0x085d('0x8'),_0x085d('0x4'),_0x085d('0x5'),_0x085d('0x6'),_0x085d('0x9'),_0x085d('0x7')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x085d('0x2')],'defaultValue':_0x085d('0xa')},'gateway':{'type':Sequelize[_0x085d('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x085d('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x085d('0x0')](_0x085d('0xb'),'IAX',_0x085d('0xc'),_0x085d('0xd')),'defaultValue':_0x085d('0xb')},'key':{'type':Sequelize[_0x085d('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x085d('0xe');}},'notificationSound':{'type':Sequelize[_0x085d('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x085d('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x085d('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x085d('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x085d('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x085d('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x085d('0x11')},'mandatoryDisposition':{'type':Sequelize[_0x085d('0xf')],'defaultValue':![],'comment':_0x085d('0x12'),'set':function(_0x1b0a6c){if(!_0x1b0a6c)this[_0x085d('0x13')](_0x085d('0x14'),null);this[_0x085d('0x13')](_0x085d('0x15'),_0x1b0a6c);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 26d65ff..128efd7 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 _0xe514=['type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','options','includeAll','include','FaxAccount','rows','catch','params','Pause','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','getDispositions','findOne','Disposition','pick','removeDispositions','addAnswer','getAnswers','CannedAnswer','sort','findAll','ids','addInteraction','FaxInteraction','omit','CmContact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','transaction','sequelize','Transaction','READ_COMMITTED','FaxApplication','findAndCountAll','priority','finally','getApplications','from-voip-provider','localstationid','description','Fax\x20Extension','appdata','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','headerinfo','minrate','modem','t38timeout','FAXOPT(','Wait','push','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','bulkCreate','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','$gte','split','FaxMessage','CmList','List','Contacts','DESC','attachments','root','server/files/attachments','CheckAfterSend','isNil','path','from','format','\x22%s\x22\x20<%s>','fax','defaults','List\x20not\x20found','user','filename','Messages','out','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','./faxAccount.socket','jayson/promise','client','http','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','FaxAccounts','UserProfileResource','end','sendStatus','stack','name','send','index','mandatoryDispositionPause','rawAttributes','fieldName'];(function(_0x56ebb6,_0x39104f){var _0x572115=function(_0x5a5d1b){while(--_0x5a5d1b){_0x56ebb6['push'](_0x56ebb6['shift']());}};_0x572115(++_0x39104f);}(_0xe514,0x87));var _0x4e51=function(_0x1c337b,_0x3b7435){_0x1c337b=_0x1c337b-0x0;var _0xb54a75=_0xe514[_0x1c337b];return _0xb54a75;};'use strict';var emlformat=require(_0x4e51('0x0'));var rimraf=require(_0x4e51('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4e51('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4e51('0x3'));var Mustache=require(_0x4e51('0x4'));var util=require(_0x4e51('0x5'));var path=require('path');var sox=require(_0x4e51('0x6'));var csv=require(_0x4e51('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4e51('0x8'));var squel=require('squel');var crypto=require(_0x4e51('0x9'));var jsforce=require(_0x4e51('0xa'));var deskjs=require(_0x4e51('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4e51('0xc'));var qs=require(_0x4e51('0xd'));var as=require(_0x4e51('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4e51('0xf'))(_0x4e51('0x10'));var utils=require(_0x4e51('0x11'));var config=require(_0x4e51('0x12'));var licenseUtil=require(_0x4e51('0x13'));var db=require(_0x4e51('0x14'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x4e51('0x15'),'port':0x18eb});var socket=require(_0x4e51('0x16'))(new Redis(config[_0x4e51('0x17')]));require(_0x4e51('0x18'))['register'](socket);var jayson=require(_0x4e51('0x19'));var client=jayson[_0x4e51('0x1a')]['http']({'port':0x232c});var client9002=jayson[_0x4e51('0x1a')][_0x4e51('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x5b64ba,_0x50a04c,_0x2c493b,_0x2998bf){return new BPromise(function(_0x28333d,_0x3f0a09){var _0x241dca=_0x2998bf||client;return _0x241dca[_0x4e51('0x1c')](_0x5b64ba,_0x2c493b)['then'](function(_0xc11d52){logger[_0x4e51('0x1d')](_0x4e51('0x1e'),_0x50a04c,_0x4e51('0x1f'));logger[_0x4e51('0x20')](_0x4e51('0x21'),_0x50a04c,'request\x20sent',JSON[_0x4e51('0x22')](_0xc11d52));if(_0xc11d52[_0x4e51('0x23')]){if(_0xc11d52[_0x4e51('0x23')][_0x4e51('0x24')]===0x1f4){logger['error'](_0x4e51('0x1e'),_0x50a04c,_0xc11d52[_0x4e51('0x23')][_0x4e51('0x25')]);return _0x3f0a09(_0xc11d52['error'][_0x4e51('0x25')]);}logger[_0x4e51('0x23')](_0x4e51('0x1e'),_0x50a04c,_0xc11d52[_0x4e51('0x23')][_0x4e51('0x25')]);return _0x28333d(_0xc11d52['error'][_0x4e51('0x25')]);}else{logger[_0x4e51('0x1d')](_0x4e51('0x1e'),_0x50a04c,_0x4e51('0x1f'));_0x28333d(_0xc11d52[_0x4e51('0x26')][_0x4e51('0x25')]);}})['catch'](function(_0x43b8bd){logger[_0x4e51('0x23')](_0x4e51('0x1e'),_0x50a04c,_0x43b8bd);_0x3f0a09(_0x43b8bd);});});}function respondWithStatusCode(_0x199aff,_0x2461a0){_0x2461a0=_0x2461a0||0xcc;return function(_0x20ba75){if(_0x20ba75){return _0x199aff['sendStatus'](_0x2461a0);}return _0x199aff['status'](_0x2461a0)['end']();};}function respondWithResult(_0x16454c,_0x347ca9){_0x347ca9=_0x347ca9||0xc8;return function(_0xf7482e){if(_0xf7482e){return _0x16454c[_0x4e51('0x27')](_0x347ca9)[_0x4e51('0x28')](_0xf7482e);}};}function respondWithFilteredResult(_0x1568fe,_0xcea3fe){return function(_0x38887f){if(_0x38887f){var _0x4ef0e0=typeof _0xcea3fe[_0x4e51('0x29')]==='undefined'&&typeof _0xcea3fe[_0x4e51('0x2a')]===_0x4e51('0x2b');var _0x30cc99=_0x38887f[_0x4e51('0x2c')];var _0x1182cf=_0x4ef0e0?0x0:_0xcea3fe[_0x4e51('0x29')];var _0x3d3a08=_0x4ef0e0?_0x38887f[_0x4e51('0x2c')]:_0xcea3fe[_0x4e51('0x29')]+_0xcea3fe[_0x4e51('0x2a')];var _0x48fb72;if(_0x3d3a08>=_0x30cc99){_0x3d3a08=_0x30cc99;_0x48fb72=0xc8;}else{_0x48fb72=0xce;}_0x1568fe[_0x4e51('0x27')](_0x48fb72);return _0x1568fe[_0x4e51('0x2d')](_0x4e51('0x2e'),_0x1182cf+'-'+_0x3d3a08+'/'+_0x30cc99)[_0x4e51('0x28')](_0x38887f);}return null;};}function patchUpdates(_0x23899a){return function(_0x497f90){try{jsonpatch[_0x4e51('0x2f')](_0x497f90,_0x23899a,!![]);}catch(_0x4b7d87){return BPromise[_0x4e51('0x30')](_0x4b7d87);}return _0x497f90[_0x4e51('0x31')]();};}function saveUpdates(_0x1efe35,_0x45dd67){return function(_0x3b7e26){if(_0x3b7e26){return _0x3b7e26[_0x4e51('0x32')](_0x1efe35)[_0x4e51('0x33')](function(_0x2f08ed){return _0x2f08ed;});}return null;};}function removeEntity(_0x562068,_0x3f370e){return function(_0x1d1c7a){if(_0x1d1c7a){return _0x1d1c7a[_0x4e51('0x34')]()['then'](function(){var _0x19e24b=_0x1d1c7a[_0x4e51('0x35')]({'plain':!![]});var _0x28a178=_0x4e51('0x36');return db[_0x4e51('0x37')]['destroy']({'where':{'type':_0x28a178,'resourceId':_0x19e24b['id']}})[_0x4e51('0x33')](function(){return _0x1d1c7a;});})[_0x4e51('0x33')](function(){_0x562068[_0x4e51('0x27')](0xcc)[_0x4e51('0x38')]();});}};}function handleEntityNotFound(_0x1b0c1c,_0x4ee9b4){return function(_0x46de39){if(!_0x46de39){_0x1b0c1c[_0x4e51('0x39')](0x194);}return _0x46de39;};}function handleError(_0x8e27bb,_0x20682e){_0x20682e=_0x20682e||0x1f4;return function(_0x2605a5){logger[_0x4e51('0x23')](_0x2605a5[_0x4e51('0x3a')]);if(_0x2605a5[_0x4e51('0x3b')]){delete _0x2605a5[_0x4e51('0x3b')];}_0x8e27bb['status'](_0x20682e)[_0x4e51('0x3c')](_0x2605a5);};}exports[_0x4e51('0x3d')]=function(_0x360fd9,_0x2c2f04){var _0x1e3ea3={'include':[{'model':db['Pause'],'as':_0x4e51('0x3e')}]},_0x20387a={},_0x4e715e={'count':0x0,'rows':[]};var _0x351873=_['map'](db['FaxAccount'][_0x4e51('0x3f')],function(_0x56c74c){return{'name':_0x56c74c[_0x4e51('0x40')],'type':_0x56c74c[_0x4e51('0x41')][_0x4e51('0x42')]};});_0x20387a['model']=_[_0x4e51('0x43')](_0x351873,'name');_0x20387a[_0x4e51('0x44')]=_[_0x4e51('0x45')](_0x360fd9[_0x4e51('0x44')]);_0x20387a[_0x4e51('0x46')]=_[_0x4e51('0x47')](_0x20387a[_0x4e51('0x48')],_0x20387a[_0x4e51('0x44')]);_0x1e3ea3[_0x4e51('0x49')]=_[_0x4e51('0x47')](_0x20387a[_0x4e51('0x48')],qs[_0x4e51('0x4a')](_0x360fd9['query'][_0x4e51('0x4a')]));_0x1e3ea3[_0x4e51('0x49')]=_0x1e3ea3[_0x4e51('0x49')][_0x4e51('0x4b')]?_0x1e3ea3[_0x4e51('0x49')]:_0x20387a[_0x4e51('0x48')];if(!_0x360fd9['query'][_0x4e51('0x4c')](_0x4e51('0x4d'))){_0x1e3ea3[_0x4e51('0x2a')]=qs[_0x4e51('0x2a')](_0x360fd9[_0x4e51('0x44')]['limit']);_0x1e3ea3[_0x4e51('0x29')]=qs[_0x4e51('0x29')](_0x360fd9['query']['offset']);}_0x1e3ea3[_0x4e51('0x4e')]=qs['sort'](_0x360fd9[_0x4e51('0x44')]['sort']);_0x1e3ea3[_0x4e51('0x4f')]=qs[_0x4e51('0x46')](_['pick'](_0x360fd9[_0x4e51('0x44')],_0x20387a[_0x4e51('0x46')]),_0x351873);if(_0x360fd9[_0x4e51('0x44')][_0x4e51('0x50')]){_0x1e3ea3[_0x4e51('0x4f')]=_[_0x4e51('0x51')](_0x1e3ea3[_0x4e51('0x4f')],{'$or':_[_0x4e51('0x43')](_0x351873,function(_0x4e4829){if(_0x4e4829[_0x4e51('0x41')]!==_0x4e51('0x52')){var _0x53998c={};_0x53998c[_0x4e4829['name']]={'$like':'%'+_0x360fd9[_0x4e51('0x44')]['filter']+'%'};return _0x53998c;}})});}_0x1e3ea3=_[_0x4e51('0x51')]({},_0x1e3ea3,_0x360fd9[_0x4e51('0x53')]);var _0x182a00={'where':_0x1e3ea3['where']};return db['FaxAccount']['count'](_0x182a00)[_0x4e51('0x33')](function(_0x4ed996){_0x4e715e[_0x4e51('0x2c')]=_0x4ed996;if(_0x360fd9['query'][_0x4e51('0x54')]){_0x1e3ea3[_0x4e51('0x55')]=[{'all':!![]}];}return db[_0x4e51('0x56')]['findAll'](_0x1e3ea3);})[_0x4e51('0x33')](function(_0x42075c){_0x4e715e[_0x4e51('0x57')]=_0x42075c;return _0x4e715e;})[_0x4e51('0x33')](respondWithFilteredResult(_0x2c2f04,_0x1e3ea3))[_0x4e51('0x58')](handleError(_0x2c2f04,null));};exports['show']=function(_0x46e2f4,_0x4a3b56){var _0x4aaea1={'raw':![],'where':{'id':_0x46e2f4[_0x4e51('0x59')]['id']},'include':[{'model':db[_0x4e51('0x5a')],'as':'mandatoryDispositionPause'}]},_0x2dee8d={};_0x2dee8d[_0x4e51('0x48')]=_['keys'](db[_0x4e51('0x56')][_0x4e51('0x3f')]);_0x2dee8d[_0x4e51('0x44')]=_['keys'](_0x46e2f4['query']);_0x2dee8d[_0x4e51('0x46')]=_[_0x4e51('0x47')](_0x2dee8d[_0x4e51('0x48')],_0x2dee8d[_0x4e51('0x44')]);_0x4aaea1[_0x4e51('0x49')]=_['intersection'](_0x2dee8d[_0x4e51('0x48')],qs[_0x4e51('0x4a')](_0x46e2f4[_0x4e51('0x44')][_0x4e51('0x4a')]));_0x4aaea1[_0x4e51('0x49')]=_0x4aaea1['attributes']['length']?_0x4aaea1[_0x4e51('0x49')]:_0x2dee8d[_0x4e51('0x48')];if(_0x46e2f4[_0x4e51('0x44')]['includeAll']){_0x4aaea1[_0x4e51('0x55')]=[{'all':!![]}];}_0x4aaea1=_[_0x4e51('0x51')]({},_0x4aaea1,_0x46e2f4['options']);return db[_0x4e51('0x56')]['find'](_0x4aaea1)[_0x4e51('0x33')](handleEntityNotFound(_0x4a3b56,null))[_0x4e51('0x33')](respondWithResult(_0x4a3b56,null))['catch'](handleError(_0x4a3b56,null));};exports[_0x4e51('0x5b')]=function(_0x5149f6,_0x5be699){return db[_0x4e51('0x56')][_0x4e51('0x5b')](_0x5149f6[_0x4e51('0x5c')],{})[_0x4e51('0x33')](function(_0x78fbb){var _0x404f79=_0x5149f6['user'][_0x4e51('0x35')]({'plain':!![]});if(!_0x404f79)throw new Error(_0x4e51('0x5d'));if(_0x404f79[_0x4e51('0x5e')]==='user'){var _0x53c3fc=_0x78fbb['get']({'plain':!![]});var _0xdb05b5=_0x4e51('0x36');return db[_0x4e51('0x5f')][_0x4e51('0x60')]({'where':{'name':_0xdb05b5,'userProfileId':_0x404f79[_0x4e51('0x61')]},'raw':!![]})[_0x4e51('0x33')](function(_0x4c1a8b){if(_0x4c1a8b&&_0x4c1a8b[_0x4e51('0x62')]===0x0){return db[_0x4e51('0x37')][_0x4e51('0x5b')]({'name':_0x53c3fc[_0x4e51('0x3b')],'resourceId':_0x53c3fc['id'],'type':_0x4c1a8b[_0x4e51('0x3b')],'sectionId':_0x4c1a8b['id']},{})[_0x4e51('0x33')](function(){return _0x78fbb;});}else{return _0x78fbb;}})[_0x4e51('0x58')](function(_0x205f28){logger[_0x4e51('0x23')](_0x4e51('0x63'),_0x205f28);throw _0x205f28;});}return _0x78fbb;})[_0x4e51('0x33')](respondWithResult(_0x5be699,0xc9))[_0x4e51('0x58')](handleError(_0x5be699,null));};exports[_0x4e51('0x32')]=function(_0x59e780,_0x513482){if(_0x59e780[_0x4e51('0x5c')]['id']){delete _0x59e780[_0x4e51('0x5c')]['id'];}return db[_0x4e51('0x56')][_0x4e51('0x60')]({'where':{'id':_0x59e780[_0x4e51('0x59')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x4e51('0x33')](handleEntityNotFound(_0x513482,null))['then'](saveUpdates(_0x59e780[_0x4e51('0x5c')],null))['then'](respondWithResult(_0x513482,null))['catch'](handleError(_0x513482,null));};exports['destroy']=function(_0x67efe5,_0x1ac846){return db['FaxAccount'][_0x4e51('0x60')]({'where':{'id':_0x67efe5[_0x4e51('0x59')]['id']}})[_0x4e51('0x33')](handleEntityNotFound(_0x1ac846,null))[_0x4e51('0x33')](removeEntity(_0x1ac846,null))[_0x4e51('0x58')](handleError(_0x1ac846,null));};exports[_0x4e51('0x64')]=function(_0x22e43d,_0x5cc15a){return db[_0x4e51('0x56')][_0x4e51('0x64')]()['then'](respondWithResult(_0x5cc15a,null))['catch'](handleError(_0x5cc15a,null));};exports[_0x4e51('0x65')]=function(_0x35fff6,_0x509cc1,_0x28f900){if(_0x35fff6[_0x4e51('0x5c')]['id']){delete _0x35fff6[_0x4e51('0x5c')]['id'];}return db[_0x4e51('0x56')][_0x4e51('0x60')]({'where':{'id':_0x35fff6[_0x4e51('0x59')]['id']}})[_0x4e51('0x33')](handleEntityNotFound(_0x509cc1,null))[_0x4e51('0x33')](function(_0x40add7){if(_0x40add7){_0x35fff6[_0x4e51('0x5c')][_0x4e51('0x66')]=_0x40add7['id'];return db['Disposition']['create'](_0x35fff6[_0x4e51('0x5c')]);}})['then'](respondWithResult(_0x509cc1,null))['catch'](handleError(_0x509cc1,null));};exports[_0x4e51('0x67')]=function(_0x4c2a85,_0xeea53f,_0x2a7a84){var _0xf1a0f4={'raw':![],'where':{}};var _0x513ecc={};var _0x24b1d0={'count':0x0,'rows':[]};return db['FaxAccount'][_0x4e51('0x68')]({'where':{'id':_0x4c2a85['params']['id']}})[_0x4e51('0x33')](handleEntityNotFound(_0xeea53f,null))[_0x4e51('0x33')](function(_0x17e2bd){if(_0x17e2bd){_0x513ecc[_0x4e51('0x48')]=_['keys'](db[_0x4e51('0x69')][_0x4e51('0x3f')]);_0x513ecc[_0x4e51('0x44')]=_[_0x4e51('0x45')](_0x4c2a85[_0x4e51('0x44')]);_0x513ecc['filters']=_[_0x4e51('0x47')](_0x513ecc['model'],_0x513ecc[_0x4e51('0x44')]);_0xf1a0f4[_0x4e51('0x49')]=_[_0x4e51('0x47')](_0x513ecc[_0x4e51('0x48')],qs[_0x4e51('0x4a')](_0x4c2a85[_0x4e51('0x44')][_0x4e51('0x4a')]));_0xf1a0f4[_0x4e51('0x49')]=_0xf1a0f4[_0x4e51('0x49')][_0x4e51('0x4b')]?_0xf1a0f4[_0x4e51('0x49')]:_0x513ecc[_0x4e51('0x48')];if(!_0x4c2a85[_0x4e51('0x44')][_0x4e51('0x4c')]('nolimit')){_0xf1a0f4[_0x4e51('0x2a')]=qs[_0x4e51('0x2a')](_0x4c2a85[_0x4e51('0x44')][_0x4e51('0x2a')]);_0xf1a0f4['offset']=qs['offset'](_0x4c2a85['query'][_0x4e51('0x29')]);}_0xf1a0f4[_0x4e51('0x4e')]=qs['sort'](_0x4c2a85[_0x4e51('0x44')]['sort']);_0xf1a0f4['where']=qs[_0x4e51('0x46')](_[_0x4e51('0x6a')](_0x4c2a85[_0x4e51('0x44')],_0x513ecc[_0x4e51('0x46')]));_0xf1a0f4[_0x4e51('0x4f')]['FaxAccountId']=_0x17e2bd['id'];if(_0x4c2a85[_0x4e51('0x44')][_0x4e51('0x50')]){_0xf1a0f4['where']=_[_0x4e51('0x51')](_0xf1a0f4[_0x4e51('0x4f')],{'$or':_[_0x4e51('0x43')](_0xf1a0f4[_0x4e51('0x49')],function(_0x5655f1){var _0x3e4029={};_0x3e4029[_0x5655f1]={'$like':'%'+_0x4c2a85['query'][_0x4e51('0x50')]+'%'};return _0x3e4029;})});}_0xf1a0f4=_['merge']({},_0xf1a0f4,_0x4c2a85[_0x4e51('0x53')]);return db['Disposition'][_0x4e51('0x2c')]({'where':_0xf1a0f4[_0x4e51('0x4f')]})['then'](function(_0x1a4c2f){_0x24b1d0['count']=_0x1a4c2f;if(_0x4c2a85[_0x4e51('0x44')][_0x4e51('0x54')]){_0xf1a0f4[_0x4e51('0x55')]=[{'all':!![]}];}return db[_0x4e51('0x69')]['findAll'](_0xf1a0f4);})[_0x4e51('0x33')](function(_0x44d414){_0x24b1d0['rows']=_0x44d414;return _0x24b1d0;});}})[_0x4e51('0x33')](respondWithFilteredResult(_0xeea53f,_0xf1a0f4))[_0x4e51('0x58')](handleError(_0xeea53f,null));};exports[_0x4e51('0x6b')]=function(_0x5e0128,_0x460f89,_0x28e3e2){return db[_0x4e51('0x56')][_0x4e51('0x60')]({'where':{'id':_0x5e0128['params']['id']}})[_0x4e51('0x33')](handleEntityNotFound(_0x460f89,null))['then'](function(_0x592392){if(_0x592392){return _0x592392[_0x4e51('0x6b')](_0x5e0128[_0x4e51('0x44')]['ids']);}})['then'](respondWithStatusCode(_0x460f89,null))['catch'](handleError(_0x460f89,null));};exports[_0x4e51('0x6c')]=function(_0x1c68e7,_0x329c8d,_0x378d91){if(_0x1c68e7[_0x4e51('0x5c')]['id']){delete _0x1c68e7[_0x4e51('0x5c')]['id'];}return db[_0x4e51('0x56')]['find']({'where':{'id':_0x1c68e7[_0x4e51('0x59')]['id']}})['then'](handleEntityNotFound(_0x329c8d,null))[_0x4e51('0x33')](function(_0x1c2ce0){if(_0x1c2ce0){_0x1c68e7['body'][_0x4e51('0x66')]=_0x1c2ce0['id'];return db['CannedAnswer']['create'](_0x1c68e7[_0x4e51('0x5c')]);}})[_0x4e51('0x33')](respondWithResult(_0x329c8d,null))[_0x4e51('0x58')](handleError(_0x329c8d,null));};exports[_0x4e51('0x6d')]=function(_0x34c536,_0x3a5be1,_0x4b347e){var _0x4a33ee={'raw':![],'where':{}};var _0x395f1d={};var _0x238ab4={'count':0x0,'rows':[]};return db[_0x4e51('0x56')][_0x4e51('0x68')]({'where':{'id':_0x34c536[_0x4e51('0x59')]['id']}})[_0x4e51('0x33')](handleEntityNotFound(_0x3a5be1,null))[_0x4e51('0x33')](function(_0x1e49c9){if(_0x1e49c9){_0x395f1d[_0x4e51('0x48')]=_[_0x4e51('0x45')](db[_0x4e51('0x6e')][_0x4e51('0x3f')]);_0x395f1d[_0x4e51('0x44')]=_[_0x4e51('0x45')](_0x34c536[_0x4e51('0x44')]);_0x395f1d['filters']=_[_0x4e51('0x47')](_0x395f1d[_0x4e51('0x48')],_0x395f1d['query']);_0x4a33ee[_0x4e51('0x49')]=_[_0x4e51('0x47')](_0x395f1d[_0x4e51('0x48')],qs[_0x4e51('0x4a')](_0x34c536[_0x4e51('0x44')][_0x4e51('0x4a')]));_0x4a33ee[_0x4e51('0x49')]=_0x4a33ee[_0x4e51('0x49')][_0x4e51('0x4b')]?_0x4a33ee[_0x4e51('0x49')]:_0x395f1d[_0x4e51('0x48')];if(!_0x34c536['query'][_0x4e51('0x4c')](_0x4e51('0x4d'))){_0x4a33ee['limit']=qs[_0x4e51('0x2a')](_0x34c536[_0x4e51('0x44')][_0x4e51('0x2a')]);_0x4a33ee[_0x4e51('0x29')]=qs[_0x4e51('0x29')](_0x34c536['query'][_0x4e51('0x29')]);}_0x4a33ee[_0x4e51('0x4e')]=qs['sort'](_0x34c536[_0x4e51('0x44')][_0x4e51('0x6f')]);_0x4a33ee['where']=qs[_0x4e51('0x46')](_[_0x4e51('0x6a')](_0x34c536[_0x4e51('0x44')],_0x395f1d[_0x4e51('0x46')]));_0x4a33ee[_0x4e51('0x4f')][_0x4e51('0x66')]=_0x1e49c9['id'];if(_0x34c536[_0x4e51('0x44')][_0x4e51('0x50')]){_0x4a33ee[_0x4e51('0x4f')]=_[_0x4e51('0x51')](_0x4a33ee[_0x4e51('0x4f')],{'$or':_[_0x4e51('0x43')](_0x4a33ee[_0x4e51('0x49')],function(_0x4793c6){var _0x4b9b57={};_0x4b9b57[_0x4793c6]={'$like':'%'+_0x34c536[_0x4e51('0x44')][_0x4e51('0x50')]+'%'};return _0x4b9b57;})});}_0x4a33ee=_[_0x4e51('0x51')]({},_0x4a33ee,_0x34c536[_0x4e51('0x53')]);return db[_0x4e51('0x6e')][_0x4e51('0x2c')]({'where':_0x4a33ee[_0x4e51('0x4f')]})[_0x4e51('0x33')](function(_0x110015){_0x238ab4[_0x4e51('0x2c')]=_0x110015;if(_0x34c536[_0x4e51('0x44')][_0x4e51('0x54')]){_0x4a33ee['include']=[{'all':!![]}];}return db[_0x4e51('0x6e')][_0x4e51('0x70')](_0x4a33ee);})['then'](function(_0x50e2c2){_0x238ab4[_0x4e51('0x57')]=_0x50e2c2;return _0x238ab4;});}})[_0x4e51('0x33')](respondWithFilteredResult(_0x3a5be1,_0x4a33ee))[_0x4e51('0x58')](handleError(_0x3a5be1,null));};exports['removeAnswers']=function(_0x65e02,_0x19015a,_0x3b7636){return db[_0x4e51('0x56')][_0x4e51('0x60')]({'where':{'id':_0x65e02[_0x4e51('0x59')]['id']}})[_0x4e51('0x33')](handleEntityNotFound(_0x19015a,null))['then'](function(_0x395ea4){if(_0x395ea4){return _0x395ea4['removeAnswers'](_0x65e02[_0x4e51('0x44')][_0x4e51('0x71')]);}})['then'](respondWithStatusCode(_0x19015a,null))['catch'](handleError(_0x19015a,null));};exports[_0x4e51('0x72')]=function(_0x487f74,_0x444cf5,_0x5165a9){return db[_0x4e51('0x73')][_0x4e51('0x60')]({'where':{'id':_0x487f74[_0x4e51('0x59')]['id']}})[_0x4e51('0x33')](handleEntityNotFound(_0x444cf5,null))['then'](function(_0x4645f8){if(_0x4645f8){return _0x4645f8[_0x4e51('0x72')](_0x487f74['body'][_0x4e51('0x71')],_[_0x4e51('0x74')](_0x487f74['body'],['ids','id'])||{});}})[_0x4e51('0x33')](respondWithResult(_0x444cf5,null))[_0x4e51('0x58')](handleError(_0x444cf5,null));};exports['getInteractions']=function(_0x3c39aa,_0x20c238,_0xd6c798){var _0x2ff0fc={'raw':![],'where':{}};var _0x78fad9={};var _0xd6ec70={'count':0x0,'rows':[]};return db[_0x4e51('0x56')][_0x4e51('0x68')]({'where':{'id':_0x3c39aa[_0x4e51('0x59')]['id']}})[_0x4e51('0x33')](handleEntityNotFound(_0x20c238,null))[_0x4e51('0x33')](function(_0xb5e5dc){if(_0xb5e5dc){_0x78fad9[_0x4e51('0x48')]=_[_0x4e51('0x45')](db[_0x4e51('0x73')][_0x4e51('0x3f')]);_0x78fad9[_0x4e51('0x44')]=_[_0x4e51('0x45')](_0x3c39aa['query']);_0x78fad9[_0x4e51('0x46')]=_['intersection'](_0x78fad9[_0x4e51('0x48')],_0x78fad9[_0x4e51('0x44')]);_0x2ff0fc['attributes']=_['intersection'](_0x78fad9[_0x4e51('0x48')],qs['fields'](_0x3c39aa[_0x4e51('0x44')][_0x4e51('0x4a')]));_0x2ff0fc[_0x4e51('0x49')]=_0x2ff0fc[_0x4e51('0x49')][_0x4e51('0x4b')]?_0x2ff0fc['attributes']:_0x78fad9[_0x4e51('0x48')];if(!_0x3c39aa[_0x4e51('0x44')][_0x4e51('0x4c')](_0x4e51('0x4d'))){_0x2ff0fc['limit']=qs[_0x4e51('0x2a')](_0x3c39aa[_0x4e51('0x44')][_0x4e51('0x2a')]);_0x2ff0fc[_0x4e51('0x29')]=qs['offset'](_0x3c39aa[_0x4e51('0x44')]['offset']);}_0x2ff0fc[_0x4e51('0x4e')]=qs[_0x4e51('0x6f')](_0x3c39aa[_0x4e51('0x44')]['sort']);_0x2ff0fc['where']=qs['filters'](_[_0x4e51('0x6a')](_0x3c39aa[_0x4e51('0x44')],_0x78fad9[_0x4e51('0x46')]));_0x2ff0fc[_0x4e51('0x4f')]['FaxAccountId']=_0xb5e5dc['id'];if(_0x3c39aa[_0x4e51('0x44')][_0x4e51('0x50')]){_0x2ff0fc['where']=_[_0x4e51('0x51')](_0x2ff0fc[_0x4e51('0x4f')],{'$or':_[_0x4e51('0x43')](_0x2ff0fc['attributes'],function(_0x2e6499){var _0x48fda9={};_0x48fda9[_0x2e6499]={'$like':'%'+_0x3c39aa[_0x4e51('0x44')][_0x4e51('0x50')]+'%'};return _0x48fda9;})});}_0x2ff0fc=_['merge']({},_0x2ff0fc,_0x3c39aa[_0x4e51('0x53')]);return db[_0x4e51('0x73')]['count']({'where':_0x2ff0fc[_0x4e51('0x4f')]})['then'](function(_0x6cd4a4){_0xd6ec70[_0x4e51('0x2c')]=_0x6cd4a4;if(_0x3c39aa['query']['includeAll']){_0x2ff0fc[_0x4e51('0x55')]=[{'model':db[_0x4e51('0x75')],'as':'Contact','required':![]},{'model':db[_0x4e51('0x76')],'as':_0x4e51('0x77'),'attributes':['name',_0x4e51('0x78'),_0x4e51('0x79')],'required':![]},{'model':db[_0x4e51('0x7a')],'as':_0x4e51('0x7b'),'attributes':['id',_0x4e51('0x3b'),_0x4e51('0x7c')],'where':_0x3c39aa[_0x4e51('0x44')][_0x4e51('0x7d')]?{'id':_0x3c39aa['query']['tag']}:undefined,'required':_0x3c39aa['query'][_0x4e51('0x7d')]?!![]:![]}];}return db[_0x4e51('0x73')][_0x4e51('0x70')](_0x2ff0fc);})[_0x4e51('0x33')](function(_0x42a00a){_0xd6ec70[_0x4e51('0x57')]=_0x42a00a;return _0xd6ec70;});}})[_0x4e51('0x33')](respondWithFilteredResult(_0x20c238,_0x2ff0fc))[_0x4e51('0x58')](handleError(_0x20c238,null));};exports[_0x4e51('0x7e')]=function(_0x391562,_0x3d800f){var _0x54d390=_0x391562[_0x4e51('0x59')]['id'];var _0x3d3510=_0x391562[_0x4e51('0x5c')];var _0x395923=0xc8;var _0x3b0cd3=null;return db['sequelize'][_0x4e51('0x7f')]({'isolationLevel':db[_0x4e51('0x80')][_0x4e51('0x81')]['ISOLATION_LEVELS'][_0x4e51('0x82')]},function(_0x2a3caf){return db[_0x4e51('0x56')][_0x4e51('0x68')]({'where':{'id':_0x54d390},'transaction':_0x2a3caf})['then'](function(_0x2491e3){if(_0x2491e3){return db[_0x4e51('0x83')]['destroy']({'where':{'FaxAccountId':_0x54d390},'transaction':_0x2a3caf})[_0x4e51('0x33')](function(){var _0x1f22c5=_[_0x4e51('0x43')](_0x3d3510,function(_0xf36514){_0xf36514[_0x4e51('0x66')]=_0x54d390;return _0xf36514;});return db[_0x4e51('0x83')]['bulkCreate'](_0x1f22c5,{'transaction':_0x2a3caf});});}else{_0x395923=0x194;_0x3b0cd3=[];}});})['then'](function(){if(_0x395923!==0x194){return db[_0x4e51('0x83')][_0x4e51('0x84')]({'where':{'FaxAccountId':_0x54d390},'order':_0x4e51('0x85')})[_0x4e51('0x33')](function(_0x11b867){_0x3b0cd3=_0x11b867;});}})['catch'](function(_0xe23a09){_0x395923=0x1f4;logger[_0x4e51('0x23')](_0xe23a09['stack']);if(_0xe23a09[_0x4e51('0x3b')]){delete _0xe23a09[_0x4e51('0x3b')];}_0x3b0cd3=_0xe23a09;})[_0x4e51('0x86')](function(){if(_0x3b0cd3===null){_0x3d800f[_0x4e51('0x39')](_0x395923);}else{if(_0x395923===0x1f4){_0x3d800f[_0x4e51('0x27')](_0x395923)[_0x4e51('0x3c')](_0x3b0cd3);}else{_0x3d800f['status'](_0x395923)[_0x4e51('0x28')](_0x3b0cd3);}}});};exports['getApplications']=function(_0x3f8f6a,_0x230230,_0x341c70){var _0x347892={};var _0x5a5f21={};var _0xac3ffe;var _0x3ebdf5;return db[_0x4e51('0x56')][_0x4e51('0x68')]({'where':{'id':_0x3f8f6a['params']['id']}})[_0x4e51('0x33')](handleEntityNotFound(_0x230230,null))[_0x4e51('0x33')](function(_0x11384a){if(_0x11384a){_0xac3ffe=_0x11384a;_0x5a5f21['model']=_[_0x4e51('0x45')](db[_0x4e51('0x83')][_0x4e51('0x3f')]);_0x5a5f21[_0x4e51('0x44')]=_[_0x4e51('0x45')](_0x3f8f6a['query']);_0x5a5f21[_0x4e51('0x46')]=_[_0x4e51('0x47')](_0x5a5f21[_0x4e51('0x48')],_0x5a5f21['query']);_0x347892['attributes']=_[_0x4e51('0x47')](_0x5a5f21[_0x4e51('0x48')],qs[_0x4e51('0x4a')](_0x3f8f6a[_0x4e51('0x44')][_0x4e51('0x4a')]));_0x347892[_0x4e51('0x49')]=_0x347892[_0x4e51('0x49')][_0x4e51('0x4b')]?_0x347892[_0x4e51('0x49')]:_0x5a5f21[_0x4e51('0x48')];_0x347892[_0x4e51('0x4e')]=qs[_0x4e51('0x6f')](_0x3f8f6a[_0x4e51('0x44')][_0x4e51('0x6f')]);_0x347892[_0x4e51('0x4f')]=qs[_0x4e51('0x46')](_[_0x4e51('0x6a')](_0x3f8f6a['query'],_0x5a5f21['filters']));if(_0x3f8f6a[_0x4e51('0x44')][_0x4e51('0x50')]){_0x347892[_0x4e51('0x4f')]=_['merge'](_0x347892['where'],{'$or':_[_0x4e51('0x43')](_0x347892[_0x4e51('0x49')],function(_0x212346){var _0x29b897={};_0x29b897[_0x212346]={'$like':'%'+_0x3f8f6a[_0x4e51('0x44')][_0x4e51('0x50')]+'%'};return _0x29b897;})});}_0x347892=_['merge']({},_0x347892,_0x3f8f6a['options']);return _0xac3ffe[_0x4e51('0x87')](_0x347892);}})['then'](function(_0x3425db){if(_0x3425db){_0x3ebdf5=_0x3425db[_0x4e51('0x4b')];if(!_0x3f8f6a[_0x4e51('0x44')][_0x4e51('0x4c')](_0x4e51('0x4d'))){_0x347892[_0x4e51('0x2a')]=qs[_0x4e51('0x2a')](_0x3f8f6a[_0x4e51('0x44')][_0x4e51('0x2a')]);_0x347892[_0x4e51('0x29')]=qs['offset'](_0x3f8f6a[_0x4e51('0x44')][_0x4e51('0x29')]);}return _0xac3ffe[_0x4e51('0x87')](_0x347892);}})[_0x4e51('0x33')](function(_0x49206a){if(_0x49206a){return _0x49206a?{'count':_0x3ebdf5,'rows':_0x49206a}:null;}})['then'](respondWithResult(_0x230230,null))[_0x4e51('0x58')](handleError(_0x230230,null));};function Extension(_0x28903e,_0x3256f6,_0x1fedbe,_0x1da79e){this['context']=_0x4e51('0x88');this['exten']=_0x28903e[_0x4e51('0x89')];this['app']=_0x1da79e;this['type']='system';this[_0x4e51('0x8a')]=_0x4e51('0x8b');this['FaxAccountId']=_0x28903e['id'];this[_0x4e51('0x85')]=_0x3256f6;this[_0x4e51('0x8c')]=_0x1fedbe;}function createExtensionsReciveFax(_0x4c1c8c){var _0x1e7160=0x1;var _0x5498d1=[];_0x5498d1['push'](new Extension(_0x4c1c8c,_0x1e7160,'',_0x4e51('0x8d')));_0x1e7160+=0x1;_0x5498d1['push'](new Extension(_0x4c1c8c,_0x1e7160,_0x4e51('0x8e'),_0x4e51('0x8f')));_0x1e7160+=0x1;for(var _0x5e2da8 in _0x4c1c8c){if(_0x4c1c8c['hasOwnProperty'](_0x5e2da8)&&(_0x5e2da8===_0x4e51('0x90')||_0x5e2da8===_0x4e51('0x89')||_0x5e2da8===_0x4e51('0x91')||_0x5e2da8==='faxdetect'||_0x5e2da8===_0x4e51('0x92')||_0x5e2da8==='maxrate'||_0x5e2da8===_0x4e51('0x93')||_0x5e2da8===_0x4e51('0x94')||_0x5e2da8===_0x4e51('0x95'))){_0x5498d1['push'](new Extension(_0x4c1c8c,_0x1e7160,_0x4e51('0x96')+_0x5e2da8+')='+_0x4c1c8c[_0x5e2da8],_0x4e51('0x8f')));_0x1e7160+=0x1;}}_0x5498d1['push'](new Extension(_0x4c1c8c,_0x1e7160,'6',_0x4e51('0x97')));_0x1e7160+=0x1;_0x5498d1[_0x4e51('0x98')](new Extension(_0x4c1c8c,_0x1e7160,_0x4e51('0x99'),_0x4e51('0x9a')));_0x1e7160=0x0;return _0x5498d1;}exports[_0x4e51('0x9b')]=function(_0x24b806,_0x48f0b6,_0x6fb79c){var _0x1092af;return db[_0x4e51('0x80')][_0x4e51('0x7f')](function(_0x289d86){return db[_0x4e51('0x56')][_0x4e51('0x5b')](_0x24b806[_0x4e51('0x5c')],{'transaction':_0x289d86})[_0x4e51('0x33')](function(_0x2f3f26){_0x1092af=_0x2f3f26[_0x4e51('0x35')]({'plain':!![]});return db[_0x4e51('0x9c')][_0x4e51('0x9d')](createExtensionsReciveFax(_0x1092af),{'transaction':_0x289d86});});})[_0x4e51('0x33')](function(){return _0x1092af;})['then'](respondWithResult(_0x48f0b6,null))[_0x4e51('0x58')](handleError(_0x48f0b6,null));};exports['updateAccountApplications']=function(_0x18bfdd,_0x3d002e,_0x1861f8){var _0x47e885;return db['sequelize'][_0x4e51('0x7f')](function(_0xd350f4){return db[_0x4e51('0x56')][_0x4e51('0x32')](_0x18bfdd['body'],{'where':{'id':_0x18bfdd[_0x4e51('0x5c')]['id']},'transaction':_0xd350f4})[_0x4e51('0x33')](function(_0x1afa63){return db['VoiceExtension'][_0x4e51('0x34')]({'where':{'FaxAccountId':_0x18bfdd[_0x4e51('0x5c')]['id']},'transaction':_0xd350f4})[_0x4e51('0x33')](function(_0x47d92e){return db[_0x4e51('0x9c')][_0x4e51('0x9d')](createExtensionsReciveFax(_['omit'](_0x18bfdd[_0x4e51('0x5c')],[_0x4e51('0x9e'),'key',_0x4e51('0x9f'),_0x4e51('0xa0'),_0x4e51('0xa1'),_0x4e51('0xa2')])),{'transaction':_0xd350f4});});});})[_0x4e51('0x33')](function(){return db[_0x4e51('0x56')][_0x4e51('0xa3')](_0x18bfdd['body']['id']);})[_0x4e51('0x33')](respondWithResult(_0x3d002e,null))['catch'](handleError(_0x3d002e,null));};exports[_0x4e51('0xa4')]=function(_0x52f4e3,_0x4d3657,_0x3f2a33){var _0x4b54ab={'raw':!![],'where':{}};var _0x42ffaf={};var _0x2c1557={'count':0x0,'rows':[]};return db[_0x4e51('0x56')][_0x4e51('0x68')]({'where':{'id':_0x52f4e3['params']['id']}})[_0x4e51('0x33')](handleEntityNotFound(_0x4d3657,null))[_0x4e51('0x33')](function(_0x5228c7){if(_0x5228c7){_0x42ffaf['model']=_[_0x4e51('0x45')](db['FaxMessage'][_0x4e51('0x3f')]);_0x42ffaf['query']=_['keys'](_0x52f4e3['query']);_0x42ffaf[_0x4e51('0x46')]=_[_0x4e51('0x47')](_0x42ffaf[_0x4e51('0x48')],_0x42ffaf[_0x4e51('0x44')]);_0x4b54ab[_0x4e51('0x49')]=_['intersection'](_0x42ffaf['model'],qs[_0x4e51('0x4a')](_0x52f4e3['query'][_0x4e51('0x4a')]));_0x4b54ab[_0x4e51('0x49')]=_0x4b54ab[_0x4e51('0x49')][_0x4e51('0x4b')]?_0x4b54ab['attributes']:_0x42ffaf['model'];if(!_0x52f4e3[_0x4e51('0x44')][_0x4e51('0x4c')]('nolimit')){_0x4b54ab[_0x4e51('0x2a')]=qs[_0x4e51('0x2a')](_0x52f4e3[_0x4e51('0x44')][_0x4e51('0x2a')]);_0x4b54ab[_0x4e51('0x29')]=qs['offset'](_0x52f4e3[_0x4e51('0x44')][_0x4e51('0x29')]);}_0x4b54ab[_0x4e51('0x4e')]=qs[_0x4e51('0x6f')](_0x52f4e3[_0x4e51('0x44')][_0x4e51('0x6f')]);_0x4b54ab['where']=qs['filters'](_['pick'](_0x52f4e3[_0x4e51('0x44')],_0x42ffaf[_0x4e51('0x46')]));_0x4b54ab[_0x4e51('0x4f')][_0x4e51('0x66')]=_0x5228c7['id'];if(_0x52f4e3[_0x4e51('0x44')][_0x4e51('0x50')]){_0x4b54ab[_0x4e51('0x4f')]=_[_0x4e51('0x51')](_0x4b54ab['where'],{'$or':_['map'](_0x4b54ab['attributes'],function(_0x496ab7){var _0x23f4d2={};_0x23f4d2[_0x496ab7]={'$like':'%'+_0x52f4e3[_0x4e51('0x44')]['filter']+'%'};return _0x23f4d2;})});}if(_0x52f4e3[_0x4e51('0x44')][_0x4e51('0xa5')]){var _0x1b8f18=_0x52f4e3['query'][_0x4e51('0xa5')][_0x4e51('0xa6')](',');var _0x1dc0ca={};_0x1dc0ca[_0x1b8f18[0x0]]={'$gte':moment(_0x1b8f18[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x4b54ab[_0x4e51('0x4f')]=_[_0x4e51('0x51')](_0x4b54ab[_0x4e51('0x4f')],_0x1dc0ca);}_0x4b54ab=_[_0x4e51('0x51')]({},_0x4b54ab,_0x52f4e3[_0x4e51('0x53')]);return db[_0x4e51('0xa7')][_0x4e51('0x2c')]({'where':_0x4b54ab[_0x4e51('0x4f')]})[_0x4e51('0x33')](function(_0x143ec3){_0x2c1557[_0x4e51('0x2c')]=_0x143ec3;if(_0x52f4e3[_0x4e51('0x44')][_0x4e51('0x54')]){_0x4b54ab[_0x4e51('0x55')]=[{'all':!![]}];}return db[_0x4e51('0xa7')][_0x4e51('0x70')](_0x4b54ab);})[_0x4e51('0x33')](function(_0x40d43d){_0x2c1557['rows']=_0x40d43d;return _0x2c1557;});}})[_0x4e51('0x33')](respondWithFilteredResult(_0x4d3657,_0x4b54ab))[_0x4e51('0x58')](handleError(_0x4d3657,null));};exports[_0x4e51('0x3c')]=function(_0x3bce23,_0x32b8ec,_0x13d59e){var _0x2451d1,_0x577eea={},_0x23f1c3;if(_0x3bce23['body']['to']){_0x23f1c3=_0x3bce23['body']['to'][0x0];}return db[_0x4e51('0x56')]['find']({'where':{'id':_0x3bce23[_0x4e51('0x59')]['id']},'include':[{'model':db[_0x4e51('0xa8')],'as':_0x4e51('0xa9'),'include':[{'model':db[_0x4e51('0x75')],'as':_0x4e51('0xaa'),'where':{'fax':_0x23f1c3},'limit':0x1,'order':[[_0x4e51('0xa0'),_0x4e51('0xab')]]}]}]})[_0x4e51('0x33')](handleEntityNotFound(_0x32b8ec,null))['then'](function(_0x2052b3){_0x2451d1=_0x2052b3;if(_0x3bce23[_0x4e51('0x5c')][_0x4e51('0xac')]&&_0x3bce23['body'][_0x4e51('0xac')][_0x4e51('0x4b')]){for(var _0x4090d1=0x0;_0x4090d1<_0x3bce23['body'][_0x4e51('0xac')][_0x4e51('0x4b')];_0x4090d1+=0x1){_0x3bce23[_0x4e51('0x5c')]['attachments'][_0x4090d1]={'filename':_0x3bce23[_0x4e51('0x5c')][_0x4e51('0xac')][_0x4090d1][_0x4e51('0x3b')],'id':_0x3bce23[_0x4e51('0x5c')]['attachments'][_0x4090d1]['id'],'path':path['join'](config[_0x4e51('0xad')],_0x4e51('0xae'),_0x3bce23[_0x4e51('0x5c')][_0x4e51('0xac')][_0x4090d1]['basename'])};}}return respondWithRpcPromise(_0x4e51('0xaf'),'CheckAfterSend',{'FaxAccountId':_[_0x4e51('0xb0')](_0x3bce23[_0x4e51('0x59')]['id'])?undefined:_0x3bce23[_0x4e51('0x59')]['id'],'path':_[_0x4e51('0xb0')](_0x3bce23[_0x4e51('0x5c')]['attachments'][0x0][_0x4e51('0xb1')])?undefined:_0x3bce23[_0x4e51('0x5c')][_0x4e51('0xac')][0x0][_0x4e51('0xb1')],'fax':_[_0x4e51('0xb0')](_0x3bce23[_0x4e51('0x5c')]['to'][0x0])?undefined:_0x3bce23[_0x4e51('0x5c')]['to'][0x0]},client9002);})[_0x4e51('0x33')](function(){if(_0x2451d1){if(_['isNil'](_0x3bce23['body'][_0x4e51('0xb2')])){_0x3bce23[_0x4e51('0x5c')][_0x4e51('0xb2')]=util[_0x4e51('0xb3')](_0x4e51('0xb4'),_0x2451d1[_0x4e51('0x3b')],_0x2451d1[_0x4e51('0xb5')]);}if(_0x2451d1[_0x4e51('0xa9')]){if(_0x2451d1['List'][_0x4e51('0xaa')]['length']){return _0x2451d1['List']['Contacts'][0x0];}else{return db[_0x4e51('0x75')]['create'](_[_0x4e51('0xb6')](_0x3bce23['body'],{'firstName':_0x3bce23[_0x4e51('0x5c')]['to'][0x0],'phone':_0x3bce23[_0x4e51('0x5c')]['to'][0x0],'fax':_0x3bce23[_0x4e51('0x5c')]['to'][0x0],'ListId':_0x2451d1['ListId']}));}}else{throw new Error(_0x4e51('0xb7'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x4e51('0x33')](function(_0x20449c){if(_0x20449c){return db[_0x4e51('0x73')][_0x4e51('0x60')]({'where':{'ContactId':_0x20449c['id'],'closed':![],'FaxAccountId':_0x2451d1['id']}})['then'](function(_0x1dbae8){if(_0x1dbae8){return[_0x1dbae8,![]];}return db[_0x4e51('0x73')][_0x4e51('0x5b')]({'UserId':_0x3bce23[_0x4e51('0xb8')]['id'],'ContactId':_0x20449c['id'],'FaxAccountId':_0x2451d1['id'],'fax':_0x3bce23[_0x4e51('0x5c')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x4e51('0x51')](_0x3bce23[_0x4e51('0x5c')],{'read':![],'body':_0x3bce23[_0x4e51('0x5c')]['attachments'][0x0][_0x4e51('0xb9')],'FaxAccountId':_0x2451d1['id'],'UserId':_0x3bce23[_0x4e51('0xb8')]['id'],'ContactId':_0x20449c['id'],'AttachmentId':_0x3bce23[_0x4e51('0x5c')][_0x4e51('0xac')][0x0]['id']})]},{'include':[{'model':db[_0x4e51('0xa7')],'as':_0x4e51('0xba')}]})[_0x4e51('0x33')](function(_0x506e42){return[_0x506e42,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x3afff3,_0x366246){if(_0x366246){return _0x3afff3;}return db[_0x4e51('0xa7')][_0x4e51('0x5b')]({'direction':_0x4e51('0xbb'),'read':![],'body':_0x3bce23[_0x4e51('0x5c')]['attachments'][0x0][_0x4e51('0xb9')],'FaxAccountId':_0x2451d1['id'],'FaxInteractionId':_0x3afff3['id'],'UserId':_0x3bce23[_0x4e51('0xb8')]['id'],'ContactId':_0x3afff3[_0x4e51('0xbc')],'AttachmentId':_0x3bce23['body'][_0x4e51('0xac')][0x0]['id']})['then'](function(_0x60ecad){_0x3afff3[_0x4e51('0xbd')]['Messages']=[];_0x3afff3['dataValues'][_0x4e51('0xba')][_0x4e51('0x98')](_0x60ecad[_0x4e51('0xbd')]);return _0x3afff3;});})[_0x4e51('0x33')](function(_0x41936a){respondWithRpcPromise(_0x4e51('0xbe'),_0x4e51('0xbe'),{'FaxAccountId':_[_0x4e51('0xb0')](_0x3bce23[_0x4e51('0x59')]['id'])?undefined:_0x3bce23['params']['id'],'path':_[_0x4e51('0xb0')](_0x3bce23['body']['attachments'][0x0][_0x4e51('0xb1')])?undefined:_0x3bce23[_0x4e51('0x5c')]['attachments'][0x0]['path'],'fax':_[_0x4e51('0xb0')](_0x3bce23['body']['to'][0x0])?undefined:_0x3bce23[_0x4e51('0x5c')]['to'][0x0],'AttachmentId':_0x3bce23[_0x4e51('0x5c')][_0x4e51('0xac')][0x0]['id']},client9002)[_0x4e51('0x33')](function(_0x3a6147){logger['info'](_0x4e51('0xbf'),_0x3a6147);})['catch'](function(_0x162513){logger['info'](_0x4e51('0xbf'),_0x162513);});return _0x41936a;})[_0x4e51('0x33')](respondWithResult(_0x32b8ec,null))[_0x4e51('0x58')](handleError(_0x32b8ec,null));};exports[_0x4e51('0xc0')]=function(_0x322a19,_0x12e013,_0x21c48d){return db[_0x4e51('0x56')][_0x4e51('0x60')]({'where':{'id':_0x322a19['params']['id']}})[_0x4e51('0x33')](handleEntityNotFound(_0x12e013,null))[_0x4e51('0x33')](function(_0x56a367){if(_0x56a367){return _0x56a367[_0x4e51('0xc0')](_0x322a19['body']['ids'],_[_0x4e51('0x74')](_0x322a19['body'],[_0x4e51('0x71'),'id'])||{})[_0x4e51('0xc1')](function(_0xfad97b){for(var _0x15db3c=0x0;_0x15db3c<_0x322a19[_0x4e51('0x5c')][_0x4e51('0x71')][_0x4e51('0x4b')];_0x15db3c+=0x1){socket[_0x4e51('0xc2')](_0x4e51('0xc3'),{'UserId':Number(_0x322a19[_0x4e51('0x5c')]['ids'][_0x15db3c]),'FaxAccountId':Number(_0x322a19['params']['id'])});}return _0xfad97b;});}})[_0x4e51('0x33')](respondWithResult(_0x12e013,null))[_0x4e51('0x58')](handleError(_0x12e013,null));};exports[_0x4e51('0xc4')]=function(_0x156532,_0x19d1de,_0x3f658b){return db[_0x4e51('0x56')][_0x4e51('0x60')]({'where':{'id':_0x156532[_0x4e51('0x59')]['id']}})[_0x4e51('0x33')](handleEntityNotFound(_0x19d1de,null))['then'](function(_0xd1026b){if(_0xd1026b){return _0xd1026b[_0x4e51('0xc4')](_0x156532[_0x4e51('0x44')]['ids'])[_0x4e51('0x33')](function(){if(_[_0x4e51('0xc5')](_0x156532[_0x4e51('0x44')][_0x4e51('0x71')])){for(var _0x399f6b=0x0;_0x399f6b<_0x156532[_0x4e51('0x44')][_0x4e51('0x71')]['length'];_0x399f6b+=0x1){socket['emit'](_0x4e51('0xc6'),{'UserId':Number(_0x156532['query'][_0x4e51('0x71')][_0x399f6b]),'FaxAccountId':Number(_0x156532[_0x4e51('0x59')]['id'])});}}else{socket[_0x4e51('0xc2')](_0x4e51('0xc6'),{'UserId':Number(_0x156532[_0x4e51('0x44')]['ids']),'FaxAccountId':Number(_0x156532[_0x4e51('0x59')]['id'])});}});}})[_0x4e51('0x33')](respondWithStatusCode(_0x19d1de,null))[_0x4e51('0x58')](handleError(_0x19d1de,null));};exports[_0x4e51('0xc7')]=function(_0xbc8e7b,_0x484e42,_0x5d6c02){var _0x43b33f={};var _0x421bf6={};var _0x1d686d;var _0x5f03fd;return db[_0x4e51('0x56')][_0x4e51('0x68')]({'where':{'id':_0xbc8e7b['params']['id']}})[_0x4e51('0x33')](handleEntityNotFound(_0x484e42,null))['then'](function(_0x31a609){if(_0x31a609){_0x1d686d=_0x31a609;_0x421bf6[_0x4e51('0x48')]=_[_0x4e51('0x45')](db[_0x4e51('0x76')][_0x4e51('0x3f')]);_0x421bf6[_0x4e51('0x44')]=_[_0x4e51('0x45')](_0xbc8e7b[_0x4e51('0x44')]);_0x421bf6[_0x4e51('0x46')]=_[_0x4e51('0x47')](_0x421bf6[_0x4e51('0x48')],_0x421bf6[_0x4e51('0x44')]);_0x43b33f['attributes']=_['intersection'](_0x421bf6[_0x4e51('0x48')],qs[_0x4e51('0x4a')](_0xbc8e7b['query'][_0x4e51('0x4a')]));_0x43b33f['attributes']=_0x43b33f[_0x4e51('0x49')][_0x4e51('0x4b')]?_0x43b33f[_0x4e51('0x49')]:_0x421bf6[_0x4e51('0x48')];_0x43b33f[_0x4e51('0x4e')]=qs[_0x4e51('0x6f')](_0xbc8e7b[_0x4e51('0x44')][_0x4e51('0x6f')]);_0x43b33f[_0x4e51('0x4f')]=qs[_0x4e51('0x46')](_[_0x4e51('0x6a')](_0xbc8e7b[_0x4e51('0x44')],_0x421bf6[_0x4e51('0x46')]));if(_0xbc8e7b[_0x4e51('0x44')]['filter']){_0x43b33f['where']=_[_0x4e51('0x51')](_0x43b33f[_0x4e51('0x4f')],{'$or':_[_0x4e51('0x43')](_0x43b33f[_0x4e51('0x49')],function(_0x126714){var _0x1b0d4c={};_0x1b0d4c[_0x126714]={'$like':'%'+_0xbc8e7b[_0x4e51('0x44')][_0x4e51('0x50')]+'%'};return _0x1b0d4c;})});}_0x43b33f=_[_0x4e51('0x51')]({},_0x43b33f,_0xbc8e7b['options']);return _0x1d686d[_0x4e51('0xc7')](_0x43b33f);}})[_0x4e51('0x33')](function(_0x113ad9){if(_0x113ad9){_0x5f03fd=_0x113ad9[_0x4e51('0x4b')];if(!_0xbc8e7b[_0x4e51('0x44')][_0x4e51('0x4c')](_0x4e51('0x4d'))){_0x43b33f[_0x4e51('0x2a')]=qs['limit'](_0xbc8e7b['query'][_0x4e51('0x2a')]);_0x43b33f[_0x4e51('0x29')]=qs[_0x4e51('0x29')](_0xbc8e7b[_0x4e51('0x44')][_0x4e51('0x29')]);}return _0x1d686d[_0x4e51('0xc7')](_0x43b33f);}})['then'](function(_0x39fa2a){if(_0x39fa2a){return _0x39fa2a?{'count':_0x5f03fd,'rows':_0x39fa2a}:null;}})['then'](respondWithResult(_0x484e42,null))[_0x4e51('0x58')](handleError(_0x484e42,null));}; \ No newline at end of file +var _0xa210=['split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','CmContact','Contacts','DESC','attachments','root','server/files/attachments','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','user','out','filename','spread','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','register','client','http','then','info','FaxAccount,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','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','show','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','getAnswers','CannedAnswer','addInteraction','FaxInteraction','omit','User','Owner','internal','Tag','Tags','tag','addApplications','transaction','sequelize','ISOLATION_LEVELS','FaxApplication','bulkCreate','findAndCountAll','finally','getApplications','context','exten','localstationid','system','priority','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','headerinfo','minrate','modem','t38timeout','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte'];(function(_0x8a6a58,_0x191904){var _0x3d2b3d=function(_0x2dcca4){while(--_0x2dcca4){_0x8a6a58['push'](_0x8a6a58['shift']());}};_0x3d2b3d(++_0x191904);}(_0xa210,0xdd));var _0x0a21=function(_0x2f2a5a,_0x2a95e0){_0x2f2a5a=_0x2f2a5a-0x0;var _0x5126c6=_0xa210[_0x2f2a5a];return _0x5126c6;};'use strict';var emlformat=require(_0x0a21('0x0'));var rimraf=require(_0x0a21('0x1'));var zipdir=require(_0x0a21('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0a21('0x3'));var moment=require(_0x0a21('0x4'));var BPromise=require(_0x0a21('0x5'));var Mustache=require('mustache');var util=require(_0x0a21('0x6'));var path=require(_0x0a21('0x7'));var sox=require(_0x0a21('0x8'));var csv=require(_0x0a21('0x9'));var ejs=require(_0x0a21('0xa'));var fs=require('fs');var fs_extra=require(_0x0a21('0xb'));var _=require(_0x0a21('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a21('0xd'));var toCsv=require(_0x0a21('0x9'));var querystring=require(_0x0a21('0xe'));var Papa=require(_0x0a21('0xf'));var Redis=require('ioredis');var authService=require(_0x0a21('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0a21('0x11'));var hardwareService=require(_0x0a21('0x12'));var logger=require(_0x0a21('0x13'))('api');var utils=require(_0x0a21('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x0a21('0x15'));var db=require(_0x0a21('0x16'))['db'];config[_0x0a21('0x17')]=_[_0x0a21('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a21('0x17')]));require('./faxAccount.socket')[_0x0a21('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0x0a21('0x1a')][_0x0a21('0x1b')]({'port':0x232c});var client9002=jayson[_0x0a21('0x1a')][_0x0a21('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x326ddd,_0x5e4780,_0x4112eb,_0x4512c5){return new BPromise(function(_0x5e971c,_0x5a5ee0){var _0x5c2a33=_0x4512c5||client;return _0x5c2a33['request'](_0x326ddd,_0x4112eb)[_0x0a21('0x1c')](function(_0x2f7325){logger[_0x0a21('0x1d')](_0x0a21('0x1e'),_0x5e4780,'request\x20sent');logger[_0x0a21('0x1f')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x5e4780,_0x0a21('0x20'),JSON['stringify'](_0x2f7325));if(_0x2f7325[_0x0a21('0x21')]){if(_0x2f7325[_0x0a21('0x21')]['code']===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x5e4780,_0x2f7325[_0x0a21('0x21')][_0x0a21('0x22')]);return _0x5a5ee0(_0x2f7325[_0x0a21('0x21')][_0x0a21('0x22')]);}logger[_0x0a21('0x21')](_0x0a21('0x1e'),_0x5e4780,_0x2f7325[_0x0a21('0x21')][_0x0a21('0x22')]);return _0x5e971c(_0x2f7325[_0x0a21('0x21')][_0x0a21('0x22')]);}else{logger[_0x0a21('0x1d')](_0x0a21('0x1e'),_0x5e4780,_0x0a21('0x20'));_0x5e971c(_0x2f7325[_0x0a21('0x23')]['message']);}})[_0x0a21('0x24')](function(_0x500a7f){logger[_0x0a21('0x21')]('FaxAccount,\x20%s,\x20%s',_0x5e4780,_0x500a7f);_0x5a5ee0(_0x500a7f);});});}function respondWithStatusCode(_0x3f0e74,_0x3cd1f2){_0x3cd1f2=_0x3cd1f2||0xcc;return function(_0x4b8364){if(_0x4b8364){return _0x3f0e74['sendStatus'](_0x3cd1f2);}return _0x3f0e74[_0x0a21('0x25')](_0x3cd1f2)[_0x0a21('0x26')]();};}function respondWithResult(_0x186299,_0xcbcb5b){_0xcbcb5b=_0xcbcb5b||0xc8;return function(_0x4229bd){if(_0x4229bd){return _0x186299['status'](_0xcbcb5b)[_0x0a21('0x27')](_0x4229bd);}};}function respondWithFilteredResult(_0x4409b4,_0x43d957){return function(_0xbc9af3){if(_0xbc9af3){var _0x1640d2=typeof _0x43d957[_0x0a21('0x28')]===_0x0a21('0x29')&&typeof _0x43d957[_0x0a21('0x2a')]===_0x0a21('0x29');var _0x3adabf=_0xbc9af3[_0x0a21('0x2b')];var _0x525716=_0x1640d2?0x0:_0x43d957['offset'];var _0xf9ebd6=_0x1640d2?_0xbc9af3[_0x0a21('0x2b')]:_0x43d957['offset']+_0x43d957['limit'];var _0x2965a6;if(_0xf9ebd6>=_0x3adabf){_0xf9ebd6=_0x3adabf;_0x2965a6=0xc8;}else{_0x2965a6=0xce;}_0x4409b4[_0x0a21('0x25')](_0x2965a6);return _0x4409b4[_0x0a21('0x2c')](_0x0a21('0x2d'),_0x525716+'-'+_0xf9ebd6+'/'+_0x3adabf)['json'](_0xbc9af3);}return null;};}function patchUpdates(_0x3fa43d){return function(_0x1a029a){try{jsonpatch[_0x0a21('0x2e')](_0x1a029a,_0x3fa43d,!![]);}catch(_0x21823b){return BPromise[_0x0a21('0x2f')](_0x21823b);}return _0x1a029a[_0x0a21('0x30')]();};}function saveUpdates(_0x465107,_0x4a66b9){return function(_0x35709f){if(_0x35709f){return _0x35709f[_0x0a21('0x31')](_0x465107)['then'](function(_0x435f8d){return _0x435f8d;});}return null;};}function removeEntity(_0x21cfaf,_0x3f567c){return function(_0x49dad1){if(_0x49dad1){return _0x49dad1[_0x0a21('0x32')]()['then'](function(){var _0x469b47=_0x49dad1[_0x0a21('0x33')]({'plain':!![]});var _0x1547e5=_0x0a21('0x34');return db[_0x0a21('0x35')]['destroy']({'where':{'type':_0x1547e5,'resourceId':_0x469b47['id']}})['then'](function(){return _0x49dad1;});})[_0x0a21('0x1c')](function(){_0x21cfaf['status'](0xcc)[_0x0a21('0x26')]();});}};}function handleEntityNotFound(_0x28705d,_0x112ca7){return function(_0x4f7aa5){if(!_0x4f7aa5){_0x28705d[_0x0a21('0x36')](0x194);}return _0x4f7aa5;};}function handleError(_0x992f8b,_0xf6bf75){_0xf6bf75=_0xf6bf75||0x1f4;return function(_0x2312d6){logger[_0x0a21('0x21')](_0x2312d6[_0x0a21('0x37')]);if(_0x2312d6[_0x0a21('0x38')]){delete _0x2312d6[_0x0a21('0x38')];}_0x992f8b[_0x0a21('0x25')](_0xf6bf75)[_0x0a21('0x39')](_0x2312d6);};}exports[_0x0a21('0x3a')]=function(_0x1a64ce,_0x33eea4){var _0x17314f={'include':[{'model':db[_0x0a21('0x3b')],'as':_0x0a21('0x3c')}]},_0x3756e6={},_0x48f826={'count':0x0,'rows':[]};var _0x249d89=_[_0x0a21('0x3d')](db[_0x0a21('0x3e')][_0x0a21('0x3f')],function(_0x5eb4a6){return{'name':_0x5eb4a6[_0x0a21('0x40')],'type':_0x5eb4a6[_0x0a21('0x41')][_0x0a21('0x42')]};});_0x3756e6[_0x0a21('0x43')]=_[_0x0a21('0x3d')](_0x249d89,_0x0a21('0x38'));_0x3756e6[_0x0a21('0x44')]=_[_0x0a21('0x45')](_0x1a64ce['query']);_0x3756e6[_0x0a21('0x46')]=_[_0x0a21('0x47')](_0x3756e6[_0x0a21('0x43')],_0x3756e6[_0x0a21('0x44')]);_0x17314f[_0x0a21('0x48')]=_[_0x0a21('0x47')](_0x3756e6[_0x0a21('0x43')],qs[_0x0a21('0x49')](_0x1a64ce[_0x0a21('0x44')][_0x0a21('0x49')]));_0x17314f[_0x0a21('0x48')]=_0x17314f['attributes'][_0x0a21('0x4a')]?_0x17314f[_0x0a21('0x48')]:_0x3756e6[_0x0a21('0x43')];if(!_0x1a64ce[_0x0a21('0x44')][_0x0a21('0x4b')](_0x0a21('0x4c'))){_0x17314f[_0x0a21('0x2a')]=qs[_0x0a21('0x2a')](_0x1a64ce['query']['limit']);_0x17314f[_0x0a21('0x28')]=qs[_0x0a21('0x28')](_0x1a64ce[_0x0a21('0x44')]['offset']);}_0x17314f[_0x0a21('0x4d')]=qs[_0x0a21('0x4e')](_0x1a64ce[_0x0a21('0x44')][_0x0a21('0x4e')]);_0x17314f[_0x0a21('0x4f')]=qs[_0x0a21('0x46')](_[_0x0a21('0x50')](_0x1a64ce[_0x0a21('0x44')],_0x3756e6[_0x0a21('0x46')]),_0x249d89);if(_0x1a64ce[_0x0a21('0x44')][_0x0a21('0x51')]){_0x17314f[_0x0a21('0x4f')]=_[_0x0a21('0x52')](_0x17314f[_0x0a21('0x4f')],{'$or':_[_0x0a21('0x3d')](_0x249d89,function(_0x5d7f24){if(_0x5d7f24[_0x0a21('0x41')]!=='VIRTUAL'){var _0x1809c8={};_0x1809c8[_0x5d7f24[_0x0a21('0x38')]]={'$like':'%'+_0x1a64ce[_0x0a21('0x44')][_0x0a21('0x51')]+'%'};return _0x1809c8;}})});}_0x17314f=_[_0x0a21('0x52')]({},_0x17314f,_0x1a64ce[_0x0a21('0x53')]);var _0x3824da={'where':_0x17314f[_0x0a21('0x4f')]};return db[_0x0a21('0x3e')][_0x0a21('0x2b')](_0x3824da)[_0x0a21('0x1c')](function(_0x4089f2){_0x48f826[_0x0a21('0x2b')]=_0x4089f2;if(_0x1a64ce[_0x0a21('0x44')][_0x0a21('0x54')]){_0x17314f[_0x0a21('0x55')]=[{'all':!![]}];}return db[_0x0a21('0x3e')][_0x0a21('0x56')](_0x17314f);})[_0x0a21('0x1c')](function(_0xfba972){_0x48f826[_0x0a21('0x57')]=_0xfba972;return _0x48f826;})['then'](respondWithFilteredResult(_0x33eea4,_0x17314f))[_0x0a21('0x24')](handleError(_0x33eea4,null));};exports[_0x0a21('0x58')]=function(_0x9ad89f,_0x3da6d1){var _0x35f75d={'raw':![],'where':{'id':_0x9ad89f[_0x0a21('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0x0a21('0x3c')}]},_0x306b12={};_0x306b12[_0x0a21('0x43')]=_['keys'](db[_0x0a21('0x3e')]['rawAttributes']);_0x306b12['query']=_[_0x0a21('0x45')](_0x9ad89f['query']);_0x306b12[_0x0a21('0x46')]=_[_0x0a21('0x47')](_0x306b12[_0x0a21('0x43')],_0x306b12[_0x0a21('0x44')]);_0x35f75d['attributes']=_[_0x0a21('0x47')](_0x306b12[_0x0a21('0x43')],qs[_0x0a21('0x49')](_0x9ad89f[_0x0a21('0x44')][_0x0a21('0x49')]));_0x35f75d[_0x0a21('0x48')]=_0x35f75d['attributes'][_0x0a21('0x4a')]?_0x35f75d[_0x0a21('0x48')]:_0x306b12[_0x0a21('0x43')];if(_0x9ad89f['query']['includeAll']){_0x35f75d[_0x0a21('0x55')]=[{'all':!![]}];}_0x35f75d=_[_0x0a21('0x52')]({},_0x35f75d,_0x9ad89f[_0x0a21('0x53')]);return db['FaxAccount']['find'](_0x35f75d)[_0x0a21('0x1c')](handleEntityNotFound(_0x3da6d1,null))[_0x0a21('0x1c')](respondWithResult(_0x3da6d1,null))[_0x0a21('0x24')](handleError(_0x3da6d1,null));};exports[_0x0a21('0x5a')]=function(_0x34bcc2,_0x5b8ebb){return db['FaxAccount'][_0x0a21('0x5a')](_0x34bcc2[_0x0a21('0x5b')],{})[_0x0a21('0x1c')](function(_0x607752){var _0x2d7e78=_0x34bcc2['user'][_0x0a21('0x33')]({'plain':!![]});if(!_0x2d7e78)throw new Error(_0x0a21('0x5c'));if(_0x2d7e78[_0x0a21('0x5d')]==='user'){var _0x44aed2=_0x607752[_0x0a21('0x33')]({'plain':!![]});var _0x4c6f5f='FaxAccounts';return db['UserProfileSection'][_0x0a21('0x5e')]({'where':{'name':_0x4c6f5f,'userProfileId':_0x2d7e78[_0x0a21('0x5f')]},'raw':!![]})['then'](function(_0x250995){if(_0x250995&&_0x250995['autoAssociation']===0x0){return db[_0x0a21('0x35')][_0x0a21('0x5a')]({'name':_0x44aed2[_0x0a21('0x38')],'resourceId':_0x44aed2['id'],'type':_0x250995['name'],'sectionId':_0x250995['id']},{})[_0x0a21('0x1c')](function(){return _0x607752;});}else{return _0x607752;}})['catch'](function(_0x522e7b){logger[_0x0a21('0x21')](_0x0a21('0x60'),_0x522e7b);throw _0x522e7b;});}return _0x607752;})[_0x0a21('0x1c')](respondWithResult(_0x5b8ebb,0xc9))[_0x0a21('0x24')](handleError(_0x5b8ebb,null));};exports['update']=function(_0x1ef2f7,_0x2748e1){if(_0x1ef2f7[_0x0a21('0x5b')]['id']){delete _0x1ef2f7[_0x0a21('0x5b')]['id'];}return db[_0x0a21('0x3e')][_0x0a21('0x5e')]({'where':{'id':_0x1ef2f7[_0x0a21('0x59')]['id']},'include':[{'model':db[_0x0a21('0x3b')],'as':_0x0a21('0x3c')}]})[_0x0a21('0x1c')](handleEntityNotFound(_0x2748e1,null))['then'](saveUpdates(_0x1ef2f7['body'],null))[_0x0a21('0x1c')](respondWithResult(_0x2748e1,null))[_0x0a21('0x24')](handleError(_0x2748e1,null));};exports['destroy']=function(_0x151626,_0x4e5c28){return db[_0x0a21('0x3e')][_0x0a21('0x5e')]({'where':{'id':_0x151626[_0x0a21('0x59')]['id']}})[_0x0a21('0x1c')](handleEntityNotFound(_0x4e5c28,null))[_0x0a21('0x1c')](removeEntity(_0x4e5c28,null))['catch'](handleError(_0x4e5c28,null));};exports[_0x0a21('0x61')]=function(_0x3e5c2b,_0x4038f1){return db['FaxAccount'][_0x0a21('0x61')]()[_0x0a21('0x1c')](respondWithResult(_0x4038f1,null))[_0x0a21('0x24')](handleError(_0x4038f1,null));};exports[_0x0a21('0x62')]=function(_0x152411,_0x589923,_0x7bc99d){if(_0x152411[_0x0a21('0x5b')]['id']){delete _0x152411['body']['id'];}return db[_0x0a21('0x3e')][_0x0a21('0x5e')]({'where':{'id':_0x152411['params']['id']}})[_0x0a21('0x1c')](handleEntityNotFound(_0x589923,null))[_0x0a21('0x1c')](function(_0xba3f95){if(_0xba3f95){_0x152411[_0x0a21('0x5b')][_0x0a21('0x63')]=_0xba3f95['id'];return db[_0x0a21('0x64')][_0x0a21('0x5a')](_0x152411[_0x0a21('0x5b')]);}})[_0x0a21('0x1c')](respondWithResult(_0x589923,null))['catch'](handleError(_0x589923,null));};exports[_0x0a21('0x65')]=function(_0x307d86,_0x566f11,_0x2812ca){var _0xea3f05={'raw':![],'where':{}};var _0x21b5be={};var _0x1e48f5={'count':0x0,'rows':[]};return db[_0x0a21('0x3e')][_0x0a21('0x66')]({'where':{'id':_0x307d86[_0x0a21('0x59')]['id']}})[_0x0a21('0x1c')](handleEntityNotFound(_0x566f11,null))[_0x0a21('0x1c')](function(_0x404aea){if(_0x404aea){_0x21b5be[_0x0a21('0x43')]=_[_0x0a21('0x45')](db[_0x0a21('0x64')][_0x0a21('0x3f')]);_0x21b5be[_0x0a21('0x44')]=_['keys'](_0x307d86[_0x0a21('0x44')]);_0x21b5be['filters']=_[_0x0a21('0x47')](_0x21b5be[_0x0a21('0x43')],_0x21b5be[_0x0a21('0x44')]);_0xea3f05[_0x0a21('0x48')]=_[_0x0a21('0x47')](_0x21b5be['model'],qs[_0x0a21('0x49')](_0x307d86[_0x0a21('0x44')]['fields']));_0xea3f05[_0x0a21('0x48')]=_0xea3f05[_0x0a21('0x48')]['length']?_0xea3f05[_0x0a21('0x48')]:_0x21b5be[_0x0a21('0x43')];if(!_0x307d86['query'][_0x0a21('0x4b')](_0x0a21('0x4c'))){_0xea3f05[_0x0a21('0x2a')]=qs['limit'](_0x307d86['query']['limit']);_0xea3f05[_0x0a21('0x28')]=qs['offset'](_0x307d86['query'][_0x0a21('0x28')]);}_0xea3f05[_0x0a21('0x4d')]=qs[_0x0a21('0x4e')](_0x307d86['query'][_0x0a21('0x4e')]);_0xea3f05[_0x0a21('0x4f')]=qs[_0x0a21('0x46')](_[_0x0a21('0x50')](_0x307d86[_0x0a21('0x44')],_0x21b5be[_0x0a21('0x46')]));_0xea3f05[_0x0a21('0x4f')][_0x0a21('0x63')]=_0x404aea['id'];if(_0x307d86[_0x0a21('0x44')]['filter']){_0xea3f05[_0x0a21('0x4f')]=_['merge'](_0xea3f05[_0x0a21('0x4f')],{'$or':_['map'](_0xea3f05[_0x0a21('0x48')],function(_0x267a43){var _0x11b015={};_0x11b015[_0x267a43]={'$like':'%'+_0x307d86[_0x0a21('0x44')]['filter']+'%'};return _0x11b015;})});}_0xea3f05=_[_0x0a21('0x52')]({},_0xea3f05,_0x307d86[_0x0a21('0x53')]);return db[_0x0a21('0x64')][_0x0a21('0x2b')]({'where':_0xea3f05[_0x0a21('0x4f')]})[_0x0a21('0x1c')](function(_0x4d22f8){_0x1e48f5[_0x0a21('0x2b')]=_0x4d22f8;if(_0x307d86[_0x0a21('0x44')][_0x0a21('0x54')]){_0xea3f05[_0x0a21('0x55')]=[{'all':!![]}];}return db[_0x0a21('0x64')][_0x0a21('0x56')](_0xea3f05);})[_0x0a21('0x1c')](function(_0x1e99dd){_0x1e48f5['rows']=_0x1e99dd;return _0x1e48f5;});}})[_0x0a21('0x1c')](respondWithFilteredResult(_0x566f11,_0xea3f05))[_0x0a21('0x24')](handleError(_0x566f11,null));};exports['removeDispositions']=function(_0x2c987e,_0x1bdd2b,_0x51b8ad){return db[_0x0a21('0x3e')][_0x0a21('0x5e')]({'where':{'id':_0x2c987e[_0x0a21('0x59')]['id']}})[_0x0a21('0x1c')](handleEntityNotFound(_0x1bdd2b,null))[_0x0a21('0x1c')](function(_0x421c5f){if(_0x421c5f){return _0x421c5f[_0x0a21('0x67')](_0x2c987e[_0x0a21('0x44')][_0x0a21('0x68')]);}})['then'](respondWithStatusCode(_0x1bdd2b,null))[_0x0a21('0x24')](handleError(_0x1bdd2b,null));};exports['addAnswer']=function(_0x486abc,_0xda5f9b,_0xda0e73){if(_0x486abc[_0x0a21('0x5b')]['id']){delete _0x486abc[_0x0a21('0x5b')]['id'];}return db[_0x0a21('0x3e')]['find']({'where':{'id':_0x486abc['params']['id']}})[_0x0a21('0x1c')](handleEntityNotFound(_0xda5f9b,null))[_0x0a21('0x1c')](function(_0x3c148f){if(_0x3c148f){_0x486abc[_0x0a21('0x5b')][_0x0a21('0x63')]=_0x3c148f['id'];return db['CannedAnswer']['create'](_0x486abc[_0x0a21('0x5b')]);}})['then'](respondWithResult(_0xda5f9b,null))[_0x0a21('0x24')](handleError(_0xda5f9b,null));};exports[_0x0a21('0x69')]=function(_0x1b9196,_0x3baaf9,_0xa465e6){var _0x4160d7={'raw':![],'where':{}};var _0x590c24={};var _0x5a7dcf={'count':0x0,'rows':[]};return db[_0x0a21('0x3e')]['findOne']({'where':{'id':_0x1b9196[_0x0a21('0x59')]['id']}})['then'](handleEntityNotFound(_0x3baaf9,null))['then'](function(_0xd1d397){if(_0xd1d397){_0x590c24[_0x0a21('0x43')]=_[_0x0a21('0x45')](db[_0x0a21('0x6a')]['rawAttributes']);_0x590c24[_0x0a21('0x44')]=_[_0x0a21('0x45')](_0x1b9196[_0x0a21('0x44')]);_0x590c24[_0x0a21('0x46')]=_['intersection'](_0x590c24[_0x0a21('0x43')],_0x590c24[_0x0a21('0x44')]);_0x4160d7['attributes']=_[_0x0a21('0x47')](_0x590c24[_0x0a21('0x43')],qs['fields'](_0x1b9196[_0x0a21('0x44')][_0x0a21('0x49')]));_0x4160d7['attributes']=_0x4160d7[_0x0a21('0x48')][_0x0a21('0x4a')]?_0x4160d7[_0x0a21('0x48')]:_0x590c24[_0x0a21('0x43')];if(!_0x1b9196[_0x0a21('0x44')][_0x0a21('0x4b')](_0x0a21('0x4c'))){_0x4160d7[_0x0a21('0x2a')]=qs[_0x0a21('0x2a')](_0x1b9196['query']['limit']);_0x4160d7['offset']=qs['offset'](_0x1b9196[_0x0a21('0x44')]['offset']);}_0x4160d7[_0x0a21('0x4d')]=qs['sort'](_0x1b9196[_0x0a21('0x44')][_0x0a21('0x4e')]);_0x4160d7['where']=qs[_0x0a21('0x46')](_[_0x0a21('0x50')](_0x1b9196[_0x0a21('0x44')],_0x590c24[_0x0a21('0x46')]));_0x4160d7[_0x0a21('0x4f')][_0x0a21('0x63')]=_0xd1d397['id'];if(_0x1b9196[_0x0a21('0x44')][_0x0a21('0x51')]){_0x4160d7[_0x0a21('0x4f')]=_[_0x0a21('0x52')](_0x4160d7[_0x0a21('0x4f')],{'$or':_['map'](_0x4160d7[_0x0a21('0x48')],function(_0x12a539){var _0x28ea7c={};_0x28ea7c[_0x12a539]={'$like':'%'+_0x1b9196['query'][_0x0a21('0x51')]+'%'};return _0x28ea7c;})});}_0x4160d7=_[_0x0a21('0x52')]({},_0x4160d7,_0x1b9196[_0x0a21('0x53')]);return db['CannedAnswer'][_0x0a21('0x2b')]({'where':_0x4160d7[_0x0a21('0x4f')]})['then'](function(_0xa02d3e){_0x5a7dcf[_0x0a21('0x2b')]=_0xa02d3e;if(_0x1b9196['query'][_0x0a21('0x54')]){_0x4160d7[_0x0a21('0x55')]=[{'all':!![]}];}return db[_0x0a21('0x6a')][_0x0a21('0x56')](_0x4160d7);})[_0x0a21('0x1c')](function(_0x164d3f){_0x5a7dcf['rows']=_0x164d3f;return _0x5a7dcf;});}})[_0x0a21('0x1c')](respondWithFilteredResult(_0x3baaf9,_0x4160d7))['catch'](handleError(_0x3baaf9,null));};exports['removeAnswers']=function(_0x207aca,_0x46f775,_0x445375){return db[_0x0a21('0x3e')][_0x0a21('0x5e')]({'where':{'id':_0x207aca[_0x0a21('0x59')]['id']}})[_0x0a21('0x1c')](handleEntityNotFound(_0x46f775,null))[_0x0a21('0x1c')](function(_0x3c23b8){if(_0x3c23b8){return _0x3c23b8['removeAnswers'](_0x207aca[_0x0a21('0x44')][_0x0a21('0x68')]);}})[_0x0a21('0x1c')](respondWithStatusCode(_0x46f775,null))[_0x0a21('0x24')](handleError(_0x46f775,null));};exports[_0x0a21('0x6b')]=function(_0x2f8031,_0x3f41fc,_0x2bba43){return db[_0x0a21('0x6c')][_0x0a21('0x5e')]({'where':{'id':_0x2f8031[_0x0a21('0x59')]['id']}})[_0x0a21('0x1c')](handleEntityNotFound(_0x3f41fc,null))[_0x0a21('0x1c')](function(_0x472427){if(_0x472427){return _0x472427[_0x0a21('0x6b')](_0x2f8031[_0x0a21('0x5b')][_0x0a21('0x68')],_[_0x0a21('0x6d')](_0x2f8031['body'],[_0x0a21('0x68'),'id'])||{});}})[_0x0a21('0x1c')](respondWithResult(_0x3f41fc,null))[_0x0a21('0x24')](handleError(_0x3f41fc,null));};exports['getInteractions']=function(_0xf08108,_0x476b55,_0x602781){var _0x4b9476={'raw':![],'where':{}};var _0x5bba3a={};var _0x2be130={'count':0x0,'rows':[]};return db[_0x0a21('0x3e')][_0x0a21('0x66')]({'where':{'id':_0xf08108['params']['id']}})[_0x0a21('0x1c')](handleEntityNotFound(_0x476b55,null))[_0x0a21('0x1c')](function(_0x7b46){if(_0x7b46){_0x5bba3a[_0x0a21('0x43')]=_[_0x0a21('0x45')](db['FaxInteraction'][_0x0a21('0x3f')]);_0x5bba3a['query']=_[_0x0a21('0x45')](_0xf08108[_0x0a21('0x44')]);_0x5bba3a[_0x0a21('0x46')]=_[_0x0a21('0x47')](_0x5bba3a['model'],_0x5bba3a[_0x0a21('0x44')]);_0x4b9476[_0x0a21('0x48')]=_[_0x0a21('0x47')](_0x5bba3a[_0x0a21('0x43')],qs[_0x0a21('0x49')](_0xf08108[_0x0a21('0x44')][_0x0a21('0x49')]));_0x4b9476[_0x0a21('0x48')]=_0x4b9476[_0x0a21('0x48')][_0x0a21('0x4a')]?_0x4b9476[_0x0a21('0x48')]:_0x5bba3a[_0x0a21('0x43')];if(!_0xf08108[_0x0a21('0x44')][_0x0a21('0x4b')](_0x0a21('0x4c'))){_0x4b9476[_0x0a21('0x2a')]=qs[_0x0a21('0x2a')](_0xf08108[_0x0a21('0x44')][_0x0a21('0x2a')]);_0x4b9476['offset']=qs[_0x0a21('0x28')](_0xf08108[_0x0a21('0x44')][_0x0a21('0x28')]);}_0x4b9476[_0x0a21('0x4d')]=qs['sort'](_0xf08108['query'][_0x0a21('0x4e')]);_0x4b9476[_0x0a21('0x4f')]=qs[_0x0a21('0x46')](_[_0x0a21('0x50')](_0xf08108[_0x0a21('0x44')],_0x5bba3a[_0x0a21('0x46')]));_0x4b9476[_0x0a21('0x4f')]['FaxAccountId']=_0x7b46['id'];if(_0xf08108[_0x0a21('0x44')][_0x0a21('0x51')]){_0x4b9476[_0x0a21('0x4f')]=_[_0x0a21('0x52')](_0x4b9476[_0x0a21('0x4f')],{'$or':_[_0x0a21('0x3d')](_0x4b9476['attributes'],function(_0x47413b){var _0x542904={};_0x542904[_0x47413b]={'$like':'%'+_0xf08108['query'][_0x0a21('0x51')]+'%'};return _0x542904;})});}_0x4b9476=_['merge']({},_0x4b9476,_0xf08108[_0x0a21('0x53')]);return db[_0x0a21('0x6c')][_0x0a21('0x2b')]({'where':_0x4b9476['where']})['then'](function(_0x441900){_0x2be130[_0x0a21('0x2b')]=_0x441900;if(_0xf08108[_0x0a21('0x44')][_0x0a21('0x54')]){_0x4b9476['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x0a21('0x6e')],'as':_0x0a21('0x6f'),'attributes':[_0x0a21('0x38'),'fullname',_0x0a21('0x70')],'required':![]},{'model':db[_0x0a21('0x71')],'as':_0x0a21('0x72'),'attributes':['id',_0x0a21('0x38'),'color'],'where':_0xf08108['query'][_0x0a21('0x73')]?{'id':_0xf08108[_0x0a21('0x44')][_0x0a21('0x73')]}:undefined,'required':_0xf08108[_0x0a21('0x44')][_0x0a21('0x73')]?!![]:![]}];}return db[_0x0a21('0x6c')][_0x0a21('0x56')](_0x4b9476);})[_0x0a21('0x1c')](function(_0x24748e){_0x2be130[_0x0a21('0x57')]=_0x24748e;return _0x2be130;});}})[_0x0a21('0x1c')](respondWithFilteredResult(_0x476b55,_0x4b9476))[_0x0a21('0x24')](handleError(_0x476b55,null));};exports[_0x0a21('0x74')]=function(_0x352c03,_0xcdf9c0){var _0x32e632=_0x352c03[_0x0a21('0x59')]['id'];var _0x221c1c=_0x352c03[_0x0a21('0x5b')];var _0x622ed0=0xc8;var _0x59fd3f=null;return db['sequelize'][_0x0a21('0x75')]({'isolationLevel':db[_0x0a21('0x76')]['Transaction'][_0x0a21('0x77')]['READ_COMMITTED']},function(_0x559493){return db['FaxAccount']['findOne']({'where':{'id':_0x32e632},'transaction':_0x559493})[_0x0a21('0x1c')](function(_0x1050b1){if(_0x1050b1){return db[_0x0a21('0x78')]['destroy']({'where':{'FaxAccountId':_0x32e632},'transaction':_0x559493})[_0x0a21('0x1c')](function(){var _0x5f418e=_['map'](_0x221c1c,function(_0x392679){_0x392679[_0x0a21('0x63')]=_0x32e632;return _0x392679;});return db[_0x0a21('0x78')][_0x0a21('0x79')](_0x5f418e,{'transaction':_0x559493});});}else{_0x622ed0=0x194;_0x59fd3f=[];}});})[_0x0a21('0x1c')](function(){if(_0x622ed0!==0x194){return db[_0x0a21('0x78')][_0x0a21('0x7a')]({'where':{'FaxAccountId':_0x32e632},'order':'priority'})[_0x0a21('0x1c')](function(_0x3e113c){_0x59fd3f=_0x3e113c;});}})['catch'](function(_0x3fc4ff){_0x622ed0=0x1f4;logger[_0x0a21('0x21')](_0x3fc4ff[_0x0a21('0x37')]);if(_0x3fc4ff['name']){delete _0x3fc4ff[_0x0a21('0x38')];}_0x59fd3f=_0x3fc4ff;})[_0x0a21('0x7b')](function(){if(_0x59fd3f===null){_0xcdf9c0[_0x0a21('0x36')](_0x622ed0);}else{if(_0x622ed0===0x1f4){_0xcdf9c0['status'](_0x622ed0)[_0x0a21('0x39')](_0x59fd3f);}else{_0xcdf9c0[_0x0a21('0x25')](_0x622ed0)['json'](_0x59fd3f);}}});};exports[_0x0a21('0x7c')]=function(_0x5d17a5,_0x247c9e,_0x8b142b){var _0x318a18={};var _0x13c175={};var _0x2f58be;var _0x4dc14a;return db['FaxAccount'][_0x0a21('0x66')]({'where':{'id':_0x5d17a5['params']['id']}})['then'](handleEntityNotFound(_0x247c9e,null))['then'](function(_0x4cca6d){if(_0x4cca6d){_0x2f58be=_0x4cca6d;_0x13c175['model']=_['keys'](db[_0x0a21('0x78')]['rawAttributes']);_0x13c175[_0x0a21('0x44')]=_[_0x0a21('0x45')](_0x5d17a5[_0x0a21('0x44')]);_0x13c175['filters']=_[_0x0a21('0x47')](_0x13c175[_0x0a21('0x43')],_0x13c175[_0x0a21('0x44')]);_0x318a18[_0x0a21('0x48')]=_[_0x0a21('0x47')](_0x13c175['model'],qs[_0x0a21('0x49')](_0x5d17a5[_0x0a21('0x44')][_0x0a21('0x49')]));_0x318a18[_0x0a21('0x48')]=_0x318a18[_0x0a21('0x48')]['length']?_0x318a18[_0x0a21('0x48')]:_0x13c175['model'];_0x318a18[_0x0a21('0x4d')]=qs[_0x0a21('0x4e')](_0x5d17a5['query'][_0x0a21('0x4e')]);_0x318a18['where']=qs['filters'](_[_0x0a21('0x50')](_0x5d17a5[_0x0a21('0x44')],_0x13c175[_0x0a21('0x46')]));if(_0x5d17a5[_0x0a21('0x44')][_0x0a21('0x51')]){_0x318a18['where']=_['merge'](_0x318a18[_0x0a21('0x4f')],{'$or':_[_0x0a21('0x3d')](_0x318a18[_0x0a21('0x48')],function(_0x3bb838){var _0x1bf041={};_0x1bf041[_0x3bb838]={'$like':'%'+_0x5d17a5['query'][_0x0a21('0x51')]+'%'};return _0x1bf041;})});}_0x318a18=_[_0x0a21('0x52')]({},_0x318a18,_0x5d17a5['options']);return _0x2f58be[_0x0a21('0x7c')](_0x318a18);}})['then'](function(_0x56ff3e){if(_0x56ff3e){_0x4dc14a=_0x56ff3e['length'];if(!_0x5d17a5[_0x0a21('0x44')][_0x0a21('0x4b')](_0x0a21('0x4c'))){_0x318a18[_0x0a21('0x2a')]=qs[_0x0a21('0x2a')](_0x5d17a5[_0x0a21('0x44')]['limit']);_0x318a18[_0x0a21('0x28')]=qs[_0x0a21('0x28')](_0x5d17a5[_0x0a21('0x44')][_0x0a21('0x28')]);}return _0x2f58be[_0x0a21('0x7c')](_0x318a18);}})[_0x0a21('0x1c')](function(_0x5e3bbd){if(_0x5e3bbd){return _0x5e3bbd?{'count':_0x4dc14a,'rows':_0x5e3bbd}:null;}})[_0x0a21('0x1c')](respondWithResult(_0x247c9e,null))[_0x0a21('0x24')](handleError(_0x247c9e,null));};function Extension(_0x145137,_0xd3dd0,_0x5bed14,_0x5da690){this[_0x0a21('0x7d')]='from-voip-provider';this[_0x0a21('0x7e')]=_0x145137[_0x0a21('0x7f')];this['app']=_0x5da690;this[_0x0a21('0x41')]=_0x0a21('0x80');this['description']='Fax\x20Extension';this['FaxAccountId']=_0x145137['id'];this[_0x0a21('0x81')]=_0xd3dd0;this['appdata']=_0x5bed14;}function createExtensionsReciveFax(_0x3a8e03){var _0x1f5e59=0x1;var _0x2c0483=[];_0x2c0483[_0x0a21('0x82')](new Extension(_0x3a8e03,_0x1f5e59,'',_0x0a21('0x83')));_0x1f5e59+=0x1;_0x2c0483[_0x0a21('0x82')](new Extension(_0x3a8e03,_0x1f5e59,_0x0a21('0x84'),_0x0a21('0x85')));_0x1f5e59+=0x1;for(var _0x44202d in _0x3a8e03){if(_0x3a8e03[_0x0a21('0x4b')](_0x44202d)&&(_0x44202d===_0x0a21('0x86')||_0x44202d===_0x0a21('0x7f')||_0x44202d===_0x0a21('0x87')||_0x44202d==='faxdetect'||_0x44202d===_0x0a21('0x88')||_0x44202d==='maxrate'||_0x44202d===_0x0a21('0x89')||_0x44202d===_0x0a21('0x8a')||_0x44202d===_0x0a21('0x8b'))){_0x2c0483[_0x0a21('0x82')](new Extension(_0x3a8e03,_0x1f5e59,'FAXOPT('+_0x44202d+')='+_0x3a8e03[_0x44202d],'Set'));_0x1f5e59+=0x1;}}_0x2c0483[_0x0a21('0x82')](new Extension(_0x3a8e03,_0x1f5e59,'6',_0x0a21('0x8c')));_0x1f5e59+=0x1;_0x2c0483[_0x0a21('0x82')](new Extension(_0x3a8e03,_0x1f5e59,_0x0a21('0x8d'),_0x0a21('0x8e')));_0x1f5e59=0x0;return _0x2c0483;}exports[_0x0a21('0x8f')]=function(_0x59910d,_0x5af5e8,_0x44411e){var _0x39f79f;return db['sequelize'][_0x0a21('0x75')](function(_0x2af5a7){return db['FaxAccount']['create'](_0x59910d[_0x0a21('0x5b')],{'transaction':_0x2af5a7})['then'](function(_0x350cbd){_0x39f79f=_0x350cbd['get']({'plain':!![]});return db[_0x0a21('0x90')]['bulkCreate'](createExtensionsReciveFax(_0x39f79f),{'transaction':_0x2af5a7});});})[_0x0a21('0x1c')](function(){return _0x39f79f;})['then'](respondWithResult(_0x5af5e8,null))[_0x0a21('0x24')](handleError(_0x5af5e8,null));};exports[_0x0a21('0x91')]=function(_0x411240,_0x41caef,_0x4968ce){var _0x505468;return db[_0x0a21('0x76')][_0x0a21('0x75')](function(_0x439be1){return db[_0x0a21('0x3e')][_0x0a21('0x31')](_0x411240[_0x0a21('0x5b')],{'where':{'id':_0x411240['body']['id']},'transaction':_0x439be1})[_0x0a21('0x1c')](function(_0x35ac0d){return db[_0x0a21('0x90')][_0x0a21('0x32')]({'where':{'FaxAccountId':_0x411240[_0x0a21('0x5b')]['id']},'transaction':_0x439be1})[_0x0a21('0x1c')](function(_0x400967){return db[_0x0a21('0x90')]['bulkCreate'](createExtensionsReciveFax(_[_0x0a21('0x6d')](_0x411240[_0x0a21('0x5b')],[_0x0a21('0x92'),_0x0a21('0x42'),_0x0a21('0x93'),_0x0a21('0x94'),_0x0a21('0x95'),_0x0a21('0x96')])),{'transaction':_0x439be1});});});})[_0x0a21('0x1c')](function(){return db[_0x0a21('0x3e')][_0x0a21('0x97')](_0x411240['body']['id']);})[_0x0a21('0x1c')](respondWithResult(_0x41caef,null))[_0x0a21('0x24')](handleError(_0x41caef,null));};exports[_0x0a21('0x98')]=function(_0x37e50a,_0x5ddb28,_0x54cfda){var _0x32aac4={'raw':!![],'where':{}};var _0x1f538c={};var _0x3a150e={'count':0x0,'rows':[]};return db['FaxAccount'][_0x0a21('0x66')]({'where':{'id':_0x37e50a[_0x0a21('0x59')]['id']}})[_0x0a21('0x1c')](handleEntityNotFound(_0x5ddb28,null))[_0x0a21('0x1c')](function(_0x37d3b0){if(_0x37d3b0){_0x1f538c[_0x0a21('0x43')]=_['keys'](db[_0x0a21('0x99')][_0x0a21('0x3f')]);_0x1f538c[_0x0a21('0x44')]=_['keys'](_0x37e50a[_0x0a21('0x44')]);_0x1f538c[_0x0a21('0x46')]=_[_0x0a21('0x47')](_0x1f538c[_0x0a21('0x43')],_0x1f538c['query']);_0x32aac4['attributes']=_[_0x0a21('0x47')](_0x1f538c[_0x0a21('0x43')],qs[_0x0a21('0x49')](_0x37e50a[_0x0a21('0x44')][_0x0a21('0x49')]));_0x32aac4['attributes']=_0x32aac4[_0x0a21('0x48')][_0x0a21('0x4a')]?_0x32aac4[_0x0a21('0x48')]:_0x1f538c[_0x0a21('0x43')];if(!_0x37e50a[_0x0a21('0x44')]['hasOwnProperty'](_0x0a21('0x4c'))){_0x32aac4['limit']=qs[_0x0a21('0x2a')](_0x37e50a['query'][_0x0a21('0x2a')]);_0x32aac4['offset']=qs[_0x0a21('0x28')](_0x37e50a[_0x0a21('0x44')][_0x0a21('0x28')]);}_0x32aac4[_0x0a21('0x4d')]=qs['sort'](_0x37e50a[_0x0a21('0x44')][_0x0a21('0x4e')]);_0x32aac4[_0x0a21('0x4f')]=qs[_0x0a21('0x46')](_[_0x0a21('0x50')](_0x37e50a[_0x0a21('0x44')],_0x1f538c[_0x0a21('0x46')]));_0x32aac4[_0x0a21('0x4f')][_0x0a21('0x63')]=_0x37d3b0['id'];if(_0x37e50a[_0x0a21('0x44')]['filter']){_0x32aac4[_0x0a21('0x4f')]=_[_0x0a21('0x52')](_0x32aac4[_0x0a21('0x4f')],{'$or':_['map'](_0x32aac4['attributes'],function(_0x5e63fb){var _0xaecd7={};_0xaecd7[_0x5e63fb]={'$like':'%'+_0x37e50a[_0x0a21('0x44')][_0x0a21('0x51')]+'%'};return _0xaecd7;})});}if(_0x37e50a[_0x0a21('0x44')][_0x0a21('0x9a')]){var _0xf7c5f4=_0x37e50a[_0x0a21('0x44')][_0x0a21('0x9a')][_0x0a21('0x9b')](',');var _0xafc37={};_0xafc37[_0xf7c5f4[0x0]]={'$gte':moment(_0xf7c5f4[0x1])[_0x0a21('0x9c')](_0x0a21('0x9d'))};_0x32aac4[_0x0a21('0x4f')]=_['merge'](_0x32aac4[_0x0a21('0x4f')],_0xafc37);}_0x32aac4=_[_0x0a21('0x52')]({},_0x32aac4,_0x37e50a[_0x0a21('0x53')]);return db[_0x0a21('0x99')][_0x0a21('0x2b')]({'where':_0x32aac4[_0x0a21('0x4f')]})[_0x0a21('0x1c')](function(_0x5e0d35){_0x3a150e[_0x0a21('0x2b')]=_0x5e0d35;if(_0x37e50a[_0x0a21('0x44')][_0x0a21('0x54')]){_0x32aac4[_0x0a21('0x55')]=[{'all':!![]}];}return db['FaxMessage'][_0x0a21('0x56')](_0x32aac4);})[_0x0a21('0x1c')](function(_0x227cd2){_0x3a150e[_0x0a21('0x57')]=_0x227cd2;return _0x3a150e;});}})[_0x0a21('0x1c')](respondWithFilteredResult(_0x5ddb28,_0x32aac4))[_0x0a21('0x24')](handleError(_0x5ddb28,null));};exports['send']=function(_0x2ab44b,_0x150ceb,_0x5ca2aa){var _0x35c429,_0x699c14={},_0x1abfbf;if(_0x2ab44b[_0x0a21('0x5b')]['to']){_0x1abfbf=_0x2ab44b[_0x0a21('0x5b')]['to'][0x0];}return db[_0x0a21('0x3e')]['find']({'where':{'id':_0x2ab44b['params']['id']},'include':[{'model':db[_0x0a21('0x9e')],'as':_0x0a21('0x9f'),'include':[{'model':db[_0x0a21('0xa0')],'as':_0x0a21('0xa1'),'where':{'fax':_0x1abfbf},'limit':0x1,'order':[['updatedAt',_0x0a21('0xa2')]]}]}]})[_0x0a21('0x1c')](handleEntityNotFound(_0x150ceb,null))[_0x0a21('0x1c')](function(_0xbaab67){_0x35c429=_0xbaab67;if(_0x2ab44b['body'][_0x0a21('0xa3')]&&_0x2ab44b[_0x0a21('0x5b')][_0x0a21('0xa3')][_0x0a21('0x4a')]){for(var _0x25f2d2=0x0;_0x25f2d2<_0x2ab44b[_0x0a21('0x5b')][_0x0a21('0xa3')][_0x0a21('0x4a')];_0x25f2d2+=0x1){_0x2ab44b[_0x0a21('0x5b')][_0x0a21('0xa3')][_0x25f2d2]={'filename':_0x2ab44b['body'][_0x0a21('0xa3')][_0x25f2d2][_0x0a21('0x38')],'id':_0x2ab44b['body'][_0x0a21('0xa3')][_0x25f2d2]['id'],'path':path['join'](config[_0x0a21('0xa4')],_0x0a21('0xa5'),_0x2ab44b[_0x0a21('0x5b')][_0x0a21('0xa3')][_0x25f2d2]['basename'])};}}return respondWithRpcPromise(_0x0a21('0xa6'),'CheckAfterSend',{'FaxAccountId':_[_0x0a21('0xa7')](_0x2ab44b[_0x0a21('0x59')]['id'])?undefined:_0x2ab44b[_0x0a21('0x59')]['id'],'path':_[_0x0a21('0xa7')](_0x2ab44b['body'][_0x0a21('0xa3')][0x0][_0x0a21('0x7')])?undefined:_0x2ab44b[_0x0a21('0x5b')][_0x0a21('0xa3')][0x0]['path'],'fax':_[_0x0a21('0xa7')](_0x2ab44b[_0x0a21('0x5b')]['to'][0x0])?undefined:_0x2ab44b[_0x0a21('0x5b')]['to'][0x0]},client9002);})[_0x0a21('0x1c')](function(){if(_0x35c429){if(_[_0x0a21('0xa7')](_0x2ab44b['body'][_0x0a21('0xa8')])){_0x2ab44b[_0x0a21('0x5b')][_0x0a21('0xa8')]=util[_0x0a21('0x9c')](_0x0a21('0xa9'),_0x35c429[_0x0a21('0x38')],_0x35c429[_0x0a21('0xaa')]);}if(_0x35c429[_0x0a21('0x9f')]){if(_0x35c429[_0x0a21('0x9f')][_0x0a21('0xa1')]['length']){return _0x35c429[_0x0a21('0x9f')][_0x0a21('0xa1')][0x0];}else{return db['CmContact'][_0x0a21('0x5a')](_[_0x0a21('0x18')](_0x2ab44b[_0x0a21('0x5b')],{'firstName':_0x2ab44b[_0x0a21('0x5b')]['to'][0x0],'phone':_0x2ab44b[_0x0a21('0x5b')]['to'][0x0],'fax':_0x2ab44b[_0x0a21('0x5b')]['to'][0x0],'ListId':_0x35c429[_0x0a21('0x96')]}));}}else{throw new Error(_0x0a21('0xab'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x0a21('0x1c')](function(_0x4a212b){if(_0x4a212b){return db['FaxInteraction'][_0x0a21('0x5e')]({'where':{'ContactId':_0x4a212b['id'],'closed':![],'FaxAccountId':_0x35c429['id']}})[_0x0a21('0x1c')](function(_0x4733ae){if(_0x4733ae){return[_0x4733ae,![]];}return db[_0x0a21('0x6c')]['create']({'UserId':_0x2ab44b[_0x0a21('0xac')]['id'],'ContactId':_0x4a212b['id'],'FaxAccountId':_0x35c429['id'],'fax':_0x2ab44b['body']['to'][0x0],'firstMsgDirection':_0x0a21('0xad'),'Messages':[_[_0x0a21('0x52')](_0x2ab44b[_0x0a21('0x5b')],{'read':![],'body':_0x2ab44b[_0x0a21('0x5b')][_0x0a21('0xa3')][0x0][_0x0a21('0xae')],'FaxAccountId':_0x35c429['id'],'UserId':_0x2ab44b[_0x0a21('0xac')]['id'],'ContactId':_0x4a212b['id'],'AttachmentId':_0x2ab44b['body']['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x0a21('0x99')],'as':'Messages'}]})[_0x0a21('0x1c')](function(_0x2c1afc){return[_0x2c1afc,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x0a21('0xaf')](function(_0x536aa7,_0x34ead1){if(_0x34ead1){return _0x536aa7;}return db[_0x0a21('0x99')][_0x0a21('0x5a')]({'direction':_0x0a21('0xad'),'read':![],'body':_0x2ab44b[_0x0a21('0x5b')][_0x0a21('0xa3')][0x0][_0x0a21('0xae')],'FaxAccountId':_0x35c429['id'],'FaxInteractionId':_0x536aa7['id'],'UserId':_0x2ab44b['user']['id'],'ContactId':_0x536aa7[_0x0a21('0xb0')],'AttachmentId':_0x2ab44b[_0x0a21('0x5b')][_0x0a21('0xa3')][0x0]['id']})['then'](function(_0x4ccf97){_0x536aa7['dataValues']['Messages']=[];_0x536aa7[_0x0a21('0xb1')][_0x0a21('0xb2')]['push'](_0x4ccf97[_0x0a21('0xb1')]);return _0x536aa7;});})[_0x0a21('0x1c')](function(_0x471e53){respondWithRpcPromise(_0x0a21('0xb3'),_0x0a21('0xb3'),{'FaxAccountId':_['isNil'](_0x2ab44b['params']['id'])?undefined:_0x2ab44b[_0x0a21('0x59')]['id'],'path':_[_0x0a21('0xa7')](_0x2ab44b[_0x0a21('0x5b')]['attachments'][0x0][_0x0a21('0x7')])?undefined:_0x2ab44b[_0x0a21('0x5b')][_0x0a21('0xa3')][0x0]['path'],'fax':_['isNil'](_0x2ab44b[_0x0a21('0x5b')]['to'][0x0])?undefined:_0x2ab44b[_0x0a21('0x5b')]['to'][0x0],'AttachmentId':_0x2ab44b[_0x0a21('0x5b')]['attachments'][0x0]['id']},client9002)[_0x0a21('0x1c')](function(_0x330208){logger[_0x0a21('0x1d')](_0x0a21('0xb4'),_0x330208);})[_0x0a21('0x24')](function(_0xf2e9ab){logger[_0x0a21('0x1d')](_0x0a21('0xb4'),_0xf2e9ab);});return _0x471e53;})[_0x0a21('0x1c')](respondWithResult(_0x150ceb,null))[_0x0a21('0x24')](handleError(_0x150ceb,null));};exports[_0x0a21('0xb5')]=function(_0x2ac78f,_0xe27b6b,_0x2513d3){return db[_0x0a21('0x3e')][_0x0a21('0x5e')]({'where':{'id':_0x2ac78f[_0x0a21('0x59')]['id']}})[_0x0a21('0x1c')](handleEntityNotFound(_0xe27b6b,null))['then'](function(_0x11a661){if(_0x11a661){return _0x11a661['addAgents'](_0x2ac78f['body'][_0x0a21('0x68')],_[_0x0a21('0x6d')](_0x2ac78f['body'],[_0x0a21('0x68'),'id'])||{})['spread'](function(_0x433023){for(var _0x31fdb9=0x0;_0x31fdb9<_0x2ac78f[_0x0a21('0x5b')]['ids']['length'];_0x31fdb9+=0x1){socket[_0x0a21('0xb6')](_0x0a21('0xb7'),{'UserId':Number(_0x2ac78f[_0x0a21('0x5b')][_0x0a21('0x68')][_0x31fdb9]),'FaxAccountId':Number(_0x2ac78f[_0x0a21('0x59')]['id'])});}return _0x433023;});}})[_0x0a21('0x1c')](respondWithResult(_0xe27b6b,null))[_0x0a21('0x24')](handleError(_0xe27b6b,null));};exports[_0x0a21('0xb8')]=function(_0xb0c741,_0x1944b9,_0x51450a){return db['FaxAccount']['find']({'where':{'id':_0xb0c741[_0x0a21('0x59')]['id']}})[_0x0a21('0x1c')](handleEntityNotFound(_0x1944b9,null))[_0x0a21('0x1c')](function(_0x1cedaf){if(_0x1cedaf){return _0x1cedaf[_0x0a21('0xb8')](_0xb0c741[_0x0a21('0x44')][_0x0a21('0x68')])[_0x0a21('0x1c')](function(){if(_[_0x0a21('0xb9')](_0xb0c741['query'][_0x0a21('0x68')])){for(var _0x1ca3fe=0x0;_0x1ca3fe<_0xb0c741['query'][_0x0a21('0x68')][_0x0a21('0x4a')];_0x1ca3fe+=0x1){socket[_0x0a21('0xb6')](_0x0a21('0xba'),{'UserId':Number(_0xb0c741[_0x0a21('0x44')]['ids'][_0x1ca3fe]),'FaxAccountId':Number(_0xb0c741[_0x0a21('0x59')]['id'])});}}else{socket[_0x0a21('0xb6')](_0x0a21('0xba'),{'UserId':Number(_0xb0c741['query'][_0x0a21('0x68')]),'FaxAccountId':Number(_0xb0c741[_0x0a21('0x59')]['id'])});}});}})[_0x0a21('0x1c')](respondWithStatusCode(_0x1944b9,null))['catch'](handleError(_0x1944b9,null));};exports[_0x0a21('0xbb')]=function(_0x27e279,_0xb8e8f9,_0x3fdd3d){var _0x54fa15={};var _0x2d248d={};var _0x4a3d23;var _0x3cf3fa;return db[_0x0a21('0x3e')][_0x0a21('0x66')]({'where':{'id':_0x27e279[_0x0a21('0x59')]['id']}})[_0x0a21('0x1c')](handleEntityNotFound(_0xb8e8f9,null))[_0x0a21('0x1c')](function(_0xd87697){if(_0xd87697){_0x4a3d23=_0xd87697;_0x2d248d[_0x0a21('0x43')]=_[_0x0a21('0x45')](db[_0x0a21('0x6e')][_0x0a21('0x3f')]);_0x2d248d[_0x0a21('0x44')]=_[_0x0a21('0x45')](_0x27e279[_0x0a21('0x44')]);_0x2d248d[_0x0a21('0x46')]=_[_0x0a21('0x47')](_0x2d248d[_0x0a21('0x43')],_0x2d248d['query']);_0x54fa15['attributes']=_[_0x0a21('0x47')](_0x2d248d[_0x0a21('0x43')],qs[_0x0a21('0x49')](_0x27e279[_0x0a21('0x44')][_0x0a21('0x49')]));_0x54fa15[_0x0a21('0x48')]=_0x54fa15[_0x0a21('0x48')][_0x0a21('0x4a')]?_0x54fa15[_0x0a21('0x48')]:_0x2d248d[_0x0a21('0x43')];_0x54fa15[_0x0a21('0x4d')]=qs['sort'](_0x27e279[_0x0a21('0x44')][_0x0a21('0x4e')]);_0x54fa15[_0x0a21('0x4f')]=qs['filters'](_[_0x0a21('0x50')](_0x27e279[_0x0a21('0x44')],_0x2d248d[_0x0a21('0x46')]));if(_0x27e279[_0x0a21('0x44')]['filter']){_0x54fa15[_0x0a21('0x4f')]=_[_0x0a21('0x52')](_0x54fa15[_0x0a21('0x4f')],{'$or':_['map'](_0x54fa15[_0x0a21('0x48')],function(_0x95751d){var _0x4de96c={};_0x4de96c[_0x95751d]={'$like':'%'+_0x27e279[_0x0a21('0x44')][_0x0a21('0x51')]+'%'};return _0x4de96c;})});}_0x54fa15=_['merge']({},_0x54fa15,_0x27e279['options']);return _0x4a3d23[_0x0a21('0xbb')](_0x54fa15);}})[_0x0a21('0x1c')](function(_0x418ccc){if(_0x418ccc){_0x3cf3fa=_0x418ccc[_0x0a21('0x4a')];if(!_0x27e279['query'][_0x0a21('0x4b')](_0x0a21('0x4c'))){_0x54fa15['limit']=qs[_0x0a21('0x2a')](_0x27e279[_0x0a21('0x44')]['limit']);_0x54fa15[_0x0a21('0x28')]=qs[_0x0a21('0x28')](_0x27e279[_0x0a21('0x44')]['offset']);}return _0x4a3d23[_0x0a21('0xbb')](_0x54fa15);}})[_0x0a21('0x1c')](function(_0x3e4ea6){if(_0x3e4ea6){return _0x3e4ea6?{'count':_0x3cf3fa,'rows':_0x3e4ea6}:null;}})[_0x0a21('0x1c')](respondWithResult(_0xb8e8f9,null))['catch'](handleError(_0xb8e8f9,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 9a720cd..cb52024 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 _0xae0d=['FaxAccount','setMaxListeners','update','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x3a04ba,_0x6e34c5){var _0x59a14f=function(_0xedd5a){while(--_0xedd5a){_0x3a04ba['push'](_0x3a04ba['shift']());}};_0x59a14f(++_0x6e34c5);}(_0xae0d,0x14e));var _0xdae0=function(_0x3f82b3,_0xca8804){_0x3f82b3=_0x3f82b3-0x0;var _0x220be2=_0xae0d[_0x3f82b3];return _0x220be2;};'use strict';var EventEmitter=require(_0xdae0('0x0'));var FaxAccount=require(_0xdae0('0x1'))['db'][_0xdae0('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xdae0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdae0('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1e141d){return function(_0x1e0f03,_0x366f6c,_0x48dd1a){FaxAccountEvents[_0xdae0('0x5')](_0x1e141d+':'+_0x1e0f03['id'],_0x1e0f03);FaxAccountEvents[_0xdae0('0x5')](_0x1e141d,_0x1e0f03);_0x48dd1a(null);};}for(var e in events){if(events[_0xdae0('0x6')](e)){var event=events[e];FaxAccount[_0xdae0('0x7')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0x483e=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','FaxAccount','setMaxListeners','save','update'];(function(_0x3ba813,_0x4acfd9){var _0x499b77=function(_0x1aaef8){while(--_0x1aaef8){_0x3ba813['push'](_0x3ba813['shift']());}};_0x499b77(++_0x4acfd9);}(_0x483e,0x9b));var _0xe483=function(_0x513545,_0x158f2e){_0x513545=_0x513545-0x0;var _0x18b7c5=_0x483e[_0x513545];return _0x18b7c5;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0xe483('0x0'))['db'][_0xe483('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xe483('0x2')](0x0);var events={'afterCreate':_0xe483('0x3'),'afterUpdate':_0xe483('0x4'),'afterDestroy':_0xe483('0x5')};function emitEvent(_0x2dec08){return function(_0x37ac5f,_0x4f42dd,_0x2a8f0a){FaxAccountEvents[_0xe483('0x6')](_0x2dec08+':'+_0x37ac5f['id'],_0x37ac5f);FaxAccountEvents['emit'](_0x2dec08,_0x37ac5f);_0x2a8f0a(null);};}for(var e in events){if(events[_0xe483('0x7')](e)){var event=events[e];FaxAccount[_0xe483('0x8')](e,emitEvent(event));}}module[_0xe483('0x9')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index ddadebd..7a4b677 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 _0xaa84=['bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x30c2ae,_0x4c98a2){var _0x1ee1cc=function(_0x165922){while(--_0x165922){_0x30c2ae['push'](_0x30c2ae['shift']());}};_0x1ee1cc(++_0x4c98a2);}(_0xaa84,0x181));var _0x4aa8=function(_0x5e0b09,_0x14268d){_0x5e0b09=_0x5e0b09-0x0;var _0x4191c1=_0xaa84[_0x5e0b09];return _0x4191c1;};'use strict';var _=require(_0x4aa8('0x0'));var util=require(_0x4aa8('0x1'));var logger=require(_0x4aa8('0x2'))(_0x4aa8('0x3'));var moment=require(_0x4aa8('0x4'));var BPromise=require(_0x4aa8('0x5'));var rp=require(_0x4aa8('0x6'));var fs=require('fs');var path=require(_0x4aa8('0x7'));var rimraf=require(_0x4aa8('0x8'));var config=require(_0x4aa8('0x9'));var attributes=require(_0x4aa8('0xa'));module[_0x4aa8('0xb')]=function(_0x272571,_0x4ed69a){return _0x272571[_0x4aa8('0xc')](_0x4aa8('0xd'),attributes,{'tableName':_0x4aa8('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd68b=['define','lodash','util','bluebird','request-promise','rimraf','../../config/environment','./faxAccount.attributes','exports'];(function(_0x154a7f,_0x3367bd){var _0x32d506=function(_0x5e23f6){while(--_0x5e23f6){_0x154a7f['push'](_0x154a7f['shift']());}};_0x32d506(++_0x3367bd);}(_0xd68b,0x76));var _0xbd68=function(_0x516ffb,_0x5b5b42){_0x516ffb=_0x516ffb-0x0;var _0x319667=_0xd68b[_0x516ffb];return _0x319667;};'use strict';var _=require(_0xbd68('0x0'));var util=require(_0xbd68('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xbd68('0x2'));var rp=require(_0xbd68('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbd68('0x4'));var config=require(_0xbd68('0x5'));var attributes=require(_0xbd68('0x6'));module[_0xbd68('0x7')]=function(_0x56da39,_0x1481dc){return _0x56da39[_0xbd68('0x8')]('FaxAccount',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 183e3de..0ed10d3 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 _0xc0ff=['length','defaults','create','contact','fax','FaxInteraction','Contact\x20not\x20found','spread','get','autoclose','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','agent','waitForTheAssignedAgent','queueId','FaxQueue','queue','Start','startRouting','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','./faxAccount.socket','register','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','stringify','NotifyFaxAccount','body','CmContact','describe','Sequelize','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','from','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','find','account','CmList','List','Contacts','DESC','FaxApplication','applications','list','priority','asc','Applications'];(function(_0x54597a,_0x4ea42f){var _0x5a764f=function(_0x5c000b){while(--_0x5c000b){_0x54597a['push'](_0x54597a['shift']());}};_0x5a764f(++_0x4ea42f);}(_0xc0ff,0xd8));var _0xfc0f=function(_0x283b55,_0x279bee){_0x283b55=_0x283b55-0x0;var _0x192e58=_0xc0ff[_0x283b55];return _0x192e58;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xfc0f('0x0'));var rs=require(_0xfc0f('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfc0f('0x2'))['db'];var utils=require(_0xfc0f('0x3'));var logger=require(_0xfc0f('0x4'))('rpc');var config=require(_0xfc0f('0x5'));var jayson=require(_0xfc0f('0x6'));var client=jayson[_0xfc0f('0x7')][_0xfc0f('0x8')]({'port':0x232c});config[_0xfc0f('0x9')]=_['defaults'](config[_0xfc0f('0x9')],{'host':_0xfc0f('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xfc0f('0xb'))[_0xfc0f('0xc')](socket);function respondWithRpcPromise(_0x33e7d8,_0x57a228,_0x28b35f){return new BPromise(function(_0x1ab63c,_0x2e44ec){return client[_0xfc0f('0xd')](_0x33e7d8,_0x28b35f)['then'](function(_0x78a03e){logger[_0xfc0f('0xe')](_0xfc0f('0xf'),_0x57a228,_0xfc0f('0x10'));logger['debug'](_0xfc0f('0x11'),_0x57a228,_0xfc0f('0x10'),JSON['stringify'](_0x78a03e));if(_0x78a03e[_0xfc0f('0x12')]){if(_0x78a03e[_0xfc0f('0x12')][_0xfc0f('0x13')]===0x1f4){logger[_0xfc0f('0x12')](_0xfc0f('0xf'),_0x57a228,_0x78a03e['error']['message']);return _0x2e44ec(_0x78a03e[_0xfc0f('0x12')][_0xfc0f('0x14')]);}logger[_0xfc0f('0x12')](_0xfc0f('0xf'),_0x57a228,_0x78a03e[_0xfc0f('0x12')][_0xfc0f('0x14')]);return _0x1ab63c(_0x78a03e[_0xfc0f('0x12')][_0xfc0f('0x14')]);}else{logger[_0xfc0f('0xe')](_0xfc0f('0xf'),_0x57a228,_0xfc0f('0x10'));_0x1ab63c(_0x78a03e['result'][_0xfc0f('0x14')]);}})[_0xfc0f('0x15')](function(_0x31a70f){logger[_0xfc0f('0x12')](_0xfc0f('0xf'),_0x57a228,_0x31a70f);_0x2e44ec(_0x31a70f);});});}exports[_0xfc0f('0x16')]=function(_0x4c1acf){var _0x45adfc=this;return new Promise(function(_0x16fdd7,_0x1a6bcb){return db[_0xfc0f('0x17')][_0xfc0f('0x18')]({'raw':_0x4c1acf[_0xfc0f('0x19')]?_0x4c1acf['options'][_0xfc0f('0x1a')]===undefined?!![]:![]:!![],'where':_0x4c1acf[_0xfc0f('0x19')]?_0x4c1acf[_0xfc0f('0x19')][_0xfc0f('0x1b')]||null:null,'attributes':_0x4c1acf[_0xfc0f('0x19')]?_0x4c1acf[_0xfc0f('0x19')][_0xfc0f('0x1c')]||null:null,'limit':_0x4c1acf[_0xfc0f('0x19')]?_0x4c1acf['options'][_0xfc0f('0x1d')]||null:null,'include':_0x4c1acf[_0xfc0f('0x19')]?_0x4c1acf[_0xfc0f('0x19')][_0xfc0f('0x1e')]?_[_0xfc0f('0x1f')](_0x4c1acf['options'][_0xfc0f('0x1e')],function(_0x40b072){return{'model':db[_0x40b072[_0xfc0f('0x20')]],'as':_0x40b072['as'],'attributes':_0x40b072['attributes'],'include':_0x40b072['include']?_[_0xfc0f('0x1f')](_0x40b072[_0xfc0f('0x1e')],function(_0x2789be){return{'model':db[_0x2789be[_0xfc0f('0x20')]],'as':_0x2789be['as'],'attributes':_0x2789be['attributes'],'include':_0x2789be[_0xfc0f('0x1e')]?_[_0xfc0f('0x1f')](_0x2789be[_0xfc0f('0x1e')],function(_0x5afce2){return{'model':db[_0x5afce2[_0xfc0f('0x20')]],'as':_0x5afce2['as'],'attributes':_0x5afce2[_0xfc0f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xfc0f('0x21')](function(_0x36b672){logger[_0xfc0f('0xe')](_0xfc0f('0x16'),_0x4c1acf);logger['debug'](_0xfc0f('0x16'),_0x4c1acf,JSON[_0xfc0f('0x22')](_0x36b672));_0x16fdd7(_0x36b672);})[_0xfc0f('0x15')](function(_0x1debf5){logger['error'](_0xfc0f('0x16'),_0x1debf5[_0xfc0f('0x14')],_0x4c1acf);_0x1a6bcb(_0x45adfc[_0xfc0f('0x12')](0x1f4,_0x1debf5[_0xfc0f('0x14')]));});});};exports[_0xfc0f('0x23')]=function(_0x32a5a5,_0x1bba34,_0x2af449){var _0x2525e0=this;return new Promise(function(_0x582417,_0xca312d){var _0x2f18c4={'body':_0x32a5a5[_0xfc0f('0x24')],'channel':'fax'};var _0x529b17=[];var _0x897f48=[];var _0x2aaa89={};return db[_0xfc0f('0x25')][_0xfc0f('0x26')]()[_0xfc0f('0x21')](function(_0x1255fa){if(!_0x1255fa){throw new db[(_0xfc0f('0x27'))]['ValidationError'](_0xfc0f('0x28'));}_0x529b17=_[_0xfc0f('0x29')](_[_0xfc0f('0x2a')](_0x1255fa),[_0xfc0f('0x2b'),_0xfc0f('0x2c')]);_0x897f48=_[_0xfc0f('0x29')](_['keys'](_0x1255fa),[_0xfc0f('0x2b'),_0xfc0f('0x2c'),_0xfc0f('0x2d'),_0xfc0f('0x2e')]);if(_0x32a5a5[_0xfc0f('0x24')]['id']){delete _0x32a5a5[_0xfc0f('0x24')]['id'];}if(_['isNil'](_0x32a5a5[_0xfc0f('0x24')][_0xfc0f('0x2f')])){throw new db[(_0xfc0f('0x27'))][(_0xfc0f('0x30'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x32a5a5['body'][_0xfc0f('0x24')])||_0x32a5a5[_0xfc0f('0x24')][_0xfc0f('0x24')]===''){throw new db[(_0xfc0f('0x27'))][(_0xfc0f('0x30'))](_0xfc0f('0x31'));}if(_[_0xfc0f('0x32')](_0x32a5a5[_0xfc0f('0x24')][_0xfc0f('0x33')])){throw new db[(_0xfc0f('0x27'))][(_0xfc0f('0x30'))](_0xfc0f('0x34')+_0x897f48);}if(!_[_0xfc0f('0x35')](_0x897f48,_0x32a5a5[_0xfc0f('0x24')][_0xfc0f('0x33')])){throw new db[(_0xfc0f('0x27'))][(_0xfc0f('0x30'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x897f48);}_0x2aaa89[_0x32a5a5['body'][_0xfc0f('0x33')]]=_0x32a5a5['body'][_0xfc0f('0x2f')];})[_0xfc0f('0x21')](function(){return db[_0xfc0f('0x17')][_0xfc0f('0x36')]({'where':{'id':_0x32a5a5[_0xfc0f('0x37')]['id']},'include':[{'model':db[_0xfc0f('0x38')],'as':_0xfc0f('0x39'),'include':[{'model':db[_0xfc0f('0x25')],'as':_0xfc0f('0x3a'),'where':_0x2aaa89,'limit':0x1,'order':[[_0xfc0f('0x2c'),_0xfc0f('0x3b')]]}]},{'model':db[_0xfc0f('0x3c')],'as':'Applications'}]});})[_0xfc0f('0x21')](function(_0x343c01){if(_0x343c01&&_0x343c01[_0xfc0f('0x39')]){var _0x355ee5=_0x343c01['get']({'plain':!![]});_0x2f18c4['account']=_0x355ee5;_0x2f18c4[_0xfc0f('0x3d')]=_0x355ee5['Applications'];_0x2f18c4[_0xfc0f('0x3e')]=_0x355ee5[_0xfc0f('0x39')];_0x2f18c4[_0xfc0f('0x3d')]=_['orderBy'](_0x2f18c4['applications'],[_0xfc0f('0x3f')],[_0xfc0f('0x40')]);if(_0x2f18c4[_0xfc0f('0x37')][_0xfc0f('0x41')]){delete _0x2f18c4['account'][_0xfc0f('0x41')];}if(_0x2f18c4[_0xfc0f('0x37')]['List']&&_0x2f18c4[_0xfc0f('0x37')][_0xfc0f('0x39')][_0xfc0f('0x3a')][_0xfc0f('0x42')]){return _0x2f18c4[_0xfc0f('0x37')][_0xfc0f('0x39')][_0xfc0f('0x3a')][0x0];}var _0x1e49bb=_[_0xfc0f('0x43')](_0x32a5a5['body'],{'firstName':_0x32a5a5[_0xfc0f('0x24')]['from'],'ListId':_0x355ee5[_0xfc0f('0x2e')]});_0x1e49bb[_0x32a5a5['body'][_0xfc0f('0x33')]]=_0x32a5a5[_0xfc0f('0x24')][_0xfc0f('0x2f')];return db[_0xfc0f('0x25')][_0xfc0f('0x44')](_0x1e49bb,{'fields':_0x529b17,'raw':!![]});}})[_0xfc0f('0x21')](function(_0x5f50f5){_0x2f18c4[_0xfc0f('0x45')]=_0x5f50f5;if(_0x5f50f5){var _0x57736c={'ContactId':_0x5f50f5['id'],'FaxAccountId':_0x32a5a5[_0xfc0f('0x37')]['id'],'fax':_0x5f50f5[_0xfc0f('0x46')]};return db[_0xfc0f('0x47')][_0xfc0f('0x36')]({'where':{'ContactId':_0x5f50f5['id'],'closed':![],'FaxAccountId':_0x32a5a5[_0xfc0f('0x37')]['id']}})[_0xfc0f('0x21')](function(_0xe0f41){if(_0xe0f41){return[_0xe0f41,![]];}return db[_0xfc0f('0x47')][_0xfc0f('0x44')](_0x57736c)[_0xfc0f('0x21')](function(_0x3833c5){return[_0x3833c5,!![]];});});}else{throw new Error(_0xfc0f('0x48'));}})[_0xfc0f('0x49')](function(_0x59dffc,_0x132f45){var _0x1283c0=_0x59dffc[_0xfc0f('0x4a')]({'plain':!![]});if(_0x132f45){if(_0x2f18c4[_0xfc0f('0x37')][_0xfc0f('0x4b')]){_0x2f18c4[_0xfc0f('0x3d')]['push']({'id':0x0,'priority':_0x2f18c4[_0xfc0f('0x3d')][_0xfc0f('0x42')]+0x1,'app':_0xfc0f('0x4c'),'appdata':_0xfc0f('0x4d'),'interval':_0xfc0f('0x4e')});}_0x1283c0['created']=!![];}else{_0x1283c0[_0xfc0f('0x4f')]=![];}_0x2f18c4[_0xfc0f('0x50')]=_0x1283c0;return db[_0xfc0f('0x51')]['create']({'body':_0x32a5a5[_0xfc0f('0x24')][_0xfc0f('0x24')],'FaxAccountId':_0x32a5a5[_0xfc0f('0x37')]['id'],'FaxInteractionId':_0x59dffc['id'],'direction':'in','ContactId':_0x59dffc[_0xfc0f('0x52')],'AttachmentId':_0x32a5a5['body'][_0xfc0f('0x53')]});})['then'](function(_0x4bf283){_0x2f18c4[_0xfc0f('0x14')]=_0x4bf283;if(!_0x2f18c4[_0xfc0f('0x50')][_0xfc0f('0x54')])return;return db[_0xfc0f('0x55')][_0xfc0f('0x36')]({'attributes':['id',_0xfc0f('0x56')],'where':{'id':_0x2f18c4[_0xfc0f('0x50')][_0xfc0f('0x54')]}});})['then'](function(_0x5c9f09){if(_0x5c9f09){_0x2f18c4['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xfc0f('0x57'),'appdata':_0x5c9f09[_0xfc0f('0x56')]+','+(_0x2f18c4[_0xfc0f('0x37')][_0xfc0f('0x58')]||0xa),'interval':_0xfc0f('0x4e')});}if(!_0x2f18c4[_0xfc0f('0x50')][_0xfc0f('0x59')])return;return db[_0xfc0f('0x5a')][_0xfc0f('0x36')]({'attributes':['id','name'],'where':{'id':_0x2f18c4[_0xfc0f('0x50')][_0xfc0f('0x59')]}});})[_0xfc0f('0x21')](function(_0x3a8d09){if(_0x3a8d09){_0x2f18c4['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0xfc0f('0x5b'),'appdata':_0x3a8d09['name']+','+(_0x2f18c4[_0xfc0f('0x37')]['waitForTheAssignedQueue']||0x12c),'interval':_0xfc0f('0x4e')});}return respondWithRpcPromise(_0xfc0f('0x5c'),_0xfc0f('0x5d'),_0x2f18c4);})[_0xfc0f('0x21')](function(_0x14f3ff){_0x582417(_0x14f3ff);})['catch'](function(_0x19266a){_0xca312d(_0x2525e0['error'](0x1f4,_0x19266a['message']));});});}; \ No newline at end of file +var _0xbb17=['*,*,*,*','created','interaction','FaxMessage','create','ContactId','User','name','UserId','unshift','agent','waitForTheAssignedAgent','queueId','FaxQueue','queue','waitForTheAssignedQueue','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFaxAccount','findAll','options','raw','where','attributes','include','map','model','body','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','keys','ListId','isNil','from\x20is\x20mandatory','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','find','account','CmList','List','Contacts','updatedAt','DESC','FaxApplication','Applications','get','applications','list','orderBy','priority','asc','length','contact','fax','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','close'];(function(_0x4a4610,_0x5cf30b){var _0x1d9868=function(_0x4c465d){while(--_0x4c465d){_0x4a4610['push'](_0x4a4610['shift']());}};_0x1d9868(++_0x5cf30b);}(_0xbb17,0xce));var _0x7bb1=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xbb17[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x7bb1('0x0'));var util=require(_0x7bb1('0x1'));var moment=require(_0x7bb1('0x2'));var BPromise=require(_0x7bb1('0x3'));var rs=require(_0x7bb1('0x4'));var fs=require('fs');var Redis=require(_0x7bb1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7bb1('0x6'));var logger=require(_0x7bb1('0x7'))('rpc');var config=require(_0x7bb1('0x8'));var jayson=require(_0x7bb1('0x9'));var client=jayson[_0x7bb1('0xa')][_0x7bb1('0xb')]({'port':0x232c});config[_0x7bb1('0xc')]=_[_0x7bb1('0xd')](config['redis'],{'host':_0x7bb1('0xe'),'port':0x18eb});var socket=require(_0x7bb1('0xf'))(new Redis(config[_0x7bb1('0xc')]));require('./faxAccount.socket')[_0x7bb1('0x10')](socket);function respondWithRpcPromise(_0x21bf5b,_0x305977,_0x187174){return new BPromise(function(_0x40fd71,_0x1bd82a){return client[_0x7bb1('0x11')](_0x21bf5b,_0x187174)[_0x7bb1('0x12')](function(_0x5012be){logger[_0x7bb1('0x13')](_0x7bb1('0x14'),_0x305977,_0x7bb1('0x15'));logger['debug'](_0x7bb1('0x16'),_0x305977,_0x7bb1('0x15'),JSON[_0x7bb1('0x17')](_0x5012be));if(_0x5012be[_0x7bb1('0x18')]){if(_0x5012be['error']['code']===0x1f4){logger[_0x7bb1('0x18')](_0x7bb1('0x14'),_0x305977,_0x5012be['error'][_0x7bb1('0x19')]);return _0x1bd82a(_0x5012be[_0x7bb1('0x18')][_0x7bb1('0x19')]);}logger[_0x7bb1('0x18')](_0x7bb1('0x14'),_0x305977,_0x5012be[_0x7bb1('0x18')][_0x7bb1('0x19')]);return _0x40fd71(_0x5012be[_0x7bb1('0x18')][_0x7bb1('0x19')]);}else{logger[_0x7bb1('0x13')](_0x7bb1('0x14'),_0x305977,_0x7bb1('0x15'));_0x40fd71(_0x5012be[_0x7bb1('0x1a')]['message']);}})[_0x7bb1('0x1b')](function(_0xbe4a04){logger['error'](_0x7bb1('0x14'),_0x305977,_0xbe4a04);_0x1bd82a(_0xbe4a04);});});}exports[_0x7bb1('0x1c')]=function(_0x201cf6){var _0x393b2a=this;return new Promise(function(_0x4afb18,_0x3ee4bd){return db['FaxAccount'][_0x7bb1('0x1d')]({'raw':_0x201cf6[_0x7bb1('0x1e')]?_0x201cf6[_0x7bb1('0x1e')][_0x7bb1('0x1f')]===undefined?!![]:![]:!![],'where':_0x201cf6[_0x7bb1('0x1e')]?_0x201cf6['options'][_0x7bb1('0x20')]||null:null,'attributes':_0x201cf6[_0x7bb1('0x1e')]?_0x201cf6[_0x7bb1('0x1e')][_0x7bb1('0x21')]||null:null,'limit':_0x201cf6[_0x7bb1('0x1e')]?_0x201cf6[_0x7bb1('0x1e')]['limit']||null:null,'include':_0x201cf6[_0x7bb1('0x1e')]?_0x201cf6[_0x7bb1('0x1e')][_0x7bb1('0x22')]?_[_0x7bb1('0x23')](_0x201cf6[_0x7bb1('0x1e')][_0x7bb1('0x22')],function(_0x1fae0d){return{'model':db[_0x1fae0d[_0x7bb1('0x24')]],'as':_0x1fae0d['as'],'attributes':_0x1fae0d[_0x7bb1('0x21')],'include':_0x1fae0d[_0x7bb1('0x22')]?_[_0x7bb1('0x23')](_0x1fae0d['include'],function(_0x30eb12){return{'model':db[_0x30eb12[_0x7bb1('0x24')]],'as':_0x30eb12['as'],'attributes':_0x30eb12[_0x7bb1('0x21')],'include':_0x30eb12[_0x7bb1('0x22')]?_['map'](_0x30eb12[_0x7bb1('0x22')],function(_0x3a0768){return{'model':db[_0x3a0768[_0x7bb1('0x24')]],'as':_0x3a0768['as'],'attributes':_0x3a0768[_0x7bb1('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3260de){logger['info'](_0x7bb1('0x1c'),_0x201cf6);logger['debug'](_0x7bb1('0x1c'),_0x201cf6,JSON['stringify'](_0x3260de));_0x4afb18(_0x3260de);})[_0x7bb1('0x1b')](function(_0x584fba){logger[_0x7bb1('0x18')](_0x7bb1('0x1c'),_0x584fba[_0x7bb1('0x19')],_0x201cf6);_0x3ee4bd(_0x393b2a[_0x7bb1('0x18')](0x1f4,_0x584fba['message']));});});};exports['NotifyFaxAccount']=function(_0x408e93,_0x1062ab,_0x4064c0){var _0x2ea296=this;return new Promise(function(_0x5aaf0f,_0x4c0df5){var _0x448937={'body':_0x408e93[_0x7bb1('0x25')],'channel':'fax'};var _0x2953f6=[];var _0x470923=[];var _0x25db75={};return db[_0x7bb1('0x26')]['describe']()['then'](function(_0xf5b89f){if(!_0xf5b89f){throw new db[(_0x7bb1('0x27'))]['ValidationError'](_0x7bb1('0x28'));}_0x2953f6=_[_0x7bb1('0x29')](_['keys'](_0xf5b89f),[_0x7bb1('0x2a'),'updatedAt']);_0x470923=_[_0x7bb1('0x29')](_[_0x7bb1('0x2b')](_0xf5b89f),['createdAt','updatedAt','CompanyId',_0x7bb1('0x2c')]);if(_0x408e93[_0x7bb1('0x25')]['id']){delete _0x408e93[_0x7bb1('0x25')]['id'];}if(_[_0x7bb1('0x2d')](_0x408e93[_0x7bb1('0x25')]['from'])){throw new db[(_0x7bb1('0x27'))]['ValidationError'](_0x7bb1('0x2e'));}if(_[_0x7bb1('0x2d')](_0x408e93[_0x7bb1('0x25')][_0x7bb1('0x25')])||_0x408e93['body'][_0x7bb1('0x25')]===''){throw new db[(_0x7bb1('0x27'))][(_0x7bb1('0x2f'))](_0x7bb1('0x30'));}if(_[_0x7bb1('0x2d')](_0x408e93[_0x7bb1('0x25')][_0x7bb1('0x31')])){throw new db[(_0x7bb1('0x27'))][(_0x7bb1('0x2f'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x470923);}if(!_['includes'](_0x470923,_0x408e93[_0x7bb1('0x25')][_0x7bb1('0x31')])){throw new db[(_0x7bb1('0x27'))]['ValidationError'](_0x7bb1('0x32')+_0x470923);}_0x25db75[_0x408e93['body'][_0x7bb1('0x31')]]=_0x408e93[_0x7bb1('0x25')][_0x7bb1('0x33')];})[_0x7bb1('0x12')](function(){return db['FaxAccount'][_0x7bb1('0x34')]({'where':{'id':_0x408e93[_0x7bb1('0x35')]['id']},'include':[{'model':db[_0x7bb1('0x36')],'as':_0x7bb1('0x37'),'include':[{'model':db[_0x7bb1('0x26')],'as':_0x7bb1('0x38'),'where':_0x25db75,'limit':0x1,'order':[[_0x7bb1('0x39'),_0x7bb1('0x3a')]]}]},{'model':db[_0x7bb1('0x3b')],'as':_0x7bb1('0x3c')}]});})[_0x7bb1('0x12')](function(_0x57af1a){if(_0x57af1a&&_0x57af1a[_0x7bb1('0x37')]){var _0x9ecc20=_0x57af1a[_0x7bb1('0x3d')]({'plain':!![]});_0x448937['account']=_0x9ecc20;_0x448937[_0x7bb1('0x3e')]=_0x9ecc20[_0x7bb1('0x3c')];_0x448937[_0x7bb1('0x3f')]=_0x9ecc20[_0x7bb1('0x37')];_0x448937[_0x7bb1('0x3e')]=_[_0x7bb1('0x40')](_0x448937['applications'],[_0x7bb1('0x41')],[_0x7bb1('0x42')]);if(_0x448937[_0x7bb1('0x35')][_0x7bb1('0x3c')]){delete _0x448937['account'][_0x7bb1('0x3c')];}if(_0x448937[_0x7bb1('0x35')][_0x7bb1('0x37')]&&_0x448937['account'][_0x7bb1('0x37')]['Contacts'][_0x7bb1('0x43')]){return _0x448937[_0x7bb1('0x35')][_0x7bb1('0x37')][_0x7bb1('0x38')][0x0];}var _0x4dca6f=_[_0x7bb1('0xd')](_0x408e93['body'],{'firstName':_0x408e93[_0x7bb1('0x25')][_0x7bb1('0x33')],'ListId':_0x9ecc20[_0x7bb1('0x2c')]});_0x4dca6f[_0x408e93[_0x7bb1('0x25')]['mapKey']]=_0x408e93[_0x7bb1('0x25')][_0x7bb1('0x33')];return db[_0x7bb1('0x26')]['create'](_0x4dca6f,{'fields':_0x2953f6,'raw':!![]});}})[_0x7bb1('0x12')](function(_0x3f6f88){_0x448937[_0x7bb1('0x44')]=_0x3f6f88;if(_0x3f6f88){var _0x20ed7b={'ContactId':_0x3f6f88['id'],'FaxAccountId':_0x408e93[_0x7bb1('0x35')]['id'],'fax':_0x3f6f88[_0x7bb1('0x45')]};return db['FaxInteraction'][_0x7bb1('0x34')]({'where':{'ContactId':_0x3f6f88['id'],'closed':![],'FaxAccountId':_0x408e93['account']['id']}})['then'](function(_0x1b4fbd){if(_0x1b4fbd){return[_0x1b4fbd,![]];}return db[_0x7bb1('0x46')]['create'](_0x20ed7b)['then'](function(_0x1aaadf){return[_0x1aaadf,!![]];});});}else{throw new Error(_0x7bb1('0x47'));}})[_0x7bb1('0x48')](function(_0x2c7e3b,_0x3f4fb1){var _0x444940=_0x2c7e3b[_0x7bb1('0x3d')]({'plain':!![]});if(_0x3f4fb1){if(_0x448937[_0x7bb1('0x35')][_0x7bb1('0x49')]){_0x448937['applications'][_0x7bb1('0x4a')]({'id':0x0,'priority':_0x448937['applications'][_0x7bb1('0x43')]+0x1,'app':_0x7bb1('0x4b'),'appdata':'unmanaged','interval':_0x7bb1('0x4c')});}_0x444940[_0x7bb1('0x4d')]=!![];}else{_0x444940[_0x7bb1('0x4d')]=![];}_0x448937[_0x7bb1('0x4e')]=_0x444940;return db[_0x7bb1('0x4f')][_0x7bb1('0x50')]({'body':_0x408e93['body'][_0x7bb1('0x25')],'FaxAccountId':_0x408e93['account']['id'],'FaxInteractionId':_0x2c7e3b['id'],'direction':'in','ContactId':_0x2c7e3b[_0x7bb1('0x51')],'AttachmentId':_0x408e93[_0x7bb1('0x25')]['AttachmentId']});})[_0x7bb1('0x12')](function(_0x7e8061){_0x448937[_0x7bb1('0x19')]=_0x7e8061;if(!_0x448937['interaction']['UserId'])return;return db[_0x7bb1('0x52')]['find']({'attributes':['id',_0x7bb1('0x53')],'where':{'id':_0x448937[_0x7bb1('0x4e')][_0x7bb1('0x54')]}});})[_0x7bb1('0x12')](function(_0x155e38){if(_0x155e38){_0x448937[_0x7bb1('0x3e')][_0x7bb1('0x55')]({'id':0x0,'priority':0x0,'app':_0x7bb1('0x56'),'appdata':_0x155e38[_0x7bb1('0x53')]+','+(_0x448937['account'][_0x7bb1('0x57')]||0xa),'interval':_0x7bb1('0x4c')});}if(!_0x448937[_0x7bb1('0x4e')][_0x7bb1('0x58')])return;return db[_0x7bb1('0x59')][_0x7bb1('0x34')]({'attributes':['id',_0x7bb1('0x53')],'where':{'id':_0x448937[_0x7bb1('0x4e')]['queueId']}});})[_0x7bb1('0x12')](function(_0x2f3c30){if(_0x2f3c30){_0x448937['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0x7bb1('0x5a'),'appdata':_0x2f3c30[_0x7bb1('0x53')]+','+(_0x448937[_0x7bb1('0x35')][_0x7bb1('0x5b')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x7bb1('0x5c'),_0x7bb1('0x5d'),_0x448937);})[_0x7bb1('0x12')](function(_0x447e20){_0x5aaf0f(_0x447e20);})[_0x7bb1('0x1b')](function(_0x3bca50){_0x4c0df5(_0x2ea296['error'](0x1f4,_0x3bca50[_0x7bb1('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index f72e442..094bea1 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 _0xa4b3=['removeListener','register','length','./faxAccount.events','save','remove','emit'];(function(_0x1d50f2,_0x3c3ec6){var _0x3769b8=function(_0x50926a){while(--_0x50926a){_0x1d50f2['push'](_0x1d50f2['shift']());}};_0x3769b8(++_0x3c3ec6);}(_0xa4b3,0x130));var _0x3a4b=function(_0x2f81f5,_0x34582d){_0x2f81f5=_0x2f81f5-0x0;var _0x2dd096=_0xa4b3[_0x2f81f5];return _0x2dd096;};'use strict';var FaxAccountEvents=require(_0x3a4b('0x0'));var events=[_0x3a4b('0x1'),_0x3a4b('0x2'),'update'];function createListener(_0x1c82e8,_0x509af1){return function(_0x416352){_0x509af1[_0x3a4b('0x3')](_0x1c82e8,_0x416352);};}function removeListener(_0x4d1036,_0x4013e9){return function(){FaxAccountEvents[_0x3a4b('0x4')](_0x4d1036,_0x4013e9);};}exports[_0x3a4b('0x5')]=function(_0x14ed57){for(var _0x423bed=0x0,_0x558d84=events[_0x3a4b('0x6')];_0x423bed<_0x558d84;_0x423bed++){var _0xda56b=events[_0x423bed];var _0x5c5228=createListener('faxAccount:'+_0xda56b,_0x14ed57);FaxAccountEvents['on'](_0xda56b,_0x5c5228);}}; \ No newline at end of file +var _0xe3ce=['removeListener','register','faxAccount:','emit'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xe3ce,0x1bf));var _0xee3c=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xe3ce[_0x3ff085];return _0x2b68c3;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=['save','remove','update'];function createListener(_0x58784f,_0x12a1c4){return function(_0x390dd2){_0x12a1c4[_0xee3c('0x0')](_0x58784f,_0x390dd2);};}function removeListener(_0x333ef3,_0x1f413d){return function(){FaxAccountEvents[_0xee3c('0x1')](_0x333ef3,_0x1f413d);};}exports[_0xee3c('0x2')]=function(_0x1197eb){for(var _0x252b4d=0x0,_0x4a7359=events['length'];_0x252b4d<_0x4a7359;_0x252b4d++){var _0x3a43fe=events[_0x252b4d];var _0x1ec5b4=createListener(_0xee3c('0x3')+_0x3a43fe,_0x1197eb);FaxAccountEvents['on'](_0x3a43fe,_0x1ec5b4);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 9ee7269..9f1c883 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 _0xb66f=['getAnswers','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','/:id/dispositions','addDisposition','addAnswer','addInteraction','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','addAgents','put','destroy','removeDispositions','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','/:id','isAuthenticated','show','getDispositions','/:id/canned_answers'];(function(_0x5a0551,_0x3a1005){var _0xb34ff5=function(_0x1189ba){while(--_0x1189ba){_0x5a0551['push'](_0x5a0551['shift']());}};_0xb34ff5(++_0x3a1005);}(_0xb66f,0x13d));var _0xfb66=function(_0x5cf685,_0x4a31fd){_0x5cf685=_0x5cf685-0x0;var _0x299a94=_0xb66f[_0x5cf685];return _0x299a94;};'use strict';var multer=require(_0xfb66('0x0'));var util=require(_0xfb66('0x1'));var path=require(_0xfb66('0x2'));var timeout=require(_0xfb66('0x3'));var express=require(_0xfb66('0x4'));var router=express[_0xfb66('0x5')]();var fs_extra=require(_0xfb66('0x6'));var auth=require(_0xfb66('0x7'));var interaction=require(_0xfb66('0x8'));var config=require(_0xfb66('0x9'));var controller=require(_0xfb66('0xa'));router[_0xfb66('0xb')]('/',auth['isAuthenticated'](),controller[_0xfb66('0xc')]);router[_0xfb66('0xb')](_0xfb66('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0xfb66('0xb')](_0xfb66('0xe'),auth[_0xfb66('0xf')](),controller[_0xfb66('0x10')]);router[_0xfb66('0xb')]('/:id/dispositions',auth[_0xfb66('0xf')](),controller[_0xfb66('0x11')]);router[_0xfb66('0xb')](_0xfb66('0x12'),auth[_0xfb66('0xf')](),controller[_0xfb66('0x13')]);router[_0xfb66('0xb')](_0xfb66('0x14'),auth[_0xfb66('0xf')](),controller[_0xfb66('0x15')]);router[_0xfb66('0xb')](_0xfb66('0x16'),auth[_0xfb66('0xf')](),controller['getApplications']);router[_0xfb66('0xb')](_0xfb66('0x17'),auth[_0xfb66('0xf')](),controller[_0xfb66('0x18')]);router['get'](_0xfb66('0x19'),auth[_0xfb66('0xf')](),controller[_0xfb66('0x1a')]);router[_0xfb66('0x1b')]('/',auth['isAuthenticated'](),controller['create']);router[_0xfb66('0x1b')](_0xfb66('0x1c'),auth[_0xfb66('0xf')](),controller[_0xfb66('0x1d')]);router[_0xfb66('0x1b')](_0xfb66('0x12'),auth[_0xfb66('0xf')](),controller[_0xfb66('0x1e')]);router['post'](_0xfb66('0x14'),auth[_0xfb66('0xf')](),controller[_0xfb66('0x1f')]);router[_0xfb66('0x1b')]('/:id/applications',auth[_0xfb66('0xf')](),controller['addApplications']);router[_0xfb66('0x1b')]('/addaccountapplications',auth['isAuthenticated'](),controller[_0xfb66('0x20')]);router[_0xfb66('0x1b')](_0xfb66('0x21'),auth[_0xfb66('0xf')](),controller[_0xfb66('0x22')]);router[_0xfb66('0x1b')](_0xfb66('0x23'),auth[_0xfb66('0xf')](),controller[_0xfb66('0x24')]);router[_0xfb66('0x1b')](_0xfb66('0x19'),auth[_0xfb66('0xf')](),controller[_0xfb66('0x25')]);router[_0xfb66('0x26')]('/:id',auth[_0xfb66('0xf')](),controller['update']);router['delete'](_0xfb66('0xe'),auth[_0xfb66('0xf')](),controller[_0xfb66('0x27')]);router['delete'](_0xfb66('0x1c'),auth[_0xfb66('0xf')](),controller[_0xfb66('0x28')]);router['delete'](_0xfb66('0x12'),auth[_0xfb66('0xf')](),controller['removeAnswers']);router['delete']('/:id/users',auth[_0xfb66('0xf')](),controller['removeAgents']);module[_0xfb66('0x29')]=router; \ No newline at end of file +var _0x9bf6=['destroy','delete','removeDispositions','removeAnswers','removeAgents','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','describe','get','/:id','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/interactions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','addAnswer','addInteraction','addApplications','addAccountApplications','updateAccountApplications','send','addAgents','put','update'];(function(_0x530586,_0x2c51ea){var _0x184607=function(_0x453a1b){while(--_0x453a1b){_0x530586['push'](_0x530586['shift']());}};_0x184607(++_0x2c51ea);}(_0x9bf6,0xc3));var _0x69bf=function(_0x5b6ee6,_0x50f57f){_0x5b6ee6=_0x5b6ee6-0x0;var _0x19151d=_0x9bf6[_0x5b6ee6];return _0x19151d;};'use strict';var multer=require(_0x69bf('0x0'));var util=require(_0x69bf('0x1'));var path=require('path');var timeout=require(_0x69bf('0x2'));var express=require(_0x69bf('0x3'));var router=express[_0x69bf('0x4')]();var fs_extra=require(_0x69bf('0x5'));var auth=require(_0x69bf('0x6'));var interaction=require(_0x69bf('0x7'));var config=require('../../config/environment');var controller=require('./faxAccount.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x69bf('0x8')]);router[_0x69bf('0x9')](_0x69bf('0xa'),auth[_0x69bf('0xb')](),controller[_0x69bf('0xc')]);router[_0x69bf('0x9')](_0x69bf('0xd'),auth[_0x69bf('0xb')](),controller[_0x69bf('0xe')]);router[_0x69bf('0x9')](_0x69bf('0xf'),auth[_0x69bf('0xb')](),controller['getAnswers']);router['get'](_0x69bf('0x10'),auth[_0x69bf('0xb')](),controller['getInteractions']);router[_0x69bf('0x9')](_0x69bf('0x11'),auth[_0x69bf('0xb')](),controller['getApplications']);router['get'](_0x69bf('0x12'),auth[_0x69bf('0xb')](),controller[_0x69bf('0x13')]);router[_0x69bf('0x9')](_0x69bf('0x14'),auth[_0x69bf('0xb')](),controller[_0x69bf('0x15')]);router['post']('/',auth[_0x69bf('0xb')](),controller['create']);router[_0x69bf('0x16')](_0x69bf('0xd'),auth[_0x69bf('0xb')](),controller[_0x69bf('0x17')]);router[_0x69bf('0x16')](_0x69bf('0xf'),auth[_0x69bf('0xb')](),controller[_0x69bf('0x18')]);router[_0x69bf('0x16')](_0x69bf('0x10'),auth[_0x69bf('0xb')](),controller[_0x69bf('0x19')]);router[_0x69bf('0x16')]('/:id/applications',auth['isAuthenticated'](),controller[_0x69bf('0x1a')]);router['post']('/addaccountapplications',auth[_0x69bf('0xb')](),controller[_0x69bf('0x1b')]);router[_0x69bf('0x16')]('/updateaccountapplications',auth[_0x69bf('0xb')](),controller[_0x69bf('0x1c')]);router['post']('/:id/send',auth[_0x69bf('0xb')](),controller[_0x69bf('0x1d')]);router[_0x69bf('0x16')](_0x69bf('0x14'),auth[_0x69bf('0xb')](),controller[_0x69bf('0x1e')]);router[_0x69bf('0x1f')](_0x69bf('0xa'),auth[_0x69bf('0xb')](),controller[_0x69bf('0x20')]);router['delete'](_0x69bf('0xa'),auth[_0x69bf('0xb')](),controller[_0x69bf('0x21')]);router[_0x69bf('0x22')]('/:id/dispositions',auth[_0x69bf('0xb')](),controller[_0x69bf('0x23')]);router[_0x69bf('0x22')]('/:id/canned_answers',auth[_0x69bf('0xb')](),controller[_0x69bf('0x24')]);router[_0x69bf('0x22')](_0x69bf('0x14'),auth[_0x69bf('0xb')](),controller[_0x69bf('0x25')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 8b56180..1fc2740 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 _0xa0e1=['TEXT','STRING','*,*,*,*','exports','INTEGER','noop'];(function(_0x66991a,_0x36fa7c){var _0x42c6ba=function(_0x42bc1c){while(--_0x42bc1c){_0x66991a['push'](_0x66991a['shift']());}};_0x42c6ba(++_0x36fa7c);}(_0xa0e1,0x14d));var _0x1a0e=function(_0x53581c,_0x91fd91){_0x53581c=_0x53581c-0x0;var _0x4338b5=_0xa0e1[_0x53581c];return _0x4338b5;};'use strict';var Sequelize=require('sequelize');module[_0x1a0e('0x0')]={'priority':{'type':Sequelize[_0x1a0e('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1a0e('0x2')},'appdata':{'type':Sequelize[_0x1a0e('0x3')]()},'description':{'type':Sequelize[_0x1a0e('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x1a0e('0x5')}}; \ No newline at end of file +var _0x7c15=['STRING','noop','*,*,*,*'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x7c15,0xe1));var _0x57c1=function(_0x16ad18,_0x9e8018){_0x16ad18=_0x16ad18-0x0;var _0x5f0d58=_0x7c15[_0x16ad18];return _0x5f0d58;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x57c1('0x0')],'allowNull':![],'defaultValue':_0x57c1('0x1')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x57c1('0x0')],'defaultValue':_0x57c1('0x2')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 75f13e1..f7f75c6 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 _0xca85=['fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','limit','undefined','count','set','apply','reject','save','destroy','then','stack','name','map','FaxApplication','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','update','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x5e2751,_0x518a55){var _0x139a39=function(_0x4802db){while(--_0x4802db){_0x5e2751['push'](_0x5e2751['shift']());}};_0x139a39(++_0x518a55);}(_0xca85,0xd3));var _0x5ca8=function(_0x135c17,_0x1188b2){_0x135c17=_0x135c17-0x0;var _0x2546b0=_0xca85[_0x135c17];return _0x2546b0;};'use strict';var emlformat=require(_0x5ca8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5ca8('0x1'));var jsonpatch=require(_0x5ca8('0x2'));var rp=require(_0x5ca8('0x3'));var moment=require('moment');var BPromise=require(_0x5ca8('0x4'));var Mustache=require(_0x5ca8('0x5'));var util=require(_0x5ca8('0x6'));var path=require(_0x5ca8('0x7'));var sox=require(_0x5ca8('0x8'));var csv=require(_0x5ca8('0x9'));var ejs=require(_0x5ca8('0xa'));var fs=require('fs');var fs_extra=require(_0x5ca8('0xb'));var _=require('lodash');var squel=require(_0x5ca8('0xc'));var crypto=require('crypto');var jsforce=require(_0x5ca8('0xd'));var deskjs=require(_0x5ca8('0xe'));var toCsv=require(_0x5ca8('0x9'));var querystring=require(_0x5ca8('0xf'));var Papa=require('papaparse');var Redis=require(_0x5ca8('0x10'));var authService=require(_0x5ca8('0x11'));var qs=require(_0x5ca8('0x12'));var as=require(_0x5ca8('0x13'));var hardwareService=require(_0x5ca8('0x14'));var logger=require(_0x5ca8('0x15'))(_0x5ca8('0x16'));var utils=require('../../config/utils');var config=require(_0x5ca8('0x17'));var licenseUtil=require(_0x5ca8('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x499869,_0x397891){_0x397891=_0x397891||0xcc;return function(_0x18546f){if(_0x18546f){return _0x499869[_0x5ca8('0x19')](_0x397891);}return _0x499869['status'](_0x397891)[_0x5ca8('0x1a')]();};}function respondWithResult(_0x402fac,_0x55fff7){_0x55fff7=_0x55fff7||0xc8;return function(_0x4ecbe6){if(_0x4ecbe6){return _0x402fac[_0x5ca8('0x1b')](_0x55fff7)[_0x5ca8('0x1c')](_0x4ecbe6);}};}function respondWithFilteredResult(_0x43e5a3,_0x5c215c){return function(_0x5d315d){if(_0x5d315d){var _0x4a2758=typeof _0x5c215c[_0x5ca8('0x1d')]==='undefined'&&typeof _0x5c215c[_0x5ca8('0x1e')]===_0x5ca8('0x1f');var _0x4f124c=_0x5d315d[_0x5ca8('0x20')];var _0x48b5cf=_0x4a2758?0x0:_0x5c215c['offset'];var _0xef40a6=_0x4a2758?_0x5d315d[_0x5ca8('0x20')]:_0x5c215c['offset']+_0x5c215c[_0x5ca8('0x1e')];var _0x5512ce;if(_0xef40a6>=_0x4f124c){_0xef40a6=_0x4f124c;_0x5512ce=0xc8;}else{_0x5512ce=0xce;}_0x43e5a3['status'](_0x5512ce);return _0x43e5a3[_0x5ca8('0x21')]('Content-Range',_0x48b5cf+'-'+_0xef40a6+'/'+_0x4f124c)[_0x5ca8('0x1c')](_0x5d315d);}return null;};}function patchUpdates(_0x4f6be5){return function(_0x3b8e2e){try{jsonpatch[_0x5ca8('0x22')](_0x3b8e2e,_0x4f6be5,!![]);}catch(_0x5f3eb5){return BPromise[_0x5ca8('0x23')](_0x5f3eb5);}return _0x3b8e2e[_0x5ca8('0x24')]();};}function saveUpdates(_0x5ea184,_0x548f9f){return function(_0x4e0531){if(_0x4e0531){return _0x4e0531['update'](_0x5ea184)['then'](function(_0xa4a73a){return _0xa4a73a;});}return null;};}function removeEntity(_0x1e58fb,_0x194844){return function(_0x398252){if(_0x398252){return _0x398252[_0x5ca8('0x25')]()[_0x5ca8('0x26')](function(){_0x1e58fb[_0x5ca8('0x1b')](0xcc)[_0x5ca8('0x1a')]();});}};}function handleEntityNotFound(_0x5734d4,_0x8a3900){return function(_0x16a7fe){if(!_0x16a7fe){_0x5734d4['sendStatus'](0x194);}return _0x16a7fe;};}function handleError(_0x2c2b06,_0x239366){_0x239366=_0x239366||0x1f4;return function(_0x23888e){logger['error'](_0x23888e[_0x5ca8('0x27')]);if(_0x23888e[_0x5ca8('0x28')]){delete _0x23888e[_0x5ca8('0x28')];}_0x2c2b06[_0x5ca8('0x1b')](_0x239366)['send'](_0x23888e);};}exports['index']=function(_0x596da2,_0x50e1a1){var _0x2ed617={},_0x44a5f7={},_0x25986b={'count':0x0,'rows':[]};var _0x1d277e=_[_0x5ca8('0x29')](db[_0x5ca8('0x2a')][_0x5ca8('0x2b')],function(_0x1fecf1){return{'name':_0x1fecf1[_0x5ca8('0x2c')],'type':_0x1fecf1[_0x5ca8('0x2d')]['key']};});_0x44a5f7[_0x5ca8('0x2e')]=_[_0x5ca8('0x29')](_0x1d277e,_0x5ca8('0x28'));_0x44a5f7[_0x5ca8('0x2f')]=_['keys'](_0x596da2[_0x5ca8('0x2f')]);_0x44a5f7[_0x5ca8('0x30')]=_[_0x5ca8('0x31')](_0x44a5f7[_0x5ca8('0x2e')],_0x44a5f7[_0x5ca8('0x2f')]);_0x2ed617[_0x5ca8('0x32')]=_[_0x5ca8('0x31')](_0x44a5f7['model'],qs[_0x5ca8('0x33')](_0x596da2[_0x5ca8('0x2f')]['fields']));_0x2ed617[_0x5ca8('0x32')]=_0x2ed617['attributes'][_0x5ca8('0x34')]?_0x2ed617[_0x5ca8('0x32')]:_0x44a5f7[_0x5ca8('0x2e')];if(!_0x596da2['query'][_0x5ca8('0x35')](_0x5ca8('0x36'))){_0x2ed617[_0x5ca8('0x1e')]=qs['limit'](_0x596da2[_0x5ca8('0x2f')][_0x5ca8('0x1e')]);_0x2ed617['offset']=qs['offset'](_0x596da2[_0x5ca8('0x2f')][_0x5ca8('0x1d')]);}_0x2ed617[_0x5ca8('0x37')]=qs[_0x5ca8('0x38')](_0x596da2['query'][_0x5ca8('0x38')]);_0x2ed617[_0x5ca8('0x39')]=qs[_0x5ca8('0x30')](_[_0x5ca8('0x3a')](_0x596da2['query'],_0x44a5f7[_0x5ca8('0x30')]),_0x1d277e);if(_0x596da2[_0x5ca8('0x2f')][_0x5ca8('0x3b')]){_0x2ed617['where']=_['merge'](_0x2ed617[_0x5ca8('0x39')],{'$or':_[_0x5ca8('0x29')](_0x1d277e,function(_0x4c4ead){if(_0x4c4ead['type']!==_0x5ca8('0x3c')){var _0x12a19e={};_0x12a19e[_0x4c4ead[_0x5ca8('0x28')]]={'$like':'%'+_0x596da2[_0x5ca8('0x2f')]['filter']+'%'};return _0x12a19e;}})});}_0x2ed617=_[_0x5ca8('0x3d')]({},_0x2ed617,_0x596da2['options']);var _0x108694={'where':_0x2ed617[_0x5ca8('0x39')]};return db[_0x5ca8('0x2a')][_0x5ca8('0x20')](_0x108694)[_0x5ca8('0x26')](function(_0x161dcf){_0x25986b['count']=_0x161dcf;if(_0x596da2[_0x5ca8('0x2f')][_0x5ca8('0x3e')]){_0x2ed617[_0x5ca8('0x3f')]=[{'all':!![]}];}return db['FaxApplication'][_0x5ca8('0x40')](_0x2ed617);})['then'](function(_0x1f5791){_0x25986b[_0x5ca8('0x41')]=_0x1f5791;return _0x25986b;})[_0x5ca8('0x26')](respondWithFilteredResult(_0x50e1a1,_0x2ed617))['catch'](handleError(_0x50e1a1,null));};exports[_0x5ca8('0x42')]=function(_0x532af2,_0x24c9de){var _0x5a07cf={'raw':!![],'where':{'id':_0x532af2[_0x5ca8('0x43')]['id']}},_0x3f0a40={};_0x3f0a40['model']=_[_0x5ca8('0x44')](db[_0x5ca8('0x2a')][_0x5ca8('0x2b')]);_0x3f0a40[_0x5ca8('0x2f')]=_['keys'](_0x532af2[_0x5ca8('0x2f')]);_0x3f0a40[_0x5ca8('0x30')]=_[_0x5ca8('0x31')](_0x3f0a40[_0x5ca8('0x2e')],_0x3f0a40[_0x5ca8('0x2f')]);_0x5a07cf[_0x5ca8('0x32')]=_[_0x5ca8('0x31')](_0x3f0a40[_0x5ca8('0x2e')],qs[_0x5ca8('0x33')](_0x532af2[_0x5ca8('0x2f')]['fields']));_0x5a07cf[_0x5ca8('0x32')]=_0x5a07cf[_0x5ca8('0x32')][_0x5ca8('0x34')]?_0x5a07cf[_0x5ca8('0x32')]:_0x3f0a40[_0x5ca8('0x2e')];if(_0x532af2[_0x5ca8('0x2f')][_0x5ca8('0x3e')]){_0x5a07cf[_0x5ca8('0x3f')]=[{'all':!![]}];}_0x5a07cf=_[_0x5ca8('0x3d')]({},_0x5a07cf,_0x532af2['options']);return db[_0x5ca8('0x2a')][_0x5ca8('0x45')](_0x5a07cf)['then'](handleEntityNotFound(_0x24c9de,null))[_0x5ca8('0x26')](respondWithResult(_0x24c9de,null))[_0x5ca8('0x46')](handleError(_0x24c9de,null));};exports[_0x5ca8('0x47')]=function(_0x2ecabd,_0x330503){return db[_0x5ca8('0x2a')][_0x5ca8('0x47')](_0x2ecabd[_0x5ca8('0x48')],{})['then'](respondWithResult(_0x330503,0xc9))[_0x5ca8('0x46')](handleError(_0x330503,null));};exports[_0x5ca8('0x49')]=function(_0x430e27,_0x3b2926){if(_0x430e27[_0x5ca8('0x48')]['id']){delete _0x430e27[_0x5ca8('0x48')]['id'];}return db[_0x5ca8('0x2a')][_0x5ca8('0x45')]({'where':{'id':_0x430e27[_0x5ca8('0x43')]['id']}})['then'](handleEntityNotFound(_0x3b2926,null))[_0x5ca8('0x26')](saveUpdates(_0x430e27[_0x5ca8('0x48')],null))[_0x5ca8('0x26')](respondWithResult(_0x3b2926,null))['catch'](handleError(_0x3b2926,null));};exports[_0x5ca8('0x25')]=function(_0x4e9b7d,_0x524ef6){return db[_0x5ca8('0x2a')][_0x5ca8('0x45')]({'where':{'id':_0x4e9b7d[_0x5ca8('0x43')]['id']}})[_0x5ca8('0x26')](handleEntityNotFound(_0x524ef6,null))['then'](removeEntity(_0x524ef6,null))[_0x5ca8('0x46')](handleError(_0x524ef6,null));}; \ No newline at end of file +var _0x8fec=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','destroy','error','stack','name','send','index','map','FaxApplication','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','then','includeAll','include','findAll','rows','catch','params','rawAttributes','length','find','create','body','update','eml-format','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x5602e9,_0x1e241d){var _0x54e2aa=function(_0xf8a7c1){while(--_0xf8a7c1){_0x5602e9['push'](_0x5602e9['shift']());}};_0x54e2aa(++_0x1e241d);}(_0x8fec,0xdf));var _0xc8fe=function(_0x287e92,_0x112818){_0x287e92=_0x287e92-0x0;var _0x11b651=_0x8fec[_0x287e92];return _0x11b651;};'use strict';var emlformat=require(_0xc8fe('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc8fe('0x1'));var jsonpatch=require(_0xc8fe('0x2'));var rp=require(_0xc8fe('0x3'));var moment=require(_0xc8fe('0x4'));var BPromise=require(_0xc8fe('0x5'));var Mustache=require(_0xc8fe('0x6'));var util=require(_0xc8fe('0x7'));var path=require(_0xc8fe('0x8'));var sox=require(_0xc8fe('0x9'));var csv=require(_0xc8fe('0xa'));var ejs=require(_0xc8fe('0xb'));var fs=require('fs');var fs_extra=require(_0xc8fe('0xc'));var _=require(_0xc8fe('0xd'));var squel=require(_0xc8fe('0xe'));var crypto=require(_0xc8fe('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xc8fe('0x10'));var toCsv=require(_0xc8fe('0xa'));var querystring=require('querystring');var Papa=require(_0xc8fe('0x11'));var Redis=require('ioredis');var authService=require(_0xc8fe('0x12'));var qs=require(_0xc8fe('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc8fe('0x14'));var logger=require(_0xc8fe('0x15'))(_0xc8fe('0x16'));var utils=require(_0xc8fe('0x17'));var config=require(_0xc8fe('0x18'));var licenseUtil=require(_0xc8fe('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14b0a3,_0x179df4){_0x179df4=_0x179df4||0xcc;return function(_0x21dd01){if(_0x21dd01){return _0x14b0a3[_0xc8fe('0x1a')](_0x179df4);}return _0x14b0a3[_0xc8fe('0x1b')](_0x179df4)['end']();};}function respondWithResult(_0x53979b,_0x3da16c){_0x3da16c=_0x3da16c||0xc8;return function(_0x27233e){if(_0x27233e){return _0x53979b[_0xc8fe('0x1b')](_0x3da16c)[_0xc8fe('0x1c')](_0x27233e);}};}function respondWithFilteredResult(_0xf715eb,_0x8d640){return function(_0x46757b){if(_0x46757b){var _0x4a91e5=typeof _0x8d640[_0xc8fe('0x1d')]==='undefined'&&typeof _0x8d640[_0xc8fe('0x1e')]===_0xc8fe('0x1f');var _0x3bc96e=_0x46757b[_0xc8fe('0x20')];var _0x40c9f2=_0x4a91e5?0x0:_0x8d640[_0xc8fe('0x1d')];var _0x43cb4f=_0x4a91e5?_0x46757b['count']:_0x8d640[_0xc8fe('0x1d')]+_0x8d640[_0xc8fe('0x1e')];var _0x396430;if(_0x43cb4f>=_0x3bc96e){_0x43cb4f=_0x3bc96e;_0x396430=0xc8;}else{_0x396430=0xce;}_0xf715eb[_0xc8fe('0x1b')](_0x396430);return _0xf715eb[_0xc8fe('0x21')](_0xc8fe('0x22'),_0x40c9f2+'-'+_0x43cb4f+'/'+_0x3bc96e)['json'](_0x46757b);}return null;};}function patchUpdates(_0x2a7616){return function(_0x1f5787){try{jsonpatch[_0xc8fe('0x23')](_0x1f5787,_0x2a7616,!![]);}catch(_0x537ca2){return BPromise[_0xc8fe('0x24')](_0x537ca2);}return _0x1f5787['save']();};}function saveUpdates(_0x158b02,_0x9f711){return function(_0x40318c){if(_0x40318c){return _0x40318c['update'](_0x158b02)['then'](function(_0x522253){return _0x522253;});}return null;};}function removeEntity(_0x27c48a,_0x228c1b){return function(_0x4254bd){if(_0x4254bd){return _0x4254bd[_0xc8fe('0x25')]()['then'](function(){_0x27c48a[_0xc8fe('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19d6c7,_0x418875){return function(_0x33a266){if(!_0x33a266){_0x19d6c7[_0xc8fe('0x1a')](0x194);}return _0x33a266;};}function handleError(_0x4a7047,_0x481123){_0x481123=_0x481123||0x1f4;return function(_0x4ea4fa){logger[_0xc8fe('0x26')](_0x4ea4fa[_0xc8fe('0x27')]);if(_0x4ea4fa[_0xc8fe('0x28')]){delete _0x4ea4fa[_0xc8fe('0x28')];}_0x4a7047[_0xc8fe('0x1b')](_0x481123)[_0xc8fe('0x29')](_0x4ea4fa);};}exports[_0xc8fe('0x2a')]=function(_0x5910db,_0x3f86a0){var _0x3d4567={},_0x450f8b={},_0x45ec5b={'count':0x0,'rows':[]};var _0xe42506=_[_0xc8fe('0x2b')](db[_0xc8fe('0x2c')]['rawAttributes'],function(_0x2bc40b){return{'name':_0x2bc40b[_0xc8fe('0x2d')],'type':_0x2bc40b[_0xc8fe('0x2e')]['key']};});_0x450f8b[_0xc8fe('0x2f')]=_[_0xc8fe('0x2b')](_0xe42506,_0xc8fe('0x28'));_0x450f8b[_0xc8fe('0x30')]=_[_0xc8fe('0x31')](_0x5910db['query']);_0x450f8b[_0xc8fe('0x32')]=_[_0xc8fe('0x33')](_0x450f8b[_0xc8fe('0x2f')],_0x450f8b['query']);_0x3d4567[_0xc8fe('0x34')]=_[_0xc8fe('0x33')](_0x450f8b[_0xc8fe('0x2f')],qs[_0xc8fe('0x35')](_0x5910db[_0xc8fe('0x30')]['fields']));_0x3d4567['attributes']=_0x3d4567[_0xc8fe('0x34')]['length']?_0x3d4567[_0xc8fe('0x34')]:_0x450f8b['model'];if(!_0x5910db['query'][_0xc8fe('0x36')](_0xc8fe('0x37'))){_0x3d4567['limit']=qs[_0xc8fe('0x1e')](_0x5910db[_0xc8fe('0x30')][_0xc8fe('0x1e')]);_0x3d4567[_0xc8fe('0x1d')]=qs[_0xc8fe('0x1d')](_0x5910db[_0xc8fe('0x30')][_0xc8fe('0x1d')]);}_0x3d4567[_0xc8fe('0x38')]=qs[_0xc8fe('0x39')](_0x5910db[_0xc8fe('0x30')]['sort']);_0x3d4567[_0xc8fe('0x3a')]=qs['filters'](_[_0xc8fe('0x3b')](_0x5910db[_0xc8fe('0x30')],_0x450f8b['filters']),_0xe42506);if(_0x5910db[_0xc8fe('0x30')][_0xc8fe('0x3c')]){_0x3d4567[_0xc8fe('0x3a')]=_[_0xc8fe('0x3d')](_0x3d4567['where'],{'$or':_[_0xc8fe('0x2b')](_0xe42506,function(_0x37615c){if(_0x37615c['type']!=='VIRTUAL'){var _0x2c5504={};_0x2c5504[_0x37615c[_0xc8fe('0x28')]]={'$like':'%'+_0x5910db['query'][_0xc8fe('0x3c')]+'%'};return _0x2c5504;}})});}_0x3d4567=_[_0xc8fe('0x3d')]({},_0x3d4567,_0x5910db[_0xc8fe('0x3e')]);var _0x4e1de1={'where':_0x3d4567[_0xc8fe('0x3a')]};return db['FaxApplication'][_0xc8fe('0x20')](_0x4e1de1)[_0xc8fe('0x3f')](function(_0x33b7ce){_0x45ec5b['count']=_0x33b7ce;if(_0x5910db['query'][_0xc8fe('0x40')]){_0x3d4567[_0xc8fe('0x41')]=[{'all':!![]}];}return db[_0xc8fe('0x2c')][_0xc8fe('0x42')](_0x3d4567);})[_0xc8fe('0x3f')](function(_0x43eac8){_0x45ec5b[_0xc8fe('0x43')]=_0x43eac8;return _0x45ec5b;})[_0xc8fe('0x3f')](respondWithFilteredResult(_0x3f86a0,_0x3d4567))[_0xc8fe('0x44')](handleError(_0x3f86a0,null));};exports['show']=function(_0x360343,_0x4c8d5d){var _0x58ca7c={'raw':!![],'where':{'id':_0x360343[_0xc8fe('0x45')]['id']}},_0xa88d2a={};_0xa88d2a[_0xc8fe('0x2f')]=_[_0xc8fe('0x31')](db[_0xc8fe('0x2c')][_0xc8fe('0x46')]);_0xa88d2a['query']=_[_0xc8fe('0x31')](_0x360343[_0xc8fe('0x30')]);_0xa88d2a[_0xc8fe('0x32')]=_['intersection'](_0xa88d2a['model'],_0xa88d2a['query']);_0x58ca7c[_0xc8fe('0x34')]=_[_0xc8fe('0x33')](_0xa88d2a[_0xc8fe('0x2f')],qs[_0xc8fe('0x35')](_0x360343[_0xc8fe('0x30')]['fields']));_0x58ca7c[_0xc8fe('0x34')]=_0x58ca7c[_0xc8fe('0x34')][_0xc8fe('0x47')]?_0x58ca7c[_0xc8fe('0x34')]:_0xa88d2a[_0xc8fe('0x2f')];if(_0x360343[_0xc8fe('0x30')][_0xc8fe('0x40')]){_0x58ca7c[_0xc8fe('0x41')]=[{'all':!![]}];}_0x58ca7c=_[_0xc8fe('0x3d')]({},_0x58ca7c,_0x360343['options']);return db['FaxApplication'][_0xc8fe('0x48')](_0x58ca7c)['then'](handleEntityNotFound(_0x4c8d5d,null))[_0xc8fe('0x3f')](respondWithResult(_0x4c8d5d,null))[_0xc8fe('0x44')](handleError(_0x4c8d5d,null));};exports[_0xc8fe('0x49')]=function(_0x293eaf,_0x280b4e){return db[_0xc8fe('0x2c')][_0xc8fe('0x49')](_0x293eaf[_0xc8fe('0x4a')],{})[_0xc8fe('0x3f')](respondWithResult(_0x280b4e,0xc9))[_0xc8fe('0x44')](handleError(_0x280b4e,null));};exports[_0xc8fe('0x4b')]=function(_0x586d8b,_0x2c54f8){if(_0x586d8b[_0xc8fe('0x4a')]['id']){delete _0x586d8b[_0xc8fe('0x4a')]['id'];}return db[_0xc8fe('0x2c')]['find']({'where':{'id':_0x586d8b[_0xc8fe('0x45')]['id']}})[_0xc8fe('0x3f')](handleEntityNotFound(_0x2c54f8,null))['then'](saveUpdates(_0x586d8b[_0xc8fe('0x4a')],null))[_0xc8fe('0x3f')](respondWithResult(_0x2c54f8,null))[_0xc8fe('0x44')](handleError(_0x2c54f8,null));};exports[_0xc8fe('0x25')]=function(_0x1b8a72,_0x5241ae){return db[_0xc8fe('0x2c')][_0xc8fe('0x48')]({'where':{'id':_0x1b8a72['params']['id']}})[_0xc8fe('0x3f')](handleEntityNotFound(_0x5241ae,null))[_0xc8fe('0x3f')](removeEntity(_0x5241ae,null))[_0xc8fe('0x44')](handleError(_0x5241ae,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 100522b..574cf91 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 _0xf9b4=['define','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports'];(function(_0xcbe213,_0x493a4f){var _0x5d7662=function(_0x44cc3e){while(--_0x44cc3e){_0xcbe213['push'](_0xcbe213['shift']());}};_0x5d7662(++_0x493a4f);}(_0xf9b4,0x64));var _0x4f9b=function(_0xa28b1a,_0x384f4b){_0xa28b1a=_0xa28b1a-0x0;var _0x4c9b78=_0xf9b4[_0xa28b1a];return _0x4c9b78;};'use strict';var _=require(_0x4f9b('0x0'));var util=require(_0x4f9b('0x1'));var logger=require(_0x4f9b('0x2'))(_0x4f9b('0x3'));var moment=require(_0x4f9b('0x4'));var BPromise=require(_0x4f9b('0x5'));var rp=require(_0x4f9b('0x6'));var fs=require('fs');var path=require(_0x4f9b('0x7'));var rimraf=require(_0x4f9b('0x8'));var config=require(_0x4f9b('0x9'));var attributes=require(_0x4f9b('0xa'));module[_0x4f9b('0xb')]=function(_0xc9d2b2,_0x36d108){return _0xc9d2b2[_0x4f9b('0xc')]('FaxApplication',attributes,{'tableName':_0x4f9b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4f9b('0xe'),'collate':_0x4f9b('0xf')});}; \ No newline at end of file +var _0x942b=['utf8mb4_unicode_ci','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','utf8mb4'];(function(_0x16900a,_0xf684c7){var _0x2f2a13=function(_0x521679){while(--_0x521679){_0x16900a['push'](_0x16900a['shift']());}};_0x2f2a13(++_0xf684c7);}(_0x942b,0x1b1));var _0xb942=function(_0x32fe26,_0x1e8a4a){_0x32fe26=_0x32fe26-0x0;var _0x13f71e=_0x942b[_0x32fe26];return _0x13f71e;};'use strict';var _=require('lodash');var util=require(_0xb942('0x0'));var logger=require(_0xb942('0x1'))('api');var moment=require('moment');var BPromise=require(_0xb942('0x2'));var rp=require(_0xb942('0x3'));var fs=require('fs');var path=require(_0xb942('0x4'));var rimraf=require(_0xb942('0x5'));var config=require(_0xb942('0x6'));var attributes=require(_0xb942('0x7'));module[_0xb942('0x8')]=function(_0x47be9e,_0x52a12f){return _0x47be9e[_0xb942('0x9')]('FaxApplication',attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb942('0xa'),'collate':_0xb942('0xb')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index ad12d3d..ddcdcc8 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 _0x3a4a=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','FaxApplication','update','body','options','where','attributes','UpdateFaxApplication','util','bluebird'];(function(_0x5a218a,_0x255d51){var _0x235470=function(_0x3987ba){while(--_0x3987ba){_0x5a218a['push'](_0x5a218a['shift']());}};_0x235470(++_0x255d51);}(_0x3a4a,0xe6));var _0xa3a4=function(_0x32f6b9,_0x2d4aa9){_0x32f6b9=_0x32f6b9-0x0;var _0x267d52=_0x3a4a[_0x32f6b9];return _0x267d52;};'use strict';var _=require('lodash');var util=require(_0xa3a4('0x0'));var moment=require('moment');var BPromise=require(_0xa3a4('0x1'));var rs=require(_0xa3a4('0x2'));var fs=require('fs');var Redis=require(_0xa3a4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa3a4('0x4'));var logger=require(_0xa3a4('0x5'))(_0xa3a4('0x6'));var config=require(_0xa3a4('0x7'));var jayson=require(_0xa3a4('0x8'));var client=jayson['client'][_0xa3a4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3780c3,_0x507505,_0x283160){return new BPromise(function(_0x138c5e,_0x541de8){return client[_0xa3a4('0xa')](_0x3780c3,_0x283160)[_0xa3a4('0xb')](function(_0x5871bb){logger[_0xa3a4('0xc')](_0xa3a4('0xd'),_0x507505,_0xa3a4('0xe'));logger[_0xa3a4('0xf')](_0xa3a4('0x10'),_0x507505,_0xa3a4('0xe'),JSON[_0xa3a4('0x11')](_0x5871bb));if(_0x5871bb['error']){if(_0x5871bb[_0xa3a4('0x12')]['code']===0x1f4){logger['error'](_0xa3a4('0xd'),_0x507505,_0x5871bb[_0xa3a4('0x12')][_0xa3a4('0x13')]);return _0x541de8(_0x5871bb[_0xa3a4('0x12')][_0xa3a4('0x13')]);}logger['error'](_0xa3a4('0xd'),_0x507505,_0x5871bb[_0xa3a4('0x12')][_0xa3a4('0x13')]);return _0x138c5e(_0x5871bb[_0xa3a4('0x12')][_0xa3a4('0x13')]);}else{logger[_0xa3a4('0xc')](_0xa3a4('0xd'),_0x507505,_0xa3a4('0xe'));_0x138c5e(_0x5871bb[_0xa3a4('0x14')]['message']);}})[_0xa3a4('0x15')](function(_0x595c8f){logger[_0xa3a4('0x12')]('FaxApplication,\x20%s,\x20%s',_0x507505,_0x595c8f);_0x541de8(_0x595c8f);});});}exports['UpdateFaxApplication']=function(_0x4abb05){var _0x530e8b=this;return new Promise(function(_0x26ef73,_0x270245){return db[_0xa3a4('0x16')][_0xa3a4('0x17')](_0x4abb05[_0xa3a4('0x18')],{'raw':_0x4abb05['options']?_0x4abb05[_0xa3a4('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4abb05['options']?_0x4abb05[_0xa3a4('0x19')][_0xa3a4('0x1a')]||null:null,'attributes':_0x4abb05[_0xa3a4('0x19')]?_0x4abb05[_0xa3a4('0x19')][_0xa3a4('0x1b')]||null:null,'limit':_0x4abb05[_0xa3a4('0x19')]?_0x4abb05['options']['limit']||null:null})[_0xa3a4('0xb')](function(_0x582b50){logger['info']('UpdateFaxApplication',_0x4abb05);logger[_0xa3a4('0xf')](_0xa3a4('0x1c'),_0x4abb05,JSON[_0xa3a4('0x11')](_0x582b50));_0x26ef73(_0x582b50);})['catch'](function(_0x335b7c){logger['error'](_0xa3a4('0x1c'),_0x335b7c[_0xa3a4('0x13')],_0x4abb05);_0x270245(_0x530e8b[_0xa3a4('0x12')](0x1f4,_0x335b7c[_0xa3a4('0x13')]));});});}; \ No newline at end of file +var _0xb59a=['debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes','limit','stringify','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x2096fd,_0x2b3543){var _0x14b7e2=function(_0x20b28d){while(--_0x20b28d){_0x2096fd['push'](_0x2096fd['shift']());}};_0x14b7e2(++_0x2b3543);}(_0xb59a,0x1ec));var _0xab59=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb59a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xab59('0x0'));var util=require('util');var moment=require(_0xab59('0x1'));var BPromise=require(_0xab59('0x2'));var rs=require(_0xab59('0x3'));var fs=require('fs');var Redis=require(_0xab59('0x4'));var db=require(_0xab59('0x5'))['db'];var utils=require(_0xab59('0x6'));var logger=require(_0xab59('0x7'))(_0xab59('0x8'));var config=require(_0xab59('0x9'));var jayson=require(_0xab59('0xa'));var client=jayson[_0xab59('0xb')][_0xab59('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x59ff55,_0x2e6e60,_0x41eb38){return new BPromise(function(_0x539be2,_0x2b5243){return client[_0xab59('0xd')](_0x59ff55,_0x41eb38)[_0xab59('0xe')](function(_0x50e22e){logger[_0xab59('0xf')](_0xab59('0x10'),_0x2e6e60,_0xab59('0x11'));logger[_0xab59('0x12')](_0xab59('0x13'),_0x2e6e60,_0xab59('0x11'),JSON['stringify'](_0x50e22e));if(_0x50e22e[_0xab59('0x14')]){if(_0x50e22e[_0xab59('0x14')][_0xab59('0x15')]===0x1f4){logger['error'](_0xab59('0x10'),_0x2e6e60,_0x50e22e[_0xab59('0x14')][_0xab59('0x16')]);return _0x2b5243(_0x50e22e['error'][_0xab59('0x16')]);}logger[_0xab59('0x14')](_0xab59('0x10'),_0x2e6e60,_0x50e22e[_0xab59('0x14')][_0xab59('0x16')]);return _0x539be2(_0x50e22e[_0xab59('0x14')][_0xab59('0x16')]);}else{logger['info']('FaxApplication,\x20%s,\x20%s',_0x2e6e60,_0xab59('0x11'));_0x539be2(_0x50e22e['result'][_0xab59('0x16')]);}})['catch'](function(_0x753d77){logger[_0xab59('0x14')](_0xab59('0x10'),_0x2e6e60,_0x753d77);_0x2b5243(_0x753d77);});});}exports[_0xab59('0x17')]=function(_0xd5d3c6){var _0x42dc8b=this;return new Promise(function(_0x2ad0c7,_0x29973e){return db[_0xab59('0x18')][_0xab59('0x19')](_0xd5d3c6[_0xab59('0x1a')],{'raw':_0xd5d3c6[_0xab59('0x1b')]?_0xd5d3c6[_0xab59('0x1b')][_0xab59('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd5d3c6[_0xab59('0x1b')]?_0xd5d3c6['options'][_0xab59('0x1d')]||null:null,'attributes':_0xd5d3c6['options']?_0xd5d3c6[_0xab59('0x1b')][_0xab59('0x1e')]||null:null,'limit':_0xd5d3c6['options']?_0xd5d3c6['options'][_0xab59('0x1f')]||null:null})['then'](function(_0x147222){logger[_0xab59('0xf')](_0xab59('0x17'),_0xd5d3c6);logger[_0xab59('0x12')](_0xab59('0x17'),_0xd5d3c6,JSON[_0xab59('0x20')](_0x147222));_0x2ad0c7(_0x147222);})[_0xab59('0x21')](function(_0x2210aa){logger[_0xab59('0x14')](_0xab59('0x17'),_0x2210aa[_0xab59('0x16')],_0xd5d3c6);_0x29973e(_0x42dc8b[_0xab59('0x14')](0x1f4,_0x2210aa[_0xab59('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 422d6e6..a9658b6 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 _0x087b=['destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0x371623,_0x31f3d8){var _0x521db2=function(_0x208dd3){while(--_0x208dd3){_0x371623['push'](_0x371623['shift']());}};_0x521db2(++_0x31f3d8);}(_0x087b,0x11a));var _0xb087=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x087b[_0x243b59];return _0x3e1676;};'use strict';var multer=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb087('0x2'));var router=express['Router']();var fs_extra=require(_0xb087('0x3'));var auth=require(_0xb087('0x4'));var interaction=require(_0xb087('0x5'));var config=require(_0xb087('0x6'));var controller=require(_0xb087('0x7'));router[_0xb087('0x8')]('/',auth[_0xb087('0x9')](),controller[_0xb087('0xa')]);router[_0xb087('0x8')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0xc')]);router[_0xb087('0xd')]('/',auth[_0xb087('0x9')](),controller[_0xb087('0xe')]);router[_0xb087('0xf')](_0xb087('0xb'),auth['isAuthenticated'](),controller[_0xb087('0x10')]);router[_0xb087('0x11')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0x12')]);module[_0xb087('0x13')]=router; \ No newline at end of file +var _0xb7e7=['exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','index','get','/:id','show','post','isAuthenticated','create','put','delete','destroy'];(function(_0x2274f0,_0x1f4eb5){var _0x2288e6=function(_0x2ce175){while(--_0x2ce175){_0x2274f0['push'](_0x2274f0['shift']());}};_0x2288e6(++_0x1f4eb5);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0xb7e7[_0x2aec52];return _0x3b8835;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller['update']);router[_0x7b7e('0xf')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x10')]);module[_0x7b7e('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 075c5c1..4d909b1 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 _0x14a0=['out','INTEGER','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x3b12de,_0x3a7503){var _0x3e8d48=function(_0x19e931){while(--_0x19e931){_0x3b12de['push'](_0x3b12de['shift']());}};_0x3e8d48(++_0x3a7503);}(_0x14a0,0x8e));var _0x014a=function(_0x48de19,_0x1edec5){_0x48de19=_0x48de19-0x0;var _0x238668=_0x14a0[_0x48de19];return _0x238668;};'use strict';var Sequelize=require('sequelize');module[_0x014a('0x0')]={'closed':{'type':Sequelize[_0x014a('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x014a('0x2')]},'disposition':{'type':Sequelize[_0x014a('0x3')]},'secondDisposition':{'type':Sequelize[_0x014a('0x3')]},'thirdDisposition':{'type':Sequelize[_0x014a('0x3')]},'note':{'type':Sequelize[_0x014a('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x014a('0x4')]('in',_0x014a('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x014a('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x014a('0x6')]}}; \ No newline at end of file +var _0x7880=['ENUM','out','INTEGER','exports','BOOLEAN','DATE','STRING'];(function(_0x10bc2a,_0xd84642){var _0x443953=function(_0x471009){while(--_0x471009){_0x10bc2a['push'](_0x10bc2a['shift']());}};_0x443953(++_0xd84642);}(_0x7880,0x1f4));var _0x0788=function(_0x1a87cd,_0x2a244f){_0x1a87cd=_0x1a87cd-0x0;var _0x4af60e=_0x7880[_0x1a87cd];return _0x4af60e;};'use strict';var Sequelize=require('sequelize');module[_0x0788('0x0')]={'closed':{'type':Sequelize[_0x0788('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0788('0x2')]},'disposition':{'type':Sequelize[_0x0788('0x3')]},'secondDisposition':{'type':Sequelize[_0x0788('0x3')]},'thirdDisposition':{'type':Sequelize[_0x0788('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x0788('0x2')]},'fax':{'type':Sequelize[_0x0788('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x0788('0x4')]('in',_0x0788('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0788('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x0788('0x4')]('in',_0x0788('0x5')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x0788('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 238ef72..cf4f633 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 _0x490a=['find','create','body','params','destroy','describe','FaxMessage','addMessage','ids','getMessages','findOne','intersection','hasOwnProperty','nolimit','order','sort','pick','where','FaxInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','merge','findAll','rows','addTags','setTags','spread','color','emit','faxInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','Attachment','createdAt','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','resolve','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../mysqldb','redis','localhost','register','sendStatus','end','status','json','undefined','limit','offset','count','Content-Range','update','then','stack','name','send','index','map','rawAttributes','fieldName','type','getOptions','fax','query','catch','show','model','keys','filters','fields','attributes','length','includeAll','include','options','FaxInteraction'];(function(_0x4f1b87,_0x260834){var _0x74718e=function(_0x24c7c2){while(--_0x24c7c2){_0x4f1b87['push'](_0x4f1b87['shift']());}};_0x74718e(++_0x260834);}(_0x490a,0x10b));var _0xa490=function(_0x3c095f,_0x2c0854){_0x3c095f=_0x3c095f-0x0;var _0x3da162=_0x490a[_0x3c095f];return _0x3da162;};'use strict';var rimraf=require(_0xa490('0x0'));var zipdir=require(_0xa490('0x1'));var moment=require(_0xa490('0x2'));var BPromise=require(_0xa490('0x3'));var util=require(_0xa490('0x4'));var path=require(_0xa490('0x5'));var fs=require('fs');var _=require(_0xa490('0x6'));var Redis=require(_0xa490('0x7'));var interaction=require(_0xa490('0x8'));var qs=require(_0xa490('0x9'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0xa490('0xa'))['db'];config[_0xa490('0xb')]=_['defaults'](config[_0xa490('0xb')],{'host':_0xa490('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa490('0xb')]));require('./faxInteraction.socket')[_0xa490('0xd')](socket);function respondWithStatusCode(_0x7785ca,_0x5205cb){_0x5205cb=_0x5205cb||0xcc;return function(_0x2bb500){if(_0x2bb500){return _0x7785ca[_0xa490('0xe')](_0x5205cb);}return _0x7785ca['status'](_0x5205cb)[_0xa490('0xf')]();};}function respondWithResult(_0x1f7b95,_0x44495b){_0x44495b=_0x44495b||0xc8;return function(_0x57fb19){if(_0x57fb19){return _0x1f7b95[_0xa490('0x10')](_0x44495b)[_0xa490('0x11')](_0x57fb19);}};}function respondWithFilteredResult(_0x8c0ba4,_0x3b972c){return function(_0x2f5a41){if(_0x2f5a41){var _0x47bf46=typeof _0x3b972c['offset']===_0xa490('0x12')&&typeof _0x3b972c[_0xa490('0x13')]===_0xa490('0x12');var _0x3ebe3a=_0x2f5a41['count'];var _0xba9208=_0x47bf46?0x0:_0x3b972c[_0xa490('0x14')];var _0x3a58e2=_0x47bf46?_0x2f5a41[_0xa490('0x15')]:_0x3b972c[_0xa490('0x14')]+_0x3b972c['limit'];var _0x207b0a;if(_0x3a58e2>=_0x3ebe3a){_0x3a58e2=_0x3ebe3a;_0x207b0a=0xc8;}else{_0x207b0a=0xce;}_0x8c0ba4[_0xa490('0x10')](_0x207b0a);return _0x8c0ba4['set'](_0xa490('0x16'),_0xba9208+'-'+_0x3a58e2+'/'+_0x3ebe3a)[_0xa490('0x11')](_0x2f5a41);}return null;};}function saveUpdates(_0xb4af3c){return function(_0x23869f){if(_0x23869f){return _0x23869f[_0xa490('0x17')](_0xb4af3c)[_0xa490('0x18')](function(_0x1b552b){return _0x1b552b;});}return null;};}function removeEntity(_0x5a4009){return function(_0x43b4fc){if(_0x43b4fc){return _0x43b4fc['destroy']()[_0xa490('0x18')](function(){_0x5a4009[_0xa490('0x10')](0xcc)[_0xa490('0xf')]();});}};}function handleEntityNotFound(_0x24562a){return function(_0x58a597){if(!_0x58a597){_0x24562a[_0xa490('0xe')](0x194);}return _0x58a597;};}function handleError(_0x5dc074,_0x43bbcd){_0x43bbcd=_0x43bbcd||0x1f4;return function(_0x46a5d4){logger['error'](_0x46a5d4[_0xa490('0x19')]);if(_0x46a5d4[_0xa490('0x1a')]){delete _0x46a5d4[_0xa490('0x1a')];}_0x5dc074[_0xa490('0x10')](_0x43bbcd)[_0xa490('0x1b')](_0x46a5d4);};}exports[_0xa490('0x1c')]=function(_0x276413,_0x1b9659){var _0x23cebc={};var _0x9a3fbc=_[_0xa490('0x1d')](db['FaxInteraction'][_0xa490('0x1e')],function(_0x54e9c2){return{'name':_0x54e9c2[_0xa490('0x1f')],'type':_0x54e9c2[_0xa490('0x20')]['key']};});_0x23cebc=qs[_0xa490('0x21')](_0x9a3fbc,_0x276413);return interaction['findAll'](_0xa490('0x22'),_0x276413[_0xa490('0x23')],_0x276413['user'],_0x23cebc,_0x9a3fbc)[_0xa490('0x18')](respondWithFilteredResult(_0x1b9659,_0x23cebc))[_0xa490('0x24')](handleError(_0x1b9659,null));};exports[_0xa490('0x25')]=function(_0x3bd0fa,_0x1150ae){var _0xe53f0e={'raw':![],'where':{'id':_0x3bd0fa['params']['id']}},_0x53fca7={};_0x53fca7[_0xa490('0x26')]=_[_0xa490('0x27')](db['FaxInteraction'][_0xa490('0x1e')]);_0x53fca7[_0xa490('0x23')]=_['keys'](_0x3bd0fa[_0xa490('0x23')]);_0x53fca7[_0xa490('0x28')]=_['intersection'](_0x53fca7[_0xa490('0x26')],_0x53fca7[_0xa490('0x23')]);_0xe53f0e['attributes']=_['intersection'](_0x53fca7[_0xa490('0x26')],qs[_0xa490('0x29')](_0x3bd0fa[_0xa490('0x23')][_0xa490('0x29')]));_0xe53f0e[_0xa490('0x2a')]=_0xe53f0e['attributes'][_0xa490('0x2b')]?_0xe53f0e['attributes']:_0x53fca7[_0xa490('0x26')];if(_0x3bd0fa[_0xa490('0x23')][_0xa490('0x2c')]){_0xe53f0e[_0xa490('0x2d')]=[{'all':!![]}];}_0xe53f0e=_['merge']({},_0xe53f0e,_0x3bd0fa[_0xa490('0x2e')]);return db[_0xa490('0x2f')][_0xa490('0x30')](_0xe53f0e)[_0xa490('0x18')](handleEntityNotFound(_0x1150ae,null))[_0xa490('0x18')](respondWithResult(_0x1150ae,null))['catch'](handleError(_0x1150ae,null));};exports[_0xa490('0x31')]=function(_0x4f4e7d,_0x16a353){return db['FaxInteraction'][_0xa490('0x31')](_0x4f4e7d[_0xa490('0x32')],{})[_0xa490('0x18')](respondWithResult(_0x16a353,0xc9))[_0xa490('0x24')](handleError(_0x16a353,null));};exports[_0xa490('0x17')]=function(_0x48ee02,_0xda1355){if(_0x48ee02[_0xa490('0x32')]['id']){delete _0x48ee02['body']['id'];}return db[_0xa490('0x2f')]['find']({'where':{'id':_0x48ee02[_0xa490('0x33')]['id']}})['then'](handleEntityNotFound(_0xda1355,null))[_0xa490('0x18')](saveUpdates(_0x48ee02[_0xa490('0x32')],null))[_0xa490('0x18')](respondWithResult(_0xda1355,null))[_0xa490('0x24')](handleError(_0xda1355,null));};exports[_0xa490('0x34')]=function(_0x325f0d,_0xf50a5b){return db[_0xa490('0x2f')]['find']({'where':{'id':_0x325f0d['params']['id']}})[_0xa490('0x18')](handleEntityNotFound(_0xf50a5b,null))['then'](removeEntity(_0xf50a5b,null))[_0xa490('0x24')](handleError(_0xf50a5b,null));};exports[_0xa490('0x35')]=function(_0x4c16c1,_0x1a6815){return db[_0xa490('0x2f')][_0xa490('0x35')]()[_0xa490('0x18')](respondWithResult(_0x1a6815,null))[_0xa490('0x24')](handleError(_0x1a6815,null));};exports['addMessage']=function(_0x55ac4a,_0x5d8aef){return db[_0xa490('0x36')][_0xa490('0x30')]({'where':{'id':_0x55ac4a['params']['id']}})[_0xa490('0x18')](handleEntityNotFound(_0x5d8aef,null))[_0xa490('0x18')](function(_0x133b9e){if(_0x133b9e){return _0x133b9e[_0xa490('0x37')](_0x55ac4a['body']['ids'],_['omit'](_0x55ac4a[_0xa490('0x32')],[_0xa490('0x38'),'id'])||{});}})[_0xa490('0x18')](respondWithResult(_0x5d8aef,null))['catch'](handleError(_0x5d8aef,null));};exports[_0xa490('0x39')]=function(_0x472baf,_0x6dc45d){var _0xaafddf={'raw':![],'where':{}};var _0x3b9cd5={};var _0x4e6343={'count':0x0,'rows':[]};return db[_0xa490('0x2f')][_0xa490('0x3a')]({'where':{'id':_0x472baf[_0xa490('0x33')]['id']}})[_0xa490('0x18')](handleEntityNotFound(_0x6dc45d,null))[_0xa490('0x18')](function(_0x3d4ada){if(_0x3d4ada){_0x3b9cd5[_0xa490('0x26')]=_[_0xa490('0x27')](db['FaxMessage'][_0xa490('0x1e')]);_0x3b9cd5[_0xa490('0x23')]=_[_0xa490('0x27')](_0x472baf[_0xa490('0x23')]);_0x3b9cd5[_0xa490('0x28')]=_[_0xa490('0x3b')](_0x3b9cd5['model'],_0x3b9cd5[_0xa490('0x23')]);_0xaafddf['attributes']=_['intersection'](_0x3b9cd5[_0xa490('0x26')],qs['fields'](_0x472baf['query']['fields']));_0xaafddf['attributes']=_0xaafddf[_0xa490('0x2a')][_0xa490('0x2b')]?_0xaafddf['attributes']:_0x3b9cd5[_0xa490('0x26')];if(!_0x472baf[_0xa490('0x23')][_0xa490('0x3c')](_0xa490('0x3d'))){_0xaafddf['limit']=qs['limit'](_0x472baf['query'][_0xa490('0x13')]);_0xaafddf[_0xa490('0x14')]=qs['offset'](_0x472baf[_0xa490('0x23')][_0xa490('0x14')]);}_0xaafddf[_0xa490('0x3e')]=qs[_0xa490('0x3f')](_0x472baf[_0xa490('0x23')][_0xa490('0x3f')]);_0xaafddf['where']=qs['filters'](_[_0xa490('0x40')](_0x472baf[_0xa490('0x23')],_0x3b9cd5[_0xa490('0x28')]));_0xaafddf[_0xa490('0x41')][_0xa490('0x42')]=_0x3d4ada['id'];if(_0x472baf[_0xa490('0x23')][_0xa490('0x43')]){_0xaafddf[_0xa490('0x41')]=_['merge'](_0xaafddf['where'],{'$or':_[_0xa490('0x1d')](_0xaafddf[_0xa490('0x2a')],function(_0x265793){var _0x125398={};_0x125398[_0x265793]={'$like':'%'+_0x472baf[_0xa490('0x23')]['filter']+'%'};return _0x125398;})});}if(_0x472baf[_0xa490('0x23')][_0xa490('0x44')]){var _0xa79071=_0x472baf[_0xa490('0x23')][_0xa490('0x44')][_0xa490('0x45')](',');var _0x3e8811={};_0x3e8811[_0xa79071[0x0]]={'$gte':moment(_0xa79071[0x1])[_0xa490('0x46')](_0xa490('0x47'))};_0xaafddf[_0xa490('0x41')]=_[_0xa490('0x48')](_0xaafddf[_0xa490('0x41')],_0x3e8811);}_0xaafddf=_[_0xa490('0x48')]({},_0xaafddf,_0x472baf[_0xa490('0x2e')]);return db[_0xa490('0x36')][_0xa490('0x15')]({'where':_0xaafddf[_0xa490('0x41')]})[_0xa490('0x18')](function(_0x13d55a){_0x4e6343[_0xa490('0x15')]=_0x13d55a;if(_0x472baf[_0xa490('0x23')]['includeAll']){_0xaafddf[_0xa490('0x2d')]=[{'all':!![]}];}return db['FaxMessage'][_0xa490('0x49')](_0xaafddf);})[_0xa490('0x18')](function(_0x5bf340){_0x4e6343[_0xa490('0x4a')]=_0x5bf340;return _0x4e6343;});}})[_0xa490('0x18')](respondWithFilteredResult(_0x6dc45d,_0xaafddf))['catch'](handleError(_0x6dc45d,null));};exports[_0xa490('0x4b')]=function(_0x301a31,_0x439d32){return db[_0xa490('0x2f')][_0xa490('0x30')]({'where':{'id':_0x301a31[_0xa490('0x33')]['id']}})[_0xa490('0x18')](handleEntityNotFound(_0x439d32,null))[_0xa490('0x18')](function(_0x4d9c1d){if(_0x4d9c1d){return _0x4d9c1d[_0xa490('0x4c')](_0x301a31[_0xa490('0x32')][_0xa490('0x38')],_['omit'](_0x301a31[_0xa490('0x32')],['ids','id'])||{})[_0xa490('0x4d')](function(){return db['Tag'][_0xa490('0x49')]({'attributes':['id',_0xa490('0x1a'),_0xa490('0x4e')],'where':{'id':_0x301a31[_0xa490('0x32')][_0xa490('0x38')]}});})[_0xa490('0x18')](function(_0x5ef160){socket[_0xa490('0x4f')](_0xa490('0x50'),{'id':Number(_0x301a31['params']['id']),'tags':_0x5ef160||[]});return{'id':Number(_0x301a31[_0xa490('0x33')]['id']),'tags':_0x5ef160||[]};});}})[_0xa490('0x18')](respondWithResult(_0x439d32,null))[_0xa490('0x24')](handleError(_0x439d32,null));};exports['removeTags']=function(_0x36a93e,_0x3d6c0d){return db['FaxInteraction']['find']({'where':{'id':_0x36a93e['params']['id']}})[_0xa490('0x18')](handleEntityNotFound(_0x3d6c0d,null))[_0xa490('0x18')](function(_0x5063af){if(_0x5063af){return _0x5063af[_0xa490('0x51')](_0x36a93e['query'][_0xa490('0x38')]);}})[_0xa490('0x18')](respondWithStatusCode(_0x3d6c0d,null))['catch'](handleError(_0x3d6c0d,null));};exports[_0xa490('0x52')]=function(_0xba4ec8,_0x26e8b5){var _0x3417c3=moment()[_0xa490('0x53')]()[_0xa490('0x54')]();var _0x53c219=path[_0xa490('0x55')](config[_0xa490('0x56')],_0xa490('0x57'),_0xa490('0x58'),_0xa490('0x59'));var _0x3e4c15=path[_0xa490('0x55')](config[_0xa490('0x56')],_0xa490('0x57'),_0xa490('0x58'),_0xa490('0x5a'));var _0x5f1088=path['join'](_0x53c219,_0x3417c3);var _0x3eda5b=util['format'](_0xa490('0x5b'),_0xba4ec8[_0xa490('0x33')]['id'],_0x3417c3);var _0x2cf09b=path[_0xa490('0x55')](_0x53c219,_0x3eda5b);var _0x509dfb=[];_0x509dfb[_0xa490('0x5c')]({'model':db[_0xa490('0x5d')],'as':_0xa490('0x5d'),'raw':!![]});var _0x5aff90=[{'model':db['FaxMessage'],'as':'Messages','attributes':['id',_0xa490('0x32'),_0xa490('0x5e')],'include':_0x509dfb}];return db[_0xa490('0x2f')][_0xa490('0x30')]({'where':{'id':_0xba4ec8[_0xa490('0x33')]['id']},'include':_0x5aff90})[_0xa490('0x18')](handleEntityNotFound(_0x26e8b5,null))[_0xa490('0x18')](function(_0x2a1343){if(_0x2a1343&&_0x2a1343[_0xa490('0x5f')]){var _0x55dda1=_0x2a1343['get']({'plain':!![]});fs['mkdirSync'](_0x5f1088);for(var _0xc83d2a=0x0;_0xc83d2a<_0x55dda1[_0xa490('0x5f')][_0xa490('0x2b')];_0xc83d2a++){var _0xd36aec=_0x55dda1[_0xa490('0x5f')][_0xc83d2a][_0xa490('0x5d')];if(_0xd36aec){var _0x5b064e=path[_0xa490('0x55')](_0x3e4c15,_0xd36aec[_0xa490('0x60')]);if(fs[_0xa490('0x61')](_0x5b064e)){fs[_0xa490('0x62')](_0x5b064e)[_0xa490('0x63')](fs[_0xa490('0x64')](path[_0xa490('0x55')](_0x5f1088,_0xd36aec[_0xa490('0x60')])));}}}return BPromise[_0xa490('0x65')]()[_0xa490('0x18')](function(){return new BPromise(function(_0x982e82,_0x34b48c){zipdir(_0x5f1088,{'saveTo':_0x2cf09b},function(_0x54b5ff,_0x4fb2e0){if(_0x54b5ff)return _0x34b48c(_0x54b5ff);return _0x982e82(_0x4fb2e0);});})['then'](function(){return new BPromise(function(_0x41c0aa,_0x294bff){rimraf(_0x5f1088,function(_0x2649ad){if(_0x2649ad)_0x294bff(_0x2649ad);return _0x41c0aa();});});})[_0xa490('0x18')](function(){return _0x26e8b5['download'](_0x2cf09b,_0x3eda5b,function(_0x324522){if(_0x324522){console[_0xa490('0x66')](_0xa490('0x67'),_0x324522);}else{fs[_0xa490('0x68')](_0x2cf09b);}});});});}else{return _0x26e8b5[_0xa490('0xe')](0xc8);}})[_0xa490('0x24')](handleError(_0x26e8b5,null));}; \ No newline at end of file +var _0x0936=['filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','spread','Tag','emit','removeTags','download','unix','join','files','tmp','root','server','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','mkdirSync','existsSync','createReadStream','pipe','createWriteStream','basename','log','err','unlinkSync','util','path','lodash','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','offset','count','set','json','update','then','destroy','error','stack','name','send','index','FaxInteraction','rawAttributes','fieldName','findAll','fax','user','catch','show','params','model','keys','query','intersection','attributes','fields','include','merge','options','create','body','find','describe','addMessage','FaxMessage','ids','getMessages','length','nolimit','limit','sort','where','filters'];(function(_0xc9ea31,_0x1840e5){var _0xa8dd84=function(_0x53df5c){while(--_0x53df5c){_0xc9ea31['push'](_0xc9ea31['shift']());}};_0xa8dd84(++_0x1840e5);}(_0x0936,0x13e));var _0x6093=function(_0x590972,_0x4dd46f){_0x590972=_0x590972-0x0;var _0x273346=_0x0936[_0x590972];return _0x273346;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x6093('0x0'));var path=require(_0x6093('0x1'));var fs=require('fs');var _=require(_0x6093('0x2'));var Redis=require('ioredis');var interaction=require(_0x6093('0x3'));var qs=require(_0x6093('0x4'));var logger=require(_0x6093('0x5'))(_0x6093('0x6'));var config=require(_0x6093('0x7'));var db=require(_0x6093('0x8'))['db'];config[_0x6093('0x9')]=_[_0x6093('0xa')](config['redis'],{'host':_0x6093('0xb'),'port':0x18eb});var socket=require(_0x6093('0xc'))(new Redis(config[_0x6093('0x9')]));require(_0x6093('0xd'))[_0x6093('0xe')](socket);function respondWithStatusCode(_0x4c0b69,_0x53adcc){_0x53adcc=_0x53adcc||0xcc;return function(_0xc8a7cf){if(_0xc8a7cf){return _0x4c0b69[_0x6093('0xf')](_0x53adcc);}return _0x4c0b69[_0x6093('0x10')](_0x53adcc)[_0x6093('0x11')]();};}function respondWithResult(_0x4cc587,_0x3b8876){_0x3b8876=_0x3b8876||0xc8;return function(_0x2025d3){if(_0x2025d3){return _0x4cc587[_0x6093('0x10')](_0x3b8876)['json'](_0x2025d3);}};}function respondWithFilteredResult(_0x194092,_0x7b5117){return function(_0x7f2337){if(_0x7f2337){var _0x3ea834=typeof _0x7b5117[_0x6093('0x12')]==='undefined'&&typeof _0x7b5117['limit']==='undefined';var _0x15ec66=_0x7f2337['count'];var _0x44d09f=_0x3ea834?0x0:_0x7b5117[_0x6093('0x12')];var _0x2fabad=_0x3ea834?_0x7f2337[_0x6093('0x13')]:_0x7b5117[_0x6093('0x12')]+_0x7b5117['limit'];var _0x440b3e;if(_0x2fabad>=_0x15ec66){_0x2fabad=_0x15ec66;_0x440b3e=0xc8;}else{_0x440b3e=0xce;}_0x194092[_0x6093('0x10')](_0x440b3e);return _0x194092[_0x6093('0x14')]('Content-Range',_0x44d09f+'-'+_0x2fabad+'/'+_0x15ec66)[_0x6093('0x15')](_0x7f2337);}return null;};}function saveUpdates(_0x12a762){return function(_0x228d63){if(_0x228d63){return _0x228d63[_0x6093('0x16')](_0x12a762)[_0x6093('0x17')](function(_0xd675ea){return _0xd675ea;});}return null;};}function removeEntity(_0xb67dba){return function(_0x9f7cfd){if(_0x9f7cfd){return _0x9f7cfd[_0x6093('0x18')]()[_0x6093('0x17')](function(){_0xb67dba[_0x6093('0x10')](0xcc)[_0x6093('0x11')]();});}};}function handleEntityNotFound(_0x27de69){return function(_0x482e72){if(!_0x482e72){_0x27de69['sendStatus'](0x194);}return _0x482e72;};}function handleError(_0x4cab3e,_0x13a42f){_0x13a42f=_0x13a42f||0x1f4;return function(_0x14bd97){logger[_0x6093('0x19')](_0x14bd97[_0x6093('0x1a')]);if(_0x14bd97[_0x6093('0x1b')]){delete _0x14bd97[_0x6093('0x1b')];}_0x4cab3e[_0x6093('0x10')](_0x13a42f)[_0x6093('0x1c')](_0x14bd97);};}exports[_0x6093('0x1d')]=function(_0x2bfcfd,_0x5b02f6){var _0x350175={};var _0x433122=_['map'](db[_0x6093('0x1e')][_0x6093('0x1f')],function(_0x5d9c4f){return{'name':_0x5d9c4f[_0x6093('0x20')],'type':_0x5d9c4f['type']['key']};});_0x350175=qs['getOptions'](_0x433122,_0x2bfcfd);return interaction[_0x6093('0x21')](_0x6093('0x22'),_0x2bfcfd['query'],_0x2bfcfd[_0x6093('0x23')],_0x350175,_0x433122)[_0x6093('0x17')](respondWithFilteredResult(_0x5b02f6,_0x350175))[_0x6093('0x24')](handleError(_0x5b02f6,null));};exports[_0x6093('0x25')]=function(_0x427196,_0x883ff5){var _0x2e529c={'raw':![],'where':{'id':_0x427196[_0x6093('0x26')]['id']}},_0x528763={};_0x528763[_0x6093('0x27')]=_[_0x6093('0x28')](db[_0x6093('0x1e')][_0x6093('0x1f')]);_0x528763[_0x6093('0x29')]=_[_0x6093('0x28')](_0x427196[_0x6093('0x29')]);_0x528763['filters']=_[_0x6093('0x2a')](_0x528763['model'],_0x528763['query']);_0x2e529c[_0x6093('0x2b')]=_[_0x6093('0x2a')](_0x528763[_0x6093('0x27')],qs[_0x6093('0x2c')](_0x427196[_0x6093('0x29')][_0x6093('0x2c')]));_0x2e529c[_0x6093('0x2b')]=_0x2e529c['attributes']['length']?_0x2e529c[_0x6093('0x2b')]:_0x528763[_0x6093('0x27')];if(_0x427196[_0x6093('0x29')]['includeAll']){_0x2e529c[_0x6093('0x2d')]=[{'all':!![]}];}_0x2e529c=_[_0x6093('0x2e')]({},_0x2e529c,_0x427196[_0x6093('0x2f')]);return db['FaxInteraction']['find'](_0x2e529c)[_0x6093('0x17')](handleEntityNotFound(_0x883ff5,null))[_0x6093('0x17')](respondWithResult(_0x883ff5,null))[_0x6093('0x24')](handleError(_0x883ff5,null));};exports[_0x6093('0x30')]=function(_0x45c815,_0x69f566){return db[_0x6093('0x1e')][_0x6093('0x30')](_0x45c815[_0x6093('0x31')],{})[_0x6093('0x17')](respondWithResult(_0x69f566,0xc9))[_0x6093('0x24')](handleError(_0x69f566,null));};exports[_0x6093('0x16')]=function(_0x19f9dd,_0x2a33a6){if(_0x19f9dd[_0x6093('0x31')]['id']){delete _0x19f9dd[_0x6093('0x31')]['id'];}return db[_0x6093('0x1e')][_0x6093('0x32')]({'where':{'id':_0x19f9dd[_0x6093('0x26')]['id']}})[_0x6093('0x17')](handleEntityNotFound(_0x2a33a6,null))['then'](saveUpdates(_0x19f9dd[_0x6093('0x31')],null))[_0x6093('0x17')](respondWithResult(_0x2a33a6,null))['catch'](handleError(_0x2a33a6,null));};exports['destroy']=function(_0x5d3be5,_0x43df70){return db[_0x6093('0x1e')][_0x6093('0x32')]({'where':{'id':_0x5d3be5[_0x6093('0x26')]['id']}})[_0x6093('0x17')](handleEntityNotFound(_0x43df70,null))['then'](removeEntity(_0x43df70,null))[_0x6093('0x24')](handleError(_0x43df70,null));};exports[_0x6093('0x33')]=function(_0x9d7de7,_0x149faa){return db['FaxInteraction'][_0x6093('0x33')]()[_0x6093('0x17')](respondWithResult(_0x149faa,null))['catch'](handleError(_0x149faa,null));};exports[_0x6093('0x34')]=function(_0x25db92,_0x3076d4){return db[_0x6093('0x35')][_0x6093('0x32')]({'where':{'id':_0x25db92[_0x6093('0x26')]['id']}})[_0x6093('0x17')](handleEntityNotFound(_0x3076d4,null))[_0x6093('0x17')](function(_0x1d327c){if(_0x1d327c){return _0x1d327c[_0x6093('0x34')](_0x25db92[_0x6093('0x31')][_0x6093('0x36')],_['omit'](_0x25db92[_0x6093('0x31')],['ids','id'])||{});}})[_0x6093('0x17')](respondWithResult(_0x3076d4,null))['catch'](handleError(_0x3076d4,null));};exports[_0x6093('0x37')]=function(_0x6f1dcb,_0x5de7a5){var _0x3ec976={'raw':![],'where':{}};var _0x222ff6={};var _0x25be6c={'count':0x0,'rows':[]};return db['FaxInteraction']['findOne']({'where':{'id':_0x6f1dcb[_0x6093('0x26')]['id']}})[_0x6093('0x17')](handleEntityNotFound(_0x5de7a5,null))[_0x6093('0x17')](function(_0x354435){if(_0x354435){_0x222ff6[_0x6093('0x27')]=_['keys'](db[_0x6093('0x35')]['rawAttributes']);_0x222ff6[_0x6093('0x29')]=_['keys'](_0x6f1dcb[_0x6093('0x29')]);_0x222ff6['filters']=_[_0x6093('0x2a')](_0x222ff6[_0x6093('0x27')],_0x222ff6['query']);_0x3ec976['attributes']=_[_0x6093('0x2a')](_0x222ff6[_0x6093('0x27')],qs[_0x6093('0x2c')](_0x6f1dcb[_0x6093('0x29')]['fields']));_0x3ec976[_0x6093('0x2b')]=_0x3ec976[_0x6093('0x2b')][_0x6093('0x38')]?_0x3ec976['attributes']:_0x222ff6['model'];if(!_0x6f1dcb['query']['hasOwnProperty'](_0x6093('0x39'))){_0x3ec976[_0x6093('0x3a')]=qs[_0x6093('0x3a')](_0x6f1dcb[_0x6093('0x29')][_0x6093('0x3a')]);_0x3ec976[_0x6093('0x12')]=qs[_0x6093('0x12')](_0x6f1dcb[_0x6093('0x29')]['offset']);}_0x3ec976['order']=qs['sort'](_0x6f1dcb[_0x6093('0x29')][_0x6093('0x3b')]);_0x3ec976[_0x6093('0x3c')]=qs[_0x6093('0x3d')](_['pick'](_0x6f1dcb[_0x6093('0x29')],_0x222ff6[_0x6093('0x3d')]));_0x3ec976[_0x6093('0x3c')]['FaxInteractionId']=_0x354435['id'];if(_0x6f1dcb['query'][_0x6093('0x3e')]){_0x3ec976[_0x6093('0x3c')]=_['merge'](_0x3ec976[_0x6093('0x3c')],{'$or':_[_0x6093('0x3f')](_0x3ec976[_0x6093('0x2b')],function(_0x253f98){var _0x351d70={};_0x351d70[_0x253f98]={'$like':'%'+_0x6f1dcb['query'][_0x6093('0x3e')]+'%'};return _0x351d70;})});}if(_0x6f1dcb[_0x6093('0x29')][_0x6093('0x40')]){var _0x140e4f=_0x6f1dcb['query'][_0x6093('0x40')][_0x6093('0x41')](',');var _0x13365d={};_0x13365d[_0x140e4f[0x0]]={'$gte':moment(_0x140e4f[0x1])[_0x6093('0x42')](_0x6093('0x43'))};_0x3ec976[_0x6093('0x3c')]=_[_0x6093('0x2e')](_0x3ec976[_0x6093('0x3c')],_0x13365d);}_0x3ec976=_['merge']({},_0x3ec976,_0x6f1dcb[_0x6093('0x2f')]);return db[_0x6093('0x35')][_0x6093('0x13')]({'where':_0x3ec976[_0x6093('0x3c')]})[_0x6093('0x17')](function(_0x394bb7){_0x25be6c[_0x6093('0x13')]=_0x394bb7;if(_0x6f1dcb[_0x6093('0x29')][_0x6093('0x44')]){_0x3ec976[_0x6093('0x2d')]=[{'all':!![]}];}return db[_0x6093('0x35')][_0x6093('0x21')](_0x3ec976);})['then'](function(_0x345b56){_0x25be6c[_0x6093('0x45')]=_0x345b56;return _0x25be6c;});}})[_0x6093('0x17')](respondWithFilteredResult(_0x5de7a5,_0x3ec976))[_0x6093('0x24')](handleError(_0x5de7a5,null));};exports['addTags']=function(_0x5058ce,_0x1b100a){return db[_0x6093('0x1e')]['find']({'where':{'id':_0x5058ce[_0x6093('0x26')]['id']}})[_0x6093('0x17')](handleEntityNotFound(_0x1b100a,null))['then'](function(_0x3717b4){if(_0x3717b4){return _0x3717b4['setTags'](_0x5058ce[_0x6093('0x31')][_0x6093('0x36')],_['omit'](_0x5058ce[_0x6093('0x31')],['ids','id'])||{})[_0x6093('0x46')](function(){return db[_0x6093('0x47')]['findAll']({'attributes':['id',_0x6093('0x1b'),'color'],'where':{'id':_0x5058ce['body']['ids']}});})[_0x6093('0x17')](function(_0x34494e){socket[_0x6093('0x48')]('faxInteractionTags:save',{'id':Number(_0x5058ce[_0x6093('0x26')]['id']),'tags':_0x34494e||[]});return{'id':Number(_0x5058ce[_0x6093('0x26')]['id']),'tags':_0x34494e||[]};});}})['then'](respondWithResult(_0x1b100a,null))[_0x6093('0x24')](handleError(_0x1b100a,null));};exports[_0x6093('0x49')]=function(_0x4d3c23,_0x1d62a7){return db[_0x6093('0x1e')][_0x6093('0x32')]({'where':{'id':_0x4d3c23[_0x6093('0x26')]['id']}})[_0x6093('0x17')](handleEntityNotFound(_0x1d62a7,null))[_0x6093('0x17')](function(_0x3e4d77){if(_0x3e4d77){return _0x3e4d77[_0x6093('0x49')](_0x4d3c23[_0x6093('0x29')][_0x6093('0x36')]);}})[_0x6093('0x17')](respondWithStatusCode(_0x1d62a7,null))['catch'](handleError(_0x1d62a7,null));};exports[_0x6093('0x4a')]=function(_0x15aa07,_0x3944bf){var _0x5e05f8=moment()[_0x6093('0x4b')]()['toString']();var _0x57a49c=path[_0x6093('0x4c')](config['root'],'server',_0x6093('0x4d'),_0x6093('0x4e'));var _0x214779=path[_0x6093('0x4c')](config[_0x6093('0x4f')],_0x6093('0x50'),'files','attachments');var _0x434fd0=path[_0x6093('0x4c')](_0x57a49c,_0x5e05f8);var _0x22fbca=util[_0x6093('0x42')](_0x6093('0x51'),_0x15aa07['params']['id'],_0x5e05f8);var _0x2f9d94=path[_0x6093('0x4c')](_0x57a49c,_0x22fbca);var _0x37f8c7=[];_0x37f8c7[_0x6093('0x52')]({'model':db['Attachment'],'as':_0x6093('0x53'),'raw':!![]});var _0x435c91=[{'model':db[_0x6093('0x35')],'as':_0x6093('0x54'),'attributes':['id',_0x6093('0x31'),_0x6093('0x55')],'include':_0x37f8c7}];return db[_0x6093('0x1e')][_0x6093('0x32')]({'where':{'id':_0x15aa07[_0x6093('0x26')]['id']},'include':_0x435c91})[_0x6093('0x17')](handleEntityNotFound(_0x3944bf,null))['then'](function(_0x4f18c8){if(_0x4f18c8&&_0x4f18c8[_0x6093('0x54')]){var _0x2d8276=_0x4f18c8['get']({'plain':!![]});fs[_0x6093('0x56')](_0x434fd0);for(var _0x49752f=0x0;_0x49752f<_0x2d8276[_0x6093('0x54')][_0x6093('0x38')];_0x49752f++){var _0x1d4960=_0x2d8276[_0x6093('0x54')][_0x49752f][_0x6093('0x53')];if(_0x1d4960){var _0x383cae=path['join'](_0x214779,_0x1d4960['basename']);if(fs[_0x6093('0x57')](_0x383cae)){fs[_0x6093('0x58')](_0x383cae)[_0x6093('0x59')](fs[_0x6093('0x5a')](path['join'](_0x434fd0,_0x1d4960[_0x6093('0x5b')])));}}}return BPromise['resolve']()['then'](function(){return new BPromise(function(_0xea7bcc,_0x5e8696){zipdir(_0x434fd0,{'saveTo':_0x2f9d94},function(_0xf50608,_0x26fbd7){if(_0xf50608)return _0x5e8696(_0xf50608);return _0xea7bcc(_0x26fbd7);});})[_0x6093('0x17')](function(){return new BPromise(function(_0x193b82,_0x39e1f6){rimraf(_0x434fd0,function(_0x11531e){if(_0x11531e)_0x39e1f6(_0x11531e);return _0x193b82();});});})['then'](function(){return _0x3944bf[_0x6093('0x4a')](_0x2f9d94,_0x22fbca,function(_0x446cb5){if(_0x446cb5){console[_0x6093('0x5c')](_0x6093('0x5d'),_0x446cb5);}else{fs[_0x6093('0x5e')](_0x2f9d94);}});});});}else{return _0x3944bf[_0x6093('0xf')](0xc8);}})[_0x6093('0x24')](handleError(_0x3944bf,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 900fc63..e7164b9 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 _0xd9d4=['events','FaxMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook'];(function(_0x5f35b1,_0x20ce05){var _0x3a6cbe=function(_0x520046){while(--_0x520046){_0x5f35b1['push'](_0x5f35b1['shift']());}};_0x3a6cbe(++_0x20ce05);}(_0xd9d4,0x1cb));var _0x4d9d=function(_0x14e27a,_0x3b4136){_0x14e27a=_0x14e27a-0x0;var _0x288688=_0xd9d4[_0x14e27a];return _0x288688;};'use strict';var EventEmitter=require(_0x4d9d('0x0'));var FaxInteraction=require('../../mysqldb')['db']['FaxInteraction'];var FaxMessage=require('../../mysqldb')['db'][_0x4d9d('0x1')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x4d9d('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4d9d('0x3'),'afterDestroy':_0x4d9d('0x4')};function emitEvent(_0x890009){return function(_0x55cc08,_0x174464,_0xd58dc6){_0x55cc08[_0x4d9d('0x5')]({'attributes':['id'],'raw':!![]})[_0x4d9d('0x6')](function(_0x4e18dc){_0x55cc08[_0x4d9d('0x7')](_0x4d9d('0x8'),_0x4e18dc[_0x4d9d('0x9')](function(_0x3ee8cb){return{'id':_0x3ee8cb['id']};}));return FaxMessage[_0x4d9d('0xa')]({'where':{'FaxInteractionId':_0x55cc08['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4d9d('0x6')](function(_0x12e28c){_0x55cc08[_0x4d9d('0x7')](_0x4d9d('0xb'),_0x12e28c[_0x4d9d('0xc')]);FaxInteractionEvents[_0x4d9d('0xd')](_0x890009+':'+_0x55cc08['id'],_0x55cc08);FaxInteractionEvents['emit'](_0x890009,_0x55cc08);_0xd58dc6(null);})[_0x4d9d('0xe')](_0xd58dc6(null));};}for(var e in events){if(events[_0x4d9d('0xf')](e)){var event=events[e];FaxInteraction[_0x4d9d('0x10')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0xb599=['emit','catch','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xb599,0x134));var _0x9b59=function(_0x463351,_0x21d3bd){_0x463351=_0x463351-0x0;var _0x564711=_0xb599[_0x463351];return _0x564711;};'use strict';var EventEmitter=require(_0x9b59('0x0'));var FaxInteraction=require(_0x9b59('0x1'))['db'][_0x9b59('0x2')];var FaxMessage=require(_0x9b59('0x1'))['db'][_0x9b59('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x9b59('0x4')](0x0);var events={'afterCreate':_0x9b59('0x5'),'afterUpdate':'update','afterDestroy':_0x9b59('0x6')};function emitEvent(_0x768905){return function(_0xa5a2ec,_0x4d0522,_0x522f56){_0xa5a2ec[_0x9b59('0x7')]({'attributes':['id'],'raw':!![]})[_0x9b59('0x8')](function(_0x314227){_0xa5a2ec[_0x9b59('0x9')](_0x9b59('0xa'),_0x314227[_0x9b59('0xb')](function(_0x4cf6f0){return{'id':_0x4cf6f0['id']};}));return FaxMessage[_0x9b59('0xc')]({'where':{'FaxInteractionId':_0xa5a2ec['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9b59('0x8')](function(_0x8445c5){_0xa5a2ec[_0x9b59('0x9')](_0x9b59('0xd'),_0x8445c5[_0x9b59('0xe')]);FaxInteractionEvents[_0x9b59('0xf')](_0x768905+':'+_0xa5a2ec['id'],_0xa5a2ec);FaxInteractionEvents[_0x9b59('0xf')](_0x768905,_0xa5a2ec);_0x522f56(null);})[_0x9b59('0x10')](_0x522f56(null));};}for(var e in events){if(events[_0x9b59('0x11')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x9b59('0x12')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 603643e..56fea44 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 _0x3ebd=['bluebird','request-promise','path','./faxInteraction.attributes','define','FaxInteraction','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment'];(function(_0x3d22eb,_0x2dc8bb){var _0x49fd78=function(_0x236be1){while(--_0x236be1){_0x3d22eb['push'](_0x3d22eb['shift']());}};_0x49fd78(++_0x2dc8bb);}(_0x3ebd,0x121));var _0xd3eb=function(_0x69c774,_0x34797f){_0x69c774=_0x69c774-0x0;var _0x1badcd=_0x3ebd[_0x69c774];return _0x1badcd;};'use strict';var _=require(_0xd3eb('0x0'));var util=require(_0xd3eb('0x1'));var logger=require(_0xd3eb('0x2'))(_0xd3eb('0x3'));var moment=require(_0xd3eb('0x4'));var BPromise=require(_0xd3eb('0x5'));var rp=require(_0xd3eb('0x6'));var fs=require('fs');var path=require(_0xd3eb('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd3eb('0x8'));module['exports']=function(_0x47b2bb,_0x283b9d){return _0x47b2bb[_0xd3eb('0x9')](_0xd3eb('0xa'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3d9d7d,_0xced6a1,_0x22c6d0){if(_0x3d9d7d['changed'](_0xd3eb('0xb'))){_0x3d9d7d[_0xd3eb('0xc')]=moment()['format'](_0xd3eb('0xd'));}_0x22c6d0(null,_0x3d9d7d);}}});}; \ No newline at end of file +var _0xf188=['define','FaxInteraction','fax_interactions','closed','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','request-promise','path','../../config/environment','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf188,0xfd));var _0x8f18=function(_0x2e7dd0,_0x2eaf26){_0x2e7dd0=_0x2e7dd0-0x0;var _0x4aee64=_0xf188[_0x2e7dd0];return _0x4aee64;};'use strict';var _=require('lodash');var util=require(_0x8f18('0x0'));var logger=require(_0x8f18('0x1'))(_0x8f18('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8f18('0x3'));var fs=require('fs');var path=require(_0x8f18('0x4'));var rimraf=require('rimraf');var config=require(_0x8f18('0x5'));var attributes=require('./faxInteraction.attributes');module[_0x8f18('0x6')]=function(_0x1f70a3,_0x243b21){return _0x1f70a3[_0x8f18('0x7')](_0x8f18('0x8'),attributes,{'tableName':_0x8f18('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1dca1c,_0x14b643,_0x1a9046){if(_0x1dca1c['changed'](_0x8f18('0xa'))){_0x1dca1c['closedAt']=moment()[_0x8f18('0xb')](_0x8f18('0xc'));}_0x1a9046(null,_0x1dca1c);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 41d4a22..2516d0c 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 _0xd79b=['socket.io-emitter','./faxInteraction.socket','register','request','then','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','FaxInteraction,\x20%s,\x20%s','message','result','catch','body','options','raw','attributes','limit','UpdateFaxInteraction','stringify','AddTagsToFaxInteraction','FaxInteraction','find','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','redis'];(function(_0x46de65,_0x5acbd8){var _0x2cbe89=function(_0x8c4748){while(--_0x8c4748){_0x46de65['push'](_0x46de65['shift']());}};_0x2cbe89(++_0x5acbd8);}(_0xd79b,0x11e));var _0xbd79=function(_0x6957ed,_0x4978d0){_0x6957ed=_0x6957ed-0x0;var _0x5df843=_0xd79b[_0x6957ed];return _0x5df843;};'use strict';var _=require(_0xbd79('0x0'));var util=require(_0xbd79('0x1'));var moment=require(_0xbd79('0x2'));var BPromise=require('bluebird');var rs=require(_0xbd79('0x3'));var fs=require('fs');var Redis=require(_0xbd79('0x4'));var db=require(_0xbd79('0x5'))['db'];var utils=require(_0xbd79('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xbd79('0x7'));var client=jayson[_0xbd79('0x8')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xbd79('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xbd79('0xa'))(new Redis(config['redis']));require(_0xbd79('0xb'))[_0xbd79('0xc')](socket);function respondWithRpcPromise(_0x42aedb,_0x347a51,_0x319a8e){return new BPromise(function(_0x579f8c,_0x13f327){return client[_0xbd79('0xd')](_0x42aedb,_0x319a8e)[_0xbd79('0xe')](function(_0x3e90bf){logger[_0xbd79('0xf')]('FaxInteraction,\x20%s,\x20%s',_0x347a51,_0xbd79('0x10'));logger[_0xbd79('0x11')](_0xbd79('0x12'),_0x347a51,'request\x20sent',JSON['stringify'](_0x3e90bf));if(_0x3e90bf[_0xbd79('0x13')]){if(_0x3e90bf['error']['code']===0x1f4){logger[_0xbd79('0x13')](_0xbd79('0x14'),_0x347a51,_0x3e90bf['error'][_0xbd79('0x15')]);return _0x13f327(_0x3e90bf[_0xbd79('0x13')][_0xbd79('0x15')]);}logger[_0xbd79('0x13')]('FaxInteraction,\x20%s,\x20%s',_0x347a51,_0x3e90bf[_0xbd79('0x13')][_0xbd79('0x15')]);return _0x579f8c(_0x3e90bf[_0xbd79('0x13')]['message']);}else{logger['info'](_0xbd79('0x14'),_0x347a51,_0xbd79('0x10'));_0x579f8c(_0x3e90bf[_0xbd79('0x16')][_0xbd79('0x15')]);}})[_0xbd79('0x17')](function(_0x4ad742){logger[_0xbd79('0x13')](_0xbd79('0x14'),_0x347a51,_0x4ad742);_0x13f327(_0x4ad742);});});}exports['UpdateFaxInteraction']=function(_0x2f1d43){var _0x4a2fb5=this;return new Promise(function(_0x5bfd41,_0x1fb3fd){return db['FaxInteraction']['update'](_0x2f1d43[_0xbd79('0x18')],{'raw':_0x2f1d43['options']?_0x2f1d43[_0xbd79('0x19')][_0xbd79('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f1d43[_0xbd79('0x19')]?_0x2f1d43[_0xbd79('0x19')]['where']||null:null,'attributes':_0x2f1d43['options']?_0x2f1d43['options'][_0xbd79('0x1b')]||null:null,'limit':_0x2f1d43[_0xbd79('0x19')]?_0x2f1d43['options'][_0xbd79('0x1c')]||null:null})['then'](function(_0x447309){logger[_0xbd79('0xf')](_0xbd79('0x1d'),_0x2f1d43);logger[_0xbd79('0x11')](_0xbd79('0x1d'),_0x2f1d43,JSON[_0xbd79('0x1e')](_0x447309));_0x5bfd41(_0x447309);})['catch'](function(_0x1dbbea){logger[_0xbd79('0x13')]('UpdateFaxInteraction',_0x1dbbea[_0xbd79('0x15')],_0x2f1d43);_0x1fb3fd(_0x4a2fb5[_0xbd79('0x13')](0x1f4,_0x1dbbea[_0xbd79('0x15')]));});});};exports[_0xbd79('0x1f')]=function(_0x241eb0){return new Promise(function(_0x33d689,_0xe2bc5f){return db[_0xbd79('0x20')][_0xbd79('0x21')]({'where':_0x241eb0['options']?_0x241eb0[_0xbd79('0x19')]['where']||null:null})[_0xbd79('0xe')](function(_0x77fd83){if(_0x77fd83){return _0x77fd83['addTags'](_0x241eb0[_0xbd79('0x18')][_0xbd79('0x22')],_['omit'](_0x241eb0[_0xbd79('0x18')],[_0xbd79('0x22'),'id'])||{});}})[_0xbd79('0x23')](function(_0x37d070){logger['info'](_0xbd79('0x24'),_0x241eb0);logger['debug'](_0xbd79('0x24'),_0x241eb0,JSON['stringify'](_0x37d070));_0x33d689(_0x37d070);})['catch'](function(_0x2cc857){logger[_0xbd79('0x13')](_0xbd79('0x24'),_0x2cc857['message'],_0x241eb0);_0xe2bc5f(_this[_0xbd79('0x13')](0x1f4,_0x2cc857[_0xbd79('0x15')]));});});}; \ No newline at end of file +var _0xa0ea=['debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateFaxInteraction','update','body','options','raw','where','attributes','limit','catch','FaxInteraction','addTags','omit','ids','spread','AddTags','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','./faxInteraction.socket','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent'];(function(_0x11f4db,_0x398e9e){var _0x17ee80=function(_0x16223e){while(--_0x16223e){_0x11f4db['push'](_0x11f4db['shift']());}};_0x17ee80(++_0x398e9e);}(_0xa0ea,0x68));var _0xaa0e=function(_0x4eec9b,_0x4aea09){_0x4eec9b=_0x4eec9b-0x0;var _0x2e3849=_0xa0ea[_0x4eec9b];return _0x2e3849;};'use strict';var _=require(_0xaa0e('0x0'));var util=require(_0xaa0e('0x1'));var moment=require('moment');var BPromise=require(_0xaa0e('0x2'));var rs=require(_0xaa0e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa0e('0x4'))['db'];var utils=require(_0xaa0e('0x5'));var logger=require(_0xaa0e('0x6'))(_0xaa0e('0x7'));var config=require('../../config/environment');var jayson=require(_0xaa0e('0x8'));var client=jayson[_0xaa0e('0x9')][_0xaa0e('0xa')]({'port':0x232a});config[_0xaa0e('0xb')]=_['defaults'](config['redis'],{'host':_0xaa0e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaa0e('0xb')]));require(_0xaa0e('0xd'))['register'](socket);function respondWithRpcPromise(_0x1a8975,_0x440d0b,_0x573999){return new BPromise(function(_0x1c2b3b,_0x3fdd07){return client[_0xaa0e('0xe')](_0x1a8975,_0x573999)[_0xaa0e('0xf')](function(_0x21704d){logger[_0xaa0e('0x10')](_0xaa0e('0x11'),_0x440d0b,_0xaa0e('0x12'));logger[_0xaa0e('0x13')](_0xaa0e('0x14'),_0x440d0b,_0xaa0e('0x12'),JSON[_0xaa0e('0x15')](_0x21704d));if(_0x21704d[_0xaa0e('0x16')]){if(_0x21704d[_0xaa0e('0x16')][_0xaa0e('0x17')]===0x1f4){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x440d0b,_0x21704d['error'][_0xaa0e('0x18')]);return _0x3fdd07(_0x21704d['error']['message']);}logger[_0xaa0e('0x16')](_0xaa0e('0x11'),_0x440d0b,_0x21704d[_0xaa0e('0x16')]['message']);return _0x1c2b3b(_0x21704d[_0xaa0e('0x16')][_0xaa0e('0x18')]);}else{logger[_0xaa0e('0x10')]('FaxInteraction,\x20%s,\x20%s',_0x440d0b,'request\x20sent');_0x1c2b3b(_0x21704d[_0xaa0e('0x19')][_0xaa0e('0x18')]);}})['catch'](function(_0x2127dd){logger[_0xaa0e('0x16')](_0xaa0e('0x11'),_0x440d0b,_0x2127dd);_0x3fdd07(_0x2127dd);});});}exports[_0xaa0e('0x1a')]=function(_0x2a09ec){var _0x71468c=this;return new Promise(function(_0x367edd,_0x714c33){return db['FaxInteraction'][_0xaa0e('0x1b')](_0x2a09ec[_0xaa0e('0x1c')],{'raw':_0x2a09ec[_0xaa0e('0x1d')]?_0x2a09ec['options'][_0xaa0e('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a09ec['options']?_0x2a09ec[_0xaa0e('0x1d')][_0xaa0e('0x1f')]||null:null,'attributes':_0x2a09ec['options']?_0x2a09ec[_0xaa0e('0x1d')][_0xaa0e('0x20')]||null:null,'limit':_0x2a09ec[_0xaa0e('0x1d')]?_0x2a09ec[_0xaa0e('0x1d')][_0xaa0e('0x21')]||null:null})[_0xaa0e('0xf')](function(_0x533dad){logger[_0xaa0e('0x10')]('UpdateFaxInteraction',_0x2a09ec);logger[_0xaa0e('0x13')](_0xaa0e('0x1a'),_0x2a09ec,JSON[_0xaa0e('0x15')](_0x533dad));_0x367edd(_0x533dad);})[_0xaa0e('0x22')](function(_0x2ab488){logger[_0xaa0e('0x16')](_0xaa0e('0x1a'),_0x2ab488[_0xaa0e('0x18')],_0x2a09ec);_0x714c33(_0x71468c[_0xaa0e('0x16')](0x1f4,_0x2ab488[_0xaa0e('0x18')]));});});};exports['AddTagsToFaxInteraction']=function(_0x2ba0a3){return new Promise(function(_0x21b1b4,_0x375bdf){return db[_0xaa0e('0x23')]['find']({'where':_0x2ba0a3[_0xaa0e('0x1d')]?_0x2ba0a3[_0xaa0e('0x1d')][_0xaa0e('0x1f')]||null:null})['then'](function(_0x87fe7f){if(_0x87fe7f){return _0x87fe7f[_0xaa0e('0x24')](_0x2ba0a3[_0xaa0e('0x1c')]['ids'],_[_0xaa0e('0x25')](_0x2ba0a3[_0xaa0e('0x1c')],[_0xaa0e('0x26'),'id'])||{});}})[_0xaa0e('0x27')](function(_0x10bbef){logger['info'](_0xaa0e('0x28'),_0x2ba0a3);logger[_0xaa0e('0x13')](_0xaa0e('0x28'),_0x2ba0a3,JSON[_0xaa0e('0x15')](_0x10bbef));_0x21b1b4(_0x10bbef);})[_0xaa0e('0x22')](function(_0x5a69fc){logger[_0xaa0e('0x16')]('AddTags',_0x5a69fc[_0xaa0e('0x18')],_0x2ba0a3);_0x375bdf(_this['error'](0x1f4,_0x5a69fc[_0xaa0e('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 4069f88..fa3cc88 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 _0xa8c4=['remove','update','emit','removeListener','length','./faxInteraction.events','save'];(function(_0x2496bd,_0x562afa){var _0x39d75f=function(_0x32bb12){while(--_0x32bb12){_0x2496bd['push'](_0x2496bd['shift']());}};_0x39d75f(++_0x562afa);}(_0xa8c4,0x10f));var _0x4a8c=function(_0x1dc725,_0x4b120b){_0x1dc725=_0x1dc725-0x0;var _0x3b9b63=_0xa8c4[_0x1dc725];return _0x3b9b63;};'use strict';var FaxInteractionEvents=require(_0x4a8c('0x0'));var events=[_0x4a8c('0x1'),_0x4a8c('0x2'),_0x4a8c('0x3')];function createListener(_0x4be3ae,_0x4b96a2){return function(_0x382b9c){_0x4b96a2[_0x4a8c('0x4')](_0x4be3ae,_0x382b9c);};}function removeListener(_0x5000e7,_0x7e9a0f){return function(){FaxInteractionEvents[_0x4a8c('0x5')](_0x5000e7,_0x7e9a0f);};}exports['register']=function(_0x4d3b99){for(var _0x474149=0x0,_0xe6f497=events[_0x4a8c('0x6')];_0x474149<_0xe6f497;_0x474149++){var _0x32b882=events[_0x474149];var _0x5817d4=createListener('faxInteraction:'+_0x32b882,_0x4d3b99);FaxInteractionEvents['on'](_0x32b882,_0x5817d4);}}; \ No newline at end of file +var _0x0e8c=['removeListener','register','length','save'];(function(_0x557f28,_0xc7a5a6){var _0x2ffa93=function(_0x57abe2){while(--_0x57abe2){_0x557f28['push'](_0x557f28['shift']());}};_0x2ffa93(++_0xc7a5a6);}(_0x0e8c,0xfb));var _0xc0e8=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x0e8c[_0x17d9e3];return _0x14192d;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0xc0e8('0x0'),'remove','update'];function createListener(_0x172ce0,_0x480f52){return function(_0x26239f){_0x480f52['emit'](_0x172ce0,_0x26239f);};}function removeListener(_0x55976c,_0x50eb2e){return function(){FaxInteractionEvents[_0xc0e8('0x1')](_0x55976c,_0x50eb2e);};}exports[_0xc0e8('0x2')]=function(_0x16a46b){for(var _0x4fb397=0x0,_0x4e61f4=events[_0xc0e8('0x3')];_0x4fb397<_0x4e61f4;_0x4fb397++){var _0x50292b=events[_0x4fb397];var _0x21e443=createListener('faxInteraction:'+_0x50292b,_0x16a46b);FaxInteractionEvents['on'](_0x50292b,_0x21e443);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 7149195..bafb389 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 _0x3f33=['isAuthenticated','describe','/:id','/:id/messages','getMessages','/:id/download','post','create','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe'];(function(_0x383118,_0x140cd7){var _0x55a99e=function(_0x3a866b){while(--_0x3a866b){_0x383118['push'](_0x383118['shift']());}};_0x55a99e(++_0x140cd7);}(_0x3f33,0x6f));var _0x33f3=function(_0x5eff86,_0x2cdd22){_0x5eff86=_0x5eff86-0x0;var _0x4b3010=_0x3f33[_0x5eff86];return _0x4b3010;};'use strict';var multer=require(_0x33f3('0x0'));var util=require('util');var path=require(_0x33f3('0x1'));var timeout=require(_0x33f3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x33f3('0x3'));var auth=require(_0x33f3('0x4'));var interaction=require(_0x33f3('0x5'));var config=require(_0x33f3('0x6'));var controller=require('./faxInteraction.controller');router[_0x33f3('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x33f3('0x7')](_0x33f3('0x8'),auth[_0x33f3('0x9')](),controller[_0x33f3('0xa')]);router[_0x33f3('0x7')](_0x33f3('0xb'),auth[_0x33f3('0x9')](),controller['show']);router['get'](_0x33f3('0xc'),auth[_0x33f3('0x9')](),controller[_0x33f3('0xd')]);router['get'](_0x33f3('0xe'),auth[_0x33f3('0x9')](),controller['download']);router[_0x33f3('0xf')]('/',auth['isAuthenticated'](),controller[_0x33f3('0x10')]);router[_0x33f3('0xf')](_0x33f3('0xc'),auth[_0x33f3('0x9')](),controller['addMessage']);router[_0x33f3('0xf')](_0x33f3('0x11'),auth[_0x33f3('0x9')](),interaction[_0x33f3('0x12')](_0x33f3('0x13'),_0x33f3('0x14')),controller[_0x33f3('0x15')]);router[_0x33f3('0x16')](_0x33f3('0xb'),auth[_0x33f3('0x9')](),interaction[_0x33f3('0x12')](_0x33f3('0x13'),_0x33f3('0x17')),controller[_0x33f3('0x18')]);router[_0x33f3('0x19')](_0x33f3('0xb'),auth['isAuthenticated'](),interaction['tracked'](_0x33f3('0x13'),_0x33f3('0x1a')),controller[_0x33f3('0x1b')]);router[_0x33f3('0x19')]('/:id/tags',auth[_0x33f3('0x9')](),controller[_0x33f3('0x1c')]);module[_0x33f3('0x1d')]=router; \ No newline at end of file +var _0x0eee=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/messages','getMessages','/:id/download','post','create','/:id/tags','fax','faxinteraction:addtags','addTags','tracked','faxinteraction:update','delete','destroy','removeTags','exports','util','path','connect-timeout','express','fs-extra'];(function(_0x288684,_0x42572a){var _0x444bc0=function(_0x39a7fc){while(--_0x39a7fc){_0x288684['push'](_0x288684['shift']());}};_0x444bc0(++_0x42572a);}(_0x0eee,0x96));var _0xe0ee=function(_0xe8129c,_0x2fb03c){_0xe8129c=_0xe8129c-0x0;var _0x709fc5=_0x0eee[_0xe8129c];return _0x709fc5;};'use strict';var multer=require('multer');var util=require(_0xe0ee('0x0'));var path=require(_0xe0ee('0x1'));var timeout=require(_0xe0ee('0x2'));var express=require(_0xe0ee('0x3'));var router=express['Router']();var fs_extra=require(_0xe0ee('0x4'));var auth=require(_0xe0ee('0x5'));var interaction=require(_0xe0ee('0x6'));var config=require(_0xe0ee('0x7'));var controller=require(_0xe0ee('0x8'));router['get']('/',auth[_0xe0ee('0x9')](),controller[_0xe0ee('0xa')]);router['get'](_0xe0ee('0xb'),auth[_0xe0ee('0x9')](),controller[_0xe0ee('0xc')]);router[_0xe0ee('0xd')](_0xe0ee('0xe'),auth[_0xe0ee('0x9')](),controller[_0xe0ee('0xf')]);router['get'](_0xe0ee('0x10'),auth['isAuthenticated'](),controller[_0xe0ee('0x11')]);router['get'](_0xe0ee('0x12'),auth[_0xe0ee('0x9')](),controller['download']);router[_0xe0ee('0x13')]('/',auth[_0xe0ee('0x9')](),controller[_0xe0ee('0x14')]);router[_0xe0ee('0x13')](_0xe0ee('0x10'),auth['isAuthenticated'](),controller['addMessage']);router[_0xe0ee('0x13')](_0xe0ee('0x15'),auth['isAuthenticated'](),interaction['tracked'](_0xe0ee('0x16'),_0xe0ee('0x17')),controller[_0xe0ee('0x18')]);router['put'](_0xe0ee('0xe'),auth[_0xe0ee('0x9')](),interaction[_0xe0ee('0x19')](_0xe0ee('0x16'),_0xe0ee('0x1a')),controller['update']);router[_0xe0ee('0x1b')](_0xe0ee('0xe'),auth['isAuthenticated'](),interaction[_0xe0ee('0x19')]('fax','faxinteraction:destroy'),controller[_0xe0ee('0x1c')]);router['delete']('/:id/tags',auth[_0xe0ee('0x9')](),controller[_0xe0ee('0x1d')]);module[_0xe0ee('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index a9bc3c9..bef112e 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 _0xc6d8=['sequelize','TEXT','BOOLEAN','out','DATE'];(function(_0x3c2c2a,_0x2bce72){var _0xf1156b=function(_0x2d874e){while(--_0x2d874e){_0x3c2c2a['push'](_0x3c2c2a['shift']());}};_0xf1156b(++_0x2bce72);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0xc6d8[_0x25d386];return _0x857f4a;};'use strict';var Sequelize=require(_0x8c6d('0x0'));module['exports']={'body':{'type':Sequelize[_0x8c6d('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x8c6d('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x8c6d('0x3')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x8c6d('0x4')]}}; \ No newline at end of file +var _0x8388=['TEXT','medium','ENUM','out','DATE','sequelize','exports'];(function(_0x2d0486,_0xce2c63){var _0x114e2a=function(_0x2b95e3){while(--_0x2b95e3){_0x2d0486['push'](_0x2d0486['shift']());}};_0x114e2a(++_0xce2c63);}(_0x8388,0x18d));var _0x8838=function(_0x10d34b,_0x4fef76){_0x10d34b=_0x10d34b-0x0;var _0x92b0bf=_0x8388[_0x10d34b];return _0x92b0bf;};'use strict';var Sequelize=require(_0x8838('0x0'));module[_0x8838('0x1')]={'body':{'type':Sequelize[_0x8838('0x2')](_0x8838('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x8838('0x4')]('in',_0x8838('0x5')),'defaultValue':_0x8838('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x8838('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x8838('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 7a93f89..e5e871d 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 _0x7377=['get','FaxInteraction','FaxInteractionId','read1stAt','format','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','User','agent','fullname','email','manual','SIP/%s','channel','motionChannel','event','EventManager','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','sequelize','contact','internal','rejectmessage','create','CmContact','isNil','Attachment','findOne','AttachmentId','SendFax','FaxAccountId','basename','join','root','server','files','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','stack','name','send','index','map','FaxMessage','rawAttributes','model','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','filter','type','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','keys','length','include','find','body','destroy','describe','accept','fax','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId'];(function(_0x5f4cd7,_0x459c44){var _0x47c93f=function(_0x11f384){while(--_0x11f384){_0x5f4cd7['push'](_0x5f4cd7['shift']());}};_0x47c93f(++_0x459c44);}(_0x7377,0xb8));var _0x7737=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0x7377[_0x9aada2];return _0x196dff;};'use strict';var emlformat=require(_0x7737('0x0'));var rimraf=require(_0x7737('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7737('0x2'));var rp=require('request-promise');var moment=require(_0x7737('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7737('0x4'));var util=require(_0x7737('0x5'));var path=require(_0x7737('0x6'));var sox=require(_0x7737('0x7'));var csv=require(_0x7737('0x8'));var ejs=require(_0x7737('0x9'));var fs=require('fs');var fs_extra=require(_0x7737('0xa'));var _=require('lodash');var squel=require(_0x7737('0xb'));var crypto=require(_0x7737('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7737('0x8'));var querystring=require(_0x7737('0xd'));var Papa=require(_0x7737('0xe'));var Redis=require(_0x7737('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7737('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7737('0x11'));var logger=require(_0x7737('0x12'))(_0x7737('0x13'));var utils=require(_0x7737('0x14'));var config=require(_0x7737('0x15'));var licenseUtil=require(_0x7737('0x16'));var db=require(_0x7737('0x17'))['db'];config[_0x7737('0x18')]=_[_0x7737('0x19')](config['redis'],{'host':_0x7737('0x1a'),'port':0x18eb});var socket=require(_0x7737('0x1b'))(new Redis(config['redis']));require(_0x7737('0x1c'))[_0x7737('0x1d')](socket);var jayson=require(_0x7737('0x1e'));var client=jayson[_0x7737('0x1f')][_0x7737('0x20')]({'port':0x232c});var client9002=jayson['client'][_0x7737('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x50a2a7,_0x3adc87,_0x1300e5,_0x16ead1){return new BPromise(function(_0x44be8e,_0x306577){var _0x3ed88f=_0x16ead1||client;return _0x3ed88f[_0x7737('0x21')](_0x50a2a7,_0x1300e5)[_0x7737('0x22')](function(_0x418d90){logger[_0x7737('0x23')]('FaxMessage,\x20%s,\x20%s',_0x3adc87,_0x7737('0x24'));logger[_0x7737('0x25')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x3adc87,_0x7737('0x24'),JSON[_0x7737('0x26')](_0x418d90));if(_0x418d90['error']){if(_0x418d90[_0x7737('0x27')][_0x7737('0x28')]===0x1f4){logger['error'](_0x7737('0x29'),_0x3adc87,_0x418d90[_0x7737('0x27')][_0x7737('0x2a')]);return _0x306577(_0x418d90[_0x7737('0x27')][_0x7737('0x2a')]);}logger[_0x7737('0x27')]('FaxMessage,\x20%s,\x20%s',_0x3adc87,_0x418d90[_0x7737('0x27')][_0x7737('0x2a')]);return _0x44be8e(_0x418d90[_0x7737('0x27')][_0x7737('0x2a')]);}else{logger[_0x7737('0x23')](_0x7737('0x29'),_0x3adc87,_0x7737('0x24'));_0x44be8e(_0x418d90[_0x7737('0x2b')][_0x7737('0x2a')]);}})['catch'](function(_0x275207){logger[_0x7737('0x27')](_0x7737('0x29'),_0x3adc87,_0x275207);_0x306577(_0x275207);});});}function respondWithStatusCode(_0x23fc9b,_0x1d8921){_0x1d8921=_0x1d8921||0xcc;return function(_0x1b80f6){if(_0x1b80f6){return _0x23fc9b[_0x7737('0x2c')](_0x1d8921);}return _0x23fc9b[_0x7737('0x2d')](_0x1d8921)[_0x7737('0x2e')]();};}function respondWithResult(_0x51db43,_0xdde44d){_0xdde44d=_0xdde44d||0xc8;return function(_0x58ec50){if(_0x58ec50){return _0x51db43['status'](_0xdde44d)[_0x7737('0x2f')](_0x58ec50);}};}function respondWithFilteredResult(_0x5b9b33,_0x47000f){return function(_0xa4a982){if(_0xa4a982){var _0x55b716=typeof _0x47000f[_0x7737('0x30')]===_0x7737('0x31')&&typeof _0x47000f[_0x7737('0x32')]===_0x7737('0x31');var _0x4b2b18=_0xa4a982[_0x7737('0x33')];var _0x1f17a5=_0x55b716?0x0:_0x47000f[_0x7737('0x30')];var _0x29ed87=_0x55b716?_0xa4a982[_0x7737('0x33')]:_0x47000f[_0x7737('0x30')]+_0x47000f[_0x7737('0x32')];var _0xa1d97;if(_0x29ed87>=_0x4b2b18){_0x29ed87=_0x4b2b18;_0xa1d97=0xc8;}else{_0xa1d97=0xce;}_0x5b9b33['status'](_0xa1d97);return _0x5b9b33[_0x7737('0x34')](_0x7737('0x35'),_0x1f17a5+'-'+_0x29ed87+'/'+_0x4b2b18)[_0x7737('0x2f')](_0xa4a982);}return null;};}function patchUpdates(_0x2e3d3c){return function(_0x343e1a){try{jsonpatch[_0x7737('0x36')](_0x343e1a,_0x2e3d3c,!![]);}catch(_0x1994fa){return BPromise[_0x7737('0x37')](_0x1994fa);}return _0x343e1a['save']();};}function saveUpdates(_0x3b8306,_0x2fd02d){return function(_0x1544df){if(_0x1544df){return _0x1544df['update'](_0x3b8306)[_0x7737('0x22')](function(_0x496a56){return _0x496a56;});}return null;};}function removeEntity(_0x3e9196,_0x5a8dc9){return function(_0x52a7f4){if(_0x52a7f4){return _0x52a7f4['destroy']()['then'](function(){_0x3e9196['status'](0xcc)[_0x7737('0x2e')]();});}};}function handleEntityNotFound(_0x1c5273,_0x445f12){return function(_0x173efc){if(!_0x173efc){_0x1c5273['sendStatus'](0x194);}return _0x173efc;};}function handleError(_0x331c76,_0x261de8){_0x261de8=_0x261de8||0x1f4;return function(_0x4cb649){logger[_0x7737('0x27')](_0x4cb649[_0x7737('0x38')]);if(_0x4cb649[_0x7737('0x39')]){delete _0x4cb649['name'];}_0x331c76['status'](_0x261de8)[_0x7737('0x3a')](_0x4cb649);};}exports[_0x7737('0x3b')]=function(_0x19fab5,_0x216ead){var _0x1873fc={},_0x59addc={},_0x5d67b2={'count':0x0,'rows':[]};var _0xe7c5e3=_[_0x7737('0x3c')](db[_0x7737('0x3d')][_0x7737('0x3e')],function(_0x1ffa2e){return{'name':_0x1ffa2e['fieldName'],'type':_0x1ffa2e['type']['key']};});_0x59addc[_0x7737('0x3f')]=_['map'](_0xe7c5e3,_0x7737('0x39'));_0x59addc['query']=_['keys'](_0x19fab5[_0x7737('0x40')]);_0x59addc[_0x7737('0x41')]=_['intersection'](_0x59addc[_0x7737('0x3f')],_0x59addc[_0x7737('0x40')]);_0x1873fc['attributes']=_[_0x7737('0x42')](_0x59addc['model'],qs[_0x7737('0x43')](_0x19fab5[_0x7737('0x40')][_0x7737('0x43')]));_0x1873fc[_0x7737('0x44')]=_0x1873fc[_0x7737('0x44')]['length']?_0x1873fc[_0x7737('0x44')]:_0x59addc['model'];if(!_0x19fab5[_0x7737('0x40')][_0x7737('0x45')]('nolimit')){_0x1873fc[_0x7737('0x32')]=qs[_0x7737('0x32')](_0x19fab5[_0x7737('0x40')][_0x7737('0x32')]);_0x1873fc[_0x7737('0x30')]=qs[_0x7737('0x30')](_0x19fab5[_0x7737('0x40')]['offset']);}_0x1873fc[_0x7737('0x46')]=qs['sort'](_0x19fab5[_0x7737('0x40')][_0x7737('0x47')]);_0x1873fc[_0x7737('0x48')]=qs[_0x7737('0x41')](_['pick'](_0x19fab5[_0x7737('0x40')],_0x59addc[_0x7737('0x41')]),_0xe7c5e3);if(_0x19fab5['query'][_0x7737('0x49')]){_0x1873fc[_0x7737('0x48')]=_['merge'](_0x1873fc[_0x7737('0x48')],{'$or':_[_0x7737('0x3c')](_0xe7c5e3,function(_0x3c93ed){if(_0x3c93ed[_0x7737('0x4a')]!==_0x7737('0x4b')){var _0x423888={};_0x423888[_0x3c93ed['name']]={'$like':'%'+_0x19fab5[_0x7737('0x40')][_0x7737('0x49')]+'%'};return _0x423888;}})});}_0x1873fc=_[_0x7737('0x4c')]({},_0x1873fc,_0x19fab5[_0x7737('0x4d')]);var _0x4b0110={'where':_0x1873fc[_0x7737('0x48')]};return db[_0x7737('0x3d')][_0x7737('0x33')](_0x4b0110)['then'](function(_0x27b8a0){_0x5d67b2[_0x7737('0x33')]=_0x27b8a0;if(_0x19fab5[_0x7737('0x40')][_0x7737('0x4e')]){_0x1873fc['include']=[{'all':!![]}];}return db[_0x7737('0x3d')][_0x7737('0x4f')](_0x1873fc);})[_0x7737('0x22')](function(_0x7d2974){_0x5d67b2[_0x7737('0x50')]=_0x7d2974;return _0x5d67b2;})[_0x7737('0x22')](respondWithFilteredResult(_0x216ead,_0x1873fc))[_0x7737('0x51')](handleError(_0x216ead,null));};exports[_0x7737('0x52')]=function(_0xa16d3e,_0x3db798){var _0x3ec3ca={'raw':!![],'where':{'id':_0xa16d3e[_0x7737('0x53')]['id']}},_0x118aeb={};_0x118aeb[_0x7737('0x3f')]=_[_0x7737('0x54')](db[_0x7737('0x3d')]['rawAttributes']);_0x118aeb['query']=_[_0x7737('0x54')](_0xa16d3e[_0x7737('0x40')]);_0x118aeb[_0x7737('0x41')]=_['intersection'](_0x118aeb[_0x7737('0x3f')],_0x118aeb[_0x7737('0x40')]);_0x3ec3ca[_0x7737('0x44')]=_['intersection'](_0x118aeb[_0x7737('0x3f')],qs['fields'](_0xa16d3e['query'][_0x7737('0x43')]));_0x3ec3ca[_0x7737('0x44')]=_0x3ec3ca[_0x7737('0x44')][_0x7737('0x55')]?_0x3ec3ca['attributes']:_0x118aeb[_0x7737('0x3f')];if(_0xa16d3e[_0x7737('0x40')][_0x7737('0x4e')]){_0x3ec3ca[_0x7737('0x56')]=[{'all':!![]}];}_0x3ec3ca=_[_0x7737('0x4c')]({},_0x3ec3ca,_0xa16d3e['options']);return db[_0x7737('0x3d')][_0x7737('0x57')](_0x3ec3ca)[_0x7737('0x22')](handleEntityNotFound(_0x3db798,null))[_0x7737('0x22')](respondWithResult(_0x3db798,null))[_0x7737('0x51')](handleError(_0x3db798,null));};exports['update']=function(_0x14da70,_0x6afbd8){if(_0x14da70[_0x7737('0x58')]['id']){delete _0x14da70[_0x7737('0x58')]['id'];}return db[_0x7737('0x3d')][_0x7737('0x57')]({'where':{'id':_0x14da70[_0x7737('0x53')]['id']}})[_0x7737('0x22')](handleEntityNotFound(_0x6afbd8,null))[_0x7737('0x22')](saveUpdates(_0x14da70[_0x7737('0x58')],null))[_0x7737('0x22')](respondWithResult(_0x6afbd8,null))[_0x7737('0x51')](handleError(_0x6afbd8,null));};exports[_0x7737('0x59')]=function(_0x13985a,_0x88044b){return db['FaxMessage'][_0x7737('0x57')]({'where':{'id':_0x13985a[_0x7737('0x53')]['id']}})[_0x7737('0x22')](handleEntityNotFound(_0x88044b,null))['then'](removeEntity(_0x88044b,null))[_0x7737('0x51')](handleError(_0x88044b,null));};exports[_0x7737('0x5a')]=function(_0x200a7f,_0x499410){return db[_0x7737('0x3d')][_0x7737('0x5a')]()[_0x7737('0x22')](respondWithResult(_0x499410,null))[_0x7737('0x51')](handleError(_0x499410,null));};var interaction_log=require(_0x7737('0x12'))('fax-interactions');exports[_0x7737('0x5b')]=function(_0x6c5d33,_0x2226bb,_0x15409c){var _0x559b65={'agent':{},'channel':_0x7737('0x5c')};if(_0x6c5d33[_0x7737('0x58')]['id']){delete _0x6c5d33['body']['id'];}_0x6c5d33['body']['read']=!![];_0x6c5d33['body'][_0x7737('0x5d')]=moment()['format'](_0x7737('0x5e'));_0x6c5d33[_0x7737('0x58')][_0x7737('0x5f')]=_0x6c5d33[_0x7737('0x58')][_0x7737('0x5f')]||_0x6c5d33['user']['id'];_0x559b65['agent']['id']=_0x6c5d33[_0x7737('0x58')]['UserId'];return db['FaxMessage'][_0x7737('0x57')]({'where':{'id':_0x6c5d33[_0x7737('0x53')]['id'],'UserId':null}})[_0x7737('0x22')](handleEntityNotFound(_0x2226bb,null))[_0x7737('0x22')](saveUpdates(_0x6c5d33['body'],null))[_0x7737('0x22')](function(_0x15d1b3){if(_0x15d1b3){_0x559b65[_0x7737('0x2a')]=_0x15d1b3[_0x7737('0x60')]({'plain':!![]});return db[_0x7737('0x61')][_0x7737('0x57')]({'where':{'id':_0x15d1b3[_0x7737('0x62')]}});}return null;})[_0x7737('0x22')](handleEntityNotFound(_0x2226bb,null))[_0x7737('0x22')](function(_0x286fae){if(_0x286fae){return _0x286fae['update']({'UserId':_0x6c5d33[_0x7737('0x58')][_0x7737('0x5f')],'read1stAt':_['isNil'](_0x286fae[_0x7737('0x63')])?moment()[_0x7737('0x64')](_0x7737('0x5e')):undefined});}return null;})[_0x7737('0x22')](function(_0xd3893f){if(_0xd3893f){_0x559b65[_0x7737('0x65')]=_0xd3893f[_0x7737('0x60')]({'plain':!![]});interaction_log['info'](_0x7737('0x66'),_0x6c5d33['user']['id'],_0x6c5d33[_0x7737('0x67')][_0x7737('0x39')],_0x6c5d33[_0x7737('0x67')]['role'],_0x559b65[_0x7737('0x65')]['id'],_0x6c5d33[_0x7737('0x58')]?JSON[_0x7737('0x26')](_0x6c5d33['body']):'null');return respondWithRpcPromise('AcceptMessage',_0x7737('0x68'),_0x559b65);}return null;})['then'](function(_0x56f2c5){var _0x5c442e=_0x7737('0x69')+_0x56f2c5[_0x7737('0x2a')][_0x7737('0x6a')];return db['sequelize'][_0x7737('0x40')](_0x5c442e,{'type':db[_0x7737('0x6b')][_0x7737('0x6c')][_0x7737('0x6d')],'raw':!![]})[_0x7737('0x22')](function(_0x9f4238){return _0x9f4238;});})[_0x7737('0x22')](function(_0x11dc65){if(_0x11dc65){_0x559b65[_0x7737('0x2a')]['contact']=_0x11dc65[0x0];if(!_0x6c5d33[_0x7737('0x58')]['UserId'])return;return db[_0x7737('0x6e')][_0x7737('0x57')]({'where':{'id':_0x6c5d33['body']['UserId'],'role':_0x7737('0x6f')},'attributes':['id','name',_0x7737('0x70'),_0x7737('0x71'),'internal'],'raw':!![]});}return null;})[_0x7737('0x22')](function(_0x4bdf89){if(!_0x4bdf89)return null;_0x559b65[_0x7737('0x2a')][_0x7737('0x6f')]=_0x4bdf89;return _0x559b65;})[_0x7737('0x22')](function(_0x2f675c){if(_0x2f675c){if(_0x6c5d33['body'][_0x7737('0x72')]){_0x559b65[_0x7737('0x2a')]['interface']=util[_0x7737('0x64')](_0x7737('0x73'),_0x6c5d33[_0x7737('0x67')]['name']);_0x559b65[_0x7737('0x2a')]['channel']=_0x559b65[_0x7737('0x74')];_0x559b65[_0x7737('0x2a')][_0x7737('0x75')]=_0x559b65[_0x7737('0x74')];_0x559b65[_0x7737('0x2a')][_0x7737('0x76')]=_0x7737('0x5b');return respondWithRpcPromise(_0x7737('0x77'),_0x7737('0x77'),{'event':'acceptmessage','message':_0x559b65[_0x7737('0x2a')]},client9002)[_0x7737('0x22')](function(){return _0x559b65;});}return _0x559b65;}return null;})[_0x7737('0x22')](respondWithResult(_0x2226bb,null))['catch'](handleError(_0x2226bb,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0x7737('0x37')]=function(_0x463dc7,_0x79bfdb,_0x449314){var _0x1a7dcc={'agent':{},'channel':_0x7737('0x5c')};if(_0x463dc7[_0x7737('0x58')]['id']){delete _0x463dc7[_0x7737('0x58')]['id'];}_0x463dc7[_0x7737('0x58')][_0x7737('0x5f')]=_0x463dc7[_0x7737('0x58')]['UserId']||_0x463dc7[_0x7737('0x67')]['id'];_0x1a7dcc[_0x7737('0x6f')]['id']=_0x463dc7[_0x7737('0x58')][_0x7737('0x5f')];return db[_0x7737('0x3d')][_0x7737('0x57')]({'where':{'id':_0x463dc7['params']['id'],'UserId':null}})[_0x7737('0x22')](handleEntityNotFound(_0x79bfdb,null))['then'](function(_0x3adaa1){if(_0x3adaa1){_0x1a7dcc['message']=_0x3adaa1[_0x7737('0x60')]({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x3adaa1[_0x7737('0x62')]}});}return null;})[_0x7737('0x22')](handleEntityNotFound(_0x79bfdb,null))[_0x7737('0x22')](function(_0x115f3e){if(_0x115f3e){_0x1a7dcc['interaction']=_0x115f3e['get']({'plain':!![]});interaction_log['info'](_0x7737('0x78'),_0x463dc7[_0x7737('0x67')]['id'],_0x463dc7[_0x7737('0x67')][_0x7737('0x39')],_0x463dc7[_0x7737('0x67')]['role'],_0x1a7dcc[_0x7737('0x65')]['id'],_0x463dc7[_0x7737('0x58')]?JSON[_0x7737('0x26')](_0x463dc7['body']):_0x7737('0x79'));return respondWithRpcPromise('RejectMessage',_0x7737('0x7a'),_0x1a7dcc);}return null;})[_0x7737('0x22')](function(_0x42ca52){var _0x462785='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x42ca52[_0x7737('0x2a')]['ContactId'];return db[_0x7737('0x7b')][_0x7737('0x40')](_0x462785,{'type':db[_0x7737('0x6b')][_0x7737('0x6c')][_0x7737('0x6d')],'raw':!![]})[_0x7737('0x22')](function(_0x8e28cb){return _0x8e28cb;});})[_0x7737('0x22')](function(_0x328765){if(_0x328765){_0x1a7dcc['message'][_0x7737('0x7c')]=_0x328765[0x0];if(!_0x463dc7[_0x7737('0x58')][_0x7737('0x5f')])return;return db[_0x7737('0x6e')][_0x7737('0x57')]({'where':{'id':_0x463dc7[_0x7737('0x58')][_0x7737('0x5f')],'role':_0x7737('0x6f')},'attributes':['id','name','fullname',_0x7737('0x71'),_0x7737('0x7d')],'raw':!![]});}return null;})['then'](function(_0x34d7f6){if(!_0x34d7f6)return null;_0x1a7dcc['message'][_0x7737('0x6f')]=_0x34d7f6;return _0x1a7dcc;})[_0x7737('0x22')](function(_0x344314){if(_0x344314){_0x344314[_0x7737('0x2a')]['interface']=util[_0x7737('0x64')](_0x7737('0x73'),_0x463dc7[_0x7737('0x67')][_0x7737('0x39')]);_0x344314[_0x7737('0x2a')][_0x7737('0x74')]=_0x1a7dcc['channel'];_0x344314[_0x7737('0x2a')][_0x7737('0x75')]=_0x1a7dcc['channel'];_0x344314[_0x7737('0x2a')][_0x7737('0x76')]=_0x7737('0x37');respondWithRpcPromise(_0x7737('0x77'),_0x7737('0x77'),{'event':_0x7737('0x7e'),'message':_0x344314[_0x7737('0x2a')]},client9002);return _0x1a7dcc;}return null;})['then'](respondWithResult(_0x79bfdb,null))['catch'](handleError(_0x79bfdb,null));};exports[_0x7737('0x7f')]=function(_0x20e897,_0x470a80){var _0x20f9c7;return db['FaxMessage'][_0x7737('0x7f')](_0x20e897['body'],{})[_0x7737('0x22')](function(_0x51cdab){_0x20f9c7=_0x51cdab;return db[_0x7737('0x80')]['findOne']({'where':{'id':_0x20f9c7[_0x7737('0x6a')]}});})['then'](function(_0x171116){if(_[_0x7737('0x81')](_0x171116)){return;}else{_0x20f9c7[_0x7737('0x5c')]=_0x171116[_0x7737('0x5c')];return db[_0x7737('0x82')][_0x7737('0x83')]({'where':{'id':_0x20f9c7[_0x7737('0x84')]}});}})[_0x7737('0x22')](function(_0x2c0b56){return respondWithRpcPromise('SendFax',_0x7737('0x85'),{'FaxAccountId':_[_0x7737('0x81')](_0x20e897[_0x7737('0x58')])?undefined:_0x20e897['body'][_0x7737('0x86')],'path':_[_0x7737('0x81')](_0x2c0b56)?undefined:util[_0x7737('0x64')]('/var/opt/motion2/server/files/attachments/%s',_0x2c0b56[_0x7737('0x87')]),'fax':_[_0x7737('0x81')](_0x20f9c7['fax'])?undefined:_0x20f9c7[_0x7737('0x5c')],'AttachmentId':_0x20f9c7[_0x7737('0x84')]},client9002);})[_0x7737('0x22')](respondWithResult(_0x470a80,0xc9))[_0x7737('0x51')](handleError(_0x470a80,null));};exports['download']=function(_0x5b33dc,_0xe4df9b){var _0x5a7cff=path[_0x7737('0x88')](config[_0x7737('0x89')],_0x7737('0x8a'),_0x7737('0x8b'),'attachments');return db[_0x7737('0x3d')][_0x7737('0x57')]({'where':{'id':_0x5b33dc[_0x7737('0x53')]['id']},'include':[{'model':db[_0x7737('0x82')],'as':_0x7737('0x82')}]})['then'](handleEntityNotFound(_0xe4df9b,null))[_0x7737('0x22')](function(_0x247ef5){if(_0x247ef5){return _0xe4df9b['download'](path[_0x7737('0x88')](_0x5a7cff,_0x247ef5['Attachment']['basename']));}})[_0x7737('0x51')](handleError(_0xe4df9b,null));}; \ No newline at end of file +var _0x915f=['info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','offset','limit','undefined','set','Content-Range','json','apply','reject','save','update','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','key','query','intersection','model','attributes','fields','nolimit','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','FaxMessage','count','includeAll','include','findAll','rows','show','params','keys','length','body','find','describe','fax-interactions','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','user','agent','UserId','get','FaxInteraction','isNil','read1stAt','interaction','[FAXMESSAGE: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','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','event','accept','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','sequelize','QueryTypes','EventManager','rejectmessage','create','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','fax','download','root','server','join','basename','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','then'];(function(_0x4aa417,_0x36cb68){var _0x8b6053=function(_0x25a546){while(--_0x25a546){_0x4aa417['push'](_0x4aa417['shift']());}};_0x8b6053(++_0x36cb68);}(_0x915f,0x192));var _0xf915=function(_0x31bae8,_0x59cb18){_0x31bae8=_0x31bae8-0x0;var _0xf25225=_0x915f[_0x31bae8];return _0xf25225;};'use strict';var emlformat=require(_0xf915('0x0'));var rimraf=require(_0xf915('0x1'));var zipdir=require(_0xf915('0x2'));var jsonpatch=require(_0xf915('0x3'));var rp=require('request-promise');var moment=require(_0xf915('0x4'));var BPromise=require(_0xf915('0x5'));var Mustache=require(_0xf915('0x6'));var util=require(_0xf915('0x7'));var path=require('path');var sox=require(_0xf915('0x8'));var csv=require(_0xf915('0x9'));var ejs=require(_0xf915('0xa'));var fs=require('fs');var fs_extra=require(_0xf915('0xb'));var _=require('lodash');var squel=require(_0xf915('0xc'));var crypto=require('crypto');var jsforce=require(_0xf915('0xd'));var deskjs=require(_0xf915('0xe'));var toCsv=require(_0xf915('0x9'));var querystring=require(_0xf915('0xf'));var Papa=require('papaparse');var Redis=require(_0xf915('0x10'));var authService=require(_0xf915('0x11'));var qs=require(_0xf915('0x12'));var as=require(_0xf915('0x13'));var hardwareService=require(_0xf915('0x14'));var logger=require(_0xf915('0x15'))(_0xf915('0x16'));var utils=require('../../config/utils');var config=require(_0xf915('0x17'));var licenseUtil=require(_0xf915('0x18'));var db=require(_0xf915('0x19'))['db'];config[_0xf915('0x1a')]=_[_0xf915('0x1b')](config[_0xf915('0x1a')],{'host':_0xf915('0x1c'),'port':0x18eb});var socket=require(_0xf915('0x1d'))(new Redis(config[_0xf915('0x1a')]));require(_0xf915('0x1e'))[_0xf915('0x1f')](socket);var jayson=require(_0xf915('0x20'));var client=jayson[_0xf915('0x21')][_0xf915('0x22')]({'port':0x232c});var client9002=jayson[_0xf915('0x21')][_0xf915('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x2ddb40,_0x2487c8,_0x2f0d4f,_0x12e4d0){return new BPromise(function(_0x1c7bd9,_0x19d7e2){var _0x78cb7d=_0x12e4d0||client;return _0x78cb7d['request'](_0x2ddb40,_0x2f0d4f)[_0xf915('0x23')](function(_0x473186){logger[_0xf915('0x24')](_0xf915('0x25'),_0x2487c8,_0xf915('0x26'));logger['debug'](_0xf915('0x27'),_0x2487c8,_0xf915('0x26'),JSON['stringify'](_0x473186));if(_0x473186[_0xf915('0x28')]){if(_0x473186[_0xf915('0x28')]['code']===0x1f4){logger[_0xf915('0x28')](_0xf915('0x25'),_0x2487c8,_0x473186[_0xf915('0x28')][_0xf915('0x29')]);return _0x19d7e2(_0x473186[_0xf915('0x28')][_0xf915('0x29')]);}logger[_0xf915('0x28')]('FaxMessage,\x20%s,\x20%s',_0x2487c8,_0x473186['error'][_0xf915('0x29')]);return _0x1c7bd9(_0x473186[_0xf915('0x28')][_0xf915('0x29')]);}else{logger[_0xf915('0x24')](_0xf915('0x25'),_0x2487c8,_0xf915('0x26'));_0x1c7bd9(_0x473186[_0xf915('0x2a')][_0xf915('0x29')]);}})[_0xf915('0x2b')](function(_0x202878){logger['error']('FaxMessage,\x20%s,\x20%s',_0x2487c8,_0x202878);_0x19d7e2(_0x202878);});});}function respondWithStatusCode(_0x11da0e,_0xee454a){_0xee454a=_0xee454a||0xcc;return function(_0x42491f){if(_0x42491f){return _0x11da0e[_0xf915('0x2c')](_0xee454a);}return _0x11da0e['status'](_0xee454a)['end']();};}function respondWithResult(_0x563bbf,_0x4fdd68){_0x4fdd68=_0x4fdd68||0xc8;return function(_0x232e26){if(_0x232e26){return _0x563bbf[_0xf915('0x2d')](_0x4fdd68)['json'](_0x232e26);}};}function respondWithFilteredResult(_0x465d42,_0x2daafe){return function(_0x386455){if(_0x386455){var _0x1b7f9e=typeof _0x2daafe[_0xf915('0x2e')]==='undefined'&&typeof _0x2daafe[_0xf915('0x2f')]===_0xf915('0x30');var _0x33a687=_0x386455['count'];var _0x33606b=_0x1b7f9e?0x0:_0x2daafe['offset'];var _0x427c71=_0x1b7f9e?_0x386455['count']:_0x2daafe[_0xf915('0x2e')]+_0x2daafe['limit'];var _0x45fd02;if(_0x427c71>=_0x33a687){_0x427c71=_0x33a687;_0x45fd02=0xc8;}else{_0x45fd02=0xce;}_0x465d42[_0xf915('0x2d')](_0x45fd02);return _0x465d42[_0xf915('0x31')](_0xf915('0x32'),_0x33606b+'-'+_0x427c71+'/'+_0x33a687)[_0xf915('0x33')](_0x386455);}return null;};}function patchUpdates(_0x495353){return function(_0x41df67){try{jsonpatch[_0xf915('0x34')](_0x41df67,_0x495353,!![]);}catch(_0x233353){return BPromise[_0xf915('0x35')](_0x233353);}return _0x41df67[_0xf915('0x36')]();};}function saveUpdates(_0x581a6c,_0x190daa){return function(_0xdb4d6f){if(_0xdb4d6f){return _0xdb4d6f[_0xf915('0x37')](_0x581a6c)['then'](function(_0x49db31){return _0x49db31;});}return null;};}function removeEntity(_0x1af293,_0x21e8fc){return function(_0x5e1e92){if(_0x5e1e92){return _0x5e1e92[_0xf915('0x38')]()[_0xf915('0x23')](function(){_0x1af293['status'](0xcc)[_0xf915('0x39')]();});}};}function handleEntityNotFound(_0x50d157,_0x52c9fc){return function(_0x4ff2cb){if(!_0x4ff2cb){_0x50d157[_0xf915('0x2c')](0x194);}return _0x4ff2cb;};}function handleError(_0x31c48f,_0x59bec9){_0x59bec9=_0x59bec9||0x1f4;return function(_0x45760b){logger[_0xf915('0x28')](_0x45760b[_0xf915('0x3a')]);if(_0x45760b[_0xf915('0x3b')]){delete _0x45760b[_0xf915('0x3b')];}_0x31c48f['status'](_0x59bec9)[_0xf915('0x3c')](_0x45760b);};}exports[_0xf915('0x3d')]=function(_0x93a224,_0x410942){var _0x3e8034={},_0x595335={},_0x187190={'count':0x0,'rows':[]};var _0x262e4f=_[_0xf915('0x3e')](db['FaxMessage'][_0xf915('0x3f')],function(_0x1cd180){return{'name':_0x1cd180[_0xf915('0x40')],'type':_0x1cd180['type'][_0xf915('0x41')]};});_0x595335['model']=_[_0xf915('0x3e')](_0x262e4f,_0xf915('0x3b'));_0x595335[_0xf915('0x42')]=_['keys'](_0x93a224[_0xf915('0x42')]);_0x595335['filters']=_[_0xf915('0x43')](_0x595335[_0xf915('0x44')],_0x595335[_0xf915('0x42')]);_0x3e8034[_0xf915('0x45')]=_['intersection'](_0x595335[_0xf915('0x44')],qs['fields'](_0x93a224['query'][_0xf915('0x46')]));_0x3e8034['attributes']=_0x3e8034[_0xf915('0x45')]['length']?_0x3e8034[_0xf915('0x45')]:_0x595335[_0xf915('0x44')];if(!_0x93a224[_0xf915('0x42')]['hasOwnProperty'](_0xf915('0x47'))){_0x3e8034[_0xf915('0x2f')]=qs['limit'](_0x93a224[_0xf915('0x42')][_0xf915('0x2f')]);_0x3e8034[_0xf915('0x2e')]=qs[_0xf915('0x2e')](_0x93a224['query'][_0xf915('0x2e')]);}_0x3e8034['order']=qs[_0xf915('0x48')](_0x93a224[_0xf915('0x42')][_0xf915('0x48')]);_0x3e8034['where']=qs[_0xf915('0x49')](_[_0xf915('0x4a')](_0x93a224[_0xf915('0x42')],_0x595335[_0xf915('0x49')]),_0x262e4f);if(_0x93a224['query'][_0xf915('0x4b')]){_0x3e8034[_0xf915('0x4c')]=_[_0xf915('0x4d')](_0x3e8034[_0xf915('0x4c')],{'$or':_[_0xf915('0x3e')](_0x262e4f,function(_0xcbb912){if(_0xcbb912[_0xf915('0x4e')]!==_0xf915('0x4f')){var _0x1c3a2e={};_0x1c3a2e[_0xcbb912[_0xf915('0x3b')]]={'$like':'%'+_0x93a224[_0xf915('0x42')][_0xf915('0x4b')]+'%'};return _0x1c3a2e;}})});}_0x3e8034=_['merge']({},_0x3e8034,_0x93a224[_0xf915('0x50')]);var _0x15f5bd={'where':_0x3e8034[_0xf915('0x4c')]};return db[_0xf915('0x51')][_0xf915('0x52')](_0x15f5bd)[_0xf915('0x23')](function(_0x2328a4){_0x187190[_0xf915('0x52')]=_0x2328a4;if(_0x93a224[_0xf915('0x42')][_0xf915('0x53')]){_0x3e8034[_0xf915('0x54')]=[{'all':!![]}];}return db[_0xf915('0x51')][_0xf915('0x55')](_0x3e8034);})[_0xf915('0x23')](function(_0xda0620){_0x187190[_0xf915('0x56')]=_0xda0620;return _0x187190;})['then'](respondWithFilteredResult(_0x410942,_0x3e8034))[_0xf915('0x2b')](handleError(_0x410942,null));};exports[_0xf915('0x57')]=function(_0x49f7d9,_0x17371b){var _0x2301bc={'raw':!![],'where':{'id':_0x49f7d9[_0xf915('0x58')]['id']}},_0x1bf938={};_0x1bf938[_0xf915('0x44')]=_[_0xf915('0x59')](db[_0xf915('0x51')][_0xf915('0x3f')]);_0x1bf938[_0xf915('0x42')]=_['keys'](_0x49f7d9[_0xf915('0x42')]);_0x1bf938[_0xf915('0x49')]=_['intersection'](_0x1bf938[_0xf915('0x44')],_0x1bf938[_0xf915('0x42')]);_0x2301bc[_0xf915('0x45')]=_[_0xf915('0x43')](_0x1bf938[_0xf915('0x44')],qs['fields'](_0x49f7d9[_0xf915('0x42')][_0xf915('0x46')]));_0x2301bc[_0xf915('0x45')]=_0x2301bc[_0xf915('0x45')][_0xf915('0x5a')]?_0x2301bc[_0xf915('0x45')]:_0x1bf938[_0xf915('0x44')];if(_0x49f7d9[_0xf915('0x42')][_0xf915('0x53')]){_0x2301bc['include']=[{'all':!![]}];}_0x2301bc=_[_0xf915('0x4d')]({},_0x2301bc,_0x49f7d9[_0xf915('0x50')]);return db[_0xf915('0x51')]['find'](_0x2301bc)['then'](handleEntityNotFound(_0x17371b,null))[_0xf915('0x23')](respondWithResult(_0x17371b,null))[_0xf915('0x2b')](handleError(_0x17371b,null));};exports[_0xf915('0x37')]=function(_0x277ba1,_0x3361f0){if(_0x277ba1[_0xf915('0x5b')]['id']){delete _0x277ba1[_0xf915('0x5b')]['id'];}return db[_0xf915('0x51')][_0xf915('0x5c')]({'where':{'id':_0x277ba1['params']['id']}})[_0xf915('0x23')](handleEntityNotFound(_0x3361f0,null))[_0xf915('0x23')](saveUpdates(_0x277ba1[_0xf915('0x5b')],null))['then'](respondWithResult(_0x3361f0,null))[_0xf915('0x2b')](handleError(_0x3361f0,null));};exports[_0xf915('0x38')]=function(_0x3db7dc,_0x9ab4a1){return db[_0xf915('0x51')]['find']({'where':{'id':_0x3db7dc[_0xf915('0x58')]['id']}})[_0xf915('0x23')](handleEntityNotFound(_0x9ab4a1,null))[_0xf915('0x23')](removeEntity(_0x9ab4a1,null))['catch'](handleError(_0x9ab4a1,null));};exports[_0xf915('0x5d')]=function(_0x22faa9,_0x37c6e9){return db[_0xf915('0x51')][_0xf915('0x5d')]()[_0xf915('0x23')](respondWithResult(_0x37c6e9,null))[_0xf915('0x2b')](handleError(_0x37c6e9,null));};var interaction_log=require(_0xf915('0x15'))(_0xf915('0x5e'));exports['accept']=function(_0x58e7e4,_0xa0d320,_0x2e6bdf){var _0xfeafb4={'agent':{},'channel':'fax'};if(_0x58e7e4[_0xf915('0x5b')]['id']){delete _0x58e7e4['body']['id'];}_0x58e7e4[_0xf915('0x5b')][_0xf915('0x5f')]=!![];_0x58e7e4[_0xf915('0x5b')][_0xf915('0x60')]=moment()[_0xf915('0x61')](_0xf915('0x62'));_0x58e7e4[_0xf915('0x5b')]['UserId']=_0x58e7e4[_0xf915('0x5b')]['UserId']||_0x58e7e4[_0xf915('0x63')]['id'];_0xfeafb4[_0xf915('0x64')]['id']=_0x58e7e4['body'][_0xf915('0x65')];return db[_0xf915('0x51')][_0xf915('0x5c')]({'where':{'id':_0x58e7e4[_0xf915('0x58')]['id'],'UserId':null}})[_0xf915('0x23')](handleEntityNotFound(_0xa0d320,null))[_0xf915('0x23')](saveUpdates(_0x58e7e4[_0xf915('0x5b')],null))[_0xf915('0x23')](function(_0x22f2b8){if(_0x22f2b8){_0xfeafb4[_0xf915('0x29')]=_0x22f2b8[_0xf915('0x66')]({'plain':!![]});return db[_0xf915('0x67')][_0xf915('0x5c')]({'where':{'id':_0x22f2b8['FaxInteractionId']}});}return null;})[_0xf915('0x23')](handleEntityNotFound(_0xa0d320,null))[_0xf915('0x23')](function(_0x5613c8){if(_0x5613c8){return _0x5613c8[_0xf915('0x37')]({'UserId':_0x58e7e4[_0xf915('0x5b')][_0xf915('0x65')],'read1stAt':_[_0xf915('0x68')](_0x5613c8[_0xf915('0x69')])?moment()['format'](_0xf915('0x62')):undefined});}return null;})['then'](function(_0x98ae9a){if(_0x98ae9a){_0xfeafb4[_0xf915('0x6a')]=_0x98ae9a[_0xf915('0x66')]({'plain':!![]});interaction_log['info'](_0xf915('0x6b'),_0x58e7e4['user']['id'],_0x58e7e4[_0xf915('0x63')][_0xf915('0x3b')],_0x58e7e4[_0xf915('0x63')]['role'],_0xfeafb4['interaction']['id'],_0x58e7e4[_0xf915('0x5b')]?JSON['stringify'](_0x58e7e4[_0xf915('0x5b')]):_0xf915('0x6c'));return respondWithRpcPromise(_0xf915('0x6d'),_0xf915('0x6e'),_0xfeafb4);}return null;})['then'](function(_0x12904a){var _0x492db9=_0xf915('0x6f')+_0x12904a[_0xf915('0x29')][_0xf915('0x70')];return db['sequelize'][_0xf915('0x42')](_0x492db9,{'type':db[_0xf915('0x71')]['QueryTypes'][_0xf915('0x72')],'raw':!![]})[_0xf915('0x23')](function(_0x572dcb){return _0x572dcb;});})[_0xf915('0x23')](function(_0x4eb46b){if(_0x4eb46b){_0xfeafb4[_0xf915('0x29')][_0xf915('0x73')]=_0x4eb46b[0x0];if(!_0x58e7e4[_0xf915('0x5b')][_0xf915('0x65')])return;return db[_0xf915('0x74')][_0xf915('0x5c')]({'where':{'id':_0x58e7e4['body']['UserId'],'role':_0xf915('0x64')},'attributes':['id',_0xf915('0x3b'),_0xf915('0x75'),_0xf915('0x76'),_0xf915('0x77')],'raw':!![]});}return null;})[_0xf915('0x23')](function(_0x4f3d9b){if(!_0x4f3d9b)return null;_0xfeafb4[_0xf915('0x29')][_0xf915('0x64')]=_0x4f3d9b;return _0xfeafb4;})[_0xf915('0x23')](function(_0x163540){if(_0x163540){if(_0x58e7e4[_0xf915('0x5b')][_0xf915('0x78')]){_0xfeafb4[_0xf915('0x29')][_0xf915('0x79')]=util[_0xf915('0x61')](_0xf915('0x7a'),_0x58e7e4[_0xf915('0x63')][_0xf915('0x3b')]);_0xfeafb4[_0xf915('0x29')][_0xf915('0x7b')]=_0xfeafb4['channel'];_0xfeafb4[_0xf915('0x29')]['motionChannel']=_0xfeafb4[_0xf915('0x7b')];_0xfeafb4[_0xf915('0x29')][_0xf915('0x7c')]=_0xf915('0x7d');return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0xfeafb4['message']},client9002)[_0xf915('0x23')](function(){return _0xfeafb4;});}return _0xfeafb4;}return null;})[_0xf915('0x23')](respondWithResult(_0xa0d320,null))['catch'](handleError(_0xa0d320,null));};var interaction_log=require(_0xf915('0x15'))(_0xf915('0x5e'));exports['reject']=function(_0x5a35a4,_0x261ccf,_0x4f8e9b){var _0x9b99d6={'agent':{},'channel':'fax'};if(_0x5a35a4[_0xf915('0x5b')]['id']){delete _0x5a35a4[_0xf915('0x5b')]['id'];}_0x5a35a4[_0xf915('0x5b')]['UserId']=_0x5a35a4[_0xf915('0x5b')][_0xf915('0x65')]||_0x5a35a4[_0xf915('0x63')]['id'];_0x9b99d6['agent']['id']=_0x5a35a4[_0xf915('0x5b')]['UserId'];return db[_0xf915('0x51')][_0xf915('0x5c')]({'where':{'id':_0x5a35a4['params']['id'],'UserId':null}})[_0xf915('0x23')](handleEntityNotFound(_0x261ccf,null))[_0xf915('0x23')](function(_0x1c50f4){if(_0x1c50f4){_0x9b99d6['message']=_0x1c50f4[_0xf915('0x66')]({'plain':!![]});return db[_0xf915('0x67')][_0xf915('0x5c')]({'where':{'id':_0x1c50f4['FaxInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x261ccf,null))['then'](function(_0x8e2295){if(_0x8e2295){_0x9b99d6[_0xf915('0x6a')]=_0x8e2295[_0xf915('0x66')]({'plain':!![]});interaction_log[_0xf915('0x24')](_0xf915('0x7e'),_0x5a35a4[_0xf915('0x63')]['id'],_0x5a35a4[_0xf915('0x63')][_0xf915('0x3b')],_0x5a35a4[_0xf915('0x63')][_0xf915('0x7f')],_0x9b99d6[_0xf915('0x6a')]['id'],_0x5a35a4[_0xf915('0x5b')]?JSON['stringify'](_0x5a35a4['body']):_0xf915('0x6c'));return respondWithRpcPromise(_0xf915('0x80'),'rejectMessage',_0x9b99d6);}return null;})[_0xf915('0x23')](function(_0x3cd4e3){var _0x496577=_0xf915('0x6f')+_0x3cd4e3[_0xf915('0x29')][_0xf915('0x70')];return db[_0xf915('0x81')]['query'](_0x496577,{'type':db[_0xf915('0x71')][_0xf915('0x82')]['SELECT'],'raw':!![]})[_0xf915('0x23')](function(_0x4cc6dd){return _0x4cc6dd;});})[_0xf915('0x23')](function(_0x4b9060){if(_0x4b9060){_0x9b99d6[_0xf915('0x29')]['contact']=_0x4b9060[0x0];if(!_0x5a35a4[_0xf915('0x5b')][_0xf915('0x65')])return;return db['User'][_0xf915('0x5c')]({'where':{'id':_0x5a35a4['body'][_0xf915('0x65')],'role':_0xf915('0x64')},'attributes':['id',_0xf915('0x3b'),'fullname',_0xf915('0x76'),_0xf915('0x77')],'raw':!![]});}return null;})[_0xf915('0x23')](function(_0x6302){if(!_0x6302)return null;_0x9b99d6['message'][_0xf915('0x64')]=_0x6302;return _0x9b99d6;})[_0xf915('0x23')](function(_0x187eec){if(_0x187eec){_0x187eec[_0xf915('0x29')][_0xf915('0x79')]=util[_0xf915('0x61')](_0xf915('0x7a'),_0x5a35a4[_0xf915('0x63')][_0xf915('0x3b')]);_0x187eec[_0xf915('0x29')][_0xf915('0x7b')]=_0x9b99d6['channel'];_0x187eec['message']['motionChannel']=_0x9b99d6[_0xf915('0x7b')];_0x187eec[_0xf915('0x29')][_0xf915('0x7c')]=_0xf915('0x35');respondWithRpcPromise('EventManager',_0xf915('0x83'),{'event':_0xf915('0x84'),'message':_0x187eec[_0xf915('0x29')]},client9002);return _0x9b99d6;}return null;})['then'](respondWithResult(_0x261ccf,null))[_0xf915('0x2b')](handleError(_0x261ccf,null));};exports[_0xf915('0x85')]=function(_0xfff654,_0x3e82cf){var _0x494ba9;return db[_0xf915('0x51')][_0xf915('0x85')](_0xfff654[_0xf915('0x5b')],{})['then'](function(_0x41b868){_0x494ba9=_0x41b868;return db['CmContact'][_0xf915('0x86')]({'where':{'id':_0x494ba9[_0xf915('0x70')]}});})[_0xf915('0x23')](function(_0x4318ba){if(_[_0xf915('0x68')](_0x4318ba)){return;}else{_0x494ba9['fax']=_0x4318ba['fax'];return db[_0xf915('0x87')][_0xf915('0x86')]({'where':{'id':_0x494ba9[_0xf915('0x88')]}});}})[_0xf915('0x23')](function(_0x277cda){return respondWithRpcPromise(_0xf915('0x89'),'SendFax',{'FaxAccountId':_['isNil'](_0xfff654['body'])?undefined:_0xfff654[_0xf915('0x5b')][_0xf915('0x8a')],'path':_[_0xf915('0x68')](_0x277cda)?undefined:util[_0xf915('0x61')](_0xf915('0x8b'),_0x277cda['basename']),'fax':_[_0xf915('0x68')](_0x494ba9[_0xf915('0x8c')])?undefined:_0x494ba9[_0xf915('0x8c')],'AttachmentId':_0x494ba9['AttachmentId']},client9002);})[_0xf915('0x23')](respondWithResult(_0x3e82cf,0xc9))[_0xf915('0x2b')](handleError(_0x3e82cf,null));};exports[_0xf915('0x8d')]=function(_0x2ecab1,_0x4d3d67){var _0x5ded6e=path['join'](config[_0xf915('0x8e')],_0xf915('0x8f'),'files','attachments');return db['FaxMessage']['find']({'where':{'id':_0x2ecab1[_0xf915('0x58')]['id']},'include':[{'model':db[_0xf915('0x87')],'as':_0xf915('0x87')}]})[_0xf915('0x23')](handleEntityNotFound(_0x4d3d67,null))[_0xf915('0x23')](function(_0xf99300){if(_0xf99300){return _0x4d3d67['download'](path[_0xf915('0x90')](_0x5ded6e,_0xf99300[_0xf915('0x87')][_0xf915('0x91')]));}})['catch'](handleError(_0x4d3d67,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 0215201..3034bca 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 _0xd8a5=['exports','events','FaxMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x417e49,_0x5d1198){var _0x1103cd=function(_0x430e72){while(--_0x430e72){_0x417e49['push'](_0x417e49['shift']());}};_0x1103cd(++_0x5d1198);}(_0xd8a5,0x160));var _0x5d8a=function(_0x3060a1,_0x1d9386){_0x3060a1=_0x3060a1-0x0;var _0x5526ce=_0xd8a5[_0x3060a1];return _0x5526ce;};'use strict';var EventEmitter=require(_0x5d8a('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x5d8a('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x5d8a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5d8a('0x3'),'afterDestroy':_0x5d8a('0x4')};function emitEvent(_0x26e941){return function(_0x22863c,_0x821a16,_0x581cbc){FaxMessageEvents[_0x5d8a('0x5')](_0x26e941+':'+_0x22863c['id'],_0x22863c);FaxMessageEvents[_0x5d8a('0x5')](_0x26e941,_0x22863c);_0x581cbc(null);};}for(var e in events){if(events[_0x5d8a('0x6')](e)){var event=events[e];FaxMessage[_0x5d8a('0x7')](e,emitEvent(event));}}module[_0x5d8a('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0x0f80=['hasOwnProperty','hook','exports','../../mysqldb','FaxMessage','setMaxListeners','save','update','emit'];(function(_0x2c01e4,_0x2d9d26){var _0x311643=function(_0x560729){while(--_0x560729){_0x2c01e4['push'](_0x2c01e4['shift']());}};_0x311643(++_0x2d9d26);}(_0x0f80,0x108));var _0x00f8=function(_0x30e259,_0x4ab69f){_0x30e259=_0x30e259-0x0;var _0x5a0c5f=_0x0f80[_0x30e259];return _0x5a0c5f;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0x00f8('0x0'))['db'][_0x00f8('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x00f8('0x2')](0x0);var events={'afterCreate':_0x00f8('0x3'),'afterUpdate':_0x00f8('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1c5e26){return function(_0x1921a1,_0x257013,_0x523990){FaxMessageEvents[_0x00f8('0x5')](_0x1c5e26+':'+_0x1921a1['id'],_0x1921a1);FaxMessageEvents[_0x00f8('0x5')](_0x1c5e26,_0x1921a1);_0x523990(null);};}for(var e in events){if(events[_0x00f8('0x6')](e)){var event=events[e];FaxMessage[_0x00f8('0x7')](e,emitEvent(event));}}module[_0x00f8('0x8')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index f1318d6..36fb5cd 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 _0x9c04=['toLowerCase','catch','error','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','body','FULLTEXT','models','get','direction','out','secret','isNil','UserId','FaxInteraction','findOne','update'];(function(_0x86bf72,_0x3bb497){var _0x4e8131=function(_0x3f4cfe){while(--_0x3f4cfe){_0x86bf72['push'](_0x86bf72['shift']());}};_0x4e8131(++_0x3bb497);}(_0x9c04,0x16b));var _0x49c0=function(_0x40baf1,_0x39a1e3){_0x40baf1=_0x40baf1-0x0;var _0x293477=_0x9c04[_0x40baf1];return _0x293477;};'use strict';var _=require(_0x49c0('0x0'));var util=require(_0x49c0('0x1'));var logger=require(_0x49c0('0x2'))(_0x49c0('0x3'));var moment=require(_0x49c0('0x4'));var BPromise=require(_0x49c0('0x5'));var rp=require(_0x49c0('0x6'));var fs=require('fs');var path=require(_0x49c0('0x7'));var rimraf=require(_0x49c0('0x8'));var config=require(_0x49c0('0x9'));var attributes=require(_0x49c0('0xa'));module[_0x49c0('0xb')]=function(_0x363fa3,_0x20e5e4){return _0x363fa3[_0x49c0('0xc')](_0x49c0('0xd'),attributes,{'tableName':_0x49c0('0xe'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x49c0('0xf')],'type':_0x49c0('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x13883f,_0x3c8724,_0x1938c0){var _0x49b6c7=_0x363fa3[_0x49c0('0x11')];var _0x2c4c41=_0x13883f[_0x49c0('0x12')]({'plain':!![]});if(_0x2c4c41['direction']['toLowerCase']()==='in'||_0x2c4c41[_0x49c0('0x13')]['toLowerCase']()===_0x49c0('0x14')&&!_0x2c4c41[_0x49c0('0x15')]&&!_[_0x49c0('0x16')](_0x2c4c41[_0x49c0('0x17')])){_0x49b6c7[_0x49c0('0x18')][_0x49c0('0x19')]({'where':{'id':_0x2c4c41['FaxInteractionId']}})['then'](function(_0x9f3903){if(_0x9f3903){_0x9f3903[_0x49c0('0x1a')]({'lastMsgAt':_0x2c4c41['createdAt'],'lastMsgDirection':_0x2c4c41[_0x49c0('0x13')][_0x49c0('0x1b')]()});}})[_0x49c0('0x1c')](function(_0x4e68fb){console[_0x49c0('0x1d')](_0x4e68fb);});}_0x1938c0();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd9b9=['FULLTEXT','get','toLowerCase','out','secret','isNil','findOne','FaxInteractionId','then','update','direction','catch','error','utf8mb4','util','../../config/logger','api','bluebird','rimraf','./faxMessage.attributes','exports','define','fax_messages','body'];(function(_0x2c1733,_0x41f113){var _0xfbb694=function(_0x32ddcf){while(--_0x32ddcf){_0x2c1733['push'](_0x2c1733['shift']());}};_0xfbb694(++_0x41f113);}(_0xd9b9,0x1d6));var _0x9d9b=function(_0x54eabf,_0x3ec253){_0x54eabf=_0x54eabf-0x0;var _0x3b3f2d=_0xd9b9[_0x54eabf];return _0x3b3f2d;};'use strict';var _=require('lodash');var util=require(_0x9d9b('0x0'));var logger=require(_0x9d9b('0x1'))(_0x9d9b('0x2'));var moment=require('moment');var BPromise=require(_0x9d9b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9d9b('0x4'));var config=require('../../config/environment');var attributes=require(_0x9d9b('0x5'));module[_0x9d9b('0x6')]=function(_0x2d33c7,_0xc30eaf){return _0x2d33c7[_0x9d9b('0x7')]('FaxMessage',attributes,{'tableName':_0x9d9b('0x8'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x9d9b('0x9')],'type':_0x9d9b('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x345621,_0xbab8f3,_0x41e583){var _0x1f7e09=_0x2d33c7['models'];var _0x1198f5=_0x345621[_0x9d9b('0xb')]({'plain':!![]});if(_0x1198f5['direction'][_0x9d9b('0xc')]()==='in'||_0x1198f5['direction'][_0x9d9b('0xc')]()===_0x9d9b('0xd')&&!_0x1198f5[_0x9d9b('0xe')]&&!_[_0x9d9b('0xf')](_0x1198f5['UserId'])){_0x1f7e09['FaxInteraction'][_0x9d9b('0x10')]({'where':{'id':_0x1198f5[_0x9d9b('0x11')]}})[_0x9d9b('0x12')](function(_0xbe364d){if(_0xbe364d){_0xbe364d[_0x9d9b('0x13')]({'lastMsgAt':_0x1198f5['createdAt'],'lastMsgDirection':_0x1198f5[_0x9d9b('0x14')][_0x9d9b('0xc')]()});}})[_0x9d9b('0x15')](function(_0xac85c9){console[_0x9d9b('0x16')](_0xac85c9);});}_0x41e583();}},'charset':_0x9d9b('0x17'),'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 cc5aba0..4087732 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 _0x207c=['result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','UpdateFaxMessage','attributes','limit','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','redis','defaults','localhost','socket.io-emitter','register','info','request\x20sent','debug','stringify','error','code','FaxMessage,\x20%s,\x20%s','message'];(function(_0x69c774,_0x34797f){var _0x1badcd=function(_0x21e055){while(--_0x21e055){_0x69c774['push'](_0x69c774['shift']());}};_0x1badcd(++_0x34797f);}(_0x207c,0x1e8));var _0xc207=function(_0x3adad8,_0x5aef55){_0x3adad8=_0x3adad8-0x0;var _0x177095=_0x207c[_0x3adad8];return _0x177095;};'use strict';var _=require('lodash');var util=require(_0xc207('0x0'));var moment=require(_0xc207('0x1'));var BPromise=require(_0xc207('0x2'));var rs=require(_0xc207('0x3'));var fs=require('fs');var Redis=require(_0xc207('0x4'));var db=require(_0xc207('0x5'))['db'];var utils=require(_0xc207('0x6'));var logger=require('../../config/logger')(_0xc207('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc207('0x8')]({'port':0x232a});config[_0xc207('0x9')]=_[_0xc207('0xa')](config['redis'],{'host':_0xc207('0xb'),'port':0x18eb});var socket=require(_0xc207('0xc'))(new Redis(config[_0xc207('0x9')]));require('./faxMessage.socket')[_0xc207('0xd')](socket);function respondWithRpcPromise(_0x817576,_0x216e14,_0x13ec41){return new BPromise(function(_0x201162,_0x347549){return client['request'](_0x817576,_0x13ec41)['then'](function(_0x5b556f){logger[_0xc207('0xe')]('FaxMessage,\x20%s,\x20%s',_0x216e14,_0xc207('0xf'));logger[_0xc207('0x10')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x216e14,_0xc207('0xf'),JSON[_0xc207('0x11')](_0x5b556f));if(_0x5b556f[_0xc207('0x12')]){if(_0x5b556f[_0xc207('0x12')][_0xc207('0x13')]===0x1f4){logger['error'](_0xc207('0x14'),_0x216e14,_0x5b556f[_0xc207('0x12')][_0xc207('0x15')]);return _0x347549(_0x5b556f[_0xc207('0x12')]['message']);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x216e14,_0x5b556f[_0xc207('0x12')][_0xc207('0x15')]);return _0x201162(_0x5b556f[_0xc207('0x12')][_0xc207('0x15')]);}else{logger['info'](_0xc207('0x14'),_0x216e14,_0xc207('0xf'));_0x201162(_0x5b556f[_0xc207('0x16')]['message']);}})[_0xc207('0x17')](function(_0x488cc0){logger[_0xc207('0x12')](_0xc207('0x14'),_0x216e14,_0x488cc0);_0x347549(_0x488cc0);});});}exports[_0xc207('0x18')]=function(_0x461f6a){var _0xce0770=this;return new Promise(function(_0x2caec5,_0x35c0b0){return db[_0xc207('0x19')][_0xc207('0x1a')](_0x461f6a[_0xc207('0x1b')],{'raw':_0x461f6a[_0xc207('0x1c')]?_0x461f6a[_0xc207('0x1c')][_0xc207('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x163b36){logger['info'](_0xc207('0x18'),_0x461f6a);logger[_0xc207('0x10')](_0xc207('0x18'),_0x461f6a,JSON[_0xc207('0x11')](_0x163b36));_0x2caec5(_0x163b36);})[_0xc207('0x17')](function(_0xd209ac){logger[_0xc207('0x12')](_0xc207('0x18'),_0xd209ac[_0xc207('0x15')],_0x461f6a);_0x35c0b0(_0xce0770[_0xc207('0x12')](0x1f4,_0xd209ac[_0xc207('0x15')]));});});};exports[_0xc207('0x1e')]=function(_0x3f738e){var _0x138970=this;return new Promise(function(_0x1445d3,_0x56a066){return db[_0xc207('0x19')]['update'](_0x3f738e['body'],{'raw':_0x3f738e[_0xc207('0x1c')]?_0x3f738e[_0xc207('0x1c')][_0xc207('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f738e[_0xc207('0x1c')]?_0x3f738e[_0xc207('0x1c')]['where']||null:null,'attributes':_0x3f738e[_0xc207('0x1c')]?_0x3f738e[_0xc207('0x1c')][_0xc207('0x1f')]||null:null,'limit':_0x3f738e[_0xc207('0x1c')]?_0x3f738e[_0xc207('0x1c')][_0xc207('0x20')]||null:null})[_0xc207('0x21')](function(_0x27bc72){logger[_0xc207('0xe')](_0xc207('0x1e'),_0x3f738e);logger[_0xc207('0x10')](_0xc207('0x1e'),_0x3f738e,JSON[_0xc207('0x11')](_0x27bc72));_0x1445d3(_0x27bc72);})['catch'](function(_0x1cc799){logger[_0xc207('0x12')](_0xc207('0x1e'),_0x1cc799[_0xc207('0x15')],_0x3f738e);_0x56a066(_0x138970[_0xc207('0x12')](0x1f4,_0x1cc799[_0xc207('0x15')]));});});}; \ No newline at end of file +var _0x668b=['./faxMessage.socket','register','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateFaxMessage','FaxMessage','create','body','raw','UpdateFaxMessage','update','options','where','attributes','limit','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost'];(function(_0x7a8171,_0x48b785){var _0x572df5=function(_0x4f45c6){while(--_0x4f45c6){_0x7a8171['push'](_0x7a8171['shift']());}};_0x572df5(++_0x48b785);}(_0x668b,0x140));var _0xb668=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x668b[_0x3899d1];return _0xeb4a7d;};'use strict';var _=require(_0xb668('0x0'));var util=require(_0xb668('0x1'));var moment=require('moment');var BPromise=require(_0xb668('0x2'));var rs=require(_0xb668('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb668('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb668('0x5'))(_0xb668('0x6'));var config=require(_0xb668('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb668('0x8')][_0xb668('0x9')]({'port':0x232a});config[_0xb668('0xa')]=_[_0xb668('0xb')](config[_0xb668('0xa')],{'host':_0xb668('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb668('0xa')]));require(_0xb668('0xd'))[_0xb668('0xe')](socket);function respondWithRpcPromise(_0x16d50d,_0x39b79c,_0x3606a7){return new BPromise(function(_0x45bc39,_0x3616e9){return client['request'](_0x16d50d,_0x3606a7)[_0xb668('0xf')](function(_0x27dbf7){logger[_0xb668('0x10')](_0xb668('0x11'),_0x39b79c,_0xb668('0x12'));logger[_0xb668('0x13')](_0xb668('0x14'),_0x39b79c,_0xb668('0x12'),JSON[_0xb668('0x15')](_0x27dbf7));if(_0x27dbf7[_0xb668('0x16')]){if(_0x27dbf7[_0xb668('0x16')][_0xb668('0x17')]===0x1f4){logger[_0xb668('0x16')](_0xb668('0x11'),_0x39b79c,_0x27dbf7[_0xb668('0x16')][_0xb668('0x18')]);return _0x3616e9(_0x27dbf7[_0xb668('0x16')][_0xb668('0x18')]);}logger[_0xb668('0x16')](_0xb668('0x11'),_0x39b79c,_0x27dbf7[_0xb668('0x16')][_0xb668('0x18')]);return _0x45bc39(_0x27dbf7['error'][_0xb668('0x18')]);}else{logger['info'](_0xb668('0x11'),_0x39b79c,_0xb668('0x12'));_0x45bc39(_0x27dbf7['result'][_0xb668('0x18')]);}})[_0xb668('0x19')](function(_0x53ff78){logger[_0xb668('0x16')]('FaxMessage,\x20%s,\x20%s',_0x39b79c,_0x53ff78);_0x3616e9(_0x53ff78);});});}exports[_0xb668('0x1a')]=function(_0x178a5d){var _0x253ba5=this;return new Promise(function(_0x12805a,_0x5d33ae){return db[_0xb668('0x1b')][_0xb668('0x1c')](_0x178a5d[_0xb668('0x1d')],{'raw':_0x178a5d['options']?_0x178a5d['options'][_0xb668('0x1e')]===undefined?!![]:![]:!![]})[_0xb668('0xf')](function(_0x517eee){logger[_0xb668('0x10')]('CreateFaxMessage',_0x178a5d);logger[_0xb668('0x13')]('CreateFaxMessage',_0x178a5d,JSON[_0xb668('0x15')](_0x517eee));_0x12805a(_0x517eee);})[_0xb668('0x19')](function(_0x3f84c7){logger[_0xb668('0x16')](_0xb668('0x1a'),_0x3f84c7[_0xb668('0x18')],_0x178a5d);_0x5d33ae(_0x253ba5['error'](0x1f4,_0x3f84c7[_0xb668('0x18')]));});});};exports[_0xb668('0x1f')]=function(_0x2ab8c2){var _0x49abfd=this;return new Promise(function(_0x5e0cee,_0xe62fce){return db[_0xb668('0x1b')][_0xb668('0x20')](_0x2ab8c2['body'],{'raw':_0x2ab8c2[_0xb668('0x21')]?_0x2ab8c2[_0xb668('0x21')][_0xb668('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ab8c2['options']?_0x2ab8c2['options'][_0xb668('0x22')]||null:null,'attributes':_0x2ab8c2[_0xb668('0x21')]?_0x2ab8c2['options'][_0xb668('0x23')]||null:null,'limit':_0x2ab8c2[_0xb668('0x21')]?_0x2ab8c2[_0xb668('0x21')][_0xb668('0x24')]||null:null})[_0xb668('0xf')](function(_0x5f36b5){logger[_0xb668('0x10')](_0xb668('0x1f'),_0x2ab8c2);logger['debug'](_0xb668('0x1f'),_0x2ab8c2,JSON['stringify'](_0x5f36b5));_0x5e0cee(_0x5f36b5);})[_0xb668('0x19')](function(_0x406cc5){logger[_0xb668('0x16')](_0xb668('0x1f'),_0x406cc5[_0xb668('0x18')],_0x2ab8c2);_0xe62fce(_0x49abfd[_0xb668('0x16')](0x1f4,_0x406cc5[_0xb668('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 9351fc8..2a6de47 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 _0x1699=['register','length','faxMessage:','./faxMessage.events','update','emit','removeListener'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x1699,0x1d8));var _0x9169=function(_0x103704,_0x32bc49){_0x103704=_0x103704-0x0;var _0x51c6d1=_0x1699[_0x103704];return _0x51c6d1;};'use strict';var FaxMessageEvents=require(_0x9169('0x0'));var events=['save','remove',_0x9169('0x1')];function createListener(_0x53365b,_0x23afb3){return function(_0x10bfc1){_0x23afb3[_0x9169('0x2')](_0x53365b,_0x10bfc1);};}function removeListener(_0x392c08,_0x357048){return function(){FaxMessageEvents[_0x9169('0x3')](_0x392c08,_0x357048);};}exports[_0x9169('0x4')]=function(_0x62feb3){for(var _0x439f48=0x0,_0x2fd096=events[_0x9169('0x5')];_0x439f48<_0x2fd096;_0x439f48++){var _0x17fa63=events[_0x439f48];var _0x388ea3=createListener(_0x9169('0x6')+_0x17fa63,_0x62feb3);FaxMessageEvents['on'](_0x17fa63,_0x388ea3);}}; \ No newline at end of file +var _0x10ee=['length','faxMessage:','./faxMessage.events','save','update','removeListener','register'];(function(_0x3a6701,_0x52dfc2){var _0x411fee=function(_0x42c1da){while(--_0x42c1da){_0x3a6701['push'](_0x3a6701['shift']());}};_0x411fee(++_0x52dfc2);}(_0x10ee,0x95));var _0xe10e=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x10ee[_0x27af45];return _0x18df21;};'use strict';var FaxMessageEvents=require(_0xe10e('0x0'));var events=[_0xe10e('0x1'),'remove',_0xe10e('0x2')];function createListener(_0x302bcb,_0x599d98){return function(_0x2fb9d0){_0x599d98['emit'](_0x302bcb,_0x2fb9d0);};}function removeListener(_0x1a4eca,_0x55fb23){return function(){FaxMessageEvents[_0xe10e('0x3')](_0x1a4eca,_0x55fb23);};}exports[_0xe10e('0x4')]=function(_0x58b05f){for(var _0x50c14b=0x0,_0x44efb9=events[_0xe10e('0x5')];_0x50c14b<_0x44efb9;_0x50c14b++){var _0x408645=events[_0x50c14b];var _0x492039=createListener(_0xe10e('0x6')+_0x408645,_0x58b05f);FaxMessageEvents['on'](_0x408645,_0x492039);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index ecefe35..eae516a 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 _0xcb91=['faxmessage:create','create','put','/:id/accept','accept','/:id/reject','reject','delete','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','get','index','isAuthenticated','describe','/:id','/:id/download','download','post','tracked','fax'];(function(_0x1c787b,_0x14b840){var _0x29ae9b=function(_0x5a94d2){while(--_0x5a94d2){_0x1c787b['push'](_0x1c787b['shift']());}};_0x29ae9b(++_0x14b840);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xcb91[_0x4d613c];return _0x301fe3;};'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');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0x7')](_0x1cb9('0xc'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xd')]);router[_0x1cb9('0xe')]('/',auth['isAuthenticated'](),interaction[_0x1cb9('0xf')](_0x1cb9('0x10'),_0x1cb9('0x11')),controller[_0x1cb9('0x12')]);router[_0x1cb9('0x13')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x1cb9('0x13')](_0x1cb9('0x14'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x15')]);router['put'](_0x1cb9('0x16'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x17')]);router[_0x1cb9('0x18')](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x1cb9('0x19')]=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(_0x414da4,_0xc85c84){var _0x1b8504=function(_0x26686f){while(--_0x26686f){_0x414da4['push'](_0x414da4['shift']());}};_0x1b8504(++_0xc85c84);}(_0x4522,0x1a0));var _0x2452=function(_0x8b6a30,_0x1f809f){_0x8b6a30=_0x8b6a30-0x0;var _0x4d3579=_0x4522[_0x8b6a30];return _0x4d3579;};'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 17ebdfb..90d4ec3 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 _0xe0e8=['STRING','INTEGER','ENUM','beepall','roundrobin','sequelize'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0xe0e8,0xe9));var _0x8e0e=function(_0x266bc0,_0x350826){_0x266bc0=_0x266bc0-0x0;var _0x5dd6b8=_0xe0e8[_0x266bc0];return _0x5dd6b8;};'use strict';var Sequelize=require(_0x8e0e('0x0'));module['exports']={'name':{'type':Sequelize[_0x8e0e('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8e0e('0x1')]},'timeout':{'type':Sequelize[_0x8e0e('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8e0e('0x3')]('rrmemory',_0x8e0e('0x4'),_0x8e0e('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x8e0e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x782b=['beepall','roundrobin','STRING','INTEGER','ENUM'];(function(_0x2c1972,_0x17144c){var _0x153125=function(_0x2d7ae4){while(--_0x2d7ae4){_0x2c1972['push'](_0x2c1972['shift']());}};_0x153125(++_0x17144c);}(_0x782b,0x89));var _0xb782=function(_0x552284,_0x4ddb09){_0x552284=_0x552284-0x0;var _0x4ac092=_0x782b[_0x552284];return _0x4ac092;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb782('0x0')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb782('0x0')]},'timeout':{'type':Sequelize[_0xb782('0x1')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb782('0x2')]('rrmemory',_0xb782('0x3'),_0xb782('0x4')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xb782('0x1')],'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 0dc17e3..1f2c37e 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 _0xce73=['filters','intersection','fields','attributes','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','keys','includeAll','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','findOne','UserFaxQueue','length','hasOwnProperty','FaxQueueId','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','team_has_fax_queues','join','user_has_teams','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','sequelize','SELECT','every','TeamId','includes','all','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','util','to-csv','ejs','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','../../mysqldb','defaults','redis','localhost','end','status','json','undefined','count','offset','limit','set','apply','save','update','then','destroy','get','FaxQueues','UserProfileResource','error','stack','name','send','map','FaxQueue','rawAttributes','fieldName','type','key','model','query'];(function(_0xbf25e3,_0x52eb52){var _0x38edf0=function(_0x1e077c){while(--_0x1e077c){_0xbf25e3['push'](_0xbf25e3['shift']());}};_0x38edf0(++_0x52eb52);}(_0xce73,0x16e));var _0x3ce7=function(_0x34556c,_0x4f5326){_0x34556c=_0x34556c-0x0;var _0x288635=_0xce73[_0x34556c];return _0x288635;};'use strict';var emlformat=require(_0x3ce7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3ce7('0x1'));var jsonpatch=require(_0x3ce7('0x2'));var rp=require(_0x3ce7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3ce7('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x3ce7('0x5'));var ejs=require(_0x3ce7('0x6'));var fs=require('fs');var fs_extra=require(_0x3ce7('0x7'));var _=require('lodash');var squel=require(_0x3ce7('0x8'));var crypto=require(_0x3ce7('0x9'));var jsforce=require(_0x3ce7('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x3ce7('0x5'));var querystring=require(_0x3ce7('0xb'));var Papa=require(_0x3ce7('0xc'));var Redis=require(_0x3ce7('0xd'));var authService=require(_0x3ce7('0xe'));var qs=require(_0x3ce7('0xf'));var as=require(_0x3ce7('0x10'));var hardwareService=require(_0x3ce7('0x11'));var logger=require(_0x3ce7('0x12'))(_0x3ce7('0x13'));var utils=require(_0x3ce7('0x14'));var config=require(_0x3ce7('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3ce7('0x16'))['db'];config['redis']=_[_0x3ce7('0x17')](config[_0x3ce7('0x18')],{'host':_0x3ce7('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3ce7('0x18')]));require('./faxQueue.socket')['register'](socket);function respondWithStatusCode(_0x4e4edd,_0x17af4a){_0x17af4a=_0x17af4a||0xcc;return function(_0x3663d5){if(_0x3663d5){return _0x4e4edd['sendStatus'](_0x17af4a);}return _0x4e4edd['status'](_0x17af4a)[_0x3ce7('0x1a')]();};}function respondWithResult(_0x49412f,_0x1d0f00){_0x1d0f00=_0x1d0f00||0xc8;return function(_0x26d5d8){if(_0x26d5d8){return _0x49412f[_0x3ce7('0x1b')](_0x1d0f00)[_0x3ce7('0x1c')](_0x26d5d8);}};}function respondWithFilteredResult(_0x5d4317,_0x66ecaf){return function(_0x14b956){if(_0x14b956){var _0x19eaa3=typeof _0x66ecaf['offset']===_0x3ce7('0x1d')&&typeof _0x66ecaf['limit']===_0x3ce7('0x1d');var _0x9f035b=_0x14b956[_0x3ce7('0x1e')];var _0x4ac520=_0x19eaa3?0x0:_0x66ecaf[_0x3ce7('0x1f')];var _0x32a8ca=_0x19eaa3?_0x14b956[_0x3ce7('0x1e')]:_0x66ecaf[_0x3ce7('0x1f')]+_0x66ecaf[_0x3ce7('0x20')];var _0x3f7e6;if(_0x32a8ca>=_0x9f035b){_0x32a8ca=_0x9f035b;_0x3f7e6=0xc8;}else{_0x3f7e6=0xce;}_0x5d4317[_0x3ce7('0x1b')](_0x3f7e6);return _0x5d4317[_0x3ce7('0x21')]('Content-Range',_0x4ac520+'-'+_0x32a8ca+'/'+_0x9f035b)[_0x3ce7('0x1c')](_0x14b956);}return null;};}function patchUpdates(_0x36d4f1){return function(_0x5ed7d2){try{jsonpatch[_0x3ce7('0x22')](_0x5ed7d2,_0x36d4f1,!![]);}catch(_0xa3d8b7){return BPromise['reject'](_0xa3d8b7);}return _0x5ed7d2[_0x3ce7('0x23')]();};}function saveUpdates(_0x2247e2,_0x5eff5e){return function(_0x31555b){if(_0x31555b){return _0x31555b[_0x3ce7('0x24')](_0x2247e2)[_0x3ce7('0x25')](function(_0x50e695){return _0x50e695;});}return null;};}function removeEntity(_0x2f5195,_0x5903da){return function(_0x150b87){if(_0x150b87){return _0x150b87[_0x3ce7('0x26')]()['then'](function(){var _0x645970=_0x150b87[_0x3ce7('0x27')]({'plain':!![]});var _0x34300e=_0x3ce7('0x28');return db[_0x3ce7('0x29')][_0x3ce7('0x26')]({'where':{'type':_0x34300e,'resourceId':_0x645970['id']}})[_0x3ce7('0x25')](function(){return _0x150b87;});})[_0x3ce7('0x25')](function(){_0x2f5195[_0x3ce7('0x1b')](0xcc)[_0x3ce7('0x1a')]();});}};}function handleEntityNotFound(_0x4557bf,_0xc9eb18){return function(_0x2d04a6){if(!_0x2d04a6){_0x4557bf['sendStatus'](0x194);}return _0x2d04a6;};}function handleError(_0x74f33b,_0x1dd244){_0x1dd244=_0x1dd244||0x1f4;return function(_0x2d42bb){logger[_0x3ce7('0x2a')](_0x2d42bb[_0x3ce7('0x2b')]);if(_0x2d42bb[_0x3ce7('0x2c')]){delete _0x2d42bb[_0x3ce7('0x2c')];}_0x74f33b[_0x3ce7('0x1b')](_0x1dd244)[_0x3ce7('0x2d')](_0x2d42bb);};}exports['index']=function(_0x2ef623,_0x305cf6){var _0x3672ed={},_0x20f93e={},_0x3c8e13={'count':0x0,'rows':[]};var _0x54b012=_[_0x3ce7('0x2e')](db[_0x3ce7('0x2f')][_0x3ce7('0x30')],function(_0x511af3){return{'name':_0x511af3[_0x3ce7('0x31')],'type':_0x511af3[_0x3ce7('0x32')][_0x3ce7('0x33')]};});_0x20f93e[_0x3ce7('0x34')]=_[_0x3ce7('0x2e')](_0x54b012,'name');_0x20f93e[_0x3ce7('0x35')]=_['keys'](_0x2ef623[_0x3ce7('0x35')]);_0x20f93e[_0x3ce7('0x36')]=_[_0x3ce7('0x37')](_0x20f93e[_0x3ce7('0x34')],_0x20f93e[_0x3ce7('0x35')]);_0x3672ed['attributes']=_[_0x3ce7('0x37')](_0x20f93e[_0x3ce7('0x34')],qs[_0x3ce7('0x38')](_0x2ef623[_0x3ce7('0x35')][_0x3ce7('0x38')]));_0x3672ed[_0x3ce7('0x39')]=_0x3672ed['attributes']['length']?_0x3672ed[_0x3ce7('0x39')]:_0x20f93e[_0x3ce7('0x34')];if(!_0x2ef623[_0x3ce7('0x35')]['hasOwnProperty'](_0x3ce7('0x3a'))){_0x3672ed[_0x3ce7('0x20')]=qs['limit'](_0x2ef623['query'][_0x3ce7('0x20')]);_0x3672ed[_0x3ce7('0x1f')]=qs[_0x3ce7('0x1f')](_0x2ef623['query'][_0x3ce7('0x1f')]);}_0x3672ed[_0x3ce7('0x3b')]=qs[_0x3ce7('0x3c')](_0x2ef623[_0x3ce7('0x35')][_0x3ce7('0x3c')]);_0x3672ed['where']=qs[_0x3ce7('0x36')](_[_0x3ce7('0x3d')](_0x2ef623[_0x3ce7('0x35')],_0x20f93e[_0x3ce7('0x36')]),_0x54b012);if(_0x2ef623[_0x3ce7('0x35')][_0x3ce7('0x3e')]){_0x3672ed['where']=_['merge'](_0x3672ed[_0x3ce7('0x3f')],{'$or':_[_0x3ce7('0x2e')](_0x54b012,function(_0x10cda8){if(_0x10cda8[_0x3ce7('0x32')]!==_0x3ce7('0x40')){var _0x222d75={};_0x222d75[_0x10cda8['name']]={'$like':'%'+_0x2ef623[_0x3ce7('0x35')][_0x3ce7('0x3e')]+'%'};return _0x222d75;}})});}_0x3672ed=_[_0x3ce7('0x41')]({},_0x3672ed,_0x2ef623[_0x3ce7('0x42')]);var _0x247eab={'where':_0x3672ed[_0x3ce7('0x3f')]};return db['FaxQueue'][_0x3ce7('0x1e')](_0x247eab)[_0x3ce7('0x25')](function(_0x47ec61){_0x3c8e13[_0x3ce7('0x1e')]=_0x47ec61;if(_0x2ef623[_0x3ce7('0x35')]['includeAll']){_0x3672ed[_0x3ce7('0x43')]=[{'all':!![]}];}return db['FaxQueue'][_0x3ce7('0x44')](_0x3672ed);})[_0x3ce7('0x25')](function(_0x10b5cb){_0x3c8e13[_0x3ce7('0x45')]=_0x10b5cb;return _0x3c8e13;})['then'](respondWithFilteredResult(_0x305cf6,_0x3672ed))[_0x3ce7('0x46')](handleError(_0x305cf6,null));};exports[_0x3ce7('0x47')]=function(_0x9ebe04,_0x3c7d58){var _0x4aa51d={'raw':!![],'where':{'id':_0x9ebe04[_0x3ce7('0x48')]['id']}},_0x4b816b={};_0x4b816b[_0x3ce7('0x34')]=_[_0x3ce7('0x49')](db[_0x3ce7('0x2f')]['rawAttributes']);_0x4b816b['query']=_[_0x3ce7('0x49')](_0x9ebe04[_0x3ce7('0x35')]);_0x4b816b['filters']=_[_0x3ce7('0x37')](_0x4b816b[_0x3ce7('0x34')],_0x4b816b[_0x3ce7('0x35')]);_0x4aa51d['attributes']=_[_0x3ce7('0x37')](_0x4b816b['model'],qs[_0x3ce7('0x38')](_0x9ebe04[_0x3ce7('0x35')][_0x3ce7('0x38')]));_0x4aa51d[_0x3ce7('0x39')]=_0x4aa51d[_0x3ce7('0x39')]['length']?_0x4aa51d[_0x3ce7('0x39')]:_0x4b816b[_0x3ce7('0x34')];if(_0x9ebe04[_0x3ce7('0x35')][_0x3ce7('0x4a')]){_0x4aa51d[_0x3ce7('0x43')]=[{'all':!![]}];}_0x4aa51d=_[_0x3ce7('0x41')]({},_0x4aa51d,_0x9ebe04[_0x3ce7('0x42')]);return db[_0x3ce7('0x2f')][_0x3ce7('0x4b')](_0x4aa51d)[_0x3ce7('0x25')](handleEntityNotFound(_0x3c7d58,null))[_0x3ce7('0x25')](respondWithResult(_0x3c7d58,null))[_0x3ce7('0x46')](handleError(_0x3c7d58,null));};exports[_0x3ce7('0x4c')]=function(_0x1e257a,_0x5f4760){return db['FaxQueue']['create'](_0x1e257a[_0x3ce7('0x4d')],{})[_0x3ce7('0x25')](function(_0x2ab5dd){var _0x22dafd=_0x1e257a['user'][_0x3ce7('0x27')]({'plain':!![]});if(!_0x22dafd)throw new Error(_0x3ce7('0x4e'));if(_0x22dafd[_0x3ce7('0x4f')]===_0x3ce7('0x50')){var _0x3ed8c0=_0x2ab5dd[_0x3ce7('0x27')]({'plain':!![]});var _0x246885=_0x3ce7('0x28');return db['UserProfileSection'][_0x3ce7('0x4b')]({'where':{'name':_0x246885,'userProfileId':_0x22dafd[_0x3ce7('0x51')]},'raw':!![]})[_0x3ce7('0x25')](function(_0x1bdb4f){if(_0x1bdb4f&&_0x1bdb4f[_0x3ce7('0x52')]===0x0){return db[_0x3ce7('0x29')][_0x3ce7('0x4c')]({'name':_0x3ed8c0[_0x3ce7('0x2c')],'resourceId':_0x3ed8c0['id'],'type':_0x1bdb4f[_0x3ce7('0x2c')],'sectionId':_0x1bdb4f['id']},{})[_0x3ce7('0x25')](function(){return _0x2ab5dd;});}else{return _0x2ab5dd;}})[_0x3ce7('0x46')](function(_0x26911d){logger['error'](_0x3ce7('0x53'),_0x26911d);throw _0x26911d;});}return _0x2ab5dd;})[_0x3ce7('0x25')](respondWithResult(_0x5f4760,0xc9))['catch'](handleError(_0x5f4760,null));};exports['update']=function(_0x14ef80,_0x2d786a){if(_0x14ef80[_0x3ce7('0x4d')]['id']){delete _0x14ef80[_0x3ce7('0x4d')]['id'];}return db['FaxQueue'][_0x3ce7('0x4b')]({'where':{'id':_0x14ef80['params']['id']}})['then'](handleEntityNotFound(_0x2d786a,null))[_0x3ce7('0x25')](saveUpdates(_0x14ef80['body'],null))[_0x3ce7('0x25')](respondWithResult(_0x2d786a,null))[_0x3ce7('0x46')](handleError(_0x2d786a,null));};exports[_0x3ce7('0x26')]=function(_0x8cd169,_0x2a8f28){return db['FaxQueue'][_0x3ce7('0x4b')]({'where':{'id':_0x8cd169[_0x3ce7('0x48')]['id']}})['then'](handleEntityNotFound(_0x2a8f28,null))[_0x3ce7('0x25')](removeEntity(_0x2a8f28,null))['catch'](handleError(_0x2a8f28,null));};exports[_0x3ce7('0x54')]=function(_0x5a2aad,_0xbedd26){return db[_0x3ce7('0x2f')][_0x3ce7('0x54')]()['then'](respondWithResult(_0xbedd26,null))[_0x3ce7('0x46')](handleError(_0xbedd26,null));};exports['getMembers']=function(_0xb0f0c,_0x5ea62f,_0x513515){var _0x453a5f={'raw':!![],'where':{}},_0x3620da={},_0x5169fa;return db[_0x3ce7('0x2f')][_0x3ce7('0x55')]({'where':{'id':_0xb0f0c['params']['id']}})[_0x3ce7('0x25')](handleEntityNotFound(_0x5ea62f,null))[_0x3ce7('0x25')](function(_0x396820){if(_0x396820){_0x5169fa=_0x396820[_0x3ce7('0x27')]({'plain':!![]});_0x3620da['model']=_['keys'](db[_0x3ce7('0x56')][_0x3ce7('0x30')]);_0x3620da[_0x3ce7('0x35')]=_[_0x3ce7('0x49')](_0xb0f0c[_0x3ce7('0x35')]);_0x3620da[_0x3ce7('0x36')]=_[_0x3ce7('0x37')](_0x3620da[_0x3ce7('0x34')],_0x3620da[_0x3ce7('0x35')]);_0x453a5f[_0x3ce7('0x39')]=_[_0x3ce7('0x37')](_0x3620da[_0x3ce7('0x34')],qs[_0x3ce7('0x38')](_0xb0f0c[_0x3ce7('0x35')][_0x3ce7('0x38')]));_0x453a5f[_0x3ce7('0x39')]=_0x453a5f[_0x3ce7('0x39')][_0x3ce7('0x57')]?_0x453a5f[_0x3ce7('0x39')]:_0x3620da[_0x3ce7('0x34')];if(!_0xb0f0c['query'][_0x3ce7('0x58')](_0x3ce7('0x3a'))){_0x453a5f[_0x3ce7('0x20')]=qs[_0x3ce7('0x20')](_0xb0f0c[_0x3ce7('0x35')][_0x3ce7('0x20')]);_0x453a5f['offset']=qs[_0x3ce7('0x1f')](_0xb0f0c['query']['offset']);}_0x453a5f[_0x3ce7('0x3b')]=qs[_0x3ce7('0x3c')](_0xb0f0c[_0x3ce7('0x35')][_0x3ce7('0x3c')]);_0x453a5f['where']=qs[_0x3ce7('0x36')](_[_0x3ce7('0x3d')](_0xb0f0c[_0x3ce7('0x35')],_0x3620da[_0x3ce7('0x36')]));_0x453a5f[_0x3ce7('0x3f')][_0x3ce7('0x59')]=_0x396820['id'];if(_0xb0f0c['query']['filter']){_0x453a5f['where']=_[_0x3ce7('0x41')](_0x453a5f['where'],{'$or':_['map'](_0x453a5f[_0x3ce7('0x39')],function(_0x14f87b){var _0x756755={};_0x756755[_0x14f87b]={'$like':'%'+_0xb0f0c[_0x3ce7('0x35')][_0x3ce7('0x3e')]+'%'};return _0x756755;})});}_0x453a5f=_[_0x3ce7('0x41')]({},_0x453a5f,_0xb0f0c[_0x3ce7('0x42')]);return db[_0x3ce7('0x56')][_0x3ce7('0x44')](_0x453a5f);}})[_0x3ce7('0x25')](function(_0xb98ce){if(_0xb98ce){return db[_0x3ce7('0x5a')][_0x3ce7('0x5b')]({'where':{'id':_[_0x3ce7('0x2e')](_0xb98ce,_0x3ce7('0x5c')),'role':_0x3ce7('0x5d')},'attributes':['id','name',_0x3ce7('0x5e'),_0x3ce7('0x5f'),_0x3ce7('0x60')]});}})[_0x3ce7('0x25')](function(_0x8a9c28){if(_0x8a9c28){return{'count':_0x8a9c28[_0x3ce7('0x1e')],'rows':_[_0x3ce7('0x2e')](_0x8a9c28['rows'],function(_0x417340){return{'membername':_0x417340[_0x3ce7('0x2c')],'UserId':_0x417340['id'],'queue_name':_0x5169fa[_0x3ce7('0x2c')],'FaxQueueId':_0x5169fa['id'],'interface':util[_0x3ce7('0x61')](_0x3ce7('0x62'),_0x3ce7('0x63'),_0x417340[_0x3ce7('0x2c')]),'penalty':0x0,'paused':_0x417340[_0x3ce7('0x5e')],'createdAt':_0x417340[_0x3ce7('0x60')],'updatedAt':_0x417340[_0x3ce7('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3ce7('0x25')](respondWithFilteredResult(_0x5ea62f,_0x453a5f))[_0x3ce7('0x46')](handleError(_0x5ea62f,null));};exports['getTeams']=function(_0x46d725,_0x10640f,_0x25c1b3){var _0x21bbb6={};var _0x15b9e0={};var _0x113fda;var _0x3d2ca8;return db[_0x3ce7('0x2f')][_0x3ce7('0x55')]({'where':{'id':_0x46d725[_0x3ce7('0x48')]['id']}})['then'](handleEntityNotFound(_0x10640f,null))[_0x3ce7('0x25')](function(_0x395b9a){if(_0x395b9a){_0x113fda=_0x395b9a;_0x15b9e0[_0x3ce7('0x34')]=_[_0x3ce7('0x49')](db[_0x3ce7('0x64')][_0x3ce7('0x30')]);_0x15b9e0['query']=_[_0x3ce7('0x49')](_0x46d725[_0x3ce7('0x35')]);_0x15b9e0[_0x3ce7('0x36')]=_[_0x3ce7('0x37')](_0x15b9e0['model'],_0x15b9e0['query']);_0x21bbb6['attributes']=_[_0x3ce7('0x37')](_0x15b9e0[_0x3ce7('0x34')],qs[_0x3ce7('0x38')](_0x46d725[_0x3ce7('0x35')][_0x3ce7('0x38')]));_0x21bbb6[_0x3ce7('0x39')]=_0x21bbb6['attributes'][_0x3ce7('0x57')]?_0x21bbb6[_0x3ce7('0x39')]:_0x15b9e0[_0x3ce7('0x34')];_0x21bbb6[_0x3ce7('0x3b')]=qs[_0x3ce7('0x3c')](_0x46d725['query'][_0x3ce7('0x3c')]);_0x21bbb6['where']=qs['filters'](_[_0x3ce7('0x3d')](_0x46d725[_0x3ce7('0x35')],_0x15b9e0[_0x3ce7('0x36')]));if(_0x46d725[_0x3ce7('0x35')]['filter']){_0x21bbb6[_0x3ce7('0x3f')]=_[_0x3ce7('0x41')](_0x21bbb6[_0x3ce7('0x3f')],{'$or':_[_0x3ce7('0x2e')](_0x21bbb6[_0x3ce7('0x39')],function(_0x23307e){var _0x18bad6={};_0x18bad6[_0x23307e]={'$like':'%'+_0x46d725['query'][_0x3ce7('0x3e')]+'%'};return _0x18bad6;})});}_0x21bbb6=_[_0x3ce7('0x41')]({},_0x21bbb6,_0x46d725[_0x3ce7('0x42')]);return _0x113fda[_0x3ce7('0x65')](_0x21bbb6);}})[_0x3ce7('0x25')](function(_0x2bfd45){if(_0x2bfd45){_0x3d2ca8=_0x2bfd45[_0x3ce7('0x57')];if(!_0x46d725['query'][_0x3ce7('0x58')](_0x3ce7('0x3a'))){_0x21bbb6[_0x3ce7('0x20')]=qs[_0x3ce7('0x20')](_0x46d725[_0x3ce7('0x35')][_0x3ce7('0x20')]);_0x21bbb6[_0x3ce7('0x1f')]=qs['offset'](_0x46d725[_0x3ce7('0x35')][_0x3ce7('0x1f')]);}return _0x113fda['getTeams'](_0x21bbb6);}})[_0x3ce7('0x25')](function(_0xc9161d){if(_0xc9161d){return _0xc9161d?{'count':_0x3d2ca8,'rows':_0xc9161d}:null;}})[_0x3ce7('0x25')](respondWithResult(_0x10640f,null))[_0x3ce7('0x46')](handleError(_0x10640f,null));};exports[_0x3ce7('0x66')]=function(_0xee2574,_0x38c1bd,_0x4e5532){var _0x3b6fc5=_0xee2574['body'][_0x3ce7('0x67')];return db[_0x3ce7('0x64')]['findAll']({'where':{'id':_0x3b6fc5},'attributes':['id'],'include':[{'model':db['User'],'as':_0x3ce7('0x68'),'attributes':['id','name',_0x3ce7('0x69'),_0x3ce7('0x6a'),_0x3ce7('0x6b')],'raw':!![]}]})[_0x3ce7('0x25')](function(_0x5508cb){if(_0x5508cb){var _0x2158ef=_[_0x3ce7('0x6c')](_0x5508cb,function(_0xfd0310){var _0xa63539=_0xfd0310['get']({'plain':!![]});return _0xa63539[_0x3ce7('0x68')];});return db[_0x3ce7('0x2f')][_0x3ce7('0x4b')]({'where':{'id':_0xee2574['params']['id']}})[_0x3ce7('0x25')](function(_0x3e88ee){return db['sequelize'][_0x3ce7('0x6d')](function(_0x3f44f7){return _0x3e88ee[_0x3ce7('0x66')](_0x3b6fc5,{'transaction':_0x3f44f7})['then'](function(){return BPromise[_0x3ce7('0x6e')](_0x2158ef,function(_0x16fac3){return db[_0x3ce7('0x56')][_0x3ce7('0x6f')]({'where':{'UserId':_0x16fac3['id'],'FaxQueueId':_0xee2574[_0x3ce7('0x48')]['id']},'transaction':_0x3f44f7});});})[_0x3ce7('0x25')](function(){_0x2158ef[_0x3ce7('0x70')](function(_0x2f0583){socket[_0x3ce7('0x71')](_0x3ce7('0x72'),{'UserId':_0x2f0583['id'],'FaxQueueId':_0x3e88ee['id']});});});});});}})[_0x3ce7('0x25')](respondWithStatusCode(_0x38c1bd,null))[_0x3ce7('0x46')](handleError(_0x38c1bd,null));};exports[_0x3ce7('0x73')]=function(_0x72a986,_0x54a3ee,_0x538c75){return db[_0x3ce7('0x64')][_0x3ce7('0x44')]({'where':{'id':_0x72a986[_0x3ce7('0x35')]['ids']},'attributes':['id'],'include':[{'model':db[_0x3ce7('0x5a')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x54a3ee,null))[_0x3ce7('0x25')](function(_0x595aae){var _0xa5c0a6=_[_0x3ce7('0x2e')](_0x595aae,'id');var _0x1656cb=[];var _0xb30af7=[];var _0x2d6c49=squel[_0x3ce7('0x74')]();_0x2d6c49[_0x3ce7('0x75')]('tq.TeamId')['from'](_0x3ce7('0x76'),'tq')[_0x3ce7('0x77')](_0x3ce7('0x78'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x3ce7('0x3f')](_0x3ce7('0x79'),_0x72a986[_0x3ce7('0x48')]['id']);for(var _0x4c3073=0x0;_0x4c3073<_0x595aae[_0x3ce7('0x57')];_0x4c3073+=0x1){let _0x74896=_0x595aae[_0x4c3073];for(var _0x48ee05=0x0;_0x48ee05<_0x74896[_0x3ce7('0x68')][_0x3ce7('0x57')];_0x48ee05+=0x1){let _0x57f8cf=_0x74896[_0x3ce7('0x68')][_0x48ee05];var _0x533c67=_0x2d6c49[_0x3ce7('0x7a')]();_0x533c67['where'](_0x3ce7('0x7b'),_0x57f8cf['id']);_0xb30af7['push'](db['sequelize'][_0x3ce7('0x35')](_0x533c67[_0x3ce7('0x7c')](),{'type':db[_0x3ce7('0x7d')]['QueryTypes'][_0x3ce7('0x7e')]})[_0x3ce7('0x25')](function(_0x31db55){if(_0x31db55[_0x3ce7('0x57')]===0x1){return _0x57f8cf['id'];}else{var _0x5f68ed=_[_0x3ce7('0x7f')](_[_0x3ce7('0x2e')](_0x31db55,_0x3ce7('0x80')),function(_0x4ec5e1){return _[_0x3ce7('0x81')](_0xa5c0a6,_0x4ec5e1);});if(_0x5f68ed){return _0x57f8cf['id'];}}}));}}return BPromise[_0x3ce7('0x82')](_0xb30af7)[_0x3ce7('0x25')](function(_0x58df70){_0x1656cb=_(_0x1656cb)['union'](_0x58df70)['compact']()[_0x3ce7('0x83')]();return db[_0x3ce7('0x2f')][_0x3ce7('0x4b')]({'where':{'id':_0x72a986[_0x3ce7('0x48')]['id']}})[_0x3ce7('0x25')](function(_0x49aac8){return db[_0x3ce7('0x7d')][_0x3ce7('0x6d')](function(_0x449b29){return _0x49aac8['removeTeams'](_0x72a986['query']['ids'],{'transaction':_0x449b29})[_0x3ce7('0x25')](function(){if(!_[_0x3ce7('0x84')](_0x1656cb)){return _0x49aac8[_0x3ce7('0x85')](_0x1656cb,{'transaction':_0x449b29});}})['then'](function(){_0x1656cb[_0x3ce7('0x70')](function(_0x5147e0){socket[_0x3ce7('0x71')](_0x3ce7('0x86'),{'UserId':_0x5147e0,'FaxQueueId':_0x49aac8['id']});});});});});});})[_0x3ce7('0x25')](respondWithStatusCode(_0x54a3ee,null))[_0x3ce7('0x46')](handleError(_0x54a3ee,null));};exports[_0x3ce7('0x87')]=function(_0x3e3b5b,_0x26faf4,_0x3462f2){return db[_0x3ce7('0x2f')][_0x3ce7('0x4b')]({'where':{'id':_0x3e3b5b[_0x3ce7('0x48')]['id']}})[_0x3ce7('0x25')](handleEntityNotFound(_0x26faf4,null))[_0x3ce7('0x25')](function(_0x8fa14b){if(_0x8fa14b){return _0x8fa14b[_0x3ce7('0x87')](_0x3e3b5b['body']['ids'],_[_0x3ce7('0x88')](_0x3e3b5b[_0x3ce7('0x4d')],['ids','id'])||{})[_0x3ce7('0x89')](function(_0x2d2e5b){for(var _0x259449=0x0;_0x259449<_0x3e3b5b[_0x3ce7('0x4d')][_0x3ce7('0x67')][_0x3ce7('0x57')];_0x259449+=0x1){socket['emit'](_0x3ce7('0x72'),{'UserId':Number(_0x3e3b5b[_0x3ce7('0x4d')][_0x3ce7('0x67')][_0x259449]),'FaxQueueId':Number(_0x3e3b5b[_0x3ce7('0x48')]['id'])});}return _0x2d2e5b;});}})[_0x3ce7('0x25')](respondWithResult(_0x26faf4,null))[_0x3ce7('0x46')](handleError(_0x26faf4,null));};exports['removeAgents']=function(_0x5484cc,_0x39bc99,_0x33d374){return db[_0x3ce7('0x2f')][_0x3ce7('0x4b')]({'where':{'id':_0x5484cc['params']['id']}})[_0x3ce7('0x25')](handleEntityNotFound(_0x39bc99,null))['then'](function(_0x27b741){if(_0x27b741){return _0x27b741['removeAgents'](_0x5484cc[_0x3ce7('0x35')][_0x3ce7('0x67')])[_0x3ce7('0x25')](function(){if(_[_0x3ce7('0x8a')](_0x5484cc[_0x3ce7('0x35')][_0x3ce7('0x67')])){for(var _0xb0a86=0x0;_0xb0a86<_0x5484cc['query'][_0x3ce7('0x67')][_0x3ce7('0x57')];_0xb0a86+=0x1){socket[_0x3ce7('0x71')](_0x3ce7('0x86'),{'UserId':Number(_0x5484cc['query'][_0x3ce7('0x67')][_0xb0a86]),'FaxQueueId':Number(_0x5484cc[_0x3ce7('0x48')]['id'])});}}else{socket[_0x3ce7('0x71')](_0x3ce7('0x86'),{'UserId':Number(_0x5484cc[_0x3ce7('0x35')][_0x3ce7('0x67')]),'FaxQueueId':Number(_0x5484cc[_0x3ce7('0x48')]['id'])});}});}})[_0x3ce7('0x25')](respondWithStatusCode(_0x39bc99,null))['catch'](handleError(_0x39bc99,null));};exports[_0x3ce7('0x8b')]=function(_0xed2d7f,_0x4537bb,_0x50c78b){var _0x119f4f={};var _0x328777={};var _0x571a2f;var _0xf90c7f;return db[_0x3ce7('0x2f')][_0x3ce7('0x55')]({'where':{'id':_0xed2d7f[_0x3ce7('0x48')]['id']}})[_0x3ce7('0x25')](handleEntityNotFound(_0x4537bb,null))[_0x3ce7('0x25')](function(_0x4f7882){if(_0x4f7882){_0x571a2f=_0x4f7882;_0x328777[_0x3ce7('0x34')]=_['keys'](db[_0x3ce7('0x5a')][_0x3ce7('0x30')]);_0x328777['query']=_[_0x3ce7('0x49')](_0xed2d7f[_0x3ce7('0x35')]);_0x328777['filters']=_[_0x3ce7('0x37')](_0x328777[_0x3ce7('0x34')],_0x328777[_0x3ce7('0x35')]);_0x119f4f['attributes']=_[_0x3ce7('0x37')](_0x328777[_0x3ce7('0x34')],qs['fields'](_0xed2d7f[_0x3ce7('0x35')]['fields']));_0x119f4f[_0x3ce7('0x39')]=_0x119f4f[_0x3ce7('0x39')][_0x3ce7('0x57')]?_0x119f4f[_0x3ce7('0x39')]:_0x328777[_0x3ce7('0x34')];_0x119f4f['order']=qs['sort'](_0xed2d7f[_0x3ce7('0x35')]['sort']);_0x119f4f[_0x3ce7('0x3f')]=qs['filters'](_[_0x3ce7('0x3d')](_0xed2d7f[_0x3ce7('0x35')],_0x328777[_0x3ce7('0x36')]));if(_0xed2d7f[_0x3ce7('0x35')][_0x3ce7('0x3e')]){_0x119f4f['where']=_[_0x3ce7('0x41')](_0x119f4f[_0x3ce7('0x3f')],{'$or':_[_0x3ce7('0x2e')](_0x119f4f['attributes'],function(_0xd4a685){var _0x5cca9b={};_0x5cca9b[_0xd4a685]={'$like':'%'+_0xed2d7f[_0x3ce7('0x35')][_0x3ce7('0x3e')]+'%'};return _0x5cca9b;})});}_0x119f4f=_[_0x3ce7('0x41')]({},_0x119f4f,_0xed2d7f[_0x3ce7('0x42')]);return _0x571a2f[_0x3ce7('0x8b')](_0x119f4f);}})[_0x3ce7('0x25')](function(_0x5abaac){if(_0x5abaac){_0xf90c7f=_0x5abaac[_0x3ce7('0x57')];if(!_0xed2d7f[_0x3ce7('0x35')][_0x3ce7('0x58')](_0x3ce7('0x3a'))){_0x119f4f['limit']=qs[_0x3ce7('0x20')](_0xed2d7f['query'][_0x3ce7('0x20')]);_0x119f4f['offset']=qs[_0x3ce7('0x1f')](_0xed2d7f[_0x3ce7('0x35')][_0x3ce7('0x1f')]);}return _0x571a2f[_0x3ce7('0x8b')](_0x119f4f);}})[_0x3ce7('0x25')](function(_0x1da5dd){if(_0x1da5dd){return _0x1da5dd?{'count':_0xf90c7f,'rows':_0x1da5dd}:null;}})[_0x3ce7('0x25')](respondWithResult(_0x4537bb,null))[_0x3ce7('0x46')](handleError(_0x4537bb,null));}; \ No newline at end of file +var _0xeece=['end','error','stack','send','map','FaxQueue','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','name','options','includeAll','catch','show','params','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','find','nolimit','order','FaxQueueId','findAll','User','findAndCountAll','UserId','agent','faxPause','updatedAt','rows','format','createdAt','findOne','Team','getTeams','addTeams','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','userFaxQueue:save','field','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','removeTeams','ids','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','emit','isArray','getAgents','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./faxQueue.socket','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','then','FaxQueues','UserProfileResource','destroy'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xeece,0x16c));var _0xeeec=function(_0x13fbf3,_0x9d385d){_0x13fbf3=_0x13fbf3-0x0;var _0x3abe39=_0xeece[_0x13fbf3];return _0x3abe39;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xeeec('0x0'));var jsonpatch=require(_0xeeec('0x1'));var rp=require(_0xeeec('0x2'));var moment=require(_0xeeec('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xeeec('0x4'));var util=require('util');var path=require('path');var sox=require(_0xeeec('0x5'));var csv=require('to-csv');var ejs=require(_0xeeec('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeeec('0x7'));var squel=require(_0xeeec('0x8'));var crypto=require(_0xeeec('0x9'));var jsforce=require(_0xeeec('0xa'));var deskjs=require(_0xeeec('0xb'));var toCsv=require(_0xeeec('0xc'));var querystring=require(_0xeeec('0xd'));var Papa=require(_0xeeec('0xe'));var Redis=require('ioredis');var authService=require(_0xeeec('0xf'));var qs=require(_0xeeec('0x10'));var as=require(_0xeeec('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeeec('0x12'))(_0xeeec('0x13'));var utils=require(_0xeeec('0x14'));var config=require(_0xeeec('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xeeec('0x16'))['db'];config[_0xeeec('0x17')]=_[_0xeeec('0x18')](config[_0xeeec('0x17')],{'host':_0xeeec('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeeec('0x17')]));require(_0xeeec('0x1a'))['register'](socket);function respondWithStatusCode(_0x44f83e,_0x5e7125){_0x5e7125=_0x5e7125||0xcc;return function(_0x3052da){if(_0x3052da){return _0x44f83e[_0xeeec('0x1b')](_0x5e7125);}return _0x44f83e[_0xeeec('0x1c')](_0x5e7125)['end']();};}function respondWithResult(_0x221905,_0x20e89b){_0x20e89b=_0x20e89b||0xc8;return function(_0x2600ff){if(_0x2600ff){return _0x221905[_0xeeec('0x1c')](_0x20e89b)[_0xeeec('0x1d')](_0x2600ff);}};}function respondWithFilteredResult(_0x533b30,_0x5890cb){return function(_0x34bce4){if(_0x34bce4){var _0x1a2df0=typeof _0x5890cb[_0xeeec('0x1e')]===_0xeeec('0x1f')&&typeof _0x5890cb[_0xeeec('0x20')]===_0xeeec('0x1f');var _0x4e7cdd=_0x34bce4['count'];var _0x453da2=_0x1a2df0?0x0:_0x5890cb[_0xeeec('0x1e')];var _0x143985=_0x1a2df0?_0x34bce4[_0xeeec('0x21')]:_0x5890cb[_0xeeec('0x1e')]+_0x5890cb[_0xeeec('0x20')];var _0x5e49a9;if(_0x143985>=_0x4e7cdd){_0x143985=_0x4e7cdd;_0x5e49a9=0xc8;}else{_0x5e49a9=0xce;}_0x533b30[_0xeeec('0x1c')](_0x5e49a9);return _0x533b30[_0xeeec('0x22')]('Content-Range',_0x453da2+'-'+_0x143985+'/'+_0x4e7cdd)[_0xeeec('0x1d')](_0x34bce4);}return null;};}function patchUpdates(_0x13677e){return function(_0x479e86){try{jsonpatch[_0xeeec('0x23')](_0x479e86,_0x13677e,!![]);}catch(_0x595ac8){return BPromise[_0xeeec('0x24')](_0x595ac8);}return _0x479e86['save']();};}function saveUpdates(_0x150401,_0x1acb3e){return function(_0x36967c){if(_0x36967c){return _0x36967c['update'](_0x150401)[_0xeeec('0x25')](function(_0x3509c6){return _0x3509c6;});}return null;};}function removeEntity(_0x12577d,_0x6cf851){return function(_0x2462c3){if(_0x2462c3){return _0x2462c3['destroy']()['then'](function(){var _0x231561=_0x2462c3['get']({'plain':!![]});var _0x2e7378=_0xeeec('0x26');return db[_0xeeec('0x27')][_0xeeec('0x28')]({'where':{'type':_0x2e7378,'resourceId':_0x231561['id']}})[_0xeeec('0x25')](function(){return _0x2462c3;});})[_0xeeec('0x25')](function(){_0x12577d[_0xeeec('0x1c')](0xcc)[_0xeeec('0x29')]();});}};}function handleEntityNotFound(_0x460160,_0x4cc3e7){return function(_0x2cac9d){if(!_0x2cac9d){_0x460160[_0xeeec('0x1b')](0x194);}return _0x2cac9d;};}function handleError(_0x5dd08f,_0x3cfff5){_0x3cfff5=_0x3cfff5||0x1f4;return function(_0x486dd3){logger[_0xeeec('0x2a')](_0x486dd3[_0xeeec('0x2b')]);if(_0x486dd3['name']){delete _0x486dd3['name'];}_0x5dd08f[_0xeeec('0x1c')](_0x3cfff5)[_0xeeec('0x2c')](_0x486dd3);};}exports['index']=function(_0x26c22b,_0x3a6d1c){var _0x17ec92={},_0x53f038={},_0x52f2f8={'count':0x0,'rows':[]};var _0x4f440b=_[_0xeeec('0x2d')](db[_0xeeec('0x2e')][_0xeeec('0x2f')],function(_0x5bf48b){return{'name':_0x5bf48b[_0xeeec('0x30')],'type':_0x5bf48b[_0xeeec('0x31')][_0xeeec('0x32')]};});_0x53f038[_0xeeec('0x33')]=_['map'](_0x4f440b,'name');_0x53f038[_0xeeec('0x34')]=_[_0xeeec('0x35')](_0x26c22b[_0xeeec('0x34')]);_0x53f038['filters']=_[_0xeeec('0x36')](_0x53f038['model'],_0x53f038['query']);_0x17ec92[_0xeeec('0x37')]=_[_0xeeec('0x36')](_0x53f038['model'],qs[_0xeeec('0x38')](_0x26c22b['query'][_0xeeec('0x38')]));_0x17ec92['attributes']=_0x17ec92[_0xeeec('0x37')][_0xeeec('0x39')]?_0x17ec92['attributes']:_0x53f038[_0xeeec('0x33')];if(!_0x26c22b[_0xeeec('0x34')][_0xeeec('0x3a')]('nolimit')){_0x17ec92['limit']=qs[_0xeeec('0x20')](_0x26c22b[_0xeeec('0x34')][_0xeeec('0x20')]);_0x17ec92[_0xeeec('0x1e')]=qs[_0xeeec('0x1e')](_0x26c22b['query']['offset']);}_0x17ec92['order']=qs[_0xeeec('0x3b')](_0x26c22b[_0xeeec('0x34')]['sort']);_0x17ec92[_0xeeec('0x3c')]=qs[_0xeeec('0x3d')](_[_0xeeec('0x3e')](_0x26c22b['query'],_0x53f038[_0xeeec('0x3d')]),_0x4f440b);if(_0x26c22b[_0xeeec('0x34')][_0xeeec('0x3f')]){_0x17ec92[_0xeeec('0x3c')]=_[_0xeeec('0x40')](_0x17ec92[_0xeeec('0x3c')],{'$or':_[_0xeeec('0x2d')](_0x4f440b,function(_0x40a718){if(_0x40a718[_0xeeec('0x31')]!=='VIRTUAL'){var _0x5594b5={};_0x5594b5[_0x40a718[_0xeeec('0x41')]]={'$like':'%'+_0x26c22b[_0xeeec('0x34')][_0xeeec('0x3f')]+'%'};return _0x5594b5;}})});}_0x17ec92=_['merge']({},_0x17ec92,_0x26c22b[_0xeeec('0x42')]);var _0x57dd7c={'where':_0x17ec92[_0xeeec('0x3c')]};return db[_0xeeec('0x2e')][_0xeeec('0x21')](_0x57dd7c)[_0xeeec('0x25')](function(_0x4b76d0){_0x52f2f8[_0xeeec('0x21')]=_0x4b76d0;if(_0x26c22b[_0xeeec('0x34')][_0xeeec('0x43')]){_0x17ec92['include']=[{'all':!![]}];}return db[_0xeeec('0x2e')]['findAll'](_0x17ec92);})[_0xeeec('0x25')](function(_0x5059d0){_0x52f2f8['rows']=_0x5059d0;return _0x52f2f8;})[_0xeeec('0x25')](respondWithFilteredResult(_0x3a6d1c,_0x17ec92))[_0xeeec('0x44')](handleError(_0x3a6d1c,null));};exports[_0xeeec('0x45')]=function(_0x59fd53,_0xc19133){var _0x58fd9e={'raw':!![],'where':{'id':_0x59fd53[_0xeeec('0x46')]['id']}},_0x5b08c9={};_0x5b08c9[_0xeeec('0x33')]=_[_0xeeec('0x35')](db[_0xeeec('0x2e')][_0xeeec('0x2f')]);_0x5b08c9[_0xeeec('0x34')]=_[_0xeeec('0x35')](_0x59fd53[_0xeeec('0x34')]);_0x5b08c9[_0xeeec('0x3d')]=_[_0xeeec('0x36')](_0x5b08c9['model'],_0x5b08c9[_0xeeec('0x34')]);_0x58fd9e[_0xeeec('0x37')]=_[_0xeeec('0x36')](_0x5b08c9[_0xeeec('0x33')],qs[_0xeeec('0x38')](_0x59fd53[_0xeeec('0x34')]['fields']));_0x58fd9e[_0xeeec('0x37')]=_0x58fd9e[_0xeeec('0x37')][_0xeeec('0x39')]?_0x58fd9e['attributes']:_0x5b08c9[_0xeeec('0x33')];if(_0x59fd53[_0xeeec('0x34')][_0xeeec('0x43')]){_0x58fd9e['include']=[{'all':!![]}];}_0x58fd9e=_[_0xeeec('0x40')]({},_0x58fd9e,_0x59fd53[_0xeeec('0x42')]);return db[_0xeeec('0x2e')]['find'](_0x58fd9e)[_0xeeec('0x25')](handleEntityNotFound(_0xc19133,null))['then'](respondWithResult(_0xc19133,null))[_0xeeec('0x44')](handleError(_0xc19133,null));};exports[_0xeeec('0x47')]=function(_0x56a507,_0x44fff1){return db[_0xeeec('0x2e')][_0xeeec('0x47')](_0x56a507['body'],{})[_0xeeec('0x25')](function(_0xb95286){var _0x5c94a8=_0x56a507[_0xeeec('0x48')][_0xeeec('0x49')]({'plain':!![]});if(!_0x5c94a8)throw new Error(_0xeeec('0x4a'));if(_0x5c94a8[_0xeeec('0x4b')]===_0xeeec('0x48')){var _0x463173=_0xb95286[_0xeeec('0x49')]({'plain':!![]});var _0x2ce342=_0xeeec('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x2ce342,'userProfileId':_0x5c94a8['userProfileId']},'raw':!![]})[_0xeeec('0x25')](function(_0x490079){if(_0x490079&&_0x490079[_0xeeec('0x4c')]===0x0){return db[_0xeeec('0x27')][_0xeeec('0x47')]({'name':_0x463173['name'],'resourceId':_0x463173['id'],'type':_0x490079[_0xeeec('0x41')],'sectionId':_0x490079['id']},{})[_0xeeec('0x25')](function(){return _0xb95286;});}else{return _0xb95286;}})[_0xeeec('0x44')](function(_0x3b801c){logger[_0xeeec('0x2a')](_0xeeec('0x4d'),_0x3b801c);throw _0x3b801c;});}return _0xb95286;})[_0xeeec('0x25')](respondWithResult(_0x44fff1,0xc9))[_0xeeec('0x44')](handleError(_0x44fff1,null));};exports[_0xeeec('0x4e')]=function(_0x2289ac,_0xb6b3a1){if(_0x2289ac[_0xeeec('0x4f')]['id']){delete _0x2289ac['body']['id'];}return db[_0xeeec('0x2e')][_0xeeec('0x50')]({'where':{'id':_0x2289ac[_0xeeec('0x46')]['id']}})[_0xeeec('0x25')](handleEntityNotFound(_0xb6b3a1,null))[_0xeeec('0x25')](saveUpdates(_0x2289ac[_0xeeec('0x4f')],null))['then'](respondWithResult(_0xb6b3a1,null))[_0xeeec('0x44')](handleError(_0xb6b3a1,null));};exports[_0xeeec('0x28')]=function(_0x197e7d,_0x289a31){return db[_0xeeec('0x2e')][_0xeeec('0x50')]({'where':{'id':_0x197e7d['params']['id']}})[_0xeeec('0x25')](handleEntityNotFound(_0x289a31,null))[_0xeeec('0x25')](removeEntity(_0x289a31,null))['catch'](handleError(_0x289a31,null));};exports['describe']=function(_0x4a8d69,_0xdfb30d){return db['FaxQueue']['describe']()[_0xeeec('0x25')](respondWithResult(_0xdfb30d,null))[_0xeeec('0x44')](handleError(_0xdfb30d,null));};exports['getMembers']=function(_0x3324d2,_0x1d5a9f,_0x3bfbee){var _0x407057={'raw':!![],'where':{}},_0x31620a={},_0x3aa387;return db[_0xeeec('0x2e')]['findOne']({'where':{'id':_0x3324d2['params']['id']}})[_0xeeec('0x25')](handleEntityNotFound(_0x1d5a9f,null))[_0xeeec('0x25')](function(_0x12255b){if(_0x12255b){_0x3aa387=_0x12255b[_0xeeec('0x49')]({'plain':!![]});_0x31620a[_0xeeec('0x33')]=_[_0xeeec('0x35')](db['UserFaxQueue'][_0xeeec('0x2f')]);_0x31620a[_0xeeec('0x34')]=_['keys'](_0x3324d2[_0xeeec('0x34')]);_0x31620a['filters']=_[_0xeeec('0x36')](_0x31620a['model'],_0x31620a[_0xeeec('0x34')]);_0x407057[_0xeeec('0x37')]=_['intersection'](_0x31620a[_0xeeec('0x33')],qs[_0xeeec('0x38')](_0x3324d2[_0xeeec('0x34')][_0xeeec('0x38')]));_0x407057[_0xeeec('0x37')]=_0x407057[_0xeeec('0x37')][_0xeeec('0x39')]?_0x407057['attributes']:_0x31620a['model'];if(!_0x3324d2['query'][_0xeeec('0x3a')](_0xeeec('0x51'))){_0x407057[_0xeeec('0x20')]=qs[_0xeeec('0x20')](_0x3324d2[_0xeeec('0x34')][_0xeeec('0x20')]);_0x407057[_0xeeec('0x1e')]=qs[_0xeeec('0x1e')](_0x3324d2[_0xeeec('0x34')][_0xeeec('0x1e')]);}_0x407057[_0xeeec('0x52')]=qs[_0xeeec('0x3b')](_0x3324d2[_0xeeec('0x34')][_0xeeec('0x3b')]);_0x407057[_0xeeec('0x3c')]=qs['filters'](_['pick'](_0x3324d2[_0xeeec('0x34')],_0x31620a['filters']));_0x407057[_0xeeec('0x3c')][_0xeeec('0x53')]=_0x12255b['id'];if(_0x3324d2[_0xeeec('0x34')][_0xeeec('0x3f')]){_0x407057[_0xeeec('0x3c')]=_[_0xeeec('0x40')](_0x407057[_0xeeec('0x3c')],{'$or':_['map'](_0x407057[_0xeeec('0x37')],function(_0x4e5c34){var _0x1460f3={};_0x1460f3[_0x4e5c34]={'$like':'%'+_0x3324d2['query']['filter']+'%'};return _0x1460f3;})});}_0x407057=_[_0xeeec('0x40')]({},_0x407057,_0x3324d2['options']);return db['UserFaxQueue'][_0xeeec('0x54')](_0x407057);}})['then'](function(_0x11766d){if(_0x11766d){return db[_0xeeec('0x55')][_0xeeec('0x56')]({'where':{'id':_[_0xeeec('0x2d')](_0x11766d,_0xeeec('0x57')),'role':_0xeeec('0x58')},'attributes':['id','name',_0xeeec('0x59'),_0xeeec('0x5a'),'createdAt']});}})[_0xeeec('0x25')](function(_0x5c036c){if(_0x5c036c){return{'count':_0x5c036c[_0xeeec('0x21')],'rows':_[_0xeeec('0x2d')](_0x5c036c[_0xeeec('0x5b')],function(_0x17358a){return{'membername':_0x17358a['name'],'UserId':_0x17358a['id'],'queue_name':_0x3aa387['name'],'FaxQueueId':_0x3aa387['id'],'interface':util[_0xeeec('0x5c')]('%s/%s','SIP',_0x17358a[_0xeeec('0x41')]),'penalty':0x0,'paused':_0x17358a[_0xeeec('0x59')],'createdAt':_0x17358a[_0xeeec('0x5d')],'updatedAt':_0x17358a[_0xeeec('0x5a')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1d5a9f,_0x407057))[_0xeeec('0x44')](handleError(_0x1d5a9f,null));};exports['getTeams']=function(_0x45a5b5,_0xc6a285,_0x271d8a){var _0x33d431={};var _0x48e24d={};var _0x53b7fa;var _0x455e92;return db['FaxQueue'][_0xeeec('0x5e')]({'where':{'id':_0x45a5b5['params']['id']}})[_0xeeec('0x25')](handleEntityNotFound(_0xc6a285,null))[_0xeeec('0x25')](function(_0x25e513){if(_0x25e513){_0x53b7fa=_0x25e513;_0x48e24d[_0xeeec('0x33')]=_['keys'](db[_0xeeec('0x5f')][_0xeeec('0x2f')]);_0x48e24d['query']=_[_0xeeec('0x35')](_0x45a5b5[_0xeeec('0x34')]);_0x48e24d['filters']=_[_0xeeec('0x36')](_0x48e24d[_0xeeec('0x33')],_0x48e24d[_0xeeec('0x34')]);_0x33d431['attributes']=_[_0xeeec('0x36')](_0x48e24d[_0xeeec('0x33')],qs['fields'](_0x45a5b5['query'][_0xeeec('0x38')]));_0x33d431[_0xeeec('0x37')]=_0x33d431[_0xeeec('0x37')][_0xeeec('0x39')]?_0x33d431[_0xeeec('0x37')]:_0x48e24d[_0xeeec('0x33')];_0x33d431[_0xeeec('0x52')]=qs[_0xeeec('0x3b')](_0x45a5b5[_0xeeec('0x34')][_0xeeec('0x3b')]);_0x33d431[_0xeeec('0x3c')]=qs[_0xeeec('0x3d')](_['pick'](_0x45a5b5[_0xeeec('0x34')],_0x48e24d[_0xeeec('0x3d')]));if(_0x45a5b5[_0xeeec('0x34')][_0xeeec('0x3f')]){_0x33d431[_0xeeec('0x3c')]=_['merge'](_0x33d431[_0xeeec('0x3c')],{'$or':_[_0xeeec('0x2d')](_0x33d431[_0xeeec('0x37')],function(_0x2d44f2){var _0x51c912={};_0x51c912[_0x2d44f2]={'$like':'%'+_0x45a5b5[_0xeeec('0x34')][_0xeeec('0x3f')]+'%'};return _0x51c912;})});}_0x33d431=_[_0xeeec('0x40')]({},_0x33d431,_0x45a5b5['options']);return _0x53b7fa[_0xeeec('0x60')](_0x33d431);}})['then'](function(_0x110f40){if(_0x110f40){_0x455e92=_0x110f40[_0xeeec('0x39')];if(!_0x45a5b5[_0xeeec('0x34')][_0xeeec('0x3a')]('nolimit')){_0x33d431[_0xeeec('0x20')]=qs[_0xeeec('0x20')](_0x45a5b5[_0xeeec('0x34')][_0xeeec('0x20')]);_0x33d431[_0xeeec('0x1e')]=qs[_0xeeec('0x1e')](_0x45a5b5[_0xeeec('0x34')][_0xeeec('0x1e')]);}return _0x53b7fa[_0xeeec('0x60')](_0x33d431);}})[_0xeeec('0x25')](function(_0x437097){if(_0x437097){return _0x437097?{'count':_0x455e92,'rows':_0x437097}:null;}})[_0xeeec('0x25')](respondWithResult(_0xc6a285,null))[_0xeeec('0x44')](handleError(_0xc6a285,null));};exports[_0xeeec('0x61')]=function(_0x18dada,_0x18bbb9,_0x22ed81){var _0x3010dc=_0x18dada[_0xeeec('0x4f')]['ids'];return db[_0xeeec('0x5f')][_0xeeec('0x54')]({'where':{'id':_0x3010dc},'attributes':['id'],'include':[{'model':db['User'],'as':_0xeeec('0x62'),'attributes':['id',_0xeeec('0x41'),_0xeeec('0x63'),_0xeeec('0x64'),_0xeeec('0x65')],'raw':!![]}]})[_0xeeec('0x25')](function(_0x7641db){if(_0x7641db){var _0x7b0b5a=_['flatMap'](_0x7641db,function(_0x42989c){var _0x57ffcc=_0x42989c[_0xeeec('0x49')]({'plain':!![]});return _0x57ffcc['Agents'];});return db[_0xeeec('0x2e')]['find']({'where':{'id':_0x18dada[_0xeeec('0x46')]['id']}})[_0xeeec('0x25')](function(_0x277dbb){return db[_0xeeec('0x66')][_0xeeec('0x67')](function(_0x5e288c){return _0x277dbb[_0xeeec('0x61')](_0x3010dc,{'transaction':_0x5e288c})[_0xeeec('0x25')](function(){return BPromise[_0xeeec('0x68')](_0x7b0b5a,function(_0x4e7c40){return db['UserFaxQueue'][_0xeeec('0x69')]({'where':{'UserId':_0x4e7c40['id'],'FaxQueueId':_0x18dada[_0xeeec('0x46')]['id']},'transaction':_0x5e288c});});})['then'](function(){_0x7b0b5a[_0xeeec('0x6a')](function(_0x3ac45a){socket['emit'](_0xeeec('0x6b'),{'UserId':_0x3ac45a['id'],'FaxQueueId':_0x277dbb['id']});});});});});}})[_0xeeec('0x25')](respondWithStatusCode(_0x18bbb9,null))[_0xeeec('0x44')](handleError(_0x18bbb9,null));};exports['removeTeams']=function(_0x12fb8e,_0x1cce0f,_0x109a15){return db[_0xeeec('0x5f')][_0xeeec('0x54')]({'where':{'id':_0x12fb8e[_0xeeec('0x34')]['ids']},'attributes':['id'],'include':[{'model':db[_0xeeec('0x55')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xeeec('0x25')](handleEntityNotFound(_0x1cce0f,null))[_0xeeec('0x25')](function(_0xa250ae){var _0x2dc9e3=_[_0xeeec('0x2d')](_0xa250ae,'id');var _0x2cf9a3=[];var _0x1c9ef2=[];var _0xee07d1=squel['select']();_0xee07d1[_0xeeec('0x6c')]('tq.TeamId')[_0xeeec('0x6d')](_0xeeec('0x6e'),'tq')[_0xeeec('0x6f')](_0xeeec('0x70'),'ut',_0xeeec('0x71'))['where'](_0xeeec('0x72'),_0x12fb8e[_0xeeec('0x46')]['id']);for(var _0x6bf7c5=0x0;_0x6bf7c5<_0xa250ae[_0xeeec('0x39')];_0x6bf7c5+=0x1){let _0x19d226=_0xa250ae[_0x6bf7c5];for(var _0x93e981=0x0;_0x93e981<_0x19d226['Agents'][_0xeeec('0x39')];_0x93e981+=0x1){let _0x32b647=_0x19d226[_0xeeec('0x62')][_0x93e981];var _0x597a02=_0xee07d1[_0xeeec('0x73')]();_0x597a02[_0xeeec('0x3c')]('ut.UserId\x20=\x20?',_0x32b647['id']);_0x1c9ef2['push'](db[_0xeeec('0x66')][_0xeeec('0x34')](_0x597a02[_0xeeec('0x74')](),{'type':db[_0xeeec('0x66')][_0xeeec('0x75')][_0xeeec('0x76')]})[_0xeeec('0x25')](function(_0x4eaebe){if(_0x4eaebe[_0xeeec('0x39')]===0x1){return _0x32b647['id'];}else{var _0x5c04ae=_[_0xeeec('0x77')](_[_0xeeec('0x2d')](_0x4eaebe,_0xeeec('0x78')),function(_0xa62f9f){return _[_0xeeec('0x79')](_0x2dc9e3,_0xa62f9f);});if(_0x5c04ae){return _0x32b647['id'];}}}));}}return BPromise['all'](_0x1c9ef2)[_0xeeec('0x25')](function(_0x1e31be){_0x2cf9a3=_(_0x2cf9a3)[_0xeeec('0x7a')](_0x1e31be)[_0xeeec('0x7b')]()[_0xeeec('0x7c')]();return db[_0xeeec('0x2e')][_0xeeec('0x50')]({'where':{'id':_0x12fb8e[_0xeeec('0x46')]['id']}})[_0xeeec('0x25')](function(_0xf64d27){return db[_0xeeec('0x66')]['transaction'](function(_0x2f942b){return _0xf64d27[_0xeeec('0x7d')](_0x12fb8e[_0xeeec('0x34')][_0xeeec('0x7e')],{'transaction':_0x2f942b})[_0xeeec('0x25')](function(){if(!_[_0xeeec('0x7f')](_0x2cf9a3)){return _0xf64d27[_0xeeec('0x80')](_0x2cf9a3,{'transaction':_0x2f942b});}})['then'](function(){_0x2cf9a3[_0xeeec('0x6a')](function(_0x281eb2){socket['emit'](_0xeeec('0x81'),{'UserId':_0x281eb2,'FaxQueueId':_0xf64d27['id']});});});});});});})[_0xeeec('0x25')](respondWithStatusCode(_0x1cce0f,null))[_0xeeec('0x44')](handleError(_0x1cce0f,null));};exports[_0xeeec('0x82')]=function(_0x1a2839,_0x240aec,_0xf9cba8){return db[_0xeeec('0x2e')][_0xeeec('0x50')]({'where':{'id':_0x1a2839[_0xeeec('0x46')]['id']}})['then'](handleEntityNotFound(_0x240aec,null))[_0xeeec('0x25')](function(_0x2f04da){if(_0x2f04da){return _0x2f04da['addAgents'](_0x1a2839[_0xeeec('0x4f')][_0xeeec('0x7e')],_[_0xeeec('0x83')](_0x1a2839[_0xeeec('0x4f')],['ids','id'])||{})['spread'](function(_0x2c13e5){for(var _0x1ae787=0x0;_0x1ae787<_0x1a2839[_0xeeec('0x4f')]['ids'][_0xeeec('0x39')];_0x1ae787+=0x1){socket[_0xeeec('0x84')](_0xeeec('0x6b'),{'UserId':Number(_0x1a2839[_0xeeec('0x4f')]['ids'][_0x1ae787]),'FaxQueueId':Number(_0x1a2839[_0xeeec('0x46')]['id'])});}return _0x2c13e5;});}})[_0xeeec('0x25')](respondWithResult(_0x240aec,null))[_0xeeec('0x44')](handleError(_0x240aec,null));};exports[_0xeeec('0x80')]=function(_0x32ac04,_0x2573ca,_0xbc2869){return db[_0xeeec('0x2e')][_0xeeec('0x50')]({'where':{'id':_0x32ac04[_0xeeec('0x46')]['id']}})['then'](handleEntityNotFound(_0x2573ca,null))[_0xeeec('0x25')](function(_0xd033f6){if(_0xd033f6){return _0xd033f6[_0xeeec('0x80')](_0x32ac04['query'][_0xeeec('0x7e')])[_0xeeec('0x25')](function(){if(_[_0xeeec('0x85')](_0x32ac04[_0xeeec('0x34')]['ids'])){for(var _0x22107e=0x0;_0x22107e<_0x32ac04['query'][_0xeeec('0x7e')][_0xeeec('0x39')];_0x22107e+=0x1){socket['emit'](_0xeeec('0x81'),{'UserId':Number(_0x32ac04[_0xeeec('0x34')][_0xeeec('0x7e')][_0x22107e]),'FaxQueueId':Number(_0x32ac04[_0xeeec('0x46')]['id'])});}}else{socket[_0xeeec('0x84')](_0xeeec('0x81'),{'UserId':Number(_0x32ac04['query']['ids']),'FaxQueueId':Number(_0x32ac04[_0xeeec('0x46')]['id'])});}});}})[_0xeeec('0x25')](respondWithStatusCode(_0x2573ca,null))[_0xeeec('0x44')](handleError(_0x2573ca,null));};exports[_0xeeec('0x86')]=function(_0x53d272,_0x3da2c7,_0x3e63b2){var _0x233311={};var _0x2ddb97={};var _0x54d46a;var _0x29d246;return db[_0xeeec('0x2e')][_0xeeec('0x5e')]({'where':{'id':_0x53d272['params']['id']}})[_0xeeec('0x25')](handleEntityNotFound(_0x3da2c7,null))[_0xeeec('0x25')](function(_0x21c866){if(_0x21c866){_0x54d46a=_0x21c866;_0x2ddb97['model']=_['keys'](db[_0xeeec('0x55')][_0xeeec('0x2f')]);_0x2ddb97[_0xeeec('0x34')]=_[_0xeeec('0x35')](_0x53d272[_0xeeec('0x34')]);_0x2ddb97[_0xeeec('0x3d')]=_[_0xeeec('0x36')](_0x2ddb97[_0xeeec('0x33')],_0x2ddb97[_0xeeec('0x34')]);_0x233311[_0xeeec('0x37')]=_[_0xeeec('0x36')](_0x2ddb97['model'],qs['fields'](_0x53d272[_0xeeec('0x34')][_0xeeec('0x38')]));_0x233311[_0xeeec('0x37')]=_0x233311[_0xeeec('0x37')][_0xeeec('0x39')]?_0x233311[_0xeeec('0x37')]:_0x2ddb97[_0xeeec('0x33')];_0x233311[_0xeeec('0x52')]=qs[_0xeeec('0x3b')](_0x53d272[_0xeeec('0x34')][_0xeeec('0x3b')]);_0x233311['where']=qs[_0xeeec('0x3d')](_[_0xeeec('0x3e')](_0x53d272[_0xeeec('0x34')],_0x2ddb97[_0xeeec('0x3d')]));if(_0x53d272[_0xeeec('0x34')]['filter']){_0x233311[_0xeeec('0x3c')]=_[_0xeeec('0x40')](_0x233311[_0xeeec('0x3c')],{'$or':_['map'](_0x233311[_0xeeec('0x37')],function(_0x18d01c){var _0x411676={};_0x411676[_0x18d01c]={'$like':'%'+_0x53d272[_0xeeec('0x34')][_0xeeec('0x3f')]+'%'};return _0x411676;})});}_0x233311=_[_0xeeec('0x40')]({},_0x233311,_0x53d272['options']);return _0x54d46a['getAgents'](_0x233311);}})[_0xeeec('0x25')](function(_0x49b3fe){if(_0x49b3fe){_0x29d246=_0x49b3fe[_0xeeec('0x39')];if(!_0x53d272['query'][_0xeeec('0x3a')](_0xeeec('0x51'))){_0x233311['limit']=qs[_0xeeec('0x20')](_0x53d272['query'][_0xeeec('0x20')]);_0x233311[_0xeeec('0x1e')]=qs[_0xeeec('0x1e')](_0x53d272[_0xeeec('0x34')][_0xeeec('0x1e')]);}return _0x54d46a[_0xeeec('0x86')](_0x233311);}})[_0xeeec('0x25')](function(_0x165830){if(_0x165830){return _0x165830?{'count':_0x29d246,'rows':_0x165830}:null;}})['then'](respondWithResult(_0x3da2c7,null))[_0xeeec('0x44')](handleError(_0x3da2c7,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index b1b5946..a5cc31a 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 _0x6626=['exports','events','FaxQueue','setMaxListeners','emit','hasOwnProperty','hook'];(function(_0x318bb8,_0x23edb2){var _0x5088a6=function(_0x5a2a09){while(--_0x5a2a09){_0x318bb8['push'](_0x318bb8['shift']());}};_0x5088a6(++_0x23edb2);}(_0x6626,0x1ba));var _0x6662=function(_0x3bdad1,_0x119e31){_0x3bdad1=_0x3bdad1-0x0;var _0x4f39b4=_0x6626[_0x3bdad1];return _0x4f39b4;};'use strict';var EventEmitter=require(_0x6662('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x6662('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x6662('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x103b21){return function(_0x4810f9,_0x56a839,_0x14fd88){FaxQueueEvents[_0x6662('0x3')](_0x103b21+':'+_0x4810f9['id'],_0x4810f9);FaxQueueEvents[_0x6662('0x3')](_0x103b21,_0x4810f9);_0x14fd88(null);};}for(var e in events){if(events[_0x6662('0x4')](e)){var event=events[e];FaxQueue[_0x6662('0x5')](e,emitEvent(event));}}module[_0x6662('0x6')]=FaxQueueEvents; \ No newline at end of file +var _0x2ed1=['remove','emit','hook','exports','events','../../mysqldb','FaxQueue','save'];(function(_0x30cb3f,_0x859105){var _0x527cc1=function(_0x406d06){while(--_0x406d06){_0x30cb3f['push'](_0x30cb3f['shift']());}};_0x527cc1(++_0x859105);}(_0x2ed1,0x174));var _0x12ed=function(_0x299c08,_0x6a595c){_0x299c08=_0x299c08-0x0;var _0x73a56b=_0x2ed1[_0x299c08];return _0x73a56b;};'use strict';var EventEmitter=require(_0x12ed('0x0'));var FaxQueue=require(_0x12ed('0x1'))['db'][_0x12ed('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x12ed('0x3'),'afterUpdate':'update','afterDestroy':_0x12ed('0x4')};function emitEvent(_0x45b7c4){return function(_0x2a259f,_0x338e05,_0xcf9bc){FaxQueueEvents[_0x12ed('0x5')](_0x45b7c4+':'+_0x2a259f['id'],_0x2a259f);FaxQueueEvents[_0x12ed('0x5')](_0x45b7c4,_0x2a259f);_0xcf9bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x12ed('0x6')](e,emitEvent(event));}}module[_0x12ed('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 a814055..711f52f 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 _0xc5ba=['define','FaxQueue','fax_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxQueue.attributes','exports'];(function(_0x57adcf,_0x556cbd){var _0x1b7dca=function(_0x549f25){while(--_0x549f25){_0x57adcf['push'](_0x57adcf['shift']());}};_0x1b7dca(++_0x556cbd);}(_0xc5ba,0x1a3));var _0xac5b=function(_0x3fe6df,_0x5a04d4){_0x3fe6df=_0x3fe6df-0x0;var _0x372a0e=_0xc5ba[_0x3fe6df];return _0x372a0e;};'use strict';var _=require('lodash');var util=require(_0xac5b('0x0'));var logger=require(_0xac5b('0x1'))(_0xac5b('0x2'));var moment=require(_0xac5b('0x3'));var BPromise=require(_0xac5b('0x4'));var rp=require(_0xac5b('0x5'));var fs=require('fs');var path=require(_0xac5b('0x6'));var rimraf=require('rimraf');var config=require(_0xac5b('0x7'));var attributes=require(_0xac5b('0x8'));module[_0xac5b('0x9')]=function(_0x4e86ab,_0x392a9b){return _0x4e86ab[_0xac5b('0xa')](_0xac5b('0xb'),attributes,{'tableName':_0xac5b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf73b=['./faxQueue.attributes','define','FaxQueue','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x390e02,_0x40f1f2){var _0x52b778=function(_0x1c7705){while(--_0x1c7705){_0x390e02['push'](_0x390e02['shift']());}};_0x52b778(++_0x40f1f2);}(_0xf73b,0x87));var _0xbf73=function(_0x5b9829,_0x197062){_0x5b9829=_0x5b9829-0x0;var _0x2e9e4b=_0xf73b[_0x5b9829];return _0x2e9e4b;};'use strict';var _=require(_0xbf73('0x0'));var util=require(_0xbf73('0x1'));var logger=require(_0xbf73('0x2'))('api');var moment=require(_0xbf73('0x3'));var BPromise=require(_0xbf73('0x4'));var rp=require(_0xbf73('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbf73('0x6'));var config=require(_0xbf73('0x7'));var attributes=require(_0xbf73('0x8'));module['exports']=function(_0x3db4c0,_0x1f6e7c){return _0x3db4c0[_0xbf73('0x9')](_0xbf73('0xa'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index aeee8a2..ada426f 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 _0x4d0c=['GetFaxQueue','findAll','options','where','attributes','include','model','map','then','find','raw','ShowFaxQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults','localhost','socket.io-emitter','request','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x599d7f,_0xc586e8){var _0x3346d3=function(_0x56b820){while(--_0x56b820){_0x599d7f['push'](_0x599d7f['shift']());}};_0x3346d3(++_0xc586e8);}(_0x4d0c,0x1b9));var _0xc4d0=function(_0x1a7c9f,_0x495a57){_0x1a7c9f=_0x1a7c9f-0x0;var _0x54bcaf=_0x4d0c[_0x1a7c9f];return _0x54bcaf;};'use strict';var _=require(_0xc4d0('0x0'));var util=require(_0xc4d0('0x1'));var moment=require(_0xc4d0('0x2'));var BPromise=require(_0xc4d0('0x3'));var rs=require(_0xc4d0('0x4'));var fs=require('fs');var Redis=require(_0xc4d0('0x5'));var db=require(_0xc4d0('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc4d0('0x7'))(_0xc4d0('0x8'));var config=require(_0xc4d0('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc4d0('0xa')][_0xc4d0('0xb')]({'port':0x232a});config['redis']=_[_0xc4d0('0xc')](config['redis'],{'host':_0xc4d0('0xd'),'port':0x18eb});var socket=require(_0xc4d0('0xe'))(new Redis(config['redis']));require('./faxQueue.socket')['register'](socket);function respondWithRpcPromise(_0x475229,_0x2f5e78,_0x127f89){return new BPromise(function(_0x62942b,_0x15b639){return client[_0xc4d0('0xf')](_0x475229,_0x127f89)['then'](function(_0x54e184){logger[_0xc4d0('0x10')](_0xc4d0('0x11'),_0x2f5e78,_0xc4d0('0x12'));logger[_0xc4d0('0x13')](_0xc4d0('0x14'),_0x2f5e78,_0xc4d0('0x12'),JSON[_0xc4d0('0x15')](_0x54e184));if(_0x54e184['error']){if(_0x54e184[_0xc4d0('0x16')][_0xc4d0('0x17')]===0x1f4){logger[_0xc4d0('0x16')](_0xc4d0('0x11'),_0x2f5e78,_0x54e184['error'][_0xc4d0('0x18')]);return _0x15b639(_0x54e184[_0xc4d0('0x16')][_0xc4d0('0x18')]);}logger[_0xc4d0('0x16')](_0xc4d0('0x11'),_0x2f5e78,_0x54e184['error'][_0xc4d0('0x18')]);return _0x62942b(_0x54e184[_0xc4d0('0x16')][_0xc4d0('0x18')]);}else{logger[_0xc4d0('0x10')](_0xc4d0('0x11'),_0x2f5e78,'request\x20sent');_0x62942b(_0x54e184[_0xc4d0('0x19')]['message']);}})[_0xc4d0('0x1a')](function(_0x1d421d){logger[_0xc4d0('0x16')]('FaxQueue,\x20%s,\x20%s',_0x2f5e78,_0x1d421d);_0x15b639(_0x1d421d);});});}exports[_0xc4d0('0x1b')]=function(_0x15d8c2){var _0x10376b=this;return new Promise(function(_0x3939d8,_0xb42578){return db['FaxQueue'][_0xc4d0('0x1c')]({'raw':_0x15d8c2[_0xc4d0('0x1d')]?_0x15d8c2[_0xc4d0('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x15d8c2[_0xc4d0('0x1d')]?_0x15d8c2[_0xc4d0('0x1d')][_0xc4d0('0x1e')]||null:null,'attributes':_0x15d8c2['options']?_0x15d8c2['options'][_0xc4d0('0x1f')]||null:null,'limit':_0x15d8c2[_0xc4d0('0x1d')]?_0x15d8c2[_0xc4d0('0x1d')]['limit']||null:null,'include':_0x15d8c2[_0xc4d0('0x1d')]?_0x15d8c2[_0xc4d0('0x1d')]['include']?_['map'](_0x15d8c2[_0xc4d0('0x1d')][_0xc4d0('0x20')],function(_0x3ef957){return{'model':db[_0x3ef957[_0xc4d0('0x21')]],'as':_0x3ef957['as'],'attributes':_0x3ef957[_0xc4d0('0x1f')],'include':_0x3ef957[_0xc4d0('0x20')]?_['map'](_0x3ef957[_0xc4d0('0x20')],function(_0x507b95){return{'model':db[_0x507b95[_0xc4d0('0x21')]],'as':_0x507b95['as'],'attributes':_0x507b95[_0xc4d0('0x1f')],'include':_0x507b95['include']?_[_0xc4d0('0x22')](_0x507b95[_0xc4d0('0x20')],function(_0x7c5d10){return{'model':db[_0x7c5d10[_0xc4d0('0x21')]],'as':_0x7c5d10['as'],'attributes':_0x7c5d10[_0xc4d0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc4d0('0x23')](function(_0x1dd47f){logger[_0xc4d0('0x10')]('GetFaxQueue',_0x15d8c2);logger[_0xc4d0('0x13')](_0xc4d0('0x1b'),_0x15d8c2,JSON[_0xc4d0('0x15')](_0x1dd47f));_0x3939d8(_0x1dd47f);})['catch'](function(_0x1948f9){logger[_0xc4d0('0x16')](_0xc4d0('0x1b'),_0x1948f9['message'],_0x15d8c2);_0xb42578(_0x10376b[_0xc4d0('0x16')](0x1f4,_0x1948f9['message']));});});};exports['ShowFaxQueue']=function(_0x899062){var _0x14f8ab=this;return new Promise(function(_0x563fa0,_0x2d93be){return db['FaxQueue'][_0xc4d0('0x24')]({'raw':_0x899062['options']?_0x899062[_0xc4d0('0x1d')][_0xc4d0('0x25')]===undefined?!![]:![]:!![],'where':_0x899062[_0xc4d0('0x1d')]?_0x899062['options'][_0xc4d0('0x1e')]||null:null,'attributes':_0x899062['options']?_0x899062[_0xc4d0('0x1d')][_0xc4d0('0x1f')]||null:null,'include':_0x899062[_0xc4d0('0x1d')]?_0x899062[_0xc4d0('0x1d')][_0xc4d0('0x20')]?_[_0xc4d0('0x22')](_0x899062[_0xc4d0('0x1d')][_0xc4d0('0x20')],function(_0x2fe58b){return{'model':db[_0x2fe58b[_0xc4d0('0x21')]],'as':_0x2fe58b['as'],'attributes':_0x2fe58b[_0xc4d0('0x1f')],'include':_0x2fe58b['include']?_['map'](_0x2fe58b[_0xc4d0('0x20')],function(_0x4d7093){return{'model':db[_0x4d7093[_0xc4d0('0x21')]],'as':_0x4d7093['as'],'attributes':_0x4d7093[_0xc4d0('0x1f')],'include':_0x4d7093[_0xc4d0('0x20')]?_[_0xc4d0('0x22')](_0x4d7093[_0xc4d0('0x20')],function(_0x2ad562){return{'model':db[_0x2ad562[_0xc4d0('0x21')]],'as':_0x2ad562['as'],'attributes':_0x2ad562[_0xc4d0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc4d0('0x23')](function(_0x28cb42){logger[_0xc4d0('0x10')](_0xc4d0('0x26'),_0x899062);logger[_0xc4d0('0x13')](_0xc4d0('0x26'),_0x899062,JSON[_0xc4d0('0x15')](_0x28cb42));_0x563fa0(_0x28cb42);})['catch'](function(_0x461daf){logger[_0xc4d0('0x16')](_0xc4d0('0x26'),_0x461daf[_0xc4d0('0x18')],_0x899062);_0x2d93be(_0x14f8ab[_0xc4d0('0x16')](0x1f4,_0x461daf[_0xc4d0('0x18')]));});});}; \ No newline at end of file +var _0x17f3=['map','model','stringify','ShowFaxQueue','bluebird','randomstring','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./faxQueue.socket','register','request','then','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','GetFaxQueue','FaxQueue','options','raw','where','attributes','limit','include'];(function(_0x3d3b53,_0x2a1ae4){var _0x13dd54=function(_0x47183c){while(--_0x47183c){_0x3d3b53['push'](_0x3d3b53['shift']());}};_0x13dd54(++_0x2a1ae4);}(_0x17f3,0xd0));var _0x317f=function(_0x3db23e,_0xdeed2){_0x3db23e=_0x3db23e-0x0;var _0x2f4c5c=_0x17f3[_0x3db23e];return _0x2f4c5c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x317f('0x0'));var rs=require(_0x317f('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x317f('0x2'))(_0x317f('0x3'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x317f('0x4')][_0x317f('0x5')]({'port':0x232a});config[_0x317f('0x6')]=_[_0x317f('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x317f('0x8'))(new Redis(config[_0x317f('0x6')]));require(_0x317f('0x9'))[_0x317f('0xa')](socket);function respondWithRpcPromise(_0x405d14,_0x16e948,_0x21ff4d){return new BPromise(function(_0x53af99,_0x24fd27){return client[_0x317f('0xb')](_0x405d14,_0x21ff4d)[_0x317f('0xc')](function(_0x2f36be){logger['info'](_0x317f('0xd'),_0x16e948,_0x317f('0xe'));logger[_0x317f('0xf')](_0x317f('0x10'),_0x16e948,_0x317f('0xe'),JSON['stringify'](_0x2f36be));if(_0x2f36be['error']){if(_0x2f36be[_0x317f('0x11')][_0x317f('0x12')]===0x1f4){logger['error']('FaxQueue,\x20%s,\x20%s',_0x16e948,_0x2f36be[_0x317f('0x11')][_0x317f('0x13')]);return _0x24fd27(_0x2f36be[_0x317f('0x11')][_0x317f('0x13')]);}logger[_0x317f('0x11')]('FaxQueue,\x20%s,\x20%s',_0x16e948,_0x2f36be['error']['message']);return _0x53af99(_0x2f36be[_0x317f('0x11')][_0x317f('0x13')]);}else{logger[_0x317f('0x14')](_0x317f('0xd'),_0x16e948,_0x317f('0xe'));_0x53af99(_0x2f36be['result']['message']);}})[_0x317f('0x15')](function(_0xc1eeee){logger['error'](_0x317f('0xd'),_0x16e948,_0xc1eeee);_0x24fd27(_0xc1eeee);});});}exports[_0x317f('0x16')]=function(_0x3a0f47){var _0xe35033=this;return new Promise(function(_0x4914bd,_0x1d22e0){return db[_0x317f('0x17')]['findAll']({'raw':_0x3a0f47[_0x317f('0x18')]?_0x3a0f47[_0x317f('0x18')][_0x317f('0x19')]===undefined?!![]:![]:!![],'where':_0x3a0f47[_0x317f('0x18')]?_0x3a0f47[_0x317f('0x18')][_0x317f('0x1a')]||null:null,'attributes':_0x3a0f47[_0x317f('0x18')]?_0x3a0f47[_0x317f('0x18')][_0x317f('0x1b')]||null:null,'limit':_0x3a0f47[_0x317f('0x18')]?_0x3a0f47[_0x317f('0x18')][_0x317f('0x1c')]||null:null,'include':_0x3a0f47[_0x317f('0x18')]?_0x3a0f47[_0x317f('0x18')][_0x317f('0x1d')]?_[_0x317f('0x1e')](_0x3a0f47[_0x317f('0x18')]['include'],function(_0x16809f){return{'model':db[_0x16809f[_0x317f('0x1f')]],'as':_0x16809f['as'],'attributes':_0x16809f[_0x317f('0x1b')],'include':_0x16809f[_0x317f('0x1d')]?_[_0x317f('0x1e')](_0x16809f[_0x317f('0x1d')],function(_0x288f13){return{'model':db[_0x288f13['model']],'as':_0x288f13['as'],'attributes':_0x288f13['attributes'],'include':_0x288f13[_0x317f('0x1d')]?_[_0x317f('0x1e')](_0x288f13[_0x317f('0x1d')],function(_0x3660a9){return{'model':db[_0x3660a9[_0x317f('0x1f')]],'as':_0x3660a9['as'],'attributes':_0x3660a9['attributes']};}):[]};}):[]};}):[]:[]})[_0x317f('0xc')](function(_0x3def9b){logger[_0x317f('0x14')]('GetFaxQueue',_0x3a0f47);logger[_0x317f('0xf')](_0x317f('0x16'),_0x3a0f47,JSON[_0x317f('0x20')](_0x3def9b));_0x4914bd(_0x3def9b);})[_0x317f('0x15')](function(_0x87d505){logger['error']('GetFaxQueue',_0x87d505[_0x317f('0x13')],_0x3a0f47);_0x1d22e0(_0xe35033[_0x317f('0x11')](0x1f4,_0x87d505[_0x317f('0x13')]));});});};exports[_0x317f('0x21')]=function(_0xe156eb){var _0x1500e7=this;return new Promise(function(_0x21d8e4,_0x3766e5){return db[_0x317f('0x17')]['find']({'raw':_0xe156eb[_0x317f('0x18')]?_0xe156eb['options'][_0x317f('0x19')]===undefined?!![]:![]:!![],'where':_0xe156eb[_0x317f('0x18')]?_0xe156eb[_0x317f('0x18')][_0x317f('0x1a')]||null:null,'attributes':_0xe156eb[_0x317f('0x18')]?_0xe156eb['options'][_0x317f('0x1b')]||null:null,'include':_0xe156eb[_0x317f('0x18')]?_0xe156eb['options'][_0x317f('0x1d')]?_[_0x317f('0x1e')](_0xe156eb[_0x317f('0x18')][_0x317f('0x1d')],function(_0x56af97){return{'model':db[_0x56af97[_0x317f('0x1f')]],'as':_0x56af97['as'],'attributes':_0x56af97[_0x317f('0x1b')],'include':_0x56af97[_0x317f('0x1d')]?_[_0x317f('0x1e')](_0x56af97[_0x317f('0x1d')],function(_0x3ffc20){return{'model':db[_0x3ffc20[_0x317f('0x1f')]],'as':_0x3ffc20['as'],'attributes':_0x3ffc20[_0x317f('0x1b')],'include':_0x3ffc20['include']?_['map'](_0x3ffc20[_0x317f('0x1d')],function(_0x2c081a){return{'model':db[_0x2c081a[_0x317f('0x1f')]],'as':_0x2c081a['as'],'attributes':_0x2c081a[_0x317f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x317f('0xc')](function(_0x1b4315){logger[_0x317f('0x14')](_0x317f('0x21'),_0xe156eb);logger[_0x317f('0xf')](_0x317f('0x21'),_0xe156eb,JSON[_0x317f('0x20')](_0x1b4315));_0x21d8e4(_0x1b4315);})[_0x317f('0x15')](function(_0x4a2913){logger[_0x317f('0x11')](_0x317f('0x21'),_0x4a2913[_0x317f('0x13')],_0xe156eb);_0x3766e5(_0x1500e7[_0x317f('0x11')](0x1f4,_0x4a2913[_0x317f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 185dc55..1021baa 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 _0x4829=['faxQueue:','save','remove','update','register','length'];(function(_0x583b79,_0x381e53){var _0x13c70f=function(_0x37f5c0){while(--_0x37f5c0){_0x583b79['push'](_0x583b79['shift']());}};_0x13c70f(++_0x381e53);}(_0x4829,0xcd));var _0x9482=function(_0x2b0bc2,_0x4331f5){_0x2b0bc2=_0x2b0bc2-0x0;var _0x56e5b9=_0x4829[_0x2b0bc2];return _0x56e5b9;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x9482('0x0'),_0x9482('0x1'),_0x9482('0x2')];function createListener(_0x285e59,_0xd6571a){return function(_0x412470){_0xd6571a['emit'](_0x285e59,_0x412470);};}function removeListener(_0x2218dc,_0x194faa){return function(){FaxQueueEvents['removeListener'](_0x2218dc,_0x194faa);};}exports[_0x9482('0x3')]=function(_0x5e734f){for(var _0x244e22=0x0,_0x66fe4b=events[_0x9482('0x4')];_0x244e22<_0x66fe4b;_0x244e22++){var _0x42c9ef=events[_0x244e22];var _0x4e18c2=createListener(_0x9482('0x5')+_0x42c9ef,_0x5e734f);FaxQueueEvents['on'](_0x42c9ef,_0x4e18c2);}}; \ No newline at end of file +var _0xe905=['update','emit','removeListener','register','length','faxQueue:','./faxQueue.events','save'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe905,0xe6));var _0x5e90=function(_0x2a3775,_0x32e5ca){_0x2a3775=_0x2a3775-0x0;var _0x126b36=_0xe905[_0x2a3775];return _0x126b36;};'use strict';var FaxQueueEvents=require(_0x5e90('0x0'));var events=[_0x5e90('0x1'),'remove',_0x5e90('0x2')];function createListener(_0x50c1b4,_0x4c28f9){return function(_0x60d981){_0x4c28f9[_0x5e90('0x3')](_0x50c1b4,_0x60d981);};}function removeListener(_0x578a6b,_0x5a75cc){return function(){FaxQueueEvents[_0x5e90('0x4')](_0x578a6b,_0x5a75cc);};}exports[_0x5e90('0x5')]=function(_0x46bf6e){for(var _0x12a6fc=0x0,_0x24e017=events[_0x5e90('0x6')];_0x12a6fc<_0x24e017;_0x12a6fc++){var _0x2cfb07=events[_0x12a6fc];var _0x2d171e=createListener(_0x5e90('0x7')+_0x2cfb07,_0x46bf6e);FaxQueueEvents['on'](_0x2cfb07,_0x2d171e);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index df5ffd4..585a75d 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 _0x1261=['isAuthenticated','describe','/:id','/:id/members','getTeams','/:id/users','getAgents','post','create','/:id/teams','addAgents','update','delete','destroy','removeTeams','removeAgents','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','index','get'];(function(_0x431feb,_0x394297){var _0x5b2a85=function(_0x4e869e){while(--_0x4e869e){_0x431feb['push'](_0x431feb['shift']());}};_0x5b2a85(++_0x394297);}(_0x1261,0x144));var _0x1126=function(_0x5263d2,_0x476862){_0x5263d2=_0x5263d2-0x0;var _0x2363a0=_0x1261[_0x5263d2];return _0x2363a0;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/describe',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['show']);router[_0x1126('0xb')](_0x1126('0xf'),auth[_0x1126('0xc')](),controller['getMembers']);router[_0x1126('0xb')]('/:id/teams',auth['isAuthenticated'](),controller[_0x1126('0x10')]);router['get'](_0x1126('0x11'),auth[_0x1126('0xc')](),controller[_0x1126('0x12')]);router[_0x1126('0x13')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0x14')]);router[_0x1126('0x13')](_0x1126('0x15'),auth[_0x1126('0xc')](),controller['addTeams']);router['post'](_0x1126('0x11'),auth[_0x1126('0xc')](),controller[_0x1126('0x16')]);router['put'](_0x1126('0xe'),auth['isAuthenticated'](),controller[_0x1126('0x17')]);router[_0x1126('0x18')](_0x1126('0xe'),auth['isAuthenticated'](),controller[_0x1126('0x19')]);router[_0x1126('0x18')]('/:id/teams',auth['isAuthenticated'](),controller[_0x1126('0x1a')]);router[_0x1126('0x18')]('/:id/users',auth['isAuthenticated'](),controller[_0x1126('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x7278=['../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','/describe','describe','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','addTeams','post','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0xb4d49d,_0x2d47fe){var _0x51f565=function(_0x4be692){while(--_0x4be692){_0xb4d49d['push'](_0xb4d49d['shift']());}};_0x51f565(++_0x2d47fe);}(_0x7278,0x161));var _0x8727=function(_0x10a694,_0x14ece0){_0x10a694=_0x10a694-0x0;var _0x1891fa=_0x7278[_0x10a694];return _0x1891fa;};'use strict';var multer=require(_0x8727('0x0'));var util=require(_0x8727('0x1'));var path=require(_0x8727('0x2'));var timeout=require(_0x8727('0x3'));var express=require(_0x8727('0x4'));var router=express['Router']();var fs_extra=require(_0x8727('0x5'));var auth=require(_0x8727('0x6'));var interaction=require(_0x8727('0x7'));var config=require(_0x8727('0x8'));var controller=require(_0x8727('0x9'));router[_0x8727('0xa')]('/',auth[_0x8727('0xb')](),controller['index']);router[_0x8727('0xa')](_0x8727('0xc'),auth[_0x8727('0xb')](),controller[_0x8727('0xd')]);router[_0x8727('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x8727('0xa')](_0x8727('0xe'),auth[_0x8727('0xb')](),controller[_0x8727('0xf')]);router[_0x8727('0xa')](_0x8727('0x10'),auth[_0x8727('0xb')](),controller[_0x8727('0x11')]);router['get'](_0x8727('0x12'),auth[_0x8727('0xb')](),controller[_0x8727('0x13')]);router['post']('/',auth[_0x8727('0xb')](),controller[_0x8727('0x14')]);router['post'](_0x8727('0x10'),auth[_0x8727('0xb')](),controller[_0x8727('0x15')]);router[_0x8727('0x16')](_0x8727('0x12'),auth[_0x8727('0xb')](),controller[_0x8727('0x17')]);router[_0x8727('0x18')](_0x8727('0x19'),auth[_0x8727('0xb')](),controller['update']);router[_0x8727('0x1a')](_0x8727('0x19'),auth[_0x8727('0xb')](),controller[_0x8727('0x1b')]);router[_0x8727('0x1a')](_0x8727('0x10'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x8727('0x1a')]('/:id/users',auth[_0x8727('0xb')](),controller[_0x8727('0x1c')]);module[_0x8727('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 4f7b494..514171d 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 _0x1f11=['STRING','DATE','moment','exports'];(function(_0x3b4ad5,_0x231672){var _0x7d2f01=function(_0x310f39){while(--_0x310f39){_0x3b4ad5['push'](_0x3b4ad5['shift']());}};_0x7d2f01(++_0x231672);}(_0x1f11,0x76));var _0x11f1=function(_0x3d07f2,_0x19854d){_0x3d07f2=_0x3d07f2-0x0;var _0x26052a=_0x1f11[_0x3d07f2];return _0x26052a;};'use strict';var moment=require(_0x11f1('0x0'));var Sequelize=require('sequelize');module[_0x11f1('0x1')]={'uniqueid':{'type':Sequelize[_0x11f1('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x11f1('0x2')]},'joinAt':{'type':Sequelize[_0x11f1('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x11f1('0x3')]},'exitAt':{'type':Sequelize[_0x11f1('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd024=['STRING','DATE','moment','sequelize'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xd024,0x112));var _0x4d02=function(_0x4a077e,_0x248059){_0x4a077e=_0x4a077e-0x0;var _0x45f4b9=_0xd024[_0x4a077e];return _0x45f4b9;};'use strict';var moment=require(_0x4d02('0x0'));var Sequelize=require(_0x4d02('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x4d02('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x4d02('0x3')]},'exitAt':{'type':Sequelize[_0x4d02('0x3')]},'reason':{'type':Sequelize[_0x4d02('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 504ce53..2e9dbce 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 _0xa900=['update','then','destroy','error','stack','name','send','index','FaxQueueReport','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa900,0x101));var _0x0a90=function(_0x401b64,_0x5cae66){_0x401b64=_0x401b64-0x0;var _0x139aa0=_0xa900[_0x401b64];return _0x139aa0;};'use strict';var emlformat=require(_0x0a90('0x0'));var rimraf=require(_0x0a90('0x1'));var zipdir=require(_0x0a90('0x2'));var jsonpatch=require(_0x0a90('0x3'));var rp=require(_0x0a90('0x4'));var moment=require(_0x0a90('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0a90('0x6'));var util=require('util');var path=require('path');var sox=require(_0x0a90('0x7'));var csv=require(_0x0a90('0x8'));var ejs=require(_0x0a90('0x9'));var fs=require('fs');var fs_extra=require(_0x0a90('0xa'));var _=require('lodash');var squel=require(_0x0a90('0xb'));var crypto=require(_0x0a90('0xc'));var jsforce=require(_0x0a90('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0a90('0x8'));var querystring=require(_0x0a90('0xe'));var Papa=require(_0x0a90('0xf'));var Redis=require('ioredis');var authService=require(_0x0a90('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0a90('0x11'));var hardwareService=require(_0x0a90('0x12'));var logger=require('../../config/logger')(_0x0a90('0x13'));var utils=require(_0x0a90('0x14'));var config=require(_0x0a90('0x15'));var licenseUtil=require(_0x0a90('0x16'));var db=require(_0x0a90('0x17'))['db'];function respondWithStatusCode(_0x37fd09,_0x198fec){_0x198fec=_0x198fec||0xcc;return function(_0x1f82d3){if(_0x1f82d3){return _0x37fd09[_0x0a90('0x18')](_0x198fec);}return _0x37fd09[_0x0a90('0x19')](_0x198fec)[_0x0a90('0x1a')]();};}function respondWithResult(_0x391bd7,_0x1f0dca){_0x1f0dca=_0x1f0dca||0xc8;return function(_0x50dfee){if(_0x50dfee){return _0x391bd7['status'](_0x1f0dca)[_0x0a90('0x1b')](_0x50dfee);}};}function respondWithFilteredResult(_0x91163a,_0x44237d){return function(_0x166806){if(_0x166806){var _0x87365=typeof _0x44237d[_0x0a90('0x1c')]===_0x0a90('0x1d')&&typeof _0x44237d['limit']===_0x0a90('0x1d');var _0x149fe9=_0x166806['count'];var _0x2c0719=_0x87365?0x0:_0x44237d[_0x0a90('0x1c')];var _0x619487=_0x87365?_0x166806[_0x0a90('0x1e')]:_0x44237d[_0x0a90('0x1c')]+_0x44237d[_0x0a90('0x1f')];var _0x4c2916;if(_0x619487>=_0x149fe9){_0x619487=_0x149fe9;_0x4c2916=0xc8;}else{_0x4c2916=0xce;}_0x91163a[_0x0a90('0x19')](_0x4c2916);return _0x91163a[_0x0a90('0x20')](_0x0a90('0x21'),_0x2c0719+'-'+_0x619487+'/'+_0x149fe9)['json'](_0x166806);}return null;};}function patchUpdates(_0x4ba044){return function(_0x7808b0){try{jsonpatch['apply'](_0x7808b0,_0x4ba044,!![]);}catch(_0x2b2ed5){return BPromise['reject'](_0x2b2ed5);}return _0x7808b0[_0x0a90('0x22')]();};}function saveUpdates(_0x30eb4a,_0xf3e76f){return function(_0x35b503){if(_0x35b503){return _0x35b503[_0x0a90('0x23')](_0x30eb4a)[_0x0a90('0x24')](function(_0x454c4c){return _0x454c4c;});}return null;};}function removeEntity(_0x1b2e71,_0x2c3431){return function(_0x228279){if(_0x228279){return _0x228279[_0x0a90('0x25')]()[_0x0a90('0x24')](function(){_0x1b2e71[_0x0a90('0x19')](0xcc)[_0x0a90('0x1a')]();});}};}function handleEntityNotFound(_0x569dc3,_0x47411a){return function(_0x21125a){if(!_0x21125a){_0x569dc3[_0x0a90('0x18')](0x194);}return _0x21125a;};}function handleError(_0x2d2285,_0x5261e7){_0x5261e7=_0x5261e7||0x1f4;return function(_0x1711e2){logger[_0x0a90('0x26')](_0x1711e2[_0x0a90('0x27')]);if(_0x1711e2[_0x0a90('0x28')]){delete _0x1711e2[_0x0a90('0x28')];}_0x2d2285[_0x0a90('0x19')](_0x5261e7)[_0x0a90('0x29')](_0x1711e2);};}exports[_0x0a90('0x2a')]=function(_0x285897,_0xbe5478){var _0x5e6886={},_0x3c194e={},_0x2d7f27={'count':0x0,'rows':[]};var _0x26f9cb=_['map'](db[_0x0a90('0x2b')]['rawAttributes'],function(_0x41c872){return{'name':_0x41c872[_0x0a90('0x2c')],'type':_0x41c872['type'][_0x0a90('0x2d')]};});_0x3c194e['model']=_[_0x0a90('0x2e')](_0x26f9cb,'name');_0x3c194e[_0x0a90('0x2f')]=_[_0x0a90('0x30')](_0x285897[_0x0a90('0x2f')]);_0x3c194e[_0x0a90('0x31')]=_[_0x0a90('0x32')](_0x3c194e[_0x0a90('0x33')],_0x3c194e[_0x0a90('0x2f')]);_0x5e6886[_0x0a90('0x34')]=_[_0x0a90('0x32')](_0x3c194e['model'],qs[_0x0a90('0x35')](_0x285897[_0x0a90('0x2f')]['fields']));_0x5e6886['attributes']=_0x5e6886[_0x0a90('0x34')]['length']?_0x5e6886['attributes']:_0x3c194e[_0x0a90('0x33')];if(!_0x285897[_0x0a90('0x2f')][_0x0a90('0x36')](_0x0a90('0x37'))){_0x5e6886[_0x0a90('0x1f')]=qs[_0x0a90('0x1f')](_0x285897[_0x0a90('0x2f')]['limit']);_0x5e6886[_0x0a90('0x1c')]=qs[_0x0a90('0x1c')](_0x285897[_0x0a90('0x2f')][_0x0a90('0x1c')]);}_0x5e6886['order']=qs['sort'](_0x285897['query']['sort']);_0x5e6886[_0x0a90('0x38')]=qs[_0x0a90('0x31')](_['pick'](_0x285897[_0x0a90('0x2f')],_0x3c194e[_0x0a90('0x31')]),_0x26f9cb);if(_0x285897['query'][_0x0a90('0x39')]){_0x5e6886['where']=_[_0x0a90('0x3a')](_0x5e6886[_0x0a90('0x38')],{'$or':_['map'](_0x26f9cb,function(_0x53eb86){if(_0x53eb86['type']!==_0x0a90('0x3b')){var _0x3b3139={};_0x3b3139[_0x53eb86[_0x0a90('0x28')]]={'$like':'%'+_0x285897['query'][_0x0a90('0x39')]+'%'};return _0x3b3139;}})});}_0x5e6886=_['merge']({},_0x5e6886,_0x285897[_0x0a90('0x3c')]);var _0x494996={'where':_0x5e6886[_0x0a90('0x38')]};return db[_0x0a90('0x2b')][_0x0a90('0x1e')](_0x494996)['then'](function(_0x23313e){_0x2d7f27[_0x0a90('0x1e')]=_0x23313e;if(_0x285897['query'][_0x0a90('0x3d')]){_0x5e6886['include']=[{'all':!![]}];}return db[_0x0a90('0x2b')][_0x0a90('0x3e')](_0x5e6886);})[_0x0a90('0x24')](function(_0x2e77b4){_0x2d7f27[_0x0a90('0x3f')]=_0x2e77b4;return _0x2d7f27;})[_0x0a90('0x24')](respondWithFilteredResult(_0xbe5478,_0x5e6886))[_0x0a90('0x40')](handleError(_0xbe5478,null));};exports[_0x0a90('0x41')]=function(_0x541376,_0x170cb8){var _0x4d5a45={'raw':!![],'where':{'id':_0x541376[_0x0a90('0x42')]['id']}},_0x123e56={};_0x123e56[_0x0a90('0x33')]=_[_0x0a90('0x30')](db[_0x0a90('0x2b')][_0x0a90('0x43')]);_0x123e56[_0x0a90('0x2f')]=_[_0x0a90('0x30')](_0x541376[_0x0a90('0x2f')]);_0x123e56[_0x0a90('0x31')]=_[_0x0a90('0x32')](_0x123e56['model'],_0x123e56[_0x0a90('0x2f')]);_0x4d5a45[_0x0a90('0x34')]=_[_0x0a90('0x32')](_0x123e56[_0x0a90('0x33')],qs[_0x0a90('0x35')](_0x541376[_0x0a90('0x2f')][_0x0a90('0x35')]));_0x4d5a45[_0x0a90('0x34')]=_0x4d5a45[_0x0a90('0x34')]['length']?_0x4d5a45[_0x0a90('0x34')]:_0x123e56[_0x0a90('0x33')];if(_0x541376['query']['includeAll']){_0x4d5a45[_0x0a90('0x44')]=[{'all':!![]}];}_0x4d5a45=_[_0x0a90('0x3a')]({},_0x4d5a45,_0x541376[_0x0a90('0x3c')]);return db[_0x0a90('0x2b')][_0x0a90('0x45')](_0x4d5a45)[_0x0a90('0x24')](handleEntityNotFound(_0x170cb8,null))[_0x0a90('0x24')](respondWithResult(_0x170cb8,null))[_0x0a90('0x40')](handleError(_0x170cb8,null));};exports[_0x0a90('0x46')]=function(_0x5dd88c,_0x249bf0){return db[_0x0a90('0x2b')][_0x0a90('0x46')](_0x5dd88c[_0x0a90('0x47')],{})[_0x0a90('0x24')](respondWithResult(_0x249bf0,0xc9))['catch'](handleError(_0x249bf0,null));};exports['update']=function(_0x19e0f7,_0x3b3494){if(_0x19e0f7[_0x0a90('0x47')]['id']){delete _0x19e0f7[_0x0a90('0x47')]['id'];}return db[_0x0a90('0x2b')][_0x0a90('0x45')]({'where':{'id':_0x19e0f7[_0x0a90('0x42')]['id']}})['then'](handleEntityNotFound(_0x3b3494,null))['then'](saveUpdates(_0x19e0f7[_0x0a90('0x47')],null))[_0x0a90('0x24')](respondWithResult(_0x3b3494,null))['catch'](handleError(_0x3b3494,null));};exports[_0x0a90('0x25')]=function(_0x2707be,_0x5a5a1e){return db['FaxQueueReport'][_0x0a90('0x45')]({'where':{'id':_0x2707be[_0x0a90('0x42')]['id']}})[_0x0a90('0x24')](handleEntityNotFound(_0x5a5a1e,null))[_0x0a90('0x24')](removeEntity(_0x5a5a1e,null))[_0x0a90('0x40')](handleError(_0x5a5a1e,null));};exports['describe']=function(_0x22a61b,_0x9b5936){return db[_0x0a90('0x2b')][_0x0a90('0x48')]()['then'](respondWithResult(_0x9b5936,null))['catch'](handleError(_0x9b5936,null));}; \ No newline at end of file +var _0x138d=['keys','query','filters','intersection','fields','attributes','nolimit','order','filter','where','merge','options','FaxQueueReport','includeAll','include','findAll','rows','params','length','catch','create','body','update','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','then','destroy','error','name','map','rawAttributes','fieldName','key','model'];(function(_0x442a6f,_0x465db4){var _0x280685=function(_0x22b7b8){while(--_0x22b7b8){_0x442a6f['push'](_0x442a6f['shift']());}};_0x280685(++_0x465db4);}(_0x138d,0x1ab));var _0xd138=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x138d[_0x934425];return _0x31d596;};'use strict';var emlformat=require(_0xd138('0x0'));var rimraf=require(_0xd138('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd138('0x2'));var rp=require(_0xd138('0x3'));var moment=require(_0xd138('0x4'));var BPromise=require(_0xd138('0x5'));var Mustache=require(_0xd138('0x6'));var util=require(_0xd138('0x7'));var path=require('path');var sox=require(_0xd138('0x8'));var csv=require(_0xd138('0x9'));var ejs=require(_0xd138('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd138('0xb'));var squel=require(_0xd138('0xc'));var crypto=require(_0xd138('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd138('0x9'));var querystring=require(_0xd138('0xe'));var Papa=require(_0xd138('0xf'));var Redis=require('ioredis');var authService=require(_0xd138('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd138('0x11'));var logger=require(_0xd138('0x12'))(_0xd138('0x13'));var utils=require(_0xd138('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xd138('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x429f16,_0x29e963){_0x29e963=_0x29e963||0xcc;return function(_0x11ed68){if(_0x11ed68){return _0x429f16[_0xd138('0x16')](_0x29e963);}return _0x429f16[_0xd138('0x17')](_0x29e963)[_0xd138('0x18')]();};}function respondWithResult(_0x24f99,_0x297102){_0x297102=_0x297102||0xc8;return function(_0x402d2c){if(_0x402d2c){return _0x24f99[_0xd138('0x17')](_0x297102)[_0xd138('0x19')](_0x402d2c);}};}function respondWithFilteredResult(_0x1f4ac1,_0x5cbee9){return function(_0x1526e9){if(_0x1526e9){var _0x3f8932=typeof _0x5cbee9['offset']==='undefined'&&typeof _0x5cbee9['limit']===_0xd138('0x1a');var _0x3a0d9b=_0x1526e9['count'];var _0x43a67d=_0x3f8932?0x0:_0x5cbee9[_0xd138('0x1b')];var _0x421d25=_0x3f8932?_0x1526e9[_0xd138('0x1c')]:_0x5cbee9['offset']+_0x5cbee9[_0xd138('0x1d')];var _0x36f021;if(_0x421d25>=_0x3a0d9b){_0x421d25=_0x3a0d9b;_0x36f021=0xc8;}else{_0x36f021=0xce;}_0x1f4ac1[_0xd138('0x17')](_0x36f021);return _0x1f4ac1[_0xd138('0x1e')](_0xd138('0x1f'),_0x43a67d+'-'+_0x421d25+'/'+_0x3a0d9b)[_0xd138('0x19')](_0x1526e9);}return null;};}function patchUpdates(_0x1755e5){return function(_0x4bd987){try{jsonpatch[_0xd138('0x20')](_0x4bd987,_0x1755e5,!![]);}catch(_0x2a5bfb){return BPromise['reject'](_0x2a5bfb);}return _0x4bd987['save']();};}function saveUpdates(_0x20c57a,_0x5e0f89){return function(_0x5ef010){if(_0x5ef010){return _0x5ef010['update'](_0x20c57a)[_0xd138('0x21')](function(_0x1bc6ef){return _0x1bc6ef;});}return null;};}function removeEntity(_0x2700ae,_0x4569f5){return function(_0x5bd0eb){if(_0x5bd0eb){return _0x5bd0eb[_0xd138('0x22')]()[_0xd138('0x21')](function(){_0x2700ae[_0xd138('0x17')](0xcc)[_0xd138('0x18')]();});}};}function handleEntityNotFound(_0x425cd8,_0x5b11d0){return function(_0x294757){if(!_0x294757){_0x425cd8[_0xd138('0x16')](0x194);}return _0x294757;};}function handleError(_0x136048,_0x413d5c){_0x413d5c=_0x413d5c||0x1f4;return function(_0x1d45b7){logger[_0xd138('0x23')](_0x1d45b7['stack']);if(_0x1d45b7[_0xd138('0x24')]){delete _0x1d45b7['name'];}_0x136048[_0xd138('0x17')](_0x413d5c)['send'](_0x1d45b7);};}exports['index']=function(_0x5df7c1,_0x15c73e){var _0x46acdf={},_0x250da9={},_0xda4456={'count':0x0,'rows':[]};var _0x5d66e1=_[_0xd138('0x25')](db['FaxQueueReport'][_0xd138('0x26')],function(_0x2d60f4){return{'name':_0x2d60f4[_0xd138('0x27')],'type':_0x2d60f4['type'][_0xd138('0x28')]};});_0x250da9[_0xd138('0x29')]=_['map'](_0x5d66e1,_0xd138('0x24'));_0x250da9['query']=_[_0xd138('0x2a')](_0x5df7c1[_0xd138('0x2b')]);_0x250da9[_0xd138('0x2c')]=_[_0xd138('0x2d')](_0x250da9[_0xd138('0x29')],_0x250da9[_0xd138('0x2b')]);_0x46acdf['attributes']=_[_0xd138('0x2d')](_0x250da9[_0xd138('0x29')],qs[_0xd138('0x2e')](_0x5df7c1['query'][_0xd138('0x2e')]));_0x46acdf['attributes']=_0x46acdf[_0xd138('0x2f')]['length']?_0x46acdf[_0xd138('0x2f')]:_0x250da9[_0xd138('0x29')];if(!_0x5df7c1[_0xd138('0x2b')]['hasOwnProperty'](_0xd138('0x30'))){_0x46acdf['limit']=qs[_0xd138('0x1d')](_0x5df7c1[_0xd138('0x2b')]['limit']);_0x46acdf['offset']=qs[_0xd138('0x1b')](_0x5df7c1['query'][_0xd138('0x1b')]);}_0x46acdf[_0xd138('0x31')]=qs['sort'](_0x5df7c1['query']['sort']);_0x46acdf['where']=qs[_0xd138('0x2c')](_['pick'](_0x5df7c1[_0xd138('0x2b')],_0x250da9[_0xd138('0x2c')]),_0x5d66e1);if(_0x5df7c1[_0xd138('0x2b')][_0xd138('0x32')]){_0x46acdf[_0xd138('0x33')]=_[_0xd138('0x34')](_0x46acdf[_0xd138('0x33')],{'$or':_[_0xd138('0x25')](_0x5d66e1,function(_0x51d934){if(_0x51d934['type']!=='VIRTUAL'){var _0x2fd523={};_0x2fd523[_0x51d934[_0xd138('0x24')]]={'$like':'%'+_0x5df7c1[_0xd138('0x2b')][_0xd138('0x32')]+'%'};return _0x2fd523;}})});}_0x46acdf=_['merge']({},_0x46acdf,_0x5df7c1[_0xd138('0x35')]);var _0x52a62c={'where':_0x46acdf[_0xd138('0x33')]};return db[_0xd138('0x36')][_0xd138('0x1c')](_0x52a62c)[_0xd138('0x21')](function(_0xf4161a){_0xda4456[_0xd138('0x1c')]=_0xf4161a;if(_0x5df7c1[_0xd138('0x2b')][_0xd138('0x37')]){_0x46acdf[_0xd138('0x38')]=[{'all':!![]}];}return db['FaxQueueReport'][_0xd138('0x39')](_0x46acdf);})[_0xd138('0x21')](function(_0x3b56c5){_0xda4456[_0xd138('0x3a')]=_0x3b56c5;return _0xda4456;})[_0xd138('0x21')](respondWithFilteredResult(_0x15c73e,_0x46acdf))['catch'](handleError(_0x15c73e,null));};exports['show']=function(_0x16c7e6,_0x43c81f){var _0x325ea1={'raw':!![],'where':{'id':_0x16c7e6[_0xd138('0x3b')]['id']}},_0x95282e={};_0x95282e[_0xd138('0x29')]=_[_0xd138('0x2a')](db[_0xd138('0x36')][_0xd138('0x26')]);_0x95282e[_0xd138('0x2b')]=_[_0xd138('0x2a')](_0x16c7e6[_0xd138('0x2b')]);_0x95282e['filters']=_[_0xd138('0x2d')](_0x95282e[_0xd138('0x29')],_0x95282e[_0xd138('0x2b')]);_0x325ea1['attributes']=_[_0xd138('0x2d')](_0x95282e[_0xd138('0x29')],qs[_0xd138('0x2e')](_0x16c7e6[_0xd138('0x2b')][_0xd138('0x2e')]));_0x325ea1[_0xd138('0x2f')]=_0x325ea1['attributes'][_0xd138('0x3c')]?_0x325ea1[_0xd138('0x2f')]:_0x95282e['model'];if(_0x16c7e6[_0xd138('0x2b')]['includeAll']){_0x325ea1[_0xd138('0x38')]=[{'all':!![]}];}_0x325ea1=_[_0xd138('0x34')]({},_0x325ea1,_0x16c7e6[_0xd138('0x35')]);return db['FaxQueueReport']['find'](_0x325ea1)[_0xd138('0x21')](handleEntityNotFound(_0x43c81f,null))[_0xd138('0x21')](respondWithResult(_0x43c81f,null))[_0xd138('0x3d')](handleError(_0x43c81f,null));};exports[_0xd138('0x3e')]=function(_0x3b5005,_0x5e195c){return db['FaxQueueReport']['create'](_0x3b5005[_0xd138('0x3f')],{})[_0xd138('0x21')](respondWithResult(_0x5e195c,0xc9))[_0xd138('0x3d')](handleError(_0x5e195c,null));};exports[_0xd138('0x40')]=function(_0x5c7c02,_0x5e9973){if(_0x5c7c02[_0xd138('0x3f')]['id']){delete _0x5c7c02[_0xd138('0x3f')]['id'];}return db[_0xd138('0x36')][_0xd138('0x41')]({'where':{'id':_0x5c7c02['params']['id']}})[_0xd138('0x21')](handleEntityNotFound(_0x5e9973,null))[_0xd138('0x21')](saveUpdates(_0x5c7c02[_0xd138('0x3f')],null))['then'](respondWithResult(_0x5e9973,null))[_0xd138('0x3d')](handleError(_0x5e9973,null));};exports[_0xd138('0x22')]=function(_0x3d2ed0,_0x5d89a7){return db['FaxQueueReport']['find']({'where':{'id':_0x3d2ed0[_0xd138('0x3b')]['id']}})[_0xd138('0x21')](handleEntityNotFound(_0x5d89a7,null))[_0xd138('0x21')](removeEntity(_0x5d89a7,null))[_0xd138('0x3d')](handleError(_0x5d89a7,null));};exports['describe']=function(_0x293baf,_0x15201a){return db[_0xd138('0x36')][_0xd138('0x42')]()[_0xd138('0x21')](respondWithResult(_0x15201a,null))['catch'](handleError(_0x15201a,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 2ba98fd..fd94bf0 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 _0xe14b=['bluebird','path','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','moment'];(function(_0x4cbf9c,_0xac5c3e){var _0x344e25=function(_0x16d758){while(--_0x16d758){_0x4cbf9c['push'](_0x4cbf9c['shift']());}};_0x344e25(++_0xac5c3e);}(_0xe14b,0x93));var _0xbe14=function(_0x114ab9,_0x3e07c2){_0x114ab9=_0x114ab9-0x0;var _0x4c4f27=_0xe14b[_0x114ab9];return _0x4c4f27;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','define','report_fax_queue','uniqueid','util'];(function(_0x3b7210,_0x269947){var _0x17d10f=function(_0xd16973){while(--_0xd16973){_0x3b7210['push'](_0x3b7210['shift']());}};_0x17d10f(++_0x269947);}(_0x1261,0x144));var _0x1126=function(_0x45d31c,_0xd0b936){_0x45d31c=_0x45d31c-0x0;var _0x33c23a=_0x1261[_0x45d31c];return _0x33c23a;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('FaxQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 2c54471..7c16d75 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 _0x3ace=['request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateFaxQueueReport','FaxQueueReport','create','options','raw','stringify','update','body','where','attributes','UpdateFaxQueueReport','lodash','util','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0x3ace,0x12d));var _0xe3ac=function(_0x38cbd1,_0x5e6c09){_0x38cbd1=_0x38cbd1-0x0;var _0x232f29=_0x3ace[_0x38cbd1];return _0x232f29;};'use strict';var _=require(_0xe3ac('0x0'));var util=require(_0xe3ac('0x1'));var moment=require(_0xe3ac('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe3ac('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xe3ac('0x4'))(_0xe3ac('0x5'));var config=require(_0xe3ac('0x6'));var jayson=require(_0xe3ac('0x7'));var client=jayson['client'][_0xe3ac('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5dd48c,_0x4d29c0,_0xe7ab95){return new BPromise(function(_0x1da4ce,_0xbebfeb){return client[_0xe3ac('0x9')](_0x5dd48c,_0xe7ab95)[_0xe3ac('0xa')](function(_0x1ae7a6){logger[_0xe3ac('0xb')](_0xe3ac('0xc'),_0x4d29c0,_0xe3ac('0xd'));logger[_0xe3ac('0xe')](_0xe3ac('0xf'),_0x4d29c0,_0xe3ac('0xd'),JSON['stringify'](_0x1ae7a6));if(_0x1ae7a6[_0xe3ac('0x10')]){if(_0x1ae7a6['error'][_0xe3ac('0x11')]===0x1f4){logger[_0xe3ac('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x4d29c0,_0x1ae7a6[_0xe3ac('0x10')][_0xe3ac('0x12')]);return _0xbebfeb(_0x1ae7a6[_0xe3ac('0x10')][_0xe3ac('0x12')]);}logger[_0xe3ac('0x10')](_0xe3ac('0xc'),_0x4d29c0,_0x1ae7a6[_0xe3ac('0x10')][_0xe3ac('0x12')]);return _0x1da4ce(_0x1ae7a6[_0xe3ac('0x10')][_0xe3ac('0x12')]);}else{logger[_0xe3ac('0xb')]('FaxQueueReport,\x20%s,\x20%s',_0x4d29c0,_0xe3ac('0xd'));_0x1da4ce(_0x1ae7a6['result'][_0xe3ac('0x12')]);}})[_0xe3ac('0x13')](function(_0x4c5402){logger[_0xe3ac('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x4d29c0,_0x4c5402);_0xbebfeb(_0x4c5402);});});}exports[_0xe3ac('0x14')]=function(_0x5e6b5a){var _0x4e5750=this;return new Promise(function(_0x28228f,_0x465da2){return db[_0xe3ac('0x15')][_0xe3ac('0x16')](_0x5e6b5a['body'],{'raw':_0x5e6b5a[_0xe3ac('0x17')]?_0x5e6b5a[_0xe3ac('0x17')][_0xe3ac('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x39c362){logger[_0xe3ac('0xb')](_0xe3ac('0x14'),_0x5e6b5a);logger['debug'](_0xe3ac('0x14'),_0x5e6b5a,JSON[_0xe3ac('0x19')](_0x39c362));_0x28228f(_0x39c362);})[_0xe3ac('0x13')](function(_0x5e6914){logger[_0xe3ac('0x10')](_0xe3ac('0x14'),_0x5e6914[_0xe3ac('0x12')],_0x5e6b5a);_0x465da2(_0x4e5750[_0xe3ac('0x10')](0x1f4,_0x5e6914[_0xe3ac('0x12')]));});});};exports['UpdateFaxQueueReport']=function(_0x4734ce){var _0x398ecc=this;return new Promise(function(_0x485e8a,_0x1bc2c4){return db[_0xe3ac('0x15')][_0xe3ac('0x1a')](_0x4734ce[_0xe3ac('0x1b')],{'raw':_0x4734ce[_0xe3ac('0x17')]?_0x4734ce[_0xe3ac('0x17')][_0xe3ac('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4734ce[_0xe3ac('0x17')]?_0x4734ce[_0xe3ac('0x17')][_0xe3ac('0x1c')]||null:null,'attributes':_0x4734ce['options']?_0x4734ce['options'][_0xe3ac('0x1d')]||null:null,'limit':_0x4734ce[_0xe3ac('0x17')]?_0x4734ce[_0xe3ac('0x17')]['limit']||null:null})['then'](function(_0x34b9c7){logger[_0xe3ac('0xb')](_0xe3ac('0x1e'),_0x4734ce);logger[_0xe3ac('0xe')](_0xe3ac('0x1e'),_0x4734ce,JSON[_0xe3ac('0x19')](_0x34b9c7));_0x485e8a(_0x34b9c7);})['catch'](function(_0x4df627){logger[_0xe3ac('0x10')]('UpdateFaxQueueReport',_0x4df627['message'],_0x4734ce);_0x1bc2c4(_0x398ecc[_0xe3ac('0x10')](0x1f4,_0x4df627[_0xe3ac('0x12')]));});});}; \ No newline at end of file +var _0xb17f=['../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','code','error','FaxQueueReport,\x20%s,\x20%s','message','result','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','stringify','catch','update','where','attributes','limit','UpdateFaxQueueReport','util','moment','randomstring','ioredis'];(function(_0x283bfe,_0x195a4c){var _0x32cf60=function(_0x36ad42){while(--_0x36ad42){_0x283bfe['push'](_0x283bfe['shift']());}};_0x32cf60(++_0x195a4c);}(_0xb17f,0x167));var _0xfb17=function(_0x2da0ae,_0x5eee88){_0x2da0ae=_0x2da0ae-0x0;var _0x5036c3=_0xb17f[_0x2da0ae];return _0x5036c3;};'use strict';var _=require('lodash');var util=require(_0xfb17('0x0'));var moment=require(_0xfb17('0x1'));var BPromise=require('bluebird');var rs=require(_0xfb17('0x2'));var fs=require('fs');var Redis=require(_0xfb17('0x3'));var db=require(_0xfb17('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfb17('0x5'));var config=require(_0xfb17('0x6'));var jayson=require(_0xfb17('0x7'));var client=jayson[_0xfb17('0x8')][_0xfb17('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xbb398a,_0x36b699,_0x5ba5ff){return new BPromise(function(_0x39bbe6,_0x95fbc4){return client[_0xfb17('0xa')](_0xbb398a,_0x5ba5ff)[_0xfb17('0xb')](function(_0x389a88){logger[_0xfb17('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x36b699,_0xfb17('0xd'));logger[_0xfb17('0xe')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x36b699,_0xfb17('0xd'),JSON['stringify'](_0x389a88));if(_0x389a88['error']){if(_0x389a88['error'][_0xfb17('0xf')]===0x1f4){logger[_0xfb17('0x10')](_0xfb17('0x11'),_0x36b699,_0x389a88[_0xfb17('0x10')]['message']);return _0x95fbc4(_0x389a88[_0xfb17('0x10')][_0xfb17('0x12')]);}logger[_0xfb17('0x10')](_0xfb17('0x11'),_0x36b699,_0x389a88[_0xfb17('0x10')][_0xfb17('0x12')]);return _0x39bbe6(_0x389a88['error'][_0xfb17('0x12')]);}else{logger[_0xfb17('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x36b699,_0xfb17('0xd'));_0x39bbe6(_0x389a88[_0xfb17('0x13')]['message']);}})['catch'](function(_0x453473){logger[_0xfb17('0x10')](_0xfb17('0x11'),_0x36b699,_0x453473);_0x95fbc4(_0x453473);});});}exports[_0xfb17('0x14')]=function(_0x445e2f){var _0x24b3dd=this;return new Promise(function(_0x3921b5,_0x5bc16b){return db[_0xfb17('0x15')][_0xfb17('0x16')](_0x445e2f[_0xfb17('0x17')],{'raw':_0x445e2f['options']?_0x445e2f[_0xfb17('0x18')][_0xfb17('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x124f8b){logger[_0xfb17('0xc')](_0xfb17('0x14'),_0x445e2f);logger['debug'](_0xfb17('0x14'),_0x445e2f,JSON[_0xfb17('0x1a')](_0x124f8b));_0x3921b5(_0x124f8b);})[_0xfb17('0x1b')](function(_0x29002f){logger[_0xfb17('0x10')]('CreateFaxQueueReport',_0x29002f['message'],_0x445e2f);_0x5bc16b(_0x24b3dd[_0xfb17('0x10')](0x1f4,_0x29002f['message']));});});};exports['UpdateFaxQueueReport']=function(_0xb97b97){var _0x483460=this;return new Promise(function(_0xe87793,_0x219826){return db[_0xfb17('0x15')][_0xfb17('0x1c')](_0xb97b97[_0xfb17('0x17')],{'raw':_0xb97b97[_0xfb17('0x18')]?_0xb97b97[_0xfb17('0x18')][_0xfb17('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb97b97[_0xfb17('0x18')]?_0xb97b97[_0xfb17('0x18')][_0xfb17('0x1d')]||null:null,'attributes':_0xb97b97['options']?_0xb97b97[_0xfb17('0x18')][_0xfb17('0x1e')]||null:null,'limit':_0xb97b97['options']?_0xb97b97[_0xfb17('0x18')][_0xfb17('0x1f')]||null:null})[_0xfb17('0xb')](function(_0x33a8a7){logger[_0xfb17('0xc')]('UpdateFaxQueueReport',_0xb97b97);logger[_0xfb17('0xe')]('UpdateFaxQueueReport',_0xb97b97,JSON[_0xfb17('0x1a')](_0x33a8a7));_0xe87793(_0x33a8a7);})[_0xfb17('0x1b')](function(_0x3b7a53){logger[_0xfb17('0x10')](_0xfb17('0x20'),_0x3b7a53[_0xfb17('0x12')],_0xb97b97);_0x219826(_0x483460['error'](0x1f4,_0x3b7a53['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index e3ee49a..05b0ac3 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 _0x3729=['put','delete','exports','multer','util','path','connect-timeout','express','Router','./faxQueueReport.controller','isAuthenticated','index','/describe','get','/:id','post'];(function(_0x475cec,_0x46f668){var _0x7e8591=function(_0x4376a7){while(--_0x4376a7){_0x475cec['push'](_0x475cec['shift']());}};_0x7e8591(++_0x46f668);}(_0x3729,0xf3));var _0x9372=function(_0x4e20ed,_0x19a754){_0x4e20ed=_0x4e20ed-0x0;var _0x420e62=_0x3729[_0x4e20ed];return _0x420e62;};'use strict';var multer=require(_0x9372('0x0'));var util=require(_0x9372('0x1'));var path=require(_0x9372('0x2'));var timeout=require(_0x9372('0x3'));var express=require(_0x9372('0x4'));var router=express[_0x9372('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9372('0x6'));router['get']('/',auth[_0x9372('0x7')](),controller[_0x9372('0x8')]);router['get'](_0x9372('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x9372('0xa')](_0x9372('0xb'),auth[_0x9372('0x7')](),controller['show']);router[_0x9372('0xc')]('/',auth[_0x9372('0x7')](),controller['create']);router[_0x9372('0xd')](_0x9372('0xb'),auth[_0x9372('0x7')](),controller['update']);router[_0x9372('0xe')]('/:id',auth[_0x9372('0x7')](),controller['destroy']);module[_0x9372('0xf')]=router; \ No newline at end of file +var _0x126a=['get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueueReport.controller'];(function(_0x34ddbd,_0x495f13){var _0x2a5fce=function(_0x365136){while(--_0x365136){_0x34ddbd['push'](_0x34ddbd['shift']());}};_0x2a5fce(++_0x495f13);}(_0x126a,0x195));var _0xa126=function(_0x494169,_0x40e671){_0x494169=_0x494169-0x0;var _0x4ad3b5=_0x126a[_0x494169];return _0x4ad3b5;};'use strict';var multer=require(_0xa126('0x0'));var util=require(_0xa126('0x1'));var path=require(_0xa126('0x2'));var timeout=require('connect-timeout');var express=require(_0xa126('0x3'));var router=express[_0xa126('0x4')]();var fs_extra=require(_0xa126('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa126('0x6'));var config=require(_0xa126('0x7'));var controller=require(_0xa126('0x8'));router[_0xa126('0x9')]('/',auth['isAuthenticated'](),controller[_0xa126('0xa')]);router[_0xa126('0x9')](_0xa126('0xb'),auth[_0xa126('0xc')](),controller[_0xa126('0xd')]);router[_0xa126('0x9')](_0xa126('0xe'),auth[_0xa126('0xc')](),controller[_0xa126('0xf')]);router[_0xa126('0x10')]('/',auth[_0xa126('0xc')](),controller[_0xa126('0x11')]);router[_0xa126('0x12')](_0xa126('0xe'),auth[_0xa126('0xc')](),controller[_0xa126('0x13')]);router[_0xa126('0x14')](_0xa126('0xe'),auth[_0xa126('0xc')](),controller[_0xa126('0x15')]);module[_0xa126('0x16')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index e06dbff..8823173 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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x2bf5d1,_0x14e28f){var _0x3472c6=function(_0xa369da){while(--_0xa369da){_0x2bf5d1['push'](_0x2bf5d1['shift']());}};_0x3472c6(++_0x14e28f);}(_0x008c,0x188));var _0xc008=function(_0x35a9a7,_0x5e8c7f){_0x35a9a7=_0x35a9a7-0x0;var _0x142c13=_0x008c[_0x35a9a7];return _0x142c13;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x4b078b,_0x53030c){var _0x4bc65c=function(_0x3103b0){while(--_0x3103b0){_0x4b078b['push'](_0x4b078b['shift']());}};_0x4bc65c(++_0x53030c);}(_0x9c44,0x178));var _0x49c4=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x9c44[_0x160c73];return _0xd9302;};'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/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 2a869fe..4b78e90 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 _0x633e=['filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','type','key','query'];(function(_0x331d5b,_0x5f2da9){var _0x174282=function(_0x350e12){while(--_0x350e12){_0x331d5b['push'](_0x331d5b['shift']());}};_0x174282(++_0x5f2da9);}(_0x633e,0x1a6));var _0xe633=function(_0x1658d8,_0x27e598){_0x1658d8=_0x1658d8-0x0;var _0x544880=_0x633e[_0x1658d8];return _0x544880;};'use strict';var emlformat=require(_0xe633('0x0'));var rimraf=require(_0xe633('0x1'));var zipdir=require(_0xe633('0x2'));var jsonpatch=require(_0xe633('0x3'));var rp=require(_0xe633('0x4'));var moment=require(_0xe633('0x5'));var BPromise=require(_0xe633('0x6'));var Mustache=require('mustache');var util=require(_0xe633('0x7'));var path=require(_0xe633('0x8'));var sox=require(_0xe633('0x9'));var csv=require(_0xe633('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe633('0xb'));var _=require(_0xe633('0xc'));var squel=require(_0xe633('0xd'));var crypto=require(_0xe633('0xe'));var jsforce=require(_0xe633('0xf'));var deskjs=require(_0xe633('0x10'));var toCsv=require(_0xe633('0xa'));var querystring=require('querystring');var Papa=require(_0xe633('0x11'));var Redis=require(_0xe633('0x12'));var authService=require(_0xe633('0x13'));var qs=require(_0xe633('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe633('0x15'));var logger=require(_0xe633('0x16'))(_0xe633('0x17'));var utils=require('../../config/utils');var config=require(_0xe633('0x18'));var licenseUtil=require(_0xe633('0x19'));var db=require(_0xe633('0x1a'))['db'];function respondWithStatusCode(_0x17c196,_0x2c0a8a){_0x2c0a8a=_0x2c0a8a||0xcc;return function(_0x5062b7){if(_0x5062b7){return _0x17c196[_0xe633('0x1b')](_0x2c0a8a);}return _0x17c196[_0xe633('0x1c')](_0x2c0a8a)[_0xe633('0x1d')]();};}function respondWithResult(_0x48d837,_0x156ae4){_0x156ae4=_0x156ae4||0xc8;return function(_0x4bb45b){if(_0x4bb45b){return _0x48d837[_0xe633('0x1c')](_0x156ae4)[_0xe633('0x1e')](_0x4bb45b);}};}function respondWithFilteredResult(_0x402358,_0x3b86bc){return function(_0x165fd9){if(_0x165fd9){var _0x358b02=typeof _0x3b86bc[_0xe633('0x1f')]===_0xe633('0x20')&&typeof _0x3b86bc['limit']===_0xe633('0x20');var _0x1a5348=_0x165fd9[_0xe633('0x21')];var _0x3e50fc=_0x358b02?0x0:_0x3b86bc[_0xe633('0x1f')];var _0x26bd63=_0x358b02?_0x165fd9[_0xe633('0x21')]:_0x3b86bc['offset']+_0x3b86bc[_0xe633('0x22')];var _0x12c275;if(_0x26bd63>=_0x1a5348){_0x26bd63=_0x1a5348;_0x12c275=0xc8;}else{_0x12c275=0xce;}_0x402358['status'](_0x12c275);return _0x402358[_0xe633('0x23')](_0xe633('0x24'),_0x3e50fc+'-'+_0x26bd63+'/'+_0x1a5348)[_0xe633('0x1e')](_0x165fd9);}return null;};}function patchUpdates(_0x459b13){return function(_0x362916){try{jsonpatch[_0xe633('0x25')](_0x362916,_0x459b13,!![]);}catch(_0x22dee5){return BPromise[_0xe633('0x26')](_0x22dee5);}return _0x362916['save']();};}function saveUpdates(_0x5633f7,_0x1eb160){return function(_0x24f2dd){if(_0x24f2dd){return _0x24f2dd['update'](_0x5633f7)[_0xe633('0x27')](function(_0x203925){return _0x203925;});}return null;};}function removeEntity(_0x3761e2,_0x3fb16b){return function(_0x587e20){if(_0x587e20){return _0x587e20[_0xe633('0x28')]()[_0xe633('0x27')](function(){_0x3761e2[_0xe633('0x1c')](0xcc)[_0xe633('0x1d')]();});}};}function handleEntityNotFound(_0x520ba6,_0x53f1da){return function(_0x85c614){if(!_0x85c614){_0x520ba6[_0xe633('0x1b')](0x194);}return _0x85c614;};}function handleError(_0x24f3db,_0x2c7871){_0x2c7871=_0x2c7871||0x1f4;return function(_0xb8614e){logger[_0xe633('0x29')](_0xb8614e[_0xe633('0x2a')]);if(_0xb8614e[_0xe633('0x2b')]){delete _0xb8614e[_0xe633('0x2b')];}_0x24f3db[_0xe633('0x1c')](_0x2c7871)[_0xe633('0x2c')](_0xb8614e);};}exports[_0xe633('0x2d')]=function(_0xd37025,_0x17f41c){var _0x34f9b4={},_0x14ab87={},_0x2a861f={'count':0x0,'rows':[]};var _0x4ba23d=_[_0xe633('0x2e')](db[_0xe633('0x2f')][_0xe633('0x30')],function(_0x184c52){return{'name':_0x184c52['fieldName'],'type':_0x184c52[_0xe633('0x31')][_0xe633('0x32')]};});_0x14ab87['model']=_[_0xe633('0x2e')](_0x4ba23d,_0xe633('0x2b'));_0x14ab87[_0xe633('0x33')]=_['keys'](_0xd37025[_0xe633('0x33')]);_0x14ab87[_0xe633('0x34')]=_[_0xe633('0x35')](_0x14ab87[_0xe633('0x36')],_0x14ab87[_0xe633('0x33')]);_0x34f9b4[_0xe633('0x37')]=_[_0xe633('0x35')](_0x14ab87['model'],qs['fields'](_0xd37025[_0xe633('0x33')][_0xe633('0x38')]));_0x34f9b4[_0xe633('0x37')]=_0x34f9b4[_0xe633('0x37')][_0xe633('0x39')]?_0x34f9b4['attributes']:_0x14ab87[_0xe633('0x36')];if(!_0xd37025[_0xe633('0x33')][_0xe633('0x3a')](_0xe633('0x3b'))){_0x34f9b4[_0xe633('0x22')]=qs['limit'](_0xd37025[_0xe633('0x33')][_0xe633('0x22')]);_0x34f9b4[_0xe633('0x1f')]=qs[_0xe633('0x1f')](_0xd37025[_0xe633('0x33')][_0xe633('0x1f')]);}_0x34f9b4[_0xe633('0x3c')]=qs['sort'](_0xd37025[_0xe633('0x33')]['sort']);_0x34f9b4[_0xe633('0x3d')]=qs['filters'](_[_0xe633('0x3e')](_0xd37025[_0xe633('0x33')],_0x14ab87['filters']),_0x4ba23d);if(_0xd37025[_0xe633('0x33')][_0xe633('0x3f')]){_0x34f9b4[_0xe633('0x3d')]=_[_0xe633('0x40')](_0x34f9b4['where'],{'$or':_[_0xe633('0x2e')](_0x4ba23d,function(_0x3f183d){if(_0x3f183d[_0xe633('0x31')]!=='VIRTUAL'){var _0x307794={};_0x307794[_0x3f183d[_0xe633('0x2b')]]={'$like':'%'+_0xd37025[_0xe633('0x33')][_0xe633('0x3f')]+'%'};return _0x307794;}})});}_0x34f9b4=_[_0xe633('0x40')]({},_0x34f9b4,_0xd37025[_0xe633('0x41')]);var _0x55b40b={'where':_0x34f9b4[_0xe633('0x3d')]};return db[_0xe633('0x2f')][_0xe633('0x21')](_0x55b40b)[_0xe633('0x27')](function(_0x4e86f7){_0x2a861f[_0xe633('0x21')]=_0x4e86f7;if(_0xd37025[_0xe633('0x33')][_0xe633('0x42')]){_0x34f9b4[_0xe633('0x43')]=[{'all':!![]}];}return db['FaxTransferReport'][_0xe633('0x44')](_0x34f9b4);})[_0xe633('0x27')](function(_0x49d9a7){_0x2a861f[_0xe633('0x45')]=_0x49d9a7;return _0x2a861f;})[_0xe633('0x27')](respondWithFilteredResult(_0x17f41c,_0x34f9b4))[_0xe633('0x46')](handleError(_0x17f41c,null));};exports[_0xe633('0x47')]=function(_0x2abb89,_0x2e2d37){var _0x29512c={'raw':!![],'where':{'id':_0x2abb89[_0xe633('0x48')]['id']}},_0x5225d7={};_0x5225d7[_0xe633('0x36')]=_['keys'](db[_0xe633('0x2f')][_0xe633('0x30')]);_0x5225d7[_0xe633('0x33')]=_[_0xe633('0x49')](_0x2abb89[_0xe633('0x33')]);_0x5225d7['filters']=_[_0xe633('0x35')](_0x5225d7['model'],_0x5225d7['query']);_0x29512c['attributes']=_[_0xe633('0x35')](_0x5225d7[_0xe633('0x36')],qs[_0xe633('0x38')](_0x2abb89[_0xe633('0x33')][_0xe633('0x38')]));_0x29512c[_0xe633('0x37')]=_0x29512c[_0xe633('0x37')][_0xe633('0x39')]?_0x29512c[_0xe633('0x37')]:_0x5225d7[_0xe633('0x36')];if(_0x2abb89['query'][_0xe633('0x42')]){_0x29512c[_0xe633('0x43')]=[{'all':!![]}];}_0x29512c=_['merge']({},_0x29512c,_0x2abb89[_0xe633('0x41')]);return db[_0xe633('0x2f')][_0xe633('0x4a')](_0x29512c)[_0xe633('0x27')](handleEntityNotFound(_0x2e2d37,null))[_0xe633('0x27')](respondWithResult(_0x2e2d37,null))['catch'](handleError(_0x2e2d37,null));};exports[_0xe633('0x4b')]=function(_0x5dbaa9,_0x54b3ce){return db[_0xe633('0x2f')][_0xe633('0x4b')](_0x5dbaa9[_0xe633('0x4c')],{})['then'](respondWithResult(_0x54b3ce,0xc9))[_0xe633('0x46')](handleError(_0x54b3ce,null));};exports[_0xe633('0x4d')]=function(_0x1c4441,_0x3fa662){if(_0x1c4441[_0xe633('0x4c')]['id']){delete _0x1c4441[_0xe633('0x4c')]['id'];}return db[_0xe633('0x2f')][_0xe633('0x4a')]({'where':{'id':_0x1c4441[_0xe633('0x48')]['id']}})[_0xe633('0x27')](handleEntityNotFound(_0x3fa662,null))['then'](saveUpdates(_0x1c4441[_0xe633('0x4c')],null))['then'](respondWithResult(_0x3fa662,null))[_0xe633('0x46')](handleError(_0x3fa662,null));};exports['destroy']=function(_0x18206b,_0x3d893b){return db['FaxTransferReport'][_0xe633('0x4a')]({'where':{'id':_0x18206b[_0xe633('0x48')]['id']}})[_0xe633('0x27')](handleEntityNotFound(_0x3d893b,null))['then'](removeEntity(_0x3d893b,null))[_0xe633('0x46')](handleError(_0x3d893b,null));};exports['describe']=function(_0x4065f1,_0x384bfa){return db['FaxTransferReport'][_0xe633('0x4e')]()[_0xe633('0x27')](respondWithResult(_0x384bfa,null))['catch'](handleError(_0x384bfa,null));}; \ No newline at end of file +var _0x19a1=['eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','json','apply','reject','save','destroy','then','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','include','findAll','catch','show','params','length','includeAll','find','create','body','describe'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x19a1,0x1e0));var _0x119a=function(_0x4d9798,_0x4f0807){_0x4d9798=_0x4d9798-0x0;var _0x48975f=_0x19a1[_0x4d9798];return _0x48975f;};'use strict';var emlformat=require(_0x119a('0x0'));var rimraf=require(_0x119a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x119a('0x2'));var rp=require('request-promise');var moment=require(_0x119a('0x3'));var BPromise=require(_0x119a('0x4'));var Mustache=require(_0x119a('0x5'));var util=require(_0x119a('0x6'));var path=require(_0x119a('0x7'));var sox=require(_0x119a('0x8'));var csv=require(_0x119a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x119a('0xa'));var _=require(_0x119a('0xb'));var squel=require(_0x119a('0xc'));var crypto=require(_0x119a('0xd'));var jsforce=require(_0x119a('0xe'));var deskjs=require(_0x119a('0xf'));var toCsv=require(_0x119a('0x9'));var querystring=require('querystring');var Papa=require(_0x119a('0x10'));var Redis=require(_0x119a('0x11'));var authService=require(_0x119a('0x12'));var qs=require(_0x119a('0x13'));var as=require(_0x119a('0x14'));var hardwareService=require(_0x119a('0x15'));var logger=require(_0x119a('0x16'))(_0x119a('0x17'));var utils=require(_0x119a('0x18'));var config=require(_0x119a('0x19'));var licenseUtil=require(_0x119a('0x1a'));var db=require(_0x119a('0x1b'))['db'];function respondWithStatusCode(_0x3e4927,_0x43067e){_0x43067e=_0x43067e||0xcc;return function(_0x206277){if(_0x206277){return _0x3e4927[_0x119a('0x1c')](_0x43067e);}return _0x3e4927['status'](_0x43067e)[_0x119a('0x1d')]();};}function respondWithResult(_0x4046a8,_0x3ada3){_0x3ada3=_0x3ada3||0xc8;return function(_0x3e4fa4){if(_0x3e4fa4){return _0x4046a8[_0x119a('0x1e')](_0x3ada3)['json'](_0x3e4fa4);}};}function respondWithFilteredResult(_0x324027,_0x4824d8){return function(_0x7ccd3e){if(_0x7ccd3e){var _0x2013e5=typeof _0x4824d8['offset']===_0x119a('0x1f')&&typeof _0x4824d8[_0x119a('0x20')]===_0x119a('0x1f');var _0x508319=_0x7ccd3e[_0x119a('0x21')];var _0x43a5fa=_0x2013e5?0x0:_0x4824d8[_0x119a('0x22')];var _0x416c58=_0x2013e5?_0x7ccd3e[_0x119a('0x21')]:_0x4824d8['offset']+_0x4824d8[_0x119a('0x20')];var _0x27b190;if(_0x416c58>=_0x508319){_0x416c58=_0x508319;_0x27b190=0xc8;}else{_0x27b190=0xce;}_0x324027[_0x119a('0x1e')](_0x27b190);return _0x324027[_0x119a('0x23')]('Content-Range',_0x43a5fa+'-'+_0x416c58+'/'+_0x508319)[_0x119a('0x24')](_0x7ccd3e);}return null;};}function patchUpdates(_0x51c8f1){return function(_0x3144a5){try{jsonpatch[_0x119a('0x25')](_0x3144a5,_0x51c8f1,!![]);}catch(_0x47f1bb){return BPromise[_0x119a('0x26')](_0x47f1bb);}return _0x3144a5[_0x119a('0x27')]();};}function saveUpdates(_0x5b137c,_0x46b9be){return function(_0x636437){if(_0x636437){return _0x636437['update'](_0x5b137c)['then'](function(_0x2e1640){return _0x2e1640;});}return null;};}function removeEntity(_0x343a64,_0x335b2e){return function(_0x3e0205){if(_0x3e0205){return _0x3e0205[_0x119a('0x28')]()[_0x119a('0x29')](function(){_0x343a64[_0x119a('0x1e')](0xcc)[_0x119a('0x1d')]();});}};}function handleEntityNotFound(_0x54d015,_0x4f66dd){return function(_0x4d5843){if(!_0x4d5843){_0x54d015['sendStatus'](0x194);}return _0x4d5843;};}function handleError(_0x8b70e9,_0x32f3bf){_0x32f3bf=_0x32f3bf||0x1f4;return function(_0x896bb6){logger[_0x119a('0x2a')](_0x896bb6[_0x119a('0x2b')]);if(_0x896bb6[_0x119a('0x2c')]){delete _0x896bb6[_0x119a('0x2c')];}_0x8b70e9[_0x119a('0x1e')](_0x32f3bf)[_0x119a('0x2d')](_0x896bb6);};}exports[_0x119a('0x2e')]=function(_0x51c128,_0x2493ef){var _0x14ab8d={},_0x3cf024={},_0x28cb28={'count':0x0,'rows':[]};var _0xf1b6ce=_[_0x119a('0x2f')](db[_0x119a('0x30')][_0x119a('0x31')],function(_0x2162f7){return{'name':_0x2162f7['fieldName'],'type':_0x2162f7[_0x119a('0x32')][_0x119a('0x33')]};});_0x3cf024[_0x119a('0x34')]=_[_0x119a('0x2f')](_0xf1b6ce,_0x119a('0x2c'));_0x3cf024[_0x119a('0x35')]=_[_0x119a('0x36')](_0x51c128['query']);_0x3cf024['filters']=_[_0x119a('0x37')](_0x3cf024['model'],_0x3cf024[_0x119a('0x35')]);_0x14ab8d[_0x119a('0x38')]=_[_0x119a('0x37')](_0x3cf024[_0x119a('0x34')],qs[_0x119a('0x39')](_0x51c128['query'][_0x119a('0x39')]));_0x14ab8d['attributes']=_0x14ab8d[_0x119a('0x38')]['length']?_0x14ab8d['attributes']:_0x3cf024['model'];if(!_0x51c128[_0x119a('0x35')][_0x119a('0x3a')](_0x119a('0x3b'))){_0x14ab8d[_0x119a('0x20')]=qs[_0x119a('0x20')](_0x51c128[_0x119a('0x35')][_0x119a('0x20')]);_0x14ab8d[_0x119a('0x22')]=qs[_0x119a('0x22')](_0x51c128['query']['offset']);}_0x14ab8d[_0x119a('0x3c')]=qs[_0x119a('0x3d')](_0x51c128[_0x119a('0x35')][_0x119a('0x3d')]);_0x14ab8d[_0x119a('0x3e')]=qs[_0x119a('0x3f')](_[_0x119a('0x40')](_0x51c128[_0x119a('0x35')],_0x3cf024['filters']),_0xf1b6ce);if(_0x51c128[_0x119a('0x35')]['filter']){_0x14ab8d[_0x119a('0x3e')]=_[_0x119a('0x41')](_0x14ab8d[_0x119a('0x3e')],{'$or':_[_0x119a('0x2f')](_0xf1b6ce,function(_0x1b6cd4){if(_0x1b6cd4[_0x119a('0x32')]!==_0x119a('0x42')){var _0x4b39b2={};_0x4b39b2[_0x1b6cd4[_0x119a('0x2c')]]={'$like':'%'+_0x51c128[_0x119a('0x35')][_0x119a('0x43')]+'%'};return _0x4b39b2;}})});}_0x14ab8d=_[_0x119a('0x41')]({},_0x14ab8d,_0x51c128[_0x119a('0x44')]);var _0x18ae1f={'where':_0x14ab8d[_0x119a('0x3e')]};return db[_0x119a('0x30')][_0x119a('0x21')](_0x18ae1f)['then'](function(_0x4c646f){_0x28cb28[_0x119a('0x21')]=_0x4c646f;if(_0x51c128['query']['includeAll']){_0x14ab8d[_0x119a('0x45')]=[{'all':!![]}];}return db[_0x119a('0x30')][_0x119a('0x46')](_0x14ab8d);})['then'](function(_0x3859c6){_0x28cb28['rows']=_0x3859c6;return _0x28cb28;})[_0x119a('0x29')](respondWithFilteredResult(_0x2493ef,_0x14ab8d))[_0x119a('0x47')](handleError(_0x2493ef,null));};exports[_0x119a('0x48')]=function(_0x9f5c5,_0x19d8f2){var _0x31ee1a={'raw':!![],'where':{'id':_0x9f5c5[_0x119a('0x49')]['id']}},_0x5e309a={};_0x5e309a['model']=_[_0x119a('0x36')](db[_0x119a('0x30')]['rawAttributes']);_0x5e309a[_0x119a('0x35')]=_[_0x119a('0x36')](_0x9f5c5[_0x119a('0x35')]);_0x5e309a['filters']=_[_0x119a('0x37')](_0x5e309a[_0x119a('0x34')],_0x5e309a[_0x119a('0x35')]);_0x31ee1a[_0x119a('0x38')]=_['intersection'](_0x5e309a[_0x119a('0x34')],qs[_0x119a('0x39')](_0x9f5c5['query'][_0x119a('0x39')]));_0x31ee1a['attributes']=_0x31ee1a[_0x119a('0x38')][_0x119a('0x4a')]?_0x31ee1a[_0x119a('0x38')]:_0x5e309a[_0x119a('0x34')];if(_0x9f5c5[_0x119a('0x35')][_0x119a('0x4b')]){_0x31ee1a[_0x119a('0x45')]=[{'all':!![]}];}_0x31ee1a=_[_0x119a('0x41')]({},_0x31ee1a,_0x9f5c5[_0x119a('0x44')]);return db[_0x119a('0x30')][_0x119a('0x4c')](_0x31ee1a)[_0x119a('0x29')](handleEntityNotFound(_0x19d8f2,null))[_0x119a('0x29')](respondWithResult(_0x19d8f2,null))[_0x119a('0x47')](handleError(_0x19d8f2,null));};exports['create']=function(_0x1345d3,_0x3a38b0){return db[_0x119a('0x30')][_0x119a('0x4d')](_0x1345d3[_0x119a('0x4e')],{})[_0x119a('0x29')](respondWithResult(_0x3a38b0,0xc9))['catch'](handleError(_0x3a38b0,null));};exports['update']=function(_0xd035ef,_0xba5b00){if(_0xd035ef['body']['id']){delete _0xd035ef[_0x119a('0x4e')]['id'];}return db['FaxTransferReport']['find']({'where':{'id':_0xd035ef[_0x119a('0x49')]['id']}})[_0x119a('0x29')](handleEntityNotFound(_0xba5b00,null))['then'](saveUpdates(_0xd035ef[_0x119a('0x4e')],null))[_0x119a('0x29')](respondWithResult(_0xba5b00,null))['catch'](handleError(_0xba5b00,null));};exports[_0x119a('0x28')]=function(_0x55864c,_0x2b110f){return db[_0x119a('0x30')][_0x119a('0x4c')]({'where':{'id':_0x55864c[_0x119a('0x49')]['id']}})[_0x119a('0x29')](handleEntityNotFound(_0x2b110f,null))[_0x119a('0x29')](removeEntity(_0x2b110f,null))[_0x119a('0x47')](handleError(_0x2b110f,null));};exports[_0x119a('0x4f')]=function(_0x5b4236,_0x257829){return db[_0x119a('0x30')][_0x119a('0x4f')]()[_0x119a('0x29')](respondWithResult(_0x257829,null))[_0x119a('0x47')](handleError(_0x257829,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 765eeec..ea5a227 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 _0xf609=['exports','define','FaxTransferReport','report_fax_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./faxTransferReport.attributes'];(function(_0x468b10,_0x1a35ee){var _0xce8bbd=function(_0x2899c5){while(--_0x2899c5){_0x468b10['push'](_0x468b10['shift']());}};_0xce8bbd(++_0x1a35ee);}(_0xf609,0x18b));var _0x9f60=function(_0x1e076b,_0x29a97c){_0x1e076b=_0x1e076b-0x0;var _0x12f072=_0xf609[_0x1e076b];return _0x12f072;};'use strict';var _=require('lodash');var util=require(_0x9f60('0x0'));var logger=require(_0x9f60('0x1'))(_0x9f60('0x2'));var moment=require(_0x9f60('0x3'));var BPromise=require(_0x9f60('0x4'));var rp=require(_0x9f60('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9f60('0x6'));var attributes=require(_0x9f60('0x7'));module[_0x9f60('0x8')]=function(_0x462e54,_0x12972a){return _0x462e54[_0x9f60('0x9')](_0x9f60('0xa'),attributes,{'tableName':_0x9f60('0xb'),'paranoid':![],'indexes':[{'name':_0x9f60('0xc'),'fields':[_0x9f60('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3164=['path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1abcac,_0x3891ff){var _0x7d6c2b=function(_0xc64c0a){while(--_0xc64c0a){_0x1abcac['push'](_0x1abcac['shift']());}};_0x7d6c2b(++_0x3891ff);}(_0x3164,0x85));var _0x4316=function(_0x484783,_0x5adb3b){_0x484783=_0x484783-0x0;var _0x583af8=_0x3164[_0x484783];return _0x583af8;};'use strict';var _=require(_0x4316('0x0'));var util=require(_0x4316('0x1'));var logger=require(_0x4316('0x2'))(_0x4316('0x3'));var moment=require(_0x4316('0x4'));var BPromise=require(_0x4316('0x5'));var rp=require(_0x4316('0x6'));var fs=require('fs');var path=require(_0x4316('0x7'));var rimraf=require(_0x4316('0x8'));var config=require(_0x4316('0x9'));var attributes=require(_0x4316('0xa'));module[_0x4316('0xb')]=function(_0x3f82c4,_0x364941){return _0x3f82c4['define']('FaxTransferReport',attributes,{'tableName':_0x4316('0xc'),'paranoid':![],'indexes':[{'name':_0x4316('0xd'),'fields':[_0x4316('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 590fd7f..dec5c9f 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 _0x5a46=['../../config/environment','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3416d9,_0x6a56f9){var _0x589ad9=function(_0x451180){while(--_0x451180){_0x3416d9['push'](_0x3416d9['shift']());}};_0x589ad9(++_0x6a56f9);}(_0x5a46,0x92));var _0x65a4=function(_0x3f16f0,_0x181a7e){_0x3f16f0=_0x3f16f0-0x0;var _0x72ea58=_0x5a46[_0x3f16f0];return _0x72ea58;};'use strict';var _=require('lodash');var util=require(_0x65a4('0x0'));var moment=require(_0x65a4('0x1'));var BPromise=require(_0x65a4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x65a4('0x3'));var db=require(_0x65a4('0x4'))['db'];var utils=require(_0x65a4('0x5'));var logger=require(_0x65a4('0x6'))(_0x65a4('0x7'));var config=require(_0x65a4('0x8'));var jayson=require(_0x65a4('0x9'));var client=jayson[_0x65a4('0xa')][_0x65a4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xeffe5b,_0x596dfc,_0x4e962b){return new BPromise(function(_0x1484a6,_0x23afa5){return client[_0x65a4('0xc')](_0xeffe5b,_0x4e962b)[_0x65a4('0xd')](function(_0x5ef74f){logger[_0x65a4('0xe')](_0x65a4('0xf'),_0x596dfc,_0x65a4('0x10'));logger[_0x65a4('0x11')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x596dfc,'request\x20sent',JSON[_0x65a4('0x12')](_0x5ef74f));if(_0x5ef74f['error']){if(_0x5ef74f[_0x65a4('0x13')]['code']===0x1f4){logger[_0x65a4('0x13')](_0x65a4('0xf'),_0x596dfc,_0x5ef74f[_0x65a4('0x13')][_0x65a4('0x14')]);return _0x23afa5(_0x5ef74f[_0x65a4('0x13')]['message']);}logger['error'](_0x65a4('0xf'),_0x596dfc,_0x5ef74f[_0x65a4('0x13')][_0x65a4('0x14')]);return _0x1484a6(_0x5ef74f['error'][_0x65a4('0x14')]);}else{logger['info'](_0x65a4('0xf'),_0x596dfc,_0x65a4('0x10'));_0x1484a6(_0x5ef74f[_0x65a4('0x15')][_0x65a4('0x14')]);}})['catch'](function(_0x99f2ea){logger['error'](_0x65a4('0xf'),_0x596dfc,_0x99f2ea);_0x23afa5(_0x99f2ea);});});} \ No newline at end of file +var _0x3020=['FaxTransferReport,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5cbdab,_0x1a5fee){var _0x22e504=function(_0x3da889){while(--_0x3da889){_0x5cbdab['push'](_0x5cbdab['shift']());}};_0x22e504(++_0x1a5fee);}(_0x3020,0x147));var _0x0302=function(_0x5e6352,_0x3232f5){_0x5e6352=_0x5e6352-0x0;var _0x1e6f46=_0x3020[_0x5e6352];return _0x1e6f46;};'use strict';var _=require(_0x0302('0x0'));var util=require('util');var moment=require(_0x0302('0x1'));var BPromise=require(_0x0302('0x2'));var rs=require(_0x0302('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0302('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0302('0x5'))(_0x0302('0x6'));var config=require(_0x0302('0x7'));var jayson=require(_0x0302('0x8'));var client=jayson[_0x0302('0x9')][_0x0302('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd89692,_0x2b85b0,_0x23300f){return new BPromise(function(_0xe854fb,_0xb95f92){return client[_0x0302('0xb')](_0xd89692,_0x23300f)['then'](function(_0x28ecda){logger[_0x0302('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x2b85b0,'request\x20sent');logger[_0x0302('0xd')](_0x0302('0xe'),_0x2b85b0,'request\x20sent',JSON[_0x0302('0xf')](_0x28ecda));if(_0x28ecda[_0x0302('0x10')]){if(_0x28ecda[_0x0302('0x10')][_0x0302('0x11')]===0x1f4){logger[_0x0302('0x10')](_0x0302('0x12'),_0x2b85b0,_0x28ecda['error']['message']);return _0xb95f92(_0x28ecda['error']['message']);}logger[_0x0302('0x10')](_0x0302('0x12'),_0x2b85b0,_0x28ecda[_0x0302('0x10')][_0x0302('0x13')]);return _0xe854fb(_0x28ecda['error'][_0x0302('0x13')]);}else{logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x2b85b0,_0x0302('0x14'));_0xe854fb(_0x28ecda[_0x0302('0x15')][_0x0302('0x13')]);}})[_0x0302('0x16')](function(_0x52b358){logger['error'](_0x0302('0x12'),_0x2b85b0,_0x52b358);_0xb95f92(_0x52b358);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 3ba73ec..bd29cc0 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 _0xf4cf=['/describe','describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xf4cf,0x1c0));var _0xff4c=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xf4cf[_0x13e741];return _0x3f8bb3;};'use strict';var multer=require(_0xff4c('0x0'));var util=require(_0xff4c('0x1'));var path=require('path');var timeout=require(_0xff4c('0x2'));var express=require(_0xff4c('0x3'));var router=express[_0xff4c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xff4c('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxTransferReport.controller');router[_0xff4c('0x6')]('/',auth[_0xff4c('0x7')](),controller['index']);router[_0xff4c('0x6')](_0xff4c('0x8'),auth[_0xff4c('0x7')](),controller[_0xff4c('0x9')]);router[_0xff4c('0x6')]('/:id',auth[_0xff4c('0x7')](),controller[_0xff4c('0xa')]);router[_0xff4c('0xb')]('/',auth['isAuthenticated'](),controller[_0xff4c('0xc')]);router[_0xff4c('0xd')](_0xff4c('0xe'),auth['isAuthenticated'](),controller[_0xff4c('0xf')]);router[_0xff4c('0x10')](_0xff4c('0xe'),auth[_0xff4c('0x7')](),controller[_0xff4c('0x11')]);module[_0xff4c('0x12')]=router; \ No newline at end of file +var _0xc1c2=['index','/describe','describe','show','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x1d1673,_0x2833c1){var _0x20a04b=function(_0x55cb2a){while(--_0x55cb2a){_0x1d1673['push'](_0x1d1673['shift']());}};_0x20a04b(++_0x2833c1);}(_0xc1c2,0x146));var _0x2c1c=function(_0x19dbd8,_0x409fbb){_0x19dbd8=_0x19dbd8-0x0;var _0x16b6fc=_0xc1c2[_0x19dbd8];return _0x16b6fc;};'use strict';var multer=require(_0x2c1c('0x0'));var util=require(_0x2c1c('0x1'));var path=require(_0x2c1c('0x2'));var timeout=require(_0x2c1c('0x3'));var express=require(_0x2c1c('0x4'));var router=express[_0x2c1c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2c1c('0x6'));var interaction=require(_0x2c1c('0x7'));var config=require('../../config/environment');var controller=require('./faxTransferReport.controller');router[_0x2c1c('0x8')]('/',auth[_0x2c1c('0x9')](),controller[_0x2c1c('0xa')]);router[_0x2c1c('0x8')](_0x2c1c('0xb'),auth[_0x2c1c('0x9')](),controller[_0x2c1c('0xc')]);router[_0x2c1c('0x8')]('/:id',auth[_0x2c1c('0x9')](),controller[_0x2c1c('0xd')]);router['post']('/',auth[_0x2c1c('0x9')](),controller[_0x2c1c('0xe')]);router[_0x2c1c('0xf')](_0x2c1c('0x10'),auth[_0x2c1c('0x9')](),controller[_0x2c1c('0x11')]);router[_0x2c1c('0x12')](_0x2c1c('0x10'),auth[_0x2c1c('0x9')](),controller[_0x2c1c('0x13')]);module[_0x2c1c('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 9c60fe6..e717421 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 _0x31a5=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x31a5,0x16c));var _0x531a=function(_0x53a0ad,_0x5700c9){_0x53a0ad=_0x53a0ad-0x0;var _0x2e1e21=_0x31a5[_0x53a0ad];return _0x2e1e21;};'use strict';var multer=require('multer');var util=require(_0x531a('0x0'));var path=require(_0x531a('0x1'));var timeout=require(_0x531a('0x2'));var express=require(_0x531a('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x531a('0x4'));var interaction=require(_0x531a('0x5'));var config=require(_0x531a('0x6'));var controller=require(_0x531a('0x7'));router['get']('/',auth[_0x531a('0x8')](),controller[_0x531a('0x9')]);router[_0x531a('0xa')](_0x531a('0xb'),auth['isAuthenticated'](),controller[_0x531a('0xc')]);router[_0x531a('0xa')](_0x531a('0xd'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x531a('0xa')](_0x531a('0xe'),auth['isAuthenticated'](),controller[_0x531a('0xf')]);router[_0x531a('0x10')]('/',auth[_0x531a('0x8')](),controller[_0x531a('0x11')]);router[_0x531a('0x10')]('/:id/configurations',auth[_0x531a('0x8')](),controller[_0x531a('0x12')]);router[_0x531a('0x13')]('/:id',auth[_0x531a('0x8')](),controller['update']);router[_0x531a('0x14')](_0x531a('0xb'),auth[_0x531a('0x8')](),controller[_0x531a('0x15')]);module[_0x531a('0x16')]=router; \ No newline at end of file +var _0x3099=['index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','update','delete','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated'];(function(_0x555a57,_0x30234b){var _0x55eb66=function(_0x5a7f62){while(--_0x5a7f62){_0x555a57['push'](_0x555a57['shift']());}};_0x55eb66(++_0x30234b);}(_0x3099,0x137));var _0x9309=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3099[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x9309('0x0'));var util=require(_0x9309('0x1'));var path=require(_0x9309('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9309('0x3'));var interaction=require(_0x9309('0x4'));var config=require(_0x9309('0x5'));var controller=require(_0x9309('0x6'));router[_0x9309('0x7')]('/',auth[_0x9309('0x8')](),controller[_0x9309('0x9')]);router[_0x9309('0x7')](_0x9309('0xa'),auth[_0x9309('0x8')](),controller[_0x9309('0xb')]);router['get'](_0x9309('0xc'),auth[_0x9309('0x8')](),controller[_0x9309('0xd')]);router[_0x9309('0x7')]('/:id/fields',auth[_0x9309('0x8')](),controller[_0x9309('0xe')]);router[_0x9309('0xf')]('/',auth[_0x9309('0x8')](),controller[_0x9309('0x10')]);router[_0x9309('0xf')](_0x9309('0xc'),auth[_0x9309('0x8')](),controller[_0x9309('0x11')]);router['put']('/:id',auth[_0x9309('0x8')](),controller[_0x9309('0x12')]);router[_0x9309('0x13')](_0x9309('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 8a17b30..848d4d3 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 _0x41b2=['sequelize','exports','STRING','ENUM','basic','integrationTab','newTab'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x41b2,0xd9));var _0x241b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41b2[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x241b('0x0'));module[_0x241b('0x1')]={'name':{'type':Sequelize[_0x241b('0x2')]},'description':{'type':Sequelize[_0x241b('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x241b('0x3')](_0x241b('0x4')),'defaultValue':_0x241b('0x4')},'password':{'type':Sequelize[_0x241b('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x241b('0x2')]},'tokenSecret':{'type':Sequelize[_0x241b('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x241b('0x5'),_0x241b('0x6')),'defaultValue':_0x241b('0x5')}}; \ No newline at end of file +var _0xd3f2=['newTab','sequelize','exports','STRING','ENUM','basic','integrationTab'];(function(_0x327f9c,_0x1fa90f){var _0x17ab3f=function(_0x587c91){while(--_0x587c91){_0x327f9c['push'](_0x327f9c['shift']());}};_0x17ab3f(++_0x1fa90f);}(_0xd3f2,0x197));var _0x2d3f=function(_0x23e77c,_0x11b8a5){_0x23e77c=_0x23e77c-0x0;var _0x43e3cc=_0xd3f2[_0x23e77c];return _0x43e3cc;};'use strict';var Sequelize=require(_0x2d3f('0x0'));module[_0x2d3f('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2d3f('0x2')]},'username':{'type':Sequelize[_0x2d3f('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x2d3f('0x3')]('basic'),'defaultValue':_0x2d3f('0x4')},'password':{'type':Sequelize[_0x2d3f('0x2')]},'consumerKey':{'type':Sequelize[_0x2d3f('0x2')]},'consumerSecret':{'type':Sequelize[_0x2d3f('0x2')]},'token':{'type':Sequelize[_0x2d3f('0x2')]},'tokenSecret':{'type':Sequelize[_0x2d3f('0x2')]},'serverUrl':{'type':Sequelize[_0x2d3f('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2d3f('0x3')](_0x2d3f('0x5'),_0x2d3f('0x6')),'defaultValue':_0x2d3f('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 3459cc8..78cbdf9 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 _0x89cb=['fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','include','findAll','rows','catch','show','length','includeAll','options','find','create','body','params','DeskConfiguration','getConfigurations','addConfiguration','findOne','Subjects','getSubjects','Descriptions','getDescriptions','channel','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','format','application/json','headers','Authorization','%s:%s','base64','concat','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','DeskAccount','rawAttributes','fieldName','model','map','query','keys','filters','intersection'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x89cb,0xb6));var _0xb89c=function(_0xf97732,_0x1703cb){_0xf97732=_0xf97732-0x0;var _0x4e364f=_0x89cb[_0xf97732];return _0x4e364f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb89c('0x0'));var zipdir=require(_0xb89c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb89c('0x2'));var BPromise=require(_0xb89c('0x3'));var Mustache=require(_0xb89c('0x4'));var util=require('util');var path=require(_0xb89c('0x5'));var sox=require(_0xb89c('0x6'));var csv=require(_0xb89c('0x7'));var ejs=require(_0xb89c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb89c('0x9'));var squel=require(_0xb89c('0xa'));var crypto=require(_0xb89c('0xb'));var jsforce=require(_0xb89c('0xc'));var deskjs=require(_0xb89c('0xd'));var toCsv=require(_0xb89c('0x7'));var querystring=require(_0xb89c('0xe'));var Papa=require('papaparse');var Redis=require(_0xb89c('0xf'));var authService=require(_0xb89c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb89c('0x11'));var hardwareService=require(_0xb89c('0x12'));var logger=require(_0xb89c('0x13'))(_0xb89c('0x14'));var utils=require('../../config/utils');var config=require(_0xb89c('0x15'));var licenseUtil=require(_0xb89c('0x16'));var db=require(_0xb89c('0x17'))['db'];var integrations=require(_0xb89c('0x18'));function respondWithStatusCode(_0x81f9d8,_0xfa866f){_0xfa866f=_0xfa866f||0xcc;return function(_0x1e8721){if(_0x1e8721){return _0x81f9d8[_0xb89c('0x19')](_0xfa866f);}return _0x81f9d8[_0xb89c('0x1a')](_0xfa866f)[_0xb89c('0x1b')]();};}function respondWithResult(_0x6570c8,_0x3bfaee){_0x3bfaee=_0x3bfaee||0xc8;return function(_0x30b37c){if(_0x30b37c){return _0x6570c8[_0xb89c('0x1a')](_0x3bfaee)[_0xb89c('0x1c')](_0x30b37c);}};}function respondWithFilteredResult(_0x570a0d,_0x5661dc){return function(_0x5e70ac){if(_0x5e70ac){var _0x5c45b8=typeof _0x5661dc[_0xb89c('0x1d')]==='undefined'&&typeof _0x5661dc[_0xb89c('0x1e')]===_0xb89c('0x1f');var _0x38353e=_0x5e70ac[_0xb89c('0x20')];var _0x46dd88=_0x5c45b8?0x0:_0x5661dc[_0xb89c('0x1d')];var _0x16a9ae=_0x5c45b8?_0x5e70ac[_0xb89c('0x20')]:_0x5661dc[_0xb89c('0x1d')]+_0x5661dc[_0xb89c('0x1e')];var _0x1cb23d;if(_0x16a9ae>=_0x38353e){_0x16a9ae=_0x38353e;_0x1cb23d=0xc8;}else{_0x1cb23d=0xce;}_0x570a0d['status'](_0x1cb23d);return _0x570a0d[_0xb89c('0x21')](_0xb89c('0x22'),_0x46dd88+'-'+_0x16a9ae+'/'+_0x38353e)[_0xb89c('0x1c')](_0x5e70ac);}return null;};}function patchUpdates(_0x1391f9){return function(_0x5de480){try{jsonpatch['apply'](_0x5de480,_0x1391f9,!![]);}catch(_0x4087a1){return BPromise[_0xb89c('0x23')](_0x4087a1);}return _0x5de480[_0xb89c('0x24')]();};}function saveUpdates(_0x2d00c2,_0x3f505f){return function(_0x398bf7){if(_0x398bf7){return _0x398bf7[_0xb89c('0x25')](_0x2d00c2)[_0xb89c('0x26')](function(_0x57ac3f){return _0x57ac3f;});}return null;};}function removeEntity(_0x440b42,_0x5dddd4){return function(_0x3a9802){if(_0x3a9802){return _0x3a9802[_0xb89c('0x27')]()[_0xb89c('0x26')](function(){_0x440b42[_0xb89c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25fb25,_0x26aa61){return function(_0x24028a){if(!_0x24028a){_0x25fb25[_0xb89c('0x19')](0x194);}return _0x24028a;};}function handleError(_0x45b3d7,_0x17799c){_0x17799c=_0x17799c||0x1f4;return function(_0x35ac3c){logger[_0xb89c('0x28')](_0x35ac3c[_0xb89c('0x29')]);if(_0x35ac3c[_0xb89c('0x2a')]){delete _0x35ac3c[_0xb89c('0x2a')];}_0x45b3d7[_0xb89c('0x1a')](_0x17799c)[_0xb89c('0x2b')](_0x35ac3c);};}exports[_0xb89c('0x2c')]=function(_0x5de2ec,_0x2665ed){var _0x520b1a={},_0x15bebd={},_0x350f38={'count':0x0,'rows':[]};var _0x58d82d=_['map'](db[_0xb89c('0x2d')][_0xb89c('0x2e')],function(_0x239e8a){return{'name':_0x239e8a[_0xb89c('0x2f')],'type':_0x239e8a['type']['key']};});_0x15bebd[_0xb89c('0x30')]=_[_0xb89c('0x31')](_0x58d82d,_0xb89c('0x2a'));_0x15bebd[_0xb89c('0x32')]=_[_0xb89c('0x33')](_0x5de2ec['query']);_0x15bebd[_0xb89c('0x34')]=_[_0xb89c('0x35')](_0x15bebd[_0xb89c('0x30')],_0x15bebd[_0xb89c('0x32')]);_0x520b1a['attributes']=_[_0xb89c('0x35')](_0x15bebd[_0xb89c('0x30')],qs[_0xb89c('0x36')](_0x5de2ec[_0xb89c('0x32')][_0xb89c('0x36')]));_0x520b1a[_0xb89c('0x37')]=_0x520b1a[_0xb89c('0x37')]['length']?_0x520b1a[_0xb89c('0x37')]:_0x15bebd[_0xb89c('0x30')];if(!_0x5de2ec[_0xb89c('0x32')][_0xb89c('0x38')](_0xb89c('0x39'))){_0x520b1a[_0xb89c('0x1e')]=qs[_0xb89c('0x1e')](_0x5de2ec[_0xb89c('0x32')]['limit']);_0x520b1a[_0xb89c('0x1d')]=qs['offset'](_0x5de2ec[_0xb89c('0x32')][_0xb89c('0x1d')]);}_0x520b1a[_0xb89c('0x3a')]=qs[_0xb89c('0x3b')](_0x5de2ec[_0xb89c('0x32')][_0xb89c('0x3b')]);_0x520b1a[_0xb89c('0x3c')]=qs[_0xb89c('0x34')](_[_0xb89c('0x3d')](_0x5de2ec[_0xb89c('0x32')],_0x15bebd[_0xb89c('0x34')]),_0x58d82d);if(_0x5de2ec['query'][_0xb89c('0x3e')]){_0x520b1a[_0xb89c('0x3c')]=_[_0xb89c('0x3f')](_0x520b1a[_0xb89c('0x3c')],{'$or':_[_0xb89c('0x31')](_0x58d82d,function(_0x568549){if(_0x568549[_0xb89c('0x40')]!==_0xb89c('0x41')){var _0x5ecb48={};_0x5ecb48[_0x568549[_0xb89c('0x2a')]]={'$like':'%'+_0x5de2ec[_0xb89c('0x32')][_0xb89c('0x3e')]+'%'};return _0x5ecb48;}})});}_0x520b1a=_['merge']({},_0x520b1a,_0x5de2ec['options']);var _0x229e56={'where':_0x520b1a[_0xb89c('0x3c')]};return db[_0xb89c('0x2d')][_0xb89c('0x20')](_0x229e56)[_0xb89c('0x26')](function(_0xff6381){_0x350f38[_0xb89c('0x20')]=_0xff6381;if(_0x5de2ec[_0xb89c('0x32')]['includeAll']){_0x520b1a[_0xb89c('0x42')]=[{'all':!![]}];}return db['DeskAccount'][_0xb89c('0x43')](_0x520b1a);})[_0xb89c('0x26')](function(_0x49f223){_0x350f38[_0xb89c('0x44')]=_0x49f223;return _0x350f38;})[_0xb89c('0x26')](respondWithFilteredResult(_0x2665ed,_0x520b1a))[_0xb89c('0x45')](handleError(_0x2665ed,null));};exports[_0xb89c('0x46')]=function(_0x15ab06,_0x50b593){var _0x3823ab={'raw':![],'where':{'id':_0x15ab06['params']['id']}},_0x23e0d1={};_0x23e0d1[_0xb89c('0x30')]=_[_0xb89c('0x33')](db[_0xb89c('0x2d')]['rawAttributes']);_0x23e0d1['query']=_['keys'](_0x15ab06[_0xb89c('0x32')]);_0x23e0d1['filters']=_[_0xb89c('0x35')](_0x23e0d1['model'],_0x23e0d1['query']);_0x3823ab[_0xb89c('0x37')]=_[_0xb89c('0x35')](_0x23e0d1['model'],qs[_0xb89c('0x36')](_0x15ab06[_0xb89c('0x32')][_0xb89c('0x36')]));_0x3823ab[_0xb89c('0x37')]=_0x3823ab['attributes'][_0xb89c('0x47')]?_0x3823ab[_0xb89c('0x37')]:_0x23e0d1[_0xb89c('0x30')];if(_0x15ab06[_0xb89c('0x32')][_0xb89c('0x48')]){_0x3823ab['include']=[{'all':!![]}];}_0x3823ab=_['merge']({},_0x3823ab,_0x15ab06[_0xb89c('0x49')]);return db[_0xb89c('0x2d')][_0xb89c('0x4a')](_0x3823ab)[_0xb89c('0x26')](handleEntityNotFound(_0x50b593,null))[_0xb89c('0x26')](respondWithResult(_0x50b593,null))[_0xb89c('0x45')](handleError(_0x50b593,null));};exports['create']=function(_0xf24271,_0x2e16c4){return db[_0xb89c('0x2d')][_0xb89c('0x4b')](_0xf24271['body'],{})[_0xb89c('0x26')](respondWithResult(_0x2e16c4,0xc9))['catch'](handleError(_0x2e16c4,null));};exports[_0xb89c('0x25')]=function(_0x5762d8,_0xc9b15a){if(_0x5762d8[_0xb89c('0x4c')]['id']){delete _0x5762d8['body']['id'];}return db[_0xb89c('0x2d')][_0xb89c('0x4a')]({'where':{'id':_0x5762d8[_0xb89c('0x4d')]['id']}})[_0xb89c('0x26')](handleEntityNotFound(_0xc9b15a,null))[_0xb89c('0x26')](saveUpdates(_0x5762d8[_0xb89c('0x4c')],null))['then'](respondWithResult(_0xc9b15a,null))[_0xb89c('0x45')](handleError(_0xc9b15a,null));};exports['destroy']=function(_0x1ef5fc,_0x264a5e){return db['DeskAccount'][_0xb89c('0x4a')]({'where':{'id':_0x1ef5fc[_0xb89c('0x4d')]['id']}})[_0xb89c('0x26')](handleEntityNotFound(_0x264a5e,null))[_0xb89c('0x26')](removeEntity(_0x264a5e,null))[_0xb89c('0x45')](handleError(_0x264a5e,null));};exports['getConfigurations']=function(_0x3c9b89,_0x2e1397,_0x515c64){var _0x1c19ea={};var _0xaa97e8={};var _0x1d56c1;var _0x40ade4;return db[_0xb89c('0x2d')]['findOne']({'where':{'id':_0x3c9b89[_0xb89c('0x4d')]['id']}})[_0xb89c('0x26')](handleEntityNotFound(_0x2e1397,null))[_0xb89c('0x26')](function(_0x1de669){if(_0x1de669){_0x1d56c1=_0x1de669;_0xaa97e8[_0xb89c('0x30')]=_[_0xb89c('0x33')](db[_0xb89c('0x4e')][_0xb89c('0x2e')]);_0xaa97e8[_0xb89c('0x32')]=_['keys'](_0x3c9b89[_0xb89c('0x32')]);_0xaa97e8[_0xb89c('0x34')]=_[_0xb89c('0x35')](_0xaa97e8['model'],_0xaa97e8[_0xb89c('0x32')]);_0x1c19ea[_0xb89c('0x37')]=_['intersection'](_0xaa97e8[_0xb89c('0x30')],qs['fields'](_0x3c9b89[_0xb89c('0x32')][_0xb89c('0x36')]));_0x1c19ea['attributes']=_0x1c19ea[_0xb89c('0x37')][_0xb89c('0x47')]?_0x1c19ea['attributes']:_0xaa97e8[_0xb89c('0x30')];_0x1c19ea[_0xb89c('0x3a')]=qs[_0xb89c('0x3b')](_0x3c9b89[_0xb89c('0x32')]['sort']);_0x1c19ea['where']=qs['filters'](_[_0xb89c('0x3d')](_0x3c9b89[_0xb89c('0x32')],_0xaa97e8[_0xb89c('0x34')]));if(_0x3c9b89[_0xb89c('0x32')][_0xb89c('0x3e')]){_0x1c19ea[_0xb89c('0x3c')]=_[_0xb89c('0x3f')](_0x1c19ea[_0xb89c('0x3c')],{'$or':_[_0xb89c('0x31')](_0x1c19ea[_0xb89c('0x37')],function(_0x29a4a9){var _0x3bdf90={};_0x3bdf90[_0x29a4a9]={'$like':'%'+_0x3c9b89[_0xb89c('0x32')]['filter']+'%'};return _0x3bdf90;})});}_0x1c19ea=_[_0xb89c('0x3f')]({},_0x1c19ea,_0x3c9b89[_0xb89c('0x49')]);return _0x1d56c1['getConfigurations'](_0x1c19ea);}})[_0xb89c('0x26')](function(_0x14a752){if(_0x14a752){_0x40ade4=_0x14a752[_0xb89c('0x47')];if(!_0x3c9b89[_0xb89c('0x32')]['hasOwnProperty'](_0xb89c('0x39'))){_0x1c19ea[_0xb89c('0x1e')]=qs[_0xb89c('0x1e')](_0x3c9b89['query'][_0xb89c('0x1e')]);_0x1c19ea['offset']=qs[_0xb89c('0x1d')](_0x3c9b89['query']['offset']);}return _0x1d56c1[_0xb89c('0x4f')](_0x1c19ea);}})['then'](function(_0x12f097){if(_0x12f097){return _0x12f097?{'count':_0x40ade4,'rows':_0x12f097}:null;}})[_0xb89c('0x26')](respondWithResult(_0x2e1397,null))[_0xb89c('0x45')](handleError(_0x2e1397,null));};exports[_0xb89c('0x50')]=function(_0xfa6c2f,_0x59db22,_0x31ed97){if(_0xfa6c2f[_0xb89c('0x4c')]['id']){delete _0xfa6c2f[_0xb89c('0x4c')]['id'];}return db[_0xb89c('0x2d')][_0xb89c('0x51')]({'where':{'id':_0xfa6c2f[_0xb89c('0x4d')]['id']}})[_0xb89c('0x26')](handleEntityNotFound(_0x59db22,null))[_0xb89c('0x26')](function(_0x59a5d6){if(_0x59a5d6){_0xfa6c2f[_0xb89c('0x4c')]['AccountId']=_0x59a5d6['id'];_0xfa6c2f['body'][_0xb89c('0x52')]=integrations[_0xb89c('0x53')](_0xfa6c2f[_0xb89c('0x4c')]['channel'],_0xfa6c2f[_0xb89c('0x4c')][_0xb89c('0x40')]);_0xfa6c2f[_0xb89c('0x4c')][_0xb89c('0x54')]=integrations[_0xb89c('0x55')](_0xfa6c2f[_0xb89c('0x4c')][_0xb89c('0x56')],_0xfa6c2f[_0xb89c('0x4c')]['type']);return db[_0xb89c('0x4e')]['create'](_0xfa6c2f[_0xb89c('0x4c')],{'include':[{'model':db[_0xb89c('0x57')],'as':'Subjects'},{'model':db['DeskField'],'as':_0xb89c('0x54')}]});}return null;})[_0xb89c('0x26')](respondWithResult(_0x59db22,null))['catch'](handleError(_0x59db22,null));};exports[_0xb89c('0x58')]=function(_0x5d5816,_0x1fe425,_0x114ec6){var _0x8f20d0=[{'name':_0xb89c('0x59'),'label':_0xb89c('0x59'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x3bc8f3='';return db['DeskAccount'][_0xb89c('0x51')]({'where':{'id':_0x5d5816['params']['id']},'attributes':['id',_0xb89c('0x5a'),_0xb89c('0x5b'),_0xb89c('0x5c'),_0xb89c('0x5d'),_0xb89c('0x5e'),_0xb89c('0x5f'),_0xb89c('0x60'),_0xb89c('0x61')]})[_0xb89c('0x26')](handleEntityNotFound(_0x1fe425,null))[_0xb89c('0x26')](function(_0x1a2c06){if(_0x1a2c06){_0x3bc8f3=_0x1a2c06['remoteUri'];var _0x141f3e=_0x3bc8f3[_0xb89c('0x62')](-0x1);if(_0x141f3e==='/'){_0x3bc8f3=_0x3bc8f3[_0xb89c('0x63')](0x0,_0x3bc8f3[_0xb89c('0x64')](_0x141f3e));}var _0x52d1a8={'method':_0xb89c('0x65'),'uri':util[_0xb89c('0x66')]('%s/custom_fields',_0x3bc8f3),'headers':{'Content-Type':_0xb89c('0x67'),'Accept':_0xb89c('0x67')},'json':!![]};if(_0x1a2c06[_0xb89c('0x5b')]==='basic'){_0x52d1a8[_0xb89c('0x68')][_0xb89c('0x69')]=util['format']('Basic\x20%s',new Buffer(util[_0xb89c('0x66')](_0xb89c('0x6a'),_0x1a2c06[_0xb89c('0x5c')],_0x1a2c06['password']))['toString'](_0xb89c('0x6b')));}return rp(_0x52d1a8)[_0xb89c('0x26')](function(_0x5b98b0){return _0x8f20d0[_0xb89c('0x6c')](_[_0xb89c('0x31')](_0x5b98b0[_0xb89c('0x6d')][_0xb89c('0x6e')],function(_0x29aa99){return{'id':_0x29aa99[_0xb89c('0x2a')],'name':_0x29aa99[_0xb89c('0x2a')],'type':_0x29aa99[_0xb89c('0x40')],'active':_0x29aa99[_0xb89c('0x6f')],'label':_0x29aa99[_0xb89c('0x70')],'custom':!![]};}));});}})[_0xb89c('0x26')](function(_0x22ada1){return{'count':_0x22ada1[_0xb89c('0x47')],'rows':_0x22ada1};})[_0xb89c('0x26')](respondWithResult(_0x1fe425,null))[_0xb89c('0x45')](function(_0x4e6ab7){var _0x280e7b=_0x5d5816[_0xb89c('0x32')][_0xb89c('0x71')]?0x1f4:_0x4e6ab7[_0xb89c('0x72')]||0x1f4;logger[_0xb89c('0x28')](_0xb89c('0x73'),_0xb89c('0x58'),_0x280e7b,JSON[_0xb89c('0x74')](_0x4e6ab7));delete _0x4e6ab7['name'];if(_0x280e7b===0x191){_0x280e7b=0x190;}_0x1fe425[_0xb89c('0x1a')](_0x280e7b)[_0xb89c('0x2b')](_0x5d5816['query'][_0xb89c('0x71')]?{'message':_0xb89c('0x75'),'statusCode':_0x4e6ab7[_0xb89c('0x72')]}:_0x4e6ab7);});}; \ No newline at end of file +var _0x64c2=['include','findAll','rows','catch','params','includeAll','find','create','body','getConfigurations','findOne','DeskConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','DeskField','Descriptions','getFields','priority','remoteUri','authType','username','password','consumerSecret','token','slice','GET','format','%s/custom_fields','application/json','headers','Authorization','Basic\x20%s','%s:%s','base64','concat','_embedded','entries','label','test','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','statusCode','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','name','index','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options'];(function(_0x2246bc,_0x2e99d5){var _0xc35599=function(_0x3c5e12){while(--_0x3c5e12){_0x2246bc['push'](_0x2246bc['shift']());}};_0xc35599(++_0x2e99d5);}(_0x64c2,0x1f0));var _0x264c=function(_0x1ba0fe,_0x3584bb){_0x1ba0fe=_0x1ba0fe-0x0;var _0x3ec126=_0x64c2[_0x1ba0fe];return _0x3ec126;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x264c('0x0'));var jsonpatch=require(_0x264c('0x1'));var rp=require(_0x264c('0x2'));var moment=require(_0x264c('0x3'));var BPromise=require(_0x264c('0x4'));var Mustache=require(_0x264c('0x5'));var util=require(_0x264c('0x6'));var path=require(_0x264c('0x7'));var sox=require('sox');var csv=require(_0x264c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x264c('0x9'));var _=require(_0x264c('0xa'));var squel=require(_0x264c('0xb'));var crypto=require('crypto');var jsforce=require(_0x264c('0xc'));var deskjs=require(_0x264c('0xd'));var toCsv=require(_0x264c('0x8'));var querystring=require(_0x264c('0xe'));var Papa=require(_0x264c('0xf'));var Redis=require(_0x264c('0x10'));var authService=require(_0x264c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x264c('0x12'));var hardwareService=require(_0x264c('0x13'));var logger=require(_0x264c('0x14'))(_0x264c('0x15'));var utils=require(_0x264c('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x264c('0x17'));function respondWithStatusCode(_0x4de59e,_0x215b74){_0x215b74=_0x215b74||0xcc;return function(_0x175f2e){if(_0x175f2e){return _0x4de59e[_0x264c('0x18')](_0x215b74);}return _0x4de59e[_0x264c('0x19')](_0x215b74)[_0x264c('0x1a')]();};}function respondWithResult(_0x3cd8b8,_0x3677c6){_0x3677c6=_0x3677c6||0xc8;return function(_0x3ac7ef){if(_0x3ac7ef){return _0x3cd8b8[_0x264c('0x19')](_0x3677c6)[_0x264c('0x1b')](_0x3ac7ef);}};}function respondWithFilteredResult(_0x567e96,_0x5b56e3){return function(_0x552e47){if(_0x552e47){var _0x2d96be=typeof _0x5b56e3[_0x264c('0x1c')]===_0x264c('0x1d')&&typeof _0x5b56e3[_0x264c('0x1e')]===_0x264c('0x1d');var _0x4b759d=_0x552e47[_0x264c('0x1f')];var _0x2ba4c4=_0x2d96be?0x0:_0x5b56e3['offset'];var _0x3a6536=_0x2d96be?_0x552e47['count']:_0x5b56e3[_0x264c('0x1c')]+_0x5b56e3[_0x264c('0x1e')];var _0xa595fd;if(_0x3a6536>=_0x4b759d){_0x3a6536=_0x4b759d;_0xa595fd=0xc8;}else{_0xa595fd=0xce;}_0x567e96['status'](_0xa595fd);return _0x567e96[_0x264c('0x20')]('Content-Range',_0x2ba4c4+'-'+_0x3a6536+'/'+_0x4b759d)[_0x264c('0x1b')](_0x552e47);}return null;};}function patchUpdates(_0x2247f2){return function(_0x2b7b6f){try{jsonpatch[_0x264c('0x21')](_0x2b7b6f,_0x2247f2,!![]);}catch(_0x3c5689){return BPromise['reject'](_0x3c5689);}return _0x2b7b6f[_0x264c('0x22')]();};}function saveUpdates(_0x5e5aca,_0x31db19){return function(_0x4da48b){if(_0x4da48b){return _0x4da48b[_0x264c('0x23')](_0x5e5aca)[_0x264c('0x24')](function(_0xe1ab54){return _0xe1ab54;});}return null;};}function removeEntity(_0x591ab1,_0x1f4124){return function(_0x18ca16){if(_0x18ca16){return _0x18ca16[_0x264c('0x25')]()['then'](function(){_0x591ab1[_0x264c('0x19')](0xcc)[_0x264c('0x1a')]();});}};}function handleEntityNotFound(_0x4c24ba,_0x17ae29){return function(_0x18219e){if(!_0x18219e){_0x4c24ba[_0x264c('0x18')](0x194);}return _0x18219e;};}function handleError(_0x216bad,_0x8872ef){_0x8872ef=_0x8872ef||0x1f4;return function(_0x150bfa){logger[_0x264c('0x26')](_0x150bfa['stack']);if(_0x150bfa[_0x264c('0x27')]){delete _0x150bfa[_0x264c('0x27')];}_0x216bad[_0x264c('0x19')](_0x8872ef)['send'](_0x150bfa);};}exports[_0x264c('0x28')]=function(_0xea5f14,_0x49fb82){var _0x450f28={},_0x965dcb={},_0x23f649={'count':0x0,'rows':[]};var _0x341579=_[_0x264c('0x29')](db[_0x264c('0x2a')][_0x264c('0x2b')],function(_0x5232dc){return{'name':_0x5232dc[_0x264c('0x2c')],'type':_0x5232dc[_0x264c('0x2d')][_0x264c('0x2e')]};});_0x965dcb[_0x264c('0x2f')]=_[_0x264c('0x29')](_0x341579,_0x264c('0x27'));_0x965dcb[_0x264c('0x30')]=_[_0x264c('0x31')](_0xea5f14[_0x264c('0x30')]);_0x965dcb[_0x264c('0x32')]=_[_0x264c('0x33')](_0x965dcb[_0x264c('0x2f')],_0x965dcb[_0x264c('0x30')]);_0x450f28[_0x264c('0x34')]=_[_0x264c('0x33')](_0x965dcb['model'],qs[_0x264c('0x35')](_0xea5f14[_0x264c('0x30')][_0x264c('0x35')]));_0x450f28[_0x264c('0x34')]=_0x450f28[_0x264c('0x34')][_0x264c('0x36')]?_0x450f28['attributes']:_0x965dcb[_0x264c('0x2f')];if(!_0xea5f14[_0x264c('0x30')][_0x264c('0x37')](_0x264c('0x38'))){_0x450f28[_0x264c('0x1e')]=qs[_0x264c('0x1e')](_0xea5f14[_0x264c('0x30')]['limit']);_0x450f28[_0x264c('0x1c')]=qs[_0x264c('0x1c')](_0xea5f14[_0x264c('0x30')][_0x264c('0x1c')]);}_0x450f28[_0x264c('0x39')]=qs[_0x264c('0x3a')](_0xea5f14[_0x264c('0x30')]['sort']);_0x450f28['where']=qs[_0x264c('0x32')](_['pick'](_0xea5f14[_0x264c('0x30')],_0x965dcb[_0x264c('0x32')]),_0x341579);if(_0xea5f14['query']['filter']){_0x450f28[_0x264c('0x3b')]=_[_0x264c('0x3c')](_0x450f28[_0x264c('0x3b')],{'$or':_[_0x264c('0x29')](_0x341579,function(_0x51fcc5){if(_0x51fcc5[_0x264c('0x2d')]!==_0x264c('0x3d')){var _0x32b488={};_0x32b488[_0x51fcc5[_0x264c('0x27')]]={'$like':'%'+_0xea5f14['query'][_0x264c('0x3e')]+'%'};return _0x32b488;}})});}_0x450f28=_[_0x264c('0x3c')]({},_0x450f28,_0xea5f14[_0x264c('0x3f')]);var _0x4afc4b={'where':_0x450f28[_0x264c('0x3b')]};return db[_0x264c('0x2a')][_0x264c('0x1f')](_0x4afc4b)[_0x264c('0x24')](function(_0x4ce255){_0x23f649['count']=_0x4ce255;if(_0xea5f14[_0x264c('0x30')]['includeAll']){_0x450f28[_0x264c('0x40')]=[{'all':!![]}];}return db['DeskAccount'][_0x264c('0x41')](_0x450f28);})[_0x264c('0x24')](function(_0x367777){_0x23f649[_0x264c('0x42')]=_0x367777;return _0x23f649;})[_0x264c('0x24')](respondWithFilteredResult(_0x49fb82,_0x450f28))[_0x264c('0x43')](handleError(_0x49fb82,null));};exports['show']=function(_0x56c916,_0x2587db){var _0x3d85ec={'raw':![],'where':{'id':_0x56c916[_0x264c('0x44')]['id']}},_0x157071={};_0x157071['model']=_[_0x264c('0x31')](db[_0x264c('0x2a')][_0x264c('0x2b')]);_0x157071[_0x264c('0x30')]=_[_0x264c('0x31')](_0x56c916[_0x264c('0x30')]);_0x157071[_0x264c('0x32')]=_['intersection'](_0x157071[_0x264c('0x2f')],_0x157071[_0x264c('0x30')]);_0x3d85ec[_0x264c('0x34')]=_[_0x264c('0x33')](_0x157071[_0x264c('0x2f')],qs[_0x264c('0x35')](_0x56c916[_0x264c('0x30')][_0x264c('0x35')]));_0x3d85ec[_0x264c('0x34')]=_0x3d85ec[_0x264c('0x34')][_0x264c('0x36')]?_0x3d85ec[_0x264c('0x34')]:_0x157071[_0x264c('0x2f')];if(_0x56c916[_0x264c('0x30')][_0x264c('0x45')]){_0x3d85ec['include']=[{'all':!![]}];}_0x3d85ec=_['merge']({},_0x3d85ec,_0x56c916[_0x264c('0x3f')]);return db[_0x264c('0x2a')][_0x264c('0x46')](_0x3d85ec)['then'](handleEntityNotFound(_0x2587db,null))[_0x264c('0x24')](respondWithResult(_0x2587db,null))[_0x264c('0x43')](handleError(_0x2587db,null));};exports[_0x264c('0x47')]=function(_0x25c73b,_0x2a4ab7){return db[_0x264c('0x2a')][_0x264c('0x47')](_0x25c73b[_0x264c('0x48')],{})[_0x264c('0x24')](respondWithResult(_0x2a4ab7,0xc9))['catch'](handleError(_0x2a4ab7,null));};exports[_0x264c('0x23')]=function(_0xa56d05,_0x1c2707){if(_0xa56d05[_0x264c('0x48')]['id']){delete _0xa56d05[_0x264c('0x48')]['id'];}return db[_0x264c('0x2a')][_0x264c('0x46')]({'where':{'id':_0xa56d05[_0x264c('0x44')]['id']}})[_0x264c('0x24')](handleEntityNotFound(_0x1c2707,null))[_0x264c('0x24')](saveUpdates(_0xa56d05[_0x264c('0x48')],null))[_0x264c('0x24')](respondWithResult(_0x1c2707,null))[_0x264c('0x43')](handleError(_0x1c2707,null));};exports[_0x264c('0x25')]=function(_0x5e5e11,_0x4b0855){return db[_0x264c('0x2a')][_0x264c('0x46')]({'where':{'id':_0x5e5e11[_0x264c('0x44')]['id']}})['then'](handleEntityNotFound(_0x4b0855,null))[_0x264c('0x24')](removeEntity(_0x4b0855,null))['catch'](handleError(_0x4b0855,null));};exports[_0x264c('0x49')]=function(_0x45a3dd,_0xc28ebb,_0x24f10a){var _0x194004={};var _0x5154f9={};var _0x16c138;var _0x321edf;return db[_0x264c('0x2a')][_0x264c('0x4a')]({'where':{'id':_0x45a3dd[_0x264c('0x44')]['id']}})['then'](handleEntityNotFound(_0xc28ebb,null))[_0x264c('0x24')](function(_0x2b90d6){if(_0x2b90d6){_0x16c138=_0x2b90d6;_0x5154f9[_0x264c('0x2f')]=_['keys'](db[_0x264c('0x4b')][_0x264c('0x2b')]);_0x5154f9[_0x264c('0x30')]=_['keys'](_0x45a3dd[_0x264c('0x30')]);_0x5154f9[_0x264c('0x32')]=_[_0x264c('0x33')](_0x5154f9[_0x264c('0x2f')],_0x5154f9['query']);_0x194004[_0x264c('0x34')]=_['intersection'](_0x5154f9[_0x264c('0x2f')],qs[_0x264c('0x35')](_0x45a3dd['query']['fields']));_0x194004['attributes']=_0x194004[_0x264c('0x34')][_0x264c('0x36')]?_0x194004[_0x264c('0x34')]:_0x5154f9[_0x264c('0x2f')];_0x194004[_0x264c('0x39')]=qs[_0x264c('0x3a')](_0x45a3dd[_0x264c('0x30')][_0x264c('0x3a')]);_0x194004['where']=qs[_0x264c('0x32')](_[_0x264c('0x4c')](_0x45a3dd['query'],_0x5154f9[_0x264c('0x32')]));if(_0x45a3dd[_0x264c('0x30')][_0x264c('0x3e')]){_0x194004[_0x264c('0x3b')]=_[_0x264c('0x3c')](_0x194004[_0x264c('0x3b')],{'$or':_[_0x264c('0x29')](_0x194004[_0x264c('0x34')],function(_0x340502){var _0x104398={};_0x104398[_0x340502]={'$like':'%'+_0x45a3dd[_0x264c('0x30')][_0x264c('0x3e')]+'%'};return _0x104398;})});}_0x194004=_[_0x264c('0x3c')]({},_0x194004,_0x45a3dd[_0x264c('0x3f')]);return _0x16c138[_0x264c('0x49')](_0x194004);}})['then'](function(_0x1fdf8d){if(_0x1fdf8d){_0x321edf=_0x1fdf8d[_0x264c('0x36')];if(!_0x45a3dd[_0x264c('0x30')][_0x264c('0x37')](_0x264c('0x38'))){_0x194004['limit']=qs[_0x264c('0x1e')](_0x45a3dd[_0x264c('0x30')][_0x264c('0x1e')]);_0x194004[_0x264c('0x1c')]=qs[_0x264c('0x1c')](_0x45a3dd[_0x264c('0x30')]['offset']);}return _0x16c138[_0x264c('0x49')](_0x194004);}})[_0x264c('0x24')](function(_0x18d73e){if(_0x18d73e){return _0x18d73e?{'count':_0x321edf,'rows':_0x18d73e}:null;}})[_0x264c('0x24')](respondWithResult(_0xc28ebb,null))[_0x264c('0x43')](handleError(_0xc28ebb,null));};exports[_0x264c('0x4d')]=function(_0x3d19ed,_0x5447df,_0xbf9ccd){if(_0x3d19ed[_0x264c('0x48')]['id']){delete _0x3d19ed['body']['id'];}return db[_0x264c('0x2a')][_0x264c('0x4a')]({'where':{'id':_0x3d19ed[_0x264c('0x44')]['id']}})[_0x264c('0x24')](handleEntityNotFound(_0x5447df,null))[_0x264c('0x24')](function(_0x3770d1){if(_0x3770d1){_0x3d19ed[_0x264c('0x48')][_0x264c('0x4e')]=_0x3770d1['id'];_0x3d19ed[_0x264c('0x48')][_0x264c('0x4f')]=integrations[_0x264c('0x50')](_0x3d19ed[_0x264c('0x48')][_0x264c('0x51')],_0x3d19ed['body'][_0x264c('0x2d')]);_0x3d19ed[_0x264c('0x48')]['Descriptions']=integrations['getDescriptions'](_0x3d19ed[_0x264c('0x48')]['channel'],_0x3d19ed[_0x264c('0x48')][_0x264c('0x2d')]);return db[_0x264c('0x4b')][_0x264c('0x47')](_0x3d19ed[_0x264c('0x48')],{'include':[{'model':db[_0x264c('0x52')],'as':'Subjects'},{'model':db['DeskField'],'as':_0x264c('0x53')}]});}return null;})['then'](respondWithResult(_0x5447df,null))[_0x264c('0x43')](handleError(_0x5447df,null));};exports[_0x264c('0x54')]=function(_0x329d68,_0x121c28,_0xfb04aa){var _0x4e8af1=[{'name':_0x264c('0x55'),'label':_0x264c('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 _0x4f16d1='';return db['DeskAccount'][_0x264c('0x4a')]({'where':{'id':_0x329d68[_0x264c('0x44')]['id']},'attributes':['id',_0x264c('0x56'),_0x264c('0x57'),_0x264c('0x58'),_0x264c('0x59'),'consumerKey',_0x264c('0x5a'),_0x264c('0x5b'),'tokenSecret']})[_0x264c('0x24')](handleEntityNotFound(_0x121c28,null))[_0x264c('0x24')](function(_0x3da9b0){if(_0x3da9b0){_0x4f16d1=_0x3da9b0[_0x264c('0x56')];var _0x2db58a=_0x4f16d1[_0x264c('0x5c')](-0x1);if(_0x2db58a==='/'){_0x4f16d1=_0x4f16d1['substring'](0x0,_0x4f16d1['lastIndexOf'](_0x2db58a));}var _0x394086={'method':_0x264c('0x5d'),'uri':util[_0x264c('0x5e')](_0x264c('0x5f'),_0x4f16d1),'headers':{'Content-Type':_0x264c('0x60'),'Accept':_0x264c('0x60')},'json':!![]};if(_0x3da9b0['authType']==='basic'){_0x394086[_0x264c('0x61')][_0x264c('0x62')]=util[_0x264c('0x5e')](_0x264c('0x63'),new Buffer(util[_0x264c('0x5e')](_0x264c('0x64'),_0x3da9b0['username'],_0x3da9b0[_0x264c('0x59')]))['toString'](_0x264c('0x65')));}return rp(_0x394086)[_0x264c('0x24')](function(_0x3c9e2d){return _0x4e8af1[_0x264c('0x66')](_[_0x264c('0x29')](_0x3c9e2d[_0x264c('0x67')][_0x264c('0x68')],function(_0x1a48ba){return{'id':_0x1a48ba[_0x264c('0x27')],'name':_0x1a48ba[_0x264c('0x27')],'type':_0x1a48ba['type'],'active':_0x1a48ba['active'],'label':_0x1a48ba[_0x264c('0x69')],'custom':!![]};}));});}})[_0x264c('0x24')](function(_0x27b61e){return{'count':_0x27b61e['length'],'rows':_0x27b61e};})[_0x264c('0x24')](respondWithResult(_0x121c28,null))[_0x264c('0x43')](function(_0x13bd83){var _0x496bd0=_0x329d68[_0x264c('0x30')][_0x264c('0x6a')]?0x1f4:_0x13bd83['statusCode']||0x1f4;logger[_0x264c('0x26')](_0x264c('0x6b'),'getFields',_0x496bd0,JSON[_0x264c('0x6c')](_0x13bd83));delete _0x13bd83[_0x264c('0x27')];if(_0x496bd0===0x191){_0x496bd0=0x190;}_0x121c28[_0x264c('0x19')](_0x496bd0)[_0x264c('0x6d')](_0x329d68[_0x264c('0x30')][_0x264c('0x6a')]?{'message':_0x264c('0x6e'),'statusCode':_0x13bd83[_0x264c('0x6f')]}:_0x13bd83);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 3424ef5..e698cef 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 _0x3ffc=['moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3ffc,0xc0));var _0xc3ff=function(_0x55677b,_0x3e5655){_0x55677b=_0x55677b-0x0;var _0x104b88=_0x3ffc[_0x55677b];return _0x104b88;};'use strict';var _=require(_0xc3ff('0x0'));var util=require(_0xc3ff('0x1'));var logger=require(_0xc3ff('0x2'))(_0xc3ff('0x3'));var moment=require(_0xc3ff('0x4'));var BPromise=require(_0xc3ff('0x5'));var rp=require(_0xc3ff('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc3ff('0x7'));var config=require(_0xc3ff('0x8'));var attributes=require(_0xc3ff('0x9'));var integrations=require(_0xc3ff('0xa'));module['exports']=function(_0x328cf6,_0x2e50dd){return _0x328cf6[_0xc3ff('0xb')](_0xc3ff('0xc'),attributes,{'tableName':_0xc3ff('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc014=['exports','define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration'];(function(_0x4d1fca,_0xaffded){var _0x1c7cbd=function(_0x127726){while(--_0x127726){_0x4d1fca['push'](_0x4d1fca['shift']());}};_0x1c7cbd(++_0xaffded);}(_0xc014,0x16c));var _0x4c01=function(_0x48e1ec,_0x35f468){_0x48e1ec=_0x48e1ec-0x0;var _0x3b33eb=_0xc014[_0x48e1ec];return _0x3b33eb;};'use strict';var _=require(_0x4c01('0x0'));var util=require(_0x4c01('0x1'));var logger=require(_0x4c01('0x2'))(_0x4c01('0x3'));var moment=require(_0x4c01('0x4'));var BPromise=require(_0x4c01('0x5'));var rp=require(_0x4c01('0x6'));var fs=require('fs');var path=require(_0x4c01('0x7'));var rimraf=require('rimraf');var config=require(_0x4c01('0x8'));var attributes=require(_0x4c01('0x9'));var integrations=require(_0x4c01('0xa'));module[_0x4c01('0xb')]=function(_0x257de7,_0xf654d4){return _0x257de7[_0x4c01('0xc')](_0x4c01('0xd'),attributes,{'tableName':_0x4c01('0xe'),'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 46bc1ff..c371a9d 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 _0x9993=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','error','code','message','result','DeskAccount','findAll','options','where','attributes','limit','include','map','model','debug','GetDeskAccount','stringify','ShowDeskAccount','find','raw','catch','util','moment'];(function(_0xd758b6,_0x225982){var _0x1dd8f3=function(_0x5b2999){while(--_0x5b2999){_0xd758b6['push'](_0xd758b6['shift']());}};_0x1dd8f3(++_0x225982);}(_0x9993,0x170));var _0x3999=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x9993[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require('lodash');var util=require(_0x3999('0x0'));var moment=require(_0x3999('0x1'));var BPromise=require(_0x3999('0x2'));var rs=require(_0x3999('0x3'));var fs=require('fs');var Redis=require(_0x3999('0x4'));var db=require(_0x3999('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3999('0x6'))(_0x3999('0x7'));var config=require(_0x3999('0x8'));var jayson=require(_0x3999('0x9'));var client=jayson[_0x3999('0xa')][_0x3999('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf5abf7,_0x581578,_0x399dc1){return new BPromise(function(_0x207a26,_0x48051c){return client[_0x3999('0xc')](_0xf5abf7,_0x399dc1)[_0x3999('0xd')](function(_0x40bc4e){logger[_0x3999('0xe')](_0x3999('0xf'),_0x581578,_0x3999('0x10'));logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x581578,'request\x20sent',JSON['stringify'](_0x40bc4e));if(_0x40bc4e[_0x3999('0x11')]){if(_0x40bc4e[_0x3999('0x11')][_0x3999('0x12')]===0x1f4){logger['error'](_0x3999('0xf'),_0x581578,_0x40bc4e[_0x3999('0x11')]['message']);return _0x48051c(_0x40bc4e[_0x3999('0x11')]['message']);}logger['error'](_0x3999('0xf'),_0x581578,_0x40bc4e[_0x3999('0x11')][_0x3999('0x13')]);return _0x207a26(_0x40bc4e['error'][_0x3999('0x13')]);}else{logger[_0x3999('0xe')](_0x3999('0xf'),_0x581578,_0x3999('0x10'));_0x207a26(_0x40bc4e[_0x3999('0x14')][_0x3999('0x13')]);}})['catch'](function(_0x52027e){logger[_0x3999('0x11')](_0x3999('0xf'),_0x581578,_0x52027e);_0x48051c(_0x52027e);});});}exports['GetDeskAccount']=function(_0x3fb567){var _0x175cdb=this;return new Promise(function(_0x3954b0,_0x1d4cf8){return db[_0x3999('0x15')][_0x3999('0x16')]({'raw':_0x3fb567[_0x3999('0x17')]?_0x3fb567[_0x3999('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3fb567[_0x3999('0x17')]?_0x3fb567[_0x3999('0x17')][_0x3999('0x18')]||null:null,'attributes':_0x3fb567[_0x3999('0x17')]?_0x3fb567[_0x3999('0x17')][_0x3999('0x19')]||null:null,'limit':_0x3fb567[_0x3999('0x17')]?_0x3fb567[_0x3999('0x17')][_0x3999('0x1a')]||null:null,'include':_0x3fb567[_0x3999('0x17')]?_0x3fb567[_0x3999('0x17')][_0x3999('0x1b')]?_[_0x3999('0x1c')](_0x3fb567[_0x3999('0x17')][_0x3999('0x1b')],function(_0x54fee6){return{'model':db[_0x54fee6[_0x3999('0x1d')]],'as':_0x54fee6['as'],'attributes':_0x54fee6[_0x3999('0x19')],'include':_0x54fee6['include']?_['map'](_0x54fee6[_0x3999('0x1b')],function(_0x13497a){return{'model':db[_0x13497a[_0x3999('0x1d')]],'as':_0x13497a['as'],'attributes':_0x13497a[_0x3999('0x19')],'include':_0x13497a[_0x3999('0x1b')]?_['map'](_0x13497a[_0x3999('0x1b')],function(_0x2337f6){return{'model':db[_0x2337f6[_0x3999('0x1d')]],'as':_0x2337f6['as'],'attributes':_0x2337f6[_0x3999('0x19')]};}):[]};}):[]};}):[]:[]})[_0x3999('0xd')](function(_0xee720f){logger['info']('GetDeskAccount',_0x3fb567);logger[_0x3999('0x1e')](_0x3999('0x1f'),_0x3fb567,JSON[_0x3999('0x20')](_0xee720f));_0x3954b0(_0xee720f);})['catch'](function(_0x4d8a80){logger[_0x3999('0x11')]('GetDeskAccount',_0x4d8a80[_0x3999('0x13')],_0x3fb567);_0x1d4cf8(_0x175cdb['error'](0x1f4,_0x4d8a80['message']));});});};exports[_0x3999('0x21')]=function(_0x40fe09){var _0x1ead5b=this;return new Promise(function(_0x553ca9,_0x1c36c7){return db[_0x3999('0x15')][_0x3999('0x22')]({'raw':_0x40fe09[_0x3999('0x17')]?_0x40fe09[_0x3999('0x17')][_0x3999('0x23')]===undefined?!![]:![]:!![],'where':_0x40fe09[_0x3999('0x17')]?_0x40fe09[_0x3999('0x17')]['where']||null:null,'attributes':_0x40fe09['options']?_0x40fe09['options']['attributes']||null:null,'include':_0x40fe09['options']?_0x40fe09[_0x3999('0x17')][_0x3999('0x1b')]?_[_0x3999('0x1c')](_0x40fe09[_0x3999('0x17')]['include'],function(_0x13e6d7){return{'model':db[_0x13e6d7[_0x3999('0x1d')]],'as':_0x13e6d7['as'],'attributes':_0x13e6d7[_0x3999('0x19')],'include':_0x13e6d7[_0x3999('0x1b')]?_[_0x3999('0x1c')](_0x13e6d7[_0x3999('0x1b')],function(_0x2afdf1){return{'model':db[_0x2afdf1[_0x3999('0x1d')]],'as':_0x2afdf1['as'],'attributes':_0x2afdf1[_0x3999('0x19')],'include':_0x2afdf1[_0x3999('0x1b')]?_[_0x3999('0x1c')](_0x2afdf1['include'],function(_0x39e40b){return{'model':db[_0x39e40b[_0x3999('0x1d')]],'as':_0x39e40b['as'],'attributes':_0x39e40b['attributes']};}):[]};}):[]};}):[]:[]})[_0x3999('0xd')](function(_0x4d5688){logger[_0x3999('0xe')]('ShowDeskAccount',_0x40fe09);logger[_0x3999('0x1e')](_0x3999('0x21'),_0x40fe09,JSON[_0x3999('0x20')](_0x4d5688));_0x553ca9(_0x4d5688);})[_0x3999('0x24')](function(_0x3dd1ea){logger['error'](_0x3999('0x21'),_0x3dd1ea['message'],_0x40fe09);_0x1c36c7(_0x1ead5b[_0x3999('0x11')](0x1f4,_0x3dd1ea[_0x3999('0x13')]));});});}; \ No newline at end of file +var _0x9b64=['then','catch','find','where','ShowDeskAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetDeskAccount','findAll','options','raw','attributes','limit','include','map','model'];(function(_0x18f21d,_0xd9b5ce){var _0x250d02=function(_0x3c3e4c){while(--_0x3c3e4c){_0x18f21d['push'](_0x18f21d['shift']());}};_0x250d02(++_0xd9b5ce);}(_0x9b64,0x101));var _0x49b6=function(_0x1eaa74,_0xcbbafc){_0x1eaa74=_0x1eaa74-0x0;var _0x2fd0e0=_0x9b64[_0x1eaa74];return _0x2fd0e0;};'use strict';var _=require(_0x49b6('0x0'));var util=require(_0x49b6('0x1'));var moment=require(_0x49b6('0x2'));var BPromise=require('bluebird');var rs=require(_0x49b6('0x3'));var fs=require('fs');var Redis=require(_0x49b6('0x4'));var db=require(_0x49b6('0x5'))['db'];var utils=require(_0x49b6('0x6'));var logger=require(_0x49b6('0x7'))(_0x49b6('0x8'));var config=require(_0x49b6('0x9'));var jayson=require(_0x49b6('0xa'));var client=jayson[_0x49b6('0xb')][_0x49b6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x14a76e,_0x47fa58,_0x5df1d1){return new BPromise(function(_0x409292,_0x564978){return client['request'](_0x14a76e,_0x5df1d1)['then'](function(_0x2cfbbb){logger[_0x49b6('0xd')](_0x49b6('0xe'),_0x47fa58,_0x49b6('0xf'));logger[_0x49b6('0x10')](_0x49b6('0x11'),_0x47fa58,_0x49b6('0xf'),JSON[_0x49b6('0x12')](_0x2cfbbb));if(_0x2cfbbb[_0x49b6('0x13')]){if(_0x2cfbbb[_0x49b6('0x13')]['code']===0x1f4){logger['error'](_0x49b6('0xe'),_0x47fa58,_0x2cfbbb['error'][_0x49b6('0x14')]);return _0x564978(_0x2cfbbb[_0x49b6('0x13')][_0x49b6('0x14')]);}logger[_0x49b6('0x13')](_0x49b6('0xe'),_0x47fa58,_0x2cfbbb[_0x49b6('0x13')][_0x49b6('0x14')]);return _0x409292(_0x2cfbbb[_0x49b6('0x13')][_0x49b6('0x14')]);}else{logger['info'](_0x49b6('0xe'),_0x47fa58,_0x49b6('0xf'));_0x409292(_0x2cfbbb[_0x49b6('0x15')][_0x49b6('0x14')]);}})['catch'](function(_0x3ff424){logger[_0x49b6('0x13')](_0x49b6('0xe'),_0x47fa58,_0x3ff424);_0x564978(_0x3ff424);});});}exports[_0x49b6('0x16')]=function(_0x2e7ae9){var _0x19c889=this;return new Promise(function(_0x9d6e7,_0x3c755f){return db['DeskAccount'][_0x49b6('0x17')]({'raw':_0x2e7ae9['options']?_0x2e7ae9[_0x49b6('0x18')][_0x49b6('0x19')]===undefined?!![]:![]:!![],'where':_0x2e7ae9[_0x49b6('0x18')]?_0x2e7ae9['options']['where']||null:null,'attributes':_0x2e7ae9[_0x49b6('0x18')]?_0x2e7ae9['options'][_0x49b6('0x1a')]||null:null,'limit':_0x2e7ae9['options']?_0x2e7ae9['options'][_0x49b6('0x1b')]||null:null,'include':_0x2e7ae9[_0x49b6('0x18')]?_0x2e7ae9[_0x49b6('0x18')][_0x49b6('0x1c')]?_[_0x49b6('0x1d')](_0x2e7ae9[_0x49b6('0x18')][_0x49b6('0x1c')],function(_0x139f00){return{'model':db[_0x139f00[_0x49b6('0x1e')]],'as':_0x139f00['as'],'attributes':_0x139f00[_0x49b6('0x1a')],'include':_0x139f00['include']?_[_0x49b6('0x1d')](_0x139f00[_0x49b6('0x1c')],function(_0x5ec5d7){return{'model':db[_0x5ec5d7['model']],'as':_0x5ec5d7['as'],'attributes':_0x5ec5d7['attributes'],'include':_0x5ec5d7[_0x49b6('0x1c')]?_[_0x49b6('0x1d')](_0x5ec5d7[_0x49b6('0x1c')],function(_0x442a81){return{'model':db[_0x442a81[_0x49b6('0x1e')]],'as':_0x442a81['as'],'attributes':_0x442a81[_0x49b6('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x49b6('0x1f')](function(_0x6084df){logger[_0x49b6('0xd')](_0x49b6('0x16'),_0x2e7ae9);logger['debug']('GetDeskAccount',_0x2e7ae9,JSON[_0x49b6('0x12')](_0x6084df));_0x9d6e7(_0x6084df);})[_0x49b6('0x20')](function(_0x350cf9){logger[_0x49b6('0x13')](_0x49b6('0x16'),_0x350cf9['message'],_0x2e7ae9);_0x3c755f(_0x19c889[_0x49b6('0x13')](0x1f4,_0x350cf9[_0x49b6('0x14')]));});});};exports['ShowDeskAccount']=function(_0x104cb8){var _0x203e37=this;return new Promise(function(_0x406805,_0x126727){return db['DeskAccount'][_0x49b6('0x21')]({'raw':_0x104cb8[_0x49b6('0x18')]?_0x104cb8[_0x49b6('0x18')][_0x49b6('0x19')]===undefined?!![]:![]:!![],'where':_0x104cb8[_0x49b6('0x18')]?_0x104cb8[_0x49b6('0x18')][_0x49b6('0x22')]||null:null,'attributes':_0x104cb8[_0x49b6('0x18')]?_0x104cb8[_0x49b6('0x18')]['attributes']||null:null,'include':_0x104cb8[_0x49b6('0x18')]?_0x104cb8[_0x49b6('0x18')][_0x49b6('0x1c')]?_[_0x49b6('0x1d')](_0x104cb8['options'][_0x49b6('0x1c')],function(_0x2d8541){return{'model':db[_0x2d8541['model']],'as':_0x2d8541['as'],'attributes':_0x2d8541['attributes'],'include':_0x2d8541[_0x49b6('0x1c')]?_[_0x49b6('0x1d')](_0x2d8541[_0x49b6('0x1c')],function(_0x1be594){return{'model':db[_0x1be594[_0x49b6('0x1e')]],'as':_0x1be594['as'],'attributes':_0x1be594[_0x49b6('0x1a')],'include':_0x1be594['include']?_[_0x49b6('0x1d')](_0x1be594[_0x49b6('0x1c')],function(_0x4c24c4){return{'model':db[_0x4c24c4[_0x49b6('0x1e')]],'as':_0x4c24c4['as'],'attributes':_0x4c24c4[_0x49b6('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x337611){logger['info'](_0x49b6('0x23'),_0x104cb8);logger[_0x49b6('0x10')](_0x49b6('0x23'),_0x104cb8,JSON['stringify'](_0x337611));_0x406805(_0x337611);})[_0x49b6('0x20')](function(_0x215e30){logger[_0x49b6('0x13')](_0x49b6('0x23'),_0x215e30[_0x49b6('0x14')],_0x104cb8);_0x126727(_0x203e37[_0x49b6('0x13')](0x1f4,_0x215e30['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 03b39dc..ac4d948 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','getTags','post','/:id/tags','setTags','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x5e5af0,_0x5e2085){var _0x459adb=function(_0x21681c){while(--_0x21681c){_0x5e5af0['push'](_0x5e5af0['shift']());}};_0x459adb(++_0x5e2085);}(_0x3e74,0x175));var _0x43e7=function(_0x335df4,_0x26c962){_0x335df4=_0x335df4-0x0;var _0x52ba66=_0x3e74[_0x335df4];return _0x52ba66;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/subjects',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/tags',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0x13'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router['put']('/:id',auth[_0x43e7('0x8')](),controller[_0x43e7('0x15')]);router[_0x43e7('0x16')](_0x43e7('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x43e7('0x17')]=router; \ No newline at end of file +var _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x1d69e5,_0x2a29af){var _0x17da11=function(_0x36c61f){while(--_0x36c61f){_0x1d69e5['push'](_0x1d69e5['shift']());}};_0x17da11(++_0x2a29af);}(_0x55ca,0x126));var _0xa55c=function(_0x29df9a,_0x42aff3){_0x29df9a=_0x29df9a-0x0;var _0x3a8e96=_0x55ca[_0x29df9a];return _0x3a8e96;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index bc43dc1..b63a511 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 _0x4833=['STRING','sequelize'];(function(_0x11ed1a,_0x18255e){var _0x2625b8=function(_0x5c8f07){while(--_0x5c8f07){_0x11ed1a['push'](_0x11ed1a['shift']());}};_0x2625b8(++_0x18255e);}(_0x4833,0x1e3));var _0x3483=function(_0x4c4b99,_0x3a290f){_0x4c4b99=_0x4c4b99-0x0;var _0x150415=_0x4833[_0x4c4b99];return _0x150415;};'use strict';var Sequelize=require(_0x3483('0x0'));module['exports']={'name':{'type':Sequelize[_0x3483('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6bdc=['exports'];(function(_0x11d1e1,_0x986177){var _0x589093=function(_0x4c18d2){while(--_0x4c18d2){_0x11d1e1['push'](_0x11d1e1['shift']());}};_0x589093(++_0x986177);}(_0x6bdc,0xc9));var _0xc6bd=function(_0x3bd631,_0x1d59a1){_0x3bd631=_0x3bd631-0x0;var _0x2eac80=_0x6bdc[_0x3bd631];return _0x2eac80;};'use strict';var Sequelize=require('sequelize');module[_0xc6bd('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 7d77c37..fccde7e 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 _0xd32d=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','set','json','apply','reject','save','then','destroy','error','stack','name','map','DeskConfiguration','rawAttributes','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','create','body','update','find','params','getFields','findOne','DeskField','getSubjects','getDescriptions','getTags','setTags','eml-format','rimraf','fast-json-patch','request-promise','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring'];(function(_0x5ba59a,_0x25e9f6){var _0x14e2e5=function(_0x1947cb){while(--_0x1947cb){_0x5ba59a['push'](_0x5ba59a['shift']());}};_0x14e2e5(++_0x25e9f6);}(_0xd32d,0x92));var _0xdd32=function(_0x43f6b4,_0x2656ff){_0x43f6b4=_0x43f6b4-0x0;var _0x36de4b=_0xd32d[_0x43f6b4];return _0x36de4b;};'use strict';var emlformat=require(_0xdd32('0x0'));var rimraf=require(_0xdd32('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdd32('0x2'));var rp=require(_0xdd32('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdd32('0x4'));var path=require('path');var sox=require(_0xdd32('0x5'));var csv=require(_0xdd32('0x6'));var ejs=require(_0xdd32('0x7'));var fs=require('fs');var fs_extra=require(_0xdd32('0x8'));var _=require(_0xdd32('0x9'));var squel=require('squel');var crypto=require(_0xdd32('0xa'));var jsforce=require(_0xdd32('0xb'));var deskjs=require(_0xdd32('0xc'));var toCsv=require(_0xdd32('0x6'));var querystring=require(_0xdd32('0xd'));var Papa=require(_0xdd32('0xe'));var Redis=require(_0xdd32('0xf'));var authService=require(_0xdd32('0x10'));var qs=require(_0xdd32('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdd32('0x12'));var logger=require(_0xdd32('0x13'))(_0xdd32('0x14'));var utils=require('../../config/utils');var config=require(_0xdd32('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xdd32('0x16'))['db'];function respondWithStatusCode(_0x1d81ed,_0x18ffdc){_0x18ffdc=_0x18ffdc||0xcc;return function(_0x642369){if(_0x642369){return _0x1d81ed[_0xdd32('0x17')](_0x18ffdc);}return _0x1d81ed['status'](_0x18ffdc)[_0xdd32('0x18')]();};}function respondWithResult(_0x4a4321,_0x6a9b48){_0x6a9b48=_0x6a9b48||0xc8;return function(_0x273689){if(_0x273689){return _0x4a4321['status'](_0x6a9b48)['json'](_0x273689);}};}function respondWithFilteredResult(_0x2c94b2,_0x103bcf){return function(_0x57065d){if(_0x57065d){var _0x148ef4=typeof _0x103bcf[_0xdd32('0x19')]===_0xdd32('0x1a')&&typeof _0x103bcf[_0xdd32('0x1b')]===_0xdd32('0x1a');var _0x17909e=_0x57065d['count'];var _0x351316=_0x148ef4?0x0:_0x103bcf[_0xdd32('0x19')];var _0x436f13=_0x148ef4?_0x57065d[_0xdd32('0x1c')]:_0x103bcf[_0xdd32('0x19')]+_0x103bcf[_0xdd32('0x1b')];var _0x38a866;if(_0x436f13>=_0x17909e){_0x436f13=_0x17909e;_0x38a866=0xc8;}else{_0x38a866=0xce;}_0x2c94b2[_0xdd32('0x1d')](_0x38a866);return _0x2c94b2[_0xdd32('0x1e')]('Content-Range',_0x351316+'-'+_0x436f13+'/'+_0x17909e)[_0xdd32('0x1f')](_0x57065d);}return null;};}function patchUpdates(_0xea4342){return function(_0x56163b){try{jsonpatch[_0xdd32('0x20')](_0x56163b,_0xea4342,!![]);}catch(_0x39df9d){return BPromise[_0xdd32('0x21')](_0x39df9d);}return _0x56163b[_0xdd32('0x22')]();};}function saveUpdates(_0x1fedc1,_0x4c132b){return function(_0x3e249c){if(_0x3e249c){return _0x3e249c['update'](_0x1fedc1)[_0xdd32('0x23')](function(_0x3cd315){return _0x3cd315;});}return null;};}function removeEntity(_0x130716,_0x241f8b){return function(_0x4e3797){if(_0x4e3797){return _0x4e3797[_0xdd32('0x24')]()[_0xdd32('0x23')](function(){_0x130716[_0xdd32('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x783294,_0x37e49a){return function(_0x441cc4){if(!_0x441cc4){_0x783294[_0xdd32('0x17')](0x194);}return _0x441cc4;};}function handleError(_0x13c69f,_0x439e3d){_0x439e3d=_0x439e3d||0x1f4;return function(_0x12a380){logger[_0xdd32('0x25')](_0x12a380[_0xdd32('0x26')]);if(_0x12a380['name']){delete _0x12a380[_0xdd32('0x27')];}_0x13c69f[_0xdd32('0x1d')](_0x439e3d)['send'](_0x12a380);};}exports['index']=function(_0x3c351d,_0x4cde84){var _0x2fb3bb={},_0x493269={},_0x1b6db2={'count':0x0,'rows':[]};var _0x3a8bca=_[_0xdd32('0x28')](db[_0xdd32('0x29')][_0xdd32('0x2a')],function(_0x56a42d){return{'name':_0x56a42d['fieldName'],'type':_0x56a42d[_0xdd32('0x2b')][_0xdd32('0x2c')]};});_0x493269['model']=_[_0xdd32('0x28')](_0x3a8bca,_0xdd32('0x27'));_0x493269['query']=_[_0xdd32('0x2d')](_0x3c351d[_0xdd32('0x2e')]);_0x493269[_0xdd32('0x2f')]=_[_0xdd32('0x30')](_0x493269['model'],_0x493269[_0xdd32('0x2e')]);_0x2fb3bb['attributes']=_['intersection'](_0x493269[_0xdd32('0x31')],qs[_0xdd32('0x32')](_0x3c351d[_0xdd32('0x2e')][_0xdd32('0x32')]));_0x2fb3bb[_0xdd32('0x33')]=_0x2fb3bb[_0xdd32('0x33')][_0xdd32('0x34')]?_0x2fb3bb[_0xdd32('0x33')]:_0x493269[_0xdd32('0x31')];if(!_0x3c351d[_0xdd32('0x2e')][_0xdd32('0x35')](_0xdd32('0x36'))){_0x2fb3bb[_0xdd32('0x1b')]=qs[_0xdd32('0x1b')](_0x3c351d[_0xdd32('0x2e')]['limit']);_0x2fb3bb[_0xdd32('0x19')]=qs[_0xdd32('0x19')](_0x3c351d[_0xdd32('0x2e')]['offset']);}_0x2fb3bb[_0xdd32('0x37')]=qs[_0xdd32('0x38')](_0x3c351d[_0xdd32('0x2e')][_0xdd32('0x38')]);_0x2fb3bb[_0xdd32('0x39')]=qs[_0xdd32('0x2f')](_[_0xdd32('0x3a')](_0x3c351d[_0xdd32('0x2e')],_0x493269['filters']),_0x3a8bca);if(_0x3c351d[_0xdd32('0x2e')][_0xdd32('0x3b')]){_0x2fb3bb[_0xdd32('0x39')]=_['merge'](_0x2fb3bb[_0xdd32('0x39')],{'$or':_['map'](_0x3a8bca,function(_0x4a55da){if(_0x4a55da[_0xdd32('0x2b')]!=='VIRTUAL'){var _0x9dcbd5={};_0x9dcbd5[_0x4a55da[_0xdd32('0x27')]]={'$like':'%'+_0x3c351d[_0xdd32('0x2e')][_0xdd32('0x3b')]+'%'};return _0x9dcbd5;}})});}_0x2fb3bb=_[_0xdd32('0x3c')]({},_0x2fb3bb,_0x3c351d[_0xdd32('0x3d')]);var _0x2e6182={'where':_0x2fb3bb['where']};return db['DeskConfiguration'][_0xdd32('0x1c')](_0x2e6182)[_0xdd32('0x23')](function(_0x1f56cb){_0x1b6db2['count']=_0x1f56cb;if(_0x3c351d[_0xdd32('0x2e')][_0xdd32('0x3e')]){_0x2fb3bb[_0xdd32('0x3f')]=[{'all':!![]}];}return db[_0xdd32('0x29')][_0xdd32('0x40')](_0x2fb3bb);})[_0xdd32('0x23')](function(_0x4648b9){_0x1b6db2[_0xdd32('0x41')]=_0x4648b9;return _0x1b6db2;})[_0xdd32('0x23')](respondWithFilteredResult(_0x4cde84,_0x2fb3bb))[_0xdd32('0x42')](handleError(_0x4cde84,null));};exports[_0xdd32('0x43')]=function(_0x4bcab2,_0x2d4c78){var _0x4cd476={'raw':![],'where':{'id':_0x4bcab2['params']['id']}},_0x482a51={};_0x482a51[_0xdd32('0x31')]=_[_0xdd32('0x2d')](db[_0xdd32('0x29')][_0xdd32('0x2a')]);_0x482a51[_0xdd32('0x2e')]=_[_0xdd32('0x2d')](_0x4bcab2[_0xdd32('0x2e')]);_0x482a51[_0xdd32('0x2f')]=_[_0xdd32('0x30')](_0x482a51[_0xdd32('0x31')],_0x482a51[_0xdd32('0x2e')]);_0x4cd476[_0xdd32('0x33')]=_[_0xdd32('0x30')](_0x482a51[_0xdd32('0x31')],qs[_0xdd32('0x32')](_0x4bcab2[_0xdd32('0x2e')][_0xdd32('0x32')]));_0x4cd476['attributes']=_0x4cd476[_0xdd32('0x33')][_0xdd32('0x34')]?_0x4cd476[_0xdd32('0x33')]:_0x482a51['model'];if(_0x4bcab2[_0xdd32('0x2e')]['includeAll']){_0x4cd476['include']=[{'all':!![]}];}_0x4cd476=_[_0xdd32('0x3c')]({},_0x4cd476,_0x4bcab2[_0xdd32('0x3d')]);return db[_0xdd32('0x29')]['find'](_0x4cd476)['then'](handleEntityNotFound(_0x2d4c78,null))[_0xdd32('0x23')](respondWithResult(_0x2d4c78,null))[_0xdd32('0x42')](handleError(_0x2d4c78,null));};exports['create']=function(_0x1ea9ad,_0x2b4904){return db[_0xdd32('0x29')][_0xdd32('0x44')](_0x1ea9ad[_0xdd32('0x45')],{})[_0xdd32('0x23')](respondWithResult(_0x2b4904,0xc9))[_0xdd32('0x42')](handleError(_0x2b4904,null));};exports[_0xdd32('0x46')]=function(_0x17b20a,_0x3cd3e3){if(_0x17b20a['body']['id']){delete _0x17b20a[_0xdd32('0x45')]['id'];}return db[_0xdd32('0x29')][_0xdd32('0x47')]({'where':{'id':_0x17b20a[_0xdd32('0x48')]['id']}})[_0xdd32('0x23')](handleEntityNotFound(_0x3cd3e3,null))[_0xdd32('0x23')](saveUpdates(_0x17b20a[_0xdd32('0x45')],null))[_0xdd32('0x23')](respondWithResult(_0x3cd3e3,null))['catch'](handleError(_0x3cd3e3,null));};exports['destroy']=function(_0x2378cb,_0x2235e3){return db['DeskConfiguration'][_0xdd32('0x47')]({'where':{'id':_0x2378cb['params']['id']}})[_0xdd32('0x23')](handleEntityNotFound(_0x2235e3,null))[_0xdd32('0x23')](removeEntity(_0x2235e3,null))['catch'](handleError(_0x2235e3,null));};exports[_0xdd32('0x49')]=function(_0x5b18ee,_0x470f90,_0xde1fac){var _0x8f83e0={};var _0x240957={};var _0x1f7d88;var _0x1d272d;return db[_0xdd32('0x29')][_0xdd32('0x4a')]({'where':{'id':_0x5b18ee['params']['id']}})[_0xdd32('0x23')](handleEntityNotFound(_0x470f90,null))[_0xdd32('0x23')](function(_0x2e96ae){if(_0x2e96ae){_0x1f7d88=_0x2e96ae;_0x240957[_0xdd32('0x31')]=_[_0xdd32('0x2d')](db[_0xdd32('0x4b')][_0xdd32('0x2a')]);_0x240957['query']=_['keys'](_0x5b18ee[_0xdd32('0x2e')]);_0x240957[_0xdd32('0x2f')]=_[_0xdd32('0x30')](_0x240957['model'],_0x240957[_0xdd32('0x2e')]);_0x8f83e0[_0xdd32('0x33')]=_[_0xdd32('0x30')](_0x240957[_0xdd32('0x31')],qs[_0xdd32('0x32')](_0x5b18ee[_0xdd32('0x2e')]['fields']));_0x8f83e0[_0xdd32('0x33')]=_0x8f83e0[_0xdd32('0x33')][_0xdd32('0x34')]?_0x8f83e0[_0xdd32('0x33')]:_0x240957[_0xdd32('0x31')];_0x8f83e0[_0xdd32('0x37')]=qs[_0xdd32('0x38')](_0x5b18ee[_0xdd32('0x2e')][_0xdd32('0x38')]);_0x8f83e0[_0xdd32('0x39')]=qs[_0xdd32('0x2f')](_[_0xdd32('0x3a')](_0x5b18ee[_0xdd32('0x2e')],_0x240957[_0xdd32('0x2f')]));if(_0x5b18ee[_0xdd32('0x2e')][_0xdd32('0x3b')]){_0x8f83e0[_0xdd32('0x39')]=_['merge'](_0x8f83e0[_0xdd32('0x39')],{'$or':_[_0xdd32('0x28')](_0x8f83e0[_0xdd32('0x33')],function(_0x4d0438){var _0x7dd369={};_0x7dd369[_0x4d0438]={'$like':'%'+_0x5b18ee['query'][_0xdd32('0x3b')]+'%'};return _0x7dd369;})});}_0x8f83e0=_['merge']({},_0x8f83e0,_0x5b18ee[_0xdd32('0x3d')]);return _0x1f7d88[_0xdd32('0x49')](_0x8f83e0);}})[_0xdd32('0x23')](function(_0x4a752c){if(_0x4a752c){_0x1d272d=_0x4a752c[_0xdd32('0x34')];if(!_0x5b18ee[_0xdd32('0x2e')][_0xdd32('0x35')](_0xdd32('0x36'))){_0x8f83e0['limit']=qs[_0xdd32('0x1b')](_0x5b18ee['query']['limit']);_0x8f83e0['offset']=qs[_0xdd32('0x19')](_0x5b18ee['query'][_0xdd32('0x19')]);}return _0x1f7d88[_0xdd32('0x49')](_0x8f83e0);}})[_0xdd32('0x23')](function(_0x3396cf){if(_0x3396cf){return _0x3396cf?{'count':_0x1d272d,'rows':_0x3396cf}:null;}})[_0xdd32('0x23')](respondWithResult(_0x470f90,null))[_0xdd32('0x42')](handleError(_0x470f90,null));};exports[_0xdd32('0x4c')]=function(_0x5f4c19,_0x37b5d8,_0x603aec){var _0x50f75f={};var _0x59ba28={};var _0x415c08;var _0x63d7b;return db[_0xdd32('0x29')][_0xdd32('0x4a')]({'where':{'id':_0x5f4c19[_0xdd32('0x48')]['id']}})['then'](handleEntityNotFound(_0x37b5d8,null))['then'](function(_0x278dd7){if(_0x278dd7){_0x415c08=_0x278dd7;_0x59ba28['model']=_[_0xdd32('0x2d')](db[_0xdd32('0x4b')][_0xdd32('0x2a')]);_0x59ba28[_0xdd32('0x2e')]=_[_0xdd32('0x2d')](_0x5f4c19[_0xdd32('0x2e')]);_0x59ba28[_0xdd32('0x2f')]=_['intersection'](_0x59ba28[_0xdd32('0x31')],_0x59ba28['query']);_0x50f75f[_0xdd32('0x33')]=_['intersection'](_0x59ba28['model'],qs['fields'](_0x5f4c19['query'][_0xdd32('0x32')]));_0x50f75f[_0xdd32('0x33')]=_0x50f75f['attributes'][_0xdd32('0x34')]?_0x50f75f[_0xdd32('0x33')]:_0x59ba28[_0xdd32('0x31')];_0x50f75f['order']=qs[_0xdd32('0x38')](_0x5f4c19[_0xdd32('0x2e')][_0xdd32('0x38')]);_0x50f75f[_0xdd32('0x39')]=qs['filters'](_[_0xdd32('0x3a')](_0x5f4c19[_0xdd32('0x2e')],_0x59ba28['filters']));if(_0x5f4c19[_0xdd32('0x2e')]['filter']){_0x50f75f[_0xdd32('0x39')]=_['merge'](_0x50f75f[_0xdd32('0x39')],{'$or':_[_0xdd32('0x28')](_0x50f75f[_0xdd32('0x33')],function(_0x373f98){var _0x1b266a={};_0x1b266a[_0x373f98]={'$like':'%'+_0x5f4c19[_0xdd32('0x2e')]['filter']+'%'};return _0x1b266a;})});}_0x50f75f=_[_0xdd32('0x3c')]({},_0x50f75f,_0x5f4c19[_0xdd32('0x3d')]);return _0x415c08[_0xdd32('0x4c')](_0x50f75f);}})['then'](function(_0x13650a){if(_0x13650a){_0x63d7b=_0x13650a[_0xdd32('0x34')];if(!_0x5f4c19[_0xdd32('0x2e')][_0xdd32('0x35')](_0xdd32('0x36'))){_0x50f75f[_0xdd32('0x1b')]=qs[_0xdd32('0x1b')](_0x5f4c19[_0xdd32('0x2e')][_0xdd32('0x1b')]);_0x50f75f[_0xdd32('0x19')]=qs[_0xdd32('0x19')](_0x5f4c19[_0xdd32('0x2e')][_0xdd32('0x19')]);}return _0x415c08[_0xdd32('0x4c')](_0x50f75f);}})[_0xdd32('0x23')](function(_0x29b673){if(_0x29b673){return _0x29b673?{'count':_0x63d7b,'rows':_0x29b673}:null;}})[_0xdd32('0x23')](respondWithResult(_0x37b5d8,null))[_0xdd32('0x42')](handleError(_0x37b5d8,null));};exports[_0xdd32('0x4d')]=function(_0x5a5f02,_0x317ea8,_0x42120a){var _0x5ab6d2={};var _0x5ab5ef={};var _0x4d5e66;var _0xd42bda;return db[_0xdd32('0x29')]['findOne']({'where':{'id':_0x5a5f02[_0xdd32('0x48')]['id']}})[_0xdd32('0x23')](handleEntityNotFound(_0x317ea8,null))[_0xdd32('0x23')](function(_0x1b7d8b){if(_0x1b7d8b){_0x4d5e66=_0x1b7d8b;_0x5ab5ef[_0xdd32('0x31')]=_[_0xdd32('0x2d')](db['DeskField']['rawAttributes']);_0x5ab5ef[_0xdd32('0x2e')]=_[_0xdd32('0x2d')](_0x5a5f02[_0xdd32('0x2e')]);_0x5ab5ef[_0xdd32('0x2f')]=_[_0xdd32('0x30')](_0x5ab5ef[_0xdd32('0x31')],_0x5ab5ef[_0xdd32('0x2e')]);_0x5ab6d2['attributes']=_[_0xdd32('0x30')](_0x5ab5ef[_0xdd32('0x31')],qs[_0xdd32('0x32')](_0x5a5f02[_0xdd32('0x2e')][_0xdd32('0x32')]));_0x5ab6d2[_0xdd32('0x33')]=_0x5ab6d2[_0xdd32('0x33')][_0xdd32('0x34')]?_0x5ab6d2['attributes']:_0x5ab5ef[_0xdd32('0x31')];_0x5ab6d2[_0xdd32('0x37')]=qs['sort'](_0x5a5f02[_0xdd32('0x2e')][_0xdd32('0x38')]);_0x5ab6d2[_0xdd32('0x39')]=qs[_0xdd32('0x2f')](_['pick'](_0x5a5f02[_0xdd32('0x2e')],_0x5ab5ef[_0xdd32('0x2f')]));if(_0x5a5f02[_0xdd32('0x2e')][_0xdd32('0x3b')]){_0x5ab6d2['where']=_[_0xdd32('0x3c')](_0x5ab6d2['where'],{'$or':_[_0xdd32('0x28')](_0x5ab6d2[_0xdd32('0x33')],function(_0x374c61){var _0x2f9bed={};_0x2f9bed[_0x374c61]={'$like':'%'+_0x5a5f02[_0xdd32('0x2e')]['filter']+'%'};return _0x2f9bed;})});}_0x5ab6d2=_[_0xdd32('0x3c')]({},_0x5ab6d2,_0x5a5f02[_0xdd32('0x3d')]);return _0x4d5e66[_0xdd32('0x4d')](_0x5ab6d2);}})[_0xdd32('0x23')](function(_0x12a2f7){if(_0x12a2f7){_0xd42bda=_0x12a2f7['length'];if(!_0x5a5f02['query'][_0xdd32('0x35')](_0xdd32('0x36'))){_0x5ab6d2[_0xdd32('0x1b')]=qs[_0xdd32('0x1b')](_0x5a5f02['query'][_0xdd32('0x1b')]);_0x5ab6d2[_0xdd32('0x19')]=qs[_0xdd32('0x19')](_0x5a5f02[_0xdd32('0x2e')][_0xdd32('0x19')]);}return _0x4d5e66['getDescriptions'](_0x5ab6d2);}})['then'](function(_0x40d444){if(_0x40d444){return _0x40d444?{'count':_0xd42bda,'rows':_0x40d444}:null;}})[_0xdd32('0x23')](respondWithResult(_0x317ea8,null))[_0xdd32('0x42')](handleError(_0x317ea8,null));};exports[_0xdd32('0x4e')]=function(_0x4b38cf,_0x4187d8,_0x474685){var _0x50cc7e={};var _0x427a1a={};var _0x24bcd0;var _0x210dfb;return db[_0xdd32('0x29')][_0xdd32('0x4a')]({'where':{'id':_0x4b38cf['params']['id']}})['then'](handleEntityNotFound(_0x4187d8,null))[_0xdd32('0x23')](function(_0x15e19d){if(_0x15e19d){_0x24bcd0=_0x15e19d;_0x427a1a[_0xdd32('0x31')]=_[_0xdd32('0x2d')](db['Tag']['rawAttributes']);_0x427a1a[_0xdd32('0x2e')]=_[_0xdd32('0x2d')](_0x4b38cf['query']);_0x427a1a['filters']=_[_0xdd32('0x30')](_0x427a1a[_0xdd32('0x31')],_0x427a1a[_0xdd32('0x2e')]);_0x50cc7e[_0xdd32('0x33')]=_[_0xdd32('0x30')](_0x427a1a[_0xdd32('0x31')],qs[_0xdd32('0x32')](_0x4b38cf[_0xdd32('0x2e')]['fields']));_0x50cc7e['attributes']=_0x50cc7e['attributes'][_0xdd32('0x34')]?_0x50cc7e[_0xdd32('0x33')]:_0x427a1a['model'];_0x50cc7e[_0xdd32('0x37')]=qs['sort'](_0x4b38cf['query'][_0xdd32('0x38')]);_0x50cc7e[_0xdd32('0x39')]=qs[_0xdd32('0x2f')](_['pick'](_0x4b38cf[_0xdd32('0x2e')],_0x427a1a[_0xdd32('0x2f')]));if(_0x4b38cf[_0xdd32('0x2e')][_0xdd32('0x3b')]){_0x50cc7e[_0xdd32('0x39')]=_['merge'](_0x50cc7e[_0xdd32('0x39')],{'$or':_[_0xdd32('0x28')](_0x50cc7e[_0xdd32('0x33')],function(_0x17c2fb){var _0x559e38={};_0x559e38[_0x17c2fb]={'$like':'%'+_0x4b38cf[_0xdd32('0x2e')][_0xdd32('0x3b')]+'%'};return _0x559e38;})});}_0x50cc7e=_[_0xdd32('0x3c')]({},_0x50cc7e,_0x4b38cf['options']);return _0x24bcd0[_0xdd32('0x4e')](_0x50cc7e);}})['then'](function(_0x3c42f5){if(_0x3c42f5){_0x210dfb=_0x3c42f5[_0xdd32('0x34')];if(!_0x4b38cf['query'][_0xdd32('0x35')](_0xdd32('0x36'))){_0x50cc7e[_0xdd32('0x1b')]=qs[_0xdd32('0x1b')](_0x4b38cf[_0xdd32('0x2e')]['limit']);_0x50cc7e['offset']=qs['offset'](_0x4b38cf['query'][_0xdd32('0x19')]);}return _0x24bcd0['getTags'](_0x50cc7e);}})[_0xdd32('0x23')](function(_0x57b736){if(_0x57b736){return _0x57b736?{'count':_0x210dfb,'rows':_0x57b736}:null;}})[_0xdd32('0x23')](respondWithResult(_0x4187d8,null))[_0xdd32('0x42')](handleError(_0x4187d8,null));};exports[_0xdd32('0x4f')]=function(_0x145980,_0x373270,_0x472e97){if(_0x145980[_0xdd32('0x45')]['id']){delete _0x145980[_0xdd32('0x45')]['id'];}return db[_0xdd32('0x29')][_0xdd32('0x4a')]({'where':{'id':_0x145980[_0xdd32('0x48')]['id']}})[_0xdd32('0x23')](handleEntityNotFound(_0x373270,null))['then'](function(_0x500b68){if(_0x500b68){return _0x500b68[_0xdd32('0x4f')](_0x145980['body']['ids']||[]);}return null;})[_0xdd32('0x23')](respondWithResult(_0x373270,null))['catch'](handleError(_0x373270,null));}; \ No newline at end of file +var _0xe496=['apply','reject','save','update','then','destroy','end','name','send','index','map','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','DeskConfiguration','includeAll','include','findAll','rows','catch','params','rawAttributes','keys','find','create','body','getFields','findOne','DeskField','pick','options','getSubjects','getDescriptions','Tag','getTags','setTags','ids','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count'];(function(_0x256d6a,_0x2f002f){var _0x460058=function(_0x195be7){while(--_0x195be7){_0x256d6a['push'](_0x256d6a['shift']());}};_0x460058(++_0x2f002f);}(_0xe496,0x16e));var _0x6e49=function(_0x2c6e58,_0x3d1caf){_0x2c6e58=_0x2c6e58-0x0;var _0x4506fd=_0xe496[_0x2c6e58];return _0x4506fd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6e49('0x0'));var rp=require(_0x6e49('0x1'));var moment=require(_0x6e49('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x6e49('0x3'));var util=require(_0x6e49('0x4'));var path=require(_0x6e49('0x5'));var sox=require(_0x6e49('0x6'));var csv=require(_0x6e49('0x7'));var ejs=require(_0x6e49('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6e49('0x9'));var crypto=require(_0x6e49('0xa'));var jsforce=require(_0x6e49('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6e49('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6e49('0xc'));var authService=require(_0x6e49('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x6e49('0xe'));var hardwareService=require(_0x6e49('0xf'));var logger=require(_0x6e49('0x10'))(_0x6e49('0x11'));var utils=require(_0x6e49('0x12'));var config=require(_0x6e49('0x13'));var licenseUtil=require(_0x6e49('0x14'));var db=require(_0x6e49('0x15'))['db'];function respondWithStatusCode(_0x3dbaa6,_0x1b198e){_0x1b198e=_0x1b198e||0xcc;return function(_0x185dae){if(_0x185dae){return _0x3dbaa6[_0x6e49('0x16')](_0x1b198e);}return _0x3dbaa6[_0x6e49('0x17')](_0x1b198e)['end']();};}function respondWithResult(_0x5cef50,_0x6a7d19){_0x6a7d19=_0x6a7d19||0xc8;return function(_0x229e30){if(_0x229e30){return _0x5cef50['status'](_0x6a7d19)[_0x6e49('0x18')](_0x229e30);}};}function respondWithFilteredResult(_0x5302ae,_0x352ec0){return function(_0x1c12b8){if(_0x1c12b8){var _0x4bfb38=typeof _0x352ec0[_0x6e49('0x19')]==='undefined'&&typeof _0x352ec0[_0x6e49('0x1a')]===_0x6e49('0x1b');var _0x110931=_0x1c12b8[_0x6e49('0x1c')];var _0x1f7507=_0x4bfb38?0x0:_0x352ec0['offset'];var _0x1c7f5d=_0x4bfb38?_0x1c12b8['count']:_0x352ec0[_0x6e49('0x19')]+_0x352ec0['limit'];var _0x1795df;if(_0x1c7f5d>=_0x110931){_0x1c7f5d=_0x110931;_0x1795df=0xc8;}else{_0x1795df=0xce;}_0x5302ae['status'](_0x1795df);return _0x5302ae['set']('Content-Range',_0x1f7507+'-'+_0x1c7f5d+'/'+_0x110931)[_0x6e49('0x18')](_0x1c12b8);}return null;};}function patchUpdates(_0x389047){return function(_0x1cf005){try{jsonpatch[_0x6e49('0x1d')](_0x1cf005,_0x389047,!![]);}catch(_0x389a17){return BPromise[_0x6e49('0x1e')](_0x389a17);}return _0x1cf005[_0x6e49('0x1f')]();};}function saveUpdates(_0x5dfc60,_0x4942cf){return function(_0x28dbed){if(_0x28dbed){return _0x28dbed[_0x6e49('0x20')](_0x5dfc60)[_0x6e49('0x21')](function(_0x39e542){return _0x39e542;});}return null;};}function removeEntity(_0x1275d9,_0x53abe8){return function(_0x35079b){if(_0x35079b){return _0x35079b[_0x6e49('0x22')]()['then'](function(){_0x1275d9[_0x6e49('0x17')](0xcc)[_0x6e49('0x23')]();});}};}function handleEntityNotFound(_0x62a307,_0x39c042){return function(_0x45f838){if(!_0x45f838){_0x62a307[_0x6e49('0x16')](0x194);}return _0x45f838;};}function handleError(_0xf7704d,_0xe57b81){_0xe57b81=_0xe57b81||0x1f4;return function(_0x422e06){logger['error'](_0x422e06['stack']);if(_0x422e06['name']){delete _0x422e06[_0x6e49('0x24')];}_0xf7704d[_0x6e49('0x17')](_0xe57b81)[_0x6e49('0x25')](_0x422e06);};}exports[_0x6e49('0x26')]=function(_0x41e6d2,_0x29948d){var _0x1bb090={},_0x498dad={},_0x59ad35={'count':0x0,'rows':[]};var _0x5a95f8=_[_0x6e49('0x27')](db['DeskConfiguration']['rawAttributes'],function(_0x83ab3d){return{'name':_0x83ab3d['fieldName'],'type':_0x83ab3d[_0x6e49('0x28')][_0x6e49('0x29')]};});_0x498dad[_0x6e49('0x2a')]=_[_0x6e49('0x27')](_0x5a95f8,_0x6e49('0x24'));_0x498dad[_0x6e49('0x2b')]=_['keys'](_0x41e6d2['query']);_0x498dad[_0x6e49('0x2c')]=_[_0x6e49('0x2d')](_0x498dad[_0x6e49('0x2a')],_0x498dad[_0x6e49('0x2b')]);_0x1bb090['attributes']=_[_0x6e49('0x2d')](_0x498dad[_0x6e49('0x2a')],qs['fields'](_0x41e6d2['query'][_0x6e49('0x2e')]));_0x1bb090['attributes']=_0x1bb090[_0x6e49('0x2f')][_0x6e49('0x30')]?_0x1bb090['attributes']:_0x498dad[_0x6e49('0x2a')];if(!_0x41e6d2['query'][_0x6e49('0x31')](_0x6e49('0x32'))){_0x1bb090[_0x6e49('0x1a')]=qs['limit'](_0x41e6d2['query'][_0x6e49('0x1a')]);_0x1bb090[_0x6e49('0x19')]=qs['offset'](_0x41e6d2['query'][_0x6e49('0x19')]);}_0x1bb090[_0x6e49('0x33')]=qs[_0x6e49('0x34')](_0x41e6d2[_0x6e49('0x2b')][_0x6e49('0x34')]);_0x1bb090[_0x6e49('0x35')]=qs[_0x6e49('0x2c')](_['pick'](_0x41e6d2[_0x6e49('0x2b')],_0x498dad['filters']),_0x5a95f8);if(_0x41e6d2[_0x6e49('0x2b')][_0x6e49('0x36')]){_0x1bb090[_0x6e49('0x35')]=_[_0x6e49('0x37')](_0x1bb090[_0x6e49('0x35')],{'$or':_[_0x6e49('0x27')](_0x5a95f8,function(_0x2c34d9){if(_0x2c34d9['type']!=='VIRTUAL'){var _0x1bf5ed={};_0x1bf5ed[_0x2c34d9[_0x6e49('0x24')]]={'$like':'%'+_0x41e6d2[_0x6e49('0x2b')][_0x6e49('0x36')]+'%'};return _0x1bf5ed;}})});}_0x1bb090=_[_0x6e49('0x37')]({},_0x1bb090,_0x41e6d2['options']);var _0x108ff1={'where':_0x1bb090[_0x6e49('0x35')]};return db[_0x6e49('0x38')][_0x6e49('0x1c')](_0x108ff1)['then'](function(_0x13e3ba){_0x59ad35[_0x6e49('0x1c')]=_0x13e3ba;if(_0x41e6d2[_0x6e49('0x2b')][_0x6e49('0x39')]){_0x1bb090[_0x6e49('0x3a')]=[{'all':!![]}];}return db[_0x6e49('0x38')][_0x6e49('0x3b')](_0x1bb090);})[_0x6e49('0x21')](function(_0x10270f){_0x59ad35[_0x6e49('0x3c')]=_0x10270f;return _0x59ad35;})[_0x6e49('0x21')](respondWithFilteredResult(_0x29948d,_0x1bb090))[_0x6e49('0x3d')](handleError(_0x29948d,null));};exports['show']=function(_0x295133,_0x34f9eb){var _0x54b8e9={'raw':![],'where':{'id':_0x295133[_0x6e49('0x3e')]['id']}},_0x435c42={};_0x435c42[_0x6e49('0x2a')]=_['keys'](db[_0x6e49('0x38')][_0x6e49('0x3f')]);_0x435c42['query']=_[_0x6e49('0x40')](_0x295133[_0x6e49('0x2b')]);_0x435c42[_0x6e49('0x2c')]=_[_0x6e49('0x2d')](_0x435c42[_0x6e49('0x2a')],_0x435c42[_0x6e49('0x2b')]);_0x54b8e9['attributes']=_[_0x6e49('0x2d')](_0x435c42[_0x6e49('0x2a')],qs[_0x6e49('0x2e')](_0x295133[_0x6e49('0x2b')]['fields']));_0x54b8e9['attributes']=_0x54b8e9[_0x6e49('0x2f')][_0x6e49('0x30')]?_0x54b8e9[_0x6e49('0x2f')]:_0x435c42['model'];if(_0x295133[_0x6e49('0x2b')]['includeAll']){_0x54b8e9['include']=[{'all':!![]}];}_0x54b8e9=_[_0x6e49('0x37')]({},_0x54b8e9,_0x295133['options']);return db['DeskConfiguration'][_0x6e49('0x41')](_0x54b8e9)['then'](handleEntityNotFound(_0x34f9eb,null))['then'](respondWithResult(_0x34f9eb,null))[_0x6e49('0x3d')](handleError(_0x34f9eb,null));};exports[_0x6e49('0x42')]=function(_0x18a256,_0xe039af){return db[_0x6e49('0x38')]['create'](_0x18a256['body'],{})[_0x6e49('0x21')](respondWithResult(_0xe039af,0xc9))[_0x6e49('0x3d')](handleError(_0xe039af,null));};exports['update']=function(_0x116af5,_0x22895f){if(_0x116af5['body']['id']){delete _0x116af5[_0x6e49('0x43')]['id'];}return db[_0x6e49('0x38')][_0x6e49('0x41')]({'where':{'id':_0x116af5[_0x6e49('0x3e')]['id']}})[_0x6e49('0x21')](handleEntityNotFound(_0x22895f,null))[_0x6e49('0x21')](saveUpdates(_0x116af5[_0x6e49('0x43')],null))['then'](respondWithResult(_0x22895f,null))[_0x6e49('0x3d')](handleError(_0x22895f,null));};exports['destroy']=function(_0x28d646,_0x21be9d){return db[_0x6e49('0x38')][_0x6e49('0x41')]({'where':{'id':_0x28d646['params']['id']}})[_0x6e49('0x21')](handleEntityNotFound(_0x21be9d,null))[_0x6e49('0x21')](removeEntity(_0x21be9d,null))[_0x6e49('0x3d')](handleError(_0x21be9d,null));};exports[_0x6e49('0x44')]=function(_0x2390c5,_0xef574d,_0xe2e758){var _0x59c24c={};var _0x2613c7={};var _0x3814fd;var _0x5b72f6;return db[_0x6e49('0x38')][_0x6e49('0x45')]({'where':{'id':_0x2390c5[_0x6e49('0x3e')]['id']}})[_0x6e49('0x21')](handleEntityNotFound(_0xef574d,null))['then'](function(_0x55adbe){if(_0x55adbe){_0x3814fd=_0x55adbe;_0x2613c7[_0x6e49('0x2a')]=_[_0x6e49('0x40')](db[_0x6e49('0x46')][_0x6e49('0x3f')]);_0x2613c7[_0x6e49('0x2b')]=_[_0x6e49('0x40')](_0x2390c5[_0x6e49('0x2b')]);_0x2613c7[_0x6e49('0x2c')]=_['intersection'](_0x2613c7['model'],_0x2613c7[_0x6e49('0x2b')]);_0x59c24c[_0x6e49('0x2f')]=_[_0x6e49('0x2d')](_0x2613c7['model'],qs[_0x6e49('0x2e')](_0x2390c5[_0x6e49('0x2b')][_0x6e49('0x2e')]));_0x59c24c[_0x6e49('0x2f')]=_0x59c24c[_0x6e49('0x2f')][_0x6e49('0x30')]?_0x59c24c[_0x6e49('0x2f')]:_0x2613c7['model'];_0x59c24c[_0x6e49('0x33')]=qs[_0x6e49('0x34')](_0x2390c5['query']['sort']);_0x59c24c['where']=qs['filters'](_[_0x6e49('0x47')](_0x2390c5[_0x6e49('0x2b')],_0x2613c7[_0x6e49('0x2c')]));if(_0x2390c5['query'][_0x6e49('0x36')]){_0x59c24c[_0x6e49('0x35')]=_['merge'](_0x59c24c['where'],{'$or':_['map'](_0x59c24c[_0x6e49('0x2f')],function(_0xd94b0e){var _0x1cfa69={};_0x1cfa69[_0xd94b0e]={'$like':'%'+_0x2390c5[_0x6e49('0x2b')][_0x6e49('0x36')]+'%'};return _0x1cfa69;})});}_0x59c24c=_[_0x6e49('0x37')]({},_0x59c24c,_0x2390c5['options']);return _0x3814fd[_0x6e49('0x44')](_0x59c24c);}})[_0x6e49('0x21')](function(_0x419401){if(_0x419401){_0x5b72f6=_0x419401[_0x6e49('0x30')];if(!_0x2390c5[_0x6e49('0x2b')][_0x6e49('0x31')](_0x6e49('0x32'))){_0x59c24c['limit']=qs['limit'](_0x2390c5[_0x6e49('0x2b')][_0x6e49('0x1a')]);_0x59c24c[_0x6e49('0x19')]=qs[_0x6e49('0x19')](_0x2390c5[_0x6e49('0x2b')]['offset']);}return _0x3814fd[_0x6e49('0x44')](_0x59c24c);}})[_0x6e49('0x21')](function(_0x4635b2){if(_0x4635b2){return _0x4635b2?{'count':_0x5b72f6,'rows':_0x4635b2}:null;}})[_0x6e49('0x21')](respondWithResult(_0xef574d,null))[_0x6e49('0x3d')](handleError(_0xef574d,null));};exports['getSubjects']=function(_0x555c32,_0x1e6f2d,_0xbfbf94){var _0x920c8c={};var _0x484970={};var _0x19a653;var _0x7dc01;return db[_0x6e49('0x38')][_0x6e49('0x45')]({'where':{'id':_0x555c32[_0x6e49('0x3e')]['id']}})[_0x6e49('0x21')](handleEntityNotFound(_0x1e6f2d,null))[_0x6e49('0x21')](function(_0x51c055){if(_0x51c055){_0x19a653=_0x51c055;_0x484970[_0x6e49('0x2a')]=_['keys'](db['DeskField']['rawAttributes']);_0x484970[_0x6e49('0x2b')]=_[_0x6e49('0x40')](_0x555c32[_0x6e49('0x2b')]);_0x484970[_0x6e49('0x2c')]=_[_0x6e49('0x2d')](_0x484970[_0x6e49('0x2a')],_0x484970['query']);_0x920c8c[_0x6e49('0x2f')]=_[_0x6e49('0x2d')](_0x484970[_0x6e49('0x2a')],qs[_0x6e49('0x2e')](_0x555c32[_0x6e49('0x2b')][_0x6e49('0x2e')]));_0x920c8c[_0x6e49('0x2f')]=_0x920c8c[_0x6e49('0x2f')][_0x6e49('0x30')]?_0x920c8c[_0x6e49('0x2f')]:_0x484970[_0x6e49('0x2a')];_0x920c8c[_0x6e49('0x33')]=qs[_0x6e49('0x34')](_0x555c32[_0x6e49('0x2b')][_0x6e49('0x34')]);_0x920c8c['where']=qs['filters'](_[_0x6e49('0x47')](_0x555c32[_0x6e49('0x2b')],_0x484970['filters']));if(_0x555c32[_0x6e49('0x2b')][_0x6e49('0x36')]){_0x920c8c[_0x6e49('0x35')]=_['merge'](_0x920c8c[_0x6e49('0x35')],{'$or':_['map'](_0x920c8c[_0x6e49('0x2f')],function(_0xcdc20){var _0x831ded={};_0x831ded[_0xcdc20]={'$like':'%'+_0x555c32['query']['filter']+'%'};return _0x831ded;})});}_0x920c8c=_[_0x6e49('0x37')]({},_0x920c8c,_0x555c32[_0x6e49('0x48')]);return _0x19a653[_0x6e49('0x49')](_0x920c8c);}})[_0x6e49('0x21')](function(_0x57ce79){if(_0x57ce79){_0x7dc01=_0x57ce79['length'];if(!_0x555c32['query'][_0x6e49('0x31')](_0x6e49('0x32'))){_0x920c8c[_0x6e49('0x1a')]=qs['limit'](_0x555c32[_0x6e49('0x2b')][_0x6e49('0x1a')]);_0x920c8c[_0x6e49('0x19')]=qs[_0x6e49('0x19')](_0x555c32[_0x6e49('0x2b')][_0x6e49('0x19')]);}return _0x19a653[_0x6e49('0x49')](_0x920c8c);}})[_0x6e49('0x21')](function(_0x344766){if(_0x344766){return _0x344766?{'count':_0x7dc01,'rows':_0x344766}:null;}})[_0x6e49('0x21')](respondWithResult(_0x1e6f2d,null))['catch'](handleError(_0x1e6f2d,null));};exports[_0x6e49('0x4a')]=function(_0x16dc2e,_0x584cdb,_0x48b982){var _0x57f9c1={};var _0x145cee={};var _0x284ce4;var _0x594346;return db[_0x6e49('0x38')][_0x6e49('0x45')]({'where':{'id':_0x16dc2e['params']['id']}})[_0x6e49('0x21')](handleEntityNotFound(_0x584cdb,null))[_0x6e49('0x21')](function(_0x2b9a91){if(_0x2b9a91){_0x284ce4=_0x2b9a91;_0x145cee['model']=_[_0x6e49('0x40')](db[_0x6e49('0x46')]['rawAttributes']);_0x145cee[_0x6e49('0x2b')]=_['keys'](_0x16dc2e[_0x6e49('0x2b')]);_0x145cee[_0x6e49('0x2c')]=_[_0x6e49('0x2d')](_0x145cee[_0x6e49('0x2a')],_0x145cee['query']);_0x57f9c1[_0x6e49('0x2f')]=_[_0x6e49('0x2d')](_0x145cee[_0x6e49('0x2a')],qs[_0x6e49('0x2e')](_0x16dc2e[_0x6e49('0x2b')][_0x6e49('0x2e')]));_0x57f9c1[_0x6e49('0x2f')]=_0x57f9c1[_0x6e49('0x2f')][_0x6e49('0x30')]?_0x57f9c1['attributes']:_0x145cee[_0x6e49('0x2a')];_0x57f9c1['order']=qs[_0x6e49('0x34')](_0x16dc2e[_0x6e49('0x2b')][_0x6e49('0x34')]);_0x57f9c1[_0x6e49('0x35')]=qs[_0x6e49('0x2c')](_[_0x6e49('0x47')](_0x16dc2e[_0x6e49('0x2b')],_0x145cee[_0x6e49('0x2c')]));if(_0x16dc2e[_0x6e49('0x2b')]['filter']){_0x57f9c1[_0x6e49('0x35')]=_['merge'](_0x57f9c1[_0x6e49('0x35')],{'$or':_[_0x6e49('0x27')](_0x57f9c1[_0x6e49('0x2f')],function(_0x3fec29){var _0x9f6af0={};_0x9f6af0[_0x3fec29]={'$like':'%'+_0x16dc2e[_0x6e49('0x2b')]['filter']+'%'};return _0x9f6af0;})});}_0x57f9c1=_[_0x6e49('0x37')]({},_0x57f9c1,_0x16dc2e[_0x6e49('0x48')]);return _0x284ce4[_0x6e49('0x4a')](_0x57f9c1);}})[_0x6e49('0x21')](function(_0x4aa59b){if(_0x4aa59b){_0x594346=_0x4aa59b[_0x6e49('0x30')];if(!_0x16dc2e[_0x6e49('0x2b')][_0x6e49('0x31')](_0x6e49('0x32'))){_0x57f9c1[_0x6e49('0x1a')]=qs[_0x6e49('0x1a')](_0x16dc2e[_0x6e49('0x2b')][_0x6e49('0x1a')]);_0x57f9c1[_0x6e49('0x19')]=qs[_0x6e49('0x19')](_0x16dc2e[_0x6e49('0x2b')][_0x6e49('0x19')]);}return _0x284ce4['getDescriptions'](_0x57f9c1);}})[_0x6e49('0x21')](function(_0x5f2b82){if(_0x5f2b82){return _0x5f2b82?{'count':_0x594346,'rows':_0x5f2b82}:null;}})[_0x6e49('0x21')](respondWithResult(_0x584cdb,null))[_0x6e49('0x3d')](handleError(_0x584cdb,null));};exports['getTags']=function(_0x40f87b,_0x27b0c9,_0x1308c7){var _0x41937e={};var _0x32f2c6={};var _0x2141a1;var _0x3a57b6;return db['DeskConfiguration'][_0x6e49('0x45')]({'where':{'id':_0x40f87b[_0x6e49('0x3e')]['id']}})[_0x6e49('0x21')](handleEntityNotFound(_0x27b0c9,null))[_0x6e49('0x21')](function(_0x387489){if(_0x387489){_0x2141a1=_0x387489;_0x32f2c6[_0x6e49('0x2a')]=_[_0x6e49('0x40')](db[_0x6e49('0x4b')][_0x6e49('0x3f')]);_0x32f2c6['query']=_[_0x6e49('0x40')](_0x40f87b[_0x6e49('0x2b')]);_0x32f2c6[_0x6e49('0x2c')]=_[_0x6e49('0x2d')](_0x32f2c6[_0x6e49('0x2a')],_0x32f2c6['query']);_0x41937e[_0x6e49('0x2f')]=_['intersection'](_0x32f2c6[_0x6e49('0x2a')],qs[_0x6e49('0x2e')](_0x40f87b[_0x6e49('0x2b')][_0x6e49('0x2e')]));_0x41937e['attributes']=_0x41937e[_0x6e49('0x2f')][_0x6e49('0x30')]?_0x41937e['attributes']:_0x32f2c6[_0x6e49('0x2a')];_0x41937e[_0x6e49('0x33')]=qs[_0x6e49('0x34')](_0x40f87b[_0x6e49('0x2b')]['sort']);_0x41937e[_0x6e49('0x35')]=qs['filters'](_[_0x6e49('0x47')](_0x40f87b[_0x6e49('0x2b')],_0x32f2c6[_0x6e49('0x2c')]));if(_0x40f87b[_0x6e49('0x2b')][_0x6e49('0x36')]){_0x41937e[_0x6e49('0x35')]=_['merge'](_0x41937e['where'],{'$or':_[_0x6e49('0x27')](_0x41937e['attributes'],function(_0xe17af7){var _0x291b13={};_0x291b13[_0xe17af7]={'$like':'%'+_0x40f87b[_0x6e49('0x2b')][_0x6e49('0x36')]+'%'};return _0x291b13;})});}_0x41937e=_['merge']({},_0x41937e,_0x40f87b['options']);return _0x2141a1[_0x6e49('0x4c')](_0x41937e);}})[_0x6e49('0x21')](function(_0x30ad06){if(_0x30ad06){_0x3a57b6=_0x30ad06['length'];if(!_0x40f87b[_0x6e49('0x2b')]['hasOwnProperty'](_0x6e49('0x32'))){_0x41937e['limit']=qs[_0x6e49('0x1a')](_0x40f87b['query'][_0x6e49('0x1a')]);_0x41937e[_0x6e49('0x19')]=qs['offset'](_0x40f87b['query']['offset']);}return _0x2141a1[_0x6e49('0x4c')](_0x41937e);}})[_0x6e49('0x21')](function(_0x3dcee8){if(_0x3dcee8){return _0x3dcee8?{'count':_0x3a57b6,'rows':_0x3dcee8}:null;}})[_0x6e49('0x21')](respondWithResult(_0x27b0c9,null))[_0x6e49('0x3d')](handleError(_0x27b0c9,null));};exports[_0x6e49('0x4d')]=function(_0x34689e,_0xa80693,_0x71cbe4){if(_0x34689e[_0x6e49('0x43')]['id']){delete _0x34689e[_0x6e49('0x43')]['id'];}return db['DeskConfiguration'][_0x6e49('0x45')]({'where':{'id':_0x34689e[_0x6e49('0x3e')]['id']}})[_0x6e49('0x21')](handleEntityNotFound(_0xa80693,null))[_0x6e49('0x21')](function(_0x392952){if(_0x392952){return _0x392952[_0x6e49('0x4d')](_0x34689e[_0x6e49('0x43')][_0x6e49('0x4e')]||[]);}return null;})[_0x6e49('0x21')](respondWithResult(_0xa80693,null))['catch'](handleError(_0xa80693,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 0b4ebd3..800f5b8 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 _0x2083=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','DeskConfiguration','int_desk_configurations','lodash'];(function(_0x2c4a04,_0x2b6876){var _0x4fc727=function(_0x2dd0da){while(--_0x2dd0da){_0x2c4a04['push'](_0x2c4a04['shift']());}};_0x4fc727(++_0x2b6876);}(_0x2083,0x137));var _0x3208=function(_0x19140e,_0x13d31c){_0x19140e=_0x19140e-0x0;var _0x13a8eb=_0x2083[_0x19140e];return _0x13a8eb;};'use strict';var _=require(_0x3208('0x0'));var util=require(_0x3208('0x1'));var logger=require('../../config/logger')(_0x3208('0x2'));var moment=require(_0x3208('0x3'));var BPromise=require(_0x3208('0x4'));var rp=require(_0x3208('0x5'));var fs=require('fs');var path=require(_0x3208('0x6'));var rimraf=require(_0x3208('0x7'));var config=require(_0x3208('0x8'));var attributes=require('./intDeskConfiguration.attributes');module['exports']=function(_0x5c8d7f,_0x152b81){return _0x5c8d7f[_0x3208('0x9')](_0x3208('0xa'),attributes,{'tableName':_0x3208('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55fe=['path','rimraf','../../config/environment','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5df34e,_0xce6aaa){var _0x410993=function(_0x284c69){while(--_0x284c69){_0x5df34e['push'](_0x5df34e['shift']());}};_0x410993(++_0xce6aaa);}(_0x55fe,0x1b9));var _0xe55f=function(_0x2ebe08,_0x4824b1){_0x2ebe08=_0x2ebe08-0x0;var _0x732882=_0x55fe[_0x2ebe08];return _0x732882;};'use strict';var _=require(_0xe55f('0x0'));var util=require(_0xe55f('0x1'));var logger=require(_0xe55f('0x2'))(_0xe55f('0x3'));var moment=require(_0xe55f('0x4'));var BPromise=require(_0xe55f('0x5'));var rp=require(_0xe55f('0x6'));var fs=require('fs');var path=require(_0xe55f('0x7'));var rimraf=require(_0xe55f('0x8'));var config=require(_0xe55f('0x9'));var attributes=require('./intDeskConfiguration.attributes');module[_0xe55f('0xa')]=function(_0x41a91f,_0x28591b){return _0x41a91f[_0xe55f('0xb')](_0xe55f('0xc'),attributes,{'tableName':_0xe55f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 4b71649..b76333b 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 _0x86c0=['DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','info','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x86c0,0x133));var _0x086c=function(_0x54703a,_0xcbd2e8){_0x54703a=_0x54703a-0x0;var _0x503bd9=_0x86c0[_0x54703a];return _0x503bd9;};'use strict';var _=require(_0x086c('0x0'));var util=require('util');var moment=require(_0x086c('0x1'));var BPromise=require(_0x086c('0x2'));var rs=require(_0x086c('0x3'));var fs=require('fs');var Redis=require(_0x086c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x086c('0x5'));var logger=require(_0x086c('0x6'))(_0x086c('0x7'));var config=require(_0x086c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x086c('0x9')][_0x086c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e27a8,_0x387428,_0x117df9){return new BPromise(function(_0x25e437,_0x52b942){return client[_0x086c('0xb')](_0x2e27a8,_0x117df9)[_0x086c('0xc')](function(_0xa1b79a){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x387428,_0x086c('0xd'));logger[_0x086c('0xe')](_0x086c('0xf'),_0x387428,_0x086c('0xd'),JSON[_0x086c('0x10')](_0xa1b79a));if(_0xa1b79a['error']){if(_0xa1b79a[_0x086c('0x11')][_0x086c('0x12')]===0x1f4){logger[_0x086c('0x11')](_0x086c('0x13'),_0x387428,_0xa1b79a['error']['message']);return _0x52b942(_0xa1b79a[_0x086c('0x11')]['message']);}logger[_0x086c('0x11')](_0x086c('0x13'),_0x387428,_0xa1b79a['error'][_0x086c('0x14')]);return _0x25e437(_0xa1b79a[_0x086c('0x11')][_0x086c('0x14')]);}else{logger[_0x086c('0x15')]('DeskConfiguration,\x20%s,\x20%s',_0x387428,_0x086c('0xd'));_0x25e437(_0xa1b79a[_0x086c('0x16')][_0x086c('0x14')]);}})['catch'](function(_0x34e74f){logger[_0x086c('0x11')](_0x086c('0x13'),_0x387428,_0x34e74f);_0x52b942(_0x34e74f);});});} \ No newline at end of file +var _0xf7a1=['ioredis','../../mysqldb','../../config/logger','../../config/environment','http','request','then','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x37b1a4,_0x55235f){var _0x3ee426=function(_0x5893a1){while(--_0x5893a1){_0x37b1a4['push'](_0x37b1a4['shift']());}};_0x3ee426(++_0x55235f);}(_0xf7a1,0xed));var _0x1f7a=function(_0xa5dbf,_0x307a39){_0xa5dbf=_0xa5dbf-0x0;var _0x43a8db=_0xf7a1[_0xa5dbf];return _0x43a8db;};'use strict';var _=require(_0x1f7a('0x0'));var util=require(_0x1f7a('0x1'));var moment=require(_0x1f7a('0x2'));var BPromise=require(_0x1f7a('0x3'));var rs=require(_0x1f7a('0x4'));var fs=require('fs');var Redis=require(_0x1f7a('0x5'));var db=require(_0x1f7a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1f7a('0x7'))('rpc');var config=require(_0x1f7a('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1f7a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x24369e,_0x3dfae3,_0x1ff20a){return new BPromise(function(_0x4c4f12,_0x3971ab){return client[_0x1f7a('0xa')](_0x24369e,_0x1ff20a)[_0x1f7a('0xb')](function(_0x32d27b){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x3dfae3,'request\x20sent');logger[_0x1f7a('0xc')](_0x1f7a('0xd'),_0x3dfae3,'request\x20sent',JSON[_0x1f7a('0xe')](_0x32d27b));if(_0x32d27b['error']){if(_0x32d27b[_0x1f7a('0xf')][_0x1f7a('0x10')]===0x1f4){logger[_0x1f7a('0xf')](_0x1f7a('0x11'),_0x3dfae3,_0x32d27b[_0x1f7a('0xf')][_0x1f7a('0x12')]);return _0x3971ab(_0x32d27b[_0x1f7a('0xf')][_0x1f7a('0x12')]);}logger[_0x1f7a('0xf')](_0x1f7a('0x11'),_0x3dfae3,_0x32d27b[_0x1f7a('0xf')][_0x1f7a('0x12')]);return _0x4c4f12(_0x32d27b[_0x1f7a('0xf')][_0x1f7a('0x12')]);}else{logger[_0x1f7a('0x13')](_0x1f7a('0x11'),_0x3dfae3,'request\x20sent');_0x4c4f12(_0x32d27b[_0x1f7a('0x14')][_0x1f7a('0x12')]);}})[_0x1f7a('0x15')](function(_0x544f3f){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x3dfae3,_0x544f3f);_0x3971ab(_0x544f3f);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 018d28f..d87485f 100644 --- a/server/api/intDeskField/index.js +++ b/server/api/intDeskField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x404d=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','get','index','show','post','put','/:id','isAuthenticated','update','destroy','multer','util','path','connect-timeout','express'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x404d,0x1e9));var _0xd404=function(_0x1f1b32,_0x2d778c){_0x1f1b32=_0x1f1b32-0x0;var _0xd4718c=_0x404d[_0x1f1b32];return _0xd4718c;};'use strict';var multer=require(_0xd404('0x0'));var util=require(_0xd404('0x1'));var path=require(_0xd404('0x2'));var timeout=require(_0xd404('0x3'));var express=require(_0xd404('0x4'));var router=express[_0xd404('0x5')]();var fs_extra=require(_0xd404('0x6'));var auth=require(_0xd404('0x7'));var interaction=require(_0xd404('0x8'));var config=require('../../config/environment');var controller=require(_0xd404('0x9'));router[_0xd404('0xa')]('/',auth['isAuthenticated'](),controller[_0xd404('0xb')]);router[_0xd404('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xd404('0xc')]);router[_0xd404('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd404('0xe')](_0xd404('0xf'),auth[_0xd404('0x10')](),controller[_0xd404('0x11')]);router['delete']('/:id',auth[_0xd404('0x10')](),controller[_0xd404('0x12')]);module['exports']=router; \ No newline at end of file +var _0x0598=['../../components/auth/service','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','multer','util','connect-timeout','fs-extra'];(function(_0x718ebd,_0xa33249){var _0x48cac9=function(_0x43001a){while(--_0x43001a){_0x718ebd['push'](_0x718ebd['shift']());}};_0x48cac9(++_0xa33249);}(_0x0598,0x92));var _0x8059=function(_0x12cc52,_0x43f18a){_0x12cc52=_0x12cc52-0x0;var _0x14299a=_0x0598[_0x12cc52];return _0x14299a;};'use strict';var multer=require(_0x8059('0x0'));var util=require(_0x8059('0x1'));var path=require('path');var timeout=require(_0x8059('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8059('0x3'));var auth=require(_0x8059('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intDeskField.controller');router[_0x8059('0x5')]('/',auth[_0x8059('0x6')](),controller['index']);router['get'](_0x8059('0x7'),auth[_0x8059('0x6')](),controller[_0x8059('0x8')]);router[_0x8059('0x9')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8059('0xa')](_0x8059('0x7'),auth[_0x8059('0x6')](),controller[_0x8059('0xb')]);router[_0x8059('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x8059('0xd')]);module[_0x8059('0xe')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index f236f05..4167a0c 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 _0x8907=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x22fb94,_0x9a235c){var _0x33da77=function(_0x58edb8){while(--_0x58edb8){_0x22fb94['push'](_0x22fb94['shift']());}};_0x33da77(++_0x9a235c);}(_0x8907,0x139));var _0x7890=function(_0x16b0c0,_0x4c19b0){_0x16b0c0=_0x16b0c0-0x0;var _0x4f3bbf=_0x8907[_0x16b0c0];return _0x4f3bbf;};'use strict';var Sequelize=require(_0x7890('0x0'));module[_0x7890('0x1')]={'type':{'type':Sequelize[_0x7890('0x2')](_0x7890('0x3'),_0x7890('0x4'),_0x7890('0x5'),_0x7890('0x6'),_0x7890('0x7')),'defaultValue':_0x7890('0x3')},'content':{'type':Sequelize[_0x7890('0x8')]},'key':{'type':Sequelize[_0x7890('0x8')]},'keyType':{'type':Sequelize[_0x7890('0x2')]('string',_0x7890('0x4'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x7890('0x8')]},'nameField':{'type':Sequelize[_0x7890('0x8')]},'customField':{'type':Sequelize[_0x7890('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7890('0x8')]}}; \ No newline at end of file +var _0xaf4c=['ENUM','variable','customVariable','keyValue','string','STRING','BOOLEAN','exports'];(function(_0x3e860a,_0x1816bd){var _0x53842a=function(_0x397e6b){while(--_0x397e6b){_0x3e860a['push'](_0x3e860a['shift']());}};_0x53842a(++_0x1816bd);}(_0xaf4c,0x12f));var _0xcaf4=function(_0x146d0f,_0x38cbd7){_0x146d0f=_0x146d0f-0x0;var _0x128b66=_0xaf4c[_0x146d0f];return _0x128b66;};'use strict';var Sequelize=require('sequelize');module[_0xcaf4('0x0')]={'type':{'type':Sequelize[_0xcaf4('0x1')]('string',_0xcaf4('0x2'),_0xcaf4('0x3'),_0xcaf4('0x4'),'picklist'),'defaultValue':_0xcaf4('0x5')},'content':{'type':Sequelize[_0xcaf4('0x6')]},'key':{'type':Sequelize[_0xcaf4('0x6')]},'keyType':{'type':Sequelize[_0xcaf4('0x1')](_0xcaf4('0x5'),_0xcaf4('0x2'),_0xcaf4('0x3'))},'keyContent':{'type':Sequelize[_0xcaf4('0x6')]},'idField':{'type':Sequelize[_0xcaf4('0x6')]},'nameField':{'type':Sequelize[_0xcaf4('0x6')]},'customField':{'type':Sequelize[_0xcaf4('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcaf4('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 17bb076..8cf348d 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 _0x8f04=['sendStatus','status','end','undefined','limit','count','set','Content-Range','json','apply','save','update','destroy','then','stack','name','send','DeskField','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','nolimit','offset','order','sort','filters','where','VIRTUAL','filter','merge','includeAll','include','findAll','catch','show','params','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x38a798,_0x9b0a78){var _0x38f497=function(_0x4338c4){while(--_0x4338c4){_0x38a798['push'](_0x38a798['shift']());}};_0x38f497(++_0x9b0a78);}(_0x8f04,0xbc));var _0x48f0=function(_0x4c91af,_0xc7d39){_0x4c91af=_0x4c91af-0x0;var _0x9589bc=_0x8f04[_0x4c91af];return _0x9589bc;};'use strict';var emlformat=require(_0x48f0('0x0'));var rimraf=require(_0x48f0('0x1'));var zipdir=require(_0x48f0('0x2'));var jsonpatch=require(_0x48f0('0x3'));var rp=require('request-promise');var moment=require(_0x48f0('0x4'));var BPromise=require(_0x48f0('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x48f0('0x6'));var sox=require('sox');var csv=require(_0x48f0('0x7'));var ejs=require(_0x48f0('0x8'));var fs=require('fs');var fs_extra=require(_0x48f0('0x9'));var _=require(_0x48f0('0xa'));var squel=require(_0x48f0('0xb'));var crypto=require(_0x48f0('0xc'));var jsforce=require(_0x48f0('0xd'));var deskjs=require(_0x48f0('0xe'));var toCsv=require(_0x48f0('0x7'));var querystring=require(_0x48f0('0xf'));var Papa=require(_0x48f0('0x10'));var Redis=require(_0x48f0('0x11'));var authService=require(_0x48f0('0x12'));var qs=require(_0x48f0('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x48f0('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x48f0('0x15'));var config=require(_0x48f0('0x16'));var licenseUtil=require(_0x48f0('0x17'));var db=require(_0x48f0('0x18'))['db'];function respondWithStatusCode(_0xd332a9,_0x513138){_0x513138=_0x513138||0xcc;return function(_0x50fc80){if(_0x50fc80){return _0xd332a9[_0x48f0('0x19')](_0x513138);}return _0xd332a9[_0x48f0('0x1a')](_0x513138)[_0x48f0('0x1b')]();};}function respondWithResult(_0x577404,_0x4256ae){_0x4256ae=_0x4256ae||0xc8;return function(_0xf471ec){if(_0xf471ec){return _0x577404[_0x48f0('0x1a')](_0x4256ae)['json'](_0xf471ec);}};}function respondWithFilteredResult(_0x37a836,_0x3e176e){return function(_0x253667){if(_0x253667){var _0x175796=typeof _0x3e176e['offset']===_0x48f0('0x1c')&&typeof _0x3e176e[_0x48f0('0x1d')]==='undefined';var _0x4bed08=_0x253667[_0x48f0('0x1e')];var _0x303125=_0x175796?0x0:_0x3e176e['offset'];var _0xfff9c1=_0x175796?_0x253667[_0x48f0('0x1e')]:_0x3e176e['offset']+_0x3e176e[_0x48f0('0x1d')];var _0x432a5d;if(_0xfff9c1>=_0x4bed08){_0xfff9c1=_0x4bed08;_0x432a5d=0xc8;}else{_0x432a5d=0xce;}_0x37a836[_0x48f0('0x1a')](_0x432a5d);return _0x37a836[_0x48f0('0x1f')](_0x48f0('0x20'),_0x303125+'-'+_0xfff9c1+'/'+_0x4bed08)[_0x48f0('0x21')](_0x253667);}return null;};}function patchUpdates(_0x14e714){return function(_0x34771f){try{jsonpatch[_0x48f0('0x22')](_0x34771f,_0x14e714,!![]);}catch(_0x1ec3d1){return BPromise['reject'](_0x1ec3d1);}return _0x34771f[_0x48f0('0x23')]();};}function saveUpdates(_0x29446a,_0x548868){return function(_0x488745){if(_0x488745){return _0x488745[_0x48f0('0x24')](_0x29446a)['then'](function(_0x34ba32){return _0x34ba32;});}return null;};}function removeEntity(_0x54edc4,_0x1aa9b1){return function(_0x5409c3){if(_0x5409c3){return _0x5409c3[_0x48f0('0x25')]()[_0x48f0('0x26')](function(){_0x54edc4[_0x48f0('0x1a')](0xcc)[_0x48f0('0x1b')]();});}};}function handleEntityNotFound(_0x5fe75b,_0x2f8e89){return function(_0x2f7cf3){if(!_0x2f7cf3){_0x5fe75b[_0x48f0('0x19')](0x194);}return _0x2f7cf3;};}function handleError(_0x43043e,_0x51f867){_0x51f867=_0x51f867||0x1f4;return function(_0x500490){logger['error'](_0x500490[_0x48f0('0x27')]);if(_0x500490[_0x48f0('0x28')]){delete _0x500490[_0x48f0('0x28')];}_0x43043e[_0x48f0('0x1a')](_0x51f867)[_0x48f0('0x29')](_0x500490);};}exports['index']=function(_0xb2face,_0xf8dfdf){var _0x45e364={},_0x5c07cf={},_0x72f69f={'count':0x0,'rows':[]};var _0x5d9f3d=_['map'](db[_0x48f0('0x2a')][_0x48f0('0x2b')],function(_0x342700){return{'name':_0x342700['fieldName'],'type':_0x342700[_0x48f0('0x2c')][_0x48f0('0x2d')]};});_0x5c07cf['model']=_['map'](_0x5d9f3d,_0x48f0('0x28'));_0x5c07cf[_0x48f0('0x2e')]=_[_0x48f0('0x2f')](_0xb2face[_0x48f0('0x2e')]);_0x5c07cf['filters']=_[_0x48f0('0x30')](_0x5c07cf[_0x48f0('0x31')],_0x5c07cf[_0x48f0('0x2e')]);_0x45e364[_0x48f0('0x32')]=_[_0x48f0('0x30')](_0x5c07cf['model'],qs['fields'](_0xb2face[_0x48f0('0x2e')][_0x48f0('0x33')]));_0x45e364[_0x48f0('0x32')]=_0x45e364[_0x48f0('0x32')]['length']?_0x45e364[_0x48f0('0x32')]:_0x5c07cf[_0x48f0('0x31')];if(!_0xb2face[_0x48f0('0x2e')]['hasOwnProperty'](_0x48f0('0x34'))){_0x45e364[_0x48f0('0x1d')]=qs[_0x48f0('0x1d')](_0xb2face[_0x48f0('0x2e')][_0x48f0('0x1d')]);_0x45e364['offset']=qs[_0x48f0('0x35')](_0xb2face[_0x48f0('0x2e')][_0x48f0('0x35')]);}_0x45e364[_0x48f0('0x36')]=qs[_0x48f0('0x37')](_0xb2face['query'][_0x48f0('0x37')]);_0x45e364['where']=qs[_0x48f0('0x38')](_['pick'](_0xb2face[_0x48f0('0x2e')],_0x5c07cf['filters']),_0x5d9f3d);if(_0xb2face[_0x48f0('0x2e')]['filter']){_0x45e364[_0x48f0('0x39')]=_['merge'](_0x45e364[_0x48f0('0x39')],{'$or':_['map'](_0x5d9f3d,function(_0x50d4f1){if(_0x50d4f1[_0x48f0('0x2c')]!==_0x48f0('0x3a')){var _0x399e9b={};_0x399e9b[_0x50d4f1['name']]={'$like':'%'+_0xb2face['query'][_0x48f0('0x3b')]+'%'};return _0x399e9b;}})});}_0x45e364=_[_0x48f0('0x3c')]({},_0x45e364,_0xb2face['options']);var _0x5b2574={'where':_0x45e364[_0x48f0('0x39')]};return db[_0x48f0('0x2a')][_0x48f0('0x1e')](_0x5b2574)[_0x48f0('0x26')](function(_0x5fc2ec){_0x72f69f[_0x48f0('0x1e')]=_0x5fc2ec;if(_0xb2face[_0x48f0('0x2e')][_0x48f0('0x3d')]){_0x45e364[_0x48f0('0x3e')]=[{'all':!![]}];}return db[_0x48f0('0x2a')][_0x48f0('0x3f')](_0x45e364);})[_0x48f0('0x26')](function(_0x4b837f){_0x72f69f['rows']=_0x4b837f;return _0x72f69f;})['then'](respondWithFilteredResult(_0xf8dfdf,_0x45e364))[_0x48f0('0x40')](handleError(_0xf8dfdf,null));};exports[_0x48f0('0x41')]=function(_0x350dbc,_0x50d71a){var _0x5c4a6b={'raw':!![],'where':{'id':_0x350dbc[_0x48f0('0x42')]['id']}},_0x189757={};_0x189757['model']=_['keys'](db['DeskField'][_0x48f0('0x2b')]);_0x189757[_0x48f0('0x2e')]=_[_0x48f0('0x2f')](_0x350dbc[_0x48f0('0x2e')]);_0x189757[_0x48f0('0x38')]=_[_0x48f0('0x30')](_0x189757[_0x48f0('0x31')],_0x189757[_0x48f0('0x2e')]);_0x5c4a6b['attributes']=_[_0x48f0('0x30')](_0x189757['model'],qs[_0x48f0('0x33')](_0x350dbc[_0x48f0('0x2e')][_0x48f0('0x33')]));_0x5c4a6b[_0x48f0('0x32')]=_0x5c4a6b[_0x48f0('0x32')]['length']?_0x5c4a6b[_0x48f0('0x32')]:_0x189757[_0x48f0('0x31')];if(_0x350dbc[_0x48f0('0x2e')][_0x48f0('0x3d')]){_0x5c4a6b[_0x48f0('0x3e')]=[{'all':!![]}];}_0x5c4a6b=_['merge']({},_0x5c4a6b,_0x350dbc[_0x48f0('0x43')]);return db[_0x48f0('0x2a')][_0x48f0('0x44')](_0x5c4a6b)[_0x48f0('0x26')](handleEntityNotFound(_0x50d71a,null))[_0x48f0('0x26')](respondWithResult(_0x50d71a,null))[_0x48f0('0x40')](handleError(_0x50d71a,null));};exports['create']=function(_0x9b7ca4,_0x4ad0b9){return db[_0x48f0('0x2a')][_0x48f0('0x45')](_0x9b7ca4[_0x48f0('0x46')],{})[_0x48f0('0x26')](respondWithResult(_0x4ad0b9,0xc9))['catch'](handleError(_0x4ad0b9,null));};exports['update']=function(_0x2f042a,_0x571365){if(_0x2f042a[_0x48f0('0x46')]['id']){delete _0x2f042a[_0x48f0('0x46')]['id'];}return db[_0x48f0('0x2a')][_0x48f0('0x44')]({'where':{'id':_0x2f042a[_0x48f0('0x42')]['id']}})[_0x48f0('0x26')](handleEntityNotFound(_0x571365,null))['then'](saveUpdates(_0x2f042a['body'],null))[_0x48f0('0x26')](respondWithResult(_0x571365,null))['catch'](handleError(_0x571365,null));};exports[_0x48f0('0x25')]=function(_0x3b3cb8,_0x44a656){return db['DeskField'][_0x48f0('0x44')]({'where':{'id':_0x3b3cb8[_0x48f0('0x42')]['id']}})[_0x48f0('0x26')](handleEntityNotFound(_0x44a656,null))[_0x48f0('0x26')](removeEntity(_0x44a656,null))[_0x48f0('0x40')](handleError(_0x44a656,null));}; \ No newline at end of file +var _0x251b=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','sendStatus','error','stack','name','send','DeskField','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','length','create','body','catch','find','params','destroy','eml-format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x251b,0x185));var _0xb251=function(_0x470bfb,_0x389787){_0x470bfb=_0x470bfb-0x0;var _0x2f5d97=_0x251b[_0x470bfb];return _0x2f5d97;};'use strict';var emlformat=require(_0xb251('0x0'));var rimraf=require(_0xb251('0x1'));var zipdir=require(_0xb251('0x2'));var jsonpatch=require(_0xb251('0x3'));var rp=require(_0xb251('0x4'));var moment=require(_0xb251('0x5'));var BPromise=require(_0xb251('0x6'));var Mustache=require(_0xb251('0x7'));var util=require(_0xb251('0x8'));var path=require(_0xb251('0x9'));var sox=require(_0xb251('0xa'));var csv=require(_0xb251('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb251('0xc'));var _=require('lodash');var squel=require(_0xb251('0xd'));var crypto=require(_0xb251('0xe'));var jsforce=require(_0xb251('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xb251('0xb'));var querystring=require(_0xb251('0x10'));var Papa=require(_0xb251('0x11'));var Redis=require('ioredis');var authService=require(_0xb251('0x12'));var qs=require(_0xb251('0x13'));var as=require(_0xb251('0x14'));var hardwareService=require(_0xb251('0x15'));var logger=require('../../config/logger')(_0xb251('0x16'));var utils=require(_0xb251('0x17'));var config=require(_0xb251('0x18'));var licenseUtil=require(_0xb251('0x19'));var db=require(_0xb251('0x1a'))['db'];function respondWithStatusCode(_0x238ea6,_0x36b0d7){_0x36b0d7=_0x36b0d7||0xcc;return function(_0x3009db){if(_0x3009db){return _0x238ea6['sendStatus'](_0x36b0d7);}return _0x238ea6[_0xb251('0x1b')](_0x36b0d7)[_0xb251('0x1c')]();};}function respondWithResult(_0x2d500a,_0x38e4c9){_0x38e4c9=_0x38e4c9||0xc8;return function(_0x2c91e9){if(_0x2c91e9){return _0x2d500a['status'](_0x38e4c9)[_0xb251('0x1d')](_0x2c91e9);}};}function respondWithFilteredResult(_0x5ebb50,_0xfe9723){return function(_0x5a346a){if(_0x5a346a){var _0x335295=typeof _0xfe9723[_0xb251('0x1e')]===_0xb251('0x1f')&&typeof _0xfe9723[_0xb251('0x20')]===_0xb251('0x1f');var _0xb07d0=_0x5a346a[_0xb251('0x21')];var _0x3130a4=_0x335295?0x0:_0xfe9723[_0xb251('0x1e')];var _0x54287e=_0x335295?_0x5a346a[_0xb251('0x21')]:_0xfe9723[_0xb251('0x1e')]+_0xfe9723[_0xb251('0x20')];var _0x58d47c;if(_0x54287e>=_0xb07d0){_0x54287e=_0xb07d0;_0x58d47c=0xc8;}else{_0x58d47c=0xce;}_0x5ebb50['status'](_0x58d47c);return _0x5ebb50['set'](_0xb251('0x22'),_0x3130a4+'-'+_0x54287e+'/'+_0xb07d0)[_0xb251('0x1d')](_0x5a346a);}return null;};}function patchUpdates(_0x4b8e09){return function(_0x39335d){try{jsonpatch['apply'](_0x39335d,_0x4b8e09,!![]);}catch(_0xc6473f){return BPromise[_0xb251('0x23')](_0xc6473f);}return _0x39335d[_0xb251('0x24')]();};}function saveUpdates(_0x6d4f08,_0xbf7704){return function(_0x35db59){if(_0x35db59){return _0x35db59[_0xb251('0x25')](_0x6d4f08)[_0xb251('0x26')](function(_0x2df1be){return _0x2df1be;});}return null;};}function removeEntity(_0x204078,_0x188370){return function(_0x2bcb77){if(_0x2bcb77){return _0x2bcb77['destroy']()[_0xb251('0x26')](function(){_0x204078['status'](0xcc)[_0xb251('0x1c')]();});}};}function handleEntityNotFound(_0x436f3b,_0x453f8e){return function(_0x1e7785){if(!_0x1e7785){_0x436f3b[_0xb251('0x27')](0x194);}return _0x1e7785;};}function handleError(_0x5b263e,_0x48ed05){_0x48ed05=_0x48ed05||0x1f4;return function(_0x28d7a3){logger[_0xb251('0x28')](_0x28d7a3[_0xb251('0x29')]);if(_0x28d7a3[_0xb251('0x2a')]){delete _0x28d7a3['name'];}_0x5b263e[_0xb251('0x1b')](_0x48ed05)[_0xb251('0x2b')](_0x28d7a3);};}exports['index']=function(_0x3a873d,_0x2039e4){var _0x5159e8={},_0x465749={},_0x3b4096={'count':0x0,'rows':[]};var _0x232fc5=_['map'](db[_0xb251('0x2c')]['rawAttributes'],function(_0x1014ad){return{'name':_0x1014ad[_0xb251('0x2d')],'type':_0x1014ad[_0xb251('0x2e')][_0xb251('0x2f')]};});_0x465749[_0xb251('0x30')]=_['map'](_0x232fc5,_0xb251('0x2a'));_0x465749['query']=_[_0xb251('0x31')](_0x3a873d['query']);_0x465749[_0xb251('0x32')]=_[_0xb251('0x33')](_0x465749['model'],_0x465749[_0xb251('0x34')]);_0x5159e8[_0xb251('0x35')]=_[_0xb251('0x33')](_0x465749[_0xb251('0x30')],qs[_0xb251('0x36')](_0x3a873d[_0xb251('0x34')]['fields']));_0x5159e8[_0xb251('0x35')]=_0x5159e8[_0xb251('0x35')]['length']?_0x5159e8[_0xb251('0x35')]:_0x465749['model'];if(!_0x3a873d['query'][_0xb251('0x37')](_0xb251('0x38'))){_0x5159e8[_0xb251('0x20')]=qs[_0xb251('0x20')](_0x3a873d[_0xb251('0x34')][_0xb251('0x20')]);_0x5159e8[_0xb251('0x1e')]=qs[_0xb251('0x1e')](_0x3a873d[_0xb251('0x34')][_0xb251('0x1e')]);}_0x5159e8[_0xb251('0x39')]=qs[_0xb251('0x3a')](_0x3a873d[_0xb251('0x34')][_0xb251('0x3a')]);_0x5159e8[_0xb251('0x3b')]=qs['filters'](_[_0xb251('0x3c')](_0x3a873d[_0xb251('0x34')],_0x465749['filters']),_0x232fc5);if(_0x3a873d['query'][_0xb251('0x3d')]){_0x5159e8[_0xb251('0x3b')]=_[_0xb251('0x3e')](_0x5159e8[_0xb251('0x3b')],{'$or':_[_0xb251('0x3f')](_0x232fc5,function(_0xe5e078){if(_0xe5e078[_0xb251('0x2e')]!==_0xb251('0x40')){var _0xef9fd2={};_0xef9fd2[_0xe5e078[_0xb251('0x2a')]]={'$like':'%'+_0x3a873d[_0xb251('0x34')][_0xb251('0x3d')]+'%'};return _0xef9fd2;}})});}_0x5159e8=_[_0xb251('0x3e')]({},_0x5159e8,_0x3a873d[_0xb251('0x41')]);var _0x3c920e={'where':_0x5159e8[_0xb251('0x3b')]};return db[_0xb251('0x2c')][_0xb251('0x21')](_0x3c920e)[_0xb251('0x26')](function(_0x439e0b){_0x3b4096[_0xb251('0x21')]=_0x439e0b;if(_0x3a873d[_0xb251('0x34')][_0xb251('0x42')]){_0x5159e8[_0xb251('0x43')]=[{'all':!![]}];}return db[_0xb251('0x2c')][_0xb251('0x44')](_0x5159e8);})[_0xb251('0x26')](function(_0x34bcd2){_0x3b4096[_0xb251('0x45')]=_0x34bcd2;return _0x3b4096;})['then'](respondWithFilteredResult(_0x2039e4,_0x5159e8))['catch'](handleError(_0x2039e4,null));};exports[_0xb251('0x46')]=function(_0x34584b,_0x1e7ca5){var _0x40dbfd={'raw':!![],'where':{'id':_0x34584b['params']['id']}},_0x1a03dd={};_0x1a03dd[_0xb251('0x30')]=_[_0xb251('0x31')](db[_0xb251('0x2c')]['rawAttributes']);_0x1a03dd[_0xb251('0x34')]=_[_0xb251('0x31')](_0x34584b['query']);_0x1a03dd[_0xb251('0x32')]=_['intersection'](_0x1a03dd[_0xb251('0x30')],_0x1a03dd[_0xb251('0x34')]);_0x40dbfd[_0xb251('0x35')]=_['intersection'](_0x1a03dd['model'],qs[_0xb251('0x36')](_0x34584b['query']['fields']));_0x40dbfd[_0xb251('0x35')]=_0x40dbfd[_0xb251('0x35')][_0xb251('0x47')]?_0x40dbfd[_0xb251('0x35')]:_0x1a03dd[_0xb251('0x30')];if(_0x34584b[_0xb251('0x34')][_0xb251('0x42')]){_0x40dbfd[_0xb251('0x43')]=[{'all':!![]}];}_0x40dbfd=_[_0xb251('0x3e')]({},_0x40dbfd,_0x34584b[_0xb251('0x41')]);return db[_0xb251('0x2c')]['find'](_0x40dbfd)[_0xb251('0x26')](handleEntityNotFound(_0x1e7ca5,null))[_0xb251('0x26')](respondWithResult(_0x1e7ca5,null))['catch'](handleError(_0x1e7ca5,null));};exports[_0xb251('0x48')]=function(_0x331254,_0x5466c0){return db[_0xb251('0x2c')][_0xb251('0x48')](_0x331254[_0xb251('0x49')],{})[_0xb251('0x26')](respondWithResult(_0x5466c0,0xc9))[_0xb251('0x4a')](handleError(_0x5466c0,null));};exports['update']=function(_0x124460,_0xcd90e5){if(_0x124460['body']['id']){delete _0x124460[_0xb251('0x49')]['id'];}return db[_0xb251('0x2c')][_0xb251('0x4b')]({'where':{'id':_0x124460[_0xb251('0x4c')]['id']}})[_0xb251('0x26')](handleEntityNotFound(_0xcd90e5,null))[_0xb251('0x26')](saveUpdates(_0x124460[_0xb251('0x49')],null))['then'](respondWithResult(_0xcd90e5,null))[_0xb251('0x4a')](handleError(_0xcd90e5,null));};exports[_0xb251('0x4d')]=function(_0x5ab1a2,_0x4736df){return db[_0xb251('0x2c')]['find']({'where':{'id':_0x5ab1a2['params']['id']}})['then'](handleEntityNotFound(_0x4736df,null))['then'](removeEntity(_0x4736df,null))[_0xb251('0x4a')](handleError(_0x4736df,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 0c203f6..f8578d2 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 _0x93a0=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','util'];(function(_0x4f42ef,_0x413cfe){var _0x120cf5=function(_0x44cfa8){while(--_0x44cfa8){_0x4f42ef['push'](_0x4f42ef['shift']());}};_0x120cf5(++_0x413cfe);}(_0x93a0,0xef));var _0x093a=function(_0x48c888,_0x56832d){_0x48c888=_0x48c888-0x0;var _0x2dd47c=_0x93a0[_0x48c888];return _0x2dd47c;};'use strict';var _=require('lodash');var util=require(_0x093a('0x0'));var logger=require(_0x093a('0x1'))('api');var moment=require(_0x093a('0x2'));var BPromise=require(_0x093a('0x3'));var rp=require(_0x093a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x093a('0x5'));var config=require(_0x093a('0x6'));var attributes=require(_0x093a('0x7'));module[_0x093a('0x8')]=function(_0x47e62f,_0x4f2a52){return _0x47e62f[_0x093a('0x9')](_0x093a('0xa'),attributes,{'tableName':_0x093a('0xb'),'paranoid':![],'indexes':[{'name':_0x093a('0xc'),'fields':[_0x093a('0xd'),_0x093a('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0669=['FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x0669,0x199));var _0x9066=function(_0x27332e,_0x247ad6){_0x27332e=_0x27332e-0x0;var _0x5882fc=_0x0669[_0x27332e];return _0x5882fc;};'use strict';var _=require(_0x9066('0x0'));var util=require(_0x9066('0x1'));var logger=require(_0x9066('0x2'))('api');var moment=require(_0x9066('0x3'));var BPromise=require(_0x9066('0x4'));var rp=require(_0x9066('0x5'));var fs=require('fs');var path=require(_0x9066('0x6'));var rimraf=require(_0x9066('0x7'));var config=require(_0x9066('0x8'));var attributes=require(_0x9066('0x9'));module[_0x9066('0xa')]=function(_0x64575e,_0x7d838e){return _0x64575e[_0x9066('0xb')](_0x9066('0xc'),attributes,{'tableName':_0x9066('0xd'),'paranoid':![],'indexes':[{'name':_0x9066('0xe'),'fields':[_0x9066('0xf'),_0x9066('0x10')],'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 1c7687d..b2fe830 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 _0x1bb7=['debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','client','http','info','DeskField,\x20%s,\x20%s','request\x20sent'];(function(_0x30780e,_0x4bb0a8){var _0x2253fa=function(_0x56728e){while(--_0x56728e){_0x30780e['push'](_0x30780e['shift']());}};_0x2253fa(++_0x4bb0a8);}(_0x1bb7,0x111));var _0x71bb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1bb7[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x71bb('0x0'));var moment=require(_0x71bb('0x1'));var BPromise=require(_0x71bb('0x2'));var rs=require(_0x71bb('0x3'));var fs=require('fs');var Redis=require(_0x71bb('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x71bb('0x5'));var config=require('../../config/environment');var jayson=require(_0x71bb('0x6'));var client=jayson[_0x71bb('0x7')][_0x71bb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2cbf1d,_0x56fcaa,_0x5c54bb){return new BPromise(function(_0x70842,_0x712269){return client['request'](_0x2cbf1d,_0x5c54bb)['then'](function(_0x5bf25c){logger[_0x71bb('0x9')](_0x71bb('0xa'),_0x56fcaa,_0x71bb('0xb'));logger[_0x71bb('0xc')](_0x71bb('0xd'),_0x56fcaa,_0x71bb('0xb'),JSON[_0x71bb('0xe')](_0x5bf25c));if(_0x5bf25c[_0x71bb('0xf')]){if(_0x5bf25c[_0x71bb('0xf')][_0x71bb('0x10')]===0x1f4){logger[_0x71bb('0xf')](_0x71bb('0xa'),_0x56fcaa,_0x5bf25c[_0x71bb('0xf')][_0x71bb('0x11')]);return _0x712269(_0x5bf25c['error'][_0x71bb('0x11')]);}logger[_0x71bb('0xf')](_0x71bb('0xa'),_0x56fcaa,_0x5bf25c[_0x71bb('0xf')][_0x71bb('0x11')]);return _0x70842(_0x5bf25c[_0x71bb('0xf')]['message']);}else{logger[_0x71bb('0x9')](_0x71bb('0xa'),_0x56fcaa,'request\x20sent');_0x70842(_0x5bf25c['result']['message']);}})[_0x71bb('0x12')](function(_0x52cf37){logger[_0x71bb('0xf')](_0x71bb('0xa'),_0x56fcaa,_0x52cf37);_0x712269(_0x52cf37);});});} \ No newline at end of file +var _0x9dfa=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x43bf4f,_0x450058){var _0x5e973e=function(_0x217f08){while(--_0x217f08){_0x43bf4f['push'](_0x43bf4f['shift']());}};_0x5e973e(++_0x450058);}(_0x9dfa,0x1e4));var _0xa9df=function(_0xf689cf,_0x53d01e){_0xf689cf=_0xf689cf-0x0;var _0x589710=_0x9dfa[_0xf689cf];return _0x589710;};'use strict';var _=require(_0xa9df('0x0'));var util=require('util');var moment=require(_0xa9df('0x1'));var BPromise=require(_0xa9df('0x2'));var rs=require(_0xa9df('0x3'));var fs=require('fs');var Redis=require(_0xa9df('0x4'));var db=require(_0xa9df('0x5'))['db'];var utils=require(_0xa9df('0x6'));var logger=require(_0xa9df('0x7'))(_0xa9df('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xa9df('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5af9ec,_0x12db48,_0x3a27bb){return new BPromise(function(_0xed28ba,_0x5cbdd0){return client[_0xa9df('0xa')](_0x5af9ec,_0x3a27bb)[_0xa9df('0xb')](function(_0x121da3){logger[_0xa9df('0xc')](_0xa9df('0xd'),_0x12db48,'request\x20sent');logger[_0xa9df('0xe')](_0xa9df('0xf'),_0x12db48,_0xa9df('0x10'),JSON[_0xa9df('0x11')](_0x121da3));if(_0x121da3[_0xa9df('0x12')]){if(_0x121da3['error'][_0xa9df('0x13')]===0x1f4){logger[_0xa9df('0x12')]('DeskField,\x20%s,\x20%s',_0x12db48,_0x121da3['error'][_0xa9df('0x14')]);return _0x5cbdd0(_0x121da3[_0xa9df('0x12')][_0xa9df('0x14')]);}logger[_0xa9df('0x12')](_0xa9df('0xd'),_0x12db48,_0x121da3['error'][_0xa9df('0x14')]);return _0xed28ba(_0x121da3[_0xa9df('0x12')][_0xa9df('0x14')]);}else{logger[_0xa9df('0xc')](_0xa9df('0xd'),_0x12db48,'request\x20sent');_0xed28ba(_0x121da3[_0xa9df('0x15')][_0xa9df('0x14')]);}})[_0xa9df('0x16')](function(_0x120c64){logger[_0xa9df('0x12')]('DeskField,\x20%s,\x20%s',_0x12db48,_0x120c64);_0x5cbdd0(_0x120c64);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 6531313..9559338 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 _0xfab0=['put','update','delete','destroy','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create'];(function(_0x1818f1,_0x384006){var _0x500f9b=function(_0x5afcef){while(--_0x5afcef){_0x1818f1['push'](_0x1818f1['shift']());}};_0x500f9b(++_0x384006);}(_0xfab0,0x154));var _0x0fab=function(_0x5e8b46,_0x21eb4a){_0x5e8b46=_0x5e8b46-0x0;var _0x252814=_0xfab0[_0x5e8b46];return _0x252814;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0fab('0x0'));var timeout=require('connect-timeout');var express=require(_0x0fab('0x1'));var router=express['Router']();var fs_extra=require(_0x0fab('0x2'));var auth=require(_0x0fab('0x3'));var interaction=require(_0x0fab('0x4'));var config=require(_0x0fab('0x5'));var controller=require(_0x0fab('0x6'));router[_0x0fab('0x7')]('/',auth[_0x0fab('0x8')](),controller['index']);router[_0x0fab('0x7')](_0x0fab('0x9'),auth[_0x0fab('0x8')](),controller[_0x0fab('0xa')]);router[_0x0fab('0x7')](_0x0fab('0xb'),auth[_0x0fab('0x8')](),controller[_0x0fab('0xc')]);router[_0x0fab('0x7')](_0x0fab('0xd'),auth[_0x0fab('0x8')](),controller[_0x0fab('0xe')]);router[_0x0fab('0xf')]('/',auth['isAuthenticated'](),controller[_0x0fab('0x10')]);router[_0x0fab('0xf')](_0x0fab('0xb'),auth[_0x0fab('0x8')](),controller['addConfiguration']);router[_0x0fab('0x11')](_0x0fab('0x9'),auth['isAuthenticated'](),controller[_0x0fab('0x12')]);router[_0x0fab('0x13')](_0x0fab('0x9'),auth['isAuthenticated'](),controller[_0x0fab('0x14')]);module['exports']=router; \ No newline at end of file +var _0x6d7c=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getFields','create','post','addConfiguration','update','delete','destroy'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x6d7c,0x12c));var _0xc6d7=function(_0x469a49,_0xfede47){_0x469a49=_0x469a49-0x0;var _0x29ff82=_0x6d7c[_0x469a49];return _0x29ff82;};'use strict';var multer=require(_0xc6d7('0x0'));var util=require('util');var path=require(_0xc6d7('0x1'));var timeout=require(_0xc6d7('0x2'));var express=require(_0xc6d7('0x3'));var router=express[_0xc6d7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc6d7('0x5'));var interaction=require(_0xc6d7('0x6'));var config=require(_0xc6d7('0x7'));var controller=require(_0xc6d7('0x8'));router[_0xc6d7('0x9')]('/',auth[_0xc6d7('0xa')](),controller[_0xc6d7('0xb')]);router[_0xc6d7('0x9')](_0xc6d7('0xc'),auth['isAuthenticated'](),controller[_0xc6d7('0xd')]);router['get'](_0xc6d7('0xe'),auth[_0xc6d7('0xa')](),controller['getConfigurations']);router[_0xc6d7('0x9')]('/:id/fields',auth[_0xc6d7('0xa')](),controller[_0xc6d7('0xf')]);router['post']('/',auth[_0xc6d7('0xa')](),controller[_0xc6d7('0x10')]);router[_0xc6d7('0x11')](_0xc6d7('0xe'),auth[_0xc6d7('0xa')](),controller[_0xc6d7('0x12')]);router['put'](_0xc6d7('0xc'),auth['isAuthenticated'](),controller[_0xc6d7('0x13')]);router[_0xc6d7('0x14')](_0xc6d7('0xc'),auth[_0xc6d7('0xa')](),controller[_0xc6d7('0x15')]);module[_0xc6d7('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 b00b958..318a5e9 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 _0xe953=['STRING'];(function(_0x558b71,_0x5d2684){var _0x100133=function(_0xac74da){while(--_0xac74da){_0x558b71['push'](_0x558b71['shift']());}};_0x100133(++_0x5d2684);}(_0xe953,0x1d0));var _0x3e95=function(_0x382a62,_0x1baa5e){_0x382a62=_0x382a62-0x0;var _0x490a25=_0xe953[_0x382a62];return _0x490a25;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x3e95('0x0')]},'tenantId':{'type':Sequelize[_0x3e95('0x0')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x3e95('0x0')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x3e95('0x0')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x9829=['sequelize','exports','STRING','BOOLEAN'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x9829,0xc4));var _0x9982=function(_0x425716,_0x3e9d1c){_0x425716=_0x425716-0x0;var _0x2d39af=_0x9829[_0x425716];return _0x2d39af;};'use strict';var Sequelize=require(_0x9982('0x0'));module[_0x9982('0x1')]={'name':{'type':Sequelize[_0x9982('0x2')]},'username':{'type':Sequelize[_0x9982('0x2')]},'password':{'type':Sequelize[_0x9982('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x9982('0x2')]},'clientId':{'type':Sequelize[_0x9982('0x2')]},'clientSecret':{'type':Sequelize[_0x9982('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x9982('0x2')]},'modernAuthentication':{'type':Sequelize[_0x9982('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 0008dad..43a42f7 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 _0x6b03=['filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','Dynamics365Account','findAll','rows','catch','show','params','find','create','body','findOne','getConfigurations','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','Dynamics365Field','Subjects','slice','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','title','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','billedserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','escalatedon','exchangerate','followupby','importsequencenumber','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','onholdtime','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','username','remoteUri','tenantId','clientId','modernAuthentication','CloudProvider','data5','data7','POST','/oauth2/token','password','clientSecret','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','includes','LogicalName','@odata.type','substring','PicklistAttributeMetadata','push','all','forEach','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','statusCode','send','test','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','UserLocalizedLabel','true','FalseOption','?$select=DisplayName,LogicalName','lodash','../../components/parsers/qs','../../config/logger','../../components/integrations/configuration','json','offset','limit','undefined','count','status','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','index','rawAttributes','fieldName','type','model','map','query','keys'];(function(_0x1de791,_0x263276){var _0x1de3a7=function(_0x43745e){while(--_0x43745e){_0x1de791['push'](_0x1de791['shift']());}};_0x1de3a7(++_0x263276);}(_0x6b03,0xa5));var _0x36b0=function(_0x36e857,_0x382e3f){_0x36e857=_0x36e857-0x0;var _0x1297dd=_0x6b03[_0x36e857];return _0x1297dd;};'use strict';var rp=require('request-promise');var util=require('util');var _=require(_0x36b0('0x0'));var qs=require(_0x36b0('0x1'));var logger=require(_0x36b0('0x2'))('api');var db=require('../../mysqldb')['db'];var integrations=require(_0x36b0('0x3'));function respondWithResult(_0x4de3fe,_0x5428d8){_0x5428d8=_0x5428d8||0xc8;return function(_0x550581){if(_0x550581){return _0x4de3fe['status'](_0x5428d8)[_0x36b0('0x4')](_0x550581);}};}function respondWithFilteredResult(_0x1236f6,_0x57dc05){return function(_0x2b8266){if(_0x2b8266){var _0x216aec=typeof _0x57dc05[_0x36b0('0x5')]==='undefined'&&typeof _0x57dc05[_0x36b0('0x6')]===_0x36b0('0x7');var _0x3f88db=_0x2b8266[_0x36b0('0x8')];var _0x2e1ed7=_0x216aec?0x0:_0x57dc05[_0x36b0('0x5')];var _0x260310=_0x216aec?_0x2b8266[_0x36b0('0x8')]:_0x57dc05[_0x36b0('0x5')]+_0x57dc05[_0x36b0('0x6')];var _0x452795;if(_0x260310>=_0x3f88db){_0x260310=_0x3f88db;_0x452795=0xc8;}else{_0x452795=0xce;}_0x1236f6[_0x36b0('0x9')](_0x452795);return _0x1236f6[_0x36b0('0xa')](_0x36b0('0xb'),_0x2e1ed7+'-'+_0x260310+'/'+_0x3f88db)[_0x36b0('0x4')](_0x2b8266);}return null;};}function saveUpdates(_0x34b000){return function(_0x26c69e){if(_0x26c69e){return _0x26c69e[_0x36b0('0xc')](_0x34b000)[_0x36b0('0xd')](function(_0x206fec){return _0x206fec;});}return null;};}function removeEntity(_0x288b09){return function(_0x366616){if(_0x366616){return _0x366616[_0x36b0('0xe')]()['then'](function(){_0x288b09['status'](0xcc)[_0x36b0('0xf')]();});}};}function handleEntityNotFound(_0x473f6b){return function(_0x59fe0f){if(!_0x59fe0f){_0x473f6b[_0x36b0('0x10')](0x194);}return _0x59fe0f;};}function handleError(_0x33aa23,_0x20a117){_0x20a117=_0x20a117||0x1f4;return function(_0x3f9e0b){logger[_0x36b0('0x11')](_0x3f9e0b[_0x36b0('0x12')]);if(_0x3f9e0b[_0x36b0('0x13')]){delete _0x3f9e0b[_0x36b0('0x13')];}_0x33aa23[_0x36b0('0x9')](_0x20a117)['send'](_0x3f9e0b);};}exports[_0x36b0('0x14')]=function(_0x33a343,_0x29bac5){var _0x169db5={},_0x3b0c05={},_0x3db662={'count':0x0,'rows':[]};var _0x4a3594=_['map'](db['Dynamics365Account'][_0x36b0('0x15')],function(_0x225a0b){return{'name':_0x225a0b[_0x36b0('0x16')],'type':_0x225a0b[_0x36b0('0x17')]['key']};});_0x3b0c05[_0x36b0('0x18')]=_[_0x36b0('0x19')](_0x4a3594,_0x36b0('0x13'));_0x3b0c05[_0x36b0('0x1a')]=_[_0x36b0('0x1b')](_0x33a343['query']);_0x3b0c05[_0x36b0('0x1c')]=_['intersection'](_0x3b0c05[_0x36b0('0x18')],_0x3b0c05[_0x36b0('0x1a')]);_0x169db5['attributes']=_[_0x36b0('0x1d')](_0x3b0c05[_0x36b0('0x18')],qs[_0x36b0('0x1e')](_0x33a343['query'][_0x36b0('0x1e')]));_0x169db5[_0x36b0('0x1f')]=_0x169db5['attributes'][_0x36b0('0x20')]?_0x169db5[_0x36b0('0x1f')]:_0x3b0c05[_0x36b0('0x18')];if(!_0x33a343[_0x36b0('0x1a')][_0x36b0('0x21')](_0x36b0('0x22'))){_0x169db5[_0x36b0('0x6')]=qs[_0x36b0('0x6')](_0x33a343[_0x36b0('0x1a')][_0x36b0('0x6')]);_0x169db5[_0x36b0('0x5')]=qs['offset'](_0x33a343[_0x36b0('0x1a')][_0x36b0('0x5')]);}_0x169db5[_0x36b0('0x23')]=qs[_0x36b0('0x24')](_0x33a343[_0x36b0('0x1a')]['sort']);_0x169db5[_0x36b0('0x25')]=qs[_0x36b0('0x1c')](_[_0x36b0('0x26')](_0x33a343[_0x36b0('0x1a')],_0x3b0c05[_0x36b0('0x1c')]),_0x4a3594);if(_0x33a343['query'][_0x36b0('0x27')]){_0x169db5[_0x36b0('0x25')]=_[_0x36b0('0x28')](_0x169db5['where'],{'$or':_[_0x36b0('0x19')](_0x4a3594,function(_0x298b8b){if(_0x298b8b[_0x36b0('0x17')]!=='VIRTUAL'){var _0x440cc1={};_0x440cc1[_0x298b8b['name']]={'$like':'%'+_0x33a343[_0x36b0('0x1a')][_0x36b0('0x27')]+'%'};return _0x440cc1;}})});}_0x169db5=_[_0x36b0('0x28')]({},_0x169db5,_0x33a343[_0x36b0('0x29')]);var _0x2f2015={'where':_0x169db5[_0x36b0('0x25')]};return db['Dynamics365Account'][_0x36b0('0x8')](_0x2f2015)[_0x36b0('0xd')](function(_0x36fdfc){_0x3db662[_0x36b0('0x8')]=_0x36fdfc;if(_0x33a343[_0x36b0('0x1a')][_0x36b0('0x2a')]){_0x169db5[_0x36b0('0x2b')]=[{'all':!![]}];}return db[_0x36b0('0x2c')][_0x36b0('0x2d')](_0x169db5);})[_0x36b0('0xd')](function(_0x414b7d){_0x3db662[_0x36b0('0x2e')]=_0x414b7d;return _0x3db662;})['then'](respondWithFilteredResult(_0x29bac5,_0x169db5))[_0x36b0('0x2f')](handleError(_0x29bac5,null));};exports[_0x36b0('0x30')]=function(_0x5ace46,_0x13e581){var _0x14bbb2={'raw':![],'where':{'id':_0x5ace46[_0x36b0('0x31')]['id']}},_0x306625={};_0x306625[_0x36b0('0x18')]=_[_0x36b0('0x1b')](db[_0x36b0('0x2c')][_0x36b0('0x15')]);_0x306625['query']=_['keys'](_0x5ace46[_0x36b0('0x1a')]);_0x306625[_0x36b0('0x1c')]=_[_0x36b0('0x1d')](_0x306625[_0x36b0('0x18')],_0x306625[_0x36b0('0x1a')]);_0x14bbb2[_0x36b0('0x1f')]=_[_0x36b0('0x1d')](_0x306625[_0x36b0('0x18')],qs[_0x36b0('0x1e')](_0x5ace46[_0x36b0('0x1a')]['fields']));_0x14bbb2[_0x36b0('0x1f')]=_0x14bbb2[_0x36b0('0x1f')][_0x36b0('0x20')]?_0x14bbb2[_0x36b0('0x1f')]:_0x306625[_0x36b0('0x18')];if(_0x5ace46[_0x36b0('0x1a')][_0x36b0('0x2a')]){_0x14bbb2[_0x36b0('0x2b')]=[{'all':!![]}];}_0x14bbb2=_[_0x36b0('0x28')]({},_0x14bbb2,_0x5ace46[_0x36b0('0x29')]);return db['Dynamics365Account'][_0x36b0('0x32')](_0x14bbb2)[_0x36b0('0xd')](handleEntityNotFound(_0x13e581,null))[_0x36b0('0xd')](respondWithResult(_0x13e581,null))['catch'](handleError(_0x13e581,null));};exports[_0x36b0('0x33')]=function(_0x1d49e3,_0x360600){return db[_0x36b0('0x2c')]['create'](_0x1d49e3['body'],{})[_0x36b0('0xd')](respondWithResult(_0x360600,0xc9))[_0x36b0('0x2f')](handleError(_0x360600,null));};exports[_0x36b0('0xc')]=function(_0x317da4,_0x245f8e){if(_0x317da4[_0x36b0('0x34')]['id']){delete _0x317da4[_0x36b0('0x34')]['id'];}return db[_0x36b0('0x2c')][_0x36b0('0x32')]({'where':{'id':_0x317da4[_0x36b0('0x31')]['id']}})[_0x36b0('0xd')](handleEntityNotFound(_0x245f8e,null))[_0x36b0('0xd')](saveUpdates(_0x317da4[_0x36b0('0x34')],null))[_0x36b0('0xd')](respondWithResult(_0x245f8e,null))[_0x36b0('0x2f')](handleError(_0x245f8e,null));};exports[_0x36b0('0xe')]=function(_0xe1700d,_0x20d314){return db[_0x36b0('0x2c')]['find']({'where':{'id':_0xe1700d[_0x36b0('0x31')]['id']}})[_0x36b0('0xd')](handleEntityNotFound(_0x20d314,null))['then'](removeEntity(_0x20d314,null))[_0x36b0('0x2f')](handleError(_0x20d314,null));};exports['getConfigurations']=function(_0x461beb,_0x58135a){var _0x2244bf={};var _0x5f18a4={};var _0x250db8;var _0x55ffac;return db['Dynamics365Account'][_0x36b0('0x35')]({'where':{'id':_0x461beb['params']['id']}})[_0x36b0('0xd')](handleEntityNotFound(_0x58135a,null))['then'](function(_0x1c55db){if(_0x1c55db){_0x250db8=_0x1c55db;_0x5f18a4[_0x36b0('0x18')]=_[_0x36b0('0x1b')](db['Dynamics365Configuration'][_0x36b0('0x15')]);_0x5f18a4[_0x36b0('0x1a')]=_[_0x36b0('0x1b')](_0x461beb[_0x36b0('0x1a')]);_0x5f18a4[_0x36b0('0x1c')]=_[_0x36b0('0x1d')](_0x5f18a4[_0x36b0('0x18')],_0x5f18a4[_0x36b0('0x1a')]);_0x2244bf[_0x36b0('0x1f')]=_['intersection'](_0x5f18a4['model'],qs[_0x36b0('0x1e')](_0x461beb[_0x36b0('0x1a')][_0x36b0('0x1e')]));_0x2244bf[_0x36b0('0x1f')]=_0x2244bf[_0x36b0('0x1f')][_0x36b0('0x20')]?_0x2244bf[_0x36b0('0x1f')]:_0x5f18a4['model'];_0x2244bf[_0x36b0('0x23')]=qs['sort'](_0x461beb['query']['sort']);_0x2244bf['where']=qs['filters'](_['pick'](_0x461beb['query'],_0x5f18a4[_0x36b0('0x1c')]));if(_0x461beb[_0x36b0('0x1a')][_0x36b0('0x27')]){_0x2244bf['where']=_[_0x36b0('0x28')](_0x2244bf[_0x36b0('0x25')],{'$or':_['map'](_0x2244bf[_0x36b0('0x1f')],function(_0x262866){var _0x1b253b={};_0x1b253b[_0x262866]={'$like':'%'+_0x461beb['query'][_0x36b0('0x27')]+'%'};return _0x1b253b;})});}_0x2244bf=_[_0x36b0('0x28')]({},_0x2244bf,_0x461beb[_0x36b0('0x29')]);return _0x250db8[_0x36b0('0x36')](_0x2244bf);}})[_0x36b0('0xd')](function(_0x3d6ec9){if(_0x3d6ec9){_0x55ffac=_0x3d6ec9[_0x36b0('0x20')];if(!_0x461beb[_0x36b0('0x1a')][_0x36b0('0x21')]('nolimit')){_0x2244bf[_0x36b0('0x6')]=qs[_0x36b0('0x6')](_0x461beb[_0x36b0('0x1a')][_0x36b0('0x6')]);_0x2244bf[_0x36b0('0x5')]=qs[_0x36b0('0x5')](_0x461beb['query'][_0x36b0('0x5')]);}return _0x250db8[_0x36b0('0x36')](_0x2244bf);}})[_0x36b0('0xd')](function(_0x1a7192){if(_0x1a7192){return _0x1a7192?{'count':_0x55ffac,'rows':_0x1a7192}:null;}})[_0x36b0('0xd')](respondWithResult(_0x58135a,null))['catch'](handleError(_0x58135a,null));};exports[_0x36b0('0x37')]=function(_0x1f5ae8,_0x47523a){if(_0x1f5ae8[_0x36b0('0x34')]['id']){delete _0x1f5ae8[_0x36b0('0x34')]['id'];}return db[_0x36b0('0x2c')][_0x36b0('0x35')]({'where':{'id':_0x1f5ae8[_0x36b0('0x31')]['id']}})[_0x36b0('0xd')](handleEntityNotFound(_0x47523a,null))[_0x36b0('0xd')](function(_0x4a5228){if(_0x4a5228){_0x1f5ae8[_0x36b0('0x34')][_0x36b0('0x38')]=_0x4a5228['id'];_0x1f5ae8['body']['Subjects']=integrations[_0x36b0('0x39')](_0x1f5ae8[_0x36b0('0x34')]['channel'],_0x1f5ae8[_0x36b0('0x34')]['type']);_0x1f5ae8[_0x36b0('0x34')][_0x36b0('0x3a')]=integrations[_0x36b0('0x3b')](_0x1f5ae8[_0x36b0('0x34')][_0x36b0('0x3c')],_0x1f5ae8[_0x36b0('0x34')][_0x36b0('0x17')]);return db['Dynamics365Configuration']['create'](_0x1f5ae8[_0x36b0('0x34')],{'include':[{'model':db[_0x36b0('0x3d')],'as':_0x36b0('0x3e')},{'model':db[_0x36b0('0x3d')],'as':_0x36b0('0x3a')}]});}return null;})[_0x36b0('0xd')](respondWithResult(_0x47523a,null))[_0x36b0('0x2f')](handleError(_0x47523a,null));};function sanitizeRemoteUri(_0x2b9c9f){var _0x4e7da2=_0x2b9c9f[_0x36b0('0x3f')](-0x1);if(_0x4e7da2==='/')return _0x2b9c9f['substring'](0x0,_0x2b9c9f[_0x36b0('0x40')](_0x4e7da2));return _0x2b9c9f;}function getWebApiUrl(_0x57b4dc){return util[_0x36b0('0x41')](_0x36b0('0x42'),_0x57b4dc);}exports[_0x36b0('0x43')]=function(_0x16adbc,_0x16eb5d){var _0x43d093=_0x16adbc['query'][_0x36b0('0x44')];var _0x154153=_0x43d093===_0x36b0('0x45')?_0x36b0('0x46'):_0x36b0('0x47');var _0x372285='';var _0xd4574a='';var _0x33d9e7='';var _0x32a961='';var _0x4e1bff='';var _0x36b768='';var _0x335b92='';var _0x5eadef='';var _0x4431f6=[_0x36b0('0x48'),'description',_0x36b0('0x49'),_0x36b0('0x4a'),_0x36b0('0x4b'),'subject',_0x36b0('0x4c'),_0x36b0('0x4d'),_0x36b0('0x4e'),_0x36b0('0x4f')];var _0x54490f=[_0x36b0('0x50'),_0x36b0('0x51'),'actualserviceunits',_0x36b0('0x52'),_0x36b0('0x53'),_0x36b0('0x54'),_0x36b0('0x55'),'contractidname',_0x36b0('0x56'),_0x36b0('0x57'),_0x36b0('0x58'),'createdbyyominame',_0x36b0('0x59'),_0x36b0('0x5a'),_0x36b0('0x5b'),_0x36b0('0x5c'),_0x36b0('0x5d'),_0x36b0('0x5e'),_0x36b0('0x5f'),_0x36b0('0x60'),'entityimage_timestamp','entityimage_url',_0x36b0('0x61'),_0x36b0('0x62'),'firstresponsebykpiidname',_0x36b0('0x63'),_0x36b0('0x64'),'influencescore','kbarticleidname',_0x36b0('0x65'),_0x36b0('0x66'),_0x36b0('0x67'),_0x36b0('0x68'),_0x36b0('0x69'),_0x36b0('0x6a'),_0x36b0('0x6b'),_0x36b0('0x6c'),_0x36b0('0x6d'),_0x36b0('0x6e'),'msdyn_iotalertname','numberofchildincidents',_0x36b0('0x6f'),'overriddencreatedon',_0x36b0('0x70'),_0x36b0('0x71'),_0x36b0('0x72'),_0x36b0('0x73'),_0x36b0('0x74'),_0x36b0('0x75'),'prioritycodename',_0x36b0('0x76'),_0x36b0('0x77'),_0x36b0('0x78'),_0x36b0('0x79'),_0x36b0('0x7a'),_0x36b0('0x7b'),_0x36b0('0x7c'),'sentimentvalue',_0x36b0('0x7d'),_0x36b0('0x7e'),_0x36b0('0x7f'),_0x36b0('0x80'),_0x36b0('0x81'),_0x36b0('0x82'),'ticketnumber',_0x36b0('0x83'),_0x36b0('0x84'),_0x36b0('0x85'),_0x36b0('0x86'),'versionnumber'];var _0x4cd839=_0x4431f6['concat'](_0x54490f);return db['Dynamics365Account'][_0x36b0('0x35')]({'where':{'id':_0x16adbc[_0x36b0('0x31')]['id']},'attributes':['id',_0x36b0('0x87'),'password',_0x36b0('0x88'),_0x36b0('0x89'),_0x36b0('0x8a'),'clientSecret',_0x36b0('0x8b')],'include':[{'model':db[_0x36b0('0x8c')],'as':_0x36b0('0x8c'),'attributes':['id',_0x36b0('0x8d'),'data7']}]})[_0x36b0('0xd')](handleEntityNotFound(_0x16eb5d,null))[_0x36b0('0xd')](function(_0x26b7c1){if(_0x26b7c1){if(_0x26b7c1['modernAuthentication']){_0x26b7c1['access_token']=_0x26b7c1[_0x36b0('0x8c')][_0x36b0('0x8d')];_0x5eadef=sanitizeRemoteUri(_0x26b7c1[_0x36b0('0x8c')][_0x36b0('0x8e')]);_0x335b92=getWebApiUrl(_0x5eadef);return _0x26b7c1;}_0x5eadef=sanitizeRemoteUri(_0x26b7c1['remoteUri']);_0x335b92=getWebApiUrl(_0x5eadef);var _0x569ce8={'method':_0x36b0('0x8f'),'uri':'https://login.microsoftonline.com/'+_0x26b7c1[_0x36b0('0x89')]+_0x36b0('0x90'),'form':{'client_id':_0x26b7c1[_0x36b0('0x8a')],'resource':_0x5eadef,'username':_0x26b7c1[_0x36b0('0x87')],'password':_0x26b7c1[_0x36b0('0x91')],'grant_type':_0x36b0('0x91'),'client_secret':_0x26b7c1[_0x36b0('0x92')]},'json':!![]};return rp(_0x569ce8);}})[_0x36b0('0xd')](function(_0x133ed6){_0x36b768=_0x133ed6[_0x36b0('0x93')];var _0x56fe2d={'method':_0x36b0('0x94'),'uri':encodeURI(_0x335b92+_0x36b0('0x95')+_0x154153+'\x27'),'headers':{'Authorization':_0x36b0('0x96')+_0x36b768,'If-None-Match':null,'OData-Version':_0x36b0('0x97')},'json':!![]};return rp(_0x56fe2d);})['then'](function(_0x1097dd){var _0x45e42f=_0x1097dd['value'][0x0];var _0x464e33=_0x45e42f[_0x36b0('0x98')];var _0x1cf04b={'method':'GET','uri':_0x335b92+_0x36b0('0x99')+_0x464e33+_0x36b0('0x9a'),'headers':{'Authorization':_0x36b0('0x96')+_0x36b768,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1cf04b);})[_0x36b0('0xd')](function(_0x56095f){_0x372285=_0x56095f;_0xd4574a=_0x372285['Attributes'];_0xd4574a=_[_0x36b0('0x9b')](_0xd4574a,function(_0x44ad3e){return!_0x4cd839[_0x36b0('0x9c')](_0x44ad3e[_0x36b0('0x9d')]);});var _0x1b1a49=[];var _0x454028=[];_0xd4574a['forEach'](function(_0x1be409){if(_0x1be409[_0x36b0('0x9e')]){var _0x25638d=_0x1be409[_0x36b0('0x9e')][_0x36b0('0x9f')](_0x1be409[_0x36b0('0x9e')]['lastIndexOf']('.')+0x1);if(_0x25638d===_0x36b0('0xa0')){_0x1b1a49[_0x36b0('0xa1')](getSelectList(_0x335b92,_0x43d093,_0x454028,_0x372285['MetadataId'],_0x1be409['MetadataId'],_0x36b768));}}});return Promise[_0x36b0('0xa2')](_0x1b1a49);})[_0x36b0('0xd')](function(_0x39f12f){_0x33d9e7=_0x39f12f[0x0];var _0x4c3e90=[];var _0x32cc20=[];_0xd4574a[_0x36b0('0xa3')](function(_0x379350){if(!_[_0x36b0('0xa4')](_0x379350['@odata.type'])){var _0x54ae36=_0x379350[_0x36b0('0x9e')][_0x36b0('0x9f')](_0x379350[_0x36b0('0x9e')][_0x36b0('0x40')]('.')+0x1);if(_0x54ae36===_0x36b0('0xa5')){_0x4c3e90[_0x36b0('0xa1')](getBooleanList(_0x335b92,_0x43d093,_0x32cc20,_0x372285[_0x36b0('0x98')],_0x379350[_0x36b0('0x98')],_0x36b768));}}});return Promise[_0x36b0('0xa2')](_0x4c3e90);})[_0x36b0('0xd')](function(_0x4245ec){_0x32a961=_0x4245ec[0x0];var _0x4b6215=[];var _0x4ff76e=[];_0xd4574a[_0x36b0('0xa3')](function(_0x5a5b95){if(_0x5a5b95['@odata.type']){var _0x1d80ce=_0x5a5b95['@odata.type']['substring'](_0x5a5b95[_0x36b0('0x9e')][_0x36b0('0x40')]('.')+0x1);if(_0x1d80ce===_0x36b0('0xa6')||_0x1d80ce===_0x36b0('0xa7')||_0x1d80ce===_0x36b0('0xa8')||_0x1d80ce===_0x36b0('0xa9')||_0x1d80ce===_0x36b0('0xaa')||_0x1d80ce===_0x36b0('0xab')||_0x1d80ce===_0x36b0('0xac')||_0x1d80ce===_0x36b0('0xad')||_0x1d80ce===_0x36b0('0xae')||_0x1d80ce===_0x36b0('0xaf')){_0x4b6215[_0x36b0('0xa1')](getInputList(_0x335b92,_0x43d093,_0x1d80ce,_0x4ff76e,_0x372285[_0x36b0('0x98')],_0x5a5b95[_0x36b0('0x98')],_0x36b768));}}});return Promise[_0x36b0('0xa2')](_0x4b6215);})['then'](function(_0x40fe84){_0x4e1bff=_0x40fe84[0x0];var _0x1ef89b=_0x33d9e7[_0x36b0('0xb0')](_0x32a961)[_0x36b0('0xb0')](_0x4e1bff);var _0x302a72={'count':_0x1ef89b[_0x36b0('0x20')],'rows':_0x1ef89b};return _0x302a72;})['then'](respondWithResult(_0x16eb5d,null))[_0x36b0('0x2f')](function(_0xbd29e){var _0xc9afb8=_0x16adbc[_0x36b0('0x1a')]['test']?0x1f4:_0xbd29e[_0x36b0('0xb1')]||0x1f4;logger[_0x36b0('0x11')](_0xbd29e['stack']);delete _0xbd29e[_0x36b0('0x13')];if(_0xc9afb8===0x191){_0xc9afb8=0x190;}_0x16eb5d[_0x36b0('0x9')](_0xc9afb8)[_0x36b0('0xb2')](_0x16adbc[_0x36b0('0x1a')][_0x36b0('0xb3')]?{'message':_0x36b0('0xb4'),'statusCode':_0xbd29e[_0x36b0('0xb1')]}:_0xbd29e);});};function getSelectList(_0x3127bf,_0x2c203a,_0x3da56f,_0x20e797,_0x255046,_0x57aa22){var _0x2b3a10={'method':_0x36b0('0x94'),'uri':_0x3127bf+_0x36b0('0x99')+_0x20e797+_0x36b0('0xb5')+_0x255046+_0x36b0('0xb6')+_0x36b0('0xb7'),'headers':{'Authorization':'Bearer\x20'+_0x57aa22,'If-None-Match':null,'OData-Version':_0x36b0('0x97')},'json':!![]};return rp(_0x2b3a10)[_0x36b0('0xd')](function(_0x43ea5c){var _0x50b692=[];var _0x573cdf=_0x43ea5c[_0x36b0('0xb8')]['Options'];_0x573cdf[_0x36b0('0xa3')](function(_0x582287){_0x50b692['push']({'name':_0x582287['Label']['UserLocalizedLabel'][_0x36b0('0xb9')],'value':String(_0x582287['Value'])});});var _0x334dc7={'id':_0x2c203a+'_'+_0x43ea5c[_0x36b0('0x9d')],'name':_0x43ea5c[_0x36b0('0xba')]['UserLocalizedLabel'][_0x36b0('0xb9')],'custom':![],'options':_0x50b692};_0x3da56f[_0x36b0('0xa1')](_0x334dc7);return _0x3da56f;});}function getBooleanList(_0x4fef37,_0x202dc9,_0x1902ac,_0x23d5a2,_0x33c114,_0x57d7b9){var _0x1b831c={'method':_0x36b0('0x94'),'uri':_0x4fef37+_0x36b0('0x99')+_0x23d5a2+')/Attributes('+_0x33c114+_0x36b0('0xbb'),'headers':{'Authorization':_0x36b0('0x96')+_0x57d7b9,'If-None-Match':null,'OData-Version':_0x36b0('0x97')},'json':!![]};return rp(_0x1b831c)['then'](function(_0x2d4ecf){var _0x37f50d=[];_0x37f50d['push']({'name':_0x2d4ecf[_0x36b0('0xb8')][_0x36b0('0xbc')][_0x36b0('0xb9')][_0x36b0('0xbd')]['Label'],'value':_0x36b0('0xbe')},{'name':_0x2d4ecf[_0x36b0('0xb8')][_0x36b0('0xbf')][_0x36b0('0xb9')][_0x36b0('0xbd')][_0x36b0('0xb9')],'value':'false'});var _0x4afbd7={'id':_0x202dc9+'_'+_0x2d4ecf['LogicalName'],'name':_0x2d4ecf['DisplayName'][_0x36b0('0xbd')][_0x36b0('0xb9')],'custom':![],'options':_0x37f50d};_0x1902ac['push'](_0x4afbd7);return _0x1902ac;});}function getInputList(_0x42317,_0x31e1f7,_0x282193,_0x2ecd5f,_0x5c04d9,_0x176cfa,_0x1d83eb){var _0x15d7c0={'method':'GET','uri':_0x42317+'EntityDefinitions('+_0x5c04d9+_0x36b0('0xb5')+_0x176cfa+')/Microsoft.Dynamics.CRM.'+_0x282193+_0x36b0('0xc0'),'headers':{'Authorization':'Bearer\x20'+_0x1d83eb,'If-None-Match':null,'OData-Version':_0x36b0('0x97')},'json':!![]};return rp(_0x15d7c0)[_0x36b0('0xd')](function(_0x3f6ee0){var _0xf6c575={'id':_0x31e1f7+'_'+_0x3f6ee0[_0x36b0('0x9d')],'name':_0x3f6ee0[_0x36b0('0xba')][_0x36b0('0xbd')]?_0x3f6ee0['DisplayName'][_0x36b0('0xbd')]['Label']:_0x3f6ee0['LogicalName'],'custom':![],'options':[]};_0x2ecd5f[_0x36b0('0xa1')](_0xf6c575);return _0x2ecd5f;});} \ No newline at end of file +var _0x992a=['api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','update','then','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','Dynamics365Account','include','catch','show','params','includeAll','find','create','body','Dynamics365Configuration','nolimit','addConfiguration','findOne','getSubjects','channel','getDescriptions','Dynamics365Field','Subjects','Descriptions','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','Incident','PhoneCall','title','description','customerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','accountidname','accountidyominame','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyname','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','versionnumber','concat','password','remoteUri','tenantId','clientId','CloudProvider','data5','data7','access_token','POST','https://login.microsoftonline.com/','/oauth2/token','username','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','includes','@odata.type','PicklistAttributeMetadata','push','all','forEach','isNil','BooleanAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','error','Wrong\x20credentials','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','true','FalseOption','false','LogicalName','?$select=DisplayName,LogicalName','request-promise','util','lodash'];(function(_0x58c53f,_0x39dbf8){var _0x355c2a=function(_0x210c14){while(--_0x210c14){_0x58c53f['push'](_0x58c53f['shift']());}};_0x355c2a(++_0x39dbf8);}(_0x992a,0xbc));var _0xa992=function(_0x1d7037,_0x57dd95){_0x1d7037=_0x1d7037-0x0;var _0x4d6568=_0x992a[_0x1d7037];return _0x4d6568;};'use strict';var rp=require(_0xa992('0x0'));var util=require(_0xa992('0x1'));var _=require(_0xa992('0x2'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xa992('0x3'));var db=require(_0xa992('0x4'))['db'];var integrations=require(_0xa992('0x5'));function respondWithResult(_0x2d142d,_0x59f644){_0x59f644=_0x59f644||0xc8;return function(_0x48cbdb){if(_0x48cbdb){return _0x2d142d[_0xa992('0x6')](_0x59f644)[_0xa992('0x7')](_0x48cbdb);}};}function respondWithFilteredResult(_0x53f19b,_0x3b6422){return function(_0x28d7ff){if(_0x28d7ff){var _0x1ed9d0=typeof _0x3b6422[_0xa992('0x8')]===_0xa992('0x9')&&typeof _0x3b6422[_0xa992('0xa')]===_0xa992('0x9');var _0x482b77=_0x28d7ff[_0xa992('0xb')];var _0x52f440=_0x1ed9d0?0x0:_0x3b6422[_0xa992('0x8')];var _0x3eae25=_0x1ed9d0?_0x28d7ff['count']:_0x3b6422[_0xa992('0x8')]+_0x3b6422[_0xa992('0xa')];var _0x4c7d0a;if(_0x3eae25>=_0x482b77){_0x3eae25=_0x482b77;_0x4c7d0a=0xc8;}else{_0x4c7d0a=0xce;}_0x53f19b[_0xa992('0x6')](_0x4c7d0a);return _0x53f19b[_0xa992('0xc')](_0xa992('0xd'),_0x52f440+'-'+_0x3eae25+'/'+_0x482b77)[_0xa992('0x7')](_0x28d7ff);}return null;};}function saveUpdates(_0xf58d14){return function(_0xfba7bd){if(_0xfba7bd){return _0xfba7bd[_0xa992('0xe')](_0xf58d14)[_0xa992('0xf')](function(_0x154098){return _0x154098;});}return null;};}function removeEntity(_0x16a965){return function(_0x288302){if(_0x288302){return _0x288302['destroy']()[_0xa992('0xf')](function(){_0x16a965[_0xa992('0x6')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5be347){return function(_0x1c0b13){if(!_0x1c0b13){_0x5be347[_0xa992('0x10')](0x194);}return _0x1c0b13;};}function handleError(_0x236427,_0x3119d0){_0x3119d0=_0x3119d0||0x1f4;return function(_0x469227){logger['error'](_0x469227[_0xa992('0x11')]);if(_0x469227['name']){delete _0x469227[_0xa992('0x12')];}_0x236427[_0xa992('0x6')](_0x3119d0)[_0xa992('0x13')](_0x469227);};}exports[_0xa992('0x14')]=function(_0x2de3d2,_0x2f239e){var _0x41fa22={},_0x35e5ad={},_0xca0d60={'count':0x0,'rows':[]};var _0x508ca5=_[_0xa992('0x15')](db['Dynamics365Account'][_0xa992('0x16')],function(_0x3495e1){return{'name':_0x3495e1[_0xa992('0x17')],'type':_0x3495e1['type'][_0xa992('0x18')]};});_0x35e5ad[_0xa992('0x19')]=_[_0xa992('0x15')](_0x508ca5,_0xa992('0x12'));_0x35e5ad[_0xa992('0x1a')]=_[_0xa992('0x1b')](_0x2de3d2[_0xa992('0x1a')]);_0x35e5ad[_0xa992('0x1c')]=_[_0xa992('0x1d')](_0x35e5ad['model'],_0x35e5ad[_0xa992('0x1a')]);_0x41fa22['attributes']=_[_0xa992('0x1d')](_0x35e5ad[_0xa992('0x19')],qs[_0xa992('0x1e')](_0x2de3d2[_0xa992('0x1a')][_0xa992('0x1e')]));_0x41fa22[_0xa992('0x1f')]=_0x41fa22[_0xa992('0x1f')][_0xa992('0x20')]?_0x41fa22['attributes']:_0x35e5ad[_0xa992('0x19')];if(!_0x2de3d2[_0xa992('0x1a')][_0xa992('0x21')]('nolimit')){_0x41fa22[_0xa992('0xa')]=qs[_0xa992('0xa')](_0x2de3d2[_0xa992('0x1a')]['limit']);_0x41fa22[_0xa992('0x8')]=qs[_0xa992('0x8')](_0x2de3d2[_0xa992('0x1a')][_0xa992('0x8')]);}_0x41fa22[_0xa992('0x22')]=qs['sort'](_0x2de3d2[_0xa992('0x1a')][_0xa992('0x23')]);_0x41fa22[_0xa992('0x24')]=qs[_0xa992('0x1c')](_[_0xa992('0x25')](_0x2de3d2['query'],_0x35e5ad[_0xa992('0x1c')]),_0x508ca5);if(_0x2de3d2[_0xa992('0x1a')][_0xa992('0x26')]){_0x41fa22[_0xa992('0x24')]=_[_0xa992('0x27')](_0x41fa22[_0xa992('0x24')],{'$or':_[_0xa992('0x15')](_0x508ca5,function(_0x22f81d){if(_0x22f81d[_0xa992('0x28')]!==_0xa992('0x29')){var _0x52f378={};_0x52f378[_0x22f81d[_0xa992('0x12')]]={'$like':'%'+_0x2de3d2[_0xa992('0x1a')]['filter']+'%'};return _0x52f378;}})});}_0x41fa22=_['merge']({},_0x41fa22,_0x2de3d2[_0xa992('0x2a')]);var _0x11ce0b={'where':_0x41fa22[_0xa992('0x24')]};return db[_0xa992('0x2b')][_0xa992('0xb')](_0x11ce0b)['then'](function(_0x24b004){_0xca0d60[_0xa992('0xb')]=_0x24b004;if(_0x2de3d2['query']['includeAll']){_0x41fa22[_0xa992('0x2c')]=[{'all':!![]}];}return db[_0xa992('0x2b')]['findAll'](_0x41fa22);})['then'](function(_0x2086fc){_0xca0d60['rows']=_0x2086fc;return _0xca0d60;})[_0xa992('0xf')](respondWithFilteredResult(_0x2f239e,_0x41fa22))[_0xa992('0x2d')](handleError(_0x2f239e,null));};exports[_0xa992('0x2e')]=function(_0x46bc7b,_0x38a75e){var _0x1a6d5f={'raw':![],'where':{'id':_0x46bc7b[_0xa992('0x2f')]['id']}},_0x137511={};_0x137511[_0xa992('0x19')]=_[_0xa992('0x1b')](db[_0xa992('0x2b')][_0xa992('0x16')]);_0x137511['query']=_[_0xa992('0x1b')](_0x46bc7b[_0xa992('0x1a')]);_0x137511[_0xa992('0x1c')]=_[_0xa992('0x1d')](_0x137511[_0xa992('0x19')],_0x137511['query']);_0x1a6d5f[_0xa992('0x1f')]=_[_0xa992('0x1d')](_0x137511['model'],qs['fields'](_0x46bc7b['query'][_0xa992('0x1e')]));_0x1a6d5f[_0xa992('0x1f')]=_0x1a6d5f[_0xa992('0x1f')][_0xa992('0x20')]?_0x1a6d5f[_0xa992('0x1f')]:_0x137511['model'];if(_0x46bc7b[_0xa992('0x1a')][_0xa992('0x30')]){_0x1a6d5f[_0xa992('0x2c')]=[{'all':!![]}];}_0x1a6d5f=_['merge']({},_0x1a6d5f,_0x46bc7b[_0xa992('0x2a')]);return db['Dynamics365Account'][_0xa992('0x31')](_0x1a6d5f)[_0xa992('0xf')](handleEntityNotFound(_0x38a75e,null))[_0xa992('0xf')](respondWithResult(_0x38a75e,null))[_0xa992('0x2d')](handleError(_0x38a75e,null));};exports['create']=function(_0x43ed9c,_0x232d10){return db['Dynamics365Account'][_0xa992('0x32')](_0x43ed9c[_0xa992('0x33')],{})[_0xa992('0xf')](respondWithResult(_0x232d10,0xc9))[_0xa992('0x2d')](handleError(_0x232d10,null));};exports['update']=function(_0x1f5374,_0x17dddb){if(_0x1f5374[_0xa992('0x33')]['id']){delete _0x1f5374[_0xa992('0x33')]['id'];}return db[_0xa992('0x2b')][_0xa992('0x31')]({'where':{'id':_0x1f5374[_0xa992('0x2f')]['id']}})['then'](handleEntityNotFound(_0x17dddb,null))[_0xa992('0xf')](saveUpdates(_0x1f5374['body'],null))['then'](respondWithResult(_0x17dddb,null))[_0xa992('0x2d')](handleError(_0x17dddb,null));};exports['destroy']=function(_0x58849a,_0x4d55fe){return db[_0xa992('0x2b')][_0xa992('0x31')]({'where':{'id':_0x58849a[_0xa992('0x2f')]['id']}})[_0xa992('0xf')](handleEntityNotFound(_0x4d55fe,null))[_0xa992('0xf')](removeEntity(_0x4d55fe,null))[_0xa992('0x2d')](handleError(_0x4d55fe,null));};exports['getConfigurations']=function(_0x28eb54,_0xddc5e8){var _0x4483af={};var _0x3589f8={};var _0x654bb4;var _0x1f29ad;return db['Dynamics365Account']['findOne']({'where':{'id':_0x28eb54['params']['id']}})['then'](handleEntityNotFound(_0xddc5e8,null))[_0xa992('0xf')](function(_0x5f060d){if(_0x5f060d){_0x654bb4=_0x5f060d;_0x3589f8[_0xa992('0x19')]=_[_0xa992('0x1b')](db[_0xa992('0x34')][_0xa992('0x16')]);_0x3589f8[_0xa992('0x1a')]=_[_0xa992('0x1b')](_0x28eb54[_0xa992('0x1a')]);_0x3589f8[_0xa992('0x1c')]=_['intersection'](_0x3589f8[_0xa992('0x19')],_0x3589f8['query']);_0x4483af['attributes']=_[_0xa992('0x1d')](_0x3589f8[_0xa992('0x19')],qs[_0xa992('0x1e')](_0x28eb54[_0xa992('0x1a')]['fields']));_0x4483af[_0xa992('0x1f')]=_0x4483af[_0xa992('0x1f')]['length']?_0x4483af[_0xa992('0x1f')]:_0x3589f8[_0xa992('0x19')];_0x4483af[_0xa992('0x22')]=qs[_0xa992('0x23')](_0x28eb54[_0xa992('0x1a')]['sort']);_0x4483af[_0xa992('0x24')]=qs[_0xa992('0x1c')](_['pick'](_0x28eb54[_0xa992('0x1a')],_0x3589f8[_0xa992('0x1c')]));if(_0x28eb54[_0xa992('0x1a')][_0xa992('0x26')]){_0x4483af[_0xa992('0x24')]=_[_0xa992('0x27')](_0x4483af[_0xa992('0x24')],{'$or':_['map'](_0x4483af[_0xa992('0x1f')],function(_0x337e1e){var _0x4646c0={};_0x4646c0[_0x337e1e]={'$like':'%'+_0x28eb54[_0xa992('0x1a')][_0xa992('0x26')]+'%'};return _0x4646c0;})});}_0x4483af=_[_0xa992('0x27')]({},_0x4483af,_0x28eb54[_0xa992('0x2a')]);return _0x654bb4['getConfigurations'](_0x4483af);}})[_0xa992('0xf')](function(_0x1d6eea){if(_0x1d6eea){_0x1f29ad=_0x1d6eea[_0xa992('0x20')];if(!_0x28eb54[_0xa992('0x1a')][_0xa992('0x21')](_0xa992('0x35'))){_0x4483af[_0xa992('0xa')]=qs[_0xa992('0xa')](_0x28eb54[_0xa992('0x1a')][_0xa992('0xa')]);_0x4483af['offset']=qs['offset'](_0x28eb54[_0xa992('0x1a')][_0xa992('0x8')]);}return _0x654bb4['getConfigurations'](_0x4483af);}})['then'](function(_0x424a57){if(_0x424a57){return _0x424a57?{'count':_0x1f29ad,'rows':_0x424a57}:null;}})[_0xa992('0xf')](respondWithResult(_0xddc5e8,null))[_0xa992('0x2d')](handleError(_0xddc5e8,null));};exports[_0xa992('0x36')]=function(_0x2f660a,_0xc0ddc){if(_0x2f660a[_0xa992('0x33')]['id']){delete _0x2f660a[_0xa992('0x33')]['id'];}return db[_0xa992('0x2b')][_0xa992('0x37')]({'where':{'id':_0x2f660a[_0xa992('0x2f')]['id']}})[_0xa992('0xf')](handleEntityNotFound(_0xc0ddc,null))[_0xa992('0xf')](function(_0x4a54d6){if(_0x4a54d6){_0x2f660a[_0xa992('0x33')]['AccountId']=_0x4a54d6['id'];_0x2f660a[_0xa992('0x33')]['Subjects']=integrations[_0xa992('0x38')](_0x2f660a[_0xa992('0x33')][_0xa992('0x39')],_0x2f660a['body'][_0xa992('0x28')]);_0x2f660a[_0xa992('0x33')]['Descriptions']=integrations[_0xa992('0x3a')](_0x2f660a[_0xa992('0x33')]['channel'],_0x2f660a[_0xa992('0x33')]['type']);return db[_0xa992('0x34')][_0xa992('0x32')](_0x2f660a[_0xa992('0x33')],{'include':[{'model':db[_0xa992('0x3b')],'as':_0xa992('0x3c')},{'model':db[_0xa992('0x3b')],'as':_0xa992('0x3d')}]});}return null;})['then'](respondWithResult(_0xc0ddc,null))[_0xa992('0x2d')](handleError(_0xc0ddc,null));};function sanitizeRemoteUri(_0x584758){var _0xbb57c8=_0x584758[_0xa992('0x3e')](-0x1);if(_0xbb57c8==='/')return _0x584758[_0xa992('0x3f')](0x0,_0x584758[_0xa992('0x40')](_0xbb57c8));return _0x584758;}function getWebApiUrl(_0x4f9179){return util[_0xa992('0x41')](_0xa992('0x42'),_0x4f9179);}exports[_0xa992('0x43')]=function(_0x5451b8,_0x163501){var _0x4a5943=_0x5451b8[_0xa992('0x1a')][_0xa992('0x44')];var _0xbd06a5=_0x4a5943==='incident'?_0xa992('0x45'):_0xa992('0x46');var _0x4a3360='';var _0x39928d='';var _0x1ee466='';var _0x1c44ce='';var _0x5c1296='';var _0x26aeb5='';var _0x5984f4='';var _0x1b7c34='';var _0x77420e=[_0xa992('0x47'),_0xa992('0x48'),_0xa992('0x49'),'ownerid',_0xa992('0x4a'),_0xa992('0x4b'),_0xa992('0x4c'),_0xa992('0x4d'),_0xa992('0x4e'),'phonecall_activity_parties'];var _0x419fd8=[_0xa992('0x4f'),_0xa992('0x50'),'actualserviceunits','billedserviceunits','contactidname',_0xa992('0x51'),_0xa992('0x52'),_0xa992('0x53'),_0xa992('0x54'),'createdbyexternalpartyyominame',_0xa992('0x55'),'createdbyyominame','createdon',_0xa992('0x56'),_0xa992('0x57'),_0xa992('0x58'),_0xa992('0x59'),_0xa992('0x5a'),_0xa992('0x5b'),_0xa992('0x5c'),'entityimage_timestamp',_0xa992('0x5d'),'escalatedon',_0xa992('0x5e'),_0xa992('0x5f'),_0xa992('0x60'),_0xa992('0x61'),_0xa992('0x62'),_0xa992('0x63'),_0xa992('0x64'),_0xa992('0x65'),_0xa992('0x66'),_0xa992('0x67'),'modifiedbyname',_0xa992('0x68'),_0xa992('0x69'),'modifiedonbehalfbyname',_0xa992('0x6a'),'msdyn_incidenttypename',_0xa992('0x6b'),_0xa992('0x6c'),'onholdtime','overriddencreatedon',_0xa992('0x6d'),_0xa992('0x6e'),_0xa992('0x6f'),_0xa992('0x70'),_0xa992('0x71'),_0xa992('0x72'),_0xa992('0x73'),_0xa992('0x74'),_0xa992('0x75'),_0xa992('0x76'),_0xa992('0x77'),_0xa992('0x78'),_0xa992('0x79'),_0xa992('0x7a'),_0xa992('0x7b'),_0xa992('0x7c'),_0xa992('0x7d'),_0xa992('0x7e'),_0xa992('0x7f'),_0xa992('0x80'),_0xa992('0x81'),_0xa992('0x82'),_0xa992('0x83'),'transactioncurrencyidname',_0xa992('0x84'),_0xa992('0x85'),_0xa992('0x86')];var _0x444fdc=_0x77420e[_0xa992('0x87')](_0x419fd8);return db[_0xa992('0x2b')]['findOne']({'where':{'id':_0x5451b8[_0xa992('0x2f')]['id']},'attributes':['id','username',_0xa992('0x88'),_0xa992('0x89'),_0xa992('0x8a'),_0xa992('0x8b'),'clientSecret','modernAuthentication'],'include':[{'model':db[_0xa992('0x8c')],'as':'CloudProvider','attributes':['id',_0xa992('0x8d'),_0xa992('0x8e')]}]})[_0xa992('0xf')](handleEntityNotFound(_0x163501,null))['then'](function(_0x2a31af){if(_0x2a31af){if(_0x2a31af['modernAuthentication']){_0x2a31af[_0xa992('0x8f')]=_0x2a31af[_0xa992('0x8c')][_0xa992('0x8d')];_0x1b7c34=sanitizeRemoteUri(_0x2a31af[_0xa992('0x8c')][_0xa992('0x8e')]);_0x5984f4=getWebApiUrl(_0x1b7c34);return _0x2a31af;}_0x1b7c34=sanitizeRemoteUri(_0x2a31af[_0xa992('0x89')]);_0x5984f4=getWebApiUrl(_0x1b7c34);var _0x324fc1={'method':_0xa992('0x90'),'uri':_0xa992('0x91')+_0x2a31af[_0xa992('0x8a')]+_0xa992('0x92'),'form':{'client_id':_0x2a31af[_0xa992('0x8b')],'resource':_0x1b7c34,'username':_0x2a31af[_0xa992('0x93')],'password':_0x2a31af[_0xa992('0x88')],'grant_type':_0xa992('0x88'),'client_secret':_0x2a31af['clientSecret']},'json':!![]};return rp(_0x324fc1);}})[_0xa992('0xf')](function(_0x239d0b){_0x26aeb5=_0x239d0b[_0xa992('0x8f')];var _0x43b8be={'method':_0xa992('0x94'),'uri':encodeURI(_0x5984f4+_0xa992('0x95')+_0xbd06a5+'\x27'),'headers':{'Authorization':_0xa992('0x96')+_0x26aeb5,'If-None-Match':null,'OData-Version':_0xa992('0x97')},'json':!![]};return rp(_0x43b8be);})[_0xa992('0xf')](function(_0x1fdbd0){var _0x1bda5c=_0x1fdbd0[_0xa992('0x98')][0x0];var _0xc0c9e7=_0x1bda5c[_0xa992('0x99')];var _0xc41c41={'method':_0xa992('0x94'),'uri':_0x5984f4+_0xa992('0x9a')+_0xc0c9e7+_0xa992('0x9b'),'headers':{'Authorization':_0xa992('0x96')+_0x26aeb5,'If-None-Match':null,'OData-Version':_0xa992('0x97')},'json':!![]};return rp(_0xc41c41);})[_0xa992('0xf')](function(_0x4305cc){_0x4a3360=_0x4305cc;_0x39928d=_0x4a3360[_0xa992('0x9c')];_0x39928d=_['remove'](_0x39928d,function(_0x3fbd64){return!_0x444fdc[_0xa992('0x9d')](_0x3fbd64['LogicalName']);});var _0x25b667=[];var _0x50f2d6=[];_0x39928d['forEach'](function(_0x19f91b){if(_0x19f91b[_0xa992('0x9e')]){var _0x1cea3d=_0x19f91b['@odata.type'][_0xa992('0x3f')](_0x19f91b[_0xa992('0x9e')][_0xa992('0x40')]('.')+0x1);if(_0x1cea3d===_0xa992('0x9f')){_0x25b667[_0xa992('0xa0')](getSelectList(_0x5984f4,_0x4a5943,_0x50f2d6,_0x4a3360[_0xa992('0x99')],_0x19f91b['MetadataId'],_0x26aeb5));}}});return Promise[_0xa992('0xa1')](_0x25b667);})[_0xa992('0xf')](function(_0x25c07b){_0x1ee466=_0x25c07b[0x0];var _0x2c4c8b=[];var _0x4d36f0=[];_0x39928d[_0xa992('0xa2')](function(_0x8333bb){if(!_[_0xa992('0xa3')](_0x8333bb['@odata.type'])){var _0x322adf=_0x8333bb[_0xa992('0x9e')]['substring'](_0x8333bb['@odata.type'][_0xa992('0x40')]('.')+0x1);if(_0x322adf===_0xa992('0xa4')){_0x2c4c8b[_0xa992('0xa0')](getBooleanList(_0x5984f4,_0x4a5943,_0x4d36f0,_0x4a3360['MetadataId'],_0x8333bb['MetadataId'],_0x26aeb5));}}});return Promise[_0xa992('0xa1')](_0x2c4c8b);})['then'](function(_0xa25596){_0x1c44ce=_0xa25596[0x0];var _0x41c902=[];var _0x1e035b=[];_0x39928d[_0xa992('0xa2')](function(_0x17c1cc){if(_0x17c1cc['@odata.type']){var _0x239d18=_0x17c1cc[_0xa992('0x9e')][_0xa992('0x3f')](_0x17c1cc[_0xa992('0x9e')][_0xa992('0x40')]('.')+0x1);if(_0x239d18==='StringAttributeMetadata'||_0x239d18===_0xa992('0xa5')||_0x239d18===_0xa992('0xa6')||_0x239d18===_0xa992('0xa7')||_0x239d18==='MemoAttributeMetadata'||_0x239d18===_0xa992('0xa8')||_0x239d18===_0xa992('0xa9')||_0x239d18===_0xa992('0xaa')||_0x239d18===_0xa992('0xab')||_0x239d18===_0xa992('0xac')){_0x41c902['push'](getInputList(_0x5984f4,_0x4a5943,_0x239d18,_0x1e035b,_0x4a3360[_0xa992('0x99')],_0x17c1cc[_0xa992('0x99')],_0x26aeb5));}}});return Promise[_0xa992('0xa1')](_0x41c902);})[_0xa992('0xf')](function(_0x164acb){_0x5c1296=_0x164acb[0x0];var _0xca8db2=_0x1ee466[_0xa992('0x87')](_0x1c44ce)['concat'](_0x5c1296);var _0x2e29ba={'count':_0xca8db2[_0xa992('0x20')],'rows':_0xca8db2};return _0x2e29ba;})[_0xa992('0xf')](respondWithResult(_0x163501,null))[_0xa992('0x2d')](function(_0xe1ab06){var _0x4b1c41=_0x5451b8[_0xa992('0x1a')][_0xa992('0xad')]?0x1f4:_0xe1ab06['statusCode']||0x1f4;logger[_0xa992('0xae')](_0xe1ab06[_0xa992('0x11')]);delete _0xe1ab06['name'];if(_0x4b1c41===0x191){_0x4b1c41=0x190;}_0x163501['status'](_0x4b1c41)[_0xa992('0x13')](_0x5451b8[_0xa992('0x1a')][_0xa992('0xad')]?{'message':_0xa992('0xaf'),'statusCode':_0xe1ab06[_0xa992('0xb0')]}:_0xe1ab06);});};function getSelectList(_0xb461d9,_0x908c8c,_0x39b631,_0x4cdc53,_0x47a693,_0x2ce7b8){var _0x5a9cca={'method':_0xa992('0x94'),'uri':_0xb461d9+_0xa992('0x9a')+_0x4cdc53+_0xa992('0xb1')+_0x47a693+_0xa992('0xb2')+_0xa992('0xb3'),'headers':{'Authorization':_0xa992('0x96')+_0x2ce7b8,'If-None-Match':null,'OData-Version':_0xa992('0x97')},'json':!![]};return rp(_0x5a9cca)[_0xa992('0xf')](function(_0x13a37e){var _0x445319=[];var _0x15a93a=_0x13a37e['OptionSet']['Options'];_0x15a93a['forEach'](function(_0x4bec9d){_0x445319[_0xa992('0xa0')]({'name':_0x4bec9d[_0xa992('0xb4')][_0xa992('0xb5')]['Label'],'value':String(_0x4bec9d[_0xa992('0xb6')])});});var _0x200991={'id':_0x908c8c+'_'+_0x13a37e['LogicalName'],'name':_0x13a37e[_0xa992('0xb7')][_0xa992('0xb5')][_0xa992('0xb4')],'custom':![],'options':_0x445319};_0x39b631[_0xa992('0xa0')](_0x200991);return _0x39b631;});}function getBooleanList(_0xc7e165,_0x577bde,_0x3a4a6f,_0x9d071,_0x57aa3a,_0x1d9144){var _0x4be0c8={'method':_0xa992('0x94'),'uri':_0xc7e165+_0xa992('0x9a')+_0x9d071+_0xa992('0xb1')+_0x57aa3a+_0xa992('0xb8'),'headers':{'Authorization':_0xa992('0x96')+_0x1d9144,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4be0c8)[_0xa992('0xf')](function(_0x404e90){var _0x4a10e2=[];_0x4a10e2[_0xa992('0xa0')]({'name':_0x404e90[_0xa992('0xb9')]['TrueOption'][_0xa992('0xb4')][_0xa992('0xb5')][_0xa992('0xb4')],'value':_0xa992('0xba')},{'name':_0x404e90['OptionSet'][_0xa992('0xbb')]['Label'][_0xa992('0xb5')][_0xa992('0xb4')],'value':_0xa992('0xbc')});var _0x4393e7={'id':_0x577bde+'_'+_0x404e90[_0xa992('0xbd')],'name':_0x404e90[_0xa992('0xb7')][_0xa992('0xb5')][_0xa992('0xb4')],'custom':![],'options':_0x4a10e2};_0x3a4a6f[_0xa992('0xa0')](_0x4393e7);return _0x3a4a6f;});}function getInputList(_0x5a06d1,_0x4ff58c,_0x453927,_0x137722,_0x20ebf9,_0x4ec7a6,_0x222495){var _0x25586d={'method':_0xa992('0x94'),'uri':_0x5a06d1+'EntityDefinitions('+_0x20ebf9+_0xa992('0xb1')+_0x4ec7a6+')/Microsoft.Dynamics.CRM.'+_0x453927+_0xa992('0xbe'),'headers':{'Authorization':_0xa992('0x96')+_0x222495,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x25586d)[_0xa992('0xf')](function(_0x35b0fe){var _0x56b9b3={'id':_0x4ff58c+'_'+_0x35b0fe['LogicalName'],'name':_0x35b0fe[_0xa992('0xb7')][_0xa992('0xb5')]?_0x35b0fe[_0xa992('0xb7')][_0xa992('0xb5')][_0xa992('0xb4')]:_0x35b0fe[_0xa992('0xbd')],'custom':![],'options':[]};_0x137722[_0xa992('0xa0')](_0x56b9b3);return _0x137722;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 3888b05..d74025b 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x248ba5,_0x27fcf7){var _0x23fa7b=function(_0x84e947){while(--_0x84e947){_0x248ba5['push'](_0x248ba5['shift']());}};_0x23fa7b(++_0x27fcf7);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x133949,_0x246957){var _0x43c607=function(_0x4d95d9){while(--_0x4d95d9){_0x133949['push'](_0x133949['shift']());}};_0x43c607(++_0x246957);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','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 ff0ffce..629b8fe 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 _0xba48=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','map','model','ShowDynamics365Account','lodash','util','moment','bluebird','randomstring'];(function(_0x1667be,_0x1c5fae){var _0x292391=function(_0x9f0280){while(--_0x9f0280){_0x1667be['push'](_0x1667be['shift']());}};_0x292391(++_0x1c5fae);}(_0xba48,0xd3));var _0x8ba4=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xba48[_0x92c450];return _0x2a9599;};'use strict';var _=require(_0x8ba4('0x0'));var util=require(_0x8ba4('0x1'));var moment=require(_0x8ba4('0x2'));var BPromise=require(_0x8ba4('0x3'));var rs=require(_0x8ba4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8ba4('0x5'))['db'];var utils=require(_0x8ba4('0x6'));var logger=require(_0x8ba4('0x7'))(_0x8ba4('0x8'));var config=require(_0x8ba4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8ba4('0xa')][_0x8ba4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1083e4,_0x4eb615,_0x2bf9b0){return new BPromise(function(_0x525fa6,_0x30a731){return client[_0x8ba4('0xc')](_0x1083e4,_0x2bf9b0)[_0x8ba4('0xd')](function(_0x163c62){logger[_0x8ba4('0xe')](_0x8ba4('0xf'),_0x4eb615,_0x8ba4('0x10'));logger[_0x8ba4('0x11')](_0x8ba4('0x12'),_0x4eb615,'request\x20sent',JSON[_0x8ba4('0x13')](_0x163c62));if(_0x163c62[_0x8ba4('0x14')]){if(_0x163c62['error'][_0x8ba4('0x15')]===0x1f4){logger[_0x8ba4('0x14')](_0x8ba4('0xf'),_0x4eb615,_0x163c62['error'][_0x8ba4('0x16')]);return _0x30a731(_0x163c62[_0x8ba4('0x14')][_0x8ba4('0x16')]);}logger[_0x8ba4('0x14')]('Dynamics365Account,\x20%s,\x20%s',_0x4eb615,_0x163c62['error']['message']);return _0x525fa6(_0x163c62[_0x8ba4('0x14')][_0x8ba4('0x16')]);}else{logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x4eb615,'request\x20sent');_0x525fa6(_0x163c62['result'][_0x8ba4('0x16')]);}})[_0x8ba4('0x17')](function(_0x37b6fd){logger[_0x8ba4('0x14')](_0x8ba4('0xf'),_0x4eb615,_0x37b6fd);_0x30a731(_0x37b6fd);});});}exports[_0x8ba4('0x18')]=function(_0x25442c){var _0x772f7e=this;return new Promise(function(_0x16be3c,_0x399568){return db[_0x8ba4('0x19')][_0x8ba4('0x1a')]({'raw':_0x25442c[_0x8ba4('0x1b')]?_0x25442c[_0x8ba4('0x1b')][_0x8ba4('0x1c')]===undefined?!![]:![]:!![],'where':_0x25442c[_0x8ba4('0x1b')]?_0x25442c[_0x8ba4('0x1b')][_0x8ba4('0x1d')]||null:null,'attributes':_0x25442c[_0x8ba4('0x1b')]?_0x25442c[_0x8ba4('0x1b')][_0x8ba4('0x1e')]||null:null,'limit':_0x25442c[_0x8ba4('0x1b')]?_0x25442c[_0x8ba4('0x1b')][_0x8ba4('0x1f')]||null:null,'include':_0x25442c['options']?_0x25442c[_0x8ba4('0x1b')][_0x8ba4('0x20')]?_[_0x8ba4('0x21')](_0x25442c['options'][_0x8ba4('0x20')],function(_0x4197f2){return{'model':db[_0x4197f2[_0x8ba4('0x22')]],'as':_0x4197f2['as'],'attributes':_0x4197f2[_0x8ba4('0x1e')],'include':_0x4197f2[_0x8ba4('0x20')]?_[_0x8ba4('0x21')](_0x4197f2[_0x8ba4('0x20')],function(_0x4834b6){return{'model':db[_0x4834b6[_0x8ba4('0x22')]],'as':_0x4834b6['as'],'attributes':_0x4834b6['attributes'],'include':_0x4834b6[_0x8ba4('0x20')]?_[_0x8ba4('0x21')](_0x4834b6['include'],function(_0x1c27f4){return{'model':db[_0x1c27f4[_0x8ba4('0x22')]],'as':_0x1c27f4['as'],'attributes':_0x1c27f4[_0x8ba4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8ba4('0xd')](function(_0x369cdf){logger[_0x8ba4('0xe')](_0x8ba4('0x18'),_0x25442c);logger[_0x8ba4('0x11')]('GetDynamics365Account',_0x25442c,JSON[_0x8ba4('0x13')](_0x369cdf));_0x16be3c(_0x369cdf);})[_0x8ba4('0x17')](function(_0x4801b7){logger[_0x8ba4('0x14')](_0x8ba4('0x18'),_0x4801b7['message'],_0x25442c);_0x399568(_0x772f7e[_0x8ba4('0x14')](0x1f4,_0x4801b7[_0x8ba4('0x16')]));});});};exports['ShowDynamics365Account']=function(_0x4cadfb){var _0x4f0000=this;return new Promise(function(_0x5aa839,_0x284afb){return db['Dynamics365Account']['find']({'raw':_0x4cadfb[_0x8ba4('0x1b')]?_0x4cadfb[_0x8ba4('0x1b')][_0x8ba4('0x1c')]===undefined?!![]:![]:!![],'where':_0x4cadfb[_0x8ba4('0x1b')]?_0x4cadfb[_0x8ba4('0x1b')][_0x8ba4('0x1d')]||null:null,'attributes':_0x4cadfb['options']?_0x4cadfb[_0x8ba4('0x1b')][_0x8ba4('0x1e')]||null:null,'include':_0x4cadfb[_0x8ba4('0x1b')]?_0x4cadfb[_0x8ba4('0x1b')]['include']?_[_0x8ba4('0x21')](_0x4cadfb[_0x8ba4('0x1b')][_0x8ba4('0x20')],function(_0x1d4b4e){return{'model':db[_0x1d4b4e[_0x8ba4('0x22')]],'as':_0x1d4b4e['as'],'attributes':_0x1d4b4e[_0x8ba4('0x1e')],'include':_0x1d4b4e[_0x8ba4('0x20')]?_[_0x8ba4('0x21')](_0x1d4b4e['include'],function(_0x2202d5){return{'model':db[_0x2202d5[_0x8ba4('0x22')]],'as':_0x2202d5['as'],'attributes':_0x2202d5[_0x8ba4('0x1e')],'include':_0x2202d5[_0x8ba4('0x20')]?_[_0x8ba4('0x21')](_0x2202d5['include'],function(_0x1945cd){return{'model':db[_0x1945cd[_0x8ba4('0x22')]],'as':_0x1945cd['as'],'attributes':_0x1945cd[_0x8ba4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8ba4('0xd')](function(_0x16bfaf){logger['info']('ShowDynamics365Account',_0x4cadfb);logger[_0x8ba4('0x11')](_0x8ba4('0x23'),_0x4cadfb,JSON['stringify'](_0x16bfaf));_0x5aa839(_0x16bfaf);})[_0x8ba4('0x17')](function(_0x338fbb){logger[_0x8ba4('0x14')](_0x8ba4('0x23'),_0x338fbb['message'],_0x4cadfb);_0x284afb(_0x4f0000[_0x8ba4('0x14')](0x1f4,_0x338fbb['message']));});});}; \ No newline at end of file +var _0x8539=['../../mysqldb','../../config/logger','rpc','../../config/environment','request','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','message','result','catch','Dynamics365Account','findAll','options','raw','limit','include','model','attributes','map','GetDynamics365Account','stringify','find','where','then','ShowDynamics365Account','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x52c4b7,_0xc8a55d){var _0xff10f4=function(_0x5556d0){while(--_0x5556d0){_0x52c4b7['push'](_0x52c4b7['shift']());}};_0xff10f4(++_0xc8a55d);}(_0x8539,0x1e4));var _0x9853=function(_0xd9725,_0x159bf3){_0xd9725=_0xd9725-0x0;var _0x42ad6e=_0x8539[_0xd9725];return _0x42ad6e;};'use strict';var _=require(_0x9853('0x0'));var util=require(_0x9853('0x1'));var moment=require(_0x9853('0x2'));var BPromise=require(_0x9853('0x3'));var rs=require(_0x9853('0x4'));var fs=require('fs');var Redis=require(_0x9853('0x5'));var db=require(_0x9853('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9853('0x7'))(_0x9853('0x8'));var config=require(_0x9853('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x374173,_0x1215fe,_0x1a83a5){return new BPromise(function(_0x447817,_0x1ebf40){return client[_0x9853('0xa')](_0x374173,_0x1a83a5)['then'](function(_0x1d7924){logger[_0x9853('0xb')](_0x9853('0xc'),_0x1215fe,_0x9853('0xd'));logger[_0x9853('0xe')](_0x9853('0xf'),_0x1215fe,_0x9853('0xd'),JSON['stringify'](_0x1d7924));if(_0x1d7924['error']){if(_0x1d7924[_0x9853('0x10')]['code']===0x1f4){logger[_0x9853('0x10')](_0x9853('0xc'),_0x1215fe,_0x1d7924['error'][_0x9853('0x11')]);return _0x1ebf40(_0x1d7924[_0x9853('0x10')][_0x9853('0x11')]);}logger[_0x9853('0x10')](_0x9853('0xc'),_0x1215fe,_0x1d7924['error'][_0x9853('0x11')]);return _0x447817(_0x1d7924['error'][_0x9853('0x11')]);}else{logger[_0x9853('0xb')](_0x9853('0xc'),_0x1215fe,_0x9853('0xd'));_0x447817(_0x1d7924[_0x9853('0x12')][_0x9853('0x11')]);}})[_0x9853('0x13')](function(_0x52be4b){logger[_0x9853('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x1215fe,_0x52be4b);_0x1ebf40(_0x52be4b);});});}exports['GetDynamics365Account']=function(_0x5ef376){var _0x5d3b49=this;return new Promise(function(_0x445b39,_0xc82261){return db[_0x9853('0x14')][_0x9853('0x15')]({'raw':_0x5ef376[_0x9853('0x16')]?_0x5ef376[_0x9853('0x16')][_0x9853('0x17')]===undefined?!![]:![]:!![],'where':_0x5ef376[_0x9853('0x16')]?_0x5ef376['options']['where']||null:null,'attributes':_0x5ef376[_0x9853('0x16')]?_0x5ef376[_0x9853('0x16')]['attributes']||null:null,'limit':_0x5ef376['options']?_0x5ef376[_0x9853('0x16')][_0x9853('0x18')]||null:null,'include':_0x5ef376[_0x9853('0x16')]?_0x5ef376[_0x9853('0x16')][_0x9853('0x19')]?_['map'](_0x5ef376[_0x9853('0x16')]['include'],function(_0x5d5e33){return{'model':db[_0x5d5e33[_0x9853('0x1a')]],'as':_0x5d5e33['as'],'attributes':_0x5d5e33[_0x9853('0x1b')],'include':_0x5d5e33['include']?_[_0x9853('0x1c')](_0x5d5e33[_0x9853('0x19')],function(_0x2cc5d7){return{'model':db[_0x2cc5d7[_0x9853('0x1a')]],'as':_0x2cc5d7['as'],'attributes':_0x2cc5d7[_0x9853('0x1b')],'include':_0x2cc5d7[_0x9853('0x19')]?_['map'](_0x2cc5d7['include'],function(_0x270ab2){return{'model':db[_0x270ab2[_0x9853('0x1a')]],'as':_0x270ab2['as'],'attributes':_0x270ab2[_0x9853('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d6b23){logger[_0x9853('0xb')](_0x9853('0x1d'),_0x5ef376);logger[_0x9853('0xe')](_0x9853('0x1d'),_0x5ef376,JSON[_0x9853('0x1e')](_0x4d6b23));_0x445b39(_0x4d6b23);})[_0x9853('0x13')](function(_0xd83d32){logger[_0x9853('0x10')](_0x9853('0x1d'),_0xd83d32[_0x9853('0x11')],_0x5ef376);_0xc82261(_0x5d3b49['error'](0x1f4,_0xd83d32[_0x9853('0x11')]));});});};exports['ShowDynamics365Account']=function(_0x11c26e){var _0x1eab71=this;return new Promise(function(_0x6764f2,_0x3ea8a9){return db['Dynamics365Account'][_0x9853('0x1f')]({'raw':_0x11c26e[_0x9853('0x16')]?_0x11c26e['options']['raw']===undefined?!![]:![]:!![],'where':_0x11c26e['options']?_0x11c26e['options'][_0x9853('0x20')]||null:null,'attributes':_0x11c26e['options']?_0x11c26e[_0x9853('0x16')][_0x9853('0x1b')]||null:null,'include':_0x11c26e[_0x9853('0x16')]?_0x11c26e[_0x9853('0x16')][_0x9853('0x19')]?_[_0x9853('0x1c')](_0x11c26e[_0x9853('0x16')][_0x9853('0x19')],function(_0x3a3b74){return{'model':db[_0x3a3b74[_0x9853('0x1a')]],'as':_0x3a3b74['as'],'attributes':_0x3a3b74[_0x9853('0x1b')],'include':_0x3a3b74['include']?_[_0x9853('0x1c')](_0x3a3b74[_0x9853('0x19')],function(_0x48e887){return{'model':db[_0x48e887[_0x9853('0x1a')]],'as':_0x48e887['as'],'attributes':_0x48e887[_0x9853('0x1b')],'include':_0x48e887[_0x9853('0x19')]?_[_0x9853('0x1c')](_0x48e887[_0x9853('0x19')],function(_0x5015c0){return{'model':db[_0x5015c0[_0x9853('0x1a')]],'as':_0x5015c0['as'],'attributes':_0x5015c0[_0x9853('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9853('0x21')](function(_0x415de0){logger[_0x9853('0xb')](_0x9853('0x22'),_0x11c26e);logger['debug'](_0x9853('0x22'),_0x11c26e,JSON[_0x9853('0x1e')](_0x415de0));_0x6764f2(_0x415de0);})[_0x9853('0x13')](function(_0x9fa814){logger[_0x9853('0x10')](_0x9853('0x22'),_0x9fa814['message'],_0x11c26e);_0x3ea8a9(_0x1eab71[_0x9853('0x10')](0x1f4,_0x9fa814[_0x9853('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 7e77e40..d6eb944 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 _0xf4a5=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','post','put','delete'];(function(_0x97def9,_0x320c56){var _0x53c5ad=function(_0x24cb55){while(--_0x24cb55){_0x97def9['push'](_0x97def9['shift']());}};_0x53c5ad(++_0x320c56);}(_0xf4a5,0x1cf));var _0x5f4a=function(_0x165189,_0x19a741){_0x165189=_0x165189-0x0;var _0x44826b=_0xf4a5[_0x165189];return _0x44826b;};'use strict';var multer=require('multer');var util=require(_0x5f4a('0x0'));var path=require(_0x5f4a('0x1'));var timeout=require(_0x5f4a('0x2'));var express=require(_0x5f4a('0x3'));var router=express[_0x5f4a('0x4')]();var fs_extra=require(_0x5f4a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5f4a('0x6'));var config=require(_0x5f4a('0x7'));var controller=require('./intDynamics365Configuration.controller');router['get']('/',auth[_0x5f4a('0x8')](),controller[_0x5f4a('0x9')]);router[_0x5f4a('0xa')](_0x5f4a('0xb'),auth[_0x5f4a('0x8')](),controller[_0x5f4a('0xc')]);router[_0x5f4a('0xa')](_0x5f4a('0xd'),auth[_0x5f4a('0x8')](),controller[_0x5f4a('0xe')]);router[_0x5f4a('0xa')](_0x5f4a('0xf'),auth[_0x5f4a('0x8')](),controller['getSubjects']);router[_0x5f4a('0xa')](_0x5f4a('0x10'),auth[_0x5f4a('0x8')](),controller['getDescriptions']);router[_0x5f4a('0x11')]('/',auth[_0x5f4a('0x8')](),controller['create']);router[_0x5f4a('0x12')](_0x5f4a('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x5f4a('0x13')](_0x5f4a('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x5f4a('0x14')]=router; \ No newline at end of file +var _0x7f7e=['isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7f7e,0x146));var _0xe7f7=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x7f7e[_0x4e676e];return _0x336a3c;};'use strict';var multer=require(_0xe7f7('0x0'));var util=require(_0xe7f7('0x1'));var path=require(_0xe7f7('0x2'));var timeout=require('connect-timeout');var express=require(_0xe7f7('0x3'));var router=express['Router']();var fs_extra=require(_0xe7f7('0x4'));var auth=require(_0xe7f7('0x5'));var interaction=require(_0xe7f7('0x6'));var config=require(_0xe7f7('0x7'));var controller=require(_0xe7f7('0x8'));router[_0xe7f7('0x9')]('/',auth[_0xe7f7('0xa')](),controller['index']);router['get'](_0xe7f7('0xb'),auth[_0xe7f7('0xa')](),controller[_0xe7f7('0xc')]);router[_0xe7f7('0x9')](_0xe7f7('0xd'),auth[_0xe7f7('0xa')](),controller[_0xe7f7('0xe')]);router[_0xe7f7('0x9')](_0xe7f7('0xf'),auth['isAuthenticated'](),controller[_0xe7f7('0x10')]);router[_0xe7f7('0x9')](_0xe7f7('0x11'),auth['isAuthenticated'](),controller[_0xe7f7('0x12')]);router[_0xe7f7('0x13')]('/',auth['isAuthenticated'](),controller[_0xe7f7('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xe7f7('0x15')]);router['delete']('/:id',auth[_0xe7f7('0xa')](),controller[_0xe7f7('0x16')]);module[_0xe7f7('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index b701612..a9f0a29 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 _0xa788=['nothing','contact','BOOLEAN','exports','STRING','ENUM','incident'];(function(_0x361a20,_0x12de63){var _0x2b4269=function(_0x38c4ac){while(--_0x38c4ac){_0x361a20['push'](_0x361a20['shift']());}};_0x2b4269(++_0x12de63);}(_0xa788,0x1b5));var _0x8a78=function(_0x1e4b04,_0xb1e574){_0x1e4b04=_0x1e4b04-0x0;var _0x117b1a=_0xa788[_0x1e4b04];return _0x117b1a;};'use strict';var Sequelize=require('sequelize');module[_0x8a78('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8a78('0x1')]},'ticketType':{'type':Sequelize[_0x8a78('0x2')](_0x8a78('0x3'),'phonecall'),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0x8a78('0x2')]('contact',_0x8a78('0x4')),'defaultValue':_0x8a78('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x8a78('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x8a78('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0x6260=['BOOLEAN','sequelize','exports','STRING','incident','phonecall','ENUM','contact','nothing'];(function(_0x5c208d,_0x25c3cc){var _0x3fa38c=function(_0x177681){while(--_0x177681){_0x5c208d['push'](_0x5c208d['shift']());}};_0x3fa38c(++_0x25c3cc);}(_0x6260,0x133));var _0x0626=function(_0x55fb83,_0x1d3856){_0x55fb83=_0x55fb83-0x0;var _0x59a87a=_0x6260[_0x55fb83];return _0x59a87a;};'use strict';var Sequelize=require(_0x0626('0x0'));module[_0x0626('0x1')]={'name':{'type':Sequelize[_0x0626('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x0626('0x3'),_0x0626('0x4')),'defaultValue':_0x0626('0x3')},'moduleCreate':{'type':Sequelize[_0x0626('0x5')](_0x0626('0x6'),_0x0626('0x7')),'defaultValue':_0x0626('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x0626('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x0626('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 4a6c782..b3a3476 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 _0xf410=['bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','map','Dynamics365Configuration','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','keys','find','body','params','getFields','Dynamics365Field','rawAttributes','getSubjects','pick','findOne','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x3bbfa2,_0x2fc5e0){var _0x4d135=function(_0x4d410e){while(--_0x4d410e){_0x3bbfa2['push'](_0x3bbfa2['shift']());}};_0x4d135(++_0x2fc5e0);}(_0xf410,0x18c));var _0x0f41=function(_0x31d416,_0x5afb14){_0x31d416=_0x31d416-0x0;var _0x1a9bb4=_0xf410[_0x31d416];return _0x1a9bb4;};'use strict';var emlformat=require(_0x0f41('0x0'));var rimraf=require(_0x0f41('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0f41('0x2'));var rp=require(_0x0f41('0x3'));var moment=require('moment');var BPromise=require(_0x0f41('0x4'));var Mustache=require(_0x0f41('0x5'));var util=require('util');var path=require(_0x0f41('0x6'));var sox=require(_0x0f41('0x7'));var csv=require('to-csv');var ejs=require(_0x0f41('0x8'));var fs=require('fs');var fs_extra=require(_0x0f41('0x9'));var _=require('lodash');var squel=require(_0x0f41('0xa'));var crypto=require(_0x0f41('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0f41('0xc'));var toCsv=require(_0x0f41('0xd'));var querystring=require(_0x0f41('0xe'));var Papa=require(_0x0f41('0xf'));var Redis=require(_0x0f41('0x10'));var authService=require(_0x0f41('0x11'));var qs=require(_0x0f41('0x12'));var as=require(_0x0f41('0x13'));var hardwareService=require(_0x0f41('0x14'));var logger=require(_0x0f41('0x15'))(_0x0f41('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0f41('0x17'));var db=require(_0x0f41('0x18'))['db'];function respondWithStatusCode(_0x43d0c7,_0xa449ec){_0xa449ec=_0xa449ec||0xcc;return function(_0x17bf22){if(_0x17bf22){return _0x43d0c7[_0x0f41('0x19')](_0xa449ec);}return _0x43d0c7[_0x0f41('0x1a')](_0xa449ec)['end']();};}function respondWithResult(_0x562d3b,_0x2d027e){_0x2d027e=_0x2d027e||0xc8;return function(_0x5edbc9){if(_0x5edbc9){return _0x562d3b['status'](_0x2d027e)[_0x0f41('0x1b')](_0x5edbc9);}};}function respondWithFilteredResult(_0x30b3a9,_0x89869){return function(_0x66d7b8){if(_0x66d7b8){var _0x157d0e=typeof _0x89869[_0x0f41('0x1c')]===_0x0f41('0x1d')&&typeof _0x89869['limit']===_0x0f41('0x1d');var _0xbaad4d=_0x66d7b8[_0x0f41('0x1e')];var _0x700a73=_0x157d0e?0x0:_0x89869[_0x0f41('0x1c')];var _0x10b350=_0x157d0e?_0x66d7b8[_0x0f41('0x1e')]:_0x89869[_0x0f41('0x1c')]+_0x89869[_0x0f41('0x1f')];var _0x434b32;if(_0x10b350>=_0xbaad4d){_0x10b350=_0xbaad4d;_0x434b32=0xc8;}else{_0x434b32=0xce;}_0x30b3a9[_0x0f41('0x1a')](_0x434b32);return _0x30b3a9[_0x0f41('0x20')](_0x0f41('0x21'),_0x700a73+'-'+_0x10b350+'/'+_0xbaad4d)[_0x0f41('0x1b')](_0x66d7b8);}return null;};}function patchUpdates(_0x2ce714){return function(_0x1f8b91){try{jsonpatch['apply'](_0x1f8b91,_0x2ce714,!![]);}catch(_0x35415a){return BPromise[_0x0f41('0x22')](_0x35415a);}return _0x1f8b91[_0x0f41('0x23')]();};}function saveUpdates(_0xc6cc6d,_0x4952df){return function(_0x54fea6){if(_0x54fea6){return _0x54fea6[_0x0f41('0x24')](_0xc6cc6d)[_0x0f41('0x25')](function(_0x515276){return _0x515276;});}return null;};}function removeEntity(_0xa7acac,_0x477793){return function(_0x4af014){if(_0x4af014){return _0x4af014[_0x0f41('0x26')]()['then'](function(){_0xa7acac[_0x0f41('0x1a')](0xcc)[_0x0f41('0x27')]();});}};}function handleEntityNotFound(_0x1bb5f7,_0x5d40d9){return function(_0x261a18){if(!_0x261a18){_0x1bb5f7[_0x0f41('0x19')](0x194);}return _0x261a18;};}function handleError(_0x40978b,_0x16041e){_0x16041e=_0x16041e||0x1f4;return function(_0x3ab44f){logger[_0x0f41('0x28')](_0x3ab44f[_0x0f41('0x29')]);if(_0x3ab44f[_0x0f41('0x2a')]){delete _0x3ab44f[_0x0f41('0x2a')];}_0x40978b[_0x0f41('0x1a')](_0x16041e)[_0x0f41('0x2b')](_0x3ab44f);};}exports[_0x0f41('0x2c')]=function(_0x19c743,_0x844f04){var _0x26831b={},_0x25296d={},_0x375386={'count':0x0,'rows':[]};var _0xed5829=_[_0x0f41('0x2d')](db[_0x0f41('0x2e')]['rawAttributes'],function(_0x4618b5){return{'name':_0x4618b5['fieldName'],'type':_0x4618b5['type'][_0x0f41('0x2f')]};});_0x25296d[_0x0f41('0x30')]=_[_0x0f41('0x2d')](_0xed5829,'name');_0x25296d[_0x0f41('0x31')]=_['keys'](_0x19c743[_0x0f41('0x31')]);_0x25296d[_0x0f41('0x32')]=_[_0x0f41('0x33')](_0x25296d['model'],_0x25296d[_0x0f41('0x31')]);_0x26831b[_0x0f41('0x34')]=_[_0x0f41('0x33')](_0x25296d['model'],qs['fields'](_0x19c743[_0x0f41('0x31')][_0x0f41('0x35')]));_0x26831b['attributes']=_0x26831b[_0x0f41('0x34')][_0x0f41('0x36')]?_0x26831b[_0x0f41('0x34')]:_0x25296d[_0x0f41('0x30')];if(!_0x19c743['query'][_0x0f41('0x37')](_0x0f41('0x38'))){_0x26831b[_0x0f41('0x1f')]=qs[_0x0f41('0x1f')](_0x19c743[_0x0f41('0x31')][_0x0f41('0x1f')]);_0x26831b[_0x0f41('0x1c')]=qs[_0x0f41('0x1c')](_0x19c743['query'][_0x0f41('0x1c')]);}_0x26831b[_0x0f41('0x39')]=qs[_0x0f41('0x3a')](_0x19c743[_0x0f41('0x31')][_0x0f41('0x3a')]);_0x26831b[_0x0f41('0x3b')]=qs[_0x0f41('0x32')](_['pick'](_0x19c743['query'],_0x25296d[_0x0f41('0x32')]),_0xed5829);if(_0x19c743[_0x0f41('0x31')]['filter']){_0x26831b[_0x0f41('0x3b')]=_['merge'](_0x26831b[_0x0f41('0x3b')],{'$or':_['map'](_0xed5829,function(_0x91f518){if(_0x91f518['type']!==_0x0f41('0x3c')){var _0x3b550a={};_0x3b550a[_0x91f518[_0x0f41('0x2a')]]={'$like':'%'+_0x19c743[_0x0f41('0x31')][_0x0f41('0x3d')]+'%'};return _0x3b550a;}})});}_0x26831b=_[_0x0f41('0x3e')]({},_0x26831b,_0x19c743[_0x0f41('0x3f')]);var _0x99dc2a={'where':_0x26831b[_0x0f41('0x3b')]};return db[_0x0f41('0x2e')][_0x0f41('0x1e')](_0x99dc2a)[_0x0f41('0x25')](function(_0x20475d){_0x375386[_0x0f41('0x1e')]=_0x20475d;if(_0x19c743['query'][_0x0f41('0x40')]){_0x26831b[_0x0f41('0x41')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x0f41('0x42')](_0x26831b);})[_0x0f41('0x25')](function(_0x2280d8){_0x375386[_0x0f41('0x43')]=_0x2280d8;return _0x375386;})['then'](respondWithFilteredResult(_0x844f04,_0x26831b))[_0x0f41('0x44')](handleError(_0x844f04,null));};exports['show']=function(_0xe3f75c,_0x109dbf){var _0x4b84bc={'raw':![],'where':{'id':_0xe3f75c['params']['id']}},_0x4942e1={};_0x4942e1[_0x0f41('0x30')]=_[_0x0f41('0x45')](db[_0x0f41('0x2e')]['rawAttributes']);_0x4942e1[_0x0f41('0x31')]=_[_0x0f41('0x45')](_0xe3f75c[_0x0f41('0x31')]);_0x4942e1['filters']=_['intersection'](_0x4942e1[_0x0f41('0x30')],_0x4942e1[_0x0f41('0x31')]);_0x4b84bc[_0x0f41('0x34')]=_[_0x0f41('0x33')](_0x4942e1[_0x0f41('0x30')],qs['fields'](_0xe3f75c[_0x0f41('0x31')][_0x0f41('0x35')]));_0x4b84bc['attributes']=_0x4b84bc['attributes'][_0x0f41('0x36')]?_0x4b84bc[_0x0f41('0x34')]:_0x4942e1['model'];if(_0xe3f75c[_0x0f41('0x31')][_0x0f41('0x40')]){_0x4b84bc[_0x0f41('0x41')]=[{'all':!![]}];}_0x4b84bc=_[_0x0f41('0x3e')]({},_0x4b84bc,_0xe3f75c['options']);return db['Dynamics365Configuration'][_0x0f41('0x46')](_0x4b84bc)[_0x0f41('0x25')](handleEntityNotFound(_0x109dbf,null))['then'](respondWithResult(_0x109dbf,null))[_0x0f41('0x44')](handleError(_0x109dbf,null));};exports['create']=function(_0x5577cc,_0x40afb9){return db[_0x0f41('0x2e')]['create'](_0x5577cc[_0x0f41('0x47')],{})[_0x0f41('0x25')](respondWithResult(_0x40afb9,0xc9))[_0x0f41('0x44')](handleError(_0x40afb9,null));};exports[_0x0f41('0x24')]=function(_0x216080,_0x3d200c){if(_0x216080[_0x0f41('0x47')]['id']){delete _0x216080['body']['id'];}return db[_0x0f41('0x2e')]['find']({'where':{'id':_0x216080[_0x0f41('0x48')]['id']}})['then'](handleEntityNotFound(_0x3d200c,null))[_0x0f41('0x25')](saveUpdates(_0x216080[_0x0f41('0x47')],null))[_0x0f41('0x25')](respondWithResult(_0x3d200c,null))['catch'](handleError(_0x3d200c,null));};exports[_0x0f41('0x26')]=function(_0x2fd1c8,_0xd655ca){return db['Dynamics365Configuration'][_0x0f41('0x46')]({'where':{'id':_0x2fd1c8[_0x0f41('0x48')]['id']}})[_0x0f41('0x25')](handleEntityNotFound(_0xd655ca,null))[_0x0f41('0x25')](removeEntity(_0xd655ca,null))[_0x0f41('0x44')](handleError(_0xd655ca,null));};exports[_0x0f41('0x49')]=function(_0x4924aa,_0x29f9a1,_0x1c40d2){var _0xbd2dce={};var _0x1d273b={};var _0x119ad7;var _0x3a2487;return db[_0x0f41('0x2e')]['findOne']({'where':{'id':_0x4924aa['params']['id']}})[_0x0f41('0x25')](handleEntityNotFound(_0x29f9a1,null))['then'](function(_0x15c3bf){if(_0x15c3bf){_0x119ad7=_0x15c3bf;_0x1d273b[_0x0f41('0x30')]=_[_0x0f41('0x45')](db[_0x0f41('0x4a')][_0x0f41('0x4b')]);_0x1d273b[_0x0f41('0x31')]=_['keys'](_0x4924aa[_0x0f41('0x31')]);_0x1d273b[_0x0f41('0x32')]=_[_0x0f41('0x33')](_0x1d273b[_0x0f41('0x30')],_0x1d273b[_0x0f41('0x31')]);_0xbd2dce[_0x0f41('0x34')]=_[_0x0f41('0x33')](_0x1d273b[_0x0f41('0x30')],qs['fields'](_0x4924aa[_0x0f41('0x31')][_0x0f41('0x35')]));_0xbd2dce[_0x0f41('0x34')]=_0xbd2dce[_0x0f41('0x34')][_0x0f41('0x36')]?_0xbd2dce[_0x0f41('0x34')]:_0x1d273b[_0x0f41('0x30')];_0xbd2dce[_0x0f41('0x39')]=qs['sort'](_0x4924aa[_0x0f41('0x31')][_0x0f41('0x3a')]);_0xbd2dce['where']=qs[_0x0f41('0x32')](_['pick'](_0x4924aa['query'],_0x1d273b[_0x0f41('0x32')]));if(_0x4924aa['query'][_0x0f41('0x3d')]){_0xbd2dce[_0x0f41('0x3b')]=_[_0x0f41('0x3e')](_0xbd2dce[_0x0f41('0x3b')],{'$or':_[_0x0f41('0x2d')](_0xbd2dce['attributes'],function(_0x40c43b){var _0x25948b={};_0x25948b[_0x40c43b]={'$like':'%'+_0x4924aa[_0x0f41('0x31')]['filter']+'%'};return _0x25948b;})});}_0xbd2dce=_[_0x0f41('0x3e')]({},_0xbd2dce,_0x4924aa[_0x0f41('0x3f')]);return _0x119ad7[_0x0f41('0x49')](_0xbd2dce);}})['then'](function(_0x418568){if(_0x418568){_0x3a2487=_0x418568[_0x0f41('0x36')];if(!_0x4924aa[_0x0f41('0x31')][_0x0f41('0x37')]('nolimit')){_0xbd2dce['limit']=qs[_0x0f41('0x1f')](_0x4924aa[_0x0f41('0x31')][_0x0f41('0x1f')]);_0xbd2dce[_0x0f41('0x1c')]=qs[_0x0f41('0x1c')](_0x4924aa[_0x0f41('0x31')][_0x0f41('0x1c')]);}return _0x119ad7[_0x0f41('0x49')](_0xbd2dce);}})['then'](function(_0x2e56b7){if(_0x2e56b7){return _0x2e56b7?{'count':_0x3a2487,'rows':_0x2e56b7}:null;}})[_0x0f41('0x25')](respondWithResult(_0x29f9a1,null))[_0x0f41('0x44')](handleError(_0x29f9a1,null));};exports[_0x0f41('0x4c')]=function(_0x54c5b2,_0x33c7da,_0x1b6435){var _0x13f2c3={};var _0xddb4b7={};var _0x256d43;var _0x5405e4;return db[_0x0f41('0x2e')]['findOne']({'where':{'id':_0x54c5b2['params']['id']}})[_0x0f41('0x25')](handleEntityNotFound(_0x33c7da,null))[_0x0f41('0x25')](function(_0x369b85){if(_0x369b85){_0x256d43=_0x369b85;_0xddb4b7['model']=_[_0x0f41('0x45')](db[_0x0f41('0x4a')][_0x0f41('0x4b')]);_0xddb4b7[_0x0f41('0x31')]=_[_0x0f41('0x45')](_0x54c5b2[_0x0f41('0x31')]);_0xddb4b7[_0x0f41('0x32')]=_['intersection'](_0xddb4b7[_0x0f41('0x30')],_0xddb4b7[_0x0f41('0x31')]);_0x13f2c3[_0x0f41('0x34')]=_['intersection'](_0xddb4b7[_0x0f41('0x30')],qs[_0x0f41('0x35')](_0x54c5b2[_0x0f41('0x31')][_0x0f41('0x35')]));_0x13f2c3[_0x0f41('0x34')]=_0x13f2c3['attributes'][_0x0f41('0x36')]?_0x13f2c3[_0x0f41('0x34')]:_0xddb4b7[_0x0f41('0x30')];_0x13f2c3[_0x0f41('0x39')]=qs[_0x0f41('0x3a')](_0x54c5b2[_0x0f41('0x31')][_0x0f41('0x3a')]);_0x13f2c3[_0x0f41('0x3b')]=qs[_0x0f41('0x32')](_[_0x0f41('0x4d')](_0x54c5b2[_0x0f41('0x31')],_0xddb4b7[_0x0f41('0x32')]));if(_0x54c5b2[_0x0f41('0x31')][_0x0f41('0x3d')]){_0x13f2c3[_0x0f41('0x3b')]=_['merge'](_0x13f2c3[_0x0f41('0x3b')],{'$or':_[_0x0f41('0x2d')](_0x13f2c3['attributes'],function(_0x132cd0){var _0x4d6b11={};_0x4d6b11[_0x132cd0]={'$like':'%'+_0x54c5b2[_0x0f41('0x31')][_0x0f41('0x3d')]+'%'};return _0x4d6b11;})});}_0x13f2c3=_[_0x0f41('0x3e')]({},_0x13f2c3,_0x54c5b2['options']);return _0x256d43['getSubjects'](_0x13f2c3);}})[_0x0f41('0x25')](function(_0x58ae84){if(_0x58ae84){_0x5405e4=_0x58ae84[_0x0f41('0x36')];if(!_0x54c5b2['query'][_0x0f41('0x37')]('nolimit')){_0x13f2c3[_0x0f41('0x1f')]=qs[_0x0f41('0x1f')](_0x54c5b2[_0x0f41('0x31')][_0x0f41('0x1f')]);_0x13f2c3[_0x0f41('0x1c')]=qs[_0x0f41('0x1c')](_0x54c5b2[_0x0f41('0x31')][_0x0f41('0x1c')]);}return _0x256d43[_0x0f41('0x4c')](_0x13f2c3);}})[_0x0f41('0x25')](function(_0x4703f4){if(_0x4703f4){return _0x4703f4?{'count':_0x5405e4,'rows':_0x4703f4}:null;}})[_0x0f41('0x25')](respondWithResult(_0x33c7da,null))[_0x0f41('0x44')](handleError(_0x33c7da,null));};exports['getDescriptions']=function(_0x48fd08,_0x5cf127,_0xd62b4d){var _0x2111dc={};var _0x49eb72={};var _0x3bb1bc;var _0x2bf4ae;return db[_0x0f41('0x2e')][_0x0f41('0x4e')]({'where':{'id':_0x48fd08[_0x0f41('0x48')]['id']}})[_0x0f41('0x25')](handleEntityNotFound(_0x5cf127,null))[_0x0f41('0x25')](function(_0x555ce8){if(_0x555ce8){_0x3bb1bc=_0x555ce8;_0x49eb72[_0x0f41('0x30')]=_[_0x0f41('0x45')](db[_0x0f41('0x4a')]['rawAttributes']);_0x49eb72[_0x0f41('0x31')]=_[_0x0f41('0x45')](_0x48fd08[_0x0f41('0x31')]);_0x49eb72[_0x0f41('0x32')]=_[_0x0f41('0x33')](_0x49eb72[_0x0f41('0x30')],_0x49eb72['query']);_0x2111dc[_0x0f41('0x34')]=_['intersection'](_0x49eb72['model'],qs[_0x0f41('0x35')](_0x48fd08[_0x0f41('0x31')]['fields']));_0x2111dc[_0x0f41('0x34')]=_0x2111dc[_0x0f41('0x34')][_0x0f41('0x36')]?_0x2111dc[_0x0f41('0x34')]:_0x49eb72[_0x0f41('0x30')];_0x2111dc['order']=qs[_0x0f41('0x3a')](_0x48fd08['query']['sort']);_0x2111dc['where']=qs[_0x0f41('0x32')](_[_0x0f41('0x4d')](_0x48fd08['query'],_0x49eb72[_0x0f41('0x32')]));if(_0x48fd08[_0x0f41('0x31')][_0x0f41('0x3d')]){_0x2111dc['where']=_[_0x0f41('0x3e')](_0x2111dc['where'],{'$or':_[_0x0f41('0x2d')](_0x2111dc[_0x0f41('0x34')],function(_0x1d5dba){var _0x138e84={};_0x138e84[_0x1d5dba]={'$like':'%'+_0x48fd08[_0x0f41('0x31')][_0x0f41('0x3d')]+'%'};return _0x138e84;})});}_0x2111dc=_['merge']({},_0x2111dc,_0x48fd08[_0x0f41('0x3f')]);return _0x3bb1bc['getDescriptions'](_0x2111dc);}})[_0x0f41('0x25')](function(_0x1a79fd){if(_0x1a79fd){_0x2bf4ae=_0x1a79fd['length'];if(!_0x48fd08[_0x0f41('0x31')][_0x0f41('0x37')]('nolimit')){_0x2111dc['limit']=qs[_0x0f41('0x1f')](_0x48fd08[_0x0f41('0x31')][_0x0f41('0x1f')]);_0x2111dc[_0x0f41('0x1c')]=qs[_0x0f41('0x1c')](_0x48fd08['query'][_0x0f41('0x1c')]);}return _0x3bb1bc[_0x0f41('0x4f')](_0x2111dc);}})[_0x0f41('0x25')](function(_0x135659){if(_0x135659){return _0x135659?{'count':_0x2bf4ae,'rows':_0x135659}:null;}})['then'](respondWithResult(_0x5cf127,null))[_0x0f41('0x44')](handleError(_0x5cf127,null));}; \ No newline at end of file +var _0x6ec2=['status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','map','VIRTUAL','filter','options','includeAll','include','findAll','params','merge','find','catch','create','body','getFields','findOne','getSubjects','Dynamics365Field','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x564dc2,_0x2539eb){var _0x10155b=function(_0x4f96f3){while(--_0x4f96f3){_0x564dc2['push'](_0x564dc2['shift']());}};_0x10155b(++_0x2539eb);}(_0x6ec2,0x170));var _0x26ec=function(_0x1267a2,_0x26094c){_0x1267a2=_0x1267a2-0x0;var _0x245cce=_0x6ec2[_0x1267a2];return _0x245cce;};'use strict';var emlformat=require(_0x26ec('0x0'));var rimraf=require(_0x26ec('0x1'));var zipdir=require(_0x26ec('0x2'));var jsonpatch=require(_0x26ec('0x3'));var rp=require(_0x26ec('0x4'));var moment=require('moment');var BPromise=require(_0x26ec('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x26ec('0x6'));var sox=require('sox');var csv=require(_0x26ec('0x7'));var ejs=require(_0x26ec('0x8'));var fs=require('fs');var fs_extra=require(_0x26ec('0x9'));var _=require(_0x26ec('0xa'));var squel=require('squel');var crypto=require(_0x26ec('0xb'));var jsforce=require(_0x26ec('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x26ec('0xd'));var Papa=require(_0x26ec('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x26ec('0xf'));var as=require(_0x26ec('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x26ec('0x11'))('api');var utils=require(_0x26ec('0x12'));var config=require(_0x26ec('0x13'));var licenseUtil=require(_0x26ec('0x14'));var db=require(_0x26ec('0x15'))['db'];function respondWithStatusCode(_0x19be97,_0x141ba9){_0x141ba9=_0x141ba9||0xcc;return function(_0x27ec17){if(_0x27ec17){return _0x19be97['sendStatus'](_0x141ba9);}return _0x19be97[_0x26ec('0x16')](_0x141ba9)[_0x26ec('0x17')]();};}function respondWithResult(_0x19be00,_0x500792){_0x500792=_0x500792||0xc8;return function(_0x511a99){if(_0x511a99){return _0x19be00[_0x26ec('0x16')](_0x500792)[_0x26ec('0x18')](_0x511a99);}};}function respondWithFilteredResult(_0xe8e47c,_0x1ac5ef){return function(_0x6b39f){if(_0x6b39f){var _0x5eab95=typeof _0x1ac5ef[_0x26ec('0x19')]===_0x26ec('0x1a')&&typeof _0x1ac5ef[_0x26ec('0x1b')]==='undefined';var _0x54b1f3=_0x6b39f[_0x26ec('0x1c')];var _0xb5d6fb=_0x5eab95?0x0:_0x1ac5ef[_0x26ec('0x19')];var _0x192553=_0x5eab95?_0x6b39f[_0x26ec('0x1c')]:_0x1ac5ef[_0x26ec('0x19')]+_0x1ac5ef[_0x26ec('0x1b')];var _0x30b103;if(_0x192553>=_0x54b1f3){_0x192553=_0x54b1f3;_0x30b103=0xc8;}else{_0x30b103=0xce;}_0xe8e47c[_0x26ec('0x16')](_0x30b103);return _0xe8e47c['set'](_0x26ec('0x1d'),_0xb5d6fb+'-'+_0x192553+'/'+_0x54b1f3)[_0x26ec('0x18')](_0x6b39f);}return null;};}function patchUpdates(_0xf16e46){return function(_0x440d83){try{jsonpatch[_0x26ec('0x1e')](_0x440d83,_0xf16e46,!![]);}catch(_0x103191){return BPromise[_0x26ec('0x1f')](_0x103191);}return _0x440d83[_0x26ec('0x20')]();};}function saveUpdates(_0x3bddf2,_0x1b21db){return function(_0x44fd59){if(_0x44fd59){return _0x44fd59[_0x26ec('0x21')](_0x3bddf2)[_0x26ec('0x22')](function(_0x5d76d9){return _0x5d76d9;});}return null;};}function removeEntity(_0x1d34d8,_0x646d0a){return function(_0x486cc1){if(_0x486cc1){return _0x486cc1[_0x26ec('0x23')]()[_0x26ec('0x22')](function(){_0x1d34d8[_0x26ec('0x16')](0xcc)[_0x26ec('0x17')]();});}};}function handleEntityNotFound(_0x5c8e0a,_0x577df4){return function(_0x5c1181){if(!_0x5c1181){_0x5c8e0a[_0x26ec('0x24')](0x194);}return _0x5c1181;};}function handleError(_0x3cb4a0,_0x2f339a){_0x2f339a=_0x2f339a||0x1f4;return function(_0x23b94d){logger['error'](_0x23b94d[_0x26ec('0x25')]);if(_0x23b94d[_0x26ec('0x26')]){delete _0x23b94d[_0x26ec('0x26')];}_0x3cb4a0['status'](_0x2f339a)[_0x26ec('0x27')](_0x23b94d);};}exports[_0x26ec('0x28')]=function(_0x50330e,_0x11cdd7){var _0x492296={},_0x1d8255={},_0x528abd={'count':0x0,'rows':[]};var _0x539d66=_['map'](db[_0x26ec('0x29')][_0x26ec('0x2a')],function(_0x37a08e){return{'name':_0x37a08e[_0x26ec('0x2b')],'type':_0x37a08e[_0x26ec('0x2c')][_0x26ec('0x2d')]};});_0x1d8255[_0x26ec('0x2e')]=_['map'](_0x539d66,'name');_0x1d8255[_0x26ec('0x2f')]=_[_0x26ec('0x30')](_0x50330e[_0x26ec('0x2f')]);_0x1d8255[_0x26ec('0x31')]=_['intersection'](_0x1d8255[_0x26ec('0x2e')],_0x1d8255['query']);_0x492296[_0x26ec('0x32')]=_[_0x26ec('0x33')](_0x1d8255['model'],qs[_0x26ec('0x34')](_0x50330e[_0x26ec('0x2f')]['fields']));_0x492296['attributes']=_0x492296[_0x26ec('0x32')][_0x26ec('0x35')]?_0x492296[_0x26ec('0x32')]:_0x1d8255[_0x26ec('0x2e')];if(!_0x50330e[_0x26ec('0x2f')][_0x26ec('0x36')](_0x26ec('0x37'))){_0x492296[_0x26ec('0x1b')]=qs['limit'](_0x50330e[_0x26ec('0x2f')]['limit']);_0x492296[_0x26ec('0x19')]=qs[_0x26ec('0x19')](_0x50330e['query'][_0x26ec('0x19')]);}_0x492296[_0x26ec('0x38')]=qs[_0x26ec('0x39')](_0x50330e[_0x26ec('0x2f')]['sort']);_0x492296['where']=qs[_0x26ec('0x31')](_[_0x26ec('0x3a')](_0x50330e[_0x26ec('0x2f')],_0x1d8255[_0x26ec('0x31')]),_0x539d66);if(_0x50330e[_0x26ec('0x2f')]['filter']){_0x492296[_0x26ec('0x3b')]=_['merge'](_0x492296['where'],{'$or':_[_0x26ec('0x3c')](_0x539d66,function(_0x184aaf){if(_0x184aaf[_0x26ec('0x2c')]!==_0x26ec('0x3d')){var _0x434e72={};_0x434e72[_0x184aaf[_0x26ec('0x26')]]={'$like':'%'+_0x50330e['query'][_0x26ec('0x3e')]+'%'};return _0x434e72;}})});}_0x492296=_['merge']({},_0x492296,_0x50330e[_0x26ec('0x3f')]);var _0xe124e2={'where':_0x492296['where']};return db[_0x26ec('0x29')][_0x26ec('0x1c')](_0xe124e2)['then'](function(_0x500456){_0x528abd['count']=_0x500456;if(_0x50330e['query'][_0x26ec('0x40')]){_0x492296[_0x26ec('0x41')]=[{'all':!![]}];}return db[_0x26ec('0x29')][_0x26ec('0x42')](_0x492296);})[_0x26ec('0x22')](function(_0x118a63){_0x528abd['rows']=_0x118a63;return _0x528abd;})[_0x26ec('0x22')](respondWithFilteredResult(_0x11cdd7,_0x492296))['catch'](handleError(_0x11cdd7,null));};exports['show']=function(_0x34b3fe,_0x54f96f){var _0x204436={'raw':![],'where':{'id':_0x34b3fe[_0x26ec('0x43')]['id']}},_0x1f3f4e={};_0x1f3f4e['model']=_[_0x26ec('0x30')](db[_0x26ec('0x29')][_0x26ec('0x2a')]);_0x1f3f4e[_0x26ec('0x2f')]=_['keys'](_0x34b3fe['query']);_0x1f3f4e['filters']=_[_0x26ec('0x33')](_0x1f3f4e[_0x26ec('0x2e')],_0x1f3f4e[_0x26ec('0x2f')]);_0x204436['attributes']=_[_0x26ec('0x33')](_0x1f3f4e[_0x26ec('0x2e')],qs['fields'](_0x34b3fe['query']['fields']));_0x204436['attributes']=_0x204436[_0x26ec('0x32')][_0x26ec('0x35')]?_0x204436[_0x26ec('0x32')]:_0x1f3f4e[_0x26ec('0x2e')];if(_0x34b3fe['query'][_0x26ec('0x40')]){_0x204436[_0x26ec('0x41')]=[{'all':!![]}];}_0x204436=_[_0x26ec('0x44')]({},_0x204436,_0x34b3fe[_0x26ec('0x3f')]);return db[_0x26ec('0x29')][_0x26ec('0x45')](_0x204436)[_0x26ec('0x22')](handleEntityNotFound(_0x54f96f,null))[_0x26ec('0x22')](respondWithResult(_0x54f96f,null))[_0x26ec('0x46')](handleError(_0x54f96f,null));};exports['create']=function(_0x349bfb,_0x10caa7){return db[_0x26ec('0x29')][_0x26ec('0x47')](_0x349bfb['body'],{})['then'](respondWithResult(_0x10caa7,0xc9))['catch'](handleError(_0x10caa7,null));};exports['update']=function(_0x1ff453,_0xda11c1){if(_0x1ff453['body']['id']){delete _0x1ff453[_0x26ec('0x48')]['id'];}return db[_0x26ec('0x29')]['find']({'where':{'id':_0x1ff453[_0x26ec('0x43')]['id']}})[_0x26ec('0x22')](handleEntityNotFound(_0xda11c1,null))[_0x26ec('0x22')](saveUpdates(_0x1ff453['body'],null))['then'](respondWithResult(_0xda11c1,null))[_0x26ec('0x46')](handleError(_0xda11c1,null));};exports['destroy']=function(_0x29dab6,_0x2e06c8){return db['Dynamics365Configuration'][_0x26ec('0x45')]({'where':{'id':_0x29dab6[_0x26ec('0x43')]['id']}})[_0x26ec('0x22')](handleEntityNotFound(_0x2e06c8,null))['then'](removeEntity(_0x2e06c8,null))['catch'](handleError(_0x2e06c8,null));};exports[_0x26ec('0x49')]=function(_0x1511b9,_0x3a86d9,_0x136c1b){var _0x35fca7={};var _0x1c25d8={};var _0x120aea;var _0x3cc4e9;return db[_0x26ec('0x29')][_0x26ec('0x4a')]({'where':{'id':_0x1511b9[_0x26ec('0x43')]['id']}})['then'](handleEntityNotFound(_0x3a86d9,null))['then'](function(_0x75352d){if(_0x75352d){_0x120aea=_0x75352d;_0x1c25d8[_0x26ec('0x2e')]=_[_0x26ec('0x30')](db['Dynamics365Field'][_0x26ec('0x2a')]);_0x1c25d8['query']=_[_0x26ec('0x30')](_0x1511b9[_0x26ec('0x2f')]);_0x1c25d8[_0x26ec('0x31')]=_[_0x26ec('0x33')](_0x1c25d8[_0x26ec('0x2e')],_0x1c25d8['query']);_0x35fca7[_0x26ec('0x32')]=_[_0x26ec('0x33')](_0x1c25d8[_0x26ec('0x2e')],qs[_0x26ec('0x34')](_0x1511b9[_0x26ec('0x2f')][_0x26ec('0x34')]));_0x35fca7[_0x26ec('0x32')]=_0x35fca7['attributes'][_0x26ec('0x35')]?_0x35fca7['attributes']:_0x1c25d8[_0x26ec('0x2e')];_0x35fca7[_0x26ec('0x38')]=qs[_0x26ec('0x39')](_0x1511b9[_0x26ec('0x2f')][_0x26ec('0x39')]);_0x35fca7[_0x26ec('0x3b')]=qs[_0x26ec('0x31')](_['pick'](_0x1511b9[_0x26ec('0x2f')],_0x1c25d8['filters']));if(_0x1511b9[_0x26ec('0x2f')][_0x26ec('0x3e')]){_0x35fca7[_0x26ec('0x3b')]=_[_0x26ec('0x44')](_0x35fca7['where'],{'$or':_[_0x26ec('0x3c')](_0x35fca7['attributes'],function(_0x2c911c){var _0x11fd2b={};_0x11fd2b[_0x2c911c]={'$like':'%'+_0x1511b9[_0x26ec('0x2f')][_0x26ec('0x3e')]+'%'};return _0x11fd2b;})});}_0x35fca7=_['merge']({},_0x35fca7,_0x1511b9[_0x26ec('0x3f')]);return _0x120aea['getFields'](_0x35fca7);}})[_0x26ec('0x22')](function(_0x10ffc9){if(_0x10ffc9){_0x3cc4e9=_0x10ffc9[_0x26ec('0x35')];if(!_0x1511b9[_0x26ec('0x2f')][_0x26ec('0x36')](_0x26ec('0x37'))){_0x35fca7[_0x26ec('0x1b')]=qs[_0x26ec('0x1b')](_0x1511b9[_0x26ec('0x2f')][_0x26ec('0x1b')]);_0x35fca7[_0x26ec('0x19')]=qs[_0x26ec('0x19')](_0x1511b9[_0x26ec('0x2f')][_0x26ec('0x19')]);}return _0x120aea['getFields'](_0x35fca7);}})['then'](function(_0x3548fe){if(_0x3548fe){return _0x3548fe?{'count':_0x3cc4e9,'rows':_0x3548fe}:null;}})[_0x26ec('0x22')](respondWithResult(_0x3a86d9,null))[_0x26ec('0x46')](handleError(_0x3a86d9,null));};exports[_0x26ec('0x4b')]=function(_0x3f6acf,_0x58634e,_0x33e5af){var _0xb2c570={};var _0x1fd471={};var _0x351829;var _0x23a627;return db[_0x26ec('0x29')][_0x26ec('0x4a')]({'where':{'id':_0x3f6acf[_0x26ec('0x43')]['id']}})[_0x26ec('0x22')](handleEntityNotFound(_0x58634e,null))['then'](function(_0x4adaa4){if(_0x4adaa4){_0x351829=_0x4adaa4;_0x1fd471[_0x26ec('0x2e')]=_[_0x26ec('0x30')](db[_0x26ec('0x4c')][_0x26ec('0x2a')]);_0x1fd471[_0x26ec('0x2f')]=_[_0x26ec('0x30')](_0x3f6acf[_0x26ec('0x2f')]);_0x1fd471[_0x26ec('0x31')]=_[_0x26ec('0x33')](_0x1fd471[_0x26ec('0x2e')],_0x1fd471[_0x26ec('0x2f')]);_0xb2c570['attributes']=_[_0x26ec('0x33')](_0x1fd471['model'],qs[_0x26ec('0x34')](_0x3f6acf[_0x26ec('0x2f')][_0x26ec('0x34')]));_0xb2c570[_0x26ec('0x32')]=_0xb2c570[_0x26ec('0x32')][_0x26ec('0x35')]?_0xb2c570[_0x26ec('0x32')]:_0x1fd471[_0x26ec('0x2e')];_0xb2c570[_0x26ec('0x38')]=qs['sort'](_0x3f6acf[_0x26ec('0x2f')][_0x26ec('0x39')]);_0xb2c570[_0x26ec('0x3b')]=qs[_0x26ec('0x31')](_['pick'](_0x3f6acf[_0x26ec('0x2f')],_0x1fd471[_0x26ec('0x31')]));if(_0x3f6acf[_0x26ec('0x2f')][_0x26ec('0x3e')]){_0xb2c570[_0x26ec('0x3b')]=_['merge'](_0xb2c570[_0x26ec('0x3b')],{'$or':_[_0x26ec('0x3c')](_0xb2c570[_0x26ec('0x32')],function(_0x11da04){var _0x40a4c4={};_0x40a4c4[_0x11da04]={'$like':'%'+_0x3f6acf[_0x26ec('0x2f')]['filter']+'%'};return _0x40a4c4;})});}_0xb2c570=_[_0x26ec('0x44')]({},_0xb2c570,_0x3f6acf['options']);return _0x351829[_0x26ec('0x4b')](_0xb2c570);}})[_0x26ec('0x22')](function(_0x28e5f7){if(_0x28e5f7){_0x23a627=_0x28e5f7[_0x26ec('0x35')];if(!_0x3f6acf['query'][_0x26ec('0x36')](_0x26ec('0x37'))){_0xb2c570[_0x26ec('0x1b')]=qs[_0x26ec('0x1b')](_0x3f6acf[_0x26ec('0x2f')][_0x26ec('0x1b')]);_0xb2c570['offset']=qs[_0x26ec('0x19')](_0x3f6acf['query'][_0x26ec('0x19')]);}return _0x351829[_0x26ec('0x4b')](_0xb2c570);}})[_0x26ec('0x22')](function(_0x1a0e98){if(_0x1a0e98){return _0x1a0e98?{'count':_0x23a627,'rows':_0x1a0e98}:null;}})['then'](respondWithResult(_0x58634e,null))[_0x26ec('0x46')](handleError(_0x58634e,null));};exports['getDescriptions']=function(_0x26c874,_0x4df7ff,_0x539b1d){var _0x50cc13={};var _0x16c775={};var _0x32f0eb;var _0x27e724;return db['Dynamics365Configuration'][_0x26ec('0x4a')]({'where':{'id':_0x26c874['params']['id']}})['then'](handleEntityNotFound(_0x4df7ff,null))[_0x26ec('0x22')](function(_0x44ea2f){if(_0x44ea2f){_0x32f0eb=_0x44ea2f;_0x16c775[_0x26ec('0x2e')]=_[_0x26ec('0x30')](db[_0x26ec('0x4c')]['rawAttributes']);_0x16c775['query']=_['keys'](_0x26c874[_0x26ec('0x2f')]);_0x16c775[_0x26ec('0x31')]=_[_0x26ec('0x33')](_0x16c775[_0x26ec('0x2e')],_0x16c775[_0x26ec('0x2f')]);_0x50cc13[_0x26ec('0x32')]=_[_0x26ec('0x33')](_0x16c775[_0x26ec('0x2e')],qs[_0x26ec('0x34')](_0x26c874['query'][_0x26ec('0x34')]));_0x50cc13['attributes']=_0x50cc13['attributes'][_0x26ec('0x35')]?_0x50cc13[_0x26ec('0x32')]:_0x16c775[_0x26ec('0x2e')];_0x50cc13[_0x26ec('0x38')]=qs[_0x26ec('0x39')](_0x26c874[_0x26ec('0x2f')][_0x26ec('0x39')]);_0x50cc13['where']=qs[_0x26ec('0x31')](_[_0x26ec('0x3a')](_0x26c874[_0x26ec('0x2f')],_0x16c775[_0x26ec('0x31')]));if(_0x26c874[_0x26ec('0x2f')][_0x26ec('0x3e')]){_0x50cc13['where']=_[_0x26ec('0x44')](_0x50cc13[_0x26ec('0x3b')],{'$or':_[_0x26ec('0x3c')](_0x50cc13[_0x26ec('0x32')],function(_0x35d6a9){var _0xadd0af={};_0xadd0af[_0x35d6a9]={'$like':'%'+_0x26c874['query'][_0x26ec('0x3e')]+'%'};return _0xadd0af;})});}_0x50cc13=_[_0x26ec('0x44')]({},_0x50cc13,_0x26c874[_0x26ec('0x3f')]);return _0x32f0eb['getDescriptions'](_0x50cc13);}})['then'](function(_0xeea83e){if(_0xeea83e){_0x27e724=_0xeea83e[_0x26ec('0x35')];if(!_0x26c874['query'][_0x26ec('0x36')](_0x26ec('0x37'))){_0x50cc13[_0x26ec('0x1b')]=qs[_0x26ec('0x1b')](_0x26c874[_0x26ec('0x2f')][_0x26ec('0x1b')]);_0x50cc13['offset']=qs['offset'](_0x26c874[_0x26ec('0x2f')][_0x26ec('0x19')]);}return _0x32f0eb[_0x26ec('0x4d')](_0x50cc13);}})[_0x26ec('0x22')](function(_0x30b432){if(_0x30b432){return _0x30b432?{'count':_0x27e724,'rows':_0x30b432}:null;}})[_0x26ec('0x22')](respondWithResult(_0x4df7ff,null))[_0x26ec('0x46')](handleError(_0x4df7ff,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index d727457..fa5cb6d 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 _0x9bde=['request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util','api','bluebird'];(function(_0x453490,_0x5a05f6){var _0x2366a3=function(_0xca49a){while(--_0xca49a){_0x453490['push'](_0x453490['shift']());}};_0x2366a3(++_0x5a05f6);}(_0x9bde,0xe1));var _0xe9bd=function(_0x2b0975,_0x5c7b92){_0x2b0975=_0x2b0975-0x0;var _0x56e1d2=_0x9bde[_0x2b0975];return _0x56e1d2;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var moment=require('moment');var BPromise=require(_0xe9bd('0x2'));var rp=require(_0xe9bd('0x3'));var fs=require('fs');var path=require(_0xe9bd('0x4'));var rimraf=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var attributes=require(_0xe9bd('0x7'));module[_0xe9bd('0x8')]=function(_0x4fd7b8,_0x4763e9){return _0x4fd7b8[_0xe9bd('0x9')](_0xe9bd('0xa'),attributes,{'tableName':_0xe9bd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4e6=['path','rimraf','./intDynamics365Configuration.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2379d2,_0x13b0cf){var _0x41069a=function(_0x1c3e16){while(--_0x1c3e16){_0x2379d2['push'](_0x2379d2['shift']());}};_0x41069a(++_0x13b0cf);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x239dba,_0x309e95){_0x239dba=_0x239dba-0x0;var _0x1ceb11=_0xb4e6[_0x239dba];return _0x1ceb11;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var logger=require(_0x6b4e('0x1'))(_0x6b4e('0x2'));var moment=require(_0x6b4e('0x3'));var BPromise=require(_0x6b4e('0x4'));var rp=require(_0x6b4e('0x5'));var fs=require('fs');var path=require(_0x6b4e('0x6'));var rimraf=require(_0x6b4e('0x7'));var config=require('../../config/environment');var attributes=require(_0x6b4e('0x8'));module[_0x6b4e('0x9')]=function(_0x1f67a2,_0x49de51){return _0x1f67a2[_0x6b4e('0xa')]('Dynamics365Configuration',attributes,{'tableName':'int_dynamics365_configurations','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 ed121cd..e432bdb 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 _0x9d40=['message','catch','lodash','util','moment','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s'];(function(_0x4a67c8,_0x2ca318){var _0xc3a1ac=function(_0xd67fe0){while(--_0xd67fe0){_0x4a67c8['push'](_0x4a67c8['shift']());}};_0xc3a1ac(++_0x2ca318);}(_0x9d40,0x106));var _0x09d4=function(_0x26426a,_0x48f29e){_0x26426a=_0x26426a-0x0;var _0x4c620b=_0x9d40[_0x26426a];return _0x4c620b;};'use strict';var _=require(_0x09d4('0x0'));var util=require(_0x09d4('0x1'));var moment=require(_0x09d4('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x09d4('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x09d4('0x4'))(_0x09d4('0x5'));var config=require(_0x09d4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x09d4('0x7')][_0x09d4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x178e59,_0x1a40fb,_0x29d281){return new BPromise(function(_0x19427c,_0x3b3925){return client[_0x09d4('0x9')](_0x178e59,_0x29d281)['then'](function(_0xa4deee){logger[_0x09d4('0xa')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1a40fb,_0x09d4('0xb'));logger[_0x09d4('0xc')](_0x09d4('0xd'),_0x1a40fb,'request\x20sent',JSON[_0x09d4('0xe')](_0xa4deee));if(_0xa4deee[_0x09d4('0xf')]){if(_0xa4deee['error'][_0x09d4('0x10')]===0x1f4){logger['error'](_0x09d4('0x11'),_0x1a40fb,_0xa4deee[_0x09d4('0xf')]['message']);return _0x3b3925(_0xa4deee[_0x09d4('0xf')][_0x09d4('0x12')]);}logger[_0x09d4('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1a40fb,_0xa4deee['error']['message']);return _0x19427c(_0xa4deee['error'][_0x09d4('0x12')]);}else{logger[_0x09d4('0xa')](_0x09d4('0x11'),_0x1a40fb,_0x09d4('0xb'));_0x19427c(_0xa4deee['result']['message']);}})[_0x09d4('0x13')](function(_0x15ff1c){logger[_0x09d4('0xf')](_0x09d4('0x11'),_0x1a40fb,_0x15ff1c);_0x3b3925(_0x15ff1c);});});} \ No newline at end of file +var _0x39c0=['info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x35df41,_0x43c1bd){var _0x419d71=function(_0x418182){while(--_0x418182){_0x35df41['push'](_0x35df41['shift']());}};_0x419d71(++_0x43c1bd);}(_0x39c0,0x195));var _0x039c=function(_0x3793cb,_0x3d0825){_0x3793cb=_0x3793cb-0x0;var _0x287f86=_0x39c0[_0x3793cb];return _0x287f86;};'use strict';var _=require(_0x039c('0x0'));var util=require(_0x039c('0x1'));var moment=require('moment');var BPromise=require(_0x039c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x039c('0x3'));var db=require(_0x039c('0x4'))['db'];var utils=require(_0x039c('0x5'));var logger=require(_0x039c('0x6'))('rpc');var config=require(_0x039c('0x7'));var jayson=require(_0x039c('0x8'));var client=jayson[_0x039c('0x9')][_0x039c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5413a0,_0x22c36b,_0x278e42){return new BPromise(function(_0x335f87,_0x1a853a){return client[_0x039c('0xb')](_0x5413a0,_0x278e42)[_0x039c('0xc')](function(_0x2100dc){logger[_0x039c('0xd')](_0x039c('0xe'),_0x22c36b,_0x039c('0xf'));logger[_0x039c('0x10')](_0x039c('0x11'),_0x22c36b,_0x039c('0xf'),JSON[_0x039c('0x12')](_0x2100dc));if(_0x2100dc[_0x039c('0x13')]){if(_0x2100dc[_0x039c('0x13')]['code']===0x1f4){logger[_0x039c('0x13')](_0x039c('0xe'),_0x22c36b,_0x2100dc[_0x039c('0x13')][_0x039c('0x14')]);return _0x1a853a(_0x2100dc[_0x039c('0x13')]['message']);}logger[_0x039c('0x13')]('Dynamics365Configuration,\x20%s,\x20%s',_0x22c36b,_0x2100dc['error'][_0x039c('0x14')]);return _0x335f87(_0x2100dc[_0x039c('0x13')][_0x039c('0x14')]);}else{logger['info'](_0x039c('0xe'),_0x22c36b,_0x039c('0xf'));_0x335f87(_0x2100dc[_0x039c('0x15')]['message']);}})['catch'](function(_0x126f45){logger[_0x039c('0x13')](_0x039c('0xe'),_0x22c36b,_0x126f45);_0x1a853a(_0x126f45);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index bfc96b2..e2c05f8 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 _0x87b6=['create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','post'];(function(_0x50e83e,_0x545ab8){var _0xa4395d=function(_0x34f71a){while(--_0x34f71a){_0x50e83e['push'](_0x50e83e['shift']());}};_0xa4395d(++_0x545ab8);}(_0x87b6,0x126));var _0x687b=function(_0x3a2fe5,_0x4f3adf){_0x3a2fe5=_0x3a2fe5-0x0;var _0x5aacd1=_0x87b6[_0x3a2fe5];return _0x5aacd1;};'use strict';var multer=require('multer');var util=require(_0x687b('0x0'));var path=require(_0x687b('0x1'));var timeout=require(_0x687b('0x2'));var express=require('express');var router=express[_0x687b('0x3')]();var fs_extra=require(_0x687b('0x4'));var auth=require(_0x687b('0x5'));var interaction=require(_0x687b('0x6'));var config=require(_0x687b('0x7'));var controller=require('./intDynamics365Field.controller');router[_0x687b('0x8')]('/',auth[_0x687b('0x9')](),controller['index']);router[_0x687b('0x8')](_0x687b('0xa'),auth[_0x687b('0x9')](),controller['show']);router[_0x687b('0xb')]('/',auth[_0x687b('0x9')](),controller[_0x687b('0xc')]);router[_0x687b('0xd')](_0x687b('0xa'),auth[_0x687b('0x9')](),controller[_0x687b('0xe')]);router[_0x687b('0xf')](_0x687b('0xa'),auth[_0x687b('0x9')](),controller[_0x687b('0x10')]);module[_0x687b('0x11')]=router; \ No newline at end of file +var _0x5ccc=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','isAuthenticated','index','/:id','post','create','put','delete','destroy','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5ccc,0x168));var _0xc5cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5ccc[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc5cc('0x0'));var util=require(_0xc5cc('0x1'));var path=require(_0xc5cc('0x2'));var timeout=require(_0xc5cc('0x3'));var express=require(_0xc5cc('0x4'));var router=express['Router']();var fs_extra=require(_0xc5cc('0x5'));var auth=require(_0xc5cc('0x6'));var interaction=require(_0xc5cc('0x7'));var config=require('../../config/environment');var controller=require(_0xc5cc('0x8'));router['get']('/',auth[_0xc5cc('0x9')](),controller[_0xc5cc('0xa')]);router['get'](_0xc5cc('0xb'),auth[_0xc5cc('0x9')](),controller['show']);router[_0xc5cc('0xc')]('/',auth[_0xc5cc('0x9')](),controller[_0xc5cc('0xd')]);router[_0xc5cc('0xe')](_0xc5cc('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xc5cc('0xf')]('/:id',auth[_0xc5cc('0x9')](),controller[_0xc5cc('0x10')]);module[_0xc5cc('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index f6a2637..b3f65cd 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 _0x7022=['customVariable','keyValue','picklist','string','STRING','variable','sequelize','exports','ENUM'];(function(_0x414dc7,_0x49eb3d){var _0x24b37f=function(_0x4d4d25){while(--_0x4d4d25){_0x414dc7['push'](_0x414dc7['shift']());}};_0x24b37f(++_0x49eb3d);}(_0x7022,0x1ec));var _0x2702=function(_0x7ea9dd,_0xdc34f8){_0x7ea9dd=_0x7ea9dd-0x0;var _0x476a9c=_0x7022[_0x7ea9dd];return _0x476a9c;};'use strict';var Sequelize=require(_0x2702('0x0'));module[_0x2702('0x1')]={'type':{'type':Sequelize[_0x2702('0x2')]('string','variable',_0x2702('0x3'),_0x2702('0x4'),_0x2702('0x5')),'defaultValue':_0x2702('0x6')},'content':{'type':Sequelize[_0x2702('0x7')]},'key':{'type':Sequelize[_0x2702('0x7')]},'keyType':{'type':Sequelize[_0x2702('0x2')](_0x2702('0x6'),_0x2702('0x8'),'customVariable')},'keyContent':{'type':Sequelize[_0x2702('0x7')]},'idField':{'type':Sequelize[_0x2702('0x7')]},'nameField':{'type':Sequelize[_0x2702('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa220=['picklist','STRING','BOOLEAN','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x1e04b5,_0x228a12){var _0x160264=function(_0x558493){while(--_0x558493){_0x1e04b5['push'](_0x1e04b5['shift']());}};_0x160264(++_0x228a12);}(_0xa220,0x81));var _0x0a22=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xa220[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require('sequelize');module[_0x0a22('0x0')]={'type':{'type':Sequelize[_0x0a22('0x1')](_0x0a22('0x2'),_0x0a22('0x3'),_0x0a22('0x4'),_0x0a22('0x5'),_0x0a22('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x0a22('0x7')]},'key':{'type':Sequelize[_0x0a22('0x7')]},'keyType':{'type':Sequelize[_0x0a22('0x1')](_0x0a22('0x2'),'variable',_0x0a22('0x4'))},'keyContent':{'type':Sequelize[_0x0a22('0x7')]},'idField':{'type':Sequelize[_0x0a22('0x7')]},'nameField':{'type':Sequelize[_0x0a22('0x7')]},'customField':{'type':Sequelize[_0x0a22('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0a22('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 0c27455..36342d7 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 _0x586a=['undefined','count','limit','apply','reject','save','then','destroy','stack','name','index','Dynamics365Field','rawAttributes','fieldName','type','keys','query','intersection','model','fields','length','attributes','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','findAll','catch','params','include','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x586a,0x144));var _0xa586=function(_0xef9ec2,_0x4c163f){_0xef9ec2=_0xef9ec2-0x0;var _0x15686c=_0x586a[_0xef9ec2];return _0x15686c;};'use strict';var emlformat=require(_0xa586('0x0'));var rimraf=require(_0xa586('0x1'));var zipdir=require(_0xa586('0x2'));var jsonpatch=require(_0xa586('0x3'));var rp=require(_0xa586('0x4'));var moment=require(_0xa586('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa586('0x6'));var util=require(_0xa586('0x7'));var path=require(_0xa586('0x8'));var sox=require('sox');var csv=require(_0xa586('0x9'));var ejs=require(_0xa586('0xa'));var fs=require('fs');var fs_extra=require(_0xa586('0xb'));var _=require('lodash');var squel=require(_0xa586('0xc'));var crypto=require(_0xa586('0xd'));var jsforce=require(_0xa586('0xe'));var deskjs=require(_0xa586('0xf'));var toCsv=require(_0xa586('0x9'));var querystring=require(_0xa586('0x10'));var Papa=require(_0xa586('0x11'));var Redis=require(_0xa586('0x12'));var authService=require(_0xa586('0x13'));var qs=require(_0xa586('0x14'));var as=require(_0xa586('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa586('0x16'))(_0xa586('0x17'));var utils=require('../../config/utils');var config=require(_0xa586('0x18'));var licenseUtil=require(_0xa586('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c75ce,_0x390b6c){_0x390b6c=_0x390b6c||0xcc;return function(_0x2152b7){if(_0x2152b7){return _0x2c75ce[_0xa586('0x1a')](_0x390b6c);}return _0x2c75ce['status'](_0x390b6c)[_0xa586('0x1b')]();};}function respondWithResult(_0xe5b484,_0x4b0c71){_0x4b0c71=_0x4b0c71||0xc8;return function(_0x3fd774){if(_0x3fd774){return _0xe5b484[_0xa586('0x1c')](_0x4b0c71)[_0xa586('0x1d')](_0x3fd774);}};}function respondWithFilteredResult(_0x1356d5,_0x44f28d){return function(_0x4aa17f){if(_0x4aa17f){var _0x2e5894=typeof _0x44f28d[_0xa586('0x1e')]==='undefined'&&typeof _0x44f28d['limit']===_0xa586('0x1f');var _0x32d46a=_0x4aa17f[_0xa586('0x20')];var _0x32dc56=_0x2e5894?0x0:_0x44f28d['offset'];var _0x55ee24=_0x2e5894?_0x4aa17f[_0xa586('0x20')]:_0x44f28d[_0xa586('0x1e')]+_0x44f28d[_0xa586('0x21')];var _0x4a3b39;if(_0x55ee24>=_0x32d46a){_0x55ee24=_0x32d46a;_0x4a3b39=0xc8;}else{_0x4a3b39=0xce;}_0x1356d5[_0xa586('0x1c')](_0x4a3b39);return _0x1356d5['set']('Content-Range',_0x32dc56+'-'+_0x55ee24+'/'+_0x32d46a)['json'](_0x4aa17f);}return null;};}function patchUpdates(_0x5d791c){return function(_0x267400){try{jsonpatch[_0xa586('0x22')](_0x267400,_0x5d791c,!![]);}catch(_0x59660f){return BPromise[_0xa586('0x23')](_0x59660f);}return _0x267400[_0xa586('0x24')]();};}function saveUpdates(_0x279e92,_0x59cd05){return function(_0x1ac837){if(_0x1ac837){return _0x1ac837['update'](_0x279e92)[_0xa586('0x25')](function(_0x28f228){return _0x28f228;});}return null;};}function removeEntity(_0x53f73d,_0x5257a8){return function(_0x2a9c00){if(_0x2a9c00){return _0x2a9c00[_0xa586('0x26')]()[_0xa586('0x25')](function(){_0x53f73d['status'](0xcc)[_0xa586('0x1b')]();});}};}function handleEntityNotFound(_0x67dedd,_0x19afd3){return function(_0x27b801){if(!_0x27b801){_0x67dedd[_0xa586('0x1a')](0x194);}return _0x27b801;};}function handleError(_0x5a64cc,_0x486875){_0x486875=_0x486875||0x1f4;return function(_0x378876){logger['error'](_0x378876[_0xa586('0x27')]);if(_0x378876[_0xa586('0x28')]){delete _0x378876[_0xa586('0x28')];}_0x5a64cc[_0xa586('0x1c')](_0x486875)['send'](_0x378876);};}exports[_0xa586('0x29')]=function(_0x2db651,_0x1c1847){var _0xbaec1={},_0x474f41={},_0xf9e4f6={'count':0x0,'rows':[]};var _0x5d9b9e=_['map'](db[_0xa586('0x2a')][_0xa586('0x2b')],function(_0x15adb9){return{'name':_0x15adb9[_0xa586('0x2c')],'type':_0x15adb9[_0xa586('0x2d')]['key']};});_0x474f41['model']=_['map'](_0x5d9b9e,_0xa586('0x28'));_0x474f41['query']=_[_0xa586('0x2e')](_0x2db651[_0xa586('0x2f')]);_0x474f41['filters']=_[_0xa586('0x30')](_0x474f41[_0xa586('0x31')],_0x474f41[_0xa586('0x2f')]);_0xbaec1['attributes']=_[_0xa586('0x30')](_0x474f41['model'],qs[_0xa586('0x32')](_0x2db651[_0xa586('0x2f')][_0xa586('0x32')]));_0xbaec1['attributes']=_0xbaec1['attributes'][_0xa586('0x33')]?_0xbaec1[_0xa586('0x34')]:_0x474f41[_0xa586('0x31')];if(!_0x2db651['query']['hasOwnProperty'](_0xa586('0x35'))){_0xbaec1[_0xa586('0x21')]=qs['limit'](_0x2db651['query'][_0xa586('0x21')]);_0xbaec1[_0xa586('0x1e')]=qs[_0xa586('0x1e')](_0x2db651['query'][_0xa586('0x1e')]);}_0xbaec1[_0xa586('0x36')]=qs[_0xa586('0x37')](_0x2db651[_0xa586('0x2f')][_0xa586('0x37')]);_0xbaec1[_0xa586('0x38')]=qs['filters'](_['pick'](_0x2db651[_0xa586('0x2f')],_0x474f41[_0xa586('0x39')]),_0x5d9b9e);if(_0x2db651[_0xa586('0x2f')][_0xa586('0x3a')]){_0xbaec1[_0xa586('0x38')]=_['merge'](_0xbaec1[_0xa586('0x38')],{'$or':_['map'](_0x5d9b9e,function(_0x4a7fe1){if(_0x4a7fe1[_0xa586('0x2d')]!==_0xa586('0x3b')){var _0x4cdb78={};_0x4cdb78[_0x4a7fe1[_0xa586('0x28')]]={'$like':'%'+_0x2db651[_0xa586('0x2f')][_0xa586('0x3a')]+'%'};return _0x4cdb78;}})});}_0xbaec1=_[_0xa586('0x3c')]({},_0xbaec1,_0x2db651[_0xa586('0x3d')]);var _0x28b0f4={'where':_0xbaec1[_0xa586('0x38')]};return db[_0xa586('0x2a')][_0xa586('0x20')](_0x28b0f4)[_0xa586('0x25')](function(_0x3854a7){_0xf9e4f6[_0xa586('0x20')]=_0x3854a7;if(_0x2db651[_0xa586('0x2f')][_0xa586('0x3e')]){_0xbaec1['include']=[{'all':!![]}];}return db[_0xa586('0x2a')][_0xa586('0x3f')](_0xbaec1);})[_0xa586('0x25')](function(_0x473f52){_0xf9e4f6['rows']=_0x473f52;return _0xf9e4f6;})[_0xa586('0x25')](respondWithFilteredResult(_0x1c1847,_0xbaec1))[_0xa586('0x40')](handleError(_0x1c1847,null));};exports['show']=function(_0x25ed7f,_0x1cf843){var _0x49a784={'raw':!![],'where':{'id':_0x25ed7f[_0xa586('0x41')]['id']}},_0x5d36b7={};_0x5d36b7['model']=_[_0xa586('0x2e')](db['Dynamics365Field'][_0xa586('0x2b')]);_0x5d36b7[_0xa586('0x2f')]=_[_0xa586('0x2e')](_0x25ed7f['query']);_0x5d36b7[_0xa586('0x39')]=_[_0xa586('0x30')](_0x5d36b7['model'],_0x5d36b7['query']);_0x49a784['attributes']=_[_0xa586('0x30')](_0x5d36b7['model'],qs[_0xa586('0x32')](_0x25ed7f[_0xa586('0x2f')]['fields']));_0x49a784[_0xa586('0x34')]=_0x49a784[_0xa586('0x34')][_0xa586('0x33')]?_0x49a784[_0xa586('0x34')]:_0x5d36b7['model'];if(_0x25ed7f[_0xa586('0x2f')][_0xa586('0x3e')]){_0x49a784[_0xa586('0x42')]=[{'all':!![]}];}_0x49a784=_[_0xa586('0x3c')]({},_0x49a784,_0x25ed7f[_0xa586('0x3d')]);return db[_0xa586('0x2a')][_0xa586('0x43')](_0x49a784)[_0xa586('0x25')](handleEntityNotFound(_0x1cf843,null))['then'](respondWithResult(_0x1cf843,null))[_0xa586('0x40')](handleError(_0x1cf843,null));};exports[_0xa586('0x44')]=function(_0x3d6964,_0x521ab7){return db[_0xa586('0x2a')]['create'](_0x3d6964[_0xa586('0x45')],{})['then'](respondWithResult(_0x521ab7,0xc9))[_0xa586('0x40')](handleError(_0x521ab7,null));};exports[_0xa586('0x46')]=function(_0x43248e,_0xacd7df){if(_0x43248e[_0xa586('0x45')]['id']){delete _0x43248e[_0xa586('0x45')]['id'];}return db[_0xa586('0x2a')][_0xa586('0x43')]({'where':{'id':_0x43248e['params']['id']}})[_0xa586('0x25')](handleEntityNotFound(_0xacd7df,null))[_0xa586('0x25')](saveUpdates(_0x43248e[_0xa586('0x45')],null))[_0xa586('0x25')](respondWithResult(_0xacd7df,null))['catch'](handleError(_0xacd7df,null));};exports[_0xa586('0x26')]=function(_0x569434,_0x468945){return db['Dynamics365Field'][_0xa586('0x43')]({'where':{'id':_0x569434[_0xa586('0x41')]['id']}})[_0xa586('0x25')](handleEntityNotFound(_0x468945,null))[_0xa586('0x25')](removeEntity(_0x468945,null))[_0xa586('0x40')](handleError(_0x468945,null));}; \ No newline at end of file +var _0xb216=['Content-Range','apply','save','then','destroy','error','stack','name','index','map','Dynamics365Field','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','show','rawAttributes','include','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status'];(function(_0x5630f7,_0x28562a){var _0x5e9a9f=function(_0x49103b){while(--_0x49103b){_0x5630f7['push'](_0x5630f7['shift']());}};_0x5e9a9f(++_0x28562a);}(_0xb216,0xbf));var _0x6b21=function(_0x5d860f,_0x467498){_0x5d860f=_0x5d860f-0x0;var _0x236490=_0xb216[_0x5d860f];return _0x236490;};'use strict';var emlformat=require(_0x6b21('0x0'));var rimraf=require(_0x6b21('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6b21('0x2'));var rp=require(_0x6b21('0x3'));var moment=require('moment');var BPromise=require(_0x6b21('0x4'));var Mustache=require('mustache');var util=require(_0x6b21('0x5'));var path=require(_0x6b21('0x6'));var sox=require(_0x6b21('0x7'));var csv=require(_0x6b21('0x8'));var ejs=require(_0x6b21('0x9'));var fs=require('fs');var fs_extra=require(_0x6b21('0xa'));var _=require(_0x6b21('0xb'));var squel=require(_0x6b21('0xc'));var crypto=require(_0x6b21('0xd'));var jsforce=require(_0x6b21('0xe'));var deskjs=require(_0x6b21('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6b21('0x10'));var Redis=require('ioredis');var authService=require(_0x6b21('0x11'));var qs=require(_0x6b21('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6b21('0x13'));var logger=require(_0x6b21('0x14'))(_0x6b21('0x15'));var utils=require(_0x6b21('0x16'));var config=require(_0x6b21('0x17'));var licenseUtil=require(_0x6b21('0x18'));var db=require(_0x6b21('0x19'))['db'];function respondWithStatusCode(_0x255d1e,_0x495100){_0x495100=_0x495100||0xcc;return function(_0x23f7e8){if(_0x23f7e8){return _0x255d1e[_0x6b21('0x1a')](_0x495100);}return _0x255d1e['status'](_0x495100)[_0x6b21('0x1b')]();};}function respondWithResult(_0x59aa6f,_0x48e7b6){_0x48e7b6=_0x48e7b6||0xc8;return function(_0x56e32c){if(_0x56e32c){return _0x59aa6f['status'](_0x48e7b6)[_0x6b21('0x1c')](_0x56e32c);}};}function respondWithFilteredResult(_0x3a2bbb,_0x5446b5){return function(_0x3621fb){if(_0x3621fb){var _0x4f521c=typeof _0x5446b5[_0x6b21('0x1d')]===_0x6b21('0x1e')&&typeof _0x5446b5[_0x6b21('0x1f')]==='undefined';var _0x37b093=_0x3621fb[_0x6b21('0x20')];var _0x5ccd12=_0x4f521c?0x0:_0x5446b5[_0x6b21('0x1d')];var _0x5afa8e=_0x4f521c?_0x3621fb[_0x6b21('0x20')]:_0x5446b5[_0x6b21('0x1d')]+_0x5446b5['limit'];var _0x252ad1;if(_0x5afa8e>=_0x37b093){_0x5afa8e=_0x37b093;_0x252ad1=0xc8;}else{_0x252ad1=0xce;}_0x3a2bbb[_0x6b21('0x21')](_0x252ad1);return _0x3a2bbb['set'](_0x6b21('0x22'),_0x5ccd12+'-'+_0x5afa8e+'/'+_0x37b093)[_0x6b21('0x1c')](_0x3621fb);}return null;};}function patchUpdates(_0x88c1a1){return function(_0x3ab736){try{jsonpatch[_0x6b21('0x23')](_0x3ab736,_0x88c1a1,!![]);}catch(_0x1bb553){return BPromise['reject'](_0x1bb553);}return _0x3ab736[_0x6b21('0x24')]();};}function saveUpdates(_0x37de43,_0xc8f689){return function(_0x47b43c){if(_0x47b43c){return _0x47b43c['update'](_0x37de43)[_0x6b21('0x25')](function(_0x2a9165){return _0x2a9165;});}return null;};}function removeEntity(_0x5f4f97,_0x18fb58){return function(_0x5b663d){if(_0x5b663d){return _0x5b663d[_0x6b21('0x26')]()[_0x6b21('0x25')](function(){_0x5f4f97[_0x6b21('0x21')](0xcc)[_0x6b21('0x1b')]();});}};}function handleEntityNotFound(_0x128ac3,_0xb49945){return function(_0x52fd6f){if(!_0x52fd6f){_0x128ac3[_0x6b21('0x1a')](0x194);}return _0x52fd6f;};}function handleError(_0x514608,_0x7093fe){_0x7093fe=_0x7093fe||0x1f4;return function(_0x5d8832){logger[_0x6b21('0x27')](_0x5d8832[_0x6b21('0x28')]);if(_0x5d8832[_0x6b21('0x29')]){delete _0x5d8832[_0x6b21('0x29')];}_0x514608[_0x6b21('0x21')](_0x7093fe)['send'](_0x5d8832);};}exports[_0x6b21('0x2a')]=function(_0x39f03d,_0x4efb5d){var _0x469217={},_0x1be2e1={},_0x105cca={'count':0x0,'rows':[]};var _0xc006ce=_[_0x6b21('0x2b')](db[_0x6b21('0x2c')]['rawAttributes'],function(_0xab9717){return{'name':_0xab9717[_0x6b21('0x2d')],'type':_0xab9717['type'][_0x6b21('0x2e')]};});_0x1be2e1[_0x6b21('0x2f')]=_[_0x6b21('0x2b')](_0xc006ce,'name');_0x1be2e1[_0x6b21('0x30')]=_[_0x6b21('0x31')](_0x39f03d[_0x6b21('0x30')]);_0x1be2e1[_0x6b21('0x32')]=_[_0x6b21('0x33')](_0x1be2e1[_0x6b21('0x2f')],_0x1be2e1['query']);_0x469217[_0x6b21('0x34')]=_[_0x6b21('0x33')](_0x1be2e1[_0x6b21('0x2f')],qs[_0x6b21('0x35')](_0x39f03d['query'][_0x6b21('0x35')]));_0x469217[_0x6b21('0x34')]=_0x469217[_0x6b21('0x34')][_0x6b21('0x36')]?_0x469217[_0x6b21('0x34')]:_0x1be2e1['model'];if(!_0x39f03d['query'][_0x6b21('0x37')](_0x6b21('0x38'))){_0x469217[_0x6b21('0x1f')]=qs['limit'](_0x39f03d[_0x6b21('0x30')][_0x6b21('0x1f')]);_0x469217[_0x6b21('0x1d')]=qs[_0x6b21('0x1d')](_0x39f03d['query'][_0x6b21('0x1d')]);}_0x469217[_0x6b21('0x39')]=qs['sort'](_0x39f03d[_0x6b21('0x30')][_0x6b21('0x3a')]);_0x469217[_0x6b21('0x3b')]=qs[_0x6b21('0x32')](_['pick'](_0x39f03d['query'],_0x1be2e1['filters']),_0xc006ce);if(_0x39f03d[_0x6b21('0x30')][_0x6b21('0x3c')]){_0x469217[_0x6b21('0x3b')]=_[_0x6b21('0x3d')](_0x469217[_0x6b21('0x3b')],{'$or':_[_0x6b21('0x2b')](_0xc006ce,function(_0x13b14b){if(_0x13b14b[_0x6b21('0x3e')]!==_0x6b21('0x3f')){var _0x59073a={};_0x59073a[_0x13b14b[_0x6b21('0x29')]]={'$like':'%'+_0x39f03d[_0x6b21('0x30')]['filter']+'%'};return _0x59073a;}})});}_0x469217=_[_0x6b21('0x3d')]({},_0x469217,_0x39f03d[_0x6b21('0x40')]);var _0x17b75f={'where':_0x469217[_0x6b21('0x3b')]};return db['Dynamics365Field'][_0x6b21('0x20')](_0x17b75f)[_0x6b21('0x25')](function(_0x247f2e){_0x105cca[_0x6b21('0x20')]=_0x247f2e;if(_0x39f03d['query'][_0x6b21('0x41')]){_0x469217['include']=[{'all':!![]}];}return db['Dynamics365Field']['findAll'](_0x469217);})[_0x6b21('0x25')](function(_0x5dcbca){_0x105cca[_0x6b21('0x42')]=_0x5dcbca;return _0x105cca;})['then'](respondWithFilteredResult(_0x4efb5d,_0x469217))[_0x6b21('0x43')](handleError(_0x4efb5d,null));};exports[_0x6b21('0x44')]=function(_0x27cfa0,_0x1b647c){var _0xd3c15={'raw':!![],'where':{'id':_0x27cfa0['params']['id']}},_0x151d23={};_0x151d23['model']=_['keys'](db[_0x6b21('0x2c')][_0x6b21('0x45')]);_0x151d23[_0x6b21('0x30')]=_['keys'](_0x27cfa0['query']);_0x151d23[_0x6b21('0x32')]=_[_0x6b21('0x33')](_0x151d23['model'],_0x151d23[_0x6b21('0x30')]);_0xd3c15[_0x6b21('0x34')]=_[_0x6b21('0x33')](_0x151d23['model'],qs['fields'](_0x27cfa0[_0x6b21('0x30')][_0x6b21('0x35')]));_0xd3c15['attributes']=_0xd3c15[_0x6b21('0x34')][_0x6b21('0x36')]?_0xd3c15[_0x6b21('0x34')]:_0x151d23[_0x6b21('0x2f')];if(_0x27cfa0[_0x6b21('0x30')][_0x6b21('0x41')]){_0xd3c15[_0x6b21('0x46')]=[{'all':!![]}];}_0xd3c15=_[_0x6b21('0x3d')]({},_0xd3c15,_0x27cfa0[_0x6b21('0x40')]);return db[_0x6b21('0x2c')][_0x6b21('0x47')](_0xd3c15)['then'](handleEntityNotFound(_0x1b647c,null))[_0x6b21('0x25')](respondWithResult(_0x1b647c,null))[_0x6b21('0x43')](handleError(_0x1b647c,null));};exports['create']=function(_0x3ebc0f,_0xce2199){return db[_0x6b21('0x2c')][_0x6b21('0x48')](_0x3ebc0f[_0x6b21('0x49')],{})[_0x6b21('0x25')](respondWithResult(_0xce2199,0xc9))[_0x6b21('0x43')](handleError(_0xce2199,null));};exports['update']=function(_0x4e508a,_0x4b6316){if(_0x4e508a[_0x6b21('0x49')]['id']){delete _0x4e508a[_0x6b21('0x49')]['id'];}return db[_0x6b21('0x2c')][_0x6b21('0x47')]({'where':{'id':_0x4e508a[_0x6b21('0x4a')]['id']}})[_0x6b21('0x25')](handleEntityNotFound(_0x4b6316,null))['then'](saveUpdates(_0x4e508a['body'],null))[_0x6b21('0x25')](respondWithResult(_0x4b6316,null))[_0x6b21('0x43')](handleError(_0x4b6316,null));};exports[_0x6b21('0x26')]=function(_0x2eba24,_0x18b535){return db[_0x6b21('0x2c')][_0x6b21('0x47')]({'where':{'id':_0x2eba24[_0x6b21('0x4a')]['id']}})[_0x6b21('0x25')](handleEntityNotFound(_0x18b535,null))[_0x6b21('0x25')](removeEntity(_0x18b535,null))[_0x6b21('0x43')](handleError(_0x18b535,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 5cd25bb..2bdbf36 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 _0xc693=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','Dynamics365Field','int_dynamics365_fields','FieldId','lodash'];(function(_0x51352f,_0x3f8caa){var _0x21db5c=function(_0x255700){while(--_0x255700){_0x51352f['push'](_0x51352f['shift']());}};_0x21db5c(++_0x3f8caa);}(_0xc693,0x1e0));var _0x3c69=function(_0x47e5db,_0x2e32ad){_0x47e5db=_0x47e5db-0x0;var _0x50716c=_0xc693[_0x47e5db];return _0x50716c;};'use strict';var _=require(_0x3c69('0x0'));var util=require(_0x3c69('0x1'));var logger=require(_0x3c69('0x2'))(_0x3c69('0x3'));var moment=require('moment');var BPromise=require(_0x3c69('0x4'));var rp=require(_0x3c69('0x5'));var fs=require('fs');var path=require(_0x3c69('0x6'));var rimraf=require(_0x3c69('0x7'));var config=require(_0x3c69('0x8'));var attributes=require('./intDynamics365Field.attributes');module[_0x3c69('0x9')]=function(_0x4dfd39,_0x67f2ff){return _0x4dfd39['define'](_0x3c69('0xa'),attributes,{'tableName':_0x3c69('0xb'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':['idField',_0x3c69('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa20e=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash'];(function(_0x39f28f,_0x352bf1){var _0x595e11=function(_0x1d9da8){while(--_0x1d9da8){_0x39f28f['push'](_0x39f28f['shift']());}};_0x595e11(++_0x352bf1);}(_0xa20e,0xba));var _0xea20=function(_0x321327,_0x4965b){_0x321327=_0x321327-0x0;var _0x33be38=_0xa20e[_0x321327];return _0x33be38;};'use strict';var _=require(_0xea20('0x0'));var util=require(_0xea20('0x1'));var logger=require(_0xea20('0x2'))(_0xea20('0x3'));var moment=require(_0xea20('0x4'));var BPromise=require(_0xea20('0x5'));var rp=require(_0xea20('0x6'));var fs=require('fs');var path=require(_0xea20('0x7'));var rimraf=require(_0xea20('0x8'));var config=require(_0xea20('0x9'));var attributes=require('./intDynamics365Field.attributes');module[_0xea20('0xa')]=function(_0x1da670,_0xb932ff){return _0x1da670[_0xea20('0xb')](_0xea20('0xc'),attributes,{'tableName':_0xea20('0xd'),'paranoid':![],'indexes':[{'name':_0xea20('0xe'),'fields':[_0xea20('0xf'),_0xea20('0x10')],'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 2ad8fa9..144fd71 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 _0xd4bd=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','message','Dynamics365Field,\x20%s,\x20%s','request\x20sent','catch','lodash','util','moment','randomstring'];(function(_0xf2662b,_0x4d8f41){var _0x257dc7=function(_0x46b1d1){while(--_0x46b1d1){_0xf2662b['push'](_0xf2662b['shift']());}};_0x257dc7(++_0x4d8f41);}(_0xd4bd,0x7a));var _0xdd4b=function(_0x5c1b26,_0x356a45){_0x5c1b26=_0x5c1b26-0x0;var _0x5253de=_0xd4bd[_0x5c1b26];return _0x5253de;};'use strict';var _=require(_0xdd4b('0x0'));var util=require(_0xdd4b('0x1'));var moment=require(_0xdd4b('0x2'));var BPromise=require('bluebird');var rs=require(_0xdd4b('0x3'));var fs=require('fs');var Redis=require(_0xdd4b('0x4'));var db=require(_0xdd4b('0x5'))['db'];var utils=require(_0xdd4b('0x6'));var logger=require(_0xdd4b('0x7'))(_0xdd4b('0x8'));var config=require(_0xdd4b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdd4b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f17fe,_0x586eeb,_0x1f7a5f){return new BPromise(function(_0x1e64cc,_0x1b27fa){return client[_0xdd4b('0xb')](_0x3f17fe,_0x1f7a5f)['then'](function(_0x4b9a7e){logger[_0xdd4b('0xc')]('Dynamics365Field,\x20%s,\x20%s',_0x586eeb,'request\x20sent');logger[_0xdd4b('0xd')](_0xdd4b('0xe'),_0x586eeb,'request\x20sent',JSON[_0xdd4b('0xf')](_0x4b9a7e));if(_0x4b9a7e[_0xdd4b('0x10')]){if(_0x4b9a7e[_0xdd4b('0x10')]['code']===0x1f4){logger[_0xdd4b('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x586eeb,_0x4b9a7e[_0xdd4b('0x10')]['message']);return _0x1b27fa(_0x4b9a7e[_0xdd4b('0x10')][_0xdd4b('0x11')]);}logger[_0xdd4b('0x10')](_0xdd4b('0x12'),_0x586eeb,_0x4b9a7e[_0xdd4b('0x10')][_0xdd4b('0x11')]);return _0x1e64cc(_0x4b9a7e[_0xdd4b('0x10')][_0xdd4b('0x11')]);}else{logger[_0xdd4b('0xc')]('Dynamics365Field,\x20%s,\x20%s',_0x586eeb,_0xdd4b('0x13'));_0x1e64cc(_0x4b9a7e['result']['message']);}})[_0xdd4b('0x14')](function(_0x379742){logger[_0xdd4b('0x10')](_0xdd4b('0x12'),_0x586eeb,_0x379742);_0x1b27fa(_0x379742);});});} \ No newline at end of file +var _0xac12=['info','Dynamics365Field,\x20%s,\x20%s','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x382a08,_0x21ebaa){var _0x431b74=function(_0x37490c){while(--_0x37490c){_0x382a08['push'](_0x382a08['shift']());}};_0x431b74(++_0x21ebaa);}(_0xac12,0x7c));var _0x2ac1=function(_0x20b631,_0x17fb71){_0x20b631=_0x20b631-0x0;var _0x3cee98=_0xac12[_0x20b631];return _0x3cee98;};'use strict';var _=require(_0x2ac1('0x0'));var util=require(_0x2ac1('0x1'));var moment=require(_0x2ac1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2ac1('0x3'));var db=require(_0x2ac1('0x4'))['db'];var utils=require(_0x2ac1('0x5'));var logger=require(_0x2ac1('0x6'))(_0x2ac1('0x7'));var config=require(_0x2ac1('0x8'));var jayson=require(_0x2ac1('0x9'));var client=jayson[_0x2ac1('0xa')][_0x2ac1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x359d5d,_0x125fb7,_0xea3fd){return new BPromise(function(_0x5e571c,_0x44a164){return client[_0x2ac1('0xc')](_0x359d5d,_0xea3fd)[_0x2ac1('0xd')](function(_0x6834cf){logger[_0x2ac1('0xe')](_0x2ac1('0xf'),_0x125fb7,'request\x20sent');logger['debug'](_0x2ac1('0x10'),_0x125fb7,_0x2ac1('0x11'),JSON[_0x2ac1('0x12')](_0x6834cf));if(_0x6834cf[_0x2ac1('0x13')]){if(_0x6834cf[_0x2ac1('0x13')]['code']===0x1f4){logger['error'](_0x2ac1('0xf'),_0x125fb7,_0x6834cf['error'][_0x2ac1('0x14')]);return _0x44a164(_0x6834cf[_0x2ac1('0x13')][_0x2ac1('0x14')]);}logger[_0x2ac1('0x13')](_0x2ac1('0xf'),_0x125fb7,_0x6834cf['error'][_0x2ac1('0x14')]);return _0x5e571c(_0x6834cf[_0x2ac1('0x13')][_0x2ac1('0x14')]);}else{logger['info'](_0x2ac1('0xf'),_0x125fb7,_0x2ac1('0x11'));_0x5e571c(_0x6834cf[_0x2ac1('0x15')]['message']);}})[_0x2ac1('0x16')](function(_0x3a779a){logger['error'](_0x2ac1('0xf'),_0x125fb7,_0x3a779a);_0x44a164(_0x3a779a);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index f90a8c3..f615337 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 _0xf650=['put','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','index','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','addConfiguration'];(function(_0xba0394,_0x2c6844){var _0x1789dd=function(_0x437c00){while(--_0x437c00){_0xba0394['push'](_0xba0394['shift']());}};_0x1789dd(++_0x2c6844);}(_0xf650,0x121));var _0x0f65=function(_0x255e23,_0x2ddd3c){_0x255e23=_0x255e23-0x0;var _0x1aaa83=_0xf650[_0x255e23];return _0x1aaa83;};'use strict';var multer=require('multer');var util=require(_0x0f65('0x0'));var path=require(_0x0f65('0x1'));var timeout=require(_0x0f65('0x2'));var express=require('express');var router=express[_0x0f65('0x3')]();var fs_extra=require(_0x0f65('0x4'));var auth=require(_0x0f65('0x5'));var interaction=require(_0x0f65('0x6'));var config=require(_0x0f65('0x7'));var controller=require(_0x0f65('0x8'));router[_0x0f65('0x9')]('/',auth['isAuthenticated'](),controller[_0x0f65('0xa')]);router[_0x0f65('0x9')](_0x0f65('0xb'),auth[_0x0f65('0xc')](),controller[_0x0f65('0xd')]);router[_0x0f65('0x9')]('/:id/configurations',auth[_0x0f65('0xc')](),controller[_0x0f65('0xe')]);router[_0x0f65('0x9')](_0x0f65('0xf'),auth[_0x0f65('0xc')](),controller[_0x0f65('0x10')]);router[_0x0f65('0x11')]('/',auth[_0x0f65('0xc')](),controller['create']);router[_0x0f65('0x11')]('/:id/configurations',auth[_0x0f65('0xc')](),controller[_0x0f65('0x12')]);router[_0x0f65('0x13')]('/:id',auth[_0x0f65('0xc')](),controller['update']);router['delete']('/:id',auth[_0x0f65('0xc')](),controller[_0x0f65('0x14')]);module[_0x0f65('0x15')]=router; \ No newline at end of file +var _0x1080=['/:id/fields','post','create','addConfiguration','put','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations'];(function(_0x123408,_0x20d332){var _0x59708a=function(_0x29b401){while(--_0x29b401){_0x123408['push'](_0x123408['shift']());}};_0x59708a(++_0x20d332);}(_0x1080,0x151));var _0x0108=function(_0x5a3911,_0x1656d0){_0x5a3911=_0x5a3911-0x0;var _0x596f1c=_0x1080[_0x5a3911];return _0x596f1c;};'use strict';var multer=require(_0x0108('0x0'));var util=require(_0x0108('0x1'));var path=require('path');var timeout=require(_0x0108('0x2'));var express=require(_0x0108('0x3'));var router=express[_0x0108('0x4')]();var fs_extra=require(_0x0108('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0108('0x6'));var config=require(_0x0108('0x7'));var controller=require(_0x0108('0x8'));router['get']('/',auth[_0x0108('0x9')](),controller[_0x0108('0xa')]);router[_0x0108('0xb')](_0x0108('0xc'),auth[_0x0108('0x9')](),controller[_0x0108('0xd')]);router[_0x0108('0xb')](_0x0108('0xe'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x0108('0xb')](_0x0108('0xf'),auth[_0x0108('0x9')](),controller['getFields']);router[_0x0108('0x10')]('/',auth[_0x0108('0x9')](),controller[_0x0108('0x11')]);router['post'](_0x0108('0xe'),auth[_0x0108('0x9')](),controller[_0x0108('0x12')]);router[_0x0108('0x13')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x0108('0xc'),auth['isAuthenticated'](),controller[_0x0108('0x14')]);module[_0x0108('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index a8b9660..5f5fa33 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 _0x1967=['STRING','username','remoteUri','exports'];(function(_0x253476,_0x16b31a){var _0x134271=function(_0x20623c){while(--_0x20623c){_0x253476['push'](_0x253476['shift']());}};_0x134271(++_0x16b31a);}(_0x1967,0x173));var _0x7196=function(_0x1f7e88,_0x9007aa){_0x1f7e88=_0x1f7e88-0x0;var _0xb6f19b=_0x1967[_0x1f7e88];return _0xb6f19b;};'use strict';var Sequelize=require('sequelize');module[_0x7196('0x0')]={'name':{'type':Sequelize[_0x7196('0x1')]},'description':{'type':Sequelize[_0x7196('0x1')]},'username':{'type':Sequelize[_0x7196('0x1')],'unique':_0x7196('0x2')},'apiKey':{'type':Sequelize[_0x7196('0x1')]},'remoteUri':{'type':Sequelize[_0x7196('0x1')],'unique':_0x7196('0x3')},'serverUrl':{'type':Sequelize[_0x7196('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x3266=['remoteUri','sequelize','exports','STRING','username'];(function(_0x4fab09,_0x2e343b){var _0xf457df=function(_0x72447b){while(--_0x72447b){_0x4fab09['push'](_0x4fab09['shift']());}};_0xf457df(++_0x2e343b);}(_0x3266,0x6a));var _0x6326=function(_0x2fee96,_0x2f735d){_0x2fee96=_0x2fee96-0x0;var _0x2e6ad1=_0x3266[_0x2fee96];return _0x2e6ad1;};'use strict';var Sequelize=require(_0x6326('0x0'));module[_0x6326('0x1')]={'name':{'type':Sequelize[_0x6326('0x2')]},'description':{'type':Sequelize[_0x6326('0x2')]},'username':{'type':Sequelize[_0x6326('0x2')],'unique':_0x6326('0x3')},'apiKey':{'type':Sequelize[_0x6326('0x2')]},'remoteUri':{'type':Sequelize[_0x6326('0x2')],'unique':_0x6326('0x4')},'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 feeb8f5..a70ef54 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 _0x477a=['getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','FreshdeskField','Descriptions','getFields','remoteUri','slice','substring','GET','%s/%s','api/v2/ticket_fields','format','Basic\x20%s','%s:X','apiKey','toString','base64','requester','agent','priority','group','source','remove','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','then','error','name','send','index','map','FreshdeskAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0x477a,0x1e2));var _0xa477=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x477a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xa477('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa477('0x1'));var jsonpatch=require(_0xa477('0x2'));var rp=require('request-promise');var moment=require(_0xa477('0x3'));var BPromise=require(_0xa477('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa477('0x5'));var sox=require(_0xa477('0x6'));var csv=require('to-csv');var ejs=require(_0xa477('0x7'));var fs=require('fs');var fs_extra=require(_0xa477('0x8'));var _=require(_0xa477('0x9'));var squel=require(_0xa477('0xa'));var crypto=require(_0xa477('0xb'));var jsforce=require(_0xa477('0xc'));var deskjs=require(_0xa477('0xd'));var toCsv=require(_0xa477('0xe'));var querystring=require(_0xa477('0xf'));var Papa=require('papaparse');var Redis=require(_0xa477('0x10'));var authService=require(_0xa477('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xa477('0x12'));var config=require(_0xa477('0x13'));var licenseUtil=require(_0xa477('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0xa477('0x15'));function respondWithStatusCode(_0x3d2a17,_0x70e1c1){_0x70e1c1=_0x70e1c1||0xcc;return function(_0x5e09ef){if(_0x5e09ef){return _0x3d2a17[_0xa477('0x16')](_0x70e1c1);}return _0x3d2a17[_0xa477('0x17')](_0x70e1c1)[_0xa477('0x18')]();};}function respondWithResult(_0x185c76,_0xe878a){_0xe878a=_0xe878a||0xc8;return function(_0x484706){if(_0x484706){return _0x185c76[_0xa477('0x17')](_0xe878a)[_0xa477('0x19')](_0x484706);}};}function respondWithFilteredResult(_0xa607d0,_0x45ecc1){return function(_0x22a156){if(_0x22a156){var _0x1659cb=typeof _0x45ecc1[_0xa477('0x1a')]===_0xa477('0x1b')&&typeof _0x45ecc1[_0xa477('0x1c')]===_0xa477('0x1b');var _0xc21f88=_0x22a156[_0xa477('0x1d')];var _0xd9cdae=_0x1659cb?0x0:_0x45ecc1['offset'];var _0x6d645=_0x1659cb?_0x22a156[_0xa477('0x1d')]:_0x45ecc1[_0xa477('0x1a')]+_0x45ecc1[_0xa477('0x1c')];var _0x4596bd;if(_0x6d645>=_0xc21f88){_0x6d645=_0xc21f88;_0x4596bd=0xc8;}else{_0x4596bd=0xce;}_0xa607d0[_0xa477('0x17')](_0x4596bd);return _0xa607d0[_0xa477('0x1e')](_0xa477('0x1f'),_0xd9cdae+'-'+_0x6d645+'/'+_0xc21f88)['json'](_0x22a156);}return null;};}function patchUpdates(_0x434ef1){return function(_0x240956){try{jsonpatch[_0xa477('0x20')](_0x240956,_0x434ef1,!![]);}catch(_0x5ed526){return BPromise['reject'](_0x5ed526);}return _0x240956['save']();};}function saveUpdates(_0x14d01e,_0x2debae){return function(_0x571501){if(_0x571501){return _0x571501[_0xa477('0x21')](_0x14d01e)['then'](function(_0x5b6e98){return _0x5b6e98;});}return null;};}function removeEntity(_0x7aa4ac,_0x166694){return function(_0x1bb568){if(_0x1bb568){return _0x1bb568[_0xa477('0x22')]()[_0xa477('0x23')](function(){_0x7aa4ac[_0xa477('0x17')](0xcc)[_0xa477('0x18')]();});}};}function handleEntityNotFound(_0x48209e,_0x3cafd9){return function(_0x1e444e){if(!_0x1e444e){_0x48209e[_0xa477('0x16')](0x194);}return _0x1e444e;};}function handleError(_0x236416,_0x18e8c3){_0x18e8c3=_0x18e8c3||0x1f4;return function(_0x27ec39){logger[_0xa477('0x24')](_0x27ec39['stack']);if(_0x27ec39[_0xa477('0x25')]){delete _0x27ec39[_0xa477('0x25')];}_0x236416[_0xa477('0x17')](_0x18e8c3)[_0xa477('0x26')](_0x27ec39);};}exports[_0xa477('0x27')]=function(_0xdb15a9,_0x14b0e8){var _0x5aed5d={},_0x169089={},_0x5819c8={'count':0x0,'rows':[]};var _0x599371=_[_0xa477('0x28')](db[_0xa477('0x29')]['rawAttributes'],function(_0x15e476){return{'name':_0x15e476[_0xa477('0x2a')],'type':_0x15e476[_0xa477('0x2b')][_0xa477('0x2c')]};});_0x169089[_0xa477('0x2d')]=_[_0xa477('0x28')](_0x599371,_0xa477('0x25'));_0x169089[_0xa477('0x2e')]=_[_0xa477('0x2f')](_0xdb15a9[_0xa477('0x2e')]);_0x169089[_0xa477('0x30')]=_[_0xa477('0x31')](_0x169089[_0xa477('0x2d')],_0x169089['query']);_0x5aed5d[_0xa477('0x32')]=_[_0xa477('0x31')](_0x169089[_0xa477('0x2d')],qs[_0xa477('0x33')](_0xdb15a9[_0xa477('0x2e')][_0xa477('0x33')]));_0x5aed5d[_0xa477('0x32')]=_0x5aed5d[_0xa477('0x32')]['length']?_0x5aed5d[_0xa477('0x32')]:_0x169089[_0xa477('0x2d')];if(!_0xdb15a9[_0xa477('0x2e')][_0xa477('0x34')](_0xa477('0x35'))){_0x5aed5d[_0xa477('0x1c')]=qs[_0xa477('0x1c')](_0xdb15a9[_0xa477('0x2e')][_0xa477('0x1c')]);_0x5aed5d[_0xa477('0x1a')]=qs[_0xa477('0x1a')](_0xdb15a9[_0xa477('0x2e')][_0xa477('0x1a')]);}_0x5aed5d[_0xa477('0x36')]=qs[_0xa477('0x37')](_0xdb15a9[_0xa477('0x2e')][_0xa477('0x37')]);_0x5aed5d[_0xa477('0x38')]=qs[_0xa477('0x30')](_['pick'](_0xdb15a9[_0xa477('0x2e')],_0x169089[_0xa477('0x30')]),_0x599371);if(_0xdb15a9[_0xa477('0x2e')][_0xa477('0x39')]){_0x5aed5d[_0xa477('0x38')]=_[_0xa477('0x3a')](_0x5aed5d['where'],{'$or':_['map'](_0x599371,function(_0x3065e7){if(_0x3065e7[_0xa477('0x2b')]!==_0xa477('0x3b')){var _0x764cef={};_0x764cef[_0x3065e7['name']]={'$like':'%'+_0xdb15a9['query'][_0xa477('0x39')]+'%'};return _0x764cef;}})});}_0x5aed5d=_[_0xa477('0x3a')]({},_0x5aed5d,_0xdb15a9[_0xa477('0x3c')]);var _0x3db1a6={'where':_0x5aed5d[_0xa477('0x38')]};return db[_0xa477('0x29')][_0xa477('0x1d')](_0x3db1a6)[_0xa477('0x23')](function(_0x365f1a){_0x5819c8['count']=_0x365f1a;if(_0xdb15a9[_0xa477('0x2e')][_0xa477('0x3d')]){_0x5aed5d[_0xa477('0x3e')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0xa477('0x3f')](_0x5aed5d);})['then'](function(_0x3d9ba0){_0x5819c8[_0xa477('0x40')]=_0x3d9ba0;return _0x5819c8;})['then'](respondWithFilteredResult(_0x14b0e8,_0x5aed5d))[_0xa477('0x41')](handleError(_0x14b0e8,null));};exports[_0xa477('0x42')]=function(_0x5c1e58,_0x240ad9){var _0x37f18c={'raw':![],'where':{'id':_0x5c1e58[_0xa477('0x43')]['id']}},_0x289080={};_0x289080[_0xa477('0x2d')]=_[_0xa477('0x2f')](db[_0xa477('0x29')][_0xa477('0x44')]);_0x289080[_0xa477('0x2e')]=_[_0xa477('0x2f')](_0x5c1e58['query']);_0x289080[_0xa477('0x30')]=_[_0xa477('0x31')](_0x289080[_0xa477('0x2d')],_0x289080[_0xa477('0x2e')]);_0x37f18c[_0xa477('0x32')]=_['intersection'](_0x289080[_0xa477('0x2d')],qs['fields'](_0x5c1e58[_0xa477('0x2e')][_0xa477('0x33')]));_0x37f18c[_0xa477('0x32')]=_0x37f18c['attributes'][_0xa477('0x45')]?_0x37f18c[_0xa477('0x32')]:_0x289080[_0xa477('0x2d')];if(_0x5c1e58[_0xa477('0x2e')][_0xa477('0x3d')]){_0x37f18c[_0xa477('0x3e')]=[{'all':!![]}];}_0x37f18c=_[_0xa477('0x3a')]({},_0x37f18c,_0x5c1e58[_0xa477('0x3c')]);return db[_0xa477('0x29')][_0xa477('0x46')](_0x37f18c)[_0xa477('0x23')](handleEntityNotFound(_0x240ad9,null))['then'](respondWithResult(_0x240ad9,null))[_0xa477('0x41')](handleError(_0x240ad9,null));};exports[_0xa477('0x47')]=function(_0xeacd33,_0x545410){return db[_0xa477('0x29')][_0xa477('0x47')](_0xeacd33['body'],{})[_0xa477('0x23')](respondWithResult(_0x545410,0xc9))[_0xa477('0x41')](handleError(_0x545410,null));};exports[_0xa477('0x21')]=function(_0x543a19,_0xcb8c41){if(_0x543a19['body']['id']){delete _0x543a19[_0xa477('0x48')]['id'];}return db['FreshdeskAccount'][_0xa477('0x46')]({'where':{'id':_0x543a19[_0xa477('0x43')]['id']}})[_0xa477('0x23')](handleEntityNotFound(_0xcb8c41,null))[_0xa477('0x23')](saveUpdates(_0x543a19['body'],null))[_0xa477('0x23')](respondWithResult(_0xcb8c41,null))[_0xa477('0x41')](handleError(_0xcb8c41,null));};exports[_0xa477('0x22')]=function(_0x59b17a,_0x4fb38b){return db[_0xa477('0x29')][_0xa477('0x46')]({'where':{'id':_0x59b17a[_0xa477('0x43')]['id']}})[_0xa477('0x23')](handleEntityNotFound(_0x4fb38b,null))[_0xa477('0x23')](removeEntity(_0x4fb38b,null))[_0xa477('0x41')](handleError(_0x4fb38b,null));};exports[_0xa477('0x49')]=function(_0x3f03c0,_0x596eb5,_0x53e55e){var _0x4052e0={};var _0x16f491={};var _0x2c1d27;var _0xadf7b9;return db[_0xa477('0x29')][_0xa477('0x4a')]({'where':{'id':_0x3f03c0['params']['id']}})[_0xa477('0x23')](handleEntityNotFound(_0x596eb5,null))[_0xa477('0x23')](function(_0x219417){if(_0x219417){_0x2c1d27=_0x219417;_0x16f491[_0xa477('0x2d')]=_[_0xa477('0x2f')](db[_0xa477('0x4b')][_0xa477('0x44')]);_0x16f491['query']=_['keys'](_0x3f03c0[_0xa477('0x2e')]);_0x16f491[_0xa477('0x30')]=_[_0xa477('0x31')](_0x16f491['model'],_0x16f491[_0xa477('0x2e')]);_0x4052e0[_0xa477('0x32')]=_[_0xa477('0x31')](_0x16f491['model'],qs[_0xa477('0x33')](_0x3f03c0[_0xa477('0x2e')][_0xa477('0x33')]));_0x4052e0[_0xa477('0x32')]=_0x4052e0[_0xa477('0x32')][_0xa477('0x45')]?_0x4052e0[_0xa477('0x32')]:_0x16f491[_0xa477('0x2d')];_0x4052e0['order']=qs['sort'](_0x3f03c0[_0xa477('0x2e')][_0xa477('0x37')]);_0x4052e0[_0xa477('0x38')]=qs[_0xa477('0x30')](_['pick'](_0x3f03c0['query'],_0x16f491[_0xa477('0x30')]));if(_0x3f03c0[_0xa477('0x2e')][_0xa477('0x39')]){_0x4052e0[_0xa477('0x38')]=_['merge'](_0x4052e0[_0xa477('0x38')],{'$or':_['map'](_0x4052e0['attributes'],function(_0x460ccf){var _0x2e20ca={};_0x2e20ca[_0x460ccf]={'$like':'%'+_0x3f03c0[_0xa477('0x2e')]['filter']+'%'};return _0x2e20ca;})});}_0x4052e0=_[_0xa477('0x3a')]({},_0x4052e0,_0x3f03c0['options']);return _0x2c1d27[_0xa477('0x49')](_0x4052e0);}})['then'](function(_0x1a0b6b){if(_0x1a0b6b){_0xadf7b9=_0x1a0b6b[_0xa477('0x45')];if(!_0x3f03c0[_0xa477('0x2e')]['hasOwnProperty'](_0xa477('0x35'))){_0x4052e0[_0xa477('0x1c')]=qs[_0xa477('0x1c')](_0x3f03c0[_0xa477('0x2e')][_0xa477('0x1c')]);_0x4052e0[_0xa477('0x1a')]=qs[_0xa477('0x1a')](_0x3f03c0[_0xa477('0x2e')]['offset']);}return _0x2c1d27[_0xa477('0x49')](_0x4052e0);}})[_0xa477('0x23')](function(_0x31cde3){if(_0x31cde3){return _0x31cde3?{'count':_0xadf7b9,'rows':_0x31cde3}:null;}})[_0xa477('0x23')](respondWithResult(_0x596eb5,null))['catch'](handleError(_0x596eb5,null));};exports[_0xa477('0x4c')]=function(_0x5a4eb2,_0x48189b,_0x3df3bf){if(_0x5a4eb2[_0xa477('0x48')]['id']){delete _0x5a4eb2['body']['id'];}return db[_0xa477('0x29')][_0xa477('0x4a')]({'where':{'id':_0x5a4eb2[_0xa477('0x43')]['id']}})['then'](handleEntityNotFound(_0x48189b,null))[_0xa477('0x23')](function(_0x578d64){if(_0x578d64){_0x5a4eb2[_0xa477('0x48')][_0xa477('0x4d')]=_0x578d64['id'];_0x5a4eb2[_0xa477('0x48')][_0xa477('0x4e')]=integrations[_0xa477('0x4f')](_0x5a4eb2['body']['channel'],_0x5a4eb2[_0xa477('0x48')][_0xa477('0x2b')]);_0x5a4eb2[_0xa477('0x48')]['Descriptions']=integrations[_0xa477('0x50')](_0x5a4eb2['body']['channel'],_0x5a4eb2[_0xa477('0x48')]['type']);return db['FreshdeskConfiguration']['create'](_0x5a4eb2[_0xa477('0x48')],{'include':[{'model':db[_0xa477('0x51')],'as':_0xa477('0x4e')},{'model':db[_0xa477('0x51')],'as':_0xa477('0x52')}]});}return null;})[_0xa477('0x23')](respondWithResult(_0x48189b,null))['catch'](handleError(_0x48189b,null));};exports[_0xa477('0x53')]=function(_0x3378a1,_0x1254fd,_0x4eb045){var _0x2b9139='';return db[_0xa477('0x29')][_0xa477('0x4a')]({'where':{'id':_0x3378a1['params']['id']},'attributes':['id','remoteUri','apiKey']})['then'](handleEntityNotFound(_0x1254fd,null))[_0xa477('0x23')](function(_0x452834){if(_0x452834){_0x2b9139=_0x452834[_0xa477('0x54')];var _0x1a48a4=_0x2b9139[_0xa477('0x55')](-0x1);if(_0x1a48a4==='/'){_0x2b9139=_0x2b9139[_0xa477('0x56')](0x0,_0x2b9139['lastIndexOf'](_0x1a48a4));}return rp({'method':_0xa477('0x57'),'uri':util['format'](_0xa477('0x58'),_0x2b9139,_0xa477('0x59')),'headers':{'Authorization':util[_0xa477('0x5a')](_0xa477('0x5b'),new Buffer(util[_0xa477('0x5a')](_0xa477('0x5c'),_0x452834[_0xa477('0x5d')]))[_0xa477('0x5e')](_0xa477('0x5f')))},'json':!![]});}})['then'](function(_0x16fcec){if(_0x16fcec){var _0x47be0a=[_0xa477('0x60'),'subject',_0xa477('0x61'),'description',_0xa477('0x17'),_0xa477('0x62'),_0xa477('0x63'),_0xa477('0x64'),'ticket_type',_0xa477('0x63'),'company'];_[_0xa477('0x65')](_0x16fcec,function(_0x3c8b35){return _0x47be0a['includes'](_0x3c8b35[_0xa477('0x25')])||!_0x3c8b35[_0xa477('0x66')]&&_0x3c8b35[_0xa477('0x2b')]!==_0xa477('0x67')&&_0x3c8b35['type']!==_0xa477('0x68');});return{'count':_0x16fcec[_0xa477('0x45')],'rows':_[_0xa477('0x28')](_0x16fcec,function(_0x4596ce){return{'id':_0x4596ce[_0xa477('0x25')],'name':_0x4596ce[_0xa477('0x69')],'custom':!_0x4596ce[_0xa477('0x66')],'options':_0x4596ce['choices']?_[_0xa477('0x28')](_0x4596ce[_0xa477('0x6a')],function(_0x7a28a7){return{'name':_[_0xa477('0x6b')](_0x7a28a7),'value':_0x7a28a7};}):[]};})};}})['then'](respondWithResult(_0x1254fd,null))[_0xa477('0x41')](function(_0x23dd79){var _0xa25710=_0x3378a1[_0xa477('0x2e')][_0xa477('0x6c')]?0x1f4:_0x23dd79[_0xa477('0x6d')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xa477('0x53'),_0xa25710,JSON['stringify'](_0x23dd79));delete _0x23dd79['name'];if(_0xa25710===0x191){_0xa25710=0x190;}_0x1254fd[_0xa477('0x17')](_0xa25710)[_0xa477('0x26')](_0x3378a1[_0xa477('0x2e')][_0xa477('0x6c')]?{'message':_0xa477('0x6e'),'statusCode':_0x23dd79[_0xa477('0x6d')]}:_0x23dd79);});}; \ No newline at end of file +var _0x574d=['destroy','name','index','map','FreshdeskAccount','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','create','body','find','getConfigurations','findOne','FreshdeskConfiguration','nolimit','addConfiguration','AccountId','getSubjects','channel','type','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','Basic\x20%s','%s:X','base64','requester','subject','description','priority','group','source','ticket_type','company','remove','default','choices','capitalize','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','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','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','then'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x574d,0xc0));var _0xd574=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x574d[_0x2235bf];return _0x4c3a64;};'use strict';var emlformat=require(_0xd574('0x0'));var rimraf=require(_0xd574('0x1'));var zipdir=require(_0xd574('0x2'));var jsonpatch=require(_0xd574('0x3'));var rp=require(_0xd574('0x4'));var moment=require(_0xd574('0x5'));var BPromise=require(_0xd574('0x6'));var Mustache=require('mustache');var util=require(_0xd574('0x7'));var path=require(_0xd574('0x8'));var sox=require(_0xd574('0x9'));var csv=require(_0xd574('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd574('0xb'));var _=require(_0xd574('0xc'));var squel=require(_0xd574('0xd'));var crypto=require(_0xd574('0xe'));var jsforce=require(_0xd574('0xf'));var deskjs=require(_0xd574('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd574('0x11'));var Redis=require(_0xd574('0x12'));var authService=require(_0xd574('0x13'));var qs=require(_0xd574('0x14'));var as=require(_0xd574('0x15'));var hardwareService=require(_0xd574('0x16'));var logger=require(_0xd574('0x17'))('api');var utils=require(_0xd574('0x18'));var config=require(_0xd574('0x19'));var licenseUtil=require(_0xd574('0x1a'));var db=require(_0xd574('0x1b'))['db'];var integrations=require(_0xd574('0x1c'));function respondWithStatusCode(_0x6c93de,_0x8dd760){_0x8dd760=_0x8dd760||0xcc;return function(_0x2a4dd4){if(_0x2a4dd4){return _0x6c93de[_0xd574('0x1d')](_0x8dd760);}return _0x6c93de[_0xd574('0x1e')](_0x8dd760)[_0xd574('0x1f')]();};}function respondWithResult(_0x2cc660,_0x564b36){_0x564b36=_0x564b36||0xc8;return function(_0xb44f5d){if(_0xb44f5d){return _0x2cc660[_0xd574('0x1e')](_0x564b36)[_0xd574('0x20')](_0xb44f5d);}};}function respondWithFilteredResult(_0x1537f4,_0x46fb4c){return function(_0x341463){if(_0x341463){var _0x137917=typeof _0x46fb4c[_0xd574('0x21')]==='undefined'&&typeof _0x46fb4c['limit']===_0xd574('0x22');var _0x343aa9=_0x341463[_0xd574('0x23')];var _0x48fd46=_0x137917?0x0:_0x46fb4c['offset'];var _0x91c627=_0x137917?_0x341463[_0xd574('0x23')]:_0x46fb4c[_0xd574('0x21')]+_0x46fb4c[_0xd574('0x24')];var _0x1c899f;if(_0x91c627>=_0x343aa9){_0x91c627=_0x343aa9;_0x1c899f=0xc8;}else{_0x1c899f=0xce;}_0x1537f4[_0xd574('0x1e')](_0x1c899f);return _0x1537f4[_0xd574('0x25')](_0xd574('0x26'),_0x48fd46+'-'+_0x91c627+'/'+_0x343aa9)[_0xd574('0x20')](_0x341463);}return null;};}function patchUpdates(_0x9f980d){return function(_0x35c2bb){try{jsonpatch['apply'](_0x35c2bb,_0x9f980d,!![]);}catch(_0x2b6647){return BPromise[_0xd574('0x27')](_0x2b6647);}return _0x35c2bb['save']();};}function saveUpdates(_0x39c39d,_0x5e5b9f){return function(_0x22d451){if(_0x22d451){return _0x22d451[_0xd574('0x28')](_0x39c39d)[_0xd574('0x29')](function(_0x3f85cf){return _0x3f85cf;});}return null;};}function removeEntity(_0x1aec00,_0x72d2b8){return function(_0x25751e){if(_0x25751e){return _0x25751e[_0xd574('0x2a')]()[_0xd574('0x29')](function(){_0x1aec00[_0xd574('0x1e')](0xcc)[_0xd574('0x1f')]();});}};}function handleEntityNotFound(_0x44ddae,_0x3e0501){return function(_0x39f5be){if(!_0x39f5be){_0x44ddae['sendStatus'](0x194);}return _0x39f5be;};}function handleError(_0x441f13,_0x53142f){_0x53142f=_0x53142f||0x1f4;return function(_0x1dcd2f){logger['error'](_0x1dcd2f['stack']);if(_0x1dcd2f[_0xd574('0x2b')]){delete _0x1dcd2f[_0xd574('0x2b')];}_0x441f13[_0xd574('0x1e')](_0x53142f)['send'](_0x1dcd2f);};}exports[_0xd574('0x2c')]=function(_0x30e49e,_0x8eefda){var _0x9761f5={},_0x508eaa={},_0x5298d7={'count':0x0,'rows':[]};var _0x130b6d=_[_0xd574('0x2d')](db[_0xd574('0x2e')][_0xd574('0x2f')],function(_0x1e65b5){return{'name':_0x1e65b5[_0xd574('0x30')],'type':_0x1e65b5['type']['key']};});_0x508eaa[_0xd574('0x31')]=_[_0xd574('0x2d')](_0x130b6d,_0xd574('0x2b'));_0x508eaa[_0xd574('0x32')]=_[_0xd574('0x33')](_0x30e49e[_0xd574('0x32')]);_0x508eaa[_0xd574('0x34')]=_[_0xd574('0x35')](_0x508eaa['model'],_0x508eaa['query']);_0x9761f5[_0xd574('0x36')]=_[_0xd574('0x35')](_0x508eaa[_0xd574('0x31')],qs[_0xd574('0x37')](_0x30e49e[_0xd574('0x32')]['fields']));_0x9761f5[_0xd574('0x36')]=_0x9761f5[_0xd574('0x36')][_0xd574('0x38')]?_0x9761f5[_0xd574('0x36')]:_0x508eaa[_0xd574('0x31')];if(!_0x30e49e[_0xd574('0x32')][_0xd574('0x39')]('nolimit')){_0x9761f5[_0xd574('0x24')]=qs['limit'](_0x30e49e[_0xd574('0x32')][_0xd574('0x24')]);_0x9761f5[_0xd574('0x21')]=qs[_0xd574('0x21')](_0x30e49e[_0xd574('0x32')][_0xd574('0x21')]);}_0x9761f5[_0xd574('0x3a')]=qs[_0xd574('0x3b')](_0x30e49e[_0xd574('0x32')][_0xd574('0x3b')]);_0x9761f5[_0xd574('0x3c')]=qs['filters'](_[_0xd574('0x3d')](_0x30e49e[_0xd574('0x32')],_0x508eaa[_0xd574('0x34')]),_0x130b6d);if(_0x30e49e['query'][_0xd574('0x3e')]){_0x9761f5[_0xd574('0x3c')]=_[_0xd574('0x3f')](_0x9761f5[_0xd574('0x3c')],{'$or':_[_0xd574('0x2d')](_0x130b6d,function(_0x445068){if(_0x445068['type']!==_0xd574('0x40')){var _0x36e814={};_0x36e814[_0x445068[_0xd574('0x2b')]]={'$like':'%'+_0x30e49e[_0xd574('0x32')][_0xd574('0x3e')]+'%'};return _0x36e814;}})});}_0x9761f5=_['merge']({},_0x9761f5,_0x30e49e[_0xd574('0x41')]);var _0x34908f={'where':_0x9761f5[_0xd574('0x3c')]};return db['FreshdeskAccount']['count'](_0x34908f)['then'](function(_0x3322e2){_0x5298d7['count']=_0x3322e2;if(_0x30e49e['query']['includeAll']){_0x9761f5[_0xd574('0x42')]=[{'all':!![]}];}return db[_0xd574('0x2e')][_0xd574('0x43')](_0x9761f5);})[_0xd574('0x29')](function(_0x5b64ab){_0x5298d7[_0xd574('0x44')]=_0x5b64ab;return _0x5298d7;})[_0xd574('0x29')](respondWithFilteredResult(_0x8eefda,_0x9761f5))[_0xd574('0x45')](handleError(_0x8eefda,null));};exports[_0xd574('0x46')]=function(_0x4a580c,_0x1bf7c5){var _0x4caf06={'raw':![],'where':{'id':_0x4a580c[_0xd574('0x47')]['id']}},_0x4621ac={};_0x4621ac[_0xd574('0x31')]=_[_0xd574('0x33')](db[_0xd574('0x2e')][_0xd574('0x2f')]);_0x4621ac[_0xd574('0x32')]=_[_0xd574('0x33')](_0x4a580c[_0xd574('0x32')]);_0x4621ac[_0xd574('0x34')]=_[_0xd574('0x35')](_0x4621ac[_0xd574('0x31')],_0x4621ac[_0xd574('0x32')]);_0x4caf06['attributes']=_[_0xd574('0x35')](_0x4621ac['model'],qs['fields'](_0x4a580c[_0xd574('0x32')][_0xd574('0x37')]));_0x4caf06['attributes']=_0x4caf06[_0xd574('0x36')][_0xd574('0x38')]?_0x4caf06[_0xd574('0x36')]:_0x4621ac['model'];if(_0x4a580c[_0xd574('0x32')][_0xd574('0x48')]){_0x4caf06[_0xd574('0x42')]=[{'all':!![]}];}_0x4caf06=_[_0xd574('0x3f')]({},_0x4caf06,_0x4a580c[_0xd574('0x41')]);return db[_0xd574('0x2e')]['find'](_0x4caf06)[_0xd574('0x29')](handleEntityNotFound(_0x1bf7c5,null))[_0xd574('0x29')](respondWithResult(_0x1bf7c5,null))[_0xd574('0x45')](handleError(_0x1bf7c5,null));};exports[_0xd574('0x49')]=function(_0x14d08b,_0x2a56a1){return db[_0xd574('0x2e')][_0xd574('0x49')](_0x14d08b[_0xd574('0x4a')],{})[_0xd574('0x29')](respondWithResult(_0x2a56a1,0xc9))[_0xd574('0x45')](handleError(_0x2a56a1,null));};exports[_0xd574('0x28')]=function(_0x1cad77,_0x44c4c6){if(_0x1cad77[_0xd574('0x4a')]['id']){delete _0x1cad77[_0xd574('0x4a')]['id'];}return db['FreshdeskAccount'][_0xd574('0x4b')]({'where':{'id':_0x1cad77[_0xd574('0x47')]['id']}})['then'](handleEntityNotFound(_0x44c4c6,null))[_0xd574('0x29')](saveUpdates(_0x1cad77[_0xd574('0x4a')],null))[_0xd574('0x29')](respondWithResult(_0x44c4c6,null))[_0xd574('0x45')](handleError(_0x44c4c6,null));};exports[_0xd574('0x2a')]=function(_0x1426fb,_0x462e5e){return db[_0xd574('0x2e')][_0xd574('0x4b')]({'where':{'id':_0x1426fb[_0xd574('0x47')]['id']}})['then'](handleEntityNotFound(_0x462e5e,null))[_0xd574('0x29')](removeEntity(_0x462e5e,null))[_0xd574('0x45')](handleError(_0x462e5e,null));};exports[_0xd574('0x4c')]=function(_0x3401aa,_0x388f30,_0xc6ebf7){var _0x2eedec={};var _0x1b7d1d={};var _0x349303;var _0xba391f;return db[_0xd574('0x2e')][_0xd574('0x4d')]({'where':{'id':_0x3401aa[_0xd574('0x47')]['id']}})[_0xd574('0x29')](handleEntityNotFound(_0x388f30,null))[_0xd574('0x29')](function(_0xcd1e61){if(_0xcd1e61){_0x349303=_0xcd1e61;_0x1b7d1d[_0xd574('0x31')]=_[_0xd574('0x33')](db[_0xd574('0x4e')][_0xd574('0x2f')]);_0x1b7d1d[_0xd574('0x32')]=_[_0xd574('0x33')](_0x3401aa[_0xd574('0x32')]);_0x1b7d1d[_0xd574('0x34')]=_[_0xd574('0x35')](_0x1b7d1d['model'],_0x1b7d1d[_0xd574('0x32')]);_0x2eedec[_0xd574('0x36')]=_[_0xd574('0x35')](_0x1b7d1d[_0xd574('0x31')],qs[_0xd574('0x37')](_0x3401aa[_0xd574('0x32')][_0xd574('0x37')]));_0x2eedec[_0xd574('0x36')]=_0x2eedec[_0xd574('0x36')]['length']?_0x2eedec['attributes']:_0x1b7d1d[_0xd574('0x31')];_0x2eedec[_0xd574('0x3a')]=qs['sort'](_0x3401aa[_0xd574('0x32')][_0xd574('0x3b')]);_0x2eedec[_0xd574('0x3c')]=qs[_0xd574('0x34')](_['pick'](_0x3401aa[_0xd574('0x32')],_0x1b7d1d[_0xd574('0x34')]));if(_0x3401aa[_0xd574('0x32')][_0xd574('0x3e')]){_0x2eedec[_0xd574('0x3c')]=_[_0xd574('0x3f')](_0x2eedec['where'],{'$or':_['map'](_0x2eedec[_0xd574('0x36')],function(_0x257a5f){var _0x483490={};_0x483490[_0x257a5f]={'$like':'%'+_0x3401aa[_0xd574('0x32')]['filter']+'%'};return _0x483490;})});}_0x2eedec=_['merge']({},_0x2eedec,_0x3401aa[_0xd574('0x41')]);return _0x349303[_0xd574('0x4c')](_0x2eedec);}})['then'](function(_0x5439c7){if(_0x5439c7){_0xba391f=_0x5439c7[_0xd574('0x38')];if(!_0x3401aa[_0xd574('0x32')][_0xd574('0x39')](_0xd574('0x4f'))){_0x2eedec[_0xd574('0x24')]=qs['limit'](_0x3401aa[_0xd574('0x32')][_0xd574('0x24')]);_0x2eedec['offset']=qs[_0xd574('0x21')](_0x3401aa[_0xd574('0x32')][_0xd574('0x21')]);}return _0x349303[_0xd574('0x4c')](_0x2eedec);}})['then'](function(_0x1c691a){if(_0x1c691a){return _0x1c691a?{'count':_0xba391f,'rows':_0x1c691a}:null;}})[_0xd574('0x29')](respondWithResult(_0x388f30,null))['catch'](handleError(_0x388f30,null));};exports[_0xd574('0x50')]=function(_0x43cd92,_0x2f97df,_0x5b1ba1){if(_0x43cd92[_0xd574('0x4a')]['id']){delete _0x43cd92['body']['id'];}return db[_0xd574('0x2e')][_0xd574('0x4d')]({'where':{'id':_0x43cd92['params']['id']}})['then'](handleEntityNotFound(_0x2f97df,null))['then'](function(_0xca35cf){if(_0xca35cf){_0x43cd92[_0xd574('0x4a')][_0xd574('0x51')]=_0xca35cf['id'];_0x43cd92[_0xd574('0x4a')]['Subjects']=integrations[_0xd574('0x52')](_0x43cd92[_0xd574('0x4a')][_0xd574('0x53')],_0x43cd92[_0xd574('0x4a')][_0xd574('0x54')]);_0x43cd92[_0xd574('0x4a')][_0xd574('0x55')]=integrations[_0xd574('0x56')](_0x43cd92[_0xd574('0x4a')]['channel'],_0x43cd92['body'][_0xd574('0x54')]);return db[_0xd574('0x4e')][_0xd574('0x49')](_0x43cd92['body'],{'include':[{'model':db['FreshdeskField'],'as':'Subjects'},{'model':db[_0xd574('0x57')],'as':_0xd574('0x55')}]});}return null;})[_0xd574('0x29')](respondWithResult(_0x2f97df,null))['catch'](handleError(_0x2f97df,null));};exports[_0xd574('0x58')]=function(_0xe99fdc,_0x17fc5e,_0x353c74){var _0x1e3399='';return db['FreshdeskAccount'][_0xd574('0x4d')]({'where':{'id':_0xe99fdc[_0xd574('0x47')]['id']},'attributes':['id',_0xd574('0x59'),_0xd574('0x5a')]})[_0xd574('0x29')](handleEntityNotFound(_0x17fc5e,null))[_0xd574('0x29')](function(_0x237c06){if(_0x237c06){_0x1e3399=_0x237c06[_0xd574('0x59')];var _0x3c9943=_0x1e3399[_0xd574('0x5b')](-0x1);if(_0x3c9943==='/'){_0x1e3399=_0x1e3399[_0xd574('0x5c')](0x0,_0x1e3399[_0xd574('0x5d')](_0x3c9943));}return rp({'method':_0xd574('0x5e'),'uri':util[_0xd574('0x5f')]('%s/%s',_0x1e3399,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0xd574('0x5f')](_0xd574('0x60'),new Buffer(util[_0xd574('0x5f')](_0xd574('0x61'),_0x237c06[_0xd574('0x5a')]))['toString'](_0xd574('0x62')))},'json':!![]});}})[_0xd574('0x29')](function(_0x1a37af){if(_0x1a37af){var _0x5afdb3=[_0xd574('0x63'),_0xd574('0x64'),'agent',_0xd574('0x65'),_0xd574('0x1e'),_0xd574('0x66'),_0xd574('0x67'),_0xd574('0x68'),_0xd574('0x69'),_0xd574('0x67'),_0xd574('0x6a')];_[_0xd574('0x6b')](_0x1a37af,function(_0x151b66){return _0x5afdb3['includes'](_0x151b66['name'])||!_0x151b66[_0xd574('0x6c')]&&_0x151b66[_0xd574('0x54')]!=='custom_text'&&_0x151b66[_0xd574('0x54')]!=='custom_dropdown';});return{'count':_0x1a37af[_0xd574('0x38')],'rows':_['map'](_0x1a37af,function(_0x3e7040){return{'id':_0x3e7040[_0xd574('0x2b')],'name':_0x3e7040['label'],'custom':!_0x3e7040[_0xd574('0x6c')],'options':_0x3e7040[_0xd574('0x6d')]?_[_0xd574('0x2d')](_0x3e7040[_0xd574('0x6d')],function(_0x498a0d){return{'name':_[_0xd574('0x6e')](_0x498a0d),'value':_0x498a0d};}):[]};})};}})[_0xd574('0x29')](respondWithResult(_0x17fc5e,null))[_0xd574('0x45')](function(_0x358c20){var _0x150c7a=_0xe99fdc[_0xd574('0x32')][_0xd574('0x6f')]?0x1f4:_0x358c20[_0xd574('0x70')]||0x1f4;logger[_0xd574('0x71')](_0xd574('0x72'),'getFields',_0x150c7a,JSON[_0xd574('0x73')](_0x358c20));delete _0x358c20[_0xd574('0x2b')];if(_0x150c7a===0x191){_0x150c7a=0x190;}_0x17fc5e[_0xd574('0x1e')](_0x150c7a)[_0xd574('0x74')](_0xe99fdc['query'][_0xd574('0x6f')]?{'message':'Wrong\x20credentials','statusCode':_0x358c20[_0xd574('0x70')]}:_0x358c20);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 3aca3bd..7e22aee 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 _0x7011=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','../../config/logger','api'];(function(_0x309cfd,_0x41acc1){var _0x500a7f=function(_0x5961fa){while(--_0x5961fa){_0x309cfd['push'](_0x309cfd['shift']());}};_0x500a7f(++_0x41acc1);}(_0x7011,0x7c));var _0x1701=function(_0x3c91f2,_0x114c77){_0x3c91f2=_0x3c91f2-0x0;var _0x3c8bd7=_0x7011[_0x3c91f2];return _0x3c8bd7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1701('0x0'))(_0x1701('0x1'));var moment=require(_0x1701('0x2'));var BPromise=require(_0x1701('0x3'));var rp=require(_0x1701('0x4'));var fs=require('fs');var path=require(_0x1701('0x5'));var rimraf=require(_0x1701('0x6'));var config=require(_0x1701('0x7'));var attributes=require(_0x1701('0x8'));var integrations=require(_0x1701('0x9'));module[_0x1701('0xa')]=function(_0x4cd43b,_0x1187db){return _0x4cd43b[_0x1701('0xb')](_0x1701('0xc'),attributes,{'tableName':_0x1701('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x47a9=['int_freshdesk_accounts','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','define'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x47a9,0xb1));var _0x947a=function(_0x493548,_0x36dfaa){_0x493548=_0x493548-0x0;var _0x37f9a5=_0x47a9[_0x493548];return _0x37f9a5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x947a('0x0'))(_0x947a('0x1'));var moment=require(_0x947a('0x2'));var BPromise=require(_0x947a('0x3'));var rp=require(_0x947a('0x4'));var fs=require('fs');var path=require(_0x947a('0x5'));var rimraf=require(_0x947a('0x6'));var config=require(_0x947a('0x7'));var attributes=require(_0x947a('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x4138a8,_0x45218d){return _0x4138a8[_0x947a('0x9')]('FreshdeskAccount',attributes,{'tableName':_0x947a('0xa'),'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 80dba66..56ccc05 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 _0x16e6=['message','result','catch','GetFreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowFreshdeskAccount','FreshdeskAccount','find','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s'];(function(_0x3e72da,_0x7909e3){var _0x20a27d=function(_0x2ce453){while(--_0x2ce453){_0x3e72da['push'](_0x3e72da['shift']());}};_0x20a27d(++_0x7909e3);}(_0x16e6,0xe8));var _0x616e=function(_0xea343d,_0x311197){_0xea343d=_0xea343d-0x0;var _0x2c6e9c=_0x16e6[_0xea343d];return _0x2c6e9c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x616e('0x0'));var BPromise=require(_0x616e('0x1'));var rs=require(_0x616e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x616e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x616e('0x4'))(_0x616e('0x5'));var config=require(_0x616e('0x6'));var jayson=require(_0x616e('0x7'));var client=jayson[_0x616e('0x8')][_0x616e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x345e79,_0x1d65be,_0x565398){return new BPromise(function(_0x14ee0b,_0xd77947){return client[_0x616e('0xa')](_0x345e79,_0x565398)[_0x616e('0xb')](function(_0x5b99a9){logger[_0x616e('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0x1d65be,_0x616e('0xd'));logger[_0x616e('0xe')](_0x616e('0xf'),_0x1d65be,_0x616e('0xd'),JSON[_0x616e('0x10')](_0x5b99a9));if(_0x5b99a9['error']){if(_0x5b99a9[_0x616e('0x11')][_0x616e('0x12')]===0x1f4){logger[_0x616e('0x11')](_0x616e('0x13'),_0x1d65be,_0x5b99a9[_0x616e('0x11')][_0x616e('0x14')]);return _0xd77947(_0x5b99a9[_0x616e('0x11')][_0x616e('0x14')]);}logger[_0x616e('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x1d65be,_0x5b99a9['error'][_0x616e('0x14')]);return _0x14ee0b(_0x5b99a9['error'][_0x616e('0x14')]);}else{logger[_0x616e('0xc')](_0x616e('0x13'),_0x1d65be,_0x616e('0xd'));_0x14ee0b(_0x5b99a9[_0x616e('0x15')][_0x616e('0x14')]);}})[_0x616e('0x16')](function(_0x4557c8){logger['error'](_0x616e('0x13'),_0x1d65be,_0x4557c8);_0xd77947(_0x4557c8);});});}exports[_0x616e('0x17')]=function(_0xb60b63){var _0x1e6bdc=this;return new Promise(function(_0x5f45d8,_0x3a4a11){return db['FreshdeskAccount'][_0x616e('0x18')]({'raw':_0xb60b63[_0x616e('0x19')]?_0xb60b63[_0x616e('0x19')][_0x616e('0x1a')]===undefined?!![]:![]:!![],'where':_0xb60b63['options']?_0xb60b63[_0x616e('0x19')][_0x616e('0x1b')]||null:null,'attributes':_0xb60b63[_0x616e('0x19')]?_0xb60b63[_0x616e('0x19')][_0x616e('0x1c')]||null:null,'limit':_0xb60b63['options']?_0xb60b63[_0x616e('0x19')][_0x616e('0x1d')]||null:null,'include':_0xb60b63[_0x616e('0x19')]?_0xb60b63[_0x616e('0x19')][_0x616e('0x1e')]?_[_0x616e('0x1f')](_0xb60b63['options'][_0x616e('0x1e')],function(_0x5c179a){return{'model':db[_0x5c179a[_0x616e('0x20')]],'as':_0x5c179a['as'],'attributes':_0x5c179a[_0x616e('0x1c')],'include':_0x5c179a[_0x616e('0x1e')]?_[_0x616e('0x1f')](_0x5c179a['include'],function(_0x3f8738){return{'model':db[_0x3f8738['model']],'as':_0x3f8738['as'],'attributes':_0x3f8738[_0x616e('0x1c')],'include':_0x3f8738['include']?_[_0x616e('0x1f')](_0x3f8738['include'],function(_0x33ba29){return{'model':db[_0x33ba29[_0x616e('0x20')]],'as':_0x33ba29['as'],'attributes':_0x33ba29[_0x616e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x616e('0xb')](function(_0x1eb9cf){logger[_0x616e('0xc')]('GetFreshdeskAccount',_0xb60b63);logger[_0x616e('0xe')](_0x616e('0x17'),_0xb60b63,JSON[_0x616e('0x10')](_0x1eb9cf));_0x5f45d8(_0x1eb9cf);})[_0x616e('0x16')](function(_0x2c00dd){logger[_0x616e('0x11')](_0x616e('0x17'),_0x2c00dd[_0x616e('0x14')],_0xb60b63);_0x3a4a11(_0x1e6bdc[_0x616e('0x11')](0x1f4,_0x2c00dd[_0x616e('0x14')]));});});};exports[_0x616e('0x21')]=function(_0x28c92c){var _0x253a99=this;return new Promise(function(_0xadbb6f,_0x253f7e){return db[_0x616e('0x22')][_0x616e('0x23')]({'raw':_0x28c92c[_0x616e('0x19')]?_0x28c92c['options'][_0x616e('0x1a')]===undefined?!![]:![]:!![],'where':_0x28c92c[_0x616e('0x19')]?_0x28c92c[_0x616e('0x19')][_0x616e('0x1b')]||null:null,'attributes':_0x28c92c['options']?_0x28c92c['options']['attributes']||null:null,'include':_0x28c92c[_0x616e('0x19')]?_0x28c92c[_0x616e('0x19')][_0x616e('0x1e')]?_[_0x616e('0x1f')](_0x28c92c[_0x616e('0x19')][_0x616e('0x1e')],function(_0x496e2b){return{'model':db[_0x496e2b[_0x616e('0x20')]],'as':_0x496e2b['as'],'attributes':_0x496e2b[_0x616e('0x1c')],'include':_0x496e2b[_0x616e('0x1e')]?_[_0x616e('0x1f')](_0x496e2b[_0x616e('0x1e')],function(_0x5b4e87){return{'model':db[_0x5b4e87[_0x616e('0x20')]],'as':_0x5b4e87['as'],'attributes':_0x5b4e87[_0x616e('0x1c')],'include':_0x5b4e87[_0x616e('0x1e')]?_['map'](_0x5b4e87[_0x616e('0x1e')],function(_0x1efeae){return{'model':db[_0x1efeae[_0x616e('0x20')]],'as':_0x1efeae['as'],'attributes':_0x1efeae[_0x616e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x616e('0xb')](function(_0x58b168){logger[_0x616e('0xc')](_0x616e('0x21'),_0x28c92c);logger['debug'](_0x616e('0x21'),_0x28c92c,JSON[_0x616e('0x10')](_0x58b168));_0xadbb6f(_0x58b168);})[_0x616e('0x16')](function(_0x36afbd){logger[_0x616e('0x11')](_0x616e('0x21'),_0x36afbd[_0x616e('0x14')],_0x28c92c);_0x253f7e(_0x253a99[_0x616e('0x11')](0x1f4,_0x36afbd[_0x616e('0x14')]));});});}; \ No newline at end of file +var _0xc66b=['request','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetFreshdeskAccount','FreshdeskAccount','options','raw','where','attributes','limit','include','map','model','debug','then','ShowFreshdeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x43b22b,_0xea722c){var _0xd4e124=function(_0x271814){while(--_0x271814){_0x43b22b['push'](_0x43b22b['shift']());}};_0xd4e124(++_0xea722c);}(_0xc66b,0x175));var _0xbc66=function(_0xa9eaa0,_0x4ba2b4){_0xa9eaa0=_0xa9eaa0-0x0;var _0x30897a=_0xc66b[_0xa9eaa0];return _0x30897a;};'use strict';var _=require(_0xbc66('0x0'));var util=require(_0xbc66('0x1'));var moment=require(_0xbc66('0x2'));var BPromise=require(_0xbc66('0x3'));var rs=require(_0xbc66('0x4'));var fs=require('fs');var Redis=require(_0xbc66('0x5'));var db=require(_0xbc66('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xbc66('0x7'))(_0xbc66('0x8'));var config=require(_0xbc66('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xbc66('0xa')][_0xbc66('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa48e16,_0x936622,_0x54d4eb){return new BPromise(function(_0x3cc3d6,_0x379465){return client[_0xbc66('0xc')](_0xa48e16,_0x54d4eb)['then'](function(_0x1219da){logger['info'](_0xbc66('0xd'),_0x936622,_0xbc66('0xe'));logger['debug'](_0xbc66('0xf'),_0x936622,_0xbc66('0xe'),JSON[_0xbc66('0x10')](_0x1219da));if(_0x1219da['error']){if(_0x1219da[_0xbc66('0x11')][_0xbc66('0x12')]===0x1f4){logger[_0xbc66('0x11')](_0xbc66('0xd'),_0x936622,_0x1219da[_0xbc66('0x11')][_0xbc66('0x13')]);return _0x379465(_0x1219da['error'][_0xbc66('0x13')]);}logger[_0xbc66('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x936622,_0x1219da['error']['message']);return _0x3cc3d6(_0x1219da[_0xbc66('0x11')][_0xbc66('0x13')]);}else{logger[_0xbc66('0x14')](_0xbc66('0xd'),_0x936622,'request\x20sent');_0x3cc3d6(_0x1219da['result']['message']);}})[_0xbc66('0x15')](function(_0x28c4d3){logger[_0xbc66('0x11')](_0xbc66('0xd'),_0x936622,_0x28c4d3);_0x379465(_0x28c4d3);});});}exports[_0xbc66('0x16')]=function(_0x2e49e3){var _0x5a12d9=this;return new Promise(function(_0x3b5f9f,_0x3aa5eb){return db[_0xbc66('0x17')]['findAll']({'raw':_0x2e49e3['options']?_0x2e49e3[_0xbc66('0x18')][_0xbc66('0x19')]===undefined?!![]:![]:!![],'where':_0x2e49e3['options']?_0x2e49e3[_0xbc66('0x18')][_0xbc66('0x1a')]||null:null,'attributes':_0x2e49e3[_0xbc66('0x18')]?_0x2e49e3['options'][_0xbc66('0x1b')]||null:null,'limit':_0x2e49e3[_0xbc66('0x18')]?_0x2e49e3['options'][_0xbc66('0x1c')]||null:null,'include':_0x2e49e3[_0xbc66('0x18')]?_0x2e49e3[_0xbc66('0x18')][_0xbc66('0x1d')]?_[_0xbc66('0x1e')](_0x2e49e3['options'][_0xbc66('0x1d')],function(_0x2495f8){return{'model':db[_0x2495f8[_0xbc66('0x1f')]],'as':_0x2495f8['as'],'attributes':_0x2495f8[_0xbc66('0x1b')],'include':_0x2495f8[_0xbc66('0x1d')]?_[_0xbc66('0x1e')](_0x2495f8[_0xbc66('0x1d')],function(_0x2b2086){return{'model':db[_0x2b2086[_0xbc66('0x1f')]],'as':_0x2b2086['as'],'attributes':_0x2b2086['attributes'],'include':_0x2b2086['include']?_[_0xbc66('0x1e')](_0x2b2086[_0xbc66('0x1d')],function(_0x2cbc8b){return{'model':db[_0x2cbc8b[_0xbc66('0x1f')]],'as':_0x2cbc8b['as'],'attributes':_0x2cbc8b[_0xbc66('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5b6b06){logger[_0xbc66('0x14')](_0xbc66('0x16'),_0x2e49e3);logger[_0xbc66('0x20')](_0xbc66('0x16'),_0x2e49e3,JSON[_0xbc66('0x10')](_0x5b6b06));_0x3b5f9f(_0x5b6b06);})['catch'](function(_0x5c617b){logger[_0xbc66('0x11')](_0xbc66('0x16'),_0x5c617b[_0xbc66('0x13')],_0x2e49e3);_0x3aa5eb(_0x5a12d9[_0xbc66('0x11')](0x1f4,_0x5c617b[_0xbc66('0x13')]));});});};exports['ShowFreshdeskAccount']=function(_0x4d7b93){var _0x4fabe6=this;return new Promise(function(_0x442458,_0x234fc6){return db[_0xbc66('0x17')]['find']({'raw':_0x4d7b93[_0xbc66('0x18')]?_0x4d7b93['options'][_0xbc66('0x19')]===undefined?!![]:![]:!![],'where':_0x4d7b93[_0xbc66('0x18')]?_0x4d7b93[_0xbc66('0x18')][_0xbc66('0x1a')]||null:null,'attributes':_0x4d7b93[_0xbc66('0x18')]?_0x4d7b93[_0xbc66('0x18')]['attributes']||null:null,'include':_0x4d7b93['options']?_0x4d7b93[_0xbc66('0x18')][_0xbc66('0x1d')]?_[_0xbc66('0x1e')](_0x4d7b93[_0xbc66('0x18')][_0xbc66('0x1d')],function(_0x1d852c){return{'model':db[_0x1d852c[_0xbc66('0x1f')]],'as':_0x1d852c['as'],'attributes':_0x1d852c[_0xbc66('0x1b')],'include':_0x1d852c[_0xbc66('0x1d')]?_[_0xbc66('0x1e')](_0x1d852c[_0xbc66('0x1d')],function(_0x15fbdf){return{'model':db[_0x15fbdf[_0xbc66('0x1f')]],'as':_0x15fbdf['as'],'attributes':_0x15fbdf[_0xbc66('0x1b')],'include':_0x15fbdf['include']?_['map'](_0x15fbdf[_0xbc66('0x1d')],function(_0x3df34d){return{'model':db[_0x3df34d['model']],'as':_0x3df34d['as'],'attributes':_0x3df34d[_0xbc66('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbc66('0x21')](function(_0x46c696){logger[_0xbc66('0x14')](_0xbc66('0x22'),_0x4d7b93);logger[_0xbc66('0x20')](_0xbc66('0x22'),_0x4d7b93,JSON['stringify'](_0x46c696));_0x442458(_0x46c696);})['catch'](function(_0x5289fa){logger['error'](_0xbc66('0x22'),_0x5289fa[_0xbc66('0x13')],_0x4d7b93);_0x234fc6(_0x4fabe6[_0xbc66('0x11')](0x1f4,_0x5289fa[_0xbc66('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 8426c30..e066dbf 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 _0x4bc3=['./intFreshdeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','setTags','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x31b836,_0x2f2b57){var _0x4d2839=function(_0x4dbaa5){while(--_0x4dbaa5){_0x31b836['push'](_0x31b836['shift']());}};_0x4d2839(++_0x2f2b57);}(_0x4bc3,0x1d5));var _0x34bc=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x4bc3[_0x88cd7b];return _0x56fcc8;};'use strict';var multer=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var path=require('path');var timeout=require(_0x34bc('0x2'));var express=require(_0x34bc('0x3'));var router=express['Router']();var fs_extra=require(_0x34bc('0x4'));var auth=require(_0x34bc('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x34bc('0x6'));router[_0x34bc('0x7')]('/',auth['isAuthenticated'](),controller[_0x34bc('0x8')]);router[_0x34bc('0x7')](_0x34bc('0x9'),auth[_0x34bc('0xa')](),controller[_0x34bc('0xb')]);router[_0x34bc('0x7')](_0x34bc('0xc'),auth[_0x34bc('0xa')](),controller[_0x34bc('0xd')]);router[_0x34bc('0x7')](_0x34bc('0xe'),auth['isAuthenticated'](),controller[_0x34bc('0xf')]);router[_0x34bc('0x7')]('/:id/descriptions',auth[_0x34bc('0xa')](),controller[_0x34bc('0x10')]);router[_0x34bc('0x7')](_0x34bc('0x11'),auth['isAuthenticated'](),controller[_0x34bc('0x12')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x34bc('0x13')](_0x34bc('0x11'),auth['isAuthenticated'](),controller[_0x34bc('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x34bc('0x15')]);router[_0x34bc('0x16')](_0x34bc('0x9'),auth['isAuthenticated'](),controller[_0x34bc('0x17')]);module[_0x34bc('0x18')]=router; \ No newline at end of file +var _0x5998=['post','put','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags'];(function(_0x27e2b4,_0x227c32){var _0x28e0ab=function(_0x2facf5){while(--_0x2facf5){_0x27e2b4['push'](_0x27e2b4['shift']());}};_0x28e0ab(++_0x227c32);}(_0x5998,0xa5));var _0x8599=function(_0x3dd2df,_0x29fe01){_0x3dd2df=_0x3dd2df-0x0;var _0x3fc548=_0x5998[_0x3dd2df];return _0x3fc548;};'use strict';var multer=require(_0x8599('0x0'));var util=require(_0x8599('0x1'));var path=require(_0x8599('0x2'));var timeout=require(_0x8599('0x3'));var express=require(_0x8599('0x4'));var router=express['Router']();var fs_extra=require(_0x8599('0x5'));var auth=require(_0x8599('0x6'));var interaction=require(_0x8599('0x7'));var config=require('../../config/environment');var controller=require(_0x8599('0x8'));router[_0x8599('0x9')]('/',auth[_0x8599('0xa')](),controller['index']);router['get'](_0x8599('0xb'),auth[_0x8599('0xa')](),controller[_0x8599('0xc')]);router[_0x8599('0x9')](_0x8599('0xd'),auth[_0x8599('0xa')](),controller[_0x8599('0xe')]);router[_0x8599('0x9')]('/:id/subjects',auth[_0x8599('0xa')](),controller['getSubjects']);router['get'](_0x8599('0xf'),auth['isAuthenticated'](),controller[_0x8599('0x10')]);router['get'](_0x8599('0x11'),auth[_0x8599('0xa')](),controller[_0x8599('0x12')]);router['post']('/',auth[_0x8599('0xa')](),controller['create']);router[_0x8599('0x13')](_0x8599('0x11'),auth[_0x8599('0xa')](),controller['setTags']);router[_0x8599('0x14')]('/:id',auth[_0x8599('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x8599('0x15')]);module[_0x8599('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 1b4168f..459072d 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 _0xb929=['exports','STRING','sequelize'];(function(_0x526c42,_0x4fa5c3){var _0x3506cb=function(_0x1fcfb0){while(--_0x1fcfb0){_0x526c42['push'](_0x526c42['shift']());}};_0x3506cb(++_0x4fa5c3);}(_0xb929,0x1cd));var _0x9b92=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb929[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x9b92('0x0'));module[_0x9b92('0x1')]={'name':{'type':Sequelize[_0x9b92('0x2')]},'description':{'type':Sequelize[_0x9b92('0x2')]}}; \ No newline at end of file +var _0x55d5=['exports','STRING'];(function(_0x5c0e81,_0x2fc724){var _0x30e294=function(_0x576667){while(--_0x576667){_0x5c0e81['push'](_0x5c0e81['shift']());}};_0x30e294(++_0x2fc724);}(_0x55d5,0xbe));var _0x555d=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x55d5[_0x1da527];return _0x40fc7c;};'use strict';var Sequelize=require('sequelize');module[_0x555d('0x0')]={'name':{'type':Sequelize[_0x555d('0x1')]},'description':{'type':Sequelize[_0x555d('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 46d21dc..b45a4f8 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 _0xac41=['sendStatus','error','stack','name','send','index','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','map','merge','options','FreshdeskConfiguration','include','findAll','catch','show','keys','includeAll','find','create','body','params','getFields','findOne','FreshdeskField','hasOwnProperty','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xac41,0xdd));var _0x1ac4=function(_0x456149,_0x298703){_0x456149=_0x456149-0x0;var _0x9d80c0=_0xac41[_0x456149];return _0x9d80c0;};'use strict';var emlformat=require(_0x1ac4('0x0'));var rimraf=require(_0x1ac4('0x1'));var zipdir=require(_0x1ac4('0x2'));var jsonpatch=require(_0x1ac4('0x3'));var rp=require(_0x1ac4('0x4'));var moment=require(_0x1ac4('0x5'));var BPromise=require(_0x1ac4('0x6'));var Mustache=require(_0x1ac4('0x7'));var util=require('util');var path=require(_0x1ac4('0x8'));var sox=require(_0x1ac4('0x9'));var csv=require(_0x1ac4('0xa'));var ejs=require(_0x1ac4('0xb'));var fs=require('fs');var fs_extra=require(_0x1ac4('0xc'));var _=require(_0x1ac4('0xd'));var squel=require(_0x1ac4('0xe'));var crypto=require(_0x1ac4('0xf'));var jsforce=require(_0x1ac4('0x10'));var deskjs=require(_0x1ac4('0x11'));var toCsv=require(_0x1ac4('0xa'));var querystring=require(_0x1ac4('0x12'));var Papa=require(_0x1ac4('0x13'));var Redis=require(_0x1ac4('0x14'));var authService=require(_0x1ac4('0x15'));var qs=require(_0x1ac4('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1ac4('0x17'));var logger=require('../../config/logger')(_0x1ac4('0x18'));var utils=require(_0x1ac4('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x1ac4('0x1a'));var db=require(_0x1ac4('0x1b'))['db'];function respondWithStatusCode(_0x4bc8d8,_0x2ac588){_0x2ac588=_0x2ac588||0xcc;return function(_0x4e54c2){if(_0x4e54c2){return _0x4bc8d8['sendStatus'](_0x2ac588);}return _0x4bc8d8['status'](_0x2ac588)[_0x1ac4('0x1c')]();};}function respondWithResult(_0x288b4e,_0x3841fa){_0x3841fa=_0x3841fa||0xc8;return function(_0xad7a88){if(_0xad7a88){return _0x288b4e[_0x1ac4('0x1d')](_0x3841fa)[_0x1ac4('0x1e')](_0xad7a88);}};}function respondWithFilteredResult(_0x5038e3,_0x531769){return function(_0x160b86){if(_0x160b86){var _0x427684=typeof _0x531769[_0x1ac4('0x1f')]==='undefined'&&typeof _0x531769[_0x1ac4('0x20')]===_0x1ac4('0x21');var _0x3bdeb7=_0x160b86[_0x1ac4('0x22')];var _0x1e7669=_0x427684?0x0:_0x531769[_0x1ac4('0x1f')];var _0x1797fc=_0x427684?_0x160b86['count']:_0x531769['offset']+_0x531769[_0x1ac4('0x20')];var _0x1dc9b3;if(_0x1797fc>=_0x3bdeb7){_0x1797fc=_0x3bdeb7;_0x1dc9b3=0xc8;}else{_0x1dc9b3=0xce;}_0x5038e3[_0x1ac4('0x1d')](_0x1dc9b3);return _0x5038e3[_0x1ac4('0x23')](_0x1ac4('0x24'),_0x1e7669+'-'+_0x1797fc+'/'+_0x3bdeb7)['json'](_0x160b86);}return null;};}function patchUpdates(_0x4b31c8){return function(_0x3c293d){try{jsonpatch[_0x1ac4('0x25')](_0x3c293d,_0x4b31c8,!![]);}catch(_0x479110){return BPromise[_0x1ac4('0x26')](_0x479110);}return _0x3c293d[_0x1ac4('0x27')]();};}function saveUpdates(_0x28a2d7,_0x2643bc){return function(_0x48475e){if(_0x48475e){return _0x48475e[_0x1ac4('0x28')](_0x28a2d7)[_0x1ac4('0x29')](function(_0x51901a){return _0x51901a;});}return null;};}function removeEntity(_0x1b5490,_0x5e58b4){return function(_0xfe5397){if(_0xfe5397){return _0xfe5397[_0x1ac4('0x2a')]()[_0x1ac4('0x29')](function(){_0x1b5490[_0x1ac4('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ddf22,_0x54284c){return function(_0x289579){if(!_0x289579){_0x1ddf22[_0x1ac4('0x2b')](0x194);}return _0x289579;};}function handleError(_0x10a42c,_0x3c0bbb){_0x3c0bbb=_0x3c0bbb||0x1f4;return function(_0x385885){logger[_0x1ac4('0x2c')](_0x385885[_0x1ac4('0x2d')]);if(_0x385885[_0x1ac4('0x2e')]){delete _0x385885[_0x1ac4('0x2e')];}_0x10a42c[_0x1ac4('0x1d')](_0x3c0bbb)[_0x1ac4('0x2f')](_0x385885);};}exports[_0x1ac4('0x30')]=function(_0x4541bb,_0x14de4e){var _0x22e219={},_0x1fa40a={},_0x4510e2={'count':0x0,'rows':[]};var _0x58e76d=_['map'](db['FreshdeskConfiguration'][_0x1ac4('0x31')],function(_0x456655){return{'name':_0x456655['fieldName'],'type':_0x456655[_0x1ac4('0x32')][_0x1ac4('0x33')]};});_0x1fa40a[_0x1ac4('0x34')]=_['map'](_0x58e76d,_0x1ac4('0x2e'));_0x1fa40a['query']=_['keys'](_0x4541bb[_0x1ac4('0x35')]);_0x1fa40a[_0x1ac4('0x36')]=_[_0x1ac4('0x37')](_0x1fa40a['model'],_0x1fa40a[_0x1ac4('0x35')]);_0x22e219[_0x1ac4('0x38')]=_[_0x1ac4('0x37')](_0x1fa40a[_0x1ac4('0x34')],qs[_0x1ac4('0x39')](_0x4541bb['query'][_0x1ac4('0x39')]));_0x22e219[_0x1ac4('0x38')]=_0x22e219[_0x1ac4('0x38')][_0x1ac4('0x3a')]?_0x22e219[_0x1ac4('0x38')]:_0x1fa40a[_0x1ac4('0x34')];if(!_0x4541bb[_0x1ac4('0x35')]['hasOwnProperty'](_0x1ac4('0x3b'))){_0x22e219[_0x1ac4('0x20')]=qs['limit'](_0x4541bb[_0x1ac4('0x35')][_0x1ac4('0x20')]);_0x22e219['offset']=qs[_0x1ac4('0x1f')](_0x4541bb[_0x1ac4('0x35')][_0x1ac4('0x1f')]);}_0x22e219[_0x1ac4('0x3c')]=qs[_0x1ac4('0x3d')](_0x4541bb[_0x1ac4('0x35')][_0x1ac4('0x3d')]);_0x22e219['where']=qs[_0x1ac4('0x36')](_[_0x1ac4('0x3e')](_0x4541bb[_0x1ac4('0x35')],_0x1fa40a[_0x1ac4('0x36')]),_0x58e76d);if(_0x4541bb[_0x1ac4('0x35')][_0x1ac4('0x3f')]){_0x22e219[_0x1ac4('0x40')]=_['merge'](_0x22e219['where'],{'$or':_[_0x1ac4('0x41')](_0x58e76d,function(_0x3277a2){if(_0x3277a2['type']!=='VIRTUAL'){var _0x593635={};_0x593635[_0x3277a2[_0x1ac4('0x2e')]]={'$like':'%'+_0x4541bb[_0x1ac4('0x35')][_0x1ac4('0x3f')]+'%'};return _0x593635;}})});}_0x22e219=_[_0x1ac4('0x42')]({},_0x22e219,_0x4541bb[_0x1ac4('0x43')]);var _0x41af65={'where':_0x22e219[_0x1ac4('0x40')]};return db[_0x1ac4('0x44')][_0x1ac4('0x22')](_0x41af65)[_0x1ac4('0x29')](function(_0x21ccb9){_0x4510e2[_0x1ac4('0x22')]=_0x21ccb9;if(_0x4541bb[_0x1ac4('0x35')]['includeAll']){_0x22e219[_0x1ac4('0x45')]=[{'all':!![]}];}return db[_0x1ac4('0x44')][_0x1ac4('0x46')](_0x22e219);})[_0x1ac4('0x29')](function(_0xb8aa0f){_0x4510e2['rows']=_0xb8aa0f;return _0x4510e2;})['then'](respondWithFilteredResult(_0x14de4e,_0x22e219))[_0x1ac4('0x47')](handleError(_0x14de4e,null));};exports[_0x1ac4('0x48')]=function(_0x5c5f79,_0x21cec8){var _0x4d443a={'raw':![],'where':{'id':_0x5c5f79['params']['id']}},_0x2854ca={};_0x2854ca[_0x1ac4('0x34')]=_[_0x1ac4('0x49')](db[_0x1ac4('0x44')][_0x1ac4('0x31')]);_0x2854ca[_0x1ac4('0x35')]=_[_0x1ac4('0x49')](_0x5c5f79[_0x1ac4('0x35')]);_0x2854ca[_0x1ac4('0x36')]=_[_0x1ac4('0x37')](_0x2854ca['model'],_0x2854ca[_0x1ac4('0x35')]);_0x4d443a['attributes']=_[_0x1ac4('0x37')](_0x2854ca['model'],qs[_0x1ac4('0x39')](_0x5c5f79[_0x1ac4('0x35')][_0x1ac4('0x39')]));_0x4d443a[_0x1ac4('0x38')]=_0x4d443a[_0x1ac4('0x38')]['length']?_0x4d443a['attributes']:_0x2854ca[_0x1ac4('0x34')];if(_0x5c5f79['query'][_0x1ac4('0x4a')]){_0x4d443a[_0x1ac4('0x45')]=[{'all':!![]}];}_0x4d443a=_[_0x1ac4('0x42')]({},_0x4d443a,_0x5c5f79['options']);return db[_0x1ac4('0x44')][_0x1ac4('0x4b')](_0x4d443a)[_0x1ac4('0x29')](handleEntityNotFound(_0x21cec8,null))[_0x1ac4('0x29')](respondWithResult(_0x21cec8,null))[_0x1ac4('0x47')](handleError(_0x21cec8,null));};exports[_0x1ac4('0x4c')]=function(_0x244569,_0x4af615){return db[_0x1ac4('0x44')]['create'](_0x244569[_0x1ac4('0x4d')],{})[_0x1ac4('0x29')](respondWithResult(_0x4af615,0xc9))[_0x1ac4('0x47')](handleError(_0x4af615,null));};exports[_0x1ac4('0x28')]=function(_0x2de44a,_0x4e132f){if(_0x2de44a[_0x1ac4('0x4d')]['id']){delete _0x2de44a[_0x1ac4('0x4d')]['id'];}return db[_0x1ac4('0x44')][_0x1ac4('0x4b')]({'where':{'id':_0x2de44a['params']['id']}})['then'](handleEntityNotFound(_0x4e132f,null))[_0x1ac4('0x29')](saveUpdates(_0x2de44a[_0x1ac4('0x4d')],null))[_0x1ac4('0x29')](respondWithResult(_0x4e132f,null))[_0x1ac4('0x47')](handleError(_0x4e132f,null));};exports['destroy']=function(_0x4678ab,_0x436fca){return db[_0x1ac4('0x44')]['find']({'where':{'id':_0x4678ab[_0x1ac4('0x4e')]['id']}})['then'](handleEntityNotFound(_0x436fca,null))[_0x1ac4('0x29')](removeEntity(_0x436fca,null))[_0x1ac4('0x47')](handleError(_0x436fca,null));};exports[_0x1ac4('0x4f')]=function(_0x573942,_0x3ae162,_0x480c51){var _0x4dadd1={};var _0x33e442={};var _0x4d2a2d;var _0x460951;return db[_0x1ac4('0x44')][_0x1ac4('0x50')]({'where':{'id':_0x573942['params']['id']}})['then'](handleEntityNotFound(_0x3ae162,null))['then'](function(_0x5d3b99){if(_0x5d3b99){_0x4d2a2d=_0x5d3b99;_0x33e442[_0x1ac4('0x34')]=_['keys'](db[_0x1ac4('0x51')][_0x1ac4('0x31')]);_0x33e442[_0x1ac4('0x35')]=_['keys'](_0x573942[_0x1ac4('0x35')]);_0x33e442[_0x1ac4('0x36')]=_[_0x1ac4('0x37')](_0x33e442[_0x1ac4('0x34')],_0x33e442[_0x1ac4('0x35')]);_0x4dadd1['attributes']=_[_0x1ac4('0x37')](_0x33e442[_0x1ac4('0x34')],qs['fields'](_0x573942[_0x1ac4('0x35')][_0x1ac4('0x39')]));_0x4dadd1[_0x1ac4('0x38')]=_0x4dadd1[_0x1ac4('0x38')][_0x1ac4('0x3a')]?_0x4dadd1[_0x1ac4('0x38')]:_0x33e442['model'];_0x4dadd1['order']=qs[_0x1ac4('0x3d')](_0x573942[_0x1ac4('0x35')][_0x1ac4('0x3d')]);_0x4dadd1[_0x1ac4('0x40')]=qs[_0x1ac4('0x36')](_[_0x1ac4('0x3e')](_0x573942[_0x1ac4('0x35')],_0x33e442[_0x1ac4('0x36')]));if(_0x573942[_0x1ac4('0x35')][_0x1ac4('0x3f')]){_0x4dadd1[_0x1ac4('0x40')]=_[_0x1ac4('0x42')](_0x4dadd1[_0x1ac4('0x40')],{'$or':_['map'](_0x4dadd1['attributes'],function(_0x42edbd){var _0x273c81={};_0x273c81[_0x42edbd]={'$like':'%'+_0x573942[_0x1ac4('0x35')][_0x1ac4('0x3f')]+'%'};return _0x273c81;})});}_0x4dadd1=_[_0x1ac4('0x42')]({},_0x4dadd1,_0x573942[_0x1ac4('0x43')]);return _0x4d2a2d['getFields'](_0x4dadd1);}})['then'](function(_0x3a0d78){if(_0x3a0d78){_0x460951=_0x3a0d78[_0x1ac4('0x3a')];if(!_0x573942[_0x1ac4('0x35')][_0x1ac4('0x52')](_0x1ac4('0x3b'))){_0x4dadd1[_0x1ac4('0x20')]=qs[_0x1ac4('0x20')](_0x573942['query'][_0x1ac4('0x20')]);_0x4dadd1['offset']=qs['offset'](_0x573942[_0x1ac4('0x35')][_0x1ac4('0x1f')]);}return _0x4d2a2d[_0x1ac4('0x4f')](_0x4dadd1);}})[_0x1ac4('0x29')](function(_0x185bc5){if(_0x185bc5){return _0x185bc5?{'count':_0x460951,'rows':_0x185bc5}:null;}})[_0x1ac4('0x29')](respondWithResult(_0x3ae162,null))[_0x1ac4('0x47')](handleError(_0x3ae162,null));};exports[_0x1ac4('0x53')]=function(_0x3510b5,_0x34a3e1,_0x42a81f){var _0xfc2d0b={};var _0x29dce4={};var _0x54302f;var _0x44b955;return db[_0x1ac4('0x44')][_0x1ac4('0x50')]({'where':{'id':_0x3510b5[_0x1ac4('0x4e')]['id']}})[_0x1ac4('0x29')](handleEntityNotFound(_0x34a3e1,null))[_0x1ac4('0x29')](function(_0x58e55e){if(_0x58e55e){_0x54302f=_0x58e55e;_0x29dce4[_0x1ac4('0x34')]=_[_0x1ac4('0x49')](db[_0x1ac4('0x51')][_0x1ac4('0x31')]);_0x29dce4[_0x1ac4('0x35')]=_[_0x1ac4('0x49')](_0x3510b5[_0x1ac4('0x35')]);_0x29dce4[_0x1ac4('0x36')]=_[_0x1ac4('0x37')](_0x29dce4[_0x1ac4('0x34')],_0x29dce4['query']);_0xfc2d0b[_0x1ac4('0x38')]=_['intersection'](_0x29dce4[_0x1ac4('0x34')],qs[_0x1ac4('0x39')](_0x3510b5[_0x1ac4('0x35')][_0x1ac4('0x39')]));_0xfc2d0b['attributes']=_0xfc2d0b[_0x1ac4('0x38')][_0x1ac4('0x3a')]?_0xfc2d0b[_0x1ac4('0x38')]:_0x29dce4[_0x1ac4('0x34')];_0xfc2d0b['order']=qs[_0x1ac4('0x3d')](_0x3510b5['query'][_0x1ac4('0x3d')]);_0xfc2d0b[_0x1ac4('0x40')]=qs['filters'](_[_0x1ac4('0x3e')](_0x3510b5[_0x1ac4('0x35')],_0x29dce4['filters']));if(_0x3510b5[_0x1ac4('0x35')]['filter']){_0xfc2d0b['where']=_[_0x1ac4('0x42')](_0xfc2d0b[_0x1ac4('0x40')],{'$or':_[_0x1ac4('0x41')](_0xfc2d0b[_0x1ac4('0x38')],function(_0x10a6a8){var _0x9b6b55={};_0x9b6b55[_0x10a6a8]={'$like':'%'+_0x3510b5[_0x1ac4('0x35')]['filter']+'%'};return _0x9b6b55;})});}_0xfc2d0b=_[_0x1ac4('0x42')]({},_0xfc2d0b,_0x3510b5['options']);return _0x54302f[_0x1ac4('0x53')](_0xfc2d0b);}})[_0x1ac4('0x29')](function(_0x18c1db){if(_0x18c1db){_0x44b955=_0x18c1db['length'];if(!_0x3510b5[_0x1ac4('0x35')][_0x1ac4('0x52')](_0x1ac4('0x3b'))){_0xfc2d0b[_0x1ac4('0x20')]=qs[_0x1ac4('0x20')](_0x3510b5['query'][_0x1ac4('0x20')]);_0xfc2d0b[_0x1ac4('0x1f')]=qs[_0x1ac4('0x1f')](_0x3510b5[_0x1ac4('0x35')][_0x1ac4('0x1f')]);}return _0x54302f[_0x1ac4('0x53')](_0xfc2d0b);}})[_0x1ac4('0x29')](function(_0x2620c8){if(_0x2620c8){return _0x2620c8?{'count':_0x44b955,'rows':_0x2620c8}:null;}})[_0x1ac4('0x29')](respondWithResult(_0x34a3e1,null))[_0x1ac4('0x47')](handleError(_0x34a3e1,null));};exports['getDescriptions']=function(_0x5fadd3,_0x3d6c78,_0x2bfbd9){var _0x2e2c16={};var _0x13bbde={};var _0x7f9817;var _0x4c690d;return db['FreshdeskConfiguration'][_0x1ac4('0x50')]({'where':{'id':_0x5fadd3[_0x1ac4('0x4e')]['id']}})[_0x1ac4('0x29')](handleEntityNotFound(_0x3d6c78,null))['then'](function(_0x1e8f14){if(_0x1e8f14){_0x7f9817=_0x1e8f14;_0x13bbde[_0x1ac4('0x34')]=_[_0x1ac4('0x49')](db[_0x1ac4('0x51')][_0x1ac4('0x31')]);_0x13bbde['query']=_[_0x1ac4('0x49')](_0x5fadd3['query']);_0x13bbde[_0x1ac4('0x36')]=_[_0x1ac4('0x37')](_0x13bbde['model'],_0x13bbde[_0x1ac4('0x35')]);_0x2e2c16[_0x1ac4('0x38')]=_[_0x1ac4('0x37')](_0x13bbde['model'],qs['fields'](_0x5fadd3[_0x1ac4('0x35')][_0x1ac4('0x39')]));_0x2e2c16['attributes']=_0x2e2c16[_0x1ac4('0x38')][_0x1ac4('0x3a')]?_0x2e2c16[_0x1ac4('0x38')]:_0x13bbde[_0x1ac4('0x34')];_0x2e2c16[_0x1ac4('0x3c')]=qs[_0x1ac4('0x3d')](_0x5fadd3[_0x1ac4('0x35')]['sort']);_0x2e2c16['where']=qs['filters'](_[_0x1ac4('0x3e')](_0x5fadd3[_0x1ac4('0x35')],_0x13bbde[_0x1ac4('0x36')]));if(_0x5fadd3[_0x1ac4('0x35')][_0x1ac4('0x3f')]){_0x2e2c16[_0x1ac4('0x40')]=_[_0x1ac4('0x42')](_0x2e2c16['where'],{'$or':_['map'](_0x2e2c16['attributes'],function(_0xc01fc3){var _0x2fa2c4={};_0x2fa2c4[_0xc01fc3]={'$like':'%'+_0x5fadd3[_0x1ac4('0x35')]['filter']+'%'};return _0x2fa2c4;})});}_0x2e2c16=_[_0x1ac4('0x42')]({},_0x2e2c16,_0x5fadd3[_0x1ac4('0x43')]);return _0x7f9817[_0x1ac4('0x54')](_0x2e2c16);}})[_0x1ac4('0x29')](function(_0x5ba9b5){if(_0x5ba9b5){_0x4c690d=_0x5ba9b5[_0x1ac4('0x3a')];if(!_0x5fadd3[_0x1ac4('0x35')][_0x1ac4('0x52')]('nolimit')){_0x2e2c16[_0x1ac4('0x20')]=qs[_0x1ac4('0x20')](_0x5fadd3[_0x1ac4('0x35')][_0x1ac4('0x20')]);_0x2e2c16[_0x1ac4('0x1f')]=qs[_0x1ac4('0x1f')](_0x5fadd3['query'][_0x1ac4('0x1f')]);}return _0x7f9817[_0x1ac4('0x54')](_0x2e2c16);}})[_0x1ac4('0x29')](function(_0x40e807){if(_0x40e807){return _0x40e807?{'count':_0x4c690d,'rows':_0x40e807}:null;}})[_0x1ac4('0x29')](respondWithResult(_0x3d6c78,null))[_0x1ac4('0x47')](handleError(_0x3d6c78,null));};exports[_0x1ac4('0x55')]=function(_0x4ccb4e,_0x3e886d,_0x18bb1f){var _0x300c69={};var _0x398bf3={};var _0x47e0e7;var _0x23285d;return db[_0x1ac4('0x44')][_0x1ac4('0x50')]({'where':{'id':_0x4ccb4e[_0x1ac4('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3e886d,null))[_0x1ac4('0x29')](function(_0x4ffbb0){if(_0x4ffbb0){_0x47e0e7=_0x4ffbb0;_0x398bf3[_0x1ac4('0x34')]=_[_0x1ac4('0x49')](db['Tag'][_0x1ac4('0x31')]);_0x398bf3[_0x1ac4('0x35')]=_[_0x1ac4('0x49')](_0x4ccb4e[_0x1ac4('0x35')]);_0x398bf3['filters']=_[_0x1ac4('0x37')](_0x398bf3[_0x1ac4('0x34')],_0x398bf3[_0x1ac4('0x35')]);_0x300c69['attributes']=_['intersection'](_0x398bf3[_0x1ac4('0x34')],qs[_0x1ac4('0x39')](_0x4ccb4e[_0x1ac4('0x35')][_0x1ac4('0x39')]));_0x300c69[_0x1ac4('0x38')]=_0x300c69[_0x1ac4('0x38')][_0x1ac4('0x3a')]?_0x300c69[_0x1ac4('0x38')]:_0x398bf3['model'];_0x300c69[_0x1ac4('0x3c')]=qs['sort'](_0x4ccb4e['query'][_0x1ac4('0x3d')]);_0x300c69['where']=qs[_0x1ac4('0x36')](_[_0x1ac4('0x3e')](_0x4ccb4e[_0x1ac4('0x35')],_0x398bf3['filters']));if(_0x4ccb4e[_0x1ac4('0x35')]['filter']){_0x300c69[_0x1ac4('0x40')]=_[_0x1ac4('0x42')](_0x300c69[_0x1ac4('0x40')],{'$or':_[_0x1ac4('0x41')](_0x300c69[_0x1ac4('0x38')],function(_0xf10760){var _0x5835fd={};_0x5835fd[_0xf10760]={'$like':'%'+_0x4ccb4e['query'][_0x1ac4('0x3f')]+'%'};return _0x5835fd;})});}_0x300c69=_[_0x1ac4('0x42')]({},_0x300c69,_0x4ccb4e[_0x1ac4('0x43')]);return _0x47e0e7[_0x1ac4('0x55')](_0x300c69);}})[_0x1ac4('0x29')](function(_0x5eed6f){if(_0x5eed6f){_0x23285d=_0x5eed6f[_0x1ac4('0x3a')];if(!_0x4ccb4e[_0x1ac4('0x35')][_0x1ac4('0x52')](_0x1ac4('0x3b'))){_0x300c69['limit']=qs[_0x1ac4('0x20')](_0x4ccb4e[_0x1ac4('0x35')][_0x1ac4('0x20')]);_0x300c69[_0x1ac4('0x1f')]=qs[_0x1ac4('0x1f')](_0x4ccb4e[_0x1ac4('0x35')]['offset']);}return _0x47e0e7[_0x1ac4('0x55')](_0x300c69);}})[_0x1ac4('0x29')](function(_0x13601b){if(_0x13601b){return _0x13601b?{'count':_0x23285d,'rows':_0x13601b}:null;}})[_0x1ac4('0x29')](respondWithResult(_0x3e886d,null))['catch'](handleError(_0x3e886d,null));};exports[_0x1ac4('0x56')]=function(_0x533b40,_0x589b31,_0x12c7ec){if(_0x533b40[_0x1ac4('0x4d')]['id']){delete _0x533b40[_0x1ac4('0x4d')]['id'];}return db[_0x1ac4('0x44')][_0x1ac4('0x50')]({'where':{'id':_0x533b40[_0x1ac4('0x4e')]['id']}})[_0x1ac4('0x29')](handleEntityNotFound(_0x589b31,null))[_0x1ac4('0x29')](function(_0x1e5c72){if(_0x1e5c72){return _0x1e5c72[_0x1ac4('0x56')](_0x533b40[_0x1ac4('0x4d')][_0x1ac4('0x57')]||[]);}return null;})[_0x1ac4('0x29')](respondWithResult(_0x589b31,null))['catch'](handleError(_0x589b31,null));}; \ No newline at end of file +var _0xb697=['merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','destroy','getFields','findOne','FreshdeskField','order','getSubjects','getDescriptions','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','end','sendStatus','error','stack','name','send','FreshdeskConfiguration','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where'];(function(_0x13e22d,_0x53d36c){var _0x34de6f=function(_0x50f1f0){while(--_0x50f1f0){_0x13e22d['push'](_0x13e22d['shift']());}};_0x34de6f(++_0x53d36c);}(_0xb697,0x17a));var _0x7b69=function(_0x36b4ec,_0xca457d){_0x36b4ec=_0x36b4ec-0x0;var _0x11c709=_0xb697[_0x36b4ec];return _0x11c709;};'use strict';var emlformat=require(_0x7b69('0x0'));var rimraf=require(_0x7b69('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7b69('0x2'));var rp=require(_0x7b69('0x3'));var moment=require(_0x7b69('0x4'));var BPromise=require(_0x7b69('0x5'));var Mustache=require('mustache');var util=require(_0x7b69('0x6'));var path=require(_0x7b69('0x7'));var sox=require(_0x7b69('0x8'));var csv=require(_0x7b69('0x9'));var ejs=require(_0x7b69('0xa'));var fs=require('fs');var fs_extra=require(_0x7b69('0xb'));var _=require('lodash');var squel=require(_0x7b69('0xc'));var crypto=require(_0x7b69('0xd'));var jsforce=require(_0x7b69('0xe'));var deskjs=require(_0x7b69('0xf'));var toCsv=require(_0x7b69('0x9'));var querystring=require(_0x7b69('0x10'));var Papa=require(_0x7b69('0x11'));var Redis=require('ioredis');var authService=require(_0x7b69('0x12'));var qs=require(_0x7b69('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7b69('0x14'));var logger=require(_0x7b69('0x15'))(_0x7b69('0x16'));var utils=require(_0x7b69('0x17'));var config=require(_0x7b69('0x18'));var licenseUtil=require(_0x7b69('0x19'));var db=require(_0x7b69('0x1a'))['db'];function respondWithStatusCode(_0x47b7c0,_0x4faac8){_0x4faac8=_0x4faac8||0xcc;return function(_0x561c6d){if(_0x561c6d){return _0x47b7c0['sendStatus'](_0x4faac8);}return _0x47b7c0[_0x7b69('0x1b')](_0x4faac8)['end']();};}function respondWithResult(_0x54cdad,_0x32109d){_0x32109d=_0x32109d||0xc8;return function(_0x131680){if(_0x131680){return _0x54cdad[_0x7b69('0x1b')](_0x32109d)[_0x7b69('0x1c')](_0x131680);}};}function respondWithFilteredResult(_0x2bda29,_0x136b7c){return function(_0x53a163){if(_0x53a163){var _0xeb6e3c=typeof _0x136b7c[_0x7b69('0x1d')]==='undefined'&&typeof _0x136b7c[_0x7b69('0x1e')]===_0x7b69('0x1f');var _0x3857a7=_0x53a163[_0x7b69('0x20')];var _0x6b0685=_0xeb6e3c?0x0:_0x136b7c[_0x7b69('0x1d')];var _0x4ac8c9=_0xeb6e3c?_0x53a163[_0x7b69('0x20')]:_0x136b7c[_0x7b69('0x1d')]+_0x136b7c['limit'];var _0x1f899c;if(_0x4ac8c9>=_0x3857a7){_0x4ac8c9=_0x3857a7;_0x1f899c=0xc8;}else{_0x1f899c=0xce;}_0x2bda29[_0x7b69('0x1b')](_0x1f899c);return _0x2bda29[_0x7b69('0x21')](_0x7b69('0x22'),_0x6b0685+'-'+_0x4ac8c9+'/'+_0x3857a7)[_0x7b69('0x1c')](_0x53a163);}return null;};}function patchUpdates(_0x21fd9a){return function(_0x124523){try{jsonpatch[_0x7b69('0x23')](_0x124523,_0x21fd9a,!![]);}catch(_0x5edb51){return BPromise[_0x7b69('0x24')](_0x5edb51);}return _0x124523[_0x7b69('0x25')]();};}function saveUpdates(_0x22ef1a,_0x45a3d0){return function(_0x91e1c5){if(_0x91e1c5){return _0x91e1c5[_0x7b69('0x26')](_0x22ef1a)[_0x7b69('0x27')](function(_0x2d4759){return _0x2d4759;});}return null;};}function removeEntity(_0x5def85,_0x627e86){return function(_0x15014c){if(_0x15014c){return _0x15014c['destroy']()[_0x7b69('0x27')](function(){_0x5def85[_0x7b69('0x1b')](0xcc)[_0x7b69('0x28')]();});}};}function handleEntityNotFound(_0x11c3fc,_0x43f606){return function(_0x216893){if(!_0x216893){_0x11c3fc[_0x7b69('0x29')](0x194);}return _0x216893;};}function handleError(_0x64cdb,_0x5ea963){_0x5ea963=_0x5ea963||0x1f4;return function(_0x451463){logger[_0x7b69('0x2a')](_0x451463[_0x7b69('0x2b')]);if(_0x451463[_0x7b69('0x2c')]){delete _0x451463[_0x7b69('0x2c')];}_0x64cdb[_0x7b69('0x1b')](_0x5ea963)[_0x7b69('0x2d')](_0x451463);};}exports['index']=function(_0x10c4bd,_0x4e21c0){var _0x17c767={},_0x269261={},_0x45f302={'count':0x0,'rows':[]};var _0x37ecd0=_['map'](db[_0x7b69('0x2e')]['rawAttributes'],function(_0x2e89d6){return{'name':_0x2e89d6[_0x7b69('0x2f')],'type':_0x2e89d6[_0x7b69('0x30')]['key']};});_0x269261[_0x7b69('0x31')]=_['map'](_0x37ecd0,_0x7b69('0x2c'));_0x269261[_0x7b69('0x32')]=_['keys'](_0x10c4bd[_0x7b69('0x32')]);_0x269261['filters']=_[_0x7b69('0x33')](_0x269261[_0x7b69('0x31')],_0x269261[_0x7b69('0x32')]);_0x17c767[_0x7b69('0x34')]=_['intersection'](_0x269261[_0x7b69('0x31')],qs[_0x7b69('0x35')](_0x10c4bd[_0x7b69('0x32')][_0x7b69('0x35')]));_0x17c767[_0x7b69('0x34')]=_0x17c767[_0x7b69('0x34')][_0x7b69('0x36')]?_0x17c767[_0x7b69('0x34')]:_0x269261['model'];if(!_0x10c4bd[_0x7b69('0x32')][_0x7b69('0x37')](_0x7b69('0x38'))){_0x17c767[_0x7b69('0x1e')]=qs[_0x7b69('0x1e')](_0x10c4bd[_0x7b69('0x32')][_0x7b69('0x1e')]);_0x17c767[_0x7b69('0x1d')]=qs['offset'](_0x10c4bd[_0x7b69('0x32')][_0x7b69('0x1d')]);}_0x17c767['order']=qs[_0x7b69('0x39')](_0x10c4bd['query'][_0x7b69('0x39')]);_0x17c767['where']=qs[_0x7b69('0x3a')](_[_0x7b69('0x3b')](_0x10c4bd[_0x7b69('0x32')],_0x269261[_0x7b69('0x3a')]),_0x37ecd0);if(_0x10c4bd[_0x7b69('0x32')][_0x7b69('0x3c')]){_0x17c767[_0x7b69('0x3d')]=_[_0x7b69('0x3e')](_0x17c767['where'],{'$or':_[_0x7b69('0x3f')](_0x37ecd0,function(_0x5be5f8){if(_0x5be5f8[_0x7b69('0x30')]!==_0x7b69('0x40')){var _0x1e8b37={};_0x1e8b37[_0x5be5f8[_0x7b69('0x2c')]]={'$like':'%'+_0x10c4bd[_0x7b69('0x32')][_0x7b69('0x3c')]+'%'};return _0x1e8b37;}})});}_0x17c767=_['merge']({},_0x17c767,_0x10c4bd[_0x7b69('0x41')]);var _0x1f78d7={'where':_0x17c767[_0x7b69('0x3d')]};return db['FreshdeskConfiguration'][_0x7b69('0x20')](_0x1f78d7)[_0x7b69('0x27')](function(_0x27310e){_0x45f302[_0x7b69('0x20')]=_0x27310e;if(_0x10c4bd[_0x7b69('0x32')][_0x7b69('0x42')]){_0x17c767[_0x7b69('0x43')]=[{'all':!![]}];}return db[_0x7b69('0x2e')][_0x7b69('0x44')](_0x17c767);})[_0x7b69('0x27')](function(_0x10e93c){_0x45f302[_0x7b69('0x45')]=_0x10e93c;return _0x45f302;})['then'](respondWithFilteredResult(_0x4e21c0,_0x17c767))[_0x7b69('0x46')](handleError(_0x4e21c0,null));};exports[_0x7b69('0x47')]=function(_0x1336f9,_0x278d71){var _0x47742a={'raw':![],'where':{'id':_0x1336f9[_0x7b69('0x48')]['id']}},_0x5e346a={};_0x5e346a[_0x7b69('0x31')]=_[_0x7b69('0x49')](db[_0x7b69('0x2e')][_0x7b69('0x4a')]);_0x5e346a[_0x7b69('0x32')]=_[_0x7b69('0x49')](_0x1336f9['query']);_0x5e346a[_0x7b69('0x3a')]=_[_0x7b69('0x33')](_0x5e346a[_0x7b69('0x31')],_0x5e346a['query']);_0x47742a[_0x7b69('0x34')]=_['intersection'](_0x5e346a[_0x7b69('0x31')],qs[_0x7b69('0x35')](_0x1336f9[_0x7b69('0x32')][_0x7b69('0x35')]));_0x47742a['attributes']=_0x47742a[_0x7b69('0x34')][_0x7b69('0x36')]?_0x47742a[_0x7b69('0x34')]:_0x5e346a[_0x7b69('0x31')];if(_0x1336f9['query'][_0x7b69('0x42')]){_0x47742a[_0x7b69('0x43')]=[{'all':!![]}];}_0x47742a=_[_0x7b69('0x3e')]({},_0x47742a,_0x1336f9[_0x7b69('0x41')]);return db[_0x7b69('0x2e')][_0x7b69('0x4b')](_0x47742a)[_0x7b69('0x27')](handleEntityNotFound(_0x278d71,null))[_0x7b69('0x27')](respondWithResult(_0x278d71,null))[_0x7b69('0x46')](handleError(_0x278d71,null));};exports[_0x7b69('0x4c')]=function(_0x530fdc,_0x20633){return db[_0x7b69('0x2e')][_0x7b69('0x4c')](_0x530fdc[_0x7b69('0x4d')],{})[_0x7b69('0x27')](respondWithResult(_0x20633,0xc9))[_0x7b69('0x46')](handleError(_0x20633,null));};exports[_0x7b69('0x26')]=function(_0xa1e54a,_0x10e11d){if(_0xa1e54a[_0x7b69('0x4d')]['id']){delete _0xa1e54a['body']['id'];}return db[_0x7b69('0x2e')][_0x7b69('0x4b')]({'where':{'id':_0xa1e54a[_0x7b69('0x48')]['id']}})[_0x7b69('0x27')](handleEntityNotFound(_0x10e11d,null))[_0x7b69('0x27')](saveUpdates(_0xa1e54a[_0x7b69('0x4d')],null))['then'](respondWithResult(_0x10e11d,null))[_0x7b69('0x46')](handleError(_0x10e11d,null));};exports[_0x7b69('0x4e')]=function(_0x172406,_0x13b165){return db['FreshdeskConfiguration'][_0x7b69('0x4b')]({'where':{'id':_0x172406['params']['id']}})['then'](handleEntityNotFound(_0x13b165,null))[_0x7b69('0x27')](removeEntity(_0x13b165,null))['catch'](handleError(_0x13b165,null));};exports[_0x7b69('0x4f')]=function(_0x2505ce,_0x20215e,_0x2ecf68){var _0xa13cdf={};var _0x5210b4={};var _0x971536;var _0x47f43c;return db[_0x7b69('0x2e')][_0x7b69('0x50')]({'where':{'id':_0x2505ce[_0x7b69('0x48')]['id']}})[_0x7b69('0x27')](handleEntityNotFound(_0x20215e,null))['then'](function(_0x4561dc){if(_0x4561dc){_0x971536=_0x4561dc;_0x5210b4['model']=_[_0x7b69('0x49')](db[_0x7b69('0x51')][_0x7b69('0x4a')]);_0x5210b4['query']=_[_0x7b69('0x49')](_0x2505ce['query']);_0x5210b4[_0x7b69('0x3a')]=_[_0x7b69('0x33')](_0x5210b4['model'],_0x5210b4['query']);_0xa13cdf[_0x7b69('0x34')]=_[_0x7b69('0x33')](_0x5210b4[_0x7b69('0x31')],qs[_0x7b69('0x35')](_0x2505ce['query'][_0x7b69('0x35')]));_0xa13cdf[_0x7b69('0x34')]=_0xa13cdf[_0x7b69('0x34')][_0x7b69('0x36')]?_0xa13cdf[_0x7b69('0x34')]:_0x5210b4[_0x7b69('0x31')];_0xa13cdf[_0x7b69('0x52')]=qs[_0x7b69('0x39')](_0x2505ce[_0x7b69('0x32')]['sort']);_0xa13cdf[_0x7b69('0x3d')]=qs[_0x7b69('0x3a')](_['pick'](_0x2505ce['query'],_0x5210b4[_0x7b69('0x3a')]));if(_0x2505ce[_0x7b69('0x32')][_0x7b69('0x3c')]){_0xa13cdf[_0x7b69('0x3d')]=_[_0x7b69('0x3e')](_0xa13cdf['where'],{'$or':_['map'](_0xa13cdf[_0x7b69('0x34')],function(_0x52318a){var _0x15e3a5={};_0x15e3a5[_0x52318a]={'$like':'%'+_0x2505ce[_0x7b69('0x32')][_0x7b69('0x3c')]+'%'};return _0x15e3a5;})});}_0xa13cdf=_[_0x7b69('0x3e')]({},_0xa13cdf,_0x2505ce[_0x7b69('0x41')]);return _0x971536[_0x7b69('0x4f')](_0xa13cdf);}})[_0x7b69('0x27')](function(_0x31caf8){if(_0x31caf8){_0x47f43c=_0x31caf8[_0x7b69('0x36')];if(!_0x2505ce[_0x7b69('0x32')][_0x7b69('0x37')]('nolimit')){_0xa13cdf[_0x7b69('0x1e')]=qs[_0x7b69('0x1e')](_0x2505ce[_0x7b69('0x32')][_0x7b69('0x1e')]);_0xa13cdf[_0x7b69('0x1d')]=qs[_0x7b69('0x1d')](_0x2505ce['query']['offset']);}return _0x971536[_0x7b69('0x4f')](_0xa13cdf);}})[_0x7b69('0x27')](function(_0x4eab78){if(_0x4eab78){return _0x4eab78?{'count':_0x47f43c,'rows':_0x4eab78}:null;}})[_0x7b69('0x27')](respondWithResult(_0x20215e,null))[_0x7b69('0x46')](handleError(_0x20215e,null));};exports[_0x7b69('0x53')]=function(_0x51efb8,_0xc3ae24,_0x432ba4){var _0x5021aa={};var _0x843227={};var _0x38a826;var _0x5465b5;return db[_0x7b69('0x2e')][_0x7b69('0x50')]({'where':{'id':_0x51efb8[_0x7b69('0x48')]['id']}})[_0x7b69('0x27')](handleEntityNotFound(_0xc3ae24,null))['then'](function(_0xdd5161){if(_0xdd5161){_0x38a826=_0xdd5161;_0x843227['model']=_['keys'](db[_0x7b69('0x51')][_0x7b69('0x4a')]);_0x843227[_0x7b69('0x32')]=_[_0x7b69('0x49')](_0x51efb8['query']);_0x843227[_0x7b69('0x3a')]=_['intersection'](_0x843227[_0x7b69('0x31')],_0x843227[_0x7b69('0x32')]);_0x5021aa[_0x7b69('0x34')]=_['intersection'](_0x843227[_0x7b69('0x31')],qs[_0x7b69('0x35')](_0x51efb8['query'][_0x7b69('0x35')]));_0x5021aa['attributes']=_0x5021aa[_0x7b69('0x34')][_0x7b69('0x36')]?_0x5021aa[_0x7b69('0x34')]:_0x843227[_0x7b69('0x31')];_0x5021aa[_0x7b69('0x52')]=qs[_0x7b69('0x39')](_0x51efb8[_0x7b69('0x32')][_0x7b69('0x39')]);_0x5021aa['where']=qs['filters'](_['pick'](_0x51efb8[_0x7b69('0x32')],_0x843227[_0x7b69('0x3a')]));if(_0x51efb8[_0x7b69('0x32')][_0x7b69('0x3c')]){_0x5021aa[_0x7b69('0x3d')]=_['merge'](_0x5021aa[_0x7b69('0x3d')],{'$or':_[_0x7b69('0x3f')](_0x5021aa['attributes'],function(_0x170f40){var _0x1baba1={};_0x1baba1[_0x170f40]={'$like':'%'+_0x51efb8[_0x7b69('0x32')][_0x7b69('0x3c')]+'%'};return _0x1baba1;})});}_0x5021aa=_['merge']({},_0x5021aa,_0x51efb8['options']);return _0x38a826[_0x7b69('0x53')](_0x5021aa);}})['then'](function(_0x284e32){if(_0x284e32){_0x5465b5=_0x284e32[_0x7b69('0x36')];if(!_0x51efb8['query'][_0x7b69('0x37')](_0x7b69('0x38'))){_0x5021aa[_0x7b69('0x1e')]=qs[_0x7b69('0x1e')](_0x51efb8[_0x7b69('0x32')]['limit']);_0x5021aa[_0x7b69('0x1d')]=qs[_0x7b69('0x1d')](_0x51efb8['query'][_0x7b69('0x1d')]);}return _0x38a826[_0x7b69('0x53')](_0x5021aa);}})[_0x7b69('0x27')](function(_0x5eb7b5){if(_0x5eb7b5){return _0x5eb7b5?{'count':_0x5465b5,'rows':_0x5eb7b5}:null;}})['then'](respondWithResult(_0xc3ae24,null))[_0x7b69('0x46')](handleError(_0xc3ae24,null));};exports[_0x7b69('0x54')]=function(_0x1ec00b,_0x166599,_0x5bb672){var _0x401203={};var _0x13ece1={};var _0xff729f;var _0x15aee6;return db[_0x7b69('0x2e')][_0x7b69('0x50')]({'where':{'id':_0x1ec00b[_0x7b69('0x48')]['id']}})[_0x7b69('0x27')](handleEntityNotFound(_0x166599,null))[_0x7b69('0x27')](function(_0x27680d){if(_0x27680d){_0xff729f=_0x27680d;_0x13ece1[_0x7b69('0x31')]=_[_0x7b69('0x49')](db[_0x7b69('0x51')][_0x7b69('0x4a')]);_0x13ece1[_0x7b69('0x32')]=_['keys'](_0x1ec00b['query']);_0x13ece1['filters']=_[_0x7b69('0x33')](_0x13ece1[_0x7b69('0x31')],_0x13ece1[_0x7b69('0x32')]);_0x401203[_0x7b69('0x34')]=_[_0x7b69('0x33')](_0x13ece1['model'],qs[_0x7b69('0x35')](_0x1ec00b[_0x7b69('0x32')]['fields']));_0x401203[_0x7b69('0x34')]=_0x401203[_0x7b69('0x34')][_0x7b69('0x36')]?_0x401203[_0x7b69('0x34')]:_0x13ece1[_0x7b69('0x31')];_0x401203[_0x7b69('0x52')]=qs[_0x7b69('0x39')](_0x1ec00b[_0x7b69('0x32')][_0x7b69('0x39')]);_0x401203['where']=qs[_0x7b69('0x3a')](_[_0x7b69('0x3b')](_0x1ec00b['query'],_0x13ece1[_0x7b69('0x3a')]));if(_0x1ec00b[_0x7b69('0x32')]['filter']){_0x401203[_0x7b69('0x3d')]=_[_0x7b69('0x3e')](_0x401203[_0x7b69('0x3d')],{'$or':_[_0x7b69('0x3f')](_0x401203[_0x7b69('0x34')],function(_0x382b10){var _0x50752c={};_0x50752c[_0x382b10]={'$like':'%'+_0x1ec00b[_0x7b69('0x32')]['filter']+'%'};return _0x50752c;})});}_0x401203=_[_0x7b69('0x3e')]({},_0x401203,_0x1ec00b[_0x7b69('0x41')]);return _0xff729f['getDescriptions'](_0x401203);}})[_0x7b69('0x27')](function(_0x1e49e5){if(_0x1e49e5){_0x15aee6=_0x1e49e5[_0x7b69('0x36')];if(!_0x1ec00b[_0x7b69('0x32')][_0x7b69('0x37')](_0x7b69('0x38'))){_0x401203[_0x7b69('0x1e')]=qs['limit'](_0x1ec00b['query'][_0x7b69('0x1e')]);_0x401203[_0x7b69('0x1d')]=qs[_0x7b69('0x1d')](_0x1ec00b[_0x7b69('0x32')][_0x7b69('0x1d')]);}return _0xff729f[_0x7b69('0x54')](_0x401203);}})['then'](function(_0x8a2f1b){if(_0x8a2f1b){return _0x8a2f1b?{'count':_0x15aee6,'rows':_0x8a2f1b}:null;}})['then'](respondWithResult(_0x166599,null))[_0x7b69('0x46')](handleError(_0x166599,null));};exports['getTags']=function(_0x506a14,_0x5c7cab,_0x1aeb3f){var _0x1f7857={};var _0x47050d={};var _0x5b735e;var _0x24a60c;return db[_0x7b69('0x2e')][_0x7b69('0x50')]({'where':{'id':_0x506a14[_0x7b69('0x48')]['id']}})[_0x7b69('0x27')](handleEntityNotFound(_0x5c7cab,null))[_0x7b69('0x27')](function(_0x18e361){if(_0x18e361){_0x5b735e=_0x18e361;_0x47050d[_0x7b69('0x31')]=_[_0x7b69('0x49')](db[_0x7b69('0x55')][_0x7b69('0x4a')]);_0x47050d[_0x7b69('0x32')]=_[_0x7b69('0x49')](_0x506a14[_0x7b69('0x32')]);_0x47050d[_0x7b69('0x3a')]=_['intersection'](_0x47050d[_0x7b69('0x31')],_0x47050d['query']);_0x1f7857[_0x7b69('0x34')]=_[_0x7b69('0x33')](_0x47050d[_0x7b69('0x31')],qs[_0x7b69('0x35')](_0x506a14[_0x7b69('0x32')][_0x7b69('0x35')]));_0x1f7857['attributes']=_0x1f7857[_0x7b69('0x34')][_0x7b69('0x36')]?_0x1f7857['attributes']:_0x47050d[_0x7b69('0x31')];_0x1f7857[_0x7b69('0x52')]=qs['sort'](_0x506a14[_0x7b69('0x32')]['sort']);_0x1f7857[_0x7b69('0x3d')]=qs['filters'](_[_0x7b69('0x3b')](_0x506a14['query'],_0x47050d['filters']));if(_0x506a14[_0x7b69('0x32')]['filter']){_0x1f7857[_0x7b69('0x3d')]=_[_0x7b69('0x3e')](_0x1f7857[_0x7b69('0x3d')],{'$or':_[_0x7b69('0x3f')](_0x1f7857[_0x7b69('0x34')],function(_0x3aa5a6){var _0x1b618e={};_0x1b618e[_0x3aa5a6]={'$like':'%'+_0x506a14[_0x7b69('0x32')][_0x7b69('0x3c')]+'%'};return _0x1b618e;})});}_0x1f7857=_[_0x7b69('0x3e')]({},_0x1f7857,_0x506a14[_0x7b69('0x41')]);return _0x5b735e['getTags'](_0x1f7857);}})[_0x7b69('0x27')](function(_0x2d164f){if(_0x2d164f){_0x24a60c=_0x2d164f[_0x7b69('0x36')];if(!_0x506a14['query'][_0x7b69('0x37')](_0x7b69('0x38'))){_0x1f7857['limit']=qs[_0x7b69('0x1e')](_0x506a14['query'][_0x7b69('0x1e')]);_0x1f7857[_0x7b69('0x1d')]=qs[_0x7b69('0x1d')](_0x506a14['query'][_0x7b69('0x1d')]);}return _0x5b735e['getTags'](_0x1f7857);}})['then'](function(_0x4f4586){if(_0x4f4586){return _0x4f4586?{'count':_0x24a60c,'rows':_0x4f4586}:null;}})[_0x7b69('0x27')](respondWithResult(_0x5c7cab,null))[_0x7b69('0x46')](handleError(_0x5c7cab,null));};exports['setTags']=function(_0x410008,_0x15f4c8,_0xbdf41f){if(_0x410008[_0x7b69('0x4d')]['id']){delete _0x410008['body']['id'];}return db[_0x7b69('0x2e')]['findOne']({'where':{'id':_0x410008[_0x7b69('0x48')]['id']}})[_0x7b69('0x27')](handleEntityNotFound(_0x15f4c8,null))[_0x7b69('0x27')](function(_0x4273d4){if(_0x4273d4){return _0x4273d4[_0x7b69('0x56')](_0x410008[_0x7b69('0x4d')][_0x7b69('0x57')]||[]);}return null;})[_0x7b69('0x27')](respondWithResult(_0x15f4c8,null))[_0x7b69('0x46')](handleError(_0x15f4c8,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 7b2cc14..27bfd18 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 _0x7540=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util'];(function(_0x5849a0,_0x5c2a2b){var _0x40b111=function(_0x40452d){while(--_0x40452d){_0x5849a0['push'](_0x5849a0['shift']());}};_0x40b111(++_0x5c2a2b);}(_0x7540,0x184));var _0x0754=function(_0x10dfdf,_0x36b623){_0x10dfdf=_0x10dfdf-0x0;var _0x4d857d=_0x7540[_0x10dfdf];return _0x4d857d;};'use strict';var _=require(_0x0754('0x0'));var util=require(_0x0754('0x1'));var logger=require(_0x0754('0x2'))(_0x0754('0x3'));var moment=require(_0x0754('0x4'));var BPromise=require(_0x0754('0x5'));var rp=require(_0x0754('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0754('0x7'));var config=require(_0x0754('0x8'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x0754('0x9')]=function(_0x34bfb2,_0x11326b){return _0x34bfb2[_0x0754('0xa')](_0x0754('0xb'),attributes,{'tableName':_0x0754('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x54fd=['util','../../config/logger','api','bluebird','path','../../config/environment','exports','define','FreshdeskConfiguration','int_freshdesk_configurations'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x54fd,0x1cc));var _0xd54f=function(_0x2fdfef,_0x4ec727){_0x2fdfef=_0x2fdfef-0x0;var _0x16b431=_0x54fd[_0x2fdfef];return _0x16b431;};'use strict';var _=require('lodash');var util=require(_0xd54f('0x0'));var logger=require(_0xd54f('0x1'))(_0xd54f('0x2'));var moment=require('moment');var BPromise=require(_0xd54f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd54f('0x4'));var rimraf=require('rimraf');var config=require(_0xd54f('0x5'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0xd54f('0x6')]=function(_0x44cf2d,_0x5bb153){return _0x44cf2d[_0xd54f('0x7')](_0xd54f('0x8'),attributes,{'tableName':_0xd54f('0x9'),'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 4e4f632..48c0491 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 _0xdee4=['result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x5698ac,_0x381805){var _0x4e3d24=function(_0x41e2f1){while(--_0x41e2f1){_0x5698ac['push'](_0x5698ac['shift']());}};_0x4e3d24(++_0x381805);}(_0xdee4,0x136));var _0x4dee=function(_0x3f4bb3,_0x54f0de){_0x3f4bb3=_0x3f4bb3-0x0;var _0x1cb73a=_0xdee4[_0x3f4bb3];return _0x1cb73a;};'use strict';var _=require(_0x4dee('0x0'));var util=require(_0x4dee('0x1'));var moment=require(_0x4dee('0x2'));var BPromise=require('bluebird');var rs=require(_0x4dee('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4dee('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4dee('0x5'))(_0x4dee('0x6'));var config=require(_0x4dee('0x7'));var jayson=require(_0x4dee('0x8'));var client=jayson[_0x4dee('0x9')][_0x4dee('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x541667,_0x1e32af,_0x332974){return new BPromise(function(_0x4d6800,_0x2fbe27){return client[_0x4dee('0xb')](_0x541667,_0x332974)[_0x4dee('0xc')](function(_0x97bac){logger[_0x4dee('0xd')](_0x4dee('0xe'),_0x1e32af,_0x4dee('0xf'));logger[_0x4dee('0x10')](_0x4dee('0x11'),_0x1e32af,_0x4dee('0xf'),JSON['stringify'](_0x97bac));if(_0x97bac[_0x4dee('0x12')]){if(_0x97bac[_0x4dee('0x12')]['code']===0x1f4){logger[_0x4dee('0x12')](_0x4dee('0xe'),_0x1e32af,_0x97bac[_0x4dee('0x12')][_0x4dee('0x13')]);return _0x2fbe27(_0x97bac[_0x4dee('0x12')][_0x4dee('0x13')]);}logger[_0x4dee('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1e32af,_0x97bac[_0x4dee('0x12')]['message']);return _0x4d6800(_0x97bac[_0x4dee('0x12')]['message']);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x1e32af,_0x4dee('0xf'));_0x4d6800(_0x97bac[_0x4dee('0x14')][_0x4dee('0x13')]);}})[_0x4dee('0x15')](function(_0x390fb6){logger['error'](_0x4dee('0xe'),_0x1e32af,_0x390fb6);_0x2fbe27(_0x390fb6);});});} \ No newline at end of file +var _0xb1cc=['client','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x20b50c,_0x65311){var _0xb68628=function(_0x2c17aa){while(--_0x2c17aa){_0x20b50c['push'](_0x20b50c['shift']());}};_0xb68628(++_0x65311);}(_0xb1cc,0xf2));var _0xcb1c=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xb1cc[_0xea8947];return _0x2455e9;};'use strict';var _=require(_0xcb1c('0x0'));var util=require(_0xcb1c('0x1'));var moment=require('moment');var BPromise=require(_0xcb1c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb1c('0x3'));var db=require(_0xcb1c('0x4'))['db'];var utils=require(_0xcb1c('0x5'));var logger=require(_0xcb1c('0x6'))(_0xcb1c('0x7'));var config=require(_0xcb1c('0x8'));var jayson=require(_0xcb1c('0x9'));var client=jayson[_0xcb1c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a15b2,_0x10835d,_0x6b523b){return new BPromise(function(_0x213e3b,_0x36112b){return client[_0xcb1c('0xb')](_0x2a15b2,_0x6b523b)[_0xcb1c('0xc')](function(_0x14cbd7){logger[_0xcb1c('0xd')](_0xcb1c('0xe'),_0x10835d,'request\x20sent');logger[_0xcb1c('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x10835d,'request\x20sent',JSON['stringify'](_0x14cbd7));if(_0x14cbd7[_0xcb1c('0x10')]){if(_0x14cbd7['error'][_0xcb1c('0x11')]===0x1f4){logger[_0xcb1c('0x10')](_0xcb1c('0xe'),_0x10835d,_0x14cbd7['error'][_0xcb1c('0x12')]);return _0x36112b(_0x14cbd7[_0xcb1c('0x10')][_0xcb1c('0x12')]);}logger[_0xcb1c('0x10')](_0xcb1c('0xe'),_0x10835d,_0x14cbd7[_0xcb1c('0x10')][_0xcb1c('0x12')]);return _0x213e3b(_0x14cbd7[_0xcb1c('0x10')][_0xcb1c('0x12')]);}else{logger['info'](_0xcb1c('0xe'),_0x10835d,'request\x20sent');_0x213e3b(_0x14cbd7[_0xcb1c('0x13')][_0xcb1c('0x12')]);}})[_0xcb1c('0x14')](function(_0x406fa1){logger['error'](_0xcb1c('0xe'),_0x10835d,_0x406fa1);_0x36112b(_0x406fa1);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 0b3802f..451aaca 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 _0x6927=['isAuthenticated','index','show','post','put','update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x28cf06,_0x29c419){var _0x3e96aa=function(_0x2d02d9){while(--_0x2d02d9){_0x28cf06['push'](_0x28cf06['shift']());}};_0x3e96aa(++_0x29c419);}(_0x6927,0xd4));var _0x7692=function(_0x455271,_0x44f046){_0x455271=_0x455271-0x0;var _0x5564c0=_0x6927[_0x455271];return _0x5564c0;};'use strict';var multer=require(_0x7692('0x0'));var util=require(_0x7692('0x1'));var path=require(_0x7692('0x2'));var timeout=require('connect-timeout');var express=require(_0x7692('0x3'));var router=express[_0x7692('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7692('0x5'));var interaction=require(_0x7692('0x6'));var config=require(_0x7692('0x7'));var controller=require('./intFreshdeskField.controller');router[_0x7692('0x8')]('/',auth[_0x7692('0x9')](),controller[_0x7692('0xa')]);router[_0x7692('0x8')]('/:id',auth[_0x7692('0x9')](),controller[_0x7692('0xb')]);router[_0x7692('0xc')]('/',auth[_0x7692('0x9')](),controller['create']);router[_0x7692('0xd')]('/:id',auth[_0x7692('0x9')](),controller[_0x7692('0xe')]);router[_0x7692('0xf')]('/:id',auth[_0x7692('0x9')](),controller[_0x7692('0x10')]);module['exports']=router; \ No newline at end of file +var _0xdf13=['fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show','post','create','delete','destroy','multer','connect-timeout','express','Router'];(function(_0x1574ec,_0x2201fc){var _0x47f1ba=function(_0x31eeac){while(--_0x31eeac){_0x1574ec['push'](_0x1574ec['shift']());}};_0x47f1ba(++_0x2201fc);}(_0xdf13,0x1c7));var _0x3df1=function(_0x404957,_0x5192a4){_0x404957=_0x404957-0x0;var _0x4e0365=_0xdf13[_0x404957];return _0x4e0365;};'use strict';var multer=require(_0x3df1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3df1('0x1'));var express=require(_0x3df1('0x2'));var router=express[_0x3df1('0x3')]();var fs_extra=require(_0x3df1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3df1('0x5'));var config=require(_0x3df1('0x6'));var controller=require(_0x3df1('0x7'));router[_0x3df1('0x8')]('/',auth[_0x3df1('0x9')](),controller[_0x3df1('0xa')]);router['get'](_0x3df1('0xb'),auth[_0x3df1('0x9')](),controller[_0x3df1('0xc')]);router[_0x3df1('0xd')]('/',auth['isAuthenticated'](),controller[_0x3df1('0xe')]);router['put'](_0x3df1('0xb'),auth[_0x3df1('0x9')](),controller['update']);router[_0x3df1('0xf')](_0x3df1('0xb'),auth['isAuthenticated'](),controller[_0x3df1('0x10')]);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 a6d033d..3f148b1 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 _0x1576=['keyValue','string','STRING','customVariable','sequelize','exports','ENUM','variable'];(function(_0x508338,_0xcf1f4d){var _0x1ccd1b=function(_0x3b4525){while(--_0x3b4525){_0x508338['push'](_0x508338['shift']());}};_0x1ccd1b(++_0xcf1f4d);}(_0x1576,0x14c));var _0x6157=function(_0x50c7e5,_0x380f0f){_0x50c7e5=_0x50c7e5-0x0;var _0x108f56=_0x1576[_0x50c7e5];return _0x108f56;};'use strict';var Sequelize=require(_0x6157('0x0'));module[_0x6157('0x1')]={'type':{'type':Sequelize[_0x6157('0x2')]('string',_0x6157('0x3'),'customVariable',_0x6157('0x4'),'picklist'),'defaultValue':_0x6157('0x5')},'content':{'type':Sequelize[_0x6157('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6157('0x2')]('string',_0x6157('0x3'),_0x6157('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x6157('0x6')]},'nameField':{'type':Sequelize[_0x6157('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x226a=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x226a,0x141));var _0xa226=function(_0x476c7,_0x298ee0){_0x476c7=_0x476c7-0x0;var _0x47ae56=_0x226a[_0x476c7];return _0x47ae56;};'use strict';var Sequelize=require(_0xa226('0x0'));module[_0xa226('0x1')]={'type':{'type':Sequelize[_0xa226('0x2')](_0xa226('0x3'),_0xa226('0x4'),_0xa226('0x5'),_0xa226('0x6'),_0xa226('0x7')),'defaultValue':_0xa226('0x3')},'content':{'type':Sequelize[_0xa226('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xa226('0x3'),_0xa226('0x4'),_0xa226('0x5'))},'keyContent':{'type':Sequelize[_0xa226('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xa226('0x8')]},'customField':{'type':Sequelize[_0xa226('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa226('0x8')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 80b2b93..6d710e8 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 _0x0713=['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','index','FreshdeskField','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','params','keys','find','catch','body','zip-dir','fast-json-patch'];(function(_0x172c3a,_0x1c62d2){var _0x4c38d3=function(_0x4f752d){while(--_0x4f752d){_0x172c3a['push'](_0x172c3a['shift']());}};_0x4c38d3(++_0x1c62d2);}(_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={},_0x292205={},_0x254fc8={'count':0x0,'rows':[]};var _0x5aba96=_['map'](db[_0x3071('0x2d')][_0x3071('0x2e')],function(_0x6ddf96){return{'name':_0x6ddf96[_0x3071('0x2f')],'type':_0x6ddf96[_0x3071('0x30')][_0x3071('0x31')]};});_0x292205[_0x3071('0x32')]=_[_0x3071('0x33')](_0x5aba96,'name');_0x292205['query']=_['keys'](_0x177b5f[_0x3071('0x34')]);_0x292205[_0x3071('0x35')]=_['intersection'](_0x292205[_0x3071('0x32')],_0x292205[_0x3071('0x34')]);_0x32f1b4[_0x3071('0x36')]=_[_0x3071('0x37')](_0x292205['model'],qs[_0x3071('0x38')](_0x177b5f[_0x3071('0x34')][_0x3071('0x38')]));_0x32f1b4[_0x3071('0x36')]=_0x32f1b4[_0x3071('0x36')][_0x3071('0x39')]?_0x32f1b4[_0x3071('0x36')]:_0x292205[_0x3071('0x32')];if(!_0x177b5f['query'][_0x3071('0x3a')]('nolimit')){_0x32f1b4['limit']=qs[_0x3071('0x20')](_0x177b5f[_0x3071('0x34')]['limit']);_0x32f1b4[_0x3071('0x1e')]=qs[_0x3071('0x1e')](_0x177b5f[_0x3071('0x34')][_0x3071('0x1e')]);}_0x32f1b4[_0x3071('0x3b')]=qs[_0x3071('0x3c')](_0x177b5f['query'][_0x3071('0x3c')]);_0x32f1b4[_0x3071('0x3d')]=qs['filters'](_[_0x3071('0x3e')](_0x177b5f['query'],_0x292205[_0x3071('0x35')]),_0x5aba96);if(_0x177b5f[_0x3071('0x34')]['filter']){_0x32f1b4['where']=_[_0x3071('0x3f')](_0x32f1b4[_0x3071('0x3d')],{'$or':_[_0x3071('0x33')](_0x5aba96,function(_0x55afa6){if(_0x55afa6[_0x3071('0x30')]!=='VIRTUAL'){var _0x1ac90a={};_0x1ac90a[_0x55afa6['name']]={'$like':'%'+_0x177b5f[_0x3071('0x34')][_0x3071('0x40')]+'%'};return _0x1ac90a;}})});}_0x32f1b4=_[_0x3071('0x3f')]({},_0x32f1b4,_0x177b5f[_0x3071('0x41')]);var _0x30ab68={'where':_0x32f1b4['where']};return db['FreshdeskField'][_0x3071('0x21')](_0x30ab68)[_0x3071('0x27')](function(_0x1455be){_0x254fc8[_0x3071('0x21')]=_0x1455be;if(_0x177b5f['query'][_0x3071('0x42')]){_0x32f1b4[_0x3071('0x43')]=[{'all':!![]}];}return db[_0x3071('0x2d')][_0x3071('0x44')](_0x32f1b4);})[_0x3071('0x27')](function(_0xb9a4b8){_0x254fc8['rows']=_0xb9a4b8;return _0x254fc8;})[_0x3071('0x27')](respondWithFilteredResult(_0x3921a1,_0x32f1b4))['catch'](handleError(_0x3921a1,null));};exports['show']=function(_0x4dc9d1,_0x47ceaf){var _0x2992e6={'raw':!![],'where':{'id':_0x4dc9d1[_0x3071('0x45')]['id']}},_0x1be8b6={};_0x1be8b6[_0x3071('0x32')]=_[_0x3071('0x46')](db[_0x3071('0x2d')][_0x3071('0x2e')]);_0x1be8b6[_0x3071('0x34')]=_['keys'](_0x4dc9d1[_0x3071('0x34')]);_0x1be8b6[_0x3071('0x35')]=_[_0x3071('0x37')](_0x1be8b6[_0x3071('0x32')],_0x1be8b6[_0x3071('0x34')]);_0x2992e6['attributes']=_['intersection'](_0x1be8b6[_0x3071('0x32')],qs[_0x3071('0x38')](_0x4dc9d1[_0x3071('0x34')][_0x3071('0x38')]));_0x2992e6[_0x3071('0x36')]=_0x2992e6['attributes'][_0x3071('0x39')]?_0x2992e6['attributes']:_0x1be8b6[_0x3071('0x32')];if(_0x4dc9d1['query']['includeAll']){_0x2992e6[_0x3071('0x43')]=[{'all':!![]}];}_0x2992e6=_['merge']({},_0x2992e6,_0x4dc9d1[_0x3071('0x41')]);return db['FreshdeskField'][_0x3071('0x47')](_0x2992e6)[_0x3071('0x27')](handleEntityNotFound(_0x47ceaf,null))[_0x3071('0x27')](respondWithResult(_0x47ceaf,null))[_0x3071('0x48')](handleError(_0x47ceaf,null));};exports['create']=function(_0x2d70bf,_0x575c12){return db[_0x3071('0x2d')]['create'](_0x2d70bf[_0x3071('0x49')],{})[_0x3071('0x27')](respondWithResult(_0x575c12,0xc9))['catch'](handleError(_0x575c12,null));};exports[_0x3071('0x26')]=function(_0x117e73,_0x224a70){if(_0x117e73[_0x3071('0x49')]['id']){delete _0x117e73[_0x3071('0x49')]['id'];}return db[_0x3071('0x2d')][_0x3071('0x47')]({'where':{'id':_0x117e73['params']['id']}})[_0x3071('0x27')](handleEntityNotFound(_0x224a70,null))[_0x3071('0x27')](saveUpdates(_0x117e73[_0x3071('0x49')],null))[_0x3071('0x27')](respondWithResult(_0x224a70,null))['catch'](handleError(_0x224a70,null));};exports[_0x3071('0x28')]=function(_0x2aea37,_0x1b832e){return db[_0x3071('0x2d')][_0x3071('0x47')]({'where':{'id':_0x2aea37[_0x3071('0x45')]['id']}})[_0x3071('0x27')](handleEntityNotFound(_0x1b832e,null))[_0x3071('0x27')](removeEntity(_0x1b832e,null))[_0x3071('0x48')](handleError(_0x1b832e,null));}; \ No newline at end of file +var _0xd64b=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','apply','reject','update','then','destroy','name','send','map','FreshdeskField','rawAttributes','type','key','model','query','filters','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','keys','intersection','length','include','options','find','create','body','params','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x155386,_0x47e571){var _0x3764af=function(_0x417fc6){while(--_0x417fc6){_0x155386['push'](_0x155386['shift']());}};_0x3764af(++_0x47e571);}(_0xd64b,0xc1));var _0xbd64=function(_0x42880f,_0x4425a5){_0x42880f=_0x42880f-0x0;var _0x14054c=_0xd64b[_0x42880f];return _0x14054c;};'use strict';var emlformat=require(_0xbd64('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbd64('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbd64('0x2'));var moment=require(_0xbd64('0x3'));var BPromise=require(_0xbd64('0x4'));var Mustache=require(_0xbd64('0x5'));var util=require(_0xbd64('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbd64('0x7'));var _=require(_0xbd64('0x8'));var squel=require(_0xbd64('0x9'));var crypto=require(_0xbd64('0xa'));var jsforce=require(_0xbd64('0xb'));var deskjs=require(_0xbd64('0xc'));var toCsv=require(_0xbd64('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbd64('0xe'));var authService=require(_0xbd64('0xf'));var qs=require(_0xbd64('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbd64('0x11'));var logger=require(_0xbd64('0x12'))(_0xbd64('0x13'));var utils=require(_0xbd64('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xbd64('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x136f60,_0x2729d8){_0x2729d8=_0x2729d8||0xcc;return function(_0x3a941c){if(_0x3a941c){return _0x136f60[_0xbd64('0x16')](_0x2729d8);}return _0x136f60[_0xbd64('0x17')](_0x2729d8)[_0xbd64('0x18')]();};}function respondWithResult(_0x2e23f2,_0x269e2f){_0x269e2f=_0x269e2f||0xc8;return function(_0x2b5808){if(_0x2b5808){return _0x2e23f2['status'](_0x269e2f)[_0xbd64('0x19')](_0x2b5808);}};}function respondWithFilteredResult(_0x13e7a4,_0x3ff550){return function(_0x32fd34){if(_0x32fd34){var _0x29fc16=typeof _0x3ff550['offset']===_0xbd64('0x1a')&&typeof _0x3ff550['limit']===_0xbd64('0x1a');var _0x1432a6=_0x32fd34[_0xbd64('0x1b')];var _0x1d7a14=_0x29fc16?0x0:_0x3ff550[_0xbd64('0x1c')];var _0x2f4554=_0x29fc16?_0x32fd34[_0xbd64('0x1b')]:_0x3ff550[_0xbd64('0x1c')]+_0x3ff550['limit'];var _0x305545;if(_0x2f4554>=_0x1432a6){_0x2f4554=_0x1432a6;_0x305545=0xc8;}else{_0x305545=0xce;}_0x13e7a4[_0xbd64('0x17')](_0x305545);return _0x13e7a4['set']('Content-Range',_0x1d7a14+'-'+_0x2f4554+'/'+_0x1432a6)[_0xbd64('0x19')](_0x32fd34);}return null;};}function patchUpdates(_0x42b328){return function(_0x196d21){try{jsonpatch[_0xbd64('0x1d')](_0x196d21,_0x42b328,!![]);}catch(_0x2c5551){return BPromise[_0xbd64('0x1e')](_0x2c5551);}return _0x196d21['save']();};}function saveUpdates(_0x4d4a16,_0x6038f){return function(_0x41f2f){if(_0x41f2f){return _0x41f2f[_0xbd64('0x1f')](_0x4d4a16)[_0xbd64('0x20')](function(_0x55e74c){return _0x55e74c;});}return null;};}function removeEntity(_0x51d118,_0x28497c){return function(_0x4afaff){if(_0x4afaff){return _0x4afaff[_0xbd64('0x21')]()['then'](function(){_0x51d118[_0xbd64('0x17')](0xcc)[_0xbd64('0x18')]();});}};}function handleEntityNotFound(_0x3d12a0,_0x2d0993){return function(_0x5ae417){if(!_0x5ae417){_0x3d12a0[_0xbd64('0x16')](0x194);}return _0x5ae417;};}function handleError(_0x3bbfbe,_0x13f527){_0x13f527=_0x13f527||0x1f4;return function(_0x2a44d0){logger['error'](_0x2a44d0['stack']);if(_0x2a44d0[_0xbd64('0x22')]){delete _0x2a44d0['name'];}_0x3bbfbe['status'](_0x13f527)[_0xbd64('0x23')](_0x2a44d0);};}exports['index']=function(_0x3cf5b7,_0x5300e8){var _0x28199c={},_0x5d8c35={},_0x1db9f3={'count':0x0,'rows':[]};var _0x3c0eaf=_[_0xbd64('0x24')](db[_0xbd64('0x25')][_0xbd64('0x26')],function(_0x207ffc){return{'name':_0x207ffc['fieldName'],'type':_0x207ffc[_0xbd64('0x27')][_0xbd64('0x28')]};});_0x5d8c35[_0xbd64('0x29')]=_[_0xbd64('0x24')](_0x3c0eaf,_0xbd64('0x22'));_0x5d8c35[_0xbd64('0x2a')]=_['keys'](_0x3cf5b7['query']);_0x5d8c35[_0xbd64('0x2b')]=_['intersection'](_0x5d8c35[_0xbd64('0x29')],_0x5d8c35[_0xbd64('0x2a')]);_0x28199c['attributes']=_['intersection'](_0x5d8c35[_0xbd64('0x29')],qs['fields'](_0x3cf5b7['query'][_0xbd64('0x2c')]));_0x28199c[_0xbd64('0x2d')]=_0x28199c[_0xbd64('0x2d')]['length']?_0x28199c[_0xbd64('0x2d')]:_0x5d8c35['model'];if(!_0x3cf5b7[_0xbd64('0x2a')][_0xbd64('0x2e')](_0xbd64('0x2f'))){_0x28199c[_0xbd64('0x30')]=qs[_0xbd64('0x30')](_0x3cf5b7[_0xbd64('0x2a')]['limit']);_0x28199c['offset']=qs[_0xbd64('0x1c')](_0x3cf5b7[_0xbd64('0x2a')][_0xbd64('0x1c')]);}_0x28199c[_0xbd64('0x31')]=qs[_0xbd64('0x32')](_0x3cf5b7[_0xbd64('0x2a')]['sort']);_0x28199c['where']=qs[_0xbd64('0x2b')](_[_0xbd64('0x33')](_0x3cf5b7[_0xbd64('0x2a')],_0x5d8c35['filters']),_0x3c0eaf);if(_0x3cf5b7['query'][_0xbd64('0x34')]){_0x28199c['where']=_[_0xbd64('0x35')](_0x28199c['where'],{'$or':_[_0xbd64('0x24')](_0x3c0eaf,function(_0x2dc00b){if(_0x2dc00b['type']!==_0xbd64('0x36')){var _0x51ae42={};_0x51ae42[_0x2dc00b['name']]={'$like':'%'+_0x3cf5b7[_0xbd64('0x2a')][_0xbd64('0x34')]+'%'};return _0x51ae42;}})});}_0x28199c=_[_0xbd64('0x35')]({},_0x28199c,_0x3cf5b7['options']);var _0x540e2a={'where':_0x28199c['where']};return db[_0xbd64('0x25')][_0xbd64('0x1b')](_0x540e2a)['then'](function(_0x393f57){_0x1db9f3[_0xbd64('0x1b')]=_0x393f57;if(_0x3cf5b7[_0xbd64('0x2a')][_0xbd64('0x37')]){_0x28199c['include']=[{'all':!![]}];}return db['FreshdeskField'][_0xbd64('0x38')](_0x28199c);})['then'](function(_0x595a91){_0x1db9f3[_0xbd64('0x39')]=_0x595a91;return _0x1db9f3;})[_0xbd64('0x20')](respondWithFilteredResult(_0x5300e8,_0x28199c))[_0xbd64('0x3a')](handleError(_0x5300e8,null));};exports[_0xbd64('0x3b')]=function(_0x693464,_0x3155b3){var _0x247775={'raw':!![],'where':{'id':_0x693464['params']['id']}},_0x762380={};_0x762380[_0xbd64('0x29')]=_[_0xbd64('0x3c')](db['FreshdeskField'][_0xbd64('0x26')]);_0x762380[_0xbd64('0x2a')]=_[_0xbd64('0x3c')](_0x693464[_0xbd64('0x2a')]);_0x762380[_0xbd64('0x2b')]=_[_0xbd64('0x3d')](_0x762380[_0xbd64('0x29')],_0x762380['query']);_0x247775[_0xbd64('0x2d')]=_['intersection'](_0x762380[_0xbd64('0x29')],qs['fields'](_0x693464[_0xbd64('0x2a')][_0xbd64('0x2c')]));_0x247775[_0xbd64('0x2d')]=_0x247775['attributes'][_0xbd64('0x3e')]?_0x247775['attributes']:_0x762380['model'];if(_0x693464['query'][_0xbd64('0x37')]){_0x247775[_0xbd64('0x3f')]=[{'all':!![]}];}_0x247775=_[_0xbd64('0x35')]({},_0x247775,_0x693464[_0xbd64('0x40')]);return db[_0xbd64('0x25')][_0xbd64('0x41')](_0x247775)[_0xbd64('0x20')](handleEntityNotFound(_0x3155b3,null))['then'](respondWithResult(_0x3155b3,null))[_0xbd64('0x3a')](handleError(_0x3155b3,null));};exports[_0xbd64('0x42')]=function(_0x379491,_0x4e5efe){return db[_0xbd64('0x25')][_0xbd64('0x42')](_0x379491[_0xbd64('0x43')],{})[_0xbd64('0x20')](respondWithResult(_0x4e5efe,0xc9))[_0xbd64('0x3a')](handleError(_0x4e5efe,null));};exports['update']=function(_0x283699,_0x1a9ec8){if(_0x283699[_0xbd64('0x43')]['id']){delete _0x283699[_0xbd64('0x43')]['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x283699[_0xbd64('0x44')]['id']}})[_0xbd64('0x20')](handleEntityNotFound(_0x1a9ec8,null))[_0xbd64('0x20')](saveUpdates(_0x283699[_0xbd64('0x43')],null))[_0xbd64('0x20')](respondWithResult(_0x1a9ec8,null))[_0xbd64('0x3a')](handleError(_0x1a9ec8,null));};exports[_0xbd64('0x21')]=function(_0x3807a7,_0x460158){return db[_0xbd64('0x25')][_0xbd64('0x41')]({'where':{'id':_0x3807a7[_0xbd64('0x44')]['id']}})[_0xbd64('0x20')](handleEntityNotFound(_0x460158,null))[_0xbd64('0x20')](removeEntity(_0x460158,null))[_0xbd64('0x3a')](handleError(_0x460158,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 974ff3e..a2d5a35 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 _0x59e5=['request-promise','path','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird'];(function(_0x145701,_0x2679a6){var _0x4a66b8=function(_0x4f4e33){while(--_0x4f4e33){_0x145701['push'](_0x145701['shift']());}};_0x4a66b8(++_0x2679a6);}(_0x59e5,0x11b));var _0x559e=function(_0x35858c,_0x487ec8){_0x35858c=_0x35858c-0x0;var _0x3decaa=_0x59e5[_0x35858c];return _0x3decaa;};'use strict';var _=require(_0x559e('0x0'));var util=require(_0x559e('0x1'));var logger=require(_0x559e('0x2'))('api');var moment=require(_0x559e('0x3'));var BPromise=require(_0x559e('0x4'));var rp=require(_0x559e('0x5'));var fs=require('fs');var path=require(_0x559e('0x6'));var rimraf=require('rimraf');var config=require(_0x559e('0x7'));var attributes=require(_0x559e('0x8'));module[_0x559e('0x9')]=function(_0x3d1069,_0x275d0a){return _0x3d1069[_0x559e('0xa')](_0x559e('0xb'),attributes,{'tableName':_0x559e('0xc'),'paranoid':![],'indexes':[{'name':_0x559e('0xd'),'fields':[_0x559e('0xe'),_0x559e('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5752=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId'];(function(_0x67a247,_0x2e1918){var _0x40c4bc=function(_0x31cd8f){while(--_0x31cd8f){_0x67a247['push'](_0x67a247['shift']());}};_0x40c4bc(++_0x2e1918);}(_0x5752,0x99));var _0x2575=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x5752[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x2575('0x0'));var util=require(_0x2575('0x1'));var logger=require(_0x2575('0x2'))(_0x2575('0x3'));var moment=require(_0x2575('0x4'));var BPromise=require(_0x2575('0x5'));var rp=require(_0x2575('0x6'));var fs=require('fs');var path=require(_0x2575('0x7'));var rimraf=require(_0x2575('0x8'));var config=require('../../config/environment');var attributes=require(_0x2575('0x9'));module[_0x2575('0xa')]=function(_0x1f8291,_0x2251aa){return _0x1f8291[_0x2575('0xb')](_0x2575('0xc'),attributes,{'tableName':_0x2575('0xd'),'paranoid':![],'indexes':[{'name':_0x2575('0xe'),'fields':[_0x2575('0xf'),_0x2575('0x10')],'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 cd72f8f..50e3764 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 _0x02f4=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch'];(function(_0x1f19fb,_0x200586){var _0x1e3d86=function(_0x34d0bb){while(--_0x34d0bb){_0x1f19fb['push'](_0x1f19fb['shift']());}};_0x1e3d86(++_0x200586);}(_0x02f4,0x1b8));var _0x402f=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x02f4[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x402f('0x0'));var util=require(_0x402f('0x1'));var moment=require(_0x402f('0x2'));var BPromise=require(_0x402f('0x3'));var rs=require(_0x402f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x402f('0x5'))['db'];var utils=require(_0x402f('0x6'));var logger=require(_0x402f('0x7'))(_0x402f('0x8'));var config=require(_0x402f('0x9'));var jayson=require(_0x402f('0xa'));var client=jayson[_0x402f('0xb')][_0x402f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3ec800,_0x118470,_0x15e1ad){return new BPromise(function(_0x2305e0,_0x1c3db4){return client[_0x402f('0xd')](_0x3ec800,_0x15e1ad)[_0x402f('0xe')](function(_0xb1b97c){logger['info'](_0x402f('0xf'),_0x118470,_0x402f('0x10'));logger['debug']('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x118470,'request\x20sent',JSON['stringify'](_0xb1b97c));if(_0xb1b97c[_0x402f('0x11')]){if(_0xb1b97c[_0x402f('0x11')][_0x402f('0x12')]===0x1f4){logger[_0x402f('0x11')](_0x402f('0xf'),_0x118470,_0xb1b97c['error'][_0x402f('0x13')]);return _0x1c3db4(_0xb1b97c['error'][_0x402f('0x13')]);}logger[_0x402f('0x11')](_0x402f('0xf'),_0x118470,_0xb1b97c[_0x402f('0x11')][_0x402f('0x13')]);return _0x2305e0(_0xb1b97c[_0x402f('0x11')][_0x402f('0x13')]);}else{logger[_0x402f('0x14')](_0x402f('0xf'),_0x118470,_0x402f('0x10'));_0x2305e0(_0xb1b97c['result']['message']);}})[_0x402f('0x15')](function(_0x19b5f5){logger[_0x402f('0x11')](_0x402f('0xf'),_0x118470,_0x19b5f5);_0x1c3db4(_0x19b5f5);});});} \ No newline at end of file +var _0xfea1=['catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x5c8ce3,_0x49a7fc){var _0x273749=function(_0x399434){while(--_0x399434){_0x5c8ce3['push'](_0x5c8ce3['shift']());}};_0x273749(++_0x49a7fc);}(_0xfea1,0x8d));var _0x1fea=function(_0x163040,_0x38a58c){_0x163040=_0x163040-0x0;var _0x364667=_0xfea1[_0x163040];return _0x364667;};'use strict';var _=require(_0x1fea('0x0'));var util=require('util');var moment=require(_0x1fea('0x1'));var BPromise=require(_0x1fea('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1fea('0x3'));var db=require(_0x1fea('0x4'))['db'];var utils=require(_0x1fea('0x5'));var logger=require('../../config/logger')(_0x1fea('0x6'));var config=require(_0x1fea('0x7'));var jayson=require(_0x1fea('0x8'));var client=jayson[_0x1fea('0x9')][_0x1fea('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e6c13,_0x381086,_0x2281f3){return new BPromise(function(_0x66ac32,_0x1ea5dc){return client[_0x1fea('0xb')](_0x3e6c13,_0x2281f3)['then'](function(_0x88a844){logger[_0x1fea('0xc')](_0x1fea('0xd'),_0x381086,'request\x20sent');logger['debug']('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x381086,_0x1fea('0xe'),JSON[_0x1fea('0xf')](_0x88a844));if(_0x88a844[_0x1fea('0x10')]){if(_0x88a844[_0x1fea('0x10')][_0x1fea('0x11')]===0x1f4){logger[_0x1fea('0x10')](_0x1fea('0xd'),_0x381086,_0x88a844[_0x1fea('0x10')]['message']);return _0x1ea5dc(_0x88a844['error'][_0x1fea('0x12')]);}logger[_0x1fea('0x10')](_0x1fea('0xd'),_0x381086,_0x88a844[_0x1fea('0x10')]['message']);return _0x66ac32(_0x88a844['error'][_0x1fea('0x12')]);}else{logger[_0x1fea('0xc')](_0x1fea('0xd'),_0x381086,_0x1fea('0xe'));_0x66ac32(_0x88a844['result']['message']);}})[_0x1fea('0x13')](function(_0x36590f){logger[_0x1fea('0x10')]('FreshdeskField,\x20%s,\x20%s',_0x381086,_0x36590f);_0x1ea5dc(_0x36590f);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 0ee1340..573ddaa 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 _0xf290=['destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update'];(function(_0x34469a,_0x47c351){var _0x1c3d14=function(_0x46a653){while(--_0x46a653){_0x34469a['push'](_0x34469a['shift']());}};_0x1c3d14(++_0x47c351);}(_0xf290,0xde));var _0x0f29=function(_0x56138f,_0x1e9ebb){_0x56138f=_0x56138f-0x0;var _0x1acaf7=_0xf290[_0x56138f];return _0x1acaf7;};'use strict';var multer=require('multer');var util=require(_0x0f29('0x0'));var path=require('path');var timeout=require(_0x0f29('0x1'));var express=require('express');var router=express[_0x0f29('0x2')]();var fs_extra=require(_0x0f29('0x3'));var auth=require(_0x0f29('0x4'));var interaction=require(_0x0f29('0x5'));var config=require(_0x0f29('0x6'));var controller=require('./intFreshsalesAccount.controller');router[_0x0f29('0x7')]('/',auth['isAuthenticated'](),controller[_0x0f29('0x8')]);router[_0x0f29('0x7')](_0x0f29('0x9'),auth[_0x0f29('0xa')](),controller[_0x0f29('0xb')]);router[_0x0f29('0x7')](_0x0f29('0xc'),auth[_0x0f29('0xa')](),controller[_0x0f29('0xd')]);router[_0x0f29('0x7')](_0x0f29('0xe'),auth[_0x0f29('0xa')](),controller[_0x0f29('0xf')]);router[_0x0f29('0x10')]('/',auth[_0x0f29('0xa')](),controller['create']);router[_0x0f29('0x10')]('/:id/configurations',auth[_0x0f29('0xa')](),controller[_0x0f29('0x11')]);router[_0x0f29('0x12')](_0x0f29('0x9'),auth[_0x0f29('0xa')](),controller[_0x0f29('0x13')]);router['delete'](_0x0f29('0x9'),auth[_0x0f29('0xa')](),controller[_0x0f29('0x14')]);module[_0x0f29('0x15')]=router; \ No newline at end of file +var _0x2e54=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','connect-timeout','express'];(function(_0x3325b3,_0x48304a){var _0x1ae2b9=function(_0x110f83){while(--_0x110f83){_0x3325b3['push'](_0x3325b3['shift']());}};_0x1ae2b9(++_0x48304a);}(_0x2e54,0x1dd));var _0x42e5=function(_0x4e0ad0,_0x1b2b6f){_0x4e0ad0=_0x4e0ad0-0x0;var _0x10ca0a=_0x2e54[_0x4e0ad0];return _0x10ca0a;};'use strict';var multer=require(_0x42e5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x42e5('0x1'));var express=require(_0x42e5('0x2'));var router=express[_0x42e5('0x3')]();var fs_extra=require(_0x42e5('0x4'));var auth=require(_0x42e5('0x5'));var interaction=require(_0x42e5('0x6'));var config=require(_0x42e5('0x7'));var controller=require('./intFreshsalesAccount.controller');router[_0x42e5('0x8')]('/',auth[_0x42e5('0x9')](),controller[_0x42e5('0xa')]);router['get'](_0x42e5('0xb'),auth['isAuthenticated'](),controller[_0x42e5('0xc')]);router['get'](_0x42e5('0xd'),auth[_0x42e5('0x9')](),controller[_0x42e5('0xe')]);router[_0x42e5('0x8')](_0x42e5('0xf'),auth[_0x42e5('0x9')](),controller[_0x42e5('0x10')]);router[_0x42e5('0x11')]('/',auth[_0x42e5('0x9')](),controller['create']);router[_0x42e5('0x11')](_0x42e5('0xd'),auth['isAuthenticated'](),controller[_0x42e5('0x12')]);router[_0x42e5('0x13')](_0x42e5('0xb'),auth[_0x42e5('0x9')](),controller[_0x42e5('0x14')]);router[_0x42e5('0x15')](_0x42e5('0xb'),auth[_0x42e5('0x9')](),controller[_0x42e5('0x16')]);module[_0x42e5('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index d845701..27d0248 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 _0xb03e=['STRING','username','remoteUri','exports'];(function(_0x577240,_0x271d56){var _0x4e9a56=function(_0x168346){while(--_0x168346){_0x577240['push'](_0x577240['shift']());}};_0x4e9a56(++_0x271d56);}(_0xb03e,0x1eb));var _0xeb03=function(_0x5b2897,_0x43bb0c){_0x5b2897=_0x5b2897-0x0;var _0x5de286=_0xb03e[_0x5b2897];return _0x5de286;};'use strict';var Sequelize=require('sequelize');module[_0xeb03('0x0')]={'name':{'type':Sequelize[_0xeb03('0x1')]},'description':{'type':Sequelize[_0xeb03('0x1')]},'username':{'type':Sequelize[_0xeb03('0x1')],'unique':_0xeb03('0x2')},'apiKey':{'type':Sequelize[_0xeb03('0x1')]},'remoteUri':{'type':Sequelize[_0xeb03('0x1')],'unique':_0xeb03('0x3')},'serverUrl':{'type':Sequelize[_0xeb03('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x77d4=['exports','STRING','username'];(function(_0x2fee96,_0x2f735d){var _0x2e6ad1=function(_0x2c55ad){while(--_0x2c55ad){_0x2fee96['push'](_0x2fee96['shift']());}};_0x2e6ad1(++_0x2f735d);}(_0x77d4,0x108));var _0x477d=function(_0x575b4c,_0x3f1d33){_0x575b4c=_0x575b4c-0x0;var _0x169ce9=_0x77d4[_0x575b4c];return _0x169ce9;};'use strict';var Sequelize=require('sequelize');module[_0x477d('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x477d('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x477d('0x2')},'apiKey':{'type':Sequelize[_0x477d('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x477d('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index fd3a824..ee31933 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 _0x89ce=['path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','set','json','apply','reject','save','then','destroy','error','stack','name','send','map','FreshsalesAccount','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','update','body','getConfigurations','FreshsalesConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','apiKey','users','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x1eb5be,_0x273811){var _0x1423bf=function(_0x38b761){while(--_0x38b761){_0x1eb5be['push'](_0x1eb5be['shift']());}};_0x1423bf(++_0x273811);}(_0x89ce,0x133));var _0xe89c=function(_0x2d5e94,_0x2fb8d4){_0x2d5e94=_0x2d5e94-0x0;var _0x3cebcf=_0x89ce[_0x2d5e94];return _0x3cebcf;};'use strict';var emlformat=require(_0xe89c('0x0'));var rimraf=require(_0xe89c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe89c('0x2'));var rp=require(_0xe89c('0x3'));var moment=require(_0xe89c('0x4'));var BPromise=require(_0xe89c('0x5'));var Mustache=require(_0xe89c('0x6'));var util=require(_0xe89c('0x7'));var path=require(_0xe89c('0x8'));var sox=require(_0xe89c('0x9'));var csv=require(_0xe89c('0xa'));var ejs=require(_0xe89c('0xb'));var fs=require('fs');var fs_extra=require(_0xe89c('0xc'));var _=require(_0xe89c('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe89c('0xe'));var toCsv=require(_0xe89c('0xa'));var querystring=require(_0xe89c('0xf'));var Papa=require(_0xe89c('0x10'));var Redis=require('ioredis');var authService=require(_0xe89c('0x11'));var qs=require(_0xe89c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe89c('0x13'));var logger=require(_0xe89c('0x14'))('api');var utils=require(_0xe89c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe89c('0x16'));var db=require(_0xe89c('0x17'))['db'];var integrations=require(_0xe89c('0x18'));function respondWithStatusCode(_0x7622e0,_0x41c32e){_0x41c32e=_0x41c32e||0xcc;return function(_0x37b2e4){if(_0x37b2e4){return _0x7622e0[_0xe89c('0x19')](_0x41c32e);}return _0x7622e0[_0xe89c('0x1a')](_0x41c32e)['end']();};}function respondWithResult(_0x4f25e6,_0x367125){_0x367125=_0x367125||0xc8;return function(_0x173e4e){if(_0x173e4e){return _0x4f25e6['status'](_0x367125)['json'](_0x173e4e);}};}function respondWithFilteredResult(_0x4e2fad,_0x243406){return function(_0x16b40d){if(_0x16b40d){var _0x1c06ee=typeof _0x243406[_0xe89c('0x1b')]===_0xe89c('0x1c')&&typeof _0x243406[_0xe89c('0x1d')]===_0xe89c('0x1c');var _0x42cc8c=_0x16b40d['count'];var _0x30577b=_0x1c06ee?0x0:_0x243406[_0xe89c('0x1b')];var _0x4a79f0=_0x1c06ee?_0x16b40d['count']:_0x243406[_0xe89c('0x1b')]+_0x243406[_0xe89c('0x1d')];var _0x380fcc;if(_0x4a79f0>=_0x42cc8c){_0x4a79f0=_0x42cc8c;_0x380fcc=0xc8;}else{_0x380fcc=0xce;}_0x4e2fad[_0xe89c('0x1a')](_0x380fcc);return _0x4e2fad[_0xe89c('0x1e')]('Content-Range',_0x30577b+'-'+_0x4a79f0+'/'+_0x42cc8c)[_0xe89c('0x1f')](_0x16b40d);}return null;};}function patchUpdates(_0x5beec9){return function(_0xe077e4){try{jsonpatch[_0xe89c('0x20')](_0xe077e4,_0x5beec9,!![]);}catch(_0x31eed5){return BPromise[_0xe89c('0x21')](_0x31eed5);}return _0xe077e4[_0xe89c('0x22')]();};}function saveUpdates(_0x2ba138,_0x4bd481){return function(_0x5ce1c2){if(_0x5ce1c2){return _0x5ce1c2['update'](_0x2ba138)[_0xe89c('0x23')](function(_0x3b4909){return _0x3b4909;});}return null;};}function removeEntity(_0x43e338,_0x16dfcd){return function(_0xb6e36c){if(_0xb6e36c){return _0xb6e36c[_0xe89c('0x24')]()[_0xe89c('0x23')](function(){_0x43e338[_0xe89c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f421f,_0x273088){return function(_0x19a8b5){if(!_0x19a8b5){_0x3f421f[_0xe89c('0x19')](0x194);}return _0x19a8b5;};}function handleError(_0x810d14,_0xbbfbda){_0xbbfbda=_0xbbfbda||0x1f4;return function(_0x1a79a0){logger[_0xe89c('0x25')](_0x1a79a0[_0xe89c('0x26')]);if(_0x1a79a0[_0xe89c('0x27')]){delete _0x1a79a0[_0xe89c('0x27')];}_0x810d14[_0xe89c('0x1a')](_0xbbfbda)[_0xe89c('0x28')](_0x1a79a0);};}exports['index']=function(_0x3da3b7,_0xd5236b){var _0x4af59f={},_0x520cc4={},_0x5eeeba={'count':0x0,'rows':[]};var _0x21928d=_[_0xe89c('0x29')](db[_0xe89c('0x2a')][_0xe89c('0x2b')],function(_0x1c88fa){return{'name':_0x1c88fa['fieldName'],'type':_0x1c88fa[_0xe89c('0x2c')][_0xe89c('0x2d')]};});_0x520cc4[_0xe89c('0x2e')]=_[_0xe89c('0x29')](_0x21928d,'name');_0x520cc4[_0xe89c('0x2f')]=_[_0xe89c('0x30')](_0x3da3b7[_0xe89c('0x2f')]);_0x520cc4[_0xe89c('0x31')]=_['intersection'](_0x520cc4[_0xe89c('0x2e')],_0x520cc4['query']);_0x4af59f[_0xe89c('0x32')]=_['intersection'](_0x520cc4[_0xe89c('0x2e')],qs[_0xe89c('0x33')](_0x3da3b7[_0xe89c('0x2f')][_0xe89c('0x33')]));_0x4af59f[_0xe89c('0x32')]=_0x4af59f[_0xe89c('0x32')][_0xe89c('0x34')]?_0x4af59f[_0xe89c('0x32')]:_0x520cc4[_0xe89c('0x2e')];if(!_0x3da3b7['query'][_0xe89c('0x35')](_0xe89c('0x36'))){_0x4af59f[_0xe89c('0x1d')]=qs[_0xe89c('0x1d')](_0x3da3b7['query'][_0xe89c('0x1d')]);_0x4af59f[_0xe89c('0x1b')]=qs['offset'](_0x3da3b7[_0xe89c('0x2f')][_0xe89c('0x1b')]);}_0x4af59f[_0xe89c('0x37')]=qs[_0xe89c('0x38')](_0x3da3b7[_0xe89c('0x2f')][_0xe89c('0x38')]);_0x4af59f[_0xe89c('0x39')]=qs['filters'](_[_0xe89c('0x3a')](_0x3da3b7['query'],_0x520cc4[_0xe89c('0x31')]),_0x21928d);if(_0x3da3b7[_0xe89c('0x2f')]['filter']){_0x4af59f[_0xe89c('0x39')]=_[_0xe89c('0x3b')](_0x4af59f[_0xe89c('0x39')],{'$or':_[_0xe89c('0x29')](_0x21928d,function(_0x35dcb2){if(_0x35dcb2[_0xe89c('0x2c')]!==_0xe89c('0x3c')){var _0x4ec5a3={};_0x4ec5a3[_0x35dcb2[_0xe89c('0x27')]]={'$like':'%'+_0x3da3b7[_0xe89c('0x2f')][_0xe89c('0x3d')]+'%'};return _0x4ec5a3;}})});}_0x4af59f=_['merge']({},_0x4af59f,_0x3da3b7[_0xe89c('0x3e')]);var _0x5a1893={'where':_0x4af59f[_0xe89c('0x39')]};return db[_0xe89c('0x2a')][_0xe89c('0x3f')](_0x5a1893)[_0xe89c('0x23')](function(_0xae47ac){_0x5eeeba[_0xe89c('0x3f')]=_0xae47ac;if(_0x3da3b7['query'][_0xe89c('0x40')]){_0x4af59f[_0xe89c('0x41')]=[{'all':!![]}];}return db[_0xe89c('0x2a')][_0xe89c('0x42')](_0x4af59f);})[_0xe89c('0x23')](function(_0xd4d765){_0x5eeeba[_0xe89c('0x43')]=_0xd4d765;return _0x5eeeba;})['then'](respondWithFilteredResult(_0xd5236b,_0x4af59f))[_0xe89c('0x44')](handleError(_0xd5236b,null));};exports[_0xe89c('0x45')]=function(_0x4a6d48,_0x514d42){var _0x4ce1db={'raw':![],'where':{'id':_0x4a6d48[_0xe89c('0x46')]['id']}},_0x322ed3={};_0x322ed3[_0xe89c('0x2e')]=_[_0xe89c('0x30')](db[_0xe89c('0x2a')]['rawAttributes']);_0x322ed3[_0xe89c('0x2f')]=_['keys'](_0x4a6d48[_0xe89c('0x2f')]);_0x322ed3[_0xe89c('0x31')]=_[_0xe89c('0x47')](_0x322ed3[_0xe89c('0x2e')],_0x322ed3[_0xe89c('0x2f')]);_0x4ce1db[_0xe89c('0x32')]=_[_0xe89c('0x47')](_0x322ed3[_0xe89c('0x2e')],qs[_0xe89c('0x33')](_0x4a6d48[_0xe89c('0x2f')]['fields']));_0x4ce1db[_0xe89c('0x32')]=_0x4ce1db[_0xe89c('0x32')][_0xe89c('0x34')]?_0x4ce1db[_0xe89c('0x32')]:_0x322ed3[_0xe89c('0x2e')];if(_0x4a6d48[_0xe89c('0x2f')][_0xe89c('0x40')]){_0x4ce1db[_0xe89c('0x41')]=[{'all':!![]}];}_0x4ce1db=_['merge']({},_0x4ce1db,_0x4a6d48[_0xe89c('0x3e')]);return db['FreshsalesAccount'][_0xe89c('0x48')](_0x4ce1db)[_0xe89c('0x23')](handleEntityNotFound(_0x514d42,null))['then'](respondWithResult(_0x514d42,null))[_0xe89c('0x44')](handleError(_0x514d42,null));};exports[_0xe89c('0x49')]=function(_0x4405e9,_0x3440a4){return db[_0xe89c('0x2a')][_0xe89c('0x49')](_0x4405e9['body'],{})[_0xe89c('0x23')](respondWithResult(_0x3440a4,0xc9))['catch'](handleError(_0x3440a4,null));};exports[_0xe89c('0x4a')]=function(_0x49e282,_0x4bf040){if(_0x49e282[_0xe89c('0x4b')]['id']){delete _0x49e282[_0xe89c('0x4b')]['id'];}return db['FreshsalesAccount'][_0xe89c('0x48')]({'where':{'id':_0x49e282['params']['id']}})[_0xe89c('0x23')](handleEntityNotFound(_0x4bf040,null))['then'](saveUpdates(_0x49e282[_0xe89c('0x4b')],null))[_0xe89c('0x23')](respondWithResult(_0x4bf040,null))[_0xe89c('0x44')](handleError(_0x4bf040,null));};exports[_0xe89c('0x24')]=function(_0x58e598,_0x3bd68d){return db[_0xe89c('0x2a')]['find']({'where':{'id':_0x58e598[_0xe89c('0x46')]['id']}})['then'](handleEntityNotFound(_0x3bd68d,null))[_0xe89c('0x23')](removeEntity(_0x3bd68d,null))[_0xe89c('0x44')](handleError(_0x3bd68d,null));};exports[_0xe89c('0x4c')]=function(_0x46693b,_0x588068,_0x39f200){var _0x29499e={};var _0x2c10d4={};var _0x1d7918;var _0x2de4d5;return db[_0xe89c('0x2a')]['findOne']({'where':{'id':_0x46693b['params']['id']}})['then'](handleEntityNotFound(_0x588068,null))[_0xe89c('0x23')](function(_0x351e05){if(_0x351e05){_0x1d7918=_0x351e05;_0x2c10d4['model']=_['keys'](db[_0xe89c('0x4d')][_0xe89c('0x2b')]);_0x2c10d4[_0xe89c('0x2f')]=_[_0xe89c('0x30')](_0x46693b[_0xe89c('0x2f')]);_0x2c10d4['filters']=_['intersection'](_0x2c10d4[_0xe89c('0x2e')],_0x2c10d4[_0xe89c('0x2f')]);_0x29499e['attributes']=_[_0xe89c('0x47')](_0x2c10d4[_0xe89c('0x2e')],qs[_0xe89c('0x33')](_0x46693b['query']['fields']));_0x29499e[_0xe89c('0x32')]=_0x29499e['attributes'][_0xe89c('0x34')]?_0x29499e[_0xe89c('0x32')]:_0x2c10d4['model'];_0x29499e['order']=qs[_0xe89c('0x38')](_0x46693b[_0xe89c('0x2f')][_0xe89c('0x38')]);_0x29499e['where']=qs[_0xe89c('0x31')](_[_0xe89c('0x3a')](_0x46693b['query'],_0x2c10d4[_0xe89c('0x31')]));if(_0x46693b['query'][_0xe89c('0x3d')]){_0x29499e[_0xe89c('0x39')]=_['merge'](_0x29499e[_0xe89c('0x39')],{'$or':_[_0xe89c('0x29')](_0x29499e[_0xe89c('0x32')],function(_0x2bbe5f){var _0x5f4609={};_0x5f4609[_0x2bbe5f]={'$like':'%'+_0x46693b[_0xe89c('0x2f')][_0xe89c('0x3d')]+'%'};return _0x5f4609;})});}_0x29499e=_[_0xe89c('0x3b')]({},_0x29499e,_0x46693b[_0xe89c('0x3e')]);return _0x1d7918[_0xe89c('0x4c')](_0x29499e);}})[_0xe89c('0x23')](function(_0x47c29b){if(_0x47c29b){_0x2de4d5=_0x47c29b[_0xe89c('0x34')];if(!_0x46693b[_0xe89c('0x2f')]['hasOwnProperty'](_0xe89c('0x36'))){_0x29499e[_0xe89c('0x1d')]=qs[_0xe89c('0x1d')](_0x46693b[_0xe89c('0x2f')][_0xe89c('0x1d')]);_0x29499e['offset']=qs['offset'](_0x46693b[_0xe89c('0x2f')][_0xe89c('0x1b')]);}return _0x1d7918[_0xe89c('0x4c')](_0x29499e);}})['then'](function(_0x3915bc){if(_0x3915bc){return _0x3915bc?{'count':_0x2de4d5,'rows':_0x3915bc}:null;}})[_0xe89c('0x23')](respondWithResult(_0x588068,null))[_0xe89c('0x44')](handleError(_0x588068,null));};exports[_0xe89c('0x4e')]=function(_0x130591,_0x570afe,_0x56aa49){if(_0x130591[_0xe89c('0x4b')]['id']){delete _0x130591[_0xe89c('0x4b')]['id'];}return db[_0xe89c('0x2a')][_0xe89c('0x4f')]({'where':{'id':_0x130591[_0xe89c('0x46')]['id']}})[_0xe89c('0x23')](handleEntityNotFound(_0x570afe,null))[_0xe89c('0x23')](function(_0x46baf6){if(_0x46baf6){_0x130591['body'][_0xe89c('0x50')]=_0x46baf6['id'];_0x130591[_0xe89c('0x4b')][_0xe89c('0x51')]=integrations[_0xe89c('0x52')](_0x130591['body'][_0xe89c('0x53')],_0x130591[_0xe89c('0x4b')]['type']);_0x130591[_0xe89c('0x4b')][_0xe89c('0x54')]=integrations[_0xe89c('0x55')](_0x130591[_0xe89c('0x4b')]['channel'],_0x130591[_0xe89c('0x4b')][_0xe89c('0x2c')]);return db['FreshsalesConfiguration'][_0xe89c('0x49')](_0x130591[_0xe89c('0x4b')],{'include':[{'model':db[_0xe89c('0x56')],'as':_0xe89c('0x51')},{'model':db[_0xe89c('0x56')],'as':_0xe89c('0x54')}]});}return null;})['then'](respondWithResult(_0x570afe,null))[_0xe89c('0x44')](handleError(_0x570afe,null));};exports[_0xe89c('0x57')]=function(_0x37289b,_0x4137bf,_0x3763df){var _0x3c1d37='';var _0x568462='';return db[_0xe89c('0x2a')][_0xe89c('0x4f')]({'where':{'id':_0x37289b[_0xe89c('0x46')]['id']},'attributes':['id',_0xe89c('0x58'),_0xe89c('0x59'),'apiKey']})[_0xe89c('0x23')](handleEntityNotFound(_0x4137bf,null))[_0xe89c('0x23')](function(_0x223194){if(_0x223194){_0x568462=_0x223194['username'];_0x3c1d37=_0x223194[_0xe89c('0x59')];var _0x125605=_0x223194[_0xe89c('0x59')]['slice'](-0x1);if(_0x125605==='/'){_0x3c1d37=_0x3c1d37[_0xe89c('0x5a')](0x0,_0x3c1d37[_0xe89c('0x5b')](_0x125605));}return rp({'method':_0xe89c('0x5c'),'uri':util[_0xe89c('0x5d')](_0xe89c('0x5e'),_0x3c1d37,_0xe89c('0x5f')),'headers':{'Authorization':_0xe89c('0x60')+_0x223194[_0xe89c('0x61')]},'json':!![]});}})[_0xe89c('0x23')](function(_0x5dfa56){if(_0x5dfa56){var _0x37ba97=_0x5dfa56[_0xe89c('0x62')];var _0x1b1133=![];var _0xb161ea=null;for(_0xb161ea=0x0;_0xb161ea<_0x37ba97[_0xe89c('0x34')];_0xb161ea++){if(_0x37ba97[_0xb161ea]['email']===_0x568462){_0x1b1133=!![];}}if(_0x1b1133){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xe89c('0x63')});}}})['then'](respondWithResult(_0x4137bf,null))[_0xe89c('0x44')](function(_0x440dc2){var _0x5b83ef=_0x37289b[_0xe89c('0x2f')][_0xe89c('0x64')]?0x1f4:_0x440dc2[_0xe89c('0x65')]||0x1f4;logger['error'](_0xe89c('0x66'),_0xe89c('0x57'),_0x5b83ef,JSON[_0xe89c('0x67')](_0x440dc2));delete _0x440dc2[_0xe89c('0x27')];if(_0x5b83ef===0x191){_0x5b83ef=0x190;}_0x4137bf[_0xe89c('0x1a')](_0x5b83ef)[_0xe89c('0x28')](_0x37289b[_0xe89c('0x2f')]['test']?{'message':_0xe89c('0x68'),'statusCode':_0x440dc2[_0xe89c('0x65')]}:_0x440dc2);});}; \ No newline at end of file +var _0x36c5=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','sendStatus','error','name','send','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','map','includeAll','include','rows','catch','params','options','create','body','find','getConfigurations','findOne','FreshsalesConfiguration','pick','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','slice','substring','lastIndexOf','GET','%s%s','Token\x20token=','apiKey','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x1837c5,_0x4e73f7){var _0x28827a=function(_0x55bc0c){while(--_0x55bc0c){_0x1837c5['push'](_0x1837c5['shift']());}};_0x28827a(++_0x4e73f7);}(_0x36c5,0x1d7));var _0x536c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36c5[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x536c('0x0'));var rimraf=require(_0x536c('0x1'));var zipdir=require(_0x536c('0x2'));var jsonpatch=require(_0x536c('0x3'));var rp=require('request-promise');var moment=require(_0x536c('0x4'));var BPromise=require(_0x536c('0x5'));var Mustache=require(_0x536c('0x6'));var util=require(_0x536c('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x536c('0x8'));var fs=require('fs');var fs_extra=require(_0x536c('0x9'));var _=require('lodash');var squel=require(_0x536c('0xa'));var crypto=require(_0x536c('0xb'));var jsforce=require(_0x536c('0xc'));var deskjs=require(_0x536c('0xd'));var toCsv=require(_0x536c('0xe'));var querystring=require(_0x536c('0xf'));var Papa=require(_0x536c('0x10'));var Redis=require(_0x536c('0x11'));var authService=require(_0x536c('0x12'));var qs=require(_0x536c('0x13'));var as=require(_0x536c('0x14'));var hardwareService=require(_0x536c('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x536c('0x16'));var config=require(_0x536c('0x17'));var licenseUtil=require(_0x536c('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x536c('0x19'));function respondWithStatusCode(_0x39f004,_0x1eadf6){_0x1eadf6=_0x1eadf6||0xcc;return function(_0x76e029){if(_0x76e029){return _0x39f004['sendStatus'](_0x1eadf6);}return _0x39f004[_0x536c('0x1a')](_0x1eadf6)[_0x536c('0x1b')]();};}function respondWithResult(_0xd3cbcf,_0xc2bdab){_0xc2bdab=_0xc2bdab||0xc8;return function(_0xb1f7cc){if(_0xb1f7cc){return _0xd3cbcf[_0x536c('0x1a')](_0xc2bdab)[_0x536c('0x1c')](_0xb1f7cc);}};}function respondWithFilteredResult(_0x21c03a,_0x5551b4){return function(_0x45e96b){if(_0x45e96b){var _0x365eda=typeof _0x5551b4[_0x536c('0x1d')]===_0x536c('0x1e')&&typeof _0x5551b4[_0x536c('0x1f')]===_0x536c('0x1e');var _0x2a7090=_0x45e96b['count'];var _0x31b012=_0x365eda?0x0:_0x5551b4[_0x536c('0x1d')];var _0x20966e=_0x365eda?_0x45e96b[_0x536c('0x20')]:_0x5551b4['offset']+_0x5551b4[_0x536c('0x1f')];var _0x3463b7;if(_0x20966e>=_0x2a7090){_0x20966e=_0x2a7090;_0x3463b7=0xc8;}else{_0x3463b7=0xce;}_0x21c03a[_0x536c('0x1a')](_0x3463b7);return _0x21c03a[_0x536c('0x21')]('Content-Range',_0x31b012+'-'+_0x20966e+'/'+_0x2a7090)[_0x536c('0x1c')](_0x45e96b);}return null;};}function patchUpdates(_0x1b0834){return function(_0xbb39bf){try{jsonpatch[_0x536c('0x22')](_0xbb39bf,_0x1b0834,!![]);}catch(_0x19a07b){return BPromise[_0x536c('0x23')](_0x19a07b);}return _0xbb39bf['save']();};}function saveUpdates(_0xb60f5f,_0x3f5329){return function(_0x3daf0f){if(_0x3daf0f){return _0x3daf0f[_0x536c('0x24')](_0xb60f5f)[_0x536c('0x25')](function(_0x13a7e9){return _0x13a7e9;});}return null;};}function removeEntity(_0x492961,_0x21f9af){return function(_0x129f07){if(_0x129f07){return _0x129f07[_0x536c('0x26')]()[_0x536c('0x25')](function(){_0x492961[_0x536c('0x1a')](0xcc)[_0x536c('0x1b')]();});}};}function handleEntityNotFound(_0x447f9f,_0x1c3e10){return function(_0x56625d){if(!_0x56625d){_0x447f9f[_0x536c('0x27')](0x194);}return _0x56625d;};}function handleError(_0x30a2ff,_0x347ff9){_0x347ff9=_0x347ff9||0x1f4;return function(_0x716aa2){logger[_0x536c('0x28')](_0x716aa2['stack']);if(_0x716aa2[_0x536c('0x29')]){delete _0x716aa2[_0x536c('0x29')];}_0x30a2ff[_0x536c('0x1a')](_0x347ff9)[_0x536c('0x2a')](_0x716aa2);};}exports['index']=function(_0x46c691,_0x54ff66){var _0x3fffc7={},_0x4d7ddc={},_0xe6c701={'count':0x0,'rows':[]};var _0xfc1c6a=_['map'](db[_0x536c('0x2b')][_0x536c('0x2c')],function(_0x5e8909){return{'name':_0x5e8909[_0x536c('0x2d')],'type':_0x5e8909[_0x536c('0x2e')][_0x536c('0x2f')]};});_0x4d7ddc[_0x536c('0x30')]=_['map'](_0xfc1c6a,_0x536c('0x29'));_0x4d7ddc[_0x536c('0x31')]=_[_0x536c('0x32')](_0x46c691['query']);_0x4d7ddc[_0x536c('0x33')]=_['intersection'](_0x4d7ddc[_0x536c('0x30')],_0x4d7ddc['query']);_0x3fffc7['attributes']=_[_0x536c('0x34')](_0x4d7ddc[_0x536c('0x30')],qs[_0x536c('0x35')](_0x46c691['query'][_0x536c('0x35')]));_0x3fffc7[_0x536c('0x36')]=_0x3fffc7[_0x536c('0x36')][_0x536c('0x37')]?_0x3fffc7[_0x536c('0x36')]:_0x4d7ddc[_0x536c('0x30')];if(!_0x46c691[_0x536c('0x31')][_0x536c('0x38')]('nolimit')){_0x3fffc7[_0x536c('0x1f')]=qs[_0x536c('0x1f')](_0x46c691['query'][_0x536c('0x1f')]);_0x3fffc7[_0x536c('0x1d')]=qs[_0x536c('0x1d')](_0x46c691['query'][_0x536c('0x1d')]);}_0x3fffc7[_0x536c('0x39')]=qs[_0x536c('0x3a')](_0x46c691[_0x536c('0x31')][_0x536c('0x3a')]);_0x3fffc7[_0x536c('0x3b')]=qs[_0x536c('0x33')](_['pick'](_0x46c691[_0x536c('0x31')],_0x4d7ddc[_0x536c('0x33')]),_0xfc1c6a);if(_0x46c691['query'][_0x536c('0x3c')]){_0x3fffc7[_0x536c('0x3b')]=_[_0x536c('0x3d')](_0x3fffc7['where'],{'$or':_[_0x536c('0x3e')](_0xfc1c6a,function(_0x278aab){if(_0x278aab[_0x536c('0x2e')]!=='VIRTUAL'){var _0x18b61f={};_0x18b61f[_0x278aab[_0x536c('0x29')]]={'$like':'%'+_0x46c691['query']['filter']+'%'};return _0x18b61f;}})});}_0x3fffc7=_[_0x536c('0x3d')]({},_0x3fffc7,_0x46c691['options']);var _0x46a927={'where':_0x3fffc7[_0x536c('0x3b')]};return db['FreshsalesAccount']['count'](_0x46a927)['then'](function(_0x30ff14){_0xe6c701[_0x536c('0x20')]=_0x30ff14;if(_0x46c691['query'][_0x536c('0x3f')]){_0x3fffc7[_0x536c('0x40')]=[{'all':!![]}];}return db[_0x536c('0x2b')]['findAll'](_0x3fffc7);})[_0x536c('0x25')](function(_0x4de6ea){_0xe6c701[_0x536c('0x41')]=_0x4de6ea;return _0xe6c701;})[_0x536c('0x25')](respondWithFilteredResult(_0x54ff66,_0x3fffc7))[_0x536c('0x42')](handleError(_0x54ff66,null));};exports['show']=function(_0x433513,_0x4b51ac){var _0x1f6852={'raw':![],'where':{'id':_0x433513[_0x536c('0x43')]['id']}},_0x268768={};_0x268768[_0x536c('0x30')]=_['keys'](db[_0x536c('0x2b')]['rawAttributes']);_0x268768[_0x536c('0x31')]=_[_0x536c('0x32')](_0x433513['query']);_0x268768[_0x536c('0x33')]=_[_0x536c('0x34')](_0x268768[_0x536c('0x30')],_0x268768[_0x536c('0x31')]);_0x1f6852[_0x536c('0x36')]=_[_0x536c('0x34')](_0x268768[_0x536c('0x30')],qs['fields'](_0x433513[_0x536c('0x31')][_0x536c('0x35')]));_0x1f6852[_0x536c('0x36')]=_0x1f6852[_0x536c('0x36')][_0x536c('0x37')]?_0x1f6852[_0x536c('0x36')]:_0x268768['model'];if(_0x433513['query'][_0x536c('0x3f')]){_0x1f6852[_0x536c('0x40')]=[{'all':!![]}];}_0x1f6852=_[_0x536c('0x3d')]({},_0x1f6852,_0x433513[_0x536c('0x44')]);return db[_0x536c('0x2b')]['find'](_0x1f6852)[_0x536c('0x25')](handleEntityNotFound(_0x4b51ac,null))['then'](respondWithResult(_0x4b51ac,null))['catch'](handleError(_0x4b51ac,null));};exports[_0x536c('0x45')]=function(_0x5b8295,_0x1000e6){return db[_0x536c('0x2b')]['create'](_0x5b8295[_0x536c('0x46')],{})['then'](respondWithResult(_0x1000e6,0xc9))['catch'](handleError(_0x1000e6,null));};exports[_0x536c('0x24')]=function(_0x60ddb2,_0x3450a5){if(_0x60ddb2[_0x536c('0x46')]['id']){delete _0x60ddb2[_0x536c('0x46')]['id'];}return db['FreshsalesAccount'][_0x536c('0x47')]({'where':{'id':_0x60ddb2[_0x536c('0x43')]['id']}})[_0x536c('0x25')](handleEntityNotFound(_0x3450a5,null))[_0x536c('0x25')](saveUpdates(_0x60ddb2[_0x536c('0x46')],null))[_0x536c('0x25')](respondWithResult(_0x3450a5,null))[_0x536c('0x42')](handleError(_0x3450a5,null));};exports[_0x536c('0x26')]=function(_0x5ca06d,_0x25855c){return db[_0x536c('0x2b')]['find']({'where':{'id':_0x5ca06d[_0x536c('0x43')]['id']}})[_0x536c('0x25')](handleEntityNotFound(_0x25855c,null))['then'](removeEntity(_0x25855c,null))[_0x536c('0x42')](handleError(_0x25855c,null));};exports[_0x536c('0x48')]=function(_0x1070f6,_0x5838c2,_0x15b9d2){var _0x235cb6={};var _0x49d733={};var _0x19f0b9;var _0x4cc8f2;return db['FreshsalesAccount'][_0x536c('0x49')]({'where':{'id':_0x1070f6[_0x536c('0x43')]['id']}})[_0x536c('0x25')](handleEntityNotFound(_0x5838c2,null))[_0x536c('0x25')](function(_0x5058d2){if(_0x5058d2){_0x19f0b9=_0x5058d2;_0x49d733[_0x536c('0x30')]=_[_0x536c('0x32')](db[_0x536c('0x4a')][_0x536c('0x2c')]);_0x49d733['query']=_[_0x536c('0x32')](_0x1070f6[_0x536c('0x31')]);_0x49d733[_0x536c('0x33')]=_[_0x536c('0x34')](_0x49d733[_0x536c('0x30')],_0x49d733['query']);_0x235cb6[_0x536c('0x36')]=_[_0x536c('0x34')](_0x49d733['model'],qs[_0x536c('0x35')](_0x1070f6[_0x536c('0x31')][_0x536c('0x35')]));_0x235cb6['attributes']=_0x235cb6[_0x536c('0x36')]['length']?_0x235cb6[_0x536c('0x36')]:_0x49d733['model'];_0x235cb6[_0x536c('0x39')]=qs['sort'](_0x1070f6['query']['sort']);_0x235cb6['where']=qs['filters'](_[_0x536c('0x4b')](_0x1070f6[_0x536c('0x31')],_0x49d733['filters']));if(_0x1070f6[_0x536c('0x31')]['filter']){_0x235cb6[_0x536c('0x3b')]=_[_0x536c('0x3d')](_0x235cb6['where'],{'$or':_[_0x536c('0x3e')](_0x235cb6[_0x536c('0x36')],function(_0x1a4a4e){var _0x14f632={};_0x14f632[_0x1a4a4e]={'$like':'%'+_0x1070f6[_0x536c('0x31')][_0x536c('0x3c')]+'%'};return _0x14f632;})});}_0x235cb6=_[_0x536c('0x3d')]({},_0x235cb6,_0x1070f6['options']);return _0x19f0b9['getConfigurations'](_0x235cb6);}})[_0x536c('0x25')](function(_0x3f8945){if(_0x3f8945){_0x4cc8f2=_0x3f8945[_0x536c('0x37')];if(!_0x1070f6[_0x536c('0x31')][_0x536c('0x38')]('nolimit')){_0x235cb6['limit']=qs[_0x536c('0x1f')](_0x1070f6['query'][_0x536c('0x1f')]);_0x235cb6['offset']=qs['offset'](_0x1070f6[_0x536c('0x31')][_0x536c('0x1d')]);}return _0x19f0b9[_0x536c('0x48')](_0x235cb6);}})['then'](function(_0x26277b){if(_0x26277b){return _0x26277b?{'count':_0x4cc8f2,'rows':_0x26277b}:null;}})[_0x536c('0x25')](respondWithResult(_0x5838c2,null))[_0x536c('0x42')](handleError(_0x5838c2,null));};exports[_0x536c('0x4c')]=function(_0x358f3c,_0x57a993,_0x3e8ebd){if(_0x358f3c['body']['id']){delete _0x358f3c[_0x536c('0x46')]['id'];}return db[_0x536c('0x2b')][_0x536c('0x49')]({'where':{'id':_0x358f3c['params']['id']}})[_0x536c('0x25')](handleEntityNotFound(_0x57a993,null))[_0x536c('0x25')](function(_0x4897c5){if(_0x4897c5){_0x358f3c['body']['AccountId']=_0x4897c5['id'];_0x358f3c['body'][_0x536c('0x4d')]=integrations[_0x536c('0x4e')](_0x358f3c[_0x536c('0x46')][_0x536c('0x4f')],_0x358f3c[_0x536c('0x46')][_0x536c('0x2e')]);_0x358f3c['body'][_0x536c('0x50')]=integrations[_0x536c('0x51')](_0x358f3c['body']['channel'],_0x358f3c[_0x536c('0x46')]['type']);return db[_0x536c('0x4a')][_0x536c('0x45')](_0x358f3c[_0x536c('0x46')],{'include':[{'model':db[_0x536c('0x52')],'as':_0x536c('0x4d')},{'model':db['FreshsalesField'],'as':_0x536c('0x50')}]});}return null;})['then'](respondWithResult(_0x57a993,null))[_0x536c('0x42')](handleError(_0x57a993,null));};exports[_0x536c('0x53')]=function(_0x595f6d,_0x3c6f9e,_0x4c7505){var _0x3c5d7e='';var _0x25fb45='';return db[_0x536c('0x2b')][_0x536c('0x49')]({'where':{'id':_0x595f6d['params']['id']},'attributes':['id',_0x536c('0x54'),'remoteUri','apiKey']})[_0x536c('0x25')](handleEntityNotFound(_0x3c6f9e,null))[_0x536c('0x25')](function(_0x1d6d7c){if(_0x1d6d7c){_0x25fb45=_0x1d6d7c[_0x536c('0x54')];_0x3c5d7e=_0x1d6d7c[_0x536c('0x55')];var _0x24a1b4=_0x1d6d7c[_0x536c('0x55')][_0x536c('0x56')](-0x1);if(_0x24a1b4==='/'){_0x3c5d7e=_0x3c5d7e[_0x536c('0x57')](0x0,_0x3c5d7e[_0x536c('0x58')](_0x24a1b4));}return rp({'method':_0x536c('0x59'),'uri':util['format'](_0x536c('0x5a'),_0x3c5d7e,'/api/selector/owners'),'headers':{'Authorization':_0x536c('0x5b')+_0x1d6d7c[_0x536c('0x5c')]},'json':!![]});}})[_0x536c('0x25')](function(_0x30e51f){if(_0x30e51f){var _0x48cb4a=_0x30e51f['users'];var _0x497575=![];var _0xc42d0d=null;for(_0xc42d0d=0x0;_0xc42d0d<_0x48cb4a[_0x536c('0x37')];_0xc42d0d++){if(_0x48cb4a[_0xc42d0d]['email']===_0x25fb45){_0x497575=!![];}}if(_0x497575){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x536c('0x5d')});}}})[_0x536c('0x25')](respondWithResult(_0x3c6f9e,null))[_0x536c('0x42')](function(_0x563666){var _0x3455dc=_0x595f6d[_0x536c('0x31')][_0x536c('0x5e')]?0x1f4:_0x563666[_0x536c('0x5f')]||0x1f4;logger[_0x536c('0x28')](_0x536c('0x60'),_0x536c('0x53'),_0x3455dc,JSON['stringify'](_0x563666));delete _0x563666['name'];if(_0x3455dc===0x191){_0x3455dc=0x190;}_0x3c6f9e['status'](_0x3455dc)[_0x536c('0x2a')](_0x595f6d[_0x536c('0x31')]['test']?{'message':_0x536c('0x61'),'statusCode':_0x563666[_0x536c('0x5f')]}:_0x563666);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 62114cc..a551e0f 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 _0x524e=['define','int_freshsales_accounts','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x2e0d2a,_0x8d568){var _0x4014f0=function(_0x3dd59d){while(--_0x3dd59d){_0x2e0d2a['push'](_0x2e0d2a['shift']());}};_0x4014f0(++_0x8d568);}(_0x524e,0x15e));var _0xe524=function(_0x2be83e,_0x4baf12){_0x2be83e=_0x2be83e-0x0;var _0x312019=_0x524e[_0x2be83e];return _0x312019;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe524('0x0'))(_0xe524('0x1'));var moment=require(_0xe524('0x2'));var BPromise=require(_0xe524('0x3'));var rp=require(_0xe524('0x4'));var fs=require('fs');var path=require(_0xe524('0x5'));var rimraf=require(_0xe524('0x6'));var config=require(_0xe524('0x7'));var attributes=require(_0xe524('0x8'));var integrations=require(_0xe524('0x9'));module['exports']=function(_0xaaeaa9,_0x41e1a3){return _0xaaeaa9[_0xe524('0xa')]('FreshsalesAccount',attributes,{'tableName':_0xe524('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4137=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount','lodash','util','../../config/logger','api'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4137,0xf8));var _0x7413=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x4137[_0x46698a];return _0x356db0;};'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'));var integrations=require(_0x7413('0xb'));module['exports']=function(_0xc808cd,_0x188d89){return _0xc808cd[_0x7413('0xc')](_0x7413('0xd'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 0a5a4d1..dbcfdea 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 _0xdf55=['FreshsalesAccount,\x20%s,\x20%s','message','info','result','catch','GetFreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','stringify','ShowFreshsalesAccount','FreshsalesAccount','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xdf55,0x83));var _0x5df5=function(_0x571461,_0x6f7b6b){_0x571461=_0x571461-0x0;var _0x15abf5=_0xdf55[_0x571461];return _0x15abf5;};'use strict';var _=require(_0x5df5('0x0'));var util=require(_0x5df5('0x1'));var moment=require('moment');var BPromise=require(_0x5df5('0x2'));var rs=require(_0x5df5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5df5('0x4'))['db'];var utils=require(_0x5df5('0x5'));var logger=require(_0x5df5('0x6'))('rpc');var config=require(_0x5df5('0x7'));var jayson=require(_0x5df5('0x8'));var client=jayson[_0x5df5('0x9')][_0x5df5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9b8756,_0x2b7ed9,_0x4722a2){return new BPromise(function(_0x3743f3,_0x4d43a3){return client[_0x5df5('0xb')](_0x9b8756,_0x4722a2)[_0x5df5('0xc')](function(_0x41941e){logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x2b7ed9,_0x5df5('0xd'));logger['debug'](_0x5df5('0xe'),_0x2b7ed9,_0x5df5('0xd'),JSON['stringify'](_0x41941e));if(_0x41941e['error']){if(_0x41941e[_0x5df5('0xf')][_0x5df5('0x10')]===0x1f4){logger[_0x5df5('0xf')](_0x5df5('0x11'),_0x2b7ed9,_0x41941e[_0x5df5('0xf')][_0x5df5('0x12')]);return _0x4d43a3(_0x41941e[_0x5df5('0xf')][_0x5df5('0x12')]);}logger[_0x5df5('0xf')](_0x5df5('0x11'),_0x2b7ed9,_0x41941e['error'][_0x5df5('0x12')]);return _0x3743f3(_0x41941e['error'][_0x5df5('0x12')]);}else{logger[_0x5df5('0x13')](_0x5df5('0x11'),_0x2b7ed9,_0x5df5('0xd'));_0x3743f3(_0x41941e[_0x5df5('0x14')]['message']);}})[_0x5df5('0x15')](function(_0x457205){logger['error'](_0x5df5('0x11'),_0x2b7ed9,_0x457205);_0x4d43a3(_0x457205);});});}exports[_0x5df5('0x16')]=function(_0xb7e1c2){var _0x44f700=this;return new Promise(function(_0x215d59,_0x4b499d){return db['FreshsalesAccount'][_0x5df5('0x17')]({'raw':_0xb7e1c2['options']?_0xb7e1c2[_0x5df5('0x18')][_0x5df5('0x19')]===undefined?!![]:![]:!![],'where':_0xb7e1c2[_0x5df5('0x18')]?_0xb7e1c2[_0x5df5('0x18')][_0x5df5('0x1a')]||null:null,'attributes':_0xb7e1c2['options']?_0xb7e1c2[_0x5df5('0x18')][_0x5df5('0x1b')]||null:null,'limit':_0xb7e1c2[_0x5df5('0x18')]?_0xb7e1c2[_0x5df5('0x18')][_0x5df5('0x1c')]||null:null,'include':_0xb7e1c2[_0x5df5('0x18')]?_0xb7e1c2['options'][_0x5df5('0x1d')]?_[_0x5df5('0x1e')](_0xb7e1c2[_0x5df5('0x18')][_0x5df5('0x1d')],function(_0x5ca542){return{'model':db[_0x5ca542[_0x5df5('0x1f')]],'as':_0x5ca542['as'],'attributes':_0x5ca542[_0x5df5('0x1b')],'include':_0x5ca542[_0x5df5('0x1d')]?_['map'](_0x5ca542['include'],function(_0x532923){return{'model':db[_0x532923[_0x5df5('0x1f')]],'as':_0x532923['as'],'attributes':_0x532923[_0x5df5('0x1b')],'include':_0x532923[_0x5df5('0x1d')]?_[_0x5df5('0x1e')](_0x532923[_0x5df5('0x1d')],function(_0x1fd83c){return{'model':db[_0x1fd83c[_0x5df5('0x1f')]],'as':_0x1fd83c['as'],'attributes':_0x1fd83c[_0x5df5('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x18bb61){logger['info'](_0x5df5('0x16'),_0xb7e1c2);logger[_0x5df5('0x20')]('GetFreshsalesAccount',_0xb7e1c2,JSON[_0x5df5('0x21')](_0x18bb61));_0x215d59(_0x18bb61);})['catch'](function(_0xd2b213){logger['error'](_0x5df5('0x16'),_0xd2b213['message'],_0xb7e1c2);_0x4b499d(_0x44f700[_0x5df5('0xf')](0x1f4,_0xd2b213['message']));});});};exports[_0x5df5('0x22')]=function(_0x47bebb){var _0x4784ca=this;return new Promise(function(_0x485484,_0xf445de){return db[_0x5df5('0x23')][_0x5df5('0x24')]({'raw':_0x47bebb[_0x5df5('0x18')]?_0x47bebb[_0x5df5('0x18')][_0x5df5('0x19')]===undefined?!![]:![]:!![],'where':_0x47bebb[_0x5df5('0x18')]?_0x47bebb['options']['where']||null:null,'attributes':_0x47bebb[_0x5df5('0x18')]?_0x47bebb[_0x5df5('0x18')][_0x5df5('0x1b')]||null:null,'include':_0x47bebb[_0x5df5('0x18')]?_0x47bebb[_0x5df5('0x18')][_0x5df5('0x1d')]?_['map'](_0x47bebb[_0x5df5('0x18')][_0x5df5('0x1d')],function(_0x2f1001){return{'model':db[_0x2f1001[_0x5df5('0x1f')]],'as':_0x2f1001['as'],'attributes':_0x2f1001['attributes'],'include':_0x2f1001[_0x5df5('0x1d')]?_['map'](_0x2f1001[_0x5df5('0x1d')],function(_0x394676){return{'model':db[_0x394676['model']],'as':_0x394676['as'],'attributes':_0x394676[_0x5df5('0x1b')],'include':_0x394676['include']?_[_0x5df5('0x1e')](_0x394676[_0x5df5('0x1d')],function(_0x4697c2){return{'model':db[_0x4697c2[_0x5df5('0x1f')]],'as':_0x4697c2['as'],'attributes':_0x4697c2['attributes']};}):[]};}):[]};}):[]:[]})[_0x5df5('0xc')](function(_0x2e7e64){logger[_0x5df5('0x13')](_0x5df5('0x22'),_0x47bebb);logger['debug'](_0x5df5('0x22'),_0x47bebb,JSON[_0x5df5('0x21')](_0x2e7e64));_0x485484(_0x2e7e64);})[_0x5df5('0x15')](function(_0x18b597){logger[_0x5df5('0xf')](_0x5df5('0x22'),_0x18b597[_0x5df5('0x12')],_0x47bebb);_0xf445de(_0x4784ca['error'](0x1f4,_0x18b597[_0x5df5('0x12')]));});});}; \ No newline at end of file +var _0x27a0=['client','http','request','info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetFreshsalesAccount','FreshsalesAccount','options','attributes','limit','include','map','model','then','catch','ShowFreshsalesAccount','find','raw','where','util','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise'];(function(_0xea35d1,_0x302471){var _0x1d7a7c=function(_0x1bc101){while(--_0x1bc101){_0xea35d1['push'](_0xea35d1['shift']());}};_0x1d7a7c(++_0x302471);}(_0x27a0,0xbf));var _0x027a=function(_0x45f2b4,_0x8e4e3d){_0x45f2b4=_0x45f2b4-0x0;var _0x321120=_0x27a0[_0x45f2b4];return _0x321120;};'use strict';var _=require('lodash');var util=require(_0x027a('0x0'));var moment=require(_0x027a('0x1'));var BPromise=require(_0x027a('0x2'));var rs=require(_0x027a('0x3'));var fs=require('fs');var Redis=require(_0x027a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x027a('0x5'));var jayson=require(_0x027a('0x6'));var client=jayson[_0x027a('0x7')][_0x027a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xe233ed,_0x3c7d67,_0x550fbb){return new BPromise(function(_0x3d1429,_0x271dfe){return client[_0x027a('0x9')](_0xe233ed,_0x550fbb)['then'](function(_0x44c56a){logger[_0x027a('0xa')](_0x027a('0xb'),_0x3c7d67,'request\x20sent');logger[_0x027a('0xc')](_0x027a('0xd'),_0x3c7d67,_0x027a('0xe'),JSON[_0x027a('0xf')](_0x44c56a));if(_0x44c56a[_0x027a('0x10')]){if(_0x44c56a[_0x027a('0x10')][_0x027a('0x11')]===0x1f4){logger[_0x027a('0x10')](_0x027a('0xb'),_0x3c7d67,_0x44c56a[_0x027a('0x10')][_0x027a('0x12')]);return _0x271dfe(_0x44c56a['error'][_0x027a('0x12')]);}logger[_0x027a('0x10')](_0x027a('0xb'),_0x3c7d67,_0x44c56a[_0x027a('0x10')][_0x027a('0x12')]);return _0x3d1429(_0x44c56a['error']['message']);}else{logger[_0x027a('0xa')]('FreshsalesAccount,\x20%s,\x20%s',_0x3c7d67,_0x027a('0xe'));_0x3d1429(_0x44c56a['result'][_0x027a('0x12')]);}})['catch'](function(_0x4dc3ab){logger['error'](_0x027a('0xb'),_0x3c7d67,_0x4dc3ab);_0x271dfe(_0x4dc3ab);});});}exports[_0x027a('0x13')]=function(_0x826d19){var _0x1fb40b=this;return new Promise(function(_0x52125e,_0x282e70){return db[_0x027a('0x14')]['findAll']({'raw':_0x826d19['options']?_0x826d19[_0x027a('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x826d19[_0x027a('0x15')]?_0x826d19['options']['where']||null:null,'attributes':_0x826d19['options']?_0x826d19['options'][_0x027a('0x16')]||null:null,'limit':_0x826d19[_0x027a('0x15')]?_0x826d19[_0x027a('0x15')][_0x027a('0x17')]||null:null,'include':_0x826d19['options']?_0x826d19[_0x027a('0x15')][_0x027a('0x18')]?_[_0x027a('0x19')](_0x826d19[_0x027a('0x15')][_0x027a('0x18')],function(_0x3bbd46){return{'model':db[_0x3bbd46['model']],'as':_0x3bbd46['as'],'attributes':_0x3bbd46[_0x027a('0x16')],'include':_0x3bbd46['include']?_[_0x027a('0x19')](_0x3bbd46[_0x027a('0x18')],function(_0x1b1a13){return{'model':db[_0x1b1a13[_0x027a('0x1a')]],'as':_0x1b1a13['as'],'attributes':_0x1b1a13['attributes'],'include':_0x1b1a13['include']?_[_0x027a('0x19')](_0x1b1a13[_0x027a('0x18')],function(_0x338141){return{'model':db[_0x338141[_0x027a('0x1a')]],'as':_0x338141['as'],'attributes':_0x338141['attributes']};}):[]};}):[]};}):[]:[]})[_0x027a('0x1b')](function(_0x55a8cd){logger[_0x027a('0xa')]('GetFreshsalesAccount',_0x826d19);logger[_0x027a('0xc')]('GetFreshsalesAccount',_0x826d19,JSON['stringify'](_0x55a8cd));_0x52125e(_0x55a8cd);})[_0x027a('0x1c')](function(_0x5782ac){logger['error'](_0x027a('0x13'),_0x5782ac['message'],_0x826d19);_0x282e70(_0x1fb40b[_0x027a('0x10')](0x1f4,_0x5782ac['message']));});});};exports[_0x027a('0x1d')]=function(_0xc99acc){var _0x4d9a29=this;return new Promise(function(_0xe4ea7d,_0x4b4ac4){return db[_0x027a('0x14')][_0x027a('0x1e')]({'raw':_0xc99acc[_0x027a('0x15')]?_0xc99acc[_0x027a('0x15')][_0x027a('0x1f')]===undefined?!![]:![]:!![],'where':_0xc99acc[_0x027a('0x15')]?_0xc99acc['options'][_0x027a('0x20')]||null:null,'attributes':_0xc99acc['options']?_0xc99acc[_0x027a('0x15')]['attributes']||null:null,'include':_0xc99acc[_0x027a('0x15')]?_0xc99acc[_0x027a('0x15')][_0x027a('0x18')]?_[_0x027a('0x19')](_0xc99acc[_0x027a('0x15')]['include'],function(_0x1274e1){return{'model':db[_0x1274e1[_0x027a('0x1a')]],'as':_0x1274e1['as'],'attributes':_0x1274e1[_0x027a('0x16')],'include':_0x1274e1[_0x027a('0x18')]?_[_0x027a('0x19')](_0x1274e1[_0x027a('0x18')],function(_0x1bc29f){return{'model':db[_0x1bc29f[_0x027a('0x1a')]],'as':_0x1bc29f['as'],'attributes':_0x1bc29f[_0x027a('0x16')],'include':_0x1bc29f[_0x027a('0x18')]?_[_0x027a('0x19')](_0x1bc29f['include'],function(_0x29dc8f){return{'model':db[_0x29dc8f[_0x027a('0x1a')]],'as':_0x29dc8f['as'],'attributes':_0x29dc8f[_0x027a('0x16')]};}):[]};}):[]};}):[]:[]})[_0x027a('0x1b')](function(_0x19b476){logger[_0x027a('0xa')](_0x027a('0x1d'),_0xc99acc);logger['debug'](_0x027a('0x1d'),_0xc99acc,JSON[_0x027a('0xf')](_0x19b476));_0xe4ea7d(_0x19b476);})[_0x027a('0x1c')](function(_0x5e9130){logger[_0x027a('0x10')]('ShowFreshsalesAccount',_0x5e9130[_0x027a('0x12')],_0xc99acc);_0x4b4ac4(_0x4d9a29[_0x027a('0x10')](0x1f4,_0x5e9130[_0x027a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 018fda0..6588925 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 _0x7c57=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/subjects','/:id/fields','getFields','post','update','delete','destroy','multer'];(function(_0x57e5f9,_0x5af0b0){var _0x2e26c6=function(_0x256e0e){while(--_0x256e0e){_0x57e5f9['push'](_0x57e5f9['shift']());}};_0x2e26c6(++_0x5af0b0);}(_0x7c57,0x6d));var _0x77c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7c57[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x77c5('0x0'));var util=require(_0x77c5('0x1'));var path=require(_0x77c5('0x2'));var timeout=require(_0x77c5('0x3'));var express=require(_0x77c5('0x4'));var router=express[_0x77c5('0x5')]();var fs_extra=require(_0x77c5('0x6'));var auth=require(_0x77c5('0x7'));var interaction=require(_0x77c5('0x8'));var config=require(_0x77c5('0x9'));var controller=require('./intFreshsalesConfiguration.controller');router[_0x77c5('0xa')]('/',auth[_0x77c5('0xb')](),controller[_0x77c5('0xc')]);router[_0x77c5('0xa')](_0x77c5('0xd'),auth[_0x77c5('0xb')](),controller[_0x77c5('0xe')]);router[_0x77c5('0xa')](_0x77c5('0xf'),auth[_0x77c5('0xb')](),controller['getSubjects']);router[_0x77c5('0xa')]('/:id/descriptions',auth[_0x77c5('0xb')](),controller['getDescriptions']);router[_0x77c5('0xa')](_0x77c5('0x10'),auth[_0x77c5('0xb')](),controller[_0x77c5('0x11')]);router[_0x77c5('0x12')]('/',auth[_0x77c5('0xb')](),controller['create']);router['put'](_0x77c5('0xd'),auth[_0x77c5('0xb')](),controller[_0x77c5('0x13')]);router[_0x77c5('0x14')](_0x77c5('0xd'),auth['isAuthenticated'](),controller[_0x77c5('0x15')]);module['exports']=router; \ No newline at end of file +var _0x151e=['./intFreshsalesConfiguration.controller','get','isAuthenticated','show','/:id/subjects','getSubjects','getDescriptions','getFields','post','create','put','/:id','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x33c637,_0x597c26){var _0x14aa20=function(_0x32a8b5){while(--_0x32a8b5){_0x33c637['push'](_0x33c637['shift']());}};_0x14aa20(++_0x597c26);}(_0x151e,0xeb));var _0xe151=function(_0x54da5b,_0x12fd71){_0x54da5b=_0x54da5b-0x0;var _0x285d3b=_0x151e[_0x54da5b];return _0x285d3b;};'use strict';var multer=require(_0xe151('0x0'));var util=require('util');var path=require(_0xe151('0x1'));var timeout=require(_0xe151('0x2'));var express=require(_0xe151('0x3'));var router=express[_0xe151('0x4')]();var fs_extra=require(_0xe151('0x5'));var auth=require(_0xe151('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe151('0x7'));router[_0xe151('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe151('0x8')]('/:id',auth[_0xe151('0x9')](),controller[_0xe151('0xa')]);router['get'](_0xe151('0xb'),auth[_0xe151('0x9')](),controller[_0xe151('0xc')]);router[_0xe151('0x8')]('/:id/descriptions',auth[_0xe151('0x9')](),controller[_0xe151('0xd')]);router[_0xe151('0x8')]('/:id/fields',auth[_0xe151('0x9')](),controller[_0xe151('0xe')]);router[_0xe151('0xf')]('/',auth['isAuthenticated'](),controller[_0xe151('0x10')]);router[_0xe151('0x11')](_0xe151('0x12'),auth[_0xe151('0x9')](),controller[_0xe151('0x13')]);router[_0xe151('0x14')]('/:id',auth[_0xe151('0x9')](),controller['destroy']);module[_0xe151('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 44fa15b..88c71ab 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 _0xf323=['sequelize','STRING'];(function(_0x4227d9,_0x550314){var _0x581959=function(_0x3c9216){while(--_0x3c9216){_0x4227d9['push'](_0x4227d9['shift']());}};_0x581959(++_0x550314);}(_0xf323,0x92));var _0x3f32=function(_0x209a80,_0x3100ad){_0x209a80=_0x209a80-0x0;var _0x5992d9=_0xf323[_0x209a80];return _0x5992d9;};'use strict';var Sequelize=require(_0x3f32('0x0'));module['exports']={'name':{'type':Sequelize[_0x3f32('0x1')]},'description':{'type':Sequelize[_0x3f32('0x1')]}}; \ No newline at end of file +var _0x00ee=['STRING','sequelize'];(function(_0x3d5df9,_0x5b3623){var _0x50ba39=function(_0x3c0de0){while(--_0x3c0de0){_0x3d5df9['push'](_0x3d5df9['shift']());}};_0x50ba39(++_0x5b3623);}(_0x00ee,0xef));var _0xe00e=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x00ee[_0x31cb5f];return _0x586042;};'use strict';var Sequelize=require(_0xe00e('0x0'));module['exports']={'name':{'type':Sequelize[_0xe00e('0x1')]},'description':{'type':Sequelize[_0xe00e('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 06f33df..d73a2fd 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 _0xe20b=['FreshsalesField','getSubjects','getDescriptions','order','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','FreshsalesConfiguration','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','rawAttributes','keys','create','body','find','findOne','params'];(function(_0xa331d9,_0x55704f){var _0x48fadf=function(_0x3e0786){while(--_0x3e0786){_0xa331d9['push'](_0xa331d9['shift']());}};_0x48fadf(++_0x55704f);}(_0xe20b,0x1eb));var _0xbe20=function(_0x4e5089,_0x186f63){_0x4e5089=_0x4e5089-0x0;var _0x17f56b=_0xe20b[_0x4e5089];return _0x17f56b;};'use strict';var emlformat=require(_0xbe20('0x0'));var rimraf=require(_0xbe20('0x1'));var zipdir=require(_0xbe20('0x2'));var jsonpatch=require(_0xbe20('0x3'));var rp=require(_0xbe20('0x4'));var moment=require('moment');var BPromise=require(_0xbe20('0x5'));var Mustache=require('mustache');var util=require(_0xbe20('0x6'));var path=require('path');var sox=require(_0xbe20('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbe20('0x8'));var _=require('lodash');var squel=require(_0xbe20('0x9'));var crypto=require(_0xbe20('0xa'));var jsforce=require(_0xbe20('0xb'));var deskjs=require(_0xbe20('0xc'));var toCsv=require('to-csv');var querystring=require(_0xbe20('0xd'));var Papa=require(_0xbe20('0xe'));var Redis=require(_0xbe20('0xf'));var authService=require(_0xbe20('0x10'));var qs=require(_0xbe20('0x11'));var as=require(_0xbe20('0x12'));var hardwareService=require(_0xbe20('0x13'));var logger=require(_0xbe20('0x14'))(_0xbe20('0x15'));var utils=require('../../config/utils');var config=require(_0xbe20('0x16'));var licenseUtil=require(_0xbe20('0x17'));var db=require(_0xbe20('0x18'))['db'];function respondWithStatusCode(_0x1f9f4f,_0x403ea1){_0x403ea1=_0x403ea1||0xcc;return function(_0x241429){if(_0x241429){return _0x1f9f4f[_0xbe20('0x19')](_0x403ea1);}return _0x1f9f4f[_0xbe20('0x1a')](_0x403ea1)[_0xbe20('0x1b')]();};}function respondWithResult(_0x739c10,_0x367419){_0x367419=_0x367419||0xc8;return function(_0x232121){if(_0x232121){return _0x739c10[_0xbe20('0x1a')](_0x367419)[_0xbe20('0x1c')](_0x232121);}};}function respondWithFilteredResult(_0x142098,_0x212dea){return function(_0x4fad7c){if(_0x4fad7c){var _0x44d9de=typeof _0x212dea[_0xbe20('0x1d')]==='undefined'&&typeof _0x212dea[_0xbe20('0x1e')]===_0xbe20('0x1f');var _0x14b694=_0x4fad7c[_0xbe20('0x20')];var _0x2ba6fd=_0x44d9de?0x0:_0x212dea[_0xbe20('0x1d')];var _0x55ab0d=_0x44d9de?_0x4fad7c['count']:_0x212dea[_0xbe20('0x1d')]+_0x212dea['limit'];var _0x22d4aa;if(_0x55ab0d>=_0x14b694){_0x55ab0d=_0x14b694;_0x22d4aa=0xc8;}else{_0x22d4aa=0xce;}_0x142098['status'](_0x22d4aa);return _0x142098['set'](_0xbe20('0x21'),_0x2ba6fd+'-'+_0x55ab0d+'/'+_0x14b694)[_0xbe20('0x1c')](_0x4fad7c);}return null;};}function patchUpdates(_0x3210bb){return function(_0x13ad12){try{jsonpatch[_0xbe20('0x22')](_0x13ad12,_0x3210bb,!![]);}catch(_0x431134){return BPromise[_0xbe20('0x23')](_0x431134);}return _0x13ad12[_0xbe20('0x24')]();};}function saveUpdates(_0x2d61e9,_0x5ebedb){return function(_0x33dcd){if(_0x33dcd){return _0x33dcd[_0xbe20('0x25')](_0x2d61e9)[_0xbe20('0x26')](function(_0x19fc13){return _0x19fc13;});}return null;};}function removeEntity(_0x5628ba,_0x3cfefc){return function(_0x39e46d){if(_0x39e46d){return _0x39e46d[_0xbe20('0x27')]()[_0xbe20('0x26')](function(){_0x5628ba[_0xbe20('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e2346,_0x37b1f8){return function(_0x46f0c2){if(!_0x46f0c2){_0x3e2346['sendStatus'](0x194);}return _0x46f0c2;};}function handleError(_0x2c3562,_0x353e6a){_0x353e6a=_0x353e6a||0x1f4;return function(_0x240fdc){logger[_0xbe20('0x28')](_0x240fdc['stack']);if(_0x240fdc[_0xbe20('0x29')]){delete _0x240fdc['name'];}_0x2c3562['status'](_0x353e6a)[_0xbe20('0x2a')](_0x240fdc);};}exports[_0xbe20('0x2b')]=function(_0x1053f7,_0x1ce20e){var _0x5192={},_0x21be0e={},_0x3a4f04={'count':0x0,'rows':[]};var _0x39d1eb=_['map'](db[_0xbe20('0x2c')]['rawAttributes'],function(_0x3d2879){return{'name':_0x3d2879['fieldName'],'type':_0x3d2879[_0xbe20('0x2d')][_0xbe20('0x2e')]};});_0x21be0e[_0xbe20('0x2f')]=_[_0xbe20('0x30')](_0x39d1eb,_0xbe20('0x29'));_0x21be0e[_0xbe20('0x31')]=_['keys'](_0x1053f7[_0xbe20('0x31')]);_0x21be0e[_0xbe20('0x32')]=_[_0xbe20('0x33')](_0x21be0e[_0xbe20('0x2f')],_0x21be0e[_0xbe20('0x31')]);_0x5192[_0xbe20('0x34')]=_[_0xbe20('0x33')](_0x21be0e['model'],qs[_0xbe20('0x35')](_0x1053f7['query'][_0xbe20('0x35')]));_0x5192[_0xbe20('0x34')]=_0x5192[_0xbe20('0x34')][_0xbe20('0x36')]?_0x5192[_0xbe20('0x34')]:_0x21be0e[_0xbe20('0x2f')];if(!_0x1053f7[_0xbe20('0x31')][_0xbe20('0x37')](_0xbe20('0x38'))){_0x5192['limit']=qs['limit'](_0x1053f7[_0xbe20('0x31')][_0xbe20('0x1e')]);_0x5192[_0xbe20('0x1d')]=qs[_0xbe20('0x1d')](_0x1053f7[_0xbe20('0x31')]['offset']);}_0x5192['order']=qs[_0xbe20('0x39')](_0x1053f7[_0xbe20('0x31')]['sort']);_0x5192[_0xbe20('0x3a')]=qs['filters'](_[_0xbe20('0x3b')](_0x1053f7['query'],_0x21be0e[_0xbe20('0x32')]),_0x39d1eb);if(_0x1053f7[_0xbe20('0x31')][_0xbe20('0x3c')]){_0x5192[_0xbe20('0x3a')]=_[_0xbe20('0x3d')](_0x5192['where'],{'$or':_[_0xbe20('0x30')](_0x39d1eb,function(_0x2ac98f){if(_0x2ac98f[_0xbe20('0x2d')]!==_0xbe20('0x3e')){var _0x429567={};_0x429567[_0x2ac98f['name']]={'$like':'%'+_0x1053f7[_0xbe20('0x31')][_0xbe20('0x3c')]+'%'};return _0x429567;}})});}_0x5192=_[_0xbe20('0x3d')]({},_0x5192,_0x1053f7[_0xbe20('0x3f')]);var _0x4f565a={'where':_0x5192[_0xbe20('0x3a')]};return db[_0xbe20('0x2c')][_0xbe20('0x20')](_0x4f565a)[_0xbe20('0x26')](function(_0x5d8a85){_0x3a4f04[_0xbe20('0x20')]=_0x5d8a85;if(_0x1053f7['query'][_0xbe20('0x40')]){_0x5192[_0xbe20('0x41')]=[{'all':!![]}];}return db[_0xbe20('0x2c')][_0xbe20('0x42')](_0x5192);})['then'](function(_0xd5fdea){_0x3a4f04['rows']=_0xd5fdea;return _0x3a4f04;})[_0xbe20('0x26')](respondWithFilteredResult(_0x1ce20e,_0x5192))[_0xbe20('0x43')](handleError(_0x1ce20e,null));};exports[_0xbe20('0x44')]=function(_0x56c207,_0x5dd527){var _0xf5fe74={'raw':![],'where':{'id':_0x56c207['params']['id']}},_0x4c5c55={};_0x4c5c55[_0xbe20('0x2f')]=_['keys'](db[_0xbe20('0x2c')][_0xbe20('0x45')]);_0x4c5c55['query']=_[_0xbe20('0x46')](_0x56c207[_0xbe20('0x31')]);_0x4c5c55[_0xbe20('0x32')]=_[_0xbe20('0x33')](_0x4c5c55['model'],_0x4c5c55[_0xbe20('0x31')]);_0xf5fe74[_0xbe20('0x34')]=_[_0xbe20('0x33')](_0x4c5c55['model'],qs[_0xbe20('0x35')](_0x56c207[_0xbe20('0x31')][_0xbe20('0x35')]));_0xf5fe74[_0xbe20('0x34')]=_0xf5fe74[_0xbe20('0x34')][_0xbe20('0x36')]?_0xf5fe74[_0xbe20('0x34')]:_0x4c5c55[_0xbe20('0x2f')];if(_0x56c207['query'][_0xbe20('0x40')]){_0xf5fe74[_0xbe20('0x41')]=[{'all':!![]}];}_0xf5fe74=_[_0xbe20('0x3d')]({},_0xf5fe74,_0x56c207[_0xbe20('0x3f')]);return db[_0xbe20('0x2c')]['find'](_0xf5fe74)[_0xbe20('0x26')](handleEntityNotFound(_0x5dd527,null))['then'](respondWithResult(_0x5dd527,null))[_0xbe20('0x43')](handleError(_0x5dd527,null));};exports[_0xbe20('0x47')]=function(_0x2f388f,_0x5609c9){return db['FreshsalesConfiguration'][_0xbe20('0x47')](_0x2f388f[_0xbe20('0x48')],{})[_0xbe20('0x26')](respondWithResult(_0x5609c9,0xc9))[_0xbe20('0x43')](handleError(_0x5609c9,null));};exports['update']=function(_0x4b7da5,_0x3609db){if(_0x4b7da5[_0xbe20('0x48')]['id']){delete _0x4b7da5[_0xbe20('0x48')]['id'];}return db[_0xbe20('0x2c')]['find']({'where':{'id':_0x4b7da5['params']['id']}})[_0xbe20('0x26')](handleEntityNotFound(_0x3609db,null))[_0xbe20('0x26')](saveUpdates(_0x4b7da5['body'],null))[_0xbe20('0x26')](respondWithResult(_0x3609db,null))[_0xbe20('0x43')](handleError(_0x3609db,null));};exports[_0xbe20('0x27')]=function(_0x2a1912,_0x524618){return db[_0xbe20('0x2c')][_0xbe20('0x49')]({'where':{'id':_0x2a1912['params']['id']}})[_0xbe20('0x26')](handleEntityNotFound(_0x524618,null))[_0xbe20('0x26')](removeEntity(_0x524618,null))[_0xbe20('0x43')](handleError(_0x524618,null));};exports['getSubjects']=function(_0x406fc3,_0x4eac2d,_0x1a439f){var _0x3eb5f9={};var _0xb60ef5={};var _0x49bd3d;var _0x1f7383;return db['FreshsalesConfiguration'][_0xbe20('0x4a')]({'where':{'id':_0x406fc3[_0xbe20('0x4b')]['id']}})[_0xbe20('0x26')](handleEntityNotFound(_0x4eac2d,null))[_0xbe20('0x26')](function(_0x3f89f8){if(_0x3f89f8){_0x49bd3d=_0x3f89f8;_0xb60ef5[_0xbe20('0x2f')]=_['keys'](db[_0xbe20('0x4c')][_0xbe20('0x45')]);_0xb60ef5[_0xbe20('0x31')]=_[_0xbe20('0x46')](_0x406fc3[_0xbe20('0x31')]);_0xb60ef5[_0xbe20('0x32')]=_[_0xbe20('0x33')](_0xb60ef5[_0xbe20('0x2f')],_0xb60ef5['query']);_0x3eb5f9['attributes']=_[_0xbe20('0x33')](_0xb60ef5[_0xbe20('0x2f')],qs[_0xbe20('0x35')](_0x406fc3[_0xbe20('0x31')]['fields']));_0x3eb5f9[_0xbe20('0x34')]=_0x3eb5f9[_0xbe20('0x34')]['length']?_0x3eb5f9['attributes']:_0xb60ef5[_0xbe20('0x2f')];_0x3eb5f9['order']=qs[_0xbe20('0x39')](_0x406fc3[_0xbe20('0x31')][_0xbe20('0x39')]);_0x3eb5f9[_0xbe20('0x3a')]=qs['filters'](_[_0xbe20('0x3b')](_0x406fc3['query'],_0xb60ef5[_0xbe20('0x32')]));if(_0x406fc3[_0xbe20('0x31')][_0xbe20('0x3c')]){_0x3eb5f9[_0xbe20('0x3a')]=_['merge'](_0x3eb5f9[_0xbe20('0x3a')],{'$or':_[_0xbe20('0x30')](_0x3eb5f9[_0xbe20('0x34')],function(_0x2418fe){var _0x5cfe1c={};_0x5cfe1c[_0x2418fe]={'$like':'%'+_0x406fc3[_0xbe20('0x31')][_0xbe20('0x3c')]+'%'};return _0x5cfe1c;})});}_0x3eb5f9=_[_0xbe20('0x3d')]({},_0x3eb5f9,_0x406fc3[_0xbe20('0x3f')]);return _0x49bd3d[_0xbe20('0x4d')](_0x3eb5f9);}})[_0xbe20('0x26')](function(_0x5cdeaf){if(_0x5cdeaf){_0x1f7383=_0x5cdeaf['length'];if(!_0x406fc3[_0xbe20('0x31')][_0xbe20('0x37')](_0xbe20('0x38'))){_0x3eb5f9[_0xbe20('0x1e')]=qs['limit'](_0x406fc3[_0xbe20('0x31')][_0xbe20('0x1e')]);_0x3eb5f9['offset']=qs[_0xbe20('0x1d')](_0x406fc3[_0xbe20('0x31')]['offset']);}return _0x49bd3d[_0xbe20('0x4d')](_0x3eb5f9);}})['then'](function(_0x57b5a7){if(_0x57b5a7){return _0x57b5a7?{'count':_0x1f7383,'rows':_0x57b5a7}:null;}})['then'](respondWithResult(_0x4eac2d,null))[_0xbe20('0x43')](handleError(_0x4eac2d,null));};exports[_0xbe20('0x4e')]=function(_0x1f764d,_0x443f70,_0x4a597f){var _0x232fb8={};var _0x3878f5={};var _0x2dc724;var _0x5cb3a8;return db[_0xbe20('0x2c')][_0xbe20('0x4a')]({'where':{'id':_0x1f764d[_0xbe20('0x4b')]['id']}})[_0xbe20('0x26')](handleEntityNotFound(_0x443f70,null))[_0xbe20('0x26')](function(_0x2bfa67){if(_0x2bfa67){_0x2dc724=_0x2bfa67;_0x3878f5[_0xbe20('0x2f')]=_[_0xbe20('0x46')](db[_0xbe20('0x4c')]['rawAttributes']);_0x3878f5[_0xbe20('0x31')]=_[_0xbe20('0x46')](_0x1f764d[_0xbe20('0x31')]);_0x3878f5[_0xbe20('0x32')]=_[_0xbe20('0x33')](_0x3878f5[_0xbe20('0x2f')],_0x3878f5[_0xbe20('0x31')]);_0x232fb8[_0xbe20('0x34')]=_['intersection'](_0x3878f5['model'],qs['fields'](_0x1f764d[_0xbe20('0x31')][_0xbe20('0x35')]));_0x232fb8[_0xbe20('0x34')]=_0x232fb8[_0xbe20('0x34')][_0xbe20('0x36')]?_0x232fb8[_0xbe20('0x34')]:_0x3878f5[_0xbe20('0x2f')];_0x232fb8[_0xbe20('0x4f')]=qs[_0xbe20('0x39')](_0x1f764d['query']['sort']);_0x232fb8[_0xbe20('0x3a')]=qs[_0xbe20('0x32')](_[_0xbe20('0x3b')](_0x1f764d[_0xbe20('0x31')],_0x3878f5['filters']));if(_0x1f764d[_0xbe20('0x31')]['filter']){_0x232fb8[_0xbe20('0x3a')]=_[_0xbe20('0x3d')](_0x232fb8[_0xbe20('0x3a')],{'$or':_['map'](_0x232fb8[_0xbe20('0x34')],function(_0x10a4a1){var _0x47bc39={};_0x47bc39[_0x10a4a1]={'$like':'%'+_0x1f764d[_0xbe20('0x31')][_0xbe20('0x3c')]+'%'};return _0x47bc39;})});}_0x232fb8=_['merge']({},_0x232fb8,_0x1f764d['options']);return _0x2dc724[_0xbe20('0x4e')](_0x232fb8);}})[_0xbe20('0x26')](function(_0x54c11b){if(_0x54c11b){_0x5cb3a8=_0x54c11b[_0xbe20('0x36')];if(!_0x1f764d[_0xbe20('0x31')]['hasOwnProperty'](_0xbe20('0x38'))){_0x232fb8[_0xbe20('0x1e')]=qs['limit'](_0x1f764d[_0xbe20('0x31')][_0xbe20('0x1e')]);_0x232fb8[_0xbe20('0x1d')]=qs['offset'](_0x1f764d[_0xbe20('0x31')]['offset']);}return _0x2dc724['getDescriptions'](_0x232fb8);}})[_0xbe20('0x26')](function(_0x30162d){if(_0x30162d){return _0x30162d?{'count':_0x5cb3a8,'rows':_0x30162d}:null;}})[_0xbe20('0x26')](respondWithResult(_0x443f70,null))[_0xbe20('0x43')](handleError(_0x443f70,null));};exports['getFields']=function(_0x3db7a7,_0x5931b0,_0x1ef342){var _0x56d949={};var _0x19569a={};var _0x4a1c9c;var _0xa44e40;return db[_0xbe20('0x2c')]['findOne']({'where':{'id':_0x3db7a7[_0xbe20('0x4b')]['id']}})[_0xbe20('0x26')](handleEntityNotFound(_0x5931b0,null))['then'](function(_0x4a18de){if(_0x4a18de){_0x4a1c9c=_0x4a18de;_0x19569a[_0xbe20('0x2f')]=_[_0xbe20('0x46')](db['FreshsalesField'][_0xbe20('0x45')]);_0x19569a[_0xbe20('0x31')]=_[_0xbe20('0x46')](_0x3db7a7[_0xbe20('0x31')]);_0x19569a[_0xbe20('0x32')]=_[_0xbe20('0x33')](_0x19569a[_0xbe20('0x2f')],_0x19569a['query']);_0x56d949[_0xbe20('0x34')]=_[_0xbe20('0x33')](_0x19569a[_0xbe20('0x2f')],qs[_0xbe20('0x35')](_0x3db7a7['query']['fields']));_0x56d949[_0xbe20('0x34')]=_0x56d949[_0xbe20('0x34')]['length']?_0x56d949['attributes']:_0x19569a[_0xbe20('0x2f')];_0x56d949['order']=qs[_0xbe20('0x39')](_0x3db7a7[_0xbe20('0x31')][_0xbe20('0x39')]);_0x56d949['where']=qs['filters'](_[_0xbe20('0x3b')](_0x3db7a7[_0xbe20('0x31')],_0x19569a[_0xbe20('0x32')]));if(_0x3db7a7[_0xbe20('0x31')][_0xbe20('0x3c')]){_0x56d949[_0xbe20('0x3a')]=_[_0xbe20('0x3d')](_0x56d949[_0xbe20('0x3a')],{'$or':_[_0xbe20('0x30')](_0x56d949[_0xbe20('0x34')],function(_0x3b8c4f){var _0x1039a5={};_0x1039a5[_0x3b8c4f]={'$like':'%'+_0x3db7a7[_0xbe20('0x31')][_0xbe20('0x3c')]+'%'};return _0x1039a5;})});}_0x56d949=_[_0xbe20('0x3d')]({},_0x56d949,_0x3db7a7[_0xbe20('0x3f')]);return _0x4a1c9c[_0xbe20('0x50')](_0x56d949);}})[_0xbe20('0x26')](function(_0x20e0c6){if(_0x20e0c6){_0xa44e40=_0x20e0c6[_0xbe20('0x36')];if(!_0x3db7a7['query'][_0xbe20('0x37')](_0xbe20('0x38'))){_0x56d949[_0xbe20('0x1e')]=qs[_0xbe20('0x1e')](_0x3db7a7[_0xbe20('0x31')][_0xbe20('0x1e')]);_0x56d949[_0xbe20('0x1d')]=qs[_0xbe20('0x1d')](_0x3db7a7['query']['offset']);}return _0x4a1c9c[_0xbe20('0x50')](_0x56d949);}})[_0xbe20('0x26')](function(_0x20ce1a){if(_0x20ce1a){return _0x20ce1a?{'count':_0xa44e40,'rows':_0x20ce1a}:null;}})[_0xbe20('0x26')](respondWithResult(_0x5931b0,null))[_0xbe20('0x43')](handleError(_0x5931b0,null));}; \ No newline at end of file +var _0x95e7=['set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','fields','include','find','create','body','update','getSubjects','FreshsalesField','getDescriptions','findOne','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count'];(function(_0x35b204,_0x513065){var _0x10edaa=function(_0x1edf4b){while(--_0x1edf4b){_0x35b204['push'](_0x35b204['shift']());}};_0x10edaa(++_0x513065);}(_0x95e7,0x16a));var _0x795e=function(_0x1a74fc,_0x5636c4){_0x1a74fc=_0x1a74fc-0x0;var _0x1b803e=_0x95e7[_0x1a74fc];return _0x1b803e;};'use strict';var emlformat=require(_0x795e('0x0'));var rimraf=require(_0x795e('0x1'));var zipdir=require(_0x795e('0x2'));var jsonpatch=require(_0x795e('0x3'));var rp=require(_0x795e('0x4'));var moment=require(_0x795e('0x5'));var BPromise=require(_0x795e('0x6'));var Mustache=require('mustache');var util=require(_0x795e('0x7'));var path=require('path');var sox=require(_0x795e('0x8'));var csv=require('to-csv');var ejs=require(_0x795e('0x9'));var fs=require('fs');var fs_extra=require(_0x795e('0xa'));var _=require('lodash');var squel=require(_0x795e('0xb'));var crypto=require('crypto');var jsforce=require(_0x795e('0xc'));var deskjs=require(_0x795e('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x795e('0xe'));var Redis=require(_0x795e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x795e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x795e('0x11'));var logger=require(_0x795e('0x12'))(_0x795e('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x795e('0x14'))['db'];function respondWithStatusCode(_0x4a9f1b,_0x349231){_0x349231=_0x349231||0xcc;return function(_0x44616b){if(_0x44616b){return _0x4a9f1b[_0x795e('0x15')](_0x349231);}return _0x4a9f1b[_0x795e('0x16')](_0x349231)[_0x795e('0x17')]();};}function respondWithResult(_0xd9e358,_0x2736e6){_0x2736e6=_0x2736e6||0xc8;return function(_0x2e2d8c){if(_0x2e2d8c){return _0xd9e358[_0x795e('0x16')](_0x2736e6)['json'](_0x2e2d8c);}};}function respondWithFilteredResult(_0x22143f,_0x51b905){return function(_0x25c7e8){if(_0x25c7e8){var _0x9547a=typeof _0x51b905[_0x795e('0x18')]===_0x795e('0x19')&&typeof _0x51b905[_0x795e('0x1a')]===_0x795e('0x19');var _0x17ec6e=_0x25c7e8[_0x795e('0x1b')];var _0x150ee1=_0x9547a?0x0:_0x51b905[_0x795e('0x18')];var _0x1489a4=_0x9547a?_0x25c7e8[_0x795e('0x1b')]:_0x51b905[_0x795e('0x18')]+_0x51b905[_0x795e('0x1a')];var _0x5578a9;if(_0x1489a4>=_0x17ec6e){_0x1489a4=_0x17ec6e;_0x5578a9=0xc8;}else{_0x5578a9=0xce;}_0x22143f[_0x795e('0x16')](_0x5578a9);return _0x22143f[_0x795e('0x1c')](_0x795e('0x1d'),_0x150ee1+'-'+_0x1489a4+'/'+_0x17ec6e)['json'](_0x25c7e8);}return null;};}function patchUpdates(_0x57faa9){return function(_0x5a0c19){try{jsonpatch['apply'](_0x5a0c19,_0x57faa9,!![]);}catch(_0x2a35d3){return BPromise[_0x795e('0x1e')](_0x2a35d3);}return _0x5a0c19[_0x795e('0x1f')]();};}function saveUpdates(_0x48edc9,_0x45b205){return function(_0x823dab){if(_0x823dab){return _0x823dab['update'](_0x48edc9)[_0x795e('0x20')](function(_0x504681){return _0x504681;});}return null;};}function removeEntity(_0x2d2416,_0x30413b){return function(_0x38e135){if(_0x38e135){return _0x38e135[_0x795e('0x21')]()[_0x795e('0x20')](function(){_0x2d2416[_0x795e('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f087e,_0x476288){return function(_0x5c54e3){if(!_0x5c54e3){_0x3f087e[_0x795e('0x15')](0x194);}return _0x5c54e3;};}function handleError(_0xdd99e9,_0x51bd99){_0x51bd99=_0x51bd99||0x1f4;return function(_0x591bb9){logger[_0x795e('0x22')](_0x591bb9[_0x795e('0x23')]);if(_0x591bb9[_0x795e('0x24')]){delete _0x591bb9['name'];}_0xdd99e9[_0x795e('0x16')](_0x51bd99)[_0x795e('0x25')](_0x591bb9);};}exports[_0x795e('0x26')]=function(_0x3d7615,_0x565271){var _0x4095bc={},_0x23c4dc={},_0x7e1290={'count':0x0,'rows':[]};var _0xf96f49=_[_0x795e('0x27')](db[_0x795e('0x28')][_0x795e('0x29')],function(_0x217e43){return{'name':_0x217e43[_0x795e('0x2a')],'type':_0x217e43[_0x795e('0x2b')][_0x795e('0x2c')]};});_0x23c4dc[_0x795e('0x2d')]=_[_0x795e('0x27')](_0xf96f49,_0x795e('0x24'));_0x23c4dc['query']=_[_0x795e('0x2e')](_0x3d7615[_0x795e('0x2f')]);_0x23c4dc[_0x795e('0x30')]=_[_0x795e('0x31')](_0x23c4dc[_0x795e('0x2d')],_0x23c4dc[_0x795e('0x2f')]);_0x4095bc['attributes']=_[_0x795e('0x31')](_0x23c4dc[_0x795e('0x2d')],qs['fields'](_0x3d7615['query']['fields']));_0x4095bc['attributes']=_0x4095bc[_0x795e('0x32')][_0x795e('0x33')]?_0x4095bc[_0x795e('0x32')]:_0x23c4dc['model'];if(!_0x3d7615['query'][_0x795e('0x34')](_0x795e('0x35'))){_0x4095bc[_0x795e('0x1a')]=qs[_0x795e('0x1a')](_0x3d7615[_0x795e('0x2f')][_0x795e('0x1a')]);_0x4095bc['offset']=qs[_0x795e('0x18')](_0x3d7615[_0x795e('0x2f')][_0x795e('0x18')]);}_0x4095bc[_0x795e('0x36')]=qs[_0x795e('0x37')](_0x3d7615[_0x795e('0x2f')]['sort']);_0x4095bc[_0x795e('0x38')]=qs[_0x795e('0x30')](_['pick'](_0x3d7615[_0x795e('0x2f')],_0x23c4dc[_0x795e('0x30')]),_0xf96f49);if(_0x3d7615[_0x795e('0x2f')][_0x795e('0x39')]){_0x4095bc[_0x795e('0x38')]=_[_0x795e('0x3a')](_0x4095bc[_0x795e('0x38')],{'$or':_[_0x795e('0x27')](_0xf96f49,function(_0x1f988a){if(_0x1f988a[_0x795e('0x2b')]!==_0x795e('0x3b')){var _0xc82811={};_0xc82811[_0x1f988a['name']]={'$like':'%'+_0x3d7615[_0x795e('0x2f')][_0x795e('0x39')]+'%'};return _0xc82811;}})});}_0x4095bc=_[_0x795e('0x3a')]({},_0x4095bc,_0x3d7615[_0x795e('0x3c')]);var _0x53e229={'where':_0x4095bc[_0x795e('0x38')]};return db['FreshsalesConfiguration'][_0x795e('0x1b')](_0x53e229)['then'](function(_0x2f2933){_0x7e1290['count']=_0x2f2933;if(_0x3d7615[_0x795e('0x2f')][_0x795e('0x3d')]){_0x4095bc['include']=[{'all':!![]}];}return db[_0x795e('0x28')][_0x795e('0x3e')](_0x4095bc);})[_0x795e('0x20')](function(_0x19edeb){_0x7e1290[_0x795e('0x3f')]=_0x19edeb;return _0x7e1290;})[_0x795e('0x20')](respondWithFilteredResult(_0x565271,_0x4095bc))[_0x795e('0x40')](handleError(_0x565271,null));};exports[_0x795e('0x41')]=function(_0x482d5a,_0x163e63){var _0x1f21d4={'raw':![],'where':{'id':_0x482d5a[_0x795e('0x42')]['id']}},_0x580085={};_0x580085['model']=_[_0x795e('0x2e')](db[_0x795e('0x28')][_0x795e('0x29')]);_0x580085[_0x795e('0x2f')]=_[_0x795e('0x2e')](_0x482d5a[_0x795e('0x2f')]);_0x580085[_0x795e('0x30')]=_[_0x795e('0x31')](_0x580085['model'],_0x580085['query']);_0x1f21d4[_0x795e('0x32')]=_['intersection'](_0x580085['model'],qs[_0x795e('0x43')](_0x482d5a[_0x795e('0x2f')][_0x795e('0x43')]));_0x1f21d4[_0x795e('0x32')]=_0x1f21d4[_0x795e('0x32')][_0x795e('0x33')]?_0x1f21d4['attributes']:_0x580085[_0x795e('0x2d')];if(_0x482d5a[_0x795e('0x2f')]['includeAll']){_0x1f21d4[_0x795e('0x44')]=[{'all':!![]}];}_0x1f21d4=_[_0x795e('0x3a')]({},_0x1f21d4,_0x482d5a[_0x795e('0x3c')]);return db[_0x795e('0x28')][_0x795e('0x45')](_0x1f21d4)[_0x795e('0x20')](handleEntityNotFound(_0x163e63,null))[_0x795e('0x20')](respondWithResult(_0x163e63,null))[_0x795e('0x40')](handleError(_0x163e63,null));};exports[_0x795e('0x46')]=function(_0x5909f5,_0x12e331){return db[_0x795e('0x28')][_0x795e('0x46')](_0x5909f5[_0x795e('0x47')],{})[_0x795e('0x20')](respondWithResult(_0x12e331,0xc9))['catch'](handleError(_0x12e331,null));};exports[_0x795e('0x48')]=function(_0x153290,_0x182fc7){if(_0x153290['body']['id']){delete _0x153290[_0x795e('0x47')]['id'];}return db['FreshsalesConfiguration'][_0x795e('0x45')]({'where':{'id':_0x153290[_0x795e('0x42')]['id']}})[_0x795e('0x20')](handleEntityNotFound(_0x182fc7,null))[_0x795e('0x20')](saveUpdates(_0x153290[_0x795e('0x47')],null))[_0x795e('0x20')](respondWithResult(_0x182fc7,null))['catch'](handleError(_0x182fc7,null));};exports[_0x795e('0x21')]=function(_0x2d5b8b,_0x4f58cf){return db['FreshsalesConfiguration']['find']({'where':{'id':_0x2d5b8b[_0x795e('0x42')]['id']}})[_0x795e('0x20')](handleEntityNotFound(_0x4f58cf,null))[_0x795e('0x20')](removeEntity(_0x4f58cf,null))[_0x795e('0x40')](handleError(_0x4f58cf,null));};exports[_0x795e('0x49')]=function(_0x5ec56c,_0x378907,_0x3d8893){var _0x23e04d={};var _0x4c3275={};var _0x5bf00a;var _0x1b8fd0;return db[_0x795e('0x28')]['findOne']({'where':{'id':_0x5ec56c[_0x795e('0x42')]['id']}})[_0x795e('0x20')](handleEntityNotFound(_0x378907,null))[_0x795e('0x20')](function(_0x4581f8){if(_0x4581f8){_0x5bf00a=_0x4581f8;_0x4c3275[_0x795e('0x2d')]=_[_0x795e('0x2e')](db[_0x795e('0x4a')][_0x795e('0x29')]);_0x4c3275[_0x795e('0x2f')]=_[_0x795e('0x2e')](_0x5ec56c[_0x795e('0x2f')]);_0x4c3275[_0x795e('0x30')]=_['intersection'](_0x4c3275[_0x795e('0x2d')],_0x4c3275[_0x795e('0x2f')]);_0x23e04d[_0x795e('0x32')]=_[_0x795e('0x31')](_0x4c3275[_0x795e('0x2d')],qs[_0x795e('0x43')](_0x5ec56c[_0x795e('0x2f')][_0x795e('0x43')]));_0x23e04d[_0x795e('0x32')]=_0x23e04d[_0x795e('0x32')][_0x795e('0x33')]?_0x23e04d['attributes']:_0x4c3275[_0x795e('0x2d')];_0x23e04d[_0x795e('0x36')]=qs[_0x795e('0x37')](_0x5ec56c[_0x795e('0x2f')]['sort']);_0x23e04d[_0x795e('0x38')]=qs['filters'](_['pick'](_0x5ec56c[_0x795e('0x2f')],_0x4c3275[_0x795e('0x30')]));if(_0x5ec56c['query'][_0x795e('0x39')]){_0x23e04d[_0x795e('0x38')]=_[_0x795e('0x3a')](_0x23e04d[_0x795e('0x38')],{'$or':_[_0x795e('0x27')](_0x23e04d[_0x795e('0x32')],function(_0x5a902f){var _0x21aaba={};_0x21aaba[_0x5a902f]={'$like':'%'+_0x5ec56c['query'][_0x795e('0x39')]+'%'};return _0x21aaba;})});}_0x23e04d=_[_0x795e('0x3a')]({},_0x23e04d,_0x5ec56c[_0x795e('0x3c')]);return _0x5bf00a[_0x795e('0x49')](_0x23e04d);}})['then'](function(_0x449040){if(_0x449040){_0x1b8fd0=_0x449040[_0x795e('0x33')];if(!_0x5ec56c[_0x795e('0x2f')][_0x795e('0x34')](_0x795e('0x35'))){_0x23e04d[_0x795e('0x1a')]=qs[_0x795e('0x1a')](_0x5ec56c[_0x795e('0x2f')][_0x795e('0x1a')]);_0x23e04d['offset']=qs['offset'](_0x5ec56c[_0x795e('0x2f')][_0x795e('0x18')]);}return _0x5bf00a[_0x795e('0x49')](_0x23e04d);}})[_0x795e('0x20')](function(_0x435a80){if(_0x435a80){return _0x435a80?{'count':_0x1b8fd0,'rows':_0x435a80}:null;}})[_0x795e('0x20')](respondWithResult(_0x378907,null))[_0x795e('0x40')](handleError(_0x378907,null));};exports[_0x795e('0x4b')]=function(_0xa5ea9e,_0x1cb79d,_0x4d3942){var _0x13bf54={};var _0x1f479c={};var _0x458f1e;var _0x58357;return db[_0x795e('0x28')][_0x795e('0x4c')]({'where':{'id':_0xa5ea9e['params']['id']}})[_0x795e('0x20')](handleEntityNotFound(_0x1cb79d,null))[_0x795e('0x20')](function(_0x576b2f){if(_0x576b2f){_0x458f1e=_0x576b2f;_0x1f479c[_0x795e('0x2d')]=_[_0x795e('0x2e')](db[_0x795e('0x4a')]['rawAttributes']);_0x1f479c[_0x795e('0x2f')]=_[_0x795e('0x2e')](_0xa5ea9e[_0x795e('0x2f')]);_0x1f479c['filters']=_[_0x795e('0x31')](_0x1f479c['model'],_0x1f479c['query']);_0x13bf54['attributes']=_[_0x795e('0x31')](_0x1f479c[_0x795e('0x2d')],qs['fields'](_0xa5ea9e[_0x795e('0x2f')]['fields']));_0x13bf54[_0x795e('0x32')]=_0x13bf54[_0x795e('0x32')][_0x795e('0x33')]?_0x13bf54[_0x795e('0x32')]:_0x1f479c[_0x795e('0x2d')];_0x13bf54[_0x795e('0x36')]=qs[_0x795e('0x37')](_0xa5ea9e[_0x795e('0x2f')]['sort']);_0x13bf54[_0x795e('0x38')]=qs[_0x795e('0x30')](_['pick'](_0xa5ea9e['query'],_0x1f479c[_0x795e('0x30')]));if(_0xa5ea9e[_0x795e('0x2f')][_0x795e('0x39')]){_0x13bf54[_0x795e('0x38')]=_[_0x795e('0x3a')](_0x13bf54[_0x795e('0x38')],{'$or':_[_0x795e('0x27')](_0x13bf54[_0x795e('0x32')],function(_0x2248fb){var _0x20978b={};_0x20978b[_0x2248fb]={'$like':'%'+_0xa5ea9e[_0x795e('0x2f')][_0x795e('0x39')]+'%'};return _0x20978b;})});}_0x13bf54=_[_0x795e('0x3a')]({},_0x13bf54,_0xa5ea9e[_0x795e('0x3c')]);return _0x458f1e['getDescriptions'](_0x13bf54);}})[_0x795e('0x20')](function(_0x4794b9){if(_0x4794b9){_0x58357=_0x4794b9[_0x795e('0x33')];if(!_0xa5ea9e[_0x795e('0x2f')][_0x795e('0x34')](_0x795e('0x35'))){_0x13bf54[_0x795e('0x1a')]=qs[_0x795e('0x1a')](_0xa5ea9e[_0x795e('0x2f')][_0x795e('0x1a')]);_0x13bf54[_0x795e('0x18')]=qs[_0x795e('0x18')](_0xa5ea9e['query'][_0x795e('0x18')]);}return _0x458f1e['getDescriptions'](_0x13bf54);}})[_0x795e('0x20')](function(_0x515e14){if(_0x515e14){return _0x515e14?{'count':_0x58357,'rows':_0x515e14}:null;}})[_0x795e('0x20')](respondWithResult(_0x1cb79d,null))[_0x795e('0x40')](handleError(_0x1cb79d,null));};exports[_0x795e('0x4d')]=function(_0x110570,_0x4c6133,_0x5e6ab2){var _0x33ba97={};var _0x42b217={};var _0x132c14;var _0x58f489;return db[_0x795e('0x28')][_0x795e('0x4c')]({'where':{'id':_0x110570[_0x795e('0x42')]['id']}})[_0x795e('0x20')](handleEntityNotFound(_0x4c6133,null))[_0x795e('0x20')](function(_0x34ed34){if(_0x34ed34){_0x132c14=_0x34ed34;_0x42b217[_0x795e('0x2d')]=_[_0x795e('0x2e')](db['FreshsalesField'][_0x795e('0x29')]);_0x42b217['query']=_[_0x795e('0x2e')](_0x110570[_0x795e('0x2f')]);_0x42b217[_0x795e('0x30')]=_['intersection'](_0x42b217[_0x795e('0x2d')],_0x42b217[_0x795e('0x2f')]);_0x33ba97[_0x795e('0x32')]=_['intersection'](_0x42b217['model'],qs[_0x795e('0x43')](_0x110570[_0x795e('0x2f')][_0x795e('0x43')]));_0x33ba97[_0x795e('0x32')]=_0x33ba97[_0x795e('0x32')][_0x795e('0x33')]?_0x33ba97[_0x795e('0x32')]:_0x42b217['model'];_0x33ba97['order']=qs[_0x795e('0x37')](_0x110570['query'][_0x795e('0x37')]);_0x33ba97[_0x795e('0x38')]=qs[_0x795e('0x30')](_['pick'](_0x110570['query'],_0x42b217[_0x795e('0x30')]));if(_0x110570[_0x795e('0x2f')][_0x795e('0x39')]){_0x33ba97['where']=_[_0x795e('0x3a')](_0x33ba97[_0x795e('0x38')],{'$or':_['map'](_0x33ba97['attributes'],function(_0x3182ad){var _0x5467f5={};_0x5467f5[_0x3182ad]={'$like':'%'+_0x110570[_0x795e('0x2f')]['filter']+'%'};return _0x5467f5;})});}_0x33ba97=_['merge']({},_0x33ba97,_0x110570[_0x795e('0x3c')]);return _0x132c14[_0x795e('0x4d')](_0x33ba97);}})[_0x795e('0x20')](function(_0x105b66){if(_0x105b66){_0x58f489=_0x105b66[_0x795e('0x33')];if(!_0x110570[_0x795e('0x2f')][_0x795e('0x34')](_0x795e('0x35'))){_0x33ba97[_0x795e('0x1a')]=qs[_0x795e('0x1a')](_0x110570[_0x795e('0x2f')][_0x795e('0x1a')]);_0x33ba97['offset']=qs[_0x795e('0x18')](_0x110570[_0x795e('0x2f')][_0x795e('0x18')]);}return _0x132c14[_0x795e('0x4d')](_0x33ba97);}})[_0x795e('0x20')](function(_0x1c07be){if(_0x1c07be){return _0x1c07be?{'count':_0x58f489,'rows':_0x1c07be}:null;}})['then'](respondWithResult(_0x4c6133,null))[_0x795e('0x40')](handleError(_0x4c6133,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 1b2f075..4131e2e 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 _0x3e99=['./intFreshsalesConfiguration.attributes','exports','FreshsalesConfiguration','api','request-promise','path','rimraf','../../config/environment'];(function(_0x8268ac,_0x23dbaf){var _0xe6f511=function(_0x3eb694){while(--_0x3eb694){_0x8268ac['push'](_0x8268ac['shift']());}};_0xe6f511(++_0x23dbaf);}(_0x3e99,0x173));var _0x93e9=function(_0x57dac3,_0x4ccdcb){_0x57dac3=_0x57dac3-0x0;var _0x261935=_0x3e99[_0x57dac3];return _0x261935;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x93e9('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x93e9('0x1'));var fs=require('fs');var path=require(_0x93e9('0x2'));var rimraf=require(_0x93e9('0x3'));var config=require(_0x93e9('0x4'));var attributes=require(_0x93e9('0x5'));module[_0x93e9('0x6')]=function(_0x44a48c,_0x3ee087){return _0x44a48c['define'](_0x93e9('0x7'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd9b4=['./intFreshsalesConfiguration.attributes','define','int_freshsales_configurations','lodash','util','bluebird','request-promise','rimraf'];(function(_0x4f08dd,_0x3784ec){var _0x3017ee=function(_0x7d95be){while(--_0x7d95be){_0x4f08dd['push'](_0x4f08dd['shift']());}};_0x3017ee(++_0x3784ec);}(_0xd9b4,0xdb));var _0x4d9b=function(_0x55bce0,_0x1597e1){_0x55bce0=_0x55bce0-0x0;var _0x4c7d3d=_0xd9b4[_0x55bce0];return _0x4c7d3d;};'use strict';var _=require(_0x4d9b('0x0'));var util=require(_0x4d9b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x4d9b('0x2'));var rp=require(_0x4d9b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4d9b('0x4'));var config=require('../../config/environment');var attributes=require(_0x4d9b('0x5'));module['exports']=function(_0x5a9291,_0x58b968){return _0x5a9291[_0x4d9b('0x6')]('FreshsalesConfiguration',attributes,{'tableName':_0x4d9b('0x7'),'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 dfd7e01..48ae5e3 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 _0xdccf=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x23fd3c,_0x46d138){var _0x1cd0d1=function(_0x55091c){while(--_0x55091c){_0x23fd3c['push'](_0x23fd3c['shift']());}};_0x1cd0d1(++_0x46d138);}(_0xdccf,0x1ef));var _0xfdcc=function(_0x54a976,_0x43fe81){_0x54a976=_0x54a976-0x0;var _0x5ebd06=_0xdccf[_0x54a976];return _0x5ebd06;};'use strict';var _=require(_0xfdcc('0x0'));var util=require(_0xfdcc('0x1'));var moment=require(_0xfdcc('0x2'));var BPromise=require(_0xfdcc('0x3'));var rs=require(_0xfdcc('0x4'));var fs=require('fs');var Redis=require(_0xfdcc('0x5'));var db=require(_0xfdcc('0x6'))['db'];var utils=require(_0xfdcc('0x7'));var logger=require(_0xfdcc('0x8'))(_0xfdcc('0x9'));var config=require(_0xfdcc('0xa'));var jayson=require(_0xfdcc('0xb'));var client=jayson['client'][_0xfdcc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5b1dc4,_0x323bdd,_0x3b16bb){return new BPromise(function(_0x14e3e5,_0x2008bc){return client[_0xfdcc('0xd')](_0x5b1dc4,_0x3b16bb)[_0xfdcc('0xe')](function(_0x572909){logger[_0xfdcc('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x323bdd,_0xfdcc('0x10'));logger[_0xfdcc('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x323bdd,_0xfdcc('0x10'),JSON[_0xfdcc('0x12')](_0x572909));if(_0x572909[_0xfdcc('0x13')]){if(_0x572909[_0xfdcc('0x13')][_0xfdcc('0x14')]===0x1f4){logger[_0xfdcc('0x13')](_0xfdcc('0x15'),_0x323bdd,_0x572909[_0xfdcc('0x13')][_0xfdcc('0x16')]);return _0x2008bc(_0x572909['error']['message']);}logger[_0xfdcc('0x13')](_0xfdcc('0x15'),_0x323bdd,_0x572909[_0xfdcc('0x13')][_0xfdcc('0x16')]);return _0x14e3e5(_0x572909[_0xfdcc('0x13')][_0xfdcc('0x16')]);}else{logger[_0xfdcc('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x323bdd,'request\x20sent');_0x14e3e5(_0x572909[_0xfdcc('0x17')][_0xfdcc('0x16')]);}})[_0xfdcc('0x18')](function(_0x338087){logger[_0xfdcc('0x13')](_0xfdcc('0x15'),_0x323bdd,_0x338087);_0x2008bc(_0x338087);});});} \ No newline at end of file +var _0xf97c=['http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x4fa665,_0x1ae12a){var _0x62ccff=function(_0x4f0bb8){while(--_0x4f0bb8){_0x4fa665['push'](_0x4fa665['shift']());}};_0x62ccff(++_0x1ae12a);}(_0xf97c,0x174));var _0xcf97=function(_0x3a87d1,_0x584e71){_0x3a87d1=_0x3a87d1-0x0;var _0x3aa6d8=_0xf97c[_0x3a87d1];return _0x3aa6d8;};'use strict';var _=require(_0xcf97('0x0'));var util=require(_0xcf97('0x1'));var moment=require(_0xcf97('0x2'));var BPromise=require(_0xcf97('0x3'));var rs=require(_0xcf97('0x4'));var fs=require('fs');var Redis=require(_0xcf97('0x5'));var db=require(_0xcf97('0x6'))['db'];var utils=require(_0xcf97('0x7'));var logger=require('../../config/logger')(_0xcf97('0x8'));var config=require(_0xcf97('0x9'));var jayson=require(_0xcf97('0xa'));var client=jayson[_0xcf97('0xb')][_0xcf97('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5d11e3,_0xd93b9c,_0x25c307){return new BPromise(function(_0x53c3e0,_0x179993){return client['request'](_0x5d11e3,_0x25c307)[_0xcf97('0xd')](function(_0x4bec22){logger[_0xcf97('0xe')](_0xcf97('0xf'),_0xd93b9c,_0xcf97('0x10'));logger[_0xcf97('0x11')](_0xcf97('0x12'),_0xd93b9c,_0xcf97('0x10'),JSON[_0xcf97('0x13')](_0x4bec22));if(_0x4bec22[_0xcf97('0x14')]){if(_0x4bec22[_0xcf97('0x14')]['code']===0x1f4){logger['error'](_0xcf97('0xf'),_0xd93b9c,_0x4bec22[_0xcf97('0x14')][_0xcf97('0x15')]);return _0x179993(_0x4bec22['error'][_0xcf97('0x15')]);}logger[_0xcf97('0x14')](_0xcf97('0xf'),_0xd93b9c,_0x4bec22[_0xcf97('0x14')]['message']);return _0x53c3e0(_0x4bec22[_0xcf97('0x14')]['message']);}else{logger[_0xcf97('0xe')](_0xcf97('0xf'),_0xd93b9c,_0xcf97('0x10'));_0x53c3e0(_0x4bec22[_0xcf97('0x16')][_0xcf97('0x15')]);}})[_0xcf97('0x17')](function(_0x4620ac){logger[_0xcf97('0x14')](_0xcf97('0xf'),_0xd93b9c,_0x4620ac);_0x179993(_0x4620ac);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index c4f5001..4e67351 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 _0x303a=['get','isAuthenticated','index','/:id','create','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller'];(function(_0xe5b349,_0x5f06e4){var _0x26b0ad=function(_0x1a97f1){while(--_0x1a97f1){_0xe5b349['push'](_0xe5b349['shift']());}};_0x26b0ad(++_0x5f06e4);}(_0x303a,0x1a0));var _0xa303=function(_0x5e8c0f,_0x1f20d9){_0x5e8c0f=_0x5e8c0f-0x0;var _0x568dbe=_0x303a[_0x5e8c0f];return _0x568dbe;};'use strict';var multer=require(_0xa303('0x0'));var util=require('util');var path=require(_0xa303('0x1'));var timeout=require(_0xa303('0x2'));var express=require(_0xa303('0x3'));var router=express[_0xa303('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa303('0x5'));var interaction=require(_0xa303('0x6'));var config=require(_0xa303('0x7'));var controller=require(_0xa303('0x8'));router[_0xa303('0x9')]('/',auth[_0xa303('0xa')](),controller[_0xa303('0xb')]);router[_0xa303('0x9')](_0xa303('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xa303('0xa')](),controller[_0xa303('0xd')]);router['put'](_0xa303('0xc'),auth['isAuthenticated'](),controller[_0xa303('0xe')]);router['delete'](_0xa303('0xc'),auth[_0xa303('0xa')](),controller[_0xa303('0xf')]);module[_0xa303('0x10')]=router; \ No newline at end of file +var _0xb49a=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','post','create','put','delete','destroy','exports','multer'];(function(_0x1b6563,_0x3bf0f1){var _0xdea7b8=function(_0x49e6c6){while(--_0x49e6c6){_0x1b6563['push'](_0x1b6563['shift']());}};_0xdea7b8(++_0x3bf0f1);}(_0xb49a,0xfb));var _0xab49=function(_0x23da4d,_0x63498c){_0x23da4d=_0x23da4d-0x0;var _0x4ae55=_0xb49a[_0x23da4d];return _0x4ae55;};'use strict';var multer=require(_0xab49('0x0'));var util=require(_0xab49('0x1'));var path=require(_0xab49('0x2'));var timeout=require(_0xab49('0x3'));var express=require(_0xab49('0x4'));var router=express['Router']();var fs_extra=require(_0xab49('0x5'));var auth=require(_0xab49('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xab49('0x7'));router[_0xab49('0x8')]('/',auth[_0xab49('0x9')](),controller[_0xab49('0xa')]);router[_0xab49('0x8')](_0xab49('0xb'),auth[_0xab49('0x9')](),controller['show']);router[_0xab49('0xc')]('/',auth[_0xab49('0x9')](),controller[_0xab49('0xd')]);router[_0xab49('0xe')](_0xab49('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xab49('0xf')](_0xab49('0xb'),auth[_0xab49('0x9')](),controller[_0xab49('0x10')]);module[_0xab49('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 8d5603e..c7ef47e 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 _0xda62=['exports','ENUM','string','customVariable','keyValue','picklist','STRING','sequelize'];(function(_0x1ebaae,_0x270f11){var _0x53b153=function(_0x138c71){while(--_0x138c71){_0x1ebaae['push'](_0x1ebaae['shift']());}};_0x53b153(++_0x270f11);}(_0xda62,0x1cf));var _0x2da6=function(_0x54fdbd,_0x1d3ed9){_0x54fdbd=_0x54fdbd-0x0;var _0x33f4b2=_0xda62[_0x54fdbd];return _0x33f4b2;};'use strict';var Sequelize=require(_0x2da6('0x0'));module[_0x2da6('0x1')]={'type':{'type':Sequelize[_0x2da6('0x2')](_0x2da6('0x3'),'variable',_0x2da6('0x4'),_0x2da6('0x5'),_0x2da6('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x2da6('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x2da6('0x2')](_0x2da6('0x3'),'variable',_0x2da6('0x4'))},'keyContent':{'type':Sequelize[_0x2da6('0x7')]},'idField':{'type':Sequelize[_0x2da6('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2da6('0x7')]}}; \ No newline at end of file +var _0xb023=['string','variable','customVariable','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x1486e5,_0x39684f){var _0x29d89b=function(_0x4a0a80){while(--_0x4a0a80){_0x1486e5['push'](_0x1486e5['shift']());}};_0x29d89b(++_0x39684f);}(_0xb023,0x1da));var _0x3b02=function(_0x4aac5a,_0x15b04c){_0x4aac5a=_0x4aac5a-0x0;var _0x42e7bc=_0xb023[_0x4aac5a];return _0x42e7bc;};'use strict';var Sequelize=require(_0x3b02('0x0'));module[_0x3b02('0x1')]={'type':{'type':Sequelize[_0x3b02('0x2')](_0x3b02('0x3'),_0x3b02('0x4'),_0x3b02('0x5'),'keyValue',_0x3b02('0x6')),'defaultValue':_0x3b02('0x3')},'content':{'type':Sequelize[_0x3b02('0x7')]},'key':{'type':Sequelize[_0x3b02('0x7')]},'keyType':{'type':Sequelize[_0x3b02('0x2')]('string',_0x3b02('0x4'),_0x3b02('0x5'))},'keyContent':{'type':Sequelize[_0x3b02('0x7')]},'idField':{'type':Sequelize[_0x3b02('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x3b02('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3b02('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index e95af3e..7a4a057 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 _0x4f10=['lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','count','set','Content-Range','json','reject','save','then','destroy','sendStatus','error','stack','send','FreshsalesField','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','merge','name','filter','options','includeAll','rows','catch','include','find','create','body','update','params','rimraf','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra'];(function(_0x5999b,_0x2320a4){var _0xe0e65d=function(_0x30bf5d){while(--_0x30bf5d){_0x5999b['push'](_0x5999b['shift']());}};_0xe0e65d(++_0x2320a4);}(_0x4f10,0x1da));var _0x04f1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4f10[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x04f1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x04f1('0x1'));var rp=require(_0x04f1('0x2'));var moment=require(_0x04f1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x04f1('0x4'));var util=require(_0x04f1('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x04f1('0x6'));var ejs=require(_0x04f1('0x7'));var fs=require('fs');var fs_extra=require(_0x04f1('0x8'));var _=require(_0x04f1('0x9'));var squel=require(_0x04f1('0xa'));var crypto=require(_0x04f1('0xb'));var jsforce=require(_0x04f1('0xc'));var deskjs=require(_0x04f1('0xd'));var toCsv=require(_0x04f1('0x6'));var querystring=require(_0x04f1('0xe'));var Papa=require('papaparse');var Redis=require(_0x04f1('0xf'));var authService=require(_0x04f1('0x10'));var qs=require(_0x04f1('0x11'));var as=require(_0x04f1('0x12'));var hardwareService=require(_0x04f1('0x13'));var logger=require(_0x04f1('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x04f1('0x15'));var licenseUtil=require(_0x04f1('0x16'));var db=require(_0x04f1('0x17'))['db'];function respondWithStatusCode(_0xa6444b,_0x4be133){_0x4be133=_0x4be133||0xcc;return function(_0x5857e9){if(_0x5857e9){return _0xa6444b['sendStatus'](_0x4be133);}return _0xa6444b[_0x04f1('0x18')](_0x4be133)[_0x04f1('0x19')]();};}function respondWithResult(_0x19ffed,_0x149744){_0x149744=_0x149744||0xc8;return function(_0x86809f){if(_0x86809f){return _0x19ffed[_0x04f1('0x18')](_0x149744)['json'](_0x86809f);}};}function respondWithFilteredResult(_0x2c70b7,_0x4c4752){return function(_0x2d26f8){if(_0x2d26f8){var _0x5d239b=typeof _0x4c4752[_0x04f1('0x1a')]==='undefined'&&typeof _0x4c4752['limit']==='undefined';var _0x5547aa=_0x2d26f8[_0x04f1('0x1b')];var _0x3b884d=_0x5d239b?0x0:_0x4c4752['offset'];var _0x5d3163=_0x5d239b?_0x2d26f8[_0x04f1('0x1b')]:_0x4c4752[_0x04f1('0x1a')]+_0x4c4752['limit'];var _0x4d82c1;if(_0x5d3163>=_0x5547aa){_0x5d3163=_0x5547aa;_0x4d82c1=0xc8;}else{_0x4d82c1=0xce;}_0x2c70b7['status'](_0x4d82c1);return _0x2c70b7[_0x04f1('0x1c')](_0x04f1('0x1d'),_0x3b884d+'-'+_0x5d3163+'/'+_0x5547aa)[_0x04f1('0x1e')](_0x2d26f8);}return null;};}function patchUpdates(_0x2fe0cd){return function(_0x4e8f0b){try{jsonpatch['apply'](_0x4e8f0b,_0x2fe0cd,!![]);}catch(_0x3f87b5){return BPromise[_0x04f1('0x1f')](_0x3f87b5);}return _0x4e8f0b[_0x04f1('0x20')]();};}function saveUpdates(_0x3a5929,_0x1bd6fc){return function(_0x37819d){if(_0x37819d){return _0x37819d['update'](_0x3a5929)[_0x04f1('0x21')](function(_0x40d93d){return _0x40d93d;});}return null;};}function removeEntity(_0x411c1f,_0xa35105){return function(_0x1ba50e){if(_0x1ba50e){return _0x1ba50e[_0x04f1('0x22')]()[_0x04f1('0x21')](function(){_0x411c1f[_0x04f1('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26ddea,_0x5e87e5){return function(_0x1b4442){if(!_0x1b4442){_0x26ddea[_0x04f1('0x23')](0x194);}return _0x1b4442;};}function handleError(_0x49efa2,_0x1d22f1){_0x1d22f1=_0x1d22f1||0x1f4;return function(_0x819a74){logger[_0x04f1('0x24')](_0x819a74[_0x04f1('0x25')]);if(_0x819a74['name']){delete _0x819a74['name'];}_0x49efa2['status'](_0x1d22f1)[_0x04f1('0x26')](_0x819a74);};}exports['index']=function(_0x3ce8eb,_0x149bc1){var _0x2dc57e={},_0x169fec={},_0x1ce966={'count':0x0,'rows':[]};var _0x3a393a=_['map'](db[_0x04f1('0x27')]['rawAttributes'],function(_0x2931e3){return{'name':_0x2931e3[_0x04f1('0x28')],'type':_0x2931e3[_0x04f1('0x29')]['key']};});_0x169fec[_0x04f1('0x2a')]=_[_0x04f1('0x2b')](_0x3a393a,'name');_0x169fec[_0x04f1('0x2c')]=_[_0x04f1('0x2d')](_0x3ce8eb['query']);_0x169fec[_0x04f1('0x2e')]=_[_0x04f1('0x2f')](_0x169fec[_0x04f1('0x2a')],_0x169fec[_0x04f1('0x2c')]);_0x2dc57e[_0x04f1('0x30')]=_[_0x04f1('0x2f')](_0x169fec['model'],qs[_0x04f1('0x31')](_0x3ce8eb[_0x04f1('0x2c')]['fields']));_0x2dc57e[_0x04f1('0x30')]=_0x2dc57e['attributes'][_0x04f1('0x32')]?_0x2dc57e[_0x04f1('0x30')]:_0x169fec[_0x04f1('0x2a')];if(!_0x3ce8eb['query'][_0x04f1('0x33')]('nolimit')){_0x2dc57e[_0x04f1('0x34')]=qs['limit'](_0x3ce8eb[_0x04f1('0x2c')]['limit']);_0x2dc57e[_0x04f1('0x1a')]=qs[_0x04f1('0x1a')](_0x3ce8eb[_0x04f1('0x2c')][_0x04f1('0x1a')]);}_0x2dc57e['order']=qs[_0x04f1('0x35')](_0x3ce8eb[_0x04f1('0x2c')]['sort']);_0x2dc57e[_0x04f1('0x36')]=qs[_0x04f1('0x2e')](_[_0x04f1('0x37')](_0x3ce8eb[_0x04f1('0x2c')],_0x169fec[_0x04f1('0x2e')]),_0x3a393a);if(_0x3ce8eb[_0x04f1('0x2c')]['filter']){_0x2dc57e[_0x04f1('0x36')]=_[_0x04f1('0x38')](_0x2dc57e[_0x04f1('0x36')],{'$or':_[_0x04f1('0x2b')](_0x3a393a,function(_0x3b7abd){if(_0x3b7abd[_0x04f1('0x29')]!=='VIRTUAL'){var _0x3bd2e1={};_0x3bd2e1[_0x3b7abd[_0x04f1('0x39')]]={'$like':'%'+_0x3ce8eb['query'][_0x04f1('0x3a')]+'%'};return _0x3bd2e1;}})});}_0x2dc57e=_[_0x04f1('0x38')]({},_0x2dc57e,_0x3ce8eb[_0x04f1('0x3b')]);var _0x44f0a5={'where':_0x2dc57e[_0x04f1('0x36')]};return db[_0x04f1('0x27')][_0x04f1('0x1b')](_0x44f0a5)['then'](function(_0x4643f0){_0x1ce966[_0x04f1('0x1b')]=_0x4643f0;if(_0x3ce8eb[_0x04f1('0x2c')][_0x04f1('0x3c')]){_0x2dc57e['include']=[{'all':!![]}];}return db[_0x04f1('0x27')]['findAll'](_0x2dc57e);})[_0x04f1('0x21')](function(_0x22bb91){_0x1ce966[_0x04f1('0x3d')]=_0x22bb91;return _0x1ce966;})[_0x04f1('0x21')](respondWithFilteredResult(_0x149bc1,_0x2dc57e))[_0x04f1('0x3e')](handleError(_0x149bc1,null));};exports['show']=function(_0x30cd54,_0x56c300){var _0x146d8f={'raw':!![],'where':{'id':_0x30cd54['params']['id']}},_0x1189ef={};_0x1189ef[_0x04f1('0x2a')]=_[_0x04f1('0x2d')](db[_0x04f1('0x27')]['rawAttributes']);_0x1189ef[_0x04f1('0x2c')]=_['keys'](_0x30cd54[_0x04f1('0x2c')]);_0x1189ef[_0x04f1('0x2e')]=_[_0x04f1('0x2f')](_0x1189ef[_0x04f1('0x2a')],_0x1189ef[_0x04f1('0x2c')]);_0x146d8f[_0x04f1('0x30')]=_[_0x04f1('0x2f')](_0x1189ef[_0x04f1('0x2a')],qs[_0x04f1('0x31')](_0x30cd54[_0x04f1('0x2c')][_0x04f1('0x31')]));_0x146d8f[_0x04f1('0x30')]=_0x146d8f[_0x04f1('0x30')]['length']?_0x146d8f[_0x04f1('0x30')]:_0x1189ef[_0x04f1('0x2a')];if(_0x30cd54[_0x04f1('0x2c')][_0x04f1('0x3c')]){_0x146d8f[_0x04f1('0x3f')]=[{'all':!![]}];}_0x146d8f=_[_0x04f1('0x38')]({},_0x146d8f,_0x30cd54[_0x04f1('0x3b')]);return db['FreshsalesField'][_0x04f1('0x40')](_0x146d8f)[_0x04f1('0x21')](handleEntityNotFound(_0x56c300,null))[_0x04f1('0x21')](respondWithResult(_0x56c300,null))[_0x04f1('0x3e')](handleError(_0x56c300,null));};exports[_0x04f1('0x41')]=function(_0x28d30b,_0x344cb0){return db[_0x04f1('0x27')][_0x04f1('0x41')](_0x28d30b[_0x04f1('0x42')],{})[_0x04f1('0x21')](respondWithResult(_0x344cb0,0xc9))['catch'](handleError(_0x344cb0,null));};exports[_0x04f1('0x43')]=function(_0x4d7069,_0x135534){if(_0x4d7069[_0x04f1('0x42')]['id']){delete _0x4d7069[_0x04f1('0x42')]['id'];}return db[_0x04f1('0x27')][_0x04f1('0x40')]({'where':{'id':_0x4d7069[_0x04f1('0x44')]['id']}})[_0x04f1('0x21')](handleEntityNotFound(_0x135534,null))['then'](saveUpdates(_0x4d7069['body'],null))[_0x04f1('0x21')](respondWithResult(_0x135534,null))[_0x04f1('0x3e')](handleError(_0x135534,null));};exports[_0x04f1('0x22')]=function(_0x4067ea,_0x1e1359){return db[_0x04f1('0x27')][_0x04f1('0x40')]({'where':{'id':_0x4067ea['params']['id']}})[_0x04f1('0x21')](handleEntityNotFound(_0x1e1359,null))[_0x04f1('0x21')](removeEntity(_0x1e1359,null))['catch'](handleError(_0x1e1359,null));}; \ No newline at end of file +var _0xc27e=['send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','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','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','name'];(function(_0x23b437,_0x922004){var _0x1ea45d=function(_0x499cf1){while(--_0x499cf1){_0x23b437['push'](_0x23b437['shift']());}};_0x1ea45d(++_0x922004);}(_0xc27e,0x110));var _0xec27=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc27e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xec27('0x0'));var rimraf=require(_0xec27('0x1'));var zipdir=require(_0xec27('0x2'));var jsonpatch=require(_0xec27('0x3'));var rp=require(_0xec27('0x4'));var moment=require(_0xec27('0x5'));var BPromise=require(_0xec27('0x6'));var Mustache=require(_0xec27('0x7'));var util=require('util');var path=require(_0xec27('0x8'));var sox=require(_0xec27('0x9'));var csv=require(_0xec27('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xec27('0xb'));var squel=require('squel');var crypto=require(_0xec27('0xc'));var jsforce=require(_0xec27('0xd'));var deskjs=require(_0xec27('0xe'));var toCsv=require(_0xec27('0xa'));var querystring=require(_0xec27('0xf'));var Papa=require(_0xec27('0x10'));var Redis=require('ioredis');var authService=require(_0xec27('0x11'));var qs=require(_0xec27('0x12'));var as=require(_0xec27('0x13'));var hardwareService=require(_0xec27('0x14'));var logger=require(_0xec27('0x15'))(_0xec27('0x16'));var utils=require(_0xec27('0x17'));var config=require(_0xec27('0x18'));var licenseUtil=require(_0xec27('0x19'));var db=require(_0xec27('0x1a'))['db'];function respondWithStatusCode(_0x135290,_0x46294e){_0x46294e=_0x46294e||0xcc;return function(_0x1b5572){if(_0x1b5572){return _0x135290['sendStatus'](_0x46294e);}return _0x135290[_0xec27('0x1b')](_0x46294e)[_0xec27('0x1c')]();};}function respondWithResult(_0x45f826,_0x2712fc){_0x2712fc=_0x2712fc||0xc8;return function(_0x9109f7){if(_0x9109f7){return _0x45f826['status'](_0x2712fc)[_0xec27('0x1d')](_0x9109f7);}};}function respondWithFilteredResult(_0x2ea224,_0x1c10dc){return function(_0x23ec2a){if(_0x23ec2a){var _0x36f54a=typeof _0x1c10dc[_0xec27('0x1e')]==='undefined'&&typeof _0x1c10dc[_0xec27('0x1f')]===_0xec27('0x20');var _0x262d6e=_0x23ec2a[_0xec27('0x21')];var _0x45731d=_0x36f54a?0x0:_0x1c10dc[_0xec27('0x1e')];var _0x4ea29c=_0x36f54a?_0x23ec2a[_0xec27('0x21')]:_0x1c10dc[_0xec27('0x1e')]+_0x1c10dc['limit'];var _0x539cbf;if(_0x4ea29c>=_0x262d6e){_0x4ea29c=_0x262d6e;_0x539cbf=0xc8;}else{_0x539cbf=0xce;}_0x2ea224[_0xec27('0x1b')](_0x539cbf);return _0x2ea224[_0xec27('0x22')](_0xec27('0x23'),_0x45731d+'-'+_0x4ea29c+'/'+_0x262d6e)[_0xec27('0x1d')](_0x23ec2a);}return null;};}function patchUpdates(_0x4423d3){return function(_0x474f44){try{jsonpatch[_0xec27('0x24')](_0x474f44,_0x4423d3,!![]);}catch(_0x22a8e1){return BPromise[_0xec27('0x25')](_0x22a8e1);}return _0x474f44[_0xec27('0x26')]();};}function saveUpdates(_0x399333,_0x2d040d){return function(_0x540895){if(_0x540895){return _0x540895[_0xec27('0x27')](_0x399333)[_0xec27('0x28')](function(_0x5542fc){return _0x5542fc;});}return null;};}function removeEntity(_0xf08122,_0x3e3ddd){return function(_0x3a5dab){if(_0x3a5dab){return _0x3a5dab[_0xec27('0x29')]()[_0xec27('0x28')](function(){_0xf08122['status'](0xcc)[_0xec27('0x1c')]();});}};}function handleEntityNotFound(_0x1cb3f5,_0x4cd4f3){return function(_0x30b0e6){if(!_0x30b0e6){_0x1cb3f5[_0xec27('0x2a')](0x194);}return _0x30b0e6;};}function handleError(_0x333790,_0x11875a){_0x11875a=_0x11875a||0x1f4;return function(_0x2c000f){logger['error'](_0x2c000f['stack']);if(_0x2c000f[_0xec27('0x2b')]){delete _0x2c000f[_0xec27('0x2b')];}_0x333790[_0xec27('0x1b')](_0x11875a)[_0xec27('0x2c')](_0x2c000f);};}exports[_0xec27('0x2d')]=function(_0x1cac3d,_0x1bff2b){var _0x4a9556={},_0xe50bd3={},_0x16b470={'count':0x0,'rows':[]};var _0x5c1441=_[_0xec27('0x2e')](db[_0xec27('0x2f')][_0xec27('0x30')],function(_0x1685ff){return{'name':_0x1685ff[_0xec27('0x31')],'type':_0x1685ff[_0xec27('0x32')][_0xec27('0x33')]};});_0xe50bd3[_0xec27('0x34')]=_[_0xec27('0x2e')](_0x5c1441,'name');_0xe50bd3[_0xec27('0x35')]=_[_0xec27('0x36')](_0x1cac3d[_0xec27('0x35')]);_0xe50bd3[_0xec27('0x37')]=_[_0xec27('0x38')](_0xe50bd3[_0xec27('0x34')],_0xe50bd3[_0xec27('0x35')]);_0x4a9556[_0xec27('0x39')]=_[_0xec27('0x38')](_0xe50bd3[_0xec27('0x34')],qs['fields'](_0x1cac3d[_0xec27('0x35')][_0xec27('0x3a')]));_0x4a9556['attributes']=_0x4a9556['attributes'][_0xec27('0x3b')]?_0x4a9556['attributes']:_0xe50bd3[_0xec27('0x34')];if(!_0x1cac3d['query'][_0xec27('0x3c')](_0xec27('0x3d'))){_0x4a9556[_0xec27('0x1f')]=qs[_0xec27('0x1f')](_0x1cac3d[_0xec27('0x35')]['limit']);_0x4a9556[_0xec27('0x1e')]=qs[_0xec27('0x1e')](_0x1cac3d[_0xec27('0x35')][_0xec27('0x1e')]);}_0x4a9556[_0xec27('0x3e')]=qs['sort'](_0x1cac3d[_0xec27('0x35')]['sort']);_0x4a9556[_0xec27('0x3f')]=qs[_0xec27('0x37')](_[_0xec27('0x40')](_0x1cac3d[_0xec27('0x35')],_0xe50bd3[_0xec27('0x37')]),_0x5c1441);if(_0x1cac3d[_0xec27('0x35')][_0xec27('0x41')]){_0x4a9556[_0xec27('0x3f')]=_[_0xec27('0x42')](_0x4a9556['where'],{'$or':_[_0xec27('0x2e')](_0x5c1441,function(_0x129d81){if(_0x129d81[_0xec27('0x32')]!==_0xec27('0x43')){var _0x1f317b={};_0x1f317b[_0x129d81[_0xec27('0x2b')]]={'$like':'%'+_0x1cac3d[_0xec27('0x35')][_0xec27('0x41')]+'%'};return _0x1f317b;}})});}_0x4a9556=_[_0xec27('0x42')]({},_0x4a9556,_0x1cac3d[_0xec27('0x44')]);var _0x2572a6={'where':_0x4a9556[_0xec27('0x3f')]};return db['FreshsalesField'][_0xec27('0x21')](_0x2572a6)[_0xec27('0x28')](function(_0x5eacc5){_0x16b470[_0xec27('0x21')]=_0x5eacc5;if(_0x1cac3d[_0xec27('0x35')][_0xec27('0x45')]){_0x4a9556[_0xec27('0x46')]=[{'all':!![]}];}return db[_0xec27('0x2f')][_0xec27('0x47')](_0x4a9556);})[_0xec27('0x28')](function(_0x471f76){_0x16b470[_0xec27('0x48')]=_0x471f76;return _0x16b470;})[_0xec27('0x28')](respondWithFilteredResult(_0x1bff2b,_0x4a9556))[_0xec27('0x49')](handleError(_0x1bff2b,null));};exports[_0xec27('0x4a')]=function(_0x4a5034,_0x1dac9d){var _0x4b6e54={'raw':!![],'where':{'id':_0x4a5034[_0xec27('0x4b')]['id']}},_0x510439={};_0x510439[_0xec27('0x34')]=_[_0xec27('0x36')](db[_0xec27('0x2f')][_0xec27('0x30')]);_0x510439[_0xec27('0x35')]=_['keys'](_0x4a5034[_0xec27('0x35')]);_0x510439[_0xec27('0x37')]=_[_0xec27('0x38')](_0x510439[_0xec27('0x34')],_0x510439['query']);_0x4b6e54[_0xec27('0x39')]=_[_0xec27('0x38')](_0x510439[_0xec27('0x34')],qs[_0xec27('0x3a')](_0x4a5034['query']['fields']));_0x4b6e54[_0xec27('0x39')]=_0x4b6e54[_0xec27('0x39')][_0xec27('0x3b')]?_0x4b6e54['attributes']:_0x510439[_0xec27('0x34')];if(_0x4a5034[_0xec27('0x35')][_0xec27('0x45')]){_0x4b6e54[_0xec27('0x46')]=[{'all':!![]}];}_0x4b6e54=_['merge']({},_0x4b6e54,_0x4a5034['options']);return db[_0xec27('0x2f')][_0xec27('0x4c')](_0x4b6e54)[_0xec27('0x28')](handleEntityNotFound(_0x1dac9d,null))[_0xec27('0x28')](respondWithResult(_0x1dac9d,null))['catch'](handleError(_0x1dac9d,null));};exports[_0xec27('0x4d')]=function(_0x25ae6d,_0x3696a1){return db['FreshsalesField'][_0xec27('0x4d')](_0x25ae6d[_0xec27('0x4e')],{})[_0xec27('0x28')](respondWithResult(_0x3696a1,0xc9))[_0xec27('0x49')](handleError(_0x3696a1,null));};exports[_0xec27('0x27')]=function(_0x3f79f2,_0x19eea1){if(_0x3f79f2['body']['id']){delete _0x3f79f2[_0xec27('0x4e')]['id'];}return db['FreshsalesField']['find']({'where':{'id':_0x3f79f2['params']['id']}})[_0xec27('0x28')](handleEntityNotFound(_0x19eea1,null))[_0xec27('0x28')](saveUpdates(_0x3f79f2['body'],null))[_0xec27('0x28')](respondWithResult(_0x19eea1,null))[_0xec27('0x49')](handleError(_0x19eea1,null));};exports[_0xec27('0x29')]=function(_0x3c9eb8,_0x55666b){return db[_0xec27('0x2f')][_0xec27('0x4c')]({'where':{'id':_0x3c9eb8[_0xec27('0x4b')]['id']}})[_0xec27('0x28')](handleEntityNotFound(_0x55666b,null))[_0xec27('0x28')](removeEntity(_0x55666b,null))[_0xec27('0x49')](handleError(_0x55666b,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 53be4b4..43ef516 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 _0x4b11=['int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField'];(function(_0x4d8a8f,_0x2afd4c){var _0xfc4adc=function(_0xb89886){while(--_0xb89886){_0x4d8a8f['push'](_0x4d8a8f['shift']());}};_0xfc4adc(++_0x2afd4c);}(_0x4b11,0xf4));var _0x14b1=function(_0x2ca22f,_0xe011eb){_0x2ca22f=_0x2ca22f-0x0;var _0x42f883=_0x4b11[_0x2ca22f];return _0x42f883;};'use strict';var _=require(_0x14b1('0x0'));var util=require(_0x14b1('0x1'));var logger=require(_0x14b1('0x2'))(_0x14b1('0x3'));var moment=require('moment');var BPromise=require(_0x14b1('0x4'));var rp=require(_0x14b1('0x5'));var fs=require('fs');var path=require(_0x14b1('0x6'));var rimraf=require('rimraf');var config=require(_0x14b1('0x7'));var attributes=require(_0x14b1('0x8'));module[_0x14b1('0x9')]=function(_0x1fb89f,_0x322430){return _0x1fb89f[_0x14b1('0xa')](_0x14b1('0xb'),attributes,{'tableName':_0x14b1('0xc'),'paranoid':![],'indexes':[{'name':_0x14b1('0xd'),'fields':[_0x14b1('0xe'),_0x14b1('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5eed=['request-promise','path','rimraf','../../config/environment','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xc6acad,_0xcc7f6d){var _0x192934=function(_0x593c1b){while(--_0x593c1b){_0xc6acad['push'](_0xc6acad['shift']());}};_0x192934(++_0xcc7f6d);}(_0x5eed,0x10a));var _0xd5ee=function(_0x5be452,_0x21d255){_0x5be452=_0x5be452-0x0;var _0x1568a4=_0x5eed[_0x5be452];return _0x1568a4;};'use strict';var _=require(_0xd5ee('0x0'));var util=require(_0xd5ee('0x1'));var logger=require(_0xd5ee('0x2'))(_0xd5ee('0x3'));var moment=require(_0xd5ee('0x4'));var BPromise=require(_0xd5ee('0x5'));var rp=require(_0xd5ee('0x6'));var fs=require('fs');var path=require(_0xd5ee('0x7'));var rimraf=require(_0xd5ee('0x8'));var config=require(_0xd5ee('0x9'));var attributes=require('./intFreshsalesField.attributes');module[_0xd5ee('0xa')]=function(_0x347377,_0xc7de11){return _0x347377[_0xd5ee('0xb')](_0xd5ee('0xc'),attributes,{'tableName':_0xd5ee('0xd'),'paranoid':![],'indexes':[{'name':_0xd5ee('0xe'),'fields':[_0xd5ee('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index dd91b55..f8f3d48 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 _0xafc4=['error','code','message','request\x20sent','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5293f4,_0x523771){var _0x1740df=function(_0x3c08bb){while(--_0x3c08bb){_0x5293f4['push'](_0x5293f4['shift']());}};_0x1740df(++_0x523771);}(_0xafc4,0x69));var _0x4afc=function(_0x330891,_0x36d68d){_0x330891=_0x330891-0x0;var _0x648ab1=_0xafc4[_0x330891];return _0x648ab1;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var moment=require(_0x4afc('0x1'));var BPromise=require('bluebird');var rs=require(_0x4afc('0x2'));var fs=require('fs');var Redis=require(_0x4afc('0x3'));var db=require(_0x4afc('0x4'))['db'];var utils=require(_0x4afc('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4afc('0x6'));var client=jayson[_0x4afc('0x7')][_0x4afc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1bb281,_0xc828d9,_0xaf053d){return new BPromise(function(_0x5e1e29,_0x31e165){return client[_0x4afc('0x9')](_0x1bb281,_0xaf053d)[_0x4afc('0xa')](function(_0x1e6bf5){logger[_0x4afc('0xb')](_0x4afc('0xc'),_0xc828d9,'request\x20sent');logger['debug'](_0x4afc('0xd'),_0xc828d9,'request\x20sent',JSON[_0x4afc('0xe')](_0x1e6bf5));if(_0x1e6bf5[_0x4afc('0xf')]){if(_0x1e6bf5['error'][_0x4afc('0x10')]===0x1f4){logger[_0x4afc('0xf')](_0x4afc('0xc'),_0xc828d9,_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);return _0x31e165(_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);}logger[_0x4afc('0xf')]('FreshsalesField,\x20%s,\x20%s',_0xc828d9,_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);return _0x5e1e29(_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0xc828d9,_0x4afc('0x12'));_0x5e1e29(_0x1e6bf5['result'][_0x4afc('0x11')]);}})[_0x4afc('0x13')](function(_0x2b928b){logger[_0x4afc('0xf')](_0x4afc('0xc'),_0xc828d9,_0x2b928b);_0x31e165(_0x2b928b);});});} \ No newline at end of file +var _0xbd51=['FreshsalesField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x359ddd,_0x25a8e7){_0x359ddd=_0x359ddd-0x0;var _0x2e7225=_0xbd51[_0x359ddd];return _0x2e7225;};'use strict';var _=require(_0x1bd5('0x0'));var util=require('util');var moment=require(_0x1bd5('0x1'));var BPromise=require(_0x1bd5('0x2'));var rs=require(_0x1bd5('0x3'));var fs=require('fs');var Redis=require(_0x1bd5('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x1bd5('0x5'));var jayson=require(_0x1bd5('0x6'));var client=jayson[_0x1bd5('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29abea,_0x30a385,_0x19077c){return new BPromise(function(_0x27d58f,_0xd8418f){return client['request'](_0x29abea,_0x19077c)[_0x1bd5('0x8')](function(_0x5c8e0d){logger[_0x1bd5('0x9')](_0x1bd5('0xa'),_0x30a385,_0x1bd5('0xb'));logger[_0x1bd5('0xc')](_0x1bd5('0xd'),_0x30a385,_0x1bd5('0xb'),JSON['stringify'](_0x5c8e0d));if(_0x5c8e0d[_0x1bd5('0xe')]){if(_0x5c8e0d['error'][_0x1bd5('0xf')]===0x1f4){logger[_0x1bd5('0xe')](_0x1bd5('0xa'),_0x30a385,_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);return _0xd8418f(_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);}logger['error']('FreshsalesField,\x20%s,\x20%s',_0x30a385,_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);return _0x27d58f(_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0x30a385,_0x1bd5('0xb'));_0x27d58f(_0x5c8e0d[_0x1bd5('0x11')][_0x1bd5('0x10')]);}})[_0x1bd5('0x12')](function(_0x43ea3e){logger[_0x1bd5('0xe')](_0x1bd5('0xa'),_0x30a385,_0x43ea3e);_0xd8418f(_0x43ea3e);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 46a7960..1a797f4 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(_0x3d8b40,_0x494477){var _0x2d9d4f=function(_0x17fc80){while(--_0x17fc80){_0x3d8b40['push'](_0x3d8b40['shift']());}};_0x2d9d4f(++_0x494477);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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(_0x5c00f9,_0x400193){var _0x476b91=function(_0x539ccf){while(--_0x539ccf){_0x5c00f9['push'](_0x5c00f9['shift']());}};_0x476b91(++_0x400193);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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 1c72fb7..8911fce 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 _0x3e9c=['exports','STRING','username','ENUM','integrationTab','newTab','sequelize'];(function(_0x455be0,_0x3e6949){var _0x4a5f3f=function(_0x1498ee){while(--_0x1498ee){_0x455be0['push'](_0x455be0['shift']());}};_0x4a5f3f(++_0x3e6949);}(_0x3e9c,0x6f));var _0xc3e9=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x3e9c[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0xc3e9('0x0'));module[_0xc3e9('0x1')]={'name':{'type':Sequelize[_0xc3e9('0x2')]},'description':{'type':Sequelize[_0xc3e9('0x2')]},'username':{'type':Sequelize[_0xc3e9('0x2')],'unique':_0xc3e9('0x3')},'remoteUri':{'type':Sequelize[_0xc3e9('0x2')]},'password':{'type':Sequelize[_0xc3e9('0x2')]},'clientId':{'type':Sequelize[_0xc3e9('0x2')]},'clientSecret':{'type':Sequelize[_0xc3e9('0x2')]},'securityToken':{'type':Sequelize[_0xc3e9('0x2')]},'serverUrl':{'type':Sequelize[_0xc3e9('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xc3e9('0x4')](_0xc3e9('0x5'),_0xc3e9('0x6')),'defaultValue':_0xc3e9('0x5')}}; \ No newline at end of file +var _0x46cb=['sequelize','exports','STRING','username','ENUM','newTab'];(function(_0x3c06e2,_0x247e9d){var _0x3eb59f=function(_0x1148f5){while(--_0x1148f5){_0x3c06e2['push'](_0x3c06e2['shift']());}};_0x3eb59f(++_0x247e9d);}(_0x46cb,0x84));var _0xb46c=function(_0x55f380,_0x3e27f0){_0x55f380=_0x55f380-0x0;var _0x36b38e=_0x46cb[_0x55f380];return _0x36b38e;};'use strict';var Sequelize=require(_0xb46c('0x0'));module[_0xb46c('0x1')]={'name':{'type':Sequelize[_0xb46c('0x2')]},'description':{'type':Sequelize[_0xb46c('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xb46c('0x3')},'remoteUri':{'type':Sequelize[_0xb46c('0x2')]},'password':{'type':Sequelize[_0xb46c('0x2')]},'clientId':{'type':Sequelize[_0xb46c('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0xb46c('0x2')]},'serverUrl':{'type':Sequelize[_0xb46c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xb46c('0x4')]('integrationTab',_0xb46c('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 68d5909..04a60c0 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 _0x118c=['ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','apply','reject','save','update','destroy','error','stack','name','send','map','SalesforceAccount','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','getConfigurations','findOne','keys','SalesforceConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','Subjects','Task','remoteUri','clientSecret','username','password','slice','substring','lastIndexOf','Connection','concat','isNil','ticketType','sobject','describe','OwnerId','IsReminderSet','Description','int','picklist','boolean','email','textarea','phone','remove','includes','label','picklistValues','value','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x1509f8,_0x19f507){var _0x11730a=function(_0xfce44f){while(--_0xfce44f){_0x1509f8['push'](_0x1509f8['shift']());}};_0x11730a(++_0x19f507);}(_0x118c,0x1ec));var _0xc118=function(_0x3be426,_0x2df1b5){_0x3be426=_0x3be426-0x0;var _0x4389e1=_0x118c[_0x3be426];return _0x4389e1;};'use strict';var emlformat=require(_0xc118('0x0'));var rimraf=require(_0xc118('0x1'));var zipdir=require(_0xc118('0x2'));var jsonpatch=require(_0xc118('0x3'));var rp=require(_0xc118('0x4'));var moment=require(_0xc118('0x5'));var BPromise=require(_0xc118('0x6'));var Mustache=require(_0xc118('0x7'));var util=require(_0xc118('0x8'));var path=require(_0xc118('0x9'));var sox=require(_0xc118('0xa'));var csv=require(_0xc118('0xb'));var ejs=require(_0xc118('0xc'));var fs=require('fs');var fs_extra=require(_0xc118('0xd'));var _=require('lodash');var squel=require(_0xc118('0xe'));var crypto=require(_0xc118('0xf'));var jsforce=require(_0xc118('0x10'));var deskjs=require(_0xc118('0x11'));var toCsv=require(_0xc118('0xb'));var querystring=require(_0xc118('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc118('0x13'));var qs=require(_0xc118('0x14'));var as=require(_0xc118('0x15'));var hardwareService=require(_0xc118('0x16'));var logger=require(_0xc118('0x17'))(_0xc118('0x18'));var utils=require('../../config/utils');var config=require(_0xc118('0x19'));var licenseUtil=require(_0xc118('0x1a'));var db=require(_0xc118('0x1b'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x394e29,_0x33d9f8){_0x33d9f8=_0x33d9f8||0xcc;return function(_0x5d108d){if(_0x5d108d){return _0x394e29[_0xc118('0x1c')](_0x33d9f8);}return _0x394e29[_0xc118('0x1d')](_0x33d9f8)[_0xc118('0x1e')]();};}function respondWithResult(_0x4b9ddd,_0x344e0e){_0x344e0e=_0x344e0e||0xc8;return function(_0x33b6f6){if(_0x33b6f6){return _0x4b9ddd['status'](_0x344e0e)[_0xc118('0x1f')](_0x33b6f6);}};}function respondWithFilteredResult(_0x1f22e6,_0x3975b6){return function(_0x832778){if(_0x832778){var _0x25af7e=typeof _0x3975b6['offset']===_0xc118('0x20')&&typeof _0x3975b6['limit']==='undefined';var _0x27c672=_0x832778[_0xc118('0x21')];var _0x5d680e=_0x25af7e?0x0:_0x3975b6[_0xc118('0x22')];var _0x7e4cc3=_0x25af7e?_0x832778['count']:_0x3975b6[_0xc118('0x22')]+_0x3975b6[_0xc118('0x23')];var _0x14296d;if(_0x7e4cc3>=_0x27c672){_0x7e4cc3=_0x27c672;_0x14296d=0xc8;}else{_0x14296d=0xce;}_0x1f22e6[_0xc118('0x1d')](_0x14296d);return _0x1f22e6['set']('Content-Range',_0x5d680e+'-'+_0x7e4cc3+'/'+_0x27c672)[_0xc118('0x1f')](_0x832778);}return null;};}function patchUpdates(_0x299b4a){return function(_0x51e4c0){try{jsonpatch[_0xc118('0x24')](_0x51e4c0,_0x299b4a,!![]);}catch(_0x344fc4){return BPromise[_0xc118('0x25')](_0x344fc4);}return _0x51e4c0[_0xc118('0x26')]();};}function saveUpdates(_0x17057c,_0x2fc37e){return function(_0x5c8928){if(_0x5c8928){return _0x5c8928[_0xc118('0x27')](_0x17057c)['then'](function(_0x453f4f){return _0x453f4f;});}return null;};}function removeEntity(_0x21fe32,_0x338216){return function(_0x4a7c80){if(_0x4a7c80){return _0x4a7c80[_0xc118('0x28')]()['then'](function(){_0x21fe32['status'](0xcc)[_0xc118('0x1e')]();});}};}function handleEntityNotFound(_0x1a1b52,_0x13f75c){return function(_0x75c042){if(!_0x75c042){_0x1a1b52[_0xc118('0x1c')](0x194);}return _0x75c042;};}function handleError(_0x29ef1b,_0x4dd09d){_0x4dd09d=_0x4dd09d||0x1f4;return function(_0x225d45){logger[_0xc118('0x29')](_0x225d45[_0xc118('0x2a')]);if(_0x225d45[_0xc118('0x2b')]){delete _0x225d45[_0xc118('0x2b')];}_0x29ef1b['status'](_0x4dd09d)[_0xc118('0x2c')](_0x225d45);};}exports['index']=function(_0x31735a,_0x48195b){var _0x49b96a={},_0x2266f2={},_0xec56d4={'count':0x0,'rows':[]};var _0x5d1085=_[_0xc118('0x2d')](db[_0xc118('0x2e')]['rawAttributes'],function(_0x20ec5d){return{'name':_0x20ec5d['fieldName'],'type':_0x20ec5d['type'][_0xc118('0x2f')]};});_0x2266f2[_0xc118('0x30')]=_[_0xc118('0x2d')](_0x5d1085,'name');_0x2266f2['query']=_['keys'](_0x31735a[_0xc118('0x31')]);_0x2266f2[_0xc118('0x32')]=_[_0xc118('0x33')](_0x2266f2[_0xc118('0x30')],_0x2266f2['query']);_0x49b96a['attributes']=_[_0xc118('0x33')](_0x2266f2[_0xc118('0x30')],qs[_0xc118('0x34')](_0x31735a['query']['fields']));_0x49b96a[_0xc118('0x35')]=_0x49b96a['attributes'][_0xc118('0x36')]?_0x49b96a['attributes']:_0x2266f2[_0xc118('0x30')];if(!_0x31735a[_0xc118('0x31')][_0xc118('0x37')](_0xc118('0x38'))){_0x49b96a[_0xc118('0x23')]=qs[_0xc118('0x23')](_0x31735a[_0xc118('0x31')][_0xc118('0x23')]);_0x49b96a[_0xc118('0x22')]=qs[_0xc118('0x22')](_0x31735a['query'][_0xc118('0x22')]);}_0x49b96a[_0xc118('0x39')]=qs[_0xc118('0x3a')](_0x31735a['query'][_0xc118('0x3a')]);_0x49b96a[_0xc118('0x3b')]=qs['filters'](_[_0xc118('0x3c')](_0x31735a[_0xc118('0x31')],_0x2266f2[_0xc118('0x32')]),_0x5d1085);if(_0x31735a[_0xc118('0x31')][_0xc118('0x3d')]){_0x49b96a['where']=_[_0xc118('0x3e')](_0x49b96a[_0xc118('0x3b')],{'$or':_[_0xc118('0x2d')](_0x5d1085,function(_0x67d08b){if(_0x67d08b[_0xc118('0x3f')]!==_0xc118('0x40')){var _0x4cd7bf={};_0x4cd7bf[_0x67d08b['name']]={'$like':'%'+_0x31735a[_0xc118('0x31')][_0xc118('0x3d')]+'%'};return _0x4cd7bf;}})});}_0x49b96a=_[_0xc118('0x3e')]({},_0x49b96a,_0x31735a[_0xc118('0x41')]);var _0xb674f7={'where':_0x49b96a['where']};return db[_0xc118('0x2e')]['count'](_0xb674f7)[_0xc118('0x42')](function(_0x357023){_0xec56d4['count']=_0x357023;if(_0x31735a['query'][_0xc118('0x43')]){_0x49b96a[_0xc118('0x44')]=[{'all':!![]}];}return db[_0xc118('0x2e')][_0xc118('0x45')](_0x49b96a);})[_0xc118('0x42')](function(_0xe039ee){_0xec56d4[_0xc118('0x46')]=_0xe039ee;return _0xec56d4;})[_0xc118('0x42')](respondWithFilteredResult(_0x48195b,_0x49b96a))[_0xc118('0x47')](handleError(_0x48195b,null));};exports[_0xc118('0x48')]=function(_0x2727a8,_0x28e8f0){var _0x1c8a50={'raw':![],'where':{'id':_0x2727a8['params']['id']}},_0x34b354={};_0x34b354[_0xc118('0x30')]=_['keys'](db[_0xc118('0x2e')][_0xc118('0x49')]);_0x34b354[_0xc118('0x31')]=_['keys'](_0x2727a8[_0xc118('0x31')]);_0x34b354['filters']=_[_0xc118('0x33')](_0x34b354[_0xc118('0x30')],_0x34b354[_0xc118('0x31')]);_0x1c8a50[_0xc118('0x35')]=_[_0xc118('0x33')](_0x34b354['model'],qs[_0xc118('0x34')](_0x2727a8[_0xc118('0x31')][_0xc118('0x34')]));_0x1c8a50['attributes']=_0x1c8a50['attributes']['length']?_0x1c8a50[_0xc118('0x35')]:_0x34b354[_0xc118('0x30')];if(_0x2727a8[_0xc118('0x31')][_0xc118('0x43')]){_0x1c8a50[_0xc118('0x44')]=[{'all':!![]}];}_0x1c8a50=_['merge']({},_0x1c8a50,_0x2727a8[_0xc118('0x41')]);return db[_0xc118('0x2e')][_0xc118('0x4a')](_0x1c8a50)[_0xc118('0x42')](handleEntityNotFound(_0x28e8f0,null))['then'](respondWithResult(_0x28e8f0,null))['catch'](handleError(_0x28e8f0,null));};exports[_0xc118('0x4b')]=function(_0x52d9b9,_0x239f35){return db[_0xc118('0x2e')][_0xc118('0x4b')](_0x52d9b9['body'],{})['then'](respondWithResult(_0x239f35,0xc9))[_0xc118('0x47')](handleError(_0x239f35,null));};exports['update']=function(_0x5058db,_0x47660f){if(_0x5058db[_0xc118('0x4c')]['id']){delete _0x5058db[_0xc118('0x4c')]['id'];}return db[_0xc118('0x2e')][_0xc118('0x4a')]({'where':{'id':_0x5058db['params']['id']}})[_0xc118('0x42')](handleEntityNotFound(_0x47660f,null))[_0xc118('0x42')](saveUpdates(_0x5058db['body'],null))[_0xc118('0x42')](respondWithResult(_0x47660f,null))['catch'](handleError(_0x47660f,null));};exports['destroy']=function(_0x1c0478,_0x310460){return db[_0xc118('0x2e')]['find']({'where':{'id':_0x1c0478[_0xc118('0x4d')]['id']}})[_0xc118('0x42')](handleEntityNotFound(_0x310460,null))[_0xc118('0x42')](removeEntity(_0x310460,null))[_0xc118('0x47')](handleError(_0x310460,null));};exports[_0xc118('0x4e')]=function(_0x3eea29,_0xe345ce,_0x8c123a){var _0x44e973={};var _0x39bd7d={};var _0x3b4acb;var _0x1b2803;return db[_0xc118('0x2e')][_0xc118('0x4f')]({'where':{'id':_0x3eea29[_0xc118('0x4d')]['id']}})['then'](handleEntityNotFound(_0xe345ce,null))['then'](function(_0x3bb8ff){if(_0x3bb8ff){_0x3b4acb=_0x3bb8ff;_0x39bd7d[_0xc118('0x30')]=_[_0xc118('0x50')](db[_0xc118('0x51')][_0xc118('0x49')]);_0x39bd7d[_0xc118('0x31')]=_[_0xc118('0x50')](_0x3eea29['query']);_0x39bd7d[_0xc118('0x32')]=_['intersection'](_0x39bd7d[_0xc118('0x30')],_0x39bd7d[_0xc118('0x31')]);_0x44e973['attributes']=_[_0xc118('0x33')](_0x39bd7d['model'],qs[_0xc118('0x34')](_0x3eea29[_0xc118('0x31')]['fields']));_0x44e973['attributes']=_0x44e973[_0xc118('0x35')]['length']?_0x44e973[_0xc118('0x35')]:_0x39bd7d[_0xc118('0x30')];_0x44e973[_0xc118('0x39')]=qs[_0xc118('0x3a')](_0x3eea29[_0xc118('0x31')][_0xc118('0x3a')]);_0x44e973[_0xc118('0x3b')]=qs[_0xc118('0x32')](_[_0xc118('0x3c')](_0x3eea29[_0xc118('0x31')],_0x39bd7d[_0xc118('0x32')]));if(_0x3eea29[_0xc118('0x31')][_0xc118('0x3d')]){_0x44e973['where']=_[_0xc118('0x3e')](_0x44e973[_0xc118('0x3b')],{'$or':_[_0xc118('0x2d')](_0x44e973[_0xc118('0x35')],function(_0x46e169){var _0x3467df={};_0x3467df[_0x46e169]={'$like':'%'+_0x3eea29['query'][_0xc118('0x3d')]+'%'};return _0x3467df;})});}_0x44e973=_[_0xc118('0x3e')]({},_0x44e973,_0x3eea29[_0xc118('0x41')]);return _0x3b4acb[_0xc118('0x4e')](_0x44e973);}})[_0xc118('0x42')](function(_0x59aafd){if(_0x59aafd){_0x1b2803=_0x59aafd[_0xc118('0x36')];if(!_0x3eea29[_0xc118('0x31')][_0xc118('0x37')]('nolimit')){_0x44e973[_0xc118('0x23')]=qs['limit'](_0x3eea29[_0xc118('0x31')][_0xc118('0x23')]);_0x44e973['offset']=qs['offset'](_0x3eea29[_0xc118('0x31')][_0xc118('0x22')]);}return _0x3b4acb[_0xc118('0x4e')](_0x44e973);}})[_0xc118('0x42')](function(_0xee5df1){if(_0xee5df1){return _0xee5df1?{'count':_0x1b2803,'rows':_0xee5df1}:null;}})[_0xc118('0x42')](respondWithResult(_0xe345ce,null))[_0xc118('0x47')](handleError(_0xe345ce,null));};exports[_0xc118('0x52')]=function(_0x1464d6,_0x2f9089,_0x11fa97){if(_0x1464d6[_0xc118('0x4c')]['id']){delete _0x1464d6[_0xc118('0x4c')]['id'];}return db['SalesforceAccount'][_0xc118('0x4f')]({'where':{'id':_0x1464d6['params']['id']}})[_0xc118('0x42')](handleEntityNotFound(_0x2f9089,null))[_0xc118('0x42')](function(_0x147e9e){if(_0x147e9e){_0x1464d6[_0xc118('0x4c')][_0xc118('0x53')]=_0x147e9e['id'];_0x1464d6[_0xc118('0x4c')]['Subjects']=integrations[_0xc118('0x54')](_0x1464d6[_0xc118('0x4c')][_0xc118('0x55')],_0x1464d6['body'][_0xc118('0x3f')]);_0x1464d6[_0xc118('0x4c')][_0xc118('0x56')]=integrations[_0xc118('0x57')](_0x1464d6[_0xc118('0x4c')]['channel'],_0x1464d6[_0xc118('0x4c')][_0xc118('0x3f')]);return db[_0xc118('0x51')][_0xc118('0x4b')](_0x1464d6[_0xc118('0x4c')],{'include':[{'model':db[_0xc118('0x58')],'as':_0xc118('0x59')},{'model':db[_0xc118('0x58')],'as':'Descriptions'}]});}return null;})[_0xc118('0x42')](respondWithResult(_0x2f9089,null))[_0xc118('0x47')](handleError(_0x2f9089,null));};exports['getFields']=function(_0x1a6a29,_0x2b93a6,_0x4351a9){var _0x2b9a71;var _0x34b16e='';var _0x123aea=_0xc118('0x5a');return db[_0xc118('0x2e')][_0xc118('0x4f')]({'where':{'id':_0x1a6a29['params']['id']},'attributes':['id',_0xc118('0x5b'),'clientId',_0xc118('0x5c'),_0xc118('0x5d'),_0xc118('0x5e'),'securityToken']})[_0xc118('0x42')](handleEntityNotFound(_0x2b93a6,null))[_0xc118('0x42')](function(_0x3f81e0){if(_0x3f81e0){_0x34b16e=_0x3f81e0[_0xc118('0x5b')];var _0x5cf3ff=_0x34b16e[_0xc118('0x5f')](-0x1);if(_0x5cf3ff==='/'){_0x34b16e=_0x34b16e[_0xc118('0x60')](0x0,_0x34b16e[_0xc118('0x61')](_0x5cf3ff));}_0x2b9a71=new jsforce[(_0xc118('0x62'))]({'oauth2':{'loginUrl':_0x34b16e,'clientId':_0x3f81e0['clientId'],'clientSecret':_0x3f81e0[_0xc118('0x5c')]}});return _0x2b9a71['login'](_0x3f81e0[_0xc118('0x5d')],_0x3f81e0['password'][_0xc118('0x63')](_0x3f81e0['securityToken']));}})[_0xc118('0x42')](function(_0x42769e){if(_0x42769e){if(!_[_0xc118('0x64')](_0x1a6a29[_0xc118('0x31')][_0xc118('0x65')])){_0x123aea=_0x1a6a29['query']['ticketType'];}return _0x2b9a71[_0xc118('0x66')](_0x123aea)[_0xc118('0x67')]();}})[_0xc118('0x42')](function(_0x1606cd){var _0x5e9dd8=[_0xc118('0x68'),'ActivityDate',_0xc118('0x69'),'IsRecurrence','Subject',_0xc118('0x6a')];var _0x37194c=['string',_0xc118('0x6b'),_0xc118('0x6c'),_0xc118('0x6d'),_0xc118('0x6e'),_0xc118('0x6f'),_0xc118('0x70')];if(_0x1606cd){_[_0xc118('0x71')](_0x1606cd['fields'],function(_0x218a79){return _0x5e9dd8[_0xc118('0x72')](_0x218a79[_0xc118('0x2b')])||!_0x37194c[_0xc118('0x72')](_0x218a79[_0xc118('0x3f')]);});return{'count':_0x1606cd['fields']['length'],'rows':_['map'](_0x1606cd[_0xc118('0x34')],function(_0x3f916b){return{'id':_0x3f916b[_0xc118('0x2b')],'name':_0x3f916b[_0xc118('0x73')],'custom':_0x3f916b['custom'],'options':_0x3f916b[_0xc118('0x74')]['length']>0x0?_['map'](_0x3f916b['picklistValues'],function(_0x438e29){return{'name':_0x438e29[_0xc118('0x73')],'value':_0x438e29[_0xc118('0x75')]};}):_0x3f916b[_0xc118('0x3f')]==_0xc118('0x6d')?[{'name':_0xc118('0x76'),'value':_0xc118('0x77')},{'name':_0xc118('0x78'),'value':_0xc118('0x79')}]:[]};})};}})[_0xc118('0x42')](respondWithResult(_0x2b93a6,null))['catch'](function(_0xc41f86){var _0x4ae732=_0x1a6a29[_0xc118('0x31')][_0xc118('0x7a')]?0x1f4:_0xc41f86[_0xc118('0x7b')]||0x1f4;logger['error'](_0xc118('0x7c'),_0xc118('0x7d'),_0x4ae732,JSON['stringify'](_0xc41f86));delete _0xc41f86[_0xc118('0x2b')];if(_0x4ae732===0x191){_0x4ae732=0x190;}_0x2b93a6[_0xc118('0x1d')](_0x4ae732)[_0xc118('0x2c')](_0x1a6a29['query'][_0xc118('0x7a')]?{'message':'Wrong\x20credentials','statusCode':_0xc41f86[_0xc118('0x7b')]}:_0xc41f86);});}; \ No newline at end of file +var _0xa6cf=['email','textarea','phone','includes','custom','picklistValues','label','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','error','stack','name','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','options','SalesforceAccount','includeAll','include','rows','catch','params','rawAttributes','find','create','body','destroy','getConfigurations','findOne','SalesforceConfiguration','sort','filter','addConfiguration','AccountId','getSubjects','channel','getDescriptions','Subjects','SalesforceField','Descriptions','clientId','password','securityToken','remoteUri','slice','substring','lastIndexOf','Connection','clientSecret','login','concat','isNil','ticketType','sobject','describe','IsReminderSet','Subject','Description','string','int','picklist','boolean'];(function(_0x15a8e1,_0x21e63d){var _0x185130=function(_0x53fa48){while(--_0x53fa48){_0x15a8e1['push'](_0x15a8e1['shift']());}};_0x185130(++_0x21e63d);}(_0xa6cf,0x88));var _0xfa6c=function(_0x4566a4,_0x2cdbf6){_0x4566a4=_0x4566a4-0x0;var _0x26d5a0=_0xa6cf[_0x4566a4];return _0x26d5a0;};'use strict';var emlformat=require(_0xfa6c('0x0'));var rimraf=require(_0xfa6c('0x1'));var zipdir=require(_0xfa6c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfa6c('0x3'));var moment=require('moment');var BPromise=require(_0xfa6c('0x4'));var Mustache=require(_0xfa6c('0x5'));var util=require(_0xfa6c('0x6'));var path=require(_0xfa6c('0x7'));var sox=require(_0xfa6c('0x8'));var csv=require(_0xfa6c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfa6c('0xa'));var _=require('lodash');var squel=require(_0xfa6c('0xb'));var crypto=require(_0xfa6c('0xc'));var jsforce=require(_0xfa6c('0xd'));var deskjs=require(_0xfa6c('0xe'));var toCsv=require(_0xfa6c('0x9'));var querystring=require('querystring');var Papa=require(_0xfa6c('0xf'));var Redis=require(_0xfa6c('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfa6c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfa6c('0x12'));var utils=require(_0xfa6c('0x13'));var config=require(_0xfa6c('0x14'));var licenseUtil=require(_0xfa6c('0x15'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x53a371,_0x54ea5b){_0x54ea5b=_0x54ea5b||0xcc;return function(_0x341f75){if(_0x341f75){return _0x53a371[_0xfa6c('0x16')](_0x54ea5b);}return _0x53a371[_0xfa6c('0x17')](_0x54ea5b)[_0xfa6c('0x18')]();};}function respondWithResult(_0x19dfe4,_0x8d89f){_0x8d89f=_0x8d89f||0xc8;return function(_0x43b05d){if(_0x43b05d){return _0x19dfe4[_0xfa6c('0x17')](_0x8d89f)[_0xfa6c('0x19')](_0x43b05d);}};}function respondWithFilteredResult(_0x269cc2,_0x59ac73){return function(_0xb2adc9){if(_0xb2adc9){var _0x49c6e9=typeof _0x59ac73[_0xfa6c('0x1a')]==='undefined'&&typeof _0x59ac73['limit']===_0xfa6c('0x1b');var _0x42cc46=_0xb2adc9['count'];var _0x4da4dd=_0x49c6e9?0x0:_0x59ac73['offset'];var _0x322dc3=_0x49c6e9?_0xb2adc9[_0xfa6c('0x1c')]:_0x59ac73[_0xfa6c('0x1a')]+_0x59ac73[_0xfa6c('0x1d')];var _0x53d380;if(_0x322dc3>=_0x42cc46){_0x322dc3=_0x42cc46;_0x53d380=0xc8;}else{_0x53d380=0xce;}_0x269cc2['status'](_0x53d380);return _0x269cc2[_0xfa6c('0x1e')](_0xfa6c('0x1f'),_0x4da4dd+'-'+_0x322dc3+'/'+_0x42cc46)[_0xfa6c('0x19')](_0xb2adc9);}return null;};}function patchUpdates(_0x3528d1){return function(_0x5b1da5){try{jsonpatch[_0xfa6c('0x20')](_0x5b1da5,_0x3528d1,!![]);}catch(_0x3ca78a){return BPromise['reject'](_0x3ca78a);}return _0x5b1da5[_0xfa6c('0x21')]();};}function saveUpdates(_0x19b6a4,_0x1fb3f1){return function(_0xb442c0){if(_0xb442c0){return _0xb442c0[_0xfa6c('0x22')](_0x19b6a4)[_0xfa6c('0x23')](function(_0x473709){return _0x473709;});}return null;};}function removeEntity(_0x489d6d,_0x52582b){return function(_0x51c138){if(_0x51c138){return _0x51c138['destroy']()[_0xfa6c('0x23')](function(){_0x489d6d[_0xfa6c('0x17')](0xcc)[_0xfa6c('0x18')]();});}};}function handleEntityNotFound(_0x4cb995,_0x433955){return function(_0x88e76){if(!_0x88e76){_0x4cb995['sendStatus'](0x194);}return _0x88e76;};}function handleError(_0x530a93,_0x284155){_0x284155=_0x284155||0x1f4;return function(_0xc12109){logger[_0xfa6c('0x24')](_0xc12109[_0xfa6c('0x25')]);if(_0xc12109[_0xfa6c('0x26')]){delete _0xc12109['name'];}_0x530a93[_0xfa6c('0x17')](_0x284155)['send'](_0xc12109);};}exports['index']=function(_0x9af07e,_0x492989){var _0x34c70c={},_0x18ec34={},_0x528edb={'count':0x0,'rows':[]};var _0x58b3cb=_[_0xfa6c('0x27')](db['SalesforceAccount']['rawAttributes'],function(_0x41624b){return{'name':_0x41624b[_0xfa6c('0x28')],'type':_0x41624b[_0xfa6c('0x29')]['key']};});_0x18ec34[_0xfa6c('0x2a')]=_[_0xfa6c('0x27')](_0x58b3cb,_0xfa6c('0x26'));_0x18ec34[_0xfa6c('0x2b')]=_[_0xfa6c('0x2c')](_0x9af07e[_0xfa6c('0x2b')]);_0x18ec34[_0xfa6c('0x2d')]=_[_0xfa6c('0x2e')](_0x18ec34[_0xfa6c('0x2a')],_0x18ec34['query']);_0x34c70c[_0xfa6c('0x2f')]=_[_0xfa6c('0x2e')](_0x18ec34[_0xfa6c('0x2a')],qs[_0xfa6c('0x30')](_0x9af07e[_0xfa6c('0x2b')][_0xfa6c('0x30')]));_0x34c70c['attributes']=_0x34c70c[_0xfa6c('0x2f')][_0xfa6c('0x31')]?_0x34c70c[_0xfa6c('0x2f')]:_0x18ec34[_0xfa6c('0x2a')];if(!_0x9af07e[_0xfa6c('0x2b')][_0xfa6c('0x32')](_0xfa6c('0x33'))){_0x34c70c[_0xfa6c('0x1d')]=qs[_0xfa6c('0x1d')](_0x9af07e[_0xfa6c('0x2b')][_0xfa6c('0x1d')]);_0x34c70c[_0xfa6c('0x1a')]=qs['offset'](_0x9af07e[_0xfa6c('0x2b')][_0xfa6c('0x1a')]);}_0x34c70c[_0xfa6c('0x34')]=qs['sort'](_0x9af07e[_0xfa6c('0x2b')]['sort']);_0x34c70c[_0xfa6c('0x35')]=qs[_0xfa6c('0x2d')](_[_0xfa6c('0x36')](_0x9af07e[_0xfa6c('0x2b')],_0x18ec34[_0xfa6c('0x2d')]),_0x58b3cb);if(_0x9af07e['query']['filter']){_0x34c70c[_0xfa6c('0x35')]=_[_0xfa6c('0x37')](_0x34c70c['where'],{'$or':_[_0xfa6c('0x27')](_0x58b3cb,function(_0x48f4fc){if(_0x48f4fc[_0xfa6c('0x29')]!==_0xfa6c('0x38')){var _0x4a57d1={};_0x4a57d1[_0x48f4fc[_0xfa6c('0x26')]]={'$like':'%'+_0x9af07e[_0xfa6c('0x2b')]['filter']+'%'};return _0x4a57d1;}})});}_0x34c70c=_[_0xfa6c('0x37')]({},_0x34c70c,_0x9af07e[_0xfa6c('0x39')]);var _0x4262a1={'where':_0x34c70c[_0xfa6c('0x35')]};return db[_0xfa6c('0x3a')][_0xfa6c('0x1c')](_0x4262a1)[_0xfa6c('0x23')](function(_0x558eaf){_0x528edb['count']=_0x558eaf;if(_0x9af07e['query'][_0xfa6c('0x3b')]){_0x34c70c[_0xfa6c('0x3c')]=[{'all':!![]}];}return db[_0xfa6c('0x3a')]['findAll'](_0x34c70c);})[_0xfa6c('0x23')](function(_0x4cca3e){_0x528edb[_0xfa6c('0x3d')]=_0x4cca3e;return _0x528edb;})[_0xfa6c('0x23')](respondWithFilteredResult(_0x492989,_0x34c70c))[_0xfa6c('0x3e')](handleError(_0x492989,null));};exports['show']=function(_0x470c45,_0x59511d){var _0x56de66={'raw':![],'where':{'id':_0x470c45[_0xfa6c('0x3f')]['id']}},_0x3d883a={};_0x3d883a[_0xfa6c('0x2a')]=_['keys'](db[_0xfa6c('0x3a')][_0xfa6c('0x40')]);_0x3d883a[_0xfa6c('0x2b')]=_['keys'](_0x470c45[_0xfa6c('0x2b')]);_0x3d883a['filters']=_['intersection'](_0x3d883a[_0xfa6c('0x2a')],_0x3d883a[_0xfa6c('0x2b')]);_0x56de66[_0xfa6c('0x2f')]=_[_0xfa6c('0x2e')](_0x3d883a[_0xfa6c('0x2a')],qs[_0xfa6c('0x30')](_0x470c45['query']['fields']));_0x56de66[_0xfa6c('0x2f')]=_0x56de66[_0xfa6c('0x2f')][_0xfa6c('0x31')]?_0x56de66[_0xfa6c('0x2f')]:_0x3d883a[_0xfa6c('0x2a')];if(_0x470c45['query'][_0xfa6c('0x3b')]){_0x56de66[_0xfa6c('0x3c')]=[{'all':!![]}];}_0x56de66=_['merge']({},_0x56de66,_0x470c45[_0xfa6c('0x39')]);return db['SalesforceAccount'][_0xfa6c('0x41')](_0x56de66)[_0xfa6c('0x23')](handleEntityNotFound(_0x59511d,null))[_0xfa6c('0x23')](respondWithResult(_0x59511d,null))['catch'](handleError(_0x59511d,null));};exports[_0xfa6c('0x42')]=function(_0xf7857,_0x469106){return db['SalesforceAccount']['create'](_0xf7857[_0xfa6c('0x43')],{})[_0xfa6c('0x23')](respondWithResult(_0x469106,0xc9))['catch'](handleError(_0x469106,null));};exports['update']=function(_0xf1a06b,_0x4921ef){if(_0xf1a06b[_0xfa6c('0x43')]['id']){delete _0xf1a06b[_0xfa6c('0x43')]['id'];}return db[_0xfa6c('0x3a')][_0xfa6c('0x41')]({'where':{'id':_0xf1a06b[_0xfa6c('0x3f')]['id']}})[_0xfa6c('0x23')](handleEntityNotFound(_0x4921ef,null))[_0xfa6c('0x23')](saveUpdates(_0xf1a06b[_0xfa6c('0x43')],null))[_0xfa6c('0x23')](respondWithResult(_0x4921ef,null))[_0xfa6c('0x3e')](handleError(_0x4921ef,null));};exports[_0xfa6c('0x44')]=function(_0x4c4d93,_0x3ee2d9){return db[_0xfa6c('0x3a')][_0xfa6c('0x41')]({'where':{'id':_0x4c4d93[_0xfa6c('0x3f')]['id']}})[_0xfa6c('0x23')](handleEntityNotFound(_0x3ee2d9,null))[_0xfa6c('0x23')](removeEntity(_0x3ee2d9,null))[_0xfa6c('0x3e')](handleError(_0x3ee2d9,null));};exports[_0xfa6c('0x45')]=function(_0x411fa4,_0x525fc8,_0x4bb2d1){var _0x498bde={};var _0x2ec47b={};var _0x3fc9f8;var _0x3a162f;return db['SalesforceAccount'][_0xfa6c('0x46')]({'where':{'id':_0x411fa4[_0xfa6c('0x3f')]['id']}})[_0xfa6c('0x23')](handleEntityNotFound(_0x525fc8,null))[_0xfa6c('0x23')](function(_0x1f3056){if(_0x1f3056){_0x3fc9f8=_0x1f3056;_0x2ec47b[_0xfa6c('0x2a')]=_['keys'](db[_0xfa6c('0x47')][_0xfa6c('0x40')]);_0x2ec47b[_0xfa6c('0x2b')]=_[_0xfa6c('0x2c')](_0x411fa4[_0xfa6c('0x2b')]);_0x2ec47b[_0xfa6c('0x2d')]=_[_0xfa6c('0x2e')](_0x2ec47b[_0xfa6c('0x2a')],_0x2ec47b[_0xfa6c('0x2b')]);_0x498bde[_0xfa6c('0x2f')]=_[_0xfa6c('0x2e')](_0x2ec47b[_0xfa6c('0x2a')],qs[_0xfa6c('0x30')](_0x411fa4[_0xfa6c('0x2b')][_0xfa6c('0x30')]));_0x498bde[_0xfa6c('0x2f')]=_0x498bde[_0xfa6c('0x2f')][_0xfa6c('0x31')]?_0x498bde[_0xfa6c('0x2f')]:_0x2ec47b[_0xfa6c('0x2a')];_0x498bde[_0xfa6c('0x34')]=qs[_0xfa6c('0x48')](_0x411fa4[_0xfa6c('0x2b')][_0xfa6c('0x48')]);_0x498bde['where']=qs[_0xfa6c('0x2d')](_[_0xfa6c('0x36')](_0x411fa4[_0xfa6c('0x2b')],_0x2ec47b[_0xfa6c('0x2d')]));if(_0x411fa4[_0xfa6c('0x2b')][_0xfa6c('0x49')]){_0x498bde[_0xfa6c('0x35')]=_['merge'](_0x498bde[_0xfa6c('0x35')],{'$or':_[_0xfa6c('0x27')](_0x498bde[_0xfa6c('0x2f')],function(_0x4c4f5b){var _0x22aefc={};_0x22aefc[_0x4c4f5b]={'$like':'%'+_0x411fa4[_0xfa6c('0x2b')][_0xfa6c('0x49')]+'%'};return _0x22aefc;})});}_0x498bde=_['merge']({},_0x498bde,_0x411fa4['options']);return _0x3fc9f8[_0xfa6c('0x45')](_0x498bde);}})[_0xfa6c('0x23')](function(_0x376c87){if(_0x376c87){_0x3a162f=_0x376c87[_0xfa6c('0x31')];if(!_0x411fa4['query']['hasOwnProperty'](_0xfa6c('0x33'))){_0x498bde[_0xfa6c('0x1d')]=qs[_0xfa6c('0x1d')](_0x411fa4[_0xfa6c('0x2b')][_0xfa6c('0x1d')]);_0x498bde['offset']=qs[_0xfa6c('0x1a')](_0x411fa4[_0xfa6c('0x2b')][_0xfa6c('0x1a')]);}return _0x3fc9f8[_0xfa6c('0x45')](_0x498bde);}})[_0xfa6c('0x23')](function(_0x34ee3e){if(_0x34ee3e){return _0x34ee3e?{'count':_0x3a162f,'rows':_0x34ee3e}:null;}})['then'](respondWithResult(_0x525fc8,null))[_0xfa6c('0x3e')](handleError(_0x525fc8,null));};exports[_0xfa6c('0x4a')]=function(_0x3896ce,_0x25a35e,_0xb5f21f){if(_0x3896ce[_0xfa6c('0x43')]['id']){delete _0x3896ce[_0xfa6c('0x43')]['id'];}return db[_0xfa6c('0x3a')][_0xfa6c('0x46')]({'where':{'id':_0x3896ce[_0xfa6c('0x3f')]['id']}})['then'](handleEntityNotFound(_0x25a35e,null))[_0xfa6c('0x23')](function(_0x45fc45){if(_0x45fc45){_0x3896ce['body'][_0xfa6c('0x4b')]=_0x45fc45['id'];_0x3896ce[_0xfa6c('0x43')]['Subjects']=integrations[_0xfa6c('0x4c')](_0x3896ce['body'][_0xfa6c('0x4d')],_0x3896ce[_0xfa6c('0x43')]['type']);_0x3896ce['body']['Descriptions']=integrations[_0xfa6c('0x4e')](_0x3896ce[_0xfa6c('0x43')][_0xfa6c('0x4d')],_0x3896ce[_0xfa6c('0x43')][_0xfa6c('0x29')]);return db['SalesforceConfiguration'][_0xfa6c('0x42')](_0x3896ce[_0xfa6c('0x43')],{'include':[{'model':db['SalesforceField'],'as':_0xfa6c('0x4f')},{'model':db[_0xfa6c('0x50')],'as':_0xfa6c('0x51')}]});}return null;})[_0xfa6c('0x23')](respondWithResult(_0x25a35e,null))[_0xfa6c('0x3e')](handleError(_0x25a35e,null));};exports['getFields']=function(_0x2dbc27,_0x11a771,_0x1a7432){var _0x513573;var _0x5da7bb='';var _0x800669='Task';return db[_0xfa6c('0x3a')]['findOne']({'where':{'id':_0x2dbc27[_0xfa6c('0x3f')]['id']},'attributes':['id','remoteUri',_0xfa6c('0x52'),'clientSecret','username',_0xfa6c('0x53'),_0xfa6c('0x54')]})['then'](handleEntityNotFound(_0x11a771,null))['then'](function(_0x5ba411){if(_0x5ba411){_0x5da7bb=_0x5ba411[_0xfa6c('0x55')];var _0xf2bb4b=_0x5da7bb[_0xfa6c('0x56')](-0x1);if(_0xf2bb4b==='/'){_0x5da7bb=_0x5da7bb[_0xfa6c('0x57')](0x0,_0x5da7bb[_0xfa6c('0x58')](_0xf2bb4b));}_0x513573=new jsforce[(_0xfa6c('0x59'))]({'oauth2':{'loginUrl':_0x5da7bb,'clientId':_0x5ba411[_0xfa6c('0x52')],'clientSecret':_0x5ba411[_0xfa6c('0x5a')]}});return _0x513573[_0xfa6c('0x5b')](_0x5ba411['username'],_0x5ba411[_0xfa6c('0x53')][_0xfa6c('0x5c')](_0x5ba411['securityToken']));}})[_0xfa6c('0x23')](function(_0x57017e){if(_0x57017e){if(!_[_0xfa6c('0x5d')](_0x2dbc27[_0xfa6c('0x2b')][_0xfa6c('0x5e')])){_0x800669=_0x2dbc27[_0xfa6c('0x2b')]['ticketType'];}return _0x513573[_0xfa6c('0x5f')](_0x800669)[_0xfa6c('0x60')]();}})[_0xfa6c('0x23')](function(_0x366e29){var _0x36865e=['OwnerId','ActivityDate',_0xfa6c('0x61'),'IsRecurrence',_0xfa6c('0x62'),_0xfa6c('0x63')];var _0x3d31e5=[_0xfa6c('0x64'),_0xfa6c('0x65'),_0xfa6c('0x66'),_0xfa6c('0x67'),_0xfa6c('0x68'),_0xfa6c('0x69'),_0xfa6c('0x6a')];if(_0x366e29){_['remove'](_0x366e29[_0xfa6c('0x30')],function(_0x3541f4){return _0x36865e['includes'](_0x3541f4[_0xfa6c('0x26')])||!_0x3d31e5[_0xfa6c('0x6b')](_0x3541f4[_0xfa6c('0x29')]);});return{'count':_0x366e29[_0xfa6c('0x30')]['length'],'rows':_['map'](_0x366e29[_0xfa6c('0x30')],function(_0x39355b){return{'id':_0x39355b[_0xfa6c('0x26')],'name':_0x39355b['label'],'custom':_0x39355b[_0xfa6c('0x6c')],'options':_0x39355b[_0xfa6c('0x6d')]['length']>0x0?_['map'](_0x39355b['picklistValues'],function(_0x2cef47){return{'name':_0x2cef47[_0xfa6c('0x6e')],'value':_0x2cef47['value']};}):_0x39355b[_0xfa6c('0x29')]=='boolean'?[{'name':_0xfa6c('0x6f'),'value':_0xfa6c('0x70')},{'name':_0xfa6c('0x71'),'value':_0xfa6c('0x72')}]:[]};})};}})[_0xfa6c('0x23')](respondWithResult(_0x11a771,null))['catch'](function(_0x4cbeef){var _0x1a0d1e=_0x2dbc27[_0xfa6c('0x2b')][_0xfa6c('0x73')]?0x1f4:_0x4cbeef[_0xfa6c('0x74')]||0x1f4;logger[_0xfa6c('0x24')](_0xfa6c('0x75'),_0xfa6c('0x76'),_0x1a0d1e,JSON[_0xfa6c('0x77')](_0x4cbeef));delete _0x4cbeef[_0xfa6c('0x26')];if(_0x1a0d1e===0x191){_0x1a0d1e=0x190;}_0x11a771[_0xfa6c('0x17')](_0x1a0d1e)['send'](_0x2dbc27[_0xfa6c('0x2b')][_0xfa6c('0x73')]?{'message':'Wrong\x20credentials','statusCode':_0x4cbeef[_0xfa6c('0x74')]}:_0x4cbeef);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 9148aea..6c9ff88 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 _0x18af=['lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts'];(function(_0x25091b,_0x4632fb){var _0x134c8d=function(_0x20d989){while(--_0x20d989){_0x25091b['push'](_0x25091b['shift']());}};_0x134c8d(++_0x4632fb);}(_0x18af,0x17a));var _0xf18a=function(_0x322c46,_0x4ae9e8){_0x322c46=_0x322c46-0x0;var _0x5032b5=_0x18af[_0x322c46];return _0x5032b5;};'use strict';var _=require(_0xf18a('0x0'));var util=require(_0xf18a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf18a('0x2'));var BPromise=require(_0xf18a('0x3'));var rp=require(_0xf18a('0x4'));var fs=require('fs');var path=require(_0xf18a('0x5'));var rimraf=require(_0xf18a('0x6'));var config=require(_0xf18a('0x7'));var attributes=require(_0xf18a('0x8'));var integrations=require(_0xf18a('0x9'));module[_0xf18a('0xa')]=function(_0x7e1886,_0x5b7d8a){return _0x7e1886[_0xf18a('0xb')](_0xf18a('0xc'),attributes,{'tableName':_0xf18a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9205=['SalesforceAccount','int_salesforce_accounts','lodash','util','api','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x1648b1,_0x46ea78){var _0x4af6d2=function(_0x25f3b0){while(--_0x25f3b0){_0x1648b1['push'](_0x1648b1['shift']());}};_0x4af6d2(++_0x46ea78);}(_0x9205,0x7a));var _0x5920=function(_0x59c945,_0x21d81d){_0x59c945=_0x59c945-0x0;var _0x46cb12=_0x9205[_0x59c945];return _0x46cb12;};'use strict';var _=require(_0x5920('0x0'));var util=require(_0x5920('0x1'));var logger=require('../../config/logger')(_0x5920('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5920('0x3'));var config=require(_0x5920('0x4'));var attributes=require(_0x5920('0x5'));var integrations=require(_0x5920('0x6'));module[_0x5920('0x7')]=function(_0x3afeb7,_0x4efc0e){return _0x3afeb7['define'](_0x5920('0x8'),attributes,{'tableName':_0x5920('0x9'),'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 636d123..6044f74 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 _0x84c0=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','GetSalesforceAccount','SalesforceAccount','findAll','raw','options','where','attributes','limit','include','map','model','catch','ShowSalesforceAccount','find','lodash','util','moment'];(function(_0x39609a,_0x28a563){var _0xecd92=function(_0x57241a){while(--_0x57241a){_0x39609a['push'](_0x39609a['shift']());}};_0xecd92(++_0x28a563);}(_0x84c0,0x99));var _0x084c=function(_0x3ddb9c,_0x3aaafb){_0x3ddb9c=_0x3ddb9c-0x0;var _0x43a775=_0x84c0[_0x3ddb9c];return _0x43a775;};'use strict';var _=require(_0x084c('0x0'));var util=require(_0x084c('0x1'));var moment=require(_0x084c('0x2'));var BPromise=require(_0x084c('0x3'));var rs=require(_0x084c('0x4'));var fs=require('fs');var Redis=require(_0x084c('0x5'));var db=require(_0x084c('0x6'))['db'];var utils=require(_0x084c('0x7'));var logger=require(_0x084c('0x8'))(_0x084c('0x9'));var config=require(_0x084c('0xa'));var jayson=require(_0x084c('0xb'));var client=jayson[_0x084c('0xc')][_0x084c('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1462a5,_0x4bd3f1,_0x405c91){return new BPromise(function(_0x3a429d,_0x7db0ae){return client[_0x084c('0xe')](_0x1462a5,_0x405c91)[_0x084c('0xf')](function(_0x6a6a4d){logger[_0x084c('0x10')](_0x084c('0x11'),_0x4bd3f1,'request\x20sent');logger[_0x084c('0x12')](_0x084c('0x13'),_0x4bd3f1,'request\x20sent',JSON[_0x084c('0x14')](_0x6a6a4d));if(_0x6a6a4d['error']){if(_0x6a6a4d[_0x084c('0x15')]['code']===0x1f4){logger[_0x084c('0x15')](_0x084c('0x11'),_0x4bd3f1,_0x6a6a4d['error']['message']);return _0x7db0ae(_0x6a6a4d['error'][_0x084c('0x16')]);}logger[_0x084c('0x15')](_0x084c('0x11'),_0x4bd3f1,_0x6a6a4d[_0x084c('0x15')][_0x084c('0x16')]);return _0x3a429d(_0x6a6a4d['error'][_0x084c('0x16')]);}else{logger[_0x084c('0x10')](_0x084c('0x11'),_0x4bd3f1,_0x084c('0x17'));_0x3a429d(_0x6a6a4d[_0x084c('0x18')][_0x084c('0x16')]);}})['catch'](function(_0x57787e){logger[_0x084c('0x15')]('SalesforceAccount,\x20%s,\x20%s',_0x4bd3f1,_0x57787e);_0x7db0ae(_0x57787e);});});}exports[_0x084c('0x19')]=function(_0x1d8968){var _0x48910e=this;return new Promise(function(_0xe76fb0,_0x328d78){return db[_0x084c('0x1a')][_0x084c('0x1b')]({'raw':_0x1d8968['options']?_0x1d8968['options'][_0x084c('0x1c')]===undefined?!![]:![]:!![],'where':_0x1d8968[_0x084c('0x1d')]?_0x1d8968[_0x084c('0x1d')][_0x084c('0x1e')]||null:null,'attributes':_0x1d8968['options']?_0x1d8968[_0x084c('0x1d')][_0x084c('0x1f')]||null:null,'limit':_0x1d8968[_0x084c('0x1d')]?_0x1d8968[_0x084c('0x1d')][_0x084c('0x20')]||null:null,'include':_0x1d8968[_0x084c('0x1d')]?_0x1d8968[_0x084c('0x1d')][_0x084c('0x21')]?_[_0x084c('0x22')](_0x1d8968[_0x084c('0x1d')]['include'],function(_0x55e093){return{'model':db[_0x55e093[_0x084c('0x23')]],'as':_0x55e093['as'],'attributes':_0x55e093[_0x084c('0x1f')],'include':_0x55e093[_0x084c('0x21')]?_['map'](_0x55e093['include'],function(_0x36be54){return{'model':db[_0x36be54[_0x084c('0x23')]],'as':_0x36be54['as'],'attributes':_0x36be54[_0x084c('0x1f')],'include':_0x36be54[_0x084c('0x21')]?_['map'](_0x36be54['include'],function(_0x11becc){return{'model':db[_0x11becc[_0x084c('0x23')]],'as':_0x11becc['as'],'attributes':_0x11becc['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e49bc){logger['info'](_0x084c('0x19'),_0x1d8968);logger[_0x084c('0x12')](_0x084c('0x19'),_0x1d8968,JSON[_0x084c('0x14')](_0x5e49bc));_0xe76fb0(_0x5e49bc);})[_0x084c('0x24')](function(_0x3990b9){logger[_0x084c('0x15')](_0x084c('0x19'),_0x3990b9[_0x084c('0x16')],_0x1d8968);_0x328d78(_0x48910e[_0x084c('0x15')](0x1f4,_0x3990b9[_0x084c('0x16')]));});});};exports[_0x084c('0x25')]=function(_0x180251){var _0x5e9034=this;return new Promise(function(_0x431146,_0x45cb42){return db[_0x084c('0x1a')][_0x084c('0x26')]({'raw':_0x180251[_0x084c('0x1d')]?_0x180251[_0x084c('0x1d')][_0x084c('0x1c')]===undefined?!![]:![]:!![],'where':_0x180251['options']?_0x180251[_0x084c('0x1d')][_0x084c('0x1e')]||null:null,'attributes':_0x180251['options']?_0x180251[_0x084c('0x1d')][_0x084c('0x1f')]||null:null,'include':_0x180251['options']?_0x180251[_0x084c('0x1d')]['include']?_[_0x084c('0x22')](_0x180251[_0x084c('0x1d')][_0x084c('0x21')],function(_0x3ddebd){return{'model':db[_0x3ddebd[_0x084c('0x23')]],'as':_0x3ddebd['as'],'attributes':_0x3ddebd[_0x084c('0x1f')],'include':_0x3ddebd[_0x084c('0x21')]?_[_0x084c('0x22')](_0x3ddebd[_0x084c('0x21')],function(_0x26db94){return{'model':db[_0x26db94[_0x084c('0x23')]],'as':_0x26db94['as'],'attributes':_0x26db94['attributes'],'include':_0x26db94[_0x084c('0x21')]?_[_0x084c('0x22')](_0x26db94['include'],function(_0x157b56){return{'model':db[_0x157b56[_0x084c('0x23')]],'as':_0x157b56['as'],'attributes':_0x157b56[_0x084c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x084c('0xf')](function(_0x42d12a){logger['info']('ShowSalesforceAccount',_0x180251);logger[_0x084c('0x12')](_0x084c('0x25'),_0x180251,JSON[_0x084c('0x14')](_0x42d12a));_0x431146(_0x42d12a);})[_0x084c('0x24')](function(_0x2434d6){logger['error'](_0x084c('0x25'),_0x2434d6[_0x084c('0x16')],_0x180251);_0x45cb42(_0x5e9034[_0x084c('0x15')](0x1f4,_0x2434d6['message']));});});}; \ No newline at end of file +var _0x9bc1=['findAll','options','raw','where','attributes','limit','include','model','map','ShowSalesforceAccount','SalesforceAccount','find','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetSalesforceAccount'];(function(_0x241811,_0x35ca5f){var _0x1d1e76=function(_0x5c024e){while(--_0x5c024e){_0x241811['push'](_0x241811['shift']());}};_0x1d1e76(++_0x35ca5f);}(_0x9bc1,0x163));var _0x19bc=function(_0x188650,_0xc40d8){_0x188650=_0x188650-0x0;var _0x4db216=_0x9bc1[_0x188650];return _0x4db216;};'use strict';var _=require(_0x19bc('0x0'));var util=require(_0x19bc('0x1'));var moment=require(_0x19bc('0x2'));var BPromise=require(_0x19bc('0x3'));var rs=require(_0x19bc('0x4'));var fs=require('fs');var Redis=require(_0x19bc('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x19bc('0x6'));var logger=require(_0x19bc('0x7'))(_0x19bc('0x8'));var config=require(_0x19bc('0x9'));var jayson=require(_0x19bc('0xa'));var client=jayson[_0x19bc('0xb')][_0x19bc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5bf6ca,_0xb3af4a,_0x482fb2){return new BPromise(function(_0x2f0530,_0x4e7467){return client[_0x19bc('0xd')](_0x5bf6ca,_0x482fb2)[_0x19bc('0xe')](function(_0x4d2ff6){logger[_0x19bc('0xf')](_0x19bc('0x10'),_0xb3af4a,'request\x20sent');logger[_0x19bc('0x11')](_0x19bc('0x12'),_0xb3af4a,_0x19bc('0x13'),JSON['stringify'](_0x4d2ff6));if(_0x4d2ff6['error']){if(_0x4d2ff6[_0x19bc('0x14')][_0x19bc('0x15')]===0x1f4){logger['error'](_0x19bc('0x10'),_0xb3af4a,_0x4d2ff6[_0x19bc('0x14')][_0x19bc('0x16')]);return _0x4e7467(_0x4d2ff6[_0x19bc('0x14')]['message']);}logger[_0x19bc('0x14')]('SalesforceAccount,\x20%s,\x20%s',_0xb3af4a,_0x4d2ff6['error'][_0x19bc('0x16')]);return _0x2f0530(_0x4d2ff6[_0x19bc('0x14')][_0x19bc('0x16')]);}else{logger['info']('SalesforceAccount,\x20%s,\x20%s',_0xb3af4a,_0x19bc('0x13'));_0x2f0530(_0x4d2ff6['result'][_0x19bc('0x16')]);}})[_0x19bc('0x17')](function(_0x4a23a7){logger[_0x19bc('0x14')](_0x19bc('0x10'),_0xb3af4a,_0x4a23a7);_0x4e7467(_0x4a23a7);});});}exports[_0x19bc('0x18')]=function(_0x9d2fea){var _0x18f336=this;return new Promise(function(_0x561f5f,_0x76b620){return db['SalesforceAccount'][_0x19bc('0x19')]({'raw':_0x9d2fea['options']?_0x9d2fea[_0x19bc('0x1a')][_0x19bc('0x1b')]===undefined?!![]:![]:!![],'where':_0x9d2fea[_0x19bc('0x1a')]?_0x9d2fea[_0x19bc('0x1a')][_0x19bc('0x1c')]||null:null,'attributes':_0x9d2fea[_0x19bc('0x1a')]?_0x9d2fea[_0x19bc('0x1a')][_0x19bc('0x1d')]||null:null,'limit':_0x9d2fea[_0x19bc('0x1a')]?_0x9d2fea[_0x19bc('0x1a')][_0x19bc('0x1e')]||null:null,'include':_0x9d2fea[_0x19bc('0x1a')]?_0x9d2fea[_0x19bc('0x1a')][_0x19bc('0x1f')]?_['map'](_0x9d2fea[_0x19bc('0x1a')][_0x19bc('0x1f')],function(_0x341b26){return{'model':db[_0x341b26[_0x19bc('0x20')]],'as':_0x341b26['as'],'attributes':_0x341b26[_0x19bc('0x1d')],'include':_0x341b26[_0x19bc('0x1f')]?_[_0x19bc('0x21')](_0x341b26[_0x19bc('0x1f')],function(_0xba7128){return{'model':db[_0xba7128['model']],'as':_0xba7128['as'],'attributes':_0xba7128[_0x19bc('0x1d')],'include':_0xba7128[_0x19bc('0x1f')]?_[_0x19bc('0x21')](_0xba7128[_0x19bc('0x1f')],function(_0x2ad5a7){return{'model':db[_0x2ad5a7[_0x19bc('0x20')]],'as':_0x2ad5a7['as'],'attributes':_0x2ad5a7['attributes']};}):[]};}):[]};}):[]:[]})[_0x19bc('0xe')](function(_0x272de6){logger[_0x19bc('0xf')](_0x19bc('0x18'),_0x9d2fea);logger[_0x19bc('0x11')]('GetSalesforceAccount',_0x9d2fea,JSON['stringify'](_0x272de6));_0x561f5f(_0x272de6);})[_0x19bc('0x17')](function(_0x187d00){logger[_0x19bc('0x14')](_0x19bc('0x18'),_0x187d00['message'],_0x9d2fea);_0x76b620(_0x18f336['error'](0x1f4,_0x187d00[_0x19bc('0x16')]));});});};exports[_0x19bc('0x22')]=function(_0x435c74){var _0x304b36=this;return new Promise(function(_0x17ecc5,_0x1b911e){return db[_0x19bc('0x23')][_0x19bc('0x24')]({'raw':_0x435c74['options']?_0x435c74[_0x19bc('0x1a')][_0x19bc('0x1b')]===undefined?!![]:![]:!![],'where':_0x435c74['options']?_0x435c74['options'][_0x19bc('0x1c')]||null:null,'attributes':_0x435c74['options']?_0x435c74[_0x19bc('0x1a')]['attributes']||null:null,'include':_0x435c74['options']?_0x435c74[_0x19bc('0x1a')][_0x19bc('0x1f')]?_[_0x19bc('0x21')](_0x435c74[_0x19bc('0x1a')]['include'],function(_0x50d54d){return{'model':db[_0x50d54d['model']],'as':_0x50d54d['as'],'attributes':_0x50d54d[_0x19bc('0x1d')],'include':_0x50d54d[_0x19bc('0x1f')]?_[_0x19bc('0x21')](_0x50d54d['include'],function(_0x241dbe){return{'model':db[_0x241dbe[_0x19bc('0x20')]],'as':_0x241dbe['as'],'attributes':_0x241dbe[_0x19bc('0x1d')],'include':_0x241dbe[_0x19bc('0x1f')]?_[_0x19bc('0x21')](_0x241dbe[_0x19bc('0x1f')],function(_0x559c26){return{'model':db[_0x559c26[_0x19bc('0x20')]],'as':_0x559c26['as'],'attributes':_0x559c26[_0x19bc('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x304566){logger[_0x19bc('0xf')](_0x19bc('0x22'),_0x435c74);logger['debug'](_0x19bc('0x22'),_0x435c74,JSON[_0x19bc('0x25')](_0x304566));_0x17ecc5(_0x304566);})[_0x19bc('0x17')](function(_0x78257c){logger[_0x19bc('0x14')](_0x19bc('0x22'),_0x78257c[_0x19bc('0x16')],_0x435c74);_0x1b911e(_0x304b36[_0x19bc('0x14')](0x1f4,_0x78257c['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 5f5b27c..8d34b04 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x1e4dba,_0x410bbe){var _0x3b57e0=function(_0x589e82){while(--_0x589e82){_0x1e4dba['push'](_0x1e4dba['shift']());}};_0x3b57e0(++_0x410bbe);}(_0x5f66,0x1a0));var _0x65f6=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x5f66[_0x122096];return _0x3d1966;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file +var _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x51fe5f,_0x1d8632){var _0x4abce9=function(_0x34afb7){while(--_0x34afb7){_0x51fe5f['push'](_0x51fe5f['shift']());}};_0x4abce9(++_0x1d8632);}(_0x0b0e,0x187));var _0xe0b0=function(_0x27d8bc,_0x19e010){_0x27d8bc=_0x27d8bc-0x0;var _0x4b04cb=_0x0b0e[_0x27d8bc];return _0x4b04cb;};'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['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index fc89226..24ed46f 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 _0x0e1c=['Task','Case','contact','lead','nothing','sequelize','exports','STRING','ENUM'];(function(_0x277175,_0xfff76b){var _0x569b56=function(_0x1ca175){while(--_0x1ca175){_0x277175['push'](_0x277175['shift']());}};_0x569b56(++_0xfff76b);}(_0x0e1c,0x101));var _0xc0e1=function(_0x4776b0,_0x2fefc0){_0x4776b0=_0x4776b0-0x0;var _0x167234=_0x0e1c[_0x4776b0];return _0x167234;};'use strict';var Sequelize=require(_0xc0e1('0x0'));module[_0xc0e1('0x1')]={'name':{'type':Sequelize[_0xc0e1('0x2')]},'description':{'type':Sequelize[_0xc0e1('0x2')]},'ticketType':{'type':Sequelize[_0xc0e1('0x3')](_0xc0e1('0x4'),_0xc0e1('0x5')),'defaultValue':_0xc0e1('0x4')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0xc0e1('0x6'),_0xc0e1('0x7'),'account_contact_lead','account'),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize['ENUM'](_0xc0e1('0x8'),_0xc0e1('0x6'),_0xc0e1('0x7'),'account'),'defaultValue':_0xc0e1('0x7')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0xc0e1('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xc0e1('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xc0e1('0x2')]}}; \ No newline at end of file +var _0xf09d=['exports','STRING','ENUM','Task','Case','contact','account_contact_lead','account','contact_lead','nothing','sequelize'];(function(_0x4457f9,_0x29f0e6){var _0x316461=function(_0x3826b8){while(--_0x3826b8){_0x4457f9['push'](_0x4457f9['shift']());}};_0x316461(++_0x29f0e6);}(_0xf09d,0xf1));var _0xdf09=function(_0x4662e3,_0x3c9e27){_0x4662e3=_0x4662e3-0x0;var _0x3ab0e7=_0xf09d[_0x4662e3];return _0x3ab0e7;};'use strict';var Sequelize=require(_0xdf09('0x0'));module[_0xdf09('0x1')]={'name':{'type':Sequelize[_0xdf09('0x2')]},'description':{'type':Sequelize[_0xdf09('0x2')]},'ticketType':{'type':Sequelize[_0xdf09('0x3')](_0xdf09('0x4'),_0xdf09('0x5')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0xdf09('0x3')]('contact_lead',_0xdf09('0x6'),'lead',_0xdf09('0x7'),_0xdf09('0x8')),'defaultValue':_0xdf09('0x9')},'moduleCreate':{'type':Sequelize[_0xdf09('0x3')](_0xdf09('0xa'),'contact','lead',_0xdf09('0x8')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0xdf09('0x2')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0xdf09('0x2')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 54c41ef..066aae3 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 _0x6cca=['pick','filter','where','merge','options','count','includeAll','findAll','rows','catch','show','filters','length','include','create','body','find','params','findOne','SalesforceField','map','getSubjects','nolimit','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','destroy','status','sendStatus','error','stack','name','send','index','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort'];(function(_0xe12b75,_0x2dd56f){var _0x5ca25c=function(_0x4f387c){while(--_0x4f387c){_0xe12b75['push'](_0xe12b75['shift']());}};_0x5ca25c(++_0x2dd56f);}(_0x6cca,0x10e));var _0xa6cc=function(_0x2ab4d1,_0x22751f){_0x2ab4d1=_0x2ab4d1-0x0;var _0x4a76b6=_0x6cca[_0x2ab4d1];return _0x4a76b6;};'use strict';var emlformat=require(_0xa6cc('0x0'));var rimraf=require(_0xa6cc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa6cc('0x2'));var rp=require(_0xa6cc('0x3'));var moment=require(_0xa6cc('0x4'));var BPromise=require(_0xa6cc('0x5'));var Mustache=require('mustache');var util=require(_0xa6cc('0x6'));var path=require(_0xa6cc('0x7'));var sox=require(_0xa6cc('0x8'));var csv=require(_0xa6cc('0x9'));var ejs=require(_0xa6cc('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa6cc('0xb'));var squel=require(_0xa6cc('0xc'));var crypto=require(_0xa6cc('0xd'));var jsforce=require(_0xa6cc('0xe'));var deskjs=require(_0xa6cc('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa6cc('0x10'));var Papa=require('papaparse');var Redis=require(_0xa6cc('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa6cc('0x12'));var hardwareService=require(_0xa6cc('0x13'));var logger=require(_0xa6cc('0x14'))(_0xa6cc('0x15'));var utils=require('../../config/utils');var config=require(_0xa6cc('0x16'));var licenseUtil=require(_0xa6cc('0x17'));var db=require(_0xa6cc('0x18'))['db'];function respondWithStatusCode(_0x2a168d,_0x3df60d){_0x3df60d=_0x3df60d||0xcc;return function(_0x3d854f){if(_0x3d854f){return _0x2a168d['sendStatus'](_0x3df60d);}return _0x2a168d['status'](_0x3df60d)[_0xa6cc('0x19')]();};}function respondWithResult(_0x17c995,_0x4f7819){_0x4f7819=_0x4f7819||0xc8;return function(_0x2d50ff){if(_0x2d50ff){return _0x17c995['status'](_0x4f7819)[_0xa6cc('0x1a')](_0x2d50ff);}};}function respondWithFilteredResult(_0x3b797e,_0x27c2a6){return function(_0x7ac53b){if(_0x7ac53b){var _0xe9c74e=typeof _0x27c2a6[_0xa6cc('0x1b')]===_0xa6cc('0x1c')&&typeof _0x27c2a6[_0xa6cc('0x1d')]===_0xa6cc('0x1c');var _0x4271ae=_0x7ac53b['count'];var _0x2e9a62=_0xe9c74e?0x0:_0x27c2a6[_0xa6cc('0x1b')];var _0x1e2926=_0xe9c74e?_0x7ac53b['count']:_0x27c2a6[_0xa6cc('0x1b')]+_0x27c2a6[_0xa6cc('0x1d')];var _0x354700;if(_0x1e2926>=_0x4271ae){_0x1e2926=_0x4271ae;_0x354700=0xc8;}else{_0x354700=0xce;}_0x3b797e['status'](_0x354700);return _0x3b797e['set'](_0xa6cc('0x1e'),_0x2e9a62+'-'+_0x1e2926+'/'+_0x4271ae)[_0xa6cc('0x1a')](_0x7ac53b);}return null;};}function patchUpdates(_0x168abd){return function(_0x367cb5){try{jsonpatch[_0xa6cc('0x1f')](_0x367cb5,_0x168abd,!![]);}catch(_0x4a0c1c){return BPromise[_0xa6cc('0x20')](_0x4a0c1c);}return _0x367cb5[_0xa6cc('0x21')]();};}function saveUpdates(_0x10380d,_0x50d0ab){return function(_0x21b05c){if(_0x21b05c){return _0x21b05c[_0xa6cc('0x22')](_0x10380d)[_0xa6cc('0x23')](function(_0x3e13c3){return _0x3e13c3;});}return null;};}function removeEntity(_0xddaddc,_0x3ca6e3){return function(_0x371a00){if(_0x371a00){return _0x371a00[_0xa6cc('0x24')]()['then'](function(){_0xddaddc[_0xa6cc('0x25')](0xcc)[_0xa6cc('0x19')]();});}};}function handleEntityNotFound(_0x1aa1ba,_0x26e258){return function(_0x57ee3f){if(!_0x57ee3f){_0x1aa1ba[_0xa6cc('0x26')](0x194);}return _0x57ee3f;};}function handleError(_0x1b33b1,_0x5bf90e){_0x5bf90e=_0x5bf90e||0x1f4;return function(_0x68cf25){logger[_0xa6cc('0x27')](_0x68cf25[_0xa6cc('0x28')]);if(_0x68cf25[_0xa6cc('0x29')]){delete _0x68cf25['name'];}_0x1b33b1['status'](_0x5bf90e)[_0xa6cc('0x2a')](_0x68cf25);};}exports[_0xa6cc('0x2b')]=function(_0x20ba88,_0xa1fa7d){var _0x354cdd={},_0x804485={},_0x2340de={'count':0x0,'rows':[]};var _0x55eb9b=_['map'](db[_0xa6cc('0x2c')][_0xa6cc('0x2d')],function(_0x4cd9b2){return{'name':_0x4cd9b2[_0xa6cc('0x2e')],'type':_0x4cd9b2[_0xa6cc('0x2f')][_0xa6cc('0x30')]};});_0x804485[_0xa6cc('0x31')]=_['map'](_0x55eb9b,_0xa6cc('0x29'));_0x804485[_0xa6cc('0x32')]=_[_0xa6cc('0x33')](_0x20ba88['query']);_0x804485['filters']=_[_0xa6cc('0x34')](_0x804485[_0xa6cc('0x31')],_0x804485['query']);_0x354cdd[_0xa6cc('0x35')]=_[_0xa6cc('0x34')](_0x804485[_0xa6cc('0x31')],qs[_0xa6cc('0x36')](_0x20ba88[_0xa6cc('0x32')][_0xa6cc('0x36')]));_0x354cdd[_0xa6cc('0x35')]=_0x354cdd[_0xa6cc('0x35')]['length']?_0x354cdd[_0xa6cc('0x35')]:_0x804485['model'];if(!_0x20ba88[_0xa6cc('0x32')][_0xa6cc('0x37')]('nolimit')){_0x354cdd[_0xa6cc('0x1d')]=qs[_0xa6cc('0x1d')](_0x20ba88[_0xa6cc('0x32')][_0xa6cc('0x1d')]);_0x354cdd[_0xa6cc('0x1b')]=qs[_0xa6cc('0x1b')](_0x20ba88[_0xa6cc('0x32')][_0xa6cc('0x1b')]);}_0x354cdd[_0xa6cc('0x38')]=qs[_0xa6cc('0x39')](_0x20ba88[_0xa6cc('0x32')]['sort']);_0x354cdd['where']=qs['filters'](_[_0xa6cc('0x3a')](_0x20ba88[_0xa6cc('0x32')],_0x804485['filters']),_0x55eb9b);if(_0x20ba88[_0xa6cc('0x32')][_0xa6cc('0x3b')]){_0x354cdd[_0xa6cc('0x3c')]=_[_0xa6cc('0x3d')](_0x354cdd['where'],{'$or':_['map'](_0x55eb9b,function(_0x3b2bee){if(_0x3b2bee[_0xa6cc('0x2f')]!=='VIRTUAL'){var _0x23cfb3={};_0x23cfb3[_0x3b2bee[_0xa6cc('0x29')]]={'$like':'%'+_0x20ba88['query']['filter']+'%'};return _0x23cfb3;}})});}_0x354cdd=_[_0xa6cc('0x3d')]({},_0x354cdd,_0x20ba88[_0xa6cc('0x3e')]);var _0x430ebc={'where':_0x354cdd[_0xa6cc('0x3c')]};return db[_0xa6cc('0x2c')][_0xa6cc('0x3f')](_0x430ebc)[_0xa6cc('0x23')](function(_0x4af168){_0x2340de[_0xa6cc('0x3f')]=_0x4af168;if(_0x20ba88[_0xa6cc('0x32')][_0xa6cc('0x40')]){_0x354cdd['include']=[{'all':!![]}];}return db['SalesforceConfiguration'][_0xa6cc('0x41')](_0x354cdd);})[_0xa6cc('0x23')](function(_0xe64092){_0x2340de[_0xa6cc('0x42')]=_0xe64092;return _0x2340de;})['then'](respondWithFilteredResult(_0xa1fa7d,_0x354cdd))[_0xa6cc('0x43')](handleError(_0xa1fa7d,null));};exports[_0xa6cc('0x44')]=function(_0x2b6cbe,_0x276ae9){var _0x172f20={'raw':![],'where':{'id':_0x2b6cbe['params']['id']}},_0xcf72e1={};_0xcf72e1[_0xa6cc('0x31')]=_['keys'](db[_0xa6cc('0x2c')][_0xa6cc('0x2d')]);_0xcf72e1[_0xa6cc('0x32')]=_[_0xa6cc('0x33')](_0x2b6cbe[_0xa6cc('0x32')]);_0xcf72e1[_0xa6cc('0x45')]=_['intersection'](_0xcf72e1[_0xa6cc('0x31')],_0xcf72e1[_0xa6cc('0x32')]);_0x172f20['attributes']=_[_0xa6cc('0x34')](_0xcf72e1[_0xa6cc('0x31')],qs[_0xa6cc('0x36')](_0x2b6cbe[_0xa6cc('0x32')]['fields']));_0x172f20['attributes']=_0x172f20[_0xa6cc('0x35')][_0xa6cc('0x46')]?_0x172f20[_0xa6cc('0x35')]:_0xcf72e1[_0xa6cc('0x31')];if(_0x2b6cbe['query'][_0xa6cc('0x40')]){_0x172f20[_0xa6cc('0x47')]=[{'all':!![]}];}_0x172f20=_[_0xa6cc('0x3d')]({},_0x172f20,_0x2b6cbe[_0xa6cc('0x3e')]);return db[_0xa6cc('0x2c')]['find'](_0x172f20)[_0xa6cc('0x23')](handleEntityNotFound(_0x276ae9,null))[_0xa6cc('0x23')](respondWithResult(_0x276ae9,null))['catch'](handleError(_0x276ae9,null));};exports[_0xa6cc('0x48')]=function(_0x54be75,_0x411b62){return db[_0xa6cc('0x2c')][_0xa6cc('0x48')](_0x54be75[_0xa6cc('0x49')],{})[_0xa6cc('0x23')](respondWithResult(_0x411b62,0xc9))[_0xa6cc('0x43')](handleError(_0x411b62,null));};exports[_0xa6cc('0x22')]=function(_0xbd6282,_0x260275){if(_0xbd6282[_0xa6cc('0x49')]['id']){delete _0xbd6282[_0xa6cc('0x49')]['id'];}return db[_0xa6cc('0x2c')][_0xa6cc('0x4a')]({'where':{'id':_0xbd6282[_0xa6cc('0x4b')]['id']}})[_0xa6cc('0x23')](handleEntityNotFound(_0x260275,null))[_0xa6cc('0x23')](saveUpdates(_0xbd6282[_0xa6cc('0x49')],null))[_0xa6cc('0x23')](respondWithResult(_0x260275,null))[_0xa6cc('0x43')](handleError(_0x260275,null));};exports[_0xa6cc('0x24')]=function(_0x43a0f6,_0x3d8f47){return db[_0xa6cc('0x2c')]['find']({'where':{'id':_0x43a0f6[_0xa6cc('0x4b')]['id']}})[_0xa6cc('0x23')](handleEntityNotFound(_0x3d8f47,null))[_0xa6cc('0x23')](removeEntity(_0x3d8f47,null))[_0xa6cc('0x43')](handleError(_0x3d8f47,null));};exports['getFields']=function(_0x33fef0,_0x6ad6b6,_0x4380cb){var _0x433a8f={};var _0x221780={};var _0x431630;var _0x57b1a9;return db[_0xa6cc('0x2c')][_0xa6cc('0x4c')]({'where':{'id':_0x33fef0[_0xa6cc('0x4b')]['id']}})[_0xa6cc('0x23')](handleEntityNotFound(_0x6ad6b6,null))[_0xa6cc('0x23')](function(_0x3921dc){if(_0x3921dc){_0x431630=_0x3921dc;_0x221780['model']=_[_0xa6cc('0x33')](db[_0xa6cc('0x4d')][_0xa6cc('0x2d')]);_0x221780['query']=_[_0xa6cc('0x33')](_0x33fef0['query']);_0x221780[_0xa6cc('0x45')]=_[_0xa6cc('0x34')](_0x221780[_0xa6cc('0x31')],_0x221780[_0xa6cc('0x32')]);_0x433a8f[_0xa6cc('0x35')]=_[_0xa6cc('0x34')](_0x221780[_0xa6cc('0x31')],qs[_0xa6cc('0x36')](_0x33fef0[_0xa6cc('0x32')][_0xa6cc('0x36')]));_0x433a8f[_0xa6cc('0x35')]=_0x433a8f['attributes']['length']?_0x433a8f[_0xa6cc('0x35')]:_0x221780[_0xa6cc('0x31')];_0x433a8f[_0xa6cc('0x38')]=qs[_0xa6cc('0x39')](_0x33fef0['query']['sort']);_0x433a8f[_0xa6cc('0x3c')]=qs[_0xa6cc('0x45')](_[_0xa6cc('0x3a')](_0x33fef0[_0xa6cc('0x32')],_0x221780[_0xa6cc('0x45')]));if(_0x33fef0[_0xa6cc('0x32')]['filter']){_0x433a8f[_0xa6cc('0x3c')]=_[_0xa6cc('0x3d')](_0x433a8f['where'],{'$or':_[_0xa6cc('0x4e')](_0x433a8f[_0xa6cc('0x35')],function(_0x3cc01c){var _0x379b69={};_0x379b69[_0x3cc01c]={'$like':'%'+_0x33fef0[_0xa6cc('0x32')][_0xa6cc('0x3b')]+'%'};return _0x379b69;})});}_0x433a8f=_[_0xa6cc('0x3d')]({},_0x433a8f,_0x33fef0[_0xa6cc('0x3e')]);return _0x431630['getFields'](_0x433a8f);}})[_0xa6cc('0x23')](function(_0x24fde3){if(_0x24fde3){_0x57b1a9=_0x24fde3[_0xa6cc('0x46')];if(!_0x33fef0[_0xa6cc('0x32')][_0xa6cc('0x37')]('nolimit')){_0x433a8f[_0xa6cc('0x1d')]=qs['limit'](_0x33fef0['query'][_0xa6cc('0x1d')]);_0x433a8f[_0xa6cc('0x1b')]=qs[_0xa6cc('0x1b')](_0x33fef0[_0xa6cc('0x32')][_0xa6cc('0x1b')]);}return _0x431630['getFields'](_0x433a8f);}})[_0xa6cc('0x23')](function(_0x385eb9){if(_0x385eb9){return _0x385eb9?{'count':_0x57b1a9,'rows':_0x385eb9}:null;}})[_0xa6cc('0x23')](respondWithResult(_0x6ad6b6,null))[_0xa6cc('0x43')](handleError(_0x6ad6b6,null));};exports[_0xa6cc('0x4f')]=function(_0x11765e,_0xfe0462,_0x2039e5){var _0x3cb6cf={};var _0x584e21={};var _0x768325;var _0x15b0c6;return db[_0xa6cc('0x2c')]['findOne']({'where':{'id':_0x11765e[_0xa6cc('0x4b')]['id']}})[_0xa6cc('0x23')](handleEntityNotFound(_0xfe0462,null))[_0xa6cc('0x23')](function(_0x3c1fbd){if(_0x3c1fbd){_0x768325=_0x3c1fbd;_0x584e21[_0xa6cc('0x31')]=_[_0xa6cc('0x33')](db[_0xa6cc('0x4d')][_0xa6cc('0x2d')]);_0x584e21[_0xa6cc('0x32')]=_[_0xa6cc('0x33')](_0x11765e['query']);_0x584e21[_0xa6cc('0x45')]=_[_0xa6cc('0x34')](_0x584e21[_0xa6cc('0x31')],_0x584e21[_0xa6cc('0x32')]);_0x3cb6cf['attributes']=_[_0xa6cc('0x34')](_0x584e21['model'],qs[_0xa6cc('0x36')](_0x11765e[_0xa6cc('0x32')][_0xa6cc('0x36')]));_0x3cb6cf[_0xa6cc('0x35')]=_0x3cb6cf[_0xa6cc('0x35')][_0xa6cc('0x46')]?_0x3cb6cf[_0xa6cc('0x35')]:_0x584e21[_0xa6cc('0x31')];_0x3cb6cf[_0xa6cc('0x38')]=qs[_0xa6cc('0x39')](_0x11765e[_0xa6cc('0x32')][_0xa6cc('0x39')]);_0x3cb6cf[_0xa6cc('0x3c')]=qs[_0xa6cc('0x45')](_['pick'](_0x11765e[_0xa6cc('0x32')],_0x584e21['filters']));if(_0x11765e[_0xa6cc('0x32')][_0xa6cc('0x3b')]){_0x3cb6cf['where']=_['merge'](_0x3cb6cf[_0xa6cc('0x3c')],{'$or':_[_0xa6cc('0x4e')](_0x3cb6cf[_0xa6cc('0x35')],function(_0x481476){var _0x54f85f={};_0x54f85f[_0x481476]={'$like':'%'+_0x11765e[_0xa6cc('0x32')][_0xa6cc('0x3b')]+'%'};return _0x54f85f;})});}_0x3cb6cf=_[_0xa6cc('0x3d')]({},_0x3cb6cf,_0x11765e[_0xa6cc('0x3e')]);return _0x768325[_0xa6cc('0x4f')](_0x3cb6cf);}})[_0xa6cc('0x23')](function(_0x3628b9){if(_0x3628b9){_0x15b0c6=_0x3628b9[_0xa6cc('0x46')];if(!_0x11765e[_0xa6cc('0x32')][_0xa6cc('0x37')](_0xa6cc('0x50'))){_0x3cb6cf[_0xa6cc('0x1d')]=qs[_0xa6cc('0x1d')](_0x11765e[_0xa6cc('0x32')]['limit']);_0x3cb6cf['offset']=qs[_0xa6cc('0x1b')](_0x11765e[_0xa6cc('0x32')]['offset']);}return _0x768325[_0xa6cc('0x4f')](_0x3cb6cf);}})['then'](function(_0x1783ab){if(_0x1783ab){return _0x1783ab?{'count':_0x15b0c6,'rows':_0x1783ab}:null;}})[_0xa6cc('0x23')](respondWithResult(_0xfe0462,null))['catch'](handleError(_0xfe0462,null));};exports[_0xa6cc('0x51')]=function(_0x279df8,_0x24facb,_0x1ba21c){var _0x3564db={};var _0x3030ac={};var _0x5b940b;var _0x4e27ca;return db[_0xa6cc('0x2c')]['findOne']({'where':{'id':_0x279df8['params']['id']}})[_0xa6cc('0x23')](handleEntityNotFound(_0x24facb,null))[_0xa6cc('0x23')](function(_0x14900a){if(_0x14900a){_0x5b940b=_0x14900a;_0x3030ac[_0xa6cc('0x31')]=_['keys'](db[_0xa6cc('0x4d')][_0xa6cc('0x2d')]);_0x3030ac[_0xa6cc('0x32')]=_['keys'](_0x279df8[_0xa6cc('0x32')]);_0x3030ac[_0xa6cc('0x45')]=_['intersection'](_0x3030ac[_0xa6cc('0x31')],_0x3030ac['query']);_0x3564db['attributes']=_[_0xa6cc('0x34')](_0x3030ac['model'],qs['fields'](_0x279df8[_0xa6cc('0x32')]['fields']));_0x3564db[_0xa6cc('0x35')]=_0x3564db[_0xa6cc('0x35')][_0xa6cc('0x46')]?_0x3564db[_0xa6cc('0x35')]:_0x3030ac['model'];_0x3564db[_0xa6cc('0x38')]=qs[_0xa6cc('0x39')](_0x279df8[_0xa6cc('0x32')][_0xa6cc('0x39')]);_0x3564db[_0xa6cc('0x3c')]=qs[_0xa6cc('0x45')](_['pick'](_0x279df8['query'],_0x3030ac['filters']));if(_0x279df8[_0xa6cc('0x32')][_0xa6cc('0x3b')]){_0x3564db[_0xa6cc('0x3c')]=_[_0xa6cc('0x3d')](_0x3564db[_0xa6cc('0x3c')],{'$or':_['map'](_0x3564db[_0xa6cc('0x35')],function(_0x34e4b6){var _0x24d6d6={};_0x24d6d6[_0x34e4b6]={'$like':'%'+_0x279df8['query'][_0xa6cc('0x3b')]+'%'};return _0x24d6d6;})});}_0x3564db=_[_0xa6cc('0x3d')]({},_0x3564db,_0x279df8[_0xa6cc('0x3e')]);return _0x5b940b[_0xa6cc('0x51')](_0x3564db);}})['then'](function(_0x1eeb65){if(_0x1eeb65){_0x4e27ca=_0x1eeb65[_0xa6cc('0x46')];if(!_0x279df8['query'][_0xa6cc('0x37')](_0xa6cc('0x50'))){_0x3564db[_0xa6cc('0x1d')]=qs[_0xa6cc('0x1d')](_0x279df8[_0xa6cc('0x32')]['limit']);_0x3564db[_0xa6cc('0x1b')]=qs[_0xa6cc('0x1b')](_0x279df8[_0xa6cc('0x32')][_0xa6cc('0x1b')]);}return _0x5b940b[_0xa6cc('0x51')](_0x3564db);}})[_0xa6cc('0x23')](function(_0x53f7ec){if(_0x53f7ec){return _0x53f7ec?{'count':_0x4e27ca,'rows':_0x53f7ec}:null;}})[_0xa6cc('0x23')](respondWithResult(_0x24facb,null))['catch'](handleError(_0x24facb,null));}; \ No newline at end of file +var _0x939d=['update','then','end','error','name','index','SalesforceConfiguration','rawAttributes','fieldName','key','model','map','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','rows','show','params','length','find','catch','create','body','destroy','findOne','order','pick','getFields','SalesforceField','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','apply','reject','save'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x939d,0xcc));var _0xd939=function(_0x571ddd,_0x1f7948){_0x571ddd=_0x571ddd-0x0;var _0x28f096=_0x939d[_0x571ddd];return _0x28f096;};'use strict';var emlformat=require(_0xd939('0x0'));var rimraf=require(_0xd939('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd939('0x2'));var rp=require(_0xd939('0x3'));var moment=require(_0xd939('0x4'));var BPromise=require(_0xd939('0x5'));var Mustache=require(_0xd939('0x6'));var util=require(_0xd939('0x7'));var path=require(_0xd939('0x8'));var sox=require(_0xd939('0x9'));var csv=require(_0xd939('0xa'));var ejs=require(_0xd939('0xb'));var fs=require('fs');var fs_extra=require(_0xd939('0xc'));var _=require('lodash');var squel=require(_0xd939('0xd'));var crypto=require('crypto');var jsforce=require(_0xd939('0xe'));var deskjs=require(_0xd939('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd939('0x10'));var Papa=require(_0xd939('0x11'));var Redis=require(_0xd939('0x12'));var authService=require(_0xd939('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd939('0x14'));var logger=require(_0xd939('0x15'))(_0xd939('0x16'));var utils=require(_0xd939('0x17'));var config=require(_0xd939('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd939('0x19'))['db'];function respondWithStatusCode(_0x2aa7e5,_0x3235fd){_0x3235fd=_0x3235fd||0xcc;return function(_0x1c71b7){if(_0x1c71b7){return _0x2aa7e5[_0xd939('0x1a')](_0x3235fd);}return _0x2aa7e5[_0xd939('0x1b')](_0x3235fd)['end']();};}function respondWithResult(_0x964a60,_0xe00f04){_0xe00f04=_0xe00f04||0xc8;return function(_0x5cd6c1){if(_0x5cd6c1){return _0x964a60[_0xd939('0x1b')](_0xe00f04)['json'](_0x5cd6c1);}};}function respondWithFilteredResult(_0x887656,_0x51c425){return function(_0x28f8af){if(_0x28f8af){var _0xb4478c=typeof _0x51c425[_0xd939('0x1c')]===_0xd939('0x1d')&&typeof _0x51c425[_0xd939('0x1e')]==='undefined';var _0x45842f=_0x28f8af[_0xd939('0x1f')];var _0x422259=_0xb4478c?0x0:_0x51c425[_0xd939('0x1c')];var _0xefc62a=_0xb4478c?_0x28f8af[_0xd939('0x1f')]:_0x51c425[_0xd939('0x1c')]+_0x51c425[_0xd939('0x1e')];var _0x248830;if(_0xefc62a>=_0x45842f){_0xefc62a=_0x45842f;_0x248830=0xc8;}else{_0x248830=0xce;}_0x887656[_0xd939('0x1b')](_0x248830);return _0x887656[_0xd939('0x20')]('Content-Range',_0x422259+'-'+_0xefc62a+'/'+_0x45842f)['json'](_0x28f8af);}return null;};}function patchUpdates(_0x20d5d3){return function(_0x38ebb6){try{jsonpatch[_0xd939('0x21')](_0x38ebb6,_0x20d5d3,!![]);}catch(_0x1440b1){return BPromise[_0xd939('0x22')](_0x1440b1);}return _0x38ebb6[_0xd939('0x23')]();};}function saveUpdates(_0x2c3a24,_0x57eb7d){return function(_0x4aaa97){if(_0x4aaa97){return _0x4aaa97[_0xd939('0x24')](_0x2c3a24)[_0xd939('0x25')](function(_0x22d71e){return _0x22d71e;});}return null;};}function removeEntity(_0x4614b4,_0x3a8368){return function(_0x749b08){if(_0x749b08){return _0x749b08['destroy']()[_0xd939('0x25')](function(){_0x4614b4[_0xd939('0x1b')](0xcc)[_0xd939('0x26')]();});}};}function handleEntityNotFound(_0x37edcf,_0xf508a3){return function(_0x42d77a){if(!_0x42d77a){_0x37edcf[_0xd939('0x1a')](0x194);}return _0x42d77a;};}function handleError(_0x163008,_0x228aa6){_0x228aa6=_0x228aa6||0x1f4;return function(_0x2170f7){logger[_0xd939('0x27')](_0x2170f7['stack']);if(_0x2170f7[_0xd939('0x28')]){delete _0x2170f7[_0xd939('0x28')];}_0x163008[_0xd939('0x1b')](_0x228aa6)['send'](_0x2170f7);};}exports[_0xd939('0x29')]=function(_0x1821ff,_0x31cdb9){var _0xe964e5={},_0x5025b6={},_0xd078a3={'count':0x0,'rows':[]};var _0x1087fe=_['map'](db[_0xd939('0x2a')][_0xd939('0x2b')],function(_0x234e3c){return{'name':_0x234e3c[_0xd939('0x2c')],'type':_0x234e3c['type'][_0xd939('0x2d')]};});_0x5025b6[_0xd939('0x2e')]=_[_0xd939('0x2f')](_0x1087fe,_0xd939('0x28'));_0x5025b6['query']=_[_0xd939('0x30')](_0x1821ff[_0xd939('0x31')]);_0x5025b6['filters']=_[_0xd939('0x32')](_0x5025b6[_0xd939('0x2e')],_0x5025b6[_0xd939('0x31')]);_0xe964e5[_0xd939('0x33')]=_[_0xd939('0x32')](_0x5025b6[_0xd939('0x2e')],qs[_0xd939('0x34')](_0x1821ff[_0xd939('0x31')][_0xd939('0x34')]));_0xe964e5[_0xd939('0x33')]=_0xe964e5[_0xd939('0x33')]['length']?_0xe964e5[_0xd939('0x33')]:_0x5025b6[_0xd939('0x2e')];if(!_0x1821ff['query'][_0xd939('0x35')](_0xd939('0x36'))){_0xe964e5[_0xd939('0x1e')]=qs[_0xd939('0x1e')](_0x1821ff[_0xd939('0x31')][_0xd939('0x1e')]);_0xe964e5[_0xd939('0x1c')]=qs[_0xd939('0x1c')](_0x1821ff[_0xd939('0x31')][_0xd939('0x1c')]);}_0xe964e5['order']=qs[_0xd939('0x37')](_0x1821ff[_0xd939('0x31')]['sort']);_0xe964e5[_0xd939('0x38')]=qs['filters'](_['pick'](_0x1821ff[_0xd939('0x31')],_0x5025b6[_0xd939('0x39')]),_0x1087fe);if(_0x1821ff[_0xd939('0x31')][_0xd939('0x3a')]){_0xe964e5['where']=_['merge'](_0xe964e5['where'],{'$or':_[_0xd939('0x2f')](_0x1087fe,function(_0xde7d43){if(_0xde7d43['type']!==_0xd939('0x3b')){var _0x4dad9d={};_0x4dad9d[_0xde7d43[_0xd939('0x28')]]={'$like':'%'+_0x1821ff['query']['filter']+'%'};return _0x4dad9d;}})});}_0xe964e5=_[_0xd939('0x3c')]({},_0xe964e5,_0x1821ff[_0xd939('0x3d')]);var _0xf98bc8={'where':_0xe964e5[_0xd939('0x38')]};return db[_0xd939('0x2a')][_0xd939('0x1f')](_0xf98bc8)[_0xd939('0x25')](function(_0x256934){_0xd078a3[_0xd939('0x1f')]=_0x256934;if(_0x1821ff['query'][_0xd939('0x3e')]){_0xe964e5[_0xd939('0x3f')]=[{'all':!![]}];}return db[_0xd939('0x2a')]['findAll'](_0xe964e5);})[_0xd939('0x25')](function(_0x558115){_0xd078a3[_0xd939('0x40')]=_0x558115;return _0xd078a3;})[_0xd939('0x25')](respondWithFilteredResult(_0x31cdb9,_0xe964e5))['catch'](handleError(_0x31cdb9,null));};exports[_0xd939('0x41')]=function(_0x114821,_0x5e36c6){var _0x476fbb={'raw':![],'where':{'id':_0x114821[_0xd939('0x42')]['id']}},_0x53351f={};_0x53351f[_0xd939('0x2e')]=_[_0xd939('0x30')](db[_0xd939('0x2a')]['rawAttributes']);_0x53351f[_0xd939('0x31')]=_['keys'](_0x114821[_0xd939('0x31')]);_0x53351f[_0xd939('0x39')]=_[_0xd939('0x32')](_0x53351f[_0xd939('0x2e')],_0x53351f[_0xd939('0x31')]);_0x476fbb[_0xd939('0x33')]=_[_0xd939('0x32')](_0x53351f['model'],qs[_0xd939('0x34')](_0x114821[_0xd939('0x31')][_0xd939('0x34')]));_0x476fbb[_0xd939('0x33')]=_0x476fbb[_0xd939('0x33')][_0xd939('0x43')]?_0x476fbb[_0xd939('0x33')]:_0x53351f[_0xd939('0x2e')];if(_0x114821[_0xd939('0x31')][_0xd939('0x3e')]){_0x476fbb[_0xd939('0x3f')]=[{'all':!![]}];}_0x476fbb=_[_0xd939('0x3c')]({},_0x476fbb,_0x114821[_0xd939('0x3d')]);return db[_0xd939('0x2a')][_0xd939('0x44')](_0x476fbb)[_0xd939('0x25')](handleEntityNotFound(_0x5e36c6,null))[_0xd939('0x25')](respondWithResult(_0x5e36c6,null))[_0xd939('0x45')](handleError(_0x5e36c6,null));};exports['create']=function(_0x5a06a2,_0xaf3d53){return db[_0xd939('0x2a')][_0xd939('0x46')](_0x5a06a2['body'],{})[_0xd939('0x25')](respondWithResult(_0xaf3d53,0xc9))[_0xd939('0x45')](handleError(_0xaf3d53,null));};exports[_0xd939('0x24')]=function(_0x1c64b4,_0x4c806d){if(_0x1c64b4['body']['id']){delete _0x1c64b4[_0xd939('0x47')]['id'];}return db['SalesforceConfiguration'][_0xd939('0x44')]({'where':{'id':_0x1c64b4[_0xd939('0x42')]['id']}})[_0xd939('0x25')](handleEntityNotFound(_0x4c806d,null))[_0xd939('0x25')](saveUpdates(_0x1c64b4[_0xd939('0x47')],null))[_0xd939('0x25')](respondWithResult(_0x4c806d,null))['catch'](handleError(_0x4c806d,null));};exports[_0xd939('0x48')]=function(_0x2901f8,_0x2d8c52){return db[_0xd939('0x2a')][_0xd939('0x44')]({'where':{'id':_0x2901f8['params']['id']}})[_0xd939('0x25')](handleEntityNotFound(_0x2d8c52,null))['then'](removeEntity(_0x2d8c52,null))[_0xd939('0x45')](handleError(_0x2d8c52,null));};exports['getFields']=function(_0x4623a2,_0x488aae,_0x3396f0){var _0x34b917={};var _0x4fc323={};var _0x30ce5b;var _0xb2a02a;return db[_0xd939('0x2a')][_0xd939('0x49')]({'where':{'id':_0x4623a2[_0xd939('0x42')]['id']}})[_0xd939('0x25')](handleEntityNotFound(_0x488aae,null))[_0xd939('0x25')](function(_0x36d13b){if(_0x36d13b){_0x30ce5b=_0x36d13b;_0x4fc323[_0xd939('0x2e')]=_[_0xd939('0x30')](db['SalesforceField']['rawAttributes']);_0x4fc323[_0xd939('0x31')]=_[_0xd939('0x30')](_0x4623a2[_0xd939('0x31')]);_0x4fc323[_0xd939('0x39')]=_[_0xd939('0x32')](_0x4fc323[_0xd939('0x2e')],_0x4fc323[_0xd939('0x31')]);_0x34b917[_0xd939('0x33')]=_[_0xd939('0x32')](_0x4fc323[_0xd939('0x2e')],qs[_0xd939('0x34')](_0x4623a2[_0xd939('0x31')][_0xd939('0x34')]));_0x34b917[_0xd939('0x33')]=_0x34b917[_0xd939('0x33')][_0xd939('0x43')]?_0x34b917[_0xd939('0x33')]:_0x4fc323[_0xd939('0x2e')];_0x34b917[_0xd939('0x4a')]=qs['sort'](_0x4623a2[_0xd939('0x31')][_0xd939('0x37')]);_0x34b917[_0xd939('0x38')]=qs[_0xd939('0x39')](_[_0xd939('0x4b')](_0x4623a2[_0xd939('0x31')],_0x4fc323[_0xd939('0x39')]));if(_0x4623a2[_0xd939('0x31')][_0xd939('0x3a')]){_0x34b917[_0xd939('0x38')]=_['merge'](_0x34b917[_0xd939('0x38')],{'$or':_['map'](_0x34b917[_0xd939('0x33')],function(_0x57975c){var _0x5990be={};_0x5990be[_0x57975c]={'$like':'%'+_0x4623a2[_0xd939('0x31')][_0xd939('0x3a')]+'%'};return _0x5990be;})});}_0x34b917=_[_0xd939('0x3c')]({},_0x34b917,_0x4623a2[_0xd939('0x3d')]);return _0x30ce5b[_0xd939('0x4c')](_0x34b917);}})[_0xd939('0x25')](function(_0xf5b955){if(_0xf5b955){_0xb2a02a=_0xf5b955[_0xd939('0x43')];if(!_0x4623a2[_0xd939('0x31')][_0xd939('0x35')](_0xd939('0x36'))){_0x34b917['limit']=qs[_0xd939('0x1e')](_0x4623a2['query'][_0xd939('0x1e')]);_0x34b917[_0xd939('0x1c')]=qs['offset'](_0x4623a2[_0xd939('0x31')]['offset']);}return _0x30ce5b['getFields'](_0x34b917);}})[_0xd939('0x25')](function(_0x12fab8){if(_0x12fab8){return _0x12fab8?{'count':_0xb2a02a,'rows':_0x12fab8}:null;}})[_0xd939('0x25')](respondWithResult(_0x488aae,null))[_0xd939('0x45')](handleError(_0x488aae,null));};exports['getSubjects']=function(_0x3c240d,_0x3fd4bc,_0x4f0e4e){var _0x2532bf={};var _0x1acdf1={};var _0x3ffa90;var _0x154559;return db[_0xd939('0x2a')][_0xd939('0x49')]({'where':{'id':_0x3c240d['params']['id']}})[_0xd939('0x25')](handleEntityNotFound(_0x3fd4bc,null))[_0xd939('0x25')](function(_0x290846){if(_0x290846){_0x3ffa90=_0x290846;_0x1acdf1[_0xd939('0x2e')]=_[_0xd939('0x30')](db[_0xd939('0x4d')][_0xd939('0x2b')]);_0x1acdf1[_0xd939('0x31')]=_[_0xd939('0x30')](_0x3c240d['query']);_0x1acdf1[_0xd939('0x39')]=_['intersection'](_0x1acdf1[_0xd939('0x2e')],_0x1acdf1[_0xd939('0x31')]);_0x2532bf[_0xd939('0x33')]=_[_0xd939('0x32')](_0x1acdf1['model'],qs[_0xd939('0x34')](_0x3c240d[_0xd939('0x31')][_0xd939('0x34')]));_0x2532bf['attributes']=_0x2532bf['attributes'][_0xd939('0x43')]?_0x2532bf[_0xd939('0x33')]:_0x1acdf1[_0xd939('0x2e')];_0x2532bf[_0xd939('0x4a')]=qs['sort'](_0x3c240d[_0xd939('0x31')][_0xd939('0x37')]);_0x2532bf[_0xd939('0x38')]=qs[_0xd939('0x39')](_[_0xd939('0x4b')](_0x3c240d[_0xd939('0x31')],_0x1acdf1[_0xd939('0x39')]));if(_0x3c240d['query'][_0xd939('0x3a')]){_0x2532bf[_0xd939('0x38')]=_[_0xd939('0x3c')](_0x2532bf[_0xd939('0x38')],{'$or':_[_0xd939('0x2f')](_0x2532bf[_0xd939('0x33')],function(_0x4cb09a){var _0x33759f={};_0x33759f[_0x4cb09a]={'$like':'%'+_0x3c240d[_0xd939('0x31')][_0xd939('0x3a')]+'%'};return _0x33759f;})});}_0x2532bf=_['merge']({},_0x2532bf,_0x3c240d[_0xd939('0x3d')]);return _0x3ffa90[_0xd939('0x4e')](_0x2532bf);}})[_0xd939('0x25')](function(_0x5918a7){if(_0x5918a7){_0x154559=_0x5918a7[_0xd939('0x43')];if(!_0x3c240d[_0xd939('0x31')][_0xd939('0x35')]('nolimit')){_0x2532bf[_0xd939('0x1e')]=qs[_0xd939('0x1e')](_0x3c240d[_0xd939('0x31')][_0xd939('0x1e')]);_0x2532bf[_0xd939('0x1c')]=qs['offset'](_0x3c240d[_0xd939('0x31')][_0xd939('0x1c')]);}return _0x3ffa90[_0xd939('0x4e')](_0x2532bf);}})[_0xd939('0x25')](function(_0x1ddd4b){if(_0x1ddd4b){return _0x1ddd4b?{'count':_0x154559,'rows':_0x1ddd4b}:null;}})['then'](respondWithResult(_0x3fd4bc,null))['catch'](handleError(_0x3fd4bc,null));};exports[_0xd939('0x4f')]=function(_0x22a7ad,_0x30767d,_0x5cc2b2){var _0xbd18c3={};var _0x3c248e={};var _0x35146f;var _0x105f3a;return db[_0xd939('0x2a')][_0xd939('0x49')]({'where':{'id':_0x22a7ad[_0xd939('0x42')]['id']}})['then'](handleEntityNotFound(_0x30767d,null))[_0xd939('0x25')](function(_0x18d1ee){if(_0x18d1ee){_0x35146f=_0x18d1ee;_0x3c248e[_0xd939('0x2e')]=_[_0xd939('0x30')](db[_0xd939('0x4d')]['rawAttributes']);_0x3c248e[_0xd939('0x31')]=_[_0xd939('0x30')](_0x22a7ad['query']);_0x3c248e[_0xd939('0x39')]=_[_0xd939('0x32')](_0x3c248e[_0xd939('0x2e')],_0x3c248e[_0xd939('0x31')]);_0xbd18c3[_0xd939('0x33')]=_[_0xd939('0x32')](_0x3c248e['model'],qs[_0xd939('0x34')](_0x22a7ad['query'][_0xd939('0x34')]));_0xbd18c3['attributes']=_0xbd18c3[_0xd939('0x33')][_0xd939('0x43')]?_0xbd18c3[_0xd939('0x33')]:_0x3c248e[_0xd939('0x2e')];_0xbd18c3[_0xd939('0x4a')]=qs[_0xd939('0x37')](_0x22a7ad['query'][_0xd939('0x37')]);_0xbd18c3['where']=qs[_0xd939('0x39')](_[_0xd939('0x4b')](_0x22a7ad['query'],_0x3c248e['filters']));if(_0x22a7ad[_0xd939('0x31')][_0xd939('0x3a')]){_0xbd18c3[_0xd939('0x38')]=_[_0xd939('0x3c')](_0xbd18c3[_0xd939('0x38')],{'$or':_['map'](_0xbd18c3[_0xd939('0x33')],function(_0x26d111){var _0x40db2f={};_0x40db2f[_0x26d111]={'$like':'%'+_0x22a7ad['query'][_0xd939('0x3a')]+'%'};return _0x40db2f;})});}_0xbd18c3=_[_0xd939('0x3c')]({},_0xbd18c3,_0x22a7ad[_0xd939('0x3d')]);return _0x35146f[_0xd939('0x4f')](_0xbd18c3);}})[_0xd939('0x25')](function(_0x40e633){if(_0x40e633){_0x105f3a=_0x40e633['length'];if(!_0x22a7ad[_0xd939('0x31')]['hasOwnProperty'](_0xd939('0x36'))){_0xbd18c3['limit']=qs[_0xd939('0x1e')](_0x22a7ad[_0xd939('0x31')][_0xd939('0x1e')]);_0xbd18c3[_0xd939('0x1c')]=qs[_0xd939('0x1c')](_0x22a7ad[_0xd939('0x31')][_0xd939('0x1c')]);}return _0x35146f['getDescriptions'](_0xbd18c3);}})[_0xd939('0x25')](function(_0x4a5bbc){if(_0x4a5bbc){return _0x4a5bbc?{'count':_0x105f3a,'rows':_0x4a5bbc}:null;}})[_0xd939('0x25')](respondWithResult(_0x30767d,null))[_0xd939('0x45')](handleError(_0x30767d,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 2234e5f..922aa1b 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 _0x7f26=['./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0xb1e132,_0x517143){var _0x33c059=function(_0x176bd9){while(--_0x176bd9){_0xb1e132['push'](_0xb1e132['shift']());}};_0x33c059(++_0x517143);}(_0x7f26,0xef));var _0x67f2=function(_0x2ad13c,_0x3e716e){_0x2ad13c=_0x2ad13c-0x0;var _0x599c2e=_0x7f26[_0x2ad13c];return _0x599c2e;};'use strict';var _=require(_0x67f2('0x0'));var util=require(_0x67f2('0x1'));var logger=require(_0x67f2('0x2'))(_0x67f2('0x3'));var moment=require(_0x67f2('0x4'));var BPromise=require(_0x67f2('0x5'));var rp=require(_0x67f2('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x67f2('0x7'));var attributes=require(_0x67f2('0x8'));module[_0x67f2('0x9')]=function(_0x217c04,_0x2a0f94){return _0x217c04[_0x67f2('0xa')](_0x67f2('0xb'),attributes,{'tableName':_0x67f2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc17e=['path','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','int_salesforce_configurations','lodash','util','api','moment','bluebird'];(function(_0x3b6bea,_0x301f0d){var _0x43d834=function(_0x243ac5){while(--_0x243ac5){_0x3b6bea['push'](_0x3b6bea['shift']());}};_0x43d834(++_0x301f0d);}(_0xc17e,0x103));var _0xec17=function(_0x47cfb2,_0x550212){_0x47cfb2=_0x47cfb2-0x0;var _0x1d5212=_0xc17e[_0x47cfb2];return _0x1d5212;};'use strict';var _=require(_0xec17('0x0'));var util=require(_0xec17('0x1'));var logger=require('../../config/logger')(_0xec17('0x2'));var moment=require(_0xec17('0x3'));var BPromise=require(_0xec17('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec17('0x5'));var rimraf=require('rimraf');var config=require(_0xec17('0x6'));var attributes=require(_0xec17('0x7'));module[_0xec17('0x8')]=function(_0x61bddd,_0x294fc6){return _0x61bddd[_0xec17('0x9')]('SalesforceConfiguration',attributes,{'tableName':_0xec17('0xa'),'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 9aa5636..80b42ef 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 _0xb260=['rpc','../../config/environment','client','http','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb260,0x13e));var _0x0b26=function(_0x5ccce8,_0xb6ac66){_0x5ccce8=_0x5ccce8-0x0;var _0xaf68af=_0xb260[_0x5ccce8];return _0xaf68af;};'use strict';var _=require(_0x0b26('0x0'));var util=require('util');var moment=require(_0x0b26('0x1'));var BPromise=require(_0x0b26('0x2'));var rs=require(_0x0b26('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0b26('0x4'));var logger=require(_0x0b26('0x5'))(_0x0b26('0x6'));var config=require(_0x0b26('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0b26('0x8')][_0x0b26('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e5e2e,_0x22a603,_0x182660){return new BPromise(function(_0x31e788,_0x9896e2){return client[_0x0b26('0xa')](_0x1e5e2e,_0x182660)['then'](function(_0x599807){logger[_0x0b26('0xb')](_0x0b26('0xc'),_0x22a603,'request\x20sent');logger['debug']('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x22a603,_0x0b26('0xd'),JSON['stringify'](_0x599807));if(_0x599807['error']){if(_0x599807[_0x0b26('0xe')][_0x0b26('0xf')]===0x1f4){logger[_0x0b26('0xe')](_0x0b26('0xc'),_0x22a603,_0x599807[_0x0b26('0xe')]['message']);return _0x9896e2(_0x599807[_0x0b26('0xe')][_0x0b26('0x10')]);}logger[_0x0b26('0xe')](_0x0b26('0xc'),_0x22a603,_0x599807['error']['message']);return _0x31e788(_0x599807['error'][_0x0b26('0x10')]);}else{logger[_0x0b26('0xb')](_0x0b26('0xc'),_0x22a603,'request\x20sent');_0x31e788(_0x599807['result'][_0x0b26('0x10')]);}})[_0x0b26('0x11')](function(_0x511663){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x22a603,_0x511663);_0x9896e2(_0x511663);});});} \ No newline at end of file +var _0x27e2=['SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x491db1,_0x5ddb66){var _0x443718=function(_0x415072){while(--_0x415072){_0x491db1['push'](_0x491db1['shift']());}};_0x443718(++_0x5ddb66);}(_0x27e2,0x67));var _0x227e=function(_0x2cd6ca,_0x25cc48){_0x2cd6ca=_0x2cd6ca-0x0;var _0x59bcec=_0x27e2[_0x2cd6ca];return _0x59bcec;};'use strict';var _=require(_0x227e('0x0'));var util=require(_0x227e('0x1'));var moment=require(_0x227e('0x2'));var BPromise=require(_0x227e('0x3'));var rs=require(_0x227e('0x4'));var fs=require('fs');var Redis=require(_0x227e('0x5'));var db=require(_0x227e('0x6'))['db'];var utils=require(_0x227e('0x7'));var logger=require('../../config/logger')(_0x227e('0x8'));var config=require(_0x227e('0x9'));var jayson=require(_0x227e('0xa'));var client=jayson[_0x227e('0xb')][_0x227e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xf89402,_0x48055d,_0x53f267){return new BPromise(function(_0x58f769,_0x25d86b){return client[_0x227e('0xd')](_0xf89402,_0x53f267)[_0x227e('0xe')](function(_0x413586){logger[_0x227e('0xf')]('SalesforceConfiguration,\x20%s,\x20%s',_0x48055d,_0x227e('0x10'));logger['debug'](_0x227e('0x11'),_0x48055d,_0x227e('0x10'),JSON['stringify'](_0x413586));if(_0x413586[_0x227e('0x12')]){if(_0x413586[_0x227e('0x12')][_0x227e('0x13')]===0x1f4){logger[_0x227e('0x12')](_0x227e('0x14'),_0x48055d,_0x413586[_0x227e('0x12')][_0x227e('0x15')]);return _0x25d86b(_0x413586[_0x227e('0x12')]['message']);}logger[_0x227e('0x12')](_0x227e('0x14'),_0x48055d,_0x413586['error'][_0x227e('0x15')]);return _0x58f769(_0x413586['error']['message']);}else{logger['info'](_0x227e('0x14'),_0x48055d,_0x227e('0x10'));_0x58f769(_0x413586[_0x227e('0x16')][_0x227e('0x15')]);}})[_0x227e('0x17')](function(_0x1640cf){logger[_0x227e('0x12')](_0x227e('0x14'),_0x48055d,_0x1640cf);_0x25d86b(_0x1640cf);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 52e3c0b..9c4731f 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 _0xc5fa=['exports','multer','path','express','Router','../../components/auth/service','./intSalesforceField.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete'];(function(_0xa7446b,_0x218525){var _0x1a2d4a=function(_0x36dfd7){while(--_0x36dfd7){_0xa7446b['push'](_0xa7446b['shift']());}};_0x1a2d4a(++_0x218525);}(_0xc5fa,0x81));var _0xac5f=function(_0x36f942,_0x3e66f8){_0x36f942=_0x36f942-0x0;var _0x31ea3f=_0xc5fa[_0x36f942];return _0x31ea3f;};'use strict';var multer=require(_0xac5f('0x0'));var util=require('util');var path=require(_0xac5f('0x1'));var timeout=require('connect-timeout');var express=require(_0xac5f('0x2'));var router=express[_0xac5f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xac5f('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xac5f('0x5'));router[_0xac5f('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xac5f('0x6')](_0xac5f('0x7'),auth[_0xac5f('0x8')](),controller[_0xac5f('0x9')]);router[_0xac5f('0xa')]('/',auth[_0xac5f('0x8')](),controller[_0xac5f('0xb')]);router[_0xac5f('0xc')](_0xac5f('0x7'),auth[_0xac5f('0x8')](),controller[_0xac5f('0xd')]);router[_0xac5f('0xe')](_0xac5f('0x7'),auth[_0xac5f('0x8')](),controller['destroy']);module[_0xac5f('0xf')]=router; \ No newline at end of file +var _0x4c4b=['delete','destroy','multer','util','path','express','Router','fs-extra','../../components/interaction/service','./intSalesforceField.controller','get','isAuthenticated','/:id','post','create','put','update'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0x4c4b,0x145));var _0xb4c4=function(_0x3f4ba6,_0x133cd6){_0x3f4ba6=_0x3f4ba6-0x0;var _0x4fa5a3=_0x4c4b[_0x3f4ba6];return _0x4fa5a3;};'use strict';var multer=require(_0xb4c4('0x0'));var util=require(_0xb4c4('0x1'));var path=require(_0xb4c4('0x2'));var timeout=require('connect-timeout');var express=require(_0xb4c4('0x3'));var router=express[_0xb4c4('0x4')]();var fs_extra=require(_0xb4c4('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb4c4('0x6'));var config=require('../../config/environment');var controller=require(_0xb4c4('0x7'));router[_0xb4c4('0x8')]('/',auth[_0xb4c4('0x9')](),controller['index']);router['get'](_0xb4c4('0xa'),auth[_0xb4c4('0x9')](),controller['show']);router[_0xb4c4('0xb')]('/',auth['isAuthenticated'](),controller[_0xb4c4('0xc')]);router[_0xb4c4('0xd')]('/:id',auth[_0xb4c4('0x9')](),controller[_0xb4c4('0xe')]);router[_0xb4c4('0xf')](_0xb4c4('0xa'),auth[_0xb4c4('0x9')](),controller[_0xb4c4('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 92bd452..e599779 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 _0x8055=['string','variable','keyValue','picklist','STRING','customVariable','sequelize','exports','ENUM'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x8055,0x12f));var _0x5805=function(_0x3e32df,_0x32b6df){_0x3e32df=_0x3e32df-0x0;var _0x5bde2b=_0x8055[_0x3e32df];return _0x5bde2b;};'use strict';var Sequelize=require(_0x5805('0x0'));module[_0x5805('0x1')]={'type':{'type':Sequelize[_0x5805('0x2')](_0x5805('0x3'),_0x5805('0x4'),'customVariable',_0x5805('0x5'),_0x5805('0x6')),'defaultValue':_0x5805('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x5805('0x7')]},'keyType':{'type':Sequelize[_0x5805('0x2')](_0x5805('0x3'),_0x5805('0x4'),_0x5805('0x8'))},'keyContent':{'type':Sequelize[_0x5805('0x7')]},'idField':{'type':Sequelize[_0x5805('0x7')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4b3d=['string','STRING','variable','ENUM','customVariable','keyValue','picklist'];(function(_0x9ebe07,_0x2b3f0e){var _0x30f48b=function(_0x321a0a){while(--_0x321a0a){_0x9ebe07['push'](_0x9ebe07['shift']());}};_0x30f48b(++_0x2b3f0e);}(_0x4b3d,0x137));var _0xd4b3=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x4b3d[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xd4b3('0x0')]('string','variable',_0xd4b3('0x1'),_0xd4b3('0x2'),_0xd4b3('0x3')),'defaultValue':_0xd4b3('0x4')},'content':{'type':Sequelize[_0xd4b3('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xd4b3('0x0')](_0xd4b3('0x4'),_0xd4b3('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0xd4b3('0x5')]},'idField':{'type':Sequelize[_0xd4b3('0x5')]},'variableName':{'type':Sequelize[_0xd4b3('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 0aef1a9..a34f4a5 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 _0x3c08=['find','create','catch','update','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','destroy','sendStatus','stack','name','send','map','SalesforceField','fieldName','type','model','keys','intersection','attributes','query','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','rawAttributes','fields','length'];(function(_0x3f2f63,_0x339ed8){var _0x4c5fd9=function(_0x1f8a2e){while(--_0x1f8a2e){_0x3f2f63['push'](_0x3f2f63['shift']());}};_0x4c5fd9(++_0x339ed8);}(_0x3c08,0x98));var _0x83c0=function(_0x19b742,_0x19e318){_0x19b742=_0x19b742-0x0;var _0x3ab093=_0x3c08[_0x19b742];return _0x3ab093;};'use strict';var emlformat=require(_0x83c0('0x0'));var rimraf=require(_0x83c0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x83c0('0x2'));var rp=require(_0x83c0('0x3'));var moment=require(_0x83c0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x83c0('0x5'));var util=require(_0x83c0('0x6'));var path=require(_0x83c0('0x7'));var sox=require(_0x83c0('0x8'));var csv=require(_0x83c0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x83c0('0xa'));var _=require('lodash');var squel=require(_0x83c0('0xb'));var crypto=require('crypto');var jsforce=require(_0x83c0('0xc'));var deskjs=require(_0x83c0('0xd'));var toCsv=require(_0x83c0('0x9'));var querystring=require(_0x83c0('0xe'));var Papa=require(_0x83c0('0xf'));var Redis=require(_0x83c0('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x83c0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x83c0('0x12'));var logger=require(_0x83c0('0x13'))(_0x83c0('0x14'));var utils=require('../../config/utils');var config=require(_0x83c0('0x15'));var licenseUtil=require(_0x83c0('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe3afb4,_0x4bc373){_0x4bc373=_0x4bc373||0xcc;return function(_0x235215){if(_0x235215){return _0xe3afb4['sendStatus'](_0x4bc373);}return _0xe3afb4[_0x83c0('0x17')](_0x4bc373)[_0x83c0('0x18')]();};}function respondWithResult(_0x112518,_0xe7bd8b){_0xe7bd8b=_0xe7bd8b||0xc8;return function(_0x3b2159){if(_0x3b2159){return _0x112518['status'](_0xe7bd8b)[_0x83c0('0x19')](_0x3b2159);}};}function respondWithFilteredResult(_0x258a2c,_0x14d07b){return function(_0xe0303c){if(_0xe0303c){var _0xfd0320=typeof _0x14d07b[_0x83c0('0x1a')]===_0x83c0('0x1b')&&typeof _0x14d07b['limit']==='undefined';var _0x232360=_0xe0303c[_0x83c0('0x1c')];var _0x3a769f=_0xfd0320?0x0:_0x14d07b[_0x83c0('0x1a')];var _0x3759b9=_0xfd0320?_0xe0303c['count']:_0x14d07b[_0x83c0('0x1a')]+_0x14d07b[_0x83c0('0x1d')];var _0x531f4e;if(_0x3759b9>=_0x232360){_0x3759b9=_0x232360;_0x531f4e=0xc8;}else{_0x531f4e=0xce;}_0x258a2c[_0x83c0('0x17')](_0x531f4e);return _0x258a2c[_0x83c0('0x1e')](_0x83c0('0x1f'),_0x3a769f+'-'+_0x3759b9+'/'+_0x232360)[_0x83c0('0x19')](_0xe0303c);}return null;};}function patchUpdates(_0x5caaa2){return function(_0x45e9bc){try{jsonpatch['apply'](_0x45e9bc,_0x5caaa2,!![]);}catch(_0x49b5fe){return BPromise[_0x83c0('0x20')](_0x49b5fe);}return _0x45e9bc[_0x83c0('0x21')]();};}function saveUpdates(_0x395693,_0x298153){return function(_0x43d109){if(_0x43d109){return _0x43d109['update'](_0x395693)[_0x83c0('0x22')](function(_0xe265a4){return _0xe265a4;});}return null;};}function removeEntity(_0xa95737,_0x3f5c53){return function(_0x194ec0){if(_0x194ec0){return _0x194ec0[_0x83c0('0x23')]()[_0x83c0('0x22')](function(){_0xa95737['status'](0xcc)[_0x83c0('0x18')]();});}};}function handleEntityNotFound(_0x49eed5,_0x2f39b9){return function(_0x474f62){if(!_0x474f62){_0x49eed5[_0x83c0('0x24')](0x194);}return _0x474f62;};}function handleError(_0xf8f1cc,_0x561d48){_0x561d48=_0x561d48||0x1f4;return function(_0x2aaf36){logger['error'](_0x2aaf36[_0x83c0('0x25')]);if(_0x2aaf36[_0x83c0('0x26')]){delete _0x2aaf36[_0x83c0('0x26')];}_0xf8f1cc[_0x83c0('0x17')](_0x561d48)[_0x83c0('0x27')](_0x2aaf36);};}exports['index']=function(_0x41d63f,_0x42a588){var _0x54a3b7={},_0x585861={},_0x3a7a5a={'count':0x0,'rows':[]};var _0x18e3d9=_[_0x83c0('0x28')](db[_0x83c0('0x29')]['rawAttributes'],function(_0x4257f8){return{'name':_0x4257f8[_0x83c0('0x2a')],'type':_0x4257f8[_0x83c0('0x2b')]['key']};});_0x585861[_0x83c0('0x2c')]=_['map'](_0x18e3d9,_0x83c0('0x26'));_0x585861['query']=_[_0x83c0('0x2d')](_0x41d63f['query']);_0x585861['filters']=_[_0x83c0('0x2e')](_0x585861[_0x83c0('0x2c')],_0x585861['query']);_0x54a3b7[_0x83c0('0x2f')]=_[_0x83c0('0x2e')](_0x585861[_0x83c0('0x2c')],qs['fields'](_0x41d63f[_0x83c0('0x30')]['fields']));_0x54a3b7['attributes']=_0x54a3b7[_0x83c0('0x2f')]['length']?_0x54a3b7[_0x83c0('0x2f')]:_0x585861[_0x83c0('0x2c')];if(!_0x41d63f['query'][_0x83c0('0x31')](_0x83c0('0x32'))){_0x54a3b7['limit']=qs[_0x83c0('0x1d')](_0x41d63f[_0x83c0('0x30')][_0x83c0('0x1d')]);_0x54a3b7[_0x83c0('0x1a')]=qs[_0x83c0('0x1a')](_0x41d63f[_0x83c0('0x30')][_0x83c0('0x1a')]);}_0x54a3b7[_0x83c0('0x33')]=qs[_0x83c0('0x34')](_0x41d63f[_0x83c0('0x30')][_0x83c0('0x34')]);_0x54a3b7[_0x83c0('0x35')]=qs[_0x83c0('0x36')](_['pick'](_0x41d63f[_0x83c0('0x30')],_0x585861[_0x83c0('0x36')]),_0x18e3d9);if(_0x41d63f['query']['filter']){_0x54a3b7[_0x83c0('0x35')]=_[_0x83c0('0x37')](_0x54a3b7[_0x83c0('0x35')],{'$or':_[_0x83c0('0x28')](_0x18e3d9,function(_0xf58942){if(_0xf58942['type']!==_0x83c0('0x38')){var _0x16161d={};_0x16161d[_0xf58942[_0x83c0('0x26')]]={'$like':'%'+_0x41d63f['query'][_0x83c0('0x39')]+'%'};return _0x16161d;}})});}_0x54a3b7=_[_0x83c0('0x37')]({},_0x54a3b7,_0x41d63f[_0x83c0('0x3a')]);var _0x205982={'where':_0x54a3b7[_0x83c0('0x35')]};return db[_0x83c0('0x29')][_0x83c0('0x1c')](_0x205982)[_0x83c0('0x22')](function(_0x8329d4){_0x3a7a5a[_0x83c0('0x1c')]=_0x8329d4;if(_0x41d63f['query'][_0x83c0('0x3b')]){_0x54a3b7[_0x83c0('0x3c')]=[{'all':!![]}];}return db[_0x83c0('0x29')][_0x83c0('0x3d')](_0x54a3b7);})['then'](function(_0x414b7e){_0x3a7a5a[_0x83c0('0x3e')]=_0x414b7e;return _0x3a7a5a;})['then'](respondWithFilteredResult(_0x42a588,_0x54a3b7))['catch'](handleError(_0x42a588,null));};exports[_0x83c0('0x3f')]=function(_0x54567a,_0x4933c1){var _0x464b38={'raw':!![],'where':{'id':_0x54567a['params']['id']}},_0x52c91f={};_0x52c91f[_0x83c0('0x2c')]=_['keys'](db[_0x83c0('0x29')][_0x83c0('0x40')]);_0x52c91f['query']=_[_0x83c0('0x2d')](_0x54567a[_0x83c0('0x30')]);_0x52c91f[_0x83c0('0x36')]=_[_0x83c0('0x2e')](_0x52c91f[_0x83c0('0x2c')],_0x52c91f['query']);_0x464b38[_0x83c0('0x2f')]=_[_0x83c0('0x2e')](_0x52c91f['model'],qs[_0x83c0('0x41')](_0x54567a['query']['fields']));_0x464b38['attributes']=_0x464b38[_0x83c0('0x2f')][_0x83c0('0x42')]?_0x464b38[_0x83c0('0x2f')]:_0x52c91f[_0x83c0('0x2c')];if(_0x54567a[_0x83c0('0x30')][_0x83c0('0x3b')]){_0x464b38['include']=[{'all':!![]}];}_0x464b38=_['merge']({},_0x464b38,_0x54567a[_0x83c0('0x3a')]);return db[_0x83c0('0x29')][_0x83c0('0x43')](_0x464b38)['then'](handleEntityNotFound(_0x4933c1,null))[_0x83c0('0x22')](respondWithResult(_0x4933c1,null))['catch'](handleError(_0x4933c1,null));};exports['create']=function(_0xb79c2b,_0x4fe906){return db[_0x83c0('0x29')][_0x83c0('0x44')](_0xb79c2b['body'],{})['then'](respondWithResult(_0x4fe906,0xc9))[_0x83c0('0x45')](handleError(_0x4fe906,null));};exports[_0x83c0('0x46')]=function(_0x5c121a,_0x55317d){if(_0x5c121a['body']['id']){delete _0x5c121a[_0x83c0('0x47')]['id'];}return db[_0x83c0('0x29')][_0x83c0('0x43')]({'where':{'id':_0x5c121a['params']['id']}})[_0x83c0('0x22')](handleEntityNotFound(_0x55317d,null))[_0x83c0('0x22')](saveUpdates(_0x5c121a['body'],null))[_0x83c0('0x22')](respondWithResult(_0x55317d,null))[_0x83c0('0x45')](handleError(_0x55317d,null));};exports[_0x83c0('0x23')]=function(_0x325daf,_0x275707){return db[_0x83c0('0x29')][_0x83c0('0x43')]({'where':{'id':_0x325daf[_0x83c0('0x48')]['id']}})[_0x83c0('0x22')](handleEntityNotFound(_0x275707,null))['then'](removeEntity(_0x275707,null))['catch'](handleError(_0x275707,null));}; \ No newline at end of file +var _0x654b=['name','send','index','map','SalesforceField','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy'];(function(_0xc9c5dc,_0xc09183){var _0x1b0f52=function(_0x50d8d1){while(--_0x50d8d1){_0xc9c5dc['push'](_0xc9c5dc['shift']());}};_0x1b0f52(++_0xc09183);}(_0x654b,0x18c));var _0xb654=function(_0x323430,_0x3d2b6d){_0x323430=_0x323430-0x0;var _0x9eecd1=_0x654b[_0x323430];return _0x9eecd1;};'use strict';var emlformat=require(_0xb654('0x0'));var rimraf=require(_0xb654('0x1'));var zipdir=require(_0xb654('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb654('0x3'));var moment=require(_0xb654('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb654('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xb654('0x6'));var ejs=require(_0xb654('0x7'));var fs=require('fs');var fs_extra=require(_0xb654('0x8'));var _=require(_0xb654('0x9'));var squel=require('squel');var crypto=require(_0xb654('0xa'));var jsforce=require(_0xb654('0xb'));var deskjs=require(_0xb654('0xc'));var toCsv=require(_0xb654('0x6'));var querystring=require('querystring');var Papa=require(_0xb654('0xd'));var Redis=require(_0xb654('0xe'));var authService=require(_0xb654('0xf'));var qs=require(_0xb654('0x10'));var as=require(_0xb654('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb654('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb654('0x13'));var db=require(_0xb654('0x14'))['db'];function respondWithStatusCode(_0x405773,_0x390452){_0x390452=_0x390452||0xcc;return function(_0x256263){if(_0x256263){return _0x405773[_0xb654('0x15')](_0x390452);}return _0x405773[_0xb654('0x16')](_0x390452)[_0xb654('0x17')]();};}function respondWithResult(_0x1ccac9,_0x3e9b24){_0x3e9b24=_0x3e9b24||0xc8;return function(_0x40d584){if(_0x40d584){return _0x1ccac9['status'](_0x3e9b24)[_0xb654('0x18')](_0x40d584);}};}function respondWithFilteredResult(_0x4e8d72,_0x5cda2a){return function(_0x35acc2){if(_0x35acc2){var _0x18b09f=typeof _0x5cda2a[_0xb654('0x19')]===_0xb654('0x1a')&&typeof _0x5cda2a[_0xb654('0x1b')]===_0xb654('0x1a');var _0x17c341=_0x35acc2[_0xb654('0x1c')];var _0x54ee78=_0x18b09f?0x0:_0x5cda2a[_0xb654('0x19')];var _0x487af3=_0x18b09f?_0x35acc2[_0xb654('0x1c')]:_0x5cda2a['offset']+_0x5cda2a[_0xb654('0x1b')];var _0x59726e;if(_0x487af3>=_0x17c341){_0x487af3=_0x17c341;_0x59726e=0xc8;}else{_0x59726e=0xce;}_0x4e8d72[_0xb654('0x16')](_0x59726e);return _0x4e8d72[_0xb654('0x1d')]('Content-Range',_0x54ee78+'-'+_0x487af3+'/'+_0x17c341)[_0xb654('0x18')](_0x35acc2);}return null;};}function patchUpdates(_0x22c0f5){return function(_0x12a4b8){try{jsonpatch[_0xb654('0x1e')](_0x12a4b8,_0x22c0f5,!![]);}catch(_0x41e443){return BPromise[_0xb654('0x1f')](_0x41e443);}return _0x12a4b8[_0xb654('0x20')]();};}function saveUpdates(_0x424488,_0x7e3ade){return function(_0x43dc59){if(_0x43dc59){return _0x43dc59[_0xb654('0x21')](_0x424488)[_0xb654('0x22')](function(_0x4450ea){return _0x4450ea;});}return null;};}function removeEntity(_0x1076ab,_0x1c6bd7){return function(_0x164e3c){if(_0x164e3c){return _0x164e3c[_0xb654('0x23')]()[_0xb654('0x22')](function(){_0x1076ab[_0xb654('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x931399,_0x3c3b47){return function(_0x584681){if(!_0x584681){_0x931399[_0xb654('0x15')](0x194);}return _0x584681;};}function handleError(_0x1eb1c8,_0x452ba1){_0x452ba1=_0x452ba1||0x1f4;return function(_0x387857){logger['error'](_0x387857['stack']);if(_0x387857[_0xb654('0x24')]){delete _0x387857[_0xb654('0x24')];}_0x1eb1c8['status'](_0x452ba1)[_0xb654('0x25')](_0x387857);};}exports[_0xb654('0x26')]=function(_0x25a851,_0x1e322b){var _0x244f82={},_0x282e1a={},_0xcc6fb3={'count':0x0,'rows':[]};var _0x5238e7=_[_0xb654('0x27')](db[_0xb654('0x28')][_0xb654('0x29')],function(_0x3b1c51){return{'name':_0x3b1c51['fieldName'],'type':_0x3b1c51[_0xb654('0x2a')][_0xb654('0x2b')]};});_0x282e1a[_0xb654('0x2c')]=_[_0xb654('0x27')](_0x5238e7,'name');_0x282e1a[_0xb654('0x2d')]=_[_0xb654('0x2e')](_0x25a851[_0xb654('0x2d')]);_0x282e1a[_0xb654('0x2f')]=_[_0xb654('0x30')](_0x282e1a[_0xb654('0x2c')],_0x282e1a[_0xb654('0x2d')]);_0x244f82[_0xb654('0x31')]=_[_0xb654('0x30')](_0x282e1a[_0xb654('0x2c')],qs['fields'](_0x25a851[_0xb654('0x2d')][_0xb654('0x32')]));_0x244f82[_0xb654('0x31')]=_0x244f82[_0xb654('0x31')][_0xb654('0x33')]?_0x244f82['attributes']:_0x282e1a[_0xb654('0x2c')];if(!_0x25a851['query'][_0xb654('0x34')](_0xb654('0x35'))){_0x244f82['limit']=qs[_0xb654('0x1b')](_0x25a851[_0xb654('0x2d')]['limit']);_0x244f82[_0xb654('0x19')]=qs[_0xb654('0x19')](_0x25a851['query']['offset']);}_0x244f82[_0xb654('0x36')]=qs[_0xb654('0x37')](_0x25a851[_0xb654('0x2d')][_0xb654('0x37')]);_0x244f82[_0xb654('0x38')]=qs[_0xb654('0x2f')](_[_0xb654('0x39')](_0x25a851[_0xb654('0x2d')],_0x282e1a[_0xb654('0x2f')]),_0x5238e7);if(_0x25a851[_0xb654('0x2d')]['filter']){_0x244f82['where']=_[_0xb654('0x3a')](_0x244f82['where'],{'$or':_[_0xb654('0x27')](_0x5238e7,function(_0x53ad8c){if(_0x53ad8c[_0xb654('0x2a')]!==_0xb654('0x3b')){var _0x2ad87e={};_0x2ad87e[_0x53ad8c[_0xb654('0x24')]]={'$like':'%'+_0x25a851[_0xb654('0x2d')][_0xb654('0x3c')]+'%'};return _0x2ad87e;}})});}_0x244f82=_[_0xb654('0x3a')]({},_0x244f82,_0x25a851[_0xb654('0x3d')]);var _0x133bf9={'where':_0x244f82['where']};return db[_0xb654('0x28')][_0xb654('0x1c')](_0x133bf9)['then'](function(_0x327698){_0xcc6fb3[_0xb654('0x1c')]=_0x327698;if(_0x25a851[_0xb654('0x2d')][_0xb654('0x3e')]){_0x244f82['include']=[{'all':!![]}];}return db[_0xb654('0x28')][_0xb654('0x3f')](_0x244f82);})[_0xb654('0x22')](function(_0x742ff0){_0xcc6fb3[_0xb654('0x40')]=_0x742ff0;return _0xcc6fb3;})[_0xb654('0x22')](respondWithFilteredResult(_0x1e322b,_0x244f82))[_0xb654('0x41')](handleError(_0x1e322b,null));};exports[_0xb654('0x42')]=function(_0x3c19a9,_0x3c5fb3){var _0x3f1d46={'raw':!![],'where':{'id':_0x3c19a9[_0xb654('0x43')]['id']}},_0x3e976c={};_0x3e976c[_0xb654('0x2c')]=_[_0xb654('0x2e')](db['SalesforceField'][_0xb654('0x29')]);_0x3e976c[_0xb654('0x2d')]=_[_0xb654('0x2e')](_0x3c19a9[_0xb654('0x2d')]);_0x3e976c[_0xb654('0x2f')]=_['intersection'](_0x3e976c['model'],_0x3e976c[_0xb654('0x2d')]);_0x3f1d46['attributes']=_[_0xb654('0x30')](_0x3e976c[_0xb654('0x2c')],qs[_0xb654('0x32')](_0x3c19a9['query'][_0xb654('0x32')]));_0x3f1d46[_0xb654('0x31')]=_0x3f1d46[_0xb654('0x31')][_0xb654('0x33')]?_0x3f1d46[_0xb654('0x31')]:_0x3e976c[_0xb654('0x2c')];if(_0x3c19a9['query'][_0xb654('0x3e')]){_0x3f1d46[_0xb654('0x44')]=[{'all':!![]}];}_0x3f1d46=_[_0xb654('0x3a')]({},_0x3f1d46,_0x3c19a9['options']);return db[_0xb654('0x28')][_0xb654('0x45')](_0x3f1d46)[_0xb654('0x22')](handleEntityNotFound(_0x3c5fb3,null))[_0xb654('0x22')](respondWithResult(_0x3c5fb3,null))[_0xb654('0x41')](handleError(_0x3c5fb3,null));};exports['create']=function(_0x595fc4,_0xfdeac9){return db[_0xb654('0x28')][_0xb654('0x46')](_0x595fc4[_0xb654('0x47')],{})[_0xb654('0x22')](respondWithResult(_0xfdeac9,0xc9))[_0xb654('0x41')](handleError(_0xfdeac9,null));};exports['update']=function(_0xeb1ac8,_0x5a42e9){if(_0xeb1ac8[_0xb654('0x47')]['id']){delete _0xeb1ac8[_0xb654('0x47')]['id'];}return db[_0xb654('0x28')][_0xb654('0x45')]({'where':{'id':_0xeb1ac8[_0xb654('0x43')]['id']}})[_0xb654('0x22')](handleEntityNotFound(_0x5a42e9,null))[_0xb654('0x22')](saveUpdates(_0xeb1ac8[_0xb654('0x47')],null))[_0xb654('0x22')](respondWithResult(_0x5a42e9,null))[_0xb654('0x41')](handleError(_0x5a42e9,null));};exports['destroy']=function(_0x554646,_0x510bf7){return db['SalesforceField']['find']({'where':{'id':_0x554646[_0xb654('0x43')]['id']}})[_0xb654('0x22')](handleEntityNotFound(_0x510bf7,null))[_0xb654('0x22')](removeEntity(_0x510bf7,null))[_0xb654('0x41')](handleError(_0x510bf7,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index d9376cc..4253cfb 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 _0xd96b=['request-promise','exports','define','salesforce_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2bcc87,_0x937b46){var _0x42e86e=function(_0x5db555){while(--_0x5db555){_0x2bcc87['push'](_0x2bcc87['shift']());}};_0x42e86e(++_0x937b46);}(_0xd96b,0x191));var _0xbd96=function(_0x4b5db4,_0x2508eb){_0x4b5db4=_0x4b5db4-0x0;var _0x2cf209=_0xd96b[_0x4b5db4];return _0x2cf209;};'use strict';var _=require(_0xbd96('0x0'));var util=require(_0xbd96('0x1'));var logger=require(_0xbd96('0x2'))(_0xbd96('0x3'));var moment=require(_0xbd96('0x4'));var BPromise=require(_0xbd96('0x5'));var rp=require(_0xbd96('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intSalesforceField.attributes');module[_0xbd96('0x7')]=function(_0xe57808,_0x1dd7e4){return _0xe57808[_0xbd96('0x8')]('SalesforceField',attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0xbd96('0x9'),'fields':['idField',_0xbd96('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc5b5=['api','bluebird','request-promise','path','rimraf','exports','salesforce_unique_index','FieldId'];(function(_0x249c33,_0x47be7e){var _0x39389b=function(_0x3cb1ac){while(--_0x3cb1ac){_0x249c33['push'](_0x249c33['shift']());}};_0x39389b(++_0x47be7e);}(_0xc5b5,0xa0));var _0x5c5b=function(_0x2e846f,_0x57929a){_0x2e846f=_0x2e846f-0x0;var _0x42f147=_0xc5b5[_0x2e846f];return _0x42f147;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x5c5b('0x0'));var moment=require('moment');var BPromise=require(_0x5c5b('0x1'));var rp=require(_0x5c5b('0x2'));var fs=require('fs');var path=require(_0x5c5b('0x3'));var rimraf=require(_0x5c5b('0x4'));var config=require('../../config/environment');var attributes=require('./intSalesforceField.attributes');module[_0x5c5b('0x5')]=function(_0x484f20,_0x38a22d){return _0x484f20['define']('SalesforceField',attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x5c5b('0x6'),'fields':['idField',_0x5c5b('0x7')],'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 a133985..02e613c 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 _0x82e2=['debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','SalesforceField,\x20%s,\x20%s'];(function(_0x5d0eea,_0x531cc4){var _0x4df64a=function(_0x2fff00){while(--_0x2fff00){_0x5d0eea['push'](_0x5d0eea['shift']());}};_0x4df64a(++_0x531cc4);}(_0x82e2,0xda));var _0x282e=function(_0x32825e,_0x5981c1){_0x32825e=_0x32825e-0x0;var _0x119578=_0x82e2[_0x32825e];return _0x119578;};'use strict';var _=require('lodash');var util=require(_0x282e('0x0'));var moment=require(_0x282e('0x1'));var BPromise=require(_0x282e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x282e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x282e('0x4'));var logger=require(_0x282e('0x5'))(_0x282e('0x6'));var config=require('../../config/environment');var jayson=require(_0x282e('0x7'));var client=jayson[_0x282e('0x8')][_0x282e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b6227,_0x10ede9,_0xf0f4db){return new BPromise(function(_0x31a3af,_0x285493){return client[_0x282e('0xa')](_0x5b6227,_0xf0f4db)['then'](function(_0x594c03){logger[_0x282e('0xb')](_0x282e('0xc'),_0x10ede9,'request\x20sent');logger[_0x282e('0xd')](_0x282e('0xe'),_0x10ede9,_0x282e('0xf'),JSON[_0x282e('0x10')](_0x594c03));if(_0x594c03[_0x282e('0x11')]){if(_0x594c03[_0x282e('0x11')][_0x282e('0x12')]===0x1f4){logger[_0x282e('0x11')](_0x282e('0xc'),_0x10ede9,_0x594c03[_0x282e('0x11')][_0x282e('0x13')]);return _0x285493(_0x594c03['error'][_0x282e('0x13')]);}logger['error']('SalesforceField,\x20%s,\x20%s',_0x10ede9,_0x594c03[_0x282e('0x11')][_0x282e('0x13')]);return _0x31a3af(_0x594c03['error']['message']);}else{logger['info'](_0x282e('0xc'),_0x10ede9,_0x282e('0xf'));_0x31a3af(_0x594c03[_0x282e('0x14')][_0x282e('0x13')]);}})['catch'](function(_0x3f2e86){logger[_0x282e('0x11')](_0x282e('0xc'),_0x10ede9,_0x3f2e86);_0x285493(_0x3f2e86);});});} \ No newline at end of file +var _0x41b1=['code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error'];(function(_0x187279,_0x26d152){var _0x3da59d=function(_0x41c808){while(--_0x41c808){_0x187279['push'](_0x187279['shift']());}};_0x3da59d(++_0x26d152);}(_0x41b1,0x9a));var _0x141b=function(_0xa45395,_0x5579e6){_0xa45395=_0xa45395-0x0;var _0x3c83d2=_0x41b1[_0xa45395];return _0x3c83d2;};'use strict';var _=require(_0x141b('0x0'));var util=require(_0x141b('0x1'));var moment=require(_0x141b('0x2'));var BPromise=require(_0x141b('0x3'));var rs=require(_0x141b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x141b('0x5'))['db'];var utils=require(_0x141b('0x6'));var logger=require(_0x141b('0x7'))('rpc');var config=require(_0x141b('0x8'));var jayson=require(_0x141b('0x9'));var client=jayson['client'][_0x141b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1df63b,_0x7f0f4d,_0xa3e405){return new BPromise(function(_0x18c48a,_0x1653fa){return client['request'](_0x1df63b,_0xa3e405)['then'](function(_0x45193b){logger[_0x141b('0xb')](_0x141b('0xc'),_0x7f0f4d,_0x141b('0xd'));logger[_0x141b('0xe')](_0x141b('0xf'),_0x7f0f4d,'request\x20sent',JSON['stringify'](_0x45193b));if(_0x45193b[_0x141b('0x10')]){if(_0x45193b[_0x141b('0x10')][_0x141b('0x11')]===0x1f4){logger[_0x141b('0x10')](_0x141b('0xc'),_0x7f0f4d,_0x45193b['error'][_0x141b('0x12')]);return _0x1653fa(_0x45193b[_0x141b('0x10')][_0x141b('0x12')]);}logger[_0x141b('0x10')]('SalesforceField,\x20%s,\x20%s',_0x7f0f4d,_0x45193b[_0x141b('0x10')]['message']);return _0x18c48a(_0x45193b[_0x141b('0x10')]['message']);}else{logger['info']('SalesforceField,\x20%s,\x20%s',_0x7f0f4d,_0x141b('0xd'));_0x18c48a(_0x45193b['result'][_0x141b('0x12')]);}})['catch'](function(_0x2f2c37){logger[_0x141b('0x10')](_0x141b('0xc'),_0x7f0f4d,_0x2f2c37);_0x1653fa(_0x2f2c37);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 582d6a2..d63ecc7 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 _0x2e5f=['get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/interaction/service','./intServicenowAccount.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2e5f,0xd1));var _0xf2e5=function(_0x57f0a2,_0x540fb6){_0x57f0a2=_0x57f0a2-0x0;var _0x2ba18b=_0x2e5f[_0x57f0a2];return _0x2ba18b;};'use strict';var multer=require(_0xf2e5('0x0'));var util=require(_0xf2e5('0x1'));var path=require(_0xf2e5('0x2'));var timeout=require('connect-timeout');var express=require(_0xf2e5('0x3'));var router=express['Router']();var fs_extra=require(_0xf2e5('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf2e5('0x5'));var config=require('../../config/environment');var controller=require(_0xf2e5('0x6'));router[_0xf2e5('0x7')]('/',auth[_0xf2e5('0x8')](),controller[_0xf2e5('0x9')]);router[_0xf2e5('0x7')](_0xf2e5('0xa'),auth['isAuthenticated'](),controller[_0xf2e5('0xb')]);router['get'](_0xf2e5('0xc'),auth[_0xf2e5('0x8')](),controller[_0xf2e5('0xd')]);router['get'](_0xf2e5('0xe'),auth['isAuthenticated'](),controller[_0xf2e5('0xf')]);router[_0xf2e5('0x10')]('/',auth['isAuthenticated'](),controller[_0xf2e5('0x11')]);router[_0xf2e5('0x10')](_0xf2e5('0xc'),auth['isAuthenticated'](),controller[_0xf2e5('0x12')]);router[_0xf2e5('0x13')](_0xf2e5('0xa'),auth[_0xf2e5('0x8')](),controller[_0xf2e5('0x14')]);router[_0xf2e5('0x15')]('/:id',auth[_0xf2e5('0x8')](),controller[_0xf2e5('0x16')]);module[_0xf2e5('0x17')]=router; \ No newline at end of file +var _0x5081=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','create','addConfiguration','put'];(function(_0x2a8d49,_0x7a194){var _0x1138c1=function(_0x1d54c7){while(--_0x1d54c7){_0x2a8d49['push'](_0x2a8d49['shift']());}};_0x1138c1(++_0x7a194);}(_0x5081,0x148));var _0x1508=function(_0x2752a3,_0x502c44){_0x2752a3=_0x2752a3-0x0;var _0x30e573=_0x5081[_0x2752a3];return _0x30e573;};'use strict';var multer=require(_0x1508('0x0'));var util=require(_0x1508('0x1'));var path=require(_0x1508('0x2'));var timeout=require(_0x1508('0x3'));var express=require(_0x1508('0x4'));var router=express[_0x1508('0x5')]();var fs_extra=require(_0x1508('0x6'));var auth=require(_0x1508('0x7'));var interaction=require(_0x1508('0x8'));var config=require(_0x1508('0x9'));var controller=require(_0x1508('0xa'));router[_0x1508('0xb')]('/',auth['isAuthenticated'](),controller[_0x1508('0xc')]);router['get'](_0x1508('0xd'),auth[_0x1508('0xe')](),controller[_0x1508('0xf')]);router[_0x1508('0xb')](_0x1508('0x10'),auth[_0x1508('0xe')](),controller[_0x1508('0x11')]);router['get']('/:id/fields',auth[_0x1508('0xe')](),controller[_0x1508('0x12')]);router['post']('/',auth[_0x1508('0xe')](),controller[_0x1508('0x13')]);router['post'](_0x1508('0x10'),auth['isAuthenticated'](),controller[_0x1508('0x14')]);router[_0x1508('0x15')](_0x1508('0xd'),auth[_0x1508('0xe')](),controller['update']);router[_0x1508('0x16')](_0x1508('0xd'),auth[_0x1508('0xe')](),controller[_0x1508('0x17')]);module[_0x1508('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 57a81fe..8d38e4c 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 _0xe81c=['remoteUri','exports','STRING','username'];(function(_0x279ce4,_0x13a3c8){var _0x3e8bcd=function(_0x122463){while(--_0x122463){_0x279ce4['push'](_0x279ce4['shift']());}};_0x3e8bcd(++_0x13a3c8);}(_0xe81c,0x75));var _0xce81=function(_0x8261bb,_0x48e718){_0x8261bb=_0x8261bb-0x0;var _0x530867=_0xe81c[_0x8261bb];return _0x530867;};'use strict';var Sequelize=require('sequelize');module[_0xce81('0x0')]={'name':{'type':Sequelize[_0xce81('0x1')]},'description':{'type':Sequelize[_0xce81('0x1')]},'username':{'type':Sequelize[_0xce81('0x1')],'unique':_0xce81('0x2')},'password':{'type':Sequelize[_0xce81('0x1')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xce81('0x1')],'unique':_0xce81('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x7f6a=['remoteUri','sequelize','exports','STRING','username'];(function(_0x56f5c5,_0x3dd9ec){var _0x543086=function(_0x149983){while(--_0x149983){_0x56f5c5['push'](_0x56f5c5['shift']());}};_0x543086(++_0x3dd9ec);}(_0x7f6a,0x155));var _0xa7f6=function(_0x5cdfe6,_0x357a99){_0x5cdfe6=_0x5cdfe6-0x0;var _0x4e0168=_0x7f6a[_0x5cdfe6];return _0x4e0168;};'use strict';var Sequelize=require(_0xa7f6('0x0'));module[_0xa7f6('0x1')]={'name':{'type':Sequelize[_0xa7f6('0x2')]},'description':{'type':Sequelize[_0xa7f6('0x2')]},'username':{'type':Sequelize[_0xa7f6('0x2')],'unique':_0xa7f6('0x3')},'password':{'type':Sequelize[_0xa7f6('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xa7f6('0x4')},'serverUrl':{'type':Sequelize[_0xa7f6('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 5377c6c..fbb0e27 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 _0x546c=['type','VIRTUAL','options','ServicenowAccount','includeAll','findAll','catch','show','params','rawAttributes','include','find','body','getConfigurations','ServicenowConfiguration','pick','findOne','Subjects','getSubjects','Descriptions','getDescriptions','channel','create','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','notify','incident_state','severity','category','caused_by','sys_updated_on','approval_history','number','sys_updated_by','opened_by','user_input','sys_domain','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','priority','sys_domain_path','rfc','group_list','resolved_at','caller_id','work_notes','short_description','close_code','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','close_notes','follow_up','parent_incident','sys_id','contact_type','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','sla_due','comments_and_work_notes','due_date','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','password','email','remoteUri','substring','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','remove','forEach','internalType','label','push','all','assign','TCL:\x20_object','includes','ServiceNow\x20error:\x20','test','Wrong\x20credentials','statusCode','boolean','True','true','false','value','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge'];(function(_0x52629b,_0x3279b3){var _0x4a47f4=function(_0x2e696c){while(--_0x2e696c){_0x52629b['push'](_0x52629b['shift']());}};_0x4a47f4(++_0x3279b3);}(_0x546c,0x12b));var _0xc546=function(_0x301356,_0x49cf61){_0x301356=_0x301356-0x0;var _0x57f41d=_0x546c[_0x301356];return _0x57f41d;};'use strict';var emlformat=require(_0xc546('0x0'));var rimraf=require(_0xc546('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc546('0x2'));var rp=require(_0xc546('0x3'));var moment=require(_0xc546('0x4'));var BPromise=require(_0xc546('0x5'));var Mustache=require(_0xc546('0x6'));var util=require(_0xc546('0x7'));var path=require('path');var sox=require(_0xc546('0x8'));var csv=require(_0xc546('0x9'));var ejs=require(_0xc546('0xa'));var fs=require('fs');var fs_extra=require(_0xc546('0xb'));var _=require(_0xc546('0xc'));var squel=require(_0xc546('0xd'));var crypto=require(_0xc546('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc546('0xf'));var toCsv=require(_0xc546('0x9'));var querystring=require(_0xc546('0x10'));var Papa=require('papaparse');var Redis=require(_0xc546('0x11'));var authService=require(_0xc546('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc546('0x13'));var hardwareService=require(_0xc546('0x14'));var logger=require(_0xc546('0x15'))(_0xc546('0x16'));var utils=require(_0xc546('0x17'));var config=require(_0xc546('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc546('0x19'))['db'];var integrations=require(_0xc546('0x1a'));function respondWithStatusCode(_0x12109d,_0x2a3031){_0x2a3031=_0x2a3031||0xcc;return function(_0x1de68f){if(_0x1de68f){return _0x12109d[_0xc546('0x1b')](_0x2a3031);}return _0x12109d[_0xc546('0x1c')](_0x2a3031)[_0xc546('0x1d')]();};}function respondWithResult(_0x2f9ee1,_0x464998){_0x464998=_0x464998||0xc8;return function(_0x58c999){if(_0x58c999){return _0x2f9ee1[_0xc546('0x1c')](_0x464998)['json'](_0x58c999);}};}function respondWithFilteredResult(_0xd710ec,_0x41844c){return function(_0xca0b31){if(_0xca0b31){var _0x554a2d=typeof _0x41844c['offset']===_0xc546('0x1e')&&typeof _0x41844c[_0xc546('0x1f')]===_0xc546('0x1e');var _0x30ff6c=_0xca0b31[_0xc546('0x20')];var _0x131afc=_0x554a2d?0x0:_0x41844c[_0xc546('0x21')];var _0x25b1af=_0x554a2d?_0xca0b31[_0xc546('0x20')]:_0x41844c[_0xc546('0x21')]+_0x41844c[_0xc546('0x1f')];var _0xeaf0a7;if(_0x25b1af>=_0x30ff6c){_0x25b1af=_0x30ff6c;_0xeaf0a7=0xc8;}else{_0xeaf0a7=0xce;}_0xd710ec[_0xc546('0x1c')](_0xeaf0a7);return _0xd710ec[_0xc546('0x22')](_0xc546('0x23'),_0x131afc+'-'+_0x25b1af+'/'+_0x30ff6c)[_0xc546('0x24')](_0xca0b31);}return null;};}function patchUpdates(_0x3f722b){return function(_0x1526e5){try{jsonpatch[_0xc546('0x25')](_0x1526e5,_0x3f722b,!![]);}catch(_0x2a1323){return BPromise[_0xc546('0x26')](_0x2a1323);}return _0x1526e5[_0xc546('0x27')]();};}function saveUpdates(_0x4daca2,_0x4c326b){return function(_0x43663f){if(_0x43663f){return _0x43663f[_0xc546('0x28')](_0x4daca2)[_0xc546('0x29')](function(_0x24a973){return _0x24a973;});}return null;};}function removeEntity(_0x1c3806,_0x3ceea6){return function(_0x299dac){if(_0x299dac){return _0x299dac[_0xc546('0x2a')]()[_0xc546('0x29')](function(){_0x1c3806[_0xc546('0x1c')](0xcc)[_0xc546('0x1d')]();});}};}function handleEntityNotFound(_0xa074df,_0x140936){return function(_0x5805a9){if(!_0x5805a9){_0xa074df[_0xc546('0x1b')](0x194);}return _0x5805a9;};}function handleError(_0x1def23,_0x2ec958){_0x2ec958=_0x2ec958||0x1f4;return function(_0x431a4d){logger[_0xc546('0x2b')](_0x431a4d[_0xc546('0x2c')]);if(_0x431a4d[_0xc546('0x2d')]){delete _0x431a4d[_0xc546('0x2d')];}_0x1def23['status'](_0x2ec958)[_0xc546('0x2e')](_0x431a4d);};}exports[_0xc546('0x2f')]=function(_0x58dc7b,_0x212232){var _0x4e481c={},_0x326e48={},_0x354844={'count':0x0,'rows':[]};var _0x3918b8=_[_0xc546('0x30')](db['ServicenowAccount']['rawAttributes'],function(_0x40375c){return{'name':_0x40375c['fieldName'],'type':_0x40375c['type'][_0xc546('0x31')]};});_0x326e48[_0xc546('0x32')]=_['map'](_0x3918b8,_0xc546('0x2d'));_0x326e48[_0xc546('0x33')]=_[_0xc546('0x34')](_0x58dc7b[_0xc546('0x33')]);_0x326e48[_0xc546('0x35')]=_[_0xc546('0x36')](_0x326e48['model'],_0x326e48[_0xc546('0x33')]);_0x4e481c[_0xc546('0x37')]=_['intersection'](_0x326e48['model'],qs[_0xc546('0x38')](_0x58dc7b[_0xc546('0x33')][_0xc546('0x38')]));_0x4e481c[_0xc546('0x37')]=_0x4e481c[_0xc546('0x37')][_0xc546('0x39')]?_0x4e481c['attributes']:_0x326e48['model'];if(!_0x58dc7b[_0xc546('0x33')][_0xc546('0x3a')](_0xc546('0x3b'))){_0x4e481c[_0xc546('0x1f')]=qs[_0xc546('0x1f')](_0x58dc7b[_0xc546('0x33')][_0xc546('0x1f')]);_0x4e481c['offset']=qs[_0xc546('0x21')](_0x58dc7b[_0xc546('0x33')][_0xc546('0x21')]);}_0x4e481c[_0xc546('0x3c')]=qs['sort'](_0x58dc7b[_0xc546('0x33')][_0xc546('0x3d')]);_0x4e481c[_0xc546('0x3e')]=qs[_0xc546('0x35')](_['pick'](_0x58dc7b['query'],_0x326e48[_0xc546('0x35')]),_0x3918b8);if(_0x58dc7b[_0xc546('0x33')][_0xc546('0x3f')]){_0x4e481c[_0xc546('0x3e')]=_[_0xc546('0x40')](_0x4e481c[_0xc546('0x3e')],{'$or':_[_0xc546('0x30')](_0x3918b8,function(_0x294452){if(_0x294452[_0xc546('0x41')]!==_0xc546('0x42')){var _0x2f71ac={};_0x2f71ac[_0x294452[_0xc546('0x2d')]]={'$like':'%'+_0x58dc7b[_0xc546('0x33')][_0xc546('0x3f')]+'%'};return _0x2f71ac;}})});}_0x4e481c=_[_0xc546('0x40')]({},_0x4e481c,_0x58dc7b[_0xc546('0x43')]);var _0x1c2d36={'where':_0x4e481c['where']};return db[_0xc546('0x44')]['count'](_0x1c2d36)[_0xc546('0x29')](function(_0x521c15){_0x354844[_0xc546('0x20')]=_0x521c15;if(_0x58dc7b[_0xc546('0x33')][_0xc546('0x45')]){_0x4e481c['include']=[{'all':!![]}];}return db[_0xc546('0x44')][_0xc546('0x46')](_0x4e481c);})[_0xc546('0x29')](function(_0x478c6b){_0x354844['rows']=_0x478c6b;return _0x354844;})['then'](respondWithFilteredResult(_0x212232,_0x4e481c))[_0xc546('0x47')](handleError(_0x212232,null));};exports[_0xc546('0x48')]=function(_0x4f9f74,_0x2f7153){var _0x3fed60={'raw':![],'where':{'id':_0x4f9f74[_0xc546('0x49')]['id']}},_0x4c2d87={};_0x4c2d87[_0xc546('0x32')]=_[_0xc546('0x34')](db[_0xc546('0x44')][_0xc546('0x4a')]);_0x4c2d87[_0xc546('0x33')]=_[_0xc546('0x34')](_0x4f9f74['query']);_0x4c2d87['filters']=_[_0xc546('0x36')](_0x4c2d87[_0xc546('0x32')],_0x4c2d87[_0xc546('0x33')]);_0x3fed60['attributes']=_[_0xc546('0x36')](_0x4c2d87[_0xc546('0x32')],qs[_0xc546('0x38')](_0x4f9f74[_0xc546('0x33')][_0xc546('0x38')]));_0x3fed60[_0xc546('0x37')]=_0x3fed60[_0xc546('0x37')][_0xc546('0x39')]?_0x3fed60[_0xc546('0x37')]:_0x4c2d87['model'];if(_0x4f9f74[_0xc546('0x33')][_0xc546('0x45')]){_0x3fed60[_0xc546('0x4b')]=[{'all':!![]}];}_0x3fed60=_[_0xc546('0x40')]({},_0x3fed60,_0x4f9f74[_0xc546('0x43')]);return db[_0xc546('0x44')][_0xc546('0x4c')](_0x3fed60)['then'](handleEntityNotFound(_0x2f7153,null))['then'](respondWithResult(_0x2f7153,null))[_0xc546('0x47')](handleError(_0x2f7153,null));};exports['create']=function(_0x36c091,_0x7fb3fb){return db[_0xc546('0x44')]['create'](_0x36c091[_0xc546('0x4d')],{})[_0xc546('0x29')](respondWithResult(_0x7fb3fb,0xc9))['catch'](handleError(_0x7fb3fb,null));};exports[_0xc546('0x28')]=function(_0x356856,_0x5460fd){if(_0x356856['body']['id']){delete _0x356856[_0xc546('0x4d')]['id'];}return db[_0xc546('0x44')]['find']({'where':{'id':_0x356856[_0xc546('0x49')]['id']}})[_0xc546('0x29')](handleEntityNotFound(_0x5460fd,null))[_0xc546('0x29')](saveUpdates(_0x356856['body'],null))['then'](respondWithResult(_0x5460fd,null))['catch'](handleError(_0x5460fd,null));};exports[_0xc546('0x2a')]=function(_0x13bae4,_0x4a72a2){return db[_0xc546('0x44')][_0xc546('0x4c')]({'where':{'id':_0x13bae4[_0xc546('0x49')]['id']}})[_0xc546('0x29')](handleEntityNotFound(_0x4a72a2,null))[_0xc546('0x29')](removeEntity(_0x4a72a2,null))['catch'](handleError(_0x4a72a2,null));};exports[_0xc546('0x4e')]=function(_0x29f0c,_0x441626,_0x10a34e){var _0x5f4b24={};var _0x3bc71d={};var _0x44b1e9;var _0x3a0b69;return db[_0xc546('0x44')]['findOne']({'where':{'id':_0x29f0c[_0xc546('0x49')]['id']}})[_0xc546('0x29')](handleEntityNotFound(_0x441626,null))[_0xc546('0x29')](function(_0x1c802b){if(_0x1c802b){_0x44b1e9=_0x1c802b;_0x3bc71d[_0xc546('0x32')]=_[_0xc546('0x34')](db[_0xc546('0x4f')]['rawAttributes']);_0x3bc71d[_0xc546('0x33')]=_['keys'](_0x29f0c[_0xc546('0x33')]);_0x3bc71d[_0xc546('0x35')]=_[_0xc546('0x36')](_0x3bc71d['model'],_0x3bc71d[_0xc546('0x33')]);_0x5f4b24[_0xc546('0x37')]=_[_0xc546('0x36')](_0x3bc71d[_0xc546('0x32')],qs[_0xc546('0x38')](_0x29f0c[_0xc546('0x33')][_0xc546('0x38')]));_0x5f4b24[_0xc546('0x37')]=_0x5f4b24[_0xc546('0x37')][_0xc546('0x39')]?_0x5f4b24['attributes']:_0x3bc71d[_0xc546('0x32')];_0x5f4b24[_0xc546('0x3c')]=qs[_0xc546('0x3d')](_0x29f0c[_0xc546('0x33')][_0xc546('0x3d')]);_0x5f4b24[_0xc546('0x3e')]=qs[_0xc546('0x35')](_[_0xc546('0x50')](_0x29f0c[_0xc546('0x33')],_0x3bc71d[_0xc546('0x35')]));if(_0x29f0c[_0xc546('0x33')]['filter']){_0x5f4b24[_0xc546('0x3e')]=_[_0xc546('0x40')](_0x5f4b24['where'],{'$or':_['map'](_0x5f4b24[_0xc546('0x37')],function(_0x3a5826){var _0x34235d={};_0x34235d[_0x3a5826]={'$like':'%'+_0x29f0c[_0xc546('0x33')][_0xc546('0x3f')]+'%'};return _0x34235d;})});}_0x5f4b24=_[_0xc546('0x40')]({},_0x5f4b24,_0x29f0c[_0xc546('0x43')]);return _0x44b1e9['getConfigurations'](_0x5f4b24);}})[_0xc546('0x29')](function(_0x185f9a){if(_0x185f9a){_0x3a0b69=_0x185f9a[_0xc546('0x39')];if(!_0x29f0c['query'][_0xc546('0x3a')](_0xc546('0x3b'))){_0x5f4b24['limit']=qs[_0xc546('0x1f')](_0x29f0c[_0xc546('0x33')]['limit']);_0x5f4b24[_0xc546('0x21')]=qs['offset'](_0x29f0c['query'][_0xc546('0x21')]);}return _0x44b1e9[_0xc546('0x4e')](_0x5f4b24);}})[_0xc546('0x29')](function(_0x272ff4){if(_0x272ff4){return _0x272ff4?{'count':_0x3a0b69,'rows':_0x272ff4}:null;}})['then'](respondWithResult(_0x441626,null))[_0xc546('0x47')](handleError(_0x441626,null));};exports['addConfiguration']=function(_0x5e67a2,_0x503f3f,_0x402097){if(_0x5e67a2[_0xc546('0x4d')]['id']){delete _0x5e67a2['body']['id'];}return db['ServicenowAccount'][_0xc546('0x51')]({'where':{'id':_0x5e67a2[_0xc546('0x49')]['id']}})[_0xc546('0x29')](handleEntityNotFound(_0x503f3f,null))[_0xc546('0x29')](function(_0x44eee9){if(_0x44eee9){_0x5e67a2[_0xc546('0x4d')]['AccountId']=_0x44eee9['id'];_0x5e67a2[_0xc546('0x4d')][_0xc546('0x52')]=integrations[_0xc546('0x53')](_0x5e67a2['body']['channel'],_0x5e67a2[_0xc546('0x4d')][_0xc546('0x41')]);_0x5e67a2['body'][_0xc546('0x54')]=integrations[_0xc546('0x55')](_0x5e67a2[_0xc546('0x4d')][_0xc546('0x56')],_0x5e67a2[_0xc546('0x4d')][_0xc546('0x41')]);return db[_0xc546('0x4f')][_0xc546('0x57')](_0x5e67a2[_0xc546('0x4d')],{'include':[{'model':db[_0xc546('0x58')],'as':_0xc546('0x52')},{'model':db['ServicenowField'],'as':_0xc546('0x54')}]});}return null;})['then'](respondWithResult(_0x503f3f,null))[_0xc546('0x47')](handleError(_0x503f3f,null));};exports[_0xc546('0x59')]=function(_0x1d2910,_0x20ffbc,_0x1a673d){var _0x3358d2=[_0xc546('0x5a'),_0xc546('0x5b'),_0xc546('0x5c'),_0xc546('0x5d'),'close_code',_0xc546('0x5e'),_0xc546('0x5f'),_0xc546('0x60'),_0xc546('0x61')];var _0x1a92bd=['parent','made_sla',_0xc546('0x62'),'watch_list','upon_reject',_0xc546('0x63'),'child_incidents',_0xc546('0x5b'),_0xc546('0x64'),_0xc546('0x65'),'resolved_by',_0xc546('0x66'),_0xc546('0x67'),_0xc546('0x68'),'sys_created_on',_0xc546('0x69'),'state',_0xc546('0x6a'),_0xc546('0x5c'),_0xc546('0x3c'),_0xc546('0x6b'),_0xc546('0x6c'),_0xc546('0x6d'),_0xc546('0x6e'),_0xc546('0x6f'),_0xc546('0x70'),_0xc546('0x71'),'business_service',_0xc546('0x72'),_0xc546('0x73'),_0xc546('0x74'),'time_worked','expected_start','opened_at','business_duration',_0xc546('0x75'),'work_end','reopened_time',_0xc546('0x76'),_0xc546('0x77'),'approval_set',_0xc546('0x5d'),_0xc546('0x78'),_0xc546('0x79'),_0xc546('0x7a'),_0xc546('0x7b'),_0xc546('0x7c'),_0xc546('0x7d'),_0xc546('0x7e'),_0xc546('0x7f'),_0xc546('0x80'),_0xc546('0x81'),_0xc546('0x82'),_0xc546('0x5e'),'sys_class_name',_0xc546('0x83'),'closed_by',_0xc546('0x84'),_0xc546('0x85'),_0xc546('0x86'),_0xc546('0x87'),'reopened_by',_0xc546('0x5f'),_0xc546('0x88'),_0xc546('0x89'),_0xc546('0x8a'),_0xc546('0x8b'),_0xc546('0x8c'),_0xc546('0x8d'),_0xc546('0x60'),'comments',_0xc546('0x8e'),'approval',_0xc546('0x8f'),_0xc546('0x90'),'sys_mod_count',_0xc546('0x91'),_0xc546('0x92'),_0xc546('0x93'),_0xc546('0x94'),_0xc546('0x95'),_0xc546('0x96'),_0xc546('0x61')];var _0x2e1ea='';var _0x46aa3b='';var _0x30642f=[];var _0x494449='';var _0x3b3245='';var _0x5c7fb6=[];var _0x24302a='';var _0x133749='';var _0x4136c7={};var _0x484201='';return db['ServicenowAccount'][_0xc546('0x51')]({'where':{'id':_0x1d2910[_0xc546('0x49')]['id']},'attributes':['id',_0xc546('0x97'),_0xc546('0x98'),_0xc546('0x99'),_0xc546('0x9a'),'serverUrl']})[_0xc546('0x29')](handleEntityNotFound(_0x20ffbc,null))[_0xc546('0x29')](function(_0x23e262){if(_0x23e262){_0x484201=_0x23e262['remoteUri'];var _0x547215=_0x484201['slice'](-0x1);if(_0x547215==='/'){_0x484201=_0x484201[_0xc546('0x9b')](0x0,_0x484201['lastIndexOf'](_0x547215));}_0x133749=util[_0xc546('0x9c')](_0xc546('0x9d'),_0x484201);_0x24302a=util[_0xc546('0x9c')](_0xc546('0x9e'),_0x484201);_0x4136c7={'user':_0x23e262[_0xc546('0x97')],'pass':_0x23e262['password']};var _0x560d1c={'method':_0xc546('0x9f'),'uri':_0x133749+_0xc546('0xa0'),'auth':_0x4136c7,'json':!![]};return rp(_0x560d1c);}})[_0xc546('0x29')](function(_0xe45aa5){if(_0xe45aa5[_0xc546('0xa1')][_0xc546('0x39')]>0x0){_0x2e1ea=_0xe45aa5[_0xc546('0xa1')];}console[_0xc546('0xa2')](_0xc546('0xa3'),_0x2e1ea);_0x5c7fb6=[];_0x46aa3b=Object['assign']([],_0x2e1ea);_[_0xc546('0xa4')](_0x46aa3b,function(_0x85cc39){return!_0x3358d2['includes'](_0x85cc39[_0xc546('0x2d')]);});_0x46aa3b[_0xc546('0xa5')](function(_0x17a1d4){var _0x2758a4=createFieldObject(_0x24302a,_0x4136c7,_0x17a1d4[_0xc546('0xa6')],_0x17a1d4[_0xc546('0x2d')],_0x17a1d4[_0xc546('0xa7')],![]);_0x5c7fb6[_0xc546('0xa8')](_0x2758a4);});return Promise[_0xc546('0xa9')](_0x5c7fb6);})[_0xc546('0x29')](function(_0x335fdc){_0x30642f=_0x335fdc;_0x494449=Object[_0xc546('0xaa')]([],_0x2e1ea);console[_0xc546('0xa2')](_0xc546('0xab'),_0x2e1ea);_[_0xc546('0xa4')](_0x494449,function(_0x23c4ca){return _0x1a92bd[_0xc546('0xac')](_0x23c4ca[_0xc546('0x2d')]);});console[_0xc546('0xa2')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x494449);_0x5c7fb6=[];_0x494449[_0xc546('0xa5')](function(_0x2298c4){var _0x128a44=createFieldObject(_0x24302a,_0x4136c7,_0x2298c4['internalType'],_0x2298c4[_0xc546('0x2d')],_0x2298c4['label'],!![]);_0x5c7fb6[_0xc546('0xa8')](_0x128a44);});return Promise[_0xc546('0xa9')](_0x5c7fb6);})['then'](function(_0x5d269c){_0x3b3245=_0x5d269c;var _0x440661=_0x30642f['concat'](_0x3b3245);return{'count':_0x440661[_0xc546('0x39')],'rows':_0x440661};})[_0xc546('0x29')](respondWithResult(_0x20ffbc,null))[_0xc546('0x47')](function(_0x351fbf){console[_0xc546('0xa2')](_0xc546('0xad')+_0x351fbf);var _0x4c0355=_0x1d2910[_0xc546('0x33')]['test']?0x1f4:_0x351fbf['statusCode']||0x1f4;logger[_0xc546('0x2b')](_0x351fbf['stack']);delete _0x351fbf['name'];if(_0x4c0355===0x191){_0x4c0355=0x190;}_0x20ffbc[_0xc546('0x1c')](_0x4c0355)[_0xc546('0x2e')](_0x1d2910[_0xc546('0x33')][_0xc546('0xae')]?{'message':_0xc546('0xaf'),'statusCode':_0x351fbf[_0xc546('0xb0')]}:_0x351fbf);});};function createFieldObject(_0x58482a,_0x41b2ce,_0x86437c,_0x3034dc,_0xe36eba,_0x17b452){return new Promise(function(_0x96906a,_0x5aec38){var _0x484804={'id':_0x3034dc,'name':_0xe36eba,'custom':_0x17b452};if(_0x86437c===_0xc546('0xb1')){_0x484804[_0xc546('0x43')]=[{'name':_0xc546('0xb2'),'value':_0xc546('0xb3')},{'name':'False','value':_0xc546('0xb4')}];_0x96906a(_0x484804);}else{var _0x54c887={'method':_0xc546('0x9f'),'uri':_0x58482a+'sys_choice?sysparm_query=name=incident^element='+_0x3034dc,'auth':_0x41b2ce,'json':!![]};return rp(_0x54c887)[_0xc546('0x29')](function(_0x23c94b){var _0xc05bd=[];if(_0x23c94b[_0xc546('0xa1')][_0xc546('0x39')]>0x0){_0x23c94b[_0xc546('0xa1')][_0xc546('0xa5')](function(_0x203afb){if(_0x203afb['inactive']===_0xc546('0xb4')){var _0x4562d7={'name':_0x203afb[_0xc546('0xa7')],'value':_0x203afb[_0xc546('0xb5')]};_0xc05bd['push'](_0x4562d7);}});}_0x484804[_0xc546('0x43')]=_0xc05bd;if(_0x484804[_0xc546('0x43')][_0xc546('0x39')]>0x0){_0x96906a(_0x484804);}else{if(_0x17b452==![]){_0x96906a();}else{_0x96906a(_0x484804);}}});}});} \ No newline at end of file +var _0xa6df=['mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','json','limit','undefined','offset','count','status','Content-Range','apply','save','update','then','sendStatus','error','stack','name','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','filter','VIRTUAL','ServicenowAccount','includeAll','include','findAll','catch','params','merge','options','find','create','body','destroy','getConfigurations','findOne','ServicenowConfiguration','order','pick','hasOwnProperty','AccountId','channel','type','Descriptions','getDescriptions','ServicenowField','Subjects','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','closed_at','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sla_due','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','password','email','remoteUri','lastIndexOf','format','username','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','internalType','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','label','concat','ServiceNow\x20error:\x20','test','statusCode','send','Wrong\x20credentials','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xa6df,0x176));var _0xfa6d=function(_0x210970,_0x32cd06){_0x210970=_0x210970-0x0;var _0x3701c8=_0xa6df[_0x210970];return _0x3701c8;};'use strict';var emlformat=require(_0xfa6d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfa6d('0x1'));var jsonpatch=require(_0xfa6d('0x2'));var rp=require(_0xfa6d('0x3'));var moment=require(_0xfa6d('0x4'));var BPromise=require(_0xfa6d('0x5'));var Mustache=require(_0xfa6d('0x6'));var util=require('util');var path=require('path');var sox=require(_0xfa6d('0x7'));var csv=require(_0xfa6d('0x8'));var ejs=require(_0xfa6d('0x9'));var fs=require('fs');var fs_extra=require(_0xfa6d('0xa'));var _=require(_0xfa6d('0xb'));var squel=require(_0xfa6d('0xc'));var crypto=require(_0xfa6d('0xd'));var jsforce=require(_0xfa6d('0xe'));var deskjs=require(_0xfa6d('0xf'));var toCsv=require(_0xfa6d('0x8'));var querystring=require(_0xfa6d('0x10'));var Papa=require(_0xfa6d('0x11'));var Redis=require(_0xfa6d('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfa6d('0x13'));var hardwareService=require(_0xfa6d('0x14'));var logger=require('../../config/logger')(_0xfa6d('0x15'));var utils=require('../../config/utils');var config=require(_0xfa6d('0x16'));var licenseUtil=require(_0xfa6d('0x17'));var db=require(_0xfa6d('0x18'))['db'];var integrations=require(_0xfa6d('0x19'));function respondWithStatusCode(_0x8b31a0,_0x5b8018){_0x5b8018=_0x5b8018||0xcc;return function(_0x41b7c4){if(_0x41b7c4){return _0x8b31a0['sendStatus'](_0x5b8018);}return _0x8b31a0['status'](_0x5b8018)[_0xfa6d('0x1a')]();};}function respondWithResult(_0x2c0fd8,_0x2435e4){_0x2435e4=_0x2435e4||0xc8;return function(_0x30d7f7){if(_0x30d7f7){return _0x2c0fd8['status'](_0x2435e4)[_0xfa6d('0x1b')](_0x30d7f7);}};}function respondWithFilteredResult(_0x4667cb,_0x10c198){return function(_0x56e72a){if(_0x56e72a){var _0x180f58=typeof _0x10c198['offset']==='undefined'&&typeof _0x10c198[_0xfa6d('0x1c')]===_0xfa6d('0x1d');var _0x2182c7=_0x56e72a['count'];var _0x9b1247=_0x180f58?0x0:_0x10c198[_0xfa6d('0x1e')];var _0x58c837=_0x180f58?_0x56e72a[_0xfa6d('0x1f')]:_0x10c198[_0xfa6d('0x1e')]+_0x10c198[_0xfa6d('0x1c')];var _0x59914f;if(_0x58c837>=_0x2182c7){_0x58c837=_0x2182c7;_0x59914f=0xc8;}else{_0x59914f=0xce;}_0x4667cb[_0xfa6d('0x20')](_0x59914f);return _0x4667cb['set'](_0xfa6d('0x21'),_0x9b1247+'-'+_0x58c837+'/'+_0x2182c7)[_0xfa6d('0x1b')](_0x56e72a);}return null;};}function patchUpdates(_0x1d02c1){return function(_0x30a169){try{jsonpatch[_0xfa6d('0x22')](_0x30a169,_0x1d02c1,!![]);}catch(_0x4ac3bb){return BPromise['reject'](_0x4ac3bb);}return _0x30a169[_0xfa6d('0x23')]();};}function saveUpdates(_0x1355ce,_0x896d22){return function(_0x1877f9){if(_0x1877f9){return _0x1877f9[_0xfa6d('0x24')](_0x1355ce)[_0xfa6d('0x25')](function(_0x2cde83){return _0x2cde83;});}return null;};}function removeEntity(_0x3c927a,_0x553cfd){return function(_0x53d3cd){if(_0x53d3cd){return _0x53d3cd['destroy']()[_0xfa6d('0x25')](function(){_0x3c927a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4604ed,_0xed648b){return function(_0x20d214){if(!_0x20d214){_0x4604ed[_0xfa6d('0x26')](0x194);}return _0x20d214;};}function handleError(_0x44413b,_0xc6a3d0){_0xc6a3d0=_0xc6a3d0||0x1f4;return function(_0x19d28){logger[_0xfa6d('0x27')](_0x19d28[_0xfa6d('0x28')]);if(_0x19d28[_0xfa6d('0x29')]){delete _0x19d28[_0xfa6d('0x29')];}_0x44413b[_0xfa6d('0x20')](_0xc6a3d0)['send'](_0x19d28);};}exports['index']=function(_0x15fc56,_0x3d8b0a){var _0x37f503={},_0x389a0e={},_0x79fd87={'count':0x0,'rows':[]};var _0x18edf9=_[_0xfa6d('0x2a')](db['ServicenowAccount'][_0xfa6d('0x2b')],function(_0x498303){return{'name':_0x498303[_0xfa6d('0x2c')],'type':_0x498303['type'][_0xfa6d('0x2d')]};});_0x389a0e['model']=_[_0xfa6d('0x2a')](_0x18edf9,'name');_0x389a0e[_0xfa6d('0x2e')]=_[_0xfa6d('0x2f')](_0x15fc56[_0xfa6d('0x2e')]);_0x389a0e[_0xfa6d('0x30')]=_[_0xfa6d('0x31')](_0x389a0e[_0xfa6d('0x32')],_0x389a0e['query']);_0x37f503[_0xfa6d('0x33')]=_['intersection'](_0x389a0e['model'],qs[_0xfa6d('0x34')](_0x15fc56['query'][_0xfa6d('0x34')]));_0x37f503[_0xfa6d('0x33')]=_0x37f503['attributes'][_0xfa6d('0x35')]?_0x37f503[_0xfa6d('0x33')]:_0x389a0e[_0xfa6d('0x32')];if(!_0x15fc56[_0xfa6d('0x2e')]['hasOwnProperty'](_0xfa6d('0x36'))){_0x37f503[_0xfa6d('0x1c')]=qs[_0xfa6d('0x1c')](_0x15fc56[_0xfa6d('0x2e')][_0xfa6d('0x1c')]);_0x37f503[_0xfa6d('0x1e')]=qs[_0xfa6d('0x1e')](_0x15fc56[_0xfa6d('0x2e')][_0xfa6d('0x1e')]);}_0x37f503['order']=qs['sort'](_0x15fc56[_0xfa6d('0x2e')][_0xfa6d('0x37')]);_0x37f503[_0xfa6d('0x38')]=qs[_0xfa6d('0x30')](_['pick'](_0x15fc56[_0xfa6d('0x2e')],_0x389a0e[_0xfa6d('0x30')]),_0x18edf9);if(_0x15fc56[_0xfa6d('0x2e')][_0xfa6d('0x39')]){_0x37f503[_0xfa6d('0x38')]=_['merge'](_0x37f503[_0xfa6d('0x38')],{'$or':_[_0xfa6d('0x2a')](_0x18edf9,function(_0x5dd2ec){if(_0x5dd2ec['type']!==_0xfa6d('0x3a')){var _0x5e6979={};_0x5e6979[_0x5dd2ec[_0xfa6d('0x29')]]={'$like':'%'+_0x15fc56[_0xfa6d('0x2e')][_0xfa6d('0x39')]+'%'};return _0x5e6979;}})});}_0x37f503=_['merge']({},_0x37f503,_0x15fc56['options']);var _0x5efa69={'where':_0x37f503[_0xfa6d('0x38')]};return db[_0xfa6d('0x3b')]['count'](_0x5efa69)[_0xfa6d('0x25')](function(_0x3a4f9c){_0x79fd87[_0xfa6d('0x1f')]=_0x3a4f9c;if(_0x15fc56[_0xfa6d('0x2e')][_0xfa6d('0x3c')]){_0x37f503[_0xfa6d('0x3d')]=[{'all':!![]}];}return db[_0xfa6d('0x3b')][_0xfa6d('0x3e')](_0x37f503);})[_0xfa6d('0x25')](function(_0x27da5d){_0x79fd87['rows']=_0x27da5d;return _0x79fd87;})[_0xfa6d('0x25')](respondWithFilteredResult(_0x3d8b0a,_0x37f503))[_0xfa6d('0x3f')](handleError(_0x3d8b0a,null));};exports['show']=function(_0x2b2bac,_0x30b648){var _0x235a21={'raw':![],'where':{'id':_0x2b2bac[_0xfa6d('0x40')]['id']}},_0x904ea6={};_0x904ea6[_0xfa6d('0x32')]=_[_0xfa6d('0x2f')](db[_0xfa6d('0x3b')]['rawAttributes']);_0x904ea6['query']=_[_0xfa6d('0x2f')](_0x2b2bac['query']);_0x904ea6[_0xfa6d('0x30')]=_['intersection'](_0x904ea6[_0xfa6d('0x32')],_0x904ea6[_0xfa6d('0x2e')]);_0x235a21[_0xfa6d('0x33')]=_[_0xfa6d('0x31')](_0x904ea6[_0xfa6d('0x32')],qs[_0xfa6d('0x34')](_0x2b2bac[_0xfa6d('0x2e')][_0xfa6d('0x34')]));_0x235a21[_0xfa6d('0x33')]=_0x235a21[_0xfa6d('0x33')]['length']?_0x235a21[_0xfa6d('0x33')]:_0x904ea6[_0xfa6d('0x32')];if(_0x2b2bac['query'][_0xfa6d('0x3c')]){_0x235a21[_0xfa6d('0x3d')]=[{'all':!![]}];}_0x235a21=_[_0xfa6d('0x41')]({},_0x235a21,_0x2b2bac[_0xfa6d('0x42')]);return db['ServicenowAccount'][_0xfa6d('0x43')](_0x235a21)[_0xfa6d('0x25')](handleEntityNotFound(_0x30b648,null))[_0xfa6d('0x25')](respondWithResult(_0x30b648,null))[_0xfa6d('0x3f')](handleError(_0x30b648,null));};exports[_0xfa6d('0x44')]=function(_0xaeb3e1,_0x4d56e5){return db['ServicenowAccount']['create'](_0xaeb3e1[_0xfa6d('0x45')],{})[_0xfa6d('0x25')](respondWithResult(_0x4d56e5,0xc9))['catch'](handleError(_0x4d56e5,null));};exports[_0xfa6d('0x24')]=function(_0x104b25,_0x390cc2){if(_0x104b25[_0xfa6d('0x45')]['id']){delete _0x104b25[_0xfa6d('0x45')]['id'];}return db[_0xfa6d('0x3b')][_0xfa6d('0x43')]({'where':{'id':_0x104b25[_0xfa6d('0x40')]['id']}})[_0xfa6d('0x25')](handleEntityNotFound(_0x390cc2,null))[_0xfa6d('0x25')](saveUpdates(_0x104b25['body'],null))[_0xfa6d('0x25')](respondWithResult(_0x390cc2,null))['catch'](handleError(_0x390cc2,null));};exports[_0xfa6d('0x46')]=function(_0x16d189,_0x1dc786){return db['ServicenowAccount'][_0xfa6d('0x43')]({'where':{'id':_0x16d189[_0xfa6d('0x40')]['id']}})[_0xfa6d('0x25')](handleEntityNotFound(_0x1dc786,null))[_0xfa6d('0x25')](removeEntity(_0x1dc786,null))['catch'](handleError(_0x1dc786,null));};exports[_0xfa6d('0x47')]=function(_0x1c0def,_0x3d44c2,_0x57ab99){var _0xab6e73={};var _0x2668bc={};var _0x528c28;var _0x5e5f64;return db[_0xfa6d('0x3b')][_0xfa6d('0x48')]({'where':{'id':_0x1c0def[_0xfa6d('0x40')]['id']}})[_0xfa6d('0x25')](handleEntityNotFound(_0x3d44c2,null))[_0xfa6d('0x25')](function(_0x59b216){if(_0x59b216){_0x528c28=_0x59b216;_0x2668bc[_0xfa6d('0x32')]=_[_0xfa6d('0x2f')](db[_0xfa6d('0x49')][_0xfa6d('0x2b')]);_0x2668bc[_0xfa6d('0x2e')]=_[_0xfa6d('0x2f')](_0x1c0def[_0xfa6d('0x2e')]);_0x2668bc[_0xfa6d('0x30')]=_[_0xfa6d('0x31')](_0x2668bc['model'],_0x2668bc['query']);_0xab6e73[_0xfa6d('0x33')]=_[_0xfa6d('0x31')](_0x2668bc[_0xfa6d('0x32')],qs[_0xfa6d('0x34')](_0x1c0def[_0xfa6d('0x2e')][_0xfa6d('0x34')]));_0xab6e73[_0xfa6d('0x33')]=_0xab6e73[_0xfa6d('0x33')]['length']?_0xab6e73[_0xfa6d('0x33')]:_0x2668bc['model'];_0xab6e73[_0xfa6d('0x4a')]=qs['sort'](_0x1c0def[_0xfa6d('0x2e')][_0xfa6d('0x37')]);_0xab6e73['where']=qs['filters'](_[_0xfa6d('0x4b')](_0x1c0def[_0xfa6d('0x2e')],_0x2668bc['filters']));if(_0x1c0def[_0xfa6d('0x2e')][_0xfa6d('0x39')]){_0xab6e73['where']=_[_0xfa6d('0x41')](_0xab6e73[_0xfa6d('0x38')],{'$or':_[_0xfa6d('0x2a')](_0xab6e73['attributes'],function(_0x2db0d7){var _0x5c39e5={};_0x5c39e5[_0x2db0d7]={'$like':'%'+_0x1c0def['query']['filter']+'%'};return _0x5c39e5;})});}_0xab6e73=_[_0xfa6d('0x41')]({},_0xab6e73,_0x1c0def['options']);return _0x528c28['getConfigurations'](_0xab6e73);}})['then'](function(_0x195d62){if(_0x195d62){_0x5e5f64=_0x195d62[_0xfa6d('0x35')];if(!_0x1c0def[_0xfa6d('0x2e')][_0xfa6d('0x4c')](_0xfa6d('0x36'))){_0xab6e73[_0xfa6d('0x1c')]=qs[_0xfa6d('0x1c')](_0x1c0def['query'][_0xfa6d('0x1c')]);_0xab6e73[_0xfa6d('0x1e')]=qs['offset'](_0x1c0def[_0xfa6d('0x2e')][_0xfa6d('0x1e')]);}return _0x528c28[_0xfa6d('0x47')](_0xab6e73);}})['then'](function(_0x2694ce){if(_0x2694ce){return _0x2694ce?{'count':_0x5e5f64,'rows':_0x2694ce}:null;}})[_0xfa6d('0x25')](respondWithResult(_0x3d44c2,null))['catch'](handleError(_0x3d44c2,null));};exports['addConfiguration']=function(_0x300260,_0x31c4de,_0x5ad643){if(_0x300260[_0xfa6d('0x45')]['id']){delete _0x300260[_0xfa6d('0x45')]['id'];}return db['ServicenowAccount'][_0xfa6d('0x48')]({'where':{'id':_0x300260[_0xfa6d('0x40')]['id']}})[_0xfa6d('0x25')](handleEntityNotFound(_0x31c4de,null))[_0xfa6d('0x25')](function(_0x21801c){if(_0x21801c){_0x300260['body'][_0xfa6d('0x4d')]=_0x21801c['id'];_0x300260['body']['Subjects']=integrations['getSubjects'](_0x300260['body'][_0xfa6d('0x4e')],_0x300260[_0xfa6d('0x45')][_0xfa6d('0x4f')]);_0x300260['body'][_0xfa6d('0x50')]=integrations[_0xfa6d('0x51')](_0x300260[_0xfa6d('0x45')][_0xfa6d('0x4e')],_0x300260[_0xfa6d('0x45')][_0xfa6d('0x4f')]);return db[_0xfa6d('0x49')][_0xfa6d('0x44')](_0x300260[_0xfa6d('0x45')],{'include':[{'model':db[_0xfa6d('0x52')],'as':_0xfa6d('0x53')},{'model':db[_0xfa6d('0x52')],'as':_0xfa6d('0x50')}]});}return null;})[_0xfa6d('0x25')](respondWithResult(_0x31c4de,null))[_0xfa6d('0x3f')](handleError(_0x31c4de,null));};exports[_0xfa6d('0x54')]=function(_0x150cf5,_0x333397,_0x4f0a9f){var _0x54703d=[_0xfa6d('0x55'),_0xfa6d('0x56'),_0xfa6d('0x57'),_0xfa6d('0x58'),_0xfa6d('0x59'),_0xfa6d('0x5a'),_0xfa6d('0x5b'),_0xfa6d('0x5c'),_0xfa6d('0x5d')];var _0x1bfd6a=[_0xfa6d('0x5e'),_0xfa6d('0x55'),'caused_by','watch_list',_0xfa6d('0x5f'),_0xfa6d('0x60'),_0xfa6d('0x61'),_0xfa6d('0x56'),_0xfa6d('0x62'),_0xfa6d('0x63'),_0xfa6d('0x64'),_0xfa6d('0x65'),_0xfa6d('0x66'),_0xfa6d('0x67'),_0xfa6d('0x68'),_0xfa6d('0x69'),_0xfa6d('0x6a'),_0xfa6d('0x6b'),_0xfa6d('0x57'),'order','calendar_stc',_0xfa6d('0x6c'),'cmdb_ci',_0xfa6d('0x6d'),_0xfa6d('0x6e'),_0xfa6d('0x6f'),_0xfa6d('0x70'),_0xfa6d('0x71'),_0xfa6d('0x72'),_0xfa6d('0x73'),_0xfa6d('0x74'),_0xfa6d('0x75'),_0xfa6d('0x76'),_0xfa6d('0x77'),_0xfa6d('0x78'),_0xfa6d('0x79'),_0xfa6d('0x7a'),_0xfa6d('0x7b'),_0xfa6d('0x7c'),_0xfa6d('0x7d'),_0xfa6d('0x7e'),_0xfa6d('0x58'),_0xfa6d('0x7f'),_0xfa6d('0x80'),'close_code',_0xfa6d('0x81'),_0xfa6d('0x82'),_0xfa6d('0x83'),'assignment_group','business_stc','additional_assignee_list','description',_0xfa6d('0x84'),_0xfa6d('0x5a'),_0xfa6d('0x85'),_0xfa6d('0x86'),_0xfa6d('0x87'),_0xfa6d('0x88'),_0xfa6d('0x89'),_0xfa6d('0x8a'),_0xfa6d('0x8b'),_0xfa6d('0x8c'),_0xfa6d('0x5b'),_0xfa6d('0x8d'),_0xfa6d('0x8e'),_0xfa6d('0x8f'),_0xfa6d('0x90'),_0xfa6d('0x91'),_0xfa6d('0x92'),_0xfa6d('0x5c'),_0xfa6d('0x93'),_0xfa6d('0x94'),'approval','comments_and_work_notes',_0xfa6d('0x95'),_0xfa6d('0x96'),_0xfa6d('0x97'),_0xfa6d('0x98'),_0xfa6d('0x99'),_0xfa6d('0x9a'),_0xfa6d('0x9b'),_0xfa6d('0x9c'),_0xfa6d('0x5d')];var _0x50156a='';var _0x113513='';var _0x192d05=[];var _0x3fb30a='';var _0x33bd6c='';var _0x351d35=[];var _0x526d72='';var _0x5c7dab='';var _0x2cd4d5={};var _0x548e34='';return db[_0xfa6d('0x3b')][_0xfa6d('0x48')]({'where':{'id':_0x150cf5[_0xfa6d('0x40')]['id']},'attributes':['id','username',_0xfa6d('0x9d'),_0xfa6d('0x9e'),_0xfa6d('0x9f'),'serverUrl']})[_0xfa6d('0x25')](handleEntityNotFound(_0x333397,null))[_0xfa6d('0x25')](function(_0x27c54f){if(_0x27c54f){_0x548e34=_0x27c54f[_0xfa6d('0x9f')];var _0x49539b=_0x548e34['slice'](-0x1);if(_0x49539b==='/'){_0x548e34=_0x548e34['substring'](0x0,_0x548e34[_0xfa6d('0xa0')](_0x49539b));}_0x5c7dab=util[_0xfa6d('0xa1')]('%s/api/now/doc/table/schema/',_0x548e34);_0x526d72=util[_0xfa6d('0xa1')]('%s/api/now/table/',_0x548e34);_0x2cd4d5={'user':_0x27c54f[_0xfa6d('0xa2')],'pass':_0x27c54f[_0xfa6d('0x9d')]};var _0x233b2c={'method':_0xfa6d('0xa3'),'uri':_0x5c7dab+_0xfa6d('0xa4'),'auth':_0x2cd4d5,'json':!![]};return rp(_0x233b2c);}})[_0xfa6d('0x25')](function(_0x3e44be){if(_0x3e44be['result'][_0xfa6d('0x35')]>0x0){_0x50156a=_0x3e44be[_0xfa6d('0xa5')];}console[_0xfa6d('0xa6')](_0xfa6d('0xa7'),_0x50156a);_0x351d35=[];_0x113513=Object[_0xfa6d('0xa8')]([],_0x50156a);_[_0xfa6d('0xa9')](_0x113513,function(_0x2fab07){return!_0x54703d[_0xfa6d('0xaa')](_0x2fab07[_0xfa6d('0x29')]);});_0x113513['forEach'](function(_0x32ef7f){var _0xcff452=createFieldObject(_0x526d72,_0x2cd4d5,_0x32ef7f[_0xfa6d('0xab')],_0x32ef7f[_0xfa6d('0x29')],_0x32ef7f['label'],![]);_0x351d35[_0xfa6d('0xac')](_0xcff452);});return Promise[_0xfa6d('0xad')](_0x351d35);})[_0xfa6d('0x25')](function(_0x5c8de9){_0x192d05=_0x5c8de9;_0x3fb30a=Object[_0xfa6d('0xa8')]([],_0x50156a);console['log'](_0xfa6d('0xae'),_0x50156a);_[_0xfa6d('0xa9')](_0x3fb30a,function(_0x484f3e){return _0x1bfd6a[_0xfa6d('0xaa')](_0x484f3e['name']);});console['log'](_0xfa6d('0xaf'),_0x3fb30a);_0x351d35=[];_0x3fb30a[_0xfa6d('0xb0')](function(_0x296696){var _0x24e41d=createFieldObject(_0x526d72,_0x2cd4d5,_0x296696[_0xfa6d('0xab')],_0x296696['name'],_0x296696[_0xfa6d('0xb1')],!![]);_0x351d35['push'](_0x24e41d);});return Promise[_0xfa6d('0xad')](_0x351d35);})[_0xfa6d('0x25')](function(_0x47b81a){_0x33bd6c=_0x47b81a;var _0x664d66=_0x192d05[_0xfa6d('0xb2')](_0x33bd6c);return{'count':_0x664d66['length'],'rows':_0x664d66};})['then'](respondWithResult(_0x333397,null))[_0xfa6d('0x3f')](function(_0x2c0abb){console[_0xfa6d('0xa6')](_0xfa6d('0xb3')+_0x2c0abb);var _0x1bc441=_0x150cf5[_0xfa6d('0x2e')][_0xfa6d('0xb4')]?0x1f4:_0x2c0abb[_0xfa6d('0xb5')]||0x1f4;logger[_0xfa6d('0x27')](_0x2c0abb[_0xfa6d('0x28')]);delete _0x2c0abb['name'];if(_0x1bc441===0x191){_0x1bc441=0x190;}_0x333397[_0xfa6d('0x20')](_0x1bc441)[_0xfa6d('0xb6')](_0x150cf5['query'][_0xfa6d('0xb4')]?{'message':_0xfa6d('0xb7'),'statusCode':_0x2c0abb[_0xfa6d('0xb5')]}:_0x2c0abb);});};function createFieldObject(_0x1aa159,_0x3f44a3,_0x5a17da,_0x57fb3e,_0x1cd69e,_0x462d25){return new Promise(function(_0x3958e8,_0x2e2cb4){var _0x4d767f={'id':_0x57fb3e,'name':_0x1cd69e,'custom':_0x462d25};if(_0x5a17da==='boolean'){_0x4d767f['options']=[{'name':_0xfa6d('0xb8'),'value':_0xfa6d('0xb9')},{'name':_0xfa6d('0xba'),'value':_0xfa6d('0xbb')}];_0x3958e8(_0x4d767f);}else{var _0x292114={'method':_0xfa6d('0xa3'),'uri':_0x1aa159+_0xfa6d('0xbc')+_0x57fb3e,'auth':_0x3f44a3,'json':!![]};return rp(_0x292114)['then'](function(_0x162d00){var _0x142608=[];if(_0x162d00['result'][_0xfa6d('0x35')]>0x0){_0x162d00['result'][_0xfa6d('0xb0')](function(_0x40e124){if(_0x40e124[_0xfa6d('0xbd')]===_0xfa6d('0xbb')){var _0x1d85ce={'name':_0x40e124[_0xfa6d('0xb1')],'value':_0x40e124['value']};_0x142608[_0xfa6d('0xac')](_0x1d85ce);}});}_0x4d767f[_0xfa6d('0x42')]=_0x142608;if(_0x4d767f[_0xfa6d('0x42')][_0xfa6d('0x35')]>0x0){_0x3958e8(_0x4d767f);}else{if(_0x462d25==![]){_0x3958e8();}else{_0x3958e8(_0x4d767f);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index e223387..705fbc9 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 _0xc4aa=['bluebird','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','lodash','util','../../config/logger','api','moment'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xc4aa[_0x3d42d8];return _0x27fc41;};'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'));var integrations=require(_0xac4a('0x8'));module[_0xac4a('0x9')]=function(_0x96be2b,_0x15cd34){return _0x96be2b[_0xac4a('0xa')](_0xac4a('0xb'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x038b=['path','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','define','ServicenowAccount','util','../../config/logger','api','bluebird'];(function(_0x2c9464,_0x3f195c){var _0x54d370=function(_0x4aa4af){while(--_0x4aa4af){_0x2c9464['push'](_0x2c9464['shift']());}};_0x54d370(++_0x3f195c);}(_0x038b,0x114));var _0xb038=function(_0x117242,_0xa1677f){_0x117242=_0x117242-0x0;var _0x100034=_0x038b[_0x117242];return _0x100034;};'use strict';var _=require('lodash');var util=require(_0xb038('0x0'));var logger=require(_0xb038('0x1'))(_0xb038('0x2'));var moment=require('moment');var BPromise=require(_0xb038('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb038('0x4'));var rimraf=require(_0xb038('0x5'));var config=require('../../config/environment');var attributes=require(_0xb038('0x6'));var integrations=require(_0xb038('0x7'));module['exports']=function(_0x54e1e7,_0x2e3e64){return _0x54e1e7[_0xb038('0x8')](_0xb038('0x9'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 6c85538..117b7a8 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 _0x0064=['../../config/utils','rpc','jayson/promise','http','request','then','info','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','ServicenowAccount,\x20%s,\x20%s','message','catch','GetServicenowAccount','ServicenowAccount','findAll','raw','options','where','attributes','limit','include','map','model','ShowServicenowAccount','find','lodash','bluebird','randomstring','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0064,0x18f));var _0x4006=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0064[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4006('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4006('0x1'));var rs=require(_0x4006('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4006('0x3'))['db'];var utils=require(_0x4006('0x4'));var logger=require('../../config/logger')(_0x4006('0x5'));var config=require('../../config/environment');var jayson=require(_0x4006('0x6'));var client=jayson['client'][_0x4006('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1ed550,_0x333bd2,_0x496cde){return new BPromise(function(_0x2887ce,_0xa3c524){return client[_0x4006('0x8')](_0x1ed550,_0x496cde)[_0x4006('0x9')](function(_0x572045){logger[_0x4006('0xa')]('ServicenowAccount,\x20%s,\x20%s',_0x333bd2,_0x4006('0xb'));logger['debug'](_0x4006('0xc'),_0x333bd2,_0x4006('0xb'),JSON[_0x4006('0xd')](_0x572045));if(_0x572045['error']){if(_0x572045[_0x4006('0xe')]['code']===0x1f4){logger[_0x4006('0xe')](_0x4006('0xf'),_0x333bd2,_0x572045[_0x4006('0xe')][_0x4006('0x10')]);return _0xa3c524(_0x572045[_0x4006('0xe')]['message']);}logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x333bd2,_0x572045[_0x4006('0xe')][_0x4006('0x10')]);return _0x2887ce(_0x572045[_0x4006('0xe')]['message']);}else{logger[_0x4006('0xa')](_0x4006('0xf'),_0x333bd2,'request\x20sent');_0x2887ce(_0x572045['result'][_0x4006('0x10')]);}})[_0x4006('0x11')](function(_0x2adfd2){logger[_0x4006('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x333bd2,_0x2adfd2);_0xa3c524(_0x2adfd2);});});}exports[_0x4006('0x12')]=function(_0x42ef87){var _0x5b4f05=this;return new Promise(function(_0x1fbd5e,_0xb131c7){return db[_0x4006('0x13')][_0x4006('0x14')]({'raw':_0x42ef87['options']?_0x42ef87['options'][_0x4006('0x15')]===undefined?!![]:![]:!![],'where':_0x42ef87[_0x4006('0x16')]?_0x42ef87[_0x4006('0x16')][_0x4006('0x17')]||null:null,'attributes':_0x42ef87[_0x4006('0x16')]?_0x42ef87['options'][_0x4006('0x18')]||null:null,'limit':_0x42ef87['options']?_0x42ef87[_0x4006('0x16')][_0x4006('0x19')]||null:null,'include':_0x42ef87[_0x4006('0x16')]?_0x42ef87[_0x4006('0x16')][_0x4006('0x1a')]?_[_0x4006('0x1b')](_0x42ef87[_0x4006('0x16')][_0x4006('0x1a')],function(_0x16ff8d){return{'model':db[_0x16ff8d['model']],'as':_0x16ff8d['as'],'attributes':_0x16ff8d[_0x4006('0x18')],'include':_0x16ff8d[_0x4006('0x1a')]?_[_0x4006('0x1b')](_0x16ff8d['include'],function(_0x38d3e5){return{'model':db[_0x38d3e5[_0x4006('0x1c')]],'as':_0x38d3e5['as'],'attributes':_0x38d3e5[_0x4006('0x18')],'include':_0x38d3e5['include']?_['map'](_0x38d3e5['include'],function(_0x2c78b0){return{'model':db[_0x2c78b0[_0x4006('0x1c')]],'as':_0x2c78b0['as'],'attributes':_0x2c78b0['attributes']};}):[]};}):[]};}):[]:[]})[_0x4006('0x9')](function(_0x5c685d){logger[_0x4006('0xa')]('GetServicenowAccount',_0x42ef87);logger['debug'](_0x4006('0x12'),_0x42ef87,JSON[_0x4006('0xd')](_0x5c685d));_0x1fbd5e(_0x5c685d);})[_0x4006('0x11')](function(_0x4bdd9e){logger[_0x4006('0xe')](_0x4006('0x12'),_0x4bdd9e[_0x4006('0x10')],_0x42ef87);_0xb131c7(_0x5b4f05[_0x4006('0xe')](0x1f4,_0x4bdd9e[_0x4006('0x10')]));});});};exports[_0x4006('0x1d')]=function(_0x35fc4b){var _0x599e33=this;return new Promise(function(_0x242124,_0x12cab8){return db[_0x4006('0x13')][_0x4006('0x1e')]({'raw':_0x35fc4b[_0x4006('0x16')]?_0x35fc4b['options']['raw']===undefined?!![]:![]:!![],'where':_0x35fc4b['options']?_0x35fc4b[_0x4006('0x16')][_0x4006('0x17')]||null:null,'attributes':_0x35fc4b[_0x4006('0x16')]?_0x35fc4b[_0x4006('0x16')][_0x4006('0x18')]||null:null,'include':_0x35fc4b['options']?_0x35fc4b[_0x4006('0x16')][_0x4006('0x1a')]?_[_0x4006('0x1b')](_0x35fc4b[_0x4006('0x16')][_0x4006('0x1a')],function(_0x3b8af9){return{'model':db[_0x3b8af9['model']],'as':_0x3b8af9['as'],'attributes':_0x3b8af9[_0x4006('0x18')],'include':_0x3b8af9['include']?_[_0x4006('0x1b')](_0x3b8af9[_0x4006('0x1a')],function(_0x52d057){return{'model':db[_0x52d057['model']],'as':_0x52d057['as'],'attributes':_0x52d057[_0x4006('0x18')],'include':_0x52d057['include']?_[_0x4006('0x1b')](_0x52d057['include'],function(_0x3226a3){return{'model':db[_0x3226a3['model']],'as':_0x3226a3['as'],'attributes':_0x3226a3['attributes']};}):[]};}):[]};}):[]:[]})[_0x4006('0x9')](function(_0x418d05){logger[_0x4006('0xa')](_0x4006('0x1d'),_0x35fc4b);logger['debug'](_0x4006('0x1d'),_0x35fc4b,JSON['stringify'](_0x418d05));_0x242124(_0x418d05);})[_0x4006('0x11')](function(_0x2e8c53){logger['error']('ShowServicenowAccount',_0x2e8c53[_0x4006('0x10')],_0x35fc4b);_0x12cab8(_0x599e33[_0x4006('0xe')](0x1f4,_0x2e8c53[_0x4006('0x10')]));});});}; \ No newline at end of file +var _0xd091=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','where','options','attributes','limit','include','map','model','ShowServicenowAccount','find','raw','lodash','bluebird'];(function(_0x47f55d,_0x306e6b){var _0x3bc92b=function(_0x21b632){while(--_0x21b632){_0x47f55d['push'](_0x47f55d['shift']());}};_0x3bc92b(++_0x306e6b);}(_0xd091,0x195));var _0x1d09=function(_0x326c48,_0x31eee6){_0x326c48=_0x326c48-0x0;var _0xf71bc5=_0xd091[_0x326c48];return _0xf71bc5;};'use strict';var _=require(_0x1d09('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1d09('0x1'));var rs=require(_0x1d09('0x2'));var fs=require('fs');var Redis=require(_0x1d09('0x3'));var db=require(_0x1d09('0x4'))['db'];var utils=require(_0x1d09('0x5'));var logger=require(_0x1d09('0x6'))('rpc');var config=require(_0x1d09('0x7'));var jayson=require(_0x1d09('0x8'));var client=jayson[_0x1d09('0x9')][_0x1d09('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f78f0,_0x5f0eba,_0x3162d7){return new BPromise(function(_0x4b82a3,_0x15f290){return client[_0x1d09('0xb')](_0x3f78f0,_0x3162d7)[_0x1d09('0xc')](function(_0x4dbeed){logger[_0x1d09('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x5f0eba,_0x1d09('0xe'));logger[_0x1d09('0xf')](_0x1d09('0x10'),_0x5f0eba,_0x1d09('0xe'),JSON[_0x1d09('0x11')](_0x4dbeed));if(_0x4dbeed[_0x1d09('0x12')]){if(_0x4dbeed[_0x1d09('0x12')][_0x1d09('0x13')]===0x1f4){logger[_0x1d09('0x12')](_0x1d09('0x14'),_0x5f0eba,_0x4dbeed['error'][_0x1d09('0x15')]);return _0x15f290(_0x4dbeed['error'][_0x1d09('0x15')]);}logger[_0x1d09('0x12')](_0x1d09('0x14'),_0x5f0eba,_0x4dbeed[_0x1d09('0x12')][_0x1d09('0x15')]);return _0x4b82a3(_0x4dbeed['error']['message']);}else{logger[_0x1d09('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x5f0eba,_0x1d09('0xe'));_0x4b82a3(_0x4dbeed[_0x1d09('0x16')][_0x1d09('0x15')]);}})[_0x1d09('0x17')](function(_0x55edb){logger[_0x1d09('0x12')](_0x1d09('0x14'),_0x5f0eba,_0x55edb);_0x15f290(_0x55edb);});});}exports[_0x1d09('0x18')]=function(_0x5e6c32){var _0x220ffb=this;return new Promise(function(_0x1d265c,_0x3aac3d){return db[_0x1d09('0x19')][_0x1d09('0x1a')]({'raw':_0x5e6c32['options']?_0x5e6c32['options']['raw']===undefined?!![]:![]:!![],'where':_0x5e6c32['options']?_0x5e6c32['options'][_0x1d09('0x1b')]||null:null,'attributes':_0x5e6c32[_0x1d09('0x1c')]?_0x5e6c32[_0x1d09('0x1c')][_0x1d09('0x1d')]||null:null,'limit':_0x5e6c32[_0x1d09('0x1c')]?_0x5e6c32[_0x1d09('0x1c')][_0x1d09('0x1e')]||null:null,'include':_0x5e6c32[_0x1d09('0x1c')]?_0x5e6c32[_0x1d09('0x1c')][_0x1d09('0x1f')]?_[_0x1d09('0x20')](_0x5e6c32[_0x1d09('0x1c')]['include'],function(_0x49be2e){return{'model':db[_0x49be2e[_0x1d09('0x21')]],'as':_0x49be2e['as'],'attributes':_0x49be2e[_0x1d09('0x1d')],'include':_0x49be2e['include']?_['map'](_0x49be2e[_0x1d09('0x1f')],function(_0x3e726a){return{'model':db[_0x3e726a[_0x1d09('0x21')]],'as':_0x3e726a['as'],'attributes':_0x3e726a[_0x1d09('0x1d')],'include':_0x3e726a[_0x1d09('0x1f')]?_[_0x1d09('0x20')](_0x3e726a[_0x1d09('0x1f')],function(_0x1731a7){return{'model':db[_0x1731a7['model']],'as':_0x1731a7['as'],'attributes':_0x1731a7[_0x1d09('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1d09('0xc')](function(_0x39bf7b){logger[_0x1d09('0xd')](_0x1d09('0x18'),_0x5e6c32);logger[_0x1d09('0xf')]('GetServicenowAccount',_0x5e6c32,JSON['stringify'](_0x39bf7b));_0x1d265c(_0x39bf7b);})[_0x1d09('0x17')](function(_0x3c10e0){logger[_0x1d09('0x12')](_0x1d09('0x18'),_0x3c10e0['message'],_0x5e6c32);_0x3aac3d(_0x220ffb[_0x1d09('0x12')](0x1f4,_0x3c10e0['message']));});});};exports[_0x1d09('0x22')]=function(_0x46f2d1){var _0x38b78e=this;return new Promise(function(_0x182d00,_0x44647a){return db['ServicenowAccount'][_0x1d09('0x23')]({'raw':_0x46f2d1[_0x1d09('0x1c')]?_0x46f2d1[_0x1d09('0x1c')][_0x1d09('0x24')]===undefined?!![]:![]:!![],'where':_0x46f2d1[_0x1d09('0x1c')]?_0x46f2d1[_0x1d09('0x1c')][_0x1d09('0x1b')]||null:null,'attributes':_0x46f2d1[_0x1d09('0x1c')]?_0x46f2d1[_0x1d09('0x1c')][_0x1d09('0x1d')]||null:null,'include':_0x46f2d1[_0x1d09('0x1c')]?_0x46f2d1['options'][_0x1d09('0x1f')]?_['map'](_0x46f2d1[_0x1d09('0x1c')][_0x1d09('0x1f')],function(_0x1a6895){return{'model':db[_0x1a6895[_0x1d09('0x21')]],'as':_0x1a6895['as'],'attributes':_0x1a6895['attributes'],'include':_0x1a6895[_0x1d09('0x1f')]?_[_0x1d09('0x20')](_0x1a6895[_0x1d09('0x1f')],function(_0x358af6){return{'model':db[_0x358af6['model']],'as':_0x358af6['as'],'attributes':_0x358af6[_0x1d09('0x1d')],'include':_0x358af6['include']?_['map'](_0x358af6[_0x1d09('0x1f')],function(_0x5badf5){return{'model':db[_0x5badf5['model']],'as':_0x5badf5['as'],'attributes':_0x5badf5['attributes']};}):[]};}):[]};}):[]:[]})[_0x1d09('0xc')](function(_0x22241d){logger[_0x1d09('0xd')](_0x1d09('0x22'),_0x46f2d1);logger[_0x1d09('0xf')](_0x1d09('0x22'),_0x46f2d1,JSON['stringify'](_0x22241d));_0x182d00(_0x22241d);})[_0x1d09('0x17')](function(_0x4c83b1){logger['error'](_0x1d09('0x22'),_0x4c83b1[_0x1d09('0x15')],_0x46f2d1);_0x44647a(_0x38b78e[_0x1d09('0x12')](0x1f4,_0x4c83b1[_0x1d09('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index a0ea16b..ba77f80 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 _0xf27f=['/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0x24dd63,_0x5c1220){var _0x282365=function(_0x38a2d0){while(--_0x38a2d0){_0x24dd63['push'](_0x24dd63['shift']());}};_0x282365(++_0x5c1220);}(_0xf27f,0x181));var _0xff27=function(_0x2269c1,_0x376258){_0x2269c1=_0x2269c1-0x0;var _0x184117=_0xf27f[_0x2269c1];return _0x184117;};'use strict';var multer=require(_0xff27('0x0'));var util=require(_0xff27('0x1'));var path=require('path');var timeout=require(_0xff27('0x2'));var express=require(_0xff27('0x3'));var router=express[_0xff27('0x4')]();var fs_extra=require(_0xff27('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xff27('0x6'));var config=require(_0xff27('0x7'));var controller=require('./intServicenowConfiguration.controller');router['get']('/',auth[_0xff27('0x8')](),controller[_0xff27('0x9')]);router[_0xff27('0xa')](_0xff27('0xb'),auth[_0xff27('0x8')](),controller[_0xff27('0xc')]);router[_0xff27('0xa')](_0xff27('0xd'),auth[_0xff27('0x8')](),controller['getFields']);router['get'](_0xff27('0xe'),auth['isAuthenticated'](),controller[_0xff27('0xf')]);router[_0xff27('0xa')](_0xff27('0x10'),auth[_0xff27('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0xff27('0x8')](),controller[_0xff27('0x11')]);router['put'](_0xff27('0xb'),auth['isAuthenticated'](),controller[_0xff27('0x12')]);router[_0xff27('0x13')](_0xff27('0xb'),auth[_0xff27('0x8')](),controller[_0xff27('0x14')]);module[_0xff27('0x15')]=router; \ No newline at end of file +var _0x2bc9=['/:id/fields','getFields','/:id/subjects','isAuthenticated','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','index','get','/:id'];(function(_0x5c30b1,_0x403e8e){var _0x2fd81e=function(_0x39c7c7){while(--_0x39c7c7){_0x5c30b1['push'](_0x5c30b1['shift']());}};_0x2fd81e(++_0x403e8e);}(_0x2bc9,0x8b));var _0x92bc=function(_0x1d5d3f,_0x3a9d08){_0x1d5d3f=_0x1d5d3f-0x0;var _0x6f9221=_0x2bc9[_0x1d5d3f];return _0x6f9221;};'use strict';var multer=require('multer');var util=require(_0x92bc('0x0'));var path=require(_0x92bc('0x1'));var timeout=require(_0x92bc('0x2'));var express=require(_0x92bc('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x92bc('0x4'));var interaction=require(_0x92bc('0x5'));var config=require(_0x92bc('0x6'));var controller=require(_0x92bc('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x92bc('0x8')]);router[_0x92bc('0x9')](_0x92bc('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x92bc('0x9')](_0x92bc('0xb'),auth['isAuthenticated'](),controller[_0x92bc('0xc')]);router['get'](_0x92bc('0xd'),auth[_0x92bc('0xe')](),controller[_0x92bc('0xf')]);router[_0x92bc('0x9')](_0x92bc('0x10'),auth['isAuthenticated'](),controller[_0x92bc('0x11')]);router[_0x92bc('0x12')]('/',auth[_0x92bc('0xe')](),controller[_0x92bc('0x13')]);router[_0x92bc('0x14')]('/:id',auth[_0x92bc('0xe')](),controller[_0x92bc('0x15')]);router[_0x92bc('0x16')](_0x92bc('0xa'),auth[_0x92bc('0xe')](),controller[_0x92bc('0x17')]);module[_0x92bc('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index e69032c..5385633 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 _0xe390=['STRING'];(function(_0x3f9313,_0x3cad05){var _0x5e6256=function(_0x4f577d){while(--_0x4f577d){_0x3f9313['push'](_0x3f9313['shift']());}};_0x5e6256(++_0x3cad05);}(_0xe390,0x1da));var _0x0e39=function(_0x311266,_0xd779b6){_0x311266=_0x311266-0x0;var _0xe10a3f=_0xe390[_0x311266];return _0xe10a3f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0e39('0x0')]},'description':{'type':Sequelize[_0x0e39('0x0')]}}; \ No newline at end of file +var _0x8749=['exports','STRING','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8749,0x1e8));var _0x9874=function(_0x105527,_0x57268d){_0x105527=_0x105527-0x0;var _0x3f4ce7=_0x8749[_0x105527];return _0x3f4ce7;};'use strict';var Sequelize=require(_0x9874('0x0'));module[_0x9874('0x1')]={'name':{'type':Sequelize[_0x9874('0x2')]},'description':{'type':Sequelize[_0x9874('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 6975a16..6866952 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 _0x7ca8=['VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','params','create','body','find','destroy','getFields','ServicenowField','order','pick','getSubjects','findOne','getDescriptions','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7ca8,0x1e9));var _0x87ca=function(_0x15d123,_0x14bf30){_0x15d123=_0x15d123-0x0;var _0x4563a0=_0x7ca8[_0x15d123];return _0x4563a0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x87ca('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x87ca('0x1'));var rp=require(_0x87ca('0x2'));var moment=require('moment');var BPromise=require(_0x87ca('0x3'));var Mustache=require('mustache');var util=require(_0x87ca('0x4'));var path=require(_0x87ca('0x5'));var sox=require(_0x87ca('0x6'));var csv=require(_0x87ca('0x7'));var ejs=require(_0x87ca('0x8'));var fs=require('fs');var fs_extra=require(_0x87ca('0x9'));var _=require(_0x87ca('0xa'));var squel=require(_0x87ca('0xb'));var crypto=require(_0x87ca('0xc'));var jsforce=require(_0x87ca('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x87ca('0x7'));var querystring=require(_0x87ca('0xe'));var Papa=require('papaparse');var Redis=require(_0x87ca('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x87ca('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x87ca('0x11'));var logger=require('../../config/logger')(_0x87ca('0x12'));var utils=require(_0x87ca('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x87ca('0x14'))['db'];function respondWithStatusCode(_0x439505,_0x40438f){_0x40438f=_0x40438f||0xcc;return function(_0x1bed03){if(_0x1bed03){return _0x439505[_0x87ca('0x15')](_0x40438f);}return _0x439505[_0x87ca('0x16')](_0x40438f)[_0x87ca('0x17')]();};}function respondWithResult(_0x46d47e,_0xb2524a){_0xb2524a=_0xb2524a||0xc8;return function(_0x3921d0){if(_0x3921d0){return _0x46d47e[_0x87ca('0x16')](_0xb2524a)[_0x87ca('0x18')](_0x3921d0);}};}function respondWithFilteredResult(_0x546532,_0x4e416d){return function(_0x963ca){if(_0x963ca){var _0x2cab99=typeof _0x4e416d[_0x87ca('0x19')]===_0x87ca('0x1a')&&typeof _0x4e416d[_0x87ca('0x1b')]===_0x87ca('0x1a');var _0x47d6ab=_0x963ca['count'];var _0x64c2bd=_0x2cab99?0x0:_0x4e416d[_0x87ca('0x19')];var _0x32974b=_0x2cab99?_0x963ca['count']:_0x4e416d[_0x87ca('0x19')]+_0x4e416d[_0x87ca('0x1b')];var _0x8ca057;if(_0x32974b>=_0x47d6ab){_0x32974b=_0x47d6ab;_0x8ca057=0xc8;}else{_0x8ca057=0xce;}_0x546532['status'](_0x8ca057);return _0x546532[_0x87ca('0x1c')](_0x87ca('0x1d'),_0x64c2bd+'-'+_0x32974b+'/'+_0x47d6ab)['json'](_0x963ca);}return null;};}function patchUpdates(_0x3a806e){return function(_0xa1017b){try{jsonpatch[_0x87ca('0x1e')](_0xa1017b,_0x3a806e,!![]);}catch(_0x41067d){return BPromise[_0x87ca('0x1f')](_0x41067d);}return _0xa1017b[_0x87ca('0x20')]();};}function saveUpdates(_0x2b7a0d,_0x2a4e3c){return function(_0xa79d91){if(_0xa79d91){return _0xa79d91[_0x87ca('0x21')](_0x2b7a0d)['then'](function(_0xf68375){return _0xf68375;});}return null;};}function removeEntity(_0x5e094a,_0x30e5a8){return function(_0x54b13d){if(_0x54b13d){return _0x54b13d['destroy']()[_0x87ca('0x22')](function(){_0x5e094a['status'](0xcc)[_0x87ca('0x17')]();});}};}function handleEntityNotFound(_0x2d5e77,_0x1e9e8c){return function(_0x91d612){if(!_0x91d612){_0x2d5e77['sendStatus'](0x194);}return _0x91d612;};}function handleError(_0x3d8881,_0x43ad6f){_0x43ad6f=_0x43ad6f||0x1f4;return function(_0x4545a3){logger[_0x87ca('0x23')](_0x4545a3[_0x87ca('0x24')]);if(_0x4545a3[_0x87ca('0x25')]){delete _0x4545a3[_0x87ca('0x25')];}_0x3d8881['status'](_0x43ad6f)['send'](_0x4545a3);};}exports[_0x87ca('0x26')]=function(_0x5253d4,_0x1fb9bf){var _0x1c7f2b={},_0x3e22d6={},_0x23a772={'count':0x0,'rows':[]};var _0x10a30f=_[_0x87ca('0x27')](db[_0x87ca('0x28')][_0x87ca('0x29')],function(_0x58728d){return{'name':_0x58728d[_0x87ca('0x2a')],'type':_0x58728d[_0x87ca('0x2b')]['key']};});_0x3e22d6['model']=_[_0x87ca('0x27')](_0x10a30f,_0x87ca('0x25'));_0x3e22d6[_0x87ca('0x2c')]=_[_0x87ca('0x2d')](_0x5253d4[_0x87ca('0x2c')]);_0x3e22d6[_0x87ca('0x2e')]=_['intersection'](_0x3e22d6[_0x87ca('0x2f')],_0x3e22d6[_0x87ca('0x2c')]);_0x1c7f2b[_0x87ca('0x30')]=_[_0x87ca('0x31')](_0x3e22d6[_0x87ca('0x2f')],qs[_0x87ca('0x32')](_0x5253d4[_0x87ca('0x2c')][_0x87ca('0x32')]));_0x1c7f2b[_0x87ca('0x30')]=_0x1c7f2b[_0x87ca('0x30')][_0x87ca('0x33')]?_0x1c7f2b['attributes']:_0x3e22d6['model'];if(!_0x5253d4[_0x87ca('0x2c')][_0x87ca('0x34')](_0x87ca('0x35'))){_0x1c7f2b[_0x87ca('0x1b')]=qs[_0x87ca('0x1b')](_0x5253d4[_0x87ca('0x2c')]['limit']);_0x1c7f2b[_0x87ca('0x19')]=qs[_0x87ca('0x19')](_0x5253d4[_0x87ca('0x2c')][_0x87ca('0x19')]);}_0x1c7f2b['order']=qs['sort'](_0x5253d4[_0x87ca('0x2c')][_0x87ca('0x36')]);_0x1c7f2b[_0x87ca('0x37')]=qs['filters'](_['pick'](_0x5253d4[_0x87ca('0x2c')],_0x3e22d6[_0x87ca('0x2e')]),_0x10a30f);if(_0x5253d4[_0x87ca('0x2c')][_0x87ca('0x38')]){_0x1c7f2b['where']=_['merge'](_0x1c7f2b[_0x87ca('0x37')],{'$or':_[_0x87ca('0x27')](_0x10a30f,function(_0x52eb79){if(_0x52eb79[_0x87ca('0x2b')]!==_0x87ca('0x39')){var _0x7dd4e3={};_0x7dd4e3[_0x52eb79[_0x87ca('0x25')]]={'$like':'%'+_0x5253d4[_0x87ca('0x2c')][_0x87ca('0x38')]+'%'};return _0x7dd4e3;}})});}_0x1c7f2b=_[_0x87ca('0x3a')]({},_0x1c7f2b,_0x5253d4[_0x87ca('0x3b')]);var _0x52b750={'where':_0x1c7f2b[_0x87ca('0x37')]};return db[_0x87ca('0x28')][_0x87ca('0x3c')](_0x52b750)['then'](function(_0x1ee48d){_0x23a772[_0x87ca('0x3c')]=_0x1ee48d;if(_0x5253d4[_0x87ca('0x2c')][_0x87ca('0x3d')]){_0x1c7f2b[_0x87ca('0x3e')]=[{'all':!![]}];}return db[_0x87ca('0x28')][_0x87ca('0x3f')](_0x1c7f2b);})[_0x87ca('0x22')](function(_0x177878){_0x23a772[_0x87ca('0x40')]=_0x177878;return _0x23a772;})[_0x87ca('0x22')](respondWithFilteredResult(_0x1fb9bf,_0x1c7f2b))[_0x87ca('0x41')](handleError(_0x1fb9bf,null));};exports['show']=function(_0x210218,_0x2b9bc7){var _0x48c8b7={'raw':![],'where':{'id':_0x210218[_0x87ca('0x42')]['id']}},_0x550263={};_0x550263[_0x87ca('0x2f')]=_['keys'](db[_0x87ca('0x28')][_0x87ca('0x29')]);_0x550263[_0x87ca('0x2c')]=_[_0x87ca('0x2d')](_0x210218[_0x87ca('0x2c')]);_0x550263[_0x87ca('0x2e')]=_[_0x87ca('0x31')](_0x550263[_0x87ca('0x2f')],_0x550263['query']);_0x48c8b7['attributes']=_[_0x87ca('0x31')](_0x550263[_0x87ca('0x2f')],qs[_0x87ca('0x32')](_0x210218[_0x87ca('0x2c')]['fields']));_0x48c8b7['attributes']=_0x48c8b7[_0x87ca('0x30')]['length']?_0x48c8b7[_0x87ca('0x30')]:_0x550263[_0x87ca('0x2f')];if(_0x210218[_0x87ca('0x2c')][_0x87ca('0x3d')]){_0x48c8b7['include']=[{'all':!![]}];}_0x48c8b7=_[_0x87ca('0x3a')]({},_0x48c8b7,_0x210218['options']);return db[_0x87ca('0x28')]['find'](_0x48c8b7)['then'](handleEntityNotFound(_0x2b9bc7,null))[_0x87ca('0x22')](respondWithResult(_0x2b9bc7,null))['catch'](handleError(_0x2b9bc7,null));};exports['create']=function(_0x7b36e,_0x257bbe){return db[_0x87ca('0x28')][_0x87ca('0x43')](_0x7b36e[_0x87ca('0x44')],{})['then'](respondWithResult(_0x257bbe,0xc9))['catch'](handleError(_0x257bbe,null));};exports[_0x87ca('0x21')]=function(_0x4cc00e,_0x43fb79){if(_0x4cc00e[_0x87ca('0x44')]['id']){delete _0x4cc00e[_0x87ca('0x44')]['id'];}return db[_0x87ca('0x28')][_0x87ca('0x45')]({'where':{'id':_0x4cc00e[_0x87ca('0x42')]['id']}})[_0x87ca('0x22')](handleEntityNotFound(_0x43fb79,null))[_0x87ca('0x22')](saveUpdates(_0x4cc00e[_0x87ca('0x44')],null))[_0x87ca('0x22')](respondWithResult(_0x43fb79,null))[_0x87ca('0x41')](handleError(_0x43fb79,null));};exports[_0x87ca('0x46')]=function(_0x4a94e1,_0x50a40a){return db[_0x87ca('0x28')][_0x87ca('0x45')]({'where':{'id':_0x4a94e1[_0x87ca('0x42')]['id']}})[_0x87ca('0x22')](handleEntityNotFound(_0x50a40a,null))['then'](removeEntity(_0x50a40a,null))[_0x87ca('0x41')](handleError(_0x50a40a,null));};exports[_0x87ca('0x47')]=function(_0x5a98cf,_0x19b515,_0x945b8a){var _0x2fff68={};var _0x5da39d={};var _0x56ef06;var _0x4e690c;return db[_0x87ca('0x28')]['findOne']({'where':{'id':_0x5a98cf[_0x87ca('0x42')]['id']}})[_0x87ca('0x22')](handleEntityNotFound(_0x19b515,null))['then'](function(_0x57c153){if(_0x57c153){_0x56ef06=_0x57c153;_0x5da39d['model']=_[_0x87ca('0x2d')](db[_0x87ca('0x48')][_0x87ca('0x29')]);_0x5da39d[_0x87ca('0x2c')]=_[_0x87ca('0x2d')](_0x5a98cf['query']);_0x5da39d[_0x87ca('0x2e')]=_[_0x87ca('0x31')](_0x5da39d[_0x87ca('0x2f')],_0x5da39d[_0x87ca('0x2c')]);_0x2fff68[_0x87ca('0x30')]=_[_0x87ca('0x31')](_0x5da39d['model'],qs[_0x87ca('0x32')](_0x5a98cf[_0x87ca('0x2c')][_0x87ca('0x32')]));_0x2fff68[_0x87ca('0x30')]=_0x2fff68[_0x87ca('0x30')][_0x87ca('0x33')]?_0x2fff68[_0x87ca('0x30')]:_0x5da39d[_0x87ca('0x2f')];_0x2fff68[_0x87ca('0x49')]=qs[_0x87ca('0x36')](_0x5a98cf['query'][_0x87ca('0x36')]);_0x2fff68[_0x87ca('0x37')]=qs[_0x87ca('0x2e')](_[_0x87ca('0x4a')](_0x5a98cf[_0x87ca('0x2c')],_0x5da39d[_0x87ca('0x2e')]));if(_0x5a98cf[_0x87ca('0x2c')][_0x87ca('0x38')]){_0x2fff68[_0x87ca('0x37')]=_['merge'](_0x2fff68[_0x87ca('0x37')],{'$or':_[_0x87ca('0x27')](_0x2fff68[_0x87ca('0x30')],function(_0x416beb){var _0x268788={};_0x268788[_0x416beb]={'$like':'%'+_0x5a98cf['query'][_0x87ca('0x38')]+'%'};return _0x268788;})});}_0x2fff68=_[_0x87ca('0x3a')]({},_0x2fff68,_0x5a98cf[_0x87ca('0x3b')]);return _0x56ef06[_0x87ca('0x47')](_0x2fff68);}})[_0x87ca('0x22')](function(_0x2e59db){if(_0x2e59db){_0x4e690c=_0x2e59db['length'];if(!_0x5a98cf[_0x87ca('0x2c')][_0x87ca('0x34')](_0x87ca('0x35'))){_0x2fff68[_0x87ca('0x1b')]=qs['limit'](_0x5a98cf[_0x87ca('0x2c')][_0x87ca('0x1b')]);_0x2fff68['offset']=qs[_0x87ca('0x19')](_0x5a98cf['query'][_0x87ca('0x19')]);}return _0x56ef06[_0x87ca('0x47')](_0x2fff68);}})[_0x87ca('0x22')](function(_0x461ea6){if(_0x461ea6){return _0x461ea6?{'count':_0x4e690c,'rows':_0x461ea6}:null;}})['then'](respondWithResult(_0x19b515,null))[_0x87ca('0x41')](handleError(_0x19b515,null));};exports[_0x87ca('0x4b')]=function(_0x20cece,_0x4bca93,_0x46790a){var _0x56d41c={};var _0x5b7b63={};var _0x17ba1b;var _0x2bd20c;return db['ServicenowConfiguration'][_0x87ca('0x4c')]({'where':{'id':_0x20cece['params']['id']}})[_0x87ca('0x22')](handleEntityNotFound(_0x4bca93,null))[_0x87ca('0x22')](function(_0x4cb5c7){if(_0x4cb5c7){_0x17ba1b=_0x4cb5c7;_0x5b7b63[_0x87ca('0x2f')]=_[_0x87ca('0x2d')](db[_0x87ca('0x48')][_0x87ca('0x29')]);_0x5b7b63['query']=_['keys'](_0x20cece[_0x87ca('0x2c')]);_0x5b7b63[_0x87ca('0x2e')]=_[_0x87ca('0x31')](_0x5b7b63['model'],_0x5b7b63['query']);_0x56d41c['attributes']=_['intersection'](_0x5b7b63[_0x87ca('0x2f')],qs[_0x87ca('0x32')](_0x20cece[_0x87ca('0x2c')][_0x87ca('0x32')]));_0x56d41c[_0x87ca('0x30')]=_0x56d41c[_0x87ca('0x30')][_0x87ca('0x33')]?_0x56d41c[_0x87ca('0x30')]:_0x5b7b63[_0x87ca('0x2f')];_0x56d41c[_0x87ca('0x49')]=qs['sort'](_0x20cece[_0x87ca('0x2c')][_0x87ca('0x36')]);_0x56d41c[_0x87ca('0x37')]=qs[_0x87ca('0x2e')](_[_0x87ca('0x4a')](_0x20cece[_0x87ca('0x2c')],_0x5b7b63['filters']));if(_0x20cece[_0x87ca('0x2c')][_0x87ca('0x38')]){_0x56d41c[_0x87ca('0x37')]=_[_0x87ca('0x3a')](_0x56d41c[_0x87ca('0x37')],{'$or':_[_0x87ca('0x27')](_0x56d41c[_0x87ca('0x30')],function(_0x4b1112){var _0x44db22={};_0x44db22[_0x4b1112]={'$like':'%'+_0x20cece['query'][_0x87ca('0x38')]+'%'};return _0x44db22;})});}_0x56d41c=_['merge']({},_0x56d41c,_0x20cece[_0x87ca('0x3b')]);return _0x17ba1b[_0x87ca('0x4b')](_0x56d41c);}})['then'](function(_0x6edc70){if(_0x6edc70){_0x2bd20c=_0x6edc70[_0x87ca('0x33')];if(!_0x20cece[_0x87ca('0x2c')]['hasOwnProperty'](_0x87ca('0x35'))){_0x56d41c[_0x87ca('0x1b')]=qs['limit'](_0x20cece[_0x87ca('0x2c')][_0x87ca('0x1b')]);_0x56d41c[_0x87ca('0x19')]=qs[_0x87ca('0x19')](_0x20cece[_0x87ca('0x2c')]['offset']);}return _0x17ba1b[_0x87ca('0x4b')](_0x56d41c);}})[_0x87ca('0x22')](function(_0x5d6bab){if(_0x5d6bab){return _0x5d6bab?{'count':_0x2bd20c,'rows':_0x5d6bab}:null;}})[_0x87ca('0x22')](respondWithResult(_0x4bca93,null))[_0x87ca('0x41')](handleError(_0x4bca93,null));};exports[_0x87ca('0x4d')]=function(_0x4d534a,_0x20e116,_0x70645){var _0x109aae={};var _0x3d9301={};var _0xe5cc11;var _0x4dbcd3;return db[_0x87ca('0x28')][_0x87ca('0x4c')]({'where':{'id':_0x4d534a[_0x87ca('0x42')]['id']}})['then'](handleEntityNotFound(_0x20e116,null))['then'](function(_0x5874f5){if(_0x5874f5){_0xe5cc11=_0x5874f5;_0x3d9301[_0x87ca('0x2f')]=_['keys'](db['ServicenowField'][_0x87ca('0x29')]);_0x3d9301[_0x87ca('0x2c')]=_[_0x87ca('0x2d')](_0x4d534a[_0x87ca('0x2c')]);_0x3d9301[_0x87ca('0x2e')]=_[_0x87ca('0x31')](_0x3d9301[_0x87ca('0x2f')],_0x3d9301[_0x87ca('0x2c')]);_0x109aae['attributes']=_['intersection'](_0x3d9301[_0x87ca('0x2f')],qs['fields'](_0x4d534a['query'][_0x87ca('0x32')]));_0x109aae[_0x87ca('0x30')]=_0x109aae['attributes']['length']?_0x109aae[_0x87ca('0x30')]:_0x3d9301[_0x87ca('0x2f')];_0x109aae[_0x87ca('0x49')]=qs[_0x87ca('0x36')](_0x4d534a['query']['sort']);_0x109aae['where']=qs[_0x87ca('0x2e')](_['pick'](_0x4d534a[_0x87ca('0x2c')],_0x3d9301[_0x87ca('0x2e')]));if(_0x4d534a[_0x87ca('0x2c')][_0x87ca('0x38')]){_0x109aae[_0x87ca('0x37')]=_[_0x87ca('0x3a')](_0x109aae['where'],{'$or':_[_0x87ca('0x27')](_0x109aae[_0x87ca('0x30')],function(_0x3ce3f2){var _0x14bc80={};_0x14bc80[_0x3ce3f2]={'$like':'%'+_0x4d534a[_0x87ca('0x2c')][_0x87ca('0x38')]+'%'};return _0x14bc80;})});}_0x109aae=_[_0x87ca('0x3a')]({},_0x109aae,_0x4d534a[_0x87ca('0x3b')]);return _0xe5cc11[_0x87ca('0x4d')](_0x109aae);}})[_0x87ca('0x22')](function(_0x17b51b){if(_0x17b51b){_0x4dbcd3=_0x17b51b['length'];if(!_0x4d534a[_0x87ca('0x2c')][_0x87ca('0x34')](_0x87ca('0x35'))){_0x109aae['limit']=qs[_0x87ca('0x1b')](_0x4d534a[_0x87ca('0x2c')]['limit']);_0x109aae[_0x87ca('0x19')]=qs['offset'](_0x4d534a['query'][_0x87ca('0x19')]);}return _0xe5cc11['getDescriptions'](_0x109aae);}})[_0x87ca('0x22')](function(_0x378f58){if(_0x378f58){return _0x378f58?{'count':_0x4dbcd3,'rows':_0x378f58}:null;}})['then'](respondWithResult(_0x20e116,null))['catch'](handleError(_0x20e116,null));}; \ No newline at end of file +var _0x7de8=['crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','json','apply','reject','update','then','destroy','end','stack','send','index','map','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','name','options','ServicenowConfiguration','includeAll','include','findAll','catch','params','create','body','find','getFields','findOne','rawAttributes','getSubjects','ServicenowField','getDescriptions','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra'];(function(_0x1e2c73,_0x12cd55){var _0x46f8d5=function(_0xe5a2fd){while(--_0xe5a2fd){_0x1e2c73['push'](_0x1e2c73['shift']());}};_0x46f8d5(++_0x12cd55);}(_0x7de8,0x8b));var _0x87de=function(_0x1264d4,_0x531b55){_0x1264d4=_0x1264d4-0x0;var _0x51539c=_0x7de8[_0x1264d4];return _0x51539c;};'use strict';var emlformat=require(_0x87de('0x0'));var rimraf=require(_0x87de('0x1'));var zipdir=require(_0x87de('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x87de('0x3'));var BPromise=require(_0x87de('0x4'));var Mustache=require(_0x87de('0x5'));var util=require(_0x87de('0x6'));var path=require(_0x87de('0x7'));var sox=require('sox');var csv=require(_0x87de('0x8'));var ejs=require(_0x87de('0x9'));var fs=require('fs');var fs_extra=require(_0x87de('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x87de('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x87de('0xc'));var toCsv=require(_0x87de('0x8'));var querystring=require(_0x87de('0xd'));var Papa=require(_0x87de('0xe'));var Redis=require('ioredis');var authService=require(_0x87de('0xf'));var qs=require(_0x87de('0x10'));var as=require(_0x87de('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x87de('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x87de('0x13'));var licenseUtil=require(_0x87de('0x14'));var db=require(_0x87de('0x15'))['db'];function respondWithStatusCode(_0xe781be,_0x3d703f){_0x3d703f=_0x3d703f||0xcc;return function(_0x41fc14){if(_0x41fc14){return _0xe781be['sendStatus'](_0x3d703f);}return _0xe781be[_0x87de('0x16')](_0x3d703f)['end']();};}function respondWithResult(_0x3c0c59,_0x448aac){_0x448aac=_0x448aac||0xc8;return function(_0x48b1e5){if(_0x48b1e5){return _0x3c0c59[_0x87de('0x16')](_0x448aac)['json'](_0x48b1e5);}};}function respondWithFilteredResult(_0x4fc7b2,_0x34e139){return function(_0x118f69){if(_0x118f69){var _0x28b36e=typeof _0x34e139[_0x87de('0x17')]===_0x87de('0x18')&&typeof _0x34e139[_0x87de('0x19')]===_0x87de('0x18');var _0x1d1169=_0x118f69['count'];var _0x1bf69e=_0x28b36e?0x0:_0x34e139['offset'];var _0x365c55=_0x28b36e?_0x118f69[_0x87de('0x1a')]:_0x34e139[_0x87de('0x17')]+_0x34e139[_0x87de('0x19')];var _0x29e267;if(_0x365c55>=_0x1d1169){_0x365c55=_0x1d1169;_0x29e267=0xc8;}else{_0x29e267=0xce;}_0x4fc7b2[_0x87de('0x16')](_0x29e267);return _0x4fc7b2['set']('Content-Range',_0x1bf69e+'-'+_0x365c55+'/'+_0x1d1169)[_0x87de('0x1b')](_0x118f69);}return null;};}function patchUpdates(_0x2f4079){return function(_0x4d303d){try{jsonpatch[_0x87de('0x1c')](_0x4d303d,_0x2f4079,!![]);}catch(_0x5e864b){return BPromise[_0x87de('0x1d')](_0x5e864b);}return _0x4d303d['save']();};}function saveUpdates(_0x488bd6,_0x39b95c){return function(_0x1ad2b3){if(_0x1ad2b3){return _0x1ad2b3[_0x87de('0x1e')](_0x488bd6)[_0x87de('0x1f')](function(_0x533d22){return _0x533d22;});}return null;};}function removeEntity(_0x111db1,_0x4c5633){return function(_0x3faf55){if(_0x3faf55){return _0x3faf55[_0x87de('0x20')]()[_0x87de('0x1f')](function(){_0x111db1[_0x87de('0x16')](0xcc)[_0x87de('0x21')]();});}};}function handleEntityNotFound(_0x309ebd,_0x1cc3fe){return function(_0x5b05de){if(!_0x5b05de){_0x309ebd['sendStatus'](0x194);}return _0x5b05de;};}function handleError(_0x1e606d,_0x5cad99){_0x5cad99=_0x5cad99||0x1f4;return function(_0x51194c){logger['error'](_0x51194c[_0x87de('0x22')]);if(_0x51194c['name']){delete _0x51194c['name'];}_0x1e606d[_0x87de('0x16')](_0x5cad99)[_0x87de('0x23')](_0x51194c);};}exports[_0x87de('0x24')]=function(_0x5be538,_0x3b58b7){var _0x1d2eb1={},_0x48e898={},_0xc13f0e={'count':0x0,'rows':[]};var _0x2d0ac5=_[_0x87de('0x25')](db['ServicenowConfiguration']['rawAttributes'],function(_0x3e62f0){return{'name':_0x3e62f0[_0x87de('0x26')],'type':_0x3e62f0[_0x87de('0x27')][_0x87de('0x28')]};});_0x48e898['model']=_[_0x87de('0x25')](_0x2d0ac5,'name');_0x48e898['query']=_[_0x87de('0x29')](_0x5be538[_0x87de('0x2a')]);_0x48e898[_0x87de('0x2b')]=_['intersection'](_0x48e898[_0x87de('0x2c')],_0x48e898[_0x87de('0x2a')]);_0x1d2eb1[_0x87de('0x2d')]=_[_0x87de('0x2e')](_0x48e898[_0x87de('0x2c')],qs[_0x87de('0x2f')](_0x5be538['query'][_0x87de('0x2f')]));_0x1d2eb1[_0x87de('0x2d')]=_0x1d2eb1[_0x87de('0x2d')][_0x87de('0x30')]?_0x1d2eb1[_0x87de('0x2d')]:_0x48e898[_0x87de('0x2c')];if(!_0x5be538[_0x87de('0x2a')][_0x87de('0x31')](_0x87de('0x32'))){_0x1d2eb1['limit']=qs[_0x87de('0x19')](_0x5be538[_0x87de('0x2a')][_0x87de('0x19')]);_0x1d2eb1[_0x87de('0x17')]=qs[_0x87de('0x17')](_0x5be538[_0x87de('0x2a')]['offset']);}_0x1d2eb1[_0x87de('0x33')]=qs[_0x87de('0x34')](_0x5be538['query'][_0x87de('0x34')]);_0x1d2eb1[_0x87de('0x35')]=qs[_0x87de('0x2b')](_[_0x87de('0x36')](_0x5be538['query'],_0x48e898[_0x87de('0x2b')]),_0x2d0ac5);if(_0x5be538[_0x87de('0x2a')][_0x87de('0x37')]){_0x1d2eb1[_0x87de('0x35')]=_[_0x87de('0x38')](_0x1d2eb1[_0x87de('0x35')],{'$or':_['map'](_0x2d0ac5,function(_0x29e65d){if(_0x29e65d[_0x87de('0x27')]!==_0x87de('0x39')){var _0x20b36e={};_0x20b36e[_0x29e65d[_0x87de('0x3a')]]={'$like':'%'+_0x5be538['query'][_0x87de('0x37')]+'%'};return _0x20b36e;}})});}_0x1d2eb1=_[_0x87de('0x38')]({},_0x1d2eb1,_0x5be538[_0x87de('0x3b')]);var _0x59e188={'where':_0x1d2eb1['where']};return db[_0x87de('0x3c')][_0x87de('0x1a')](_0x59e188)[_0x87de('0x1f')](function(_0x480a0a){_0xc13f0e[_0x87de('0x1a')]=_0x480a0a;if(_0x5be538['query'][_0x87de('0x3d')]){_0x1d2eb1[_0x87de('0x3e')]=[{'all':!![]}];}return db[_0x87de('0x3c')][_0x87de('0x3f')](_0x1d2eb1);})[_0x87de('0x1f')](function(_0x26f128){_0xc13f0e['rows']=_0x26f128;return _0xc13f0e;})['then'](respondWithFilteredResult(_0x3b58b7,_0x1d2eb1))[_0x87de('0x40')](handleError(_0x3b58b7,null));};exports['show']=function(_0x33bcfa,_0x2bb43f){var _0x11fd20={'raw':![],'where':{'id':_0x33bcfa[_0x87de('0x41')]['id']}},_0x1437ee={};_0x1437ee[_0x87de('0x2c')]=_[_0x87de('0x29')](db[_0x87de('0x3c')]['rawAttributes']);_0x1437ee[_0x87de('0x2a')]=_[_0x87de('0x29')](_0x33bcfa[_0x87de('0x2a')]);_0x1437ee['filters']=_[_0x87de('0x2e')](_0x1437ee[_0x87de('0x2c')],_0x1437ee[_0x87de('0x2a')]);_0x11fd20[_0x87de('0x2d')]=_[_0x87de('0x2e')](_0x1437ee['model'],qs[_0x87de('0x2f')](_0x33bcfa['query'][_0x87de('0x2f')]));_0x11fd20[_0x87de('0x2d')]=_0x11fd20[_0x87de('0x2d')][_0x87de('0x30')]?_0x11fd20[_0x87de('0x2d')]:_0x1437ee['model'];if(_0x33bcfa[_0x87de('0x2a')][_0x87de('0x3d')]){_0x11fd20[_0x87de('0x3e')]=[{'all':!![]}];}_0x11fd20=_[_0x87de('0x38')]({},_0x11fd20,_0x33bcfa[_0x87de('0x3b')]);return db[_0x87de('0x3c')]['find'](_0x11fd20)[_0x87de('0x1f')](handleEntityNotFound(_0x2bb43f,null))[_0x87de('0x1f')](respondWithResult(_0x2bb43f,null))['catch'](handleError(_0x2bb43f,null));};exports['create']=function(_0x5c8014,_0x22666b){return db['ServicenowConfiguration'][_0x87de('0x42')](_0x5c8014[_0x87de('0x43')],{})[_0x87de('0x1f')](respondWithResult(_0x22666b,0xc9))[_0x87de('0x40')](handleError(_0x22666b,null));};exports[_0x87de('0x1e')]=function(_0x43b4bb,_0x50d708){if(_0x43b4bb['body']['id']){delete _0x43b4bb['body']['id'];}return db[_0x87de('0x3c')]['find']({'where':{'id':_0x43b4bb[_0x87de('0x41')]['id']}})[_0x87de('0x1f')](handleEntityNotFound(_0x50d708,null))[_0x87de('0x1f')](saveUpdates(_0x43b4bb[_0x87de('0x43')],null))[_0x87de('0x1f')](respondWithResult(_0x50d708,null))[_0x87de('0x40')](handleError(_0x50d708,null));};exports[_0x87de('0x20')]=function(_0x43440b,_0x18728f){return db[_0x87de('0x3c')][_0x87de('0x44')]({'where':{'id':_0x43440b['params']['id']}})[_0x87de('0x1f')](handleEntityNotFound(_0x18728f,null))['then'](removeEntity(_0x18728f,null))[_0x87de('0x40')](handleError(_0x18728f,null));};exports[_0x87de('0x45')]=function(_0x3b2f6a,_0x11b2ed,_0x2110cf){var _0x304f5e={};var _0x4a78c2={};var _0x35368e;var _0x43d42b;return db[_0x87de('0x3c')][_0x87de('0x46')]({'where':{'id':_0x3b2f6a[_0x87de('0x41')]['id']}})['then'](handleEntityNotFound(_0x11b2ed,null))[_0x87de('0x1f')](function(_0x35d485){if(_0x35d485){_0x35368e=_0x35d485;_0x4a78c2[_0x87de('0x2c')]=_[_0x87de('0x29')](db['ServicenowField'][_0x87de('0x47')]);_0x4a78c2[_0x87de('0x2a')]=_[_0x87de('0x29')](_0x3b2f6a['query']);_0x4a78c2[_0x87de('0x2b')]=_[_0x87de('0x2e')](_0x4a78c2[_0x87de('0x2c')],_0x4a78c2['query']);_0x304f5e[_0x87de('0x2d')]=_[_0x87de('0x2e')](_0x4a78c2[_0x87de('0x2c')],qs['fields'](_0x3b2f6a['query']['fields']));_0x304f5e[_0x87de('0x2d')]=_0x304f5e[_0x87de('0x2d')][_0x87de('0x30')]?_0x304f5e[_0x87de('0x2d')]:_0x4a78c2[_0x87de('0x2c')];_0x304f5e[_0x87de('0x33')]=qs['sort'](_0x3b2f6a[_0x87de('0x2a')][_0x87de('0x34')]);_0x304f5e[_0x87de('0x35')]=qs[_0x87de('0x2b')](_[_0x87de('0x36')](_0x3b2f6a[_0x87de('0x2a')],_0x4a78c2[_0x87de('0x2b')]));if(_0x3b2f6a[_0x87de('0x2a')][_0x87de('0x37')]){_0x304f5e[_0x87de('0x35')]=_[_0x87de('0x38')](_0x304f5e[_0x87de('0x35')],{'$or':_[_0x87de('0x25')](_0x304f5e[_0x87de('0x2d')],function(_0x3243b3){var _0x12d715={};_0x12d715[_0x3243b3]={'$like':'%'+_0x3b2f6a[_0x87de('0x2a')][_0x87de('0x37')]+'%'};return _0x12d715;})});}_0x304f5e=_[_0x87de('0x38')]({},_0x304f5e,_0x3b2f6a[_0x87de('0x3b')]);return _0x35368e[_0x87de('0x45')](_0x304f5e);}})[_0x87de('0x1f')](function(_0x200e8c){if(_0x200e8c){_0x43d42b=_0x200e8c['length'];if(!_0x3b2f6a[_0x87de('0x2a')][_0x87de('0x31')]('nolimit')){_0x304f5e[_0x87de('0x19')]=qs[_0x87de('0x19')](_0x3b2f6a['query']['limit']);_0x304f5e[_0x87de('0x17')]=qs[_0x87de('0x17')](_0x3b2f6a[_0x87de('0x2a')]['offset']);}return _0x35368e['getFields'](_0x304f5e);}})['then'](function(_0x175ca9){if(_0x175ca9){return _0x175ca9?{'count':_0x43d42b,'rows':_0x175ca9}:null;}})[_0x87de('0x1f')](respondWithResult(_0x11b2ed,null))[_0x87de('0x40')](handleError(_0x11b2ed,null));};exports[_0x87de('0x48')]=function(_0x393cc4,_0x41cc36,_0x4308f9){var _0x225d55={};var _0x240b54={};var _0x32f3c9;var _0x5323f5;return db[_0x87de('0x3c')][_0x87de('0x46')]({'where':{'id':_0x393cc4[_0x87de('0x41')]['id']}})[_0x87de('0x1f')](handleEntityNotFound(_0x41cc36,null))['then'](function(_0x5782aa){if(_0x5782aa){_0x32f3c9=_0x5782aa;_0x240b54[_0x87de('0x2c')]=_[_0x87de('0x29')](db[_0x87de('0x49')][_0x87de('0x47')]);_0x240b54['query']=_[_0x87de('0x29')](_0x393cc4[_0x87de('0x2a')]);_0x240b54[_0x87de('0x2b')]=_['intersection'](_0x240b54[_0x87de('0x2c')],_0x240b54[_0x87de('0x2a')]);_0x225d55[_0x87de('0x2d')]=_[_0x87de('0x2e')](_0x240b54[_0x87de('0x2c')],qs[_0x87de('0x2f')](_0x393cc4['query'][_0x87de('0x2f')]));_0x225d55[_0x87de('0x2d')]=_0x225d55['attributes']['length']?_0x225d55['attributes']:_0x240b54[_0x87de('0x2c')];_0x225d55[_0x87de('0x33')]=qs[_0x87de('0x34')](_0x393cc4[_0x87de('0x2a')][_0x87de('0x34')]);_0x225d55['where']=qs[_0x87de('0x2b')](_[_0x87de('0x36')](_0x393cc4[_0x87de('0x2a')],_0x240b54[_0x87de('0x2b')]));if(_0x393cc4[_0x87de('0x2a')][_0x87de('0x37')]){_0x225d55[_0x87de('0x35')]=_[_0x87de('0x38')](_0x225d55[_0x87de('0x35')],{'$or':_['map'](_0x225d55[_0x87de('0x2d')],function(_0x20e0ec){var _0xa1f0de={};_0xa1f0de[_0x20e0ec]={'$like':'%'+_0x393cc4[_0x87de('0x2a')]['filter']+'%'};return _0xa1f0de;})});}_0x225d55=_[_0x87de('0x38')]({},_0x225d55,_0x393cc4[_0x87de('0x3b')]);return _0x32f3c9['getSubjects'](_0x225d55);}})[_0x87de('0x1f')](function(_0x4e9e43){if(_0x4e9e43){_0x5323f5=_0x4e9e43[_0x87de('0x30')];if(!_0x393cc4['query'][_0x87de('0x31')]('nolimit')){_0x225d55['limit']=qs[_0x87de('0x19')](_0x393cc4[_0x87de('0x2a')][_0x87de('0x19')]);_0x225d55[_0x87de('0x17')]=qs[_0x87de('0x17')](_0x393cc4[_0x87de('0x2a')][_0x87de('0x17')]);}return _0x32f3c9[_0x87de('0x48')](_0x225d55);}})['then'](function(_0x57bd42){if(_0x57bd42){return _0x57bd42?{'count':_0x5323f5,'rows':_0x57bd42}:null;}})[_0x87de('0x1f')](respondWithResult(_0x41cc36,null))[_0x87de('0x40')](handleError(_0x41cc36,null));};exports[_0x87de('0x4a')]=function(_0x9cfa69,_0x2a91a1,_0x187275){var _0x3ede5e={};var _0x576752={};var _0x5a5dde;var _0x3d0e6b;return db[_0x87de('0x3c')][_0x87de('0x46')]({'where':{'id':_0x9cfa69[_0x87de('0x41')]['id']}})[_0x87de('0x1f')](handleEntityNotFound(_0x2a91a1,null))[_0x87de('0x1f')](function(_0x22d49c){if(_0x22d49c){_0x5a5dde=_0x22d49c;_0x576752[_0x87de('0x2c')]=_['keys'](db['ServicenowField'][_0x87de('0x47')]);_0x576752['query']=_[_0x87de('0x29')](_0x9cfa69['query']);_0x576752[_0x87de('0x2b')]=_['intersection'](_0x576752[_0x87de('0x2c')],_0x576752[_0x87de('0x2a')]);_0x3ede5e[_0x87de('0x2d')]=_[_0x87de('0x2e')](_0x576752[_0x87de('0x2c')],qs['fields'](_0x9cfa69['query'][_0x87de('0x2f')]));_0x3ede5e['attributes']=_0x3ede5e[_0x87de('0x2d')][_0x87de('0x30')]?_0x3ede5e[_0x87de('0x2d')]:_0x576752[_0x87de('0x2c')];_0x3ede5e[_0x87de('0x33')]=qs[_0x87de('0x34')](_0x9cfa69[_0x87de('0x2a')]['sort']);_0x3ede5e[_0x87de('0x35')]=qs['filters'](_['pick'](_0x9cfa69[_0x87de('0x2a')],_0x576752[_0x87de('0x2b')]));if(_0x9cfa69[_0x87de('0x2a')][_0x87de('0x37')]){_0x3ede5e[_0x87de('0x35')]=_[_0x87de('0x38')](_0x3ede5e['where'],{'$or':_[_0x87de('0x25')](_0x3ede5e[_0x87de('0x2d')],function(_0x25ba06){var _0x25b482={};_0x25b482[_0x25ba06]={'$like':'%'+_0x9cfa69[_0x87de('0x2a')][_0x87de('0x37')]+'%'};return _0x25b482;})});}_0x3ede5e=_['merge']({},_0x3ede5e,_0x9cfa69[_0x87de('0x3b')]);return _0x5a5dde[_0x87de('0x4a')](_0x3ede5e);}})[_0x87de('0x1f')](function(_0x29691a){if(_0x29691a){_0x3d0e6b=_0x29691a['length'];if(!_0x9cfa69[_0x87de('0x2a')]['hasOwnProperty'](_0x87de('0x32'))){_0x3ede5e['limit']=qs[_0x87de('0x19')](_0x9cfa69[_0x87de('0x2a')][_0x87de('0x19')]);_0x3ede5e[_0x87de('0x17')]=qs[_0x87de('0x17')](_0x9cfa69[_0x87de('0x2a')]['offset']);}return _0x5a5dde[_0x87de('0x4a')](_0x3ede5e);}})['then'](function(_0x540bb8){if(_0x540bb8){return _0x540bb8?{'count':_0x3d0e6b,'rows':_0x540bb8}:null;}})['then'](respondWithResult(_0x2a91a1,null))[_0x87de('0x40')](handleError(_0x2a91a1,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 48697c1..95088b3 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 _0xf3f9=['path','rimraf','../../config/environment','define','int_servicenow_configurations','lodash','util','api','moment','bluebird','request-promise'];(function(_0x560db5,_0xd10956){var _0x569c92=function(_0x45be9a){while(--_0x45be9a){_0x560db5['push'](_0x560db5['shift']());}};_0x569c92(++_0xd10956);}(_0xf3f9,0x1de));var _0x9f3f=function(_0x34e83c,_0x11a09c){_0x34e83c=_0x34e83c-0x0;var _0x4fe514=_0xf3f9[_0x34e83c];return _0x4fe514;};'use strict';var _=require(_0x9f3f('0x0'));var util=require(_0x9f3f('0x1'));var logger=require('../../config/logger')(_0x9f3f('0x2'));var moment=require(_0x9f3f('0x3'));var BPromise=require(_0x9f3f('0x4'));var rp=require(_0x9f3f('0x5'));var fs=require('fs');var path=require(_0x9f3f('0x6'));var rimraf=require(_0x9f3f('0x7'));var config=require(_0x9f3f('0x8'));var attributes=require('./intServicenowConfiguration.attributes');module['exports']=function(_0xc4516a,_0x566b08){return _0xc4516a[_0x9f3f('0x9')]('ServicenowConfiguration',attributes,{'tableName':_0x9f3f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf79e=['../../config/logger','api','bluebird','request-promise','../../config/environment','./intServicenowConfiguration.attributes','exports','define','int_servicenow_configurations','util'];(function(_0x3537e1,_0xbc7714){var _0x164a50=function(_0x57c2d1){while(--_0x57c2d1){_0x3537e1['push'](_0x3537e1['shift']());}};_0x164a50(++_0xbc7714);}(_0xf79e,0x185));var _0xef79=function(_0x19cb6c,_0x161b87){_0x19cb6c=_0x19cb6c-0x0;var _0x1239a0=_0xf79e[_0x19cb6c];return _0x1239a0;};'use strict';var _=require('lodash');var util=require(_0xef79('0x0'));var logger=require(_0xef79('0x1'))(_0xef79('0x2'));var moment=require('moment');var BPromise=require(_0xef79('0x3'));var rp=require(_0xef79('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xef79('0x5'));var attributes=require(_0xef79('0x6'));module[_0xef79('0x7')]=function(_0x22b3c2,_0x396c51){return _0x22b3c2[_0xef79('0x8')]('ServicenowConfiguration',attributes,{'tableName':_0xef79('0x9'),'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 8033e0b..7d6dbfe 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 _0xe4bd=['http','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','info','lodash','util','bluebird','randomstring','../../config/utils','../../config/environment','client'];(function(_0x34e756,_0x12215f){var _0x374472=function(_0x4ce667){while(--_0x4ce667){_0x34e756['push'](_0x34e756['shift']());}};_0x374472(++_0x12215f);}(_0xe4bd,0x89));var _0xde4b=function(_0x16db8a,_0x2a34e1){_0x16db8a=_0x16db8a-0x0;var _0x126cae=_0xe4bd[_0x16db8a];return _0x126cae;};'use strict';var _=require(_0xde4b('0x0'));var util=require(_0xde4b('0x1'));var moment=require('moment');var BPromise=require(_0xde4b('0x2'));var rs=require(_0xde4b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xde4b('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xde4b('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xde4b('0x6')][_0xde4b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4b740f,_0x39ac6e,_0x4043d4){return new BPromise(function(_0x39de07,_0x5d9e62){return client['request'](_0x4b740f,_0x4043d4)['then'](function(_0xeb89ae){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x39ac6e,_0xde4b('0x8'));logger['debug'](_0xde4b('0x9'),_0x39ac6e,_0xde4b('0x8'),JSON[_0xde4b('0xa')](_0xeb89ae));if(_0xeb89ae[_0xde4b('0xb')]){if(_0xeb89ae['error'][_0xde4b('0xc')]===0x1f4){logger[_0xde4b('0xb')](_0xde4b('0xd'),_0x39ac6e,_0xeb89ae[_0xde4b('0xb')]['message']);return _0x5d9e62(_0xeb89ae[_0xde4b('0xb')]['message']);}logger[_0xde4b('0xb')](_0xde4b('0xd'),_0x39ac6e,_0xeb89ae[_0xde4b('0xb')]['message']);return _0x39de07(_0xeb89ae[_0xde4b('0xb')][_0xde4b('0xe')]);}else{logger[_0xde4b('0xf')](_0xde4b('0xd'),_0x39ac6e,_0xde4b('0x8'));_0x39de07(_0xeb89ae['result'][_0xde4b('0xe')]);}})['catch'](function(_0x3ad061){logger[_0xde4b('0xb')](_0xde4b('0xd'),_0x39ac6e,_0x3ad061);_0x5d9e62(_0x3ad061);});});} \ No newline at end of file +var _0x1329=['then','ServicenowConfiguration,\x20%s,\x20%s','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x1329,0x199));var _0x9132=function(_0x1a86c4,_0x2e9c80){_0x1a86c4=_0x1a86c4-0x0;var _0x2bc29d=_0x1329[_0x1a86c4];return _0x2bc29d;};'use strict';var _=require(_0x9132('0x0'));var util=require(_0x9132('0x1'));var moment=require(_0x9132('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9132('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9132('0x4'));var logger=require(_0x9132('0x5'))(_0x9132('0x6'));var config=require(_0x9132('0x7'));var jayson=require(_0x9132('0x8'));var client=jayson['client'][_0x9132('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46e1ac,_0x3e6659,_0x5b24b4){return new BPromise(function(_0x4873d2,_0x3ceac0){return client[_0x9132('0xa')](_0x46e1ac,_0x5b24b4)[_0x9132('0xb')](function(_0x208f21){logger['info'](_0x9132('0xc'),_0x3e6659,'request\x20sent');logger['debug'](_0x9132('0xd'),_0x3e6659,_0x9132('0xe'),JSON[_0x9132('0xf')](_0x208f21));if(_0x208f21[_0x9132('0x10')]){if(_0x208f21[_0x9132('0x10')][_0x9132('0x11')]===0x1f4){logger[_0x9132('0x10')](_0x9132('0xc'),_0x3e6659,_0x208f21['error']['message']);return _0x3ceac0(_0x208f21[_0x9132('0x10')][_0x9132('0x12')]);}logger[_0x9132('0x10')](_0x9132('0xc'),_0x3e6659,_0x208f21[_0x9132('0x10')]['message']);return _0x4873d2(_0x208f21[_0x9132('0x10')]['message']);}else{logger[_0x9132('0x13')](_0x9132('0xc'),_0x3e6659,'request\x20sent');_0x4873d2(_0x208f21['result']['message']);}})[_0x9132('0x14')](function(_0x4aa33d){logger[_0x9132('0x10')](_0x9132('0xc'),_0x3e6659,_0x4aa33d);_0x3ceac0(_0x4aa33d);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 837c63d..46b1b4b 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 _0x27a7=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','show','post','put','delete','destroy','multer','path'];(function(_0x3fc7ec,_0x55e235){var _0x5d54e0=function(_0x5b83da){while(--_0x5b83da){_0x3fc7ec['push'](_0x3fc7ec['shift']());}};_0x5d54e0(++_0x55e235);}(_0x27a7,0x18e));var _0x727a=function(_0x3c22e0,_0x1dc6ea){_0x3c22e0=_0x3c22e0-0x0;var _0x215811=_0x27a7[_0x3c22e0];return _0x215811;};'use strict';var multer=require(_0x727a('0x0'));var util=require('util');var path=require(_0x727a('0x1'));var timeout=require(_0x727a('0x2'));var express=require(_0x727a('0x3'));var router=express[_0x727a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x727a('0x5'));var interaction=require(_0x727a('0x6'));var config=require(_0x727a('0x7'));var controller=require('./intServicenowField.controller');router['get']('/',auth[_0x727a('0x8')](),controller[_0x727a('0x9')]);router['get'](_0x727a('0xa'),auth['isAuthenticated'](),controller[_0x727a('0xb')]);router[_0x727a('0xc')]('/',auth[_0x727a('0x8')](),controller['create']);router[_0x727a('0xd')](_0x727a('0xa'),auth[_0x727a('0x8')](),controller['update']);router[_0x727a('0xe')]('/:id',auth[_0x727a('0x8')](),controller[_0x727a('0xf')]);module['exports']=router; \ No newline at end of file +var _0xbd92=['Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','/:id','post','create','put','update','destroy','multer','util','connect-timeout','express'];(function(_0x1baef3,_0x48273d){var _0x448277=function(_0x27146b){while(--_0x27146b){_0x1baef3['push'](_0x1baef3['shift']());}};_0x448277(++_0x48273d);}(_0xbd92,0xb0));var _0x2bd9=function(_0x42bb3f,_0x572c71){_0x42bb3f=_0x42bb3f-0x0;var _0x4e6d23=_0xbd92[_0x42bb3f];return _0x4e6d23;};'use strict';var multer=require(_0x2bd9('0x0'));var util=require(_0x2bd9('0x1'));var path=require('path');var timeout=require(_0x2bd9('0x2'));var express=require(_0x2bd9('0x3'));var router=express[_0x2bd9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2bd9('0x5'));var interaction=require(_0x2bd9('0x6'));var config=require('../../config/environment');var controller=require('./intServicenowField.controller');router['get']('/',auth[_0x2bd9('0x7')](),controller[_0x2bd9('0x8')]);router['get'](_0x2bd9('0x9'),auth[_0x2bd9('0x7')](),controller['show']);router[_0x2bd9('0xa')]('/',auth[_0x2bd9('0x7')](),controller[_0x2bd9('0xb')]);router[_0x2bd9('0xc')](_0x2bd9('0x9'),auth[_0x2bd9('0x7')](),controller[_0x2bd9('0xd')]);router['delete'](_0x2bd9('0x9'),auth[_0x2bd9('0x7')](),controller[_0x2bd9('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 61b9616..68d143c 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 _0xf3c6=['sequelize','exports','variable','customVariable','picklist','STRING','string','BOOLEAN'];(function(_0x50f0a9,_0x2b0c57){var _0x5a33d9=function(_0x40338e){while(--_0x40338e){_0x50f0a9['push'](_0x50f0a9['shift']());}};_0x5a33d9(++_0x2b0c57);}(_0xf3c6,0xb8));var _0x6f3c=function(_0x2129bc,_0x1ea4d9){_0x2129bc=_0x2129bc-0x0;var _0xb6d343=_0xf3c6[_0x2129bc];return _0xb6d343;};'use strict';var Sequelize=require(_0x6f3c('0x0'));module[_0x6f3c('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x6f3c('0x2'),_0x6f3c('0x3'),'keyValue',_0x6f3c('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x6f3c('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x6f3c('0x6'),_0x6f3c('0x2'),_0x6f3c('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x6f3c('0x5')]},'nameField':{'type':Sequelize[_0x6f3c('0x5')]},'customField':{'type':Sequelize[_0x6f3c('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x36d8=['string','customVariable','keyValue','picklist','STRING','ENUM','variable','BOOLEAN','sequelize','exports'];(function(_0x43fbc8,_0x1a7228){var _0x5bf73=function(_0x3266f0){while(--_0x3266f0){_0x43fbc8['push'](_0x43fbc8['shift']());}};_0x5bf73(++_0x1a7228);}(_0x36d8,0x198));var _0x836d=function(_0x2824a9,_0x517771){_0x2824a9=_0x2824a9-0x0;var _0x134fad=_0x36d8[_0x2824a9];return _0x134fad;};'use strict';var Sequelize=require(_0x836d('0x0'));module[_0x836d('0x1')]={'type':{'type':Sequelize['ENUM'](_0x836d('0x2'),'variable',_0x836d('0x3'),_0x836d('0x4'),_0x836d('0x5')),'defaultValue':_0x836d('0x2')},'content':{'type':Sequelize[_0x836d('0x6')]},'key':{'type':Sequelize[_0x836d('0x6')]},'keyType':{'type':Sequelize[_0x836d('0x7')](_0x836d('0x2'),_0x836d('0x8'),_0x836d('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x836d('0x6')]},'customField':{'type':Sequelize[_0x836d('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x836d('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 95b2988..7ca7a8f 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 _0x15bd=['to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','ServicenowField','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x15bd,0xdc));var _0xd15b=function(_0x239cee,_0xf786c8){_0x239cee=_0x239cee-0x0;var _0x4fe6b6=_0x15bd[_0x239cee];return _0x4fe6b6;};'use strict';var emlformat=require(_0xd15b('0x0'));var rimraf=require(_0xd15b('0x1'));var zipdir=require(_0xd15b('0x2'));var jsonpatch=require(_0xd15b('0x3'));var rp=require(_0xd15b('0x4'));var moment=require(_0xd15b('0x5'));var BPromise=require(_0xd15b('0x6'));var Mustache=require(_0xd15b('0x7'));var util=require(_0xd15b('0x8'));var path=require(_0xd15b('0x9'));var sox=require(_0xd15b('0xa'));var csv=require(_0xd15b('0xb'));var ejs=require(_0xd15b('0xc'));var fs=require('fs');var fs_extra=require(_0xd15b('0xd'));var _=require(_0xd15b('0xe'));var squel=require(_0xd15b('0xf'));var crypto=require(_0xd15b('0x10'));var jsforce=require('jsforce');var deskjs=require(_0xd15b('0x11'));var toCsv=require(_0xd15b('0xb'));var querystring=require(_0xd15b('0x12'));var Papa=require('papaparse');var Redis=require(_0xd15b('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xd15b('0x14'));var as=require(_0xd15b('0x15'));var hardwareService=require(_0xd15b('0x16'));var logger=require(_0xd15b('0x17'))(_0xd15b('0x18'));var utils=require(_0xd15b('0x19'));var config=require(_0xd15b('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x470ea8,_0x34d65b){_0x34d65b=_0x34d65b||0xcc;return function(_0x28cd6f){if(_0x28cd6f){return _0x470ea8[_0xd15b('0x1b')](_0x34d65b);}return _0x470ea8[_0xd15b('0x1c')](_0x34d65b)[_0xd15b('0x1d')]();};}function respondWithResult(_0x3ef7fb,_0x2f6187){_0x2f6187=_0x2f6187||0xc8;return function(_0x441c02){if(_0x441c02){return _0x3ef7fb[_0xd15b('0x1c')](_0x2f6187)[_0xd15b('0x1e')](_0x441c02);}};}function respondWithFilteredResult(_0x57cf3f,_0x50525c){return function(_0x3fa9fe){if(_0x3fa9fe){var _0x590bb8=typeof _0x50525c[_0xd15b('0x1f')]===_0xd15b('0x20')&&typeof _0x50525c[_0xd15b('0x21')]===_0xd15b('0x20');var _0x2b912a=_0x3fa9fe[_0xd15b('0x22')];var _0xd2f71e=_0x590bb8?0x0:_0x50525c[_0xd15b('0x1f')];var _0x33301f=_0x590bb8?_0x3fa9fe[_0xd15b('0x22')]:_0x50525c['offset']+_0x50525c[_0xd15b('0x21')];var _0x589509;if(_0x33301f>=_0x2b912a){_0x33301f=_0x2b912a;_0x589509=0xc8;}else{_0x589509=0xce;}_0x57cf3f[_0xd15b('0x1c')](_0x589509);return _0x57cf3f[_0xd15b('0x23')](_0xd15b('0x24'),_0xd2f71e+'-'+_0x33301f+'/'+_0x2b912a)['json'](_0x3fa9fe);}return null;};}function patchUpdates(_0x2eee92){return function(_0x3db70e){try{jsonpatch[_0xd15b('0x25')](_0x3db70e,_0x2eee92,!![]);}catch(_0x2d41d3){return BPromise[_0xd15b('0x26')](_0x2d41d3);}return _0x3db70e[_0xd15b('0x27')]();};}function saveUpdates(_0x33dad9,_0x11cd9e){return function(_0x7a29a5){if(_0x7a29a5){return _0x7a29a5[_0xd15b('0x28')](_0x33dad9)[_0xd15b('0x29')](function(_0x1c68fd){return _0x1c68fd;});}return null;};}function removeEntity(_0x5c279c,_0x3ed00a){return function(_0x48a631){if(_0x48a631){return _0x48a631[_0xd15b('0x2a')]()[_0xd15b('0x29')](function(){_0x5c279c['status'](0xcc)[_0xd15b('0x1d')]();});}};}function handleEntityNotFound(_0x1dda49,_0x474359){return function(_0x171529){if(!_0x171529){_0x1dda49[_0xd15b('0x1b')](0x194);}return _0x171529;};}function handleError(_0x237ec4,_0x44baca){_0x44baca=_0x44baca||0x1f4;return function(_0x42613d){logger['error'](_0x42613d[_0xd15b('0x2b')]);if(_0x42613d[_0xd15b('0x2c')]){delete _0x42613d['name'];}_0x237ec4[_0xd15b('0x1c')](_0x44baca)[_0xd15b('0x2d')](_0x42613d);};}exports['index']=function(_0x14e1bd,_0x5b9878){var _0xf9fd36={},_0x877043={},_0x1f5522={'count':0x0,'rows':[]};var _0x2f0131=_[_0xd15b('0x2e')](db[_0xd15b('0x2f')][_0xd15b('0x30')],function(_0x22e1dc){return{'name':_0x22e1dc['fieldName'],'type':_0x22e1dc[_0xd15b('0x31')][_0xd15b('0x32')]};});_0x877043[_0xd15b('0x33')]=_[_0xd15b('0x2e')](_0x2f0131,_0xd15b('0x2c'));_0x877043[_0xd15b('0x34')]=_[_0xd15b('0x35')](_0x14e1bd[_0xd15b('0x34')]);_0x877043['filters']=_[_0xd15b('0x36')](_0x877043[_0xd15b('0x33')],_0x877043['query']);_0xf9fd36[_0xd15b('0x37')]=_[_0xd15b('0x36')](_0x877043['model'],qs[_0xd15b('0x38')](_0x14e1bd[_0xd15b('0x34')]['fields']));_0xf9fd36[_0xd15b('0x37')]=_0xf9fd36[_0xd15b('0x37')][_0xd15b('0x39')]?_0xf9fd36['attributes']:_0x877043[_0xd15b('0x33')];if(!_0x14e1bd[_0xd15b('0x34')]['hasOwnProperty'](_0xd15b('0x3a'))){_0xf9fd36['limit']=qs[_0xd15b('0x21')](_0x14e1bd[_0xd15b('0x34')]['limit']);_0xf9fd36['offset']=qs['offset'](_0x14e1bd[_0xd15b('0x34')][_0xd15b('0x1f')]);}_0xf9fd36[_0xd15b('0x3b')]=qs[_0xd15b('0x3c')](_0x14e1bd['query']['sort']);_0xf9fd36[_0xd15b('0x3d')]=qs[_0xd15b('0x3e')](_[_0xd15b('0x3f')](_0x14e1bd[_0xd15b('0x34')],_0x877043[_0xd15b('0x3e')]),_0x2f0131);if(_0x14e1bd[_0xd15b('0x34')][_0xd15b('0x40')]){_0xf9fd36['where']=_[_0xd15b('0x41')](_0xf9fd36[_0xd15b('0x3d')],{'$or':_[_0xd15b('0x2e')](_0x2f0131,function(_0x5c5a64){if(_0x5c5a64[_0xd15b('0x31')]!==_0xd15b('0x42')){var _0x442846={};_0x442846[_0x5c5a64[_0xd15b('0x2c')]]={'$like':'%'+_0x14e1bd[_0xd15b('0x34')]['filter']+'%'};return _0x442846;}})});}_0xf9fd36=_[_0xd15b('0x41')]({},_0xf9fd36,_0x14e1bd[_0xd15b('0x43')]);var _0xbd5804={'where':_0xf9fd36[_0xd15b('0x3d')]};return db[_0xd15b('0x2f')][_0xd15b('0x22')](_0xbd5804)[_0xd15b('0x29')](function(_0x1c2cb1){_0x1f5522[_0xd15b('0x22')]=_0x1c2cb1;if(_0x14e1bd['query'][_0xd15b('0x44')]){_0xf9fd36[_0xd15b('0x45')]=[{'all':!![]}];}return db[_0xd15b('0x2f')][_0xd15b('0x46')](_0xf9fd36);})[_0xd15b('0x29')](function(_0x6c8ddf){_0x1f5522['rows']=_0x6c8ddf;return _0x1f5522;})[_0xd15b('0x29')](respondWithFilteredResult(_0x5b9878,_0xf9fd36))[_0xd15b('0x47')](handleError(_0x5b9878,null));};exports[_0xd15b('0x48')]=function(_0x4e40a8,_0xaea8b5){var _0x520ccd={'raw':!![],'where':{'id':_0x4e40a8[_0xd15b('0x49')]['id']}},_0x1a9ebd={};_0x1a9ebd[_0xd15b('0x33')]=_[_0xd15b('0x35')](db[_0xd15b('0x2f')][_0xd15b('0x30')]);_0x1a9ebd[_0xd15b('0x34')]=_[_0xd15b('0x35')](_0x4e40a8[_0xd15b('0x34')]);_0x1a9ebd[_0xd15b('0x3e')]=_[_0xd15b('0x36')](_0x1a9ebd[_0xd15b('0x33')],_0x1a9ebd['query']);_0x520ccd[_0xd15b('0x37')]=_[_0xd15b('0x36')](_0x1a9ebd['model'],qs[_0xd15b('0x38')](_0x4e40a8['query'][_0xd15b('0x38')]));_0x520ccd[_0xd15b('0x37')]=_0x520ccd[_0xd15b('0x37')][_0xd15b('0x39')]?_0x520ccd[_0xd15b('0x37')]:_0x1a9ebd[_0xd15b('0x33')];if(_0x4e40a8[_0xd15b('0x34')][_0xd15b('0x44')]){_0x520ccd[_0xd15b('0x45')]=[{'all':!![]}];}_0x520ccd=_[_0xd15b('0x41')]({},_0x520ccd,_0x4e40a8['options']);return db['ServicenowField']['find'](_0x520ccd)[_0xd15b('0x29')](handleEntityNotFound(_0xaea8b5,null))[_0xd15b('0x29')](respondWithResult(_0xaea8b5,null))[_0xd15b('0x47')](handleError(_0xaea8b5,null));};exports[_0xd15b('0x4a')]=function(_0x10a02c,_0x3ff587){return db[_0xd15b('0x2f')]['create'](_0x10a02c[_0xd15b('0x4b')],{})['then'](respondWithResult(_0x3ff587,0xc9))[_0xd15b('0x47')](handleError(_0x3ff587,null));};exports['update']=function(_0x3b1abd,_0x274d80){if(_0x3b1abd[_0xd15b('0x4b')]['id']){delete _0x3b1abd['body']['id'];}return db['ServicenowField'][_0xd15b('0x4c')]({'where':{'id':_0x3b1abd[_0xd15b('0x49')]['id']}})[_0xd15b('0x29')](handleEntityNotFound(_0x274d80,null))[_0xd15b('0x29')](saveUpdates(_0x3b1abd[_0xd15b('0x4b')],null))[_0xd15b('0x29')](respondWithResult(_0x274d80,null))[_0xd15b('0x47')](handleError(_0x274d80,null));};exports[_0xd15b('0x2a')]=function(_0x50c746,_0x18bc47){return db[_0xd15b('0x2f')][_0xd15b('0x4c')]({'where':{'id':_0x50c746[_0xd15b('0x49')]['id']}})[_0xd15b('0x29')](handleEntityNotFound(_0x18bc47,null))[_0xd15b('0x29')](removeEntity(_0x18bc47,null))[_0xd15b('0x47')](handleError(_0x18bc47,null));}; \ No newline at end of file +var _0xb7f3=['catch','show','params','options','create','body','destroy','find','eml-format','rimraf','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','reject','update','then','error','stack','send','map','ServicenowField','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','includeAll','include','findAll'];(function(_0xd59614,_0xbf894d){var _0x4aa06d=function(_0x225a17){while(--_0x225a17){_0xd59614['push'](_0xd59614['shift']());}};_0x4aa06d(++_0xbf894d);}(_0xb7f3,0x1eb));var _0x3b7f=function(_0x56e668,_0x453b9f){_0x56e668=_0x56e668-0x0;var _0x65bf29=_0xb7f3[_0x56e668];return _0x65bf29;};'use strict';var emlformat=require(_0x3b7f('0x0'));var rimraf=require(_0x3b7f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3b7f('0x2'));var BPromise=require(_0x3b7f('0x3'));var Mustache=require(_0x3b7f('0x4'));var util=require(_0x3b7f('0x5'));var path=require('path');var sox=require(_0x3b7f('0x6'));var csv=require(_0x3b7f('0x7'));var ejs=require(_0x3b7f('0x8'));var fs=require('fs');var fs_extra=require(_0x3b7f('0x9'));var _=require(_0x3b7f('0xa'));var squel=require(_0x3b7f('0xb'));var crypto=require(_0x3b7f('0xc'));var jsforce=require(_0x3b7f('0xd'));var deskjs=require(_0x3b7f('0xe'));var toCsv=require(_0x3b7f('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3b7f('0xf'));var authService=require(_0x3b7f('0x10'));var qs=require(_0x3b7f('0x11'));var as=require(_0x3b7f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3b7f('0x13'))(_0x3b7f('0x14'));var utils=require(_0x3b7f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x3b7f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b1f3e,_0xabe89e){_0xabe89e=_0xabe89e||0xcc;return function(_0x41080f){if(_0x41080f){return _0x4b1f3e[_0x3b7f('0x17')](_0xabe89e);}return _0x4b1f3e[_0x3b7f('0x18')](_0xabe89e)[_0x3b7f('0x19')]();};}function respondWithResult(_0x4bea2f,_0x151664){_0x151664=_0x151664||0xc8;return function(_0x14d40c){if(_0x14d40c){return _0x4bea2f['status'](_0x151664)['json'](_0x14d40c);}};}function respondWithFilteredResult(_0x336b39,_0x26c07a){return function(_0x4db3b4){if(_0x4db3b4){var _0x330ac1=typeof _0x26c07a[_0x3b7f('0x1a')]==='undefined'&&typeof _0x26c07a[_0x3b7f('0x1b')]===_0x3b7f('0x1c');var _0x1ac234=_0x4db3b4['count'];var _0x4536d4=_0x330ac1?0x0:_0x26c07a[_0x3b7f('0x1a')];var _0x4ad126=_0x330ac1?_0x4db3b4[_0x3b7f('0x1d')]:_0x26c07a[_0x3b7f('0x1a')]+_0x26c07a[_0x3b7f('0x1b')];var _0x2eb024;if(_0x4ad126>=_0x1ac234){_0x4ad126=_0x1ac234;_0x2eb024=0xc8;}else{_0x2eb024=0xce;}_0x336b39[_0x3b7f('0x18')](_0x2eb024);return _0x336b39['set']('Content-Range',_0x4536d4+'-'+_0x4ad126+'/'+_0x1ac234)['json'](_0x4db3b4);}return null;};}function patchUpdates(_0x1dfbf8){return function(_0x21353f){try{jsonpatch['apply'](_0x21353f,_0x1dfbf8,!![]);}catch(_0x5e20f4){return BPromise[_0x3b7f('0x1e')](_0x5e20f4);}return _0x21353f['save']();};}function saveUpdates(_0x20fa03,_0x1cefd7){return function(_0x50857a){if(_0x50857a){return _0x50857a[_0x3b7f('0x1f')](_0x20fa03)[_0x3b7f('0x20')](function(_0x39ed8c){return _0x39ed8c;});}return null;};}function removeEntity(_0xb8fb15,_0x353132){return function(_0x15835b){if(_0x15835b){return _0x15835b['destroy']()[_0x3b7f('0x20')](function(){_0xb8fb15[_0x3b7f('0x18')](0xcc)[_0x3b7f('0x19')]();});}};}function handleEntityNotFound(_0x3a2eaa,_0x12eb6d){return function(_0x404094){if(!_0x404094){_0x3a2eaa['sendStatus'](0x194);}return _0x404094;};}function handleError(_0x29ef12,_0xe2b584){_0xe2b584=_0xe2b584||0x1f4;return function(_0x11919c){logger[_0x3b7f('0x21')](_0x11919c[_0x3b7f('0x22')]);if(_0x11919c['name']){delete _0x11919c['name'];}_0x29ef12['status'](_0xe2b584)[_0x3b7f('0x23')](_0x11919c);};}exports['index']=function(_0xce3265,_0x3af8fa){var _0x32f6b6={},_0x2c7bd5={},_0x4e2248={'count':0x0,'rows':[]};var _0x38916b=_[_0x3b7f('0x24')](db[_0x3b7f('0x25')][_0x3b7f('0x26')],function(_0x20823a){return{'name':_0x20823a[_0x3b7f('0x27')],'type':_0x20823a['type'][_0x3b7f('0x28')]};});_0x2c7bd5[_0x3b7f('0x29')]=_['map'](_0x38916b,_0x3b7f('0x2a'));_0x2c7bd5[_0x3b7f('0x2b')]=_[_0x3b7f('0x2c')](_0xce3265[_0x3b7f('0x2b')]);_0x2c7bd5[_0x3b7f('0x2d')]=_[_0x3b7f('0x2e')](_0x2c7bd5[_0x3b7f('0x29')],_0x2c7bd5[_0x3b7f('0x2b')]);_0x32f6b6[_0x3b7f('0x2f')]=_[_0x3b7f('0x2e')](_0x2c7bd5['model'],qs[_0x3b7f('0x30')](_0xce3265[_0x3b7f('0x2b')][_0x3b7f('0x30')]));_0x32f6b6['attributes']=_0x32f6b6['attributes']['length']?_0x32f6b6['attributes']:_0x2c7bd5[_0x3b7f('0x29')];if(!_0xce3265[_0x3b7f('0x2b')][_0x3b7f('0x31')](_0x3b7f('0x32'))){_0x32f6b6['limit']=qs['limit'](_0xce3265[_0x3b7f('0x2b')]['limit']);_0x32f6b6['offset']=qs[_0x3b7f('0x1a')](_0xce3265[_0x3b7f('0x2b')][_0x3b7f('0x1a')]);}_0x32f6b6[_0x3b7f('0x33')]=qs[_0x3b7f('0x34')](_0xce3265[_0x3b7f('0x2b')][_0x3b7f('0x34')]);_0x32f6b6[_0x3b7f('0x35')]=qs[_0x3b7f('0x2d')](_['pick'](_0xce3265[_0x3b7f('0x2b')],_0x2c7bd5[_0x3b7f('0x2d')]),_0x38916b);if(_0xce3265[_0x3b7f('0x2b')][_0x3b7f('0x36')]){_0x32f6b6[_0x3b7f('0x35')]=_[_0x3b7f('0x37')](_0x32f6b6[_0x3b7f('0x35')],{'$or':_[_0x3b7f('0x24')](_0x38916b,function(_0x5b4bea){if(_0x5b4bea[_0x3b7f('0x38')]!==_0x3b7f('0x39')){var _0x379a55={};_0x379a55[_0x5b4bea[_0x3b7f('0x2a')]]={'$like':'%'+_0xce3265[_0x3b7f('0x2b')]['filter']+'%'};return _0x379a55;}})});}_0x32f6b6=_[_0x3b7f('0x37')]({},_0x32f6b6,_0xce3265['options']);var _0x2a8663={'where':_0x32f6b6[_0x3b7f('0x35')]};return db[_0x3b7f('0x25')][_0x3b7f('0x1d')](_0x2a8663)['then'](function(_0x4a3712){_0x4e2248[_0x3b7f('0x1d')]=_0x4a3712;if(_0xce3265['query'][_0x3b7f('0x3a')]){_0x32f6b6[_0x3b7f('0x3b')]=[{'all':!![]}];}return db[_0x3b7f('0x25')][_0x3b7f('0x3c')](_0x32f6b6);})['then'](function(_0x545f0c){_0x4e2248['rows']=_0x545f0c;return _0x4e2248;})[_0x3b7f('0x20')](respondWithFilteredResult(_0x3af8fa,_0x32f6b6))[_0x3b7f('0x3d')](handleError(_0x3af8fa,null));};exports[_0x3b7f('0x3e')]=function(_0xeed02e,_0x5a1fda){var _0x389dad={'raw':!![],'where':{'id':_0xeed02e[_0x3b7f('0x3f')]['id']}},_0x13d2d0={};_0x13d2d0[_0x3b7f('0x29')]=_[_0x3b7f('0x2c')](db[_0x3b7f('0x25')][_0x3b7f('0x26')]);_0x13d2d0[_0x3b7f('0x2b')]=_[_0x3b7f('0x2c')](_0xeed02e[_0x3b7f('0x2b')]);_0x13d2d0[_0x3b7f('0x2d')]=_[_0x3b7f('0x2e')](_0x13d2d0[_0x3b7f('0x29')],_0x13d2d0[_0x3b7f('0x2b')]);_0x389dad[_0x3b7f('0x2f')]=_[_0x3b7f('0x2e')](_0x13d2d0[_0x3b7f('0x29')],qs[_0x3b7f('0x30')](_0xeed02e[_0x3b7f('0x2b')][_0x3b7f('0x30')]));_0x389dad[_0x3b7f('0x2f')]=_0x389dad['attributes']['length']?_0x389dad['attributes']:_0x13d2d0['model'];if(_0xeed02e[_0x3b7f('0x2b')][_0x3b7f('0x3a')]){_0x389dad[_0x3b7f('0x3b')]=[{'all':!![]}];}_0x389dad=_[_0x3b7f('0x37')]({},_0x389dad,_0xeed02e[_0x3b7f('0x40')]);return db['ServicenowField']['find'](_0x389dad)[_0x3b7f('0x20')](handleEntityNotFound(_0x5a1fda,null))['then'](respondWithResult(_0x5a1fda,null))[_0x3b7f('0x3d')](handleError(_0x5a1fda,null));};exports[_0x3b7f('0x41')]=function(_0x29f608,_0x1599dd){return db[_0x3b7f('0x25')][_0x3b7f('0x41')](_0x29f608['body'],{})['then'](respondWithResult(_0x1599dd,0xc9))[_0x3b7f('0x3d')](handleError(_0x1599dd,null));};exports['update']=function(_0x46d334,_0x27920b){if(_0x46d334[_0x3b7f('0x42')]['id']){delete _0x46d334[_0x3b7f('0x42')]['id'];}return db[_0x3b7f('0x25')]['find']({'where':{'id':_0x46d334[_0x3b7f('0x3f')]['id']}})[_0x3b7f('0x20')](handleEntityNotFound(_0x27920b,null))[_0x3b7f('0x20')](saveUpdates(_0x46d334[_0x3b7f('0x42')],null))[_0x3b7f('0x20')](respondWithResult(_0x27920b,null))[_0x3b7f('0x3d')](handleError(_0x27920b,null));};exports[_0x3b7f('0x43')]=function(_0x41c60b,_0x12a4e9){return db[_0x3b7f('0x25')][_0x3b7f('0x44')]({'where':{'id':_0x41c60b[_0x3b7f('0x3f')]['id']}})[_0x3b7f('0x20')](handleEntityNotFound(_0x12a4e9,null))[_0x3b7f('0x20')](removeEntity(_0x12a4e9,null))[_0x3b7f('0x3d')](handleError(_0x12a4e9,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index e487d81..fc1ff1f 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 _0x15f7=['request-promise','path','../../config/environment','./intServicenowField.attributes','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird'];(function(_0x4f8554,_0x2abc84){var _0x1964bc=function(_0xbf613f){while(--_0xbf613f){_0x4f8554['push'](_0x4f8554['shift']());}};_0x1964bc(++_0x2abc84);}(_0x15f7,0x109));var _0x715f=function(_0x12d951,_0x249808){_0x12d951=_0x12d951-0x0;var _0x44de17=_0x15f7[_0x12d951];return _0x44de17;};'use strict';var _=require(_0x715f('0x0'));var util=require(_0x715f('0x1'));var logger=require(_0x715f('0x2'))(_0x715f('0x3'));var moment=require('moment');var BPromise=require(_0x715f('0x4'));var rp=require(_0x715f('0x5'));var fs=require('fs');var path=require(_0x715f('0x6'));var rimraf=require('rimraf');var config=require(_0x715f('0x7'));var attributes=require(_0x715f('0x8'));module['exports']=function(_0x454881,_0x442c53){return _0x454881[_0x715f('0x9')](_0x715f('0xa'),attributes,{'tableName':_0x715f('0xb'),'paranoid':![],'indexes':[{'name':_0x715f('0xc'),'fields':[_0x715f('0xd'),_0x715f('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf494=['define','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports'];(function(_0x85d5a8,_0x1977be){var _0x20479b=function(_0x125248){while(--_0x125248){_0x85d5a8['push'](_0x85d5a8['shift']());}};_0x20479b(++_0x1977be);}(_0xf494,0x1c6));var _0x4f49=function(_0x107261,_0x3dc1f3){_0x107261=_0x107261-0x0;var _0x4fce96=_0xf494[_0x107261];return _0x4fce96;};'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')]('ServicenowField',attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x4f49('0xc'),'fields':[_0x4f49('0xd'),_0x4f49('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 3c43c36..4f58442 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 _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x2e19ac,_0x5ee48a){var _0x29d578=function(_0x436f90){while(--_0x436f90){_0x2e19ac['push'](_0x2e19ac['shift']());}};_0x29d578(++_0x5ee48a);}(_0xaa88,0x137));var _0x8aa8=function(_0x513f27,_0x1cbc87){_0x513f27=_0x513f27-0x0;var _0xa316b7=_0xaa88[_0x513f27];return _0xa316b7;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file +var _0xac4a=['ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xac4a,0x13f));var _0xaac4=function(_0x26646a,_0x5deb68){_0x26646a=_0x26646a-0x0;var _0x401ff4=_0xac4a[_0x26646a];return _0x401ff4;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('ServicenowField,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('ServicenowField,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 5116d3d..6e918cc 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x41a58f,_0x507593){var _0x138039=function(_0x761b1f){while(--_0x761b1f){_0x41a58f['push'](_0x41a58f['shift']());}};_0x138039(++_0x507593);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _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(_0x511f22,_0x5561f0){var _0x27ab94=function(_0x155d85){while(--_0x155d85){_0x511f22['push'](_0x511f22['shift']());}};_0x27ab94(++_0x5561f0);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 4bff815..0b57a07 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(_0x239b3f,_0x19b394){var _0x4833cd=function(_0x3ba12f){while(--_0x3ba12f){_0x239b3f['push'](_0x239b3f['shift']());}};_0x4833cd(++_0x19b394);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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(_0x108ee8,_0x440e1b){var _0x1597d4=function(_0x58a272){while(--_0x58a272){_0x108ee8['push'](_0x108ee8['shift']());}};_0x1597d4(++_0x440e1b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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 4c80f67..e413f4f 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 _0x3896=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','SugarcrmAccount','includeAll','include','findAll','rows','show','find','catch','create','body','params','findOne','SugarcrmConfiguration','getConfigurations','addConfiguration','AccountId','getSubjects','channel','getDescriptions','SugarcrmField','Subjects','getFields','created_by','description','duration_minutes','parent_id','parent_type','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','%s%s','/service/v4_1/rest.php','login','JSON','stringify','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','module_fields','remove','label','endsWith','values','test','statusCode','Wrong\x20credentials','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x35a64d,_0x530443){var _0x5c76da=function(_0x118b4c){while(--_0x118b4c){_0x35a64d['push'](_0x35a64d['shift']());}};_0x5c76da(++_0x530443);}(_0x3896,0x65));var _0x6389=function(_0xbfa243,_0x2f00a7){_0xbfa243=_0xbfa243-0x0;var _0x25b2a3=_0x3896[_0xbfa243];return _0x25b2a3;};'use strict';var emlformat=require(_0x6389('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6389('0x1'));var rp=require(_0x6389('0x2'));var moment=require(_0x6389('0x3'));var BPromise=require(_0x6389('0x4'));var Mustache=require(_0x6389('0x5'));var util=require('util');var path=require('path');var sox=require(_0x6389('0x6'));var csv=require(_0x6389('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6389('0x8'));var _=require(_0x6389('0x9'));var squel=require(_0x6389('0xa'));var crypto=require(_0x6389('0xb'));var jsforce=require(_0x6389('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6389('0x7'));var querystring=require(_0x6389('0xd'));var Papa=require(_0x6389('0xe'));var Redis=require(_0x6389('0xf'));var authService=require(_0x6389('0x10'));var qs=require(_0x6389('0x11'));var as=require(_0x6389('0x12'));var hardwareService=require(_0x6389('0x13'));var logger=require(_0x6389('0x14'))(_0x6389('0x15'));var utils=require(_0x6389('0x16'));var config=require(_0x6389('0x17'));var licenseUtil=require(_0x6389('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x6389('0x19'));function respondWithStatusCode(_0x54e574,_0x233884){_0x233884=_0x233884||0xcc;return function(_0x5ab4fa){if(_0x5ab4fa){return _0x54e574[_0x6389('0x1a')](_0x233884);}return _0x54e574[_0x6389('0x1b')](_0x233884)['end']();};}function respondWithResult(_0x4378b6,_0x1eedae){_0x1eedae=_0x1eedae||0xc8;return function(_0x349320){if(_0x349320){return _0x4378b6[_0x6389('0x1b')](_0x1eedae)[_0x6389('0x1c')](_0x349320);}};}function respondWithFilteredResult(_0x701527,_0x183c09){return function(_0x3fcaab){if(_0x3fcaab){var _0x1307c9=typeof _0x183c09['offset']===_0x6389('0x1d')&&typeof _0x183c09[_0x6389('0x1e')]==='undefined';var _0x211732=_0x3fcaab[_0x6389('0x1f')];var _0x49e813=_0x1307c9?0x0:_0x183c09[_0x6389('0x20')];var _0x1373dd=_0x1307c9?_0x3fcaab['count']:_0x183c09['offset']+_0x183c09['limit'];var _0x29f879;if(_0x1373dd>=_0x211732){_0x1373dd=_0x211732;_0x29f879=0xc8;}else{_0x29f879=0xce;}_0x701527[_0x6389('0x1b')](_0x29f879);return _0x701527[_0x6389('0x21')]('Content-Range',_0x49e813+'-'+_0x1373dd+'/'+_0x211732)[_0x6389('0x1c')](_0x3fcaab);}return null;};}function patchUpdates(_0x1c30d4){return function(_0x2e4372){try{jsonpatch[_0x6389('0x22')](_0x2e4372,_0x1c30d4,!![]);}catch(_0x5a78b7){return BPromise['reject'](_0x5a78b7);}return _0x2e4372[_0x6389('0x23')]();};}function saveUpdates(_0x357ed3,_0x12d739){return function(_0xb5ece6){if(_0xb5ece6){return _0xb5ece6[_0x6389('0x24')](_0x357ed3)[_0x6389('0x25')](function(_0x4adfb9){return _0x4adfb9;});}return null;};}function removeEntity(_0x377890,_0x4a69c0){return function(_0x3537f7){if(_0x3537f7){return _0x3537f7[_0x6389('0x26')]()['then'](function(){_0x377890[_0x6389('0x1b')](0xcc)[_0x6389('0x27')]();});}};}function handleEntityNotFound(_0x48d9eb,_0x516672){return function(_0x28800f){if(!_0x28800f){_0x48d9eb[_0x6389('0x1a')](0x194);}return _0x28800f;};}function handleError(_0x1064b1,_0x4ef68f){_0x4ef68f=_0x4ef68f||0x1f4;return function(_0x579d08){logger[_0x6389('0x28')](_0x579d08[_0x6389('0x29')]);if(_0x579d08[_0x6389('0x2a')]){delete _0x579d08[_0x6389('0x2a')];}_0x1064b1['status'](_0x4ef68f)[_0x6389('0x2b')](_0x579d08);};}exports[_0x6389('0x2c')]=function(_0x58980b,_0x1f10cb){var _0x38e85d={},_0x59b576={},_0x574d98={'count':0x0,'rows':[]};var _0x19d893=_[_0x6389('0x2d')](db['SugarcrmAccount'][_0x6389('0x2e')],function(_0x30ac4b){return{'name':_0x30ac4b['fieldName'],'type':_0x30ac4b['type'][_0x6389('0x2f')]};});_0x59b576[_0x6389('0x30')]=_[_0x6389('0x2d')](_0x19d893,_0x6389('0x2a'));_0x59b576[_0x6389('0x31')]=_[_0x6389('0x32')](_0x58980b[_0x6389('0x31')]);_0x59b576[_0x6389('0x33')]=_[_0x6389('0x34')](_0x59b576['model'],_0x59b576['query']);_0x38e85d[_0x6389('0x35')]=_[_0x6389('0x34')](_0x59b576['model'],qs['fields'](_0x58980b['query'][_0x6389('0x36')]));_0x38e85d[_0x6389('0x35')]=_0x38e85d['attributes'][_0x6389('0x37')]?_0x38e85d[_0x6389('0x35')]:_0x59b576[_0x6389('0x30')];if(!_0x58980b[_0x6389('0x31')][_0x6389('0x38')](_0x6389('0x39'))){_0x38e85d[_0x6389('0x1e')]=qs[_0x6389('0x1e')](_0x58980b[_0x6389('0x31')][_0x6389('0x1e')]);_0x38e85d[_0x6389('0x20')]=qs[_0x6389('0x20')](_0x58980b['query']['offset']);}_0x38e85d[_0x6389('0x3a')]=qs[_0x6389('0x3b')](_0x58980b[_0x6389('0x31')][_0x6389('0x3b')]);_0x38e85d[_0x6389('0x3c')]=qs[_0x6389('0x33')](_[_0x6389('0x3d')](_0x58980b[_0x6389('0x31')],_0x59b576[_0x6389('0x33')]),_0x19d893);if(_0x58980b['query'][_0x6389('0x3e')]){_0x38e85d[_0x6389('0x3c')]=_[_0x6389('0x3f')](_0x38e85d[_0x6389('0x3c')],{'$or':_[_0x6389('0x2d')](_0x19d893,function(_0x1a03fe){if(_0x1a03fe[_0x6389('0x40')]!=='VIRTUAL'){var _0x18a4a8={};_0x18a4a8[_0x1a03fe[_0x6389('0x2a')]]={'$like':'%'+_0x58980b[_0x6389('0x31')]['filter']+'%'};return _0x18a4a8;}})});}_0x38e85d=_[_0x6389('0x3f')]({},_0x38e85d,_0x58980b[_0x6389('0x41')]);var _0x3dc3c0={'where':_0x38e85d['where']};return db[_0x6389('0x42')]['count'](_0x3dc3c0)['then'](function(_0xbc3cf0){_0x574d98['count']=_0xbc3cf0;if(_0x58980b[_0x6389('0x31')][_0x6389('0x43')]){_0x38e85d[_0x6389('0x44')]=[{'all':!![]}];}return db[_0x6389('0x42')][_0x6389('0x45')](_0x38e85d);})[_0x6389('0x25')](function(_0x178c60){_0x574d98[_0x6389('0x46')]=_0x178c60;return _0x574d98;})['then'](respondWithFilteredResult(_0x1f10cb,_0x38e85d))['catch'](handleError(_0x1f10cb,null));};exports[_0x6389('0x47')]=function(_0x5b32a6,_0x596a71){var _0x1d6433={'raw':![],'where':{'id':_0x5b32a6['params']['id']}},_0x471ab8={};_0x471ab8[_0x6389('0x30')]=_['keys'](db[_0x6389('0x42')][_0x6389('0x2e')]);_0x471ab8['query']=_['keys'](_0x5b32a6[_0x6389('0x31')]);_0x471ab8['filters']=_['intersection'](_0x471ab8[_0x6389('0x30')],_0x471ab8[_0x6389('0x31')]);_0x1d6433[_0x6389('0x35')]=_[_0x6389('0x34')](_0x471ab8[_0x6389('0x30')],qs[_0x6389('0x36')](_0x5b32a6[_0x6389('0x31')][_0x6389('0x36')]));_0x1d6433[_0x6389('0x35')]=_0x1d6433[_0x6389('0x35')][_0x6389('0x37')]?_0x1d6433['attributes']:_0x471ab8['model'];if(_0x5b32a6[_0x6389('0x31')][_0x6389('0x43')]){_0x1d6433[_0x6389('0x44')]=[{'all':!![]}];}_0x1d6433=_['merge']({},_0x1d6433,_0x5b32a6['options']);return db[_0x6389('0x42')][_0x6389('0x48')](_0x1d6433)['then'](handleEntityNotFound(_0x596a71,null))[_0x6389('0x25')](respondWithResult(_0x596a71,null))[_0x6389('0x49')](handleError(_0x596a71,null));};exports['create']=function(_0x350602,_0x3770e8){return db[_0x6389('0x42')][_0x6389('0x4a')](_0x350602['body'],{})[_0x6389('0x25')](respondWithResult(_0x3770e8,0xc9))[_0x6389('0x49')](handleError(_0x3770e8,null));};exports[_0x6389('0x24')]=function(_0x5711be,_0x1a678c){if(_0x5711be[_0x6389('0x4b')]['id']){delete _0x5711be[_0x6389('0x4b')]['id'];}return db[_0x6389('0x42')][_0x6389('0x48')]({'where':{'id':_0x5711be[_0x6389('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1a678c,null))[_0x6389('0x25')](saveUpdates(_0x5711be[_0x6389('0x4b')],null))[_0x6389('0x25')](respondWithResult(_0x1a678c,null))['catch'](handleError(_0x1a678c,null));};exports[_0x6389('0x26')]=function(_0x47319b,_0x4b603a){return db['SugarcrmAccount']['find']({'where':{'id':_0x47319b[_0x6389('0x4c')]['id']}})[_0x6389('0x25')](handleEntityNotFound(_0x4b603a,null))['then'](removeEntity(_0x4b603a,null))[_0x6389('0x49')](handleError(_0x4b603a,null));};exports['getConfigurations']=function(_0x1dd4a3,_0xd0b634,_0x825893){var _0x218c98={};var _0x1299af={};var _0x49a113;var _0x19990d;return db['SugarcrmAccount'][_0x6389('0x4d')]({'where':{'id':_0x1dd4a3[_0x6389('0x4c')]['id']}})[_0x6389('0x25')](handleEntityNotFound(_0xd0b634,null))[_0x6389('0x25')](function(_0x634a45){if(_0x634a45){_0x49a113=_0x634a45;_0x1299af[_0x6389('0x30')]=_[_0x6389('0x32')](db[_0x6389('0x4e')][_0x6389('0x2e')]);_0x1299af[_0x6389('0x31')]=_[_0x6389('0x32')](_0x1dd4a3[_0x6389('0x31')]);_0x1299af[_0x6389('0x33')]=_['intersection'](_0x1299af['model'],_0x1299af[_0x6389('0x31')]);_0x218c98[_0x6389('0x35')]=_['intersection'](_0x1299af['model'],qs[_0x6389('0x36')](_0x1dd4a3['query']['fields']));_0x218c98[_0x6389('0x35')]=_0x218c98[_0x6389('0x35')]['length']?_0x218c98['attributes']:_0x1299af[_0x6389('0x30')];_0x218c98[_0x6389('0x3a')]=qs['sort'](_0x1dd4a3[_0x6389('0x31')][_0x6389('0x3b')]);_0x218c98[_0x6389('0x3c')]=qs[_0x6389('0x33')](_[_0x6389('0x3d')](_0x1dd4a3[_0x6389('0x31')],_0x1299af[_0x6389('0x33')]));if(_0x1dd4a3[_0x6389('0x31')][_0x6389('0x3e')]){_0x218c98['where']=_['merge'](_0x218c98[_0x6389('0x3c')],{'$or':_[_0x6389('0x2d')](_0x218c98[_0x6389('0x35')],function(_0x1406c3){var _0x22c17b={};_0x22c17b[_0x1406c3]={'$like':'%'+_0x1dd4a3[_0x6389('0x31')]['filter']+'%'};return _0x22c17b;})});}_0x218c98=_[_0x6389('0x3f')]({},_0x218c98,_0x1dd4a3['options']);return _0x49a113[_0x6389('0x4f')](_0x218c98);}})['then'](function(_0x2c4cc8){if(_0x2c4cc8){_0x19990d=_0x2c4cc8[_0x6389('0x37')];if(!_0x1dd4a3['query'][_0x6389('0x38')]('nolimit')){_0x218c98[_0x6389('0x1e')]=qs['limit'](_0x1dd4a3[_0x6389('0x31')][_0x6389('0x1e')]);_0x218c98['offset']=qs[_0x6389('0x20')](_0x1dd4a3[_0x6389('0x31')][_0x6389('0x20')]);}return _0x49a113[_0x6389('0x4f')](_0x218c98);}})['then'](function(_0x59f907){if(_0x59f907){return _0x59f907?{'count':_0x19990d,'rows':_0x59f907}:null;}})['then'](respondWithResult(_0xd0b634,null))[_0x6389('0x49')](handleError(_0xd0b634,null));};exports[_0x6389('0x50')]=function(_0x3062c1,_0x6e929a,_0x1a442d){if(_0x3062c1[_0x6389('0x4b')]['id']){delete _0x3062c1['body']['id'];}return db[_0x6389('0x42')][_0x6389('0x4d')]({'where':{'id':_0x3062c1['params']['id']}})[_0x6389('0x25')](handleEntityNotFound(_0x6e929a,null))[_0x6389('0x25')](function(_0x3a4fc4){if(_0x3a4fc4){_0x3062c1[_0x6389('0x4b')][_0x6389('0x51')]=_0x3a4fc4['id'];_0x3062c1[_0x6389('0x4b')]['Subjects']=integrations[_0x6389('0x52')](_0x3062c1[_0x6389('0x4b')][_0x6389('0x53')],_0x3062c1[_0x6389('0x4b')][_0x6389('0x40')]);_0x3062c1['body']['Descriptions']=integrations[_0x6389('0x54')](_0x3062c1['body'][_0x6389('0x53')],_0x3062c1[_0x6389('0x4b')]['type']);return db['SugarcrmConfiguration']['create'](_0x3062c1[_0x6389('0x4b')],{'include':[{'model':db[_0x6389('0x55')],'as':_0x6389('0x56')},{'model':db['SugarcrmField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x6e929a,null))[_0x6389('0x49')](handleError(_0x6e929a,null));};exports[_0x6389('0x57')]=function(_0x6369b8,_0x1f7aac,_0x2430dc){var _0x1ebb62='';var _0x51d90e=['id',_0x6389('0x2a'),'assigned_user_id',_0x6389('0x58'),_0x6389('0x59'),'date_start','duration_hours',_0x6389('0x5a'),_0x6389('0x5b'),_0x6389('0x5c'),'parent_name',_0x6389('0x5d')];return db['SugarcrmAccount'][_0x6389('0x4d')]({'where':{'id':_0x6369b8['params']['id']},'attributes':['id',_0x6389('0x5e'),_0x6389('0x5f'),_0x6389('0x60')]})[_0x6389('0x25')](handleEntityNotFound(_0x1f7aac,null))[_0x6389('0x25')](function(_0x4db10a){if(_0x4db10a){_0x1ebb62=_0x4db10a[_0x6389('0x60')];var _0x56dd2d=_0x1ebb62[_0x6389('0x61')](-0x1);if(_0x56dd2d==='/'){_0x1ebb62=_0x1ebb62[_0x6389('0x62')](0x0,_0x1ebb62[_0x6389('0x63')](_0x56dd2d));}return rp({'method':_0x6389('0x64'),'uri':util['format'](_0x6389('0x65'),_0x1ebb62,_0x6389('0x66')),'json':!![],'form':{'method':_0x6389('0x67'),'input_type':_0x6389('0x68'),'response_type':_0x6389('0x68'),'rest_data':JSON[_0x6389('0x69')]({'user_auth':{'user_name':_0x4db10a[_0x6389('0x5e')],'password':_0x4db10a[_0x6389('0x5f')],'encryption':'PLAIN'},'application':_0x6389('0x6a')})}});}})[_0x6389('0x25')](function(_0x22ad63){if(_0x22ad63&&_0x22ad63[_0x6389('0x2a')]!==_0x6389('0x6b')&&_0x22ad63[_0x6389('0x2a')]!==_0x6389('0x6c')){return rp({'method':_0x6389('0x64'),'uri':util['format'](_0x6389('0x65'),_0x1ebb62,_0x6389('0x66')),'json':!![],'form':{'method':_0x6389('0x6d'),'input_type':_0x6389('0x68'),'response_type':_0x6389('0x68'),'rest_data':JSON[_0x6389('0x69')]({'session':_0x22ad63['id'],'module_name':_0x6389('0x6e')})}})['then'](function(_0x9d5733){if(_0x9d5733){var _0x284ece=_['values'](_0x9d5733[_0x6389('0x6f')]);_[_0x6389('0x70')](_0x284ece,function(_0x5d795e){return _0x51d90e['includes'](_0x5d795e[_0x6389('0x2a')]);});return{'count':_0x284ece[_0x6389('0x37')],'rows':_[_0x6389('0x2d')](_0x284ece,function(_0x2a2fe4){return{'id':_0x2a2fe4[_0x6389('0x2a')],'name':_0x2a2fe4[_0x6389('0x71')],'custom':_[_0x6389('0x72')](_0x2a2fe4[_0x6389('0x2a')],'_c')?!![]:![],'options':_0x2a2fe4[_0x6389('0x41')]?_['map'](_[_0x6389('0x73')](_0x2a2fe4[_0x6389('0x41')]),function(_0x31b4e3){return{'name':_0x31b4e3['value'],'value':_0x31b4e3[_0x6389('0x2a')]};}):[]};})};}})['then'](respondWithResult(_0x1f7aac,null))['catch'](function(_0x274027){var _0x290619=_0x6369b8['query'][_0x6389('0x74')]?0x1f4:_0x274027[_0x6389('0x75')]||0x1f4;logger[_0x6389('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0x6389('0x57'),_0x290619,JSON[_0x6389('0x69')](_0x274027));delete _0x274027[_0x6389('0x2a')];if(_0x290619===0x191){_0x290619=0x190;}_0x1f7aac[_0x6389('0x1b')](_0x290619)[_0x6389('0x2b')](_0x6369b8[_0x6389('0x31')]['test']?{'message':_0x6389('0x76'),'statusCode':_0x274027[_0x6389('0x75')]}:_0x274027);});}else{var _0x2e3ac6=0x1f4;_0x1f7aac[_0x6389('0x1b')](_0x2e3ac6)[_0x6389('0x2b')]({'message':_0x6389('0x76'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x675e=['remoteUri','slice','substring','format','/service/v4_1/rest.php','login','JSON','stringify','username','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','%s%s','get_module_fields','remove','includes','label','values','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','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','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','SugarcrmAccount','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','order','pick','addConfiguration','AccountId','Subjects','channel','SugarcrmField','getFields','created_by','date_start','duration_hours','duration_minutes','parent_id','parent_name','direction','password'];(function(_0x495737,_0x2573c9){var _0xace243=function(_0x1c5670){while(--_0x1c5670){_0x495737['push'](_0x495737['shift']());}};_0xace243(++_0x2573c9);}(_0x675e,0x10b));var _0xe675=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0x675e[_0x368fb9];return _0x4892fb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe675('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe675('0x1'));var rp=require(_0xe675('0x2'));var moment=require(_0xe675('0x3'));var BPromise=require(_0xe675('0x4'));var Mustache=require(_0xe675('0x5'));var util=require(_0xe675('0x6'));var path=require(_0xe675('0x7'));var sox=require(_0xe675('0x8'));var csv=require('to-csv');var ejs=require(_0xe675('0x9'));var fs=require('fs');var fs_extra=require(_0xe675('0xa'));var _=require(_0xe675('0xb'));var squel=require(_0xe675('0xc'));var crypto=require('crypto');var jsforce=require(_0xe675('0xd'));var deskjs=require(_0xe675('0xe'));var toCsv=require(_0xe675('0xf'));var querystring=require(_0xe675('0x10'));var Papa=require(_0xe675('0x11'));var Redis=require(_0xe675('0x12'));var authService=require(_0xe675('0x13'));var qs=require(_0xe675('0x14'));var as=require(_0xe675('0x15'));var hardwareService=require(_0xe675('0x16'));var logger=require(_0xe675('0x17'))(_0xe675('0x18'));var utils=require(_0xe675('0x19'));var config=require(_0xe675('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xe675('0x1b'))['db'];var integrations=require(_0xe675('0x1c'));function respondWithStatusCode(_0x4cb639,_0x42c34d){_0x42c34d=_0x42c34d||0xcc;return function(_0x28d337){if(_0x28d337){return _0x4cb639[_0xe675('0x1d')](_0x42c34d);}return _0x4cb639[_0xe675('0x1e')](_0x42c34d)[_0xe675('0x1f')]();};}function respondWithResult(_0x415256,_0x56fafd){_0x56fafd=_0x56fafd||0xc8;return function(_0x4e80a2){if(_0x4e80a2){return _0x415256[_0xe675('0x1e')](_0x56fafd)['json'](_0x4e80a2);}};}function respondWithFilteredResult(_0x108f30,_0x5866b8){return function(_0x3d7e0f){if(_0x3d7e0f){var _0x420fa9=typeof _0x5866b8[_0xe675('0x20')]===_0xe675('0x21')&&typeof _0x5866b8[_0xe675('0x22')]===_0xe675('0x21');var _0x5e455a=_0x3d7e0f['count'];var _0x359d5e=_0x420fa9?0x0:_0x5866b8['offset'];var _0x314c31=_0x420fa9?_0x3d7e0f[_0xe675('0x23')]:_0x5866b8['offset']+_0x5866b8['limit'];var _0x3c8796;if(_0x314c31>=_0x5e455a){_0x314c31=_0x5e455a;_0x3c8796=0xc8;}else{_0x3c8796=0xce;}_0x108f30['status'](_0x3c8796);return _0x108f30[_0xe675('0x24')](_0xe675('0x25'),_0x359d5e+'-'+_0x314c31+'/'+_0x5e455a)[_0xe675('0x26')](_0x3d7e0f);}return null;};}function patchUpdates(_0x251349){return function(_0x5c6fe7){try{jsonpatch[_0xe675('0x27')](_0x5c6fe7,_0x251349,!![]);}catch(_0x366fb0){return BPromise[_0xe675('0x28')](_0x366fb0);}return _0x5c6fe7[_0xe675('0x29')]();};}function saveUpdates(_0x3e6f53,_0x3fe94d){return function(_0x2eb63e){if(_0x2eb63e){return _0x2eb63e[_0xe675('0x2a')](_0x3e6f53)[_0xe675('0x2b')](function(_0x25b5c9){return _0x25b5c9;});}return null;};}function removeEntity(_0x1c3111,_0x25b154){return function(_0x2aa76b){if(_0x2aa76b){return _0x2aa76b[_0xe675('0x2c')]()['then'](function(){_0x1c3111[_0xe675('0x1e')](0xcc)[_0xe675('0x1f')]();});}};}function handleEntityNotFound(_0x4ff2e3,_0x4bc714){return function(_0x5cd9b3){if(!_0x5cd9b3){_0x4ff2e3[_0xe675('0x1d')](0x194);}return _0x5cd9b3;};}function handleError(_0x52c762,_0xbac55c){_0xbac55c=_0xbac55c||0x1f4;return function(_0x3f10f8){logger[_0xe675('0x2d')](_0x3f10f8[_0xe675('0x2e')]);if(_0x3f10f8[_0xe675('0x2f')]){delete _0x3f10f8['name'];}_0x52c762[_0xe675('0x1e')](_0xbac55c)[_0xe675('0x30')](_0x3f10f8);};}exports['index']=function(_0x2edbdf,_0x7aab16){var _0x2ea21f={},_0x24ae28={},_0x573080={'count':0x0,'rows':[]};var _0x1ab62a=_['map'](db[_0xe675('0x31')][_0xe675('0x32')],function(_0x234207){return{'name':_0x234207[_0xe675('0x33')],'type':_0x234207[_0xe675('0x34')][_0xe675('0x35')]};});_0x24ae28[_0xe675('0x36')]=_[_0xe675('0x37')](_0x1ab62a,_0xe675('0x2f'));_0x24ae28[_0xe675('0x38')]=_['keys'](_0x2edbdf[_0xe675('0x38')]);_0x24ae28[_0xe675('0x39')]=_[_0xe675('0x3a')](_0x24ae28[_0xe675('0x36')],_0x24ae28['query']);_0x2ea21f['attributes']=_[_0xe675('0x3a')](_0x24ae28[_0xe675('0x36')],qs['fields'](_0x2edbdf[_0xe675('0x38')][_0xe675('0x3b')]));_0x2ea21f[_0xe675('0x3c')]=_0x2ea21f[_0xe675('0x3c')][_0xe675('0x3d')]?_0x2ea21f[_0xe675('0x3c')]:_0x24ae28['model'];if(!_0x2edbdf[_0xe675('0x38')][_0xe675('0x3e')](_0xe675('0x3f'))){_0x2ea21f[_0xe675('0x22')]=qs[_0xe675('0x22')](_0x2edbdf[_0xe675('0x38')][_0xe675('0x22')]);_0x2ea21f[_0xe675('0x20')]=qs[_0xe675('0x20')](_0x2edbdf['query'][_0xe675('0x20')]);}_0x2ea21f['order']=qs[_0xe675('0x40')](_0x2edbdf['query'][_0xe675('0x40')]);_0x2ea21f['where']=qs['filters'](_['pick'](_0x2edbdf[_0xe675('0x38')],_0x24ae28[_0xe675('0x39')]),_0x1ab62a);if(_0x2edbdf[_0xe675('0x38')][_0xe675('0x41')]){_0x2ea21f[_0xe675('0x42')]=_[_0xe675('0x43')](_0x2ea21f[_0xe675('0x42')],{'$or':_[_0xe675('0x37')](_0x1ab62a,function(_0x46ffa1){if(_0x46ffa1[_0xe675('0x34')]!=='VIRTUAL'){var _0x209621={};_0x209621[_0x46ffa1[_0xe675('0x2f')]]={'$like':'%'+_0x2edbdf[_0xe675('0x38')][_0xe675('0x41')]+'%'};return _0x209621;}})});}_0x2ea21f=_[_0xe675('0x43')]({},_0x2ea21f,_0x2edbdf[_0xe675('0x44')]);var _0x1b292c={'where':_0x2ea21f[_0xe675('0x42')]};return db[_0xe675('0x31')]['count'](_0x1b292c)[_0xe675('0x2b')](function(_0x5d0695){_0x573080['count']=_0x5d0695;if(_0x2edbdf[_0xe675('0x38')][_0xe675('0x45')]){_0x2ea21f[_0xe675('0x46')]=[{'all':!![]}];}return db[_0xe675('0x31')][_0xe675('0x47')](_0x2ea21f);})[_0xe675('0x2b')](function(_0x4e44b6){_0x573080[_0xe675('0x48')]=_0x4e44b6;return _0x573080;})[_0xe675('0x2b')](respondWithFilteredResult(_0x7aab16,_0x2ea21f))[_0xe675('0x49')](handleError(_0x7aab16,null));};exports[_0xe675('0x4a')]=function(_0x55eaea,_0x275779){var _0x812623={'raw':![],'where':{'id':_0x55eaea[_0xe675('0x4b')]['id']}},_0x71b0e3={};_0x71b0e3[_0xe675('0x36')]=_[_0xe675('0x4c')](db['SugarcrmAccount'][_0xe675('0x32')]);_0x71b0e3[_0xe675('0x38')]=_[_0xe675('0x4c')](_0x55eaea[_0xe675('0x38')]);_0x71b0e3[_0xe675('0x39')]=_[_0xe675('0x3a')](_0x71b0e3[_0xe675('0x36')],_0x71b0e3[_0xe675('0x38')]);_0x812623['attributes']=_[_0xe675('0x3a')](_0x71b0e3['model'],qs[_0xe675('0x3b')](_0x55eaea[_0xe675('0x38')][_0xe675('0x3b')]));_0x812623[_0xe675('0x3c')]=_0x812623[_0xe675('0x3c')]['length']?_0x812623[_0xe675('0x3c')]:_0x71b0e3['model'];if(_0x55eaea[_0xe675('0x38')][_0xe675('0x45')]){_0x812623[_0xe675('0x46')]=[{'all':!![]}];}_0x812623=_['merge']({},_0x812623,_0x55eaea[_0xe675('0x44')]);return db[_0xe675('0x31')][_0xe675('0x4d')](_0x812623)[_0xe675('0x2b')](handleEntityNotFound(_0x275779,null))[_0xe675('0x2b')](respondWithResult(_0x275779,null))['catch'](handleError(_0x275779,null));};exports[_0xe675('0x4e')]=function(_0xd0bd80,_0x37f031){return db[_0xe675('0x31')][_0xe675('0x4e')](_0xd0bd80[_0xe675('0x4f')],{})[_0xe675('0x2b')](respondWithResult(_0x37f031,0xc9))[_0xe675('0x49')](handleError(_0x37f031,null));};exports[_0xe675('0x2a')]=function(_0x3bced5,_0x4909b3){if(_0x3bced5['body']['id']){delete _0x3bced5[_0xe675('0x4f')]['id'];}return db[_0xe675('0x31')][_0xe675('0x4d')]({'where':{'id':_0x3bced5[_0xe675('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4909b3,null))[_0xe675('0x2b')](saveUpdates(_0x3bced5[_0xe675('0x4f')],null))[_0xe675('0x2b')](respondWithResult(_0x4909b3,null))[_0xe675('0x49')](handleError(_0x4909b3,null));};exports[_0xe675('0x2c')]=function(_0x265df1,_0x29d21d){return db[_0xe675('0x31')]['find']({'where':{'id':_0x265df1['params']['id']}})['then'](handleEntityNotFound(_0x29d21d,null))[_0xe675('0x2b')](removeEntity(_0x29d21d,null))['catch'](handleError(_0x29d21d,null));};exports[_0xe675('0x50')]=function(_0x58ad09,_0xf562b2,_0x1ed393){var _0x4f13bb={};var _0x5ad5d6={};var _0x48301c;var _0x5e0871;return db[_0xe675('0x31')][_0xe675('0x51')]({'where':{'id':_0x58ad09[_0xe675('0x4b')]['id']}})['then'](handleEntityNotFound(_0xf562b2,null))[_0xe675('0x2b')](function(_0x22e76c){if(_0x22e76c){_0x48301c=_0x22e76c;_0x5ad5d6['model']=_[_0xe675('0x4c')](db[_0xe675('0x52')]['rawAttributes']);_0x5ad5d6[_0xe675('0x38')]=_[_0xe675('0x4c')](_0x58ad09[_0xe675('0x38')]);_0x5ad5d6[_0xe675('0x39')]=_[_0xe675('0x3a')](_0x5ad5d6[_0xe675('0x36')],_0x5ad5d6[_0xe675('0x38')]);_0x4f13bb['attributes']=_['intersection'](_0x5ad5d6['model'],qs['fields'](_0x58ad09[_0xe675('0x38')]['fields']));_0x4f13bb[_0xe675('0x3c')]=_0x4f13bb[_0xe675('0x3c')][_0xe675('0x3d')]?_0x4f13bb[_0xe675('0x3c')]:_0x5ad5d6[_0xe675('0x36')];_0x4f13bb[_0xe675('0x53')]=qs[_0xe675('0x40')](_0x58ad09[_0xe675('0x38')]['sort']);_0x4f13bb[_0xe675('0x42')]=qs[_0xe675('0x39')](_[_0xe675('0x54')](_0x58ad09['query'],_0x5ad5d6[_0xe675('0x39')]));if(_0x58ad09['query']['filter']){_0x4f13bb[_0xe675('0x42')]=_[_0xe675('0x43')](_0x4f13bb[_0xe675('0x42')],{'$or':_['map'](_0x4f13bb[_0xe675('0x3c')],function(_0x393ec1){var _0x3ad73b={};_0x3ad73b[_0x393ec1]={'$like':'%'+_0x58ad09[_0xe675('0x38')]['filter']+'%'};return _0x3ad73b;})});}_0x4f13bb=_[_0xe675('0x43')]({},_0x4f13bb,_0x58ad09[_0xe675('0x44')]);return _0x48301c[_0xe675('0x50')](_0x4f13bb);}})[_0xe675('0x2b')](function(_0x446deb){if(_0x446deb){_0x5e0871=_0x446deb[_0xe675('0x3d')];if(!_0x58ad09[_0xe675('0x38')]['hasOwnProperty']('nolimit')){_0x4f13bb['limit']=qs[_0xe675('0x22')](_0x58ad09[_0xe675('0x38')][_0xe675('0x22')]);_0x4f13bb['offset']=qs[_0xe675('0x20')](_0x58ad09[_0xe675('0x38')]['offset']);}return _0x48301c[_0xe675('0x50')](_0x4f13bb);}})[_0xe675('0x2b')](function(_0x1a1a37){if(_0x1a1a37){return _0x1a1a37?{'count':_0x5e0871,'rows':_0x1a1a37}:null;}})['then'](respondWithResult(_0xf562b2,null))[_0xe675('0x49')](handleError(_0xf562b2,null));};exports[_0xe675('0x55')]=function(_0x19e2e3,_0x369d8c,_0x296fb3){if(_0x19e2e3[_0xe675('0x4f')]['id']){delete _0x19e2e3[_0xe675('0x4f')]['id'];}return db[_0xe675('0x31')][_0xe675('0x51')]({'where':{'id':_0x19e2e3['params']['id']}})[_0xe675('0x2b')](handleEntityNotFound(_0x369d8c,null))[_0xe675('0x2b')](function(_0x5a672c){if(_0x5a672c){_0x19e2e3[_0xe675('0x4f')][_0xe675('0x56')]=_0x5a672c['id'];_0x19e2e3[_0xe675('0x4f')][_0xe675('0x57')]=integrations['getSubjects'](_0x19e2e3[_0xe675('0x4f')][_0xe675('0x58')],_0x19e2e3[_0xe675('0x4f')][_0xe675('0x34')]);_0x19e2e3[_0xe675('0x4f')]['Descriptions']=integrations['getDescriptions'](_0x19e2e3[_0xe675('0x4f')][_0xe675('0x58')],_0x19e2e3['body']['type']);return db[_0xe675('0x52')][_0xe675('0x4e')](_0x19e2e3[_0xe675('0x4f')],{'include':[{'model':db[_0xe675('0x59')],'as':_0xe675('0x57')},{'model':db[_0xe675('0x59')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x369d8c,null))[_0xe675('0x49')](handleError(_0x369d8c,null));};exports[_0xe675('0x5a')]=function(_0x58300e,_0x4f42b2,_0x3c3530){var _0x4c7d25='';var _0x5290b2=['id',_0xe675('0x2f'),'assigned_user_id',_0xe675('0x5b'),'description',_0xe675('0x5c'),_0xe675('0x5d'),_0xe675('0x5e'),_0xe675('0x5f'),'parent_type',_0xe675('0x60'),_0xe675('0x61')];return db[_0xe675('0x31')]['findOne']({'where':{'id':_0x58300e[_0xe675('0x4b')]['id']},'attributes':['id','username',_0xe675('0x62'),_0xe675('0x63')]})['then'](handleEntityNotFound(_0x4f42b2,null))['then'](function(_0x6ba50c){if(_0x6ba50c){_0x4c7d25=_0x6ba50c[_0xe675('0x63')];var _0x4dc947=_0x4c7d25[_0xe675('0x64')](-0x1);if(_0x4dc947==='/'){_0x4c7d25=_0x4c7d25[_0xe675('0x65')](0x0,_0x4c7d25['lastIndexOf'](_0x4dc947));}return rp({'method':'POST','uri':util[_0xe675('0x66')]('%s%s',_0x4c7d25,_0xe675('0x67')),'json':!![],'form':{'method':_0xe675('0x68'),'input_type':_0xe675('0x69'),'response_type':_0xe675('0x69'),'rest_data':JSON[_0xe675('0x6a')]({'user_auth':{'user_name':_0x6ba50c[_0xe675('0x6b')],'password':_0x6ba50c[_0xe675('0x62')],'encryption':'PLAIN'},'application':_0xe675('0x6c')})}});}})[_0xe675('0x2b')](function(_0x301b69){if(_0x301b69&&_0x301b69[_0xe675('0x2f')]!==_0xe675('0x6d')&&_0x301b69[_0xe675('0x2f')]!==_0xe675('0x6e')){return rp({'method':'POST','uri':util[_0xe675('0x66')](_0xe675('0x6f'),_0x4c7d25,_0xe675('0x67')),'json':!![],'form':{'method':_0xe675('0x70'),'input_type':_0xe675('0x69'),'response_type':'JSON','rest_data':JSON[_0xe675('0x6a')]({'session':_0x301b69['id'],'module_name':'Calls'})}})[_0xe675('0x2b')](function(_0x502fca){if(_0x502fca){var _0x7a24d6=_['values'](_0x502fca['module_fields']);_[_0xe675('0x71')](_0x7a24d6,function(_0x3d494a){return _0x5290b2[_0xe675('0x72')](_0x3d494a[_0xe675('0x2f')]);});return{'count':_0x7a24d6[_0xe675('0x3d')],'rows':_[_0xe675('0x37')](_0x7a24d6,function(_0x373679){return{'id':_0x373679[_0xe675('0x2f')],'name':_0x373679[_0xe675('0x73')],'custom':_['endsWith'](_0x373679['name'],'_c')?!![]:![],'options':_0x373679['options']?_[_0xe675('0x37')](_[_0xe675('0x74')](_0x373679[_0xe675('0x44')]),function(_0x2612d2){return{'name':_0x2612d2[_0xe675('0x75')],'value':_0x2612d2[_0xe675('0x2f')]};}):[]};})};}})['then'](respondWithResult(_0x4f42b2,null))['catch'](function(_0x22a3a6){var _0x43979f=_0x58300e[_0xe675('0x38')][_0xe675('0x76')]?0x1f4:_0x22a3a6[_0xe675('0x77')]||0x1f4;logger[_0xe675('0x2d')](_0xe675('0x78'),_0xe675('0x5a'),_0x43979f,JSON[_0xe675('0x6a')](_0x22a3a6));delete _0x22a3a6[_0xe675('0x2f')];if(_0x43979f===0x191){_0x43979f=0x190;}_0x4f42b2[_0xe675('0x1e')](_0x43979f)[_0xe675('0x30')](_0x58300e[_0xe675('0x38')][_0xe675('0x76')]?{'message':'Wrong\x20credentials','statusCode':_0x22a3a6[_0xe675('0x77')]}:_0x22a3a6);});}else{var _0x5f39d=0x1f4;_0x4f42b2['status'](_0x5f39d)[_0xe675('0x30')]({'message':_0xe675('0x79'),'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 e42a28b..b2ac5f0 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 _0xb53e=['util','api','moment','request-promise','path','../../config/environment','./intSugarcrmAccount.attributes','define','int_sugarcrm_accounts','lodash'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xb53e,0xa9));var _0xeb53=function(_0x3a0e9b,_0x518ef1){_0x3a0e9b=_0x3a0e9b-0x0;var _0x21fb71=_0xb53e[_0x3a0e9b];return _0x21fb71;};'use strict';var _=require(_0xeb53('0x0'));var util=require(_0xeb53('0x1'));var logger=require('../../config/logger')(_0xeb53('0x2'));var moment=require(_0xeb53('0x3'));var BPromise=require('bluebird');var rp=require(_0xeb53('0x4'));var fs=require('fs');var path=require(_0xeb53('0x5'));var rimraf=require('rimraf');var config=require(_0xeb53('0x6'));var attributes=require(_0xeb53('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x40391f,_0x576ffb){return _0x40391f[_0xeb53('0x8')]('SugarcrmAccount',attributes,{'tableName':_0xeb53('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf619=['../../components/integrations/configuration','exports','define','int_sugarcrm_accounts','util','api','moment','bluebird','request-promise','../../config/environment','./intSugarcrmAccount.attributes'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0xf619,0x17a));var _0x9f61=function(_0x18b11c,_0x1a92fc){_0x18b11c=_0x18b11c-0x0;var _0x5238a7=_0xf619[_0x18b11c];return _0x5238a7;};'use strict';var _=require('lodash');var util=require(_0x9f61('0x0'));var logger=require('../../config/logger')(_0x9f61('0x1'));var moment=require(_0x9f61('0x2'));var BPromise=require(_0x9f61('0x3'));var rp=require(_0x9f61('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9f61('0x5'));var attributes=require(_0x9f61('0x6'));var integrations=require(_0x9f61('0x7'));module[_0x9f61('0x8')]=function(_0x5c2ec0,_0x3a3327){return _0x5c2ec0[_0x9f61('0x9')]('SugarcrmAccount',attributes,{'tableName':_0x9f61('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index d66bcb1..197e89a 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 _0xba88=['message','info','result','catch','GetSugarcrmAccount','SugarcrmAccount','options','raw','where','attributes','limit','include','map','model','debug','ShowSugarcrmAccount','find','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x554f1d,_0x1bdc2e){var _0x4b4da1=function(_0xdd24d9){while(--_0xdd24d9){_0x554f1d['push'](_0x554f1d['shift']());}};_0x4b4da1(++_0x1bdc2e);}(_0xba88,0x17c));var _0x8ba8=function(_0x3abd63,_0x49de10){_0x3abd63=_0x3abd63-0x0;var _0x365275=_0xba88[_0x3abd63];return _0x365275;};'use strict';var _=require('lodash');var util=require(_0x8ba8('0x0'));var moment=require('moment');var BPromise=require(_0x8ba8('0x1'));var rs=require(_0x8ba8('0x2'));var fs=require('fs');var Redis=require(_0x8ba8('0x3'));var db=require(_0x8ba8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8ba8('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8ba8('0x6'));var client=jayson[_0x8ba8('0x7')][_0x8ba8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x168ea1,_0x5e8116,_0x14aff5){return new BPromise(function(_0x2218ef,_0x9dc0fa){return client[_0x8ba8('0x9')](_0x168ea1,_0x14aff5)[_0x8ba8('0xa')](function(_0x3c11a2){logger['info'](_0x8ba8('0xb'),_0x5e8116,_0x8ba8('0xc'));logger['debug'](_0x8ba8('0xd'),_0x5e8116,'request\x20sent',JSON[_0x8ba8('0xe')](_0x3c11a2));if(_0x3c11a2[_0x8ba8('0xf')]){if(_0x3c11a2[_0x8ba8('0xf')]['code']===0x1f4){logger[_0x8ba8('0xf')](_0x8ba8('0xb'),_0x5e8116,_0x3c11a2[_0x8ba8('0xf')][_0x8ba8('0x10')]);return _0x9dc0fa(_0x3c11a2[_0x8ba8('0xf')][_0x8ba8('0x10')]);}logger['error'](_0x8ba8('0xb'),_0x5e8116,_0x3c11a2[_0x8ba8('0xf')]['message']);return _0x2218ef(_0x3c11a2[_0x8ba8('0xf')][_0x8ba8('0x10')]);}else{logger[_0x8ba8('0x11')](_0x8ba8('0xb'),_0x5e8116,_0x8ba8('0xc'));_0x2218ef(_0x3c11a2[_0x8ba8('0x12')][_0x8ba8('0x10')]);}})[_0x8ba8('0x13')](function(_0x15d1ea){logger[_0x8ba8('0xf')](_0x8ba8('0xb'),_0x5e8116,_0x15d1ea);_0x9dc0fa(_0x15d1ea);});});}exports[_0x8ba8('0x14')]=function(_0x31c3ef){var _0x347e88=this;return new Promise(function(_0x507ed7,_0x29bf14){return db[_0x8ba8('0x15')]['findAll']({'raw':_0x31c3ef[_0x8ba8('0x16')]?_0x31c3ef[_0x8ba8('0x16')][_0x8ba8('0x17')]===undefined?!![]:![]:!![],'where':_0x31c3ef[_0x8ba8('0x16')]?_0x31c3ef[_0x8ba8('0x16')][_0x8ba8('0x18')]||null:null,'attributes':_0x31c3ef['options']?_0x31c3ef['options'][_0x8ba8('0x19')]||null:null,'limit':_0x31c3ef[_0x8ba8('0x16')]?_0x31c3ef[_0x8ba8('0x16')][_0x8ba8('0x1a')]||null:null,'include':_0x31c3ef[_0x8ba8('0x16')]?_0x31c3ef[_0x8ba8('0x16')][_0x8ba8('0x1b')]?_[_0x8ba8('0x1c')](_0x31c3ef['options'][_0x8ba8('0x1b')],function(_0x14193b){return{'model':db[_0x14193b[_0x8ba8('0x1d')]],'as':_0x14193b['as'],'attributes':_0x14193b[_0x8ba8('0x19')],'include':_0x14193b[_0x8ba8('0x1b')]?_['map'](_0x14193b[_0x8ba8('0x1b')],function(_0x2b63b6){return{'model':db[_0x2b63b6[_0x8ba8('0x1d')]],'as':_0x2b63b6['as'],'attributes':_0x2b63b6['attributes'],'include':_0x2b63b6[_0x8ba8('0x1b')]?_[_0x8ba8('0x1c')](_0x2b63b6[_0x8ba8('0x1b')],function(_0x1421fd){return{'model':db[_0x1421fd[_0x8ba8('0x1d')]],'as':_0x1421fd['as'],'attributes':_0x1421fd[_0x8ba8('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8ba8('0xa')](function(_0x3d62ec){logger['info'](_0x8ba8('0x14'),_0x31c3ef);logger[_0x8ba8('0x1e')]('GetSugarcrmAccount',_0x31c3ef,JSON[_0x8ba8('0xe')](_0x3d62ec));_0x507ed7(_0x3d62ec);})['catch'](function(_0x58df2b){logger[_0x8ba8('0xf')](_0x8ba8('0x14'),_0x58df2b[_0x8ba8('0x10')],_0x31c3ef);_0x29bf14(_0x347e88['error'](0x1f4,_0x58df2b[_0x8ba8('0x10')]));});});};exports[_0x8ba8('0x1f')]=function(_0x2bb186){var _0x4bb058=this;return new Promise(function(_0x48575b,_0x4fd894){return db[_0x8ba8('0x15')][_0x8ba8('0x20')]({'raw':_0x2bb186['options']?_0x2bb186['options']['raw']===undefined?!![]:![]:!![],'where':_0x2bb186[_0x8ba8('0x16')]?_0x2bb186[_0x8ba8('0x16')][_0x8ba8('0x18')]||null:null,'attributes':_0x2bb186['options']?_0x2bb186[_0x8ba8('0x16')]['attributes']||null:null,'include':_0x2bb186[_0x8ba8('0x16')]?_0x2bb186[_0x8ba8('0x16')]['include']?_[_0x8ba8('0x1c')](_0x2bb186[_0x8ba8('0x16')][_0x8ba8('0x1b')],function(_0xbe9090){return{'model':db[_0xbe9090[_0x8ba8('0x1d')]],'as':_0xbe9090['as'],'attributes':_0xbe9090[_0x8ba8('0x19')],'include':_0xbe9090[_0x8ba8('0x1b')]?_[_0x8ba8('0x1c')](_0xbe9090[_0x8ba8('0x1b')],function(_0x4fc71f){return{'model':db[_0x4fc71f[_0x8ba8('0x1d')]],'as':_0x4fc71f['as'],'attributes':_0x4fc71f['attributes'],'include':_0x4fc71f[_0x8ba8('0x1b')]?_[_0x8ba8('0x1c')](_0x4fc71f[_0x8ba8('0x1b')],function(_0x450932){return{'model':db[_0x450932[_0x8ba8('0x1d')]],'as':_0x450932['as'],'attributes':_0x450932[_0x8ba8('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8ba8('0xa')](function(_0x3259cf){logger[_0x8ba8('0x11')](_0x8ba8('0x1f'),_0x2bb186);logger[_0x8ba8('0x1e')](_0x8ba8('0x1f'),_0x2bb186,JSON['stringify'](_0x3259cf));_0x48575b(_0x3259cf);})[_0x8ba8('0x13')](function(_0x41c2cf){logger['error'](_0x8ba8('0x1f'),_0x41c2cf[_0x8ba8('0x10')],_0x2bb186);_0x4fd894(_0x4bb058[_0x8ba8('0xf')](0x1f4,_0x41c2cf['message']));});});}; \ No newline at end of file +var _0xaac4=['message','result','catch','findAll','options','raw','attributes','limit','include','map','model','GetSugarcrmAccount','ShowSugarcrmAccount','SugarcrmAccount','find','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x216f98,_0x470c7f){var _0xea6b36=function(_0x38f18c){while(--_0x38f18c){_0x216f98['push'](_0x216f98['shift']());}};_0xea6b36(++_0x470c7f);}(_0xaac4,0x140));var _0x4aac=function(_0x225bbd,_0x378910){_0x225bbd=_0x225bbd-0x0;var _0x44fd36=_0xaac4[_0x225bbd];return _0x44fd36;};'use strict';var _=require(_0x4aac('0x0'));var util=require(_0x4aac('0x1'));var moment=require(_0x4aac('0x2'));var BPromise=require('bluebird');var rs=require(_0x4aac('0x3'));var fs=require('fs');var Redis=require(_0x4aac('0x4'));var db=require(_0x4aac('0x5'))['db'];var utils=require(_0x4aac('0x6'));var logger=require(_0x4aac('0x7'))(_0x4aac('0x8'));var config=require(_0x4aac('0x9'));var jayson=require(_0x4aac('0xa'));var client=jayson[_0x4aac('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbc1ab7,_0x4115a7,_0x41353a){return new BPromise(function(_0x324113,_0x173359){return client[_0x4aac('0xc')](_0xbc1ab7,_0x41353a)[_0x4aac('0xd')](function(_0x4a403b){logger[_0x4aac('0xe')](_0x4aac('0xf'),_0x4115a7,_0x4aac('0x10'));logger[_0x4aac('0x11')](_0x4aac('0x12'),_0x4115a7,'request\x20sent',JSON[_0x4aac('0x13')](_0x4a403b));if(_0x4a403b[_0x4aac('0x14')]){if(_0x4a403b[_0x4aac('0x14')][_0x4aac('0x15')]===0x1f4){logger[_0x4aac('0x14')](_0x4aac('0xf'),_0x4115a7,_0x4a403b[_0x4aac('0x14')][_0x4aac('0x16')]);return _0x173359(_0x4a403b[_0x4aac('0x14')][_0x4aac('0x16')]);}logger[_0x4aac('0x14')](_0x4aac('0xf'),_0x4115a7,_0x4a403b[_0x4aac('0x14')][_0x4aac('0x16')]);return _0x324113(_0x4a403b[_0x4aac('0x14')][_0x4aac('0x16')]);}else{logger[_0x4aac('0xe')](_0x4aac('0xf'),_0x4115a7,_0x4aac('0x10'));_0x324113(_0x4a403b[_0x4aac('0x17')][_0x4aac('0x16')]);}})[_0x4aac('0x18')](function(_0x2337f8){logger['error'](_0x4aac('0xf'),_0x4115a7,_0x2337f8);_0x173359(_0x2337f8);});});}exports['GetSugarcrmAccount']=function(_0x9e82eb){var _0x4182d8=this;return new Promise(function(_0x30f222,_0x3d9736){return db['SugarcrmAccount'][_0x4aac('0x19')]({'raw':_0x9e82eb[_0x4aac('0x1a')]?_0x9e82eb['options'][_0x4aac('0x1b')]===undefined?!![]:![]:!![],'where':_0x9e82eb[_0x4aac('0x1a')]?_0x9e82eb[_0x4aac('0x1a')]['where']||null:null,'attributes':_0x9e82eb['options']?_0x9e82eb[_0x4aac('0x1a')][_0x4aac('0x1c')]||null:null,'limit':_0x9e82eb[_0x4aac('0x1a')]?_0x9e82eb[_0x4aac('0x1a')][_0x4aac('0x1d')]||null:null,'include':_0x9e82eb[_0x4aac('0x1a')]?_0x9e82eb['options'][_0x4aac('0x1e')]?_[_0x4aac('0x1f')](_0x9e82eb[_0x4aac('0x1a')][_0x4aac('0x1e')],function(_0x4d98de){return{'model':db[_0x4d98de[_0x4aac('0x20')]],'as':_0x4d98de['as'],'attributes':_0x4d98de[_0x4aac('0x1c')],'include':_0x4d98de[_0x4aac('0x1e')]?_[_0x4aac('0x1f')](_0x4d98de[_0x4aac('0x1e')],function(_0x448eb8){return{'model':db[_0x448eb8[_0x4aac('0x20')]],'as':_0x448eb8['as'],'attributes':_0x448eb8[_0x4aac('0x1c')],'include':_0x448eb8['include']?_[_0x4aac('0x1f')](_0x448eb8[_0x4aac('0x1e')],function(_0x165df0){return{'model':db[_0x165df0[_0x4aac('0x20')]],'as':_0x165df0['as'],'attributes':_0x165df0[_0x4aac('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4aac('0xd')](function(_0x4d2789){logger[_0x4aac('0xe')]('GetSugarcrmAccount',_0x9e82eb);logger[_0x4aac('0x11')](_0x4aac('0x21'),_0x9e82eb,JSON[_0x4aac('0x13')](_0x4d2789));_0x30f222(_0x4d2789);})[_0x4aac('0x18')](function(_0x150d22){logger['error'](_0x4aac('0x21'),_0x150d22[_0x4aac('0x16')],_0x9e82eb);_0x3d9736(_0x4182d8[_0x4aac('0x14')](0x1f4,_0x150d22[_0x4aac('0x16')]));});});};exports[_0x4aac('0x22')]=function(_0x2199f1){var _0x48d6ec=this;return new Promise(function(_0x1aa86f,_0x45aedf){return db[_0x4aac('0x23')][_0x4aac('0x24')]({'raw':_0x2199f1[_0x4aac('0x1a')]?_0x2199f1[_0x4aac('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2199f1['options']?_0x2199f1[_0x4aac('0x1a')][_0x4aac('0x25')]||null:null,'attributes':_0x2199f1[_0x4aac('0x1a')]?_0x2199f1[_0x4aac('0x1a')][_0x4aac('0x1c')]||null:null,'include':_0x2199f1[_0x4aac('0x1a')]?_0x2199f1[_0x4aac('0x1a')][_0x4aac('0x1e')]?_[_0x4aac('0x1f')](_0x2199f1['options']['include'],function(_0x3bdfac){return{'model':db[_0x3bdfac['model']],'as':_0x3bdfac['as'],'attributes':_0x3bdfac[_0x4aac('0x1c')],'include':_0x3bdfac[_0x4aac('0x1e')]?_[_0x4aac('0x1f')](_0x3bdfac['include'],function(_0x90987d){return{'model':db[_0x90987d[_0x4aac('0x20')]],'as':_0x90987d['as'],'attributes':_0x90987d[_0x4aac('0x1c')],'include':_0x90987d[_0x4aac('0x1e')]?_[_0x4aac('0x1f')](_0x90987d[_0x4aac('0x1e')],function(_0x10b0f8){return{'model':db[_0x10b0f8['model']],'as':_0x10b0f8['as'],'attributes':_0x10b0f8[_0x4aac('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4aac('0xd')](function(_0x4fd301){logger[_0x4aac('0xe')]('ShowSugarcrmAccount',_0x2199f1);logger[_0x4aac('0x11')]('ShowSugarcrmAccount',_0x2199f1,JSON[_0x4aac('0x13')](_0x4fd301));_0x1aa86f(_0x4fd301);})['catch'](function(_0x500e24){logger['error']('ShowSugarcrmAccount',_0x500e24[_0x4aac('0x16')],_0x2199f1);_0x45aedf(_0x48d6ec[_0x4aac('0x14')](0x1f4,_0x500e24[_0x4aac('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index eb1baa3..686a736 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 _0x9ab1=['destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','create','update','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9ab1,0x1cf));var _0x19ab=function(_0x42f803,_0x3d1284){_0x42f803=_0x42f803-0x0;var _0x5b04e5=_0x9ab1[_0x42f803];return _0x5b04e5;};'use strict';var multer=require('multer');var util=require(_0x19ab('0x0'));var path=require(_0x19ab('0x1'));var timeout=require(_0x19ab('0x2'));var express=require('express');var router=express[_0x19ab('0x3')]();var fs_extra=require(_0x19ab('0x4'));var auth=require(_0x19ab('0x5'));var interaction=require(_0x19ab('0x6'));var config=require(_0x19ab('0x7'));var controller=require(_0x19ab('0x8'));router[_0x19ab('0x9')]('/',auth[_0x19ab('0xa')](),controller[_0x19ab('0xb')]);router['get'](_0x19ab('0xc'),auth[_0x19ab('0xa')](),controller[_0x19ab('0xd')]);router[_0x19ab('0x9')]('/:id/fields',auth[_0x19ab('0xa')](),controller['getFields']);router[_0x19ab('0x9')](_0x19ab('0xe'),auth[_0x19ab('0xa')](),controller[_0x19ab('0xf')]);router[_0x19ab('0x9')](_0x19ab('0x10'),auth[_0x19ab('0xa')](),controller['getDescriptions']);router['post']('/',auth['isAuthenticated'](),controller[_0x19ab('0x11')]);router['put'](_0x19ab('0xc'),auth['isAuthenticated'](),controller[_0x19ab('0x12')]);router[_0x19ab('0x13')]('/:id',auth[_0x19ab('0xa')](),controller[_0x19ab('0x14')]);module['exports']=router; \ No newline at end of file +var _0x5743=['../../components/interaction/service','./intSugarcrmConfiguration.controller','get','index','/:id','isAuthenticated','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x1ce337,_0x2e7814){var _0x157500=function(_0x4e4486){while(--_0x4e4486){_0x1ce337['push'](_0x1ce337['shift']());}};_0x157500(++_0x2e7814);}(_0x5743,0x118));var _0x3574=function(_0x124ded,_0x2554aa){_0x124ded=_0x124ded-0x0;var _0x44ba2d=_0x5743[_0x124ded];return _0x44ba2d;};'use strict';var multer=require(_0x3574('0x0'));var util=require(_0x3574('0x1'));var path=require(_0x3574('0x2'));var timeout=require(_0x3574('0x3'));var express=require('express');var router=express[_0x3574('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3574('0x5'));var interaction=require(_0x3574('0x6'));var config=require('../../config/environment');var controller=require(_0x3574('0x7'));router[_0x3574('0x8')]('/',auth['isAuthenticated'](),controller[_0x3574('0x9')]);router[_0x3574('0x8')](_0x3574('0xa'),auth[_0x3574('0xb')](),controller['show']);router['get']('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x3574('0x8')](_0x3574('0xc'),auth[_0x3574('0xb')](),controller[_0x3574('0xd')]);router[_0x3574('0x8')]('/:id/descriptions',auth[_0x3574('0xb')](),controller[_0x3574('0xe')]);router[_0x3574('0xf')]('/',auth[_0x3574('0xb')](),controller[_0x3574('0x10')]);router[_0x3574('0x11')](_0x3574('0xa'),auth[_0x3574('0xb')](),controller[_0x3574('0x12')]);router[_0x3574('0x13')]('/:id',auth[_0x3574('0xb')](),controller[_0x3574('0x14')]);module[_0x3574('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 aa89d28..4894a03 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 _0xfa8c=['sequelize','exports','STRING'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xfa8c,0xae));var _0xcfa8=function(_0x4dfae1,_0x47dad6){_0x4dfae1=_0x4dfae1-0x0;var _0xd0eabd=_0xfa8c[_0x4dfae1];return _0xd0eabd;};'use strict';var Sequelize=require(_0xcfa8('0x0'));module[_0xcfa8('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xcfa8('0x2')]}}; \ No newline at end of file +var _0x9d28=['sequelize','exports','STRING'];(function(_0x113e32,_0x5339f0){var _0x4ff939=function(_0x2be9ca){while(--_0x2be9ca){_0x113e32['push'](_0x113e32['shift']());}};_0x4ff939(++_0x5339f0);}(_0x9d28,0x1e9));var _0x89d2=function(_0x367c8e,_0x3a6502){_0x367c8e=_0x367c8e-0x0;var _0x1c2789=_0x9d28[_0x367c8e];return _0x1c2789;};'use strict';var Sequelize=require(_0x89d2('0x0'));module[_0x89d2('0x1')]={'name':{'type':Sequelize[_0x89d2('0x2')]},'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 c65ed1a..2deee4e 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 _0xea93=['fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','findOne','SugarcrmField','getSubjects','nolimit','getDescriptions','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','SugarcrmConfiguration','rawAttributes','fieldName','model','map','keys','query','filters','intersection','attributes'];(function(_0x388554,_0x2f66c2){var _0x53d686=function(_0x1d2305){while(--_0x1d2305){_0x388554['push'](_0x388554['shift']());}};_0x53d686(++_0x2f66c2);}(_0xea93,0x154));var _0x3ea9=function(_0x337748,_0x402b05){_0x337748=_0x337748-0x0;var _0x3bb03f=_0xea93[_0x337748];return _0x3bb03f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3ea9('0x0'));var rp=require(_0x3ea9('0x1'));var moment=require('moment');var BPromise=require(_0x3ea9('0x2'));var Mustache=require(_0x3ea9('0x3'));var util=require(_0x3ea9('0x4'));var path=require(_0x3ea9('0x5'));var sox=require('sox');var csv=require(_0x3ea9('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3ea9('0x7'));var _=require(_0x3ea9('0x8'));var squel=require(_0x3ea9('0x9'));var crypto=require(_0x3ea9('0xa'));var jsforce=require(_0x3ea9('0xb'));var deskjs=require(_0x3ea9('0xc'));var toCsv=require(_0x3ea9('0x6'));var querystring=require(_0x3ea9('0xd'));var Papa=require(_0x3ea9('0xe'));var Redis=require(_0x3ea9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3ea9('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3ea9('0x11'))('api');var utils=require(_0x3ea9('0x12'));var config=require(_0x3ea9('0x13'));var licenseUtil=require(_0x3ea9('0x14'));var db=require(_0x3ea9('0x15'))['db'];function respondWithStatusCode(_0x3d64aa,_0x2b4e42){_0x2b4e42=_0x2b4e42||0xcc;return function(_0x5a0a53){if(_0x5a0a53){return _0x3d64aa['sendStatus'](_0x2b4e42);}return _0x3d64aa[_0x3ea9('0x16')](_0x2b4e42)[_0x3ea9('0x17')]();};}function respondWithResult(_0xb44ff8,_0x351eee){_0x351eee=_0x351eee||0xc8;return function(_0x549334){if(_0x549334){return _0xb44ff8[_0x3ea9('0x16')](_0x351eee)[_0x3ea9('0x18')](_0x549334);}};}function respondWithFilteredResult(_0x345a31,_0x3b25d3){return function(_0x4c14c2){if(_0x4c14c2){var _0x3d03c0=typeof _0x3b25d3[_0x3ea9('0x19')]===_0x3ea9('0x1a')&&typeof _0x3b25d3['limit']===_0x3ea9('0x1a');var _0x440bc9=_0x4c14c2[_0x3ea9('0x1b')];var _0x49f649=_0x3d03c0?0x0:_0x3b25d3['offset'];var _0x4dfccd=_0x3d03c0?_0x4c14c2[_0x3ea9('0x1b')]:_0x3b25d3[_0x3ea9('0x19')]+_0x3b25d3[_0x3ea9('0x1c')];var _0x3f1658;if(_0x4dfccd>=_0x440bc9){_0x4dfccd=_0x440bc9;_0x3f1658=0xc8;}else{_0x3f1658=0xce;}_0x345a31[_0x3ea9('0x16')](_0x3f1658);return _0x345a31['set']('Content-Range',_0x49f649+'-'+_0x4dfccd+'/'+_0x440bc9)['json'](_0x4c14c2);}return null;};}function patchUpdates(_0x1f9733){return function(_0x4037ca){try{jsonpatch[_0x3ea9('0x1d')](_0x4037ca,_0x1f9733,!![]);}catch(_0x5df741){return BPromise[_0x3ea9('0x1e')](_0x5df741);}return _0x4037ca['save']();};}function saveUpdates(_0x3c7daa,_0x1570bb){return function(_0x376340){if(_0x376340){return _0x376340[_0x3ea9('0x1f')](_0x3c7daa)[_0x3ea9('0x20')](function(_0x3ec257){return _0x3ec257;});}return null;};}function removeEntity(_0x37fa3e,_0x305a0d){return function(_0x290c1f){if(_0x290c1f){return _0x290c1f[_0x3ea9('0x21')]()[_0x3ea9('0x20')](function(){_0x37fa3e[_0x3ea9('0x16')](0xcc)[_0x3ea9('0x17')]();});}};}function handleEntityNotFound(_0x58cd56,_0x512000){return function(_0x413ae5){if(!_0x413ae5){_0x58cd56[_0x3ea9('0x22')](0x194);}return _0x413ae5;};}function handleError(_0x57188a,_0x7121b8){_0x7121b8=_0x7121b8||0x1f4;return function(_0x343e4a){logger[_0x3ea9('0x23')](_0x343e4a[_0x3ea9('0x24')]);if(_0x343e4a[_0x3ea9('0x25')]){delete _0x343e4a[_0x3ea9('0x25')];}_0x57188a[_0x3ea9('0x16')](_0x7121b8)[_0x3ea9('0x26')](_0x343e4a);};}exports[_0x3ea9('0x27')]=function(_0x33d713,_0x480915){var _0x5338bf={},_0x505d12={},_0x47220f={'count':0x0,'rows':[]};var _0x4b380b=_['map'](db[_0x3ea9('0x28')][_0x3ea9('0x29')],function(_0x4381a7){return{'name':_0x4381a7[_0x3ea9('0x2a')],'type':_0x4381a7['type']['key']};});_0x505d12[_0x3ea9('0x2b')]=_[_0x3ea9('0x2c')](_0x4b380b,'name');_0x505d12['query']=_[_0x3ea9('0x2d')](_0x33d713[_0x3ea9('0x2e')]);_0x505d12[_0x3ea9('0x2f')]=_[_0x3ea9('0x30')](_0x505d12[_0x3ea9('0x2b')],_0x505d12[_0x3ea9('0x2e')]);_0x5338bf[_0x3ea9('0x31')]=_[_0x3ea9('0x30')](_0x505d12[_0x3ea9('0x2b')],qs[_0x3ea9('0x32')](_0x33d713['query'][_0x3ea9('0x32')]));_0x5338bf[_0x3ea9('0x31')]=_0x5338bf['attributes'][_0x3ea9('0x33')]?_0x5338bf['attributes']:_0x505d12[_0x3ea9('0x2b')];if(!_0x33d713[_0x3ea9('0x2e')][_0x3ea9('0x34')]('nolimit')){_0x5338bf[_0x3ea9('0x1c')]=qs['limit'](_0x33d713[_0x3ea9('0x2e')]['limit']);_0x5338bf[_0x3ea9('0x19')]=qs[_0x3ea9('0x19')](_0x33d713[_0x3ea9('0x2e')]['offset']);}_0x5338bf[_0x3ea9('0x35')]=qs[_0x3ea9('0x36')](_0x33d713[_0x3ea9('0x2e')]['sort']);_0x5338bf['where']=qs[_0x3ea9('0x2f')](_[_0x3ea9('0x37')](_0x33d713['query'],_0x505d12[_0x3ea9('0x2f')]),_0x4b380b);if(_0x33d713[_0x3ea9('0x2e')][_0x3ea9('0x38')]){_0x5338bf[_0x3ea9('0x39')]=_[_0x3ea9('0x3a')](_0x5338bf[_0x3ea9('0x39')],{'$or':_['map'](_0x4b380b,function(_0x2a626c){if(_0x2a626c[_0x3ea9('0x3b')]!==_0x3ea9('0x3c')){var _0x313d63={};_0x313d63[_0x2a626c[_0x3ea9('0x25')]]={'$like':'%'+_0x33d713['query'][_0x3ea9('0x38')]+'%'};return _0x313d63;}})});}_0x5338bf=_['merge']({},_0x5338bf,_0x33d713[_0x3ea9('0x3d')]);var _0x2c1d7d={'where':_0x5338bf[_0x3ea9('0x39')]};return db[_0x3ea9('0x28')]['count'](_0x2c1d7d)['then'](function(_0x373084){_0x47220f[_0x3ea9('0x1b')]=_0x373084;if(_0x33d713[_0x3ea9('0x2e')][_0x3ea9('0x3e')]){_0x5338bf[_0x3ea9('0x3f')]=[{'all':!![]}];}return db[_0x3ea9('0x28')][_0x3ea9('0x40')](_0x5338bf);})['then'](function(_0x2437a){_0x47220f[_0x3ea9('0x41')]=_0x2437a;return _0x47220f;})[_0x3ea9('0x20')](respondWithFilteredResult(_0x480915,_0x5338bf))[_0x3ea9('0x42')](handleError(_0x480915,null));};exports[_0x3ea9('0x43')]=function(_0x2fbc2a,_0x4d3453){var _0x4797e5={'raw':![],'where':{'id':_0x2fbc2a[_0x3ea9('0x44')]['id']}},_0x30837a={};_0x30837a[_0x3ea9('0x2b')]=_['keys'](db['SugarcrmConfiguration'][_0x3ea9('0x29')]);_0x30837a[_0x3ea9('0x2e')]=_[_0x3ea9('0x2d')](_0x2fbc2a[_0x3ea9('0x2e')]);_0x30837a[_0x3ea9('0x2f')]=_[_0x3ea9('0x30')](_0x30837a['model'],_0x30837a[_0x3ea9('0x2e')]);_0x4797e5[_0x3ea9('0x31')]=_[_0x3ea9('0x30')](_0x30837a[_0x3ea9('0x2b')],qs[_0x3ea9('0x32')](_0x2fbc2a[_0x3ea9('0x2e')][_0x3ea9('0x32')]));_0x4797e5['attributes']=_0x4797e5[_0x3ea9('0x31')]['length']?_0x4797e5[_0x3ea9('0x31')]:_0x30837a[_0x3ea9('0x2b')];if(_0x2fbc2a['query']['includeAll']){_0x4797e5[_0x3ea9('0x3f')]=[{'all':!![]}];}_0x4797e5=_[_0x3ea9('0x3a')]({},_0x4797e5,_0x2fbc2a[_0x3ea9('0x3d')]);return db[_0x3ea9('0x28')][_0x3ea9('0x45')](_0x4797e5)[_0x3ea9('0x20')](handleEntityNotFound(_0x4d3453,null))['then'](respondWithResult(_0x4d3453,null))[_0x3ea9('0x42')](handleError(_0x4d3453,null));};exports[_0x3ea9('0x46')]=function(_0x29dbd7,_0x5a3f15){return db['SugarcrmConfiguration']['create'](_0x29dbd7['body'],{})[_0x3ea9('0x20')](respondWithResult(_0x5a3f15,0xc9))['catch'](handleError(_0x5a3f15,null));};exports[_0x3ea9('0x1f')]=function(_0x4f7978,_0x4c6686){if(_0x4f7978[_0x3ea9('0x47')]['id']){delete _0x4f7978['body']['id'];}return db[_0x3ea9('0x28')][_0x3ea9('0x45')]({'where':{'id':_0x4f7978[_0x3ea9('0x44')]['id']}})[_0x3ea9('0x20')](handleEntityNotFound(_0x4c6686,null))['then'](saveUpdates(_0x4f7978['body'],null))[_0x3ea9('0x20')](respondWithResult(_0x4c6686,null))[_0x3ea9('0x42')](handleError(_0x4c6686,null));};exports[_0x3ea9('0x21')]=function(_0x3d31b2,_0x5abbe5){return db['SugarcrmConfiguration']['find']({'where':{'id':_0x3d31b2[_0x3ea9('0x44')]['id']}})[_0x3ea9('0x20')](handleEntityNotFound(_0x5abbe5,null))['then'](removeEntity(_0x5abbe5,null))[_0x3ea9('0x42')](handleError(_0x5abbe5,null));};exports[_0x3ea9('0x48')]=function(_0x3f666d,_0x56731d,_0x43c9e3){var _0x270422={};var _0x5209c2={};var _0x40c1b7;var _0x2df6c0;return db[_0x3ea9('0x28')][_0x3ea9('0x49')]({'where':{'id':_0x3f666d[_0x3ea9('0x44')]['id']}})['then'](handleEntityNotFound(_0x56731d,null))['then'](function(_0x302231){if(_0x302231){_0x40c1b7=_0x302231;_0x5209c2['model']=_[_0x3ea9('0x2d')](db[_0x3ea9('0x4a')]['rawAttributes']);_0x5209c2[_0x3ea9('0x2e')]=_[_0x3ea9('0x2d')](_0x3f666d[_0x3ea9('0x2e')]);_0x5209c2[_0x3ea9('0x2f')]=_[_0x3ea9('0x30')](_0x5209c2[_0x3ea9('0x2b')],_0x5209c2[_0x3ea9('0x2e')]);_0x270422['attributes']=_['intersection'](_0x5209c2[_0x3ea9('0x2b')],qs[_0x3ea9('0x32')](_0x3f666d['query'][_0x3ea9('0x32')]));_0x270422['attributes']=_0x270422[_0x3ea9('0x31')][_0x3ea9('0x33')]?_0x270422['attributes']:_0x5209c2['model'];_0x270422[_0x3ea9('0x35')]=qs['sort'](_0x3f666d[_0x3ea9('0x2e')][_0x3ea9('0x36')]);_0x270422[_0x3ea9('0x39')]=qs[_0x3ea9('0x2f')](_[_0x3ea9('0x37')](_0x3f666d[_0x3ea9('0x2e')],_0x5209c2[_0x3ea9('0x2f')]));if(_0x3f666d['query'][_0x3ea9('0x38')]){_0x270422['where']=_[_0x3ea9('0x3a')](_0x270422[_0x3ea9('0x39')],{'$or':_[_0x3ea9('0x2c')](_0x270422[_0x3ea9('0x31')],function(_0xa90de9){var _0x24504b={};_0x24504b[_0xa90de9]={'$like':'%'+_0x3f666d[_0x3ea9('0x2e')][_0x3ea9('0x38')]+'%'};return _0x24504b;})});}_0x270422=_[_0x3ea9('0x3a')]({},_0x270422,_0x3f666d['options']);return _0x40c1b7[_0x3ea9('0x48')](_0x270422);}})[_0x3ea9('0x20')](function(_0x329d64){if(_0x329d64){_0x2df6c0=_0x329d64[_0x3ea9('0x33')];if(!_0x3f666d['query'][_0x3ea9('0x34')]('nolimit')){_0x270422[_0x3ea9('0x1c')]=qs['limit'](_0x3f666d['query'][_0x3ea9('0x1c')]);_0x270422['offset']=qs[_0x3ea9('0x19')](_0x3f666d[_0x3ea9('0x2e')][_0x3ea9('0x19')]);}return _0x40c1b7[_0x3ea9('0x48')](_0x270422);}})['then'](function(_0x30bf85){if(_0x30bf85){return _0x30bf85?{'count':_0x2df6c0,'rows':_0x30bf85}:null;}})[_0x3ea9('0x20')](respondWithResult(_0x56731d,null))[_0x3ea9('0x42')](handleError(_0x56731d,null));};exports[_0x3ea9('0x4b')]=function(_0x58ab9d,_0x7fbb89,_0x348797){var _0xb60373={};var _0x4da018={};var _0x2cba26;var _0x4bb9f0;return db[_0x3ea9('0x28')][_0x3ea9('0x49')]({'where':{'id':_0x58ab9d['params']['id']}})[_0x3ea9('0x20')](handleEntityNotFound(_0x7fbb89,null))[_0x3ea9('0x20')](function(_0x28ab2f){if(_0x28ab2f){_0x2cba26=_0x28ab2f;_0x4da018['model']=_[_0x3ea9('0x2d')](db[_0x3ea9('0x4a')][_0x3ea9('0x29')]);_0x4da018['query']=_['keys'](_0x58ab9d[_0x3ea9('0x2e')]);_0x4da018['filters']=_[_0x3ea9('0x30')](_0x4da018[_0x3ea9('0x2b')],_0x4da018[_0x3ea9('0x2e')]);_0xb60373[_0x3ea9('0x31')]=_[_0x3ea9('0x30')](_0x4da018[_0x3ea9('0x2b')],qs['fields'](_0x58ab9d['query'][_0x3ea9('0x32')]));_0xb60373[_0x3ea9('0x31')]=_0xb60373[_0x3ea9('0x31')][_0x3ea9('0x33')]?_0xb60373[_0x3ea9('0x31')]:_0x4da018[_0x3ea9('0x2b')];_0xb60373[_0x3ea9('0x35')]=qs[_0x3ea9('0x36')](_0x58ab9d[_0x3ea9('0x2e')]['sort']);_0xb60373[_0x3ea9('0x39')]=qs[_0x3ea9('0x2f')](_[_0x3ea9('0x37')](_0x58ab9d['query'],_0x4da018[_0x3ea9('0x2f')]));if(_0x58ab9d[_0x3ea9('0x2e')]['filter']){_0xb60373['where']=_[_0x3ea9('0x3a')](_0xb60373[_0x3ea9('0x39')],{'$or':_[_0x3ea9('0x2c')](_0xb60373[_0x3ea9('0x31')],function(_0x4fdc30){var _0x40efb2={};_0x40efb2[_0x4fdc30]={'$like':'%'+_0x58ab9d[_0x3ea9('0x2e')][_0x3ea9('0x38')]+'%'};return _0x40efb2;})});}_0xb60373=_[_0x3ea9('0x3a')]({},_0xb60373,_0x58ab9d['options']);return _0x2cba26[_0x3ea9('0x4b')](_0xb60373);}})[_0x3ea9('0x20')](function(_0x2f410f){if(_0x2f410f){_0x4bb9f0=_0x2f410f[_0x3ea9('0x33')];if(!_0x58ab9d[_0x3ea9('0x2e')][_0x3ea9('0x34')](_0x3ea9('0x4c'))){_0xb60373['limit']=qs[_0x3ea9('0x1c')](_0x58ab9d[_0x3ea9('0x2e')][_0x3ea9('0x1c')]);_0xb60373[_0x3ea9('0x19')]=qs[_0x3ea9('0x19')](_0x58ab9d[_0x3ea9('0x2e')]['offset']);}return _0x2cba26['getSubjects'](_0xb60373);}})['then'](function(_0x56756b){if(_0x56756b){return _0x56756b?{'count':_0x4bb9f0,'rows':_0x56756b}:null;}})[_0x3ea9('0x20')](respondWithResult(_0x7fbb89,null))[_0x3ea9('0x42')](handleError(_0x7fbb89,null));};exports[_0x3ea9('0x4d')]=function(_0x9102fe,_0xa47c42,_0x392806){var _0x28ba4d={};var _0x36ccc4={};var _0x3b593c;var _0x4b4c08;return db[_0x3ea9('0x28')][_0x3ea9('0x49')]({'where':{'id':_0x9102fe['params']['id']}})['then'](handleEntityNotFound(_0xa47c42,null))[_0x3ea9('0x20')](function(_0x2c5189){if(_0x2c5189){_0x3b593c=_0x2c5189;_0x36ccc4[_0x3ea9('0x2b')]=_[_0x3ea9('0x2d')](db[_0x3ea9('0x4a')][_0x3ea9('0x29')]);_0x36ccc4[_0x3ea9('0x2e')]=_[_0x3ea9('0x2d')](_0x9102fe[_0x3ea9('0x2e')]);_0x36ccc4[_0x3ea9('0x2f')]=_['intersection'](_0x36ccc4[_0x3ea9('0x2b')],_0x36ccc4[_0x3ea9('0x2e')]);_0x28ba4d['attributes']=_['intersection'](_0x36ccc4['model'],qs[_0x3ea9('0x32')](_0x9102fe[_0x3ea9('0x2e')][_0x3ea9('0x32')]));_0x28ba4d[_0x3ea9('0x31')]=_0x28ba4d['attributes']['length']?_0x28ba4d[_0x3ea9('0x31')]:_0x36ccc4[_0x3ea9('0x2b')];_0x28ba4d[_0x3ea9('0x35')]=qs[_0x3ea9('0x36')](_0x9102fe[_0x3ea9('0x2e')][_0x3ea9('0x36')]);_0x28ba4d[_0x3ea9('0x39')]=qs[_0x3ea9('0x2f')](_[_0x3ea9('0x37')](_0x9102fe['query'],_0x36ccc4[_0x3ea9('0x2f')]));if(_0x9102fe['query'][_0x3ea9('0x38')]){_0x28ba4d[_0x3ea9('0x39')]=_[_0x3ea9('0x3a')](_0x28ba4d['where'],{'$or':_[_0x3ea9('0x2c')](_0x28ba4d[_0x3ea9('0x31')],function(_0x123c72){var _0xa80de={};_0xa80de[_0x123c72]={'$like':'%'+_0x9102fe[_0x3ea9('0x2e')]['filter']+'%'};return _0xa80de;})});}_0x28ba4d=_[_0x3ea9('0x3a')]({},_0x28ba4d,_0x9102fe[_0x3ea9('0x3d')]);return _0x3b593c[_0x3ea9('0x4d')](_0x28ba4d);}})[_0x3ea9('0x20')](function(_0x2399c7){if(_0x2399c7){_0x4b4c08=_0x2399c7['length'];if(!_0x9102fe[_0x3ea9('0x2e')][_0x3ea9('0x34')](_0x3ea9('0x4c'))){_0x28ba4d[_0x3ea9('0x1c')]=qs[_0x3ea9('0x1c')](_0x9102fe[_0x3ea9('0x2e')]['limit']);_0x28ba4d['offset']=qs[_0x3ea9('0x19')](_0x9102fe[_0x3ea9('0x2e')][_0x3ea9('0x19')]);}return _0x3b593c[_0x3ea9('0x4d')](_0x28ba4d);}})[_0x3ea9('0x20')](function(_0x3549b3){if(_0x3549b3){return _0x3549b3?{'count':_0x4b4c08,'rows':_0x3549b3}:null;}})[_0x3ea9('0x20')](respondWithResult(_0xa47c42,null))[_0x3ea9('0x42')](handleError(_0xa47c42,null));}; \ No newline at end of file +var _0xb0bb=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','name','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','findOne','SugarcrmField','getFields','getSubjects','getDescriptions','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','index','map','SugarcrmConfiguration','model','query','keys'];(function(_0x1a5c0b,_0x5e08f2){var _0x178a0a=function(_0x329c33){while(--_0x329c33){_0x1a5c0b['push'](_0x1a5c0b['shift']());}};_0x178a0a(++_0x5e08f2);}(_0xb0bb,0x159));var _0xbb0b=function(_0x480735,_0x30287b){_0x480735=_0x480735-0x0;var _0x2c076a=_0xb0bb[_0x480735];return _0x2c076a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbb0b('0x0'));var zipdir=require(_0xbb0b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbb0b('0x2'));var moment=require(_0xbb0b('0x3'));var BPromise=require(_0xbb0b('0x4'));var Mustache=require('mustache');var util=require(_0xbb0b('0x5'));var path=require(_0xbb0b('0x6'));var sox=require('sox');var csv=require(_0xbb0b('0x7'));var ejs=require(_0xbb0b('0x8'));var fs=require('fs');var fs_extra=require(_0xbb0b('0x9'));var _=require(_0xbb0b('0xa'));var squel=require('squel');var crypto=require(_0xbb0b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xbb0b('0xc'));var toCsv=require(_0xbb0b('0x7'));var querystring=require(_0xbb0b('0xd'));var Papa=require(_0xbb0b('0xe'));var Redis=require('ioredis');var authService=require(_0xbb0b('0xf'));var qs=require(_0xbb0b('0x10'));var as=require(_0xbb0b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbb0b('0x12'))(_0xbb0b('0x13'));var utils=require(_0xbb0b('0x14'));var config=require(_0xbb0b('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x538a28,_0x56edcb){_0x56edcb=_0x56edcb||0xcc;return function(_0x1f18c9){if(_0x1f18c9){return _0x538a28['sendStatus'](_0x56edcb);}return _0x538a28[_0xbb0b('0x16')](_0x56edcb)[_0xbb0b('0x17')]();};}function respondWithResult(_0x37fd05,_0x37f201){_0x37f201=_0x37f201||0xc8;return function(_0x217e37){if(_0x217e37){return _0x37fd05['status'](_0x37f201)[_0xbb0b('0x18')](_0x217e37);}};}function respondWithFilteredResult(_0x21481c,_0x4235c3){return function(_0x18c588){if(_0x18c588){var _0x2ead45=typeof _0x4235c3[_0xbb0b('0x19')]==='undefined'&&typeof _0x4235c3['limit']===_0xbb0b('0x1a');var _0x2d9198=_0x18c588[_0xbb0b('0x1b')];var _0x280afd=_0x2ead45?0x0:_0x4235c3[_0xbb0b('0x19')];var _0x578051=_0x2ead45?_0x18c588[_0xbb0b('0x1b')]:_0x4235c3[_0xbb0b('0x19')]+_0x4235c3[_0xbb0b('0x1c')];var _0x4dac98;if(_0x578051>=_0x2d9198){_0x578051=_0x2d9198;_0x4dac98=0xc8;}else{_0x4dac98=0xce;}_0x21481c['status'](_0x4dac98);return _0x21481c[_0xbb0b('0x1d')](_0xbb0b('0x1e'),_0x280afd+'-'+_0x578051+'/'+_0x2d9198)[_0xbb0b('0x18')](_0x18c588);}return null;};}function patchUpdates(_0x85f472){return function(_0x11e9a7){try{jsonpatch[_0xbb0b('0x1f')](_0x11e9a7,_0x85f472,!![]);}catch(_0xf98320){return BPromise[_0xbb0b('0x20')](_0xf98320);}return _0x11e9a7[_0xbb0b('0x21')]();};}function saveUpdates(_0x2f487a,_0x1ea922){return function(_0x4575d3){if(_0x4575d3){return _0x4575d3[_0xbb0b('0x22')](_0x2f487a)[_0xbb0b('0x23')](function(_0x253ff1){return _0x253ff1;});}return null;};}function removeEntity(_0x25a84b,_0x4e4c8e){return function(_0x17572b){if(_0x17572b){return _0x17572b[_0xbb0b('0x24')]()[_0xbb0b('0x23')](function(){_0x25a84b['status'](0xcc)[_0xbb0b('0x17')]();});}};}function handleEntityNotFound(_0x5449eb,_0x4ee3ab){return function(_0x47806e){if(!_0x47806e){_0x5449eb[_0xbb0b('0x25')](0x194);}return _0x47806e;};}function handleError(_0x253a86,_0x3c78cd){_0x3c78cd=_0x3c78cd||0x1f4;return function(_0x55780e){logger['error'](_0x55780e[_0xbb0b('0x26')]);if(_0x55780e['name']){delete _0x55780e['name'];}_0x253a86[_0xbb0b('0x16')](_0x3c78cd)['send'](_0x55780e);};}exports[_0xbb0b('0x27')]=function(_0x1466c7,_0x35fafc){var _0x2773c1={},_0x5e0281={},_0x3ab890={'count':0x0,'rows':[]};var _0x456e26=_[_0xbb0b('0x28')](db[_0xbb0b('0x29')]['rawAttributes'],function(_0x5f41c5){return{'name':_0x5f41c5['fieldName'],'type':_0x5f41c5['type']['key']};});_0x5e0281[_0xbb0b('0x2a')]=_[_0xbb0b('0x28')](_0x456e26,'name');_0x5e0281[_0xbb0b('0x2b')]=_[_0xbb0b('0x2c')](_0x1466c7[_0xbb0b('0x2b')]);_0x5e0281[_0xbb0b('0x2d')]=_[_0xbb0b('0x2e')](_0x5e0281[_0xbb0b('0x2a')],_0x5e0281[_0xbb0b('0x2b')]);_0x2773c1[_0xbb0b('0x2f')]=_[_0xbb0b('0x2e')](_0x5e0281[_0xbb0b('0x2a')],qs[_0xbb0b('0x30')](_0x1466c7[_0xbb0b('0x2b')][_0xbb0b('0x30')]));_0x2773c1['attributes']=_0x2773c1[_0xbb0b('0x2f')][_0xbb0b('0x31')]?_0x2773c1[_0xbb0b('0x2f')]:_0x5e0281['model'];if(!_0x1466c7[_0xbb0b('0x2b')][_0xbb0b('0x32')](_0xbb0b('0x33'))){_0x2773c1[_0xbb0b('0x1c')]=qs[_0xbb0b('0x1c')](_0x1466c7[_0xbb0b('0x2b')][_0xbb0b('0x1c')]);_0x2773c1[_0xbb0b('0x19')]=qs[_0xbb0b('0x19')](_0x1466c7['query'][_0xbb0b('0x19')]);}_0x2773c1[_0xbb0b('0x34')]=qs[_0xbb0b('0x35')](_0x1466c7['query'][_0xbb0b('0x35')]);_0x2773c1[_0xbb0b('0x36')]=qs[_0xbb0b('0x2d')](_[_0xbb0b('0x37')](_0x1466c7['query'],_0x5e0281['filters']),_0x456e26);if(_0x1466c7[_0xbb0b('0x2b')][_0xbb0b('0x38')]){_0x2773c1[_0xbb0b('0x36')]=_['merge'](_0x2773c1[_0xbb0b('0x36')],{'$or':_[_0xbb0b('0x28')](_0x456e26,function(_0x3dba49){if(_0x3dba49[_0xbb0b('0x39')]!==_0xbb0b('0x3a')){var _0x146493={};_0x146493[_0x3dba49[_0xbb0b('0x3b')]]={'$like':'%'+_0x1466c7[_0xbb0b('0x2b')][_0xbb0b('0x38')]+'%'};return _0x146493;}})});}_0x2773c1=_[_0xbb0b('0x3c')]({},_0x2773c1,_0x1466c7[_0xbb0b('0x3d')]);var _0x547ec6={'where':_0x2773c1[_0xbb0b('0x36')]};return db[_0xbb0b('0x29')][_0xbb0b('0x1b')](_0x547ec6)[_0xbb0b('0x23')](function(_0x2345e2){_0x3ab890['count']=_0x2345e2;if(_0x1466c7[_0xbb0b('0x2b')][_0xbb0b('0x3e')]){_0x2773c1[_0xbb0b('0x3f')]=[{'all':!![]}];}return db[_0xbb0b('0x29')][_0xbb0b('0x40')](_0x2773c1);})['then'](function(_0xeb55f8){_0x3ab890[_0xbb0b('0x41')]=_0xeb55f8;return _0x3ab890;})[_0xbb0b('0x23')](respondWithFilteredResult(_0x35fafc,_0x2773c1))[_0xbb0b('0x42')](handleError(_0x35fafc,null));};exports[_0xbb0b('0x43')]=function(_0x447af3,_0x16a71c){var _0x5c66e8={'raw':![],'where':{'id':_0x447af3[_0xbb0b('0x44')]['id']}},_0x13dc30={};_0x13dc30['model']=_[_0xbb0b('0x2c')](db[_0xbb0b('0x29')][_0xbb0b('0x45')]);_0x13dc30['query']=_['keys'](_0x447af3[_0xbb0b('0x2b')]);_0x13dc30['filters']=_[_0xbb0b('0x2e')](_0x13dc30['model'],_0x13dc30[_0xbb0b('0x2b')]);_0x5c66e8['attributes']=_['intersection'](_0x13dc30[_0xbb0b('0x2a')],qs['fields'](_0x447af3[_0xbb0b('0x2b')]['fields']));_0x5c66e8[_0xbb0b('0x2f')]=_0x5c66e8[_0xbb0b('0x2f')][_0xbb0b('0x31')]?_0x5c66e8[_0xbb0b('0x2f')]:_0x13dc30[_0xbb0b('0x2a')];if(_0x447af3[_0xbb0b('0x2b')][_0xbb0b('0x3e')]){_0x5c66e8[_0xbb0b('0x3f')]=[{'all':!![]}];}_0x5c66e8=_['merge']({},_0x5c66e8,_0x447af3[_0xbb0b('0x3d')]);return db[_0xbb0b('0x29')]['find'](_0x5c66e8)[_0xbb0b('0x23')](handleEntityNotFound(_0x16a71c,null))[_0xbb0b('0x23')](respondWithResult(_0x16a71c,null))[_0xbb0b('0x42')](handleError(_0x16a71c,null));};exports[_0xbb0b('0x46')]=function(_0x37cbe2,_0x4a2c98){return db['SugarcrmConfiguration']['create'](_0x37cbe2['body'],{})[_0xbb0b('0x23')](respondWithResult(_0x4a2c98,0xc9))[_0xbb0b('0x42')](handleError(_0x4a2c98,null));};exports['update']=function(_0x3d01c1,_0x5d95a3){if(_0x3d01c1[_0xbb0b('0x47')]['id']){delete _0x3d01c1[_0xbb0b('0x47')]['id'];}return db[_0xbb0b('0x29')][_0xbb0b('0x48')]({'where':{'id':_0x3d01c1[_0xbb0b('0x44')]['id']}})['then'](handleEntityNotFound(_0x5d95a3,null))[_0xbb0b('0x23')](saveUpdates(_0x3d01c1['body'],null))['then'](respondWithResult(_0x5d95a3,null))['catch'](handleError(_0x5d95a3,null));};exports[_0xbb0b('0x24')]=function(_0x75bfd0,_0x35b482){return db['SugarcrmConfiguration'][_0xbb0b('0x48')]({'where':{'id':_0x75bfd0[_0xbb0b('0x44')]['id']}})['then'](handleEntityNotFound(_0x35b482,null))[_0xbb0b('0x23')](removeEntity(_0x35b482,null))['catch'](handleError(_0x35b482,null));};exports['getFields']=function(_0x4a9f0e,_0x267d81,_0x53dedd){var _0x3ce64c={};var _0x57078f={};var _0x41df44;var _0x156ca9;return db['SugarcrmConfiguration'][_0xbb0b('0x49')]({'where':{'id':_0x4a9f0e['params']['id']}})[_0xbb0b('0x23')](handleEntityNotFound(_0x267d81,null))[_0xbb0b('0x23')](function(_0x5e8edd){if(_0x5e8edd){_0x41df44=_0x5e8edd;_0x57078f[_0xbb0b('0x2a')]=_['keys'](db[_0xbb0b('0x4a')][_0xbb0b('0x45')]);_0x57078f[_0xbb0b('0x2b')]=_[_0xbb0b('0x2c')](_0x4a9f0e[_0xbb0b('0x2b')]);_0x57078f[_0xbb0b('0x2d')]=_[_0xbb0b('0x2e')](_0x57078f[_0xbb0b('0x2a')],_0x57078f[_0xbb0b('0x2b')]);_0x3ce64c['attributes']=_[_0xbb0b('0x2e')](_0x57078f[_0xbb0b('0x2a')],qs['fields'](_0x4a9f0e[_0xbb0b('0x2b')]['fields']));_0x3ce64c[_0xbb0b('0x2f')]=_0x3ce64c[_0xbb0b('0x2f')][_0xbb0b('0x31')]?_0x3ce64c[_0xbb0b('0x2f')]:_0x57078f['model'];_0x3ce64c['order']=qs[_0xbb0b('0x35')](_0x4a9f0e[_0xbb0b('0x2b')][_0xbb0b('0x35')]);_0x3ce64c['where']=qs[_0xbb0b('0x2d')](_[_0xbb0b('0x37')](_0x4a9f0e[_0xbb0b('0x2b')],_0x57078f[_0xbb0b('0x2d')]));if(_0x4a9f0e[_0xbb0b('0x2b')][_0xbb0b('0x38')]){_0x3ce64c[_0xbb0b('0x36')]=_[_0xbb0b('0x3c')](_0x3ce64c[_0xbb0b('0x36')],{'$or':_[_0xbb0b('0x28')](_0x3ce64c[_0xbb0b('0x2f')],function(_0x41d8ba){var _0x55259b={};_0x55259b[_0x41d8ba]={'$like':'%'+_0x4a9f0e[_0xbb0b('0x2b')]['filter']+'%'};return _0x55259b;})});}_0x3ce64c=_[_0xbb0b('0x3c')]({},_0x3ce64c,_0x4a9f0e[_0xbb0b('0x3d')]);return _0x41df44[_0xbb0b('0x4b')](_0x3ce64c);}})[_0xbb0b('0x23')](function(_0x3898b0){if(_0x3898b0){_0x156ca9=_0x3898b0['length'];if(!_0x4a9f0e[_0xbb0b('0x2b')][_0xbb0b('0x32')](_0xbb0b('0x33'))){_0x3ce64c[_0xbb0b('0x1c')]=qs['limit'](_0x4a9f0e['query'][_0xbb0b('0x1c')]);_0x3ce64c[_0xbb0b('0x19')]=qs[_0xbb0b('0x19')](_0x4a9f0e[_0xbb0b('0x2b')][_0xbb0b('0x19')]);}return _0x41df44['getFields'](_0x3ce64c);}})[_0xbb0b('0x23')](function(_0x5a07c3){if(_0x5a07c3){return _0x5a07c3?{'count':_0x156ca9,'rows':_0x5a07c3}:null;}})['then'](respondWithResult(_0x267d81,null))[_0xbb0b('0x42')](handleError(_0x267d81,null));};exports[_0xbb0b('0x4c')]=function(_0x332a6e,_0x2b50f9,_0x261b06){var _0x5e3ff9={};var _0x60323={};var _0x283b64;var _0x261001;return db[_0xbb0b('0x29')][_0xbb0b('0x49')]({'where':{'id':_0x332a6e[_0xbb0b('0x44')]['id']}})[_0xbb0b('0x23')](handleEntityNotFound(_0x2b50f9,null))[_0xbb0b('0x23')](function(_0x4462eb){if(_0x4462eb){_0x283b64=_0x4462eb;_0x60323[_0xbb0b('0x2a')]=_[_0xbb0b('0x2c')](db['SugarcrmField'][_0xbb0b('0x45')]);_0x60323[_0xbb0b('0x2b')]=_['keys'](_0x332a6e['query']);_0x60323[_0xbb0b('0x2d')]=_[_0xbb0b('0x2e')](_0x60323[_0xbb0b('0x2a')],_0x60323['query']);_0x5e3ff9[_0xbb0b('0x2f')]=_[_0xbb0b('0x2e')](_0x60323[_0xbb0b('0x2a')],qs[_0xbb0b('0x30')](_0x332a6e[_0xbb0b('0x2b')]['fields']));_0x5e3ff9[_0xbb0b('0x2f')]=_0x5e3ff9[_0xbb0b('0x2f')][_0xbb0b('0x31')]?_0x5e3ff9['attributes']:_0x60323['model'];_0x5e3ff9['order']=qs['sort'](_0x332a6e[_0xbb0b('0x2b')][_0xbb0b('0x35')]);_0x5e3ff9[_0xbb0b('0x36')]=qs['filters'](_['pick'](_0x332a6e[_0xbb0b('0x2b')],_0x60323['filters']));if(_0x332a6e['query'][_0xbb0b('0x38')]){_0x5e3ff9[_0xbb0b('0x36')]=_[_0xbb0b('0x3c')](_0x5e3ff9[_0xbb0b('0x36')],{'$or':_[_0xbb0b('0x28')](_0x5e3ff9[_0xbb0b('0x2f')],function(_0x5bcd55){var _0x25107a={};_0x25107a[_0x5bcd55]={'$like':'%'+_0x332a6e['query'][_0xbb0b('0x38')]+'%'};return _0x25107a;})});}_0x5e3ff9=_[_0xbb0b('0x3c')]({},_0x5e3ff9,_0x332a6e[_0xbb0b('0x3d')]);return _0x283b64['getSubjects'](_0x5e3ff9);}})[_0xbb0b('0x23')](function(_0x74fe5f){if(_0x74fe5f){_0x261001=_0x74fe5f[_0xbb0b('0x31')];if(!_0x332a6e[_0xbb0b('0x2b')][_0xbb0b('0x32')](_0xbb0b('0x33'))){_0x5e3ff9[_0xbb0b('0x1c')]=qs[_0xbb0b('0x1c')](_0x332a6e[_0xbb0b('0x2b')][_0xbb0b('0x1c')]);_0x5e3ff9['offset']=qs[_0xbb0b('0x19')](_0x332a6e[_0xbb0b('0x2b')][_0xbb0b('0x19')]);}return _0x283b64[_0xbb0b('0x4c')](_0x5e3ff9);}})[_0xbb0b('0x23')](function(_0xbbb143){if(_0xbbb143){return _0xbbb143?{'count':_0x261001,'rows':_0xbbb143}:null;}})[_0xbb0b('0x23')](respondWithResult(_0x2b50f9,null))[_0xbb0b('0x42')](handleError(_0x2b50f9,null));};exports[_0xbb0b('0x4d')]=function(_0xd98bac,_0x36e49f,_0x5bf250){var _0x503ca3={};var _0x479445={};var _0x43c4b7;var _0x5e09ed;return db[_0xbb0b('0x29')][_0xbb0b('0x49')]({'where':{'id':_0xd98bac[_0xbb0b('0x44')]['id']}})['then'](handleEntityNotFound(_0x36e49f,null))[_0xbb0b('0x23')](function(_0x31a063){if(_0x31a063){_0x43c4b7=_0x31a063;_0x479445[_0xbb0b('0x2a')]=_[_0xbb0b('0x2c')](db[_0xbb0b('0x4a')][_0xbb0b('0x45')]);_0x479445[_0xbb0b('0x2b')]=_[_0xbb0b('0x2c')](_0xd98bac['query']);_0x479445[_0xbb0b('0x2d')]=_[_0xbb0b('0x2e')](_0x479445[_0xbb0b('0x2a')],_0x479445[_0xbb0b('0x2b')]);_0x503ca3[_0xbb0b('0x2f')]=_[_0xbb0b('0x2e')](_0x479445[_0xbb0b('0x2a')],qs[_0xbb0b('0x30')](_0xd98bac[_0xbb0b('0x2b')][_0xbb0b('0x30')]));_0x503ca3[_0xbb0b('0x2f')]=_0x503ca3['attributes'][_0xbb0b('0x31')]?_0x503ca3[_0xbb0b('0x2f')]:_0x479445['model'];_0x503ca3[_0xbb0b('0x34')]=qs[_0xbb0b('0x35')](_0xd98bac[_0xbb0b('0x2b')]['sort']);_0x503ca3[_0xbb0b('0x36')]=qs[_0xbb0b('0x2d')](_[_0xbb0b('0x37')](_0xd98bac['query'],_0x479445[_0xbb0b('0x2d')]));if(_0xd98bac['query'][_0xbb0b('0x38')]){_0x503ca3[_0xbb0b('0x36')]=_[_0xbb0b('0x3c')](_0x503ca3[_0xbb0b('0x36')],{'$or':_[_0xbb0b('0x28')](_0x503ca3[_0xbb0b('0x2f')],function(_0x54e94c){var _0x294c86={};_0x294c86[_0x54e94c]={'$like':'%'+_0xd98bac['query'][_0xbb0b('0x38')]+'%'};return _0x294c86;})});}_0x503ca3=_['merge']({},_0x503ca3,_0xd98bac[_0xbb0b('0x3d')]);return _0x43c4b7[_0xbb0b('0x4d')](_0x503ca3);}})[_0xbb0b('0x23')](function(_0x452ee7){if(_0x452ee7){_0x5e09ed=_0x452ee7[_0xbb0b('0x31')];if(!_0xd98bac[_0xbb0b('0x2b')]['hasOwnProperty'](_0xbb0b('0x33'))){_0x503ca3[_0xbb0b('0x1c')]=qs[_0xbb0b('0x1c')](_0xd98bac[_0xbb0b('0x2b')][_0xbb0b('0x1c')]);_0x503ca3[_0xbb0b('0x19')]=qs[_0xbb0b('0x19')](_0xd98bac['query'][_0xbb0b('0x19')]);}return _0x43c4b7['getDescriptions'](_0x503ca3);}})[_0xbb0b('0x23')](function(_0x109444){if(_0x109444){return _0x109444?{'count':_0x5e09ed,'rows':_0x109444}:null;}})[_0xbb0b('0x23')](respondWithResult(_0x36e49f,null))['catch'](handleError(_0x36e49f,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index f88cdd2..79a17f7 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 _0x2cf5=['int_sugarcrm_configurations','lodash','util','api','moment','bluebird','path','rimraf','./intSugarcrmConfiguration.attributes','exports'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x2cf5,0xfb));var _0x52cf=function(_0xa0cf46,_0x2e116d){_0xa0cf46=_0xa0cf46-0x0;var _0x2bf0c0=_0x2cf5[_0xa0cf46];return _0x2bf0c0;};'use strict';var _=require(_0x52cf('0x0'));var util=require(_0x52cf('0x1'));var logger=require('../../config/logger')(_0x52cf('0x2'));var moment=require(_0x52cf('0x3'));var BPromise=require(_0x52cf('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x52cf('0x5'));var rimraf=require(_0x52cf('0x6'));var config=require('../../config/environment');var attributes=require(_0x52cf('0x7'));module[_0x52cf('0x8')]=function(_0xe39fb8,_0x31c5cf){return _0xe39fb8['define']('SugarcrmConfiguration',attributes,{'tableName':_0x52cf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x933b=['request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird'];(function(_0x556b74,_0x15c0f8){var _0x3ba401=function(_0x3cad67){while(--_0x3cad67){_0x556b74['push'](_0x556b74['shift']());}};_0x3ba401(++_0x15c0f8);}(_0x933b,0xf7));var _0xb933=function(_0x244b17,_0x3f44f0){_0x244b17=_0x244b17-0x0;var _0x2d311b=_0x933b[_0x244b17];return _0x2d311b;};'use strict';var _=require(_0xb933('0x0'));var util=require('util');var logger=require(_0xb933('0x1'))(_0xb933('0x2'));var moment=require(_0xb933('0x3'));var BPromise=require(_0xb933('0x4'));var rp=require(_0xb933('0x5'));var fs=require('fs');var path=require(_0xb933('0x6'));var rimraf=require(_0xb933('0x7'));var config=require(_0xb933('0x8'));var attributes=require(_0xb933('0x9'));module[_0xb933('0xa')]=function(_0x3d89f9,_0xe7fa9b){return _0x3d89f9[_0xb933('0xb')]('SugarcrmConfiguration',attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 0c8ca47..b727296 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 _0x1344=['rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x453f5e,_0x1a9f19){var _0x3c262f=function(_0x303f47){while(--_0x303f47){_0x453f5e['push'](_0x453f5e['shift']());}};_0x3c262f(++_0x1a9f19);}(_0x1344,0x156));var _0x4134=function(_0x3730b1,_0x28a04b){_0x3730b1=_0x3730b1-0x0;var _0x2a75db=_0x1344[_0x3730b1];return _0x2a75db;};'use strict';var _=require(_0x4134('0x0'));var util=require(_0x4134('0x1'));var moment=require(_0x4134('0x2'));var BPromise=require('bluebird');var rs=require(_0x4134('0x3'));var fs=require('fs');var Redis=require(_0x4134('0x4'));var db=require(_0x4134('0x5'))['db'];var utils=require(_0x4134('0x6'));var logger=require(_0x4134('0x7'))(_0x4134('0x8'));var config=require(_0x4134('0x9'));var jayson=require(_0x4134('0xa'));var client=jayson[_0x4134('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35289e,_0x4441a9,_0xa969cf){return new BPromise(function(_0x295a3b,_0x488861){return client[_0x4134('0xc')](_0x35289e,_0xa969cf)[_0x4134('0xd')](function(_0x811530){logger[_0x4134('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4441a9,_0x4134('0xf'));logger[_0x4134('0x10')](_0x4134('0x11'),_0x4441a9,_0x4134('0xf'),JSON[_0x4134('0x12')](_0x811530));if(_0x811530[_0x4134('0x13')]){if(_0x811530[_0x4134('0x13')][_0x4134('0x14')]===0x1f4){logger[_0x4134('0x13')](_0x4134('0x15'),_0x4441a9,_0x811530[_0x4134('0x13')][_0x4134('0x16')]);return _0x488861(_0x811530[_0x4134('0x13')][_0x4134('0x16')]);}logger[_0x4134('0x13')](_0x4134('0x15'),_0x4441a9,_0x811530[_0x4134('0x13')][_0x4134('0x16')]);return _0x295a3b(_0x811530['error'][_0x4134('0x16')]);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x4441a9,_0x4134('0xf'));_0x295a3b(_0x811530[_0x4134('0x17')][_0x4134('0x16')]);}})[_0x4134('0x18')](function(_0x4a9a2b){logger['error'](_0x4134('0x15'),_0x4441a9,_0x4a9a2b);_0x488861(_0x4a9a2b);});});} \ No newline at end of file +var _0xc08b=['catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x13ddba,_0x4c0ae8){var _0xd69758=function(_0x56be2c){while(--_0x56be2c){_0x13ddba['push'](_0x13ddba['shift']());}};_0xd69758(++_0x4c0ae8);}(_0xc08b,0x141));var _0xbc08=function(_0x24f6ee,_0x1c8f5b){_0x24f6ee=_0x24f6ee-0x0;var _0x2c25b7=_0xc08b[_0x24f6ee];return _0x2c25b7;};'use strict';var _=require('lodash');var util=require(_0xbc08('0x0'));var moment=require('moment');var BPromise=require(_0xbc08('0x1'));var rs=require(_0xbc08('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbc08('0x3'))['db'];var utils=require(_0xbc08('0x4'));var logger=require(_0xbc08('0x5'))('rpc');var config=require(_0xbc08('0x6'));var jayson=require(_0xbc08('0x7'));var client=jayson[_0xbc08('0x8')][_0xbc08('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e94b3,_0x12fa69,_0x3b1272){return new BPromise(function(_0x1e47d7,_0x212b26){return client[_0xbc08('0xa')](_0x1e94b3,_0x3b1272)[_0xbc08('0xb')](function(_0x3ec3ce){logger[_0xbc08('0xc')](_0xbc08('0xd'),_0x12fa69,_0xbc08('0xe'));logger['debug'](_0xbc08('0xf'),_0x12fa69,_0xbc08('0xe'),JSON['stringify'](_0x3ec3ce));if(_0x3ec3ce[_0xbc08('0x10')]){if(_0x3ec3ce['error']['code']===0x1f4){logger[_0xbc08('0x10')](_0xbc08('0xd'),_0x12fa69,_0x3ec3ce[_0xbc08('0x10')][_0xbc08('0x11')]);return _0x212b26(_0x3ec3ce[_0xbc08('0x10')][_0xbc08('0x11')]);}logger['error'](_0xbc08('0xd'),_0x12fa69,_0x3ec3ce[_0xbc08('0x10')]['message']);return _0x1e47d7(_0x3ec3ce['error'][_0xbc08('0x11')]);}else{logger[_0xbc08('0xc')](_0xbc08('0xd'),_0x12fa69,_0xbc08('0xe'));_0x1e47d7(_0x3ec3ce[_0xbc08('0x12')][_0xbc08('0x11')]);}})[_0xbc08('0x13')](function(_0x373ce1){logger[_0xbc08('0x10')](_0xbc08('0xd'),_0x12fa69,_0x373ce1);_0x212b26(_0x373ce1);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 1d02c1e..cbf9cb7 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 _0x5df7=['path','Router','fs-extra','../../components/interaction/service','./intSugarcrmField.controller','get','isAuthenticated','index','create','/:id','update','delete','destroy','exports','multer','util'];(function(_0x25097c,_0x26a5cb){var _0x37991d=function(_0x52deb3){while(--_0x52deb3){_0x25097c['push'](_0x25097c['shift']());}};_0x37991d(++_0x26a5cb);}(_0x5df7,0xbe));var _0x75df=function(_0x14cc9d,_0xc4abc1){_0x14cc9d=_0x14cc9d-0x0;var _0x2659da=_0x5df7[_0x14cc9d];return _0x2659da;};'use strict';var multer=require(_0x75df('0x0'));var util=require(_0x75df('0x1'));var path=require(_0x75df('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x75df('0x3')]();var fs_extra=require(_0x75df('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x75df('0x5'));var config=require('../../config/environment');var controller=require(_0x75df('0x6'));router[_0x75df('0x7')]('/',auth[_0x75df('0x8')](),controller[_0x75df('0x9')]);router[_0x75df('0x7')]('/:id',auth[_0x75df('0x8')](),controller['show']);router['post']('/',auth[_0x75df('0x8')](),controller[_0x75df('0xa')]);router['put'](_0x75df('0xb'),auth['isAuthenticated'](),controller[_0x75df('0xc')]);router[_0x75df('0xd')]('/:id',auth[_0x75df('0x8')](),controller[_0x75df('0xe')]);module[_0x75df('0xf')]=router; \ No newline at end of file +var _0x474d=['isAuthenticated','post','create','put','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get'];(function(_0x4b4fbc,_0x1a4bce){var _0x249462=function(_0x1f1d1e){while(--_0x1f1d1e){_0x4b4fbc['push'](_0x4b4fbc['shift']());}};_0x249462(++_0x1a4bce);}(_0x474d,0xb1));var _0xd474=function(_0x44733d,_0x4ba68c){_0x44733d=_0x44733d-0x0;var _0xda3c8=_0x474d[_0x44733d];return _0xda3c8;};'use strict';var multer=require(_0xd474('0x0'));var util=require(_0xd474('0x1'));var path=require(_0xd474('0x2'));var timeout=require(_0xd474('0x3'));var express=require('express');var router=express[_0xd474('0x4')]();var fs_extra=require(_0xd474('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd474('0x6'));var config=require(_0xd474('0x7'));var controller=require(_0xd474('0x8'));router[_0xd474('0x9')]('/',auth[_0xd474('0xa')](),controller['index']);router[_0xd474('0x9')]('/:id',auth[_0xd474('0xa')](),controller['show']);router[_0xd474('0xb')]('/',auth[_0xd474('0xa')](),controller[_0xd474('0xc')]);router[_0xd474('0xd')](_0xd474('0xe'),auth[_0xd474('0xa')](),controller['update']);router['delete']('/:id',auth[_0xd474('0xa')](),controller[_0xd474('0xf')]);module[_0xd474('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 3bfba99..141e146 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 _0x4944=['customVariable','keyValue','picklist','STRING','BOOLEAN','exports','ENUM','string','variable'];(function(_0x4e752e,_0x533112){var _0x3cd511=function(_0x5bdb9c){while(--_0x5bdb9c){_0x4e752e['push'](_0x4e752e['shift']());}};_0x3cd511(++_0x533112);}(_0x4944,0x101));var _0x4494=function(_0x214591,_0x262f85){_0x214591=_0x214591-0x0;var _0x3d13f1=_0x4944[_0x214591];return _0x3d13f1;};'use strict';var Sequelize=require('sequelize');module[_0x4494('0x0')]={'type':{'type':Sequelize[_0x4494('0x1')](_0x4494('0x2'),_0x4494('0x3'),_0x4494('0x4'),_0x4494('0x5'),_0x4494('0x6')),'defaultValue':_0x4494('0x2')},'content':{'type':Sequelize[_0x4494('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x4494('0x1')](_0x4494('0x2'),_0x4494('0x3'),_0x4494('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x4494('0x7')]},'customField':{'type':Sequelize[_0x4494('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4494('0x7')]}}; \ No newline at end of file +var _0x0713=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','ENUM','string'];(function(_0x238663,_0x1647b2){var _0x3a1091=function(_0x1d3777){while(--_0x1d3777){_0x238663['push'](_0x238663['shift']());}};_0x3a1091(++_0x1647b2);}(_0x0713,0x126));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x3071('0x0')](_0x3071('0x1'),_0x3071('0x2'),_0x3071('0x3'),_0x3071('0x4'),_0x3071('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x3071('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x3071('0x0')](_0x3071('0x1'),_0x3071('0x2'),_0x3071('0x3'))},'keyContent':{'type':Sequelize[_0x3071('0x6')]},'idField':{'type':Sequelize[_0x3071('0x6')]},'nameField':{'type':Sequelize[_0x3071('0x6')]},'customField':{'type':Sequelize[_0x3071('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3071('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 5d85aef..024fcf0 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 _0x9026=['fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','reject','save','update','then','error','stack','name','index','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','rawAttributes','SugarcrmField','create','body','find','params','destroy','eml-format','rimraf','zip-dir'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x9026,0x131));var _0x6902=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x9026[_0x27af45];return _0x18df21;};'use strict';var emlformat=require(_0x6902('0x0'));var rimraf=require(_0x6902('0x1'));var zipdir=require(_0x6902('0x2'));var jsonpatch=require(_0x6902('0x3'));var rp=require(_0x6902('0x4'));var moment=require('moment');var BPromise=require(_0x6902('0x5'));var Mustache=require(_0x6902('0x6'));var util=require(_0x6902('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x6902('0x8'));var ejs=require(_0x6902('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6902('0xa'));var squel=require(_0x6902('0xb'));var crypto=require(_0x6902('0xc'));var jsforce=require(_0x6902('0xd'));var deskjs=require(_0x6902('0xe'));var toCsv=require(_0x6902('0x8'));var querystring=require(_0x6902('0xf'));var Papa=require(_0x6902('0x10'));var Redis=require(_0x6902('0x11'));var authService=require(_0x6902('0x12'));var qs=require(_0x6902('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6902('0x14'));var logger=require(_0x6902('0x15'))(_0x6902('0x16'));var utils=require(_0x6902('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6902('0x18'));var db=require(_0x6902('0x19'))['db'];function respondWithStatusCode(_0x3cd8f2,_0x44f057){_0x44f057=_0x44f057||0xcc;return function(_0x227e13){if(_0x227e13){return _0x3cd8f2[_0x6902('0x1a')](_0x44f057);}return _0x3cd8f2[_0x6902('0x1b')](_0x44f057)[_0x6902('0x1c')]();};}function respondWithResult(_0x1818c1,_0x45d545){_0x45d545=_0x45d545||0xc8;return function(_0x315239){if(_0x315239){return _0x1818c1[_0x6902('0x1b')](_0x45d545)['json'](_0x315239);}};}function respondWithFilteredResult(_0x2e565a,_0x3e34bb){return function(_0x46330e){if(_0x46330e){var _0x49dca4=typeof _0x3e34bb[_0x6902('0x1d')]==='undefined'&&typeof _0x3e34bb[_0x6902('0x1e')]===_0x6902('0x1f');var _0x21b047=_0x46330e['count'];var _0x427f21=_0x49dca4?0x0:_0x3e34bb[_0x6902('0x1d')];var _0x31c7c1=_0x49dca4?_0x46330e[_0x6902('0x20')]:_0x3e34bb[_0x6902('0x1d')]+_0x3e34bb['limit'];var _0x5ce055;if(_0x31c7c1>=_0x21b047){_0x31c7c1=_0x21b047;_0x5ce055=0xc8;}else{_0x5ce055=0xce;}_0x2e565a['status'](_0x5ce055);return _0x2e565a['set'](_0x6902('0x21'),_0x427f21+'-'+_0x31c7c1+'/'+_0x21b047)[_0x6902('0x22')](_0x46330e);}return null;};}function patchUpdates(_0x1e68a5){return function(_0x1ec906){try{jsonpatch['apply'](_0x1ec906,_0x1e68a5,!![]);}catch(_0x150e56){return BPromise[_0x6902('0x23')](_0x150e56);}return _0x1ec906[_0x6902('0x24')]();};}function saveUpdates(_0x5f1498,_0x1a82db){return function(_0x2a1ea6){if(_0x2a1ea6){return _0x2a1ea6[_0x6902('0x25')](_0x5f1498)[_0x6902('0x26')](function(_0x542c4e){return _0x542c4e;});}return null;};}function removeEntity(_0x1057a5,_0x40da4b){return function(_0x5aeada){if(_0x5aeada){return _0x5aeada['destroy']()[_0x6902('0x26')](function(){_0x1057a5[_0x6902('0x1b')](0xcc)[_0x6902('0x1c')]();});}};}function handleEntityNotFound(_0x679e66,_0x2edb59){return function(_0x2a40a1){if(!_0x2a40a1){_0x679e66[_0x6902('0x1a')](0x194);}return _0x2a40a1;};}function handleError(_0x16df32,_0x287c21){_0x287c21=_0x287c21||0x1f4;return function(_0x392536){logger[_0x6902('0x27')](_0x392536[_0x6902('0x28')]);if(_0x392536[_0x6902('0x29')]){delete _0x392536[_0x6902('0x29')];}_0x16df32['status'](_0x287c21)['send'](_0x392536);};}exports[_0x6902('0x2a')]=function(_0x202516,_0x21510b){var _0x3690e6={},_0x145cda={},_0x4369e3={'count':0x0,'rows':[]};var _0x1dde7d=_[_0x6902('0x2b')](db['SugarcrmField']['rawAttributes'],function(_0x362454){return{'name':_0x362454[_0x6902('0x2c')],'type':_0x362454[_0x6902('0x2d')][_0x6902('0x2e')]};});_0x145cda[_0x6902('0x2f')]=_[_0x6902('0x2b')](_0x1dde7d,_0x6902('0x29'));_0x145cda[_0x6902('0x30')]=_[_0x6902('0x31')](_0x202516[_0x6902('0x30')]);_0x145cda[_0x6902('0x32')]=_['intersection'](_0x145cda[_0x6902('0x2f')],_0x145cda[_0x6902('0x30')]);_0x3690e6[_0x6902('0x33')]=_[_0x6902('0x34')](_0x145cda[_0x6902('0x2f')],qs[_0x6902('0x35')](_0x202516['query'][_0x6902('0x35')]));_0x3690e6[_0x6902('0x33')]=_0x3690e6['attributes'][_0x6902('0x36')]?_0x3690e6[_0x6902('0x33')]:_0x145cda[_0x6902('0x2f')];if(!_0x202516['query'][_0x6902('0x37')](_0x6902('0x38'))){_0x3690e6[_0x6902('0x1e')]=qs[_0x6902('0x1e')](_0x202516['query'][_0x6902('0x1e')]);_0x3690e6[_0x6902('0x1d')]=qs[_0x6902('0x1d')](_0x202516['query']['offset']);}_0x3690e6[_0x6902('0x39')]=qs[_0x6902('0x3a')](_0x202516[_0x6902('0x30')]['sort']);_0x3690e6[_0x6902('0x3b')]=qs[_0x6902('0x32')](_[_0x6902('0x3c')](_0x202516[_0x6902('0x30')],_0x145cda[_0x6902('0x32')]),_0x1dde7d);if(_0x202516['query']['filter']){_0x3690e6[_0x6902('0x3b')]=_[_0x6902('0x3d')](_0x3690e6[_0x6902('0x3b')],{'$or':_['map'](_0x1dde7d,function(_0xd66ba8){if(_0xd66ba8[_0x6902('0x2d')]!==_0x6902('0x3e')){var _0xa01361={};_0xa01361[_0xd66ba8[_0x6902('0x29')]]={'$like':'%'+_0x202516[_0x6902('0x30')][_0x6902('0x3f')]+'%'};return _0xa01361;}})});}_0x3690e6=_[_0x6902('0x3d')]({},_0x3690e6,_0x202516[_0x6902('0x40')]);var _0x2959c3={'where':_0x3690e6[_0x6902('0x3b')]};return db['SugarcrmField'][_0x6902('0x20')](_0x2959c3)[_0x6902('0x26')](function(_0x4108b6){_0x4369e3[_0x6902('0x20')]=_0x4108b6;if(_0x202516[_0x6902('0x30')][_0x6902('0x41')]){_0x3690e6[_0x6902('0x42')]=[{'all':!![]}];}return db['SugarcrmField'][_0x6902('0x43')](_0x3690e6);})['then'](function(_0xb41a8d){_0x4369e3['rows']=_0xb41a8d;return _0x4369e3;})[_0x6902('0x26')](respondWithFilteredResult(_0x21510b,_0x3690e6))[_0x6902('0x44')](handleError(_0x21510b,null));};exports[_0x6902('0x45')]=function(_0x59ebe0,_0x231421){var _0x4e10d9={'raw':!![],'where':{'id':_0x59ebe0['params']['id']}},_0x524584={};_0x524584[_0x6902('0x2f')]=_[_0x6902('0x31')](db['SugarcrmField'][_0x6902('0x46')]);_0x524584[_0x6902('0x30')]=_[_0x6902('0x31')](_0x59ebe0[_0x6902('0x30')]);_0x524584[_0x6902('0x32')]=_[_0x6902('0x34')](_0x524584[_0x6902('0x2f')],_0x524584['query']);_0x4e10d9[_0x6902('0x33')]=_['intersection'](_0x524584['model'],qs['fields'](_0x59ebe0[_0x6902('0x30')][_0x6902('0x35')]));_0x4e10d9[_0x6902('0x33')]=_0x4e10d9[_0x6902('0x33')]['length']?_0x4e10d9['attributes']:_0x524584[_0x6902('0x2f')];if(_0x59ebe0['query']['includeAll']){_0x4e10d9[_0x6902('0x42')]=[{'all':!![]}];}_0x4e10d9=_[_0x6902('0x3d')]({},_0x4e10d9,_0x59ebe0[_0x6902('0x40')]);return db[_0x6902('0x47')]['find'](_0x4e10d9)['then'](handleEntityNotFound(_0x231421,null))[_0x6902('0x26')](respondWithResult(_0x231421,null))['catch'](handleError(_0x231421,null));};exports['create']=function(_0x3e07e8,_0x23a105){return db[_0x6902('0x47')][_0x6902('0x48')](_0x3e07e8[_0x6902('0x49')],{})[_0x6902('0x26')](respondWithResult(_0x23a105,0xc9))['catch'](handleError(_0x23a105,null));};exports[_0x6902('0x25')]=function(_0x2f309b,_0x1c4155){if(_0x2f309b['body']['id']){delete _0x2f309b[_0x6902('0x49')]['id'];}return db[_0x6902('0x47')][_0x6902('0x4a')]({'where':{'id':_0x2f309b[_0x6902('0x4b')]['id']}})[_0x6902('0x26')](handleEntityNotFound(_0x1c4155,null))[_0x6902('0x26')](saveUpdates(_0x2f309b[_0x6902('0x49')],null))[_0x6902('0x26')](respondWithResult(_0x1c4155,null))[_0x6902('0x44')](handleError(_0x1c4155,null));};exports[_0x6902('0x4c')]=function(_0x447ddd,_0x973811){return db[_0x6902('0x47')][_0x6902('0x4a')]({'where':{'id':_0x447ddd[_0x6902('0x4b')]['id']}})[_0x6902('0x26')](handleEntityNotFound(_0x973811,null))[_0x6902('0x26')](removeEntity(_0x973811,null))[_0x6902('0x44')](handleError(_0x973811,null));}; \ No newline at end of file +var _0x07de=['zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','fields','length','nolimit','order','sort','pick','where','options','SugarcrmField','includeAll','findAll','rows','show','params','intersection','include','find','create','body','catch','destroy','eml-format'];(function(_0x5299e9,_0x344512){var _0x2b51c4=function(_0x56bceb){while(--_0x56bceb){_0x5299e9['push'](_0x5299e9['shift']());}};_0x2b51c4(++_0x344512);}(_0x07de,0x123));var _0xe07d=function(_0x10d2bf,_0x54bb61){_0x10d2bf=_0x10d2bf-0x0;var _0x550e42=_0x07de[_0x10d2bf];return _0x550e42;};'use strict';var emlformat=require(_0xe07d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe07d('0x1'));var jsonpatch=require(_0xe07d('0x2'));var rp=require(_0xe07d('0x3'));var moment=require(_0xe07d('0x4'));var BPromise=require(_0xe07d('0x5'));var Mustache=require('mustache');var util=require(_0xe07d('0x6'));var path=require('path');var sox=require(_0xe07d('0x7'));var csv=require(_0xe07d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe07d('0x9'));var _=require(_0xe07d('0xa'));var squel=require('squel');var crypto=require(_0xe07d('0xb'));var jsforce=require(_0xe07d('0xc'));var deskjs=require(_0xe07d('0xd'));var toCsv=require(_0xe07d('0x8'));var querystring=require(_0xe07d('0xe'));var Papa=require(_0xe07d('0xf'));var Redis=require(_0xe07d('0x10'));var authService=require(_0xe07d('0x11'));var qs=require(_0xe07d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe07d('0x13'));var logger=require('../../config/logger')(_0xe07d('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe07d('0x15'));var db=require(_0xe07d('0x16'))['db'];function respondWithStatusCode(_0x4a4b76,_0x5133b8){_0x5133b8=_0x5133b8||0xcc;return function(_0x55616b){if(_0x55616b){return _0x4a4b76[_0xe07d('0x17')](_0x5133b8);}return _0x4a4b76[_0xe07d('0x18')](_0x5133b8)[_0xe07d('0x19')]();};}function respondWithResult(_0x16a41d,_0x587a40){_0x587a40=_0x587a40||0xc8;return function(_0x4b8ce1){if(_0x4b8ce1){return _0x16a41d[_0xe07d('0x18')](_0x587a40)['json'](_0x4b8ce1);}};}function respondWithFilteredResult(_0x37c8c4,_0x571813){return function(_0x2aea88){if(_0x2aea88){var _0x279b73=typeof _0x571813[_0xe07d('0x1a')]===_0xe07d('0x1b')&&typeof _0x571813['limit']===_0xe07d('0x1b');var _0x45bd07=_0x2aea88[_0xe07d('0x1c')];var _0x3aa7c2=_0x279b73?0x0:_0x571813[_0xe07d('0x1a')];var _0x47bc5e=_0x279b73?_0x2aea88[_0xe07d('0x1c')]:_0x571813['offset']+_0x571813[_0xe07d('0x1d')];var _0xaf7c86;if(_0x47bc5e>=_0x45bd07){_0x47bc5e=_0x45bd07;_0xaf7c86=0xc8;}else{_0xaf7c86=0xce;}_0x37c8c4[_0xe07d('0x18')](_0xaf7c86);return _0x37c8c4[_0xe07d('0x1e')](_0xe07d('0x1f'),_0x3aa7c2+'-'+_0x47bc5e+'/'+_0x45bd07)[_0xe07d('0x20')](_0x2aea88);}return null;};}function patchUpdates(_0x3d08a0){return function(_0x2bd970){try{jsonpatch[_0xe07d('0x21')](_0x2bd970,_0x3d08a0,!![]);}catch(_0x5bfa3b){return BPromise[_0xe07d('0x22')](_0x5bfa3b);}return _0x2bd970[_0xe07d('0x23')]();};}function saveUpdates(_0x1f719b,_0x55872b){return function(_0xc216d4){if(_0xc216d4){return _0xc216d4[_0xe07d('0x24')](_0x1f719b)[_0xe07d('0x25')](function(_0x517111){return _0x517111;});}return null;};}function removeEntity(_0x4368ac,_0x2cece9){return function(_0x299a4f){if(_0x299a4f){return _0x299a4f['destroy']()[_0xe07d('0x25')](function(){_0x4368ac[_0xe07d('0x18')](0xcc)[_0xe07d('0x19')]();});}};}function handleEntityNotFound(_0x369abf,_0x13ef7e){return function(_0x4f9525){if(!_0x4f9525){_0x369abf['sendStatus'](0x194);}return _0x4f9525;};}function handleError(_0x1ef019,_0x58a837){_0x58a837=_0x58a837||0x1f4;return function(_0x3d56a0){logger['error'](_0x3d56a0[_0xe07d('0x26')]);if(_0x3d56a0['name']){delete _0x3d56a0[_0xe07d('0x27')];}_0x1ef019['status'](_0x58a837)[_0xe07d('0x28')](_0x3d56a0);};}exports[_0xe07d('0x29')]=function(_0x119d02,_0x46ccaf){var _0x30fc10={},_0x5eff3a={},_0x55ae60={'count':0x0,'rows':[]};var _0x1e2ee6=_[_0xe07d('0x2a')](db['SugarcrmField'][_0xe07d('0x2b')],function(_0x36feaa){return{'name':_0x36feaa[_0xe07d('0x2c')],'type':_0x36feaa[_0xe07d('0x2d')][_0xe07d('0x2e')]};});_0x5eff3a['model']=_[_0xe07d('0x2a')](_0x1e2ee6,_0xe07d('0x27'));_0x5eff3a[_0xe07d('0x2f')]=_[_0xe07d('0x30')](_0x119d02['query']);_0x5eff3a[_0xe07d('0x31')]=_['intersection'](_0x5eff3a[_0xe07d('0x32')],_0x5eff3a['query']);_0x30fc10[_0xe07d('0x33')]=_['intersection'](_0x5eff3a[_0xe07d('0x32')],qs[_0xe07d('0x34')](_0x119d02[_0xe07d('0x2f')][_0xe07d('0x34')]));_0x30fc10[_0xe07d('0x33')]=_0x30fc10['attributes'][_0xe07d('0x35')]?_0x30fc10[_0xe07d('0x33')]:_0x5eff3a['model'];if(!_0x119d02[_0xe07d('0x2f')]['hasOwnProperty'](_0xe07d('0x36'))){_0x30fc10[_0xe07d('0x1d')]=qs[_0xe07d('0x1d')](_0x119d02[_0xe07d('0x2f')][_0xe07d('0x1d')]);_0x30fc10[_0xe07d('0x1a')]=qs[_0xe07d('0x1a')](_0x119d02[_0xe07d('0x2f')][_0xe07d('0x1a')]);}_0x30fc10[_0xe07d('0x37')]=qs[_0xe07d('0x38')](_0x119d02[_0xe07d('0x2f')][_0xe07d('0x38')]);_0x30fc10['where']=qs[_0xe07d('0x31')](_[_0xe07d('0x39')](_0x119d02['query'],_0x5eff3a[_0xe07d('0x31')]),_0x1e2ee6);if(_0x119d02['query']['filter']){_0x30fc10[_0xe07d('0x3a')]=_['merge'](_0x30fc10[_0xe07d('0x3a')],{'$or':_[_0xe07d('0x2a')](_0x1e2ee6,function(_0x53c861){if(_0x53c861[_0xe07d('0x2d')]!=='VIRTUAL'){var _0x28aa65={};_0x28aa65[_0x53c861[_0xe07d('0x27')]]={'$like':'%'+_0x119d02[_0xe07d('0x2f')]['filter']+'%'};return _0x28aa65;}})});}_0x30fc10=_['merge']({},_0x30fc10,_0x119d02[_0xe07d('0x3b')]);var _0x5f4428={'where':_0x30fc10[_0xe07d('0x3a')]};return db[_0xe07d('0x3c')]['count'](_0x5f4428)['then'](function(_0x55af01){_0x55ae60[_0xe07d('0x1c')]=_0x55af01;if(_0x119d02[_0xe07d('0x2f')][_0xe07d('0x3d')]){_0x30fc10['include']=[{'all':!![]}];}return db[_0xe07d('0x3c')][_0xe07d('0x3e')](_0x30fc10);})[_0xe07d('0x25')](function(_0x5702ae){_0x55ae60[_0xe07d('0x3f')]=_0x5702ae;return _0x55ae60;})[_0xe07d('0x25')](respondWithFilteredResult(_0x46ccaf,_0x30fc10))['catch'](handleError(_0x46ccaf,null));};exports[_0xe07d('0x40')]=function(_0x2b9a23,_0x851da6){var _0x38f8a3={'raw':!![],'where':{'id':_0x2b9a23[_0xe07d('0x41')]['id']}},_0x4c8dbc={};_0x4c8dbc[_0xe07d('0x32')]=_[_0xe07d('0x30')](db[_0xe07d('0x3c')]['rawAttributes']);_0x4c8dbc['query']=_[_0xe07d('0x30')](_0x2b9a23[_0xe07d('0x2f')]);_0x4c8dbc[_0xe07d('0x31')]=_[_0xe07d('0x42')](_0x4c8dbc[_0xe07d('0x32')],_0x4c8dbc[_0xe07d('0x2f')]);_0x38f8a3[_0xe07d('0x33')]=_[_0xe07d('0x42')](_0x4c8dbc[_0xe07d('0x32')],qs[_0xe07d('0x34')](_0x2b9a23[_0xe07d('0x2f')][_0xe07d('0x34')]));_0x38f8a3[_0xe07d('0x33')]=_0x38f8a3[_0xe07d('0x33')][_0xe07d('0x35')]?_0x38f8a3[_0xe07d('0x33')]:_0x4c8dbc[_0xe07d('0x32')];if(_0x2b9a23[_0xe07d('0x2f')][_0xe07d('0x3d')]){_0x38f8a3[_0xe07d('0x43')]=[{'all':!![]}];}_0x38f8a3=_['merge']({},_0x38f8a3,_0x2b9a23['options']);return db[_0xe07d('0x3c')][_0xe07d('0x44')](_0x38f8a3)[_0xe07d('0x25')](handleEntityNotFound(_0x851da6,null))[_0xe07d('0x25')](respondWithResult(_0x851da6,null))['catch'](handleError(_0x851da6,null));};exports[_0xe07d('0x45')]=function(_0x269f7a,_0x543561){return db[_0xe07d('0x3c')]['create'](_0x269f7a['body'],{})[_0xe07d('0x25')](respondWithResult(_0x543561,0xc9))['catch'](handleError(_0x543561,null));};exports['update']=function(_0x43023d,_0x4ebb95){if(_0x43023d['body']['id']){delete _0x43023d['body']['id'];}return db[_0xe07d('0x3c')][_0xe07d('0x44')]({'where':{'id':_0x43023d['params']['id']}})[_0xe07d('0x25')](handleEntityNotFound(_0x4ebb95,null))[_0xe07d('0x25')](saveUpdates(_0x43023d[_0xe07d('0x46')],null))[_0xe07d('0x25')](respondWithResult(_0x4ebb95,null))[_0xe07d('0x47')](handleError(_0x4ebb95,null));};exports[_0xe07d('0x48')]=function(_0x151a87,_0x301f6e){return db[_0xe07d('0x3c')][_0xe07d('0x44')]({'where':{'id':_0x151a87['params']['id']}})[_0xe07d('0x25')](handleEntityNotFound(_0x301f6e,null))[_0xe07d('0x25')](removeEntity(_0x301f6e,null))[_0xe07d('0x47')](handleError(_0x301f6e,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 00130ed..d925e2f 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 _0x0f0c=['SugarcrmField','int_sugarcrm_fields','idField','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intSugarcrmField.attributes','exports','define'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x0f0c,0xab));var _0xc0f0=function(_0x18dedd,_0x4cb9e5){_0x18dedd=_0x18dedd-0x0;var _0x35b7e1=_0x0f0c[_0x18dedd];return _0x35b7e1;};'use strict';var _=require(_0xc0f0('0x0'));var util=require('util');var logger=require(_0xc0f0('0x1'))(_0xc0f0('0x2'));var moment=require(_0xc0f0('0x3'));var BPromise=require(_0xc0f0('0x4'));var rp=require(_0xc0f0('0x5'));var fs=require('fs');var path=require(_0xc0f0('0x6'));var rimraf=require(_0xc0f0('0x7'));var config=require('../../config/environment');var attributes=require(_0xc0f0('0x8'));module[_0xc0f0('0x9')]=function(_0x1284cf,_0x583d79){return _0x1284cf[_0xc0f0('0xa')](_0xc0f0('0xb'),attributes,{'tableName':_0xc0f0('0xc'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0xc0f0('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4d91=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','define','SugarcrmField','sugarcrm_unique_index','idField','FieldId','lodash','util'];(function(_0x671369,_0x433da5){var _0x33f2b4=function(_0x2e9db2){while(--_0x2e9db2){_0x671369['push'](_0x671369['shift']());}};_0x33f2b4(++_0x433da5);}(_0x4d91,0x11e));var _0x14d9=function(_0x149083,_0x4047b6){_0x149083=_0x149083-0x0;var _0x4dc74e=_0x4d91[_0x149083];return _0x4dc74e;};'use strict';var _=require(_0x14d9('0x0'));var util=require(_0x14d9('0x1'));var logger=require(_0x14d9('0x2'))(_0x14d9('0x3'));var moment=require(_0x14d9('0x4'));var BPromise=require(_0x14d9('0x5'));var rp=require(_0x14d9('0x6'));var fs=require('fs');var path=require(_0x14d9('0x7'));var rimraf=require(_0x14d9('0x8'));var config=require(_0x14d9('0x9'));var attributes=require(_0x14d9('0xa'));module['exports']=function(_0x2c4680,_0x103f52){return _0x2c4680[_0x14d9('0xb')](_0x14d9('0xc'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x14d9('0xd'),'fields':[_0x14d9('0xe'),_0x14d9('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 a1591fd..59b04fd 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 _0x9337=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','SugarcrmField,\x20%s,\x20%s,\x20%s','error','code','SugarcrmField,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird'];(function(_0x363f8e,_0x5ef807){var _0x29bafd=function(_0x4ae217){while(--_0x4ae217){_0x363f8e['push'](_0x363f8e['shift']());}};_0x29bafd(++_0x5ef807);}(_0x9337,0x1ea));var _0x7933=function(_0x5c9c14,_0x37d8e2){_0x5c9c14=_0x5c9c14-0x0;var _0xe7dc0=_0x9337[_0x5c9c14];return _0xe7dc0;};'use strict';var _=require(_0x7933('0x0'));var util=require(_0x7933('0x1'));var moment=require(_0x7933('0x2'));var BPromise=require(_0x7933('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7933('0x4'))['db'];var utils=require(_0x7933('0x5'));var logger=require(_0x7933('0x6'))(_0x7933('0x7'));var config=require(_0x7933('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7933('0x9')][_0x7933('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10b8bb,_0x1a7a29,_0x3336f3){return new BPromise(function(_0x51d920,_0x2101d3){return client['request'](_0x10b8bb,_0x3336f3)[_0x7933('0xb')](function(_0x5438cc){logger[_0x7933('0xc')]('SugarcrmField,\x20%s,\x20%s',_0x1a7a29,'request\x20sent');logger['debug'](_0x7933('0xd'),_0x1a7a29,'request\x20sent',JSON['stringify'](_0x5438cc));if(_0x5438cc[_0x7933('0xe')]){if(_0x5438cc[_0x7933('0xe')][_0x7933('0xf')]===0x1f4){logger[_0x7933('0xe')](_0x7933('0x10'),_0x1a7a29,_0x5438cc[_0x7933('0xe')][_0x7933('0x11')]);return _0x2101d3(_0x5438cc[_0x7933('0xe')][_0x7933('0x11')]);}logger[_0x7933('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x1a7a29,_0x5438cc[_0x7933('0xe')][_0x7933('0x11')]);return _0x51d920(_0x5438cc[_0x7933('0xe')]['message']);}else{logger[_0x7933('0xc')](_0x7933('0x10'),_0x1a7a29,'request\x20sent');_0x51d920(_0x5438cc['result']['message']);}})[_0x7933('0x12')](function(_0xb11ce2){logger[_0x7933('0xe')](_0x7933('0x10'),_0x1a7a29,_0xb11ce2);_0x2101d3(_0xb11ce2);});});} \ No newline at end of file +var _0xe9d3=['../../config/utils','../../config/logger','../../config/environment','client','http','then','info','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','SugarcrmField,\x20%s,\x20%s','message','request\x20sent','result','catch','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x4e607f,_0x262958){var _0x15d991=function(_0x37bf81){while(--_0x37bf81){_0x4e607f['push'](_0x4e607f['shift']());}};_0x15d991(++_0x262958);}(_0xe9d3,0x9b));var _0x3e9d=function(_0x57ceb2,_0x56a7e0){_0x57ceb2=_0x57ceb2-0x0;var _0x29d6e1=_0xe9d3[_0x57ceb2];return _0x29d6e1;};'use strict';var _=require('lodash');var util=require(_0x3e9d('0x0'));var moment=require(_0x3e9d('0x1'));var BPromise=require(_0x3e9d('0x2'));var rs=require(_0x3e9d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e9d('0x4'))['db'];var utils=require(_0x3e9d('0x5'));var logger=require(_0x3e9d('0x6'))('rpc');var config=require(_0x3e9d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3e9d('0x8')][_0x3e9d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d6129,_0x8ae3e0,_0x2de1bc){return new BPromise(function(_0xb18eda,_0x491e2b){return client['request'](_0x2d6129,_0x2de1bc)[_0x3e9d('0xa')](function(_0x1b3826){logger[_0x3e9d('0xb')]('SugarcrmField,\x20%s,\x20%s',_0x8ae3e0,'request\x20sent');logger[_0x3e9d('0xc')](_0x3e9d('0xd'),_0x8ae3e0,'request\x20sent',JSON['stringify'](_0x1b3826));if(_0x1b3826[_0x3e9d('0xe')]){if(_0x1b3826[_0x3e9d('0xe')]['code']===0x1f4){logger[_0x3e9d('0xe')](_0x3e9d('0xf'),_0x8ae3e0,_0x1b3826['error']['message']);return _0x491e2b(_0x1b3826['error'][_0x3e9d('0x10')]);}logger[_0x3e9d('0xe')](_0x3e9d('0xf'),_0x8ae3e0,_0x1b3826[_0x3e9d('0xe')][_0x3e9d('0x10')]);return _0xb18eda(_0x1b3826[_0x3e9d('0xe')][_0x3e9d('0x10')]);}else{logger[_0x3e9d('0xb')](_0x3e9d('0xf'),_0x8ae3e0,_0x3e9d('0x11'));_0xb18eda(_0x1b3826[_0x3e9d('0x12')][_0x3e9d('0x10')]);}})[_0x3e9d('0x13')](function(_0x28babe){logger[_0x3e9d('0xe')](_0x3e9d('0xf'),_0x8ae3e0,_0x28babe);_0x491e2b(_0x28babe);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 34bb322..285a300 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 _0x1cf4=['isAuthenticated','index','/:id','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','destroy','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get'];(function(_0x43c67c,_0x40fe04){var _0x3136a2=function(_0x1c6ce0){while(--_0x1c6ce0){_0x43c67c['push'](_0x43c67c['shift']());}};_0x3136a2(++_0x40fe04);}(_0x1cf4,0xbf));var _0x41cf=function(_0x37fc15,_0x146b3c){_0x37fc15=_0x37fc15-0x0;var _0x3a939d=_0x1cf4[_0x37fc15];return _0x3a939d;};'use strict';var multer=require(_0x41cf('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x41cf('0x1'));var express=require(_0x41cf('0x2'));var router=express['Router']();var fs_extra=require(_0x41cf('0x3'));var auth=require(_0x41cf('0x4'));var interaction=require(_0x41cf('0x5'));var config=require(_0x41cf('0x6'));var controller=require(_0x41cf('0x7'));router[_0x41cf('0x8')]('/',auth[_0x41cf('0x9')](),controller[_0x41cf('0xa')]);router[_0x41cf('0x8')](_0x41cf('0xb'),auth[_0x41cf('0x9')](),controller['show']);router[_0x41cf('0x8')](_0x41cf('0xc'),auth[_0x41cf('0x9')](),controller['getConfigurations']);router[_0x41cf('0x8')](_0x41cf('0xd'),auth[_0x41cf('0x9')](),controller[_0x41cf('0xe')]);router[_0x41cf('0xf')]('/',auth[_0x41cf('0x9')](),controller[_0x41cf('0x10')]);router[_0x41cf('0xf')](_0x41cf('0xc'),auth[_0x41cf('0x9')](),controller[_0x41cf('0x11')]);router[_0x41cf('0x12')](_0x41cf('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x41cf('0xb'),auth['isAuthenticated'](),controller[_0x41cf('0x13')]);module['exports']=router; \ No newline at end of file +var _0x4422=['update','destroy','exports','multer','connect-timeout','Router','fs-extra','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x4422,0xab));var _0x2442=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4422[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x2442('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2442('0x1'));var express=require('express');var router=express[_0x2442('0x2')]();var fs_extra=require(_0x2442('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2442('0x4'));var controller=require(_0x2442('0x5'));router[_0x2442('0x6')]('/',auth[_0x2442('0x7')](),controller['index']);router[_0x2442('0x6')](_0x2442('0x8'),auth[_0x2442('0x7')](),controller[_0x2442('0x9')]);router[_0x2442('0x6')](_0x2442('0xa'),auth['isAuthenticated'](),controller[_0x2442('0xb')]);router[_0x2442('0x6')](_0x2442('0xc'),auth[_0x2442('0x7')](),controller[_0x2442('0xd')]);router[_0x2442('0xe')]('/',auth[_0x2442('0x7')](),controller[_0x2442('0xf')]);router['post'](_0x2442('0xa'),auth[_0x2442('0x7')](),controller[_0x2442('0x10')]);router[_0x2442('0x11')](_0x2442('0x8'),auth[_0x2442('0x7')](),controller[_0x2442('0x12')]);router['delete'](_0x2442('0x8'),auth[_0x2442('0x7')](),controller[_0x2442('0x13')]);module[_0x2442('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 77bd3aa..ba56e67 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 _0xa68e=['STRING','sequelize','exports'];(function(_0x35e92e,_0x21581b){var _0x1205a8=function(_0x4325d8){while(--_0x4325d8){_0x35e92e['push'](_0x35e92e['shift']());}};_0x1205a8(++_0x21581b);}(_0xa68e,0xa6));var _0xea68=function(_0x329ba0,_0x2e889b){_0x329ba0=_0x329ba0-0x0;var _0x526123=_0xa68e[_0x329ba0];return _0x526123;};'use strict';var Sequelize=require(_0xea68('0x0'));module[_0xea68('0x1')]={'name':{'type':Sequelize[_0xea68('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xea68('0x2')]},'username':{'type':Sequelize[_0xea68('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0xea68('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0xea68('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x9193=['exports','STRING','HelpDesk','sequelize'];(function(_0x312f03,_0x362b5b){var _0x9cba64=function(_0x2aa69d){while(--_0x2aa69d){_0x312f03['push'](_0x312f03['shift']());}};_0x9cba64(++_0x362b5b);}(_0x9193,0x1af));var _0x3919=function(_0x56138f,_0x1e9ebb){_0x56138f=_0x56138f-0x0;var _0x1acaf7=_0x9193[_0x56138f];return _0x1acaf7;};'use strict';var Sequelize=require(_0x3919('0x0'));module[_0x3919('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x3919('0x2')]},'username':{'type':Sequelize[_0x3919('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x3919('0x2')],'allowNull':![],'defaultValue':_0x3919('0x3')},'remoteUri':{'type':Sequelize[_0x3919('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x3919('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x3919('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 e38b107..6b9f676 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 _0x0173=['VtigerField','md5','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','format','%s/webservice.php','getchallenge','success','POST','login','result','token','GET','sessionName','autogenerated','reference','owner','remove','includes','editable','false','startsWith','picklistValues','label','value','log','vTiger\x20error:\x20','test','getFields','stringify','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','then','sendStatus','error','stack','name','send','index','VtigerAccount','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','findOne','VtigerConfiguration','rawAttributes','order','getConfigurations','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','Subjects'];(function(_0x1b12f1,_0x2e10d9){var _0xe21e85=function(_0x2bbc8f){while(--_0x2bbc8f){_0x1b12f1['push'](_0x1b12f1['shift']());}};_0xe21e85(++_0x2e10d9);}(_0x0173,0xa1));var _0x3017=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0173[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x3017('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3017('0x1'));var jsonpatch=require(_0x3017('0x2'));var rp=require(_0x3017('0x3'));var moment=require(_0x3017('0x4'));var BPromise=require(_0x3017('0x5'));var Mustache=require(_0x3017('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x3017('0x7'));var ejs=require(_0x3017('0x8'));var fs=require('fs');var fs_extra=require(_0x3017('0x9'));var _=require(_0x3017('0xa'));var squel=require(_0x3017('0xb'));var crypto=require(_0x3017('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3017('0xd'));var toCsv=require(_0x3017('0x7'));var querystring=require(_0x3017('0xe'));var Papa=require(_0x3017('0xf'));var Redis=require(_0x3017('0x10'));var authService=require(_0x3017('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3017('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3017('0x13'))(_0x3017('0x14'));var utils=require(_0x3017('0x15'));var config=require(_0x3017('0x16'));var licenseUtil=require(_0x3017('0x17'));var db=require(_0x3017('0x18'))['db'];var integrations=require(_0x3017('0x19'));function respondWithStatusCode(_0x53923e,_0x431ec1){_0x431ec1=_0x431ec1||0xcc;return function(_0x519490){if(_0x519490){return _0x53923e['sendStatus'](_0x431ec1);}return _0x53923e[_0x3017('0x1a')](_0x431ec1)[_0x3017('0x1b')]();};}function respondWithResult(_0x5f41c9,_0x37e05d){_0x37e05d=_0x37e05d||0xc8;return function(_0x1f0648){if(_0x1f0648){return _0x5f41c9[_0x3017('0x1a')](_0x37e05d)['json'](_0x1f0648);}};}function respondWithFilteredResult(_0x3895a7,_0x5a7933){return function(_0x108aee){if(_0x108aee){var _0x306476=typeof _0x5a7933[_0x3017('0x1c')]===_0x3017('0x1d')&&typeof _0x5a7933['limit']==='undefined';var _0x4ecd86=_0x108aee[_0x3017('0x1e')];var _0x10fc91=_0x306476?0x0:_0x5a7933[_0x3017('0x1c')];var _0x2b6dc1=_0x306476?_0x108aee['count']:_0x5a7933['offset']+_0x5a7933[_0x3017('0x1f')];var _0x300151;if(_0x2b6dc1>=_0x4ecd86){_0x2b6dc1=_0x4ecd86;_0x300151=0xc8;}else{_0x300151=0xce;}_0x3895a7[_0x3017('0x1a')](_0x300151);return _0x3895a7[_0x3017('0x20')](_0x3017('0x21'),_0x10fc91+'-'+_0x2b6dc1+'/'+_0x4ecd86)[_0x3017('0x22')](_0x108aee);}return null;};}function patchUpdates(_0x2ce473){return function(_0x570cbc){try{jsonpatch[_0x3017('0x23')](_0x570cbc,_0x2ce473,!![]);}catch(_0x4b40ea){return BPromise[_0x3017('0x24')](_0x4b40ea);}return _0x570cbc['save']();};}function saveUpdates(_0x57211f,_0x58c534){return function(_0x44d054){if(_0x44d054){return _0x44d054[_0x3017('0x25')](_0x57211f)[_0x3017('0x26')](function(_0x2aa323){return _0x2aa323;});}return null;};}function removeEntity(_0x858c83,_0x19f270){return function(_0x3eea82){if(_0x3eea82){return _0x3eea82['destroy']()[_0x3017('0x26')](function(){_0x858c83['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x29723e,_0x2c3a4a){return function(_0x20d508){if(!_0x20d508){_0x29723e[_0x3017('0x27')](0x194);}return _0x20d508;};}function handleError(_0x39dfa8,_0x12aac9){_0x12aac9=_0x12aac9||0x1f4;return function(_0x202aa9){logger[_0x3017('0x28')](_0x202aa9[_0x3017('0x29')]);if(_0x202aa9[_0x3017('0x2a')]){delete _0x202aa9[_0x3017('0x2a')];}_0x39dfa8[_0x3017('0x1a')](_0x12aac9)[_0x3017('0x2b')](_0x202aa9);};}exports[_0x3017('0x2c')]=function(_0x11c475,_0x500fd8){var _0xfff642={},_0x29188f={},_0x21a90b={'count':0x0,'rows':[]};var _0x14aa1e=_['map'](db[_0x3017('0x2d')]['rawAttributes'],function(_0x1a166b){return{'name':_0x1a166b[_0x3017('0x2e')],'type':_0x1a166b[_0x3017('0x2f')][_0x3017('0x30')]};});_0x29188f[_0x3017('0x31')]=_[_0x3017('0x32')](_0x14aa1e,'name');_0x29188f[_0x3017('0x33')]=_[_0x3017('0x34')](_0x11c475[_0x3017('0x33')]);_0x29188f[_0x3017('0x35')]=_[_0x3017('0x36')](_0x29188f[_0x3017('0x31')],_0x29188f[_0x3017('0x33')]);_0xfff642[_0x3017('0x37')]=_[_0x3017('0x36')](_0x29188f[_0x3017('0x31')],qs[_0x3017('0x38')](_0x11c475['query'][_0x3017('0x38')]));_0xfff642[_0x3017('0x37')]=_0xfff642[_0x3017('0x37')][_0x3017('0x39')]?_0xfff642['attributes']:_0x29188f['model'];if(!_0x11c475[_0x3017('0x33')][_0x3017('0x3a')](_0x3017('0x3b'))){_0xfff642[_0x3017('0x1f')]=qs[_0x3017('0x1f')](_0x11c475[_0x3017('0x33')][_0x3017('0x1f')]);_0xfff642[_0x3017('0x1c')]=qs[_0x3017('0x1c')](_0x11c475[_0x3017('0x33')][_0x3017('0x1c')]);}_0xfff642['order']=qs[_0x3017('0x3c')](_0x11c475[_0x3017('0x33')][_0x3017('0x3c')]);_0xfff642['where']=qs[_0x3017('0x35')](_[_0x3017('0x3d')](_0x11c475[_0x3017('0x33')],_0x29188f[_0x3017('0x35')]),_0x14aa1e);if(_0x11c475[_0x3017('0x33')]['filter']){_0xfff642[_0x3017('0x3e')]=_[_0x3017('0x3f')](_0xfff642[_0x3017('0x3e')],{'$or':_[_0x3017('0x32')](_0x14aa1e,function(_0xf36ecc){if(_0xf36ecc[_0x3017('0x2f')]!==_0x3017('0x40')){var _0x2e339a={};_0x2e339a[_0xf36ecc[_0x3017('0x2a')]]={'$like':'%'+_0x11c475[_0x3017('0x33')][_0x3017('0x41')]+'%'};return _0x2e339a;}})});}_0xfff642=_[_0x3017('0x3f')]({},_0xfff642,_0x11c475[_0x3017('0x42')]);var _0x3692c5={'where':_0xfff642[_0x3017('0x3e')]};return db['VtigerAccount'][_0x3017('0x1e')](_0x3692c5)['then'](function(_0x22cc75){_0x21a90b['count']=_0x22cc75;if(_0x11c475[_0x3017('0x33')][_0x3017('0x43')]){_0xfff642[_0x3017('0x44')]=[{'all':!![]}];}return db[_0x3017('0x2d')][_0x3017('0x45')](_0xfff642);})[_0x3017('0x26')](function(_0x531531){_0x21a90b[_0x3017('0x46')]=_0x531531;return _0x21a90b;})['then'](respondWithFilteredResult(_0x500fd8,_0xfff642))[_0x3017('0x47')](handleError(_0x500fd8,null));};exports[_0x3017('0x48')]=function(_0x19a431,_0x1dbc52){var _0x63d1d5={'raw':![],'where':{'id':_0x19a431[_0x3017('0x49')]['id']}},_0x4dc553={};_0x4dc553[_0x3017('0x31')]=_['keys'](db[_0x3017('0x2d')]['rawAttributes']);_0x4dc553[_0x3017('0x33')]=_[_0x3017('0x34')](_0x19a431['query']);_0x4dc553[_0x3017('0x35')]=_['intersection'](_0x4dc553['model'],_0x4dc553[_0x3017('0x33')]);_0x63d1d5['attributes']=_[_0x3017('0x36')](_0x4dc553[_0x3017('0x31')],qs[_0x3017('0x38')](_0x19a431[_0x3017('0x33')][_0x3017('0x38')]));_0x63d1d5[_0x3017('0x37')]=_0x63d1d5[_0x3017('0x37')][_0x3017('0x39')]?_0x63d1d5[_0x3017('0x37')]:_0x4dc553['model'];if(_0x19a431[_0x3017('0x33')][_0x3017('0x43')]){_0x63d1d5['include']=[{'all':!![]}];}_0x63d1d5=_[_0x3017('0x3f')]({},_0x63d1d5,_0x19a431[_0x3017('0x42')]);return db[_0x3017('0x2d')][_0x3017('0x4a')](_0x63d1d5)[_0x3017('0x26')](handleEntityNotFound(_0x1dbc52,null))[_0x3017('0x26')](respondWithResult(_0x1dbc52,null))[_0x3017('0x47')](handleError(_0x1dbc52,null));};exports[_0x3017('0x4b')]=function(_0x32b630,_0x2b5772){return db[_0x3017('0x2d')]['create'](_0x32b630['body'],{})[_0x3017('0x26')](respondWithResult(_0x2b5772,0xc9))[_0x3017('0x47')](handleError(_0x2b5772,null));};exports['update']=function(_0x2d5822,_0x21586b){if(_0x2d5822['body']['id']){delete _0x2d5822[_0x3017('0x4c')]['id'];}return db[_0x3017('0x2d')][_0x3017('0x4a')]({'where':{'id':_0x2d5822[_0x3017('0x49')]['id']}})[_0x3017('0x26')](handleEntityNotFound(_0x21586b,null))[_0x3017('0x26')](saveUpdates(_0x2d5822['body'],null))[_0x3017('0x26')](respondWithResult(_0x21586b,null))[_0x3017('0x47')](handleError(_0x21586b,null));};exports[_0x3017('0x4d')]=function(_0x5c5831,_0x158524){return db[_0x3017('0x2d')][_0x3017('0x4a')]({'where':{'id':_0x5c5831[_0x3017('0x49')]['id']}})[_0x3017('0x26')](handleEntityNotFound(_0x158524,null))['then'](removeEntity(_0x158524,null))[_0x3017('0x47')](handleError(_0x158524,null));};exports['getConfigurations']=function(_0x485bcc,_0x561346,_0x40fa8c){var _0x3b20b0={};var _0x9ddf42={};var _0x295d08;var _0x5bf83f;return db[_0x3017('0x2d')][_0x3017('0x4e')]({'where':{'id':_0x485bcc[_0x3017('0x49')]['id']}})[_0x3017('0x26')](handleEntityNotFound(_0x561346,null))[_0x3017('0x26')](function(_0xaec703){if(_0xaec703){_0x295d08=_0xaec703;_0x9ddf42[_0x3017('0x31')]=_[_0x3017('0x34')](db[_0x3017('0x4f')][_0x3017('0x50')]);_0x9ddf42['query']=_[_0x3017('0x34')](_0x485bcc[_0x3017('0x33')]);_0x9ddf42[_0x3017('0x35')]=_[_0x3017('0x36')](_0x9ddf42['model'],_0x9ddf42['query']);_0x3b20b0[_0x3017('0x37')]=_[_0x3017('0x36')](_0x9ddf42['model'],qs[_0x3017('0x38')](_0x485bcc['query'][_0x3017('0x38')]));_0x3b20b0[_0x3017('0x37')]=_0x3b20b0['attributes'][_0x3017('0x39')]?_0x3b20b0[_0x3017('0x37')]:_0x9ddf42[_0x3017('0x31')];_0x3b20b0[_0x3017('0x51')]=qs[_0x3017('0x3c')](_0x485bcc[_0x3017('0x33')][_0x3017('0x3c')]);_0x3b20b0['where']=qs['filters'](_['pick'](_0x485bcc['query'],_0x9ddf42[_0x3017('0x35')]));if(_0x485bcc[_0x3017('0x33')]['filter']){_0x3b20b0[_0x3017('0x3e')]=_['merge'](_0x3b20b0[_0x3017('0x3e')],{'$or':_['map'](_0x3b20b0[_0x3017('0x37')],function(_0x18f9aa){var _0x1f3b2e={};_0x1f3b2e[_0x18f9aa]={'$like':'%'+_0x485bcc[_0x3017('0x33')][_0x3017('0x41')]+'%'};return _0x1f3b2e;})});}_0x3b20b0=_[_0x3017('0x3f')]({},_0x3b20b0,_0x485bcc[_0x3017('0x42')]);return _0x295d08['getConfigurations'](_0x3b20b0);}})[_0x3017('0x26')](function(_0x5873a8){if(_0x5873a8){_0x5bf83f=_0x5873a8[_0x3017('0x39')];if(!_0x485bcc[_0x3017('0x33')]['hasOwnProperty'](_0x3017('0x3b'))){_0x3b20b0[_0x3017('0x1f')]=qs[_0x3017('0x1f')](_0x485bcc[_0x3017('0x33')][_0x3017('0x1f')]);_0x3b20b0[_0x3017('0x1c')]=qs[_0x3017('0x1c')](_0x485bcc[_0x3017('0x33')][_0x3017('0x1c')]);}return _0x295d08[_0x3017('0x52')](_0x3b20b0);}})['then'](function(_0x46f2df){if(_0x46f2df){return _0x46f2df?{'count':_0x5bf83f,'rows':_0x46f2df}:null;}})[_0x3017('0x26')](respondWithResult(_0x561346,null))['catch'](handleError(_0x561346,null));};exports[_0x3017('0x53')]=function(_0x129896,_0xf8e408,_0x222eff){if(_0x129896[_0x3017('0x4c')]['id']){delete _0x129896['body']['id'];}return db['VtigerAccount'][_0x3017('0x4e')]({'where':{'id':_0x129896['params']['id']}})[_0x3017('0x26')](handleEntityNotFound(_0xf8e408,null))[_0x3017('0x26')](function(_0x404ca3){if(_0x404ca3){_0x129896[_0x3017('0x4c')]['AccountId']=_0x404ca3['id'];_0x129896[_0x3017('0x4c')]['Subjects']=integrations[_0x3017('0x54')](_0x129896['body'][_0x3017('0x55')],_0x129896[_0x3017('0x4c')][_0x3017('0x2f')]);_0x129896[_0x3017('0x4c')][_0x3017('0x56')]=integrations[_0x3017('0x57')](_0x129896['body'][_0x3017('0x55')],_0x129896[_0x3017('0x4c')]['type']);return db[_0x3017('0x4f')][_0x3017('0x4b')](_0x129896[_0x3017('0x4c')],{'include':[{'model':db['VtigerField'],'as':_0x3017('0x58')},{'model':db[_0x3017('0x59')],'as':'Descriptions'}]});}return null;})[_0x3017('0x26')](respondWithResult(_0xf8e408,null))[_0x3017('0x47')](handleError(_0xf8e408,null));};var md5=require(_0x3017('0x5a'));exports['getFields']=function(_0x2ea206,_0x4f72da,_0x43eb82){var _0x4c3649=null;var _0x14dddf=null;var _0x17a084=null;var _0x4bc122=null;var _0xc91fa='';return db[_0x3017('0x2d')][_0x3017('0x4e')]({'where':{'id':_0x2ea206[_0x3017('0x49')]['id']},'attributes':['id',_0x3017('0x2a'),_0x3017('0x5b'),_0x3017('0x5c'),_0x3017('0x5d'),_0x3017('0x5e'),_0x3017('0x5f'),_0x3017('0x60')]})['then'](handleEntityNotFound(_0x4f72da,null))[_0x3017('0x26')](function(_0x4cce81){if(_0x4cce81){_0x4c3649=_0x4cce81[_0x3017('0x5b')];_0x14dddf=_0x4cce81[_0x3017('0x60')];_0x17a084=_0x4cce81[_0x3017('0x5d')];_0xc91fa=_0x4cce81[_0x3017('0x5e')];var _0x5c9a8b=_0xc91fa[_0x3017('0x61')](-0x1);if(_0x5c9a8b==='/'){_0xc91fa=_0xc91fa['substring'](0x0,_0xc91fa['lastIndexOf'](_0x5c9a8b));}_0x4bc122=util[_0x3017('0x62')](_0x3017('0x63'),_0xc91fa);var _0x7946aa={'method':'GET','uri':_0x4bc122,'qs':{'operation':_0x3017('0x64'),'username':_0x4cce81['username']},'json':!![]};return rp(_0x7946aa);}})[_0x3017('0x26')](function(_0xc6fdf7){if(_0xc6fdf7[_0x3017('0x65')]){var _0x11be96={'method':_0x3017('0x66'),'uri':_0x4bc122,'form':{'operation':_0x3017('0x67'),'username':_0x4c3649,'accessKey':md5(_0xc6fdf7[_0x3017('0x68')][_0x3017('0x69')]+_0x14dddf)},'json':!![]};return rp(_0x11be96);}})['then'](function(_0x346a8a){if(_0x346a8a[_0x3017('0x65')]){var _0x16cfe0={'method':_0x3017('0x6a'),'uri':_0x4bc122,'qs':{'operation':'describe','username':_0x4c3649,'sessionName':_0x346a8a[_0x3017('0x68')][_0x3017('0x6b')],'elementType':_0x17a084},'json':!![]};return rp(_0x16cfe0);}})[_0x3017('0x26')](function(_0x4425a0){if(_0x4425a0[_0x3017('0x65')]){var _0x37c372=[_0x3017('0x6c'),_0x3017('0x6d'),_0x3017('0x6e')];_[_0x3017('0x6f')](_0x4425a0['result'][_0x3017('0x38')],function(_0x9eb5f5){return _0x37c372[_0x3017('0x70')](_0x9eb5f5[_0x3017('0x2f')]['name']);});_[_0x3017('0x6f')](_0x4425a0['result'][_0x3017('0x38')],function(_0x315b7c){return _0x315b7c[_0x3017('0x71')]===_0x3017('0x72');});return{'count':_0x4425a0['result'][_0x3017('0x38')]['length'],'rows':_[_0x3017('0x32')](_0x4425a0['result'][_0x3017('0x38')],function(_0x5d4cd5){return{'id':_0x5d4cd5[_0x3017('0x2a')],'name':_0x5d4cd5['label'],'custom':_[_0x3017('0x73')](_0x5d4cd5[_0x3017('0x2a')],'cf_')?!![]:![],'options':_0x5d4cd5['type'][_0x3017('0x2a')]==='picklist'&&_0x5d4cd5[_0x3017('0x2f')][_0x3017('0x74')][_0x3017('0x39')]>0x0?_[_0x3017('0x32')](_0x5d4cd5['type'][_0x3017('0x74')],function(_0x1eb91f){return{'name':_0x1eb91f[_0x3017('0x75')],'value':_0x1eb91f[_0x3017('0x76')]};}):[]};})};}})[_0x3017('0x26')](respondWithResult(_0x4f72da,null))[_0x3017('0x47')](function(_0x24f523){console[_0x3017('0x77')](_0x3017('0x78')+_0x24f523);var _0x4da26c=_0x2ea206[_0x3017('0x33')][_0x3017('0x79')]?0x1f4:_0x24f523['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x3017('0x7a'),_0x4da26c,JSON[_0x3017('0x7b')](_0x24f523));delete _0x24f523[_0x3017('0x2a')];if(_0x4da26c===0x191){_0x4da26c=0x190;}_0x4f72da['status'](_0x4da26c)[_0x3017('0x2b')](_0x2ea206[_0x3017('0x33')][_0x3017('0x79')]?{'message':'Wrong\x20credentials','statusCode':_0x24f523[_0x3017('0x7c')]}:_0x24f523);});}; \ No newline at end of file +var _0xcc02=['picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','error','stack','name','send','map','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','VtigerAccount','includeAll','rows','catch','show','params','rawAttributes','find','create','body','destroy','findOne','pick','getConfigurations','addConfiguration','Subjects','channel','getDescriptions','VtigerConfiguration','VtigerField','Descriptions','md5','getFields','description','moduleName','remoteUri','serverUrl','accessKey','substring','lastIndexOf','%s/webservice.php','GET','getchallenge','username','success','POST','result','token','describe','sessionName','autogenerated','reference','owner','remove','includes','editable','false','label','startsWith'];(function(_0x55304f,_0x3ba9f9){var _0x375a70=function(_0x32128d){while(--_0x32128d){_0x55304f['push'](_0x55304f['shift']());}};_0x375a70(++_0x3ba9f9);}(_0xcc02,0x1dd));var _0x2cc0=function(_0x1bc1e6,_0x3fc89c){_0x1bc1e6=_0x1bc1e6-0x0;var _0x9d59b9=_0xcc02[_0x1bc1e6];return _0x9d59b9;};'use strict';var emlformat=require(_0x2cc0('0x0'));var rimraf=require(_0x2cc0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2cc0('0x2'));var rp=require(_0x2cc0('0x3'));var moment=require(_0x2cc0('0x4'));var BPromise=require(_0x2cc0('0x5'));var Mustache=require(_0x2cc0('0x6'));var util=require(_0x2cc0('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x2cc0('0x8'));var ejs=require(_0x2cc0('0x9'));var fs=require('fs');var fs_extra=require(_0x2cc0('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2cc0('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x2cc0('0x8'));var querystring=require(_0x2cc0('0xc'));var Papa=require(_0x2cc0('0xd'));var Redis=require(_0x2cc0('0xe'));var authService=require(_0x2cc0('0xf'));var qs=require(_0x2cc0('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2cc0('0x11'));var logger=require(_0x2cc0('0x12'))(_0x2cc0('0x13'));var utils=require(_0x2cc0('0x14'));var config=require(_0x2cc0('0x15'));var licenseUtil=require(_0x2cc0('0x16'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x147c78,_0x4f56c0){_0x4f56c0=_0x4f56c0||0xcc;return function(_0x5c2917){if(_0x5c2917){return _0x147c78[_0x2cc0('0x17')](_0x4f56c0);}return _0x147c78[_0x2cc0('0x18')](_0x4f56c0)[_0x2cc0('0x19')]();};}function respondWithResult(_0x467441,_0x1ae71f){_0x1ae71f=_0x1ae71f||0xc8;return function(_0x36a477){if(_0x36a477){return _0x467441[_0x2cc0('0x18')](_0x1ae71f)[_0x2cc0('0x1a')](_0x36a477);}};}function respondWithFilteredResult(_0x59f88a,_0x52968d){return function(_0x26cb2b){if(_0x26cb2b){var _0x2c17f8=typeof _0x52968d[_0x2cc0('0x1b')]==='undefined'&&typeof _0x52968d[_0x2cc0('0x1c')]===_0x2cc0('0x1d');var _0x2986c5=_0x26cb2b[_0x2cc0('0x1e')];var _0x3ae994=_0x2c17f8?0x0:_0x52968d['offset'];var _0x3abb56=_0x2c17f8?_0x26cb2b['count']:_0x52968d['offset']+_0x52968d['limit'];var _0xd0f44b;if(_0x3abb56>=_0x2986c5){_0x3abb56=_0x2986c5;_0xd0f44b=0xc8;}else{_0xd0f44b=0xce;}_0x59f88a['status'](_0xd0f44b);return _0x59f88a[_0x2cc0('0x1f')](_0x2cc0('0x20'),_0x3ae994+'-'+_0x3abb56+'/'+_0x2986c5)[_0x2cc0('0x1a')](_0x26cb2b);}return null;};}function patchUpdates(_0x2410d4){return function(_0x421bca){try{jsonpatch[_0x2cc0('0x21')](_0x421bca,_0x2410d4,!![]);}catch(_0x28b4f0){return BPromise['reject'](_0x28b4f0);}return _0x421bca['save']();};}function saveUpdates(_0x4608ed,_0x5c10a9){return function(_0x359ff2){if(_0x359ff2){return _0x359ff2[_0x2cc0('0x22')](_0x4608ed)[_0x2cc0('0x23')](function(_0x50d98d){return _0x50d98d;});}return null;};}function removeEntity(_0x2d9c70,_0x5098f9){return function(_0x7122cf){if(_0x7122cf){return _0x7122cf['destroy']()[_0x2cc0('0x23')](function(){_0x2d9c70[_0x2cc0('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3417da,_0x47f4f){return function(_0x2f1c22){if(!_0x2f1c22){_0x3417da[_0x2cc0('0x17')](0x194);}return _0x2f1c22;};}function handleError(_0x3c3fb9,_0x4a37d0){_0x4a37d0=_0x4a37d0||0x1f4;return function(_0x5232b3){logger[_0x2cc0('0x24')](_0x5232b3[_0x2cc0('0x25')]);if(_0x5232b3[_0x2cc0('0x26')]){delete _0x5232b3[_0x2cc0('0x26')];}_0x3c3fb9[_0x2cc0('0x18')](_0x4a37d0)[_0x2cc0('0x27')](_0x5232b3);};}exports['index']=function(_0x315e8b,_0x2eeac4){var _0x2aa5ad={},_0x3c1905={},_0x9c6a71={'count':0x0,'rows':[]};var _0x1a0d8c=_[_0x2cc0('0x28')](db['VtigerAccount']['rawAttributes'],function(_0x235a7a){return{'name':_0x235a7a[_0x2cc0('0x29')],'type':_0x235a7a[_0x2cc0('0x2a')]['key']};});_0x3c1905['model']=_['map'](_0x1a0d8c,_0x2cc0('0x26'));_0x3c1905[_0x2cc0('0x2b')]=_[_0x2cc0('0x2c')](_0x315e8b[_0x2cc0('0x2b')]);_0x3c1905[_0x2cc0('0x2d')]=_[_0x2cc0('0x2e')](_0x3c1905[_0x2cc0('0x2f')],_0x3c1905[_0x2cc0('0x2b')]);_0x2aa5ad['attributes']=_['intersection'](_0x3c1905[_0x2cc0('0x2f')],qs['fields'](_0x315e8b[_0x2cc0('0x2b')][_0x2cc0('0x30')]));_0x2aa5ad[_0x2cc0('0x31')]=_0x2aa5ad['attributes'][_0x2cc0('0x32')]?_0x2aa5ad[_0x2cc0('0x31')]:_0x3c1905[_0x2cc0('0x2f')];if(!_0x315e8b[_0x2cc0('0x2b')][_0x2cc0('0x33')](_0x2cc0('0x34'))){_0x2aa5ad[_0x2cc0('0x1c')]=qs[_0x2cc0('0x1c')](_0x315e8b[_0x2cc0('0x2b')][_0x2cc0('0x1c')]);_0x2aa5ad[_0x2cc0('0x1b')]=qs[_0x2cc0('0x1b')](_0x315e8b[_0x2cc0('0x2b')][_0x2cc0('0x1b')]);}_0x2aa5ad['order']=qs[_0x2cc0('0x35')](_0x315e8b['query'][_0x2cc0('0x35')]);_0x2aa5ad['where']=qs[_0x2cc0('0x2d')](_['pick'](_0x315e8b['query'],_0x3c1905['filters']),_0x1a0d8c);if(_0x315e8b[_0x2cc0('0x2b')][_0x2cc0('0x36')]){_0x2aa5ad[_0x2cc0('0x37')]=_[_0x2cc0('0x38')](_0x2aa5ad[_0x2cc0('0x37')],{'$or':_['map'](_0x1a0d8c,function(_0x3fa6ef){if(_0x3fa6ef[_0x2cc0('0x2a')]!==_0x2cc0('0x39')){var _0x5c7bec={};_0x5c7bec[_0x3fa6ef['name']]={'$like':'%'+_0x315e8b[_0x2cc0('0x2b')][_0x2cc0('0x36')]+'%'};return _0x5c7bec;}})});}_0x2aa5ad=_[_0x2cc0('0x38')]({},_0x2aa5ad,_0x315e8b[_0x2cc0('0x3a')]);var _0x40be09={'where':_0x2aa5ad[_0x2cc0('0x37')]};return db[_0x2cc0('0x3b')][_0x2cc0('0x1e')](_0x40be09)[_0x2cc0('0x23')](function(_0x2b55ca){_0x9c6a71['count']=_0x2b55ca;if(_0x315e8b[_0x2cc0('0x2b')][_0x2cc0('0x3c')]){_0x2aa5ad['include']=[{'all':!![]}];}return db[_0x2cc0('0x3b')]['findAll'](_0x2aa5ad);})['then'](function(_0xd9725){_0x9c6a71[_0x2cc0('0x3d')]=_0xd9725;return _0x9c6a71;})[_0x2cc0('0x23')](respondWithFilteredResult(_0x2eeac4,_0x2aa5ad))[_0x2cc0('0x3e')](handleError(_0x2eeac4,null));};exports[_0x2cc0('0x3f')]=function(_0x1807ea,_0x5eca63){var _0x2baa82={'raw':![],'where':{'id':_0x1807ea[_0x2cc0('0x40')]['id']}},_0x4e6e7f={};_0x4e6e7f[_0x2cc0('0x2f')]=_['keys'](db[_0x2cc0('0x3b')][_0x2cc0('0x41')]);_0x4e6e7f[_0x2cc0('0x2b')]=_[_0x2cc0('0x2c')](_0x1807ea[_0x2cc0('0x2b')]);_0x4e6e7f['filters']=_[_0x2cc0('0x2e')](_0x4e6e7f[_0x2cc0('0x2f')],_0x4e6e7f[_0x2cc0('0x2b')]);_0x2baa82[_0x2cc0('0x31')]=_['intersection'](_0x4e6e7f['model'],qs['fields'](_0x1807ea[_0x2cc0('0x2b')]['fields']));_0x2baa82[_0x2cc0('0x31')]=_0x2baa82[_0x2cc0('0x31')][_0x2cc0('0x32')]?_0x2baa82[_0x2cc0('0x31')]:_0x4e6e7f[_0x2cc0('0x2f')];if(_0x1807ea[_0x2cc0('0x2b')][_0x2cc0('0x3c')]){_0x2baa82['include']=[{'all':!![]}];}_0x2baa82=_[_0x2cc0('0x38')]({},_0x2baa82,_0x1807ea[_0x2cc0('0x3a')]);return db[_0x2cc0('0x3b')][_0x2cc0('0x42')](_0x2baa82)[_0x2cc0('0x23')](handleEntityNotFound(_0x5eca63,null))[_0x2cc0('0x23')](respondWithResult(_0x5eca63,null))[_0x2cc0('0x3e')](handleError(_0x5eca63,null));};exports[_0x2cc0('0x43')]=function(_0x17aea8,_0x54d967){return db[_0x2cc0('0x3b')][_0x2cc0('0x43')](_0x17aea8[_0x2cc0('0x44')],{})[_0x2cc0('0x23')](respondWithResult(_0x54d967,0xc9))[_0x2cc0('0x3e')](handleError(_0x54d967,null));};exports[_0x2cc0('0x22')]=function(_0x250f35,_0x3926a1){if(_0x250f35[_0x2cc0('0x44')]['id']){delete _0x250f35['body']['id'];}return db['VtigerAccount']['find']({'where':{'id':_0x250f35[_0x2cc0('0x40')]['id']}})[_0x2cc0('0x23')](handleEntityNotFound(_0x3926a1,null))[_0x2cc0('0x23')](saveUpdates(_0x250f35[_0x2cc0('0x44')],null))[_0x2cc0('0x23')](respondWithResult(_0x3926a1,null))[_0x2cc0('0x3e')](handleError(_0x3926a1,null));};exports[_0x2cc0('0x45')]=function(_0x49b40d,_0xd7f089){return db[_0x2cc0('0x3b')][_0x2cc0('0x42')]({'where':{'id':_0x49b40d[_0x2cc0('0x40')]['id']}})[_0x2cc0('0x23')](handleEntityNotFound(_0xd7f089,null))[_0x2cc0('0x23')](removeEntity(_0xd7f089,null))['catch'](handleError(_0xd7f089,null));};exports['getConfigurations']=function(_0x5e8f71,_0x52b090,_0x1ef317){var _0x3b9dd6={};var _0x1940e5={};var _0x9b9856;var _0x517f0a;return db[_0x2cc0('0x3b')][_0x2cc0('0x46')]({'where':{'id':_0x5e8f71[_0x2cc0('0x40')]['id']}})['then'](handleEntityNotFound(_0x52b090,null))[_0x2cc0('0x23')](function(_0x474beb){if(_0x474beb){_0x9b9856=_0x474beb;_0x1940e5[_0x2cc0('0x2f')]=_['keys'](db['VtigerConfiguration'][_0x2cc0('0x41')]);_0x1940e5['query']=_['keys'](_0x5e8f71['query']);_0x1940e5[_0x2cc0('0x2d')]=_[_0x2cc0('0x2e')](_0x1940e5['model'],_0x1940e5[_0x2cc0('0x2b')]);_0x3b9dd6['attributes']=_[_0x2cc0('0x2e')](_0x1940e5[_0x2cc0('0x2f')],qs[_0x2cc0('0x30')](_0x5e8f71[_0x2cc0('0x2b')]['fields']));_0x3b9dd6[_0x2cc0('0x31')]=_0x3b9dd6['attributes'][_0x2cc0('0x32')]?_0x3b9dd6[_0x2cc0('0x31')]:_0x1940e5[_0x2cc0('0x2f')];_0x3b9dd6['order']=qs['sort'](_0x5e8f71['query'][_0x2cc0('0x35')]);_0x3b9dd6['where']=qs[_0x2cc0('0x2d')](_[_0x2cc0('0x47')](_0x5e8f71['query'],_0x1940e5[_0x2cc0('0x2d')]));if(_0x5e8f71[_0x2cc0('0x2b')]['filter']){_0x3b9dd6[_0x2cc0('0x37')]=_['merge'](_0x3b9dd6[_0x2cc0('0x37')],{'$or':_['map'](_0x3b9dd6[_0x2cc0('0x31')],function(_0x399d3f){var _0x159651={};_0x159651[_0x399d3f]={'$like':'%'+_0x5e8f71['query']['filter']+'%'};return _0x159651;})});}_0x3b9dd6=_[_0x2cc0('0x38')]({},_0x3b9dd6,_0x5e8f71['options']);return _0x9b9856[_0x2cc0('0x48')](_0x3b9dd6);}})[_0x2cc0('0x23')](function(_0x31a1f0){if(_0x31a1f0){_0x517f0a=_0x31a1f0['length'];if(!_0x5e8f71['query'][_0x2cc0('0x33')](_0x2cc0('0x34'))){_0x3b9dd6['limit']=qs[_0x2cc0('0x1c')](_0x5e8f71[_0x2cc0('0x2b')][_0x2cc0('0x1c')]);_0x3b9dd6[_0x2cc0('0x1b')]=qs[_0x2cc0('0x1b')](_0x5e8f71[_0x2cc0('0x2b')][_0x2cc0('0x1b')]);}return _0x9b9856['getConfigurations'](_0x3b9dd6);}})[_0x2cc0('0x23')](function(_0x306aa8){if(_0x306aa8){return _0x306aa8?{'count':_0x517f0a,'rows':_0x306aa8}:null;}})[_0x2cc0('0x23')](respondWithResult(_0x52b090,null))[_0x2cc0('0x3e')](handleError(_0x52b090,null));};exports[_0x2cc0('0x49')]=function(_0x1a30aa,_0x1db201,_0x52ba5b){if(_0x1a30aa[_0x2cc0('0x44')]['id']){delete _0x1a30aa[_0x2cc0('0x44')]['id'];}return db[_0x2cc0('0x3b')][_0x2cc0('0x46')]({'where':{'id':_0x1a30aa[_0x2cc0('0x40')]['id']}})['then'](handleEntityNotFound(_0x1db201,null))[_0x2cc0('0x23')](function(_0x50ce27){if(_0x50ce27){_0x1a30aa[_0x2cc0('0x44')]['AccountId']=_0x50ce27['id'];_0x1a30aa[_0x2cc0('0x44')][_0x2cc0('0x4a')]=integrations['getSubjects'](_0x1a30aa['body'][_0x2cc0('0x4b')],_0x1a30aa['body']['type']);_0x1a30aa[_0x2cc0('0x44')]['Descriptions']=integrations[_0x2cc0('0x4c')](_0x1a30aa[_0x2cc0('0x44')][_0x2cc0('0x4b')],_0x1a30aa['body']['type']);return db[_0x2cc0('0x4d')]['create'](_0x1a30aa[_0x2cc0('0x44')],{'include':[{'model':db[_0x2cc0('0x4e')],'as':_0x2cc0('0x4a')},{'model':db[_0x2cc0('0x4e')],'as':_0x2cc0('0x4f')}]});}return null;})[_0x2cc0('0x23')](respondWithResult(_0x1db201,null))[_0x2cc0('0x3e')](handleError(_0x1db201,null));};var md5=require(_0x2cc0('0x50'));exports[_0x2cc0('0x51')]=function(_0x31e89e,_0x2c08b7,_0x2c6432){var _0x1f784b=null;var _0x57d451=null;var _0x4185f9=null;var _0x15cdd8=null;var _0x24b472='';return db[_0x2cc0('0x3b')][_0x2cc0('0x46')]({'where':{'id':_0x31e89e[_0x2cc0('0x40')]['id']},'attributes':['id','name','username',_0x2cc0('0x52'),_0x2cc0('0x53'),_0x2cc0('0x54'),_0x2cc0('0x55'),_0x2cc0('0x56')]})['then'](handleEntityNotFound(_0x2c08b7,null))[_0x2cc0('0x23')](function(_0x3ad5ca){if(_0x3ad5ca){_0x1f784b=_0x3ad5ca['username'];_0x57d451=_0x3ad5ca['accessKey'];_0x4185f9=_0x3ad5ca[_0x2cc0('0x53')];_0x24b472=_0x3ad5ca[_0x2cc0('0x54')];var _0x56d882=_0x24b472['slice'](-0x1);if(_0x56d882==='/'){_0x24b472=_0x24b472[_0x2cc0('0x57')](0x0,_0x24b472[_0x2cc0('0x58')](_0x56d882));}_0x15cdd8=util['format'](_0x2cc0('0x59'),_0x24b472);var _0x231f8e={'method':_0x2cc0('0x5a'),'uri':_0x15cdd8,'qs':{'operation':_0x2cc0('0x5b'),'username':_0x3ad5ca[_0x2cc0('0x5c')]},'json':!![]};return rp(_0x231f8e);}})['then'](function(_0x118f15){if(_0x118f15[_0x2cc0('0x5d')]){var _0x2f18c5={'method':_0x2cc0('0x5e'),'uri':_0x15cdd8,'form':{'operation':'login','username':_0x1f784b,'accessKey':md5(_0x118f15[_0x2cc0('0x5f')][_0x2cc0('0x60')]+_0x57d451)},'json':!![]};return rp(_0x2f18c5);}})[_0x2cc0('0x23')](function(_0x221a41){if(_0x221a41[_0x2cc0('0x5d')]){var _0x1e215d={'method':_0x2cc0('0x5a'),'uri':_0x15cdd8,'qs':{'operation':_0x2cc0('0x61'),'username':_0x1f784b,'sessionName':_0x221a41['result'][_0x2cc0('0x62')],'elementType':_0x4185f9},'json':!![]};return rp(_0x1e215d);}})[_0x2cc0('0x23')](function(_0x3e673f){if(_0x3e673f[_0x2cc0('0x5d')]){var _0x2a4131=[_0x2cc0('0x63'),_0x2cc0('0x64'),_0x2cc0('0x65')];_[_0x2cc0('0x66')](_0x3e673f[_0x2cc0('0x5f')][_0x2cc0('0x30')],function(_0xed852a){return _0x2a4131[_0x2cc0('0x67')](_0xed852a[_0x2cc0('0x2a')]['name']);});_[_0x2cc0('0x66')](_0x3e673f[_0x2cc0('0x5f')][_0x2cc0('0x30')],function(_0x5719ca){return _0x5719ca[_0x2cc0('0x68')]===_0x2cc0('0x69');});return{'count':_0x3e673f['result']['fields']['length'],'rows':_[_0x2cc0('0x28')](_0x3e673f['result'][_0x2cc0('0x30')],function(_0x43fc2a){return{'id':_0x43fc2a[_0x2cc0('0x26')],'name':_0x43fc2a[_0x2cc0('0x6a')],'custom':_[_0x2cc0('0x6b')](_0x43fc2a[_0x2cc0('0x26')],'cf_')?!![]:![],'options':_0x43fc2a[_0x2cc0('0x2a')]['name']===_0x2cc0('0x6c')&&_0x43fc2a[_0x2cc0('0x2a')]['picklistValues'][_0x2cc0('0x32')]>0x0?_[_0x2cc0('0x28')](_0x43fc2a[_0x2cc0('0x2a')][_0x2cc0('0x6d')],function(_0x4283bb){return{'name':_0x4283bb[_0x2cc0('0x6a')],'value':_0x4283bb[_0x2cc0('0x6e')]};}):[]};})};}})[_0x2cc0('0x23')](respondWithResult(_0x2c08b7,null))[_0x2cc0('0x3e')](function(_0x28e685){console[_0x2cc0('0x6f')](_0x2cc0('0x70')+_0x28e685);var _0x31d795=_0x31e89e[_0x2cc0('0x2b')][_0x2cc0('0x71')]?0x1f4:_0x28e685[_0x2cc0('0x72')]||0x1f4;logger[_0x2cc0('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0x2cc0('0x51'),_0x31d795,JSON[_0x2cc0('0x73')](_0x28e685));delete _0x28e685[_0x2cc0('0x26')];if(_0x31d795===0x191){_0x31d795=0x190;}_0x2c08b7['status'](_0x31d795)[_0x2cc0('0x27')](_0x31e89e[_0x2cc0('0x2b')][_0x2cc0('0x71')]?{'message':_0x2cc0('0x74'),'statusCode':_0x28e685['statusCode']}:_0x28e685);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 2972d77..f97e4a9 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 _0xcc09=['request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','define','VtigerAccount','lodash','util','../../config/logger','api','bluebird'];(function(_0x4675d5,_0x235c85){var _0x2e9f01=function(_0x17a40d){while(--_0x17a40d){_0x4675d5['push'](_0x4675d5['shift']());}};_0x2e9f01(++_0x235c85);}(_0xcc09,0xcb));var _0x9cc0=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xcc09[_0x255d5b];return _0x3e141a;};'use strict';var _=require(_0x9cc0('0x0'));var util=require(_0x9cc0('0x1'));var logger=require(_0x9cc0('0x2'))(_0x9cc0('0x3'));var moment=require('moment');var BPromise=require(_0x9cc0('0x4'));var rp=require(_0x9cc0('0x5'));var fs=require('fs');var path=require(_0x9cc0('0x6'));var rimraf=require(_0x9cc0('0x7'));var config=require(_0x9cc0('0x8'));var attributes=require(_0x9cc0('0x9'));var integrations=require(_0x9cc0('0xa'));module['exports']=function(_0x393350,_0x570aa0){return _0x393350[_0x9cc0('0xb')](_0x9cc0('0xc'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x49d8=['../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./intVtigerAccount.attributes'];(function(_0x325194,_0x44d1fb){var _0x40039e=function(_0x1c9759){while(--_0x1c9759){_0x325194['push'](_0x325194['shift']());}};_0x40039e(++_0x44d1fb);}(_0x49d8,0x17f));var _0x849d=function(_0x312d02,_0x2c7665){_0x312d02=_0x312d02-0x0;var _0x563803=_0x49d8[_0x312d02];return _0x563803;};'use strict';var _=require(_0x849d('0x0'));var util=require(_0x849d('0x1'));var logger=require('../../config/logger')(_0x849d('0x2'));var moment=require(_0x849d('0x3'));var BPromise=require(_0x849d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x849d('0x5'));var rimraf=require(_0x849d('0x6'));var config=require(_0x849d('0x7'));var attributes=require(_0x849d('0x8'));var integrations=require(_0x849d('0x9'));module[_0x849d('0xa')]=function(_0x39e86c,_0x1b1792){return _0x39e86c[_0x849d('0xb')](_0x849d('0xc'),attributes,{'tableName':_0x849d('0xd'),'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 57b7a58..da20226 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 _0x750a=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','catch','options','raw','attributes','limit','model','include','map','GetVtigerAccount','ShowVtigerAccount','VtigerAccount','where'];(function(_0x3f5da1,_0x302c0b){var _0x3ff670=function(_0x5a6ab7){while(--_0x5a6ab7){_0x3f5da1['push'](_0x3f5da1['shift']());}};_0x3ff670(++_0x302c0b);}(_0x750a,0x140));var _0xa750=function(_0x3054d9,_0x440a5c){_0x3054d9=_0x3054d9-0x0;var _0xb2f736=_0x750a[_0x3054d9];return _0xb2f736;};'use strict';var _=require('lodash');var util=require(_0xa750('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa750('0x1'));var fs=require('fs');var Redis=require(_0xa750('0x2'));var db=require(_0xa750('0x3'))['db'];var utils=require(_0xa750('0x4'));var logger=require(_0xa750('0x5'))(_0xa750('0x6'));var config=require(_0xa750('0x7'));var jayson=require(_0xa750('0x8'));var client=jayson[_0xa750('0x9')][_0xa750('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x197299,_0x1ae455,_0x3d7c43){return new BPromise(function(_0x47a4dd,_0x53f2cb){return client[_0xa750('0xb')](_0x197299,_0x3d7c43)['then'](function(_0x4458b1){logger[_0xa750('0xc')]('VtigerAccount,\x20%s,\x20%s',_0x1ae455,_0xa750('0xd'));logger[_0xa750('0xe')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x1ae455,'request\x20sent',JSON[_0xa750('0xf')](_0x4458b1));if(_0x4458b1['error']){if(_0x4458b1[_0xa750('0x10')][_0xa750('0x11')]===0x1f4){logger['error'](_0xa750('0x12'),_0x1ae455,_0x4458b1[_0xa750('0x10')][_0xa750('0x13')]);return _0x53f2cb(_0x4458b1['error'][_0xa750('0x13')]);}logger[_0xa750('0x10')](_0xa750('0x12'),_0x1ae455,_0x4458b1[_0xa750('0x10')][_0xa750('0x13')]);return _0x47a4dd(_0x4458b1[_0xa750('0x10')]['message']);}else{logger[_0xa750('0xc')](_0xa750('0x12'),_0x1ae455,_0xa750('0xd'));_0x47a4dd(_0x4458b1['result'][_0xa750('0x13')]);}})[_0xa750('0x14')](function(_0x58639b){logger['error'](_0xa750('0x12'),_0x1ae455,_0x58639b);_0x53f2cb(_0x58639b);});});}exports['GetVtigerAccount']=function(_0x433dbd){var _0x1bde87=this;return new Promise(function(_0x4f1faa,_0x36dcca){return db['VtigerAccount']['findAll']({'raw':_0x433dbd[_0xa750('0x15')]?_0x433dbd['options'][_0xa750('0x16')]===undefined?!![]:![]:!![],'where':_0x433dbd['options']?_0x433dbd[_0xa750('0x15')]['where']||null:null,'attributes':_0x433dbd[_0xa750('0x15')]?_0x433dbd['options'][_0xa750('0x17')]||null:null,'limit':_0x433dbd['options']?_0x433dbd['options'][_0xa750('0x18')]||null:null,'include':_0x433dbd['options']?_0x433dbd[_0xa750('0x15')]['include']?_['map'](_0x433dbd['options']['include'],function(_0x15d72f){return{'model':db[_0x15d72f[_0xa750('0x19')]],'as':_0x15d72f['as'],'attributes':_0x15d72f[_0xa750('0x17')],'include':_0x15d72f[_0xa750('0x1a')]?_[_0xa750('0x1b')](_0x15d72f[_0xa750('0x1a')],function(_0x3001bc){return{'model':db[_0x3001bc[_0xa750('0x19')]],'as':_0x3001bc['as'],'attributes':_0x3001bc[_0xa750('0x17')],'include':_0x3001bc[_0xa750('0x1a')]?_[_0xa750('0x1b')](_0x3001bc[_0xa750('0x1a')],function(_0x31ea63){return{'model':db[_0x31ea63[_0xa750('0x19')]],'as':_0x31ea63['as'],'attributes':_0x31ea63[_0xa750('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d3923){logger[_0xa750('0xc')](_0xa750('0x1c'),_0x433dbd);logger['debug'](_0xa750('0x1c'),_0x433dbd,JSON[_0xa750('0xf')](_0x3d3923));_0x4f1faa(_0x3d3923);})[_0xa750('0x14')](function(_0x1223d2){logger['error'](_0xa750('0x1c'),_0x1223d2[_0xa750('0x13')],_0x433dbd);_0x36dcca(_0x1bde87[_0xa750('0x10')](0x1f4,_0x1223d2[_0xa750('0x13')]));});});};exports[_0xa750('0x1d')]=function(_0x59ab33){var _0x46cc11=this;return new Promise(function(_0x4c2c9e,_0x2d0e93){return db[_0xa750('0x1e')]['find']({'raw':_0x59ab33[_0xa750('0x15')]?_0x59ab33[_0xa750('0x15')][_0xa750('0x16')]===undefined?!![]:![]:!![],'where':_0x59ab33[_0xa750('0x15')]?_0x59ab33[_0xa750('0x15')][_0xa750('0x1f')]||null:null,'attributes':_0x59ab33[_0xa750('0x15')]?_0x59ab33[_0xa750('0x15')]['attributes']||null:null,'include':_0x59ab33[_0xa750('0x15')]?_0x59ab33['options'][_0xa750('0x1a')]?_[_0xa750('0x1b')](_0x59ab33[_0xa750('0x15')][_0xa750('0x1a')],function(_0x556fde){return{'model':db[_0x556fde[_0xa750('0x19')]],'as':_0x556fde['as'],'attributes':_0x556fde[_0xa750('0x17')],'include':_0x556fde['include']?_[_0xa750('0x1b')](_0x556fde[_0xa750('0x1a')],function(_0x280b87){return{'model':db[_0x280b87[_0xa750('0x19')]],'as':_0x280b87['as'],'attributes':_0x280b87['attributes'],'include':_0x280b87[_0xa750('0x1a')]?_['map'](_0x280b87['include'],function(_0x4e59f3){return{'model':db[_0x4e59f3[_0xa750('0x19')]],'as':_0x4e59f3['as'],'attributes':_0x4e59f3[_0xa750('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x470089){logger[_0xa750('0xc')](_0xa750('0x1d'),_0x59ab33);logger['debug'](_0xa750('0x1d'),_0x59ab33,JSON[_0xa750('0xf')](_0x470089));_0x4c2c9e(_0x470089);})[_0xa750('0x14')](function(_0x5d402a){logger[_0xa750('0x10')](_0xa750('0x1d'),_0x5d402a[_0xa750('0x13')],_0x59ab33);_0x2d0e93(_0x46cc11['error'](0x1f4,_0x5d402a[_0xa750('0x13')]));});});}; \ No newline at end of file +var _0x34b7=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','map','include','model','then','ShowVtigerAccount','find','moment','bluebird'];(function(_0x3a2562,_0x2acdef){var _0x59eb58=function(_0x1b5e69){while(--_0x1b5e69){_0x3a2562['push'](_0x3a2562['shift']());}};_0x59eb58(++_0x2acdef);}(_0x34b7,0x196));var _0x734b=function(_0x3c371a,_0x3893fa){_0x3c371a=_0x3c371a-0x0;var _0x1ad099=_0x34b7[_0x3c371a];return _0x1ad099;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x734b('0x0'));var BPromise=require(_0x734b('0x1'));var rs=require(_0x734b('0x2'));var fs=require('fs');var Redis=require(_0x734b('0x3'));var db=require(_0x734b('0x4'))['db'];var utils=require(_0x734b('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x734b('0x6'));var jayson=require(_0x734b('0x7'));var client=jayson[_0x734b('0x8')][_0x734b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28918a,_0x35d685,_0x58e2f1){return new BPromise(function(_0x1eb803,_0x2e7932){return client['request'](_0x28918a,_0x58e2f1)['then'](function(_0x5f4b3a){logger[_0x734b('0xa')]('VtigerAccount,\x20%s,\x20%s',_0x35d685,_0x734b('0xb'));logger[_0x734b('0xc')](_0x734b('0xd'),_0x35d685,_0x734b('0xb'),JSON[_0x734b('0xe')](_0x5f4b3a));if(_0x5f4b3a[_0x734b('0xf')]){if(_0x5f4b3a[_0x734b('0xf')][_0x734b('0x10')]===0x1f4){logger[_0x734b('0xf')](_0x734b('0x11'),_0x35d685,_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);return _0x2e7932(_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);}logger['error'](_0x734b('0x11'),_0x35d685,_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);return _0x1eb803(_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);}else{logger[_0x734b('0xa')](_0x734b('0x11'),_0x35d685,_0x734b('0xb'));_0x1eb803(_0x5f4b3a[_0x734b('0x13')][_0x734b('0x12')]);}})[_0x734b('0x14')](function(_0x4d2d23){logger[_0x734b('0xf')](_0x734b('0x11'),_0x35d685,_0x4d2d23);_0x2e7932(_0x4d2d23);});});}exports[_0x734b('0x15')]=function(_0x5edbe9){var _0x4d3b9c=this;return new Promise(function(_0x56a95c,_0xcd12a1){return db[_0x734b('0x16')][_0x734b('0x17')]({'raw':_0x5edbe9[_0x734b('0x18')]?_0x5edbe9[_0x734b('0x18')][_0x734b('0x19')]===undefined?!![]:![]:!![],'where':_0x5edbe9[_0x734b('0x18')]?_0x5edbe9[_0x734b('0x18')][_0x734b('0x1a')]||null:null,'attributes':_0x5edbe9[_0x734b('0x18')]?_0x5edbe9[_0x734b('0x18')][_0x734b('0x1b')]||null:null,'limit':_0x5edbe9[_0x734b('0x18')]?_0x5edbe9[_0x734b('0x18')]['limit']||null:null,'include':_0x5edbe9[_0x734b('0x18')]?_0x5edbe9[_0x734b('0x18')]['include']?_[_0x734b('0x1c')](_0x5edbe9[_0x734b('0x18')][_0x734b('0x1d')],function(_0x11fb8e){return{'model':db[_0x11fb8e[_0x734b('0x1e')]],'as':_0x11fb8e['as'],'attributes':_0x11fb8e[_0x734b('0x1b')],'include':_0x11fb8e[_0x734b('0x1d')]?_[_0x734b('0x1c')](_0x11fb8e[_0x734b('0x1d')],function(_0x3abbe6){return{'model':db[_0x3abbe6[_0x734b('0x1e')]],'as':_0x3abbe6['as'],'attributes':_0x3abbe6[_0x734b('0x1b')],'include':_0x3abbe6[_0x734b('0x1d')]?_['map'](_0x3abbe6['include'],function(_0x13cc5a){return{'model':db[_0x13cc5a[_0x734b('0x1e')]],'as':_0x13cc5a['as'],'attributes':_0x13cc5a['attributes']};}):[]};}):[]};}):[]:[]})[_0x734b('0x1f')](function(_0x2dd51a){logger[_0x734b('0xa')](_0x734b('0x15'),_0x5edbe9);logger[_0x734b('0xc')](_0x734b('0x15'),_0x5edbe9,JSON[_0x734b('0xe')](_0x2dd51a));_0x56a95c(_0x2dd51a);})['catch'](function(_0x1f3652){logger[_0x734b('0xf')](_0x734b('0x15'),_0x1f3652[_0x734b('0x12')],_0x5edbe9);_0xcd12a1(_0x4d3b9c[_0x734b('0xf')](0x1f4,_0x1f3652[_0x734b('0x12')]));});});};exports[_0x734b('0x20')]=function(_0x21ed3c){var _0x371ead=this;return new Promise(function(_0x3065b0,_0x5dcabf){return db[_0x734b('0x16')][_0x734b('0x21')]({'raw':_0x21ed3c['options']?_0x21ed3c[_0x734b('0x18')][_0x734b('0x19')]===undefined?!![]:![]:!![],'where':_0x21ed3c[_0x734b('0x18')]?_0x21ed3c[_0x734b('0x18')][_0x734b('0x1a')]||null:null,'attributes':_0x21ed3c[_0x734b('0x18')]?_0x21ed3c[_0x734b('0x18')][_0x734b('0x1b')]||null:null,'include':_0x21ed3c[_0x734b('0x18')]?_0x21ed3c[_0x734b('0x18')][_0x734b('0x1d')]?_[_0x734b('0x1c')](_0x21ed3c[_0x734b('0x18')][_0x734b('0x1d')],function(_0x4512fc){return{'model':db[_0x4512fc['model']],'as':_0x4512fc['as'],'attributes':_0x4512fc[_0x734b('0x1b')],'include':_0x4512fc['include']?_[_0x734b('0x1c')](_0x4512fc[_0x734b('0x1d')],function(_0x3413bf){return{'model':db[_0x3413bf[_0x734b('0x1e')]],'as':_0x3413bf['as'],'attributes':_0x3413bf[_0x734b('0x1b')],'include':_0x3413bf[_0x734b('0x1d')]?_['map'](_0x3413bf['include'],function(_0x3460a0){return{'model':db[_0x3460a0['model']],'as':_0x3460a0['as'],'attributes':_0x3460a0[_0x734b('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2de959){logger['info'](_0x734b('0x20'),_0x21ed3c);logger['debug'](_0x734b('0x20'),_0x21ed3c,JSON[_0x734b('0xe')](_0x2de959));_0x3065b0(_0x2de959);})[_0x734b('0x14')](function(_0x34a504){logger[_0x734b('0xf')](_0x734b('0x20'),_0x34a504[_0x734b('0x12')],_0x21ed3c);_0x5dcabf(_0x371ead['error'](0x1f4,_0x34a504[_0x734b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 48be2a5..546632f 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 _0xb7e9=['path','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id','update','delete','destroy','multer','util'];(function(_0x2addc4,_0xb13cc4){var _0x20e376=function(_0x46cec1){while(--_0x46cec1){_0x2addc4['push'](_0x2addc4['shift']());}};_0x20e376(++_0xb13cc4);}(_0xb7e9,0x1b3));var _0x9b7e=function(_0x5c6c64,_0x12d4cb){_0x5c6c64=_0x5c6c64-0x0;var _0x172174=_0xb7e9[_0x5c6c64];return _0x172174;};'use strict';var multer=require(_0x9b7e('0x0'));var util=require(_0x9b7e('0x1'));var path=require(_0x9b7e('0x2'));var timeout=require('connect-timeout');var express=require(_0x9b7e('0x3'));var router=express[_0x9b7e('0x4')]();var fs_extra=require(_0x9b7e('0x5'));var auth=require(_0x9b7e('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intVtigerConfiguration.controller');router[_0x9b7e('0x7')]('/',auth[_0x9b7e('0x8')](),controller[_0x9b7e('0x9')]);router[_0x9b7e('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x9b7e('0xa')]);router[_0x9b7e('0x7')]('/:id/fields',auth[_0x9b7e('0x8')](),controller['getFields']);router[_0x9b7e('0x7')](_0x9b7e('0xb'),auth[_0x9b7e('0x8')](),controller[_0x9b7e('0xc')]);router['get'](_0x9b7e('0xd'),auth['isAuthenticated'](),controller[_0x9b7e('0xe')]);router['post']('/',auth[_0x9b7e('0x8')](),controller['create']);router['put'](_0x9b7e('0xf'),auth['isAuthenticated'](),controller[_0x9b7e('0x10')]);router[_0x9b7e('0x11')](_0x9b7e('0xf'),auth[_0x9b7e('0x8')](),controller[_0x9b7e('0x12')]);module['exports']=router; \ No newline at end of file +var _0x8360=['getDescriptions','post','create','update','destroy','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','./intVtigerConfiguration.controller','isAuthenticated','get','/:id','/:id/fields','getFields','/:id/subjects'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x8360,0x114));var _0x0836=function(_0x239db9,_0x536ad8){_0x239db9=_0x239db9-0x0;var _0x1ae137=_0x8360[_0x239db9];return _0x1ae137;};'use strict';var multer=require(_0x0836('0x0'));var util=require(_0x0836('0x1'));var path=require(_0x0836('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0836('0x3'));var interaction=require(_0x0836('0x4'));var config=require('../../config/environment');var controller=require(_0x0836('0x5'));router['get']('/',auth[_0x0836('0x6')](),controller['index']);router[_0x0836('0x7')](_0x0836('0x8'),auth[_0x0836('0x6')](),controller['show']);router[_0x0836('0x7')](_0x0836('0x9'),auth[_0x0836('0x6')](),controller[_0x0836('0xa')]);router[_0x0836('0x7')](_0x0836('0xb'),auth[_0x0836('0x6')](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0x0836('0x6')](),controller[_0x0836('0xc')]);router[_0x0836('0xd')]('/',auth[_0x0836('0x6')](),controller[_0x0836('0xe')]);router['put']('/:id',auth[_0x0836('0x6')](),controller[_0x0836('0xf')]);router['delete']('/:id',auth[_0x0836('0x6')](),controller[_0x0836('0x10')]);module[_0x0836('0x11')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 21865b7..7ad7ede 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 _0x3ab6=['STRING','sequelize','exports'];(function(_0x21dc5b,_0x36d805){var _0x531399=function(_0x52d796){while(--_0x52d796){_0x21dc5b['push'](_0x21dc5b['shift']());}};_0x531399(++_0x36d805);}(_0x3ab6,0x115));var _0x63ab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ab6[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x63ab('0x0'));module[_0x63ab('0x1')]={'name':{'type':Sequelize[_0x63ab('0x2')]},'description':{'type':Sequelize[_0x63ab('0x2')]}}; \ No newline at end of file +var _0xef11=['exports','STRING','sequelize'];(function(_0x4254e7,_0x4fc342){var _0x5e0844=function(_0x3a92c7){while(--_0x3a92c7){_0x4254e7['push'](_0x4254e7['shift']());}};_0x5e0844(++_0x4fc342);}(_0xef11,0x13d));var _0x1ef1=function(_0x2405bc,_0x2f28a1){_0x2405bc=_0x2405bc-0x0;var _0x5272d4=_0xef11[_0x2405bc];return _0x5272d4;};'use strict';var Sequelize=require(_0x1ef1('0x0'));module[_0x1ef1('0x1')]={'name':{'type':Sequelize[_0x1ef1('0x2')]},'description':{'type':Sequelize[_0x1ef1('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 6c6290e..152dad9 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 _0x863e=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','save','update','destroy','then','error','name','send','index','VtigerConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','findOne','VtigerField','order','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x2fb648,_0x2c4e7a){var _0x18341b=function(_0x3e0c2a){while(--_0x3e0c2a){_0x2fb648['push'](_0x2fb648['shift']());}};_0x18341b(++_0x2c4e7a);}(_0x863e,0x1f1));var _0xe863=function(_0x53c148,_0x5b5327){_0x53c148=_0x53c148-0x0;var _0x59377d=_0x863e[_0x53c148];return _0x59377d;};'use strict';var emlformat=require(_0xe863('0x0'));var rimraf=require(_0xe863('0x1'));var zipdir=require(_0xe863('0x2'));var jsonpatch=require(_0xe863('0x3'));var rp=require(_0xe863('0x4'));var moment=require(_0xe863('0x5'));var BPromise=require(_0xe863('0x6'));var Mustache=require('mustache');var util=require(_0xe863('0x7'));var path=require(_0xe863('0x8'));var sox=require(_0xe863('0x9'));var csv=require(_0xe863('0xa'));var ejs=require(_0xe863('0xb'));var fs=require('fs');var fs_extra=require(_0xe863('0xc'));var _=require(_0xe863('0xd'));var squel=require(_0xe863('0xe'));var crypto=require('crypto');var jsforce=require(_0xe863('0xf'));var deskjs=require(_0xe863('0x10'));var toCsv=require(_0xe863('0xa'));var querystring=require(_0xe863('0x11'));var Papa=require(_0xe863('0x12'));var Redis=require(_0xe863('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xe863('0x14'));var as=require(_0xe863('0x15'));var hardwareService=require(_0xe863('0x16'));var logger=require(_0xe863('0x17'))(_0xe863('0x18'));var utils=require(_0xe863('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe863('0x1a'))['db'];function respondWithStatusCode(_0x509fe8,_0xc9516f){_0xc9516f=_0xc9516f||0xcc;return function(_0x34ba45){if(_0x34ba45){return _0x509fe8[_0xe863('0x1b')](_0xc9516f);}return _0x509fe8[_0xe863('0x1c')](_0xc9516f)[_0xe863('0x1d')]();};}function respondWithResult(_0x3c459b,_0x4c2f88){_0x4c2f88=_0x4c2f88||0xc8;return function(_0x1e4b68){if(_0x1e4b68){return _0x3c459b['status'](_0x4c2f88)[_0xe863('0x1e')](_0x1e4b68);}};}function respondWithFilteredResult(_0x588c52,_0xe3a9c6){return function(_0x3a24b9){if(_0x3a24b9){var _0x1c13ea=typeof _0xe3a9c6[_0xe863('0x1f')]===_0xe863('0x20')&&typeof _0xe3a9c6['limit']===_0xe863('0x20');var _0x2d6675=_0x3a24b9[_0xe863('0x21')];var _0x4c659f=_0x1c13ea?0x0:_0xe3a9c6[_0xe863('0x1f')];var _0x115ebd=_0x1c13ea?_0x3a24b9[_0xe863('0x21')]:_0xe3a9c6[_0xe863('0x1f')]+_0xe3a9c6[_0xe863('0x22')];var _0x18009c;if(_0x115ebd>=_0x2d6675){_0x115ebd=_0x2d6675;_0x18009c=0xc8;}else{_0x18009c=0xce;}_0x588c52[_0xe863('0x1c')](_0x18009c);return _0x588c52['set']('Content-Range',_0x4c659f+'-'+_0x115ebd+'/'+_0x2d6675)[_0xe863('0x1e')](_0x3a24b9);}return null;};}function patchUpdates(_0x1fa45e){return function(_0xa7588c){try{jsonpatch[_0xe863('0x23')](_0xa7588c,_0x1fa45e,!![]);}catch(_0x297488){return BPromise[_0xe863('0x24')](_0x297488);}return _0xa7588c[_0xe863('0x25')]();};}function saveUpdates(_0x43e91f,_0x38fffb){return function(_0x5c8cd7){if(_0x5c8cd7){return _0x5c8cd7[_0xe863('0x26')](_0x43e91f)['then'](function(_0x2003a8){return _0x2003a8;});}return null;};}function removeEntity(_0x418de9,_0x2f6a36){return function(_0x3c8542){if(_0x3c8542){return _0x3c8542[_0xe863('0x27')]()[_0xe863('0x28')](function(){_0x418de9[_0xe863('0x1c')](0xcc)[_0xe863('0x1d')]();});}};}function handleEntityNotFound(_0x29467f,_0x54117e){return function(_0x36a4f8){if(!_0x36a4f8){_0x29467f[_0xe863('0x1b')](0x194);}return _0x36a4f8;};}function handleError(_0x12f1b5,_0x1e2001){_0x1e2001=_0x1e2001||0x1f4;return function(_0x3bde2e){logger[_0xe863('0x29')](_0x3bde2e['stack']);if(_0x3bde2e['name']){delete _0x3bde2e[_0xe863('0x2a')];}_0x12f1b5[_0xe863('0x1c')](_0x1e2001)[_0xe863('0x2b')](_0x3bde2e);};}exports[_0xe863('0x2c')]=function(_0x52ab4b,_0x3a302a){var _0x33d070={},_0x2aafea={},_0x436ecb={'count':0x0,'rows':[]};var _0xb7d017=_['map'](db[_0xe863('0x2d')][_0xe863('0x2e')],function(_0x385e23){return{'name':_0x385e23[_0xe863('0x2f')],'type':_0x385e23[_0xe863('0x30')][_0xe863('0x31')]};});_0x2aafea['model']=_['map'](_0xb7d017,_0xe863('0x2a'));_0x2aafea[_0xe863('0x32')]=_[_0xe863('0x33')](_0x52ab4b[_0xe863('0x32')]);_0x2aafea[_0xe863('0x34')]=_[_0xe863('0x35')](_0x2aafea[_0xe863('0x36')],_0x2aafea['query']);_0x33d070[_0xe863('0x37')]=_['intersection'](_0x2aafea[_0xe863('0x36')],qs[_0xe863('0x38')](_0x52ab4b[_0xe863('0x32')][_0xe863('0x38')]));_0x33d070[_0xe863('0x37')]=_0x33d070[_0xe863('0x37')][_0xe863('0x39')]?_0x33d070[_0xe863('0x37')]:_0x2aafea[_0xe863('0x36')];if(!_0x52ab4b['query']['hasOwnProperty'](_0xe863('0x3a'))){_0x33d070[_0xe863('0x22')]=qs['limit'](_0x52ab4b[_0xe863('0x32')][_0xe863('0x22')]);_0x33d070[_0xe863('0x1f')]=qs[_0xe863('0x1f')](_0x52ab4b[_0xe863('0x32')][_0xe863('0x1f')]);}_0x33d070['order']=qs[_0xe863('0x3b')](_0x52ab4b[_0xe863('0x32')][_0xe863('0x3b')]);_0x33d070[_0xe863('0x3c')]=qs[_0xe863('0x34')](_[_0xe863('0x3d')](_0x52ab4b[_0xe863('0x32')],_0x2aafea[_0xe863('0x34')]),_0xb7d017);if(_0x52ab4b[_0xe863('0x32')][_0xe863('0x3e')]){_0x33d070[_0xe863('0x3c')]=_[_0xe863('0x3f')](_0x33d070[_0xe863('0x3c')],{'$or':_[_0xe863('0x40')](_0xb7d017,function(_0x51d783){if(_0x51d783[_0xe863('0x30')]!==_0xe863('0x41')){var _0x503773={};_0x503773[_0x51d783[_0xe863('0x2a')]]={'$like':'%'+_0x52ab4b['query'][_0xe863('0x3e')]+'%'};return _0x503773;}})});}_0x33d070=_[_0xe863('0x3f')]({},_0x33d070,_0x52ab4b[_0xe863('0x42')]);var _0x5c46f2={'where':_0x33d070[_0xe863('0x3c')]};return db[_0xe863('0x2d')][_0xe863('0x21')](_0x5c46f2)[_0xe863('0x28')](function(_0x2b2bb1){_0x436ecb[_0xe863('0x21')]=_0x2b2bb1;if(_0x52ab4b[_0xe863('0x32')][_0xe863('0x43')]){_0x33d070[_0xe863('0x44')]=[{'all':!![]}];}return db[_0xe863('0x2d')][_0xe863('0x45')](_0x33d070);})[_0xe863('0x28')](function(_0x2184fb){_0x436ecb[_0xe863('0x46')]=_0x2184fb;return _0x436ecb;})[_0xe863('0x28')](respondWithFilteredResult(_0x3a302a,_0x33d070))[_0xe863('0x47')](handleError(_0x3a302a,null));};exports[_0xe863('0x48')]=function(_0x5b76eb,_0x4d3da4){var _0xb3feef={'raw':![],'where':{'id':_0x5b76eb[_0xe863('0x49')]['id']}},_0x334f3d={};_0x334f3d[_0xe863('0x36')]=_[_0xe863('0x33')](db[_0xe863('0x2d')][_0xe863('0x2e')]);_0x334f3d[_0xe863('0x32')]=_[_0xe863('0x33')](_0x5b76eb[_0xe863('0x32')]);_0x334f3d[_0xe863('0x34')]=_['intersection'](_0x334f3d[_0xe863('0x36')],_0x334f3d[_0xe863('0x32')]);_0xb3feef[_0xe863('0x37')]=_['intersection'](_0x334f3d[_0xe863('0x36')],qs['fields'](_0x5b76eb['query'][_0xe863('0x38')]));_0xb3feef['attributes']=_0xb3feef[_0xe863('0x37')]['length']?_0xb3feef[_0xe863('0x37')]:_0x334f3d['model'];if(_0x5b76eb[_0xe863('0x32')]['includeAll']){_0xb3feef['include']=[{'all':!![]}];}_0xb3feef=_[_0xe863('0x3f')]({},_0xb3feef,_0x5b76eb['options']);return db['VtigerConfiguration'][_0xe863('0x4a')](_0xb3feef)['then'](handleEntityNotFound(_0x4d3da4,null))[_0xe863('0x28')](respondWithResult(_0x4d3da4,null))['catch'](handleError(_0x4d3da4,null));};exports['create']=function(_0x28efa2,_0x3c090b){return db['VtigerConfiguration'][_0xe863('0x4b')](_0x28efa2[_0xe863('0x4c')],{})[_0xe863('0x28')](respondWithResult(_0x3c090b,0xc9))['catch'](handleError(_0x3c090b,null));};exports[_0xe863('0x26')]=function(_0x10ceaa,_0x337c52){if(_0x10ceaa['body']['id']){delete _0x10ceaa[_0xe863('0x4c')]['id'];}return db[_0xe863('0x2d')][_0xe863('0x4a')]({'where':{'id':_0x10ceaa[_0xe863('0x49')]['id']}})[_0xe863('0x28')](handleEntityNotFound(_0x337c52,null))[_0xe863('0x28')](saveUpdates(_0x10ceaa[_0xe863('0x4c')],null))[_0xe863('0x28')](respondWithResult(_0x337c52,null))['catch'](handleError(_0x337c52,null));};exports['destroy']=function(_0x28c15f,_0xf851e4){return db[_0xe863('0x2d')][_0xe863('0x4a')]({'where':{'id':_0x28c15f['params']['id']}})[_0xe863('0x28')](handleEntityNotFound(_0xf851e4,null))[_0xe863('0x28')](removeEntity(_0xf851e4,null))[_0xe863('0x47')](handleError(_0xf851e4,null));};exports[_0xe863('0x4d')]=function(_0xb34f01,_0x12f9b3,_0x4ab297){var _0x56e765={};var _0x1b9f20={};var _0x29ff2c;var _0xd64824;return db[_0xe863('0x2d')][_0xe863('0x4e')]({'where':{'id':_0xb34f01[_0xe863('0x49')]['id']}})[_0xe863('0x28')](handleEntityNotFound(_0x12f9b3,null))['then'](function(_0x5699e0){if(_0x5699e0){_0x29ff2c=_0x5699e0;_0x1b9f20[_0xe863('0x36')]=_[_0xe863('0x33')](db[_0xe863('0x4f')][_0xe863('0x2e')]);_0x1b9f20['query']=_[_0xe863('0x33')](_0xb34f01[_0xe863('0x32')]);_0x1b9f20['filters']=_[_0xe863('0x35')](_0x1b9f20['model'],_0x1b9f20[_0xe863('0x32')]);_0x56e765[_0xe863('0x37')]=_[_0xe863('0x35')](_0x1b9f20[_0xe863('0x36')],qs['fields'](_0xb34f01[_0xe863('0x32')][_0xe863('0x38')]));_0x56e765['attributes']=_0x56e765[_0xe863('0x37')][_0xe863('0x39')]?_0x56e765[_0xe863('0x37')]:_0x1b9f20[_0xe863('0x36')];_0x56e765[_0xe863('0x50')]=qs[_0xe863('0x3b')](_0xb34f01[_0xe863('0x32')][_0xe863('0x3b')]);_0x56e765[_0xe863('0x3c')]=qs[_0xe863('0x34')](_[_0xe863('0x3d')](_0xb34f01[_0xe863('0x32')],_0x1b9f20['filters']));if(_0xb34f01[_0xe863('0x32')][_0xe863('0x3e')]){_0x56e765[_0xe863('0x3c')]=_[_0xe863('0x3f')](_0x56e765[_0xe863('0x3c')],{'$or':_['map'](_0x56e765['attributes'],function(_0x5809e1){var _0x1c705d={};_0x1c705d[_0x5809e1]={'$like':'%'+_0xb34f01['query']['filter']+'%'};return _0x1c705d;})});}_0x56e765=_[_0xe863('0x3f')]({},_0x56e765,_0xb34f01['options']);return _0x29ff2c[_0xe863('0x4d')](_0x56e765);}})[_0xe863('0x28')](function(_0x42b911){if(_0x42b911){_0xd64824=_0x42b911[_0xe863('0x39')];if(!_0xb34f01[_0xe863('0x32')][_0xe863('0x51')](_0xe863('0x3a'))){_0x56e765[_0xe863('0x22')]=qs['limit'](_0xb34f01[_0xe863('0x32')][_0xe863('0x22')]);_0x56e765[_0xe863('0x1f')]=qs[_0xe863('0x1f')](_0xb34f01[_0xe863('0x32')][_0xe863('0x1f')]);}return _0x29ff2c[_0xe863('0x4d')](_0x56e765);}})[_0xe863('0x28')](function(_0x4fe3b9){if(_0x4fe3b9){return _0x4fe3b9?{'count':_0xd64824,'rows':_0x4fe3b9}:null;}})[_0xe863('0x28')](respondWithResult(_0x12f9b3,null))[_0xe863('0x47')](handleError(_0x12f9b3,null));};exports[_0xe863('0x52')]=function(_0x2cdee3,_0x571d0e,_0x468e36){var _0x55cdde={};var _0x39279d={};var _0x44de50;var _0x3f26b6;return db[_0xe863('0x2d')]['findOne']({'where':{'id':_0x2cdee3['params']['id']}})[_0xe863('0x28')](handleEntityNotFound(_0x571d0e,null))[_0xe863('0x28')](function(_0x5e7e84){if(_0x5e7e84){_0x44de50=_0x5e7e84;_0x39279d[_0xe863('0x36')]=_[_0xe863('0x33')](db['VtigerField'][_0xe863('0x2e')]);_0x39279d['query']=_[_0xe863('0x33')](_0x2cdee3[_0xe863('0x32')]);_0x39279d[_0xe863('0x34')]=_[_0xe863('0x35')](_0x39279d[_0xe863('0x36')],_0x39279d[_0xe863('0x32')]);_0x55cdde['attributes']=_[_0xe863('0x35')](_0x39279d[_0xe863('0x36')],qs[_0xe863('0x38')](_0x2cdee3[_0xe863('0x32')][_0xe863('0x38')]));_0x55cdde[_0xe863('0x37')]=_0x55cdde[_0xe863('0x37')][_0xe863('0x39')]?_0x55cdde[_0xe863('0x37')]:_0x39279d[_0xe863('0x36')];_0x55cdde['order']=qs['sort'](_0x2cdee3[_0xe863('0x32')][_0xe863('0x3b')]);_0x55cdde[_0xe863('0x3c')]=qs[_0xe863('0x34')](_['pick'](_0x2cdee3[_0xe863('0x32')],_0x39279d[_0xe863('0x34')]));if(_0x2cdee3[_0xe863('0x32')]['filter']){_0x55cdde['where']=_[_0xe863('0x3f')](_0x55cdde[_0xe863('0x3c')],{'$or':_[_0xe863('0x40')](_0x55cdde['attributes'],function(_0x416441){var _0x5a8d6a={};_0x5a8d6a[_0x416441]={'$like':'%'+_0x2cdee3['query'][_0xe863('0x3e')]+'%'};return _0x5a8d6a;})});}_0x55cdde=_[_0xe863('0x3f')]({},_0x55cdde,_0x2cdee3[_0xe863('0x42')]);return _0x44de50['getSubjects'](_0x55cdde);}})[_0xe863('0x28')](function(_0x21da6b){if(_0x21da6b){_0x3f26b6=_0x21da6b['length'];if(!_0x2cdee3[_0xe863('0x32')][_0xe863('0x51')](_0xe863('0x3a'))){_0x55cdde[_0xe863('0x22')]=qs[_0xe863('0x22')](_0x2cdee3[_0xe863('0x32')][_0xe863('0x22')]);_0x55cdde[_0xe863('0x1f')]=qs[_0xe863('0x1f')](_0x2cdee3[_0xe863('0x32')]['offset']);}return _0x44de50['getSubjects'](_0x55cdde);}})[_0xe863('0x28')](function(_0x3488e3){if(_0x3488e3){return _0x3488e3?{'count':_0x3f26b6,'rows':_0x3488e3}:null;}})['then'](respondWithResult(_0x571d0e,null))[_0xe863('0x47')](handleError(_0x571d0e,null));};exports[_0xe863('0x53')]=function(_0x5edd01,_0x2127e9,_0x265db7){var _0x261e49={};var _0x550cb0={};var _0x2ca9bc;var _0x213ec6;return db[_0xe863('0x2d')]['findOne']({'where':{'id':_0x5edd01['params']['id']}})[_0xe863('0x28')](handleEntityNotFound(_0x2127e9,null))[_0xe863('0x28')](function(_0x8c60e9){if(_0x8c60e9){_0x2ca9bc=_0x8c60e9;_0x550cb0['model']=_[_0xe863('0x33')](db[_0xe863('0x4f')]['rawAttributes']);_0x550cb0['query']=_[_0xe863('0x33')](_0x5edd01[_0xe863('0x32')]);_0x550cb0['filters']=_[_0xe863('0x35')](_0x550cb0[_0xe863('0x36')],_0x550cb0[_0xe863('0x32')]);_0x261e49[_0xe863('0x37')]=_['intersection'](_0x550cb0[_0xe863('0x36')],qs[_0xe863('0x38')](_0x5edd01[_0xe863('0x32')][_0xe863('0x38')]));_0x261e49[_0xe863('0x37')]=_0x261e49[_0xe863('0x37')][_0xe863('0x39')]?_0x261e49[_0xe863('0x37')]:_0x550cb0[_0xe863('0x36')];_0x261e49['order']=qs[_0xe863('0x3b')](_0x5edd01[_0xe863('0x32')]['sort']);_0x261e49['where']=qs[_0xe863('0x34')](_[_0xe863('0x3d')](_0x5edd01[_0xe863('0x32')],_0x550cb0[_0xe863('0x34')]));if(_0x5edd01[_0xe863('0x32')][_0xe863('0x3e')]){_0x261e49[_0xe863('0x3c')]=_[_0xe863('0x3f')](_0x261e49[_0xe863('0x3c')],{'$or':_[_0xe863('0x40')](_0x261e49[_0xe863('0x37')],function(_0x93655d){var _0x4df762={};_0x4df762[_0x93655d]={'$like':'%'+_0x5edd01[_0xe863('0x32')]['filter']+'%'};return _0x4df762;})});}_0x261e49=_[_0xe863('0x3f')]({},_0x261e49,_0x5edd01['options']);return _0x2ca9bc[_0xe863('0x53')](_0x261e49);}})[_0xe863('0x28')](function(_0x20a3c7){if(_0x20a3c7){_0x213ec6=_0x20a3c7['length'];if(!_0x5edd01['query'][_0xe863('0x51')](_0xe863('0x3a'))){_0x261e49[_0xe863('0x22')]=qs[_0xe863('0x22')](_0x5edd01[_0xe863('0x32')][_0xe863('0x22')]);_0x261e49[_0xe863('0x1f')]=qs[_0xe863('0x1f')](_0x5edd01[_0xe863('0x32')][_0xe863('0x1f')]);}return _0x2ca9bc[_0xe863('0x53')](_0x261e49);}})[_0xe863('0x28')](function(_0x240cea){if(_0x240cea){return _0x240cea?{'count':_0x213ec6,'rows':_0x240cea}:null;}})[_0xe863('0x28')](respondWithResult(_0x2127e9,null))[_0xe863('0x47')](handleError(_0x2127e9,null));}; \ No newline at end of file +var _0x8cd9=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','reject','save','then','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','include','rows','catch','show','params','fields','includeAll','find','create','body','update','destroy','getFields','findOne','VtigerField','hasOwnProperty','getSubjects','order','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','jsforce','desk.js'];(function(_0xf7f7e0,_0x578099){var _0x253612=function(_0x30fd23){while(--_0x30fd23){_0xf7f7e0['push'](_0xf7f7e0['shift']());}};_0x253612(++_0x578099);}(_0x8cd9,0x186));var _0x98cd=function(_0x241d05,_0x1e7544){_0x241d05=_0x241d05-0x0;var _0x206a9d=_0x8cd9[_0x241d05];return _0x206a9d;};'use strict';var emlformat=require(_0x98cd('0x0'));var rimraf=require(_0x98cd('0x1'));var zipdir=require(_0x98cd('0x2'));var jsonpatch=require(_0x98cd('0x3'));var rp=require(_0x98cd('0x4'));var moment=require(_0x98cd('0x5'));var BPromise=require(_0x98cd('0x6'));var Mustache=require(_0x98cd('0x7'));var util=require(_0x98cd('0x8'));var path=require(_0x98cd('0x9'));var sox=require(_0x98cd('0xa'));var csv=require('to-csv');var ejs=require(_0x98cd('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x98cd('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x98cd('0xd'));var deskjs=require(_0x98cd('0xe'));var toCsv=require(_0x98cd('0xf'));var querystring=require(_0x98cd('0x10'));var Papa=require(_0x98cd('0x11'));var Redis=require(_0x98cd('0x12'));var authService=require(_0x98cd('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x98cd('0x14'));var hardwareService=require(_0x98cd('0x15'));var logger=require('../../config/logger')(_0x98cd('0x16'));var utils=require(_0x98cd('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x98cd('0x18'))['db'];function respondWithStatusCode(_0x4a18ec,_0x2c04a4){_0x2c04a4=_0x2c04a4||0xcc;return function(_0x49dbc3){if(_0x49dbc3){return _0x4a18ec[_0x98cd('0x19')](_0x2c04a4);}return _0x4a18ec[_0x98cd('0x1a')](_0x2c04a4)[_0x98cd('0x1b')]();};}function respondWithResult(_0x2d3184,_0x3044ec){_0x3044ec=_0x3044ec||0xc8;return function(_0x26549d){if(_0x26549d){return _0x2d3184[_0x98cd('0x1a')](_0x3044ec)[_0x98cd('0x1c')](_0x26549d);}};}function respondWithFilteredResult(_0x5eca17,_0x160bcc){return function(_0x2d2e17){if(_0x2d2e17){var _0x12cdb8=typeof _0x160bcc[_0x98cd('0x1d')]===_0x98cd('0x1e')&&typeof _0x160bcc['limit']==='undefined';var _0x1fcbf7=_0x2d2e17['count'];var _0x1187ba=_0x12cdb8?0x0:_0x160bcc[_0x98cd('0x1d')];var _0x5d66c6=_0x12cdb8?_0x2d2e17[_0x98cd('0x1f')]:_0x160bcc[_0x98cd('0x1d')]+_0x160bcc[_0x98cd('0x20')];var _0x432aad;if(_0x5d66c6>=_0x1fcbf7){_0x5d66c6=_0x1fcbf7;_0x432aad=0xc8;}else{_0x432aad=0xce;}_0x5eca17[_0x98cd('0x1a')](_0x432aad);return _0x5eca17['set']('Content-Range',_0x1187ba+'-'+_0x5d66c6+'/'+_0x1fcbf7)['json'](_0x2d2e17);}return null;};}function patchUpdates(_0x2c61b5){return function(_0x1ea24d){try{jsonpatch['apply'](_0x1ea24d,_0x2c61b5,!![]);}catch(_0x47f714){return BPromise[_0x98cd('0x21')](_0x47f714);}return _0x1ea24d[_0x98cd('0x22')]();};}function saveUpdates(_0x165c84,_0x3e9408){return function(_0x4fc2db){if(_0x4fc2db){return _0x4fc2db['update'](_0x165c84)[_0x98cd('0x23')](function(_0x2dcf1e){return _0x2dcf1e;});}return null;};}function removeEntity(_0x1b2522,_0x21702a){return function(_0x3cd46b){if(_0x3cd46b){return _0x3cd46b['destroy']()[_0x98cd('0x23')](function(){_0x1b2522['status'](0xcc)[_0x98cd('0x1b')]();});}};}function handleEntityNotFound(_0x36bcac,_0x1eb40f){return function(_0x1f37d1){if(!_0x1f37d1){_0x36bcac[_0x98cd('0x19')](0x194);}return _0x1f37d1;};}function handleError(_0x5487f8,_0x2bbe8c){_0x2bbe8c=_0x2bbe8c||0x1f4;return function(_0xe54890){logger[_0x98cd('0x24')](_0xe54890[_0x98cd('0x25')]);if(_0xe54890[_0x98cd('0x26')]){delete _0xe54890[_0x98cd('0x26')];}_0x5487f8['status'](_0x2bbe8c)[_0x98cd('0x27')](_0xe54890);};}exports[_0x98cd('0x28')]=function(_0x3e4b8d,_0x5cb015){var _0x595a3d={},_0x993137={},_0x2ad9ae={'count':0x0,'rows':[]};var _0x591bf2=_[_0x98cd('0x29')](db[_0x98cd('0x2a')][_0x98cd('0x2b')],function(_0x1d1c45){return{'name':_0x1d1c45[_0x98cd('0x2c')],'type':_0x1d1c45[_0x98cd('0x2d')][_0x98cd('0x2e')]};});_0x993137[_0x98cd('0x2f')]=_[_0x98cd('0x29')](_0x591bf2,_0x98cd('0x26'));_0x993137[_0x98cd('0x30')]=_[_0x98cd('0x31')](_0x3e4b8d[_0x98cd('0x30')]);_0x993137[_0x98cd('0x32')]=_[_0x98cd('0x33')](_0x993137[_0x98cd('0x2f')],_0x993137[_0x98cd('0x30')]);_0x595a3d[_0x98cd('0x34')]=_[_0x98cd('0x33')](_0x993137[_0x98cd('0x2f')],qs['fields'](_0x3e4b8d[_0x98cd('0x30')]['fields']));_0x595a3d[_0x98cd('0x34')]=_0x595a3d[_0x98cd('0x34')][_0x98cd('0x35')]?_0x595a3d[_0x98cd('0x34')]:_0x993137[_0x98cd('0x2f')];if(!_0x3e4b8d[_0x98cd('0x30')]['hasOwnProperty'](_0x98cd('0x36'))){_0x595a3d[_0x98cd('0x20')]=qs['limit'](_0x3e4b8d[_0x98cd('0x30')][_0x98cd('0x20')]);_0x595a3d['offset']=qs[_0x98cd('0x1d')](_0x3e4b8d['query']['offset']);}_0x595a3d['order']=qs['sort'](_0x3e4b8d[_0x98cd('0x30')][_0x98cd('0x37')]);_0x595a3d[_0x98cd('0x38')]=qs['filters'](_[_0x98cd('0x39')](_0x3e4b8d['query'],_0x993137[_0x98cd('0x32')]),_0x591bf2);if(_0x3e4b8d[_0x98cd('0x30')][_0x98cd('0x3a')]){_0x595a3d['where']=_['merge'](_0x595a3d['where'],{'$or':_['map'](_0x591bf2,function(_0x5d769d){if(_0x5d769d['type']!==_0x98cd('0x3b')){var _0x5b85ca={};_0x5b85ca[_0x5d769d['name']]={'$like':'%'+_0x3e4b8d[_0x98cd('0x30')][_0x98cd('0x3a')]+'%'};return _0x5b85ca;}})});}_0x595a3d=_[_0x98cd('0x3c')]({},_0x595a3d,_0x3e4b8d[_0x98cd('0x3d')]);var _0x14678a={'where':_0x595a3d[_0x98cd('0x38')]};return db[_0x98cd('0x2a')][_0x98cd('0x1f')](_0x14678a)[_0x98cd('0x23')](function(_0x3e6928){_0x2ad9ae[_0x98cd('0x1f')]=_0x3e6928;if(_0x3e4b8d['query']['includeAll']){_0x595a3d[_0x98cd('0x3e')]=[{'all':!![]}];}return db[_0x98cd('0x2a')]['findAll'](_0x595a3d);})['then'](function(_0x372f17){_0x2ad9ae[_0x98cd('0x3f')]=_0x372f17;return _0x2ad9ae;})['then'](respondWithFilteredResult(_0x5cb015,_0x595a3d))[_0x98cd('0x40')](handleError(_0x5cb015,null));};exports[_0x98cd('0x41')]=function(_0x11a8af,_0x203971){var _0x3472f7={'raw':![],'where':{'id':_0x11a8af[_0x98cd('0x42')]['id']}},_0x5280d5={};_0x5280d5[_0x98cd('0x2f')]=_[_0x98cd('0x31')](db[_0x98cd('0x2a')]['rawAttributes']);_0x5280d5[_0x98cd('0x30')]=_['keys'](_0x11a8af[_0x98cd('0x30')]);_0x5280d5[_0x98cd('0x32')]=_[_0x98cd('0x33')](_0x5280d5[_0x98cd('0x2f')],_0x5280d5['query']);_0x3472f7[_0x98cd('0x34')]=_[_0x98cd('0x33')](_0x5280d5[_0x98cd('0x2f')],qs[_0x98cd('0x43')](_0x11a8af['query'][_0x98cd('0x43')]));_0x3472f7[_0x98cd('0x34')]=_0x3472f7[_0x98cd('0x34')][_0x98cd('0x35')]?_0x3472f7[_0x98cd('0x34')]:_0x5280d5[_0x98cd('0x2f')];if(_0x11a8af[_0x98cd('0x30')][_0x98cd('0x44')]){_0x3472f7[_0x98cd('0x3e')]=[{'all':!![]}];}_0x3472f7=_['merge']({},_0x3472f7,_0x11a8af[_0x98cd('0x3d')]);return db[_0x98cd('0x2a')][_0x98cd('0x45')](_0x3472f7)[_0x98cd('0x23')](handleEntityNotFound(_0x203971,null))[_0x98cd('0x23')](respondWithResult(_0x203971,null))[_0x98cd('0x40')](handleError(_0x203971,null));};exports[_0x98cd('0x46')]=function(_0x398e37,_0x4e1a55){return db[_0x98cd('0x2a')][_0x98cd('0x46')](_0x398e37[_0x98cd('0x47')],{})['then'](respondWithResult(_0x4e1a55,0xc9))[_0x98cd('0x40')](handleError(_0x4e1a55,null));};exports[_0x98cd('0x48')]=function(_0x78e508,_0x2cec12){if(_0x78e508[_0x98cd('0x47')]['id']){delete _0x78e508[_0x98cd('0x47')]['id'];}return db[_0x98cd('0x2a')][_0x98cd('0x45')]({'where':{'id':_0x78e508[_0x98cd('0x42')]['id']}})[_0x98cd('0x23')](handleEntityNotFound(_0x2cec12,null))[_0x98cd('0x23')](saveUpdates(_0x78e508[_0x98cd('0x47')],null))[_0x98cd('0x23')](respondWithResult(_0x2cec12,null))['catch'](handleError(_0x2cec12,null));};exports[_0x98cd('0x49')]=function(_0x582e6d,_0xb43846){return db[_0x98cd('0x2a')]['find']({'where':{'id':_0x582e6d[_0x98cd('0x42')]['id']}})[_0x98cd('0x23')](handleEntityNotFound(_0xb43846,null))[_0x98cd('0x23')](removeEntity(_0xb43846,null))[_0x98cd('0x40')](handleError(_0xb43846,null));};exports[_0x98cd('0x4a')]=function(_0x13f69a,_0x5250e1,_0x5edda8){var _0x3de038={};var _0x151e24={};var _0xb68c97;var _0x358c94;return db['VtigerConfiguration'][_0x98cd('0x4b')]({'where':{'id':_0x13f69a[_0x98cd('0x42')]['id']}})[_0x98cd('0x23')](handleEntityNotFound(_0x5250e1,null))[_0x98cd('0x23')](function(_0xe71779){if(_0xe71779){_0xb68c97=_0xe71779;_0x151e24[_0x98cd('0x2f')]=_[_0x98cd('0x31')](db[_0x98cd('0x4c')][_0x98cd('0x2b')]);_0x151e24[_0x98cd('0x30')]=_['keys'](_0x13f69a[_0x98cd('0x30')]);_0x151e24[_0x98cd('0x32')]=_[_0x98cd('0x33')](_0x151e24[_0x98cd('0x2f')],_0x151e24[_0x98cd('0x30')]);_0x3de038[_0x98cd('0x34')]=_['intersection'](_0x151e24[_0x98cd('0x2f')],qs[_0x98cd('0x43')](_0x13f69a[_0x98cd('0x30')][_0x98cd('0x43')]));_0x3de038['attributes']=_0x3de038[_0x98cd('0x34')][_0x98cd('0x35')]?_0x3de038[_0x98cd('0x34')]:_0x151e24['model'];_0x3de038['order']=qs[_0x98cd('0x37')](_0x13f69a['query']['sort']);_0x3de038[_0x98cd('0x38')]=qs['filters'](_[_0x98cd('0x39')](_0x13f69a[_0x98cd('0x30')],_0x151e24['filters']));if(_0x13f69a['query']['filter']){_0x3de038[_0x98cd('0x38')]=_['merge'](_0x3de038[_0x98cd('0x38')],{'$or':_[_0x98cd('0x29')](_0x3de038[_0x98cd('0x34')],function(_0x17b5af){var _0x4e4136={};_0x4e4136[_0x17b5af]={'$like':'%'+_0x13f69a[_0x98cd('0x30')][_0x98cd('0x3a')]+'%'};return _0x4e4136;})});}_0x3de038=_[_0x98cd('0x3c')]({},_0x3de038,_0x13f69a[_0x98cd('0x3d')]);return _0xb68c97[_0x98cd('0x4a')](_0x3de038);}})[_0x98cd('0x23')](function(_0x4f7b8b){if(_0x4f7b8b){_0x358c94=_0x4f7b8b[_0x98cd('0x35')];if(!_0x13f69a[_0x98cd('0x30')][_0x98cd('0x4d')](_0x98cd('0x36'))){_0x3de038[_0x98cd('0x20')]=qs[_0x98cd('0x20')](_0x13f69a[_0x98cd('0x30')][_0x98cd('0x20')]);_0x3de038['offset']=qs[_0x98cd('0x1d')](_0x13f69a['query'][_0x98cd('0x1d')]);}return _0xb68c97[_0x98cd('0x4a')](_0x3de038);}})['then'](function(_0x37e013){if(_0x37e013){return _0x37e013?{'count':_0x358c94,'rows':_0x37e013}:null;}})[_0x98cd('0x23')](respondWithResult(_0x5250e1,null))[_0x98cd('0x40')](handleError(_0x5250e1,null));};exports[_0x98cd('0x4e')]=function(_0x4a36e7,_0x453949,_0x4d1f80){var _0x22b7af={};var _0x4d2da6={};var _0x5a6e10;var _0x27331b;return db[_0x98cd('0x2a')]['findOne']({'where':{'id':_0x4a36e7[_0x98cd('0x42')]['id']}})[_0x98cd('0x23')](handleEntityNotFound(_0x453949,null))[_0x98cd('0x23')](function(_0x51f027){if(_0x51f027){_0x5a6e10=_0x51f027;_0x4d2da6[_0x98cd('0x2f')]=_[_0x98cd('0x31')](db[_0x98cd('0x4c')][_0x98cd('0x2b')]);_0x4d2da6[_0x98cd('0x30')]=_[_0x98cd('0x31')](_0x4a36e7[_0x98cd('0x30')]);_0x4d2da6[_0x98cd('0x32')]=_['intersection'](_0x4d2da6['model'],_0x4d2da6[_0x98cd('0x30')]);_0x22b7af[_0x98cd('0x34')]=_[_0x98cd('0x33')](_0x4d2da6[_0x98cd('0x2f')],qs[_0x98cd('0x43')](_0x4a36e7['query']['fields']));_0x22b7af[_0x98cd('0x34')]=_0x22b7af[_0x98cd('0x34')]['length']?_0x22b7af[_0x98cd('0x34')]:_0x4d2da6[_0x98cd('0x2f')];_0x22b7af[_0x98cd('0x4f')]=qs['sort'](_0x4a36e7[_0x98cd('0x30')][_0x98cd('0x37')]);_0x22b7af[_0x98cd('0x38')]=qs[_0x98cd('0x32')](_[_0x98cd('0x39')](_0x4a36e7[_0x98cd('0x30')],_0x4d2da6[_0x98cd('0x32')]));if(_0x4a36e7[_0x98cd('0x30')][_0x98cd('0x3a')]){_0x22b7af[_0x98cd('0x38')]=_[_0x98cd('0x3c')](_0x22b7af['where'],{'$or':_['map'](_0x22b7af[_0x98cd('0x34')],function(_0x43353a){var _0x4a7e81={};_0x4a7e81[_0x43353a]={'$like':'%'+_0x4a36e7[_0x98cd('0x30')][_0x98cd('0x3a')]+'%'};return _0x4a7e81;})});}_0x22b7af=_[_0x98cd('0x3c')]({},_0x22b7af,_0x4a36e7['options']);return _0x5a6e10[_0x98cd('0x4e')](_0x22b7af);}})[_0x98cd('0x23')](function(_0xfa9e5e){if(_0xfa9e5e){_0x27331b=_0xfa9e5e[_0x98cd('0x35')];if(!_0x4a36e7[_0x98cd('0x30')][_0x98cd('0x4d')](_0x98cd('0x36'))){_0x22b7af[_0x98cd('0x20')]=qs[_0x98cd('0x20')](_0x4a36e7[_0x98cd('0x30')][_0x98cd('0x20')]);_0x22b7af['offset']=qs[_0x98cd('0x1d')](_0x4a36e7['query'][_0x98cd('0x1d')]);}return _0x5a6e10[_0x98cd('0x4e')](_0x22b7af);}})[_0x98cd('0x23')](function(_0x2440b6){if(_0x2440b6){return _0x2440b6?{'count':_0x27331b,'rows':_0x2440b6}:null;}})['then'](respondWithResult(_0x453949,null))[_0x98cd('0x40')](handleError(_0x453949,null));};exports['getDescriptions']=function(_0xd3389b,_0x144f3f,_0x5e7c7f){var _0x408207={};var _0x37fdca={};var _0xe4a083;var _0x759497;return db['VtigerConfiguration'][_0x98cd('0x4b')]({'where':{'id':_0xd3389b[_0x98cd('0x42')]['id']}})[_0x98cd('0x23')](handleEntityNotFound(_0x144f3f,null))['then'](function(_0x198180){if(_0x198180){_0xe4a083=_0x198180;_0x37fdca['model']=_[_0x98cd('0x31')](db[_0x98cd('0x4c')][_0x98cd('0x2b')]);_0x37fdca['query']=_[_0x98cd('0x31')](_0xd3389b[_0x98cd('0x30')]);_0x37fdca[_0x98cd('0x32')]=_['intersection'](_0x37fdca[_0x98cd('0x2f')],_0x37fdca[_0x98cd('0x30')]);_0x408207[_0x98cd('0x34')]=_[_0x98cd('0x33')](_0x37fdca[_0x98cd('0x2f')],qs[_0x98cd('0x43')](_0xd3389b[_0x98cd('0x30')]['fields']));_0x408207['attributes']=_0x408207[_0x98cd('0x34')][_0x98cd('0x35')]?_0x408207[_0x98cd('0x34')]:_0x37fdca['model'];_0x408207[_0x98cd('0x4f')]=qs[_0x98cd('0x37')](_0xd3389b[_0x98cd('0x30')][_0x98cd('0x37')]);_0x408207[_0x98cd('0x38')]=qs[_0x98cd('0x32')](_[_0x98cd('0x39')](_0xd3389b[_0x98cd('0x30')],_0x37fdca[_0x98cd('0x32')]));if(_0xd3389b['query'][_0x98cd('0x3a')]){_0x408207[_0x98cd('0x38')]=_['merge'](_0x408207[_0x98cd('0x38')],{'$or':_[_0x98cd('0x29')](_0x408207['attributes'],function(_0xabe80b){var _0x19e71d={};_0x19e71d[_0xabe80b]={'$like':'%'+_0xd3389b[_0x98cd('0x30')][_0x98cd('0x3a')]+'%'};return _0x19e71d;})});}_0x408207=_[_0x98cd('0x3c')]({},_0x408207,_0xd3389b['options']);return _0xe4a083[_0x98cd('0x50')](_0x408207);}})[_0x98cd('0x23')](function(_0x5bca9a){if(_0x5bca9a){_0x759497=_0x5bca9a['length'];if(!_0xd3389b[_0x98cd('0x30')][_0x98cd('0x4d')](_0x98cd('0x36'))){_0x408207[_0x98cd('0x20')]=qs[_0x98cd('0x20')](_0xd3389b['query'][_0x98cd('0x20')]);_0x408207[_0x98cd('0x1d')]=qs[_0x98cd('0x1d')](_0xd3389b[_0x98cd('0x30')]['offset']);}return _0xe4a083[_0x98cd('0x50')](_0x408207);}})[_0x98cd('0x23')](function(_0x279cef){if(_0x279cef){return _0x279cef?{'count':_0x759497,'rows':_0x279cef}:null;}})[_0x98cd('0x23')](respondWithResult(_0x144f3f,null))[_0x98cd('0x40')](handleError(_0x144f3f,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 0cbb22a..0aa657f 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 _0x3fc4=['exports','define','VtigerConfiguration','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes'];(function(_0x4492e4,_0x1a02c6){var _0x198c32=function(_0x2a41f3){while(--_0x2a41f3){_0x4492e4['push'](_0x4492e4['shift']());}};_0x198c32(++_0x1a02c6);}(_0x3fc4,0x162));var _0x43fc=function(_0x5e75c8,_0x3362f3){_0x5e75c8=_0x5e75c8-0x0;var _0x4a8fa8=_0x3fc4[_0x5e75c8];return _0x4a8fa8;};'use strict';var _=require(_0x43fc('0x0'));var util=require(_0x43fc('0x1'));var logger=require(_0x43fc('0x2'))(_0x43fc('0x3'));var moment=require(_0x43fc('0x4'));var BPromise=require(_0x43fc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x43fc('0x6'));var rimraf=require(_0x43fc('0x7'));var config=require(_0x43fc('0x8'));var attributes=require(_0x43fc('0x9'));module[_0x43fc('0xa')]=function(_0x1f5b95,_0x19200d){return _0x1f5b95[_0x43fc('0xb')](_0x43fc('0xc'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac94=['util','../../config/logger','api','moment','bluebird','rimraf','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash'];(function(_0x2abb2a,_0x222c12){var _0x495214=function(_0x4745da){while(--_0x4745da){_0x2abb2a['push'](_0x2abb2a['shift']());}};_0x495214(++_0x222c12);}(_0xac94,0x1c2));var _0x4ac9=function(_0x1a17f4,_0x21a460){_0x1a17f4=_0x1a17f4-0x0;var _0x29b9e0=_0xac94[_0x1a17f4];return _0x29b9e0;};'use strict';var _=require(_0x4ac9('0x0'));var util=require(_0x4ac9('0x1'));var logger=require(_0x4ac9('0x2'))(_0x4ac9('0x3'));var moment=require(_0x4ac9('0x4'));var BPromise=require(_0x4ac9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ac9('0x6'));var config=require('../../config/environment');var attributes=require('./intVtigerConfiguration.attributes');module[_0x4ac9('0x7')]=function(_0x5d3763,_0x29e1ab){return _0x5d3763[_0x4ac9('0x8')](_0x4ac9('0x9'),attributes,{'tableName':_0x4ac9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index c09eed2..091db39 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 _0xdf58=['lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x39d9b8,_0xae7407){var _0x402b87=function(_0x23c529){while(--_0x23c529){_0x39d9b8['push'](_0x39d9b8['shift']());}};_0x402b87(++_0xae7407);}(_0xdf58,0x1b8));var _0x8df5=function(_0x170786,_0x1e16b0){_0x170786=_0x170786-0x0;var _0x50016e=_0xdf58[_0x170786];return _0x50016e;};'use strict';var _=require(_0x8df5('0x0'));var util=require(_0x8df5('0x1'));var moment=require(_0x8df5('0x2'));var BPromise=require('bluebird');var rs=require(_0x8df5('0x3'));var fs=require('fs');var Redis=require(_0x8df5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8df5('0x5'));var logger=require(_0x8df5('0x6'))(_0x8df5('0x7'));var config=require(_0x8df5('0x8'));var jayson=require(_0x8df5('0x9'));var client=jayson[_0x8df5('0xa')][_0x8df5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c2d8a,_0x3df4f3,_0x1df76d){return new BPromise(function(_0x4b79ff,_0x3ed7c4){return client[_0x8df5('0xc')](_0x5c2d8a,_0x1df76d)[_0x8df5('0xd')](function(_0x36cac2){logger[_0x8df5('0xe')](_0x8df5('0xf'),_0x3df4f3,_0x8df5('0x10'));logger['debug']('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x3df4f3,_0x8df5('0x10'),JSON[_0x8df5('0x11')](_0x36cac2));if(_0x36cac2[_0x8df5('0x12')]){if(_0x36cac2[_0x8df5('0x12')][_0x8df5('0x13')]===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x3df4f3,_0x36cac2[_0x8df5('0x12')][_0x8df5('0x14')]);return _0x3ed7c4(_0x36cac2['error']['message']);}logger[_0x8df5('0x12')](_0x8df5('0xf'),_0x3df4f3,_0x36cac2[_0x8df5('0x12')][_0x8df5('0x14')]);return _0x4b79ff(_0x36cac2[_0x8df5('0x12')][_0x8df5('0x14')]);}else{logger[_0x8df5('0xe')](_0x8df5('0xf'),_0x3df4f3,_0x8df5('0x10'));_0x4b79ff(_0x36cac2[_0x8df5('0x15')][_0x8df5('0x14')]);}})['catch'](function(_0x5d25e3){logger[_0x8df5('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x3df4f3,_0x5d25e3);_0x3ed7c4(_0x5d25e3);});});} \ No newline at end of file +var _0x177d=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','error','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x4d058b,_0x3426df){var _0x5d3d2d=function(_0x483c17){while(--_0x483c17){_0x4d058b['push'](_0x4d058b['shift']());}};_0x5d3d2d(++_0x3426df);}(_0x177d,0x1b4));var _0xd177=function(_0x501ca6,_0x573c82){_0x501ca6=_0x501ca6-0x0;var _0x351c8e=_0x177d[_0x501ca6];return _0x351c8e;};'use strict';var _=require('lodash');var util=require(_0xd177('0x0'));var moment=require(_0xd177('0x1'));var BPromise=require(_0xd177('0x2'));var rs=require(_0xd177('0x3'));var fs=require('fs');var Redis=require(_0xd177('0x4'));var db=require(_0xd177('0x5'))['db'];var utils=require(_0xd177('0x6'));var logger=require(_0xd177('0x7'))(_0xd177('0x8'));var config=require(_0xd177('0x9'));var jayson=require(_0xd177('0xa'));var client=jayson[_0xd177('0xb')][_0xd177('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3e730e,_0x3e0d68,_0x1c2389){return new BPromise(function(_0x24be6f,_0x2a326f){return client[_0xd177('0xd')](_0x3e730e,_0x1c2389)['then'](function(_0x407401){logger[_0xd177('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x3e0d68,_0xd177('0xf'));logger['debug']('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x3e0d68,'request\x20sent',JSON['stringify'](_0x407401));if(_0x407401[_0xd177('0x10')]){if(_0x407401['error']['code']===0x1f4){logger[_0xd177('0x10')](_0xd177('0x11'),_0x3e0d68,_0x407401['error']['message']);return _0x2a326f(_0x407401['error'][_0xd177('0x12')]);}logger[_0xd177('0x10')](_0xd177('0x11'),_0x3e0d68,_0x407401[_0xd177('0x10')][_0xd177('0x12')]);return _0x24be6f(_0x407401[_0xd177('0x10')][_0xd177('0x12')]);}else{logger[_0xd177('0xe')](_0xd177('0x11'),_0x3e0d68,_0xd177('0xf'));_0x24be6f(_0x407401[_0xd177('0x13')][_0xd177('0x12')]);}})[_0xd177('0x14')](function(_0x179fc1){logger[_0xd177('0x10')](_0xd177('0x11'),_0x3e0d68,_0x179fc1);_0x2a326f(_0x179fc1);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index c8e346b..cde36a1 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 _0x27e0=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','show','post','delete','/:id','destroy','exports','util','path','connect-timeout'];(function(_0x5d7c62,_0x4894e1){var _0x1f5e3c=function(_0x29c84d){while(--_0x29c84d){_0x5d7c62['push'](_0x5d7c62['shift']());}};_0x1f5e3c(++_0x4894e1);}(_0x27e0,0x1c5));var _0x027e=function(_0x331859,_0x57cd80){_0x331859=_0x331859-0x0;var _0x143388=_0x27e0[_0x331859];return _0x143388;};'use strict';var multer=require('multer');var util=require(_0x027e('0x0'));var path=require(_0x027e('0x1'));var timeout=require(_0x027e('0x2'));var express=require(_0x027e('0x3'));var router=express[_0x027e('0x4')]();var fs_extra=require(_0x027e('0x5'));var auth=require(_0x027e('0x6'));var interaction=require(_0x027e('0x7'));var config=require(_0x027e('0x8'));var controller=require(_0x027e('0x9'));router[_0x027e('0xa')]('/',auth[_0x027e('0xb')](),controller[_0x027e('0xc')]);router[_0x027e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x027e('0xd')]);router[_0x027e('0xe')]('/',auth[_0x027e('0xb')](),controller['create']);router['put']('/:id',auth[_0x027e('0xb')](),controller['update']);router[_0x027e('0xf')](_0x027e('0x10'),auth['isAuthenticated'](),controller[_0x027e('0x11')]);module[_0x027e('0x12')]=router; \ No newline at end of file +var _0x9a5a=['./intVtigerField.controller','get','/:id','isAuthenticated','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4c1cf0,_0x259709){var _0x4a11a4=function(_0x194b3e){while(--_0x194b3e){_0x4c1cf0['push'](_0x4c1cf0['shift']());}};_0x4a11a4(++_0x259709);}(_0x9a5a,0x13b));var _0xa9a5=function(_0x7dc879,_0x54f9e0){_0x7dc879=_0x7dc879-0x0;var _0x57cc53=_0x9a5a[_0x7dc879];return _0x57cc53;};'use strict';var multer=require(_0xa9a5('0x0'));var util=require(_0xa9a5('0x1'));var path=require(_0xa9a5('0x2'));var timeout=require(_0xa9a5('0x3'));var express=require(_0xa9a5('0x4'));var router=express[_0xa9a5('0x5')]();var fs_extra=require(_0xa9a5('0x6'));var auth=require(_0xa9a5('0x7'));var interaction=require(_0xa9a5('0x8'));var config=require('../../config/environment');var controller=require(_0xa9a5('0x9'));router[_0xa9a5('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa9a5('0xa')](_0xa9a5('0xb'),auth[_0xa9a5('0xc')](),controller['show']);router[_0xa9a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa9a5('0xe')](_0xa9a5('0xb'),auth[_0xa9a5('0xc')](),controller[_0xa9a5('0xf')]);router[_0xa9a5('0x10')]('/:id',auth[_0xa9a5('0xc')](),controller[_0xa9a5('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 9ccd100..3955b30 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 _0xd9e6=['STRING','ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','picklist'];(function(_0x591149,_0x5d20e9){var _0xa1c7ed=function(_0x892564){while(--_0x892564){_0x591149['push'](_0x591149['shift']());}};_0xa1c7ed(++_0x5d20e9);}(_0xd9e6,0x161));var _0x6d9e=function(_0x3a773f,_0x14d688){_0x3a773f=_0x3a773f-0x0;var _0x59d44c=_0xd9e6[_0x3a773f];return _0x59d44c;};'use strict';var Sequelize=require(_0x6d9e('0x0'));module[_0x6d9e('0x1')]={'type':{'type':Sequelize['ENUM'](_0x6d9e('0x2'),_0x6d9e('0x3'),_0x6d9e('0x4'),_0x6d9e('0x5'),_0x6d9e('0x6')),'defaultValue':_0x6d9e('0x2')},'content':{'type':Sequelize[_0x6d9e('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6d9e('0x8')](_0x6d9e('0x2'),_0x6d9e('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x6d9e('0x7')]},'idField':{'type':Sequelize[_0x6d9e('0x7')]},'nameField':{'type':Sequelize[_0x6d9e('0x7')]},'customField':{'type':Sequelize[_0x6d9e('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6d9e('0x7')]}}; \ No newline at end of file +var _0x66a7=['STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','variable','keyValue','picklist','string'];(function(_0x5cc103,_0x201541){var _0x3de5a5=function(_0x42c00e){while(--_0x42c00e){_0x5cc103['push'](_0x5cc103['shift']());}};_0x3de5a5(++_0x201541);}(_0x66a7,0x143));var _0x766a=function(_0x40001a,_0x57f2ae){_0x40001a=_0x40001a-0x0;var _0x4cec45=_0x66a7[_0x40001a];return _0x4cec45;};'use strict';var Sequelize=require(_0x766a('0x0'));module[_0x766a('0x1')]={'type':{'type':Sequelize[_0x766a('0x2')]('string',_0x766a('0x3'),'customVariable',_0x766a('0x4'),_0x766a('0x5')),'defaultValue':_0x766a('0x6')},'content':{'type':Sequelize[_0x766a('0x7')]},'key':{'type':Sequelize[_0x766a('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x766a('0x6'),_0x766a('0x3'),_0x766a('0x8'))},'keyContent':{'type':Sequelize[_0x766a('0x7')]},'idField':{'type':Sequelize[_0x766a('0x7')]},'nameField':{'type':Sequelize[_0x766a('0x7')]},'customField':{'type':Sequelize[_0x766a('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index c541e3b..56e353c 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 _0xbf72=['keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','includeAll','include','findAll','show','params','options','create','body','catch','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','reject','save','update','destroy','then','error','stack','name','index','VtigerField','rawAttributes','fieldName','type','key','model','map','query'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xbf72,0x1da));var _0x2bf7=function(_0x5859cc,_0x4ee4ee){_0x5859cc=_0x5859cc-0x0;var _0x21bb5a=_0xbf72[_0x5859cc];return _0x21bb5a;};'use strict';var emlformat=require(_0x2bf7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2bf7('0x1'));var jsonpatch=require(_0x2bf7('0x2'));var rp=require(_0x2bf7('0x3'));var moment=require(_0x2bf7('0x4'));var BPromise=require(_0x2bf7('0x5'));var Mustache=require(_0x2bf7('0x6'));var util=require(_0x2bf7('0x7'));var path=require(_0x2bf7('0x8'));var sox=require(_0x2bf7('0x9'));var csv=require(_0x2bf7('0xa'));var ejs=require(_0x2bf7('0xb'));var fs=require('fs');var fs_extra=require(_0x2bf7('0xc'));var _=require(_0x2bf7('0xd'));var squel=require(_0x2bf7('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2bf7('0xf'));var toCsv=require(_0x2bf7('0xa'));var querystring=require('querystring');var Papa=require(_0x2bf7('0x10'));var Redis=require(_0x2bf7('0x11'));var authService=require(_0x2bf7('0x12'));var qs=require(_0x2bf7('0x13'));var as=require(_0x2bf7('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2bf7('0x15'))('api');var utils=require(_0x2bf7('0x16'));var config=require(_0x2bf7('0x17'));var licenseUtil=require(_0x2bf7('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e92cb,_0x2a1b1d){_0x2a1b1d=_0x2a1b1d||0xcc;return function(_0x52d8ee){if(_0x52d8ee){return _0x4e92cb[_0x2bf7('0x19')](_0x2a1b1d);}return _0x4e92cb[_0x2bf7('0x1a')](_0x2a1b1d)[_0x2bf7('0x1b')]();};}function respondWithResult(_0x535e90,_0x59ef44){_0x59ef44=_0x59ef44||0xc8;return function(_0x44dd6a){if(_0x44dd6a){return _0x535e90['status'](_0x59ef44)[_0x2bf7('0x1c')](_0x44dd6a);}};}function respondWithFilteredResult(_0x503236,_0x108d57){return function(_0x50f7f5){if(_0x50f7f5){var _0xeb36be=typeof _0x108d57['offset']===_0x2bf7('0x1d')&&typeof _0x108d57[_0x2bf7('0x1e')]===_0x2bf7('0x1d');var _0x4d6530=_0x50f7f5[_0x2bf7('0x1f')];var _0xffcdaf=_0xeb36be?0x0:_0x108d57[_0x2bf7('0x20')];var _0x2138ee=_0xeb36be?_0x50f7f5[_0x2bf7('0x1f')]:_0x108d57['offset']+_0x108d57[_0x2bf7('0x1e')];var _0x46040e;if(_0x2138ee>=_0x4d6530){_0x2138ee=_0x4d6530;_0x46040e=0xc8;}else{_0x46040e=0xce;}_0x503236['status'](_0x46040e);return _0x503236['set'](_0x2bf7('0x21'),_0xffcdaf+'-'+_0x2138ee+'/'+_0x4d6530)[_0x2bf7('0x1c')](_0x50f7f5);}return null;};}function patchUpdates(_0x5c9115){return function(_0x331a28){try{jsonpatch['apply'](_0x331a28,_0x5c9115,!![]);}catch(_0x55b111){return BPromise[_0x2bf7('0x22')](_0x55b111);}return _0x331a28[_0x2bf7('0x23')]();};}function saveUpdates(_0x2eb499,_0x4346eb){return function(_0x195485){if(_0x195485){return _0x195485[_0x2bf7('0x24')](_0x2eb499)['then'](function(_0x93f83f){return _0x93f83f;});}return null;};}function removeEntity(_0x36af37,_0x2d4f62){return function(_0x305765){if(_0x305765){return _0x305765[_0x2bf7('0x25')]()[_0x2bf7('0x26')](function(){_0x36af37[_0x2bf7('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52530d,_0x445135){return function(_0x137f70){if(!_0x137f70){_0x52530d['sendStatus'](0x194);}return _0x137f70;};}function handleError(_0x4b5526,_0x43a27d){_0x43a27d=_0x43a27d||0x1f4;return function(_0x3c0cf0){logger[_0x2bf7('0x27')](_0x3c0cf0[_0x2bf7('0x28')]);if(_0x3c0cf0[_0x2bf7('0x29')]){delete _0x3c0cf0['name'];}_0x4b5526[_0x2bf7('0x1a')](_0x43a27d)['send'](_0x3c0cf0);};}exports[_0x2bf7('0x2a')]=function(_0x540bea,_0x871db8){var _0x231c2d={},_0x11dec3={},_0x4df9d1={'count':0x0,'rows':[]};var _0x496d72=_['map'](db[_0x2bf7('0x2b')][_0x2bf7('0x2c')],function(_0x3b1b72){return{'name':_0x3b1b72[_0x2bf7('0x2d')],'type':_0x3b1b72[_0x2bf7('0x2e')][_0x2bf7('0x2f')]};});_0x11dec3[_0x2bf7('0x30')]=_[_0x2bf7('0x31')](_0x496d72,'name');_0x11dec3[_0x2bf7('0x32')]=_[_0x2bf7('0x33')](_0x540bea[_0x2bf7('0x32')]);_0x11dec3['filters']=_[_0x2bf7('0x34')](_0x11dec3[_0x2bf7('0x30')],_0x11dec3[_0x2bf7('0x32')]);_0x231c2d['attributes']=_[_0x2bf7('0x34')](_0x11dec3[_0x2bf7('0x30')],qs[_0x2bf7('0x35')](_0x540bea[_0x2bf7('0x32')][_0x2bf7('0x35')]));_0x231c2d['attributes']=_0x231c2d[_0x2bf7('0x36')][_0x2bf7('0x37')]?_0x231c2d[_0x2bf7('0x36')]:_0x11dec3[_0x2bf7('0x30')];if(!_0x540bea['query'][_0x2bf7('0x38')](_0x2bf7('0x39'))){_0x231c2d[_0x2bf7('0x1e')]=qs[_0x2bf7('0x1e')](_0x540bea[_0x2bf7('0x32')][_0x2bf7('0x1e')]);_0x231c2d[_0x2bf7('0x20')]=qs[_0x2bf7('0x20')](_0x540bea[_0x2bf7('0x32')][_0x2bf7('0x20')]);}_0x231c2d[_0x2bf7('0x3a')]=qs[_0x2bf7('0x3b')](_0x540bea[_0x2bf7('0x32')][_0x2bf7('0x3b')]);_0x231c2d[_0x2bf7('0x3c')]=qs[_0x2bf7('0x3d')](_['pick'](_0x540bea[_0x2bf7('0x32')],_0x11dec3[_0x2bf7('0x3d')]),_0x496d72);if(_0x540bea[_0x2bf7('0x32')][_0x2bf7('0x3e')]){_0x231c2d[_0x2bf7('0x3c')]=_['merge'](_0x231c2d[_0x2bf7('0x3c')],{'$or':_[_0x2bf7('0x31')](_0x496d72,function(_0x443856){if(_0x443856[_0x2bf7('0x2e')]!==_0x2bf7('0x3f')){var _0x49725e={};_0x49725e[_0x443856[_0x2bf7('0x29')]]={'$like':'%'+_0x540bea['query']['filter']+'%'};return _0x49725e;}})});}_0x231c2d=_[_0x2bf7('0x40')]({},_0x231c2d,_0x540bea['options']);var _0x2d10d4={'where':_0x231c2d['where']};return db[_0x2bf7('0x2b')]['count'](_0x2d10d4)[_0x2bf7('0x26')](function(_0x401654){_0x4df9d1[_0x2bf7('0x1f')]=_0x401654;if(_0x540bea['query'][_0x2bf7('0x41')]){_0x231c2d[_0x2bf7('0x42')]=[{'all':!![]}];}return db[_0x2bf7('0x2b')][_0x2bf7('0x43')](_0x231c2d);})['then'](function(_0x40c273){_0x4df9d1['rows']=_0x40c273;return _0x4df9d1;})['then'](respondWithFilteredResult(_0x871db8,_0x231c2d))['catch'](handleError(_0x871db8,null));};exports[_0x2bf7('0x44')]=function(_0x38a112,_0x4d21bb){var _0x286288={'raw':!![],'where':{'id':_0x38a112[_0x2bf7('0x45')]['id']}},_0x264368={};_0x264368['model']=_[_0x2bf7('0x33')](db[_0x2bf7('0x2b')][_0x2bf7('0x2c')]);_0x264368[_0x2bf7('0x32')]=_[_0x2bf7('0x33')](_0x38a112[_0x2bf7('0x32')]);_0x264368[_0x2bf7('0x3d')]=_[_0x2bf7('0x34')](_0x264368[_0x2bf7('0x30')],_0x264368['query']);_0x286288[_0x2bf7('0x36')]=_['intersection'](_0x264368[_0x2bf7('0x30')],qs[_0x2bf7('0x35')](_0x38a112[_0x2bf7('0x32')][_0x2bf7('0x35')]));_0x286288['attributes']=_0x286288[_0x2bf7('0x36')][_0x2bf7('0x37')]?_0x286288['attributes']:_0x264368['model'];if(_0x38a112[_0x2bf7('0x32')][_0x2bf7('0x41')]){_0x286288[_0x2bf7('0x42')]=[{'all':!![]}];}_0x286288=_[_0x2bf7('0x40')]({},_0x286288,_0x38a112[_0x2bf7('0x46')]);return db['VtigerField']['find'](_0x286288)['then'](handleEntityNotFound(_0x4d21bb,null))[_0x2bf7('0x26')](respondWithResult(_0x4d21bb,null))['catch'](handleError(_0x4d21bb,null));};exports[_0x2bf7('0x47')]=function(_0x55c169,_0x43f70a){return db[_0x2bf7('0x2b')][_0x2bf7('0x47')](_0x55c169[_0x2bf7('0x48')],{})[_0x2bf7('0x26')](respondWithResult(_0x43f70a,0xc9))[_0x2bf7('0x49')](handleError(_0x43f70a,null));};exports[_0x2bf7('0x24')]=function(_0x1b1e83,_0x633339){if(_0x1b1e83[_0x2bf7('0x48')]['id']){delete _0x1b1e83[_0x2bf7('0x48')]['id'];}return db[_0x2bf7('0x2b')][_0x2bf7('0x4a')]({'where':{'id':_0x1b1e83['params']['id']}})[_0x2bf7('0x26')](handleEntityNotFound(_0x633339,null))['then'](saveUpdates(_0x1b1e83[_0x2bf7('0x48')],null))[_0x2bf7('0x26')](respondWithResult(_0x633339,null))['catch'](handleError(_0x633339,null));};exports[_0x2bf7('0x25')]=function(_0x10529a,_0x47107f){return db[_0x2bf7('0x2b')][_0x2bf7('0x4a')]({'where':{'id':_0x10529a[_0x2bf7('0x45')]['id']}})[_0x2bf7('0x26')](handleEntityNotFound(_0x47107f,null))[_0x2bf7('0x26')](removeEntity(_0x47107f,null))[_0x2bf7('0x49')](handleError(_0x47107f,null));}; \ No newline at end of file +var _0x008d=['rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','where','pick','filter','merge','options','include','rows','catch','show','params','length','includeAll','find','create','body','eml-format','zip-dir','moment','util','path','to-csv','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','save','update','destroy','then','stack','name','send','map','VtigerField'];(function(_0x4cf991,_0x5a1eb3){var _0x254966=function(_0x57c3cc){while(--_0x57c3cc){_0x4cf991['push'](_0x4cf991['shift']());}};_0x254966(++_0x5a1eb3);}(_0x008d,0x1bd));var _0xd008=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x008d[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0xd008('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd008('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd008('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd008('0x3'));var path=require(_0xd008('0x4'));var sox=require('sox');var csv=require(_0xd008('0x5'));var ejs=require(_0xd008('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd008('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd008('0x8'));var deskjs=require('desk.js');var toCsv=require(_0xd008('0x5'));var querystring=require(_0xd008('0x9'));var Papa=require(_0xd008('0xa'));var Redis=require(_0xd008('0xb'));var authService=require(_0xd008('0xc'));var qs=require(_0xd008('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd008('0xe'));var logger=require('../../config/logger')('api');var utils=require(_0xd008('0xf'));var config=require(_0xd008('0x10'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c9559,_0x47cec){_0x47cec=_0x47cec||0xcc;return function(_0x1f7f4a){if(_0x1f7f4a){return _0x1c9559[_0xd008('0x11')](_0x47cec);}return _0x1c9559[_0xd008('0x12')](_0x47cec)[_0xd008('0x13')]();};}function respondWithResult(_0x370406,_0x2c72a7){_0x2c72a7=_0x2c72a7||0xc8;return function(_0x12fc3d){if(_0x12fc3d){return _0x370406[_0xd008('0x12')](_0x2c72a7)[_0xd008('0x14')](_0x12fc3d);}};}function respondWithFilteredResult(_0x108e56,_0x4983bb){return function(_0x20175d){if(_0x20175d){var _0x2e255f=typeof _0x4983bb[_0xd008('0x15')]===_0xd008('0x16')&&typeof _0x4983bb[_0xd008('0x17')]==='undefined';var _0x3c7321=_0x20175d[_0xd008('0x18')];var _0x21481d=_0x2e255f?0x0:_0x4983bb[_0xd008('0x15')];var _0x4fb441=_0x2e255f?_0x20175d[_0xd008('0x18')]:_0x4983bb[_0xd008('0x15')]+_0x4983bb[_0xd008('0x17')];var _0x519cbc;if(_0x4fb441>=_0x3c7321){_0x4fb441=_0x3c7321;_0x519cbc=0xc8;}else{_0x519cbc=0xce;}_0x108e56[_0xd008('0x12')](_0x519cbc);return _0x108e56[_0xd008('0x19')]('Content-Range',_0x21481d+'-'+_0x4fb441+'/'+_0x3c7321)[_0xd008('0x14')](_0x20175d);}return null;};}function patchUpdates(_0x1a044f){return function(_0x4bef11){try{jsonpatch['apply'](_0x4bef11,_0x1a044f,!![]);}catch(_0x5ede68){return BPromise['reject'](_0x5ede68);}return _0x4bef11[_0xd008('0x1a')]();};}function saveUpdates(_0x19570c,_0x5842a6){return function(_0x2db2ba){if(_0x2db2ba){return _0x2db2ba[_0xd008('0x1b')](_0x19570c)['then'](function(_0x3b30d1){return _0x3b30d1;});}return null;};}function removeEntity(_0x15e02e,_0x37efa1){return function(_0x27ba52){if(_0x27ba52){return _0x27ba52[_0xd008('0x1c')]()[_0xd008('0x1d')](function(){_0x15e02e['status'](0xcc)[_0xd008('0x13')]();});}};}function handleEntityNotFound(_0x420cfb,_0x2fd391){return function(_0x1b05e1){if(!_0x1b05e1){_0x420cfb[_0xd008('0x11')](0x194);}return _0x1b05e1;};}function handleError(_0x1e976c,_0x4fe637){_0x4fe637=_0x4fe637||0x1f4;return function(_0xf6c276){logger['error'](_0xf6c276[_0xd008('0x1e')]);if(_0xf6c276[_0xd008('0x1f')]){delete _0xf6c276[_0xd008('0x1f')];}_0x1e976c[_0xd008('0x12')](_0x4fe637)[_0xd008('0x20')](_0xf6c276);};}exports['index']=function(_0x4278d9,_0x155325){var _0x533b80={},_0x532dd2={},_0x118eab={'count':0x0,'rows':[]};var _0x375782=_[_0xd008('0x21')](db[_0xd008('0x22')][_0xd008('0x23')],function(_0x4f10e3){return{'name':_0x4f10e3['fieldName'],'type':_0x4f10e3[_0xd008('0x24')]['key']};});_0x532dd2[_0xd008('0x25')]=_[_0xd008('0x21')](_0x375782,'name');_0x532dd2[_0xd008('0x26')]=_[_0xd008('0x27')](_0x4278d9['query']);_0x532dd2[_0xd008('0x28')]=_[_0xd008('0x29')](_0x532dd2[_0xd008('0x25')],_0x532dd2[_0xd008('0x26')]);_0x533b80[_0xd008('0x2a')]=_[_0xd008('0x29')](_0x532dd2[_0xd008('0x25')],qs[_0xd008('0x2b')](_0x4278d9[_0xd008('0x26')]['fields']));_0x533b80['attributes']=_0x533b80[_0xd008('0x2a')]['length']?_0x533b80[_0xd008('0x2a')]:_0x532dd2[_0xd008('0x25')];if(!_0x4278d9[_0xd008('0x26')][_0xd008('0x2c')]('nolimit')){_0x533b80['limit']=qs[_0xd008('0x17')](_0x4278d9['query'][_0xd008('0x17')]);_0x533b80[_0xd008('0x15')]=qs[_0xd008('0x15')](_0x4278d9[_0xd008('0x26')][_0xd008('0x15')]);}_0x533b80['order']=qs['sort'](_0x4278d9['query']['sort']);_0x533b80[_0xd008('0x2d')]=qs[_0xd008('0x28')](_[_0xd008('0x2e')](_0x4278d9[_0xd008('0x26')],_0x532dd2['filters']),_0x375782);if(_0x4278d9[_0xd008('0x26')]['filter']){_0x533b80['where']=_['merge'](_0x533b80[_0xd008('0x2d')],{'$or':_[_0xd008('0x21')](_0x375782,function(_0x4aadf6){if(_0x4aadf6['type']!=='VIRTUAL'){var _0x153c69={};_0x153c69[_0x4aadf6[_0xd008('0x1f')]]={'$like':'%'+_0x4278d9[_0xd008('0x26')][_0xd008('0x2f')]+'%'};return _0x153c69;}})});}_0x533b80=_[_0xd008('0x30')]({},_0x533b80,_0x4278d9[_0xd008('0x31')]);var _0x481cdf={'where':_0x533b80[_0xd008('0x2d')]};return db[_0xd008('0x22')]['count'](_0x481cdf)[_0xd008('0x1d')](function(_0x37cf14){_0x118eab['count']=_0x37cf14;if(_0x4278d9[_0xd008('0x26')]['includeAll']){_0x533b80[_0xd008('0x32')]=[{'all':!![]}];}return db[_0xd008('0x22')]['findAll'](_0x533b80);})[_0xd008('0x1d')](function(_0x3bd076){_0x118eab[_0xd008('0x33')]=_0x3bd076;return _0x118eab;})[_0xd008('0x1d')](respondWithFilteredResult(_0x155325,_0x533b80))[_0xd008('0x34')](handleError(_0x155325,null));};exports[_0xd008('0x35')]=function(_0x373f15,_0x1e9624){var _0x408f59={'raw':!![],'where':{'id':_0x373f15[_0xd008('0x36')]['id']}},_0x2d8d36={};_0x2d8d36['model']=_[_0xd008('0x27')](db[_0xd008('0x22')]['rawAttributes']);_0x2d8d36[_0xd008('0x26')]=_[_0xd008('0x27')](_0x373f15['query']);_0x2d8d36[_0xd008('0x28')]=_['intersection'](_0x2d8d36['model'],_0x2d8d36['query']);_0x408f59[_0xd008('0x2a')]=_['intersection'](_0x2d8d36['model'],qs['fields'](_0x373f15['query'][_0xd008('0x2b')]));_0x408f59[_0xd008('0x2a')]=_0x408f59['attributes'][_0xd008('0x37')]?_0x408f59[_0xd008('0x2a')]:_0x2d8d36[_0xd008('0x25')];if(_0x373f15['query'][_0xd008('0x38')]){_0x408f59['include']=[{'all':!![]}];}_0x408f59=_[_0xd008('0x30')]({},_0x408f59,_0x373f15['options']);return db[_0xd008('0x22')][_0xd008('0x39')](_0x408f59)[_0xd008('0x1d')](handleEntityNotFound(_0x1e9624,null))[_0xd008('0x1d')](respondWithResult(_0x1e9624,null))[_0xd008('0x34')](handleError(_0x1e9624,null));};exports[_0xd008('0x3a')]=function(_0x3c736a,_0xea30f){return db[_0xd008('0x22')]['create'](_0x3c736a[_0xd008('0x3b')],{})['then'](respondWithResult(_0xea30f,0xc9))[_0xd008('0x34')](handleError(_0xea30f,null));};exports[_0xd008('0x1b')]=function(_0x46d4be,_0x3eaf13){if(_0x46d4be[_0xd008('0x3b')]['id']){delete _0x46d4be['body']['id'];}return db[_0xd008('0x22')]['find']({'where':{'id':_0x46d4be['params']['id']}})[_0xd008('0x1d')](handleEntityNotFound(_0x3eaf13,null))[_0xd008('0x1d')](saveUpdates(_0x46d4be[_0xd008('0x3b')],null))[_0xd008('0x1d')](respondWithResult(_0x3eaf13,null))['catch'](handleError(_0x3eaf13,null));};exports[_0xd008('0x1c')]=function(_0x72bad6,_0x3a7acc){return db[_0xd008('0x22')][_0xd008('0x39')]({'where':{'id':_0x72bad6['params']['id']}})[_0xd008('0x1d')](handleEntityNotFound(_0x3a7acc,null))[_0xd008('0x1d')](removeEntity(_0x3a7acc,null))[_0xd008('0x34')](handleError(_0x3a7acc,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index ff01267..c01ae08 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 _0xc9f0=['lodash','../../config/logger','api','bluebird','request-promise','rimraf','./intVtigerField.attributes','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc9f0,0x11e));var _0x0c9f=function(_0x394330,_0x5a5d4f){_0x394330=_0x394330-0x0;var _0x215e20=_0xc9f0[_0x394330];return _0x215e20;};'use strict';var _=require(_0x0c9f('0x0'));var util=require('util');var logger=require(_0x0c9f('0x1'))(_0x0c9f('0x2'));var moment=require('moment');var BPromise=require(_0x0c9f('0x3'));var rp=require(_0x0c9f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0c9f('0x5'));var config=require('../../config/environment');var attributes=require(_0x0c9f('0x6'));module['exports']=function(_0x456a54,_0x131732){return _0x456a54[_0x0c9f('0x7')](_0x0c9f('0x8'),attributes,{'tableName':_0x0c9f('0x9'),'paranoid':![],'indexes':[{'name':_0x0c9f('0xa'),'fields':[_0x0c9f('0xb'),_0x0c9f('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2c5c=['api','moment','bluebird','request-promise','path','../../config/environment','exports','define','int_vtiger_fields','vtiger_unique_index','FieldId','lodash','util','../../config/logger'];(function(_0x32f97a,_0x1b5fba){var _0x17d7b2=function(_0x5358d6){while(--_0x5358d6){_0x32f97a['push'](_0x32f97a['shift']());}};_0x17d7b2(++_0x1b5fba);}(_0x2c5c,0x1a1));var _0xc2c5=function(_0x145906,_0x4f50aa){_0x145906=_0x145906-0x0;var _0x5c1b6e=_0x2c5c[_0x145906];return _0x5c1b6e;};'use strict';var _=require(_0xc2c5('0x0'));var util=require(_0xc2c5('0x1'));var logger=require(_0xc2c5('0x2'))(_0xc2c5('0x3'));var moment=require(_0xc2c5('0x4'));var BPromise=require(_0xc2c5('0x5'));var rp=require(_0xc2c5('0x6'));var fs=require('fs');var path=require(_0xc2c5('0x7'));var rimraf=require('rimraf');var config=require(_0xc2c5('0x8'));var attributes=require('./intVtigerField.attributes');module[_0xc2c5('0x9')]=function(_0x228b7c,_0x31d9ea){return _0x228b7c[_0xc2c5('0xa')]('VtigerField',attributes,{'tableName':_0xc2c5('0xb'),'paranoid':![],'indexes':[{'name':_0xc2c5('0xc'),'fields':['idField',_0xc2c5('0xd')],'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 782d766..c27a35d 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 _0x7e15=['request','info','VtigerField,\x20%s,\x20%s','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x1acd26,_0x3caf56){var _0x332fb4=function(_0xb6c33c){while(--_0xb6c33c){_0x1acd26['push'](_0x1acd26['shift']());}};_0x332fb4(++_0x3caf56);}(_0x7e15,0x1ad));var _0x57e1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7e15[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x57e1('0x0'));var BPromise=require(_0x57e1('0x1'));var rs=require(_0x57e1('0x2'));var fs=require('fs');var Redis=require(_0x57e1('0x3'));var db=require(_0x57e1('0x4'))['db'];var utils=require(_0x57e1('0x5'));var logger=require(_0x57e1('0x6'))('rpc');var config=require(_0x57e1('0x7'));var jayson=require(_0x57e1('0x8'));var client=jayson[_0x57e1('0x9')][_0x57e1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x826da3,_0x5439b3,_0x287a5d){return new BPromise(function(_0xb2e18d,_0x3daf10){return client[_0x57e1('0xb')](_0x826da3,_0x287a5d)['then'](function(_0x486dfa){logger[_0x57e1('0xc')](_0x57e1('0xd'),_0x5439b3,_0x57e1('0xe'));logger['debug'](_0x57e1('0xf'),_0x5439b3,'request\x20sent',JSON['stringify'](_0x486dfa));if(_0x486dfa[_0x57e1('0x10')]){if(_0x486dfa[_0x57e1('0x10')][_0x57e1('0x11')]===0x1f4){logger[_0x57e1('0x10')](_0x57e1('0xd'),_0x5439b3,_0x486dfa['error']['message']);return _0x3daf10(_0x486dfa[_0x57e1('0x10')][_0x57e1('0x12')]);}logger[_0x57e1('0x10')](_0x57e1('0xd'),_0x5439b3,_0x486dfa[_0x57e1('0x10')]['message']);return _0xb2e18d(_0x486dfa[_0x57e1('0x10')][_0x57e1('0x12')]);}else{logger[_0x57e1('0xc')](_0x57e1('0xd'),_0x5439b3,_0x57e1('0xe'));_0xb2e18d(_0x486dfa['result']['message']);}})[_0x57e1('0x13')](function(_0x2ab119){logger[_0x57e1('0x10')](_0x57e1('0xd'),_0x5439b3,_0x2ab119);_0x3daf10(_0x2ab119);});});} \ No newline at end of file +var _0x1788=['../../config/environment','jayson/promise','client','http','request','then','VtigerField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x492af7,_0x6722c){var _0x19971d=function(_0x76f37c){while(--_0x76f37c){_0x492af7['push'](_0x492af7['shift']());}};_0x19971d(++_0x6722c);}(_0x1788,0x7d));var _0x8178=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x1788[_0x1b2ff7];return _0x31656a;};'use strict';var _=require(_0x8178('0x0'));var util=require('util');var moment=require(_0x8178('0x1'));var BPromise=require(_0x8178('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8178('0x3'));var db=require(_0x8178('0x4'))['db'];var utils=require(_0x8178('0x5'));var logger=require('../../config/logger')(_0x8178('0x6'));var config=require(_0x8178('0x7'));var jayson=require(_0x8178('0x8'));var client=jayson[_0x8178('0x9')][_0x8178('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x533831,_0x3f905f,_0x1efd37){return new BPromise(function(_0x54d3e2,_0x4c00c5){return client[_0x8178('0xb')](_0x533831,_0x1efd37)[_0x8178('0xc')](function(_0x5e0b76){logger['info'](_0x8178('0xd'),_0x3f905f,_0x8178('0xe'));logger[_0x8178('0xf')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x3f905f,_0x8178('0xe'),JSON['stringify'](_0x5e0b76));if(_0x5e0b76[_0x8178('0x10')]){if(_0x5e0b76[_0x8178('0x10')][_0x8178('0x11')]===0x1f4){logger[_0x8178('0x10')](_0x8178('0xd'),_0x3f905f,_0x5e0b76[_0x8178('0x10')][_0x8178('0x12')]);return _0x4c00c5(_0x5e0b76[_0x8178('0x10')][_0x8178('0x12')]);}logger[_0x8178('0x10')](_0x8178('0xd'),_0x3f905f,_0x5e0b76[_0x8178('0x10')]['message']);return _0x54d3e2(_0x5e0b76[_0x8178('0x10')][_0x8178('0x12')]);}else{logger[_0x8178('0x13')](_0x8178('0xd'),_0x3f905f,'request\x20sent');_0x54d3e2(_0x5e0b76[_0x8178('0x14')][_0x8178('0x12')]);}})[_0x8178('0x15')](function(_0x224045){logger['error']('VtigerField,\x20%s,\x20%s',_0x3f905f,_0x224045);_0x4c00c5(_0x224045);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index fe0a55c..5d3602d 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 _0x4bf9=['get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0xa5077b,_0x55d3e0){var _0x405ae5=function(_0x1a63ca){while(--_0x1a63ca){_0xa5077b['push'](_0xa5077b['shift']());}};_0x405ae5(++_0x55d3e0);}(_0x4bf9,0x11f));var _0x94bf=function(_0x1de297,_0x54e14e){_0x1de297=_0x1de297-0x0;var _0x52769b=_0x4bf9[_0x1de297];return _0x52769b;};'use strict';var multer=require(_0x94bf('0x0'));var util=require('util');var path=require(_0x94bf('0x1'));var timeout=require(_0x94bf('0x2'));var express=require(_0x94bf('0x3'));var router=express['Router']();var fs_extra=require(_0x94bf('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x94bf('0x5'));var config=require(_0x94bf('0x6'));var controller=require('./intZendeskAccount.controller');router[_0x94bf('0x7')]('/',auth[_0x94bf('0x8')](),controller[_0x94bf('0x9')]);router[_0x94bf('0x7')](_0x94bf('0xa'),auth[_0x94bf('0x8')](),controller[_0x94bf('0xb')]);router[_0x94bf('0x7')](_0x94bf('0xc'),auth['isAuthenticated'](),controller[_0x94bf('0xd')]);router[_0x94bf('0x7')]('/:id/fields',auth[_0x94bf('0x8')](),controller[_0x94bf('0xe')]);router[_0x94bf('0xf')]('/',auth[_0x94bf('0x8')](),controller[_0x94bf('0x10')]);router[_0x94bf('0xf')](_0x94bf('0xc'),auth[_0x94bf('0x8')](),controller[_0x94bf('0x11')]);router[_0x94bf('0x12')](_0x94bf('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x94bf('0xa'),auth[_0x94bf('0x8')](),controller[_0x94bf('0x13')]);module[_0x94bf('0x14')]=router; \ No newline at end of file +var _0xc7a6=['destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','update'];(function(_0x4e7a49,_0x5a45e9){var _0x5650d8=function(_0x4fb731){while(--_0x4fb731){_0x4e7a49['push'](_0x4e7a49['shift']());}};_0x5650d8(++_0x5a45e9);}(_0xc7a6,0x17c));var _0x6c7a=function(_0x5a9d2b,_0x64b8b8){_0x5a9d2b=_0x5a9d2b-0x0;var _0x55a4a5=_0xc7a6[_0x5a9d2b];return _0x55a4a5;};'use strict';var multer=require(_0x6c7a('0x0'));var util=require(_0x6c7a('0x1'));var path=require('path');var timeout=require(_0x6c7a('0x2'));var express=require(_0x6c7a('0x3'));var router=express[_0x6c7a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6c7a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6c7a('0x6'));var controller=require(_0x6c7a('0x7'));router[_0x6c7a('0x8')]('/',auth[_0x6c7a('0x9')](),controller['index']);router[_0x6c7a('0x8')](_0x6c7a('0xa'),auth[_0x6c7a('0x9')](),controller[_0x6c7a('0xb')]);router[_0x6c7a('0x8')](_0x6c7a('0xc'),auth[_0x6c7a('0x9')](),controller['getConfigurations']);router[_0x6c7a('0x8')](_0x6c7a('0xd'),auth[_0x6c7a('0x9')](),controller[_0x6c7a('0xe')]);router[_0x6c7a('0xf')]('/',auth['isAuthenticated'](),controller[_0x6c7a('0x10')]);router['post'](_0x6c7a('0xc'),auth[_0x6c7a('0x9')](),controller[_0x6c7a('0x11')]);router['put']('/:id',auth[_0x6c7a('0x9')](),controller[_0x6c7a('0x12')]);router['delete'](_0x6c7a('0xa'),auth[_0x6c7a('0x9')](),controller[_0x6c7a('0x13')]);module[_0x6c7a('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index b2273a3..6ecb81b 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 _0x5ff9=['STRING','ENUM','password','integrationTab','sequelize','exports'];(function(_0x541ea6,_0x51cab6){var _0x3c3e84=function(_0xc06bed){while(--_0xc06bed){_0x541ea6['push'](_0x541ea6['shift']());}};_0x3c3e84(++_0x51cab6);}(_0x5ff9,0xa0));var _0x95ff=function(_0x46a979,_0x4f97a1){_0x46a979=_0x46a979-0x0;var _0x2e627e=_0x5ff9[_0x46a979];return _0x2e627e;};'use strict';var Sequelize=require(_0x95ff('0x0'));module[_0x95ff('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x95ff('0x2')]},'username':{'type':Sequelize[_0x95ff('0x2')],'unique':'username'},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x95ff('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x95ff('0x3')](_0x95ff('0x4'),'token'),'defaultValue':_0x95ff('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x95ff('0x3')](_0x95ff('0x5'),'newTab'),'defaultValue':_0x95ff('0x5')}}; \ No newline at end of file +var _0x444e=['newTab','sequelize','STRING','remoteUri','ENUM','password','token'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x444e,0xe8));var _0xe444=function(_0x25756a,_0x503ffe){_0x25756a=_0x25756a-0x0;var _0x5e6b3f=_0x444e[_0x25756a];return _0x5e6b3f;};'use strict';var Sequelize=require(_0xe444('0x0'));module['exports']={'name':{'type':Sequelize[_0xe444('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe444('0x1')],'unique':'username'},'password':{'type':Sequelize[_0xe444('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xe444('0x1')],'unique':_0xe444('0x2')},'authType':{'type':Sequelize[_0xe444('0x3')](_0xe444('0x4'),_0xe444('0x5')),'defaultValue':_0xe444('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xe444('0x3')]('integrationTab',_0xe444('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 9300c76..6c1329c 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 _0x0565=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','ZendeskAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','include','find','create','body','getConfigurations','ZendeskConfiguration','pick','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','Subjects','getFields','token','authType','remoteUri','slice','substring','lastIndexOf','format','ticket_fields','headers','Basic\x20%s','%s:%s','username','password','toString','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','position','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials'];(function(_0xf421d8,_0x446b24){var _0x5edfff=function(_0x120530){while(--_0x120530){_0xf421d8['push'](_0xf421d8['shift']());}};_0x5edfff(++_0x446b24);}(_0x0565,0xf2));var _0x5056=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0x0565[_0x25d386];return _0x857f4a;};'use strict';var emlformat=require(_0x5056('0x0'));var rimraf=require(_0x5056('0x1'));var zipdir=require(_0x5056('0x2'));var jsonpatch=require(_0x5056('0x3'));var rp=require(_0x5056('0x4'));var moment=require(_0x5056('0x5'));var BPromise=require(_0x5056('0x6'));var Mustache=require(_0x5056('0x7'));var util=require(_0x5056('0x8'));var path=require(_0x5056('0x9'));var sox=require('sox');var csv=require(_0x5056('0xa'));var ejs=require(_0x5056('0xb'));var fs=require('fs');var fs_extra=require(_0x5056('0xc'));var _=require(_0x5056('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5056('0xe'));var deskjs=require(_0x5056('0xf'));var toCsv=require(_0x5056('0xa'));var querystring=require(_0x5056('0x10'));var Papa=require(_0x5056('0x11'));var Redis=require(_0x5056('0x12'));var authService=require(_0x5056('0x13'));var qs=require(_0x5056('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5056('0x15'));var logger=require(_0x5056('0x16'))(_0x5056('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5056('0x18'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x53e98a,_0x2d44fb){_0x2d44fb=_0x2d44fb||0xcc;return function(_0x4b183a){if(_0x4b183a){return _0x53e98a[_0x5056('0x19')](_0x2d44fb);}return _0x53e98a[_0x5056('0x1a')](_0x2d44fb)[_0x5056('0x1b')]();};}function respondWithResult(_0x543cee,_0x1e8b64){_0x1e8b64=_0x1e8b64||0xc8;return function(_0x29d05f){if(_0x29d05f){return _0x543cee[_0x5056('0x1a')](_0x1e8b64)[_0x5056('0x1c')](_0x29d05f);}};}function respondWithFilteredResult(_0x21561d,_0x6a044a){return function(_0x4ac332){if(_0x4ac332){var _0x2b7a17=typeof _0x6a044a['offset']===_0x5056('0x1d')&&typeof _0x6a044a[_0x5056('0x1e')]===_0x5056('0x1d');var _0x1f2ac6=_0x4ac332[_0x5056('0x1f')];var _0x51b21e=_0x2b7a17?0x0:_0x6a044a[_0x5056('0x20')];var _0x56537e=_0x2b7a17?_0x4ac332['count']:_0x6a044a['offset']+_0x6a044a[_0x5056('0x1e')];var _0x517bf3;if(_0x56537e>=_0x1f2ac6){_0x56537e=_0x1f2ac6;_0x517bf3=0xc8;}else{_0x517bf3=0xce;}_0x21561d[_0x5056('0x1a')](_0x517bf3);return _0x21561d[_0x5056('0x21')](_0x5056('0x22'),_0x51b21e+'-'+_0x56537e+'/'+_0x1f2ac6)[_0x5056('0x1c')](_0x4ac332);}return null;};}function patchUpdates(_0x33035c){return function(_0x4835fd){try{jsonpatch[_0x5056('0x23')](_0x4835fd,_0x33035c,!![]);}catch(_0x3cfd41){return BPromise['reject'](_0x3cfd41);}return _0x4835fd[_0x5056('0x24')]();};}function saveUpdates(_0x1bccef,_0x2564d0){return function(_0x58b16d){if(_0x58b16d){return _0x58b16d[_0x5056('0x25')](_0x1bccef)[_0x5056('0x26')](function(_0x5afbfe){return _0x5afbfe;});}return null;};}function removeEntity(_0x4a64be,_0x29e166){return function(_0x2f36a3){if(_0x2f36a3){return _0x2f36a3[_0x5056('0x27')]()[_0x5056('0x26')](function(){_0x4a64be['status'](0xcc)[_0x5056('0x1b')]();});}};}function handleEntityNotFound(_0x25409f,_0x5d1656){return function(_0x2c4290){if(!_0x2c4290){_0x25409f['sendStatus'](0x194);}return _0x2c4290;};}function handleError(_0x15f03f,_0x39d539){_0x39d539=_0x39d539||0x1f4;return function(_0x1106e5){logger[_0x5056('0x28')](_0x1106e5[_0x5056('0x29')]);if(_0x1106e5['name']){delete _0x1106e5[_0x5056('0x2a')];}_0x15f03f[_0x5056('0x1a')](_0x39d539)[_0x5056('0x2b')](_0x1106e5);};}exports[_0x5056('0x2c')]=function(_0x53e6db,_0x24d33e){var _0x5b0270={},_0x70246c={},_0x49fe67={'count':0x0,'rows':[]};var _0x56ccba=_['map'](db[_0x5056('0x2d')][_0x5056('0x2e')],function(_0x482939){return{'name':_0x482939[_0x5056('0x2f')],'type':_0x482939[_0x5056('0x30')][_0x5056('0x31')]};});_0x70246c[_0x5056('0x32')]=_[_0x5056('0x33')](_0x56ccba,_0x5056('0x2a'));_0x70246c[_0x5056('0x34')]=_[_0x5056('0x35')](_0x53e6db[_0x5056('0x34')]);_0x70246c[_0x5056('0x36')]=_[_0x5056('0x37')](_0x70246c['model'],_0x70246c['query']);_0x5b0270[_0x5056('0x38')]=_[_0x5056('0x37')](_0x70246c['model'],qs[_0x5056('0x39')](_0x53e6db[_0x5056('0x34')]['fields']));_0x5b0270[_0x5056('0x38')]=_0x5b0270[_0x5056('0x38')][_0x5056('0x3a')]?_0x5b0270[_0x5056('0x38')]:_0x70246c[_0x5056('0x32')];if(!_0x53e6db[_0x5056('0x34')][_0x5056('0x3b')](_0x5056('0x3c'))){_0x5b0270[_0x5056('0x1e')]=qs[_0x5056('0x1e')](_0x53e6db[_0x5056('0x34')][_0x5056('0x1e')]);_0x5b0270[_0x5056('0x20')]=qs[_0x5056('0x20')](_0x53e6db[_0x5056('0x34')]['offset']);}_0x5b0270[_0x5056('0x3d')]=qs['sort'](_0x53e6db[_0x5056('0x34')][_0x5056('0x3e')]);_0x5b0270[_0x5056('0x3f')]=qs[_0x5056('0x36')](_['pick'](_0x53e6db[_0x5056('0x34')],_0x70246c[_0x5056('0x36')]),_0x56ccba);if(_0x53e6db['query'][_0x5056('0x40')]){_0x5b0270['where']=_[_0x5056('0x41')](_0x5b0270[_0x5056('0x3f')],{'$or':_[_0x5056('0x33')](_0x56ccba,function(_0x502732){if(_0x502732[_0x5056('0x30')]!==_0x5056('0x42')){var _0x308133={};_0x308133[_0x502732[_0x5056('0x2a')]]={'$like':'%'+_0x53e6db[_0x5056('0x34')][_0x5056('0x40')]+'%'};return _0x308133;}})});}_0x5b0270=_[_0x5056('0x41')]({},_0x5b0270,_0x53e6db[_0x5056('0x43')]);var _0x15553e={'where':_0x5b0270[_0x5056('0x3f')]};return db[_0x5056('0x2d')][_0x5056('0x1f')](_0x15553e)[_0x5056('0x26')](function(_0x1e28f4){_0x49fe67[_0x5056('0x1f')]=_0x1e28f4;if(_0x53e6db[_0x5056('0x34')]['includeAll']){_0x5b0270['include']=[{'all':!![]}];}return db[_0x5056('0x2d')][_0x5056('0x44')](_0x5b0270);})[_0x5056('0x26')](function(_0x3a76d2){_0x49fe67[_0x5056('0x45')]=_0x3a76d2;return _0x49fe67;})[_0x5056('0x26')](respondWithFilteredResult(_0x24d33e,_0x5b0270))[_0x5056('0x46')](handleError(_0x24d33e,null));};exports[_0x5056('0x47')]=function(_0x48ab5e,_0x58f12f){var _0x68a385={'raw':![],'where':{'id':_0x48ab5e[_0x5056('0x48')]['id']}},_0x1b3a5e={};_0x1b3a5e['model']=_[_0x5056('0x35')](db['ZendeskAccount'][_0x5056('0x2e')]);_0x1b3a5e[_0x5056('0x34')]=_[_0x5056('0x35')](_0x48ab5e[_0x5056('0x34')]);_0x1b3a5e[_0x5056('0x36')]=_[_0x5056('0x37')](_0x1b3a5e['model'],_0x1b3a5e[_0x5056('0x34')]);_0x68a385[_0x5056('0x38')]=_[_0x5056('0x37')](_0x1b3a5e['model'],qs['fields'](_0x48ab5e['query']['fields']));_0x68a385[_0x5056('0x38')]=_0x68a385[_0x5056('0x38')][_0x5056('0x3a')]?_0x68a385[_0x5056('0x38')]:_0x1b3a5e[_0x5056('0x32')];if(_0x48ab5e['query']['includeAll']){_0x68a385[_0x5056('0x49')]=[{'all':!![]}];}_0x68a385=_[_0x5056('0x41')]({},_0x68a385,_0x48ab5e[_0x5056('0x43')]);return db[_0x5056('0x2d')][_0x5056('0x4a')](_0x68a385)[_0x5056('0x26')](handleEntityNotFound(_0x58f12f,null))[_0x5056('0x26')](respondWithResult(_0x58f12f,null))['catch'](handleError(_0x58f12f,null));};exports['create']=function(_0x14e3f5,_0x3c2988){return db['ZendeskAccount'][_0x5056('0x4b')](_0x14e3f5[_0x5056('0x4c')],{})['then'](respondWithResult(_0x3c2988,0xc9))['catch'](handleError(_0x3c2988,null));};exports[_0x5056('0x25')]=function(_0x1ab1a9,_0x50aa03){if(_0x1ab1a9['body']['id']){delete _0x1ab1a9[_0x5056('0x4c')]['id'];}return db[_0x5056('0x2d')]['find']({'where':{'id':_0x1ab1a9['params']['id']}})[_0x5056('0x26')](handleEntityNotFound(_0x50aa03,null))[_0x5056('0x26')](saveUpdates(_0x1ab1a9[_0x5056('0x4c')],null))[_0x5056('0x26')](respondWithResult(_0x50aa03,null))[_0x5056('0x46')](handleError(_0x50aa03,null));};exports[_0x5056('0x27')]=function(_0x97f7d8,_0x366ba2){return db[_0x5056('0x2d')][_0x5056('0x4a')]({'where':{'id':_0x97f7d8[_0x5056('0x48')]['id']}})[_0x5056('0x26')](handleEntityNotFound(_0x366ba2,null))[_0x5056('0x26')](removeEntity(_0x366ba2,null))[_0x5056('0x46')](handleError(_0x366ba2,null));};exports[_0x5056('0x4d')]=function(_0x4bf758,_0x5c1c29,_0x5bf887){var _0xb1fd25={};var _0x428701={};var _0x1c84b1;var _0x35776b;return db[_0x5056('0x2d')]['findOne']({'where':{'id':_0x4bf758[_0x5056('0x48')]['id']}})[_0x5056('0x26')](handleEntityNotFound(_0x5c1c29,null))[_0x5056('0x26')](function(_0x3d22cc){if(_0x3d22cc){_0x1c84b1=_0x3d22cc;_0x428701[_0x5056('0x32')]=_[_0x5056('0x35')](db[_0x5056('0x4e')][_0x5056('0x2e')]);_0x428701[_0x5056('0x34')]=_[_0x5056('0x35')](_0x4bf758[_0x5056('0x34')]);_0x428701[_0x5056('0x36')]=_[_0x5056('0x37')](_0x428701['model'],_0x428701[_0x5056('0x34')]);_0xb1fd25[_0x5056('0x38')]=_[_0x5056('0x37')](_0x428701['model'],qs[_0x5056('0x39')](_0x4bf758[_0x5056('0x34')][_0x5056('0x39')]));_0xb1fd25[_0x5056('0x38')]=_0xb1fd25['attributes']['length']?_0xb1fd25['attributes']:_0x428701[_0x5056('0x32')];_0xb1fd25['order']=qs[_0x5056('0x3e')](_0x4bf758[_0x5056('0x34')][_0x5056('0x3e')]);_0xb1fd25[_0x5056('0x3f')]=qs[_0x5056('0x36')](_[_0x5056('0x4f')](_0x4bf758['query'],_0x428701['filters']));if(_0x4bf758[_0x5056('0x34')][_0x5056('0x40')]){_0xb1fd25['where']=_[_0x5056('0x41')](_0xb1fd25[_0x5056('0x3f')],{'$or':_[_0x5056('0x33')](_0xb1fd25[_0x5056('0x38')],function(_0x44b75e){var _0x524308={};_0x524308[_0x44b75e]={'$like':'%'+_0x4bf758[_0x5056('0x34')][_0x5056('0x40')]+'%'};return _0x524308;})});}_0xb1fd25=_['merge']({},_0xb1fd25,_0x4bf758[_0x5056('0x43')]);return _0x1c84b1[_0x5056('0x4d')](_0xb1fd25);}})[_0x5056('0x26')](function(_0x1d59ac){if(_0x1d59ac){_0x35776b=_0x1d59ac[_0x5056('0x3a')];if(!_0x4bf758[_0x5056('0x34')][_0x5056('0x3b')](_0x5056('0x3c'))){_0xb1fd25[_0x5056('0x1e')]=qs[_0x5056('0x1e')](_0x4bf758[_0x5056('0x34')][_0x5056('0x1e')]);_0xb1fd25[_0x5056('0x20')]=qs['offset'](_0x4bf758[_0x5056('0x34')][_0x5056('0x20')]);}return _0x1c84b1[_0x5056('0x4d')](_0xb1fd25);}})[_0x5056('0x26')](function(_0x267ba4){if(_0x267ba4){return _0x267ba4?{'count':_0x35776b,'rows':_0x267ba4}:null;}})[_0x5056('0x26')](respondWithResult(_0x5c1c29,null))['catch'](handleError(_0x5c1c29,null));};exports[_0x5056('0x50')]=function(_0x4e343e,_0x1c3684,_0x277939){if(_0x4e343e['body']['id']){delete _0x4e343e['body']['id'];}return db[_0x5056('0x2d')][_0x5056('0x51')]({'where':{'id':_0x4e343e[_0x5056('0x48')]['id']}})[_0x5056('0x26')](handleEntityNotFound(_0x1c3684,null))['then'](function(_0x521384){if(_0x521384){_0x4e343e[_0x5056('0x4c')][_0x5056('0x52')]=_0x521384['id'];_0x4e343e[_0x5056('0x4c')]['Subjects']=integrations[_0x5056('0x53')](_0x4e343e['body'][_0x5056('0x54')],_0x4e343e[_0x5056('0x4c')][_0x5056('0x30')]);_0x4e343e['body'][_0x5056('0x55')]=integrations[_0x5056('0x56')](_0x4e343e[_0x5056('0x4c')][_0x5056('0x54')],_0x4e343e[_0x5056('0x4c')][_0x5056('0x30')]);return db[_0x5056('0x4e')]['create'](_0x4e343e[_0x5056('0x4c')],{'include':[{'model':db[_0x5056('0x57')],'as':_0x5056('0x58')},{'model':db['ZendeskField'],'as':_0x5056('0x55')}]});}return null;})['then'](respondWithResult(_0x1c3684,null))[_0x5056('0x46')](handleError(_0x1c3684,null));};exports[_0x5056('0x59')]=function(_0x3c7d5c,_0x45eac9,_0x5639a1){var _0x2a856c='';return db[_0x5056('0x2d')]['findOne']({'where':{'id':_0x3c7d5c[_0x5056('0x48')]['id']},'attributes':['id','username','password',_0x5056('0x5a'),_0x5056('0x5b'),_0x5056('0x5c')]})[_0x5056('0x26')](handleEntityNotFound(_0x45eac9,null))[_0x5056('0x26')](function(_0x88270d){if(_0x88270d){_0x2a856c=_0x88270d[_0x5056('0x5c')];var _0x3aa15f=_0x2a856c[_0x5056('0x5d')](-0x1);if(_0x3aa15f==='/'){_0x2a856c=_0x2a856c[_0x5056('0x5e')](0x0,_0x2a856c[_0x5056('0x5f')](_0x3aa15f));}var _0x153143={'method':'GET','uri':util[_0x5056('0x60')]('%s/%s',_0x2a856c,_0x5056('0x61')),'json':!![]};switch(_0x88270d[_0x5056('0x5b')]){case'password':_0x153143[_0x5056('0x62')]={'Authorization':util[_0x5056('0x60')](_0x5056('0x63'),new Buffer(util[_0x5056('0x60')](_0x5056('0x64'),_0x88270d[_0x5056('0x65')],_0x88270d[_0x5056('0x66')]))[_0x5056('0x67')]('base64'))};break;case _0x5056('0x5a'):_0x153143[_0x5056('0x62')]={'Authorization':util[_0x5056('0x60')](_0x5056('0x63'),new Buffer(util[_0x5056('0x60')]('%s/token:%s',_0x88270d[_0x5056('0x65')],_0x88270d['token']))[_0x5056('0x67')](_0x5056('0x68')))};break;default:throw new db[(_0x5056('0x69'))][(_0x5056('0x6a'))](_0x5056('0x6b'));}return rp(_0x153143);}})[_0x5056('0x26')](function(_0x2be789){if(_0x2be789){var _0x5f41de=[_0x5056('0x6c'),_0x5056('0x6d'),_0x5056('0x6e'),_0x5056('0x6f')];_[_0x5056('0x70')](_0x2be789[_0x5056('0x61')],function(_0x3f34b6){return _0x5f41de['includes'](_0x3f34b6['type']);});return{'count':_0x2be789['ticket_fields'][_0x5056('0x3a')],'rows':_['map'](_0x2be789[_0x5056('0x61')],function(_0x43d241){return{'id':_0x43d241['id'],'name':_0x43d241[_0x5056('0x71')]>0x7?_0x43d241['title']:_0x43d241[_0x5056('0x30')],'custom':_0x43d241['position']>0x7?!![]:![],'options':_0x43d241[_0x5056('0x72')]?_0x43d241[_0x5056('0x72')]:_0x43d241[_0x5056('0x73')]?_0x43d241['custom_field_options']:[]};})};}})[_0x5056('0x26')](respondWithResult(_0x45eac9,null))['catch'](function(_0x54b0ba){var _0x2ed978=_0x3c7d5c[_0x5056('0x34')]['test']?0x1f4:_0x54b0ba[_0x5056('0x74')]||0x1f4;logger['error'](_0x5056('0x75'),_0x5056('0x59'),_0x2ed978,JSON[_0x5056('0x76')](_0x54b0ba));delete _0x54b0ba[_0x5056('0x2a')];if(_0x2ed978===0x191){_0x2ed978=0x190;}_0x45eac9[_0x5056('0x1a')](_0x2ed978)[_0x5056('0x2b')](_0x3c7d5c['query'][_0x5056('0x77')]?{'message':_0x5056('0x78'),'statusCode':_0x54b0ba[_0x5056('0x74')]}:_0x54b0ba);});}; \ No newline at end of file +var _0x6b20=['../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','merge','create','body','find','findOne','ZendeskConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZendeskField','getFields','username','password','authType','remoteUri','slice','format','Basic\x20%s','%s:%s','toString','base64','token','headers','Sequelize','ValidationError','Unknown\x20authentication\x20type','remove','includes','ticket_fields','position','title','system_field_options','custom_field_options','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x41c16a,_0x56ad31){var _0x29c279=function(_0x238301){while(--_0x238301){_0x41c16a['push'](_0x41c16a['shift']());}};_0x29c279(++_0x56ad31);}(_0x6b20,0xd1));var _0x06b2=function(_0x51cd9e,_0x43fb84){_0x51cd9e=_0x51cd9e-0x0;var _0x47848b=_0x6b20[_0x51cd9e];return _0x47848b;};'use strict';var emlformat=require(_0x06b2('0x0'));var rimraf=require(_0x06b2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x06b2('0x2'));var rp=require('request-promise');var moment=require(_0x06b2('0x3'));var BPromise=require(_0x06b2('0x4'));var Mustache=require(_0x06b2('0x5'));var util=require('util');var path=require(_0x06b2('0x6'));var sox=require(_0x06b2('0x7'));var csv=require(_0x06b2('0x8'));var ejs=require(_0x06b2('0x9'));var fs=require('fs');var fs_extra=require(_0x06b2('0xa'));var _=require(_0x06b2('0xb'));var squel=require(_0x06b2('0xc'));var crypto=require('crypto');var jsforce=require(_0x06b2('0xd'));var deskjs=require(_0x06b2('0xe'));var toCsv=require(_0x06b2('0x8'));var querystring=require('querystring');var Papa=require(_0x06b2('0xf'));var Redis=require('ioredis');var authService=require(_0x06b2('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x06b2('0x11'));var logger=require(_0x06b2('0x12'))('api');var utils=require(_0x06b2('0x13'));var config=require(_0x06b2('0x14'));var licenseUtil=require(_0x06b2('0x15'));var db=require(_0x06b2('0x16'))['db'];var integrations=require(_0x06b2('0x17'));function respondWithStatusCode(_0x810a12,_0x3039c9){_0x3039c9=_0x3039c9||0xcc;return function(_0x926bf6){if(_0x926bf6){return _0x810a12[_0x06b2('0x18')](_0x3039c9);}return _0x810a12[_0x06b2('0x19')](_0x3039c9)[_0x06b2('0x1a')]();};}function respondWithResult(_0x2822e9,_0x26faee){_0x26faee=_0x26faee||0xc8;return function(_0x544de8){if(_0x544de8){return _0x2822e9[_0x06b2('0x19')](_0x26faee)[_0x06b2('0x1b')](_0x544de8);}};}function respondWithFilteredResult(_0x47496c,_0x3830e9){return function(_0xef0466){if(_0xef0466){var _0x45d5c5=typeof _0x3830e9['offset']===_0x06b2('0x1c')&&typeof _0x3830e9[_0x06b2('0x1d')]==='undefined';var _0x1e16d1=_0xef0466['count'];var _0x4c9cae=_0x45d5c5?0x0:_0x3830e9[_0x06b2('0x1e')];var _0x1b4ab0=_0x45d5c5?_0xef0466[_0x06b2('0x1f')]:_0x3830e9[_0x06b2('0x1e')]+_0x3830e9['limit'];var _0x288801;if(_0x1b4ab0>=_0x1e16d1){_0x1b4ab0=_0x1e16d1;_0x288801=0xc8;}else{_0x288801=0xce;}_0x47496c[_0x06b2('0x19')](_0x288801);return _0x47496c[_0x06b2('0x20')](_0x06b2('0x21'),_0x4c9cae+'-'+_0x1b4ab0+'/'+_0x1e16d1)[_0x06b2('0x1b')](_0xef0466);}return null;};}function patchUpdates(_0x368ad8){return function(_0x268e7d){try{jsonpatch['apply'](_0x268e7d,_0x368ad8,!![]);}catch(_0x18c9a9){return BPromise[_0x06b2('0x22')](_0x18c9a9);}return _0x268e7d[_0x06b2('0x23')]();};}function saveUpdates(_0x208384,_0x4e2a4c){return function(_0x4fa84f){if(_0x4fa84f){return _0x4fa84f[_0x06b2('0x24')](_0x208384)[_0x06b2('0x25')](function(_0x4fc95f){return _0x4fc95f;});}return null;};}function removeEntity(_0x39659f,_0x5e40f2){return function(_0x3d58c6){if(_0x3d58c6){return _0x3d58c6[_0x06b2('0x26')]()[_0x06b2('0x25')](function(){_0x39659f['status'](0xcc)[_0x06b2('0x1a')]();});}};}function handleEntityNotFound(_0x306ce,_0xc65820){return function(_0x1a94dc){if(!_0x1a94dc){_0x306ce[_0x06b2('0x18')](0x194);}return _0x1a94dc;};}function handleError(_0x4f5e90,_0xbb00ea){_0xbb00ea=_0xbb00ea||0x1f4;return function(_0x34370b){logger[_0x06b2('0x27')](_0x34370b[_0x06b2('0x28')]);if(_0x34370b[_0x06b2('0x29')]){delete _0x34370b[_0x06b2('0x29')];}_0x4f5e90['status'](_0xbb00ea)[_0x06b2('0x2a')](_0x34370b);};}exports[_0x06b2('0x2b')]=function(_0x2720fa,_0x13c0eb){var _0x1f02d8={},_0x1bfaa9={},_0x3668bb={'count':0x0,'rows':[]};var _0x51698b=_[_0x06b2('0x2c')](db[_0x06b2('0x2d')][_0x06b2('0x2e')],function(_0x15a78b){return{'name':_0x15a78b[_0x06b2('0x2f')],'type':_0x15a78b[_0x06b2('0x30')][_0x06b2('0x31')]};});_0x1bfaa9[_0x06b2('0x32')]=_['map'](_0x51698b,_0x06b2('0x29'));_0x1bfaa9[_0x06b2('0x33')]=_[_0x06b2('0x34')](_0x2720fa[_0x06b2('0x33')]);_0x1bfaa9[_0x06b2('0x35')]=_[_0x06b2('0x36')](_0x1bfaa9[_0x06b2('0x32')],_0x1bfaa9['query']);_0x1f02d8['attributes']=_[_0x06b2('0x36')](_0x1bfaa9[_0x06b2('0x32')],qs[_0x06b2('0x37')](_0x2720fa['query'][_0x06b2('0x37')]));_0x1f02d8[_0x06b2('0x38')]=_0x1f02d8[_0x06b2('0x38')][_0x06b2('0x39')]?_0x1f02d8[_0x06b2('0x38')]:_0x1bfaa9[_0x06b2('0x32')];if(!_0x2720fa['query'][_0x06b2('0x3a')](_0x06b2('0x3b'))){_0x1f02d8[_0x06b2('0x1d')]=qs['limit'](_0x2720fa[_0x06b2('0x33')][_0x06b2('0x1d')]);_0x1f02d8['offset']=qs[_0x06b2('0x1e')](_0x2720fa[_0x06b2('0x33')][_0x06b2('0x1e')]);}_0x1f02d8[_0x06b2('0x3c')]=qs[_0x06b2('0x3d')](_0x2720fa[_0x06b2('0x33')][_0x06b2('0x3d')]);_0x1f02d8[_0x06b2('0x3e')]=qs[_0x06b2('0x35')](_[_0x06b2('0x3f')](_0x2720fa[_0x06b2('0x33')],_0x1bfaa9[_0x06b2('0x35')]),_0x51698b);if(_0x2720fa['query'][_0x06b2('0x40')]){_0x1f02d8['where']=_['merge'](_0x1f02d8[_0x06b2('0x3e')],{'$or':_['map'](_0x51698b,function(_0x26ab14){if(_0x26ab14['type']!==_0x06b2('0x41')){var _0x369673={};_0x369673[_0x26ab14[_0x06b2('0x29')]]={'$like':'%'+_0x2720fa[_0x06b2('0x33')][_0x06b2('0x40')]+'%'};return _0x369673;}})});}_0x1f02d8=_['merge']({},_0x1f02d8,_0x2720fa[_0x06b2('0x42')]);var _0xee3ec6={'where':_0x1f02d8[_0x06b2('0x3e')]};return db[_0x06b2('0x2d')][_0x06b2('0x1f')](_0xee3ec6)[_0x06b2('0x25')](function(_0x5f2549){_0x3668bb[_0x06b2('0x1f')]=_0x5f2549;if(_0x2720fa[_0x06b2('0x33')]['includeAll']){_0x1f02d8['include']=[{'all':!![]}];}return db[_0x06b2('0x2d')][_0x06b2('0x43')](_0x1f02d8);})[_0x06b2('0x25')](function(_0x3a8452){_0x3668bb[_0x06b2('0x44')]=_0x3a8452;return _0x3668bb;})[_0x06b2('0x25')](respondWithFilteredResult(_0x13c0eb,_0x1f02d8))[_0x06b2('0x45')](handleError(_0x13c0eb,null));};exports[_0x06b2('0x46')]=function(_0x2e2a80,_0x117bf4){var _0x1d7750={'raw':![],'where':{'id':_0x2e2a80[_0x06b2('0x47')]['id']}},_0xf9b9e={};_0xf9b9e[_0x06b2('0x32')]=_[_0x06b2('0x34')](db[_0x06b2('0x2d')][_0x06b2('0x2e')]);_0xf9b9e[_0x06b2('0x33')]=_[_0x06b2('0x34')](_0x2e2a80['query']);_0xf9b9e[_0x06b2('0x35')]=_[_0x06b2('0x36')](_0xf9b9e[_0x06b2('0x32')],_0xf9b9e[_0x06b2('0x33')]);_0x1d7750['attributes']=_[_0x06b2('0x36')](_0xf9b9e[_0x06b2('0x32')],qs['fields'](_0x2e2a80[_0x06b2('0x33')][_0x06b2('0x37')]));_0x1d7750['attributes']=_0x1d7750[_0x06b2('0x38')][_0x06b2('0x39')]?_0x1d7750['attributes']:_0xf9b9e['model'];if(_0x2e2a80['query'][_0x06b2('0x48')]){_0x1d7750[_0x06b2('0x49')]=[{'all':!![]}];}_0x1d7750=_[_0x06b2('0x4a')]({},_0x1d7750,_0x2e2a80[_0x06b2('0x42')]);return db[_0x06b2('0x2d')]['find'](_0x1d7750)['then'](handleEntityNotFound(_0x117bf4,null))[_0x06b2('0x25')](respondWithResult(_0x117bf4,null))[_0x06b2('0x45')](handleError(_0x117bf4,null));};exports[_0x06b2('0x4b')]=function(_0x1f4d89,_0x33ac29){return db[_0x06b2('0x2d')]['create'](_0x1f4d89[_0x06b2('0x4c')],{})[_0x06b2('0x25')](respondWithResult(_0x33ac29,0xc9))[_0x06b2('0x45')](handleError(_0x33ac29,null));};exports[_0x06b2('0x24')]=function(_0x146c5c,_0x36a74a){if(_0x146c5c['body']['id']){delete _0x146c5c[_0x06b2('0x4c')]['id'];}return db[_0x06b2('0x2d')][_0x06b2('0x4d')]({'where':{'id':_0x146c5c[_0x06b2('0x47')]['id']}})['then'](handleEntityNotFound(_0x36a74a,null))[_0x06b2('0x25')](saveUpdates(_0x146c5c[_0x06b2('0x4c')],null))[_0x06b2('0x25')](respondWithResult(_0x36a74a,null))[_0x06b2('0x45')](handleError(_0x36a74a,null));};exports['destroy']=function(_0x346f04,_0x8cf9fe){return db[_0x06b2('0x2d')][_0x06b2('0x4d')]({'where':{'id':_0x346f04[_0x06b2('0x47')]['id']}})[_0x06b2('0x25')](handleEntityNotFound(_0x8cf9fe,null))[_0x06b2('0x25')](removeEntity(_0x8cf9fe,null))[_0x06b2('0x45')](handleError(_0x8cf9fe,null));};exports['getConfigurations']=function(_0x33bc8e,_0x8288ae,_0x318a3b){var _0x5c328c={};var _0x2857d5={};var _0x2f75a0;var _0x4fba4c;return db['ZendeskAccount'][_0x06b2('0x4e')]({'where':{'id':_0x33bc8e['params']['id']}})['then'](handleEntityNotFound(_0x8288ae,null))[_0x06b2('0x25')](function(_0x5899c1){if(_0x5899c1){_0x2f75a0=_0x5899c1;_0x2857d5[_0x06b2('0x32')]=_[_0x06b2('0x34')](db[_0x06b2('0x4f')][_0x06b2('0x2e')]);_0x2857d5[_0x06b2('0x33')]=_[_0x06b2('0x34')](_0x33bc8e[_0x06b2('0x33')]);_0x2857d5[_0x06b2('0x35')]=_[_0x06b2('0x36')](_0x2857d5[_0x06b2('0x32')],_0x2857d5['query']);_0x5c328c['attributes']=_[_0x06b2('0x36')](_0x2857d5[_0x06b2('0x32')],qs['fields'](_0x33bc8e[_0x06b2('0x33')][_0x06b2('0x37')]));_0x5c328c[_0x06b2('0x38')]=_0x5c328c[_0x06b2('0x38')]['length']?_0x5c328c['attributes']:_0x2857d5['model'];_0x5c328c[_0x06b2('0x3c')]=qs['sort'](_0x33bc8e['query'][_0x06b2('0x3d')]);_0x5c328c[_0x06b2('0x3e')]=qs[_0x06b2('0x35')](_[_0x06b2('0x3f')](_0x33bc8e[_0x06b2('0x33')],_0x2857d5[_0x06b2('0x35')]));if(_0x33bc8e['query'][_0x06b2('0x40')]){_0x5c328c[_0x06b2('0x3e')]=_['merge'](_0x5c328c[_0x06b2('0x3e')],{'$or':_[_0x06b2('0x2c')](_0x5c328c[_0x06b2('0x38')],function(_0x2e0388){var _0x23ce27={};_0x23ce27[_0x2e0388]={'$like':'%'+_0x33bc8e[_0x06b2('0x33')][_0x06b2('0x40')]+'%'};return _0x23ce27;})});}_0x5c328c=_[_0x06b2('0x4a')]({},_0x5c328c,_0x33bc8e[_0x06b2('0x42')]);return _0x2f75a0[_0x06b2('0x50')](_0x5c328c);}})[_0x06b2('0x25')](function(_0x397b16){if(_0x397b16){_0x4fba4c=_0x397b16['length'];if(!_0x33bc8e[_0x06b2('0x33')][_0x06b2('0x3a')]('nolimit')){_0x5c328c[_0x06b2('0x1d')]=qs[_0x06b2('0x1d')](_0x33bc8e[_0x06b2('0x33')][_0x06b2('0x1d')]);_0x5c328c['offset']=qs[_0x06b2('0x1e')](_0x33bc8e[_0x06b2('0x33')][_0x06b2('0x1e')]);}return _0x2f75a0['getConfigurations'](_0x5c328c);}})[_0x06b2('0x25')](function(_0x1ad9f7){if(_0x1ad9f7){return _0x1ad9f7?{'count':_0x4fba4c,'rows':_0x1ad9f7}:null;}})[_0x06b2('0x25')](respondWithResult(_0x8288ae,null))[_0x06b2('0x45')](handleError(_0x8288ae,null));};exports[_0x06b2('0x51')]=function(_0x43b907,_0x1aae55,_0x10faea){if(_0x43b907[_0x06b2('0x4c')]['id']){delete _0x43b907['body']['id'];}return db['ZendeskAccount']['findOne']({'where':{'id':_0x43b907['params']['id']}})[_0x06b2('0x25')](handleEntityNotFound(_0x1aae55,null))['then'](function(_0x200a6e){if(_0x200a6e){_0x43b907[_0x06b2('0x4c')][_0x06b2('0x52')]=_0x200a6e['id'];_0x43b907[_0x06b2('0x4c')][_0x06b2('0x53')]=integrations[_0x06b2('0x54')](_0x43b907['body']['channel'],_0x43b907[_0x06b2('0x4c')][_0x06b2('0x30')]);_0x43b907['body'][_0x06b2('0x55')]=integrations[_0x06b2('0x56')](_0x43b907[_0x06b2('0x4c')][_0x06b2('0x57')],_0x43b907[_0x06b2('0x4c')][_0x06b2('0x30')]);return db['ZendeskConfiguration'][_0x06b2('0x4b')](_0x43b907['body'],{'include':[{'model':db[_0x06b2('0x58')],'as':_0x06b2('0x53')},{'model':db[_0x06b2('0x58')],'as':'Descriptions'}]});}return null;})[_0x06b2('0x25')](respondWithResult(_0x1aae55,null))[_0x06b2('0x45')](handleError(_0x1aae55,null));};exports[_0x06b2('0x59')]=function(_0x4cc763,_0xc1010,_0x4900d2){var _0x15b345='';return db[_0x06b2('0x2d')][_0x06b2('0x4e')]({'where':{'id':_0x4cc763[_0x06b2('0x47')]['id']},'attributes':['id',_0x06b2('0x5a'),_0x06b2('0x5b'),'token',_0x06b2('0x5c'),_0x06b2('0x5d')]})[_0x06b2('0x25')](handleEntityNotFound(_0xc1010,null))[_0x06b2('0x25')](function(_0x5f3db5){if(_0x5f3db5){_0x15b345=_0x5f3db5[_0x06b2('0x5d')];var _0x39464c=_0x15b345[_0x06b2('0x5e')](-0x1);if(_0x39464c==='/'){_0x15b345=_0x15b345['substring'](0x0,_0x15b345['lastIndexOf'](_0x39464c));}var _0x3ef003={'method':'GET','uri':util[_0x06b2('0x5f')]('%s/%s',_0x15b345,'ticket_fields'),'json':!![]};switch(_0x5f3db5[_0x06b2('0x5c')]){case _0x06b2('0x5b'):_0x3ef003['headers']={'Authorization':util[_0x06b2('0x5f')](_0x06b2('0x60'),new Buffer(util[_0x06b2('0x5f')](_0x06b2('0x61'),_0x5f3db5[_0x06b2('0x5a')],_0x5f3db5[_0x06b2('0x5b')]))[_0x06b2('0x62')](_0x06b2('0x63')))};break;case _0x06b2('0x64'):_0x3ef003[_0x06b2('0x65')]={'Authorization':util[_0x06b2('0x5f')]('Basic\x20%s',new Buffer(util[_0x06b2('0x5f')]('%s/token:%s',_0x5f3db5['username'],_0x5f3db5[_0x06b2('0x64')]))[_0x06b2('0x62')]('base64'))};break;default:throw new db[(_0x06b2('0x66'))][(_0x06b2('0x67'))](_0x06b2('0x68'));}return rp(_0x3ef003);}})['then'](function(_0x309337){if(_0x309337){var _0x3ff04f=['subject','description','group','assignee'];_[_0x06b2('0x69')](_0x309337['ticket_fields'],function(_0x1e4412){return _0x3ff04f[_0x06b2('0x6a')](_0x1e4412[_0x06b2('0x30')]);});return{'count':_0x309337[_0x06b2('0x6b')][_0x06b2('0x39')],'rows':_[_0x06b2('0x2c')](_0x309337[_0x06b2('0x6b')],function(_0x444725){return{'id':_0x444725['id'],'name':_0x444725[_0x06b2('0x6c')]>0x7?_0x444725[_0x06b2('0x6d')]:_0x444725[_0x06b2('0x30')],'custom':_0x444725[_0x06b2('0x6c')]>0x7?!![]:![],'options':_0x444725[_0x06b2('0x6e')]?_0x444725['system_field_options']:_0x444725['custom_field_options']?_0x444725[_0x06b2('0x6f')]:[]};})};}})[_0x06b2('0x25')](respondWithResult(_0xc1010,null))[_0x06b2('0x45')](function(_0x1328ec){var _0x364706=_0x4cc763[_0x06b2('0x33')]['test']?0x1f4:_0x1328ec['statusCode']||0x1f4;logger[_0x06b2('0x27')](_0x06b2('0x70'),_0x06b2('0x59'),_0x364706,JSON[_0x06b2('0x71')](_0x1328ec));delete _0x1328ec[_0x06b2('0x29')];if(_0x364706===0x191){_0x364706=0x190;}_0xc1010['status'](_0x364706)[_0x06b2('0x2a')](_0x4cc763['query']['test']?{'message':_0x06b2('0x72'),'statusCode':_0x1328ec[_0x06b2('0x73')]}:_0x1328ec);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index a84a0d9..7e9b4bd 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 _0xa609=['define','ZendeskAccount','int_zendesk_accounts','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration'];(function(_0x1cb1e3,_0x41e279){var _0x18d694=function(_0x4dc61d){while(--_0x4dc61d){_0x1cb1e3['push'](_0x1cb1e3['shift']());}};_0x18d694(++_0x41e279);}(_0xa609,0x147));var _0x9a60=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xa609[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x9a60('0x0'));var util=require('util');var logger=require(_0x9a60('0x1'))('api');var moment=require(_0x9a60('0x2'));var BPromise=require('bluebird');var rp=require(_0x9a60('0x3'));var fs=require('fs');var path=require(_0x9a60('0x4'));var rimraf=require(_0x9a60('0x5'));var config=require(_0x9a60('0x6'));var attributes=require(_0x9a60('0x7'));var integrations=require(_0x9a60('0x8'));module['exports']=function(_0x3e222d,_0x2b46db){return _0x3e222d[_0x9a60('0x9')](_0x9a60('0xa'),attributes,{'tableName':_0x9a60('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0334=['../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x26fce0,_0x29aee3){var _0x2f5b68=function(_0xd86c3){while(--_0xd86c3){_0x26fce0['push'](_0x26fce0['shift']());}};_0x2f5b68(++_0x29aee3);}(_0x0334,0x7a));var _0x4033=function(_0x4960c5,_0x1b53a6){_0x4960c5=_0x4960c5-0x0;var _0x510202=_0x0334[_0x4960c5];return _0x510202;};'use strict';var _=require(_0x4033('0x0'));var util=require(_0x4033('0x1'));var logger=require(_0x4033('0x2'))(_0x4033('0x3'));var moment=require(_0x4033('0x4'));var BPromise=require('bluebird');var rp=require(_0x4033('0x5'));var fs=require('fs');var path=require(_0x4033('0x6'));var rimraf=require('rimraf');var config=require(_0x4033('0x7'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x4033('0x8'));module[_0x4033('0x9')]=function(_0x1656fb,_0x4d3f96){return _0x1656fb[_0x4033('0xa')](_0x4033('0xb'),attributes,{'tableName':_0x4033('0xc'),'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 77ea5ad..a8b743b 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 _0x480e=['ShowZendeskAccount','find','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ZendeskAccount,\x20%s,\x20%s','result','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','include','model','map','catch'];(function(_0x5b4f9c,_0x1a9eed){var _0x114bea=function(_0x525cb2){while(--_0x525cb2){_0x5b4f9c['push'](_0x5b4f9c['shift']());}};_0x114bea(++_0x1a9eed);}(_0x480e,0x6e));var _0xe480=function(_0x4cdb5a,_0x14862d){_0x4cdb5a=_0x4cdb5a-0x0;var _0x4adfa1=_0x480e[_0x4cdb5a];return _0x4adfa1;};'use strict';var _=require(_0xe480('0x0'));var util=require('util');var moment=require(_0xe480('0x1'));var BPromise=require(_0xe480('0x2'));var rs=require(_0xe480('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe480('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe480('0x5'))(_0xe480('0x6'));var config=require(_0xe480('0x7'));var jayson=require(_0xe480('0x8'));var client=jayson['client'][_0xe480('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d5622,_0x54f238,_0x4d6c7b){return new BPromise(function(_0x4c8e34,_0x38987b){return client[_0xe480('0xa')](_0x4d5622,_0x4d6c7b)[_0xe480('0xb')](function(_0x712cc9){logger[_0xe480('0xc')]('ZendeskAccount,\x20%s,\x20%s',_0x54f238,_0xe480('0xd'));logger[_0xe480('0xe')](_0xe480('0xf'),_0x54f238,_0xe480('0xd'),JSON[_0xe480('0x10')](_0x712cc9));if(_0x712cc9[_0xe480('0x11')]){if(_0x712cc9[_0xe480('0x11')][_0xe480('0x12')]===0x1f4){logger[_0xe480('0x11')]('ZendeskAccount,\x20%s,\x20%s',_0x54f238,_0x712cc9[_0xe480('0x11')][_0xe480('0x13')]);return _0x38987b(_0x712cc9[_0xe480('0x11')][_0xe480('0x13')]);}logger[_0xe480('0x11')](_0xe480('0x14'),_0x54f238,_0x712cc9[_0xe480('0x11')][_0xe480('0x13')]);return _0x4c8e34(_0x712cc9['error'][_0xe480('0x13')]);}else{logger[_0xe480('0xc')](_0xe480('0x14'),_0x54f238,_0xe480('0xd'));_0x4c8e34(_0x712cc9[_0xe480('0x15')][_0xe480('0x13')]);}})['catch'](function(_0x272d1b){logger[_0xe480('0x11')](_0xe480('0x14'),_0x54f238,_0x272d1b);_0x38987b(_0x272d1b);});});}exports[_0xe480('0x16')]=function(_0x6e23f1){var _0x2bcced=this;return new Promise(function(_0x4832e2,_0x33e684){return db[_0xe480('0x17')][_0xe480('0x18')]({'raw':_0x6e23f1[_0xe480('0x19')]?_0x6e23f1[_0xe480('0x19')][_0xe480('0x1a')]===undefined?!![]:![]:!![],'where':_0x6e23f1['options']?_0x6e23f1[_0xe480('0x19')][_0xe480('0x1b')]||null:null,'attributes':_0x6e23f1['options']?_0x6e23f1[_0xe480('0x19')][_0xe480('0x1c')]||null:null,'limit':_0x6e23f1['options']?_0x6e23f1[_0xe480('0x19')][_0xe480('0x1d')]||null:null,'include':_0x6e23f1[_0xe480('0x19')]?_0x6e23f1['options'][_0xe480('0x1e')]?_['map'](_0x6e23f1[_0xe480('0x19')][_0xe480('0x1e')],function(_0x2f7e46){return{'model':db[_0x2f7e46[_0xe480('0x1f')]],'as':_0x2f7e46['as'],'attributes':_0x2f7e46[_0xe480('0x1c')],'include':_0x2f7e46[_0xe480('0x1e')]?_[_0xe480('0x20')](_0x2f7e46[_0xe480('0x1e')],function(_0x574777){return{'model':db[_0x574777[_0xe480('0x1f')]],'as':_0x574777['as'],'attributes':_0x574777[_0xe480('0x1c')],'include':_0x574777['include']?_[_0xe480('0x20')](_0x574777[_0xe480('0x1e')],function(_0x2fb842){return{'model':db[_0x2fb842[_0xe480('0x1f')]],'as':_0x2fb842['as'],'attributes':_0x2fb842['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x561048){logger['info'](_0xe480('0x16'),_0x6e23f1);logger[_0xe480('0xe')](_0xe480('0x16'),_0x6e23f1,JSON['stringify'](_0x561048));_0x4832e2(_0x561048);})[_0xe480('0x21')](function(_0x5c4848){logger[_0xe480('0x11')](_0xe480('0x16'),_0x5c4848[_0xe480('0x13')],_0x6e23f1);_0x33e684(_0x2bcced[_0xe480('0x11')](0x1f4,_0x5c4848[_0xe480('0x13')]));});});};exports[_0xe480('0x22')]=function(_0x3bdbac){var _0x54a93a=this;return new Promise(function(_0x392894,_0x4414bf){return db['ZendeskAccount'][_0xe480('0x23')]({'raw':_0x3bdbac['options']?_0x3bdbac['options'][_0xe480('0x1a')]===undefined?!![]:![]:!![],'where':_0x3bdbac[_0xe480('0x19')]?_0x3bdbac[_0xe480('0x19')][_0xe480('0x1b')]||null:null,'attributes':_0x3bdbac[_0xe480('0x19')]?_0x3bdbac[_0xe480('0x19')][_0xe480('0x1c')]||null:null,'include':_0x3bdbac['options']?_0x3bdbac['options'][_0xe480('0x1e')]?_[_0xe480('0x20')](_0x3bdbac['options'][_0xe480('0x1e')],function(_0x2059e9){return{'model':db[_0x2059e9['model']],'as':_0x2059e9['as'],'attributes':_0x2059e9[_0xe480('0x1c')],'include':_0x2059e9[_0xe480('0x1e')]?_[_0xe480('0x20')](_0x2059e9[_0xe480('0x1e')],function(_0xd35875){return{'model':db[_0xd35875[_0xe480('0x1f')]],'as':_0xd35875['as'],'attributes':_0xd35875[_0xe480('0x1c')],'include':_0xd35875[_0xe480('0x1e')]?_['map'](_0xd35875['include'],function(_0x10e8ff){return{'model':db[_0x10e8ff[_0xe480('0x1f')]],'as':_0x10e8ff['as'],'attributes':_0x10e8ff[_0xe480('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe480('0xb')](function(_0x41e21d){logger[_0xe480('0xc')](_0xe480('0x22'),_0x3bdbac);logger[_0xe480('0xe')](_0xe480('0x22'),_0x3bdbac,JSON[_0xe480('0x10')](_0x41e21d));_0x392894(_0x41e21d);})[_0xe480('0x21')](function(_0x29f0c5){logger['error'](_0xe480('0x22'),_0x29f0c5[_0xe480('0x13')],_0x3bdbac);_0x4414bf(_0x54a93a['error'](0x1f4,_0x29f0c5[_0xe480('0x13')]));});});}; \ No newline at end of file +var _0xf8cc=['ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','limit','include','map','model','attributes','ShowZendeskAccount','lodash','util','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x23b655,_0x4feb2b){var _0x364b32=function(_0x4e41ac){while(--_0x4e41ac){_0x23b655['push'](_0x23b655['shift']());}};_0x364b32(++_0x4feb2b);}(_0xf8cc,0x173));var _0xcf8c=function(_0x52476d,_0x3cf150){_0x52476d=_0x52476d-0x0;var _0xd7018a=_0xf8cc[_0x52476d];return _0xd7018a;};'use strict';var _=require(_0xcf8c('0x0'));var util=require(_0xcf8c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcf8c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcf8c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xcf8c('0x4'))('rpc');var config=require(_0xcf8c('0x5'));var jayson=require(_0xcf8c('0x6'));var client=jayson[_0xcf8c('0x7')][_0xcf8c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1f77d2,_0x50b6eb,_0x391bb8){return new BPromise(function(_0x3ec3d0,_0xaa9d78){return client['request'](_0x1f77d2,_0x391bb8)[_0xcf8c('0x9')](function(_0x41a3e3){logger['info'](_0xcf8c('0xa'),_0x50b6eb,_0xcf8c('0xb'));logger[_0xcf8c('0xc')](_0xcf8c('0xd'),_0x50b6eb,_0xcf8c('0xb'),JSON[_0xcf8c('0xe')](_0x41a3e3));if(_0x41a3e3['error']){if(_0x41a3e3['error']['code']===0x1f4){logger['error'](_0xcf8c('0xa'),_0x50b6eb,_0x41a3e3[_0xcf8c('0xf')][_0xcf8c('0x10')]);return _0xaa9d78(_0x41a3e3[_0xcf8c('0xf')][_0xcf8c('0x10')]);}logger[_0xcf8c('0xf')](_0xcf8c('0xa'),_0x50b6eb,_0x41a3e3[_0xcf8c('0xf')][_0xcf8c('0x10')]);return _0x3ec3d0(_0x41a3e3['error'][_0xcf8c('0x10')]);}else{logger[_0xcf8c('0x11')](_0xcf8c('0xa'),_0x50b6eb,_0xcf8c('0xb'));_0x3ec3d0(_0x41a3e3[_0xcf8c('0x12')][_0xcf8c('0x10')]);}})[_0xcf8c('0x13')](function(_0x24855a){logger[_0xcf8c('0xf')](_0xcf8c('0xa'),_0x50b6eb,_0x24855a);_0xaa9d78(_0x24855a);});});}exports[_0xcf8c('0x14')]=function(_0x5da595){var _0x205a77=this;return new Promise(function(_0x35d751,_0x1d82cb){return db[_0xcf8c('0x15')][_0xcf8c('0x16')]({'raw':_0x5da595['options']?_0x5da595[_0xcf8c('0x17')][_0xcf8c('0x18')]===undefined?!![]:![]:!![],'where':_0x5da595[_0xcf8c('0x17')]?_0x5da595[_0xcf8c('0x17')][_0xcf8c('0x19')]||null:null,'attributes':_0x5da595[_0xcf8c('0x17')]?_0x5da595[_0xcf8c('0x17')]['attributes']||null:null,'limit':_0x5da595[_0xcf8c('0x17')]?_0x5da595['options'][_0xcf8c('0x1a')]||null:null,'include':_0x5da595[_0xcf8c('0x17')]?_0x5da595[_0xcf8c('0x17')][_0xcf8c('0x1b')]?_[_0xcf8c('0x1c')](_0x5da595[_0xcf8c('0x17')][_0xcf8c('0x1b')],function(_0x54a6c7){return{'model':db[_0x54a6c7[_0xcf8c('0x1d')]],'as':_0x54a6c7['as'],'attributes':_0x54a6c7['attributes'],'include':_0x54a6c7[_0xcf8c('0x1b')]?_[_0xcf8c('0x1c')](_0x54a6c7[_0xcf8c('0x1b')],function(_0x2d3c12){return{'model':db[_0x2d3c12[_0xcf8c('0x1d')]],'as':_0x2d3c12['as'],'attributes':_0x2d3c12[_0xcf8c('0x1e')],'include':_0x2d3c12['include']?_[_0xcf8c('0x1c')](_0x2d3c12[_0xcf8c('0x1b')],function(_0x589f67){return{'model':db[_0x589f67['model']],'as':_0x589f67['as'],'attributes':_0x589f67[_0xcf8c('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3dee06){logger[_0xcf8c('0x11')](_0xcf8c('0x14'),_0x5da595);logger[_0xcf8c('0xc')]('GetZendeskAccount',_0x5da595,JSON['stringify'](_0x3dee06));_0x35d751(_0x3dee06);})[_0xcf8c('0x13')](function(_0x288828){logger[_0xcf8c('0xf')]('GetZendeskAccount',_0x288828[_0xcf8c('0x10')],_0x5da595);_0x1d82cb(_0x205a77[_0xcf8c('0xf')](0x1f4,_0x288828[_0xcf8c('0x10')]));});});};exports[_0xcf8c('0x1f')]=function(_0x35124b){var _0x30a75d=this;return new Promise(function(_0x21533c,_0x442c73){return db[_0xcf8c('0x15')]['find']({'raw':_0x35124b[_0xcf8c('0x17')]?_0x35124b[_0xcf8c('0x17')][_0xcf8c('0x18')]===undefined?!![]:![]:!![],'where':_0x35124b['options']?_0x35124b['options'][_0xcf8c('0x19')]||null:null,'attributes':_0x35124b[_0xcf8c('0x17')]?_0x35124b['options'][_0xcf8c('0x1e')]||null:null,'include':_0x35124b[_0xcf8c('0x17')]?_0x35124b[_0xcf8c('0x17')][_0xcf8c('0x1b')]?_[_0xcf8c('0x1c')](_0x35124b[_0xcf8c('0x17')][_0xcf8c('0x1b')],function(_0x43c77a){return{'model':db[_0x43c77a[_0xcf8c('0x1d')]],'as':_0x43c77a['as'],'attributes':_0x43c77a[_0xcf8c('0x1e')],'include':_0x43c77a[_0xcf8c('0x1b')]?_[_0xcf8c('0x1c')](_0x43c77a[_0xcf8c('0x1b')],function(_0x162582){return{'model':db[_0x162582['model']],'as':_0x162582['as'],'attributes':_0x162582[_0xcf8c('0x1e')],'include':_0x162582['include']?_[_0xcf8c('0x1c')](_0x162582[_0xcf8c('0x1b')],function(_0x39fadf){return{'model':db[_0x39fadf[_0xcf8c('0x1d')]],'as':_0x39fadf['as'],'attributes':_0x39fadf[_0xcf8c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xcf8c('0x9')](function(_0x1cf40f){logger['info'](_0xcf8c('0x1f'),_0x35124b);logger[_0xcf8c('0xc')](_0xcf8c('0x1f'),_0x35124b,JSON[_0xcf8c('0xe')](_0x1cf40f));_0x21533c(_0x1cf40f);})[_0xcf8c('0x13')](function(_0x561ef9){logger[_0xcf8c('0xf')](_0xcf8c('0x1f'),_0x561ef9[_0xcf8c('0x10')],_0x35124b);_0x442c73(_0x30a75d[_0xcf8c('0xf')](0x1f4,_0x561ef9['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 1b09ba0..bfc7324 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 _0x5c00=['path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','getFields','/:id/subjects','getSubjects','/:id/tags','post','create','setTags','put','/:id','delete','destroy','exports','multer','util'];(function(_0x5d0a81,_0x48a656){var _0x4574d2=function(_0xb24f59){while(--_0xb24f59){_0x5d0a81['push'](_0x5d0a81['shift']());}};_0x4574d2(++_0x48a656);}(_0x5c00,0x17e));var _0x05c0=function(_0x3c8033,_0x18ad41){_0x3c8033=_0x3c8033-0x0;var _0x35f8f3=_0x5c00[_0x3c8033];return _0x35f8f3;};'use strict';var multer=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var path=require(_0x05c0('0x2'));var timeout=require('connect-timeout');var express=require(_0x05c0('0x3'));var router=express['Router']();var fs_extra=require(_0x05c0('0x4'));var auth=require(_0x05c0('0x5'));var interaction=require(_0x05c0('0x6'));var config=require(_0x05c0('0x7'));var controller=require('./intZendeskConfiguration.controller');router[_0x05c0('0x8')]('/',auth[_0x05c0('0x9')](),controller[_0x05c0('0xa')]);router[_0x05c0('0x8')]('/:id',auth[_0x05c0('0x9')](),controller[_0x05c0('0xb')]);router[_0x05c0('0x8')]('/:id/fields',auth[_0x05c0('0x9')](),controller[_0x05c0('0xc')]);router[_0x05c0('0x8')](_0x05c0('0xd'),auth[_0x05c0('0x9')](),controller[_0x05c0('0xe')]);router['get']('/:id/descriptions',auth[_0x05c0('0x9')](),controller['getDescriptions']);router[_0x05c0('0x8')](_0x05c0('0xf'),auth[_0x05c0('0x9')](),controller['getTags']);router[_0x05c0('0x10')]('/',auth['isAuthenticated'](),controller[_0x05c0('0x11')]);router[_0x05c0('0x10')](_0x05c0('0xf'),auth[_0x05c0('0x9')](),controller[_0x05c0('0x12')]);router[_0x05c0('0x13')](_0x05c0('0x14'),auth[_0x05c0('0x9')](),controller['update']);router[_0x05c0('0x15')](_0x05c0('0x14'),auth[_0x05c0('0x9')](),controller[_0x05c0('0x16')]);module[_0x05c0('0x17')]=router; \ No newline at end of file +var _0xb688=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','update','exports','util'];(function(_0x513f27,_0x1cbc87){var _0xa316b7=function(_0x3b592d){while(--_0x3b592d){_0x513f27['push'](_0x513f27['shift']());}};_0xa316b7(++_0x1cbc87);}(_0xb688,0xcf));var _0x8b68=function(_0x254667,_0x257442){_0x254667=_0x254667-0x0;var _0x162473=_0xb688[_0x254667];return _0x162473;};'use strict';var multer=require('multer');var util=require(_0x8b68('0x0'));var path=require(_0x8b68('0x1'));var timeout=require(_0x8b68('0x2'));var express=require(_0x8b68('0x3'));var router=express[_0x8b68('0x4')]();var fs_extra=require(_0x8b68('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8b68('0x6'));var config=require(_0x8b68('0x7'));var controller=require(_0x8b68('0x8'));router[_0x8b68('0x9')]('/',auth['isAuthenticated'](),controller[_0x8b68('0xa')]);router['get'](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xd')]);router[_0x8b68('0x9')](_0x8b68('0xe'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xf')]);router[_0x8b68('0x9')](_0x8b68('0x10'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x11')]);router[_0x8b68('0x9')](_0x8b68('0x12'),auth['isAuthenticated'](),controller[_0x8b68('0x13')]);router[_0x8b68('0x9')](_0x8b68('0x14'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x15')]);router[_0x8b68('0x16')]('/',auth[_0x8b68('0xc')](),controller[_0x8b68('0x17')]);router[_0x8b68('0x16')]('/:id/tags',auth[_0x8b68('0xc')](),controller['setTags']);router['put'](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x18')]);router['delete']('/:id',auth[_0x8b68('0xc')](),controller['destroy']);module[_0x8b68('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 6e081e0..494a9f9 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 _0x4ca8=['STRING','sequelize'];(function(_0x40b6db,_0x2a1fbb){var _0x3eaa81=function(_0x203e91){while(--_0x203e91){_0x40b6db['push'](_0x40b6db['shift']());}};_0x3eaa81(++_0x2a1fbb);}(_0x4ca8,0x115));var _0x84ca=function(_0x3937f5,_0x806903){_0x3937f5=_0x3937f5-0x0;var _0x472d73=_0x4ca8[_0x3937f5];return _0x472d73;};'use strict';var Sequelize=require(_0x84ca('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x84ca('0x1')]}}; \ No newline at end of file +var _0x4113=['exports','STRING','sequelize'];(function(_0x6adec3,_0x3d264a){var _0xf68ec2=function(_0x54a2c1){while(--_0x54a2c1){_0x6adec3['push'](_0x6adec3['shift']());}};_0xf68ec2(++_0x3d264a);}(_0x4113,0xad));var _0x3411=function(_0x57fd5e,_0x4116b3){_0x57fd5e=_0x57fd5e-0x0;var _0x3bda81=_0x4113[_0x57fd5e];return _0x3bda81;};'use strict';var Sequelize=require(_0x3411('0x0'));module[_0x3411('0x1')]={'name':{'type':Sequelize[_0x3411('0x2')]},'description':{'type':Sequelize[_0x3411('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 6fe76a8..4657a43 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 _0xa0d6=['body','findOne','getFields','ZendeskField','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','length','includeAll','find','catch','create'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa0d6,0x1c1));var _0x6a0d=function(_0x31ee83,_0x3ae9df){_0x31ee83=_0x31ee83-0x0;var _0x46e8d1=_0xa0d6[_0x31ee83];return _0x46e8d1;};'use strict';var emlformat=require(_0x6a0d('0x0'));var rimraf=require(_0x6a0d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6a0d('0x2'));var rp=require('request-promise');var moment=require(_0x6a0d('0x3'));var BPromise=require(_0x6a0d('0x4'));var Mustache=require(_0x6a0d('0x5'));var util=require(_0x6a0d('0x6'));var path=require(_0x6a0d('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6a0d('0x8'));var _=require(_0x6a0d('0x9'));var squel=require(_0x6a0d('0xa'));var crypto=require(_0x6a0d('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6a0d('0xc'));var toCsv=require(_0x6a0d('0xd'));var querystring=require(_0x6a0d('0xe'));var Papa=require(_0x6a0d('0xf'));var Redis=require(_0x6a0d('0x10'));var authService=require(_0x6a0d('0x11'));var qs=require(_0x6a0d('0x12'));var as=require(_0x6a0d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6a0d('0x14'))(_0x6a0d('0x15'));var utils=require(_0x6a0d('0x16'));var config=require(_0x6a0d('0x17'));var licenseUtil=require(_0x6a0d('0x18'));var db=require(_0x6a0d('0x19'))['db'];function respondWithStatusCode(_0x3c3550,_0x115cb1){_0x115cb1=_0x115cb1||0xcc;return function(_0x18744d){if(_0x18744d){return _0x3c3550[_0x6a0d('0x1a')](_0x115cb1);}return _0x3c3550['status'](_0x115cb1)[_0x6a0d('0x1b')]();};}function respondWithResult(_0x534234,_0x289ac9){_0x289ac9=_0x289ac9||0xc8;return function(_0x57e1b9){if(_0x57e1b9){return _0x534234[_0x6a0d('0x1c')](_0x289ac9)[_0x6a0d('0x1d')](_0x57e1b9);}};}function respondWithFilteredResult(_0x65bedd,_0xbaf91e){return function(_0x85231){if(_0x85231){var _0x59b480=typeof _0xbaf91e[_0x6a0d('0x1e')]===_0x6a0d('0x1f')&&typeof _0xbaf91e[_0x6a0d('0x20')]===_0x6a0d('0x1f');var _0x41d4b8=_0x85231[_0x6a0d('0x21')];var _0x416cbc=_0x59b480?0x0:_0xbaf91e[_0x6a0d('0x1e')];var _0x9feb11=_0x59b480?_0x85231[_0x6a0d('0x21')]:_0xbaf91e['offset']+_0xbaf91e[_0x6a0d('0x20')];var _0x56e848;if(_0x9feb11>=_0x41d4b8){_0x9feb11=_0x41d4b8;_0x56e848=0xc8;}else{_0x56e848=0xce;}_0x65bedd[_0x6a0d('0x1c')](_0x56e848);return _0x65bedd[_0x6a0d('0x22')](_0x6a0d('0x23'),_0x416cbc+'-'+_0x9feb11+'/'+_0x41d4b8)['json'](_0x85231);}return null;};}function patchUpdates(_0x527af2){return function(_0x4573d8){try{jsonpatch[_0x6a0d('0x24')](_0x4573d8,_0x527af2,!![]);}catch(_0x3553c2){return BPromise[_0x6a0d('0x25')](_0x3553c2);}return _0x4573d8[_0x6a0d('0x26')]();};}function saveUpdates(_0x4f6f96,_0x4a4231){return function(_0x1ad089){if(_0x1ad089){return _0x1ad089[_0x6a0d('0x27')](_0x4f6f96)['then'](function(_0x5268a8){return _0x5268a8;});}return null;};}function removeEntity(_0x7aa871,_0x334797){return function(_0x42bdc9){if(_0x42bdc9){return _0x42bdc9[_0x6a0d('0x28')]()[_0x6a0d('0x29')](function(){_0x7aa871[_0x6a0d('0x1c')](0xcc)[_0x6a0d('0x1b')]();});}};}function handleEntityNotFound(_0x4c17af,_0x1544b4){return function(_0x373db2){if(!_0x373db2){_0x4c17af[_0x6a0d('0x1a')](0x194);}return _0x373db2;};}function handleError(_0x3718aa,_0x12de59){_0x12de59=_0x12de59||0x1f4;return function(_0x47e2fb){logger[_0x6a0d('0x2a')](_0x47e2fb[_0x6a0d('0x2b')]);if(_0x47e2fb[_0x6a0d('0x2c')]){delete _0x47e2fb[_0x6a0d('0x2c')];}_0x3718aa[_0x6a0d('0x1c')](_0x12de59)[_0x6a0d('0x2d')](_0x47e2fb);};}exports['index']=function(_0x4bb80a,_0x6a3f88){var _0x248a80={},_0x4c6eab={},_0x1a980e={'count':0x0,'rows':[]};var _0x5de9d7=_[_0x6a0d('0x2e')](db[_0x6a0d('0x2f')][_0x6a0d('0x30')],function(_0x2e4bdf){return{'name':_0x2e4bdf[_0x6a0d('0x31')],'type':_0x2e4bdf[_0x6a0d('0x32')][_0x6a0d('0x33')]};});_0x4c6eab[_0x6a0d('0x34')]=_[_0x6a0d('0x2e')](_0x5de9d7,'name');_0x4c6eab['query']=_[_0x6a0d('0x35')](_0x4bb80a[_0x6a0d('0x36')]);_0x4c6eab[_0x6a0d('0x37')]=_[_0x6a0d('0x38')](_0x4c6eab['model'],_0x4c6eab[_0x6a0d('0x36')]);_0x248a80['attributes']=_[_0x6a0d('0x38')](_0x4c6eab[_0x6a0d('0x34')],qs[_0x6a0d('0x39')](_0x4bb80a[_0x6a0d('0x36')]['fields']));_0x248a80[_0x6a0d('0x3a')]=_0x248a80[_0x6a0d('0x3a')]['length']?_0x248a80[_0x6a0d('0x3a')]:_0x4c6eab['model'];if(!_0x4bb80a['query'][_0x6a0d('0x3b')](_0x6a0d('0x3c'))){_0x248a80['limit']=qs[_0x6a0d('0x20')](_0x4bb80a[_0x6a0d('0x36')][_0x6a0d('0x20')]);_0x248a80[_0x6a0d('0x1e')]=qs[_0x6a0d('0x1e')](_0x4bb80a['query'][_0x6a0d('0x1e')]);}_0x248a80[_0x6a0d('0x3d')]=qs[_0x6a0d('0x3e')](_0x4bb80a['query']['sort']);_0x248a80[_0x6a0d('0x3f')]=qs[_0x6a0d('0x37')](_[_0x6a0d('0x40')](_0x4bb80a[_0x6a0d('0x36')],_0x4c6eab[_0x6a0d('0x37')]),_0x5de9d7);if(_0x4bb80a[_0x6a0d('0x36')][_0x6a0d('0x41')]){_0x248a80[_0x6a0d('0x3f')]=_[_0x6a0d('0x42')](_0x248a80[_0x6a0d('0x3f')],{'$or':_[_0x6a0d('0x2e')](_0x5de9d7,function(_0x41faf6){if(_0x41faf6['type']!==_0x6a0d('0x43')){var _0xbc3654={};_0xbc3654[_0x41faf6[_0x6a0d('0x2c')]]={'$like':'%'+_0x4bb80a[_0x6a0d('0x36')][_0x6a0d('0x41')]+'%'};return _0xbc3654;}})});}_0x248a80=_[_0x6a0d('0x42')]({},_0x248a80,_0x4bb80a[_0x6a0d('0x44')]);var _0x38f1c7={'where':_0x248a80['where']};return db['ZendeskConfiguration'][_0x6a0d('0x21')](_0x38f1c7)['then'](function(_0x1606b0){_0x1a980e[_0x6a0d('0x21')]=_0x1606b0;if(_0x4bb80a['query']['includeAll']){_0x248a80[_0x6a0d('0x45')]=[{'all':!![]}];}return db[_0x6a0d('0x2f')][_0x6a0d('0x46')](_0x248a80);})[_0x6a0d('0x29')](function(_0x54ebe5){_0x1a980e[_0x6a0d('0x47')]=_0x54ebe5;return _0x1a980e;})['then'](respondWithFilteredResult(_0x6a3f88,_0x248a80))['catch'](handleError(_0x6a3f88,null));};exports[_0x6a0d('0x48')]=function(_0x3a117d,_0xa726a){var _0x9d1732={'raw':![],'where':{'id':_0x3a117d[_0x6a0d('0x49')]['id']}},_0x4c2d67={};_0x4c2d67[_0x6a0d('0x34')]=_[_0x6a0d('0x35')](db['ZendeskConfiguration'][_0x6a0d('0x30')]);_0x4c2d67[_0x6a0d('0x36')]=_[_0x6a0d('0x35')](_0x3a117d[_0x6a0d('0x36')]);_0x4c2d67['filters']=_[_0x6a0d('0x38')](_0x4c2d67[_0x6a0d('0x34')],_0x4c2d67[_0x6a0d('0x36')]);_0x9d1732[_0x6a0d('0x3a')]=_['intersection'](_0x4c2d67[_0x6a0d('0x34')],qs[_0x6a0d('0x39')](_0x3a117d[_0x6a0d('0x36')]['fields']));_0x9d1732[_0x6a0d('0x3a')]=_0x9d1732[_0x6a0d('0x3a')][_0x6a0d('0x4a')]?_0x9d1732[_0x6a0d('0x3a')]:_0x4c2d67[_0x6a0d('0x34')];if(_0x3a117d[_0x6a0d('0x36')][_0x6a0d('0x4b')]){_0x9d1732[_0x6a0d('0x45')]=[{'all':!![]}];}_0x9d1732=_['merge']({},_0x9d1732,_0x3a117d[_0x6a0d('0x44')]);return db[_0x6a0d('0x2f')][_0x6a0d('0x4c')](_0x9d1732)['then'](handleEntityNotFound(_0xa726a,null))[_0x6a0d('0x29')](respondWithResult(_0xa726a,null))[_0x6a0d('0x4d')](handleError(_0xa726a,null));};exports[_0x6a0d('0x4e')]=function(_0x404e4b,_0x95bfaf){return db['ZendeskConfiguration']['create'](_0x404e4b[_0x6a0d('0x4f')],{})[_0x6a0d('0x29')](respondWithResult(_0x95bfaf,0xc9))['catch'](handleError(_0x95bfaf,null));};exports[_0x6a0d('0x27')]=function(_0x4c8ff8,_0xed1cc7){if(_0x4c8ff8[_0x6a0d('0x4f')]['id']){delete _0x4c8ff8['body']['id'];}return db[_0x6a0d('0x2f')][_0x6a0d('0x4c')]({'where':{'id':_0x4c8ff8[_0x6a0d('0x49')]['id']}})[_0x6a0d('0x29')](handleEntityNotFound(_0xed1cc7,null))['then'](saveUpdates(_0x4c8ff8[_0x6a0d('0x4f')],null))[_0x6a0d('0x29')](respondWithResult(_0xed1cc7,null))[_0x6a0d('0x4d')](handleError(_0xed1cc7,null));};exports[_0x6a0d('0x28')]=function(_0x559867,_0x16c710){return db[_0x6a0d('0x2f')]['find']({'where':{'id':_0x559867[_0x6a0d('0x49')]['id']}})['then'](handleEntityNotFound(_0x16c710,null))['then'](removeEntity(_0x16c710,null))[_0x6a0d('0x4d')](handleError(_0x16c710,null));};exports['getFields']=function(_0x2ef25c,_0x47d96b,_0x5e4e57){var _0x56d2d4={};var _0x3eb35b={};var _0x2519a1;var _0x1cdc87;return db[_0x6a0d('0x2f')][_0x6a0d('0x50')]({'where':{'id':_0x2ef25c[_0x6a0d('0x49')]['id']}})[_0x6a0d('0x29')](handleEntityNotFound(_0x47d96b,null))[_0x6a0d('0x29')](function(_0x47d9e3){if(_0x47d9e3){_0x2519a1=_0x47d9e3;_0x3eb35b[_0x6a0d('0x34')]=_['keys'](db['ZendeskField'][_0x6a0d('0x30')]);_0x3eb35b[_0x6a0d('0x36')]=_[_0x6a0d('0x35')](_0x2ef25c['query']);_0x3eb35b[_0x6a0d('0x37')]=_[_0x6a0d('0x38')](_0x3eb35b[_0x6a0d('0x34')],_0x3eb35b[_0x6a0d('0x36')]);_0x56d2d4[_0x6a0d('0x3a')]=_[_0x6a0d('0x38')](_0x3eb35b['model'],qs[_0x6a0d('0x39')](_0x2ef25c['query'][_0x6a0d('0x39')]));_0x56d2d4[_0x6a0d('0x3a')]=_0x56d2d4['attributes'][_0x6a0d('0x4a')]?_0x56d2d4[_0x6a0d('0x3a')]:_0x3eb35b['model'];_0x56d2d4['order']=qs['sort'](_0x2ef25c[_0x6a0d('0x36')][_0x6a0d('0x3e')]);_0x56d2d4[_0x6a0d('0x3f')]=qs[_0x6a0d('0x37')](_[_0x6a0d('0x40')](_0x2ef25c[_0x6a0d('0x36')],_0x3eb35b[_0x6a0d('0x37')]));if(_0x2ef25c[_0x6a0d('0x36')][_0x6a0d('0x41')]){_0x56d2d4['where']=_[_0x6a0d('0x42')](_0x56d2d4[_0x6a0d('0x3f')],{'$or':_[_0x6a0d('0x2e')](_0x56d2d4[_0x6a0d('0x3a')],function(_0x4ebd32){var _0x72059={};_0x72059[_0x4ebd32]={'$like':'%'+_0x2ef25c[_0x6a0d('0x36')][_0x6a0d('0x41')]+'%'};return _0x72059;})});}_0x56d2d4=_[_0x6a0d('0x42')]({},_0x56d2d4,_0x2ef25c[_0x6a0d('0x44')]);return _0x2519a1[_0x6a0d('0x51')](_0x56d2d4);}})[_0x6a0d('0x29')](function(_0x49d0c4){if(_0x49d0c4){_0x1cdc87=_0x49d0c4[_0x6a0d('0x4a')];if(!_0x2ef25c[_0x6a0d('0x36')][_0x6a0d('0x3b')]('nolimit')){_0x56d2d4['limit']=qs['limit'](_0x2ef25c[_0x6a0d('0x36')][_0x6a0d('0x20')]);_0x56d2d4[_0x6a0d('0x1e')]=qs[_0x6a0d('0x1e')](_0x2ef25c['query'][_0x6a0d('0x1e')]);}return _0x2519a1[_0x6a0d('0x51')](_0x56d2d4);}})[_0x6a0d('0x29')](function(_0x3b2866){if(_0x3b2866){return _0x3b2866?{'count':_0x1cdc87,'rows':_0x3b2866}:null;}})[_0x6a0d('0x29')](respondWithResult(_0x47d96b,null))[_0x6a0d('0x4d')](handleError(_0x47d96b,null));};exports['getSubjects']=function(_0x45c51d,_0x294bd4,_0x34f1a2){var _0x5a973d={};var _0x339d8f={};var _0x270ca4;var _0x24f55e;return db[_0x6a0d('0x2f')][_0x6a0d('0x50')]({'where':{'id':_0x45c51d[_0x6a0d('0x49')]['id']}})[_0x6a0d('0x29')](handleEntityNotFound(_0x294bd4,null))[_0x6a0d('0x29')](function(_0x6a4228){if(_0x6a4228){_0x270ca4=_0x6a4228;_0x339d8f[_0x6a0d('0x34')]=_[_0x6a0d('0x35')](db[_0x6a0d('0x52')][_0x6a0d('0x30')]);_0x339d8f[_0x6a0d('0x36')]=_[_0x6a0d('0x35')](_0x45c51d['query']);_0x339d8f[_0x6a0d('0x37')]=_['intersection'](_0x339d8f[_0x6a0d('0x34')],_0x339d8f[_0x6a0d('0x36')]);_0x5a973d[_0x6a0d('0x3a')]=_[_0x6a0d('0x38')](_0x339d8f[_0x6a0d('0x34')],qs[_0x6a0d('0x39')](_0x45c51d[_0x6a0d('0x36')][_0x6a0d('0x39')]));_0x5a973d[_0x6a0d('0x3a')]=_0x5a973d['attributes'][_0x6a0d('0x4a')]?_0x5a973d[_0x6a0d('0x3a')]:_0x339d8f[_0x6a0d('0x34')];_0x5a973d[_0x6a0d('0x3d')]=qs[_0x6a0d('0x3e')](_0x45c51d[_0x6a0d('0x36')][_0x6a0d('0x3e')]);_0x5a973d[_0x6a0d('0x3f')]=qs[_0x6a0d('0x37')](_['pick'](_0x45c51d[_0x6a0d('0x36')],_0x339d8f['filters']));if(_0x45c51d[_0x6a0d('0x36')]['filter']){_0x5a973d[_0x6a0d('0x3f')]=_[_0x6a0d('0x42')](_0x5a973d[_0x6a0d('0x3f')],{'$or':_[_0x6a0d('0x2e')](_0x5a973d[_0x6a0d('0x3a')],function(_0x3b424a){var _0x206d61={};_0x206d61[_0x3b424a]={'$like':'%'+_0x45c51d[_0x6a0d('0x36')][_0x6a0d('0x41')]+'%'};return _0x206d61;})});}_0x5a973d=_[_0x6a0d('0x42')]({},_0x5a973d,_0x45c51d[_0x6a0d('0x44')]);return _0x270ca4[_0x6a0d('0x53')](_0x5a973d);}})[_0x6a0d('0x29')](function(_0x5e7672){if(_0x5e7672){_0x24f55e=_0x5e7672[_0x6a0d('0x4a')];if(!_0x45c51d['query']['hasOwnProperty'](_0x6a0d('0x3c'))){_0x5a973d[_0x6a0d('0x20')]=qs[_0x6a0d('0x20')](_0x45c51d[_0x6a0d('0x36')][_0x6a0d('0x20')]);_0x5a973d[_0x6a0d('0x1e')]=qs[_0x6a0d('0x1e')](_0x45c51d['query'][_0x6a0d('0x1e')]);}return _0x270ca4['getSubjects'](_0x5a973d);}})[_0x6a0d('0x29')](function(_0x22fdd2){if(_0x22fdd2){return _0x22fdd2?{'count':_0x24f55e,'rows':_0x22fdd2}:null;}})['then'](respondWithResult(_0x294bd4,null))[_0x6a0d('0x4d')](handleError(_0x294bd4,null));};exports[_0x6a0d('0x54')]=function(_0x2fff95,_0x39ffbf,_0x2a6e01){var _0x5e207a={};var _0x327caa={};var _0x11aaaf;var _0x35b6df;return db[_0x6a0d('0x2f')]['findOne']({'where':{'id':_0x2fff95[_0x6a0d('0x49')]['id']}})[_0x6a0d('0x29')](handleEntityNotFound(_0x39ffbf,null))[_0x6a0d('0x29')](function(_0x2e434f){if(_0x2e434f){_0x11aaaf=_0x2e434f;_0x327caa['model']=_[_0x6a0d('0x35')](db[_0x6a0d('0x52')][_0x6a0d('0x30')]);_0x327caa[_0x6a0d('0x36')]=_['keys'](_0x2fff95[_0x6a0d('0x36')]);_0x327caa[_0x6a0d('0x37')]=_[_0x6a0d('0x38')](_0x327caa['model'],_0x327caa[_0x6a0d('0x36')]);_0x5e207a['attributes']=_['intersection'](_0x327caa['model'],qs[_0x6a0d('0x39')](_0x2fff95[_0x6a0d('0x36')][_0x6a0d('0x39')]));_0x5e207a[_0x6a0d('0x3a')]=_0x5e207a['attributes'][_0x6a0d('0x4a')]?_0x5e207a[_0x6a0d('0x3a')]:_0x327caa[_0x6a0d('0x34')];_0x5e207a[_0x6a0d('0x3d')]=qs['sort'](_0x2fff95[_0x6a0d('0x36')]['sort']);_0x5e207a[_0x6a0d('0x3f')]=qs[_0x6a0d('0x37')](_[_0x6a0d('0x40')](_0x2fff95['query'],_0x327caa[_0x6a0d('0x37')]));if(_0x2fff95['query'][_0x6a0d('0x41')]){_0x5e207a['where']=_[_0x6a0d('0x42')](_0x5e207a[_0x6a0d('0x3f')],{'$or':_['map'](_0x5e207a[_0x6a0d('0x3a')],function(_0x53ecb3){var _0x48040c={};_0x48040c[_0x53ecb3]={'$like':'%'+_0x2fff95[_0x6a0d('0x36')][_0x6a0d('0x41')]+'%'};return _0x48040c;})});}_0x5e207a=_[_0x6a0d('0x42')]({},_0x5e207a,_0x2fff95[_0x6a0d('0x44')]);return _0x11aaaf[_0x6a0d('0x54')](_0x5e207a);}})[_0x6a0d('0x29')](function(_0xb8a3fe){if(_0xb8a3fe){_0x35b6df=_0xb8a3fe[_0x6a0d('0x4a')];if(!_0x2fff95[_0x6a0d('0x36')][_0x6a0d('0x3b')]('nolimit')){_0x5e207a['limit']=qs[_0x6a0d('0x20')](_0x2fff95[_0x6a0d('0x36')][_0x6a0d('0x20')]);_0x5e207a[_0x6a0d('0x1e')]=qs['offset'](_0x2fff95['query'][_0x6a0d('0x1e')]);}return _0x11aaaf[_0x6a0d('0x54')](_0x5e207a);}})[_0x6a0d('0x29')](function(_0x5151f6){if(_0x5151f6){return _0x5151f6?{'count':_0x35b6df,'rows':_0x5151f6}:null;}})[_0x6a0d('0x29')](respondWithResult(_0x39ffbf,null))[_0x6a0d('0x4d')](handleError(_0x39ffbf,null));};exports['getTags']=function(_0x567f4c,_0x5746cf,_0x106259){var _0x5591b7={};var _0x198637={};var _0x358711;var _0x3bc670;return db[_0x6a0d('0x2f')][_0x6a0d('0x50')]({'where':{'id':_0x567f4c['params']['id']}})[_0x6a0d('0x29')](handleEntityNotFound(_0x5746cf,null))[_0x6a0d('0x29')](function(_0x3bdd38){if(_0x3bdd38){_0x358711=_0x3bdd38;_0x198637['model']=_[_0x6a0d('0x35')](db['Tag'][_0x6a0d('0x30')]);_0x198637[_0x6a0d('0x36')]=_[_0x6a0d('0x35')](_0x567f4c[_0x6a0d('0x36')]);_0x198637[_0x6a0d('0x37')]=_[_0x6a0d('0x38')](_0x198637[_0x6a0d('0x34')],_0x198637[_0x6a0d('0x36')]);_0x5591b7['attributes']=_[_0x6a0d('0x38')](_0x198637[_0x6a0d('0x34')],qs[_0x6a0d('0x39')](_0x567f4c[_0x6a0d('0x36')]['fields']));_0x5591b7[_0x6a0d('0x3a')]=_0x5591b7[_0x6a0d('0x3a')][_0x6a0d('0x4a')]?_0x5591b7[_0x6a0d('0x3a')]:_0x198637[_0x6a0d('0x34')];_0x5591b7[_0x6a0d('0x3d')]=qs[_0x6a0d('0x3e')](_0x567f4c[_0x6a0d('0x36')][_0x6a0d('0x3e')]);_0x5591b7[_0x6a0d('0x3f')]=qs['filters'](_[_0x6a0d('0x40')](_0x567f4c['query'],_0x198637[_0x6a0d('0x37')]));if(_0x567f4c[_0x6a0d('0x36')][_0x6a0d('0x41')]){_0x5591b7[_0x6a0d('0x3f')]=_['merge'](_0x5591b7[_0x6a0d('0x3f')],{'$or':_[_0x6a0d('0x2e')](_0x5591b7[_0x6a0d('0x3a')],function(_0x154a68){var _0x283c18={};_0x283c18[_0x154a68]={'$like':'%'+_0x567f4c[_0x6a0d('0x36')][_0x6a0d('0x41')]+'%'};return _0x283c18;})});}_0x5591b7=_[_0x6a0d('0x42')]({},_0x5591b7,_0x567f4c[_0x6a0d('0x44')]);return _0x358711[_0x6a0d('0x55')](_0x5591b7);}})[_0x6a0d('0x29')](function(_0x4a3e4a){if(_0x4a3e4a){_0x3bc670=_0x4a3e4a['length'];if(!_0x567f4c[_0x6a0d('0x36')][_0x6a0d('0x3b')]('nolimit')){_0x5591b7[_0x6a0d('0x20')]=qs[_0x6a0d('0x20')](_0x567f4c[_0x6a0d('0x36')][_0x6a0d('0x20')]);_0x5591b7[_0x6a0d('0x1e')]=qs[_0x6a0d('0x1e')](_0x567f4c['query'][_0x6a0d('0x1e')]);}return _0x358711[_0x6a0d('0x55')](_0x5591b7);}})[_0x6a0d('0x29')](function(_0x1f45c9){if(_0x1f45c9){return _0x1f45c9?{'count':_0x3bc670,'rows':_0x1f45c9}:null;}})[_0x6a0d('0x29')](respondWithResult(_0x5746cf,null))[_0x6a0d('0x4d')](handleError(_0x5746cf,null));};exports[_0x6a0d('0x56')]=function(_0x202c33,_0x37d0c9,_0x17cf16){if(_0x202c33[_0x6a0d('0x4f')]['id']){delete _0x202c33[_0x6a0d('0x4f')]['id'];}return db[_0x6a0d('0x2f')][_0x6a0d('0x50')]({'where':{'id':_0x202c33[_0x6a0d('0x49')]['id']}})[_0x6a0d('0x29')](handleEntityNotFound(_0x37d0c9,null))[_0x6a0d('0x29')](function(_0x100067){if(_0x100067){return _0x100067[_0x6a0d('0x56')](_0x202c33[_0x6a0d('0x4f')][_0x6a0d('0x57')]||[]);}return null;})['then'](respondWithResult(_0x37d0c9,null))[_0x6a0d('0x4d')](handleError(_0x37d0c9,null));}; \ No newline at end of file +var _0x2809=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','index','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','fields','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','intersection','create','body','find','params','getFields','ZendeskField','hasOwnProperty','nolimit','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','desk.js','papaparse','ioredis','../../components/auth/service'];(function(_0x1287b4,_0x1a0e36){var _0x3e56d6=function(_0x5085ac){while(--_0x5085ac){_0x1287b4['push'](_0x1287b4['shift']());}};_0x3e56d6(++_0x1a0e36);}(_0x2809,0x1e8));var _0x9280=function(_0x51ea1b,_0x1c5a3b){_0x51ea1b=_0x51ea1b-0x0;var _0x56d914=_0x2809[_0x51ea1b];return _0x56d914;};'use strict';var emlformat=require(_0x9280('0x0'));var rimraf=require(_0x9280('0x1'));var zipdir=require(_0x9280('0x2'));var jsonpatch=require(_0x9280('0x3'));var rp=require('request-promise');var moment=require(_0x9280('0x4'));var BPromise=require(_0x9280('0x5'));var Mustache=require(_0x9280('0x6'));var util=require(_0x9280('0x7'));var path=require('path');var sox=require(_0x9280('0x8'));var csv=require(_0x9280('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9280('0xa'));var _=require('lodash');var squel=require(_0x9280('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9280('0xc'));var toCsv=require(_0x9280('0x9'));var querystring=require('querystring');var Papa=require(_0x9280('0xd'));var Redis=require(_0x9280('0xe'));var authService=require(_0x9280('0xf'));var qs=require(_0x9280('0x10'));var as=require(_0x9280('0x11'));var hardwareService=require(_0x9280('0x12'));var logger=require(_0x9280('0x13'))(_0x9280('0x14'));var utils=require('../../config/utils');var config=require(_0x9280('0x15'));var licenseUtil=require(_0x9280('0x16'));var db=require(_0x9280('0x17'))['db'];function respondWithStatusCode(_0x548038,_0x2c35b0){_0x2c35b0=_0x2c35b0||0xcc;return function(_0x4e326a){if(_0x4e326a){return _0x548038[_0x9280('0x18')](_0x2c35b0);}return _0x548038[_0x9280('0x19')](_0x2c35b0)[_0x9280('0x1a')]();};}function respondWithResult(_0x313ac3,_0x5a6370){_0x5a6370=_0x5a6370||0xc8;return function(_0x1484af){if(_0x1484af){return _0x313ac3[_0x9280('0x19')](_0x5a6370)[_0x9280('0x1b')](_0x1484af);}};}function respondWithFilteredResult(_0x12fd2d,_0x1878c5){return function(_0x28e6ae){if(_0x28e6ae){var _0x1f7bd1=typeof _0x1878c5[_0x9280('0x1c')]===_0x9280('0x1d')&&typeof _0x1878c5[_0x9280('0x1e')]===_0x9280('0x1d');var _0x4a5fbb=_0x28e6ae[_0x9280('0x1f')];var _0x51dfd3=_0x1f7bd1?0x0:_0x1878c5['offset'];var _0x528682=_0x1f7bd1?_0x28e6ae[_0x9280('0x1f')]:_0x1878c5[_0x9280('0x1c')]+_0x1878c5[_0x9280('0x1e')];var _0x3f0e7e;if(_0x528682>=_0x4a5fbb){_0x528682=_0x4a5fbb;_0x3f0e7e=0xc8;}else{_0x3f0e7e=0xce;}_0x12fd2d[_0x9280('0x19')](_0x3f0e7e);return _0x12fd2d[_0x9280('0x20')](_0x9280('0x21'),_0x51dfd3+'-'+_0x528682+'/'+_0x4a5fbb)['json'](_0x28e6ae);}return null;};}function patchUpdates(_0x3760b8){return function(_0x4413a2){try{jsonpatch[_0x9280('0x22')](_0x4413a2,_0x3760b8,!![]);}catch(_0x5b50f2){return BPromise[_0x9280('0x23')](_0x5b50f2);}return _0x4413a2[_0x9280('0x24')]();};}function saveUpdates(_0x1416f0,_0x160517){return function(_0x10a3f5){if(_0x10a3f5){return _0x10a3f5[_0x9280('0x25')](_0x1416f0)['then'](function(_0x2ec476){return _0x2ec476;});}return null;};}function removeEntity(_0x3b92e1,_0x305cd4){return function(_0x17cbf4){if(_0x17cbf4){return _0x17cbf4[_0x9280('0x26')]()[_0x9280('0x27')](function(){_0x3b92e1[_0x9280('0x19')](0xcc)[_0x9280('0x1a')]();});}};}function handleEntityNotFound(_0xa68cb0,_0x41b459){return function(_0x40dc37){if(!_0x40dc37){_0xa68cb0['sendStatus'](0x194);}return _0x40dc37;};}function handleError(_0x3da480,_0x1e3a12){_0x1e3a12=_0x1e3a12||0x1f4;return function(_0x1e82c9){logger[_0x9280('0x28')](_0x1e82c9['stack']);if(_0x1e82c9[_0x9280('0x29')]){delete _0x1e82c9[_0x9280('0x29')];}_0x3da480['status'](_0x1e3a12)[_0x9280('0x2a')](_0x1e82c9);};}exports[_0x9280('0x2b')]=function(_0x3df891,_0x36c6e1){var _0x3abbb4={},_0x15e488={},_0x3d1b60={'count':0x0,'rows':[]};var _0x349537=_['map'](db[_0x9280('0x2c')][_0x9280('0x2d')],function(_0x428f0b){return{'name':_0x428f0b[_0x9280('0x2e')],'type':_0x428f0b[_0x9280('0x2f')][_0x9280('0x30')]};});_0x15e488[_0x9280('0x31')]=_[_0x9280('0x32')](_0x349537,_0x9280('0x29'));_0x15e488[_0x9280('0x33')]=_[_0x9280('0x34')](_0x3df891['query']);_0x15e488[_0x9280('0x35')]=_['intersection'](_0x15e488[_0x9280('0x31')],_0x15e488['query']);_0x3abbb4['attributes']=_['intersection'](_0x15e488[_0x9280('0x31')],qs['fields'](_0x3df891[_0x9280('0x33')][_0x9280('0x36')]));_0x3abbb4[_0x9280('0x37')]=_0x3abbb4['attributes'][_0x9280('0x38')]?_0x3abbb4[_0x9280('0x37')]:_0x15e488[_0x9280('0x31')];if(!_0x3df891[_0x9280('0x33')]['hasOwnProperty']('nolimit')){_0x3abbb4['limit']=qs[_0x9280('0x1e')](_0x3df891[_0x9280('0x33')][_0x9280('0x1e')]);_0x3abbb4[_0x9280('0x1c')]=qs[_0x9280('0x1c')](_0x3df891[_0x9280('0x33')][_0x9280('0x1c')]);}_0x3abbb4[_0x9280('0x39')]=qs[_0x9280('0x3a')](_0x3df891[_0x9280('0x33')][_0x9280('0x3a')]);_0x3abbb4[_0x9280('0x3b')]=qs[_0x9280('0x35')](_[_0x9280('0x3c')](_0x3df891[_0x9280('0x33')],_0x15e488[_0x9280('0x35')]),_0x349537);if(_0x3df891['query'][_0x9280('0x3d')]){_0x3abbb4[_0x9280('0x3b')]=_[_0x9280('0x3e')](_0x3abbb4[_0x9280('0x3b')],{'$or':_[_0x9280('0x32')](_0x349537,function(_0x4b018f){if(_0x4b018f[_0x9280('0x2f')]!==_0x9280('0x3f')){var _0x400809={};_0x400809[_0x4b018f[_0x9280('0x29')]]={'$like':'%'+_0x3df891[_0x9280('0x33')][_0x9280('0x3d')]+'%'};return _0x400809;}})});}_0x3abbb4=_[_0x9280('0x3e')]({},_0x3abbb4,_0x3df891[_0x9280('0x40')]);var _0x347db2={'where':_0x3abbb4[_0x9280('0x3b')]};return db[_0x9280('0x2c')][_0x9280('0x1f')](_0x347db2)[_0x9280('0x27')](function(_0x59df91){_0x3d1b60[_0x9280('0x1f')]=_0x59df91;if(_0x3df891['query'][_0x9280('0x41')]){_0x3abbb4[_0x9280('0x42')]=[{'all':!![]}];}return db[_0x9280('0x2c')]['findAll'](_0x3abbb4);})['then'](function(_0x205d51){_0x3d1b60[_0x9280('0x43')]=_0x205d51;return _0x3d1b60;})[_0x9280('0x27')](respondWithFilteredResult(_0x36c6e1,_0x3abbb4))[_0x9280('0x44')](handleError(_0x36c6e1,null));};exports['show']=function(_0x17a7a5,_0x153e8e){var _0x205e2c={'raw':![],'where':{'id':_0x17a7a5['params']['id']}},_0x592ac3={};_0x592ac3[_0x9280('0x31')]=_[_0x9280('0x34')](db['ZendeskConfiguration'][_0x9280('0x2d')]);_0x592ac3['query']=_[_0x9280('0x34')](_0x17a7a5[_0x9280('0x33')]);_0x592ac3[_0x9280('0x35')]=_[_0x9280('0x45')](_0x592ac3[_0x9280('0x31')],_0x592ac3[_0x9280('0x33')]);_0x205e2c['attributes']=_['intersection'](_0x592ac3[_0x9280('0x31')],qs[_0x9280('0x36')](_0x17a7a5[_0x9280('0x33')]['fields']));_0x205e2c[_0x9280('0x37')]=_0x205e2c[_0x9280('0x37')]['length']?_0x205e2c[_0x9280('0x37')]:_0x592ac3['model'];if(_0x17a7a5[_0x9280('0x33')][_0x9280('0x41')]){_0x205e2c['include']=[{'all':!![]}];}_0x205e2c=_[_0x9280('0x3e')]({},_0x205e2c,_0x17a7a5[_0x9280('0x40')]);return db[_0x9280('0x2c')]['find'](_0x205e2c)[_0x9280('0x27')](handleEntityNotFound(_0x153e8e,null))[_0x9280('0x27')](respondWithResult(_0x153e8e,null))[_0x9280('0x44')](handleError(_0x153e8e,null));};exports['create']=function(_0x52f909,_0x13bbbb){return db['ZendeskConfiguration'][_0x9280('0x46')](_0x52f909[_0x9280('0x47')],{})[_0x9280('0x27')](respondWithResult(_0x13bbbb,0xc9))[_0x9280('0x44')](handleError(_0x13bbbb,null));};exports[_0x9280('0x25')]=function(_0x557d90,_0x1216ed){if(_0x557d90['body']['id']){delete _0x557d90[_0x9280('0x47')]['id'];}return db[_0x9280('0x2c')]['find']({'where':{'id':_0x557d90['params']['id']}})['then'](handleEntityNotFound(_0x1216ed,null))[_0x9280('0x27')](saveUpdates(_0x557d90['body'],null))[_0x9280('0x27')](respondWithResult(_0x1216ed,null))[_0x9280('0x44')](handleError(_0x1216ed,null));};exports[_0x9280('0x26')]=function(_0x51e25f,_0x141771){return db[_0x9280('0x2c')][_0x9280('0x48')]({'where':{'id':_0x51e25f[_0x9280('0x49')]['id']}})[_0x9280('0x27')](handleEntityNotFound(_0x141771,null))[_0x9280('0x27')](removeEntity(_0x141771,null))['catch'](handleError(_0x141771,null));};exports[_0x9280('0x4a')]=function(_0x5e641a,_0x28d7be,_0x85d701){var _0x58e132={};var _0x441cc9={};var _0x2e656f;var _0x4bd739;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x5e641a['params']['id']}})[_0x9280('0x27')](handleEntityNotFound(_0x28d7be,null))[_0x9280('0x27')](function(_0x49a9a3){if(_0x49a9a3){_0x2e656f=_0x49a9a3;_0x441cc9[_0x9280('0x31')]=_['keys'](db[_0x9280('0x4b')][_0x9280('0x2d')]);_0x441cc9[_0x9280('0x33')]=_[_0x9280('0x34')](_0x5e641a[_0x9280('0x33')]);_0x441cc9[_0x9280('0x35')]=_[_0x9280('0x45')](_0x441cc9[_0x9280('0x31')],_0x441cc9[_0x9280('0x33')]);_0x58e132['attributes']=_['intersection'](_0x441cc9[_0x9280('0x31')],qs[_0x9280('0x36')](_0x5e641a[_0x9280('0x33')][_0x9280('0x36')]));_0x58e132[_0x9280('0x37')]=_0x58e132[_0x9280('0x37')][_0x9280('0x38')]?_0x58e132[_0x9280('0x37')]:_0x441cc9[_0x9280('0x31')];_0x58e132[_0x9280('0x39')]=qs[_0x9280('0x3a')](_0x5e641a['query'][_0x9280('0x3a')]);_0x58e132[_0x9280('0x3b')]=qs[_0x9280('0x35')](_[_0x9280('0x3c')](_0x5e641a[_0x9280('0x33')],_0x441cc9[_0x9280('0x35')]));if(_0x5e641a['query'][_0x9280('0x3d')]){_0x58e132['where']=_[_0x9280('0x3e')](_0x58e132[_0x9280('0x3b')],{'$or':_[_0x9280('0x32')](_0x58e132[_0x9280('0x37')],function(_0x3a7202){var _0x1957a6={};_0x1957a6[_0x3a7202]={'$like':'%'+_0x5e641a[_0x9280('0x33')]['filter']+'%'};return _0x1957a6;})});}_0x58e132=_[_0x9280('0x3e')]({},_0x58e132,_0x5e641a[_0x9280('0x40')]);return _0x2e656f[_0x9280('0x4a')](_0x58e132);}})[_0x9280('0x27')](function(_0x55c7d4){if(_0x55c7d4){_0x4bd739=_0x55c7d4[_0x9280('0x38')];if(!_0x5e641a[_0x9280('0x33')][_0x9280('0x4c')](_0x9280('0x4d'))){_0x58e132[_0x9280('0x1e')]=qs[_0x9280('0x1e')](_0x5e641a['query'][_0x9280('0x1e')]);_0x58e132[_0x9280('0x1c')]=qs['offset'](_0x5e641a[_0x9280('0x33')][_0x9280('0x1c')]);}return _0x2e656f[_0x9280('0x4a')](_0x58e132);}})[_0x9280('0x27')](function(_0x23f90d){if(_0x23f90d){return _0x23f90d?{'count':_0x4bd739,'rows':_0x23f90d}:null;}})[_0x9280('0x27')](respondWithResult(_0x28d7be,null))['catch'](handleError(_0x28d7be,null));};exports[_0x9280('0x4e')]=function(_0x3db98c,_0x43c154,_0x537343){var _0x5b0f92={};var _0xe90a7={};var _0x4337c5;var _0x4e05ef;return db[_0x9280('0x2c')][_0x9280('0x4f')]({'where':{'id':_0x3db98c['params']['id']}})[_0x9280('0x27')](handleEntityNotFound(_0x43c154,null))[_0x9280('0x27')](function(_0x1e4ce5){if(_0x1e4ce5){_0x4337c5=_0x1e4ce5;_0xe90a7['model']=_[_0x9280('0x34')](db[_0x9280('0x4b')][_0x9280('0x2d')]);_0xe90a7[_0x9280('0x33')]=_[_0x9280('0x34')](_0x3db98c[_0x9280('0x33')]);_0xe90a7[_0x9280('0x35')]=_[_0x9280('0x45')](_0xe90a7[_0x9280('0x31')],_0xe90a7[_0x9280('0x33')]);_0x5b0f92[_0x9280('0x37')]=_[_0x9280('0x45')](_0xe90a7[_0x9280('0x31')],qs[_0x9280('0x36')](_0x3db98c[_0x9280('0x33')][_0x9280('0x36')]));_0x5b0f92[_0x9280('0x37')]=_0x5b0f92[_0x9280('0x37')][_0x9280('0x38')]?_0x5b0f92['attributes']:_0xe90a7['model'];_0x5b0f92['order']=qs[_0x9280('0x3a')](_0x3db98c['query'][_0x9280('0x3a')]);_0x5b0f92[_0x9280('0x3b')]=qs[_0x9280('0x35')](_[_0x9280('0x3c')](_0x3db98c[_0x9280('0x33')],_0xe90a7['filters']));if(_0x3db98c[_0x9280('0x33')][_0x9280('0x3d')]){_0x5b0f92[_0x9280('0x3b')]=_['merge'](_0x5b0f92[_0x9280('0x3b')],{'$or':_['map'](_0x5b0f92[_0x9280('0x37')],function(_0x576b28){var _0x5a44c4={};_0x5a44c4[_0x576b28]={'$like':'%'+_0x3db98c[_0x9280('0x33')][_0x9280('0x3d')]+'%'};return _0x5a44c4;})});}_0x5b0f92=_[_0x9280('0x3e')]({},_0x5b0f92,_0x3db98c[_0x9280('0x40')]);return _0x4337c5[_0x9280('0x4e')](_0x5b0f92);}})[_0x9280('0x27')](function(_0x12a289){if(_0x12a289){_0x4e05ef=_0x12a289[_0x9280('0x38')];if(!_0x3db98c[_0x9280('0x33')][_0x9280('0x4c')](_0x9280('0x4d'))){_0x5b0f92[_0x9280('0x1e')]=qs[_0x9280('0x1e')](_0x3db98c['query'][_0x9280('0x1e')]);_0x5b0f92['offset']=qs[_0x9280('0x1c')](_0x3db98c[_0x9280('0x33')][_0x9280('0x1c')]);}return _0x4337c5[_0x9280('0x4e')](_0x5b0f92);}})[_0x9280('0x27')](function(_0x175512){if(_0x175512){return _0x175512?{'count':_0x4e05ef,'rows':_0x175512}:null;}})[_0x9280('0x27')](respondWithResult(_0x43c154,null))[_0x9280('0x44')](handleError(_0x43c154,null));};exports[_0x9280('0x50')]=function(_0x121b30,_0x2efbd1,_0x26d272){var _0x13fd55={};var _0x4805dc={};var _0x4169b7;var _0x47d650;return db['ZendeskConfiguration'][_0x9280('0x4f')]({'where':{'id':_0x121b30[_0x9280('0x49')]['id']}})[_0x9280('0x27')](handleEntityNotFound(_0x2efbd1,null))[_0x9280('0x27')](function(_0x49d5b0){if(_0x49d5b0){_0x4169b7=_0x49d5b0;_0x4805dc[_0x9280('0x31')]=_[_0x9280('0x34')](db[_0x9280('0x4b')][_0x9280('0x2d')]);_0x4805dc[_0x9280('0x33')]=_[_0x9280('0x34')](_0x121b30[_0x9280('0x33')]);_0x4805dc[_0x9280('0x35')]=_[_0x9280('0x45')](_0x4805dc[_0x9280('0x31')],_0x4805dc[_0x9280('0x33')]);_0x13fd55[_0x9280('0x37')]=_[_0x9280('0x45')](_0x4805dc[_0x9280('0x31')],qs[_0x9280('0x36')](_0x121b30[_0x9280('0x33')][_0x9280('0x36')]));_0x13fd55[_0x9280('0x37')]=_0x13fd55[_0x9280('0x37')][_0x9280('0x38')]?_0x13fd55[_0x9280('0x37')]:_0x4805dc[_0x9280('0x31')];_0x13fd55[_0x9280('0x39')]=qs[_0x9280('0x3a')](_0x121b30[_0x9280('0x33')][_0x9280('0x3a')]);_0x13fd55['where']=qs['filters'](_[_0x9280('0x3c')](_0x121b30[_0x9280('0x33')],_0x4805dc[_0x9280('0x35')]));if(_0x121b30['query'][_0x9280('0x3d')]){_0x13fd55[_0x9280('0x3b')]=_[_0x9280('0x3e')](_0x13fd55['where'],{'$or':_[_0x9280('0x32')](_0x13fd55['attributes'],function(_0x1c5da5){var _0x2f5ee8={};_0x2f5ee8[_0x1c5da5]={'$like':'%'+_0x121b30[_0x9280('0x33')][_0x9280('0x3d')]+'%'};return _0x2f5ee8;})});}_0x13fd55=_[_0x9280('0x3e')]({},_0x13fd55,_0x121b30[_0x9280('0x40')]);return _0x4169b7['getDescriptions'](_0x13fd55);}})[_0x9280('0x27')](function(_0xd6d163){if(_0xd6d163){_0x47d650=_0xd6d163[_0x9280('0x38')];if(!_0x121b30[_0x9280('0x33')][_0x9280('0x4c')](_0x9280('0x4d'))){_0x13fd55[_0x9280('0x1e')]=qs[_0x9280('0x1e')](_0x121b30[_0x9280('0x33')][_0x9280('0x1e')]);_0x13fd55['offset']=qs[_0x9280('0x1c')](_0x121b30[_0x9280('0x33')]['offset']);}return _0x4169b7[_0x9280('0x50')](_0x13fd55);}})[_0x9280('0x27')](function(_0x30044e){if(_0x30044e){return _0x30044e?{'count':_0x47d650,'rows':_0x30044e}:null;}})[_0x9280('0x27')](respondWithResult(_0x2efbd1,null))['catch'](handleError(_0x2efbd1,null));};exports[_0x9280('0x51')]=function(_0x55f9ed,_0x1c5aa3,_0x49e93b){var _0x1e7ad3={};var _0x412619={};var _0x200fd2;var _0x1d3875;return db['ZendeskConfiguration'][_0x9280('0x4f')]({'where':{'id':_0x55f9ed['params']['id']}})['then'](handleEntityNotFound(_0x1c5aa3,null))[_0x9280('0x27')](function(_0x1f5746){if(_0x1f5746){_0x200fd2=_0x1f5746;_0x412619[_0x9280('0x31')]=_['keys'](db[_0x9280('0x52')][_0x9280('0x2d')]);_0x412619['query']=_[_0x9280('0x34')](_0x55f9ed[_0x9280('0x33')]);_0x412619['filters']=_[_0x9280('0x45')](_0x412619[_0x9280('0x31')],_0x412619[_0x9280('0x33')]);_0x1e7ad3['attributes']=_[_0x9280('0x45')](_0x412619[_0x9280('0x31')],qs[_0x9280('0x36')](_0x55f9ed['query'][_0x9280('0x36')]));_0x1e7ad3['attributes']=_0x1e7ad3['attributes'][_0x9280('0x38')]?_0x1e7ad3[_0x9280('0x37')]:_0x412619[_0x9280('0x31')];_0x1e7ad3[_0x9280('0x39')]=qs[_0x9280('0x3a')](_0x55f9ed[_0x9280('0x33')][_0x9280('0x3a')]);_0x1e7ad3[_0x9280('0x3b')]=qs[_0x9280('0x35')](_[_0x9280('0x3c')](_0x55f9ed[_0x9280('0x33')],_0x412619[_0x9280('0x35')]));if(_0x55f9ed[_0x9280('0x33')][_0x9280('0x3d')]){_0x1e7ad3[_0x9280('0x3b')]=_[_0x9280('0x3e')](_0x1e7ad3[_0x9280('0x3b')],{'$or':_[_0x9280('0x32')](_0x1e7ad3[_0x9280('0x37')],function(_0x22eee9){var _0x15fe4a={};_0x15fe4a[_0x22eee9]={'$like':'%'+_0x55f9ed['query'][_0x9280('0x3d')]+'%'};return _0x15fe4a;})});}_0x1e7ad3=_[_0x9280('0x3e')]({},_0x1e7ad3,_0x55f9ed['options']);return _0x200fd2[_0x9280('0x51')](_0x1e7ad3);}})[_0x9280('0x27')](function(_0x2ad956){if(_0x2ad956){_0x1d3875=_0x2ad956['length'];if(!_0x55f9ed[_0x9280('0x33')]['hasOwnProperty']('nolimit')){_0x1e7ad3[_0x9280('0x1e')]=qs[_0x9280('0x1e')](_0x55f9ed[_0x9280('0x33')][_0x9280('0x1e')]);_0x1e7ad3['offset']=qs['offset'](_0x55f9ed[_0x9280('0x33')][_0x9280('0x1c')]);}return _0x200fd2['getTags'](_0x1e7ad3);}})[_0x9280('0x27')](function(_0x28a7b8){if(_0x28a7b8){return _0x28a7b8?{'count':_0x1d3875,'rows':_0x28a7b8}:null;}})[_0x9280('0x27')](respondWithResult(_0x1c5aa3,null))[_0x9280('0x44')](handleError(_0x1c5aa3,null));};exports[_0x9280('0x53')]=function(_0x428993,_0x3febb2,_0x33f533){if(_0x428993['body']['id']){delete _0x428993[_0x9280('0x47')]['id'];}return db[_0x9280('0x2c')][_0x9280('0x4f')]({'where':{'id':_0x428993[_0x9280('0x49')]['id']}})[_0x9280('0x27')](handleEntityNotFound(_0x3febb2,null))[_0x9280('0x27')](function(_0x1b2874){if(_0x1b2874){return _0x1b2874[_0x9280('0x53')](_0x428993[_0x9280('0x47')]['ids']||[]);}return null;})['then'](respondWithResult(_0x3febb2,null))[_0x9280('0x44')](handleError(_0x3febb2,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 3192b15..2c98abf 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 _0x36ee=['ZendeskConfiguration','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define'];(function(_0x1f8685,_0x31b799){var _0x144705=function(_0x4840b8){while(--_0x4840b8){_0x1f8685['push'](_0x1f8685['shift']());}};_0x144705(++_0x31b799);}(_0x36ee,0xe8));var _0xe36e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x36ee[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe36e('0x0'))('api');var moment=require(_0xe36e('0x1'));var BPromise=require(_0xe36e('0x2'));var rp=require(_0xe36e('0x3'));var fs=require('fs');var path=require(_0xe36e('0x4'));var rimraf=require(_0xe36e('0x5'));var config=require(_0xe36e('0x6'));var attributes=require(_0xe36e('0x7'));module[_0xe36e('0x8')]=function(_0x25a07d,_0x190404){return _0x25a07d[_0xe36e('0x9')](_0xe36e('0xa'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x160f=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','int_zendesk_configurations'];(function(_0x2dead1,_0xe5ea45){var _0xfdf450=function(_0xaee03b){while(--_0xaee03b){_0x2dead1['push'](_0x2dead1['shift']());}};_0xfdf450(++_0xe5ea45);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf160('0x0'));var util=require(_0xf160('0x1'));var logger=require(_0xf160('0x2'))(_0xf160('0x3'));var moment=require('moment');var BPromise=require(_0xf160('0x4'));var rp=require(_0xf160('0x5'));var fs=require('fs');var path=require(_0xf160('0x6'));var rimraf=require(_0xf160('0x7'));var config=require(_0xf160('0x8'));var attributes=require(_0xf160('0x9'));module['exports']=function(_0x311d63,_0x11902f){return _0x311d63['define']('ZendeskConfiguration',attributes,{'tableName':_0xf160('0xa'),'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 0fe76a8..ee32db4 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 _0xea8f=['bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','then','info','ZendeskConfiguration,\x20%s,\x20%s','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','util','moment'];(function(_0x507e46,_0x4166c1){var _0x3604d3=function(_0x3555f3){while(--_0x3555f3){_0x507e46['push'](_0x507e46['shift']());}};_0x3604d3(++_0x4166c1);}(_0xea8f,0x18d));var _0xfea8=function(_0x40dfae,_0xc898a1){_0x40dfae=_0x40dfae-0x0;var _0x1106f1=_0xea8f[_0x40dfae];return _0x1106f1;};'use strict';var _=require('lodash');var util=require(_0xfea8('0x0'));var moment=require(_0xfea8('0x1'));var BPromise=require(_0xfea8('0x2'));var rs=require(_0xfea8('0x3'));var fs=require('fs');var Redis=require(_0xfea8('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfea8('0x5'))(_0xfea8('0x6'));var config=require('../../config/environment');var jayson=require(_0xfea8('0x7'));var client=jayson[_0xfea8('0x8')][_0xfea8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xdbc23,_0x10f513,_0x38d0a7){return new BPromise(function(_0x5285fa,_0x45ff1d){return client['request'](_0xdbc23,_0x38d0a7)[_0xfea8('0xa')](function(_0x25eab3){logger[_0xfea8('0xb')](_0xfea8('0xc'),_0x10f513,'request\x20sent');logger['debug'](_0xfea8('0xd'),_0x10f513,'request\x20sent',JSON[_0xfea8('0xe')](_0x25eab3));if(_0x25eab3[_0xfea8('0xf')]){if(_0x25eab3[_0xfea8('0xf')][_0xfea8('0x10')]===0x1f4){logger[_0xfea8('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0x10f513,_0x25eab3[_0xfea8('0xf')][_0xfea8('0x11')]);return _0x45ff1d(_0x25eab3[_0xfea8('0xf')][_0xfea8('0x11')]);}logger[_0xfea8('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0x10f513,_0x25eab3[_0xfea8('0xf')]['message']);return _0x5285fa(_0x25eab3[_0xfea8('0xf')][_0xfea8('0x11')]);}else{logger[_0xfea8('0xb')](_0xfea8('0xc'),_0x10f513,_0xfea8('0x12'));_0x5285fa(_0x25eab3[_0xfea8('0x13')]['message']);}})[_0xfea8('0x14')](function(_0x55dde8){logger['error'](_0xfea8('0xc'),_0x10f513,_0x55dde8);_0x45ff1d(_0x55dde8);});});} \ No newline at end of file +var _0xe0f1=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0xf854d8,_0x3a9a03){var _0x559eb2=function(_0x5212d9){while(--_0x5212d9){_0xf854d8['push'](_0xf854d8['shift']());}};_0x559eb2(++_0x3a9a03);}(_0xe0f1,0x12e));var _0x1e0f=function(_0x30033a,_0x5ce4a6){_0x30033a=_0x30033a-0x0;var _0x5e3518=_0xe0f1[_0x30033a];return _0x5e3518;};'use strict';var _=require(_0x1e0f('0x0'));var util=require('util');var moment=require(_0x1e0f('0x1'));var BPromise=require(_0x1e0f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1e0f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1e0f('0x4'));var logger=require(_0x1e0f('0x5'))(_0x1e0f('0x6'));var config=require(_0x1e0f('0x7'));var jayson=require(_0x1e0f('0x8'));var client=jayson[_0x1e0f('0x9')][_0x1e0f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x362316,_0x35f778,_0x50ca19){return new BPromise(function(_0x17d0ce,_0x543548){return client[_0x1e0f('0xb')](_0x362316,_0x50ca19)[_0x1e0f('0xc')](function(_0x2dbdac){logger[_0x1e0f('0xd')](_0x1e0f('0xe'),_0x35f778,'request\x20sent');logger[_0x1e0f('0xf')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x35f778,_0x1e0f('0x10'),JSON[_0x1e0f('0x11')](_0x2dbdac));if(_0x2dbdac[_0x1e0f('0x12')]){if(_0x2dbdac[_0x1e0f('0x12')][_0x1e0f('0x13')]===0x1f4){logger[_0x1e0f('0x12')](_0x1e0f('0xe'),_0x35f778,_0x2dbdac[_0x1e0f('0x12')][_0x1e0f('0x14')]);return _0x543548(_0x2dbdac[_0x1e0f('0x12')][_0x1e0f('0x14')]);}logger['error'](_0x1e0f('0xe'),_0x35f778,_0x2dbdac[_0x1e0f('0x12')]['message']);return _0x17d0ce(_0x2dbdac[_0x1e0f('0x12')][_0x1e0f('0x14')]);}else{logger[_0x1e0f('0xd')](_0x1e0f('0xe'),_0x35f778,_0x1e0f('0x10'));_0x17d0ce(_0x2dbdac['result'][_0x1e0f('0x14')]);}})[_0x1e0f('0x15')](function(_0x1264d2){logger['error'](_0x1e0f('0xe'),_0x35f778,_0x1264d2);_0x543548(_0x1264d2);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 29cb1e4..e560cb1 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 _0x824a=['get','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x46759d,_0x13e994){var _0x3e7fe0=function(_0x2f427d){while(--_0x2f427d){_0x46759d['push'](_0x46759d['shift']());}};_0x3e7fe0(++_0x13e994);}(_0x824a,0x106));var _0xa824=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x824a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xa824('0x0'));var util=require(_0xa824('0x1'));var path=require(_0xa824('0x2'));var timeout=require(_0xa824('0x3'));var express=require(_0xa824('0x4'));var router=express['Router']();var fs_extra=require(_0xa824('0x5'));var auth=require(_0xa824('0x6'));var interaction=require(_0xa824('0x7'));var config=require(_0xa824('0x8'));var controller=require('./intZendeskField.controller');router['get']('/',auth[_0xa824('0x9')](),controller[_0xa824('0xa')]);router[_0xa824('0xb')]('/:id',auth[_0xa824('0x9')](),controller[_0xa824('0xc')]);router[_0xa824('0xd')]('/',auth['isAuthenticated'](),controller[_0xa824('0xe')]);router[_0xa824('0xf')](_0xa824('0x10'),auth[_0xa824('0x9')](),controller[_0xa824('0x11')]);router[_0xa824('0x12')](_0xa824('0x10'),auth[_0xa824('0x9')](),controller[_0xa824('0x13')]);module[_0xa824('0x14')]=router; \ No newline at end of file +var _0xb228=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x15aac3,_0x2cda38){var _0x2c8480=function(_0x498d1e){while(--_0x498d1e){_0x15aac3['push'](_0x15aac3['shift']());}};_0x2c8480(++_0x2cda38);}(_0xb228,0x19f));var _0x8b22=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xb228[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x8b22('0x0'));var util=require(_0x8b22('0x1'));var path=require(_0x8b22('0x2'));var timeout=require('connect-timeout');var express=require(_0x8b22('0x3'));var router=express[_0x8b22('0x4')]();var fs_extra=require(_0x8b22('0x5'));var auth=require(_0x8b22('0x6'));var interaction=require(_0x8b22('0x7'));var config=require(_0x8b22('0x8'));var controller=require(_0x8b22('0x9'));router[_0x8b22('0xa')]('/',auth['isAuthenticated'](),controller[_0x8b22('0xb')]);router[_0x8b22('0xa')](_0x8b22('0xc'),auth[_0x8b22('0xd')](),controller[_0x8b22('0xe')]);router[_0x8b22('0xf')]('/',auth[_0x8b22('0xd')](),controller[_0x8b22('0x10')]);router[_0x8b22('0x11')](_0x8b22('0xc'),auth['isAuthenticated'](),controller[_0x8b22('0x12')]);router[_0x8b22('0x13')](_0x8b22('0xc'),auth[_0x8b22('0xd')](),controller[_0x8b22('0x14')]);module[_0x8b22('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index e7e62aa..202cc6a 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 _0x0530=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','exports','ENUM','string'];(function(_0x460321,_0x5bc325){var _0x4a7888=function(_0x4fa503){while(--_0x4fa503){_0x460321['push'](_0x460321['shift']());}};_0x4a7888(++_0x5bc325);}(_0x0530,0xc3));var _0x0053=function(_0x38aae8,_0x50455b){_0x38aae8=_0x38aae8-0x0;var _0x52024c=_0x0530[_0x38aae8];return _0x52024c;};'use strict';var Sequelize=require('sequelize');module[_0x0053('0x0')]={'type':{'type':Sequelize[_0x0053('0x1')](_0x0053('0x2'),_0x0053('0x3'),_0x0053('0x4'),_0x0053('0x5'),_0x0053('0x6')),'defaultValue':_0x0053('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x0053('0x1')]('string','variable',_0x0053('0x4'))},'keyContent':{'type':Sequelize[_0x0053('0x7')]},'idField':{'type':Sequelize[_0x0053('0x7')]},'nameField':{'type':Sequelize[_0x0053('0x7')]},'customField':{'type':Sequelize[_0x0053('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0053('0x7')]}}; \ No newline at end of file +var _0xdf3b=['BOOLEAN','sequelize','exports','string','variable','customVariable','picklist','STRING','ENUM'];(function(_0x207ae2,_0x52fbda){var _0x2fe1ea=function(_0x59866d){while(--_0x59866d){_0x207ae2['push'](_0x207ae2['shift']());}};_0x2fe1ea(++_0x52fbda);}(_0xdf3b,0xd9));var _0xbdf3=function(_0x50a448,_0x3d1a4d){_0x50a448=_0x50a448-0x0;var _0x5da8c6=_0xdf3b[_0x50a448];return _0x5da8c6;};'use strict';var Sequelize=require(_0xbdf3('0x0'));module[_0xbdf3('0x1')]={'type':{'type':Sequelize['ENUM'](_0xbdf3('0x2'),_0xbdf3('0x3'),_0xbdf3('0x4'),'keyValue',_0xbdf3('0x5')),'defaultValue':_0xbdf3('0x2')},'content':{'type':Sequelize[_0xbdf3('0x6')]},'key':{'type':Sequelize[_0xbdf3('0x6')]},'keyType':{'type':Sequelize[_0xbdf3('0x7')](_0xbdf3('0x2'),'variable',_0xbdf3('0x4'))},'keyContent':{'type':Sequelize[_0xbdf3('0x6')]},'idField':{'type':Sequelize[_0xbdf3('0x6')]},'nameField':{'type':Sequelize[_0xbdf3('0x6')]},'customField':{'type':Sequelize[_0xbdf3('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbdf3('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index dbfbde1..728b71e 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 _0x7333=['set','Content-Range','apply','save','update','then','destroy','end','name','index','ZendeskField','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','map','type','filter','options','includeAll','rows','catch','show','find','body','params','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit'];(function(_0x1216ce,_0x5949d4){var _0x48fb35=function(_0xa1fdff){while(--_0xa1fdff){_0x1216ce['push'](_0x1216ce['shift']());}};_0x48fb35(++_0x5949d4);}(_0x7333,0xfc));var _0x3733=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7333[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x3733('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3733('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3733('0x2'));var moment=require(_0x3733('0x3'));var BPromise=require(_0x3733('0x4'));var Mustache=require('mustache');var util=require(_0x3733('0x5'));var path=require(_0x3733('0x6'));var sox=require(_0x3733('0x7'));var csv=require('to-csv');var ejs=require(_0x3733('0x8'));var fs=require('fs');var fs_extra=require(_0x3733('0x9'));var _=require(_0x3733('0xa'));var squel=require(_0x3733('0xb'));var crypto=require('crypto');var jsforce=require(_0x3733('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3733('0xd'));var querystring=require(_0x3733('0xe'));var Papa=require(_0x3733('0xf'));var Redis=require(_0x3733('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3733('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3733('0x12'));var logger=require(_0x3733('0x13'))(_0x3733('0x14'));var utils=require(_0x3733('0x15'));var config=require(_0x3733('0x16'));var licenseUtil=require(_0x3733('0x17'));var db=require(_0x3733('0x18'))['db'];function respondWithStatusCode(_0x1402f8,_0x331f5d){_0x331f5d=_0x331f5d||0xcc;return function(_0x1fa139){if(_0x1fa139){return _0x1402f8[_0x3733('0x19')](_0x331f5d);}return _0x1402f8['status'](_0x331f5d)['end']();};}function respondWithResult(_0x387268,_0x2de05f){_0x2de05f=_0x2de05f||0xc8;return function(_0x402489){if(_0x402489){return _0x387268[_0x3733('0x1a')](_0x2de05f)[_0x3733('0x1b')](_0x402489);}};}function respondWithFilteredResult(_0x46a03e,_0x520008){return function(_0x1fd598){if(_0x1fd598){var _0x607186=typeof _0x520008[_0x3733('0x1c')]===_0x3733('0x1d')&&typeof _0x520008['limit']===_0x3733('0x1d');var _0x79ae75=_0x1fd598[_0x3733('0x1e')];var _0xd0f743=_0x607186?0x0:_0x520008['offset'];var _0x24a91e=_0x607186?_0x1fd598[_0x3733('0x1e')]:_0x520008[_0x3733('0x1c')]+_0x520008[_0x3733('0x1f')];var _0x981f37;if(_0x24a91e>=_0x79ae75){_0x24a91e=_0x79ae75;_0x981f37=0xc8;}else{_0x981f37=0xce;}_0x46a03e[_0x3733('0x1a')](_0x981f37);return _0x46a03e[_0x3733('0x20')](_0x3733('0x21'),_0xd0f743+'-'+_0x24a91e+'/'+_0x79ae75)[_0x3733('0x1b')](_0x1fd598);}return null;};}function patchUpdates(_0x48e182){return function(_0x92539){try{jsonpatch[_0x3733('0x22')](_0x92539,_0x48e182,!![]);}catch(_0x168fb5){return BPromise['reject'](_0x168fb5);}return _0x92539[_0x3733('0x23')]();};}function saveUpdates(_0x2fee60,_0x425495){return function(_0xab24eb){if(_0xab24eb){return _0xab24eb[_0x3733('0x24')](_0x2fee60)[_0x3733('0x25')](function(_0x81016){return _0x81016;});}return null;};}function removeEntity(_0x48826c,_0x3187a3){return function(_0x483904){if(_0x483904){return _0x483904[_0x3733('0x26')]()[_0x3733('0x25')](function(){_0x48826c[_0x3733('0x1a')](0xcc)[_0x3733('0x27')]();});}};}function handleEntityNotFound(_0x3f77d0,_0xf21aa9){return function(_0x34a572){if(!_0x34a572){_0x3f77d0[_0x3733('0x19')](0x194);}return _0x34a572;};}function handleError(_0x1a408a,_0x52ed95){_0x52ed95=_0x52ed95||0x1f4;return function(_0x1ce6c1){logger['error'](_0x1ce6c1['stack']);if(_0x1ce6c1[_0x3733('0x28')]){delete _0x1ce6c1[_0x3733('0x28')];}_0x1a408a[_0x3733('0x1a')](_0x52ed95)['send'](_0x1ce6c1);};}exports[_0x3733('0x29')]=function(_0x375dc2,_0x1a8a88){var _0x2be841={},_0x13b66e={},_0x1054bb={'count':0x0,'rows':[]};var _0x2fc431=_['map'](db[_0x3733('0x2a')][_0x3733('0x2b')],function(_0x414f69){return{'name':_0x414f69[_0x3733('0x2c')],'type':_0x414f69['type']['key']};});_0x13b66e[_0x3733('0x2d')]=_['map'](_0x2fc431,_0x3733('0x28'));_0x13b66e['query']=_[_0x3733('0x2e')](_0x375dc2[_0x3733('0x2f')]);_0x13b66e[_0x3733('0x30')]=_[_0x3733('0x31')](_0x13b66e[_0x3733('0x2d')],_0x13b66e[_0x3733('0x2f')]);_0x2be841[_0x3733('0x32')]=_[_0x3733('0x31')](_0x13b66e['model'],qs[_0x3733('0x33')](_0x375dc2[_0x3733('0x2f')][_0x3733('0x33')]));_0x2be841[_0x3733('0x32')]=_0x2be841[_0x3733('0x32')][_0x3733('0x34')]?_0x2be841[_0x3733('0x32')]:_0x13b66e[_0x3733('0x2d')];if(!_0x375dc2[_0x3733('0x2f')][_0x3733('0x35')](_0x3733('0x36'))){_0x2be841[_0x3733('0x1f')]=qs[_0x3733('0x1f')](_0x375dc2[_0x3733('0x2f')][_0x3733('0x1f')]);_0x2be841['offset']=qs[_0x3733('0x1c')](_0x375dc2[_0x3733('0x2f')][_0x3733('0x1c')]);}_0x2be841[_0x3733('0x37')]=qs[_0x3733('0x38')](_0x375dc2['query'][_0x3733('0x38')]);_0x2be841['where']=qs[_0x3733('0x30')](_[_0x3733('0x39')](_0x375dc2[_0x3733('0x2f')],_0x13b66e['filters']),_0x2fc431);if(_0x375dc2[_0x3733('0x2f')]['filter']){_0x2be841[_0x3733('0x3a')]=_[_0x3733('0x3b')](_0x2be841['where'],{'$or':_[_0x3733('0x3c')](_0x2fc431,function(_0x14ad52){if(_0x14ad52[_0x3733('0x3d')]!=='VIRTUAL'){var _0x41b100={};_0x41b100[_0x14ad52[_0x3733('0x28')]]={'$like':'%'+_0x375dc2[_0x3733('0x2f')][_0x3733('0x3e')]+'%'};return _0x41b100;}})});}_0x2be841=_[_0x3733('0x3b')]({},_0x2be841,_0x375dc2[_0x3733('0x3f')]);var _0x5912c6={'where':_0x2be841[_0x3733('0x3a')]};return db['ZendeskField']['count'](_0x5912c6)[_0x3733('0x25')](function(_0x47a622){_0x1054bb[_0x3733('0x1e')]=_0x47a622;if(_0x375dc2[_0x3733('0x2f')][_0x3733('0x40')]){_0x2be841['include']=[{'all':!![]}];}return db[_0x3733('0x2a')]['findAll'](_0x2be841);})['then'](function(_0x358263){_0x1054bb[_0x3733('0x41')]=_0x358263;return _0x1054bb;})[_0x3733('0x25')](respondWithFilteredResult(_0x1a8a88,_0x2be841))[_0x3733('0x42')](handleError(_0x1a8a88,null));};exports[_0x3733('0x43')]=function(_0x57849a,_0x58b5b5){var _0x3d5a00={'raw':!![],'where':{'id':_0x57849a['params']['id']}},_0x3b0f86={};_0x3b0f86['model']=_['keys'](db['ZendeskField']['rawAttributes']);_0x3b0f86[_0x3733('0x2f')]=_['keys'](_0x57849a['query']);_0x3b0f86['filters']=_['intersection'](_0x3b0f86[_0x3733('0x2d')],_0x3b0f86[_0x3733('0x2f')]);_0x3d5a00[_0x3733('0x32')]=_['intersection'](_0x3b0f86[_0x3733('0x2d')],qs[_0x3733('0x33')](_0x57849a[_0x3733('0x2f')]['fields']));_0x3d5a00[_0x3733('0x32')]=_0x3d5a00[_0x3733('0x32')][_0x3733('0x34')]?_0x3d5a00[_0x3733('0x32')]:_0x3b0f86['model'];if(_0x57849a[_0x3733('0x2f')][_0x3733('0x40')]){_0x3d5a00['include']=[{'all':!![]}];}_0x3d5a00=_['merge']({},_0x3d5a00,_0x57849a['options']);return db[_0x3733('0x2a')][_0x3733('0x44')](_0x3d5a00)[_0x3733('0x25')](handleEntityNotFound(_0x58b5b5,null))[_0x3733('0x25')](respondWithResult(_0x58b5b5,null))[_0x3733('0x42')](handleError(_0x58b5b5,null));};exports['create']=function(_0xe0eb96,_0x31f762){return db['ZendeskField']['create'](_0xe0eb96[_0x3733('0x45')],{})['then'](respondWithResult(_0x31f762,0xc9))[_0x3733('0x42')](handleError(_0x31f762,null));};exports[_0x3733('0x24')]=function(_0x10bdd9,_0xff007b){if(_0x10bdd9['body']['id']){delete _0x10bdd9['body']['id'];}return db[_0x3733('0x2a')]['find']({'where':{'id':_0x10bdd9[_0x3733('0x46')]['id']}})['then'](handleEntityNotFound(_0xff007b,null))[_0x3733('0x25')](saveUpdates(_0x10bdd9['body'],null))[_0x3733('0x25')](respondWithResult(_0xff007b,null))['catch'](handleError(_0xff007b,null));};exports[_0x3733('0x26')]=function(_0x4924c2,_0x25c042){return db['ZendeskField'][_0x3733('0x44')]({'where':{'id':_0x4924c2[_0x3733('0x46')]['id']}})[_0x3733('0x25')](handleEntityNotFound(_0x25c042,null))[_0x3733('0x25')](removeEntity(_0x25c042,null))[_0x3733('0x42')](handleError(_0x25c042,null));}; \ No newline at end of file +var _0x8f1d=['name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','ZendeskField','includeAll','include','rows','catch','params','keys','length','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack'];(function(_0x338e7a,_0x544027){var _0x41a7a7=function(_0x515b95){while(--_0x515b95){_0x338e7a['push'](_0x338e7a['shift']());}};_0x41a7a7(++_0x544027);}(_0x8f1d,0x72));var _0xd8f1=function(_0x571852,_0x34ae1f){_0x571852=_0x571852-0x0;var _0x1ec365=_0x8f1d[_0x571852];return _0x1ec365;};'use strict';var emlformat=require(_0xd8f1('0x0'));var rimraf=require(_0xd8f1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd8f1('0x2'));var rp=require(_0xd8f1('0x3'));var moment=require(_0xd8f1('0x4'));var BPromise=require(_0xd8f1('0x5'));var Mustache=require(_0xd8f1('0x6'));var util=require('util');var path=require(_0xd8f1('0x7'));var sox=require(_0xd8f1('0x8'));var csv=require(_0xd8f1('0x9'));var ejs=require(_0xd8f1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd8f1('0xb'));var squel=require(_0xd8f1('0xc'));var crypto=require(_0xd8f1('0xd'));var jsforce=require(_0xd8f1('0xe'));var deskjs=require(_0xd8f1('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd8f1('0x10'));var Papa=require(_0xd8f1('0x11'));var Redis=require(_0xd8f1('0x12'));var authService=require(_0xd8f1('0x13'));var qs=require(_0xd8f1('0x14'));var as=require(_0xd8f1('0x15'));var hardwareService=require(_0xd8f1('0x16'));var logger=require(_0xd8f1('0x17'))('api');var utils=require(_0xd8f1('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xd8f1('0x19'));var db=require(_0xd8f1('0x1a'))['db'];function respondWithStatusCode(_0x50b309,_0x39eaab){_0x39eaab=_0x39eaab||0xcc;return function(_0x3707b6){if(_0x3707b6){return _0x50b309[_0xd8f1('0x1b')](_0x39eaab);}return _0x50b309[_0xd8f1('0x1c')](_0x39eaab)[_0xd8f1('0x1d')]();};}function respondWithResult(_0x269e57,_0x3da391){_0x3da391=_0x3da391||0xc8;return function(_0x17e0ab){if(_0x17e0ab){return _0x269e57['status'](_0x3da391)[_0xd8f1('0x1e')](_0x17e0ab);}};}function respondWithFilteredResult(_0x2bbb53,_0xc6828c){return function(_0x50051d){if(_0x50051d){var _0x3c85c2=typeof _0xc6828c[_0xd8f1('0x1f')]==='undefined'&&typeof _0xc6828c[_0xd8f1('0x20')]===_0xd8f1('0x21');var _0x923f89=_0x50051d['count'];var _0x5735d4=_0x3c85c2?0x0:_0xc6828c[_0xd8f1('0x1f')];var _0xd7c14=_0x3c85c2?_0x50051d[_0xd8f1('0x22')]:_0xc6828c['offset']+_0xc6828c[_0xd8f1('0x20')];var _0x2cbe3b;if(_0xd7c14>=_0x923f89){_0xd7c14=_0x923f89;_0x2cbe3b=0xc8;}else{_0x2cbe3b=0xce;}_0x2bbb53[_0xd8f1('0x1c')](_0x2cbe3b);return _0x2bbb53[_0xd8f1('0x23')](_0xd8f1('0x24'),_0x5735d4+'-'+_0xd7c14+'/'+_0x923f89)['json'](_0x50051d);}return null;};}function patchUpdates(_0x22029c){return function(_0x233012){try{jsonpatch[_0xd8f1('0x25')](_0x233012,_0x22029c,!![]);}catch(_0xefb0c){return BPromise['reject'](_0xefb0c);}return _0x233012[_0xd8f1('0x26')]();};}function saveUpdates(_0x711baf,_0x1212fc){return function(_0x702bb9){if(_0x702bb9){return _0x702bb9[_0xd8f1('0x27')](_0x711baf)[_0xd8f1('0x28')](function(_0x2d4431){return _0x2d4431;});}return null;};}function removeEntity(_0x4dc4c8,_0xd1090f){return function(_0x41afa7){if(_0x41afa7){return _0x41afa7[_0xd8f1('0x29')]()[_0xd8f1('0x28')](function(){_0x4dc4c8[_0xd8f1('0x1c')](0xcc)[_0xd8f1('0x1d')]();});}};}function handleEntityNotFound(_0x287fea,_0x29114b){return function(_0x29fcbb){if(!_0x29fcbb){_0x287fea[_0xd8f1('0x1b')](0x194);}return _0x29fcbb;};}function handleError(_0x3d2601,_0x3773b1){_0x3773b1=_0x3773b1||0x1f4;return function(_0x5230ac){logger[_0xd8f1('0x2a')](_0x5230ac[_0xd8f1('0x2b')]);if(_0x5230ac[_0xd8f1('0x2c')]){delete _0x5230ac['name'];}_0x3d2601[_0xd8f1('0x1c')](_0x3773b1)[_0xd8f1('0x2d')](_0x5230ac);};}exports[_0xd8f1('0x2e')]=function(_0x3202f9,_0x4ec46e){var _0x239aff={},_0x575f3f={},_0x284dd1={'count':0x0,'rows':[]};var _0x10dcd5=_[_0xd8f1('0x2f')](db['ZendeskField'][_0xd8f1('0x30')],function(_0x44c7a3){return{'name':_0x44c7a3[_0xd8f1('0x31')],'type':_0x44c7a3[_0xd8f1('0x32')][_0xd8f1('0x33')]};});_0x575f3f[_0xd8f1('0x34')]=_['map'](_0x10dcd5,_0xd8f1('0x2c'));_0x575f3f[_0xd8f1('0x35')]=_['keys'](_0x3202f9['query']);_0x575f3f['filters']=_[_0xd8f1('0x36')](_0x575f3f['model'],_0x575f3f[_0xd8f1('0x35')]);_0x239aff[_0xd8f1('0x37')]=_[_0xd8f1('0x36')](_0x575f3f[_0xd8f1('0x34')],qs['fields'](_0x3202f9[_0xd8f1('0x35')][_0xd8f1('0x38')]));_0x239aff['attributes']=_0x239aff[_0xd8f1('0x37')]['length']?_0x239aff[_0xd8f1('0x37')]:_0x575f3f[_0xd8f1('0x34')];if(!_0x3202f9[_0xd8f1('0x35')][_0xd8f1('0x39')](_0xd8f1('0x3a'))){_0x239aff[_0xd8f1('0x20')]=qs[_0xd8f1('0x20')](_0x3202f9[_0xd8f1('0x35')][_0xd8f1('0x20')]);_0x239aff[_0xd8f1('0x1f')]=qs[_0xd8f1('0x1f')](_0x3202f9['query'][_0xd8f1('0x1f')]);}_0x239aff[_0xd8f1('0x3b')]=qs[_0xd8f1('0x3c')](_0x3202f9[_0xd8f1('0x35')][_0xd8f1('0x3c')]);_0x239aff['where']=qs[_0xd8f1('0x3d')](_[_0xd8f1('0x3e')](_0x3202f9[_0xd8f1('0x35')],_0x575f3f['filters']),_0x10dcd5);if(_0x3202f9['query']['filter']){_0x239aff[_0xd8f1('0x3f')]=_[_0xd8f1('0x40')](_0x239aff[_0xd8f1('0x3f')],{'$or':_[_0xd8f1('0x2f')](_0x10dcd5,function(_0x327c05){if(_0x327c05['type']!==_0xd8f1('0x41')){var _0x185d2e={};_0x185d2e[_0x327c05[_0xd8f1('0x2c')]]={'$like':'%'+_0x3202f9[_0xd8f1('0x35')][_0xd8f1('0x42')]+'%'};return _0x185d2e;}})});}_0x239aff=_[_0xd8f1('0x40')]({},_0x239aff,_0x3202f9[_0xd8f1('0x43')]);var _0x355b38={'where':_0x239aff[_0xd8f1('0x3f')]};return db[_0xd8f1('0x44')]['count'](_0x355b38)['then'](function(_0x59552e){_0x284dd1[_0xd8f1('0x22')]=_0x59552e;if(_0x3202f9[_0xd8f1('0x35')][_0xd8f1('0x45')]){_0x239aff[_0xd8f1('0x46')]=[{'all':!![]}];}return db[_0xd8f1('0x44')]['findAll'](_0x239aff);})[_0xd8f1('0x28')](function(_0x3f3b6e){_0x284dd1[_0xd8f1('0x47')]=_0x3f3b6e;return _0x284dd1;})[_0xd8f1('0x28')](respondWithFilteredResult(_0x4ec46e,_0x239aff))[_0xd8f1('0x48')](handleError(_0x4ec46e,null));};exports['show']=function(_0x2086ff,_0x3c147d){var _0x292c1b={'raw':!![],'where':{'id':_0x2086ff[_0xd8f1('0x49')]['id']}},_0xc4e49c={};_0xc4e49c[_0xd8f1('0x34')]=_[_0xd8f1('0x4a')](db[_0xd8f1('0x44')]['rawAttributes']);_0xc4e49c['query']=_[_0xd8f1('0x4a')](_0x2086ff[_0xd8f1('0x35')]);_0xc4e49c[_0xd8f1('0x3d')]=_[_0xd8f1('0x36')](_0xc4e49c[_0xd8f1('0x34')],_0xc4e49c[_0xd8f1('0x35')]);_0x292c1b[_0xd8f1('0x37')]=_[_0xd8f1('0x36')](_0xc4e49c['model'],qs[_0xd8f1('0x38')](_0x2086ff[_0xd8f1('0x35')][_0xd8f1('0x38')]));_0x292c1b[_0xd8f1('0x37')]=_0x292c1b[_0xd8f1('0x37')][_0xd8f1('0x4b')]?_0x292c1b[_0xd8f1('0x37')]:_0xc4e49c[_0xd8f1('0x34')];if(_0x2086ff['query'][_0xd8f1('0x45')]){_0x292c1b['include']=[{'all':!![]}];}_0x292c1b=_['merge']({},_0x292c1b,_0x2086ff[_0xd8f1('0x43')]);return db[_0xd8f1('0x44')][_0xd8f1('0x4c')](_0x292c1b)[_0xd8f1('0x28')](handleEntityNotFound(_0x3c147d,null))['then'](respondWithResult(_0x3c147d,null))[_0xd8f1('0x48')](handleError(_0x3c147d,null));};exports[_0xd8f1('0x4d')]=function(_0x1f34ff,_0x9d407c){return db[_0xd8f1('0x44')][_0xd8f1('0x4d')](_0x1f34ff[_0xd8f1('0x4e')],{})[_0xd8f1('0x28')](respondWithResult(_0x9d407c,0xc9))[_0xd8f1('0x48')](handleError(_0x9d407c,null));};exports[_0xd8f1('0x27')]=function(_0x1f23d3,_0x5dbf25){if(_0x1f23d3[_0xd8f1('0x4e')]['id']){delete _0x1f23d3[_0xd8f1('0x4e')]['id'];}return db[_0xd8f1('0x44')][_0xd8f1('0x4c')]({'where':{'id':_0x1f23d3[_0xd8f1('0x49')]['id']}})[_0xd8f1('0x28')](handleEntityNotFound(_0x5dbf25,null))[_0xd8f1('0x28')](saveUpdates(_0x1f23d3[_0xd8f1('0x4e')],null))[_0xd8f1('0x28')](respondWithResult(_0x5dbf25,null))[_0xd8f1('0x48')](handleError(_0x5dbf25,null));};exports[_0xd8f1('0x29')]=function(_0x3d3336,_0x14fd2b){return db['ZendeskField'][_0xd8f1('0x4c')]({'where':{'id':_0x3d3336['params']['id']}})[_0xd8f1('0x28')](handleEntityNotFound(_0x14fd2b,null))['then'](removeEntity(_0x14fd2b,null))['catch'](handleError(_0x14fd2b,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 3badd99..1c5b0f6 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 _0x300e=['request-promise','path','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','zendesk_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x449385,_0x4543e1){var _0x234dd4=function(_0x4993cd){while(--_0x4993cd){_0x449385['push'](_0x449385['shift']());}};_0x234dd4(++_0x4543e1);}(_0x300e,0xea));var _0xe300=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0x300e[_0x1b7368];return _0x25d54c;};'use strict';var _=require(_0xe300('0x0'));var util=require(_0xe300('0x1'));var logger=require(_0xe300('0x2'))(_0xe300('0x3'));var moment=require(_0xe300('0x4'));var BPromise=require(_0xe300('0x5'));var rp=require(_0xe300('0x6'));var fs=require('fs');var path=require(_0xe300('0x7'));var rimraf=require('rimraf');var config=require(_0xe300('0x8'));var attributes=require(_0xe300('0x9'));module[_0xe300('0xa')]=function(_0x495df8,_0x21cd4a){return _0x495df8[_0xe300('0xb')](_0xe300('0xc'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0xe300('0xd'),'fields':[_0xe300('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd487=['bluebird','request-promise','rimraf','../../config/environment','./intZendeskField.attributes','define','ZendeskField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x365d7c,_0x42935d){var _0x1f0ffc=function(_0x3670d3){while(--_0x3670d3){_0x365d7c['push'](_0x365d7c['shift']());}};_0x1f0ffc(++_0x42935d);}(_0xd487,0x7d));var _0x7d48=function(_0x4adfa4,_0x121c5a){_0x4adfa4=_0x4adfa4-0x0;var _0x14cec1=_0xd487[_0x4adfa4];return _0x14cec1;};'use strict';var _=require(_0x7d48('0x0'));var util=require(_0x7d48('0x1'));var logger=require(_0x7d48('0x2'))(_0x7d48('0x3'));var moment=require(_0x7d48('0x4'));var BPromise=require(_0x7d48('0x5'));var rp=require(_0x7d48('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7d48('0x7'));var config=require(_0x7d48('0x8'));var attributes=require(_0x7d48('0x9'));module['exports']=function(_0x483d3d,_0x2b3f49){return _0x483d3d[_0x7d48('0xa')](_0x7d48('0xb'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':['idField',_0x7d48('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index ef0c52a..2b27dc1 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 _0x8afa=['info','ZendeskField,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request'];(function(_0x1bbc08,_0x444008){var _0x5d825b=function(_0x522920){while(--_0x522920){_0x1bbc08['push'](_0x1bbc08['shift']());}};_0x5d825b(++_0x444008);}(_0x8afa,0x11b));var _0xa8af=function(_0x137e21,_0x1205f7){_0x137e21=_0x137e21-0x0;var _0x2583d0=_0x8afa[_0x137e21];return _0x2583d0;};'use strict';var _=require(_0xa8af('0x0'));var util=require('util');var moment=require(_0xa8af('0x1'));var BPromise=require(_0xa8af('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa8af('0x3'));var db=require(_0xa8af('0x4'))['db'];var utils=require(_0xa8af('0x5'));var logger=require('../../config/logger')(_0xa8af('0x6'));var config=require(_0xa8af('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa8af('0x8')][_0xa8af('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x29f5f8,_0x4c0808,_0x4f0983){return new BPromise(function(_0x2eb3b7,_0x218f85){return client[_0xa8af('0xa')](_0x29f5f8,_0x4f0983)['then'](function(_0x5a264c){logger[_0xa8af('0xb')](_0xa8af('0xc'),_0x4c0808,'request\x20sent');logger[_0xa8af('0xd')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x4c0808,_0xa8af('0xe'),JSON[_0xa8af('0xf')](_0x5a264c));if(_0x5a264c['error']){if(_0x5a264c['error'][_0xa8af('0x10')]===0x1f4){logger[_0xa8af('0x11')](_0xa8af('0xc'),_0x4c0808,_0x5a264c[_0xa8af('0x11')][_0xa8af('0x12')]);return _0x218f85(_0x5a264c[_0xa8af('0x11')]['message']);}logger['error'](_0xa8af('0xc'),_0x4c0808,_0x5a264c['error'][_0xa8af('0x12')]);return _0x2eb3b7(_0x5a264c['error']['message']);}else{logger[_0xa8af('0xb')]('ZendeskField,\x20%s,\x20%s',_0x4c0808,_0xa8af('0xe'));_0x2eb3b7(_0x5a264c[_0xa8af('0x13')]['message']);}})[_0xa8af('0x14')](function(_0x17c677){logger[_0xa8af('0x11')](_0xa8af('0xc'),_0x4c0808,_0x17c677);_0x218f85(_0x17c677);});});} \ No newline at end of file +var _0xb2a2=['client','http','request','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x121027,_0x43442f){var _0x3c7a0e=function(_0x5a8073){while(--_0x5a8073){_0x121027['push'](_0x121027['shift']());}};_0x3c7a0e(++_0x43442f);}(_0xb2a2,0x96));var _0x2b2a=function(_0x5dee5a,_0x162b04){_0x5dee5a=_0x5dee5a-0x0;var _0x3d37d5=_0xb2a2[_0x5dee5a];return _0x3d37d5;};'use strict';var _=require(_0x2b2a('0x0'));var util=require(_0x2b2a('0x1'));var moment=require(_0x2b2a('0x2'));var BPromise=require(_0x2b2a('0x3'));var rs=require(_0x2b2a('0x4'));var fs=require('fs');var Redis=require(_0x2b2a('0x5'));var db=require(_0x2b2a('0x6'))['db'];var utils=require(_0x2b2a('0x7'));var logger=require('../../config/logger')(_0x2b2a('0x8'));var config=require(_0x2b2a('0x9'));var jayson=require(_0x2b2a('0xa'));var client=jayson[_0x2b2a('0xb')][_0x2b2a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x41790b,_0x195d6e,_0x5171ea){return new BPromise(function(_0x42597c,_0x544c80){return client[_0x2b2a('0xd')](_0x41790b,_0x5171ea)['then'](function(_0x1599c0){logger[_0x2b2a('0xe')](_0x2b2a('0xf'),_0x195d6e,_0x2b2a('0x10'));logger[_0x2b2a('0x11')](_0x2b2a('0x12'),_0x195d6e,_0x2b2a('0x10'),JSON['stringify'](_0x1599c0));if(_0x1599c0[_0x2b2a('0x13')]){if(_0x1599c0[_0x2b2a('0x13')]['code']===0x1f4){logger[_0x2b2a('0x13')](_0x2b2a('0xf'),_0x195d6e,_0x1599c0['error'][_0x2b2a('0x14')]);return _0x544c80(_0x1599c0[_0x2b2a('0x13')][_0x2b2a('0x14')]);}logger[_0x2b2a('0x13')](_0x2b2a('0xf'),_0x195d6e,_0x1599c0[_0x2b2a('0x13')][_0x2b2a('0x14')]);return _0x42597c(_0x1599c0[_0x2b2a('0x13')][_0x2b2a('0x14')]);}else{logger[_0x2b2a('0xe')]('ZendeskField,\x20%s,\x20%s',_0x195d6e,_0x2b2a('0x10'));_0x42597c(_0x1599c0[_0x2b2a('0x15')][_0x2b2a('0x14')]);}})[_0x2b2a('0x16')](function(_0x3740a7){logger[_0x2b2a('0x13')](_0x2b2a('0xf'),_0x195d6e,_0x3740a7);_0x544c80(_0x3740a7);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index e632303..3ed1582 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 _0xc64d=['Router','fs-extra','../../components/interaction/service','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getFields','post','addConfiguration','put','update','delete','destroy','exports','util','express'];(function(_0x33dc62,_0x598f0e){var _0x43f5d5=function(_0x581820){while(--_0x581820){_0x33dc62['push'](_0x33dc62['shift']());}};_0x43f5d5(++_0x598f0e);}(_0xc64d,0x166));var _0xdc64=function(_0x2f8d80,_0x4e6c4c){_0x2f8d80=_0x2f8d80-0x0;var _0x69d269=_0xc64d[_0x2f8d80];return _0x69d269;};'use strict';var multer=require('multer');var util=require(_0xdc64('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdc64('0x1'));var router=express[_0xdc64('0x2')]();var fs_extra=require(_0xdc64('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xdc64('0x4'));var config=require('../../config/environment');var controller=require(_0xdc64('0x5'));router[_0xdc64('0x6')]('/',auth[_0xdc64('0x7')](),controller[_0xdc64('0x8')]);router[_0xdc64('0x6')](_0xdc64('0x9'),auth[_0xdc64('0x7')](),controller[_0xdc64('0xa')]);router[_0xdc64('0x6')](_0xdc64('0xb'),auth[_0xdc64('0x7')](),controller['getConfigurations']);router[_0xdc64('0x6')]('/:id/fields',auth[_0xdc64('0x7')](),controller[_0xdc64('0xc')]);router[_0xdc64('0xd')]('/',auth[_0xdc64('0x7')](),controller['create']);router[_0xdc64('0xd')](_0xdc64('0xb'),auth['isAuthenticated'](),controller[_0xdc64('0xe')]);router[_0xdc64('0xf')](_0xdc64('0x9'),auth[_0xdc64('0x7')](),controller[_0xdc64('0x10')]);router[_0xdc64('0x11')]('/:id',auth[_0xdc64('0x7')](),controller[_0xdc64('0x12')]);module[_0xdc64('0x13')]=router; \ No newline at end of file +var _0x5acf=['exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoAccount.controller','isAuthenticated','index','/:id','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','destroy'];(function(_0x5c72ee,_0x5a8bf8){var _0x231876=function(_0x955276){while(--_0x955276){_0x5c72ee['push'](_0x5c72ee['shift']());}};_0x231876(++_0x5a8bf8);}(_0x5acf,0x171));var _0xf5ac=function(_0x7e8c80,_0x402cb1){_0x7e8c80=_0x7e8c80-0x0;var _0x3bc133=_0x5acf[_0x7e8c80];return _0x3bc133;};'use strict';var multer=require(_0xf5ac('0x0'));var util=require('util');var path=require(_0xf5ac('0x1'));var timeout=require(_0xf5ac('0x2'));var express=require('express');var router=express[_0xf5ac('0x3')]();var fs_extra=require(_0xf5ac('0x4'));var auth=require(_0xf5ac('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf5ac('0x6'));var controller=require(_0xf5ac('0x7'));router['get']('/',auth[_0xf5ac('0x8')](),controller[_0xf5ac('0x9')]);router['get'](_0xf5ac('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xf5ac('0xb')](_0xf5ac('0xc'),auth[_0xf5ac('0x8')](),controller[_0xf5ac('0xd')]);router['get'](_0xf5ac('0xe'),auth[_0xf5ac('0x8')](),controller[_0xf5ac('0xf')]);router[_0xf5ac('0x10')]('/',auth[_0xf5ac('0x8')](),controller[_0xf5ac('0x11')]);router[_0xf5ac('0x10')](_0xf5ac('0xc'),auth['isAuthenticated'](),controller[_0xf5ac('0x12')]);router[_0xf5ac('0x13')](_0xf5ac('0xa'),auth[_0xf5ac('0x8')](),controller[_0xf5ac('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xf5ac('0x15')]);module[_0xf5ac('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 629cae1..e4a394e 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 _0x2750=['STRING','sequelize'];(function(_0x3564d6,_0x37d1cb){var _0x1f2267=function(_0xbf7dfb){while(--_0xbf7dfb){_0x3564d6['push'](_0x3564d6['shift']());}};_0x1f2267(++_0x37d1cb);}(_0x2750,0x13b));var _0x0275=function(_0x10acf7,_0x59705b){_0x10acf7=_0x10acf7-0x0;var _0x233d87=_0x2750[_0x10acf7];return _0x233d87;};'use strict';var Sequelize=require(_0x0275('0x0'));module['exports']={'name':{'type':Sequelize[_0x0275('0x1')]},'description':{'type':Sequelize[_0x0275('0x1')]},'host':{'type':Sequelize[_0x0275('0x1')]},'zone':{'type':Sequelize[_0x0275('0x1')]},'clientId':{'type':Sequelize[_0x0275('0x1')]},'clientSecret':{'type':Sequelize[_0x0275('0x1')]},'serverUrl':{'type':Sequelize[_0x0275('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0x0275('0x1')]},'refreshToken':{'type':Sequelize[_0x0275('0x1')]}}; \ No newline at end of file +var _0x702d=['sequelize','exports','STRING'];(function(_0x24c485,_0x406747){var _0x2317b6=function(_0x12b822){while(--_0x12b822){_0x24c485['push'](_0x24c485['shift']());}};_0x2317b6(++_0x406747);}(_0x702d,0x147));var _0xd702=function(_0x2e4309,_0x2b67b1){_0x2e4309=_0x2e4309-0x0;var _0x3b8e56=_0x702d[_0x2e4309];return _0x3b8e56;};'use strict';var Sequelize=require(_0xd702('0x0'));module[_0xd702('0x1')]={'name':{'type':Sequelize[_0xd702('0x2')]},'description':{'type':Sequelize[_0xd702('0x2')]},'host':{'type':Sequelize[_0xd702('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xd702('0x2')]},'clientSecret':{'type':Sequelize[_0xd702('0x2')]},'serverUrl':{'type':Sequelize[_0xd702('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xd702('0x2')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 7610e30..832cb9a 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 _0xdcab=['findOne','order','filter','nolimit','getConfigurations','addConfiguration','AccountId','getSubjects','channel','Descriptions','ZohoField','Subjects','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','/oauth/v2/token','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','serverUrl','code','refreshToken','host','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Result','Call_Start_Time','Call_Type','includes','api_name','system_mandatory','push','display_label','custom_field','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','zip-dir','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','ZohoAccount','rawAttributes','fieldName','key','model','query','intersection','attributes','length','limit','sort','where','filters','pick','type','VIRTUAL','merge','options','includeAll','include','findAll','params','keys','fields','find','catch','create','body'];(function(_0x364b32,_0x4dec35){var _0x3f3ea0=function(_0x1911a8){while(--_0x1911a8){_0x364b32['push'](_0x364b32['shift']());}};_0x3f3ea0(++_0x4dec35);}(_0xdcab,0xbb));var _0xbdca=function(_0x7edbdf,_0x47b1ae){_0x7edbdf=_0x7edbdf-0x0;var _0x1f63d5=_0xdcab[_0x7edbdf];return _0x1f63d5;};'use strict';var emlformat=require(_0xbdca('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbdca('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbdca('0x2'));var moment=require(_0xbdca('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbdca('0x4'));var path=require('path');var sox=require(_0xbdca('0x5'));var csv=require(_0xbdca('0x6'));var ejs=require(_0xbdca('0x7'));var fs=require('fs');var fs_extra=require(_0xbdca('0x8'));var _=require(_0xbdca('0x9'));var squel=require('squel');var crypto=require(_0xbdca('0xa'));var jsforce=require(_0xbdca('0xb'));var deskjs=require(_0xbdca('0xc'));var toCsv=require(_0xbdca('0x6'));var querystring=require(_0xbdca('0xd'));var Papa=require(_0xbdca('0xe'));var Redis=require(_0xbdca('0xf'));var authService=require(_0xbdca('0x10'));var qs=require(_0xbdca('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbdca('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xbdca('0x13'));var licenseUtil=require(_0xbdca('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0xbdca('0x15'));function respondWithStatusCode(_0x5c4812,_0xcd34d8){_0xcd34d8=_0xcd34d8||0xcc;return function(_0x771daf){if(_0x771daf){return _0x5c4812[_0xbdca('0x16')](_0xcd34d8);}return _0x5c4812[_0xbdca('0x17')](_0xcd34d8)['end']();};}function respondWithResult(_0xac6283,_0x2b4d9d){_0x2b4d9d=_0x2b4d9d||0xc8;return function(_0x1b9d22){if(_0x1b9d22){return _0xac6283[_0xbdca('0x17')](_0x2b4d9d)[_0xbdca('0x18')](_0x1b9d22);}};}function respondWithFilteredResult(_0x29e838,_0x1bacd1){return function(_0x51883c){if(_0x51883c){var _0x43d68b=typeof _0x1bacd1['offset']===_0xbdca('0x19')&&typeof _0x1bacd1['limit']===_0xbdca('0x19');var _0x22ccdc=_0x51883c[_0xbdca('0x1a')];var _0x4b539b=_0x43d68b?0x0:_0x1bacd1[_0xbdca('0x1b')];var _0x54652c=_0x43d68b?_0x51883c[_0xbdca('0x1a')]:_0x1bacd1[_0xbdca('0x1b')]+_0x1bacd1['limit'];var _0x260e8f;if(_0x54652c>=_0x22ccdc){_0x54652c=_0x22ccdc;_0x260e8f=0xc8;}else{_0x260e8f=0xce;}_0x29e838[_0xbdca('0x17')](_0x260e8f);return _0x29e838['set'](_0xbdca('0x1c'),_0x4b539b+'-'+_0x54652c+'/'+_0x22ccdc)[_0xbdca('0x18')](_0x51883c);}return null;};}function patchUpdates(_0x6a8742){return function(_0xd48e80){try{jsonpatch[_0xbdca('0x1d')](_0xd48e80,_0x6a8742,!![]);}catch(_0x2371ff){return BPromise[_0xbdca('0x1e')](_0x2371ff);}return _0xd48e80[_0xbdca('0x1f')]();};}function saveUpdates(_0x406409,_0x45d99a){return function(_0x51a587){if(_0x51a587){return _0x51a587[_0xbdca('0x20')](_0x406409)[_0xbdca('0x21')](function(_0x27626e){return _0x27626e;});}return null;};}function removeEntity(_0x527b84,_0x329221){return function(_0x2940dd){if(_0x2940dd){return _0x2940dd[_0xbdca('0x22')]()[_0xbdca('0x21')](function(){_0x527b84[_0xbdca('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xeb8965,_0x5953b8){return function(_0x30f877){if(!_0x30f877){_0xeb8965[_0xbdca('0x16')](0x194);}return _0x30f877;};}function handleError(_0x5e5448,_0x33cbed){_0x33cbed=_0x33cbed||0x1f4;return function(_0x4fddd5){logger[_0xbdca('0x23')](_0x4fddd5['stack']);if(_0x4fddd5[_0xbdca('0x24')]){delete _0x4fddd5[_0xbdca('0x24')];}_0x5e5448[_0xbdca('0x17')](_0x33cbed)['send'](_0x4fddd5);};}exports[_0xbdca('0x25')]=function(_0x289679,_0x44e892){var _0x56ac04={},_0x2f62ee={},_0x163d33={'count':0x0,'rows':[]};var _0xec2787=_[_0xbdca('0x26')](db[_0xbdca('0x27')][_0xbdca('0x28')],function(_0x135ac4){return{'name':_0x135ac4[_0xbdca('0x29')],'type':_0x135ac4['type'][_0xbdca('0x2a')]};});_0x2f62ee[_0xbdca('0x2b')]=_[_0xbdca('0x26')](_0xec2787,_0xbdca('0x24'));_0x2f62ee['query']=_['keys'](_0x289679[_0xbdca('0x2c')]);_0x2f62ee['filters']=_[_0xbdca('0x2d')](_0x2f62ee[_0xbdca('0x2b')],_0x2f62ee['query']);_0x56ac04[_0xbdca('0x2e')]=_[_0xbdca('0x2d')](_0x2f62ee[_0xbdca('0x2b')],qs['fields'](_0x289679[_0xbdca('0x2c')]['fields']));_0x56ac04[_0xbdca('0x2e')]=_0x56ac04[_0xbdca('0x2e')][_0xbdca('0x2f')]?_0x56ac04['attributes']:_0x2f62ee[_0xbdca('0x2b')];if(!_0x289679['query']['hasOwnProperty']('nolimit')){_0x56ac04[_0xbdca('0x30')]=qs[_0xbdca('0x30')](_0x289679[_0xbdca('0x2c')][_0xbdca('0x30')]);_0x56ac04[_0xbdca('0x1b')]=qs[_0xbdca('0x1b')](_0x289679[_0xbdca('0x2c')][_0xbdca('0x1b')]);}_0x56ac04['order']=qs[_0xbdca('0x31')](_0x289679[_0xbdca('0x2c')][_0xbdca('0x31')]);_0x56ac04[_0xbdca('0x32')]=qs[_0xbdca('0x33')](_[_0xbdca('0x34')](_0x289679[_0xbdca('0x2c')],_0x2f62ee['filters']),_0xec2787);if(_0x289679['query']['filter']){_0x56ac04[_0xbdca('0x32')]=_['merge'](_0x56ac04[_0xbdca('0x32')],{'$or':_['map'](_0xec2787,function(_0x2d2b25){if(_0x2d2b25[_0xbdca('0x35')]!==_0xbdca('0x36')){var _0x4ed424={};_0x4ed424[_0x2d2b25[_0xbdca('0x24')]]={'$like':'%'+_0x289679[_0xbdca('0x2c')]['filter']+'%'};return _0x4ed424;}})});}_0x56ac04=_[_0xbdca('0x37')]({},_0x56ac04,_0x289679[_0xbdca('0x38')]);var _0x587ddb={'where':_0x56ac04[_0xbdca('0x32')]};return db['ZohoAccount'][_0xbdca('0x1a')](_0x587ddb)[_0xbdca('0x21')](function(_0x41db4c){_0x163d33[_0xbdca('0x1a')]=_0x41db4c;if(_0x289679['query'][_0xbdca('0x39')]){_0x56ac04[_0xbdca('0x3a')]=[{'all':!![]}];}return db['ZohoAccount'][_0xbdca('0x3b')](_0x56ac04);})[_0xbdca('0x21')](function(_0x2d2ea6){_0x163d33['rows']=_0x2d2ea6;return _0x163d33;})[_0xbdca('0x21')](respondWithFilteredResult(_0x44e892,_0x56ac04))['catch'](handleError(_0x44e892,null));};exports['show']=function(_0x468557,_0x474c17){var _0x347b30={'raw':![],'where':{'id':_0x468557[_0xbdca('0x3c')]['id']}},_0x426268={};_0x426268[_0xbdca('0x2b')]=_[_0xbdca('0x3d')](db[_0xbdca('0x27')][_0xbdca('0x28')]);_0x426268[_0xbdca('0x2c')]=_[_0xbdca('0x3d')](_0x468557['query']);_0x426268[_0xbdca('0x33')]=_[_0xbdca('0x2d')](_0x426268[_0xbdca('0x2b')],_0x426268[_0xbdca('0x2c')]);_0x347b30[_0xbdca('0x2e')]=_['intersection'](_0x426268[_0xbdca('0x2b')],qs[_0xbdca('0x3e')](_0x468557[_0xbdca('0x2c')][_0xbdca('0x3e')]));_0x347b30[_0xbdca('0x2e')]=_0x347b30[_0xbdca('0x2e')]['length']?_0x347b30[_0xbdca('0x2e')]:_0x426268[_0xbdca('0x2b')];if(_0x468557[_0xbdca('0x2c')][_0xbdca('0x39')]){_0x347b30[_0xbdca('0x3a')]=[{'all':!![]}];}_0x347b30=_[_0xbdca('0x37')]({},_0x347b30,_0x468557['options']);return db['ZohoAccount'][_0xbdca('0x3f')](_0x347b30)[_0xbdca('0x21')](handleEntityNotFound(_0x474c17,null))[_0xbdca('0x21')](respondWithResult(_0x474c17,null))[_0xbdca('0x40')](handleError(_0x474c17,null));};exports['create']=function(_0x1b967f,_0x2186e7){return db[_0xbdca('0x27')][_0xbdca('0x41')](_0x1b967f[_0xbdca('0x42')],{})[_0xbdca('0x21')](respondWithResult(_0x2186e7,0xc9))['catch'](handleError(_0x2186e7,null));};exports['update']=function(_0x18e28d,_0xbba57b){if(_0x18e28d['body']['id']){delete _0x18e28d['body']['id'];}return db[_0xbdca('0x27')]['find']({'where':{'id':_0x18e28d[_0xbdca('0x3c')]['id']}})[_0xbdca('0x21')](handleEntityNotFound(_0xbba57b,null))['then'](saveUpdates(_0x18e28d['body'],null))[_0xbdca('0x21')](respondWithResult(_0xbba57b,null))['catch'](handleError(_0xbba57b,null));};exports[_0xbdca('0x22')]=function(_0x4f4dbf,_0x29c1f8){return db[_0xbdca('0x27')][_0xbdca('0x3f')]({'where':{'id':_0x4f4dbf['params']['id']}})[_0xbdca('0x21')](handleEntityNotFound(_0x29c1f8,null))[_0xbdca('0x21')](removeEntity(_0x29c1f8,null))[_0xbdca('0x40')](handleError(_0x29c1f8,null));};exports['getConfigurations']=function(_0x35789f,_0x99af5f,_0x113bfb){var _0x1f8e51={};var _0x4c7a78={};var _0x523b21;var _0x591ec3;return db[_0xbdca('0x27')][_0xbdca('0x43')]({'where':{'id':_0x35789f['params']['id']}})[_0xbdca('0x21')](handleEntityNotFound(_0x99af5f,null))[_0xbdca('0x21')](function(_0x151c85){if(_0x151c85){_0x523b21=_0x151c85;_0x4c7a78[_0xbdca('0x2b')]=_[_0xbdca('0x3d')](db['ZohoConfiguration'][_0xbdca('0x28')]);_0x4c7a78['query']=_[_0xbdca('0x3d')](_0x35789f[_0xbdca('0x2c')]);_0x4c7a78[_0xbdca('0x33')]=_[_0xbdca('0x2d')](_0x4c7a78[_0xbdca('0x2b')],_0x4c7a78[_0xbdca('0x2c')]);_0x1f8e51['attributes']=_[_0xbdca('0x2d')](_0x4c7a78[_0xbdca('0x2b')],qs['fields'](_0x35789f[_0xbdca('0x2c')][_0xbdca('0x3e')]));_0x1f8e51['attributes']=_0x1f8e51[_0xbdca('0x2e')][_0xbdca('0x2f')]?_0x1f8e51[_0xbdca('0x2e')]:_0x4c7a78[_0xbdca('0x2b')];_0x1f8e51[_0xbdca('0x44')]=qs['sort'](_0x35789f[_0xbdca('0x2c')][_0xbdca('0x31')]);_0x1f8e51['where']=qs[_0xbdca('0x33')](_[_0xbdca('0x34')](_0x35789f['query'],_0x4c7a78[_0xbdca('0x33')]));if(_0x35789f[_0xbdca('0x2c')][_0xbdca('0x45')]){_0x1f8e51[_0xbdca('0x32')]=_['merge'](_0x1f8e51['where'],{'$or':_[_0xbdca('0x26')](_0x1f8e51[_0xbdca('0x2e')],function(_0xf60925){var _0x8ebbe5={};_0x8ebbe5[_0xf60925]={'$like':'%'+_0x35789f[_0xbdca('0x2c')][_0xbdca('0x45')]+'%'};return _0x8ebbe5;})});}_0x1f8e51=_[_0xbdca('0x37')]({},_0x1f8e51,_0x35789f[_0xbdca('0x38')]);return _0x523b21['getConfigurations'](_0x1f8e51);}})['then'](function(_0x22a87d){if(_0x22a87d){_0x591ec3=_0x22a87d[_0xbdca('0x2f')];if(!_0x35789f[_0xbdca('0x2c')]['hasOwnProperty'](_0xbdca('0x46'))){_0x1f8e51[_0xbdca('0x30')]=qs[_0xbdca('0x30')](_0x35789f[_0xbdca('0x2c')]['limit']);_0x1f8e51[_0xbdca('0x1b')]=qs[_0xbdca('0x1b')](_0x35789f['query'][_0xbdca('0x1b')]);}return _0x523b21[_0xbdca('0x47')](_0x1f8e51);}})['then'](function(_0x52759f){if(_0x52759f){return _0x52759f?{'count':_0x591ec3,'rows':_0x52759f}:null;}})[_0xbdca('0x21')](respondWithResult(_0x99af5f,null))['catch'](handleError(_0x99af5f,null));};exports[_0xbdca('0x48')]=function(_0x993500,_0x3c8806,_0x2f9bd4){if(_0x993500[_0xbdca('0x42')]['id']){delete _0x993500[_0xbdca('0x42')]['id'];}return db['ZohoAccount'][_0xbdca('0x43')]({'where':{'id':_0x993500[_0xbdca('0x3c')]['id']}})[_0xbdca('0x21')](handleEntityNotFound(_0x3c8806,null))[_0xbdca('0x21')](function(_0x2efb00){if(_0x2efb00){_0x993500[_0xbdca('0x42')][_0xbdca('0x49')]=_0x2efb00['id'];_0x993500[_0xbdca('0x42')]['Subjects']=integrations[_0xbdca('0x4a')](_0x993500[_0xbdca('0x42')][_0xbdca('0x4b')],_0x993500[_0xbdca('0x42')]['type']);_0x993500[_0xbdca('0x42')][_0xbdca('0x4c')]=integrations['getDescriptions'](_0x993500['body']['channel'],_0x993500[_0xbdca('0x42')]['type']);return db['ZohoConfiguration'][_0xbdca('0x41')](_0x993500[_0xbdca('0x42')],{'include':[{'model':db[_0xbdca('0x4d')],'as':_0xbdca('0x4e')},{'model':db[_0xbdca('0x4d')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x3c8806,null))[_0xbdca('0x40')](handleError(_0x3c8806,null));};function getAccessToken(_0x34fed1){return new Promise(function(_0x351fef,_0x13e4ff){var _0x219918;switch(_0x34fed1[_0xbdca('0x4f')]){case'US':_0x219918=_0xbdca('0x50');break;case'AU':_0x219918=_0xbdca('0x51');break;case'EU':_0x219918='https://accounts.zoho.eu';break;case'IN':_0x219918=_0xbdca('0x52');break;case'CN':_0x219918='https://accounts.zoho.com.cn';break;default:_0x219918=_0xbdca('0x53');break;}var _0xbfe6e1={'method':'POST','uri':_0x219918+_0xbdca('0x54'),'qs':{'refresh_token':_0x34fed1['refreshToken'],'client_id':_0x34fed1['clientId'],'client_secret':_0x34fed1[_0xbdca('0x55')],'grant_type':_0xbdca('0x56')},'json':!![]};return rp(_0xbfe6e1)['then'](function(_0x2920a5){if(_0x2920a5[_0xbdca('0x57')]){_0x351fef(_0x2920a5[_0xbdca('0x57')]);}else{_0x13e4ff(_0xbdca('0x58'));}})[_0xbdca('0x40')](function(_0x5dca9e){_0x13e4ff(_0x5dca9e);});});}exports[_0xbdca('0x59')]=function(_0x23ed18,_0x37431b,_0x376801){var _0x4a169d,_0x9ee5ed,_0x4d687a,_0x15440c,_0x207b36;return db[_0xbdca('0x27')][_0xbdca('0x43')]({'where':{'id':_0x23ed18[_0xbdca('0x3c')]['id']},'attributes':['id','host',_0xbdca('0x4f'),'clientId','clientSecret',_0xbdca('0x5a'),_0xbdca('0x5b'),_0xbdca('0x5c')]})[_0xbdca('0x21')](handleEntityNotFound(_0x37431b,null))[_0xbdca('0x21')](function(_0x55f53a){_0x207b36=_0x55f53a;_0x4a169d=_0x207b36[_0xbdca('0x5d')];_0x9ee5ed=_0x4a169d==='zoho.eu'?'eu':_0xbdca('0x5e');_0x4d687a=_0x207b36[_0xbdca('0x5a')];var _0x33f481=_0x4d687a[_0xbdca('0x5f')](-0x1);if(_0x33f481==='/'||_0x33f481==='\x5c'||_0x33f481===':'){_0x4d687a=_0x4d687a[_0xbdca('0x60')](0x0,_0x4d687a[_0xbdca('0x61')](_0x33f481));}if(!_0x207b36[_0xbdca('0x5c')]){throw new Error(_0xbdca('0x62'));}return getAccessToken(_0x207b36);})[_0xbdca('0x21')](function(_0x5cf4d8){if(_0x5cf4d8){return rp({'method':_0xbdca('0x63'),'uri':util[_0xbdca('0x64')](_0xbdca('0x65'),_0x9ee5ed),'qs':{'module':_0xbdca('0x66')},'headers':{'Authorization':_0xbdca('0x67')+_0x5cf4d8},'json':!![]});}})[_0xbdca('0x21')](function(_0x41bd43){if(_0x41bd43){if(_0x41bd43[_0xbdca('0x68')]&&_0x41bd43[_0xbdca('0x68')][_0xbdca('0x23')]){throw new Error(_0x41bd43[_0xbdca('0x68')][_0xbdca('0x23')][_0xbdca('0x69')]);}var _0x53d9cc=[];var _0x432dc0=[];var _0x562805=[_0xbdca('0x6a'),_0xbdca('0x6b'),_0xbdca('0x6c'),_0xbdca('0x6d'),'Call_Duration',_0xbdca('0x6e'),_0xbdca('0x6f'),_0xbdca('0x70')];_0x432dc0=_['remove'](_0x41bd43[_0xbdca('0x3e')],function(_0x322833){return _0x562805[_0xbdca('0x71')](_0x322833[_0xbdca('0x72')]);});for(var _0x30226a=0x0;_0x30226a<_0x432dc0['length'];_0x30226a++){if(_0x432dc0[_0x30226a][_0xbdca('0x73')]===![]){_0x53d9cc[_0xbdca('0x74')]({'id':_0x432dc0[_0x30226a]['id'],'name':_0x432dc0[_0x30226a][_0xbdca('0x75')],'custom':_0x432dc0[_0x30226a][_0xbdca('0x76')],'options':_0x432dc0[_0x30226a]['data_type']===_0xbdca('0x77')&&_0x432dc0[_0x30226a][_0xbdca('0x78')][_0xbdca('0x2f')]>-0x1?_[_0xbdca('0x26')](_0x432dc0[_0x30226a]['pick_list_values'],function(_0x357893){return{'name':_0x357893,'value':_0x357893};}):[]});}}return{'count':_0x53d9cc[_0xbdca('0x2f')],'rows':_0x53d9cc};}else{return{'count':0x0,'rows':[]};}})[_0xbdca('0x21')](respondWithResult(_0x37431b,null))[_0xbdca('0x40')](function(_0x8ac47b){var _0x238c0d=_0x23ed18[_0xbdca('0x2c')][_0xbdca('0x79')]?0x1f4:_0x8ac47b[_0xbdca('0x7a')]||0x1f4;logger[_0xbdca('0x23')](_0xbdca('0x7b'),_0xbdca('0x59'),_0x238c0d,JSON[_0xbdca('0x7c')](_0x8ac47b));delete _0x8ac47b[_0xbdca('0x24')];if(_0x238c0d===0x191){_0x238c0d=0x190;}_0x37431b['status'](_0x238c0d)[_0xbdca('0x7d')](_0x23ed18[_0xbdca('0x2c')]['test']?{'message':_0xbdca('0x7e'),'statusCode':_0x8ac47b[_0xbdca('0x7a')]}:_0x8ac47b);});}; \ No newline at end of file +var _0xe016=['pick','filter','merge','options','then','includeAll','include','findAll','rows','show','params','rawAttributes','length','find','catch','body','getConfigurations','ZohoConfiguration','order','hasOwnProperty','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','create','ZohoField','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','serverUrl','code','zoho.eu','com','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','message','Owner','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','error','index','map','ZohoAccount','fieldName','type','key','model','name','query','keys','intersection','fields','attributes','nolimit','sort','where','filters'];(function(_0xdf5462,_0x66522a){var _0x12bcb0=function(_0x467132){while(--_0x467132){_0xdf5462['push'](_0xdf5462['shift']());}};_0x12bcb0(++_0x66522a);}(_0xe016,0x1d9));var _0x6e01=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xe016[_0x36c5b0];return _0xf19333;};'use strict';var emlformat=require(_0x6e01('0x0'));var rimraf=require(_0x6e01('0x1'));var zipdir=require(_0x6e01('0x2'));var jsonpatch=require(_0x6e01('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6e01('0x4'));var util=require(_0x6e01('0x5'));var path=require(_0x6e01('0x6'));var sox=require(_0x6e01('0x7'));var csv=require(_0x6e01('0x8'));var ejs=require(_0x6e01('0x9'));var fs=require('fs');var fs_extra=require(_0x6e01('0xa'));var _=require(_0x6e01('0xb'));var squel=require(_0x6e01('0xc'));var crypto=require(_0x6e01('0xd'));var jsforce=require(_0x6e01('0xe'));var deskjs=require(_0x6e01('0xf'));var toCsv=require(_0x6e01('0x8'));var querystring=require(_0x6e01('0x10'));var Papa=require(_0x6e01('0x11'));var Redis=require(_0x6e01('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6e01('0x13'));var as=require(_0x6e01('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6e01('0x15'))(_0x6e01('0x16'));var utils=require('../../config/utils');var config=require(_0x6e01('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6e01('0x18'))['db'];var integrations=require(_0x6e01('0x19'));function respondWithStatusCode(_0x2ae405,_0x15023d){_0x15023d=_0x15023d||0xcc;return function(_0x3c42b5){if(_0x3c42b5){return _0x2ae405[_0x6e01('0x1a')](_0x15023d);}return _0x2ae405[_0x6e01('0x1b')](_0x15023d)[_0x6e01('0x1c')]();};}function respondWithResult(_0x264f1b,_0x11ee52){_0x11ee52=_0x11ee52||0xc8;return function(_0x5d819f){if(_0x5d819f){return _0x264f1b[_0x6e01('0x1b')](_0x11ee52)[_0x6e01('0x1d')](_0x5d819f);}};}function respondWithFilteredResult(_0x1e005e,_0x448f40){return function(_0x46aa64){if(_0x46aa64){var _0x5f119a=typeof _0x448f40[_0x6e01('0x1e')]===_0x6e01('0x1f')&&typeof _0x448f40['limit']===_0x6e01('0x1f');var _0x404f79=_0x46aa64[_0x6e01('0x20')];var _0xbc1a55=_0x5f119a?0x0:_0x448f40['offset'];var _0x3b6dc3=_0x5f119a?_0x46aa64['count']:_0x448f40['offset']+_0x448f40[_0x6e01('0x21')];var _0x539e51;if(_0x3b6dc3>=_0x404f79){_0x3b6dc3=_0x404f79;_0x539e51=0xc8;}else{_0x539e51=0xce;}_0x1e005e['status'](_0x539e51);return _0x1e005e[_0x6e01('0x22')](_0x6e01('0x23'),_0xbc1a55+'-'+_0x3b6dc3+'/'+_0x404f79)['json'](_0x46aa64);}return null;};}function patchUpdates(_0x5f45cb){return function(_0x553c4f){try{jsonpatch[_0x6e01('0x24')](_0x553c4f,_0x5f45cb,!![]);}catch(_0x3525c4){return BPromise[_0x6e01('0x25')](_0x3525c4);}return _0x553c4f[_0x6e01('0x26')]();};}function saveUpdates(_0x344004,_0x34ae69){return function(_0x28f6dd){if(_0x28f6dd){return _0x28f6dd[_0x6e01('0x27')](_0x344004)['then'](function(_0x37e00d){return _0x37e00d;});}return null;};}function removeEntity(_0x159d91,_0x3d1f7e){return function(_0x5be4b7){if(_0x5be4b7){return _0x5be4b7[_0x6e01('0x28')]()['then'](function(){_0x159d91['status'](0xcc)[_0x6e01('0x1c')]();});}};}function handleEntityNotFound(_0x242621,_0x550caf){return function(_0x2f2a72){if(!_0x2f2a72){_0x242621['sendStatus'](0x194);}return _0x2f2a72;};}function handleError(_0x52db75,_0x257ff7){_0x257ff7=_0x257ff7||0x1f4;return function(_0x5188cb){logger[_0x6e01('0x29')](_0x5188cb['stack']);if(_0x5188cb['name']){delete _0x5188cb['name'];}_0x52db75[_0x6e01('0x1b')](_0x257ff7)['send'](_0x5188cb);};}exports[_0x6e01('0x2a')]=function(_0xa0d1fd,_0x38b4cb){var _0x4998eb={},_0x35979e={},_0x1c5ea5={'count':0x0,'rows':[]};var _0x177ac8=_[_0x6e01('0x2b')](db[_0x6e01('0x2c')]['rawAttributes'],function(_0x297dc9){return{'name':_0x297dc9[_0x6e01('0x2d')],'type':_0x297dc9[_0x6e01('0x2e')][_0x6e01('0x2f')]};});_0x35979e[_0x6e01('0x30')]=_['map'](_0x177ac8,_0x6e01('0x31'));_0x35979e[_0x6e01('0x32')]=_[_0x6e01('0x33')](_0xa0d1fd[_0x6e01('0x32')]);_0x35979e['filters']=_[_0x6e01('0x34')](_0x35979e['model'],_0x35979e['query']);_0x4998eb['attributes']=_[_0x6e01('0x34')](_0x35979e[_0x6e01('0x30')],qs[_0x6e01('0x35')](_0xa0d1fd[_0x6e01('0x32')][_0x6e01('0x35')]));_0x4998eb[_0x6e01('0x36')]=_0x4998eb[_0x6e01('0x36')]['length']?_0x4998eb['attributes']:_0x35979e['model'];if(!_0xa0d1fd[_0x6e01('0x32')]['hasOwnProperty'](_0x6e01('0x37'))){_0x4998eb['limit']=qs[_0x6e01('0x21')](_0xa0d1fd[_0x6e01('0x32')]['limit']);_0x4998eb[_0x6e01('0x1e')]=qs[_0x6e01('0x1e')](_0xa0d1fd[_0x6e01('0x32')][_0x6e01('0x1e')]);}_0x4998eb['order']=qs['sort'](_0xa0d1fd[_0x6e01('0x32')][_0x6e01('0x38')]);_0x4998eb[_0x6e01('0x39')]=qs[_0x6e01('0x3a')](_[_0x6e01('0x3b')](_0xa0d1fd[_0x6e01('0x32')],_0x35979e[_0x6e01('0x3a')]),_0x177ac8);if(_0xa0d1fd[_0x6e01('0x32')][_0x6e01('0x3c')]){_0x4998eb['where']=_['merge'](_0x4998eb[_0x6e01('0x39')],{'$or':_['map'](_0x177ac8,function(_0x1ae81a){if(_0x1ae81a[_0x6e01('0x2e')]!=='VIRTUAL'){var _0x1a1144={};_0x1a1144[_0x1ae81a[_0x6e01('0x31')]]={'$like':'%'+_0xa0d1fd[_0x6e01('0x32')][_0x6e01('0x3c')]+'%'};return _0x1a1144;}})});}_0x4998eb=_[_0x6e01('0x3d')]({},_0x4998eb,_0xa0d1fd[_0x6e01('0x3e')]);var _0x492edd={'where':_0x4998eb[_0x6e01('0x39')]};return db[_0x6e01('0x2c')][_0x6e01('0x20')](_0x492edd)[_0x6e01('0x3f')](function(_0x1a15cd){_0x1c5ea5[_0x6e01('0x20')]=_0x1a15cd;if(_0xa0d1fd[_0x6e01('0x32')][_0x6e01('0x40')]){_0x4998eb[_0x6e01('0x41')]=[{'all':!![]}];}return db[_0x6e01('0x2c')][_0x6e01('0x42')](_0x4998eb);})[_0x6e01('0x3f')](function(_0x30a8c9){_0x1c5ea5[_0x6e01('0x43')]=_0x30a8c9;return _0x1c5ea5;})[_0x6e01('0x3f')](respondWithFilteredResult(_0x38b4cb,_0x4998eb))['catch'](handleError(_0x38b4cb,null));};exports[_0x6e01('0x44')]=function(_0x4b0d3a,_0x313281){var _0x17f21f={'raw':![],'where':{'id':_0x4b0d3a[_0x6e01('0x45')]['id']}},_0x46cddf={};_0x46cddf[_0x6e01('0x30')]=_[_0x6e01('0x33')](db[_0x6e01('0x2c')][_0x6e01('0x46')]);_0x46cddf[_0x6e01('0x32')]=_[_0x6e01('0x33')](_0x4b0d3a[_0x6e01('0x32')]);_0x46cddf[_0x6e01('0x3a')]=_[_0x6e01('0x34')](_0x46cddf['model'],_0x46cddf[_0x6e01('0x32')]);_0x17f21f['attributes']=_['intersection'](_0x46cddf[_0x6e01('0x30')],qs[_0x6e01('0x35')](_0x4b0d3a['query'][_0x6e01('0x35')]));_0x17f21f['attributes']=_0x17f21f[_0x6e01('0x36')][_0x6e01('0x47')]?_0x17f21f['attributes']:_0x46cddf[_0x6e01('0x30')];if(_0x4b0d3a[_0x6e01('0x32')][_0x6e01('0x40')]){_0x17f21f['include']=[{'all':!![]}];}_0x17f21f=_[_0x6e01('0x3d')]({},_0x17f21f,_0x4b0d3a[_0x6e01('0x3e')]);return db[_0x6e01('0x2c')][_0x6e01('0x48')](_0x17f21f)[_0x6e01('0x3f')](handleEntityNotFound(_0x313281,null))['then'](respondWithResult(_0x313281,null))[_0x6e01('0x49')](handleError(_0x313281,null));};exports['create']=function(_0x3a8314,_0x1f6ff1){return db[_0x6e01('0x2c')]['create'](_0x3a8314[_0x6e01('0x4a')],{})[_0x6e01('0x3f')](respondWithResult(_0x1f6ff1,0xc9))[_0x6e01('0x49')](handleError(_0x1f6ff1,null));};exports['update']=function(_0x26f92f,_0x1deac0){if(_0x26f92f['body']['id']){delete _0x26f92f[_0x6e01('0x4a')]['id'];}return db[_0x6e01('0x2c')][_0x6e01('0x48')]({'where':{'id':_0x26f92f['params']['id']}})['then'](handleEntityNotFound(_0x1deac0,null))[_0x6e01('0x3f')](saveUpdates(_0x26f92f[_0x6e01('0x4a')],null))[_0x6e01('0x3f')](respondWithResult(_0x1deac0,null))[_0x6e01('0x49')](handleError(_0x1deac0,null));};exports[_0x6e01('0x28')]=function(_0x2c0d41,_0x1f73ee){return db['ZohoAccount']['find']({'where':{'id':_0x2c0d41[_0x6e01('0x45')]['id']}})[_0x6e01('0x3f')](handleEntityNotFound(_0x1f73ee,null))[_0x6e01('0x3f')](removeEntity(_0x1f73ee,null))[_0x6e01('0x49')](handleError(_0x1f73ee,null));};exports[_0x6e01('0x4b')]=function(_0x2ddebd,_0x2fda79,_0x10a6fb){var _0x2f3243={};var _0x49dadb={};var _0x509f60;var _0x257b91;return db[_0x6e01('0x2c')]['findOne']({'where':{'id':_0x2ddebd[_0x6e01('0x45')]['id']}})[_0x6e01('0x3f')](handleEntityNotFound(_0x2fda79,null))[_0x6e01('0x3f')](function(_0x11e061){if(_0x11e061){_0x509f60=_0x11e061;_0x49dadb[_0x6e01('0x30')]=_[_0x6e01('0x33')](db[_0x6e01('0x4c')][_0x6e01('0x46')]);_0x49dadb[_0x6e01('0x32')]=_[_0x6e01('0x33')](_0x2ddebd[_0x6e01('0x32')]);_0x49dadb[_0x6e01('0x3a')]=_['intersection'](_0x49dadb[_0x6e01('0x30')],_0x49dadb[_0x6e01('0x32')]);_0x2f3243['attributes']=_[_0x6e01('0x34')](_0x49dadb[_0x6e01('0x30')],qs[_0x6e01('0x35')](_0x2ddebd[_0x6e01('0x32')]['fields']));_0x2f3243['attributes']=_0x2f3243['attributes'][_0x6e01('0x47')]?_0x2f3243[_0x6e01('0x36')]:_0x49dadb[_0x6e01('0x30')];_0x2f3243[_0x6e01('0x4d')]=qs[_0x6e01('0x38')](_0x2ddebd[_0x6e01('0x32')][_0x6e01('0x38')]);_0x2f3243[_0x6e01('0x39')]=qs[_0x6e01('0x3a')](_[_0x6e01('0x3b')](_0x2ddebd['query'],_0x49dadb['filters']));if(_0x2ddebd[_0x6e01('0x32')][_0x6e01('0x3c')]){_0x2f3243[_0x6e01('0x39')]=_[_0x6e01('0x3d')](_0x2f3243[_0x6e01('0x39')],{'$or':_[_0x6e01('0x2b')](_0x2f3243['attributes'],function(_0x4f5e1){var _0x2c60d0={};_0x2c60d0[_0x4f5e1]={'$like':'%'+_0x2ddebd['query'][_0x6e01('0x3c')]+'%'};return _0x2c60d0;})});}_0x2f3243=_[_0x6e01('0x3d')]({},_0x2f3243,_0x2ddebd[_0x6e01('0x3e')]);return _0x509f60['getConfigurations'](_0x2f3243);}})[_0x6e01('0x3f')](function(_0x30424c){if(_0x30424c){_0x257b91=_0x30424c[_0x6e01('0x47')];if(!_0x2ddebd['query'][_0x6e01('0x4e')](_0x6e01('0x37'))){_0x2f3243[_0x6e01('0x21')]=qs[_0x6e01('0x21')](_0x2ddebd['query'][_0x6e01('0x21')]);_0x2f3243['offset']=qs[_0x6e01('0x1e')](_0x2ddebd[_0x6e01('0x32')][_0x6e01('0x1e')]);}return _0x509f60[_0x6e01('0x4b')](_0x2f3243);}})[_0x6e01('0x3f')](function(_0x159d4f){if(_0x159d4f){return _0x159d4f?{'count':_0x257b91,'rows':_0x159d4f}:null;}})[_0x6e01('0x3f')](respondWithResult(_0x2fda79,null))['catch'](handleError(_0x2fda79,null));};exports['addConfiguration']=function(_0x5dba36,_0x15c92d,_0x1fdf96){if(_0x5dba36[_0x6e01('0x4a')]['id']){delete _0x5dba36[_0x6e01('0x4a')]['id'];}return db[_0x6e01('0x2c')][_0x6e01('0x4f')]({'where':{'id':_0x5dba36[_0x6e01('0x45')]['id']}})[_0x6e01('0x3f')](handleEntityNotFound(_0x15c92d,null))['then'](function(_0x7abf0a){if(_0x7abf0a){_0x5dba36[_0x6e01('0x4a')][_0x6e01('0x50')]=_0x7abf0a['id'];_0x5dba36[_0x6e01('0x4a')][_0x6e01('0x51')]=integrations[_0x6e01('0x52')](_0x5dba36[_0x6e01('0x4a')][_0x6e01('0x53')],_0x5dba36[_0x6e01('0x4a')]['type']);_0x5dba36['body'][_0x6e01('0x54')]=integrations[_0x6e01('0x55')](_0x5dba36[_0x6e01('0x4a')][_0x6e01('0x53')],_0x5dba36['body'][_0x6e01('0x2e')]);return db[_0x6e01('0x4c')][_0x6e01('0x56')](_0x5dba36[_0x6e01('0x4a')],{'include':[{'model':db[_0x6e01('0x57')],'as':_0x6e01('0x51')},{'model':db[_0x6e01('0x57')],'as':_0x6e01('0x54')}]});}return null;})[_0x6e01('0x3f')](respondWithResult(_0x15c92d,null))['catch'](handleError(_0x15c92d,null));};function getAccessToken(_0x5ad55d){return new Promise(function(_0x56f176,_0x328fcf){var _0xe5cc8c;switch(_0x5ad55d['zone']){case'US':_0xe5cc8c=_0x6e01('0x58');break;case'AU':_0xe5cc8c=_0x6e01('0x59');break;case'EU':_0xe5cc8c=_0x6e01('0x5a');break;case'IN':_0xe5cc8c=_0x6e01('0x5b');break;case'CN':_0xe5cc8c='https://accounts.zoho.com.cn';break;default:_0xe5cc8c=_0x6e01('0x5a');break;}var _0x45e95e={'method':'POST','uri':_0xe5cc8c+'/oauth/v2/token','qs':{'refresh_token':_0x5ad55d[_0x6e01('0x5c')],'client_id':_0x5ad55d[_0x6e01('0x5d')],'client_secret':_0x5ad55d[_0x6e01('0x5e')],'grant_type':_0x6e01('0x5f')},'json':!![]};return rp(_0x45e95e)[_0x6e01('0x3f')](function(_0x2929c0){if(_0x2929c0['access_token']){_0x56f176(_0x2929c0[_0x6e01('0x60')]);}else{_0x328fcf(_0x6e01('0x61'));}})[_0x6e01('0x49')](function(_0x315102){_0x328fcf(_0x315102);});});}exports['getFields']=function(_0x2e66de,_0x231141,_0x3c705d){var _0x3802d9,_0x3ec473,_0x1506c6,_0x3a425d,_0x2da6e1;return db['ZohoAccount'][_0x6e01('0x4f')]({'where':{'id':_0x2e66de[_0x6e01('0x45')]['id']},'attributes':['id',_0x6e01('0x62'),'zone',_0x6e01('0x5d'),_0x6e01('0x5e'),_0x6e01('0x63'),_0x6e01('0x64'),_0x6e01('0x5c')]})[_0x6e01('0x3f')](handleEntityNotFound(_0x231141,null))[_0x6e01('0x3f')](function(_0x1555ef){_0x2da6e1=_0x1555ef;_0x3802d9=_0x2da6e1[_0x6e01('0x62')];_0x3ec473=_0x3802d9===_0x6e01('0x65')?'eu':_0x6e01('0x66');_0x1506c6=_0x2da6e1['serverUrl'];var _0xe269d2=_0x1506c6['slice'](-0x1);if(_0xe269d2==='/'||_0xe269d2==='\x5c'||_0xe269d2===':'){_0x1506c6=_0x1506c6[_0x6e01('0x67')](0x0,_0x1506c6[_0x6e01('0x68')](_0xe269d2));}if(!_0x2da6e1['refreshToken']){throw new Error(_0x6e01('0x69'));}return getAccessToken(_0x2da6e1);})[_0x6e01('0x3f')](function(_0x1bd1b5){if(_0x1bd1b5){return rp({'method':'GET','uri':util[_0x6e01('0x6a')](_0x6e01('0x6b'),_0x3ec473),'qs':{'module':'Calls'},'headers':{'Authorization':_0x6e01('0x6c')+_0x1bd1b5},'json':!![]});}})[_0x6e01('0x3f')](function(_0x415f3e){if(_0x415f3e){if(_0x415f3e[_0x6e01('0x6d')]&&_0x415f3e[_0x6e01('0x6d')][_0x6e01('0x29')]){throw new Error(_0x415f3e[_0x6e01('0x6d')]['error'][_0x6e01('0x6e')]);}var _0x357c14=[];var _0x52b3e7=[];var _0x28fe33=[_0x6e01('0x6f'),'Subject','Description',_0x6e01('0x70'),_0x6e01('0x71'),_0x6e01('0x72'),_0x6e01('0x73'),_0x6e01('0x74')];_0x52b3e7=_[_0x6e01('0x75')](_0x415f3e[_0x6e01('0x35')],function(_0x3efe2d){return _0x28fe33[_0x6e01('0x76')](_0x3efe2d[_0x6e01('0x77')]);});for(var _0x3222c5=0x0;_0x3222c5<_0x52b3e7[_0x6e01('0x47')];_0x3222c5++){if(_0x52b3e7[_0x3222c5][_0x6e01('0x78')]===![]){_0x357c14[_0x6e01('0x79')]({'id':_0x52b3e7[_0x3222c5]['id'],'name':_0x52b3e7[_0x3222c5][_0x6e01('0x7a')],'custom':_0x52b3e7[_0x3222c5][_0x6e01('0x7b')],'options':_0x52b3e7[_0x3222c5][_0x6e01('0x7c')]===_0x6e01('0x7d')&&_0x52b3e7[_0x3222c5]['pick_list_values'][_0x6e01('0x47')]>-0x1?_[_0x6e01('0x2b')](_0x52b3e7[_0x3222c5][_0x6e01('0x7e')],function(_0x5a41fb){return{'name':_0x5a41fb,'value':_0x5a41fb};}):[]});}}return{'count':_0x357c14['length'],'rows':_0x357c14};}else{return{'count':0x0,'rows':[]};}})[_0x6e01('0x3f')](respondWithResult(_0x231141,null))['catch'](function(_0x355f31){var _0x5d0db6=_0x2e66de[_0x6e01('0x32')][_0x6e01('0x7f')]?0x1f4:_0x355f31['statusCode']||0x1f4;logger[_0x6e01('0x29')](_0x6e01('0x80'),_0x6e01('0x81'),_0x5d0db6,JSON[_0x6e01('0x82')](_0x355f31));delete _0x355f31[_0x6e01('0x31')];if(_0x5d0db6===0x191){_0x5d0db6=0x190;}_0x231141['status'](_0x5d0db6)[_0x6e01('0x83')](_0x2e66de[_0x6e01('0x32')]['test']?{'message':_0x6e01('0x84'),'statusCode':_0x355f31['statusCode']}:_0x355f31);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 70df66c..396c32e 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 _0x4cad=['https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','catch','error','host','https://accounts.zoho.com','parse','lodash','util','../../config/logger','api','bluebird','request-promise','./intZohoAccount.attributes','define','ZohoAccount','changed','zone','serverUrl','clientId','clientSecret','code','slice','substring','lastIndexOf'];(function(_0x45cf48,_0x5508dd){var _0x1f400b=function(_0x1ce164){while(--_0x1ce164){_0x45cf48['push'](_0x45cf48['shift']());}};_0x1f400b(++_0x5508dd);}(_0x4cad,0x1f4));var _0xd4ca=function(_0x4dfa3d,_0x3d7a54){_0x4dfa3d=_0x4dfa3d-0x0;var _0x3dd0a7=_0x4cad[_0x4dfa3d];return _0x3dd0a7;};'use strict';var _=require(_0xd4ca('0x0'));var util=require(_0xd4ca('0x1'));var logger=require(_0xd4ca('0x2'))(_0xd4ca('0x3'));var moment=require('moment');var BPromise=require(_0xd4ca('0x4'));var rp=require(_0xd4ca('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd4ca('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0xd7c26e,_0x474920){return _0xd7c26e[_0xd4ca('0x7')](_0xd4ca('0x8'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x383f02,_0x34f4e6,_0x39143c){if(_0x383f02[_0xd4ca('0x9')](_0xd4ca('0xa'))||_0x383f02['changed'](_0xd4ca('0xb'))||_0x383f02[_0xd4ca('0x9')](_0xd4ca('0xc'))||_0x383f02[_0xd4ca('0x9')](_0xd4ca('0xd'))||_0x383f02[_0xd4ca('0x9')](_0xd4ca('0xe'))||_0x383f02[_0xd4ca('0x9')]('host')){var _0x5868e9,_0x2b63da;_0x5868e9=_0x383f02[_0xd4ca('0xb')];var _0x5bf3ce=_0x5868e9[_0xd4ca('0xf')](-0x1);if(_0x5bf3ce==='/'||_0x5bf3ce==='\x5c'||_0x5bf3ce===':'){_0x5868e9=_0x5868e9[_0xd4ca('0x10')](0x0,_0x5868e9[_0xd4ca('0x11')](_0x5bf3ce));}switch(_0x383f02[_0xd4ca('0xa')]){case'US':_0x2b63da='https://accounts.zoho.com';break;case'AU':_0x2b63da=_0xd4ca('0x12');break;case'IN':_0x2b63da=_0xd4ca('0x13');break;case'CN':_0x2b63da=_0xd4ca('0x14');break;default:_0x2b63da=_0xd4ca('0x15');break;}var _0x4f9b0f={'method':_0xd4ca('0x16'),'uri':_0x2b63da+_0xd4ca('0x17'),'form':{'grant_type':_0xd4ca('0x18'),'client_id':_0x383f02[_0xd4ca('0xc')],'client_secret':_0x383f02[_0xd4ca('0xd')],'redirect_uri':_0x383f02[_0xd4ca('0xb')],'code':_0x383f02[_0xd4ca('0xe')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x4f9b0f)['then'](function(_0x46ec67){var _0x4ea014=JSON['parse'](_0x46ec67);if(_0x4ea014['refresh_token']){_0x383f02['refreshToken']=_0x4ea014[_0xd4ca('0x19')];logger[_0xd4ca('0x1a')](util[_0xd4ca('0x1b')](_0xd4ca('0x1c'),_0x383f02['name'],_0x383f02['id']));}else{logger['error'](util[_0xd4ca('0x1b')](_0xd4ca('0x1d'),_0x383f02[_0xd4ca('0x1e')],_0x383f02['id']),util[_0xd4ca('0x1f')](_0x4ea014,{'showHidden':![],'depth':null}));}return _0x39143c(null,_0x34f4e6);})[_0xd4ca('0x20')](function(_0x23c1f3){logger[_0xd4ca('0x21')](util[_0xd4ca('0x1b')](_0xd4ca('0x1d'),_0x383f02[_0xd4ca('0x1e')],_0x383f02['id']),util[_0xd4ca('0x1f')](parsedResult,{'showHidden':![],'depth':null}));return _0x39143c(_0x23c1f3);});}else{return _0x39143c(null,_0x34f4e6);}},'beforeUpdate':function(_0x29da29,_0x4688c7,_0x3d5a00){if(_0x29da29[_0xd4ca('0x9')](_0xd4ca('0xa'))||_0x29da29[_0xd4ca('0x9')](_0xd4ca('0xb'))||_0x29da29[_0xd4ca('0x9')]('clientId')||_0x29da29[_0xd4ca('0x9')](_0xd4ca('0xd'))||_0x29da29[_0xd4ca('0x9')](_0xd4ca('0xe'))||_0x29da29['changed'](_0xd4ca('0x22'))){var _0x4d1fb3,_0x2170a5;_0x4d1fb3=_0x29da29[_0xd4ca('0xb')];var _0x177fc5=_0x4d1fb3[_0xd4ca('0xf')](-0x1);if(_0x177fc5==='/'||_0x177fc5==='\x5c'||_0x177fc5===':'){_0x4d1fb3=_0x4d1fb3['substring'](0x0,_0x4d1fb3['lastIndexOf'](_0x177fc5));}switch(_0x29da29['zone']){case'US':_0x2170a5=_0xd4ca('0x23');break;case'AU':_0x2170a5=_0xd4ca('0x12');break;case'IN':_0x2170a5=_0xd4ca('0x13');break;case'CN':_0x2170a5=_0xd4ca('0x14');break;default:_0x2170a5='https://accounts.zoho.eu';break;}var _0x32d83f={'method':_0xd4ca('0x16'),'uri':_0x2170a5+_0xd4ca('0x17'),'form':{'grant_type':_0xd4ca('0x18'),'client_id':_0x29da29[_0xd4ca('0xc')],'client_secret':_0x29da29[_0xd4ca('0xd')],'redirect_uri':_0x29da29['serverUrl'],'code':_0x29da29[_0xd4ca('0xe')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x32d83f)['then'](function(_0x3b32ec){var _0x336d60=JSON[_0xd4ca('0x24')](_0x3b32ec);if(_0x336d60['refresh_token']){_0x29da29['refreshToken']=_0x336d60[_0xd4ca('0x19')];logger[_0xd4ca('0x1a')](util[_0xd4ca('0x1b')](_0xd4ca('0x1c'),_0x29da29[_0xd4ca('0x1e')],_0x29da29['id']));}else{logger[_0xd4ca('0x21')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x29da29[_0xd4ca('0x1e')],_0x29da29['id']),util['inspect'](_0x336d60,{'showHidden':![],'depth':null}));}return _0x3d5a00(null,_0x4688c7);})[_0xd4ca('0x20')](function(_0x2efa5c){logger['error'](util['format'](_0xd4ca('0x1d'),_0x29da29[_0xd4ca('0x1e')],_0x29da29['id']),util[_0xd4ca('0x1f')](parsedResult,{'showHidden':![],'depth':null}));return _0x3d5a00(_0x2efa5c);});}else{return _0x3d5a00(null,_0x4688c7);}}}});}; \ No newline at end of file +var _0x140d=['https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','then','refresh_token','refreshToken','name','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','slice','https://accounts.zoho.com','https://accounts.zoho.in','authorization_code','application/x-www-form-urlencoded','parse','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts','zone','serverUrl','changed','clientId','clientSecret','code','host','substring','lastIndexOf','https://accounts.zoho.com.au'];(function(_0x3b6f7e,_0x2c6e88){var _0xa6608=function(_0x5ba576){while(--_0x5ba576){_0x3b6f7e['push'](_0x3b6f7e['shift']());}};_0xa6608(++_0x2c6e88);}(_0x140d,0x1b9));var _0xd140=function(_0x4b88f8,_0x20ae18){_0x4b88f8=_0x4b88f8-0x0;var _0x15ecc5=_0x140d[_0x4b88f8];return _0x15ecc5;};'use strict';var _=require('lodash');var util=require(_0xd140('0x0'));var logger=require(_0xd140('0x1'))('api');var moment=require(_0xd140('0x2'));var BPromise=require(_0xd140('0x3'));var rp=require(_0xd140('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd140('0x5'));var attributes=require(_0xd140('0x6'));var integrations=require(_0xd140('0x7'));module['exports']=function(_0x1a85d8,_0x3437d0){return _0x1a85d8[_0xd140('0x8')](_0xd140('0x9'),attributes,{'tableName':_0xd140('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x10a053,_0x14a32a,_0x3e9beb){if(_0x10a053['changed'](_0xd140('0xb'))||_0x10a053['changed'](_0xd140('0xc'))||_0x10a053[_0xd140('0xd')](_0xd140('0xe'))||_0x10a053[_0xd140('0xd')](_0xd140('0xf'))||_0x10a053[_0xd140('0xd')](_0xd140('0x10'))||_0x10a053[_0xd140('0xd')](_0xd140('0x11'))){var _0x4071d4,_0x76fb95;_0x4071d4=_0x10a053[_0xd140('0xc')];var _0x19ad5a=_0x4071d4['slice'](-0x1);if(_0x19ad5a==='/'||_0x19ad5a==='\x5c'||_0x19ad5a===':'){_0x4071d4=_0x4071d4[_0xd140('0x12')](0x0,_0x4071d4[_0xd140('0x13')](_0x19ad5a));}switch(_0x10a053[_0xd140('0xb')]){case'US':_0x76fb95='https://accounts.zoho.com';break;case'AU':_0x76fb95=_0xd140('0x14');break;case'IN':_0x76fb95='https://accounts.zoho.in';break;case'CN':_0x76fb95=_0xd140('0x15');break;default:_0x76fb95=_0xd140('0x16');break;}var _0x3315b3={'method':_0xd140('0x17'),'uri':_0x76fb95+_0xd140('0x18'),'form':{'grant_type':'authorization_code','client_id':_0x10a053[_0xd140('0xe')],'client_secret':_0x10a053[_0xd140('0xf')],'redirect_uri':_0x10a053[_0xd140('0xc')],'code':_0x10a053[_0xd140('0x10')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x3315b3)[_0xd140('0x19')](function(_0x223b1b){var _0x38065e=JSON['parse'](_0x223b1b);if(_0x38065e[_0xd140('0x1a')]){_0x10a053[_0xd140('0x1b')]=_0x38065e[_0xd140('0x1a')];logger['info'](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x10a053[_0xd140('0x1c')],_0x10a053['id']));}else{logger[_0xd140('0x1d')](util[_0xd140('0x1e')](_0xd140('0x1f'),_0x10a053[_0xd140('0x1c')],_0x10a053['id']),util[_0xd140('0x20')](_0x38065e,{'showHidden':![],'depth':null}));}return _0x3e9beb(null,_0x14a32a);})[_0xd140('0x21')](function(_0x32b139){logger['error'](util[_0xd140('0x1e')](_0xd140('0x1f'),_0x10a053[_0xd140('0x1c')],_0x10a053['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x3e9beb(_0x32b139);});}else{return _0x3e9beb(null,_0x14a32a);}},'beforeUpdate':function(_0x1c16ce,_0x257742,_0x39506b){if(_0x1c16ce['changed']('zone')||_0x1c16ce[_0xd140('0xd')](_0xd140('0xc'))||_0x1c16ce['changed']('clientId')||_0x1c16ce[_0xd140('0xd')]('clientSecret')||_0x1c16ce[_0xd140('0xd')]('code')||_0x1c16ce[_0xd140('0xd')]('host')){var _0x102d85,_0x12b192;_0x102d85=_0x1c16ce[_0xd140('0xc')];var _0x19ff06=_0x102d85[_0xd140('0x22')](-0x1);if(_0x19ff06==='/'||_0x19ff06==='\x5c'||_0x19ff06===':'){_0x102d85=_0x102d85['substring'](0x0,_0x102d85[_0xd140('0x13')](_0x19ff06));}switch(_0x1c16ce[_0xd140('0xb')]){case'US':_0x12b192=_0xd140('0x23');break;case'AU':_0x12b192=_0xd140('0x14');break;case'IN':_0x12b192=_0xd140('0x24');break;case'CN':_0x12b192='https://accounts.zoho.com.cn';break;default:_0x12b192=_0xd140('0x16');break;}var _0x55457e={'method':_0xd140('0x17'),'uri':_0x12b192+_0xd140('0x18'),'form':{'grant_type':_0xd140('0x25'),'client_id':_0x1c16ce[_0xd140('0xe')],'client_secret':_0x1c16ce[_0xd140('0xf')],'redirect_uri':_0x1c16ce[_0xd140('0xc')],'code':_0x1c16ce[_0xd140('0x10')]},'headers':{'Content-Type':_0xd140('0x26')}};return rp(_0x55457e)['then'](function(_0x3a603b){var _0x449c82=JSON[_0xd140('0x27')](_0x3a603b);if(_0x449c82[_0xd140('0x1a')]){_0x1c16ce['refreshToken']=_0x449c82[_0xd140('0x1a')];logger[_0xd140('0x28')](util['format'](_0xd140('0x29'),_0x1c16ce['name'],_0x1c16ce['id']));}else{logger[_0xd140('0x1d')](util[_0xd140('0x1e')](_0xd140('0x1f'),_0x1c16ce[_0xd140('0x1c')],_0x1c16ce['id']),util[_0xd140('0x20')](_0x449c82,{'showHidden':![],'depth':null}));}return _0x39506b(null,_0x257742);})['catch'](function(_0x4e129a){logger[_0xd140('0x1d')](util[_0xd140('0x1e')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1c16ce[_0xd140('0x1c')],_0x1c16ce['id']),util[_0xd140('0x20')](parsedResult,{'showHidden':![],'depth':null}));return _0x39506b(_0x4e129a);});}else{return _0x39506b(null,_0x257742);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 3d8783a..74dd6b4 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 _0x5d4e=['jayson/promise','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','attributes','limit','include','map','model','where','ShowZohoAccount','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x4cd2ad,_0x5233c2){var _0x44a823=function(_0x31d179){while(--_0x31d179){_0x4cd2ad['push'](_0x4cd2ad['shift']());}};_0x44a823(++_0x5233c2);}(_0x5d4e,0x138));var _0xe5d4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5d4e[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0xe5d4('0x0'));var moment=require(_0xe5d4('0x1'));var BPromise=require(_0xe5d4('0x2'));var rs=require(_0xe5d4('0x3'));var fs=require('fs');var Redis=require(_0xe5d4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe5d4('0x5'));var logger=require(_0xe5d4('0x6'))(_0xe5d4('0x7'));var config=require('../../config/environment');var jayson=require(_0xe5d4('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5ecca3,_0x304a0b,_0x262b90){return new BPromise(function(_0x2d416d,_0x1b332f){return client[_0xe5d4('0x9')](_0x5ecca3,_0x262b90)[_0xe5d4('0xa')](function(_0xf7fa11){logger[_0xe5d4('0xb')](_0xe5d4('0xc'),_0x304a0b,_0xe5d4('0xd'));logger[_0xe5d4('0xe')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x304a0b,'request\x20sent',JSON[_0xe5d4('0xf')](_0xf7fa11));if(_0xf7fa11[_0xe5d4('0x10')]){if(_0xf7fa11[_0xe5d4('0x10')][_0xe5d4('0x11')]===0x1f4){logger[_0xe5d4('0x10')](_0xe5d4('0xc'),_0x304a0b,_0xf7fa11[_0xe5d4('0x10')][_0xe5d4('0x12')]);return _0x1b332f(_0xf7fa11[_0xe5d4('0x10')]['message']);}logger['error'](_0xe5d4('0xc'),_0x304a0b,_0xf7fa11[_0xe5d4('0x10')]['message']);return _0x2d416d(_0xf7fa11[_0xe5d4('0x10')][_0xe5d4('0x12')]);}else{logger[_0xe5d4('0xb')](_0xe5d4('0xc'),_0x304a0b,_0xe5d4('0xd'));_0x2d416d(_0xf7fa11[_0xe5d4('0x13')][_0xe5d4('0x12')]);}})[_0xe5d4('0x14')](function(_0x274b83){logger[_0xe5d4('0x10')](_0xe5d4('0xc'),_0x304a0b,_0x274b83);_0x1b332f(_0x274b83);});});}exports[_0xe5d4('0x15')]=function(_0x915fb7){var _0x3a926a=this;return new Promise(function(_0x435782,_0xde81d2){return db[_0xe5d4('0x16')][_0xe5d4('0x17')]({'raw':_0x915fb7[_0xe5d4('0x18')]?_0x915fb7[_0xe5d4('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x915fb7[_0xe5d4('0x18')]?_0x915fb7[_0xe5d4('0x18')]['where']||null:null,'attributes':_0x915fb7[_0xe5d4('0x18')]?_0x915fb7[_0xe5d4('0x18')][_0xe5d4('0x19')]||null:null,'limit':_0x915fb7[_0xe5d4('0x18')]?_0x915fb7[_0xe5d4('0x18')][_0xe5d4('0x1a')]||null:null,'include':_0x915fb7['options']?_0x915fb7['options'][_0xe5d4('0x1b')]?_[_0xe5d4('0x1c')](_0x915fb7['options'][_0xe5d4('0x1b')],function(_0x357161){return{'model':db[_0x357161['model']],'as':_0x357161['as'],'attributes':_0x357161['attributes'],'include':_0x357161[_0xe5d4('0x1b')]?_[_0xe5d4('0x1c')](_0x357161[_0xe5d4('0x1b')],function(_0xb79648){return{'model':db[_0xb79648[_0xe5d4('0x1d')]],'as':_0xb79648['as'],'attributes':_0xb79648[_0xe5d4('0x19')],'include':_0xb79648[_0xe5d4('0x1b')]?_[_0xe5d4('0x1c')](_0xb79648['include'],function(_0x436d08){return{'model':db[_0x436d08[_0xe5d4('0x1d')]],'as':_0x436d08['as'],'attributes':_0x436d08[_0xe5d4('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xf48273){logger[_0xe5d4('0xb')](_0xe5d4('0x15'),_0x915fb7);logger[_0xe5d4('0xe')](_0xe5d4('0x15'),_0x915fb7,JSON[_0xe5d4('0xf')](_0xf48273));_0x435782(_0xf48273);})['catch'](function(_0x15965d){logger[_0xe5d4('0x10')](_0xe5d4('0x15'),_0x15965d[_0xe5d4('0x12')],_0x915fb7);_0xde81d2(_0x3a926a[_0xe5d4('0x10')](0x1f4,_0x15965d[_0xe5d4('0x12')]));});});};exports['ShowZohoAccount']=function(_0x45663b){var _0xbcf569=this;return new Promise(function(_0xe546c9,_0x4fc639){return db[_0xe5d4('0x16')]['find']({'raw':_0x45663b['options']?_0x45663b['options']['raw']===undefined?!![]:![]:!![],'where':_0x45663b[_0xe5d4('0x18')]?_0x45663b[_0xe5d4('0x18')][_0xe5d4('0x1e')]||null:null,'attributes':_0x45663b[_0xe5d4('0x18')]?_0x45663b[_0xe5d4('0x18')][_0xe5d4('0x19')]||null:null,'include':_0x45663b['options']?_0x45663b['options']['include']?_['map'](_0x45663b[_0xe5d4('0x18')][_0xe5d4('0x1b')],function(_0x412872){return{'model':db[_0x412872[_0xe5d4('0x1d')]],'as':_0x412872['as'],'attributes':_0x412872['attributes'],'include':_0x412872[_0xe5d4('0x1b')]?_[_0xe5d4('0x1c')](_0x412872[_0xe5d4('0x1b')],function(_0x5dbc05){return{'model':db[_0x5dbc05[_0xe5d4('0x1d')]],'as':_0x5dbc05['as'],'attributes':_0x5dbc05[_0xe5d4('0x19')],'include':_0x5dbc05[_0xe5d4('0x1b')]?_[_0xe5d4('0x1c')](_0x5dbc05[_0xe5d4('0x1b')],function(_0x278484){return{'model':db[_0x278484[_0xe5d4('0x1d')]],'as':_0x278484['as'],'attributes':_0x278484[_0xe5d4('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe5d4('0xa')](function(_0x5d9e7b){logger[_0xe5d4('0xb')](_0xe5d4('0x1f'),_0x45663b);logger[_0xe5d4('0xe')](_0xe5d4('0x1f'),_0x45663b,JSON['stringify'](_0x5d9e7b));_0xe546c9(_0x5d9e7b);})[_0xe5d4('0x14')](function(_0x101be3){logger[_0xe5d4('0x10')](_0xe5d4('0x1f'),_0x101be3[_0xe5d4('0x12')],_0x45663b);_0x4fc639(_0xbcf569['error'](0x1f4,_0x101be3['message']));});});}; \ No newline at end of file +var _0xb4b6=['result','catch','GetZohoAccount','findAll','options','raw','where','limit','map','include','attributes','ShowZohoAccount','ZohoAccount','find','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xb4b6,0x7e));var _0x6b4b=function(_0x44e1e4,_0x46082b){_0x44e1e4=_0x44e1e4-0x0;var _0x2063b8=_0xb4b6[_0x44e1e4];return _0x2063b8;};'use strict';var _=require('lodash');var util=require(_0x6b4b('0x0'));var moment=require(_0x6b4b('0x1'));var BPromise=require(_0x6b4b('0x2'));var rs=require(_0x6b4b('0x3'));var fs=require('fs');var Redis=require(_0x6b4b('0x4'));var db=require(_0x6b4b('0x5'))['db'];var utils=require(_0x6b4b('0x6'));var logger=require(_0x6b4b('0x7'))(_0x6b4b('0x8'));var config=require('../../config/environment');var jayson=require(_0x6b4b('0x9'));var client=jayson['client'][_0x6b4b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25eef2,_0x8b279d,_0x127577){return new BPromise(function(_0x2e6b81,_0x572b2d){return client[_0x6b4b('0xb')](_0x25eef2,_0x127577)[_0x6b4b('0xc')](function(_0x40b391){logger[_0x6b4b('0xd')](_0x6b4b('0xe'),_0x8b279d,_0x6b4b('0xf'));logger[_0x6b4b('0x10')](_0x6b4b('0x11'),_0x8b279d,'request\x20sent',JSON[_0x6b4b('0x12')](_0x40b391));if(_0x40b391['error']){if(_0x40b391[_0x6b4b('0x13')][_0x6b4b('0x14')]===0x1f4){logger[_0x6b4b('0x13')](_0x6b4b('0xe'),_0x8b279d,_0x40b391[_0x6b4b('0x13')][_0x6b4b('0x15')]);return _0x572b2d(_0x40b391[_0x6b4b('0x13')]['message']);}logger[_0x6b4b('0x13')](_0x6b4b('0xe'),_0x8b279d,_0x40b391[_0x6b4b('0x13')]['message']);return _0x2e6b81(_0x40b391['error'][_0x6b4b('0x15')]);}else{logger[_0x6b4b('0xd')]('ZohoAccount,\x20%s,\x20%s',_0x8b279d,_0x6b4b('0xf'));_0x2e6b81(_0x40b391[_0x6b4b('0x16')][_0x6b4b('0x15')]);}})[_0x6b4b('0x17')](function(_0x22a176){logger[_0x6b4b('0x13')](_0x6b4b('0xe'),_0x8b279d,_0x22a176);_0x572b2d(_0x22a176);});});}exports[_0x6b4b('0x18')]=function(_0x15333b){var _0x5308da=this;return new Promise(function(_0x5a1afc,_0x26b9b4){return db['ZohoAccount'][_0x6b4b('0x19')]({'raw':_0x15333b[_0x6b4b('0x1a')]?_0x15333b[_0x6b4b('0x1a')][_0x6b4b('0x1b')]===undefined?!![]:![]:!![],'where':_0x15333b['options']?_0x15333b[_0x6b4b('0x1a')][_0x6b4b('0x1c')]||null:null,'attributes':_0x15333b['options']?_0x15333b['options']['attributes']||null:null,'limit':_0x15333b[_0x6b4b('0x1a')]?_0x15333b[_0x6b4b('0x1a')][_0x6b4b('0x1d')]||null:null,'include':_0x15333b[_0x6b4b('0x1a')]?_0x15333b[_0x6b4b('0x1a')]['include']?_[_0x6b4b('0x1e')](_0x15333b[_0x6b4b('0x1a')][_0x6b4b('0x1f')],function(_0xef64c9){return{'model':db[_0xef64c9['model']],'as':_0xef64c9['as'],'attributes':_0xef64c9['attributes'],'include':_0xef64c9['include']?_['map'](_0xef64c9[_0x6b4b('0x1f')],function(_0x526f6d){return{'model':db[_0x526f6d['model']],'as':_0x526f6d['as'],'attributes':_0x526f6d[_0x6b4b('0x20')],'include':_0x526f6d[_0x6b4b('0x1f')]?_[_0x6b4b('0x1e')](_0x526f6d[_0x6b4b('0x1f')],function(_0x5afba8){return{'model':db[_0x5afba8['model']],'as':_0x5afba8['as'],'attributes':_0x5afba8[_0x6b4b('0x20')]};}):[]};}):[]};}):[]:[]})[_0x6b4b('0xc')](function(_0x2973f){logger[_0x6b4b('0xd')]('GetZohoAccount',_0x15333b);logger[_0x6b4b('0x10')]('GetZohoAccount',_0x15333b,JSON[_0x6b4b('0x12')](_0x2973f));_0x5a1afc(_0x2973f);})[_0x6b4b('0x17')](function(_0x334cf8){logger['error'](_0x6b4b('0x18'),_0x334cf8[_0x6b4b('0x15')],_0x15333b);_0x26b9b4(_0x5308da[_0x6b4b('0x13')](0x1f4,_0x334cf8[_0x6b4b('0x15')]));});});};exports[_0x6b4b('0x21')]=function(_0x1ab7de){var _0x4bea7a=this;return new Promise(function(_0x509a54,_0x55e595){return db[_0x6b4b('0x22')][_0x6b4b('0x23')]({'raw':_0x1ab7de[_0x6b4b('0x1a')]?_0x1ab7de[_0x6b4b('0x1a')][_0x6b4b('0x1b')]===undefined?!![]:![]:!![],'where':_0x1ab7de[_0x6b4b('0x1a')]?_0x1ab7de['options']['where']||null:null,'attributes':_0x1ab7de['options']?_0x1ab7de[_0x6b4b('0x1a')]['attributes']||null:null,'include':_0x1ab7de[_0x6b4b('0x1a')]?_0x1ab7de['options']['include']?_['map'](_0x1ab7de[_0x6b4b('0x1a')][_0x6b4b('0x1f')],function(_0x2cb4ff){return{'model':db[_0x2cb4ff[_0x6b4b('0x24')]],'as':_0x2cb4ff['as'],'attributes':_0x2cb4ff[_0x6b4b('0x20')],'include':_0x2cb4ff['include']?_[_0x6b4b('0x1e')](_0x2cb4ff['include'],function(_0x5b0252){return{'model':db[_0x5b0252['model']],'as':_0x5b0252['as'],'attributes':_0x5b0252[_0x6b4b('0x20')],'include':_0x5b0252[_0x6b4b('0x1f')]?_[_0x6b4b('0x1e')](_0x5b0252['include'],function(_0x273521){return{'model':db[_0x273521[_0x6b4b('0x24')]],'as':_0x273521['as'],'attributes':_0x273521[_0x6b4b('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x550465){logger[_0x6b4b('0xd')](_0x6b4b('0x21'),_0x1ab7de);logger[_0x6b4b('0x10')](_0x6b4b('0x21'),_0x1ab7de,JSON[_0x6b4b('0x12')](_0x550465));_0x509a54(_0x550465);})[_0x6b4b('0x17')](function(_0x4a8af8){logger[_0x6b4b('0x13')]('ShowZohoAccount',_0x4a8af8[_0x6b4b('0x15')],_0x1ab7de);_0x55e595(_0x4bea7a[_0x6b4b('0x13')](0x1f4,_0x4a8af8['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 1f725ca..7bbfbb6 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 _0xa4a9=['/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','destroy','exports','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show'];(function(_0x1d6ea6,_0x2276c6){var _0x4e20ea=function(_0x3f1579){while(--_0x3f1579){_0x1d6ea6['push'](_0x1d6ea6['shift']());}};_0x4e20ea(++_0x2276c6);}(_0xa4a9,0x137));var _0x9a4a=function(_0x154b4c,_0xa38e2){_0x154b4c=_0x154b4c-0x0;var _0x100586=_0xa4a9[_0x154b4c];return _0x100586;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x9a4a('0x0'));var express=require(_0x9a4a('0x1'));var router=express['Router']();var fs_extra=require(_0x9a4a('0x2'));var auth=require(_0x9a4a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x9a4a('0x4'));var controller=require('./intZohoConfiguration.controller');router[_0x9a4a('0x5')]('/',auth[_0x9a4a('0x6')](),controller['index']);router[_0x9a4a('0x5')](_0x9a4a('0x7'),auth[_0x9a4a('0x6')](),controller[_0x9a4a('0x8')]);router[_0x9a4a('0x5')](_0x9a4a('0x9'),auth[_0x9a4a('0x6')](),controller['getFields']);router[_0x9a4a('0x5')](_0x9a4a('0xa'),auth[_0x9a4a('0x6')](),controller[_0x9a4a('0xb')]);router[_0x9a4a('0x5')](_0x9a4a('0xc'),auth[_0x9a4a('0x6')](),controller[_0x9a4a('0xd')]);router[_0x9a4a('0xe')]('/',auth[_0x9a4a('0x6')](),controller[_0x9a4a('0xf')]);router[_0x9a4a('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x9a4a('0x11')]);router['delete']('/:id',auth[_0x9a4a('0x6')](),controller[_0x9a4a('0x12')]);module[_0x9a4a('0x13')]=router; \ No newline at end of file +var _0xdf11=['isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update','delete','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','/:id'];(function(_0x14a6b9,_0x322766){var _0x3c1161=function(_0x57e353){while(--_0x57e353){_0x14a6b9['push'](_0x14a6b9['shift']());}};_0x3c1161(++_0x322766);}(_0xdf11,0x1da));var _0x1df1=function(_0x24db1d,_0x1f560a){_0x24db1d=_0x24db1d-0x0;var _0x5221e6=_0xdf11[_0x24db1d];return _0x5221e6;};'use strict';var multer=require('multer');var util=require(_0x1df1('0x0'));var path=require('path');var timeout=require(_0x1df1('0x1'));var express=require('express');var router=express[_0x1df1('0x2')]();var fs_extra=require(_0x1df1('0x3'));var auth=require(_0x1df1('0x4'));var interaction=require(_0x1df1('0x5'));var config=require(_0x1df1('0x6'));var controller=require(_0x1df1('0x7'));router[_0x1df1('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1df1('0x8')](_0x1df1('0x9'),auth[_0x1df1('0xa')](),controller[_0x1df1('0xb')]);router[_0x1df1('0x8')](_0x1df1('0xc'),auth[_0x1df1('0xa')](),controller['getFields']);router[_0x1df1('0x8')](_0x1df1('0xd'),auth[_0x1df1('0xa')](),controller[_0x1df1('0xe')]);router['get'](_0x1df1('0xf'),auth[_0x1df1('0xa')](),controller[_0x1df1('0x10')]);router[_0x1df1('0x11')]('/',auth[_0x1df1('0xa')](),controller['create']);router[_0x1df1('0x12')](_0x1df1('0x9'),auth[_0x1df1('0xa')](),controller[_0x1df1('0x13')]);router[_0x1df1('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x1df1('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 1403687..bc98006 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 _0x94a1=['STRING','ENUM','lead','contact','nothing','contact_lead','sequelize'];(function(_0x146837,_0x2aa6a2){var _0x3d7e60=function(_0x1301ac){while(--_0x1301ac){_0x146837['push'](_0x146837['shift']());}};_0x3d7e60(++_0x2aa6a2);}(_0x94a1,0x8b));var _0x194a=function(_0x821d08,_0x4ecbaa){_0x821d08=_0x821d08-0x0;var _0x8eb256=_0x94a1[_0x821d08];return _0x8eb256;};'use strict';var Sequelize=require(_0x194a('0x0'));module['exports']={'name':{'type':Sequelize[_0x194a('0x1')]},'moduleCreate':{'type':Sequelize[_0x194a('0x2')](_0x194a('0x3'),_0x194a('0x4'),_0x194a('0x5')),'defaultValue':_0x194a('0x3')},'moduleSearch':{'type':Sequelize[_0x194a('0x2')]('contact_lead','contact',_0x194a('0x3')),'defaultValue':_0x194a('0x6')},'description':{'type':Sequelize[_0x194a('0x1')]}}; \ No newline at end of file +var _0xb815=['contact_lead','STRING','sequelize','exports','lead','nothing','ENUM'];(function(_0x4256b5,_0x82fc17){var _0x248d48=function(_0x4c18df){while(--_0x4c18df){_0x4256b5['push'](_0x4256b5['shift']());}};_0x248d48(++_0x82fc17);}(_0xb815,0x160));var _0x5b81=function(_0x540b7d,_0x56017f){_0x540b7d=_0x540b7d-0x0;var _0x517a86=_0xb815[_0x540b7d];return _0x517a86;};'use strict';var Sequelize=require(_0x5b81('0x0'));module[_0x5b81('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize['ENUM'](_0x5b81('0x2'),'contact',_0x5b81('0x3')),'defaultValue':_0x5b81('0x2')},'moduleSearch':{'type':Sequelize[_0x5b81('0x4')](_0x5b81('0x5'),'contact',_0x5b81('0x2')),'defaultValue':_0x5b81('0x5')},'description':{'type':Sequelize[_0x5b81('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index f3761ae..8c6b5ec 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 _0xdc72=['count','offset','set','Content-Range','save','update','destroy','then','end','stack','name','index','map','ZohoConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','find','create','body','getFields','findOne','ZohoField','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','json','undefined','limit'];(function(_0x231647,_0x2bc8b0){var _0x3a5c2f=function(_0x442d12){while(--_0x442d12){_0x231647['push'](_0x231647['shift']());}};_0x3a5c2f(++_0x2bc8b0);}(_0xdc72,0xc8));var _0x2dc7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc72[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2dc7('0x0'));var zipdir=require(_0x2dc7('0x1'));var jsonpatch=require(_0x2dc7('0x2'));var rp=require(_0x2dc7('0x3'));var moment=require(_0x2dc7('0x4'));var BPromise=require(_0x2dc7('0x5'));var Mustache=require(_0x2dc7('0x6'));var util=require(_0x2dc7('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x2dc7('0x8'));var ejs=require(_0x2dc7('0x9'));var fs=require('fs');var fs_extra=require(_0x2dc7('0xa'));var _=require(_0x2dc7('0xb'));var squel=require(_0x2dc7('0xc'));var crypto=require('crypto');var jsforce=require(_0x2dc7('0xd'));var deskjs=require(_0x2dc7('0xe'));var toCsv=require(_0x2dc7('0x8'));var querystring=require(_0x2dc7('0xf'));var Papa=require('papaparse');var Redis=require(_0x2dc7('0x10'));var authService=require(_0x2dc7('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2dc7('0x12'));var hardwareService=require(_0x2dc7('0x13'));var logger=require(_0x2dc7('0x14'))('api');var utils=require(_0x2dc7('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2dc7('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x220b27,_0x15c3c3){_0x15c3c3=_0x15c3c3||0xcc;return function(_0x2284b9){if(_0x2284b9){return _0x220b27[_0x2dc7('0x17')](_0x15c3c3);}return _0x220b27[_0x2dc7('0x18')](_0x15c3c3)['end']();};}function respondWithResult(_0x392fe9,_0xfb9cbd){_0xfb9cbd=_0xfb9cbd||0xc8;return function(_0x22b359){if(_0x22b359){return _0x392fe9[_0x2dc7('0x18')](_0xfb9cbd)[_0x2dc7('0x19')](_0x22b359);}};}function respondWithFilteredResult(_0x127331,_0x4e8b8a){return function(_0x2ea8cc){if(_0x2ea8cc){var _0x1ee1fb=typeof _0x4e8b8a['offset']===_0x2dc7('0x1a')&&typeof _0x4e8b8a[_0x2dc7('0x1b')]===_0x2dc7('0x1a');var _0x4920cd=_0x2ea8cc[_0x2dc7('0x1c')];var _0x25c9de=_0x1ee1fb?0x0:_0x4e8b8a[_0x2dc7('0x1d')];var _0x50727b=_0x1ee1fb?_0x2ea8cc[_0x2dc7('0x1c')]:_0x4e8b8a[_0x2dc7('0x1d')]+_0x4e8b8a[_0x2dc7('0x1b')];var _0x43a7dd;if(_0x50727b>=_0x4920cd){_0x50727b=_0x4920cd;_0x43a7dd=0xc8;}else{_0x43a7dd=0xce;}_0x127331[_0x2dc7('0x18')](_0x43a7dd);return _0x127331[_0x2dc7('0x1e')](_0x2dc7('0x1f'),_0x25c9de+'-'+_0x50727b+'/'+_0x4920cd)[_0x2dc7('0x19')](_0x2ea8cc);}return null;};}function patchUpdates(_0x2aa598){return function(_0x574c54){try{jsonpatch['apply'](_0x574c54,_0x2aa598,!![]);}catch(_0x58a7f0){return BPromise['reject'](_0x58a7f0);}return _0x574c54[_0x2dc7('0x20')]();};}function saveUpdates(_0x251e4c,_0x565c38){return function(_0xca95e1){if(_0xca95e1){return _0xca95e1[_0x2dc7('0x21')](_0x251e4c)['then'](function(_0x32a5e4){return _0x32a5e4;});}return null;};}function removeEntity(_0x511396,_0x314f21){return function(_0x1bba7b){if(_0x1bba7b){return _0x1bba7b[_0x2dc7('0x22')]()[_0x2dc7('0x23')](function(){_0x511396[_0x2dc7('0x18')](0xcc)[_0x2dc7('0x24')]();});}};}function handleEntityNotFound(_0x567308,_0x2ffb4b){return function(_0x4745c7){if(!_0x4745c7){_0x567308[_0x2dc7('0x17')](0x194);}return _0x4745c7;};}function handleError(_0x54905d,_0x499ed3){_0x499ed3=_0x499ed3||0x1f4;return function(_0x69874f){logger['error'](_0x69874f[_0x2dc7('0x25')]);if(_0x69874f[_0x2dc7('0x26')]){delete _0x69874f[_0x2dc7('0x26')];}_0x54905d[_0x2dc7('0x18')](_0x499ed3)['send'](_0x69874f);};}exports[_0x2dc7('0x27')]=function(_0x3b8adb,_0x41b6b4){var _0x292902={},_0x422476={},_0x2cc44e={'count':0x0,'rows':[]};var _0x296163=_[_0x2dc7('0x28')](db[_0x2dc7('0x29')][_0x2dc7('0x2a')],function(_0x484e23){return{'name':_0x484e23['fieldName'],'type':_0x484e23[_0x2dc7('0x2b')][_0x2dc7('0x2c')]};});_0x422476[_0x2dc7('0x2d')]=_[_0x2dc7('0x28')](_0x296163,_0x2dc7('0x26'));_0x422476[_0x2dc7('0x2e')]=_[_0x2dc7('0x2f')](_0x3b8adb[_0x2dc7('0x2e')]);_0x422476[_0x2dc7('0x30')]=_[_0x2dc7('0x31')](_0x422476[_0x2dc7('0x2d')],_0x422476['query']);_0x292902['attributes']=_[_0x2dc7('0x31')](_0x422476[_0x2dc7('0x2d')],qs[_0x2dc7('0x32')](_0x3b8adb[_0x2dc7('0x2e')]['fields']));_0x292902[_0x2dc7('0x33')]=_0x292902[_0x2dc7('0x33')][_0x2dc7('0x34')]?_0x292902[_0x2dc7('0x33')]:_0x422476[_0x2dc7('0x2d')];if(!_0x3b8adb[_0x2dc7('0x2e')][_0x2dc7('0x35')](_0x2dc7('0x36'))){_0x292902[_0x2dc7('0x1b')]=qs[_0x2dc7('0x1b')](_0x3b8adb['query'][_0x2dc7('0x1b')]);_0x292902[_0x2dc7('0x1d')]=qs[_0x2dc7('0x1d')](_0x3b8adb[_0x2dc7('0x2e')][_0x2dc7('0x1d')]);}_0x292902[_0x2dc7('0x37')]=qs[_0x2dc7('0x38')](_0x3b8adb[_0x2dc7('0x2e')]['sort']);_0x292902[_0x2dc7('0x39')]=qs[_0x2dc7('0x30')](_[_0x2dc7('0x3a')](_0x3b8adb['query'],_0x422476['filters']),_0x296163);if(_0x3b8adb[_0x2dc7('0x2e')][_0x2dc7('0x3b')]){_0x292902['where']=_[_0x2dc7('0x3c')](_0x292902[_0x2dc7('0x39')],{'$or':_[_0x2dc7('0x28')](_0x296163,function(_0x2ab1df){if(_0x2ab1df[_0x2dc7('0x2b')]!=='VIRTUAL'){var _0x19345b={};_0x19345b[_0x2ab1df[_0x2dc7('0x26')]]={'$like':'%'+_0x3b8adb[_0x2dc7('0x2e')][_0x2dc7('0x3b')]+'%'};return _0x19345b;}})});}_0x292902=_[_0x2dc7('0x3c')]({},_0x292902,_0x3b8adb[_0x2dc7('0x3d')]);var _0x33ba01={'where':_0x292902[_0x2dc7('0x39')]};return db['ZohoConfiguration']['count'](_0x33ba01)[_0x2dc7('0x23')](function(_0x1ebba9){_0x2cc44e[_0x2dc7('0x1c')]=_0x1ebba9;if(_0x3b8adb['query'][_0x2dc7('0x3e')]){_0x292902[_0x2dc7('0x3f')]=[{'all':!![]}];}return db[_0x2dc7('0x29')]['findAll'](_0x292902);})[_0x2dc7('0x23')](function(_0xd19de8){_0x2cc44e[_0x2dc7('0x40')]=_0xd19de8;return _0x2cc44e;})[_0x2dc7('0x23')](respondWithFilteredResult(_0x41b6b4,_0x292902))[_0x2dc7('0x41')](handleError(_0x41b6b4,null));};exports[_0x2dc7('0x42')]=function(_0x593bec,_0x59415e){var _0x192dc1={'raw':![],'where':{'id':_0x593bec[_0x2dc7('0x43')]['id']}},_0x4f7bc8={};_0x4f7bc8[_0x2dc7('0x2d')]=_[_0x2dc7('0x2f')](db[_0x2dc7('0x29')][_0x2dc7('0x2a')]);_0x4f7bc8['query']=_[_0x2dc7('0x2f')](_0x593bec['query']);_0x4f7bc8['filters']=_[_0x2dc7('0x31')](_0x4f7bc8[_0x2dc7('0x2d')],_0x4f7bc8['query']);_0x192dc1['attributes']=_['intersection'](_0x4f7bc8[_0x2dc7('0x2d')],qs['fields'](_0x593bec[_0x2dc7('0x2e')][_0x2dc7('0x32')]));_0x192dc1[_0x2dc7('0x33')]=_0x192dc1[_0x2dc7('0x33')][_0x2dc7('0x34')]?_0x192dc1['attributes']:_0x4f7bc8['model'];if(_0x593bec[_0x2dc7('0x2e')]['includeAll']){_0x192dc1[_0x2dc7('0x3f')]=[{'all':!![]}];}_0x192dc1=_[_0x2dc7('0x3c')]({},_0x192dc1,_0x593bec[_0x2dc7('0x3d')]);return db[_0x2dc7('0x29')][_0x2dc7('0x44')](_0x192dc1)[_0x2dc7('0x23')](handleEntityNotFound(_0x59415e,null))[_0x2dc7('0x23')](respondWithResult(_0x59415e,null))[_0x2dc7('0x41')](handleError(_0x59415e,null));};exports[_0x2dc7('0x45')]=function(_0x567a17,_0x438c3d){return db[_0x2dc7('0x29')][_0x2dc7('0x45')](_0x567a17[_0x2dc7('0x46')],{})[_0x2dc7('0x23')](respondWithResult(_0x438c3d,0xc9))[_0x2dc7('0x41')](handleError(_0x438c3d,null));};exports[_0x2dc7('0x21')]=function(_0x423adc,_0x112b28){if(_0x423adc[_0x2dc7('0x46')]['id']){delete _0x423adc[_0x2dc7('0x46')]['id'];}return db[_0x2dc7('0x29')][_0x2dc7('0x44')]({'where':{'id':_0x423adc[_0x2dc7('0x43')]['id']}})['then'](handleEntityNotFound(_0x112b28,null))[_0x2dc7('0x23')](saveUpdates(_0x423adc[_0x2dc7('0x46')],null))[_0x2dc7('0x23')](respondWithResult(_0x112b28,null))[_0x2dc7('0x41')](handleError(_0x112b28,null));};exports[_0x2dc7('0x22')]=function(_0x3d077e,_0xc72ad9){return db[_0x2dc7('0x29')][_0x2dc7('0x44')]({'where':{'id':_0x3d077e[_0x2dc7('0x43')]['id']}})['then'](handleEntityNotFound(_0xc72ad9,null))[_0x2dc7('0x23')](removeEntity(_0xc72ad9,null))[_0x2dc7('0x41')](handleError(_0xc72ad9,null));};exports[_0x2dc7('0x47')]=function(_0x4b5d16,_0x4b2624,_0x464c1d){var _0x5de0ed={};var _0x4282f2={};var _0x1cc627;var _0x362201;return db[_0x2dc7('0x29')][_0x2dc7('0x48')]({'where':{'id':_0x4b5d16[_0x2dc7('0x43')]['id']}})[_0x2dc7('0x23')](handleEntityNotFound(_0x4b2624,null))[_0x2dc7('0x23')](function(_0x342b57){if(_0x342b57){_0x1cc627=_0x342b57;_0x4282f2[_0x2dc7('0x2d')]=_['keys'](db['ZohoField']['rawAttributes']);_0x4282f2[_0x2dc7('0x2e')]=_[_0x2dc7('0x2f')](_0x4b5d16[_0x2dc7('0x2e')]);_0x4282f2[_0x2dc7('0x30')]=_['intersection'](_0x4282f2['model'],_0x4282f2['query']);_0x5de0ed[_0x2dc7('0x33')]=_[_0x2dc7('0x31')](_0x4282f2[_0x2dc7('0x2d')],qs[_0x2dc7('0x32')](_0x4b5d16['query'][_0x2dc7('0x32')]));_0x5de0ed[_0x2dc7('0x33')]=_0x5de0ed[_0x2dc7('0x33')][_0x2dc7('0x34')]?_0x5de0ed['attributes']:_0x4282f2[_0x2dc7('0x2d')];_0x5de0ed['order']=qs[_0x2dc7('0x38')](_0x4b5d16['query']['sort']);_0x5de0ed[_0x2dc7('0x39')]=qs[_0x2dc7('0x30')](_['pick'](_0x4b5d16['query'],_0x4282f2[_0x2dc7('0x30')]));if(_0x4b5d16['query'][_0x2dc7('0x3b')]){_0x5de0ed['where']=_[_0x2dc7('0x3c')](_0x5de0ed[_0x2dc7('0x39')],{'$or':_['map'](_0x5de0ed[_0x2dc7('0x33')],function(_0x3f9679){var _0x512258={};_0x512258[_0x3f9679]={'$like':'%'+_0x4b5d16['query'][_0x2dc7('0x3b')]+'%'};return _0x512258;})});}_0x5de0ed=_['merge']({},_0x5de0ed,_0x4b5d16['options']);return _0x1cc627[_0x2dc7('0x47')](_0x5de0ed);}})[_0x2dc7('0x23')](function(_0x340529){if(_0x340529){_0x362201=_0x340529[_0x2dc7('0x34')];if(!_0x4b5d16[_0x2dc7('0x2e')]['hasOwnProperty'](_0x2dc7('0x36'))){_0x5de0ed[_0x2dc7('0x1b')]=qs[_0x2dc7('0x1b')](_0x4b5d16[_0x2dc7('0x2e')][_0x2dc7('0x1b')]);_0x5de0ed[_0x2dc7('0x1d')]=qs[_0x2dc7('0x1d')](_0x4b5d16[_0x2dc7('0x2e')][_0x2dc7('0x1d')]);}return _0x1cc627[_0x2dc7('0x47')](_0x5de0ed);}})[_0x2dc7('0x23')](function(_0x3a64bc){if(_0x3a64bc){return _0x3a64bc?{'count':_0x362201,'rows':_0x3a64bc}:null;}})[_0x2dc7('0x23')](respondWithResult(_0x4b2624,null))[_0x2dc7('0x41')](handleError(_0x4b2624,null));};exports['getSubjects']=function(_0x356b93,_0x37b4a2,_0x448d1b){var _0x13be7b={};var _0x539dc4={};var _0x370aeb;var _0x4852ef;return db[_0x2dc7('0x29')][_0x2dc7('0x48')]({'where':{'id':_0x356b93[_0x2dc7('0x43')]['id']}})['then'](handleEntityNotFound(_0x37b4a2,null))[_0x2dc7('0x23')](function(_0x51f5ff){if(_0x51f5ff){_0x370aeb=_0x51f5ff;_0x539dc4[_0x2dc7('0x2d')]=_['keys'](db[_0x2dc7('0x49')][_0x2dc7('0x2a')]);_0x539dc4['query']=_[_0x2dc7('0x2f')](_0x356b93[_0x2dc7('0x2e')]);_0x539dc4[_0x2dc7('0x30')]=_[_0x2dc7('0x31')](_0x539dc4[_0x2dc7('0x2d')],_0x539dc4[_0x2dc7('0x2e')]);_0x13be7b[_0x2dc7('0x33')]=_['intersection'](_0x539dc4[_0x2dc7('0x2d')],qs[_0x2dc7('0x32')](_0x356b93[_0x2dc7('0x2e')][_0x2dc7('0x32')]));_0x13be7b['attributes']=_0x13be7b[_0x2dc7('0x33')][_0x2dc7('0x34')]?_0x13be7b[_0x2dc7('0x33')]:_0x539dc4[_0x2dc7('0x2d')];_0x13be7b[_0x2dc7('0x37')]=qs['sort'](_0x356b93[_0x2dc7('0x2e')]['sort']);_0x13be7b[_0x2dc7('0x39')]=qs['filters'](_[_0x2dc7('0x3a')](_0x356b93[_0x2dc7('0x2e')],_0x539dc4[_0x2dc7('0x30')]));if(_0x356b93[_0x2dc7('0x2e')][_0x2dc7('0x3b')]){_0x13be7b[_0x2dc7('0x39')]=_['merge'](_0x13be7b[_0x2dc7('0x39')],{'$or':_[_0x2dc7('0x28')](_0x13be7b[_0x2dc7('0x33')],function(_0x1d5d5f){var _0x58020b={};_0x58020b[_0x1d5d5f]={'$like':'%'+_0x356b93[_0x2dc7('0x2e')]['filter']+'%'};return _0x58020b;})});}_0x13be7b=_[_0x2dc7('0x3c')]({},_0x13be7b,_0x356b93[_0x2dc7('0x3d')]);return _0x370aeb[_0x2dc7('0x4a')](_0x13be7b);}})[_0x2dc7('0x23')](function(_0x314e82){if(_0x314e82){_0x4852ef=_0x314e82['length'];if(!_0x356b93[_0x2dc7('0x2e')][_0x2dc7('0x35')](_0x2dc7('0x36'))){_0x13be7b['limit']=qs['limit'](_0x356b93[_0x2dc7('0x2e')][_0x2dc7('0x1b')]);_0x13be7b[_0x2dc7('0x1d')]=qs['offset'](_0x356b93[_0x2dc7('0x2e')][_0x2dc7('0x1d')]);}return _0x370aeb[_0x2dc7('0x4a')](_0x13be7b);}})[_0x2dc7('0x23')](function(_0x2d45dc){if(_0x2d45dc){return _0x2d45dc?{'count':_0x4852ef,'rows':_0x2d45dc}:null;}})['then'](respondWithResult(_0x37b4a2,null))[_0x2dc7('0x41')](handleError(_0x37b4a2,null));};exports['getDescriptions']=function(_0x2a79f9,_0x312a24,_0x23bbcd){var _0x10905b={};var _0x26e80e={};var _0x96dcdf;var _0xe7f11d;return db[_0x2dc7('0x29')][_0x2dc7('0x48')]({'where':{'id':_0x2a79f9[_0x2dc7('0x43')]['id']}})['then'](handleEntityNotFound(_0x312a24,null))[_0x2dc7('0x23')](function(_0x304205){if(_0x304205){_0x96dcdf=_0x304205;_0x26e80e[_0x2dc7('0x2d')]=_[_0x2dc7('0x2f')](db['ZohoField'][_0x2dc7('0x2a')]);_0x26e80e[_0x2dc7('0x2e')]=_[_0x2dc7('0x2f')](_0x2a79f9[_0x2dc7('0x2e')]);_0x26e80e[_0x2dc7('0x30')]=_[_0x2dc7('0x31')](_0x26e80e[_0x2dc7('0x2d')],_0x26e80e[_0x2dc7('0x2e')]);_0x10905b['attributes']=_[_0x2dc7('0x31')](_0x26e80e[_0x2dc7('0x2d')],qs[_0x2dc7('0x32')](_0x2a79f9[_0x2dc7('0x2e')][_0x2dc7('0x32')]));_0x10905b[_0x2dc7('0x33')]=_0x10905b[_0x2dc7('0x33')][_0x2dc7('0x34')]?_0x10905b[_0x2dc7('0x33')]:_0x26e80e[_0x2dc7('0x2d')];_0x10905b[_0x2dc7('0x37')]=qs[_0x2dc7('0x38')](_0x2a79f9[_0x2dc7('0x2e')]['sort']);_0x10905b['where']=qs['filters'](_['pick'](_0x2a79f9['query'],_0x26e80e[_0x2dc7('0x30')]));if(_0x2a79f9[_0x2dc7('0x2e')][_0x2dc7('0x3b')]){_0x10905b['where']=_['merge'](_0x10905b[_0x2dc7('0x39')],{'$or':_[_0x2dc7('0x28')](_0x10905b['attributes'],function(_0x4b5657){var _0x417160={};_0x417160[_0x4b5657]={'$like':'%'+_0x2a79f9['query'][_0x2dc7('0x3b')]+'%'};return _0x417160;})});}_0x10905b=_[_0x2dc7('0x3c')]({},_0x10905b,_0x2a79f9['options']);return _0x96dcdf[_0x2dc7('0x4b')](_0x10905b);}})[_0x2dc7('0x23')](function(_0x31721c){if(_0x31721c){_0xe7f11d=_0x31721c[_0x2dc7('0x34')];if(!_0x2a79f9[_0x2dc7('0x2e')][_0x2dc7('0x35')]('nolimit')){_0x10905b[_0x2dc7('0x1b')]=qs[_0x2dc7('0x1b')](_0x2a79f9[_0x2dc7('0x2e')][_0x2dc7('0x1b')]);_0x10905b[_0x2dc7('0x1d')]=qs[_0x2dc7('0x1d')](_0x2a79f9[_0x2dc7('0x2e')]['offset']);}return _0x96dcdf[_0x2dc7('0x4b')](_0x10905b);}})[_0x2dc7('0x23')](function(_0x184f19){if(_0x184f19){return _0x184f19?{'count':_0xe7f11d,'rows':_0x184f19}:null;}})[_0x2dc7('0x23')](respondWithResult(_0x312a24,null))[_0x2dc7('0x41')](handleError(_0x312a24,null));}; \ No newline at end of file +var _0xb462=['ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','undefined','count','offset','limit','apply','reject','save','update','destroy','sendStatus','error','stack','send','index','ZohoConfiguration','fieldName','type','key','model','map','name','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','then','includeAll','include','findAll','params','rawAttributes','length','find','catch','create','body','getFields','findOne','ZohoField','pick','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xb462,0xec));var _0x2b46=function(_0x5e12d8,_0x49f2f4){_0x5e12d8=_0x5e12d8-0x0;var _0x340466=_0xb462[_0x5e12d8];return _0x340466;};'use strict';var emlformat=require(_0x2b46('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2b46('0x1'));var jsonpatch=require(_0x2b46('0x2'));var rp=require(_0x2b46('0x3'));var moment=require(_0x2b46('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2b46('0x5'));var util=require(_0x2b46('0x6'));var path=require(_0x2b46('0x7'));var sox=require(_0x2b46('0x8'));var csv=require(_0x2b46('0x9'));var ejs=require(_0x2b46('0xa'));var fs=require('fs');var fs_extra=require(_0x2b46('0xb'));var _=require(_0x2b46('0xc'));var squel=require(_0x2b46('0xd'));var crypto=require(_0x2b46('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2b46('0xf'));var toCsv=require(_0x2b46('0x9'));var querystring=require(_0x2b46('0x10'));var Papa=require(_0x2b46('0x11'));var Redis=require(_0x2b46('0x12'));var authService=require(_0x2b46('0x13'));var qs=require(_0x2b46('0x14'));var as=require(_0x2b46('0x15'));var hardwareService=require(_0x2b46('0x16'));var logger=require(_0x2b46('0x17'))(_0x2b46('0x18'));var utils=require(_0x2b46('0x19'));var config=require(_0x2b46('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ed24e,_0xc6aa62){_0xc6aa62=_0xc6aa62||0xcc;return function(_0x43f1e8){if(_0x43f1e8){return _0x5ed24e['sendStatus'](_0xc6aa62);}return _0x5ed24e[_0x2b46('0x1b')](_0xc6aa62)[_0x2b46('0x1c')]();};}function respondWithResult(_0x495358,_0x419c6d){_0x419c6d=_0x419c6d||0xc8;return function(_0x568e41){if(_0x568e41){return _0x495358['status'](_0x419c6d)[_0x2b46('0x1d')](_0x568e41);}};}function respondWithFilteredResult(_0x3ef3be,_0x1d5559){return function(_0x3a2f47){if(_0x3a2f47){var _0x155b9e=typeof _0x1d5559['offset']===_0x2b46('0x1e')&&typeof _0x1d5559['limit']===_0x2b46('0x1e');var _0x36a18d=_0x3a2f47[_0x2b46('0x1f')];var _0x520966=_0x155b9e?0x0:_0x1d5559['offset'];var _0x226a18=_0x155b9e?_0x3a2f47[_0x2b46('0x1f')]:_0x1d5559[_0x2b46('0x20')]+_0x1d5559[_0x2b46('0x21')];var _0x57b0e4;if(_0x226a18>=_0x36a18d){_0x226a18=_0x36a18d;_0x57b0e4=0xc8;}else{_0x57b0e4=0xce;}_0x3ef3be[_0x2b46('0x1b')](_0x57b0e4);return _0x3ef3be['set']('Content-Range',_0x520966+'-'+_0x226a18+'/'+_0x36a18d)['json'](_0x3a2f47);}return null;};}function patchUpdates(_0xb86d){return function(_0x39cfe0){try{jsonpatch[_0x2b46('0x22')](_0x39cfe0,_0xb86d,!![]);}catch(_0x14e6e2){return BPromise[_0x2b46('0x23')](_0x14e6e2);}return _0x39cfe0[_0x2b46('0x24')]();};}function saveUpdates(_0x129b00,_0x2c4186){return function(_0x55018f){if(_0x55018f){return _0x55018f[_0x2b46('0x25')](_0x129b00)['then'](function(_0x38745b){return _0x38745b;});}return null;};}function removeEntity(_0x596fff,_0x3673b1){return function(_0x2fd544){if(_0x2fd544){return _0x2fd544[_0x2b46('0x26')]()['then'](function(){_0x596fff['status'](0xcc)[_0x2b46('0x1c')]();});}};}function handleEntityNotFound(_0x5bf2cf,_0x5a4a7e){return function(_0x9466c2){if(!_0x9466c2){_0x5bf2cf[_0x2b46('0x27')](0x194);}return _0x9466c2;};}function handleError(_0x51e0a1,_0x400d1f){_0x400d1f=_0x400d1f||0x1f4;return function(_0x50dfa9){logger[_0x2b46('0x28')](_0x50dfa9[_0x2b46('0x29')]);if(_0x50dfa9['name']){delete _0x50dfa9['name'];}_0x51e0a1[_0x2b46('0x1b')](_0x400d1f)[_0x2b46('0x2a')](_0x50dfa9);};}exports[_0x2b46('0x2b')]=function(_0x280517,_0x55ab60){var _0x390ec5={},_0x3d7536={},_0x2ec987={'count':0x0,'rows':[]};var _0x21877e=_['map'](db[_0x2b46('0x2c')]['rawAttributes'],function(_0xe5fe4f){return{'name':_0xe5fe4f[_0x2b46('0x2d')],'type':_0xe5fe4f[_0x2b46('0x2e')][_0x2b46('0x2f')]};});_0x3d7536[_0x2b46('0x30')]=_[_0x2b46('0x31')](_0x21877e,_0x2b46('0x32'));_0x3d7536['query']=_[_0x2b46('0x33')](_0x280517[_0x2b46('0x34')]);_0x3d7536[_0x2b46('0x35')]=_[_0x2b46('0x36')](_0x3d7536[_0x2b46('0x30')],_0x3d7536[_0x2b46('0x34')]);_0x390ec5[_0x2b46('0x37')]=_[_0x2b46('0x36')](_0x3d7536['model'],qs['fields'](_0x280517[_0x2b46('0x34')][_0x2b46('0x38')]));_0x390ec5[_0x2b46('0x37')]=_0x390ec5[_0x2b46('0x37')]['length']?_0x390ec5[_0x2b46('0x37')]:_0x3d7536['model'];if(!_0x280517[_0x2b46('0x34')][_0x2b46('0x39')](_0x2b46('0x3a'))){_0x390ec5['limit']=qs['limit'](_0x280517[_0x2b46('0x34')][_0x2b46('0x21')]);_0x390ec5['offset']=qs[_0x2b46('0x20')](_0x280517[_0x2b46('0x34')]['offset']);}_0x390ec5[_0x2b46('0x3b')]=qs[_0x2b46('0x3c')](_0x280517[_0x2b46('0x34')][_0x2b46('0x3c')]);_0x390ec5[_0x2b46('0x3d')]=qs[_0x2b46('0x35')](_['pick'](_0x280517['query'],_0x3d7536['filters']),_0x21877e);if(_0x280517[_0x2b46('0x34')][_0x2b46('0x3e')]){_0x390ec5['where']=_[_0x2b46('0x3f')](_0x390ec5[_0x2b46('0x3d')],{'$or':_[_0x2b46('0x31')](_0x21877e,function(_0x31a07f){if(_0x31a07f[_0x2b46('0x2e')]!=='VIRTUAL'){var _0x5a0e14={};_0x5a0e14[_0x31a07f[_0x2b46('0x32')]]={'$like':'%'+_0x280517[_0x2b46('0x34')][_0x2b46('0x3e')]+'%'};return _0x5a0e14;}})});}_0x390ec5=_['merge']({},_0x390ec5,_0x280517[_0x2b46('0x40')]);var _0x5bb029={'where':_0x390ec5[_0x2b46('0x3d')]};return db[_0x2b46('0x2c')]['count'](_0x5bb029)[_0x2b46('0x41')](function(_0x42f41f){_0x2ec987[_0x2b46('0x1f')]=_0x42f41f;if(_0x280517[_0x2b46('0x34')][_0x2b46('0x42')]){_0x390ec5[_0x2b46('0x43')]=[{'all':!![]}];}return db[_0x2b46('0x2c')][_0x2b46('0x44')](_0x390ec5);})['then'](function(_0x363546){_0x2ec987['rows']=_0x363546;return _0x2ec987;})[_0x2b46('0x41')](respondWithFilteredResult(_0x55ab60,_0x390ec5))['catch'](handleError(_0x55ab60,null));};exports['show']=function(_0x2f516b,_0x53e6d7){var _0x626141={'raw':![],'where':{'id':_0x2f516b[_0x2b46('0x45')]['id']}},_0x44efec={};_0x44efec[_0x2b46('0x30')]=_['keys'](db['ZohoConfiguration'][_0x2b46('0x46')]);_0x44efec[_0x2b46('0x34')]=_[_0x2b46('0x33')](_0x2f516b[_0x2b46('0x34')]);_0x44efec['filters']=_['intersection'](_0x44efec[_0x2b46('0x30')],_0x44efec[_0x2b46('0x34')]);_0x626141['attributes']=_[_0x2b46('0x36')](_0x44efec[_0x2b46('0x30')],qs['fields'](_0x2f516b[_0x2b46('0x34')][_0x2b46('0x38')]));_0x626141[_0x2b46('0x37')]=_0x626141['attributes'][_0x2b46('0x47')]?_0x626141[_0x2b46('0x37')]:_0x44efec['model'];if(_0x2f516b['query'][_0x2b46('0x42')]){_0x626141[_0x2b46('0x43')]=[{'all':!![]}];}_0x626141=_['merge']({},_0x626141,_0x2f516b[_0x2b46('0x40')]);return db[_0x2b46('0x2c')][_0x2b46('0x48')](_0x626141)['then'](handleEntityNotFound(_0x53e6d7,null))[_0x2b46('0x41')](respondWithResult(_0x53e6d7,null))[_0x2b46('0x49')](handleError(_0x53e6d7,null));};exports[_0x2b46('0x4a')]=function(_0x47b57b,_0x47c3f4){return db[_0x2b46('0x2c')]['create'](_0x47b57b[_0x2b46('0x4b')],{})['then'](respondWithResult(_0x47c3f4,0xc9))[_0x2b46('0x49')](handleError(_0x47c3f4,null));};exports[_0x2b46('0x25')]=function(_0xd8754d,_0x108f69){if(_0xd8754d[_0x2b46('0x4b')]['id']){delete _0xd8754d['body']['id'];}return db['ZohoConfiguration'][_0x2b46('0x48')]({'where':{'id':_0xd8754d['params']['id']}})[_0x2b46('0x41')](handleEntityNotFound(_0x108f69,null))[_0x2b46('0x41')](saveUpdates(_0xd8754d[_0x2b46('0x4b')],null))[_0x2b46('0x41')](respondWithResult(_0x108f69,null))[_0x2b46('0x49')](handleError(_0x108f69,null));};exports['destroy']=function(_0x3742df,_0x51c5c1){return db[_0x2b46('0x2c')][_0x2b46('0x48')]({'where':{'id':_0x3742df['params']['id']}})[_0x2b46('0x41')](handleEntityNotFound(_0x51c5c1,null))[_0x2b46('0x41')](removeEntity(_0x51c5c1,null))[_0x2b46('0x49')](handleError(_0x51c5c1,null));};exports[_0x2b46('0x4c')]=function(_0x84ae6c,_0x1f6894,_0x310814){var _0x21d6e0={};var _0x3b03d={};var _0x44d0b9;var _0xacdd67;return db['ZohoConfiguration'][_0x2b46('0x4d')]({'where':{'id':_0x84ae6c[_0x2b46('0x45')]['id']}})[_0x2b46('0x41')](handleEntityNotFound(_0x1f6894,null))['then'](function(_0x155a46){if(_0x155a46){_0x44d0b9=_0x155a46;_0x3b03d[_0x2b46('0x30')]=_['keys'](db[_0x2b46('0x4e')][_0x2b46('0x46')]);_0x3b03d[_0x2b46('0x34')]=_[_0x2b46('0x33')](_0x84ae6c[_0x2b46('0x34')]);_0x3b03d[_0x2b46('0x35')]=_[_0x2b46('0x36')](_0x3b03d[_0x2b46('0x30')],_0x3b03d[_0x2b46('0x34')]);_0x21d6e0['attributes']=_[_0x2b46('0x36')](_0x3b03d[_0x2b46('0x30')],qs[_0x2b46('0x38')](_0x84ae6c[_0x2b46('0x34')][_0x2b46('0x38')]));_0x21d6e0[_0x2b46('0x37')]=_0x21d6e0['attributes'][_0x2b46('0x47')]?_0x21d6e0[_0x2b46('0x37')]:_0x3b03d['model'];_0x21d6e0[_0x2b46('0x3b')]=qs['sort'](_0x84ae6c['query'][_0x2b46('0x3c')]);_0x21d6e0[_0x2b46('0x3d')]=qs[_0x2b46('0x35')](_[_0x2b46('0x4f')](_0x84ae6c['query'],_0x3b03d['filters']));if(_0x84ae6c[_0x2b46('0x34')]['filter']){_0x21d6e0['where']=_[_0x2b46('0x3f')](_0x21d6e0[_0x2b46('0x3d')],{'$or':_['map'](_0x21d6e0[_0x2b46('0x37')],function(_0x3e53f4){var _0x124839={};_0x124839[_0x3e53f4]={'$like':'%'+_0x84ae6c[_0x2b46('0x34')][_0x2b46('0x3e')]+'%'};return _0x124839;})});}_0x21d6e0=_[_0x2b46('0x3f')]({},_0x21d6e0,_0x84ae6c[_0x2b46('0x40')]);return _0x44d0b9[_0x2b46('0x4c')](_0x21d6e0);}})[_0x2b46('0x41')](function(_0x1ee3bc){if(_0x1ee3bc){_0xacdd67=_0x1ee3bc[_0x2b46('0x47')];if(!_0x84ae6c[_0x2b46('0x34')]['hasOwnProperty'](_0x2b46('0x3a'))){_0x21d6e0[_0x2b46('0x21')]=qs[_0x2b46('0x21')](_0x84ae6c[_0x2b46('0x34')]['limit']);_0x21d6e0[_0x2b46('0x20')]=qs[_0x2b46('0x20')](_0x84ae6c[_0x2b46('0x34')][_0x2b46('0x20')]);}return _0x44d0b9[_0x2b46('0x4c')](_0x21d6e0);}})[_0x2b46('0x41')](function(_0x40edc5){if(_0x40edc5){return _0x40edc5?{'count':_0xacdd67,'rows':_0x40edc5}:null;}})[_0x2b46('0x41')](respondWithResult(_0x1f6894,null))[_0x2b46('0x49')](handleError(_0x1f6894,null));};exports['getSubjects']=function(_0x998d2e,_0x27d0d0,_0x476b3b){var _0x284c05={};var _0x4ccfb9={};var _0x32f7ef;var _0x2eab05;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x998d2e[_0x2b46('0x45')]['id']}})['then'](handleEntityNotFound(_0x27d0d0,null))[_0x2b46('0x41')](function(_0x22626c){if(_0x22626c){_0x32f7ef=_0x22626c;_0x4ccfb9[_0x2b46('0x30')]=_[_0x2b46('0x33')](db['ZohoField'][_0x2b46('0x46')]);_0x4ccfb9[_0x2b46('0x34')]=_['keys'](_0x998d2e[_0x2b46('0x34')]);_0x4ccfb9[_0x2b46('0x35')]=_[_0x2b46('0x36')](_0x4ccfb9[_0x2b46('0x30')],_0x4ccfb9[_0x2b46('0x34')]);_0x284c05[_0x2b46('0x37')]=_[_0x2b46('0x36')](_0x4ccfb9[_0x2b46('0x30')],qs['fields'](_0x998d2e[_0x2b46('0x34')][_0x2b46('0x38')]));_0x284c05[_0x2b46('0x37')]=_0x284c05[_0x2b46('0x37')][_0x2b46('0x47')]?_0x284c05[_0x2b46('0x37')]:_0x4ccfb9['model'];_0x284c05['order']=qs[_0x2b46('0x3c')](_0x998d2e[_0x2b46('0x34')][_0x2b46('0x3c')]);_0x284c05['where']=qs[_0x2b46('0x35')](_[_0x2b46('0x4f')](_0x998d2e['query'],_0x4ccfb9[_0x2b46('0x35')]));if(_0x998d2e[_0x2b46('0x34')][_0x2b46('0x3e')]){_0x284c05[_0x2b46('0x3d')]=_['merge'](_0x284c05['where'],{'$or':_['map'](_0x284c05[_0x2b46('0x37')],function(_0xca0691){var _0x143b41={};_0x143b41[_0xca0691]={'$like':'%'+_0x998d2e[_0x2b46('0x34')][_0x2b46('0x3e')]+'%'};return _0x143b41;})});}_0x284c05=_[_0x2b46('0x3f')]({},_0x284c05,_0x998d2e[_0x2b46('0x40')]);return _0x32f7ef['getSubjects'](_0x284c05);}})['then'](function(_0x5e0b88){if(_0x5e0b88){_0x2eab05=_0x5e0b88[_0x2b46('0x47')];if(!_0x998d2e['query'][_0x2b46('0x39')](_0x2b46('0x3a'))){_0x284c05[_0x2b46('0x21')]=qs['limit'](_0x998d2e[_0x2b46('0x34')][_0x2b46('0x21')]);_0x284c05[_0x2b46('0x20')]=qs['offset'](_0x998d2e[_0x2b46('0x34')][_0x2b46('0x20')]);}return _0x32f7ef[_0x2b46('0x50')](_0x284c05);}})[_0x2b46('0x41')](function(_0x5ef468){if(_0x5ef468){return _0x5ef468?{'count':_0x2eab05,'rows':_0x5ef468}:null;}})['then'](respondWithResult(_0x27d0d0,null))[_0x2b46('0x49')](handleError(_0x27d0d0,null));};exports['getDescriptions']=function(_0x32bf69,_0x149438,_0x9ef28e){var _0x4dcdb6={};var _0x114f84={};var _0x45b02a;var _0x16cd01;return db[_0x2b46('0x2c')][_0x2b46('0x4d')]({'where':{'id':_0x32bf69[_0x2b46('0x45')]['id']}})[_0x2b46('0x41')](handleEntityNotFound(_0x149438,null))[_0x2b46('0x41')](function(_0x3f784b){if(_0x3f784b){_0x45b02a=_0x3f784b;_0x114f84[_0x2b46('0x30')]=_[_0x2b46('0x33')](db[_0x2b46('0x4e')][_0x2b46('0x46')]);_0x114f84[_0x2b46('0x34')]=_[_0x2b46('0x33')](_0x32bf69[_0x2b46('0x34')]);_0x114f84[_0x2b46('0x35')]=_[_0x2b46('0x36')](_0x114f84['model'],_0x114f84['query']);_0x4dcdb6[_0x2b46('0x37')]=_['intersection'](_0x114f84[_0x2b46('0x30')],qs[_0x2b46('0x38')](_0x32bf69[_0x2b46('0x34')][_0x2b46('0x38')]));_0x4dcdb6['attributes']=_0x4dcdb6['attributes'][_0x2b46('0x47')]?_0x4dcdb6[_0x2b46('0x37')]:_0x114f84['model'];_0x4dcdb6[_0x2b46('0x3b')]=qs['sort'](_0x32bf69[_0x2b46('0x34')][_0x2b46('0x3c')]);_0x4dcdb6[_0x2b46('0x3d')]=qs[_0x2b46('0x35')](_[_0x2b46('0x4f')](_0x32bf69[_0x2b46('0x34')],_0x114f84[_0x2b46('0x35')]));if(_0x32bf69[_0x2b46('0x34')][_0x2b46('0x3e')]){_0x4dcdb6[_0x2b46('0x3d')]=_[_0x2b46('0x3f')](_0x4dcdb6[_0x2b46('0x3d')],{'$or':_[_0x2b46('0x31')](_0x4dcdb6['attributes'],function(_0x31b5e3){var _0x4f3f55={};_0x4f3f55[_0x31b5e3]={'$like':'%'+_0x32bf69[_0x2b46('0x34')][_0x2b46('0x3e')]+'%'};return _0x4f3f55;})});}_0x4dcdb6=_[_0x2b46('0x3f')]({},_0x4dcdb6,_0x32bf69[_0x2b46('0x40')]);return _0x45b02a[_0x2b46('0x51')](_0x4dcdb6);}})['then'](function(_0x20dbbb){if(_0x20dbbb){_0x16cd01=_0x20dbbb[_0x2b46('0x47')];if(!_0x32bf69['query'][_0x2b46('0x39')](_0x2b46('0x3a'))){_0x4dcdb6['limit']=qs[_0x2b46('0x21')](_0x32bf69[_0x2b46('0x34')][_0x2b46('0x21')]);_0x4dcdb6['offset']=qs['offset'](_0x32bf69['query']['offset']);}return _0x45b02a[_0x2b46('0x51')](_0x4dcdb6);}})[_0x2b46('0x41')](function(_0x36ab39){if(_0x36ab39){return _0x36ab39?{'count':_0x16cd01,'rows':_0x36ab39}:null;}})[_0x2b46('0x41')](respondWithResult(_0x149438,null))[_0x2b46('0x49')](handleError(_0x149438,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 601ad5b..4cb49b4 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 _0x11be=['api','moment','path','./intZohoConfiguration.attributes','define','ZohoConfiguration','util','../../config/logger'];(function(_0x3528af,_0x3e7cf1){var _0x97721c=function(_0x1a000f){while(--_0x1a000f){_0x3528af['push'](_0x3528af['shift']());}};_0x97721c(++_0x3e7cf1);}(_0x11be,0x1c6));var _0xe11b=function(_0x257b0e,_0x563d7e){_0x257b0e=_0x257b0e-0x0;var _0x27ac2a=_0x11be[_0x257b0e];return _0x27ac2a;};'use strict';var _=require('lodash');var util=require(_0xe11b('0x0'));var logger=require(_0xe11b('0x1'))(_0xe11b('0x2'));var moment=require(_0xe11b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe11b('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe11b('0x5'));module['exports']=function(_0x4e09fb,_0x3914f7){return _0x4e09fb[_0xe11b('0x6')](_0xe11b('0x7'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb45a=['api','moment','request-promise','path','rimraf','../../config/environment','exports','ZohoConfiguration','int_zoho_configurations','../../config/logger'];(function(_0x238830,_0x545f75){var _0x5917f0=function(_0x12f821){while(--_0x12f821){_0x238830['push'](_0x238830['shift']());}};_0x5917f0(++_0x545f75);}(_0xb45a,0x10d));var _0xab45=function(_0x12cfa8,_0x2deabd){_0x12cfa8=_0x12cfa8-0x0;var _0x58390c=_0xb45a[_0x12cfa8];return _0x58390c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xab45('0x0'))(_0xab45('0x1'));var moment=require(_0xab45('0x2'));var BPromise=require('bluebird');var rp=require(_0xab45('0x3'));var fs=require('fs');var path=require(_0xab45('0x4'));var rimraf=require(_0xab45('0x5'));var config=require(_0xab45('0x6'));var attributes=require('./intZohoConfiguration.attributes');module[_0xab45('0x7')]=function(_0x2b237d,_0x368574){return _0x2b237d['define'](_0xab45('0x8'),attributes,{'tableName':_0xab45('0x9'),'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 e48b393..46373ab 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 _0x9131=['../../config/environment','http','request','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x20cf10,_0x465f55){var _0x53fe52=function(_0x1c2fb2){while(--_0x1c2fb2){_0x20cf10['push'](_0x20cf10['shift']());}};_0x53fe52(++_0x465f55);}(_0x9131,0x19a));var _0x1913=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9131[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1913('0x0'));var util=require('util');var moment=require(_0x1913('0x1'));var BPromise=require(_0x1913('0x2'));var rs=require(_0x1913('0x3'));var fs=require('fs');var Redis=require(_0x1913('0x4'));var db=require(_0x1913('0x5'))['db'];var utils=require(_0x1913('0x6'));var logger=require(_0x1913('0x7'))('rpc');var config=require(_0x1913('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1913('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d37cb,_0x1f2f50,_0x26f140){return new BPromise(function(_0x4fbcfc,_0x4d8609){return client[_0x1913('0xa')](_0x5d37cb,_0x26f140)['then'](function(_0x29d340){logger[_0x1913('0xb')](_0x1913('0xc'),_0x1f2f50,_0x1913('0xd'));logger[_0x1913('0xe')](_0x1913('0xf'),_0x1f2f50,_0x1913('0xd'),JSON[_0x1913('0x10')](_0x29d340));if(_0x29d340[_0x1913('0x11')]){if(_0x29d340[_0x1913('0x11')][_0x1913('0x12')]===0x1f4){logger[_0x1913('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x1f2f50,_0x29d340[_0x1913('0x11')]['message']);return _0x4d8609(_0x29d340[_0x1913('0x11')]['message']);}logger[_0x1913('0x11')](_0x1913('0xc'),_0x1f2f50,_0x29d340[_0x1913('0x11')][_0x1913('0x13')]);return _0x4fbcfc(_0x29d340['error']['message']);}else{logger[_0x1913('0xb')]('ZohoConfiguration,\x20%s,\x20%s',_0x1f2f50,_0x1913('0xd'));_0x4fbcfc(_0x29d340[_0x1913('0x14')][_0x1913('0x13')]);}})[_0x1913('0x15')](function(_0x1a7219){logger[_0x1913('0x11')](_0x1913('0xc'),_0x1f2f50,_0x1a7219);_0x4d8609(_0x1a7219);});});} \ No newline at end of file +var _0x2c06=['error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x13cd99,_0x50bd8d){var _0x1d42c7=function(_0x1fa433){while(--_0x1fa433){_0x13cd99['push'](_0x13cd99['shift']());}};_0x1d42c7(++_0x50bd8d);}(_0x2c06,0x1e9));var _0x62c0=function(_0x592215,_0xf22bc5){_0x592215=_0x592215-0x0;var _0x3826da=_0x2c06[_0x592215];return _0x3826da;};'use strict';var _=require(_0x62c0('0x0'));var util=require('util');var moment=require(_0x62c0('0x1'));var BPromise=require(_0x62c0('0x2'));var rs=require(_0x62c0('0x3'));var fs=require('fs');var Redis=require(_0x62c0('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x62c0('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x62c0('0x6'));var client=jayson[_0x62c0('0x7')][_0x62c0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x49cba0,_0x26dca2,_0x43af81){return new BPromise(function(_0x396776,_0x6cbd85){return client[_0x62c0('0x9')](_0x49cba0,_0x43af81)[_0x62c0('0xa')](function(_0x574f9e){logger[_0x62c0('0xb')](_0x62c0('0xc'),_0x26dca2,_0x62c0('0xd'));logger[_0x62c0('0xe')](_0x62c0('0xf'),_0x26dca2,_0x62c0('0xd'),JSON[_0x62c0('0x10')](_0x574f9e));if(_0x574f9e[_0x62c0('0x11')]){if(_0x574f9e[_0x62c0('0x11')][_0x62c0('0x12')]===0x1f4){logger['error'](_0x62c0('0xc'),_0x26dca2,_0x574f9e[_0x62c0('0x11')]['message']);return _0x6cbd85(_0x574f9e[_0x62c0('0x11')]['message']);}logger[_0x62c0('0x11')](_0x62c0('0xc'),_0x26dca2,_0x574f9e['error'][_0x62c0('0x13')]);return _0x396776(_0x574f9e[_0x62c0('0x11')][_0x62c0('0x13')]);}else{logger[_0x62c0('0xb')](_0x62c0('0xc'),_0x26dca2,_0x62c0('0xd'));_0x396776(_0x574f9e[_0x62c0('0x14')][_0x62c0('0x13')]);}})[_0x62c0('0x15')](function(_0x2d5e99){logger[_0x62c0('0x11')](_0x62c0('0xc'),_0x26dca2,_0x2d5e99);_0x6cbd85(_0x2d5e99);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index ee45688..6ce4df5 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 _0x6020=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post','/:id','update','delete','destroy'];(function(_0x1c969c,_0x2c0fbf){var _0x421d03=function(_0x2f4b4e){while(--_0x2f4b4e){_0x1c969c['push'](_0x1c969c['shift']());}};_0x421d03(++_0x2c0fbf);}(_0x6020,0x91));var _0x0602=function(_0x512661,_0x4b4012){_0x512661=_0x512661-0x0;var _0x1debde=_0x6020[_0x512661];return _0x1debde;};'use strict';var multer=require(_0x0602('0x0'));var util=require(_0x0602('0x1'));var path=require(_0x0602('0x2'));var timeout=require(_0x0602('0x3'));var express=require('express');var router=express[_0x0602('0x4')]();var fs_extra=require(_0x0602('0x5'));var auth=require(_0x0602('0x6'));var interaction=require(_0x0602('0x7'));var config=require(_0x0602('0x8'));var controller=require('./intZohoField.controller');router[_0x0602('0x9')]('/',auth[_0x0602('0xa')](),controller[_0x0602('0xb')]);router[_0x0602('0x9')]('/:id',auth[_0x0602('0xa')](),controller['show']);router[_0x0602('0xc')]('/',auth[_0x0602('0xa')](),controller['create']);router['put'](_0x0602('0xd'),auth['isAuthenticated'](),controller[_0x0602('0xe')]);router[_0x0602('0xf')](_0x0602('0xd'),auth['isAuthenticated'](),controller[_0x0602('0x10')]);module[_0x0602('0x11')]=router; \ No newline at end of file +var _0xd73a=['put','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','create'];(function(_0x3de37b,_0xce550c){var _0x144ae3=function(_0x18a447){while(--_0x18a447){_0x3de37b['push'](_0x3de37b['shift']());}};_0x144ae3(++_0xce550c);}(_0xd73a,0x1a8));var _0xad73=function(_0x375301,_0x21df95){_0x375301=_0x375301-0x0;var _0x392020=_0xd73a[_0x375301];return _0x392020;};'use strict';var multer=require(_0xad73('0x0'));var util=require(_0xad73('0x1'));var path=require('path');var timeout=require(_0xad73('0x2'));var express=require(_0xad73('0x3'));var router=express[_0xad73('0x4')]();var fs_extra=require(_0xad73('0x5'));var auth=require(_0xad73('0x6'));var interaction=require(_0xad73('0x7'));var config=require(_0xad73('0x8'));var controller=require(_0xad73('0x9'));router[_0xad73('0xa')]('/',auth[_0xad73('0xb')](),controller[_0xad73('0xc')]);router[_0xad73('0xa')](_0xad73('0xd'),auth[_0xad73('0xb')](),controller[_0xad73('0xe')]);router['post']('/',auth[_0xad73('0xb')](),controller[_0xad73('0xf')]);router[_0xad73('0x10')](_0xad73('0xd'),auth[_0xad73('0xb')](),controller['update']);router[_0xad73('0x11')](_0xad73('0xd'),auth[_0xad73('0xb')](),controller[_0xad73('0x12')]);module[_0xad73('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 13fff66..37e69ec 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 _0xa5c4=['customVariable','picklist','STRING','sequelize','exports','string','variable'];(function(_0x1d2e88,_0x410d1d){var _0x42794b=function(_0x292a66){while(--_0x292a66){_0x1d2e88['push'](_0x1d2e88['shift']());}};_0x42794b(++_0x410d1d);}(_0xa5c4,0x1e6));var _0x4a5c=function(_0x3fb5eb,_0x5947a6){_0x3fb5eb=_0x3fb5eb-0x0;var _0x481291=_0xa5c4[_0x3fb5eb];return _0x481291;};'use strict';var Sequelize=require(_0x4a5c('0x0'));module[_0x4a5c('0x1')]={'type':{'type':Sequelize['ENUM'](_0x4a5c('0x2'),_0x4a5c('0x3'),_0x4a5c('0x4'),'keyValue',_0x4a5c('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x4a5c('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x4a5c('0x2'),_0x4a5c('0x3'),_0x4a5c('0x4'))},'keyContent':{'type':Sequelize[_0x4a5c('0x6')]},'idField':{'type':Sequelize[_0x4a5c('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4a5c('0x6')]}}; \ No newline at end of file +var _0x96d9=['ENUM','string','variable','keyValue','STRING','customVariable','BOOLEAN','sequelize','exports'];(function(_0x29d2d2,_0x3344){var _0x3f6476=function(_0x29c2a2){while(--_0x29c2a2){_0x29d2d2['push'](_0x29d2d2['shift']());}};_0x3f6476(++_0x3344);}(_0x96d9,0x139));var _0x996d=function(_0x2cccdf,_0x4186fc){_0x2cccdf=_0x2cccdf-0x0;var _0x472f3f=_0x96d9[_0x2cccdf];return _0x472f3f;};'use strict';var Sequelize=require(_0x996d('0x0'));module[_0x996d('0x1')]={'type':{'type':Sequelize[_0x996d('0x2')](_0x996d('0x3'),_0x996d('0x4'),'customVariable',_0x996d('0x5'),'picklist'),'defaultValue':_0x996d('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x996d('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x996d('0x3'),_0x996d('0x4'),_0x996d('0x7'))},'keyContent':{'type':Sequelize[_0x996d('0x6')]},'idField':{'type':Sequelize[_0x996d('0x6')]},'nameField':{'type':Sequelize[_0x996d('0x6')]},'customField':{'type':Sequelize[_0x996d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 3c011ca..1ebdd18 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 _0xb679=['../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','sendStatus','name','send','index','map','type','key','model','query','filters','attributes','intersection','fields','length','nolimit','order','pick','filter','merge','where','options','ZohoField','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x549bf6,_0x4debfc){var _0x39717c=function(_0x5ae839){while(--_0x5ae839){_0x549bf6['push'](_0x549bf6['shift']());}};_0x39717c(++_0x4debfc);}(_0xb679,0x1e8));var _0x9b67=function(_0x5f2c3a,_0x24b6d3){_0x5f2c3a=_0x5f2c3a-0x0;var _0x2b1228=_0xb679[_0x5f2c3a];return _0x2b1228;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9b67('0x0'));var zipdir=require(_0x9b67('0x1'));var jsonpatch=require(_0x9b67('0x2'));var rp=require(_0x9b67('0x3'));var moment=require(_0x9b67('0x4'));var BPromise=require(_0x9b67('0x5'));var Mustache=require(_0x9b67('0x6'));var util=require(_0x9b67('0x7'));var path=require(_0x9b67('0x8'));var sox=require('sox');var csv=require(_0x9b67('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9b67('0xa'));var squel=require(_0x9b67('0xb'));var crypto=require(_0x9b67('0xc'));var jsforce=require(_0x9b67('0xd'));var deskjs=require(_0x9b67('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9b67('0xf'));var Redis=require(_0x9b67('0x10'));var authService=require(_0x9b67('0x11'));var qs=require(_0x9b67('0x12'));var as=require(_0x9b67('0x13'));var hardwareService=require(_0x9b67('0x14'));var logger=require(_0x9b67('0x15'))(_0x9b67('0x16'));var utils=require(_0x9b67('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9b67('0x18'))['db'];function respondWithStatusCode(_0x370af1,_0x4b7dca){_0x4b7dca=_0x4b7dca||0xcc;return function(_0xc05678){if(_0xc05678){return _0x370af1['sendStatus'](_0x4b7dca);}return _0x370af1[_0x9b67('0x19')](_0x4b7dca)[_0x9b67('0x1a')]();};}function respondWithResult(_0x5a4a81,_0x392521){_0x392521=_0x392521||0xc8;return function(_0x1c69f3){if(_0x1c69f3){return _0x5a4a81[_0x9b67('0x19')](_0x392521)[_0x9b67('0x1b')](_0x1c69f3);}};}function respondWithFilteredResult(_0x2dd4fd,_0x1d14e4){return function(_0x20fe14){if(_0x20fe14){var _0x29d3f6=typeof _0x1d14e4[_0x9b67('0x1c')]===_0x9b67('0x1d')&&typeof _0x1d14e4[_0x9b67('0x1e')]===_0x9b67('0x1d');var _0x2b922a=_0x20fe14[_0x9b67('0x1f')];var _0x226c64=_0x29d3f6?0x0:_0x1d14e4[_0x9b67('0x1c')];var _0x4169bb=_0x29d3f6?_0x20fe14['count']:_0x1d14e4[_0x9b67('0x1c')]+_0x1d14e4[_0x9b67('0x1e')];var _0x4e6092;if(_0x4169bb>=_0x2b922a){_0x4169bb=_0x2b922a;_0x4e6092=0xc8;}else{_0x4e6092=0xce;}_0x2dd4fd[_0x9b67('0x19')](_0x4e6092);return _0x2dd4fd['set'](_0x9b67('0x20'),_0x226c64+'-'+_0x4169bb+'/'+_0x2b922a)[_0x9b67('0x1b')](_0x20fe14);}return null;};}function patchUpdates(_0x4c8c11){return function(_0x127409){try{jsonpatch[_0x9b67('0x21')](_0x127409,_0x4c8c11,!![]);}catch(_0x25663e){return BPromise[_0x9b67('0x22')](_0x25663e);}return _0x127409[_0x9b67('0x23')]();};}function saveUpdates(_0x2465b5,_0x433d98){return function(_0x5643a7){if(_0x5643a7){return _0x5643a7[_0x9b67('0x24')](_0x2465b5)['then'](function(_0xd1c79){return _0xd1c79;});}return null;};}function removeEntity(_0x25ab9b,_0x2ea003){return function(_0x5e92d1){if(_0x5e92d1){return _0x5e92d1[_0x9b67('0x25')]()[_0x9b67('0x26')](function(){_0x25ab9b[_0x9b67('0x19')](0xcc)[_0x9b67('0x1a')]();});}};}function handleEntityNotFound(_0x572892,_0x4d45bd){return function(_0x5b33c3){if(!_0x5b33c3){_0x572892[_0x9b67('0x27')](0x194);}return _0x5b33c3;};}function handleError(_0x414e31,_0x490693){_0x490693=_0x490693||0x1f4;return function(_0x1da37c){logger['error'](_0x1da37c['stack']);if(_0x1da37c[_0x9b67('0x28')]){delete _0x1da37c[_0x9b67('0x28')];}_0x414e31['status'](_0x490693)[_0x9b67('0x29')](_0x1da37c);};}exports[_0x9b67('0x2a')]=function(_0x26950f,_0x1ee614){var _0x2d644b={},_0x322ffe={},_0x51dabd={'count':0x0,'rows':[]};var _0x1520de=_[_0x9b67('0x2b')](db['ZohoField']['rawAttributes'],function(_0x29b2c1){return{'name':_0x29b2c1['fieldName'],'type':_0x29b2c1[_0x9b67('0x2c')][_0x9b67('0x2d')]};});_0x322ffe[_0x9b67('0x2e')]=_['map'](_0x1520de,_0x9b67('0x28'));_0x322ffe['query']=_['keys'](_0x26950f[_0x9b67('0x2f')]);_0x322ffe[_0x9b67('0x30')]=_['intersection'](_0x322ffe[_0x9b67('0x2e')],_0x322ffe[_0x9b67('0x2f')]);_0x2d644b[_0x9b67('0x31')]=_[_0x9b67('0x32')](_0x322ffe[_0x9b67('0x2e')],qs[_0x9b67('0x33')](_0x26950f[_0x9b67('0x2f')][_0x9b67('0x33')]));_0x2d644b[_0x9b67('0x31')]=_0x2d644b[_0x9b67('0x31')][_0x9b67('0x34')]?_0x2d644b[_0x9b67('0x31')]:_0x322ffe[_0x9b67('0x2e')];if(!_0x26950f[_0x9b67('0x2f')]['hasOwnProperty'](_0x9b67('0x35'))){_0x2d644b[_0x9b67('0x1e')]=qs['limit'](_0x26950f[_0x9b67('0x2f')]['limit']);_0x2d644b[_0x9b67('0x1c')]=qs[_0x9b67('0x1c')](_0x26950f[_0x9b67('0x2f')][_0x9b67('0x1c')]);}_0x2d644b[_0x9b67('0x36')]=qs['sort'](_0x26950f[_0x9b67('0x2f')]['sort']);_0x2d644b['where']=qs[_0x9b67('0x30')](_[_0x9b67('0x37')](_0x26950f[_0x9b67('0x2f')],_0x322ffe['filters']),_0x1520de);if(_0x26950f[_0x9b67('0x2f')][_0x9b67('0x38')]){_0x2d644b['where']=_[_0x9b67('0x39')](_0x2d644b[_0x9b67('0x3a')],{'$or':_[_0x9b67('0x2b')](_0x1520de,function(_0x185e7d){if(_0x185e7d[_0x9b67('0x2c')]!=='VIRTUAL'){var _0x45791a={};_0x45791a[_0x185e7d[_0x9b67('0x28')]]={'$like':'%'+_0x26950f['query']['filter']+'%'};return _0x45791a;}})});}_0x2d644b=_[_0x9b67('0x39')]({},_0x2d644b,_0x26950f[_0x9b67('0x3b')]);var _0x3420e7={'where':_0x2d644b[_0x9b67('0x3a')]};return db[_0x9b67('0x3c')]['count'](_0x3420e7)['then'](function(_0x10dfe2){_0x51dabd[_0x9b67('0x1f')]=_0x10dfe2;if(_0x26950f[_0x9b67('0x2f')][_0x9b67('0x3d')]){_0x2d644b[_0x9b67('0x3e')]=[{'all':!![]}];}return db[_0x9b67('0x3c')][_0x9b67('0x3f')](_0x2d644b);})['then'](function(_0x299106){_0x51dabd[_0x9b67('0x40')]=_0x299106;return _0x51dabd;})[_0x9b67('0x26')](respondWithFilteredResult(_0x1ee614,_0x2d644b))[_0x9b67('0x41')](handleError(_0x1ee614,null));};exports[_0x9b67('0x42')]=function(_0x37acd7,_0x5c3c03){var _0x2a591f={'raw':!![],'where':{'id':_0x37acd7['params']['id']}},_0x3c1ba7={};_0x3c1ba7['model']=_[_0x9b67('0x43')](db[_0x9b67('0x3c')][_0x9b67('0x44')]);_0x3c1ba7[_0x9b67('0x2f')]=_[_0x9b67('0x43')](_0x37acd7[_0x9b67('0x2f')]);_0x3c1ba7['filters']=_[_0x9b67('0x32')](_0x3c1ba7[_0x9b67('0x2e')],_0x3c1ba7['query']);_0x2a591f[_0x9b67('0x31')]=_['intersection'](_0x3c1ba7[_0x9b67('0x2e')],qs[_0x9b67('0x33')](_0x37acd7[_0x9b67('0x2f')][_0x9b67('0x33')]));_0x2a591f[_0x9b67('0x31')]=_0x2a591f[_0x9b67('0x31')][_0x9b67('0x34')]?_0x2a591f[_0x9b67('0x31')]:_0x3c1ba7[_0x9b67('0x2e')];if(_0x37acd7[_0x9b67('0x2f')][_0x9b67('0x3d')]){_0x2a591f[_0x9b67('0x3e')]=[{'all':!![]}];}_0x2a591f=_['merge']({},_0x2a591f,_0x37acd7[_0x9b67('0x3b')]);return db[_0x9b67('0x3c')][_0x9b67('0x45')](_0x2a591f)[_0x9b67('0x26')](handleEntityNotFound(_0x5c3c03,null))['then'](respondWithResult(_0x5c3c03,null))[_0x9b67('0x41')](handleError(_0x5c3c03,null));};exports[_0x9b67('0x46')]=function(_0x73bcc4,_0x215296){return db['ZohoField'][_0x9b67('0x46')](_0x73bcc4[_0x9b67('0x47')],{})[_0x9b67('0x26')](respondWithResult(_0x215296,0xc9))[_0x9b67('0x41')](handleError(_0x215296,null));};exports[_0x9b67('0x24')]=function(_0x4bd7b1,_0xf87d00){if(_0x4bd7b1['body']['id']){delete _0x4bd7b1[_0x9b67('0x47')]['id'];}return db[_0x9b67('0x3c')][_0x9b67('0x45')]({'where':{'id':_0x4bd7b1[_0x9b67('0x48')]['id']}})[_0x9b67('0x26')](handleEntityNotFound(_0xf87d00,null))['then'](saveUpdates(_0x4bd7b1[_0x9b67('0x47')],null))[_0x9b67('0x26')](respondWithResult(_0xf87d00,null))['catch'](handleError(_0xf87d00,null));};exports[_0x9b67('0x25')]=function(_0x38d4d2,_0x48652){return db[_0x9b67('0x3c')]['find']({'where':{'id':_0x38d4d2['params']['id']}})['then'](handleEntityNotFound(_0x48652,null))[_0x9b67('0x26')](removeEntity(_0x48652,null))[_0x9b67('0x41')](handleError(_0x48652,null));}; \ No newline at end of file +var _0xbb09=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','then','destroy','error','stack','name','index','map','ZohoField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','params','find','create','body','update','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring'];(function(_0xee2e7a,_0x58354d){var _0x319dd3=function(_0xa99240){while(--_0xa99240){_0xee2e7a['push'](_0xee2e7a['shift']());}};_0x319dd3(++_0x58354d);}(_0xbb09,0x102));var _0x9bb0=function(_0x4c80d7,_0x2bef29){_0x4c80d7=_0x4c80d7-0x0;var _0x3c5095=_0xbb09[_0x4c80d7];return _0x3c5095;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9bb0('0x0'));var jsonpatch=require(_0x9bb0('0x1'));var rp=require(_0x9bb0('0x2'));var moment=require(_0x9bb0('0x3'));var BPromise=require(_0x9bb0('0x4'));var Mustache=require('mustache');var util=require(_0x9bb0('0x5'));var path=require('path');var sox=require(_0x9bb0('0x6'));var csv=require(_0x9bb0('0x7'));var ejs=require(_0x9bb0('0x8'));var fs=require('fs');var fs_extra=require(_0x9bb0('0x9'));var _=require(_0x9bb0('0xa'));var squel=require(_0x9bb0('0xb'));var crypto=require('crypto');var jsforce=require(_0x9bb0('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9bb0('0x7'));var querystring=require(_0x9bb0('0xd'));var Papa=require('papaparse');var Redis=require(_0x9bb0('0xe'));var authService=require(_0x9bb0('0xf'));var qs=require(_0x9bb0('0x10'));var as=require(_0x9bb0('0x11'));var hardwareService=require(_0x9bb0('0x12'));var logger=require(_0x9bb0('0x13'))(_0x9bb0('0x14'));var utils=require(_0x9bb0('0x15'));var config=require(_0x9bb0('0x16'));var licenseUtil=require(_0x9bb0('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16d89f,_0x488ae4){_0x488ae4=_0x488ae4||0xcc;return function(_0x3b6588){if(_0x3b6588){return _0x16d89f[_0x9bb0('0x18')](_0x488ae4);}return _0x16d89f['status'](_0x488ae4)['end']();};}function respondWithResult(_0x27180,_0x41b8ea){_0x41b8ea=_0x41b8ea||0xc8;return function(_0x4ad688){if(_0x4ad688){return _0x27180[_0x9bb0('0x19')](_0x41b8ea)[_0x9bb0('0x1a')](_0x4ad688);}};}function respondWithFilteredResult(_0x3f1e05,_0x12e3cf){return function(_0x4deba8){if(_0x4deba8){var _0x2c3bd8=typeof _0x12e3cf[_0x9bb0('0x1b')]===_0x9bb0('0x1c')&&typeof _0x12e3cf[_0x9bb0('0x1d')]===_0x9bb0('0x1c');var _0x3515ca=_0x4deba8[_0x9bb0('0x1e')];var _0x5db882=_0x2c3bd8?0x0:_0x12e3cf[_0x9bb0('0x1b')];var _0x2d26aa=_0x2c3bd8?_0x4deba8[_0x9bb0('0x1e')]:_0x12e3cf[_0x9bb0('0x1b')]+_0x12e3cf['limit'];var _0x53091c;if(_0x2d26aa>=_0x3515ca){_0x2d26aa=_0x3515ca;_0x53091c=0xc8;}else{_0x53091c=0xce;}_0x3f1e05['status'](_0x53091c);return _0x3f1e05['set'](_0x9bb0('0x1f'),_0x5db882+'-'+_0x2d26aa+'/'+_0x3515ca)[_0x9bb0('0x1a')](_0x4deba8);}return null;};}function patchUpdates(_0x313016){return function(_0xa32108){try{jsonpatch[_0x9bb0('0x20')](_0xa32108,_0x313016,!![]);}catch(_0x485fb4){return BPromise['reject'](_0x485fb4);}return _0xa32108[_0x9bb0('0x21')]();};}function saveUpdates(_0x419011,_0x2ac885){return function(_0x4013af){if(_0x4013af){return _0x4013af['update'](_0x419011)[_0x9bb0('0x22')](function(_0x1d69b6){return _0x1d69b6;});}return null;};}function removeEntity(_0x7d5c9d,_0x1e3be1){return function(_0x210d77){if(_0x210d77){return _0x210d77[_0x9bb0('0x23')]()[_0x9bb0('0x22')](function(){_0x7d5c9d[_0x9bb0('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11b247,_0x32ccb6){return function(_0x147692){if(!_0x147692){_0x11b247[_0x9bb0('0x18')](0x194);}return _0x147692;};}function handleError(_0x34e96f,_0x479aec){_0x479aec=_0x479aec||0x1f4;return function(_0x1dfa96){logger[_0x9bb0('0x24')](_0x1dfa96[_0x9bb0('0x25')]);if(_0x1dfa96[_0x9bb0('0x26')]){delete _0x1dfa96[_0x9bb0('0x26')];}_0x34e96f[_0x9bb0('0x19')](_0x479aec)['send'](_0x1dfa96);};}exports[_0x9bb0('0x27')]=function(_0x188bac,_0x3cfad3){var _0x30e6c0={},_0x4d0a0c={},_0x2e3d5a={'count':0x0,'rows':[]};var _0x11a45f=_[_0x9bb0('0x28')](db[_0x9bb0('0x29')][_0x9bb0('0x2a')],function(_0x3a4b2b){return{'name':_0x3a4b2b[_0x9bb0('0x2b')],'type':_0x3a4b2b[_0x9bb0('0x2c')][_0x9bb0('0x2d')]};});_0x4d0a0c[_0x9bb0('0x2e')]=_['map'](_0x11a45f,_0x9bb0('0x26'));_0x4d0a0c['query']=_[_0x9bb0('0x2f')](_0x188bac[_0x9bb0('0x30')]);_0x4d0a0c[_0x9bb0('0x31')]=_[_0x9bb0('0x32')](_0x4d0a0c[_0x9bb0('0x2e')],_0x4d0a0c[_0x9bb0('0x30')]);_0x30e6c0[_0x9bb0('0x33')]=_[_0x9bb0('0x32')](_0x4d0a0c['model'],qs[_0x9bb0('0x34')](_0x188bac[_0x9bb0('0x30')][_0x9bb0('0x34')]));_0x30e6c0['attributes']=_0x30e6c0[_0x9bb0('0x33')]['length']?_0x30e6c0[_0x9bb0('0x33')]:_0x4d0a0c['model'];if(!_0x188bac['query']['hasOwnProperty']('nolimit')){_0x30e6c0[_0x9bb0('0x1d')]=qs[_0x9bb0('0x1d')](_0x188bac['query']['limit']);_0x30e6c0[_0x9bb0('0x1b')]=qs[_0x9bb0('0x1b')](_0x188bac['query'][_0x9bb0('0x1b')]);}_0x30e6c0['order']=qs[_0x9bb0('0x35')](_0x188bac[_0x9bb0('0x30')][_0x9bb0('0x35')]);_0x30e6c0[_0x9bb0('0x36')]=qs['filters'](_[_0x9bb0('0x37')](_0x188bac[_0x9bb0('0x30')],_0x4d0a0c['filters']),_0x11a45f);if(_0x188bac[_0x9bb0('0x30')][_0x9bb0('0x38')]){_0x30e6c0[_0x9bb0('0x36')]=_[_0x9bb0('0x39')](_0x30e6c0[_0x9bb0('0x36')],{'$or':_[_0x9bb0('0x28')](_0x11a45f,function(_0x1e4457){if(_0x1e4457[_0x9bb0('0x2c')]!=='VIRTUAL'){var _0x1d9a30={};_0x1d9a30[_0x1e4457['name']]={'$like':'%'+_0x188bac[_0x9bb0('0x30')][_0x9bb0('0x38')]+'%'};return _0x1d9a30;}})});}_0x30e6c0=_['merge']({},_0x30e6c0,_0x188bac[_0x9bb0('0x3a')]);var _0xa1d44a={'where':_0x30e6c0[_0x9bb0('0x36')]};return db[_0x9bb0('0x29')][_0x9bb0('0x1e')](_0xa1d44a)['then'](function(_0x13962d){_0x2e3d5a[_0x9bb0('0x1e')]=_0x13962d;if(_0x188bac[_0x9bb0('0x30')][_0x9bb0('0x3b')]){_0x30e6c0[_0x9bb0('0x3c')]=[{'all':!![]}];}return db[_0x9bb0('0x29')]['findAll'](_0x30e6c0);})[_0x9bb0('0x22')](function(_0x23c581){_0x2e3d5a[_0x9bb0('0x3d')]=_0x23c581;return _0x2e3d5a;})[_0x9bb0('0x22')](respondWithFilteredResult(_0x3cfad3,_0x30e6c0))[_0x9bb0('0x3e')](handleError(_0x3cfad3,null));};exports['show']=function(_0x2f7112,_0x1ca56b){var _0x3e82e5={'raw':!![],'where':{'id':_0x2f7112[_0x9bb0('0x3f')]['id']}},_0x5c0c0c={};_0x5c0c0c[_0x9bb0('0x2e')]=_[_0x9bb0('0x2f')](db[_0x9bb0('0x29')][_0x9bb0('0x2a')]);_0x5c0c0c[_0x9bb0('0x30')]=_['keys'](_0x2f7112[_0x9bb0('0x30')]);_0x5c0c0c[_0x9bb0('0x31')]=_[_0x9bb0('0x32')](_0x5c0c0c['model'],_0x5c0c0c['query']);_0x3e82e5['attributes']=_[_0x9bb0('0x32')](_0x5c0c0c[_0x9bb0('0x2e')],qs[_0x9bb0('0x34')](_0x2f7112[_0x9bb0('0x30')][_0x9bb0('0x34')]));_0x3e82e5['attributes']=_0x3e82e5[_0x9bb0('0x33')]['length']?_0x3e82e5[_0x9bb0('0x33')]:_0x5c0c0c[_0x9bb0('0x2e')];if(_0x2f7112[_0x9bb0('0x30')][_0x9bb0('0x3b')]){_0x3e82e5[_0x9bb0('0x3c')]=[{'all':!![]}];}_0x3e82e5=_[_0x9bb0('0x39')]({},_0x3e82e5,_0x2f7112['options']);return db[_0x9bb0('0x29')][_0x9bb0('0x40')](_0x3e82e5)[_0x9bb0('0x22')](handleEntityNotFound(_0x1ca56b,null))['then'](respondWithResult(_0x1ca56b,null))[_0x9bb0('0x3e')](handleError(_0x1ca56b,null));};exports[_0x9bb0('0x41')]=function(_0x4803ae,_0x3b3fc5){return db['ZohoField'][_0x9bb0('0x41')](_0x4803ae[_0x9bb0('0x42')],{})['then'](respondWithResult(_0x3b3fc5,0xc9))[_0x9bb0('0x3e')](handleError(_0x3b3fc5,null));};exports[_0x9bb0('0x43')]=function(_0x4cc917,_0x31131b){if(_0x4cc917[_0x9bb0('0x42')]['id']){delete _0x4cc917[_0x9bb0('0x42')]['id'];}return db[_0x9bb0('0x29')][_0x9bb0('0x40')]({'where':{'id':_0x4cc917[_0x9bb0('0x3f')]['id']}})[_0x9bb0('0x22')](handleEntityNotFound(_0x31131b,null))[_0x9bb0('0x22')](saveUpdates(_0x4cc917[_0x9bb0('0x42')],null))['then'](respondWithResult(_0x31131b,null))[_0x9bb0('0x3e')](handleError(_0x31131b,null));};exports[_0x9bb0('0x23')]=function(_0xbc83e0,_0x39d01b){return db['ZohoField'][_0x9bb0('0x40')]({'where':{'id':_0xbc83e0['params']['id']}})[_0x9bb0('0x22')](handleEntityNotFound(_0x39d01b,null))[_0x9bb0('0x22')](removeEntity(_0x39d01b,null))['catch'](handleError(_0x39d01b,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index d5b7b29..6172591 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 _0x7046=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intZohoField.attributes','exports','ZohoField','idField'];(function(_0x36e534,_0x96136e){var _0x110630=function(_0x9b5a34){while(--_0x9b5a34){_0x36e534['push'](_0x36e534['shift']());}};_0x110630(++_0x96136e);}(_0x7046,0x144));var _0x6704=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7046[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var logger=require(_0x6704('0x2'))(_0x6704('0x3'));var moment=require('moment');var BPromise=require(_0x6704('0x4'));var rp=require(_0x6704('0x5'));var fs=require('fs');var path=require(_0x6704('0x6'));var rimraf=require('rimraf');var config=require(_0x6704('0x7'));var attributes=require(_0x6704('0x8'));module[_0x6704('0x9')]=function(_0x626a14,_0x2917be){return _0x626a14['define'](_0x6704('0xa'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x6704('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x01d9=['define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var logger=require(_0x901d('0x2'))(_0x901d('0x3'));var moment=require('moment');var BPromise=require(_0x901d('0x4'));var rp=require(_0x901d('0x5'));var fs=require('fs');var path=require(_0x901d('0x6'));var rimraf=require(_0x901d('0x7'));var config=require(_0x901d('0x8'));var attributes=require(_0x901d('0x9'));module[_0x901d('0xa')]=function(_0x4e7842,_0x1e5d7d){return _0x4e7842[_0x901d('0xb')](_0x901d('0xc'),attributes,{'tableName':_0x901d('0xd'),'paranoid':![],'indexes':[{'name':_0x901d('0xe'),'fields':[_0x901d('0xf'),_0x901d('0x10')],'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 0eb8d4f..25bf485 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 _0xa805=['../../config/utils','../../config/logger','rpc','http','request','info','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ZohoField,\x20%s,\x20%s','lodash','util','bluebird','randomstring'];(function(_0x5d5e13,_0x3a826c){var _0x4b2f4b=function(_0x3e4e3b){while(--_0x3e4e3b){_0x5d5e13['push'](_0x5d5e13['shift']());}};_0x4b2f4b(++_0x3a826c);}(_0xa805,0x1d0));var _0x5a80=function(_0xffc02e,_0x320346){_0xffc02e=_0xffc02e-0x0;var _0x4a6a27=_0xa805[_0xffc02e];return _0x4a6a27;};'use strict';var _=require(_0x5a80('0x0'));var util=require(_0x5a80('0x1'));var moment=require('moment');var BPromise=require(_0x5a80('0x2'));var rs=require(_0x5a80('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5a80('0x4'));var logger=require(_0x5a80('0x5'))(_0x5a80('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x5a80('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4ec187,_0x264807,_0x5db451){return new BPromise(function(_0x4c4ae9,_0x415216){return client[_0x5a80('0x8')](_0x4ec187,_0x5db451)['then'](function(_0x49977a){logger[_0x5a80('0x9')]('ZohoField,\x20%s,\x20%s',_0x264807,_0x5a80('0xa'));logger[_0x5a80('0xb')](_0x5a80('0xc'),_0x264807,_0x5a80('0xa'),JSON[_0x5a80('0xd')](_0x49977a));if(_0x49977a[_0x5a80('0xe')]){if(_0x49977a[_0x5a80('0xe')][_0x5a80('0xf')]===0x1f4){logger['error']('ZohoField,\x20%s,\x20%s',_0x264807,_0x49977a[_0x5a80('0xe')][_0x5a80('0x10')]);return _0x415216(_0x49977a[_0x5a80('0xe')]['message']);}logger[_0x5a80('0xe')](_0x5a80('0x11'),_0x264807,_0x49977a[_0x5a80('0xe')][_0x5a80('0x10')]);return _0x4c4ae9(_0x49977a['error'][_0x5a80('0x10')]);}else{logger[_0x5a80('0x9')](_0x5a80('0x11'),_0x264807,'request\x20sent');_0x4c4ae9(_0x49977a['result']['message']);}})['catch'](function(_0x4f0817){logger['error']('ZohoField,\x20%s,\x20%s',_0x264807,_0x4f0817);_0x415216(_0x4f0817);});});} \ No newline at end of file +var _0xfbe5=['../../mysqldb','rpc','client','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x469fe9,_0x12c818){var _0x3e0c24=function(_0x2d08c8){while(--_0x2d08c8){_0x469fe9['push'](_0x469fe9['shift']());}};_0x3e0c24(++_0x12c818);}(_0xfbe5,0x164));var _0x5fbe=function(_0x2dee79,_0x1e5847){_0x2dee79=_0x2dee79-0x0;var _0x5e6339=_0xfbe5[_0x2dee79];return _0x5e6339;};'use strict';var _=require(_0x5fbe('0x0'));var util=require('util');var moment=require(_0x5fbe('0x1'));var BPromise=require(_0x5fbe('0x2'));var rs=require(_0x5fbe('0x3'));var fs=require('fs');var Redis=require(_0x5fbe('0x4'));var db=require(_0x5fbe('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5fbe('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5fbe('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc04f8f,_0xc551c8,_0x590102){return new BPromise(function(_0x169db1,_0x451166){return client[_0x5fbe('0x8')](_0xc04f8f,_0x590102)[_0x5fbe('0x9')](function(_0x3cc3e7){logger[_0x5fbe('0xa')](_0x5fbe('0xb'),_0xc551c8,_0x5fbe('0xc'));logger['debug'](_0x5fbe('0xd'),_0xc551c8,'request\x20sent',JSON[_0x5fbe('0xe')](_0x3cc3e7));if(_0x3cc3e7['error']){if(_0x3cc3e7[_0x5fbe('0xf')]['code']===0x1f4){logger[_0x5fbe('0xf')](_0x5fbe('0xb'),_0xc551c8,_0x3cc3e7[_0x5fbe('0xf')]['message']);return _0x451166(_0x3cc3e7['error'][_0x5fbe('0x10')]);}logger[_0x5fbe('0xf')](_0x5fbe('0xb'),_0xc551c8,_0x3cc3e7['error'][_0x5fbe('0x10')]);return _0x169db1(_0x3cc3e7[_0x5fbe('0xf')]['message']);}else{logger[_0x5fbe('0xa')](_0x5fbe('0xb'),_0xc551c8,_0x5fbe('0xc'));_0x169db1(_0x3cc3e7[_0x5fbe('0x11')][_0x5fbe('0x10')]);}})[_0x5fbe('0x12')](function(_0x5723b7){logger[_0x5fbe('0xf')]('ZohoField,\x20%s,\x20%s',_0xc551c8,_0x5723b7);_0x451166(_0x5723b7);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index a3ef621..694f723 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x337168,_0x15997b){var _0x1f6386=function(_0x3eeef5){while(--_0x3eeef5){_0x337168['push'](_0x337168['shift']());}};_0x1f6386(++_0x15997b);}(_0x70e0,0x17b));var _0x070e=function(_0x1d8528,_0x36ec15){_0x1d8528=_0x1d8528-0x0;var _0x584934=_0x70e0[_0x1d8528];return _0x584934;};'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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x718f1f,_0x2e2338){var _0x48b289=function(_0x524e31){while(--_0x524e31){_0x718f1f['push'](_0x718f1f['shift']());}};_0x48b289(++_0x2e2338);}(_0x9c44,0x178));var _0x49c4=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x9c44[_0x422905];return _0x33dc6c;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 36a5bdc..b49af5c 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 _0x2d88=['exports','STRING','unique_name_and_version','app.js','INTEGER','state','sequelize'];(function(_0x2ba1b2,_0x1d4370){var _0x23345e=function(_0x397142){while(--_0x397142){_0x2ba1b2['push'](_0x2ba1b2['shift']());}};_0x23345e(++_0x1d4370);}(_0x2d88,0x110));var _0x82d8=function(_0x1d297a,_0x387665){_0x1d297a=_0x1d297a-0x0;var _0x5d2f48=_0x2d88[_0x1d297a];return _0x5d2f48;};'use strict';var Sequelize=require(_0x82d8('0x0'));module[_0x82d8('0x1')]={'name':{'type':Sequelize[_0x82d8('0x2')],'allowNull':![],'unique':_0x82d8('0x3')},'version':{'type':Sequelize[_0x82d8('0x2')],'allowNull':![],'unique':_0x82d8('0x3')},'main':{'type':Sequelize[_0x82d8('0x2')],'defaultValue':_0x82d8('0x4')},'filename':{'type':Sequelize[_0x82d8('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x82d8('0x2')]},'size':{'type':Sequelize[_0x82d8('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x82d8('0x2')]},'logo':{'type':Sequelize[_0x82d8('0x2')]},'state':{'type':Sequelize[_0x82d8('0x2')],'unique':_0x82d8('0x6')},'description':{'type':Sequelize[_0x82d8('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x82d8('0x2')]},'link':{'type':Sequelize[_0x82d8('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x0a9e=['INTEGER','BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version','app.js'];(function(_0x49d940,_0x184d0c){var _0x268078=function(_0x49909b){while(--_0x49909b){_0x49d940['push'](_0x49d940['shift']());}};_0x268078(++_0x184d0c);}(_0x0a9e,0x1bb));var _0xe0a9=function(_0x3c5d1d,_0x1b1b72){_0x3c5d1d=_0x3c5d1d-0x0;var _0x34a8f6=_0x0a9e[_0x3c5d1d];return _0x34a8f6;};'use strict';var Sequelize=require(_0xe0a9('0x0'));module[_0xe0a9('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0xe0a9('0x2')],'allowNull':![],'unique':_0xe0a9('0x3')},'main':{'type':Sequelize[_0xe0a9('0x2')],'defaultValue':_0xe0a9('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0xe0a9('0x2')]},'type':{'type':Sequelize[_0xe0a9('0x2')]},'size':{'type':Sequelize[_0xe0a9('0x5')]},'active':{'type':Sequelize[_0xe0a9('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0xe0a9('0x2')]},'logo':{'type':Sequelize[_0xe0a9('0x2')]},'state':{'type':Sequelize[_0xe0a9('0x2')],'unique':_0xe0a9('0x7')},'description':{'type':Sequelize[_0xe0a9('0x2')]},'title':{'type':Sequelize[_0xe0a9('0x2')]},'remoteUri':{'type':Sequelize[_0xe0a9('0x2')]},'link':{'type':Sequelize[_0xe0a9('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 96eff45..fcb28b8 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 _0x47c5=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','map','VIRTUAL','filter','merge','count','includeAll','include','findAll','show','params','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','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','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','Integration'];(function(_0x1328cf,_0x142b12){var _0x25bcbc=function(_0x5d3b7f){while(--_0x5d3b7f){_0x1328cf['push'](_0x1328cf['shift']());}};_0x25bcbc(++_0x142b12);}(_0x47c5,0x165));var _0x547c=function(_0x113a6c,_0x10df30){_0x113a6c=_0x113a6c-0x0;var _0x1ac632=_0x47c5[_0x113a6c];return _0x1ac632;};'use strict';var emlformat=require(_0x547c('0x0'));var rimraf=require(_0x547c('0x1'));var zipdir=require(_0x547c('0x2'));var jsonpatch=require(_0x547c('0x3'));var rp=require(_0x547c('0x4'));var moment=require(_0x547c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x547c('0x6'));var util=require(_0x547c('0x7'));var path=require('path');var sox=require(_0x547c('0x8'));var csv=require(_0x547c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x547c('0xa'));var _=require(_0x547c('0xb'));var squel=require(_0x547c('0xc'));var crypto=require(_0x547c('0xd'));var jsforce=require(_0x547c('0xe'));var deskjs=require(_0x547c('0xf'));var toCsv=require(_0x547c('0x9'));var querystring=require(_0x547c('0x10'));var Papa=require(_0x547c('0x11'));var Redis=require(_0x547c('0x12'));var authService=require(_0x547c('0x13'));var qs=require(_0x547c('0x14'));var as=require(_0x547c('0x15'));var hardwareService=require(_0x547c('0x16'));var logger=require(_0x547c('0x17'))(_0x547c('0x18'));var utils=require(_0x547c('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x547c('0x1a'));var db=require(_0x547c('0x1b'))['db'];function respondWithStatusCode(_0x5eea67,_0x436c19){_0x436c19=_0x436c19||0xcc;return function(_0x201d95){if(_0x201d95){return _0x5eea67[_0x547c('0x1c')](_0x436c19);}return _0x5eea67[_0x547c('0x1d')](_0x436c19)[_0x547c('0x1e')]();};}function respondWithResult(_0x150317,_0x2bc289){_0x2bc289=_0x2bc289||0xc8;return function(_0xa3c7b0){if(_0xa3c7b0){return _0x150317[_0x547c('0x1d')](_0x2bc289)[_0x547c('0x1f')](_0xa3c7b0);}};}function respondWithFilteredResult(_0x240243,_0x103455){return function(_0x39f316){if(_0x39f316){var _0x23644b=typeof _0x103455[_0x547c('0x20')]===_0x547c('0x21')&&typeof _0x103455[_0x547c('0x22')]===_0x547c('0x21');var _0x49acca=_0x39f316['count'];var _0x23fa9e=_0x23644b?0x0:_0x103455[_0x547c('0x20')];var _0xeb059e=_0x23644b?_0x39f316['count']:_0x103455[_0x547c('0x20')]+_0x103455[_0x547c('0x22')];var _0x1ddbd3;if(_0xeb059e>=_0x49acca){_0xeb059e=_0x49acca;_0x1ddbd3=0xc8;}else{_0x1ddbd3=0xce;}_0x240243['status'](_0x1ddbd3);return _0x240243[_0x547c('0x23')](_0x547c('0x24'),_0x23fa9e+'-'+_0xeb059e+'/'+_0x49acca)['json'](_0x39f316);}return null;};}function patchUpdates(_0x5453f9){return function(_0x35040a){try{jsonpatch[_0x547c('0x25')](_0x35040a,_0x5453f9,!![]);}catch(_0x4f20c1){return BPromise[_0x547c('0x26')](_0x4f20c1);}return _0x35040a[_0x547c('0x27')]();};}function saveUpdates(_0x592e46,_0x2e317a){return function(_0x17fd97){if(_0x17fd97){return _0x17fd97[_0x547c('0x28')](_0x592e46)['then'](function(_0x3a55a0){return _0x3a55a0;});}return null;};}function removeEntity(_0x361c5c,_0x470694){return function(_0x26823c){if(_0x26823c){return _0x26823c[_0x547c('0x29')]()[_0x547c('0x2a')](function(){_0x361c5c[_0x547c('0x1d')](0xcc)[_0x547c('0x1e')]();});}};}function handleEntityNotFound(_0x507895,_0x39c5f9){return function(_0x4c66b9){if(!_0x4c66b9){_0x507895['sendStatus'](0x194);}return _0x4c66b9;};}function handleError(_0x4855fd,_0x478f04){_0x478f04=_0x478f04||0x1f4;return function(_0x2c725d){logger['error'](_0x2c725d[_0x547c('0x2b')]);if(_0x2c725d['name']){delete _0x2c725d[_0x547c('0x2c')];}_0x4855fd['status'](_0x478f04)[_0x547c('0x2d')](_0x2c725d);};}exports[_0x547c('0x2e')]=function(_0x2389de,_0x30a96c){var _0x198afb={},_0x569924={},_0x575c74={'count':0x0,'rows':[]};var _0x28c282=_['map'](db[_0x547c('0x2f')][_0x547c('0x30')],function(_0x3e7652){return{'name':_0x3e7652[_0x547c('0x31')],'type':_0x3e7652[_0x547c('0x32')][_0x547c('0x33')]};});_0x569924[_0x547c('0x34')]=_['map'](_0x28c282,'name');_0x569924[_0x547c('0x35')]=_[_0x547c('0x36')](_0x2389de[_0x547c('0x35')]);_0x569924[_0x547c('0x37')]=_[_0x547c('0x38')](_0x569924[_0x547c('0x34')],_0x569924[_0x547c('0x35')]);_0x198afb[_0x547c('0x39')]=_[_0x547c('0x38')](_0x569924[_0x547c('0x34')],qs[_0x547c('0x3a')](_0x2389de[_0x547c('0x35')][_0x547c('0x3a')]));_0x198afb[_0x547c('0x39')]=_0x198afb['attributes'][_0x547c('0x3b')]?_0x198afb['attributes']:_0x569924['model'];if(!_0x2389de['query'][_0x547c('0x3c')](_0x547c('0x3d'))){_0x198afb[_0x547c('0x22')]=qs[_0x547c('0x22')](_0x2389de[_0x547c('0x35')][_0x547c('0x22')]);_0x198afb['offset']=qs['offset'](_0x2389de['query'][_0x547c('0x20')]);}_0x198afb[_0x547c('0x3e')]=qs[_0x547c('0x3f')](_0x2389de[_0x547c('0x35')][_0x547c('0x3f')]);_0x198afb[_0x547c('0x40')]=qs['filters'](_[_0x547c('0x41')](_0x2389de['query'],_0x569924[_0x547c('0x37')]),_0x28c282);if(_0x2389de[_0x547c('0x35')]['filter']){_0x198afb[_0x547c('0x40')]=_['merge'](_0x198afb['where'],{'$or':_[_0x547c('0x42')](_0x28c282,function(_0x281d52){if(_0x281d52[_0x547c('0x32')]!==_0x547c('0x43')){var _0x4c36b9={};_0x4c36b9[_0x281d52['name']]={'$like':'%'+_0x2389de[_0x547c('0x35')][_0x547c('0x44')]+'%'};return _0x4c36b9;}})});}_0x198afb=_[_0x547c('0x45')]({},_0x198afb,_0x2389de['options']);var _0x3886ae={'where':_0x198afb[_0x547c('0x40')]};return db[_0x547c('0x2f')]['count'](_0x3886ae)[_0x547c('0x2a')](function(_0x3a6a0a){_0x575c74[_0x547c('0x46')]=_0x3a6a0a;if(_0x2389de['query'][_0x547c('0x47')]){_0x198afb[_0x547c('0x48')]=[{'all':!![]}];}return db['Integration'][_0x547c('0x49')](_0x198afb);})[_0x547c('0x2a')](function(_0x9c3cb2){_0x575c74['rows']=_0x9c3cb2;return _0x575c74;})[_0x547c('0x2a')](respondWithFilteredResult(_0x30a96c,_0x198afb))['catch'](handleError(_0x30a96c,null));};exports[_0x547c('0x4a')]=function(_0x5393a2,_0xb86f5f){var _0x414b9d={'raw':![],'where':{'id':_0x5393a2[_0x547c('0x4b')]['id']}},_0x3d37d7={};_0x3d37d7[_0x547c('0x34')]=_[_0x547c('0x36')](db['Integration']['rawAttributes']);_0x3d37d7[_0x547c('0x35')]=_[_0x547c('0x36')](_0x5393a2[_0x547c('0x35')]);_0x3d37d7['filters']=_[_0x547c('0x38')](_0x3d37d7[_0x547c('0x34')],_0x3d37d7[_0x547c('0x35')]);_0x414b9d[_0x547c('0x39')]=_[_0x547c('0x38')](_0x3d37d7[_0x547c('0x34')],qs['fields'](_0x5393a2[_0x547c('0x35')][_0x547c('0x3a')]));_0x414b9d[_0x547c('0x39')]=_0x414b9d['attributes'][_0x547c('0x3b')]?_0x414b9d[_0x547c('0x39')]:_0x3d37d7[_0x547c('0x34')];if(_0x5393a2[_0x547c('0x35')]['includeAll']){_0x414b9d[_0x547c('0x48')]=[{'all':!![]}];}_0x414b9d=_['merge']({},_0x414b9d,_0x5393a2[_0x547c('0x4c')]);return db['Integration'][_0x547c('0x4d')](_0x414b9d)[_0x547c('0x2a')](handleEntityNotFound(_0xb86f5f,null))['then'](respondWithResult(_0xb86f5f,null))[_0x547c('0x4e')](handleError(_0xb86f5f,null));};exports[_0x547c('0x4f')]=function(_0xa005cc,_0x1ddf30){return db['Integration'][_0x547c('0x4f')](_0xa005cc['body'],{})['then'](respondWithResult(_0x1ddf30,0xc9))[_0x547c('0x4e')](handleError(_0x1ddf30,null));};exports[_0x547c('0x28')]=function(_0x3e3f52,_0x11a878){if(_0x3e3f52[_0x547c('0x50')]['id']){delete _0x3e3f52[_0x547c('0x50')]['id'];}return db[_0x547c('0x2f')][_0x547c('0x4d')]({'where':{'id':_0x3e3f52[_0x547c('0x4b')]['id']}})[_0x547c('0x2a')](handleEntityNotFound(_0x11a878,null))[_0x547c('0x2a')](saveUpdates(_0x3e3f52[_0x547c('0x50')],null))['then'](respondWithResult(_0x11a878,null))['catch'](handleError(_0x11a878,null));};exports[_0x547c('0x29')]=function(_0x21ea26,_0x48de6e){return db[_0x547c('0x2f')][_0x547c('0x4d')]({'where':{'id':_0x21ea26[_0x547c('0x4b')]['id']}})[_0x547c('0x2a')](handleEntityNotFound(_0x48de6e,null))[_0x547c('0x2a')](removeEntity(_0x48de6e,null))[_0x547c('0x4e')](handleError(_0x48de6e,null));}; \ No newline at end of file +var _0x781d=['../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','destroy','then','error','name','send','index','map','Integration','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','where','filters','filter','merge','VIRTUAL','includeAll','catch','show','params','rawAttributes','options','body','find','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x11ff70,_0x4c2487){var _0x84d17c=function(_0x1147a7){while(--_0x1147a7){_0x11ff70['push'](_0x11ff70['shift']());}};_0x84d17c(++_0x4c2487);}(_0x781d,0x14a));var _0xd781=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x781d[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0xd781('0x0'));var rimraf=require(_0xd781('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd781('0x2'));var moment=require(_0xd781('0x3'));var BPromise=require(_0xd781('0x4'));var Mustache=require(_0xd781('0x5'));var util=require(_0xd781('0x6'));var path=require(_0xd781('0x7'));var sox=require(_0xd781('0x8'));var csv=require(_0xd781('0x9'));var ejs=require(_0xd781('0xa'));var fs=require('fs');var fs_extra=require(_0xd781('0xb'));var _=require('lodash');var squel=require(_0xd781('0xc'));var crypto=require(_0xd781('0xd'));var jsforce=require(_0xd781('0xe'));var deskjs=require(_0xd781('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd781('0x10'));var Papa=require('papaparse');var Redis=require(_0xd781('0x11'));var authService=require(_0xd781('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd781('0x13'));var hardwareService=require(_0xd781('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xd781('0x15'));var config=require(_0xd781('0x16'));var licenseUtil=require(_0xd781('0x17'));var db=require(_0xd781('0x18'))['db'];function respondWithStatusCode(_0xbea78b,_0x1f2f1e){_0x1f2f1e=_0x1f2f1e||0xcc;return function(_0xc7758f){if(_0xc7758f){return _0xbea78b[_0xd781('0x19')](_0x1f2f1e);}return _0xbea78b[_0xd781('0x1a')](_0x1f2f1e)[_0xd781('0x1b')]();};}function respondWithResult(_0xd454e7,_0x587953){_0x587953=_0x587953||0xc8;return function(_0x477bdc){if(_0x477bdc){return _0xd454e7[_0xd781('0x1a')](_0x587953)['json'](_0x477bdc);}};}function respondWithFilteredResult(_0x3a1f48,_0x48bffc){return function(_0x294e5a){if(_0x294e5a){var _0x22d787=typeof _0x48bffc[_0xd781('0x1c')]===_0xd781('0x1d')&&typeof _0x48bffc[_0xd781('0x1e')]===_0xd781('0x1d');var _0x501b0d=_0x294e5a['count'];var _0x1407fc=_0x22d787?0x0:_0x48bffc[_0xd781('0x1c')];var _0x395d9c=_0x22d787?_0x294e5a[_0xd781('0x1f')]:_0x48bffc[_0xd781('0x1c')]+_0x48bffc[_0xd781('0x1e')];var _0x260aa8;if(_0x395d9c>=_0x501b0d){_0x395d9c=_0x501b0d;_0x260aa8=0xc8;}else{_0x260aa8=0xce;}_0x3a1f48[_0xd781('0x1a')](_0x260aa8);return _0x3a1f48['set'](_0xd781('0x20'),_0x1407fc+'-'+_0x395d9c+'/'+_0x501b0d)[_0xd781('0x21')](_0x294e5a);}return null;};}function patchUpdates(_0x1036d3){return function(_0x103758){try{jsonpatch[_0xd781('0x22')](_0x103758,_0x1036d3,!![]);}catch(_0x274665){return BPromise[_0xd781('0x23')](_0x274665);}return _0x103758['save']();};}function saveUpdates(_0xe0c65f,_0x4e2c56){return function(_0x567fdf){if(_0x567fdf){return _0x567fdf[_0xd781('0x24')](_0xe0c65f)['then'](function(_0x175ba6){return _0x175ba6;});}return null;};}function removeEntity(_0x101480,_0x395087){return function(_0x31bf57){if(_0x31bf57){return _0x31bf57[_0xd781('0x25')]()[_0xd781('0x26')](function(){_0x101480[_0xd781('0x1a')](0xcc)[_0xd781('0x1b')]();});}};}function handleEntityNotFound(_0x10940b,_0x5662db){return function(_0x529ca1){if(!_0x529ca1){_0x10940b[_0xd781('0x19')](0x194);}return _0x529ca1;};}function handleError(_0x849587,_0xdad0b1){_0xdad0b1=_0xdad0b1||0x1f4;return function(_0x57b41e){logger[_0xd781('0x27')](_0x57b41e['stack']);if(_0x57b41e['name']){delete _0x57b41e[_0xd781('0x28')];}_0x849587['status'](_0xdad0b1)[_0xd781('0x29')](_0x57b41e);};}exports[_0xd781('0x2a')]=function(_0x5c3848,_0x5b6b9d){var _0x43cc74={},_0x5b0464={},_0x296a0b={'count':0x0,'rows':[]};var _0x4a3bd3=_[_0xd781('0x2b')](db[_0xd781('0x2c')]['rawAttributes'],function(_0x54521e){return{'name':_0x54521e[_0xd781('0x2d')],'type':_0x54521e[_0xd781('0x2e')][_0xd781('0x2f')]};});_0x5b0464['model']=_['map'](_0x4a3bd3,_0xd781('0x28'));_0x5b0464[_0xd781('0x30')]=_[_0xd781('0x31')](_0x5c3848['query']);_0x5b0464['filters']=_[_0xd781('0x32')](_0x5b0464[_0xd781('0x33')],_0x5b0464['query']);_0x43cc74[_0xd781('0x34')]=_[_0xd781('0x32')](_0x5b0464['model'],qs[_0xd781('0x35')](_0x5c3848[_0xd781('0x30')][_0xd781('0x35')]));_0x43cc74[_0xd781('0x34')]=_0x43cc74['attributes'][_0xd781('0x36')]?_0x43cc74[_0xd781('0x34')]:_0x5b0464[_0xd781('0x33')];if(!_0x5c3848[_0xd781('0x30')]['hasOwnProperty'](_0xd781('0x37'))){_0x43cc74[_0xd781('0x1e')]=qs['limit'](_0x5c3848[_0xd781('0x30')]['limit']);_0x43cc74[_0xd781('0x1c')]=qs[_0xd781('0x1c')](_0x5c3848['query'][_0xd781('0x1c')]);}_0x43cc74[_0xd781('0x38')]=qs['sort'](_0x5c3848[_0xd781('0x30')]['sort']);_0x43cc74[_0xd781('0x39')]=qs[_0xd781('0x3a')](_['pick'](_0x5c3848[_0xd781('0x30')],_0x5b0464[_0xd781('0x3a')]),_0x4a3bd3);if(_0x5c3848['query'][_0xd781('0x3b')]){_0x43cc74[_0xd781('0x39')]=_[_0xd781('0x3c')](_0x43cc74['where'],{'$or':_[_0xd781('0x2b')](_0x4a3bd3,function(_0x22b94e){if(_0x22b94e[_0xd781('0x2e')]!==_0xd781('0x3d')){var _0x2e8218={};_0x2e8218[_0x22b94e[_0xd781('0x28')]]={'$like':'%'+_0x5c3848[_0xd781('0x30')][_0xd781('0x3b')]+'%'};return _0x2e8218;}})});}_0x43cc74=_[_0xd781('0x3c')]({},_0x43cc74,_0x5c3848['options']);var _0x2a60d6={'where':_0x43cc74['where']};return db[_0xd781('0x2c')][_0xd781('0x1f')](_0x2a60d6)['then'](function(_0x1a5833){_0x296a0b[_0xd781('0x1f')]=_0x1a5833;if(_0x5c3848[_0xd781('0x30')][_0xd781('0x3e')]){_0x43cc74['include']=[{'all':!![]}];}return db[_0xd781('0x2c')]['findAll'](_0x43cc74);})[_0xd781('0x26')](function(_0xcdaacf){_0x296a0b['rows']=_0xcdaacf;return _0x296a0b;})['then'](respondWithFilteredResult(_0x5b6b9d,_0x43cc74))[_0xd781('0x3f')](handleError(_0x5b6b9d,null));};exports[_0xd781('0x40')]=function(_0x15b49d,_0x23bbab){var _0x53aba6={'raw':![],'where':{'id':_0x15b49d[_0xd781('0x41')]['id']}},_0x46e7f6={};_0x46e7f6['model']=_['keys'](db[_0xd781('0x2c')][_0xd781('0x42')]);_0x46e7f6[_0xd781('0x30')]=_['keys'](_0x15b49d['query']);_0x46e7f6[_0xd781('0x3a')]=_[_0xd781('0x32')](_0x46e7f6[_0xd781('0x33')],_0x46e7f6[_0xd781('0x30')]);_0x53aba6[_0xd781('0x34')]=_[_0xd781('0x32')](_0x46e7f6['model'],qs['fields'](_0x15b49d[_0xd781('0x30')][_0xd781('0x35')]));_0x53aba6[_0xd781('0x34')]=_0x53aba6[_0xd781('0x34')][_0xd781('0x36')]?_0x53aba6['attributes']:_0x46e7f6[_0xd781('0x33')];if(_0x15b49d[_0xd781('0x30')][_0xd781('0x3e')]){_0x53aba6['include']=[{'all':!![]}];}_0x53aba6=_[_0xd781('0x3c')]({},_0x53aba6,_0x15b49d[_0xd781('0x43')]);return db[_0xd781('0x2c')]['find'](_0x53aba6)[_0xd781('0x26')](handleEntityNotFound(_0x23bbab,null))[_0xd781('0x26')](respondWithResult(_0x23bbab,null))['catch'](handleError(_0x23bbab,null));};exports['create']=function(_0x13a907,_0x16d16e){return db[_0xd781('0x2c')]['create'](_0x13a907[_0xd781('0x44')],{})[_0xd781('0x26')](respondWithResult(_0x16d16e,0xc9))[_0xd781('0x3f')](handleError(_0x16d16e,null));};exports[_0xd781('0x24')]=function(_0x336d30,_0x3828ad){if(_0x336d30[_0xd781('0x44')]['id']){delete _0x336d30['body']['id'];}return db[_0xd781('0x2c')][_0xd781('0x45')]({'where':{'id':_0x336d30[_0xd781('0x41')]['id']}})['then'](handleEntityNotFound(_0x3828ad,null))[_0xd781('0x26')](saveUpdates(_0x336d30[_0xd781('0x44')],null))['then'](respondWithResult(_0x3828ad,null))[_0xd781('0x3f')](handleError(_0x3828ad,null));};exports[_0xd781('0x25')]=function(_0x41caac,_0x207546){return db[_0xd781('0x2c')]['find']({'where':{'id':_0x41caac[_0xd781('0x41')]['id']}})['then'](handleEntityNotFound(_0x207546,null))[_0xd781('0x26')](removeEntity(_0x207546,null))['catch'](handleError(_0x207546,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 4bf5c65..07e5bc0 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 _0x3af2=['rimraf','../../config/environment','define','Integration','lodash','util','../../config/logger','api'];(function(_0x19c483,_0x3b63fc){var _0x47ae32=function(_0x5fd5a0){while(--_0x5fd5a0){_0x19c483['push'](_0x19c483['shift']());}};_0x47ae32(++_0x3b63fc);}(_0x3af2,0x124));var _0x23af=function(_0x3c4a7c,_0x2f4e3c){_0x3c4a7c=_0x3c4a7c-0x0;var _0xf13d1e=_0x3af2[_0x3c4a7c];return _0xf13d1e;};'use strict';var _=require(_0x23af('0x0'));var util=require(_0x23af('0x1'));var logger=require(_0x23af('0x2'))(_0x23af('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x23af('0x4'));var config=require(_0x23af('0x5'));var attributes=require('./integration.attributes');module['exports']=function(_0xcd4fa8,_0x7ff038){return _0xcd4fa8[_0x23af('0x6')](_0x23af('0x7'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x86e1=['moment','request-promise','path','../../config/environment','./integration.attributes','exports','Integration','integrations','../../config/logger','api'];(function(_0xe3b13,_0x5773b1){var _0x681cf=function(_0x2457c1){while(--_0x2457c1){_0xe3b13['push'](_0xe3b13['shift']());}};_0x681cf(++_0x5773b1);}(_0x86e1,0x198));var _0x186e=function(_0x2a5862,_0x58b4ae){_0x2a5862=_0x2a5862-0x0;var _0x24a06c=_0x86e1[_0x2a5862];return _0x24a06c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x186e('0x0'))(_0x186e('0x1'));var moment=require(_0x186e('0x2'));var BPromise=require('bluebird');var rp=require(_0x186e('0x3'));var fs=require('fs');var path=require(_0x186e('0x4'));var rimraf=require('rimraf');var config=require(_0x186e('0x5'));var attributes=require(_0x186e('0x6'));module[_0x186e('0x7')]=function(_0x13edd2,_0x4ce0a6){return _0x13edd2['define'](_0x186e('0x8'),attributes,{'tableName':_0x186e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index d887a06..76bf85b 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 _0x2542=['info','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x58e7a3,_0x59eda9){var _0x3e45dd=function(_0x38a400){while(--_0x38a400){_0x58e7a3['push'](_0x58e7a3['shift']());}};_0x3e45dd(++_0x59eda9);}(_0x2542,0x169));var _0x2254=function(_0x5cd298,_0x543ec8){_0x5cd298=_0x5cd298-0x0;var _0x385810=_0x2542[_0x5cd298];return _0x385810;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var BPromise=require(_0x2254('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2254('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2254('0x5'));var logger=require(_0x2254('0x6'))(_0x2254('0x7'));var config=require(_0x2254('0x8'));var jayson=require(_0x2254('0x9'));var client=jayson['client'][_0x2254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe8ca50,_0x2ee7ee,_0x3c45ec){return new BPromise(function(_0x1637ad,_0x477b47){return client[_0x2254('0xb')](_0xe8ca50,_0x3c45ec)[_0x2254('0xc')](function(_0xb395da){logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,'request\x20sent');logger[_0x2254('0xf')](_0x2254('0x10'),_0x2ee7ee,_0x2254('0x11'),JSON[_0x2254('0x12')](_0xb395da));if(_0xb395da['error']){if(_0xb395da['error'][_0x2254('0x13')]===0x1f4){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);return _0x477b47(_0xb395da[_0x2254('0x14')]['message']);}logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da['error'][_0x2254('0x15')]);return _0x1637ad(_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);}else{logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,_0x2254('0x11'));_0x1637ad(_0xb395da['result'][_0x2254('0x15')]);}})['catch'](function(_0x327d6d){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0x327d6d);_0x477b47(_0x327d6d);});});} \ No newline at end of file +var _0xd943=['info','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','error','code','Integration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then'];(function(_0x42991d,_0x48b22a){var _0x20b6dd=function(_0x175685){while(--_0x175685){_0x42991d['push'](_0x42991d['shift']());}};_0x20b6dd(++_0x48b22a);}(_0xd943,0x15d));var _0x3d94=function(_0x20c1ae,_0x4737b4){_0x20c1ae=_0x20c1ae-0x0;var _0x1f866d=_0xd943[_0x20c1ae];return _0x1f866d;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];var utils=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d94('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54e81f,_0x4d29e7,_0x20f4d1){return new BPromise(function(_0x35d36a,_0x5244c3){return client['request'](_0x54e81f,_0x20f4d1)[_0x3d94('0xa')](function(_0x27e381){logger[_0x3d94('0xb')]('Integration,\x20%s,\x20%s',_0x4d29e7,_0x3d94('0xc'));logger['debug'](_0x3d94('0xd'),_0x4d29e7,_0x3d94('0xc'),JSON['stringify'](_0x27e381));if(_0x27e381[_0x3d94('0xe')]){if(_0x27e381[_0x3d94('0xe')][_0x3d94('0xf')]===0x1f4){logger[_0x3d94('0xe')](_0x3d94('0x10'),_0x4d29e7,_0x27e381['error'][_0x3d94('0x11')]);return _0x5244c3(_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);}logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);return _0x35d36a(_0x27e381['error'][_0x3d94('0x11')]);}else{logger[_0x3d94('0xb')](_0x3d94('0x10'),_0x4d29e7,_0x3d94('0xc'));_0x35d36a(_0x27e381[_0x3d94('0x12')][_0x3d94('0x11')]);}})[_0x3d94('0x13')](function(_0x9893cb){logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x9893cb);_0x5244c3(_0x9893cb);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 4dd03e4..3540a64 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 _0x187d=['/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./integrationReport.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x67763f,_0x510e5a){var _0x2e0498=function(_0x3be690){while(--_0x3be690){_0x67763f['push'](_0x67763f['shift']());}};_0x2e0498(++_0x510e5a);}(_0x187d,0x93));var _0xd187=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x187d[_0x30ae5e];return _0x1f2e93;};'use strict';var multer=require(_0xd187('0x0'));var util=require('util');var path=require(_0xd187('0x1'));var timeout=require(_0xd187('0x2'));var express=require(_0xd187('0x3'));var router=express[_0xd187('0x4')]();var fs_extra=require(_0xd187('0x5'));var auth=require(_0xd187('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd187('0x7'));var controller=require(_0xd187('0x8'));router['get']('/',auth[_0xd187('0x9')](),controller[_0xd187('0xa')]);router[_0xd187('0xb')](_0xd187('0xc'),auth[_0xd187('0x9')](),controller[_0xd187('0xd')]);router[_0xd187('0xb')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0xf')]);router[_0xd187('0x10')]('/',auth[_0xd187('0x9')](),controller[_0xd187('0x11')]);router[_0xd187('0x12')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0x13')]);router[_0xd187('0x14')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0x15')]);module[_0xd187('0x16')]=router; \ No newline at end of file +var _0x955f=['post','create','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x221259,_0x1621fd){var _0x347599=function(_0x3de640){while(--_0x3de640){_0x221259['push'](_0x221259['shift']());}};_0x347599(++_0x1621fd);}(_0x955f,0x1eb));var _0xf955=function(_0x380fee,_0x3988dc){_0x380fee=_0x380fee-0x0;var _0x42262d=_0x955f[_0x380fee];return _0x42262d;};'use strict';var multer=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var path=require(_0xf955('0x2'));var timeout=require(_0xf955('0x3'));var express=require(_0xf955('0x4'));var router=express['Router']();var fs_extra=require(_0xf955('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf955('0x6'));var controller=require('./integrationReport.controller');router[_0xf955('0x7')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0x9')]);router['get'](_0xf955('0xa'),auth[_0xf955('0x8')](),controller['describe']);router[_0xf955('0x7')](_0xf955('0xb'),auth[_0xf955('0x8')](),controller[_0xf955('0xc')]);router[_0xf955('0xd')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0xe')]);router['put'](_0xf955('0xb'),auth['isAuthenticated'](),controller[_0xf955('0xf')]);router[_0xf955('0x10')](_0xf955('0xb'),auth['isAuthenticated'](),controller[_0xf955('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 75da303..be11e66 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 _0x634b=['STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENDING','RECEIVED','sequelize','exports'];(function(_0x1ba3df,_0x184b9e){var _0x5ab877=function(_0x520ae1){while(--_0x520ae1){_0x1ba3df['push'](_0x1ba3df['shift']());}};_0x5ab877(++_0x184b9e);}(_0x634b,0x152));var _0xb634=function(_0xde9204,_0x5c9297){_0xde9204=_0xde9204-0x0;var _0x17a34d=_0x634b[_0xde9204];return _0x17a34d;};'use strict';var Sequelize=require(_0xb634('0x0'));module[_0xb634('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0xb634('0x2')]},'exitStatus':{'type':Sequelize[_0xb634('0x2')]},'ticketId':{'type':Sequelize[_0xb634('0x2')]},'integrationId':{'type':Sequelize[_0xb634('0x3')]},'contacts':{'type':Sequelize[_0xb634('0x2')]},'uniqueid':{'type':Sequelize[_0xb634('0x2')]},'calleridnum':{'type':Sequelize[_0xb634('0x2')]},'calleridname':{'type':Sequelize[_0xb634('0x2')]},'queue':{'type':Sequelize[_0xb634('0x2')]},'interface':{'type':Sequelize[_0xb634('0x2')]},'membername':{'type':Sequelize[_0xb634('0x2')]},'agentcalledAt':{'type':Sequelize[_0xb634('0x4')]},'agentconnectAt':{'type':Sequelize[_0xb634('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xb634('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xb634('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xb634('0x3')]},'reason':{'type':Sequelize[_0xb634('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xb634('0x4')]},'agentdump':{'type':Sequelize[_0xb634('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xb634('0x2')]},'channel':{'type':Sequelize[_0xb634('0x2')]},'channelstate':{'type':Sequelize[_0xb634('0x3')]},'channelstatedesc':{'type':Sequelize[_0xb634('0x2')]},'connectedlinenum':{'type':Sequelize[_0xb634('0x2')]},'connectedlinename':{'type':Sequelize[_0xb634('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xb634('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xb634('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xb634('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xb634('0x2')]},'destcalleridnum':{'type':Sequelize[_0xb634('0x2')]},'destcalleridname':{'type':Sequelize[_0xb634('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xb634('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xb634('0x2')]},'destlanguage':{'type':Sequelize[_0xb634('0x2')]},'destaccountcode':{'type':Sequelize[_0xb634('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xb634('0x2')]},'messageId':{'type':Sequelize[_0xb634('0x2')]},'inReplyTo':{'type':Sequelize[_0xb634('0x2')]},'subject':{'type':Sequelize[_0xb634('0x2')]},'from':{'type':Sequelize[_0xb634('0x2')]},'to':{'type':Sequelize[_0xb634('0x2')]},'cc':{'type':Sequelize[_0xb634('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0xb634('0x6')]},'status':{'type':Sequelize[_0xb634('0x7')]('SENT',_0xb634('0x8'),_0xb634('0x9'),'FAILED')},'url':{'type':Sequelize[_0xb634('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xb634('0x2')]},'projectId':{'type':Sequelize[_0xb634('0x3')]}}; \ No newline at end of file +var _0xce3f=['ENUM','RECEIVED','FAILED','sequelize','STRING','INTEGER','DATE','BOOLEAN','TEXT'];(function(_0x4dc4be,_0x386dd3){var _0x177665=function(_0x5e68fa){while(--_0x5e68fa){_0x4dc4be['push'](_0x4dc4be['shift']());}};_0x177665(++_0x386dd3);}(_0xce3f,0x6f));var _0xfce3=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xce3f[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0xfce3('0x0'));module['exports']={'integration':{'type':Sequelize[_0xfce3('0x1')]},'eventChannel':{'type':Sequelize[_0xfce3('0x1')]},'exitStatus':{'type':Sequelize[_0xfce3('0x1')]},'ticketId':{'type':Sequelize[_0xfce3('0x1')]},'integrationId':{'type':Sequelize[_0xfce3('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xfce3('0x1')]},'calleridnum':{'type':Sequelize[_0xfce3('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xfce3('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xfce3('0x1')]},'agentcalledAt':{'type':Sequelize[_0xfce3('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xfce3('0x2')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xfce3('0x3')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xfce3('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xfce3('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xfce3('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0xfce3('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xfce3('0x1')]},'channel':{'type':Sequelize[_0xfce3('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xfce3('0x1')]},'connectedlinenum':{'type':Sequelize[_0xfce3('0x1')]},'connectedlinename':{'type':Sequelize[_0xfce3('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xfce3('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xfce3('0x1')]},'destchannel':{'type':Sequelize[_0xfce3('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xfce3('0x1')]},'destcalleridname':{'type':Sequelize[_0xfce3('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xfce3('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xfce3('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xfce3('0x1')]},'destexten':{'type':Sequelize[_0xfce3('0x1')]},'destpriority':{'type':Sequelize[_0xfce3('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xfce3('0x1')]},'inReplyTo':{'type':Sequelize[_0xfce3('0x1')]},'subject':{'type':Sequelize[_0xfce3('0x1')]},'from':{'type':Sequelize[_0xfce3('0x1')]},'to':{'type':Sequelize[_0xfce3('0x1')]},'cc':{'type':Sequelize[_0xfce3('0x1')]},'attachment':{'type':Sequelize[_0xfce3('0x5')]},'html':{'type':Sequelize[_0xfce3('0x5')]},'text':{'type':Sequelize[_0xfce3('0x5')]},'status':{'type':Sequelize[_0xfce3('0x6')]('SENT','SENDING',_0xfce3('0x7'),_0xfce3('0x8'))},'url':{'type':Sequelize[_0xfce3('0x1')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0xfce3('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 939ffcd..57e75a4 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 _0xe186=['findAll','rows','catch','show','params','keys','find','create','body','destroy','describe','eml-format','rimraf','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','end','error','stack','name','send','index','IntegrationReport','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include'];(function(_0x4fcacf,_0x5a3628){var _0x3999b7=function(_0x15a769){while(--_0x15a769){_0x4fcacf['push'](_0x4fcacf['shift']());}};_0x3999b7(++_0x5a3628);}(_0xe186,0x97));var _0x6e18=function(_0x40d253,_0x1205ed){_0x40d253=_0x40d253-0x0;var _0x42e3fe=_0xe186[_0x40d253];return _0x42e3fe;};'use strict';var emlformat=require(_0x6e18('0x0'));var rimraf=require(_0x6e18('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6e18('0x2'));var util=require('util');var path=require(_0x6e18('0x3'));var sox=require(_0x6e18('0x4'));var csv=require(_0x6e18('0x5'));var ejs=require(_0x6e18('0x6'));var fs=require('fs');var fs_extra=require(_0x6e18('0x7'));var _=require('lodash');var squel=require(_0x6e18('0x8'));var crypto=require('crypto');var jsforce=require(_0x6e18('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6e18('0xa'));var Papa=require(_0x6e18('0xb'));var Redis=require(_0x6e18('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x6e18('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6e18('0xe'));var logger=require('../../config/logger')('api');var utils=require(_0x6e18('0xf'));var config=require(_0x6e18('0x10'));var licenseUtil=require(_0x6e18('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2bf2b4,_0x294b3b){_0x294b3b=_0x294b3b||0xcc;return function(_0x251eeb){if(_0x251eeb){return _0x2bf2b4[_0x6e18('0x12')](_0x294b3b);}return _0x2bf2b4[_0x6e18('0x13')](_0x294b3b)['end']();};}function respondWithResult(_0x439e96,_0x3ba4fb){_0x3ba4fb=_0x3ba4fb||0xc8;return function(_0x42af07){if(_0x42af07){return _0x439e96[_0x6e18('0x13')](_0x3ba4fb)[_0x6e18('0x14')](_0x42af07);}};}function respondWithFilteredResult(_0x2ee82e,_0x37da9c){return function(_0x5ef31c){if(_0x5ef31c){var _0x1f8627=typeof _0x37da9c['offset']===_0x6e18('0x15')&&typeof _0x37da9c[_0x6e18('0x16')]===_0x6e18('0x15');var _0x1c6a4b=_0x5ef31c[_0x6e18('0x17')];var _0x2ce6fb=_0x1f8627?0x0:_0x37da9c[_0x6e18('0x18')];var _0x30dec0=_0x1f8627?_0x5ef31c[_0x6e18('0x17')]:_0x37da9c[_0x6e18('0x18')]+_0x37da9c[_0x6e18('0x16')];var _0x1f1294;if(_0x30dec0>=_0x1c6a4b){_0x30dec0=_0x1c6a4b;_0x1f1294=0xc8;}else{_0x1f1294=0xce;}_0x2ee82e[_0x6e18('0x13')](_0x1f1294);return _0x2ee82e['set'](_0x6e18('0x19'),_0x2ce6fb+'-'+_0x30dec0+'/'+_0x1c6a4b)[_0x6e18('0x14')](_0x5ef31c);}return null;};}function patchUpdates(_0xcdc995){return function(_0x4335c2){try{jsonpatch['apply'](_0x4335c2,_0xcdc995,!![]);}catch(_0x17a30d){return BPromise[_0x6e18('0x1a')](_0x17a30d);}return _0x4335c2[_0x6e18('0x1b')]();};}function saveUpdates(_0x59920c,_0x548eeb){return function(_0x2c3bc3){if(_0x2c3bc3){return _0x2c3bc3[_0x6e18('0x1c')](_0x59920c)['then'](function(_0x53c9e7){return _0x53c9e7;});}return null;};}function removeEntity(_0x6f7ccc,_0x452dcc){return function(_0x383774){if(_0x383774){return _0x383774['destroy']()[_0x6e18('0x1d')](function(){_0x6f7ccc[_0x6e18('0x13')](0xcc)[_0x6e18('0x1e')]();});}};}function handleEntityNotFound(_0x489e25,_0x348e8e){return function(_0x441d64){if(!_0x441d64){_0x489e25[_0x6e18('0x12')](0x194);}return _0x441d64;};}function handleError(_0xde3964,_0x2342bb){_0x2342bb=_0x2342bb||0x1f4;return function(_0x209ca9){logger[_0x6e18('0x1f')](_0x209ca9[_0x6e18('0x20')]);if(_0x209ca9['name']){delete _0x209ca9[_0x6e18('0x21')];}_0xde3964[_0x6e18('0x13')](_0x2342bb)[_0x6e18('0x22')](_0x209ca9);};}exports[_0x6e18('0x23')]=function(_0x3df31e,_0x5c7522){var _0x68c1c2={},_0x3ceb72={},_0x49de4c={'count':0x0,'rows':[]};var _0x1d693b=_['map'](db[_0x6e18('0x24')][_0x6e18('0x25')],function(_0x50ece9){return{'name':_0x50ece9[_0x6e18('0x26')],'type':_0x50ece9[_0x6e18('0x27')][_0x6e18('0x28')]};});_0x3ceb72[_0x6e18('0x29')]=_['map'](_0x1d693b,_0x6e18('0x21'));_0x3ceb72[_0x6e18('0x2a')]=_['keys'](_0x3df31e[_0x6e18('0x2a')]);_0x3ceb72['filters']=_[_0x6e18('0x2b')](_0x3ceb72[_0x6e18('0x29')],_0x3ceb72[_0x6e18('0x2a')]);_0x68c1c2['attributes']=_[_0x6e18('0x2b')](_0x3ceb72[_0x6e18('0x29')],qs[_0x6e18('0x2c')](_0x3df31e[_0x6e18('0x2a')][_0x6e18('0x2c')]));_0x68c1c2[_0x6e18('0x2d')]=_0x68c1c2[_0x6e18('0x2d')][_0x6e18('0x2e')]?_0x68c1c2[_0x6e18('0x2d')]:_0x3ceb72[_0x6e18('0x29')];if(!_0x3df31e[_0x6e18('0x2a')][_0x6e18('0x2f')](_0x6e18('0x30'))){_0x68c1c2[_0x6e18('0x16')]=qs[_0x6e18('0x16')](_0x3df31e['query'][_0x6e18('0x16')]);_0x68c1c2['offset']=qs['offset'](_0x3df31e[_0x6e18('0x2a')][_0x6e18('0x18')]);}_0x68c1c2[_0x6e18('0x31')]=qs[_0x6e18('0x32')](_0x3df31e[_0x6e18('0x2a')][_0x6e18('0x32')]);_0x68c1c2['where']=qs[_0x6e18('0x33')](_['pick'](_0x3df31e['query'],_0x3ceb72['filters']),_0x1d693b);if(_0x3df31e[_0x6e18('0x2a')][_0x6e18('0x34')]){_0x68c1c2[_0x6e18('0x35')]=_[_0x6e18('0x36')](_0x68c1c2[_0x6e18('0x35')],{'$or':_['map'](_0x1d693b,function(_0x293e3b){if(_0x293e3b['type']!==_0x6e18('0x37')){var _0x1e6ff4={};_0x1e6ff4[_0x293e3b[_0x6e18('0x21')]]={'$like':'%'+_0x3df31e[_0x6e18('0x2a')][_0x6e18('0x34')]+'%'};return _0x1e6ff4;}})});}_0x68c1c2=_[_0x6e18('0x36')]({},_0x68c1c2,_0x3df31e[_0x6e18('0x38')]);var _0x242673={'where':_0x68c1c2[_0x6e18('0x35')]};return db[_0x6e18('0x24')][_0x6e18('0x17')](_0x242673)[_0x6e18('0x1d')](function(_0x69e3d6){_0x49de4c['count']=_0x69e3d6;if(_0x3df31e['query'][_0x6e18('0x39')]){_0x68c1c2[_0x6e18('0x3a')]=[{'all':!![]}];}return db[_0x6e18('0x24')][_0x6e18('0x3b')](_0x68c1c2);})[_0x6e18('0x1d')](function(_0x37dfa7){_0x49de4c[_0x6e18('0x3c')]=_0x37dfa7;return _0x49de4c;})[_0x6e18('0x1d')](respondWithFilteredResult(_0x5c7522,_0x68c1c2))[_0x6e18('0x3d')](handleError(_0x5c7522,null));};exports[_0x6e18('0x3e')]=function(_0x1d46b5,_0x100e48){var _0x1839b0={'raw':![],'where':{'id':_0x1d46b5[_0x6e18('0x3f')]['id']}},_0x5b6d5b={};_0x5b6d5b['model']=_[_0x6e18('0x40')](db[_0x6e18('0x24')][_0x6e18('0x25')]);_0x5b6d5b['query']=_[_0x6e18('0x40')](_0x1d46b5['query']);_0x5b6d5b[_0x6e18('0x33')]=_['intersection'](_0x5b6d5b[_0x6e18('0x29')],_0x5b6d5b[_0x6e18('0x2a')]);_0x1839b0[_0x6e18('0x2d')]=_[_0x6e18('0x2b')](_0x5b6d5b[_0x6e18('0x29')],qs[_0x6e18('0x2c')](_0x1d46b5[_0x6e18('0x2a')][_0x6e18('0x2c')]));_0x1839b0[_0x6e18('0x2d')]=_0x1839b0[_0x6e18('0x2d')]['length']?_0x1839b0['attributes']:_0x5b6d5b[_0x6e18('0x29')];if(_0x1d46b5[_0x6e18('0x2a')][_0x6e18('0x39')]){_0x1839b0[_0x6e18('0x3a')]=[{'all':!![]}];}_0x1839b0=_[_0x6e18('0x36')]({},_0x1839b0,_0x1d46b5[_0x6e18('0x38')]);return db[_0x6e18('0x24')][_0x6e18('0x41')](_0x1839b0)[_0x6e18('0x1d')](handleEntityNotFound(_0x100e48,null))[_0x6e18('0x1d')](respondWithResult(_0x100e48,null))['catch'](handleError(_0x100e48,null));};exports[_0x6e18('0x42')]=function(_0x323129,_0x21e652){return db[_0x6e18('0x24')][_0x6e18('0x42')](_0x323129[_0x6e18('0x43')],{})[_0x6e18('0x1d')](respondWithResult(_0x21e652,0xc9))[_0x6e18('0x3d')](handleError(_0x21e652,null));};exports[_0x6e18('0x1c')]=function(_0x1f9b26,_0x765572){if(_0x1f9b26['body']['id']){delete _0x1f9b26['body']['id'];}return db[_0x6e18('0x24')][_0x6e18('0x41')]({'where':{'id':_0x1f9b26[_0x6e18('0x3f')]['id']}})[_0x6e18('0x1d')](handleEntityNotFound(_0x765572,null))[_0x6e18('0x1d')](saveUpdates(_0x1f9b26[_0x6e18('0x43')],null))[_0x6e18('0x1d')](respondWithResult(_0x765572,null))[_0x6e18('0x3d')](handleError(_0x765572,null));};exports[_0x6e18('0x44')]=function(_0x4c3496,_0xcea1b3){return db[_0x6e18('0x24')][_0x6e18('0x41')]({'where':{'id':_0x4c3496[_0x6e18('0x3f')]['id']}})[_0x6e18('0x1d')](handleEntityNotFound(_0xcea1b3,null))['then'](removeEntity(_0xcea1b3,null))[_0x6e18('0x3d')](handleError(_0xcea1b3,null));};exports[_0x6e18('0x45')]=function(_0x3110f3,_0x410127){return db[_0x6e18('0x24')][_0x6e18('0x45')]()[_0x6e18('0x1d')](respondWithResult(_0x410127,null))[_0x6e18('0x3d')](handleError(_0x410127,null));}; \ No newline at end of file +var _0x4aa4=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','apply','reject','save','update','then','error','stack','name','send','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','IntegrationReport','findAll','rows','catch','show','include','create','body','find','destroy','params','describe','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse'];(function(_0x17aa78,_0x1ca1ef){var _0x4e0514=function(_0x37340c){while(--_0x37340c){_0x17aa78['push'](_0x17aa78['shift']());}};_0x4e0514(++_0x1ca1ef);}(_0x4aa4,0xd1));var _0x44aa=function(_0x1b08c0,_0x323997){_0x1b08c0=_0x1b08c0-0x0;var _0x1ec45a=_0x4aa4[_0x1b08c0];return _0x1ec45a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x44aa('0x0'));var rp=require(_0x44aa('0x1'));var moment=require(_0x44aa('0x2'));var BPromise=require(_0x44aa('0x3'));var Mustache=require(_0x44aa('0x4'));var util=require(_0x44aa('0x5'));var path=require(_0x44aa('0x6'));var sox=require(_0x44aa('0x7'));var csv=require(_0x44aa('0x8'));var ejs=require(_0x44aa('0x9'));var fs=require('fs');var fs_extra=require(_0x44aa('0xa'));var _=require('lodash');var squel=require(_0x44aa('0xb'));var crypto=require(_0x44aa('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x44aa('0xd'));var toCsv=require('to-csv');var querystring=require(_0x44aa('0xe'));var Papa=require(_0x44aa('0xf'));var Redis=require('ioredis');var authService=require(_0x44aa('0x10'));var qs=require(_0x44aa('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x44aa('0x12'));var logger=require(_0x44aa('0x13'))(_0x44aa('0x14'));var utils=require('../../config/utils');var config=require(_0x44aa('0x15'));var licenseUtil=require(_0x44aa('0x16'));var db=require(_0x44aa('0x17'))['db'];function respondWithStatusCode(_0x534e18,_0x340e1e){_0x340e1e=_0x340e1e||0xcc;return function(_0x39754e){if(_0x39754e){return _0x534e18[_0x44aa('0x18')](_0x340e1e);}return _0x534e18['status'](_0x340e1e)[_0x44aa('0x19')]();};}function respondWithResult(_0x3b04c1,_0x23228a){_0x23228a=_0x23228a||0xc8;return function(_0x1b170d){if(_0x1b170d){return _0x3b04c1['status'](_0x23228a)[_0x44aa('0x1a')](_0x1b170d);}};}function respondWithFilteredResult(_0x3928a8,_0x2f67d6){return function(_0x5dc0e4){if(_0x5dc0e4){var _0x535dc8=typeof _0x2f67d6[_0x44aa('0x1b')]===_0x44aa('0x1c')&&typeof _0x2f67d6[_0x44aa('0x1d')]==='undefined';var _0x5aa8da=_0x5dc0e4[_0x44aa('0x1e')];var _0x20cc85=_0x535dc8?0x0:_0x2f67d6[_0x44aa('0x1b')];var _0x192f51=_0x535dc8?_0x5dc0e4['count']:_0x2f67d6['offset']+_0x2f67d6[_0x44aa('0x1d')];var _0x32d3bc;if(_0x192f51>=_0x5aa8da){_0x192f51=_0x5aa8da;_0x32d3bc=0xc8;}else{_0x32d3bc=0xce;}_0x3928a8[_0x44aa('0x1f')](_0x32d3bc);return _0x3928a8['set']('Content-Range',_0x20cc85+'-'+_0x192f51+'/'+_0x5aa8da)[_0x44aa('0x1a')](_0x5dc0e4);}return null;};}function patchUpdates(_0x9a2d3a){return function(_0xb53ee8){try{jsonpatch[_0x44aa('0x20')](_0xb53ee8,_0x9a2d3a,!![]);}catch(_0xa05a02){return BPromise[_0x44aa('0x21')](_0xa05a02);}return _0xb53ee8[_0x44aa('0x22')]();};}function saveUpdates(_0x4746e8,_0x2c24d0){return function(_0x201651){if(_0x201651){return _0x201651[_0x44aa('0x23')](_0x4746e8)[_0x44aa('0x24')](function(_0x2d3f26){return _0x2d3f26;});}return null;};}function removeEntity(_0x327eaa,_0x5dac59){return function(_0xe44143){if(_0xe44143){return _0xe44143['destroy']()[_0x44aa('0x24')](function(){_0x327eaa[_0x44aa('0x1f')](0xcc)[_0x44aa('0x19')]();});}};}function handleEntityNotFound(_0x2ce06d,_0x1cc2d6){return function(_0x460087){if(!_0x460087){_0x2ce06d[_0x44aa('0x18')](0x194);}return _0x460087;};}function handleError(_0x477c60,_0x5a4eb4){_0x5a4eb4=_0x5a4eb4||0x1f4;return function(_0x448375){logger[_0x44aa('0x25')](_0x448375[_0x44aa('0x26')]);if(_0x448375['name']){delete _0x448375[_0x44aa('0x27')];}_0x477c60[_0x44aa('0x1f')](_0x5a4eb4)[_0x44aa('0x28')](_0x448375);};}exports['index']=function(_0x2328c4,_0xde20f2){var _0x460e24={},_0x531275={},_0x1fd428={'count':0x0,'rows':[]};var _0x21c1d0=_['map'](db['IntegrationReport'][_0x44aa('0x29')],function(_0x4a128b){return{'name':_0x4a128b[_0x44aa('0x2a')],'type':_0x4a128b[_0x44aa('0x2b')][_0x44aa('0x2c')]};});_0x531275[_0x44aa('0x2d')]=_[_0x44aa('0x2e')](_0x21c1d0,_0x44aa('0x27'));_0x531275['query']=_[_0x44aa('0x2f')](_0x2328c4[_0x44aa('0x30')]);_0x531275[_0x44aa('0x31')]=_[_0x44aa('0x32')](_0x531275['model'],_0x531275['query']);_0x460e24['attributes']=_[_0x44aa('0x32')](_0x531275['model'],qs['fields'](_0x2328c4['query'][_0x44aa('0x33')]));_0x460e24[_0x44aa('0x34')]=_0x460e24['attributes'][_0x44aa('0x35')]?_0x460e24[_0x44aa('0x34')]:_0x531275[_0x44aa('0x2d')];if(!_0x2328c4[_0x44aa('0x30')][_0x44aa('0x36')](_0x44aa('0x37'))){_0x460e24[_0x44aa('0x1d')]=qs[_0x44aa('0x1d')](_0x2328c4[_0x44aa('0x30')]['limit']);_0x460e24[_0x44aa('0x1b')]=qs[_0x44aa('0x1b')](_0x2328c4[_0x44aa('0x30')][_0x44aa('0x1b')]);}_0x460e24[_0x44aa('0x38')]=qs['sort'](_0x2328c4[_0x44aa('0x30')]['sort']);_0x460e24[_0x44aa('0x39')]=qs['filters'](_[_0x44aa('0x3a')](_0x2328c4[_0x44aa('0x30')],_0x531275['filters']),_0x21c1d0);if(_0x2328c4[_0x44aa('0x30')][_0x44aa('0x3b')]){_0x460e24[_0x44aa('0x39')]=_[_0x44aa('0x3c')](_0x460e24['where'],{'$or':_[_0x44aa('0x2e')](_0x21c1d0,function(_0x3d2e5e){if(_0x3d2e5e[_0x44aa('0x2b')]!==_0x44aa('0x3d')){var _0x5b82df={};_0x5b82df[_0x3d2e5e[_0x44aa('0x27')]]={'$like':'%'+_0x2328c4[_0x44aa('0x30')][_0x44aa('0x3b')]+'%'};return _0x5b82df;}})});}_0x460e24=_[_0x44aa('0x3c')]({},_0x460e24,_0x2328c4[_0x44aa('0x3e')]);var _0x19d022={'where':_0x460e24[_0x44aa('0x39')]};return db[_0x44aa('0x3f')]['count'](_0x19d022)[_0x44aa('0x24')](function(_0x3f7074){_0x1fd428[_0x44aa('0x1e')]=_0x3f7074;if(_0x2328c4[_0x44aa('0x30')]['includeAll']){_0x460e24['include']=[{'all':!![]}];}return db['IntegrationReport'][_0x44aa('0x40')](_0x460e24);})[_0x44aa('0x24')](function(_0xad26d){_0x1fd428[_0x44aa('0x41')]=_0xad26d;return _0x1fd428;})[_0x44aa('0x24')](respondWithFilteredResult(_0xde20f2,_0x460e24))[_0x44aa('0x42')](handleError(_0xde20f2,null));};exports[_0x44aa('0x43')]=function(_0x8960b9,_0x1869a8){var _0x52b6b7={'raw':![],'where':{'id':_0x8960b9['params']['id']}},_0x5b394a={};_0x5b394a['model']=_[_0x44aa('0x2f')](db['IntegrationReport'][_0x44aa('0x29')]);_0x5b394a[_0x44aa('0x30')]=_[_0x44aa('0x2f')](_0x8960b9[_0x44aa('0x30')]);_0x5b394a['filters']=_['intersection'](_0x5b394a[_0x44aa('0x2d')],_0x5b394a[_0x44aa('0x30')]);_0x52b6b7['attributes']=_[_0x44aa('0x32')](_0x5b394a[_0x44aa('0x2d')],qs['fields'](_0x8960b9[_0x44aa('0x30')][_0x44aa('0x33')]));_0x52b6b7[_0x44aa('0x34')]=_0x52b6b7[_0x44aa('0x34')][_0x44aa('0x35')]?_0x52b6b7[_0x44aa('0x34')]:_0x5b394a[_0x44aa('0x2d')];if(_0x8960b9[_0x44aa('0x30')]['includeAll']){_0x52b6b7[_0x44aa('0x44')]=[{'all':!![]}];}_0x52b6b7=_[_0x44aa('0x3c')]({},_0x52b6b7,_0x8960b9[_0x44aa('0x3e')]);return db[_0x44aa('0x3f')]['find'](_0x52b6b7)[_0x44aa('0x24')](handleEntityNotFound(_0x1869a8,null))['then'](respondWithResult(_0x1869a8,null))['catch'](handleError(_0x1869a8,null));};exports[_0x44aa('0x45')]=function(_0x966eb,_0xf64b07){return db[_0x44aa('0x3f')][_0x44aa('0x45')](_0x966eb[_0x44aa('0x46')],{})[_0x44aa('0x24')](respondWithResult(_0xf64b07,0xc9))['catch'](handleError(_0xf64b07,null));};exports['update']=function(_0x309742,_0x3f1c7e){if(_0x309742[_0x44aa('0x46')]['id']){delete _0x309742['body']['id'];}return db[_0x44aa('0x3f')][_0x44aa('0x47')]({'where':{'id':_0x309742['params']['id']}})['then'](handleEntityNotFound(_0x3f1c7e,null))[_0x44aa('0x24')](saveUpdates(_0x309742[_0x44aa('0x46')],null))[_0x44aa('0x24')](respondWithResult(_0x3f1c7e,null))[_0x44aa('0x42')](handleError(_0x3f1c7e,null));};exports[_0x44aa('0x48')]=function(_0x44fbb8,_0x42ee98){return db[_0x44aa('0x3f')][_0x44aa('0x47')]({'where':{'id':_0x44fbb8[_0x44aa('0x49')]['id']}})[_0x44aa('0x24')](handleEntityNotFound(_0x42ee98,null))[_0x44aa('0x24')](removeEntity(_0x42ee98,null))['catch'](handleError(_0x42ee98,null));};exports[_0x44aa('0x4a')]=function(_0x1b4283,_0x208999){return db['IntegrationReport'][_0x44aa('0x4a')]()[_0x44aa('0x24')](respondWithResult(_0x208999,null))[_0x44aa('0x42')](handleError(_0x208999,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 6762835..d17d284 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 _0xe8a1=['api','moment','bluebird','request-promise','path','../../config/environment','./integrationReport.attributes','IntegrationReport','util','../../config/logger'];(function(_0x2da8e2,_0x48a6fc){var _0xa636db=function(_0x3d9955){while(--_0x3d9955){_0x2da8e2['push'](_0x2da8e2['shift']());}};_0xa636db(++_0x48a6fc);}(_0xe8a1,0x102));var _0x1e8a=function(_0x1174ec,_0x18069f){_0x1174ec=_0x1174ec-0x0;var _0x5aa5ce=_0xe8a1[_0x1174ec];return _0x5aa5ce;};'use strict';var _=require('lodash');var util=require(_0x1e8a('0x0'));var logger=require(_0x1e8a('0x1'))(_0x1e8a('0x2'));var moment=require(_0x1e8a('0x3'));var BPromise=require(_0x1e8a('0x4'));var rp=require(_0x1e8a('0x5'));var fs=require('fs');var path=require(_0x1e8a('0x6'));var rimraf=require('rimraf');var config=require(_0x1e8a('0x7'));var attributes=require(_0x1e8a('0x8'));module['exports']=function(_0x1be594,_0x409f9b){return _0x1be594['define'](_0x1e8a('0x9'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3eeb=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','report_integration'];(function(_0x155c33,_0xda628e){var _0x411ca6=function(_0x5412ea){while(--_0x5412ea){_0x155c33['push'](_0x155c33['shift']());}};_0x411ca6(++_0xda628e);}(_0x3eeb,0x176));var _0xb3ee=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x3eeb[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0xb3ee('0x0'));var util=require(_0xb3ee('0x1'));var logger=require(_0xb3ee('0x2'))(_0xb3ee('0x3'));var moment=require(_0xb3ee('0x4'));var BPromise=require(_0xb3ee('0x5'));var rp=require(_0xb3ee('0x6'));var fs=require('fs');var path=require(_0xb3ee('0x7'));var rimraf=require(_0xb3ee('0x8'));var config=require('../../config/environment');var attributes=require('./integrationReport.attributes');module[_0xb3ee('0x9')]=function(_0x3d9d51,_0x25c344){return _0x3d9d51['define']('IntegrationReport',attributes,{'tableName':_0xb3ee('0xa'),'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 db80f6f..09e4233 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 _0x6d38=['request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x3c415b,_0x11476b){var _0x53456c=function(_0x12ddea){while(--_0x12ddea){_0x3c415b['push'](_0x3c415b['shift']());}};_0x53456c(++_0x11476b);}(_0x6d38,0x1ef));var _0x86d3=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x6d38[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var moment=require(_0x86d3('0x1'));var BPromise=require(_0x86d3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86d3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x86d3('0x4'))(_0x86d3('0x5'));var config=require(_0x86d3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x86d3('0x7')][_0x86d3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33d4aa,_0x2eaa15,_0x47e654){return new BPromise(function(_0x552b07,_0x2aea31){return client[_0x86d3('0x9')](_0x33d4aa,_0x47e654)[_0x86d3('0xa')](function(_0x499640){logger['info'](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));logger['debug']('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x2eaa15,_0x86d3('0xc'),JSON[_0x86d3('0xd')](_0x499640));if(_0x499640['error']){if(_0x499640[_0x86d3('0xe')]['code']===0x1f4){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);return _0x2aea31(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640['error'][_0x86d3('0xf')]);return _0x552b07(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}else{logger[_0x86d3('0x10')](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));_0x552b07(_0x499640[_0x86d3('0x11')][_0x86d3('0xf')]);}})['catch'](function(_0x2d5ba9){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x2d5ba9);_0x2aea31(_0x2d5ba9);});});} \ No newline at end of file +var _0x687b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0x687b,0x14a));var _0xb687=function(_0x146907,_0x541dcb){_0x146907=_0x146907-0x0;var _0x47e370=_0x687b[_0x146907];return _0x47e370;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var moment=require(_0xb687('0x2'));var BPromise=require(_0xb687('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb687('0x4'))['db'];var utils=require(_0xb687('0x5'));var logger=require(_0xb687('0x6'))(_0xb687('0x7'));var config=require(_0xb687('0x8'));var jayson=require(_0xb687('0x9'));var client=jayson[_0xb687('0xa')][_0xb687('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47ffea,_0x27b750,_0x48942b){return new BPromise(function(_0x2aea59,_0xd40346){return client['request'](_0x47ffea,_0x48942b)[_0xb687('0xc')](function(_0x21e3ab){logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));logger[_0xb687('0x10')](_0xb687('0x11'),_0x27b750,_0xb687('0xf'),JSON[_0xb687('0x12')](_0x21e3ab));if(_0x21e3ab['error']){if(_0x21e3ab[_0xb687('0x13')][_0xb687('0x14')]===0x1f4){logger[_0xb687('0x13')](_0xb687('0xe'),_0x27b750,_0x21e3ab['error']['message']);return _0xd40346(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}logger['error'](_0xb687('0xe'),_0x27b750,_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);return _0x2aea59(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}else{logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));_0x2aea59(_0x21e3ab[_0xb687('0x16')][_0xb687('0x15')]);}})[_0xb687('0x17')](function(_0x19bb29){logger['error'](_0xb687('0xe'),_0x27b750,_0x19bb29);_0xd40346(_0x19bb29);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index c07ac1e..3ff5c8a 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 _0x6379=['addInterval','/:id/sub_intervals/create_many','addIntervals','/:id','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./interval.controller','get','isAuthenticated','index','show','/:id/sub_intervals','post','create'];(function(_0x3934a6,_0x152bdb){var _0x3a2a8f=function(_0xb8438d){while(--_0xb8438d){_0x3934a6['push'](_0x3934a6['shift']());}};_0x3a2a8f(++_0x152bdb);}(_0x6379,0x84));var _0x9637=function(_0x4b43c0,_0x3a8091){_0x4b43c0=_0x4b43c0-0x0;var _0x574c13=_0x6379[_0x4b43c0];return _0x574c13;};'use strict';var multer=require(_0x9637('0x0'));var util=require(_0x9637('0x1'));var path=require(_0x9637('0x2'));var timeout=require(_0x9637('0x3'));var express=require(_0x9637('0x4'));var router=express['Router']();var fs_extra=require(_0x9637('0x5'));var auth=require(_0x9637('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9637('0x7'));router[_0x9637('0x8')]('/',auth[_0x9637('0x9')](),controller[_0x9637('0xa')]);router[_0x9637('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x9637('0xb')]);router[_0x9637('0x8')](_0x9637('0xc'),auth[_0x9637('0x9')](),controller['getIntervals']);router[_0x9637('0xd')]('/',auth[_0x9637('0x9')](),controller[_0x9637('0xe')]);router[_0x9637('0xd')](_0x9637('0xc'),auth[_0x9637('0x9')](),controller[_0x9637('0xf')]);router[_0x9637('0xd')](_0x9637('0x10'),auth['isAuthenticated'](),controller[_0x9637('0x11')]);router['put'](_0x9637('0x12'),auth[_0x9637('0x9')](),controller['update']);router[_0x9637('0x13')](_0x9637('0x12'),auth[_0x9637('0x9')](),controller[_0x9637('0x14')]);module['exports']=router; \ No newline at end of file +var _0xf360=['getIntervals','post','create','addInterval','addIntervals','put','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./interval.controller','get','index','/:id','isAuthenticated','/:id/sub_intervals'];(function(_0x28df1b,_0x26df9e){var _0x5de352=function(_0x1c6045){while(--_0x1c6045){_0x28df1b['push'](_0x28df1b['shift']());}};_0x5de352(++_0x26df9e);}(_0xf360,0x13c));var _0x0f36=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xf360[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0x0f36('0x0'));var util=require('util');var path=require(_0x0f36('0x1'));var timeout=require(_0x0f36('0x2'));var express=require(_0x0f36('0x3'));var router=express[_0x0f36('0x4')]();var fs_extra=require(_0x0f36('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0f36('0x6'));var config=require(_0x0f36('0x7'));var controller=require(_0x0f36('0x8'));router[_0x0f36('0x9')]('/',auth['isAuthenticated'](),controller[_0x0f36('0xa')]);router[_0x0f36('0x9')](_0x0f36('0xb'),auth[_0x0f36('0xc')](),controller['show']);router[_0x0f36('0x9')](_0x0f36('0xd'),auth['isAuthenticated'](),controller[_0x0f36('0xe')]);router[_0x0f36('0xf')]('/',auth[_0x0f36('0xc')](),controller[_0x0f36('0x10')]);router['post'](_0x0f36('0xd'),auth[_0x0f36('0xc')](),controller[_0x0f36('0x11')]);router[_0x0f36('0xf')]('/:id/sub_intervals/create_many',auth['isAuthenticated'](),controller[_0x0f36('0x12')]);router[_0x0f36('0x13')](_0x0f36('0xb'),auth[_0x0f36('0xc')](),controller['update']);router[_0x0f36('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x0f36('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 0e73491..f7a534e 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 _0xce24=['sequelize','exports','STRING'];(function(_0xb0c11a,_0x33fdc6){var _0x46cad3=function(_0x4603cd){while(--_0x4603cd){_0xb0c11a['push'](_0xb0c11a['shift']());}};_0x46cad3(++_0x33fdc6);}(_0xce24,0x15c));var _0x4ce2=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xce24[_0x311c35];return _0x5cc50c;};'use strict';var Sequelize=require(_0x4ce2('0x0'));module[_0x4ce2('0x1')]={'name':{'type':Sequelize[_0x4ce2('0x2')]},'description':{'type':Sequelize[_0x4ce2('0x2')]},'interval':{'type':Sequelize[_0x4ce2('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x64db=['STRING','sequelize'];(function(_0xaf25ae,_0x2001c1){var _0x49732d=function(_0x5b764d){while(--_0x5b764d){_0xaf25ae['push'](_0xaf25ae['shift']());}};_0x49732d(++_0x2001c1);}(_0x64db,0x1c9));var _0xb64d=function(_0xd572b,_0x4664c1){_0xd572b=_0xd572b-0x0;var _0x437a51=_0x64db[_0xd572b];return _0x437a51;};'use strict';var Sequelize=require(_0xb64d('0x0'));module['exports']={'name':{'type':Sequelize[_0xb64d('0x1')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 62c638f..f12d2ba 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 _0x12f9=['UserProfileResource','then','error','name','send','index','map','rawAttributes','type','keys','filters','model','query','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','Interval','includeAll','findAll','rows','catch','include','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addInterval','IntervalId','getIntervals','length','nolimit','addIntervals','findOne','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','Intervals'];(function(_0x43b2e5,_0x2a167e){var _0x594034=function(_0x2f6366){while(--_0x2f6366){_0x43b2e5['push'](_0x43b2e5['shift']());}};_0x594034(++_0x2a167e);}(_0x12f9,0x85));var _0x912f=function(_0x46a6d6,_0x439f08){_0x46a6d6=_0x46a6d6-0x0;var _0x17bd9c=_0x12f9[_0x46a6d6];return _0x17bd9c;};'use strict';var emlformat=require(_0x912f('0x0'));var rimraf=require(_0x912f('0x1'));var zipdir=require(_0x912f('0x2'));var jsonpatch=require(_0x912f('0x3'));var rp=require('request-promise');var moment=require(_0x912f('0x4'));var BPromise=require(_0x912f('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x912f('0x6'));var sox=require(_0x912f('0x7'));var csv=require(_0x912f('0x8'));var ejs=require(_0x912f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x912f('0xa'));var squel=require(_0x912f('0xb'));var crypto=require(_0x912f('0xc'));var jsforce=require(_0x912f('0xd'));var deskjs=require(_0x912f('0xe'));var toCsv=require(_0x912f('0x8'));var querystring=require(_0x912f('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x912f('0x10'));var qs=require(_0x912f('0x11'));var as=require(_0x912f('0x12'));var hardwareService=require(_0x912f('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x912f('0x14'));var config=require(_0x912f('0x15'));var licenseUtil=require(_0x912f('0x16'));var db=require(_0x912f('0x17'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x2b505f,_0xa804c){_0xa804c=_0xa804c||0xcc;return function(_0x362335){if(_0x362335){return _0x2b505f[_0x912f('0x18')](_0xa804c);}return _0x2b505f['status'](_0xa804c)['end']();};}function respondWithResult(_0x28724d,_0x2f91b5){_0x2f91b5=_0x2f91b5||0xc8;return function(_0x19173a){if(_0x19173a){return _0x28724d[_0x912f('0x19')](_0x2f91b5)[_0x912f('0x1a')](_0x19173a);}};}function respondWithFilteredResult(_0x454a71,_0x307eed){return function(_0x4f62de){if(_0x4f62de){var _0x2f7977=typeof _0x307eed[_0x912f('0x1b')]===_0x912f('0x1c')&&typeof _0x307eed[_0x912f('0x1d')]===_0x912f('0x1c');var _0xa68272=_0x4f62de[_0x912f('0x1e')];var _0x3fab11=_0x2f7977?0x0:_0x307eed[_0x912f('0x1b')];var _0x1f0a59=_0x2f7977?_0x4f62de['count']:_0x307eed[_0x912f('0x1b')]+_0x307eed[_0x912f('0x1d')];var _0x1e820c;if(_0x1f0a59>=_0xa68272){_0x1f0a59=_0xa68272;_0x1e820c=0xc8;}else{_0x1e820c=0xce;}_0x454a71[_0x912f('0x19')](_0x1e820c);return _0x454a71[_0x912f('0x1f')](_0x912f('0x20'),_0x3fab11+'-'+_0x1f0a59+'/'+_0xa68272)['json'](_0x4f62de);}return null;};}function patchUpdates(_0x45324c){return function(_0x400f18){try{jsonpatch[_0x912f('0x21')](_0x400f18,_0x45324c,!![]);}catch(_0x3c03dd){return BPromise[_0x912f('0x22')](_0x3c03dd);}return _0x400f18[_0x912f('0x23')]();};}function saveUpdates(_0x34bbc4,_0x26ea46){return function(_0x244953){if(_0x244953){return _0x244953[_0x912f('0x24')](_0x34bbc4)['then'](function(_0x1cc82b){return _0x1cc82b;});}return null;};}function removeEntity(_0x36233a,_0x5aaccd){return function(_0x52830b){if(_0x52830b){return _0x52830b[_0x912f('0x25')]()['then'](function(){var _0x30985a=_0x52830b['get']({'plain':!![]});var _0x45bab3=_0x912f('0x26');return db[_0x912f('0x27')][_0x912f('0x25')]({'where':{'type':_0x45bab3,'resourceId':_0x30985a['id']}})[_0x912f('0x28')](function(){return _0x52830b;});})[_0x912f('0x28')](function(){_0x36233a[_0x912f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28afd5,_0x4a9083){return function(_0x29b86b){if(!_0x29b86b){_0x28afd5[_0x912f('0x18')](0x194);}return _0x29b86b;};}function handleError(_0x3e2f59,_0x36d107){_0x36d107=_0x36d107||0x1f4;return function(_0x575548){logger[_0x912f('0x29')](_0x575548['stack']);if(_0x575548[_0x912f('0x2a')]){delete _0x575548['name'];}_0x3e2f59[_0x912f('0x19')](_0x36d107)[_0x912f('0x2b')](_0x575548);};}exports[_0x912f('0x2c')]=function(_0x486b0a,_0x44de56){var _0x2af8bd={},_0x43ef5d={},_0x28e9a7={'count':0x0,'rows':[]};var _0x9d70d8=_[_0x912f('0x2d')](db['Interval'][_0x912f('0x2e')],function(_0x5d2a68){return{'name':_0x5d2a68['fieldName'],'type':_0x5d2a68[_0x912f('0x2f')]['key']};});_0x43ef5d['model']=_['map'](_0x9d70d8,_0x912f('0x2a'));_0x43ef5d['query']=_[_0x912f('0x30')](_0x486b0a['query']);_0x43ef5d[_0x912f('0x31')]=_['intersection'](_0x43ef5d[_0x912f('0x32')],_0x43ef5d[_0x912f('0x33')]);_0x2af8bd[_0x912f('0x34')]=_[_0x912f('0x35')](_0x43ef5d[_0x912f('0x32')],qs['fields'](_0x486b0a[_0x912f('0x33')][_0x912f('0x36')]));_0x2af8bd[_0x912f('0x34')]=_0x2af8bd[_0x912f('0x34')]['length']?_0x2af8bd['attributes']:_0x43ef5d[_0x912f('0x32')];if(!_0x486b0a[_0x912f('0x33')][_0x912f('0x37')]('nolimit')){_0x2af8bd[_0x912f('0x1d')]=qs[_0x912f('0x1d')](_0x486b0a[_0x912f('0x33')]['limit']);_0x2af8bd[_0x912f('0x1b')]=qs[_0x912f('0x1b')](_0x486b0a[_0x912f('0x33')][_0x912f('0x1b')]);}_0x2af8bd[_0x912f('0x38')]=qs[_0x912f('0x39')](_0x486b0a[_0x912f('0x33')][_0x912f('0x39')]);_0x2af8bd[_0x912f('0x3a')]=qs['filters'](_[_0x912f('0x3b')](_0x486b0a[_0x912f('0x33')],_0x43ef5d[_0x912f('0x31')]),_0x9d70d8);if(_0x486b0a['query']['filter']){_0x2af8bd[_0x912f('0x3a')]=_[_0x912f('0x3c')](_0x2af8bd['where'],{'$or':_[_0x912f('0x2d')](_0x9d70d8,function(_0x359e6b){if(_0x359e6b['type']!==_0x912f('0x3d')){var _0x143d47={};_0x143d47[_0x359e6b['name']]={'$like':'%'+_0x486b0a[_0x912f('0x33')][_0x912f('0x3e')]+'%'};return _0x143d47;}})});}_0x2af8bd=_[_0x912f('0x3c')]({},_0x2af8bd,_0x486b0a['options']);var _0x2fd94a={'where':_0x2af8bd[_0x912f('0x3a')]};return db[_0x912f('0x3f')][_0x912f('0x1e')](_0x2fd94a)[_0x912f('0x28')](function(_0x414767){_0x28e9a7['count']=_0x414767;if(_0x486b0a[_0x912f('0x33')][_0x912f('0x40')]){_0x2af8bd['include']=[{'all':!![]}];}return db[_0x912f('0x3f')][_0x912f('0x41')](_0x2af8bd);})[_0x912f('0x28')](function(_0x5627c6){_0x28e9a7[_0x912f('0x42')]=_0x5627c6;return _0x28e9a7;})['then'](respondWithFilteredResult(_0x44de56,_0x2af8bd))[_0x912f('0x43')](handleError(_0x44de56,null));};exports['show']=function(_0x4a229e,_0x264bde){var _0x6c20bb={'raw':!![],'where':{'id':_0x4a229e['params']['id']}},_0x5ecbe1={};_0x5ecbe1['model']=_[_0x912f('0x30')](db[_0x912f('0x3f')][_0x912f('0x2e')]);_0x5ecbe1[_0x912f('0x33')]=_[_0x912f('0x30')](_0x4a229e[_0x912f('0x33')]);_0x5ecbe1[_0x912f('0x31')]=_[_0x912f('0x35')](_0x5ecbe1['model'],_0x5ecbe1[_0x912f('0x33')]);_0x6c20bb['attributes']=_[_0x912f('0x35')](_0x5ecbe1[_0x912f('0x32')],qs[_0x912f('0x36')](_0x4a229e['query'][_0x912f('0x36')]));_0x6c20bb['attributes']=_0x6c20bb[_0x912f('0x34')]['length']?_0x6c20bb[_0x912f('0x34')]:_0x5ecbe1['model'];if(_0x4a229e['query']['includeAll']){_0x6c20bb[_0x912f('0x44')]=[{'all':!![]}];}_0x6c20bb=_[_0x912f('0x3c')]({},_0x6c20bb,_0x4a229e[_0x912f('0x45')]);return db['Interval'][_0x912f('0x46')](_0x6c20bb)[_0x912f('0x28')](handleEntityNotFound(_0x264bde,null))[_0x912f('0x28')](respondWithResult(_0x264bde,null))[_0x912f('0x43')](handleError(_0x264bde,null));};exports['create']=function(_0x2f0793,_0x55522a){return db['Interval'][_0x912f('0x47')](_0x2f0793[_0x912f('0x48')],{})[_0x912f('0x28')](function(_0x5ccf15){var _0x3097fd=_0x2f0793[_0x912f('0x49')][_0x912f('0x4a')]({'plain':!![]});if(!_0x3097fd)throw new Error(_0x912f('0x4b'));if(_0x3097fd['role']===_0x912f('0x49')){var _0x5802f2=_0x5ccf15[_0x912f('0x4a')]({'plain':!![]});var _0x3d70bc='Intervals';return db[_0x912f('0x4c')][_0x912f('0x46')]({'where':{'name':_0x3d70bc,'userProfileId':_0x3097fd['userProfileId']},'raw':!![]})[_0x912f('0x28')](function(_0x1de543){if(_0x1de543&&_0x1de543['autoAssociation']===0x0){return db[_0x912f('0x27')]['create']({'name':_0x5802f2[_0x912f('0x2a')],'resourceId':_0x5802f2['id'],'type':_0x1de543[_0x912f('0x2a')],'sectionId':_0x1de543['id']},{})['then'](function(){return _0x5ccf15;});}else{return _0x5ccf15;}})[_0x912f('0x43')](function(_0x39434b){logger['error'](_0x912f('0x4d'),_0x39434b);throw _0x39434b;});}return _0x5ccf15;})[_0x912f('0x28')](respondWithResult(_0x55522a,0xc9))[_0x912f('0x43')](handleError(_0x55522a,null));};exports[_0x912f('0x24')]=function(_0x25262e,_0x5331b8){if(_0x25262e[_0x912f('0x48')]['id']){delete _0x25262e[_0x912f('0x48')]['id'];}return db[_0x912f('0x3f')][_0x912f('0x46')]({'where':{'id':_0x25262e[_0x912f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5331b8,null))[_0x912f('0x28')](saveUpdates(_0x25262e['body'],null))[_0x912f('0x28')](respondWithResult(_0x5331b8,null))[_0x912f('0x43')](handleError(_0x5331b8,null));};exports[_0x912f('0x25')]=function(_0x39c3b8,_0x5246ed){return db['Interval'][_0x912f('0x46')]({'where':{'id':_0x39c3b8[_0x912f('0x4e')]['id']}})[_0x912f('0x28')](handleEntityNotFound(_0x5246ed,null))[_0x912f('0x28')](removeEntity(_0x5246ed,null))[_0x912f('0x43')](handleError(_0x5246ed,null));};exports[_0x912f('0x4f')]=function(_0x5ea219,_0xcea3c4,_0x41a20f){if(_0x5ea219[_0x912f('0x48')]['id']){delete _0x5ea219[_0x912f('0x48')]['id'];}return db[_0x912f('0x3f')]['find']({'where':{'id':_0x5ea219[_0x912f('0x4e')]['id']}})['then'](handleEntityNotFound(_0xcea3c4,null))[_0x912f('0x28')](function(_0x1683fc){if(_0x1683fc){_0x5ea219[_0x912f('0x48')][_0x912f('0x50')]=_0x1683fc['id'];return db[_0x912f('0x3f')][_0x912f('0x47')](_0x5ea219[_0x912f('0x48')]);}})[_0x912f('0x28')](respondWithResult(_0xcea3c4,null))[_0x912f('0x43')](handleError(_0xcea3c4,null));};exports[_0x912f('0x51')]=function(_0x2ff819,_0x25c9ed,_0x4a2ee5){var _0x1c1272={};var _0x30de35={};var _0x371b1b;var _0x485015;return db[_0x912f('0x3f')]['findOne']({'where':{'id':_0x2ff819[_0x912f('0x4e')]['id']}})[_0x912f('0x28')](handleEntityNotFound(_0x25c9ed,null))['then'](function(_0x53a71c){if(_0x53a71c){_0x371b1b=_0x53a71c;_0x30de35['model']=_[_0x912f('0x30')](db['Interval'][_0x912f('0x2e')]);_0x30de35[_0x912f('0x33')]=_[_0x912f('0x30')](_0x2ff819[_0x912f('0x33')]);_0x30de35[_0x912f('0x31')]=_[_0x912f('0x35')](_0x30de35['model'],_0x30de35[_0x912f('0x33')]);_0x1c1272[_0x912f('0x34')]=_['intersection'](_0x30de35[_0x912f('0x32')],qs[_0x912f('0x36')](_0x2ff819[_0x912f('0x33')][_0x912f('0x36')]));_0x1c1272[_0x912f('0x34')]=_0x1c1272[_0x912f('0x34')][_0x912f('0x52')]?_0x1c1272['attributes']:_0x30de35[_0x912f('0x32')];_0x1c1272[_0x912f('0x38')]=qs['sort'](_0x2ff819[_0x912f('0x33')][_0x912f('0x39')]);_0x1c1272[_0x912f('0x3a')]=qs[_0x912f('0x31')](_[_0x912f('0x3b')](_0x2ff819['query'],_0x30de35[_0x912f('0x31')]));if(_0x2ff819[_0x912f('0x33')][_0x912f('0x3e')]){_0x1c1272[_0x912f('0x3a')]=_[_0x912f('0x3c')](_0x1c1272[_0x912f('0x3a')],{'$or':_[_0x912f('0x2d')](_0x1c1272[_0x912f('0x34')],function(_0x32f6bf){var _0x130dcc={};_0x130dcc[_0x32f6bf]={'$like':'%'+_0x2ff819['query']['filter']+'%'};return _0x130dcc;})});}_0x1c1272=_[_0x912f('0x3c')]({},_0x1c1272,_0x2ff819[_0x912f('0x45')]);return _0x371b1b[_0x912f('0x51')](_0x1c1272);}})['then'](function(_0x3ef21d){if(_0x3ef21d){_0x485015=_0x3ef21d[_0x912f('0x52')];if(!_0x2ff819[_0x912f('0x33')][_0x912f('0x37')](_0x912f('0x53'))){_0x1c1272['limit']=qs['limit'](_0x2ff819[_0x912f('0x33')][_0x912f('0x1d')]);_0x1c1272[_0x912f('0x1b')]=qs[_0x912f('0x1b')](_0x2ff819['query'][_0x912f('0x1b')]);}return _0x371b1b[_0x912f('0x51')](_0x1c1272);}})[_0x912f('0x28')](function(_0x5c7a1e){if(_0x5c7a1e){return _0x5c7a1e?{'count':_0x485015,'rows':_0x5c7a1e}:null;}})[_0x912f('0x28')](respondWithResult(_0x25c9ed,null))['catch'](handleError(_0x25c9ed,null));};exports[_0x912f('0x54')]=function(_0x897798,_0x386bb8,_0x44e0f2){return db[_0x912f('0x3f')][_0x912f('0x55')]({'where':{'id':_0x897798[_0x912f('0x4e')]['id']}})[_0x912f('0x28')](handleEntityNotFound(_0x386bb8,null))[_0x912f('0x28')](function(_0x1fdb33){if(_0x1fdb33){return db['sequelize']['transaction'](function(_0x589ecc){return db[_0x912f('0x3f')][_0x912f('0x25')]({'where':{'IntervalId':_0x897798['params']['id']},'transaction':_0x589ecc})[_0x912f('0x28')](function(_0x5ebe39){var _0x3b8dd2=_[_0x912f('0x2d')](_0x897798[_0x912f('0x48')],function(_0x5d1cca){delete _0x5d1cca['id'];_0x5d1cca[_0x912f('0x50')]=_0x897798[_0x912f('0x4e')]['id'];return _0x5d1cca;});return db['Interval']['bulkCreate'](_0x3b8dd2,{'transaction':_0x589ecc});});})[_0x912f('0x28')](function(){return db[_0x912f('0x3f')]['findAll']({'where':{'IntervalId':_0x897798[_0x912f('0x4e')]['id']}});});}})[_0x912f('0x28')](respondWithResult(_0x386bb8,null))[_0x912f('0x43')](handleError(_0x386bb8,null));}; \ No newline at end of file +var _0x363f=['body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','IntervalId','getIntervals','addIntervals','findOne','sequelize','transaction','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','get','Intervals','UserProfileResource','error','stack','name','index','map','rawAttributes','type','model','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','filter','merge','options','includeAll','Interval','findAll','rows','catch','show','params','keys','fields','include','find','create'];(function(_0x5baf32,_0x103278){var _0x539cae=function(_0x43c0c2){while(--_0x43c0c2){_0x5baf32['push'](_0x5baf32['shift']());}};_0x539cae(++_0x103278);}(_0x363f,0x66));var _0xf363=function(_0x14b485,_0x3d2b70){_0x14b485=_0x14b485-0x0;var _0x109ff3=_0x363f[_0x14b485];return _0x109ff3;};'use strict';var emlformat=require(_0xf363('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf363('0x1'));var rp=require(_0xf363('0x2'));var moment=require(_0xf363('0x3'));var BPromise=require(_0xf363('0x4'));var Mustache=require(_0xf363('0x5'));var util=require(_0xf363('0x6'));var path=require(_0xf363('0x7'));var sox=require(_0xf363('0x8'));var csv=require('to-csv');var ejs=require(_0xf363('0x9'));var fs=require('fs');var fs_extra=require(_0xf363('0xa'));var _=require(_0xf363('0xb'));var squel=require('squel');var crypto=require(_0xf363('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf363('0xd'));var toCsv=require(_0xf363('0xe'));var querystring=require('querystring');var Papa=require(_0xf363('0xf'));var Redis=require(_0xf363('0x10'));var authService=require(_0xf363('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf363('0x12'));var logger=require(_0xf363('0x13'))(_0xf363('0x14'));var utils=require(_0xf363('0x15'));var config=require(_0xf363('0x16'));var licenseUtil=require(_0xf363('0x17'));var db=require('../../mysqldb')['db'];var extensions=require(_0xf363('0x18'));function respondWithStatusCode(_0x1582fa,_0x23ae4d){_0x23ae4d=_0x23ae4d||0xcc;return function(_0xad0d30){if(_0xad0d30){return _0x1582fa[_0xf363('0x19')](_0x23ae4d);}return _0x1582fa[_0xf363('0x1a')](_0x23ae4d)[_0xf363('0x1b')]();};}function respondWithResult(_0x24927b,_0x11177a){_0x11177a=_0x11177a||0xc8;return function(_0x5324ea){if(_0x5324ea){return _0x24927b[_0xf363('0x1a')](_0x11177a)[_0xf363('0x1c')](_0x5324ea);}};}function respondWithFilteredResult(_0x3fd1e5,_0x4e9513){return function(_0x1d71ba){if(_0x1d71ba){var _0x1e4ce3=typeof _0x4e9513[_0xf363('0x1d')]===_0xf363('0x1e')&&typeof _0x4e9513[_0xf363('0x1f')]===_0xf363('0x1e');var _0x8bf5f0=_0x1d71ba[_0xf363('0x20')];var _0x55c7f1=_0x1e4ce3?0x0:_0x4e9513['offset'];var _0x1bb8fb=_0x1e4ce3?_0x1d71ba[_0xf363('0x20')]:_0x4e9513['offset']+_0x4e9513[_0xf363('0x1f')];var _0x1b48b7;if(_0x1bb8fb>=_0x8bf5f0){_0x1bb8fb=_0x8bf5f0;_0x1b48b7=0xc8;}else{_0x1b48b7=0xce;}_0x3fd1e5[_0xf363('0x1a')](_0x1b48b7);return _0x3fd1e5[_0xf363('0x21')]('Content-Range',_0x55c7f1+'-'+_0x1bb8fb+'/'+_0x8bf5f0)[_0xf363('0x1c')](_0x1d71ba);}return null;};}function patchUpdates(_0x5f05a9){return function(_0x2fe78f){try{jsonpatch['apply'](_0x2fe78f,_0x5f05a9,!![]);}catch(_0x2b3612){return BPromise[_0xf363('0x22')](_0x2b3612);}return _0x2fe78f[_0xf363('0x23')]();};}function saveUpdates(_0x46a4a5,_0x5c71c2){return function(_0x31a9a5){if(_0x31a9a5){return _0x31a9a5[_0xf363('0x24')](_0x46a4a5)[_0xf363('0x25')](function(_0x2f5cdb){return _0x2f5cdb;});}return null;};}function removeEntity(_0x5ae833,_0xe024e4){return function(_0x1255dc){if(_0x1255dc){return _0x1255dc[_0xf363('0x26')]()[_0xf363('0x25')](function(){var _0x15bb99=_0x1255dc[_0xf363('0x27')]({'plain':!![]});var _0x3d12aa=_0xf363('0x28');return db[_0xf363('0x29')][_0xf363('0x26')]({'where':{'type':_0x3d12aa,'resourceId':_0x15bb99['id']}})[_0xf363('0x25')](function(){return _0x1255dc;});})['then'](function(){_0x5ae833['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x13ef52,_0x16ba2a){return function(_0x4e861a){if(!_0x4e861a){_0x13ef52['sendStatus'](0x194);}return _0x4e861a;};}function handleError(_0x4cc010,_0x41a8f2){_0x41a8f2=_0x41a8f2||0x1f4;return function(_0x521776){logger[_0xf363('0x2a')](_0x521776[_0xf363('0x2b')]);if(_0x521776[_0xf363('0x2c')]){delete _0x521776[_0xf363('0x2c')];}_0x4cc010[_0xf363('0x1a')](_0x41a8f2)['send'](_0x521776);};}exports[_0xf363('0x2d')]=function(_0x5e36d3,_0x23a1fc){var _0x3c7e34={},_0x578edf={},_0x20df6e={'count':0x0,'rows':[]};var _0x22e838=_[_0xf363('0x2e')](db['Interval'][_0xf363('0x2f')],function(_0x46de4a){return{'name':_0x46de4a['fieldName'],'type':_0x46de4a[_0xf363('0x30')]['key']};});_0x578edf[_0xf363('0x31')]=_['map'](_0x22e838,_0xf363('0x2c'));_0x578edf['query']=_['keys'](_0x5e36d3[_0xf363('0x32')]);_0x578edf['filters']=_[_0xf363('0x33')](_0x578edf['model'],_0x578edf[_0xf363('0x32')]);_0x3c7e34[_0xf363('0x34')]=_[_0xf363('0x33')](_0x578edf['model'],qs['fields'](_0x5e36d3[_0xf363('0x32')]['fields']));_0x3c7e34[_0xf363('0x34')]=_0x3c7e34[_0xf363('0x34')][_0xf363('0x35')]?_0x3c7e34[_0xf363('0x34')]:_0x578edf[_0xf363('0x31')];if(!_0x5e36d3['query'][_0xf363('0x36')](_0xf363('0x37'))){_0x3c7e34[_0xf363('0x1f')]=qs['limit'](_0x5e36d3['query']['limit']);_0x3c7e34[_0xf363('0x1d')]=qs[_0xf363('0x1d')](_0x5e36d3[_0xf363('0x32')][_0xf363('0x1d')]);}_0x3c7e34[_0xf363('0x38')]=qs[_0xf363('0x39')](_0x5e36d3[_0xf363('0x32')][_0xf363('0x39')]);_0x3c7e34['where']=qs[_0xf363('0x3a')](_[_0xf363('0x3b')](_0x5e36d3['query'],_0x578edf[_0xf363('0x3a')]),_0x22e838);if(_0x5e36d3[_0xf363('0x32')]['filter']){_0x3c7e34['where']=_['merge'](_0x3c7e34[_0xf363('0x3c')],{'$or':_[_0xf363('0x2e')](_0x22e838,function(_0x138db9){if(_0x138db9[_0xf363('0x30')]!=='VIRTUAL'){var _0x3e0ba3={};_0x3e0ba3[_0x138db9[_0xf363('0x2c')]]={'$like':'%'+_0x5e36d3['query'][_0xf363('0x3d')]+'%'};return _0x3e0ba3;}})});}_0x3c7e34=_[_0xf363('0x3e')]({},_0x3c7e34,_0x5e36d3[_0xf363('0x3f')]);var _0x5870d5={'where':_0x3c7e34[_0xf363('0x3c')]};return db['Interval'][_0xf363('0x20')](_0x5870d5)['then'](function(_0xaad4cd){_0x20df6e[_0xf363('0x20')]=_0xaad4cd;if(_0x5e36d3[_0xf363('0x32')][_0xf363('0x40')]){_0x3c7e34['include']=[{'all':!![]}];}return db[_0xf363('0x41')][_0xf363('0x42')](_0x3c7e34);})[_0xf363('0x25')](function(_0x4fd09d){_0x20df6e[_0xf363('0x43')]=_0x4fd09d;return _0x20df6e;})['then'](respondWithFilteredResult(_0x23a1fc,_0x3c7e34))[_0xf363('0x44')](handleError(_0x23a1fc,null));};exports[_0xf363('0x45')]=function(_0x424836,_0x427891){var _0x315f18={'raw':!![],'where':{'id':_0x424836[_0xf363('0x46')]['id']}},_0x1d3652={};_0x1d3652['model']=_[_0xf363('0x47')](db[_0xf363('0x41')][_0xf363('0x2f')]);_0x1d3652[_0xf363('0x32')]=_[_0xf363('0x47')](_0x424836['query']);_0x1d3652['filters']=_[_0xf363('0x33')](_0x1d3652['model'],_0x1d3652['query']);_0x315f18[_0xf363('0x34')]=_[_0xf363('0x33')](_0x1d3652['model'],qs[_0xf363('0x48')](_0x424836[_0xf363('0x32')][_0xf363('0x48')]));_0x315f18[_0xf363('0x34')]=_0x315f18['attributes'][_0xf363('0x35')]?_0x315f18[_0xf363('0x34')]:_0x1d3652[_0xf363('0x31')];if(_0x424836[_0xf363('0x32')][_0xf363('0x40')]){_0x315f18[_0xf363('0x49')]=[{'all':!![]}];}_0x315f18=_['merge']({},_0x315f18,_0x424836[_0xf363('0x3f')]);return db[_0xf363('0x41')][_0xf363('0x4a')](_0x315f18)['then'](handleEntityNotFound(_0x427891,null))[_0xf363('0x25')](respondWithResult(_0x427891,null))['catch'](handleError(_0x427891,null));};exports[_0xf363('0x4b')]=function(_0x2980c8,_0x381b30){return db[_0xf363('0x41')][_0xf363('0x4b')](_0x2980c8[_0xf363('0x4c')],{})[_0xf363('0x25')](function(_0x47b320){var _0x546155=_0x2980c8[_0xf363('0x4d')][_0xf363('0x27')]({'plain':!![]});if(!_0x546155)throw new Error(_0xf363('0x4e'));if(_0x546155['role']===_0xf363('0x4d')){var _0x50752f=_0x47b320[_0xf363('0x27')]({'plain':!![]});var _0x15a863=_0xf363('0x28');return db[_0xf363('0x4f')][_0xf363('0x4a')]({'where':{'name':_0x15a863,'userProfileId':_0x546155[_0xf363('0x50')]},'raw':!![]})[_0xf363('0x25')](function(_0x59b2c9){if(_0x59b2c9&&_0x59b2c9[_0xf363('0x51')]===0x0){return db[_0xf363('0x29')][_0xf363('0x4b')]({'name':_0x50752f['name'],'resourceId':_0x50752f['id'],'type':_0x59b2c9['name'],'sectionId':_0x59b2c9['id']},{})[_0xf363('0x25')](function(){return _0x47b320;});}else{return _0x47b320;}})[_0xf363('0x44')](function(_0x3e163e){logger[_0xf363('0x2a')](_0xf363('0x52'),_0x3e163e);throw _0x3e163e;});}return _0x47b320;})[_0xf363('0x25')](respondWithResult(_0x381b30,0xc9))[_0xf363('0x44')](handleError(_0x381b30,null));};exports[_0xf363('0x24')]=function(_0x55f7fe,_0x4673fe){if(_0x55f7fe[_0xf363('0x4c')]['id']){delete _0x55f7fe[_0xf363('0x4c')]['id'];}return db['Interval'][_0xf363('0x4a')]({'where':{'id':_0x55f7fe[_0xf363('0x46')]['id']}})[_0xf363('0x25')](handleEntityNotFound(_0x4673fe,null))[_0xf363('0x25')](saveUpdates(_0x55f7fe['body'],null))[_0xf363('0x25')](respondWithResult(_0x4673fe,null))['catch'](handleError(_0x4673fe,null));};exports[_0xf363('0x26')]=function(_0x51b872,_0xc3b6a1){return db[_0xf363('0x41')][_0xf363('0x4a')]({'where':{'id':_0x51b872['params']['id']}})[_0xf363('0x25')](handleEntityNotFound(_0xc3b6a1,null))['then'](removeEntity(_0xc3b6a1,null))['catch'](handleError(_0xc3b6a1,null));};exports['addInterval']=function(_0x31e217,_0xf94748,_0x2c1850){if(_0x31e217[_0xf363('0x4c')]['id']){delete _0x31e217[_0xf363('0x4c')]['id'];}return db[_0xf363('0x41')][_0xf363('0x4a')]({'where':{'id':_0x31e217[_0xf363('0x46')]['id']}})[_0xf363('0x25')](handleEntityNotFound(_0xf94748,null))[_0xf363('0x25')](function(_0x5b7d37){if(_0x5b7d37){_0x31e217[_0xf363('0x4c')][_0xf363('0x53')]=_0x5b7d37['id'];return db[_0xf363('0x41')][_0xf363('0x4b')](_0x31e217['body']);}})[_0xf363('0x25')](respondWithResult(_0xf94748,null))['catch'](handleError(_0xf94748,null));};exports['getIntervals']=function(_0x1ac930,_0x21a52c,_0xfa682f){var _0xc0622c={};var _0x4a8dd3={};var _0x5df3ab;var _0x1625a1;return db[_0xf363('0x41')]['findOne']({'where':{'id':_0x1ac930[_0xf363('0x46')]['id']}})[_0xf363('0x25')](handleEntityNotFound(_0x21a52c,null))['then'](function(_0x2ac995){if(_0x2ac995){_0x5df3ab=_0x2ac995;_0x4a8dd3[_0xf363('0x31')]=_[_0xf363('0x47')](db[_0xf363('0x41')][_0xf363('0x2f')]);_0x4a8dd3[_0xf363('0x32')]=_[_0xf363('0x47')](_0x1ac930['query']);_0x4a8dd3[_0xf363('0x3a')]=_[_0xf363('0x33')](_0x4a8dd3[_0xf363('0x31')],_0x4a8dd3[_0xf363('0x32')]);_0xc0622c[_0xf363('0x34')]=_[_0xf363('0x33')](_0x4a8dd3[_0xf363('0x31')],qs[_0xf363('0x48')](_0x1ac930[_0xf363('0x32')][_0xf363('0x48')]));_0xc0622c[_0xf363('0x34')]=_0xc0622c[_0xf363('0x34')][_0xf363('0x35')]?_0xc0622c['attributes']:_0x4a8dd3['model'];_0xc0622c[_0xf363('0x38')]=qs[_0xf363('0x39')](_0x1ac930[_0xf363('0x32')]['sort']);_0xc0622c[_0xf363('0x3c')]=qs['filters'](_['pick'](_0x1ac930[_0xf363('0x32')],_0x4a8dd3[_0xf363('0x3a')]));if(_0x1ac930[_0xf363('0x32')][_0xf363('0x3d')]){_0xc0622c[_0xf363('0x3c')]=_[_0xf363('0x3e')](_0xc0622c[_0xf363('0x3c')],{'$or':_[_0xf363('0x2e')](_0xc0622c[_0xf363('0x34')],function(_0x1de1f8){var _0x688ed6={};_0x688ed6[_0x1de1f8]={'$like':'%'+_0x1ac930['query']['filter']+'%'};return _0x688ed6;})});}_0xc0622c=_[_0xf363('0x3e')]({},_0xc0622c,_0x1ac930['options']);return _0x5df3ab[_0xf363('0x54')](_0xc0622c);}})[_0xf363('0x25')](function(_0x4505ba){if(_0x4505ba){_0x1625a1=_0x4505ba[_0xf363('0x35')];if(!_0x1ac930[_0xf363('0x32')]['hasOwnProperty'](_0xf363('0x37'))){_0xc0622c[_0xf363('0x1f')]=qs[_0xf363('0x1f')](_0x1ac930[_0xf363('0x32')]['limit']);_0xc0622c[_0xf363('0x1d')]=qs['offset'](_0x1ac930[_0xf363('0x32')][_0xf363('0x1d')]);}return _0x5df3ab[_0xf363('0x54')](_0xc0622c);}})['then'](function(_0x2f8695){if(_0x2f8695){return _0x2f8695?{'count':_0x1625a1,'rows':_0x2f8695}:null;}})[_0xf363('0x25')](respondWithResult(_0x21a52c,null))[_0xf363('0x44')](handleError(_0x21a52c,null));};exports[_0xf363('0x55')]=function(_0x509f22,_0x533a58,_0x13a56a){return db['Interval'][_0xf363('0x56')]({'where':{'id':_0x509f22[_0xf363('0x46')]['id']}})[_0xf363('0x25')](handleEntityNotFound(_0x533a58,null))[_0xf363('0x25')](function(_0x190b78){if(_0x190b78){return db[_0xf363('0x57')][_0xf363('0x58')](function(_0x59b7be){return db['Interval'][_0xf363('0x26')]({'where':{'IntervalId':_0x509f22[_0xf363('0x46')]['id']},'transaction':_0x59b7be})[_0xf363('0x25')](function(_0x2b2ba5){var _0x161dc6=_[_0xf363('0x2e')](_0x509f22[_0xf363('0x4c')],function(_0x1507e4){delete _0x1507e4['id'];_0x1507e4['IntervalId']=_0x509f22[_0xf363('0x46')]['id'];return _0x1507e4;});return db[_0xf363('0x41')]['bulkCreate'](_0x161dc6,{'transaction':_0x59b7be});});})[_0xf363('0x25')](function(){return db[_0xf363('0x41')][_0xf363('0x42')]({'where':{'IntervalId':_0x509f22[_0xf363('0x46')]['id']}});});}})[_0xf363('0x25')](respondWithResult(_0x533a58,null))['catch'](handleError(_0x533a58,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 06c0578..48f98d0 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 _0xae39=['ifTime','reduce','./interval.attributes','../../components/extensions/rewrite','define','Interval','tools_intervals','rewrite','interval','getIntervals','then','all','map'];(function(_0x504552,_0x183fd1){var _0x5e6d44=function(_0x21111f){while(--_0x21111f){_0x504552['push'](_0x504552['shift']());}};_0x5e6d44(++_0x183fd1);}(_0xae39,0xd2));var _0x9ae3=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xae39[_0x334841];return _0x5beb4b;};'use strict';var attributes=require(_0x9ae3('0x0'));var extensions=require(_0x9ae3('0x1'));var iftime=require('../../utils/iftime')['iftime'];module['exports']=function(_0x3c3270){return _0x3c3270[_0x9ae3('0x2')](_0x9ae3('0x3'),attributes,{'tableName':_0x9ae3('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xe48060){extensions[_0x9ae3('0x5')](_0x3c3270,_0xe48060);},'afterBulkCreate':function(_0x58c666,_0x483a7f,_0x2640be){_0x2640be();extensions[_0x9ae3('0x5')](_0x3c3270,_0x58c666[0x0]);},'afterUpdate':function(_0x3bcd69){extensions['rewrite'](_0x3c3270,_0x3bcd69);},'afterDestroy':function(_0x31e169){extensions[_0x9ae3('0x5')](_0x3c3270,_0x31e169);}},'instanceMethods':{'ifTime':function(_0x11dbd7=undefined,_0x462e3b=new Date()){if(typeof this[_0x9ae3('0x6')]==='string'){return iftime(this[_0x9ae3('0x6')],_0x11dbd7,_0x462e3b);}else{return this[_0x9ae3('0x7')]()[_0x9ae3('0x8')](function(_0x593093){return Promise[_0x9ae3('0x9')](_0x593093[_0x9ae3('0xa')](function(_0x46573a){return _0x46573a[_0x9ae3('0xb')](_0x11dbd7,_0x462e3b);}));})[_0x9ae3('0x8')](function(_0x219364){return _0x219364[_0x9ae3('0xc')](function(_0x194566,_0x422e5f){return _0x194566||_0x422e5f;},![]);});}}}});}; \ No newline at end of file +var _0xac97=['Interval','rewrite','interval','string','getIntervals','then','all','map','ifTime','reduce','./interval.attributes','../../utils/iftime','iftime','exports'];(function(_0x402edc,_0x430857){var _0x4b990c=function(_0xdb4c3a){while(--_0xdb4c3a){_0x402edc['push'](_0x402edc['shift']());}};_0x4b990c(++_0x430857);}(_0xac97,0xa4));var _0x7ac9=function(_0x42f58d,_0x44a5a3){_0x42f58d=_0x42f58d-0x0;var _0x3207f5=_0xac97[_0x42f58d];return _0x3207f5;};'use strict';var attributes=require(_0x7ac9('0x0'));var extensions=require('../../components/extensions/rewrite');var iftime=require(_0x7ac9('0x1'))[_0x7ac9('0x2')];module[_0x7ac9('0x3')]=function(_0x76c9c1){return _0x76c9c1['define'](_0x7ac9('0x4'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x9f3c17){extensions[_0x7ac9('0x5')](_0x76c9c1,_0x9f3c17);},'afterBulkCreate':function(_0xf09c1,_0x2f9d26,_0x5b2d90){_0x5b2d90();extensions[_0x7ac9('0x5')](_0x76c9c1,_0xf09c1[0x0]);},'afterUpdate':function(_0x4d43b0){extensions[_0x7ac9('0x5')](_0x76c9c1,_0x4d43b0);},'afterDestroy':function(_0x4833b2){extensions['rewrite'](_0x76c9c1,_0x4833b2);}},'instanceMethods':{'ifTime':function(_0x3b9980=undefined,_0x435867=new Date()){if(typeof this[_0x7ac9('0x6')]===_0x7ac9('0x7')){return iftime(this[_0x7ac9('0x6')],_0x3b9980,_0x435867);}else{return this[_0x7ac9('0x8')]()[_0x7ac9('0x9')](function(_0x388ce7){return Promise[_0x7ac9('0xa')](_0x388ce7[_0x7ac9('0xb')](function(_0x4fdb6a){return _0x4fdb6a[_0x7ac9('0xc')](_0x3b9980,_0x435867);}));})[_0x7ac9('0x9')](function(_0x452499){return _0x452499[_0x7ac9('0xd')](function(_0x2573e8,_0x5d386e){return _0x2573e8||_0x5d386e;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 98bd691..cc762e4 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 _0x6323=['error','message','ShowInterval','find','then','all','ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','intervalIds','isArray','intervals','string','timezone','length','IntervalIftime:\x20timezone\x20=\x20%s','silly','IntervalIftime','resolve','util','../../mysqldb','iftime','rpc','findAll','options','raw','where','attributes','limit','include','map','model','info','debug','GetInterval','stringify','catch'];(function(_0xedb936,_0x10a478){var _0x113126=function(_0x136e47){while(--_0x136e47){_0xedb936['push'](_0xedb936['shift']());}};_0x113126(++_0x10a478);}(_0x6323,0xc0));var _0x3632=function(_0x203542,_0x3aef0b){_0x203542=_0x203542-0x0;var _0x5d00fb=_0x6323[_0x203542];return _0x5d00fb;};'use strict';var _=require('lodash');var util=require(_0x3632('0x0'));var db=require(_0x3632('0x1'))['db'];var iftime=require('../../utils/iftime')[_0x3632('0x2')];var logger=require('../../config/logger')(_0x3632('0x3'));exports['GetInterval']=function(_0x28baf9){var _0x35a149=this;return new Promise(function(_0x35155a,_0x4456ff){return db['Interval'][_0x3632('0x4')]({'raw':_0x28baf9[_0x3632('0x5')]?_0x28baf9[_0x3632('0x5')][_0x3632('0x6')]===undefined?!![]:![]:!![],'where':_0x28baf9['options']?_0x28baf9[_0x3632('0x5')][_0x3632('0x7')]||null:null,'attributes':_0x28baf9[_0x3632('0x5')]?_0x28baf9[_0x3632('0x5')][_0x3632('0x8')]||null:null,'limit':_0x28baf9[_0x3632('0x5')]?_0x28baf9[_0x3632('0x5')][_0x3632('0x9')]||null:null,'include':_0x28baf9['options']?_0x28baf9[_0x3632('0x5')][_0x3632('0xa')]?_[_0x3632('0xb')](_0x28baf9[_0x3632('0x5')][_0x3632('0xa')],function(_0x33faf7){return{'model':db[_0x33faf7[_0x3632('0xc')]],'as':_0x33faf7['as'],'attributes':_0x33faf7[_0x3632('0x8')],'include':_0x33faf7[_0x3632('0xa')]?_[_0x3632('0xb')](_0x33faf7[_0x3632('0xa')],function(_0x319f6d){return{'model':db[_0x319f6d['model']],'as':_0x319f6d['as'],'attributes':_0x319f6d[_0x3632('0x8')],'include':_0x319f6d[_0x3632('0xa')]?_['map'](_0x319f6d[_0x3632('0xa')],function(_0x3cc731){return{'model':db[_0x3cc731['model']],'as':_0x3cc731['as'],'attributes':_0x3cc731['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a3e91){logger[_0x3632('0xd')]('GetInterval',_0x28baf9);logger[_0x3632('0xe')](_0x3632('0xf'),_0x28baf9,JSON[_0x3632('0x10')](_0x2a3e91));_0x35155a(_0x2a3e91);})[_0x3632('0x11')](function(_0x5df37b){logger[_0x3632('0x12')](_0x3632('0xf'),_0x5df37b[_0x3632('0x13')],_0x28baf9);_0x4456ff(_0x35a149[_0x3632('0x12')](0x1f4,_0x5df37b[_0x3632('0x13')]));});});};exports[_0x3632('0x14')]=function(_0x36828b){var _0x58abc7=this;return new Promise(function(_0x2a0003,_0x5cd584){return db['Interval'][_0x3632('0x15')]({'raw':_0x36828b[_0x3632('0x5')]?_0x36828b[_0x3632('0x5')][_0x3632('0x6')]===undefined?!![]:![]:!![],'where':_0x36828b[_0x3632('0x5')]?_0x36828b[_0x3632('0x5')][_0x3632('0x7')]||null:null,'attributes':_0x36828b[_0x3632('0x5')]?_0x36828b[_0x3632('0x5')][_0x3632('0x8')]||null:null,'include':_0x36828b[_0x3632('0x5')]?_0x36828b[_0x3632('0x5')][_0x3632('0xa')]?_[_0x3632('0xb')](_0x36828b[_0x3632('0x5')][_0x3632('0xa')],function(_0x251771){return{'model':db[_0x251771[_0x3632('0xc')]],'as':_0x251771['as'],'attributes':_0x251771[_0x3632('0x8')],'include':_0x251771[_0x3632('0xa')]?_[_0x3632('0xb')](_0x251771[_0x3632('0xa')],function(_0x45381b){return{'model':db[_0x45381b['model']],'as':_0x45381b['as'],'attributes':_0x45381b[_0x3632('0x8')],'include':_0x45381b[_0x3632('0xa')]?_[_0x3632('0xb')](_0x45381b[_0x3632('0xa')],function(_0x155068){return{'model':db[_0x155068[_0x3632('0xc')]],'as':_0x155068['as'],'attributes':_0x155068[_0x3632('0x8')]};}):[]};}):[]};}):[]:[]})[_0x3632('0x16')](function(_0x507d54){logger['info'](_0x3632('0x14'),_0x36828b);logger['debug'](_0x3632('0x14'),_0x36828b,JSON[_0x3632('0x10')](_0x507d54));_0x2a0003(_0x507d54);})[_0x3632('0x11')](function(_0x57d848){logger['error'](_0x3632('0x14'),_0x57d848[_0x3632('0x13')],_0x36828b);_0x5cd584(_0x58abc7[_0x3632('0x12')](0x1f4,_0x57d848[_0x3632('0x13')]));});});};function checkArrayOfIntervals(_0x12a299,_0x339ec9){var _0x25a4f5=[];return db['Interval']['findAll']({'where':{'id':_0x12a299}})[_0x3632('0x16')](function(_0x2e6288){_0x25a4f5=_0x2e6288;return Promise[_0x3632('0x17')](_0x25a4f5[_0x3632('0xb')](function(_0xde97ae){return _0xde97ae[_0x3632('0x18')](_0x339ec9);}));})[_0x3632('0x16')](function(_0x18fc41){var _0x23b2c0=_0x18fc41[_0x3632('0x19')](function(_0x1e9d84,_0x436f86){return _0x1e9d84||_0x436f86;},![]);logger['info'](util[_0x3632('0x1a')](_0x3632('0x1b'),_0x25a4f5[_0x3632('0xb')](function(_0x25f92b){return _0x25f92b[_0x3632('0x1c')];})['join'](',\x20'),_0x25a4f5[_0x3632('0xb')](function(_0x513330){return _0x513330['id'];})[_0x3632('0x1d')](',\x20')));return _0x23b2c0;});}function checkSingleInterval(_0x19036d,_0x2dca44){return db['Interval'][_0x3632('0x1e')](_0x19036d)[_0x3632('0x16')](function(_0x41a900){if(_0x41a900){logger[_0x3632('0xd')](util[_0x3632('0x1a')](_0x3632('0x1f'),_0x41a900[_0x3632('0x1c')],_0x41a900['id']));return _0x41a900[_0x3632('0x18')](_0x2dca44);}});}exports['IntervalIftime']=function(_0x3470cc){var _0x2e160d=_0x3470cc[_0x3632('0x20')];var _0x28df31=Array[_0x3632('0x21')](_0x3470cc[_0x3632('0x22')])?_0x3470cc[_0x3632('0x22')]:typeof _0x3470cc[_0x3632('0x22')]===_0x3632('0x23')?[_0x3470cc[_0x3632('0x22')]]:[];var _0xe57941=_0x3470cc[_0x3632('0x24')]||undefined;var _0x58b4f3=![];if(_0x28df31[_0x3632('0x25')]){logger[_0x3632('0xd')](util['format']('IntervalIftime:\x20interval\x20strings\x20=\x20%s',_0x28df31[_0x3632('0x1d')](';\x20')));}if(_0xe57941){logger['info'](util['format'](_0x3632('0x26'),_0xe57941));}logger[_0x3632('0xe')]('Iftime',_0x58b4f3);logger[_0x3632('0x27')](_0x3632('0x28'),_0x3470cc);return Promise[_0x3632('0x29')]()[_0x3632('0x16')](function(){if(Array['isArray'](_0x2e160d)){return checkArrayOfIntervals(_0x2e160d,_0xe57941);}else if(_0x2e160d){return checkSingleInterval(_0x2e160d,_0xe57941);}})[_0x3632('0x16')](function(_0x283e12){var _0x2fd4a3=_0x28df31['reduce'](function(_0x108d99,_0x4134ca){return _0x108d99||iftime(_0x4134ca,_0xe57941);},![]);_0x58b4f3=_0x283e12||_0x2fd4a3;return _0x58b4f3;})[_0x3632('0x11')](function(_0x4997f0){logger[_0x3632('0x12')](_0x3632('0x28'),_0x3470cc,_0x4997f0);throw this[_0x3632('0x12')](0x1f4,_0x4997f0[_0x3632('0x13')]);});}; \ No newline at end of file +var _0xc85f=['rpc','GetInterval','Interval','findAll','options','raw','where','attributes','limit','include','map','model','then','info','catch','error','ShowInterval','find','stringify','message','ifTime','reduce','format','name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervals','string','timezone','length','IntervalIftime:\x20timezone\x20=\x20%s','debug','Iftime','resolve','lodash','util','../../mysqldb','../../utils/iftime','iftime','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc85f,0xa2));var _0xfc85=function(_0x2685e4,_0x4b739f){_0x2685e4=_0x2685e4-0x0;var _0x3c2b74=_0xc85f[_0x2685e4];return _0x3c2b74;};'use strict';var _=require(_0xfc85('0x0'));var util=require(_0xfc85('0x1'));var db=require(_0xfc85('0x2'))['db'];var iftime=require(_0xfc85('0x3'))[_0xfc85('0x4')];var logger=require(_0xfc85('0x5'))(_0xfc85('0x6'));exports[_0xfc85('0x7')]=function(_0x13cca7){var _0x2072b8=this;return new Promise(function(_0x19ae94,_0x22a5be){return db[_0xfc85('0x8')][_0xfc85('0x9')]({'raw':_0x13cca7[_0xfc85('0xa')]?_0x13cca7[_0xfc85('0xa')][_0xfc85('0xb')]===undefined?!![]:![]:!![],'where':_0x13cca7[_0xfc85('0xa')]?_0x13cca7['options'][_0xfc85('0xc')]||null:null,'attributes':_0x13cca7['options']?_0x13cca7['options'][_0xfc85('0xd')]||null:null,'limit':_0x13cca7[_0xfc85('0xa')]?_0x13cca7[_0xfc85('0xa')][_0xfc85('0xe')]||null:null,'include':_0x13cca7[_0xfc85('0xa')]?_0x13cca7['options'][_0xfc85('0xf')]?_[_0xfc85('0x10')](_0x13cca7['options']['include'],function(_0x1c5826){return{'model':db[_0x1c5826[_0xfc85('0x11')]],'as':_0x1c5826['as'],'attributes':_0x1c5826[_0xfc85('0xd')],'include':_0x1c5826[_0xfc85('0xf')]?_[_0xfc85('0x10')](_0x1c5826[_0xfc85('0xf')],function(_0x3c8e94){return{'model':db[_0x3c8e94['model']],'as':_0x3c8e94['as'],'attributes':_0x3c8e94[_0xfc85('0xd')],'include':_0x3c8e94[_0xfc85('0xf')]?_[_0xfc85('0x10')](_0x3c8e94[_0xfc85('0xf')],function(_0x2f4790){return{'model':db[_0x2f4790['model']],'as':_0x2f4790['as'],'attributes':_0x2f4790[_0xfc85('0xd')]};}):[]};}):[]};}):[]:[]})[_0xfc85('0x12')](function(_0x3a0213){logger[_0xfc85('0x13')](_0xfc85('0x7'),_0x13cca7);logger['debug'](_0xfc85('0x7'),_0x13cca7,JSON['stringify'](_0x3a0213));_0x19ae94(_0x3a0213);})[_0xfc85('0x14')](function(_0x59200d){logger[_0xfc85('0x15')]('GetInterval',_0x59200d['message'],_0x13cca7);_0x22a5be(_0x2072b8[_0xfc85('0x15')](0x1f4,_0x59200d['message']));});});};exports[_0xfc85('0x16')]=function(_0x3b1f9c){var _0x1c0177=this;return new Promise(function(_0x90f759,_0x47160b){return db[_0xfc85('0x8')][_0xfc85('0x17')]({'raw':_0x3b1f9c[_0xfc85('0xa')]?_0x3b1f9c['options']['raw']===undefined?!![]:![]:!![],'where':_0x3b1f9c[_0xfc85('0xa')]?_0x3b1f9c['options'][_0xfc85('0xc')]||null:null,'attributes':_0x3b1f9c['options']?_0x3b1f9c[_0xfc85('0xa')][_0xfc85('0xd')]||null:null,'include':_0x3b1f9c[_0xfc85('0xa')]?_0x3b1f9c[_0xfc85('0xa')][_0xfc85('0xf')]?_[_0xfc85('0x10')](_0x3b1f9c[_0xfc85('0xa')][_0xfc85('0xf')],function(_0x36c703){return{'model':db[_0x36c703[_0xfc85('0x11')]],'as':_0x36c703['as'],'attributes':_0x36c703[_0xfc85('0xd')],'include':_0x36c703[_0xfc85('0xf')]?_['map'](_0x36c703[_0xfc85('0xf')],function(_0x3cf31b){return{'model':db[_0x3cf31b[_0xfc85('0x11')]],'as':_0x3cf31b['as'],'attributes':_0x3cf31b['attributes'],'include':_0x3cf31b[_0xfc85('0xf')]?_['map'](_0x3cf31b[_0xfc85('0xf')],function(_0x409195){return{'model':db[_0x409195['model']],'as':_0x409195['as'],'attributes':_0x409195[_0xfc85('0xd')]};}):[]};}):[]};}):[]:[]})[_0xfc85('0x12')](function(_0x299f1d){logger['info'](_0xfc85('0x16'),_0x3b1f9c);logger['debug'](_0xfc85('0x16'),_0x3b1f9c,JSON[_0xfc85('0x18')](_0x299f1d));_0x90f759(_0x299f1d);})[_0xfc85('0x14')](function(_0x3e8765){logger[_0xfc85('0x15')](_0xfc85('0x16'),_0x3e8765['message'],_0x3b1f9c);_0x47160b(_0x1c0177[_0xfc85('0x15')](0x1f4,_0x3e8765[_0xfc85('0x19')]));});});};function checkArrayOfIntervals(_0x5f8152,_0x299a05){var _0x338ec0=[];return db[_0xfc85('0x8')]['findAll']({'where':{'id':_0x5f8152}})[_0xfc85('0x12')](function(_0x359670){_0x338ec0=_0x359670;return Promise['all'](_0x338ec0['map'](function(_0x496292){return _0x496292[_0xfc85('0x1a')](_0x299a05);}));})['then'](function(_0x59bc57){var _0x5b8da3=_0x59bc57[_0xfc85('0x1b')](function(_0x333780,_0x2bb39c){return _0x333780||_0x2bb39c;},![]);logger[_0xfc85('0x13')](util[_0xfc85('0x1c')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x338ec0['map'](function(_0x127862){return _0x127862[_0xfc85('0x1d')];})[_0xfc85('0x1e')](',\x20'),_0x338ec0[_0xfc85('0x10')](function(_0x23135a){return _0x23135a['id'];})[_0xfc85('0x1e')](',\x20')));return _0x5b8da3;});}function checkSingleInterval(_0x171993,_0xd1e40a){return db[_0xfc85('0x8')][_0xfc85('0x1f')](_0x171993)[_0xfc85('0x12')](function(_0x3e2756){if(_0x3e2756){logger[_0xfc85('0x13')](util[_0xfc85('0x1c')](_0xfc85('0x20'),_0x3e2756[_0xfc85('0x1d')],_0x3e2756['id']));return _0x3e2756[_0xfc85('0x1a')](_0xd1e40a);}});}exports[_0xfc85('0x21')]=function(_0x18266c){var _0x96166c=_0x18266c['intervalIds'];var _0x5830ce=Array['isArray'](_0x18266c[_0xfc85('0x22')])?_0x18266c[_0xfc85('0x22')]:typeof _0x18266c['intervals']===_0xfc85('0x23')?[_0x18266c[_0xfc85('0x22')]]:[];var _0x2323b9=_0x18266c[_0xfc85('0x24')]||undefined;var _0x4584aa=![];if(_0x5830ce[_0xfc85('0x25')]){logger[_0xfc85('0x13')](util['format']('IntervalIftime:\x20interval\x20strings\x20=\x20%s',_0x5830ce['join'](';\x20')));}if(_0x2323b9){logger[_0xfc85('0x13')](util[_0xfc85('0x1c')](_0xfc85('0x26'),_0x2323b9));}logger[_0xfc85('0x27')](_0xfc85('0x28'),_0x4584aa);logger['silly'](_0xfc85('0x21'),_0x18266c);return Promise[_0xfc85('0x29')]()[_0xfc85('0x12')](function(){if(Array['isArray'](_0x96166c)){return checkArrayOfIntervals(_0x96166c,_0x2323b9);}else if(_0x96166c){return checkSingleInterval(_0x96166c,_0x2323b9);}})[_0xfc85('0x12')](function(_0x3381a7){var _0x54bc42=_0x5830ce[_0xfc85('0x1b')](function(_0x2f363e,_0x50c419){return _0x2f363e||iftime(_0x50c419,_0x2323b9);},![]);_0x4584aa=_0x3381a7||_0x54bc42;return _0x4584aa;})[_0xfc85('0x14')](function(_0x13906f){logger[_0xfc85('0x15')]('IntervalIftime',_0x18266c,_0x13906f);throw this['error'](0x1f4,_0x13906f[_0xfc85('0x19')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 731a3ac..5dbb0a3 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1af05b,_0x5134b5){_0x1af05b=_0x1af05b-0x0;var _0x5be7cc=_0x0b0e[_0x1af05b];return _0x5be7cc;};'use strict';var express=require(_0xe0b0('0x0'));var router=express['Router']();var auth=require(_0xe0b0('0x1'));var controller=require('./jira.controller');router[_0xe0b0('0x2')]('/',auth[_0xe0b0('0x3')](),controller[_0xe0b0('0x4')]);module[_0xe0b0('0x5')]=router; \ No newline at end of file +var _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x186b2c,_0x1fe2a4){var _0x205d86=function(_0x52fa99){while(--_0x52fa99){_0x186b2c['push'](_0x186b2c['shift']());}};_0x205d86(++_0x1fe2a4);}(_0xadb5,0xad));var _0x5adb=function(_0x3fb2f7,_0x262f22){_0x3fb2f7=_0x3fb2f7-0x0;var _0x544de8=_0xadb5[_0x3fb2f7];return _0x544de8;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 650e699..3720834 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 _0x0f46=['socket','remoteAddress','https','../../config/logger','api','support','key','MOTGUI','summary','description','Bug','customfield_11500','email','fields','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','application/json','Basic\x20','base64','stringify','request','setEncoding','utf8','data','end','status','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','x-forwarded-for','connection'];(function(_0x36be9d,_0x1bea91){var _0x4ea118=function(_0x1f1ab0){while(--_0x1f1ab0){_0x36be9d['push'](_0x36be9d['shift']());}};_0x4ea118(++_0x1bea91);}(_0x0f46,0x136));var _0x60f4=function(_0x3da78e,_0x512b14){_0x3da78e=_0x3da78e-0x0;var _0x52d5e1=_0x0f46[_0x3da78e];return _0x52d5e1;};'use strict';var BPromise=require('bluebird');var https=require(_0x60f4('0x0'));var logger=require(_0x60f4('0x1'))(_0x60f4('0x2'));var USERNAME=_0x60f4('0x3');var PASSWORD='3eAmWpBVP0';function openIssue(_0x4d4ffd,_0x332581){var _0x28b1c7={'fields':{'project':{'key':_0x4d4ffd[_0x60f4('0x4')]||_0x60f4('0x5')},'summary':(_0x4d4ffd[_0x60f4('0x6')]||'Report')+'\x20from\x20'+_0x4d4ffd['ip'],'description':_0x4d4ffd[_0x60f4('0x7')]||JSON['stringify'](_0x4d4ffd),'issuetype':{'name':_0x4d4ffd['issuetype']||_0x60f4('0x8')}}};_0x28b1c7['fields'][_0x60f4('0x9')]=_0x4d4ffd[_0x60f4('0xa')];_0x28b1c7[_0x60f4('0xb')][_0x60f4('0xc')]=_0x4d4ffd[_0x60f4('0xd')];_0x28b1c7[_0x60f4('0xb')][_0x60f4('0xe')]=_0x4d4ffd[_0x60f4('0xf')];_0x28b1c7[_0x60f4('0xb')][_0x60f4('0x10')]=_0x4d4ffd[_0x60f4('0x11')];_0x28b1c7[_0x60f4('0xb')][_0x60f4('0x12')]=_0x4d4ffd['reason'];_0x28b1c7[_0x60f4('0xb')][_0x60f4('0x13')]=_0x4d4ffd['ip'];var _0x1044a2={'host':_0x60f4('0x14'),'port':0x1bb,'path':_0x60f4('0x15'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x60f4('0x16'),'Authorization':_0x60f4('0x17')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x60f4('0x18'))}};var _0x597090=JSON[_0x60f4('0x19')](_0x28b1c7);var _0x1fd7de=https[_0x60f4('0x1a')](_0x1044a2,function(_0x254ecd){_0x254ecd[_0x60f4('0x1b')](_0x60f4('0x1c'));var _0x416eb5='';_0x254ecd['on'](_0x60f4('0x1d'),function(_0x335743){_0x416eb5+=_0x335743;});_0x254ecd['on'](_0x60f4('0x1e'),function(){if(_0x332581){return _0x332581[_0x60f4('0x1f')](_0x254ecd['statusCode'])[_0x60f4('0x20')](JSON[_0x60f4('0x21')](_0x416eb5));}});});_0x1fd7de['on']('error',function(_0xe1d590){if(_0x332581){return _0x332581[_0x60f4('0x1f')](0x1f4)['json']({'errors':[{'message':_0x60f4('0x22'),'type':_0x60f4('0x23')}]});}});_0x1fd7de[_0x60f4('0x24')](_0x597090);_0x1fd7de[_0x60f4('0x1e')]();}exports[_0x60f4('0x25')]=openIssue;exports[_0x60f4('0x26')]=function(_0x5efa05,_0xa52f54){_0x5efa05[_0x60f4('0x27')]['ip']=_0x5efa05['headers'][_0x60f4('0x28')]||_0x5efa05[_0x60f4('0x29')]['remoteAddress']||_0x5efa05[_0x60f4('0x2a')]['remoteAddress']||_0x5efa05['connection'][_0x60f4('0x2a')][_0x60f4('0x2b')];return openIssue(_0x5efa05[_0x60f4('0x27')],_0xa52f54);}; \ No newline at end of file +var _0xc357=['description','stringify','issuetype','Bug','customfield_11501','oldToken','fields','customfield_11502','newToken','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','request','setEncoding','utf8','end','status','statusCode','json','parse','api.jira','headers','x-forwarded-for','connection','socket','remoteAddress','body','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20'];(function(_0x5d2252,_0x55a912){var _0xeae478=function(_0x4058aa){while(--_0x4058aa){_0x5d2252['push'](_0x5d2252['shift']());}};_0xeae478(++_0x55a912);}(_0xc357,0xf1));var _0x7c35=function(_0x24fee0,_0x43c2ce){_0x24fee0=_0x24fee0-0x0;var _0x1f8a33=_0xc357[_0x24fee0];return _0x1f8a33;};'use strict';var BPromise=require(_0x7c35('0x0'));var https=require(_0x7c35('0x1'));var logger=require(_0x7c35('0x2'))(_0x7c35('0x3'));var USERNAME=_0x7c35('0x4');var PASSWORD=_0x7c35('0x5');function openIssue(_0x237f6f,_0x20e6d2){var _0x24f882={'fields':{'project':{'key':_0x237f6f[_0x7c35('0x6')]||_0x7c35('0x7')},'summary':(_0x237f6f[_0x7c35('0x8')]||_0x7c35('0x9'))+_0x7c35('0xa')+_0x237f6f['ip'],'description':_0x237f6f[_0x7c35('0xb')]||JSON[_0x7c35('0xc')](_0x237f6f),'issuetype':{'name':_0x237f6f[_0x7c35('0xd')]||_0x7c35('0xe')}}};_0x24f882['fields']['customfield_11500']=_0x237f6f['email'];_0x24f882['fields'][_0x7c35('0xf')]=_0x237f6f[_0x7c35('0x10')];_0x24f882[_0x7c35('0x11')][_0x7c35('0x12')]=_0x237f6f[_0x7c35('0x13')];_0x24f882[_0x7c35('0x11')]['customfield_11503']=_0x237f6f[_0x7c35('0x14')];_0x24f882['fields'][_0x7c35('0x15')]=_0x237f6f[_0x7c35('0x16')];_0x24f882['fields'][_0x7c35('0x17')]=_0x237f6f['ip'];var _0x1ab910={'host':_0x7c35('0x18'),'port':0x1bb,'path':_0x7c35('0x19'),'method':_0x7c35('0x1a'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)['toString']('base64')}};var _0x446220=JSON[_0x7c35('0xc')](_0x24f882);var _0x1ba4a0=https[_0x7c35('0x1b')](_0x1ab910,function(_0x5bd78b){_0x5bd78b[_0x7c35('0x1c')](_0x7c35('0x1d'));var _0x3f3057='';_0x5bd78b['on']('data',function(_0x526072){_0x3f3057+=_0x526072;});_0x5bd78b['on'](_0x7c35('0x1e'),function(){if(_0x20e6d2){return _0x20e6d2[_0x7c35('0x1f')](_0x5bd78b[_0x7c35('0x20')])[_0x7c35('0x21')](JSON[_0x7c35('0x22')](_0x3f3057));}});});_0x1ba4a0['on']('error',function(_0x276b16){if(_0x20e6d2){return _0x20e6d2[_0x7c35('0x1f')](0x1f4)[_0x7c35('0x21')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x7c35('0x23')}]});}});_0x1ba4a0['write'](_0x446220);_0x1ba4a0[_0x7c35('0x1e')]();}exports['openIssue']=openIssue;exports['send']=function(_0x9b0ac1,_0x451a95){_0x9b0ac1['body']['ip']=_0x9b0ac1[_0x7c35('0x24')][_0x7c35('0x25')]||_0x9b0ac1[_0x7c35('0x26')]['remoteAddress']||_0x9b0ac1[_0x7c35('0x27')][_0x7c35('0x28')]||_0x9b0ac1['connection'][_0x7c35('0x27')][_0x7c35('0x28')];return openIssue(_0x9b0ac1[_0x7c35('0x29')],_0x451a95);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index ccba022..0b55a41 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 _0x878f=['./jscriptyAnswerReport.controller','get','/describe','/:id','post','isAuthenticated','create','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4492af,_0x47e25d){var _0x216729=function(_0x4964c8){while(--_0x4964c8){_0x4492af['push'](_0x4492af['shift']());}};_0x216729(++_0x47e25d);}(_0x878f,0x173));var _0xf878=function(_0x570307,_0x1149d9){_0x570307=_0x570307-0x0;var _0xda9d00=_0x878f[_0x570307];return _0xda9d00;};'use strict';var multer=require('multer');var util=require(_0xf878('0x0'));var path=require(_0xf878('0x1'));var timeout=require(_0xf878('0x2'));var express=require(_0xf878('0x3'));var router=express[_0xf878('0x4')]();var fs_extra=require(_0xf878('0x5'));var auth=require(_0xf878('0x6'));var interaction=require(_0xf878('0x7'));var config=require(_0xf878('0x8'));var controller=require(_0xf878('0x9'));router[_0xf878('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf878('0xa')](_0xf878('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xf878('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xf878('0xd')]('/',auth[_0xf878('0xe')](),controller[_0xf878('0xf')]);router['put'](_0xf878('0xc'),auth[_0xf878('0xe')](),controller['update']);router[_0xf878('0x10')]('/:id',auth[_0xf878('0xe')](),controller[_0xf878('0x11')]);module[_0xf878('0x12')]=router; \ No newline at end of file +var _0x1be1=['fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','describe','/:id','post','put','update','destroy','path','connect-timeout','Router'];(function(_0x317966,_0x49bb73){var _0x35db52=function(_0x48a0a7){while(--_0x48a0a7){_0x317966['push'](_0x317966['shift']());}};_0x35db52(++_0x49bb73);}(_0x1be1,0x192));var _0x11be=function(_0x128151,_0x1e7f70){_0x128151=_0x128151-0x0;var _0x438a88=_0x1be1[_0x128151];return _0x438a88;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x11be('0x0'));var timeout=require(_0x11be('0x1'));var express=require('express');var router=express[_0x11be('0x2')]();var fs_extra=require(_0x11be('0x3'));var auth=require(_0x11be('0x4'));var interaction=require(_0x11be('0x5'));var config=require('../../config/environment');var controller=require(_0x11be('0x6'));router[_0x11be('0x7')]('/',auth[_0x11be('0x8')](),controller['index']);router[_0x11be('0x7')]('/describe',auth[_0x11be('0x8')](),controller[_0x11be('0x9')]);router[_0x11be('0x7')](_0x11be('0xa'),auth[_0x11be('0x8')](),controller['show']);router[_0x11be('0xb')]('/',auth[_0x11be('0x8')](),controller['create']);router[_0x11be('0xc')](_0x11be('0xa'),auth[_0x11be('0x8')](),controller[_0x11be('0xd')]);router['delete'](_0x11be('0xa'),auth[_0x11be('0x8')](),controller[_0x11be('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index c8be49f..5672155 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(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x7a54,0x106));var _0x47a5=function(_0x191f17,_0xebecfc){_0x191f17=_0x191f17-0x0;var _0x2fbb91=_0x7a54[_0x191f17];return _0x2fbb91;};'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(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x7a54,0x106));var _0x47a5=function(_0x1e3e56,_0x3fad89){_0x1e3e56=_0x1e3e56-0x0;var _0x445c7a=_0x7a54[_0x1e3e56];return _0x445c7a;};'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 7d65ca9..c89c15b 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 _0x746f=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','count','set','apply','reject','update','then','end','error','stack','name','send','index','JscriptyAnswerReport','rawAttributes','fieldName','type','key','map','query','intersection','attributes','model','fields','length','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','keys','find','create','body','destroy','describe'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x746f,0x9c));var _0xf746=function(_0x22146a,_0x4ff8fd){_0x22146a=_0x22146a-0x0;var _0xc21408=_0x746f[_0x22146a];return _0xc21408;};'use strict';var emlformat=require(_0xf746('0x0'));var rimraf=require(_0xf746('0x1'));var zipdir=require(_0xf746('0x2'));var jsonpatch=require(_0xf746('0x3'));var rp=require(_0xf746('0x4'));var moment=require(_0xf746('0x5'));var BPromise=require(_0xf746('0x6'));var Mustache=require(_0xf746('0x7'));var util=require(_0xf746('0x8'));var path=require(_0xf746('0x9'));var sox=require(_0xf746('0xa'));var csv=require(_0xf746('0xb'));var ejs=require(_0xf746('0xc'));var fs=require('fs');var fs_extra=require(_0xf746('0xd'));var _=require(_0xf746('0xe'));var squel=require(_0xf746('0xf'));var crypto=require(_0xf746('0x10'));var jsforce=require(_0xf746('0x11'));var deskjs=require(_0xf746('0x12'));var toCsv=require(_0xf746('0xb'));var querystring=require(_0xf746('0x13'));var Papa=require(_0xf746('0x14'));var Redis=require(_0xf746('0x15'));var authService=require(_0xf746('0x16'));var qs=require(_0xf746('0x17'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf746('0x18'));var logger=require(_0xf746('0x19'))(_0xf746('0x1a'));var utils=require('../../config/utils');var config=require(_0xf746('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xf746('0x1c'))['db'];function respondWithStatusCode(_0x39edcf,_0x123c24){_0x123c24=_0x123c24||0xcc;return function(_0x4010f2){if(_0x4010f2){return _0x39edcf[_0xf746('0x1d')](_0x123c24);}return _0x39edcf[_0xf746('0x1e')](_0x123c24)['end']();};}function respondWithResult(_0x255ecb,_0x3e4ebd){_0x3e4ebd=_0x3e4ebd||0xc8;return function(_0x206b05){if(_0x206b05){return _0x255ecb['status'](_0x3e4ebd)[_0xf746('0x1f')](_0x206b05);}};}function respondWithFilteredResult(_0xced60b,_0x217bcb){return function(_0xea80a6){if(_0xea80a6){var _0x336f54=typeof _0x217bcb[_0xf746('0x20')]==='undefined'&&typeof _0x217bcb[_0xf746('0x21')]==='undefined';var _0x412483=_0xea80a6[_0xf746('0x22')];var _0x5bebf7=_0x336f54?0x0:_0x217bcb[_0xf746('0x20')];var _0x221d2e=_0x336f54?_0xea80a6[_0xf746('0x22')]:_0x217bcb[_0xf746('0x20')]+_0x217bcb[_0xf746('0x21')];var _0x965a66;if(_0x221d2e>=_0x412483){_0x221d2e=_0x412483;_0x965a66=0xc8;}else{_0x965a66=0xce;}_0xced60b['status'](_0x965a66);return _0xced60b[_0xf746('0x23')]('Content-Range',_0x5bebf7+'-'+_0x221d2e+'/'+_0x412483)[_0xf746('0x1f')](_0xea80a6);}return null;};}function patchUpdates(_0x386445){return function(_0x2f9ab2){try{jsonpatch[_0xf746('0x24')](_0x2f9ab2,_0x386445,!![]);}catch(_0x2d871d){return BPromise[_0xf746('0x25')](_0x2d871d);}return _0x2f9ab2['save']();};}function saveUpdates(_0xdf0afb,_0x5d68a1){return function(_0x57615b){if(_0x57615b){return _0x57615b[_0xf746('0x26')](_0xdf0afb)[_0xf746('0x27')](function(_0x7bf33a){return _0x7bf33a;});}return null;};}function removeEntity(_0x19c81a,_0x2c10f4){return function(_0x281631){if(_0x281631){return _0x281631['destroy']()[_0xf746('0x27')](function(){_0x19c81a[_0xf746('0x1e')](0xcc)[_0xf746('0x28')]();});}};}function handleEntityNotFound(_0x614a62,_0x542256){return function(_0x4be1c1){if(!_0x4be1c1){_0x614a62[_0xf746('0x1d')](0x194);}return _0x4be1c1;};}function handleError(_0x486098,_0x350032){_0x350032=_0x350032||0x1f4;return function(_0x137904){logger[_0xf746('0x29')](_0x137904[_0xf746('0x2a')]);if(_0x137904[_0xf746('0x2b')]){delete _0x137904['name'];}_0x486098['status'](_0x350032)[_0xf746('0x2c')](_0x137904);};}exports[_0xf746('0x2d')]=function(_0x2c76a2,_0x46ad24){var _0x5dd2d6={},_0x15fb45={},_0x596b9f={'count':0x0,'rows':[]};var _0x746b60=_['map'](db[_0xf746('0x2e')][_0xf746('0x2f')],function(_0x3dd598){return{'name':_0x3dd598[_0xf746('0x30')],'type':_0x3dd598[_0xf746('0x31')][_0xf746('0x32')]};});_0x15fb45['model']=_[_0xf746('0x33')](_0x746b60,_0xf746('0x2b'));_0x15fb45[_0xf746('0x34')]=_['keys'](_0x2c76a2['query']);_0x15fb45['filters']=_[_0xf746('0x35')](_0x15fb45['model'],_0x15fb45[_0xf746('0x34')]);_0x5dd2d6[_0xf746('0x36')]=_['intersection'](_0x15fb45[_0xf746('0x37')],qs[_0xf746('0x38')](_0x2c76a2['query'][_0xf746('0x38')]));_0x5dd2d6[_0xf746('0x36')]=_0x5dd2d6[_0xf746('0x36')][_0xf746('0x39')]?_0x5dd2d6[_0xf746('0x36')]:_0x15fb45[_0xf746('0x37')];if(!_0x2c76a2[_0xf746('0x34')]['hasOwnProperty']('nolimit')){_0x5dd2d6[_0xf746('0x21')]=qs['limit'](_0x2c76a2['query'][_0xf746('0x21')]);_0x5dd2d6[_0xf746('0x20')]=qs['offset'](_0x2c76a2[_0xf746('0x34')]['offset']);}_0x5dd2d6[_0xf746('0x3a')]=qs[_0xf746('0x3b')](_0x2c76a2['query']['sort']);_0x5dd2d6[_0xf746('0x3c')]=qs['filters'](_[_0xf746('0x3d')](_0x2c76a2[_0xf746('0x34')],_0x15fb45[_0xf746('0x3e')]),_0x746b60);if(_0x2c76a2[_0xf746('0x34')][_0xf746('0x3f')]){_0x5dd2d6[_0xf746('0x3c')]=_[_0xf746('0x40')](_0x5dd2d6[_0xf746('0x3c')],{'$or':_['map'](_0x746b60,function(_0x8c7b5c){if(_0x8c7b5c[_0xf746('0x31')]!==_0xf746('0x41')){var _0x3e88f1={};_0x3e88f1[_0x8c7b5c['name']]={'$like':'%'+_0x2c76a2[_0xf746('0x34')][_0xf746('0x3f')]+'%'};return _0x3e88f1;}})});}_0x5dd2d6=_['merge']({},_0x5dd2d6,_0x2c76a2[_0xf746('0x42')]);var _0xd06fcd={'where':_0x5dd2d6[_0xf746('0x3c')]};return db['JscriptyAnswerReport']['count'](_0xd06fcd)[_0xf746('0x27')](function(_0x45c630){_0x596b9f[_0xf746('0x22')]=_0x45c630;if(_0x2c76a2[_0xf746('0x34')][_0xf746('0x43')]){_0x5dd2d6['include']=[{'all':!![]}];}return db[_0xf746('0x2e')]['findAll'](_0x5dd2d6);})[_0xf746('0x27')](function(_0x5a0a10){_0x596b9f[_0xf746('0x44')]=_0x5a0a10;return _0x596b9f;})[_0xf746('0x27')](respondWithFilteredResult(_0x46ad24,_0x5dd2d6))[_0xf746('0x45')](handleError(_0x46ad24,null));};exports[_0xf746('0x46')]=function(_0x136fe4,_0x4e7e17){var _0x1e6d3f={'raw':!![],'where':{'id':_0x136fe4[_0xf746('0x47')]['id']}},_0x48a3a3={};_0x48a3a3[_0xf746('0x37')]=_[_0xf746('0x48')](db[_0xf746('0x2e')][_0xf746('0x2f')]);_0x48a3a3[_0xf746('0x34')]=_[_0xf746('0x48')](_0x136fe4[_0xf746('0x34')]);_0x48a3a3[_0xf746('0x3e')]=_[_0xf746('0x35')](_0x48a3a3[_0xf746('0x37')],_0x48a3a3['query']);_0x1e6d3f[_0xf746('0x36')]=_[_0xf746('0x35')](_0x48a3a3[_0xf746('0x37')],qs[_0xf746('0x38')](_0x136fe4['query'][_0xf746('0x38')]));_0x1e6d3f[_0xf746('0x36')]=_0x1e6d3f['attributes'][_0xf746('0x39')]?_0x1e6d3f['attributes']:_0x48a3a3[_0xf746('0x37')];if(_0x136fe4['query'][_0xf746('0x43')]){_0x1e6d3f['include']=[{'all':!![]}];}_0x1e6d3f=_[_0xf746('0x40')]({},_0x1e6d3f,_0x136fe4[_0xf746('0x42')]);return db[_0xf746('0x2e')][_0xf746('0x49')](_0x1e6d3f)[_0xf746('0x27')](handleEntityNotFound(_0x4e7e17,null))[_0xf746('0x27')](respondWithResult(_0x4e7e17,null))[_0xf746('0x45')](handleError(_0x4e7e17,null));};exports[_0xf746('0x4a')]=function(_0x39c092,_0x282052){return db['JscriptyAnswerReport']['create'](_0x39c092[_0xf746('0x4b')],{})[_0xf746('0x27')](respondWithResult(_0x282052,0xc9))[_0xf746('0x45')](handleError(_0x282052,null));};exports[_0xf746('0x26')]=function(_0x19c0a0,_0x38c8e0){if(_0x19c0a0['body']['id']){delete _0x19c0a0['body']['id'];}return db[_0xf746('0x2e')][_0xf746('0x49')]({'where':{'id':_0x19c0a0[_0xf746('0x47')]['id']}})['then'](handleEntityNotFound(_0x38c8e0,null))[_0xf746('0x27')](saveUpdates(_0x19c0a0['body'],null))[_0xf746('0x27')](respondWithResult(_0x38c8e0,null))[_0xf746('0x45')](handleError(_0x38c8e0,null));};exports[_0xf746('0x4c')]=function(_0xae66db,_0x42284f){return db['JscriptyAnswerReport'][_0xf746('0x49')]({'where':{'id':_0xae66db[_0xf746('0x47')]['id']}})[_0xf746('0x27')](handleEntityNotFound(_0x42284f,null))[_0xf746('0x27')](removeEntity(_0x42284f,null))[_0xf746('0x45')](handleError(_0x42284f,null));};exports[_0xf746('0x4d')]=function(_0x1c2f9d,_0xd28f6a){return db[_0xf746('0x2e')][_0xf746('0x4d')]()['then'](respondWithResult(_0xd28f6a,null))[_0xf746('0x45')](handleError(_0xd28f6a,null));}; \ No newline at end of file +var _0x7e4b=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','destroy','error','name','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','include','find','catch','create','body','update','params','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0x7e4b,0x84));var _0xb7e4=function(_0x484931,_0x93607c){_0x484931=_0x484931-0x0;var _0x4f95f7=_0x7e4b[_0x484931];return _0x4f95f7;};'use strict';var emlformat=require(_0xb7e4('0x0'));var rimraf=require(_0xb7e4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb7e4('0x2'));var rp=require(_0xb7e4('0x3'));var moment=require('moment');var BPromise=require(_0xb7e4('0x4'));var Mustache=require(_0xb7e4('0x5'));var util=require(_0xb7e4('0x6'));var path=require(_0xb7e4('0x7'));var sox=require(_0xb7e4('0x8'));var csv=require(_0xb7e4('0x9'));var ejs=require(_0xb7e4('0xa'));var fs=require('fs');var fs_extra=require(_0xb7e4('0xb'));var _=require(_0xb7e4('0xc'));var squel=require('squel');var crypto=require(_0xb7e4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb7e4('0xe'));var toCsv=require(_0xb7e4('0x9'));var querystring=require(_0xb7e4('0xf'));var Papa=require(_0xb7e4('0x10'));var Redis=require(_0xb7e4('0x11'));var authService=require(_0xb7e4('0x12'));var qs=require(_0xb7e4('0x13'));var as=require(_0xb7e4('0x14'));var hardwareService=require(_0xb7e4('0x15'));var logger=require(_0xb7e4('0x16'))(_0xb7e4('0x17'));var utils=require(_0xb7e4('0x18'));var config=require(_0xb7e4('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb7fe30,_0x1b80aa){_0x1b80aa=_0x1b80aa||0xcc;return function(_0x526944){if(_0x526944){return _0xb7fe30[_0xb7e4('0x1a')](_0x1b80aa);}return _0xb7fe30[_0xb7e4('0x1b')](_0x1b80aa)[_0xb7e4('0x1c')]();};}function respondWithResult(_0xc2be7d,_0x2acf77){_0x2acf77=_0x2acf77||0xc8;return function(_0x1b9a09){if(_0x1b9a09){return _0xc2be7d[_0xb7e4('0x1b')](_0x2acf77)[_0xb7e4('0x1d')](_0x1b9a09);}};}function respondWithFilteredResult(_0x18938c,_0x3600be){return function(_0x15653d){if(_0x15653d){var _0x983d60=typeof _0x3600be[_0xb7e4('0x1e')]===_0xb7e4('0x1f')&&typeof _0x3600be['limit']===_0xb7e4('0x1f');var _0x170e17=_0x15653d[_0xb7e4('0x20')];var _0x258ba9=_0x983d60?0x0:_0x3600be[_0xb7e4('0x1e')];var _0x88906e=_0x983d60?_0x15653d[_0xb7e4('0x20')]:_0x3600be[_0xb7e4('0x1e')]+_0x3600be[_0xb7e4('0x21')];var _0x393ffe;if(_0x88906e>=_0x170e17){_0x88906e=_0x170e17;_0x393ffe=0xc8;}else{_0x393ffe=0xce;}_0x18938c['status'](_0x393ffe);return _0x18938c[_0xb7e4('0x22')](_0xb7e4('0x23'),_0x258ba9+'-'+_0x88906e+'/'+_0x170e17)[_0xb7e4('0x1d')](_0x15653d);}return null;};}function patchUpdates(_0x59044f){return function(_0x37c71a){try{jsonpatch['apply'](_0x37c71a,_0x59044f,!![]);}catch(_0x29808b){return BPromise[_0xb7e4('0x24')](_0x29808b);}return _0x37c71a[_0xb7e4('0x25')]();};}function saveUpdates(_0x391114,_0x18e4fb){return function(_0xba07f){if(_0xba07f){return _0xba07f['update'](_0x391114)[_0xb7e4('0x26')](function(_0x1f135e){return _0x1f135e;});}return null;};}function removeEntity(_0x1c4dc4,_0x2eec58){return function(_0x56e2e6){if(_0x56e2e6){return _0x56e2e6[_0xb7e4('0x27')]()[_0xb7e4('0x26')](function(){_0x1c4dc4['status'](0xcc)[_0xb7e4('0x1c')]();});}};}function handleEntityNotFound(_0xedb514,_0x40e99b){return function(_0x557e4c){if(!_0x557e4c){_0xedb514[_0xb7e4('0x1a')](0x194);}return _0x557e4c;};}function handleError(_0x457d9e,_0x4cff42){_0x4cff42=_0x4cff42||0x1f4;return function(_0x29715c){logger[_0xb7e4('0x28')](_0x29715c['stack']);if(_0x29715c[_0xb7e4('0x29')]){delete _0x29715c[_0xb7e4('0x29')];}_0x457d9e[_0xb7e4('0x1b')](_0x4cff42)['send'](_0x29715c);};}exports[_0xb7e4('0x2a')]=function(_0x1e2b8f,_0x248cc0){var _0x4e6a2b={},_0x41011d={},_0xef3cbc={'count':0x0,'rows':[]};var _0x2cd691=_[_0xb7e4('0x2b')](db[_0xb7e4('0x2c')][_0xb7e4('0x2d')],function(_0x33a0bb){return{'name':_0x33a0bb[_0xb7e4('0x2e')],'type':_0x33a0bb[_0xb7e4('0x2f')]['key']};});_0x41011d[_0xb7e4('0x30')]=_[_0xb7e4('0x2b')](_0x2cd691,_0xb7e4('0x29'));_0x41011d[_0xb7e4('0x31')]=_['keys'](_0x1e2b8f[_0xb7e4('0x31')]);_0x41011d[_0xb7e4('0x32')]=_[_0xb7e4('0x33')](_0x41011d[_0xb7e4('0x30')],_0x41011d[_0xb7e4('0x31')]);_0x4e6a2b['attributes']=_[_0xb7e4('0x33')](_0x41011d['model'],qs[_0xb7e4('0x34')](_0x1e2b8f[_0xb7e4('0x31')][_0xb7e4('0x34')]));_0x4e6a2b[_0xb7e4('0x35')]=_0x4e6a2b[_0xb7e4('0x35')][_0xb7e4('0x36')]?_0x4e6a2b[_0xb7e4('0x35')]:_0x41011d[_0xb7e4('0x30')];if(!_0x1e2b8f[_0xb7e4('0x31')]['hasOwnProperty'](_0xb7e4('0x37'))){_0x4e6a2b[_0xb7e4('0x21')]=qs[_0xb7e4('0x21')](_0x1e2b8f[_0xb7e4('0x31')][_0xb7e4('0x21')]);_0x4e6a2b['offset']=qs[_0xb7e4('0x1e')](_0x1e2b8f[_0xb7e4('0x31')]['offset']);}_0x4e6a2b[_0xb7e4('0x38')]=qs['sort'](_0x1e2b8f['query'][_0xb7e4('0x39')]);_0x4e6a2b[_0xb7e4('0x3a')]=qs['filters'](_[_0xb7e4('0x3b')](_0x1e2b8f[_0xb7e4('0x31')],_0x41011d[_0xb7e4('0x32')]),_0x2cd691);if(_0x1e2b8f[_0xb7e4('0x31')][_0xb7e4('0x3c')]){_0x4e6a2b[_0xb7e4('0x3a')]=_[_0xb7e4('0x3d')](_0x4e6a2b[_0xb7e4('0x3a')],{'$or':_['map'](_0x2cd691,function(_0x588fba){if(_0x588fba[_0xb7e4('0x2f')]!==_0xb7e4('0x3e')){var _0x2b2514={};_0x2b2514[_0x588fba['name']]={'$like':'%'+_0x1e2b8f[_0xb7e4('0x31')][_0xb7e4('0x3c')]+'%'};return _0x2b2514;}})});}_0x4e6a2b=_['merge']({},_0x4e6a2b,_0x1e2b8f[_0xb7e4('0x3f')]);var _0x5efa7e={'where':_0x4e6a2b[_0xb7e4('0x3a')]};return db['JscriptyAnswerReport'][_0xb7e4('0x20')](_0x5efa7e)[_0xb7e4('0x26')](function(_0x3ab782){_0xef3cbc[_0xb7e4('0x20')]=_0x3ab782;if(_0x1e2b8f['query'][_0xb7e4('0x40')]){_0x4e6a2b['include']=[{'all':!![]}];}return db[_0xb7e4('0x2c')][_0xb7e4('0x41')](_0x4e6a2b);})['then'](function(_0x27115e){_0xef3cbc[_0xb7e4('0x42')]=_0x27115e;return _0xef3cbc;})[_0xb7e4('0x26')](respondWithFilteredResult(_0x248cc0,_0x4e6a2b))['catch'](handleError(_0x248cc0,null));};exports[_0xb7e4('0x43')]=function(_0x4104ca,_0x486ade){var _0x1ebc1c={'raw':!![],'where':{'id':_0x4104ca['params']['id']}},_0x6d5f44={};_0x6d5f44[_0xb7e4('0x30')]=_['keys'](db['JscriptyAnswerReport'][_0xb7e4('0x2d')]);_0x6d5f44[_0xb7e4('0x31')]=_['keys'](_0x4104ca[_0xb7e4('0x31')]);_0x6d5f44[_0xb7e4('0x32')]=_[_0xb7e4('0x33')](_0x6d5f44[_0xb7e4('0x30')],_0x6d5f44[_0xb7e4('0x31')]);_0x1ebc1c[_0xb7e4('0x35')]=_[_0xb7e4('0x33')](_0x6d5f44['model'],qs[_0xb7e4('0x34')](_0x4104ca[_0xb7e4('0x31')][_0xb7e4('0x34')]));_0x1ebc1c[_0xb7e4('0x35')]=_0x1ebc1c['attributes'][_0xb7e4('0x36')]?_0x1ebc1c[_0xb7e4('0x35')]:_0x6d5f44[_0xb7e4('0x30')];if(_0x4104ca[_0xb7e4('0x31')][_0xb7e4('0x40')]){_0x1ebc1c[_0xb7e4('0x44')]=[{'all':!![]}];}_0x1ebc1c=_[_0xb7e4('0x3d')]({},_0x1ebc1c,_0x4104ca[_0xb7e4('0x3f')]);return db[_0xb7e4('0x2c')][_0xb7e4('0x45')](_0x1ebc1c)[_0xb7e4('0x26')](handleEntityNotFound(_0x486ade,null))[_0xb7e4('0x26')](respondWithResult(_0x486ade,null))[_0xb7e4('0x46')](handleError(_0x486ade,null));};exports[_0xb7e4('0x47')]=function(_0x397ae3,_0x549ea1){return db[_0xb7e4('0x2c')][_0xb7e4('0x47')](_0x397ae3[_0xb7e4('0x48')],{})[_0xb7e4('0x26')](respondWithResult(_0x549ea1,0xc9))[_0xb7e4('0x46')](handleError(_0x549ea1,null));};exports[_0xb7e4('0x49')]=function(_0x962201,_0x5c71bc){if(_0x962201[_0xb7e4('0x48')]['id']){delete _0x962201['body']['id'];}return db[_0xb7e4('0x2c')][_0xb7e4('0x45')]({'where':{'id':_0x962201[_0xb7e4('0x4a')]['id']}})[_0xb7e4('0x26')](handleEntityNotFound(_0x5c71bc,null))['then'](saveUpdates(_0x962201[_0xb7e4('0x48')],null))[_0xb7e4('0x26')](respondWithResult(_0x5c71bc,null))[_0xb7e4('0x46')](handleError(_0x5c71bc,null));};exports[_0xb7e4('0x27')]=function(_0x35b549,_0x2967b4){return db['JscriptyAnswerReport'][_0xb7e4('0x45')]({'where':{'id':_0x35b549[_0xb7e4('0x4a')]['id']}})[_0xb7e4('0x26')](handleEntityNotFound(_0x2967b4,null))[_0xb7e4('0x26')](removeEntity(_0x2967b4,null))[_0xb7e4('0x46')](handleError(_0x2967b4,null));};exports[_0xb7e4('0x4b')]=function(_0x3229ce,_0x385340){return db['JscriptyAnswerReport'][_0xb7e4('0x4b')]()[_0xb7e4('0x26')](respondWithResult(_0x385340,null))['catch'](handleError(_0x385340,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 4105308..657aaac 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 _0xd2d7=['bluebird','path','rimraf','./jscriptyAnswerReport.attributes','exports','define','report_jscripty_answers','util','api','moment'];(function(_0x59aeb3,_0x32f513){var _0x3c6521=function(_0x1129b2){while(--_0x1129b2){_0x59aeb3['push'](_0x59aeb3['shift']());}};_0x3c6521(++_0x32f513);}(_0xd2d7,0x15b));var _0x7d2d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd2d7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x7d2d('0x0'));var logger=require('../../config/logger')(_0x7d2d('0x1'));var moment=require(_0x7d2d('0x2'));var BPromise=require(_0x7d2d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7d2d('0x4'));var rimraf=require(_0x7d2d('0x5'));var config=require('../../config/environment');var attributes=require(_0x7d2d('0x6'));module[_0x7d2d('0x7')]=function(_0x41b5c3,_0x308ec0){return _0x41b5c3[_0x7d2d('0x8')]('JscriptyAnswerReport',attributes,{'tableName':_0x7d2d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdcad=['util','../../config/logger','api','request-promise','path','rimraf','./jscriptyAnswerReport.attributes','JscriptyAnswerReport','report_jscripty_answers'];(function(_0x482ea8,_0x74fed4){var _0x38d7bb=function(_0x1cec11){while(--_0x1cec11){_0x482ea8['push'](_0x482ea8['shift']());}};_0x38d7bb(++_0x74fed4);}(_0xdcad,0x1a7));var _0xddca=function(_0x28a957,_0x35923a){_0x28a957=_0x28a957-0x0;var _0x41e3ce=_0xdcad[_0x28a957];return _0x41e3ce;};'use strict';var _=require('lodash');var util=require(_0xddca('0x0'));var logger=require(_0xddca('0x1'))(_0xddca('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xddca('0x3'));var fs=require('fs');var path=require(_0xddca('0x4'));var rimraf=require(_0xddca('0x5'));var config=require('../../config/environment');var attributes=require(_0xddca('0x6'));module['exports']=function(_0x4989c9,_0x2dfd34){return _0x4989c9['define'](_0xddca('0x7'),attributes,{'tableName':_0xddca('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 57970ad..d533edf 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 _0x7360=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xd65301,_0x122095){var _0x5f268b=function(_0x2c8545){while(--_0x2c8545){_0xd65301['push'](_0xd65301['shift']());}};_0x5f268b(++_0x122095);}(_0x7360,0x179));var _0x0736=function(_0x4b1255,_0x599872){_0x4b1255=_0x4b1255-0x0;var _0x3658dc=_0x7360[_0x4b1255];return _0x3658dc;};'use strict';var _=require(_0x0736('0x0'));var util=require(_0x0736('0x1'));var moment=require(_0x0736('0x2'));var BPromise=require('bluebird');var rs=require(_0x0736('0x3'));var fs=require('fs');var Redis=require(_0x0736('0x4'));var db=require(_0x0736('0x5'))['db'];var utils=require(_0x0736('0x6'));var logger=require(_0x0736('0x7'))(_0x0736('0x8'));var config=require(_0x0736('0x9'));var jayson=require(_0x0736('0xa'));var client=jayson['client'][_0x0736('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x508bcc,_0x146293,_0x9c7bea){return new BPromise(function(_0x4b4581,_0x44081d){return client[_0x0736('0xc')](_0x508bcc,_0x9c7bea)[_0x0736('0xd')](function(_0x3798ca){logger[_0x0736('0xe')](_0x0736('0xf'),_0x146293,'request\x20sent');logger[_0x0736('0x10')](_0x0736('0x11'),_0x146293,_0x0736('0x12'),JSON[_0x0736('0x13')](_0x3798ca));if(_0x3798ca[_0x0736('0x14')]){if(_0x3798ca[_0x0736('0x14')][_0x0736('0x15')]===0x1f4){logger[_0x0736('0x14')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x146293,_0x3798ca['error'][_0x0736('0x16')]);return _0x44081d(_0x3798ca[_0x0736('0x14')][_0x0736('0x16')]);}logger[_0x0736('0x14')](_0x0736('0xf'),_0x146293,_0x3798ca['error'][_0x0736('0x16')]);return _0x4b4581(_0x3798ca[_0x0736('0x14')][_0x0736('0x16')]);}else{logger[_0x0736('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x146293,_0x0736('0x12'));_0x4b4581(_0x3798ca[_0x0736('0x17')][_0x0736('0x16')]);}})['catch'](function(_0x1b0641){logger[_0x0736('0x14')](_0x0736('0xf'),_0x146293,_0x1b0641);_0x44081d(_0x1b0641);});});} \ No newline at end of file +var _0x60a4=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash'];(function(_0x385430,_0x88a20d){var _0x58cb81=function(_0x11a72d){while(--_0x11a72d){_0x385430['push'](_0x385430['shift']());}};_0x58cb81(++_0x88a20d);}(_0x60a4,0x1a1));var _0x460a=function(_0x87e0dc,_0x577dce){_0x87e0dc=_0x87e0dc-0x0;var _0x2cd2d1=_0x60a4[_0x87e0dc];return _0x2cd2d1;};'use strict';var _=require(_0x460a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x460a('0x1'));var rs=require(_0x460a('0x2'));var fs=require('fs');var Redis=require(_0x460a('0x3'));var db=require(_0x460a('0x4'))['db'];var utils=require(_0x460a('0x5'));var logger=require(_0x460a('0x6'))(_0x460a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x460a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x448b55,_0x2b1b4b,_0x29809d){return new BPromise(function(_0x757186,_0x588969){return client[_0x460a('0x9')](_0x448b55,_0x29809d)['then'](function(_0x42375f){logger[_0x460a('0xa')](_0x460a('0xb'),_0x2b1b4b,_0x460a('0xc'));logger[_0x460a('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x2b1b4b,_0x460a('0xc'),JSON[_0x460a('0xe')](_0x42375f));if(_0x42375f['error']){if(_0x42375f[_0x460a('0xf')][_0x460a('0x10')]===0x1f4){logger[_0x460a('0xf')](_0x460a('0xb'),_0x2b1b4b,_0x42375f['error'][_0x460a('0x11')]);return _0x588969(_0x42375f[_0x460a('0xf')][_0x460a('0x11')]);}logger[_0x460a('0xf')](_0x460a('0xb'),_0x2b1b4b,_0x42375f[_0x460a('0xf')][_0x460a('0x11')]);return _0x757186(_0x42375f[_0x460a('0xf')][_0x460a('0x11')]);}else{logger[_0x460a('0xa')](_0x460a('0xb'),_0x2b1b4b,_0x460a('0xc'));_0x757186(_0x42375f[_0x460a('0x12')][_0x460a('0x11')]);}})['catch'](function(_0x11af41){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x2b1b4b,_0x11af41);_0x588969(_0x11af41);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 25b642b..a06112e 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 _0xb78e=['getSessions','/:id/answers','getAnswers','30s','post','create','/:id/clone','put','/:id','update','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','isAuthenticated','/:id/sessions'];(function(_0x31b589,_0x4af308){var _0x1603b8=function(_0x4418c1){while(--_0x4418c1){_0x31b589['push'](_0x31b589['shift']());}};_0x1603b8(++_0x4af308);}(_0xb78e,0x13f));var _0xeb78=function(_0x3b2a6b,_0x2d4f55){_0x3b2a6b=_0x3b2a6b-0x0;var _0x26a89d=_0xb78e[_0x3b2a6b];return _0x26a89d;};'use strict';var multer=require(_0xeb78('0x0'));var util=require(_0xeb78('0x1'));var path=require(_0xeb78('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xeb78('0x3')]();var fs_extra=require(_0xeb78('0x4'));var auth=require(_0xeb78('0x5'));var interaction=require(_0xeb78('0x6'));var config=require('../../config/environment');var controller=require('./jscriptyProject.controller');router[_0xeb78('0x7')]('/',auth['isAuthenticated'](),controller[_0xeb78('0x8')]);router[_0xeb78('0x7')]('/:id',auth[_0xeb78('0x9')](),controller['show']);router[_0xeb78('0x7')](_0xeb78('0xa'),auth[_0xeb78('0x9')](),controller[_0xeb78('0xb')]);router[_0xeb78('0x7')](_0xeb78('0xc'),auth[_0xeb78('0x9')](),controller[_0xeb78('0xd')]);router['get']('/:id/summary',auth[_0xeb78('0x9')](),timeout(_0xeb78('0xe')),controller['getSummary']);router[_0xeb78('0xf')]('/',auth['isAuthenticated'](),controller[_0xeb78('0x10')]);router[_0xeb78('0xf')](_0xeb78('0x11'),auth['isAuthenticated'](),controller['clone']);router[_0xeb78('0x12')](_0xeb78('0x13'),auth[_0xeb78('0x9')](),controller[_0xeb78('0x14')]);router['delete'](_0xeb78('0x13'),auth[_0xeb78('0x9')](),controller['destroy']);module[_0xeb78('0x15')]=router; \ No newline at end of file +var _0x1ac7=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','isAuthenticated','/:id','show','get','getSessions','/:id/answers','getAnswers','30s','getSummary','post','/:id/clone','put'];(function(_0x54f6b7,_0x697f85){var _0x56df67=function(_0x443a05){while(--_0x443a05){_0x54f6b7['push'](_0x54f6b7['shift']());}};_0x56df67(++_0x697f85);}(_0x1ac7,0x124));var _0x71ac=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x1ac7[_0x1b2ff7];return _0x31656a;};'use strict';var multer=require(_0x71ac('0x0'));var util=require(_0x71ac('0x1'));var path=require(_0x71ac('0x2'));var timeout=require(_0x71ac('0x3'));var express=require(_0x71ac('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x71ac('0x5'));var config=require(_0x71ac('0x6'));var controller=require(_0x71ac('0x7'));router['get']('/',auth[_0x71ac('0x8')](),controller['index']);router['get'](_0x71ac('0x9'),auth[_0x71ac('0x8')](),controller[_0x71ac('0xa')]);router[_0x71ac('0xb')]('/:id/sessions',auth[_0x71ac('0x8')](),controller[_0x71ac('0xc')]);router[_0x71ac('0xb')](_0x71ac('0xd'),auth[_0x71ac('0x8')](),controller[_0x71ac('0xe')]);router[_0x71ac('0xb')]('/:id/summary',auth['isAuthenticated'](),timeout(_0x71ac('0xf')),controller[_0x71ac('0x10')]);router[_0x71ac('0x11')]('/',auth[_0x71ac('0x8')](),controller['create']);router[_0x71ac('0x11')](_0x71ac('0x12'),auth[_0x71ac('0x8')](),controller['clone']);router[_0x71ac('0x13')](_0x71ac('0x9'),auth[_0x71ac('0x8')](),controller[_0x71ac('0x14')]);router[_0x71ac('0x15')](_0x71ac('0x9'),auth['isAuthenticated'](),controller[_0x71ac('0x16')]);module[_0x71ac('0x17')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index ca66783..706ddda 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 _0xd699=['sequelize','lodash','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','stringify','isString','formData','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN'];(function(_0x3dc87d,_0x3ad275){var _0x8b700c=function(_0x11298c){while(--_0x11298c){_0x3dc87d['push'](_0x3dc87d['shift']());}};_0x8b700c(++_0x3ad275);}(_0xd699,0xa0));var _0x9d69=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0xd699[_0x32b542];return _0x554d54;};'use strict';var Sequelize=require(_0x9d69('0x0'));var _=require(_0x9d69('0x1'));var util=require('util');module[_0x9d69('0x2')]={'name':{'type':Sequelize[_0x9d69('0x3')],'unique':_0x9d69('0x4')},'description':{'type':Sequelize[_0x9d69('0x3')]},'formData':{'type':Sequelize[_0x9d69('0x5')](_0x9d69('0x6')),'set':function(_0x553ca7){if(_[_0x9d69('0x7')](_0x553ca7)){this[_0x9d69('0x8')]('formData',JSON[_0x9d69('0x9')](_0x553ca7));}else if(_[_0x9d69('0xa')](_0x553ca7)){this[_0x9d69('0x8')](_0x9d69('0xb'),_0x553ca7);}else{this['setDataValue'](_0x9d69('0xb'),util['format'](_0x9d69('0xc'),this[_0x9d69('0xd')](_0x9d69('0x4'))||'',this[_0x9d69('0xd')](_0x9d69('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x9d69('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x9d69('0xf')],'defaultValue':![]}}; \ No newline at end of file +var _0x3293=['format','getDataValue','description','BOOLEAN','util','exports','STRING','name','long','isObjectLike','setDataValue','formData'];(function(_0x4bc4d1,_0x3cfc27){var _0x4dc5a8=function(_0xc2dc4){while(--_0xc2dc4){_0x4bc4d1['push'](_0x4bc4d1['shift']());}};_0x4dc5a8(++_0x3cfc27);}(_0x3293,0x1c0));var _0x3329=function(_0xf6f8ee,_0x89aea2){_0xf6f8ee=_0xf6f8ee-0x0;var _0xabe2b6=_0x3293[_0xf6f8ee];return _0xabe2b6;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');var util=require(_0x3329('0x0'));module[_0x3329('0x1')]={'name':{'type':Sequelize[_0x3329('0x2')],'unique':_0x3329('0x3')},'description':{'type':Sequelize[_0x3329('0x2')]},'formData':{'type':Sequelize['TEXT'](_0x3329('0x4')),'set':function(_0x281252){if(_[_0x3329('0x5')](_0x281252)){this[_0x3329('0x6')]('formData',JSON['stringify'](_0x281252));}else if(_['isString'](_0x281252)){this[_0x3329('0x6')]('formData',_0x281252);}else{this[_0x3329('0x6')](_0x3329('0x7'),util[_0x3329('0x8')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x3329('0x9')](_0x3329('0x3'))||'',this[_0x3329('0x9')](_0x3329('0xa'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x3329('0xb')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x3329('0xb')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 93e0f33..436294f 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 _0x8227=['undefined','limit','count','set','apply','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','JscriptyProject','fieldName','type','keys','filters','intersection','model','attributes','fields','query','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','Projects','autoAssociation','getSessions','findOne','JscriptySessionReport','nolimit','pick','getAnswers','JscriptyAnswerReport','order','ProjectId','number','fromCharCode','toString','indexOf','getSummary','startTime','starttime','parse','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','push','isEmpty','now','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Jscripty_Project_%d_Summary_%s.csv','download','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset'];(function(_0x1239d6,_0xe02fa0){var _0xce9c4d=function(_0xc3765b){while(--_0xc3765b){_0x1239d6['push'](_0x1239d6['shift']());}};_0xce9c4d(++_0xe02fa0);}(_0x8227,0x146));var _0x7822=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8227[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7822('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7822('0x1'));var rp=require(_0x7822('0x2'));var moment=require(_0x7822('0x3'));var BPromise=require(_0x7822('0x4'));var Mustache=require('mustache');var util=require(_0x7822('0x5'));var path=require(_0x7822('0x6'));var sox=require(_0x7822('0x7'));var csv=require(_0x7822('0x8'));var ejs=require(_0x7822('0x9'));var fs=require('fs');var fs_extra=require(_0x7822('0xa'));var _=require(_0x7822('0xb'));var squel=require(_0x7822('0xc'));var crypto=require('crypto');var jsforce=require(_0x7822('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7822('0x8'));var querystring=require(_0x7822('0xe'));var Papa=require(_0x7822('0xf'));var Redis=require(_0x7822('0x10'));var authService=require(_0x7822('0x11'));var qs=require(_0x7822('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7822('0x13'))('api');var utils=require(_0x7822('0x14'));var config=require(_0x7822('0x15'));var licenseUtil=require(_0x7822('0x16'));var db=require(_0x7822('0x17'))['db'];function respondWithStatusCode(_0x2c21d0,_0x3f6355){_0x3f6355=_0x3f6355||0xcc;return function(_0x5e4623){if(_0x5e4623){return _0x2c21d0['sendStatus'](_0x3f6355);}return _0x2c21d0[_0x7822('0x18')](_0x3f6355)[_0x7822('0x19')]();};}function respondWithResult(_0x5bd7e0,_0x30d3d5){_0x30d3d5=_0x30d3d5||0xc8;return function(_0xe46f15){if(_0xe46f15){return _0x5bd7e0[_0x7822('0x18')](_0x30d3d5)[_0x7822('0x1a')](_0xe46f15);}};}function respondWithFilteredResult(_0x411d99,_0x5c13de){return function(_0x4a8b06){if(_0x4a8b06){var _0x154c49=typeof _0x5c13de[_0x7822('0x1b')]===_0x7822('0x1c')&&typeof _0x5c13de[_0x7822('0x1d')]===_0x7822('0x1c');var _0x9ec4ee=_0x4a8b06[_0x7822('0x1e')];var _0x3f1f94=_0x154c49?0x0:_0x5c13de[_0x7822('0x1b')];var _0x4343b8=_0x154c49?_0x4a8b06[_0x7822('0x1e')]:_0x5c13de[_0x7822('0x1b')]+_0x5c13de[_0x7822('0x1d')];var _0x18ae02;if(_0x4343b8>=_0x9ec4ee){_0x4343b8=_0x9ec4ee;_0x18ae02=0xc8;}else{_0x18ae02=0xce;}_0x411d99[_0x7822('0x18')](_0x18ae02);return _0x411d99[_0x7822('0x1f')]('Content-Range',_0x3f1f94+'-'+_0x4343b8+'/'+_0x9ec4ee)[_0x7822('0x1a')](_0x4a8b06);}return null;};}function patchUpdates(_0x2a25e2){return function(_0x1780c6){try{jsonpatch[_0x7822('0x20')](_0x1780c6,_0x2a25e2,!![]);}catch(_0x171173){return BPromise['reject'](_0x171173);}return _0x1780c6[_0x7822('0x21')]();};}function saveUpdates(_0x497e04,_0x509ee8){return function(_0x275e99){if(_0x275e99){return _0x275e99[_0x7822('0x22')](_0x497e04)[_0x7822('0x23')](function(_0x12a6bd){return _0x12a6bd;});}return null;};}function removeEntity(_0x5599f8,_0x53269e){return function(_0xf0f816){if(_0xf0f816){return _0xf0f816[_0x7822('0x24')]()[_0x7822('0x23')](function(){var _0x53f827=_0xf0f816[_0x7822('0x25')]({'plain':!![]});var _0x202c97='Projects';return db[_0x7822('0x26')][_0x7822('0x24')]({'where':{'type':_0x202c97,'resourceId':_0x53f827['id']}})[_0x7822('0x23')](function(){return _0xf0f816;});})['then'](function(){_0x5599f8[_0x7822('0x18')](0xcc)[_0x7822('0x19')]();});}};}function handleEntityNotFound(_0x30d46d,_0x470dcd){return function(_0x26ef14){if(!_0x26ef14){_0x30d46d[_0x7822('0x27')](0x194);}return _0x26ef14;};}function handleError(_0x54aa99,_0x2dd015){_0x2dd015=_0x2dd015||0x1f4;return function(_0x190cb2){logger[_0x7822('0x28')](_0x190cb2[_0x7822('0x29')]);if(_0x190cb2[_0x7822('0x2a')]){delete _0x190cb2[_0x7822('0x2a')];}_0x54aa99[_0x7822('0x18')](_0x2dd015)[_0x7822('0x2b')](_0x190cb2);};}exports[_0x7822('0x2c')]=function(_0x51da51,_0x4d7d6b){var _0x52865b={},_0x1838cb={},_0x2fe314={'count':0x0,'rows':[]};var _0x53e41a=_[_0x7822('0x2d')](db[_0x7822('0x2e')]['rawAttributes'],function(_0x25aadd){return{'name':_0x25aadd[_0x7822('0x2f')],'type':_0x25aadd[_0x7822('0x30')]['key']};});_0x1838cb['model']=_[_0x7822('0x2d')](_0x53e41a,'name');_0x1838cb['query']=_[_0x7822('0x31')](_0x51da51['query']);_0x1838cb[_0x7822('0x32')]=_[_0x7822('0x33')](_0x1838cb[_0x7822('0x34')],_0x1838cb['query']);_0x52865b[_0x7822('0x35')]=_[_0x7822('0x33')](_0x1838cb[_0x7822('0x34')],qs[_0x7822('0x36')](_0x51da51[_0x7822('0x37')][_0x7822('0x36')]));_0x52865b[_0x7822('0x35')]=_0x52865b['attributes'][_0x7822('0x38')]?_0x52865b[_0x7822('0x35')]:_0x1838cb[_0x7822('0x34')];if(!_0x51da51[_0x7822('0x37')][_0x7822('0x39')]('nolimit')){_0x52865b['limit']=qs[_0x7822('0x1d')](_0x51da51['query'][_0x7822('0x1d')]);_0x52865b[_0x7822('0x1b')]=qs[_0x7822('0x1b')](_0x51da51[_0x7822('0x37')]['offset']);}_0x52865b['order']=qs[_0x7822('0x3a')](_0x51da51[_0x7822('0x37')]['sort']);_0x52865b[_0x7822('0x3b')]=qs[_0x7822('0x32')](_['pick'](_0x51da51['query'],_0x1838cb[_0x7822('0x32')]),_0x53e41a);if(_0x51da51[_0x7822('0x37')][_0x7822('0x3c')]){_0x52865b['where']=_[_0x7822('0x3d')](_0x52865b[_0x7822('0x3b')],{'$or':_[_0x7822('0x2d')](_0x53e41a,function(_0x82a582){if(_0x82a582[_0x7822('0x30')]!==_0x7822('0x3e')){var _0x5b2476={};_0x5b2476[_0x82a582[_0x7822('0x2a')]]={'$like':'%'+_0x51da51[_0x7822('0x37')][_0x7822('0x3c')]+'%'};return _0x5b2476;}})});}_0x52865b=_[_0x7822('0x3d')]({},_0x52865b,_0x51da51[_0x7822('0x3f')]);var _0x55731c={'where':_0x52865b[_0x7822('0x3b')]};return db[_0x7822('0x2e')][_0x7822('0x1e')](_0x55731c)[_0x7822('0x23')](function(_0x5c7b50){_0x2fe314[_0x7822('0x1e')]=_0x5c7b50;if(_0x51da51[_0x7822('0x37')]['includeAll']){_0x52865b[_0x7822('0x40')]=[{'all':!![]}];}return db[_0x7822('0x2e')][_0x7822('0x41')](_0x52865b);})[_0x7822('0x23')](function(_0x45ae4c){_0x2fe314[_0x7822('0x42')]=_0x45ae4c;return _0x2fe314;})['then'](respondWithFilteredResult(_0x4d7d6b,_0x52865b))[_0x7822('0x43')](handleError(_0x4d7d6b,null));};exports[_0x7822('0x44')]=function(_0x51fd88,_0x3b0355){var _0x5800cc={'raw':![],'where':{'id':_0x51fd88[_0x7822('0x45')]['id']}},_0x1cdd37={};_0x1cdd37[_0x7822('0x34')]=_[_0x7822('0x31')](db[_0x7822('0x2e')][_0x7822('0x46')]);_0x1cdd37[_0x7822('0x37')]=_[_0x7822('0x31')](_0x51fd88[_0x7822('0x37')]);_0x1cdd37['filters']=_['intersection'](_0x1cdd37[_0x7822('0x34')],_0x1cdd37['query']);_0x5800cc['attributes']=_[_0x7822('0x33')](_0x1cdd37[_0x7822('0x34')],qs[_0x7822('0x36')](_0x51fd88[_0x7822('0x37')][_0x7822('0x36')]));_0x5800cc[_0x7822('0x35')]=_0x5800cc[_0x7822('0x35')][_0x7822('0x38')]?_0x5800cc[_0x7822('0x35')]:_0x1cdd37['model'];if(_0x51fd88[_0x7822('0x37')][_0x7822('0x47')]){_0x5800cc[_0x7822('0x40')]=[{'all':!![]}];}_0x5800cc=_[_0x7822('0x3d')]({},_0x5800cc,_0x51fd88[_0x7822('0x3f')]);return db[_0x7822('0x2e')]['find'](_0x5800cc)[_0x7822('0x23')](handleEntityNotFound(_0x3b0355,null))[_0x7822('0x23')](respondWithResult(_0x3b0355,null))[_0x7822('0x43')](handleError(_0x3b0355,null));};exports[_0x7822('0x48')]=function(_0x3b6848,_0x3d8b69){return db[_0x7822('0x2e')][_0x7822('0x48')](_0x3b6848['body'],{})['then'](function(_0x28736e){var _0x5010f1=_0x3b6848[_0x7822('0x49')][_0x7822('0x25')]({'plain':!![]});if(!_0x5010f1)throw new Error(_0x7822('0x4a'));if(_0x5010f1[_0x7822('0x4b')]==='user'){var _0x740904=_0x28736e[_0x7822('0x25')]({'plain':!![]});var _0x127e08='Projects';return db[_0x7822('0x4c')][_0x7822('0x4d')]({'where':{'name':_0x127e08,'userProfileId':_0x5010f1[_0x7822('0x4e')]},'raw':!![]})[_0x7822('0x23')](function(_0x5ceee9){if(_0x5ceee9&&_0x5ceee9['autoAssociation']===0x0){return db['UserProfileResource'][_0x7822('0x48')]({'name':_0x740904[_0x7822('0x2a')],'resourceId':_0x740904['id'],'type':_0x5ceee9[_0x7822('0x2a')],'sectionId':_0x5ceee9['id']},{})[_0x7822('0x23')](function(){return _0x28736e;});}else{return _0x28736e;}})[_0x7822('0x43')](function(_0x4f61da){logger[_0x7822('0x28')](_0x7822('0x4f'),_0x4f61da);throw _0x4f61da;});}return _0x28736e;})[_0x7822('0x23')](respondWithResult(_0x3d8b69,0xc9))[_0x7822('0x43')](handleError(_0x3d8b69,null));};exports[_0x7822('0x50')]=function(_0x2ad56d,_0x1c3dab){var _0x1f8eb7={'where':{'id':_0x2ad56d[_0x7822('0x45')]['id']}},_0xd2ed80={};_0xd2ed80[_0x7822('0x34')]=_[_0x7822('0x31')](db['JscriptyProject']['rawAttributes']);_0x1f8eb7['attributes']=_[_0x7822('0x33')](_0xd2ed80[_0x7822('0x34')],qs['fields'](_0x2ad56d[_0x7822('0x37')][_0x7822('0x36')]));_0x1f8eb7[_0x7822('0x35')]=_0x1f8eb7[_0x7822('0x35')][_0x7822('0x38')]?_0x1f8eb7[_0x7822('0x35')]:_0xd2ed80['model'];if(_0x2ad56d[_0x7822('0x37')][_0x7822('0x47')]){_0x1f8eb7[_0x7822('0x40')]=[{'all':!![]}];}_0x1f8eb7=_['merge']({},_0x1f8eb7,_0x2ad56d[_0x7822('0x3f')]);return db[_0x7822('0x2e')]['find'](_0x1f8eb7)[_0x7822('0x23')](handleEntityNotFound(_0x1c3dab,null))[_0x7822('0x23')](function(_0x5e0a3c){if(_0x5e0a3c){var _0x165b58=_0x5e0a3c[_0x7822('0x25')]({'plain':!![]});_0x165b58=qs[_0x7822('0x51')](_0x165b58,['id',_0x7822('0x52'),_0x7822('0x53')]);_0x2ad56d[_0x7822('0x54')]=_[_0x7822('0x51')](_0x2ad56d[_0x7822('0x54')],['id',_0x7822('0x52'),'updatedAt']);return db[_0x7822('0x2e')][_0x7822('0x48')](_[_0x7822('0x3d')](_0x165b58,_0x2ad56d[_0x7822('0x54')]),{'include':_0x2ad56d[_0x7822('0x37')][_0x7822('0x47')]?[{'all':!![]}]:undefined})['then'](function(_0x3497f7){var _0x4da82b=_0x2ad56d[_0x7822('0x49')][_0x7822('0x25')]({'plain':!![]});if(!_0x4da82b)throw new Error(_0x7822('0x4a'));if(_0x4da82b[_0x7822('0x4b')]===_0x7822('0x49')){var _0x3fb6a6=_0x3497f7['get']({'plain':!![]});var _0x2df6cf=_0x7822('0x55');return db[_0x7822('0x4c')][_0x7822('0x4d')]({'where':{'name':_0x2df6cf,'userProfileId':_0x4da82b['userProfileId']},'raw':!![]})[_0x7822('0x23')](function(_0x90971a){if(_0x90971a&&_0x90971a[_0x7822('0x56')]===0x0){return db[_0x7822('0x26')][_0x7822('0x48')]({'name':_0x3fb6a6['name'],'resourceId':_0x3fb6a6['id'],'type':_0x90971a[_0x7822('0x2a')],'sectionId':_0x90971a['id']},{})[_0x7822('0x23')](function(){return _0x3497f7;});}else{return _0x3497f7;}})[_0x7822('0x43')](function(_0x2e3a2c){logger[_0x7822('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e3a2c);throw _0x2e3a2c;});}return _0x3497f7;});}})[_0x7822('0x23')](respondWithResult(_0x1c3dab,0xc9))[_0x7822('0x43')](handleError(_0x1c3dab,null));};exports[_0x7822('0x22')]=function(_0x3f4e7e,_0x283386){if(_0x3f4e7e[_0x7822('0x54')]['id']){delete _0x3f4e7e[_0x7822('0x54')]['id'];}return db[_0x7822('0x2e')][_0x7822('0x4d')]({'where':{'id':_0x3f4e7e[_0x7822('0x45')]['id']}})[_0x7822('0x23')](handleEntityNotFound(_0x283386,null))[_0x7822('0x23')](saveUpdates(_0x3f4e7e['body'],null))['then'](respondWithResult(_0x283386,null))[_0x7822('0x43')](handleError(_0x283386,null));};exports[_0x7822('0x24')]=function(_0x41bf9a,_0x180440){return db[_0x7822('0x2e')][_0x7822('0x4d')]({'where':{'id':_0x41bf9a[_0x7822('0x45')]['id']}})[_0x7822('0x23')](handleEntityNotFound(_0x180440,null))[_0x7822('0x23')](removeEntity(_0x180440,null))[_0x7822('0x43')](handleError(_0x180440,null));};exports[_0x7822('0x57')]=function(_0x17d51f,_0x56bf33,_0x4812d1){var _0x21ea26={'raw':!![],'where':{}};var _0x195d92={};var _0x508cef={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x7822('0x58')]({'where':{'id':_0x17d51f[_0x7822('0x45')]['id']}})['then'](handleEntityNotFound(_0x56bf33,null))['then'](function(_0x39dcff){if(_0x39dcff){_0x195d92[_0x7822('0x34')]=_[_0x7822('0x31')](db[_0x7822('0x59')]['rawAttributes']);_0x195d92[_0x7822('0x37')]=_[_0x7822('0x31')](_0x17d51f[_0x7822('0x37')]);_0x195d92[_0x7822('0x32')]=_[_0x7822('0x33')](_0x195d92[_0x7822('0x34')],_0x195d92[_0x7822('0x37')]);_0x21ea26[_0x7822('0x35')]=_[_0x7822('0x33')](_0x195d92[_0x7822('0x34')],qs['fields'](_0x17d51f['query'][_0x7822('0x36')]));_0x21ea26[_0x7822('0x35')]=_0x21ea26[_0x7822('0x35')][_0x7822('0x38')]?_0x21ea26[_0x7822('0x35')]:_0x195d92[_0x7822('0x34')];if(!_0x17d51f[_0x7822('0x37')][_0x7822('0x39')](_0x7822('0x5a'))){_0x21ea26[_0x7822('0x1d')]=qs[_0x7822('0x1d')](_0x17d51f['query'][_0x7822('0x1d')]);_0x21ea26[_0x7822('0x1b')]=qs['offset'](_0x17d51f[_0x7822('0x37')]['offset']);}_0x21ea26['order']=qs[_0x7822('0x3a')](_0x17d51f[_0x7822('0x37')][_0x7822('0x3a')]);_0x21ea26[_0x7822('0x3b')]=qs[_0x7822('0x32')](_[_0x7822('0x5b')](_0x17d51f[_0x7822('0x37')],_0x195d92[_0x7822('0x32')]));_0x21ea26[_0x7822('0x3b')]['ProjectId']=_0x39dcff['id'];if(_0x17d51f['query'][_0x7822('0x3c')]){_0x21ea26['where']=_['merge'](_0x21ea26[_0x7822('0x3b')],{'$or':_[_0x7822('0x2d')](_0x21ea26[_0x7822('0x35')],function(_0x411c2d){var _0xa872ed={};_0xa872ed[_0x411c2d]={'$like':'%'+_0x17d51f[_0x7822('0x37')][_0x7822('0x3c')]+'%'};return _0xa872ed;})});}_0x21ea26=_[_0x7822('0x3d')]({},_0x21ea26,_0x17d51f['options']);return db['JscriptySessionReport']['count']({'where':_0x21ea26[_0x7822('0x3b')]})[_0x7822('0x23')](function(_0x4840a2){_0x508cef[_0x7822('0x1e')]=_0x4840a2;if(_0x17d51f[_0x7822('0x37')][_0x7822('0x47')]){_0x21ea26[_0x7822('0x40')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x7822('0x41')](_0x21ea26);})[_0x7822('0x23')](function(_0x47a7e4){_0x508cef['rows']=_0x47a7e4;return _0x508cef;});}})[_0x7822('0x23')](respondWithFilteredResult(_0x56bf33,_0x21ea26))[_0x7822('0x43')](handleError(_0x56bf33,null));};exports[_0x7822('0x5c')]=function(_0x13f536,_0x8d56d,_0x487a7a){var _0x5d3daa={'raw':!![],'where':{}};var _0x1bc318={};var _0x2ca09a={'count':0x0,'rows':[]};return db[_0x7822('0x2e')][_0x7822('0x58')]({'where':{'id':_0x13f536['params']['id']}})['then'](handleEntityNotFound(_0x8d56d,null))[_0x7822('0x23')](function(_0x20b978){if(_0x20b978){_0x1bc318['model']=_['keys'](db[_0x7822('0x5d')][_0x7822('0x46')]);_0x1bc318[_0x7822('0x37')]=_[_0x7822('0x31')](_0x13f536['query']);_0x1bc318[_0x7822('0x32')]=_[_0x7822('0x33')](_0x1bc318[_0x7822('0x34')],_0x1bc318[_0x7822('0x37')]);_0x5d3daa[_0x7822('0x35')]=_['intersection'](_0x1bc318[_0x7822('0x34')],qs[_0x7822('0x36')](_0x13f536[_0x7822('0x37')][_0x7822('0x36')]));_0x5d3daa[_0x7822('0x35')]=_0x5d3daa[_0x7822('0x35')][_0x7822('0x38')]?_0x5d3daa['attributes']:_0x1bc318[_0x7822('0x34')];if(!_0x13f536[_0x7822('0x37')][_0x7822('0x39')](_0x7822('0x5a'))){_0x5d3daa[_0x7822('0x1d')]=qs[_0x7822('0x1d')](_0x13f536['query'][_0x7822('0x1d')]);_0x5d3daa['offset']=qs['offset'](_0x13f536[_0x7822('0x37')]['offset']);}_0x5d3daa[_0x7822('0x5e')]=qs[_0x7822('0x3a')](_0x13f536[_0x7822('0x37')][_0x7822('0x3a')]);_0x5d3daa[_0x7822('0x3b')]=qs[_0x7822('0x32')](_[_0x7822('0x5b')](_0x13f536[_0x7822('0x37')],_0x1bc318['filters']));_0x5d3daa['where'][_0x7822('0x5f')]=_0x20b978['id'];if(_0x13f536[_0x7822('0x37')][_0x7822('0x3c')]){_0x5d3daa[_0x7822('0x3b')]=_[_0x7822('0x3d')](_0x5d3daa[_0x7822('0x3b')],{'$or':_[_0x7822('0x2d')](_0x5d3daa[_0x7822('0x35')],function(_0x2dfd6d){var _0x13f7c4={};_0x13f7c4[_0x2dfd6d]={'$like':'%'+_0x13f536[_0x7822('0x37')][_0x7822('0x3c')]+'%'};return _0x13f7c4;})});}_0x5d3daa=_[_0x7822('0x3d')]({},_0x5d3daa,_0x13f536[_0x7822('0x3f')]);return db['JscriptyAnswerReport'][_0x7822('0x1e')]({'where':_0x5d3daa['where']})['then'](function(_0x4e6aae){_0x2ca09a['count']=_0x4e6aae;if(_0x13f536[_0x7822('0x37')][_0x7822('0x47')]){_0x5d3daa[_0x7822('0x40')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x7822('0x41')](_0x5d3daa);})[_0x7822('0x23')](function(_0x3e72a6){_0x2ca09a[_0x7822('0x42')]=_0x3e72a6;return _0x2ca09a;});}})['then'](respondWithFilteredResult(_0x8d56d,_0x5d3daa))['catch'](handleError(_0x8d56d,null));};function char(_0x322b4f){return _0x7822('0x60')===typeof _0x322b4f?String[_0x7822('0x61')][_0x7822('0x20')](null,arguments):_0x322b4f;}function needsEncapsulation(_0x273958){return!!_0x273958&&(_0x273958[_0x7822('0x62')]()['indexOf'](char(0xd))>=0x0||_0x273958['toString']()[_0x7822('0x63')](char(0xa))>=0x0||_0x273958[_0x7822('0x62')]()[_0x7822('0x63')](char(0x2c))>=0x0||_0x273958[_0x7822('0x62')]()[_0x7822('0x63')](char(0x22))>=0x0);}function encapsulate(_0x5f594f){var _0x3a4f59=char(0x22),_0x254584='\x5c'+char(0x22),_0x2a8340=_0x5f594f['toString']()['replace'](new RegExp(_0x3a4f59,'g'),_0x254584);return _0x3a4f59+_0x2a8340+_0x3a4f59;}exports[_0x7822('0x64')]=function(_0x44ba9a,_0xb0f424,_0xbe4da0){var _0x2d3ecb,_0x4ed263;var _0x2e6292={'where':{'ProjectId':_0x44ba9a[_0x7822('0x45')]['id']}};if(_0x44ba9a[_0x7822('0x37')][_0x7822('0x65')]){_0x2e6292['where'][_0x7822('0x66')]=JSON[_0x7822('0x67')](_0x44ba9a[_0x7822('0x37')]['startTime']);}return db[_0x7822('0x59')]['findAll'](_0x2e6292)[_0x7822('0x23')](handleEntityNotFound(_0xb0f424,null))[_0x7822('0x23')](function(_0x70a6fb){if(_0x70a6fb){_0x2d3ecb=_0x70a6fb;return db['JscriptyQuestionReport'][_0x7822('0x41')]({'where':{'SessionId':{'$in':_['map'](_0x2d3ecb,'id')},'ProjectId':_0x44ba9a[_0x7822('0x45')]['id']},'order':_0x7822('0x68')});}})[_0x7822('0x23')](handleEntityNotFound(_0xb0f424,null))[_0x7822('0x23')](function(_0x5e2344){if(_0x5e2344){_0x4ed263=_0x5e2344;var _0x2507d4={};for(var _0x1c7a59=0x0,_0x38ac3e=_0x4ed263[_0x7822('0x38')];_0x1c7a59<_0x38ac3e;_0x1c7a59++){if(!_0x2507d4[_0x7822('0x39')](_0x4ed263[_0x1c7a59][_0x7822('0x69')])){_0x2507d4[_0x4ed263[_0x1c7a59][_0x7822('0x69')]]=needsEncapsulation(_0x4ed263[_0x1c7a59][_0x7822('0x6a')])?encapsulate(_0x4ed263[_0x1c7a59][_0x7822('0x6a')]):_0x4ed263[_0x1c7a59][_0x7822('0x6a')];}}var _0x33a3ca=[],_0x29854d={};for(var _0x4996a5=0x0,_0x59340c=_0x2d3ecb[_0x7822('0x38')];_0x4996a5<_0x59340c;_0x4996a5++){_0x29854d={'ProjectId':_0x44ba9a['params']['id'],'SessionId':_0x2d3ecb[_0x4996a5]['id'],'StartTime':moment(_0x2d3ecb[_0x4996a5][_0x7822('0x66')])['format'](_0x7822('0x6b'))};for(var _0x34788f=0x0,_0x351823=_0x4ed263['length'];_0x34788f<_0x351823;_0x34788f++){if(_0x4ed263[_0x34788f][_0x7822('0x6c')]==_0x2d3ecb[_0x4996a5]['id']&&_0x2507d4['hasOwnProperty'](_0x4ed263[_0x34788f][_0x7822('0x69')])){_0x29854d[_0x2507d4[_0x4ed263[_0x34788f]['questionId']]]=_0x4ed263[_0x34788f]['answer'];}}for(var _0x1fc5b7 in _0x2507d4){if(!_0x29854d[_0x7822('0x39')](_0x2507d4[_0x1fc5b7])){_0x29854d[_0x2507d4[_0x1fc5b7]]=null;}}_0x33a3ca[_0x7822('0x6d')](_0x29854d);}return _0x33a3ca;}})['then'](function(_0x311a05){if(!_[_0x7822('0x6e')](_0x311a05)){var _0x3ecea6=toCsv(_0x311a05);var _0x64d5e=Date[_0x7822('0x6f')]();fs[_0x7822('0x70')](util[_0x7822('0x71')](_0x7822('0x72'),_0x44ba9a['params']['id'],_0x64d5e),_0x3ecea6);_0xb0f424[_0x7822('0x73')]('Content-disposition','attachment;\x20filename='+util['format'](_0x7822('0x74'),_0x44ba9a[_0x7822('0x45')]['id'],_0x64d5e));_0xb0f424['setHeader']('Content-type','text/csv');return _0xb0f424[_0x7822('0x75')](util[_0x7822('0x71')](_0x7822('0x72'),_0x44ba9a['params']['id'],_0x64d5e));}else{return _0xb0f424[_0x7822('0x27')](0xcc);}})['catch'](handleError(_0xb0f424,null));}; \ No newline at end of file +var _0x7ebf=['lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','end','offset','limit','count','status','set','Content-Range','json','apply','reject','update','then','destroy','get','UserProfileResource','sendStatus','name','send','JscriptyProject','type','key','model','map','keys','filters','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','params','rawAttributes','intersection','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Projects','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','UserProfileSection','autoAssociation','getSessions','JscriptySessionReport','order','ProjectId','filter','findOne','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','startTime','parse','findAll','-createdAt','questionId','question','starttime','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','now','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','text/csv','download','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra'];(function(_0x5538d5,_0x190032){var _0x323b1a=function(_0x179caa){while(--_0x179caa){_0x5538d5['push'](_0x5538d5['shift']());}};_0x323b1a(++_0x190032);}(_0x7ebf,0x153));var _0xf7eb=function(_0x12d5f0,_0x6887da){_0x12d5f0=_0x12d5f0-0x0;var _0xbfca0=_0x7ebf[_0x12d5f0];return _0xbfca0;};'use strict';var emlformat=require(_0xf7eb('0x0'));var rimraf=require(_0xf7eb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf7eb('0x2'));var rp=require(_0xf7eb('0x3'));var moment=require(_0xf7eb('0x4'));var BPromise=require(_0xf7eb('0x5'));var Mustache=require(_0xf7eb('0x6'));var util=require(_0xf7eb('0x7'));var path=require(_0xf7eb('0x8'));var sox=require(_0xf7eb('0x9'));var csv=require(_0xf7eb('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf7eb('0xb'));var _=require(_0xf7eb('0xc'));var squel=require(_0xf7eb('0xd'));var crypto=require(_0xf7eb('0xe'));var jsforce=require(_0xf7eb('0xf'));var deskjs=require(_0xf7eb('0x10'));var toCsv=require(_0xf7eb('0xa'));var querystring=require(_0xf7eb('0x11'));var Papa=require('papaparse');var Redis=require(_0xf7eb('0x12'));var authService=require(_0xf7eb('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf7eb('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xf7eb('0x15'));var config=require(_0xf7eb('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf7eb('0x17'))['db'];function respondWithStatusCode(_0x2d58fc,_0x4ad386){_0x4ad386=_0x4ad386||0xcc;return function(_0x39eefe){if(_0x39eefe){return _0x2d58fc['sendStatus'](_0x4ad386);}return _0x2d58fc['status'](_0x4ad386)[_0xf7eb('0x18')]();};}function respondWithResult(_0x1c019b,_0x51d97f){_0x51d97f=_0x51d97f||0xc8;return function(_0xd02a6a){if(_0xd02a6a){return _0x1c019b['status'](_0x51d97f)['json'](_0xd02a6a);}};}function respondWithFilteredResult(_0x91e683,_0x5390d1){return function(_0x1c2b1c){if(_0x1c2b1c){var _0x5d1f14=typeof _0x5390d1[_0xf7eb('0x19')]==='undefined'&&typeof _0x5390d1[_0xf7eb('0x1a')]==='undefined';var _0x9d325c=_0x1c2b1c['count'];var _0x4188b6=_0x5d1f14?0x0:_0x5390d1['offset'];var _0x14d501=_0x5d1f14?_0x1c2b1c[_0xf7eb('0x1b')]:_0x5390d1[_0xf7eb('0x19')]+_0x5390d1[_0xf7eb('0x1a')];var _0x20d407;if(_0x14d501>=_0x9d325c){_0x14d501=_0x9d325c;_0x20d407=0xc8;}else{_0x20d407=0xce;}_0x91e683[_0xf7eb('0x1c')](_0x20d407);return _0x91e683[_0xf7eb('0x1d')](_0xf7eb('0x1e'),_0x4188b6+'-'+_0x14d501+'/'+_0x9d325c)[_0xf7eb('0x1f')](_0x1c2b1c);}return null;};}function patchUpdates(_0x5efd0a){return function(_0x2e9e3e){try{jsonpatch[_0xf7eb('0x20')](_0x2e9e3e,_0x5efd0a,!![]);}catch(_0x2cdc5e){return BPromise[_0xf7eb('0x21')](_0x2cdc5e);}return _0x2e9e3e['save']();};}function saveUpdates(_0x2cc3c8,_0x16a003){return function(_0x30d178){if(_0x30d178){return _0x30d178[_0xf7eb('0x22')](_0x2cc3c8)[_0xf7eb('0x23')](function(_0x22d0ec){return _0x22d0ec;});}return null;};}function removeEntity(_0x5696fa,_0x288b84){return function(_0x5b0484){if(_0x5b0484){return _0x5b0484[_0xf7eb('0x24')]()[_0xf7eb('0x23')](function(){var _0x1f41b0=_0x5b0484[_0xf7eb('0x25')]({'plain':!![]});var _0x393e75='Projects';return db[_0xf7eb('0x26')][_0xf7eb('0x24')]({'where':{'type':_0x393e75,'resourceId':_0x1f41b0['id']}})[_0xf7eb('0x23')](function(){return _0x5b0484;});})[_0xf7eb('0x23')](function(){_0x5696fa[_0xf7eb('0x1c')](0xcc)[_0xf7eb('0x18')]();});}};}function handleEntityNotFound(_0x360a34,_0x4f416a){return function(_0x8370aa){if(!_0x8370aa){_0x360a34[_0xf7eb('0x27')](0x194);}return _0x8370aa;};}function handleError(_0x9d41b5,_0x33b6d1){_0x33b6d1=_0x33b6d1||0x1f4;return function(_0x3da4af){logger['error'](_0x3da4af['stack']);if(_0x3da4af['name']){delete _0x3da4af[_0xf7eb('0x28')];}_0x9d41b5[_0xf7eb('0x1c')](_0x33b6d1)[_0xf7eb('0x29')](_0x3da4af);};}exports['index']=function(_0x2b98ca,_0x443aa6){var _0x2daedc={},_0x25b40c={},_0xbea3e9={'count':0x0,'rows':[]};var _0x143d4c=_['map'](db[_0xf7eb('0x2a')]['rawAttributes'],function(_0x40a606){return{'name':_0x40a606['fieldName'],'type':_0x40a606[_0xf7eb('0x2b')][_0xf7eb('0x2c')]};});_0x25b40c[_0xf7eb('0x2d')]=_[_0xf7eb('0x2e')](_0x143d4c,_0xf7eb('0x28'));_0x25b40c['query']=_[_0xf7eb('0x2f')](_0x2b98ca['query']);_0x25b40c[_0xf7eb('0x30')]=_['intersection'](_0x25b40c[_0xf7eb('0x2d')],_0x25b40c[_0xf7eb('0x31')]);_0x2daedc[_0xf7eb('0x32')]=_['intersection'](_0x25b40c[_0xf7eb('0x2d')],qs[_0xf7eb('0x33')](_0x2b98ca[_0xf7eb('0x31')]['fields']));_0x2daedc[_0xf7eb('0x32')]=_0x2daedc[_0xf7eb('0x32')][_0xf7eb('0x34')]?_0x2daedc[_0xf7eb('0x32')]:_0x25b40c[_0xf7eb('0x2d')];if(!_0x2b98ca[_0xf7eb('0x31')][_0xf7eb('0x35')](_0xf7eb('0x36'))){_0x2daedc[_0xf7eb('0x1a')]=qs[_0xf7eb('0x1a')](_0x2b98ca[_0xf7eb('0x31')][_0xf7eb('0x1a')]);_0x2daedc[_0xf7eb('0x19')]=qs['offset'](_0x2b98ca[_0xf7eb('0x31')][_0xf7eb('0x19')]);}_0x2daedc['order']=qs[_0xf7eb('0x37')](_0x2b98ca[_0xf7eb('0x31')][_0xf7eb('0x37')]);_0x2daedc[_0xf7eb('0x38')]=qs[_0xf7eb('0x30')](_[_0xf7eb('0x39')](_0x2b98ca['query'],_0x25b40c['filters']),_0x143d4c);if(_0x2b98ca[_0xf7eb('0x31')]['filter']){_0x2daedc[_0xf7eb('0x38')]=_[_0xf7eb('0x3a')](_0x2daedc[_0xf7eb('0x38')],{'$or':_['map'](_0x143d4c,function(_0x23e03b){if(_0x23e03b['type']!==_0xf7eb('0x3b')){var _0x1099d6={};_0x1099d6[_0x23e03b[_0xf7eb('0x28')]]={'$like':'%'+_0x2b98ca[_0xf7eb('0x31')]['filter']+'%'};return _0x1099d6;}})});}_0x2daedc=_[_0xf7eb('0x3a')]({},_0x2daedc,_0x2b98ca[_0xf7eb('0x3c')]);var _0x2595e2={'where':_0x2daedc['where']};return db['JscriptyProject'][_0xf7eb('0x1b')](_0x2595e2)[_0xf7eb('0x23')](function(_0x305c75){_0xbea3e9[_0xf7eb('0x1b')]=_0x305c75;if(_0x2b98ca[_0xf7eb('0x31')][_0xf7eb('0x3d')]){_0x2daedc[_0xf7eb('0x3e')]=[{'all':!![]}];}return db[_0xf7eb('0x2a')]['findAll'](_0x2daedc);})[_0xf7eb('0x23')](function(_0x39dfba){_0xbea3e9[_0xf7eb('0x3f')]=_0x39dfba;return _0xbea3e9;})[_0xf7eb('0x23')](respondWithFilteredResult(_0x443aa6,_0x2daedc))[_0xf7eb('0x40')](handleError(_0x443aa6,null));};exports['show']=function(_0x41834c,_0x3385a8){var _0x2799d7={'raw':![],'where':{'id':_0x41834c[_0xf7eb('0x41')]['id']}},_0x4bd762={};_0x4bd762[_0xf7eb('0x2d')]=_[_0xf7eb('0x2f')](db['JscriptyProject'][_0xf7eb('0x42')]);_0x4bd762[_0xf7eb('0x31')]=_[_0xf7eb('0x2f')](_0x41834c[_0xf7eb('0x31')]);_0x4bd762[_0xf7eb('0x30')]=_[_0xf7eb('0x43')](_0x4bd762['model'],_0x4bd762[_0xf7eb('0x31')]);_0x2799d7[_0xf7eb('0x32')]=_[_0xf7eb('0x43')](_0x4bd762[_0xf7eb('0x2d')],qs[_0xf7eb('0x33')](_0x41834c[_0xf7eb('0x31')][_0xf7eb('0x33')]));_0x2799d7[_0xf7eb('0x32')]=_0x2799d7[_0xf7eb('0x32')][_0xf7eb('0x34')]?_0x2799d7['attributes']:_0x4bd762[_0xf7eb('0x2d')];if(_0x41834c['query'][_0xf7eb('0x3d')]){_0x2799d7['include']=[{'all':!![]}];}_0x2799d7=_[_0xf7eb('0x3a')]({},_0x2799d7,_0x41834c[_0xf7eb('0x3c')]);return db[_0xf7eb('0x2a')]['find'](_0x2799d7)['then'](handleEntityNotFound(_0x3385a8,null))[_0xf7eb('0x23')](respondWithResult(_0x3385a8,null))[_0xf7eb('0x40')](handleError(_0x3385a8,null));};exports[_0xf7eb('0x44')]=function(_0x344423,_0x1bb3e2){return db[_0xf7eb('0x2a')]['create'](_0x344423[_0xf7eb('0x45')],{})[_0xf7eb('0x23')](function(_0x408d66){var _0x3592fb=_0x344423['user']['get']({'plain':!![]});if(!_0x3592fb)throw new Error(_0xf7eb('0x46'));if(_0x3592fb['role']===_0xf7eb('0x47')){var _0x2a0ba8=_0x408d66['get']({'plain':!![]});var _0x4d651f=_0xf7eb('0x48');return db['UserProfileSection'][_0xf7eb('0x49')]({'where':{'name':_0x4d651f,'userProfileId':_0x3592fb[_0xf7eb('0x4a')]},'raw':!![]})[_0xf7eb('0x23')](function(_0x37406b){if(_0x37406b&&_0x37406b['autoAssociation']===0x0){return db[_0xf7eb('0x26')]['create']({'name':_0x2a0ba8[_0xf7eb('0x28')],'resourceId':_0x2a0ba8['id'],'type':_0x37406b[_0xf7eb('0x28')],'sectionId':_0x37406b['id']},{})['then'](function(){return _0x408d66;});}else{return _0x408d66;}})[_0xf7eb('0x40')](function(_0x3a83f6){logger[_0xf7eb('0x4b')](_0xf7eb('0x4c'),_0x3a83f6);throw _0x3a83f6;});}return _0x408d66;})['then'](respondWithResult(_0x1bb3e2,0xc9))['catch'](handleError(_0x1bb3e2,null));};exports[_0xf7eb('0x4d')]=function(_0x402aa9,_0x2fcbbb){var _0x440431={'where':{'id':_0x402aa9['params']['id']}},_0x461abe={};_0x461abe[_0xf7eb('0x2d')]=_[_0xf7eb('0x2f')](db[_0xf7eb('0x2a')][_0xf7eb('0x42')]);_0x440431['attributes']=_[_0xf7eb('0x43')](_0x461abe[_0xf7eb('0x2d')],qs[_0xf7eb('0x33')](_0x402aa9['query'][_0xf7eb('0x33')]));_0x440431[_0xf7eb('0x32')]=_0x440431[_0xf7eb('0x32')][_0xf7eb('0x34')]?_0x440431[_0xf7eb('0x32')]:_0x461abe[_0xf7eb('0x2d')];if(_0x402aa9[_0xf7eb('0x31')][_0xf7eb('0x3d')]){_0x440431[_0xf7eb('0x3e')]=[{'all':!![]}];}_0x440431=_['merge']({},_0x440431,_0x402aa9[_0xf7eb('0x3c')]);return db[_0xf7eb('0x2a')]['find'](_0x440431)[_0xf7eb('0x23')](handleEntityNotFound(_0x2fcbbb,null))[_0xf7eb('0x23')](function(_0x2315e8){if(_0x2315e8){var _0x4894bc=_0x2315e8[_0xf7eb('0x25')]({'plain':!![]});_0x4894bc=qs[_0xf7eb('0x4e')](_0x4894bc,['id',_0xf7eb('0x4f'),'updatedAt']);_0x402aa9[_0xf7eb('0x45')]=_[_0xf7eb('0x4e')](_0x402aa9[_0xf7eb('0x45')],['id',_0xf7eb('0x4f'),_0xf7eb('0x50')]);return db[_0xf7eb('0x2a')]['create'](_[_0xf7eb('0x3a')](_0x4894bc,_0x402aa9[_0xf7eb('0x45')]),{'include':_0x402aa9[_0xf7eb('0x31')][_0xf7eb('0x3d')]?[{'all':!![]}]:undefined})[_0xf7eb('0x23')](function(_0x410c10){var _0x54ee67=_0x402aa9[_0xf7eb('0x47')]['get']({'plain':!![]});if(!_0x54ee67)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x54ee67[_0xf7eb('0x51')]===_0xf7eb('0x47')){var _0xe749a7=_0x410c10[_0xf7eb('0x25')]({'plain':!![]});var _0x51126f=_0xf7eb('0x48');return db[_0xf7eb('0x52')][_0xf7eb('0x49')]({'where':{'name':_0x51126f,'userProfileId':_0x54ee67[_0xf7eb('0x4a')]},'raw':!![]})[_0xf7eb('0x23')](function(_0x1c379c){if(_0x1c379c&&_0x1c379c[_0xf7eb('0x53')]===0x0){return db[_0xf7eb('0x26')][_0xf7eb('0x44')]({'name':_0xe749a7['name'],'resourceId':_0xe749a7['id'],'type':_0x1c379c['name'],'sectionId':_0x1c379c['id']},{})[_0xf7eb('0x23')](function(){return _0x410c10;});}else{return _0x410c10;}})[_0xf7eb('0x40')](function(_0x3dc701){logger[_0xf7eb('0x4b')](_0xf7eb('0x4c'),_0x3dc701);throw _0x3dc701;});}return _0x410c10;});}})[_0xf7eb('0x23')](respondWithResult(_0x2fcbbb,0xc9))[_0xf7eb('0x40')](handleError(_0x2fcbbb,null));};exports[_0xf7eb('0x22')]=function(_0x4ba6d1,_0xc7259e){if(_0x4ba6d1[_0xf7eb('0x45')]['id']){delete _0x4ba6d1[_0xf7eb('0x45')]['id'];}return db[_0xf7eb('0x2a')][_0xf7eb('0x49')]({'where':{'id':_0x4ba6d1[_0xf7eb('0x41')]['id']}})[_0xf7eb('0x23')](handleEntityNotFound(_0xc7259e,null))[_0xf7eb('0x23')](saveUpdates(_0x4ba6d1[_0xf7eb('0x45')],null))['then'](respondWithResult(_0xc7259e,null))[_0xf7eb('0x40')](handleError(_0xc7259e,null));};exports['destroy']=function(_0x101aac,_0x2b2601){return db['JscriptyProject'][_0xf7eb('0x49')]({'where':{'id':_0x101aac[_0xf7eb('0x41')]['id']}})[_0xf7eb('0x23')](handleEntityNotFound(_0x2b2601,null))[_0xf7eb('0x23')](removeEntity(_0x2b2601,null))[_0xf7eb('0x40')](handleError(_0x2b2601,null));};exports[_0xf7eb('0x54')]=function(_0x29b2ad,_0x1d9b6b,_0x50533c){var _0x1040d7={'raw':!![],'where':{}};var _0x1a5374={};var _0x407360={'count':0x0,'rows':[]};return db[_0xf7eb('0x2a')]['findOne']({'where':{'id':_0x29b2ad[_0xf7eb('0x41')]['id']}})[_0xf7eb('0x23')](handleEntityNotFound(_0x1d9b6b,null))[_0xf7eb('0x23')](function(_0x1f4dea){if(_0x1f4dea){_0x1a5374[_0xf7eb('0x2d')]=_[_0xf7eb('0x2f')](db[_0xf7eb('0x55')][_0xf7eb('0x42')]);_0x1a5374['query']=_['keys'](_0x29b2ad[_0xf7eb('0x31')]);_0x1a5374['filters']=_[_0xf7eb('0x43')](_0x1a5374[_0xf7eb('0x2d')],_0x1a5374[_0xf7eb('0x31')]);_0x1040d7[_0xf7eb('0x32')]=_[_0xf7eb('0x43')](_0x1a5374['model'],qs[_0xf7eb('0x33')](_0x29b2ad[_0xf7eb('0x31')]['fields']));_0x1040d7[_0xf7eb('0x32')]=_0x1040d7[_0xf7eb('0x32')]['length']?_0x1040d7['attributes']:_0x1a5374[_0xf7eb('0x2d')];if(!_0x29b2ad[_0xf7eb('0x31')][_0xf7eb('0x35')](_0xf7eb('0x36'))){_0x1040d7[_0xf7eb('0x1a')]=qs[_0xf7eb('0x1a')](_0x29b2ad[_0xf7eb('0x31')][_0xf7eb('0x1a')]);_0x1040d7['offset']=qs[_0xf7eb('0x19')](_0x29b2ad[_0xf7eb('0x31')]['offset']);}_0x1040d7[_0xf7eb('0x56')]=qs[_0xf7eb('0x37')](_0x29b2ad[_0xf7eb('0x31')][_0xf7eb('0x37')]);_0x1040d7[_0xf7eb('0x38')]=qs[_0xf7eb('0x30')](_[_0xf7eb('0x39')](_0x29b2ad[_0xf7eb('0x31')],_0x1a5374['filters']));_0x1040d7['where'][_0xf7eb('0x57')]=_0x1f4dea['id'];if(_0x29b2ad[_0xf7eb('0x31')][_0xf7eb('0x58')]){_0x1040d7[_0xf7eb('0x38')]=_[_0xf7eb('0x3a')](_0x1040d7[_0xf7eb('0x38')],{'$or':_[_0xf7eb('0x2e')](_0x1040d7[_0xf7eb('0x32')],function(_0x4ded30){var _0x595515={};_0x595515[_0x4ded30]={'$like':'%'+_0x29b2ad['query'][_0xf7eb('0x58')]+'%'};return _0x595515;})});}_0x1040d7=_['merge']({},_0x1040d7,_0x29b2ad[_0xf7eb('0x3c')]);return db[_0xf7eb('0x55')][_0xf7eb('0x1b')]({'where':_0x1040d7[_0xf7eb('0x38')]})[_0xf7eb('0x23')](function(_0x290eb8){_0x407360[_0xf7eb('0x1b')]=_0x290eb8;if(_0x29b2ad[_0xf7eb('0x31')]['includeAll']){_0x1040d7['include']=[{'all':!![]}];}return db[_0xf7eb('0x55')]['findAll'](_0x1040d7);})[_0xf7eb('0x23')](function(_0x189fd7){_0x407360['rows']=_0x189fd7;return _0x407360;});}})[_0xf7eb('0x23')](respondWithFilteredResult(_0x1d9b6b,_0x1040d7))['catch'](handleError(_0x1d9b6b,null));};exports['getAnswers']=function(_0x50fa39,_0x1473d5,_0x3e957e){var _0x5d4d27={'raw':!![],'where':{}};var _0x1f2af4={};var _0x268b74={'count':0x0,'rows':[]};return db[_0xf7eb('0x2a')][_0xf7eb('0x59')]({'where':{'id':_0x50fa39[_0xf7eb('0x41')]['id']}})[_0xf7eb('0x23')](handleEntityNotFound(_0x1473d5,null))[_0xf7eb('0x23')](function(_0x420960){if(_0x420960){_0x1f2af4[_0xf7eb('0x2d')]=_[_0xf7eb('0x2f')](db['JscriptyAnswerReport'][_0xf7eb('0x42')]);_0x1f2af4[_0xf7eb('0x31')]=_['keys'](_0x50fa39['query']);_0x1f2af4[_0xf7eb('0x30')]=_['intersection'](_0x1f2af4[_0xf7eb('0x2d')],_0x1f2af4[_0xf7eb('0x31')]);_0x5d4d27['attributes']=_[_0xf7eb('0x43')](_0x1f2af4['model'],qs[_0xf7eb('0x33')](_0x50fa39[_0xf7eb('0x31')]['fields']));_0x5d4d27[_0xf7eb('0x32')]=_0x5d4d27['attributes'][_0xf7eb('0x34')]?_0x5d4d27[_0xf7eb('0x32')]:_0x1f2af4[_0xf7eb('0x2d')];if(!_0x50fa39['query']['hasOwnProperty'](_0xf7eb('0x36'))){_0x5d4d27[_0xf7eb('0x1a')]=qs[_0xf7eb('0x1a')](_0x50fa39[_0xf7eb('0x31')][_0xf7eb('0x1a')]);_0x5d4d27[_0xf7eb('0x19')]=qs[_0xf7eb('0x19')](_0x50fa39[_0xf7eb('0x31')][_0xf7eb('0x19')]);}_0x5d4d27[_0xf7eb('0x56')]=qs[_0xf7eb('0x37')](_0x50fa39[_0xf7eb('0x31')][_0xf7eb('0x37')]);_0x5d4d27[_0xf7eb('0x38')]=qs['filters'](_['pick'](_0x50fa39[_0xf7eb('0x31')],_0x1f2af4[_0xf7eb('0x30')]));_0x5d4d27[_0xf7eb('0x38')]['ProjectId']=_0x420960['id'];if(_0x50fa39['query']['filter']){_0x5d4d27[_0xf7eb('0x38')]=_[_0xf7eb('0x3a')](_0x5d4d27[_0xf7eb('0x38')],{'$or':_[_0xf7eb('0x2e')](_0x5d4d27[_0xf7eb('0x32')],function(_0x5131b0){var _0x1cd351={};_0x1cd351[_0x5131b0]={'$like':'%'+_0x50fa39[_0xf7eb('0x31')][_0xf7eb('0x58')]+'%'};return _0x1cd351;})});}_0x5d4d27=_[_0xf7eb('0x3a')]({},_0x5d4d27,_0x50fa39[_0xf7eb('0x3c')]);return db['JscriptyAnswerReport'][_0xf7eb('0x1b')]({'where':_0x5d4d27[_0xf7eb('0x38')]})[_0xf7eb('0x23')](function(_0x131d19){_0x268b74[_0xf7eb('0x1b')]=_0x131d19;if(_0x50fa39[_0xf7eb('0x31')][_0xf7eb('0x3d')]){_0x5d4d27['include']=[{'all':!![]}];}return db[_0xf7eb('0x5a')]['findAll'](_0x5d4d27);})['then'](function(_0x471a59){_0x268b74[_0xf7eb('0x3f')]=_0x471a59;return _0x268b74;});}})[_0xf7eb('0x23')](respondWithFilteredResult(_0x1473d5,_0x5d4d27))[_0xf7eb('0x40')](handleError(_0x1473d5,null));};function char(_0x5a4faf){return _0xf7eb('0x5b')===typeof _0x5a4faf?String[_0xf7eb('0x5c')][_0xf7eb('0x20')](null,arguments):_0x5a4faf;}function needsEncapsulation(_0x1a2a57){return!!_0x1a2a57&&(_0x1a2a57[_0xf7eb('0x5d')]()['indexOf'](char(0xd))>=0x0||_0x1a2a57['toString']()[_0xf7eb('0x5e')](char(0xa))>=0x0||_0x1a2a57[_0xf7eb('0x5d')]()[_0xf7eb('0x5e')](char(0x2c))>=0x0||_0x1a2a57[_0xf7eb('0x5d')]()[_0xf7eb('0x5e')](char(0x22))>=0x0);}function encapsulate(_0x5b8e39){var _0x59f412=char(0x22),_0x4afb3c='\x5c'+char(0x22),_0x28ca13=_0x5b8e39['toString']()[_0xf7eb('0x5f')](new RegExp(_0x59f412,'g'),_0x4afb3c);return _0x59f412+_0x28ca13+_0x59f412;}exports['getSummary']=function(_0x17e37b,_0x12361b,_0x3361ee){var _0x11bba4,_0x24e494;var _0x2eb0e8={'where':{'ProjectId':_0x17e37b[_0xf7eb('0x41')]['id']}};if(_0x17e37b[_0xf7eb('0x31')][_0xf7eb('0x60')]){_0x2eb0e8['where']['starttime']=JSON[_0xf7eb('0x61')](_0x17e37b[_0xf7eb('0x31')]['startTime']);}return db[_0xf7eb('0x55')][_0xf7eb('0x62')](_0x2eb0e8)[_0xf7eb('0x23')](handleEntityNotFound(_0x12361b,null))[_0xf7eb('0x23')](function(_0x253019){if(_0x253019){_0x11bba4=_0x253019;return db['JscriptyQuestionReport']['findAll']({'where':{'SessionId':{'$in':_[_0xf7eb('0x2e')](_0x11bba4,'id')},'ProjectId':_0x17e37b[_0xf7eb('0x41')]['id']},'order':_0xf7eb('0x63')});}})[_0xf7eb('0x23')](handleEntityNotFound(_0x12361b,null))['then'](function(_0x11b529){if(_0x11b529){_0x24e494=_0x11b529;var _0x882dde={};for(var _0x3872bd=0x0,_0xee49a8=_0x24e494['length'];_0x3872bd<_0xee49a8;_0x3872bd++){if(!_0x882dde[_0xf7eb('0x35')](_0x24e494[_0x3872bd][_0xf7eb('0x64')])){_0x882dde[_0x24e494[_0x3872bd][_0xf7eb('0x64')]]=needsEncapsulation(_0x24e494[_0x3872bd][_0xf7eb('0x65')])?encapsulate(_0x24e494[_0x3872bd][_0xf7eb('0x65')]):_0x24e494[_0x3872bd]['question'];}}var _0x3467b6=[],_0x1cb231={};for(var _0x442ce6=0x0,_0x5e126b=_0x11bba4[_0xf7eb('0x34')];_0x442ce6<_0x5e126b;_0x442ce6++){_0x1cb231={'ProjectId':_0x17e37b['params']['id'],'SessionId':_0x11bba4[_0x442ce6]['id'],'StartTime':moment(_0x11bba4[_0x442ce6][_0xf7eb('0x66')])['format'](_0xf7eb('0x67'))};for(var _0x3f97de=0x0,_0x518cf8=_0x24e494[_0xf7eb('0x34')];_0x3f97de<_0x518cf8;_0x3f97de++){if(_0x24e494[_0x3f97de][_0xf7eb('0x68')]==_0x11bba4[_0x442ce6]['id']&&_0x882dde['hasOwnProperty'](_0x24e494[_0x3f97de][_0xf7eb('0x64')])){_0x1cb231[_0x882dde[_0x24e494[_0x3f97de][_0xf7eb('0x64')]]]=_0x24e494[_0x3f97de][_0xf7eb('0x69')];}}for(var _0x37cc26 in _0x882dde){if(!_0x1cb231[_0xf7eb('0x35')](_0x882dde[_0x37cc26])){_0x1cb231[_0x882dde[_0x37cc26]]=null;}}_0x3467b6[_0xf7eb('0x6a')](_0x1cb231);}return _0x3467b6;}})[_0xf7eb('0x23')](function(_0x14ce2a){if(!_['isEmpty'](_0x14ce2a)){var _0x4c61a3=toCsv(_0x14ce2a);var _0x39a86e=Date[_0xf7eb('0x6b')]();fs[_0xf7eb('0x6c')](util[_0xf7eb('0x6d')](_0xf7eb('0x6e'),_0x17e37b[_0xf7eb('0x41')]['id'],_0x39a86e),_0x4c61a3);_0x12361b[_0xf7eb('0x6f')](_0xf7eb('0x70'),_0xf7eb('0x71')+util['format'](_0xf7eb('0x72'),_0x17e37b[_0xf7eb('0x41')]['id'],_0x39a86e));_0x12361b['setHeader']('Content-type',_0xf7eb('0x73'));return _0x12361b[_0xf7eb('0x74')](util[_0xf7eb('0x6d')](_0xf7eb('0x6e'),_0x17e37b[_0xf7eb('0x41')]['id'],_0x39a86e));}else{return _0x12361b[_0xf7eb('0x27')](0xcc);}})[_0xf7eb('0x40')](handleError(_0x12361b,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 663bde6..9ced78d 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 _0xe06f=['../../config/environment','./jscriptyProject.attributes','define','JscriptyProject','jscripty_projects','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x2ffc46,_0x35ce3c){var _0x1eda8f=function(_0x285344){while(--_0x285344){_0x2ffc46['push'](_0x2ffc46['shift']());}};_0x1eda8f(++_0x35ce3c);}(_0xe06f,0x65));var _0xfe06=function(_0x1448c8,_0x5f057b){_0x1448c8=_0x1448c8-0x0;var _0x17625f=_0xe06f[_0x1448c8];return _0x17625f;};'use strict';var _=require(_0xfe06('0x0'));var util=require(_0xfe06('0x1'));var logger=require('../../config/logger')(_0xfe06('0x2'));var moment=require('moment');var BPromise=require(_0xfe06('0x3'));var rp=require(_0xfe06('0x4'));var fs=require('fs');var path=require(_0xfe06('0x5'));var rimraf=require(_0xfe06('0x6'));var config=require(_0xfe06('0x7'));var attributes=require(_0xfe06('0x8'));module['exports']=function(_0x4b4be6,_0x530973){return _0x4b4be6[_0xfe06('0x9')](_0xfe06('0xa'),attributes,{'tableName':_0xfe06('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc99e=['rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x12128a,_0x15c29e){var _0x2fefe7=function(_0x300f4f){while(--_0x300f4f){_0x12128a['push'](_0x12128a['shift']());}};_0x2fefe7(++_0x15c29e);}(_0xc99e,0x6e));var _0xec99=function(_0x3a3d92,_0x35e0ef){_0x3a3d92=_0x3a3d92-0x0;var _0x3a4ac8=_0xc99e[_0x3a3d92];return _0x3a4ac8;};'use strict';var _=require(_0xec99('0x0'));var util=require(_0xec99('0x1'));var logger=require(_0xec99('0x2'))(_0xec99('0x3'));var moment=require(_0xec99('0x4'));var BPromise=require(_0xec99('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec99('0x6'));var rimraf=require(_0xec99('0x7'));var config=require(_0xec99('0x8'));var attributes=require(_0xec99('0x9'));module[_0xec99('0xa')]=function(_0x39821d,_0x451dd4){return _0x39821d[_0xec99('0xb')]('JscriptyProject',attributes,{'tableName':_0xec99('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 0672c74..e69ef7d 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(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xac4a,0x13f));var _0xaac4=function(_0x5c35b3,_0x32b64f){_0x5c35b3=_0x5c35b3-0x0;var _0x4d8a1c=_0xac4a[_0x5c35b3];return _0x4d8a1c;};'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 _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptyProject,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x4f54b3,_0x5705df){var _0x31ed9a=function(_0x54a857){while(--_0x54a857){_0x4f54b3['push'](_0x4f54b3['shift']());}};_0x31ed9a(++_0x5705df);}(_0xb43b,0x1b2));var _0xbb43=function(_0x2420ef,_0x5897f2){_0x2420ef=_0x2420ef-0x0;var _0x203aba=_0xb43b[_0x2420ef];return _0x203aba;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 80aa69c..31d67a0 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 _0x5d1b=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x11e4d4,_0x22307c){var _0x358440=function(_0x876693){while(--_0x876693){_0x11e4d4['push'](_0x11e4d4['shift']());}};_0x358440(++_0x22307c);}(_0x5d1b,0xd8));var _0xb5d1=function(_0x5e56e3,_0xf9b2a7){_0x5e56e3=_0x5e56e3-0x0;var _0x4bd80f=_0x5d1b[_0x5e56e3];return _0x4bd80f;};'use strict';var multer=require(_0xb5d1('0x0'));var util=require(_0xb5d1('0x1'));var path=require(_0xb5d1('0x2'));var timeout=require('connect-timeout');var express=require(_0xb5d1('0x3'));var router=express[_0xb5d1('0x4')]();var fs_extra=require(_0xb5d1('0x5'));var auth=require(_0xb5d1('0x6'));var interaction=require(_0xb5d1('0x7'));var config=require('../../config/environment');var controller=require('./jscriptyQuestionReport.controller');router[_0xb5d1('0x8')]('/',auth[_0xb5d1('0x9')](),controller[_0xb5d1('0xa')]);router[_0xb5d1('0x8')]('/describe',auth[_0xb5d1('0x9')](),controller['describe']);router[_0xb5d1('0x8')](_0xb5d1('0xb'),auth[_0xb5d1('0x9')](),controller[_0xb5d1('0xc')]);router[_0xb5d1('0xd')]('/',auth['isAuthenticated'](),controller[_0xb5d1('0xe')]);router[_0xb5d1('0xf')]('/:id',auth[_0xb5d1('0x9')](),controller[_0xb5d1('0x10')]);router[_0xb5d1('0x11')](_0xb5d1('0xb'),auth[_0xb5d1('0x9')](),controller[_0xb5d1('0x12')]);module[_0xb5d1('0x13')]=router; \ No newline at end of file +var _0x064c=['fs-extra','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x464097,_0x59196d){var _0x4ccdc9=function(_0x2cac0f){while(--_0x2cac0f){_0x464097['push'](_0x464097['shift']());}};_0x4ccdc9(++_0x59196d);}(_0x064c,0x1af));var _0xc064=function(_0x5ef905,_0x564b87){_0x5ef905=_0x5ef905-0x0;var _0x367808=_0x064c[_0x5ef905];return _0x367808;};'use strict';var multer=require(_0xc064('0x0'));var util=require(_0xc064('0x1'));var path=require(_0xc064('0x2'));var timeout=require(_0xc064('0x3'));var express=require(_0xc064('0x4'));var router=express[_0xc064('0x5')]();var fs_extra=require(_0xc064('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xc064('0x7'));var config=require(_0xc064('0x8'));var controller=require(_0xc064('0x9'));router[_0xc064('0xa')]('/',auth[_0xc064('0xb')](),controller[_0xc064('0xc')]);router['get'](_0xc064('0xd'),auth[_0xc064('0xb')](),controller[_0xc064('0xe')]);router['get'](_0xc064('0xf'),auth[_0xc064('0xb')](),controller[_0xc064('0x10')]);router[_0xc064('0x11')]('/',auth[_0xc064('0xb')](),controller[_0xc064('0x12')]);router[_0xc064('0x13')]('/:id',auth[_0xc064('0xb')](),controller['update']);router[_0xc064('0x14')]('/:id',auth[_0xc064('0xb')](),controller[_0xc064('0x15')]);module[_0xc064('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index d001fd6..cef12ea 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(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x7a54,0x106));var _0x47a5=function(_0x137d2f,_0x5235ce){_0x137d2f=_0x137d2f-0x0;var _0x5a7956=_0x7a54[_0x137d2f];return _0x5a7956;};'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(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x7a54,0x106));var _0x47a5=function(_0x528187,_0xe972dc){_0x528187=_0x528187-0x0;var _0x5c262d=_0x7a54[_0x528187];return _0x5c262d;};'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 c8a5b1a..7e4cc3e 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 _0xc5c8=['../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','catch','show','params','keys','options','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service'];(function(_0x3cd451,_0x26e81a){var _0x571ce6=function(_0x27af9e){while(--_0x27af9e){_0x3cd451['push'](_0x3cd451['shift']());}};_0x571ce6(++_0x26e81a);}(_0xc5c8,0x118));var _0x8c5c=function(_0x2cc468,_0x2010f7){_0x2cc468=_0x2cc468-0x0;var _0x57e8d9=_0xc5c8[_0x2cc468];return _0x57e8d9;};'use strict';var emlformat=require(_0x8c5c('0x0'));var rimraf=require(_0x8c5c('0x1'));var zipdir=require(_0x8c5c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8c5c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8c5c('0x4'));var util=require(_0x8c5c('0x5'));var path=require('path');var sox=require(_0x8c5c('0x6'));var csv=require(_0x8c5c('0x7'));var ejs=require(_0x8c5c('0x8'));var fs=require('fs');var fs_extra=require(_0x8c5c('0x9'));var _=require(_0x8c5c('0xa'));var squel=require(_0x8c5c('0xb'));var crypto=require(_0x8c5c('0xc'));var jsforce=require(_0x8c5c('0xd'));var deskjs=require(_0x8c5c('0xe'));var toCsv=require(_0x8c5c('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8c5c('0xf'));var qs=require(_0x8c5c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8c5c('0x11'))(_0x8c5c('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8c5c('0x13'));var db=require(_0x8c5c('0x14'))['db'];function respondWithStatusCode(_0x5df88b,_0x5ea5e4){_0x5ea5e4=_0x5ea5e4||0xcc;return function(_0x316e3f){if(_0x316e3f){return _0x5df88b[_0x8c5c('0x15')](_0x5ea5e4);}return _0x5df88b[_0x8c5c('0x16')](_0x5ea5e4)['end']();};}function respondWithResult(_0x11f07a,_0x2261aa){_0x2261aa=_0x2261aa||0xc8;return function(_0x4fe2a6){if(_0x4fe2a6){return _0x11f07a['status'](_0x2261aa)[_0x8c5c('0x17')](_0x4fe2a6);}};}function respondWithFilteredResult(_0x5ed06d,_0x443d8f){return function(_0x403f3b){if(_0x403f3b){var _0x2e820a=typeof _0x443d8f[_0x8c5c('0x18')]===_0x8c5c('0x19')&&typeof _0x443d8f[_0x8c5c('0x1a')]===_0x8c5c('0x19');var _0x107835=_0x403f3b[_0x8c5c('0x1b')];var _0x10614e=_0x2e820a?0x0:_0x443d8f['offset'];var _0x5d8dd3=_0x2e820a?_0x403f3b['count']:_0x443d8f['offset']+_0x443d8f[_0x8c5c('0x1a')];var _0x53c6ad;if(_0x5d8dd3>=_0x107835){_0x5d8dd3=_0x107835;_0x53c6ad=0xc8;}else{_0x53c6ad=0xce;}_0x5ed06d[_0x8c5c('0x16')](_0x53c6ad);return _0x5ed06d[_0x8c5c('0x1c')](_0x8c5c('0x1d'),_0x10614e+'-'+_0x5d8dd3+'/'+_0x107835)[_0x8c5c('0x17')](_0x403f3b);}return null;};}function patchUpdates(_0x21d0de){return function(_0x264515){try{jsonpatch[_0x8c5c('0x1e')](_0x264515,_0x21d0de,!![]);}catch(_0xac22f9){return BPromise[_0x8c5c('0x1f')](_0xac22f9);}return _0x264515[_0x8c5c('0x20')]();};}function saveUpdates(_0x542b61,_0x2f3ef3){return function(_0x34f24e){if(_0x34f24e){return _0x34f24e[_0x8c5c('0x21')](_0x542b61)['then'](function(_0x261b31){return _0x261b31;});}return null;};}function removeEntity(_0x5d153d,_0x570486){return function(_0x572e87){if(_0x572e87){return _0x572e87[_0x8c5c('0x22')]()[_0x8c5c('0x23')](function(){_0x5d153d[_0x8c5c('0x16')](0xcc)[_0x8c5c('0x24')]();});}};}function handleEntityNotFound(_0x284889,_0x584f05){return function(_0x4bf1ec){if(!_0x4bf1ec){_0x284889['sendStatus'](0x194);}return _0x4bf1ec;};}function handleError(_0x19820f,_0x1ca2da){_0x1ca2da=_0x1ca2da||0x1f4;return function(_0x2fc2f7){logger[_0x8c5c('0x25')](_0x2fc2f7[_0x8c5c('0x26')]);if(_0x2fc2f7[_0x8c5c('0x27')]){delete _0x2fc2f7[_0x8c5c('0x27')];}_0x19820f[_0x8c5c('0x16')](_0x1ca2da)[_0x8c5c('0x28')](_0x2fc2f7);};}exports[_0x8c5c('0x29')]=function(_0x1f4fb9,_0xec73ec){var _0x23f003={},_0x5e26eb={},_0x450b66={'count':0x0,'rows':[]};var _0x479ff0=_[_0x8c5c('0x2a')](db[_0x8c5c('0x2b')][_0x8c5c('0x2c')],function(_0x3d3fd5){return{'name':_0x3d3fd5[_0x8c5c('0x2d')],'type':_0x3d3fd5['type']['key']};});_0x5e26eb[_0x8c5c('0x2e')]=_[_0x8c5c('0x2a')](_0x479ff0,_0x8c5c('0x27'));_0x5e26eb[_0x8c5c('0x2f')]=_['keys'](_0x1f4fb9[_0x8c5c('0x2f')]);_0x5e26eb[_0x8c5c('0x30')]=_[_0x8c5c('0x31')](_0x5e26eb['model'],_0x5e26eb['query']);_0x23f003[_0x8c5c('0x32')]=_[_0x8c5c('0x31')](_0x5e26eb[_0x8c5c('0x2e')],qs[_0x8c5c('0x33')](_0x1f4fb9['query'][_0x8c5c('0x33')]));_0x23f003[_0x8c5c('0x32')]=_0x23f003[_0x8c5c('0x32')][_0x8c5c('0x34')]?_0x23f003[_0x8c5c('0x32')]:_0x5e26eb[_0x8c5c('0x2e')];if(!_0x1f4fb9['query'][_0x8c5c('0x35')](_0x8c5c('0x36'))){_0x23f003[_0x8c5c('0x1a')]=qs[_0x8c5c('0x1a')](_0x1f4fb9[_0x8c5c('0x2f')][_0x8c5c('0x1a')]);_0x23f003['offset']=qs[_0x8c5c('0x18')](_0x1f4fb9[_0x8c5c('0x2f')][_0x8c5c('0x18')]);}_0x23f003['order']=qs[_0x8c5c('0x37')](_0x1f4fb9[_0x8c5c('0x2f')][_0x8c5c('0x37')]);_0x23f003[_0x8c5c('0x38')]=qs[_0x8c5c('0x30')](_[_0x8c5c('0x39')](_0x1f4fb9[_0x8c5c('0x2f')],_0x5e26eb[_0x8c5c('0x30')]),_0x479ff0);if(_0x1f4fb9[_0x8c5c('0x2f')][_0x8c5c('0x3a')]){_0x23f003['where']=_[_0x8c5c('0x3b')](_0x23f003[_0x8c5c('0x38')],{'$or':_[_0x8c5c('0x2a')](_0x479ff0,function(_0x1fc438){if(_0x1fc438[_0x8c5c('0x3c')]!==_0x8c5c('0x3d')){var _0x58ef2a={};_0x58ef2a[_0x1fc438[_0x8c5c('0x27')]]={'$like':'%'+_0x1f4fb9[_0x8c5c('0x2f')]['filter']+'%'};return _0x58ef2a;}})});}_0x23f003=_[_0x8c5c('0x3b')]({},_0x23f003,_0x1f4fb9['options']);var _0x55b140={'where':_0x23f003[_0x8c5c('0x38')]};return db[_0x8c5c('0x2b')]['count'](_0x55b140)[_0x8c5c('0x23')](function(_0x42ad50){_0x450b66['count']=_0x42ad50;if(_0x1f4fb9[_0x8c5c('0x2f')][_0x8c5c('0x3e')]){_0x23f003[_0x8c5c('0x3f')]=[{'all':!![]}];}return db[_0x8c5c('0x2b')][_0x8c5c('0x40')](_0x23f003);})[_0x8c5c('0x23')](function(_0x2a806a){_0x450b66['rows']=_0x2a806a;return _0x450b66;})[_0x8c5c('0x23')](respondWithFilteredResult(_0xec73ec,_0x23f003))[_0x8c5c('0x41')](handleError(_0xec73ec,null));};exports[_0x8c5c('0x42')]=function(_0x5732a4,_0x5d9c6f){var _0x3ed226={'raw':!![],'where':{'id':_0x5732a4[_0x8c5c('0x43')]['id']}},_0xfe1aad={};_0xfe1aad['model']=_[_0x8c5c('0x44')](db[_0x8c5c('0x2b')][_0x8c5c('0x2c')]);_0xfe1aad['query']=_[_0x8c5c('0x44')](_0x5732a4['query']);_0xfe1aad['filters']=_[_0x8c5c('0x31')](_0xfe1aad['model'],_0xfe1aad[_0x8c5c('0x2f')]);_0x3ed226['attributes']=_[_0x8c5c('0x31')](_0xfe1aad[_0x8c5c('0x2e')],qs[_0x8c5c('0x33')](_0x5732a4[_0x8c5c('0x2f')]['fields']));_0x3ed226[_0x8c5c('0x32')]=_0x3ed226['attributes']['length']?_0x3ed226['attributes']:_0xfe1aad[_0x8c5c('0x2e')];if(_0x5732a4[_0x8c5c('0x2f')][_0x8c5c('0x3e')]){_0x3ed226[_0x8c5c('0x3f')]=[{'all':!![]}];}_0x3ed226=_[_0x8c5c('0x3b')]({},_0x3ed226,_0x5732a4[_0x8c5c('0x45')]);return db['JscriptyQuestionReport'][_0x8c5c('0x46')](_0x3ed226)['then'](handleEntityNotFound(_0x5d9c6f,null))[_0x8c5c('0x23')](respondWithResult(_0x5d9c6f,null))[_0x8c5c('0x41')](handleError(_0x5d9c6f,null));};exports[_0x8c5c('0x47')]=function(_0x2b8a77,_0x1a3e36){return db['JscriptyQuestionReport'][_0x8c5c('0x47')](_0x2b8a77[_0x8c5c('0x48')],{})[_0x8c5c('0x23')](respondWithResult(_0x1a3e36,0xc9))[_0x8c5c('0x41')](handleError(_0x1a3e36,null));};exports[_0x8c5c('0x21')]=function(_0x846fb8,_0x3ea922){if(_0x846fb8[_0x8c5c('0x48')]['id']){delete _0x846fb8['body']['id'];}return db['JscriptyQuestionReport']['find']({'where':{'id':_0x846fb8[_0x8c5c('0x43')]['id']}})[_0x8c5c('0x23')](handleEntityNotFound(_0x3ea922,null))[_0x8c5c('0x23')](saveUpdates(_0x846fb8['body'],null))[_0x8c5c('0x23')](respondWithResult(_0x3ea922,null))[_0x8c5c('0x41')](handleError(_0x3ea922,null));};exports['destroy']=function(_0x206a2e,_0x17c155){return db[_0x8c5c('0x2b')][_0x8c5c('0x46')]({'where':{'id':_0x206a2e[_0x8c5c('0x43')]['id']}})['then'](handleEntityNotFound(_0x17c155,null))[_0x8c5c('0x23')](removeEntity(_0x17c155,null))[_0x8c5c('0x41')](handleError(_0x17c155,null));};exports[_0x8c5c('0x49')]=function(_0xea6d79,_0x40c56a){return db[_0x8c5c('0x2b')][_0x8c5c('0x49')]()[_0x8c5c('0x23')](respondWithResult(_0x40c56a,null))[_0x8c5c('0x41')](handleError(_0x40c56a,null));}; \ No newline at end of file +var _0xffc2=['filter','options','includeAll','include','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','end','error','stack','name','send','index','map','JscriptyQuestionReport','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','where','pick','merge','VIRTUAL'];(function(_0x457c96,_0x13785c){var _0x4e5ebc=function(_0x2fddc2){while(--_0x2fddc2){_0x457c96['push'](_0x457c96['shift']());}};_0x4e5ebc(++_0x13785c);}(_0xffc2,0xe4));var _0x2ffc=function(_0x383fac,_0xeda6b6){_0x383fac=_0x383fac-0x0;var _0x38d3b6=_0xffc2[_0x383fac];return _0x38d3b6;};'use strict';var emlformat=require(_0x2ffc('0x0'));var rimraf=require(_0x2ffc('0x1'));var zipdir=require(_0x2ffc('0x2'));var jsonpatch=require(_0x2ffc('0x3'));var rp=require(_0x2ffc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2ffc('0x5'));var util=require(_0x2ffc('0x6'));var path=require(_0x2ffc('0x7'));var sox=require(_0x2ffc('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2ffc('0x9'));var _=require(_0x2ffc('0xa'));var squel=require(_0x2ffc('0xb'));var crypto=require(_0x2ffc('0xc'));var jsforce=require(_0x2ffc('0xd'));var deskjs=require(_0x2ffc('0xe'));var toCsv=require(_0x2ffc('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2ffc('0x10'));var authService=require(_0x2ffc('0x11'));var qs=require(_0x2ffc('0x12'));var as=require(_0x2ffc('0x13'));var hardwareService=require(_0x2ffc('0x14'));var logger=require(_0x2ffc('0x15'))(_0x2ffc('0x16'));var utils=require('../../config/utils');var config=require(_0x2ffc('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5027fa,_0x450a78){_0x450a78=_0x450a78||0xcc;return function(_0x316317){if(_0x316317){return _0x5027fa['sendStatus'](_0x450a78);}return _0x5027fa[_0x2ffc('0x18')](_0x450a78)['end']();};}function respondWithResult(_0x27127f,_0x64b963){_0x64b963=_0x64b963||0xc8;return function(_0x4a11b6){if(_0x4a11b6){return _0x27127f['status'](_0x64b963)[_0x2ffc('0x19')](_0x4a11b6);}};}function respondWithFilteredResult(_0x7cbe83,_0x3b4c61){return function(_0x289f6c){if(_0x289f6c){var _0x805c52=typeof _0x3b4c61[_0x2ffc('0x1a')]===_0x2ffc('0x1b')&&typeof _0x3b4c61[_0x2ffc('0x1c')]===_0x2ffc('0x1b');var _0x1f588f=_0x289f6c[_0x2ffc('0x1d')];var _0x2d757d=_0x805c52?0x0:_0x3b4c61[_0x2ffc('0x1a')];var _0xbafab6=_0x805c52?_0x289f6c[_0x2ffc('0x1d')]:_0x3b4c61[_0x2ffc('0x1a')]+_0x3b4c61[_0x2ffc('0x1c')];var _0x1e5c3d;if(_0xbafab6>=_0x1f588f){_0xbafab6=_0x1f588f;_0x1e5c3d=0xc8;}else{_0x1e5c3d=0xce;}_0x7cbe83[_0x2ffc('0x18')](_0x1e5c3d);return _0x7cbe83[_0x2ffc('0x1e')](_0x2ffc('0x1f'),_0x2d757d+'-'+_0xbafab6+'/'+_0x1f588f)[_0x2ffc('0x19')](_0x289f6c);}return null;};}function patchUpdates(_0xe68559){return function(_0x27756e){try{jsonpatch[_0x2ffc('0x20')](_0x27756e,_0xe68559,!![]);}catch(_0xd32b93){return BPromise['reject'](_0xd32b93);}return _0x27756e[_0x2ffc('0x21')]();};}function saveUpdates(_0x12070e,_0x52ce28){return function(_0x10623e){if(_0x10623e){return _0x10623e[_0x2ffc('0x22')](_0x12070e)[_0x2ffc('0x23')](function(_0x31da95){return _0x31da95;});}return null;};}function removeEntity(_0x3bbd42,_0x28d8d7){return function(_0x52b83d){if(_0x52b83d){return _0x52b83d['destroy']()[_0x2ffc('0x23')](function(){_0x3bbd42[_0x2ffc('0x18')](0xcc)[_0x2ffc('0x24')]();});}};}function handleEntityNotFound(_0x25b335,_0x45078a){return function(_0x55632b){if(!_0x55632b){_0x25b335['sendStatus'](0x194);}return _0x55632b;};}function handleError(_0x53dc5f,_0x35fe26){_0x35fe26=_0x35fe26||0x1f4;return function(_0x1d8c0e){logger[_0x2ffc('0x25')](_0x1d8c0e[_0x2ffc('0x26')]);if(_0x1d8c0e[_0x2ffc('0x27')]){delete _0x1d8c0e[_0x2ffc('0x27')];}_0x53dc5f['status'](_0x35fe26)[_0x2ffc('0x28')](_0x1d8c0e);};}exports[_0x2ffc('0x29')]=function(_0x355891,_0x3ff1b5){var _0x1005fd={},_0x3a7d29={},_0x1ac1df={'count':0x0,'rows':[]};var _0x1b00f4=_[_0x2ffc('0x2a')](db[_0x2ffc('0x2b')]['rawAttributes'],function(_0x333ca1){return{'name':_0x333ca1['fieldName'],'type':_0x333ca1[_0x2ffc('0x2c')][_0x2ffc('0x2d')]};});_0x3a7d29['model']=_[_0x2ffc('0x2a')](_0x1b00f4,'name');_0x3a7d29[_0x2ffc('0x2e')]=_[_0x2ffc('0x2f')](_0x355891[_0x2ffc('0x2e')]);_0x3a7d29[_0x2ffc('0x30')]=_[_0x2ffc('0x31')](_0x3a7d29[_0x2ffc('0x32')],_0x3a7d29[_0x2ffc('0x2e')]);_0x1005fd[_0x2ffc('0x33')]=_[_0x2ffc('0x31')](_0x3a7d29['model'],qs[_0x2ffc('0x34')](_0x355891[_0x2ffc('0x2e')][_0x2ffc('0x34')]));_0x1005fd[_0x2ffc('0x33')]=_0x1005fd[_0x2ffc('0x33')][_0x2ffc('0x35')]?_0x1005fd[_0x2ffc('0x33')]:_0x3a7d29[_0x2ffc('0x32')];if(!_0x355891['query']['hasOwnProperty'](_0x2ffc('0x36'))){_0x1005fd[_0x2ffc('0x1c')]=qs[_0x2ffc('0x1c')](_0x355891[_0x2ffc('0x2e')][_0x2ffc('0x1c')]);_0x1005fd[_0x2ffc('0x1a')]=qs['offset'](_0x355891[_0x2ffc('0x2e')]['offset']);}_0x1005fd[_0x2ffc('0x37')]=qs['sort'](_0x355891[_0x2ffc('0x2e')]['sort']);_0x1005fd[_0x2ffc('0x38')]=qs[_0x2ffc('0x30')](_[_0x2ffc('0x39')](_0x355891[_0x2ffc('0x2e')],_0x3a7d29[_0x2ffc('0x30')]),_0x1b00f4);if(_0x355891['query']['filter']){_0x1005fd[_0x2ffc('0x38')]=_[_0x2ffc('0x3a')](_0x1005fd[_0x2ffc('0x38')],{'$or':_[_0x2ffc('0x2a')](_0x1b00f4,function(_0x4c6711){if(_0x4c6711['type']!==_0x2ffc('0x3b')){var _0x10c2dc={};_0x10c2dc[_0x4c6711['name']]={'$like':'%'+_0x355891[_0x2ffc('0x2e')][_0x2ffc('0x3c')]+'%'};return _0x10c2dc;}})});}_0x1005fd=_[_0x2ffc('0x3a')]({},_0x1005fd,_0x355891[_0x2ffc('0x3d')]);var _0x236d05={'where':_0x1005fd[_0x2ffc('0x38')]};return db[_0x2ffc('0x2b')][_0x2ffc('0x1d')](_0x236d05)[_0x2ffc('0x23')](function(_0x35e1f3){_0x1ac1df[_0x2ffc('0x1d')]=_0x35e1f3;if(_0x355891['query'][_0x2ffc('0x3e')]){_0x1005fd[_0x2ffc('0x3f')]=[{'all':!![]}];}return db[_0x2ffc('0x2b')]['findAll'](_0x1005fd);})[_0x2ffc('0x23')](function(_0x37f095){_0x1ac1df['rows']=_0x37f095;return _0x1ac1df;})[_0x2ffc('0x23')](respondWithFilteredResult(_0x3ff1b5,_0x1005fd))[_0x2ffc('0x40')](handleError(_0x3ff1b5,null));};exports[_0x2ffc('0x41')]=function(_0x56592a,_0x54177a){var _0x347c0d={'raw':!![],'where':{'id':_0x56592a[_0x2ffc('0x42')]['id']}},_0x1a904e={};_0x1a904e[_0x2ffc('0x32')]=_[_0x2ffc('0x2f')](db['JscriptyQuestionReport']['rawAttributes']);_0x1a904e[_0x2ffc('0x2e')]=_[_0x2ffc('0x2f')](_0x56592a[_0x2ffc('0x2e')]);_0x1a904e[_0x2ffc('0x30')]=_[_0x2ffc('0x31')](_0x1a904e[_0x2ffc('0x32')],_0x1a904e[_0x2ffc('0x2e')]);_0x347c0d['attributes']=_[_0x2ffc('0x31')](_0x1a904e[_0x2ffc('0x32')],qs[_0x2ffc('0x34')](_0x56592a['query']['fields']));_0x347c0d['attributes']=_0x347c0d[_0x2ffc('0x33')][_0x2ffc('0x35')]?_0x347c0d['attributes']:_0x1a904e[_0x2ffc('0x32')];if(_0x56592a[_0x2ffc('0x2e')]['includeAll']){_0x347c0d[_0x2ffc('0x3f')]=[{'all':!![]}];}_0x347c0d=_[_0x2ffc('0x3a')]({},_0x347c0d,_0x56592a[_0x2ffc('0x3d')]);return db[_0x2ffc('0x2b')][_0x2ffc('0x43')](_0x347c0d)[_0x2ffc('0x23')](handleEntityNotFound(_0x54177a,null))[_0x2ffc('0x23')](respondWithResult(_0x54177a,null))[_0x2ffc('0x40')](handleError(_0x54177a,null));};exports[_0x2ffc('0x44')]=function(_0x44b3cf,_0x46cc9c){return db['JscriptyQuestionReport'][_0x2ffc('0x44')](_0x44b3cf[_0x2ffc('0x45')],{})[_0x2ffc('0x23')](respondWithResult(_0x46cc9c,0xc9))[_0x2ffc('0x40')](handleError(_0x46cc9c,null));};exports['update']=function(_0x1c6ada,_0x3678ce){if(_0x1c6ada[_0x2ffc('0x45')]['id']){delete _0x1c6ada[_0x2ffc('0x45')]['id'];}return db[_0x2ffc('0x2b')][_0x2ffc('0x43')]({'where':{'id':_0x1c6ada[_0x2ffc('0x42')]['id']}})[_0x2ffc('0x23')](handleEntityNotFound(_0x3678ce,null))['then'](saveUpdates(_0x1c6ada[_0x2ffc('0x45')],null))[_0x2ffc('0x23')](respondWithResult(_0x3678ce,null))[_0x2ffc('0x40')](handleError(_0x3678ce,null));};exports[_0x2ffc('0x46')]=function(_0x46d5e2,_0x1c40c2){return db[_0x2ffc('0x2b')][_0x2ffc('0x43')]({'where':{'id':_0x46d5e2[_0x2ffc('0x42')]['id']}})['then'](handleEntityNotFound(_0x1c40c2,null))['then'](removeEntity(_0x1c40c2,null))['catch'](handleError(_0x1c40c2,null));};exports[_0x2ffc('0x47')]=function(_0x10c973,_0x3508c1){return db[_0x2ffc('0x2b')]['describe']()[_0x2ffc('0x23')](respondWithResult(_0x3508c1,null))[_0x2ffc('0x40')](handleError(_0x3508c1,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index caf2d18..2c49923 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 _0xf8d8=['api','moment','bluebird','request-promise','path','rimraf','./jscriptyQuestionReport.attributes','report_jscripty_questions','lodash','util','../../config/logger'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xf8d8,0x97));var _0x8f8d=function(_0x5d008b,_0x12b7b2){_0x5d008b=_0x5d008b-0x0;var _0x381807=_0xf8d8[_0x5d008b];return _0x381807;};'use strict';var _=require(_0x8f8d('0x0'));var util=require(_0x8f8d('0x1'));var logger=require(_0x8f8d('0x2'))(_0x8f8d('0x3'));var moment=require(_0x8f8d('0x4'));var BPromise=require(_0x8f8d('0x5'));var rp=require(_0x8f8d('0x6'));var fs=require('fs');var path=require(_0x8f8d('0x7'));var rimraf=require(_0x8f8d('0x8'));var config=require('../../config/environment');var attributes=require(_0x8f8d('0x9'));module['exports']=function(_0x4c3188,_0x15c7d2){return _0x4c3188['define']('JscriptyQuestionReport',attributes,{'tableName':_0x8f8d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa0a2=['../../config/environment','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','report_jscripty_questions','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1d30bd,_0x136d6b){var _0x3a0118=function(_0x548d9f){while(--_0x548d9f){_0x1d30bd['push'](_0x1d30bd['shift']());}};_0x3a0118(++_0x136d6b);}(_0xa0a2,0x71));var _0x2a0a=function(_0x58c20f,_0x4cdb1b){_0x58c20f=_0x58c20f-0x0;var _0x3b0318=_0xa0a2[_0x58c20f];return _0x3b0318;};'use strict';var _=require(_0x2a0a('0x0'));var util=require('util');var logger=require(_0x2a0a('0x1'))(_0x2a0a('0x2'));var moment=require(_0x2a0a('0x3'));var BPromise=require(_0x2a0a('0x4'));var rp=require(_0x2a0a('0x5'));var fs=require('fs');var path=require(_0x2a0a('0x6'));var rimraf=require('rimraf');var config=require(_0x2a0a('0x7'));var attributes=require(_0x2a0a('0x8'));module['exports']=function(_0x561d8d,_0x5b37ab){return _0x561d8d[_0x2a0a('0x9')](_0x2a0a('0xa'),attributes,{'tableName':_0x2a0a('0xb'),'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 5cd67b8..4c73266 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 _0x47ed=['jayson/promise','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment'];(function(_0xf2e588,_0x8382bf){var _0x958ed2=function(_0x1d76c8){while(--_0x1d76c8){_0xf2e588['push'](_0xf2e588['shift']());}};_0x958ed2(++_0x8382bf);}(_0x47ed,0x135));var _0xd47e=function(_0x4327c5,_0x34fd51){_0x4327c5=_0x4327c5-0x0;var _0x693f12=_0x47ed[_0x4327c5];return _0x693f12;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd47e('0x0'));var BPromise=require(_0xd47e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd47e('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd47e('0x3'))(_0xd47e('0x4'));var config=require(_0xd47e('0x5'));var jayson=require(_0xd47e('0x6'));var client=jayson[_0xd47e('0x7')][_0xd47e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3cc24b,_0x3e461f,_0x5998ef){return new BPromise(function(_0x302784,_0x369ee0){return client[_0xd47e('0x9')](_0x3cc24b,_0x5998ef)[_0xd47e('0xa')](function(_0x5d2d83){logger[_0xd47e('0xb')](_0xd47e('0xc'),_0x3e461f,_0xd47e('0xd'));logger[_0xd47e('0xe')](_0xd47e('0xf'),_0x3e461f,'request\x20sent',JSON['stringify'](_0x5d2d83));if(_0x5d2d83[_0xd47e('0x10')]){if(_0x5d2d83['error'][_0xd47e('0x11')]===0x1f4){logger[_0xd47e('0x10')](_0xd47e('0xc'),_0x3e461f,_0x5d2d83[_0xd47e('0x10')][_0xd47e('0x12')]);return _0x369ee0(_0x5d2d83[_0xd47e('0x10')][_0xd47e('0x12')]);}logger['error'](_0xd47e('0xc'),_0x3e461f,_0x5d2d83['error'][_0xd47e('0x12')]);return _0x302784(_0x5d2d83['error']['message']);}else{logger[_0xd47e('0xb')](_0xd47e('0xc'),_0x3e461f,_0xd47e('0xd'));_0x302784(_0x5d2d83[_0xd47e('0x13')]['message']);}})[_0xd47e('0x14')](function(_0x2fbffd){logger[_0xd47e('0x10')](_0xd47e('0xc'),_0x3e461f,_0x2fbffd);_0x369ee0(_0x2fbffd);});});} \ No newline at end of file +var _0x40da=['client','http','request','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x40da,0x1c2));var _0xa40d=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x40da[_0x4f9b18];return _0x29f20c;};'use strict';var _=require(_0xa40d('0x0'));var util=require(_0xa40d('0x1'));var moment=require(_0xa40d('0x2'));var BPromise=require(_0xa40d('0x3'));var rs=require(_0xa40d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa40d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa40d('0x6'))(_0xa40d('0x7'));var config=require(_0xa40d('0x8'));var jayson=require(_0xa40d('0x9'));var client=jayson[_0xa40d('0xa')][_0xa40d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x267748,_0x1b0dc4,_0x37436c){return new BPromise(function(_0x305798,_0x49e71a){return client[_0xa40d('0xc')](_0x267748,_0x37436c)['then'](function(_0x874e6a){logger['info'](_0xa40d('0xd'),_0x1b0dc4,_0xa40d('0xe'));logger[_0xa40d('0xf')](_0xa40d('0x10'),_0x1b0dc4,_0xa40d('0xe'),JSON[_0xa40d('0x11')](_0x874e6a));if(_0x874e6a[_0xa40d('0x12')]){if(_0x874e6a[_0xa40d('0x12')][_0xa40d('0x13')]===0x1f4){logger[_0xa40d('0x12')](_0xa40d('0xd'),_0x1b0dc4,_0x874e6a[_0xa40d('0x12')][_0xa40d('0x14')]);return _0x49e71a(_0x874e6a['error'][_0xa40d('0x14')]);}logger[_0xa40d('0x12')](_0xa40d('0xd'),_0x1b0dc4,_0x874e6a[_0xa40d('0x12')]['message']);return _0x305798(_0x874e6a[_0xa40d('0x12')][_0xa40d('0x14')]);}else{logger[_0xa40d('0x15')](_0xa40d('0xd'),_0x1b0dc4,_0xa40d('0xe'));_0x305798(_0x874e6a['result'][_0xa40d('0x14')]);}})[_0xa40d('0x16')](function(_0x52204c){logger[_0xa40d('0x12')](_0xa40d('0xd'),_0x1b0dc4,_0x52204c);_0x49e71a(_0x52204c);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 40c1591..a1df1d5 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 _0xf838=['express','Router','fs-extra','../../components/interaction/service','./jscriptySessionReport.controller','isAuthenticated','index','/describe','describe','get','/:id','/:id/questions','getQuestions','create','put','delete','destroy','exports','util','path','connect-timeout'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0xf838,0x177));var _0x8f83=function(_0x4378d5,_0x496620){_0x4378d5=_0x4378d5-0x0;var _0x453cf2=_0xf838[_0x4378d5];return _0x453cf2;};'use strict';var multer=require('multer');var util=require(_0x8f83('0x0'));var path=require(_0x8f83('0x1'));var timeout=require(_0x8f83('0x2'));var express=require(_0x8f83('0x3'));var router=express[_0x8f83('0x4')]();var fs_extra=require(_0x8f83('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8f83('0x6'));var config=require('../../config/environment');var controller=require(_0x8f83('0x7'));router['get']('/',auth[_0x8f83('0x8')](),controller[_0x8f83('0x9')]);router['get'](_0x8f83('0xa'),auth['isAuthenticated'](),controller[_0x8f83('0xb')]);router[_0x8f83('0xc')](_0x8f83('0xd'),auth[_0x8f83('0x8')](),controller['show']);router[_0x8f83('0xc')](_0x8f83('0xe'),auth['isAuthenticated'](),controller[_0x8f83('0xf')]);router['post']('/',auth[_0x8f83('0x8')](),controller[_0x8f83('0x10')]);router[_0x8f83('0x11')](_0x8f83('0xd'),auth[_0x8f83('0x8')](),controller['update']);router[_0x8f83('0x12')](_0x8f83('0xd'),auth[_0x8f83('0x8')](),controller[_0x8f83('0x13')]);module[_0x8f83('0x14')]=router; \ No newline at end of file +var _0x88ea=['/:id/questions','put','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','./jscriptySessionReport.controller','get','isAuthenticated','index','describe','/:id','show'];(function(_0x120830,_0x4d996a){var _0x4d4a32=function(_0x4d7639){while(--_0x4d7639){_0x120830['push'](_0x120830['shift']());}};_0x4d4a32(++_0x4d996a);}(_0x88ea,0x71));var _0xa88e=function(_0x3dc752,_0x3e39f4){_0x3dc752=_0x3dc752-0x0;var _0x1e4725=_0x88ea[_0x3dc752];return _0x1e4725;};'use strict';var multer=require(_0xa88e('0x0'));var util=require(_0xa88e('0x1'));var path=require(_0xa88e('0x2'));var timeout=require(_0xa88e('0x3'));var express=require(_0xa88e('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa88e('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa88e('0x6'));router[_0xa88e('0x7')]('/',auth[_0xa88e('0x8')](),controller[_0xa88e('0x9')]);router[_0xa88e('0x7')]('/describe',auth[_0xa88e('0x8')](),controller[_0xa88e('0xa')]);router[_0xa88e('0x7')](_0xa88e('0xb'),auth[_0xa88e('0x8')](),controller[_0xa88e('0xc')]);router[_0xa88e('0x7')](_0xa88e('0xd'),auth[_0xa88e('0x8')](),controller['getQuestions']);router['post']('/',auth[_0xa88e('0x8')](),controller['create']);router[_0xa88e('0xe')](_0xa88e('0xb'),auth[_0xa88e('0x8')](),controller['update']);router[_0xa88e('0xf')]('/:id',auth[_0xa88e('0x8')](),controller[_0xa88e('0x10')]);module[_0xa88e('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 047a0f9..f232995 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 _0x1f93=['moment','sequelize','exports','DATE','setDataValue','starttime','endtime','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN'];(function(_0x459b7e,_0x22f08e){var _0x30a75e=function(_0x3756f5){while(--_0x3756f5){_0x459b7e['push'](_0x459b7e['shift']());}};_0x30a75e(++_0x22f08e);}(_0x1f93,0x118));var _0x31f9=function(_0x18d550,_0x5874c1){_0x18d550=_0x18d550-0x0;var _0x384e10=_0x1f93[_0x18d550];return _0x384e10;};'use strict';var moment=require(_0x31f9('0x0'));var Sequelize=require(_0x31f9('0x1'));module[_0x31f9('0x2')]={'starttime':{'type':Sequelize[_0x31f9('0x3')],'set':function(_0x2852bf){this[_0x31f9('0x4')](_0x31f9('0x5'),_0x2852bf);this[_0x31f9('0x4')](_0x31f9('0x6'),moment()['format'](_0x31f9('0x7')));}},'endtime':{'type':Sequelize[_0x31f9('0x3')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x31f9('0x8')]},'queue':{'type':Sequelize[_0x31f9('0x8')]},'uniqueid':{'type':Sequelize[_0x31f9('0x8')]},'calleridname':{'type':Sequelize[_0x31f9('0x8')]},'calleridnum':{'type':Sequelize[_0x31f9('0x8')]},'completed':{'type':Sequelize[_0x31f9('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0xad52=['moment','sequelize','exports','DATE','starttime','setDataValue','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN'];(function(_0xf26734,_0x202fb6){var _0x133c60=function(_0x580cf0){while(--_0x580cf0){_0xf26734['push'](_0xf26734['shift']());}};_0x133c60(++_0x202fb6);}(_0xad52,0x1e4));var _0x2ad5=function(_0x2e0519,_0x1fc59f){_0x2e0519=_0x2e0519-0x0;var _0x46c368=_0xad52[_0x2e0519];return _0x46c368;};'use strict';var moment=require(_0x2ad5('0x0'));var Sequelize=require(_0x2ad5('0x1'));module[_0x2ad5('0x2')]={'starttime':{'type':Sequelize[_0x2ad5('0x3')],'set':function(_0x5833dc){this['setDataValue'](_0x2ad5('0x4'),_0x5833dc);this[_0x2ad5('0x5')](_0x2ad5('0x6'),moment()[_0x2ad5('0x7')](_0x2ad5('0x8')));}},'endtime':{'type':Sequelize[_0x2ad5('0x3')]},'membername':{'type':Sequelize[_0x2ad5('0x9')]},'projectname':{'type':Sequelize[_0x2ad5('0x9')]},'queue':{'type':Sequelize[_0x2ad5('0x9')]},'uniqueid':{'type':Sequelize[_0x2ad5('0x9')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x2ad5('0xa')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 2e521d4..553b719 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 _0xa6ab=['find','create','body','catch','destroy','describe','getQuestions','findOne','JscriptyQuestionReport','hasOwnProperty','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','error','stack','send','map','JscriptySessionReport','rawAttributes','fieldName','type','key','name','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','show','params','options'];(function(_0x46ae87,_0x4bd053){var _0x303fcc=function(_0xf522b9){while(--_0xf522b9){_0x46ae87['push'](_0x46ae87['shift']());}};_0x303fcc(++_0x4bd053);}(_0xa6ab,0x1de));var _0xba6a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa6ab[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0xba6a('0x0'));var rimraf=require(_0xba6a('0x1'));var zipdir=require(_0xba6a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xba6a('0x3'));var moment=require(_0xba6a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xba6a('0x5'));var util=require(_0xba6a('0x6'));var path=require(_0xba6a('0x7'));var sox=require(_0xba6a('0x8'));var csv=require(_0xba6a('0x9'));var ejs=require(_0xba6a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xba6a('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xba6a('0xc'));var toCsv=require(_0xba6a('0x9'));var querystring=require(_0xba6a('0xd'));var Papa=require(_0xba6a('0xe'));var Redis=require(_0xba6a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xba6a('0x10'));var as=require(_0xba6a('0x11'));var hardwareService=require(_0xba6a('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xba6a('0x13'));var config=require(_0xba6a('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf8d433,_0x4d5593){_0x4d5593=_0x4d5593||0xcc;return function(_0x2f57b9){if(_0x2f57b9){return _0xf8d433[_0xba6a('0x15')](_0x4d5593);}return _0xf8d433[_0xba6a('0x16')](_0x4d5593)[_0xba6a('0x17')]();};}function respondWithResult(_0x13dbdc,_0x14165a){_0x14165a=_0x14165a||0xc8;return function(_0x1b81f8){if(_0x1b81f8){return _0x13dbdc[_0xba6a('0x16')](_0x14165a)[_0xba6a('0x18')](_0x1b81f8);}};}function respondWithFilteredResult(_0xd4fbcb,_0x4a6c96){return function(_0x151dba){if(_0x151dba){var _0x7eb2ab=typeof _0x4a6c96[_0xba6a('0x19')]===_0xba6a('0x1a')&&typeof _0x4a6c96['limit']===_0xba6a('0x1a');var _0x5f25f8=_0x151dba[_0xba6a('0x1b')];var _0x38ed25=_0x7eb2ab?0x0:_0x4a6c96[_0xba6a('0x19')];var _0x1613ae=_0x7eb2ab?_0x151dba[_0xba6a('0x1b')]:_0x4a6c96[_0xba6a('0x19')]+_0x4a6c96[_0xba6a('0x1c')];var _0x456f52;if(_0x1613ae>=_0x5f25f8){_0x1613ae=_0x5f25f8;_0x456f52=0xc8;}else{_0x456f52=0xce;}_0xd4fbcb[_0xba6a('0x16')](_0x456f52);return _0xd4fbcb[_0xba6a('0x1d')](_0xba6a('0x1e'),_0x38ed25+'-'+_0x1613ae+'/'+_0x5f25f8)[_0xba6a('0x18')](_0x151dba);}return null;};}function patchUpdates(_0x4b9014){return function(_0x2803e1){try{jsonpatch[_0xba6a('0x1f')](_0x2803e1,_0x4b9014,!![]);}catch(_0x12482e){return BPromise[_0xba6a('0x20')](_0x12482e);}return _0x2803e1[_0xba6a('0x21')]();};}function saveUpdates(_0xb4e5a9,_0xc279b3){return function(_0x3a8e16){if(_0x3a8e16){return _0x3a8e16[_0xba6a('0x22')](_0xb4e5a9)[_0xba6a('0x23')](function(_0x47d203){return _0x47d203;});}return null;};}function removeEntity(_0xedd1a9,_0x6e3af8){return function(_0x14ae6c){if(_0x14ae6c){return _0x14ae6c['destroy']()[_0xba6a('0x23')](function(){_0xedd1a9[_0xba6a('0x16')](0xcc)[_0xba6a('0x17')]();});}};}function handleEntityNotFound(_0x39313d,_0x1973d0){return function(_0x5cc252){if(!_0x5cc252){_0x39313d[_0xba6a('0x15')](0x194);}return _0x5cc252;};}function handleError(_0xf4fcba,_0x38ad31){_0x38ad31=_0x38ad31||0x1f4;return function(_0x30b8bf){logger[_0xba6a('0x24')](_0x30b8bf[_0xba6a('0x25')]);if(_0x30b8bf['name']){delete _0x30b8bf['name'];}_0xf4fcba[_0xba6a('0x16')](_0x38ad31)[_0xba6a('0x26')](_0x30b8bf);};}exports['index']=function(_0x3c2581,_0x1a60ef){var _0x259ddc={},_0x511a62={},_0x11424c={'count':0x0,'rows':[]};var _0x169212=_[_0xba6a('0x27')](db[_0xba6a('0x28')][_0xba6a('0x29')],function(_0x3f1e43){return{'name':_0x3f1e43[_0xba6a('0x2a')],'type':_0x3f1e43[_0xba6a('0x2b')][_0xba6a('0x2c')]};});_0x511a62['model']=_[_0xba6a('0x27')](_0x169212,_0xba6a('0x2d'));_0x511a62[_0xba6a('0x2e')]=_[_0xba6a('0x2f')](_0x3c2581[_0xba6a('0x2e')]);_0x511a62[_0xba6a('0x30')]=_[_0xba6a('0x31')](_0x511a62[_0xba6a('0x32')],_0x511a62[_0xba6a('0x2e')]);_0x259ddc[_0xba6a('0x33')]=_[_0xba6a('0x31')](_0x511a62['model'],qs[_0xba6a('0x34')](_0x3c2581[_0xba6a('0x2e')][_0xba6a('0x34')]));_0x259ddc[_0xba6a('0x33')]=_0x259ddc['attributes'][_0xba6a('0x35')]?_0x259ddc[_0xba6a('0x33')]:_0x511a62[_0xba6a('0x32')];if(!_0x3c2581[_0xba6a('0x2e')]['hasOwnProperty'](_0xba6a('0x36'))){_0x259ddc[_0xba6a('0x1c')]=qs[_0xba6a('0x1c')](_0x3c2581[_0xba6a('0x2e')]['limit']);_0x259ddc[_0xba6a('0x19')]=qs[_0xba6a('0x19')](_0x3c2581[_0xba6a('0x2e')]['offset']);}_0x259ddc[_0xba6a('0x37')]=qs[_0xba6a('0x38')](_0x3c2581['query'][_0xba6a('0x38')]);_0x259ddc[_0xba6a('0x39')]=qs[_0xba6a('0x30')](_[_0xba6a('0x3a')](_0x3c2581[_0xba6a('0x2e')],_0x511a62[_0xba6a('0x30')]),_0x169212);if(_0x3c2581[_0xba6a('0x2e')][_0xba6a('0x3b')]){_0x259ddc[_0xba6a('0x39')]=_['merge'](_0x259ddc[_0xba6a('0x39')],{'$or':_[_0xba6a('0x27')](_0x169212,function(_0x5e69ce){if(_0x5e69ce[_0xba6a('0x2b')]!=='VIRTUAL'){var _0x48e0ff={};_0x48e0ff[_0x5e69ce[_0xba6a('0x2d')]]={'$like':'%'+_0x3c2581[_0xba6a('0x2e')]['filter']+'%'};return _0x48e0ff;}})});}_0x259ddc=_[_0xba6a('0x3c')]({},_0x259ddc,_0x3c2581['options']);var _0x3df96b={'where':_0x259ddc['where']};return db[_0xba6a('0x28')][_0xba6a('0x1b')](_0x3df96b)[_0xba6a('0x23')](function(_0x58810a){_0x11424c[_0xba6a('0x1b')]=_0x58810a;if(_0x3c2581[_0xba6a('0x2e')][_0xba6a('0x3d')]){_0x259ddc[_0xba6a('0x3e')]=[{'all':!![]}];}return db[_0xba6a('0x28')][_0xba6a('0x3f')](_0x259ddc);})[_0xba6a('0x23')](function(_0x4ef668){_0x11424c[_0xba6a('0x40')]=_0x4ef668;return _0x11424c;})[_0xba6a('0x23')](respondWithFilteredResult(_0x1a60ef,_0x259ddc))['catch'](handleError(_0x1a60ef,null));};exports[_0xba6a('0x41')]=function(_0x3a2237,_0x1f0cb6){var _0x4d6bab={'raw':!![],'where':{'id':_0x3a2237[_0xba6a('0x42')]['id']}},_0x2be8b9={};_0x2be8b9[_0xba6a('0x32')]=_[_0xba6a('0x2f')](db[_0xba6a('0x28')][_0xba6a('0x29')]);_0x2be8b9[_0xba6a('0x2e')]=_['keys'](_0x3a2237[_0xba6a('0x2e')]);_0x2be8b9[_0xba6a('0x30')]=_['intersection'](_0x2be8b9[_0xba6a('0x32')],_0x2be8b9[_0xba6a('0x2e')]);_0x4d6bab[_0xba6a('0x33')]=_[_0xba6a('0x31')](_0x2be8b9[_0xba6a('0x32')],qs[_0xba6a('0x34')](_0x3a2237[_0xba6a('0x2e')][_0xba6a('0x34')]));_0x4d6bab[_0xba6a('0x33')]=_0x4d6bab[_0xba6a('0x33')][_0xba6a('0x35')]?_0x4d6bab[_0xba6a('0x33')]:_0x2be8b9['model'];if(_0x3a2237['query'][_0xba6a('0x3d')]){_0x4d6bab[_0xba6a('0x3e')]=[{'all':!![]}];}_0x4d6bab=_[_0xba6a('0x3c')]({},_0x4d6bab,_0x3a2237[_0xba6a('0x43')]);return db[_0xba6a('0x28')][_0xba6a('0x44')](_0x4d6bab)[_0xba6a('0x23')](handleEntityNotFound(_0x1f0cb6,null))[_0xba6a('0x23')](respondWithResult(_0x1f0cb6,null))['catch'](handleError(_0x1f0cb6,null));};exports['create']=function(_0x50d436,_0x1a2754){return db['JscriptySessionReport'][_0xba6a('0x45')](_0x50d436[_0xba6a('0x46')],{})[_0xba6a('0x23')](respondWithResult(_0x1a2754,0xc9))['catch'](handleError(_0x1a2754,null));};exports[_0xba6a('0x22')]=function(_0x43350a,_0x36d746){if(_0x43350a[_0xba6a('0x46')]['id']){delete _0x43350a['body']['id'];}return db[_0xba6a('0x28')][_0xba6a('0x44')]({'where':{'id':_0x43350a[_0xba6a('0x42')]['id']}})['then'](handleEntityNotFound(_0x36d746,null))[_0xba6a('0x23')](saveUpdates(_0x43350a[_0xba6a('0x46')],null))['then'](respondWithResult(_0x36d746,null))[_0xba6a('0x47')](handleError(_0x36d746,null));};exports[_0xba6a('0x48')]=function(_0x5f3fdc,_0x24038a){return db[_0xba6a('0x28')][_0xba6a('0x44')]({'where':{'id':_0x5f3fdc['params']['id']}})['then'](handleEntityNotFound(_0x24038a,null))[_0xba6a('0x23')](removeEntity(_0x24038a,null))[_0xba6a('0x47')](handleError(_0x24038a,null));};exports[_0xba6a('0x49')]=function(_0x3dfac1,_0x1c5b2b){return db['JscriptySessionReport'][_0xba6a('0x49')]()[_0xba6a('0x23')](respondWithResult(_0x1c5b2b,null))[_0xba6a('0x47')](handleError(_0x1c5b2b,null));};exports[_0xba6a('0x4a')]=function(_0x53df29,_0x454728,_0x30668d){var _0x5abb99={'raw':!![],'where':{}};var _0x2e419c={};var _0x479ac4={'count':0x0,'rows':[]};return db[_0xba6a('0x28')][_0xba6a('0x4b')]({'where':{'id':_0x53df29['params']['id']}})['then'](handleEntityNotFound(_0x454728,null))[_0xba6a('0x23')](function(_0x16fed8){if(_0x16fed8){_0x2e419c[_0xba6a('0x32')]=_[_0xba6a('0x2f')](db[_0xba6a('0x4c')][_0xba6a('0x29')]);_0x2e419c['query']=_[_0xba6a('0x2f')](_0x53df29[_0xba6a('0x2e')]);_0x2e419c[_0xba6a('0x30')]=_[_0xba6a('0x31')](_0x2e419c[_0xba6a('0x32')],_0x2e419c[_0xba6a('0x2e')]);_0x5abb99[_0xba6a('0x33')]=_[_0xba6a('0x31')](_0x2e419c[_0xba6a('0x32')],qs[_0xba6a('0x34')](_0x53df29[_0xba6a('0x2e')]['fields']));_0x5abb99['attributes']=_0x5abb99[_0xba6a('0x33')][_0xba6a('0x35')]?_0x5abb99[_0xba6a('0x33')]:_0x2e419c['model'];if(!_0x53df29[_0xba6a('0x2e')][_0xba6a('0x4d')](_0xba6a('0x36'))){_0x5abb99[_0xba6a('0x1c')]=qs[_0xba6a('0x1c')](_0x53df29[_0xba6a('0x2e')][_0xba6a('0x1c')]);_0x5abb99[_0xba6a('0x19')]=qs[_0xba6a('0x19')](_0x53df29[_0xba6a('0x2e')][_0xba6a('0x19')]);}_0x5abb99['order']=qs[_0xba6a('0x38')](_0x53df29[_0xba6a('0x2e')][_0xba6a('0x38')]);_0x5abb99['where']=qs[_0xba6a('0x30')](_[_0xba6a('0x3a')](_0x53df29[_0xba6a('0x2e')],_0x2e419c[_0xba6a('0x30')]));_0x5abb99[_0xba6a('0x39')]['SessionId']=_0x16fed8['id'];if(_0x53df29[_0xba6a('0x2e')][_0xba6a('0x3b')]){_0x5abb99[_0xba6a('0x39')]=_[_0xba6a('0x3c')](_0x5abb99[_0xba6a('0x39')],{'$or':_[_0xba6a('0x27')](_0x5abb99[_0xba6a('0x33')],function(_0x3ceb6e){var _0x48f8fd={};_0x48f8fd[_0x3ceb6e]={'$like':'%'+_0x53df29[_0xba6a('0x2e')][_0xba6a('0x3b')]+'%'};return _0x48f8fd;})});}_0x5abb99=_['merge']({},_0x5abb99,_0x53df29[_0xba6a('0x43')]);return db[_0xba6a('0x4c')][_0xba6a('0x1b')]({'where':_0x5abb99[_0xba6a('0x39')]})[_0xba6a('0x23')](function(_0x1294ff){_0x479ac4[_0xba6a('0x1b')]=_0x1294ff;if(_0x53df29[_0xba6a('0x2e')][_0xba6a('0x3d')]){_0x5abb99[_0xba6a('0x3e')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x5abb99);})['then'](function(_0xc64a0e){_0x479ac4[_0xba6a('0x40')]=_0xc64a0e;return _0x479ac4;});}})[_0xba6a('0x23')](respondWithFilteredResult(_0x454728,_0x5abb99))[_0xba6a('0x47')](handleError(_0x454728,null));}; \ No newline at end of file +var _0x8657=['Content-Range','reject','save','update','then','destroy','status','error','stack','name','index','map','JscriptySessionReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','params','include','options','find','create','body','describe','getQuestions','findOne','rawAttributes','sort','SessionId','JscriptyQuestionReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','json','undefined','limit','offset','count','set'];(function(_0x40d8d1,_0x47df01){var _0x582e70=function(_0x5b1457){while(--_0x5b1457){_0x40d8d1['push'](_0x40d8d1['shift']());}};_0x582e70(++_0x47df01);}(_0x8657,0x120));var _0x7865=function(_0x1915c1,_0xd593b){_0x1915c1=_0x1915c1-0x0;var _0x34e636=_0x8657[_0x1915c1];return _0x34e636;};'use strict';var emlformat=require(_0x7865('0x0'));var rimraf=require(_0x7865('0x1'));var zipdir=require(_0x7865('0x2'));var jsonpatch=require(_0x7865('0x3'));var rp=require(_0x7865('0x4'));var moment=require(_0x7865('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7865('0x6'));var util=require(_0x7865('0x7'));var path=require(_0x7865('0x8'));var sox=require(_0x7865('0x9'));var csv=require(_0x7865('0xa'));var ejs=require(_0x7865('0xb'));var fs=require('fs');var fs_extra=require(_0x7865('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7865('0xd'));var jsforce=require(_0x7865('0xe'));var deskjs=require(_0x7865('0xf'));var toCsv=require(_0x7865('0xa'));var querystring=require(_0x7865('0x10'));var Papa=require(_0x7865('0x11'));var Redis=require(_0x7865('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7865('0x13'));var hardwareService=require(_0x7865('0x14'));var logger=require(_0x7865('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x7865('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7865('0x17'))['db'];function respondWithStatusCode(_0x2e2083,_0x55aa72){_0x55aa72=_0x55aa72||0xcc;return function(_0x30d612){if(_0x30d612){return _0x2e2083[_0x7865('0x18')](_0x55aa72);}return _0x2e2083['status'](_0x55aa72)[_0x7865('0x19')]();};}function respondWithResult(_0x2dbe46,_0x4fcb99){_0x4fcb99=_0x4fcb99||0xc8;return function(_0x46b1eb){if(_0x46b1eb){return _0x2dbe46['status'](_0x4fcb99)[_0x7865('0x1a')](_0x46b1eb);}};}function respondWithFilteredResult(_0x4d709b,_0x32587f){return function(_0x43eecf){if(_0x43eecf){var _0x3e3b3b=typeof _0x32587f['offset']===_0x7865('0x1b')&&typeof _0x32587f[_0x7865('0x1c')]===_0x7865('0x1b');var _0x12f026=_0x43eecf['count'];var _0x5a5775=_0x3e3b3b?0x0:_0x32587f[_0x7865('0x1d')];var _0x35d39c=_0x3e3b3b?_0x43eecf[_0x7865('0x1e')]:_0x32587f['offset']+_0x32587f[_0x7865('0x1c')];var _0x1eca5c;if(_0x35d39c>=_0x12f026){_0x35d39c=_0x12f026;_0x1eca5c=0xc8;}else{_0x1eca5c=0xce;}_0x4d709b['status'](_0x1eca5c);return _0x4d709b[_0x7865('0x1f')](_0x7865('0x20'),_0x5a5775+'-'+_0x35d39c+'/'+_0x12f026)[_0x7865('0x1a')](_0x43eecf);}return null;};}function patchUpdates(_0x310231){return function(_0x1b2278){try{jsonpatch['apply'](_0x1b2278,_0x310231,!![]);}catch(_0x35155c){return BPromise[_0x7865('0x21')](_0x35155c);}return _0x1b2278[_0x7865('0x22')]();};}function saveUpdates(_0x225c68,_0xd389b4){return function(_0x3ac371){if(_0x3ac371){return _0x3ac371[_0x7865('0x23')](_0x225c68)[_0x7865('0x24')](function(_0x390c7a){return _0x390c7a;});}return null;};}function removeEntity(_0x334e93,_0x5dad2d){return function(_0x1359eb){if(_0x1359eb){return _0x1359eb[_0x7865('0x25')]()[_0x7865('0x24')](function(){_0x334e93[_0x7865('0x26')](0xcc)[_0x7865('0x19')]();});}};}function handleEntityNotFound(_0x338488,_0x5668a0){return function(_0x58f0ca){if(!_0x58f0ca){_0x338488[_0x7865('0x18')](0x194);}return _0x58f0ca;};}function handleError(_0x3d0441,_0x23405c){_0x23405c=_0x23405c||0x1f4;return function(_0x41dc1d){logger[_0x7865('0x27')](_0x41dc1d[_0x7865('0x28')]);if(_0x41dc1d[_0x7865('0x29')]){delete _0x41dc1d['name'];}_0x3d0441[_0x7865('0x26')](_0x23405c)['send'](_0x41dc1d);};}exports[_0x7865('0x2a')]=function(_0x5e84e1,_0x1b15c0){var _0x1d027c={},_0x1d6483={},_0x562993={'count':0x0,'rows':[]};var _0x118dbd=_[_0x7865('0x2b')](db[_0x7865('0x2c')]['rawAttributes'],function(_0x140d70){return{'name':_0x140d70[_0x7865('0x2d')],'type':_0x140d70[_0x7865('0x2e')][_0x7865('0x2f')]};});_0x1d6483[_0x7865('0x30')]=_[_0x7865('0x2b')](_0x118dbd,'name');_0x1d6483[_0x7865('0x31')]=_[_0x7865('0x32')](_0x5e84e1[_0x7865('0x31')]);_0x1d6483[_0x7865('0x33')]=_[_0x7865('0x34')](_0x1d6483[_0x7865('0x30')],_0x1d6483[_0x7865('0x31')]);_0x1d027c[_0x7865('0x35')]=_[_0x7865('0x34')](_0x1d6483[_0x7865('0x30')],qs['fields'](_0x5e84e1[_0x7865('0x31')][_0x7865('0x36')]));_0x1d027c[_0x7865('0x35')]=_0x1d027c[_0x7865('0x35')][_0x7865('0x37')]?_0x1d027c[_0x7865('0x35')]:_0x1d6483[_0x7865('0x30')];if(!_0x5e84e1[_0x7865('0x31')]['hasOwnProperty'](_0x7865('0x38'))){_0x1d027c[_0x7865('0x1c')]=qs[_0x7865('0x1c')](_0x5e84e1[_0x7865('0x31')][_0x7865('0x1c')]);_0x1d027c[_0x7865('0x1d')]=qs[_0x7865('0x1d')](_0x5e84e1[_0x7865('0x31')][_0x7865('0x1d')]);}_0x1d027c[_0x7865('0x39')]=qs['sort'](_0x5e84e1['query']['sort']);_0x1d027c[_0x7865('0x3a')]=qs[_0x7865('0x33')](_[_0x7865('0x3b')](_0x5e84e1['query'],_0x1d6483[_0x7865('0x33')]),_0x118dbd);if(_0x5e84e1['query'][_0x7865('0x3c')]){_0x1d027c[_0x7865('0x3a')]=_[_0x7865('0x3d')](_0x1d027c[_0x7865('0x3a')],{'$or':_[_0x7865('0x2b')](_0x118dbd,function(_0x577461){if(_0x577461[_0x7865('0x2e')]!==_0x7865('0x3e')){var _0x32d2ec={};_0x32d2ec[_0x577461[_0x7865('0x29')]]={'$like':'%'+_0x5e84e1[_0x7865('0x31')][_0x7865('0x3c')]+'%'};return _0x32d2ec;}})});}_0x1d027c=_[_0x7865('0x3d')]({},_0x1d027c,_0x5e84e1['options']);var _0x45a12c={'where':_0x1d027c[_0x7865('0x3a')]};return db[_0x7865('0x2c')][_0x7865('0x1e')](_0x45a12c)['then'](function(_0x166372){_0x562993[_0x7865('0x1e')]=_0x166372;if(_0x5e84e1[_0x7865('0x31')][_0x7865('0x3f')]){_0x1d027c['include']=[{'all':!![]}];}return db[_0x7865('0x2c')][_0x7865('0x40')](_0x1d027c);})[_0x7865('0x24')](function(_0x12ca28){_0x562993[_0x7865('0x41')]=_0x12ca28;return _0x562993;})[_0x7865('0x24')](respondWithFilteredResult(_0x1b15c0,_0x1d027c))[_0x7865('0x42')](handleError(_0x1b15c0,null));};exports['show']=function(_0xd26ae3,_0x2a4bfa){var _0x1277ed={'raw':!![],'where':{'id':_0xd26ae3[_0x7865('0x43')]['id']}},_0x257c19={};_0x257c19[_0x7865('0x30')]=_['keys'](db[_0x7865('0x2c')]['rawAttributes']);_0x257c19['query']=_['keys'](_0xd26ae3['query']);_0x257c19[_0x7865('0x33')]=_[_0x7865('0x34')](_0x257c19[_0x7865('0x30')],_0x257c19[_0x7865('0x31')]);_0x1277ed['attributes']=_[_0x7865('0x34')](_0x257c19['model'],qs[_0x7865('0x36')](_0xd26ae3[_0x7865('0x31')][_0x7865('0x36')]));_0x1277ed['attributes']=_0x1277ed[_0x7865('0x35')][_0x7865('0x37')]?_0x1277ed[_0x7865('0x35')]:_0x257c19[_0x7865('0x30')];if(_0xd26ae3[_0x7865('0x31')]['includeAll']){_0x1277ed[_0x7865('0x44')]=[{'all':!![]}];}_0x1277ed=_[_0x7865('0x3d')]({},_0x1277ed,_0xd26ae3[_0x7865('0x45')]);return db[_0x7865('0x2c')][_0x7865('0x46')](_0x1277ed)[_0x7865('0x24')](handleEntityNotFound(_0x2a4bfa,null))['then'](respondWithResult(_0x2a4bfa,null))[_0x7865('0x42')](handleError(_0x2a4bfa,null));};exports[_0x7865('0x47')]=function(_0x4404ab,_0x3541f8){return db['JscriptySessionReport'][_0x7865('0x47')](_0x4404ab[_0x7865('0x48')],{})[_0x7865('0x24')](respondWithResult(_0x3541f8,0xc9))[_0x7865('0x42')](handleError(_0x3541f8,null));};exports[_0x7865('0x23')]=function(_0x2d5a20,_0x158417){if(_0x2d5a20[_0x7865('0x48')]['id']){delete _0x2d5a20[_0x7865('0x48')]['id'];}return db[_0x7865('0x2c')]['find']({'where':{'id':_0x2d5a20[_0x7865('0x43')]['id']}})[_0x7865('0x24')](handleEntityNotFound(_0x158417,null))[_0x7865('0x24')](saveUpdates(_0x2d5a20[_0x7865('0x48')],null))[_0x7865('0x24')](respondWithResult(_0x158417,null))[_0x7865('0x42')](handleError(_0x158417,null));};exports[_0x7865('0x25')]=function(_0x2b878a,_0x2177e4){return db[_0x7865('0x2c')][_0x7865('0x46')]({'where':{'id':_0x2b878a[_0x7865('0x43')]['id']}})['then'](handleEntityNotFound(_0x2177e4,null))[_0x7865('0x24')](removeEntity(_0x2177e4,null))['catch'](handleError(_0x2177e4,null));};exports[_0x7865('0x49')]=function(_0x35fff3,_0x1ada7e){return db[_0x7865('0x2c')][_0x7865('0x49')]()[_0x7865('0x24')](respondWithResult(_0x1ada7e,null))['catch'](handleError(_0x1ada7e,null));};exports[_0x7865('0x4a')]=function(_0x50a9fa,_0x42e317,_0x12f683){var _0x351558={'raw':!![],'where':{}};var _0x1333e={};var _0x44eae7={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x7865('0x4b')]({'where':{'id':_0x50a9fa[_0x7865('0x43')]['id']}})['then'](handleEntityNotFound(_0x42e317,null))[_0x7865('0x24')](function(_0x30a680){if(_0x30a680){_0x1333e['model']=_[_0x7865('0x32')](db['JscriptyQuestionReport'][_0x7865('0x4c')]);_0x1333e[_0x7865('0x31')]=_[_0x7865('0x32')](_0x50a9fa['query']);_0x1333e[_0x7865('0x33')]=_[_0x7865('0x34')](_0x1333e[_0x7865('0x30')],_0x1333e[_0x7865('0x31')]);_0x351558[_0x7865('0x35')]=_['intersection'](_0x1333e[_0x7865('0x30')],qs['fields'](_0x50a9fa[_0x7865('0x31')]['fields']));_0x351558[_0x7865('0x35')]=_0x351558['attributes']['length']?_0x351558[_0x7865('0x35')]:_0x1333e[_0x7865('0x30')];if(!_0x50a9fa[_0x7865('0x31')]['hasOwnProperty'](_0x7865('0x38'))){_0x351558[_0x7865('0x1c')]=qs['limit'](_0x50a9fa[_0x7865('0x31')][_0x7865('0x1c')]);_0x351558[_0x7865('0x1d')]=qs[_0x7865('0x1d')](_0x50a9fa[_0x7865('0x31')][_0x7865('0x1d')]);}_0x351558['order']=qs[_0x7865('0x4d')](_0x50a9fa[_0x7865('0x31')][_0x7865('0x4d')]);_0x351558[_0x7865('0x3a')]=qs[_0x7865('0x33')](_[_0x7865('0x3b')](_0x50a9fa['query'],_0x1333e['filters']));_0x351558['where'][_0x7865('0x4e')]=_0x30a680['id'];if(_0x50a9fa['query'][_0x7865('0x3c')]){_0x351558[_0x7865('0x3a')]=_['merge'](_0x351558[_0x7865('0x3a')],{'$or':_[_0x7865('0x2b')](_0x351558[_0x7865('0x35')],function(_0x4be913){var _0x956ec0={};_0x956ec0[_0x4be913]={'$like':'%'+_0x50a9fa[_0x7865('0x31')][_0x7865('0x3c')]+'%'};return _0x956ec0;})});}_0x351558=_[_0x7865('0x3d')]({},_0x351558,_0x50a9fa[_0x7865('0x45')]);return db['JscriptyQuestionReport'][_0x7865('0x1e')]({'where':_0x351558[_0x7865('0x3a')]})[_0x7865('0x24')](function(_0x1b88ca){_0x44eae7[_0x7865('0x1e')]=_0x1b88ca;if(_0x50a9fa[_0x7865('0x31')][_0x7865('0x3f')]){_0x351558['include']=[{'all':!![]}];}return db[_0x7865('0x4f')][_0x7865('0x40')](_0x351558);})[_0x7865('0x24')](function(_0x1dae17){_0x44eae7['rows']=_0x1dae17;return _0x44eae7;});}})[_0x7865('0x24')](respondWithFilteredResult(_0x42e317,_0x351558))[_0x7865('0x42')](handleError(_0x42e317,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index a601ac5..31d16b2 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 _0xaa3f=['rimraf','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4c22cc,_0x251317){var _0x312e1d=function(_0x2cd973){while(--_0x2cd973){_0x4c22cc['push'](_0x4c22cc['shift']());}};_0x312e1d(++_0x251317);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x698446,_0x5d9fd0){_0x698446=_0x698446-0x0;var _0x70a82b=_0xaa3f[_0x698446];return _0x70a82b;};'use strict';var _=require(_0xfaa3('0x0'));var util=require(_0xfaa3('0x1'));var logger=require(_0xfaa3('0x2'))(_0xfaa3('0x3'));var moment=require(_0xfaa3('0x4'));var BPromise=require(_0xfaa3('0x5'));var rp=require(_0xfaa3('0x6'));var fs=require('fs');var path=require(_0xfaa3('0x7'));var rimraf=require(_0xfaa3('0x8'));var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module[_0xfaa3('0x9')]=function(_0x4bac92,_0x3d09aa){return _0x4bac92[_0xfaa3('0xa')](_0xfaa3('0xb'),attributes,{'tableName':_0xfaa3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ee1=['report_jscripty_sessions','lodash','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define'];(function(_0xf1074e,_0x3b3c43){var _0x43ae47=function(_0x19f9de){while(--_0x19f9de){_0xf1074e['push'](_0xf1074e['shift']());}};_0x43ae47(++_0x3b3c43);}(_0x7ee1,0x8d));var _0x17ee=function(_0x16cf74,_0x2d75ef){_0x16cf74=_0x16cf74-0x0;var _0x31008a=_0x7ee1[_0x16cf74];return _0x31008a;};'use strict';var _=require(_0x17ee('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x17ee('0x1'));var BPromise=require(_0x17ee('0x2'));var rp=require(_0x17ee('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x17ee('0x4'));var config=require(_0x17ee('0x5'));var attributes=require(_0x17ee('0x6'));module[_0x17ee('0x7')]=function(_0x5c0617,_0x52b1db){return _0x5c0617[_0x17ee('0x8')]('JscriptySessionReport',attributes,{'tableName':_0x17ee('0x9'),'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 88a3f58..374ef18 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 _0x1623=['../../config/utils','../../config/environment','client','http','request','then','info','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','JscriptySessionReport,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4228f7,_0x4d3c91){var _0x2c5b0a=function(_0x1e600c){while(--_0x1e600c){_0x4228f7['push'](_0x4228f7['shift']());}};_0x2c5b0a(++_0x4d3c91);}(_0x1623,0xab));var _0x3162=function(_0x15d6aa,_0x45371d){_0x15d6aa=_0x15d6aa-0x0;var _0x3f44e3=_0x1623[_0x15d6aa];return _0x3f44e3;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3162('0x1'));var rs=require(_0x3162('0x2'));var fs=require('fs');var Redis=require(_0x3162('0x3'));var db=require(_0x3162('0x4'))['db'];var utils=require(_0x3162('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3162('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3162('0x7')][_0x3162('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53260d,_0xffe9b6,_0x2dc07e){return new BPromise(function(_0x26ee32,_0x36609e){return client[_0x3162('0x9')](_0x53260d,_0x2dc07e)[_0x3162('0xa')](function(_0xe43099){logger[_0x3162('0xb')]('JscriptySessionReport,\x20%s,\x20%s',_0xffe9b6,'request\x20sent');logger[_0x3162('0xc')](_0x3162('0xd'),_0xffe9b6,_0x3162('0xe'),JSON[_0x3162('0xf')](_0xe43099));if(_0xe43099[_0x3162('0x10')]){if(_0xe43099[_0x3162('0x10')][_0x3162('0x11')]===0x1f4){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x36609e(_0xe43099['error'][_0x3162('0x13')]);}logger[_0x3162('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x26ee32(_0xe43099[_0x3162('0x10')][_0x3162('0x13')]);}else{logger['info'](_0x3162('0x12'),_0xffe9b6,_0x3162('0xe'));_0x26ee32(_0xe43099[_0x3162('0x14')]['message']);}})[_0x3162('0x15')](function(_0x42cf7d){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0x42cf7d);_0x36609e(_0x42cf7d);});});} \ No newline at end of file +var _0x5430=['ioredis','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','JscriptySessionReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5430,0x10c));var _0x0543=function(_0x1b3ae5,_0xe33dc2){_0x1b3ae5=_0x1b3ae5-0x0;var _0x5dd2c1=_0x5430[_0x1b3ae5];return _0x5dd2c1;};'use strict';var _=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var moment=require(_0x0543('0x2'));var BPromise=require(_0x0543('0x3'));var rs=require(_0x0543('0x4'));var fs=require('fs');var Redis=require(_0x0543('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0543('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0543('0x7'));var client=jayson[_0x0543('0x8')][_0x0543('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x319568,_0x46bca7,_0x5ac352){return new BPromise(function(_0x372974,_0x7b8280){return client[_0x0543('0xa')](_0x319568,_0x5ac352)[_0x0543('0xb')](function(_0x2fb723){logger[_0x0543('0xc')]('JscriptySessionReport,\x20%s,\x20%s',_0x46bca7,_0x0543('0xd'));logger[_0x0543('0xe')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x46bca7,_0x0543('0xd'),JSON[_0x0543('0xf')](_0x2fb723));if(_0x2fb723[_0x0543('0x10')]){if(_0x2fb723[_0x0543('0x10')][_0x0543('0x11')]===0x1f4){logger[_0x0543('0x10')](_0x0543('0x12'),_0x46bca7,_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);return _0x7b8280(_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);}logger[_0x0543('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0x46bca7,_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);return _0x372974(_0x2fb723['error']['message']);}else{logger[_0x0543('0xc')](_0x0543('0x12'),_0x46bca7,_0x0543('0xd'));_0x372974(_0x2fb723[_0x0543('0x14')][_0x0543('0x13')]);}})['catch'](function(_0xe69a3d){logger[_0x0543('0x10')](_0x0543('0x12'),_0x46bca7,_0xe69a3d);_0x7b8280(_0xe69a3d);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index dd15447..9c51ad4 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 _0x64a1=['path','Router','fs-extra','../../components/auth/service','../../config/environment','./license.controller','get','index','/:id','isAuthenticated','update','/download_log_file','downloadLogFile','exports','multer','util'];(function(_0x4a9bc8,_0x36b0a3){var _0x4e4fd8=function(_0x1ea06f){while(--_0x1ea06f){_0x4a9bc8['push'](_0x4a9bc8['shift']());}};_0x4e4fd8(++_0x36b0a3);}(_0x64a1,0x13e));var _0x164a=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x64a1[_0x29d915];return _0x160f86;};'use strict';var multer=require(_0x164a('0x0'));var util=require(_0x164a('0x1'));var path=require(_0x164a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x164a('0x3')]();var fs_extra=require(_0x164a('0x4'));var auth=require(_0x164a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x164a('0x6'));var controller=require(_0x164a('0x7'));router[_0x164a('0x8')]('/',controller[_0x164a('0x9')]);router['put'](_0x164a('0xa'),auth[_0x164a('0xb')](),controller[_0x164a('0xc')]);router[_0x164a('0x8')](_0x164a('0xd'),auth['isAuthenticated'](),controller[_0x164a('0xe')]);module[_0x164a('0xf')]=router; \ No newline at end of file +var _0x389b=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index','put','/:id','isAuthenticated','update','multer','path'];(function(_0x4b6e02,_0x195824){var _0x20099a=function(_0x28fde6){while(--_0x28fde6){_0x4b6e02['push'](_0x4b6e02['shift']());}};_0x20099a(++_0x195824);}(_0x389b,0xae));var _0xb389=function(_0x1b81ae,_0x1941f7){_0x1b81ae=_0x1b81ae-0x0;var _0x33ba48=_0x389b[_0x1b81ae];return _0x33ba48;};'use strict';var multer=require(_0xb389('0x0'));var util=require('util');var path=require(_0xb389('0x1'));var timeout=require(_0xb389('0x2'));var express=require(_0xb389('0x3'));var router=express[_0xb389('0x4')]();var fs_extra=require(_0xb389('0x5'));var auth=require(_0xb389('0x6'));var interaction=require(_0xb389('0x7'));var config=require(_0xb389('0x8'));var controller=require(_0xb389('0x9'));router[_0xb389('0xa')]('/',controller[_0xb389('0xb')]);router[_0xb389('0xc')](_0xb389('0xd'),auth[_0xb389('0xe')](),controller[_0xb389('0xf')]);router[_0xb389('0xa')]('/download_log_file',auth[_0xb389('0xe')](),controller['downloadLogFile']);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 914a140..49478d5 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 _0x1af2=['STRING','INTEGER','exports'];(function(_0x2d2f1a,_0x57b966){var _0x55d9db=function(_0x15771f){while(--_0x15771f){_0x2d2f1a['push'](_0x2d2f1a['shift']());}};_0x55d9db(++_0x57b966);}(_0x1af2,0x15b));var _0x21af=function(_0x4e29f1,_0x3da155){_0x4e29f1=_0x4e29f1-0x0;var _0x4bc72f=_0x1af2[_0x4e29f1];return _0x4bc72f;};'use strict';var Sequelize=require('sequelize');module[_0x21af('0x0')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x21af('0x1')]},'data2':{'type':Sequelize[_0x21af('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0x21af('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd980=['STRING','INTEGER','exports','TEXT'];(function(_0x4283c8,_0x10f507){var _0x5baece=function(_0x48045d){while(--_0x48045d){_0x4283c8['push'](_0x4283c8['shift']());}};_0x5baece(++_0x10f507);}(_0xd980,0x86));var _0x0d98=function(_0x59c9d6,_0x1cd5c1){_0x59c9d6=_0x59c9d6-0x0;var _0x3a7885=_0xd980[_0x59c9d6];return _0x3a7885;};'use strict';var Sequelize=require('sequelize');module[_0x0d98('0x0')]={'license':{'type':Sequelize[_0x0d98('0x1')]},'data1':{'type':Sequelize[_0x0d98('0x2')]},'data2':{'type':Sequelize[_0x0d98('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x0d98('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index aa16226..98e4b98 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 _0xbc5c=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','../../config/license/util','index','model','keys','License','rawAttributes','query','filters','intersection','attributes','fields','length','merge','options','catch','update','body','find','params','get','key','downloadLogFile','license-info.log','join','/var','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','rimraf'];(function(_0x2158a6,_0x11993c){var _0x4da6ed=function(_0xadf211){while(--_0xadf211){_0x2158a6['push'](_0x2158a6['shift']());}};_0x4da6ed(++_0x11993c);}(_0xbc5c,0x97));var _0xcbc5=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xbc5c[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcbc5('0x0'));var zipdir=require(_0xcbc5('0x1'));var jsonpatch=require(_0xcbc5('0x2'));var rp=require(_0xcbc5('0x3'));var moment=require(_0xcbc5('0x4'));var BPromise=require(_0xcbc5('0x5'));var Mustache=require(_0xcbc5('0x6'));var util=require(_0xcbc5('0x7'));var path=require(_0xcbc5('0x8'));var sox=require(_0xcbc5('0x9'));var csv=require(_0xcbc5('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcbc5('0xb'));var _=require(_0xcbc5('0xc'));var squel=require(_0xcbc5('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcbc5('0xa'));var querystring=require(_0xcbc5('0xe'));var Papa=require(_0xcbc5('0xf'));var Redis=require(_0xcbc5('0x10'));var authService=require(_0xcbc5('0x11'));var qs=require(_0xcbc5('0x12'));var as=require(_0xcbc5('0x13'));var hardwareService=require(_0xcbc5('0x14'));var logger=require(_0xcbc5('0x15'))(_0xcbc5('0x16'));var utils=require(_0xcbc5('0x17'));var config=require(_0xcbc5('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xcbc5('0x19'))['db'];function respondWithStatusCode(_0x1185b8,_0x10904f){_0x10904f=_0x10904f||0xcc;return function(_0x135fee){if(_0x135fee){return _0x1185b8['sendStatus'](_0x10904f);}return _0x1185b8[_0xcbc5('0x1a')](_0x10904f)[_0xcbc5('0x1b')]();};}function respondWithResult(_0x2d5329,_0x508f84){_0x508f84=_0x508f84||0xc8;return function(_0x155b0a){if(_0x155b0a){return _0x2d5329[_0xcbc5('0x1a')](_0x508f84)[_0xcbc5('0x1c')](_0x155b0a);}};}function respondWithFilteredResult(_0x1e6979,_0x3eaa11){return function(_0x36a46a){if(_0x36a46a){var _0x332a13=typeof _0x3eaa11[_0xcbc5('0x1d')]===_0xcbc5('0x1e')&&typeof _0x3eaa11[_0xcbc5('0x1f')]===_0xcbc5('0x1e');var _0x25c3c5=_0x36a46a[_0xcbc5('0x20')];var _0x2a5e0b=_0x332a13?0x0:_0x3eaa11[_0xcbc5('0x1d')];var _0xa42773=_0x332a13?_0x36a46a[_0xcbc5('0x20')]:_0x3eaa11[_0xcbc5('0x1d')]+_0x3eaa11[_0xcbc5('0x1f')];var _0x384bac;if(_0xa42773>=_0x25c3c5){_0xa42773=_0x25c3c5;_0x384bac=0xc8;}else{_0x384bac=0xce;}_0x1e6979['status'](_0x384bac);return _0x1e6979['set'](_0xcbc5('0x21'),_0x2a5e0b+'-'+_0xa42773+'/'+_0x25c3c5)['json'](_0x36a46a);}return null;};}function patchUpdates(_0x25ce24){return function(_0x264988){try{jsonpatch[_0xcbc5('0x22')](_0x264988,_0x25ce24,!![]);}catch(_0x25b512){return BPromise[_0xcbc5('0x23')](_0x25b512);}return _0x264988[_0xcbc5('0x24')]();};}function saveUpdates(_0x5d2f2d,_0xa60f3d){return function(_0x4436ac){if(_0x4436ac){return _0x4436ac['update'](_0x5d2f2d)[_0xcbc5('0x25')](function(_0x55d3bb){return _0x55d3bb;});}return null;};}function removeEntity(_0x439389,_0x331fa5){return function(_0x3b98bf){if(_0x3b98bf){return _0x3b98bf[_0xcbc5('0x26')]()[_0xcbc5('0x25')](function(){_0x439389[_0xcbc5('0x1a')](0xcc)[_0xcbc5('0x1b')]();});}};}function handleEntityNotFound(_0x13d154,_0x161471){return function(_0xf85acc){if(!_0xf85acc){_0x13d154[_0xcbc5('0x27')](0x194);}return _0xf85acc;};}function handleError(_0x2188d2,_0x126a85){_0x126a85=_0x126a85||0x1f4;return function(_0xebf1cb){logger[_0xcbc5('0x28')](_0xebf1cb[_0xcbc5('0x29')]);if(_0xebf1cb[_0xcbc5('0x2a')]){delete _0xebf1cb[_0xcbc5('0x2a')];}_0x2188d2['status'](_0x126a85)[_0xcbc5('0x2b')](_0xebf1cb);};}var utilLicense=require(_0xcbc5('0x2c'));exports[_0xcbc5('0x2d')]=function(_0xf5b117,_0x414d28){var _0x146ec9={'raw':!![],'where':{'id':0x1}},_0x1621fd={};_0x1621fd[_0xcbc5('0x2e')]=_[_0xcbc5('0x2f')](db[_0xcbc5('0x30')][_0xcbc5('0x31')]);_0x1621fd[_0xcbc5('0x32')]=_[_0xcbc5('0x2f')](_0xf5b117[_0xcbc5('0x32')]);_0x1621fd[_0xcbc5('0x33')]=_[_0xcbc5('0x34')](_0x1621fd[_0xcbc5('0x2e')],_0x1621fd['query']);_0x146ec9[_0xcbc5('0x35')]=_[_0xcbc5('0x34')](_0x1621fd['model'],qs[_0xcbc5('0x36')](_0xf5b117[_0xcbc5('0x32')][_0xcbc5('0x36')]));_0x146ec9['attributes']=_0x146ec9['attributes'][_0xcbc5('0x37')]?_0x146ec9[_0xcbc5('0x35')]:_0x1621fd['model'];_0x146ec9=_[_0xcbc5('0x38')]({},_0x146ec9,_0xf5b117[_0xcbc5('0x39')]);return utilLicense['getLicense'](_0x146ec9)[_0xcbc5('0x25')](respondWithResult(_0x414d28,null))[_0xcbc5('0x3a')](handleError(_0x414d28,null));};exports[_0xcbc5('0x3b')]=function(_0x3ab86e,_0x121ce4){if(_0x3ab86e[_0xcbc5('0x3c')]['id']){delete _0x3ab86e[_0xcbc5('0x3c')]['id'];}return db[_0xcbc5('0x30')][_0xcbc5('0x3d')]({'where':{'id':_0x3ab86e[_0xcbc5('0x3e')]['id']}})[_0xcbc5('0x25')](handleEntityNotFound(_0x121ce4,null))[_0xcbc5('0x25')](function(_0x3d955a){var _0x48556b=_0x3d955a[_0xcbc5('0x3f')]({'plain':!![]});return utilLicense['checkLicense'](_0x48556b,_0x3ab86e[_0xcbc5('0x3c')][_0xcbc5('0x40')]);})[_0xcbc5('0x25')](function(_0x1e523b){if(!_0x1e523b['demo']){return saveUpdates(_0x3ab86e[_0xcbc5('0x3c')],null);}return _0x1e523b;})[_0xcbc5('0x25')](respondWithResult(_0x121ce4,null))[_0xcbc5('0x3a')](handleError(_0x121ce4,null));};exports[_0xcbc5('0x41')]=function(_0x4c4ed4,_0x18a3d1){var _0x2e70e0=_0xcbc5('0x42');var _0x548721=path[_0xcbc5('0x43')](_0xcbc5('0x44'),'log',_0xcbc5('0x45'),_0x2e70e0);_0x18a3d1[_0xcbc5('0x46')](_0xcbc5('0x47'),_0xcbc5('0x48')+_0x2e70e0);_0x18a3d1['set'](_0xcbc5('0x49'),_0xcbc5('0x4a'));_0x18a3d1[_0xcbc5('0x4b')](_0x548721);}; \ No newline at end of file +var _0xd2e7=['json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','model','keys','License','query','filters','attributes','intersection','fields','length','merge','options','getLicense','catch','body','find','params','checkLicense','key','demo','license-info.log','join','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end'];(function(_0x2ba00c,_0x182642){var _0x21712b=function(_0x1bcf8e){while(--_0x1bcf8e){_0x2ba00c['push'](_0x2ba00c['shift']());}};_0x21712b(++_0x182642);}(_0xd2e7,0x1a0));var _0x7d2e=function(_0x10497f,_0x83332a){_0x10497f=_0x10497f-0x0;var _0x381690=_0xd2e7[_0x10497f];return _0x381690;};'use strict';var emlformat=require(_0x7d2e('0x0'));var rimraf=require(_0x7d2e('0x1'));var zipdir=require(_0x7d2e('0x2'));var jsonpatch=require(_0x7d2e('0x3'));var rp=require(_0x7d2e('0x4'));var moment=require(_0x7d2e('0x5'));var BPromise=require(_0x7d2e('0x6'));var Mustache=require(_0x7d2e('0x7'));var util=require('util');var path=require(_0x7d2e('0x8'));var sox=require(_0x7d2e('0x9'));var csv=require(_0x7d2e('0xa'));var ejs=require(_0x7d2e('0xb'));var fs=require('fs');var fs_extra=require(_0x7d2e('0xc'));var _=require(_0x7d2e('0xd'));var squel=require(_0x7d2e('0xe'));var crypto=require(_0x7d2e('0xf'));var jsforce=require(_0x7d2e('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x7d2e('0xa'));var querystring=require(_0x7d2e('0x11'));var Papa=require('papaparse');var Redis=require(_0x7d2e('0x12'));var authService=require(_0x7d2e('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7d2e('0x14'));var logger=require(_0x7d2e('0x15'))(_0x7d2e('0x16'));var utils=require(_0x7d2e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x7d2e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2da298,_0x2bcc00){_0x2bcc00=_0x2bcc00||0xcc;return function(_0x16f532){if(_0x16f532){return _0x2da298[_0x7d2e('0x19')](_0x2bcc00);}return _0x2da298[_0x7d2e('0x1a')](_0x2bcc00)[_0x7d2e('0x1b')]();};}function respondWithResult(_0x47b409,_0x8fcaf4){_0x8fcaf4=_0x8fcaf4||0xc8;return function(_0x909172){if(_0x909172){return _0x47b409[_0x7d2e('0x1a')](_0x8fcaf4)[_0x7d2e('0x1c')](_0x909172);}};}function respondWithFilteredResult(_0x7ca293,_0x400b0b){return function(_0x2413e3){if(_0x2413e3){var _0x6b1d00=typeof _0x400b0b[_0x7d2e('0x1d')]==='undefined'&&typeof _0x400b0b[_0x7d2e('0x1e')]===_0x7d2e('0x1f');var _0x157274=_0x2413e3[_0x7d2e('0x20')];var _0x3e69cf=_0x6b1d00?0x0:_0x400b0b[_0x7d2e('0x1d')];var _0xde67c8=_0x6b1d00?_0x2413e3[_0x7d2e('0x20')]:_0x400b0b[_0x7d2e('0x1d')]+_0x400b0b[_0x7d2e('0x1e')];var _0x511d6c;if(_0xde67c8>=_0x157274){_0xde67c8=_0x157274;_0x511d6c=0xc8;}else{_0x511d6c=0xce;}_0x7ca293[_0x7d2e('0x1a')](_0x511d6c);return _0x7ca293[_0x7d2e('0x21')](_0x7d2e('0x22'),_0x3e69cf+'-'+_0xde67c8+'/'+_0x157274)[_0x7d2e('0x1c')](_0x2413e3);}return null;};}function patchUpdates(_0x4f3aed){return function(_0x8119fa){try{jsonpatch['apply'](_0x8119fa,_0x4f3aed,!![]);}catch(_0x41ebda){return BPromise[_0x7d2e('0x23')](_0x41ebda);}return _0x8119fa['save']();};}function saveUpdates(_0x3c46a6,_0x11c104){return function(_0x52fb24){if(_0x52fb24){return _0x52fb24[_0x7d2e('0x24')](_0x3c46a6)[_0x7d2e('0x25')](function(_0x5efcdc){return _0x5efcdc;});}return null;};}function removeEntity(_0x1c069c,_0x2853ca){return function(_0x11eca0){if(_0x11eca0){return _0x11eca0[_0x7d2e('0x26')]()[_0x7d2e('0x25')](function(){_0x1c069c['status'](0xcc)[_0x7d2e('0x1b')]();});}};}function handleEntityNotFound(_0x45c23f,_0x32eafe){return function(_0x2b2a5c){if(!_0x2b2a5c){_0x45c23f[_0x7d2e('0x19')](0x194);}return _0x2b2a5c;};}function handleError(_0x365142,_0xcf4ed2){_0xcf4ed2=_0xcf4ed2||0x1f4;return function(_0x127920){logger[_0x7d2e('0x27')](_0x127920[_0x7d2e('0x28')]);if(_0x127920[_0x7d2e('0x29')]){delete _0x127920['name'];}_0x365142[_0x7d2e('0x1a')](_0xcf4ed2)[_0x7d2e('0x2a')](_0x127920);};}var utilLicense=require(_0x7d2e('0x18'));exports[_0x7d2e('0x2b')]=function(_0x648323,_0x73c22f){var _0x1299f7={'raw':!![],'where':{'id':0x1}},_0x3a958b={};_0x3a958b[_0x7d2e('0x2c')]=_[_0x7d2e('0x2d')](db[_0x7d2e('0x2e')]['rawAttributes']);_0x3a958b[_0x7d2e('0x2f')]=_[_0x7d2e('0x2d')](_0x648323[_0x7d2e('0x2f')]);_0x3a958b[_0x7d2e('0x30')]=_['intersection'](_0x3a958b[_0x7d2e('0x2c')],_0x3a958b[_0x7d2e('0x2f')]);_0x1299f7[_0x7d2e('0x31')]=_[_0x7d2e('0x32')](_0x3a958b['model'],qs['fields'](_0x648323['query'][_0x7d2e('0x33')]));_0x1299f7[_0x7d2e('0x31')]=_0x1299f7[_0x7d2e('0x31')][_0x7d2e('0x34')]?_0x1299f7['attributes']:_0x3a958b['model'];_0x1299f7=_[_0x7d2e('0x35')]({},_0x1299f7,_0x648323[_0x7d2e('0x36')]);return utilLicense[_0x7d2e('0x37')](_0x1299f7)[_0x7d2e('0x25')](respondWithResult(_0x73c22f,null))[_0x7d2e('0x38')](handleError(_0x73c22f,null));};exports['update']=function(_0x124457,_0x30aad9){if(_0x124457['body']['id']){delete _0x124457[_0x7d2e('0x39')]['id'];}return db[_0x7d2e('0x2e')][_0x7d2e('0x3a')]({'where':{'id':_0x124457[_0x7d2e('0x3b')]['id']}})[_0x7d2e('0x25')](handleEntityNotFound(_0x30aad9,null))[_0x7d2e('0x25')](function(_0x25eca1){var _0x2c76f1=_0x25eca1['get']({'plain':!![]});return utilLicense[_0x7d2e('0x3c')](_0x2c76f1,_0x124457[_0x7d2e('0x39')][_0x7d2e('0x3d')]);})[_0x7d2e('0x25')](function(_0x30238b){if(!_0x30238b[_0x7d2e('0x3e')]){return saveUpdates(_0x124457['body'],null);}return _0x30238b;})[_0x7d2e('0x25')](respondWithResult(_0x30aad9,null))[_0x7d2e('0x38')](handleError(_0x30aad9,null));};exports['downloadLogFile']=function(_0x166a15,_0x2f3c7a){var _0x115097=_0x7d2e('0x3f');var _0x3b5001=path[_0x7d2e('0x40')](_0x7d2e('0x41'),_0x7d2e('0x42'),_0x7d2e('0x43'),_0x115097);_0x2f3c7a[_0x7d2e('0x44')](_0x7d2e('0x45'),_0x7d2e('0x46')+_0x115097);_0x2f3c7a[_0x7d2e('0x21')](_0x7d2e('0x47'),_0x7d2e('0x48'));_0x2f3c7a[_0x7d2e('0x49')](_0x3b5001);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 5045ddc..25d4bf1 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 _0x2087=['license','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','exports','License'];(function(_0xff2c6d,_0x13d022){var _0x34354d=function(_0x1bdaa2){while(--_0x1bdaa2){_0xff2c6d['push'](_0xff2c6d['shift']());}};_0x34354d(++_0x13d022);}(_0x2087,0xf3));var _0x7208=function(_0x15b52d,_0x1ce25a){_0x15b52d=_0x15b52d-0x0;var _0x1fdd32=_0x2087[_0x15b52d];return _0x1fdd32;};'use strict';var _=require(_0x7208('0x0'));var util=require(_0x7208('0x1'));var logger=require(_0x7208('0x2'))(_0x7208('0x3'));var moment=require('moment');var BPromise=require(_0x7208('0x4'));var rp=require(_0x7208('0x5'));var fs=require('fs');var path=require(_0x7208('0x6'));var rimraf=require(_0x7208('0x7'));var config=require('../../config/environment');var attributes=require('./license.attributes');module[_0x7208('0x8')]=function(_0x5cc93f,_0x3c7d9d){return _0x5cc93f['define'](_0x7208('0x9'),attributes,{'tableName':_0x7208('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x56a0=['lodash','api','moment','bluebird','path','rimraf','./license.attributes','License'];(function(_0x229c22,_0x183240){var _0x4844c3=function(_0x543be9){while(--_0x543be9){_0x229c22['push'](_0x229c22['shift']());}};_0x4844c3(++_0x183240);}(_0x56a0,0x1d0));var _0x056a=function(_0x5f170f,_0x553d8e){_0x5f170f=_0x5f170f-0x0;var _0x2419de=_0x56a0[_0x5f170f];return _0x2419de;};'use strict';var _=require(_0x056a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x056a('0x1'));var moment=require(_0x056a('0x2'));var BPromise=require(_0x056a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x056a('0x4'));var rimraf=require(_0x056a('0x5'));var config=require('../../config/environment');var attributes=require(_0x056a('0x6'));module['exports']=function(_0x1ec3f0,_0x27d9a9){return _0x1ec3f0['define'](_0x056a('0x7'),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 73e116e..5b96a91 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 _0x66bf=['bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','util','moment'];(function(_0x1f3a5f,_0x325a27){var _0x4e2a1e=function(_0x1532b5){while(--_0x1532b5){_0x1f3a5f['push'](_0x1f3a5f['shift']());}};_0x4e2a1e(++_0x325a27);}(_0x66bf,0xa5));var _0xf66b=function(_0x34b368,_0x10c15f){_0x34b368=_0x34b368-0x0;var _0x22daf6=_0x66bf[_0x34b368];return _0x22daf6;};'use strict';var _=require(_0xf66b('0x0'));var util=require(_0xf66b('0x1'));var moment=require(_0xf66b('0x2'));var BPromise=require(_0xf66b('0x3'));var rs=require(_0xf66b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf66b('0x5'));var logger=require(_0xf66b('0x6'))('rpc');var config=require(_0xf66b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf66b('0x8')][_0xf66b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37590e,_0x187530,_0xd737ef){return new BPromise(function(_0x334cc4,_0x447dab){return client[_0xf66b('0xa')](_0x37590e,_0xd737ef)[_0xf66b('0xb')](function(_0x146e34){logger['info'](_0xf66b('0xc'),_0x187530,_0xf66b('0xd'));logger[_0xf66b('0xe')](_0xf66b('0xf'),_0x187530,_0xf66b('0xd'),JSON[_0xf66b('0x10')](_0x146e34));if(_0x146e34[_0xf66b('0x11')]){if(_0x146e34[_0xf66b('0x11')][_0xf66b('0x12')]===0x1f4){logger[_0xf66b('0x11')]('License,\x20%s,\x20%s',_0x187530,_0x146e34[_0xf66b('0x11')][_0xf66b('0x13')]);return _0x447dab(_0x146e34[_0xf66b('0x11')][_0xf66b('0x13')]);}logger[_0xf66b('0x11')](_0xf66b('0xc'),_0x187530,_0x146e34[_0xf66b('0x11')][_0xf66b('0x13')]);return _0x334cc4(_0x146e34[_0xf66b('0x11')][_0xf66b('0x13')]);}else{logger[_0xf66b('0x14')](_0xf66b('0xc'),_0x187530,_0xf66b('0xd'));_0x334cc4(_0x146e34['result'][_0xf66b('0x13')]);}})['catch'](function(_0x5570eb){logger[_0xf66b('0x11')](_0xf66b('0xc'),_0x187530,_0x5570eb);_0x447dab(_0x5570eb);});});} \ No newline at end of file +var _0x2446=['message','request\x20sent','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','License,\x20%s,\x20%s','License,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x2446,0x179));var _0x6244=function(_0x36f4f1,_0x4e7e43){_0x36f4f1=_0x36f4f1-0x0;var _0x3a6775=_0x2446[_0x36f4f1];return _0x3a6775;};'use strict';var _=require(_0x6244('0x0'));var util=require(_0x6244('0x1'));var moment=require(_0x6244('0x2'));var BPromise=require(_0x6244('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6244('0x4'));var db=require(_0x6244('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6244('0x6'))(_0x6244('0x7'));var config=require(_0x6244('0x8'));var jayson=require(_0x6244('0x9'));var client=jayson['client'][_0x6244('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34eb5b,_0x34e503,_0x5ad08d){return new BPromise(function(_0x3f023b,_0x14b389){return client[_0x6244('0xb')](_0x34eb5b,_0x5ad08d)[_0x6244('0xc')](function(_0x120207){logger[_0x6244('0xd')](_0x6244('0xe'),_0x34e503,'request\x20sent');logger['debug'](_0x6244('0xf'),_0x34e503,'request\x20sent',JSON[_0x6244('0x10')](_0x120207));if(_0x120207['error']){if(_0x120207[_0x6244('0x11')][_0x6244('0x12')]===0x1f4){logger[_0x6244('0x11')](_0x6244('0xe'),_0x34e503,_0x120207['error'][_0x6244('0x13')]);return _0x14b389(_0x120207[_0x6244('0x11')][_0x6244('0x13')]);}logger['error'](_0x6244('0xe'),_0x34e503,_0x120207[_0x6244('0x11')][_0x6244('0x13')]);return _0x3f023b(_0x120207[_0x6244('0x11')]['message']);}else{logger[_0x6244('0xd')](_0x6244('0xe'),_0x34e503,_0x6244('0x14'));_0x3f023b(_0x120207[_0x6244('0x15')][_0x6244('0x13')]);}})['catch'](function(_0x408ca0){logger['error'](_0x6244('0xe'),_0x34e503,_0x408ca0);_0x14b389(_0x408ca0);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 5fa5681..b12e8de 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 _0x27f0=['../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','post','addAnswer','create','addImap','addInteraction','/:id/applications','send','/:id/users','addAgents','put','/:id','update','removeDispositions','delete','removeAnswers','/:id/in_servers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x30b057,_0x1d1505){var _0x331671=function(_0x30bcdf){while(--_0x30bcdf){_0x30b057['push'](_0x30b057['shift']());}};_0x331671(++_0x1d1505);}(_0x27f0,0x1f4));var _0x027f=function(_0x138507,_0x4a0d4d){_0x138507=_0x138507-0x0;var _0x5bca11=_0x27f0[_0x138507];return _0x5bca11;};'use strict';var multer=require(_0x027f('0x0'));var util=require(_0x027f('0x1'));var path=require('path');var timeout=require(_0x027f('0x2'));var express=require('express');var router=express[_0x027f('0x3')]();var fs_extra=require(_0x027f('0x4'));var auth=require(_0x027f('0x5'));var interaction=require(_0x027f('0x6'));var config=require('../../config/environment');var controller=require('./mailAccount.controller');router[_0x027f('0x7')]('/',auth[_0x027f('0x8')](),controller['index']);router['get'](_0x027f('0x9'),auth[_0x027f('0x8')](),controller[_0x027f('0xa')]);router[_0x027f('0x7')]('/:id',auth[_0x027f('0x8')](),controller['show']);router['get'](_0x027f('0xb'),auth['isAuthenticated'](),controller[_0x027f('0xc')]);router[_0x027f('0x7')](_0x027f('0xd'),auth[_0x027f('0x8')](),controller[_0x027f('0xe')]);router[_0x027f('0x7')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0x027f('0xf')]);router[_0x027f('0x7')](_0x027f('0x10'),auth[_0x027f('0x8')](),controller[_0x027f('0x11')]);router[_0x027f('0x7')](_0x027f('0x12'),auth[_0x027f('0x8')](),controller[_0x027f('0x13')]);router[_0x027f('0x7')]('/:id/applications',auth[_0x027f('0x8')](),controller[_0x027f('0x14')]);router[_0x027f('0x7')](_0x027f('0x15'),auth[_0x027f('0x8')](),controller[_0x027f('0x16')]);router['get'](_0x027f('0x17'),auth[_0x027f('0x8')](),controller[_0x027f('0x18')]);router[_0x027f('0x7')]('/:id/users',auth[_0x027f('0x8')](),controller['getAgents']);router[_0x027f('0x19')](_0x027f('0xb'),auth[_0x027f('0x8')](),controller['addDisposition']);router['post'](_0x027f('0xd'),auth[_0x027f('0x8')](),controller[_0x027f('0x1a')]);router[_0x027f('0x19')]('/',auth[_0x027f('0x8')](),controller[_0x027f('0x1b')]);router[_0x027f('0x19')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0x027f('0x1c')]);router[_0x027f('0x19')](_0x027f('0x10'),auth[_0x027f('0x8')](),controller['addSmtp']);router[_0x027f('0x19')](_0x027f('0x12'),auth['isAuthenticated'](),controller[_0x027f('0x1d')]);router['post'](_0x027f('0x1e'),auth[_0x027f('0x8')](),controller['addApplications']);router[_0x027f('0x19')]('/:id/send',auth['isAuthenticated'](),controller[_0x027f('0x1f')]);router[_0x027f('0x19')](_0x027f('0x20'),auth[_0x027f('0x8')](),controller[_0x027f('0x21')]);router[_0x027f('0x22')](_0x027f('0x23'),auth[_0x027f('0x8')](),controller[_0x027f('0x24')]);router['delete']('/:id/dispositions',auth[_0x027f('0x8')](),controller[_0x027f('0x25')]);router[_0x027f('0x26')](_0x027f('0xd'),auth['isAuthenticated'](),controller[_0x027f('0x27')]);router['delete'](_0x027f('0x28'),auth[_0x027f('0x8')](),controller[_0x027f('0x29')]);router[_0x027f('0x26')](_0x027f('0x10'),auth[_0x027f('0x8')](),controller[_0x027f('0x2a')]);router[_0x027f('0x26')](_0x027f('0x23'),auth[_0x027f('0x8')](),controller[_0x027f('0x2b')]);router[_0x027f('0x26')](_0x027f('0x20'),auth[_0x027f('0x8')](),controller[_0x027f('0x2c')]);module[_0x027f('0x2d')]=router; \ No newline at end of file +var _0xefc9=['removeAgents','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getImap','/:id/out_servers','getSmtp','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','verifySmtp','getAgents','addDisposition','addAnswer','create','post','addImap','addSmtp','/:id/interactions','addInteraction','addApplications','/:id/send','/:id/users','addAgents','put','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy'];(function(_0x2f5194,_0x35230a){var _0x4f848b=function(_0x28a408){while(--_0x28a408){_0x2f5194['push'](_0x2f5194['shift']());}};_0x4f848b(++_0x35230a);}(_0xefc9,0x128));var _0x9efc=function(_0x961134,_0x4ef84e){_0x961134=_0x961134-0x0;var _0x3b87b0=_0xefc9[_0x961134];return _0x3b87b0;};'use strict';var multer=require('multer');var util=require(_0x9efc('0x0'));var path=require('path');var timeout=require(_0x9efc('0x1'));var express=require(_0x9efc('0x2'));var router=express['Router']();var fs_extra=require(_0x9efc('0x3'));var auth=require(_0x9efc('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9efc('0x5'));var controller=require(_0x9efc('0x6'));router[_0x9efc('0x7')]('/',auth[_0x9efc('0x8')](),controller[_0x9efc('0x9')]);router[_0x9efc('0x7')](_0x9efc('0xa'),auth[_0x9efc('0x8')](),controller['describe']);router[_0x9efc('0x7')](_0x9efc('0xb'),auth[_0x9efc('0x8')](),controller[_0x9efc('0xc')]);router[_0x9efc('0x7')](_0x9efc('0xd'),auth[_0x9efc('0x8')](),controller[_0x9efc('0xe')]);router[_0x9efc('0x7')](_0x9efc('0xf'),auth[_0x9efc('0x8')](),controller[_0x9efc('0x10')]);router[_0x9efc('0x7')]('/:id/in_servers',auth[_0x9efc('0x8')](),controller[_0x9efc('0x11')]);router[_0x9efc('0x7')](_0x9efc('0x12'),auth[_0x9efc('0x8')](),controller[_0x9efc('0x13')]);router[_0x9efc('0x7')]('/:id/interactions',auth[_0x9efc('0x8')](),controller[_0x9efc('0x14')]);router[_0x9efc('0x7')](_0x9efc('0x15'),auth['isAuthenticated'](),controller[_0x9efc('0x16')]);router[_0x9efc('0x7')](_0x9efc('0x17'),auth[_0x9efc('0x8')](),controller[_0x9efc('0x18')]);router['get']('/:id/verify',auth[_0x9efc('0x8')](),controller[_0x9efc('0x19')]);router[_0x9efc('0x7')]('/:id/users',auth[_0x9efc('0x8')](),controller[_0x9efc('0x1a')]);router['post'](_0x9efc('0xd'),auth[_0x9efc('0x8')](),controller[_0x9efc('0x1b')]);router['post']('/:id/canned_answers',auth[_0x9efc('0x8')](),controller[_0x9efc('0x1c')]);router['post']('/',auth[_0x9efc('0x8')](),controller[_0x9efc('0x1d')]);router[_0x9efc('0x1e')]('/:id/in_servers',auth[_0x9efc('0x8')](),controller[_0x9efc('0x1f')]);router[_0x9efc('0x1e')](_0x9efc('0x12'),auth[_0x9efc('0x8')](),controller[_0x9efc('0x20')]);router[_0x9efc('0x1e')](_0x9efc('0x21'),auth[_0x9efc('0x8')](),controller[_0x9efc('0x22')]);router[_0x9efc('0x1e')]('/:id/applications',auth[_0x9efc('0x8')](),controller[_0x9efc('0x23')]);router[_0x9efc('0x1e')](_0x9efc('0x24'),auth[_0x9efc('0x8')](),controller['send']);router[_0x9efc('0x1e')](_0x9efc('0x25'),auth[_0x9efc('0x8')](),controller[_0x9efc('0x26')]);router[_0x9efc('0x27')](_0x9efc('0xb'),auth[_0x9efc('0x8')](),controller[_0x9efc('0x28')]);router[_0x9efc('0x29')](_0x9efc('0xd'),auth[_0x9efc('0x8')](),controller[_0x9efc('0x2a')]);router[_0x9efc('0x29')](_0x9efc('0xf'),auth[_0x9efc('0x8')](),controller[_0x9efc('0x2b')]);router['delete']('/:id/in_servers',auth['isAuthenticated'](),controller[_0x9efc('0x2c')]);router['delete']('/:id/out_servers',auth[_0x9efc('0x8')](),controller[_0x9efc('0x2d')]);router['delete']('/:id',auth[_0x9efc('0x8')](),controller[_0x9efc('0x2e')]);router[_0x9efc('0x29')](_0x9efc('0x25'),auth[_0x9efc('0x8')](),controller[_0x9efc('0x2f')]);module[_0x9efc('0x30')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 7d04a58..9246765 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 _0xe47d=['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','hotmail','outlook365','getDataValue','provider','custom','sequelize','exports','STRING','TEXT','BOOLEAN','Arial,Helvetica,sans-serif'];(function(_0x3bab09,_0x217c29){var _0x164376=function(_0x277730){while(--_0x277730){_0x3bab09['push'](_0x3bab09['shift']());}};_0x164376(++_0x217c29);}(_0xe47d,0x162));var _0xde47=function(_0x3c4828,_0x546d02){_0x3c4828=_0x3c4828-0x0;var _0x5149c2=_0xe47d[_0x3c4828];return _0x5149c2;};'use strict';var Sequelize=require(_0xde47('0x0'));module[_0xde47('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xde47('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0xde47('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xde47('0x3')]},'markAsUnread':{'type':Sequelize[_0xde47('0x4')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xde47('0x5')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0xde47('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xde47('0x7');}},'notificationSound':{'type':Sequelize[_0xde47('0x4')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xde47('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xde47('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0xde47('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xde47('0x4')],'defaultValue':![],'comment':_0xde47('0xa'),'set':function(_0x53392f){if(!_0x53392f)this[_0xde47('0xb')](_0xde47('0xc'),null);this[_0xde47('0xb')]('mandatoryDisposition',_0x53392f);}},'provider':{'type':Sequelize['ENUM']('gmail',_0xde47('0xd'),'yahoo',_0xde47('0xe')),'defaultValue':null,'get':function(){if(!this[_0xde47('0xf')](_0xde47('0x10')))return'custom';return this[_0xde47('0xf')]('provider');},'set':function(_0x36a3b5){if(_0x36a3b5===_0xde47('0x11'))_0x36a3b5=null;return this[_0xde47('0xb')](_0xde47('0x10'),_0x36a3b5);}}}; \ No newline at end of file +var _0x8a13=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','ENUM','gmail','hotmail','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','INTEGER'];(function(_0x4c6145,_0x3c719d){var _0x5c1c3d=function(_0x3d03e8){while(--_0x3d03e8){_0x4c6145['push'](_0x4c6145['shift']());}};_0x5c1c3d(++_0x3c719d);}(_0x8a13,0x71));var _0x38a1=function(_0x512661,_0x4b4012){_0x512661=_0x512661-0x0;var _0x1debde=_0x8a13[_0x512661];return _0x1debde;};'use strict';var Sequelize=require(_0x38a1('0x0'));module[_0x38a1('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x38a1('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x38a1('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x38a1('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x38a1('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x38a1('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x38a1('0x4')]},'markAsUnread':{'type':Sequelize[_0x38a1('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x38a1('0x5')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x38a1('0x4')],'defaultValue':function(){return _0x38a1('0x6');}},'notificationSound':{'type':Sequelize[_0x38a1('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x38a1('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x38a1('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x38a1('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x38a1('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x38a1('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x38a1('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x38a1('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x38a1('0x3')],'defaultValue':![],'comment':_0x38a1('0x8'),'set':function(_0x89b256){if(!_0x89b256)this[_0x38a1('0x9')](_0x38a1('0xa'),null);this[_0x38a1('0x9')]('mandatoryDisposition',_0x89b256);}},'provider':{'type':Sequelize[_0x38a1('0xb')](_0x38a1('0xc'),_0x38a1('0xd'),'yahoo','outlook365'),'defaultValue':null,'get':function(){if(!this[_0x38a1('0xe')](_0x38a1('0xf')))return'custom';return this[_0x38a1('0xe')]('provider');},'set':function(_0x2312a3){if(_0x2312a3===_0x38a1('0x10'))_0x2312a3=null;return this[_0x38a1('0x9')](_0x38a1('0xf'),_0x2312a3);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 76d44c0..0601603 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 _0x0598=['rows','params','MailServerIn','MailServerOut','keys','rawAttributes','include','provider','custom','body','secure','describe','find','MailAccountId','create','getDispositions','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','MailAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','findOne','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','getInteractions','CmContact','Contact','Owner','internal','Tag','Tags','color','tag','addApplications','transaction','sequelize','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','finally','getApplications','getMessages','MailMessage','$gte','split','format','true','CmList','List','Contacts','updatedAt','DESC','CloudProvider','from','attachments','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','messageId','subject','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','VerifySmtp','verifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','spread','emit','removeAgents','isArray','userMailAccount:remove','User','getAgents','moment','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','json','undefined','limit','count','offset','set','Content-Range','update','destroy','get','end','sendStatus','stack','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','outlook365','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','port','host','service','authentication','Imap','Smtp','index','Pause','mandatoryDispositionPause','map','MailAccount','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x0598,0x1ea));var _0x8059=function(_0x2f52c1,_0x3adc38){_0x2f52c1=_0x2f52c1-0x0;var _0x330f4e=_0x0598[_0x2f52c1];return _0x330f4e;};'use strict';var moment=require(_0x8059('0x0'));var BPromise=require('bluebird');var util=require(_0x8059('0x1'));var path=require(_0x8059('0x2'));var _=require(_0x8059('0x3'));var juice=require('juice');var Redis=require(_0x8059('0x4'));var qs=require(_0x8059('0x5'));var logger=require(_0x8059('0x6'))(_0x8059('0x7'));var config=require(_0x8059('0x8'));var db=require(_0x8059('0x9'))['db'];config['redis']=_[_0x8059('0xa')](config[_0x8059('0xb')],{'host':_0x8059('0xc'),'port':0x18eb});var socket=require(_0x8059('0xd'))(new Redis(config[_0x8059('0xb')]));require('./mailAccount.socket')[_0x8059('0xe')](socket);var jayson=require(_0x8059('0xf'));var client=jayson[_0x8059('0x10')]['http']({'port':0x232b});function respondWithRpcPromise(_0x343bed,_0x30436a,_0x5d80ab,_0x996b45){return new BPromise(function(_0x5255a7,_0x296976){var _0x2c7303=_0x996b45||client;return _0x2c7303[_0x8059('0x11')](_0x343bed,_0x5d80ab)[_0x8059('0x12')](function(_0x24c3a4){logger['info'](_0x8059('0x13'),_0x30436a,_0x8059('0x14'));logger['debug'](_0x8059('0x15'),_0x30436a,'request\x20sent',JSON[_0x8059('0x16')](_0x24c3a4));if(_0x24c3a4[_0x8059('0x17')]){if(_0x24c3a4['error'][_0x8059('0x18')]===0x1f4){logger[_0x8059('0x17')](_0x8059('0x13'),_0x30436a,_0x24c3a4[_0x8059('0x17')]['message']);return _0x296976(_0x24c3a4[_0x8059('0x17')][_0x8059('0x19')]);}logger[_0x8059('0x17')](_0x8059('0x13'),_0x30436a,_0x24c3a4[_0x8059('0x17')][_0x8059('0x19')]);return _0x5255a7(_0x24c3a4[_0x8059('0x17')]['message']);}else{logger['info'](_0x8059('0x13'),_0x30436a,_0x8059('0x14'));_0x5255a7(_0x24c3a4['result']['message']);}})[_0x8059('0x1a')](function(_0x177309){logger['error']('MailAccount,\x20%s,\x20%s',_0x30436a,_0x177309);_0x296976(_0x177309);});});}function respondWithStatusCode(_0x582a06,_0x18ffd4){_0x18ffd4=_0x18ffd4||0xcc;return function(_0x3d8cb0){if(_0x3d8cb0){return _0x582a06['sendStatus'](_0x18ffd4);}return _0x582a06[_0x8059('0x1b')](_0x18ffd4)['end']();};}function respondWithResult(_0x592661,_0x224e32){_0x224e32=_0x224e32||0xc8;return function(_0x377b87){if(_0x377b87){return _0x592661['status'](_0x224e32)[_0x8059('0x1c')](_0x377b87);}};}function respondWithFilteredResult(_0x5b767d,_0xc6f7ef){return function(_0x539958){if(_0x539958){var _0x56668b=typeof _0xc6f7ef['offset']===_0x8059('0x1d')&&typeof _0xc6f7ef[_0x8059('0x1e')]===_0x8059('0x1d');var _0x148848=_0x539958[_0x8059('0x1f')];var _0x422382=_0x56668b?0x0:_0xc6f7ef[_0x8059('0x20')];var _0x5b2e0d=_0x56668b?_0x539958[_0x8059('0x1f')]:_0xc6f7ef[_0x8059('0x20')]+_0xc6f7ef['limit'];var _0x15a4ab;if(_0x5b2e0d>=_0x148848){_0x5b2e0d=_0x148848;_0x15a4ab=0xc8;}else{_0x15a4ab=0xce;}_0x5b767d[_0x8059('0x1b')](_0x15a4ab);return _0x5b767d[_0x8059('0x21')](_0x8059('0x22'),_0x422382+'-'+_0x5b2e0d+'/'+_0x148848)[_0x8059('0x1c')](_0x539958);}return null;};}function saveUpdates(_0x5819ba){return function(_0x30849b){if(_0x30849b){return _0x30849b[_0x8059('0x23')](_0x5819ba)[_0x8059('0x12')](function(_0x266944){return _0x266944;});}return null;};}function removeEntity(_0x52c77f){return function(_0x5b0c4d){if(_0x5b0c4d){return _0x5b0c4d[_0x8059('0x24')]()[_0x8059('0x12')](function(){var _0x20dd31=_0x5b0c4d[_0x8059('0x25')]({'plain':!![]});var _0x32e4dd='MailAccounts';return db['UserProfileResource'][_0x8059('0x24')]({'where':{'type':_0x32e4dd,'resourceId':_0x20dd31['id']}})[_0x8059('0x12')](function(){return _0x5b0c4d;});})[_0x8059('0x12')](function(){_0x52c77f['status'](0xcc)[_0x8059('0x26')]();});}};}function handleEntityNotFound(_0x502c2e){return function(_0x395603){if(!_0x395603){_0x502c2e[_0x8059('0x27')](0x194);}return _0x395603;};}function handleError(_0x4bc3b3,_0x385d13){_0x385d13=_0x385d13||0x1f4;return function(_0x24f55e){logger[_0x8059('0x17')](_0x24f55e[_0x8059('0x28')]);if(_0x24f55e['name']){delete _0x24f55e[_0x8059('0x29')];}_0x4bc3b3[_0x8059('0x1b')](_0x385d13)[_0x8059('0x2a')](_0x24f55e);};}function getImapHost(_0x53e44a){switch(_0x53e44a){case _0x8059('0x2b'):return _0x8059('0x2c');case _0x8059('0x2d'):return _0x8059('0x2e');case _0x8059('0x2f'):return _0x8059('0x30');case'outlook365':return _0x8059('0x31');}throw new Error(_0x8059('0x32'),_0x53e44a);}function getSmtpHost(_0x5aeca5){switch(_0x5aeca5){case _0x8059('0x2b'):return _0x8059('0x33');case _0x8059('0x2d'):return _0x8059('0x34');case _0x8059('0x2f'):return _0x8059('0x35');case _0x8059('0x36'):return _0x8059('0x37');}throw new Error(_0x8059('0x32'),_0x5aeca5);}function getAuthenticationOptions(_0x516b6b,_0x2b41d6){var _0x5c88a9={};var _0x4851c1={};if(_0x516b6b){_0x5c88a9[_0x8059('0x38')]=_0x4851c1[_0x8059('0x38')]=_0x2b41d6[_0x8059('0x39')];_0x5c88a9[_0x8059('0x3a')]=_0x4851c1[_0x8059('0x3b')]=_0x2b41d6[_0x8059('0x3a')];if(_0x2b41d6['modernAuthentication']){_0x5c88a9[_0x8059('0x3c')]=_0x4851c1[_0x8059('0x3c')]=!![];_0x5c88a9[_0x8059('0x3d')]=_0x4851c1['CloudProviderId']=_0x2b41d6[_0x8059('0x3d')];_0x5c88a9[_0x8059('0x3a')]=_0x4851c1[_0x8059('0x3b')]=null;}else{_0x5c88a9[_0x8059('0x3d')]=_0x4851c1[_0x8059('0x3d')]=null;}_0x5c88a9['host']=getImapHost(_0x516b6b);_0x5c88a9[_0x8059('0x3e')]=0x3e1;_0x4851c1[_0x8059('0x3f')]=getSmtpHost(_0x516b6b);_0x4851c1[_0x8059('0x3e')]=0x24b;_0x4851c1['secure']=![];_0x5c88a9[_0x8059('0x40')]=_0x4851c1[_0x8059('0x40')]=null;}else{if(_0x2b41d6[_0x8059('0x41')]){_0x5c88a9[_0x8059('0x38')]=_0x4851c1[_0x8059('0x38')]=_0x2b41d6['username'];_0x5c88a9[_0x8059('0x3a')]=_0x4851c1['pass']=_0x2b41d6['password'];}else{_0x5c88a9[_0x8059('0x41')]=_0x4851c1[_0x8059('0x41')]=![];_0x5c88a9[_0x8059('0x38')]=_0x4851c1[_0x8059('0x38')]=null;_0x5c88a9[_0x8059('0x3a')]=_0x4851c1[_0x8059('0x3b')]=null;}_0x5c88a9[_0x8059('0x3f')]=_0x2b41d6[_0x8059('0x42')]['host'];_0x5c88a9[_0x8059('0x3e')]=_0x2b41d6['Imap'][_0x8059('0x3e')];_0x4851c1[_0x8059('0x3f')]=_0x2b41d6[_0x8059('0x43')][_0x8059('0x3f')];_0x4851c1['port']=_0x2b41d6[_0x8059('0x43')][_0x8059('0x3e')];}return{'Imap':_0x5c88a9,'Smtp':_0x4851c1};}exports[_0x8059('0x44')]=function(_0x48d059,_0x47ae8c){var _0x1bf7ff={'include':[{'model':db['MailServerIn'],'as':_0x8059('0x42')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x8059('0x45')],'as':_0x8059('0x46')}]},_0x59a409={},_0x5c7ad8={'count':0x0,'rows':[]};var _0x16dd5e=_[_0x8059('0x47')](db[_0x8059('0x48')]['rawAttributes'],function(_0x33e387){return{'name':_0x33e387[_0x8059('0x49')],'type':_0x33e387[_0x8059('0x4a')][_0x8059('0x4b')]};});_0x59a409['model']=_['map'](_0x16dd5e,_0x8059('0x29'));_0x59a409[_0x8059('0x4c')]=_['keys'](_0x48d059[_0x8059('0x4c')]);_0x59a409['filters']=_['intersection'](_0x59a409[_0x8059('0x4d')],_0x59a409[_0x8059('0x4c')]);_0x1bf7ff[_0x8059('0x4e')]=_[_0x8059('0x4f')](_0x59a409[_0x8059('0x4d')],qs[_0x8059('0x50')](_0x48d059['query'][_0x8059('0x50')]));_0x1bf7ff['attributes']=_0x1bf7ff[_0x8059('0x4e')][_0x8059('0x51')]?_0x1bf7ff[_0x8059('0x4e')]:_0x59a409[_0x8059('0x4d')];if(!_0x48d059[_0x8059('0x4c')][_0x8059('0x52')](_0x8059('0x53'))){_0x1bf7ff[_0x8059('0x1e')]=qs['limit'](_0x48d059[_0x8059('0x4c')][_0x8059('0x1e')]);_0x1bf7ff[_0x8059('0x20')]=qs[_0x8059('0x20')](_0x48d059['query'][_0x8059('0x20')]);}_0x1bf7ff[_0x8059('0x54')]=qs[_0x8059('0x55')](_0x48d059[_0x8059('0x4c')]['sort']);_0x1bf7ff[_0x8059('0x56')]=qs[_0x8059('0x57')](_[_0x8059('0x58')](_0x48d059[_0x8059('0x4c')],_0x59a409['filters']),_0x16dd5e);if(_0x48d059['query'][_0x8059('0x59')]){_0x1bf7ff[_0x8059('0x56')]=_[_0x8059('0x5a')](_0x1bf7ff['where'],{'$or':_['map'](_0x16dd5e,function(_0x3f8b9a){if(_0x3f8b9a[_0x8059('0x4a')]!==_0x8059('0x5b')){var _0x4197a0={};_0x4197a0[_0x3f8b9a[_0x8059('0x29')]]={'$like':'%'+_0x48d059[_0x8059('0x4c')][_0x8059('0x59')]+'%'};return _0x4197a0;}})});}_0x1bf7ff=_[_0x8059('0x5a')]({},_0x1bf7ff,_0x48d059[_0x8059('0x5c')]);var _0x39c406={'where':_0x1bf7ff[_0x8059('0x56')]};return db[_0x8059('0x48')][_0x8059('0x1f')](_0x39c406)[_0x8059('0x12')](function(_0x5cd1ce){_0x5c7ad8['count']=_0x5cd1ce;if(_0x48d059[_0x8059('0x4c')][_0x8059('0x5d')]){_0x1bf7ff['include']=[{'all':!![]}];}return db[_0x8059('0x48')][_0x8059('0x5e')](_0x1bf7ff);})['then'](function(_0x190ae6){_0x5c7ad8[_0x8059('0x5f')]=_0x190ae6;return _0x5c7ad8;})['then'](respondWithFilteredResult(_0x47ae8c,_0x1bf7ff))[_0x8059('0x1a')](handleError(_0x47ae8c,null));};exports['show']=function(_0x55a703,_0x59de26){var _0x3a750b={'raw':![],'where':{'id':_0x55a703[_0x8059('0x60')]['id']},'include':[{'model':db[_0x8059('0x61')],'as':_0x8059('0x42')},{'model':db[_0x8059('0x62')],'as':'Smtp'},{'model':db[_0x8059('0x45')],'as':_0x8059('0x46')}]},_0x2d6121={};_0x2d6121[_0x8059('0x4d')]=_[_0x8059('0x63')](db['MailAccount'][_0x8059('0x64')]);_0x2d6121[_0x8059('0x4c')]=_[_0x8059('0x63')](_0x55a703[_0x8059('0x4c')]);_0x2d6121[_0x8059('0x57')]=_[_0x8059('0x4f')](_0x2d6121['model'],_0x2d6121[_0x8059('0x4c')]);_0x3a750b['attributes']=_[_0x8059('0x4f')](_0x2d6121[_0x8059('0x4d')],qs[_0x8059('0x50')](_0x55a703[_0x8059('0x4c')][_0x8059('0x50')]));_0x3a750b[_0x8059('0x4e')]=_0x3a750b[_0x8059('0x4e')][_0x8059('0x51')]?_0x3a750b[_0x8059('0x4e')]:_0x2d6121['model'];if(_0x55a703[_0x8059('0x4c')][_0x8059('0x5d')]){_0x3a750b[_0x8059('0x65')]=[{'all':!![]}];}_0x3a750b=_['merge']({},_0x3a750b,_0x55a703['options']);return db['MailAccount']['find'](_0x3a750b)[_0x8059('0x12')](handleEntityNotFound(_0x59de26,null))[_0x8059('0x12')](respondWithResult(_0x59de26,null))['catch'](handleError(_0x59de26,null));};exports[_0x8059('0x23')]=function(_0x5c709b,_0x16e993){if(_0x5c709b['body']['id']){delete _0x5c709b['body']['id'];}var _0x30d61d=_0x5c709b['body'][_0x8059('0x66')]===_0x8059('0x67')?null:_0x5c709b['body']['provider'];var _0x139661=_0x5c709b['body'][_0x8059('0x42')]||{};var _0x2c778e=_0x5c709b[_0x8059('0x68')][_0x8059('0x43')]||{};if(_0x30d61d){_0x139661[_0x8059('0x3f')]=getImapHost(_0x30d61d);_0x139661[_0x8059('0x3e')]=0x3e1;_0x2c778e[_0x8059('0x3f')]=getSmtpHost(_0x30d61d);_0x2c778e[_0x8059('0x3e')]=0x24b;_0x2c778e[_0x8059('0x69')]=![];}if(_0x2c778e[_0x8059('0x3c')]){_0x2c778e[_0x8059('0x69')]=![];}else{_0x2c778e[_0x8059('0x3d')]=null;}if(!_0x139661[_0x8059('0x3c')])_0x139661[_0x8059('0x3d')]=null;_0x5c709b[_0x8059('0x68')]['Imap']=_0x139661;_0x5c709b[_0x8059('0x68')][_0x8059('0x43')]=_0x2c778e;return db['MailAccount']['find']({'where':{'id':_0x5c709b[_0x8059('0x60')]['id']},'include':[{'model':db[_0x8059('0x61')],'as':'Imap'},{'model':db[_0x8059('0x62')],'as':'Smtp'},{'model':db[_0x8059('0x45')],'as':_0x8059('0x46')}]})[_0x8059('0x12')](handleEntityNotFound(_0x16e993,null))[_0x8059('0x12')](function(_0xac8334){if(!_0xac8334)throw new Error('Mail\x20Account\x20not\x20found');if(_0xac8334['service'])delete _0x5c709b[_0x8059('0x68')]['Imap'];return _0xac8334;})[_0x8059('0x12')](saveUpdates(_0x5c709b['body'],null))[_0x8059('0x12')](function(_0x21e1da){if(!_0x5c709b[_0x8059('0x68')][_0x8059('0x42')])return _0x21e1da;return db[_0x8059('0x61')][_0x8059('0x23')](_0x5c709b[_0x8059('0x68')][_0x8059('0x42')],{'where':{'MailAccountId':_0x21e1da['id']}})['then'](function(){return _0x21e1da;});})['then'](function(_0x115c58){if(!_0x5c709b[_0x8059('0x68')][_0x8059('0x43')])return _0x115c58;return db['MailServerOut'][_0x8059('0x23')](_0x5c709b['body']['Smtp'],{'where':{'MailAccountId':_0x115c58['id']}})[_0x8059('0x12')](function(){return _0x115c58;});})[_0x8059('0x12')](respondWithResult(_0x16e993,null))['catch'](handleError(_0x16e993,null));};exports[_0x8059('0x6a')]=function(_0x12a859,_0x4ad13a){return db[_0x8059('0x48')][_0x8059('0x6a')]()['then'](respondWithResult(_0x4ad13a,null))['catch'](handleError(_0x4ad13a,null));};exports['addDisposition']=function(_0x390293,_0x5038ec){if(_0x390293[_0x8059('0x68')]['id']){delete _0x390293[_0x8059('0x68')]['id'];}return db['MailAccount'][_0x8059('0x6b')]({'where':{'id':_0x390293[_0x8059('0x60')]['id']}})[_0x8059('0x12')](handleEntityNotFound(_0x5038ec,null))['then'](function(_0x3b436c){if(_0x3b436c){_0x390293[_0x8059('0x68')][_0x8059('0x6c')]=_0x3b436c['id'];return db['Disposition'][_0x8059('0x6d')](_0x390293['body']);}})[_0x8059('0x12')](respondWithResult(_0x5038ec,null))[_0x8059('0x1a')](handleError(_0x5038ec,null));};exports[_0x8059('0x6e')]=function(_0x145fba,_0x330f25){var _0x34d5a8={'raw':![],'where':{}};var _0x7f615e={};var _0x4c051f={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x145fba[_0x8059('0x60')]['id']}})[_0x8059('0x12')](handleEntityNotFound(_0x330f25,null))[_0x8059('0x12')](function(_0x3c43ca){if(_0x3c43ca){_0x7f615e['model']=_[_0x8059('0x63')](db[_0x8059('0x6f')][_0x8059('0x64')]);_0x7f615e[_0x8059('0x4c')]=_[_0x8059('0x63')](_0x145fba[_0x8059('0x4c')]);_0x7f615e[_0x8059('0x57')]=_[_0x8059('0x4f')](_0x7f615e[_0x8059('0x4d')],_0x7f615e['query']);_0x34d5a8[_0x8059('0x4e')]=_[_0x8059('0x4f')](_0x7f615e[_0x8059('0x4d')],qs[_0x8059('0x50')](_0x145fba[_0x8059('0x4c')][_0x8059('0x50')]));_0x34d5a8[_0x8059('0x4e')]=_0x34d5a8['attributes']['length']?_0x34d5a8['attributes']:_0x7f615e['model'];if(!_0x145fba[_0x8059('0x4c')][_0x8059('0x52')](_0x8059('0x53'))){_0x34d5a8[_0x8059('0x1e')]=qs[_0x8059('0x1e')](_0x145fba['query'][_0x8059('0x1e')]);_0x34d5a8[_0x8059('0x20')]=qs[_0x8059('0x20')](_0x145fba[_0x8059('0x4c')]['offset']);}_0x34d5a8[_0x8059('0x54')]=qs['sort'](_0x145fba[_0x8059('0x4c')][_0x8059('0x55')]);_0x34d5a8['where']=qs[_0x8059('0x57')](_[_0x8059('0x58')](_0x145fba[_0x8059('0x4c')],_0x7f615e[_0x8059('0x57')]));_0x34d5a8[_0x8059('0x56')][_0x8059('0x6c')]=_0x3c43ca['id'];if(_0x145fba[_0x8059('0x4c')][_0x8059('0x59')]){_0x34d5a8['where']=_[_0x8059('0x5a')](_0x34d5a8[_0x8059('0x56')],{'$or':_[_0x8059('0x47')](_0x34d5a8[_0x8059('0x4e')],function(_0x3cb73c){var _0x57e99e={};_0x57e99e[_0x3cb73c]={'$like':'%'+_0x145fba['query']['filter']+'%'};return _0x57e99e;})});}_0x34d5a8=_[_0x8059('0x5a')]({},_0x34d5a8,_0x145fba[_0x8059('0x5c')]);return db[_0x8059('0x6f')][_0x8059('0x1f')]({'where':_0x34d5a8[_0x8059('0x56')]})[_0x8059('0x12')](function(_0x4394e3){_0x4c051f[_0x8059('0x1f')]=_0x4394e3;if(_0x145fba[_0x8059('0x4c')][_0x8059('0x5d')]){_0x34d5a8[_0x8059('0x65')]=[{'all':!![]}];}return db['Disposition'][_0x8059('0x5e')](_0x34d5a8);})[_0x8059('0x12')](function(_0x4471d1){_0x4c051f[_0x8059('0x5f')]=_0x4471d1;return _0x4c051f;});}})[_0x8059('0x12')](respondWithFilteredResult(_0x330f25,_0x34d5a8))[_0x8059('0x1a')](handleError(_0x330f25,null));};exports[_0x8059('0x70')]=function(_0x17f3aa,_0x59aaaf){return db[_0x8059('0x48')][_0x8059('0x6b')]({'where':{'id':_0x17f3aa[_0x8059('0x60')]['id']}})[_0x8059('0x12')](handleEntityNotFound(_0x59aaaf,null))[_0x8059('0x12')](function(_0xcaa4cf){if(_0xcaa4cf){return _0xcaa4cf[_0x8059('0x70')](_0x17f3aa[_0x8059('0x4c')][_0x8059('0x71')]);}})[_0x8059('0x12')](respondWithStatusCode(_0x59aaaf,null))[_0x8059('0x1a')](handleError(_0x59aaaf,null));};exports[_0x8059('0x72')]=function(_0x22bccd,_0xd159ae){if(_0x22bccd[_0x8059('0x68')]['id']){delete _0x22bccd[_0x8059('0x68')]['id'];}return db[_0x8059('0x48')]['find']({'where':{'id':_0x22bccd[_0x8059('0x60')]['id']}})[_0x8059('0x12')](handleEntityNotFound(_0xd159ae,null))[_0x8059('0x12')](function(_0x22c2f1){if(_0x22c2f1){_0x22bccd[_0x8059('0x68')][_0x8059('0x6c')]=_0x22c2f1['id'];return db[_0x8059('0x73')][_0x8059('0x6d')](_0x22bccd[_0x8059('0x68')]);}})['then'](respondWithResult(_0xd159ae,null))[_0x8059('0x1a')](handleError(_0xd159ae,null));};exports[_0x8059('0x74')]=function(_0x6fb050,_0x4bc124){var _0x454938={'raw':![],'where':{}};var _0x351ca1={};var _0x4070ad={'count':0x0,'rows':[]};return db[_0x8059('0x48')]['findOne']({'where':{'id':_0x6fb050[_0x8059('0x60')]['id']}})[_0x8059('0x12')](handleEntityNotFound(_0x4bc124,null))[_0x8059('0x12')](function(_0x3b9ee3){if(_0x3b9ee3){_0x351ca1['model']=_[_0x8059('0x63')](db[_0x8059('0x73')][_0x8059('0x64')]);_0x351ca1[_0x8059('0x4c')]=_[_0x8059('0x63')](_0x6fb050[_0x8059('0x4c')]);_0x351ca1[_0x8059('0x57')]=_[_0x8059('0x4f')](_0x351ca1[_0x8059('0x4d')],_0x351ca1[_0x8059('0x4c')]);_0x454938[_0x8059('0x4e')]=_['intersection'](_0x351ca1[_0x8059('0x4d')],qs[_0x8059('0x50')](_0x6fb050[_0x8059('0x4c')][_0x8059('0x50')]));_0x454938[_0x8059('0x4e')]=_0x454938[_0x8059('0x4e')]['length']?_0x454938[_0x8059('0x4e')]:_0x351ca1['model'];if(!_0x6fb050[_0x8059('0x4c')][_0x8059('0x52')]('nolimit')){_0x454938[_0x8059('0x1e')]=qs[_0x8059('0x1e')](_0x6fb050[_0x8059('0x4c')][_0x8059('0x1e')]);_0x454938[_0x8059('0x20')]=qs[_0x8059('0x20')](_0x6fb050[_0x8059('0x4c')][_0x8059('0x20')]);}_0x454938[_0x8059('0x54')]=qs['sort'](_0x6fb050[_0x8059('0x4c')][_0x8059('0x55')]);_0x454938[_0x8059('0x56')]=qs[_0x8059('0x57')](_[_0x8059('0x58')](_0x6fb050['query'],_0x351ca1[_0x8059('0x57')]));_0x454938[_0x8059('0x56')][_0x8059('0x6c')]=_0x3b9ee3['id'];if(_0x6fb050[_0x8059('0x4c')][_0x8059('0x59')]){_0x454938[_0x8059('0x56')]=_[_0x8059('0x5a')](_0x454938[_0x8059('0x56')],{'$or':_[_0x8059('0x47')](_0x454938[_0x8059('0x4e')],function(_0x41ccd4){var _0x19b3a4={};_0x19b3a4[_0x41ccd4]={'$like':'%'+_0x6fb050[_0x8059('0x4c')][_0x8059('0x59')]+'%'};return _0x19b3a4;})});}_0x454938=_['merge']({},_0x454938,_0x6fb050['options']);return db['CannedAnswer']['count']({'where':_0x454938[_0x8059('0x56')]})[_0x8059('0x12')](function(_0x53c810){_0x4070ad[_0x8059('0x1f')]=_0x53c810;if(_0x6fb050['query'][_0x8059('0x5d')]){_0x454938[_0x8059('0x65')]=[{'all':!![]}];}return db[_0x8059('0x73')][_0x8059('0x5e')](_0x454938);})['then'](function(_0x2a5632){_0x4070ad[_0x8059('0x5f')]=_0x2a5632;return _0x4070ad;});}})['then'](respondWithFilteredResult(_0x4bc124,_0x454938))[_0x8059('0x1a')](handleError(_0x4bc124,null));};exports[_0x8059('0x75')]=function(_0x583941,_0x5baa95){return db[_0x8059('0x48')][_0x8059('0x6b')]({'where':{'id':_0x583941[_0x8059('0x60')]['id']}})[_0x8059('0x12')](handleEntityNotFound(_0x5baa95,null))['then'](function(_0x29978a){if(_0x29978a){return _0x29978a['removeAnswers'](_0x583941[_0x8059('0x4c')]['ids']);}})[_0x8059('0x12')](respondWithStatusCode(_0x5baa95,null))['catch'](handleError(_0x5baa95,null));};exports[_0x8059('0x6d')]=function(_0x3db0e9,_0x1f4a6b){var _0x39ed33={'name':_0x3db0e9['body']['name'],'key':_0x3db0e9[_0x8059('0x68')][_0x8059('0x4b')],'provider':_0x3db0e9[_0x8059('0x68')][_0x8059('0x66')]==='custom'?null:_0x3db0e9[_0x8059('0x68')][_0x8059('0x66')],'email':_0x3db0e9[_0x8059('0x68')][_0x8059('0x76')],'ListId':_0x3db0e9[_0x8059('0x68')][_0x8059('0x77')],'active':!_[_0x8059('0x78')](_0x3db0e9[_0x8059('0x68')]['active'])?_0x3db0e9['body'][_0x8059('0x79')]:!![],'description':_0x3db0e9[_0x8059('0x68')][_0x8059('0x7a')]||null};var _0x46fb3c=getAuthenticationOptions(_0x39ed33['provider'],_0x3db0e9[_0x8059('0x68')]);_0x39ed33['Imap']=_0x46fb3c['Imap'];_0x39ed33[_0x8059('0x43')]=_0x46fb3c['Smtp'];return db[_0x8059('0x48')][_0x8059('0x6d')](_0x39ed33,{'include':[{'model':db['MailServerOut'],'as':_0x8059('0x43')},{'model':db[_0x8059('0x61')],'as':_0x8059('0x42')}]})[_0x8059('0x12')](function(_0x43cc9e){var _0x28363f=_0x3db0e9[_0x8059('0x38')][_0x8059('0x25')]({'plain':!![]});if(!_0x28363f)throw new Error(_0x8059('0x7b'));if(_0x28363f['role']===_0x8059('0x38')){var _0x46c947=_0x43cc9e['get']({'plain':!![]});return db[_0x8059('0x7c')]['find']({'where':{'name':_0x8059('0x7d'),'userProfileId':_0x28363f[_0x8059('0x7e')]},'raw':!![]})[_0x8059('0x12')](function(_0x46666b){if(_0x46666b&&_0x46666b[_0x8059('0x7f')]===0x0){return db['UserProfileResource'][_0x8059('0x6d')]({'name':_0x46c947['name'],'resourceId':_0x46c947['id'],'type':_0x46666b[_0x8059('0x29')],'sectionId':_0x46666b['id']},{})[_0x8059('0x12')](function(){return _0x43cc9e;});}else{return _0x43cc9e;}})[_0x8059('0x1a')](function(_0xdc5c16){logger[_0x8059('0x17')](_0x8059('0x80'),_0xdc5c16);throw _0xdc5c16;});}return _0x43cc9e;})[_0x8059('0x12')](respondWithResult(_0x1f4a6b,0xc9))[_0x8059('0x1a')](handleError(_0x1f4a6b,null));};exports[_0x8059('0x81')]=function(_0x11da61,_0xf227a){return db[_0x8059('0x48')][_0x8059('0x82')]({'where':{'id':_0x11da61[_0x8059('0x60')]['id']}})[_0x8059('0x12')](handleEntityNotFound(_0xf227a,null))[_0x8059('0x12')](function(_0x5cbf2f){if(_0x5cbf2f){return _0x5cbf2f[_0x8059('0x81')]();}return null;})[_0x8059('0x12')](respondWithResult(_0xf227a,null))[_0x8059('0x1a')](handleError(_0xf227a,null));};exports[_0x8059('0x83')]=function(_0x32c968,_0x5ab7c7){if(_0x32c968['body']['id']){delete _0x32c968[_0x8059('0x68')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x32c968[_0x8059('0x60')]['id']}})[_0x8059('0x12')](handleEntityNotFound(_0x5ab7c7,null))[_0x8059('0x12')](function(_0x358ba4){if(_0x358ba4){_0x32c968['body'][_0x8059('0x6c')]=_0x358ba4['id'];return db[_0x8059('0x61')]['create'](_0x32c968['body']);}})[_0x8059('0x12')](respondWithResult(_0x5ab7c7,null))[_0x8059('0x1a')](handleError(_0x5ab7c7,null));};exports[_0x8059('0x84')]=function(_0x5838b2,_0x53e247){return db[_0x8059('0x48')]['findOne']({'where':{'id':_0x5838b2[_0x8059('0x60')]['id']}})[_0x8059('0x12')](handleEntityNotFound(_0x53e247,null))[_0x8059('0x12')](function(_0x38b9a8){if(_0x38b9a8){return _0x38b9a8[_0x8059('0x85')](null);}return null;})[_0x8059('0x12')](respondWithStatusCode(_0x53e247,null))[_0x8059('0x1a')](handleError(_0x53e247,null));};exports[_0x8059('0x86')]=function(_0x4a1c94,_0x2284b2){return db[_0x8059('0x48')][_0x8059('0x82')]({'where':{'id':_0x4a1c94[_0x8059('0x60')]['id']}})[_0x8059('0x12')](handleEntityNotFound(_0x2284b2,null))[_0x8059('0x12')](function(_0x5db349){if(_0x5db349){return _0x5db349[_0x8059('0x86')]();}return null;})['then'](respondWithResult(_0x2284b2,null))[_0x8059('0x1a')](handleError(_0x2284b2,null));};exports[_0x8059('0x87')]=function(_0x2c5d83,_0x58d566){if(_0x2c5d83['body']['id']){delete _0x2c5d83[_0x8059('0x68')]['id'];}return db[_0x8059('0x48')][_0x8059('0x6b')]({'where':{'id':_0x2c5d83[_0x8059('0x60')]['id']}})['then'](handleEntityNotFound(_0x58d566,null))[_0x8059('0x12')](function(_0x349054){if(_0x349054){_0x2c5d83[_0x8059('0x68')]['MailAccountId']=_0x349054['id'];return db[_0x8059('0x62')][_0x8059('0x6d')](_0x2c5d83[_0x8059('0x68')]);}})['then'](respondWithResult(_0x58d566,null))[_0x8059('0x1a')](handleError(_0x58d566,null));};exports[_0x8059('0x88')]=function(_0x1f991a,_0xdd515){return db['MailAccount'][_0x8059('0x82')]({'where':{'id':_0x1f991a['params']['id']}})[_0x8059('0x12')](handleEntityNotFound(_0xdd515,null))[_0x8059('0x12')](function(_0x924d08){if(_0x924d08){return _0x924d08[_0x8059('0x89')](null);}return null;})[_0x8059('0x12')](respondWithStatusCode(_0xdd515,null))[_0x8059('0x1a')](handleError(_0xdd515,null));};exports[_0x8059('0x8a')]=function(_0x29ffbd,_0x476469){return db[_0x8059('0x8b')][_0x8059('0x6b')]({'where':{'id':_0x29ffbd[_0x8059('0x60')]['id']}})[_0x8059('0x12')](handleEntityNotFound(_0x476469,null))[_0x8059('0x12')](function(_0x284d14){if(_0x284d14){return _0x284d14[_0x8059('0x8a')](_0x29ffbd[_0x8059('0x68')][_0x8059('0x71')],_['omit'](_0x29ffbd['body'],[_0x8059('0x71'),'id'])||{});}})[_0x8059('0x12')](respondWithResult(_0x476469,null))[_0x8059('0x1a')](handleError(_0x476469,null));};exports[_0x8059('0x8c')]=function(_0x344874,_0x170d18){var _0x375543={'raw':![],'where':{}};var _0x2fd19c={};var _0x5ad7bf={'count':0x0,'rows':[]};return db['MailAccount'][_0x8059('0x82')]({'where':{'id':_0x344874[_0x8059('0x60')]['id']}})[_0x8059('0x12')](handleEntityNotFound(_0x170d18,null))['then'](function(_0x1756c1){if(_0x1756c1){_0x2fd19c[_0x8059('0x4d')]=_[_0x8059('0x63')](db[_0x8059('0x8b')][_0x8059('0x64')]);_0x2fd19c[_0x8059('0x4c')]=_[_0x8059('0x63')](_0x344874[_0x8059('0x4c')]);_0x2fd19c['filters']=_[_0x8059('0x4f')](_0x2fd19c[_0x8059('0x4d')],_0x2fd19c[_0x8059('0x4c')]);_0x375543[_0x8059('0x4e')]=_[_0x8059('0x4f')](_0x2fd19c['model'],qs[_0x8059('0x50')](_0x344874['query']['fields']));_0x375543[_0x8059('0x4e')]=_0x375543[_0x8059('0x4e')]['length']?_0x375543[_0x8059('0x4e')]:_0x2fd19c[_0x8059('0x4d')];if(!_0x344874[_0x8059('0x4c')]['hasOwnProperty']('nolimit')){_0x375543[_0x8059('0x1e')]=qs[_0x8059('0x1e')](_0x344874[_0x8059('0x4c')][_0x8059('0x1e')]);_0x375543[_0x8059('0x20')]=qs['offset'](_0x344874['query'][_0x8059('0x20')]);}_0x375543['order']=qs[_0x8059('0x55')](_0x344874[_0x8059('0x4c')][_0x8059('0x55')]);_0x375543[_0x8059('0x56')]=qs[_0x8059('0x57')](_[_0x8059('0x58')](_0x344874[_0x8059('0x4c')],_0x2fd19c[_0x8059('0x57')]));_0x375543['where'][_0x8059('0x6c')]=_0x1756c1['id'];if(_0x344874[_0x8059('0x4c')][_0x8059('0x59')]){_0x375543[_0x8059('0x56')]=_['merge'](_0x375543[_0x8059('0x56')],{'$or':_[_0x8059('0x47')](_0x375543['attributes'],function(_0xbd0e9a){var _0x4e7c25={};_0x4e7c25[_0xbd0e9a]={'$like':'%'+_0x344874['query'][_0x8059('0x59')]+'%'};return _0x4e7c25;})});}_0x375543=_[_0x8059('0x5a')]({},_0x375543,_0x344874[_0x8059('0x5c')]);return db[_0x8059('0x8b')]['count']({'where':_0x375543[_0x8059('0x56')]})[_0x8059('0x12')](function(_0x384e5a){_0x5ad7bf[_0x8059('0x1f')]=_0x384e5a;if(_0x344874[_0x8059('0x4c')][_0x8059('0x5d')]){_0x375543[_0x8059('0x65')]=[{'model':db[_0x8059('0x8d')],'as':_0x8059('0x8e'),'required':![]},{'model':db['User'],'as':_0x8059('0x8f'),'attributes':['name','fullname',_0x8059('0x90')],'required':![]},{'model':db[_0x8059('0x91')],'as':_0x8059('0x92'),'attributes':['id',_0x8059('0x29'),_0x8059('0x93')],'where':_0x344874['query'][_0x8059('0x94')]?{'id':_0x344874[_0x8059('0x4c')][_0x8059('0x94')]}:undefined,'required':_0x344874['query']['tag']?!![]:![]}];}return db[_0x8059('0x8b')]['findAll'](_0x375543);})[_0x8059('0x12')](function(_0x57cf66){_0x5ad7bf[_0x8059('0x5f')]=_0x57cf66;return _0x5ad7bf;});}})[_0x8059('0x12')](respondWithFilteredResult(_0x170d18,_0x375543))['catch'](handleError(_0x170d18,null));};exports[_0x8059('0x95')]=function addApplications(_0x9da368,_0x5674a0){var _0x510221=_0x9da368['params']['id'];var _0x1e2ee5=_0x9da368[_0x8059('0x68')];var _0x3f4149=0xc8;var _0x3f41df=null;return db['sequelize'][_0x8059('0x96')]({'isolationLevel':db[_0x8059('0x97')]['Transaction'][_0x8059('0x98')][_0x8059('0x99')]},function(_0x392831){return db[_0x8059('0x48')][_0x8059('0x82')]({'where':{'id':_0x510221},'transaction':_0x392831})[_0x8059('0x12')](function(_0x29c2f4){if(_0x29c2f4){return db[_0x8059('0x9a')][_0x8059('0x24')]({'where':{'MailAccountId':_0x510221},'transaction':_0x392831})[_0x8059('0x12')](function(){var _0x39fb7b=_[_0x8059('0x47')](_0x1e2ee5,function(_0x195f7a){_0x195f7a[_0x8059('0x6c')]=_0x510221;return _0x195f7a;});return db[_0x8059('0x9a')][_0x8059('0x9b')](_0x39fb7b,{'transaction':_0x392831});});}else{_0x3f4149=0x194;_0x3f41df=[];}});})[_0x8059('0x12')](function(){if(_0x3f4149!==0x194){return db[_0x8059('0x9a')][_0x8059('0x9c')]({'where':{'MailAccountId':_0x510221},'order':'priority'})[_0x8059('0x12')](function(_0x5ca44b){_0x3f41df=_0x5ca44b;});}})[_0x8059('0x1a')](function(_0x513144){_0x3f4149=0x1f4;logger[_0x8059('0x17')](_0x513144['stack']);if(_0x513144['name']){delete _0x513144[_0x8059('0x29')];}_0x3f41df=_0x513144;})[_0x8059('0x9d')](function(){if(_0x3f41df===null){_0x5674a0[_0x8059('0x27')](_0x3f4149);}else{if(_0x3f4149===0x1f4){_0x5674a0[_0x8059('0x1b')](_0x3f4149)[_0x8059('0x2a')](_0x3f41df);}else{_0x5674a0[_0x8059('0x1b')](_0x3f4149)[_0x8059('0x1c')](_0x3f41df);}}});};exports['getApplications']=function(_0x299013,_0x5c2fdc){var _0x2b0f74={};var _0x42f5a3={};var _0x3504d7;var _0x4e0ffd;return db[_0x8059('0x48')][_0x8059('0x82')]({'where':{'id':_0x299013[_0x8059('0x60')]['id']}})[_0x8059('0x12')](handleEntityNotFound(_0x5c2fdc,null))[_0x8059('0x12')](function(_0x2a88e5){if(_0x2a88e5){_0x3504d7=_0x2a88e5;_0x42f5a3[_0x8059('0x4d')]=_[_0x8059('0x63')](db[_0x8059('0x9a')][_0x8059('0x64')]);_0x42f5a3[_0x8059('0x4c')]=_[_0x8059('0x63')](_0x299013['query']);_0x42f5a3['filters']=_['intersection'](_0x42f5a3['model'],_0x42f5a3['query']);_0x2b0f74[_0x8059('0x4e')]=_[_0x8059('0x4f')](_0x42f5a3['model'],qs[_0x8059('0x50')](_0x299013['query'][_0x8059('0x50')]));_0x2b0f74[_0x8059('0x4e')]=_0x2b0f74['attributes'][_0x8059('0x51')]?_0x2b0f74[_0x8059('0x4e')]:_0x42f5a3[_0x8059('0x4d')];_0x2b0f74[_0x8059('0x54')]=qs[_0x8059('0x55')](_0x299013[_0x8059('0x4c')][_0x8059('0x55')]);_0x2b0f74[_0x8059('0x56')]=qs[_0x8059('0x57')](_[_0x8059('0x58')](_0x299013[_0x8059('0x4c')],_0x42f5a3[_0x8059('0x57')]));if(_0x299013[_0x8059('0x4c')][_0x8059('0x59')]){_0x2b0f74[_0x8059('0x56')]=_[_0x8059('0x5a')](_0x2b0f74[_0x8059('0x56')],{'$or':_[_0x8059('0x47')](_0x2b0f74['attributes'],function(_0x2eb428){var _0x2441a2={};_0x2441a2[_0x2eb428]={'$like':'%'+_0x299013[_0x8059('0x4c')][_0x8059('0x59')]+'%'};return _0x2441a2;})});}_0x2b0f74=_[_0x8059('0x5a')]({},_0x2b0f74,_0x299013[_0x8059('0x5c')]);return _0x3504d7['getApplications'](_0x2b0f74);}})[_0x8059('0x12')](function(_0x5a4ce2){if(_0x5a4ce2){_0x4e0ffd=_0x5a4ce2['length'];if(!_0x299013[_0x8059('0x4c')][_0x8059('0x52')](_0x8059('0x53'))){_0x2b0f74['limit']=qs['limit'](_0x299013[_0x8059('0x4c')]['limit']);_0x2b0f74['offset']=qs['offset'](_0x299013[_0x8059('0x4c')][_0x8059('0x20')]);}return _0x3504d7[_0x8059('0x9e')](_0x2b0f74);}})[_0x8059('0x12')](function(_0x7e463){if(_0x7e463){return _0x7e463?{'count':_0x4e0ffd,'rows':_0x7e463}:null;}})[_0x8059('0x12')](respondWithResult(_0x5c2fdc,null))['catch'](handleError(_0x5c2fdc,null));};exports[_0x8059('0x9f')]=function(_0x2c00e1,_0x247648){var _0x1cea32={'raw':!![],'where':{}};var _0x763857={};var _0x3be24c={'count':0x0,'rows':[]};return db[_0x8059('0x48')][_0x8059('0x82')]({'where':{'id':_0x2c00e1[_0x8059('0x60')]['id']}})[_0x8059('0x12')](handleEntityNotFound(_0x247648,null))[_0x8059('0x12')](function(_0x75858a){if(_0x75858a){_0x763857[_0x8059('0x4d')]=_[_0x8059('0x63')](db[_0x8059('0xa0')][_0x8059('0x64')]);_0x763857[_0x8059('0x4c')]=_['keys'](_0x2c00e1['query']);_0x763857['filters']=_[_0x8059('0x4f')](_0x763857[_0x8059('0x4d')],_0x763857[_0x8059('0x4c')]);_0x1cea32[_0x8059('0x4e')]=_[_0x8059('0x4f')](_0x763857['model'],qs[_0x8059('0x50')](_0x2c00e1[_0x8059('0x4c')][_0x8059('0x50')]));_0x1cea32[_0x8059('0x4e')]=_0x1cea32[_0x8059('0x4e')][_0x8059('0x51')]?_0x1cea32[_0x8059('0x4e')]:_0x763857[_0x8059('0x4d')];if(!_0x2c00e1['query'][_0x8059('0x52')](_0x8059('0x53'))){_0x1cea32[_0x8059('0x1e')]=qs['limit'](_0x2c00e1['query'][_0x8059('0x1e')]);_0x1cea32[_0x8059('0x20')]=qs[_0x8059('0x20')](_0x2c00e1[_0x8059('0x4c')][_0x8059('0x20')]);}_0x1cea32[_0x8059('0x54')]=qs[_0x8059('0x55')](_0x2c00e1['query'][_0x8059('0x55')]);_0x1cea32['where']=qs['filters'](_[_0x8059('0x58')](_0x2c00e1[_0x8059('0x4c')],_0x763857[_0x8059('0x57')]));_0x1cea32['where']['MailAccountId']=_0x75858a['id'];if(_0x2c00e1[_0x8059('0x4c')][_0x8059('0x59')]){_0x1cea32[_0x8059('0x56')]=_['merge'](_0x1cea32[_0x8059('0x56')],{'$or':_['map'](_0x1cea32[_0x8059('0x4e')],function(_0x378d12){var _0x35725c={};_0x35725c[_0x378d12]={'$like':'%'+_0x2c00e1['query'][_0x8059('0x59')]+'%'};return _0x35725c;})});}if(_0x2c00e1[_0x8059('0x4c')][_0x8059('0xa1')]){var _0x11ee3f=_0x2c00e1[_0x8059('0x4c')]['$gte'][_0x8059('0xa2')](',');var _0x4b585f={};_0x4b585f[_0x11ee3f[0x0]]={'$gte':moment(_0x11ee3f[0x1])[_0x8059('0xa3')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1cea32['where']=_['merge'](_0x1cea32[_0x8059('0x56')],_0x4b585f);}_0x1cea32=_['merge']({},_0x1cea32,_0x2c00e1['options']);return db['MailMessage'][_0x8059('0x1f')]({'where':_0x1cea32['where']})['then'](function(_0x550c74){_0x3be24c[_0x8059('0x1f')]=_0x550c74;if(_0x2c00e1[_0x8059('0x4c')][_0x8059('0x5d')]){_0x1cea32[_0x8059('0x65')]=[{'all':!![]}];}return db[_0x8059('0xa0')][_0x8059('0x5e')](_0x1cea32);})[_0x8059('0x12')](function(_0x8a4b59){if(_0x2c00e1[_0x8059('0x4c')]['inlineCss']===_0x8059('0xa4')){for(var _0x1ff4c6=0x0;_0x1ff4c6<_0x8a4b59[_0x8059('0x51')];_0x1ff4c6++){_0x8a4b59[_0x1ff4c6][_0x8059('0x68')]=juice(_0x8a4b59[_0x1ff4c6]['body']);}}_0x3be24c[_0x8059('0x5f')]=_0x8a4b59;return _0x3be24c;});}})[_0x8059('0x12')](respondWithFilteredResult(_0x247648,_0x1cea32))[_0x8059('0x1a')](handleError(_0x247648,null));};exports[_0x8059('0x2a')]=function(_0x52f4d9,_0x2398f4){var _0x4e4380,_0x577a63={},_0x45c82a;if(_0x52f4d9['body']['to']){_0x45c82a=_0x52f4d9[_0x8059('0x68')]['to'][_0x8059('0xa2')](',')[0x0];}return db['MailAccount'][_0x8059('0x6b')]({'where':{'id':_0x52f4d9[_0x8059('0x60')]['id']},'include':[{'model':db[_0x8059('0xa5')],'as':_0x8059('0xa6'),'include':[{'model':db['CmContact'],'as':_0x8059('0xa7'),'where':{'email':_0x45c82a},'limit':0x1,'order':[[_0x8059('0xa8'),_0x8059('0xa9')]]}]},{'model':db[_0x8059('0x62')],'as':_0x8059('0x43'),'raw':!![],'include':[{'model':db[_0x8059('0xaa')],'as':'CloudProvider','raw':!![]}]}]})['then'](handleEntityNotFound(_0x2398f4,null))[_0x8059('0x12')](function(_0x3fa779){if(!_0x3fa779)return;_0x4e4380=_0x3fa779;if(!_0x3fa779['Smtp'])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0x8059('0x78')](_0x52f4d9['body'][_0x8059('0xab')])){_0x52f4d9['body'][_0x8059('0xab')]=util[_0x8059('0xa3')]('%s\x20<%s>',_0x3fa779[_0x8059('0x29')],_0x3fa779['email']||_0x3fa779[_0x8059('0x43')][_0x8059('0x38')]);}if(_0x52f4d9[_0x8059('0x68')][_0x8059('0xac')]&&_0x52f4d9[_0x8059('0x68')][_0x8059('0xac')][_0x8059('0x51')]){for(var _0x147957=0x0;_0x147957<_0x52f4d9['body'][_0x8059('0xac')][_0x8059('0x51')];_0x147957+=0x1){_0x52f4d9[_0x8059('0x68')][_0x8059('0xac')][_0x147957]={'filename':_0x52f4d9['body']['attachments'][_0x147957][_0x8059('0x29')],'path':path['join'](config['root'],'server/files/attachments',_0x52f4d9[_0x8059('0x68')][_0x8059('0xac')][_0x147957][_0x8059('0xad')])};}}var _0x395849=_0x3fa779[_0x8059('0xae')]();return respondWithRpcPromise(_0x8059('0xaf'),_0x8059('0xb0'),{'account':_0x395849,'message':_0x52f4d9[_0x8059('0x68')]});})[_0x8059('0x12')](function(_0x346fe8){if(!_0x346fe8)return;_0x577a63=_0x346fe8;if(!_0x4e4380[_0x8059('0xa6')])throw new Error(_0x8059('0xb1'));if(_0x4e4380[_0x8059('0xa6')][_0x8059('0xa7')][_0x8059('0x51')])return _0x4e4380['List'][_0x8059('0xa7')][0x0];return db[_0x8059('0x8d')][_0x8059('0x6d')](_[_0x8059('0xa')](_0x52f4d9[_0x8059('0x68')],{'firstName':_0x52f4d9[_0x8059('0x68')]['to'],'email':_0x52f4d9[_0x8059('0x68')]['to'],'phone':_0x52f4d9[_0x8059('0x68')]['to'],'ListId':_0x4e4380[_0x8059('0x77')]}));})[_0x8059('0x12')](function(_0x517bea){if(!_0x517bea)return;var _0x55c413={'UserId':_0x52f4d9[_0x8059('0x38')]['id'],'ContactId':_0x517bea['id'],'MailAccountId':_0x4e4380['id'],'inReplyTo':_0x577a63[_0x8059('0xb2')],'to':_0x52f4d9[_0x8059('0x68')][_0x8059('0xab')],'cc':_0x52f4d9[_0x8059('0x68')]['cc'],'subject':_0x52f4d9[_0x8059('0x68')][_0x8059('0xb3')],'attach':_0x52f4d9[_0x8059('0x68')]['attach'],'firstMsgDirection':_0x8059('0xb4'),'lastMsgAt':moment()[_0x8059('0xa3')](_0x8059('0xb5')),'lastMsgDirection':_0x8059('0xb4'),'Messages':[_[_0x8059('0x5a')](_0x52f4d9[_0x8059('0x68')],{'messageId':_0x577a63['messageId'],'sentAt':moment()[_0x8059('0xa3')](_0x8059('0xb5')),'read':!![],'MailAccountId':_0x4e4380['id'],'UserId':_0x52f4d9['user']['id'],'ContactId':_0x517bea['id']})]};if(_0x52f4d9[_0x8059('0x68')]['Interaction']){_0x55c413=_['merge'](_0x55c413,_0x52f4d9['body'][_0x8059('0xb6')]);}return db[_0x8059('0x8b')]['create'](_0x55c413,{'include':[{'model':db[_0x8059('0xa0')],'as':_0x8059('0xb7')}]});})['then'](respondWithResult(_0x2398f4,null))[_0x8059('0x1a')](handleError(_0x2398f4,null));};exports['verifySmtp']=function(_0x56ed3a,_0x3c7c38){return db[_0x8059('0x48')][_0x8059('0x6b')]({'where':{'id':_0x56ed3a[_0x8059('0x60')]['id']},'include':[{'model':db[_0x8059('0x62')],'as':_0x8059('0x43'),'raw':!![],'include':[{'model':db[_0x8059('0xaa')],'as':_0x8059('0xaa'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x3c7c38,null))[_0x8059('0x12')](function(_0x260a09){if(!_0x260a09[_0x8059('0x43')])return;var _0x54f05b=_0x260a09[_0x8059('0xae')]();return respondWithRpcPromise(_0x8059('0xb8'),_0x8059('0xb9'),{'account':_0x54f05b});})['then'](respondWithResult(_0x3c7c38,null))[_0x8059('0x1a')](handleError(_0x3c7c38,null));};exports[_0x8059('0x24')]=function(_0x5a37e2,_0x5ecc80){return db[_0x8059('0x48')]['find']({'where':{'id':_0x5a37e2[_0x8059('0x60')]['id']}})[_0x8059('0x12')](handleEntityNotFound(_0x5ecc80,null))['then'](function(_0x5d836e){if(_0x5d836e&&_0x5d836e[_0x8059('0x40')]){throw new db[(_0x8059('0xba'))]['ValidationError'](_0x8059('0xbb'));}return _0x5d836e;})[_0x8059('0x12')](removeEntity(_0x5ecc80,null))[_0x8059('0x1a')](handleError(_0x5ecc80,null));};exports['addAgents']=function(_0x40a7d2,_0x4b92e4){return db[_0x8059('0x48')][_0x8059('0x6b')]({'where':{'id':_0x40a7d2['params']['id']}})[_0x8059('0x12')](handleEntityNotFound(_0x4b92e4,null))[_0x8059('0x12')](function(_0x459720){if(_0x459720){return _0x459720['addAgents'](_0x40a7d2[_0x8059('0x68')][_0x8059('0x71')],_['omit'](_0x40a7d2['body'],['ids','id'])||{})[_0x8059('0xbc')](function(_0x5c5a52){for(var _0x5d909a=0x0;_0x5d909a<_0x40a7d2[_0x8059('0x68')][_0x8059('0x71')][_0x8059('0x51')];_0x5d909a+=0x1){socket[_0x8059('0xbd')]('userMailAccount:save',{'UserId':Number(_0x40a7d2[_0x8059('0x68')]['ids'][_0x5d909a]),'MailAccountId':Number(_0x40a7d2[_0x8059('0x60')]['id'])});}return _0x5c5a52;});}})[_0x8059('0x12')](respondWithResult(_0x4b92e4,null))[_0x8059('0x1a')](handleError(_0x4b92e4,null));};exports[_0x8059('0xbe')]=function(_0x30aa99,_0x3b45db){return db[_0x8059('0x48')][_0x8059('0x6b')]({'where':{'id':_0x30aa99[_0x8059('0x60')]['id']}})['then'](handleEntityNotFound(_0x3b45db,null))[_0x8059('0x12')](function(_0xac848f){if(_0xac848f){return _0xac848f[_0x8059('0xbe')](_0x30aa99[_0x8059('0x4c')][_0x8059('0x71')])['then'](function(){if(_[_0x8059('0xbf')](_0x30aa99[_0x8059('0x4c')][_0x8059('0x71')])){for(var _0x96a67d=0x0;_0x96a67d<_0x30aa99[_0x8059('0x4c')][_0x8059('0x71')][_0x8059('0x51')];_0x96a67d+=0x1){socket[_0x8059('0xbd')](_0x8059('0xc0'),{'UserId':Number(_0x30aa99[_0x8059('0x4c')][_0x8059('0x71')][_0x96a67d]),'MailAccountId':Number(_0x30aa99['params']['id'])});}}else{socket[_0x8059('0xbd')]('userMailAccount:remove',{'UserId':Number(_0x30aa99[_0x8059('0x4c')][_0x8059('0x71')]),'MailAccountId':Number(_0x30aa99[_0x8059('0x60')]['id'])});}});}})[_0x8059('0x12')](respondWithStatusCode(_0x3b45db,null))[_0x8059('0x1a')](handleError(_0x3b45db,null));};exports['getAgents']=function(_0x457669,_0x371080){var _0x27225f={};var _0x1c0940={};var _0x3f101a;var _0x47271b;return db[_0x8059('0x48')][_0x8059('0x82')]({'where':{'id':_0x457669['params']['id']}})[_0x8059('0x12')](handleEntityNotFound(_0x371080,null))[_0x8059('0x12')](function(_0x338155){if(_0x338155){_0x3f101a=_0x338155;_0x1c0940[_0x8059('0x4d')]=_[_0x8059('0x63')](db[_0x8059('0xc1')]['rawAttributes']);_0x1c0940[_0x8059('0x4c')]=_[_0x8059('0x63')](_0x457669['query']);_0x1c0940[_0x8059('0x57')]=_[_0x8059('0x4f')](_0x1c0940['model'],_0x1c0940[_0x8059('0x4c')]);_0x27225f[_0x8059('0x4e')]=_[_0x8059('0x4f')](_0x1c0940[_0x8059('0x4d')],qs[_0x8059('0x50')](_0x457669[_0x8059('0x4c')][_0x8059('0x50')]));_0x27225f[_0x8059('0x4e')]=_0x27225f[_0x8059('0x4e')][_0x8059('0x51')]?_0x27225f[_0x8059('0x4e')]:_0x1c0940[_0x8059('0x4d')];_0x27225f[_0x8059('0x54')]=qs[_0x8059('0x55')](_0x457669[_0x8059('0x4c')][_0x8059('0x55')]);_0x27225f[_0x8059('0x56')]=qs['filters'](_['pick'](_0x457669[_0x8059('0x4c')],_0x1c0940['filters']));if(_0x457669[_0x8059('0x4c')][_0x8059('0x59')]){_0x27225f[_0x8059('0x56')]=_['merge'](_0x27225f['where'],{'$or':_['map'](_0x27225f['attributes'],function(_0x1f8a81){var _0x2b9376={};_0x2b9376[_0x1f8a81]={'$like':'%'+_0x457669['query'][_0x8059('0x59')]+'%'};return _0x2b9376;})});}_0x27225f=_[_0x8059('0x5a')]({},_0x27225f,_0x457669[_0x8059('0x5c')]);return _0x3f101a[_0x8059('0xc2')](_0x27225f);}})['then'](function(_0x3227f5){if(_0x3227f5){_0x47271b=_0x3227f5[_0x8059('0x51')];if(!_0x457669[_0x8059('0x4c')][_0x8059('0x52')](_0x8059('0x53'))){_0x27225f[_0x8059('0x1e')]=qs['limit'](_0x457669['query'][_0x8059('0x1e')]);_0x27225f[_0x8059('0x20')]=qs['offset'](_0x457669[_0x8059('0x4c')]['offset']);}return _0x3f101a[_0x8059('0xc2')](_0x27225f);}})[_0x8059('0x12')](function(_0x5a1bce){if(_0x5a1bce){return _0x5a1bce?{'count':_0x47271b,'rows':_0x5a1bce}:null;}})[_0x8059('0x12')](respondWithResult(_0x371080,null))[_0x8059('0x1a')](handleError(_0x371080,null));}; \ No newline at end of file +var _0xbb7a=['attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','MailServerOut','include','find','body','provider','secure','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','create','Disposition','rows','removeDispositions','addAnswer','CannedAnswer','nolimit','removeAnswers','ids','custom','email','ListId','isNil','description','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','removeImap','findOne','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','CmContact','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','priority','finally','getApplications','getMessages','MailMessage','$gte','format','inlineCss','true','CmList','List','Contacts','DESC','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','root','server/files/attachments','getSmtpOptions','SendMail','defaults','messageId','attach','YYYY-MM-DD\x20HH:mm:ss','out','Interaction','Messages','verifySmtp','CloudProvider','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','User','getAgents','moment','bluebird','path','lodash','juice','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailAccount.socket','register','http','request','then','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','end','offset','undefined','limit','count','set','update','destroy','get','MailAccounts','UserProfileResource','stack','name','send','gmail','imap.gmail.com','yahoo','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.mail.yahoo.com','hotmail','smtp-mail.outlook.com','smtp.office365.com','user','username','password','modernAuthentication','CloudProviderId','pass','host','service','authentication','Imap','port','Smtp','index','MailServerIn','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','type','key','model','query','keys','filters','intersection'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xbb7a,0x73));var _0xabb7=function(_0x8e8597,_0x4d3ff3){_0x8e8597=_0x8e8597-0x0;var _0x20d704=_0xbb7a[_0x8e8597];return _0x20d704;};'use strict';var moment=require(_0xabb7('0x0'));var BPromise=require(_0xabb7('0x1'));var util=require('util');var path=require(_0xabb7('0x2'));var _=require(_0xabb7('0x3'));var juice=require(_0xabb7('0x4'));var Redis=require('ioredis');var qs=require(_0xabb7('0x5'));var logger=require(_0xabb7('0x6'))(_0xabb7('0x7'));var config=require(_0xabb7('0x8'));var db=require(_0xabb7('0x9'))['db'];config['redis']=_['defaults'](config[_0xabb7('0xa')],{'host':_0xabb7('0xb'),'port':0x18eb});var socket=require(_0xabb7('0xc'))(new Redis(config['redis']));require(_0xabb7('0xd'))[_0xabb7('0xe')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xabb7('0xf')]({'port':0x232b});function respondWithRpcPromise(_0x35b5b0,_0x98f13b,_0x751c8a,_0x2b8d62){return new BPromise(function(_0x38e96d,_0x1a458e){var _0x4677b1=_0x2b8d62||client;return _0x4677b1[_0xabb7('0x10')](_0x35b5b0,_0x751c8a)[_0xabb7('0x11')](function(_0x8a3b65){logger['info'](_0xabb7('0x12'),_0x98f13b,'request\x20sent');logger[_0xabb7('0x13')](_0xabb7('0x14'),_0x98f13b,'request\x20sent',JSON[_0xabb7('0x15')](_0x8a3b65));if(_0x8a3b65[_0xabb7('0x16')]){if(_0x8a3b65[_0xabb7('0x16')][_0xabb7('0x17')]===0x1f4){logger['error'](_0xabb7('0x12'),_0x98f13b,_0x8a3b65[_0xabb7('0x16')][_0xabb7('0x18')]);return _0x1a458e(_0x8a3b65['error'][_0xabb7('0x18')]);}logger[_0xabb7('0x16')](_0xabb7('0x12'),_0x98f13b,_0x8a3b65[_0xabb7('0x16')][_0xabb7('0x18')]);return _0x38e96d(_0x8a3b65['error'][_0xabb7('0x18')]);}else{logger[_0xabb7('0x19')](_0xabb7('0x12'),_0x98f13b,'request\x20sent');_0x38e96d(_0x8a3b65[_0xabb7('0x1a')]['message']);}})['catch'](function(_0x53e747){logger['error'](_0xabb7('0x12'),_0x98f13b,_0x53e747);_0x1a458e(_0x53e747);});});}function respondWithStatusCode(_0x2e0f0d,_0x3dda09){_0x3dda09=_0x3dda09||0xcc;return function(_0x531e00){if(_0x531e00){return _0x2e0f0d[_0xabb7('0x1b')](_0x3dda09);}return _0x2e0f0d[_0xabb7('0x1c')](_0x3dda09)[_0xabb7('0x1d')]();};}function respondWithResult(_0x37597a,_0x4f3747){_0x4f3747=_0x4f3747||0xc8;return function(_0x2159a2){if(_0x2159a2){return _0x37597a[_0xabb7('0x1c')](_0x4f3747)['json'](_0x2159a2);}};}function respondWithFilteredResult(_0x449ea9,_0x4ccea3){return function(_0x131f97){if(_0x131f97){var _0x7e7964=typeof _0x4ccea3[_0xabb7('0x1e')]===_0xabb7('0x1f')&&typeof _0x4ccea3[_0xabb7('0x20')]===_0xabb7('0x1f');var _0x2bd891=_0x131f97[_0xabb7('0x21')];var _0x457f27=_0x7e7964?0x0:_0x4ccea3[_0xabb7('0x1e')];var _0x44e098=_0x7e7964?_0x131f97[_0xabb7('0x21')]:_0x4ccea3[_0xabb7('0x1e')]+_0x4ccea3[_0xabb7('0x20')];var _0x410fa5;if(_0x44e098>=_0x2bd891){_0x44e098=_0x2bd891;_0x410fa5=0xc8;}else{_0x410fa5=0xce;}_0x449ea9[_0xabb7('0x1c')](_0x410fa5);return _0x449ea9[_0xabb7('0x22')]('Content-Range',_0x457f27+'-'+_0x44e098+'/'+_0x2bd891)['json'](_0x131f97);}return null;};}function saveUpdates(_0x44191a){return function(_0x1590ff){if(_0x1590ff){return _0x1590ff[_0xabb7('0x23')](_0x44191a)[_0xabb7('0x11')](function(_0x5d2d72){return _0x5d2d72;});}return null;};}function removeEntity(_0x4a478e){return function(_0x3f55ea){if(_0x3f55ea){return _0x3f55ea[_0xabb7('0x24')]()[_0xabb7('0x11')](function(){var _0x42cf63=_0x3f55ea[_0xabb7('0x25')]({'plain':!![]});var _0x210de3=_0xabb7('0x26');return db[_0xabb7('0x27')]['destroy']({'where':{'type':_0x210de3,'resourceId':_0x42cf63['id']}})['then'](function(){return _0x3f55ea;});})['then'](function(){_0x4a478e[_0xabb7('0x1c')](0xcc)[_0xabb7('0x1d')]();});}};}function handleEntityNotFound(_0x717467){return function(_0x20784a){if(!_0x20784a){_0x717467[_0xabb7('0x1b')](0x194);}return _0x20784a;};}function handleError(_0x36928b,_0x3a04dc){_0x3a04dc=_0x3a04dc||0x1f4;return function(_0x247a16){logger[_0xabb7('0x16')](_0x247a16[_0xabb7('0x28')]);if(_0x247a16[_0xabb7('0x29')]){delete _0x247a16[_0xabb7('0x29')];}_0x36928b[_0xabb7('0x1c')](_0x3a04dc)[_0xabb7('0x2a')](_0x247a16);};}function getImapHost(_0x1224cf){switch(_0x1224cf){case _0xabb7('0x2b'):return _0xabb7('0x2c');case _0xabb7('0x2d'):return'imap.mail.yahoo.com';case'hotmail':return _0xabb7('0x2e');case _0xabb7('0x2f'):return _0xabb7('0x30');}throw new Error(_0xabb7('0x31'),_0x1224cf);}function getSmtpHost(_0x598c6){switch(_0x598c6){case _0xabb7('0x2b'):return'smtp.gmail.com';case _0xabb7('0x2d'):return _0xabb7('0x32');case _0xabb7('0x33'):return _0xabb7('0x34');case'outlook365':return _0xabb7('0x35');}throw new Error(_0xabb7('0x31'),_0x598c6);}function getAuthenticationOptions(_0x45c1d0,_0x14d6df){var _0x3fa62c={};var _0x5349e3={};if(_0x45c1d0){_0x3fa62c[_0xabb7('0x36')]=_0x5349e3[_0xabb7('0x36')]=_0x14d6df[_0xabb7('0x37')];_0x3fa62c[_0xabb7('0x38')]=_0x5349e3['pass']=_0x14d6df['password'];if(_0x14d6df[_0xabb7('0x39')]){_0x3fa62c[_0xabb7('0x39')]=_0x5349e3[_0xabb7('0x39')]=!![];_0x3fa62c[_0xabb7('0x3a')]=_0x5349e3['CloudProviderId']=_0x14d6df['CloudProviderId'];_0x3fa62c[_0xabb7('0x38')]=_0x5349e3[_0xabb7('0x3b')]=null;}else{_0x3fa62c[_0xabb7('0x3a')]=_0x5349e3[_0xabb7('0x3a')]=null;}_0x3fa62c[_0xabb7('0x3c')]=getImapHost(_0x45c1d0);_0x3fa62c['port']=0x3e1;_0x5349e3[_0xabb7('0x3c')]=getSmtpHost(_0x45c1d0);_0x5349e3['port']=0x24b;_0x5349e3['secure']=![];_0x3fa62c[_0xabb7('0x3d')]=_0x5349e3[_0xabb7('0x3d')]=null;}else{if(_0x14d6df[_0xabb7('0x3e')]){_0x3fa62c['user']=_0x5349e3[_0xabb7('0x36')]=_0x14d6df[_0xabb7('0x37')];_0x3fa62c[_0xabb7('0x38')]=_0x5349e3[_0xabb7('0x3b')]=_0x14d6df[_0xabb7('0x38')];}else{_0x3fa62c['authentication']=_0x5349e3[_0xabb7('0x3e')]=![];_0x3fa62c[_0xabb7('0x36')]=_0x5349e3[_0xabb7('0x36')]=null;_0x3fa62c[_0xabb7('0x38')]=_0x5349e3[_0xabb7('0x3b')]=null;}_0x3fa62c[_0xabb7('0x3c')]=_0x14d6df[_0xabb7('0x3f')]['host'];_0x3fa62c['port']=_0x14d6df[_0xabb7('0x3f')][_0xabb7('0x40')];_0x5349e3[_0xabb7('0x3c')]=_0x14d6df['Smtp'][_0xabb7('0x3c')];_0x5349e3['port']=_0x14d6df[_0xabb7('0x41')][_0xabb7('0x40')];}return{'Imap':_0x3fa62c,'Smtp':_0x5349e3};}exports[_0xabb7('0x42')]=function(_0x2a3c32,_0x2b9e7f){var _0x18a736={'include':[{'model':db[_0xabb7('0x43')],'as':_0xabb7('0x3f')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0xabb7('0x44')],'as':_0xabb7('0x45')}]},_0xa3852c={},_0x3a5d12={'count':0x0,'rows':[]};var _0x2e081f=_[_0xabb7('0x46')](db[_0xabb7('0x47')][_0xabb7('0x48')],function(_0x4b71bc){return{'name':_0x4b71bc['fieldName'],'type':_0x4b71bc[_0xabb7('0x49')][_0xabb7('0x4a')]};});_0xa3852c[_0xabb7('0x4b')]=_[_0xabb7('0x46')](_0x2e081f,_0xabb7('0x29'));_0xa3852c[_0xabb7('0x4c')]=_[_0xabb7('0x4d')](_0x2a3c32[_0xabb7('0x4c')]);_0xa3852c[_0xabb7('0x4e')]=_[_0xabb7('0x4f')](_0xa3852c['model'],_0xa3852c[_0xabb7('0x4c')]);_0x18a736[_0xabb7('0x50')]=_[_0xabb7('0x4f')](_0xa3852c[_0xabb7('0x4b')],qs[_0xabb7('0x51')](_0x2a3c32[_0xabb7('0x4c')][_0xabb7('0x51')]));_0x18a736[_0xabb7('0x50')]=_0x18a736[_0xabb7('0x50')][_0xabb7('0x52')]?_0x18a736[_0xabb7('0x50')]:_0xa3852c[_0xabb7('0x4b')];if(!_0x2a3c32[_0xabb7('0x4c')][_0xabb7('0x53')]('nolimit')){_0x18a736[_0xabb7('0x20')]=qs[_0xabb7('0x20')](_0x2a3c32['query'][_0xabb7('0x20')]);_0x18a736['offset']=qs[_0xabb7('0x1e')](_0x2a3c32[_0xabb7('0x4c')][_0xabb7('0x1e')]);}_0x18a736[_0xabb7('0x54')]=qs[_0xabb7('0x55')](_0x2a3c32['query'][_0xabb7('0x55')]);_0x18a736[_0xabb7('0x56')]=qs[_0xabb7('0x4e')](_[_0xabb7('0x57')](_0x2a3c32[_0xabb7('0x4c')],_0xa3852c[_0xabb7('0x4e')]),_0x2e081f);if(_0x2a3c32[_0xabb7('0x4c')][_0xabb7('0x58')]){_0x18a736['where']=_[_0xabb7('0x59')](_0x18a736[_0xabb7('0x56')],{'$or':_[_0xabb7('0x46')](_0x2e081f,function(_0x48a816){if(_0x48a816[_0xabb7('0x49')]!==_0xabb7('0x5a')){var _0x54c065={};_0x54c065[_0x48a816[_0xabb7('0x29')]]={'$like':'%'+_0x2a3c32[_0xabb7('0x4c')][_0xabb7('0x58')]+'%'};return _0x54c065;}})});}_0x18a736=_[_0xabb7('0x59')]({},_0x18a736,_0x2a3c32[_0xabb7('0x5b')]);var _0x20867c={'where':_0x18a736['where']};return db[_0xabb7('0x47')]['count'](_0x20867c)[_0xabb7('0x11')](function(_0x428ed2){_0x3a5d12['count']=_0x428ed2;if(_0x2a3c32['query'][_0xabb7('0x5c')]){_0x18a736['include']=[{'all':!![]}];}return db[_0xabb7('0x47')][_0xabb7('0x5d')](_0x18a736);})[_0xabb7('0x11')](function(_0x26371c){_0x3a5d12['rows']=_0x26371c;return _0x3a5d12;})[_0xabb7('0x11')](respondWithFilteredResult(_0x2b9e7f,_0x18a736))[_0xabb7('0x5e')](handleError(_0x2b9e7f,null));};exports[_0xabb7('0x5f')]=function(_0x5215f9,_0x51a016){var _0x367ec0={'raw':![],'where':{'id':_0x5215f9[_0xabb7('0x60')]['id']},'include':[{'model':db[_0xabb7('0x43')],'as':_0xabb7('0x3f')},{'model':db[_0xabb7('0x61')],'as':_0xabb7('0x41')},{'model':db[_0xabb7('0x44')],'as':_0xabb7('0x45')}]},_0x4b87cd={};_0x4b87cd[_0xabb7('0x4b')]=_[_0xabb7('0x4d')](db[_0xabb7('0x47')][_0xabb7('0x48')]);_0x4b87cd['query']=_[_0xabb7('0x4d')](_0x5215f9[_0xabb7('0x4c')]);_0x4b87cd['filters']=_[_0xabb7('0x4f')](_0x4b87cd['model'],_0x4b87cd[_0xabb7('0x4c')]);_0x367ec0[_0xabb7('0x50')]=_['intersection'](_0x4b87cd[_0xabb7('0x4b')],qs['fields'](_0x5215f9[_0xabb7('0x4c')][_0xabb7('0x51')]));_0x367ec0[_0xabb7('0x50')]=_0x367ec0[_0xabb7('0x50')][_0xabb7('0x52')]?_0x367ec0[_0xabb7('0x50')]:_0x4b87cd['model'];if(_0x5215f9['query'][_0xabb7('0x5c')]){_0x367ec0[_0xabb7('0x62')]=[{'all':!![]}];}_0x367ec0=_[_0xabb7('0x59')]({},_0x367ec0,_0x5215f9[_0xabb7('0x5b')]);return db[_0xabb7('0x47')][_0xabb7('0x63')](_0x367ec0)[_0xabb7('0x11')](handleEntityNotFound(_0x51a016,null))[_0xabb7('0x11')](respondWithResult(_0x51a016,null))['catch'](handleError(_0x51a016,null));};exports[_0xabb7('0x23')]=function(_0x10ff30,_0x244a98){if(_0x10ff30[_0xabb7('0x64')]['id']){delete _0x10ff30['body']['id'];}var _0x4711c8=_0x10ff30['body'][_0xabb7('0x65')]==='custom'?null:_0x10ff30[_0xabb7('0x64')][_0xabb7('0x65')];var _0x4342e2=_0x10ff30[_0xabb7('0x64')]['Imap']||{};var _0x28b672=_0x10ff30[_0xabb7('0x64')]['Smtp']||{};if(_0x4711c8){_0x4342e2[_0xabb7('0x3c')]=getImapHost(_0x4711c8);_0x4342e2['port']=0x3e1;_0x28b672[_0xabb7('0x3c')]=getSmtpHost(_0x4711c8);_0x28b672['port']=0x24b;_0x28b672[_0xabb7('0x66')]=![];}if(_0x28b672[_0xabb7('0x39')]){_0x28b672['secure']=![];}else{_0x28b672['CloudProviderId']=null;}if(!_0x4342e2[_0xabb7('0x39')])_0x4342e2[_0xabb7('0x3a')]=null;_0x10ff30[_0xabb7('0x64')]['Imap']=_0x4342e2;_0x10ff30['body']['Smtp']=_0x28b672;return db[_0xabb7('0x47')][_0xabb7('0x63')]({'where':{'id':_0x10ff30['params']['id']},'include':[{'model':db[_0xabb7('0x43')],'as':_0xabb7('0x3f')},{'model':db['MailServerOut'],'as':_0xabb7('0x41')},{'model':db[_0xabb7('0x44')],'as':_0xabb7('0x45')}]})[_0xabb7('0x11')](handleEntityNotFound(_0x244a98,null))[_0xabb7('0x11')](function(_0x114830){if(!_0x114830)throw new Error(_0xabb7('0x67'));if(_0x114830[_0xabb7('0x3d')])delete _0x10ff30['body'][_0xabb7('0x3f')];return _0x114830;})[_0xabb7('0x11')](saveUpdates(_0x10ff30[_0xabb7('0x64')],null))[_0xabb7('0x11')](function(_0x2732d0){if(!_0x10ff30[_0xabb7('0x64')][_0xabb7('0x3f')])return _0x2732d0;return db[_0xabb7('0x43')]['update'](_0x10ff30['body'][_0xabb7('0x3f')],{'where':{'MailAccountId':_0x2732d0['id']}})['then'](function(){return _0x2732d0;});})[_0xabb7('0x11')](function(_0x11d298){if(!_0x10ff30[_0xabb7('0x64')]['Smtp'])return _0x11d298;return db[_0xabb7('0x61')][_0xabb7('0x23')](_0x10ff30[_0xabb7('0x64')]['Smtp'],{'where':{'MailAccountId':_0x11d298['id']}})[_0xabb7('0x11')](function(){return _0x11d298;});})['then'](respondWithResult(_0x244a98,null))[_0xabb7('0x5e')](handleError(_0x244a98,null));};exports[_0xabb7('0x68')]=function(_0x2c71d5,_0x2d3987){return db[_0xabb7('0x47')][_0xabb7('0x68')]()[_0xabb7('0x11')](respondWithResult(_0x2d3987,null))[_0xabb7('0x5e')](handleError(_0x2d3987,null));};exports[_0xabb7('0x69')]=function(_0x5ae529,_0x26b83b){if(_0x5ae529['body']['id']){delete _0x5ae529[_0xabb7('0x64')]['id'];}return db[_0xabb7('0x47')][_0xabb7('0x63')]({'where':{'id':_0x5ae529[_0xabb7('0x60')]['id']}})[_0xabb7('0x11')](handleEntityNotFound(_0x26b83b,null))[_0xabb7('0x11')](function(_0x15c6f5){if(_0x15c6f5){_0x5ae529[_0xabb7('0x64')][_0xabb7('0x6a')]=_0x15c6f5['id'];return db['Disposition'][_0xabb7('0x6b')](_0x5ae529[_0xabb7('0x64')]);}})['then'](respondWithResult(_0x26b83b,null))[_0xabb7('0x5e')](handleError(_0x26b83b,null));};exports['getDispositions']=function(_0x2e62a3,_0x336bcf){var _0x6d446c={'raw':![],'where':{}};var _0x4347e3={};var _0x3a3ad5={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x2e62a3['params']['id']}})[_0xabb7('0x11')](handleEntityNotFound(_0x336bcf,null))[_0xabb7('0x11')](function(_0x4c323d){if(_0x4c323d){_0x4347e3['model']=_['keys'](db['Disposition']['rawAttributes']);_0x4347e3[_0xabb7('0x4c')]=_[_0xabb7('0x4d')](_0x2e62a3[_0xabb7('0x4c')]);_0x4347e3['filters']=_['intersection'](_0x4347e3[_0xabb7('0x4b')],_0x4347e3[_0xabb7('0x4c')]);_0x6d446c[_0xabb7('0x50')]=_['intersection'](_0x4347e3[_0xabb7('0x4b')],qs[_0xabb7('0x51')](_0x2e62a3['query'][_0xabb7('0x51')]));_0x6d446c['attributes']=_0x6d446c[_0xabb7('0x50')][_0xabb7('0x52')]?_0x6d446c['attributes']:_0x4347e3[_0xabb7('0x4b')];if(!_0x2e62a3['query'][_0xabb7('0x53')]('nolimit')){_0x6d446c[_0xabb7('0x20')]=qs[_0xabb7('0x20')](_0x2e62a3[_0xabb7('0x4c')][_0xabb7('0x20')]);_0x6d446c[_0xabb7('0x1e')]=qs['offset'](_0x2e62a3[_0xabb7('0x4c')]['offset']);}_0x6d446c[_0xabb7('0x54')]=qs[_0xabb7('0x55')](_0x2e62a3[_0xabb7('0x4c')][_0xabb7('0x55')]);_0x6d446c['where']=qs['filters'](_[_0xabb7('0x57')](_0x2e62a3['query'],_0x4347e3[_0xabb7('0x4e')]));_0x6d446c[_0xabb7('0x56')][_0xabb7('0x6a')]=_0x4c323d['id'];if(_0x2e62a3[_0xabb7('0x4c')]['filter']){_0x6d446c[_0xabb7('0x56')]=_['merge'](_0x6d446c['where'],{'$or':_[_0xabb7('0x46')](_0x6d446c[_0xabb7('0x50')],function(_0x118a6f){var _0x26d31e={};_0x26d31e[_0x118a6f]={'$like':'%'+_0x2e62a3[_0xabb7('0x4c')]['filter']+'%'};return _0x26d31e;})});}_0x6d446c=_[_0xabb7('0x59')]({},_0x6d446c,_0x2e62a3[_0xabb7('0x5b')]);return db[_0xabb7('0x6c')][_0xabb7('0x21')]({'where':_0x6d446c['where']})['then'](function(_0x4de760){_0x3a3ad5[_0xabb7('0x21')]=_0x4de760;if(_0x2e62a3[_0xabb7('0x4c')][_0xabb7('0x5c')]){_0x6d446c[_0xabb7('0x62')]=[{'all':!![]}];}return db[_0xabb7('0x6c')][_0xabb7('0x5d')](_0x6d446c);})['then'](function(_0x548800){_0x3a3ad5[_0xabb7('0x6d')]=_0x548800;return _0x3a3ad5;});}})[_0xabb7('0x11')](respondWithFilteredResult(_0x336bcf,_0x6d446c))[_0xabb7('0x5e')](handleError(_0x336bcf,null));};exports[_0xabb7('0x6e')]=function(_0x17fb7a,_0x1ef29f){return db[_0xabb7('0x47')][_0xabb7('0x63')]({'where':{'id':_0x17fb7a[_0xabb7('0x60')]['id']}})['then'](handleEntityNotFound(_0x1ef29f,null))['then'](function(_0x154868){if(_0x154868){return _0x154868[_0xabb7('0x6e')](_0x17fb7a[_0xabb7('0x4c')]['ids']);}})[_0xabb7('0x11')](respondWithStatusCode(_0x1ef29f,null))['catch'](handleError(_0x1ef29f,null));};exports[_0xabb7('0x6f')]=function(_0x5844c5,_0xd2a11b){if(_0x5844c5[_0xabb7('0x64')]['id']){delete _0x5844c5[_0xabb7('0x64')]['id'];}return db[_0xabb7('0x47')]['find']({'where':{'id':_0x5844c5[_0xabb7('0x60')]['id']}})[_0xabb7('0x11')](handleEntityNotFound(_0xd2a11b,null))[_0xabb7('0x11')](function(_0x4874ce){if(_0x4874ce){_0x5844c5[_0xabb7('0x64')]['MailAccountId']=_0x4874ce['id'];return db[_0xabb7('0x70')][_0xabb7('0x6b')](_0x5844c5['body']);}})[_0xabb7('0x11')](respondWithResult(_0xd2a11b,null))['catch'](handleError(_0xd2a11b,null));};exports['getAnswers']=function(_0x5b3e4e,_0x2a49b4){var _0x32ecad={'raw':![],'where':{}};var _0x5eaca6={};var _0x38112b={'count':0x0,'rows':[]};return db[_0xabb7('0x47')]['findOne']({'where':{'id':_0x5b3e4e[_0xabb7('0x60')]['id']}})[_0xabb7('0x11')](handleEntityNotFound(_0x2a49b4,null))[_0xabb7('0x11')](function(_0x1796f0){if(_0x1796f0){_0x5eaca6[_0xabb7('0x4b')]=_[_0xabb7('0x4d')](db[_0xabb7('0x70')]['rawAttributes']);_0x5eaca6[_0xabb7('0x4c')]=_['keys'](_0x5b3e4e[_0xabb7('0x4c')]);_0x5eaca6[_0xabb7('0x4e')]=_[_0xabb7('0x4f')](_0x5eaca6[_0xabb7('0x4b')],_0x5eaca6[_0xabb7('0x4c')]);_0x32ecad[_0xabb7('0x50')]=_[_0xabb7('0x4f')](_0x5eaca6['model'],qs[_0xabb7('0x51')](_0x5b3e4e[_0xabb7('0x4c')]['fields']));_0x32ecad['attributes']=_0x32ecad['attributes']['length']?_0x32ecad['attributes']:_0x5eaca6[_0xabb7('0x4b')];if(!_0x5b3e4e['query']['hasOwnProperty'](_0xabb7('0x71'))){_0x32ecad['limit']=qs[_0xabb7('0x20')](_0x5b3e4e[_0xabb7('0x4c')]['limit']);_0x32ecad[_0xabb7('0x1e')]=qs[_0xabb7('0x1e')](_0x5b3e4e[_0xabb7('0x4c')]['offset']);}_0x32ecad['order']=qs[_0xabb7('0x55')](_0x5b3e4e['query'][_0xabb7('0x55')]);_0x32ecad['where']=qs[_0xabb7('0x4e')](_[_0xabb7('0x57')](_0x5b3e4e[_0xabb7('0x4c')],_0x5eaca6[_0xabb7('0x4e')]));_0x32ecad[_0xabb7('0x56')]['MailAccountId']=_0x1796f0['id'];if(_0x5b3e4e['query'][_0xabb7('0x58')]){_0x32ecad['where']=_[_0xabb7('0x59')](_0x32ecad[_0xabb7('0x56')],{'$or':_[_0xabb7('0x46')](_0x32ecad[_0xabb7('0x50')],function(_0x303d86){var _0x4e35e8={};_0x4e35e8[_0x303d86]={'$like':'%'+_0x5b3e4e[_0xabb7('0x4c')][_0xabb7('0x58')]+'%'};return _0x4e35e8;})});}_0x32ecad=_[_0xabb7('0x59')]({},_0x32ecad,_0x5b3e4e[_0xabb7('0x5b')]);return db[_0xabb7('0x70')][_0xabb7('0x21')]({'where':_0x32ecad[_0xabb7('0x56')]})['then'](function(_0x2d8d88){_0x38112b['count']=_0x2d8d88;if(_0x5b3e4e['query']['includeAll']){_0x32ecad[_0xabb7('0x62')]=[{'all':!![]}];}return db[_0xabb7('0x70')][_0xabb7('0x5d')](_0x32ecad);})[_0xabb7('0x11')](function(_0x15c7c2){_0x38112b[_0xabb7('0x6d')]=_0x15c7c2;return _0x38112b;});}})[_0xabb7('0x11')](respondWithFilteredResult(_0x2a49b4,_0x32ecad))[_0xabb7('0x5e')](handleError(_0x2a49b4,null));};exports[_0xabb7('0x72')]=function(_0x29937b,_0x1b1fd){return db[_0xabb7('0x47')]['find']({'where':{'id':_0x29937b['params']['id']}})[_0xabb7('0x11')](handleEntityNotFound(_0x1b1fd,null))[_0xabb7('0x11')](function(_0xfb2070){if(_0xfb2070){return _0xfb2070[_0xabb7('0x72')](_0x29937b[_0xabb7('0x4c')][_0xabb7('0x73')]);}})['then'](respondWithStatusCode(_0x1b1fd,null))[_0xabb7('0x5e')](handleError(_0x1b1fd,null));};exports[_0xabb7('0x6b')]=function(_0x5cf466,_0x5c64c9){var _0x1c34a1={'name':_0x5cf466['body']['name'],'key':_0x5cf466[_0xabb7('0x64')][_0xabb7('0x4a')],'provider':_0x5cf466[_0xabb7('0x64')][_0xabb7('0x65')]===_0xabb7('0x74')?null:_0x5cf466[_0xabb7('0x64')]['provider'],'email':_0x5cf466[_0xabb7('0x64')][_0xabb7('0x75')],'ListId':_0x5cf466[_0xabb7('0x64')][_0xabb7('0x76')],'active':!_[_0xabb7('0x77')](_0x5cf466[_0xabb7('0x64')]['active'])?_0x5cf466['body']['active']:!![],'description':_0x5cf466[_0xabb7('0x64')][_0xabb7('0x78')]||null};var _0xc59b7f=getAuthenticationOptions(_0x1c34a1[_0xabb7('0x65')],_0x5cf466[_0xabb7('0x64')]);_0x1c34a1[_0xabb7('0x3f')]=_0xc59b7f['Imap'];_0x1c34a1[_0xabb7('0x41')]=_0xc59b7f[_0xabb7('0x41')];return db[_0xabb7('0x47')][_0xabb7('0x6b')](_0x1c34a1,{'include':[{'model':db[_0xabb7('0x61')],'as':_0xabb7('0x41')},{'model':db[_0xabb7('0x43')],'as':'Imap'}]})[_0xabb7('0x11')](function(_0x2b562c){var _0x1d3ab8=_0x5cf466[_0xabb7('0x36')][_0xabb7('0x25')]({'plain':!![]});if(!_0x1d3ab8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1d3ab8[_0xabb7('0x79')]===_0xabb7('0x36')){var _0x457fbc=_0x2b562c[_0xabb7('0x25')]({'plain':!![]});return db[_0xabb7('0x7a')][_0xabb7('0x63')]({'where':{'name':_0xabb7('0x26'),'userProfileId':_0x1d3ab8[_0xabb7('0x7b')]},'raw':!![]})[_0xabb7('0x11')](function(_0x31e340){if(_0x31e340&&_0x31e340[_0xabb7('0x7c')]===0x0){return db[_0xabb7('0x27')]['create']({'name':_0x457fbc[_0xabb7('0x29')],'resourceId':_0x457fbc['id'],'type':_0x31e340[_0xabb7('0x29')],'sectionId':_0x31e340['id']},{})[_0xabb7('0x11')](function(){return _0x2b562c;});}else{return _0x2b562c;}})['catch'](function(_0x206c30){logger[_0xabb7('0x16')](_0xabb7('0x7d'),_0x206c30);throw _0x206c30;});}return _0x2b562c;})[_0xabb7('0x11')](respondWithResult(_0x5c64c9,0xc9))[_0xabb7('0x5e')](handleError(_0x5c64c9,null));};exports['getImap']=function(_0x345e3e,_0x3023e5){return db['MailAccount']['findOne']({'where':{'id':_0x345e3e[_0xabb7('0x60')]['id']}})[_0xabb7('0x11')](handleEntityNotFound(_0x3023e5,null))['then'](function(_0x273760){if(_0x273760){return _0x273760['getImap']();}return null;})[_0xabb7('0x11')](respondWithResult(_0x3023e5,null))[_0xabb7('0x5e')](handleError(_0x3023e5,null));};exports['addImap']=function(_0x57a3e1,_0x49d938){if(_0x57a3e1[_0xabb7('0x64')]['id']){delete _0x57a3e1[_0xabb7('0x64')]['id'];}return db[_0xabb7('0x47')]['find']({'where':{'id':_0x57a3e1[_0xabb7('0x60')]['id']}})['then'](handleEntityNotFound(_0x49d938,null))['then'](function(_0x49ebff){if(_0x49ebff){_0x57a3e1[_0xabb7('0x64')][_0xabb7('0x6a')]=_0x49ebff['id'];return db[_0xabb7('0x43')][_0xabb7('0x6b')](_0x57a3e1[_0xabb7('0x64')]);}})['then'](respondWithResult(_0x49d938,null))['catch'](handleError(_0x49d938,null));};exports[_0xabb7('0x7e')]=function(_0xd5ae5b,_0x564f44){return db[_0xabb7('0x47')][_0xabb7('0x7f')]({'where':{'id':_0xd5ae5b[_0xabb7('0x60')]['id']}})[_0xabb7('0x11')](handleEntityNotFound(_0x564f44,null))[_0xabb7('0x11')](function(_0x53650a){if(_0x53650a){return _0x53650a[_0xabb7('0x80')](null);}return null;})[_0xabb7('0x11')](respondWithStatusCode(_0x564f44,null))[_0xabb7('0x5e')](handleError(_0x564f44,null));};exports['getSmtp']=function(_0x190724,_0x597050){return db[_0xabb7('0x47')][_0xabb7('0x7f')]({'where':{'id':_0x190724['params']['id']}})[_0xabb7('0x11')](handleEntityNotFound(_0x597050,null))[_0xabb7('0x11')](function(_0x293e89){if(_0x293e89){return _0x293e89[_0xabb7('0x81')]();}return null;})['then'](respondWithResult(_0x597050,null))[_0xabb7('0x5e')](handleError(_0x597050,null));};exports[_0xabb7('0x82')]=function(_0x29b73f,_0x5ca24a){if(_0x29b73f[_0xabb7('0x64')]['id']){delete _0x29b73f['body']['id'];}return db['MailAccount'][_0xabb7('0x63')]({'where':{'id':_0x29b73f[_0xabb7('0x60')]['id']}})[_0xabb7('0x11')](handleEntityNotFound(_0x5ca24a,null))[_0xabb7('0x11')](function(_0xdbf3f9){if(_0xdbf3f9){_0x29b73f[_0xabb7('0x64')][_0xabb7('0x6a')]=_0xdbf3f9['id'];return db['MailServerOut']['create'](_0x29b73f[_0xabb7('0x64')]);}})[_0xabb7('0x11')](respondWithResult(_0x5ca24a,null))[_0xabb7('0x5e')](handleError(_0x5ca24a,null));};exports[_0xabb7('0x83')]=function(_0x3f473b,_0x348e8a){return db[_0xabb7('0x47')][_0xabb7('0x7f')]({'where':{'id':_0x3f473b[_0xabb7('0x60')]['id']}})[_0xabb7('0x11')](handleEntityNotFound(_0x348e8a,null))[_0xabb7('0x11')](function(_0x1b0816){if(_0x1b0816){return _0x1b0816[_0xabb7('0x84')](null);}return null;})[_0xabb7('0x11')](respondWithStatusCode(_0x348e8a,null))[_0xabb7('0x5e')](handleError(_0x348e8a,null));};exports[_0xabb7('0x85')]=function(_0x17a688,_0x37e487){return db[_0xabb7('0x86')][_0xabb7('0x63')]({'where':{'id':_0x17a688[_0xabb7('0x60')]['id']}})[_0xabb7('0x11')](handleEntityNotFound(_0x37e487,null))[_0xabb7('0x11')](function(_0x48071d){if(_0x48071d){return _0x48071d['addInteraction'](_0x17a688[_0xabb7('0x64')]['ids'],_['omit'](_0x17a688['body'],[_0xabb7('0x73'),'id'])||{});}})['then'](respondWithResult(_0x37e487,null))['catch'](handleError(_0x37e487,null));};exports['getInteractions']=function(_0x376c5a,_0x313dae){var _0x33baf6={'raw':![],'where':{}};var _0x48f562={};var _0x10a7b7={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x376c5a['params']['id']}})['then'](handleEntityNotFound(_0x313dae,null))[_0xabb7('0x11')](function(_0x17810f){if(_0x17810f){_0x48f562['model']=_['keys'](db['MailInteraction'][_0xabb7('0x48')]);_0x48f562['query']=_['keys'](_0x376c5a[_0xabb7('0x4c')]);_0x48f562[_0xabb7('0x4e')]=_[_0xabb7('0x4f')](_0x48f562[_0xabb7('0x4b')],_0x48f562[_0xabb7('0x4c')]);_0x33baf6[_0xabb7('0x50')]=_['intersection'](_0x48f562[_0xabb7('0x4b')],qs['fields'](_0x376c5a['query']['fields']));_0x33baf6[_0xabb7('0x50')]=_0x33baf6[_0xabb7('0x50')][_0xabb7('0x52')]?_0x33baf6[_0xabb7('0x50')]:_0x48f562[_0xabb7('0x4b')];if(!_0x376c5a[_0xabb7('0x4c')]['hasOwnProperty'](_0xabb7('0x71'))){_0x33baf6[_0xabb7('0x20')]=qs[_0xabb7('0x20')](_0x376c5a[_0xabb7('0x4c')]['limit']);_0x33baf6[_0xabb7('0x1e')]=qs[_0xabb7('0x1e')](_0x376c5a[_0xabb7('0x4c')][_0xabb7('0x1e')]);}_0x33baf6[_0xabb7('0x54')]=qs['sort'](_0x376c5a[_0xabb7('0x4c')][_0xabb7('0x55')]);_0x33baf6[_0xabb7('0x56')]=qs[_0xabb7('0x4e')](_[_0xabb7('0x57')](_0x376c5a[_0xabb7('0x4c')],_0x48f562['filters']));_0x33baf6[_0xabb7('0x56')][_0xabb7('0x6a')]=_0x17810f['id'];if(_0x376c5a[_0xabb7('0x4c')]['filter']){_0x33baf6[_0xabb7('0x56')]=_['merge'](_0x33baf6[_0xabb7('0x56')],{'$or':_[_0xabb7('0x46')](_0x33baf6[_0xabb7('0x50')],function(_0x5ee95d){var _0x1d51c0={};_0x1d51c0[_0x5ee95d]={'$like':'%'+_0x376c5a[_0xabb7('0x4c')][_0xabb7('0x58')]+'%'};return _0x1d51c0;})});}_0x33baf6=_[_0xabb7('0x59')]({},_0x33baf6,_0x376c5a[_0xabb7('0x5b')]);return db[_0xabb7('0x86')][_0xabb7('0x21')]({'where':_0x33baf6[_0xabb7('0x56')]})[_0xabb7('0x11')](function(_0x1fec69){_0x10a7b7[_0xabb7('0x21')]=_0x1fec69;if(_0x376c5a[_0xabb7('0x4c')][_0xabb7('0x5c')]){_0x33baf6[_0xabb7('0x62')]=[{'model':db[_0xabb7('0x87')],'as':'Contact','required':![]},{'model':db['User'],'as':_0xabb7('0x88'),'attributes':[_0xabb7('0x29'),_0xabb7('0x89'),_0xabb7('0x8a')],'required':![]},{'model':db[_0xabb7('0x8b')],'as':_0xabb7('0x8c'),'attributes':['id',_0xabb7('0x29'),_0xabb7('0x8d')],'where':_0x376c5a[_0xabb7('0x4c')][_0xabb7('0x8e')]?{'id':_0x376c5a[_0xabb7('0x4c')][_0xabb7('0x8e')]}:undefined,'required':_0x376c5a[_0xabb7('0x4c')]['tag']?!![]:![]}];}return db[_0xabb7('0x86')][_0xabb7('0x5d')](_0x33baf6);})[_0xabb7('0x11')](function(_0xf96ad7){_0x10a7b7[_0xabb7('0x6d')]=_0xf96ad7;return _0x10a7b7;});}})['then'](respondWithFilteredResult(_0x313dae,_0x33baf6))['catch'](handleError(_0x313dae,null));};exports[_0xabb7('0x8f')]=function addApplications(_0x4c8f1f,_0x1e3872){var _0x3763ff=_0x4c8f1f[_0xabb7('0x60')]['id'];var _0x1a9f64=_0x4c8f1f[_0xabb7('0x64')];var _0x4f4ada=0xc8;var _0x3c625f=null;return db[_0xabb7('0x90')][_0xabb7('0x91')]({'isolationLevel':db[_0xabb7('0x90')][_0xabb7('0x92')][_0xabb7('0x93')][_0xabb7('0x94')]},function(_0x3e145b){return db['MailAccount'][_0xabb7('0x7f')]({'where':{'id':_0x3763ff},'transaction':_0x3e145b})[_0xabb7('0x11')](function(_0x4e5c87){if(_0x4e5c87){return db[_0xabb7('0x95')][_0xabb7('0x24')]({'where':{'MailAccountId':_0x3763ff},'transaction':_0x3e145b})['then'](function(){var _0x5327cf=_['map'](_0x1a9f64,function(_0x504289){_0x504289['MailAccountId']=_0x3763ff;return _0x504289;});return db[_0xabb7('0x95')]['bulkCreate'](_0x5327cf,{'transaction':_0x3e145b});});}else{_0x4f4ada=0x194;_0x3c625f=[];}});})[_0xabb7('0x11')](function(){if(_0x4f4ada!==0x194){return db['MailApplication'][_0xabb7('0x96')]({'where':{'MailAccountId':_0x3763ff},'order':_0xabb7('0x97')})[_0xabb7('0x11')](function(_0x448875){_0x3c625f=_0x448875;});}})['catch'](function(_0x296b57){_0x4f4ada=0x1f4;logger[_0xabb7('0x16')](_0x296b57[_0xabb7('0x28')]);if(_0x296b57[_0xabb7('0x29')]){delete _0x296b57['name'];}_0x3c625f=_0x296b57;})[_0xabb7('0x98')](function(){if(_0x3c625f===null){_0x1e3872['sendStatus'](_0x4f4ada);}else{if(_0x4f4ada===0x1f4){_0x1e3872[_0xabb7('0x1c')](_0x4f4ada)['send'](_0x3c625f);}else{_0x1e3872[_0xabb7('0x1c')](_0x4f4ada)['json'](_0x3c625f);}}});};exports[_0xabb7('0x99')]=function(_0x5ed231,_0x32e3e6){var _0x323f31={};var _0x13e052={};var _0x567ba9;var _0x235566;return db[_0xabb7('0x47')]['findOne']({'where':{'id':_0x5ed231[_0xabb7('0x60')]['id']}})[_0xabb7('0x11')](handleEntityNotFound(_0x32e3e6,null))[_0xabb7('0x11')](function(_0x42841e){if(_0x42841e){_0x567ba9=_0x42841e;_0x13e052[_0xabb7('0x4b')]=_['keys'](db['MailApplication'][_0xabb7('0x48')]);_0x13e052[_0xabb7('0x4c')]=_[_0xabb7('0x4d')](_0x5ed231[_0xabb7('0x4c')]);_0x13e052[_0xabb7('0x4e')]=_['intersection'](_0x13e052[_0xabb7('0x4b')],_0x13e052[_0xabb7('0x4c')]);_0x323f31['attributes']=_['intersection'](_0x13e052[_0xabb7('0x4b')],qs[_0xabb7('0x51')](_0x5ed231[_0xabb7('0x4c')]['fields']));_0x323f31[_0xabb7('0x50')]=_0x323f31[_0xabb7('0x50')][_0xabb7('0x52')]?_0x323f31[_0xabb7('0x50')]:_0x13e052[_0xabb7('0x4b')];_0x323f31[_0xabb7('0x54')]=qs[_0xabb7('0x55')](_0x5ed231[_0xabb7('0x4c')][_0xabb7('0x55')]);_0x323f31[_0xabb7('0x56')]=qs[_0xabb7('0x4e')](_[_0xabb7('0x57')](_0x5ed231[_0xabb7('0x4c')],_0x13e052[_0xabb7('0x4e')]));if(_0x5ed231[_0xabb7('0x4c')]['filter']){_0x323f31['where']=_['merge'](_0x323f31[_0xabb7('0x56')],{'$or':_[_0xabb7('0x46')](_0x323f31[_0xabb7('0x50')],function(_0x2c6415){var _0x5a2b5f={};_0x5a2b5f[_0x2c6415]={'$like':'%'+_0x5ed231['query'][_0xabb7('0x58')]+'%'};return _0x5a2b5f;})});}_0x323f31=_[_0xabb7('0x59')]({},_0x323f31,_0x5ed231[_0xabb7('0x5b')]);return _0x567ba9['getApplications'](_0x323f31);}})['then'](function(_0x2225ea){if(_0x2225ea){_0x235566=_0x2225ea[_0xabb7('0x52')];if(!_0x5ed231[_0xabb7('0x4c')][_0xabb7('0x53')](_0xabb7('0x71'))){_0x323f31['limit']=qs[_0xabb7('0x20')](_0x5ed231[_0xabb7('0x4c')]['limit']);_0x323f31[_0xabb7('0x1e')]=qs[_0xabb7('0x1e')](_0x5ed231[_0xabb7('0x4c')]['offset']);}return _0x567ba9[_0xabb7('0x99')](_0x323f31);}})[_0xabb7('0x11')](function(_0x1d4028){if(_0x1d4028){return _0x1d4028?{'count':_0x235566,'rows':_0x1d4028}:null;}})['then'](respondWithResult(_0x32e3e6,null))[_0xabb7('0x5e')](handleError(_0x32e3e6,null));};exports[_0xabb7('0x9a')]=function(_0x175330,_0x31307d){var _0x1d4b26={'raw':!![],'where':{}};var _0x3b6bed={};var _0x14015c={'count':0x0,'rows':[]};return db[_0xabb7('0x47')]['findOne']({'where':{'id':_0x175330[_0xabb7('0x60')]['id']}})[_0xabb7('0x11')](handleEntityNotFound(_0x31307d,null))[_0xabb7('0x11')](function(_0x269415){if(_0x269415){_0x3b6bed[_0xabb7('0x4b')]=_[_0xabb7('0x4d')](db[_0xabb7('0x9b')][_0xabb7('0x48')]);_0x3b6bed[_0xabb7('0x4c')]=_[_0xabb7('0x4d')](_0x175330['query']);_0x3b6bed[_0xabb7('0x4e')]=_[_0xabb7('0x4f')](_0x3b6bed[_0xabb7('0x4b')],_0x3b6bed[_0xabb7('0x4c')]);_0x1d4b26[_0xabb7('0x50')]=_['intersection'](_0x3b6bed[_0xabb7('0x4b')],qs[_0xabb7('0x51')](_0x175330['query'][_0xabb7('0x51')]));_0x1d4b26[_0xabb7('0x50')]=_0x1d4b26[_0xabb7('0x50')][_0xabb7('0x52')]?_0x1d4b26[_0xabb7('0x50')]:_0x3b6bed['model'];if(!_0x175330[_0xabb7('0x4c')]['hasOwnProperty'](_0xabb7('0x71'))){_0x1d4b26[_0xabb7('0x20')]=qs[_0xabb7('0x20')](_0x175330['query'][_0xabb7('0x20')]);_0x1d4b26[_0xabb7('0x1e')]=qs['offset'](_0x175330['query'][_0xabb7('0x1e')]);}_0x1d4b26[_0xabb7('0x54')]=qs[_0xabb7('0x55')](_0x175330[_0xabb7('0x4c')][_0xabb7('0x55')]);_0x1d4b26[_0xabb7('0x56')]=qs[_0xabb7('0x4e')](_[_0xabb7('0x57')](_0x175330[_0xabb7('0x4c')],_0x3b6bed[_0xabb7('0x4e')]));_0x1d4b26[_0xabb7('0x56')][_0xabb7('0x6a')]=_0x269415['id'];if(_0x175330['query']['filter']){_0x1d4b26[_0xabb7('0x56')]=_[_0xabb7('0x59')](_0x1d4b26[_0xabb7('0x56')],{'$or':_[_0xabb7('0x46')](_0x1d4b26[_0xabb7('0x50')],function(_0x4c4659){var _0x749719={};_0x749719[_0x4c4659]={'$like':'%'+_0x175330[_0xabb7('0x4c')]['filter']+'%'};return _0x749719;})});}if(_0x175330[_0xabb7('0x4c')][_0xabb7('0x9c')]){var _0xc3f6db=_0x175330[_0xabb7('0x4c')][_0xabb7('0x9c')]['split'](',');var _0x4d01fb={};_0x4d01fb[_0xc3f6db[0x0]]={'$gte':moment(_0xc3f6db[0x1])[_0xabb7('0x9d')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1d4b26['where']=_[_0xabb7('0x59')](_0x1d4b26[_0xabb7('0x56')],_0x4d01fb);}_0x1d4b26=_[_0xabb7('0x59')]({},_0x1d4b26,_0x175330[_0xabb7('0x5b')]);return db['MailMessage']['count']({'where':_0x1d4b26['where']})[_0xabb7('0x11')](function(_0x323f9b){_0x14015c[_0xabb7('0x21')]=_0x323f9b;if(_0x175330['query'][_0xabb7('0x5c')]){_0x1d4b26[_0xabb7('0x62')]=[{'all':!![]}];}return db[_0xabb7('0x9b')][_0xabb7('0x5d')](_0x1d4b26);})[_0xabb7('0x11')](function(_0xf1d3e9){if(_0x175330[_0xabb7('0x4c')][_0xabb7('0x9e')]===_0xabb7('0x9f')){for(var _0x1d6623=0x0;_0x1d6623<_0xf1d3e9[_0xabb7('0x52')];_0x1d6623++){_0xf1d3e9[_0x1d6623][_0xabb7('0x64')]=juice(_0xf1d3e9[_0x1d6623][_0xabb7('0x64')]);}}_0x14015c['rows']=_0xf1d3e9;return _0x14015c;});}})[_0xabb7('0x11')](respondWithFilteredResult(_0x31307d,_0x1d4b26))[_0xabb7('0x5e')](handleError(_0x31307d,null));};exports[_0xabb7('0x2a')]=function(_0x32cc78,_0x2399df){var _0x376062,_0x1b4b4={},_0x2db5b0;if(_0x32cc78[_0xabb7('0x64')]['to']){_0x2db5b0=_0x32cc78[_0xabb7('0x64')]['to']['split'](',')[0x0];}return db[_0xabb7('0x47')][_0xabb7('0x63')]({'where':{'id':_0x32cc78[_0xabb7('0x60')]['id']},'include':[{'model':db[_0xabb7('0xa0')],'as':_0xabb7('0xa1'),'include':[{'model':db[_0xabb7('0x87')],'as':_0xabb7('0xa2'),'where':{'email':_0x2db5b0},'limit':0x1,'order':[['updatedAt',_0xabb7('0xa3')]]}]},{'model':db[_0xabb7('0x61')],'as':_0xabb7('0x41'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})[_0xabb7('0x11')](handleEntityNotFound(_0x2399df,null))[_0xabb7('0x11')](function(_0x48a6b5){if(!_0x48a6b5)return;_0x376062=_0x48a6b5;if(!_0x48a6b5[_0xabb7('0x41')])throw new Error(_0xabb7('0xa4'));if(_[_0xabb7('0x77')](_0x32cc78['body']['from'])){_0x32cc78[_0xabb7('0x64')][_0xabb7('0xa5')]=util[_0xabb7('0x9d')](_0xabb7('0xa6'),_0x48a6b5['name'],_0x48a6b5[_0xabb7('0x75')]||_0x48a6b5[_0xabb7('0x41')][_0xabb7('0x36')]);}if(_0x32cc78[_0xabb7('0x64')]['attachments']&&_0x32cc78[_0xabb7('0x64')][_0xabb7('0xa7')][_0xabb7('0x52')]){for(var _0x102733=0x0;_0x102733<_0x32cc78[_0xabb7('0x64')][_0xabb7('0xa7')]['length'];_0x102733+=0x1){_0x32cc78[_0xabb7('0x64')]['attachments'][_0x102733]={'filename':_0x32cc78[_0xabb7('0x64')][_0xabb7('0xa7')][_0x102733]['name'],'path':path['join'](config[_0xabb7('0xa8')],_0xabb7('0xa9'),_0x32cc78[_0xabb7('0x64')][_0xabb7('0xa7')][_0x102733]['basename'])};}}var _0x17bc41=_0x48a6b5[_0xabb7('0xaa')]();return respondWithRpcPromise(_0xabb7('0xab'),'sendMail',{'account':_0x17bc41,'message':_0x32cc78[_0xabb7('0x64')]});})[_0xabb7('0x11')](function(_0x4f325d){if(!_0x4f325d)return;_0x1b4b4=_0x4f325d;if(!_0x376062[_0xabb7('0xa1')])throw new Error('List\x20not\x20found');if(_0x376062[_0xabb7('0xa1')][_0xabb7('0xa2')]['length'])return _0x376062[_0xabb7('0xa1')][_0xabb7('0xa2')][0x0];return db['CmContact'][_0xabb7('0x6b')](_[_0xabb7('0xac')](_0x32cc78[_0xabb7('0x64')],{'firstName':_0x32cc78['body']['to'],'email':_0x32cc78['body']['to'],'phone':_0x32cc78[_0xabb7('0x64')]['to'],'ListId':_0x376062[_0xabb7('0x76')]}));})['then'](function(_0x1c6585){if(!_0x1c6585)return;var _0x1d3593={'UserId':_0x32cc78[_0xabb7('0x36')]['id'],'ContactId':_0x1c6585['id'],'MailAccountId':_0x376062['id'],'inReplyTo':_0x1b4b4[_0xabb7('0xad')],'to':_0x32cc78['body'][_0xabb7('0xa5')],'cc':_0x32cc78[_0xabb7('0x64')]['cc'],'subject':_0x32cc78[_0xabb7('0x64')]['subject'],'attach':_0x32cc78[_0xabb7('0x64')][_0xabb7('0xae')],'firstMsgDirection':'out','lastMsgAt':moment()[_0xabb7('0x9d')](_0xabb7('0xaf')),'lastMsgDirection':_0xabb7('0xb0'),'Messages':[_['merge'](_0x32cc78[_0xabb7('0x64')],{'messageId':_0x1b4b4[_0xabb7('0xad')],'sentAt':moment()[_0xabb7('0x9d')](_0xabb7('0xaf')),'read':!![],'MailAccountId':_0x376062['id'],'UserId':_0x32cc78[_0xabb7('0x36')]['id'],'ContactId':_0x1c6585['id']})]};if(_0x32cc78[_0xabb7('0x64')][_0xabb7('0xb1')]){_0x1d3593=_[_0xabb7('0x59')](_0x1d3593,_0x32cc78[_0xabb7('0x64')][_0xabb7('0xb1')]);}return db[_0xabb7('0x86')][_0xabb7('0x6b')](_0x1d3593,{'include':[{'model':db[_0xabb7('0x9b')],'as':_0xabb7('0xb2')}]});})[_0xabb7('0x11')](respondWithResult(_0x2399df,null))['catch'](handleError(_0x2399df,null));};exports[_0xabb7('0xb3')]=function(_0x30ade7,_0x2b6358){return db[_0xabb7('0x47')][_0xabb7('0x63')]({'where':{'id':_0x30ade7[_0xabb7('0x60')]['id']},'include':[{'model':db[_0xabb7('0x61')],'as':_0xabb7('0x41'),'raw':!![],'include':[{'model':db[_0xabb7('0xb4')],'as':_0xabb7('0xb4'),'raw':!![]}]}]})[_0xabb7('0x11')](handleEntityNotFound(_0x2b6358,null))[_0xabb7('0x11')](function(_0x37b4be){if(!_0x37b4be[_0xabb7('0x41')])return;var _0x934d48=_0x37b4be['getSmtpOptions']();return respondWithRpcPromise(_0xabb7('0xb5'),_0xabb7('0xb3'),{'account':_0x934d48});})[_0xabb7('0x11')](respondWithResult(_0x2b6358,null))[_0xabb7('0x5e')](handleError(_0x2b6358,null));};exports[_0xabb7('0x24')]=function(_0x30ce60,_0x50c234){return db[_0xabb7('0x47')][_0xabb7('0x63')]({'where':{'id':_0x30ce60[_0xabb7('0x60')]['id']}})[_0xabb7('0x11')](handleEntityNotFound(_0x50c234,null))['then'](function(_0x5e60e4){if(_0x5e60e4&&_0x5e60e4[_0xabb7('0x3d')]){throw new db[(_0xabb7('0xb6'))][(_0xabb7('0xb7'))](_0xabb7('0xb8'));}return _0x5e60e4;})[_0xabb7('0x11')](removeEntity(_0x50c234,null))[_0xabb7('0x5e')](handleError(_0x50c234,null));};exports['addAgents']=function(_0xc051bd,_0x431fa2){return db['MailAccount']['find']({'where':{'id':_0xc051bd[_0xabb7('0x60')]['id']}})[_0xabb7('0x11')](handleEntityNotFound(_0x431fa2,null))[_0xabb7('0x11')](function(_0xa6c4d9){if(_0xa6c4d9){return _0xa6c4d9[_0xabb7('0xb9')](_0xc051bd['body'][_0xabb7('0x73')],_[_0xabb7('0xba')](_0xc051bd[_0xabb7('0x64')],[_0xabb7('0x73'),'id'])||{})[_0xabb7('0xbb')](function(_0x3b466d){for(var _0x128081=0x0;_0x128081<_0xc051bd['body'][_0xabb7('0x73')]['length'];_0x128081+=0x1){socket['emit'](_0xabb7('0xbc'),{'UserId':Number(_0xc051bd['body'][_0xabb7('0x73')][_0x128081]),'MailAccountId':Number(_0xc051bd[_0xabb7('0x60')]['id'])});}return _0x3b466d;});}})[_0xabb7('0x11')](respondWithResult(_0x431fa2,null))[_0xabb7('0x5e')](handleError(_0x431fa2,null));};exports[_0xabb7('0xbd')]=function(_0x58f522,_0x90afc1){return db[_0xabb7('0x47')][_0xabb7('0x63')]({'where':{'id':_0x58f522[_0xabb7('0x60')]['id']}})['then'](handleEntityNotFound(_0x90afc1,null))[_0xabb7('0x11')](function(_0x20e09e){if(_0x20e09e){return _0x20e09e['removeAgents'](_0x58f522[_0xabb7('0x4c')][_0xabb7('0x73')])[_0xabb7('0x11')](function(){if(_[_0xabb7('0xbe')](_0x58f522[_0xabb7('0x4c')][_0xabb7('0x73')])){for(var _0x1f82b6=0x0;_0x1f82b6<_0x58f522[_0xabb7('0x4c')][_0xabb7('0x73')]['length'];_0x1f82b6+=0x1){socket[_0xabb7('0xbf')]('userMailAccount:remove',{'UserId':Number(_0x58f522[_0xabb7('0x4c')][_0xabb7('0x73')][_0x1f82b6]),'MailAccountId':Number(_0x58f522[_0xabb7('0x60')]['id'])});}}else{socket[_0xabb7('0xbf')](_0xabb7('0xc0'),{'UserId':Number(_0x58f522['query'][_0xabb7('0x73')]),'MailAccountId':Number(_0x58f522[_0xabb7('0x60')]['id'])});}});}})[_0xabb7('0x11')](respondWithStatusCode(_0x90afc1,null))[_0xabb7('0x5e')](handleError(_0x90afc1,null));};exports['getAgents']=function(_0x457d3f,_0x2df6de){var _0x5a39a9={};var _0x254f6c={};var _0x59dc62;var _0x1ca668;return db['MailAccount'][_0xabb7('0x7f')]({'where':{'id':_0x457d3f['params']['id']}})[_0xabb7('0x11')](handleEntityNotFound(_0x2df6de,null))[_0xabb7('0x11')](function(_0x11ad80){if(_0x11ad80){_0x59dc62=_0x11ad80;_0x254f6c[_0xabb7('0x4b')]=_[_0xabb7('0x4d')](db[_0xabb7('0xc1')][_0xabb7('0x48')]);_0x254f6c['query']=_[_0xabb7('0x4d')](_0x457d3f[_0xabb7('0x4c')]);_0x254f6c[_0xabb7('0x4e')]=_[_0xabb7('0x4f')](_0x254f6c[_0xabb7('0x4b')],_0x254f6c[_0xabb7('0x4c')]);_0x5a39a9[_0xabb7('0x50')]=_[_0xabb7('0x4f')](_0x254f6c[_0xabb7('0x4b')],qs[_0xabb7('0x51')](_0x457d3f[_0xabb7('0x4c')]['fields']));_0x5a39a9[_0xabb7('0x50')]=_0x5a39a9[_0xabb7('0x50')][_0xabb7('0x52')]?_0x5a39a9['attributes']:_0x254f6c[_0xabb7('0x4b')];_0x5a39a9[_0xabb7('0x54')]=qs['sort'](_0x457d3f['query']['sort']);_0x5a39a9[_0xabb7('0x56')]=qs['filters'](_[_0xabb7('0x57')](_0x457d3f['query'],_0x254f6c['filters']));if(_0x457d3f[_0xabb7('0x4c')][_0xabb7('0x58')]){_0x5a39a9[_0xabb7('0x56')]=_['merge'](_0x5a39a9[_0xabb7('0x56')],{'$or':_['map'](_0x5a39a9['attributes'],function(_0x4724c7){var _0x36bc8d={};_0x36bc8d[_0x4724c7]={'$like':'%'+_0x457d3f[_0xabb7('0x4c')][_0xabb7('0x58')]+'%'};return _0x36bc8d;})});}_0x5a39a9=_[_0xabb7('0x59')]({},_0x5a39a9,_0x457d3f[_0xabb7('0x5b')]);return _0x59dc62['getAgents'](_0x5a39a9);}})['then'](function(_0x64f239){if(_0x64f239){_0x1ca668=_0x64f239[_0xabb7('0x52')];if(!_0x457d3f[_0xabb7('0x4c')][_0xabb7('0x53')](_0xabb7('0x71'))){_0x5a39a9[_0xabb7('0x20')]=qs[_0xabb7('0x20')](_0x457d3f[_0xabb7('0x4c')][_0xabb7('0x20')]);_0x5a39a9[_0xabb7('0x1e')]=qs[_0xabb7('0x1e')](_0x457d3f['query'][_0xabb7('0x1e')]);}return _0x59dc62[_0xabb7('0xc2')](_0x5a39a9);}})[_0xabb7('0x11')](function(_0x2ba8d4){if(_0x2ba8d4){return _0x2ba8d4?{'count':_0x1ca668,'rows':_0x2ba8d4}:null;}})[_0xabb7('0x11')](respondWithResult(_0x2df6de,null))[_0xabb7('0x5e')](handleError(_0x2df6de,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index df5b98f..0825d77 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 _0x6f76=['update','remove','emit','hasOwnProperty','hook','exports','events','MailAccount','save'];(function(_0x32e9fc,_0x4d74d7){var _0x38bbbe=function(_0x130035){while(--_0x130035){_0x32e9fc['push'](_0x32e9fc['shift']());}};_0x38bbbe(++_0x4d74d7);}(_0x6f76,0x14a));var _0x66f7=function(_0xfa6eb,_0x3ad486){_0xfa6eb=_0xfa6eb-0x0;var _0x5a4b26=_0x6f76[_0xfa6eb];return _0x5a4b26;};'use strict';var EventEmitter=require(_0x66f7('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x66f7('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x66f7('0x2'),'afterUpdate':_0x66f7('0x3'),'afterDestroy':_0x66f7('0x4')};function emitEvent(_0x18e50b){return function(_0xfe550c,_0x5ea5ef,_0x201af1){MailAccountEvents[_0x66f7('0x5')](_0x18e50b+':'+_0xfe550c['id'],_0xfe550c);MailAccountEvents[_0x66f7('0x5')](_0x18e50b,_0xfe550c);_0x201af1(null);};}for(var e in events){if(events[_0x66f7('0x6')](e)){var event=events[e];MailAccount[_0x66f7('0x7')](e,emitEvent(event));}}module[_0x66f7('0x8')]=MailAccountEvents; \ No newline at end of file +var _0xb96d=['setMaxListeners','update','remove','emit','hasOwnProperty','exports','../../mysqldb','MailAccount'];(function(_0x903228,_0x42c429){var _0xcec81d=function(_0x4da97a){while(--_0x4da97a){_0x903228['push'](_0x903228['shift']());}};_0xcec81d(++_0x42c429);}(_0xb96d,0x9e));var _0xdb96=function(_0x39e164,_0x2cb93b){_0x39e164=_0x39e164-0x0;var _0x13fa6b=_0xb96d[_0x39e164];return _0x13fa6b;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0xdb96('0x0'))['db'][_0xdb96('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xdb96('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdb96('0x3'),'afterDestroy':_0xdb96('0x4')};function emitEvent(_0x22be94){return function(_0x488b02,_0x4af3cf,_0x291c6a){MailAccountEvents[_0xdb96('0x5')](_0x22be94+':'+_0x488b02['id'],_0x488b02);MailAccountEvents[_0xdb96('0x5')](_0x22be94,_0x488b02);_0x291c6a(null);};}for(var e in events){if(events[_0xdb96('0x6')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0xdb96('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index c58b016..e94e12f 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 _0x6315=['data5','pass','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','provider','custom','service','host','Smtp','port','secure','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user'];(function(_0x9a5042,_0x191062){var _0x33e7e3=function(_0x2ac10e){while(--_0x2ac10e){_0x9a5042['push'](_0x9a5042['shift']());}};_0x33e7e3(++_0x191062);}(_0x6315,0xad));var _0x5631=function(_0x38548c,_0xd37354){_0x38548c=_0x38548c-0x0;var _0x199d62=_0x6315[_0x38548c];return _0x199d62;};'use strict';var attributes=require(_0x5631('0x0'));module[_0x5631('0x1')]=function(_0x22623e){return _0x22623e[_0x5631('0x2')](_0x5631('0x3'),attributes,{'tableName':_0x5631('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x1a9eb7=this;var _0x5d8b1a={'id':_0x1a9eb7['id'],'tls':{'rejectUnauthorized':![]}};if(_0x1a9eb7[_0x5631('0x5')]!==_0x5631('0x6')){_0x5d8b1a[_0x5631('0x7')]=_0x1a9eb7[_0x5631('0x5')];}else{_0x5d8b1a[_0x5631('0x8')]=_0x1a9eb7[_0x5631('0x9')][_0x5631('0x8')];_0x5d8b1a['port']=_0x1a9eb7[_0x5631('0x9')][_0x5631('0xa')];_0x5d8b1a[_0x5631('0xb')]=_0x1a9eb7['Smtp'][_0x5631('0xb')];}if(_0x1a9eb7['Smtp']['authentication']){if(_0x1a9eb7[_0x5631('0x9')]['modernAuthentication']){if(!_0x1a9eb7['Smtp'][_0x5631('0xc')])throw new Error(_0x5631('0xd'));_0x5d8b1a[_0x5631('0xe')]={'type':_0x5631('0xf'),'user':_0x1a9eb7[_0x5631('0x9')][_0x5631('0x10')],'accessToken':_0x1a9eb7['Smtp'][_0x5631('0xc')][_0x5631('0x11')]};}else{_0x5d8b1a['auth']={'user':_0x1a9eb7['Smtp'][_0x5631('0x10')],'pass':_0x1a9eb7[_0x5631('0x9')][_0x5631('0x12')]};}}return _0x5d8b1a;}}});}; \ No newline at end of file +var _0x25f8=['auth','user','data5','pass','./mailAccount.attributes','exports','MailAccount','mail_accounts','provider','service','host','Smtp','port','secure','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found'];(function(_0x3c7b02,_0xee1db8){var _0x3e37d1=function(_0x35fc5e){while(--_0x35fc5e){_0x3c7b02['push'](_0x3c7b02['shift']());}};_0x3e37d1(++_0xee1db8);}(_0x25f8,0x1c4));var _0x825f=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x25f8[_0x2c91e9];return _0x13f0ff;};'use strict';var attributes=require(_0x825f('0x0'));module[_0x825f('0x1')]=function(_0x52d20a){return _0x52d20a['define'](_0x825f('0x2'),attributes,{'tableName':_0x825f('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x357cc0=this;var _0x564644={'id':_0x357cc0['id'],'tls':{'rejectUnauthorized':![]}};if(_0x357cc0[_0x825f('0x4')]!=='custom'){_0x564644[_0x825f('0x5')]=_0x357cc0['provider'];}else{_0x564644[_0x825f('0x6')]=_0x357cc0[_0x825f('0x7')][_0x825f('0x6')];_0x564644[_0x825f('0x8')]=_0x357cc0['Smtp'][_0x825f('0x8')];_0x564644[_0x825f('0x9')]=_0x357cc0[_0x825f('0x7')][_0x825f('0x9')];}if(_0x357cc0[_0x825f('0x7')]['authentication']){if(_0x357cc0[_0x825f('0x7')]['modernAuthentication']){if(!_0x357cc0[_0x825f('0x7')][_0x825f('0xa')])throw new Error(_0x825f('0xb'));_0x564644[_0x825f('0xc')]={'type':'OAuth2','user':_0x357cc0[_0x825f('0x7')][_0x825f('0xd')],'accessToken':_0x357cc0[_0x825f('0x7')][_0x825f('0xa')][_0x825f('0xe')]};}else{_0x564644[_0x825f('0xc')]={'user':_0x357cc0['Smtp'][_0x825f('0xd')],'pass':_0x357cc0[_0x825f('0x7')][_0x825f('0xf')]};}}return _0x564644;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 77bba72..bb57c89 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 _0xd6d2=['request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','GetMailAccount','MailAccount','options','raw','where','attributes','include','model','map','ShowMailAccount','find','smtp','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','mail','difference','keys','CmContact','createdAt','updatedAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC','MailApplication','Applications','CloudProvider','omit','applications','list','orderBy','asc','autoclose','push','close','length','create','List\x20not\x20found','contact','messageId','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','interaction','attachments','originCc','bcc','originChannel','Email','UserId','User','name','unshift','agent','waitForTheAssignedAgent','*,*,*,*','queueId','MailQueue','queue','waitForTheAssignedQueue','startRouting','lodash','moment','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info'];(function(_0x409b99,_0x3b62af){var _0x558f77=function(_0xb66fcc){while(--_0xb66fcc){_0x409b99['push'](_0x409b99['shift']());}};_0x558f77(++_0x3b62af);}(_0xd6d2,0xcb));var _0x2d6d=function(_0x3085f6,_0x1bb614){_0x3085f6=_0x3085f6-0x0;var _0x2917a6=_0xd6d2[_0x3085f6];return _0x2917a6;};'use strict';var _=require(_0x2d6d('0x0'));var moment=require(_0x2d6d('0x1'));var BPromise=require('bluebird');var rs=require(_0x2d6d('0x2'));var Redis=require(_0x2d6d('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x2d6d('0x4'))('rpc');var config=require(_0x2d6d('0x5'));var jayson=require(_0x2d6d('0x6'));var client=jayson[_0x2d6d('0x7')]['http']({'port':0x232c});config[_0x2d6d('0x8')]=_[_0x2d6d('0x9')](config[_0x2d6d('0x8')],{'host':_0x2d6d('0xa'),'port':0x18eb});var socket=require(_0x2d6d('0xb'))(new Redis(config[_0x2d6d('0x8')]));require(_0x2d6d('0xc'))[_0x2d6d('0xd')](socket);function respondWithRpcPromise(_0x8e4be8,_0x261959,_0x1a1f60){return new BPromise(function(_0x4bf440,_0x25fc41){return client[_0x2d6d('0xe')](_0x8e4be8,_0x1a1f60)[_0x2d6d('0xf')](function(_0x3cc2fa){logger[_0x2d6d('0x10')]('MailAccount,\x20%s,\x20%s',_0x261959,_0x2d6d('0x11'));logger[_0x2d6d('0x12')](_0x2d6d('0x13'),_0x261959,_0x2d6d('0x11'),JSON[_0x2d6d('0x14')](_0x3cc2fa));if(_0x3cc2fa['error']){if(_0x3cc2fa[_0x2d6d('0x15')][_0x2d6d('0x16')]===0x1f4){logger[_0x2d6d('0x15')](_0x2d6d('0x17'),_0x261959,_0x3cc2fa['error'][_0x2d6d('0x18')]);return _0x25fc41(_0x3cc2fa[_0x2d6d('0x15')]['message']);}logger['error'](_0x2d6d('0x17'),_0x261959,_0x3cc2fa[_0x2d6d('0x15')][_0x2d6d('0x18')]);return _0x4bf440(_0x3cc2fa['error'][_0x2d6d('0x18')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x261959,'request\x20sent');_0x4bf440(_0x3cc2fa[_0x2d6d('0x19')][_0x2d6d('0x18')]);}})[_0x2d6d('0x1a')](function(_0x3c527e){logger[_0x2d6d('0x15')](_0x2d6d('0x17'),_0x261959,_0x3c527e);_0x25fc41(_0x3c527e);});});}exports[_0x2d6d('0x1b')]=function(_0xa2c4a7){var _0x31b38b=this;return new Promise(function(_0x4898a7,_0x315d13){return db[_0x2d6d('0x1c')]['findAll']({'raw':_0xa2c4a7[_0x2d6d('0x1d')]?_0xa2c4a7[_0x2d6d('0x1d')][_0x2d6d('0x1e')]===undefined?!![]:![]:!![],'where':_0xa2c4a7[_0x2d6d('0x1d')]?_0xa2c4a7[_0x2d6d('0x1d')][_0x2d6d('0x1f')]||null:null,'attributes':_0xa2c4a7['options']?_0xa2c4a7[_0x2d6d('0x1d')][_0x2d6d('0x20')]||null:null,'limit':_0xa2c4a7[_0x2d6d('0x1d')]?_0xa2c4a7['options']['limit']||null:null,'include':_0xa2c4a7[_0x2d6d('0x1d')]?_0xa2c4a7['options']['include']?_['map'](_0xa2c4a7[_0x2d6d('0x1d')][_0x2d6d('0x21')],function(_0x3da83d){return{'model':db[_0x3da83d[_0x2d6d('0x22')]],'as':_0x3da83d['as'],'attributes':_0x3da83d[_0x2d6d('0x20')],'include':_0x3da83d['include']?_[_0x2d6d('0x23')](_0x3da83d[_0x2d6d('0x21')],function(_0x455e71){return{'model':db[_0x455e71[_0x2d6d('0x22')]],'as':_0x455e71['as'],'attributes':_0x455e71[_0x2d6d('0x20')],'include':_0x455e71[_0x2d6d('0x21')]?_[_0x2d6d('0x23')](_0x455e71[_0x2d6d('0x21')],function(_0x27b7d2){return{'model':db[_0x27b7d2['model']],'as':_0x27b7d2['as'],'attributes':_0x27b7d2[_0x2d6d('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2d6d('0xf')](function(_0x2e7b32){logger[_0x2d6d('0x10')]('GetMailAccount',_0xa2c4a7);logger[_0x2d6d('0x12')]('GetMailAccount',_0xa2c4a7,JSON[_0x2d6d('0x14')](_0x2e7b32));_0x4898a7(_0x2e7b32);})['catch'](function(_0x58bfc7){logger[_0x2d6d('0x15')]('GetMailAccount',_0x58bfc7[_0x2d6d('0x18')],_0xa2c4a7);_0x315d13(_0x31b38b[_0x2d6d('0x15')](0x1f4,_0x58bfc7['message']));});});};exports[_0x2d6d('0x24')]=function(_0x4864a6){var _0xfbf3dc=this;return new Promise(function(_0x422153,_0xafd15a){return db[_0x2d6d('0x1c')][_0x2d6d('0x25')]({'raw':_0x4864a6[_0x2d6d('0x1d')]?_0x4864a6[_0x2d6d('0x1d')][_0x2d6d('0x1e')]===undefined?!![]:![]:!![],'where':_0x4864a6['options']?_0x4864a6[_0x2d6d('0x1d')][_0x2d6d('0x1f')]||null:null,'attributes':_0x4864a6['options']?_0x4864a6[_0x2d6d('0x1d')][_0x2d6d('0x20')]||null:null,'include':_0x4864a6[_0x2d6d('0x1d')]?_0x4864a6[_0x2d6d('0x1d')][_0x2d6d('0x21')]?_['map'](_0x4864a6['options']['include'],function(_0x625d2a){return{'model':db[_0x625d2a[_0x2d6d('0x22')]],'as':_0x625d2a['as'],'attributes':_0x625d2a[_0x2d6d('0x20')],'include':_0x625d2a['include']?_[_0x2d6d('0x23')](_0x625d2a[_0x2d6d('0x21')],function(_0x29dce0){return{'model':db[_0x29dce0[_0x2d6d('0x22')]],'as':_0x29dce0['as'],'attributes':_0x29dce0['attributes'],'include':_0x29dce0[_0x2d6d('0x21')]?_[_0x2d6d('0x23')](_0x29dce0[_0x2d6d('0x21')],function(_0x15f9af){return{'model':db[_0x15f9af[_0x2d6d('0x22')]],'as':_0x15f9af['as'],'attributes':_0x15f9af[_0x2d6d('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2d6d('0xf')](function(_0x5b0674){if(_0x4864a6[_0x2d6d('0x1d')][_0x2d6d('0x26')]===!![])_0x5b0674[_0x2d6d('0x27')](_0x2d6d('0x28'),_0x5b0674[_0x2d6d('0x29')]());logger['info'](_0x2d6d('0x24'),_0x4864a6);logger[_0x2d6d('0x12')](_0x2d6d('0x24'),_0x4864a6,JSON[_0x2d6d('0x14')](_0x5b0674));_0x422153(_0x5b0674);})[_0x2d6d('0x1a')](function(_0x108f7c){logger[_0x2d6d('0x15')](_0x2d6d('0x24'),_0x108f7c[_0x2d6d('0x18')],_0x4864a6);_0xafd15a(_0xfbf3dc[_0x2d6d('0x15')](0x1f4,_0x108f7c[_0x2d6d('0x18')]));});});};exports[_0x2d6d('0x2a')]=function(_0x33c6b5){var _0x1dae0a=this;return new Promise(function(_0x34fc23,_0x11c737){var _0x452417={'body':_0x33c6b5['body'],'channel':_0x2d6d('0x2b')};var _0x97b688=_[_0x2d6d('0x2c')](_[_0x2d6d('0x2d')](db[_0x2d6d('0x2e')]['rawAttributes']),[_0x2d6d('0x2f'),_0x2d6d('0x30'),_0x2d6d('0x31'),_0x2d6d('0x32')]);var _0x543b4b=![];if(_0x33c6b5[_0x2d6d('0x33')]['id']){delete _0x33c6b5[_0x2d6d('0x33')]['id'];}if(_[_0x2d6d('0x34')](_0x33c6b5[_0x2d6d('0x33')][_0x2d6d('0x35')])){return _0x11c737(_0x1dae0a['error'](0x1f4,_0x2d6d('0x36')));}if(_[_0x2d6d('0x34')](_0x33c6b5['body'][_0x2d6d('0x33')])||_0x33c6b5[_0x2d6d('0x33')][_0x2d6d('0x33')]===''){return _0x11c737(_0x1dae0a['error'](0x1f4,_0x2d6d('0x37')));}if(_[_0x2d6d('0x34')](_0x33c6b5['body']['mapKey'])){return _0x11c737(_0x1dae0a['error'](0x1f4,_0x2d6d('0x38')+_0x97b688));}if(!_[_0x2d6d('0x39')](_0x97b688,_0x33c6b5['body'][_0x2d6d('0x3a')])){return _0x11c737(_0x1dae0a[_0x2d6d('0x15')](0x1f4,_0x2d6d('0x3b')+_0x97b688));}var _0x470fb5={};_0x470fb5[_0x33c6b5['body'][_0x2d6d('0x3a')]]=_0x33c6b5[_0x2d6d('0x33')]['from'];return db[_0x2d6d('0x1c')][_0x2d6d('0x25')]({'where':{'id':_0x33c6b5[_0x2d6d('0x3c')]['id']},'include':[{'model':db[_0x2d6d('0x3d')],'as':_0x2d6d('0x3e'),'include':[{'model':db[_0x2d6d('0x2e')],'as':_0x2d6d('0x3f'),'where':_0x470fb5,'limit':0x1,'order':[['updatedAt',_0x2d6d('0x40')]]}]},{'model':db[_0x2d6d('0x41')],'as':_0x2d6d('0x42')},{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db[_0x2d6d('0x43')],'as':_0x2d6d('0x43')}]}]})[_0x2d6d('0xf')](function(_0x4e5203){if(_0x4e5203&&_0x4e5203[_0x2d6d('0x3e')]){var _0xff0b07=_0x4e5203['get']({'plain':!![]});_0x452417[_0x2d6d('0x3c')]=_[_0x2d6d('0x44')](_0xff0b07,[_0x2d6d('0x42'),_0x2d6d('0x3e')]);_0x452417[_0x2d6d('0x3c')][_0x2d6d('0x28')]=_0x4e5203[_0x2d6d('0x29')]();_0x452417[_0x2d6d('0x45')]=_0xff0b07[_0x2d6d('0x42')];_0x452417[_0x2d6d('0x46')]=_0xff0b07['List'];_0x452417[_0x2d6d('0x45')]=_[_0x2d6d('0x47')](_0x452417[_0x2d6d('0x45')],['priority'],[_0x2d6d('0x48')]);if(_0x452417[_0x2d6d('0x3c')]&&_0x452417[_0x2d6d('0x3c')][_0x2d6d('0x49')]){_0x452417[_0x2d6d('0x45')][_0x2d6d('0x4a')]({'id':0x0,'priority':_0x452417[_0x2d6d('0x45')]['length']+0x1,'app':_0x2d6d('0x4b'),'appdata':_0x2d6d('0x49'),'interval':'*,*,*,*'});}if(_0x452417[_0x2d6d('0x3c')][_0x2d6d('0x42')]){delete _0x452417['account'][_0x2d6d('0x42')];}if(_0x452417[_0x2d6d('0x3c')]['List']){delete _0x452417[_0x2d6d('0x3c')][_0x2d6d('0x3e')];}if(_0xff0b07[_0x2d6d('0x3e')][_0x2d6d('0x3f')][_0x2d6d('0x4c')]){return _0xff0b07[_0x2d6d('0x3e')][_0x2d6d('0x3f')][0x0];}var _0x566bc4=_['defaults'](_0x33c6b5[_0x2d6d('0x33')],{'firstName':_0x33c6b5['body'][_0x2d6d('0x35')],'ListId':_0xff0b07[_0x2d6d('0x32')]});_0x566bc4[_0x33c6b5[_0x2d6d('0x33')]['mapKey']]=_0x33c6b5[_0x2d6d('0x33')]['from'];return db[_0x2d6d('0x2e')][_0x2d6d('0x4d')](_0x566bc4);}else{throw new Error(_0x2d6d('0x4e'));}})[_0x2d6d('0xf')](function(_0x30402e){_0x452417[_0x2d6d('0x4f')]=_0x30402e;if(_0x30402e){if(!_0x33c6b5[_0x2d6d('0x33')][_0x2d6d('0x18')]['messageId']){_0x33c6b5[_0x2d6d('0x33')][_0x2d6d('0x18')][_0x2d6d('0x50')]=rs['generate']()+'\x20'+_0x33c6b5['body']['message'][_0x2d6d('0x35')];}var _0x4c1b4f={'ContactId':_0x30402e['id'],'MailAccountId':_0x33c6b5[_0x2d6d('0x3c')]['id'],'inReplyTo':_0x33c6b5[_0x2d6d('0x33')][_0x2d6d('0x18')][_0x2d6d('0x50')],'to':_0x33c6b5[_0x2d6d('0x33')][_0x2d6d('0x18')]['from'],'cc':_0x33c6b5[_0x2d6d('0x33')][_0x2d6d('0x18')]['cc'],'subject':_0x33c6b5[_0x2d6d('0x33')][_0x2d6d('0x18')][_0x2d6d('0x51')],'attach':_0x33c6b5[_0x2d6d('0x33')]['message'][_0x2d6d('0x52')],'lastMsgAt':moment()[_0x2d6d('0x53')](_0x2d6d('0x54')),'lastMsgDirection':'in'};return db[_0x2d6d('0x55')]['find']({'where':{'closed':![],'MailAccountId':_0x33c6b5[_0x2d6d('0x3c')]['id']},'include':[{'model':db[_0x2d6d('0x56')],'as':_0x2d6d('0x57'),'attributes':['messageId'],'where':{'messageId':_0x33c6b5[_0x2d6d('0x33')][_0x2d6d('0x18')][_0x2d6d('0x58')]}}]})['then'](function(_0x3dd1d8){if(_0x3dd1d8){return[_0x3dd1d8,![]];}return db['MailInteraction'][_0x2d6d('0x4d')](_0x4c1b4f)[_0x2d6d('0xf')](function(_0x2183ba){return[_0x2183ba,!![]];});});}else{throw new Error(_0x2d6d('0x59'));}})[_0x2d6d('0x5a')](function(_0x179721,_0x3540ed){if(_0x179721){_0x543b4b=_0x3540ed;if(!_0x3540ed){return _0x179721[_0x2d6d('0x5b')]({'inReplyTo':_0x33c6b5['body'][_0x2d6d('0x18')][_0x2d6d('0x50')],'to':_0x33c6b5[_0x2d6d('0x33')][_0x2d6d('0x18')][_0x2d6d('0x35')],'cc':_0x33c6b5['body'][_0x2d6d('0x18')]['cc'],'subject':_0x33c6b5['body'][_0x2d6d('0x18')][_0x2d6d('0x51')],'attach':_0x179721[_0x2d6d('0x52')]?_0x179721[_0x2d6d('0x52')]:_0x33c6b5[_0x2d6d('0x33')][_0x2d6d('0x18')][_0x2d6d('0x52')],'substatus':null,'substatusAt':moment()[_0x2d6d('0x53')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x2d6d('0x53')](_0x2d6d('0x54')),'lastMsgDirection':'in'});}else{return _0x179721;}}})[_0x2d6d('0xf')](function(_0x2ea00d){_0x452417[_0x2d6d('0x5c')]=_0x2ea00d['get']({'plain':!![]});_0x452417['interaction']['created']=_0x543b4b;return db[_0x2d6d('0x56')][_0x2d6d('0x4d')]({'body':_0x33c6b5[_0x2d6d('0x33')][_0x2d6d('0x33')],'MailAccountId':_0x33c6b5[_0x2d6d('0x3c')]['id'],'MailInteractionId':_0x2ea00d['id'],'direction':'in','ContactId':_0x452417[_0x2d6d('0x4f')]['id'],'messageId':_0x33c6b5[_0x2d6d('0x33')][_0x2d6d('0x18')][_0x2d6d('0x50')],'from':_0x33c6b5['body'][_0x2d6d('0x18')]['from'],'to':_0x33c6b5[_0x2d6d('0x33')][_0x2d6d('0x18')]['to'],'cc':_0x33c6b5[_0x2d6d('0x33')][_0x2d6d('0x18')]['cc'],'subject':_0x33c6b5[_0x2d6d('0x33')][_0x2d6d('0x18')]['subject'],'attach':_0x33c6b5[_0x2d6d('0x33')][_0x2d6d('0x18')]['attach'],'Attachments':_0x33c6b5[_0x2d6d('0x33')][_0x2d6d('0x18')][_0x2d6d('0x5d')],'originTo':_0x33c6b5[_0x2d6d('0x33')][_0x2d6d('0x18')]['originTo'],'originCc':_0x33c6b5[_0x2d6d('0x33')][_0x2d6d('0x18')][_0x2d6d('0x5e')],'bcc':_0x33c6b5[_0x2d6d('0x33')][_0x2d6d('0x18')][_0x2d6d('0x5f')],'ChatWebsiteId':_0x33c6b5[_0x2d6d('0x33')][_0x2d6d('0x18')]['ChatWebsiteId']||null,'originChannel':_0x33c6b5[_0x2d6d('0x33')][_0x2d6d('0x18')][_0x2d6d('0x60')]||_0x2d6d('0x61'),'ChatOfflineMessageId':_0x33c6b5['body'][_0x2d6d('0x18')]['ChatOfflineMessageId']||null},{'include':[{'model':db['Attachment'],'as':'Attachments'}]});})['then'](function(_0x54b0e0){_0x452417[_0x2d6d('0x18')]=_0x54b0e0;if(!_0x452417[_0x2d6d('0x5c')][_0x2d6d('0x62')]){return;}return db[_0x2d6d('0x63')][_0x2d6d('0x25')]({'attributes':['id',_0x2d6d('0x64')],'where':{'id':_0x452417[_0x2d6d('0x5c')]['UserId']}});})[_0x2d6d('0xf')](function(_0x92da1c){if(_0x92da1c){_0x452417['applications'][_0x2d6d('0x65')]({'id':0x0,'priority':0x0,'app':_0x2d6d('0x66'),'appdata':_0x92da1c['name']+','+(_0x452417[_0x2d6d('0x3c')][_0x2d6d('0x67')]||0xa),'interval':_0x2d6d('0x68')});}if(!_0x452417['interaction'][_0x2d6d('0x69')]){return;}return db[_0x2d6d('0x6a')][_0x2d6d('0x25')]({'attributes':['id',_0x2d6d('0x64')],'where':{'id':_0x452417[_0x2d6d('0x5c')]['queueId']}});})[_0x2d6d('0xf')](function(_0x5de755){if(_0x5de755){_0x452417[_0x2d6d('0x45')][_0x2d6d('0x65')]({'id':0x0,'priority':0x1,'app':_0x2d6d('0x6b'),'appdata':_0x5de755['name']+','+(_0x452417['account'][_0x2d6d('0x6c')]||0x12c),'interval':_0x2d6d('0x68')});}return respondWithRpcPromise('Start',_0x2d6d('0x6d'),_0x452417);})[_0x2d6d('0xf')](function(_0x4952ac){_0x34fc23(_0x4952ac);})[_0x2d6d('0x1a')](function(_0x129d20){_0x11c737(_0x1dae0a[_0x2d6d('0x15')](0x1f4,_0x129d20[_0x2d6d('0x18')]));});});}; \ No newline at end of file +var _0xfd20=['http','redis','defaults','socket.io-emitter','./mailAccount.socket','register','request','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetMailAccount','MailAccount','findAll','options','where','limit','map','include','attributes','model','then','info','catch','ShowMailAccount','smtp','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','body','mail','keys','CmContact','rawAttributes','createdAt','updatedAt','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','find','CmList','Contacts','DESC','MailServerOut','Smtp','CloudProvider','List','account','omit','Applications','applications','list','orderBy','asc','autoclose','push','close','*,*,*,*','length','create','contact','messageId','generate','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','inReplyTo','spread','update','subject','interaction','created','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','moment','ioredis','../../mysqldb','rpc','jayson/promise','client'];(function(_0xf2fe16,_0x183bae){var _0x7f2b7b=function(_0x515166){while(--_0x515166){_0xf2fe16['push'](_0xf2fe16['shift']());}};_0x7f2b7b(++_0x183bae);}(_0xfd20,0x66));var _0x0fd2=function(_0x4809f1,_0x44933e){_0x4809f1=_0x4809f1-0x0;var _0x289ff9=_0xfd20[_0x4809f1];return _0x289ff9;};'use strict';var _=require('lodash');var moment=require(_0x0fd2('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var Redis=require(_0x0fd2('0x1'));var db=require(_0x0fd2('0x2'))['db'];var logger=require('../../config/logger')(_0x0fd2('0x3'));var config=require('../../config/environment');var jayson=require(_0x0fd2('0x4'));var client=jayson[_0x0fd2('0x5')][_0x0fd2('0x6')]({'port':0x232c});config[_0x0fd2('0x7')]=_[_0x0fd2('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0fd2('0x9'))(new Redis(config[_0x0fd2('0x7')]));require(_0x0fd2('0xa'))[_0x0fd2('0xb')](socket);function respondWithRpcPromise(_0x3996dc,_0x195948,_0x1a0f34){return new BPromise(function(_0x4a95a5,_0x39b9a7){return client[_0x0fd2('0xc')](_0x3996dc,_0x1a0f34)['then'](function(_0x336d8b){logger['info'](_0x0fd2('0xd'),_0x195948,_0x0fd2('0xe'));logger[_0x0fd2('0xf')](_0x0fd2('0x10'),_0x195948,_0x0fd2('0xe'),JSON[_0x0fd2('0x11')](_0x336d8b));if(_0x336d8b[_0x0fd2('0x12')]){if(_0x336d8b[_0x0fd2('0x12')]['code']===0x1f4){logger['error'](_0x0fd2('0xd'),_0x195948,_0x336d8b[_0x0fd2('0x12')][_0x0fd2('0x13')]);return _0x39b9a7(_0x336d8b[_0x0fd2('0x12')]['message']);}logger[_0x0fd2('0x12')]('MailAccount,\x20%s,\x20%s',_0x195948,_0x336d8b['error'][_0x0fd2('0x13')]);return _0x4a95a5(_0x336d8b['error'][_0x0fd2('0x13')]);}else{logger['info'](_0x0fd2('0xd'),_0x195948,'request\x20sent');_0x4a95a5(_0x336d8b[_0x0fd2('0x14')][_0x0fd2('0x13')]);}})['catch'](function(_0x2b25d2){logger['error'](_0x0fd2('0xd'),_0x195948,_0x2b25d2);_0x39b9a7(_0x2b25d2);});});}exports[_0x0fd2('0x15')]=function(_0x3fb07e){var _0x11b423=this;return new Promise(function(_0x2977ef,_0x34e110){return db[_0x0fd2('0x16')][_0x0fd2('0x17')]({'raw':_0x3fb07e[_0x0fd2('0x18')]?_0x3fb07e[_0x0fd2('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3fb07e['options']?_0x3fb07e['options'][_0x0fd2('0x19')]||null:null,'attributes':_0x3fb07e[_0x0fd2('0x18')]?_0x3fb07e['options']['attributes']||null:null,'limit':_0x3fb07e[_0x0fd2('0x18')]?_0x3fb07e[_0x0fd2('0x18')][_0x0fd2('0x1a')]||null:null,'include':_0x3fb07e[_0x0fd2('0x18')]?_0x3fb07e[_0x0fd2('0x18')]['include']?_[_0x0fd2('0x1b')](_0x3fb07e[_0x0fd2('0x18')][_0x0fd2('0x1c')],function(_0x54cce1){return{'model':db[_0x54cce1['model']],'as':_0x54cce1['as'],'attributes':_0x54cce1[_0x0fd2('0x1d')],'include':_0x54cce1[_0x0fd2('0x1c')]?_['map'](_0x54cce1[_0x0fd2('0x1c')],function(_0x429fef){return{'model':db[_0x429fef[_0x0fd2('0x1e')]],'as':_0x429fef['as'],'attributes':_0x429fef[_0x0fd2('0x1d')],'include':_0x429fef[_0x0fd2('0x1c')]?_[_0x0fd2('0x1b')](_0x429fef[_0x0fd2('0x1c')],function(_0x25720e){return{'model':db[_0x25720e['model']],'as':_0x25720e['as'],'attributes':_0x25720e[_0x0fd2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0fd2('0x1f')](function(_0x235c90){logger[_0x0fd2('0x20')](_0x0fd2('0x15'),_0x3fb07e);logger['debug'](_0x0fd2('0x15'),_0x3fb07e,JSON[_0x0fd2('0x11')](_0x235c90));_0x2977ef(_0x235c90);})[_0x0fd2('0x21')](function(_0x1a7a98){logger[_0x0fd2('0x12')](_0x0fd2('0x15'),_0x1a7a98[_0x0fd2('0x13')],_0x3fb07e);_0x34e110(_0x11b423[_0x0fd2('0x12')](0x1f4,_0x1a7a98['message']));});});};exports[_0x0fd2('0x22')]=function(_0x48c373){var _0x568ac0=this;return new Promise(function(_0x1828cc,_0x553715){return db[_0x0fd2('0x16')]['find']({'raw':_0x48c373[_0x0fd2('0x18')]?_0x48c373['options']['raw']===undefined?!![]:![]:!![],'where':_0x48c373[_0x0fd2('0x18')]?_0x48c373[_0x0fd2('0x18')][_0x0fd2('0x19')]||null:null,'attributes':_0x48c373['options']?_0x48c373['options'][_0x0fd2('0x1d')]||null:null,'include':_0x48c373['options']?_0x48c373[_0x0fd2('0x18')][_0x0fd2('0x1c')]?_[_0x0fd2('0x1b')](_0x48c373[_0x0fd2('0x18')][_0x0fd2('0x1c')],function(_0x2975fb){return{'model':db[_0x2975fb[_0x0fd2('0x1e')]],'as':_0x2975fb['as'],'attributes':_0x2975fb['attributes'],'include':_0x2975fb[_0x0fd2('0x1c')]?_[_0x0fd2('0x1b')](_0x2975fb['include'],function(_0x5dbe7b){return{'model':db[_0x5dbe7b[_0x0fd2('0x1e')]],'as':_0x5dbe7b['as'],'attributes':_0x5dbe7b['attributes'],'include':_0x5dbe7b['include']?_[_0x0fd2('0x1b')](_0x5dbe7b[_0x0fd2('0x1c')],function(_0x2aa966){return{'model':db[_0x2aa966[_0x0fd2('0x1e')]],'as':_0x2aa966['as'],'attributes':_0x2aa966[_0x0fd2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0fd2('0x1f')](function(_0x2f907c){if(_0x48c373[_0x0fd2('0x18')][_0x0fd2('0x23')]===!![])_0x2f907c[_0x0fd2('0x24')](_0x0fd2('0x25'),_0x2f907c[_0x0fd2('0x26')]());logger[_0x0fd2('0x20')](_0x0fd2('0x22'),_0x48c373);logger[_0x0fd2('0xf')](_0x0fd2('0x22'),_0x48c373,JSON['stringify'](_0x2f907c));_0x1828cc(_0x2f907c);})[_0x0fd2('0x21')](function(_0x134d31){logger[_0x0fd2('0x12')](_0x0fd2('0x22'),_0x134d31['message'],_0x48c373);_0x553715(_0x568ac0[_0x0fd2('0x12')](0x1f4,_0x134d31['message']));});});};exports[_0x0fd2('0x27')]=function(_0x2c33bd){var _0x539348=this;return new Promise(function(_0x43e585,_0x29828a){var _0xe3f07e={'body':_0x2c33bd[_0x0fd2('0x28')],'channel':_0x0fd2('0x29')};var _0x3cb07b=_['difference'](_[_0x0fd2('0x2a')](db[_0x0fd2('0x2b')][_0x0fd2('0x2c')]),[_0x0fd2('0x2d'),_0x0fd2('0x2e'),'CompanyId',_0x0fd2('0x2f')]);var _0x2e804d=![];if(_0x2c33bd['body']['id']){delete _0x2c33bd[_0x0fd2('0x28')]['id'];}if(_[_0x0fd2('0x30')](_0x2c33bd[_0x0fd2('0x28')][_0x0fd2('0x31')])){return _0x29828a(_0x539348[_0x0fd2('0x12')](0x1f4,_0x0fd2('0x32')));}if(_[_0x0fd2('0x30')](_0x2c33bd[_0x0fd2('0x28')]['body'])||_0x2c33bd['body'][_0x0fd2('0x28')]===''){return _0x29828a(_0x539348[_0x0fd2('0x12')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x0fd2('0x30')](_0x2c33bd['body'][_0x0fd2('0x33')])){return _0x29828a(_0x539348[_0x0fd2('0x12')](0x1f4,_0x0fd2('0x34')+_0x3cb07b));}if(!_[_0x0fd2('0x35')](_0x3cb07b,_0x2c33bd[_0x0fd2('0x28')][_0x0fd2('0x33')])){return _0x29828a(_0x539348['error'](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3cb07b));}var _0x1070e5={};_0x1070e5[_0x2c33bd['body'][_0x0fd2('0x33')]]=_0x2c33bd[_0x0fd2('0x28')][_0x0fd2('0x31')];return db[_0x0fd2('0x16')][_0x0fd2('0x36')]({'where':{'id':_0x2c33bd['account']['id']},'include':[{'model':db[_0x0fd2('0x37')],'as':'List','include':[{'model':db[_0x0fd2('0x2b')],'as':_0x0fd2('0x38'),'where':_0x1070e5,'limit':0x1,'order':[['updatedAt',_0x0fd2('0x39')]]}]},{'model':db['MailApplication'],'as':'Applications'},{'model':db[_0x0fd2('0x3a')],'as':_0x0fd2('0x3b'),'include':[{'model':db[_0x0fd2('0x3c')],'as':'CloudProvider'}]}]})[_0x0fd2('0x1f')](function(_0x119e21){if(_0x119e21&&_0x119e21[_0x0fd2('0x3d')]){var _0xcbfd28=_0x119e21['get']({'plain':!![]});_0xe3f07e[_0x0fd2('0x3e')]=_[_0x0fd2('0x3f')](_0xcbfd28,[_0x0fd2('0x40'),_0x0fd2('0x3d')]);_0xe3f07e[_0x0fd2('0x3e')][_0x0fd2('0x25')]=_0x119e21[_0x0fd2('0x26')]();_0xe3f07e[_0x0fd2('0x41')]=_0xcbfd28[_0x0fd2('0x40')];_0xe3f07e[_0x0fd2('0x42')]=_0xcbfd28[_0x0fd2('0x3d')];_0xe3f07e['applications']=_[_0x0fd2('0x43')](_0xe3f07e[_0x0fd2('0x41')],['priority'],[_0x0fd2('0x44')]);if(_0xe3f07e['account']&&_0xe3f07e[_0x0fd2('0x3e')][_0x0fd2('0x45')]){_0xe3f07e[_0x0fd2('0x41')][_0x0fd2('0x46')]({'id':0x0,'priority':_0xe3f07e[_0x0fd2('0x41')]['length']+0x1,'app':_0x0fd2('0x47'),'appdata':_0x0fd2('0x45'),'interval':_0x0fd2('0x48')});}if(_0xe3f07e['account']['Applications']){delete _0xe3f07e[_0x0fd2('0x3e')][_0x0fd2('0x40')];}if(_0xe3f07e[_0x0fd2('0x3e')][_0x0fd2('0x3d')]){delete _0xe3f07e[_0x0fd2('0x3e')][_0x0fd2('0x3d')];}if(_0xcbfd28['List'][_0x0fd2('0x38')][_0x0fd2('0x49')]){return _0xcbfd28[_0x0fd2('0x3d')][_0x0fd2('0x38')][0x0];}var _0x379524=_[_0x0fd2('0x8')](_0x2c33bd[_0x0fd2('0x28')],{'firstName':_0x2c33bd[_0x0fd2('0x28')][_0x0fd2('0x31')],'ListId':_0xcbfd28[_0x0fd2('0x2f')]});_0x379524[_0x2c33bd[_0x0fd2('0x28')][_0x0fd2('0x33')]]=_0x2c33bd[_0x0fd2('0x28')]['from'];return db[_0x0fd2('0x2b')][_0x0fd2('0x4a')](_0x379524);}else{throw new Error('List\x20not\x20found');}})[_0x0fd2('0x1f')](function(_0x43ac2f){_0xe3f07e[_0x0fd2('0x4b')]=_0x43ac2f;if(_0x43ac2f){if(!_0x2c33bd[_0x0fd2('0x28')]['message']['messageId']){_0x2c33bd['body'][_0x0fd2('0x13')][_0x0fd2('0x4c')]=rs[_0x0fd2('0x4d')]()+'\x20'+_0x2c33bd[_0x0fd2('0x28')][_0x0fd2('0x13')][_0x0fd2('0x31')];}var _0x47343a={'ContactId':_0x43ac2f['id'],'MailAccountId':_0x2c33bd[_0x0fd2('0x3e')]['id'],'inReplyTo':_0x2c33bd[_0x0fd2('0x28')][_0x0fd2('0x13')]['messageId'],'to':_0x2c33bd['body']['message']['from'],'cc':_0x2c33bd['body'][_0x0fd2('0x13')]['cc'],'subject':_0x2c33bd['body'][_0x0fd2('0x13')]['subject'],'attach':_0x2c33bd[_0x0fd2('0x28')]['message'][_0x0fd2('0x4e')],'lastMsgAt':moment()[_0x0fd2('0x4f')](_0x0fd2('0x50')),'lastMsgDirection':'in'};return db['MailInteraction']['find']({'where':{'closed':![],'MailAccountId':_0x2c33bd[_0x0fd2('0x3e')]['id']},'include':[{'model':db[_0x0fd2('0x51')],'as':_0x0fd2('0x52'),'attributes':[_0x0fd2('0x4c')],'where':{'messageId':_0x2c33bd[_0x0fd2('0x28')][_0x0fd2('0x13')][_0x0fd2('0x53')]}}]})[_0x0fd2('0x1f')](function(_0x3da3bb){if(_0x3da3bb){return[_0x3da3bb,![]];}return db['MailInteraction'][_0x0fd2('0x4a')](_0x47343a)[_0x0fd2('0x1f')](function(_0x293a32){return[_0x293a32,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x0fd2('0x54')](function(_0x5243e4,_0x3659b6){if(_0x5243e4){_0x2e804d=_0x3659b6;if(!_0x3659b6){return _0x5243e4[_0x0fd2('0x55')]({'inReplyTo':_0x2c33bd[_0x0fd2('0x28')][_0x0fd2('0x13')][_0x0fd2('0x4c')],'to':_0x2c33bd[_0x0fd2('0x28')][_0x0fd2('0x13')][_0x0fd2('0x31')],'cc':_0x2c33bd['body'][_0x0fd2('0x13')]['cc'],'subject':_0x2c33bd[_0x0fd2('0x28')]['message'][_0x0fd2('0x56')],'attach':_0x5243e4[_0x0fd2('0x4e')]?_0x5243e4[_0x0fd2('0x4e')]:_0x2c33bd['body'][_0x0fd2('0x13')][_0x0fd2('0x4e')],'substatus':null,'substatusAt':moment()[_0x0fd2('0x4f')](_0x0fd2('0x50')),'lastMsgAt':moment()[_0x0fd2('0x4f')](_0x0fd2('0x50')),'lastMsgDirection':'in'});}else{return _0x5243e4;}}})[_0x0fd2('0x1f')](function(_0x23f786){_0xe3f07e[_0x0fd2('0x57')]=_0x23f786['get']({'plain':!![]});_0xe3f07e[_0x0fd2('0x57')][_0x0fd2('0x58')]=_0x2e804d;return db[_0x0fd2('0x51')]['create']({'body':_0x2c33bd[_0x0fd2('0x28')][_0x0fd2('0x28')],'MailAccountId':_0x2c33bd[_0x0fd2('0x3e')]['id'],'MailInteractionId':_0x23f786['id'],'direction':'in','ContactId':_0xe3f07e[_0x0fd2('0x4b')]['id'],'messageId':_0x2c33bd[_0x0fd2('0x28')]['message']['messageId'],'from':_0x2c33bd[_0x0fd2('0x28')][_0x0fd2('0x13')][_0x0fd2('0x31')],'to':_0x2c33bd[_0x0fd2('0x28')][_0x0fd2('0x13')]['to'],'cc':_0x2c33bd[_0x0fd2('0x28')][_0x0fd2('0x13')]['cc'],'subject':_0x2c33bd[_0x0fd2('0x28')]['message'][_0x0fd2('0x56')],'attach':_0x2c33bd[_0x0fd2('0x28')][_0x0fd2('0x13')][_0x0fd2('0x4e')],'Attachments':_0x2c33bd['body'][_0x0fd2('0x13')][_0x0fd2('0x59')],'originTo':_0x2c33bd[_0x0fd2('0x28')][_0x0fd2('0x13')][_0x0fd2('0x5a')],'originCc':_0x2c33bd[_0x0fd2('0x28')][_0x0fd2('0x13')][_0x0fd2('0x5b')],'bcc':_0x2c33bd[_0x0fd2('0x28')]['message'][_0x0fd2('0x5c')],'ChatWebsiteId':_0x2c33bd[_0x0fd2('0x28')][_0x0fd2('0x13')][_0x0fd2('0x5d')]||null,'originChannel':_0x2c33bd[_0x0fd2('0x28')][_0x0fd2('0x13')][_0x0fd2('0x5e')]||_0x0fd2('0x5f'),'ChatOfflineMessageId':_0x2c33bd['body'][_0x0fd2('0x13')][_0x0fd2('0x60')]||null},{'include':[{'model':db[_0x0fd2('0x61')],'as':_0x0fd2('0x62')}]});})[_0x0fd2('0x1f')](function(_0x5bb23a){_0xe3f07e['message']=_0x5bb23a;if(!_0xe3f07e[_0x0fd2('0x57')][_0x0fd2('0x63')]){return;}return db[_0x0fd2('0x64')]['find']({'attributes':['id',_0x0fd2('0x65')],'where':{'id':_0xe3f07e[_0x0fd2('0x57')][_0x0fd2('0x63')]}});})[_0x0fd2('0x1f')](function(_0x155c8d){if(_0x155c8d){_0xe3f07e[_0x0fd2('0x41')][_0x0fd2('0x66')]({'id':0x0,'priority':0x0,'app':_0x0fd2('0x67'),'appdata':_0x155c8d[_0x0fd2('0x65')]+','+(_0xe3f07e[_0x0fd2('0x3e')][_0x0fd2('0x68')]||0xa),'interval':_0x0fd2('0x48')});}if(!_0xe3f07e[_0x0fd2('0x57')][_0x0fd2('0x69')]){return;}return db['MailQueue'][_0x0fd2('0x36')]({'attributes':['id',_0x0fd2('0x65')],'where':{'id':_0xe3f07e[_0x0fd2('0x57')]['queueId']}});})[_0x0fd2('0x1f')](function(_0x19c3af){if(_0x19c3af){_0xe3f07e[_0x0fd2('0x41')][_0x0fd2('0x66')]({'id':0x0,'priority':0x1,'app':_0x0fd2('0x6a'),'appdata':_0x19c3af[_0x0fd2('0x65')]+','+(_0xe3f07e[_0x0fd2('0x3e')][_0x0fd2('0x6b')]||0x12c),'interval':_0x0fd2('0x48')});}return respondWithRpcPromise('Start','startRouting',_0xe3f07e);})['then'](function(_0x126232){_0x43e585(_0x126232);})[_0x0fd2('0x21')](function(_0x1172cf){_0x29828a(_0x539348[_0x0fd2('0x12')](0x1f4,_0x1172cf[_0x0fd2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 7767950..4a2fb07 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 _0x2324=['mailAccount:','remove','update','emit','removeListener'];(function(_0x47f111,_0x4f7664){var _0x4ad5f0=function(_0x473fb4){while(--_0x473fb4){_0x47f111['push'](_0x47f111['shift']());}};_0x4ad5f0(++_0x4f7664);}(_0x2324,0x1c3));var _0x4232=function(_0x2e04c1,_0x3583e9){_0x2e04c1=_0x2e04c1-0x0;var _0x5b8c8e=_0x2324[_0x2e04c1];return _0x5b8c8e;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=['save',_0x4232('0x0'),_0x4232('0x1')];function createListener(_0x1ab2b9,_0x4e8cc3){return function(_0xc36026){_0x4e8cc3[_0x4232('0x2')](_0x1ab2b9,_0xc36026);};}function removeListener(_0x66b0f5,_0x5adc3e){return function(){MailAccountEvents[_0x4232('0x3')](_0x66b0f5,_0x5adc3e);};}exports['register']=function(_0xd96974){for(var _0x6e288a=0x0,_0x2fcee5=events['length'];_0x6e288a<_0x2fcee5;_0x6e288a++){var _0x376316=events[_0x6e288a];var _0x7c54cd=createListener(_0x4232('0x4')+_0x376316,_0xd96974);MailAccountEvents['on'](_0x376316,_0x7c54cd);}}; \ No newline at end of file +var _0xefb3=['removeListener','register','length','mailAccount:','update'];(function(_0x24717a,_0x26f6dc){var _0x32cf54=function(_0x1282a6){while(--_0x1282a6){_0x24717a['push'](_0x24717a['shift']());}};_0x32cf54(++_0x26f6dc);}(_0xefb3,0x167));var _0x3efb=function(_0x135b32,_0xf0715d){_0x135b32=_0x135b32-0x0;var _0x1cad85=_0xefb3[_0x135b32];return _0x1cad85;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=['save','remove',_0x3efb('0x0')];function createListener(_0x5725bf,_0x26a499){return function(_0x5f9e19){_0x26a499['emit'](_0x5725bf,_0x5f9e19);};}function removeListener(_0xd45be7,_0x15d30a){return function(){MailAccountEvents[_0x3efb('0x1')](_0xd45be7,_0x15d30a);};}exports[_0x3efb('0x2')]=function(_0x3efc7f){for(var _0x309485=0x0,_0x29b8d2=events[_0x3efb('0x3')];_0x309485<_0x29b8d2;_0x309485++){var _0x58f75a=events[_0x309485];var _0x2b07a6=createListener(_0x3efb('0x4')+_0x58f75a,_0x3efc7f);MailAccountEvents['on'](_0x58f75a,_0x2b07a6);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 879171f..fa01a2f 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 _0xe62b=['destroy','multer','express','fs-extra','../../components/auth/service','./mailApplication.controller','get','/:id','show','put','isAuthenticated','update','delete'];(function(_0x986c6b,_0x315b81){var _0xf15eaf=function(_0x141305){while(--_0x141305){_0x986c6b['push'](_0x986c6b['shift']());}};_0xf15eaf(++_0x315b81);}(_0xe62b,0x1bb));var _0xbe62=function(_0x38a660,_0x3a6593){_0x38a660=_0x38a660-0x0;var _0x5a601c=_0xe62b[_0x38a660];return _0x5a601c;};'use strict';var multer=require(_0xbe62('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe62('0x1'));var router=express['Router']();var fs_extra=require(_0xbe62('0x2'));var auth=require(_0xbe62('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe62('0x4'));router[_0xbe62('0x5')](_0xbe62('0x6'),auth['isAuthenticated'](),controller[_0xbe62('0x7')]);router[_0xbe62('0x8')](_0xbe62('0x6'),auth[_0xbe62('0x9')](),controller[_0xbe62('0xa')]);router[_0xbe62('0xb')](_0xbe62('0x6'),auth[_0xbe62('0x9')](),controller[_0xbe62('0xc')]);module['exports']=router; \ No newline at end of file +var _0x76df=['../../components/interaction/service','../../config/environment','./mailApplication.controller','/:id','isAuthenticated','show','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x285800,_0x26765e){var _0x4b809e=function(_0x12c58b){while(--_0x12c58b){_0x285800['push'](_0x285800['shift']());}};_0x4b809e(++_0x26765e);}(_0x76df,0x179));var _0xf76d=function(_0x30faee,_0x1c3794){_0x30faee=_0x30faee-0x0;var _0x3a90ab=_0x76df[_0x30faee];return _0x3a90ab;};'use strict';var multer=require(_0xf76d('0x0'));var util=require(_0xf76d('0x1'));var path=require(_0xf76d('0x2'));var timeout=require(_0xf76d('0x3'));var express=require(_0xf76d('0x4'));var router=express[_0xf76d('0x5')]();var fs_extra=require(_0xf76d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf76d('0x7'));var config=require(_0xf76d('0x8'));var controller=require(_0xf76d('0x9'));router['get'](_0xf76d('0xa'),auth[_0xf76d('0xb')](),controller[_0xf76d('0xc')]);router[_0xf76d('0xd')](_0xf76d('0xa'),auth[_0xf76d('0xb')](),controller[_0xf76d('0xe')]);router['delete'](_0xf76d('0xa'),auth[_0xf76d('0xb')](),controller[_0xf76d('0xf')]);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 3757092..4e3c921 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 _0x6d5f=['noop','TEXT','*,*,*,*','exports','INTEGER','STRING'];(function(_0x29c8b0,_0x192653){var _0x5924f6=function(_0x1b1250){while(--_0x1b1250){_0x29c8b0['push'](_0x29c8b0['shift']());}};_0x5924f6(++_0x192653);}(_0x6d5f,0x1ad));var _0xf6d5=function(_0x5dda30,_0x1cc8cc){_0x5dda30=_0x5dda30-0x0;var _0x134885=_0x6d5f[_0x5dda30];return _0x134885;};'use strict';var Sequelize=require('sequelize');module[_0xf6d5('0x0')]={'priority':{'type':Sequelize[_0xf6d5('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xf6d5('0x2')],'allowNull':![],'defaultValue':_0xf6d5('0x3')},'appdata':{'type':Sequelize[_0xf6d5('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xf6d5('0x2')],'defaultValue':_0xf6d5('0x5')}}; \ No newline at end of file +var _0x2fc4=['INTEGER','noop','TEXT','*,*,*,*','exports'];(function(_0x5ee769,_0x561a77){var _0xc37b7f=function(_0x65091b){while(--_0x65091b){_0x5ee769['push'](_0x5ee769['shift']());}};_0xc37b7f(++_0x561a77);}(_0x2fc4,0x153));var _0x42fc=function(_0x15a38e,_0x245139){_0x15a38e=_0x15a38e-0x0;var _0xf67c25=_0x2fc4[_0x15a38e];return _0xf67c25;};'use strict';var Sequelize=require('sequelize');module[_0x42fc('0x0')]={'priority':{'type':Sequelize[_0x42fc('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x42fc('0x2')},'appdata':{'type':Sequelize[_0x42fc('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x42fc('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 5d95592..e0d2207 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 _0x9c44=['Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','show','params','model','keys','MailApplication','rawAttributes','query','attributes','intersection','fields','length','includeAll','include','merge','options','find','then','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set'];(function(_0x41cf04,_0x41e49b){var _0x270ada=function(_0x7625d1){while(--_0x7625d1){_0x41cf04['push'](_0x41cf04['shift']());}};_0x270ada(++_0x41e49b);}(_0x9c44,0x178));var _0x49c4=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x9c44[_0x36c5b0];return _0xf19333;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={'raw':!![],'where':{'id':_0x5987ae[_0x49c4('0x29')]['id']}},_0x46e04d={};_0x46e04d[_0x49c4('0x2a')]=_[_0x49c4('0x2b')](db[_0x49c4('0x2c')][_0x49c4('0x2d')]);_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2b')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d['filters']=_['intersection'](_0x46e04d['model'],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x2f')]=_[_0x49c4('0x30')](_0x46e04d[_0x49c4('0x2a')],qs[_0x49c4('0x31')](_0x5987ae['query'][_0x49c4('0x31')]));_0x2b2793[_0x49c4('0x2f')]=_0x2b2793[_0x49c4('0x2f')][_0x49c4('0x32')]?_0x2b2793['attributes']:_0x46e04d['model'];if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x33')]){_0x2b2793[_0x49c4('0x34')]=[{'all':!![]}];}_0x2b2793=_[_0x49c4('0x35')]({},_0x2b2793,_0x5987ae[_0x49c4('0x36')]);return db['MailApplication'][_0x49c4('0x37')](_0x2b2793)[_0x49c4('0x38')](handleEntityNotFound(_0x889909,null))[_0x49c4('0x38')](respondWithResult(_0x889909,null))['catch'](handleError(_0x889909,null));};exports['update']=function(_0x85dce2,_0x1991e9){if(_0x85dce2[_0x49c4('0x39')]['id']){delete _0x85dce2[_0x49c4('0x39')]['id'];}return db[_0x49c4('0x2c')][_0x49c4('0x37')]({'where':{'id':_0x85dce2[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x1991e9,null))[_0x49c4('0x38')](saveUpdates(_0x85dce2['body'],null))[_0x49c4('0x38')](respondWithResult(_0x1991e9,null))['catch'](handleError(_0x1991e9,null));};exports[_0x49c4('0x23')]=function(_0x349791,_0x2625a6){return db[_0x49c4('0x2c')]['find']({'where':{'id':_0x349791[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x2625a6,null))[_0x49c4('0x38')](removeEntity(_0x2625a6,null))['catch'](handleError(_0x2625a6,null));}; \ No newline at end of file +var _0x9c44=['Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','show','params','model','keys','MailApplication','rawAttributes','query','attributes','intersection','fields','length','includeAll','include','merge','options','find','then','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set'];(function(_0x2c9056,_0x552f14){var _0x3e6959=function(_0x556247){while(--_0x556247){_0x2c9056['push'](_0x2c9056['shift']());}};_0x3e6959(++_0x552f14);}(_0x9c44,0x178));var _0x49c4=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x9c44[_0x1694f5];return _0x5b4321;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={'raw':!![],'where':{'id':_0x5987ae[_0x49c4('0x29')]['id']}},_0x46e04d={};_0x46e04d[_0x49c4('0x2a')]=_[_0x49c4('0x2b')](db[_0x49c4('0x2c')][_0x49c4('0x2d')]);_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2b')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d['filters']=_['intersection'](_0x46e04d['model'],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x2f')]=_[_0x49c4('0x30')](_0x46e04d[_0x49c4('0x2a')],qs[_0x49c4('0x31')](_0x5987ae['query'][_0x49c4('0x31')]));_0x2b2793[_0x49c4('0x2f')]=_0x2b2793[_0x49c4('0x2f')][_0x49c4('0x32')]?_0x2b2793['attributes']:_0x46e04d['model'];if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x33')]){_0x2b2793[_0x49c4('0x34')]=[{'all':!![]}];}_0x2b2793=_[_0x49c4('0x35')]({},_0x2b2793,_0x5987ae[_0x49c4('0x36')]);return db['MailApplication'][_0x49c4('0x37')](_0x2b2793)[_0x49c4('0x38')](handleEntityNotFound(_0x889909,null))[_0x49c4('0x38')](respondWithResult(_0x889909,null))['catch'](handleError(_0x889909,null));};exports['update']=function(_0x85dce2,_0x1991e9){if(_0x85dce2[_0x49c4('0x39')]['id']){delete _0x85dce2[_0x49c4('0x39')]['id'];}return db[_0x49c4('0x2c')][_0x49c4('0x37')]({'where':{'id':_0x85dce2[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x1991e9,null))[_0x49c4('0x38')](saveUpdates(_0x85dce2['body'],null))[_0x49c4('0x38')](respondWithResult(_0x1991e9,null))['catch'](handleError(_0x1991e9,null));};exports[_0x49c4('0x23')]=function(_0x349791,_0x2625a6){return db[_0x49c4('0x2c')]['find']({'where':{'id':_0x349791[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x2625a6,null))[_0x49c4('0x38')](removeEntity(_0x2625a6,null))['catch'](handleError(_0x2625a6,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 24de0e3..e7d0dca 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 _0x4c22=['define','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailApplication.attributes','exports'];(function(_0x1fe378,_0x43ea7e){var _0x562e94=function(_0x3dbbd4){while(--_0x3dbbd4){_0x1fe378['push'](_0x1fe378['shift']());}};_0x562e94(++_0x43ea7e);}(_0x4c22,0x6c));var _0x24c2=function(_0x53c7c1,_0x3e83ec){_0x53c7c1=_0x53c7c1-0x0;var _0x41185e=_0x4c22[_0x53c7c1];return _0x41185e;};'use strict';var _=require(_0x24c2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x24c2('0x1'));var moment=require(_0x24c2('0x2'));var BPromise=require(_0x24c2('0x3'));var rp=require(_0x24c2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x24c2('0x5'));var config=require(_0x24c2('0x6'));var attributes=require(_0x24c2('0x7'));module[_0x24c2('0x8')]=function(_0x3544b5,_0x1808b4){return _0x3544b5[_0x24c2('0x9')]('MailApplication',attributes,{'tableName':_0x24c2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x24c2('0xb'),'collate':_0x24c2('0xc')});}; \ No newline at end of file +var _0x86e8=['rimraf','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','lodash','util','api','moment','bluebird','path'];(function(_0x52d1e1,_0x21224c){var _0x3049e7=function(_0x5923d8){while(--_0x5923d8){_0x52d1e1['push'](_0x52d1e1['shift']());}};_0x3049e7(++_0x21224c);}(_0x86e8,0x1ce));var _0x886e=function(_0x4dc59d,_0x522e5e){_0x4dc59d=_0x4dc59d-0x0;var _0x2ea9e5=_0x86e8[_0x4dc59d];return _0x2ea9e5;};'use strict';var _=require(_0x886e('0x0'));var util=require(_0x886e('0x1'));var logger=require('../../config/logger')(_0x886e('0x2'));var moment=require(_0x886e('0x3'));var BPromise=require(_0x886e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x886e('0x5'));var rimraf=require(_0x886e('0x6'));var config=require('../../config/environment');var attributes=require(_0x886e('0x7'));module[_0x886e('0x8')]=function(_0x3d1543,_0x11b45a){return _0x3d1543[_0x886e('0x9')](_0x886e('0xa'),attributes,{'tableName':_0x886e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x886e('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 580392d..cc5c9eb 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 _0x21f3=['result','catch','UpdateMailApplication','MailApplication','update','body','options','where','attributes','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','MailApplication,\x20%s,\x20%s','message'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x21f3,0x85));var _0x321f=function(_0x1fe669,_0x1cbb92){_0x1fe669=_0x1fe669-0x0;var _0x187928=_0x21f3[_0x1fe669];return _0x187928;};'use strict';var _=require(_0x321f('0x0'));var util=require('util');var moment=require(_0x321f('0x1'));var BPromise=require(_0x321f('0x2'));var rs=require(_0x321f('0x3'));var fs=require('fs');var Redis=require(_0x321f('0x4'));var db=require(_0x321f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x321f('0x6'))(_0x321f('0x7'));var config=require(_0x321f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x321f('0x9')][_0x321f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4617eb,_0x5f2b6b,_0x43d319){return new BPromise(function(_0x1044c5,_0x412c4d){return client[_0x321f('0xb')](_0x4617eb,_0x43d319)[_0x321f('0xc')](function(_0x15762d){logger[_0x321f('0xd')]('MailApplication,\x20%s,\x20%s',_0x5f2b6b,_0x321f('0xe'));logger[_0x321f('0xf')](_0x321f('0x10'),_0x5f2b6b,_0x321f('0xe'),JSON[_0x321f('0x11')](_0x15762d));if(_0x15762d[_0x321f('0x12')]){if(_0x15762d['error'][_0x321f('0x13')]===0x1f4){logger['error'](_0x321f('0x14'),_0x5f2b6b,_0x15762d[_0x321f('0x12')][_0x321f('0x15')]);return _0x412c4d(_0x15762d['error'][_0x321f('0x15')]);}logger['error'](_0x321f('0x14'),_0x5f2b6b,_0x15762d[_0x321f('0x12')][_0x321f('0x15')]);return _0x1044c5(_0x15762d[_0x321f('0x12')][_0x321f('0x15')]);}else{logger['info'](_0x321f('0x14'),_0x5f2b6b,_0x321f('0xe'));_0x1044c5(_0x15762d[_0x321f('0x16')][_0x321f('0x15')]);}})[_0x321f('0x17')](function(_0x2fcaee){logger[_0x321f('0x12')](_0x321f('0x14'),_0x5f2b6b,_0x2fcaee);_0x412c4d(_0x2fcaee);});});}exports[_0x321f('0x18')]=function(_0x1cd44e){var _0x494f9e=this;return new Promise(function(_0x29678e,_0x241c10){return db[_0x321f('0x19')][_0x321f('0x1a')](_0x1cd44e[_0x321f('0x1b')],{'raw':_0x1cd44e[_0x321f('0x1c')]?_0x1cd44e[_0x321f('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1cd44e[_0x321f('0x1c')]?_0x1cd44e['options'][_0x321f('0x1d')]||null:null,'attributes':_0x1cd44e['options']?_0x1cd44e['options'][_0x321f('0x1e')]||null:null,'limit':_0x1cd44e[_0x321f('0x1c')]?_0x1cd44e[_0x321f('0x1c')]['limit']||null:null})[_0x321f('0xc')](function(_0x18f637){logger[_0x321f('0xd')](_0x321f('0x18'),_0x1cd44e);logger['debug'](_0x321f('0x18'),_0x1cd44e,JSON[_0x321f('0x11')](_0x18f637));_0x29678e(_0x18f637);})[_0x321f('0x17')](function(_0x40c63a){logger[_0x321f('0x12')](_0x321f('0x18'),_0x40c63a[_0x321f('0x15')],_0x1cd44e);_0x241c10(_0x494f9e[_0x321f('0x12')](0x1f4,_0x40c63a[_0x321f('0x15')]));});});}; \ No newline at end of file +var _0xbe58=['UpdateMailApplication','MailApplication','update','options','where','attributes','limit','then','debug','stringify','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','MailApplication,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch'];(function(_0x46ae5a,_0x2a38d0){var _0x434986=function(_0x22735d){while(--_0x22735d){_0x46ae5a['push'](_0x46ae5a['shift']());}};_0x434986(++_0x2a38d0);}(_0xbe58,0x19f));var _0x8be5=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xbe58[_0xc4001c];return _0x49f7bc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8be5('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8be5('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x8be5('0x2'));var logger=require(_0x8be5('0x3'))(_0x8be5('0x4'));var config=require(_0x8be5('0x5'));var jayson=require(_0x8be5('0x6'));var client=jayson[_0x8be5('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fdbb6,_0x61c95,_0x22ed1f){return new BPromise(function(_0xb9d4df,_0x9d6c40){return client[_0x8be5('0x8')](_0x4fdbb6,_0x22ed1f)['then'](function(_0x364658){logger[_0x8be5('0x9')](_0x8be5('0xa'),_0x61c95,_0x8be5('0xb'));logger['debug']('MailApplication,\x20%s,\x20%s,\x20%s',_0x61c95,_0x8be5('0xb'),JSON['stringify'](_0x364658));if(_0x364658[_0x8be5('0xc')]){if(_0x364658[_0x8be5('0xc')][_0x8be5('0xd')]===0x1f4){logger[_0x8be5('0xc')](_0x8be5('0xa'),_0x61c95,_0x364658['error'][_0x8be5('0xe')]);return _0x9d6c40(_0x364658[_0x8be5('0xc')]['message']);}logger[_0x8be5('0xc')](_0x8be5('0xa'),_0x61c95,_0x364658['error']['message']);return _0xb9d4df(_0x364658['error'][_0x8be5('0xe')]);}else{logger[_0x8be5('0x9')](_0x8be5('0xa'),_0x61c95,_0x8be5('0xb'));_0xb9d4df(_0x364658[_0x8be5('0xf')][_0x8be5('0xe')]);}})[_0x8be5('0x10')](function(_0x3ea19c){logger['error'](_0x8be5('0xa'),_0x61c95,_0x3ea19c);_0x9d6c40(_0x3ea19c);});});}exports[_0x8be5('0x11')]=function(_0x526ea7){var _0x59494a=this;return new Promise(function(_0x1d4c79,_0x1d0139){return db[_0x8be5('0x12')][_0x8be5('0x13')](_0x526ea7['body'],{'raw':_0x526ea7[_0x8be5('0x14')]?_0x526ea7[_0x8be5('0x14')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x526ea7[_0x8be5('0x14')]?_0x526ea7[_0x8be5('0x14')][_0x8be5('0x15')]||null:null,'attributes':_0x526ea7[_0x8be5('0x14')]?_0x526ea7[_0x8be5('0x14')][_0x8be5('0x16')]||null:null,'limit':_0x526ea7[_0x8be5('0x14')]?_0x526ea7[_0x8be5('0x14')][_0x8be5('0x17')]||null:null})[_0x8be5('0x18')](function(_0x20777d){logger[_0x8be5('0x9')](_0x8be5('0x11'),_0x526ea7);logger[_0x8be5('0x19')](_0x8be5('0x11'),_0x526ea7,JSON[_0x8be5('0x1a')](_0x20777d));_0x1d4c79(_0x20777d);})[_0x8be5('0x10')](function(_0x2d57f5){logger['error'](_0x8be5('0x11'),_0x2d57f5[_0x8be5('0xe')],_0x526ea7);_0x1d0139(_0x59494a[_0x8be5('0xc')](0x1f4,_0x2d57f5[_0x8be5('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 805dc60..5ec474f 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 _0x56d5=['/:id/download','post','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','put','mailinteraction:update','update','mailinteraction:destroy','destroy','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','/:id/messages','getMessages'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x56d5,0x1ae));var _0x556d=function(_0x7e5685,_0x34dfa2){_0x7e5685=_0x7e5685-0x0;var _0x1e6604=_0x56d5[_0x7e5685];return _0x1e6604;};'use strict';var express=require(_0x556d('0x0'));var router=express[_0x556d('0x1')]();var auth=require(_0x556d('0x2'));var interaction=require(_0x556d('0x3'));var controller=require('./mailInteraction.controller');router[_0x556d('0x4')]('/',auth['isAuthenticated'](),controller[_0x556d('0x5')]);router[_0x556d('0x4')](_0x556d('0x6'),auth[_0x556d('0x7')](),controller[_0x556d('0x8')]);router['get'](_0x556d('0x9'),auth[_0x556d('0x7')](),controller['show']);router[_0x556d('0x4')](_0x556d('0xa'),auth[_0x556d('0x7')](),controller[_0x556d('0xb')]);router[_0x556d('0x4')](_0x556d('0xc'),auth[_0x556d('0x7')](),controller['download']);router[_0x556d('0xd')]('/',auth[_0x556d('0x7')](),controller['create']);router[_0x556d('0xd')](_0x556d('0xa'),auth[_0x556d('0x7')](),controller[_0x556d('0xe')]);router['post'](_0x556d('0xf'),auth[_0x556d('0x7')](),interaction[_0x556d('0x10')](_0x556d('0x11'),_0x556d('0x12')),controller['addTags']);router[_0x556d('0x13')](_0x556d('0x9'),auth[_0x556d('0x7')](),interaction[_0x556d('0x10')](_0x556d('0x11'),_0x556d('0x14')),controller[_0x556d('0x15')]);router['delete'](_0x556d('0x9'),auth[_0x556d('0x7')](),interaction[_0x556d('0x10')](_0x556d('0x11'),_0x556d('0x16')),controller[_0x556d('0x17')]);router['delete'](_0x556d('0xf'),auth[_0x556d('0x7')](),controller[_0x556d('0x18')]);module[_0x556d('0x19')]=router; \ No newline at end of file +var _0xd8e5=['update','destroy','delete','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','tracked','mail','addTags','mailinteraction:update'];(function(_0x5202f9,_0x300a19){var _0x136d7e=function(_0x5bb26c){while(--_0x5bb26c){_0x5202f9['push'](_0x5202f9['shift']());}};_0x136d7e(++_0x300a19);}(_0xd8e5,0x75));var _0x5d8e=function(_0x21dfe2,_0x3c157d){_0x21dfe2=_0x21dfe2-0x0;var _0x454e1e=_0xd8e5[_0x21dfe2];return _0x454e1e;};'use strict';var express=require(_0x5d8e('0x0'));var router=express[_0x5d8e('0x1')]();var auth=require(_0x5d8e('0x2'));var interaction=require(_0x5d8e('0x3'));var controller=require(_0x5d8e('0x4'));router[_0x5d8e('0x5')]('/',auth[_0x5d8e('0x6')](),controller[_0x5d8e('0x7')]);router['get'](_0x5d8e('0x8'),auth[_0x5d8e('0x6')](),controller[_0x5d8e('0x9')]);router[_0x5d8e('0x5')](_0x5d8e('0xa'),auth[_0x5d8e('0x6')](),controller[_0x5d8e('0xb')]);router['get'](_0x5d8e('0xc'),auth[_0x5d8e('0x6')](),controller[_0x5d8e('0xd')]);router[_0x5d8e('0x5')](_0x5d8e('0xe'),auth['isAuthenticated'](),controller[_0x5d8e('0xf')]);router[_0x5d8e('0x10')]('/',auth[_0x5d8e('0x6')](),controller[_0x5d8e('0x11')]);router[_0x5d8e('0x10')](_0x5d8e('0xc'),auth['isAuthenticated'](),controller['addMessage']);router[_0x5d8e('0x10')](_0x5d8e('0x12'),auth[_0x5d8e('0x6')](),interaction[_0x5d8e('0x13')](_0x5d8e('0x14'),'mailinteraction:addtags'),controller[_0x5d8e('0x15')]);router['put'](_0x5d8e('0xa'),auth['isAuthenticated'](),interaction[_0x5d8e('0x13')](_0x5d8e('0x14'),_0x5d8e('0x16')),controller[_0x5d8e('0x17')]);router['delete'](_0x5d8e('0xa'),auth[_0x5d8e('0x6')](),interaction[_0x5d8e('0x13')]('mail','mailinteraction:destroy'),controller[_0x5d8e('0x18')]);router[_0x5d8e('0x19')]('/:id/tags',auth['isAuthenticated'](),controller[_0x5d8e('0x1a')]);module[_0x5d8e('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 c85cad7..1fccc51 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 _0x9690=['long','ENUM','out','INTEGER','sequelize','iconv','exports','BOOLEAN','DATE','STRING','TEXT'];(function(_0x806a40,_0x5181cd){var _0x58b632=function(_0xf3ed9d){while(--_0xf3ed9d){_0x806a40['push'](_0x806a40['shift']());}};_0x58b632(++_0x5181cd);}(_0x9690,0xbf));var _0x0969=function(_0x11dff1,_0x328ba2){_0x11dff1=_0x11dff1-0x0;var _0x1bb175=_0x9690[_0x11dff1];return _0x1bb175;};'use strict';var Sequelize=require(_0x0969('0x0'));var iconv=require(_0x0969('0x1'));module[_0x0969('0x2')]={'closed':{'type':Sequelize[_0x0969('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0969('0x4')]},'disposition':{'type':Sequelize[_0x0969('0x5')]},'secondDisposition':{'type':Sequelize[_0x0969('0x5')]},'thirdDisposition':{'type':Sequelize[_0x0969('0x5')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x0969('0x5')](0x1fe)},'to':{'type':Sequelize[_0x0969('0x5')]},'cc':{'type':Sequelize[_0x0969('0x6')](_0x0969('0x7'))},'subject':{'type':Sequelize[_0x0969('0x6')]()},'attach':{'type':Sequelize[_0x0969('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x0969('0x4')]},'substatus':{'type':Sequelize[_0x0969('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0x0969('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x0969('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x0969('0x8')]('in',_0x0969('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x0969('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x0969('0xa')]}}; \ No newline at end of file +var _0x1b3c=['long','BOOLEAN','ENUM','out','INTEGER','sequelize','iconv','exports','DATE','STRING','TEXT'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1b3c,0x9f));var _0xc1b3=function(_0x54c447,_0x4a1a2b){_0x54c447=_0x54c447-0x0;var _0x5193df=_0x1b3c[_0x54c447];return _0x5193df;};'use strict';var Sequelize=require(_0xc1b3('0x0'));var iconv=require(_0xc1b3('0x1'));module[_0xc1b3('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc1b3('0x3')]},'disposition':{'type':Sequelize[_0xc1b3('0x4')]},'secondDisposition':{'type':Sequelize[_0xc1b3('0x4')]},'thirdDisposition':{'type':Sequelize[_0xc1b3('0x4')]},'note':{'type':Sequelize[_0xc1b3('0x4')]},'inReplyTo':{'type':Sequelize[_0xc1b3('0x4')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xc1b3('0x5')](_0xc1b3('0x6'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0xc1b3('0x7')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0xc1b3('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0xc1b3('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xc1b3('0x8')]('in',_0xc1b3('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xc1b3('0x8')]('in',_0xc1b3('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xc1b3('0xa')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index e5ee3be..84cd5ac 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 _0x5a00=['push','Attachment','Attachments','Messages','from','subject','get','mkdirSync','each','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','bcc','headers','Bcc','basename','existsSync','writeFileSync','message%d.eml','eml-format','rimraf','zip-dir','moment','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','html-entities','redis','defaults','./mailInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','update','then','destroy','error','name','MailInteraction','fieldName','getOptions','query','params','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','body','catch','describe','addMessage','MailMessage','ids','findOne','hasOwnProperty','order','sort','where','pick','MailInteractionId','filter','map','$gte','format','findAll','inlineCss','rows','addTags','setTags','emit','mailInteractionTags:save','removeTags','download','unix','toString','join','server','files','root','attachments'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5a00,0x7a));var _0x05a0=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x5a00[_0x243b2f];return _0xcb3c2d;};'use strict';var emlformat=require(_0x05a0('0x0'));var rimraf=require(_0x05a0('0x1'));var zipdir=require(_0x05a0('0x2'));var moment=require(_0x05a0('0x3'));var BPromise=require(_0x05a0('0x4'));var util=require(_0x05a0('0x5'));var path=require(_0x05a0('0x6'));var fs=require('fs');var _=require(_0x05a0('0x7'));var juice=require(_0x05a0('0x8'));var Redis=require(_0x05a0('0x9'));var interaction=require('../../components/interaction/service');var qs=require(_0x05a0('0xa'));var logger=require(_0x05a0('0xb'))(_0x05a0('0xc'));var config=require(_0x05a0('0xd'));var db=require('../../mysqldb')['db'];var htmlEntities=require(_0x05a0('0xe'));config[_0x05a0('0xf')]=_[_0x05a0('0x10')](config[_0x05a0('0xf')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x05a0('0xf')]));require(_0x05a0('0x11'))[_0x05a0('0x12')](socket);function respondWithStatusCode(_0x2e2741,_0x128c71){_0x128c71=_0x128c71||0xcc;return function(_0x32c7cd){if(_0x32c7cd){return _0x2e2741[_0x05a0('0x13')](_0x128c71);}return _0x2e2741[_0x05a0('0x14')](_0x128c71)[_0x05a0('0x15')]();};}function respondWithResult(_0x8510a5,_0x4c5017){_0x4c5017=_0x4c5017||0xc8;return function(_0x53ea70){if(_0x53ea70){return _0x8510a5[_0x05a0('0x14')](_0x4c5017)['json'](_0x53ea70);}};}function respondWithFilteredResult(_0x401820,_0x94233d){return function(_0x32a73c){if(_0x32a73c){var _0x112df3=typeof _0x94233d[_0x05a0('0x16')]===_0x05a0('0x17')&&typeof _0x94233d[_0x05a0('0x18')]===_0x05a0('0x17');var _0x469fe3=_0x32a73c[_0x05a0('0x19')];var _0x4b6175=_0x112df3?0x0:_0x94233d[_0x05a0('0x16')];var _0xdbe331=_0x112df3?_0x32a73c['count']:_0x94233d[_0x05a0('0x16')]+_0x94233d['limit'];var _0x398824;if(_0xdbe331>=_0x469fe3){_0xdbe331=_0x469fe3;_0x398824=0xc8;}else{_0x398824=0xce;}_0x401820[_0x05a0('0x14')](_0x398824);return _0x401820[_0x05a0('0x1a')]('Content-Range',_0x4b6175+'-'+_0xdbe331+'/'+_0x469fe3)[_0x05a0('0x1b')](_0x32a73c);}return null;};}function saveUpdates(_0x43c82a){return function(_0x3f8d64){if(_0x3f8d64){return _0x3f8d64[_0x05a0('0x1c')](_0x43c82a)[_0x05a0('0x1d')](function(_0x5bb63d){return _0x5bb63d;});}return null;};}function removeEntity(_0x597dde){return function(_0xe63d94){if(_0xe63d94){return _0xe63d94[_0x05a0('0x1e')]()[_0x05a0('0x1d')](function(){_0x597dde[_0x05a0('0x14')](0xcc)[_0x05a0('0x15')]();});}};}function handleEntityNotFound(_0x1e48e7){return function(_0x4a16ef){if(!_0x4a16ef){_0x1e48e7[_0x05a0('0x13')](0x194);}return _0x4a16ef;};}function handleError(_0x38e013,_0x52542e){_0x52542e=_0x52542e||0x1f4;return function(_0x59d683){logger[_0x05a0('0x1f')](_0x59d683['stack']);if(_0x59d683[_0x05a0('0x20')]){delete _0x59d683['name'];}_0x38e013[_0x05a0('0x14')](_0x52542e)['send'](_0x59d683);};}exports['index']=function(_0x4b15ce,_0x5ba09b){var _0x353ecd={};var _0x54c813=_['map'](db[_0x05a0('0x21')]['rawAttributes'],function(_0x3e9ccf){return{'name':_0x3e9ccf[_0x05a0('0x22')],'type':_0x3e9ccf['type']['key']};});_0x353ecd=qs[_0x05a0('0x23')](_0x54c813,_0x4b15ce);return interaction['findAll']('mail',_0x4b15ce[_0x05a0('0x24')],_0x4b15ce['user'],_0x353ecd,_0x54c813)[_0x05a0('0x1d')](respondWithFilteredResult(_0x5ba09b,_0x353ecd))['catch'](handleError(_0x5ba09b,null));};exports['show']=function(_0xeb7435,_0x28d76f){var _0x30dea3={'raw':![],'where':{'id':_0xeb7435[_0x05a0('0x25')]['id']}},_0x266cae={};_0x266cae[_0x05a0('0x26')]=_[_0x05a0('0x27')](db[_0x05a0('0x21')][_0x05a0('0x28')]);_0x266cae[_0x05a0('0x24')]=_[_0x05a0('0x27')](_0xeb7435[_0x05a0('0x24')]);_0x266cae[_0x05a0('0x29')]=_[_0x05a0('0x2a')](_0x266cae[_0x05a0('0x26')],_0x266cae[_0x05a0('0x24')]);_0x30dea3[_0x05a0('0x2b')]=_['intersection'](_0x266cae[_0x05a0('0x26')],qs[_0x05a0('0x2c')](_0xeb7435[_0x05a0('0x24')]['fields']));_0x30dea3[_0x05a0('0x2b')]=_0x30dea3[_0x05a0('0x2b')][_0x05a0('0x2d')]?_0x30dea3['attributes']:_0x266cae[_0x05a0('0x26')];if(_0xeb7435[_0x05a0('0x24')][_0x05a0('0x2e')]){_0x30dea3[_0x05a0('0x2f')]=[{'all':!![]}];}_0x30dea3=_[_0x05a0('0x30')]({},_0x30dea3,_0xeb7435[_0x05a0('0x31')]);return db[_0x05a0('0x21')][_0x05a0('0x32')](_0x30dea3)[_0x05a0('0x1d')](handleEntityNotFound(_0x28d76f,null))[_0x05a0('0x1d')](respondWithResult(_0x28d76f,null))['catch'](handleError(_0x28d76f,null));};exports['create']=function(_0x59263c,_0x1310a7){return db[_0x05a0('0x21')]['create'](_0x59263c['body'],{})['then'](respondWithResult(_0x1310a7,0xc9))['catch'](handleError(_0x1310a7,null));};exports['update']=function(_0x267c2f,_0x5196d2){if(_0x267c2f[_0x05a0('0x33')]['id']){delete _0x267c2f[_0x05a0('0x33')]['id'];}return db['MailInteraction']['find']({'where':{'id':_0x267c2f[_0x05a0('0x25')]['id']}})[_0x05a0('0x1d')](handleEntityNotFound(_0x5196d2,null))[_0x05a0('0x1d')](saveUpdates(_0x267c2f[_0x05a0('0x33')],null))[_0x05a0('0x1d')](respondWithResult(_0x5196d2,null))[_0x05a0('0x34')](handleError(_0x5196d2,null));};exports['destroy']=function(_0x298423,_0xc410ac){return db[_0x05a0('0x21')][_0x05a0('0x32')]({'where':{'id':_0x298423[_0x05a0('0x25')]['id']}})['then'](handleEntityNotFound(_0xc410ac,null))[_0x05a0('0x1d')](removeEntity(_0xc410ac,null))[_0x05a0('0x34')](handleError(_0xc410ac,null));};exports[_0x05a0('0x35')]=function(_0x47b4ee,_0x6e89e2){return db[_0x05a0('0x21')][_0x05a0('0x35')]()[_0x05a0('0x1d')](respondWithResult(_0x6e89e2,null))[_0x05a0('0x34')](handleError(_0x6e89e2,null));};exports[_0x05a0('0x36')]=function(_0x58ca5f,_0x50d13b){return db[_0x05a0('0x37')][_0x05a0('0x32')]({'where':{'id':_0x58ca5f[_0x05a0('0x25')]['id']}})[_0x05a0('0x1d')](handleEntityNotFound(_0x50d13b,null))[_0x05a0('0x1d')](function(_0x22a6fe){if(_0x22a6fe){return _0x22a6fe[_0x05a0('0x36')](_0x58ca5f[_0x05a0('0x33')][_0x05a0('0x38')],_['omit'](_0x58ca5f[_0x05a0('0x33')],['ids','id'])||{});}})[_0x05a0('0x1d')](respondWithResult(_0x50d13b,null))[_0x05a0('0x34')](handleError(_0x50d13b,null));};exports['getMessages']=function(_0x129524,_0x1b9b7c){var _0xa3d5eb={'raw':![],'where':{}};var _0x2998ca={};var _0x4efda9={'count':0x0,'rows':[]};return db[_0x05a0('0x21')][_0x05a0('0x39')]({'where':{'id':_0x129524[_0x05a0('0x25')]['id']}})[_0x05a0('0x1d')](handleEntityNotFound(_0x1b9b7c,null))[_0x05a0('0x1d')](function(_0x3057c4){if(_0x3057c4){_0x2998ca['model']=_[_0x05a0('0x27')](db[_0x05a0('0x37')][_0x05a0('0x28')]);_0x2998ca['query']=_['keys'](_0x129524[_0x05a0('0x24')]);_0x2998ca['filters']=_[_0x05a0('0x2a')](_0x2998ca['model'],_0x2998ca[_0x05a0('0x24')]);_0xa3d5eb[_0x05a0('0x2b')]=_[_0x05a0('0x2a')](_0x2998ca[_0x05a0('0x26')],qs[_0x05a0('0x2c')](_0x129524['query'][_0x05a0('0x2c')]));_0xa3d5eb[_0x05a0('0x2b')]=_0xa3d5eb[_0x05a0('0x2b')][_0x05a0('0x2d')]?_0xa3d5eb[_0x05a0('0x2b')]:_0x2998ca[_0x05a0('0x26')];if(!_0x129524[_0x05a0('0x24')][_0x05a0('0x3a')]('nolimit')){_0xa3d5eb['limit']=qs[_0x05a0('0x18')](_0x129524['query'][_0x05a0('0x18')]);_0xa3d5eb['offset']=qs['offset'](_0x129524[_0x05a0('0x24')][_0x05a0('0x16')]);}_0xa3d5eb[_0x05a0('0x3b')]=qs[_0x05a0('0x3c')](_0x129524[_0x05a0('0x24')][_0x05a0('0x3c')]);_0xa3d5eb[_0x05a0('0x3d')]=qs['filters'](_[_0x05a0('0x3e')](_0x129524[_0x05a0('0x24')],_0x2998ca[_0x05a0('0x29')]));_0xa3d5eb[_0x05a0('0x3d')][_0x05a0('0x3f')]=_0x3057c4['id'];if(_0x129524[_0x05a0('0x24')][_0x05a0('0x40')]){_0xa3d5eb[_0x05a0('0x3d')]=_[_0x05a0('0x30')](_0xa3d5eb[_0x05a0('0x3d')],{'$or':_[_0x05a0('0x41')](_0xa3d5eb[_0x05a0('0x2b')],function(_0xc80f6){var _0x458217={};_0x458217[_0xc80f6]={'$like':'%'+_0x129524[_0x05a0('0x24')]['filter']+'%'};return _0x458217;})});}if(_0x129524['query']['$gte']){var _0x57225f=_0x129524[_0x05a0('0x24')][_0x05a0('0x42')]['split'](',');var _0x4a687a={};_0x4a687a[_0x57225f[0x0]]={'$gte':moment(_0x57225f[0x1])[_0x05a0('0x43')]('YYYY-MM-DD\x20HH:mm:ss')};_0xa3d5eb['where']=_[_0x05a0('0x30')](_0xa3d5eb[_0x05a0('0x3d')],_0x4a687a);}_0xa3d5eb=_[_0x05a0('0x30')]({},_0xa3d5eb,_0x129524[_0x05a0('0x31')]);return db[_0x05a0('0x37')][_0x05a0('0x19')]({'where':_0xa3d5eb[_0x05a0('0x3d')]})[_0x05a0('0x1d')](function(_0x4671cc){_0x4efda9['count']=_0x4671cc;if(_0x129524[_0x05a0('0x24')][_0x05a0('0x2e')]){_0xa3d5eb['include']=[{'all':!![]}];}return db[_0x05a0('0x37')][_0x05a0('0x44')](_0xa3d5eb);})[_0x05a0('0x1d')](function(_0x58830d){if(_0x129524[_0x05a0('0x24')][_0x05a0('0x45')]==='true'){for(var _0x1e191c=0x0;_0x1e191c<_0x58830d['length'];_0x1e191c++){_0x58830d[_0x1e191c]['body']=juice(_0x58830d[_0x1e191c][_0x05a0('0x33')]);}}_0x4efda9[_0x05a0('0x46')]=_0x58830d;return _0x4efda9;});}})[_0x05a0('0x1d')](respondWithFilteredResult(_0x1b9b7c,_0xa3d5eb))[_0x05a0('0x34')](handleError(_0x1b9b7c,null));};exports[_0x05a0('0x47')]=function(_0x13e650,_0xb3b4e6){return db[_0x05a0('0x21')]['find']({'where':{'id':_0x13e650['params']['id']}})[_0x05a0('0x1d')](handleEntityNotFound(_0xb3b4e6,null))[_0x05a0('0x1d')](function(_0x455f60){if(_0x455f60){return _0x455f60[_0x05a0('0x48')](_0x13e650[_0x05a0('0x33')][_0x05a0('0x38')],_['omit'](_0x13e650[_0x05a0('0x33')],[_0x05a0('0x38'),'id'])||{})['spread'](function(){return db['Tag'][_0x05a0('0x44')]({'attributes':['id',_0x05a0('0x20'),'color'],'where':{'id':_0x13e650[_0x05a0('0x33')][_0x05a0('0x38')]}});})['then'](function(_0x54199b){socket[_0x05a0('0x49')](_0x05a0('0x4a'),{'id':Number(_0x13e650[_0x05a0('0x25')]['id']),'tags':_0x54199b||[]});return{'id':Number(_0x13e650[_0x05a0('0x25')]['id']),'tags':_0x54199b||[]};});}})[_0x05a0('0x1d')](respondWithResult(_0xb3b4e6,null))[_0x05a0('0x34')](handleError(_0xb3b4e6,null));};exports[_0x05a0('0x4b')]=function(_0x33f251,_0x4d47b7){return db[_0x05a0('0x21')][_0x05a0('0x32')]({'where':{'id':_0x33f251['params']['id']}})['then'](handleEntityNotFound(_0x4d47b7,null))[_0x05a0('0x1d')](function(_0x307bff){if(_0x307bff){return _0x307bff['removeTags'](_0x33f251[_0x05a0('0x24')][_0x05a0('0x38')]);}})[_0x05a0('0x1d')](respondWithStatusCode(_0x4d47b7,null))[_0x05a0('0x34')](handleError(_0x4d47b7,null));};exports[_0x05a0('0x4c')]=function(_0x1d3b57,_0x4e07f8){var _0x501acd=moment()[_0x05a0('0x4d')]()[_0x05a0('0x4e')]();var _0x36cd6e=path[_0x05a0('0x4f')](config['root'],_0x05a0('0x50'),_0x05a0('0x51'),'tmp');var _0x2309c7=path['join'](config[_0x05a0('0x52')],_0x05a0('0x50'),'files',_0x05a0('0x53'));var _0x336f28=path[_0x05a0('0x4f')](_0x36cd6e,_0x501acd);var _0x4fec86=util[_0x05a0('0x43')]('transcript-%d-%s.zip',_0x1d3b57[_0x05a0('0x25')]['id'],_0x501acd);var _0x194489=path[_0x05a0('0x4f')](_0x36cd6e,_0x4fec86);var _0x2fd6f4=[];if(_0x1d3b57[_0x05a0('0x24')]['attachments']){_0x2fd6f4[_0x05a0('0x54')]({'model':db[_0x05a0('0x55')],'as':_0x05a0('0x56'),'raw':!![]});}var _0x372114=[{'model':db[_0x05a0('0x37')],'as':_0x05a0('0x57'),'attributes':['id',_0x05a0('0x33'),_0x05a0('0x58'),'to','cc','bcc',_0x05a0('0x59'),'createdAt'],'where':{'secret':![]},'order':qs[_0x05a0('0x3c')]('id'),'include':_0x2fd6f4}];return db[_0x05a0('0x21')][_0x05a0('0x32')]({'where':{'id':_0x1d3b57[_0x05a0('0x25')]['id']},'include':_0x372114})['then'](handleEntityNotFound(_0x4e07f8,null))[_0x05a0('0x1d')](function(_0x392691){if(_0x392691&&_0x392691[_0x05a0('0x57')]){var _0x26661c=_0x392691[_0x05a0('0x5a')]({'plain':!![]});fs[_0x05a0('0x5b')](_0x336f28);return BPromise[_0x05a0('0x5c')](_0x26661c[_0x05a0('0x57')],function(_0x1454b3,_0x459203){var _0x100954={'from':_0x1454b3[_0x05a0('0x58')],'to':_0x1454b3['to']||_0x05a0('0x5d'),'subject':_0x1454b3['subject'],'html':htmlEntities[_0x05a0('0x5e')](_0x1454b3[_0x05a0('0x33')]),'headers':{'Date':moment(_0x1454b3['createdAt'])['format'](_0x05a0('0x5f'))},'attachments':[]};if(_0x1454b3['cc']){_0x100954['headers']['Cc']=_0x1454b3['cc'];}if(_0x1454b3[_0x05a0('0x60')]){_0x100954[_0x05a0('0x61')][_0x05a0('0x62')]=_0x1454b3[_0x05a0('0x60')];}return new BPromise(function(_0x412fb8,_0x22fa07){if(_0x1454b3[_0x05a0('0x56')]){for(var _0x3ab7e6=0x0;_0x3ab7e6<_0x1454b3[_0x05a0('0x56')][_0x05a0('0x2d')];_0x3ab7e6++){var _0x54b98f=_0x1454b3[_0x05a0('0x56')][_0x3ab7e6];var _0x22323a=path[_0x05a0('0x4f')](_0x2309c7,_0x54b98f[_0x05a0('0x63')]);if(fs[_0x05a0('0x64')](_0x22323a)){_0x100954[_0x05a0('0x53')][_0x05a0('0x54')]({'name':_0x54b98f['name'],'contentType':_0x54b98f['type'],'data':fs['readFileSync'](_0x22323a)});}}}emlformat['build'](_0x100954,function(_0x3c98ee,_0x1e9645){if(_0x3c98ee)return _0x22fa07(_0x3c98ee);fs[_0x05a0('0x65')](path[_0x05a0('0x4f')](_0x336f28,util[_0x05a0('0x43')](_0x05a0('0x66'),_0x459203)),_0x1e9645);return _0x412fb8(_0x1e9645);});});})['then'](function(){return new BPromise(function(_0x406644,_0x224b25){zipdir(_0x336f28,{'saveTo':_0x194489},function(_0x74c42b,_0x45af6e){if(_0x74c42b)return _0x224b25(_0x74c42b);return _0x406644(_0x45af6e);});})['then'](function(){return new BPromise(function(_0x2b404b,_0x4bea3a){rimraf(_0x336f28,function(_0x199e82){if(_0x199e82)_0x4bea3a(_0x199e82);return _0x2b404b();});});})[_0x05a0('0x1d')](function(){return _0x4e07f8['download'](_0x194489,_0x4fec86,function(_0x22acab){if(!_0x22acab)fs['unlinkSync'](_0x194489);});});});}else{return _0x4e07f8[_0x05a0('0x13')](0xc8);}})[_0x05a0('0x34')](handleError(_0x4e07f8,null));}; \ No newline at end of file +var _0x448b=['files','tmp','join','attachments','transcript-%d-%s.zip','from','bcc','subject','createdAt','get','mkdirSync','each','Messages','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','existsSync','push','readFileSync','build','message%d.eml','eml-format','rimraf','zip-dir','util','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','api','defaults','redis','localhost','./mailInteraction.socket','end','json','offset','undefined','limit','count','status','set','update','then','destroy','stack','name','send','index','map','MailInteraction','rawAttributes','type','findAll','mail','user','catch','show','params','model','keys','query','fields','attributes','includeAll','include','merge','options','find','create','body','addMessage','ids','getMessages','findOne','MailMessage','filters','intersection','hasOwnProperty','order','sort','pick','where','filter','$gte','split','format','true','length','rows','addTags','setTags','omit','spread','Tag','color','removeTags','unix','toString','root','server'];(function(_0x66dd80,_0x234147){var _0x3ee03d=function(_0x394844){while(--_0x394844){_0x66dd80['push'](_0x66dd80['shift']());}};_0x3ee03d(++_0x234147);}(_0x448b,0x1b8));var _0xb448=function(_0x426f16,_0x42fc02){_0x426f16=_0x426f16-0x0;var _0x27067d=_0x448b[_0x426f16];return _0x27067d;};'use strict';var emlformat=require(_0xb448('0x0'));var rimraf=require(_0xb448('0x1'));var zipdir=require(_0xb448('0x2'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xb448('0x3'));var path=require('path');var fs=require('fs');var _=require('lodash');var juice=require(_0xb448('0x4'));var Redis=require(_0xb448('0x5'));var interaction=require(_0xb448('0x6'));var qs=require(_0xb448('0x7'));var logger=require('../../config/logger')(_0xb448('0x8'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var htmlEntities=require('html-entities');config['redis']=_[_0xb448('0x9')](config[_0xb448('0xa')],{'host':_0xb448('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb448('0xa')]));require(_0xb448('0xc'))['register'](socket);function respondWithStatusCode(_0x3f43a3,_0xb43f99){_0xb43f99=_0xb43f99||0xcc;return function(_0x1845d7){if(_0x1845d7){return _0x3f43a3['sendStatus'](_0xb43f99);}return _0x3f43a3['status'](_0xb43f99)[_0xb448('0xd')]();};}function respondWithResult(_0x475731,_0xab875a){_0xab875a=_0xab875a||0xc8;return function(_0x32bf80){if(_0x32bf80){return _0x475731['status'](_0xab875a)[_0xb448('0xe')](_0x32bf80);}};}function respondWithFilteredResult(_0x576521,_0xa0dc6e){return function(_0x16ca2d){if(_0x16ca2d){var _0x3177cf=typeof _0xa0dc6e[_0xb448('0xf')]===_0xb448('0x10')&&typeof _0xa0dc6e[_0xb448('0x11')]===_0xb448('0x10');var _0x300104=_0x16ca2d[_0xb448('0x12')];var _0x15b45c=_0x3177cf?0x0:_0xa0dc6e[_0xb448('0xf')];var _0x35c5a2=_0x3177cf?_0x16ca2d[_0xb448('0x12')]:_0xa0dc6e[_0xb448('0xf')]+_0xa0dc6e[_0xb448('0x11')];var _0x2a39ef;if(_0x35c5a2>=_0x300104){_0x35c5a2=_0x300104;_0x2a39ef=0xc8;}else{_0x2a39ef=0xce;}_0x576521[_0xb448('0x13')](_0x2a39ef);return _0x576521[_0xb448('0x14')]('Content-Range',_0x15b45c+'-'+_0x35c5a2+'/'+_0x300104)['json'](_0x16ca2d);}return null;};}function saveUpdates(_0x37b13e){return function(_0x1749a5){if(_0x1749a5){return _0x1749a5[_0xb448('0x15')](_0x37b13e)[_0xb448('0x16')](function(_0x54213c){return _0x54213c;});}return null;};}function removeEntity(_0x43d7f8){return function(_0x3ed0a7){if(_0x3ed0a7){return _0x3ed0a7[_0xb448('0x17')]()[_0xb448('0x16')](function(){_0x43d7f8[_0xb448('0x13')](0xcc)[_0xb448('0xd')]();});}};}function handleEntityNotFound(_0x31ab64){return function(_0xd92c99){if(!_0xd92c99){_0x31ab64['sendStatus'](0x194);}return _0xd92c99;};}function handleError(_0x3bf7ca,_0x1c9c4a){_0x1c9c4a=_0x1c9c4a||0x1f4;return function(_0x366c47){logger['error'](_0x366c47[_0xb448('0x18')]);if(_0x366c47[_0xb448('0x19')]){delete _0x366c47[_0xb448('0x19')];}_0x3bf7ca[_0xb448('0x13')](_0x1c9c4a)[_0xb448('0x1a')](_0x366c47);};}exports[_0xb448('0x1b')]=function(_0x59a02a,_0x264f55){var _0xd893da={};var _0x1bdc09=_[_0xb448('0x1c')](db[_0xb448('0x1d')][_0xb448('0x1e')],function(_0x19a64b){return{'name':_0x19a64b['fieldName'],'type':_0x19a64b[_0xb448('0x1f')]['key']};});_0xd893da=qs['getOptions'](_0x1bdc09,_0x59a02a);return interaction[_0xb448('0x20')](_0xb448('0x21'),_0x59a02a['query'],_0x59a02a[_0xb448('0x22')],_0xd893da,_0x1bdc09)[_0xb448('0x16')](respondWithFilteredResult(_0x264f55,_0xd893da))[_0xb448('0x23')](handleError(_0x264f55,null));};exports[_0xb448('0x24')]=function(_0x104e9e,_0x479f48){var _0x4342fb={'raw':![],'where':{'id':_0x104e9e[_0xb448('0x25')]['id']}},_0x433e78={};_0x433e78[_0xb448('0x26')]=_[_0xb448('0x27')](db[_0xb448('0x1d')]['rawAttributes']);_0x433e78[_0xb448('0x28')]=_[_0xb448('0x27')](_0x104e9e[_0xb448('0x28')]);_0x433e78['filters']=_['intersection'](_0x433e78[_0xb448('0x26')],_0x433e78['query']);_0x4342fb['attributes']=_['intersection'](_0x433e78['model'],qs[_0xb448('0x29')](_0x104e9e[_0xb448('0x28')]['fields']));_0x4342fb['attributes']=_0x4342fb['attributes']['length']?_0x4342fb[_0xb448('0x2a')]:_0x433e78[_0xb448('0x26')];if(_0x104e9e[_0xb448('0x28')][_0xb448('0x2b')]){_0x4342fb[_0xb448('0x2c')]=[{'all':!![]}];}_0x4342fb=_[_0xb448('0x2d')]({},_0x4342fb,_0x104e9e[_0xb448('0x2e')]);return db[_0xb448('0x1d')][_0xb448('0x2f')](_0x4342fb)[_0xb448('0x16')](handleEntityNotFound(_0x479f48,null))['then'](respondWithResult(_0x479f48,null))[_0xb448('0x23')](handleError(_0x479f48,null));};exports[_0xb448('0x30')]=function(_0x180cda,_0xeb53ac){return db[_0xb448('0x1d')][_0xb448('0x30')](_0x180cda[_0xb448('0x31')],{})[_0xb448('0x16')](respondWithResult(_0xeb53ac,0xc9))[_0xb448('0x23')](handleError(_0xeb53ac,null));};exports[_0xb448('0x15')]=function(_0x1dede2,_0x1bfe1d){if(_0x1dede2[_0xb448('0x31')]['id']){delete _0x1dede2[_0xb448('0x31')]['id'];}return db['MailInteraction']['find']({'where':{'id':_0x1dede2[_0xb448('0x25')]['id']}})[_0xb448('0x16')](handleEntityNotFound(_0x1bfe1d,null))['then'](saveUpdates(_0x1dede2['body'],null))[_0xb448('0x16')](respondWithResult(_0x1bfe1d,null))['catch'](handleError(_0x1bfe1d,null));};exports[_0xb448('0x17')]=function(_0x23b749,_0x52d868){return db['MailInteraction'][_0xb448('0x2f')]({'where':{'id':_0x23b749[_0xb448('0x25')]['id']}})[_0xb448('0x16')](handleEntityNotFound(_0x52d868,null))[_0xb448('0x16')](removeEntity(_0x52d868,null))[_0xb448('0x23')](handleError(_0x52d868,null));};exports['describe']=function(_0x543d6b,_0x139f22){return db[_0xb448('0x1d')]['describe']()[_0xb448('0x16')](respondWithResult(_0x139f22,null))[_0xb448('0x23')](handleError(_0x139f22,null));};exports[_0xb448('0x32')]=function(_0x4485a4,_0x498fd4){return db['MailMessage'][_0xb448('0x2f')]({'where':{'id':_0x4485a4[_0xb448('0x25')]['id']}})[_0xb448('0x16')](handleEntityNotFound(_0x498fd4,null))[_0xb448('0x16')](function(_0x31e0be){if(_0x31e0be){return _0x31e0be[_0xb448('0x32')](_0x4485a4[_0xb448('0x31')][_0xb448('0x33')],_['omit'](_0x4485a4[_0xb448('0x31')],[_0xb448('0x33'),'id'])||{});}})[_0xb448('0x16')](respondWithResult(_0x498fd4,null))[_0xb448('0x23')](handleError(_0x498fd4,null));};exports[_0xb448('0x34')]=function(_0x68d0c5,_0x4c01cb){var _0x5394b2={'raw':![],'where':{}};var _0x4c71d9={};var _0x242634={'count':0x0,'rows':[]};return db[_0xb448('0x1d')][_0xb448('0x35')]({'where':{'id':_0x68d0c5[_0xb448('0x25')]['id']}})[_0xb448('0x16')](handleEntityNotFound(_0x4c01cb,null))[_0xb448('0x16')](function(_0x780bcc){if(_0x780bcc){_0x4c71d9['model']=_['keys'](db[_0xb448('0x36')]['rawAttributes']);_0x4c71d9['query']=_[_0xb448('0x27')](_0x68d0c5[_0xb448('0x28')]);_0x4c71d9[_0xb448('0x37')]=_[_0xb448('0x38')](_0x4c71d9['model'],_0x4c71d9[_0xb448('0x28')]);_0x5394b2['attributes']=_[_0xb448('0x38')](_0x4c71d9[_0xb448('0x26')],qs[_0xb448('0x29')](_0x68d0c5[_0xb448('0x28')][_0xb448('0x29')]));_0x5394b2['attributes']=_0x5394b2['attributes']['length']?_0x5394b2[_0xb448('0x2a')]:_0x4c71d9[_0xb448('0x26')];if(!_0x68d0c5[_0xb448('0x28')][_0xb448('0x39')]('nolimit')){_0x5394b2[_0xb448('0x11')]=qs[_0xb448('0x11')](_0x68d0c5['query'][_0xb448('0x11')]);_0x5394b2[_0xb448('0xf')]=qs[_0xb448('0xf')](_0x68d0c5['query']['offset']);}_0x5394b2[_0xb448('0x3a')]=qs[_0xb448('0x3b')](_0x68d0c5[_0xb448('0x28')][_0xb448('0x3b')]);_0x5394b2['where']=qs['filters'](_[_0xb448('0x3c')](_0x68d0c5[_0xb448('0x28')],_0x4c71d9[_0xb448('0x37')]));_0x5394b2[_0xb448('0x3d')]['MailInteractionId']=_0x780bcc['id'];if(_0x68d0c5[_0xb448('0x28')][_0xb448('0x3e')]){_0x5394b2[_0xb448('0x3d')]=_[_0xb448('0x2d')](_0x5394b2['where'],{'$or':_[_0xb448('0x1c')](_0x5394b2[_0xb448('0x2a')],function(_0x27b514){var _0x1378d2={};_0x1378d2[_0x27b514]={'$like':'%'+_0x68d0c5[_0xb448('0x28')]['filter']+'%'};return _0x1378d2;})});}if(_0x68d0c5[_0xb448('0x28')][_0xb448('0x3f')]){var _0x5bec39=_0x68d0c5['query']['$gte'][_0xb448('0x40')](',');var _0x3a361e={};_0x3a361e[_0x5bec39[0x0]]={'$gte':moment(_0x5bec39[0x1])[_0xb448('0x41')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5394b2['where']=_['merge'](_0x5394b2[_0xb448('0x3d')],_0x3a361e);}_0x5394b2=_['merge']({},_0x5394b2,_0x68d0c5[_0xb448('0x2e')]);return db['MailMessage']['count']({'where':_0x5394b2[_0xb448('0x3d')]})[_0xb448('0x16')](function(_0x2e52b9){_0x242634['count']=_0x2e52b9;if(_0x68d0c5[_0xb448('0x28')][_0xb448('0x2b')]){_0x5394b2[_0xb448('0x2c')]=[{'all':!![]}];}return db[_0xb448('0x36')]['findAll'](_0x5394b2);})[_0xb448('0x16')](function(_0xfc98fe){if(_0x68d0c5[_0xb448('0x28')]['inlineCss']===_0xb448('0x42')){for(var _0x43f14e=0x0;_0x43f14e<_0xfc98fe[_0xb448('0x43')];_0x43f14e++){_0xfc98fe[_0x43f14e][_0xb448('0x31')]=juice(_0xfc98fe[_0x43f14e][_0xb448('0x31')]);}}_0x242634[_0xb448('0x44')]=_0xfc98fe;return _0x242634;});}})[_0xb448('0x16')](respondWithFilteredResult(_0x4c01cb,_0x5394b2))[_0xb448('0x23')](handleError(_0x4c01cb,null));};exports[_0xb448('0x45')]=function(_0x530376,_0x43a2b4){return db[_0xb448('0x1d')][_0xb448('0x2f')]({'where':{'id':_0x530376[_0xb448('0x25')]['id']}})[_0xb448('0x16')](handleEntityNotFound(_0x43a2b4,null))[_0xb448('0x16')](function(_0x1eb7a5){if(_0x1eb7a5){return _0x1eb7a5[_0xb448('0x46')](_0x530376[_0xb448('0x31')]['ids'],_[_0xb448('0x47')](_0x530376[_0xb448('0x31')],['ids','id'])||{})[_0xb448('0x48')](function(){return db[_0xb448('0x49')][_0xb448('0x20')]({'attributes':['id',_0xb448('0x19'),_0xb448('0x4a')],'where':{'id':_0x530376[_0xb448('0x31')][_0xb448('0x33')]}});})[_0xb448('0x16')](function(_0x1b7dcc){socket['emit']('mailInteractionTags:save',{'id':Number(_0x530376['params']['id']),'tags':_0x1b7dcc||[]});return{'id':Number(_0x530376[_0xb448('0x25')]['id']),'tags':_0x1b7dcc||[]};});}})[_0xb448('0x16')](respondWithResult(_0x43a2b4,null))[_0xb448('0x23')](handleError(_0x43a2b4,null));};exports[_0xb448('0x4b')]=function(_0x4c22cd,_0x6062ed){return db[_0xb448('0x1d')]['find']({'where':{'id':_0x4c22cd[_0xb448('0x25')]['id']}})[_0xb448('0x16')](handleEntityNotFound(_0x6062ed,null))[_0xb448('0x16')](function(_0x23135c){if(_0x23135c){return _0x23135c[_0xb448('0x4b')](_0x4c22cd[_0xb448('0x28')][_0xb448('0x33')]);}})[_0xb448('0x16')](respondWithStatusCode(_0x6062ed,null))[_0xb448('0x23')](handleError(_0x6062ed,null));};exports['download']=function(_0xc6112,_0x5623d7){var _0x38897d=moment()[_0xb448('0x4c')]()[_0xb448('0x4d')]();var _0x199e8e=path['join'](config[_0xb448('0x4e')],_0xb448('0x4f'),_0xb448('0x50'),_0xb448('0x51'));var _0x339ff6=path[_0xb448('0x52')](config['root'],_0xb448('0x4f'),_0xb448('0x50'),_0xb448('0x53'));var _0x1e2cea=path['join'](_0x199e8e,_0x38897d);var _0x5c5248=util[_0xb448('0x41')](_0xb448('0x54'),_0xc6112[_0xb448('0x25')]['id'],_0x38897d);var _0x17187e=path['join'](_0x199e8e,_0x5c5248);var _0x255058=[];if(_0xc6112['query'][_0xb448('0x53')]){_0x255058['push']({'model':db['Attachment'],'as':'Attachments','raw':!![]});}var _0x3fde0b=[{'model':db['MailMessage'],'as':'Messages','attributes':['id',_0xb448('0x31'),_0xb448('0x55'),'to','cc',_0xb448('0x56'),_0xb448('0x57'),_0xb448('0x58')],'where':{'secret':![]},'order':qs[_0xb448('0x3b')]('id'),'include':_0x255058}];return db['MailInteraction'][_0xb448('0x2f')]({'where':{'id':_0xc6112['params']['id']},'include':_0x3fde0b})['then'](handleEntityNotFound(_0x5623d7,null))[_0xb448('0x16')](function(_0x10a2db){if(_0x10a2db&&_0x10a2db['Messages']){var _0x283f80=_0x10a2db[_0xb448('0x59')]({'plain':!![]});fs[_0xb448('0x5a')](_0x1e2cea);return BPromise[_0xb448('0x5b')](_0x283f80[_0xb448('0x5c')],function(_0x2e10df,_0x21cf39){var _0x3423bd={'from':_0x2e10df[_0xb448('0x55')],'to':_0x2e10df['to']||_0xb448('0x5d'),'subject':_0x2e10df['subject'],'html':htmlEntities[_0xb448('0x5e')](_0x2e10df[_0xb448('0x31')]),'headers':{'Date':moment(_0x2e10df[_0xb448('0x58')])[_0xb448('0x41')](_0xb448('0x5f'))},'attachments':[]};if(_0x2e10df['cc']){_0x3423bd[_0xb448('0x60')]['Cc']=_0x2e10df['cc'];}if(_0x2e10df[_0xb448('0x56')]){_0x3423bd[_0xb448('0x60')][_0xb448('0x61')]=_0x2e10df[_0xb448('0x56')];}return new BPromise(function(_0xcf62e3,_0x14da42){if(_0x2e10df[_0xb448('0x62')]){for(var _0x4a2d49=0x0;_0x4a2d49<_0x2e10df[_0xb448('0x62')]['length'];_0x4a2d49++){var _0x16002d=_0x2e10df[_0xb448('0x62')][_0x4a2d49];var _0x589f69=path[_0xb448('0x52')](_0x339ff6,_0x16002d['basename']);if(fs[_0xb448('0x63')](_0x589f69)){_0x3423bd['attachments'][_0xb448('0x64')]({'name':_0x16002d[_0xb448('0x19')],'contentType':_0x16002d['type'],'data':fs[_0xb448('0x65')](_0x589f69)});}}}emlformat[_0xb448('0x66')](_0x3423bd,function(_0x4f09d6,_0x273241){if(_0x4f09d6)return _0x14da42(_0x4f09d6);fs['writeFileSync'](path['join'](_0x1e2cea,util['format'](_0xb448('0x67'),_0x21cf39)),_0x273241);return _0xcf62e3(_0x273241);});});})[_0xb448('0x16')](function(){return new BPromise(function(_0x8358b9,_0x28aa87){zipdir(_0x1e2cea,{'saveTo':_0x17187e},function(_0x3bea59,_0x41431d){if(_0x3bea59)return _0x28aa87(_0x3bea59);return _0x8358b9(_0x41431d);});})[_0xb448('0x16')](function(){return new BPromise(function(_0x1a3ba5,_0x5c1641){rimraf(_0x1e2cea,function(_0x28507d){if(_0x28507d)_0x5c1641(_0x28507d);return _0x1a3ba5();});});})[_0xb448('0x16')](function(){return _0x5623d7['download'](_0x17187e,_0x5c5248,function(_0x4ac9ab){if(!_0x4ac9ab)fs['unlinkSync'](_0x17187e);});});});}else{return _0x5623d7['sendStatus'](0xc8);}})[_0xb448('0x23')](handleError(_0x5623d7,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 00c774c..22f97d7 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 _0x9873=['../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','unreadMessages','emit','catch','hasOwnProperty','exports','events'];(function(_0x15997b,_0x1a3b55){var _0x1cda31=function(_0x11e5ee){while(--_0x11e5ee){_0x15997b['push'](_0x15997b['shift']());}};_0x1cda31(++_0x1a3b55);}(_0x9873,0x1bf));var _0x3987=function(_0x16584d,_0x5ccb01){_0x16584d=_0x16584d-0x0;var _0x3bfbba=_0x9873[_0x16584d];return _0x3bfbba;};'use strict';var EventEmitter=require(_0x3987('0x0'));var MailInteraction=require(_0x3987('0x1'))['db'][_0x3987('0x2')];var MailMessage=require(_0x3987('0x1'))['db'][_0x3987('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x3987('0x4')](0x0);var events={'afterCreate':_0x3987('0x5'),'afterUpdate':_0x3987('0x6'),'afterDestroy':_0x3987('0x7')};function emitEvent(_0x218d52){return function(_0x27809b,_0xb2d093,_0x45ed72){_0x27809b[_0x3987('0x8')]({'attributes':['id'],'raw':!![]})[_0x3987('0x9')](function(_0x1da637){_0x27809b[_0x3987('0xa')]('Users',_0x1da637['map'](function(_0x560ccc){return{'id':_0x560ccc['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x27809b['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x25fcbd){_0x27809b[_0x3987('0xa')](_0x3987('0xb'),_0x25fcbd['length']);MailInteractionEvents[_0x3987('0xc')](_0x218d52+':'+_0x27809b['id'],_0x27809b);MailInteractionEvents['emit'](_0x218d52,_0x27809b);_0x45ed72(null);})[_0x3987('0xd')](_0x45ed72(null));};}for(var e in events){if(events[_0x3987('0xe')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x3987('0xf')]=MailInteractionEvents; \ No newline at end of file +var _0xa7af=['remove','getUsers','Users','map','then','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','MailInteraction','MailMessage','save','update'];(function(_0x210d3c,_0x556021){var _0x5b7d96=function(_0x17dfbd){while(--_0x17dfbd){_0x210d3c['push'](_0x210d3c['shift']());}};_0x5b7d96(++_0x556021);}(_0xa7af,0x13e));var _0xfa7a=function(_0x3a8647,_0x1c1a8f){_0x3a8647=_0x3a8647-0x0;var _0xf42234=_0xa7af[_0x3a8647];return _0xf42234;};'use strict';var EventEmitter=require(_0xfa7a('0x0'));var MailInteraction=require(_0xfa7a('0x1'))['db'][_0xfa7a('0x2')];var MailMessage=require(_0xfa7a('0x1'))['db'][_0xfa7a('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfa7a('0x4'),'afterUpdate':_0xfa7a('0x5'),'afterDestroy':_0xfa7a('0x6')};function emitEvent(_0x38f167){return function(_0x3e29d8,_0x1782f4,_0x5401e0){_0x3e29d8[_0xfa7a('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4cc8e5){_0x3e29d8['setDataValue'](_0xfa7a('0x8'),_0x4cc8e5[_0xfa7a('0x9')](function(_0x1d2c8d){return{'id':_0x1d2c8d['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x3e29d8['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfa7a('0xa')](function(_0x599969){_0x3e29d8[_0xfa7a('0xb')](_0xfa7a('0xc'),_0x599969[_0xfa7a('0xd')]);MailInteractionEvents['emit'](_0x38f167+':'+_0x3e29d8['id'],_0x3e29d8);MailInteractionEvents[_0xfa7a('0xe')](_0x38f167,_0x3e29d8);_0x5401e0(null);})[_0xfa7a('0xf')](_0x5401e0(null));};}for(var e in events){if(events[_0xfa7a('0x10')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0xfa7a('0x11')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 512e75b..a722f15 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 _0x4453=['define','MailInteraction','mail_interactions','fti_mail_interactions','subject','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','then','catch','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','request-promise','rimraf','../../config/environment','exports'];(function(_0x153f3e,_0x524fbe){var _0xdf1f39=function(_0xdaad92){while(--_0xdaad92){_0x153f3e['push'](_0x153f3e['shift']());}};_0xdf1f39(++_0x524fbe);}(_0x4453,0x125));var _0x3445=function(_0x561ff7,_0x156137){_0x561ff7=_0x561ff7-0x0;var _0x33e6a7=_0x4453[_0x561ff7];return _0x33e6a7;};'use strict';var _=require('lodash');var util=require(_0x3445('0x0'));var logger=require(_0x3445('0x1'))(_0x3445('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3445('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3445('0x4'));var config=require(_0x3445('0x5'));var attributes=require('./mailInteraction.attributes');module[_0x3445('0x6')]=function(_0x39fd2b,_0xde4d9e){return _0x39fd2b[_0x3445('0x7')](_0x3445('0x8'),attributes,{'tableName':_0x3445('0x9'),'paranoid':![],'indexes':[{'name':_0x3445('0xa'),'fields':[_0x3445('0xb'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x284de3,_0x28f109,_0x116886){if(_0x284de3[_0x3445('0xc')]){_0x284de3[_0x3445('0xd')]=moment()[_0x3445('0xe')](_0x3445('0xf'));}if(_0x284de3[_0x3445('0x10')]){_0x284de3[_0x3445('0x11')]=moment()['format'](_0x3445('0xf'));}_0x116886(null,_0x28f109);},'beforeUpdate':function(_0x1c2e32,_0x410e21,_0x1bc82d){if(_0x1c2e32[_0x3445('0x12')](_0x3445('0xc'))){_0x1c2e32[_0x3445('0xd')]=_0x1c2e32[_0x3445('0xc')]?moment()[_0x3445('0xe')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x1c2e32[_0x3445('0x12')]('closed')){_0x1c2e32[_0x3445('0x11')]=moment()[_0x3445('0xe')]('YYYY-MM-DD\x20HH:mm:ss');_0x1c2e32[_0x3445('0xc')]=null;_0x1c2e32[_0x3445('0xd')]=null;}_0x1bc82d(null,_0x1c2e32);},'afterUpdate':function(_0x3ea779,_0x23f430,_0x50cfe3){var _0x1aac2e=_0x39fd2b[_0x3445('0x13')];var _0x597359=_0x3ea779[_0x3445('0x14')]({'plain':!![]});if(_0x597359[_0x3445('0x10')]){return _0x1aac2e['MailMessage']['update']({'read':!![]},{'where':{'MailInteractionId':_0x597359['id']}})[_0x3445('0x15')](function(){_0x50cfe3();})[_0x3445('0x16')](function(_0x2a2ebf){_0x50cfe3(_0x2a2ebf);});}else{_0x50cfe3();}}},'charset':_0x3445('0x17'),'collate':_0x3445('0x18')});}; \ No newline at end of file +var _0x52df=['changed','substatus','format','models','get','MailMessage','update','then','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./mailInteraction.attributes','exports','define','mail_interactions','fti_mail_interactions','FULLTEXT','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x52df,0x1d5));var _0xf52d=function(_0x10436e,_0x27e4d8){_0x10436e=_0x10436e-0x0;var _0x4ab78e=_0x52df[_0x10436e];return _0x4ab78e;};'use strict';var _=require(_0xf52d('0x0'));var util=require('util');var logger=require(_0xf52d('0x1'))(_0xf52d('0x2'));var moment=require('moment');var BPromise=require(_0xf52d('0x3'));var rp=require(_0xf52d('0x4'));var fs=require('fs');var path=require(_0xf52d('0x5'));var rimraf=require('rimraf');var config=require(_0xf52d('0x6'));var attributes=require(_0xf52d('0x7'));module[_0xf52d('0x8')]=function(_0x44bff3,_0x28d541){return _0x44bff3[_0xf52d('0x9')]('MailInteraction',attributes,{'tableName':_0xf52d('0xa'),'paranoid':![],'indexes':[{'name':_0xf52d('0xb'),'fields':['subject','to'],'type':_0xf52d('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x63a25b,_0x15f32d,_0x37f94a){if(_0x63a25b['substatus']){_0x63a25b[_0xf52d('0xd')]=moment()['format'](_0xf52d('0xe'));}if(_0x63a25b[_0xf52d('0xf')]){_0x63a25b[_0xf52d('0x10')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x37f94a(null,_0x15f32d);},'beforeUpdate':function(_0x1ba88b,_0x19299a,_0x1f26e1){if(_0x1ba88b[_0xf52d('0x11')]('substatus')){_0x1ba88b[_0xf52d('0xd')]=_0x1ba88b[_0xf52d('0x12')]?moment()[_0xf52d('0x13')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x1ba88b['changed'](_0xf52d('0xf'))){_0x1ba88b['closedAt']=moment()[_0xf52d('0x13')](_0xf52d('0xe'));_0x1ba88b[_0xf52d('0x12')]=null;_0x1ba88b['substatusAt']=null;}_0x1f26e1(null,_0x1ba88b);},'afterUpdate':function(_0x1d4042,_0x18bc02,_0x28fcca){var _0x578336=_0x44bff3[_0xf52d('0x14')];var _0x278ce4=_0x1d4042[_0xf52d('0x15')]({'plain':!![]});if(_0x278ce4[_0xf52d('0xf')]){return _0x578336[_0xf52d('0x16')][_0xf52d('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x278ce4['id']}})[_0xf52d('0x18')](function(){_0x28fcca();})['catch'](function(_0x26dfe6){_0x28fcca(_0x26dfe6);});}else{_0x28fcca();}}},'charset':_0xf52d('0x19'),'collate':_0xf52d('0x1a')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 316eb52..33df766 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 _0x7919=['info','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','MailInteraction,\x20%s,\x20%s','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','debug','stringify','AddTagsToMailInteraction','find','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','request','then'];(function(_0x5ca784,_0x28bea2){var _0x5aa579=function(_0x531234){while(--_0x531234){_0x5ca784['push'](_0x5ca784['shift']());}};_0x5aa579(++_0x28bea2);}(_0x7919,0xeb));var _0x9791=function(_0x3ad1a3,_0x383b91){_0x3ad1a3=_0x3ad1a3-0x0;var _0x53256f=_0x7919[_0x3ad1a3];return _0x53256f;};'use strict';var _=require(_0x9791('0x0'));var util=require(_0x9791('0x1'));var moment=require(_0x9791('0x2'));var BPromise=require(_0x9791('0x3'));var rs=require(_0x9791('0x4'));var fs=require('fs');var Redis=require(_0x9791('0x5'));var db=require(_0x9791('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9791('0x7'))(_0x9791('0x8'));var config=require('../../config/environment');var jayson=require(_0x9791('0x9'));var client=jayson[_0x9791('0xa')][_0x9791('0xb')]({'port':0x232a});config[_0x9791('0xc')]=_[_0x9791('0xd')](config['redis'],{'host':_0x9791('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9791('0xc')]));require('./mailInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x5f773,_0x497bc7,_0x43df11){return new BPromise(function(_0x31a02b,_0x5d67e4){return client[_0x9791('0xf')](_0x5f773,_0x43df11)[_0x9791('0x10')](function(_0x36194f){logger[_0x9791('0x11')]('MailInteraction,\x20%s,\x20%s',_0x497bc7,_0x9791('0x12'));logger['debug'](_0x9791('0x13'),_0x497bc7,_0x9791('0x12'),JSON['stringify'](_0x36194f));if(_0x36194f[_0x9791('0x14')]){if(_0x36194f['error'][_0x9791('0x15')]===0x1f4){logger[_0x9791('0x14')](_0x9791('0x16'),_0x497bc7,_0x36194f[_0x9791('0x14')][_0x9791('0x17')]);return _0x5d67e4(_0x36194f[_0x9791('0x14')][_0x9791('0x17')]);}logger[_0x9791('0x14')](_0x9791('0x16'),_0x497bc7,_0x36194f[_0x9791('0x14')][_0x9791('0x17')]);return _0x31a02b(_0x36194f[_0x9791('0x14')][_0x9791('0x17')]);}else{logger['info'](_0x9791('0x16'),_0x497bc7,_0x9791('0x12'));_0x31a02b(_0x36194f[_0x9791('0x18')][_0x9791('0x17')]);}})[_0x9791('0x19')](function(_0x5c2fca){logger[_0x9791('0x14')](_0x9791('0x16'),_0x497bc7,_0x5c2fca);_0x5d67e4(_0x5c2fca);});});}exports[_0x9791('0x1a')]=function(_0x2cfaa2){var _0x41cb20=this;return new Promise(function(_0xef3a83,_0x36e5f7){return db[_0x9791('0x1b')][_0x9791('0x1c')](_0x2cfaa2[_0x9791('0x1d')],{'raw':_0x2cfaa2[_0x9791('0x1e')]?_0x2cfaa2['options'][_0x9791('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2cfaa2['options']?_0x2cfaa2['options'][_0x9791('0x20')]||null:null,'attributes':_0x2cfaa2[_0x9791('0x1e')]?_0x2cfaa2['options'][_0x9791('0x21')]||null:null,'limit':_0x2cfaa2[_0x9791('0x1e')]?_0x2cfaa2[_0x9791('0x1e')]['limit']||null:null})[_0x9791('0x10')](function(_0x1e1834){logger[_0x9791('0x11')]('UpdateMailInteraction',_0x2cfaa2);logger[_0x9791('0x22')]('UpdateMailInteraction',_0x2cfaa2,JSON[_0x9791('0x23')](_0x1e1834));_0xef3a83(_0x1e1834);})[_0x9791('0x19')](function(_0x50760e){logger[_0x9791('0x14')]('UpdateMailInteraction',_0x50760e[_0x9791('0x17')],_0x2cfaa2);_0x36e5f7(_0x41cb20['error'](0x1f4,_0x50760e[_0x9791('0x17')]));});});};exports[_0x9791('0x24')]=function(_0x5d943f){return new Promise(function(_0x5f336c,_0x55614a){return db[_0x9791('0x1b')][_0x9791('0x25')]({'where':_0x5d943f[_0x9791('0x1e')]?_0x5d943f[_0x9791('0x1e')]['where']||null:null})[_0x9791('0x10')](function(_0x2d85bd){if(_0x2d85bd){return _0x2d85bd['addTags'](_0x5d943f[_0x9791('0x1d')][_0x9791('0x26')],_[_0x9791('0x27')](_0x5d943f[_0x9791('0x1d')],[_0x9791('0x26'),'id'])||{});}})[_0x9791('0x28')](function(_0x4a2df8){logger[_0x9791('0x11')](_0x9791('0x29'),_0x5d943f);logger[_0x9791('0x22')]('AddTags',_0x5d943f,JSON[_0x9791('0x23')](_0x4a2df8));_0x5f336c(_0x4a2df8);})['catch'](function(_0x43ef6a){logger['error']('AddTags',_0x43ef6a[_0x9791('0x17')],_0x5d943f);_0x55614a(_this['error'](0x1f4,_0x43ef6a[_0x9791('0x17')]));});});}; \ No newline at end of file +var _0x7711=['AddTags','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','./mailInteraction.socket','register','request','info','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','where','attributes','limit','then','AddTagsToMailInteraction','find','addTags','ids','omit','spread','debug'];(function(_0x5c3c7b,_0x4586ab){var _0x4b8adc=function(_0x3c7617){while(--_0x3c7617){_0x5c3c7b['push'](_0x5c3c7b['shift']());}};_0x4b8adc(++_0x4586ab);}(_0x7711,0xf7));var _0x1771=function(_0x396824,_0x4bbf02){_0x396824=_0x396824-0x0;var _0x5988ae=_0x7711[_0x396824];return _0x5988ae;};'use strict';var _=require(_0x1771('0x0'));var util=require(_0x1771('0x1'));var moment=require(_0x1771('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1771('0x3'));var db=require(_0x1771('0x4'))['db'];var utils=require(_0x1771('0x5'));var logger=require(_0x1771('0x6'))('rpc');var config=require(_0x1771('0x7'));var jayson=require(_0x1771('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x1771('0x9')]=_[_0x1771('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1771('0x9')]));require(_0x1771('0xb'))[_0x1771('0xc')](socket);function respondWithRpcPromise(_0x280b1d,_0xa371aa,_0xd260b0){return new BPromise(function(_0x35e12a,_0x248fe6){return client[_0x1771('0xd')](_0x280b1d,_0xd260b0)['then'](function(_0x430c89){logger[_0x1771('0xe')](_0x1771('0xf'),_0xa371aa,_0x1771('0x10'));logger['debug'](_0x1771('0x11'),_0xa371aa,_0x1771('0x10'),JSON[_0x1771('0x12')](_0x430c89));if(_0x430c89[_0x1771('0x13')]){if(_0x430c89[_0x1771('0x13')][_0x1771('0x14')]===0x1f4){logger['error'](_0x1771('0xf'),_0xa371aa,_0x430c89[_0x1771('0x13')][_0x1771('0x15')]);return _0x248fe6(_0x430c89[_0x1771('0x13')][_0x1771('0x15')]);}logger[_0x1771('0x13')](_0x1771('0xf'),_0xa371aa,_0x430c89[_0x1771('0x13')][_0x1771('0x15')]);return _0x35e12a(_0x430c89[_0x1771('0x13')][_0x1771('0x15')]);}else{logger[_0x1771('0xe')](_0x1771('0xf'),_0xa371aa,'request\x20sent');_0x35e12a(_0x430c89[_0x1771('0x16')][_0x1771('0x15')]);}})[_0x1771('0x17')](function(_0x55a69b){logger['error'](_0x1771('0xf'),_0xa371aa,_0x55a69b);_0x248fe6(_0x55a69b);});});}exports[_0x1771('0x18')]=function(_0x1b3da8){var _0x54a661=this;return new Promise(function(_0x3e5d2d,_0x442cb2){return db[_0x1771('0x19')][_0x1771('0x1a')](_0x1b3da8[_0x1771('0x1b')],{'raw':_0x1b3da8['options']?_0x1b3da8[_0x1771('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b3da8[_0x1771('0x1c')]?_0x1b3da8['options'][_0x1771('0x1d')]||null:null,'attributes':_0x1b3da8['options']?_0x1b3da8[_0x1771('0x1c')][_0x1771('0x1e')]||null:null,'limit':_0x1b3da8[_0x1771('0x1c')]?_0x1b3da8[_0x1771('0x1c')][_0x1771('0x1f')]||null:null})[_0x1771('0x20')](function(_0x4ed06f){logger[_0x1771('0xe')]('UpdateMailInteraction',_0x1b3da8);logger['debug'](_0x1771('0x18'),_0x1b3da8,JSON[_0x1771('0x12')](_0x4ed06f));_0x3e5d2d(_0x4ed06f);})[_0x1771('0x17')](function(_0x416d2a){logger[_0x1771('0x13')](_0x1771('0x18'),_0x416d2a[_0x1771('0x15')],_0x1b3da8);_0x442cb2(_0x54a661[_0x1771('0x13')](0x1f4,_0x416d2a[_0x1771('0x15')]));});});};exports[_0x1771('0x21')]=function(_0x4dafd6){return new Promise(function(_0x278617,_0x54cac4){return db[_0x1771('0x19')][_0x1771('0x22')]({'where':_0x4dafd6['options']?_0x4dafd6['options'][_0x1771('0x1d')]||null:null})['then'](function(_0x2610ff){if(_0x2610ff){return _0x2610ff[_0x1771('0x23')](_0x4dafd6[_0x1771('0x1b')][_0x1771('0x24')],_[_0x1771('0x25')](_0x4dafd6[_0x1771('0x1b')],[_0x1771('0x24'),'id'])||{});}})[_0x1771('0x26')](function(_0x1efb16){logger[_0x1771('0xe')]('AddTags',_0x4dafd6);logger[_0x1771('0x27')]('AddTags',_0x4dafd6,JSON['stringify'](_0x1efb16));_0x278617(_0x1efb16);})[_0x1771('0x17')](function(_0x511545){logger['error'](_0x1771('0x28'),_0x511545[_0x1771('0x15')],_0x4dafd6);_0x54cac4(_this[_0x1771('0x13')](0x1f4,_0x511545['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 24cb5dd..2b399ed 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 _0x9555=['save','remove','emit','register','length','mailInteraction:'];(function(_0x477c0c,_0x48b400){var _0x37d540=function(_0x2d95e2){while(--_0x2d95e2){_0x477c0c['push'](_0x477c0c['shift']());}};_0x37d540(++_0x48b400);}(_0x9555,0xd2));var _0x5955=function(_0x2a3c12,_0x1416f4){_0x2a3c12=_0x2a3c12-0x0;var _0x464893=_0x9555[_0x2a3c12];return _0x464893;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x5955('0x0'),_0x5955('0x1'),'update'];function createListener(_0x1688bd,_0x5aa91d){return function(_0x580b6b){_0x5aa91d[_0x5955('0x2')](_0x1688bd,_0x580b6b);};}function removeListener(_0x43e0e2,_0x3214da){return function(){MailInteractionEvents['removeListener'](_0x43e0e2,_0x3214da);};}exports[_0x5955('0x3')]=function(_0x4dd9c4){for(var _0x1eac3d=0x0,_0x18a2c0=events[_0x5955('0x4')];_0x1eac3d<_0x18a2c0;_0x1eac3d++){var _0x576a33=events[_0x1eac3d];var _0x47c4d3=createListener(_0x5955('0x5')+_0x576a33,_0x4dd9c4);MailInteractionEvents['on'](_0x576a33,_0x47c4d3);}}; \ No newline at end of file +var _0x3d86=['save','emit','removeListener','register','length','mailInteraction:','./mailInteraction.events'];(function(_0x33bb2f,_0x3ce239){var _0x14f7b6=function(_0x20e607){while(--_0x20e607){_0x33bb2f['push'](_0x33bb2f['shift']());}};_0x14f7b6(++_0x3ce239);}(_0x3d86,0xa0));var _0x63d8=function(_0x1ce30b,_0x3abfd8){_0x1ce30b=_0x1ce30b-0x0;var _0x328c1f=_0x3d86[_0x1ce30b];return _0x328c1f;};'use strict';var MailInteractionEvents=require(_0x63d8('0x0'));var events=[_0x63d8('0x1'),'remove','update'];function createListener(_0x12edd9,_0x15fb84){return function(_0x47510d){_0x15fb84[_0x63d8('0x2')](_0x12edd9,_0x47510d);};}function removeListener(_0x1176cd,_0x79554a){return function(){MailInteractionEvents[_0x63d8('0x3')](_0x1176cd,_0x79554a);};}exports[_0x63d8('0x4')]=function(_0x4cc0fc){for(var _0x4b8df2=0x0,_0x3eae4f=events[_0x63d8('0x5')];_0x4b8df2<_0x3eae4f;_0x4b8df2++){var _0x557b44=events[_0x4b8df2];var _0x1d8da2=createListener(_0x63d8('0x6')+_0x557b44,_0x4cc0fc);MailInteractionEvents['on'](_0x557b44,_0x1d8da2);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 1e44fb5..8c9a3d2 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 _0x1ea1=['update','accept','reject','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','/describe','get','/:id/download','download','post','tracked','mailmessage:create','create','put','/:id'];(function(_0x3d2f68,_0x48f637){var _0x1e6690=function(_0x14b36){while(--_0x14b36){_0x3d2f68['push'](_0x3d2f68['shift']());}};_0x1e6690(++_0x48f637);}(_0x1ea1,0xce));var _0x11ea=function(_0x34fd11,_0x9a5f15){_0x34fd11=_0x34fd11-0x0;var _0x133302=_0x1ea1[_0x34fd11];return _0x133302;};'use strict';var multer=require(_0x11ea('0x0'));var util=require(_0x11ea('0x1'));var path=require('path');var timeout=require(_0x11ea('0x2'));var express=require(_0x11ea('0x3'));var router=express['Router']();var fs_extra=require(_0x11ea('0x4'));var auth=require(_0x11ea('0x5'));var interaction=require(_0x11ea('0x6'));var config=require(_0x11ea('0x7'));var controller=require('./mailMessage.controller');router['get']('/',auth[_0x11ea('0x8')](),controller['index']);router['get'](_0x11ea('0x9'),auth[_0x11ea('0x8')](),controller['describe']);router[_0x11ea('0xa')]('/:id',auth[_0x11ea('0x8')](),controller['show']);router[_0x11ea('0xa')](_0x11ea('0xb'),auth[_0x11ea('0x8')](),controller[_0x11ea('0xc')]);router[_0x11ea('0xd')]('/',auth[_0x11ea('0x8')](),interaction[_0x11ea('0xe')]('mail',_0x11ea('0xf')),controller[_0x11ea('0x10')]);router[_0x11ea('0x11')](_0x11ea('0x12'),auth[_0x11ea('0x8')](),controller[_0x11ea('0x13')]);router['put']('/:id/accept',auth['isAuthenticated'](),controller[_0x11ea('0x14')]);router[_0x11ea('0x11')]('/:id/reject',auth[_0x11ea('0x8')](),controller[_0x11ea('0x15')]);router[_0x11ea('0x16')](_0x11ea('0x12'),auth[_0x11ea('0x8')](),controller[_0x11ea('0x17')]);module[_0x11ea('0x18')]=router; \ No newline at end of file +var _0x7b10=['create','put','/:id','update','accept','/:id/reject','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','isAuthenticated','index','get','/describe','describe','/:id/download','download','post','tracked','mail'];(function(_0x9540a7,_0x4388f9){var _0x13a63a=function(_0x23bace){while(--_0x23bace){_0x9540a7['push'](_0x9540a7['shift']());}};_0x13a63a(++_0x4388f9);}(_0x7b10,0x1ac));var _0x07b1=function(_0x1f1a8f,_0x1ca09e){_0x1f1a8f=_0x1f1a8f-0x0;var _0x50a839=_0x7b10[_0x1f1a8f];return _0x50a839;};'use strict';var multer=require(_0x07b1('0x0'));var util=require(_0x07b1('0x1'));var path=require(_0x07b1('0x2'));var timeout=require(_0x07b1('0x3'));var express=require(_0x07b1('0x4'));var router=express['Router']();var fs_extra=require(_0x07b1('0x5'));var auth=require(_0x07b1('0x6'));var interaction=require(_0x07b1('0x7'));var config=require(_0x07b1('0x8'));var controller=require(_0x07b1('0x9'));router['get']('/',auth[_0x07b1('0xa')](),controller[_0x07b1('0xb')]);router[_0x07b1('0xc')](_0x07b1('0xd'),auth[_0x07b1('0xa')](),controller[_0x07b1('0xe')]);router[_0x07b1('0xc')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x07b1('0xf'),auth[_0x07b1('0xa')](),controller[_0x07b1('0x10')]);router[_0x07b1('0x11')]('/',auth[_0x07b1('0xa')](),interaction[_0x07b1('0x12')](_0x07b1('0x13'),'mailmessage:create'),controller[_0x07b1('0x14')]);router[_0x07b1('0x15')](_0x07b1('0x16'),auth['isAuthenticated'](),controller[_0x07b1('0x17')]);router[_0x07b1('0x15')]('/:id/accept',auth[_0x07b1('0xa')](),controller[_0x07b1('0x18')]);router['put'](_0x07b1('0x19'),auth['isAuthenticated'](),controller['reject']);router[_0x07b1('0x1a')](_0x07b1('0x16'),auth[_0x07b1('0xa')](),controller[_0x07b1('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 92a8ac4..802e51d 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 _0xbff6=['TEXT','DATE','INTEGER','Email','Chat','sequelize','exports','long','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x3da434,_0x2b147c){var _0x2daa92=function(_0x2d7202){while(--_0x2d7202){_0x3da434['push'](_0x3da434['shift']());}};_0x2daa92(++_0x2b147c);}(_0xbff6,0xae));var _0x6bff=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0xbff6[_0x47fd36];return _0x21a0fc;};'use strict';var Sequelize=require(_0x6bff('0x0'));var _=require('lodash');module[_0x6bff('0x1')]={'body':{'type':Sequelize['TEXT'](_0x6bff('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x6bff('0x3'))},'read':{'type':Sequelize[_0x6bff('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6bff('0x5')]('in',_0x6bff('0x6')),'defaultValue':_0x6bff('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x6bff('0x7')]},'to':{'type':Sequelize['TEXT']('long')},'cc':{'type':Sequelize[_0x6bff('0x8')]('long')},'bcc':{'type':Sequelize[_0x6bff('0x8')](_0x6bff('0x2'))},'subject':{'type':Sequelize[_0x6bff('0x8')]},'sentAt':{'type':Sequelize[_0x6bff('0x9')]},'attach':{'type':Sequelize[_0x6bff('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x6bff('0x9')]},'originTo':{'type':Sequelize[_0x6bff('0x8')](_0x6bff('0x2'))},'originCc':{'type':Sequelize[_0x6bff('0x8')](_0x6bff('0x2'))},'originChannel':{'type':Sequelize[_0x6bff('0x5')](_0x6bff('0xb'),_0x6bff('0xc')),'defaultValue':_0x6bff('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0xe124=['medium','BOOLEAN','out','STRING','long','DATE','ENUM','Email','Chat','sequelize','lodash','exports','TEXT'];(function(_0x27c3f0,_0x198aa2){var _0x11e51c=function(_0x2a48ec){while(--_0x2a48ec){_0x27c3f0['push'](_0x27c3f0['shift']());}};_0x11e51c(++_0x198aa2);}(_0xe124,0xa5));var _0x4e12=function(_0x42abf0,_0x1d340d){_0x42abf0=_0x42abf0-0x0;var _0xeb427a=_0xe124[_0x42abf0];return _0xeb427a;};'use strict';var Sequelize=require(_0x4e12('0x0'));var _=require(_0x4e12('0x1'));module[_0x4e12('0x2')]={'body':{'type':Sequelize[_0x4e12('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x4e12('0x3')](_0x4e12('0x4'))},'read':{'type':Sequelize[_0x4e12('0x5')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x4e12('0x6')),'defaultValue':_0x4e12('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x4e12('0x7')]},'to':{'type':Sequelize[_0x4e12('0x3')](_0x4e12('0x8'))},'cc':{'type':Sequelize[_0x4e12('0x3')](_0x4e12('0x8'))},'bcc':{'type':Sequelize[_0x4e12('0x3')](_0x4e12('0x8'))},'subject':{'type':Sequelize[_0x4e12('0x3')]},'sentAt':{'type':Sequelize[_0x4e12('0x9')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x4e12('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x4e12('0x3')](_0x4e12('0x8'))},'originCc':{'type':Sequelize['TEXT'](_0x4e12('0x8'))},'originChannel':{'type':Sequelize[_0x4e12('0xa')](_0x4e12('0xb'),_0x4e12('0xc')),'defaultValue':_0x4e12('0xb'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 00cb5dc..dbaa528 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 _0x5910=['stringify','error','code','message','result','catch','status','json','undefined','limit','offset','count','set','update','destroy','end','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','merge','MailMessage','includeAll','include','findAll','rows','params','options','find','body','describe','create','direction','out','split','MailAccount','findOne','MailAccountId','CmList','List','Contacts','updatedAt','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','ListId','List\x20not\x20found','SendMail','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','mail','read','readAt','UserId','user','agent','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','SIP/%s','channel','motionChannel','event','accept','fromString','EventManager','acceptmessage','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','interface','reject','rejectmessage','download','unix','toString','server','files','tmp','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','readFileSync','writeFileSync','unlinkSync','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','jayson/promise','client','http','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s'];(function(_0x3ef674,_0x3a568b){var _0x52f9f5=function(_0x225d31){while(--_0x225d31){_0x3ef674['push'](_0x3ef674['shift']());}};_0x52f9f5(++_0x3a568b);}(_0x5910,0x8c));var _0x0591=function(_0x53baca,_0x5adc98){_0x53baca=_0x53baca-0x0;var _0x19b34b=_0x5910[_0x53baca];return _0x19b34b;};'use strict';var emlformat=require('eml-format');var moment=require('moment');var BPromise=require('bluebird');var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0x0591('0x0'));var Redis=require(_0x0591('0x1'));var htmlToText=require(_0x0591('0x2'));var qs=require(_0x0591('0x3'));var logger=require(_0x0591('0x4'))('api');var interaction_log=require('../../config/logger')(_0x0591('0x5'));var config=require(_0x0591('0x6'));var db=require(_0x0591('0x7'))['db'];config[_0x0591('0x8')]=_[_0x0591('0x9')](config[_0x0591('0x8')],{'host':_0x0591('0xa'),'port':0x18eb});var socket=require(_0x0591('0xb'))(new Redis(config['redis']));var htmlEntities=require('html-entities');require(_0x0591('0xc'))['register'](socket);var jayson=require(_0x0591('0xd'));var client=jayson[_0x0591('0xe')][_0x0591('0xf')]({'port':0x232c});var client9003=jayson[_0x0591('0xe')][_0x0591('0xf')]({'port':0x232b});var client9002=jayson[_0x0591('0xe')][_0x0591('0xf')]({'port':0x232a});function respondWithRpcPromise(_0x51ce24,_0x1318f7,_0x1e9951,_0x1d9f64){return new BPromise(function(_0x3e17b7,_0x21f480){var _0x1df261=_0x1d9f64||client;return _0x1df261['request'](_0x51ce24,_0x1e9951)[_0x0591('0x10')](function(_0x32aa03){logger[_0x0591('0x11')](_0x0591('0x12'),_0x1318f7,_0x0591('0x13'));logger[_0x0591('0x14')](_0x0591('0x15'),_0x1318f7,_0x0591('0x13'),JSON[_0x0591('0x16')](_0x32aa03));if(_0x32aa03[_0x0591('0x17')]){if(_0x32aa03[_0x0591('0x17')][_0x0591('0x18')]===0x1f4){logger[_0x0591('0x17')]('MailMessage,\x20%s,\x20%s',_0x1318f7,_0x32aa03['error']['message']);return _0x21f480(_0x32aa03['error'][_0x0591('0x19')]);}logger['error'](_0x0591('0x12'),_0x1318f7,_0x32aa03[_0x0591('0x17')][_0x0591('0x19')]);return _0x3e17b7(_0x32aa03['error'][_0x0591('0x19')]);}else{logger[_0x0591('0x11')](_0x0591('0x12'),_0x1318f7,_0x0591('0x13'));_0x3e17b7(_0x32aa03[_0x0591('0x1a')][_0x0591('0x19')]);}})[_0x0591('0x1b')](function(_0x473699){logger[_0x0591('0x17')](_0x0591('0x12'),_0x1318f7,_0x473699);_0x21f480(_0x473699);});});}function respondWithResult(_0x63ba1c,_0x23344d){_0x23344d=_0x23344d||0xc8;return function(_0x4f6275){if(_0x4f6275){return _0x63ba1c[_0x0591('0x1c')](_0x23344d)[_0x0591('0x1d')](_0x4f6275);}};}function respondWithFilteredResult(_0x2d4458,_0x380043){return function(_0x30be5a){if(_0x30be5a){var _0x1d4e4a=typeof _0x380043['offset']===_0x0591('0x1e')&&typeof _0x380043[_0x0591('0x1f')]===_0x0591('0x1e');var _0x291e92=_0x30be5a['count'];var _0x242ca1=_0x1d4e4a?0x0:_0x380043[_0x0591('0x20')];var _0x9e10b3=_0x1d4e4a?_0x30be5a[_0x0591('0x21')]:_0x380043[_0x0591('0x20')]+_0x380043[_0x0591('0x1f')];var _0x1bf700;if(_0x9e10b3>=_0x291e92){_0x9e10b3=_0x291e92;_0x1bf700=0xc8;}else{_0x1bf700=0xce;}_0x2d4458[_0x0591('0x1c')](_0x1bf700);return _0x2d4458[_0x0591('0x22')]('Content-Range',_0x242ca1+'-'+_0x9e10b3+'/'+_0x291e92)[_0x0591('0x1d')](_0x30be5a);}return null;};}function saveUpdates(_0x1dab83){return function(_0x645792){if(_0x645792){return _0x645792[_0x0591('0x23')](_0x1dab83)[_0x0591('0x10')](function(_0x2d6110){return _0x2d6110;});}return null;};}function removeEntity(_0x99a169){return function(_0x5e68ca){if(_0x5e68ca){return _0x5e68ca[_0x0591('0x24')]()[_0x0591('0x10')](function(){_0x99a169[_0x0591('0x1c')](0xcc)[_0x0591('0x25')]();});}};}function handleEntityNotFound(_0xbc91f0){return function(_0x3b5677){if(!_0x3b5677){_0xbc91f0[_0x0591('0x26')](0x194);}return _0x3b5677;};}function handleError(_0x15fccf,_0x58d897){_0x58d897=_0x58d897||0x1f4;return function(_0x3eeba5){logger[_0x0591('0x17')](_0x3eeba5[_0x0591('0x27')]);if(_0x3eeba5[_0x0591('0x28')]){delete _0x3eeba5[_0x0591('0x28')];}_0x15fccf[_0x0591('0x1c')](_0x58d897)[_0x0591('0x29')](_0x3eeba5);};}exports[_0x0591('0x2a')]=function(_0x4d1e1b,_0x27e13f){var _0x300d35={},_0x167df6={},_0x32759d={'count':0x0,'rows':[]};var _0x5a7f00=_['map'](db['MailMessage'][_0x0591('0x2b')],function(_0x32ac56){return{'name':_0x32ac56[_0x0591('0x2c')],'type':_0x32ac56[_0x0591('0x2d')][_0x0591('0x2e')]};});_0x167df6[_0x0591('0x2f')]=_[_0x0591('0x30')](_0x5a7f00,_0x0591('0x28'));_0x167df6['query']=_[_0x0591('0x31')](_0x4d1e1b[_0x0591('0x32')]);_0x167df6[_0x0591('0x33')]=_[_0x0591('0x34')](_0x167df6[_0x0591('0x2f')],_0x167df6['query']);_0x300d35['attributes']=_[_0x0591('0x34')](_0x167df6[_0x0591('0x2f')],qs[_0x0591('0x35')](_0x4d1e1b[_0x0591('0x32')][_0x0591('0x35')]));_0x300d35[_0x0591('0x36')]=_0x300d35['attributes'][_0x0591('0x37')]?_0x300d35['attributes']:_0x167df6['model'];if(!_0x4d1e1b[_0x0591('0x32')][_0x0591('0x38')](_0x0591('0x39'))){_0x300d35[_0x0591('0x1f')]=qs[_0x0591('0x1f')](_0x4d1e1b['query'][_0x0591('0x1f')]);_0x300d35['offset']=qs[_0x0591('0x20')](_0x4d1e1b[_0x0591('0x32')][_0x0591('0x20')]);}_0x300d35[_0x0591('0x3a')]=qs['sort'](_0x4d1e1b[_0x0591('0x32')]['sort']);_0x300d35[_0x0591('0x3b')]=qs['filters'](_[_0x0591('0x3c')](_0x4d1e1b[_0x0591('0x32')],_0x167df6['filters']),_0x5a7f00);if(_0x4d1e1b[_0x0591('0x32')][_0x0591('0x3d')]){_0x300d35['where']=_['merge'](_0x300d35[_0x0591('0x3b')],{'$or':_[_0x0591('0x30')](_0x5a7f00,function(_0x4e298c){if(_0x4e298c['type']!==_0x0591('0x3e')){var _0x370dcc={};_0x370dcc[_0x4e298c['name']]={'$like':'%'+_0x4d1e1b[_0x0591('0x32')][_0x0591('0x3d')]+'%'};return _0x370dcc;}})});}_0x300d35=_[_0x0591('0x3f')]({},_0x300d35,_0x4d1e1b['options']);var _0x599e98={'where':_0x300d35[_0x0591('0x3b')]};return db[_0x0591('0x40')][_0x0591('0x21')](_0x599e98)[_0x0591('0x10')](function(_0x469966){_0x32759d['count']=_0x469966;if(_0x4d1e1b[_0x0591('0x32')][_0x0591('0x41')]){_0x300d35[_0x0591('0x42')]=[{'all':!![]}];}return db[_0x0591('0x40')][_0x0591('0x43')](_0x300d35);})[_0x0591('0x10')](function(_0x529e36){_0x32759d[_0x0591('0x44')]=_0x529e36;return _0x32759d;})[_0x0591('0x10')](respondWithFilteredResult(_0x27e13f,_0x300d35))[_0x0591('0x1b')](handleError(_0x27e13f,null));};exports['show']=function(_0x4599d3,_0x533b56){var _0x1bffd4={'raw':!![],'where':{'id':_0x4599d3[_0x0591('0x45')]['id']}},_0x2ae511={};_0x2ae511[_0x0591('0x2f')]=_['keys'](db[_0x0591('0x40')]['rawAttributes']);_0x2ae511[_0x0591('0x32')]=_['keys'](_0x4599d3[_0x0591('0x32')]);_0x2ae511[_0x0591('0x33')]=_['intersection'](_0x2ae511['model'],_0x2ae511[_0x0591('0x32')]);_0x1bffd4['attributes']=_[_0x0591('0x34')](_0x2ae511['model'],qs['fields'](_0x4599d3[_0x0591('0x32')][_0x0591('0x35')]));_0x1bffd4[_0x0591('0x36')]=_0x1bffd4['attributes']['length']?_0x1bffd4[_0x0591('0x36')]:_0x2ae511[_0x0591('0x2f')];if(_0x4599d3[_0x0591('0x32')][_0x0591('0x41')]){_0x1bffd4[_0x0591('0x42')]=[{'all':!![]}];}_0x1bffd4=_['merge']({},_0x1bffd4,_0x4599d3[_0x0591('0x46')]);return db[_0x0591('0x40')][_0x0591('0x47')](_0x1bffd4)[_0x0591('0x10')](handleEntityNotFound(_0x533b56,null))[_0x0591('0x10')](respondWithResult(_0x533b56,null))['catch'](handleError(_0x533b56,null));};exports['update']=function(_0x274859,_0x33d22f){if(_0x274859[_0x0591('0x48')]['id']){delete _0x274859[_0x0591('0x48')]['id'];}return db[_0x0591('0x40')][_0x0591('0x47')]({'where':{'id':_0x274859[_0x0591('0x45')]['id']}})['then'](handleEntityNotFound(_0x33d22f,null))[_0x0591('0x10')](saveUpdates(_0x274859[_0x0591('0x48')],null))[_0x0591('0x10')](respondWithResult(_0x33d22f,null))[_0x0591('0x1b')](handleError(_0x33d22f,null));};exports[_0x0591('0x24')]=function(_0x4f2d82,_0x36c721){return db[_0x0591('0x40')][_0x0591('0x47')]({'where':{'id':_0x4f2d82[_0x0591('0x45')]['id']}})[_0x0591('0x10')](handleEntityNotFound(_0x36c721,null))[_0x0591('0x10')](removeEntity(_0x36c721,null))['catch'](handleError(_0x36c721,null));};exports['describe']=function(_0x27761a,_0x3bc829){return db[_0x0591('0x40')][_0x0591('0x49')]()[_0x0591('0x10')](respondWithResult(_0x3bc829,null))['catch'](handleError(_0x3bc829,null));};exports[_0x0591('0x4a')]=function(_0x30d085,_0x424727){return db[_0x0591('0x40')]['create'](_0x30d085[_0x0591('0x48')])[_0x0591('0x10')](function(_0x5f52f6){if(_0x5f52f6){if(_0x5f52f6[_0x0591('0x4b')]===_0x0591('0x4c')&&!_0x5f52f6['secret']){var _0x4b63e0,_0x56594f,_0x553d3c;if(_0x30d085['body']['to']){_0x56594f=_0x30d085[_0x0591('0x48')]['to'][_0x0591('0x4d')](',')[0x0];}return db[_0x0591('0x4e')][_0x0591('0x4f')]({'where':{'id':_0x5f52f6[_0x0591('0x50')]},'include':[{'model':db[_0x0591('0x51')],'as':_0x0591('0x52'),'include':[{'model':db['CmContact'],'as':_0x0591('0x53'),'where':{'email':_0x56594f},'limit':0x1,'order':[[_0x0591('0x54'),'DESC']]}]},{'model':db[_0x0591('0x55')],'as':_0x0591('0x56'),'raw':!![],'include':[{'model':db[_0x0591('0x57')],'as':'CloudProvider','raw':!![]}]}]})['then'](function(_0x40b818){_0x4b63e0=_0x40b818;if(!_0x4b63e0||!_0x4b63e0[_0x0591('0x56')])return;var _0x1d91b6=_0x4b63e0[_0x0591('0x58')]();if(_0x30d085[_0x0591('0x48')]['attachments']&&_0x30d085[_0x0591('0x48')]['attachments'][_0x0591('0x37')]){for(var _0x524880=0x0;_0x524880<_0x30d085[_0x0591('0x48')][_0x0591('0x59')]['length'];_0x524880+=0x1){_0x30d085[_0x0591('0x48')][_0x0591('0x59')][_0x524880]={'filename':_0x30d085[_0x0591('0x48')][_0x0591('0x59')][_0x524880][_0x0591('0x28')],'path':path[_0x0591('0x5a')](config[_0x0591('0x5b')],_0x0591('0x5c'),_0x30d085[_0x0591('0x48')][_0x0591('0x59')][_0x524880][_0x0591('0x5d')])};}}_0x553d3c={'account':_0x1d91b6,'message':_0x30d085['body']};return;})[_0x0591('0x10')](function(){if(_0x4b63e0['List']){if(_0x4b63e0[_0x0591('0x52')]['Contacts'][_0x0591('0x37')]){return _0x4b63e0[_0x0591('0x52')][_0x0591('0x53')][0x0];}else{return db['CmContact'][_0x0591('0x4a')](_[_0x0591('0x9')](_0x30d085[_0x0591('0x48')],{'firstName':_0x30d085['body']['to'],'email':_0x30d085['body']['to'],'phone':_0x30d085['body']['to'],'ListId':_0x4b63e0[_0x0591('0x5e')]}));}}else{throw new Error(_0x0591('0x5f'));}})['then'](function(){if(_0x553d3c){return respondWithRpcPromise(_0x0591('0x60'),_0x0591('0x61'),_0x553d3c,client9003)['then'](function(_0x5c7a1e){return _0x5f52f6[_0x0591('0x23')]({'read':!![],'messageId':_0x5c7a1e['messageId'],'sentAt':moment()[_0x0591('0x62')](_0x0591('0x63'))});})[_0x0591('0x1b')](function(_0x5b513a){logger[_0x0591('0x17')]('%s',JSON[_0x0591('0x16')](_0x5b513a));return _0x5f52f6;});}return _0x5f52f6;});}return _0x5f52f6;}})[_0x0591('0x10')](respondWithResult(_0x424727,0xc9))[_0x0591('0x1b')](handleError(_0x424727,null));};exports['accept']=function(_0x4116ce,_0x539ef0){var _0x50151f={'agent':{},'channel':_0x0591('0x64')};if(_0x4116ce[_0x0591('0x48')]['id']){delete _0x4116ce['body']['id'];}_0x4116ce[_0x0591('0x48')][_0x0591('0x65')]=!![];_0x4116ce['body'][_0x0591('0x66')]=moment()[_0x0591('0x62')]('YYYY-MM-DD\x20HH:mm:ss');_0x4116ce['body'][_0x0591('0x67')]=_0x4116ce['body'][_0x0591('0x67')]||_0x4116ce[_0x0591('0x68')]['id'];_0x50151f[_0x0591('0x69')]['id']=_0x4116ce[_0x0591('0x48')][_0x0591('0x67')];return db[_0x0591('0x40')][_0x0591('0x47')]({'where':{'id':_0x4116ce[_0x0591('0x45')]['id'],'UserId':null}})[_0x0591('0x10')](handleEntityNotFound(_0x539ef0,null))[_0x0591('0x10')](saveUpdates(_0x4116ce[_0x0591('0x48')],null))[_0x0591('0x10')](function(_0x470476){if(_0x470476){_0x50151f[_0x0591('0x19')]=_0x470476['get']({'plain':!![]});return db[_0x0591('0x6a')][_0x0591('0x47')]({'where':{'id':_0x470476[_0x0591('0x6b')]}});}return null;})['then'](handleEntityNotFound(_0x539ef0,null))['then'](function(_0x4f9623){if(_0x4f9623){return _0x4f9623[_0x0591('0x23')]({'UserId':_0x4116ce[_0x0591('0x48')][_0x0591('0x67')],'read1stAt':_[_0x0591('0x6c')](_0x4f9623[_0x0591('0x6d')])?moment()[_0x0591('0x62')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x0591('0x10')](function(_0x594141){if(_0x594141){_0x50151f[_0x0591('0x6e')]=_0x594141[_0x0591('0x6f')]({'plain':!![]});interaction_log[_0x0591('0x11')](_0x0591('0x70'),_0x4116ce[_0x0591('0x68')]['id'],_0x4116ce[_0x0591('0x68')][_0x0591('0x28')],_0x4116ce[_0x0591('0x68')][_0x0591('0x71')],_0x50151f[_0x0591('0x6e')]['id'],_0x4116ce['body']?JSON['stringify'](_0x4116ce[_0x0591('0x48')]):_0x0591('0x72'));return respondWithRpcPromise(_0x0591('0x73'),_0x0591('0x74'),_0x50151f);}return null;})['then'](function(_0x4043b0){var _0xc01366=_0x0591('0x75')+_0x4043b0[_0x0591('0x19')][_0x0591('0x76')];return db[_0x0591('0x77')][_0x0591('0x32')](_0xc01366,{'type':db[_0x0591('0x78')][_0x0591('0x79')][_0x0591('0x7a')],'raw':!![]})[_0x0591('0x10')](function(_0x5fab5d){return _0x5fab5d;});})[_0x0591('0x10')](function(_0x2d6317){if(_0x2d6317){_0x50151f['message'][_0x0591('0x7b')]=_0x2d6317[0x0];if(!_0x4116ce[_0x0591('0x48')][_0x0591('0x67')])return;return db[_0x0591('0x7c')]['find']({'where':{'id':_0x4116ce[_0x0591('0x48')]['UserId'],'role':_0x0591('0x69')},'attributes':['id',_0x0591('0x28'),_0x0591('0x7d'),_0x0591('0x7e'),_0x0591('0x7f')],'raw':!![]});}return null;})[_0x0591('0x10')](function(_0x171af4){if(!_0x171af4)return null;_0x50151f[_0x0591('0x19')][_0x0591('0x69')]=_0x171af4;return _0x50151f;})[_0x0591('0x10')](function(_0x4ad9b3){if(_0x4ad9b3){if(_0x4116ce[_0x0591('0x48')]['manual']){_0x50151f[_0x0591('0x19')]['interface']=util['format'](_0x0591('0x80'),_0x4116ce[_0x0591('0x68')][_0x0591('0x28')]);_0x50151f['message'][_0x0591('0x81')]=_0x50151f['channel'];_0x50151f['message'][_0x0591('0x82')]=_0x50151f[_0x0591('0x81')];_0x50151f[_0x0591('0x19')][_0x0591('0x83')]=_0x0591('0x84');_0x50151f['message']['body']=htmlToText[_0x0591('0x85')](_0x50151f[_0x0591('0x19')][_0x0591('0x48')]);return respondWithRpcPromise(_0x0591('0x86'),_0x0591('0x86'),{'event':_0x0591('0x87'),'message':_0x50151f[_0x0591('0x19')]},client9002)['then'](function(){return _0x50151f;});}return _0x50151f;}return null;})[_0x0591('0x10')](respondWithResult(_0x539ef0,null))[_0x0591('0x1b')](handleError(_0x539ef0,null));};exports['reject']=function(_0x4754cf,_0x32ae9a){var _0x435bdc={'agent':{},'channel':_0x0591('0x64')};if(_0x4754cf[_0x0591('0x48')]['id']){delete _0x4754cf['body']['id'];}_0x4754cf[_0x0591('0x48')][_0x0591('0x67')]=_0x4754cf[_0x0591('0x48')][_0x0591('0x67')]||_0x4754cf[_0x0591('0x68')]['id'];_0x435bdc[_0x0591('0x69')]['id']=_0x4754cf[_0x0591('0x48')][_0x0591('0x67')];return db['MailMessage'][_0x0591('0x47')]({'where':{'id':_0x4754cf['params']['id'],'UserId':null}})[_0x0591('0x10')](handleEntityNotFound(_0x32ae9a,null))[_0x0591('0x10')](function(_0x10b5ad){if(_0x10b5ad){_0x435bdc[_0x0591('0x19')]=_0x10b5ad[_0x0591('0x6f')]({'plain':!![]});return db[_0x0591('0x6a')][_0x0591('0x47')]({'where':{'id':_0x10b5ad[_0x0591('0x6b')]}});}return null;})[_0x0591('0x10')](handleEntityNotFound(_0x32ae9a,null))[_0x0591('0x10')](function(_0x3340d5){if(_0x3340d5){_0x435bdc[_0x0591('0x6e')]=_0x3340d5[_0x0591('0x6f')]({'plain':!![]});interaction_log[_0x0591('0x11')](_0x0591('0x88'),_0x4754cf['user']['id'],_0x4754cf[_0x0591('0x68')][_0x0591('0x28')],_0x4754cf[_0x0591('0x68')]['role'],_0x435bdc[_0x0591('0x6e')]['id'],_0x4754cf[_0x0591('0x48')]?JSON[_0x0591('0x16')](_0x4754cf[_0x0591('0x48')]):_0x0591('0x72'));return respondWithRpcPromise(_0x0591('0x89'),'rejectMessage',_0x435bdc);}return null;})['then'](function(_0x447773){var _0x24ecd7='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x447773[_0x0591('0x19')][_0x0591('0x76')];return db[_0x0591('0x77')][_0x0591('0x32')](_0x24ecd7,{'type':db['Sequelize'][_0x0591('0x79')]['SELECT'],'raw':!![]})[_0x0591('0x10')](function(_0x21a3d9){return _0x21a3d9;});})[_0x0591('0x10')](function(_0x493a76){if(_0x493a76){_0x435bdc['message'][_0x0591('0x7b')]=_0x493a76[0x0];if(!_0x4754cf[_0x0591('0x48')][_0x0591('0x67')])return;return db[_0x0591('0x7c')]['find']({'where':{'id':_0x4754cf[_0x0591('0x48')][_0x0591('0x67')],'role':_0x0591('0x69')},'attributes':['id',_0x0591('0x28'),_0x0591('0x7d'),_0x0591('0x7e'),_0x0591('0x7f')],'raw':!![]});}return null;})[_0x0591('0x10')](function(_0x55d8f7){if(!_0x55d8f7)return null;_0x435bdc['message'][_0x0591('0x69')]=_0x55d8f7;return _0x435bdc;})[_0x0591('0x10')](function(_0x2ff034){if(_0x2ff034){_0x2ff034[_0x0591('0x19')][_0x0591('0x8a')]=util[_0x0591('0x62')]('SIP/%s',_0x4754cf[_0x0591('0x68')][_0x0591('0x28')]);_0x2ff034[_0x0591('0x19')][_0x0591('0x81')]=_0x435bdc[_0x0591('0x81')];_0x2ff034[_0x0591('0x19')][_0x0591('0x82')]=_0x435bdc[_0x0591('0x81')];_0x2ff034[_0x0591('0x19')]['event']=_0x0591('0x8b');_0x2ff034[_0x0591('0x19')][_0x0591('0x48')]=htmlToText[_0x0591('0x85')](_0x435bdc['message'][_0x0591('0x48')]);respondWithRpcPromise(_0x0591('0x86'),_0x0591('0x86'),{'event':_0x0591('0x8c'),'message':_0x2ff034['message']},client9002);return _0x435bdc;}return null;})[_0x0591('0x10')](respondWithResult(_0x32ae9a,null))[_0x0591('0x1b')](handleError(_0x32ae9a,null));};exports[_0x0591('0x8d')]=function(_0x57dbf6,_0x1d930b){var _0x368cc3=moment()[_0x0591('0x8e')]()[_0x0591('0x8f')]();var _0x80775f=path[_0x0591('0x5a')](config[_0x0591('0x5b')],_0x0591('0x90'),_0x0591('0x91'),_0x0591('0x92'));var _0x4ce042=path[_0x0591('0x5a')](config[_0x0591('0x5b')],'server',_0x0591('0x91'),_0x0591('0x59'));var _0x8d701c=util[_0x0591('0x62')](_0x0591('0x93'),_0x368cc3);return db[_0x0591('0x40')][_0x0591('0x47')]({'where':{'id':_0x57dbf6[_0x0591('0x45')]['id']},'attributes':['id',_0x0591('0x48'),_0x0591('0x94'),'to','cc',_0x0591('0x95'),_0x0591('0x96'),_0x0591('0x97')],'include':_0x57dbf6['query'][_0x0591('0x59')]?[{'model':db[_0x0591('0x98')],'as':_0x0591('0x99')}]:undefined})[_0x0591('0x10')](handleEntityNotFound(_0x1d930b,null))[_0x0591('0x10')](function(_0x3031ad){if(_0x3031ad){var _0x4de18b=_0x3031ad;var _0x1bd7fe={'from':_0x4de18b['from'],'to':_0x4de18b['to'],'subject':_0x4de18b[_0x0591('0x96')],'html':htmlEntities[_0x0591('0x9a')](_0x4de18b[_0x0591('0x48')]),'headers':{'Date':moment(_0x4de18b['createdAt'])[_0x0591('0x62')](_0x0591('0x9b'))},'attachments':[]};if(_0x3031ad['cc']){_0x1bd7fe[_0x0591('0x9c')]['Cc']=_0x3031ad['cc'];}if(_0x3031ad[_0x0591('0x95')]){_0x1bd7fe[_0x0591('0x9c')][_0x0591('0x9d')]=_0x3031ad[_0x0591('0x95')];}return new BPromise(function(_0x4936f0,_0x29beb1){if(_0x3031ad[_0x0591('0x99')]){for(var _0x30b1e8=0x0;_0x30b1e8<_0x3031ad[_0x0591('0x99')][_0x0591('0x37')];_0x30b1e8++){var _0x349ce0=_0x3031ad['Attachments'][_0x30b1e8];var _0x95364c=path[_0x0591('0x5a')](_0x4ce042,_0x349ce0[_0x0591('0x5d')]);if(fs[_0x0591('0x9e')](_0x95364c)){_0x1bd7fe[_0x0591('0x59')]['push']({'name':_0x349ce0[_0x0591('0x28')],'contentType':_0x349ce0['type'],'data':fs[_0x0591('0x9f')](_0x95364c)});}}}emlformat['build'](_0x1bd7fe,function(_0x2a2511,_0x590c29){if(_0x2a2511)return _0x29beb1(_0x2a2511);fs[_0x0591('0xa0')](path[_0x0591('0x5a')](_0x80775f,_0x8d701c),_0x590c29);return _0x4936f0(_0x590c29);});});}})['then'](function(_0x2f0fe7){if(_0x2f0fe7){return _0x1d930b[_0x0591('0x8d')](path['join'](_0x80775f,_0x8d701c),_0x8d701c,function(_0x258181){if(!_0x258181)fs[_0x0591('0xa1')](path['join'](_0x80775f,_0x8d701c));});}})[_0x0591('0x1b')](handleError(_0x1d930b,null));}; \ No newline at end of file +var _0xf2de=['request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','undefined','limit','count','offset','set','Content-Range','json','destroy','stack','name','index','map','MailMessage','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','fields','hasOwnProperty','order','sort','filters','filter','where','merge','VIRTUAL','includeAll','findAll','show','params','length','include','options','find','update','body','describe','create','direction','secret','split','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','server/files/attachments','basename','ListId','messageId','format','stringify','accept','mail','read','readAt','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectmessage','download','toString','server','tmp','root','files','from','subject','Attachment','Attachments','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','existsSync','push','build','writeFileSync','unlinkSync','eml-format','bluebird','util','path','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','./mailMessage.socket','register','client','http','request','then','info','MailMessage,\x20%s,\x20%s'];(function(_0x44a430,_0x309f07){var _0x30c824=function(_0x2a11d4){while(--_0x2a11d4){_0x44a430['push'](_0x44a430['shift']());}};_0x30c824(++_0x309f07);}(_0xf2de,0x85));var _0xef2d=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0xf2de[_0xa8883];return _0x479426;};'use strict';var emlformat=require(_0xef2d('0x0'));var moment=require('moment');var BPromise=require(_0xef2d('0x1'));var util=require(_0xef2d('0x2'));var path=require(_0xef2d('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var htmlToText=require(_0xef2d('0x4'));var qs=require(_0xef2d('0x5'));var logger=require(_0xef2d('0x6'))(_0xef2d('0x7'));var interaction_log=require(_0xef2d('0x6'))(_0xef2d('0x8'));var config=require(_0xef2d('0x9'));var db=require(_0xef2d('0xa'))['db'];config[_0xef2d('0xb')]=_[_0xef2d('0xc')](config[_0xef2d('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var htmlEntities=require('html-entities');require(_0xef2d('0xd'))[_0xef2d('0xe')](socket);var jayson=require('jayson/promise');var client=jayson[_0xef2d('0xf')][_0xef2d('0x10')]({'port':0x232c});var client9003=jayson['client'][_0xef2d('0x10')]({'port':0x232b});var client9002=jayson[_0xef2d('0xf')][_0xef2d('0x10')]({'port':0x232a});function respondWithRpcPromise(_0x11f362,_0x336f3a,_0x536a68,_0x341397){return new BPromise(function(_0x44210a,_0x20baac){var _0x4b25b8=_0x341397||client;return _0x4b25b8[_0xef2d('0x11')](_0x11f362,_0x536a68)[_0xef2d('0x12')](function(_0x23333c){logger[_0xef2d('0x13')](_0xef2d('0x14'),_0x336f3a,_0xef2d('0x15'));logger[_0xef2d('0x16')](_0xef2d('0x17'),_0x336f3a,_0xef2d('0x15'),JSON['stringify'](_0x23333c));if(_0x23333c['error']){if(_0x23333c[_0xef2d('0x18')]['code']===0x1f4){logger[_0xef2d('0x18')](_0xef2d('0x14'),_0x336f3a,_0x23333c[_0xef2d('0x18')]['message']);return _0x20baac(_0x23333c['error'][_0xef2d('0x19')]);}logger[_0xef2d('0x18')](_0xef2d('0x14'),_0x336f3a,_0x23333c['error']['message']);return _0x44210a(_0x23333c['error'][_0xef2d('0x19')]);}else{logger[_0xef2d('0x13')]('MailMessage,\x20%s,\x20%s',_0x336f3a,'request\x20sent');_0x44210a(_0x23333c[_0xef2d('0x1a')]['message']);}})[_0xef2d('0x1b')](function(_0x4ea32a){logger['error']('MailMessage,\x20%s,\x20%s',_0x336f3a,_0x4ea32a);_0x20baac(_0x4ea32a);});});}function respondWithResult(_0x1d269d,_0x1543d5){_0x1543d5=_0x1543d5||0xc8;return function(_0x231422){if(_0x231422){return _0x1d269d['status'](_0x1543d5)['json'](_0x231422);}};}function respondWithFilteredResult(_0x50d4ca,_0x3273de){return function(_0x4af28c){if(_0x4af28c){var _0x435c45=typeof _0x3273de['offset']===_0xef2d('0x1c')&&typeof _0x3273de[_0xef2d('0x1d')]===_0xef2d('0x1c');var _0x3eb435=_0x4af28c[_0xef2d('0x1e')];var _0xfbdbbe=_0x435c45?0x0:_0x3273de[_0xef2d('0x1f')];var _0x468b95=_0x435c45?_0x4af28c[_0xef2d('0x1e')]:_0x3273de['offset']+_0x3273de['limit'];var _0x9c988a;if(_0x468b95>=_0x3eb435){_0x468b95=_0x3eb435;_0x9c988a=0xc8;}else{_0x9c988a=0xce;}_0x50d4ca['status'](_0x9c988a);return _0x50d4ca[_0xef2d('0x20')](_0xef2d('0x21'),_0xfbdbbe+'-'+_0x468b95+'/'+_0x3eb435)[_0xef2d('0x22')](_0x4af28c);}return null;};}function saveUpdates(_0x33ceb0){return function(_0x15e353){if(_0x15e353){return _0x15e353['update'](_0x33ceb0)['then'](function(_0x3fa5ca){return _0x3fa5ca;});}return null;};}function removeEntity(_0x321bde){return function(_0x1095ee){if(_0x1095ee){return _0x1095ee[_0xef2d('0x23')]()[_0xef2d('0x12')](function(){_0x321bde['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4794c8){return function(_0x5b4e2e){if(!_0x5b4e2e){_0x4794c8['sendStatus'](0x194);}return _0x5b4e2e;};}function handleError(_0x3eaca2,_0x14161f){_0x14161f=_0x14161f||0x1f4;return function(_0x114f2d){logger['error'](_0x114f2d[_0xef2d('0x24')]);if(_0x114f2d[_0xef2d('0x25')]){delete _0x114f2d[_0xef2d('0x25')];}_0x3eaca2['status'](_0x14161f)['send'](_0x114f2d);};}exports[_0xef2d('0x26')]=function(_0x329a24,_0x26ff91){var _0x5a0161={},_0x56fa6c={},_0x5c995b={'count':0x0,'rows':[]};var _0x2b5241=_[_0xef2d('0x27')](db[_0xef2d('0x28')][_0xef2d('0x29')],function(_0x667b7){return{'name':_0x667b7[_0xef2d('0x2a')],'type':_0x667b7[_0xef2d('0x2b')]['key']};});_0x56fa6c[_0xef2d('0x2c')]=_[_0xef2d('0x27')](_0x2b5241,_0xef2d('0x25'));_0x56fa6c['query']=_[_0xef2d('0x2d')](_0x329a24[_0xef2d('0x2e')]);_0x56fa6c['filters']=_[_0xef2d('0x2f')](_0x56fa6c[_0xef2d('0x2c')],_0x56fa6c[_0xef2d('0x2e')]);_0x5a0161[_0xef2d('0x30')]=_[_0xef2d('0x2f')](_0x56fa6c['model'],qs[_0xef2d('0x31')](_0x329a24[_0xef2d('0x2e')][_0xef2d('0x31')]));_0x5a0161[_0xef2d('0x30')]=_0x5a0161[_0xef2d('0x30')]['length']?_0x5a0161[_0xef2d('0x30')]:_0x56fa6c[_0xef2d('0x2c')];if(!_0x329a24['query'][_0xef2d('0x32')]('nolimit')){_0x5a0161[_0xef2d('0x1d')]=qs[_0xef2d('0x1d')](_0x329a24['query'][_0xef2d('0x1d')]);_0x5a0161['offset']=qs[_0xef2d('0x1f')](_0x329a24['query'][_0xef2d('0x1f')]);}_0x5a0161[_0xef2d('0x33')]=qs[_0xef2d('0x34')](_0x329a24[_0xef2d('0x2e')][_0xef2d('0x34')]);_0x5a0161['where']=qs[_0xef2d('0x35')](_['pick'](_0x329a24[_0xef2d('0x2e')],_0x56fa6c[_0xef2d('0x35')]),_0x2b5241);if(_0x329a24['query'][_0xef2d('0x36')]){_0x5a0161[_0xef2d('0x37')]=_[_0xef2d('0x38')](_0x5a0161[_0xef2d('0x37')],{'$or':_[_0xef2d('0x27')](_0x2b5241,function(_0x4097ee){if(_0x4097ee[_0xef2d('0x2b')]!==_0xef2d('0x39')){var _0x29457c={};_0x29457c[_0x4097ee['name']]={'$like':'%'+_0x329a24[_0xef2d('0x2e')]['filter']+'%'};return _0x29457c;}})});}_0x5a0161=_[_0xef2d('0x38')]({},_0x5a0161,_0x329a24['options']);var _0x2f1fed={'where':_0x5a0161['where']};return db[_0xef2d('0x28')][_0xef2d('0x1e')](_0x2f1fed)[_0xef2d('0x12')](function(_0x1a78c0){_0x5c995b[_0xef2d('0x1e')]=_0x1a78c0;if(_0x329a24['query'][_0xef2d('0x3a')]){_0x5a0161['include']=[{'all':!![]}];}return db['MailMessage'][_0xef2d('0x3b')](_0x5a0161);})[_0xef2d('0x12')](function(_0x35de52){_0x5c995b['rows']=_0x35de52;return _0x5c995b;})[_0xef2d('0x12')](respondWithFilteredResult(_0x26ff91,_0x5a0161))[_0xef2d('0x1b')](handleError(_0x26ff91,null));};exports[_0xef2d('0x3c')]=function(_0x291f4d,_0x35134d){var _0x1b4f65={'raw':!![],'where':{'id':_0x291f4d[_0xef2d('0x3d')]['id']}},_0x28d184={};_0x28d184[_0xef2d('0x2c')]=_[_0xef2d('0x2d')](db[_0xef2d('0x28')][_0xef2d('0x29')]);_0x28d184[_0xef2d('0x2e')]=_[_0xef2d('0x2d')](_0x291f4d[_0xef2d('0x2e')]);_0x28d184[_0xef2d('0x35')]=_[_0xef2d('0x2f')](_0x28d184[_0xef2d('0x2c')],_0x28d184[_0xef2d('0x2e')]);_0x1b4f65[_0xef2d('0x30')]=_[_0xef2d('0x2f')](_0x28d184['model'],qs[_0xef2d('0x31')](_0x291f4d['query'][_0xef2d('0x31')]));_0x1b4f65['attributes']=_0x1b4f65['attributes'][_0xef2d('0x3e')]?_0x1b4f65[_0xef2d('0x30')]:_0x28d184[_0xef2d('0x2c')];if(_0x291f4d['query'][_0xef2d('0x3a')]){_0x1b4f65[_0xef2d('0x3f')]=[{'all':!![]}];}_0x1b4f65=_[_0xef2d('0x38')]({},_0x1b4f65,_0x291f4d[_0xef2d('0x40')]);return db[_0xef2d('0x28')][_0xef2d('0x41')](_0x1b4f65)['then'](handleEntityNotFound(_0x35134d,null))[_0xef2d('0x12')](respondWithResult(_0x35134d,null))['catch'](handleError(_0x35134d,null));};exports[_0xef2d('0x42')]=function(_0x2a5a69,_0x5aa37f){if(_0x2a5a69[_0xef2d('0x43')]['id']){delete _0x2a5a69['body']['id'];}return db['MailMessage'][_0xef2d('0x41')]({'where':{'id':_0x2a5a69['params']['id']}})[_0xef2d('0x12')](handleEntityNotFound(_0x5aa37f,null))[_0xef2d('0x12')](saveUpdates(_0x2a5a69[_0xef2d('0x43')],null))['then'](respondWithResult(_0x5aa37f,null))[_0xef2d('0x1b')](handleError(_0x5aa37f,null));};exports[_0xef2d('0x23')]=function(_0x4a7fc9,_0x53c003){return db['MailMessage']['find']({'where':{'id':_0x4a7fc9[_0xef2d('0x3d')]['id']}})[_0xef2d('0x12')](handleEntityNotFound(_0x53c003,null))['then'](removeEntity(_0x53c003,null))['catch'](handleError(_0x53c003,null));};exports['describe']=function(_0x54594b,_0x1fa8b8){return db[_0xef2d('0x28')][_0xef2d('0x44')]()['then'](respondWithResult(_0x1fa8b8,null))['catch'](handleError(_0x1fa8b8,null));};exports[_0xef2d('0x45')]=function(_0x2c2348,_0x70fc9d){return db[_0xef2d('0x28')][_0xef2d('0x45')](_0x2c2348[_0xef2d('0x43')])[_0xef2d('0x12')](function(_0x4f7bea){if(_0x4f7bea){if(_0x4f7bea[_0xef2d('0x46')]==='out'&&!_0x4f7bea[_0xef2d('0x47')]){var _0x3dd888,_0xdc0a14,_0x30e4d0;if(_0x2c2348[_0xef2d('0x43')]['to']){_0xdc0a14=_0x2c2348[_0xef2d('0x43')]['to'][_0xef2d('0x48')](',')[0x0];}return db['MailAccount'][_0xef2d('0x49')]({'where':{'id':_0x4f7bea[_0xef2d('0x4a')]},'include':[{'model':db[_0xef2d('0x4b')],'as':_0xef2d('0x4c'),'include':[{'model':db[_0xef2d('0x4d')],'as':_0xef2d('0x4e'),'where':{'email':_0xdc0a14},'limit':0x1,'order':[[_0xef2d('0x4f'),_0xef2d('0x50')]]}]},{'model':db[_0xef2d('0x51')],'as':_0xef2d('0x52'),'raw':!![],'include':[{'model':db[_0xef2d('0x53')],'as':_0xef2d('0x53'),'raw':!![]}]}]})['then'](function(_0x4c6cbe){_0x3dd888=_0x4c6cbe;if(!_0x3dd888||!_0x3dd888[_0xef2d('0x52')])return;var _0x233bae=_0x3dd888[_0xef2d('0x54')]();if(_0x2c2348[_0xef2d('0x43')][_0xef2d('0x55')]&&_0x2c2348['body']['attachments'][_0xef2d('0x3e')]){for(var _0x27b5fa=0x0;_0x27b5fa<_0x2c2348['body'][_0xef2d('0x55')]['length'];_0x27b5fa+=0x1){_0x2c2348['body'][_0xef2d('0x55')][_0x27b5fa]={'filename':_0x2c2348['body'][_0xef2d('0x55')][_0x27b5fa][_0xef2d('0x25')],'path':path[_0xef2d('0x56')](config['root'],_0xef2d('0x57'),_0x2c2348[_0xef2d('0x43')][_0xef2d('0x55')][_0x27b5fa][_0xef2d('0x58')])};}}_0x30e4d0={'account':_0x233bae,'message':_0x2c2348[_0xef2d('0x43')]};return;})[_0xef2d('0x12')](function(){if(_0x3dd888[_0xef2d('0x4c')]){if(_0x3dd888[_0xef2d('0x4c')]['Contacts']['length']){return _0x3dd888[_0xef2d('0x4c')][_0xef2d('0x4e')][0x0];}else{return db[_0xef2d('0x4d')]['create'](_['defaults'](_0x2c2348[_0xef2d('0x43')],{'firstName':_0x2c2348[_0xef2d('0x43')]['to'],'email':_0x2c2348['body']['to'],'phone':_0x2c2348[_0xef2d('0x43')]['to'],'ListId':_0x3dd888[_0xef2d('0x59')]}));}}else{throw new Error('List\x20not\x20found');}})[_0xef2d('0x12')](function(){if(_0x30e4d0){return respondWithRpcPromise('SendMail','sendMail',_0x30e4d0,client9003)['then'](function(_0x3b1773){return _0x4f7bea[_0xef2d('0x42')]({'read':!![],'messageId':_0x3b1773[_0xef2d('0x5a')],'sentAt':moment()[_0xef2d('0x5b')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xef2d('0x1b')](function(_0x27e861){logger[_0xef2d('0x18')]('%s',JSON[_0xef2d('0x5c')](_0x27e861));return _0x4f7bea;});}return _0x4f7bea;});}return _0x4f7bea;}})[_0xef2d('0x12')](respondWithResult(_0x70fc9d,0xc9))[_0xef2d('0x1b')](handleError(_0x70fc9d,null));};exports[_0xef2d('0x5d')]=function(_0x18f6dd,_0x5af314){var _0x5635d1={'agent':{},'channel':_0xef2d('0x5e')};if(_0x18f6dd[_0xef2d('0x43')]['id']){delete _0x18f6dd[_0xef2d('0x43')]['id'];}_0x18f6dd[_0xef2d('0x43')][_0xef2d('0x5f')]=!![];_0x18f6dd[_0xef2d('0x43')][_0xef2d('0x60')]=moment()[_0xef2d('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');_0x18f6dd[_0xef2d('0x43')][_0xef2d('0x61')]=_0x18f6dd['body'][_0xef2d('0x61')]||_0x18f6dd[_0xef2d('0x62')]['id'];_0x5635d1[_0xef2d('0x63')]['id']=_0x18f6dd[_0xef2d('0x43')][_0xef2d('0x61')];return db[_0xef2d('0x28')][_0xef2d('0x41')]({'where':{'id':_0x18f6dd[_0xef2d('0x3d')]['id'],'UserId':null}})[_0xef2d('0x12')](handleEntityNotFound(_0x5af314,null))['then'](saveUpdates(_0x18f6dd[_0xef2d('0x43')],null))[_0xef2d('0x12')](function(_0x5dd15a){if(_0x5dd15a){_0x5635d1['message']=_0x5dd15a[_0xef2d('0x64')]({'plain':!![]});return db[_0xef2d('0x65')][_0xef2d('0x41')]({'where':{'id':_0x5dd15a[_0xef2d('0x66')]}});}return null;})[_0xef2d('0x12')](handleEntityNotFound(_0x5af314,null))[_0xef2d('0x12')](function(_0x40096e){if(_0x40096e){return _0x40096e[_0xef2d('0x42')]({'UserId':_0x18f6dd[_0xef2d('0x43')][_0xef2d('0x61')],'read1stAt':_[_0xef2d('0x67')](_0x40096e[_0xef2d('0x68')])?moment()[_0xef2d('0x5b')](_0xef2d('0x69')):undefined});}return null;})[_0xef2d('0x12')](function(_0x304a24){if(_0x304a24){_0x5635d1[_0xef2d('0x6a')]=_0x304a24[_0xef2d('0x64')]({'plain':!![]});interaction_log[_0xef2d('0x13')](_0xef2d('0x6b'),_0x18f6dd['user']['id'],_0x18f6dd[_0xef2d('0x62')][_0xef2d('0x25')],_0x18f6dd[_0xef2d('0x62')][_0xef2d('0x6c')],_0x5635d1[_0xef2d('0x6a')]['id'],_0x18f6dd[_0xef2d('0x43')]?JSON['stringify'](_0x18f6dd[_0xef2d('0x43')]):_0xef2d('0x6d'));return respondWithRpcPromise(_0xef2d('0x6e'),_0xef2d('0x6f'),_0x5635d1);}return null;})['then'](function(_0x117dcd){var _0x489fb0=_0xef2d('0x70')+_0x117dcd[_0xef2d('0x19')][_0xef2d('0x71')];return db[_0xef2d('0x72')][_0xef2d('0x2e')](_0x489fb0,{'type':db['Sequelize'][_0xef2d('0x73')][_0xef2d('0x74')],'raw':!![]})['then'](function(_0x10936c){return _0x10936c;});})[_0xef2d('0x12')](function(_0x569d6c){if(_0x569d6c){_0x5635d1[_0xef2d('0x19')][_0xef2d('0x75')]=_0x569d6c[0x0];if(!_0x18f6dd[_0xef2d('0x43')]['UserId'])return;return db[_0xef2d('0x76')][_0xef2d('0x41')]({'where':{'id':_0x18f6dd['body'][_0xef2d('0x61')],'role':_0xef2d('0x63')},'attributes':['id',_0xef2d('0x25'),_0xef2d('0x77'),_0xef2d('0x78'),_0xef2d('0x79')],'raw':!![]});}return null;})['then'](function(_0x4deb6b){if(!_0x4deb6b)return null;_0x5635d1[_0xef2d('0x19')][_0xef2d('0x63')]=_0x4deb6b;return _0x5635d1;})['then'](function(_0x39cbf2){if(_0x39cbf2){if(_0x18f6dd[_0xef2d('0x43')]['manual']){_0x5635d1[_0xef2d('0x19')][_0xef2d('0x7a')]=util[_0xef2d('0x5b')](_0xef2d('0x7b'),_0x18f6dd[_0xef2d('0x62')][_0xef2d('0x25')]);_0x5635d1['message'][_0xef2d('0x7c')]=_0x5635d1[_0xef2d('0x7c')];_0x5635d1['message'][_0xef2d('0x7d')]=_0x5635d1[_0xef2d('0x7c')];_0x5635d1[_0xef2d('0x19')][_0xef2d('0x7e')]='accept';_0x5635d1[_0xef2d('0x19')][_0xef2d('0x43')]=htmlToText[_0xef2d('0x7f')](_0x5635d1['message'][_0xef2d('0x43')]);return respondWithRpcPromise(_0xef2d('0x80'),_0xef2d('0x80'),{'event':_0xef2d('0x81'),'message':_0x5635d1[_0xef2d('0x19')]},client9002)[_0xef2d('0x12')](function(){return _0x5635d1;});}return _0x5635d1;}return null;})[_0xef2d('0x12')](respondWithResult(_0x5af314,null))[_0xef2d('0x1b')](handleError(_0x5af314,null));};exports[_0xef2d('0x82')]=function(_0xb2152a,_0x2de754){var _0xef69d6={'agent':{},'channel':_0xef2d('0x5e')};if(_0xb2152a[_0xef2d('0x43')]['id']){delete _0xb2152a[_0xef2d('0x43')]['id'];}_0xb2152a[_0xef2d('0x43')][_0xef2d('0x61')]=_0xb2152a[_0xef2d('0x43')][_0xef2d('0x61')]||_0xb2152a['user']['id'];_0xef69d6[_0xef2d('0x63')]['id']=_0xb2152a[_0xef2d('0x43')][_0xef2d('0x61')];return db[_0xef2d('0x28')][_0xef2d('0x41')]({'where':{'id':_0xb2152a[_0xef2d('0x3d')]['id'],'UserId':null}})[_0xef2d('0x12')](handleEntityNotFound(_0x2de754,null))[_0xef2d('0x12')](function(_0x2137dd){if(_0x2137dd){_0xef69d6[_0xef2d('0x19')]=_0x2137dd[_0xef2d('0x64')]({'plain':!![]});return db[_0xef2d('0x65')]['find']({'where':{'id':_0x2137dd[_0xef2d('0x66')]}});}return null;})[_0xef2d('0x12')](handleEntityNotFound(_0x2de754,null))[_0xef2d('0x12')](function(_0x543e82){if(_0x543e82){_0xef69d6[_0xef2d('0x6a')]=_0x543e82['get']({'plain':!![]});interaction_log[_0xef2d('0x13')](_0xef2d('0x83'),_0xb2152a['user']['id'],_0xb2152a['user']['name'],_0xb2152a['user'][_0xef2d('0x6c')],_0xef69d6['interaction']['id'],_0xb2152a['body']?JSON[_0xef2d('0x5c')](_0xb2152a[_0xef2d('0x43')]):_0xef2d('0x6d'));return respondWithRpcPromise(_0xef2d('0x84'),'rejectMessage',_0xef69d6);}return null;})[_0xef2d('0x12')](function(_0x4ad6f1){var _0x169ebb='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4ad6f1[_0xef2d('0x19')][_0xef2d('0x71')];return db[_0xef2d('0x72')]['query'](_0x169ebb,{'type':db['Sequelize'][_0xef2d('0x73')][_0xef2d('0x74')],'raw':!![]})[_0xef2d('0x12')](function(_0x59c35f){return _0x59c35f;});})[_0xef2d('0x12')](function(_0x45ab92){if(_0x45ab92){_0xef69d6['message'][_0xef2d('0x75')]=_0x45ab92[0x0];if(!_0xb2152a[_0xef2d('0x43')][_0xef2d('0x61')])return;return db[_0xef2d('0x76')][_0xef2d('0x41')]({'where':{'id':_0xb2152a[_0xef2d('0x43')][_0xef2d('0x61')],'role':'agent'},'attributes':['id',_0xef2d('0x25'),_0xef2d('0x77'),'email',_0xef2d('0x79')],'raw':!![]});}return null;})['then'](function(_0x3ca7e6){if(!_0x3ca7e6)return null;_0xef69d6['message']['agent']=_0x3ca7e6;return _0xef69d6;})[_0xef2d('0x12')](function(_0x1cfd70){if(_0x1cfd70){_0x1cfd70[_0xef2d('0x19')][_0xef2d('0x7a')]=util['format']('SIP/%s',_0xb2152a['user'][_0xef2d('0x25')]);_0x1cfd70[_0xef2d('0x19')][_0xef2d('0x7c')]=_0xef69d6[_0xef2d('0x7c')];_0x1cfd70['message'][_0xef2d('0x7d')]=_0xef69d6[_0xef2d('0x7c')];_0x1cfd70[_0xef2d('0x19')][_0xef2d('0x7e')]='reject';_0x1cfd70['message'][_0xef2d('0x43')]=htmlToText[_0xef2d('0x7f')](_0xef69d6['message']['body']);respondWithRpcPromise(_0xef2d('0x80'),_0xef2d('0x80'),{'event':_0xef2d('0x85'),'message':_0x1cfd70[_0xef2d('0x19')]},client9002);return _0xef69d6;}return null;})[_0xef2d('0x12')](respondWithResult(_0x2de754,null))[_0xef2d('0x1b')](handleError(_0x2de754,null));};exports[_0xef2d('0x86')]=function(_0x1cc99e,_0x241f12){var _0x4b6be2=moment()['unix']()[_0xef2d('0x87')]();var _0x3927be=path[_0xef2d('0x56')](config['root'],_0xef2d('0x88'),'files',_0xef2d('0x89'));var _0x22f279=path[_0xef2d('0x56')](config[_0xef2d('0x8a')],_0xef2d('0x88'),_0xef2d('0x8b'),_0xef2d('0x55'));var _0x37c18b=util[_0xef2d('0x5b')]('message-%s.eml',_0x4b6be2);return db[_0xef2d('0x28')][_0xef2d('0x41')]({'where':{'id':_0x1cc99e['params']['id']},'attributes':['id','body',_0xef2d('0x8c'),'to','cc','bcc',_0xef2d('0x8d'),'createdAt'],'include':_0x1cc99e[_0xef2d('0x2e')][_0xef2d('0x55')]?[{'model':db[_0xef2d('0x8e')],'as':_0xef2d('0x8f')}]:undefined})['then'](handleEntityNotFound(_0x241f12,null))[_0xef2d('0x12')](function(_0x4f2a86){if(_0x4f2a86){var _0x2d4ddf=_0x4f2a86;var _0x23f994={'from':_0x2d4ddf[_0xef2d('0x8c')],'to':_0x2d4ddf['to'],'subject':_0x2d4ddf[_0xef2d('0x8d')],'html':htmlEntities['decode'](_0x2d4ddf[_0xef2d('0x43')]),'headers':{'Date':moment(_0x2d4ddf[_0xef2d('0x90')])['format'](_0xef2d('0x91'))},'attachments':[]};if(_0x4f2a86['cc']){_0x23f994[_0xef2d('0x92')]['Cc']=_0x4f2a86['cc'];}if(_0x4f2a86[_0xef2d('0x93')]){_0x23f994[_0xef2d('0x92')][_0xef2d('0x94')]=_0x4f2a86[_0xef2d('0x93')];}return new BPromise(function(_0xe44b1c,_0x16f26f){if(_0x4f2a86[_0xef2d('0x8f')]){for(var _0x23ea69=0x0;_0x23ea69<_0x4f2a86[_0xef2d('0x8f')][_0xef2d('0x3e')];_0x23ea69++){var _0xe1807b=_0x4f2a86[_0xef2d('0x8f')][_0x23ea69];var _0x2fe816=path[_0xef2d('0x56')](_0x22f279,_0xe1807b[_0xef2d('0x58')]);if(fs[_0xef2d('0x95')](_0x2fe816)){_0x23f994[_0xef2d('0x55')][_0xef2d('0x96')]({'name':_0xe1807b[_0xef2d('0x25')],'contentType':_0xe1807b['type'],'data':fs['readFileSync'](_0x2fe816)});}}}emlformat[_0xef2d('0x97')](_0x23f994,function(_0x89c106,_0x189c29){if(_0x89c106)return _0x16f26f(_0x89c106);fs[_0xef2d('0x98')](path[_0xef2d('0x56')](_0x3927be,_0x37c18b),_0x189c29);return _0xe44b1c(_0x189c29);});});}})['then'](function(_0x4d2ba9){if(_0x4d2ba9){return _0x241f12['download'](path[_0xef2d('0x56')](_0x3927be,_0x37c18b),_0x37c18b,function(_0x314de0){if(!_0x314de0)fs[_0xef2d('0x99')](path[_0xef2d('0x56')](_0x3927be,_0x37c18b));});}})['catch'](handleError(_0x241f12,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 808a1f0..5b5f515 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 _0x97b1=['setMaxListeners','save','update','emit','hasOwnProperty','hook','events','../../mysqldb','MailMessage'];(function(_0x15c14c,_0x171df3){var _0x1f73eb=function(_0x430ffd){while(--_0x430ffd){_0x15c14c['push'](_0x15c14c['shift']());}};_0x1f73eb(++_0x171df3);}(_0x97b1,0x189));var _0x197b=function(_0x460666,_0x24bfa0){_0x460666=_0x460666-0x0;var _0x555cbf=_0x97b1[_0x460666];return _0x555cbf;};'use strict';var EventEmitter=require(_0x197b('0x0'));var MailMessage=require(_0x197b('0x1'))['db'][_0x197b('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x197b('0x3')](0x0);var events={'afterCreate':_0x197b('0x4'),'afterUpdate':_0x197b('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2b3705){return function(_0x39c80d,_0x51bb48,_0x2bcea3){MailMessageEvents[_0x197b('0x6')](_0x2b3705+':'+_0x39c80d['id'],_0x39c80d);MailMessageEvents[_0x197b('0x6')](_0x2b3705,_0x39c80d);_0x2bcea3(null);};}for(var e in events){if(events[_0x197b('0x7')](e)){var event=events[e];MailMessage[_0x197b('0x8')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0x7a55=['hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','save','remove','emit'];(function(_0x53ad9c,_0x448a91){var _0x51a477=function(_0x1cc81e){while(--_0x1cc81e){_0x53ad9c['push'](_0x53ad9c['shift']());}};_0x51a477(++_0x448a91);}(_0x7a55,0xf5));var _0x57a5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7a55[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x57a5('0x0'));var MailMessage=require(_0x57a5('0x1'))['db'][_0x57a5('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x57a5('0x3')](0x0);var events={'afterCreate':_0x57a5('0x4'),'afterUpdate':'update','afterDestroy':_0x57a5('0x5')};function emitEvent(_0x1b414a){return function(_0x10b4d9,_0x54da5e,_0x7e52e9){MailMessageEvents[_0x57a5('0x6')](_0x1b414a+':'+_0x10b4d9['id'],_0x10b4d9);MailMessageEvents[_0x57a5('0x6')](_0x1b414a,_0x10b4d9);_0x7e52e9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x57a5('0x7')](e,emitEvent(event));}}module[_0x57a5('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 22da1e5..42f2323 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 _0xa89b=['api','moment','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','messageId','subject','FULLTEXT','body','plainBody','fromString','models','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','error','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x5994d8,_0x807a4a){var _0x5013a1=function(_0x122e57){while(--_0x122e57){_0x5994d8['push'](_0x5994d8['shift']());}};_0x5013a1(++_0x807a4a);}(_0xa89b,0x93));var _0xba89=function(_0x55a7c2,_0x365314){_0x55a7c2=_0x55a7c2-0x0;var _0xd12715=_0xa89b[_0x55a7c2];return _0xd12715;};'use strict';var _=require(_0xba89('0x0'));var util=require(_0xba89('0x1'));var logger=require(_0xba89('0x2'))(_0xba89('0x3'));var moment=require(_0xba89('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var htmlToText=require('html-to-text');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xba89('0x5'));var attributes=require(_0xba89('0x6'));module[_0xba89('0x7')]=function(_0x29e16a,_0x53aeb7){return _0x29e16a[_0xba89('0x8')](_0xba89('0x9'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0xba89('0xa'),'fields':[_0xba89('0xa')]},{'name':'fti_mail_messages','fields':['plainBody',_0xba89('0xb')],'type':_0xba89('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4c37a6,_0x17af27,_0xcaa880){if(_0x4c37a6[_0xba89('0xd')]){_0x4c37a6[_0xba89('0xe')]=htmlToText[_0xba89('0xf')](_0x4c37a6['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0xcaa880(null,_0x17af27);},'afterCreate':function(_0x4ce0c1,_0x482507,_0x36292c){var _0x1a5078=_0x29e16a[_0xba89('0x10')];var _0x29cf82=_0x4ce0c1['get']({'plain':!![]});if(_0x29cf82[_0xba89('0x11')]['toLowerCase']()==='in'||_0x29cf82[_0xba89('0x11')][_0xba89('0x12')]()===_0xba89('0x13')&&!_0x29cf82[_0xba89('0x14')]&&!_[_0xba89('0x15')](_0x29cf82[_0xba89('0x16')])){_0x1a5078[_0xba89('0x17')][_0xba89('0x18')]({'where':{'id':_0x29cf82[_0xba89('0x19')]}})[_0xba89('0x1a')](function(_0x37a195){if(_0x37a195){_0x37a195[_0xba89('0x1b')]({'lastMsgAt':_0x29cf82['createdAt'],'lastMsgDirection':_0x29cf82['direction']['toLowerCase']()});}})['catch'](function(_0x9d9e91){console[_0xba89('0x1c')](_0x9d9e91);});}_0x36292c();}},'charset':'utf8mb4','collate':_0xba89('0x1d')});}; \ No newline at end of file +var _0x3fdf=['direction','out','secret','findOne','MailInteractionId','then','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text','rimraf','exports','define','messageId','fti_mail_messages','plainBody','body','fromString','models','toLowerCase'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0x3fdf,0xb2));var _0xf3fd=function(_0x3939d7,_0x18bd17){_0x3939d7=_0x3939d7-0x0;var _0x7056c8=_0x3fdf[_0x3939d7];return _0x7056c8;};'use strict';var _=require(_0xf3fd('0x0'));var util=require(_0xf3fd('0x1'));var logger=require(_0xf3fd('0x2'))(_0xf3fd('0x3'));var moment=require(_0xf3fd('0x4'));var BPromise=require(_0xf3fd('0x5'));var rp=require(_0xf3fd('0x6'));var htmlToText=require(_0xf3fd('0x7'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf3fd('0x8'));var config=require('../../config/environment');var attributes=require('./mailMessage.attributes');module[_0xf3fd('0x9')]=function(_0x513b0b,_0x5a3cf9){return _0x513b0b[_0xf3fd('0xa')]('MailMessage',attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0xf3fd('0xb'),'fields':[_0xf3fd('0xb')]},{'name':_0xf3fd('0xc'),'fields':[_0xf3fd('0xd'),'subject'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x571638,_0x4ed572,_0x2114ea){if(_0x571638[_0xf3fd('0xe')]){_0x571638[_0xf3fd('0xd')]=htmlToText[_0xf3fd('0xf')](_0x571638['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x2114ea(null,_0x4ed572);},'afterCreate':function(_0x6eb223,_0x223c94,_0x102be1){var _0x2dcbe9=_0x513b0b[_0xf3fd('0x10')];var _0x10f52b=_0x6eb223['get']({'plain':!![]});if(_0x10f52b['direction'][_0xf3fd('0x11')]()==='in'||_0x10f52b[_0xf3fd('0x12')]['toLowerCase']()===_0xf3fd('0x13')&&!_0x10f52b[_0xf3fd('0x14')]&&!_['isNil'](_0x10f52b['UserId'])){_0x2dcbe9['MailInteraction'][_0xf3fd('0x15')]({'where':{'id':_0x10f52b[_0xf3fd('0x16')]}})[_0xf3fd('0x17')](function(_0x15de78){if(_0x15de78){_0x15de78['update']({'lastMsgAt':_0x10f52b[_0xf3fd('0x18')],'lastMsgDirection':_0x10f52b[_0xf3fd('0x12')]['toLowerCase']()});}})[_0xf3fd('0x19')](function(_0x4aa712){console['error'](_0x4aa712);});}_0x102be1();}},'charset':_0xf3fd('0x1a'),'collate':_0xf3fd('0x1b')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 72311ff..f19c150 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 _0x1399=['catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','error','code','message','result','CreateMailMessage','MailMessage','create','body','options','raw','debug','stringify'];(function(_0x486338,_0x2ab3f9){var _0x4c8298=function(_0x21130d){while(--_0x21130d){_0x486338['push'](_0x486338['shift']());}};_0x4c8298(++_0x2ab3f9);}(_0x1399,0x16c));var _0x9139=function(_0x2b7c38,_0x496d14){_0x2b7c38=_0x2b7c38-0x0;var _0x313fcc=_0x1399[_0x2b7c38];return _0x313fcc;};'use strict';var _=require(_0x9139('0x0'));var util=require(_0x9139('0x1'));var moment=require('moment');var BPromise=require(_0x9139('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9139('0x3'));var db=require(_0x9139('0x4'))['db'];var utils=require(_0x9139('0x5'));var logger=require(_0x9139('0x6'))(_0x9139('0x7'));var config=require(_0x9139('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9139('0x9')]({'port':0x232a});config[_0x9139('0xa')]=_[_0x9139('0xb')](config['redis'],{'host':_0x9139('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9139('0xd'))[_0x9139('0xe')](socket);function respondWithRpcPromise(_0x4830cd,_0x315de8,_0x1bfa6b){return new BPromise(function(_0x5c90eb,_0x4f7f3a){return client[_0x9139('0xf')](_0x4830cd,_0x1bfa6b)[_0x9139('0x10')](function(_0x23357c){logger[_0x9139('0x11')](_0x9139('0x12'),_0x315de8,'request\x20sent');logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x315de8,_0x9139('0x13'),JSON['stringify'](_0x23357c));if(_0x23357c[_0x9139('0x14')]){if(_0x23357c[_0x9139('0x14')][_0x9139('0x15')]===0x1f4){logger[_0x9139('0x14')]('MailMessage,\x20%s,\x20%s',_0x315de8,_0x23357c[_0x9139('0x14')]['message']);return _0x4f7f3a(_0x23357c['error']['message']);}logger[_0x9139('0x14')](_0x9139('0x12'),_0x315de8,_0x23357c[_0x9139('0x14')][_0x9139('0x16')]);return _0x5c90eb(_0x23357c[_0x9139('0x14')][_0x9139('0x16')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x315de8,_0x9139('0x13'));_0x5c90eb(_0x23357c[_0x9139('0x17')]['message']);}})['catch'](function(_0x30a363){logger[_0x9139('0x14')]('MailMessage,\x20%s,\x20%s',_0x315de8,_0x30a363);_0x4f7f3a(_0x30a363);});});}exports[_0x9139('0x18')]=function(_0x1ef57b){var _0x1a592e=this;return new Promise(function(_0x3c8296,_0xd2eb33){return db[_0x9139('0x19')][_0x9139('0x1a')](_0x1ef57b[_0x9139('0x1b')],{'raw':_0x1ef57b[_0x9139('0x1c')]?_0x1ef57b[_0x9139('0x1c')][_0x9139('0x1d')]===undefined?!![]:![]:!![]})[_0x9139('0x10')](function(_0x5a3e2e){logger[_0x9139('0x11')](_0x9139('0x18'),_0x1ef57b);logger[_0x9139('0x1e')](_0x9139('0x18'),_0x1ef57b,JSON[_0x9139('0x1f')](_0x5a3e2e));_0x3c8296(_0x5a3e2e);})[_0x9139('0x20')](function(_0x4b7fe0){logger[_0x9139('0x14')](_0x9139('0x18'),_0x4b7fe0['message'],_0x1ef57b);_0xd2eb33(_0x1a592e[_0x9139('0x14')](0x1f4,_0x4b7fe0[_0x9139('0x16')]));});});}; \ No newline at end of file +var _0x955f=['../../mysqldb','rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','./mailMessage.socket','register','then','info','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','CreateMailMessage','MailMessage','create','options','raw','lodash','util','moment','bluebird','randomstring'];(function(_0x7e2384,_0xd8f685){var _0x40656f=function(_0x10c17f){while(--_0x10c17f){_0x7e2384['push'](_0x7e2384['shift']());}};_0x40656f(++_0xd8f685);}(_0x955f,0x1eb));var _0xf955=function(_0x5a4556,_0x2ea063){_0x5a4556=_0x5a4556-0x0;var _0x5b3b1a=_0x955f[_0x5a4556];return _0x5b3b1a;};'use strict';var _=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var moment=require(_0xf955('0x2'));var BPromise=require(_0xf955('0x3'));var rs=require(_0xf955('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf955('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf955('0x6'));var config=require('../../config/environment');var jayson=require(_0xf955('0x7'));var client=jayson[_0xf955('0x8')][_0xf955('0x9')]({'port':0x232a});config['redis']=_[_0xf955('0xa')](config[_0xf955('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xf955('0xc'))(new Redis(config[_0xf955('0xb')]));require(_0xf955('0xd'))[_0xf955('0xe')](socket);function respondWithRpcPromise(_0x134c1b,_0x421e4a,_0x186719){return new BPromise(function(_0x4d213a,_0xf7e3e){return client['request'](_0x134c1b,_0x186719)[_0xf955('0xf')](function(_0x5d6211){logger[_0xf955('0x10')]('MailMessage,\x20%s,\x20%s',_0x421e4a,_0xf955('0x11'));logger['debug'](_0xf955('0x12'),_0x421e4a,'request\x20sent',JSON[_0xf955('0x13')](_0x5d6211));if(_0x5d6211[_0xf955('0x14')]){if(_0x5d6211[_0xf955('0x14')][_0xf955('0x15')]===0x1f4){logger[_0xf955('0x14')](_0xf955('0x16'),_0x421e4a,_0x5d6211[_0xf955('0x14')][_0xf955('0x17')]);return _0xf7e3e(_0x5d6211[_0xf955('0x14')][_0xf955('0x17')]);}logger['error'](_0xf955('0x16'),_0x421e4a,_0x5d6211['error'][_0xf955('0x17')]);return _0x4d213a(_0x5d6211[_0xf955('0x14')][_0xf955('0x17')]);}else{logger[_0xf955('0x10')]('MailMessage,\x20%s,\x20%s',_0x421e4a,'request\x20sent');_0x4d213a(_0x5d6211[_0xf955('0x18')][_0xf955('0x17')]);}})[_0xf955('0x19')](function(_0x4d7b5b){logger[_0xf955('0x14')](_0xf955('0x16'),_0x421e4a,_0x4d7b5b);_0xf7e3e(_0x4d7b5b);});});}exports[_0xf955('0x1a')]=function(_0x3f960e){var _0x3ae4fb=this;return new Promise(function(_0x5f4d9a,_0x17d86a){return db[_0xf955('0x1b')][_0xf955('0x1c')](_0x3f960e['body'],{'raw':_0x3f960e[_0xf955('0x1d')]?_0x3f960e['options'][_0xf955('0x1e')]===undefined?!![]:![]:!![]})[_0xf955('0xf')](function(_0x37143d){logger[_0xf955('0x10')](_0xf955('0x1a'),_0x3f960e);logger['debug'](_0xf955('0x1a'),_0x3f960e,JSON[_0xf955('0x13')](_0x37143d));_0x5f4d9a(_0x37143d);})[_0xf955('0x19')](function(_0x13a1a7){logger[_0xf955('0x14')](_0xf955('0x1a'),_0x13a1a7[_0xf955('0x17')],_0x3f960e);_0x17d86a(_0x3ae4fb['error'](0x1f4,_0x13a1a7[_0xf955('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index f77b404..d3466b9 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 _0x67bb=['./mailMessage.events','save','remove','emit','removeListener','register','length'];(function(_0x3de3be,_0xd103bd){var _0x3ff29b=function(_0xc6270d){while(--_0xc6270d){_0x3de3be['push'](_0x3de3be['shift']());}};_0x3ff29b(++_0xd103bd);}(_0x67bb,0x1a4));var _0xb67b=function(_0x59b27d,_0x5046e3){_0x59b27d=_0x59b27d-0x0;var _0x3f5a08=_0x67bb[_0x59b27d];return _0x3f5a08;};'use strict';var MailMessageEvents=require(_0xb67b('0x0'));var events=[_0xb67b('0x1'),_0xb67b('0x2'),'update'];function createListener(_0x2e6bdf,_0x44e28f){return function(_0x25a71b){_0x44e28f[_0xb67b('0x3')](_0x2e6bdf,_0x25a71b);};}function removeListener(_0x2d85af,_0x413b5f){return function(){MailMessageEvents[_0xb67b('0x4')](_0x2d85af,_0x413b5f);};}exports[_0xb67b('0x5')]=function(_0x5e24d8){for(var _0x373f79=0x0,_0x2b36ba=events[_0xb67b('0x6')];_0x373f79<_0x2b36ba;_0x373f79++){var _0x9bfb7c=events[_0x373f79];var _0x435f63=createListener('mailMessage:'+_0x9bfb7c,_0x5e24d8);MailMessageEvents['on'](_0x9bfb7c,_0x435f63);}}; \ No newline at end of file +var _0xddb6=['length','./mailMessage.events','save','removeListener'];(function(_0x4fe7c5,_0x1fb98e){var _0x301b41=function(_0x3763c4){while(--_0x3763c4){_0x4fe7c5['push'](_0x4fe7c5['shift']());}};_0x301b41(++_0x1fb98e);}(_0xddb6,0x171));var _0x6ddb=function(_0x222303,_0x227f6c){_0x222303=_0x222303-0x0;var _0xfde1c0=_0xddb6[_0x222303];return _0xfde1c0;};'use strict';var MailMessageEvents=require(_0x6ddb('0x0'));var events=[_0x6ddb('0x1'),'remove','update'];function createListener(_0x374b56,_0x3c4e7b){return function(_0x37f40a){_0x3c4e7b['emit'](_0x374b56,_0x37f40a);};}function removeListener(_0x1aff00,_0x771380){return function(){MailMessageEvents[_0x6ddb('0x2')](_0x1aff00,_0x771380);};}exports['register']=function(_0x27d6a4){for(var _0x15d5d7=0x0,_0x1d92ed=events[_0x6ddb('0x3')];_0x15d5d7<_0x1d92ed;_0x15d5d7++){var _0x4c50b4=events[_0x15d5d7];var _0x3f5345=createListener('mailMessage:'+_0x4c50b4,_0x27d6a4);MailMessageEvents['on'](_0x4c50b4,_0x3f5345);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 0d085e5..8d3e973 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 _0xc7c9=['getTeams','/:id/users','post','addTeams','put','destroy','delete','removeTeams','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','/:id/teams'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0xc7c9,0x192));var _0x9c7c=function(_0x531590,_0x5da57e){_0x531590=_0x531590-0x0;var _0x20806a=_0xc7c9[_0x531590];return _0x20806a;};'use strict';var multer=require(_0x9c7c('0x0'));var util=require(_0x9c7c('0x1'));var path=require(_0x9c7c('0x2'));var timeout=require('connect-timeout');var express=require(_0x9c7c('0x3'));var router=express[_0x9c7c('0x4')]();var fs_extra=require(_0x9c7c('0x5'));var auth=require(_0x9c7c('0x6'));var interaction=require(_0x9c7c('0x7'));var config=require(_0x9c7c('0x8'));var controller=require('./mailQueue.controller');router[_0x9c7c('0x9')]('/',auth[_0x9c7c('0xa')](),controller[_0x9c7c('0xb')]);router[_0x9c7c('0x9')](_0x9c7c('0xc'),auth[_0x9c7c('0xa')](),controller[_0x9c7c('0xd')]);router[_0x9c7c('0x9')](_0x9c7c('0xe'),auth[_0x9c7c('0xa')](),controller['show']);router['get'](_0x9c7c('0xf'),auth[_0x9c7c('0xa')](),controller[_0x9c7c('0x10')]);router[_0x9c7c('0x9')](_0x9c7c('0x11'),auth[_0x9c7c('0xa')](),controller[_0x9c7c('0x12')]);router[_0x9c7c('0x9')](_0x9c7c('0x13'),auth[_0x9c7c('0xa')](),controller['getAgents']);router[_0x9c7c('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9c7c('0x14')](_0x9c7c('0x11'),auth[_0x9c7c('0xa')](),controller[_0x9c7c('0x15')]);router[_0x9c7c('0x14')](_0x9c7c('0x13'),auth[_0x9c7c('0xa')](),controller['addAgents']);router[_0x9c7c('0x16')](_0x9c7c('0xe'),auth[_0x9c7c('0xa')](),controller['update']);router['delete'](_0x9c7c('0xe'),auth[_0x9c7c('0xa')](),controller[_0x9c7c('0x17')]);router[_0x9c7c('0x18')](_0x9c7c('0x11'),auth['isAuthenticated'](),controller[_0x9c7c('0x19')]);router[_0x9c7c('0x18')](_0x9c7c('0x13'),auth[_0x9c7c('0xa')](),controller[_0x9c7c('0x1a')]);module[_0x9c7c('0x1b')]=router; \ No newline at end of file +var _0x04fd=['post','create','/:id/teams','addTeams','put','update','destroy','delete','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/:id','show','/:id/members','getTeams','/:id/users','getAgents'];(function(_0x2441f2,_0x4136ca){var _0x3e8bca=function(_0x2f42b6){while(--_0x2f42b6){_0x2441f2['push'](_0x2441f2['shift']());}};_0x3e8bca(++_0x4136ca);}(_0x04fd,0x14e));var _0xd04f=function(_0x244ab2,_0x1ade6e){_0x244ab2=_0x244ab2-0x0;var _0x15f2a2=_0x04fd[_0x244ab2];return _0x15f2a2;};'use strict';var multer=require('multer');var util=require(_0xd04f('0x0'));var path=require(_0xd04f('0x1'));var timeout=require(_0xd04f('0x2'));var express=require('express');var router=express[_0xd04f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd04f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd04f('0x5'));var controller=require(_0xd04f('0x6'));router[_0xd04f('0x7')]('/',auth[_0xd04f('0x8')](),controller[_0xd04f('0x9')]);router['get']('/describe',auth[_0xd04f('0x8')](),controller['describe']);router[_0xd04f('0x7')](_0xd04f('0xa'),auth[_0xd04f('0x8')](),controller[_0xd04f('0xb')]);router['get'](_0xd04f('0xc'),auth[_0xd04f('0x8')](),controller['getMembers']);router[_0xd04f('0x7')]('/:id/teams',auth[_0xd04f('0x8')](),controller[_0xd04f('0xd')]);router['get'](_0xd04f('0xe'),auth['isAuthenticated'](),controller[_0xd04f('0xf')]);router[_0xd04f('0x10')]('/',auth[_0xd04f('0x8')](),controller[_0xd04f('0x11')]);router[_0xd04f('0x10')](_0xd04f('0x12'),auth[_0xd04f('0x8')](),controller[_0xd04f('0x13')]);router[_0xd04f('0x10')](_0xd04f('0xe'),auth[_0xd04f('0x8')](),controller['addAgents']);router[_0xd04f('0x14')](_0xd04f('0xa'),auth[_0xd04f('0x8')](),controller[_0xd04f('0x15')]);router['delete']('/:id',auth[_0xd04f('0x8')](),controller[_0xd04f('0x16')]);router[_0xd04f('0x17')](_0xd04f('0x12'),auth[_0xd04f('0x8')](),controller['removeTeams']);router[_0xd04f('0x17')]('/:id/users',auth[_0xd04f('0x8')](),controller['removeAgents']);module[_0xd04f('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 4d45e7c..ced859d 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 _0x700a=['INTEGER','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x2cf10e,_0x2a278a){var _0xd5184e=function(_0x448dac){while(--_0x448dac){_0x2cf10e['push'](_0x2cf10e['shift']());}};_0xd5184e(++_0x2a278a);}(_0x700a,0x84));var _0xa700=function(_0x5b6d89,_0x425826){_0x5b6d89=_0x5b6d89-0x0;var _0x4daf6f=_0x700a[_0x5b6d89];return _0x4daf6f;};'use strict';var Sequelize=require(_0xa700('0x0'));module[_0xa700('0x1')]={'name':{'type':Sequelize[_0xa700('0x2')],'unique':_0xa700('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xa700('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xa700('0x5'),_0xa700('0x6'),_0xa700('0x7'))}}; \ No newline at end of file +var _0xcb33=['name','ENUM','rrmemory','beepall','sequelize','exports'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xcb33,0x17e));var _0x3cb3=function(_0xef033a,_0x437ae1){_0xef033a=_0xef033a-0x0;var _0x2d4af3=_0xcb33[_0xef033a];return _0x2d4af3;};'use strict';var Sequelize=require(_0x3cb3('0x0'));module[_0x3cb3('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x3cb3('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3cb3('0x3')](_0x3cb3('0x4'),_0x3cb3('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 4913781..cc9bc5b 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 _0x95ce=['fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','user','role','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserMailQueue','MailQueueId','findAll','findAndCountAll','UserId','agent','mailPause','createdAt','SIP','updatedAt','getTeams','Team','addTeams','User','Agents','online','voicePause','interface','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','ids','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','value','isEmpty','userMailQueue:remove','addAgents','omit','removeAgents','getAgents','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','UserProfileResource','destroy','sendStatus','error','stack','name','index','map','MailQueue','rawAttributes','type','key','model','keys','query','filters','intersection','attributes'];(function(_0x1d8f82,_0x40d8f9){var _0x166e17=function(_0x5882b5){while(--_0x5882b5){_0x1d8f82['push'](_0x1d8f82['shift']());}};_0x166e17(++_0x40d8f9);}(_0x95ce,0x1e6));var _0xe95c=function(_0x5d5ec4,_0x164e2b){_0x5d5ec4=_0x5d5ec4-0x0;var _0x404ca1=_0x95ce[_0x5d5ec4];return _0x404ca1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe95c('0x0'));var zipdir=require(_0xe95c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe95c('0x2'));var BPromise=require(_0xe95c('0x3'));var Mustache=require(_0xe95c('0x4'));var util=require(_0xe95c('0x5'));var path=require(_0xe95c('0x6'));var sox=require(_0xe95c('0x7'));var csv=require(_0xe95c('0x8'));var ejs=require(_0xe95c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe95c('0xa'));var squel=require(_0xe95c('0xb'));var crypto=require(_0xe95c('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe95c('0x8'));var querystring=require(_0xe95c('0xd'));var Papa=require(_0xe95c('0xe'));var Redis=require('ioredis');var authService=require(_0xe95c('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe95c('0x10'));var logger=require(_0xe95c('0x11'))(_0xe95c('0x12'));var utils=require('../../config/utils');var config=require(_0xe95c('0x13'));var licenseUtil=require(_0xe95c('0x14'));var db=require('../../mysqldb')['db'];config[_0xe95c('0x15')]=_[_0xe95c('0x16')](config[_0xe95c('0x15')],{'host':_0xe95c('0x17'),'port':0x18eb});var socket=require(_0xe95c('0x18'))(new Redis(config[_0xe95c('0x15')]));require('./mailQueue.socket')[_0xe95c('0x19')](socket);function respondWithStatusCode(_0x241917,_0x405b9a){_0x405b9a=_0x405b9a||0xcc;return function(_0x4c1874){if(_0x4c1874){return _0x241917['sendStatus'](_0x405b9a);}return _0x241917[_0xe95c('0x1a')](_0x405b9a)[_0xe95c('0x1b')]();};}function respondWithResult(_0x236b76,_0x1327e8){_0x1327e8=_0x1327e8||0xc8;return function(_0xa3c2ae){if(_0xa3c2ae){return _0x236b76[_0xe95c('0x1a')](_0x1327e8)[_0xe95c('0x1c')](_0xa3c2ae);}};}function respondWithFilteredResult(_0x16872b,_0x21fb4e){return function(_0x17b96d){if(_0x17b96d){var _0x2562aa=typeof _0x21fb4e[_0xe95c('0x1d')]==='undefined'&&typeof _0x21fb4e[_0xe95c('0x1e')]===_0xe95c('0x1f');var _0x2d2d21=_0x17b96d['count'];var _0x3845df=_0x2562aa?0x0:_0x21fb4e['offset'];var _0x2160cc=_0x2562aa?_0x17b96d[_0xe95c('0x20')]:_0x21fb4e[_0xe95c('0x1d')]+_0x21fb4e[_0xe95c('0x1e')];var _0x1eb18e;if(_0x2160cc>=_0x2d2d21){_0x2160cc=_0x2d2d21;_0x1eb18e=0xc8;}else{_0x1eb18e=0xce;}_0x16872b[_0xe95c('0x1a')](_0x1eb18e);return _0x16872b[_0xe95c('0x21')](_0xe95c('0x22'),_0x3845df+'-'+_0x2160cc+'/'+_0x2d2d21)[_0xe95c('0x1c')](_0x17b96d);}return null;};}function patchUpdates(_0x21bad4){return function(_0xe80a2f){try{jsonpatch[_0xe95c('0x23')](_0xe80a2f,_0x21bad4,!![]);}catch(_0x5e2f4f){return BPromise[_0xe95c('0x24')](_0x5e2f4f);}return _0xe80a2f[_0xe95c('0x25')]();};}function saveUpdates(_0x2795d9,_0x221bc9){return function(_0x1084c1){if(_0x1084c1){return _0x1084c1[_0xe95c('0x26')](_0x2795d9)['then'](function(_0x2dc218){return _0x2dc218;});}return null;};}function removeEntity(_0x121ed9,_0x59a160){return function(_0x18fd38){if(_0x18fd38){return _0x18fd38['destroy']()[_0xe95c('0x27')](function(){var _0x5d4c50=_0x18fd38['get']({'plain':!![]});var _0x39bf0f='MailQueues';return db[_0xe95c('0x28')][_0xe95c('0x29')]({'where':{'type':_0x39bf0f,'resourceId':_0x5d4c50['id']}})[_0xe95c('0x27')](function(){return _0x18fd38;});})['then'](function(){_0x121ed9[_0xe95c('0x1a')](0xcc)[_0xe95c('0x1b')]();});}};}function handleEntityNotFound(_0xdb56bf,_0x298ff7){return function(_0x12b247){if(!_0x12b247){_0xdb56bf[_0xe95c('0x2a')](0x194);}return _0x12b247;};}function handleError(_0x33ab8c,_0x4d5906){_0x4d5906=_0x4d5906||0x1f4;return function(_0x308c5b){logger[_0xe95c('0x2b')](_0x308c5b[_0xe95c('0x2c')]);if(_0x308c5b[_0xe95c('0x2d')]){delete _0x308c5b['name'];}_0x33ab8c[_0xe95c('0x1a')](_0x4d5906)['send'](_0x308c5b);};}exports[_0xe95c('0x2e')]=function(_0x15bdf0,_0x1604e5){var _0x1bb702={},_0x503bc0={},_0x1cbcb8={'count':0x0,'rows':[]};var _0x6864f1=_[_0xe95c('0x2f')](db[_0xe95c('0x30')][_0xe95c('0x31')],function(_0x56a1d6){return{'name':_0x56a1d6['fieldName'],'type':_0x56a1d6[_0xe95c('0x32')][_0xe95c('0x33')]};});_0x503bc0[_0xe95c('0x34')]=_[_0xe95c('0x2f')](_0x6864f1,_0xe95c('0x2d'));_0x503bc0['query']=_[_0xe95c('0x35')](_0x15bdf0[_0xe95c('0x36')]);_0x503bc0[_0xe95c('0x37')]=_[_0xe95c('0x38')](_0x503bc0['model'],_0x503bc0['query']);_0x1bb702[_0xe95c('0x39')]=_[_0xe95c('0x38')](_0x503bc0[_0xe95c('0x34')],qs[_0xe95c('0x3a')](_0x15bdf0[_0xe95c('0x36')][_0xe95c('0x3a')]));_0x1bb702['attributes']=_0x1bb702['attributes'][_0xe95c('0x3b')]?_0x1bb702[_0xe95c('0x39')]:_0x503bc0[_0xe95c('0x34')];if(!_0x15bdf0[_0xe95c('0x36')][_0xe95c('0x3c')](_0xe95c('0x3d'))){_0x1bb702['limit']=qs[_0xe95c('0x1e')](_0x15bdf0[_0xe95c('0x36')][_0xe95c('0x1e')]);_0x1bb702['offset']=qs[_0xe95c('0x1d')](_0x15bdf0['query'][_0xe95c('0x1d')]);}_0x1bb702[_0xe95c('0x3e')]=qs['sort'](_0x15bdf0['query'][_0xe95c('0x3f')]);_0x1bb702['where']=qs[_0xe95c('0x37')](_[_0xe95c('0x40')](_0x15bdf0[_0xe95c('0x36')],_0x503bc0[_0xe95c('0x37')]),_0x6864f1);if(_0x15bdf0[_0xe95c('0x36')][_0xe95c('0x41')]){_0x1bb702[_0xe95c('0x42')]=_[_0xe95c('0x43')](_0x1bb702[_0xe95c('0x42')],{'$or':_[_0xe95c('0x2f')](_0x6864f1,function(_0x58f80d){if(_0x58f80d[_0xe95c('0x32')]!==_0xe95c('0x44')){var _0x273ad2={};_0x273ad2[_0x58f80d[_0xe95c('0x2d')]]={'$like':'%'+_0x15bdf0[_0xe95c('0x36')][_0xe95c('0x41')]+'%'};return _0x273ad2;}})});}_0x1bb702=_[_0xe95c('0x43')]({},_0x1bb702,_0x15bdf0[_0xe95c('0x45')]);var _0x4c3edb={'where':_0x1bb702[_0xe95c('0x42')]};return db[_0xe95c('0x30')][_0xe95c('0x20')](_0x4c3edb)[_0xe95c('0x27')](function(_0x3ba42f){_0x1cbcb8[_0xe95c('0x20')]=_0x3ba42f;if(_0x15bdf0['query'][_0xe95c('0x46')]){_0x1bb702[_0xe95c('0x47')]=[{'all':!![]}];}return db[_0xe95c('0x30')]['findAll'](_0x1bb702);})[_0xe95c('0x27')](function(_0x5b88c1){_0x1cbcb8[_0xe95c('0x48')]=_0x5b88c1;return _0x1cbcb8;})['then'](respondWithFilteredResult(_0x1604e5,_0x1bb702))[_0xe95c('0x49')](handleError(_0x1604e5,null));};exports[_0xe95c('0x4a')]=function(_0x54eea1,_0x5526f1){var _0x4c3b82={'raw':!![],'where':{'id':_0x54eea1[_0xe95c('0x4b')]['id']}},_0x3438bf={};_0x3438bf[_0xe95c('0x34')]=_[_0xe95c('0x35')](db['MailQueue']['rawAttributes']);_0x3438bf[_0xe95c('0x36')]=_[_0xe95c('0x35')](_0x54eea1[_0xe95c('0x36')]);_0x3438bf[_0xe95c('0x37')]=_[_0xe95c('0x38')](_0x3438bf[_0xe95c('0x34')],_0x3438bf['query']);_0x4c3b82[_0xe95c('0x39')]=_['intersection'](_0x3438bf[_0xe95c('0x34')],qs[_0xe95c('0x3a')](_0x54eea1[_0xe95c('0x36')][_0xe95c('0x3a')]));_0x4c3b82[_0xe95c('0x39')]=_0x4c3b82[_0xe95c('0x39')][_0xe95c('0x3b')]?_0x4c3b82['attributes']:_0x3438bf[_0xe95c('0x34')];if(_0x54eea1[_0xe95c('0x36')][_0xe95c('0x46')]){_0x4c3b82[_0xe95c('0x47')]=[{'all':!![]}];}_0x4c3b82=_[_0xe95c('0x43')]({},_0x4c3b82,_0x54eea1[_0xe95c('0x45')]);return db[_0xe95c('0x30')][_0xe95c('0x4c')](_0x4c3b82)[_0xe95c('0x27')](handleEntityNotFound(_0x5526f1,null))[_0xe95c('0x27')](respondWithResult(_0x5526f1,null))[_0xe95c('0x49')](handleError(_0x5526f1,null));};exports[_0xe95c('0x4d')]=function(_0x356c05,_0x220d20){return db[_0xe95c('0x30')]['create'](_0x356c05['body'],{})['then'](function(_0x472dfd){var _0x4eb24a=_0x356c05[_0xe95c('0x4e')]['get']({'plain':!![]});if(!_0x4eb24a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4eb24a[_0xe95c('0x4f')]===_0xe95c('0x4e')){var _0x5c53c0=_0x472dfd[_0xe95c('0x50')]({'plain':!![]});var _0x1a2227='MailQueues';return db[_0xe95c('0x51')][_0xe95c('0x4c')]({'where':{'name':_0x1a2227,'userProfileId':_0x4eb24a['userProfileId']},'raw':!![]})[_0xe95c('0x27')](function(_0x485b63){if(_0x485b63&&_0x485b63[_0xe95c('0x52')]===0x0){return db[_0xe95c('0x28')][_0xe95c('0x4d')]({'name':_0x5c53c0[_0xe95c('0x2d')],'resourceId':_0x5c53c0['id'],'type':_0x485b63[_0xe95c('0x2d')],'sectionId':_0x485b63['id']},{})[_0xe95c('0x27')](function(){return _0x472dfd;});}else{return _0x472dfd;}})[_0xe95c('0x49')](function(_0x33cc9b){logger[_0xe95c('0x2b')](_0xe95c('0x53'),_0x33cc9b);throw _0x33cc9b;});}return _0x472dfd;})['then'](respondWithResult(_0x220d20,0xc9))[_0xe95c('0x49')](handleError(_0x220d20,null));};exports[_0xe95c('0x26')]=function(_0x546a53,_0x1716e5){if(_0x546a53[_0xe95c('0x54')]['id']){delete _0x546a53[_0xe95c('0x54')]['id'];}return db[_0xe95c('0x30')][_0xe95c('0x4c')]({'where':{'id':_0x546a53[_0xe95c('0x4b')]['id']}})[_0xe95c('0x27')](handleEntityNotFound(_0x1716e5,null))[_0xe95c('0x27')](saveUpdates(_0x546a53[_0xe95c('0x54')],null))[_0xe95c('0x27')](respondWithResult(_0x1716e5,null))['catch'](handleError(_0x1716e5,null));};exports[_0xe95c('0x29')]=function(_0x104664,_0x89e0e4){return db[_0xe95c('0x30')][_0xe95c('0x4c')]({'where':{'id':_0x104664[_0xe95c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x89e0e4,null))['then'](removeEntity(_0x89e0e4,null))['catch'](handleError(_0x89e0e4,null));};exports[_0xe95c('0x55')]=function(_0x3563a8,_0x16197c){return db[_0xe95c('0x30')]['describe']()[_0xe95c('0x27')](respondWithResult(_0x16197c,null))[_0xe95c('0x49')](handleError(_0x16197c,null));};exports[_0xe95c('0x56')]=function(_0x3554d9,_0x528310,_0x1e5e47){var _0x100bac={'raw':!![],'where':{}},_0x5e8571={},_0x2c2365;return db[_0xe95c('0x30')][_0xe95c('0x57')]({'where':{'id':_0x3554d9[_0xe95c('0x4b')]['id']}})[_0xe95c('0x27')](handleEntityNotFound(_0x528310,null))[_0xe95c('0x27')](function(_0x2c6187){if(_0x2c6187){_0x2c2365=_0x2c6187[_0xe95c('0x50')]({'plain':!![]});_0x5e8571['model']=_[_0xe95c('0x35')](db[_0xe95c('0x58')]['rawAttributes']);_0x5e8571['query']=_[_0xe95c('0x35')](_0x3554d9['query']);_0x5e8571[_0xe95c('0x37')]=_[_0xe95c('0x38')](_0x5e8571[_0xe95c('0x34')],_0x5e8571[_0xe95c('0x36')]);_0x100bac[_0xe95c('0x39')]=_[_0xe95c('0x38')](_0x5e8571['model'],qs[_0xe95c('0x3a')](_0x3554d9[_0xe95c('0x36')]['fields']));_0x100bac['attributes']=_0x100bac['attributes'][_0xe95c('0x3b')]?_0x100bac['attributes']:_0x5e8571[_0xe95c('0x34')];if(!_0x3554d9[_0xe95c('0x36')][_0xe95c('0x3c')](_0xe95c('0x3d'))){_0x100bac[_0xe95c('0x1e')]=qs[_0xe95c('0x1e')](_0x3554d9['query'][_0xe95c('0x1e')]);_0x100bac['offset']=qs[_0xe95c('0x1d')](_0x3554d9[_0xe95c('0x36')][_0xe95c('0x1d')]);}_0x100bac[_0xe95c('0x3e')]=qs[_0xe95c('0x3f')](_0x3554d9[_0xe95c('0x36')]['sort']);_0x100bac[_0xe95c('0x42')]=qs[_0xe95c('0x37')](_['pick'](_0x3554d9[_0xe95c('0x36')],_0x5e8571[_0xe95c('0x37')]));_0x100bac[_0xe95c('0x42')][_0xe95c('0x59')]=_0x2c6187['id'];if(_0x3554d9['query'][_0xe95c('0x41')]){_0x100bac[_0xe95c('0x42')]=_[_0xe95c('0x43')](_0x100bac[_0xe95c('0x42')],{'$or':_['map'](_0x100bac['attributes'],function(_0x503096){var _0x536a97={};_0x536a97[_0x503096]={'$like':'%'+_0x3554d9['query'][_0xe95c('0x41')]+'%'};return _0x536a97;})});}_0x100bac=_[_0xe95c('0x43')]({},_0x100bac,_0x3554d9['options']);return db[_0xe95c('0x58')][_0xe95c('0x5a')](_0x100bac);}})[_0xe95c('0x27')](function(_0x238ed1){if(_0x238ed1){return db['User'][_0xe95c('0x5b')]({'where':{'id':_[_0xe95c('0x2f')](_0x238ed1,_0xe95c('0x5c')),'role':_0xe95c('0x5d')},'attributes':['id',_0xe95c('0x2d'),_0xe95c('0x5e'),'updatedAt',_0xe95c('0x5f')]});}})[_0xe95c('0x27')](function(_0x2f2f03){if(_0x2f2f03){return{'count':_0x2f2f03[_0xe95c('0x20')],'rows':_[_0xe95c('0x2f')](_0x2f2f03[_0xe95c('0x48')],function(_0x440753){return{'membername':_0x440753[_0xe95c('0x2d')],'UserId':_0x440753['id'],'queue_name':_0x2c2365[_0xe95c('0x2d')],'MailQueueId':_0x2c2365['id'],'interface':util['format']('%s/%s',_0xe95c('0x60'),_0x440753[_0xe95c('0x2d')]),'penalty':0x0,'paused':_0x440753[_0xe95c('0x5e')],'createdAt':_0x440753[_0xe95c('0x5f')],'updatedAt':_0x440753[_0xe95c('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x528310,_0x100bac))[_0xe95c('0x49')](handleError(_0x528310,null));};exports[_0xe95c('0x62')]=function(_0x43cd8b,_0x13d09a,_0x29116b){var _0x501ea2={};var _0x44ecf7={};var _0x7cefd7;var _0x30d9f0;return db[_0xe95c('0x30')]['findOne']({'where':{'id':_0x43cd8b[_0xe95c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x13d09a,null))[_0xe95c('0x27')](function(_0x18500d){if(_0x18500d){_0x7cefd7=_0x18500d;_0x44ecf7['model']=_[_0xe95c('0x35')](db[_0xe95c('0x63')][_0xe95c('0x31')]);_0x44ecf7[_0xe95c('0x36')]=_[_0xe95c('0x35')](_0x43cd8b[_0xe95c('0x36')]);_0x44ecf7[_0xe95c('0x37')]=_['intersection'](_0x44ecf7['model'],_0x44ecf7[_0xe95c('0x36')]);_0x501ea2[_0xe95c('0x39')]=_[_0xe95c('0x38')](_0x44ecf7['model'],qs[_0xe95c('0x3a')](_0x43cd8b[_0xe95c('0x36')]['fields']));_0x501ea2['attributes']=_0x501ea2[_0xe95c('0x39')][_0xe95c('0x3b')]?_0x501ea2[_0xe95c('0x39')]:_0x44ecf7['model'];_0x501ea2[_0xe95c('0x3e')]=qs[_0xe95c('0x3f')](_0x43cd8b[_0xe95c('0x36')][_0xe95c('0x3f')]);_0x501ea2['where']=qs[_0xe95c('0x37')](_[_0xe95c('0x40')](_0x43cd8b[_0xe95c('0x36')],_0x44ecf7[_0xe95c('0x37')]));if(_0x43cd8b[_0xe95c('0x36')][_0xe95c('0x41')]){_0x501ea2[_0xe95c('0x42')]=_[_0xe95c('0x43')](_0x501ea2['where'],{'$or':_['map'](_0x501ea2[_0xe95c('0x39')],function(_0x2e6617){var _0x2e4fda={};_0x2e4fda[_0x2e6617]={'$like':'%'+_0x43cd8b['query'][_0xe95c('0x41')]+'%'};return _0x2e4fda;})});}_0x501ea2=_['merge']({},_0x501ea2,_0x43cd8b['options']);return _0x7cefd7[_0xe95c('0x62')](_0x501ea2);}})[_0xe95c('0x27')](function(_0x5328bc){if(_0x5328bc){_0x30d9f0=_0x5328bc['length'];if(!_0x43cd8b[_0xe95c('0x36')]['hasOwnProperty'](_0xe95c('0x3d'))){_0x501ea2[_0xe95c('0x1e')]=qs[_0xe95c('0x1e')](_0x43cd8b[_0xe95c('0x36')]['limit']);_0x501ea2[_0xe95c('0x1d')]=qs['offset'](_0x43cd8b['query'][_0xe95c('0x1d')]);}return _0x7cefd7[_0xe95c('0x62')](_0x501ea2);}})['then'](function(_0x2880b7){if(_0x2880b7){return _0x2880b7?{'count':_0x30d9f0,'rows':_0x2880b7}:null;}})[_0xe95c('0x27')](respondWithResult(_0x13d09a,null))['catch'](handleError(_0x13d09a,null));};exports[_0xe95c('0x64')]=function(_0x50101e,_0x5a3111,_0x4bb987){var _0x16b478=_0x50101e[_0xe95c('0x54')]['ids'];return db[_0xe95c('0x63')][_0xe95c('0x5a')]({'where':{'id':_0x16b478},'attributes':['id'],'include':[{'model':db[_0xe95c('0x65')],'as':_0xe95c('0x66'),'attributes':['id','name',_0xe95c('0x67'),_0xe95c('0x68'),_0xe95c('0x69')],'raw':!![]}]})[_0xe95c('0x27')](function(_0x200120){if(_0x200120){var _0x3863e7=_['flatMap'](_0x200120,function(_0x552662){var _0x572b7f=_0x552662['get']({'plain':!![]});return _0x572b7f[_0xe95c('0x66')];});return db[_0xe95c('0x30')][_0xe95c('0x4c')]({'where':{'id':_0x50101e[_0xe95c('0x4b')]['id']}})[_0xe95c('0x27')](function(_0x1e1dca){return db['sequelize']['transaction'](function(_0x25713e){return _0x1e1dca[_0xe95c('0x64')](_0x16b478,{'transaction':_0x25713e})['then'](function(){return BPromise['each'](_0x3863e7,function(_0x1e4917){return db[_0xe95c('0x58')][_0xe95c('0x6a')]({'where':{'UserId':_0x1e4917['id'],'MailQueueId':_0x50101e[_0xe95c('0x4b')]['id']},'transaction':_0x25713e});});})[_0xe95c('0x27')](function(){_0x3863e7[_0xe95c('0x6b')](function(_0xd31994){socket[_0xe95c('0x6c')](_0xe95c('0x6d'),{'UserId':_0xd31994['id'],'MailQueueId':_0x1e1dca['id']});});});});});}})[_0xe95c('0x27')](respondWithStatusCode(_0x5a3111,null))['catch'](handleError(_0x5a3111,null));};exports[_0xe95c('0x6e')]=function(_0x32e6c2,_0x1fdaf8,_0x573495){return db[_0xe95c('0x63')][_0xe95c('0x5a')]({'where':{'id':_0x32e6c2[_0xe95c('0x36')][_0xe95c('0x6f')]},'attributes':['id'],'include':[{'model':db[_0xe95c('0x65')],'as':_0xe95c('0x66'),'attributes':['id'],'raw':!![]}]})[_0xe95c('0x27')](handleEntityNotFound(_0x1fdaf8,null))[_0xe95c('0x27')](function(_0x14a5a6){var _0x1dfa6b=_['map'](_0x14a5a6,'id');var _0x276de6=[];var _0x946919=[];var _0x516fe8=squel['select']();_0x516fe8['field'](_0xe95c('0x70'))[_0xe95c('0x71')]('team_has_mail_queues','tq')[_0xe95c('0x72')](_0xe95c('0x73'),'ut',_0xe95c('0x74'))[_0xe95c('0x42')](_0xe95c('0x75'),_0x32e6c2['params']['id']);for(var _0x1695e3=0x0;_0x1695e3<_0x14a5a6[_0xe95c('0x3b')];_0x1695e3+=0x1){let _0x508f86=_0x14a5a6[_0x1695e3];for(var _0x24cc23=0x0;_0x24cc23<_0x508f86[_0xe95c('0x66')][_0xe95c('0x3b')];_0x24cc23+=0x1){let _0x1765d1=_0x508f86['Agents'][_0x24cc23];var _0xd43e37=_0x516fe8[_0xe95c('0x76')]();_0xd43e37[_0xe95c('0x42')](_0xe95c('0x77'),_0x1765d1['id']);_0x946919[_0xe95c('0x78')](db['sequelize'][_0xe95c('0x36')](_0xd43e37['toString'](),{'type':db[_0xe95c('0x79')][_0xe95c('0x7a')][_0xe95c('0x7b')]})[_0xe95c('0x27')](function(_0x3604c0){if(_0x3604c0[_0xe95c('0x3b')]===0x1){return _0x1765d1['id'];}else{var _0x49a201=_[_0xe95c('0x7c')](_['map'](_0x3604c0,_0xe95c('0x7d')),function(_0x4b59fb){return _[_0xe95c('0x7e')](_0x1dfa6b,_0x4b59fb);});if(_0x49a201){return _0x1765d1['id'];}}}));}}return BPromise[_0xe95c('0x7f')](_0x946919)[_0xe95c('0x27')](function(_0x12b183){_0x276de6=_(_0x276de6)[_0xe95c('0x80')](_0x12b183)['compact']()[_0xe95c('0x81')]();return db[_0xe95c('0x30')][_0xe95c('0x4c')]({'where':{'id':_0x32e6c2['params']['id']}})[_0xe95c('0x27')](function(_0x3ebc5a){return db[_0xe95c('0x79')]['transaction'](function(_0x293925){return _0x3ebc5a['removeTeams'](_0x32e6c2[_0xe95c('0x36')][_0xe95c('0x6f')],{'transaction':_0x293925})['then'](function(){if(!_[_0xe95c('0x82')](_0x276de6)){return _0x3ebc5a['removeAgents'](_0x276de6,{'transaction':_0x293925});}})[_0xe95c('0x27')](function(){_0x276de6[_0xe95c('0x6b')](function(_0xbdccf4){socket[_0xe95c('0x6c')](_0xe95c('0x83'),{'UserId':_0xbdccf4,'MailQueueId':_0x3ebc5a['id']});});});});});});})[_0xe95c('0x27')](respondWithStatusCode(_0x1fdaf8,null))['catch'](handleError(_0x1fdaf8,null));};exports[_0xe95c('0x84')]=function(_0x5e9f4e,_0x88c7d3,_0x1ef24b){return db[_0xe95c('0x30')][_0xe95c('0x4c')]({'where':{'id':_0x5e9f4e['params']['id']}})[_0xe95c('0x27')](handleEntityNotFound(_0x88c7d3,null))[_0xe95c('0x27')](function(_0x1063c7){if(_0x1063c7){return _0x1063c7['addAgents'](_0x5e9f4e[_0xe95c('0x54')][_0xe95c('0x6f')],_[_0xe95c('0x85')](_0x5e9f4e[_0xe95c('0x54')],[_0xe95c('0x6f'),'id'])||{})['spread'](function(_0x386cda){for(var _0x5de4ba=0x0;_0x5de4ba<_0x5e9f4e[_0xe95c('0x54')][_0xe95c('0x6f')][_0xe95c('0x3b')];_0x5de4ba+=0x1){socket['emit']('userMailQueue:save',{'UserId':Number(_0x5e9f4e[_0xe95c('0x54')][_0xe95c('0x6f')][_0x5de4ba]),'MailQueueId':Number(_0x5e9f4e[_0xe95c('0x4b')]['id'])});}return _0x386cda;});}})[_0xe95c('0x27')](respondWithResult(_0x88c7d3,null))[_0xe95c('0x49')](handleError(_0x88c7d3,null));};exports[_0xe95c('0x86')]=function(_0x4420af,_0x382e8a,_0x135f3d){return db[_0xe95c('0x30')][_0xe95c('0x4c')]({'where':{'id':_0x4420af[_0xe95c('0x4b')]['id']}})[_0xe95c('0x27')](handleEntityNotFound(_0x382e8a,null))[_0xe95c('0x27')](function(_0x1213d2){if(_0x1213d2){return _0x1213d2[_0xe95c('0x86')](_0x4420af[_0xe95c('0x36')][_0xe95c('0x6f')])['then'](function(){if(_['isArray'](_0x4420af['query'][_0xe95c('0x6f')])){for(var _0x367fa5=0x0;_0x367fa5<_0x4420af['query'][_0xe95c('0x6f')][_0xe95c('0x3b')];_0x367fa5+=0x1){socket['emit'](_0xe95c('0x83'),{'UserId':Number(_0x4420af[_0xe95c('0x36')][_0xe95c('0x6f')][_0x367fa5]),'MailQueueId':Number(_0x4420af[_0xe95c('0x4b')]['id'])});}}else{socket['emit'](_0xe95c('0x83'),{'UserId':Number(_0x4420af[_0xe95c('0x36')][_0xe95c('0x6f')]),'MailQueueId':Number(_0x4420af[_0xe95c('0x4b')]['id'])});}});}})[_0xe95c('0x27')](respondWithStatusCode(_0x382e8a,null))[_0xe95c('0x49')](handleError(_0x382e8a,null));};exports[_0xe95c('0x87')]=function(_0x15ee97,_0x5aa2f7,_0x3a4fb9){var _0x40d435={};var _0x4a4cd2={};var _0xe9172e;var _0x4d4438;return db[_0xe95c('0x30')][_0xe95c('0x57')]({'where':{'id':_0x15ee97[_0xe95c('0x4b')]['id']}})[_0xe95c('0x27')](handleEntityNotFound(_0x5aa2f7,null))[_0xe95c('0x27')](function(_0x18019c){if(_0x18019c){_0xe9172e=_0x18019c;_0x4a4cd2[_0xe95c('0x34')]=_[_0xe95c('0x35')](db[_0xe95c('0x65')]['rawAttributes']);_0x4a4cd2['query']=_[_0xe95c('0x35')](_0x15ee97[_0xe95c('0x36')]);_0x4a4cd2['filters']=_[_0xe95c('0x38')](_0x4a4cd2['model'],_0x4a4cd2[_0xe95c('0x36')]);_0x40d435[_0xe95c('0x39')]=_[_0xe95c('0x38')](_0x4a4cd2['model'],qs[_0xe95c('0x3a')](_0x15ee97[_0xe95c('0x36')][_0xe95c('0x3a')]));_0x40d435[_0xe95c('0x39')]=_0x40d435[_0xe95c('0x39')]['length']?_0x40d435['attributes']:_0x4a4cd2[_0xe95c('0x34')];_0x40d435[_0xe95c('0x3e')]=qs[_0xe95c('0x3f')](_0x15ee97['query'][_0xe95c('0x3f')]);_0x40d435[_0xe95c('0x42')]=qs[_0xe95c('0x37')](_[_0xe95c('0x40')](_0x15ee97[_0xe95c('0x36')],_0x4a4cd2[_0xe95c('0x37')]));if(_0x15ee97['query'][_0xe95c('0x41')]){_0x40d435['where']=_[_0xe95c('0x43')](_0x40d435['where'],{'$or':_['map'](_0x40d435[_0xe95c('0x39')],function(_0xa428e7){var _0x7ba377={};_0x7ba377[_0xa428e7]={'$like':'%'+_0x15ee97[_0xe95c('0x36')][_0xe95c('0x41')]+'%'};return _0x7ba377;})});}_0x40d435=_[_0xe95c('0x43')]({},_0x40d435,_0x15ee97[_0xe95c('0x45')]);return _0xe9172e[_0xe95c('0x87')](_0x40d435);}})[_0xe95c('0x27')](function(_0x2682ac){if(_0x2682ac){_0x4d4438=_0x2682ac[_0xe95c('0x3b')];if(!_0x15ee97[_0xe95c('0x36')][_0xe95c('0x3c')](_0xe95c('0x3d'))){_0x40d435['limit']=qs[_0xe95c('0x1e')](_0x15ee97['query'][_0xe95c('0x1e')]);_0x40d435[_0xe95c('0x1d')]=qs[_0xe95c('0x1d')](_0x15ee97[_0xe95c('0x36')][_0xe95c('0x1d')]);}return _0xe9172e[_0xe95c('0x87')](_0x40d435);}})[_0xe95c('0x27')](function(_0x5857ad){if(_0x5857ad){return _0x5857ad?{'count':_0x4d4438,'rows':_0x5857ad}:null;}})[_0xe95c('0x27')](respondWithResult(_0x5aa2f7,null))[_0xe95c('0x49')](handleError(_0x5aa2f7,null));}; \ No newline at end of file +var _0xc181=['value','removeAgents','emit','userMailQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','status','end','json','offset','undefined','limit','set','Content-Range','reject','then','destroy','MailQueues','UserProfileResource','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','MailQueue','count','include','findAll','rows','catch','show','params','find','create','body','get','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','order','MailQueueId','User','findAndCountAll','UserId','agent','mailPause','format','%s/%s','createdAt','updatedAt','getTeams','addTeams','ids','Team','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','userMailQueue:save','removeTeams','select','tq.TeamId','from','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','union'];(function(_0x923ad8,_0x3b97ca){var _0x2307d0=function(_0x39592a){while(--_0x39592a){_0x923ad8['push'](_0x923ad8['shift']());}};_0x2307d0(++_0x3b97ca);}(_0xc181,0x126));var _0x1c18=function(_0x18aaaf,_0x385db6){_0x18aaaf=_0x18aaaf-0x0;var _0x52d892=_0xc181[_0x18aaaf];return _0x52d892;};'use strict';var emlformat=require(_0x1c18('0x0'));var rimraf=require(_0x1c18('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1c18('0x2'));var rp=require(_0x1c18('0x3'));var moment=require(_0x1c18('0x4'));var BPromise=require(_0x1c18('0x5'));var Mustache=require(_0x1c18('0x6'));var util=require('util');var path=require(_0x1c18('0x7'));var sox=require(_0x1c18('0x8'));var csv=require(_0x1c18('0x9'));var ejs=require(_0x1c18('0xa'));var fs=require('fs');var fs_extra=require(_0x1c18('0xb'));var _=require(_0x1c18('0xc'));var squel=require(_0x1c18('0xd'));var crypto=require(_0x1c18('0xe'));var jsforce=require(_0x1c18('0xf'));var deskjs=require(_0x1c18('0x10'));var toCsv=require(_0x1c18('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1c18('0x11'));var authService=require(_0x1c18('0x12'));var qs=require(_0x1c18('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1c18('0x14'));var logger=require(_0x1c18('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1c18('0x16'));var db=require(_0x1c18('0x17'))['db'];config[_0x1c18('0x18')]=_[_0x1c18('0x19')](config['redis'],{'host':_0x1c18('0x1a'),'port':0x18eb});var socket=require(_0x1c18('0x1b'))(new Redis(config[_0x1c18('0x18')]));require(_0x1c18('0x1c'))[_0x1c18('0x1d')](socket);function respondWithStatusCode(_0x451d0a,_0x4b4754){_0x4b4754=_0x4b4754||0xcc;return function(_0x38a8f0){if(_0x38a8f0){return _0x451d0a['sendStatus'](_0x4b4754);}return _0x451d0a[_0x1c18('0x1e')](_0x4b4754)[_0x1c18('0x1f')]();};}function respondWithResult(_0x48464c,_0x33a5ed){_0x33a5ed=_0x33a5ed||0xc8;return function(_0x2c91a6){if(_0x2c91a6){return _0x48464c[_0x1c18('0x1e')](_0x33a5ed)[_0x1c18('0x20')](_0x2c91a6);}};}function respondWithFilteredResult(_0x5d9821,_0x17479c){return function(_0x557263){if(_0x557263){var _0xc49d3c=typeof _0x17479c[_0x1c18('0x21')]===_0x1c18('0x22')&&typeof _0x17479c[_0x1c18('0x23')]===_0x1c18('0x22');var _0x1417f0=_0x557263['count'];var _0x38942d=_0xc49d3c?0x0:_0x17479c['offset'];var _0x599140=_0xc49d3c?_0x557263['count']:_0x17479c['offset']+_0x17479c['limit'];var _0x56eb54;if(_0x599140>=_0x1417f0){_0x599140=_0x1417f0;_0x56eb54=0xc8;}else{_0x56eb54=0xce;}_0x5d9821[_0x1c18('0x1e')](_0x56eb54);return _0x5d9821[_0x1c18('0x24')](_0x1c18('0x25'),_0x38942d+'-'+_0x599140+'/'+_0x1417f0)['json'](_0x557263);}return null;};}function patchUpdates(_0x16faf4){return function(_0x5a323a){try{jsonpatch['apply'](_0x5a323a,_0x16faf4,!![]);}catch(_0x74ccf1){return BPromise[_0x1c18('0x26')](_0x74ccf1);}return _0x5a323a['save']();};}function saveUpdates(_0x29c147,_0x2c30de){return function(_0x40c13f){if(_0x40c13f){return _0x40c13f['update'](_0x29c147)[_0x1c18('0x27')](function(_0x2985d6){return _0x2985d6;});}return null;};}function removeEntity(_0x5687cb,_0x3fa7c7){return function(_0x12c378){if(_0x12c378){return _0x12c378[_0x1c18('0x28')]()['then'](function(){var _0x5ed7de=_0x12c378['get']({'plain':!![]});var _0x349120=_0x1c18('0x29');return db[_0x1c18('0x2a')][_0x1c18('0x28')]({'where':{'type':_0x349120,'resourceId':_0x5ed7de['id']}})['then'](function(){return _0x12c378;});})['then'](function(){_0x5687cb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x447ff6,_0x2720a3){return function(_0x5018ea){if(!_0x5018ea){_0x447ff6[_0x1c18('0x2b')](0x194);}return _0x5018ea;};}function handleError(_0x40656d,_0x3fc07d){_0x3fc07d=_0x3fc07d||0x1f4;return function(_0x4db303){logger[_0x1c18('0x2c')](_0x4db303[_0x1c18('0x2d')]);if(_0x4db303[_0x1c18('0x2e')]){delete _0x4db303['name'];}_0x40656d['status'](_0x3fc07d)[_0x1c18('0x2f')](_0x4db303);};}exports[_0x1c18('0x30')]=function(_0x357642,_0x3091da){var _0x530411={},_0x1e5735={},_0x22100c={'count':0x0,'rows':[]};var _0x9a35ba=_[_0x1c18('0x31')](db['MailQueue'][_0x1c18('0x32')],function(_0x525117){return{'name':_0x525117['fieldName'],'type':_0x525117[_0x1c18('0x33')][_0x1c18('0x34')]};});_0x1e5735[_0x1c18('0x35')]=_[_0x1c18('0x31')](_0x9a35ba,_0x1c18('0x2e'));_0x1e5735[_0x1c18('0x36')]=_[_0x1c18('0x37')](_0x357642['query']);_0x1e5735[_0x1c18('0x38')]=_[_0x1c18('0x39')](_0x1e5735['model'],_0x1e5735['query']);_0x530411['attributes']=_[_0x1c18('0x39')](_0x1e5735[_0x1c18('0x35')],qs[_0x1c18('0x3a')](_0x357642[_0x1c18('0x36')]['fields']));_0x530411[_0x1c18('0x3b')]=_0x530411[_0x1c18('0x3b')][_0x1c18('0x3c')]?_0x530411[_0x1c18('0x3b')]:_0x1e5735['model'];if(!_0x357642[_0x1c18('0x36')]['hasOwnProperty'](_0x1c18('0x3d'))){_0x530411[_0x1c18('0x23')]=qs[_0x1c18('0x23')](_0x357642[_0x1c18('0x36')][_0x1c18('0x23')]);_0x530411[_0x1c18('0x21')]=qs[_0x1c18('0x21')](_0x357642[_0x1c18('0x36')]['offset']);}_0x530411['order']=qs[_0x1c18('0x3e')](_0x357642['query'][_0x1c18('0x3e')]);_0x530411['where']=qs[_0x1c18('0x38')](_[_0x1c18('0x3f')](_0x357642[_0x1c18('0x36')],_0x1e5735[_0x1c18('0x38')]),_0x9a35ba);if(_0x357642['query'][_0x1c18('0x40')]){_0x530411[_0x1c18('0x41')]=_[_0x1c18('0x42')](_0x530411['where'],{'$or':_['map'](_0x9a35ba,function(_0xcb5acf){if(_0xcb5acf[_0x1c18('0x33')]!==_0x1c18('0x43')){var _0x4feaad={};_0x4feaad[_0xcb5acf[_0x1c18('0x2e')]]={'$like':'%'+_0x357642[_0x1c18('0x36')][_0x1c18('0x40')]+'%'};return _0x4feaad;}})});}_0x530411=_[_0x1c18('0x42')]({},_0x530411,_0x357642[_0x1c18('0x44')]);var _0x5a1afe={'where':_0x530411['where']};return db[_0x1c18('0x45')][_0x1c18('0x46')](_0x5a1afe)['then'](function(_0x4bf48b){_0x22100c[_0x1c18('0x46')]=_0x4bf48b;if(_0x357642[_0x1c18('0x36')]['includeAll']){_0x530411[_0x1c18('0x47')]=[{'all':!![]}];}return db[_0x1c18('0x45')][_0x1c18('0x48')](_0x530411);})[_0x1c18('0x27')](function(_0x179e7d){_0x22100c[_0x1c18('0x49')]=_0x179e7d;return _0x22100c;})[_0x1c18('0x27')](respondWithFilteredResult(_0x3091da,_0x530411))[_0x1c18('0x4a')](handleError(_0x3091da,null));};exports[_0x1c18('0x4b')]=function(_0x5879c8,_0x3baed5){var _0x458b06={'raw':!![],'where':{'id':_0x5879c8[_0x1c18('0x4c')]['id']}},_0x280aaa={};_0x280aaa[_0x1c18('0x35')]=_[_0x1c18('0x37')](db[_0x1c18('0x45')][_0x1c18('0x32')]);_0x280aaa[_0x1c18('0x36')]=_[_0x1c18('0x37')](_0x5879c8[_0x1c18('0x36')]);_0x280aaa[_0x1c18('0x38')]=_[_0x1c18('0x39')](_0x280aaa[_0x1c18('0x35')],_0x280aaa[_0x1c18('0x36')]);_0x458b06[_0x1c18('0x3b')]=_[_0x1c18('0x39')](_0x280aaa[_0x1c18('0x35')],qs[_0x1c18('0x3a')](_0x5879c8[_0x1c18('0x36')][_0x1c18('0x3a')]));_0x458b06[_0x1c18('0x3b')]=_0x458b06[_0x1c18('0x3b')][_0x1c18('0x3c')]?_0x458b06[_0x1c18('0x3b')]:_0x280aaa[_0x1c18('0x35')];if(_0x5879c8[_0x1c18('0x36')]['includeAll']){_0x458b06[_0x1c18('0x47')]=[{'all':!![]}];}_0x458b06=_[_0x1c18('0x42')]({},_0x458b06,_0x5879c8[_0x1c18('0x44')]);return db[_0x1c18('0x45')][_0x1c18('0x4d')](_0x458b06)['then'](handleEntityNotFound(_0x3baed5,null))[_0x1c18('0x27')](respondWithResult(_0x3baed5,null))[_0x1c18('0x4a')](handleError(_0x3baed5,null));};exports[_0x1c18('0x4e')]=function(_0x4fe335,_0x2b6b14){return db[_0x1c18('0x45')][_0x1c18('0x4e')](_0x4fe335[_0x1c18('0x4f')],{})[_0x1c18('0x27')](function(_0x58e20f){var _0x3d211e=_0x4fe335['user'][_0x1c18('0x50')]({'plain':!![]});if(!_0x3d211e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3d211e[_0x1c18('0x51')]===_0x1c18('0x52')){var _0x5680a0=_0x58e20f[_0x1c18('0x50')]({'plain':!![]});var _0x254cde=_0x1c18('0x29');return db[_0x1c18('0x53')][_0x1c18('0x4d')]({'where':{'name':_0x254cde,'userProfileId':_0x3d211e[_0x1c18('0x54')]},'raw':!![]})[_0x1c18('0x27')](function(_0x45c721){if(_0x45c721&&_0x45c721['autoAssociation']===0x0){return db[_0x1c18('0x2a')]['create']({'name':_0x5680a0[_0x1c18('0x2e')],'resourceId':_0x5680a0['id'],'type':_0x45c721['name'],'sectionId':_0x45c721['id']},{})[_0x1c18('0x27')](function(){return _0x58e20f;});}else{return _0x58e20f;}})[_0x1c18('0x4a')](function(_0x5e4c92){logger[_0x1c18('0x2c')](_0x1c18('0x55'),_0x5e4c92);throw _0x5e4c92;});}return _0x58e20f;})[_0x1c18('0x27')](respondWithResult(_0x2b6b14,0xc9))[_0x1c18('0x4a')](handleError(_0x2b6b14,null));};exports[_0x1c18('0x56')]=function(_0x4fcdcf,_0x2fdcae){if(_0x4fcdcf[_0x1c18('0x4f')]['id']){delete _0x4fcdcf[_0x1c18('0x4f')]['id'];}return db[_0x1c18('0x45')]['find']({'where':{'id':_0x4fcdcf[_0x1c18('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2fdcae,null))[_0x1c18('0x27')](saveUpdates(_0x4fcdcf[_0x1c18('0x4f')],null))['then'](respondWithResult(_0x2fdcae,null))[_0x1c18('0x4a')](handleError(_0x2fdcae,null));};exports[_0x1c18('0x28')]=function(_0x36e97d,_0x2e8ddc){return db['MailQueue'][_0x1c18('0x4d')]({'where':{'id':_0x36e97d['params']['id']}})['then'](handleEntityNotFound(_0x2e8ddc,null))[_0x1c18('0x27')](removeEntity(_0x2e8ddc,null))[_0x1c18('0x4a')](handleError(_0x2e8ddc,null));};exports['describe']=function(_0x4a89d0,_0x334fbd){return db[_0x1c18('0x45')][_0x1c18('0x57')]()['then'](respondWithResult(_0x334fbd,null))['catch'](handleError(_0x334fbd,null));};exports[_0x1c18('0x58')]=function(_0x44f317,_0x47b736,_0x53ba61){var _0x33944b={'raw':!![],'where':{}},_0x5914f9={},_0x34a4df;return db['MailQueue'][_0x1c18('0x59')]({'where':{'id':_0x44f317[_0x1c18('0x4c')]['id']}})[_0x1c18('0x27')](handleEntityNotFound(_0x47b736,null))[_0x1c18('0x27')](function(_0x3c75b0){if(_0x3c75b0){_0x34a4df=_0x3c75b0[_0x1c18('0x50')]({'plain':!![]});_0x5914f9[_0x1c18('0x35')]=_['keys'](db[_0x1c18('0x5a')][_0x1c18('0x32')]);_0x5914f9[_0x1c18('0x36')]=_['keys'](_0x44f317['query']);_0x5914f9[_0x1c18('0x38')]=_[_0x1c18('0x39')](_0x5914f9[_0x1c18('0x35')],_0x5914f9['query']);_0x33944b[_0x1c18('0x3b')]=_[_0x1c18('0x39')](_0x5914f9[_0x1c18('0x35')],qs[_0x1c18('0x3a')](_0x44f317[_0x1c18('0x36')][_0x1c18('0x3a')]));_0x33944b[_0x1c18('0x3b')]=_0x33944b['attributes'][_0x1c18('0x3c')]?_0x33944b[_0x1c18('0x3b')]:_0x5914f9[_0x1c18('0x35')];if(!_0x44f317[_0x1c18('0x36')][_0x1c18('0x5b')]('nolimit')){_0x33944b[_0x1c18('0x23')]=qs[_0x1c18('0x23')](_0x44f317['query']['limit']);_0x33944b[_0x1c18('0x21')]=qs['offset'](_0x44f317[_0x1c18('0x36')][_0x1c18('0x21')]);}_0x33944b[_0x1c18('0x5c')]=qs[_0x1c18('0x3e')](_0x44f317[_0x1c18('0x36')][_0x1c18('0x3e')]);_0x33944b['where']=qs['filters'](_[_0x1c18('0x3f')](_0x44f317[_0x1c18('0x36')],_0x5914f9['filters']));_0x33944b['where'][_0x1c18('0x5d')]=_0x3c75b0['id'];if(_0x44f317['query'][_0x1c18('0x40')]){_0x33944b['where']=_['merge'](_0x33944b['where'],{'$or':_[_0x1c18('0x31')](_0x33944b['attributes'],function(_0x335cf5){var _0x12fef9={};_0x12fef9[_0x335cf5]={'$like':'%'+_0x44f317[_0x1c18('0x36')][_0x1c18('0x40')]+'%'};return _0x12fef9;})});}_0x33944b=_[_0x1c18('0x42')]({},_0x33944b,_0x44f317[_0x1c18('0x44')]);return db[_0x1c18('0x5a')]['findAll'](_0x33944b);}})[_0x1c18('0x27')](function(_0x318b9a){if(_0x318b9a){return db[_0x1c18('0x5e')][_0x1c18('0x5f')]({'where':{'id':_[_0x1c18('0x31')](_0x318b9a,_0x1c18('0x60')),'role':_0x1c18('0x61')},'attributes':['id',_0x1c18('0x2e'),_0x1c18('0x62'),'updatedAt','createdAt']});}})['then'](function(_0x4fa10c){if(_0x4fa10c){return{'count':_0x4fa10c[_0x1c18('0x46')],'rows':_[_0x1c18('0x31')](_0x4fa10c['rows'],function(_0x1d97af){return{'membername':_0x1d97af[_0x1c18('0x2e')],'UserId':_0x1d97af['id'],'queue_name':_0x34a4df[_0x1c18('0x2e')],'MailQueueId':_0x34a4df['id'],'interface':util[_0x1c18('0x63')](_0x1c18('0x64'),'SIP',_0x1d97af[_0x1c18('0x2e')]),'penalty':0x0,'paused':_0x1d97af[_0x1c18('0x62')],'createdAt':_0x1d97af[_0x1c18('0x65')],'updatedAt':_0x1d97af[_0x1c18('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1c18('0x27')](respondWithFilteredResult(_0x47b736,_0x33944b))['catch'](handleError(_0x47b736,null));};exports[_0x1c18('0x67')]=function(_0x16db22,_0x5b2d07,_0x14f102){var _0x1add7d={};var _0x2cf6d5={};var _0x48e8be;var _0x23191c;return db[_0x1c18('0x45')]['findOne']({'where':{'id':_0x16db22[_0x1c18('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5b2d07,null))[_0x1c18('0x27')](function(_0xb6ff5c){if(_0xb6ff5c){_0x48e8be=_0xb6ff5c;_0x2cf6d5[_0x1c18('0x35')]=_['keys'](db['Team'][_0x1c18('0x32')]);_0x2cf6d5['query']=_[_0x1c18('0x37')](_0x16db22[_0x1c18('0x36')]);_0x2cf6d5[_0x1c18('0x38')]=_[_0x1c18('0x39')](_0x2cf6d5['model'],_0x2cf6d5[_0x1c18('0x36')]);_0x1add7d[_0x1c18('0x3b')]=_[_0x1c18('0x39')](_0x2cf6d5[_0x1c18('0x35')],qs[_0x1c18('0x3a')](_0x16db22[_0x1c18('0x36')][_0x1c18('0x3a')]));_0x1add7d[_0x1c18('0x3b')]=_0x1add7d[_0x1c18('0x3b')][_0x1c18('0x3c')]?_0x1add7d[_0x1c18('0x3b')]:_0x2cf6d5[_0x1c18('0x35')];_0x1add7d[_0x1c18('0x5c')]=qs[_0x1c18('0x3e')](_0x16db22[_0x1c18('0x36')]['sort']);_0x1add7d['where']=qs[_0x1c18('0x38')](_['pick'](_0x16db22[_0x1c18('0x36')],_0x2cf6d5['filters']));if(_0x16db22['query'][_0x1c18('0x40')]){_0x1add7d[_0x1c18('0x41')]=_[_0x1c18('0x42')](_0x1add7d[_0x1c18('0x41')],{'$or':_[_0x1c18('0x31')](_0x1add7d[_0x1c18('0x3b')],function(_0x5748c3){var _0x1138d3={};_0x1138d3[_0x5748c3]={'$like':'%'+_0x16db22[_0x1c18('0x36')]['filter']+'%'};return _0x1138d3;})});}_0x1add7d=_[_0x1c18('0x42')]({},_0x1add7d,_0x16db22['options']);return _0x48e8be['getTeams'](_0x1add7d);}})['then'](function(_0x553c56){if(_0x553c56){_0x23191c=_0x553c56[_0x1c18('0x3c')];if(!_0x16db22[_0x1c18('0x36')]['hasOwnProperty']('nolimit')){_0x1add7d[_0x1c18('0x23')]=qs['limit'](_0x16db22[_0x1c18('0x36')][_0x1c18('0x23')]);_0x1add7d[_0x1c18('0x21')]=qs['offset'](_0x16db22[_0x1c18('0x36')][_0x1c18('0x21')]);}return _0x48e8be[_0x1c18('0x67')](_0x1add7d);}})[_0x1c18('0x27')](function(_0x458e77){if(_0x458e77){return _0x458e77?{'count':_0x23191c,'rows':_0x458e77}:null;}})['then'](respondWithResult(_0x5b2d07,null))[_0x1c18('0x4a')](handleError(_0x5b2d07,null));};exports[_0x1c18('0x68')]=function(_0x3d1c6c,_0x30a5f1,_0x7baeae){var _0x9c3eb9=_0x3d1c6c['body'][_0x1c18('0x69')];return db[_0x1c18('0x6a')][_0x1c18('0x48')]({'where':{'id':_0x9c3eb9},'attributes':['id'],'include':[{'model':db[_0x1c18('0x5e')],'as':_0x1c18('0x6b'),'attributes':['id',_0x1c18('0x2e'),_0x1c18('0x6c'),_0x1c18('0x6d'),'interface'],'raw':!![]}]})['then'](function(_0x29cfb7){if(_0x29cfb7){var _0xd7a8e6=_[_0x1c18('0x6e')](_0x29cfb7,function(_0x535112){var _0x53ef07=_0x535112[_0x1c18('0x50')]({'plain':!![]});return _0x53ef07[_0x1c18('0x6b')];});return db[_0x1c18('0x45')]['find']({'where':{'id':_0x3d1c6c['params']['id']}})[_0x1c18('0x27')](function(_0x357ce1){return db[_0x1c18('0x6f')][_0x1c18('0x70')](function(_0x4b5164){return _0x357ce1[_0x1c18('0x68')](_0x9c3eb9,{'transaction':_0x4b5164})[_0x1c18('0x27')](function(){return BPromise[_0x1c18('0x71')](_0xd7a8e6,function(_0x503f7b){return db['UserMailQueue'][_0x1c18('0x72')]({'where':{'UserId':_0x503f7b['id'],'MailQueueId':_0x3d1c6c[_0x1c18('0x4c')]['id']},'transaction':_0x4b5164});});})[_0x1c18('0x27')](function(){_0xd7a8e6[_0x1c18('0x73')](function(_0x10bab3){socket['emit'](_0x1c18('0x74'),{'UserId':_0x10bab3['id'],'MailQueueId':_0x357ce1['id']});});});});});}})[_0x1c18('0x27')](respondWithStatusCode(_0x30a5f1,null))['catch'](handleError(_0x30a5f1,null));};exports[_0x1c18('0x75')]=function(_0xbc156e,_0x68958,_0x317322){return db[_0x1c18('0x6a')][_0x1c18('0x48')]({'where':{'id':_0xbc156e[_0x1c18('0x36')][_0x1c18('0x69')]},'attributes':['id'],'include':[{'model':db[_0x1c18('0x5e')],'as':_0x1c18('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x1c18('0x27')](handleEntityNotFound(_0x68958,null))[_0x1c18('0x27')](function(_0x452dd4){var _0x205191=_[_0x1c18('0x31')](_0x452dd4,'id');var _0x58ddac=[];var _0x110494=[];var _0x14e7ca=squel[_0x1c18('0x76')]();_0x14e7ca['field'](_0x1c18('0x77'))[_0x1c18('0x78')](_0x1c18('0x79'),'tq')['join'](_0x1c18('0x7a'),'ut',_0x1c18('0x7b'))['where'](_0x1c18('0x7c'),_0xbc156e['params']['id']);for(var _0x347c7a=0x0;_0x347c7a<_0x452dd4['length'];_0x347c7a+=0x1){let _0x24b43b=_0x452dd4[_0x347c7a];for(var _0x59f113=0x0;_0x59f113<_0x24b43b[_0x1c18('0x6b')][_0x1c18('0x3c')];_0x59f113+=0x1){let _0x410fea=_0x24b43b[_0x1c18('0x6b')][_0x59f113];var _0x4d338d=_0x14e7ca[_0x1c18('0x7d')]();_0x4d338d[_0x1c18('0x41')](_0x1c18('0x7e'),_0x410fea['id']);_0x110494[_0x1c18('0x7f')](db[_0x1c18('0x6f')][_0x1c18('0x36')](_0x4d338d[_0x1c18('0x80')](),{'type':db[_0x1c18('0x6f')][_0x1c18('0x81')][_0x1c18('0x82')]})[_0x1c18('0x27')](function(_0x3e7ebf){if(_0x3e7ebf[_0x1c18('0x3c')]===0x1){return _0x410fea['id'];}else{var _0x2cc174=_[_0x1c18('0x83')](_['map'](_0x3e7ebf,'TeamId'),function(_0x17ad1c){return _[_0x1c18('0x84')](_0x205191,_0x17ad1c);});if(_0x2cc174){return _0x410fea['id'];}}}));}}return BPromise[_0x1c18('0x85')](_0x110494)['then'](function(_0x3b1ec){_0x58ddac=_(_0x58ddac)[_0x1c18('0x86')](_0x3b1ec)['compact']()[_0x1c18('0x87')]();return db[_0x1c18('0x45')]['find']({'where':{'id':_0xbc156e[_0x1c18('0x4c')]['id']}})[_0x1c18('0x27')](function(_0x1696bf){return db['sequelize'][_0x1c18('0x70')](function(_0x470ba2){return _0x1696bf['removeTeams'](_0xbc156e[_0x1c18('0x36')][_0x1c18('0x69')],{'transaction':_0x470ba2})['then'](function(){if(!_['isEmpty'](_0x58ddac)){return _0x1696bf[_0x1c18('0x88')](_0x58ddac,{'transaction':_0x470ba2});}})[_0x1c18('0x27')](function(){_0x58ddac[_0x1c18('0x73')](function(_0x16e4b3){socket[_0x1c18('0x89')](_0x1c18('0x8a'),{'UserId':_0x16e4b3,'MailQueueId':_0x1696bf['id']});});});});});});})[_0x1c18('0x27')](respondWithStatusCode(_0x68958,null))[_0x1c18('0x4a')](handleError(_0x68958,null));};exports['addAgents']=function(_0x3b5d54,_0xcc03b7,_0x2bf9d3){return db[_0x1c18('0x45')][_0x1c18('0x4d')]({'where':{'id':_0x3b5d54[_0x1c18('0x4c')]['id']}})[_0x1c18('0x27')](handleEntityNotFound(_0xcc03b7,null))[_0x1c18('0x27')](function(_0xd7e81d){if(_0xd7e81d){return _0xd7e81d[_0x1c18('0x8b')](_0x3b5d54['body']['ids'],_[_0x1c18('0x8c')](_0x3b5d54[_0x1c18('0x4f')],[_0x1c18('0x69'),'id'])||{})[_0x1c18('0x8d')](function(_0x229d62){for(var _0x11a181=0x0;_0x11a181<_0x3b5d54['body']['ids'][_0x1c18('0x3c')];_0x11a181+=0x1){socket['emit']('userMailQueue:save',{'UserId':Number(_0x3b5d54[_0x1c18('0x4f')]['ids'][_0x11a181]),'MailQueueId':Number(_0x3b5d54[_0x1c18('0x4c')]['id'])});}return _0x229d62;});}})[_0x1c18('0x27')](respondWithResult(_0xcc03b7,null))[_0x1c18('0x4a')](handleError(_0xcc03b7,null));};exports['removeAgents']=function(_0x53eedf,_0x5e3d3c,_0x5df5a7){return db[_0x1c18('0x45')][_0x1c18('0x4d')]({'where':{'id':_0x53eedf[_0x1c18('0x4c')]['id']}})[_0x1c18('0x27')](handleEntityNotFound(_0x5e3d3c,null))[_0x1c18('0x27')](function(_0x591315){if(_0x591315){return _0x591315[_0x1c18('0x88')](_0x53eedf[_0x1c18('0x36')][_0x1c18('0x69')])[_0x1c18('0x27')](function(){if(_['isArray'](_0x53eedf[_0x1c18('0x36')][_0x1c18('0x69')])){for(var _0x2d6b0e=0x0;_0x2d6b0e<_0x53eedf[_0x1c18('0x36')][_0x1c18('0x69')][_0x1c18('0x3c')];_0x2d6b0e+=0x1){socket['emit'](_0x1c18('0x8a'),{'UserId':Number(_0x53eedf[_0x1c18('0x36')][_0x1c18('0x69')][_0x2d6b0e]),'MailQueueId':Number(_0x53eedf[_0x1c18('0x4c')]['id'])});}}else{socket[_0x1c18('0x89')]('userMailQueue:remove',{'UserId':Number(_0x53eedf[_0x1c18('0x36')]['ids']),'MailQueueId':Number(_0x53eedf['params']['id'])});}});}})[_0x1c18('0x27')](respondWithStatusCode(_0x5e3d3c,null))[_0x1c18('0x4a')](handleError(_0x5e3d3c,null));};exports[_0x1c18('0x8e')]=function(_0x556ed8,_0x25d0c9,_0x20d7e0){var _0x11afc1={};var _0x3a2396={};var _0x5a1654;var _0x129e2e;return db['MailQueue'][_0x1c18('0x59')]({'where':{'id':_0x556ed8[_0x1c18('0x4c')]['id']}})['then'](handleEntityNotFound(_0x25d0c9,null))[_0x1c18('0x27')](function(_0x4a53ae){if(_0x4a53ae){_0x5a1654=_0x4a53ae;_0x3a2396['model']=_['keys'](db['User']['rawAttributes']);_0x3a2396[_0x1c18('0x36')]=_[_0x1c18('0x37')](_0x556ed8[_0x1c18('0x36')]);_0x3a2396[_0x1c18('0x38')]=_[_0x1c18('0x39')](_0x3a2396[_0x1c18('0x35')],_0x3a2396['query']);_0x11afc1[_0x1c18('0x3b')]=_['intersection'](_0x3a2396[_0x1c18('0x35')],qs[_0x1c18('0x3a')](_0x556ed8[_0x1c18('0x36')]['fields']));_0x11afc1[_0x1c18('0x3b')]=_0x11afc1['attributes']['length']?_0x11afc1[_0x1c18('0x3b')]:_0x3a2396[_0x1c18('0x35')];_0x11afc1[_0x1c18('0x5c')]=qs[_0x1c18('0x3e')](_0x556ed8['query']['sort']);_0x11afc1['where']=qs[_0x1c18('0x38')](_[_0x1c18('0x3f')](_0x556ed8[_0x1c18('0x36')],_0x3a2396['filters']));if(_0x556ed8[_0x1c18('0x36')][_0x1c18('0x40')]){_0x11afc1[_0x1c18('0x41')]=_[_0x1c18('0x42')](_0x11afc1['where'],{'$or':_[_0x1c18('0x31')](_0x11afc1[_0x1c18('0x3b')],function(_0x5bbe31){var _0x48f0f5={};_0x48f0f5[_0x5bbe31]={'$like':'%'+_0x556ed8[_0x1c18('0x36')]['filter']+'%'};return _0x48f0f5;})});}_0x11afc1=_[_0x1c18('0x42')]({},_0x11afc1,_0x556ed8[_0x1c18('0x44')]);return _0x5a1654[_0x1c18('0x8e')](_0x11afc1);}})[_0x1c18('0x27')](function(_0x4df03d){if(_0x4df03d){_0x129e2e=_0x4df03d[_0x1c18('0x3c')];if(!_0x556ed8['query'][_0x1c18('0x5b')]('nolimit')){_0x11afc1[_0x1c18('0x23')]=qs[_0x1c18('0x23')](_0x556ed8[_0x1c18('0x36')][_0x1c18('0x23')]);_0x11afc1[_0x1c18('0x21')]=qs[_0x1c18('0x21')](_0x556ed8[_0x1c18('0x36')][_0x1c18('0x21')]);}return _0x5a1654[_0x1c18('0x8e')](_0x11afc1);}})[_0x1c18('0x27')](function(_0x5161a4){if(_0x5161a4){return _0x5161a4?{'count':_0x129e2e,'rows':_0x5161a4}:null;}})['then'](respondWithResult(_0x25d0c9,null))['catch'](handleError(_0x25d0c9,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index ab316cf..f031865 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 _0x71ac=['MailQueue','save','update','remove','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x560a91,_0x383a21){var _0x53e45b=function(_0x4898e8){while(--_0x4898e8){_0x560a91['push'](_0x560a91['shift']());}};_0x53e45b(++_0x383a21);}(_0x71ac,0x1a7));var _0xc71a=function(_0x1cbcf1,_0x3f9fd9){_0x1cbcf1=_0x1cbcf1-0x0;var _0x3a06f0=_0x71ac[_0x1cbcf1];return _0x3a06f0;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xc71a('0x0'))['db'][_0xc71a('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc71a('0x2'),'afterUpdate':_0xc71a('0x3'),'afterDestroy':_0xc71a('0x4')};function emitEvent(_0x11a4db){return function(_0x266595,_0x5ead04,_0x16b5c7){MailQueueEvents[_0xc71a('0x5')](_0x11a4db+':'+_0x266595['id'],_0x266595);MailQueueEvents[_0xc71a('0x5')](_0x11a4db,_0x266595);_0x16b5c7(null);};}for(var e in events){if(events[_0xc71a('0x6')](e)){var event=events[e];MailQueue[_0xc71a('0x7')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x42c0=['../../mysqldb','MailQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0xe0e250,_0xc7c35a){var _0x3814bd=function(_0x35056d){while(--_0x35056d){_0xe0e250['push'](_0xe0e250['shift']());}};_0x3814bd(++_0xc7c35a);}(_0x42c0,0x149));var _0x042c=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x42c0[_0x29d94e];return _0x106237;};'use strict';var EventEmitter=require(_0x042c('0x0'));var MailQueue=require(_0x042c('0x1'))['db'][_0x042c('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x042c('0x3')](0x0);var events={'afterCreate':_0x042c('0x4'),'afterUpdate':_0x042c('0x5'),'afterDestroy':'remove'};function emitEvent(_0x389532){return function(_0x4be983,_0x517bd2,_0x4a3102){MailQueueEvents[_0x042c('0x6')](_0x389532+':'+_0x4be983['id'],_0x4be983);MailQueueEvents[_0x042c('0x6')](_0x389532,_0x4be983);_0x4a3102(null);};}for(var e in events){if(events[_0x042c('0x7')](e)){var event=events[e];MailQueue[_0x042c('0x8')](e,emitEvent(event));}}module[_0x042c('0x9')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index b46e028..fdae561 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 _0x655d=['../../config/environment','./mailQueue.attributes','define','MailQueue','mail_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x655d,0x18b));var _0xd655=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x655d[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xd655('0x0'));var util=require(_0xd655('0x1'));var logger=require(_0xd655('0x2'))(_0xd655('0x3'));var moment=require(_0xd655('0x4'));var BPromise=require(_0xd655('0x5'));var rp=require(_0xd655('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd655('0x7'));var config=require(_0xd655('0x8'));var attributes=require(_0xd655('0x9'));module['exports']=function(_0x5660e6,_0x3a599c){return _0x5660e6[_0xd655('0xa')](_0xd655('0xb'),attributes,{'tableName':_0xd655('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1259=['../../config/logger','api','bluebird','request-promise','path','./mailQueue.attributes','exports','MailQueue','mail_queues','lodash'];(function(_0x167cac,_0x5446a6){var _0x2b1d29=function(_0x5bb730){while(--_0x5bb730){_0x167cac['push'](_0x167cac['shift']());}};_0x2b1d29(++_0x5446a6);}(_0x1259,0x167));var _0x9125=function(_0x4315f7,_0x5e14ed){_0x4315f7=_0x4315f7-0x0;var _0x3d7aea=_0x1259[_0x4315f7];return _0x3d7aea;};'use strict';var _=require(_0x9125('0x0'));var util=require('util');var logger=require(_0x9125('0x1'))(_0x9125('0x2'));var moment=require('moment');var BPromise=require(_0x9125('0x3'));var rp=require(_0x9125('0x4'));var fs=require('fs');var path=require(_0x9125('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9125('0x6'));module[_0x9125('0x7')]=function(_0x1f0e0d,_0x555625){return _0x1f0e0d['define'](_0x9125('0x8'),attributes,{'tableName':_0x9125('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 c8d3568..573c44f 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 _0x8369=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','MailQueue,\x20%s,\x20%s','message','catch','GetMailQueue','MailQueue','findAll','options','where','limit','include','map','attributes','model','ShowMailQueue','find','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x154305,_0x3bb604){var _0x564497=function(_0x3d7cbb){while(--_0x3d7cbb){_0x154305['push'](_0x154305['shift']());}};_0x564497(++_0x3bb604);}(_0x8369,0x10b));var _0x9836=function(_0x41a245,_0x22110b){_0x41a245=_0x41a245-0x0;var _0x22a8aa=_0x8369[_0x41a245];return _0x22a8aa;};'use strict';var _=require(_0x9836('0x0'));var util=require(_0x9836('0x1'));var moment=require(_0x9836('0x2'));var BPromise=require(_0x9836('0x3'));var rs=require(_0x9836('0x4'));var fs=require('fs');var Redis=require(_0x9836('0x5'));var db=require(_0x9836('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9836('0x7'))('rpc');var config=require(_0x9836('0x8'));var jayson=require(_0x9836('0x9'));var client=jayson['client'][_0x9836('0xa')]({'port':0x232a});config[_0x9836('0xb')]=_['defaults'](config[_0x9836('0xb')],{'host':_0x9836('0xc'),'port':0x18eb});var socket=require(_0x9836('0xd'))(new Redis(config[_0x9836('0xb')]));require('./mailQueue.socket')[_0x9836('0xe')](socket);function respondWithRpcPromise(_0x18b9de,_0x351ea4,_0x9f4d76){return new BPromise(function(_0x4f41b4,_0x34b972){return client[_0x9836('0xf')](_0x18b9de,_0x9f4d76)[_0x9836('0x10')](function(_0x2d9fe9){logger[_0x9836('0x11')]('MailQueue,\x20%s,\x20%s',_0x351ea4,_0x9836('0x12'));logger[_0x9836('0x13')](_0x9836('0x14'),_0x351ea4,_0x9836('0x12'),JSON[_0x9836('0x15')](_0x2d9fe9));if(_0x2d9fe9[_0x9836('0x16')]){if(_0x2d9fe9[_0x9836('0x16')][_0x9836('0x17')]===0x1f4){logger['error'](_0x9836('0x18'),_0x351ea4,_0x2d9fe9[_0x9836('0x16')][_0x9836('0x19')]);return _0x34b972(_0x2d9fe9['error'][_0x9836('0x19')]);}logger['error'](_0x9836('0x18'),_0x351ea4,_0x2d9fe9['error'][_0x9836('0x19')]);return _0x4f41b4(_0x2d9fe9[_0x9836('0x16')][_0x9836('0x19')]);}else{logger[_0x9836('0x11')](_0x9836('0x18'),_0x351ea4,_0x9836('0x12'));_0x4f41b4(_0x2d9fe9['result'][_0x9836('0x19')]);}})[_0x9836('0x1a')](function(_0x5496ce){logger[_0x9836('0x16')](_0x9836('0x18'),_0x351ea4,_0x5496ce);_0x34b972(_0x5496ce);});});}exports[_0x9836('0x1b')]=function(_0x498443){var _0x6b8e68=this;return new Promise(function(_0x479671,_0x472ab4){return db[_0x9836('0x1c')][_0x9836('0x1d')]({'raw':_0x498443[_0x9836('0x1e')]?_0x498443[_0x9836('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x498443['options']?_0x498443['options'][_0x9836('0x1f')]||null:null,'attributes':_0x498443[_0x9836('0x1e')]?_0x498443[_0x9836('0x1e')]['attributes']||null:null,'limit':_0x498443[_0x9836('0x1e')]?_0x498443[_0x9836('0x1e')][_0x9836('0x20')]||null:null,'include':_0x498443[_0x9836('0x1e')]?_0x498443['options'][_0x9836('0x21')]?_[_0x9836('0x22')](_0x498443[_0x9836('0x1e')][_0x9836('0x21')],function(_0x1be097){return{'model':db[_0x1be097['model']],'as':_0x1be097['as'],'attributes':_0x1be097[_0x9836('0x23')],'include':_0x1be097[_0x9836('0x21')]?_['map'](_0x1be097[_0x9836('0x21')],function(_0x517237){return{'model':db[_0x517237[_0x9836('0x24')]],'as':_0x517237['as'],'attributes':_0x517237['attributes'],'include':_0x517237['include']?_['map'](_0x517237[_0x9836('0x21')],function(_0x1c061f){return{'model':db[_0x1c061f[_0x9836('0x24')]],'as':_0x1c061f['as'],'attributes':_0x1c061f[_0x9836('0x23')]};}):[]};}):[]};}):[]:[]})[_0x9836('0x10')](function(_0x118aac){logger[_0x9836('0x11')]('GetMailQueue',_0x498443);logger[_0x9836('0x13')](_0x9836('0x1b'),_0x498443,JSON[_0x9836('0x15')](_0x118aac));_0x479671(_0x118aac);})[_0x9836('0x1a')](function(_0x2372c1){logger[_0x9836('0x16')](_0x9836('0x1b'),_0x2372c1[_0x9836('0x19')],_0x498443);_0x472ab4(_0x6b8e68[_0x9836('0x16')](0x1f4,_0x2372c1['message']));});});};exports[_0x9836('0x25')]=function(_0xc2d47a){var _0x16f7cf=this;return new Promise(function(_0x462c05,_0x1dfb14){return db[_0x9836('0x1c')][_0x9836('0x26')]({'raw':_0xc2d47a[_0x9836('0x1e')]?_0xc2d47a['options']['raw']===undefined?!![]:![]:!![],'where':_0xc2d47a[_0x9836('0x1e')]?_0xc2d47a[_0x9836('0x1e')][_0x9836('0x1f')]||null:null,'attributes':_0xc2d47a['options']?_0xc2d47a['options']['attributes']||null:null,'include':_0xc2d47a[_0x9836('0x1e')]?_0xc2d47a['options'][_0x9836('0x21')]?_[_0x9836('0x22')](_0xc2d47a['options']['include'],function(_0x36a03f){return{'model':db[_0x36a03f[_0x9836('0x24')]],'as':_0x36a03f['as'],'attributes':_0x36a03f[_0x9836('0x23')],'include':_0x36a03f[_0x9836('0x21')]?_[_0x9836('0x22')](_0x36a03f['include'],function(_0x5d1833){return{'model':db[_0x5d1833[_0x9836('0x24')]],'as':_0x5d1833['as'],'attributes':_0x5d1833[_0x9836('0x23')],'include':_0x5d1833[_0x9836('0x21')]?_[_0x9836('0x22')](_0x5d1833[_0x9836('0x21')],function(_0x32f95e){return{'model':db[_0x32f95e['model']],'as':_0x32f95e['as'],'attributes':_0x32f95e[_0x9836('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29b205){logger[_0x9836('0x11')](_0x9836('0x25'),_0xc2d47a);logger[_0x9836('0x13')](_0x9836('0x25'),_0xc2d47a,JSON[_0x9836('0x15')](_0x29b205));_0x462c05(_0x29b205);})[_0x9836('0x1a')](function(_0x5dafa7){logger[_0x9836('0x16')](_0x9836('0x25'),_0x5dafa7[_0x9836('0x19')],_0xc2d47a);_0x1dfb14(_0x16f7cf['error'](0x1f4,_0x5dafa7['message']));});});}; \ No newline at end of file +var _0x91b2=['request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','MailQueue,\x20%s,\x20%s','message','result','catch','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','map','include','model','then','ShowMailQueue','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','info'];(function(_0x104e21,_0x2ea86f){var _0x605b37=function(_0x580fce){while(--_0x580fce){_0x104e21['push'](_0x104e21['shift']());}};_0x605b37(++_0x2ea86f);}(_0x91b2,0x14e));var _0x291b=function(_0x152678,_0x11e0ac){_0x152678=_0x152678-0x0;var _0x311a9=_0x91b2[_0x152678];return _0x311a9;};'use strict';var _=require('lodash');var util=require(_0x291b('0x0'));var moment=require(_0x291b('0x1'));var BPromise=require(_0x291b('0x2'));var rs=require(_0x291b('0x3'));var fs=require('fs');var Redis=require(_0x291b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x291b('0x5'));var logger=require(_0x291b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x291b('0x7'));var client=jayson['client'][_0x291b('0x8')]({'port':0x232a});config[_0x291b('0x9')]=_[_0x291b('0xa')](config[_0x291b('0x9')],{'host':_0x291b('0xb'),'port':0x18eb});var socket=require(_0x291b('0xc'))(new Redis(config[_0x291b('0x9')]));require(_0x291b('0xd'))[_0x291b('0xe')](socket);function respondWithRpcPromise(_0x3afd01,_0x2853df,_0x14eb67){return new BPromise(function(_0x561101,_0x2245fb){return client[_0x291b('0xf')](_0x3afd01,_0x14eb67)['then'](function(_0x82ed3){logger[_0x291b('0x10')]('MailQueue,\x20%s,\x20%s',_0x2853df,_0x291b('0x11'));logger[_0x291b('0x12')](_0x291b('0x13'),_0x2853df,_0x291b('0x11'),JSON[_0x291b('0x14')](_0x82ed3));if(_0x82ed3['error']){if(_0x82ed3[_0x291b('0x15')][_0x291b('0x16')]===0x1f4){logger[_0x291b('0x15')](_0x291b('0x17'),_0x2853df,_0x82ed3[_0x291b('0x15')][_0x291b('0x18')]);return _0x2245fb(_0x82ed3[_0x291b('0x15')][_0x291b('0x18')]);}logger[_0x291b('0x15')](_0x291b('0x17'),_0x2853df,_0x82ed3['error'][_0x291b('0x18')]);return _0x561101(_0x82ed3[_0x291b('0x15')]['message']);}else{logger[_0x291b('0x10')]('MailQueue,\x20%s,\x20%s',_0x2853df,_0x291b('0x11'));_0x561101(_0x82ed3[_0x291b('0x19')][_0x291b('0x18')]);}})[_0x291b('0x1a')](function(_0x313f41){logger[_0x291b('0x15')]('MailQueue,\x20%s,\x20%s',_0x2853df,_0x313f41);_0x2245fb(_0x313f41);});});}exports[_0x291b('0x1b')]=function(_0xc5e665){var _0x285086=this;return new Promise(function(_0x2e9dfd,_0xe3ee78){return db[_0x291b('0x1c')][_0x291b('0x1d')]({'raw':_0xc5e665[_0x291b('0x1e')]?_0xc5e665['options'][_0x291b('0x1f')]===undefined?!![]:![]:!![],'where':_0xc5e665[_0x291b('0x1e')]?_0xc5e665[_0x291b('0x1e')][_0x291b('0x20')]||null:null,'attributes':_0xc5e665[_0x291b('0x1e')]?_0xc5e665[_0x291b('0x1e')][_0x291b('0x21')]||null:null,'limit':_0xc5e665[_0x291b('0x1e')]?_0xc5e665['options']['limit']||null:null,'include':_0xc5e665[_0x291b('0x1e')]?_0xc5e665[_0x291b('0x1e')]['include']?_[_0x291b('0x22')](_0xc5e665[_0x291b('0x1e')][_0x291b('0x23')],function(_0x2c5da6){return{'model':db[_0x2c5da6[_0x291b('0x24')]],'as':_0x2c5da6['as'],'attributes':_0x2c5da6[_0x291b('0x21')],'include':_0x2c5da6[_0x291b('0x23')]?_['map'](_0x2c5da6[_0x291b('0x23')],function(_0x425a48){return{'model':db[_0x425a48[_0x291b('0x24')]],'as':_0x425a48['as'],'attributes':_0x425a48[_0x291b('0x21')],'include':_0x425a48[_0x291b('0x23')]?_[_0x291b('0x22')](_0x425a48[_0x291b('0x23')],function(_0xb89187){return{'model':db[_0xb89187[_0x291b('0x24')]],'as':_0xb89187['as'],'attributes':_0xb89187[_0x291b('0x21')]};}):[]};}):[]};}):[]:[]})[_0x291b('0x25')](function(_0x5a8425){logger['info']('GetMailQueue',_0xc5e665);logger[_0x291b('0x12')]('GetMailQueue',_0xc5e665,JSON[_0x291b('0x14')](_0x5a8425));_0x2e9dfd(_0x5a8425);})['catch'](function(_0x3f63aa){logger['error'](_0x291b('0x1b'),_0x3f63aa[_0x291b('0x18')],_0xc5e665);_0xe3ee78(_0x285086[_0x291b('0x15')](0x1f4,_0x3f63aa[_0x291b('0x18')]));});});};exports[_0x291b('0x26')]=function(_0x144ad6){var _0x505ce7=this;return new Promise(function(_0x55a5c5,_0x492ee4){return db[_0x291b('0x1c')]['find']({'raw':_0x144ad6['options']?_0x144ad6[_0x291b('0x1e')][_0x291b('0x1f')]===undefined?!![]:![]:!![],'where':_0x144ad6['options']?_0x144ad6['options'][_0x291b('0x20')]||null:null,'attributes':_0x144ad6['options']?_0x144ad6[_0x291b('0x1e')][_0x291b('0x21')]||null:null,'include':_0x144ad6['options']?_0x144ad6[_0x291b('0x1e')][_0x291b('0x23')]?_[_0x291b('0x22')](_0x144ad6[_0x291b('0x1e')][_0x291b('0x23')],function(_0x43b26c){return{'model':db[_0x43b26c[_0x291b('0x24')]],'as':_0x43b26c['as'],'attributes':_0x43b26c[_0x291b('0x21')],'include':_0x43b26c[_0x291b('0x23')]?_[_0x291b('0x22')](_0x43b26c['include'],function(_0x438218){return{'model':db[_0x438218[_0x291b('0x24')]],'as':_0x438218['as'],'attributes':_0x438218[_0x291b('0x21')],'include':_0x438218[_0x291b('0x23')]?_[_0x291b('0x22')](_0x438218[_0x291b('0x23')],function(_0x2931f0){return{'model':db[_0x2931f0[_0x291b('0x24')]],'as':_0x2931f0['as'],'attributes':_0x2931f0[_0x291b('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x472031){logger[_0x291b('0x10')](_0x291b('0x26'),_0x144ad6);logger['debug']('ShowMailQueue',_0x144ad6,JSON[_0x291b('0x14')](_0x472031));_0x55a5c5(_0x472031);})[_0x291b('0x1a')](function(_0x5e8f10){logger[_0x291b('0x15')]('ShowMailQueue',_0x5e8f10[_0x291b('0x18')],_0x144ad6);_0x492ee4(_0x505ce7[_0x291b('0x15')](0x1f4,_0x5e8f10['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 9f20158..a82d4de 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 _0xa069=['update','emit','removeListener','register','length','mailQueue:','save','remove'];(function(_0x169937,_0x29a6ce){var _0x43fb0d=function(_0x380aaa){while(--_0x380aaa){_0x169937['push'](_0x169937['shift']());}};_0x43fb0d(++_0x29a6ce);}(_0xa069,0xa6));var _0x9a06=function(_0x3287c6,_0x5e0c29){_0x3287c6=_0x3287c6-0x0;var _0x366643=_0xa069[_0x3287c6];return _0x366643;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x9a06('0x0'),_0x9a06('0x1'),_0x9a06('0x2')];function createListener(_0x1dd010,_0xecbc5f){return function(_0x4f0ea4){_0xecbc5f[_0x9a06('0x3')](_0x1dd010,_0x4f0ea4);};}function removeListener(_0x3d56c,_0x386589){return function(){MailQueueEvents[_0x9a06('0x4')](_0x3d56c,_0x386589);};}exports[_0x9a06('0x5')]=function(_0x4a2405){for(var _0x4560d6=0x0,_0x172e8d=events[_0x9a06('0x6')];_0x4560d6<_0x172e8d;_0x4560d6++){var _0x5b55a5=events[_0x4560d6];var _0x261579=createListener(_0x9a06('0x7')+_0x5b55a5,_0x4a2405);MailQueueEvents['on'](_0x5b55a5,_0x261579);}}; \ No newline at end of file +var _0x6722=['./mailQueue.events','save','remove','update','emit','register','length'];(function(_0x341f64,_0x2512a6){var _0x5133d0=function(_0x2d9e6e){while(--_0x2d9e6e){_0x341f64['push'](_0x341f64['shift']());}};_0x5133d0(++_0x2512a6);}(_0x6722,0x134));var _0x2672=function(_0x39368f,_0x101da5){_0x39368f=_0x39368f-0x0;var _0x1988ee=_0x6722[_0x39368f];return _0x1988ee;};'use strict';var MailQueueEvents=require(_0x2672('0x0'));var events=[_0x2672('0x1'),_0x2672('0x2'),_0x2672('0x3')];function createListener(_0x538944,_0x3ef1d5){return function(_0x2ee13f){_0x3ef1d5[_0x2672('0x4')](_0x538944,_0x2ee13f);};}function removeListener(_0x1500b1,_0x19881a){return function(){MailQueueEvents['removeListener'](_0x1500b1,_0x19881a);};}exports[_0x2672('0x5')]=function(_0x46d9a6){for(var _0x57b8b7=0x0,_0x1bed98=events[_0x2672('0x6')];_0x57b8b7<_0x1bed98;_0x57b8b7++){var _0x1a9785=events[_0x57b8b7];var _0x4006a1=createListener('mailQueue:'+_0x1a9785,_0x46d9a6);MailQueueEvents['on'](_0x1a9785,_0x4006a1);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index b73c978..1253c8f 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 _0xd0ce=['show','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x4bb2b9,_0x459c78){var _0x40e2a2=function(_0x19a26c){while(--_0x19a26c){_0x4bb2b9['push'](_0x4bb2b9['shift']());}};_0x40e2a2(++_0x459c78);}(_0xd0ce,0x167));var _0xed0c=function(_0x28d31d,_0x57a4e6){_0x28d31d=_0x28d31d-0x0;var _0x2df7c1=_0xd0ce[_0x28d31d];return _0x2df7c1;};'use strict';var multer=require(_0xed0c('0x0'));var util=require(_0xed0c('0x1'));var path=require('path');var timeout=require(_0xed0c('0x2'));var express=require(_0xed0c('0x3'));var router=express[_0xed0c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xed0c('0x5'));var interaction=require(_0xed0c('0x6'));var config=require(_0xed0c('0x7'));var controller=require(_0xed0c('0x8'));router[_0xed0c('0x9')]('/',auth['isAuthenticated'](),controller[_0xed0c('0xa')]);router[_0xed0c('0x9')](_0xed0c('0xb'),auth[_0xed0c('0xc')](),controller[_0xed0c('0xd')]);router[_0xed0c('0x9')](_0xed0c('0xe'),auth['isAuthenticated'](),controller[_0xed0c('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xed0c('0x10')]);router[_0xed0c('0x11')](_0xed0c('0xe'),auth[_0xed0c('0xc')](),controller[_0xed0c('0x12')]);router[_0xed0c('0x13')]('/:id',auth[_0xed0c('0xc')](),controller[_0xed0c('0x14')]);module[_0xed0c('0x15')]=router; \ No newline at end of file +var _0x38bf=['/:id','show','create','put','update','delete','util','path','express','Router','../../components/interaction/service','isAuthenticated','index','get','/describe','describe'];(function(_0x3bae9e,_0x126176){var _0xbe5d1f=function(_0x56252f){while(--_0x56252f){_0x3bae9e['push'](_0x3bae9e['shift']());}};_0xbe5d1f(++_0x126176);}(_0x38bf,0x76));var _0xf38b=function(_0xfb7eb7,_0x5797aa){_0xfb7eb7=_0xfb7eb7-0x0;var _0x498e24=_0x38bf[_0xfb7eb7];return _0x498e24;};'use strict';var multer=require('multer');var util=require(_0xf38b('0x0'));var path=require(_0xf38b('0x1'));var timeout=require('connect-timeout');var express=require(_0xf38b('0x2'));var router=express[_0xf38b('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf38b('0x4'));var config=require('../../config/environment');var controller=require('./mailQueueReport.controller');router['get']('/',auth[_0xf38b('0x5')](),controller[_0xf38b('0x6')]);router[_0xf38b('0x7')](_0xf38b('0x8'),auth['isAuthenticated'](),controller[_0xf38b('0x9')]);router[_0xf38b('0x7')](_0xf38b('0xa'),auth[_0xf38b('0x5')](),controller[_0xf38b('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf38b('0xc')]);router[_0xf38b('0xd')](_0xf38b('0xa'),auth[_0xf38b('0x5')](),controller[_0xf38b('0xe')]);router[_0xf38b('0xf')](_0xf38b('0xa'),auth[_0xf38b('0x5')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index a6abe5d..eff69e7 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 _0xd20c=['DATE','moment','exports','STRING'];(function(_0x575de0,_0x15ea20){var _0x2eef9e=function(_0x2a21b0){while(--_0x2a21b0){_0x575de0['push'](_0x575de0['shift']());}};_0x2eef9e(++_0x15ea20);}(_0xd20c,0x1a9));var _0xcd20=function(_0x16c7fc,_0x36450b){_0x16c7fc=_0x16c7fc-0x0;var _0x1bf4a1=_0xd20c[_0x16c7fc];return _0x1bf4a1;};'use strict';var moment=require(_0xcd20('0x0'));var Sequelize=require('sequelize');module[_0xcd20('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xcd20('0x2')]},'joinAt':{'type':Sequelize[_0xcd20('0x3')]},'leaveAt':{'type':Sequelize[_0xcd20('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfb1c=['moment','sequelize','exports','STRING','DATE'];(function(_0x6c634f,_0x49d8ae){var _0xfe3040=function(_0x1e9dcd){while(--_0x1e9dcd){_0x6c634f['push'](_0x6c634f['shift']());}};_0xfe3040(++_0x49d8ae);}(_0xfb1c,0xd2));var _0xcfb1=function(_0x1a1caa,_0x39295f){_0x1a1caa=_0x1a1caa-0x0;var _0x322687=_0xfb1c[_0x1a1caa];return _0x322687;};'use strict';var moment=require(_0xcfb1('0x0'));var Sequelize=require(_0xcfb1('0x1'));module[_0xcfb1('0x2')]={'uniqueid':{'type':Sequelize[_0xcfb1('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xcfb1('0x4')]},'leaveAt':{'type':Sequelize[_0xcfb1('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xcfb1('0x4')]},'reason':{'type':Sequelize[_0xcfb1('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 8d1cb9a..5649068 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 _0x6d38=['findAll','rows','show','keys','filters','intersection','create','catch','body','find','params','describe','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','update','then','stack','name','send','index','map','MailQueueReport','rawAttributes','type','key','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include'];(function(_0x466247,_0x5d69e3){var _0x4b352e=function(_0x58c71b){while(--_0x58c71b){_0x466247['push'](_0x466247['shift']());}};_0x4b352e(++_0x5d69e3);}(_0x6d38,0x1ef));var _0x86d3=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x6d38[_0x2b4411];return _0x8e41ef;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x86d3('0x0'));var zipdir=require(_0x86d3('0x1'));var jsonpatch=require(_0x86d3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x86d3('0x3'));var Mustache=require('mustache');var util=require(_0x86d3('0x4'));var path=require(_0x86d3('0x5'));var sox=require(_0x86d3('0x6'));var csv=require('to-csv');var ejs=require(_0x86d3('0x7'));var fs=require('fs');var fs_extra=require(_0x86d3('0x8'));var _=require(_0x86d3('0x9'));var squel=require(_0x86d3('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x86d3('0xb'));var toCsv=require(_0x86d3('0xc'));var querystring=require(_0x86d3('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x86d3('0xe'));var qs=require(_0x86d3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x86d3('0x10'))(_0x86d3('0x11'));var utils=require('../../config/utils');var config=require(_0x86d3('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x86d3('0x13'))['db'];function respondWithStatusCode(_0x7d4d2e,_0x440a55){_0x440a55=_0x440a55||0xcc;return function(_0x26d64c){if(_0x26d64c){return _0x7d4d2e[_0x86d3('0x14')](_0x440a55);}return _0x7d4d2e[_0x86d3('0x15')](_0x440a55)[_0x86d3('0x16')]();};}function respondWithResult(_0x12ef4a,_0x5ce2ff){_0x5ce2ff=_0x5ce2ff||0xc8;return function(_0x1c1ba8){if(_0x1c1ba8){return _0x12ef4a[_0x86d3('0x15')](_0x5ce2ff)[_0x86d3('0x17')](_0x1c1ba8);}};}function respondWithFilteredResult(_0x207f6f,_0x1ea535){return function(_0x34fb3b){if(_0x34fb3b){var _0x1ff008=typeof _0x1ea535[_0x86d3('0x18')]==='undefined'&&typeof _0x1ea535[_0x86d3('0x19')]===_0x86d3('0x1a');var _0x431b3f=_0x34fb3b[_0x86d3('0x1b')];var _0x46feec=_0x1ff008?0x0:_0x1ea535[_0x86d3('0x18')];var _0x33e459=_0x1ff008?_0x34fb3b[_0x86d3('0x1b')]:_0x1ea535[_0x86d3('0x18')]+_0x1ea535['limit'];var _0x191ba5;if(_0x33e459>=_0x431b3f){_0x33e459=_0x431b3f;_0x191ba5=0xc8;}else{_0x191ba5=0xce;}_0x207f6f['status'](_0x191ba5);return _0x207f6f[_0x86d3('0x1c')]('Content-Range',_0x46feec+'-'+_0x33e459+'/'+_0x431b3f)['json'](_0x34fb3b);}return null;};}function patchUpdates(_0x41486a){return function(_0x1edb6d){try{jsonpatch[_0x86d3('0x1d')](_0x1edb6d,_0x41486a,!![]);}catch(_0x1720ae){return BPromise['reject'](_0x1720ae);}return _0x1edb6d[_0x86d3('0x1e')]();};}function saveUpdates(_0x55e1c3,_0x36e0fa){return function(_0x3fdf67){if(_0x3fdf67){return _0x3fdf67[_0x86d3('0x1f')](_0x55e1c3)['then'](function(_0x39d819){return _0x39d819;});}return null;};}function removeEntity(_0x72b3d4,_0x1fa4ac){return function(_0x4bf5b8){if(_0x4bf5b8){return _0x4bf5b8['destroy']()[_0x86d3('0x20')](function(){_0x72b3d4['status'](0xcc)[_0x86d3('0x16')]();});}};}function handleEntityNotFound(_0x1bea5e,_0x3dfecd){return function(_0x3c5fe4){if(!_0x3c5fe4){_0x1bea5e['sendStatus'](0x194);}return _0x3c5fe4;};}function handleError(_0x481077,_0x3359e4){_0x3359e4=_0x3359e4||0x1f4;return function(_0x611764){logger['error'](_0x611764[_0x86d3('0x21')]);if(_0x611764['name']){delete _0x611764[_0x86d3('0x22')];}_0x481077[_0x86d3('0x15')](_0x3359e4)[_0x86d3('0x23')](_0x611764);};}exports[_0x86d3('0x24')]=function(_0x11a6fd,_0x14c9ff){var _0x1f203e={},_0x35d708={},_0x303f13={'count':0x0,'rows':[]};var _0x44dacf=_[_0x86d3('0x25')](db[_0x86d3('0x26')][_0x86d3('0x27')],function(_0x28c25e){return{'name':_0x28c25e['fieldName'],'type':_0x28c25e[_0x86d3('0x28')][_0x86d3('0x29')]};});_0x35d708[_0x86d3('0x2a')]=_[_0x86d3('0x25')](_0x44dacf,_0x86d3('0x22'));_0x35d708[_0x86d3('0x2b')]=_['keys'](_0x11a6fd[_0x86d3('0x2b')]);_0x35d708['filters']=_['intersection'](_0x35d708[_0x86d3('0x2a')],_0x35d708[_0x86d3('0x2b')]);_0x1f203e[_0x86d3('0x2c')]=_['intersection'](_0x35d708[_0x86d3('0x2a')],qs[_0x86d3('0x2d')](_0x11a6fd['query'][_0x86d3('0x2d')]));_0x1f203e[_0x86d3('0x2c')]=_0x1f203e[_0x86d3('0x2c')][_0x86d3('0x2e')]?_0x1f203e[_0x86d3('0x2c')]:_0x35d708[_0x86d3('0x2a')];if(!_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x2f')]('nolimit')){_0x1f203e['limit']=qs['limit'](_0x11a6fd[_0x86d3('0x2b')]['limit']);_0x1f203e[_0x86d3('0x18')]=qs['offset'](_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x18')]);}_0x1f203e[_0x86d3('0x30')]=qs[_0x86d3('0x31')](_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x31')]);_0x1f203e[_0x86d3('0x32')]=qs['filters'](_[_0x86d3('0x33')](_0x11a6fd[_0x86d3('0x2b')],_0x35d708['filters']),_0x44dacf);if(_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x34')]){_0x1f203e[_0x86d3('0x32')]=_[_0x86d3('0x35')](_0x1f203e['where'],{'$or':_[_0x86d3('0x25')](_0x44dacf,function(_0x42ac0d){if(_0x42ac0d[_0x86d3('0x28')]!=='VIRTUAL'){var _0x5762ca={};_0x5762ca[_0x42ac0d[_0x86d3('0x22')]]={'$like':'%'+_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x34')]+'%'};return _0x5762ca;}})});}_0x1f203e=_[_0x86d3('0x35')]({},_0x1f203e,_0x11a6fd[_0x86d3('0x36')]);var _0x3666fc={'where':_0x1f203e[_0x86d3('0x32')]};return db['MailQueueReport'][_0x86d3('0x1b')](_0x3666fc)[_0x86d3('0x20')](function(_0x2bdc67){_0x303f13[_0x86d3('0x1b')]=_0x2bdc67;if(_0x11a6fd['query'][_0x86d3('0x37')]){_0x1f203e[_0x86d3('0x38')]=[{'all':!![]}];}return db[_0x86d3('0x26')][_0x86d3('0x39')](_0x1f203e);})['then'](function(_0x587747){_0x303f13[_0x86d3('0x3a')]=_0x587747;return _0x303f13;})['then'](respondWithFilteredResult(_0x14c9ff,_0x1f203e))['catch'](handleError(_0x14c9ff,null));};exports[_0x86d3('0x3b')]=function(_0x1385fc,_0x43490a){var _0x35d6fe={'raw':!![],'where':{'id':_0x1385fc['params']['id']}},_0x23ef72={};_0x23ef72[_0x86d3('0x2a')]=_[_0x86d3('0x3c')](db[_0x86d3('0x26')]['rawAttributes']);_0x23ef72[_0x86d3('0x2b')]=_[_0x86d3('0x3c')](_0x1385fc['query']);_0x23ef72[_0x86d3('0x3d')]=_[_0x86d3('0x3e')](_0x23ef72['model'],_0x23ef72['query']);_0x35d6fe['attributes']=_[_0x86d3('0x3e')](_0x23ef72[_0x86d3('0x2a')],qs[_0x86d3('0x2d')](_0x1385fc[_0x86d3('0x2b')][_0x86d3('0x2d')]));_0x35d6fe[_0x86d3('0x2c')]=_0x35d6fe['attributes'][_0x86d3('0x2e')]?_0x35d6fe[_0x86d3('0x2c')]:_0x23ef72['model'];if(_0x1385fc[_0x86d3('0x2b')][_0x86d3('0x37')]){_0x35d6fe[_0x86d3('0x38')]=[{'all':!![]}];}_0x35d6fe=_[_0x86d3('0x35')]({},_0x35d6fe,_0x1385fc[_0x86d3('0x36')]);return db[_0x86d3('0x26')]['find'](_0x35d6fe)[_0x86d3('0x20')](handleEntityNotFound(_0x43490a,null))[_0x86d3('0x20')](respondWithResult(_0x43490a,null))['catch'](handleError(_0x43490a,null));};exports[_0x86d3('0x3f')]=function(_0x412d0e,_0xd20863){return db[_0x86d3('0x26')][_0x86d3('0x3f')](_0x412d0e['body'],{})[_0x86d3('0x20')](respondWithResult(_0xd20863,0xc9))[_0x86d3('0x40')](handleError(_0xd20863,null));};exports[_0x86d3('0x1f')]=function(_0x14fa58,_0x369b75){if(_0x14fa58[_0x86d3('0x41')]['id']){delete _0x14fa58[_0x86d3('0x41')]['id'];}return db[_0x86d3('0x26')][_0x86d3('0x42')]({'where':{'id':_0x14fa58[_0x86d3('0x43')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x369b75,null))[_0x86d3('0x20')](saveUpdates(_0x14fa58['body'],null))[_0x86d3('0x20')](respondWithResult(_0x369b75,null))[_0x86d3('0x40')](handleError(_0x369b75,null));};exports['destroy']=function(_0x43290d,_0x23a6ee){return db[_0x86d3('0x26')][_0x86d3('0x42')]({'where':{'id':_0x43290d[_0x86d3('0x43')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x23a6ee,null))['then'](removeEntity(_0x23a6ee,null))['catch'](handleError(_0x23a6ee,null));};exports['describe']=function(_0x5bedc6,_0x159253){return db[_0x86d3('0x26')][_0x86d3('0x44')]()[_0x86d3('0x20')](respondWithResult(_0x159253,null))[_0x86d3('0x40')](handleError(_0x159253,null));}; \ No newline at end of file +var _0xa30a=['destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','apply','save','update','then','error','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','include','findAll','rows','catch','includeAll','find','body'];(function(_0x5330c1,_0xfb8cde){var _0x15e0bc=function(_0x294ad1){while(--_0x294ad1){_0x5330c1['push'](_0x5330c1['shift']());}};_0x15e0bc(++_0xfb8cde);}(_0xa30a,0xd7));var _0xaa30=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa30a[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xaa30('0x0'));var rimraf=require(_0xaa30('0x1'));var zipdir=require(_0xaa30('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaa30('0x3'));var moment=require(_0xaa30('0x4'));var BPromise=require(_0xaa30('0x5'));var Mustache=require(_0xaa30('0x6'));var util=require(_0xaa30('0x7'));var path=require(_0xaa30('0x8'));var sox=require(_0xaa30('0x9'));var csv=require('to-csv');var ejs=require(_0xaa30('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaa30('0xb'));var squel=require(_0xaa30('0xc'));var crypto=require(_0xaa30('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xaa30('0xe'));var toCsv=require(_0xaa30('0xf'));var querystring=require(_0xaa30('0x10'));var Papa=require(_0xaa30('0x11'));var Redis=require(_0xaa30('0x12'));var authService=require(_0xaa30('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa30('0x14'));var logger=require('../../config/logger')(_0xaa30('0x15'));var utils=require(_0xaa30('0x16'));var config=require(_0xaa30('0x17'));var licenseUtil=require(_0xaa30('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xec992f,_0x3de2d1){_0x3de2d1=_0x3de2d1||0xcc;return function(_0xcd1d3b){if(_0xcd1d3b){return _0xec992f['sendStatus'](_0x3de2d1);}return _0xec992f[_0xaa30('0x19')](_0x3de2d1)[_0xaa30('0x1a')]();};}function respondWithResult(_0x25c02e,_0x14de74){_0x14de74=_0x14de74||0xc8;return function(_0x41f1d9){if(_0x41f1d9){return _0x25c02e[_0xaa30('0x19')](_0x14de74)[_0xaa30('0x1b')](_0x41f1d9);}};}function respondWithFilteredResult(_0x3b8095,_0x2e37af){return function(_0xfae724){if(_0xfae724){var _0x519518=typeof _0x2e37af[_0xaa30('0x1c')]==='undefined'&&typeof _0x2e37af['limit']===_0xaa30('0x1d');var _0x153939=_0xfae724[_0xaa30('0x1e')];var _0x540e36=_0x519518?0x0:_0x2e37af['offset'];var _0x53f9fd=_0x519518?_0xfae724[_0xaa30('0x1e')]:_0x2e37af['offset']+_0x2e37af[_0xaa30('0x1f')];var _0x332a0a;if(_0x53f9fd>=_0x153939){_0x53f9fd=_0x153939;_0x332a0a=0xc8;}else{_0x332a0a=0xce;}_0x3b8095['status'](_0x332a0a);return _0x3b8095['set']('Content-Range',_0x540e36+'-'+_0x53f9fd+'/'+_0x153939)[_0xaa30('0x1b')](_0xfae724);}return null;};}function patchUpdates(_0x3e4f1d){return function(_0x61b85){try{jsonpatch[_0xaa30('0x20')](_0x61b85,_0x3e4f1d,!![]);}catch(_0x43a526){return BPromise['reject'](_0x43a526);}return _0x61b85[_0xaa30('0x21')]();};}function saveUpdates(_0x24bb25,_0x2e16e7){return function(_0x2d9e35){if(_0x2d9e35){return _0x2d9e35[_0xaa30('0x22')](_0x24bb25)['then'](function(_0x325b42){return _0x325b42;});}return null;};}function removeEntity(_0x13128a,_0x2fecdd){return function(_0x326f84){if(_0x326f84){return _0x326f84['destroy']()[_0xaa30('0x23')](function(){_0x13128a[_0xaa30('0x19')](0xcc)[_0xaa30('0x1a')]();});}};}function handleEntityNotFound(_0x12da2f,_0x97b038){return function(_0x2a59ce){if(!_0x2a59ce){_0x12da2f['sendStatus'](0x194);}return _0x2a59ce;};}function handleError(_0x467850,_0x465701){_0x465701=_0x465701||0x1f4;return function(_0x5d4da8){logger[_0xaa30('0x24')](_0x5d4da8['stack']);if(_0x5d4da8[_0xaa30('0x25')]){delete _0x5d4da8[_0xaa30('0x25')];}_0x467850[_0xaa30('0x19')](_0x465701)[_0xaa30('0x26')](_0x5d4da8);};}exports[_0xaa30('0x27')]=function(_0xc10b8f,_0x6ff09a){var _0x39f708={},_0x1f288c={},_0x43fb30={'count':0x0,'rows':[]};var _0x44aa9b=_[_0xaa30('0x28')](db[_0xaa30('0x29')][_0xaa30('0x2a')],function(_0x40e4ee){return{'name':_0x40e4ee[_0xaa30('0x2b')],'type':_0x40e4ee[_0xaa30('0x2c')][_0xaa30('0x2d')]};});_0x1f288c['model']=_[_0xaa30('0x28')](_0x44aa9b,_0xaa30('0x25'));_0x1f288c[_0xaa30('0x2e')]=_[_0xaa30('0x2f')](_0xc10b8f[_0xaa30('0x2e')]);_0x1f288c[_0xaa30('0x30')]=_['intersection'](_0x1f288c['model'],_0x1f288c['query']);_0x39f708[_0xaa30('0x31')]=_[_0xaa30('0x32')](_0x1f288c[_0xaa30('0x33')],qs[_0xaa30('0x34')](_0xc10b8f[_0xaa30('0x2e')]['fields']));_0x39f708['attributes']=_0x39f708[_0xaa30('0x31')][_0xaa30('0x35')]?_0x39f708['attributes']:_0x1f288c[_0xaa30('0x33')];if(!_0xc10b8f['query'][_0xaa30('0x36')]('nolimit')){_0x39f708[_0xaa30('0x1f')]=qs[_0xaa30('0x1f')](_0xc10b8f['query'][_0xaa30('0x1f')]);_0x39f708[_0xaa30('0x1c')]=qs[_0xaa30('0x1c')](_0xc10b8f[_0xaa30('0x2e')][_0xaa30('0x1c')]);}_0x39f708[_0xaa30('0x37')]=qs['sort'](_0xc10b8f[_0xaa30('0x2e')][_0xaa30('0x38')]);_0x39f708['where']=qs[_0xaa30('0x30')](_[_0xaa30('0x39')](_0xc10b8f[_0xaa30('0x2e')],_0x1f288c['filters']),_0x44aa9b);if(_0xc10b8f['query'][_0xaa30('0x3a')]){_0x39f708[_0xaa30('0x3b')]=_[_0xaa30('0x3c')](_0x39f708[_0xaa30('0x3b')],{'$or':_[_0xaa30('0x28')](_0x44aa9b,function(_0x291854){if(_0x291854['type']!=='VIRTUAL'){var _0x120c43={};_0x120c43[_0x291854[_0xaa30('0x25')]]={'$like':'%'+_0xc10b8f[_0xaa30('0x2e')]['filter']+'%'};return _0x120c43;}})});}_0x39f708=_[_0xaa30('0x3c')]({},_0x39f708,_0xc10b8f[_0xaa30('0x3d')]);var _0x8fb95e={'where':_0x39f708[_0xaa30('0x3b')]};return db['MailQueueReport'][_0xaa30('0x1e')](_0x8fb95e)[_0xaa30('0x23')](function(_0x2c5ddb){_0x43fb30[_0xaa30('0x1e')]=_0x2c5ddb;if(_0xc10b8f[_0xaa30('0x2e')]['includeAll']){_0x39f708[_0xaa30('0x3e')]=[{'all':!![]}];}return db[_0xaa30('0x29')][_0xaa30('0x3f')](_0x39f708);})[_0xaa30('0x23')](function(_0x13f08f){_0x43fb30[_0xaa30('0x40')]=_0x13f08f;return _0x43fb30;})[_0xaa30('0x23')](respondWithFilteredResult(_0x6ff09a,_0x39f708))[_0xaa30('0x41')](handleError(_0x6ff09a,null));};exports['show']=function(_0x59ef25,_0x18771d){var _0x4a170a={'raw':!![],'where':{'id':_0x59ef25['params']['id']}},_0x5208f8={};_0x5208f8[_0xaa30('0x33')]=_['keys'](db[_0xaa30('0x29')]['rawAttributes']);_0x5208f8[_0xaa30('0x2e')]=_[_0xaa30('0x2f')](_0x59ef25[_0xaa30('0x2e')]);_0x5208f8[_0xaa30('0x30')]=_[_0xaa30('0x32')](_0x5208f8[_0xaa30('0x33')],_0x5208f8[_0xaa30('0x2e')]);_0x4a170a[_0xaa30('0x31')]=_[_0xaa30('0x32')](_0x5208f8[_0xaa30('0x33')],qs[_0xaa30('0x34')](_0x59ef25['query'][_0xaa30('0x34')]));_0x4a170a[_0xaa30('0x31')]=_0x4a170a[_0xaa30('0x31')][_0xaa30('0x35')]?_0x4a170a[_0xaa30('0x31')]:_0x5208f8['model'];if(_0x59ef25['query'][_0xaa30('0x42')]){_0x4a170a['include']=[{'all':!![]}];}_0x4a170a=_[_0xaa30('0x3c')]({},_0x4a170a,_0x59ef25[_0xaa30('0x3d')]);return db[_0xaa30('0x29')][_0xaa30('0x43')](_0x4a170a)[_0xaa30('0x23')](handleEntityNotFound(_0x18771d,null))[_0xaa30('0x23')](respondWithResult(_0x18771d,null))[_0xaa30('0x41')](handleError(_0x18771d,null));};exports['create']=function(_0x3cf0bb,_0x6c9da6){return db[_0xaa30('0x29')]['create'](_0x3cf0bb[_0xaa30('0x44')],{})[_0xaa30('0x23')](respondWithResult(_0x6c9da6,0xc9))['catch'](handleError(_0x6c9da6,null));};exports[_0xaa30('0x22')]=function(_0x4a8fcc,_0x25d227){if(_0x4a8fcc['body']['id']){delete _0x4a8fcc['body']['id'];}return db[_0xaa30('0x29')]['find']({'where':{'id':_0x4a8fcc['params']['id']}})[_0xaa30('0x23')](handleEntityNotFound(_0x25d227,null))[_0xaa30('0x23')](saveUpdates(_0x4a8fcc[_0xaa30('0x44')],null))[_0xaa30('0x23')](respondWithResult(_0x25d227,null))[_0xaa30('0x41')](handleError(_0x25d227,null));};exports[_0xaa30('0x45')]=function(_0x5616cd,_0x17d75d){return db[_0xaa30('0x29')][_0xaa30('0x43')]({'where':{'id':_0x5616cd['params']['id']}})['then'](handleEntityNotFound(_0x17d75d,null))['then'](removeEntity(_0x17d75d,null))['catch'](handleError(_0x17d75d,null));};exports[_0xaa30('0x46')]=function(_0x1ba164,_0xdc32bc){return db[_0xaa30('0x29')][_0xaa30('0x46')]()[_0xaa30('0x23')](respondWithResult(_0xdc32bc,null))['catch'](handleError(_0xdc32bc,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 2ae135f..d03fd89 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 _0xf0c7=['rimraf','../../config/environment','./mailQueueReport.attributes','exports','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x4a97e3,_0x5632c3){var _0x970f92=function(_0x3b57d2){while(--_0x3b57d2){_0x4a97e3['push'](_0x4a97e3['shift']());}};_0x970f92(++_0x5632c3);}(_0xf0c7,0x1c1));var _0x7f0c=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xf0c7[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7f0c('0x0'));var util=require(_0x7f0c('0x1'));var logger=require(_0x7f0c('0x2'))(_0x7f0c('0x3'));var moment=require('moment');var BPromise=require(_0x7f0c('0x4'));var rp=require(_0x7f0c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7f0c('0x6'));var config=require(_0x7f0c('0x7'));var attributes=require(_0x7f0c('0x8'));module[_0x7f0c('0x9')]=function(_0x1ec1af,_0x5d864a){return _0x1ec1af['define'](_0x7f0c('0xa'),attributes,{'tableName':_0x7f0c('0xb'),'paranoid':![],'indexes':[{'name':_0x7f0c('0xc'),'fields':[_0x7f0c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6ceb=['./mailQueueReport.attributes','exports','define','lodash','util','../../config/logger','bluebird','path'];(function(_0x34e4a0,_0x1fd446){var _0x3ead3e=function(_0x47adec){while(--_0x47adec){_0x34e4a0['push'](_0x34e4a0['shift']());}};_0x3ead3e(++_0x1fd446);}(_0x6ceb,0x83));var _0xb6ce=function(_0x55aa2a,_0x4e6df6){_0x55aa2a=_0x55aa2a-0x0;var _0x324703=_0x6ceb[_0x55aa2a];return _0x324703;};'use strict';var _=require(_0xb6ce('0x0'));var util=require(_0xb6ce('0x1'));var logger=require(_0xb6ce('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb6ce('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb6ce('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb6ce('0x5'));module[_0xb6ce('0x6')]=function(_0x46df53,_0x53e7c1){return _0x46df53[_0xb6ce('0x7')]('MailQueueReport',attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 357dc17..4226e76 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(_0x50b16c,_0x5e9cce){var _0x4e939a=function(_0x9f560){while(--_0x9f560){_0x50b16c['push'](_0x50b16c['shift']());}};_0x4e939a(++_0x5e9cce);}(_0x2ef3,0xba));var _0x32ef=function(_0x3398dc,_0x2f15ef){_0x3398dc=_0x3398dc-0x0;var _0x50b66e=_0x2ef3[_0x3398dc];return _0x50b66e;};'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 _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0x6498d8,_0x532448){var _0x1e4469=function(_0x35a373){while(--_0x35a373){_0x6498d8['push'](_0x6498d8['shift']());}};_0x1e4469(++_0x532448);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xc4aa[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index f7a29f2..02d0f65 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x108d68,_0x9b39de){var _0x11476a=function(_0x21cc20){while(--_0x21cc20){_0x108d68['push'](_0x108d68['shift']());}};_0x11476a(++_0x9b39de);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x337a5c,_0xc2e30){var _0x4eed23=function(_0x6b5863){while(--_0x6b5863){_0x337a5c['push'](_0x337a5c['shift']());}};_0x4eed23(++_0xc2e30);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3e6d5d,_0x264c7a){_0x3e6d5d=_0x3e6d5d-0x0;var _0x238923=_0xcb91[_0x3e6d5d];return _0x238923;};'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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 1b1c8db..583b22c 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 _0xf038=['exports','STRING','BOOLEAN','INTEGER','INBOX','sequelize'];(function(_0x9abfa5,_0xf64fec){var _0x14514c=function(_0x4a3596){while(--_0x4a3596){_0x9abfa5['push'](_0x9abfa5['shift']());}};_0x14514c(++_0xf64fec);}(_0xf038,0x1f1));var _0x8f03=function(_0xf34109,_0x380779){_0xf34109=_0xf34109-0x0;var _0x570bfc=_0xf038[_0xf34109];return _0x570bfc;};'use strict';var Sequelize=require(_0x8f03('0x0'));module[_0x8f03('0x1')]={'description':{'type':Sequelize[_0x8f03('0x2')]},'host':{'type':Sequelize[_0x8f03('0x2')]},'authentication':{'type':Sequelize[_0x8f03('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x8f03('0x2')]},'password':{'type':Sequelize[_0x8f03('0x2')]},'port':{'type':Sequelize[_0x8f03('0x4')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x8f03('0x2')],'defaultValue':_0x8f03('0x5')},'connTimeout':{'type':Sequelize[_0x8f03('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x8f03('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x8f03('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x0886=['INBOX','sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x35cb4b,_0x1216dc){var _0x173ea3=function(_0x4f5fa9){while(--_0x4f5fa9){_0x35cb4b['push'](_0x35cb4b['shift']());}};_0x173ea3(++_0x1216dc);}(_0x0886,0x73));var _0x6088=function(_0x2557ba,_0x2376f2){_0x2557ba=_0x2557ba-0x0;var _0x42a750=_0x0886[_0x2557ba];return _0x42a750;};'use strict';var Sequelize=require(_0x6088('0x0'));module[_0x6088('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x6088('0x2')]},'authentication':{'type':Sequelize[_0x6088('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x6088('0x2')]},'password':{'type':Sequelize[_0x6088('0x2')]},'port':{'type':Sequelize[_0x6088('0x4')]},'tls':{'type':Sequelize[_0x6088('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x6088('0x2')],'defaultValue':_0x6088('0x5')},'connTimeout':{'type':Sequelize[_0x6088('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x6088('0x2')]},'modernAuthentication':{'type':Sequelize[_0x6088('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 173ce7a..19e2ecf 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 _0x67ab=['define','mail_servers_in','lodash','../../config/logger','moment','request-promise','path','rimraf','./mailServerIn.attributes'];(function(_0x328db0,_0x19d1fa){var _0x4f6d29=function(_0x549b66){while(--_0x549b66){_0x328db0['push'](_0x328db0['shift']());}};_0x4f6d29(++_0x19d1fa);}(_0x67ab,0x1d6));var _0xb67a=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x67ab[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xb67a('0x0'));var util=require('util');var logger=require(_0xb67a('0x1'))('api');var moment=require(_0xb67a('0x2'));var BPromise=require('bluebird');var rp=require(_0xb67a('0x3'));var fs=require('fs');var path=require(_0xb67a('0x4'));var rimraf=require(_0xb67a('0x5'));var config=require('../../config/environment');var attributes=require(_0xb67a('0x6'));module['exports']=function(_0x39d8d6,_0x3c9767){return _0x39d8d6[_0xb67a('0x7')]('MailServerIn',attributes,{'tableName':_0xb67a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf21=['MailServerIn','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define'];(function(_0xfbcd52,_0x5917aa){var _0x1afcee=function(_0x51e4d4){while(--_0x51e4d4){_0xfbcd52['push'](_0xfbcd52['shift']());}};_0x1afcee(++_0x5917aa);}(_0xcf21,0xaa));var _0x1cf2=function(_0x21db46,_0x5d6ab6){_0x21db46=_0x21db46-0x0;var _0x5a45d2=_0xcf21[_0x21db46];return _0x5a45d2;};'use strict';var _=require(_0x1cf2('0x0'));var util=require(_0x1cf2('0x1'));var logger=require(_0x1cf2('0x2'))(_0x1cf2('0x3'));var moment=require(_0x1cf2('0x4'));var BPromise=require('bluebird');var rp=require(_0x1cf2('0x5'));var fs=require('fs');var path=require(_0x1cf2('0x6'));var rimraf=require(_0x1cf2('0x7'));var config=require(_0x1cf2('0x8'));var attributes=require(_0x1cf2('0x9'));module[_0x1cf2('0xa')]=function(_0x354d66,_0x5e09d9){return _0x354d66[_0x1cf2('0xb')](_0x1cf2('0xc'),attributes,{'tableName':'mail_servers_in','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 512ba8b..719ced1 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 _0x8f73=['stringify','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','where','attributes','limit','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s'];(function(_0x227cce,_0x46477b){var _0x339dfb=function(_0x43ef09){while(--_0x43ef09){_0x227cce['push'](_0x227cce['shift']());}};_0x339dfb(++_0x46477b);}(_0x8f73,0x79));var _0x38f7=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x8f73[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x38f7('0x0'));var util=require(_0x38f7('0x1'));var moment=require(_0x38f7('0x2'));var BPromise=require(_0x38f7('0x3'));var rs=require(_0x38f7('0x4'));var fs=require('fs');var Redis=require(_0x38f7('0x5'));var db=require(_0x38f7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x38f7('0x7'))(_0x38f7('0x8'));var config=require(_0x38f7('0x9'));var jayson=require(_0x38f7('0xa'));var client=jayson[_0x38f7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45b75c,_0x3eb954,_0x5aad6b){return new BPromise(function(_0x46180e,_0x440dd9){return client[_0x38f7('0xc')](_0x45b75c,_0x5aad6b)[_0x38f7('0xd')](function(_0x51bb42){logger[_0x38f7('0xe')](_0x38f7('0xf'),_0x3eb954,_0x38f7('0x10'));logger[_0x38f7('0x11')](_0x38f7('0x12'),_0x3eb954,'request\x20sent',JSON[_0x38f7('0x13')](_0x51bb42));if(_0x51bb42[_0x38f7('0x14')]){if(_0x51bb42[_0x38f7('0x14')][_0x38f7('0x15')]===0x1f4){logger[_0x38f7('0x14')]('MailServerIn,\x20%s,\x20%s',_0x3eb954,_0x51bb42[_0x38f7('0x14')][_0x38f7('0x16')]);return _0x440dd9(_0x51bb42[_0x38f7('0x14')][_0x38f7('0x16')]);}logger[_0x38f7('0x14')](_0x38f7('0xf'),_0x3eb954,_0x51bb42['error']['message']);return _0x46180e(_0x51bb42[_0x38f7('0x14')]['message']);}else{logger[_0x38f7('0xe')]('MailServerIn,\x20%s,\x20%s',_0x3eb954,_0x38f7('0x10'));_0x46180e(_0x51bb42[_0x38f7('0x17')]['message']);}})[_0x38f7('0x18')](function(_0x399af2){logger[_0x38f7('0x14')](_0x38f7('0xf'),_0x3eb954,_0x399af2);_0x440dd9(_0x399af2);});});}exports[_0x38f7('0x19')]=function(_0x213776){var _0x54898e=this;return new Promise(function(_0x250877,_0x2d0950){return db[_0x38f7('0x1a')][_0x38f7('0x1b')]({'raw':_0x213776[_0x38f7('0x1c')]?_0x213776['options']['raw']===undefined?!![]:![]:!![],'where':_0x213776[_0x38f7('0x1c')]?_0x213776[_0x38f7('0x1c')][_0x38f7('0x1d')]||null:null,'attributes':_0x213776['options']?_0x213776[_0x38f7('0x1c')][_0x38f7('0x1e')]||null:null,'limit':_0x213776[_0x38f7('0x1c')]?_0x213776[_0x38f7('0x1c')][_0x38f7('0x1f')]||null:null,'include':_0x213776['options']?_0x213776[_0x38f7('0x1c')][_0x38f7('0x20')]?_[_0x38f7('0x21')](_0x213776[_0x38f7('0x1c')][_0x38f7('0x20')],function(_0x26d0e6){return{'model':db[_0x26d0e6[_0x38f7('0x22')]],'as':_0x26d0e6['as'],'attributes':_0x26d0e6[_0x38f7('0x1e')],'include':_0x26d0e6[_0x38f7('0x20')]?_['map'](_0x26d0e6['include'],function(_0x37c09e){return{'model':db[_0x37c09e[_0x38f7('0x22')]],'as':_0x37c09e['as'],'attributes':_0x37c09e[_0x38f7('0x1e')],'include':_0x37c09e['include']?_[_0x38f7('0x21')](_0x37c09e[_0x38f7('0x20')],function(_0x25903c){return{'model':db[_0x25903c[_0x38f7('0x22')]],'as':_0x25903c['as'],'attributes':_0x25903c['attributes']};}):[]};}):[]};}):[]:[]})[_0x38f7('0xd')](function(_0x5b41df){logger[_0x38f7('0xe')]('GetMailServerIn',_0x213776);logger[_0x38f7('0x11')](_0x38f7('0x19'),_0x213776,JSON[_0x38f7('0x13')](_0x5b41df));_0x250877(_0x5b41df);})[_0x38f7('0x18')](function(_0x426314){logger[_0x38f7('0x14')](_0x38f7('0x19'),_0x426314[_0x38f7('0x16')],_0x213776);_0x2d0950(_0x54898e[_0x38f7('0x14')](0x1f4,_0x426314[_0x38f7('0x16')]));});});}; \ No newline at end of file +var _0x705f=['request','then','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','findAll','options','where','limit','include','map','model','attributes','GetMailServerIn','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x422ad6,_0x1b6dfe){var _0x2b125f=function(_0x465716){while(--_0x465716){_0x422ad6['push'](_0x422ad6['shift']());}};_0x2b125f(++_0x1b6dfe);}(_0x705f,0x75));var _0xf705=function(_0x25bb9d,_0x4f12cc){_0x25bb9d=_0x25bb9d-0x0;var _0x5e7a45=_0x705f[_0x25bb9d];return _0x5e7a45;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf705('0x0'));var BPromise=require('bluebird');var rs=require(_0xf705('0x1'));var fs=require('fs');var Redis=require(_0xf705('0x2'));var db=require(_0xf705('0x3'))['db'];var utils=require(_0xf705('0x4'));var logger=require(_0xf705('0x5'))(_0xf705('0x6'));var config=require(_0xf705('0x7'));var jayson=require(_0xf705('0x8'));var client=jayson[_0xf705('0x9')][_0xf705('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32c99d,_0x48eb92,_0x51fda8){return new BPromise(function(_0xc244e3,_0x58cae9){return client[_0xf705('0xb')](_0x32c99d,_0x51fda8)[_0xf705('0xc')](function(_0x4f3226){logger['info'](_0xf705('0xd'),_0x48eb92,_0xf705('0xe'));logger[_0xf705('0xf')](_0xf705('0x10'),_0x48eb92,_0xf705('0xe'),JSON[_0xf705('0x11')](_0x4f3226));if(_0x4f3226[_0xf705('0x12')]){if(_0x4f3226[_0xf705('0x12')]['code']===0x1f4){logger[_0xf705('0x12')](_0xf705('0xd'),_0x48eb92,_0x4f3226[_0xf705('0x12')][_0xf705('0x13')]);return _0x58cae9(_0x4f3226[_0xf705('0x12')]['message']);}logger['error'](_0xf705('0xd'),_0x48eb92,_0x4f3226[_0xf705('0x12')][_0xf705('0x13')]);return _0xc244e3(_0x4f3226[_0xf705('0x12')]['message']);}else{logger[_0xf705('0x14')](_0xf705('0xd'),_0x48eb92,_0xf705('0xe'));_0xc244e3(_0x4f3226[_0xf705('0x15')]['message']);}})[_0xf705('0x16')](function(_0x479b31){logger[_0xf705('0x12')](_0xf705('0xd'),_0x48eb92,_0x479b31);_0x58cae9(_0x479b31);});});}exports['GetMailServerIn']=function(_0xa9a2ca){var _0x5cb9e1=this;return new Promise(function(_0x425cd6,_0x5c05ae){return db['MailServerIn'][_0xf705('0x17')]({'raw':_0xa9a2ca[_0xf705('0x18')]?_0xa9a2ca[_0xf705('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xa9a2ca[_0xf705('0x18')]?_0xa9a2ca[_0xf705('0x18')][_0xf705('0x19')]||null:null,'attributes':_0xa9a2ca['options']?_0xa9a2ca[_0xf705('0x18')]['attributes']||null:null,'limit':_0xa9a2ca['options']?_0xa9a2ca[_0xf705('0x18')][_0xf705('0x1a')]||null:null,'include':_0xa9a2ca[_0xf705('0x18')]?_0xa9a2ca[_0xf705('0x18')][_0xf705('0x1b')]?_[_0xf705('0x1c')](_0xa9a2ca[_0xf705('0x18')][_0xf705('0x1b')],function(_0x424d4e){return{'model':db[_0x424d4e[_0xf705('0x1d')]],'as':_0x424d4e['as'],'attributes':_0x424d4e[_0xf705('0x1e')],'include':_0x424d4e['include']?_[_0xf705('0x1c')](_0x424d4e['include'],function(_0x23bb4a){return{'model':db[_0x23bb4a['model']],'as':_0x23bb4a['as'],'attributes':_0x23bb4a['attributes'],'include':_0x23bb4a[_0xf705('0x1b')]?_[_0xf705('0x1c')](_0x23bb4a['include'],function(_0x4f5435){return{'model':db[_0x4f5435[_0xf705('0x1d')]],'as':_0x4f5435['as'],'attributes':_0x4f5435[_0xf705('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf705('0xc')](function(_0xabee0){logger[_0xf705('0x14')]('GetMailServerIn',_0xa9a2ca);logger[_0xf705('0xf')](_0xf705('0x1f'),_0xa9a2ca,JSON[_0xf705('0x11')](_0xabee0));_0x425cd6(_0xabee0);})['catch'](function(_0x4a09ab){logger['error']('GetMailServerIn',_0x4a09ab[_0xf705('0x13')],_0xa9a2ca);_0x5c05ae(_0x5cb9e1['error'](0x1f4,_0x4a09ab['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 60cd988..c6b2cc2 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x7a54,0x106));var _0x47a5=function(_0x3432e4,_0x541de6){_0x3432e4=_0x3432e4-0x0;var _0x5725d1=_0x7a54[_0x3432e4];return _0x5725d1;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _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(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_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('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 d0f094c..1d63975 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 _0x9c00=['sequelize','exports','STRING','BOOLEAN'];(function(_0x5df4b0,_0x1b42f2){var _0x2f9d20=function(_0x23784c){while(--_0x23784c){_0x5df4b0['push'](_0x5df4b0['shift']());}};_0x2f9d20(++_0x1b42f2);}(_0x9c00,0x1a0));var _0x09c0=function(_0x1af05b,_0x5134b5){_0x1af05b=_0x1af05b-0x0;var _0x5be7cc=_0x9c00[_0x1af05b];return _0x5be7cc;};'use strict';var Sequelize=require(_0x09c0('0x0'));module[_0x09c0('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x09c0('0x2')]},'pass':{'type':Sequelize[_0x09c0('0x2')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x09c0('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x09c0('0x2')]},'authentication':{'type':Sequelize[_0x09c0('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x09c0('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x351d=['sequelize','STRING','INTEGER','BOOLEAN'];(function(_0x1bebfc,_0x45143c){var _0xcce855=function(_0x3e1514){while(--_0x3e1514){_0x1bebfc['push'](_0x1bebfc['shift']());}};_0xcce855(++_0x45143c);}(_0x351d,0x90));var _0xd351=function(_0x43f150,_0x342996){_0x43f150=_0x43f150-0x0;var _0x299a7d=_0x351d[_0x43f150];return _0x299a7d;};'use strict';var Sequelize=require(_0xd351('0x0'));module['exports']={'description':{'type':Sequelize[_0xd351('0x1')]},'host':{'type':Sequelize[_0xd351('0x1')]},'user':{'type':Sequelize[_0xd351('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xd351('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0xd351('0x1')]},'authentication':{'type':Sequelize[_0xd351('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 7a009de..01a9406 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 _0x7d08=['stack','name','index','map','MailServerOut','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x7d08,0x198));var _0x87d0=function(_0x3a82a3,_0xc1079c){_0x3a82a3=_0x3a82a3-0x0;var _0xd0d138=_0x7d08[_0x3a82a3];return _0xd0d138;};'use strict';var emlformat=require(_0x87d0('0x0'));var rimraf=require(_0x87d0('0x1'));var zipdir=require(_0x87d0('0x2'));var jsonpatch=require(_0x87d0('0x3'));var rp=require('request-promise');var moment=require(_0x87d0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x87d0('0x5'));var util=require(_0x87d0('0x6'));var path=require(_0x87d0('0x7'));var sox=require(_0x87d0('0x8'));var csv=require('to-csv');var ejs=require(_0x87d0('0x9'));var fs=require('fs');var fs_extra=require(_0x87d0('0xa'));var _=require(_0x87d0('0xb'));var squel=require(_0x87d0('0xc'));var crypto=require(_0x87d0('0xd'));var jsforce=require(_0x87d0('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x87d0('0xf'));var Papa=require(_0x87d0('0x10'));var Redis=require(_0x87d0('0x11'));var authService=require(_0x87d0('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x87d0('0x13'));var hardwareService=require(_0x87d0('0x14'));var logger=require(_0x87d0('0x15'))(_0x87d0('0x16'));var utils=require(_0x87d0('0x17'));var config=require(_0x87d0('0x18'));var licenseUtil=require(_0x87d0('0x19'));var db=require(_0x87d0('0x1a'))['db'];function respondWithStatusCode(_0x1b97ff,_0x4c7801){_0x4c7801=_0x4c7801||0xcc;return function(_0xaf67aa){if(_0xaf67aa){return _0x1b97ff[_0x87d0('0x1b')](_0x4c7801);}return _0x1b97ff[_0x87d0('0x1c')](_0x4c7801)[_0x87d0('0x1d')]();};}function respondWithResult(_0x1810b1,_0x423c49){_0x423c49=_0x423c49||0xc8;return function(_0x298048){if(_0x298048){return _0x1810b1[_0x87d0('0x1c')](_0x423c49)[_0x87d0('0x1e')](_0x298048);}};}function respondWithFilteredResult(_0x3566b8,_0x2a3f8f){return function(_0xe0a510){if(_0xe0a510){var _0x506877=typeof _0x2a3f8f[_0x87d0('0x1f')]===_0x87d0('0x20')&&typeof _0x2a3f8f[_0x87d0('0x21')]==='undefined';var _0x427f86=_0xe0a510[_0x87d0('0x22')];var _0x560aaf=_0x506877?0x0:_0x2a3f8f[_0x87d0('0x1f')];var _0x4d8571=_0x506877?_0xe0a510[_0x87d0('0x22')]:_0x2a3f8f[_0x87d0('0x1f')]+_0x2a3f8f[_0x87d0('0x21')];var _0x397e00;if(_0x4d8571>=_0x427f86){_0x4d8571=_0x427f86;_0x397e00=0xc8;}else{_0x397e00=0xce;}_0x3566b8[_0x87d0('0x1c')](_0x397e00);return _0x3566b8[_0x87d0('0x23')]('Content-Range',_0x560aaf+'-'+_0x4d8571+'/'+_0x427f86)['json'](_0xe0a510);}return null;};}function patchUpdates(_0x1c97ab){return function(_0x3bc0e3){try{jsonpatch[_0x87d0('0x24')](_0x3bc0e3,_0x1c97ab,!![]);}catch(_0x90ed5c){return BPromise[_0x87d0('0x25')](_0x90ed5c);}return _0x3bc0e3['save']();};}function saveUpdates(_0x1748a9,_0x28d9c6){return function(_0x20323f){if(_0x20323f){return _0x20323f[_0x87d0('0x26')](_0x1748a9)[_0x87d0('0x27')](function(_0x44498a){return _0x44498a;});}return null;};}function removeEntity(_0x5886be,_0x4db2c7){return function(_0x3699a5){if(_0x3699a5){return _0x3699a5[_0x87d0('0x28')]()[_0x87d0('0x27')](function(){_0x5886be['status'](0xcc)[_0x87d0('0x1d')]();});}};}function handleEntityNotFound(_0x44a3bc,_0x4ed6dc){return function(_0x31eaba){if(!_0x31eaba){_0x44a3bc[_0x87d0('0x1b')](0x194);}return _0x31eaba;};}function handleError(_0x2d1c5e,_0x4440c1){_0x4440c1=_0x4440c1||0x1f4;return function(_0x56bec9){logger[_0x87d0('0x29')](_0x56bec9[_0x87d0('0x2a')]);if(_0x56bec9[_0x87d0('0x2b')]){delete _0x56bec9[_0x87d0('0x2b')];}_0x2d1c5e[_0x87d0('0x1c')](_0x4440c1)['send'](_0x56bec9);};}exports[_0x87d0('0x2c')]=function(_0x3d5807,_0x408b6e){var _0x564bcb={},_0x341615={},_0x2e10a1={'count':0x0,'rows':[]};var _0x11fc32=_[_0x87d0('0x2d')](db[_0x87d0('0x2e')][_0x87d0('0x2f')],function(_0x222ae6){return{'name':_0x222ae6[_0x87d0('0x30')],'type':_0x222ae6[_0x87d0('0x31')][_0x87d0('0x32')]};});_0x341615[_0x87d0('0x33')]=_[_0x87d0('0x2d')](_0x11fc32,_0x87d0('0x2b'));_0x341615['query']=_[_0x87d0('0x34')](_0x3d5807['query']);_0x341615[_0x87d0('0x35')]=_[_0x87d0('0x36')](_0x341615['model'],_0x341615[_0x87d0('0x37')]);_0x564bcb[_0x87d0('0x38')]=_[_0x87d0('0x36')](_0x341615[_0x87d0('0x33')],qs[_0x87d0('0x39')](_0x3d5807['query'][_0x87d0('0x39')]));_0x564bcb[_0x87d0('0x38')]=_0x564bcb[_0x87d0('0x38')][_0x87d0('0x3a')]?_0x564bcb[_0x87d0('0x38')]:_0x341615['model'];if(!_0x3d5807[_0x87d0('0x37')][_0x87d0('0x3b')]('nolimit')){_0x564bcb[_0x87d0('0x21')]=qs[_0x87d0('0x21')](_0x3d5807[_0x87d0('0x37')][_0x87d0('0x21')]);_0x564bcb[_0x87d0('0x1f')]=qs['offset'](_0x3d5807['query']['offset']);}_0x564bcb['order']=qs[_0x87d0('0x3c')](_0x3d5807[_0x87d0('0x37')][_0x87d0('0x3c')]);_0x564bcb['where']=qs[_0x87d0('0x35')](_['pick'](_0x3d5807['query'],_0x341615[_0x87d0('0x35')]),_0x11fc32);if(_0x3d5807[_0x87d0('0x37')][_0x87d0('0x3d')]){_0x564bcb[_0x87d0('0x3e')]=_[_0x87d0('0x3f')](_0x564bcb['where'],{'$or':_[_0x87d0('0x2d')](_0x11fc32,function(_0x7d4be0){if(_0x7d4be0[_0x87d0('0x31')]!==_0x87d0('0x40')){var _0x5c0f04={};_0x5c0f04[_0x7d4be0[_0x87d0('0x2b')]]={'$like':'%'+_0x3d5807[_0x87d0('0x37')]['filter']+'%'};return _0x5c0f04;}})});}_0x564bcb=_['merge']({},_0x564bcb,_0x3d5807[_0x87d0('0x41')]);var _0x2abafe={'where':_0x564bcb[_0x87d0('0x3e')]};return db[_0x87d0('0x2e')]['count'](_0x2abafe)['then'](function(_0x4ac5ad){_0x2e10a1[_0x87d0('0x22')]=_0x4ac5ad;if(_0x3d5807[_0x87d0('0x37')][_0x87d0('0x42')]){_0x564bcb[_0x87d0('0x43')]=[{'all':!![]}];}return db[_0x87d0('0x2e')][_0x87d0('0x44')](_0x564bcb);})[_0x87d0('0x27')](function(_0xedc900){_0x2e10a1[_0x87d0('0x45')]=_0xedc900;return _0x2e10a1;})[_0x87d0('0x27')](respondWithFilteredResult(_0x408b6e,_0x564bcb))['catch'](handleError(_0x408b6e,null));};exports[_0x87d0('0x46')]=function(_0x3addd2,_0x2a20a8){var _0x8333f1={'raw':!![],'where':{'id':_0x3addd2[_0x87d0('0x47')]['id']}},_0x4737ce={};_0x4737ce['model']=_['keys'](db[_0x87d0('0x2e')]['rawAttributes']);_0x4737ce[_0x87d0('0x37')]=_[_0x87d0('0x34')](_0x3addd2[_0x87d0('0x37')]);_0x4737ce[_0x87d0('0x35')]=_['intersection'](_0x4737ce['model'],_0x4737ce[_0x87d0('0x37')]);_0x8333f1['attributes']=_['intersection'](_0x4737ce[_0x87d0('0x33')],qs['fields'](_0x3addd2[_0x87d0('0x37')][_0x87d0('0x39')]));_0x8333f1['attributes']=_0x8333f1[_0x87d0('0x38')][_0x87d0('0x3a')]?_0x8333f1[_0x87d0('0x38')]:_0x4737ce[_0x87d0('0x33')];if(_0x3addd2[_0x87d0('0x37')][_0x87d0('0x42')]){_0x8333f1['include']=[{'all':!![]}];}_0x8333f1=_[_0x87d0('0x3f')]({},_0x8333f1,_0x3addd2[_0x87d0('0x41')]);return db[_0x87d0('0x2e')][_0x87d0('0x48')](_0x8333f1)[_0x87d0('0x27')](handleEntityNotFound(_0x2a20a8,null))['then'](respondWithResult(_0x2a20a8,null))[_0x87d0('0x49')](handleError(_0x2a20a8,null));};exports['create']=function(_0x6ac8b8,_0x223b7a){return db[_0x87d0('0x2e')]['create'](_0x6ac8b8[_0x87d0('0x4a')],{})['then'](respondWithResult(_0x223b7a,0xc9))[_0x87d0('0x49')](handleError(_0x223b7a,null));};exports[_0x87d0('0x26')]=function(_0xb16a4b,_0x25352f){if(_0xb16a4b[_0x87d0('0x4a')]['id']){delete _0xb16a4b['body']['id'];}return db[_0x87d0('0x2e')][_0x87d0('0x48')]({'where':{'id':_0xb16a4b['params']['id']}})['then'](handleEntityNotFound(_0x25352f,null))[_0x87d0('0x27')](saveUpdates(_0xb16a4b[_0x87d0('0x4a')],null))['then'](respondWithResult(_0x25352f,null))[_0x87d0('0x49')](handleError(_0x25352f,null));};exports['destroy']=function(_0x10ae3d,_0x3e5fbb){return db[_0x87d0('0x2e')][_0x87d0('0x48')]({'where':{'id':_0x10ae3d[_0x87d0('0x47')]['id']}})['then'](handleEntityNotFound(_0x3e5fbb,null))[_0x87d0('0x27')](removeEntity(_0x3e5fbb,null))[_0x87d0('0x49')](handleError(_0x3e5fbb,null));}; \ No newline at end of file +var _0xbc78=['merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','then','destroy','error','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x2cacef,_0xba1573){var _0x289ba6=function(_0x4ac8b9){while(--_0x4ac8b9){_0x2cacef['push'](_0x2cacef['shift']());}};_0x289ba6(++_0xba1573);}(_0xbc78,0x1bc));var _0x8bc7=function(_0x37d6b9,_0x203c2b){_0x37d6b9=_0x37d6b9-0x0;var _0x402e11=_0xbc78[_0x37d6b9];return _0x402e11;};'use strict';var emlformat=require(_0x8bc7('0x0'));var rimraf=require(_0x8bc7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8bc7('0x2'));var rp=require('request-promise');var moment=require(_0x8bc7('0x3'));var BPromise=require(_0x8bc7('0x4'));var Mustache=require(_0x8bc7('0x5'));var util=require(_0x8bc7('0x6'));var path=require(_0x8bc7('0x7'));var sox=require(_0x8bc7('0x8'));var csv=require('to-csv');var ejs=require(_0x8bc7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8bc7('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8bc7('0xb'));var deskjs=require(_0x8bc7('0xc'));var toCsv=require(_0x8bc7('0xd'));var querystring=require('querystring');var Papa=require(_0x8bc7('0xe'));var Redis=require('ioredis');var authService=require(_0x8bc7('0xf'));var qs=require(_0x8bc7('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8bc7('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x8bc7('0x12'));var licenseUtil=require(_0x8bc7('0x13'));var db=require(_0x8bc7('0x14'))['db'];function respondWithStatusCode(_0x4c19ba,_0x30b55c){_0x30b55c=_0x30b55c||0xcc;return function(_0x4dee7d){if(_0x4dee7d){return _0x4c19ba[_0x8bc7('0x15')](_0x30b55c);}return _0x4c19ba['status'](_0x30b55c)[_0x8bc7('0x16')]();};}function respondWithResult(_0x578513,_0x4ea573){_0x4ea573=_0x4ea573||0xc8;return function(_0x19f0d0){if(_0x19f0d0){return _0x578513[_0x8bc7('0x17')](_0x4ea573)[_0x8bc7('0x18')](_0x19f0d0);}};}function respondWithFilteredResult(_0x44b9d6,_0x598114){return function(_0x429b33){if(_0x429b33){var _0xef3204=typeof _0x598114['offset']==='undefined'&&typeof _0x598114[_0x8bc7('0x19')]===_0x8bc7('0x1a');var _0x25ccb7=_0x429b33[_0x8bc7('0x1b')];var _0x3eb1b=_0xef3204?0x0:_0x598114[_0x8bc7('0x1c')];var _0x37262b=_0xef3204?_0x429b33[_0x8bc7('0x1b')]:_0x598114[_0x8bc7('0x1c')]+_0x598114[_0x8bc7('0x19')];var _0x5849fc;if(_0x37262b>=_0x25ccb7){_0x37262b=_0x25ccb7;_0x5849fc=0xc8;}else{_0x5849fc=0xce;}_0x44b9d6['status'](_0x5849fc);return _0x44b9d6[_0x8bc7('0x1d')](_0x8bc7('0x1e'),_0x3eb1b+'-'+_0x37262b+'/'+_0x25ccb7)[_0x8bc7('0x18')](_0x429b33);}return null;};}function patchUpdates(_0x10df6b){return function(_0x5308ed){try{jsonpatch['apply'](_0x5308ed,_0x10df6b,!![]);}catch(_0x116f14){return BPromise[_0x8bc7('0x1f')](_0x116f14);}return _0x5308ed[_0x8bc7('0x20')]();};}function saveUpdates(_0x185f00,_0x92c40b){return function(_0x4360f0){if(_0x4360f0){return _0x4360f0[_0x8bc7('0x21')](_0x185f00)[_0x8bc7('0x22')](function(_0x38cc46){return _0x38cc46;});}return null;};}function removeEntity(_0x5d925e,_0xe8e7f5){return function(_0xfe064e){if(_0xfe064e){return _0xfe064e[_0x8bc7('0x23')]()[_0x8bc7('0x22')](function(){_0x5d925e[_0x8bc7('0x17')](0xcc)[_0x8bc7('0x16')]();});}};}function handleEntityNotFound(_0x4deff0,_0x39ff50){return function(_0x326eb7){if(!_0x326eb7){_0x4deff0[_0x8bc7('0x15')](0x194);}return _0x326eb7;};}function handleError(_0x5381b1,_0x4bfe59){_0x4bfe59=_0x4bfe59||0x1f4;return function(_0x4c91ab){logger[_0x8bc7('0x24')](_0x4c91ab['stack']);if(_0x4c91ab[_0x8bc7('0x25')]){delete _0x4c91ab[_0x8bc7('0x25')];}_0x5381b1[_0x8bc7('0x17')](_0x4bfe59)[_0x8bc7('0x26')](_0x4c91ab);};}exports[_0x8bc7('0x27')]=function(_0x26a756,_0xfabb26){var _0x44c1fc={},_0x2367a4={},_0x29618b={'count':0x0,'rows':[]};var _0x52eaee=_[_0x8bc7('0x28')](db[_0x8bc7('0x29')][_0x8bc7('0x2a')],function(_0x30203c){return{'name':_0x30203c[_0x8bc7('0x2b')],'type':_0x30203c[_0x8bc7('0x2c')]['key']};});_0x2367a4[_0x8bc7('0x2d')]=_[_0x8bc7('0x28')](_0x52eaee,_0x8bc7('0x25'));_0x2367a4[_0x8bc7('0x2e')]=_[_0x8bc7('0x2f')](_0x26a756[_0x8bc7('0x2e')]);_0x2367a4[_0x8bc7('0x30')]=_[_0x8bc7('0x31')](_0x2367a4[_0x8bc7('0x2d')],_0x2367a4[_0x8bc7('0x2e')]);_0x44c1fc[_0x8bc7('0x32')]=_['intersection'](_0x2367a4[_0x8bc7('0x2d')],qs['fields'](_0x26a756[_0x8bc7('0x2e')][_0x8bc7('0x33')]));_0x44c1fc[_0x8bc7('0x32')]=_0x44c1fc[_0x8bc7('0x32')][_0x8bc7('0x34')]?_0x44c1fc[_0x8bc7('0x32')]:_0x2367a4['model'];if(!_0x26a756[_0x8bc7('0x2e')][_0x8bc7('0x35')](_0x8bc7('0x36'))){_0x44c1fc[_0x8bc7('0x19')]=qs[_0x8bc7('0x19')](_0x26a756[_0x8bc7('0x2e')][_0x8bc7('0x19')]);_0x44c1fc['offset']=qs['offset'](_0x26a756[_0x8bc7('0x2e')][_0x8bc7('0x1c')]);}_0x44c1fc[_0x8bc7('0x37')]=qs['sort'](_0x26a756[_0x8bc7('0x2e')][_0x8bc7('0x38')]);_0x44c1fc[_0x8bc7('0x39')]=qs[_0x8bc7('0x30')](_[_0x8bc7('0x3a')](_0x26a756[_0x8bc7('0x2e')],_0x2367a4[_0x8bc7('0x30')]),_0x52eaee);if(_0x26a756[_0x8bc7('0x2e')][_0x8bc7('0x3b')]){_0x44c1fc['where']=_[_0x8bc7('0x3c')](_0x44c1fc[_0x8bc7('0x39')],{'$or':_['map'](_0x52eaee,function(_0x16b3a7){if(_0x16b3a7[_0x8bc7('0x2c')]!==_0x8bc7('0x3d')){var _0x6b3744={};_0x6b3744[_0x16b3a7[_0x8bc7('0x25')]]={'$like':'%'+_0x26a756[_0x8bc7('0x2e')]['filter']+'%'};return _0x6b3744;}})});}_0x44c1fc=_[_0x8bc7('0x3c')]({},_0x44c1fc,_0x26a756[_0x8bc7('0x3e')]);var _0x230e1b={'where':_0x44c1fc[_0x8bc7('0x39')]};return db['MailServerOut'][_0x8bc7('0x1b')](_0x230e1b)['then'](function(_0x29af89){_0x29618b[_0x8bc7('0x1b')]=_0x29af89;if(_0x26a756[_0x8bc7('0x2e')][_0x8bc7('0x3f')]){_0x44c1fc[_0x8bc7('0x40')]=[{'all':!![]}];}return db['MailServerOut'][_0x8bc7('0x41')](_0x44c1fc);})[_0x8bc7('0x22')](function(_0x50334e){_0x29618b[_0x8bc7('0x42')]=_0x50334e;return _0x29618b;})[_0x8bc7('0x22')](respondWithFilteredResult(_0xfabb26,_0x44c1fc))[_0x8bc7('0x43')](handleError(_0xfabb26,null));};exports['show']=function(_0x1252ad,_0x13bf3e){var _0x21cf1a={'raw':!![],'where':{'id':_0x1252ad[_0x8bc7('0x44')]['id']}},_0x34b75c={};_0x34b75c[_0x8bc7('0x2d')]=_['keys'](db[_0x8bc7('0x29')][_0x8bc7('0x2a')]);_0x34b75c[_0x8bc7('0x2e')]=_[_0x8bc7('0x2f')](_0x1252ad[_0x8bc7('0x2e')]);_0x34b75c['filters']=_[_0x8bc7('0x31')](_0x34b75c['model'],_0x34b75c['query']);_0x21cf1a[_0x8bc7('0x32')]=_[_0x8bc7('0x31')](_0x34b75c[_0x8bc7('0x2d')],qs[_0x8bc7('0x33')](_0x1252ad[_0x8bc7('0x2e')][_0x8bc7('0x33')]));_0x21cf1a[_0x8bc7('0x32')]=_0x21cf1a[_0x8bc7('0x32')][_0x8bc7('0x34')]?_0x21cf1a[_0x8bc7('0x32')]:_0x34b75c['model'];if(_0x1252ad[_0x8bc7('0x2e')][_0x8bc7('0x3f')]){_0x21cf1a[_0x8bc7('0x40')]=[{'all':!![]}];}_0x21cf1a=_[_0x8bc7('0x3c')]({},_0x21cf1a,_0x1252ad[_0x8bc7('0x3e')]);return db['MailServerOut'][_0x8bc7('0x45')](_0x21cf1a)[_0x8bc7('0x22')](handleEntityNotFound(_0x13bf3e,null))['then'](respondWithResult(_0x13bf3e,null))['catch'](handleError(_0x13bf3e,null));};exports[_0x8bc7('0x46')]=function(_0xc4750,_0x1d3b37){return db[_0x8bc7('0x29')][_0x8bc7('0x46')](_0xc4750[_0x8bc7('0x47')],{})[_0x8bc7('0x22')](respondWithResult(_0x1d3b37,0xc9))[_0x8bc7('0x43')](handleError(_0x1d3b37,null));};exports['update']=function(_0x3a05e2,_0x41a640){if(_0x3a05e2[_0x8bc7('0x47')]['id']){delete _0x3a05e2[_0x8bc7('0x47')]['id'];}return db['MailServerOut'][_0x8bc7('0x45')]({'where':{'id':_0x3a05e2[_0x8bc7('0x44')]['id']}})[_0x8bc7('0x22')](handleEntityNotFound(_0x41a640,null))[_0x8bc7('0x22')](saveUpdates(_0x3a05e2['body'],null))[_0x8bc7('0x22')](respondWithResult(_0x41a640,null))[_0x8bc7('0x43')](handleError(_0x41a640,null));};exports[_0x8bc7('0x23')]=function(_0x1d38c5,_0x339aff){return db[_0x8bc7('0x29')][_0x8bc7('0x45')]({'where':{'id':_0x1d38c5[_0x8bc7('0x44')]['id']}})['then'](handleEntityNotFound(_0x339aff,null))[_0x8bc7('0x22')](removeEntity(_0x339aff,null))[_0x8bc7('0x43')](handleError(_0x339aff,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index c3df822..d5a9d5a 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 _0x9d1b=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','define','MailServerOut','mail_servers_out'];(function(_0x4f786f,_0x49fcb9){var _0x366181=function(_0x25adf2){while(--_0x25adf2){_0x4f786f['push'](_0x4f786f['shift']());}};_0x366181(++_0x49fcb9);}(_0x9d1b,0x13f));var _0xb9d1=function(_0x405aeb,_0x5ee732){_0x405aeb=_0x405aeb-0x0;var _0x50e76a=_0x9d1b[_0x405aeb];return _0x50e76a;};'use strict';var _=require(_0xb9d1('0x0'));var util=require(_0xb9d1('0x1'));var logger=require('../../config/logger')(_0xb9d1('0x2'));var moment=require(_0xb9d1('0x3'));var BPromise=require(_0xb9d1('0x4'));var rp=require(_0xb9d1('0x5'));var fs=require('fs');var path=require(_0xb9d1('0x6'));var rimraf=require('rimraf');var config=require(_0xb9d1('0x7'));var attributes=require('./mailServerOut.attributes');module['exports']=function(_0xc27026,_0xf0b98a){return _0xc27026[_0xb9d1('0x8')](_0xb9d1('0x9'),attributes,{'tableName':_0xb9d1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x934c=['rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','util','bluebird'];(function(_0x58ccde,_0x907fac){var _0x4152ae=function(_0x40cb85){while(--_0x40cb85){_0x58ccde['push'](_0x58ccde['shift']());}};_0x4152ae(++_0x907fac);}(_0x934c,0x1c6));var _0xc934=function(_0x44761a,_0x38a274){_0x44761a=_0x44761a-0x0;var _0x22e1c3=_0x934c[_0x44761a];return _0x22e1c3;};'use strict';var _=require('lodash');var util=require(_0xc934('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc934('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc934('0x2'));var config=require(_0xc934('0x3'));var attributes=require(_0xc934('0x4'));module[_0xc934('0x5')]=function(_0x35c945,_0x279a66){return _0x35c945[_0xc934('0x6')](_0xc934('0x7'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index adc8b30..42b1d4a 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x3797d9,_0x1ce1c7){var _0x2d1c0d=function(_0xbc5158){while(--_0xbc5158){_0x3797d9['push'](_0x3797d9['shift']());}};_0x2d1c0d(++_0x1ce1c7);}(_0x2ef3,0xba));var _0x32ef=function(_0x25466c,_0x32f639){_0x25466c=_0x25466c-0x0;var _0x1a8770=_0x2ef3[_0x25466c];return _0x1a8770;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0x1261=['then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x1ee0bc,_0x7249cf){var _0x214e6a=function(_0x10e0d6){while(--_0x10e0d6){_0x1ee0bc['push'](_0x1ee0bc['shift']());}};_0x214e6a(++_0x7249cf);}(_0x1261,0x144));var _0x1126=function(_0x262c39,_0x14b574){_0x262c39=_0x262c39-0x0;var _0x371d00=_0x1261[_0x262c39];return _0x371d00;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailServerOut,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 80552d4..02a4cc5 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 _0x40ff=['connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','destroy','exports','util','path'];(function(_0x16d36d,_0x30c31d){var _0xd6454d=function(_0x572fe7){while(--_0x572fe7){_0x16d36d['push'](_0x16d36d['shift']());}};_0xd6454d(++_0x30c31d);}(_0x40ff,0x12e));var _0xf40f=function(_0x4ca87e,_0x4962a2){_0x4ca87e=_0x4ca87e-0x0;var _0x5c71ad=_0x40ff[_0x4ca87e];return _0x5c71ad;};'use strict';var multer=require('multer');var util=require(_0xf40f('0x0'));var path=require(_0xf40f('0x1'));var timeout=require(_0xf40f('0x2'));var express=require(_0xf40f('0x3'));var router=express['Router']();var fs_extra=require(_0xf40f('0x4'));var auth=require(_0xf40f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf40f('0x6'));var controller=require('./mailSubstatus.controller');router[_0xf40f('0x7')]('/',auth[_0xf40f('0x8')](),controller[_0xf40f('0x9')]);router[_0xf40f('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xf40f('0xa')]);router[_0xf40f('0x7')](_0xf40f('0xb'),auth['isAuthenticated'](),controller[_0xf40f('0xc')]);router[_0xf40f('0xd')]('/',auth[_0xf40f('0x8')](),controller[_0xf40f('0xe')]);router[_0xf40f('0xf')](_0xf40f('0xb'),auth[_0xf40f('0x8')](),controller[_0xf40f('0x10')]);router['delete'](_0xf40f('0xb'),auth[_0xf40f('0x8')](),controller[_0xf40f('0x11')]);module[_0xf40f('0x12')]=router; \ No newline at end of file +var _0xbcff=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','index','get','/describe','/:id','show','post','create','put','delete','destroy','exports','multer'];(function(_0x2a61bd,_0x2168a5){var _0x43b93b=function(_0x2901f9){while(--_0x2901f9){_0x2a61bd['push'](_0x2a61bd['shift']());}};_0x43b93b(++_0x2168a5);}(_0xbcff,0x133));var _0xfbcf=function(_0x4c66d0,_0x4d4eec){_0x4c66d0=_0x4c66d0-0x0;var _0x499d1e=_0xbcff[_0x4c66d0];return _0x499d1e;};'use strict';var multer=require(_0xfbcf('0x0'));var util=require(_0xfbcf('0x1'));var path=require(_0xfbcf('0x2'));var timeout=require(_0xfbcf('0x3'));var express=require(_0xfbcf('0x4'));var router=express[_0xfbcf('0x5')]();var fs_extra=require(_0xfbcf('0x6'));var auth=require(_0xfbcf('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xfbcf('0x8'));var controller=require(_0xfbcf('0x9'));router['get']('/',auth[_0xfbcf('0xa')](),controller[_0xfbcf('0xb')]);router[_0xfbcf('0xc')](_0xfbcf('0xd'),auth[_0xfbcf('0xa')](),controller['describe']);router[_0xfbcf('0xc')](_0xfbcf('0xe'),auth[_0xfbcf('0xa')](),controller[_0xfbcf('0xf')]);router[_0xfbcf('0x10')]('/',auth[_0xfbcf('0xa')](),controller[_0xfbcf('0x11')]);router[_0xfbcf('0x12')](_0xfbcf('0xe'),auth[_0xfbcf('0xa')](),controller['update']);router[_0xfbcf('0x13')](_0xfbcf('0xe'),auth[_0xfbcf('0xa')](),controller[_0xfbcf('0x14')]);module[_0xfbcf('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 2cea00f..a842552 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 _0xc359=['name','STRING','exports'];(function(_0x29313f,_0x234b48){var _0x35b18b=function(_0xf4cc3c){while(--_0xf4cc3c){_0x29313f['push'](_0x29313f['shift']());}};_0x35b18b(++_0x234b48);}(_0xc359,0x1d9));var _0x9c35=function(_0x4990d5,_0xe2c486){_0x4990d5=_0x4990d5-0x0;var _0x275e25=_0xc359[_0x4990d5];return _0x275e25;};'use strict';var Sequelize=require('sequelize');module[_0x9c35('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x9c35('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9c35('0x2')]}}; \ No newline at end of file +var _0x8ca9=['sequelize','exports','STRING','name'];(function(_0x409deb,_0x2b731){var _0x15a4f7=function(_0x556510){while(--_0x556510){_0x409deb['push'](_0x409deb['shift']());}};_0x15a4f7(++_0x2b731);}(_0x8ca9,0x9c));var _0x98ca=function(_0x53ceb6,_0xcd75fe){_0x53ceb6=_0x53ceb6-0x0;var _0x5832d0=_0x8ca9[_0x53ceb6];return _0x5832d0;};'use strict';var Sequelize=require(_0x98ca('0x0'));module[_0x98ca('0x1')]={'name':{'type':Sequelize[_0x98ca('0x2')],'unique':_0x98ca('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x98ca('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 0f5ab26..b38e1bd 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 _0xd564=['describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','sendStatus','error','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','includeAll','include','findAll','rows','show','params','options','catch','create','body','find'];(function(_0xd908b,_0x53186a){var _0x65f18f=function(_0x153000){while(--_0x153000){_0xd908b['push'](_0xd908b['shift']());}};_0x65f18f(++_0x53186a);}(_0xd564,0xa1));var _0x4d56=function(_0x5eec49,_0x424f3d){_0x5eec49=_0x5eec49-0x0;var _0x1b31b8=_0xd564[_0x5eec49];return _0x1b31b8;};'use strict';var emlformat=require(_0x4d56('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4d56('0x1'));var jsonpatch=require(_0x4d56('0x2'));var rp=require(_0x4d56('0x3'));var moment=require(_0x4d56('0x4'));var BPromise=require(_0x4d56('0x5'));var Mustache=require(_0x4d56('0x6'));var util=require(_0x4d56('0x7'));var path=require(_0x4d56('0x8'));var sox=require(_0x4d56('0x9'));var csv=require(_0x4d56('0xa'));var ejs=require(_0x4d56('0xb'));var fs=require('fs');var fs_extra=require(_0x4d56('0xc'));var _=require(_0x4d56('0xd'));var squel=require(_0x4d56('0xe'));var crypto=require(_0x4d56('0xf'));var jsforce=require(_0x4d56('0x10'));var deskjs=require(_0x4d56('0x11'));var toCsv=require(_0x4d56('0xa'));var querystring=require(_0x4d56('0x12'));var Papa=require(_0x4d56('0x13'));var Redis=require('ioredis');var authService=require(_0x4d56('0x14'));var qs=require(_0x4d56('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4d56('0x16'));var logger=require(_0x4d56('0x17'))('api');var utils=require(_0x4d56('0x18'));var config=require(_0x4d56('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x4d56('0x1a'))['db'];function respondWithStatusCode(_0x2e12f5,_0x1155a2){_0x1155a2=_0x1155a2||0xcc;return function(_0x575113){if(_0x575113){return _0x2e12f5['sendStatus'](_0x1155a2);}return _0x2e12f5[_0x4d56('0x1b')](_0x1155a2)['end']();};}function respondWithResult(_0x4c48a1,_0x61ea85){_0x61ea85=_0x61ea85||0xc8;return function(_0x2314a1){if(_0x2314a1){return _0x4c48a1[_0x4d56('0x1b')](_0x61ea85)[_0x4d56('0x1c')](_0x2314a1);}};}function respondWithFilteredResult(_0x4aba08,_0x558a66){return function(_0x3b357b){if(_0x3b357b){var _0x12a405=typeof _0x558a66[_0x4d56('0x1d')]===_0x4d56('0x1e')&&typeof _0x558a66[_0x4d56('0x1f')]===_0x4d56('0x1e');var _0x145b28=_0x3b357b[_0x4d56('0x20')];var _0x106589=_0x12a405?0x0:_0x558a66[_0x4d56('0x1d')];var _0x5aed44=_0x12a405?_0x3b357b['count']:_0x558a66['offset']+_0x558a66[_0x4d56('0x1f')];var _0x30ea77;if(_0x5aed44>=_0x145b28){_0x5aed44=_0x145b28;_0x30ea77=0xc8;}else{_0x30ea77=0xce;}_0x4aba08[_0x4d56('0x1b')](_0x30ea77);return _0x4aba08[_0x4d56('0x21')](_0x4d56('0x22'),_0x106589+'-'+_0x5aed44+'/'+_0x145b28)[_0x4d56('0x1c')](_0x3b357b);}return null;};}function patchUpdates(_0x43756d){return function(_0x32fc8b){try{jsonpatch['apply'](_0x32fc8b,_0x43756d,!![]);}catch(_0x17b555){return BPromise[_0x4d56('0x23')](_0x17b555);}return _0x32fc8b[_0x4d56('0x24')]();};}function saveUpdates(_0x43a869,_0x5cf607){return function(_0x245e85){if(_0x245e85){return _0x245e85[_0x4d56('0x25')](_0x43a869)[_0x4d56('0x26')](function(_0x5bfa1f){return _0x5bfa1f;});}return null;};}function removeEntity(_0x16a8b6,_0x5080af){return function(_0x35c146){if(_0x35c146){return _0x35c146[_0x4d56('0x27')]()['then'](function(){_0x16a8b6['status'](0xcc)[_0x4d56('0x28')]();});}};}function handleEntityNotFound(_0x2427b3,_0xc83233){return function(_0x203dfe){if(!_0x203dfe){_0x2427b3[_0x4d56('0x29')](0x194);}return _0x203dfe;};}function handleError(_0x5f98cb,_0x1ebde0){_0x1ebde0=_0x1ebde0||0x1f4;return function(_0x5b3867){logger[_0x4d56('0x2a')](_0x5b3867['stack']);if(_0x5b3867[_0x4d56('0x2b')]){delete _0x5b3867[_0x4d56('0x2b')];}_0x5f98cb[_0x4d56('0x1b')](_0x1ebde0)[_0x4d56('0x2c')](_0x5b3867);};}exports[_0x4d56('0x2d')]=function(_0x2cb8ab,_0x1c4cd7){var _0x37d6a8={},_0x38e10d={},_0x4349ee={'count':0x0,'rows':[]};var _0x283f27=_[_0x4d56('0x2e')](db[_0x4d56('0x2f')][_0x4d56('0x30')],function(_0x179798){return{'name':_0x179798[_0x4d56('0x31')],'type':_0x179798[_0x4d56('0x32')][_0x4d56('0x33')]};});_0x38e10d[_0x4d56('0x34')]=_[_0x4d56('0x2e')](_0x283f27,_0x4d56('0x2b'));_0x38e10d[_0x4d56('0x35')]=_[_0x4d56('0x36')](_0x2cb8ab[_0x4d56('0x35')]);_0x38e10d['filters']=_[_0x4d56('0x37')](_0x38e10d[_0x4d56('0x34')],_0x38e10d[_0x4d56('0x35')]);_0x37d6a8[_0x4d56('0x38')]=_[_0x4d56('0x37')](_0x38e10d['model'],qs[_0x4d56('0x39')](_0x2cb8ab['query'][_0x4d56('0x39')]));_0x37d6a8[_0x4d56('0x38')]=_0x37d6a8[_0x4d56('0x38')][_0x4d56('0x3a')]?_0x37d6a8[_0x4d56('0x38')]:_0x38e10d[_0x4d56('0x34')];if(!_0x2cb8ab[_0x4d56('0x35')][_0x4d56('0x3b')](_0x4d56('0x3c'))){_0x37d6a8['limit']=qs[_0x4d56('0x1f')](_0x2cb8ab['query']['limit']);_0x37d6a8[_0x4d56('0x1d')]=qs[_0x4d56('0x1d')](_0x2cb8ab[_0x4d56('0x35')][_0x4d56('0x1d')]);}_0x37d6a8[_0x4d56('0x3d')]=qs[_0x4d56('0x3e')](_0x2cb8ab['query'][_0x4d56('0x3e')]);_0x37d6a8['where']=qs[_0x4d56('0x3f')](_[_0x4d56('0x40')](_0x2cb8ab[_0x4d56('0x35')],_0x38e10d[_0x4d56('0x3f')]),_0x283f27);if(_0x2cb8ab[_0x4d56('0x35')][_0x4d56('0x41')]){_0x37d6a8[_0x4d56('0x42')]=_[_0x4d56('0x43')](_0x37d6a8[_0x4d56('0x42')],{'$or':_[_0x4d56('0x2e')](_0x283f27,function(_0x5d2c1f){if(_0x5d2c1f[_0x4d56('0x32')]!=='VIRTUAL'){var _0x403422={};_0x403422[_0x5d2c1f['name']]={'$like':'%'+_0x2cb8ab['query'][_0x4d56('0x41')]+'%'};return _0x403422;}})});}_0x37d6a8=_[_0x4d56('0x43')]({},_0x37d6a8,_0x2cb8ab['options']);var _0x2d8f29={'where':_0x37d6a8['where']};return db['MailSubstatus'][_0x4d56('0x20')](_0x2d8f29)[_0x4d56('0x26')](function(_0x50c48f){_0x4349ee[_0x4d56('0x20')]=_0x50c48f;if(_0x2cb8ab[_0x4d56('0x35')][_0x4d56('0x44')]){_0x37d6a8[_0x4d56('0x45')]=[{'all':!![]}];}return db[_0x4d56('0x2f')][_0x4d56('0x46')](_0x37d6a8);})[_0x4d56('0x26')](function(_0x43a8cf){_0x4349ee[_0x4d56('0x47')]=_0x43a8cf;return _0x4349ee;})[_0x4d56('0x26')](respondWithFilteredResult(_0x1c4cd7,_0x37d6a8))['catch'](handleError(_0x1c4cd7,null));};exports[_0x4d56('0x48')]=function(_0x1b8bea,_0x1b873c){var _0x2564e8={'raw':!![],'where':{'id':_0x1b8bea[_0x4d56('0x49')]['id']}},_0xb24f75={};_0xb24f75[_0x4d56('0x34')]=_[_0x4d56('0x36')](db['MailSubstatus'][_0x4d56('0x30')]);_0xb24f75[_0x4d56('0x35')]=_[_0x4d56('0x36')](_0x1b8bea[_0x4d56('0x35')]);_0xb24f75[_0x4d56('0x3f')]=_[_0x4d56('0x37')](_0xb24f75[_0x4d56('0x34')],_0xb24f75[_0x4d56('0x35')]);_0x2564e8[_0x4d56('0x38')]=_[_0x4d56('0x37')](_0xb24f75[_0x4d56('0x34')],qs[_0x4d56('0x39')](_0x1b8bea[_0x4d56('0x35')][_0x4d56('0x39')]));_0x2564e8[_0x4d56('0x38')]=_0x2564e8[_0x4d56('0x38')][_0x4d56('0x3a')]?_0x2564e8[_0x4d56('0x38')]:_0xb24f75[_0x4d56('0x34')];if(_0x1b8bea[_0x4d56('0x35')][_0x4d56('0x44')]){_0x2564e8['include']=[{'all':!![]}];}_0x2564e8=_[_0x4d56('0x43')]({},_0x2564e8,_0x1b8bea[_0x4d56('0x4a')]);return db[_0x4d56('0x2f')]['find'](_0x2564e8)[_0x4d56('0x26')](handleEntityNotFound(_0x1b873c,null))[_0x4d56('0x26')](respondWithResult(_0x1b873c,null))[_0x4d56('0x4b')](handleError(_0x1b873c,null));};exports[_0x4d56('0x4c')]=function(_0x3694c2,_0x22ac32){return db[_0x4d56('0x2f')][_0x4d56('0x4c')](_0x3694c2[_0x4d56('0x4d')],{})[_0x4d56('0x26')](respondWithResult(_0x22ac32,0xc9))[_0x4d56('0x4b')](handleError(_0x22ac32,null));};exports[_0x4d56('0x25')]=function(_0x508f39,_0x8d31d2){if(_0x508f39['body']['id']){delete _0x508f39[_0x4d56('0x4d')]['id'];}return db[_0x4d56('0x2f')][_0x4d56('0x4e')]({'where':{'id':_0x508f39[_0x4d56('0x49')]['id']}})[_0x4d56('0x26')](handleEntityNotFound(_0x8d31d2,null))[_0x4d56('0x26')](saveUpdates(_0x508f39['body'],null))[_0x4d56('0x26')](respondWithResult(_0x8d31d2,null))[_0x4d56('0x4b')](handleError(_0x8d31d2,null));};exports[_0x4d56('0x27')]=function(_0xe8a0c0,_0x1d778b){return db[_0x4d56('0x2f')][_0x4d56('0x4e')]({'where':{'id':_0xe8a0c0[_0x4d56('0x49')]['id']}})[_0x4d56('0x26')](handleEntityNotFound(_0x1d778b,null))[_0x4d56('0x26')](removeEntity(_0x1d778b,null))[_0x4d56('0x4b')](handleError(_0x1d778b,null));};exports[_0x4d56('0x4f')]=function(_0x19d98a,_0x57eacb){return db['MailSubstatus'][_0x4d56('0x4f')]()[_0x4d56('0x26')](respondWithResult(_0x57eacb,null))[_0x4d56('0x4b')](handleError(_0x57eacb,null));}; \ No newline at end of file +var _0x0a76=['status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','then','destroy','stack','name','MailSubstatus','rawAttributes','fieldName','type','key','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','findAll','catch','show','params','model','includeAll','include','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus'];(function(_0x228f16,_0x3f2ff7){var _0x5597ff=function(_0x482b07){while(--_0x482b07){_0x228f16['push'](_0x228f16['shift']());}};_0x5597ff(++_0x3f2ff7);}(_0x0a76,0x1a1));var _0x60a7=function(_0x274d1a,_0x1a4f13){_0x274d1a=_0x274d1a-0x0;var _0x5c05d7=_0x0a76[_0x274d1a];return _0x5c05d7;};'use strict';var emlformat=require(_0x60a7('0x0'));var rimraf=require(_0x60a7('0x1'));var zipdir=require(_0x60a7('0x2'));var jsonpatch=require(_0x60a7('0x3'));var rp=require(_0x60a7('0x4'));var moment=require(_0x60a7('0x5'));var BPromise=require(_0x60a7('0x6'));var Mustache=require(_0x60a7('0x7'));var util=require(_0x60a7('0x8'));var path=require(_0x60a7('0x9'));var sox=require(_0x60a7('0xa'));var csv=require('to-csv');var ejs=require(_0x60a7('0xb'));var fs=require('fs');var fs_extra=require(_0x60a7('0xc'));var _=require(_0x60a7('0xd'));var squel=require(_0x60a7('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x60a7('0xf'));var toCsv=require(_0x60a7('0x10'));var querystring=require(_0x60a7('0x11'));var Papa=require(_0x60a7('0x12'));var Redis=require(_0x60a7('0x13'));var authService=require(_0x60a7('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x60a7('0x15'));var hardwareService=require(_0x60a7('0x16'));var logger=require(_0x60a7('0x17'))(_0x60a7('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x60a7('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45e9df,_0x958c90){_0x958c90=_0x958c90||0xcc;return function(_0x4d29dc){if(_0x4d29dc){return _0x45e9df[_0x60a7('0x1a')](_0x958c90);}return _0x45e9df[_0x60a7('0x1b')](_0x958c90)[_0x60a7('0x1c')]();};}function respondWithResult(_0x5f02f5,_0xb9fa82){_0xb9fa82=_0xb9fa82||0xc8;return function(_0x5972fc){if(_0x5972fc){return _0x5f02f5['status'](_0xb9fa82)['json'](_0x5972fc);}};}function respondWithFilteredResult(_0x1a0fc1,_0xc5d72a){return function(_0x3e3157){if(_0x3e3157){var _0x28a5e7=typeof _0xc5d72a['offset']===_0x60a7('0x1d')&&typeof _0xc5d72a[_0x60a7('0x1e')]==='undefined';var _0x1ec156=_0x3e3157[_0x60a7('0x1f')];var _0xe683f4=_0x28a5e7?0x0:_0xc5d72a['offset'];var _0x5ccd55=_0x28a5e7?_0x3e3157[_0x60a7('0x1f')]:_0xc5d72a[_0x60a7('0x20')]+_0xc5d72a[_0x60a7('0x1e')];var _0x559cdb;if(_0x5ccd55>=_0x1ec156){_0x5ccd55=_0x1ec156;_0x559cdb=0xc8;}else{_0x559cdb=0xce;}_0x1a0fc1[_0x60a7('0x1b')](_0x559cdb);return _0x1a0fc1['set'](_0x60a7('0x21'),_0xe683f4+'-'+_0x5ccd55+'/'+_0x1ec156)[_0x60a7('0x22')](_0x3e3157);}return null;};}function patchUpdates(_0x159152){return function(_0x35a032){try{jsonpatch[_0x60a7('0x23')](_0x35a032,_0x159152,!![]);}catch(_0x1c8172){return BPromise[_0x60a7('0x24')](_0x1c8172);}return _0x35a032['save']();};}function saveUpdates(_0x184a20,_0x41ba1b){return function(_0x5d6a56){if(_0x5d6a56){return _0x5d6a56['update'](_0x184a20)[_0x60a7('0x25')](function(_0x1a7d0f){return _0x1a7d0f;});}return null;};}function removeEntity(_0x1a9382,_0x2ab032){return function(_0x494afc){if(_0x494afc){return _0x494afc[_0x60a7('0x26')]()[_0x60a7('0x25')](function(){_0x1a9382[_0x60a7('0x1b')](0xcc)[_0x60a7('0x1c')]();});}};}function handleEntityNotFound(_0x1d9a45,_0x679948){return function(_0x56e7bb){if(!_0x56e7bb){_0x1d9a45[_0x60a7('0x1a')](0x194);}return _0x56e7bb;};}function handleError(_0x2501a9,_0xd70f5a){_0xd70f5a=_0xd70f5a||0x1f4;return function(_0x2d032a){logger['error'](_0x2d032a[_0x60a7('0x27')]);if(_0x2d032a[_0x60a7('0x28')]){delete _0x2d032a[_0x60a7('0x28')];}_0x2501a9[_0x60a7('0x1b')](_0xd70f5a)['send'](_0x2d032a);};}exports['index']=function(_0x22774a,_0x4763ee){var _0x4131bb={},_0x33cfa4={},_0x27fb36={'count':0x0,'rows':[]};var _0x2b31de=_['map'](db[_0x60a7('0x29')][_0x60a7('0x2a')],function(_0x381172){return{'name':_0x381172[_0x60a7('0x2b')],'type':_0x381172[_0x60a7('0x2c')][_0x60a7('0x2d')]};});_0x33cfa4['model']=_[_0x60a7('0x2e')](_0x2b31de,_0x60a7('0x28'));_0x33cfa4['query']=_['keys'](_0x22774a[_0x60a7('0x2f')]);_0x33cfa4[_0x60a7('0x30')]=_[_0x60a7('0x31')](_0x33cfa4['model'],_0x33cfa4['query']);_0x4131bb['attributes']=_[_0x60a7('0x31')](_0x33cfa4['model'],qs[_0x60a7('0x32')](_0x22774a[_0x60a7('0x2f')][_0x60a7('0x32')]));_0x4131bb[_0x60a7('0x33')]=_0x4131bb[_0x60a7('0x33')][_0x60a7('0x34')]?_0x4131bb[_0x60a7('0x33')]:_0x33cfa4['model'];if(!_0x22774a[_0x60a7('0x2f')][_0x60a7('0x35')](_0x60a7('0x36'))){_0x4131bb['limit']=qs[_0x60a7('0x1e')](_0x22774a[_0x60a7('0x2f')]['limit']);_0x4131bb[_0x60a7('0x20')]=qs[_0x60a7('0x20')](_0x22774a[_0x60a7('0x2f')][_0x60a7('0x20')]);}_0x4131bb[_0x60a7('0x37')]=qs[_0x60a7('0x38')](_0x22774a[_0x60a7('0x2f')]['sort']);_0x4131bb[_0x60a7('0x39')]=qs[_0x60a7('0x30')](_[_0x60a7('0x3a')](_0x22774a['query'],_0x33cfa4[_0x60a7('0x30')]),_0x2b31de);if(_0x22774a[_0x60a7('0x2f')]['filter']){_0x4131bb[_0x60a7('0x39')]=_['merge'](_0x4131bb['where'],{'$or':_['map'](_0x2b31de,function(_0xc1c844){if(_0xc1c844['type']!=='VIRTUAL'){var _0x3ae7bf={};_0x3ae7bf[_0xc1c844[_0x60a7('0x28')]]={'$like':'%'+_0x22774a[_0x60a7('0x2f')][_0x60a7('0x3b')]+'%'};return _0x3ae7bf;}})});}_0x4131bb=_[_0x60a7('0x3c')]({},_0x4131bb,_0x22774a[_0x60a7('0x3d')]);var _0x12ebbf={'where':_0x4131bb['where']};return db[_0x60a7('0x29')][_0x60a7('0x1f')](_0x12ebbf)[_0x60a7('0x25')](function(_0x42288e){_0x27fb36['count']=_0x42288e;if(_0x22774a[_0x60a7('0x2f')]['includeAll']){_0x4131bb['include']=[{'all':!![]}];}return db[_0x60a7('0x29')][_0x60a7('0x3e')](_0x4131bb);})[_0x60a7('0x25')](function(_0x1b0be7){_0x27fb36['rows']=_0x1b0be7;return _0x27fb36;})[_0x60a7('0x25')](respondWithFilteredResult(_0x4763ee,_0x4131bb))[_0x60a7('0x3f')](handleError(_0x4763ee,null));};exports[_0x60a7('0x40')]=function(_0x3dc77c,_0x84b242){var _0x189cec={'raw':!![],'where':{'id':_0x3dc77c[_0x60a7('0x41')]['id']}},_0x2f3cb2={};_0x2f3cb2['model']=_['keys'](db[_0x60a7('0x29')][_0x60a7('0x2a')]);_0x2f3cb2['query']=_['keys'](_0x3dc77c[_0x60a7('0x2f')]);_0x2f3cb2[_0x60a7('0x30')]=_['intersection'](_0x2f3cb2[_0x60a7('0x42')],_0x2f3cb2['query']);_0x189cec['attributes']=_[_0x60a7('0x31')](_0x2f3cb2[_0x60a7('0x42')],qs['fields'](_0x3dc77c[_0x60a7('0x2f')][_0x60a7('0x32')]));_0x189cec[_0x60a7('0x33')]=_0x189cec['attributes']['length']?_0x189cec[_0x60a7('0x33')]:_0x2f3cb2[_0x60a7('0x42')];if(_0x3dc77c[_0x60a7('0x2f')][_0x60a7('0x43')]){_0x189cec[_0x60a7('0x44')]=[{'all':!![]}];}_0x189cec=_['merge']({},_0x189cec,_0x3dc77c[_0x60a7('0x3d')]);return db[_0x60a7('0x29')][_0x60a7('0x45')](_0x189cec)['then'](handleEntityNotFound(_0x84b242,null))[_0x60a7('0x25')](respondWithResult(_0x84b242,null))[_0x60a7('0x3f')](handleError(_0x84b242,null));};exports[_0x60a7('0x46')]=function(_0x593a51,_0x12f94a){return db['MailSubstatus'][_0x60a7('0x46')](_0x593a51[_0x60a7('0x47')],{})[_0x60a7('0x25')](respondWithResult(_0x12f94a,0xc9))[_0x60a7('0x3f')](handleError(_0x12f94a,null));};exports[_0x60a7('0x48')]=function(_0x229a5f,_0x488990){if(_0x229a5f[_0x60a7('0x47')]['id']){delete _0x229a5f[_0x60a7('0x47')]['id'];}return db[_0x60a7('0x29')]['find']({'where':{'id':_0x229a5f[_0x60a7('0x41')]['id']}})['then'](handleEntityNotFound(_0x488990,null))['then'](saveUpdates(_0x229a5f[_0x60a7('0x47')],null))[_0x60a7('0x25')](respondWithResult(_0x488990,null))[_0x60a7('0x3f')](handleError(_0x488990,null));};exports[_0x60a7('0x26')]=function(_0x369fb8,_0x3c7fc9){return db[_0x60a7('0x29')][_0x60a7('0x45')]({'where':{'id':_0x369fb8[_0x60a7('0x41')]['id']}})[_0x60a7('0x25')](handleEntityNotFound(_0x3c7fc9,null))[_0x60a7('0x25')](removeEntity(_0x3c7fc9,null))[_0x60a7('0x3f')](handleError(_0x3c7fc9,null));};exports['describe']=function(_0x5dae39,_0x4b631c){return db[_0x60a7('0x29')][_0x60a7('0x49')]()[_0x60a7('0x25')](respondWithResult(_0x4b631c,null))[_0x60a7('0x3f')](handleError(_0x4b631c,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index ff2c99d..41fc8ca 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 _0x5963=['exports','../../mysqldb','MailSubstatus','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0x1cf19d,_0x49d381){var _0x54c278=function(_0x3b93eb){while(--_0x3b93eb){_0x1cf19d['push'](_0x1cf19d['shift']());}};_0x54c278(++_0x49d381);}(_0x5963,0x191));var _0x3596=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5963[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0x3596('0x0'))['db'][_0x3596('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x3596('0x2')](0x0);var events={'afterUpdate':_0x3596('0x3')};function emitEvent(_0x352de8){return function(_0x288307,_0x5ba08a,_0x4d4591){MailSubstatusEvents['emit'](_0x352de8+':'+_0x288307['id'],_0x288307);MailSubstatusEvents[_0x3596('0x4')](_0x352de8,_0x288307);_0x4d4591(null);};}for(var e in events){if(events[_0x3596('0x5')](e)){var event=events[e];MailSubstatus[_0x3596('0x6')](e,emitEvent(event));}}module[_0x3596('0x7')]=MailSubstatusEvents; \ No newline at end of file +var _0x6316=['hasOwnProperty','hook','events','../../mysqldb','MailSubstatus','setMaxListeners','emit'];(function(_0x118bce,_0x24eef4){var _0x1fe0a6=function(_0x3c1acd){while(--_0x3c1acd){_0x118bce['push'](_0x118bce['shift']());}};_0x1fe0a6(++_0x24eef4);}(_0x6316,0x9c));var _0x6631=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6316[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require(_0x6631('0x0'));var MailSubstatus=require(_0x6631('0x1'))['db'][_0x6631('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x6631('0x3')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0xf3c71c){return function(_0x20cc07,_0x1e1c31,_0x741d7f){MailSubstatusEvents[_0x6631('0x4')](_0xf3c71c+':'+_0x20cc07['id'],_0x20cc07);MailSubstatusEvents[_0x6631('0x4')](_0xf3c71c,_0x20cc07);_0x741d7f(null);};}for(var e in events){if(events[_0x6631('0x5')](e)){var event=events[e];MailSubstatus[_0x6631('0x6')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index eaf312e..39152f5 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 _0x74d9=['exports','models','define','mail_substatuses','Condition','update','name','_previousDataValues','then','./mailSubstatus.attributes'];(function(_0x112fe3,_0x16b642){var _0x1ec903=function(_0x1539eb){while(--_0x1539eb){_0x112fe3['push'](_0x112fe3['shift']());}};_0x1ec903(++_0x16b642);}(_0x74d9,0x81));var _0x974d=function(_0x57d71f,_0x598a0e){_0x57d71f=_0x57d71f-0x0;var _0x2d1d26=_0x74d9[_0x57d71f];return _0x2d1d26;};'use strict';var attributes=require(_0x974d('0x0'));module[_0x974d('0x1')]=function(_0x54cbc6){var _0x518b3b=_0x54cbc6[_0x974d('0x2')];return _0x54cbc6[_0x974d('0x3')]('MailSubstatus',attributes,{'tableName':_0x974d('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x2a6958,_0x106ca0,_0x2d80e4){return _0x518b3b[_0x974d('0x5')][_0x974d('0x6')]({'value':_0x2a6958[_0x974d('0x7')]},{'where':{'field':'mailSubstatus','value':_0x2a6958[_0x974d('0x8')][_0x974d('0x7')]}})[_0x974d('0x9')](function(){_0x2d80e4();})['catch'](function(_0x138cca){_0x2d80e4(_0x138cca);});}}});}; \ No newline at end of file +var _0x7155=['then','exports','models','MailSubstatus','mail_substatuses','update','_previousDataValues','name'];(function(_0x82fbee,_0x14ee26){var _0xcc86a6=function(_0x121fb0){while(--_0x121fb0){_0x82fbee['push'](_0x82fbee['shift']());}};_0xcc86a6(++_0x14ee26);}(_0x7155,0x1c1));var _0x5715=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7155[_0x3dd15e];return _0x231fd0;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x5715('0x0')]=function(_0x41634c){var _0x45c300=_0x41634c[_0x5715('0x1')];return _0x41634c['define'](_0x5715('0x2'),attributes,{'tableName':_0x5715('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x18b654,_0x482916,_0x684767){return _0x45c300['Condition'][_0x5715('0x4')]({'value':_0x18b654['name']},{'where':{'field':'mailSubstatus','value':_0x18b654[_0x5715('0x5')][_0x5715('0x6')]}})[_0x5715('0x7')](function(){_0x684767();})['catch'](function(_0x1c6454){_0x684767(_0x1c6454);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 443731e..697d89b 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 _0xf883=['MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent'];(function(_0x524ce0,_0x3670b2){var _0x38299f=function(_0x513ef4){while(--_0x513ef4){_0x524ce0['push'](_0x524ce0['shift']());}};_0x38299f(++_0x3670b2);}(_0xf883,0x177));var _0x3f88=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf883[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3f88('0x0'));var util=require(_0x3f88('0x1'));var moment=require('moment');var BPromise=require(_0x3f88('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f88('0x3'));var db=require(_0x3f88('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3f88('0x5'))(_0x3f88('0x6'));var config=require(_0x3f88('0x7'));var jayson=require(_0x3f88('0x8'));var client=jayson[_0x3f88('0x9')][_0x3f88('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x211655,_0x4ad66c,_0x513866){return new BPromise(function(_0x24fcbc,_0x223253){return client[_0x3f88('0xb')](_0x211655,_0x513866)[_0x3f88('0xc')](function(_0x4b9540){logger[_0x3f88('0xd')](_0x3f88('0xe'),_0x4ad66c,_0x3f88('0xf'));logger['debug'](_0x3f88('0x10'),_0x4ad66c,_0x3f88('0xf'),JSON[_0x3f88('0x11')](_0x4b9540));if(_0x4b9540[_0x3f88('0x12')]){if(_0x4b9540[_0x3f88('0x12')][_0x3f88('0x13')]===0x1f4){logger[_0x3f88('0x12')](_0x3f88('0xe'),_0x4ad66c,_0x4b9540[_0x3f88('0x12')][_0x3f88('0x14')]);return _0x223253(_0x4b9540[_0x3f88('0x12')][_0x3f88('0x14')]);}logger[_0x3f88('0x12')](_0x3f88('0xe'),_0x4ad66c,_0x4b9540[_0x3f88('0x12')][_0x3f88('0x14')]);return _0x24fcbc(_0x4b9540[_0x3f88('0x12')][_0x3f88('0x14')]);}else{logger[_0x3f88('0xd')](_0x3f88('0xe'),_0x4ad66c,'request\x20sent');_0x24fcbc(_0x4b9540[_0x3f88('0x15')][_0x3f88('0x14')]);}})[_0x3f88('0x16')](function(_0x1c6ea9){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x4ad66c,_0x1c6ea9);_0x223253(_0x1c6ea9);});});} \ No newline at end of file +var _0x6ec3=['MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','MailSubstatus,\x20%s,\x20%s'];(function(_0x573325,_0x2f2fa5){var _0x1987bb=function(_0x2dfffa){while(--_0x2dfffa){_0x573325['push'](_0x573325['shift']());}};_0x1987bb(++_0x2f2fa5);}(_0x6ec3,0xa7));var _0x36ec=function(_0x14f6d7,_0x29b917){_0x14f6d7=_0x14f6d7-0x0;var _0x27c4fc=_0x6ec3[_0x14f6d7];return _0x27c4fc;};'use strict';var _=require(_0x36ec('0x0'));var util=require(_0x36ec('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x36ec('0x2'));var fs=require('fs');var Redis=require(_0x36ec('0x3'));var db=require(_0x36ec('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x36ec('0x5'));var config=require(_0x36ec('0x6'));var jayson=require(_0x36ec('0x7'));var client=jayson[_0x36ec('0x8')][_0x36ec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5621f0,_0x31d5fa,_0x3a9b75){return new BPromise(function(_0x1264b3,_0x40cb82){return client['request'](_0x5621f0,_0x3a9b75)[_0x36ec('0xa')](function(_0x4a82c9){logger[_0x36ec('0xb')](_0x36ec('0xc'),_0x31d5fa,'request\x20sent');logger['debug'](_0x36ec('0xd'),_0x31d5fa,_0x36ec('0xe'),JSON[_0x36ec('0xf')](_0x4a82c9));if(_0x4a82c9[_0x36ec('0x10')]){if(_0x4a82c9['error'][_0x36ec('0x11')]===0x1f4){logger['error'](_0x36ec('0xc'),_0x31d5fa,_0x4a82c9[_0x36ec('0x10')]['message']);return _0x40cb82(_0x4a82c9[_0x36ec('0x10')][_0x36ec('0x12')]);}logger[_0x36ec('0x10')](_0x36ec('0xc'),_0x31d5fa,_0x4a82c9[_0x36ec('0x10')][_0x36ec('0x12')]);return _0x1264b3(_0x4a82c9[_0x36ec('0x10')]['message']);}else{logger[_0x36ec('0xb')](_0x36ec('0xc'),_0x31d5fa,_0x36ec('0xe'));_0x1264b3(_0x4a82c9['result'][_0x36ec('0x12')]);}})[_0x36ec('0x13')](function(_0x41ea27){logger[_0x36ec('0x10')](_0x36ec('0xc'),_0x31d5fa,_0x41ea27);_0x40cb82(_0x41ea27);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 6c06b69..1582208 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 _0x8458=['create','put','update','/:id','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','show'];(function(_0x3dd7f0,_0x5c5317){var _0x359491=function(_0x4fb088){while(--_0x4fb088){_0x3dd7f0['push'](_0x3dd7f0['shift']());}};_0x359491(++_0x5c5317);}(_0x8458,0x8a));var _0x8845=function(_0x15d011,_0x482f89){_0x15d011=_0x15d011-0x0;var _0x1f000b=_0x8458[_0x15d011];return _0x1f000b;};'use strict';var multer=require('multer');var util=require(_0x8845('0x0'));var path=require(_0x8845('0x1'));var timeout=require(_0x8845('0x2'));var express=require(_0x8845('0x3'));var router=express[_0x8845('0x4')]();var fs_extra=require(_0x8845('0x5'));var auth=require(_0x8845('0x6'));var interaction=require(_0x8845('0x7'));var config=require(_0x8845('0x8'));var controller=require(_0x8845('0x9'));router[_0x8845('0xa')]('/',auth[_0x8845('0xb')](),controller[_0x8845('0xc')]);router[_0x8845('0xa')](_0x8845('0xd'),auth[_0x8845('0xb')](),controller[_0x8845('0xe')]);router[_0x8845('0xa')]('/:id',auth[_0x8845('0xb')](),controller[_0x8845('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8845('0x10')]);router[_0x8845('0x11')]('/:id',auth[_0x8845('0xb')](),controller[_0x8845('0x12')]);router['delete'](_0x8845('0x13'),auth['isAuthenticated'](),controller[_0x8845('0x14')]);module[_0x8845('0x15')]=router; \ No newline at end of file +var _0x80f0=['multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','delete','destroy','exports'];(function(_0x264545,_0x214037){var _0x114d10=function(_0x9e3461){while(--_0x9e3461){_0x264545['push'](_0x264545['shift']());}};_0x114d10(++_0x214037);}(_0x80f0,0x17c));var _0x080f=function(_0x45b3aa,_0x28b786){_0x45b3aa=_0x45b3aa-0x0;var _0xf28f65=_0x80f0[_0x45b3aa];return _0xf28f65;};'use strict';var multer=require(_0x080f('0x0'));var util=require(_0x080f('0x1'));var path=require('path');var timeout=require(_0x080f('0x2'));var express=require('express');var router=express[_0x080f('0x3')]();var fs_extra=require(_0x080f('0x4'));var auth=require(_0x080f('0x5'));var interaction=require(_0x080f('0x6'));var config=require('../../config/environment');var controller=require('./mailTransferReport.controller');router[_0x080f('0x7')]('/',auth[_0x080f('0x8')](),controller[_0x080f('0x9')]);router[_0x080f('0x7')](_0x080f('0xa'),auth[_0x080f('0x8')](),controller[_0x080f('0xb')]);router['get'](_0x080f('0xc'),auth[_0x080f('0x8')](),controller[_0x080f('0xd')]);router[_0x080f('0xe')]('/',auth[_0x080f('0x8')](),controller['create']);router[_0x080f('0xf')]('/:id',auth[_0x080f('0x8')](),controller['update']);router[_0x080f('0x10')](_0x080f('0xc'),auth[_0x080f('0x8')](),controller[_0x080f('0x11')]);module[_0x080f('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index eda5d50..b3a0684 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x4d45f1,_0xe45462){var _0x467097=function(_0x3bf0c6){while(--_0x3bf0c6){_0x4d45f1['push'](_0x4d45f1['shift']());}};_0x467097(++_0xe45462);}(_0xaa88,0x137));var _0x8aa8=function(_0x1a37e3,_0x5db8f6){_0x1a37e3=_0x1a37e3-0x0;var _0x4db78a=_0xaa88[_0x1a37e3];return _0x4db78a;};'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(_0x32e594,_0x57e75e){var _0x56514f=function(_0x5b9cb0){while(--_0x5b9cb0){_0x32e594['push'](_0x32e594['shift']());}};_0x56514f(++_0x57e75e);}(_0xaa88,0x137));var _0x8aa8=function(_0x37e845,_0x219f9f){_0x37e845=_0x37e845-0x0;var _0x59e55b=_0xaa88[_0x37e845];return _0x59e55b;};'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/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 9025b7e..330268f 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 _0x313c=['querystring','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','stack','name','index','map','MailTransferReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','findAll','rows','catch','params','includeAll','include','options','find','create','body','describe','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js'];(function(_0x102b18,_0x42ce8f){var _0x262fb0=function(_0xd09985){while(--_0xd09985){_0x102b18['push'](_0x102b18['shift']());}};_0x262fb0(++_0x42ce8f);}(_0x313c,0x150));var _0xc313=function(_0x5de2b8,_0x30adb1){_0x5de2b8=_0x5de2b8-0x0;var _0x5f594b=_0x313c[_0x5de2b8];return _0x5f594b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc313('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc313('0x1'));var rp=require('request-promise');var moment=require(_0xc313('0x2'));var BPromise=require(_0xc313('0x3'));var Mustache=require(_0xc313('0x4'));var util=require(_0xc313('0x5'));var path=require(_0xc313('0x6'));var sox=require('sox');var csv=require(_0xc313('0x7'));var ejs=require(_0xc313('0x8'));var fs=require('fs');var fs_extra=require(_0xc313('0x9'));var _=require(_0xc313('0xa'));var squel=require(_0xc313('0xb'));var crypto=require('crypto');var jsforce=require(_0xc313('0xc'));var deskjs=require(_0xc313('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc313('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc313('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc313('0x10'))(_0xc313('0x11'));var utils=require(_0xc313('0x12'));var config=require(_0xc313('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2896ad,_0x400c2d){_0x400c2d=_0x400c2d||0xcc;return function(_0x3a7545){if(_0x3a7545){return _0x2896ad[_0xc313('0x14')](_0x400c2d);}return _0x2896ad[_0xc313('0x15')](_0x400c2d)[_0xc313('0x16')]();};}function respondWithResult(_0x41efa7,_0x5cfaef){_0x5cfaef=_0x5cfaef||0xc8;return function(_0x318434){if(_0x318434){return _0x41efa7[_0xc313('0x15')](_0x5cfaef)[_0xc313('0x17')](_0x318434);}};}function respondWithFilteredResult(_0x589e1a,_0x576627){return function(_0x1e9712){if(_0x1e9712){var _0x2341ec=typeof _0x576627[_0xc313('0x18')]===_0xc313('0x19')&&typeof _0x576627[_0xc313('0x1a')]===_0xc313('0x19');var _0x17b557=_0x1e9712['count'];var _0x200ad5=_0x2341ec?0x0:_0x576627[_0xc313('0x18')];var _0x2383da=_0x2341ec?_0x1e9712[_0xc313('0x1b')]:_0x576627[_0xc313('0x18')]+_0x576627['limit'];var _0x295db2;if(_0x2383da>=_0x17b557){_0x2383da=_0x17b557;_0x295db2=0xc8;}else{_0x295db2=0xce;}_0x589e1a[_0xc313('0x15')](_0x295db2);return _0x589e1a[_0xc313('0x1c')](_0xc313('0x1d'),_0x200ad5+'-'+_0x2383da+'/'+_0x17b557)[_0xc313('0x17')](_0x1e9712);}return null;};}function patchUpdates(_0x439497){return function(_0xa00f41){try{jsonpatch['apply'](_0xa00f41,_0x439497,!![]);}catch(_0x443686){return BPromise[_0xc313('0x1e')](_0x443686);}return _0xa00f41[_0xc313('0x1f')]();};}function saveUpdates(_0x3d4960,_0x270d9b){return function(_0x5548bf){if(_0x5548bf){return _0x5548bf[_0xc313('0x20')](_0x3d4960)['then'](function(_0x23d33e){return _0x23d33e;});}return null;};}function removeEntity(_0x1c3ff0,_0x46d5d4){return function(_0x4e22f1){if(_0x4e22f1){return _0x4e22f1[_0xc313('0x21')]()[_0xc313('0x22')](function(){_0x1c3ff0[_0xc313('0x15')](0xcc)[_0xc313('0x16')]();});}};}function handleEntityNotFound(_0x59ee80,_0x128a67){return function(_0x2fb347){if(!_0x2fb347){_0x59ee80[_0xc313('0x14')](0x194);}return _0x2fb347;};}function handleError(_0xd0abb5,_0x407d93){_0x407d93=_0x407d93||0x1f4;return function(_0x5667bd){logger['error'](_0x5667bd[_0xc313('0x23')]);if(_0x5667bd[_0xc313('0x24')]){delete _0x5667bd[_0xc313('0x24')];}_0xd0abb5[_0xc313('0x15')](_0x407d93)['send'](_0x5667bd);};}exports[_0xc313('0x25')]=function(_0x3e960e,_0x8cb26f){var _0x1755ff={},_0x25e6d4={},_0x23b60d={'count':0x0,'rows':[]};var _0x233105=_[_0xc313('0x26')](db[_0xc313('0x27')][_0xc313('0x28')],function(_0x23f1a3){return{'name':_0x23f1a3['fieldName'],'type':_0x23f1a3[_0xc313('0x29')][_0xc313('0x2a')]};});_0x25e6d4[_0xc313('0x2b')]=_[_0xc313('0x26')](_0x233105,'name');_0x25e6d4[_0xc313('0x2c')]=_[_0xc313('0x2d')](_0x3e960e[_0xc313('0x2c')]);_0x25e6d4[_0xc313('0x2e')]=_[_0xc313('0x2f')](_0x25e6d4[_0xc313('0x2b')],_0x25e6d4[_0xc313('0x2c')]);_0x1755ff[_0xc313('0x30')]=_[_0xc313('0x2f')](_0x25e6d4[_0xc313('0x2b')],qs['fields'](_0x3e960e[_0xc313('0x2c')][_0xc313('0x31')]));_0x1755ff[_0xc313('0x30')]=_0x1755ff['attributes'][_0xc313('0x32')]?_0x1755ff[_0xc313('0x30')]:_0x25e6d4[_0xc313('0x2b')];if(!_0x3e960e[_0xc313('0x2c')][_0xc313('0x33')](_0xc313('0x34'))){_0x1755ff[_0xc313('0x1a')]=qs[_0xc313('0x1a')](_0x3e960e[_0xc313('0x2c')][_0xc313('0x1a')]);_0x1755ff[_0xc313('0x18')]=qs[_0xc313('0x18')](_0x3e960e[_0xc313('0x2c')][_0xc313('0x18')]);}_0x1755ff[_0xc313('0x35')]=qs['sort'](_0x3e960e[_0xc313('0x2c')][_0xc313('0x36')]);_0x1755ff[_0xc313('0x37')]=qs[_0xc313('0x2e')](_[_0xc313('0x38')](_0x3e960e[_0xc313('0x2c')],_0x25e6d4['filters']),_0x233105);if(_0x3e960e[_0xc313('0x2c')][_0xc313('0x39')]){_0x1755ff['where']=_['merge'](_0x1755ff[_0xc313('0x37')],{'$or':_[_0xc313('0x26')](_0x233105,function(_0x5845e3){if(_0x5845e3[_0xc313('0x29')]!=='VIRTUAL'){var _0x2e7015={};_0x2e7015[_0x5845e3[_0xc313('0x24')]]={'$like':'%'+_0x3e960e[_0xc313('0x2c')][_0xc313('0x39')]+'%'};return _0x2e7015;}})});}_0x1755ff=_[_0xc313('0x3a')]({},_0x1755ff,_0x3e960e['options']);var _0x267da0={'where':_0x1755ff[_0xc313('0x37')]};return db[_0xc313('0x27')][_0xc313('0x1b')](_0x267da0)['then'](function(_0x4d92e1){_0x23b60d['count']=_0x4d92e1;if(_0x3e960e['query']['includeAll']){_0x1755ff['include']=[{'all':!![]}];}return db['MailTransferReport'][_0xc313('0x3b')](_0x1755ff);})[_0xc313('0x22')](function(_0x2be6aa){_0x23b60d[_0xc313('0x3c')]=_0x2be6aa;return _0x23b60d;})[_0xc313('0x22')](respondWithFilteredResult(_0x8cb26f,_0x1755ff))[_0xc313('0x3d')](handleError(_0x8cb26f,null));};exports['show']=function(_0x18ce5e,_0x53212c){var _0x4bf6dd={'raw':!![],'where':{'id':_0x18ce5e[_0xc313('0x3e')]['id']}},_0x562277={};_0x562277[_0xc313('0x2b')]=_[_0xc313('0x2d')](db[_0xc313('0x27')][_0xc313('0x28')]);_0x562277[_0xc313('0x2c')]=_[_0xc313('0x2d')](_0x18ce5e[_0xc313('0x2c')]);_0x562277[_0xc313('0x2e')]=_['intersection'](_0x562277[_0xc313('0x2b')],_0x562277[_0xc313('0x2c')]);_0x4bf6dd[_0xc313('0x30')]=_['intersection'](_0x562277['model'],qs[_0xc313('0x31')](_0x18ce5e['query']['fields']));_0x4bf6dd[_0xc313('0x30')]=_0x4bf6dd['attributes'][_0xc313('0x32')]?_0x4bf6dd[_0xc313('0x30')]:_0x562277[_0xc313('0x2b')];if(_0x18ce5e[_0xc313('0x2c')][_0xc313('0x3f')]){_0x4bf6dd[_0xc313('0x40')]=[{'all':!![]}];}_0x4bf6dd=_[_0xc313('0x3a')]({},_0x4bf6dd,_0x18ce5e[_0xc313('0x41')]);return db[_0xc313('0x27')][_0xc313('0x42')](_0x4bf6dd)['then'](handleEntityNotFound(_0x53212c,null))[_0xc313('0x22')](respondWithResult(_0x53212c,null))[_0xc313('0x3d')](handleError(_0x53212c,null));};exports[_0xc313('0x43')]=function(_0x329fac,_0x24629d){return db[_0xc313('0x27')]['create'](_0x329fac['body'],{})['then'](respondWithResult(_0x24629d,0xc9))[_0xc313('0x3d')](handleError(_0x24629d,null));};exports[_0xc313('0x20')]=function(_0x16295a,_0x544477){if(_0x16295a[_0xc313('0x44')]['id']){delete _0x16295a['body']['id'];}return db['MailTransferReport'][_0xc313('0x42')]({'where':{'id':_0x16295a[_0xc313('0x3e')]['id']}})[_0xc313('0x22')](handleEntityNotFound(_0x544477,null))[_0xc313('0x22')](saveUpdates(_0x16295a[_0xc313('0x44')],null))[_0xc313('0x22')](respondWithResult(_0x544477,null))['catch'](handleError(_0x544477,null));};exports['destroy']=function(_0x574c04,_0x3e734b){return db['MailTransferReport']['find']({'where':{'id':_0x574c04[_0xc313('0x3e')]['id']}})[_0xc313('0x22')](handleEntityNotFound(_0x3e734b,null))['then'](removeEntity(_0x3e734b,null))[_0xc313('0x3d')](handleError(_0x3e734b,null));};exports[_0xc313('0x45')]=function(_0x3b1eb3,_0x269cc4){return db[_0xc313('0x27')]['describe']()['then'](respondWithResult(_0x269cc4,null))['catch'](handleError(_0x269cc4,null));}; \ No newline at end of file +var _0xce7e=['sox','to-csv','fs-extra','crypto','jsforce','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','reject','save','then','destroy','error','name','send','index','MailTransferReport','rawAttributes','fieldName','key','keys','query','intersection','attributes','model','fields','nolimit','order','sort','filters','pick','where','map','type','VIRTUAL','filter','merge','options','includeAll','rows','catch','show','params','include','find','create','body','update','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','util'];(function(_0x180f09,_0x3023ed){var _0x5cafe1=function(_0x3b463f){while(--_0x3b463f){_0x180f09['push'](_0x180f09['shift']());}};_0x5cafe1(++_0x3023ed);}(_0xce7e,0x198));var _0xece7=function(_0x2e11e1,_0x1ed71e){_0x2e11e1=_0x2e11e1-0x0;var _0x2ca368=_0xce7e[_0x2e11e1];return _0x2ca368;};'use strict';var emlformat=require(_0xece7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xece7('0x1'));var jsonpatch=require(_0xece7('0x2'));var rp=require('request-promise');var moment=require(_0xece7('0x3'));var BPromise=require(_0xece7('0x4'));var Mustache=require('mustache');var util=require(_0xece7('0x5'));var path=require('path');var sox=require(_0xece7('0x6'));var csv=require(_0xece7('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xece7('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xece7('0x9'));var jsforce=require(_0xece7('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xece7('0x7'));var querystring=require('querystring');var Papa=require(_0xece7('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xece7('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xece7('0xd'));var logger=require(_0xece7('0xe'))('api');var utils=require(_0xece7('0xf'));var config=require(_0xece7('0x10'));var licenseUtil=require(_0xece7('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f2289,_0x4eff1b){_0x4eff1b=_0x4eff1b||0xcc;return function(_0x299693){if(_0x299693){return _0x2f2289[_0xece7('0x12')](_0x4eff1b);}return _0x2f2289['status'](_0x4eff1b)[_0xece7('0x13')]();};}function respondWithResult(_0x5d9fc1,_0x21e389){_0x21e389=_0x21e389||0xc8;return function(_0x349e05){if(_0x349e05){return _0x5d9fc1[_0xece7('0x14')](_0x21e389)['json'](_0x349e05);}};}function respondWithFilteredResult(_0x4fcaaf,_0x3bd3b8){return function(_0x144261){if(_0x144261){var _0x23a192=typeof _0x3bd3b8['offset']===_0xece7('0x15')&&typeof _0x3bd3b8[_0xece7('0x16')]===_0xece7('0x15');var _0x3cd001=_0x144261[_0xece7('0x17')];var _0xa3cc7e=_0x23a192?0x0:_0x3bd3b8['offset'];var _0x39cfce=_0x23a192?_0x144261['count']:_0x3bd3b8[_0xece7('0x18')]+_0x3bd3b8[_0xece7('0x16')];var _0x3c420a;if(_0x39cfce>=_0x3cd001){_0x39cfce=_0x3cd001;_0x3c420a=0xc8;}else{_0x3c420a=0xce;}_0x4fcaaf[_0xece7('0x14')](_0x3c420a);return _0x4fcaaf[_0xece7('0x19')](_0xece7('0x1a'),_0xa3cc7e+'-'+_0x39cfce+'/'+_0x3cd001)[_0xece7('0x1b')](_0x144261);}return null;};}function patchUpdates(_0x1c10e7){return function(_0x18de91){try{jsonpatch['apply'](_0x18de91,_0x1c10e7,!![]);}catch(_0x434ef5){return BPromise[_0xece7('0x1c')](_0x434ef5);}return _0x18de91[_0xece7('0x1d')]();};}function saveUpdates(_0x450209,_0x5fa03c){return function(_0x5db5fc){if(_0x5db5fc){return _0x5db5fc['update'](_0x450209)[_0xece7('0x1e')](function(_0x3fc08a){return _0x3fc08a;});}return null;};}function removeEntity(_0x44c5e5,_0x581158){return function(_0x10a2a0){if(_0x10a2a0){return _0x10a2a0[_0xece7('0x1f')]()[_0xece7('0x1e')](function(){_0x44c5e5[_0xece7('0x14')](0xcc)[_0xece7('0x13')]();});}};}function handleEntityNotFound(_0x5a8765,_0x4d36d7){return function(_0x1a31d4){if(!_0x1a31d4){_0x5a8765[_0xece7('0x12')](0x194);}return _0x1a31d4;};}function handleError(_0x4b3192,_0x3e9c21){_0x3e9c21=_0x3e9c21||0x1f4;return function(_0x59eee5){logger[_0xece7('0x20')](_0x59eee5['stack']);if(_0x59eee5[_0xece7('0x21')]){delete _0x59eee5['name'];}_0x4b3192[_0xece7('0x14')](_0x3e9c21)[_0xece7('0x22')](_0x59eee5);};}exports[_0xece7('0x23')]=function(_0x4aca0a,_0x6a1924){var _0x2fa04d={},_0x3c7888={},_0x5591a4={'count':0x0,'rows':[]};var _0x222d8d=_['map'](db[_0xece7('0x24')][_0xece7('0x25')],function(_0x452e1d){return{'name':_0x452e1d[_0xece7('0x26')],'type':_0x452e1d['type'][_0xece7('0x27')]};});_0x3c7888['model']=_['map'](_0x222d8d,_0xece7('0x21'));_0x3c7888['query']=_[_0xece7('0x28')](_0x4aca0a[_0xece7('0x29')]);_0x3c7888['filters']=_[_0xece7('0x2a')](_0x3c7888['model'],_0x3c7888[_0xece7('0x29')]);_0x2fa04d[_0xece7('0x2b')]=_[_0xece7('0x2a')](_0x3c7888[_0xece7('0x2c')],qs[_0xece7('0x2d')](_0x4aca0a[_0xece7('0x29')]['fields']));_0x2fa04d[_0xece7('0x2b')]=_0x2fa04d[_0xece7('0x2b')]['length']?_0x2fa04d['attributes']:_0x3c7888[_0xece7('0x2c')];if(!_0x4aca0a[_0xece7('0x29')]['hasOwnProperty'](_0xece7('0x2e'))){_0x2fa04d[_0xece7('0x16')]=qs[_0xece7('0x16')](_0x4aca0a[_0xece7('0x29')][_0xece7('0x16')]);_0x2fa04d[_0xece7('0x18')]=qs[_0xece7('0x18')](_0x4aca0a[_0xece7('0x29')][_0xece7('0x18')]);}_0x2fa04d[_0xece7('0x2f')]=qs[_0xece7('0x30')](_0x4aca0a[_0xece7('0x29')][_0xece7('0x30')]);_0x2fa04d['where']=qs[_0xece7('0x31')](_[_0xece7('0x32')](_0x4aca0a['query'],_0x3c7888[_0xece7('0x31')]),_0x222d8d);if(_0x4aca0a[_0xece7('0x29')]['filter']){_0x2fa04d[_0xece7('0x33')]=_['merge'](_0x2fa04d[_0xece7('0x33')],{'$or':_[_0xece7('0x34')](_0x222d8d,function(_0xb293c6){if(_0xb293c6[_0xece7('0x35')]!==_0xece7('0x36')){var _0x1da196={};_0x1da196[_0xb293c6[_0xece7('0x21')]]={'$like':'%'+_0x4aca0a['query'][_0xece7('0x37')]+'%'};return _0x1da196;}})});}_0x2fa04d=_[_0xece7('0x38')]({},_0x2fa04d,_0x4aca0a[_0xece7('0x39')]);var _0x231567={'where':_0x2fa04d[_0xece7('0x33')]};return db[_0xece7('0x24')]['count'](_0x231567)['then'](function(_0x5081c1){_0x5591a4[_0xece7('0x17')]=_0x5081c1;if(_0x4aca0a[_0xece7('0x29')][_0xece7('0x3a')]){_0x2fa04d['include']=[{'all':!![]}];}return db[_0xece7('0x24')]['findAll'](_0x2fa04d);})[_0xece7('0x1e')](function(_0x4bcaab){_0x5591a4[_0xece7('0x3b')]=_0x4bcaab;return _0x5591a4;})[_0xece7('0x1e')](respondWithFilteredResult(_0x6a1924,_0x2fa04d))[_0xece7('0x3c')](handleError(_0x6a1924,null));};exports[_0xece7('0x3d')]=function(_0x58098a,_0x4b1ab5){var _0x2c9a68={'raw':!![],'where':{'id':_0x58098a[_0xece7('0x3e')]['id']}},_0x5c81b0={};_0x5c81b0['model']=_[_0xece7('0x28')](db[_0xece7('0x24')][_0xece7('0x25')]);_0x5c81b0[_0xece7('0x29')]=_[_0xece7('0x28')](_0x58098a['query']);_0x5c81b0[_0xece7('0x31')]=_[_0xece7('0x2a')](_0x5c81b0[_0xece7('0x2c')],_0x5c81b0[_0xece7('0x29')]);_0x2c9a68[_0xece7('0x2b')]=_[_0xece7('0x2a')](_0x5c81b0[_0xece7('0x2c')],qs[_0xece7('0x2d')](_0x58098a[_0xece7('0x29')][_0xece7('0x2d')]));_0x2c9a68[_0xece7('0x2b')]=_0x2c9a68[_0xece7('0x2b')]['length']?_0x2c9a68[_0xece7('0x2b')]:_0x5c81b0[_0xece7('0x2c')];if(_0x58098a[_0xece7('0x29')][_0xece7('0x3a')]){_0x2c9a68[_0xece7('0x3f')]=[{'all':!![]}];}_0x2c9a68=_[_0xece7('0x38')]({},_0x2c9a68,_0x58098a[_0xece7('0x39')]);return db[_0xece7('0x24')][_0xece7('0x40')](_0x2c9a68)[_0xece7('0x1e')](handleEntityNotFound(_0x4b1ab5,null))[_0xece7('0x1e')](respondWithResult(_0x4b1ab5,null))[_0xece7('0x3c')](handleError(_0x4b1ab5,null));};exports[_0xece7('0x41')]=function(_0x362210,_0x4ba9a4){return db[_0xece7('0x24')][_0xece7('0x41')](_0x362210[_0xece7('0x42')],{})[_0xece7('0x1e')](respondWithResult(_0x4ba9a4,0xc9))['catch'](handleError(_0x4ba9a4,null));};exports[_0xece7('0x43')]=function(_0x27cf02,_0x3180a0){if(_0x27cf02[_0xece7('0x42')]['id']){delete _0x27cf02[_0xece7('0x42')]['id'];}return db['MailTransferReport'][_0xece7('0x40')]({'where':{'id':_0x27cf02[_0xece7('0x3e')]['id']}})[_0xece7('0x1e')](handleEntityNotFound(_0x3180a0,null))[_0xece7('0x1e')](saveUpdates(_0x27cf02[_0xece7('0x42')],null))[_0xece7('0x1e')](respondWithResult(_0x3180a0,null))['catch'](handleError(_0x3180a0,null));};exports['destroy']=function(_0x2d882c,_0x385614){return db[_0xece7('0x24')][_0xece7('0x40')]({'where':{'id':_0x2d882c['params']['id']}})[_0xece7('0x1e')](handleEntityNotFound(_0x385614,null))[_0xece7('0x1e')](removeEntity(_0x385614,null))[_0xece7('0x3c')](handleError(_0x385614,null));};exports[_0xece7('0x44')]=function(_0x5ab9ae,_0x3fd0c5){return db[_0xece7('0x24')][_0xece7('0x44')]()[_0xece7('0x1e')](respondWithResult(_0x3fd0c5,null))[_0xece7('0x3c')](handleError(_0x3fd0c5,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 1ef0bc5..2841f1f 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 _0x34d2=['moment','bluebird','request-promise','path','rimraf','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','util','../../config/logger','api'];(function(_0x1c06f4,_0x2feba6){var _0x1a727e=function(_0x2e83af){while(--_0x2e83af){_0x1c06f4['push'](_0x1c06f4['shift']());}};_0x1a727e(++_0x2feba6);}(_0x34d2,0x7b));var _0x234d=function(_0x430dcf,_0x40a0b7){_0x430dcf=_0x430dcf-0x0;var _0x2b03f4=_0x34d2[_0x430dcf];return _0x2b03f4;};'use strict';var _=require('lodash');var util=require(_0x234d('0x0'));var logger=require(_0x234d('0x1'))(_0x234d('0x2'));var moment=require(_0x234d('0x3'));var BPromise=require(_0x234d('0x4'));var rp=require(_0x234d('0x5'));var fs=require('fs');var path=require(_0x234d('0x6'));var rimraf=require(_0x234d('0x7'));var config=require('../../config/environment');var attributes=require(_0x234d('0x8'));module[_0x234d('0x9')]=function(_0x5dfaf4,_0x244090){return _0x5dfaf4[_0x234d('0xa')](_0x234d('0xb'),attributes,{'tableName':_0x234d('0xc'),'paranoid':![],'indexes':[{'name':_0x234d('0xd'),'fields':[_0x234d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0fda=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','MailTransferReport','report_mail_transfer','uniqueid'];(function(_0x36f47c,_0x38ef4d){var _0x296c55=function(_0x403eec){while(--_0x403eec){_0x36f47c['push'](_0x36f47c['shift']());}};_0x296c55(++_0x38ef4d);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x15a64e,_0x1d8c76){_0x15a64e=_0x15a64e-0x0;var _0x1a59cd=_0x0fda[_0x15a64e];return _0x1a59cd;};'use strict';var _=require(_0xa0fd('0x0'));var util=require('util');var logger=require(_0xa0fd('0x1'))(_0xa0fd('0x2'));var moment=require(_0xa0fd('0x3'));var BPromise=require(_0xa0fd('0x4'));var rp=require(_0xa0fd('0x5'));var fs=require('fs');var path=require(_0xa0fd('0x6'));var rimraf=require(_0xa0fd('0x7'));var config=require('../../config/environment');var attributes=require('./mailTransferReport.attributes');module[_0xa0fd('0x8')]=function(_0x4aec58,_0x49b3c1){return _0x4aec58[_0xa0fd('0x9')](_0xa0fd('0xa'),attributes,{'tableName':_0xa0fd('0xb'),'paranoid':![],'indexes':[{'name':_0xa0fd('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 89c944a..641218f 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 _0xbc9c=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch'];(function(_0xe866e0,_0x3ede77){var _0x4d7644=function(_0x4e4a83){while(--_0x4e4a83){_0xe866e0['push'](_0xe866e0['shift']());}};_0x4d7644(++_0x3ede77);}(_0xbc9c,0x84));var _0xcbc9=function(_0x46dc22,_0x3c100a){_0x46dc22=_0x46dc22-0x0;var _0x40664d=_0xbc9c[_0x46dc22];return _0x40664d;};'use strict';var _=require(_0xcbc9('0x0'));var util=require(_0xcbc9('0x1'));var moment=require(_0xcbc9('0x2'));var BPromise=require(_0xcbc9('0x3'));var rs=require(_0xcbc9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcbc9('0x5'))['db'];var utils=require(_0xcbc9('0x6'));var logger=require(_0xcbc9('0x7'))(_0xcbc9('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcbc9('0x9')][_0xcbc9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f6a58,_0x3cd6c2,_0x213e8d){return new BPromise(function(_0x38f110,_0x2764b9){return client[_0xcbc9('0xb')](_0x1f6a58,_0x213e8d)[_0xcbc9('0xc')](function(_0x2d0844){logger['info'](_0xcbc9('0xd'),_0x3cd6c2,_0xcbc9('0xe'));logger['debug'](_0xcbc9('0xf'),_0x3cd6c2,'request\x20sent',JSON[_0xcbc9('0x10')](_0x2d0844));if(_0x2d0844[_0xcbc9('0x11')]){if(_0x2d0844[_0xcbc9('0x11')][_0xcbc9('0x12')]===0x1f4){logger['error'](_0xcbc9('0xd'),_0x3cd6c2,_0x2d0844['error'][_0xcbc9('0x13')]);return _0x2764b9(_0x2d0844['error'][_0xcbc9('0x13')]);}logger['error'](_0xcbc9('0xd'),_0x3cd6c2,_0x2d0844[_0xcbc9('0x11')]['message']);return _0x38f110(_0x2d0844[_0xcbc9('0x11')]['message']);}else{logger[_0xcbc9('0x14')](_0xcbc9('0xd'),_0x3cd6c2,_0xcbc9('0xe'));_0x38f110(_0x2d0844['result'][_0xcbc9('0x13')]);}})[_0xcbc9('0x15')](function(_0x3d08c3){logger['error'](_0xcbc9('0xd'),_0x3cd6c2,_0x3d08c3);_0x2764b9(_0x3d08c3);});});} \ No newline at end of file +var _0x36a8=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb'];(function(_0x238cda,_0x366547){var _0x7c9fe8=function(_0x20996c){while(--_0x20996c){_0x238cda['push'](_0x238cda['shift']());}};_0x7c9fe8(++_0x366547);}(_0x36a8,0xab));var _0x836a=function(_0x41a60b,_0xc398d){_0x41a60b=_0x41a60b-0x0;var _0x10c95a=_0x36a8[_0x41a60b];return _0x10c95a;};'use strict';var _=require(_0x836a('0x0'));var util=require('util');var moment=require(_0x836a('0x1'));var BPromise=require(_0x836a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x836a('0x3'));var db=require(_0x836a('0x4'))['db'];var utils=require(_0x836a('0x5'));var logger=require('../../config/logger')(_0x836a('0x6'));var config=require(_0x836a('0x7'));var jayson=require(_0x836a('0x8'));var client=jayson[_0x836a('0x9')][_0x836a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ef4ef,_0x4a0c30,_0x577f5d){return new BPromise(function(_0x326d69,_0xf7fff){return client[_0x836a('0xb')](_0x4ef4ef,_0x577f5d)[_0x836a('0xc')](function(_0x543f64){logger[_0x836a('0xd')](_0x836a('0xe'),_0x4a0c30,_0x836a('0xf'));logger[_0x836a('0x10')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x4a0c30,_0x836a('0xf'),JSON['stringify'](_0x543f64));if(_0x543f64[_0x836a('0x11')]){if(_0x543f64['error'][_0x836a('0x12')]===0x1f4){logger[_0x836a('0x11')](_0x836a('0xe'),_0x4a0c30,_0x543f64[_0x836a('0x11')][_0x836a('0x13')]);return _0xf7fff(_0x543f64[_0x836a('0x11')]['message']);}logger[_0x836a('0x11')](_0x836a('0xe'),_0x4a0c30,_0x543f64['error']['message']);return _0x326d69(_0x543f64[_0x836a('0x11')][_0x836a('0x13')]);}else{logger['info']('MailTransferReport,\x20%s,\x20%s',_0x4a0c30,'request\x20sent');_0x326d69(_0x543f64[_0x836a('0x14')]['message']);}})[_0x836a('0x15')](function(_0x3a9605){logger[_0x836a('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x4a0c30,_0x3a9605);_0xf7fff(_0x3a9605);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 1cca7c4..2374ef2 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 _0xf251=['../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service'];(function(_0x3c5b1d,_0x1c8127){var _0x3ee0a4=function(_0x218661){while(--_0x218661){_0x3c5b1d['push'](_0x3c5b1d['shift']());}};_0x3ee0a4(++_0x1c8127);}(_0xf251,0xa3));var _0x1f25=function(_0x5cd23e,_0x20777b){_0x5cd23e=_0x5cd23e-0x0;var _0x216550=_0xf251[_0x5cd23e];return _0x216550;};'use strict';var multer=require(_0x1f25('0x0'));var util=require('util');var path=require(_0x1f25('0x1'));var timeout=require('connect-timeout');var express=require(_0x1f25('0x2'));var router=express['Router']();var fs_extra=require(_0x1f25('0x3'));var auth=require(_0x1f25('0x4'));var interaction=require(_0x1f25('0x5'));var config=require(_0x1f25('0x6'));var controller=require(_0x1f25('0x7'));router[_0x1f25('0x8')]('/',auth[_0x1f25('0x9')](),controller[_0x1f25('0xa')]);router['get'](_0x1f25('0xb'),auth[_0x1f25('0x9')](),controller['describe']);router[_0x1f25('0x8')](_0x1f25('0xc'),auth[_0x1f25('0x9')](),controller[_0x1f25('0xd')]);router[_0x1f25('0xe')]('/',auth[_0x1f25('0x9')](),controller[_0x1f25('0xf')]);router[_0x1f25('0x10')](_0x1f25('0xc'),auth[_0x1f25('0x9')](),controller[_0x1f25('0x11')]);router[_0x1f25('0x12')](_0x1f25('0xc'),auth[_0x1f25('0x9')](),controller[_0x1f25('0x13')]);module[_0x1f25('0x14')]=router; \ No newline at end of file +var _0x30af=['destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','isAuthenticated','index','get','/describe','describe','show','post','create','put','delete','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x30af,0xf4));var _0xf30a=function(_0x445024,_0x36dca6){_0x445024=_0x445024-0x0;var _0x5ab19a=_0x30af[_0x445024];return _0x5ab19a;};'use strict';var multer=require(_0xf30a('0x0'));var util=require(_0xf30a('0x1'));var path=require(_0xf30a('0x2'));var timeout=require(_0xf30a('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf30a('0x4'));var auth=require(_0xf30a('0x5'));var interaction=require(_0xf30a('0x6'));var config=require(_0xf30a('0x7'));var controller=require(_0xf30a('0x8'));router['get']('/',auth[_0xf30a('0x9')](),controller[_0xf30a('0xa')]);router[_0xf30a('0xb')](_0xf30a('0xc'),auth[_0xf30a('0x9')](),controller[_0xf30a('0xd')]);router[_0xf30a('0xb')]('/:id',auth[_0xf30a('0x9')](),controller[_0xf30a('0xe')]);router[_0xf30a('0xf')]('/',auth[_0xf30a('0x9')](),controller[_0xf30a('0x10')]);router[_0xf30a('0x11')]('/:id',auth[_0xf30a('0x9')](),controller['update']);router[_0xf30a('0x12')](_0xf30a('0x13'),auth[_0xf30a('0x9')](),controller[_0xf30a('0x14')]);module[_0xf30a('0x15')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 9bb3eb5..ea82f82 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 _0xb4d9=['setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','sequelize','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds'];(function(_0x14ef91,_0x2bdcc0){var _0x3d62d8=function(_0x2d8ffc){while(--_0x2d8ffc){_0x14ef91['push'](_0x14ef91['shift']());}};_0x3d62d8(++_0x2bdcc0);}(_0xb4d9,0x115));var _0x9b4d=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xb4d9[_0x122096];return _0x3d1966;};'use strict';var Sequelize=require(_0x9b4d('0x0'));var moment=require('moment');module[_0x9b4d('0x1')]={'channel':{'type':Sequelize[_0x9b4d('0x2')]},'membername':{'type':Sequelize[_0x9b4d('0x2')]},'interface':{'type':Sequelize[_0x9b4d('0x2')]},'type':{'type':Sequelize[_0x9b4d('0x2')],'defaultValue':_0x9b4d('0x3'),'comment':_0x9b4d('0x4')},'duration':{'type':Sequelize[_0x9b4d('0x5')]},'enterAt':{'type':Sequelize[_0x9b4d('0x6')]},'exitAt':{'type':Sequelize[_0x9b4d('0x6')],'set':function(_0x8442c1){var _0x109303=moment(_0x8442c1);var _0x477e82=moment(this[_0x9b4d('0x7')](_0x9b4d('0x8')));var _0x2c8a65=_0x109303[_0x9b4d('0x9')](_0x477e82,_0x9b4d('0xa'));this[_0x9b4d('0xb')](_0x9b4d('0xc'),_0x8442c1);this[_0x9b4d('0xb')](_0x9b4d('0xd'),_0x2c8a65>=0x0?_0x2c8a65:null);}},'data1':{'type':Sequelize[_0x9b4d('0x2')],'comment':_0x9b4d('0xe')},'data2':{'type':Sequelize[_0x9b4d('0x2')],'comment':_0x9b4d('0xf')},'data3':{'type':Sequelize[_0x9b4d('0x2')],'comment':_0x9b4d('0x10')},'data4':{'type':Sequelize[_0x9b4d('0x2')],'comment':_0x9b4d('0x11')},'data5':{'type':Sequelize[_0x9b4d('0x2')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x9b4d('0x2')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5643=['moment','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','seconds','setDataValue','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5643,0xa4));var _0x3564=function(_0x334523,_0x3a63a3){_0x334523=_0x334523-0x0;var _0x27d54b=_0x5643[_0x334523];return _0x27d54b;};'use strict';var Sequelize=require(_0x3564('0x0'));var moment=require(_0x3564('0x1'));module[_0x3564('0x2')]={'channel':{'type':Sequelize[_0x3564('0x3')]},'membername':{'type':Sequelize[_0x3564('0x3')]},'interface':{'type':Sequelize[_0x3564('0x3')]},'type':{'type':Sequelize[_0x3564('0x3')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x3564('0x4')},'duration':{'type':Sequelize[_0x3564('0x5')]},'enterAt':{'type':Sequelize[_0x3564('0x6')]},'exitAt':{'type':Sequelize[_0x3564('0x6')],'set':function(_0x4d7950){var _0x4eb92c=moment(_0x4d7950);var _0x3d5f18=moment(this[_0x3564('0x7')](_0x3564('0x8')));var _0x528797=_0x4eb92c['diff'](_0x3d5f18,_0x3564('0x9'));this[_0x3564('0xa')]('exitAt',_0x4d7950);this['setDataValue']('duration',_0x528797>=0x0?_0x528797:null);}},'data1':{'type':Sequelize['STRING'],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x3564('0x3')],'comment':_0x3564('0xb')},'data3':{'type':Sequelize['STRING'],'comment':_0x3564('0xc')},'data4':{'type':Sequelize[_0x3564('0x3')],'comment':_0x3564('0xd')},'data5':{'type':Sequelize['STRING'],'comment':_0x3564('0xe')},'role':{'type':Sequelize[_0x3564('0x3')]},'internal':{'type':Sequelize[_0x3564('0x5')]},'uniqueid':{'type':Sequelize[_0x3564('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index f5690c0..9cd4fd8 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 _0x7217=['query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','filter','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','send','index','map','MemberReport','fieldName','type','model','name','keys'];(function(_0x3789c6,_0x53a98b){var _0x475614=function(_0x18b90e){while(--_0x18b90e){_0x3789c6['push'](_0x3789c6['shift']());}};_0x475614(++_0x53a98b);}(_0x7217,0x19e));var _0x7721=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x7217[_0x5447fd];return _0x15b28a;};'use strict';var emlformat=require(_0x7721('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7721('0x1'));var jsonpatch=require(_0x7721('0x2'));var rp=require(_0x7721('0x3'));var moment=require(_0x7721('0x4'));var BPromise=require(_0x7721('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7721('0x6'));var sox=require(_0x7721('0x7'));var csv=require(_0x7721('0x8'));var ejs=require(_0x7721('0x9'));var fs=require('fs');var fs_extra=require(_0x7721('0xa'));var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x8'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];function respondWithStatusCode(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xcc;return function(_0x199930){if(_0x199930){return _0x55b4ca['sendStatus'](_0x2911ec);}return _0x55b4ca[_0x7721('0x1c')](_0x2911ec)[_0x7721('0x1d')]();};}function respondWithResult(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0xc8;return function(_0x5069da){if(_0x5069da){return _0x3f01c5[_0x7721('0x1c')](_0x2e9752)[_0x7721('0x1e')](_0x5069da);}};}function respondWithFilteredResult(_0x534f1b,_0x4e199a){return function(_0x4b183e){if(_0x4b183e){var _0x5ed54=typeof _0x4e199a[_0x7721('0x1f')]===_0x7721('0x20')&&typeof _0x4e199a[_0x7721('0x21')]==='undefined';var _0x20f669=_0x4b183e['count'];var _0x3fc09e=_0x5ed54?0x0:_0x4e199a['offset'];var _0xfec626=_0x5ed54?_0x4b183e[_0x7721('0x22')]:_0x4e199a[_0x7721('0x1f')]+_0x4e199a[_0x7721('0x21')];var _0x2286e5;if(_0xfec626>=_0x20f669){_0xfec626=_0x20f669;_0x2286e5=0xc8;}else{_0x2286e5=0xce;}_0x534f1b[_0x7721('0x1c')](_0x2286e5);return _0x534f1b[_0x7721('0x23')](_0x7721('0x24'),_0x3fc09e+'-'+_0xfec626+'/'+_0x20f669)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0xaeccc4){return function(_0x4ce1db){try{jsonpatch[_0x7721('0x25')](_0x4ce1db,_0xaeccc4,!![]);}catch(_0x2c1583){return BPromise[_0x7721('0x26')](_0x2c1583);}return _0x4ce1db[_0x7721('0x27')]();};}function saveUpdates(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')](_0x57140c)[_0x7721('0x29')](function(_0x3e8a4e){return _0x3e8a4e;});}return null;};}function removeEntity(_0x1caad8,_0x121cc4){return function(_0x395b15){if(_0x395b15){return _0x395b15[_0x7721('0x2a')]()['then'](function(){_0x1caad8[_0x7721('0x1c')](0xcc)[_0x7721('0x1d')]();});}};}function handleEntityNotFound(_0x125564,_0x1f67c7){return function(_0x40d550){if(!_0x40d550){_0x125564[_0x7721('0x2b')](0x194);}return _0x40d550;};}function handleError(_0x424e05,_0xf753f1){_0xf753f1=_0xf753f1||0x1f4;return function(_0x40f367){logger['error'](_0x40f367[_0x7721('0x2c')]);if(_0x40f367['name']){delete _0x40f367['name'];}_0x424e05[_0x7721('0x1c')](_0xf753f1)[_0x7721('0x2d')](_0x40f367);};}exports[_0x7721('0x2e')]=function(_0x158d98,_0x1ea4d){var _0x37b9f0={},_0xd7d703={},_0x1da2d8={'count':0x0,'rows':[]};var _0x5c54f0=_[_0x7721('0x2f')](db[_0x7721('0x30')]['rawAttributes'],function(_0x4a25c9){return{'name':_0x4a25c9[_0x7721('0x31')],'type':_0x4a25c9[_0x7721('0x32')]['key']};});_0xd7d703[_0x7721('0x33')]=_[_0x7721('0x2f')](_0x5c54f0,_0x7721('0x34'));_0xd7d703['query']=_[_0x7721('0x35')](_0x158d98[_0x7721('0x36')]);_0xd7d703[_0x7721('0x37')]=_[_0x7721('0x38')](_0xd7d703[_0x7721('0x33')],_0xd7d703['query']);_0x37b9f0[_0x7721('0x39')]=_[_0x7721('0x38')](_0xd7d703[_0x7721('0x33')],qs['fields'](_0x158d98[_0x7721('0x36')][_0x7721('0x3a')]));_0x37b9f0['attributes']=_0x37b9f0[_0x7721('0x39')]['length']?_0x37b9f0[_0x7721('0x39')]:_0xd7d703[_0x7721('0x33')];if(!_0x158d98[_0x7721('0x36')][_0x7721('0x3b')](_0x7721('0x3c'))){_0x37b9f0[_0x7721('0x21')]=qs[_0x7721('0x21')](_0x158d98[_0x7721('0x36')][_0x7721('0x21')]);_0x37b9f0[_0x7721('0x1f')]=qs[_0x7721('0x1f')](_0x158d98['query'][_0x7721('0x1f')]);}_0x37b9f0['order']=qs[_0x7721('0x3d')](_0x158d98[_0x7721('0x36')][_0x7721('0x3d')]);_0x37b9f0[_0x7721('0x3e')]=qs[_0x7721('0x37')](_[_0x7721('0x3f')](_0x158d98['query'],_0xd7d703['filters']),_0x5c54f0);if(_0x158d98['query']['filter']){_0x37b9f0[_0x7721('0x3e')]=_[_0x7721('0x40')](_0x37b9f0[_0x7721('0x3e')],{'$or':_[_0x7721('0x2f')](_0x5c54f0,function(_0x4a90ce){if(_0x4a90ce[_0x7721('0x32')]!=='VIRTUAL'){var _0xfab37b={};_0xfab37b[_0x4a90ce[_0x7721('0x34')]]={'$like':'%'+_0x158d98['query'][_0x7721('0x41')]+'%'};return _0xfab37b;}})});}_0x37b9f0=_[_0x7721('0x40')]({},_0x37b9f0,_0x158d98['options']);var _0x4d0111={'where':_0x37b9f0[_0x7721('0x3e')]};return db[_0x7721('0x30')][_0x7721('0x22')](_0x4d0111)[_0x7721('0x29')](function(_0x577af9){_0x1da2d8[_0x7721('0x22')]=_0x577af9;if(_0x158d98[_0x7721('0x36')][_0x7721('0x42')]){_0x37b9f0[_0x7721('0x43')]=[{'all':!![]}];}return db[_0x7721('0x30')]['findAll'](_0x37b9f0);})[_0x7721('0x29')](function(_0x4a2c28){_0x1da2d8[_0x7721('0x44')]=_0x4a2c28;return _0x1da2d8;})['then'](respondWithFilteredResult(_0x1ea4d,_0x37b9f0))[_0x7721('0x45')](handleError(_0x1ea4d,null));};exports[_0x7721('0x46')]=function(_0x231dad,_0x49e0c5){var _0x1453d4={'raw':!![],'where':{'id':_0x231dad[_0x7721('0x47')]['id']}},_0x11d853={};_0x11d853['model']=_[_0x7721('0x35')](db[_0x7721('0x30')][_0x7721('0x48')]);_0x11d853[_0x7721('0x36')]=_[_0x7721('0x35')](_0x231dad[_0x7721('0x36')]);_0x11d853[_0x7721('0x37')]=_['intersection'](_0x11d853['model'],_0x11d853[_0x7721('0x36')]);_0x1453d4[_0x7721('0x39')]=_[_0x7721('0x38')](_0x11d853[_0x7721('0x33')],qs[_0x7721('0x3a')](_0x231dad[_0x7721('0x36')][_0x7721('0x3a')]));_0x1453d4[_0x7721('0x39')]=_0x1453d4[_0x7721('0x39')][_0x7721('0x49')]?_0x1453d4['attributes']:_0x11d853['model'];if(_0x231dad[_0x7721('0x36')][_0x7721('0x42')]){_0x1453d4[_0x7721('0x43')]=[{'all':!![]}];}_0x1453d4=_[_0x7721('0x40')]({},_0x1453d4,_0x231dad['options']);return db[_0x7721('0x30')][_0x7721('0x4a')](_0x1453d4)['then'](handleEntityNotFound(_0x49e0c5,null))[_0x7721('0x29')](respondWithResult(_0x49e0c5,null))['catch'](handleError(_0x49e0c5,null));};exports[_0x7721('0x4b')]=function(_0x5c6922,_0x334f23){return db[_0x7721('0x30')][_0x7721('0x4b')](_0x5c6922['body'],{})[_0x7721('0x29')](respondWithResult(_0x334f23,0xc9))[_0x7721('0x45')](handleError(_0x334f23,null));};exports['update']=function(_0x223d93,_0x1196c2){if(_0x223d93[_0x7721('0x4c')]['id']){delete _0x223d93['body']['id'];}return db[_0x7721('0x30')]['find']({'where':{'id':_0x223d93[_0x7721('0x47')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x1196c2,null))[_0x7721('0x29')](saveUpdates(_0x223d93[_0x7721('0x4c')],null))[_0x7721('0x29')](respondWithResult(_0x1196c2,null))[_0x7721('0x45')](handleError(_0x1196c2,null));};exports[_0x7721('0x2a')]=function(_0x7fbb73,_0x694d2f){return db[_0x7721('0x30')][_0x7721('0x4a')]({'where':{'id':_0x7fbb73[_0x7721('0x47')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x694d2f,null))[_0x7721('0x29')](removeEntity(_0x694d2f,null))[_0x7721('0x45')](handleError(_0x694d2f,null));};exports['describe']=function(_0x474f32,_0x2f6f30){return db[_0x7721('0x30')][_0x7721('0x4d')]()[_0x7721('0x29')](respondWithResult(_0x2f6f30,null))[_0x7721('0x45')](handleError(_0x2f6f30,null));}; \ No newline at end of file +var _0x34e8=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','MemberReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x3a9661,_0x530b12){var _0x5bb119=function(_0x1278f){while(--_0x1278f){_0x3a9661['push'](_0x3a9661['shift']());}};_0x5bb119(++_0x530b12);}(_0x34e8,0x12c));var _0x834e=function(_0x2dfb61,_0x57db77){_0x2dfb61=_0x2dfb61-0x0;var _0x10adfe=_0x34e8[_0x2dfb61];return _0x10adfe;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(!_0x5e1cc5){_0x24fcf7['sendStatus'](0x194);}return _0x5e1cc5;};}function handleError(_0x1e713a,_0x508a1d){_0x508a1d=_0x508a1d||0x1f4;return function(_0x2826ec){logger[_0x834e('0x2c')](_0x2826ec[_0x834e('0x2d')]);if(_0x2826ec[_0x834e('0x2e')]){delete _0x2826ec[_0x834e('0x2e')];}_0x1e713a[_0x834e('0x1d')](_0x508a1d)['send'](_0x2826ec);};}exports['index']=function(_0x4dc64a,_0x58c1d7){var _0x2c7a8d={},_0x567cea={},_0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x32')],'type':_0x1e026a[_0x834e('0x33')][_0x834e('0x34')]};});_0x567cea[_0x834e('0x35')]=_[_0x834e('0x2f')](_0x5dacc1,'name');_0x567cea[_0x834e('0x36')]=_['keys'](_0x4dc64a[_0x834e('0x36')]);_0x567cea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],_0x567cea[_0x834e('0x36')]);_0x2c7a8d[_0x834e('0x39')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x4dc64a[_0x834e('0x36')]['fields']));_0x2c7a8d[_0x834e('0x39')]=_0x2c7a8d[_0x834e('0x39')][_0x834e('0x3b')]?_0x2c7a8d[_0x834e('0x39')]:_0x567cea['model'];if(!_0x4dc64a[_0x834e('0x36')][_0x834e('0x3c')]('nolimit')){_0x2c7a8d['limit']=qs['limit'](_0x4dc64a[_0x834e('0x36')][_0x834e('0x20')]);_0x2c7a8d[_0x834e('0x22')]=qs[_0x834e('0x22')](_0x4dc64a[_0x834e('0x36')][_0x834e('0x22')]);}_0x2c7a8d['order']=qs[_0x834e('0x3d')](_0x4dc64a['query'][_0x834e('0x3d')]);_0x2c7a8d[_0x834e('0x3e')]=qs['filters'](_[_0x834e('0x3f')](_0x4dc64a[_0x834e('0x36')],_0x567cea['filters']),_0x5dacc1);if(_0x4dc64a['query'][_0x834e('0x40')]){_0x2c7a8d[_0x834e('0x3e')]=_[_0x834e('0x41')](_0x2c7a8d[_0x834e('0x3e')],{'$or':_[_0x834e('0x2f')](_0x5dacc1,function(_0x4ca43c){if(_0x4ca43c[_0x834e('0x33')]!=='VIRTUAL'){var _0x50c243={};_0x50c243[_0x4ca43c[_0x834e('0x2e')]]={'$like':'%'+_0x4dc64a['query'][_0x834e('0x40')]+'%'};return _0x50c243;}})});}_0x2c7a8d=_[_0x834e('0x41')]({},_0x2c7a8d,_0x4dc64a[_0x834e('0x42')]);var _0x3c59af={'where':_0x2c7a8d[_0x834e('0x3e')]};return db['MemberReport'][_0x834e('0x21')](_0x3c59af)[_0x834e('0x2a')](function(_0x38f266){_0x106d6a['count']=_0x38f266;if(_0x4dc64a[_0x834e('0x36')][_0x834e('0x43')]){_0x2c7a8d['include']=[{'all':!![]}];}return db[_0x834e('0x30')]['findAll'](_0x2c7a8d);})[_0x834e('0x2a')](function(_0x585335){_0x106d6a['rows']=_0x585335;return _0x106d6a;})['then'](respondWithFilteredResult(_0x58c1d7,_0x2c7a8d))[_0x834e('0x44')](handleError(_0x58c1d7,null));};exports[_0x834e('0x45')]=function(_0x3bcbf4,_0xbc1571){var _0x8ad264={'raw':!![],'where':{'id':_0x3bcbf4[_0x834e('0x46')]['id']}},_0x23feea={};_0x23feea['model']=_[_0x834e('0x47')](db['MemberReport'][_0x834e('0x31')]);_0x23feea['query']=_[_0x834e('0x47')](_0x3bcbf4['query']);_0x23feea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x23feea['model'],_0x23feea[_0x834e('0x36')]);_0x8ad264[_0x834e('0x39')]=_[_0x834e('0x38')](_0x23feea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x3bcbf4[_0x834e('0x36')][_0x834e('0x3a')]));_0x8ad264[_0x834e('0x39')]=_0x8ad264[_0x834e('0x39')][_0x834e('0x3b')]?_0x8ad264['attributes']:_0x23feea[_0x834e('0x35')];if(_0x3bcbf4[_0x834e('0x36')]['includeAll']){_0x8ad264[_0x834e('0x48')]=[{'all':!![]}];}_0x8ad264=_[_0x834e('0x41')]({},_0x8ad264,_0x3bcbf4[_0x834e('0x42')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x8ad264)[_0x834e('0x2a')](handleEntityNotFound(_0xbc1571,null))['then'](respondWithResult(_0xbc1571,null))['catch'](handleError(_0xbc1571,null));};exports[_0x834e('0x4a')]=function(_0x1a5444,_0x30568e){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x1a5444[_0x834e('0x4b')],{})[_0x834e('0x2a')](respondWithResult(_0x30568e,0xc9))[_0x834e('0x44')](handleError(_0x30568e,null));};exports[_0x834e('0x29')]=function(_0x390c45,_0xf02f0d){if(_0x390c45[_0x834e('0x4b')]['id']){delete _0x390c45[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x390c45[_0x834e('0x46')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0xf02f0d,null))[_0x834e('0x2a')](saveUpdates(_0x390c45[_0x834e('0x4b')],null))[_0x834e('0x2a')](respondWithResult(_0xf02f0d,null))['catch'](handleError(_0xf02f0d,null));};exports[_0x834e('0x2b')]=function(_0x1f08b9,_0x4e73e0){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1f08b9['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4e73e0,null))[_0x834e('0x2a')](removeEntity(_0x4e73e0,null))[_0x834e('0x44')](handleError(_0x4e73e0,null));};exports[_0x834e('0x4c')]=function(_0x4288e4,_0xb77aab){return db[_0x834e('0x30')]['describe']()[_0x834e('0x2a')](respondWithResult(_0xb77aab,null))[_0x834e('0x44')](handleError(_0xb77aab,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index a8ec851..1df04c6 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 _0x3408=['../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member','membername','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4cfd53,_0xee9624){var _0x558054=function(_0x36bbeb){while(--_0x36bbeb){_0x4cfd53['push'](_0x4cfd53['shift']());}};_0x558054(++_0xee9624);}(_0x3408,0x177));var _0x8340=function(_0x4d6889,_0xee0cd3){_0x4d6889=_0x4d6889-0x0;var _0x5a52e5=_0x3408[_0x4d6889];return _0x5a52e5;};'use strict';var _=require(_0x8340('0x0'));var util=require(_0x8340('0x1'));var logger=require(_0x8340('0x2'))(_0x8340('0x3'));var moment=require(_0x8340('0x4'));var BPromise=require(_0x8340('0x5'));var rp=require(_0x8340('0x6'));var fs=require('fs');var path=require(_0x8340('0x7'));var rimraf=require(_0x8340('0x8'));var config=require(_0x8340('0x9'));var attributes=require(_0x8340('0xa'));module[_0x8340('0xb')]=function(_0x16e6fb,_0x339a18){return _0x16e6fb[_0x8340('0xc')](_0x8340('0xd'),attributes,{'tableName':_0x8340('0xe'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x8340('0xf'),'interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5bf1=['bluebird','request-promise','../../config/environment','./memberReport.attributes','exports','MemberReport','report_member','membername_interface','membername','interface','lodash','util','../../config/logger','moment'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0x5bf1,0x15a));var _0x15bf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5bf1[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x15bf('0x0'));var util=require(_0x15bf('0x1'));var logger=require(_0x15bf('0x2'))('api');var moment=require(_0x15bf('0x3'));var BPromise=require(_0x15bf('0x4'));var rp=require(_0x15bf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x15bf('0x6'));var attributes=require(_0x15bf('0x7'));module[_0x15bf('0x8')]=function(_0x397792,_0x33c0d8){return _0x397792['define'](_0x15bf('0x9'),attributes,{'tableName':_0x15bf('0xa'),'paranoid':![],'indexes':[{'name':_0x15bf('0xb'),'fields':[_0x15bf('0xc'),_0x15bf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index b8e8bda..84106da 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 _0x81d4=['moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','stringify','error','code','MemberReport,\x20%s,\x20%s','message','result','MemberReport','options','raw','where','attributes','limit','map','model','include','GetMemberReport','catch','CreateMemberReport','UpdateMemberReport','update','body','util'];(function(_0x1abcbc,_0x10fa0e){var _0x5a458e=function(_0x3c800e){while(--_0x3c800e){_0x1abcbc['push'](_0x1abcbc['shift']());}};_0x5a458e(++_0x10fa0e);}(_0x81d4,0x197));var _0x481d=function(_0x4ed7c6,_0x4715fe){_0x4ed7c6=_0x4ed7c6-0x0;var _0x18a7e4=_0x81d4[_0x4ed7c6];return _0x18a7e4;};'use strict';var _=require('lodash');var util=require(_0x481d('0x0'));var moment=require(_0x481d('0x1'));var BPromise=require('bluebird');var rs=require(_0x481d('0x2'));var fs=require('fs');var Redis=require(_0x481d('0x3'));var db=require(_0x481d('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x481d('0x5'));var config=require(_0x481d('0x6'));var jayson=require(_0x481d('0x7'));var client=jayson['client'][_0x481d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x17d32a,_0x2f91fd,_0x271b33){return new BPromise(function(_0x1d9263,_0x25adbb){return client['request'](_0x17d32a,_0x271b33)[_0x481d('0x9')](function(_0x1cf758){logger[_0x481d('0xa')]('MemberReport,\x20%s,\x20%s',_0x2f91fd,_0x481d('0xb'));logger[_0x481d('0xc')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x2f91fd,_0x481d('0xb'),JSON[_0x481d('0xd')](_0x1cf758));if(_0x1cf758[_0x481d('0xe')]){if(_0x1cf758[_0x481d('0xe')][_0x481d('0xf')]===0x1f4){logger[_0x481d('0xe')](_0x481d('0x10'),_0x2f91fd,_0x1cf758['error'][_0x481d('0x11')]);return _0x25adbb(_0x1cf758['error']['message']);}logger[_0x481d('0xe')](_0x481d('0x10'),_0x2f91fd,_0x1cf758[_0x481d('0xe')]['message']);return _0x1d9263(_0x1cf758[_0x481d('0xe')]['message']);}else{logger[_0x481d('0xa')](_0x481d('0x10'),_0x2f91fd,_0x481d('0xb'));_0x1d9263(_0x1cf758[_0x481d('0x12')][_0x481d('0x11')]);}})['catch'](function(_0x63b8c1){logger[_0x481d('0xe')](_0x481d('0x10'),_0x2f91fd,_0x63b8c1);_0x25adbb(_0x63b8c1);});});}exports['GetMemberReport']=function(_0x21e2a5){var _0x5056c7=this;return new Promise(function(_0x3ef7c6,_0x534a99){return db[_0x481d('0x13')]['findAll']({'raw':_0x21e2a5[_0x481d('0x14')]?_0x21e2a5['options'][_0x481d('0x15')]===undefined?!![]:![]:!![],'where':_0x21e2a5['options']?_0x21e2a5[_0x481d('0x14')][_0x481d('0x16')]||null:null,'attributes':_0x21e2a5['options']?_0x21e2a5[_0x481d('0x14')][_0x481d('0x17')]||null:null,'limit':_0x21e2a5[_0x481d('0x14')]?_0x21e2a5['options'][_0x481d('0x18')]||null:null,'include':_0x21e2a5['options']?_0x21e2a5['options']['include']?_[_0x481d('0x19')](_0x21e2a5['options']['include'],function(_0x280586){return{'model':db[_0x280586[_0x481d('0x1a')]],'as':_0x280586['as'],'attributes':_0x280586[_0x481d('0x17')],'include':_0x280586['include']?_[_0x481d('0x19')](_0x280586[_0x481d('0x1b')],function(_0x51e3a){return{'model':db[_0x51e3a[_0x481d('0x1a')]],'as':_0x51e3a['as'],'attributes':_0x51e3a['attributes'],'include':_0x51e3a[_0x481d('0x1b')]?_[_0x481d('0x19')](_0x51e3a['include'],function(_0x371cbe){return{'model':db[_0x371cbe[_0x481d('0x1a')]],'as':_0x371cbe['as'],'attributes':_0x371cbe[_0x481d('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x599e61){logger[_0x481d('0xa')](_0x481d('0x1c'),_0x21e2a5);logger['debug']('GetMemberReport',_0x21e2a5,JSON[_0x481d('0xd')](_0x599e61));_0x3ef7c6(_0x599e61);})[_0x481d('0x1d')](function(_0x495fbb){logger[_0x481d('0xe')](_0x481d('0x1c'),_0x495fbb[_0x481d('0x11')],_0x21e2a5);_0x534a99(_0x5056c7[_0x481d('0xe')](0x1f4,_0x495fbb[_0x481d('0x11')]));});});};exports[_0x481d('0x1e')]=function(_0x447ac3){var _0x46f01b=this;return new Promise(function(_0x43d417,_0x4791ae){return db[_0x481d('0x13')]['create'](_0x447ac3['body'],{'raw':_0x447ac3['options']?_0x447ac3[_0x481d('0x14')]['raw']===undefined?!![]:![]:!![]})[_0x481d('0x9')](function(_0x5d00fe){logger[_0x481d('0xa')](_0x481d('0x1e'),_0x447ac3);logger[_0x481d('0xc')](_0x481d('0x1e'),_0x447ac3,JSON[_0x481d('0xd')](_0x5d00fe));_0x43d417(_0x5d00fe);})[_0x481d('0x1d')](function(_0x46e60c){logger[_0x481d('0xe')](_0x481d('0x1e'),_0x46e60c[_0x481d('0x11')],_0x447ac3);_0x4791ae(_0x46f01b[_0x481d('0xe')](0x1f4,_0x46e60c[_0x481d('0x11')]));});});};exports[_0x481d('0x1f')]=function(_0x35c4b4){var _0x131961=this;return new Promise(function(_0x5288fe,_0x2143f6){return db[_0x481d('0x13')][_0x481d('0x20')](_0x35c4b4[_0x481d('0x21')],{'raw':_0x35c4b4[_0x481d('0x14')]?_0x35c4b4[_0x481d('0x14')][_0x481d('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35c4b4[_0x481d('0x14')]?_0x35c4b4['options'][_0x481d('0x16')]||null:null,'attributes':_0x35c4b4[_0x481d('0x14')]?_0x35c4b4[_0x481d('0x14')][_0x481d('0x17')]||null:null,'limit':_0x35c4b4[_0x481d('0x14')]?_0x35c4b4['options']['limit']||null:null})[_0x481d('0x9')](function(_0x5def7f){logger[_0x481d('0xa')](_0x481d('0x1f'),_0x35c4b4);logger[_0x481d('0xc')](_0x481d('0x1f'),_0x35c4b4,JSON[_0x481d('0xd')](_0x5def7f));_0x5288fe(_0x5def7f);})[_0x481d('0x1d')](function(_0x2c251f){logger[_0x481d('0xe')](_0x481d('0x1f'),_0x2c251f['message'],_0x35c4b4);_0x2143f6(_0x131961['error'](0x1f4,_0x2c251f[_0x481d('0x11')]));});});}; \ No newline at end of file +var _0x0967=['client','http','info','MemberReport,\x20%s,\x20%s','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','GetMemberReport','options','raw','where','attributes','limit','include','map','model','then','debug','CreateMemberReport','body','UpdateMemberReport','MemberReport','update','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x50516f,_0x19e4c8){var _0x14d753=function(_0x1a5cc3){while(--_0x1a5cc3){_0x50516f['push'](_0x50516f['shift']());}};_0x14d753(++_0x19e4c8);}(_0x0967,0x100));var _0x7096=function(_0xf50fc,_0x40b206){_0xf50fc=_0xf50fc-0x0;var _0x3d6e00=_0x0967[_0xf50fc];return _0x3d6e00;};'use strict';var _=require(_0x7096('0x0'));var util=require('util');var moment=require(_0x7096('0x1'));var BPromise=require(_0x7096('0x2'));var rs=require(_0x7096('0x3'));var fs=require('fs');var Redis=require(_0x7096('0x4'));var db=require(_0x7096('0x5'))['db'];var utils=require(_0x7096('0x6'));var logger=require(_0x7096('0x7'))(_0x7096('0x8'));var config=require('../../config/environment');var jayson=require(_0x7096('0x9'));var client=jayson[_0x7096('0xa')][_0x7096('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1344c3,_0x1191bf,_0x20f7ef){return new BPromise(function(_0x2832fc,_0x27b864){return client['request'](_0x1344c3,_0x20f7ef)['then'](function(_0x2f05bf){logger[_0x7096('0xc')](_0x7096('0xd'),_0x1191bf,'request\x20sent');logger['debug'](_0x7096('0xe'),_0x1191bf,_0x7096('0xf'),JSON[_0x7096('0x10')](_0x2f05bf));if(_0x2f05bf['error']){if(_0x2f05bf['error'][_0x7096('0x11')]===0x1f4){logger[_0x7096('0x12')]('MemberReport,\x20%s,\x20%s',_0x1191bf,_0x2f05bf[_0x7096('0x12')]['message']);return _0x27b864(_0x2f05bf[_0x7096('0x12')][_0x7096('0x13')]);}logger['error'](_0x7096('0xd'),_0x1191bf,_0x2f05bf[_0x7096('0x12')][_0x7096('0x13')]);return _0x2832fc(_0x2f05bf[_0x7096('0x12')][_0x7096('0x13')]);}else{logger[_0x7096('0xc')]('MemberReport,\x20%s,\x20%s',_0x1191bf,_0x7096('0xf'));_0x2832fc(_0x2f05bf[_0x7096('0x14')][_0x7096('0x13')]);}})[_0x7096('0x15')](function(_0x1e8514){logger['error'](_0x7096('0xd'),_0x1191bf,_0x1e8514);_0x27b864(_0x1e8514);});});}exports[_0x7096('0x16')]=function(_0x1ff404){var _0x516b97=this;return new Promise(function(_0x5079e6,_0x15ca15){return db['MemberReport']['findAll']({'raw':_0x1ff404['options']?_0x1ff404[_0x7096('0x17')][_0x7096('0x18')]===undefined?!![]:![]:!![],'where':_0x1ff404[_0x7096('0x17')]?_0x1ff404[_0x7096('0x17')][_0x7096('0x19')]||null:null,'attributes':_0x1ff404[_0x7096('0x17')]?_0x1ff404[_0x7096('0x17')][_0x7096('0x1a')]||null:null,'limit':_0x1ff404['options']?_0x1ff404[_0x7096('0x17')][_0x7096('0x1b')]||null:null,'include':_0x1ff404[_0x7096('0x17')]?_0x1ff404['options'][_0x7096('0x1c')]?_['map'](_0x1ff404['options'][_0x7096('0x1c')],function(_0x48849a){return{'model':db[_0x48849a['model']],'as':_0x48849a['as'],'attributes':_0x48849a[_0x7096('0x1a')],'include':_0x48849a['include']?_[_0x7096('0x1d')](_0x48849a['include'],function(_0x4f14f9){return{'model':db[_0x4f14f9[_0x7096('0x1e')]],'as':_0x4f14f9['as'],'attributes':_0x4f14f9['attributes'],'include':_0x4f14f9[_0x7096('0x1c')]?_['map'](_0x4f14f9[_0x7096('0x1c')],function(_0xd83be3){return{'model':db[_0xd83be3['model']],'as':_0xd83be3['as'],'attributes':_0xd83be3[_0x7096('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x7096('0x1f')](function(_0x4f6d90){logger['info']('GetMemberReport',_0x1ff404);logger[_0x7096('0x20')](_0x7096('0x16'),_0x1ff404,JSON[_0x7096('0x10')](_0x4f6d90));_0x5079e6(_0x4f6d90);})[_0x7096('0x15')](function(_0x5b4531){logger[_0x7096('0x12')](_0x7096('0x16'),_0x5b4531[_0x7096('0x13')],_0x1ff404);_0x15ca15(_0x516b97[_0x7096('0x12')](0x1f4,_0x5b4531[_0x7096('0x13')]));});});};exports[_0x7096('0x21')]=function(_0x36ab98){var _0x1611f9=this;return new Promise(function(_0x1323ac,_0x3f07ba){return db['MemberReport']['create'](_0x36ab98[_0x7096('0x22')],{'raw':_0x36ab98[_0x7096('0x17')]?_0x36ab98[_0x7096('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x7096('0x1f')](function(_0x30f516){logger[_0x7096('0xc')](_0x7096('0x21'),_0x36ab98);logger['debug'](_0x7096('0x21'),_0x36ab98,JSON['stringify'](_0x30f516));_0x1323ac(_0x30f516);})['catch'](function(_0x11a2e2){logger[_0x7096('0x12')](_0x7096('0x21'),_0x11a2e2[_0x7096('0x13')],_0x36ab98);_0x3f07ba(_0x1611f9[_0x7096('0x12')](0x1f4,_0x11a2e2['message']));});});};exports[_0x7096('0x23')]=function(_0x5741df){var _0x379f72=this;return new Promise(function(_0x497267,_0x108def){return db[_0x7096('0x24')][_0x7096('0x25')](_0x5741df[_0x7096('0x22')],{'raw':_0x5741df['options']?_0x5741df[_0x7096('0x17')][_0x7096('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5741df[_0x7096('0x17')]?_0x5741df[_0x7096('0x17')][_0x7096('0x19')]||null:null,'attributes':_0x5741df[_0x7096('0x17')]?_0x5741df['options'][_0x7096('0x1a')]||null:null,'limit':_0x5741df[_0x7096('0x17')]?_0x5741df[_0x7096('0x17')][_0x7096('0x1b')]||null:null})[_0x7096('0x1f')](function(_0x49dcab){logger['info'](_0x7096('0x23'),_0x5741df);logger[_0x7096('0x20')]('UpdateMemberReport',_0x5741df,JSON[_0x7096('0x10')](_0x49dcab));_0x497267(_0x49dcab);})[_0x7096('0x15')](function(_0x3ca523){logger['error'](_0x7096('0x23'),_0x3ca523[_0x7096('0x13')],_0x5741df);_0x108def(_0x379f72[_0x7096('0x12')](0x1f4,_0x3ca523[_0x7096('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 105ce94..a330539 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 _0xaf99=['../../components/auth/service','../../config/environment','./migration.controller','index','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x4232d8,_0x13fd09){var _0x324de2=function(_0x167ad5){while(--_0x167ad5){_0x4232d8['push'](_0x4232d8['shift']());}};_0x324de2(++_0x13fd09);}(_0xaf99,0x13a));var _0x9af9=function(_0x5aecc8,_0x38006b){_0x5aecc8=_0x5aecc8-0x0;var _0x4beb6d=_0xaf99[_0x5aecc8];return _0x4beb6d;};'use strict';var multer=require('multer');var util=require(_0x9af9('0x0'));var path=require(_0x9af9('0x1'));var timeout=require(_0x9af9('0x2'));var express=require(_0x9af9('0x3'));var router=express[_0x9af9('0x4')]();var fs_extra=require(_0x9af9('0x5'));var auth=require(_0x9af9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9af9('0x7'));var controller=require(_0x9af9('0x8'));router['get']('/',controller[_0x9af9('0x9')]);module['exports']=router; \ No newline at end of file +var _0x031f=['path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./migration.controller','get','index','exports','multer'];(function(_0x973c1e,_0x121d65){var _0x2dcf74=function(_0xd29dd0){while(--_0xd29dd0){_0x973c1e['push'](_0x973c1e['shift']());}};_0x2dcf74(++_0x121d65);}(_0x031f,0x1c2));var _0xf031=function(_0x83bea3,_0x4a7cf0){_0x83bea3=_0x83bea3-0x0;var _0x1c9600=_0x031f[_0x83bea3];return _0x1c9600;};'use strict';var multer=require(_0xf031('0x0'));var util=require('util');var path=require(_0xf031('0x1'));var timeout=require('connect-timeout');var express=require(_0xf031('0x2'));var router=express[_0xf031('0x3')]();var fs_extra=require(_0xf031('0x4'));var auth=require(_0xf031('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf031('0x6'));var controller=require(_0xf031('0x7'));router[_0xf031('0x8')]('/',controller[_0xf031('0x9')]);module[_0xf031('0xa')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index d89ea58..cc5e843 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 _0xaf46=['version','exports'];(function(_0x3a7e01,_0x51204c){var _0x5b8398=function(_0x4dcfab){while(--_0x4dcfab){_0x3a7e01['push'](_0x3a7e01['shift']());}};_0x5b8398(++_0x51204c);}(_0xaf46,0x18d));var _0x6af4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xaf46[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x6af4('0x0')]={'version':{'type':Sequelize['STRING'],'unique':_0x6af4('0x1')}}; \ No newline at end of file +var _0xa9d2=['STRING','sequelize'];(function(_0xbb14db,_0x3ee8c6){var _0x36bed7=function(_0x16c478){while(--_0x16c478){_0xbb14db['push'](_0xbb14db['shift']());}};_0x36bed7(++_0x3ee8c6);}(_0xa9d2,0x1d9));var _0x2a9d=function(_0x1f0674,_0x41b75e){_0x1f0674=_0x1f0674-0x0;var _0x358d6b=_0xa9d2[_0x1f0674];return _0x358d6b;};'use strict';var Sequelize=require(_0x2a9d('0x0'));module['exports']={'version':{'type':Sequelize[_0x2a9d('0x1')],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 1460fbd..f37e4a4 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 _0x80b9=['limit','count','status','set','Content-Range','apply','save','then','send','index','map','Migration','rawAttributes','fieldName','key','name','query','keys','filters','model','intersection','fields','attributes','length','order','sort','merge','where','type','VIRTUAL','filter','options','includeAll','findAll','rows','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined'];(function(_0xb3c50,_0x2499ab){var _0x25d881=function(_0xea29c5){while(--_0xea29c5){_0xb3c50['push'](_0xb3c50['shift']());}};_0x25d881(++_0x2499ab);}(_0x80b9,0x123));var _0x980b=function(_0x378d01,_0x41ce66){_0x378d01=_0x378d01-0x0;var _0x369360=_0x80b9[_0x378d01];return _0x369360;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x980b('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x980b('0x1'));var BPromise=require(_0x980b('0x2'));var Mustache=require(_0x980b('0x3'));var util=require(_0x980b('0x4'));var path=require(_0x980b('0x5'));var sox=require(_0x980b('0x6'));var csv=require(_0x980b('0x7'));var ejs=require(_0x980b('0x8'));var fs=require('fs');var fs_extra=require(_0x980b('0x9'));var _=require(_0x980b('0xa'));var squel=require(_0x980b('0xb'));var crypto=require(_0x980b('0xc'));var jsforce=require(_0x980b('0xd'));var deskjs=require(_0x980b('0xe'));var toCsv=require(_0x980b('0x7'));var querystring=require(_0x980b('0xf'));var Papa=require(_0x980b('0x10'));var Redis=require(_0x980b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x980b('0x12'));var as=require(_0x980b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x980b('0x14'));var config=require(_0x980b('0x15'));var licenseUtil=require(_0x980b('0x16'));var db=require(_0x980b('0x17'))['db'];function respondWithStatusCode(_0x47f26b,_0x3bbef4){_0x3bbef4=_0x3bbef4||0xcc;return function(_0x3a3e0f){if(_0x3a3e0f){return _0x47f26b[_0x980b('0x18')](_0x3bbef4);}return _0x47f26b['status'](_0x3bbef4)[_0x980b('0x19')]();};}function respondWithResult(_0x5acef7,_0x5aaa6d){_0x5aaa6d=_0x5aaa6d||0xc8;return function(_0x1ab5d8){if(_0x1ab5d8){return _0x5acef7['status'](_0x5aaa6d)[_0x980b('0x1a')](_0x1ab5d8);}};}function respondWithFilteredResult(_0x17bd30,_0x187778){return function(_0x2ae6ab){if(_0x2ae6ab){var _0x186f72=typeof _0x187778[_0x980b('0x1b')]===_0x980b('0x1c')&&typeof _0x187778[_0x980b('0x1d')]===_0x980b('0x1c');var _0x563f6c=_0x2ae6ab['count'];var _0x55f868=_0x186f72?0x0:_0x187778[_0x980b('0x1b')];var _0x557ca5=_0x186f72?_0x2ae6ab[_0x980b('0x1e')]:_0x187778[_0x980b('0x1b')]+_0x187778[_0x980b('0x1d')];var _0x3448f7;if(_0x557ca5>=_0x563f6c){_0x557ca5=_0x563f6c;_0x3448f7=0xc8;}else{_0x3448f7=0xce;}_0x17bd30[_0x980b('0x1f')](_0x3448f7);return _0x17bd30[_0x980b('0x20')](_0x980b('0x21'),_0x55f868+'-'+_0x557ca5+'/'+_0x563f6c)[_0x980b('0x1a')](_0x2ae6ab);}return null;};}function patchUpdates(_0x2f4b2c){return function(_0x3c0605){try{jsonpatch[_0x980b('0x22')](_0x3c0605,_0x2f4b2c,!![]);}catch(_0x32df82){return BPromise['reject'](_0x32df82);}return _0x3c0605[_0x980b('0x23')]();};}function saveUpdates(_0x213c05,_0x3e1d72){return function(_0x5ba20f){if(_0x5ba20f){return _0x5ba20f['update'](_0x213c05)[_0x980b('0x24')](function(_0x70d65a){return _0x70d65a;});}return null;};}function removeEntity(_0x48ca2d,_0x12e91b){return function(_0xef3d75){if(_0xef3d75){return _0xef3d75['destroy']()[_0x980b('0x24')](function(){_0x48ca2d[_0x980b('0x1f')](0xcc)[_0x980b('0x19')]();});}};}function handleEntityNotFound(_0x30034d,_0x56bfc6){return function(_0x241e66){if(!_0x241e66){_0x30034d[_0x980b('0x18')](0x194);}return _0x241e66;};}function handleError(_0xeb000d,_0x5bbc19){_0x5bbc19=_0x5bbc19||0x1f4;return function(_0x7afdd2){logger['error'](_0x7afdd2['stack']);if(_0x7afdd2['name']){delete _0x7afdd2['name'];}_0xeb000d[_0x980b('0x1f')](_0x5bbc19)[_0x980b('0x25')](_0x7afdd2);};}exports[_0x980b('0x26')]=function(_0x45a70f,_0x2e78d2){var _0x43c023={},_0x5713f1={},_0x1bc0e7={'count':0x0,'rows':[]};var _0xef822c=_[_0x980b('0x27')](db[_0x980b('0x28')][_0x980b('0x29')],function(_0xcdd978){return{'name':_0xcdd978[_0x980b('0x2a')],'type':_0xcdd978['type'][_0x980b('0x2b')]};});_0x5713f1['model']=_[_0x980b('0x27')](_0xef822c,_0x980b('0x2c'));_0x5713f1[_0x980b('0x2d')]=_[_0x980b('0x2e')](_0x45a70f['query']);_0x5713f1[_0x980b('0x2f')]=_['intersection'](_0x5713f1[_0x980b('0x30')],_0x5713f1['query']);_0x43c023['attributes']=_[_0x980b('0x31')](_0x5713f1[_0x980b('0x30')],qs[_0x980b('0x32')](_0x45a70f['query']['fields']));_0x43c023[_0x980b('0x33')]=_0x43c023[_0x980b('0x33')][_0x980b('0x34')]?_0x43c023[_0x980b('0x33')]:_0x5713f1[_0x980b('0x30')];if(!_0x45a70f[_0x980b('0x2d')]['hasOwnProperty']('nolimit')){_0x43c023[_0x980b('0x1d')]=qs[_0x980b('0x1d')](_0x45a70f[_0x980b('0x2d')][_0x980b('0x1d')]);_0x43c023[_0x980b('0x1b')]=qs[_0x980b('0x1b')](_0x45a70f[_0x980b('0x2d')][_0x980b('0x1b')]);}_0x43c023[_0x980b('0x35')]=qs[_0x980b('0x36')](_0x45a70f['query'][_0x980b('0x36')]);_0x43c023['where']=qs[_0x980b('0x2f')](_['pick'](_0x45a70f[_0x980b('0x2d')],_0x5713f1['filters']),_0xef822c);if(_0x45a70f[_0x980b('0x2d')]['filter']){_0x43c023['where']=_[_0x980b('0x37')](_0x43c023[_0x980b('0x38')],{'$or':_[_0x980b('0x27')](_0xef822c,function(_0x569024){if(_0x569024[_0x980b('0x39')]!==_0x980b('0x3a')){var _0x2cd1eb={};_0x2cd1eb[_0x569024[_0x980b('0x2c')]]={'$like':'%'+_0x45a70f[_0x980b('0x2d')][_0x980b('0x3b')]+'%'};return _0x2cd1eb;}})});}_0x43c023=_[_0x980b('0x37')]({},_0x43c023,_0x45a70f[_0x980b('0x3c')]);var _0x50e229={'where':_0x43c023[_0x980b('0x38')]};return db['Migration']['count'](_0x50e229)['then'](function(_0x2a04db){_0x1bc0e7['count']=_0x2a04db;if(_0x45a70f['query'][_0x980b('0x3d')]){_0x43c023['include']=[{'all':!![]}];}return db['Migration'][_0x980b('0x3e')](_0x43c023);})[_0x980b('0x24')](function(_0x3a8473){_0x1bc0e7[_0x980b('0x3f')]=_0x3a8473;return _0x1bc0e7;})['then'](respondWithFilteredResult(_0x2e78d2,_0x43c023))['catch'](handleError(_0x2e78d2,null));}; \ No newline at end of file +var _0xe545=['sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','Migration','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x1ead10,_0x112415){var _0xc0bd04=function(_0x2bd86d){while(--_0x2bd86d){_0x1ead10['push'](_0x1ead10['shift']());}};_0xc0bd04(++_0x112415);}(_0xe545,0x6c));var _0x5e54=function(_0x127b66,_0x4e4b4c){_0x127b66=_0x127b66-0x0;var _0x59dc28=_0xe545[_0x127b66];return _0x59dc28;};'use strict';var emlformat=require(_0x5e54('0x0'));var rimraf=require(_0x5e54('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5e54('0x2'));var rp=require(_0x5e54('0x3'));var moment=require(_0x5e54('0x4'));var BPromise=require(_0x5e54('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x5e54('0x6'));var ejs=require(_0x5e54('0x7'));var fs=require('fs');var fs_extra=require(_0x5e54('0x8'));var _=require(_0x5e54('0x9'));var squel=require(_0x5e54('0xa'));var crypto=require(_0x5e54('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5e54('0xc'));var toCsv=require(_0x5e54('0x6'));var querystring=require(_0x5e54('0xd'));var Papa=require(_0x5e54('0xe'));var Redis=require(_0x5e54('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5e54('0x10'))(_0x5e54('0x11'));var utils=require('../../config/utils');var config=require(_0x5e54('0x12'));var licenseUtil=require(_0x5e54('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x106435,_0x4462c3){_0x4462c3=_0x4462c3||0xcc;return function(_0xbd38ba){if(_0xbd38ba){return _0x106435[_0x5e54('0x14')](_0x4462c3);}return _0x106435['status'](_0x4462c3)[_0x5e54('0x15')]();};}function respondWithResult(_0x4c8c2d,_0x90f7f9){_0x90f7f9=_0x90f7f9||0xc8;return function(_0x1068ef){if(_0x1068ef){return _0x4c8c2d[_0x5e54('0x16')](_0x90f7f9)[_0x5e54('0x17')](_0x1068ef);}};}function respondWithFilteredResult(_0x364a5a,_0x53eb50){return function(_0x5e65b4){if(_0x5e65b4){var _0x2bd92e=typeof _0x53eb50[_0x5e54('0x18')]===_0x5e54('0x19')&&typeof _0x53eb50[_0x5e54('0x1a')]==='undefined';var _0x2b865f=_0x5e65b4[_0x5e54('0x1b')];var _0x3e4408=_0x2bd92e?0x0:_0x53eb50['offset'];var _0x2a4f63=_0x2bd92e?_0x5e65b4[_0x5e54('0x1b')]:_0x53eb50[_0x5e54('0x18')]+_0x53eb50['limit'];var _0x56dbda;if(_0x2a4f63>=_0x2b865f){_0x2a4f63=_0x2b865f;_0x56dbda=0xc8;}else{_0x56dbda=0xce;}_0x364a5a[_0x5e54('0x16')](_0x56dbda);return _0x364a5a[_0x5e54('0x1c')]('Content-Range',_0x3e4408+'-'+_0x2a4f63+'/'+_0x2b865f)[_0x5e54('0x17')](_0x5e65b4);}return null;};}function patchUpdates(_0x50d8c8){return function(_0x531bef){try{jsonpatch[_0x5e54('0x1d')](_0x531bef,_0x50d8c8,!![]);}catch(_0xd48ffd){return BPromise[_0x5e54('0x1e')](_0xd48ffd);}return _0x531bef[_0x5e54('0x1f')]();};}function saveUpdates(_0x44cbfa,_0xa89225){return function(_0x429067){if(_0x429067){return _0x429067[_0x5e54('0x20')](_0x44cbfa)[_0x5e54('0x21')](function(_0x1d470f){return _0x1d470f;});}return null;};}function removeEntity(_0x5dd45d,_0x129e2a){return function(_0x9ce395){if(_0x9ce395){return _0x9ce395[_0x5e54('0x22')]()[_0x5e54('0x21')](function(){_0x5dd45d['status'](0xcc)[_0x5e54('0x15')]();});}};}function handleEntityNotFound(_0x16a724,_0xea16cd){return function(_0x41b078){if(!_0x41b078){_0x16a724[_0x5e54('0x14')](0x194);}return _0x41b078;};}function handleError(_0x3bc6c4,_0x76a55d){_0x76a55d=_0x76a55d||0x1f4;return function(_0x6990b){logger[_0x5e54('0x23')](_0x6990b[_0x5e54('0x24')]);if(_0x6990b[_0x5e54('0x25')]){delete _0x6990b[_0x5e54('0x25')];}_0x3bc6c4[_0x5e54('0x16')](_0x76a55d)[_0x5e54('0x26')](_0x6990b);};}exports[_0x5e54('0x27')]=function(_0x3e9802,_0x193f8e){var _0x41f369={},_0x467507={},_0x1e4486={'count':0x0,'rows':[]};var _0x52b8f3=_['map'](db[_0x5e54('0x28')]['rawAttributes'],function(_0x2560aa){return{'name':_0x2560aa[_0x5e54('0x29')],'type':_0x2560aa[_0x5e54('0x2a')][_0x5e54('0x2b')]};});_0x467507[_0x5e54('0x2c')]=_['map'](_0x52b8f3,_0x5e54('0x25'));_0x467507[_0x5e54('0x2d')]=_[_0x5e54('0x2e')](_0x3e9802['query']);_0x467507['filters']=_[_0x5e54('0x2f')](_0x467507['model'],_0x467507[_0x5e54('0x2d')]);_0x41f369[_0x5e54('0x30')]=_[_0x5e54('0x2f')](_0x467507['model'],qs[_0x5e54('0x31')](_0x3e9802[_0x5e54('0x2d')][_0x5e54('0x31')]));_0x41f369['attributes']=_0x41f369[_0x5e54('0x30')]['length']?_0x41f369['attributes']:_0x467507[_0x5e54('0x2c')];if(!_0x3e9802[_0x5e54('0x2d')][_0x5e54('0x32')](_0x5e54('0x33'))){_0x41f369[_0x5e54('0x1a')]=qs[_0x5e54('0x1a')](_0x3e9802['query'][_0x5e54('0x1a')]);_0x41f369[_0x5e54('0x18')]=qs[_0x5e54('0x18')](_0x3e9802[_0x5e54('0x2d')][_0x5e54('0x18')]);}_0x41f369['order']=qs['sort'](_0x3e9802[_0x5e54('0x2d')][_0x5e54('0x34')]);_0x41f369[_0x5e54('0x35')]=qs[_0x5e54('0x36')](_[_0x5e54('0x37')](_0x3e9802[_0x5e54('0x2d')],_0x467507[_0x5e54('0x36')]),_0x52b8f3);if(_0x3e9802[_0x5e54('0x2d')][_0x5e54('0x38')]){_0x41f369[_0x5e54('0x35')]=_['merge'](_0x41f369[_0x5e54('0x35')],{'$or':_['map'](_0x52b8f3,function(_0x4107ea){if(_0x4107ea[_0x5e54('0x2a')]!==_0x5e54('0x39')){var _0x299c0c={};_0x299c0c[_0x4107ea[_0x5e54('0x25')]]={'$like':'%'+_0x3e9802[_0x5e54('0x2d')][_0x5e54('0x38')]+'%'};return _0x299c0c;}})});}_0x41f369=_[_0x5e54('0x3a')]({},_0x41f369,_0x3e9802[_0x5e54('0x3b')]);var _0x47ceb7={'where':_0x41f369[_0x5e54('0x35')]};return db[_0x5e54('0x28')][_0x5e54('0x1b')](_0x47ceb7)[_0x5e54('0x21')](function(_0x5dc8f0){_0x1e4486[_0x5e54('0x1b')]=_0x5dc8f0;if(_0x3e9802['query'][_0x5e54('0x3c')]){_0x41f369[_0x5e54('0x3d')]=[{'all':!![]}];}return db[_0x5e54('0x28')]['findAll'](_0x41f369);})[_0x5e54('0x21')](function(_0xe39cb8){_0x1e4486[_0x5e54('0x3e')]=_0xe39cb8;return _0x1e4486;})[_0x5e54('0x21')](respondWithFilteredResult(_0x193f8e,_0x41f369))[_0x5e54('0x3f')](handleError(_0x193f8e,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 01639df..6666514 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 _0x35b6=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','exports','define','Migration','migrations','lodash','util'];(function(_0x85a82,_0x425ea3){var _0x388c77=function(_0x10f459){while(--_0x10f459){_0x85a82['push'](_0x85a82['shift']());}};_0x388c77(++_0x425ea3);}(_0x35b6,0x10c));var _0x635b=function(_0x3c2aab,_0x55c76d){_0x3c2aab=_0x3c2aab-0x0;var _0x17f6e8=_0x35b6[_0x3c2aab];return _0x17f6e8;};'use strict';var _=require(_0x635b('0x0'));var util=require(_0x635b('0x1'));var logger=require(_0x635b('0x2'))(_0x635b('0x3'));var moment=require(_0x635b('0x4'));var BPromise=require(_0x635b('0x5'));var rp=require(_0x635b('0x6'));var fs=require('fs');var path=require(_0x635b('0x7'));var rimraf=require(_0x635b('0x8'));var config=require(_0x635b('0x9'));var attributes=require(_0x635b('0xa'));module[_0x635b('0xb')]=function(_0x4b9455,_0x4f8983){return _0x4b9455[_0x635b('0xc')](_0x635b('0xd'),attributes,{'tableName':_0x635b('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c11=['Migration','migrations','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','exports'];(function(_0x1526cf,_0x4f952f){var _0x32ffbd=function(_0x196a69){while(--_0x196a69){_0x1526cf['push'](_0x1526cf['shift']());}};_0x32ffbd(++_0x4f952f);}(_0x3c11,0x6e));var _0x13c1=function(_0x26ae39,_0x55e75c){_0x26ae39=_0x26ae39-0x0;var _0x3c871f=_0x3c11[_0x26ae39];return _0x3c871f;};'use strict';var _=require(_0x13c1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x13c1('0x1'));var moment=require(_0x13c1('0x2'));var BPromise=require(_0x13c1('0x3'));var rp=require(_0x13c1('0x4'));var fs=require('fs');var path=require(_0x13c1('0x5'));var rimraf=require(_0x13c1('0x6'));var config=require(_0x13c1('0x7'));var attributes=require(_0x13c1('0x8'));module[_0x13c1('0x9')]=function(_0x6d6f8,_0x4ea1ba){return _0x6d6f8['define'](_0x13c1('0xa'),attributes,{'tableName':_0x13c1('0xb'),'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 5739944..5df6293 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 _0x7ec2=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','moment','randomstring'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x7ec2,0x15c));var _0x27ec=function(_0x59a4c9,_0x6745e){_0x59a4c9=_0x59a4c9-0x0;var _0x5781c9=_0x7ec2[_0x59a4c9];return _0x5781c9;};'use strict';var _=require(_0x27ec('0x0'));var util=require(_0x27ec('0x1'));var moment=require(_0x27ec('0x2'));var BPromise=require('bluebird');var rs=require(_0x27ec('0x3'));var fs=require('fs');var Redis=require(_0x27ec('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x27ec('0x5'));var logger=require(_0x27ec('0x6'))(_0x27ec('0x7'));var config=require(_0x27ec('0x8'));var jayson=require(_0x27ec('0x9'));var client=jayson[_0x27ec('0xa')][_0x27ec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x280cdb,_0x27b57c,_0x1ad634){return new BPromise(function(_0x37903a,_0x43d129){return client[_0x27ec('0xc')](_0x280cdb,_0x1ad634)[_0x27ec('0xd')](function(_0x1000e5){logger[_0x27ec('0xe')](_0x27ec('0xf'),_0x27b57c,_0x27ec('0x10'));logger[_0x27ec('0x11')](_0x27ec('0x12'),_0x27b57c,_0x27ec('0x10'),JSON['stringify'](_0x1000e5));if(_0x1000e5[_0x27ec('0x13')]){if(_0x1000e5[_0x27ec('0x13')][_0x27ec('0x14')]===0x1f4){logger[_0x27ec('0x13')]('Migration,\x20%s,\x20%s',_0x27b57c,_0x1000e5[_0x27ec('0x13')]['message']);return _0x43d129(_0x1000e5[_0x27ec('0x13')][_0x27ec('0x15')]);}logger[_0x27ec('0x13')](_0x27ec('0xf'),_0x27b57c,_0x1000e5[_0x27ec('0x13')][_0x27ec('0x15')]);return _0x37903a(_0x1000e5[_0x27ec('0x13')]['message']);}else{logger[_0x27ec('0xe')](_0x27ec('0xf'),_0x27b57c,'request\x20sent');_0x37903a(_0x1000e5['result'][_0x27ec('0x15')]);}})['catch'](function(_0x440335){logger[_0x27ec('0x13')](_0x27ec('0xf'),_0x27b57c,_0x440335);_0x43d129(_0x440335);});});} \ No newline at end of file +var _0xffe1=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','bluebird','ioredis','../../config/utils'];(function(_0x4f5673,_0x5d4e3f){var _0x2dfcfe=function(_0x49f9fd){while(--_0x49f9fd){_0x4f5673['push'](_0x4f5673['shift']());}};_0x2dfcfe(++_0x5d4e3f);}(_0xffe1,0x187));var _0x1ffe=function(_0x121536,_0x56cc32){_0x121536=_0x121536-0x0;var _0x22ca75=_0xffe1[_0x121536];return _0x22ca75;};'use strict';var _=require(_0x1ffe('0x0'));var util=require(_0x1ffe('0x1'));var moment=require('moment');var BPromise=require(_0x1ffe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1ffe('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1ffe('0x4'));var logger=require(_0x1ffe('0x5'))(_0x1ffe('0x6'));var config=require(_0x1ffe('0x7'));var jayson=require(_0x1ffe('0x8'));var client=jayson[_0x1ffe('0x9')][_0x1ffe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37df04,_0x41a9f9,_0x548bc9){return new BPromise(function(_0x1c6bdb,_0x4c125e){return client[_0x1ffe('0xb')](_0x37df04,_0x548bc9)['then'](function(_0x29f784){logger['info'](_0x1ffe('0xc'),_0x41a9f9,_0x1ffe('0xd'));logger[_0x1ffe('0xe')](_0x1ffe('0xf'),_0x41a9f9,_0x1ffe('0xd'),JSON[_0x1ffe('0x10')](_0x29f784));if(_0x29f784[_0x1ffe('0x11')]){if(_0x29f784[_0x1ffe('0x11')][_0x1ffe('0x12')]===0x1f4){logger['error']('Migration,\x20%s,\x20%s',_0x41a9f9,_0x29f784[_0x1ffe('0x11')][_0x1ffe('0x13')]);return _0x4c125e(_0x29f784[_0x1ffe('0x11')][_0x1ffe('0x13')]);}logger[_0x1ffe('0x11')](_0x1ffe('0xc'),_0x41a9f9,_0x29f784[_0x1ffe('0x11')]['message']);return _0x1c6bdb(_0x29f784[_0x1ffe('0x11')][_0x1ffe('0x13')]);}else{logger[_0x1ffe('0x14')](_0x1ffe('0xc'),_0x41a9f9,_0x1ffe('0xd'));_0x1c6bdb(_0x29f784[_0x1ffe('0x15')][_0x1ffe('0x13')]);}})['catch'](function(_0x4d5cee){logger['error'](_0x1ffe('0xc'),_0x41a9f9,_0x4d5cee);_0x4c125e(_0x4d5cee);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 987d45b..65ed10f 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 _0x7d10=['create','put','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./network.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0xcbefb6,_0x4a6ca6){var _0x195f12=function(_0xd7af60){while(--_0xd7af60){_0xcbefb6['push'](_0xcbefb6['shift']());}};_0x195f12(++_0x4a6ca6);}(_0x7d10,0x1ce));var _0x07d1=function(_0x33a813,_0xd491c5){_0x33a813=_0x33a813-0x0;var _0x2e1506=_0x7d10[_0x33a813];return _0x2e1506;};'use strict';var multer=require('multer');var util=require(_0x07d1('0x0'));var path=require(_0x07d1('0x1'));var timeout=require('connect-timeout');var express=require(_0x07d1('0x2'));var router=express[_0x07d1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x07d1('0x4'));var interaction=require(_0x07d1('0x5'));var config=require('../../config/environment');var controller=require(_0x07d1('0x6'));router[_0x07d1('0x7')]('/',auth[_0x07d1('0x8')](),controller[_0x07d1('0x9')]);router['get'](_0x07d1('0xa'),auth[_0x07d1('0x8')](),controller[_0x07d1('0xb')]);router[_0x07d1('0xc')]('/',auth[_0x07d1('0x8')](),controller[_0x07d1('0xd')]);router[_0x07d1('0xe')](_0x07d1('0xa'),auth[_0x07d1('0x8')](),controller[_0x07d1('0xf')]);router[_0x07d1('0x10')](_0x07d1('0xa'),auth[_0x07d1('0x8')](),controller[_0x07d1('0x11')]);module[_0x07d1('0x12')]=router; \ No newline at end of file +var _0x6365=['put','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','create'];(function(_0x4af01e,_0x543f5c){var _0x178c11=function(_0x2c2f76){while(--_0x2c2f76){_0x4af01e['push'](_0x4af01e['shift']());}};_0x178c11(++_0x543f5c);}(_0x6365,0x148));var _0x5636=function(_0x213ac2,_0x2dcd9b){_0x213ac2=_0x213ac2-0x0;var _0x24c810=_0x6365[_0x213ac2];return _0x24c810;};'use strict';var multer=require(_0x5636('0x0'));var util=require(_0x5636('0x1'));var path=require(_0x5636('0x2'));var timeout=require(_0x5636('0x3'));var express=require('express');var router=express[_0x5636('0x4')]();var fs_extra=require(_0x5636('0x5'));var auth=require(_0x5636('0x6'));var interaction=require(_0x5636('0x7'));var config=require(_0x5636('0x8'));var controller=require('./network.controller');router[_0x5636('0x9')]('/',auth[_0x5636('0xa')](),controller[_0x5636('0xb')]);router[_0x5636('0x9')]('/:id',auth[_0x5636('0xa')](),controller[_0x5636('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5636('0xd')]);router[_0x5636('0xe')](_0x5636('0xf'),auth[_0x5636('0xa')](),controller['update']);router['delete'](_0x5636('0xf'),auth['isAuthenticated'](),controller[_0x5636('0x10')]);module[_0x5636('0x11')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 0e49d7e..4bbe6aa 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 _0x4c95=['sequelize','exports','localnet','stun','turn','STRING'];(function(_0x39106e,_0x586f3d){var _0x892aec=function(_0xded1b5){while(--_0xded1b5){_0x39106e['push'](_0x39106e['shift']());}};_0x892aec(++_0x586f3d);}(_0x4c95,0x1da));var _0x54c9=function(_0x5c33ff,_0x31d35c){_0x5c33ff=_0x5c33ff-0x0;var _0x4c3fbf=_0x4c95[_0x5c33ff];return _0x4c3fbf;};'use strict';var Sequelize=require(_0x54c9('0x0'));module[_0x54c9('0x1')]={'type':{'type':Sequelize['ENUM'](_0x54c9('0x2'),'externip',_0x54c9('0x3'),_0x54c9('0x4'))},'value':{'type':Sequelize[_0x54c9('0x5')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x54c9('0x5')]}}; \ No newline at end of file +var _0x0f0a=['exports','ENUM','externip','sequelize'];(function(_0x1c1d78,_0x7c8495){var _0x4e369e=function(_0x2d8ba5){while(--_0x2d8ba5){_0x1c1d78['push'](_0x1c1d78['shift']());}};_0x4e369e(++_0x7c8495);}(_0x0f0a,0x197));var _0xa0f0=function(_0x104a6b,_0x1190c6){_0x104a6b=_0x104a6b-0x0;var _0x517db0=_0x0f0a[_0x104a6b];return _0x517db0;};'use strict';var Sequelize=require(_0xa0f0('0x0'));module[_0xa0f0('0x1')]={'type':{'type':Sequelize[_0xa0f0('0x2')]('localnet',_0xa0f0('0x3'),'stun','turn')},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 5a31889..32abc48 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 _0xfbae=['body','toUpperCase','STUN','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','readFileSync','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','/etc/asterisk/turn_xcally.conf','server/files/templates/turn_multiple.ejs','util','path','ejs','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','Network,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','status','json','offset','undefined','count','limit','set','Content-Range','update','destroy','end','sendStatus','stack','name','index','map','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','Network','include','findAll','params','rawAttributes','keys','length','includeAll','find','create'];(function(_0x1c3eb7,_0x257c46){var _0x617b2a=function(_0x3ea1d0){while(--_0x3ea1d0){_0x1c3eb7['push'](_0x1c3eb7['shift']());}};_0x617b2a(++_0x257c46);}(_0xfbae,0x1be));var _0xefba=function(_0xf82af7,_0x598481){_0xf82af7=_0xf82af7-0x0;var _0x2a1867=_0xfbae[_0xf82af7];return _0x2a1867;};'use strict';var util=require(_0xefba('0x0'));var path=require(_0xefba('0x1'));var ejs=require(_0xefba('0x2'));var fs=require('fs');var _=require(_0xefba('0x3'));var qs=require(_0xefba('0x4'));var logger=require(_0xefba('0x5'))('api');var config=require(_0xefba('0x6'));var db=require(_0xefba('0x7'))['db'];var jayson=require(_0xefba('0x8'));var client=jayson[_0xefba('0x9')][_0xefba('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x325e9f,_0x478023,_0xbe37dd,_0x14da2a){return new Promise(function(_0x3c49e5,_0x2612e8){var _0x3998ee=_0x14da2a||client;return _0x3998ee[_0xefba('0xb')](_0x325e9f,_0xbe37dd)[_0xefba('0xc')](function(_0x19ebcc){logger['info'](_0xefba('0xd'),_0x478023,_0xefba('0xe'));logger['debug']('Network,\x20%s,\x20%s,\x20%s',_0x478023,_0xefba('0xe'),JSON[_0xefba('0xf')](_0x19ebcc));if(_0x19ebcc[_0xefba('0x10')]){if(_0x19ebcc[_0xefba('0x10')]['code']===0x1f4){logger[_0xefba('0x10')](_0xefba('0xd'),_0x478023,_0x19ebcc[_0xefba('0x10')]['message']);return _0x2612e8(_0x19ebcc[_0xefba('0x10')][_0xefba('0x11')]);}logger[_0xefba('0x10')](_0xefba('0xd'),_0x478023,_0x19ebcc[_0xefba('0x10')][_0xefba('0x11')]);return _0x3c49e5(_0x19ebcc[_0xefba('0x10')][_0xefba('0x11')]);}else{logger[_0xefba('0x12')](_0xefba('0xd'),_0x478023,'request\x20sent');_0x3c49e5(_0x19ebcc[_0xefba('0x13')]['message']);}})[_0xefba('0x14')](function(_0x26e1ee){logger['error'](_0xefba('0xd'),_0x478023,_0x26e1ee);_0x2612e8(_0x26e1ee);});});}function respondWithResult(_0x234680,_0x281db4){_0x281db4=_0x281db4||0xc8;return function(_0x139275){if(_0x139275){return _0x234680[_0xefba('0x15')](_0x281db4)[_0xefba('0x16')](_0x139275);}};}function respondWithFilteredResult(_0x4fab22,_0x26ded9){return function(_0x124995){if(_0x124995){var _0x4e6c31=typeof _0x26ded9[_0xefba('0x17')]===_0xefba('0x18')&&typeof _0x26ded9['limit']===_0xefba('0x18');var _0x254593=_0x124995[_0xefba('0x19')];var _0x305078=_0x4e6c31?0x0:_0x26ded9[_0xefba('0x17')];var _0xbd12aa=_0x4e6c31?_0x124995[_0xefba('0x19')]:_0x26ded9[_0xefba('0x17')]+_0x26ded9[_0xefba('0x1a')];var _0x5261ad;if(_0xbd12aa>=_0x254593){_0xbd12aa=_0x254593;_0x5261ad=0xc8;}else{_0x5261ad=0xce;}_0x4fab22[_0xefba('0x15')](_0x5261ad);return _0x4fab22[_0xefba('0x1b')](_0xefba('0x1c'),_0x305078+'-'+_0xbd12aa+'/'+_0x254593)[_0xefba('0x16')](_0x124995);}return null;};}function saveUpdates(_0x14a806){return function(_0x9093db){if(_0x9093db){return _0x9093db[_0xefba('0x1d')](_0x14a806)[_0xefba('0xc')](function(_0x2fe6fd){return _0x2fe6fd;});}return null;};}function removeEntity(_0x457ec7){return function(_0x514ec8){if(_0x514ec8){return _0x514ec8[_0xefba('0x1e')]()['then'](function(){_0x457ec7[_0xefba('0x15')](0xcc)[_0xefba('0x1f')]();});}};}function handleEntityNotFound(_0x210739){return function(_0x5b09da){if(!_0x5b09da){_0x210739[_0xefba('0x20')](0x194);}return _0x5b09da;};}function handleError(_0x52c14d,_0x34653a){_0x34653a=_0x34653a||0x1f4;return function(_0x510fb8){logger[_0xefba('0x10')](_0x510fb8[_0xefba('0x21')]);if(_0x510fb8['name']){delete _0x510fb8[_0xefba('0x22')];}_0x52c14d[_0xefba('0x15')](_0x34653a)['send'](_0x510fb8);};}exports[_0xefba('0x23')]=function(_0x425c6e,_0x20c24b){var _0x2eccc5={},_0x2e3326={},_0x33bd22={'count':0x0,'rows':[]};var _0x38f673=_[_0xefba('0x24')](db['Network']['rawAttributes'],function(_0x28adfc){return{'name':_0x28adfc['fieldName'],'type':_0x28adfc[_0xefba('0x25')][_0xefba('0x26')]};});_0x2e3326[_0xefba('0x27')]=_[_0xefba('0x24')](_0x38f673,_0xefba('0x22'));_0x2e3326[_0xefba('0x28')]=_['keys'](_0x425c6e[_0xefba('0x28')]);_0x2e3326[_0xefba('0x29')]=_[_0xefba('0x2a')](_0x2e3326['model'],_0x2e3326[_0xefba('0x28')]);_0x2eccc5['attributes']=_[_0xefba('0x2a')](_0x2e3326['model'],qs[_0xefba('0x2b')](_0x425c6e['query'][_0xefba('0x2b')]));_0x2eccc5[_0xefba('0x2c')]=_0x2eccc5['attributes']['length']?_0x2eccc5['attributes']:_0x2e3326[_0xefba('0x27')];if(!_0x425c6e[_0xefba('0x28')][_0xefba('0x2d')](_0xefba('0x2e'))){_0x2eccc5[_0xefba('0x1a')]=qs[_0xefba('0x1a')](_0x425c6e[_0xefba('0x28')]['limit']);_0x2eccc5[_0xefba('0x17')]=qs[_0xefba('0x17')](_0x425c6e['query'][_0xefba('0x17')]);}_0x2eccc5[_0xefba('0x2f')]=qs['sort'](_0x425c6e[_0xefba('0x28')]['sort']);_0x2eccc5[_0xefba('0x30')]=qs[_0xefba('0x29')](_[_0xefba('0x31')](_0x425c6e[_0xefba('0x28')],_0x2e3326['filters']),_0x38f673);if(_0x425c6e[_0xefba('0x28')][_0xefba('0x32')]){_0x2eccc5[_0xefba('0x30')]=_[_0xefba('0x33')](_0x2eccc5['where'],{'$or':_[_0xefba('0x24')](_0x38f673,function(_0x327896){if(_0x327896['type']!==_0xefba('0x34')){var _0x69d271={};_0x69d271[_0x327896[_0xefba('0x22')]]={'$like':'%'+_0x425c6e['query'][_0xefba('0x32')]+'%'};return _0x69d271;}})});}_0x2eccc5=_[_0xefba('0x33')]({},_0x2eccc5,_0x425c6e[_0xefba('0x35')]);var _0x516adf={'where':_0x2eccc5[_0xefba('0x30')]};return db[_0xefba('0x36')][_0xefba('0x19')](_0x516adf)['then'](function(_0x2f2b07){_0x33bd22[_0xefba('0x19')]=_0x2f2b07;if(_0x425c6e[_0xefba('0x28')]['includeAll']){_0x2eccc5[_0xefba('0x37')]=[{'all':!![]}];}return db['Network'][_0xefba('0x38')](_0x2eccc5);})[_0xefba('0xc')](function(_0x2c62d5){_0x33bd22['rows']=_0x2c62d5;return _0x33bd22;})['then'](respondWithFilteredResult(_0x20c24b,_0x2eccc5))[_0xefba('0x14')](handleError(_0x20c24b,null));};exports['show']=function(_0x1c5f61,_0x3a1a08){var _0x9304fc={'raw':!![],'where':{'id':_0x1c5f61[_0xefba('0x39')]['id']}},_0x597a1e={};_0x597a1e[_0xefba('0x27')]=_['keys'](db[_0xefba('0x36')][_0xefba('0x3a')]);_0x597a1e[_0xefba('0x28')]=_[_0xefba('0x3b')](_0x1c5f61[_0xefba('0x28')]);_0x597a1e[_0xefba('0x29')]=_[_0xefba('0x2a')](_0x597a1e['model'],_0x597a1e[_0xefba('0x28')]);_0x9304fc[_0xefba('0x2c')]=_[_0xefba('0x2a')](_0x597a1e[_0xefba('0x27')],qs[_0xefba('0x2b')](_0x1c5f61['query'][_0xefba('0x2b')]));_0x9304fc[_0xefba('0x2c')]=_0x9304fc[_0xefba('0x2c')][_0xefba('0x3c')]?_0x9304fc[_0xefba('0x2c')]:_0x597a1e[_0xefba('0x27')];if(_0x1c5f61[_0xefba('0x28')][_0xefba('0x3d')]){_0x9304fc[_0xefba('0x37')]=[{'all':!![]}];}_0x9304fc=_['merge']({},_0x9304fc,_0x1c5f61['options']);return db['Network'][_0xefba('0x3e')](_0x9304fc)[_0xefba('0xc')](handleEntityNotFound(_0x3a1a08,null))[_0xefba('0xc')](respondWithResult(_0x3a1a08,null))['catch'](handleError(_0x3a1a08,null));};exports[_0xefba('0x3f')]=function(_0x155454,_0x338d40){var _0x1163b2;return db[_0xefba('0x36')][_0xefba('0x3f')](_0x155454[_0xefba('0x40')],{'raw':!![]})[_0xefba('0xc')](function(_0x45edcc){_0x1163b2=_0x45edcc;return db['Network'][_0xefba('0x38')]({'where':{'type':_0x155454[_0xefba('0x40')]['type']},'raw':!![]});})[_0xefba('0xc')](function(_0x21943c){if(_0x1163b2[_0xefba('0x25')][_0xefba('0x41')]()==_0xefba('0x42')){var _0x36d2d7=fs['readFileSync'](path[_0xefba('0x43')](config[_0xefba('0x44')],_0xefba('0x45')),_0xefba('0x46'));var _0x2b897f=ejs[_0xefba('0x47')](_0x36d2d7,{'networks':_0x21943c||[]});fs[_0xefba('0x48')](_0xefba('0x49'),_0x2b897f);return respondWithRpcPromise(_0xefba('0x4a'),_0xefba('0x3f'),{'module':_0xefba('0x4b')});}else if(_0x1163b2[_0xefba('0x25')][_0xefba('0x41')]()==_0xefba('0x4c')){var _0x3251ff=fs[_0xefba('0x4d')](path['join'](config[_0xefba('0x44')],'server/files/templates/turn_multiple.ejs'),_0xefba('0x46'));var _0x58de26=ejs['render'](_0x3251ff,{'networks':_0x21943c||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x58de26);return respondWithRpcPromise(_0xefba('0x4a'),_0xefba('0x3f'),{'module':_0xefba('0x4b')});}else{var _0x293f03=fs['readFileSync'](path[_0xefba('0x43')](config[_0xefba('0x44')],_0xefba('0x4e')),_0xefba('0x46'));var _0x26140a=ejs[_0xefba('0x47')](_0x293f03,{'networks':_0x21943c||[]});fs[_0xefba('0x48')](util[_0xefba('0x4f')](_0xefba('0x50'),_0x155454['body']['type'][_0xefba('0x51')]()),_0x26140a);return respondWithRpcPromise('Reload',_0xefba('0x3f'),{'module':_0xefba('0x52')});}})[_0xefba('0xc')](function(){return _0x1163b2;})[_0xefba('0xc')](respondWithResult(_0x338d40,0xc9))['catch'](handleError(_0x338d40,null));};exports[_0xefba('0x1d')]=function(_0x1194c3,_0x196c07){var _0x40550b;return db[_0xefba('0x36')][_0xefba('0x3e')]({'where':{'id':_0x1194c3['params']['id']}})[_0xefba('0xc')](handleEntityNotFound(_0x196c07,null))[_0xefba('0xc')](saveUpdates(_0x1194c3[_0xefba('0x40')],null))[_0xefba('0xc')](function(_0x5ef59e){if(_0x5ef59e){_0x40550b=_0x5ef59e;return db['Network']['findAll']({'where':{'type':_0x40550b['type']},'raw':!![]});}return null;})[_0xefba('0xc')](function(_0x46363a){if(_0x40550b[_0xefba('0x25')][_0xefba('0x41')]()==_0xefba('0x42')){var _0x3ba50e=fs[_0xefba('0x4d')](path[_0xefba('0x43')](config[_0xefba('0x44')],_0xefba('0x45')),'utf8');var _0x57c756=ejs[_0xefba('0x47')](_0x3ba50e,{'networks':_0x46363a||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x57c756);return respondWithRpcPromise(_0xefba('0x4a'),_0xefba('0x1d'),{'module':'res_stun_monitor.so'});}else if(_0x40550b[_0xefba('0x25')]['toUpperCase']()=='TURN'){var _0x41d906=fs['readFileSync'](path[_0xefba('0x43')](config[_0xefba('0x44')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x22e716=ejs['render'](_0x41d906,{'networks':_0x46363a||[]});fs[_0xefba('0x48')](_0xefba('0x53'),_0x22e716);return respondWithRpcPromise(_0xefba('0x4a'),_0xefba('0x1d'),{'module':_0xefba('0x4b')});}else{var _0x5c4ae4=fs[_0xefba('0x4d')](path['join'](config[_0xefba('0x44')],_0xefba('0x4e')),_0xefba('0x46'));var _0x315b30=ejs['render'](_0x5c4ae4,{'networks':_0x46363a||[]});fs[_0xefba('0x48')](util[_0xefba('0x4f')](_0xefba('0x50'),_0x1194c3[_0xefba('0x40')][_0xefba('0x25')]['toLowerCase']()),_0x315b30);return respondWithRpcPromise(_0xefba('0x4a'),'update',{'module':_0xefba('0x52')});}})[_0xefba('0xc')](function(_0x262036){if(_0x262036){return _0x40550b;}return null;})[_0xefba('0xc')](respondWithResult(_0x196c07,null))[_0xefba('0x14')](handleError(_0x196c07,null));};exports[_0xefba('0x1e')]=function(_0x422a54,_0x35d81c){var _0x2bd4ad;return db['Network'][_0xefba('0x3e')]({'where':{'id':_0x422a54['params']['id']}})[_0xefba('0xc')](function(_0x25aedc){_0x2bd4ad=_0x25aedc;return _0x25aedc;})[_0xefba('0xc')](handleEntityNotFound(_0x35d81c,null))[_0xefba('0xc')](removeEntity(_0x35d81c,null))[_0xefba('0xc')](function(){if(_0x2bd4ad){return db[_0xefba('0x36')][_0xefba('0x38')]({'where':{'type':_0x2bd4ad[_0xefba('0x25')]},'raw':!![]});}})['then'](function(_0x1c6ff0){if(_0x2bd4ad[_0xefba('0x25')][_0xefba('0x41')]()==_0xefba('0x42')){var _0x186f43=fs[_0xefba('0x4d')](path[_0xefba('0x43')](config['root'],_0xefba('0x45')),_0xefba('0x46'));var _0xdec4a5=ejs[_0xefba('0x47')](_0x186f43,{'networks':_0x1c6ff0||[]});fs[_0xefba('0x48')]('/etc/asterisk/stun_xcally.conf',_0xdec4a5);return respondWithRpcPromise(_0xefba('0x4a'),_0xefba('0x1e'),{'module':_0xefba('0x4b')});}else if(_0x2bd4ad[_0xefba('0x25')]['toUpperCase']()==_0xefba('0x4c')){var _0x5dc80c=fs['readFileSync'](path[_0xefba('0x43')](config['root'],_0xefba('0x54')),'utf8');var _0x4cfa17=ejs['render'](_0x5dc80c,{'networks':_0x1c6ff0||[]});fs[_0xefba('0x48')](_0xefba('0x53'),_0x4cfa17);return respondWithRpcPromise(_0xefba('0x4a'),_0xefba('0x1e'),{'module':_0xefba('0x4b')});}else{var _0x4514eb=fs[_0xefba('0x4d')](path[_0xefba('0x43')](config[_0xefba('0x44')],_0xefba('0x4e')),_0xefba('0x46'));var _0x29382b=ejs[_0xefba('0x47')](_0x4514eb,{'networks':_0x1c6ff0||[]});fs[_0xefba('0x48')](util['format'](_0xefba('0x50'),_0x2bd4ad['type']['toLowerCase']()),_0x29382b);return respondWithRpcPromise(_0xefba('0x4a'),_0xefba('0x1e'),{'module':_0xefba('0x52')});}})[_0xefba('0x14')](handleError(_0x35d81c,null));}; \ No newline at end of file +var _0x58dd=['message','result','catch','status','json','offset','undefined','limit','set','update','destroy','then','end','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Network','count','include','findAll','rows','show','params','includeAll','create','body','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs','utf8','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','toUpperCase','TURN','join','server/files/templates/turn_multiple.ejs','render','Reload','writeFileSync','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','util','path','ejs','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','Network,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code'];(function(_0x101778,_0x184196){var _0x4d0e62=function(_0x4b65bf){while(--_0x4b65bf){_0x101778['push'](_0x101778['shift']());}};_0x4d0e62(++_0x184196);}(_0x58dd,0x14d));var _0xd58d=function(_0x27b4a0,_0xb1279f){_0x27b4a0=_0x27b4a0-0x0;var _0x1cc589=_0x58dd[_0x27b4a0];return _0x1cc589;};'use strict';var util=require(_0xd58d('0x0'));var path=require(_0xd58d('0x1'));var ejs=require(_0xd58d('0x2'));var fs=require('fs');var _=require(_0xd58d('0x3'));var qs=require(_0xd58d('0x4'));var logger=require(_0xd58d('0x5'))('api');var config=require(_0xd58d('0x6'));var db=require(_0xd58d('0x7'))['db'];var jayson=require(_0xd58d('0x8'));var client=jayson[_0xd58d('0x9')][_0xd58d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54cc53,_0x2ee254,_0x3e6282,_0x199cff){return new Promise(function(_0x1c48e4,_0x34af1f){var _0x3714af=_0x199cff||client;return _0x3714af[_0xd58d('0xb')](_0x54cc53,_0x3e6282)['then'](function(_0x33cd95){logger[_0xd58d('0xc')](_0xd58d('0xd'),_0x2ee254,'request\x20sent');logger[_0xd58d('0xe')]('Network,\x20%s,\x20%s,\x20%s',_0x2ee254,_0xd58d('0xf'),JSON[_0xd58d('0x10')](_0x33cd95));if(_0x33cd95['error']){if(_0x33cd95[_0xd58d('0x11')][_0xd58d('0x12')]===0x1f4){logger[_0xd58d('0x11')](_0xd58d('0xd'),_0x2ee254,_0x33cd95[_0xd58d('0x11')][_0xd58d('0x13')]);return _0x34af1f(_0x33cd95[_0xd58d('0x11')][_0xd58d('0x13')]);}logger[_0xd58d('0x11')]('Network,\x20%s,\x20%s',_0x2ee254,_0x33cd95['error'][_0xd58d('0x13')]);return _0x1c48e4(_0x33cd95[_0xd58d('0x11')][_0xd58d('0x13')]);}else{logger[_0xd58d('0xc')](_0xd58d('0xd'),_0x2ee254,_0xd58d('0xf'));_0x1c48e4(_0x33cd95[_0xd58d('0x14')][_0xd58d('0x13')]);}})[_0xd58d('0x15')](function(_0x16b17b){logger['error'](_0xd58d('0xd'),_0x2ee254,_0x16b17b);_0x34af1f(_0x16b17b);});});}function respondWithResult(_0x33ef04,_0x504b20){_0x504b20=_0x504b20||0xc8;return function(_0x21d08a){if(_0x21d08a){return _0x33ef04[_0xd58d('0x16')](_0x504b20)[_0xd58d('0x17')](_0x21d08a);}};}function respondWithFilteredResult(_0x23f446,_0x4ade01){return function(_0x3f9c1a){if(_0x3f9c1a){var _0x54e0b5=typeof _0x4ade01[_0xd58d('0x18')]===_0xd58d('0x19')&&typeof _0x4ade01[_0xd58d('0x1a')]===_0xd58d('0x19');var _0x10b1b6=_0x3f9c1a['count'];var _0x7227f8=_0x54e0b5?0x0:_0x4ade01[_0xd58d('0x18')];var _0x397932=_0x54e0b5?_0x3f9c1a['count']:_0x4ade01[_0xd58d('0x18')]+_0x4ade01[_0xd58d('0x1a')];var _0xa613f8;if(_0x397932>=_0x10b1b6){_0x397932=_0x10b1b6;_0xa613f8=0xc8;}else{_0xa613f8=0xce;}_0x23f446['status'](_0xa613f8);return _0x23f446[_0xd58d('0x1b')]('Content-Range',_0x7227f8+'-'+_0x397932+'/'+_0x10b1b6)['json'](_0x3f9c1a);}return null;};}function saveUpdates(_0x1ffb70){return function(_0x2552ff){if(_0x2552ff){return _0x2552ff[_0xd58d('0x1c')](_0x1ffb70)['then'](function(_0x37031f){return _0x37031f;});}return null;};}function removeEntity(_0x189068){return function(_0x2a5827){if(_0x2a5827){return _0x2a5827[_0xd58d('0x1d')]()[_0xd58d('0x1e')](function(){_0x189068[_0xd58d('0x16')](0xcc)[_0xd58d('0x1f')]();});}};}function handleEntityNotFound(_0x45c1cd){return function(_0x342e4c){if(!_0x342e4c){_0x45c1cd['sendStatus'](0x194);}return _0x342e4c;};}function handleError(_0x4740a8,_0x27851c){_0x27851c=_0x27851c||0x1f4;return function(_0x3a619d){logger[_0xd58d('0x11')](_0x3a619d['stack']);if(_0x3a619d[_0xd58d('0x20')]){delete _0x3a619d['name'];}_0x4740a8['status'](_0x27851c)[_0xd58d('0x21')](_0x3a619d);};}exports[_0xd58d('0x22')]=function(_0x5ea341,_0x19c5fb){var _0x132428={},_0x8854d9={},_0x1a6783={'count':0x0,'rows':[]};var _0x3d3254=_[_0xd58d('0x23')](db['Network'][_0xd58d('0x24')],function(_0x1baba1){return{'name':_0x1baba1[_0xd58d('0x25')],'type':_0x1baba1[_0xd58d('0x26')][_0xd58d('0x27')]};});_0x8854d9['model']=_[_0xd58d('0x23')](_0x3d3254,_0xd58d('0x20'));_0x8854d9[_0xd58d('0x28')]=_[_0xd58d('0x29')](_0x5ea341[_0xd58d('0x28')]);_0x8854d9[_0xd58d('0x2a')]=_['intersection'](_0x8854d9['model'],_0x8854d9['query']);_0x132428[_0xd58d('0x2b')]=_[_0xd58d('0x2c')](_0x8854d9[_0xd58d('0x2d')],qs[_0xd58d('0x2e')](_0x5ea341[_0xd58d('0x28')][_0xd58d('0x2e')]));_0x132428[_0xd58d('0x2b')]=_0x132428[_0xd58d('0x2b')][_0xd58d('0x2f')]?_0x132428['attributes']:_0x8854d9[_0xd58d('0x2d')];if(!_0x5ea341[_0xd58d('0x28')][_0xd58d('0x30')](_0xd58d('0x31'))){_0x132428[_0xd58d('0x1a')]=qs[_0xd58d('0x1a')](_0x5ea341['query'][_0xd58d('0x1a')]);_0x132428[_0xd58d('0x18')]=qs[_0xd58d('0x18')](_0x5ea341['query'][_0xd58d('0x18')]);}_0x132428[_0xd58d('0x32')]=qs[_0xd58d('0x33')](_0x5ea341['query'][_0xd58d('0x33')]);_0x132428[_0xd58d('0x34')]=qs[_0xd58d('0x2a')](_[_0xd58d('0x35')](_0x5ea341[_0xd58d('0x28')],_0x8854d9[_0xd58d('0x2a')]),_0x3d3254);if(_0x5ea341[_0xd58d('0x28')][_0xd58d('0x36')]){_0x132428[_0xd58d('0x34')]=_[_0xd58d('0x37')](_0x132428[_0xd58d('0x34')],{'$or':_[_0xd58d('0x23')](_0x3d3254,function(_0x12ce89){if(_0x12ce89[_0xd58d('0x26')]!==_0xd58d('0x38')){var _0x485e22={};_0x485e22[_0x12ce89[_0xd58d('0x20')]]={'$like':'%'+_0x5ea341[_0xd58d('0x28')]['filter']+'%'};return _0x485e22;}})});}_0x132428=_[_0xd58d('0x37')]({},_0x132428,_0x5ea341[_0xd58d('0x39')]);var _0x1cbf6c={'where':_0x132428[_0xd58d('0x34')]};return db[_0xd58d('0x3a')][_0xd58d('0x3b')](_0x1cbf6c)[_0xd58d('0x1e')](function(_0x241a6a){_0x1a6783[_0xd58d('0x3b')]=_0x241a6a;if(_0x5ea341[_0xd58d('0x28')]['includeAll']){_0x132428[_0xd58d('0x3c')]=[{'all':!![]}];}return db[_0xd58d('0x3a')][_0xd58d('0x3d')](_0x132428);})[_0xd58d('0x1e')](function(_0x5c5537){_0x1a6783[_0xd58d('0x3e')]=_0x5c5537;return _0x1a6783;})[_0xd58d('0x1e')](respondWithFilteredResult(_0x19c5fb,_0x132428))[_0xd58d('0x15')](handleError(_0x19c5fb,null));};exports[_0xd58d('0x3f')]=function(_0x562207,_0x42d9f9){var _0x389072={'raw':!![],'where':{'id':_0x562207[_0xd58d('0x40')]['id']}},_0x5f358b={};_0x5f358b[_0xd58d('0x2d')]=_[_0xd58d('0x29')](db[_0xd58d('0x3a')][_0xd58d('0x24')]);_0x5f358b['query']=_[_0xd58d('0x29')](_0x562207[_0xd58d('0x28')]);_0x5f358b['filters']=_['intersection'](_0x5f358b[_0xd58d('0x2d')],_0x5f358b['query']);_0x389072[_0xd58d('0x2b')]=_[_0xd58d('0x2c')](_0x5f358b[_0xd58d('0x2d')],qs['fields'](_0x562207['query']['fields']));_0x389072[_0xd58d('0x2b')]=_0x389072[_0xd58d('0x2b')][_0xd58d('0x2f')]?_0x389072[_0xd58d('0x2b')]:_0x5f358b[_0xd58d('0x2d')];if(_0x562207[_0xd58d('0x28')][_0xd58d('0x41')]){_0x389072[_0xd58d('0x3c')]=[{'all':!![]}];}_0x389072=_[_0xd58d('0x37')]({},_0x389072,_0x562207[_0xd58d('0x39')]);return db[_0xd58d('0x3a')]['find'](_0x389072)[_0xd58d('0x1e')](handleEntityNotFound(_0x42d9f9,null))[_0xd58d('0x1e')](respondWithResult(_0x42d9f9,null))[_0xd58d('0x15')](handleError(_0x42d9f9,null));};exports[_0xd58d('0x42')]=function(_0x25b9e2,_0x415e67){var _0x35cb63;return db['Network']['create'](_0x25b9e2['body'],{'raw':!![]})[_0xd58d('0x1e')](function(_0x5592){_0x35cb63=_0x5592;return db[_0xd58d('0x3a')][_0xd58d('0x3d')]({'where':{'type':_0x25b9e2[_0xd58d('0x43')][_0xd58d('0x26')]},'raw':!![]});})[_0xd58d('0x1e')](function(_0x58f3ef){if(_0x35cb63[_0xd58d('0x26')]['toUpperCase']()==_0xd58d('0x44')){var _0x476b32=fs[_0xd58d('0x45')](path['join'](config[_0xd58d('0x46')],_0xd58d('0x47')),_0xd58d('0x48'));var _0xdb3602=ejs['render'](_0x476b32,{'networks':_0x58f3ef||[]});fs['writeFileSync'](_0xd58d('0x49'),_0xdb3602);return respondWithRpcPromise('Reload',_0xd58d('0x42'),{'module':_0xd58d('0x4a')});}else if(_0x35cb63['type'][_0xd58d('0x4b')]()==_0xd58d('0x4c')){var _0x1687ed=fs[_0xd58d('0x45')](path[_0xd58d('0x4d')](config['root'],_0xd58d('0x4e')),'utf8');var _0xa421f4=ejs[_0xd58d('0x4f')](_0x1687ed,{'networks':_0x58f3ef||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0xa421f4);return respondWithRpcPromise(_0xd58d('0x50'),_0xd58d('0x42'),{'module':'res_stun_monitor.so'});}else{var _0x4991ba=fs[_0xd58d('0x45')](path[_0xd58d('0x4d')](config[_0xd58d('0x46')],'server/files/templates/network.ejs'),_0xd58d('0x48'));var _0x2cd139=ejs[_0xd58d('0x4f')](_0x4991ba,{'networks':_0x58f3ef||[]});fs[_0xd58d('0x51')](util[_0xd58d('0x52')](_0xd58d('0x53'),_0x25b9e2[_0xd58d('0x43')][_0xd58d('0x26')][_0xd58d('0x54')]()),_0x2cd139);return respondWithRpcPromise(_0xd58d('0x50'),'create',{'module':_0xd58d('0x55')});}})[_0xd58d('0x1e')](function(){return _0x35cb63;})[_0xd58d('0x1e')](respondWithResult(_0x415e67,0xc9))[_0xd58d('0x15')](handleError(_0x415e67,null));};exports[_0xd58d('0x1c')]=function(_0x1a4110,_0x1b8a41){var _0x480a3f;return db[_0xd58d('0x3a')]['find']({'where':{'id':_0x1a4110['params']['id']}})[_0xd58d('0x1e')](handleEntityNotFound(_0x1b8a41,null))[_0xd58d('0x1e')](saveUpdates(_0x1a4110[_0xd58d('0x43')],null))[_0xd58d('0x1e')](function(_0x26f1d9){if(_0x26f1d9){_0x480a3f=_0x26f1d9;return db['Network'][_0xd58d('0x3d')]({'where':{'type':_0x480a3f['type']},'raw':!![]});}return null;})[_0xd58d('0x1e')](function(_0x5cee99){if(_0x480a3f[_0xd58d('0x26')][_0xd58d('0x4b')]()==_0xd58d('0x44')){var _0x45cab7=fs['readFileSync'](path[_0xd58d('0x4d')](config[_0xd58d('0x46')],_0xd58d('0x47')),'utf8');var _0x36ae1c=ejs['render'](_0x45cab7,{'networks':_0x5cee99||[]});fs['writeFileSync'](_0xd58d('0x49'),_0x36ae1c);return respondWithRpcPromise(_0xd58d('0x50'),_0xd58d('0x1c'),{'module':_0xd58d('0x4a')});}else if(_0x480a3f['type']['toUpperCase']()==_0xd58d('0x4c')){var _0x5f123f=fs['readFileSync'](path[_0xd58d('0x4d')](config[_0xd58d('0x46')],_0xd58d('0x4e')),_0xd58d('0x48'));var _0x64b2c3=ejs['render'](_0x5f123f,{'networks':_0x5cee99||[]});fs[_0xd58d('0x51')]('/etc/asterisk/turn_xcally.conf',_0x64b2c3);return respondWithRpcPromise(_0xd58d('0x50'),_0xd58d('0x1c'),{'module':'res_stun_monitor.so'});}else{var _0x120eb4=fs[_0xd58d('0x45')](path['join'](config[_0xd58d('0x46')],'server/files/templates/network.ejs'),_0xd58d('0x48'));var _0xc0e9d5=ejs[_0xd58d('0x4f')](_0x120eb4,{'networks':_0x5cee99||[]});fs[_0xd58d('0x51')](util[_0xd58d('0x52')]('/etc/asterisk/sip_xcally_%s.conf',_0x1a4110[_0xd58d('0x43')][_0xd58d('0x26')][_0xd58d('0x54')]()),_0xc0e9d5);return respondWithRpcPromise(_0xd58d('0x50'),'update',{'module':_0xd58d('0x55')});}})[_0xd58d('0x1e')](function(_0x12aa7f){if(_0x12aa7f){return _0x480a3f;}return null;})[_0xd58d('0x1e')](respondWithResult(_0x1b8a41,null))[_0xd58d('0x15')](handleError(_0x1b8a41,null));};exports[_0xd58d('0x1d')]=function(_0x90ed3e,_0x3448a9){var _0x4d5957;return db['Network']['find']({'where':{'id':_0x90ed3e[_0xd58d('0x40')]['id']}})[_0xd58d('0x1e')](function(_0x1cd95b){_0x4d5957=_0x1cd95b;return _0x1cd95b;})[_0xd58d('0x1e')](handleEntityNotFound(_0x3448a9,null))[_0xd58d('0x1e')](removeEntity(_0x3448a9,null))['then'](function(){if(_0x4d5957){return db['Network'][_0xd58d('0x3d')]({'where':{'type':_0x4d5957[_0xd58d('0x26')]},'raw':!![]});}})[_0xd58d('0x1e')](function(_0x4f8d1d){if(_0x4d5957[_0xd58d('0x26')][_0xd58d('0x4b')]()=='STUN'){var _0x2429ea=fs[_0xd58d('0x45')](path[_0xd58d('0x4d')](config[_0xd58d('0x46')],_0xd58d('0x47')),_0xd58d('0x48'));var _0x3bd4de=ejs[_0xd58d('0x4f')](_0x2429ea,{'networks':_0x4f8d1d||[]});fs[_0xd58d('0x51')](_0xd58d('0x49'),_0x3bd4de);return respondWithRpcPromise(_0xd58d('0x50'),_0xd58d('0x1d'),{'module':'res_stun_monitor.so'});}else if(_0x4d5957['type'][_0xd58d('0x4b')]()=='TURN'){var _0x324114=fs[_0xd58d('0x45')](path[_0xd58d('0x4d')](config[_0xd58d('0x46')],_0xd58d('0x4e')),_0xd58d('0x48'));var _0x280ddd=ejs['render'](_0x324114,{'networks':_0x4f8d1d||[]});fs['writeFileSync'](_0xd58d('0x56'),_0x280ddd);return respondWithRpcPromise(_0xd58d('0x50'),_0xd58d('0x1d'),{'module':_0xd58d('0x4a')});}else{var _0x12d136=fs[_0xd58d('0x45')](path[_0xd58d('0x4d')](config[_0xd58d('0x46')],_0xd58d('0x57')),_0xd58d('0x48'));var _0x9b473=ejs[_0xd58d('0x4f')](_0x12d136,{'networks':_0x4f8d1d||[]});fs[_0xd58d('0x51')](util[_0xd58d('0x52')]('/etc/asterisk/sip_xcally_%s.conf',_0x4d5957['type'][_0xd58d('0x54')]()),_0x9b473);return respondWithRpcPromise('Reload','destroy',{'module':_0xd58d('0x55')});}})[_0xd58d('0x15')](handleError(_0x3448a9,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 64c2cd7..b58009a 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 _0x593e=['path','../../config/environment','./network.attributes','exports','define','Network','network','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x331dc5,_0x1c0b16){var _0x5d98b0=function(_0x4c7c60){while(--_0x4c7c60){_0x331dc5['push'](_0x331dc5['shift']());}};_0x5d98b0(++_0x1c0b16);}(_0x593e,0xcb));var _0xe593=function(_0x782c04,_0x1ba990){_0x782c04=_0x782c04-0x0;var _0x511687=_0x593e[_0x782c04];return _0x511687;};'use strict';var _=require(_0xe593('0x0'));var util=require(_0xe593('0x1'));var logger=require(_0xe593('0x2'))(_0xe593('0x3'));var moment=require(_0xe593('0x4'));var BPromise=require(_0xe593('0x5'));var rp=require(_0xe593('0x6'));var fs=require('fs');var path=require(_0xe593('0x7'));var rimraf=require('rimraf');var config=require(_0xe593('0x8'));var attributes=require(_0xe593('0x9'));module[_0xe593('0xa')]=function(_0x1e50d3,_0x3b7082){return _0x1e50d3[_0xe593('0xb')](_0xe593('0xc'),attributes,{'tableName':_0xe593('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0506=['network','lodash','util','../../config/logger','path','../../config/environment','define','Network'];(function(_0xdf3db6,_0x2a1952){var _0x4b7a65=function(_0x2953be){while(--_0x2953be){_0xdf3db6['push'](_0xdf3db6['shift']());}};_0x4b7a65(++_0x2a1952);}(_0x0506,0x1d1));var _0x6050=function(_0x1605a7,_0x4e421d){_0x1605a7=_0x1605a7-0x0;var _0x42a3f5=_0x0506[_0x1605a7];return _0x42a3f5;};'use strict';var _=require(_0x6050('0x0'));var util=require(_0x6050('0x1'));var logger=require(_0x6050('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6050('0x3'));var rimraf=require('rimraf');var config=require(_0x6050('0x4'));var attributes=require('./network.attributes');module['exports']=function(_0xfd44cc,_0x269be3){return _0xfd44cc[_0x6050('0x5')](_0x6050('0x6'),attributes,{'tableName':_0x6050('0x7'),'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 945c415..d174442 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(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0x30f4e8,_0x34ca1a){_0x30f4e8=_0x30f4e8-0x0;var _0x20a5c0=_0x7a54[_0x30f4e8];return _0x20a5c0;};'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(_0x5de17e,_0x556efd){var _0x9db192=function(_0x4a3d2a){while(--_0x4a3d2a){_0x5de17e['push'](_0x5de17e['shift']());}};_0x9db192(++_0x556efd);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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 e55cd34..c5b8a3d 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 _0x2b92=['put','delete','destroy','removeDispositions','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelAccount.controller','get','isAuthenticated','index','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','/:id/notify','notify','/:id/applications','addApplications','addAgents','/:id/send','send'];(function(_0x1e4a8e,_0x18022b){var _0x5408f9=function(_0x4ef2ed){while(--_0x4ef2ed){_0x1e4a8e['push'](_0x1e4a8e['shift']());}};_0x5408f9(++_0x18022b);}(_0x2b92,0x96));var _0x22b9=function(_0x326c53,_0x435700){_0x326c53=_0x326c53-0x0;var _0xefd074=_0x2b92[_0x326c53];return _0xefd074;};'use strict';var multer=require('multer');var util=require(_0x22b9('0x0'));var path=require(_0x22b9('0x1'));var timeout=require(_0x22b9('0x2'));var express=require(_0x22b9('0x3'));var router=express[_0x22b9('0x4')]();var fs_extra=require(_0x22b9('0x5'));var auth=require(_0x22b9('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x22b9('0x7'));router[_0x22b9('0x8')]('/',auth[_0x22b9('0x9')](),controller[_0x22b9('0xa')]);router[_0x22b9('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x22b9('0x8')](_0x22b9('0xb'),auth[_0x22b9('0x9')](),controller[_0x22b9('0xc')]);router['get'](_0x22b9('0xd'),auth[_0x22b9('0x9')](),controller['getDispositions']);router[_0x22b9('0x8')](_0x22b9('0xe'),auth[_0x22b9('0x9')](),controller[_0x22b9('0xf')]);router['get']('/:id/applications',auth[_0x22b9('0x9')](),controller[_0x22b9('0x10')]);router[_0x22b9('0x8')](_0x22b9('0x11'),auth[_0x22b9('0x9')](),controller[_0x22b9('0x12')]);router[_0x22b9('0x8')](_0x22b9('0x13'),auth[_0x22b9('0x9')](),controller[_0x22b9('0x14')]);router[_0x22b9('0x15')]('/',auth[_0x22b9('0x9')](),controller[_0x22b9('0x16')]);router[_0x22b9('0x15')](_0x22b9('0xd'),auth[_0x22b9('0x9')](),controller['addDisposition']);router[_0x22b9('0x15')](_0x22b9('0xe'),auth[_0x22b9('0x9')](),controller['addAnswer']);router['post'](_0x22b9('0x17'),controller[_0x22b9('0x18')]);router[_0x22b9('0x15')](_0x22b9('0x19'),auth['isAuthenticated'](),controller[_0x22b9('0x1a')]);router['post'](_0x22b9('0x13'),auth[_0x22b9('0x9')](),controller[_0x22b9('0x1b')]);router['post'](_0x22b9('0x1c'),auth[_0x22b9('0x9')](),controller[_0x22b9('0x1d')]);router[_0x22b9('0x1e')]('/:id',auth[_0x22b9('0x9')](),controller['update']);router[_0x22b9('0x1f')](_0x22b9('0xb'),auth[_0x22b9('0x9')](),controller[_0x22b9('0x20')]);router[_0x22b9('0x1f')](_0x22b9('0xd'),auth['isAuthenticated'](),controller[_0x22b9('0x21')]);router[_0x22b9('0x1f')](_0x22b9('0xe'),auth[_0x22b9('0x9')](),controller['removeAnswers']);router['delete'](_0x22b9('0x13'),auth['isAuthenticated'](),controller[_0x22b9('0x22')]);module[_0x22b9('0x23')]=router; \ No newline at end of file +var _0x4d4a=['addAgents','/:id/send','send','put','delete','removeDispositions','/:id/canned_answers','removeAnswers','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','notify'];(function(_0x3726d9,_0x5bfc40){var _0x563822=function(_0x55adf8){while(--_0x55adf8){_0x3726d9['push'](_0x3726d9['shift']());}};_0x563822(++_0x5bfc40);}(_0x4d4a,0x1c2));var _0xa4d4=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x4d4a[_0x138adb];return _0x1b27f2;};'use strict';var multer=require(_0xa4d4('0x0'));var util=require(_0xa4d4('0x1'));var path=require(_0xa4d4('0x2'));var timeout=require(_0xa4d4('0x3'));var express=require('express');var router=express[_0xa4d4('0x4')]();var fs_extra=require(_0xa4d4('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa4d4('0x6'));var controller=require(_0xa4d4('0x7'));router[_0xa4d4('0x8')]('/',auth[_0xa4d4('0x9')](),controller[_0xa4d4('0xa')]);router[_0xa4d4('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xa4d4('0x8')](_0xa4d4('0xb'),auth[_0xa4d4('0x9')](),controller[_0xa4d4('0xc')]);router['get'](_0xa4d4('0xd'),auth[_0xa4d4('0x9')](),controller[_0xa4d4('0xe')]);router[_0xa4d4('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xa4d4('0xf')]);router[_0xa4d4('0x8')](_0xa4d4('0x10'),auth[_0xa4d4('0x9')](),controller[_0xa4d4('0x11')]);router[_0xa4d4('0x8')]('/:id/interactions',auth[_0xa4d4('0x9')](),controller[_0xa4d4('0x12')]);router['get'](_0xa4d4('0x13'),auth[_0xa4d4('0x9')](),controller[_0xa4d4('0x14')]);router[_0xa4d4('0x15')]('/',auth[_0xa4d4('0x9')](),controller[_0xa4d4('0x16')]);router['post'](_0xa4d4('0xd'),auth[_0xa4d4('0x9')](),controller[_0xa4d4('0x17')]);router[_0xa4d4('0x15')]('/:id/canned_answers',auth[_0xa4d4('0x9')](),controller[_0xa4d4('0x18')]);router[_0xa4d4('0x15')]('/:id/notify',controller[_0xa4d4('0x19')]);router[_0xa4d4('0x15')](_0xa4d4('0x10'),auth[_0xa4d4('0x9')](),controller['addApplications']);router['post']('/:id/users',auth[_0xa4d4('0x9')](),controller[_0xa4d4('0x1a')]);router[_0xa4d4('0x15')](_0xa4d4('0x1b'),auth[_0xa4d4('0x9')](),controller[_0xa4d4('0x1c')]);router[_0xa4d4('0x1d')](_0xa4d4('0xb'),auth[_0xa4d4('0x9')](),controller['update']);router[_0xa4d4('0x1e')](_0xa4d4('0xb'),auth[_0xa4d4('0x9')](),controller['destroy']);router[_0xa4d4('0x1e')](_0xa4d4('0xd'),auth[_0xa4d4('0x9')](),controller[_0xa4d4('0x1f')]);router['delete'](_0xa4d4('0x20'),auth[_0xa4d4('0x9')](),controller[_0xa4d4('0x21')]);router['delete'](_0xa4d4('0x13'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 20d8b9e..dcb15dc 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 _0xc226=['STRING','name','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports'];(function(_0x5eb03a,_0x375774){var _0x1f81c9=function(_0x1f2755){while(--_0x1f2755){_0x5eb03a['push'](_0x5eb03a['shift']());}};_0x1f81c9(++_0x375774);}(_0xc226,0x150));var _0x6c22=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xc226[_0x34bf97];return _0x292719;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x6c22('0x0'));module[_0x6c22('0x1')]={'name':{'type':Sequelize[_0x6c22('0x2')],'unique':_0x6c22('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x6c22('0x2')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x6c22('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x6c22('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x6c22('0x4')],'defaultValue':function(){return _0x6c22('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6c22('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x6c22('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x6c22('0x2')]},'queueTransfer':{'type':Sequelize[_0x6c22('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6c22('0x7')],'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[_0x6c22('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x6c22('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x6c22('0x6')],'defaultValue':![],'comment':_0x6c22('0x9'),'set':function(_0x5f08db){if(!_0x5f08db)this[_0x6c22('0xa')](_0x6c22('0xb'),null);this[_0x6c22('0xa')](_0x6c22('0xc'),_0x5f08db);}}}; \ No newline at end of file +var _0xbc23=['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','mandatoryDisposition','sequelize','exports','STRING','generate'];(function(_0x5e6c6d,_0x5ea58a){var _0x5d619e=function(_0x40c8d6){while(--_0x40c8d6){_0x5e6c6d['push'](_0x5e6c6d['shift']());}};_0x5d619e(++_0x5ea58a);}(_0xbc23,0xa4));var _0x3bc2=function(_0x4d38f2,_0x248c1f){_0x4d38f2=_0x4d38f2-0x0;var _0x59061f=_0xbc23[_0x4d38f2];return _0x59061f;};'use strict';var Sequelize=require(_0x3bc2('0x0'));var rs=require('randomstring');module[_0x3bc2('0x1')]={'name':{'type':Sequelize[_0x3bc2('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x3bc2('0x2')],'defaultValue':function(){return rs[_0x3bc2('0x3')]();}},'replyUri':{'type':Sequelize[_0x3bc2('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x3bc2('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x3bc2('0x4')],'defaultValue':function(){return _0x3bc2('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3bc2('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3bc2('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x3bc2('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x3bc2('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3bc2('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3bc2('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3bc2('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x3bc2('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x3bc2('0x9'),'set':function(_0x35efdd){if(!_0x35efdd)this[_0x3bc2('0xa')]('mandatoryDispositionPauseId',null);this[_0x3bc2('0xa')](_0x3bc2('0xb'),_0x35efdd);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index f8e8eb4..8caa06f 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 _0xe13a=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','OpenchannelAccounts','UserProfileResource','destroy','stack','name','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','OpenchannelAccount','findAll','catch','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','OpenchannelAccountId','Disposition','findOne','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','openchannel','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','mapKey','ValidationError','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','CmList','Contacts','DESC','List','applications','list','orderBy','asc','account','Applications','contact','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','firstName','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','queueId','queue','startRouting','EventManager','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','OpenchannelApplication','findAndCountAll','priority','getApplications','getInteractions','Contact','fullname','internal','Tag','Tags','color','tag','rows','addAgents','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','send','body\x20is\x20mandatory\x20and\x20not\x20empty','out','Messages','dataValues','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto'];(function(_0x1516c7,_0x263d00){var _0x1da53f=function(_0xd9950e){while(--_0xd9950e){_0x1516c7['push'](_0x1516c7['shift']());}};_0x1da53f(++_0x263d00);}(_0xe13a,0x178));var _0xae13=function(_0x1252ff,_0x1df964){_0x1252ff=_0x1252ff-0x0;var _0x41e6ee=_0xe13a[_0x1252ff];return _0x41e6ee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xae13('0x0'));var zipdir=require(_0xae13('0x1'));var jsonpatch=require(_0xae13('0x2'));var rp=require(_0xae13('0x3'));var moment=require('moment');var BPromise=require(_0xae13('0x4'));var Mustache=require(_0xae13('0x5'));var util=require(_0xae13('0x6'));var path=require(_0xae13('0x7'));var sox=require(_0xae13('0x8'));var csv=require(_0xae13('0x9'));var ejs=require(_0xae13('0xa'));var fs=require('fs');var fs_extra=require(_0xae13('0xb'));var _=require(_0xae13('0xc'));var squel=require('squel');var crypto=require(_0xae13('0xd'));var jsforce=require(_0xae13('0xe'));var deskjs=require(_0xae13('0xf'));var toCsv=require(_0xae13('0x9'));var querystring=require(_0xae13('0x10'));var Papa=require(_0xae13('0x11'));var Redis=require(_0xae13('0x12'));var authService=require(_0xae13('0x13'));var qs=require(_0xae13('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xae13('0x15'));var logger=require(_0xae13('0x16'))(_0xae13('0x17'));var utils=require(_0xae13('0x18'));var config=require(_0xae13('0x19'));var licenseUtil=require(_0xae13('0x1a'));var db=require(_0xae13('0x1b'))['db'];config['redis']=_[_0xae13('0x1c')](config[_0xae13('0x1d')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelAccount.socket')['register'](socket);var jayson=require(_0xae13('0x1e'));var client=jayson[_0xae13('0x1f')][_0xae13('0x20')]({'port':0x232c});var client9002=jayson[_0xae13('0x1f')][_0xae13('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x2912a2,_0x5c25a4,_0x3c488f,_0x5e46bc){return new BPromise(function(_0xe10aab,_0x16764b){var _0x207363=_0x5e46bc||client;return _0x207363[_0xae13('0x21')](_0x2912a2,_0x3c488f)[_0xae13('0x22')](function(_0x1b33b7){logger[_0xae13('0x23')](_0xae13('0x24'),_0x5c25a4,_0xae13('0x25'));logger['debug'](_0xae13('0x26'),_0x5c25a4,'request\x20sent',JSON[_0xae13('0x27')](_0x1b33b7));if(_0x1b33b7[_0xae13('0x28')]){if(_0x1b33b7['error'][_0xae13('0x29')]===0x1f4){logger[_0xae13('0x28')](_0xae13('0x24'),_0x5c25a4,_0x1b33b7[_0xae13('0x28')][_0xae13('0x2a')]);return _0x16764b(_0x1b33b7[_0xae13('0x28')]['message']);}logger['error'](_0xae13('0x24'),_0x5c25a4,_0x1b33b7[_0xae13('0x28')]['message']);return _0xe10aab(_0x1b33b7[_0xae13('0x28')]['message']);}else{logger[_0xae13('0x23')](_0xae13('0x24'),_0x5c25a4,_0xae13('0x25'));_0xe10aab(_0x1b33b7['result']['message']);}})['catch'](function(_0x4edb8c){logger[_0xae13('0x28')](_0xae13('0x24'),_0x5c25a4,_0x4edb8c);_0x16764b(_0x4edb8c);});});}function respondWithStatusCode(_0x55a39b,_0x370874){_0x370874=_0x370874||0xcc;return function(_0x517e71){if(_0x517e71){return _0x55a39b[_0xae13('0x2b')](_0x370874);}return _0x55a39b['status'](_0x370874)[_0xae13('0x2c')]();};}function respondWithResult(_0x3117c2,_0x526e4e){_0x526e4e=_0x526e4e||0xc8;return function(_0xa98d6c){if(_0xa98d6c){return _0x3117c2[_0xae13('0x2d')](_0x526e4e)[_0xae13('0x2e')](_0xa98d6c);}};}function respondWithFilteredResult(_0x306dfb,_0x578e99){return function(_0x41ceb7){if(_0x41ceb7){var _0x27b737=typeof _0x578e99[_0xae13('0x2f')]===_0xae13('0x30')&&typeof _0x578e99[_0xae13('0x31')]===_0xae13('0x30');var _0x277b69=_0x41ceb7['count'];var _0x133481=_0x27b737?0x0:_0x578e99['offset'];var _0xf6289c=_0x27b737?_0x41ceb7[_0xae13('0x32')]:_0x578e99[_0xae13('0x2f')]+_0x578e99[_0xae13('0x31')];var _0x352aec;if(_0xf6289c>=_0x277b69){_0xf6289c=_0x277b69;_0x352aec=0xc8;}else{_0x352aec=0xce;}_0x306dfb[_0xae13('0x2d')](_0x352aec);return _0x306dfb[_0xae13('0x33')]('Content-Range',_0x133481+'-'+_0xf6289c+'/'+_0x277b69)['json'](_0x41ceb7);}return null;};}function patchUpdates(_0x30d2c0){return function(_0x233896){try{jsonpatch[_0xae13('0x34')](_0x233896,_0x30d2c0,!![]);}catch(_0x3710d6){return BPromise[_0xae13('0x35')](_0x3710d6);}return _0x233896[_0xae13('0x36')]();};}function saveUpdates(_0x126686,_0x1a8708){return function(_0x1fda10){if(_0x1fda10){return _0x1fda10[_0xae13('0x37')](_0x126686)['then'](function(_0x1a83d7){return _0x1a83d7;});}return null;};}function removeEntity(_0x116270,_0x469a81){return function(_0x597001){if(_0x597001){return _0x597001['destroy']()['then'](function(){var _0x5ba0a8=_0x597001['get']({'plain':!![]});var _0x5ee151=_0xae13('0x38');return db[_0xae13('0x39')][_0xae13('0x3a')]({'where':{'type':_0x5ee151,'resourceId':_0x5ba0a8['id']}})['then'](function(){return _0x597001;});})[_0xae13('0x22')](function(){_0x116270[_0xae13('0x2d')](0xcc)[_0xae13('0x2c')]();});}};}function handleEntityNotFound(_0x1f5587,_0x2405c3){return function(_0x4a2610){if(!_0x4a2610){_0x1f5587[_0xae13('0x2b')](0x194);}return _0x4a2610;};}function handleError(_0x1e1112,_0x15865c){_0x15865c=_0x15865c||0x1f4;return function(_0x535b0b){logger['error'](_0x535b0b[_0xae13('0x3b')]);if(_0x535b0b[_0xae13('0x3c')]){delete _0x535b0b[_0xae13('0x3c')];}_0x1e1112[_0xae13('0x2d')](_0x15865c)['send'](_0x535b0b);};}exports[_0xae13('0x3d')]=function(_0x133643,_0x538283){var _0x249058={'include':[{'model':db[_0xae13('0x3e')],'as':_0xae13('0x3f')}]},_0x4c058f={},_0x5955dd={'count':0x0,'rows':[]};var _0x3d3569=_[_0xae13('0x40')](db['OpenchannelAccount'][_0xae13('0x41')],function(_0x300b4e){return{'name':_0x300b4e[_0xae13('0x42')],'type':_0x300b4e[_0xae13('0x43')]['key']};});_0x4c058f[_0xae13('0x44')]=_[_0xae13('0x40')](_0x3d3569,_0xae13('0x3c'));_0x4c058f[_0xae13('0x45')]=_['keys'](_0x133643['query']);_0x4c058f[_0xae13('0x46')]=_[_0xae13('0x47')](_0x4c058f['model'],_0x4c058f[_0xae13('0x45')]);_0x249058['attributes']=_[_0xae13('0x47')](_0x4c058f[_0xae13('0x44')],qs[_0xae13('0x48')](_0x133643['query'][_0xae13('0x48')]));_0x249058[_0xae13('0x49')]=_0x249058[_0xae13('0x49')][_0xae13('0x4a')]?_0x249058['attributes']:_0x4c058f[_0xae13('0x44')];if(!_0x133643[_0xae13('0x45')][_0xae13('0x4b')](_0xae13('0x4c'))){_0x249058[_0xae13('0x31')]=qs[_0xae13('0x31')](_0x133643[_0xae13('0x45')][_0xae13('0x31')]);_0x249058['offset']=qs[_0xae13('0x2f')](_0x133643['query'][_0xae13('0x2f')]);}_0x249058[_0xae13('0x4d')]=qs[_0xae13('0x4e')](_0x133643[_0xae13('0x45')]['sort']);_0x249058[_0xae13('0x4f')]=qs['filters'](_[_0xae13('0x50')](_0x133643[_0xae13('0x45')],_0x4c058f['filters']),_0x3d3569);if(_0x133643[_0xae13('0x45')][_0xae13('0x51')]){_0x249058[_0xae13('0x4f')]=_[_0xae13('0x52')](_0x249058[_0xae13('0x4f')],{'$or':_[_0xae13('0x40')](_0x3d3569,function(_0x54bfee){if(_0x54bfee[_0xae13('0x43')]!==_0xae13('0x53')){var _0xd15aa7={};_0xd15aa7[_0x54bfee[_0xae13('0x3c')]]={'$like':'%'+_0x133643[_0xae13('0x45')]['filter']+'%'};return _0xd15aa7;}})});}_0x249058=_[_0xae13('0x52')]({},_0x249058,_0x133643[_0xae13('0x54')]);var _0x8e6f1e={'where':_0x249058['where']};return db['OpenchannelAccount']['count'](_0x8e6f1e)['then'](function(_0x60a53a){_0x5955dd['count']=_0x60a53a;if(_0x133643[_0xae13('0x45')]['includeAll']){_0x249058[_0xae13('0x55')]=[{'all':!![]}];}return db[_0xae13('0x56')][_0xae13('0x57')](_0x249058);})[_0xae13('0x22')](function(_0x4509ea){_0x5955dd['rows']=_0x4509ea;return _0x5955dd;})[_0xae13('0x22')](respondWithFilteredResult(_0x538283,_0x249058))[_0xae13('0x58')](handleError(_0x538283,null));};exports['show']=function(_0x67d3a8,_0x41913a){var _0x49c43a={'raw':![],'where':{'id':_0x67d3a8['params']['id']},'include':[{'model':db['Pause'],'as':_0xae13('0x3f')}]},_0x50610f={};_0x50610f[_0xae13('0x44')]=_['keys'](db[_0xae13('0x56')][_0xae13('0x41')]);_0x50610f['query']=_[_0xae13('0x59')](_0x67d3a8[_0xae13('0x45')]);_0x50610f[_0xae13('0x46')]=_[_0xae13('0x47')](_0x50610f[_0xae13('0x44')],_0x50610f[_0xae13('0x45')]);_0x49c43a[_0xae13('0x49')]=_[_0xae13('0x47')](_0x50610f[_0xae13('0x44')],qs[_0xae13('0x48')](_0x67d3a8['query'][_0xae13('0x48')]));_0x49c43a[_0xae13('0x49')]=_0x49c43a[_0xae13('0x49')]['length']?_0x49c43a[_0xae13('0x49')]:_0x50610f['model'];if(_0x67d3a8[_0xae13('0x45')][_0xae13('0x5a')]){_0x49c43a[_0xae13('0x55')]=[{'all':!![]}];}_0x49c43a=_['merge']({},_0x49c43a,_0x67d3a8['options']);return db[_0xae13('0x56')][_0xae13('0x5b')](_0x49c43a)[_0xae13('0x22')](handleEntityNotFound(_0x41913a,null))[_0xae13('0x22')](respondWithResult(_0x41913a,null))[_0xae13('0x58')](handleError(_0x41913a,null));};exports[_0xae13('0x5c')]=function(_0x3b9840,_0x4995d9){return db[_0xae13('0x56')][_0xae13('0x5c')](_0x3b9840[_0xae13('0x5d')],{})[_0xae13('0x22')](function(_0xcbac5b){var _0x67e5d3=_0x3b9840[_0xae13('0x5e')]['get']({'plain':!![]});if(!_0x67e5d3)throw new Error(_0xae13('0x5f'));if(_0x67e5d3[_0xae13('0x60')]==='user'){var _0x244c7c=_0xcbac5b[_0xae13('0x61')]({'plain':!![]});var _0xe6b279='OpenchannelAccounts';return db[_0xae13('0x62')][_0xae13('0x5b')]({'where':{'name':_0xe6b279,'userProfileId':_0x67e5d3['userProfileId']},'raw':!![]})[_0xae13('0x22')](function(_0xaabdd3){if(_0xaabdd3&&_0xaabdd3[_0xae13('0x63')]===0x0){return db[_0xae13('0x39')][_0xae13('0x5c')]({'name':_0x244c7c[_0xae13('0x3c')],'resourceId':_0x244c7c['id'],'type':_0xaabdd3['name'],'sectionId':_0xaabdd3['id']},{})['then'](function(){return _0xcbac5b;});}else{return _0xcbac5b;}})[_0xae13('0x58')](function(_0x2dd9ad){logger[_0xae13('0x28')](_0xae13('0x64'),_0x2dd9ad);throw _0x2dd9ad;});}return _0xcbac5b;})[_0xae13('0x22')](respondWithResult(_0x4995d9,0xc9))[_0xae13('0x58')](handleError(_0x4995d9,null));};exports['update']=function(_0x298dfd,_0x6c3a15){if(_0x298dfd['body']['id']){delete _0x298dfd['body']['id'];}return db['OpenchannelAccount'][_0xae13('0x5b')]({'where':{'id':_0x298dfd[_0xae13('0x65')]['id']},'include':[{'model':db[_0xae13('0x3e')],'as':_0xae13('0x3f')}]})[_0xae13('0x22')](handleEntityNotFound(_0x6c3a15,null))[_0xae13('0x22')](saveUpdates(_0x298dfd[_0xae13('0x5d')],null))[_0xae13('0x22')](respondWithResult(_0x6c3a15,null))[_0xae13('0x58')](handleError(_0x6c3a15,null));};exports[_0xae13('0x3a')]=function(_0x593421,_0x28bb14){return db[_0xae13('0x56')][_0xae13('0x5b')]({'where':{'id':_0x593421[_0xae13('0x65')]['id']}})['then'](handleEntityNotFound(_0x28bb14,null))[_0xae13('0x22')](removeEntity(_0x28bb14,null))[_0xae13('0x58')](handleError(_0x28bb14,null));};exports['describe']=function(_0x37dcdd,_0x59a2e0){return db['OpenchannelAccount'][_0xae13('0x66')]()[_0xae13('0x22')](respondWithResult(_0x59a2e0,null))[_0xae13('0x58')](handleError(_0x59a2e0,null));};exports[_0xae13('0x67')]=function(_0x22a7f9,_0x3797da,_0x5c893c){if(_0x22a7f9['body']['id']){delete _0x22a7f9[_0xae13('0x5d')]['id'];}return db[_0xae13('0x56')][_0xae13('0x5b')]({'where':{'id':_0x22a7f9['params']['id']}})[_0xae13('0x22')](handleEntityNotFound(_0x3797da,null))['then'](function(_0x22cc5a){if(_0x22cc5a){_0x22a7f9[_0xae13('0x5d')][_0xae13('0x68')]=_0x22cc5a['id'];return db[_0xae13('0x69')][_0xae13('0x5c')](_0x22a7f9['body']);}})[_0xae13('0x22')](respondWithResult(_0x3797da,null))[_0xae13('0x58')](handleError(_0x3797da,null));};exports['getDispositions']=function(_0x1c1a59,_0xb67155,_0x1f641c){var _0x3a4e6a={'raw':![],'where':{}};var _0x2e570e={};var _0x2d40f8={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xae13('0x6a')]({'where':{'id':_0x1c1a59['params']['id']}})[_0xae13('0x22')](handleEntityNotFound(_0xb67155,null))['then'](function(_0x2e7648){if(_0x2e7648){_0x2e570e[_0xae13('0x44')]=_['keys'](db[_0xae13('0x69')][_0xae13('0x41')]);_0x2e570e[_0xae13('0x45')]=_[_0xae13('0x59')](_0x1c1a59[_0xae13('0x45')]);_0x2e570e[_0xae13('0x46')]=_[_0xae13('0x47')](_0x2e570e[_0xae13('0x44')],_0x2e570e['query']);_0x3a4e6a[_0xae13('0x49')]=_[_0xae13('0x47')](_0x2e570e[_0xae13('0x44')],qs[_0xae13('0x48')](_0x1c1a59[_0xae13('0x45')][_0xae13('0x48')]));_0x3a4e6a[_0xae13('0x49')]=_0x3a4e6a[_0xae13('0x49')][_0xae13('0x4a')]?_0x3a4e6a[_0xae13('0x49')]:_0x2e570e['model'];if(!_0x1c1a59[_0xae13('0x45')]['hasOwnProperty']('nolimit')){_0x3a4e6a[_0xae13('0x31')]=qs[_0xae13('0x31')](_0x1c1a59[_0xae13('0x45')]['limit']);_0x3a4e6a[_0xae13('0x2f')]=qs['offset'](_0x1c1a59[_0xae13('0x45')]['offset']);}_0x3a4e6a[_0xae13('0x4d')]=qs[_0xae13('0x4e')](_0x1c1a59['query'][_0xae13('0x4e')]);_0x3a4e6a[_0xae13('0x4f')]=qs['filters'](_['pick'](_0x1c1a59[_0xae13('0x45')],_0x2e570e['filters']));_0x3a4e6a['where'][_0xae13('0x68')]=_0x2e7648['id'];if(_0x1c1a59['query'][_0xae13('0x51')]){_0x3a4e6a['where']=_[_0xae13('0x52')](_0x3a4e6a[_0xae13('0x4f')],{'$or':_[_0xae13('0x40')](_0x3a4e6a[_0xae13('0x49')],function(_0x263ee1){var _0x31c15e={};_0x31c15e[_0x263ee1]={'$like':'%'+_0x1c1a59['query'][_0xae13('0x51')]+'%'};return _0x31c15e;})});}_0x3a4e6a=_[_0xae13('0x52')]({},_0x3a4e6a,_0x1c1a59['options']);return db['Disposition']['count']({'where':_0x3a4e6a[_0xae13('0x4f')]})['then'](function(_0x38115e){_0x2d40f8['count']=_0x38115e;if(_0x1c1a59['query'][_0xae13('0x5a')]){_0x3a4e6a[_0xae13('0x55')]=[{'all':!![]}];}return db[_0xae13('0x69')][_0xae13('0x57')](_0x3a4e6a);})[_0xae13('0x22')](function(_0x317ca7){_0x2d40f8['rows']=_0x317ca7;return _0x2d40f8;});}})[_0xae13('0x22')](respondWithFilteredResult(_0xb67155,_0x3a4e6a))[_0xae13('0x58')](handleError(_0xb67155,null));};exports[_0xae13('0x6b')]=function(_0x1613b5,_0x4ea1f4,_0x23bb21){return db[_0xae13('0x56')][_0xae13('0x5b')]({'where':{'id':_0x1613b5['params']['id']}})['then'](handleEntityNotFound(_0x4ea1f4,null))[_0xae13('0x22')](function(_0x45a73b){if(_0x45a73b){return _0x45a73b[_0xae13('0x6b')](_0x1613b5[_0xae13('0x45')][_0xae13('0x6c')]);}})[_0xae13('0x22')](respondWithStatusCode(_0x4ea1f4,null))[_0xae13('0x58')](handleError(_0x4ea1f4,null));};exports[_0xae13('0x6d')]=function(_0x4fae2d,_0x2c0718,_0x2de667){if(_0x4fae2d['body']['id']){delete _0x4fae2d[_0xae13('0x5d')]['id'];}return db[_0xae13('0x56')]['find']({'where':{'id':_0x4fae2d[_0xae13('0x65')]['id']}})[_0xae13('0x22')](handleEntityNotFound(_0x2c0718,null))['then'](function(_0x1c259d){if(_0x1c259d){_0x4fae2d[_0xae13('0x5d')][_0xae13('0x68')]=_0x1c259d['id'];return db['CannedAnswer']['create'](_0x4fae2d[_0xae13('0x5d')]);}})[_0xae13('0x22')](respondWithResult(_0x2c0718,null))[_0xae13('0x58')](handleError(_0x2c0718,null));};exports['getAnswers']=function(_0x76b83f,_0x51230d,_0x28450e){var _0x36a151={'raw':![],'where':{}};var _0x274fc9={};var _0x249d40={'count':0x0,'rows':[]};return db[_0xae13('0x56')][_0xae13('0x6a')]({'where':{'id':_0x76b83f[_0xae13('0x65')]['id']}})[_0xae13('0x22')](handleEntityNotFound(_0x51230d,null))[_0xae13('0x22')](function(_0x2d8f94){if(_0x2d8f94){_0x274fc9['model']=_[_0xae13('0x59')](db['CannedAnswer'][_0xae13('0x41')]);_0x274fc9[_0xae13('0x45')]=_[_0xae13('0x59')](_0x76b83f[_0xae13('0x45')]);_0x274fc9[_0xae13('0x46')]=_[_0xae13('0x47')](_0x274fc9[_0xae13('0x44')],_0x274fc9[_0xae13('0x45')]);_0x36a151[_0xae13('0x49')]=_[_0xae13('0x47')](_0x274fc9['model'],qs[_0xae13('0x48')](_0x76b83f[_0xae13('0x45')][_0xae13('0x48')]));_0x36a151[_0xae13('0x49')]=_0x36a151[_0xae13('0x49')][_0xae13('0x4a')]?_0x36a151[_0xae13('0x49')]:_0x274fc9[_0xae13('0x44')];if(!_0x76b83f['query'][_0xae13('0x4b')](_0xae13('0x4c'))){_0x36a151[_0xae13('0x31')]=qs[_0xae13('0x31')](_0x76b83f[_0xae13('0x45')][_0xae13('0x31')]);_0x36a151[_0xae13('0x2f')]=qs['offset'](_0x76b83f[_0xae13('0x45')][_0xae13('0x2f')]);}_0x36a151[_0xae13('0x4d')]=qs[_0xae13('0x4e')](_0x76b83f[_0xae13('0x45')][_0xae13('0x4e')]);_0x36a151['where']=qs[_0xae13('0x46')](_[_0xae13('0x50')](_0x76b83f[_0xae13('0x45')],_0x274fc9[_0xae13('0x46')]));_0x36a151[_0xae13('0x4f')][_0xae13('0x68')]=_0x2d8f94['id'];if(_0x76b83f[_0xae13('0x45')][_0xae13('0x51')]){_0x36a151[_0xae13('0x4f')]=_[_0xae13('0x52')](_0x36a151[_0xae13('0x4f')],{'$or':_['map'](_0x36a151[_0xae13('0x49')],function(_0x419e7a){var _0xeb37e4={};_0xeb37e4[_0x419e7a]={'$like':'%'+_0x76b83f[_0xae13('0x45')][_0xae13('0x51')]+'%'};return _0xeb37e4;})});}_0x36a151=_[_0xae13('0x52')]({},_0x36a151,_0x76b83f['options']);return db['CannedAnswer'][_0xae13('0x32')]({'where':_0x36a151['where']})[_0xae13('0x22')](function(_0x313f53){_0x249d40[_0xae13('0x32')]=_0x313f53;if(_0x76b83f[_0xae13('0x45')]['includeAll']){_0x36a151['include']=[{'all':!![]}];}return db[_0xae13('0x6e')][_0xae13('0x57')](_0x36a151);})[_0xae13('0x22')](function(_0x4e5555){_0x249d40['rows']=_0x4e5555;return _0x249d40;});}})[_0xae13('0x22')](respondWithFilteredResult(_0x51230d,_0x36a151))[_0xae13('0x58')](handleError(_0x51230d,null));};exports[_0xae13('0x6f')]=function(_0x22bb08,_0x34276a,_0x3b9533){return db['OpenchannelAccount'][_0xae13('0x5b')]({'where':{'id':_0x22bb08[_0xae13('0x65')]['id']}})[_0xae13('0x22')](handleEntityNotFound(_0x34276a,null))['then'](function(_0x4d1a9b){if(_0x4d1a9b){return _0x4d1a9b[_0xae13('0x6f')](_0x22bb08[_0xae13('0x45')][_0xae13('0x6c')]);}})[_0xae13('0x22')](respondWithStatusCode(_0x34276a,null))[_0xae13('0x58')](handleError(_0x34276a,null));};exports[_0xae13('0x70')]=function(_0xa98f5d,_0x588b4c,_0x25178e){var _0x1bd696={'body':_0xa98f5d[_0xae13('0x5d')],'channel':_0xae13('0x71')};var _0x51ff57=[];var _0x388389=[];var _0x3c6c12={};var _0x3fcce0=![];return db[_0xae13('0x72')][_0xae13('0x66')]()[_0xae13('0x22')](function(_0x17c2a0){if(!_0x17c2a0){throw new db[(_0xae13('0x73'))]['ValidationError'](_0xae13('0x74'));}_0x51ff57=_[_0xae13('0x75')](_[_0xae13('0x59')](_0x17c2a0),[_0xae13('0x76'),_0xae13('0x77')]);_0x388389=_['difference'](_['keys'](_0x17c2a0),[_0xae13('0x76'),_0xae13('0x77'),_0xae13('0x78'),_0xae13('0x79')]);if(_0xa98f5d[_0xae13('0x5d')]['id']){delete _0xa98f5d[_0xae13('0x5d')]['id'];}if(_[_0xae13('0x7a')](_0xa98f5d[_0xae13('0x5d')]['from'])){throw new db['Sequelize']['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0xa98f5d[_0xae13('0x5d')][_0xae13('0x5d')])||_0xa98f5d['body'][_0xae13('0x5d')]===''){throw new db[(_0xae13('0x73'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xae13('0x7a')](_0xa98f5d['body'][_0xae13('0x7b')])){throw new db['Sequelize'][(_0xae13('0x7c'))](_0xae13('0x7d')+_0x388389);}if(!_[_0xae13('0x7e')](_0x388389,_0xa98f5d[_0xae13('0x5d')]['mapKey'])){throw new db['Sequelize'][(_0xae13('0x7c'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x388389);}_0x3c6c12[_0xa98f5d[_0xae13('0x5d')][_0xae13('0x7b')]]=_0xa98f5d['body'][_0xae13('0x7f')];})[_0xae13('0x22')](function(){return db[_0xae13('0x56')][_0xae13('0x5b')]({'where':{'id':_0xa98f5d['params']['id']},'include':[{'model':db[_0xae13('0x80')],'as':'List','include':[{'model':db[_0xae13('0x72')],'as':_0xae13('0x81'),'where':_0x3c6c12,'limit':0x1,'order':[[_0xae13('0x77'),_0xae13('0x82')]]}]},{'model':db['OpenchannelApplication'],'as':'Applications'}]});})[_0xae13('0x22')](handleEntityNotFound(_0x588b4c,null))[_0xae13('0x22')](function(_0x5e6267){if(_0x5e6267&&_0x5e6267[_0xae13('0x83')]){_0x1bd696['account']=_0x5e6267;_0x1bd696[_0xae13('0x84')]=_0x5e6267['Applications'];_0x1bd696[_0xae13('0x85')]=_0x5e6267[_0xae13('0x83')];_0x1bd696['applications']=_[_0xae13('0x86')](_0x1bd696['applications'],['priority'],[_0xae13('0x87')]);if(_0x1bd696[_0xae13('0x88')][_0xae13('0x89')]){delete _0x1bd696[_0xae13('0x88')][_0xae13('0x89')];}if(_0x1bd696[_0xae13('0x88')][_0xae13('0x83')]&&_0x1bd696['account'][_0xae13('0x83')][_0xae13('0x81')][_0xae13('0x4a')]){return _0x1bd696[_0xae13('0x88')][_0xae13('0x83')][_0xae13('0x81')][0x0];}var _0x149d20=_[_0xae13('0x1c')](_0xa98f5d[_0xae13('0x5d')],{'firstName':_0xa98f5d[_0xae13('0x5d')][_0xae13('0x7f')],'ListId':_0x5e6267['ListId']});_0x149d20[_0xa98f5d['body']['mapKey']]=_0xa98f5d[_0xae13('0x5d')][_0xae13('0x7f')];return db[_0xae13('0x72')][_0xae13('0x5c')](_0x149d20,{'fields':_0x51ff57,'raw':!![]});}})[_0xae13('0x22')](handleEntityNotFound(_0x588b4c,null))[_0xae13('0x22')](function(_0x52dc06){_0x1bd696[_0xae13('0x8a')]=_0x52dc06;if(_0x52dc06){var _0x33242b={'ContactId':_0x52dc06['id'],'OpenchannelAccountId':_0xa98f5d['params']['id'],'from':(_0x52dc06['firstName']||'')+'\x20'+(_0x52dc06[_0xae13('0x8b')]||'')};var _0x5a5fd1={'OpenchannelAccountId':_0xa98f5d[_0xae13('0x65')]['id'],'closed':![]};if(_0xa98f5d[_0xae13('0x5d')][_0xae13('0x8c')]){_0x5a5fd1[_0xae13('0x8c')]=_0xa98f5d['body'][_0xae13('0x8c')];return db['OpenchannelInteraction']['find']({'where':_0x5a5fd1})['then'](function(_0x37c86d){if(_0x37c86d){return[_0x37c86d,![]];}_0x33242b[_0xae13('0x8c')]=_0xa98f5d[_0xae13('0x5d')][_0xae13('0x8c')];_0x33242b[_0xae13('0x8d')]=_0xa98f5d[_0xae13('0x5d')][_0xae13('0x8d')];return db[_0xae13('0x8e')][_0xae13('0x5c')](_0x33242b)['then'](function(_0x393ee9){return[_0x393ee9,!![]];});});}else{_0x5a5fd1[_0xae13('0x8c')]=null;}_0x5a5fd1[_0xae13('0x8f')]=_0x52dc06['id'];return db[_0xae13('0x8e')][_0xae13('0x5b')]({'where':_0x5a5fd1})[_0xae13('0x22')](function(_0x22801a){if(_0x22801a){return[_0x22801a,![]];}return db[_0xae13('0x8e')][_0xae13('0x5c')](_0x33242b)[_0xae13('0x22')](function(_0x312230){return[_0x312230,!![]];});});}})['spread'](function(_0xcf94bb,_0x1eec1c){if(_0xcf94bb){_0x3fcce0=_0x1eec1c;if(!_0x1eec1c){var _0x2a00bd={'from':(_0x1bd696[_0xae13('0x8a')][_0xae13('0x90')]||'')+'\x20'+(_0x1bd696[_0xae13('0x8a')]['lastName']||'')};if(_0xa98f5d['body'][_0xae13('0x8c')]&&_0xa98f5d[_0xae13('0x5d')][_0xae13('0x91')]&&_0xa98f5d['body'][_0xae13('0x8c')]!=_0xa98f5d[_0xae13('0x5d')][_0xae13('0x91')]){_0x2a00bd[_0xae13('0x8c')]=_0xa98f5d[_0xae13('0x5d')]['messageId'];}return _0xcf94bb[_0xae13('0x37')](_0x2a00bd);}else{return _0xcf94bb;}}})[_0xae13('0x22')](function(_0x295bb8){_0x1bd696['interaction']=_0x295bb8[_0xae13('0x61')]({'plain':!![]});_0x1bd696[_0xae13('0x92')][_0xae13('0x93')]=_0x3fcce0;if(_0x1bd696[_0xae13('0x92')][_0xae13('0x93')]){if(_0x1bd696[_0xae13('0x88')][_0xae13('0x94')]){_0x1bd696[_0xae13('0x84')][_0xae13('0x95')]({'id':0x0,'priority':_0x1bd696['applications'][_0xae13('0x4a')]+0x1,'app':_0xae13('0x96'),'appdata':_0xae13('0x97'),'interval':_0xae13('0x98')});}}return db[_0xae13('0x99')][_0xae13('0x5c')]({'body':_0xa98f5d['body'][_0xae13('0x5d')],'OpenchannelAccountId':_0xa98f5d[_0xae13('0x65')]['id'],'OpenchannelInteractionId':_0x295bb8['id'],'direction':'in','ContactId':_0x1bd696[_0xae13('0x8a')]['id'],'AttachmentId':_0xa98f5d[_0xae13('0x5d')][_0xae13('0x9a')]});})['then'](function(_0xa0a63b){_0x1bd696['message']=_0xa0a63b;if(!_0x1bd696['interaction'][_0xae13('0x9b')])return;return db[_0xae13('0x9c')][_0xae13('0x5b')]({'attributes':['id',_0xae13('0x3c')],'where':{'id':_0x1bd696[_0xae13('0x92')][_0xae13('0x9b')]}});})[_0xae13('0x22')](function(_0x3250ce){if(_0x3250ce){_0x1bd696[_0xae13('0x84')][_0xae13('0x9d')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3250ce[_0xae13('0x3c')]+','+(_0x1bd696['account'][_0xae13('0x9e')]||0xa),'interval':_0xae13('0x98')});_0x1bd696[_0xae13('0x9f')]=!![];}if(!_0x1bd696[_0xae13('0x92')][_0xae13('0xa0')])return;return db['OpenchannelQueue'][_0xae13('0x5b')]({'attributes':['id',_0xae13('0x3c')],'where':{'id':_0x1bd696[_0xae13('0x92')][_0xae13('0xa0')]}});})['then'](function(_0x1cbdb7){if(_0x1cbdb7){_0x1bd696[_0xae13('0x84')][_0xae13('0x9d')]({'id':0x0,'priority':0x1,'app':_0xae13('0xa1'),'appdata':_0x1cbdb7[_0xae13('0x3c')]+','+(_0x1bd696[_0xae13('0x88')]['waitForTheAssignedQueue']||0x12c),'interval':_0xae13('0x98')});}return respondWithRpcPromise('Start',_0xae13('0xa2'),_0x1bd696);})[_0xae13('0x22')](function(_0x5c917b){respondWithRpcPromise(_0xae13('0xa3'),_0xae13('0xa3'),{'event':_0xae13('0x70'),'message':_0x5c917b},client9002);return _0x5c917b;})[_0xae13('0x22')](respondWithResult(_0x588b4c,null))[_0xae13('0x58')](handleError(_0x588b4c,null));};exports[_0xae13('0xa4')]=function(_0x563dd8,_0x5620cd){var _0x295d82=_0x563dd8[_0xae13('0x65')]['id'];var _0x2a33e8=_0x563dd8[_0xae13('0x5d')];var _0x3e11d7=0xc8;var _0x206d0f=null;return db[_0xae13('0xa5')][_0xae13('0xa6')]({'isolationLevel':db[_0xae13('0xa5')]['Transaction'][_0xae13('0xa7')][_0xae13('0xa8')]},function(_0x28668b){return db['OpenchannelAccount'][_0xae13('0x6a')]({'where':{'id':_0x295d82},'transaction':_0x28668b})['then'](function(_0x17b68e){if(_0x17b68e){return db['OpenchannelApplication'][_0xae13('0x3a')]({'where':{'OpenchannelAccountId':_0x295d82},'transaction':_0x28668b})[_0xae13('0x22')](function(){var _0x321bfd=_[_0xae13('0x40')](_0x2a33e8,function(_0x16c86d){_0x16c86d[_0xae13('0x68')]=_0x295d82;return _0x16c86d;});return db['OpenchannelApplication'][_0xae13('0xa9')](_0x321bfd,{'transaction':_0x28668b});});}else{_0x3e11d7=0x194;_0x206d0f=[];}});})['then'](function(){if(_0x3e11d7!==0x194){return db[_0xae13('0xaa')][_0xae13('0xab')]({'where':{'OpenchannelAccountId':_0x295d82},'order':_0xae13('0xac')})[_0xae13('0x22')](function(_0xb780fb){_0x206d0f=_0xb780fb;});}})[_0xae13('0x58')](function(_0x1d7694){_0x3e11d7=0x1f4;logger[_0xae13('0x28')](_0x1d7694[_0xae13('0x3b')]);if(_0x1d7694['name']){delete _0x1d7694['name'];}_0x206d0f=_0x1d7694;})['finally'](function(){if(_0x206d0f===null){_0x5620cd[_0xae13('0x2b')](_0x3e11d7);}else{if(_0x3e11d7===0x1f4){_0x5620cd[_0xae13('0x2d')](_0x3e11d7)['send'](_0x206d0f);}else{_0x5620cd['status'](_0x3e11d7)[_0xae13('0x2e')](_0x206d0f);}}});};exports[_0xae13('0xad')]=function(_0x41fa7e,_0x59dbff,_0x5e05c7){var _0x4b7b8b={};var _0x43e603={};var _0x328dc5;var _0x41c05f;return db['OpenchannelAccount'][_0xae13('0x6a')]({'where':{'id':_0x41fa7e[_0xae13('0x65')]['id']}})[_0xae13('0x22')](handleEntityNotFound(_0x59dbff,null))['then'](function(_0x3690ed){if(_0x3690ed){_0x328dc5=_0x3690ed;_0x43e603[_0xae13('0x44')]=_[_0xae13('0x59')](db[_0xae13('0xaa')]['rawAttributes']);_0x43e603['query']=_[_0xae13('0x59')](_0x41fa7e['query']);_0x43e603[_0xae13('0x46')]=_[_0xae13('0x47')](_0x43e603['model'],_0x43e603[_0xae13('0x45')]);_0x4b7b8b[_0xae13('0x49')]=_[_0xae13('0x47')](_0x43e603[_0xae13('0x44')],qs[_0xae13('0x48')](_0x41fa7e['query'][_0xae13('0x48')]));_0x4b7b8b[_0xae13('0x49')]=_0x4b7b8b['attributes'][_0xae13('0x4a')]?_0x4b7b8b[_0xae13('0x49')]:_0x43e603[_0xae13('0x44')];_0x4b7b8b[_0xae13('0x4d')]=qs['sort'](_0x41fa7e[_0xae13('0x45')][_0xae13('0x4e')]);_0x4b7b8b[_0xae13('0x4f')]=qs[_0xae13('0x46')](_['pick'](_0x41fa7e['query'],_0x43e603[_0xae13('0x46')]));if(_0x41fa7e[_0xae13('0x45')][_0xae13('0x51')]){_0x4b7b8b[_0xae13('0x4f')]=_[_0xae13('0x52')](_0x4b7b8b[_0xae13('0x4f')],{'$or':_[_0xae13('0x40')](_0x4b7b8b[_0xae13('0x49')],function(_0x829c6c){var _0x14092a={};_0x14092a[_0x829c6c]={'$like':'%'+_0x41fa7e['query'][_0xae13('0x51')]+'%'};return _0x14092a;})});}_0x4b7b8b=_[_0xae13('0x52')]({},_0x4b7b8b,_0x41fa7e[_0xae13('0x54')]);return _0x328dc5[_0xae13('0xad')](_0x4b7b8b);}})['then'](function(_0x2287c8){if(_0x2287c8){_0x41c05f=_0x2287c8[_0xae13('0x4a')];if(!_0x41fa7e[_0xae13('0x45')][_0xae13('0x4b')](_0xae13('0x4c'))){_0x4b7b8b['limit']=qs[_0xae13('0x31')](_0x41fa7e[_0xae13('0x45')][_0xae13('0x31')]);_0x4b7b8b[_0xae13('0x2f')]=qs[_0xae13('0x2f')](_0x41fa7e[_0xae13('0x45')][_0xae13('0x2f')]);}return _0x328dc5['getApplications'](_0x4b7b8b);}})[_0xae13('0x22')](function(_0x2c0058){if(_0x2c0058){return _0x2c0058?{'count':_0x41c05f,'rows':_0x2c0058}:null;}})['then'](respondWithResult(_0x59dbff,null))[_0xae13('0x58')](handleError(_0x59dbff,null));};exports[_0xae13('0xae')]=function(_0x311b36,_0x21849b,_0x286ebc){var _0x2c051b={'raw':![],'where':{}};var _0x2e4e0c={};var _0x303f96={'count':0x0,'rows':[]};return db[_0xae13('0x56')]['findOne']({'where':{'id':_0x311b36[_0xae13('0x65')]['id']}})[_0xae13('0x22')](handleEntityNotFound(_0x21849b,null))[_0xae13('0x22')](function(_0x4cd1fc){if(_0x4cd1fc){_0x2e4e0c['model']=_['keys'](db[_0xae13('0x8e')][_0xae13('0x41')]);_0x2e4e0c[_0xae13('0x45')]=_[_0xae13('0x59')](_0x311b36[_0xae13('0x45')]);_0x2e4e0c[_0xae13('0x46')]=_[_0xae13('0x47')](_0x2e4e0c[_0xae13('0x44')],_0x2e4e0c[_0xae13('0x45')]);_0x2c051b['attributes']=_[_0xae13('0x47')](_0x2e4e0c['model'],qs['fields'](_0x311b36[_0xae13('0x45')][_0xae13('0x48')]));_0x2c051b[_0xae13('0x49')]=_0x2c051b[_0xae13('0x49')][_0xae13('0x4a')]?_0x2c051b[_0xae13('0x49')]:_0x2e4e0c[_0xae13('0x44')];if(!_0x311b36['query']['hasOwnProperty'](_0xae13('0x4c'))){_0x2c051b[_0xae13('0x31')]=qs[_0xae13('0x31')](_0x311b36['query'][_0xae13('0x31')]);_0x2c051b[_0xae13('0x2f')]=qs[_0xae13('0x2f')](_0x311b36[_0xae13('0x45')][_0xae13('0x2f')]);}_0x2c051b[_0xae13('0x4d')]=qs[_0xae13('0x4e')](_0x311b36[_0xae13('0x45')][_0xae13('0x4e')]);_0x2c051b['where']=qs[_0xae13('0x46')](_[_0xae13('0x50')](_0x311b36[_0xae13('0x45')],_0x2e4e0c[_0xae13('0x46')]));_0x2c051b[_0xae13('0x4f')]['OpenchannelAccountId']=_0x4cd1fc['id'];if(_0x311b36[_0xae13('0x45')][_0xae13('0x51')]){_0x2c051b[_0xae13('0x4f')]=_['merge'](_0x2c051b[_0xae13('0x4f')],{'$or':_['map'](_0x2c051b[_0xae13('0x49')],function(_0x1fe0c5){var _0x1ef3db={};_0x1ef3db[_0x1fe0c5]={'$like':'%'+_0x311b36['query'][_0xae13('0x51')]+'%'};return _0x1ef3db;})});}_0x2c051b=_[_0xae13('0x52')]({},_0x2c051b,_0x311b36[_0xae13('0x54')]);return db[_0xae13('0x8e')][_0xae13('0x32')]({'where':_0x2c051b[_0xae13('0x4f')]})['then'](function(_0x4e2c36){_0x303f96[_0xae13('0x32')]=_0x4e2c36;if(_0x311b36[_0xae13('0x45')][_0xae13('0x5a')]){_0x2c051b[_0xae13('0x55')]=[{'model':db['CmContact'],'as':_0xae13('0xaf'),'required':![]},{'model':db[_0xae13('0x9c')],'as':'Owner','attributes':[_0xae13('0x3c'),_0xae13('0xb0'),_0xae13('0xb1')],'required':![]},{'model':db[_0xae13('0xb2')],'as':_0xae13('0xb3'),'attributes':['id',_0xae13('0x3c'),_0xae13('0xb4')],'where':_0x311b36[_0xae13('0x45')][_0xae13('0xb5')]?{'id':_0x311b36[_0xae13('0x45')]['tag']}:undefined,'required':_0x311b36[_0xae13('0x45')]['tag']?!![]:![]}];}return db[_0xae13('0x8e')][_0xae13('0x57')](_0x2c051b);})[_0xae13('0x22')](function(_0x332677){_0x303f96[_0xae13('0xb6')]=_0x332677;return _0x303f96;});}})[_0xae13('0x22')](respondWithFilteredResult(_0x21849b,_0x2c051b))[_0xae13('0x58')](handleError(_0x21849b,null));};exports[_0xae13('0xb7')]=function(_0x47e53d,_0x53203d,_0x366104){return db[_0xae13('0x56')][_0xae13('0x5b')]({'where':{'id':_0x47e53d[_0xae13('0x65')]['id']}})['then'](handleEntityNotFound(_0x53203d,null))['then'](function(_0x413614){if(_0x413614){return _0x413614[_0xae13('0xb7')](_0x47e53d[_0xae13('0x5d')][_0xae13('0x6c')],_[_0xae13('0xb8')](_0x47e53d[_0xae13('0x5d')],['ids','id'])||{})['spread'](function(_0xb6beb7){for(var _0x597784=0x0;_0x597784<_0x47e53d[_0xae13('0x5d')]['ids']['length'];_0x597784+=0x1){socket[_0xae13('0xb9')]('userOpenchannelAccount:save',{'UserId':Number(_0x47e53d[_0xae13('0x5d')][_0xae13('0x6c')][_0x597784]),'OpenchannelAccountId':Number(_0x47e53d['params']['id'])});}return _0xb6beb7;});}})[_0xae13('0x22')](respondWithResult(_0x53203d,null))[_0xae13('0x58')](handleError(_0x53203d,null));};exports[_0xae13('0xba')]=function(_0x2951a2,_0x483638,_0x4a30e1){return db[_0xae13('0x56')]['find']({'where':{'id':_0x2951a2[_0xae13('0x65')]['id']}})[_0xae13('0x22')](handleEntityNotFound(_0x483638,null))[_0xae13('0x22')](function(_0x35c012){if(_0x35c012){return _0x35c012[_0xae13('0xba')](_0x2951a2['query']['ids'])[_0xae13('0x22')](function(){if(_[_0xae13('0xbb')](_0x2951a2[_0xae13('0x45')]['ids'])){for(var _0x5ae83e=0x0;_0x5ae83e<_0x2951a2[_0xae13('0x45')]['ids']['length'];_0x5ae83e+=0x1){socket[_0xae13('0xb9')]('userOpenchannelAccount:remove',{'UserId':Number(_0x2951a2[_0xae13('0x45')]['ids'][_0x5ae83e]),'OpenchannelAccountId':Number(_0x2951a2[_0xae13('0x65')]['id'])});}}else{socket[_0xae13('0xb9')](_0xae13('0xbc'),{'UserId':Number(_0x2951a2[_0xae13('0x45')][_0xae13('0x6c')]),'OpenchannelAccountId':Number(_0x2951a2[_0xae13('0x65')]['id'])});}});}})[_0xae13('0x22')](respondWithStatusCode(_0x483638,null))[_0xae13('0x58')](handleError(_0x483638,null));};exports[_0xae13('0xbd')]=function(_0x43c147,_0x38bb55,_0x316973){var _0x311f4f={};var _0x21eb75={};var _0x4a24b7;var _0x5df50d;return db[_0xae13('0x56')][_0xae13('0x6a')]({'where':{'id':_0x43c147[_0xae13('0x65')]['id']}})[_0xae13('0x22')](handleEntityNotFound(_0x38bb55,null))[_0xae13('0x22')](function(_0x6aadea){if(_0x6aadea){_0x4a24b7=_0x6aadea;_0x21eb75['model']=_[_0xae13('0x59')](db[_0xae13('0x9c')][_0xae13('0x41')]);_0x21eb75[_0xae13('0x45')]=_[_0xae13('0x59')](_0x43c147[_0xae13('0x45')]);_0x21eb75['filters']=_['intersection'](_0x21eb75['model'],_0x21eb75['query']);_0x311f4f[_0xae13('0x49')]=_[_0xae13('0x47')](_0x21eb75[_0xae13('0x44')],qs[_0xae13('0x48')](_0x43c147['query'][_0xae13('0x48')]));_0x311f4f[_0xae13('0x49')]=_0x311f4f[_0xae13('0x49')][_0xae13('0x4a')]?_0x311f4f['attributes']:_0x21eb75[_0xae13('0x44')];_0x311f4f[_0xae13('0x4d')]=qs['sort'](_0x43c147[_0xae13('0x45')][_0xae13('0x4e')]);_0x311f4f[_0xae13('0x4f')]=qs[_0xae13('0x46')](_[_0xae13('0x50')](_0x43c147[_0xae13('0x45')],_0x21eb75[_0xae13('0x46')]));if(_0x43c147[_0xae13('0x45')]['filter']){_0x311f4f[_0xae13('0x4f')]=_[_0xae13('0x52')](_0x311f4f[_0xae13('0x4f')],{'$or':_[_0xae13('0x40')](_0x311f4f[_0xae13('0x49')],function(_0x7b7ae3){var _0x1367d2={};_0x1367d2[_0x7b7ae3]={'$like':'%'+_0x43c147[_0xae13('0x45')][_0xae13('0x51')]+'%'};return _0x1367d2;})});}_0x311f4f=_['merge']({},_0x311f4f,_0x43c147[_0xae13('0x54')]);return _0x4a24b7[_0xae13('0xbd')](_0x311f4f);}})[_0xae13('0x22')](function(_0x2cf22f){if(_0x2cf22f){_0x5df50d=_0x2cf22f[_0xae13('0x4a')];if(!_0x43c147[_0xae13('0x45')][_0xae13('0x4b')](_0xae13('0x4c'))){_0x311f4f['limit']=qs['limit'](_0x43c147['query'][_0xae13('0x31')]);_0x311f4f[_0xae13('0x2f')]=qs[_0xae13('0x2f')](_0x43c147[_0xae13('0x45')][_0xae13('0x2f')]);}return _0x4a24b7[_0xae13('0xbd')](_0x311f4f);}})[_0xae13('0x22')](function(_0xb72be5){if(_0xb72be5){return _0xb72be5?{'count':_0x5df50d,'rows':_0xb72be5}:null;}})[_0xae13('0x22')](respondWithResult(_0x38bb55,null))[_0xae13('0x58')](handleError(_0x38bb55,null));};exports[_0xae13('0xbe')]=function(_0x3ad389,_0x2c874c,_0x16eb1d){var _0x2b4f99,_0x546bff,_0x23473e;if(_[_0xae13('0x7a')](_0x3ad389[_0xae13('0x5d')][_0xae13('0x5d')])||_0x3ad389['body'][_0xae13('0x5d')]===''){throw new db[(_0xae13('0x73'))][(_0xae13('0x7c'))](_0xae13('0xbf'));}if(_[_0xae13('0x7a')](_0x3ad389['body']['to'])){}_0x2b4f99=_0x3ad389['body']['to'];return db[_0xae13('0x56')][_0xae13('0x6a')]({'where':{'id':_0x3ad389[_0xae13('0x65')]['id']}})[_0xae13('0x22')](handleEntityNotFound(_0x2c874c,null))[_0xae13('0x22')](function(_0x4aa5e6){if(_0x4aa5e6){return db[_0xae13('0x56')]['find']({'where':{'id':_0x4aa5e6['id']},'include':[{'model':db[_0xae13('0x80')],'as':_0xae13('0x83'),'include':[{'model':db[_0xae13('0x72')],'as':_0xae13('0x81'),'where':{[_0x4aa5e6['mapKey']]:_0x2b4f99},'limit':0x1,'order':[[_0xae13('0x77'),_0xae13('0x82')]]}]}]})['then'](handleEntityNotFound(_0x2c874c,null))[_0xae13('0x22')](function(_0x484fba){if(_0x484fba&&_0x484fba['List']){_0x546bff=_0x484fba[_0xae13('0x61')]({'plain':!![]});if(_0x546bff[_0xae13('0x83')]&&_0x546bff[_0xae13('0x83')][_0xae13('0x81')]['length']){return _0x546bff[_0xae13('0x83')]['Contacts'][0x0];}return db['CmContact'][_0xae13('0x5c')](_[_0xae13('0x1c')](_0x3ad389[_0xae13('0x5d')],{'firstName':_0x2b4f99,[_0x484fba[_0xae13('0x7b')]]:_0x2b4f99,'phone':_0x2b4f99,'ListId':_0x546bff[_0xae13('0x79')]}));}})[_0xae13('0x22')](handleEntityNotFound(_0x2c874c,null))[_0xae13('0x22')](function(_0x3331f5){if(_0x3331f5){_0x23473e=_0x3331f5;return db[_0xae13('0x8e')][_0xae13('0x5b')]({'where':{'ContactId':_0x23473e['id'],'closed':![],'OpenchannelAccountId':_0x546bff['id']}})[_0xae13('0x22')](function(_0x432eff){if(_0x432eff){return[_0x432eff,![]];}return db['OpenchannelInteraction']['create']({'UserId':_0x3ad389[_0xae13('0x5e')]['id'],'ContactId':_0x23473e['id'],'OpenchannelAccountId':_0x546bff['id'],'lastMsgDirection':_0xae13('0xc0'),'firstMsgDirection':_0xae13('0xc0'),'Messages':[_[_0xae13('0x52')](_0x3ad389['body'],{'read':![],'body':_0x3ad389['body']['body'],'OpenchannelAccountId':_0x546bff['id'],'UserId':_0x3ad389['user']['id'],'ContactId':_0x23473e['id']})]},{'include':[{'model':db[_0xae13('0x99')],'as':_0xae13('0xc1')}]})['then'](function(_0x20c4ea){return[_0x20c4ea,!![]];});});}})['spread'](function(_0x34d2bd,_0x391060){if(_0x391060){return _0x34d2bd;}return db[_0xae13('0x99')][_0xae13('0x5c')](_[_0xae13('0x52')](_0x3ad389['body'],{'read':![],'body':_0x3ad389[_0xae13('0x5d')][_0xae13('0x5d')],'OpenchannelAccountId':_0x546bff['id'],'OpenchannelInteractionId':_0x34d2bd['id'],'UserId':_0x3ad389[_0xae13('0x5e')]['id'],'ContactId':_0x23473e['id']}))[_0xae13('0x22')](function(_0x56573a){_0x34d2bd['dataValues'][_0xae13('0xc1')]=[];_0x34d2bd[_0xae13('0xc2')]['Messages'][_0xae13('0x95')](_0x56573a[_0xae13('0xc2')]);return _0x34d2bd;});});}})[_0xae13('0x22')](respondWithResult(_0x2c874c,null))[_0xae13('0x58')](handleError(_0x2c874c,null));}; \ No newline at end of file +var _0x5fc7=['ids','notify','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','List','CmContact','Contacts','applications','Applications','list','orderBy','priority','account','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','forcedOwnership','OpenchannelQueue','queueId','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','addApplications','sequelize','Transaction','OpenchannelApplication','findAndCountAll','finally','send','getApplications','getInteractions','Contact','Owner','fullname','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','CmList','DESC','Messages','dataValues','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','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./openchannelAccount.socket','register','jayson/promise','client','http','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','OpenchannelAccounts','UserProfileResource','end','stack','name','index','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','Pause','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','order','map','removeDispositions','addAnswer','CannedAnswer','pick'];(function(_0x14fb0f,_0x20b35a){var _0x382348=function(_0x404709){while(--_0x404709){_0x14fb0f['push'](_0x14fb0f['shift']());}};_0x382348(++_0x20b35a);}(_0x5fc7,0x1e1));var _0x75fc=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x5fc7[_0x4ae6ef];return _0x3cbb4e;};'use strict';var emlformat=require(_0x75fc('0x0'));var rimraf=require(_0x75fc('0x1'));var zipdir=require(_0x75fc('0x2'));var jsonpatch=require(_0x75fc('0x3'));var rp=require(_0x75fc('0x4'));var moment=require(_0x75fc('0x5'));var BPromise=require(_0x75fc('0x6'));var Mustache=require(_0x75fc('0x7'));var util=require(_0x75fc('0x8'));var path=require(_0x75fc('0x9'));var sox=require(_0x75fc('0xa'));var csv=require(_0x75fc('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x75fc('0xc'));var _=require(_0x75fc('0xd'));var squel=require(_0x75fc('0xe'));var crypto=require(_0x75fc('0xf'));var jsforce=require(_0x75fc('0x10'));var deskjs=require(_0x75fc('0x11'));var toCsv=require(_0x75fc('0xb'));var querystring=require(_0x75fc('0x12'));var Papa=require(_0x75fc('0x13'));var Redis=require(_0x75fc('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x75fc('0x15'));var as=require(_0x75fc('0x16'));var hardwareService=require(_0x75fc('0x17'));var logger=require(_0x75fc('0x18'))('api');var utils=require(_0x75fc('0x19'));var config=require(_0x75fc('0x1a'));var licenseUtil=require(_0x75fc('0x1b'));var db=require(_0x75fc('0x1c'))['db'];config[_0x75fc('0x1d')]=_[_0x75fc('0x1e')](config[_0x75fc('0x1d')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x75fc('0x1f'))[_0x75fc('0x20')](socket);var jayson=require(_0x75fc('0x21'));var client=jayson[_0x75fc('0x22')][_0x75fc('0x23')]({'port':0x232c});var client9002=jayson[_0x75fc('0x22')][_0x75fc('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x3053b6,_0x53f23d,_0xf3dec8,_0x382201){return new BPromise(function(_0x51011d,_0x1ce09b){var _0x9a1359=_0x382201||client;return _0x9a1359['request'](_0x3053b6,_0xf3dec8)['then'](function(_0x25b52b){logger[_0x75fc('0x24')](_0x75fc('0x25'),_0x53f23d,_0x75fc('0x26'));logger[_0x75fc('0x27')](_0x75fc('0x28'),_0x53f23d,'request\x20sent',JSON[_0x75fc('0x29')](_0x25b52b));if(_0x25b52b['error']){if(_0x25b52b[_0x75fc('0x2a')][_0x75fc('0x2b')]===0x1f4){logger[_0x75fc('0x2a')](_0x75fc('0x25'),_0x53f23d,_0x25b52b['error'][_0x75fc('0x2c')]);return _0x1ce09b(_0x25b52b[_0x75fc('0x2a')]['message']);}logger[_0x75fc('0x2a')](_0x75fc('0x25'),_0x53f23d,_0x25b52b['error'][_0x75fc('0x2c')]);return _0x51011d(_0x25b52b['error'][_0x75fc('0x2c')]);}else{logger[_0x75fc('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0x53f23d,_0x75fc('0x26'));_0x51011d(_0x25b52b[_0x75fc('0x2d')]['message']);}})[_0x75fc('0x2e')](function(_0x2418be){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x53f23d,_0x2418be);_0x1ce09b(_0x2418be);});});}function respondWithStatusCode(_0x10a59a,_0x5a75b2){_0x5a75b2=_0x5a75b2||0xcc;return function(_0x19a59e){if(_0x19a59e){return _0x10a59a[_0x75fc('0x2f')](_0x5a75b2);}return _0x10a59a['status'](_0x5a75b2)['end']();};}function respondWithResult(_0x5dd7a9,_0x5530c9){_0x5530c9=_0x5530c9||0xc8;return function(_0x3ceb61){if(_0x3ceb61){return _0x5dd7a9[_0x75fc('0x30')](_0x5530c9)[_0x75fc('0x31')](_0x3ceb61);}};}function respondWithFilteredResult(_0xe13951,_0xc7025){return function(_0x337058){if(_0x337058){var _0x54bcd5=typeof _0xc7025[_0x75fc('0x32')]===_0x75fc('0x33')&&typeof _0xc7025[_0x75fc('0x34')]===_0x75fc('0x33');var _0x5c8adb=_0x337058[_0x75fc('0x35')];var _0x486e3f=_0x54bcd5?0x0:_0xc7025[_0x75fc('0x32')];var _0x337032=_0x54bcd5?_0x337058[_0x75fc('0x35')]:_0xc7025[_0x75fc('0x32')]+_0xc7025['limit'];var _0x26fdf0;if(_0x337032>=_0x5c8adb){_0x337032=_0x5c8adb;_0x26fdf0=0xc8;}else{_0x26fdf0=0xce;}_0xe13951['status'](_0x26fdf0);return _0xe13951[_0x75fc('0x36')](_0x75fc('0x37'),_0x486e3f+'-'+_0x337032+'/'+_0x5c8adb)['json'](_0x337058);}return null;};}function patchUpdates(_0x1131d5){return function(_0xb00b6e){try{jsonpatch['apply'](_0xb00b6e,_0x1131d5,!![]);}catch(_0x361862){return BPromise[_0x75fc('0x38')](_0x361862);}return _0xb00b6e[_0x75fc('0x39')]();};}function saveUpdates(_0x20e435,_0x2b3edb){return function(_0x4755df){if(_0x4755df){return _0x4755df[_0x75fc('0x3a')](_0x20e435)[_0x75fc('0x3b')](function(_0x581475){return _0x581475;});}return null;};}function removeEntity(_0xeebc79,_0x447c13){return function(_0x46dfa2){if(_0x46dfa2){return _0x46dfa2[_0x75fc('0x3c')]()[_0x75fc('0x3b')](function(){var _0x3a629c=_0x46dfa2[_0x75fc('0x3d')]({'plain':!![]});var _0x10ea7c=_0x75fc('0x3e');return db[_0x75fc('0x3f')][_0x75fc('0x3c')]({'where':{'type':_0x10ea7c,'resourceId':_0x3a629c['id']}})[_0x75fc('0x3b')](function(){return _0x46dfa2;});})[_0x75fc('0x3b')](function(){_0xeebc79['status'](0xcc)[_0x75fc('0x40')]();});}};}function handleEntityNotFound(_0x1c9e6f,_0x9636fe){return function(_0x19e172){if(!_0x19e172){_0x1c9e6f['sendStatus'](0x194);}return _0x19e172;};}function handleError(_0x458bdf,_0x2e3c70){_0x2e3c70=_0x2e3c70||0x1f4;return function(_0x27fec3){logger[_0x75fc('0x2a')](_0x27fec3[_0x75fc('0x41')]);if(_0x27fec3[_0x75fc('0x42')]){delete _0x27fec3[_0x75fc('0x42')];}_0x458bdf[_0x75fc('0x30')](_0x2e3c70)['send'](_0x27fec3);};}exports[_0x75fc('0x43')]=function(_0x18ef60,_0x2b7398){var _0x45f2b9={'include':[{'model':db['Pause'],'as':_0x75fc('0x44')}]},_0x2332a9={},_0x443e1b={'count':0x0,'rows':[]};var _0x3e14c0=_['map'](db[_0x75fc('0x45')][_0x75fc('0x46')],function(_0x2e6273){return{'name':_0x2e6273[_0x75fc('0x47')],'type':_0x2e6273[_0x75fc('0x48')]['key']};});_0x2332a9[_0x75fc('0x49')]=_['map'](_0x3e14c0,_0x75fc('0x42'));_0x2332a9[_0x75fc('0x4a')]=_[_0x75fc('0x4b')](_0x18ef60[_0x75fc('0x4a')]);_0x2332a9[_0x75fc('0x4c')]=_[_0x75fc('0x4d')](_0x2332a9[_0x75fc('0x49')],_0x2332a9[_0x75fc('0x4a')]);_0x45f2b9[_0x75fc('0x4e')]=_['intersection'](_0x2332a9[_0x75fc('0x49')],qs[_0x75fc('0x4f')](_0x18ef60[_0x75fc('0x4a')][_0x75fc('0x4f')]));_0x45f2b9[_0x75fc('0x4e')]=_0x45f2b9['attributes'][_0x75fc('0x50')]?_0x45f2b9[_0x75fc('0x4e')]:_0x2332a9[_0x75fc('0x49')];if(!_0x18ef60['query'][_0x75fc('0x51')](_0x75fc('0x52'))){_0x45f2b9[_0x75fc('0x34')]=qs[_0x75fc('0x34')](_0x18ef60[_0x75fc('0x4a')][_0x75fc('0x34')]);_0x45f2b9[_0x75fc('0x32')]=qs['offset'](_0x18ef60[_0x75fc('0x4a')][_0x75fc('0x32')]);}_0x45f2b9['order']=qs[_0x75fc('0x53')](_0x18ef60[_0x75fc('0x4a')][_0x75fc('0x53')]);_0x45f2b9['where']=qs[_0x75fc('0x4c')](_['pick'](_0x18ef60['query'],_0x2332a9['filters']),_0x3e14c0);if(_0x18ef60[_0x75fc('0x4a')][_0x75fc('0x54')]){_0x45f2b9[_0x75fc('0x55')]=_['merge'](_0x45f2b9[_0x75fc('0x55')],{'$or':_['map'](_0x3e14c0,function(_0x80b278){if(_0x80b278[_0x75fc('0x48')]!==_0x75fc('0x56')){var _0x947e85={};_0x947e85[_0x80b278['name']]={'$like':'%'+_0x18ef60[_0x75fc('0x4a')][_0x75fc('0x54')]+'%'};return _0x947e85;}})});}_0x45f2b9=_[_0x75fc('0x57')]({},_0x45f2b9,_0x18ef60[_0x75fc('0x58')]);var _0x464cde={'where':_0x45f2b9[_0x75fc('0x55')]};return db[_0x75fc('0x45')]['count'](_0x464cde)[_0x75fc('0x3b')](function(_0x499b76){_0x443e1b[_0x75fc('0x35')]=_0x499b76;if(_0x18ef60[_0x75fc('0x4a')][_0x75fc('0x59')]){_0x45f2b9[_0x75fc('0x5a')]=[{'all':!![]}];}return db[_0x75fc('0x45')][_0x75fc('0x5b')](_0x45f2b9);})[_0x75fc('0x3b')](function(_0xadecdc){_0x443e1b[_0x75fc('0x5c')]=_0xadecdc;return _0x443e1b;})['then'](respondWithFilteredResult(_0x2b7398,_0x45f2b9))[_0x75fc('0x2e')](handleError(_0x2b7398,null));};exports[_0x75fc('0x5d')]=function(_0x776bd2,_0xec2c6c){var _0x488ac5={'raw':![],'where':{'id':_0x776bd2[_0x75fc('0x5e')]['id']},'include':[{'model':db['Pause'],'as':_0x75fc('0x44')}]},_0x4c4082={};_0x4c4082[_0x75fc('0x49')]=_[_0x75fc('0x4b')](db[_0x75fc('0x45')][_0x75fc('0x46')]);_0x4c4082[_0x75fc('0x4a')]=_[_0x75fc('0x4b')](_0x776bd2[_0x75fc('0x4a')]);_0x4c4082[_0x75fc('0x4c')]=_[_0x75fc('0x4d')](_0x4c4082['model'],_0x4c4082[_0x75fc('0x4a')]);_0x488ac5[_0x75fc('0x4e')]=_[_0x75fc('0x4d')](_0x4c4082['model'],qs['fields'](_0x776bd2[_0x75fc('0x4a')][_0x75fc('0x4f')]));_0x488ac5[_0x75fc('0x4e')]=_0x488ac5[_0x75fc('0x4e')]['length']?_0x488ac5[_0x75fc('0x4e')]:_0x4c4082[_0x75fc('0x49')];if(_0x776bd2['query'][_0x75fc('0x59')]){_0x488ac5['include']=[{'all':!![]}];}_0x488ac5=_[_0x75fc('0x57')]({},_0x488ac5,_0x776bd2[_0x75fc('0x58')]);return db[_0x75fc('0x45')]['find'](_0x488ac5)[_0x75fc('0x3b')](handleEntityNotFound(_0xec2c6c,null))[_0x75fc('0x3b')](respondWithResult(_0xec2c6c,null))[_0x75fc('0x2e')](handleError(_0xec2c6c,null));};exports[_0x75fc('0x5f')]=function(_0x45cd82,_0x3c14b8){return db[_0x75fc('0x45')][_0x75fc('0x5f')](_0x45cd82[_0x75fc('0x60')],{})['then'](function(_0x5460a2){var _0x40ce47=_0x45cd82['user'][_0x75fc('0x3d')]({'plain':!![]});if(!_0x40ce47)throw new Error(_0x75fc('0x61'));if(_0x40ce47['role']===_0x75fc('0x62')){var _0x3d2687=_0x5460a2['get']({'plain':!![]});var _0x10fcb3=_0x75fc('0x3e');return db[_0x75fc('0x63')]['find']({'where':{'name':_0x10fcb3,'userProfileId':_0x40ce47[_0x75fc('0x64')]},'raw':!![]})[_0x75fc('0x3b')](function(_0x11ded3){if(_0x11ded3&&_0x11ded3[_0x75fc('0x65')]===0x0){return db[_0x75fc('0x3f')][_0x75fc('0x5f')]({'name':_0x3d2687[_0x75fc('0x42')],'resourceId':_0x3d2687['id'],'type':_0x11ded3['name'],'sectionId':_0x11ded3['id']},{})[_0x75fc('0x3b')](function(){return _0x5460a2;});}else{return _0x5460a2;}})['catch'](function(_0x4adaf3){logger['error'](_0x75fc('0x66'),_0x4adaf3);throw _0x4adaf3;});}return _0x5460a2;})[_0x75fc('0x3b')](respondWithResult(_0x3c14b8,0xc9))[_0x75fc('0x2e')](handleError(_0x3c14b8,null));};exports[_0x75fc('0x3a')]=function(_0x4ea09a,_0x11f15f){if(_0x4ea09a[_0x75fc('0x60')]['id']){delete _0x4ea09a['body']['id'];}return db[_0x75fc('0x45')][_0x75fc('0x67')]({'where':{'id':_0x4ea09a['params']['id']},'include':[{'model':db[_0x75fc('0x68')],'as':_0x75fc('0x44')}]})[_0x75fc('0x3b')](handleEntityNotFound(_0x11f15f,null))[_0x75fc('0x3b')](saveUpdates(_0x4ea09a[_0x75fc('0x60')],null))[_0x75fc('0x3b')](respondWithResult(_0x11f15f,null))[_0x75fc('0x2e')](handleError(_0x11f15f,null));};exports[_0x75fc('0x3c')]=function(_0xc18f1f,_0x1ca082){return db['OpenchannelAccount'][_0x75fc('0x67')]({'where':{'id':_0xc18f1f[_0x75fc('0x5e')]['id']}})[_0x75fc('0x3b')](handleEntityNotFound(_0x1ca082,null))[_0x75fc('0x3b')](removeEntity(_0x1ca082,null))[_0x75fc('0x2e')](handleError(_0x1ca082,null));};exports['describe']=function(_0xc00fb,_0x2ed807){return db['OpenchannelAccount']['describe']()['then'](respondWithResult(_0x2ed807,null))[_0x75fc('0x2e')](handleError(_0x2ed807,null));};exports[_0x75fc('0x69')]=function(_0x2f8357,_0x2be335,_0x18c6bb){if(_0x2f8357[_0x75fc('0x60')]['id']){delete _0x2f8357['body']['id'];}return db['OpenchannelAccount'][_0x75fc('0x67')]({'where':{'id':_0x2f8357[_0x75fc('0x5e')]['id']}})['then'](handleEntityNotFound(_0x2be335,null))['then'](function(_0x4586ec){if(_0x4586ec){_0x2f8357[_0x75fc('0x60')][_0x75fc('0x6a')]=_0x4586ec['id'];return db[_0x75fc('0x6b')]['create'](_0x2f8357['body']);}})[_0x75fc('0x3b')](respondWithResult(_0x2be335,null))['catch'](handleError(_0x2be335,null));};exports[_0x75fc('0x6c')]=function(_0x279398,_0x20259e,_0x4274a3){var _0x4395b8={'raw':![],'where':{}};var _0xb65700={};var _0x25cdfe={'count':0x0,'rows':[]};return db[_0x75fc('0x45')][_0x75fc('0x6d')]({'where':{'id':_0x279398['params']['id']}})[_0x75fc('0x3b')](handleEntityNotFound(_0x20259e,null))[_0x75fc('0x3b')](function(_0x3b59f8){if(_0x3b59f8){_0xb65700[_0x75fc('0x49')]=_[_0x75fc('0x4b')](db['Disposition'][_0x75fc('0x46')]);_0xb65700['query']=_[_0x75fc('0x4b')](_0x279398[_0x75fc('0x4a')]);_0xb65700[_0x75fc('0x4c')]=_[_0x75fc('0x4d')](_0xb65700[_0x75fc('0x49')],_0xb65700['query']);_0x4395b8[_0x75fc('0x4e')]=_[_0x75fc('0x4d')](_0xb65700[_0x75fc('0x49')],qs[_0x75fc('0x4f')](_0x279398[_0x75fc('0x4a')]['fields']));_0x4395b8[_0x75fc('0x4e')]=_0x4395b8[_0x75fc('0x4e')][_0x75fc('0x50')]?_0x4395b8[_0x75fc('0x4e')]:_0xb65700[_0x75fc('0x49')];if(!_0x279398[_0x75fc('0x4a')]['hasOwnProperty']('nolimit')){_0x4395b8[_0x75fc('0x34')]=qs[_0x75fc('0x34')](_0x279398[_0x75fc('0x4a')][_0x75fc('0x34')]);_0x4395b8[_0x75fc('0x32')]=qs[_0x75fc('0x32')](_0x279398[_0x75fc('0x4a')][_0x75fc('0x32')]);}_0x4395b8[_0x75fc('0x6e')]=qs['sort'](_0x279398[_0x75fc('0x4a')][_0x75fc('0x53')]);_0x4395b8[_0x75fc('0x55')]=qs['filters'](_['pick'](_0x279398[_0x75fc('0x4a')],_0xb65700[_0x75fc('0x4c')]));_0x4395b8[_0x75fc('0x55')][_0x75fc('0x6a')]=_0x3b59f8['id'];if(_0x279398[_0x75fc('0x4a')][_0x75fc('0x54')]){_0x4395b8['where']=_[_0x75fc('0x57')](_0x4395b8[_0x75fc('0x55')],{'$or':_[_0x75fc('0x6f')](_0x4395b8[_0x75fc('0x4e')],function(_0x48a670){var _0x3e65ca={};_0x3e65ca[_0x48a670]={'$like':'%'+_0x279398[_0x75fc('0x4a')]['filter']+'%'};return _0x3e65ca;})});}_0x4395b8=_[_0x75fc('0x57')]({},_0x4395b8,_0x279398[_0x75fc('0x58')]);return db[_0x75fc('0x6b')][_0x75fc('0x35')]({'where':_0x4395b8[_0x75fc('0x55')]})[_0x75fc('0x3b')](function(_0x30dd19){_0x25cdfe['count']=_0x30dd19;if(_0x279398[_0x75fc('0x4a')]['includeAll']){_0x4395b8['include']=[{'all':!![]}];}return db[_0x75fc('0x6b')]['findAll'](_0x4395b8);})[_0x75fc('0x3b')](function(_0xeac7a1){_0x25cdfe['rows']=_0xeac7a1;return _0x25cdfe;});}})[_0x75fc('0x3b')](respondWithFilteredResult(_0x20259e,_0x4395b8))[_0x75fc('0x2e')](handleError(_0x20259e,null));};exports[_0x75fc('0x70')]=function(_0x50655d,_0x3a27ac,_0x184ba5){return db[_0x75fc('0x45')][_0x75fc('0x67')]({'where':{'id':_0x50655d[_0x75fc('0x5e')]['id']}})['then'](handleEntityNotFound(_0x3a27ac,null))['then'](function(_0x221370){if(_0x221370){return _0x221370['removeDispositions'](_0x50655d[_0x75fc('0x4a')]['ids']);}})[_0x75fc('0x3b')](respondWithStatusCode(_0x3a27ac,null))[_0x75fc('0x2e')](handleError(_0x3a27ac,null));};exports[_0x75fc('0x71')]=function(_0x59d5c6,_0x10e977,_0x2d4f7e){if(_0x59d5c6[_0x75fc('0x60')]['id']){delete _0x59d5c6[_0x75fc('0x60')]['id'];}return db[_0x75fc('0x45')][_0x75fc('0x67')]({'where':{'id':_0x59d5c6[_0x75fc('0x5e')]['id']}})[_0x75fc('0x3b')](handleEntityNotFound(_0x10e977,null))[_0x75fc('0x3b')](function(_0x30cb1b){if(_0x30cb1b){_0x59d5c6[_0x75fc('0x60')][_0x75fc('0x6a')]=_0x30cb1b['id'];return db[_0x75fc('0x72')][_0x75fc('0x5f')](_0x59d5c6[_0x75fc('0x60')]);}})[_0x75fc('0x3b')](respondWithResult(_0x10e977,null))[_0x75fc('0x2e')](handleError(_0x10e977,null));};exports['getAnswers']=function(_0x46d71c,_0x8282ec,_0x5d05ff){var _0x4e1f1d={'raw':![],'where':{}};var _0x45d640={};var _0xa2d279={'count':0x0,'rows':[]};return db[_0x75fc('0x45')][_0x75fc('0x6d')]({'where':{'id':_0x46d71c[_0x75fc('0x5e')]['id']}})[_0x75fc('0x3b')](handleEntityNotFound(_0x8282ec,null))[_0x75fc('0x3b')](function(_0x2a6a2b){if(_0x2a6a2b){_0x45d640[_0x75fc('0x49')]=_[_0x75fc('0x4b')](db[_0x75fc('0x72')][_0x75fc('0x46')]);_0x45d640[_0x75fc('0x4a')]=_['keys'](_0x46d71c[_0x75fc('0x4a')]);_0x45d640[_0x75fc('0x4c')]=_[_0x75fc('0x4d')](_0x45d640[_0x75fc('0x49')],_0x45d640[_0x75fc('0x4a')]);_0x4e1f1d['attributes']=_[_0x75fc('0x4d')](_0x45d640[_0x75fc('0x49')],qs[_0x75fc('0x4f')](_0x46d71c['query']['fields']));_0x4e1f1d['attributes']=_0x4e1f1d[_0x75fc('0x4e')][_0x75fc('0x50')]?_0x4e1f1d['attributes']:_0x45d640[_0x75fc('0x49')];if(!_0x46d71c[_0x75fc('0x4a')][_0x75fc('0x51')](_0x75fc('0x52'))){_0x4e1f1d['limit']=qs['limit'](_0x46d71c[_0x75fc('0x4a')][_0x75fc('0x34')]);_0x4e1f1d[_0x75fc('0x32')]=qs[_0x75fc('0x32')](_0x46d71c[_0x75fc('0x4a')][_0x75fc('0x32')]);}_0x4e1f1d[_0x75fc('0x6e')]=qs[_0x75fc('0x53')](_0x46d71c[_0x75fc('0x4a')]['sort']);_0x4e1f1d['where']=qs[_0x75fc('0x4c')](_[_0x75fc('0x73')](_0x46d71c[_0x75fc('0x4a')],_0x45d640[_0x75fc('0x4c')]));_0x4e1f1d['where'][_0x75fc('0x6a')]=_0x2a6a2b['id'];if(_0x46d71c[_0x75fc('0x4a')][_0x75fc('0x54')]){_0x4e1f1d[_0x75fc('0x55')]=_[_0x75fc('0x57')](_0x4e1f1d['where'],{'$or':_['map'](_0x4e1f1d[_0x75fc('0x4e')],function(_0x535a89){var _0x4db6b4={};_0x4db6b4[_0x535a89]={'$like':'%'+_0x46d71c[_0x75fc('0x4a')]['filter']+'%'};return _0x4db6b4;})});}_0x4e1f1d=_[_0x75fc('0x57')]({},_0x4e1f1d,_0x46d71c[_0x75fc('0x58')]);return db['CannedAnswer']['count']({'where':_0x4e1f1d[_0x75fc('0x55')]})[_0x75fc('0x3b')](function(_0x29bb5a){_0xa2d279[_0x75fc('0x35')]=_0x29bb5a;if(_0x46d71c[_0x75fc('0x4a')][_0x75fc('0x59')]){_0x4e1f1d[_0x75fc('0x5a')]=[{'all':!![]}];}return db[_0x75fc('0x72')][_0x75fc('0x5b')](_0x4e1f1d);})['then'](function(_0x1b3588){_0xa2d279[_0x75fc('0x5c')]=_0x1b3588;return _0xa2d279;});}})[_0x75fc('0x3b')](respondWithFilteredResult(_0x8282ec,_0x4e1f1d))[_0x75fc('0x2e')](handleError(_0x8282ec,null));};exports['removeAnswers']=function(_0x58c0f9,_0x43b1c3,_0x43ee50){return db[_0x75fc('0x45')][_0x75fc('0x67')]({'where':{'id':_0x58c0f9['params']['id']}})[_0x75fc('0x3b')](handleEntityNotFound(_0x43b1c3,null))[_0x75fc('0x3b')](function(_0x37c31f){if(_0x37c31f){return _0x37c31f['removeAnswers'](_0x58c0f9[_0x75fc('0x4a')][_0x75fc('0x74')]);}})['then'](respondWithStatusCode(_0x43b1c3,null))[_0x75fc('0x2e')](handleError(_0x43b1c3,null));};exports[_0x75fc('0x75')]=function(_0x525587,_0x3518d1,_0x10a24e){var _0x334287={'body':_0x525587[_0x75fc('0x60')],'channel':'openchannel'};var _0x3ddfbc=[];var _0x3dfd28=[];var _0x278188={};var _0x24c74b=![];return db['CmContact']['describe']()[_0x75fc('0x3b')](function(_0x1dd459){if(!_0x1dd459){throw new db['Sequelize'][(_0x75fc('0x76'))](_0x75fc('0x77'));}_0x3ddfbc=_[_0x75fc('0x78')](_[_0x75fc('0x4b')](_0x1dd459),[_0x75fc('0x79'),_0x75fc('0x7a')]);_0x3dfd28=_['difference'](_[_0x75fc('0x4b')](_0x1dd459),[_0x75fc('0x79'),_0x75fc('0x7a'),_0x75fc('0x7b'),_0x75fc('0x7c')]);if(_0x525587[_0x75fc('0x60')]['id']){delete _0x525587[_0x75fc('0x60')]['id'];}if(_[_0x75fc('0x7d')](_0x525587['body']['from'])){throw new db[(_0x75fc('0x7e'))]['ValidationError'](_0x75fc('0x7f'));}if(_[_0x75fc('0x7d')](_0x525587[_0x75fc('0x60')][_0x75fc('0x60')])||_0x525587[_0x75fc('0x60')][_0x75fc('0x60')]===''){throw new db[(_0x75fc('0x7e'))][(_0x75fc('0x76'))](_0x75fc('0x80'));}if(_[_0x75fc('0x7d')](_0x525587[_0x75fc('0x60')][_0x75fc('0x81')])){throw new db[(_0x75fc('0x7e'))][(_0x75fc('0x76'))](_0x75fc('0x82')+_0x3dfd28);}if(!_[_0x75fc('0x83')](_0x3dfd28,_0x525587[_0x75fc('0x60')][_0x75fc('0x81')])){throw new db['Sequelize'][(_0x75fc('0x76'))](_0x75fc('0x84')+_0x3dfd28);}_0x278188[_0x525587['body'][_0x75fc('0x81')]]=_0x525587[_0x75fc('0x60')][_0x75fc('0x85')];})['then'](function(){return db['OpenchannelAccount']['find']({'where':{'id':_0x525587[_0x75fc('0x5e')]['id']},'include':[{'model':db['CmList'],'as':_0x75fc('0x86'),'include':[{'model':db[_0x75fc('0x87')],'as':_0x75fc('0x88'),'where':_0x278188,'limit':0x1,'order':[[_0x75fc('0x7a'),'DESC']]}]},{'model':db['OpenchannelApplication'],'as':'Applications'}]});})[_0x75fc('0x3b')](handleEntityNotFound(_0x3518d1,null))[_0x75fc('0x3b')](function(_0x4ff6e9){if(_0x4ff6e9&&_0x4ff6e9[_0x75fc('0x86')]){_0x334287['account']=_0x4ff6e9;_0x334287[_0x75fc('0x89')]=_0x4ff6e9[_0x75fc('0x8a')];_0x334287[_0x75fc('0x8b')]=_0x4ff6e9['List'];_0x334287[_0x75fc('0x89')]=_[_0x75fc('0x8c')](_0x334287[_0x75fc('0x89')],[_0x75fc('0x8d')],['asc']);if(_0x334287[_0x75fc('0x8e')][_0x75fc('0x8a')]){delete _0x334287[_0x75fc('0x8e')][_0x75fc('0x8a')];}if(_0x334287[_0x75fc('0x8e')][_0x75fc('0x86')]&&_0x334287['account'][_0x75fc('0x86')]['Contacts'][_0x75fc('0x50')]){return _0x334287['account'][_0x75fc('0x86')][_0x75fc('0x88')][0x0];}var _0x2523ff=_[_0x75fc('0x1e')](_0x525587['body'],{'firstName':_0x525587['body']['from'],'ListId':_0x4ff6e9[_0x75fc('0x7c')]});_0x2523ff[_0x525587[_0x75fc('0x60')][_0x75fc('0x81')]]=_0x525587[_0x75fc('0x60')][_0x75fc('0x85')];return db[_0x75fc('0x87')][_0x75fc('0x5f')](_0x2523ff,{'fields':_0x3ddfbc,'raw':!![]});}})['then'](handleEntityNotFound(_0x3518d1,null))['then'](function(_0x563a79){_0x334287[_0x75fc('0x8f')]=_0x563a79;if(_0x563a79){var _0x5c368c={'ContactId':_0x563a79['id'],'OpenchannelAccountId':_0x525587[_0x75fc('0x5e')]['id'],'from':(_0x563a79[_0x75fc('0x90')]||'')+'\x20'+(_0x563a79[_0x75fc('0x91')]||'')};var _0x5756bb={'OpenchannelAccountId':_0x525587['params']['id'],'closed':![]};if(_0x525587['body'][_0x75fc('0x92')]){_0x5756bb[_0x75fc('0x92')]=_0x525587['body'][_0x75fc('0x92')];return db[_0x75fc('0x93')][_0x75fc('0x67')]({'where':_0x5756bb})['then'](function(_0x4151d0){if(_0x4151d0){return[_0x4151d0,![]];}_0x5c368c[_0x75fc('0x92')]=_0x525587[_0x75fc('0x60')][_0x75fc('0x92')];_0x5c368c[_0x75fc('0x94')]=_0x525587[_0x75fc('0x60')][_0x75fc('0x94')];return db[_0x75fc('0x93')][_0x75fc('0x5f')](_0x5c368c)[_0x75fc('0x3b')](function(_0x487dcc){return[_0x487dcc,!![]];});});}else{_0x5756bb['threadId']=null;}_0x5756bb[_0x75fc('0x95')]=_0x563a79['id'];return db['OpenchannelInteraction'][_0x75fc('0x67')]({'where':_0x5756bb})['then'](function(_0xe99810){if(_0xe99810){return[_0xe99810,![]];}return db['OpenchannelInteraction']['create'](_0x5c368c)[_0x75fc('0x3b')](function(_0x4248c7){return[_0x4248c7,!![]];});});}})[_0x75fc('0x96')](function(_0x2cb8e1,_0x24e427){if(_0x2cb8e1){_0x24c74b=_0x24e427;if(!_0x24e427){var _0x440d76={'from':(_0x334287[_0x75fc('0x8f')][_0x75fc('0x90')]||'')+'\x20'+(_0x334287[_0x75fc('0x8f')][_0x75fc('0x91')]||'')};if(_0x525587[_0x75fc('0x60')][_0x75fc('0x92')]&&_0x525587[_0x75fc('0x60')][_0x75fc('0x97')]&&_0x525587[_0x75fc('0x60')]['threadId']!=_0x525587[_0x75fc('0x60')][_0x75fc('0x97')]){_0x440d76[_0x75fc('0x92')]=_0x525587['body'][_0x75fc('0x97')];}return _0x2cb8e1[_0x75fc('0x3a')](_0x440d76);}else{return _0x2cb8e1;}}})[_0x75fc('0x3b')](function(_0xa3d477){_0x334287[_0x75fc('0x98')]=_0xa3d477[_0x75fc('0x3d')]({'plain':!![]});_0x334287[_0x75fc('0x98')][_0x75fc('0x99')]=_0x24c74b;if(_0x334287[_0x75fc('0x98')][_0x75fc('0x99')]){if(_0x334287[_0x75fc('0x8e')][_0x75fc('0x9a')]){_0x334287[_0x75fc('0x89')][_0x75fc('0x9b')]({'id':0x0,'priority':_0x334287[_0x75fc('0x89')][_0x75fc('0x50')]+0x1,'app':_0x75fc('0x9c'),'appdata':_0x75fc('0x9d'),'interval':_0x75fc('0x9e')});}}return db[_0x75fc('0x9f')]['create']({'body':_0x525587['body'][_0x75fc('0x60')],'OpenchannelAccountId':_0x525587[_0x75fc('0x5e')]['id'],'OpenchannelInteractionId':_0xa3d477['id'],'direction':'in','ContactId':_0x334287[_0x75fc('0x8f')]['id'],'AttachmentId':_0x525587[_0x75fc('0x60')][_0x75fc('0xa0')]});})[_0x75fc('0x3b')](function(_0x3242c9){_0x334287[_0x75fc('0x2c')]=_0x3242c9;if(!_0x334287[_0x75fc('0x98')][_0x75fc('0xa1')])return;return db[_0x75fc('0xa2')][_0x75fc('0x67')]({'attributes':['id',_0x75fc('0x42')],'where':{'id':_0x334287[_0x75fc('0x98')][_0x75fc('0xa1')]}});})['then'](function(_0x22cb85){if(_0x22cb85){_0x334287[_0x75fc('0x89')][_0x75fc('0xa3')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x22cb85[_0x75fc('0x42')]+','+(_0x334287[_0x75fc('0x8e')]['waitForTheAssignedAgent']||0xa),'interval':_0x75fc('0x9e')});_0x334287[_0x75fc('0xa4')]=!![];}if(!_0x334287[_0x75fc('0x98')]['queueId'])return;return db[_0x75fc('0xa5')]['find']({'attributes':['id',_0x75fc('0x42')],'where':{'id':_0x334287[_0x75fc('0x98')][_0x75fc('0xa6')]}});})[_0x75fc('0x3b')](function(_0xc3674b){if(_0xc3674b){_0x334287[_0x75fc('0x89')][_0x75fc('0xa3')]({'id':0x0,'priority':0x1,'app':_0x75fc('0xa7'),'appdata':_0xc3674b['name']+','+(_0x334287[_0x75fc('0x8e')][_0x75fc('0xa8')]||0x12c),'interval':_0x75fc('0x9e')});}return respondWithRpcPromise(_0x75fc('0xa9'),_0x75fc('0xaa'),_0x334287);})[_0x75fc('0x3b')](function(_0x174693){respondWithRpcPromise(_0x75fc('0xab'),_0x75fc('0xab'),{'event':_0x75fc('0x75'),'message':_0x174693},client9002);return _0x174693;})['then'](respondWithResult(_0x3518d1,null))[_0x75fc('0x2e')](handleError(_0x3518d1,null));};exports[_0x75fc('0xac')]=function(_0x1d72dd,_0x3d600d){var _0x54783d=_0x1d72dd[_0x75fc('0x5e')]['id'];var _0x388eb5=_0x1d72dd['body'];var _0x10ea1c=0xc8;var _0x399870=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x75fc('0xad')][_0x75fc('0xae')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x3d0e7c){return db[_0x75fc('0x45')][_0x75fc('0x6d')]({'where':{'id':_0x54783d},'transaction':_0x3d0e7c})[_0x75fc('0x3b')](function(_0xf40ad1){if(_0xf40ad1){return db[_0x75fc('0xaf')]['destroy']({'where':{'OpenchannelAccountId':_0x54783d},'transaction':_0x3d0e7c})[_0x75fc('0x3b')](function(){var _0x12e034=_['map'](_0x388eb5,function(_0x356cf5){_0x356cf5[_0x75fc('0x6a')]=_0x54783d;return _0x356cf5;});return db[_0x75fc('0xaf')]['bulkCreate'](_0x12e034,{'transaction':_0x3d0e7c});});}else{_0x10ea1c=0x194;_0x399870=[];}});})[_0x75fc('0x3b')](function(){if(_0x10ea1c!==0x194){return db['OpenchannelApplication'][_0x75fc('0xb0')]({'where':{'OpenchannelAccountId':_0x54783d},'order':'priority'})[_0x75fc('0x3b')](function(_0x3c6d6b){_0x399870=_0x3c6d6b;});}})['catch'](function(_0x4292d8){_0x10ea1c=0x1f4;logger[_0x75fc('0x2a')](_0x4292d8[_0x75fc('0x41')]);if(_0x4292d8[_0x75fc('0x42')]){delete _0x4292d8[_0x75fc('0x42')];}_0x399870=_0x4292d8;})[_0x75fc('0xb1')](function(){if(_0x399870===null){_0x3d600d[_0x75fc('0x2f')](_0x10ea1c);}else{if(_0x10ea1c===0x1f4){_0x3d600d[_0x75fc('0x30')](_0x10ea1c)[_0x75fc('0xb2')](_0x399870);}else{_0x3d600d[_0x75fc('0x30')](_0x10ea1c)[_0x75fc('0x31')](_0x399870);}}});};exports[_0x75fc('0xb3')]=function(_0x100b16,_0x5936e2,_0x513768){var _0x44391e={};var _0x5508d3={};var _0x16a198;var _0x225bfe;return db[_0x75fc('0x45')][_0x75fc('0x6d')]({'where':{'id':_0x100b16[_0x75fc('0x5e')]['id']}})[_0x75fc('0x3b')](handleEntityNotFound(_0x5936e2,null))[_0x75fc('0x3b')](function(_0x27d9c9){if(_0x27d9c9){_0x16a198=_0x27d9c9;_0x5508d3[_0x75fc('0x49')]=_['keys'](db['OpenchannelApplication']['rawAttributes']);_0x5508d3['query']=_[_0x75fc('0x4b')](_0x100b16['query']);_0x5508d3[_0x75fc('0x4c')]=_['intersection'](_0x5508d3[_0x75fc('0x49')],_0x5508d3[_0x75fc('0x4a')]);_0x44391e[_0x75fc('0x4e')]=_[_0x75fc('0x4d')](_0x5508d3[_0x75fc('0x49')],qs[_0x75fc('0x4f')](_0x100b16['query'][_0x75fc('0x4f')]));_0x44391e['attributes']=_0x44391e[_0x75fc('0x4e')][_0x75fc('0x50')]?_0x44391e[_0x75fc('0x4e')]:_0x5508d3[_0x75fc('0x49')];_0x44391e[_0x75fc('0x6e')]=qs[_0x75fc('0x53')](_0x100b16[_0x75fc('0x4a')][_0x75fc('0x53')]);_0x44391e['where']=qs[_0x75fc('0x4c')](_[_0x75fc('0x73')](_0x100b16['query'],_0x5508d3['filters']));if(_0x100b16[_0x75fc('0x4a')]['filter']){_0x44391e[_0x75fc('0x55')]=_[_0x75fc('0x57')](_0x44391e[_0x75fc('0x55')],{'$or':_[_0x75fc('0x6f')](_0x44391e[_0x75fc('0x4e')],function(_0x5b4600){var _0x188427={};_0x188427[_0x5b4600]={'$like':'%'+_0x100b16[_0x75fc('0x4a')][_0x75fc('0x54')]+'%'};return _0x188427;})});}_0x44391e=_[_0x75fc('0x57')]({},_0x44391e,_0x100b16['options']);return _0x16a198['getApplications'](_0x44391e);}})['then'](function(_0x1496be){if(_0x1496be){_0x225bfe=_0x1496be[_0x75fc('0x50')];if(!_0x100b16[_0x75fc('0x4a')]['hasOwnProperty'](_0x75fc('0x52'))){_0x44391e['limit']=qs['limit'](_0x100b16[_0x75fc('0x4a')]['limit']);_0x44391e[_0x75fc('0x32')]=qs[_0x75fc('0x32')](_0x100b16[_0x75fc('0x4a')]['offset']);}return _0x16a198['getApplications'](_0x44391e);}})['then'](function(_0x1caa92){if(_0x1caa92){return _0x1caa92?{'count':_0x225bfe,'rows':_0x1caa92}:null;}})[_0x75fc('0x3b')](respondWithResult(_0x5936e2,null))[_0x75fc('0x2e')](handleError(_0x5936e2,null));};exports[_0x75fc('0xb4')]=function(_0x3a7af1,_0xe3722f,_0x34860e){var _0xf3f635={'raw':![],'where':{}};var _0x494cb8={};var _0x1df539={'count':0x0,'rows':[]};return db[_0x75fc('0x45')][_0x75fc('0x6d')]({'where':{'id':_0x3a7af1[_0x75fc('0x5e')]['id']}})[_0x75fc('0x3b')](handleEntityNotFound(_0xe3722f,null))[_0x75fc('0x3b')](function(_0x33883e){if(_0x33883e){_0x494cb8[_0x75fc('0x49')]=_[_0x75fc('0x4b')](db[_0x75fc('0x93')][_0x75fc('0x46')]);_0x494cb8[_0x75fc('0x4a')]=_[_0x75fc('0x4b')](_0x3a7af1[_0x75fc('0x4a')]);_0x494cb8[_0x75fc('0x4c')]=_['intersection'](_0x494cb8['model'],_0x494cb8['query']);_0xf3f635['attributes']=_[_0x75fc('0x4d')](_0x494cb8['model'],qs[_0x75fc('0x4f')](_0x3a7af1[_0x75fc('0x4a')]['fields']));_0xf3f635[_0x75fc('0x4e')]=_0xf3f635[_0x75fc('0x4e')][_0x75fc('0x50')]?_0xf3f635[_0x75fc('0x4e')]:_0x494cb8[_0x75fc('0x49')];if(!_0x3a7af1[_0x75fc('0x4a')][_0x75fc('0x51')](_0x75fc('0x52'))){_0xf3f635['limit']=qs['limit'](_0x3a7af1[_0x75fc('0x4a')][_0x75fc('0x34')]);_0xf3f635[_0x75fc('0x32')]=qs['offset'](_0x3a7af1[_0x75fc('0x4a')][_0x75fc('0x32')]);}_0xf3f635['order']=qs[_0x75fc('0x53')](_0x3a7af1[_0x75fc('0x4a')][_0x75fc('0x53')]);_0xf3f635[_0x75fc('0x55')]=qs[_0x75fc('0x4c')](_[_0x75fc('0x73')](_0x3a7af1[_0x75fc('0x4a')],_0x494cb8[_0x75fc('0x4c')]));_0xf3f635[_0x75fc('0x55')][_0x75fc('0x6a')]=_0x33883e['id'];if(_0x3a7af1[_0x75fc('0x4a')][_0x75fc('0x54')]){_0xf3f635['where']=_[_0x75fc('0x57')](_0xf3f635['where'],{'$or':_[_0x75fc('0x6f')](_0xf3f635[_0x75fc('0x4e')],function(_0x5c0b6e){var _0x20a858={};_0x20a858[_0x5c0b6e]={'$like':'%'+_0x3a7af1['query'][_0x75fc('0x54')]+'%'};return _0x20a858;})});}_0xf3f635=_[_0x75fc('0x57')]({},_0xf3f635,_0x3a7af1['options']);return db[_0x75fc('0x93')][_0x75fc('0x35')]({'where':_0xf3f635[_0x75fc('0x55')]})['then'](function(_0x5f1d6c){_0x1df539[_0x75fc('0x35')]=_0x5f1d6c;if(_0x3a7af1['query']['includeAll']){_0xf3f635[_0x75fc('0x5a')]=[{'model':db[_0x75fc('0x87')],'as':_0x75fc('0xb5'),'required':![]},{'model':db[_0x75fc('0xa2')],'as':_0x75fc('0xb6'),'attributes':[_0x75fc('0x42'),_0x75fc('0xb7'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x75fc('0xb8'),'attributes':['id',_0x75fc('0x42'),_0x75fc('0xb9')],'where':_0x3a7af1['query']['tag']?{'id':_0x3a7af1[_0x75fc('0x4a')][_0x75fc('0xba')]}:undefined,'required':_0x3a7af1[_0x75fc('0x4a')][_0x75fc('0xba')]?!![]:![]}];}return db[_0x75fc('0x93')][_0x75fc('0x5b')](_0xf3f635);})[_0x75fc('0x3b')](function(_0x6265b3){_0x1df539[_0x75fc('0x5c')]=_0x6265b3;return _0x1df539;});}})[_0x75fc('0x3b')](respondWithFilteredResult(_0xe3722f,_0xf3f635))[_0x75fc('0x2e')](handleError(_0xe3722f,null));};exports[_0x75fc('0xbb')]=function(_0x4dd2ac,_0x4d43fc,_0x6f7320){return db['OpenchannelAccount'][_0x75fc('0x67')]({'where':{'id':_0x4dd2ac['params']['id']}})[_0x75fc('0x3b')](handleEntityNotFound(_0x4d43fc,null))[_0x75fc('0x3b')](function(_0x47ff61){if(_0x47ff61){return _0x47ff61[_0x75fc('0xbb')](_0x4dd2ac[_0x75fc('0x60')]['ids'],_[_0x75fc('0xbc')](_0x4dd2ac['body'],[_0x75fc('0x74'),'id'])||{})[_0x75fc('0x96')](function(_0x1edd39){for(var _0x5ca19b=0x0;_0x5ca19b<_0x4dd2ac['body']['ids']['length'];_0x5ca19b+=0x1){socket[_0x75fc('0xbd')](_0x75fc('0xbe'),{'UserId':Number(_0x4dd2ac[_0x75fc('0x60')][_0x75fc('0x74')][_0x5ca19b]),'OpenchannelAccountId':Number(_0x4dd2ac[_0x75fc('0x5e')]['id'])});}return _0x1edd39;});}})[_0x75fc('0x3b')](respondWithResult(_0x4d43fc,null))[_0x75fc('0x2e')](handleError(_0x4d43fc,null));};exports[_0x75fc('0xbf')]=function(_0x46ba03,_0x3bd347,_0x239e27){return db[_0x75fc('0x45')][_0x75fc('0x67')]({'where':{'id':_0x46ba03[_0x75fc('0x5e')]['id']}})[_0x75fc('0x3b')](handleEntityNotFound(_0x3bd347,null))[_0x75fc('0x3b')](function(_0x871006){if(_0x871006){return _0x871006[_0x75fc('0xbf')](_0x46ba03[_0x75fc('0x4a')]['ids'])[_0x75fc('0x3b')](function(){if(_[_0x75fc('0xc0')](_0x46ba03['query'][_0x75fc('0x74')])){for(var _0x231fe7=0x0;_0x231fe7<_0x46ba03[_0x75fc('0x4a')][_0x75fc('0x74')]['length'];_0x231fe7+=0x1){socket[_0x75fc('0xbd')](_0x75fc('0xc1'),{'UserId':Number(_0x46ba03['query']['ids'][_0x231fe7]),'OpenchannelAccountId':Number(_0x46ba03[_0x75fc('0x5e')]['id'])});}}else{socket[_0x75fc('0xbd')]('userOpenchannelAccount:remove',{'UserId':Number(_0x46ba03['query']['ids']),'OpenchannelAccountId':Number(_0x46ba03[_0x75fc('0x5e')]['id'])});}});}})['then'](respondWithStatusCode(_0x3bd347,null))[_0x75fc('0x2e')](handleError(_0x3bd347,null));};exports['getAgents']=function(_0x52af23,_0x3c1884,_0x3cbb9f){var _0xf8d38f={};var _0x2b1ed0={};var _0x4a4311;var _0x40e3b2;return db[_0x75fc('0x45')][_0x75fc('0x6d')]({'where':{'id':_0x52af23['params']['id']}})[_0x75fc('0x3b')](handleEntityNotFound(_0x3c1884,null))[_0x75fc('0x3b')](function(_0x8ad422){if(_0x8ad422){_0x4a4311=_0x8ad422;_0x2b1ed0[_0x75fc('0x49')]=_[_0x75fc('0x4b')](db[_0x75fc('0xa2')][_0x75fc('0x46')]);_0x2b1ed0['query']=_[_0x75fc('0x4b')](_0x52af23[_0x75fc('0x4a')]);_0x2b1ed0[_0x75fc('0x4c')]=_[_0x75fc('0x4d')](_0x2b1ed0[_0x75fc('0x49')],_0x2b1ed0[_0x75fc('0x4a')]);_0xf8d38f[_0x75fc('0x4e')]=_[_0x75fc('0x4d')](_0x2b1ed0[_0x75fc('0x49')],qs[_0x75fc('0x4f')](_0x52af23[_0x75fc('0x4a')][_0x75fc('0x4f')]));_0xf8d38f[_0x75fc('0x4e')]=_0xf8d38f[_0x75fc('0x4e')][_0x75fc('0x50')]?_0xf8d38f['attributes']:_0x2b1ed0[_0x75fc('0x49')];_0xf8d38f[_0x75fc('0x6e')]=qs[_0x75fc('0x53')](_0x52af23['query']['sort']);_0xf8d38f[_0x75fc('0x55')]=qs[_0x75fc('0x4c')](_[_0x75fc('0x73')](_0x52af23[_0x75fc('0x4a')],_0x2b1ed0['filters']));if(_0x52af23[_0x75fc('0x4a')][_0x75fc('0x54')]){_0xf8d38f[_0x75fc('0x55')]=_[_0x75fc('0x57')](_0xf8d38f[_0x75fc('0x55')],{'$or':_[_0x75fc('0x6f')](_0xf8d38f[_0x75fc('0x4e')],function(_0x4c1ace){var _0x458e85={};_0x458e85[_0x4c1ace]={'$like':'%'+_0x52af23[_0x75fc('0x4a')][_0x75fc('0x54')]+'%'};return _0x458e85;})});}_0xf8d38f=_[_0x75fc('0x57')]({},_0xf8d38f,_0x52af23[_0x75fc('0x58')]);return _0x4a4311[_0x75fc('0xc2')](_0xf8d38f);}})[_0x75fc('0x3b')](function(_0x2539f8){if(_0x2539f8){_0x40e3b2=_0x2539f8[_0x75fc('0x50')];if(!_0x52af23[_0x75fc('0x4a')][_0x75fc('0x51')]('nolimit')){_0xf8d38f[_0x75fc('0x34')]=qs[_0x75fc('0x34')](_0x52af23[_0x75fc('0x4a')][_0x75fc('0x34')]);_0xf8d38f['offset']=qs[_0x75fc('0x32')](_0x52af23['query']['offset']);}return _0x4a4311['getAgents'](_0xf8d38f);}})['then'](function(_0x389793){if(_0x389793){return _0x389793?{'count':_0x40e3b2,'rows':_0x389793}:null;}})[_0x75fc('0x3b')](respondWithResult(_0x3c1884,null))[_0x75fc('0x2e')](handleError(_0x3c1884,null));};exports['send']=function(_0x345d63,_0x4e847e,_0x527c82){var _0x574968,_0x4cfde3,_0x485a02;if(_[_0x75fc('0x7d')](_0x345d63[_0x75fc('0x60')][_0x75fc('0x60')])||_0x345d63[_0x75fc('0x60')][_0x75fc('0x60')]===''){throw new db[(_0x75fc('0x7e'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x75fc('0x7d')](_0x345d63[_0x75fc('0x60')]['to'])){}_0x574968=_0x345d63[_0x75fc('0x60')]['to'];return db[_0x75fc('0x45')][_0x75fc('0x6d')]({'where':{'id':_0x345d63[_0x75fc('0x5e')]['id']}})[_0x75fc('0x3b')](handleEntityNotFound(_0x4e847e,null))[_0x75fc('0x3b')](function(_0x3aa895){if(_0x3aa895){return db[_0x75fc('0x45')]['find']({'where':{'id':_0x3aa895['id']},'include':[{'model':db[_0x75fc('0xc3')],'as':_0x75fc('0x86'),'include':[{'model':db[_0x75fc('0x87')],'as':'Contacts','where':{[_0x3aa895[_0x75fc('0x81')]]:_0x574968},'limit':0x1,'order':[[_0x75fc('0x7a'),_0x75fc('0xc4')]]}]}]})[_0x75fc('0x3b')](handleEntityNotFound(_0x4e847e,null))['then'](function(_0x1eb270){if(_0x1eb270&&_0x1eb270['List']){_0x4cfde3=_0x1eb270[_0x75fc('0x3d')]({'plain':!![]});if(_0x4cfde3[_0x75fc('0x86')]&&_0x4cfde3['List'][_0x75fc('0x88')][_0x75fc('0x50')]){return _0x4cfde3[_0x75fc('0x86')][_0x75fc('0x88')][0x0];}return db[_0x75fc('0x87')][_0x75fc('0x5f')](_['defaults'](_0x345d63[_0x75fc('0x60')],{'firstName':_0x574968,[_0x1eb270['mapKey']]:_0x574968,'phone':_0x574968,'ListId':_0x4cfde3[_0x75fc('0x7c')]}));}})[_0x75fc('0x3b')](handleEntityNotFound(_0x4e847e,null))['then'](function(_0x3ea398){if(_0x3ea398){_0x485a02=_0x3ea398;return db[_0x75fc('0x93')][_0x75fc('0x67')]({'where':{'ContactId':_0x485a02['id'],'closed':![],'OpenchannelAccountId':_0x4cfde3['id']}})[_0x75fc('0x3b')](function(_0x56720a){if(_0x56720a){return[_0x56720a,![]];}return db['OpenchannelInteraction'][_0x75fc('0x5f')]({'UserId':_0x345d63[_0x75fc('0x62')]['id'],'ContactId':_0x485a02['id'],'OpenchannelAccountId':_0x4cfde3['id'],'lastMsgDirection':'out','firstMsgDirection':'out','Messages':[_['merge'](_0x345d63[_0x75fc('0x60')],{'read':![],'body':_0x345d63[_0x75fc('0x60')]['body'],'OpenchannelAccountId':_0x4cfde3['id'],'UserId':_0x345d63[_0x75fc('0x62')]['id'],'ContactId':_0x485a02['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x75fc('0xc5')}]})[_0x75fc('0x3b')](function(_0x21c4a8){return[_0x21c4a8,!![]];});});}})[_0x75fc('0x96')](function(_0xac3317,_0x5f295c){if(_0x5f295c){return _0xac3317;}return db[_0x75fc('0x9f')][_0x75fc('0x5f')](_[_0x75fc('0x57')](_0x345d63[_0x75fc('0x60')],{'read':![],'body':_0x345d63[_0x75fc('0x60')]['body'],'OpenchannelAccountId':_0x4cfde3['id'],'OpenchannelInteractionId':_0xac3317['id'],'UserId':_0x345d63['user']['id'],'ContactId':_0x485a02['id']}))[_0x75fc('0x3b')](function(_0x2a75c5){_0xac3317[_0x75fc('0xc6')][_0x75fc('0xc5')]=[];_0xac3317[_0x75fc('0xc6')][_0x75fc('0xc5')][_0x75fc('0x9b')](_0x2a75c5[_0x75fc('0xc6')]);return _0xac3317;});});}})['then'](respondWithResult(_0x4e847e,null))[_0x75fc('0x2e')](handleError(_0x4e847e,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 2d2a173..f4196eb 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 _0x13f6=['save','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x4f9da9,_0x2ee609){var _0x4bd584=function(_0x4131c8){while(--_0x4131c8){_0x4f9da9['push'](_0x4f9da9['shift']());}};_0x4bd584(++_0x2ee609);}(_0x13f6,0x124));var _0x613f=function(_0x499d15,_0x5376c1){_0x499d15=_0x499d15-0x0;var _0x189291=_0x13f6[_0x499d15];return _0x189291;};'use strict';var EventEmitter=require(_0x613f('0x0'));var OpenchannelAccount=require(_0x613f('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x613f('0x2'),'afterUpdate':_0x613f('0x3'),'afterDestroy':_0x613f('0x4')};function emitEvent(_0x5414ff){return function(_0x179f6e,_0x1e01e3,_0x20af2f){OpenchannelAccountEvents['emit'](_0x5414ff+':'+_0x179f6e['id'],_0x179f6e);OpenchannelAccountEvents[_0x613f('0x5')](_0x5414ff,_0x179f6e);_0x20af2f(null);};}for(var e in events){if(events[_0x613f('0x6')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0x668b=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x383356,_0x33d2f5){var _0x32ee5a=function(_0x2741db){while(--_0x2741db){_0x383356['push'](_0x383356['shift']());}};_0x32ee5a(++_0x33d2f5);}(_0x668b,0x140));var _0xb668=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0x668b[_0x4e6ae6];return _0x23c108;};'use strict';var EventEmitter=require(_0xb668('0x0'));var OpenchannelAccount=require(_0xb668('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xb668('0x2')](0x0);var events={'afterCreate':_0xb668('0x3'),'afterUpdate':'update','afterDestroy':_0xb668('0x4')};function emitEvent(_0x5e2e83){return function(_0x2fab11,_0x4092a6,_0x2960f5){OpenchannelAccountEvents['emit'](_0x5e2e83+':'+_0x2fab11['id'],_0x2fab11);OpenchannelAccountEvents[_0xb668('0x5')](_0x5e2e83,_0x2fab11);_0x2960f5(null);};}for(var e in events){if(events[_0xb668('0x6')](e)){var event=events[e];OpenchannelAccount[_0xb668('0x7')](e,emitEvent(event));}}module[_0xb668('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 dc9180c..963ce3a 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(_0x2cc896,_0x23c05a){var _0x42bcc5=function(_0x26f859){while(--_0x26f859){_0x2cc896['push'](_0x2cc896['shift']());}};_0x42bcc5(++_0x23c05a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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(_0x25ab0d,_0x4cea22){var _0x47a65e=function(_0x229652){while(--_0x229652){_0x25ab0d['push'](_0x25ab0d['shift']());}};_0x47a65e(++_0x4cea22);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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 6ca8643..af32edf 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 _0x1ba2=['http','defaults','redis','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x8d8917,_0x504e20){var _0x55bd93=function(_0x24db56){while(--_0x24db56){_0x8d8917['push'](_0x8d8917['shift']());}};_0x55bd93(++_0x504e20);}(_0x1ba2,0xb4));var _0x21ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1ba2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x21ba('0x0'));var util=require('util');var moment=require(_0x21ba('0x1'));var BPromise=require('bluebird');var rs=require(_0x21ba('0x2'));var fs=require('fs');var Redis=require(_0x21ba('0x3'));var db=require(_0x21ba('0x4'))['db'];var utils=require(_0x21ba('0x5'));var logger=require(_0x21ba('0x6'))('rpc');var config=require(_0x21ba('0x7'));var jayson=require(_0x21ba('0x8'));var client=jayson['client'][_0x21ba('0x9')]({'port':0x232a});config['redis']=_[_0x21ba('0xa')](config[_0x21ba('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x21ba('0xc'))(new Redis(config['redis']));require(_0x21ba('0xd'))[_0x21ba('0xe')](socket);function respondWithRpcPromise(_0x48ddf3,_0x3063e9,_0x32393d){return new BPromise(function(_0x3926b5,_0x3512a2){return client[_0x21ba('0xf')](_0x48ddf3,_0x32393d)[_0x21ba('0x10')](function(_0x2953d2){logger[_0x21ba('0x11')](_0x21ba('0x12'),_0x3063e9,_0x21ba('0x13'));logger[_0x21ba('0x14')](_0x21ba('0x15'),_0x3063e9,'request\x20sent',JSON['stringify'](_0x2953d2));if(_0x2953d2[_0x21ba('0x16')]){if(_0x2953d2[_0x21ba('0x16')][_0x21ba('0x17')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x3063e9,_0x2953d2[_0x21ba('0x16')]['message']);return _0x3512a2(_0x2953d2[_0x21ba('0x16')]['message']);}logger[_0x21ba('0x16')](_0x21ba('0x12'),_0x3063e9,_0x2953d2[_0x21ba('0x16')][_0x21ba('0x18')]);return _0x3926b5(_0x2953d2[_0x21ba('0x16')]['message']);}else{logger[_0x21ba('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x3063e9,_0x21ba('0x13'));_0x3926b5(_0x2953d2[_0x21ba('0x19')][_0x21ba('0x18')]);}})[_0x21ba('0x1a')](function(_0x305c05){logger[_0x21ba('0x16')](_0x21ba('0x12'),_0x3063e9,_0x305c05);_0x3512a2(_0x305c05);});});} \ No newline at end of file +var _0xde2c=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./openchannelAccount.socket','register','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment'];(function(_0x19ff83,_0x26ba4a){var _0x15b65c=function(_0x26e82a){while(--_0x26e82a){_0x19ff83['push'](_0x19ff83['shift']());}};_0x15b65c(++_0x26ba4a);}(_0xde2c,0x7f));var _0xcde2=function(_0x4d2f00,_0x4e94d5){_0x4d2f00=_0x4d2f00-0x0;var _0x2d7b7f=_0xde2c[_0x4d2f00];return _0x2d7b7f;};'use strict';var _=require(_0xcde2('0x0'));var util=require(_0xcde2('0x1'));var moment=require(_0xcde2('0x2'));var BPromise=require(_0xcde2('0x3'));var rs=require(_0xcde2('0x4'));var fs=require('fs');var Redis=require(_0xcde2('0x5'));var db=require(_0xcde2('0x6'))['db'];var utils=require(_0xcde2('0x7'));var logger=require('../../config/logger')(_0xcde2('0x8'));var config=require(_0xcde2('0x9'));var jayson=require(_0xcde2('0xa'));var client=jayson[_0xcde2('0xb')][_0xcde2('0xc')]({'port':0x232a});config['redis']=_[_0xcde2('0xd')](config[_0xcde2('0xe')],{'host':_0xcde2('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xcde2('0x10'))[_0xcde2('0x11')](socket);function respondWithRpcPromise(_0x4e9749,_0x181a73,_0x29f7e0){return new BPromise(function(_0x12a287,_0x127358){return client['request'](_0x4e9749,_0x29f7e0)['then'](function(_0x25677f){logger[_0xcde2('0x12')](_0xcde2('0x13'),_0x181a73,_0xcde2('0x14'));logger[_0xcde2('0x15')](_0xcde2('0x16'),_0x181a73,'request\x20sent',JSON[_0xcde2('0x17')](_0x25677f));if(_0x25677f['error']){if(_0x25677f[_0xcde2('0x18')]['code']===0x1f4){logger['error'](_0xcde2('0x13'),_0x181a73,_0x25677f[_0xcde2('0x18')][_0xcde2('0x19')]);return _0x127358(_0x25677f[_0xcde2('0x18')][_0xcde2('0x19')]);}logger['error'](_0xcde2('0x13'),_0x181a73,_0x25677f['error'][_0xcde2('0x19')]);return _0x12a287(_0x25677f[_0xcde2('0x18')][_0xcde2('0x19')]);}else{logger[_0xcde2('0x12')]('OpenchannelAccount,\x20%s,\x20%s',_0x181a73,'request\x20sent');_0x12a287(_0x25677f['result'][_0xcde2('0x19')]);}})['catch'](function(_0x285ac7){logger[_0xcde2('0x18')](_0xcde2('0x13'),_0x181a73,_0x285ac7);_0x127358(_0x285ac7);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 8010605..216279a 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 _0xc0d6=['save','update','emit','removeListener','register','openchannelAccount:'];(function(_0x4e0510,_0x384626){var _0x2352b9=function(_0x2b29f2){while(--_0x2b29f2){_0x4e0510['push'](_0x4e0510['shift']());}};_0x2352b9(++_0x384626);}(_0xc0d6,0x1ce));var _0x6c0d=function(_0x232e81,_0x3c26af){_0x232e81=_0x232e81-0x0;var _0x21537f=_0xc0d6[_0x232e81];return _0x21537f;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x6c0d('0x0'),'remove',_0x6c0d('0x1')];function createListener(_0x278292,_0x83bbbc){return function(_0xa6bfd8){_0x83bbbc[_0x6c0d('0x2')](_0x278292,_0xa6bfd8);};}function removeListener(_0x21857a,_0xfc2a1c){return function(){OpenchannelAccountEvents[_0x6c0d('0x3')](_0x21857a,_0xfc2a1c);};}exports[_0x6c0d('0x4')]=function(_0x32cbb6){for(var _0x4caa83=0x0,_0x4d7a9c=events['length'];_0x4caa83<_0x4d7a9c;_0x4caa83++){var _0x987707=events[_0x4caa83];var _0x266f0c=createListener(_0x6c0d('0x5')+_0x987707,_0x32cbb6);OpenchannelAccountEvents['on'](_0x987707,_0x266f0c);}}; \ No newline at end of file +var _0xd816=['update','emit','removeListener','./openchannelAccount.events','save'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xd816,0xd5));var _0x6d81=function(_0x529c7e,_0x386cb4){_0x529c7e=_0x529c7e-0x0;var _0x1d6723=_0xd816[_0x529c7e];return _0x1d6723;};'use strict';var OpenchannelAccountEvents=require(_0x6d81('0x0'));var events=[_0x6d81('0x1'),'remove',_0x6d81('0x2')];function createListener(_0x538e21,_0x540f68){return function(_0x5d99e4){_0x540f68[_0x6d81('0x3')](_0x538e21,_0x5d99e4);};}function removeListener(_0x39a52f,_0x3511a2){return function(){OpenchannelAccountEvents[_0x6d81('0x4')](_0x39a52f,_0x3511a2);};}exports['register']=function(_0x6c01ef){for(var _0x4ba95f=0x0,_0x10f1a7=events['length'];_0x4ba95f<_0x10f1a7;_0x4ba95f++){var _0x96d1ac=events[_0x4ba95f];var _0x15d634=createListener('openchannelAccount:'+_0x96d1ac,_0x6c01ef);OpenchannelAccountEvents['on'](_0x96d1ac,_0x15d634);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 1f3e591..ec936ee 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 _0xde86=['index','get','/:id','post','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','isAuthenticated'];(function(_0x4d2440,_0x206068){var _0x1efe72=function(_0x572669){while(--_0x572669){_0x4d2440['push'](_0x4d2440['shift']());}};_0x1efe72(++_0x206068);}(_0xde86,0x7b));var _0x6de8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xde86[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x6de8('0x0'));var util=require('util');var path=require(_0x6de8('0x1'));var timeout=require(_0x6de8('0x2'));var express=require('express');var router=express[_0x6de8('0x3')]();var fs_extra=require(_0x6de8('0x4'));var auth=require(_0x6de8('0x5'));var interaction=require(_0x6de8('0x6'));var config=require(_0x6de8('0x7'));var controller=require(_0x6de8('0x8'));router['get']('/',auth[_0x6de8('0x9')](),controller[_0x6de8('0xa')]);router[_0x6de8('0xb')](_0x6de8('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x6de8('0xd')]('/',auth[_0x6de8('0x9')](),controller['create']);router[_0x6de8('0xe')](_0x6de8('0xc'),auth[_0x6de8('0x9')](),controller[_0x6de8('0xf')]);router[_0x6de8('0x10')](_0x6de8('0xc'),auth[_0x6de8('0x9')](),controller[_0x6de8('0x11')]);module[_0x6de8('0x12')]=router; \ No newline at end of file +var _0x9be4=['create','put','update','delete','destroy','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','/:id','isAuthenticated','show'];(function(_0x33fa3a,_0x44ebd4){var _0x2d454f=function(_0x529774){while(--_0x529774){_0x33fa3a['push'](_0x33fa3a['shift']());}};_0x2d454f(++_0x44ebd4);}(_0x9be4,0xcc));var _0x49be=function(_0x334eae,_0x100379){_0x334eae=_0x334eae-0x0;var _0x279c84=_0x9be4[_0x334eae];return _0x279c84;};'use strict';var multer=require(_0x49be('0x0'));var util=require(_0x49be('0x1'));var path=require(_0x49be('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x49be('0x3'));var auth=require(_0x49be('0x4'));var interaction=require(_0x49be('0x5'));var config=require(_0x49be('0x6'));var controller=require(_0x49be('0x7'));router[_0x49be('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x49be('0x8')](_0x49be('0x9'),auth[_0x49be('0xa')](),controller[_0x49be('0xb')]);router['post']('/',auth[_0x49be('0xa')](),controller[_0x49be('0xc')]);router[_0x49be('0xd')](_0x49be('0x9'),auth[_0x49be('0xa')](),controller[_0x49be('0xe')]);router[_0x49be('0xf')](_0x49be('0x9'),auth[_0x49be('0xa')](),controller[_0x49be('0x10')]);module[_0x49be('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index bbf656f..0c054b6 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 _0xd81a=['INTEGER','STRING','noop','TEXT','sequelize','exports'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0xd81a,0xdc));var _0xad81=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xd81a[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0xad81('0x0'));module[_0xad81('0x1')]={'priority':{'type':Sequelize[_0xad81('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xad81('0x3')],'allowNull':![],'defaultValue':_0xad81('0x4')},'appdata':{'type':Sequelize[_0xad81('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xd624=['noop','TEXT','*,*,*,*','exports','INTEGER','STRING'];(function(_0x591550,_0x39e803){var _0x109f2c=function(_0x42d941){while(--_0x42d941){_0x591550['push'](_0x591550['shift']());}};_0x109f2c(++_0x39e803);}(_0xd624,0xed));var _0x4d62=function(_0xe388ef,_0x1e00d6){_0xe388ef=_0xe388ef-0x0;var _0x2b8952=_0xd624[_0xe388ef];return _0x2b8952;};'use strict';var Sequelize=require('sequelize');module[_0x4d62('0x0')]={'priority':{'type':Sequelize[_0x4d62('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x4d62('0x2')],'allowNull':![],'defaultValue':_0x4d62('0x3')},'appdata':{'type':Sequelize[_0x4d62('0x4')]()},'description':{'type':Sequelize[_0x4d62('0x2')]},'interval':{'type':Sequelize[_0x4d62('0x2')],'defaultValue':_0x4d62('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 490627e..913fbab 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 _0x113a=['status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','filters','pick','merge','VIRTUAL','filter','options','OpenchannelApplication','includeAll','include','catch','show','params','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x113a,0x13e));var _0xa113=function(_0x4bfbae,_0x24973c){_0x4bfbae=_0x4bfbae-0x0;var _0x4cfa90=_0x113a[_0x4bfbae];return _0x4cfa90;};'use strict';var emlformat=require(_0xa113('0x0'));var rimraf=require(_0xa113('0x1'));var zipdir=require(_0xa113('0x2'));var jsonpatch=require(_0xa113('0x3'));var rp=require(_0xa113('0x4'));var moment=require(_0xa113('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xa113('0x6'));var sox=require(_0xa113('0x7'));var csv=require(_0xa113('0x8'));var ejs=require(_0xa113('0x9'));var fs=require('fs');var fs_extra=require(_0xa113('0xa'));var _=require(_0xa113('0xb'));var squel=require(_0xa113('0xc'));var crypto=require(_0xa113('0xd'));var jsforce=require(_0xa113('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa113('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa113('0xf'));var as=require(_0xa113('0x10'));var hardwareService=require(_0xa113('0x11'));var logger=require(_0xa113('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xa113('0x13'));var licenseUtil=require(_0xa113('0x14'));var db=require(_0xa113('0x15'))['db'];function respondWithStatusCode(_0x207189,_0x498867){_0x498867=_0x498867||0xcc;return function(_0x2b17ac){if(_0x2b17ac){return _0x207189['sendStatus'](_0x498867);}return _0x207189[_0xa113('0x16')](_0x498867)[_0xa113('0x17')]();};}function respondWithResult(_0x41884e,_0xf5c1ec){_0xf5c1ec=_0xf5c1ec||0xc8;return function(_0x4899ac){if(_0x4899ac){return _0x41884e[_0xa113('0x16')](_0xf5c1ec)['json'](_0x4899ac);}};}function respondWithFilteredResult(_0x5da19c,_0x5d3f21){return function(_0x30a8c7){if(_0x30a8c7){var _0x17990a=typeof _0x5d3f21[_0xa113('0x18')]===_0xa113('0x19')&&typeof _0x5d3f21[_0xa113('0x1a')]===_0xa113('0x19');var _0x10128a=_0x30a8c7[_0xa113('0x1b')];var _0x5eda2f=_0x17990a?0x0:_0x5d3f21[_0xa113('0x18')];var _0x578cf0=_0x17990a?_0x30a8c7[_0xa113('0x1b')]:_0x5d3f21[_0xa113('0x18')]+_0x5d3f21[_0xa113('0x1a')];var _0x52cbd3;if(_0x578cf0>=_0x10128a){_0x578cf0=_0x10128a;_0x52cbd3=0xc8;}else{_0x52cbd3=0xce;}_0x5da19c[_0xa113('0x16')](_0x52cbd3);return _0x5da19c[_0xa113('0x1c')](_0xa113('0x1d'),_0x5eda2f+'-'+_0x578cf0+'/'+_0x10128a)['json'](_0x30a8c7);}return null;};}function patchUpdates(_0x10c694){return function(_0x24d6bf){try{jsonpatch[_0xa113('0x1e')](_0x24d6bf,_0x10c694,!![]);}catch(_0x403397){return BPromise[_0xa113('0x1f')](_0x403397);}return _0x24d6bf['save']();};}function saveUpdates(_0x1af00a,_0x4d1764){return function(_0x158f34){if(_0x158f34){return _0x158f34['update'](_0x1af00a)[_0xa113('0x20')](function(_0x5e9c9d){return _0x5e9c9d;});}return null;};}function removeEntity(_0x3cc8c6,_0x5caed1){return function(_0x2d46df){if(_0x2d46df){return _0x2d46df[_0xa113('0x21')]()[_0xa113('0x20')](function(){_0x3cc8c6[_0xa113('0x16')](0xcc)[_0xa113('0x17')]();});}};}function handleEntityNotFound(_0x64084f,_0x35d258){return function(_0x54d806){if(!_0x54d806){_0x64084f[_0xa113('0x22')](0x194);}return _0x54d806;};}function handleError(_0x136aee,_0x35d16c){_0x35d16c=_0x35d16c||0x1f4;return function(_0x5a52dd){logger['error'](_0x5a52dd[_0xa113('0x23')]);if(_0x5a52dd[_0xa113('0x24')]){delete _0x5a52dd['name'];}_0x136aee[_0xa113('0x16')](_0x35d16c)[_0xa113('0x25')](_0x5a52dd);};}exports[_0xa113('0x26')]=function(_0x4a3088,_0x5f44fa){var _0x58c08d={},_0x50ee9a={},_0x40fc8e={'count':0x0,'rows':[]};var _0x537089=_[_0xa113('0x27')](db['OpenchannelApplication'][_0xa113('0x28')],function(_0x23d18c){return{'name':_0x23d18c[_0xa113('0x29')],'type':_0x23d18c['type']['key']};});_0x50ee9a[_0xa113('0x2a')]=_[_0xa113('0x27')](_0x537089,_0xa113('0x24'));_0x50ee9a['query']=_[_0xa113('0x2b')](_0x4a3088[_0xa113('0x2c')]);_0x50ee9a['filters']=_[_0xa113('0x2d')](_0x50ee9a['model'],_0x50ee9a[_0xa113('0x2c')]);_0x58c08d[_0xa113('0x2e')]=_[_0xa113('0x2d')](_0x50ee9a[_0xa113('0x2a')],qs[_0xa113('0x2f')](_0x4a3088[_0xa113('0x2c')][_0xa113('0x2f')]));_0x58c08d['attributes']=_0x58c08d['attributes']['length']?_0x58c08d[_0xa113('0x2e')]:_0x50ee9a['model'];if(!_0x4a3088[_0xa113('0x2c')][_0xa113('0x30')](_0xa113('0x31'))){_0x58c08d[_0xa113('0x1a')]=qs[_0xa113('0x1a')](_0x4a3088[_0xa113('0x2c')][_0xa113('0x1a')]);_0x58c08d[_0xa113('0x18')]=qs[_0xa113('0x18')](_0x4a3088[_0xa113('0x2c')][_0xa113('0x18')]);}_0x58c08d[_0xa113('0x32')]=qs['sort'](_0x4a3088[_0xa113('0x2c')]['sort']);_0x58c08d[_0xa113('0x33')]=qs[_0xa113('0x34')](_[_0xa113('0x35')](_0x4a3088['query'],_0x50ee9a[_0xa113('0x34')]),_0x537089);if(_0x4a3088[_0xa113('0x2c')]['filter']){_0x58c08d[_0xa113('0x33')]=_[_0xa113('0x36')](_0x58c08d[_0xa113('0x33')],{'$or':_['map'](_0x537089,function(_0x533685){if(_0x533685['type']!==_0xa113('0x37')){var _0x48af55={};_0x48af55[_0x533685[_0xa113('0x24')]]={'$like':'%'+_0x4a3088[_0xa113('0x2c')][_0xa113('0x38')]+'%'};return _0x48af55;}})});}_0x58c08d=_[_0xa113('0x36')]({},_0x58c08d,_0x4a3088[_0xa113('0x39')]);var _0x3e7137={'where':_0x58c08d['where']};return db[_0xa113('0x3a')][_0xa113('0x1b')](_0x3e7137)[_0xa113('0x20')](function(_0x20cafb){_0x40fc8e[_0xa113('0x1b')]=_0x20cafb;if(_0x4a3088[_0xa113('0x2c')][_0xa113('0x3b')]){_0x58c08d[_0xa113('0x3c')]=[{'all':!![]}];}return db[_0xa113('0x3a')]['findAll'](_0x58c08d);})[_0xa113('0x20')](function(_0x2d1f9a){_0x40fc8e['rows']=_0x2d1f9a;return _0x40fc8e;})[_0xa113('0x20')](respondWithFilteredResult(_0x5f44fa,_0x58c08d))[_0xa113('0x3d')](handleError(_0x5f44fa,null));};exports[_0xa113('0x3e')]=function(_0x1c01f2,_0x191cdb){var _0x3fdd61={'raw':!![],'where':{'id':_0x1c01f2[_0xa113('0x3f')]['id']}},_0x146444={};_0x146444[_0xa113('0x2a')]=_[_0xa113('0x2b')](db[_0xa113('0x3a')][_0xa113('0x28')]);_0x146444['query']=_['keys'](_0x1c01f2['query']);_0x146444[_0xa113('0x34')]=_[_0xa113('0x2d')](_0x146444[_0xa113('0x2a')],_0x146444[_0xa113('0x2c')]);_0x3fdd61[_0xa113('0x2e')]=_[_0xa113('0x2d')](_0x146444['model'],qs['fields'](_0x1c01f2[_0xa113('0x2c')][_0xa113('0x2f')]));_0x3fdd61[_0xa113('0x2e')]=_0x3fdd61[_0xa113('0x2e')]['length']?_0x3fdd61[_0xa113('0x2e')]:_0x146444[_0xa113('0x2a')];if(_0x1c01f2[_0xa113('0x2c')][_0xa113('0x3b')]){_0x3fdd61[_0xa113('0x3c')]=[{'all':!![]}];}_0x3fdd61=_[_0xa113('0x36')]({},_0x3fdd61,_0x1c01f2[_0xa113('0x39')]);return db[_0xa113('0x3a')]['find'](_0x3fdd61)['then'](handleEntityNotFound(_0x191cdb,null))[_0xa113('0x20')](respondWithResult(_0x191cdb,null))[_0xa113('0x3d')](handleError(_0x191cdb,null));};exports[_0xa113('0x40')]=function(_0x488384,_0x20835b){return db[_0xa113('0x3a')]['create'](_0x488384[_0xa113('0x41')],{})[_0xa113('0x20')](respondWithResult(_0x20835b,0xc9))[_0xa113('0x3d')](handleError(_0x20835b,null));};exports[_0xa113('0x42')]=function(_0xac80c9,_0x57014e){if(_0xac80c9[_0xa113('0x41')]['id']){delete _0xac80c9[_0xa113('0x41')]['id'];}return db['OpenchannelApplication'][_0xa113('0x43')]({'where':{'id':_0xac80c9[_0xa113('0x3f')]['id']}})[_0xa113('0x20')](handleEntityNotFound(_0x57014e,null))[_0xa113('0x20')](saveUpdates(_0xac80c9[_0xa113('0x41')],null))[_0xa113('0x20')](respondWithResult(_0x57014e,null))[_0xa113('0x3d')](handleError(_0x57014e,null));};exports[_0xa113('0x21')]=function(_0x22349a,_0x35b27a){return db['OpenchannelApplication'][_0xa113('0x43')]({'where':{'id':_0x22349a['params']['id']}})['then'](handleEntityNotFound(_0x35b27a,null))[_0xa113('0x20')](removeEntity(_0x35b27a,null))[_0xa113('0x3d')](handleError(_0x35b27a,null));}; \ No newline at end of file +var _0xa384=['where','merge','VIRTUAL','filter','OpenchannelApplication','include','findAll','catch','show','params','keys','includeAll','options','find','create','body','update','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','sort','filters','pick'];(function(_0x1e3af2,_0x1229c3){var _0x327af5=function(_0x45be07){while(--_0x45be07){_0x1e3af2['push'](_0x1e3af2['shift']());}};_0x327af5(++_0x1229c3);}(_0xa384,0xa3));var _0x4a38=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0xa384[_0x3e44fa];return _0x2a0aba;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4a38('0x0'));var jsonpatch=require(_0x4a38('0x1'));var rp=require(_0x4a38('0x2'));var moment=require(_0x4a38('0x3'));var BPromise=require(_0x4a38('0x4'));var Mustache=require('mustache');var util=require(_0x4a38('0x5'));var path=require(_0x4a38('0x6'));var sox=require(_0x4a38('0x7'));var csv=require(_0x4a38('0x8'));var ejs=require(_0x4a38('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4a38('0xa'));var squel=require(_0x4a38('0xb'));var crypto=require('crypto');var jsforce=require(_0x4a38('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4a38('0xd'));var Papa=require(_0x4a38('0xe'));var Redis=require(_0x4a38('0xf'));var authService=require(_0x4a38('0x10'));var qs=require(_0x4a38('0x11'));var as=require(_0x4a38('0x12'));var hardwareService=require(_0x4a38('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x4a38('0x14'));var config=require(_0x4a38('0x15'));var licenseUtil=require(_0x4a38('0x16'));var db=require(_0x4a38('0x17'))['db'];function respondWithStatusCode(_0x5d9afa,_0x14b5c2){_0x14b5c2=_0x14b5c2||0xcc;return function(_0x4ae70e){if(_0x4ae70e){return _0x5d9afa[_0x4a38('0x18')](_0x14b5c2);}return _0x5d9afa[_0x4a38('0x19')](_0x14b5c2)[_0x4a38('0x1a')]();};}function respondWithResult(_0x54af79,_0x20d789){_0x20d789=_0x20d789||0xc8;return function(_0x10e3f6){if(_0x10e3f6){return _0x54af79[_0x4a38('0x19')](_0x20d789)[_0x4a38('0x1b')](_0x10e3f6);}};}function respondWithFilteredResult(_0x155c12,_0x399ddf){return function(_0x522429){if(_0x522429){var _0x45e405=typeof _0x399ddf['offset']===_0x4a38('0x1c')&&typeof _0x399ddf['limit']===_0x4a38('0x1c');var _0x10a717=_0x522429[_0x4a38('0x1d')];var _0xe4f2a6=_0x45e405?0x0:_0x399ddf[_0x4a38('0x1e')];var _0x5693c4=_0x45e405?_0x522429[_0x4a38('0x1d')]:_0x399ddf[_0x4a38('0x1e')]+_0x399ddf[_0x4a38('0x1f')];var _0x3d01af;if(_0x5693c4>=_0x10a717){_0x5693c4=_0x10a717;_0x3d01af=0xc8;}else{_0x3d01af=0xce;}_0x155c12[_0x4a38('0x19')](_0x3d01af);return _0x155c12['set'](_0x4a38('0x20'),_0xe4f2a6+'-'+_0x5693c4+'/'+_0x10a717)['json'](_0x522429);}return null;};}function patchUpdates(_0x501c0e){return function(_0x252cd2){try{jsonpatch[_0x4a38('0x21')](_0x252cd2,_0x501c0e,!![]);}catch(_0xe3984e){return BPromise[_0x4a38('0x22')](_0xe3984e);}return _0x252cd2[_0x4a38('0x23')]();};}function saveUpdates(_0x11bbc4,_0x1349a6){return function(_0x220faf){if(_0x220faf){return _0x220faf['update'](_0x11bbc4)[_0x4a38('0x24')](function(_0x38ac69){return _0x38ac69;});}return null;};}function removeEntity(_0x277e09,_0x1c2d08){return function(_0x43f5fd){if(_0x43f5fd){return _0x43f5fd['destroy']()['then'](function(){_0x277e09[_0x4a38('0x19')](0xcc)[_0x4a38('0x1a')]();});}};}function handleEntityNotFound(_0x1013c8,_0x4e3e50){return function(_0x28d087){if(!_0x28d087){_0x1013c8[_0x4a38('0x18')](0x194);}return _0x28d087;};}function handleError(_0x4c067d,_0x5e834f){_0x5e834f=_0x5e834f||0x1f4;return function(_0x55ec41){logger[_0x4a38('0x25')](_0x55ec41[_0x4a38('0x26')]);if(_0x55ec41['name']){delete _0x55ec41[_0x4a38('0x27')];}_0x4c067d[_0x4a38('0x19')](_0x5e834f)[_0x4a38('0x28')](_0x55ec41);};}exports['index']=function(_0x2c717d,_0x1e5bc8){var _0x4792ba={},_0x3ca3a7={},_0x2c8607={'count':0x0,'rows':[]};var _0x1e0d17=_[_0x4a38('0x29')](db['OpenchannelApplication'][_0x4a38('0x2a')],function(_0x5a43a4){return{'name':_0x5a43a4[_0x4a38('0x2b')],'type':_0x5a43a4[_0x4a38('0x2c')][_0x4a38('0x2d')]};});_0x3ca3a7['model']=_[_0x4a38('0x29')](_0x1e0d17,'name');_0x3ca3a7[_0x4a38('0x2e')]=_['keys'](_0x2c717d[_0x4a38('0x2e')]);_0x3ca3a7['filters']=_[_0x4a38('0x2f')](_0x3ca3a7[_0x4a38('0x30')],_0x3ca3a7[_0x4a38('0x2e')]);_0x4792ba[_0x4a38('0x31')]=_[_0x4a38('0x2f')](_0x3ca3a7['model'],qs[_0x4a38('0x32')](_0x2c717d[_0x4a38('0x2e')][_0x4a38('0x32')]));_0x4792ba[_0x4a38('0x31')]=_0x4792ba[_0x4a38('0x31')][_0x4a38('0x33')]?_0x4792ba['attributes']:_0x3ca3a7['model'];if(!_0x2c717d[_0x4a38('0x2e')][_0x4a38('0x34')]('nolimit')){_0x4792ba[_0x4a38('0x1f')]=qs[_0x4a38('0x1f')](_0x2c717d[_0x4a38('0x2e')][_0x4a38('0x1f')]);_0x4792ba[_0x4a38('0x1e')]=qs[_0x4a38('0x1e')](_0x2c717d[_0x4a38('0x2e')]['offset']);}_0x4792ba['order']=qs['sort'](_0x2c717d[_0x4a38('0x2e')][_0x4a38('0x35')]);_0x4792ba['where']=qs[_0x4a38('0x36')](_[_0x4a38('0x37')](_0x2c717d[_0x4a38('0x2e')],_0x3ca3a7[_0x4a38('0x36')]),_0x1e0d17);if(_0x2c717d[_0x4a38('0x2e')]['filter']){_0x4792ba[_0x4a38('0x38')]=_[_0x4a38('0x39')](_0x4792ba['where'],{'$or':_[_0x4a38('0x29')](_0x1e0d17,function(_0x40d3a8){if(_0x40d3a8['type']!==_0x4a38('0x3a')){var _0x1597a2={};_0x1597a2[_0x40d3a8[_0x4a38('0x27')]]={'$like':'%'+_0x2c717d[_0x4a38('0x2e')][_0x4a38('0x3b')]+'%'};return _0x1597a2;}})});}_0x4792ba=_[_0x4a38('0x39')]({},_0x4792ba,_0x2c717d['options']);var _0x4a0b09={'where':_0x4792ba[_0x4a38('0x38')]};return db[_0x4a38('0x3c')][_0x4a38('0x1d')](_0x4a0b09)['then'](function(_0x3c53a3){_0x2c8607[_0x4a38('0x1d')]=_0x3c53a3;if(_0x2c717d[_0x4a38('0x2e')]['includeAll']){_0x4792ba[_0x4a38('0x3d')]=[{'all':!![]}];}return db[_0x4a38('0x3c')][_0x4a38('0x3e')](_0x4792ba);})[_0x4a38('0x24')](function(_0x4918e7){_0x2c8607['rows']=_0x4918e7;return _0x2c8607;})['then'](respondWithFilteredResult(_0x1e5bc8,_0x4792ba))[_0x4a38('0x3f')](handleError(_0x1e5bc8,null));};exports[_0x4a38('0x40')]=function(_0x1c31dc,_0x55a160){var _0x454404={'raw':!![],'where':{'id':_0x1c31dc[_0x4a38('0x41')]['id']}},_0x13e413={};_0x13e413['model']=_[_0x4a38('0x42')](db[_0x4a38('0x3c')][_0x4a38('0x2a')]);_0x13e413[_0x4a38('0x2e')]=_[_0x4a38('0x42')](_0x1c31dc[_0x4a38('0x2e')]);_0x13e413[_0x4a38('0x36')]=_[_0x4a38('0x2f')](_0x13e413[_0x4a38('0x30')],_0x13e413['query']);_0x454404[_0x4a38('0x31')]=_[_0x4a38('0x2f')](_0x13e413['model'],qs[_0x4a38('0x32')](_0x1c31dc[_0x4a38('0x2e')][_0x4a38('0x32')]));_0x454404[_0x4a38('0x31')]=_0x454404[_0x4a38('0x31')][_0x4a38('0x33')]?_0x454404[_0x4a38('0x31')]:_0x13e413['model'];if(_0x1c31dc[_0x4a38('0x2e')][_0x4a38('0x43')]){_0x454404[_0x4a38('0x3d')]=[{'all':!![]}];}_0x454404=_[_0x4a38('0x39')]({},_0x454404,_0x1c31dc[_0x4a38('0x44')]);return db[_0x4a38('0x3c')][_0x4a38('0x45')](_0x454404)[_0x4a38('0x24')](handleEntityNotFound(_0x55a160,null))['then'](respondWithResult(_0x55a160,null))['catch'](handleError(_0x55a160,null));};exports[_0x4a38('0x46')]=function(_0x238029,_0x77c367){return db['OpenchannelApplication'][_0x4a38('0x46')](_0x238029[_0x4a38('0x47')],{})[_0x4a38('0x24')](respondWithResult(_0x77c367,0xc9))['catch'](handleError(_0x77c367,null));};exports[_0x4a38('0x48')]=function(_0x476171,_0x4b8540){if(_0x476171[_0x4a38('0x47')]['id']){delete _0x476171['body']['id'];}return db[_0x4a38('0x3c')][_0x4a38('0x45')]({'where':{'id':_0x476171[_0x4a38('0x41')]['id']}})[_0x4a38('0x24')](handleEntityNotFound(_0x4b8540,null))[_0x4a38('0x24')](saveUpdates(_0x476171['body'],null))['then'](respondWithResult(_0x4b8540,null))[_0x4a38('0x3f')](handleError(_0x4b8540,null));};exports['destroy']=function(_0xf07f33,_0x2b5ea7){return db[_0x4a38('0x3c')][_0x4a38('0x45')]({'where':{'id':_0xf07f33[_0x4a38('0x41')]['id']}})['then'](handleEntityNotFound(_0x2b5ea7,null))[_0x4a38('0x24')](removeEntity(_0x2b5ea7,null))[_0x4a38('0x3f')](handleError(_0x2b5ea7,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index c43881e..bbfbdd0 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 _0x357a=['api','moment','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x3b7b42,_0x31badd){var _0x1ebaad=function(_0x3655d9){while(--_0x3655d9){_0x3b7b42['push'](_0x3b7b42['shift']());}};_0x1ebaad(++_0x31badd);}(_0x357a,0x165));var _0xa357=function(_0x551e8f,_0x1dc6c4){_0x551e8f=_0x551e8f-0x0;var _0x78751b=_0x357a[_0x551e8f];return _0x78751b;};'use strict';var _=require(_0xa357('0x0'));var util=require(_0xa357('0x1'));var logger=require(_0xa357('0x2'))(_0xa357('0x3'));var moment=require(_0xa357('0x4'));var BPromise=require('bluebird');var rp=require(_0xa357('0x5'));var fs=require('fs');var path=require(_0xa357('0x6'));var rimraf=require(_0xa357('0x7'));var config=require(_0xa357('0x8'));var attributes=require(_0xa357('0x9'));module['exports']=function(_0x197a4c,_0x5322d2){return _0x197a4c[_0xa357('0xa')](_0xa357('0xb'),attributes,{'tableName':_0xa357('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa357('0xd'),'collate':_0xa357('0xe')});}; \ No newline at end of file +var _0x81d6=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelApplication.attributes','define','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0xb97ac0,_0x870f61){var _0x4964b6=function(_0x5a5f11){while(--_0x5a5f11){_0xb97ac0['push'](_0xb97ac0['shift']());}};_0x4964b6(++_0x870f61);}(_0x81d6,0x14d));var _0x681d=function(_0x551357,_0x13e42b){_0x551357=_0x551357-0x0;var _0x460eef=_0x81d6[_0x551357];return _0x460eef;};'use strict';var _=require(_0x681d('0x0'));var util=require(_0x681d('0x1'));var logger=require(_0x681d('0x2'))(_0x681d('0x3'));var moment=require(_0x681d('0x4'));var BPromise=require(_0x681d('0x5'));var rp=require(_0x681d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x681d('0x7'));var config=require(_0x681d('0x8'));var attributes=require(_0x681d('0x9'));module['exports']=function(_0x1009c6,_0x511a94){return _0x1009c6[_0x681d('0xa')](_0x681d('0xb'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x681d('0xc'),'collate':_0x681d('0xd')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 6bda824..2cd74e7 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 _0xc629=['attributes','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelApplication,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','options','where'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xc629,0x1de));var _0x9c62=function(_0x72787,_0x594958){_0x72787=_0x72787-0x0;var _0x46a611=_0xc629[_0x72787];return _0x46a611;};'use strict';var _=require(_0x9c62('0x0'));var util=require(_0x9c62('0x1'));var moment=require(_0x9c62('0x2'));var BPromise=require('bluebird');var rs=require(_0x9c62('0x3'));var fs=require('fs');var Redis=require(_0x9c62('0x4'));var db=require(_0x9c62('0x5'))['db'];var utils=require(_0x9c62('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x9c62('0x7'));var jayson=require(_0x9c62('0x8'));var client=jayson[_0x9c62('0x9')][_0x9c62('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50111d,_0x2c879e,_0x35b037){return new BPromise(function(_0x12abe4,_0x599233){return client['request'](_0x50111d,_0x35b037)[_0x9c62('0xb')](function(_0x4f1c5f){logger[_0x9c62('0xc')]('OpenchannelApplication,\x20%s,\x20%s',_0x2c879e,_0x9c62('0xd'));logger['debug'](_0x9c62('0xe'),_0x2c879e,'request\x20sent',JSON[_0x9c62('0xf')](_0x4f1c5f));if(_0x4f1c5f[_0x9c62('0x10')]){if(_0x4f1c5f['error']['code']===0x1f4){logger[_0x9c62('0x10')](_0x9c62('0x11'),_0x2c879e,_0x4f1c5f['error'][_0x9c62('0x12')]);return _0x599233(_0x4f1c5f[_0x9c62('0x10')][_0x9c62('0x12')]);}logger[_0x9c62('0x10')]('OpenchannelApplication,\x20%s,\x20%s',_0x2c879e,_0x4f1c5f[_0x9c62('0x10')][_0x9c62('0x12')]);return _0x12abe4(_0x4f1c5f[_0x9c62('0x10')]['message']);}else{logger['info'](_0x9c62('0x11'),_0x2c879e,_0x9c62('0xd'));_0x12abe4(_0x4f1c5f[_0x9c62('0x13')][_0x9c62('0x12')]);}})[_0x9c62('0x14')](function(_0x39a24d){logger[_0x9c62('0x10')](_0x9c62('0x11'),_0x2c879e,_0x39a24d);_0x599233(_0x39a24d);});});}exports[_0x9c62('0x15')]=function(_0x2140b9){var _0x551d10=this;return new Promise(function(_0x4d3f38,_0x52d441){return db[_0x9c62('0x16')][_0x9c62('0x17')](_0x2140b9['body'],{'raw':_0x2140b9[_0x9c62('0x18')]?_0x2140b9[_0x9c62('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2140b9[_0x9c62('0x18')]?_0x2140b9[_0x9c62('0x18')][_0x9c62('0x19')]||null:null,'attributes':_0x2140b9[_0x9c62('0x18')]?_0x2140b9[_0x9c62('0x18')][_0x9c62('0x1a')]||null:null,'limit':_0x2140b9['options']?_0x2140b9['options']['limit']||null:null})[_0x9c62('0xb')](function(_0x49fbf9){logger[_0x9c62('0xc')](_0x9c62('0x15'),_0x2140b9);logger[_0x9c62('0x1b')](_0x9c62('0x15'),_0x2140b9,JSON['stringify'](_0x49fbf9));_0x4d3f38(_0x49fbf9);})[_0x9c62('0x14')](function(_0xf5453a){logger[_0x9c62('0x10')](_0x9c62('0x15'),_0xf5453a[_0x9c62('0x12')],_0x2140b9);_0x52d441(_0x551d10[_0x9c62('0x10')](0x1f4,_0xf5453a[_0x9c62('0x12')]));});});}; \ No newline at end of file +var _0x634b=['jayson/promise','client','http','request','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','update','options','raw','where','attributes','limit','UpdateOpenchannelApplication','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3cb48e,_0x580d7a){var _0x27c35a=function(_0x4d95c8){while(--_0x4d95c8){_0x3cb48e['push'](_0x3cb48e['shift']());}};_0x27c35a(++_0x580d7a);}(_0x634b,0x1ba));var _0xb634=function(_0x139b66,_0xf61f78){_0x139b66=_0x139b66-0x0;var _0x44f3f1=_0x634b[_0x139b66];return _0x44f3f1;};'use strict';var _=require('lodash');var util=require(_0xb634('0x0'));var moment=require(_0xb634('0x1'));var BPromise=require(_0xb634('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb634('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb634('0x4'));var logger=require(_0xb634('0x5'))(_0xb634('0x6'));var config=require(_0xb634('0x7'));var jayson=require(_0xb634('0x8'));var client=jayson[_0xb634('0x9')][_0xb634('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x223651,_0x207272,_0x193bab){return new BPromise(function(_0x257e54,_0x83e4b8){return client[_0xb634('0xb')](_0x223651,_0x193bab)[_0xb634('0xc')](function(_0x1ac07c){logger['info'](_0xb634('0xd'),_0x207272,_0xb634('0xe'));logger[_0xb634('0xf')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x207272,'request\x20sent',JSON[_0xb634('0x10')](_0x1ac07c));if(_0x1ac07c[_0xb634('0x11')]){if(_0x1ac07c['error'][_0xb634('0x12')]===0x1f4){logger['error'](_0xb634('0xd'),_0x207272,_0x1ac07c['error'][_0xb634('0x13')]);return _0x83e4b8(_0x1ac07c['error'][_0xb634('0x13')]);}logger[_0xb634('0x11')](_0xb634('0xd'),_0x207272,_0x1ac07c[_0xb634('0x11')][_0xb634('0x13')]);return _0x257e54(_0x1ac07c['error'][_0xb634('0x13')]);}else{logger[_0xb634('0x14')](_0xb634('0xd'),_0x207272,_0xb634('0xe'));_0x257e54(_0x1ac07c[_0xb634('0x15')][_0xb634('0x13')]);}})[_0xb634('0x16')](function(_0x53fa9a){logger[_0xb634('0x11')](_0xb634('0xd'),_0x207272,_0x53fa9a);_0x83e4b8(_0x53fa9a);});});}exports['UpdateOpenchannelApplication']=function(_0x3d2315){var _0x3f4cc6=this;return new Promise(function(_0x26b533,_0x5866f8){return db['OpenchannelApplication'][_0xb634('0x17')](_0x3d2315['body'],{'raw':_0x3d2315['options']?_0x3d2315[_0xb634('0x18')][_0xb634('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d2315['options']?_0x3d2315[_0xb634('0x18')][_0xb634('0x1a')]||null:null,'attributes':_0x3d2315[_0xb634('0x18')]?_0x3d2315['options'][_0xb634('0x1b')]||null:null,'limit':_0x3d2315['options']?_0x3d2315['options'][_0xb634('0x1c')]||null:null})['then'](function(_0x4617ea){logger[_0xb634('0x14')](_0xb634('0x1d'),_0x3d2315);logger[_0xb634('0xf')](_0xb634('0x1d'),_0x3d2315,JSON[_0xb634('0x10')](_0x4617ea));_0x26b533(_0x4617ea);})[_0xb634('0x16')](function(_0x61299b){logger[_0xb634('0x11')](_0xb634('0x1d'),_0x61299b[_0xb634('0x13')],_0x3d2315);_0x5866f8(_0x3f4cc6[_0xb634('0x11')](0x1f4,_0x61299b[_0xb634('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 4746af5..b0b65c7 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 _0x693a=['exports','util','path','Router','fs-extra','../../components/auth/service','./openchannelInteraction.controller','get','index','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','download','post','create','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','delete','openchannelinteraction:destroy','destroy','removeTags'];(function(_0x1e081a,_0x482d6b){var _0x428209=function(_0x524b53){while(--_0x524b53){_0x1e081a['push'](_0x1e081a['shift']());}};_0x428209(++_0x482d6b);}(_0x693a,0x75));var _0xa693=function(_0x59342a,_0x16827b){_0x59342a=_0x59342a-0x0;var _0x17abc9=_0x693a[_0x59342a];return _0x17abc9;};'use strict';var multer=require('multer');var util=require(_0xa693('0x0'));var path=require(_0xa693('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa693('0x2')]();var fs_extra=require(_0xa693('0x3'));var auth=require(_0xa693('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa693('0x5'));router[_0xa693('0x6')]('/',auth['isAuthenticated'](),controller[_0xa693('0x7')]);router[_0xa693('0x6')]('/describe',auth[_0xa693('0x8')](),controller[_0xa693('0x9')]);router[_0xa693('0x6')](_0xa693('0xa'),auth[_0xa693('0x8')](),controller[_0xa693('0xb')]);router[_0xa693('0x6')](_0xa693('0xc'),auth[_0xa693('0x8')](),controller[_0xa693('0xd')]);router[_0xa693('0x6')]('/:id/download',auth[_0xa693('0x8')](),controller[_0xa693('0xe')]);router[_0xa693('0xf')]('/',auth[_0xa693('0x8')](),controller[_0xa693('0x10')]);router['post'](_0xa693('0xc'),auth[_0xa693('0x8')](),controller['addMessage']);router['post'](_0xa693('0x11'),auth['isAuthenticated'](),interaction[_0xa693('0x12')](_0xa693('0x13'),_0xa693('0x14')),controller[_0xa693('0x15')]);router[_0xa693('0x16')](_0xa693('0xa'),auth['isAuthenticated'](),interaction[_0xa693('0x12')](_0xa693('0x13'),_0xa693('0x17')),controller['update']);router[_0xa693('0x18')](_0xa693('0xa'),auth['isAuthenticated'](),interaction[_0xa693('0x12')](_0xa693('0x13'),_0xa693('0x19')),controller[_0xa693('0x1a')]);router[_0xa693('0x18')](_0xa693('0x11'),auth[_0xa693('0x8')](),controller[_0xa693('0x1b')]);module[_0xa693('0x1c')]=router; \ No newline at end of file +var _0x6f29=['../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','index','/describe','/:id','/:id/download','isAuthenticated','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','openchannelinteraction:addtags','addTags','put','openchannel','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','removeTags','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x199415,_0x1b5846){var _0x3e8f61=function(_0x122d6e){while(--_0x122d6e){_0x199415['push'](_0x199415['shift']());}};_0x3e8f61(++_0x1b5846);}(_0x6f29,0x1da));var _0x96f2=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0x6f29[_0x456fb1];return _0x4083d6;};'use strict';var multer=require(_0x96f2('0x0'));var util=require(_0x96f2('0x1'));var path=require(_0x96f2('0x2'));var timeout=require(_0x96f2('0x3'));var express=require('express');var router=express[_0x96f2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x96f2('0x5'));var interaction=require(_0x96f2('0x6'));var config=require(_0x96f2('0x7'));var controller=require(_0x96f2('0x8'));router[_0x96f2('0x9')]('/',auth['isAuthenticated'](),controller[_0x96f2('0xa')]);router['get'](_0x96f2('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x96f2('0x9')](_0x96f2('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x96f2('0x9')]('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router['get'](_0x96f2('0xd'),auth[_0x96f2('0xe')](),controller[_0x96f2('0xf')]);router[_0x96f2('0x10')]('/',auth['isAuthenticated'](),controller[_0x96f2('0x11')]);router[_0x96f2('0x10')](_0x96f2('0x12'),auth['isAuthenticated'](),controller[_0x96f2('0x13')]);router[_0x96f2('0x10')](_0x96f2('0x14'),auth[_0x96f2('0xe')](),interaction[_0x96f2('0x15')]('openchannel',_0x96f2('0x16')),controller[_0x96f2('0x17')]);router[_0x96f2('0x18')](_0x96f2('0xc'),auth['isAuthenticated'](),interaction[_0x96f2('0x15')](_0x96f2('0x19'),_0x96f2('0x1a')),controller[_0x96f2('0x1b')]);router[_0x96f2('0x1c')](_0x96f2('0xc'),auth[_0x96f2('0xe')](),interaction[_0x96f2('0x15')](_0x96f2('0x19'),_0x96f2('0x1d')),controller['destroy']);router[_0x96f2('0x1c')](_0x96f2('0x14'),auth[_0x96f2('0xe')](),controller[_0x96f2('0x1e')]);module[_0x96f2('0x1f')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 6615f32..6441b80 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 _0x1707=['out','BOOLEAN','INTEGER','sequelize','STRING','DATE','ENUM'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1707,0x1df));var _0x7170=function(_0x322309,_0xec8f3a){_0x322309=_0x322309-0x0;var _0x572f01=_0x1707[_0x322309];return _0x572f01;};'use strict';var Sequelize=require(_0x7170('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x7170('0x1')]},'secondDisposition':{'type':Sequelize[_0x7170('0x1')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7170('0x1')]},'read1stAt':{'type':Sequelize[_0x7170('0x2')]},'threadId':{'type':Sequelize[_0x7170('0x1')]},'externalUrl':{'type':Sequelize[_0x7170('0x1')]},'lastMsgAt':{'type':Sequelize[_0x7170('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x7170('0x3')]('in',_0x7170('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x7170('0x3')]('in',_0x7170('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x7170('0x1')]},'autoreplyExecuted':{'type':Sequelize[_0x7170('0x5')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x7170('0x6')]}}; \ No newline at end of file +var _0x205d=['BOOLEAN','STRING','DATE','ENUM','out','INTEGER','sequelize','exports'];(function(_0x1c6715,_0x25f20a){var _0x532699=function(_0x168816){while(--_0x168816){_0x1c6715['push'](_0x1c6715['shift']());}};_0x532699(++_0x25f20a);}(_0x205d,0xf6));var _0xd205=function(_0x203917,_0x2eec89){_0x203917=_0x203917-0x0;var _0xfe18a0=_0x205d[_0x203917];return _0xfe18a0;};'use strict';var Sequelize=require(_0xd205('0x0'));module[_0xd205('0x1')]={'closed':{'type':Sequelize[_0xd205('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xd205('0x3')]},'thirdDisposition':{'type':Sequelize[_0xd205('0x3')]},'note':{'type':Sequelize[_0xd205('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0xd205('0x3')]},'externalUrl':{'type':Sequelize[_0xd205('0x3')]},'lastMsgAt':{'type':Sequelize[_0xd205('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xd205('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xd205('0x5')]('in',_0xd205('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xd205('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0xd205('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xd205('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 20464cc..54272d4 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 _0x895a=['create','body','catch','describe','addMessage','ids','omit','getMessages','keys','OpenchannelMessage','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','OpenchannelInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','rows','addTags','setTags','spread','color','emit','openchannelInteractionTags:save','removeTags','unix','toString','root','join','server','attachments','push','User','fullname','CmContact','Contact','lastName','createdAt','direction','secret','read','OpenchannelAccount','Account','Owner','mkdirSync','Openchannel','N.A.','closed','threadId','Public','Attachment','basename','existsSync','createReadStream','pipe','out','System','firstName','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','download','Unable\x20to\x20delete\x20zip\x20file','rimraf','moment','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/environment','../../mysqldb','redis','defaults','./openchannelInteraction.socket','register','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','json','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','getOptions','findAll','query','from','params','model','intersection','attributes','fields','include','merge','OpenchannelInteraction','find'];(function(_0x33c663,_0x4416ed){var _0x4c6299=function(_0x4c1937){while(--_0x4c1937){_0x33c663['push'](_0x33c663['shift']());}};_0x4c6299(++_0x4416ed);}(_0x895a,0xc5));var _0xa895=function(_0x373bab,_0x40f098){_0x373bab=_0x373bab-0x0;var _0x1ac7bb=_0x895a[_0x373bab];return _0x1ac7bb;};'use strict';var rimraf=require(_0xa895('0x0'));var zipdir=require('zip-dir');var moment=require(_0xa895('0x1'));var util=require('util');var path=require('path');var ejs=require(_0xa895('0x2'));var fs=require('fs');var _=require(_0xa895('0x3'));var Redis=require(_0xa895('0x4'));var interaction=require(_0xa895('0x5'));var qs=require(_0xa895('0x6'));var pdf=require(_0xa895('0x7'));var logger=require('../../config/logger')('api');var config=require(_0xa895('0x8'));var db=require(_0xa895('0x9'))['db'];config[_0xa895('0xa')]=_[_0xa895('0xb')](config[_0xa895('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa895('0xa')]));require(_0xa895('0xc'))[_0xa895('0xd')](socket);function respondWithStatusCode(_0xc29fc9,_0x26e943){_0x26e943=_0x26e943||0xcc;return function(_0x54175d){if(_0x54175d){return _0xc29fc9[_0xa895('0xe')](_0x26e943);}return _0xc29fc9[_0xa895('0xf')](_0x26e943)[_0xa895('0x10')]();};}function respondWithResult(_0x1ceb41,_0x129f6d){_0x129f6d=_0x129f6d||0xc8;return function(_0x1ca9c1){if(_0x1ca9c1){return _0x1ceb41[_0xa895('0xf')](_0x129f6d)['json'](_0x1ca9c1);}};}function respondWithFilteredResult(_0x310ae8,_0x150a5){return function(_0x2de781){if(_0x2de781){var _0x550882=typeof _0x150a5['offset']===_0xa895('0x11')&&typeof _0x150a5[_0xa895('0x12')]===_0xa895('0x11');var _0x29e9ba=_0x2de781['count'];var _0x385979=_0x550882?0x0:_0x150a5[_0xa895('0x13')];var _0xd8429e=_0x550882?_0x2de781[_0xa895('0x14')]:_0x150a5['offset']+_0x150a5[_0xa895('0x12')];var _0xbf9177;if(_0xd8429e>=_0x29e9ba){_0xd8429e=_0x29e9ba;_0xbf9177=0xc8;}else{_0xbf9177=0xce;}_0x310ae8[_0xa895('0xf')](_0xbf9177);return _0x310ae8[_0xa895('0x15')](_0xa895('0x16'),_0x385979+'-'+_0xd8429e+'/'+_0x29e9ba)[_0xa895('0x17')](_0x2de781);}return null;};}function saveUpdates(_0x2d1b08){return function(_0x5d8f93){if(_0x5d8f93){return _0x5d8f93[_0xa895('0x18')](_0x2d1b08)[_0xa895('0x19')](function(_0x1bd065){return _0x1bd065;});}return null;};}function removeEntity(_0x2aface){return function(_0x495414){if(_0x495414){return _0x495414[_0xa895('0x1a')]()[_0xa895('0x19')](function(){_0x2aface['status'](0xcc)[_0xa895('0x10')]();});}};}function handleEntityNotFound(_0x242ba1){return function(_0x245510){if(!_0x245510){_0x242ba1['sendStatus'](0x194);}return _0x245510;};}function handleError(_0x539e74,_0x495ed7){_0x495ed7=_0x495ed7||0x1f4;return function(_0x2293ac){logger[_0xa895('0x1b')](_0x2293ac[_0xa895('0x1c')]);if(_0x2293ac[_0xa895('0x1d')]){delete _0x2293ac[_0xa895('0x1d')];}_0x539e74[_0xa895('0xf')](_0x495ed7)[_0xa895('0x1e')](_0x2293ac);};}exports[_0xa895('0x1f')]=function(_0x4f870,_0x1689cb){var _0x34c639={};var _0x257004=_[_0xa895('0x20')](db['OpenchannelInteraction'][_0xa895('0x21')],function(_0x276f1c){return{'name':_0x276f1c[_0xa895('0x22')],'type':_0x276f1c['type'][_0xa895('0x23')]};});_0x34c639=qs[_0xa895('0x24')](_0x257004,_0x4f870);return interaction[_0xa895('0x25')]('openchannel',_0x4f870[_0xa895('0x26')],_0x4f870['user'],_0x34c639,_0x257004)['then'](respondWithFilteredResult(_0x1689cb,_0x34c639))['catch'](handleError(_0x1689cb,null));};exports['show']=function(_0x4110a4,_0x917bf1){var _0x33d852={};if(_0x4110a4[_0xa895('0x26')]['type']&&_0x4110a4[_0xa895('0x26')]['type']===_0xa895('0x27')){_0x33d852[_0xa895('0x27')]=_0x4110a4[_0xa895('0x28')]['id'];}else{_0x33d852['id']=_0x4110a4['params']['id'];}var _0x477476={'raw':![],'where':_0x33d852},_0xa5716c={};_0xa5716c[_0xa895('0x29')]=_['keys'](db['OpenchannelInteraction'][_0xa895('0x21')]);_0xa5716c[_0xa895('0x26')]=_['keys'](_0x4110a4[_0xa895('0x26')]);_0xa5716c['filters']=_[_0xa895('0x2a')](_0xa5716c['model'],_0xa5716c[_0xa895('0x26')]);_0x477476[_0xa895('0x2b')]=_[_0xa895('0x2a')](_0xa5716c['model'],qs[_0xa895('0x2c')](_0x4110a4[_0xa895('0x26')]['fields']));_0x477476[_0xa895('0x2b')]=_0x477476[_0xa895('0x2b')]['length']?_0x477476['attributes']:_0xa5716c['model'];if(_0x4110a4[_0xa895('0x26')]['includeAll']){_0x477476[_0xa895('0x2d')]=[{'all':!![]}];}_0x477476=_[_0xa895('0x2e')]({},_0x477476,_0x4110a4['options']);return db[_0xa895('0x2f')][_0xa895('0x30')](_0x477476)[_0xa895('0x19')](handleEntityNotFound(_0x917bf1,null))[_0xa895('0x19')](respondWithResult(_0x917bf1,null))['catch'](handleError(_0x917bf1,null));};exports[_0xa895('0x31')]=function(_0x320e40,_0x79623c){return db[_0xa895('0x2f')][_0xa895('0x31')](_0x320e40[_0xa895('0x32')],{})[_0xa895('0x19')](respondWithResult(_0x79623c,0xc9))[_0xa895('0x33')](handleError(_0x79623c,null));};exports['update']=function(_0x2a21d9,_0x40d559){if(_0x2a21d9[_0xa895('0x32')]['id']){delete _0x2a21d9[_0xa895('0x32')]['id'];}return db[_0xa895('0x2f')][_0xa895('0x30')]({'where':{'id':_0x2a21d9[_0xa895('0x28')]['id']}})[_0xa895('0x19')](handleEntityNotFound(_0x40d559,null))['then'](saveUpdates(_0x2a21d9[_0xa895('0x32')],null))[_0xa895('0x19')](respondWithResult(_0x40d559,null))[_0xa895('0x33')](handleError(_0x40d559,null));};exports[_0xa895('0x1a')]=function(_0x22e812,_0x4f7aa5){return db[_0xa895('0x2f')]['find']({'where':{'id':_0x22e812[_0xa895('0x28')]['id']}})['then'](handleEntityNotFound(_0x4f7aa5,null))[_0xa895('0x19')](removeEntity(_0x4f7aa5,null))[_0xa895('0x33')](handleError(_0x4f7aa5,null));};exports[_0xa895('0x34')]=function(_0x33dda1,_0x4eabf7){return db['OpenchannelInteraction'][_0xa895('0x34')]()[_0xa895('0x19')](respondWithResult(_0x4eabf7,null))['catch'](handleError(_0x4eabf7,null));};exports[_0xa895('0x35')]=function(_0x4a5532,_0x377b58){return db['OpenchannelMessage'][_0xa895('0x30')]({'where':{'id':_0x4a5532[_0xa895('0x28')]['id']}})[_0xa895('0x19')](handleEntityNotFound(_0x377b58,null))['then'](function(_0x3a7002){if(_0x3a7002){return _0x3a7002[_0xa895('0x35')](_0x4a5532[_0xa895('0x32')][_0xa895('0x36')],_[_0xa895('0x37')](_0x4a5532[_0xa895('0x32')],['ids','id'])||{});}})[_0xa895('0x19')](respondWithResult(_0x377b58,null))[_0xa895('0x33')](handleError(_0x377b58,null));};exports[_0xa895('0x38')]=function(_0x6da04c,_0x36d1ed){var _0xeccfa9={'raw':![],'where':{}};var _0x147059={};var _0xe736a4={'count':0x0,'rows':[]};return db[_0xa895('0x2f')]['findOne']({'where':{'id':_0x6da04c[_0xa895('0x28')]['id']}})[_0xa895('0x19')](handleEntityNotFound(_0x36d1ed,null))[_0xa895('0x19')](function(_0x45df9f){if(_0x45df9f){_0x147059[_0xa895('0x29')]=_[_0xa895('0x39')](db[_0xa895('0x3a')][_0xa895('0x21')]);_0x147059[_0xa895('0x26')]=_[_0xa895('0x39')](_0x6da04c['query']);_0x147059['filters']=_['intersection'](_0x147059[_0xa895('0x29')],_0x147059[_0xa895('0x26')]);_0xeccfa9[_0xa895('0x2b')]=_['intersection'](_0x147059['model'],qs[_0xa895('0x2c')](_0x6da04c['query']['fields']));_0xeccfa9[_0xa895('0x2b')]=_0xeccfa9[_0xa895('0x2b')][_0xa895('0x3b')]?_0xeccfa9[_0xa895('0x2b')]:_0x147059[_0xa895('0x29')];if(!_0x6da04c['query'][_0xa895('0x3c')](_0xa895('0x3d'))){_0xeccfa9['limit']=qs[_0xa895('0x12')](_0x6da04c['query'][_0xa895('0x12')]);_0xeccfa9[_0xa895('0x13')]=qs[_0xa895('0x13')](_0x6da04c[_0xa895('0x26')][_0xa895('0x13')]);}_0xeccfa9[_0xa895('0x3e')]=qs[_0xa895('0x3f')](_0x6da04c[_0xa895('0x26')][_0xa895('0x3f')]);_0xeccfa9[_0xa895('0x40')]=qs[_0xa895('0x41')](_[_0xa895('0x42')](_0x6da04c[_0xa895('0x26')],_0x147059[_0xa895('0x41')]));_0xeccfa9[_0xa895('0x40')][_0xa895('0x43')]=_0x45df9f['id'];if(_0x6da04c[_0xa895('0x26')][_0xa895('0x44')]){_0xeccfa9[_0xa895('0x40')]=_[_0xa895('0x2e')](_0xeccfa9['where'],{'$or':_[_0xa895('0x20')](_0xeccfa9[_0xa895('0x2b')],function(_0xa47e39){var _0x49f8dd={};_0x49f8dd[_0xa47e39]={'$like':'%'+_0x6da04c[_0xa895('0x26')][_0xa895('0x44')]+'%'};return _0x49f8dd;})});}if(_0x6da04c[_0xa895('0x26')][_0xa895('0x45')]){var _0x513b3c=_0x6da04c[_0xa895('0x26')][_0xa895('0x45')][_0xa895('0x46')](',');var _0x70c80b={};_0x70c80b[_0x513b3c[0x0]]={'$gte':moment(_0x513b3c[0x1])[_0xa895('0x47')](_0xa895('0x48'))};_0xeccfa9[_0xa895('0x40')]=_[_0xa895('0x2e')](_0xeccfa9[_0xa895('0x40')],_0x70c80b);}_0xeccfa9=_[_0xa895('0x2e')]({},_0xeccfa9,_0x6da04c[_0xa895('0x49')]);return db[_0xa895('0x3a')][_0xa895('0x14')]({'where':_0xeccfa9[_0xa895('0x40')]})[_0xa895('0x19')](function(_0x1ee1e5){_0xe736a4[_0xa895('0x14')]=_0x1ee1e5;if(_0x6da04c['query']['includeAll']){_0xeccfa9[_0xa895('0x2d')]=[{'all':!![]}];}return db[_0xa895('0x3a')][_0xa895('0x25')](_0xeccfa9);})['then'](function(_0xfbe082){_0xe736a4[_0xa895('0x4a')]=_0xfbe082;return _0xe736a4;});}})[_0xa895('0x19')](respondWithFilteredResult(_0x36d1ed,_0xeccfa9))[_0xa895('0x33')](handleError(_0x36d1ed,null));};exports[_0xa895('0x4b')]=function(_0x2f1d4f,_0x1b8c2f){return db[_0xa895('0x2f')]['find']({'where':{'id':_0x2f1d4f['params']['id']}})['then'](handleEntityNotFound(_0x1b8c2f,null))[_0xa895('0x19')](function(_0x591c85){if(_0x591c85){return _0x591c85[_0xa895('0x4c')](_0x2f1d4f[_0xa895('0x32')][_0xa895('0x36')],_['omit'](_0x2f1d4f['body'],[_0xa895('0x36'),'id'])||{})[_0xa895('0x4d')](function(){return db['Tag'][_0xa895('0x25')]({'attributes':['id',_0xa895('0x1d'),_0xa895('0x4e')],'where':{'id':_0x2f1d4f['body'][_0xa895('0x36')]}});})[_0xa895('0x19')](function(_0x757ee0){socket[_0xa895('0x4f')](_0xa895('0x50'),{'id':Number(_0x2f1d4f[_0xa895('0x28')]['id']),'tags':_0x757ee0||[]});return{'id':Number(_0x2f1d4f[_0xa895('0x28')]['id']),'tags':_0x757ee0||[]};});}})[_0xa895('0x19')](respondWithResult(_0x1b8c2f,null))[_0xa895('0x33')](handleError(_0x1b8c2f,null));};exports[_0xa895('0x51')]=function(_0x942f8c,_0xe9c6cf){return db['OpenchannelInteraction'][_0xa895('0x30')]({'where':{'id':_0x942f8c[_0xa895('0x28')]['id']}})[_0xa895('0x19')](handleEntityNotFound(_0xe9c6cf,null))[_0xa895('0x19')](function(_0x3c81d5){if(_0x3c81d5){return _0x3c81d5[_0xa895('0x51')](_0x942f8c[_0xa895('0x26')]['ids']);}})[_0xa895('0x19')](respondWithStatusCode(_0xe9c6cf,null))[_0xa895('0x33')](handleError(_0xe9c6cf,null));};exports['download']=function(_0x31e87d,_0x55dc5b){var _0x160b88=moment()[_0xa895('0x52')]()[_0xa895('0x53')]();var _0x306cfd=path['join'](config[_0xa895('0x54')],'server','files','tmp');var _0x1bb616=path[_0xa895('0x55')](config[_0xa895('0x54')],_0xa895('0x56'),'files',_0xa895('0x57'));var _0x2a5034=path[_0xa895('0x55')](_0x306cfd,_0x160b88);var _0x58efbb=util[_0xa895('0x47')]('transcript-%d-%s.zip',_0x31e87d['params']['id'],_0x160b88);var _0x330690=path[_0xa895('0x55')](_0x306cfd,_0x58efbb);var _0xb4db1d=[];_0xb4db1d[_0xa895('0x58')]({'model':db[_0xa895('0x59')],'as':_0xa895('0x59'),'attributes':['id',_0xa895('0x5a')],'raw':!![]});_0xb4db1d[_0xa895('0x58')]({'model':db[_0xa895('0x5b')],'as':_0xa895('0x5c'),'attributes':['id','firstName',_0xa895('0x5d')],'raw':!![]});if(_0x31e87d[_0xa895('0x26')][_0xa895('0x57')]){_0xb4db1d[_0xa895('0x58')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x19776b=[{'model':db[_0xa895('0x3a')],'as':'Messages','attributes':['id',_0xa895('0x32'),_0xa895('0x5e'),_0xa895('0x5f'),_0xa895('0x60'),_0xa895('0x61')],'include':_0xb4db1d}];_0x19776b[_0xa895('0x58')]({'model':db[_0xa895('0x62')],'as':_0xa895('0x63'),'attributes':['id',_0xa895('0x1d')]});_0x19776b[_0xa895('0x58')]({'model':db['User'],'as':_0xa895('0x64'),'attributes':['id',_0xa895('0x5a')]});return db['OpenchannelInteraction'][_0xa895('0x30')]({'where':{'id':_0x31e87d[_0xa895('0x28')]['id']},'include':_0x19776b})[_0xa895('0x19')](handleEntityNotFound(_0x55dc5b,null))['then'](function(_0x3fd4a7){if(_0x3fd4a7){var _0x274185=_0x3fd4a7['get']({'plain':!![]});fs[_0xa895('0x65')](_0x2a5034);var _0x1b4870={'channel':_0xa895('0x66'),'account':_0x274185[_0xa895('0x63')]['name'],'agent':_0x274185[_0xa895('0x64')]?_0x274185[_0xa895('0x64')]['fullname']:_0xa895('0x67'),'createdAt':moment(_0x274185[_0xa895('0x5e')])[_0xa895('0x47')](_0xa895('0x48'))['toString'](),'closedAt':_0x274185[_0xa895('0x68')]?moment(_0x274185['closedAt'])['format'](_0xa895('0x48'))[_0xa895('0x53')]():'','disposition':_0x274185['disposition'],'visibility':_0x274185[_0xa895('0x69')]?_0xa895('0x6a'):'Private','messages':_(_0x274185['Messages'])[_0xa895('0x44')]({'secret':![]})['map'](function(_0x509eb0){if(_0x509eb0[_0xa895('0x6b')]){var _0x2f865f=path['join'](_0x1bb616,_0x509eb0[_0xa895('0x6b')][_0xa895('0x6c')]);if(fs[_0xa895('0x6d')](_0x2f865f)){fs[_0xa895('0x6e')](_0x2f865f)[_0xa895('0x6f')](fs['createWriteStream'](path[_0xa895('0x55')](_0x2a5034,_0x509eb0[_0xa895('0x6b')][_0xa895('0x6c')])));}}return{'date':moment(_0x509eb0[_0xa895('0x5e')])[_0xa895('0x47')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x509eb0[_0xa895('0x5f')]===_0xa895('0x70')?_0x509eb0[_0xa895('0x59')]?_0x509eb0[_0xa895('0x59')][_0xa895('0x5a')]:_0xa895('0x71'):_0x509eb0['Contact'][_0xa895('0x72')]+(_0x509eb0['Contact']['lastName']?'\x20'+_0x509eb0[_0xa895('0x5c')][_0xa895('0x5d')]:''),'body':_0x509eb0[_0xa895('0x6b')]?_0x509eb0[_0xa895('0x6b')][_0xa895('0x6c')]:_0x509eb0[_0xa895('0x32')],'direction':_0x509eb0['direction']===_0xa895('0x70')?'A':'C','secret':_0x509eb0[_0xa895('0x60')],'read':_0x509eb0['read'],'attachment':_0x509eb0[_0xa895('0x6b')]};})[_0xa895('0x73')]()};return ejs[_0xa895('0x74')](path[_0xa895('0x55')](config[_0xa895('0x54')],_0xa895('0x56'),_0xa895('0x75'),_0xa895('0x76')),{'interaction':_0x1b4870})[_0xa895('0x19')](function(_0x3e0b4b){var _0x1ccda7=path[_0xa895('0x55')](_0x2a5034,_0xa895('0x77')+_0x274185['id']+'-'+_0x160b88+_0xa895('0x78'));var _0x5e3a28={'path':_0x1ccda7,'channel':'Openchannel','interactionId':_0x274185['id']};return pdf['createPdfFromHTML'](_0x3e0b4b,_0x5e3a28);})[_0xa895('0x19')](function(){return new Promise(function(_0x3bdd6b,_0x3c1e30){zipdir(_0x2a5034,{'saveTo':_0x330690},function(_0x5993ba,_0x55b387){if(_0x5993ba)return _0x3c1e30(_0x5993ba);return _0x3bdd6b(_0x55b387);});})[_0xa895('0x19')](function(){return new Promise(function(_0x32b96,_0x18242e){rimraf(_0x2a5034,function(_0x1d0c29){if(_0x1d0c29)_0x18242e(_0x1d0c29);return _0x32b96();});});})[_0xa895('0x19')](function(){return _0x55dc5b[_0xa895('0x79')](_0x330690,_0x58efbb,function(_0x12b230){if(_0x12b230){logger['error'](_0xa895('0x7a'),_0x12b230);}else{fs['unlinkSync'](_0x330690);}});});});}else{return _0x55dc5b[_0xa895('0xe')](0xc8);}})['catch'](handleError(_0x55dc5b,null));}; \ No newline at end of file +var _0xc987=['end','json','offset','limit','count','status','set','then','destroy','stack','name','send','rawAttributes','fieldName','type','key','getOptions','findAll','openchannel','query','user','catch','from','params','keys','filters','intersection','model','fields','attributes','length','includeAll','include','merge','OpenchannelInteraction','create','body','update','find','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','$gte','options','rows','spread','Tag','color','emit','openchannelInteractionTags:save','download','unix','toString','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','lastName','Attachment','Messages','direction','secret','read','OpenchannelAccount','Account','Owner','get','Openchannel','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','Public','Private','map','basename','pipe','out','firstName','renderFile','views','createPdfFromHTML','error','unlinkSync','rimraf','zip-dir','moment','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus'];(function(_0x4c9819,_0x1662b9){var _0x1ed9c6=function(_0x429b7f){while(--_0x429b7f){_0x4c9819['push'](_0x4c9819['shift']());}};_0x1ed9c6(++_0x1662b9);}(_0xc987,0x1dd));var _0x7c98=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0xc987[_0x54d4a8];return _0x3b321b;};'use strict';var rimraf=require(_0x7c98('0x0'));var zipdir=require(_0x7c98('0x1'));var moment=require(_0x7c98('0x2'));var util=require(_0x7c98('0x3'));var path=require('path');var ejs=require(_0x7c98('0x4'));var fs=require('fs');var _=require(_0x7c98('0x5'));var Redis=require(_0x7c98('0x6'));var interaction=require(_0x7c98('0x7'));var qs=require(_0x7c98('0x8'));var pdf=require('../../components/export/pdf');var logger=require(_0x7c98('0x9'))(_0x7c98('0xa'));var config=require(_0x7c98('0xb'));var db=require(_0x7c98('0xc'))['db'];config[_0x7c98('0xd')]=_[_0x7c98('0xe')](config[_0x7c98('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x7c98('0xf'))(new Redis(config[_0x7c98('0xd')]));require(_0x7c98('0x10'))[_0x7c98('0x11')](socket);function respondWithStatusCode(_0x2d4c7d,_0x26bc72){_0x26bc72=_0x26bc72||0xcc;return function(_0x2d2678){if(_0x2d2678){return _0x2d4c7d[_0x7c98('0x12')](_0x26bc72);}return _0x2d4c7d['status'](_0x26bc72)[_0x7c98('0x13')]();};}function respondWithResult(_0x5e3f82,_0x409bb9){_0x409bb9=_0x409bb9||0xc8;return function(_0x33dba4){if(_0x33dba4){return _0x5e3f82['status'](_0x409bb9)[_0x7c98('0x14')](_0x33dba4);}};}function respondWithFilteredResult(_0x1d1890,_0x19e7c4){return function(_0x5a741b){if(_0x5a741b){var _0x2f3b1d=typeof _0x19e7c4[_0x7c98('0x15')]==='undefined'&&typeof _0x19e7c4[_0x7c98('0x16')]==='undefined';var _0x8222c3=_0x5a741b['count'];var _0x7aeb80=_0x2f3b1d?0x0:_0x19e7c4[_0x7c98('0x15')];var _0x5006b9=_0x2f3b1d?_0x5a741b[_0x7c98('0x17')]:_0x19e7c4[_0x7c98('0x15')]+_0x19e7c4[_0x7c98('0x16')];var _0x35b39b;if(_0x5006b9>=_0x8222c3){_0x5006b9=_0x8222c3;_0x35b39b=0xc8;}else{_0x35b39b=0xce;}_0x1d1890[_0x7c98('0x18')](_0x35b39b);return _0x1d1890[_0x7c98('0x19')]('Content-Range',_0x7aeb80+'-'+_0x5006b9+'/'+_0x8222c3)[_0x7c98('0x14')](_0x5a741b);}return null;};}function saveUpdates(_0x53c8fd){return function(_0x17d996){if(_0x17d996){return _0x17d996['update'](_0x53c8fd)[_0x7c98('0x1a')](function(_0x242b96){return _0x242b96;});}return null;};}function removeEntity(_0x17dce0){return function(_0x3985db){if(_0x3985db){return _0x3985db[_0x7c98('0x1b')]()[_0x7c98('0x1a')](function(){_0x17dce0[_0x7c98('0x18')](0xcc)[_0x7c98('0x13')]();});}};}function handleEntityNotFound(_0x280ae6){return function(_0x591a22){if(!_0x591a22){_0x280ae6[_0x7c98('0x12')](0x194);}return _0x591a22;};}function handleError(_0xde4e2b,_0x4766d3){_0x4766d3=_0x4766d3||0x1f4;return function(_0x38c6aa){logger['error'](_0x38c6aa[_0x7c98('0x1c')]);if(_0x38c6aa['name']){delete _0x38c6aa[_0x7c98('0x1d')];}_0xde4e2b[_0x7c98('0x18')](_0x4766d3)[_0x7c98('0x1e')](_0x38c6aa);};}exports['index']=function(_0x29b28d,_0xb90a6){var _0x3a1e54={};var _0xb9416e=_['map'](db['OpenchannelInteraction'][_0x7c98('0x1f')],function(_0x471359){return{'name':_0x471359[_0x7c98('0x20')],'type':_0x471359[_0x7c98('0x21')][_0x7c98('0x22')]};});_0x3a1e54=qs[_0x7c98('0x23')](_0xb9416e,_0x29b28d);return interaction[_0x7c98('0x24')](_0x7c98('0x25'),_0x29b28d[_0x7c98('0x26')],_0x29b28d[_0x7c98('0x27')],_0x3a1e54,_0xb9416e)[_0x7c98('0x1a')](respondWithFilteredResult(_0xb90a6,_0x3a1e54))[_0x7c98('0x28')](handleError(_0xb90a6,null));};exports['show']=function(_0x2008f6,_0x24201b){var _0x4331fa={};if(_0x2008f6[_0x7c98('0x26')]['type']&&_0x2008f6[_0x7c98('0x26')][_0x7c98('0x21')]===_0x7c98('0x29')){_0x4331fa[_0x7c98('0x29')]=_0x2008f6[_0x7c98('0x2a')]['id'];}else{_0x4331fa['id']=_0x2008f6[_0x7c98('0x2a')]['id'];}var _0x13ebf7={'raw':![],'where':_0x4331fa},_0x5c95a8={};_0x5c95a8['model']=_[_0x7c98('0x2b')](db['OpenchannelInteraction'][_0x7c98('0x1f')]);_0x5c95a8[_0x7c98('0x26')]=_['keys'](_0x2008f6[_0x7c98('0x26')]);_0x5c95a8[_0x7c98('0x2c')]=_['intersection'](_0x5c95a8['model'],_0x5c95a8[_0x7c98('0x26')]);_0x13ebf7['attributes']=_[_0x7c98('0x2d')](_0x5c95a8[_0x7c98('0x2e')],qs[_0x7c98('0x2f')](_0x2008f6[_0x7c98('0x26')][_0x7c98('0x2f')]));_0x13ebf7[_0x7c98('0x30')]=_0x13ebf7['attributes'][_0x7c98('0x31')]?_0x13ebf7[_0x7c98('0x30')]:_0x5c95a8[_0x7c98('0x2e')];if(_0x2008f6['query'][_0x7c98('0x32')]){_0x13ebf7[_0x7c98('0x33')]=[{'all':!![]}];}_0x13ebf7=_[_0x7c98('0x34')]({},_0x13ebf7,_0x2008f6['options']);return db[_0x7c98('0x35')]['find'](_0x13ebf7)[_0x7c98('0x1a')](handleEntityNotFound(_0x24201b,null))[_0x7c98('0x1a')](respondWithResult(_0x24201b,null))['catch'](handleError(_0x24201b,null));};exports['create']=function(_0x33f840,_0x447930){return db[_0x7c98('0x35')][_0x7c98('0x36')](_0x33f840[_0x7c98('0x37')],{})['then'](respondWithResult(_0x447930,0xc9))[_0x7c98('0x28')](handleError(_0x447930,null));};exports[_0x7c98('0x38')]=function(_0x15985e,_0x5e3b01){if(_0x15985e[_0x7c98('0x37')]['id']){delete _0x15985e[_0x7c98('0x37')]['id'];}return db[_0x7c98('0x35')][_0x7c98('0x39')]({'where':{'id':_0x15985e[_0x7c98('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5e3b01,null))[_0x7c98('0x1a')](saveUpdates(_0x15985e[_0x7c98('0x37')],null))[_0x7c98('0x1a')](respondWithResult(_0x5e3b01,null))[_0x7c98('0x28')](handleError(_0x5e3b01,null));};exports['destroy']=function(_0x1c8e45,_0x3924ca){return db['OpenchannelInteraction'][_0x7c98('0x39')]({'where':{'id':_0x1c8e45['params']['id']}})[_0x7c98('0x1a')](handleEntityNotFound(_0x3924ca,null))['then'](removeEntity(_0x3924ca,null))[_0x7c98('0x28')](handleError(_0x3924ca,null));};exports[_0x7c98('0x3a')]=function(_0x4859a7,_0x840df0){return db[_0x7c98('0x35')][_0x7c98('0x3a')]()[_0x7c98('0x1a')](respondWithResult(_0x840df0,null))[_0x7c98('0x28')](handleError(_0x840df0,null));};exports[_0x7c98('0x3b')]=function(_0x3c099b,_0x357188){return db[_0x7c98('0x3c')][_0x7c98('0x39')]({'where':{'id':_0x3c099b['params']['id']}})[_0x7c98('0x1a')](handleEntityNotFound(_0x357188,null))[_0x7c98('0x1a')](function(_0x4ad59e){if(_0x4ad59e){return _0x4ad59e[_0x7c98('0x3b')](_0x3c099b[_0x7c98('0x37')][_0x7c98('0x3d')],_[_0x7c98('0x3e')](_0x3c099b[_0x7c98('0x37')],['ids','id'])||{});}})[_0x7c98('0x1a')](respondWithResult(_0x357188,null))[_0x7c98('0x28')](handleError(_0x357188,null));};exports[_0x7c98('0x3f')]=function(_0x1a9469,_0x1c9648){var _0x1bbf4f={'raw':![],'where':{}};var _0x3e9794={};var _0x59c98b={'count':0x0,'rows':[]};return db[_0x7c98('0x35')][_0x7c98('0x40')]({'where':{'id':_0x1a9469[_0x7c98('0x2a')]['id']}})[_0x7c98('0x1a')](handleEntityNotFound(_0x1c9648,null))[_0x7c98('0x1a')](function(_0x3174d9){if(_0x3174d9){_0x3e9794[_0x7c98('0x2e')]=_['keys'](db[_0x7c98('0x3c')][_0x7c98('0x1f')]);_0x3e9794[_0x7c98('0x26')]=_[_0x7c98('0x2b')](_0x1a9469[_0x7c98('0x26')]);_0x3e9794[_0x7c98('0x2c')]=_['intersection'](_0x3e9794['model'],_0x3e9794['query']);_0x1bbf4f[_0x7c98('0x30')]=_['intersection'](_0x3e9794[_0x7c98('0x2e')],qs[_0x7c98('0x2f')](_0x1a9469[_0x7c98('0x26')][_0x7c98('0x2f')]));_0x1bbf4f[_0x7c98('0x30')]=_0x1bbf4f[_0x7c98('0x30')]['length']?_0x1bbf4f[_0x7c98('0x30')]:_0x3e9794['model'];if(!_0x1a9469[_0x7c98('0x26')]['hasOwnProperty'](_0x7c98('0x41'))){_0x1bbf4f[_0x7c98('0x16')]=qs['limit'](_0x1a9469['query']['limit']);_0x1bbf4f[_0x7c98('0x15')]=qs[_0x7c98('0x15')](_0x1a9469[_0x7c98('0x26')][_0x7c98('0x15')]);}_0x1bbf4f[_0x7c98('0x42')]=qs[_0x7c98('0x43')](_0x1a9469[_0x7c98('0x26')][_0x7c98('0x43')]);_0x1bbf4f[_0x7c98('0x44')]=qs['filters'](_[_0x7c98('0x45')](_0x1a9469[_0x7c98('0x26')],_0x3e9794['filters']));_0x1bbf4f[_0x7c98('0x44')][_0x7c98('0x46')]=_0x3174d9['id'];if(_0x1a9469[_0x7c98('0x26')]['filter']){_0x1bbf4f[_0x7c98('0x44')]=_[_0x7c98('0x34')](_0x1bbf4f[_0x7c98('0x44')],{'$or':_['map'](_0x1bbf4f[_0x7c98('0x30')],function(_0x388e1a){var _0x25d9a4={};_0x25d9a4[_0x388e1a]={'$like':'%'+_0x1a9469[_0x7c98('0x26')][_0x7c98('0x47')]+'%'};return _0x25d9a4;})});}if(_0x1a9469[_0x7c98('0x26')][_0x7c98('0x48')]){var _0x505c23=_0x1a9469[_0x7c98('0x26')][_0x7c98('0x48')]['split'](',');var _0x10d351={};_0x10d351[_0x505c23[0x0]]={'$gte':moment(_0x505c23[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x1bbf4f[_0x7c98('0x44')]=_[_0x7c98('0x34')](_0x1bbf4f[_0x7c98('0x44')],_0x10d351);}_0x1bbf4f=_[_0x7c98('0x34')]({},_0x1bbf4f,_0x1a9469[_0x7c98('0x49')]);return db[_0x7c98('0x3c')][_0x7c98('0x17')]({'where':_0x1bbf4f['where']})[_0x7c98('0x1a')](function(_0x389e32){_0x59c98b[_0x7c98('0x17')]=_0x389e32;if(_0x1a9469[_0x7c98('0x26')][_0x7c98('0x32')]){_0x1bbf4f[_0x7c98('0x33')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x7c98('0x24')](_0x1bbf4f);})['then'](function(_0x24a3dd){_0x59c98b[_0x7c98('0x4a')]=_0x24a3dd;return _0x59c98b;});}})[_0x7c98('0x1a')](respondWithFilteredResult(_0x1c9648,_0x1bbf4f))['catch'](handleError(_0x1c9648,null));};exports['addTags']=function(_0x4b8ec3,_0x2c17f3){return db['OpenchannelInteraction']['find']({'where':{'id':_0x4b8ec3[_0x7c98('0x2a')]['id']}})['then'](handleEntityNotFound(_0x2c17f3,null))[_0x7c98('0x1a')](function(_0x2add3f){if(_0x2add3f){return _0x2add3f['setTags'](_0x4b8ec3['body'][_0x7c98('0x3d')],_[_0x7c98('0x3e')](_0x4b8ec3[_0x7c98('0x37')],[_0x7c98('0x3d'),'id'])||{})[_0x7c98('0x4b')](function(){return db[_0x7c98('0x4c')][_0x7c98('0x24')]({'attributes':['id',_0x7c98('0x1d'),_0x7c98('0x4d')],'where':{'id':_0x4b8ec3[_0x7c98('0x37')]['ids']}});})['then'](function(_0x3a3d39){socket[_0x7c98('0x4e')](_0x7c98('0x4f'),{'id':Number(_0x4b8ec3[_0x7c98('0x2a')]['id']),'tags':_0x3a3d39||[]});return{'id':Number(_0x4b8ec3[_0x7c98('0x2a')]['id']),'tags':_0x3a3d39||[]};});}})[_0x7c98('0x1a')](respondWithResult(_0x2c17f3,null))[_0x7c98('0x28')](handleError(_0x2c17f3,null));};exports['removeTags']=function(_0x25e1d9,_0x1d4260){return db['OpenchannelInteraction'][_0x7c98('0x39')]({'where':{'id':_0x25e1d9[_0x7c98('0x2a')]['id']}})['then'](handleEntityNotFound(_0x1d4260,null))['then'](function(_0x14ab72){if(_0x14ab72){return _0x14ab72['removeTags'](_0x25e1d9['query'][_0x7c98('0x3d')]);}})[_0x7c98('0x1a')](respondWithStatusCode(_0x1d4260,null))[_0x7c98('0x28')](handleError(_0x1d4260,null));};exports[_0x7c98('0x50')]=function(_0x5a4470,_0x4a064a){var _0x436760=moment()[_0x7c98('0x51')]()[_0x7c98('0x52')]();var _0x2e889e=path[_0x7c98('0x53')](config[_0x7c98('0x54')],_0x7c98('0x55'),_0x7c98('0x56'),_0x7c98('0x57'));var _0x1311d9=path[_0x7c98('0x53')](config[_0x7c98('0x54')],_0x7c98('0x55'),'files',_0x7c98('0x58'));var _0x593c9f=path[_0x7c98('0x53')](_0x2e889e,_0x436760);var _0x2e71b8=util[_0x7c98('0x59')](_0x7c98('0x5a'),_0x5a4470[_0x7c98('0x2a')]['id'],_0x436760);var _0x1238aa=path[_0x7c98('0x53')](_0x2e889e,_0x2e71b8);var _0x57df56=[];_0x57df56[_0x7c98('0x5b')]({'model':db[_0x7c98('0x5c')],'as':_0x7c98('0x5c'),'attributes':['id',_0x7c98('0x5d')],'raw':!![]});_0x57df56[_0x7c98('0x5b')]({'model':db[_0x7c98('0x5e')],'as':_0x7c98('0x5f'),'attributes':['id','firstName',_0x7c98('0x60')],'raw':!![]});if(_0x5a4470[_0x7c98('0x26')][_0x7c98('0x58')]){_0x57df56[_0x7c98('0x5b')]({'model':db[_0x7c98('0x61')],'as':'Attachment','raw':!![]});}var _0x2015c0=[{'model':db[_0x7c98('0x3c')],'as':_0x7c98('0x62'),'attributes':['id',_0x7c98('0x37'),'createdAt',_0x7c98('0x63'),_0x7c98('0x64'),_0x7c98('0x65')],'include':_0x57df56}];_0x2015c0[_0x7c98('0x5b')]({'model':db[_0x7c98('0x66')],'as':_0x7c98('0x67'),'attributes':['id',_0x7c98('0x1d')]});_0x2015c0['push']({'model':db[_0x7c98('0x5c')],'as':_0x7c98('0x68'),'attributes':['id',_0x7c98('0x5d')]});return db[_0x7c98('0x35')]['find']({'where':{'id':_0x5a4470[_0x7c98('0x2a')]['id']},'include':_0x2015c0})[_0x7c98('0x1a')](handleEntityNotFound(_0x4a064a,null))[_0x7c98('0x1a')](function(_0x56b3b1){if(_0x56b3b1){var _0x491233=_0x56b3b1[_0x7c98('0x69')]({'plain':!![]});fs['mkdirSync'](_0x593c9f);var _0x27e985={'channel':_0x7c98('0x6a'),'account':_0x491233[_0x7c98('0x67')][_0x7c98('0x1d')],'agent':_0x491233[_0x7c98('0x68')]?_0x491233['Owner']['fullname']:_0x7c98('0x6b'),'createdAt':moment(_0x491233['createdAt'])[_0x7c98('0x59')](_0x7c98('0x6c'))[_0x7c98('0x52')](),'closedAt':_0x491233[_0x7c98('0x6d')]?moment(_0x491233[_0x7c98('0x6e')])[_0x7c98('0x59')](_0x7c98('0x6c'))[_0x7c98('0x52')]():'','disposition':_0x491233[_0x7c98('0x6f')],'visibility':_0x491233['threadId']?_0x7c98('0x70'):_0x7c98('0x71'),'messages':_(_0x491233[_0x7c98('0x62')])['filter']({'secret':![]})[_0x7c98('0x72')](function(_0x46fd1a){if(_0x46fd1a['Attachment']){var _0x25aac9=path[_0x7c98('0x53')](_0x1311d9,_0x46fd1a[_0x7c98('0x61')][_0x7c98('0x73')]);if(fs['existsSync'](_0x25aac9)){fs['createReadStream'](_0x25aac9)[_0x7c98('0x74')](fs['createWriteStream'](path[_0x7c98('0x53')](_0x593c9f,_0x46fd1a[_0x7c98('0x61')][_0x7c98('0x73')])));}}return{'date':moment(_0x46fd1a['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x7c98('0x52')](),'sender':_0x46fd1a[_0x7c98('0x63')]===_0x7c98('0x75')?_0x46fd1a['User']?_0x46fd1a[_0x7c98('0x5c')][_0x7c98('0x5d')]:'System':_0x46fd1a['Contact'][_0x7c98('0x76')]+(_0x46fd1a['Contact'][_0x7c98('0x60')]?'\x20'+_0x46fd1a[_0x7c98('0x5f')]['lastName']:''),'body':_0x46fd1a[_0x7c98('0x61')]?_0x46fd1a[_0x7c98('0x61')][_0x7c98('0x73')]:_0x46fd1a[_0x7c98('0x37')],'direction':_0x46fd1a[_0x7c98('0x63')]===_0x7c98('0x75')?'A':'C','secret':_0x46fd1a[_0x7c98('0x64')],'read':_0x46fd1a[_0x7c98('0x65')],'attachment':_0x46fd1a[_0x7c98('0x61')]};})['value']()};return ejs[_0x7c98('0x77')](path[_0x7c98('0x53')](config[_0x7c98('0x54')],_0x7c98('0x55'),_0x7c98('0x78'),'downloadInteraction.ejs'),{'interaction':_0x27e985})[_0x7c98('0x1a')](function(_0x3da7b6){var _0x31ce1e=path['join'](_0x593c9f,'transcript-'+_0x491233['id']+'-'+_0x436760+'.pdf');var _0x5b5fbf={'path':_0x31ce1e,'channel':_0x7c98('0x6a'),'interactionId':_0x491233['id']};return pdf[_0x7c98('0x79')](_0x3da7b6,_0x5b5fbf);})['then'](function(){return new Promise(function(_0x6a7279,_0x5ac702){zipdir(_0x593c9f,{'saveTo':_0x1238aa},function(_0x45e46a,_0x1afef6){if(_0x45e46a)return _0x5ac702(_0x45e46a);return _0x6a7279(_0x1afef6);});})[_0x7c98('0x1a')](function(){return new Promise(function(_0x2d12af,_0x535bcc){rimraf(_0x593c9f,function(_0x3c35fc){if(_0x3c35fc)_0x535bcc(_0x3c35fc);return _0x2d12af();});});})[_0x7c98('0x1a')](function(){return _0x4a064a['download'](_0x1238aa,_0x2e71b8,function(_0x5ae2ca){if(_0x5ae2ca){logger[_0x7c98('0x7a')]('Unable\x20to\x20delete\x20zip\x20file',_0x5ae2ca);}else{fs[_0x7c98('0x7b')](_0x1238aa);}});});});}else{return _0x4a064a[_0x7c98('0x12')](0xc8);}})[_0x7c98('0x28')](handleError(_0x4a064a,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index af1d271..2b376ae 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 _0xa625=['../../mysqldb','OpenchannelMessage','update','then','setDataValue','Users','map','findAll','unreadMessages','length','catch','hasOwnProperty','hook','exports','events'];(function(_0x23a79e,_0x235f89){var _0x3dab57=function(_0x346cf4){while(--_0x346cf4){_0x23a79e['push'](_0x23a79e['shift']());}};_0x3dab57(++_0x235f89);}(_0xa625,0x68));var _0x5a62=function(_0x376db5,_0x2b8874){_0x376db5=_0x376db5-0x0;var _0x304c17=_0xa625[_0x376db5];return _0x304c17;};'use strict';var EventEmitter=require(_0x5a62('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x5a62('0x1'))['db'][_0x5a62('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5a62('0x3'),'afterDestroy':'remove'};function emitEvent(_0x931a64){return function(_0x5d51da,_0x23c1f8,_0x10a464){_0x5d51da['getUsers']({'attributes':['id'],'raw':!![]})[_0x5a62('0x4')](function(_0x39170b){_0x5d51da[_0x5a62('0x5')](_0x5a62('0x6'),_0x39170b[_0x5a62('0x7')](function(_0x4841d7){return{'id':_0x4841d7['id']};}));return OpenchannelMessage[_0x5a62('0x8')]({'where':{'OpenchannelInteractionId':_0x5d51da['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5a62('0x4')](function(_0x1377ff){_0x5d51da['setDataValue'](_0x5a62('0x9'),_0x1377ff[_0x5a62('0xa')]);OpenchannelInteractionEvents['emit'](_0x931a64+':'+_0x5d51da['id'],_0x5d51da);OpenchannelInteractionEvents['emit'](_0x931a64,_0x5d51da);_0x10a464(null);})[_0x5a62('0xb')](_0x10a464(null));};}for(var e in events){if(events[_0x5a62('0xc')](e)){var event=events[e];OpenchannelInteraction[_0x5a62('0xd')](e,emitEvent(event));}}module[_0x5a62('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x82a8=['exports','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','update','remove','setDataValue','unreadMessages','length','emit','hasOwnProperty','hook'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x82a8,0xc4));var _0x882a=function(_0x298950,_0xc9838){_0x298950=_0x298950-0x0;var _0x304e0d=_0x82a8[_0x298950];return _0x304e0d;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x882a('0x0'))['db'][_0x882a('0x1')];var OpenchannelMessage=require('../../mysqldb')['db'][_0x882a('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x882a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x882a('0x4'),'afterDestroy':_0x882a('0x5')};function emitEvent(_0x2ead22){return function(_0xb6861d,_0x53e531,_0x51738d){_0xb6861d['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x82aa26){_0xb6861d[_0x882a('0x6')]('Users',_0x82aa26['map'](function(_0xff7002){return{'id':_0xff7002['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0xb6861d['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x1a03df){_0xb6861d['setDataValue'](_0x882a('0x7'),_0x1a03df[_0x882a('0x8')]);OpenchannelInteractionEvents[_0x882a('0x9')](_0x2ead22+':'+_0xb6861d['id'],_0xb6861d);OpenchannelInteractionEvents[_0x882a('0x9')](_0x2ead22,_0xb6861d);_0x51738d(null);})['catch'](_0x51738d(null));};}for(var e in events){if(events[_0x882a('0xa')](e)){var event=events[e];OpenchannelInteraction[_0x882a('0xb')](e,emitEvent(event));}}module[_0x882a('0xc')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 9a8061b..c0af484 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 _0xb540=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','openchannel_interactions','utf8mb4_unicode_ci','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x2bff,_0x238149){var _0xc95b01=function(_0x454c76){while(--_0x454c76){_0x2bff['push'](_0x2bff['shift']());}};_0xc95b01(++_0x238149);}(_0xb540,0x179));var _0x0b54=function(_0xf023b9,_0x5b79e1){_0xf023b9=_0xf023b9-0x0;var _0x201900=_0xb540[_0xf023b9];return _0x201900;};'use strict';var _=require(_0x0b54('0x0'));var util=require(_0x0b54('0x1'));var logger=require(_0x0b54('0x2'))(_0x0b54('0x3'));var moment=require(_0x0b54('0x4'));var BPromise=require(_0x0b54('0x5'));var rp=require(_0x0b54('0x6'));var fs=require('fs');var path=require(_0x0b54('0x7'));var rimraf=require(_0x0b54('0x8'));var config=require(_0x0b54('0x9'));var attributes=require(_0x0b54('0xa'));module[_0x0b54('0xb')]=function(_0x4e3204,_0x5b0d4b){return _0x4e3204['define']('OpenchannelInteraction',attributes,{'tableName':_0x0b54('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0b54('0xd'),'hooks':{'beforeUpdate':function(_0x10453b,_0x1284bb,_0x3619da){if(_0x10453b[_0x0b54('0xe')](_0x0b54('0xf'))){_0x10453b[_0x0b54('0x10')]=moment()['format'](_0x0b54('0x11'));}_0x3619da(null,_0x10453b);}}});}; \ No newline at end of file +var _0x1e33=['./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3c606f,_0x250f60){var _0x3ab92a=function(_0x2aada7){while(--_0x2aada7){_0x3c606f['push'](_0x3c606f['shift']());}};_0x3ab92a(++_0x250f60);}(_0x1e33,0x13d));var _0x31e3=function(_0xbf64ae,_0x54f83b){_0xbf64ae=_0xbf64ae-0x0;var _0x2ed262=_0x1e33[_0xbf64ae];return _0x2ed262;};'use strict';var _=require('lodash');var util=require(_0x31e3('0x0'));var logger=require('../../config/logger')(_0x31e3('0x1'));var moment=require(_0x31e3('0x2'));var BPromise=require(_0x31e3('0x3'));var rp=require(_0x31e3('0x4'));var fs=require('fs');var path=require(_0x31e3('0x5'));var rimraf=require(_0x31e3('0x6'));var config=require('../../config/environment');var attributes=require(_0x31e3('0x7'));module[_0x31e3('0x8')]=function(_0x500d96,_0x92d309){return _0x500d96[_0x31e3('0x9')](_0x31e3('0xa'),attributes,{'tableName':_0x31e3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x31e3('0xc'),'hooks':{'beforeUpdate':function(_0x1793a1,_0x32a5fe,_0x470a1b){if(_0x1793a1[_0x31e3('0xd')](_0x31e3('0xe'))){_0x1793a1[_0x31e3('0xf')]=moment()[_0x31e3('0x10')](_0x31e3('0x11'));}_0x470a1b(null,_0x1793a1);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 6ede063..1486023 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 _0xd3d2=['defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','attributes','limit','then','info','stringify','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','spread','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http'];(function(_0x2d0a2c,_0x2e4ef8){var _0xda6457=function(_0xbd2a3b){while(--_0xbd2a3b){_0x2d0a2c['push'](_0x2d0a2c['shift']());}};_0xda6457(++_0x2e4ef8);}(_0xd3d2,0x1ba));var _0x2d3d=function(_0xd38e0e,_0x1f5c9f){_0xd38e0e=_0xd38e0e-0x0;var _0x45941f=_0xd3d2[_0xd38e0e];return _0x45941f;};'use strict';var _=require('lodash');var util=require(_0x2d3d('0x0'));var moment=require('moment');var BPromise=require(_0x2d3d('0x1'));var rs=require(_0x2d3d('0x2'));var fs=require('fs');var Redis=require(_0x2d3d('0x3'));var db=require(_0x2d3d('0x4'))['db'];var utils=require(_0x2d3d('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x2d3d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2d3d('0x7')][_0x2d3d('0x8')]({'port':0x232a});config['redis']=_[_0x2d3d('0x9')](config[_0x2d3d('0xa')],{'host':_0x2d3d('0xb'),'port':0x18eb});var socket=require(_0x2d3d('0xc'))(new Redis(config[_0x2d3d('0xa')]));require(_0x2d3d('0xd'))[_0x2d3d('0xe')](socket);function respondWithRpcPromise(_0x447615,_0x39decb,_0x35c3c0){return new BPromise(function(_0x4091db,_0x2c18d5){return client['request'](_0x447615,_0x35c3c0)['then'](function(_0xd3f445){logger['info'](_0x2d3d('0xf'),_0x39decb,_0x2d3d('0x10'));logger[_0x2d3d('0x11')](_0x2d3d('0x12'),_0x39decb,_0x2d3d('0x10'),JSON['stringify'](_0xd3f445));if(_0xd3f445[_0x2d3d('0x13')]){if(_0xd3f445[_0x2d3d('0x13')]['code']===0x1f4){logger[_0x2d3d('0x13')](_0x2d3d('0xf'),_0x39decb,_0xd3f445[_0x2d3d('0x13')]['message']);return _0x2c18d5(_0xd3f445[_0x2d3d('0x13')]['message']);}logger[_0x2d3d('0x13')](_0x2d3d('0xf'),_0x39decb,_0xd3f445[_0x2d3d('0x13')][_0x2d3d('0x14')]);return _0x4091db(_0xd3f445[_0x2d3d('0x13')][_0x2d3d('0x14')]);}else{logger['info'](_0x2d3d('0xf'),_0x39decb,_0x2d3d('0x10'));_0x4091db(_0xd3f445[_0x2d3d('0x15')][_0x2d3d('0x14')]);}})[_0x2d3d('0x16')](function(_0x25da1b){logger[_0x2d3d('0x13')](_0x2d3d('0xf'),_0x39decb,_0x25da1b);_0x2c18d5(_0x25da1b);});});}exports[_0x2d3d('0x17')]=function(_0x392295){var _0x20bbba=this;return new Promise(function(_0x1454f6,_0x3e01fd){return db[_0x2d3d('0x18')][_0x2d3d('0x19')](_0x392295[_0x2d3d('0x1a')],{'raw':_0x392295[_0x2d3d('0x1b')]?_0x392295['options'][_0x2d3d('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x392295[_0x2d3d('0x1b')]?_0x392295[_0x2d3d('0x1b')][_0x2d3d('0x1d')]||null:null,'attributes':_0x392295[_0x2d3d('0x1b')]?_0x392295[_0x2d3d('0x1b')][_0x2d3d('0x1e')]||null:null,'limit':_0x392295[_0x2d3d('0x1b')]?_0x392295[_0x2d3d('0x1b')][_0x2d3d('0x1f')]||null:null})[_0x2d3d('0x20')](function(_0x23b3d8){logger[_0x2d3d('0x21')](_0x2d3d('0x17'),_0x392295);logger['debug']('UpdateOpenchannelInteraction',_0x392295,JSON[_0x2d3d('0x22')](_0x23b3d8));_0x1454f6(_0x23b3d8);})[_0x2d3d('0x16')](function(_0x110e19){logger[_0x2d3d('0x13')]('UpdateOpenchannelInteraction',_0x110e19['message'],_0x392295);_0x3e01fd(_0x20bbba['error'](0x1f4,_0x110e19['message']));});});};exports[_0x2d3d('0x23')]=function(_0x208d41){return new Promise(function(_0xdb9508,_0x4cd932){return db[_0x2d3d('0x18')][_0x2d3d('0x24')]({'where':_0x208d41[_0x2d3d('0x1b')]?_0x208d41[_0x2d3d('0x1b')][_0x2d3d('0x1d')]||null:null})[_0x2d3d('0x20')](function(_0x34d9d3){if(_0x34d9d3){return _0x34d9d3[_0x2d3d('0x25')](_0x208d41[_0x2d3d('0x1a')][_0x2d3d('0x26')],_[_0x2d3d('0x27')](_0x208d41[_0x2d3d('0x1a')],[_0x2d3d('0x26'),'id'])||{});}})[_0x2d3d('0x28')](function(_0x56eb23){logger[_0x2d3d('0x21')]('AddTags',_0x208d41);logger['debug']('AddTags',_0x208d41,JSON[_0x2d3d('0x22')](_0x56eb23));_0xdb9508(_0x56eb23);})[_0x2d3d('0x16')](function(_0x48492b){logger[_0x2d3d('0x13')]('AddTags',_0x48492b[_0x2d3d('0x14')],_0x208d41);_0x4cd932(_this[_0x2d3d('0x13')](0x1f4,_0x48492b[_0x2d3d('0x14')]));});});}; \ No newline at end of file +var _0xccf1=['addTags','ids','omit','spread','AddTags','util','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','./openchannelInteraction.socket','request','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','UpdateOpenchannelInteraction','update','body','options','raw','attributes','limit','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','where','then'];(function(_0xa9dc5f,_0x1fd9e7){var _0x41c443=function(_0x1d5258){while(--_0x1d5258){_0xa9dc5f['push'](_0xa9dc5f['shift']());}};_0x41c443(++_0x1fd9e7);}(_0xccf1,0x19f));var _0x1ccf=function(_0x1db5d7,_0x57d383){_0x1db5d7=_0x1db5d7-0x0;var _0x2cb6d8=_0xccf1[_0x1db5d7];return _0x2cb6d8;};'use strict';var _=require('lodash');var util=require(_0x1ccf('0x0'));var moment=require('moment');var BPromise=require(_0x1ccf('0x1'));var rs=require(_0x1ccf('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1ccf('0x3'));var logger=require(_0x1ccf('0x4'))('rpc');var config=require(_0x1ccf('0x5'));var jayson=require(_0x1ccf('0x6'));var client=jayson['client'][_0x1ccf('0x7')]({'port':0x232a});config[_0x1ccf('0x8')]=_[_0x1ccf('0x9')](config[_0x1ccf('0x8')],{'host':_0x1ccf('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1ccf('0x8')]));require(_0x1ccf('0xb'))['register'](socket);function respondWithRpcPromise(_0x549bda,_0x419ae0,_0x4d6b25){return new BPromise(function(_0x55b909,_0x50055d){return client[_0x1ccf('0xc')](_0x549bda,_0x4d6b25)['then'](function(_0x1dfd4e){logger[_0x1ccf('0xd')](_0x1ccf('0xe'),_0x419ae0,_0x1ccf('0xf'));logger[_0x1ccf('0x10')](_0x1ccf('0x11'),_0x419ae0,'request\x20sent',JSON[_0x1ccf('0x12')](_0x1dfd4e));if(_0x1dfd4e['error']){if(_0x1dfd4e['error'][_0x1ccf('0x13')]===0x1f4){logger[_0x1ccf('0x14')](_0x1ccf('0xe'),_0x419ae0,_0x1dfd4e[_0x1ccf('0x14')][_0x1ccf('0x15')]);return _0x50055d(_0x1dfd4e[_0x1ccf('0x14')][_0x1ccf('0x15')]);}logger[_0x1ccf('0x14')](_0x1ccf('0xe'),_0x419ae0,_0x1dfd4e['error'][_0x1ccf('0x15')]);return _0x55b909(_0x1dfd4e[_0x1ccf('0x14')][_0x1ccf('0x15')]);}else{logger[_0x1ccf('0xd')]('OpenchannelInteraction,\x20%s,\x20%s',_0x419ae0,_0x1ccf('0xf'));_0x55b909(_0x1dfd4e[_0x1ccf('0x16')][_0x1ccf('0x15')]);}})[_0x1ccf('0x17')](function(_0x35fce6){logger[_0x1ccf('0x14')](_0x1ccf('0xe'),_0x419ae0,_0x35fce6);_0x50055d(_0x35fce6);});});}exports[_0x1ccf('0x18')]=function(_0x5db9a2){var _0x4d22a6=this;return new Promise(function(_0x5f1b69,_0x460f70){return db['OpenchannelInteraction'][_0x1ccf('0x19')](_0x5db9a2[_0x1ccf('0x1a')],{'raw':_0x5db9a2['options']?_0x5db9a2[_0x1ccf('0x1b')][_0x1ccf('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5db9a2[_0x1ccf('0x1b')]?_0x5db9a2[_0x1ccf('0x1b')]['where']||null:null,'attributes':_0x5db9a2[_0x1ccf('0x1b')]?_0x5db9a2[_0x1ccf('0x1b')][_0x1ccf('0x1d')]||null:null,'limit':_0x5db9a2[_0x1ccf('0x1b')]?_0x5db9a2['options'][_0x1ccf('0x1e')]||null:null})['then'](function(_0x38bdb9){logger['info'](_0x1ccf('0x18'),_0x5db9a2);logger[_0x1ccf('0x10')](_0x1ccf('0x18'),_0x5db9a2,JSON[_0x1ccf('0x12')](_0x38bdb9));_0x5f1b69(_0x38bdb9);})[_0x1ccf('0x17')](function(_0x51e2ce){logger[_0x1ccf('0x14')](_0x1ccf('0x18'),_0x51e2ce[_0x1ccf('0x15')],_0x5db9a2);_0x460f70(_0x4d22a6[_0x1ccf('0x14')](0x1f4,_0x51e2ce[_0x1ccf('0x15')]));});});};exports[_0x1ccf('0x1f')]=function(_0x1b9661){return new Promise(function(_0x111a94,_0x70d7cf){return db[_0x1ccf('0x20')][_0x1ccf('0x21')]({'where':_0x1b9661[_0x1ccf('0x1b')]?_0x1b9661['options'][_0x1ccf('0x22')]||null:null})[_0x1ccf('0x23')](function(_0x46492a){if(_0x46492a){return _0x46492a[_0x1ccf('0x24')](_0x1b9661['body'][_0x1ccf('0x25')],_[_0x1ccf('0x26')](_0x1b9661['body'],[_0x1ccf('0x25'),'id'])||{});}})[_0x1ccf('0x27')](function(_0x4102c2){logger[_0x1ccf('0xd')](_0x1ccf('0x28'),_0x1b9661);logger['debug'](_0x1ccf('0x28'),_0x1b9661,JSON[_0x1ccf('0x12')](_0x4102c2));_0x111a94(_0x4102c2);})[_0x1ccf('0x17')](function(_0x5c32cd){logger[_0x1ccf('0x14')](_0x1ccf('0x28'),_0x5c32cd[_0x1ccf('0x15')],_0x1b9661);_0x70d7cf(_this['error'](0x1f4,_0x5c32cd['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index fbd9926..de3c70d 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 _0x1643=['update','emit','removeListener','register','length','openchannelInteraction:','save'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x1643,0xb5));var _0x3164=function(_0x452133,_0x18e434){_0x452133=_0x452133-0x0;var _0x1d892e=_0x1643[_0x452133];return _0x1d892e;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x3164('0x0'),'remove',_0x3164('0x1')];function createListener(_0x2bcb30,_0x4869e0){return function(_0x4c2df7){_0x4869e0[_0x3164('0x2')](_0x2bcb30,_0x4c2df7);};}function removeListener(_0x32e949,_0x25ff33){return function(){OpenchannelInteractionEvents[_0x3164('0x3')](_0x32e949,_0x25ff33);};}exports[_0x3164('0x4')]=function(_0x3d6e73){for(var _0x1e2fd2=0x0,_0xf4edbb=events[_0x3164('0x5')];_0x1e2fd2<_0xf4edbb;_0x1e2fd2++){var _0x50f1ee=events[_0x1e2fd2];var _0x1e860f=createListener(_0x3164('0x6')+_0x50f1ee,_0x3d6e73);OpenchannelInteractionEvents['on'](_0x50f1ee,_0x1e860f);}}; \ No newline at end of file +var _0x6064=['update','emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','save'];(function(_0xc3a044,_0xcc0178){var _0x25281b=function(_0x5819dc){while(--_0x5819dc){_0xc3a044['push'](_0xc3a044['shift']());}};_0x25281b(++_0xcc0178);}(_0x6064,0x1c6));var _0x4606=function(_0x275e22,_0x7ccfcc){_0x275e22=_0x275e22-0x0;var _0x1930a4=_0x6064[_0x275e22];return _0x1930a4;};'use strict';var OpenchannelInteractionEvents=require(_0x4606('0x0'));var events=[_0x4606('0x1'),'remove',_0x4606('0x2')];function createListener(_0x4bd6f8,_0x201e2a){return function(_0x3596e5){_0x201e2a[_0x4606('0x3')](_0x4bd6f8,_0x3596e5);};}function removeListener(_0x24fc50,_0xdf359d){return function(){OpenchannelInteractionEvents[_0x4606('0x4')](_0x24fc50,_0xdf359d);};}exports[_0x4606('0x5')]=function(_0x5d8575){for(var _0x3f9867=0x0,_0x2d53dd=events[_0x4606('0x6')];_0x3f9867<_0x2d53dd;_0x3f9867++){var _0x29d7ab=events[_0x3f9867];var _0x471180=createListener(_0x4606('0x7')+_0x29d7ab,_0x5d8575);OpenchannelInteractionEvents['on'](_0x29d7ab,_0x471180);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 3aa915a..4bc5574 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 _0x9c44=['index','get','/describe','/:id','show','tracked','openchannel','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelMessage.controller','isAuthenticated'];(function(_0x151935,_0x58df29){var _0x3c8f56=function(_0x31e2f6){while(--_0x31e2f6){_0x151935['push'](_0x151935['shift']());}};_0x3c8f56(++_0x58df29);}(_0x9c44,0x178));var _0x49c4=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x9c44[_0x45d55e];return _0x29812a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x49c4('0xd')](_0x49c4('0xe'),'openchannelmessage:create'),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0x11')]);router[_0x49c4('0x10')]('/:id/accept',auth[_0x49c4('0x7')](),controller[_0x49c4('0x12')]);router['put'](_0x49c4('0x13'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);router[_0x49c4('0x15')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x16')]);module[_0x49c4('0x17')]=router; \ No newline at end of file +var _0x0713=['get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','openchannelmessage:create','put','update','accept','/:id/reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelMessage.controller'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0xe')]('/',auth[_0x3071('0x9')](),interaction[_0x3071('0xf')](_0x3071('0x10'),_0x3071('0x11')),controller['create']);router[_0x3071('0x12')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x13')]);router[_0x3071('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0x3071('0x14')]);router['put'](_0x3071('0x15'),auth[_0x3071('0x9')](),controller['reject']);router[_0x3071('0x16')]('/:id',auth[_0x3071('0x9')](),controller[_0x3071('0x17')]);module[_0x3071('0x18')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 291a198..5cff7a7 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 _0x6ea9=['STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x5dd036,_0x3109a6){var _0x6b2816=function(_0x18cc49){while(--_0x18cc49){_0x5dd036['push'](_0x5dd036['shift']());}};_0x6b2816(++_0x3109a6);}(_0x6ea9,0x89));var _0x96ea=function(_0x417950,_0x264f24){_0x417950=_0x417950-0x0;var _0x20ffa9=_0x6ea9[_0x417950];return _0x20ffa9;};'use strict';var Sequelize=require(_0x96ea('0x0'));module[_0x96ea('0x1')]={'body':{'type':Sequelize[_0x96ea('0x2')](_0x96ea('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x96ea('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x96ea('0x5')]('in',_0x96ea('0x6')),'defaultValue':_0x96ea('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x96ea('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x4c71=['STRING','TEXT','sequelize','exports','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x2e7e7e,_0x342afb){var _0x1a9541=function(_0x26e065){while(--_0x26e065){_0x2e7e7e['push'](_0x2e7e7e['shift']());}};_0x1a9541(++_0x342afb);}(_0x4c71,0x12b));var _0x14c7=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x4c71[_0x4ff09b];return _0x3f5c2e;};'use strict';var Sequelize=require(_0x14c7('0x0'));module[_0x14c7('0x1')]={'body':{'type':Sequelize['TEXT'](_0x14c7('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x14c7('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x14c7('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x14c7('0x4')]('in',_0x14c7('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x14c7('0x6')]},'providerName':{'type':Sequelize[_0x14c7('0x7')]},'providerResponse':{'type':Sequelize[_0x14c7('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index b84dfed..d1dc427 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 _0x3b4e=['request\x20sent','debug','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','status','json','offset','undefined','Content-Range','reject','update','end','sendStatus','stack','name','send','index','OpenchannelMessage','rawAttributes','type','model','map','keys','query','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','merge','options','find','create','body','describe','openchannel-interactions','openchannel','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','OpenchannelInteraction','isNil','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','agent','fullname','email','manual','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','OpenchannelInteractionId','RejectMessage','rejectMessage','contact','internal','rejectmessage','rimraf','zip-dir','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./openchannelMessage.socket','jayson/promise','client','http','request','then','info'];(function(_0xb46f05,_0x2012de){var _0x4e4766=function(_0x29f11){while(--_0x29f11){_0xb46f05['push'](_0xb46f05['shift']());}};_0x4e4766(++_0x2012de);}(_0x3b4e,0x15a));var _0xe3b4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3b4e[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe3b4('0x0'));var zipdir=require(_0xe3b4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe3b4('0x2'));var Mustache=require(_0xe3b4('0x3'));var util=require(_0xe3b4('0x4'));var path=require(_0xe3b4('0x5'));var sox=require('sox');var csv=require(_0xe3b4('0x6'));var ejs=require(_0xe3b4('0x7'));var fs=require('fs');var fs_extra=require(_0xe3b4('0x8'));var _=require(_0xe3b4('0x9'));var squel=require(_0xe3b4('0xa'));var crypto=require(_0xe3b4('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe3b4('0x6'));var querystring=require('querystring');var Papa=require(_0xe3b4('0xc'));var Redis=require(_0xe3b4('0xd'));var authService=require(_0xe3b4('0xe'));var qs=require(_0xe3b4('0xf'));var as=require(_0xe3b4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe3b4('0x11'))(_0xe3b4('0x12'));var utils=require('../../config/utils');var config=require(_0xe3b4('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xe3b4('0x14'))['db'];config['redis']=_[_0xe3b4('0x15')](config['redis'],{'host':_0xe3b4('0x16'),'port':0x18eb});var socket=require(_0xe3b4('0x17'))(new Redis(config[_0xe3b4('0x18')]));require(_0xe3b4('0x19'))['register'](socket);var jayson=require(_0xe3b4('0x1a'));var client=jayson[_0xe3b4('0x1b')][_0xe3b4('0x1c')]({'port':0x232c});var client9002=jayson[_0xe3b4('0x1b')][_0xe3b4('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x185c47,_0x1341a9,_0x574dcb,_0x317296){return new BPromise(function(_0x4d9db8,_0x2280c5){var _0x9758ae=_0x317296||client;return _0x9758ae[_0xe3b4('0x1d')](_0x185c47,_0x574dcb)[_0xe3b4('0x1e')](function(_0x570f60){logger[_0xe3b4('0x1f')]('OpenchannelMessage,\x20%s,\x20%s',_0x1341a9,_0xe3b4('0x20'));logger[_0xe3b4('0x21')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x1341a9,_0xe3b4('0x20'),JSON[_0xe3b4('0x22')](_0x570f60));if(_0x570f60['error']){if(_0x570f60[_0xe3b4('0x23')][_0xe3b4('0x24')]===0x1f4){logger[_0xe3b4('0x23')](_0xe3b4('0x25'),_0x1341a9,_0x570f60[_0xe3b4('0x23')][_0xe3b4('0x26')]);return _0x2280c5(_0x570f60[_0xe3b4('0x23')][_0xe3b4('0x26')]);}logger['error'](_0xe3b4('0x25'),_0x1341a9,_0x570f60[_0xe3b4('0x23')][_0xe3b4('0x26')]);return _0x4d9db8(_0x570f60[_0xe3b4('0x23')]['message']);}else{logger[_0xe3b4('0x1f')]('OpenchannelMessage,\x20%s,\x20%s',_0x1341a9,_0xe3b4('0x20'));_0x4d9db8(_0x570f60[_0xe3b4('0x27')][_0xe3b4('0x26')]);}})['catch'](function(_0x275691){logger[_0xe3b4('0x23')](_0xe3b4('0x25'),_0x1341a9,_0x275691);_0x2280c5(_0x275691);});});}function respondWithStatusCode(_0x5a3f5a,_0x52bb0){_0x52bb0=_0x52bb0||0xcc;return function(_0x23b064){if(_0x23b064){return _0x5a3f5a['sendStatus'](_0x52bb0);}return _0x5a3f5a[_0xe3b4('0x28')](_0x52bb0)['end']();};}function respondWithResult(_0x43db82,_0xe778ef){_0xe778ef=_0xe778ef||0xc8;return function(_0x106347){if(_0x106347){return _0x43db82[_0xe3b4('0x28')](_0xe778ef)[_0xe3b4('0x29')](_0x106347);}};}function respondWithFilteredResult(_0x3cd9e7,_0x5791ee){return function(_0x316228){if(_0x316228){var _0x4842b9=typeof _0x5791ee[_0xe3b4('0x2a')]===_0xe3b4('0x2b')&&typeof _0x5791ee['limit']===_0xe3b4('0x2b');var _0x3f7602=_0x316228['count'];var _0x336aa7=_0x4842b9?0x0:_0x5791ee['offset'];var _0x19e3e6=_0x4842b9?_0x316228['count']:_0x5791ee['offset']+_0x5791ee['limit'];var _0xf59f4d;if(_0x19e3e6>=_0x3f7602){_0x19e3e6=_0x3f7602;_0xf59f4d=0xc8;}else{_0xf59f4d=0xce;}_0x3cd9e7[_0xe3b4('0x28')](_0xf59f4d);return _0x3cd9e7['set'](_0xe3b4('0x2c'),_0x336aa7+'-'+_0x19e3e6+'/'+_0x3f7602)[_0xe3b4('0x29')](_0x316228);}return null;};}function patchUpdates(_0x4c0d74){return function(_0x6d126d){try{jsonpatch['apply'](_0x6d126d,_0x4c0d74,!![]);}catch(_0x2e9452){return BPromise[_0xe3b4('0x2d')](_0x2e9452);}return _0x6d126d['save']();};}function saveUpdates(_0x1a6491,_0x598f6c){return function(_0x5e7017){if(_0x5e7017){return _0x5e7017[_0xe3b4('0x2e')](_0x1a6491)[_0xe3b4('0x1e')](function(_0x14fdc9){return _0x14fdc9;});}return null;};}function removeEntity(_0x391062,_0x4e7830){return function(_0x40a072){if(_0x40a072){return _0x40a072['destroy']()[_0xe3b4('0x1e')](function(){_0x391062['status'](0xcc)[_0xe3b4('0x2f')]();});}};}function handleEntityNotFound(_0x8f8602,_0x20f98e){return function(_0x1af237){if(!_0x1af237){_0x8f8602[_0xe3b4('0x30')](0x194);}return _0x1af237;};}function handleError(_0x1cf09f,_0x1fef7c){_0x1fef7c=_0x1fef7c||0x1f4;return function(_0x5a6342){logger[_0xe3b4('0x23')](_0x5a6342[_0xe3b4('0x31')]);if(_0x5a6342[_0xe3b4('0x32')]){delete _0x5a6342[_0xe3b4('0x32')];}_0x1cf09f['status'](_0x1fef7c)[_0xe3b4('0x33')](_0x5a6342);};}exports[_0xe3b4('0x34')]=function(_0x3e2a56,_0x12747c){var _0x39a408={},_0x140879={},_0xbd7458={'count':0x0,'rows':[]};var _0x33d068=_['map'](db[_0xe3b4('0x35')][_0xe3b4('0x36')],function(_0x43a5c5){return{'name':_0x43a5c5['fieldName'],'type':_0x43a5c5[_0xe3b4('0x37')]['key']};});_0x140879[_0xe3b4('0x38')]=_[_0xe3b4('0x39')](_0x33d068,_0xe3b4('0x32'));_0x140879['query']=_[_0xe3b4('0x3a')](_0x3e2a56[_0xe3b4('0x3b')]);_0x140879['filters']=_[_0xe3b4('0x3c')](_0x140879[_0xe3b4('0x38')],_0x140879[_0xe3b4('0x3b')]);_0x39a408[_0xe3b4('0x3d')]=_[_0xe3b4('0x3c')](_0x140879['model'],qs[_0xe3b4('0x3e')](_0x3e2a56[_0xe3b4('0x3b')][_0xe3b4('0x3e')]));_0x39a408[_0xe3b4('0x3d')]=_0x39a408['attributes'][_0xe3b4('0x3f')]?_0x39a408['attributes']:_0x140879[_0xe3b4('0x38')];if(!_0x3e2a56[_0xe3b4('0x3b')]['hasOwnProperty'](_0xe3b4('0x40'))){_0x39a408[_0xe3b4('0x41')]=qs[_0xe3b4('0x41')](_0x3e2a56[_0xe3b4('0x3b')][_0xe3b4('0x41')]);_0x39a408[_0xe3b4('0x2a')]=qs['offset'](_0x3e2a56[_0xe3b4('0x3b')][_0xe3b4('0x2a')]);}_0x39a408[_0xe3b4('0x42')]=qs[_0xe3b4('0x43')](_0x3e2a56[_0xe3b4('0x3b')][_0xe3b4('0x43')]);_0x39a408[_0xe3b4('0x44')]=qs[_0xe3b4('0x45')](_[_0xe3b4('0x46')](_0x3e2a56[_0xe3b4('0x3b')],_0x140879[_0xe3b4('0x45')]),_0x33d068);if(_0x3e2a56[_0xe3b4('0x3b')][_0xe3b4('0x47')]){_0x39a408['where']=_['merge'](_0x39a408['where'],{'$or':_[_0xe3b4('0x39')](_0x33d068,function(_0x88a19d){if(_0x88a19d[_0xe3b4('0x37')]!==_0xe3b4('0x48')){var _0x23d80b={};_0x23d80b[_0x88a19d[_0xe3b4('0x32')]]={'$like':'%'+_0x3e2a56[_0xe3b4('0x3b')]['filter']+'%'};return _0x23d80b;}})});}_0x39a408=_['merge']({},_0x39a408,_0x3e2a56['options']);var _0x4cc5e3={'where':_0x39a408['where']};return db[_0xe3b4('0x35')][_0xe3b4('0x49')](_0x4cc5e3)[_0xe3b4('0x1e')](function(_0x5ed9af){_0xbd7458[_0xe3b4('0x49')]=_0x5ed9af;if(_0x3e2a56[_0xe3b4('0x3b')][_0xe3b4('0x4a')]){_0x39a408[_0xe3b4('0x4b')]=[{'all':!![]}];}return db[_0xe3b4('0x35')][_0xe3b4('0x4c')](_0x39a408);})[_0xe3b4('0x1e')](function(_0x4ebb1a){_0xbd7458[_0xe3b4('0x4d')]=_0x4ebb1a;return _0xbd7458;})[_0xe3b4('0x1e')](respondWithFilteredResult(_0x12747c,_0x39a408))[_0xe3b4('0x4e')](handleError(_0x12747c,null));};exports[_0xe3b4('0x4f')]=function(_0x4be91c,_0x5c955a){var _0x13f747={'raw':!![],'where':{'id':_0x4be91c[_0xe3b4('0x50')]['id']}},_0x56a271={};_0x56a271[_0xe3b4('0x38')]=_[_0xe3b4('0x3a')](db[_0xe3b4('0x35')]['rawAttributes']);_0x56a271['query']=_[_0xe3b4('0x3a')](_0x4be91c[_0xe3b4('0x3b')]);_0x56a271[_0xe3b4('0x45')]=_[_0xe3b4('0x3c')](_0x56a271[_0xe3b4('0x38')],_0x56a271[_0xe3b4('0x3b')]);_0x13f747[_0xe3b4('0x3d')]=_[_0xe3b4('0x3c')](_0x56a271[_0xe3b4('0x38')],qs[_0xe3b4('0x3e')](_0x4be91c[_0xe3b4('0x3b')][_0xe3b4('0x3e')]));_0x13f747[_0xe3b4('0x3d')]=_0x13f747[_0xe3b4('0x3d')][_0xe3b4('0x3f')]?_0x13f747['attributes']:_0x56a271['model'];if(_0x4be91c['query'][_0xe3b4('0x4a')]){_0x13f747[_0xe3b4('0x4b')]=[{'all':!![]}];}_0x13f747=_[_0xe3b4('0x51')]({},_0x13f747,_0x4be91c[_0xe3b4('0x52')]);return db[_0xe3b4('0x35')][_0xe3b4('0x53')](_0x13f747)[_0xe3b4('0x1e')](handleEntityNotFound(_0x5c955a,null))[_0xe3b4('0x1e')](respondWithResult(_0x5c955a,null))[_0xe3b4('0x4e')](handleError(_0x5c955a,null));};exports[_0xe3b4('0x54')]=function(_0x2a4354,_0x26a519){return db[_0xe3b4('0x35')][_0xe3b4('0x54')](_0x2a4354[_0xe3b4('0x55')],{})['then'](respondWithResult(_0x26a519,0xc9))[_0xe3b4('0x4e')](handleError(_0x26a519,null));};exports['update']=function(_0x155790,_0x512a68){if(_0x155790[_0xe3b4('0x55')]['id']){delete _0x155790[_0xe3b4('0x55')]['id'];}return db[_0xe3b4('0x35')][_0xe3b4('0x53')]({'where':{'id':_0x155790['params']['id']}})[_0xe3b4('0x1e')](handleEntityNotFound(_0x512a68,null))[_0xe3b4('0x1e')](saveUpdates(_0x155790['body'],null))[_0xe3b4('0x1e')](respondWithResult(_0x512a68,null))[_0xe3b4('0x4e')](handleError(_0x512a68,null));};exports['destroy']=function(_0x40a187,_0x4f1b09){return db['OpenchannelMessage']['find']({'where':{'id':_0x40a187[_0xe3b4('0x50')]['id']}})[_0xe3b4('0x1e')](handleEntityNotFound(_0x4f1b09,null))[_0xe3b4('0x1e')](removeEntity(_0x4f1b09,null))[_0xe3b4('0x4e')](handleError(_0x4f1b09,null));};exports['describe']=function(_0x537fac,_0x4c5ed1){return db[_0xe3b4('0x35')][_0xe3b4('0x56')]()['then'](respondWithResult(_0x4c5ed1,null))[_0xe3b4('0x4e')](handleError(_0x4c5ed1,null));};var interaction_log=require(_0xe3b4('0x11'))(_0xe3b4('0x57'));exports['accept']=function(_0x2e70c6,_0x227c09,_0x30607e){var _0x59d090={'agent':{},'channel':_0xe3b4('0x58')};if(_0x2e70c6[_0xe3b4('0x55')]['id']){delete _0x2e70c6['body']['id'];}_0x2e70c6[_0xe3b4('0x55')]['read']=!![];_0x2e70c6[_0xe3b4('0x55')][_0xe3b4('0x59')]=moment()[_0xe3b4('0x5a')](_0xe3b4('0x5b'));_0x2e70c6[_0xe3b4('0x55')]['UserId']=_0x2e70c6['body'][_0xe3b4('0x5c')]||_0x2e70c6[_0xe3b4('0x5d')]['id'];_0x59d090['agent']['id']=_0x2e70c6['body'][_0xe3b4('0x5c')];return db[_0xe3b4('0x35')][_0xe3b4('0x53')]({'where':{'id':_0x2e70c6[_0xe3b4('0x50')]['id'],'UserId':null}})[_0xe3b4('0x1e')](handleEntityNotFound(_0x227c09,null))[_0xe3b4('0x1e')](saveUpdates(_0x2e70c6[_0xe3b4('0x55')],null))['then'](function(_0x4728c7){if(_0x4728c7){_0x59d090[_0xe3b4('0x26')]=_0x4728c7[_0xe3b4('0x5e')]({'plain':!![]});return db[_0xe3b4('0x5f')][_0xe3b4('0x53')]({'where':{'id':_0x4728c7['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x227c09,null))[_0xe3b4('0x1e')](function(_0x2f720c){if(_0x2f720c){return _0x2f720c[_0xe3b4('0x2e')]({'UserId':_0x2e70c6[_0xe3b4('0x55')][_0xe3b4('0x5c')],'read1stAt':_[_0xe3b4('0x60')](_0x2f720c['read1stAt'])?moment()[_0xe3b4('0x5a')](_0xe3b4('0x5b')):undefined});}return null;})[_0xe3b4('0x1e')](function(_0x36bba5){if(_0x36bba5){_0x59d090[_0xe3b4('0x61')]=_0x36bba5['get']({'plain':!![]});interaction_log[_0xe3b4('0x1f')](_0xe3b4('0x62'),_0x2e70c6[_0xe3b4('0x5d')]['id'],_0x2e70c6[_0xe3b4('0x5d')][_0xe3b4('0x32')],_0x2e70c6[_0xe3b4('0x5d')][_0xe3b4('0x63')],_0x59d090[_0xe3b4('0x61')]['id'],_0x2e70c6[_0xe3b4('0x55')]?JSON[_0xe3b4('0x22')](_0x2e70c6['body']):_0xe3b4('0x64'));return respondWithRpcPromise(_0xe3b4('0x65'),_0xe3b4('0x66'),_0x59d090);}return null;})[_0xe3b4('0x1e')](function(_0x1ef05){var _0x4a6953='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1ef05[_0xe3b4('0x26')][_0xe3b4('0x67')];return db[_0xe3b4('0x68')][_0xe3b4('0x3b')](_0x4a6953,{'type':db[_0xe3b4('0x69')][_0xe3b4('0x6a')][_0xe3b4('0x6b')],'raw':!![]})[_0xe3b4('0x1e')](function(_0xa1679d){return _0xa1679d;});})['then'](function(_0x21d514){if(_0x21d514){_0x59d090[_0xe3b4('0x26')]['contact']=_0x21d514[0x0];if(!_0x2e70c6['body'][_0xe3b4('0x5c')])return;return db[_0xe3b4('0x6c')][_0xe3b4('0x53')]({'where':{'id':_0x2e70c6[_0xe3b4('0x55')]['UserId'],'role':_0xe3b4('0x6d')},'attributes':['id',_0xe3b4('0x32'),_0xe3b4('0x6e'),_0xe3b4('0x6f'),'internal'],'raw':!![]});}return null;})['then'](function(_0x103b46){if(!_0x103b46)return null;_0x59d090[_0xe3b4('0x26')][_0xe3b4('0x6d')]=_0x103b46;return _0x59d090;})['then'](function(_0x394cdd){if(_0x394cdd){if(_0x2e70c6['body'][_0xe3b4('0x70')]){_0x59d090[_0xe3b4('0x26')]['interface']=util['format'](_0xe3b4('0x71'),_0x2e70c6[_0xe3b4('0x5d')][_0xe3b4('0x32')]);_0x59d090[_0xe3b4('0x26')][_0xe3b4('0x72')]=_0x59d090[_0xe3b4('0x72')];_0x59d090[_0xe3b4('0x26')][_0xe3b4('0x73')]=_0x59d090[_0xe3b4('0x72')];_0x59d090[_0xe3b4('0x26')][_0xe3b4('0x74')]=_0xe3b4('0x75');return respondWithRpcPromise(_0xe3b4('0x76'),_0xe3b4('0x76'),{'event':_0xe3b4('0x77'),'message':_0x59d090[_0xe3b4('0x26')]},client9002)[_0xe3b4('0x1e')](function(){return _0x59d090;});}return _0x59d090;}return null;})[_0xe3b4('0x1e')](respondWithResult(_0x227c09,null))['catch'](handleError(_0x227c09,null));};var interaction_log=require(_0xe3b4('0x11'))(_0xe3b4('0x57'));exports[_0xe3b4('0x2d')]=function(_0x2f5941,_0x30bf4f,_0x522d23){var _0x48346e={'agent':{},'channel':_0xe3b4('0x58')};if(_0x2f5941['body']['id']){delete _0x2f5941[_0xe3b4('0x55')]['id'];}_0x2f5941['body'][_0xe3b4('0x5c')]=_0x2f5941[_0xe3b4('0x55')][_0xe3b4('0x5c')]||_0x2f5941[_0xe3b4('0x5d')]['id'];_0x48346e['agent']['id']=_0x2f5941[_0xe3b4('0x55')][_0xe3b4('0x5c')];return db[_0xe3b4('0x35')][_0xe3b4('0x53')]({'where':{'id':_0x2f5941[_0xe3b4('0x50')]['id'],'UserId':null}})[_0xe3b4('0x1e')](handleEntityNotFound(_0x30bf4f,null))['then'](function(_0x22fe8d){if(_0x22fe8d){_0x48346e[_0xe3b4('0x26')]=_0x22fe8d[_0xe3b4('0x5e')]({'plain':!![]});return db['OpenchannelInteraction'][_0xe3b4('0x53')]({'where':{'id':_0x22fe8d[_0xe3b4('0x78')]}});}return null;})[_0xe3b4('0x1e')](handleEntityNotFound(_0x30bf4f,null))[_0xe3b4('0x1e')](function(_0x59d665){if(_0x59d665){_0x48346e['interaction']=_0x59d665['get']({'plain':!![]});interaction_log[_0xe3b4('0x1f')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2f5941[_0xe3b4('0x5d')]['id'],_0x2f5941[_0xe3b4('0x5d')][_0xe3b4('0x32')],_0x2f5941[_0xe3b4('0x5d')]['role'],_0x48346e[_0xe3b4('0x61')]['id'],_0x2f5941['body']?JSON[_0xe3b4('0x22')](_0x2f5941[_0xe3b4('0x55')]):_0xe3b4('0x64'));return respondWithRpcPromise(_0xe3b4('0x79'),_0xe3b4('0x7a'),_0x48346e);}return null;})[_0xe3b4('0x1e')](function(_0x1510b5){var _0x4d78b9='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1510b5[_0xe3b4('0x26')][_0xe3b4('0x67')];return db[_0xe3b4('0x68')][_0xe3b4('0x3b')](_0x4d78b9,{'type':db[_0xe3b4('0x69')][_0xe3b4('0x6a')][_0xe3b4('0x6b')],'raw':!![]})[_0xe3b4('0x1e')](function(_0x26673f){return _0x26673f;});})[_0xe3b4('0x1e')](function(_0x59cf55){if(_0x59cf55){_0x48346e[_0xe3b4('0x26')][_0xe3b4('0x7b')]=_0x59cf55[0x0];if(!_0x2f5941[_0xe3b4('0x55')]['UserId'])return;return db[_0xe3b4('0x6c')][_0xe3b4('0x53')]({'where':{'id':_0x2f5941[_0xe3b4('0x55')][_0xe3b4('0x5c')],'role':_0xe3b4('0x6d')},'attributes':['id','name',_0xe3b4('0x6e'),_0xe3b4('0x6f'),_0xe3b4('0x7c')],'raw':!![]});}return null;})[_0xe3b4('0x1e')](function(_0x3fed77){if(!_0x3fed77)return null;_0x48346e[_0xe3b4('0x26')][_0xe3b4('0x6d')]=_0x3fed77;return _0x48346e;})['then'](function(_0x3fcdca){if(_0x3fcdca){_0x3fcdca[_0xe3b4('0x26')]['interface']=util[_0xe3b4('0x5a')]('SIP/%s',_0x2f5941[_0xe3b4('0x5d')][_0xe3b4('0x32')]);_0x3fcdca['message'][_0xe3b4('0x72')]=_0x48346e[_0xe3b4('0x72')];_0x3fcdca[_0xe3b4('0x26')][_0xe3b4('0x73')]=_0x48346e[_0xe3b4('0x72')];_0x3fcdca[_0xe3b4('0x26')][_0xe3b4('0x74')]=_0xe3b4('0x2d');respondWithRpcPromise(_0xe3b4('0x76'),_0xe3b4('0x76'),{'event':_0xe3b4('0x7d'),'message':_0x3fcdca['message']},client9002);return _0x48346e;}return null;})[_0xe3b4('0x1e')](respondWithResult(_0x30bf4f,null))[_0xe3b4('0x4e')](handleError(_0x30bf4f,null));}; \ No newline at end of file +var _0xc76e=['lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','include','findAll','show','includeAll','find','create','body','params','describe','openchannel-interactions','accept','openchannel','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','get','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','interaction','user','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','email','internal','agent','interface','format','SIP/%s','channel','EventManager','acceptmessage','../../config/logger','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','QueryTypes','motionChannel','event','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','ejs','fs-extra'];(function(_0x190b37,_0x386197){var _0x4e7eb7=function(_0x31468b){while(--_0x31468b){_0x190b37['push'](_0x190b37['shift']());}};_0x4e7eb7(++_0x386197);}(_0xc76e,0x10c));var _0xec76=function(_0x5f12eb,_0x4e3c2d){_0x5f12eb=_0x5f12eb-0x0;var _0x307e41=_0xc76e[_0x5f12eb];return _0x307e41;};'use strict';var emlformat=require(_0xec76('0x0'));var rimraf=require(_0xec76('0x1'));var zipdir=require(_0xec76('0x2'));var jsonpatch=require(_0xec76('0x3'));var rp=require(_0xec76('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xec76('0x5'));var util=require(_0xec76('0x6'));var path=require('path');var sox=require(_0xec76('0x7'));var csv=require('to-csv');var ejs=require(_0xec76('0x8'));var fs=require('fs');var fs_extra=require(_0xec76('0x9'));var _=require(_0xec76('0xa'));var squel=require(_0xec76('0xb'));var crypto=require(_0xec76('0xc'));var jsforce=require(_0xec76('0xd'));var deskjs=require(_0xec76('0xe'));var toCsv=require(_0xec76('0xf'));var querystring=require(_0xec76('0x10'));var Papa=require('papaparse');var Redis=require(_0xec76('0x11'));var authService=require(_0xec76('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xec76('0x13'));var hardwareService=require(_0xec76('0x14'));var logger=require('../../config/logger')(_0xec76('0x15'));var utils=require(_0xec76('0x16'));var config=require(_0xec76('0x17'));var licenseUtil=require(_0xec76('0x18'));var db=require(_0xec76('0x19'))['db'];config[_0xec76('0x1a')]=_[_0xec76('0x1b')](config[_0xec76('0x1a')],{'host':_0xec76('0x1c'),'port':0x18eb});var socket=require(_0xec76('0x1d'))(new Redis(config[_0xec76('0x1a')]));require(_0xec76('0x1e'))[_0xec76('0x1f')](socket);var jayson=require(_0xec76('0x20'));var client=jayson[_0xec76('0x21')][_0xec76('0x22')]({'port':0x232c});var client9002=jayson['client'][_0xec76('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x490c76,_0x2fe444,_0x36347e,_0x4452fd){return new BPromise(function(_0x91a265,_0x38be5e){var _0x17931d=_0x4452fd||client;return _0x17931d['request'](_0x490c76,_0x36347e)['then'](function(_0x3fde84){logger[_0xec76('0x23')](_0xec76('0x24'),_0x2fe444,_0xec76('0x25'));logger[_0xec76('0x26')](_0xec76('0x27'),_0x2fe444,_0xec76('0x25'),JSON[_0xec76('0x28')](_0x3fde84));if(_0x3fde84[_0xec76('0x29')]){if(_0x3fde84[_0xec76('0x29')][_0xec76('0x2a')]===0x1f4){logger[_0xec76('0x29')]('OpenchannelMessage,\x20%s,\x20%s',_0x2fe444,_0x3fde84[_0xec76('0x29')][_0xec76('0x2b')]);return _0x38be5e(_0x3fde84[_0xec76('0x29')][_0xec76('0x2b')]);}logger[_0xec76('0x29')](_0xec76('0x24'),_0x2fe444,_0x3fde84[_0xec76('0x29')]['message']);return _0x91a265(_0x3fde84['error'][_0xec76('0x2b')]);}else{logger['info'](_0xec76('0x24'),_0x2fe444,_0xec76('0x25'));_0x91a265(_0x3fde84[_0xec76('0x2c')][_0xec76('0x2b')]);}})[_0xec76('0x2d')](function(_0x4957b4){logger[_0xec76('0x29')]('OpenchannelMessage,\x20%s,\x20%s',_0x2fe444,_0x4957b4);_0x38be5e(_0x4957b4);});});}function respondWithStatusCode(_0x53ef25,_0x5bf545){_0x5bf545=_0x5bf545||0xcc;return function(_0x3ad46f){if(_0x3ad46f){return _0x53ef25[_0xec76('0x2e')](_0x5bf545);}return _0x53ef25['status'](_0x5bf545)[_0xec76('0x2f')]();};}function respondWithResult(_0xe2ddff,_0x6585f2){_0x6585f2=_0x6585f2||0xc8;return function(_0x125942){if(_0x125942){return _0xe2ddff[_0xec76('0x30')](_0x6585f2)[_0xec76('0x31')](_0x125942);}};}function respondWithFilteredResult(_0x325745,_0x400f7d){return function(_0x347050){if(_0x347050){var _0x584574=typeof _0x400f7d[_0xec76('0x32')]===_0xec76('0x33')&&typeof _0x400f7d['limit']===_0xec76('0x33');var _0x40e79d=_0x347050[_0xec76('0x34')];var _0x3ec7b6=_0x584574?0x0:_0x400f7d['offset'];var _0x4c2011=_0x584574?_0x347050[_0xec76('0x34')]:_0x400f7d[_0xec76('0x32')]+_0x400f7d[_0xec76('0x35')];var _0x2ffeaa;if(_0x4c2011>=_0x40e79d){_0x4c2011=_0x40e79d;_0x2ffeaa=0xc8;}else{_0x2ffeaa=0xce;}_0x325745[_0xec76('0x30')](_0x2ffeaa);return _0x325745[_0xec76('0x36')](_0xec76('0x37'),_0x3ec7b6+'-'+_0x4c2011+'/'+_0x40e79d)[_0xec76('0x31')](_0x347050);}return null;};}function patchUpdates(_0x3dbade){return function(_0x96349d){try{jsonpatch[_0xec76('0x38')](_0x96349d,_0x3dbade,!![]);}catch(_0xd3beed){return BPromise[_0xec76('0x39')](_0xd3beed);}return _0x96349d[_0xec76('0x3a')]();};}function saveUpdates(_0xcc614a,_0xf811d){return function(_0x446f70){if(_0x446f70){return _0x446f70[_0xec76('0x3b')](_0xcc614a)['then'](function(_0x1bca4b){return _0x1bca4b;});}return null;};}function removeEntity(_0x30a212,_0x1ab72f){return function(_0x2f52ec){if(_0x2f52ec){return _0x2f52ec[_0xec76('0x3c')]()[_0xec76('0x3d')](function(){_0x30a212[_0xec76('0x30')](0xcc)[_0xec76('0x2f')]();});}};}function handleEntityNotFound(_0x56b552,_0x12d69e){return function(_0x3a30a7){if(!_0x3a30a7){_0x56b552['sendStatus'](0x194);}return _0x3a30a7;};}function handleError(_0x5524a8,_0x5a4b16){_0x5a4b16=_0x5a4b16||0x1f4;return function(_0x2a3175){logger[_0xec76('0x29')](_0x2a3175[_0xec76('0x3e')]);if(_0x2a3175[_0xec76('0x3f')]){delete _0x2a3175[_0xec76('0x3f')];}_0x5524a8[_0xec76('0x30')](_0x5a4b16)[_0xec76('0x40')](_0x2a3175);};}exports[_0xec76('0x41')]=function(_0x5120ca,_0x55b91a){var _0x49caa2={},_0xf3525={},_0x479e49={'count':0x0,'rows':[]};var _0x557a16=_[_0xec76('0x42')](db[_0xec76('0x43')][_0xec76('0x44')],function(_0x43dd1c){return{'name':_0x43dd1c[_0xec76('0x45')],'type':_0x43dd1c['type'][_0xec76('0x46')]};});_0xf3525[_0xec76('0x47')]=_[_0xec76('0x42')](_0x557a16,_0xec76('0x3f'));_0xf3525[_0xec76('0x48')]=_[_0xec76('0x49')](_0x5120ca[_0xec76('0x48')]);_0xf3525[_0xec76('0x4a')]=_[_0xec76('0x4b')](_0xf3525[_0xec76('0x47')],_0xf3525[_0xec76('0x48')]);_0x49caa2[_0xec76('0x4c')]=_[_0xec76('0x4b')](_0xf3525[_0xec76('0x47')],qs[_0xec76('0x4d')](_0x5120ca['query'][_0xec76('0x4d')]));_0x49caa2[_0xec76('0x4c')]=_0x49caa2[_0xec76('0x4c')][_0xec76('0x4e')]?_0x49caa2[_0xec76('0x4c')]:_0xf3525['model'];if(!_0x5120ca[_0xec76('0x48')][_0xec76('0x4f')](_0xec76('0x50'))){_0x49caa2['limit']=qs['limit'](_0x5120ca[_0xec76('0x48')][_0xec76('0x35')]);_0x49caa2['offset']=qs[_0xec76('0x32')](_0x5120ca['query'][_0xec76('0x32')]);}_0x49caa2[_0xec76('0x51')]=qs[_0xec76('0x52')](_0x5120ca[_0xec76('0x48')][_0xec76('0x52')]);_0x49caa2[_0xec76('0x53')]=qs[_0xec76('0x4a')](_[_0xec76('0x54')](_0x5120ca[_0xec76('0x48')],_0xf3525[_0xec76('0x4a')]),_0x557a16);if(_0x5120ca[_0xec76('0x48')][_0xec76('0x55')]){_0x49caa2[_0xec76('0x53')]=_[_0xec76('0x56')](_0x49caa2[_0xec76('0x53')],{'$or':_[_0xec76('0x42')](_0x557a16,function(_0x2e5634){if(_0x2e5634[_0xec76('0x57')]!=='VIRTUAL'){var _0x1388a8={};_0x1388a8[_0x2e5634['name']]={'$like':'%'+_0x5120ca[_0xec76('0x48')][_0xec76('0x55')]+'%'};return _0x1388a8;}})});}_0x49caa2=_[_0xec76('0x56')]({},_0x49caa2,_0x5120ca[_0xec76('0x58')]);var _0x8fb197={'where':_0x49caa2[_0xec76('0x53')]};return db['OpenchannelMessage'][_0xec76('0x34')](_0x8fb197)['then'](function(_0x25af32){_0x479e49[_0xec76('0x34')]=_0x25af32;if(_0x5120ca['query']['includeAll']){_0x49caa2[_0xec76('0x59')]=[{'all':!![]}];}return db[_0xec76('0x43')][_0xec76('0x5a')](_0x49caa2);})['then'](function(_0x4d5aa6){_0x479e49['rows']=_0x4d5aa6;return _0x479e49;})[_0xec76('0x3d')](respondWithFilteredResult(_0x55b91a,_0x49caa2))['catch'](handleError(_0x55b91a,null));};exports[_0xec76('0x5b')]=function(_0x90e660,_0x4c1e75){var _0x3066fd={'raw':!![],'where':{'id':_0x90e660['params']['id']}},_0x1e643d={};_0x1e643d['model']=_[_0xec76('0x49')](db[_0xec76('0x43')][_0xec76('0x44')]);_0x1e643d[_0xec76('0x48')]=_['keys'](_0x90e660[_0xec76('0x48')]);_0x1e643d[_0xec76('0x4a')]=_[_0xec76('0x4b')](_0x1e643d[_0xec76('0x47')],_0x1e643d[_0xec76('0x48')]);_0x3066fd[_0xec76('0x4c')]=_[_0xec76('0x4b')](_0x1e643d['model'],qs[_0xec76('0x4d')](_0x90e660[_0xec76('0x48')]['fields']));_0x3066fd[_0xec76('0x4c')]=_0x3066fd['attributes']['length']?_0x3066fd[_0xec76('0x4c')]:_0x1e643d[_0xec76('0x47')];if(_0x90e660[_0xec76('0x48')][_0xec76('0x5c')]){_0x3066fd['include']=[{'all':!![]}];}_0x3066fd=_[_0xec76('0x56')]({},_0x3066fd,_0x90e660[_0xec76('0x58')]);return db[_0xec76('0x43')][_0xec76('0x5d')](_0x3066fd)[_0xec76('0x3d')](handleEntityNotFound(_0x4c1e75,null))[_0xec76('0x3d')](respondWithResult(_0x4c1e75,null))[_0xec76('0x2d')](handleError(_0x4c1e75,null));};exports['create']=function(_0x481cb6,_0x31fd11){return db['OpenchannelMessage'][_0xec76('0x5e')](_0x481cb6['body'],{})[_0xec76('0x3d')](respondWithResult(_0x31fd11,0xc9))[_0xec76('0x2d')](handleError(_0x31fd11,null));};exports[_0xec76('0x3b')]=function(_0x198dfd,_0x449c8c){if(_0x198dfd[_0xec76('0x5f')]['id']){delete _0x198dfd[_0xec76('0x5f')]['id'];}return db['OpenchannelMessage'][_0xec76('0x5d')]({'where':{'id':_0x198dfd[_0xec76('0x60')]['id']}})[_0xec76('0x3d')](handleEntityNotFound(_0x449c8c,null))[_0xec76('0x3d')](saveUpdates(_0x198dfd['body'],null))[_0xec76('0x3d')](respondWithResult(_0x449c8c,null))[_0xec76('0x2d')](handleError(_0x449c8c,null));};exports[_0xec76('0x3c')]=function(_0x1ee8eb,_0x3ab64a){return db['OpenchannelMessage'][_0xec76('0x5d')]({'where':{'id':_0x1ee8eb[_0xec76('0x60')]['id']}})['then'](handleEntityNotFound(_0x3ab64a,null))[_0xec76('0x3d')](removeEntity(_0x3ab64a,null))[_0xec76('0x2d')](handleError(_0x3ab64a,null));};exports[_0xec76('0x61')]=function(_0x58e5d0,_0x4c359b){return db[_0xec76('0x43')][_0xec76('0x61')]()['then'](respondWithResult(_0x4c359b,null))[_0xec76('0x2d')](handleError(_0x4c359b,null));};var interaction_log=require('../../config/logger')(_0xec76('0x62'));exports[_0xec76('0x63')]=function(_0x590ce7,_0x4613e2,_0x439461){var _0x3f1715={'agent':{},'channel':_0xec76('0x64')};if(_0x590ce7['body']['id']){delete _0x590ce7[_0xec76('0x5f')]['id'];}_0x590ce7[_0xec76('0x5f')]['read']=!![];_0x590ce7[_0xec76('0x5f')][_0xec76('0x65')]=moment()['format'](_0xec76('0x66'));_0x590ce7[_0xec76('0x5f')][_0xec76('0x67')]=_0x590ce7[_0xec76('0x5f')][_0xec76('0x67')]||_0x590ce7['user']['id'];_0x3f1715['agent']['id']=_0x590ce7[_0xec76('0x5f')]['UserId'];return db['OpenchannelMessage'][_0xec76('0x5d')]({'where':{'id':_0x590ce7[_0xec76('0x60')]['id'],'UserId':null}})[_0xec76('0x3d')](handleEntityNotFound(_0x4613e2,null))[_0xec76('0x3d')](saveUpdates(_0x590ce7[_0xec76('0x5f')],null))[_0xec76('0x3d')](function(_0x49732d){if(_0x49732d){_0x3f1715['message']=_0x49732d[_0xec76('0x68')]({'plain':!![]});return db[_0xec76('0x69')][_0xec76('0x5d')]({'where':{'id':_0x49732d[_0xec76('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x4613e2,null))[_0xec76('0x3d')](function(_0x8f28d9){if(_0x8f28d9){return _0x8f28d9[_0xec76('0x3b')]({'UserId':_0x590ce7['body']['UserId'],'read1stAt':_['isNil'](_0x8f28d9[_0xec76('0x6b')])?moment()['format'](_0xec76('0x66')):undefined});}return null;})['then'](function(_0x4092de){if(_0x4092de){_0x3f1715[_0xec76('0x6c')]=_0x4092de[_0xec76('0x68')]({'plain':!![]});interaction_log[_0xec76('0x23')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x590ce7['user']['id'],_0x590ce7[_0xec76('0x6d')]['name'],_0x590ce7[_0xec76('0x6d')][_0xec76('0x6e')],_0x3f1715[_0xec76('0x6c')]['id'],_0x590ce7['body']?JSON[_0xec76('0x28')](_0x590ce7[_0xec76('0x5f')]):'null');return respondWithRpcPromise(_0xec76('0x6f'),_0xec76('0x70'),_0x3f1715);}return null;})[_0xec76('0x3d')](function(_0x591a4d){var _0x1f4b59=_0xec76('0x71')+_0x591a4d[_0xec76('0x2b')][_0xec76('0x72')];return db[_0xec76('0x73')]['query'](_0x1f4b59,{'type':db[_0xec76('0x74')]['QueryTypes'][_0xec76('0x75')],'raw':!![]})[_0xec76('0x3d')](function(_0x3f4a61){return _0x3f4a61;});})[_0xec76('0x3d')](function(_0x46f32e){if(_0x46f32e){_0x3f1715['message'][_0xec76('0x76')]=_0x46f32e[0x0];if(!_0x590ce7[_0xec76('0x5f')]['UserId'])return;return db[_0xec76('0x77')][_0xec76('0x5d')]({'where':{'id':_0x590ce7['body'][_0xec76('0x67')],'role':'agent'},'attributes':['id','name',_0xec76('0x78'),_0xec76('0x79'),_0xec76('0x7a')],'raw':!![]});}return null;})['then'](function(_0x1ed0e7){if(!_0x1ed0e7)return null;_0x3f1715['message'][_0xec76('0x7b')]=_0x1ed0e7;return _0x3f1715;})['then'](function(_0x578e52){if(_0x578e52){if(_0x590ce7[_0xec76('0x5f')]['manual']){_0x3f1715[_0xec76('0x2b')][_0xec76('0x7c')]=util[_0xec76('0x7d')](_0xec76('0x7e'),_0x590ce7[_0xec76('0x6d')][_0xec76('0x3f')]);_0x3f1715['message'][_0xec76('0x7f')]=_0x3f1715[_0xec76('0x7f')];_0x3f1715['message']['motionChannel']=_0x3f1715[_0xec76('0x7f')];_0x3f1715[_0xec76('0x2b')]['event']=_0xec76('0x63');return respondWithRpcPromise(_0xec76('0x80'),_0xec76('0x80'),{'event':_0xec76('0x81'),'message':_0x3f1715[_0xec76('0x2b')]},client9002)[_0xec76('0x3d')](function(){return _0x3f1715;});}return _0x3f1715;}return null;})['then'](respondWithResult(_0x4613e2,null))[_0xec76('0x2d')](handleError(_0x4613e2,null));};var interaction_log=require(_0xec76('0x82'))(_0xec76('0x62'));exports['reject']=function(_0x19a050,_0x4fc0a2,_0x424d4e){var _0x2599b2={'agent':{},'channel':_0xec76('0x64')};if(_0x19a050[_0xec76('0x5f')]['id']){delete _0x19a050[_0xec76('0x5f')]['id'];}_0x19a050[_0xec76('0x5f')][_0xec76('0x67')]=_0x19a050[_0xec76('0x5f')][_0xec76('0x67')]||_0x19a050['user']['id'];_0x2599b2['agent']['id']=_0x19a050[_0xec76('0x5f')][_0xec76('0x67')];return db[_0xec76('0x43')][_0xec76('0x5d')]({'where':{'id':_0x19a050[_0xec76('0x60')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4fc0a2,null))[_0xec76('0x3d')](function(_0x362819){if(_0x362819){_0x2599b2[_0xec76('0x2b')]=_0x362819[_0xec76('0x68')]({'plain':!![]});return db[_0xec76('0x69')][_0xec76('0x5d')]({'where':{'id':_0x362819['OpenchannelInteractionId']}});}return null;})[_0xec76('0x3d')](handleEntityNotFound(_0x4fc0a2,null))[_0xec76('0x3d')](function(_0x30ec9a){if(_0x30ec9a){_0x2599b2[_0xec76('0x6c')]=_0x30ec9a['get']({'plain':!![]});interaction_log[_0xec76('0x23')](_0xec76('0x83'),_0x19a050[_0xec76('0x6d')]['id'],_0x19a050[_0xec76('0x6d')][_0xec76('0x3f')],_0x19a050[_0xec76('0x6d')][_0xec76('0x6e')],_0x2599b2[_0xec76('0x6c')]['id'],_0x19a050[_0xec76('0x5f')]?JSON[_0xec76('0x28')](_0x19a050[_0xec76('0x5f')]):_0xec76('0x84'));return respondWithRpcPromise(_0xec76('0x85'),_0xec76('0x86'),_0x2599b2);}return null;})[_0xec76('0x3d')](function(_0x21ede2){var _0xb0b865=_0xec76('0x71')+_0x21ede2[_0xec76('0x2b')][_0xec76('0x72')];return db[_0xec76('0x73')][_0xec76('0x48')](_0xb0b865,{'type':db[_0xec76('0x74')][_0xec76('0x87')][_0xec76('0x75')],'raw':!![]})[_0xec76('0x3d')](function(_0x2c0eec){return _0x2c0eec;});})[_0xec76('0x3d')](function(_0x25da80){if(_0x25da80){_0x2599b2['message'][_0xec76('0x76')]=_0x25da80[0x0];if(!_0x19a050[_0xec76('0x5f')][_0xec76('0x67')])return;return db[_0xec76('0x77')][_0xec76('0x5d')]({'where':{'id':_0x19a050['body'][_0xec76('0x67')],'role':_0xec76('0x7b')},'attributes':['id',_0xec76('0x3f'),'fullname',_0xec76('0x79'),'internal'],'raw':!![]});}return null;})[_0xec76('0x3d')](function(_0x4da49c){if(!_0x4da49c)return null;_0x2599b2['message'][_0xec76('0x7b')]=_0x4da49c;return _0x2599b2;})[_0xec76('0x3d')](function(_0x4c069c){if(_0x4c069c){_0x4c069c[_0xec76('0x2b')][_0xec76('0x7c')]=util[_0xec76('0x7d')](_0xec76('0x7e'),_0x19a050[_0xec76('0x6d')][_0xec76('0x3f')]);_0x4c069c['message'][_0xec76('0x7f')]=_0x2599b2[_0xec76('0x7f')];_0x4c069c[_0xec76('0x2b')][_0xec76('0x88')]=_0x2599b2[_0xec76('0x7f')];_0x4c069c[_0xec76('0x2b')][_0xec76('0x89')]=_0xec76('0x39');respondWithRpcPromise(_0xec76('0x80'),_0xec76('0x80'),{'event':_0xec76('0x8a'),'message':_0x4c069c['message']},client9002);return _0x2599b2;}return null;})[_0xec76('0x3d')](respondWithResult(_0x4fc0a2,null))[_0xec76('0x2d')](handleError(_0x4fc0a2,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index cab06f4..bc6063a 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 _0x0b6e=['hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','update','emit'];(function(_0x4cebea,_0x19a09d){var _0x27b3ff=function(_0xfc8f9b){while(--_0xfc8f9b){_0x4cebea['push'](_0x4cebea['shift']());}};_0x27b3ff(++_0x19a09d);}(_0x0b6e,0x64));var _0xe0b6=function(_0x4139d0,_0x2d2b7c){_0x4139d0=_0x4139d0-0x0;var _0x1d4c2e=_0x0b6e[_0x4139d0];return _0x1d4c2e;};'use strict';var EventEmitter=require(_0xe0b6('0x0'));var OpenchannelMessage=require(_0xe0b6('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xe0b6('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe0b6('0x3'),'afterDestroy':'remove'};function emitEvent(_0xc28ce){return function(_0x49bb63,_0x1c54c0,_0x58aff6){OpenchannelMessageEvents[_0xe0b6('0x4')](_0xc28ce+':'+_0x49bb63['id'],_0x49bb63);OpenchannelMessageEvents[_0xe0b6('0x4')](_0xc28ce,_0x49bb63);_0x58aff6(null);};}for(var e in events){if(events[_0xe0b6('0x5')](e)){var event=events[e];OpenchannelMessage[_0xe0b6('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0x24be=['exports','../../mysqldb','OpenchannelMessage','setMaxListeners','save','emit','hasOwnProperty'];(function(_0x2c3a8f,_0x374e56){var _0x189412=function(_0x560055){while(--_0x560055){_0x2c3a8f['push'](_0x2c3a8f['shift']());}};_0x189412(++_0x374e56);}(_0x24be,0x1ac));var _0xe24b=function(_0x33ef92,_0x4de903){_0x33ef92=_0x33ef92-0x0;var _0x4e725b=_0x24be[_0x33ef92];return _0x4e725b;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xe24b('0x0'))['db'][_0xe24b('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xe24b('0x2')](0x0);var events={'afterCreate':_0xe24b('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x372610){return function(_0xf3ec17,_0x65c13f,_0x4fd131){OpenchannelMessageEvents[_0xe24b('0x4')](_0x372610+':'+_0xf3ec17['id'],_0xf3ec17);OpenchannelMessageEvents[_0xe24b('0x4')](_0x372610,_0xf3ec17);_0x4fd131(null);};}for(var e in events){if(events[_0xe24b('0x5')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0xe24b('0x6')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 9e93f2d..d77ef56 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 _0x0481=['then','out','CmContact','describe','OpenchannelAccount','OpenchannelAccountId','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','method','GET','POST','Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','catch','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','bluebird','request-promise','rimraf','./openchannelMessage.attributes','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','toLowerCase','direction','secret','isNil','OpenchannelInteraction','findOne','OpenchannelInteractionId'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0481,0x10c));var _0x1048=function(_0xf4f343,_0x41fe4a){_0xf4f343=_0xf4f343-0x0;var _0x4cda68=_0x0481[_0xf4f343];return _0x4cda68;};'use strict';var _=require(_0x1048('0x0'));var util=require(_0x1048('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x1048('0x2'));var rp=require(_0x1048('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1048('0x4'));var config=require('../../config/environment');var attributes=require(_0x1048('0x5'));module['exports']=function(_0x3d2629,_0x2cb7f2){return _0x3d2629[_0x1048('0x6')](_0x1048('0x7'),attributes,{'tableName':_0x1048('0x8'),'paranoid':![],'indexes':[{'name':_0x1048('0x9'),'fields':[_0x1048('0xa')],'type':_0x1048('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x46bfe8,_0x52f954,_0x47ec1f){var _0x59cf98=_0x3d2629[_0x1048('0xc')];var _0x553d94=_0x46bfe8['get']({'plain':!![]});if(_0x553d94['direction'][_0x1048('0xd')]()==='in'||_0x553d94[_0x1048('0xe')]['toLowerCase']()==='out'&&!_0x553d94[_0x1048('0xf')]&&!_[_0x1048('0x10')](_0x553d94['UserId'])){_0x59cf98[_0x1048('0x11')][_0x1048('0x12')]({'where':{'id':_0x553d94[_0x1048('0x13')]}})[_0x1048('0x14')](function(_0xee2044){if(_0xee2044){_0xee2044['update']({'lastMsgAt':_0x553d94['createdAt'],'lastMsgDirection':_0x553d94[_0x1048('0xe')]['toLowerCase']()});}})['catch'](function(_0x312119){console['error'](_0x312119);});}if(_0x553d94[_0x1048('0xe')]===_0x1048('0x15')&&!_0x553d94[_0x1048('0xf')]){var _0x23719e;_0x59cf98[_0x1048('0x16')][_0x1048('0x17')]()[_0x1048('0x14')](function(_0x3f1ca8){return _0x59cf98[_0x1048('0x18')]['find']({'where':{'id':_0x553d94[_0x1048('0x19')]},'include':[{'model':_0x59cf98['OpenchannelInteraction'],'as':_0x1048('0x1a'),'where':{'id':_0x553d94[_0x1048('0x13')]},'limit':0x1,'include':[{'model':_0x59cf98['CmContact'],'as':_0x1048('0x1b'),'attributes':_[_0x1048('0x1c')](_0x3f1ca8)}]}]});})[_0x1048('0x14')](function(_0x14b268){_0x23719e=_0x14b268['get']({'plain':!![]});if(_0x23719e&&_0x23719e[_0x1048('0x1d')]){logger[_0x1048('0x1e')](_0x1048('0x1f'),_0x1048('0x20'),util[_0x1048('0x21')](_0x1048('0x22'),_0x553d94['id'],_0x23719e[_0x1048('0x1d')]));if(_0x23719e['Interactions']&&_0x23719e[_0x1048('0x1a')][_0x1048('0x23')]){_0x553d94[_0x1048('0x24')]=_[_0x1048('0x25')](_0x23719e[_0x1048('0x1a')][0x0],_0x1048('0x1b'));_0x553d94[_0x1048('0x1b')]=_0x23719e[_0x1048('0x1a')][0x0][_0x1048('0x1b')];}var _0x52f954={'method':'POST','uri':encodeURI(_0x23719e[_0x1048('0x1d')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x52f954[_0x1048('0x26')]){case _0x1048('0x27'):_0x52f954['qs']=_0x553d94;break;case _0x1048('0x28'):_0x52f954[_0x1048('0xa')]=_0x553d94;break;}return rp(_0x52f954)[_0x1048('0x14')](function(_0x24a4e3){logger[_0x1048('0x1e')](_0x1048('0x1f'),_0x1048('0x20'),util[_0x1048('0x21')](_0x1048('0x29'),_0x553d94['id'],_0x23719e[_0x1048('0x1d')]));if(_0x24a4e3[_0x1048('0xa')][_0x1048('0x2a')]&&_0x24a4e3[_0x1048('0xa')][_0x1048('0x2a')]!=_0x553d94[_0x1048('0x24')][_0x1048('0x2a')]){return _0x59cf98['OpenchannelInteraction'][_0x1048('0x2b')]({'threadId':_0x24a4e3[_0x1048('0xa')]['threadId']},{'where':{'id':_0x553d94[_0x1048('0x24')]['id']}});}else{return;}})['then'](function(){return _0x46bfe8['update']({'read':!![]});})[_0x1048('0x2c')](function(_0x3d82b9){logger['error'](_0x1048('0x1f'),_0x1048('0x20'),util['inspect'](_0x3d82b9,{'showHidden':![],'depth':null}));_0x47ec1f();});}else{_0x47ec1f();}})[_0x1048('0x2d')](function(){_0x47ec1f();});}else{_0x47ec1f();}}},'charset':_0x1048('0x2e'),'collate':_0x1048('0x2f')});}; \ No newline at end of file +var _0xaecb=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','fti_openchannel_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','then','update','createdAt','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','OpenchannelInteractionId','CmContact','Contact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','length','POST','method','GET','info','afterCreate','threadId','Interaction','catch','error','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x9b7a64,_0x38d4a8){var _0x33fd98=function(_0x15c82b){while(--_0x15c82b){_0x9b7a64['push'](_0x9b7a64['shift']());}};_0x33fd98(++_0x38d4a8);}(_0xaecb,0x1ed));var _0xbaec=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaecb[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xbaec('0x0'));var util=require(_0xbaec('0x1'));var logger=require(_0xbaec('0x2'))(_0xbaec('0x3'));var moment=require(_0xbaec('0x4'));var BPromise=require(_0xbaec('0x5'));var rp=require(_0xbaec('0x6'));var fs=require('fs');var path=require(_0xbaec('0x7'));var rimraf=require(_0xbaec('0x8'));var config=require(_0xbaec('0x9'));var attributes=require(_0xbaec('0xa'));module[_0xbaec('0xb')]=function(_0x16411d,_0x1a9fa0){return _0x16411d[_0xbaec('0xc')](_0xbaec('0xd'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0xbaec('0xe'),'fields':[_0xbaec('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3cf2dc,_0x4960b5,_0x4b9f45){var _0xc35f11=_0x16411d[_0xbaec('0x10')];var _0x4d02df=_0x3cf2dc[_0xbaec('0x11')]({'plain':!![]});if(_0x4d02df[_0xbaec('0x12')][_0xbaec('0x13')]()==='in'||_0x4d02df[_0xbaec('0x12')][_0xbaec('0x13')]()===_0xbaec('0x14')&&!_0x4d02df[_0xbaec('0x15')]&&!_[_0xbaec('0x16')](_0x4d02df[_0xbaec('0x17')])){_0xc35f11[_0xbaec('0x18')][_0xbaec('0x19')]({'where':{'id':_0x4d02df['OpenchannelInteractionId']}})[_0xbaec('0x1a')](function(_0x179085){if(_0x179085){_0x179085[_0xbaec('0x1b')]({'lastMsgAt':_0x4d02df[_0xbaec('0x1c')],'lastMsgDirection':_0x4d02df[_0xbaec('0x12')][_0xbaec('0x13')]()});}})['catch'](function(_0x22fa2c){console['error'](_0x22fa2c);});}if(_0x4d02df[_0xbaec('0x12')]===_0xbaec('0x14')&&!_0x4d02df[_0xbaec('0x15')]){var _0x5a7bd9;_0xc35f11['CmContact'][_0xbaec('0x1d')]()[_0xbaec('0x1a')](function(_0x2b20ff){return _0xc35f11[_0xbaec('0x1e')][_0xbaec('0x1f')]({'where':{'id':_0x4d02df[_0xbaec('0x20')]},'include':[{'model':_0xc35f11['OpenchannelInteraction'],'as':_0xbaec('0x21'),'where':{'id':_0x4d02df[_0xbaec('0x22')]},'limit':0x1,'include':[{'model':_0xc35f11[_0xbaec('0x23')],'as':_0xbaec('0x24'),'attributes':_[_0xbaec('0x25')](_0x2b20ff)}]}]});})['then'](function(_0x357614){_0x5a7bd9=_0x357614[_0xbaec('0x11')]({'plain':!![]});if(_0x5a7bd9&&_0x5a7bd9[_0xbaec('0x26')]){logger['info'](_0xbaec('0x27'),'afterCreate',util[_0xbaec('0x28')](_0xbaec('0x29'),_0x4d02df['id'],_0x5a7bd9[_0xbaec('0x26')]));if(_0x5a7bd9[_0xbaec('0x21')]&&_0x5a7bd9['Interactions'][_0xbaec('0x2a')]){_0x4d02df['Interaction']=_['omit'](_0x5a7bd9['Interactions'][0x0],'Contact');_0x4d02df[_0xbaec('0x24')]=_0x5a7bd9[_0xbaec('0x21')][0x0][_0xbaec('0x24')];}var _0x4960b5={'method':_0xbaec('0x2b'),'uri':encodeURI(_0x5a7bd9[_0xbaec('0x26')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4960b5[_0xbaec('0x2c')]){case _0xbaec('0x2d'):_0x4960b5['qs']=_0x4d02df;break;case _0xbaec('0x2b'):_0x4960b5['body']=_0x4d02df;break;}return rp(_0x4960b5)['then'](function(_0x3fdc3d){logger[_0xbaec('0x2e')](_0xbaec('0x27'),_0xbaec('0x2f'),util[_0xbaec('0x28')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x4d02df['id'],_0x5a7bd9[_0xbaec('0x26')]));if(_0x3fdc3d['body']['threadId']&&_0x3fdc3d[_0xbaec('0xf')][_0xbaec('0x30')]!=_0x4d02df['Interaction'][_0xbaec('0x30')]){return _0xc35f11[_0xbaec('0x18')][_0xbaec('0x1b')]({'threadId':_0x3fdc3d[_0xbaec('0xf')][_0xbaec('0x30')]},{'where':{'id':_0x4d02df[_0xbaec('0x31')]['id']}});}else{return;}})[_0xbaec('0x1a')](function(){return _0x3cf2dc[_0xbaec('0x1b')]({'read':!![]});})[_0xbaec('0x32')](function(_0x49959b){logger[_0xbaec('0x33')](_0xbaec('0x27'),_0xbaec('0x2f'),util['inspect'](_0x49959b,{'showHidden':![],'depth':null}));_0x4b9f45();});}else{_0x4b9f45();}})[_0xbaec('0x34')](function(){_0x4b9f45();});}else{_0x4b9f45();}}},'charset':_0xbaec('0x35'),'collate':_0xbaec('0x36')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index c16d6e5..a3b323c 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 _0x0b0e=['message','result','OpenchannelMessage','create','body','options','CreateOpenchannelMessage','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x274bc8,_0x492192){var _0x3b2918=function(_0x24a3b8){while(--_0x24a3b8){_0x274bc8['push'](_0x274bc8['shift']());}};_0x3b2918(++_0x492192);}(_0x0b0e,0x187));var _0xe0b0=function(_0xf5fbb7,_0xdb7f69){_0xf5fbb7=_0xf5fbb7-0x0;var _0x330d55=_0x0b0e[_0xf5fbb7];return _0x330d55;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});config[_0xe0b0('0xc')]=_['defaults'](config['redis'],{'host':_0xe0b0('0xd'),'port':0x18eb});var socket=require(_0xe0b0('0xe'))(new Redis(config[_0xe0b0('0xc')]));require(_0xe0b0('0xf'))['register'](socket);function respondWithRpcPromise(_0x338e7c,_0x1dd3b8,_0x553d4f){return new BPromise(function(_0x1fef28,_0x2f32b6){return client['request'](_0x338e7c,_0x553d4f)[_0xe0b0('0x10')](function(_0x2cdad2){logger[_0xe0b0('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,_0xe0b0('0x12'));logger[_0xe0b0('0x13')](_0xe0b0('0x14'),_0x1dd3b8,_0xe0b0('0x12'),JSON[_0xe0b0('0x15')](_0x2cdad2));if(_0x2cdad2['error']){if(_0x2cdad2[_0xe0b0('0x16')][_0xe0b0('0x17')]===0x1f4){logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2[_0xe0b0('0x16')]['message']);return _0x2f32b6(_0x2cdad2[_0xe0b0('0x16')]['message']);}logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2['error'][_0xe0b0('0x19')]);return _0x1fef28(_0x2cdad2['error'][_0xe0b0('0x19')]);}else{logger[_0xe0b0('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,'request\x20sent');_0x1fef28(_0x2cdad2[_0xe0b0('0x1a')]['message']);}})['catch'](function(_0x4bce65){logger[_0xe0b0('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,_0x4bce65);_0x2f32b6(_0x4bce65);});});}exports['CreateOpenchannelMessage']=function(_0x10cde1){var _0x59dff5=this;return new Promise(function(_0x472286,_0x5dba2f){return db[_0xe0b0('0x1b')][_0xe0b0('0x1c')](_0x10cde1[_0xe0b0('0x1d')],{'raw':_0x10cde1[_0xe0b0('0x1e')]?_0x10cde1[_0xe0b0('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2fa820){logger['info'](_0xe0b0('0x1f'),_0x10cde1);logger[_0xe0b0('0x13')]('CreateOpenchannelMessage',_0x10cde1,JSON[_0xe0b0('0x15')](_0x2fa820));_0x472286(_0x2fa820);})['catch'](function(_0x2208d0){logger['error'](_0xe0b0('0x1f'),_0x2208d0['message'],_0x10cde1);_0x5dba2f(_0x59dff5[_0xe0b0('0x16')](0x1f4,_0x2208d0['message']));});});}; \ No newline at end of file +var _0x0b0e=['message','result','OpenchannelMessage','create','body','options','CreateOpenchannelMessage','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s'];(function(_0xf077f8,_0x3d4d95){var _0x40245d=function(_0x45970b){while(--_0x45970b){_0xf077f8['push'](_0xf077f8['shift']());}};_0x40245d(++_0x3d4d95);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1bda6c,_0x5440b1){_0x1bda6c=_0x1bda6c-0x0;var _0x501a86=_0x0b0e[_0x1bda6c];return _0x501a86;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});config[_0xe0b0('0xc')]=_['defaults'](config['redis'],{'host':_0xe0b0('0xd'),'port':0x18eb});var socket=require(_0xe0b0('0xe'))(new Redis(config[_0xe0b0('0xc')]));require(_0xe0b0('0xf'))['register'](socket);function respondWithRpcPromise(_0x338e7c,_0x1dd3b8,_0x553d4f){return new BPromise(function(_0x1fef28,_0x2f32b6){return client['request'](_0x338e7c,_0x553d4f)[_0xe0b0('0x10')](function(_0x2cdad2){logger[_0xe0b0('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,_0xe0b0('0x12'));logger[_0xe0b0('0x13')](_0xe0b0('0x14'),_0x1dd3b8,_0xe0b0('0x12'),JSON[_0xe0b0('0x15')](_0x2cdad2));if(_0x2cdad2['error']){if(_0x2cdad2[_0xe0b0('0x16')][_0xe0b0('0x17')]===0x1f4){logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2[_0xe0b0('0x16')]['message']);return _0x2f32b6(_0x2cdad2[_0xe0b0('0x16')]['message']);}logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2['error'][_0xe0b0('0x19')]);return _0x1fef28(_0x2cdad2['error'][_0xe0b0('0x19')]);}else{logger[_0xe0b0('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,'request\x20sent');_0x1fef28(_0x2cdad2[_0xe0b0('0x1a')]['message']);}})['catch'](function(_0x4bce65){logger[_0xe0b0('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,_0x4bce65);_0x2f32b6(_0x4bce65);});});}exports['CreateOpenchannelMessage']=function(_0x10cde1){var _0x59dff5=this;return new Promise(function(_0x472286,_0x5dba2f){return db[_0xe0b0('0x1b')][_0xe0b0('0x1c')](_0x10cde1[_0xe0b0('0x1d')],{'raw':_0x10cde1[_0xe0b0('0x1e')]?_0x10cde1[_0xe0b0('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2fa820){logger['info'](_0xe0b0('0x1f'),_0x10cde1);logger[_0xe0b0('0x13')]('CreateOpenchannelMessage',_0x10cde1,JSON[_0xe0b0('0x15')](_0x2fa820));_0x472286(_0x2fa820);})['catch'](function(_0x2208d0){logger['error'](_0xe0b0('0x1f'),_0x2208d0['message'],_0x10cde1);_0x5dba2f(_0x59dff5[_0xe0b0('0x16')](0x1f4,_0x2208d0['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index ac4049a..8e19fa2 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 _0x799b=['length','openchannelMessage:','./openchannelMessage.events','update','emit','removeListener'];(function(_0x3933b3,_0x3d6b90){var _0x241a71=function(_0x33bda0){while(--_0x33bda0){_0x3933b3['push'](_0x3933b3['shift']());}};_0x241a71(++_0x3d6b90);}(_0x799b,0x8c));var _0xb799=function(_0x528db5,_0x31e843){_0x528db5=_0x528db5-0x0;var _0x2e2c9d=_0x799b[_0x528db5];return _0x2e2c9d;};'use strict';var OpenchannelMessageEvents=require(_0xb799('0x0'));var events=['save','remove',_0xb799('0x1')];function createListener(_0x539b08,_0x437846){return function(_0x41bafc){_0x437846[_0xb799('0x2')](_0x539b08,_0x41bafc);};}function removeListener(_0x1dda29,_0x4fdc5b){return function(){OpenchannelMessageEvents[_0xb799('0x3')](_0x1dda29,_0x4fdc5b);};}exports['register']=function(_0x7398b7){for(var _0x4e3ab0=0x0,_0x171d59=events[_0xb799('0x4')];_0x4e3ab0<_0x171d59;_0x4e3ab0++){var _0x3e0c35=events[_0x4e3ab0];var _0x2012e1=createListener(_0xb799('0x5')+_0x3e0c35,_0x7398b7);OpenchannelMessageEvents['on'](_0x3e0c35,_0x2012e1);}}; \ No newline at end of file +var _0x0cc6=['./openchannelMessage.events','save','update','emit','removeListener','register','length','openchannelMessage:'];(function(_0x4f5108,_0x46a54b){var _0x2d56ca=function(_0x5b3c1e){while(--_0x5b3c1e){_0x4f5108['push'](_0x4f5108['shift']());}};_0x2d56ca(++_0x46a54b);}(_0x0cc6,0xe0));var _0x60cc=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x0cc6[_0x465a0c];return _0x1e202e;};'use strict';var OpenchannelMessageEvents=require(_0x60cc('0x0'));var events=[_0x60cc('0x1'),'remove',_0x60cc('0x2')];function createListener(_0x1a39a9,_0x513d05){return function(_0x67ba11){_0x513d05[_0x60cc('0x3')](_0x1a39a9,_0x67ba11);};}function removeListener(_0x43e6c3,_0x6286bb){return function(){OpenchannelMessageEvents[_0x60cc('0x4')](_0x43e6c3,_0x6286bb);};}exports[_0x60cc('0x5')]=function(_0x588477){for(var _0x26aa55=0x0,_0x3c87f3=events[_0x60cc('0x6')];_0x26aa55<_0x3c87f3;_0x26aa55++){var _0x20fb36=events[_0x26aa55];var _0x25b924=createListener(_0x60cc('0x7')+_0x20fb36,_0x588477);OpenchannelMessageEvents['on'](_0x20fb36,_0x25b924);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 28ab79d..c293e14 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 _0x99d2=['/:id/teams','getTeams','/:id/users','post','addTeams','put','update','delete','/:id','destroy','removeTeams','removeAgents','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','isAuthenticated','index','get','describe','show','/:id/members','getMembers'];(function(_0x7d3f05,_0x50414a){var _0x406e8b=function(_0x21aff1){while(--_0x21aff1){_0x7d3f05['push'](_0x7d3f05['shift']());}};_0x406e8b(++_0x50414a);}(_0x99d2,0xaf));var _0x299d=function(_0x41783f,_0x783ca8){_0x41783f=_0x41783f-0x0;var _0x88773b=_0x99d2[_0x41783f];return _0x88773b;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x299d('0x0'));var express=require(_0x299d('0x1'));var router=express[_0x299d('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x299d('0x3'));var interaction=require(_0x299d('0x4'));var config=require(_0x299d('0x5'));var controller=require(_0x299d('0x6'));router['get']('/',auth[_0x299d('0x7')](),controller[_0x299d('0x8')]);router[_0x299d('0x9')]('/describe',auth[_0x299d('0x7')](),controller[_0x299d('0xa')]);router[_0x299d('0x9')]('/:id',auth[_0x299d('0x7')](),controller[_0x299d('0xb')]);router[_0x299d('0x9')](_0x299d('0xc'),auth[_0x299d('0x7')](),controller[_0x299d('0xd')]);router[_0x299d('0x9')](_0x299d('0xe'),auth[_0x299d('0x7')](),controller[_0x299d('0xf')]);router[_0x299d('0x9')](_0x299d('0x10'),auth[_0x299d('0x7')](),controller['getAgents']);router[_0x299d('0x11')]('/',auth[_0x299d('0x7')](),controller['create']);router['post'](_0x299d('0xe'),auth[_0x299d('0x7')](),controller[_0x299d('0x12')]);router[_0x299d('0x11')](_0x299d('0x10'),auth[_0x299d('0x7')](),controller['addAgents']);router[_0x299d('0x13')]('/:id',auth[_0x299d('0x7')](),controller[_0x299d('0x14')]);router[_0x299d('0x15')](_0x299d('0x16'),auth[_0x299d('0x7')](),controller[_0x299d('0x17')]);router['delete']('/:id/teams',auth[_0x299d('0x7')](),controller[_0x299d('0x18')]);router[_0x299d('0x15')](_0x299d('0x10'),auth[_0x299d('0x7')](),controller[_0x299d('0x19')]);module[_0x299d('0x1a')]=router; \ No newline at end of file +var _0x1d67=['delete','removeTeams','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','/:id/users','getAgents','post','addTeams','addAgents','put','update','destroy'];(function(_0x128de4,_0x511592){var _0x167659=function(_0x5d4b6d){while(--_0x5d4b6d){_0x128de4['push'](_0x128de4['shift']());}};_0x167659(++_0x511592);}(_0x1d67,0x126));var _0x71d6=function(_0x438334,_0x38cd81){_0x438334=_0x438334-0x0;var _0x15562e=_0x1d67[_0x438334];return _0x15562e;};'use strict';var multer=require(_0x71d6('0x0'));var util=require(_0x71d6('0x1'));var path=require(_0x71d6('0x2'));var timeout=require('connect-timeout');var express=require(_0x71d6('0x3'));var router=express[_0x71d6('0x4')]();var fs_extra=require(_0x71d6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x71d6('0x6'));var config=require(_0x71d6('0x7'));var controller=require('./openchannelQueue.controller');router[_0x71d6('0x8')]('/',auth[_0x71d6('0x9')](),controller[_0x71d6('0xa')]);router[_0x71d6('0x8')](_0x71d6('0xb'),auth[_0x71d6('0x9')](),controller[_0x71d6('0xc')]);router[_0x71d6('0x8')](_0x71d6('0xd'),auth[_0x71d6('0x9')](),controller[_0x71d6('0xe')]);router[_0x71d6('0x8')]('/:id/members',auth[_0x71d6('0x9')](),controller[_0x71d6('0xf')]);router[_0x71d6('0x8')](_0x71d6('0x10'),auth[_0x71d6('0x9')](),controller['getTeams']);router['get'](_0x71d6('0x11'),auth[_0x71d6('0x9')](),controller[_0x71d6('0x12')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x71d6('0x13')](_0x71d6('0x10'),auth[_0x71d6('0x9')](),controller[_0x71d6('0x14')]);router[_0x71d6('0x13')](_0x71d6('0x11'),auth[_0x71d6('0x9')](),controller[_0x71d6('0x15')]);router[_0x71d6('0x16')](_0x71d6('0xd'),auth[_0x71d6('0x9')](),controller[_0x71d6('0x17')]);router['delete'](_0x71d6('0xd'),auth[_0x71d6('0x9')](),controller[_0x71d6('0x18')]);router[_0x71d6('0x19')](_0x71d6('0x10'),auth[_0x71d6('0x9')](),controller[_0x71d6('0x1a')]);router[_0x71d6('0x19')](_0x71d6('0x11'),auth['isAuthenticated'](),controller[_0x71d6('0x1b')]);module[_0x71d6('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 f1ac61e..abb5ecf 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 _0xe5da=['STRING','INTEGER','ENUM','beepall','roundrobin','sequelize','exports'];(function(_0x238bad,_0x20457c){var _0x5d3e16=function(_0x28dac3){while(--_0x28dac3){_0x238bad['push'](_0x238bad['shift']());}};_0x5d3e16(++_0x20457c);}(_0xe5da,0xec));var _0xae5d=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xe5da[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0xae5d('0x0'));module[_0xae5d('0x1')]={'name':{'type':Sequelize[_0xae5d('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xae5d('0x2')]},'timeout':{'type':Sequelize[_0xae5d('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xae5d('0x4')]('rrmemory',_0xae5d('0x5'),_0xae5d('0x6'))}}; \ No newline at end of file +var _0xf18f=['ENUM','rrmemory','beepall','sequelize','exports','STRING','name'];(function(_0x2796e2,_0x4365b0){var _0x37820e=function(_0x5b7717){while(--_0x5b7717){_0x2796e2['push'](_0x2796e2['shift']());}};_0x37820e(++_0x4365b0);}(_0xf18f,0x1c3));var _0xff18=function(_0x12aaa4,_0x2fac96){_0x12aaa4=_0x12aaa4-0x0;var _0x155606=_0xf18f[_0x12aaa4];return _0x155606;};'use strict';var Sequelize=require(_0xff18('0x0'));module[_0xff18('0x1')]={'name':{'type':Sequelize[_0xff18('0x2')],'unique':_0xff18('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xff18('0x4')](_0xff18('0x5'),_0xff18('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 22ae1ab..87ca6a4 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 _0xa747=['SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','undefined','count','offset','limit','set','json','save','update','then','get','destroy','end','error','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','nolimit','sort','pick','filter','where','merge','options','include','rows','catch','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelQueues','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','length','hasOwnProperty','order','OpenchannelQueueId','UserOpenchannelQueue','findAll','agent','updatedAt','createdAt','format','%s/%s','SIP','openchannelPause','getTeams','ids','Team','User','Agents','online','interface','sequelize','transaction','addTeams','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes'];(function(_0x1e4eae,_0x162c8e){var _0x1a98c5=function(_0x23ad79){while(--_0x23ad79){_0x1e4eae['push'](_0x1e4eae['shift']());}};_0x1a98c5(++_0x162c8e);}(_0xa747,0x9c));var _0x7a74=function(_0x43337d,_0x52536e){_0x43337d=_0x43337d-0x0;var _0x452291=_0xa747[_0x43337d];return _0x452291;};'use strict';var emlformat=require(_0x7a74('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7a74('0x1'));var jsonpatch=require(_0x7a74('0x2'));var rp=require(_0x7a74('0x3'));var moment=require(_0x7a74('0x4'));var BPromise=require(_0x7a74('0x5'));var Mustache=require(_0x7a74('0x6'));var util=require('util');var path=require('path');var sox=require(_0x7a74('0x7'));var csv=require(_0x7a74('0x8'));var ejs=require(_0x7a74('0x9'));var fs=require('fs');var fs_extra=require(_0x7a74('0xa'));var _=require(_0x7a74('0xb'));var squel=require('squel');var crypto=require(_0x7a74('0xc'));var jsforce=require(_0x7a74('0xd'));var deskjs=require(_0x7a74('0xe'));var toCsv=require(_0x7a74('0x8'));var querystring=require(_0x7a74('0xf'));var Papa=require(_0x7a74('0x10'));var Redis=require('ioredis');var authService=require(_0x7a74('0x11'));var qs=require(_0x7a74('0x12'));var as=require(_0x7a74('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7a74('0x14'))(_0x7a74('0x15'));var utils=require(_0x7a74('0x16'));var config=require(_0x7a74('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x7a74('0x18'))['db'];config[_0x7a74('0x19')]=_[_0x7a74('0x1a')](config[_0x7a74('0x19')],{'host':_0x7a74('0x1b'),'port':0x18eb});var socket=require(_0x7a74('0x1c'))(new Redis(config[_0x7a74('0x19')]));require('./openchannelQueue.socket')['register'](socket);function respondWithStatusCode(_0x2120a6,_0x4d3c74){_0x4d3c74=_0x4d3c74||0xcc;return function(_0x55b09d){if(_0x55b09d){return _0x2120a6[_0x7a74('0x1d')](_0x4d3c74);}return _0x2120a6[_0x7a74('0x1e')](_0x4d3c74)['end']();};}function respondWithResult(_0x302548,_0x38a81a){_0x38a81a=_0x38a81a||0xc8;return function(_0x2219fe){if(_0x2219fe){return _0x302548[_0x7a74('0x1e')](_0x38a81a)['json'](_0x2219fe);}};}function respondWithFilteredResult(_0x4b4030,_0x218a72){return function(_0x14e0a7){if(_0x14e0a7){var _0x1eb209=typeof _0x218a72['offset']===_0x7a74('0x1f')&&typeof _0x218a72['limit']===_0x7a74('0x1f');var _0x573fab=_0x14e0a7[_0x7a74('0x20')];var _0x1244d5=_0x1eb209?0x0:_0x218a72[_0x7a74('0x21')];var _0x470db1=_0x1eb209?_0x14e0a7[_0x7a74('0x20')]:_0x218a72[_0x7a74('0x21')]+_0x218a72[_0x7a74('0x22')];var _0x4581ab;if(_0x470db1>=_0x573fab){_0x470db1=_0x573fab;_0x4581ab=0xc8;}else{_0x4581ab=0xce;}_0x4b4030[_0x7a74('0x1e')](_0x4581ab);return _0x4b4030[_0x7a74('0x23')]('Content-Range',_0x1244d5+'-'+_0x470db1+'/'+_0x573fab)[_0x7a74('0x24')](_0x14e0a7);}return null;};}function patchUpdates(_0x1514e0){return function(_0x7e9868){try{jsonpatch['apply'](_0x7e9868,_0x1514e0,!![]);}catch(_0x11d1a5){return BPromise['reject'](_0x11d1a5);}return _0x7e9868[_0x7a74('0x25')]();};}function saveUpdates(_0x44e6a2,_0x3736ee){return function(_0x5d9aca){if(_0x5d9aca){return _0x5d9aca[_0x7a74('0x26')](_0x44e6a2)[_0x7a74('0x27')](function(_0x23d983){return _0x23d983;});}return null;};}function removeEntity(_0x453b1e,_0x19a390){return function(_0x5cd45e){if(_0x5cd45e){return _0x5cd45e['destroy']()[_0x7a74('0x27')](function(){var _0x587878=_0x5cd45e[_0x7a74('0x28')]({'plain':!![]});var _0x565891='OpenchannelQueues';return db['UserProfileResource'][_0x7a74('0x29')]({'where':{'type':_0x565891,'resourceId':_0x587878['id']}})[_0x7a74('0x27')](function(){return _0x5cd45e;});})[_0x7a74('0x27')](function(){_0x453b1e[_0x7a74('0x1e')](0xcc)[_0x7a74('0x2a')]();});}};}function handleEntityNotFound(_0x5732cf,_0x17890f){return function(_0x5c5c0a){if(!_0x5c5c0a){_0x5732cf['sendStatus'](0x194);}return _0x5c5c0a;};}function handleError(_0x2f86b9,_0x140940){_0x140940=_0x140940||0x1f4;return function(_0x488f37){logger[_0x7a74('0x2b')](_0x488f37['stack']);if(_0x488f37['name']){delete _0x488f37['name'];}_0x2f86b9['status'](_0x140940)['send'](_0x488f37);};}exports[_0x7a74('0x2c')]=function(_0x2f5469,_0x99d09e){var _0x3627ca={},_0x249d8a={},_0x33d12f={'count':0x0,'rows':[]};var _0x38a12f=_[_0x7a74('0x2d')](db[_0x7a74('0x2e')][_0x7a74('0x2f')],function(_0x2a48fb){return{'name':_0x2a48fb[_0x7a74('0x30')],'type':_0x2a48fb[_0x7a74('0x31')][_0x7a74('0x32')]};});_0x249d8a[_0x7a74('0x33')]=_[_0x7a74('0x2d')](_0x38a12f,_0x7a74('0x34'));_0x249d8a['query']=_['keys'](_0x2f5469[_0x7a74('0x35')]);_0x249d8a[_0x7a74('0x36')]=_[_0x7a74('0x37')](_0x249d8a['model'],_0x249d8a[_0x7a74('0x35')]);_0x3627ca[_0x7a74('0x38')]=_[_0x7a74('0x37')](_0x249d8a['model'],qs[_0x7a74('0x39')](_0x2f5469['query']['fields']));_0x3627ca['attributes']=_0x3627ca[_0x7a74('0x38')]['length']?_0x3627ca[_0x7a74('0x38')]:_0x249d8a[_0x7a74('0x33')];if(!_0x2f5469[_0x7a74('0x35')]['hasOwnProperty'](_0x7a74('0x3a'))){_0x3627ca[_0x7a74('0x22')]=qs[_0x7a74('0x22')](_0x2f5469[_0x7a74('0x35')][_0x7a74('0x22')]);_0x3627ca[_0x7a74('0x21')]=qs[_0x7a74('0x21')](_0x2f5469['query'][_0x7a74('0x21')]);}_0x3627ca['order']=qs[_0x7a74('0x3b')](_0x2f5469[_0x7a74('0x35')][_0x7a74('0x3b')]);_0x3627ca['where']=qs['filters'](_[_0x7a74('0x3c')](_0x2f5469[_0x7a74('0x35')],_0x249d8a[_0x7a74('0x36')]),_0x38a12f);if(_0x2f5469[_0x7a74('0x35')][_0x7a74('0x3d')]){_0x3627ca[_0x7a74('0x3e')]=_[_0x7a74('0x3f')](_0x3627ca[_0x7a74('0x3e')],{'$or':_[_0x7a74('0x2d')](_0x38a12f,function(_0x17e83b){if(_0x17e83b[_0x7a74('0x31')]!=='VIRTUAL'){var _0x23f933={};_0x23f933[_0x17e83b[_0x7a74('0x34')]]={'$like':'%'+_0x2f5469[_0x7a74('0x35')][_0x7a74('0x3d')]+'%'};return _0x23f933;}})});}_0x3627ca=_['merge']({},_0x3627ca,_0x2f5469[_0x7a74('0x40')]);var _0x9b14df={'where':_0x3627ca[_0x7a74('0x3e')]};return db[_0x7a74('0x2e')][_0x7a74('0x20')](_0x9b14df)[_0x7a74('0x27')](function(_0x478d2e){_0x33d12f[_0x7a74('0x20')]=_0x478d2e;if(_0x2f5469['query']['includeAll']){_0x3627ca[_0x7a74('0x41')]=[{'all':!![]}];}return db[_0x7a74('0x2e')]['findAll'](_0x3627ca);})[_0x7a74('0x27')](function(_0x56eb48){_0x33d12f[_0x7a74('0x42')]=_0x56eb48;return _0x33d12f;})[_0x7a74('0x27')](respondWithFilteredResult(_0x99d09e,_0x3627ca))[_0x7a74('0x43')](handleError(_0x99d09e,null));};exports['show']=function(_0x3b5164,_0x1a1cae){var _0x4acd0e={'raw':!![],'where':{'id':_0x3b5164['params']['id']}},_0x441888={};_0x441888[_0x7a74('0x33')]=_['keys'](db[_0x7a74('0x2e')][_0x7a74('0x2f')]);_0x441888[_0x7a74('0x35')]=_[_0x7a74('0x44')](_0x3b5164[_0x7a74('0x35')]);_0x441888[_0x7a74('0x36')]=_[_0x7a74('0x37')](_0x441888[_0x7a74('0x33')],_0x441888[_0x7a74('0x35')]);_0x4acd0e[_0x7a74('0x38')]=_[_0x7a74('0x37')](_0x441888[_0x7a74('0x33')],qs[_0x7a74('0x39')](_0x3b5164['query'][_0x7a74('0x39')]));_0x4acd0e['attributes']=_0x4acd0e['attributes']['length']?_0x4acd0e['attributes']:_0x441888['model'];if(_0x3b5164[_0x7a74('0x35')]['includeAll']){_0x4acd0e['include']=[{'all':!![]}];}_0x4acd0e=_[_0x7a74('0x3f')]({},_0x4acd0e,_0x3b5164[_0x7a74('0x40')]);return db[_0x7a74('0x2e')][_0x7a74('0x45')](_0x4acd0e)[_0x7a74('0x27')](handleEntityNotFound(_0x1a1cae,null))[_0x7a74('0x27')](respondWithResult(_0x1a1cae,null))[_0x7a74('0x43')](handleError(_0x1a1cae,null));};exports[_0x7a74('0x46')]=function(_0x1e5157,_0x1764ea){return db['OpenchannelQueue'][_0x7a74('0x46')](_0x1e5157[_0x7a74('0x47')],{})[_0x7a74('0x27')](function(_0xf6890){var _0x5b090a=_0x1e5157[_0x7a74('0x48')][_0x7a74('0x28')]({'plain':!![]});if(!_0x5b090a)throw new Error(_0x7a74('0x49'));if(_0x5b090a[_0x7a74('0x4a')]===_0x7a74('0x48')){var _0x206330=_0xf6890[_0x7a74('0x28')]({'plain':!![]});var _0x2555cd=_0x7a74('0x4b');return db[_0x7a74('0x4c')][_0x7a74('0x45')]({'where':{'name':_0x2555cd,'userProfileId':_0x5b090a[_0x7a74('0x4d')]},'raw':!![]})['then'](function(_0x1501c2){if(_0x1501c2&&_0x1501c2[_0x7a74('0x4e')]===0x0){return db[_0x7a74('0x4f')]['create']({'name':_0x206330[_0x7a74('0x34')],'resourceId':_0x206330['id'],'type':_0x1501c2[_0x7a74('0x34')],'sectionId':_0x1501c2['id']},{})[_0x7a74('0x27')](function(){return _0xf6890;});}else{return _0xf6890;}})[_0x7a74('0x43')](function(_0x577c2c){logger[_0x7a74('0x2b')](_0x7a74('0x50'),_0x577c2c);throw _0x577c2c;});}return _0xf6890;})['then'](respondWithResult(_0x1764ea,0xc9))['catch'](handleError(_0x1764ea,null));};exports[_0x7a74('0x26')]=function(_0x28efe1,_0x592236){if(_0x28efe1[_0x7a74('0x47')]['id']){delete _0x28efe1[_0x7a74('0x47')]['id'];}return db[_0x7a74('0x2e')]['find']({'where':{'id':_0x28efe1[_0x7a74('0x51')]['id']}})[_0x7a74('0x27')](handleEntityNotFound(_0x592236,null))[_0x7a74('0x27')](saveUpdates(_0x28efe1[_0x7a74('0x47')],null))[_0x7a74('0x27')](respondWithResult(_0x592236,null))[_0x7a74('0x43')](handleError(_0x592236,null));};exports['destroy']=function(_0x54e1f4,_0x2f4644){return db[_0x7a74('0x2e')][_0x7a74('0x45')]({'where':{'id':_0x54e1f4['params']['id']}})[_0x7a74('0x27')](handleEntityNotFound(_0x2f4644,null))[_0x7a74('0x27')](removeEntity(_0x2f4644,null))['catch'](handleError(_0x2f4644,null));};exports['describe']=function(_0xd6b0a8,_0x35838d){return db[_0x7a74('0x2e')][_0x7a74('0x52')]()[_0x7a74('0x27')](respondWithResult(_0x35838d,null))[_0x7a74('0x43')](handleError(_0x35838d,null));};exports[_0x7a74('0x53')]=function(_0x523889,_0x2647d8,_0x5ed1ca){var _0xafe372={'raw':!![],'where':{}},_0xad48fe={},_0x3e3083;return db[_0x7a74('0x2e')][_0x7a74('0x54')]({'where':{'id':_0x523889['params']['id']}})[_0x7a74('0x27')](handleEntityNotFound(_0x2647d8,null))[_0x7a74('0x27')](function(_0x57dd3e){if(_0x57dd3e){_0x3e3083=_0x57dd3e[_0x7a74('0x28')]({'plain':!![]});_0xad48fe['model']=_[_0x7a74('0x44')](db['UserOpenchannelQueue'][_0x7a74('0x2f')]);_0xad48fe[_0x7a74('0x35')]=_[_0x7a74('0x44')](_0x523889[_0x7a74('0x35')]);_0xad48fe[_0x7a74('0x36')]=_[_0x7a74('0x37')](_0xad48fe[_0x7a74('0x33')],_0xad48fe[_0x7a74('0x35')]);_0xafe372[_0x7a74('0x38')]=_[_0x7a74('0x37')](_0xad48fe[_0x7a74('0x33')],qs['fields'](_0x523889[_0x7a74('0x35')][_0x7a74('0x39')]));_0xafe372['attributes']=_0xafe372[_0x7a74('0x38')][_0x7a74('0x55')]?_0xafe372[_0x7a74('0x38')]:_0xad48fe[_0x7a74('0x33')];if(!_0x523889[_0x7a74('0x35')][_0x7a74('0x56')](_0x7a74('0x3a'))){_0xafe372[_0x7a74('0x22')]=qs[_0x7a74('0x22')](_0x523889[_0x7a74('0x35')][_0x7a74('0x22')]);_0xafe372[_0x7a74('0x21')]=qs[_0x7a74('0x21')](_0x523889[_0x7a74('0x35')][_0x7a74('0x21')]);}_0xafe372[_0x7a74('0x57')]=qs[_0x7a74('0x3b')](_0x523889['query']['sort']);_0xafe372['where']=qs[_0x7a74('0x36')](_['pick'](_0x523889[_0x7a74('0x35')],_0xad48fe[_0x7a74('0x36')]));_0xafe372[_0x7a74('0x3e')][_0x7a74('0x58')]=_0x57dd3e['id'];if(_0x523889[_0x7a74('0x35')][_0x7a74('0x3d')]){_0xafe372['where']=_['merge'](_0xafe372[_0x7a74('0x3e')],{'$or':_[_0x7a74('0x2d')](_0xafe372[_0x7a74('0x38')],function(_0xe39568){var _0x1ca105={};_0x1ca105[_0xe39568]={'$like':'%'+_0x523889[_0x7a74('0x35')][_0x7a74('0x3d')]+'%'};return _0x1ca105;})});}_0xafe372=_['merge']({},_0xafe372,_0x523889[_0x7a74('0x40')]);return db[_0x7a74('0x59')][_0x7a74('0x5a')](_0xafe372);}})[_0x7a74('0x27')](function(_0x37f83b){if(_0x37f83b){return db['User']['findAndCountAll']({'where':{'id':_['map'](_0x37f83b,'UserId'),'role':_0x7a74('0x5b')},'attributes':['id',_0x7a74('0x34'),'openchannelPause',_0x7a74('0x5c'),_0x7a74('0x5d')]});}})[_0x7a74('0x27')](function(_0x13ad3d){if(_0x13ad3d){return{'count':_0x13ad3d[_0x7a74('0x20')],'rows':_[_0x7a74('0x2d')](_0x13ad3d[_0x7a74('0x42')],function(_0x1e60a6){return{'membername':_0x1e60a6['name'],'UserId':_0x1e60a6['id'],'queue_name':_0x3e3083[_0x7a74('0x34')],'OpenchannelQueueId':_0x3e3083['id'],'interface':util[_0x7a74('0x5e')](_0x7a74('0x5f'),_0x7a74('0x60'),_0x1e60a6[_0x7a74('0x34')]),'penalty':0x0,'paused':_0x1e60a6[_0x7a74('0x61')],'createdAt':_0x1e60a6[_0x7a74('0x5d')],'updatedAt':_0x1e60a6[_0x7a74('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7a74('0x27')](respondWithFilteredResult(_0x2647d8,_0xafe372))[_0x7a74('0x43')](handleError(_0x2647d8,null));};exports['getTeams']=function(_0x2674de,_0x22d935,_0xdb2153){var _0x41a97f={};var _0x30fbba={};var _0x40e2f1;var _0x2b1eaf;return db[_0x7a74('0x2e')]['findOne']({'where':{'id':_0x2674de['params']['id']}})['then'](handleEntityNotFound(_0x22d935,null))[_0x7a74('0x27')](function(_0x438571){if(_0x438571){_0x40e2f1=_0x438571;_0x30fbba[_0x7a74('0x33')]=_[_0x7a74('0x44')](db['Team']['rawAttributes']);_0x30fbba['query']=_[_0x7a74('0x44')](_0x2674de[_0x7a74('0x35')]);_0x30fbba['filters']=_[_0x7a74('0x37')](_0x30fbba['model'],_0x30fbba[_0x7a74('0x35')]);_0x41a97f[_0x7a74('0x38')]=_['intersection'](_0x30fbba[_0x7a74('0x33')],qs['fields'](_0x2674de[_0x7a74('0x35')][_0x7a74('0x39')]));_0x41a97f[_0x7a74('0x38')]=_0x41a97f[_0x7a74('0x38')][_0x7a74('0x55')]?_0x41a97f[_0x7a74('0x38')]:_0x30fbba[_0x7a74('0x33')];_0x41a97f[_0x7a74('0x57')]=qs[_0x7a74('0x3b')](_0x2674de[_0x7a74('0x35')]['sort']);_0x41a97f['where']=qs['filters'](_[_0x7a74('0x3c')](_0x2674de[_0x7a74('0x35')],_0x30fbba[_0x7a74('0x36')]));if(_0x2674de['query'][_0x7a74('0x3d')]){_0x41a97f[_0x7a74('0x3e')]=_[_0x7a74('0x3f')](_0x41a97f[_0x7a74('0x3e')],{'$or':_[_0x7a74('0x2d')](_0x41a97f[_0x7a74('0x38')],function(_0x21489d){var _0x4195f8={};_0x4195f8[_0x21489d]={'$like':'%'+_0x2674de[_0x7a74('0x35')][_0x7a74('0x3d')]+'%'};return _0x4195f8;})});}_0x41a97f=_['merge']({},_0x41a97f,_0x2674de[_0x7a74('0x40')]);return _0x40e2f1[_0x7a74('0x62')](_0x41a97f);}})[_0x7a74('0x27')](function(_0x4867b7){if(_0x4867b7){_0x2b1eaf=_0x4867b7[_0x7a74('0x55')];if(!_0x2674de[_0x7a74('0x35')][_0x7a74('0x56')](_0x7a74('0x3a'))){_0x41a97f['limit']=qs['limit'](_0x2674de['query'][_0x7a74('0x22')]);_0x41a97f['offset']=qs[_0x7a74('0x21')](_0x2674de[_0x7a74('0x35')][_0x7a74('0x21')]);}return _0x40e2f1[_0x7a74('0x62')](_0x41a97f);}})[_0x7a74('0x27')](function(_0x150c77){if(_0x150c77){return _0x150c77?{'count':_0x2b1eaf,'rows':_0x150c77}:null;}})['then'](respondWithResult(_0x22d935,null))[_0x7a74('0x43')](handleError(_0x22d935,null));};exports['addTeams']=function(_0x5abe1f,_0x4aac69,_0x3f8ce0){var _0x537340=_0x5abe1f['body'][_0x7a74('0x63')];return db[_0x7a74('0x64')]['findAll']({'where':{'id':_0x537340},'attributes':['id'],'include':[{'model':db[_0x7a74('0x65')],'as':_0x7a74('0x66'),'attributes':['id',_0x7a74('0x34'),_0x7a74('0x67'),'voicePause',_0x7a74('0x68')],'raw':!![]}]})[_0x7a74('0x27')](function(_0x278307){if(_0x278307){var _0x2b5019=_['flatMap'](_0x278307,function(_0xda4217){var _0x387913=_0xda4217['get']({'plain':!![]});return _0x387913[_0x7a74('0x66')];});return db['OpenchannelQueue'][_0x7a74('0x45')]({'where':{'id':_0x5abe1f[_0x7a74('0x51')]['id']}})[_0x7a74('0x27')](function(_0x5cfbbc){return db[_0x7a74('0x69')][_0x7a74('0x6a')](function(_0x504dd0){return _0x5cfbbc[_0x7a74('0x6b')](_0x537340,{'transaction':_0x504dd0})[_0x7a74('0x27')](function(){return BPromise['each'](_0x2b5019,function(_0x19bbc9){return db[_0x7a74('0x59')][_0x7a74('0x6c')]({'where':{'UserId':_0x19bbc9['id'],'OpenchannelQueueId':_0x5abe1f[_0x7a74('0x51')]['id']},'transaction':_0x504dd0});});})[_0x7a74('0x27')](function(){_0x2b5019[_0x7a74('0x6d')](function(_0x2171d4){socket[_0x7a74('0x6e')](_0x7a74('0x6f'),{'UserId':_0x2171d4['id'],'OpenchannelQueueId':_0x5cfbbc['id']});});});});});}})[_0x7a74('0x27')](respondWithStatusCode(_0x4aac69,null))[_0x7a74('0x43')](handleError(_0x4aac69,null));};exports[_0x7a74('0x70')]=function(_0x3865f3,_0x13f6f4,_0x55e252){return db[_0x7a74('0x64')][_0x7a74('0x5a')]({'where':{'id':_0x3865f3[_0x7a74('0x35')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7a74('0x66'),'attributes':['id'],'raw':!![]}]})[_0x7a74('0x27')](handleEntityNotFound(_0x13f6f4,null))[_0x7a74('0x27')](function(_0x4330a8){var _0x12c450=_[_0x7a74('0x2d')](_0x4330a8,'id');var _0x2fa23b=[];var _0x3a31ca=[];var _0x25deb9=squel['select']();_0x25deb9[_0x7a74('0x71')](_0x7a74('0x72'))[_0x7a74('0x73')](_0x7a74('0x74'),'tq')[_0x7a74('0x75')](_0x7a74('0x76'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x7a74('0x3e')](_0x7a74('0x77'),_0x3865f3[_0x7a74('0x51')]['id']);for(var _0x569ee7=0x0;_0x569ee7<_0x4330a8['length'];_0x569ee7+=0x1){let _0x406c09=_0x4330a8[_0x569ee7];for(var _0x3e0672=0x0;_0x3e0672<_0x406c09['Agents'][_0x7a74('0x55')];_0x3e0672+=0x1){let _0x41a098=_0x406c09[_0x7a74('0x66')][_0x3e0672];var _0x59efa4=_0x25deb9[_0x7a74('0x78')]();_0x59efa4[_0x7a74('0x3e')](_0x7a74('0x79'),_0x41a098['id']);_0x3a31ca['push'](db['sequelize'][_0x7a74('0x35')](_0x59efa4[_0x7a74('0x7a')](),{'type':db[_0x7a74('0x69')][_0x7a74('0x7b')][_0x7a74('0x7c')]})[_0x7a74('0x27')](function(_0x1acd7b){if(_0x1acd7b[_0x7a74('0x55')]===0x1){return _0x41a098['id'];}else{var _0x5b6cb0=_[_0x7a74('0x7d')](_['map'](_0x1acd7b,_0x7a74('0x7e')),function(_0x32633f){return _[_0x7a74('0x7f')](_0x12c450,_0x32633f);});if(_0x5b6cb0){return _0x41a098['id'];}}}));}}return BPromise[_0x7a74('0x80')](_0x3a31ca)['then'](function(_0x38f5fa){_0x2fa23b=_(_0x2fa23b)[_0x7a74('0x81')](_0x38f5fa)[_0x7a74('0x82')]()[_0x7a74('0x83')]();return db[_0x7a74('0x2e')][_0x7a74('0x45')]({'where':{'id':_0x3865f3[_0x7a74('0x51')]['id']}})[_0x7a74('0x27')](function(_0x5cec39){return db[_0x7a74('0x69')]['transaction'](function(_0x4ae49d){return _0x5cec39[_0x7a74('0x70')](_0x3865f3[_0x7a74('0x35')][_0x7a74('0x63')],{'transaction':_0x4ae49d})[_0x7a74('0x27')](function(){if(!_[_0x7a74('0x84')](_0x2fa23b)){return _0x5cec39[_0x7a74('0x85')](_0x2fa23b,{'transaction':_0x4ae49d});}})[_0x7a74('0x27')](function(){_0x2fa23b[_0x7a74('0x6d')](function(_0x2f27d0){socket[_0x7a74('0x6e')](_0x7a74('0x86'),{'UserId':_0x2f27d0,'OpenchannelQueueId':_0x5cec39['id']});});});});});});})[_0x7a74('0x27')](respondWithStatusCode(_0x13f6f4,null))['catch'](handleError(_0x13f6f4,null));};exports[_0x7a74('0x87')]=function(_0x262a9e,_0x14dac3,_0xc210d4){return db[_0x7a74('0x2e')][_0x7a74('0x45')]({'where':{'id':_0x262a9e['params']['id']}})[_0x7a74('0x27')](handleEntityNotFound(_0x14dac3,null))['then'](function(_0x4ac92b){if(_0x4ac92b){return _0x4ac92b[_0x7a74('0x87')](_0x262a9e['body'][_0x7a74('0x63')],_[_0x7a74('0x88')](_0x262a9e['body'],['ids','id'])||{})[_0x7a74('0x89')](function(_0x3d03a9){for(var _0x93113c=0x0;_0x93113c<_0x262a9e[_0x7a74('0x47')][_0x7a74('0x63')][_0x7a74('0x55')];_0x93113c+=0x1){socket[_0x7a74('0x6e')]('userOpenchannelQueue:save',{'UserId':Number(_0x262a9e[_0x7a74('0x47')][_0x7a74('0x63')][_0x93113c]),'OpenchannelQueueId':Number(_0x262a9e[_0x7a74('0x51')]['id'])});}return _0x3d03a9;});}})[_0x7a74('0x27')](respondWithResult(_0x14dac3,null))[_0x7a74('0x43')](handleError(_0x14dac3,null));};exports[_0x7a74('0x85')]=function(_0x388136,_0x9e46cf,_0xa826dd){return db[_0x7a74('0x2e')][_0x7a74('0x45')]({'where':{'id':_0x388136[_0x7a74('0x51')]['id']}})['then'](handleEntityNotFound(_0x9e46cf,null))[_0x7a74('0x27')](function(_0x13f075){if(_0x13f075){return _0x13f075['removeAgents'](_0x388136[_0x7a74('0x35')][_0x7a74('0x63')])[_0x7a74('0x27')](function(){if(_[_0x7a74('0x8a')](_0x388136[_0x7a74('0x35')][_0x7a74('0x63')])){for(var _0x583043=0x0;_0x583043<_0x388136[_0x7a74('0x35')][_0x7a74('0x63')][_0x7a74('0x55')];_0x583043+=0x1){socket[_0x7a74('0x6e')](_0x7a74('0x86'),{'UserId':Number(_0x388136['query']['ids'][_0x583043]),'OpenchannelQueueId':Number(_0x388136[_0x7a74('0x51')]['id'])});}}else{socket['emit'](_0x7a74('0x86'),{'UserId':Number(_0x388136['query']['ids']),'OpenchannelQueueId':Number(_0x388136[_0x7a74('0x51')]['id'])});}});}})['then'](respondWithStatusCode(_0x9e46cf,null))['catch'](handleError(_0x9e46cf,null));};exports[_0x7a74('0x8b')]=function(_0x3073aa,_0x2676d7,_0xf72fc4){var _0x2150c4={};var _0x1e3ac3={};var _0x375005;var _0x40332d;return db[_0x7a74('0x2e')]['findOne']({'where':{'id':_0x3073aa[_0x7a74('0x51')]['id']}})[_0x7a74('0x27')](handleEntityNotFound(_0x2676d7,null))['then'](function(_0x4e15c5){if(_0x4e15c5){_0x375005=_0x4e15c5;_0x1e3ac3[_0x7a74('0x33')]=_['keys'](db[_0x7a74('0x65')][_0x7a74('0x2f')]);_0x1e3ac3[_0x7a74('0x35')]=_[_0x7a74('0x44')](_0x3073aa[_0x7a74('0x35')]);_0x1e3ac3[_0x7a74('0x36')]=_[_0x7a74('0x37')](_0x1e3ac3[_0x7a74('0x33')],_0x1e3ac3['query']);_0x2150c4['attributes']=_['intersection'](_0x1e3ac3[_0x7a74('0x33')],qs[_0x7a74('0x39')](_0x3073aa[_0x7a74('0x35')][_0x7a74('0x39')]));_0x2150c4[_0x7a74('0x38')]=_0x2150c4[_0x7a74('0x38')][_0x7a74('0x55')]?_0x2150c4[_0x7a74('0x38')]:_0x1e3ac3[_0x7a74('0x33')];_0x2150c4['order']=qs[_0x7a74('0x3b')](_0x3073aa[_0x7a74('0x35')]['sort']);_0x2150c4[_0x7a74('0x3e')]=qs[_0x7a74('0x36')](_[_0x7a74('0x3c')](_0x3073aa['query'],_0x1e3ac3[_0x7a74('0x36')]));if(_0x3073aa[_0x7a74('0x35')][_0x7a74('0x3d')]){_0x2150c4[_0x7a74('0x3e')]=_[_0x7a74('0x3f')](_0x2150c4[_0x7a74('0x3e')],{'$or':_['map'](_0x2150c4[_0x7a74('0x38')],function(_0x22e977){var _0x21c7d8={};_0x21c7d8[_0x22e977]={'$like':'%'+_0x3073aa[_0x7a74('0x35')]['filter']+'%'};return _0x21c7d8;})});}_0x2150c4=_[_0x7a74('0x3f')]({},_0x2150c4,_0x3073aa[_0x7a74('0x40')]);return _0x375005['getAgents'](_0x2150c4);}})['then'](function(_0x64f799){if(_0x64f799){_0x40332d=_0x64f799[_0x7a74('0x55')];if(!_0x3073aa[_0x7a74('0x35')][_0x7a74('0x56')](_0x7a74('0x3a'))){_0x2150c4[_0x7a74('0x22')]=qs['limit'](_0x3073aa[_0x7a74('0x35')][_0x7a74('0x22')]);_0x2150c4[_0x7a74('0x21')]=qs[_0x7a74('0x21')](_0x3073aa[_0x7a74('0x35')][_0x7a74('0x21')]);}return _0x375005[_0x7a74('0x8b')](_0x2150c4);}})[_0x7a74('0x27')](function(_0x2d71f5){if(_0x2d71f5){return _0x2d71f5?{'count':_0x40332d,'rows':_0x2d71f5}:null;}})[_0x7a74('0x27')](respondWithResult(_0x2676d7,null))[_0x7a74('0x43')](handleError(_0x2676d7,null));}; \ No newline at end of file +var _0x1ce9=['show','params','rawAttributes','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserOpenchannelQueue','User','findAndCountAll','agent','openchannelPause','updatedAt','createdAt','format','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','get','sequelize','transaction','each','forEach','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','union','value','removeAgents','emit','addAgents','spread','isArray','userOpenchannelQueue:remove','getAgents','request-promise','moment','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','OpenchannelQueues','UserProfileResource','error','stack','name','index','map','OpenchannelQueue','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','include','findAll','rows'];(function(_0xb99421,_0xaab133){var _0x4b3ec7=function(_0x591d1a){while(--_0x591d1a){_0xb99421['push'](_0xb99421['shift']());}};_0x4b3ec7(++_0xaab133);}(_0x1ce9,0xca));var _0x91ce=function(_0x8020a6,_0x188878){_0x8020a6=_0x8020a6-0x0;var _0x4e2938=_0x1ce9[_0x8020a6];return _0x4e2938;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x91ce('0x0'));var moment=require(_0x91ce('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x91ce('0x2'));var path=require(_0x91ce('0x3'));var sox=require(_0x91ce('0x4'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x91ce('0x5'));var _=require(_0x91ce('0x6'));var squel=require('squel');var crypto=require(_0x91ce('0x7'));var jsforce=require(_0x91ce('0x8'));var deskjs=require(_0x91ce('0x9'));var toCsv=require(_0x91ce('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x91ce('0xb'));var authService=require(_0x91ce('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x91ce('0xd'));var hardwareService=require(_0x91ce('0xe'));var logger=require(_0x91ce('0xf'))('api');var utils=require('../../config/utils');var config=require(_0x91ce('0x10'));var licenseUtil=require(_0x91ce('0x11'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x91ce('0x12')](config[_0x91ce('0x13')],{'host':_0x91ce('0x14'),'port':0x18eb});var socket=require(_0x91ce('0x15'))(new Redis(config[_0x91ce('0x13')]));require(_0x91ce('0x16'))[_0x91ce('0x17')](socket);function respondWithStatusCode(_0x49dc8b,_0x8bc4be){_0x8bc4be=_0x8bc4be||0xcc;return function(_0xe334b2){if(_0xe334b2){return _0x49dc8b[_0x91ce('0x18')](_0x8bc4be);}return _0x49dc8b[_0x91ce('0x19')](_0x8bc4be)[_0x91ce('0x1a')]();};}function respondWithResult(_0x47d4ae,_0x2cf7bb){_0x2cf7bb=_0x2cf7bb||0xc8;return function(_0x338854){if(_0x338854){return _0x47d4ae[_0x91ce('0x19')](_0x2cf7bb)['json'](_0x338854);}};}function respondWithFilteredResult(_0x33b383,_0x20ee2a){return function(_0x26489f){if(_0x26489f){var _0x313e7f=typeof _0x20ee2a[_0x91ce('0x1b')]===_0x91ce('0x1c')&&typeof _0x20ee2a[_0x91ce('0x1d')]===_0x91ce('0x1c');var _0x34bbf2=_0x26489f[_0x91ce('0x1e')];var _0x117ff8=_0x313e7f?0x0:_0x20ee2a['offset'];var _0x4eaa16=_0x313e7f?_0x26489f[_0x91ce('0x1e')]:_0x20ee2a['offset']+_0x20ee2a[_0x91ce('0x1d')];var _0x4dfd67;if(_0x4eaa16>=_0x34bbf2){_0x4eaa16=_0x34bbf2;_0x4dfd67=0xc8;}else{_0x4dfd67=0xce;}_0x33b383['status'](_0x4dfd67);return _0x33b383[_0x91ce('0x1f')](_0x91ce('0x20'),_0x117ff8+'-'+_0x4eaa16+'/'+_0x34bbf2)['json'](_0x26489f);}return null;};}function patchUpdates(_0x42f96d){return function(_0x326dd9){try{jsonpatch[_0x91ce('0x21')](_0x326dd9,_0x42f96d,!![]);}catch(_0x1501b7){return BPromise['reject'](_0x1501b7);}return _0x326dd9[_0x91ce('0x22')]();};}function saveUpdates(_0x2b5e67,_0x49d51c){return function(_0x50a61f){if(_0x50a61f){return _0x50a61f[_0x91ce('0x23')](_0x2b5e67)[_0x91ce('0x24')](function(_0xd575ad){return _0xd575ad;});}return null;};}function removeEntity(_0x1480c8,_0x51db29){return function(_0x1a659f){if(_0x1a659f){return _0x1a659f[_0x91ce('0x25')]()[_0x91ce('0x24')](function(){var _0x3f624d=_0x1a659f['get']({'plain':!![]});var _0x1328bd=_0x91ce('0x26');return db[_0x91ce('0x27')][_0x91ce('0x25')]({'where':{'type':_0x1328bd,'resourceId':_0x3f624d['id']}})['then'](function(){return _0x1a659f;});})[_0x91ce('0x24')](function(){_0x1480c8[_0x91ce('0x19')](0xcc)[_0x91ce('0x1a')]();});}};}function handleEntityNotFound(_0x482eb4,_0x382e86){return function(_0x3ccaf1){if(!_0x3ccaf1){_0x482eb4[_0x91ce('0x18')](0x194);}return _0x3ccaf1;};}function handleError(_0x1d5bdc,_0x228e8d){_0x228e8d=_0x228e8d||0x1f4;return function(_0x4641cb){logger[_0x91ce('0x28')](_0x4641cb[_0x91ce('0x29')]);if(_0x4641cb[_0x91ce('0x2a')]){delete _0x4641cb['name'];}_0x1d5bdc[_0x91ce('0x19')](_0x228e8d)['send'](_0x4641cb);};}exports[_0x91ce('0x2b')]=function(_0x16abf1,_0x3648ca){var _0x25028c={},_0x3117b9={},_0x2a2e37={'count':0x0,'rows':[]};var _0xacbd21=_[_0x91ce('0x2c')](db[_0x91ce('0x2d')]['rawAttributes'],function(_0x18b872){return{'name':_0x18b872[_0x91ce('0x2e')],'type':_0x18b872[_0x91ce('0x2f')][_0x91ce('0x30')]};});_0x3117b9[_0x91ce('0x31')]=_['map'](_0xacbd21,_0x91ce('0x2a'));_0x3117b9['query']=_[_0x91ce('0x32')](_0x16abf1[_0x91ce('0x33')]);_0x3117b9['filters']=_[_0x91ce('0x34')](_0x3117b9[_0x91ce('0x31')],_0x3117b9[_0x91ce('0x33')]);_0x25028c[_0x91ce('0x35')]=_[_0x91ce('0x34')](_0x3117b9['model'],qs[_0x91ce('0x36')](_0x16abf1[_0x91ce('0x33')][_0x91ce('0x36')]));_0x25028c[_0x91ce('0x35')]=_0x25028c[_0x91ce('0x35')][_0x91ce('0x37')]?_0x25028c[_0x91ce('0x35')]:_0x3117b9[_0x91ce('0x31')];if(!_0x16abf1[_0x91ce('0x33')][_0x91ce('0x38')](_0x91ce('0x39'))){_0x25028c['limit']=qs[_0x91ce('0x1d')](_0x16abf1['query'][_0x91ce('0x1d')]);_0x25028c[_0x91ce('0x1b')]=qs[_0x91ce('0x1b')](_0x16abf1[_0x91ce('0x33')][_0x91ce('0x1b')]);}_0x25028c[_0x91ce('0x3a')]=qs[_0x91ce('0x3b')](_0x16abf1[_0x91ce('0x33')][_0x91ce('0x3b')]);_0x25028c[_0x91ce('0x3c')]=qs['filters'](_[_0x91ce('0x3d')](_0x16abf1[_0x91ce('0x33')],_0x3117b9[_0x91ce('0x3e')]),_0xacbd21);if(_0x16abf1[_0x91ce('0x33')][_0x91ce('0x3f')]){_0x25028c['where']=_['merge'](_0x25028c[_0x91ce('0x3c')],{'$or':_[_0x91ce('0x2c')](_0xacbd21,function(_0x2c5851){if(_0x2c5851[_0x91ce('0x2f')]!==_0x91ce('0x40')){var _0x5e1e41={};_0x5e1e41[_0x2c5851['name']]={'$like':'%'+_0x16abf1[_0x91ce('0x33')]['filter']+'%'};return _0x5e1e41;}})});}_0x25028c=_[_0x91ce('0x41')]({},_0x25028c,_0x16abf1[_0x91ce('0x42')]);var _0x911825={'where':_0x25028c['where']};return db[_0x91ce('0x2d')][_0x91ce('0x1e')](_0x911825)['then'](function(_0xbc43d7){_0x2a2e37[_0x91ce('0x1e')]=_0xbc43d7;if(_0x16abf1['query']['includeAll']){_0x25028c[_0x91ce('0x43')]=[{'all':!![]}];}return db[_0x91ce('0x2d')][_0x91ce('0x44')](_0x25028c);})[_0x91ce('0x24')](function(_0x1239e5){_0x2a2e37[_0x91ce('0x45')]=_0x1239e5;return _0x2a2e37;})['then'](respondWithFilteredResult(_0x3648ca,_0x25028c))['catch'](handleError(_0x3648ca,null));};exports[_0x91ce('0x46')]=function(_0x4866f2,_0x2e076d){var _0x36b471={'raw':!![],'where':{'id':_0x4866f2[_0x91ce('0x47')]['id']}},_0x584fe5={};_0x584fe5[_0x91ce('0x31')]=_[_0x91ce('0x32')](db['OpenchannelQueue'][_0x91ce('0x48')]);_0x584fe5[_0x91ce('0x33')]=_[_0x91ce('0x32')](_0x4866f2[_0x91ce('0x33')]);_0x584fe5[_0x91ce('0x3e')]=_['intersection'](_0x584fe5[_0x91ce('0x31')],_0x584fe5[_0x91ce('0x33')]);_0x36b471['attributes']=_[_0x91ce('0x34')](_0x584fe5[_0x91ce('0x31')],qs[_0x91ce('0x36')](_0x4866f2[_0x91ce('0x33')][_0x91ce('0x36')]));_0x36b471[_0x91ce('0x35')]=_0x36b471['attributes'][_0x91ce('0x37')]?_0x36b471['attributes']:_0x584fe5[_0x91ce('0x31')];if(_0x4866f2['query']['includeAll']){_0x36b471[_0x91ce('0x43')]=[{'all':!![]}];}_0x36b471=_['merge']({},_0x36b471,_0x4866f2[_0x91ce('0x42')]);return db[_0x91ce('0x2d')][_0x91ce('0x49')](_0x36b471)[_0x91ce('0x24')](handleEntityNotFound(_0x2e076d,null))[_0x91ce('0x24')](respondWithResult(_0x2e076d,null))[_0x91ce('0x4a')](handleError(_0x2e076d,null));};exports[_0x91ce('0x4b')]=function(_0x1d38dd,_0x238c7e){return db[_0x91ce('0x2d')][_0x91ce('0x4b')](_0x1d38dd['body'],{})[_0x91ce('0x24')](function(_0x331935){var _0xb33460=_0x1d38dd[_0x91ce('0x4c')]['get']({'plain':!![]});if(!_0xb33460)throw new Error(_0x91ce('0x4d'));if(_0xb33460[_0x91ce('0x4e')]===_0x91ce('0x4c')){var _0x1e73f5=_0x331935['get']({'plain':!![]});var _0x2ca2ab=_0x91ce('0x26');return db[_0x91ce('0x4f')]['find']({'where':{'name':_0x2ca2ab,'userProfileId':_0xb33460[_0x91ce('0x50')]},'raw':!![]})['then'](function(_0x458248){if(_0x458248&&_0x458248['autoAssociation']===0x0){return db[_0x91ce('0x27')]['create']({'name':_0x1e73f5['name'],'resourceId':_0x1e73f5['id'],'type':_0x458248['name'],'sectionId':_0x458248['id']},{})[_0x91ce('0x24')](function(){return _0x331935;});}else{return _0x331935;}})['catch'](function(_0x2c39f0){logger[_0x91ce('0x28')](_0x91ce('0x51'),_0x2c39f0);throw _0x2c39f0;});}return _0x331935;})[_0x91ce('0x24')](respondWithResult(_0x238c7e,0xc9))[_0x91ce('0x4a')](handleError(_0x238c7e,null));};exports[_0x91ce('0x23')]=function(_0x51619f,_0x2c522e){if(_0x51619f[_0x91ce('0x52')]['id']){delete _0x51619f[_0x91ce('0x52')]['id'];}return db[_0x91ce('0x2d')][_0x91ce('0x49')]({'where':{'id':_0x51619f[_0x91ce('0x47')]['id']}})['then'](handleEntityNotFound(_0x2c522e,null))[_0x91ce('0x24')](saveUpdates(_0x51619f[_0x91ce('0x52')],null))[_0x91ce('0x24')](respondWithResult(_0x2c522e,null))[_0x91ce('0x4a')](handleError(_0x2c522e,null));};exports[_0x91ce('0x25')]=function(_0x1c069e,_0x36e50a){return db[_0x91ce('0x2d')][_0x91ce('0x49')]({'where':{'id':_0x1c069e[_0x91ce('0x47')]['id']}})[_0x91ce('0x24')](handleEntityNotFound(_0x36e50a,null))[_0x91ce('0x24')](removeEntity(_0x36e50a,null))['catch'](handleError(_0x36e50a,null));};exports[_0x91ce('0x53')]=function(_0x3a9cd3,_0x3e1611){return db[_0x91ce('0x2d')][_0x91ce('0x53')]()['then'](respondWithResult(_0x3e1611,null))[_0x91ce('0x4a')](handleError(_0x3e1611,null));};exports[_0x91ce('0x54')]=function(_0xfe914a,_0x2b552a,_0xe6e0c4){var _0xf8b735={'raw':!![],'where':{}},_0x29e28f={},_0x2cac8b;return db[_0x91ce('0x2d')][_0x91ce('0x55')]({'where':{'id':_0xfe914a[_0x91ce('0x47')]['id']}})[_0x91ce('0x24')](handleEntityNotFound(_0x2b552a,null))[_0x91ce('0x24')](function(_0x3dc6b1){if(_0x3dc6b1){_0x2cac8b=_0x3dc6b1['get']({'plain':!![]});_0x29e28f['model']=_[_0x91ce('0x32')](db[_0x91ce('0x56')][_0x91ce('0x48')]);_0x29e28f[_0x91ce('0x33')]=_[_0x91ce('0x32')](_0xfe914a['query']);_0x29e28f[_0x91ce('0x3e')]=_[_0x91ce('0x34')](_0x29e28f['model'],_0x29e28f[_0x91ce('0x33')]);_0xf8b735['attributes']=_[_0x91ce('0x34')](_0x29e28f[_0x91ce('0x31')],qs[_0x91ce('0x36')](_0xfe914a[_0x91ce('0x33')][_0x91ce('0x36')]));_0xf8b735[_0x91ce('0x35')]=_0xf8b735[_0x91ce('0x35')][_0x91ce('0x37')]?_0xf8b735['attributes']:_0x29e28f[_0x91ce('0x31')];if(!_0xfe914a[_0x91ce('0x33')][_0x91ce('0x38')](_0x91ce('0x39'))){_0xf8b735['limit']=qs['limit'](_0xfe914a[_0x91ce('0x33')][_0x91ce('0x1d')]);_0xf8b735[_0x91ce('0x1b')]=qs['offset'](_0xfe914a[_0x91ce('0x33')][_0x91ce('0x1b')]);}_0xf8b735[_0x91ce('0x3a')]=qs[_0x91ce('0x3b')](_0xfe914a[_0x91ce('0x33')][_0x91ce('0x3b')]);_0xf8b735[_0x91ce('0x3c')]=qs[_0x91ce('0x3e')](_[_0x91ce('0x3d')](_0xfe914a['query'],_0x29e28f[_0x91ce('0x3e')]));_0xf8b735[_0x91ce('0x3c')]['OpenchannelQueueId']=_0x3dc6b1['id'];if(_0xfe914a['query'][_0x91ce('0x3f')]){_0xf8b735[_0x91ce('0x3c')]=_[_0x91ce('0x41')](_0xf8b735['where'],{'$or':_[_0x91ce('0x2c')](_0xf8b735['attributes'],function(_0x4bff96){var _0x472875={};_0x472875[_0x4bff96]={'$like':'%'+_0xfe914a[_0x91ce('0x33')]['filter']+'%'};return _0x472875;})});}_0xf8b735=_[_0x91ce('0x41')]({},_0xf8b735,_0xfe914a[_0x91ce('0x42')]);return db[_0x91ce('0x56')]['findAll'](_0xf8b735);}})['then'](function(_0x348ace){if(_0x348ace){return db[_0x91ce('0x57')][_0x91ce('0x58')]({'where':{'id':_[_0x91ce('0x2c')](_0x348ace,'UserId'),'role':_0x91ce('0x59')},'attributes':['id',_0x91ce('0x2a'),_0x91ce('0x5a'),_0x91ce('0x5b'),_0x91ce('0x5c')]});}})[_0x91ce('0x24')](function(_0x580a27){if(_0x580a27){return{'count':_0x580a27[_0x91ce('0x1e')],'rows':_[_0x91ce('0x2c')](_0x580a27[_0x91ce('0x45')],function(_0x22e7f6){return{'membername':_0x22e7f6[_0x91ce('0x2a')],'UserId':_0x22e7f6['id'],'queue_name':_0x2cac8b[_0x91ce('0x2a')],'OpenchannelQueueId':_0x2cac8b['id'],'interface':util[_0x91ce('0x5d')]('%s/%s',_0x91ce('0x5e'),_0x22e7f6[_0x91ce('0x2a')]),'penalty':0x0,'paused':_0x22e7f6[_0x91ce('0x5a')],'createdAt':_0x22e7f6['createdAt'],'updatedAt':_0x22e7f6['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2b552a,_0xf8b735))['catch'](handleError(_0x2b552a,null));};exports[_0x91ce('0x5f')]=function(_0x3a1f32,_0x39f7a8,_0x29ee22){var _0x464b0b={};var _0xb6bc41={};var _0x35fec5;var _0x37e01c;return db[_0x91ce('0x2d')][_0x91ce('0x55')]({'where':{'id':_0x3a1f32[_0x91ce('0x47')]['id']}})[_0x91ce('0x24')](handleEntityNotFound(_0x39f7a8,null))[_0x91ce('0x24')](function(_0x4ba88e){if(_0x4ba88e){_0x35fec5=_0x4ba88e;_0xb6bc41['model']=_[_0x91ce('0x32')](db[_0x91ce('0x60')][_0x91ce('0x48')]);_0xb6bc41[_0x91ce('0x33')]=_['keys'](_0x3a1f32['query']);_0xb6bc41[_0x91ce('0x3e')]=_[_0x91ce('0x34')](_0xb6bc41[_0x91ce('0x31')],_0xb6bc41[_0x91ce('0x33')]);_0x464b0b[_0x91ce('0x35')]=_[_0x91ce('0x34')](_0xb6bc41[_0x91ce('0x31')],qs[_0x91ce('0x36')](_0x3a1f32[_0x91ce('0x33')][_0x91ce('0x36')]));_0x464b0b[_0x91ce('0x35')]=_0x464b0b['attributes']['length']?_0x464b0b['attributes']:_0xb6bc41[_0x91ce('0x31')];_0x464b0b[_0x91ce('0x3a')]=qs[_0x91ce('0x3b')](_0x3a1f32[_0x91ce('0x33')][_0x91ce('0x3b')]);_0x464b0b[_0x91ce('0x3c')]=qs[_0x91ce('0x3e')](_[_0x91ce('0x3d')](_0x3a1f32[_0x91ce('0x33')],_0xb6bc41[_0x91ce('0x3e')]));if(_0x3a1f32[_0x91ce('0x33')][_0x91ce('0x3f')]){_0x464b0b[_0x91ce('0x3c')]=_[_0x91ce('0x41')](_0x464b0b[_0x91ce('0x3c')],{'$or':_['map'](_0x464b0b[_0x91ce('0x35')],function(_0x28af1e){var _0x1d3a03={};_0x1d3a03[_0x28af1e]={'$like':'%'+_0x3a1f32[_0x91ce('0x33')]['filter']+'%'};return _0x1d3a03;})});}_0x464b0b=_[_0x91ce('0x41')]({},_0x464b0b,_0x3a1f32[_0x91ce('0x42')]);return _0x35fec5['getTeams'](_0x464b0b);}})[_0x91ce('0x24')](function(_0x49292e){if(_0x49292e){_0x37e01c=_0x49292e[_0x91ce('0x37')];if(!_0x3a1f32[_0x91ce('0x33')][_0x91ce('0x38')](_0x91ce('0x39'))){_0x464b0b[_0x91ce('0x1d')]=qs[_0x91ce('0x1d')](_0x3a1f32[_0x91ce('0x33')][_0x91ce('0x1d')]);_0x464b0b[_0x91ce('0x1b')]=qs[_0x91ce('0x1b')](_0x3a1f32[_0x91ce('0x33')][_0x91ce('0x1b')]);}return _0x35fec5[_0x91ce('0x5f')](_0x464b0b);}})[_0x91ce('0x24')](function(_0x14cdef){if(_0x14cdef){return _0x14cdef?{'count':_0x37e01c,'rows':_0x14cdef}:null;}})['then'](respondWithResult(_0x39f7a8,null))['catch'](handleError(_0x39f7a8,null));};exports[_0x91ce('0x61')]=function(_0x2cceb4,_0x2b6910,_0x470f9b){var _0xf50fd1=_0x2cceb4[_0x91ce('0x52')][_0x91ce('0x62')];return db[_0x91ce('0x60')][_0x91ce('0x44')]({'where':{'id':_0xf50fd1},'attributes':['id'],'include':[{'model':db['User'],'as':_0x91ce('0x63'),'attributes':['id',_0x91ce('0x2a'),_0x91ce('0x64'),_0x91ce('0x65'),_0x91ce('0x66')],'raw':!![]}]})[_0x91ce('0x24')](function(_0x3bb5d9){if(_0x3bb5d9){var _0x5836ae=_[_0x91ce('0x67')](_0x3bb5d9,function(_0xeb5ef6){var _0x325e80=_0xeb5ef6[_0x91ce('0x68')]({'plain':!![]});return _0x325e80[_0x91ce('0x63')];});return db[_0x91ce('0x2d')][_0x91ce('0x49')]({'where':{'id':_0x2cceb4[_0x91ce('0x47')]['id']}})['then'](function(_0x3d09f5){return db[_0x91ce('0x69')][_0x91ce('0x6a')](function(_0x288ac3){return _0x3d09f5['addTeams'](_0xf50fd1,{'transaction':_0x288ac3})[_0x91ce('0x24')](function(){return BPromise[_0x91ce('0x6b')](_0x5836ae,function(_0x13fcca){return db[_0x91ce('0x56')]['findOrCreate']({'where':{'UserId':_0x13fcca['id'],'OpenchannelQueueId':_0x2cceb4['params']['id']},'transaction':_0x288ac3});});})[_0x91ce('0x24')](function(){_0x5836ae[_0x91ce('0x6c')](function(_0x4afc41){socket['emit'](_0x91ce('0x6d'),{'UserId':_0x4afc41['id'],'OpenchannelQueueId':_0x3d09f5['id']});});});});});}})['then'](respondWithStatusCode(_0x2b6910,null))['catch'](handleError(_0x2b6910,null));};exports[_0x91ce('0x6e')]=function(_0x4d6d9d,_0x40ad3b,_0xc94a3e){return db[_0x91ce('0x60')][_0x91ce('0x44')]({'where':{'id':_0x4d6d9d[_0x91ce('0x33')]['ids']},'attributes':['id'],'include':[{'model':db[_0x91ce('0x57')],'as':_0x91ce('0x63'),'attributes':['id'],'raw':!![]}]})[_0x91ce('0x24')](handleEntityNotFound(_0x40ad3b,null))[_0x91ce('0x24')](function(_0x7bf544){var _0x7b284b=_['map'](_0x7bf544,'id');var _0x256654=[];var _0x593ec3=[];var _0x198ed0=squel[_0x91ce('0x6f')]();_0x198ed0[_0x91ce('0x70')](_0x91ce('0x71'))[_0x91ce('0x72')](_0x91ce('0x73'),'tq')[_0x91ce('0x74')](_0x91ce('0x75'),'ut',_0x91ce('0x76'))[_0x91ce('0x3c')](_0x91ce('0x77'),_0x4d6d9d[_0x91ce('0x47')]['id']);for(var _0x4d9e08=0x0;_0x4d9e08<_0x7bf544[_0x91ce('0x37')];_0x4d9e08+=0x1){let _0x1f346c=_0x7bf544[_0x4d9e08];for(var _0x347a78=0x0;_0x347a78<_0x1f346c[_0x91ce('0x63')][_0x91ce('0x37')];_0x347a78+=0x1){let _0x2f18df=_0x1f346c[_0x91ce('0x63')][_0x347a78];var _0x5e9e4a=_0x198ed0['clone']();_0x5e9e4a['where'](_0x91ce('0x78'),_0x2f18df['id']);_0x593ec3[_0x91ce('0x79')](db[_0x91ce('0x69')][_0x91ce('0x33')](_0x5e9e4a[_0x91ce('0x7a')](),{'type':db['sequelize']['QueryTypes'][_0x91ce('0x7b')]})[_0x91ce('0x24')](function(_0x447bbb){if(_0x447bbb['length']===0x1){return _0x2f18df['id'];}else{var _0x28c6a5=_[_0x91ce('0x7c')](_[_0x91ce('0x2c')](_0x447bbb,_0x91ce('0x7d')),function(_0xe5bb72){return _[_0x91ce('0x7e')](_0x7b284b,_0xe5bb72);});if(_0x28c6a5){return _0x2f18df['id'];}}}));}}return BPromise['all'](_0x593ec3)[_0x91ce('0x24')](function(_0x2df929){_0x256654=_(_0x256654)[_0x91ce('0x7f')](_0x2df929)['compact']()[_0x91ce('0x80')]();return db[_0x91ce('0x2d')]['find']({'where':{'id':_0x4d6d9d[_0x91ce('0x47')]['id']}})[_0x91ce('0x24')](function(_0xb8a1d8){return db['sequelize'][_0x91ce('0x6a')](function(_0x565312){return _0xb8a1d8[_0x91ce('0x6e')](_0x4d6d9d[_0x91ce('0x33')][_0x91ce('0x62')],{'transaction':_0x565312})[_0x91ce('0x24')](function(){if(!_['isEmpty'](_0x256654)){return _0xb8a1d8[_0x91ce('0x81')](_0x256654,{'transaction':_0x565312});}})[_0x91ce('0x24')](function(){_0x256654['forEach'](function(_0xaf4829){socket[_0x91ce('0x82')]('userOpenchannelQueue:remove',{'UserId':_0xaf4829,'OpenchannelQueueId':_0xb8a1d8['id']});});});});});});})[_0x91ce('0x24')](respondWithStatusCode(_0x40ad3b,null))[_0x91ce('0x4a')](handleError(_0x40ad3b,null));};exports[_0x91ce('0x83')]=function(_0x1f3722,_0x127e27,_0x493029){return db[_0x91ce('0x2d')][_0x91ce('0x49')]({'where':{'id':_0x1f3722[_0x91ce('0x47')]['id']}})[_0x91ce('0x24')](handleEntityNotFound(_0x127e27,null))[_0x91ce('0x24')](function(_0x1b6731){if(_0x1b6731){return _0x1b6731[_0x91ce('0x83')](_0x1f3722[_0x91ce('0x52')][_0x91ce('0x62')],_['omit'](_0x1f3722[_0x91ce('0x52')],['ids','id'])||{})[_0x91ce('0x84')](function(_0x2ed977){for(var _0x3b8d0a=0x0;_0x3b8d0a<_0x1f3722['body']['ids'][_0x91ce('0x37')];_0x3b8d0a+=0x1){socket['emit']('userOpenchannelQueue:save',{'UserId':Number(_0x1f3722[_0x91ce('0x52')][_0x91ce('0x62')][_0x3b8d0a]),'OpenchannelQueueId':Number(_0x1f3722[_0x91ce('0x47')]['id'])});}return _0x2ed977;});}})[_0x91ce('0x24')](respondWithResult(_0x127e27,null))['catch'](handleError(_0x127e27,null));};exports['removeAgents']=function(_0x42020c,_0x5ccda1,_0x4964ee){return db[_0x91ce('0x2d')][_0x91ce('0x49')]({'where':{'id':_0x42020c[_0x91ce('0x47')]['id']}})['then'](handleEntityNotFound(_0x5ccda1,null))[_0x91ce('0x24')](function(_0x4402ce){if(_0x4402ce){return _0x4402ce[_0x91ce('0x81')](_0x42020c[_0x91ce('0x33')][_0x91ce('0x62')])[_0x91ce('0x24')](function(){if(_[_0x91ce('0x85')](_0x42020c[_0x91ce('0x33')]['ids'])){for(var _0x462e2f=0x0;_0x462e2f<_0x42020c[_0x91ce('0x33')]['ids'][_0x91ce('0x37')];_0x462e2f+=0x1){socket['emit'](_0x91ce('0x86'),{'UserId':Number(_0x42020c['query']['ids'][_0x462e2f]),'OpenchannelQueueId':Number(_0x42020c[_0x91ce('0x47')]['id'])});}}else{socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x42020c['query']['ids']),'OpenchannelQueueId':Number(_0x42020c[_0x91ce('0x47')]['id'])});}});}})['then'](respondWithStatusCode(_0x5ccda1,null))[_0x91ce('0x4a')](handleError(_0x5ccda1,null));};exports[_0x91ce('0x87')]=function(_0x1188aa,_0x1cf6e6,_0x19995f){var _0x51ca99={};var _0x99809d={};var _0x272cdd;var _0x3f9f65;return db[_0x91ce('0x2d')][_0x91ce('0x55')]({'where':{'id':_0x1188aa[_0x91ce('0x47')]['id']}})[_0x91ce('0x24')](handleEntityNotFound(_0x1cf6e6,null))['then'](function(_0x296f86){if(_0x296f86){_0x272cdd=_0x296f86;_0x99809d[_0x91ce('0x31')]=_[_0x91ce('0x32')](db[_0x91ce('0x57')][_0x91ce('0x48')]);_0x99809d[_0x91ce('0x33')]=_['keys'](_0x1188aa['query']);_0x99809d['filters']=_[_0x91ce('0x34')](_0x99809d[_0x91ce('0x31')],_0x99809d[_0x91ce('0x33')]);_0x51ca99['attributes']=_[_0x91ce('0x34')](_0x99809d[_0x91ce('0x31')],qs[_0x91ce('0x36')](_0x1188aa['query'][_0x91ce('0x36')]));_0x51ca99[_0x91ce('0x35')]=_0x51ca99[_0x91ce('0x35')]['length']?_0x51ca99[_0x91ce('0x35')]:_0x99809d['model'];_0x51ca99['order']=qs[_0x91ce('0x3b')](_0x1188aa['query'][_0x91ce('0x3b')]);_0x51ca99['where']=qs['filters'](_['pick'](_0x1188aa[_0x91ce('0x33')],_0x99809d['filters']));if(_0x1188aa['query'][_0x91ce('0x3f')]){_0x51ca99['where']=_['merge'](_0x51ca99['where'],{'$or':_[_0x91ce('0x2c')](_0x51ca99[_0x91ce('0x35')],function(_0xf85a8b){var _0x580376={};_0x580376[_0xf85a8b]={'$like':'%'+_0x1188aa[_0x91ce('0x33')][_0x91ce('0x3f')]+'%'};return _0x580376;})});}_0x51ca99=_[_0x91ce('0x41')]({},_0x51ca99,_0x1188aa['options']);return _0x272cdd[_0x91ce('0x87')](_0x51ca99);}})[_0x91ce('0x24')](function(_0x4398c0){if(_0x4398c0){_0x3f9f65=_0x4398c0[_0x91ce('0x37')];if(!_0x1188aa[_0x91ce('0x33')][_0x91ce('0x38')](_0x91ce('0x39'))){_0x51ca99[_0x91ce('0x1d')]=qs[_0x91ce('0x1d')](_0x1188aa[_0x91ce('0x33')][_0x91ce('0x1d')]);_0x51ca99[_0x91ce('0x1b')]=qs[_0x91ce('0x1b')](_0x1188aa[_0x91ce('0x33')][_0x91ce('0x1b')]);}return _0x272cdd[_0x91ce('0x87')](_0x51ca99);}})[_0x91ce('0x24')](function(_0x59aba4){if(_0x59aba4){return _0x59aba4?{'count':_0x3f9f65,'rows':_0x59aba4}:null;}})['then'](respondWithResult(_0x1cf6e6,null))[_0x91ce('0x4a')](handleError(_0x1cf6e6,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 7e0bcfb..257b8a4 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 _0xd12b=['setMaxListeners','remove','emit','hook','exports','events','../../mysqldb','OpenchannelQueue'];(function(_0x5c9286,_0x4c9b3f){var _0xee8463=function(_0x5ee461){while(--_0x5ee461){_0x5c9286['push'](_0x5c9286['shift']());}};_0xee8463(++_0x4c9b3f);}(_0xd12b,0x135));var _0xbd12=function(_0x5b0741,_0x438df7){_0x5b0741=_0x5b0741-0x0;var _0x3ee9c9=_0xd12b[_0x5b0741];return _0x3ee9c9;};'use strict';var EventEmitter=require(_0xbd12('0x0'));var OpenchannelQueue=require(_0xbd12('0x1'))['db'][_0xbd12('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xbd12('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xbd12('0x4')};function emitEvent(_0x39264c){return function(_0xe9bf8c,_0x28473a,_0x3a03e6){OpenchannelQueueEvents[_0xbd12('0x5')](_0x39264c+':'+_0xe9bf8c['id'],_0xe9bf8c);OpenchannelQueueEvents['emit'](_0x39264c,_0xe9bf8c);_0x3a03e6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0xbd12('0x6')](e,emitEvent(event));}}module[_0xbd12('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xb6eb=['save','update','remove','emit','hasOwnProperty','hook','exports','events','OpenchannelQueue','setMaxListeners'];(function(_0x433c11,_0x509a13){var _0x1bbb06=function(_0x54697b){while(--_0x54697b){_0x433c11['push'](_0x433c11['shift']());}};_0x1bbb06(++_0x509a13);}(_0xb6eb,0x16f));var _0xbb6e=function(_0x329e13,_0x4fcf0b){_0x329e13=_0x329e13-0x0;var _0x55c713=_0xb6eb[_0x329e13];return _0x55c713;};'use strict';var EventEmitter=require(_0xbb6e('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0xbb6e('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xbb6e('0x2')](0x0);var events={'afterCreate':_0xbb6e('0x3'),'afterUpdate':_0xbb6e('0x4'),'afterDestroy':_0xbb6e('0x5')};function emitEvent(_0x207731){return function(_0x2ec452,_0x40a859,_0x3127cf){OpenchannelQueueEvents['emit'](_0x207731+':'+_0x2ec452['id'],_0x2ec452);OpenchannelQueueEvents[_0xbb6e('0x6')](_0x207731,_0x2ec452);_0x3127cf(null);};}for(var e in events){if(events[_0xbb6e('0x7')](e)){var event=events[e];OpenchannelQueue[_0xbb6e('0x8')](e,emitEvent(event));}}module[_0xbb6e('0x9')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 05bbaf8..d2c95cb 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 _0x10b8=['api','moment','path','rimraf','../../config/environment','exports','define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger'];(function(_0x1ab0dd,_0x37e3b1){var _0x58107a=function(_0x255cc2){while(--_0x255cc2){_0x1ab0dd['push'](_0x1ab0dd['shift']());}};_0x58107a(++_0x37e3b1);}(_0x10b8,0x11d));var _0x810b=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x10b8[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x810b('0x0'));var util=require(_0x810b('0x1'));var logger=require(_0x810b('0x2'))(_0x810b('0x3'));var moment=require(_0x810b('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x810b('0x5'));var rimraf=require(_0x810b('0x6'));var config=require(_0x810b('0x7'));var attributes=require('./openchannelQueue.attributes');module[_0x810b('0x8')]=function(_0x10a7ec,_0x1c84c8){return _0x10a7ec[_0x810b('0x9')](_0x810b('0xa'),attributes,{'tableName':_0x810b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x650e=['openchannel_queues','lodash','util','api','moment','bluebird','request-promise','rimraf','./openchannelQueue.attributes','exports','OpenchannelQueue'];(function(_0x5b8310,_0x77ea6f){var _0xd3ebc1=function(_0x9dfb29){while(--_0x9dfb29){_0x5b8310['push'](_0x5b8310['shift']());}};_0xd3ebc1(++_0x77ea6f);}(_0x650e,0x135));var _0xe650=function(_0x4d71b3,_0x52c4ba){_0x4d71b3=_0x4d71b3-0x0;var _0x1da1a9=_0x650e[_0x4d71b3];return _0x1da1a9;};'use strict';var _=require(_0xe650('0x0'));var util=require(_0xe650('0x1'));var logger=require('../../config/logger')(_0xe650('0x2'));var moment=require(_0xe650('0x3'));var BPromise=require(_0xe650('0x4'));var rp=require(_0xe650('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe650('0x6'));var config=require('../../config/environment');var attributes=require(_0xe650('0x7'));module[_0xe650('0x8')]=function(_0x32591d,_0x49cc1d){return _0x32591d['define'](_0xe650('0x9'),attributes,{'tableName':_0xe650('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 3101d66..531ccff 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 _0x8317=['then','info','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','attributes','include','model','map','ShowOpenchannelQueue','where','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket'];(function(_0x30a7b9,_0xcd5c43){var _0x219429=function(_0x34d1bb){while(--_0x34d1bb){_0x30a7b9['push'](_0x30a7b9['shift']());}};_0x219429(++_0xcd5c43);}(_0x8317,0x7f));var _0x7831=function(_0x565d9a,_0x1ae10d){_0x565d9a=_0x565d9a-0x0;var _0x11a9e3=_0x8317[_0x565d9a];return _0x11a9e3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7831('0x0'));var BPromise=require(_0x7831('0x1'));var rs=require(_0x7831('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7831('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7831('0x4'))('rpc');var config=require(_0x7831('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x7831('0x6')][_0x7831('0x7')]({'port':0x232a});config[_0x7831('0x8')]=_[_0x7831('0x9')](config[_0x7831('0x8')],{'host':_0x7831('0xa'),'port':0x18eb});var socket=require(_0x7831('0xb'))(new Redis(config[_0x7831('0x8')]));require(_0x7831('0xc'))['register'](socket);function respondWithRpcPromise(_0xe31222,_0x223ce8,_0x6d3924){return new BPromise(function(_0xeb50b0,_0x3b5c8e){return client['request'](_0xe31222,_0x6d3924)[_0x7831('0xd')](function(_0x147afa){logger[_0x7831('0xe')](_0x7831('0xf'),_0x223ce8,'request\x20sent');logger[_0x7831('0x10')](_0x7831('0x11'),_0x223ce8,'request\x20sent',JSON[_0x7831('0x12')](_0x147afa));if(_0x147afa[_0x7831('0x13')]){if(_0x147afa[_0x7831('0x13')][_0x7831('0x14')]===0x1f4){logger['error'](_0x7831('0xf'),_0x223ce8,_0x147afa['error'][_0x7831('0x15')]);return _0x3b5c8e(_0x147afa[_0x7831('0x13')][_0x7831('0x15')]);}logger[_0x7831('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x223ce8,_0x147afa['error'][_0x7831('0x15')]);return _0xeb50b0(_0x147afa[_0x7831('0x13')][_0x7831('0x15')]);}else{logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x223ce8,'request\x20sent');_0xeb50b0(_0x147afa[_0x7831('0x16')]['message']);}})[_0x7831('0x17')](function(_0x6d53b1){logger['error'](_0x7831('0xf'),_0x223ce8,_0x6d53b1);_0x3b5c8e(_0x6d53b1);});});}exports[_0x7831('0x18')]=function(_0x34bcf3){var _0x22406d=this;return new Promise(function(_0x9d803f,_0x21f0bc){return db[_0x7831('0x19')][_0x7831('0x1a')]({'raw':_0x34bcf3[_0x7831('0x1b')]?_0x34bcf3[_0x7831('0x1b')][_0x7831('0x1c')]===undefined?!![]:![]:!![],'where':_0x34bcf3[_0x7831('0x1b')]?_0x34bcf3['options']['where']||null:null,'attributes':_0x34bcf3['options']?_0x34bcf3[_0x7831('0x1b')][_0x7831('0x1d')]||null:null,'limit':_0x34bcf3[_0x7831('0x1b')]?_0x34bcf3[_0x7831('0x1b')]['limit']||null:null,'include':_0x34bcf3[_0x7831('0x1b')]?_0x34bcf3[_0x7831('0x1b')][_0x7831('0x1e')]?_['map'](_0x34bcf3[_0x7831('0x1b')][_0x7831('0x1e')],function(_0x20894c){return{'model':db[_0x20894c[_0x7831('0x1f')]],'as':_0x20894c['as'],'attributes':_0x20894c[_0x7831('0x1d')],'include':_0x20894c[_0x7831('0x1e')]?_[_0x7831('0x20')](_0x20894c[_0x7831('0x1e')],function(_0x20448f){return{'model':db[_0x20448f['model']],'as':_0x20448f['as'],'attributes':_0x20448f[_0x7831('0x1d')],'include':_0x20448f[_0x7831('0x1e')]?_['map'](_0x20448f[_0x7831('0x1e')],function(_0x184fa8){return{'model':db[_0x184fa8[_0x7831('0x1f')]],'as':_0x184fa8['as'],'attributes':_0x184fa8[_0x7831('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f0954){logger[_0x7831('0xe')](_0x7831('0x18'),_0x34bcf3);logger[_0x7831('0x10')](_0x7831('0x18'),_0x34bcf3,JSON['stringify'](_0x1f0954));_0x9d803f(_0x1f0954);})[_0x7831('0x17')](function(_0x51a66f){logger[_0x7831('0x13')](_0x7831('0x18'),_0x51a66f[_0x7831('0x15')],_0x34bcf3);_0x21f0bc(_0x22406d['error'](0x1f4,_0x51a66f['message']));});});};exports[_0x7831('0x21')]=function(_0x47551f){var _0x31e537=this;return new Promise(function(_0x2974d9,_0x3fab7c){return db['OpenchannelQueue']['find']({'raw':_0x47551f[_0x7831('0x1b')]?_0x47551f['options']['raw']===undefined?!![]:![]:!![],'where':_0x47551f['options']?_0x47551f[_0x7831('0x1b')][_0x7831('0x22')]||null:null,'attributes':_0x47551f[_0x7831('0x1b')]?_0x47551f[_0x7831('0x1b')][_0x7831('0x1d')]||null:null,'include':_0x47551f['options']?_0x47551f[_0x7831('0x1b')]['include']?_[_0x7831('0x20')](_0x47551f[_0x7831('0x1b')][_0x7831('0x1e')],function(_0xc8837){return{'model':db[_0xc8837[_0x7831('0x1f')]],'as':_0xc8837['as'],'attributes':_0xc8837[_0x7831('0x1d')],'include':_0xc8837[_0x7831('0x1e')]?_[_0x7831('0x20')](_0xc8837['include'],function(_0x224b0c){return{'model':db[_0x224b0c[_0x7831('0x1f')]],'as':_0x224b0c['as'],'attributes':_0x224b0c[_0x7831('0x1d')],'include':_0x224b0c['include']?_['map'](_0x224b0c[_0x7831('0x1e')],function(_0xdffb26){return{'model':db[_0xdffb26['model']],'as':_0xdffb26['as'],'attributes':_0xdffb26[_0x7831('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7831('0xd')](function(_0xc46a1f){logger[_0x7831('0xe')](_0x7831('0x21'),_0x47551f);logger['debug'](_0x7831('0x21'),_0x47551f,JSON[_0x7831('0x12')](_0xc46a1f));_0x2974d9(_0xc46a1f);})[_0x7831('0x17')](function(_0x9c869){logger[_0x7831('0x13')]('ShowOpenchannelQueue',_0x9c869[_0x7831('0x15')],_0x47551f);_0x3fab7c(_0x31e537[_0x7831('0x13')](0x1f4,_0x9c869[_0x7831('0x15')]));});});}; \ No newline at end of file +var _0x4b2a=['debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','OpenchannelQueue,\x20%s,\x20%s','message','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowOpenchannelQueue','find','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','then','info','request\x20sent'];(function(_0x20faa3,_0xa8151d){var _0x2ebc7f=function(_0x9f5d12){while(--_0x9f5d12){_0x20faa3['push'](_0x20faa3['shift']());}};_0x2ebc7f(++_0xa8151d);}(_0x4b2a,0x19a));var _0xa4b2=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4b2a[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xa4b2('0x0'));var util=require('util');var moment=require(_0xa4b2('0x1'));var BPromise=require(_0xa4b2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa4b2('0x3'))['db'];var utils=require(_0xa4b2('0x4'));var logger=require(_0xa4b2('0x5'))(_0xa4b2('0x6'));var config=require(_0xa4b2('0x7'));var jayson=require(_0xa4b2('0x8'));var client=jayson['client'][_0xa4b2('0x9')]({'port':0x232a});config[_0xa4b2('0xa')]=_[_0xa4b2('0xb')](config[_0xa4b2('0xa')],{'host':_0xa4b2('0xc'),'port':0x18eb});var socket=require(_0xa4b2('0xd'))(new Redis(config[_0xa4b2('0xa')]));require(_0xa4b2('0xe'))[_0xa4b2('0xf')](socket);function respondWithRpcPromise(_0x1ba7bb,_0x36149a,_0x297abb){return new BPromise(function(_0x3330c4,_0x499d47){return client['request'](_0x1ba7bb,_0x297abb)[_0xa4b2('0x10')](function(_0x780be4){logger[_0xa4b2('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x36149a,_0xa4b2('0x12'));logger[_0xa4b2('0x13')](_0xa4b2('0x14'),_0x36149a,'request\x20sent',JSON['stringify'](_0x780be4));if(_0x780be4['error']){if(_0x780be4['error']['code']===0x1f4){logger[_0xa4b2('0x15')](_0xa4b2('0x16'),_0x36149a,_0x780be4[_0xa4b2('0x15')][_0xa4b2('0x17')]);return _0x499d47(_0x780be4[_0xa4b2('0x15')]['message']);}logger[_0xa4b2('0x15')](_0xa4b2('0x16'),_0x36149a,_0x780be4['error'][_0xa4b2('0x17')]);return _0x3330c4(_0x780be4[_0xa4b2('0x15')]['message']);}else{logger[_0xa4b2('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x36149a,_0xa4b2('0x12'));_0x3330c4(_0x780be4['result']['message']);}})[_0xa4b2('0x18')](function(_0x1cdff3){logger[_0xa4b2('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x36149a,_0x1cdff3);_0x499d47(_0x1cdff3);});});}exports[_0xa4b2('0x19')]=function(_0x54b5c6){var _0x1777e6=this;return new Promise(function(_0x1a3f06,_0xc19cc0){return db[_0xa4b2('0x1a')][_0xa4b2('0x1b')]({'raw':_0x54b5c6[_0xa4b2('0x1c')]?_0x54b5c6['options'][_0xa4b2('0x1d')]===undefined?!![]:![]:!![],'where':_0x54b5c6[_0xa4b2('0x1c')]?_0x54b5c6['options'][_0xa4b2('0x1e')]||null:null,'attributes':_0x54b5c6['options']?_0x54b5c6[_0xa4b2('0x1c')][_0xa4b2('0x1f')]||null:null,'limit':_0x54b5c6[_0xa4b2('0x1c')]?_0x54b5c6[_0xa4b2('0x1c')][_0xa4b2('0x20')]||null:null,'include':_0x54b5c6[_0xa4b2('0x1c')]?_0x54b5c6[_0xa4b2('0x1c')][_0xa4b2('0x21')]?_[_0xa4b2('0x22')](_0x54b5c6[_0xa4b2('0x1c')][_0xa4b2('0x21')],function(_0x3291c6){return{'model':db[_0x3291c6[_0xa4b2('0x23')]],'as':_0x3291c6['as'],'attributes':_0x3291c6[_0xa4b2('0x1f')],'include':_0x3291c6[_0xa4b2('0x21')]?_[_0xa4b2('0x22')](_0x3291c6[_0xa4b2('0x21')],function(_0x133f7c){return{'model':db[_0x133f7c[_0xa4b2('0x23')]],'as':_0x133f7c['as'],'attributes':_0x133f7c['attributes'],'include':_0x133f7c['include']?_[_0xa4b2('0x22')](_0x133f7c['include'],function(_0xf6bf9b){return{'model':db[_0xf6bf9b[_0xa4b2('0x23')]],'as':_0xf6bf9b['as'],'attributes':_0xf6bf9b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ede0a){logger['info']('GetOpenchannelQueue',_0x54b5c6);logger[_0xa4b2('0x13')](_0xa4b2('0x19'),_0x54b5c6,JSON[_0xa4b2('0x24')](_0x1ede0a));_0x1a3f06(_0x1ede0a);})[_0xa4b2('0x18')](function(_0x37a6f5){logger[_0xa4b2('0x15')](_0xa4b2('0x19'),_0x37a6f5[_0xa4b2('0x17')],_0x54b5c6);_0xc19cc0(_0x1777e6[_0xa4b2('0x15')](0x1f4,_0x37a6f5[_0xa4b2('0x17')]));});});};exports[_0xa4b2('0x25')]=function(_0x4fdf70){var _0x1b57e4=this;return new Promise(function(_0xae2d1e,_0x49c18b){return db[_0xa4b2('0x1a')][_0xa4b2('0x26')]({'raw':_0x4fdf70['options']?_0x4fdf70[_0xa4b2('0x1c')][_0xa4b2('0x1d')]===undefined?!![]:![]:!![],'where':_0x4fdf70['options']?_0x4fdf70[_0xa4b2('0x1c')]['where']||null:null,'attributes':_0x4fdf70[_0xa4b2('0x1c')]?_0x4fdf70[_0xa4b2('0x1c')][_0xa4b2('0x1f')]||null:null,'include':_0x4fdf70[_0xa4b2('0x1c')]?_0x4fdf70[_0xa4b2('0x1c')][_0xa4b2('0x21')]?_[_0xa4b2('0x22')](_0x4fdf70[_0xa4b2('0x1c')][_0xa4b2('0x21')],function(_0x1d7f7e){return{'model':db[_0x1d7f7e[_0xa4b2('0x23')]],'as':_0x1d7f7e['as'],'attributes':_0x1d7f7e[_0xa4b2('0x1f')],'include':_0x1d7f7e['include']?_[_0xa4b2('0x22')](_0x1d7f7e['include'],function(_0x110ce6){return{'model':db[_0x110ce6[_0xa4b2('0x23')]],'as':_0x110ce6['as'],'attributes':_0x110ce6[_0xa4b2('0x1f')],'include':_0x110ce6[_0xa4b2('0x21')]?_[_0xa4b2('0x22')](_0x110ce6[_0xa4b2('0x21')],function(_0x3ab9fd){return{'model':db[_0x3ab9fd['model']],'as':_0x3ab9fd['as'],'attributes':_0x3ab9fd[_0xa4b2('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa4b2('0x10')](function(_0x54aa33){logger['info']('ShowOpenchannelQueue',_0x4fdf70);logger[_0xa4b2('0x13')]('ShowOpenchannelQueue',_0x4fdf70,JSON[_0xa4b2('0x24')](_0x54aa33));_0xae2d1e(_0x54aa33);})[_0xa4b2('0x18')](function(_0x51a4d4){logger[_0xa4b2('0x15')]('ShowOpenchannelQueue',_0x51a4d4[_0xa4b2('0x17')],_0x4fdf70);_0x49c18b(_0x1b57e4['error'](0x1f4,_0x51a4d4[_0xa4b2('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index c17d870..70c2785 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 _0x9087=['remove','update','removeListener','register','length','./openchannelQueue.events'];(function(_0x44745f,_0x432d7e){var _0xac7f24=function(_0x53038f){while(--_0x53038f){_0x44745f['push'](_0x44745f['shift']());}};_0xac7f24(++_0x432d7e);}(_0x9087,0x125));var _0x7908=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9087[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelQueueEvents=require(_0x7908('0x0'));var events=['save',_0x7908('0x1'),_0x7908('0x2')];function createListener(_0x52ccda,_0x119b79){return function(_0x2ce099){_0x119b79['emit'](_0x52ccda,_0x2ce099);};}function removeListener(_0x3fd719,_0x34022a){return function(){OpenchannelQueueEvents[_0x7908('0x3')](_0x3fd719,_0x34022a);};}exports[_0x7908('0x4')]=function(_0x3f12a7){for(var _0x1292a7=0x0,_0x325bed=events[_0x7908('0x5')];_0x1292a7<_0x325bed;_0x1292a7++){var _0x3fbc2d=events[_0x1292a7];var _0x29758c=createListener('openchannelQueue:'+_0x3fbc2d,_0x3f12a7);OpenchannelQueueEvents['on'](_0x3fbc2d,_0x29758c);}}; \ No newline at end of file +var _0x1b84=['remove','emit','removeListener','register','length','./openchannelQueue.events','save'];(function(_0xb40ff3,_0x3dd4d6){var _0x3a71c9=function(_0x10597e){while(--_0x10597e){_0xb40ff3['push'](_0xb40ff3['shift']());}};_0x3a71c9(++_0x3dd4d6);}(_0x1b84,0xc2));var _0x41b8=function(_0x4ab5ed,_0xfcdb97){_0x4ab5ed=_0x4ab5ed-0x0;var _0x4ffdf7=_0x1b84[_0x4ab5ed];return _0x4ffdf7;};'use strict';var OpenchannelQueueEvents=require(_0x41b8('0x0'));var events=[_0x41b8('0x1'),_0x41b8('0x2'),'update'];function createListener(_0x20118d,_0x5f3c60){return function(_0x57894f){_0x5f3c60[_0x41b8('0x3')](_0x20118d,_0x57894f);};}function removeListener(_0x24a211,_0x462e77){return function(){OpenchannelQueueEvents[_0x41b8('0x4')](_0x24a211,_0x462e77);};}exports[_0x41b8('0x5')]=function(_0x597069){for(var _0x4de2f4=0x0,_0x4ea6ed=events[_0x41b8('0x6')];_0x4de2f4<_0x4ea6ed;_0x4de2f4++){var _0xe84650=events[_0x4de2f4];var _0x1dc216=createListener('openchannelQueue:'+_0xe84650,_0x597069);OpenchannelQueueEvents['on'](_0xe84650,_0x1dc216);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 367da58..a0b1a4e 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 _0x2379=['show','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x46ec9a,_0x25afd1){var _0x53d0af=function(_0x78e2ed){while(--_0x78e2ed){_0x46ec9a['push'](_0x46ec9a['shift']());}};_0x53d0af(++_0x25afd1);}(_0x2379,0x16d));var _0x9237=function(_0x454c18,_0x405f1d){_0x454c18=_0x454c18-0x0;var _0x178a36=_0x2379[_0x454c18];return _0x178a36;};'use strict';var multer=require('multer');var util=require(_0x9237('0x0'));var path=require('path');var timeout=require(_0x9237('0x1'));var express=require(_0x9237('0x2'));var router=express['Router']();var fs_extra=require(_0x9237('0x3'));var auth=require(_0x9237('0x4'));var interaction=require(_0x9237('0x5'));var config=require(_0x9237('0x6'));var controller=require(_0x9237('0x7'));router[_0x9237('0x8')]('/',auth[_0x9237('0x9')](),controller[_0x9237('0xa')]);router[_0x9237('0x8')]('/describe',auth[_0x9237('0x9')](),controller[_0x9237('0xb')]);router[_0x9237('0x8')](_0x9237('0xc'),auth[_0x9237('0x9')](),controller[_0x9237('0xd')]);router[_0x9237('0xe')]('/',auth[_0x9237('0x9')](),controller[_0x9237('0xf')]);router[_0x9237('0x10')](_0x9237('0xc'),auth[_0x9237('0x9')](),controller[_0x9237('0x11')]);router[_0x9237('0x12')](_0x9237('0xc'),auth[_0x9237('0x9')](),controller[_0x9237('0x13')]);module[_0x9237('0x14')]=router; \ No newline at end of file +var _0x6971=['multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','show','post','create','/:id','update','delete','destroy','exports'];(function(_0x4f5f48,_0x5b041a){var _0x44f10f=function(_0x5c02cf){while(--_0x5c02cf){_0x4f5f48['push'](_0x4f5f48['shift']());}};_0x44f10f(++_0x5b041a);}(_0x6971,0x18c));var _0x1697=function(_0x2ec445,_0x3fd2a6){_0x2ec445=_0x2ec445-0x0;var _0xfa59b=_0x6971[_0x2ec445];return _0xfa59b;};'use strict';var multer=require(_0x1697('0x0'));var util=require(_0x1697('0x1'));var path=require(_0x1697('0x2'));var timeout=require('connect-timeout');var express=require(_0x1697('0x3'));var router=express['Router']();var fs_extra=require(_0x1697('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1697('0x5'));var config=require(_0x1697('0x6'));var controller=require('./openchannelQueueReport.controller');router[_0x1697('0x7')]('/',auth[_0x1697('0x8')](),controller['index']);router['get']('/describe',auth[_0x1697('0x8')](),controller[_0x1697('0x9')]);router[_0x1697('0x7')]('/:id',auth[_0x1697('0x8')](),controller[_0x1697('0xa')]);router[_0x1697('0xb')]('/',auth[_0x1697('0x8')](),controller[_0x1697('0xc')]);router['put'](_0x1697('0xd'),auth[_0x1697('0x8')](),controller[_0x1697('0xe')]);router[_0x1697('0xf')]('/:id',auth[_0x1697('0x8')](),controller[_0x1697('0x10')]);module[_0x1697('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index ba0f55e..ea39a36 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 _0x0e7a=['exports','STRING','DATE','moment','sequelize'];(function(_0x427b15,_0x29ec04){var _0x446cd3=function(_0x2a169c){while(--_0x2a169c){_0x427b15['push'](_0x427b15['shift']());}};_0x446cd3(++_0x29ec04);}(_0x0e7a,0x71));var _0xa0e7=function(_0x3b9388,_0xc4ab13){_0x3b9388=_0x3b9388-0x0;var _0x3d82d2=_0x0e7a[_0x3b9388];return _0x3d82d2;};'use strict';var moment=require(_0xa0e7('0x0'));var Sequelize=require(_0xa0e7('0x1'));module[_0xa0e7('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xa0e7('0x3')]},'joinAt':{'type':Sequelize[_0xa0e7('0x4')]},'leaveAt':{'type':Sequelize[_0xa0e7('0x4')]},'acceptAt':{'type':Sequelize[_0xa0e7('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xa0e7('0x3')]}}; \ No newline at end of file +var _0xd93d=['moment','sequelize','STRING','DATE'];(function(_0x18aea7,_0x3fd4ea){var _0x49de06=function(_0x5cb5e2){while(--_0x5cb5e2){_0x18aea7['push'](_0x18aea7['shift']());}};_0x49de06(++_0x3fd4ea);}(_0xd93d,0x1d0));var _0xdd93=function(_0xaa6529,_0x52f7db){_0xaa6529=_0xaa6529-0x0;var _0x39b304=_0xd93d[_0xaa6529];return _0x39b304;};'use strict';var moment=require(_0xdd93('0x0'));var Sequelize=require(_0xdd93('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xdd93('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xdd93('0x3')]},'leaveAt':{'type':Sequelize[_0xdd93('0x3')]},'acceptAt':{'type':Sequelize[_0xdd93('0x3')]},'exitAt':{'type':Sequelize[_0xdd93('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 d8db9fa..461bc7b 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 _0x305b=['querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','OpenchannelQueueReport','rawAttributes','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','show','keys','include','options','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','desk.js','to-csv'];(function(_0xdba494,_0x839252){var _0x36b895=function(_0x28c3e0){while(--_0x28c3e0){_0xdba494['push'](_0xdba494['shift']());}};_0x36b895(++_0x839252);}(_0x305b,0x114));var _0xb305=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0x305b[_0x4d07cc];return _0x42de3b;};'use strict';var emlformat=require(_0xb305('0x0'));var rimraf=require(_0xb305('0x1'));var zipdir=require(_0xb305('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb305('0x3'));var moment=require(_0xb305('0x4'));var BPromise=require(_0xb305('0x5'));var Mustache=require(_0xb305('0x6'));var util=require('util');var path=require('path');var sox=require(_0xb305('0x7'));var csv=require('to-csv');var ejs=require(_0xb305('0x8'));var fs=require('fs');var fs_extra=require(_0xb305('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb305('0xa'));var toCsv=require(_0xb305('0xb'));var querystring=require(_0xb305('0xc'));var Papa=require(_0xb305('0xd'));var Redis=require(_0xb305('0xe'));var authService=require(_0xb305('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb305('0x10'));var logger=require(_0xb305('0x11'))(_0xb305('0x12'));var utils=require('../../config/utils');var config=require(_0xb305('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xb305('0x14'))['db'];function respondWithStatusCode(_0x22f699,_0x579b23){_0x579b23=_0x579b23||0xcc;return function(_0x30a88a){if(_0x30a88a){return _0x22f699[_0xb305('0x15')](_0x579b23);}return _0x22f699[_0xb305('0x16')](_0x579b23)[_0xb305('0x17')]();};}function respondWithResult(_0x3f6c44,_0x47a806){_0x47a806=_0x47a806||0xc8;return function(_0x1e9ef1){if(_0x1e9ef1){return _0x3f6c44[_0xb305('0x16')](_0x47a806)[_0xb305('0x18')](_0x1e9ef1);}};}function respondWithFilteredResult(_0x279b6e,_0x4cc85d){return function(_0x3378d0){if(_0x3378d0){var _0x365999=typeof _0x4cc85d[_0xb305('0x19')]==='undefined'&&typeof _0x4cc85d[_0xb305('0x1a')]===_0xb305('0x1b');var _0x55faa1=_0x3378d0['count'];var _0x55587c=_0x365999?0x0:_0x4cc85d[_0xb305('0x19')];var _0x2aa6f4=_0x365999?_0x3378d0[_0xb305('0x1c')]:_0x4cc85d['offset']+_0x4cc85d['limit'];var _0x11907f;if(_0x2aa6f4>=_0x55faa1){_0x2aa6f4=_0x55faa1;_0x11907f=0xc8;}else{_0x11907f=0xce;}_0x279b6e[_0xb305('0x16')](_0x11907f);return _0x279b6e[_0xb305('0x1d')](_0xb305('0x1e'),_0x55587c+'-'+_0x2aa6f4+'/'+_0x55faa1)[_0xb305('0x18')](_0x3378d0);}return null;};}function patchUpdates(_0x2307a0){return function(_0x34e5d5){try{jsonpatch[_0xb305('0x1f')](_0x34e5d5,_0x2307a0,!![]);}catch(_0x359bb8){return BPromise[_0xb305('0x20')](_0x359bb8);}return _0x34e5d5['save']();};}function saveUpdates(_0x36a424,_0x3dadd5){return function(_0x298930){if(_0x298930){return _0x298930['update'](_0x36a424)[_0xb305('0x21')](function(_0x5bcb6c){return _0x5bcb6c;});}return null;};}function removeEntity(_0x48cd99,_0xd83b05){return function(_0x1ceae2){if(_0x1ceae2){return _0x1ceae2[_0xb305('0x22')]()['then'](function(){_0x48cd99[_0xb305('0x16')](0xcc)[_0xb305('0x17')]();});}};}function handleEntityNotFound(_0x397a1f,_0x191ec2){return function(_0x2d38c1){if(!_0x2d38c1){_0x397a1f[_0xb305('0x15')](0x194);}return _0x2d38c1;};}function handleError(_0x5934b9,_0x246411){_0x246411=_0x246411||0x1f4;return function(_0x46d3fc){logger[_0xb305('0x23')](_0x46d3fc[_0xb305('0x24')]);if(_0x46d3fc['name']){delete _0x46d3fc[_0xb305('0x25')];}_0x5934b9[_0xb305('0x16')](_0x246411)[_0xb305('0x26')](_0x46d3fc);};}exports[_0xb305('0x27')]=function(_0x324211,_0x45cc86){var _0x5316de={},_0x1abe66={},_0x47f11a={'count':0x0,'rows':[]};var _0x59e8d3=_['map'](db[_0xb305('0x28')][_0xb305('0x29')],function(_0x462549){return{'name':_0x462549['fieldName'],'type':_0x462549[_0xb305('0x2a')]['key']};});_0x1abe66[_0xb305('0x2b')]=_[_0xb305('0x2c')](_0x59e8d3,'name');_0x1abe66['query']=_['keys'](_0x324211[_0xb305('0x2d')]);_0x1abe66[_0xb305('0x2e')]=_[_0xb305('0x2f')](_0x1abe66[_0xb305('0x2b')],_0x1abe66[_0xb305('0x2d')]);_0x5316de[_0xb305('0x30')]=_['intersection'](_0x1abe66['model'],qs[_0xb305('0x31')](_0x324211[_0xb305('0x2d')][_0xb305('0x31')]));_0x5316de[_0xb305('0x30')]=_0x5316de[_0xb305('0x30')][_0xb305('0x32')]?_0x5316de['attributes']:_0x1abe66['model'];if(!_0x324211[_0xb305('0x2d')][_0xb305('0x33')](_0xb305('0x34'))){_0x5316de[_0xb305('0x1a')]=qs[_0xb305('0x1a')](_0x324211[_0xb305('0x2d')][_0xb305('0x1a')]);_0x5316de[_0xb305('0x19')]=qs[_0xb305('0x19')](_0x324211['query'][_0xb305('0x19')]);}_0x5316de[_0xb305('0x35')]=qs[_0xb305('0x36')](_0x324211[_0xb305('0x2d')]['sort']);_0x5316de[_0xb305('0x37')]=qs[_0xb305('0x2e')](_[_0xb305('0x38')](_0x324211[_0xb305('0x2d')],_0x1abe66[_0xb305('0x2e')]),_0x59e8d3);if(_0x324211['query'][_0xb305('0x39')]){_0x5316de[_0xb305('0x37')]=_[_0xb305('0x3a')](_0x5316de[_0xb305('0x37')],{'$or':_[_0xb305('0x2c')](_0x59e8d3,function(_0x5b0c1e){if(_0x5b0c1e['type']!==_0xb305('0x3b')){var _0x373f66={};_0x373f66[_0x5b0c1e[_0xb305('0x25')]]={'$like':'%'+_0x324211[_0xb305('0x2d')][_0xb305('0x39')]+'%'};return _0x373f66;}})});}_0x5316de=_[_0xb305('0x3a')]({},_0x5316de,_0x324211['options']);var _0x30f141={'where':_0x5316de[_0xb305('0x37')]};return db['OpenchannelQueueReport'][_0xb305('0x1c')](_0x30f141)[_0xb305('0x21')](function(_0xd2f00e){_0x47f11a[_0xb305('0x1c')]=_0xd2f00e;if(_0x324211['query'][_0xb305('0x3c')]){_0x5316de['include']=[{'all':!![]}];}return db[_0xb305('0x28')]['findAll'](_0x5316de);})[_0xb305('0x21')](function(_0x68ac57){_0x47f11a[_0xb305('0x3d')]=_0x68ac57;return _0x47f11a;})[_0xb305('0x21')](respondWithFilteredResult(_0x45cc86,_0x5316de))['catch'](handleError(_0x45cc86,null));};exports[_0xb305('0x3e')]=function(_0x3e222b,_0x41892f){var _0x54eda8={'raw':!![],'where':{'id':_0x3e222b['params']['id']}},_0x1d72ea={};_0x1d72ea[_0xb305('0x2b')]=_[_0xb305('0x3f')](db['OpenchannelQueueReport']['rawAttributes']);_0x1d72ea[_0xb305('0x2d')]=_[_0xb305('0x3f')](_0x3e222b[_0xb305('0x2d')]);_0x1d72ea[_0xb305('0x2e')]=_[_0xb305('0x2f')](_0x1d72ea[_0xb305('0x2b')],_0x1d72ea[_0xb305('0x2d')]);_0x54eda8['attributes']=_[_0xb305('0x2f')](_0x1d72ea['model'],qs[_0xb305('0x31')](_0x3e222b[_0xb305('0x2d')][_0xb305('0x31')]));_0x54eda8[_0xb305('0x30')]=_0x54eda8[_0xb305('0x30')][_0xb305('0x32')]?_0x54eda8[_0xb305('0x30')]:_0x1d72ea[_0xb305('0x2b')];if(_0x3e222b['query'][_0xb305('0x3c')]){_0x54eda8[_0xb305('0x40')]=[{'all':!![]}];}_0x54eda8=_[_0xb305('0x3a')]({},_0x54eda8,_0x3e222b[_0xb305('0x41')]);return db[_0xb305('0x28')][_0xb305('0x42')](_0x54eda8)[_0xb305('0x21')](handleEntityNotFound(_0x41892f,null))['then'](respondWithResult(_0x41892f,null))[_0xb305('0x43')](handleError(_0x41892f,null));};exports['create']=function(_0x1375b2,_0x54fc51){return db[_0xb305('0x28')][_0xb305('0x44')](_0x1375b2[_0xb305('0x45')],{})[_0xb305('0x21')](respondWithResult(_0x54fc51,0xc9))[_0xb305('0x43')](handleError(_0x54fc51,null));};exports['update']=function(_0x22ba6f,_0x3bfd7d){if(_0x22ba6f[_0xb305('0x45')]['id']){delete _0x22ba6f['body']['id'];}return db['OpenchannelQueueReport'][_0xb305('0x42')]({'where':{'id':_0x22ba6f[_0xb305('0x46')]['id']}})[_0xb305('0x21')](handleEntityNotFound(_0x3bfd7d,null))['then'](saveUpdates(_0x22ba6f[_0xb305('0x45')],null))[_0xb305('0x21')](respondWithResult(_0x3bfd7d,null))['catch'](handleError(_0x3bfd7d,null));};exports[_0xb305('0x22')]=function(_0x1049ef,_0x2ea033){return db[_0xb305('0x28')][_0xb305('0x42')]({'where':{'id':_0x1049ef[_0xb305('0x46')]['id']}})[_0xb305('0x21')](handleEntityNotFound(_0x2ea033,null))['then'](removeEntity(_0x2ea033,null))[_0xb305('0x43')](handleError(_0x2ea033,null));};exports[_0xb305('0x47')]=function(_0x3360d5,_0x41cc10){return db[_0xb305('0x28')]['describe']()[_0xb305('0x21')](respondWithResult(_0x41cc10,null))['catch'](handleError(_0x41cc10,null));}; \ No newline at end of file +var _0x6ba4=['body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../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','save','update','destroy','then','send','index','map','rawAttributes','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','OpenchannelQueueReport','rows','catch','merge','find','create'];(function(_0x2da357,_0x1f9b2f){var _0x138fdd=function(_0xe3077d){while(--_0xe3077d){_0x2da357['push'](_0x2da357['shift']());}};_0x138fdd(++_0x1f9b2f);}(_0x6ba4,0x99));var _0x46ba=function(_0x27e8d9,_0x738e05){_0x27e8d9=_0x27e8d9-0x0;var _0x3a85de=_0x6ba4[_0x27e8d9];return _0x3a85de;};'use strict';var emlformat=require(_0x46ba('0x0'));var rimraf=require(_0x46ba('0x1'));var zipdir=require(_0x46ba('0x2'));var jsonpatch=require(_0x46ba('0x3'));var rp=require(_0x46ba('0x4'));var moment=require(_0x46ba('0x5'));var BPromise=require(_0x46ba('0x6'));var Mustache=require('mustache');var util=require(_0x46ba('0x7'));var path=require(_0x46ba('0x8'));var sox=require(_0x46ba('0x9'));var csv=require(_0x46ba('0xa'));var ejs=require(_0x46ba('0xb'));var fs=require('fs');var fs_extra=require(_0x46ba('0xc'));var _=require(_0x46ba('0xd'));var squel=require(_0x46ba('0xe'));var crypto=require(_0x46ba('0xf'));var jsforce=require(_0x46ba('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x46ba('0xa'));var querystring=require(_0x46ba('0x11'));var Papa=require('papaparse');var Redis=require(_0x46ba('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x46ba('0x13'));var hardwareService=require(_0x46ba('0x14'));var logger=require(_0x46ba('0x15'))(_0x46ba('0x16'));var utils=require(_0x46ba('0x17'));var config=require(_0x46ba('0x18'));var licenseUtil=require(_0x46ba('0x19'));var db=require(_0x46ba('0x1a'))['db'];function respondWithStatusCode(_0x4d4ebc,_0x38cce4){_0x38cce4=_0x38cce4||0xcc;return function(_0x9e525e){if(_0x9e525e){return _0x4d4ebc[_0x46ba('0x1b')](_0x38cce4);}return _0x4d4ebc['status'](_0x38cce4)[_0x46ba('0x1c')]();};}function respondWithResult(_0x264601,_0x16d428){_0x16d428=_0x16d428||0xc8;return function(_0x54c820){if(_0x54c820){return _0x264601[_0x46ba('0x1d')](_0x16d428)[_0x46ba('0x1e')](_0x54c820);}};}function respondWithFilteredResult(_0x38c4e0,_0x48c42b){return function(_0x267ffb){if(_0x267ffb){var _0x1a4b16=typeof _0x48c42b[_0x46ba('0x1f')]===_0x46ba('0x20')&&typeof _0x48c42b[_0x46ba('0x21')]==='undefined';var _0x1d0d94=_0x267ffb[_0x46ba('0x22')];var _0x1b38f4=_0x1a4b16?0x0:_0x48c42b[_0x46ba('0x1f')];var _0x382f8d=_0x1a4b16?_0x267ffb[_0x46ba('0x22')]:_0x48c42b['offset']+_0x48c42b[_0x46ba('0x21')];var _0x46186e;if(_0x382f8d>=_0x1d0d94){_0x382f8d=_0x1d0d94;_0x46186e=0xc8;}else{_0x46186e=0xce;}_0x38c4e0[_0x46ba('0x1d')](_0x46186e);return _0x38c4e0[_0x46ba('0x23')]('Content-Range',_0x1b38f4+'-'+_0x382f8d+'/'+_0x1d0d94)[_0x46ba('0x1e')](_0x267ffb);}return null;};}function patchUpdates(_0xe3d5e6){return function(_0xad4e1a){try{jsonpatch[_0x46ba('0x24')](_0xad4e1a,_0xe3d5e6,!![]);}catch(_0x23e0b1){return BPromise['reject'](_0x23e0b1);}return _0xad4e1a[_0x46ba('0x25')]();};}function saveUpdates(_0x3cd105,_0x473a08){return function(_0x326ae7){if(_0x326ae7){return _0x326ae7[_0x46ba('0x26')](_0x3cd105)['then'](function(_0x224b6b){return _0x224b6b;});}return null;};}function removeEntity(_0x286954,_0x38d77d){return function(_0x54cdfe){if(_0x54cdfe){return _0x54cdfe[_0x46ba('0x27')]()[_0x46ba('0x28')](function(){_0x286954[_0x46ba('0x1d')](0xcc)[_0x46ba('0x1c')]();});}};}function handleEntityNotFound(_0x116b40,_0x1ba0b8){return function(_0x21e3de){if(!_0x21e3de){_0x116b40[_0x46ba('0x1b')](0x194);}return _0x21e3de;};}function handleError(_0x2b6e48,_0x483afc){_0x483afc=_0x483afc||0x1f4;return function(_0x4c8313){logger['error'](_0x4c8313['stack']);if(_0x4c8313['name']){delete _0x4c8313['name'];}_0x2b6e48[_0x46ba('0x1d')](_0x483afc)[_0x46ba('0x29')](_0x4c8313);};}exports[_0x46ba('0x2a')]=function(_0x3996e0,_0x9a9a9f){var _0x5334f1={},_0x493a34={},_0x50cc41={'count':0x0,'rows':[]};var _0x9e08a5=_[_0x46ba('0x2b')](db['OpenchannelQueueReport'][_0x46ba('0x2c')],function(_0x59720b){return{'name':_0x59720b['fieldName'],'type':_0x59720b[_0x46ba('0x2d')][_0x46ba('0x2e')]};});_0x493a34[_0x46ba('0x2f')]=_[_0x46ba('0x2b')](_0x9e08a5,_0x46ba('0x30'));_0x493a34[_0x46ba('0x31')]=_[_0x46ba('0x32')](_0x3996e0[_0x46ba('0x31')]);_0x493a34[_0x46ba('0x33')]=_[_0x46ba('0x34')](_0x493a34[_0x46ba('0x2f')],_0x493a34[_0x46ba('0x31')]);_0x5334f1[_0x46ba('0x35')]=_[_0x46ba('0x34')](_0x493a34[_0x46ba('0x2f')],qs[_0x46ba('0x36')](_0x3996e0[_0x46ba('0x31')][_0x46ba('0x36')]));_0x5334f1[_0x46ba('0x35')]=_0x5334f1[_0x46ba('0x35')][_0x46ba('0x37')]?_0x5334f1[_0x46ba('0x35')]:_0x493a34['model'];if(!_0x3996e0[_0x46ba('0x31')][_0x46ba('0x38')](_0x46ba('0x39'))){_0x5334f1[_0x46ba('0x21')]=qs[_0x46ba('0x21')](_0x3996e0['query'][_0x46ba('0x21')]);_0x5334f1['offset']=qs[_0x46ba('0x1f')](_0x3996e0[_0x46ba('0x31')]['offset']);}_0x5334f1['order']=qs['sort'](_0x3996e0['query'][_0x46ba('0x3a')]);_0x5334f1[_0x46ba('0x3b')]=qs['filters'](_[_0x46ba('0x3c')](_0x3996e0['query'],_0x493a34[_0x46ba('0x33')]),_0x9e08a5);if(_0x3996e0[_0x46ba('0x31')][_0x46ba('0x3d')]){_0x5334f1[_0x46ba('0x3b')]=_['merge'](_0x5334f1[_0x46ba('0x3b')],{'$or':_[_0x46ba('0x2b')](_0x9e08a5,function(_0x353a6d){if(_0x353a6d['type']!==_0x46ba('0x3e')){var _0xf7b7b2={};_0xf7b7b2[_0x353a6d[_0x46ba('0x30')]]={'$like':'%'+_0x3996e0[_0x46ba('0x31')]['filter']+'%'};return _0xf7b7b2;}})});}_0x5334f1=_['merge']({},_0x5334f1,_0x3996e0[_0x46ba('0x3f')]);var _0x12bed6={'where':_0x5334f1['where']};return db['OpenchannelQueueReport']['count'](_0x12bed6)['then'](function(_0x26ced6){_0x50cc41[_0x46ba('0x22')]=_0x26ced6;if(_0x3996e0[_0x46ba('0x31')][_0x46ba('0x40')]){_0x5334f1[_0x46ba('0x41')]=[{'all':!![]}];}return db[_0x46ba('0x42')]['findAll'](_0x5334f1);})[_0x46ba('0x28')](function(_0x43c827){_0x50cc41[_0x46ba('0x43')]=_0x43c827;return _0x50cc41;})['then'](respondWithFilteredResult(_0x9a9a9f,_0x5334f1))[_0x46ba('0x44')](handleError(_0x9a9a9f,null));};exports['show']=function(_0x5124ac,_0x1134f1){var _0x2049bd={'raw':!![],'where':{'id':_0x5124ac['params']['id']}},_0x64c390={};_0x64c390[_0x46ba('0x2f')]=_[_0x46ba('0x32')](db[_0x46ba('0x42')]['rawAttributes']);_0x64c390['query']=_[_0x46ba('0x32')](_0x5124ac[_0x46ba('0x31')]);_0x64c390['filters']=_['intersection'](_0x64c390[_0x46ba('0x2f')],_0x64c390[_0x46ba('0x31')]);_0x2049bd['attributes']=_[_0x46ba('0x34')](_0x64c390['model'],qs[_0x46ba('0x36')](_0x5124ac[_0x46ba('0x31')][_0x46ba('0x36')]));_0x2049bd['attributes']=_0x2049bd['attributes'][_0x46ba('0x37')]?_0x2049bd[_0x46ba('0x35')]:_0x64c390['model'];if(_0x5124ac[_0x46ba('0x31')][_0x46ba('0x40')]){_0x2049bd[_0x46ba('0x41')]=[{'all':!![]}];}_0x2049bd=_[_0x46ba('0x45')]({},_0x2049bd,_0x5124ac[_0x46ba('0x3f')]);return db[_0x46ba('0x42')][_0x46ba('0x46')](_0x2049bd)[_0x46ba('0x28')](handleEntityNotFound(_0x1134f1,null))[_0x46ba('0x28')](respondWithResult(_0x1134f1,null))[_0x46ba('0x44')](handleError(_0x1134f1,null));};exports[_0x46ba('0x47')]=function(_0x523d2b,_0x454d88){return db[_0x46ba('0x42')][_0x46ba('0x47')](_0x523d2b[_0x46ba('0x48')],{})['then'](respondWithResult(_0x454d88,0xc9))['catch'](handleError(_0x454d88,null));};exports[_0x46ba('0x26')]=function(_0x4517fd,_0xa559dc){if(_0x4517fd['body']['id']){delete _0x4517fd[_0x46ba('0x48')]['id'];}return db[_0x46ba('0x42')][_0x46ba('0x46')]({'where':{'id':_0x4517fd[_0x46ba('0x49')]['id']}})[_0x46ba('0x28')](handleEntityNotFound(_0xa559dc,null))[_0x46ba('0x28')](saveUpdates(_0x4517fd[_0x46ba('0x48')],null))[_0x46ba('0x28')](respondWithResult(_0xa559dc,null))[_0x46ba('0x44')](handleError(_0xa559dc,null));};exports[_0x46ba('0x27')]=function(_0x54973a,_0xaefe91){return db[_0x46ba('0x42')]['find']({'where':{'id':_0x54973a[_0x46ba('0x49')]['id']}})[_0x46ba('0x28')](handleEntityNotFound(_0xaefe91,null))[_0x46ba('0x28')](removeEntity(_0xaefe91,null))[_0x46ba('0x44')](handleError(_0xaefe91,null));};exports[_0x46ba('0x4a')]=function(_0x590809,_0x345641){return db[_0x46ba('0x42')][_0x46ba('0x4a')]()[_0x46ba('0x28')](respondWithResult(_0x345641,null))[_0x46ba('0x44')](handleError(_0x345641,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 3054eeb..c45fb06 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 _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x1e91f7,_0x45caf1){var _0xdc1c1c=function(_0x2a820d){while(--_0x2a820d){_0x1e91f7['push'](_0x1e91f7['shift']());}};_0xdc1c1c(++_0x45caf1);}(_0x7a54,0x106));var _0x47a5=function(_0x42d107,_0x1cb38f){_0x42d107=_0x42d107-0x0;var _0x499899=_0x7a54[_0x42d107];return _0x499899;};'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':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','moment'];(function(_0x190d64,_0x1b0535){var _0x1f27db=function(_0x235ebf){while(--_0x235ebf){_0x190d64['push'](_0x190d64['shift']());}};_0x1f27db(++_0x1b0535);}(_0xe14b,0x93));var _0xbe14=function(_0xac7646,_0x324cc4){_0xac7646=_0xac7646-0x0;var _0x56b2f0=_0xe14b[_0xac7646];return _0x56b2f0;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 59663c5..73bc98f 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 _0x4cf8=['info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','CreateOpenchannelQueueReport','body','options','raw','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x3aac69,_0x81d09f){var _0x38d35b=function(_0x58ef90){while(--_0x58ef90){_0x3aac69['push'](_0x3aac69['shift']());}};_0x38d35b(++_0x81d09f);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x35e92e,_0x21581b){_0x35e92e=_0x35e92e-0x0;var _0x1205a8=_0x4cf8[_0x35e92e];return _0x1205a8;};'use strict';var _=require(_0x84cf('0x0'));var util=require(_0x84cf('0x1'));var moment=require(_0x84cf('0x2'));var BPromise=require(_0x84cf('0x3'));var rs=require(_0x84cf('0x4'));var fs=require('fs');var Redis=require(_0x84cf('0x5'));var db=require(_0x84cf('0x6'))['db'];var utils=require(_0x84cf('0x7'));var logger=require(_0x84cf('0x8'))(_0x84cf('0x9'));var config=require(_0x84cf('0xa'));var jayson=require(_0x84cf('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x455345,_0x56c5cc,_0x15ba85){return new BPromise(function(_0x2c11b0,_0x51b84c){return client[_0x84cf('0xc')](_0x455345,_0x15ba85)[_0x84cf('0xd')](function(_0x489063){logger[_0x84cf('0xe')](_0x84cf('0xf'),_0x56c5cc,_0x84cf('0x10'));logger[_0x84cf('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x56c5cc,_0x84cf('0x10'),JSON[_0x84cf('0x12')](_0x489063));if(_0x489063['error']){if(_0x489063['error'][_0x84cf('0x13')]===0x1f4){logger[_0x84cf('0x14')](_0x84cf('0xf'),_0x56c5cc,_0x489063[_0x84cf('0x14')][_0x84cf('0x15')]);return _0x51b84c(_0x489063[_0x84cf('0x14')][_0x84cf('0x15')]);}logger[_0x84cf('0x14')](_0x84cf('0xf'),_0x56c5cc,_0x489063[_0x84cf('0x14')][_0x84cf('0x15')]);return _0x2c11b0(_0x489063[_0x84cf('0x14')][_0x84cf('0x15')]);}else{logger[_0x84cf('0xe')](_0x84cf('0xf'),_0x56c5cc,_0x84cf('0x10'));_0x2c11b0(_0x489063[_0x84cf('0x16')][_0x84cf('0x15')]);}})[_0x84cf('0x17')](function(_0x5b8ac8){logger[_0x84cf('0x14')](_0x84cf('0xf'),_0x56c5cc,_0x5b8ac8);_0x51b84c(_0x5b8ac8);});});}exports[_0x84cf('0x18')]=function(_0x1abe2d){var _0x1dad1a=this;return new Promise(function(_0x13ba16,_0xe6b5b6){return db['OpenchannelQueueReport']['create'](_0x1abe2d[_0x84cf('0x19')],{'raw':_0x1abe2d[_0x84cf('0x1a')]?_0x1abe2d[_0x84cf('0x1a')][_0x84cf('0x1b')]===undefined?!![]:![]:!![]})[_0x84cf('0xd')](function(_0x5dda3f){logger[_0x84cf('0xe')](_0x84cf('0x18'),_0x1abe2d);logger[_0x84cf('0x11')](_0x84cf('0x18'),_0x1abe2d,JSON[_0x84cf('0x12')](_0x5dda3f));_0x13ba16(_0x5dda3f);})['catch'](function(_0x42fa45){logger[_0x84cf('0x14')](_0x84cf('0x18'),_0x42fa45[_0x84cf('0x15')],_0x1abe2d);_0xe6b5b6(_0x1dad1a[_0x84cf('0x14')](0x1f4,_0x42fa45[_0x84cf('0x15')]));});});};exports[_0x84cf('0x1c')]=function(_0x4c9d1c){var _0x2b2c90=this;return new Promise(function(_0x26db3f,_0x1c7747){return db[_0x84cf('0x1d')][_0x84cf('0x1e')](_0x4c9d1c[_0x84cf('0x19')],{'raw':_0x4c9d1c[_0x84cf('0x1a')]?_0x4c9d1c[_0x84cf('0x1a')][_0x84cf('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c9d1c[_0x84cf('0x1a')]?_0x4c9d1c['options'][_0x84cf('0x1f')]||null:null,'attributes':_0x4c9d1c[_0x84cf('0x1a')]?_0x4c9d1c[_0x84cf('0x1a')][_0x84cf('0x20')]||null:null,'limit':_0x4c9d1c['options']?_0x4c9d1c[_0x84cf('0x1a')]['limit']||null:null})[_0x84cf('0xd')](function(_0x4092fd){logger[_0x84cf('0xe')](_0x84cf('0x1c'),_0x4c9d1c);logger[_0x84cf('0x11')](_0x84cf('0x1c'),_0x4c9d1c,JSON[_0x84cf('0x12')](_0x4092fd));_0x26db3f(_0x4092fd);})[_0x84cf('0x17')](function(_0x1bfa56){logger[_0x84cf('0x14')](_0x84cf('0x1c'),_0x1bfa56[_0x84cf('0x15')],_0x4c9d1c);_0x1c7747(_0x2b2c90[_0x84cf('0x14')](0x1f4,_0x1bfa56[_0x84cf('0x15')]));});});}; \ No newline at end of file +var _0xa7fa=['info','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','update','raw','where','limit','UpdateOpenchannelQueueReport','debug','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x3168e2,_0x5af0c5){var _0x1fc006=function(_0x2c1cdc){while(--_0x2c1cdc){_0x3168e2['push'](_0x3168e2['shift']());}};_0x1fc006(++_0x5af0c5);}(_0xa7fa,0xfc));var _0xaa7f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa7fa[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xaa7f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xaa7f('0x1'));var rs=require(_0xaa7f('0x2'));var fs=require('fs');var Redis=require(_0xaa7f('0x3'));var db=require(_0xaa7f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xaa7f('0x5'))(_0xaa7f('0x6'));var config=require(_0xaa7f('0x7'));var jayson=require(_0xaa7f('0x8'));var client=jayson['client'][_0xaa7f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48105b,_0x50bab6,_0x3898a3){return new BPromise(function(_0x506a91,_0x3ac236){return client[_0xaa7f('0xa')](_0x48105b,_0x3898a3)[_0xaa7f('0xb')](function(_0x2dbcb6){logger['info'](_0xaa7f('0xc'),_0x50bab6,_0xaa7f('0xd'));logger['debug'](_0xaa7f('0xe'),_0x50bab6,_0xaa7f('0xd'),JSON[_0xaa7f('0xf')](_0x2dbcb6));if(_0x2dbcb6[_0xaa7f('0x10')]){if(_0x2dbcb6['error']['code']===0x1f4){logger[_0xaa7f('0x10')](_0xaa7f('0xc'),_0x50bab6,_0x2dbcb6[_0xaa7f('0x10')][_0xaa7f('0x11')]);return _0x3ac236(_0x2dbcb6[_0xaa7f('0x10')][_0xaa7f('0x11')]);}logger[_0xaa7f('0x10')](_0xaa7f('0xc'),_0x50bab6,_0x2dbcb6[_0xaa7f('0x10')]['message']);return _0x506a91(_0x2dbcb6[_0xaa7f('0x10')]['message']);}else{logger[_0xaa7f('0x12')](_0xaa7f('0xc'),_0x50bab6,_0xaa7f('0xd'));_0x506a91(_0x2dbcb6['result'][_0xaa7f('0x11')]);}})[_0xaa7f('0x13')](function(_0x1bd3f9){logger[_0xaa7f('0x10')](_0xaa7f('0xc'),_0x50bab6,_0x1bd3f9);_0x3ac236(_0x1bd3f9);});});}exports[_0xaa7f('0x14')]=function(_0x2c17c4){var _0x4fbd09=this;return new Promise(function(_0x90863a,_0x1e18a6){return db[_0xaa7f('0x15')][_0xaa7f('0x16')](_0x2c17c4['body'],{'raw':_0x2c17c4['options']?_0x2c17c4[_0xaa7f('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xaa7f('0xb')](function(_0x21e870){logger['info'](_0xaa7f('0x14'),_0x2c17c4);logger['debug'](_0xaa7f('0x14'),_0x2c17c4,JSON[_0xaa7f('0xf')](_0x21e870));_0x90863a(_0x21e870);})[_0xaa7f('0x13')](function(_0x516d7e){logger[_0xaa7f('0x10')](_0xaa7f('0x14'),_0x516d7e[_0xaa7f('0x11')],_0x2c17c4);_0x1e18a6(_0x4fbd09[_0xaa7f('0x10')](0x1f4,_0x516d7e['message']));});});};exports['UpdateOpenchannelQueueReport']=function(_0x28d627){var _0x3effde=this;return new Promise(function(_0x3076f4,_0x246a18){return db[_0xaa7f('0x15')][_0xaa7f('0x18')](_0x28d627['body'],{'raw':_0x28d627['options']?_0x28d627['options'][_0xaa7f('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28d627['options']?_0x28d627[_0xaa7f('0x17')][_0xaa7f('0x1a')]||null:null,'attributes':_0x28d627['options']?_0x28d627[_0xaa7f('0x17')]['attributes']||null:null,'limit':_0x28d627[_0xaa7f('0x17')]?_0x28d627[_0xaa7f('0x17')][_0xaa7f('0x1b')]||null:null})[_0xaa7f('0xb')](function(_0x223321){logger['info'](_0xaa7f('0x1c'),_0x28d627);logger[_0xaa7f('0x1d')](_0xaa7f('0x1c'),_0x28d627,JSON['stringify'](_0x223321));_0x3076f4(_0x223321);})[_0xaa7f('0x13')](function(_0x1b17e2){logger[_0xaa7f('0x10')](_0xaa7f('0x1c'),_0x1b17e2[_0xaa7f('0x11')],_0x28d627);_0x246a18(_0x3effde[_0xaa7f('0x10')](0x1f4,_0x1b17e2['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index d648e61..e4d9492 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 _0x7e0a=['update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','isAuthenticated','index','get','describe','/:id','show','put'];(function(_0x5ca2f8,_0x11c873){var _0x19c4b7=function(_0x443011){while(--_0x443011){_0x5ca2f8['push'](_0x5ca2f8['shift']());}};_0x19c4b7(++_0x11c873);}(_0x7e0a,0x134));var _0xa7e0=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x7e0a[_0xdea41a];return _0x15d0d8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa7e0('0x0'));var timeout=require(_0xa7e0('0x1'));var express=require(_0xa7e0('0x2'));var router=express[_0xa7e0('0x3')]();var fs_extra=require(_0xa7e0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa7e0('0x5'));var config=require(_0xa7e0('0x6'));var controller=require(_0xa7e0('0x7'));router['get']('/',auth[_0xa7e0('0x8')](),controller[_0xa7e0('0x9')]);router[_0xa7e0('0xa')]('/describe',auth[_0xa7e0('0x8')](),controller[_0xa7e0('0xb')]);router[_0xa7e0('0xa')](_0xa7e0('0xc'),auth[_0xa7e0('0x8')](),controller[_0xa7e0('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xa7e0('0xe')](_0xa7e0('0xc'),auth[_0xa7e0('0x8')](),controller[_0xa7e0('0xf')]);router[_0xa7e0('0x10')](_0xa7e0('0xc'),auth[_0xa7e0('0x8')](),controller[_0xa7e0('0x11')]);module[_0xa7e0('0x12')]=router; \ No newline at end of file +var _0x12c7=['../../config/environment','./openchannelTransferReport.controller','isAuthenticated','index','get','describe','post','create','put','update','delete','/:id','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x404576,_0x256c23){var _0x55d370=function(_0x53c643){while(--_0x53c643){_0x404576['push'](_0x404576['shift']());}};_0x55d370(++_0x256c23);}(_0x12c7,0x12a));var _0x712c=function(_0x4e1fbb,_0x53b643){_0x4e1fbb=_0x4e1fbb-0x0;var _0x100b97=_0x12c7[_0x4e1fbb];return _0x100b97;};'use strict';var multer=require(_0x712c('0x0'));var util=require('util');var path=require(_0x712c('0x1'));var timeout=require(_0x712c('0x2'));var express=require(_0x712c('0x3'));var router=express[_0x712c('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x712c('0x5'));var config=require(_0x712c('0x6'));var controller=require(_0x712c('0x7'));router['get']('/',auth[_0x712c('0x8')](),controller[_0x712c('0x9')]);router[_0x712c('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x712c('0xb')]);router['get']('/:id',auth[_0x712c('0x8')](),controller['show']);router[_0x712c('0xc')]('/',auth[_0x712c('0x8')](),controller[_0x712c('0xd')]);router[_0x712c('0xe')]('/:id',auth[_0x712c('0x8')](),controller[_0x712c('0xf')]);router[_0x712c('0x10')](_0x712c('0x11'),auth[_0x712c('0x8')](),controller['destroy']);module[_0x712c('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index d944a05..7a16826 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x51e72f,_0x5b8bcc){var _0x400a55=function(_0x43f755){while(--_0x43f755){_0x51e72f['push'](_0x51e72f['shift']());}};_0x400a55(++_0x5b8bcc);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x7a6aed,_0x335e68){_0x7a6aed=_0x7a6aed-0x0;var _0x9dbabf=_0xf3cd[_0x7a6aed];return _0x9dbabf;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x1b92b8,_0x440682){var _0x4837aa=function(_0x45db5a){while(--_0x45db5a){_0x1b92b8['push'](_0x1b92b8['shift']());}};_0x4837aa(++_0x440682);}(_0xaa88,0x137));var _0x8aa8=function(_0x4bb581,_0x6f7037){_0x4bb581=_0x4bb581-0x0;var _0x316bf5=_0xaa88[_0x4bb581];return _0x316bf5;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index c62d978..0ffb096 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 _0x9b57=['show','params','length','includeAll','find','create','body','eml-format','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','include','catch'];(function(_0x5544be,_0x55e8e1){var _0x26bb77=function(_0x22fae4){while(--_0x22fae4){_0x5544be['push'](_0x5544be['shift']());}};_0x26bb77(++_0x55e8e1);}(_0x9b57,0x1f1));var _0x79b5=function(_0x257537,_0x4211f9){_0x257537=_0x257537-0x0;var _0x28105d=_0x9b57[_0x257537];return _0x28105d;};'use strict';var emlformat=require(_0x79b5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x79b5('0x1'));var Mustache=require(_0x79b5('0x2'));var util=require(_0x79b5('0x3'));var path=require(_0x79b5('0x4'));var sox=require(_0x79b5('0x5'));var csv=require(_0x79b5('0x6'));var ejs=require(_0x79b5('0x7'));var fs=require('fs');var fs_extra=require(_0x79b5('0x8'));var _=require('lodash');var squel=require(_0x79b5('0x9'));var crypto=require(_0x79b5('0xa'));var jsforce=require(_0x79b5('0xb'));var deskjs=require(_0x79b5('0xc'));var toCsv=require(_0x79b5('0x6'));var querystring=require('querystring');var Papa=require(_0x79b5('0xd'));var Redis=require(_0x79b5('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x79b5('0xf'));var as=require(_0x79b5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x79b5('0x11'))(_0x79b5('0x12'));var utils=require(_0x79b5('0x13'));var config=require(_0x79b5('0x14'));var licenseUtil=require(_0x79b5('0x15'));var db=require(_0x79b5('0x16'))['db'];function respondWithStatusCode(_0x528621,_0x21489c){_0x21489c=_0x21489c||0xcc;return function(_0x13554d){if(_0x13554d){return _0x528621[_0x79b5('0x17')](_0x21489c);}return _0x528621[_0x79b5('0x18')](_0x21489c)['end']();};}function respondWithResult(_0x3f5c8d,_0x4cf26e){_0x4cf26e=_0x4cf26e||0xc8;return function(_0x2dd5b8){if(_0x2dd5b8){return _0x3f5c8d[_0x79b5('0x18')](_0x4cf26e)[_0x79b5('0x19')](_0x2dd5b8);}};}function respondWithFilteredResult(_0x1f80b3,_0xc2d0ee){return function(_0x3bb7d0){if(_0x3bb7d0){var _0x423939=typeof _0xc2d0ee[_0x79b5('0x1a')]===_0x79b5('0x1b')&&typeof _0xc2d0ee[_0x79b5('0x1c')]===_0x79b5('0x1b');var _0x23e23d=_0x3bb7d0[_0x79b5('0x1d')];var _0x863c21=_0x423939?0x0:_0xc2d0ee['offset'];var _0x1b48c6=_0x423939?_0x3bb7d0[_0x79b5('0x1d')]:_0xc2d0ee['offset']+_0xc2d0ee[_0x79b5('0x1c')];var _0x188ea6;if(_0x1b48c6>=_0x23e23d){_0x1b48c6=_0x23e23d;_0x188ea6=0xc8;}else{_0x188ea6=0xce;}_0x1f80b3[_0x79b5('0x18')](_0x188ea6);return _0x1f80b3[_0x79b5('0x1e')](_0x79b5('0x1f'),_0x863c21+'-'+_0x1b48c6+'/'+_0x23e23d)[_0x79b5('0x19')](_0x3bb7d0);}return null;};}function patchUpdates(_0x4888e4){return function(_0xb91c2){try{jsonpatch[_0x79b5('0x20')](_0xb91c2,_0x4888e4,!![]);}catch(_0x346a31){return BPromise[_0x79b5('0x21')](_0x346a31);}return _0xb91c2[_0x79b5('0x22')]();};}function saveUpdates(_0x40656f,_0x1d4260){return function(_0x5050ed){if(_0x5050ed){return _0x5050ed[_0x79b5('0x23')](_0x40656f)[_0x79b5('0x24')](function(_0x10ea60){return _0x10ea60;});}return null;};}function removeEntity(_0x23efd2,_0x33aede){return function(_0x34f3d5){if(_0x34f3d5){return _0x34f3d5[_0x79b5('0x25')]()[_0x79b5('0x24')](function(){_0x23efd2[_0x79b5('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28a402,_0x42d6d3){return function(_0x53dcae){if(!_0x53dcae){_0x28a402['sendStatus'](0x194);}return _0x53dcae;};}function handleError(_0x18cf05,_0x70a87e){_0x70a87e=_0x70a87e||0x1f4;return function(_0x2cda1b){logger['error'](_0x2cda1b['stack']);if(_0x2cda1b[_0x79b5('0x26')]){delete _0x2cda1b['name'];}_0x18cf05[_0x79b5('0x18')](_0x70a87e)[_0x79b5('0x27')](_0x2cda1b);};}exports[_0x79b5('0x28')]=function(_0x429606,_0x2e8af6){var _0x185d16={},_0x5181a3={},_0x486624={'count':0x0,'rows':[]};var _0x5d094a=_[_0x79b5('0x29')](db[_0x79b5('0x2a')][_0x79b5('0x2b')],function(_0x5e549b){return{'name':_0x5e549b[_0x79b5('0x2c')],'type':_0x5e549b['type'][_0x79b5('0x2d')]};});_0x5181a3[_0x79b5('0x2e')]=_[_0x79b5('0x29')](_0x5d094a,_0x79b5('0x26'));_0x5181a3['query']=_[_0x79b5('0x2f')](_0x429606[_0x79b5('0x30')]);_0x5181a3[_0x79b5('0x31')]=_['intersection'](_0x5181a3[_0x79b5('0x2e')],_0x5181a3[_0x79b5('0x30')]);_0x185d16[_0x79b5('0x32')]=_[_0x79b5('0x33')](_0x5181a3[_0x79b5('0x2e')],qs[_0x79b5('0x34')](_0x429606[_0x79b5('0x30')][_0x79b5('0x34')]));_0x185d16[_0x79b5('0x32')]=_0x185d16[_0x79b5('0x32')]['length']?_0x185d16[_0x79b5('0x32')]:_0x5181a3[_0x79b5('0x2e')];if(!_0x429606[_0x79b5('0x30')]['hasOwnProperty'](_0x79b5('0x35'))){_0x185d16[_0x79b5('0x1c')]=qs[_0x79b5('0x1c')](_0x429606[_0x79b5('0x30')]['limit']);_0x185d16[_0x79b5('0x1a')]=qs[_0x79b5('0x1a')](_0x429606[_0x79b5('0x30')][_0x79b5('0x1a')]);}_0x185d16['order']=qs[_0x79b5('0x36')](_0x429606[_0x79b5('0x30')][_0x79b5('0x36')]);_0x185d16[_0x79b5('0x37')]=qs[_0x79b5('0x31')](_[_0x79b5('0x38')](_0x429606[_0x79b5('0x30')],_0x5181a3[_0x79b5('0x31')]),_0x5d094a);if(_0x429606['query'][_0x79b5('0x39')]){_0x185d16['where']=_['merge'](_0x185d16['where'],{'$or':_[_0x79b5('0x29')](_0x5d094a,function(_0x41855f){if(_0x41855f['type']!==_0x79b5('0x3a')){var _0x138c2b={};_0x138c2b[_0x41855f['name']]={'$like':'%'+_0x429606[_0x79b5('0x30')][_0x79b5('0x39')]+'%'};return _0x138c2b;}})});}_0x185d16=_[_0x79b5('0x3b')]({},_0x185d16,_0x429606[_0x79b5('0x3c')]);var _0x2642b5={'where':_0x185d16[_0x79b5('0x37')]};return db[_0x79b5('0x2a')]['count'](_0x2642b5)[_0x79b5('0x24')](function(_0x46a64e){_0x486624[_0x79b5('0x1d')]=_0x46a64e;if(_0x429606[_0x79b5('0x30')]['includeAll']){_0x185d16[_0x79b5('0x3d')]=[{'all':!![]}];}return db[_0x79b5('0x2a')]['findAll'](_0x185d16);})[_0x79b5('0x24')](function(_0x585d1a){_0x486624['rows']=_0x585d1a;return _0x486624;})[_0x79b5('0x24')](respondWithFilteredResult(_0x2e8af6,_0x185d16))[_0x79b5('0x3e')](handleError(_0x2e8af6,null));};exports[_0x79b5('0x3f')]=function(_0x2499c5,_0x2e4a8f){var _0x2cd269={'raw':!![],'where':{'id':_0x2499c5[_0x79b5('0x40')]['id']}},_0x2ee939={};_0x2ee939[_0x79b5('0x2e')]=_[_0x79b5('0x2f')](db[_0x79b5('0x2a')][_0x79b5('0x2b')]);_0x2ee939['query']=_[_0x79b5('0x2f')](_0x2499c5[_0x79b5('0x30')]);_0x2ee939[_0x79b5('0x31')]=_[_0x79b5('0x33')](_0x2ee939[_0x79b5('0x2e')],_0x2ee939[_0x79b5('0x30')]);_0x2cd269[_0x79b5('0x32')]=_['intersection'](_0x2ee939['model'],qs[_0x79b5('0x34')](_0x2499c5[_0x79b5('0x30')][_0x79b5('0x34')]));_0x2cd269[_0x79b5('0x32')]=_0x2cd269[_0x79b5('0x32')][_0x79b5('0x41')]?_0x2cd269[_0x79b5('0x32')]:_0x2ee939[_0x79b5('0x2e')];if(_0x2499c5[_0x79b5('0x30')][_0x79b5('0x42')]){_0x2cd269[_0x79b5('0x3d')]=[{'all':!![]}];}_0x2cd269=_[_0x79b5('0x3b')]({},_0x2cd269,_0x2499c5[_0x79b5('0x3c')]);return db[_0x79b5('0x2a')][_0x79b5('0x43')](_0x2cd269)[_0x79b5('0x24')](handleEntityNotFound(_0x2e4a8f,null))['then'](respondWithResult(_0x2e4a8f,null))[_0x79b5('0x3e')](handleError(_0x2e4a8f,null));};exports[_0x79b5('0x44')]=function(_0x55c7bd,_0x43a292){return db[_0x79b5('0x2a')]['create'](_0x55c7bd[_0x79b5('0x45')],{})[_0x79b5('0x24')](respondWithResult(_0x43a292,0xc9))['catch'](handleError(_0x43a292,null));};exports['update']=function(_0x26f64e,_0x4570d6){if(_0x26f64e[_0x79b5('0x45')]['id']){delete _0x26f64e[_0x79b5('0x45')]['id'];}return db[_0x79b5('0x2a')][_0x79b5('0x43')]({'where':{'id':_0x26f64e[_0x79b5('0x40')]['id']}})[_0x79b5('0x24')](handleEntityNotFound(_0x4570d6,null))[_0x79b5('0x24')](saveUpdates(_0x26f64e[_0x79b5('0x45')],null))[_0x79b5('0x24')](respondWithResult(_0x4570d6,null))[_0x79b5('0x3e')](handleError(_0x4570d6,null));};exports[_0x79b5('0x25')]=function(_0x595bb6,_0x529461){return db[_0x79b5('0x2a')][_0x79b5('0x43')]({'where':{'id':_0x595bb6[_0x79b5('0x40')]['id']}})[_0x79b5('0x24')](handleEntityNotFound(_0x529461,null))[_0x79b5('0x24')](removeEntity(_0x529461,null))[_0x79b5('0x3e')](handleError(_0x529461,null));};exports['describe']=function(_0x85add7,_0x4c2e89){return db[_0x79b5('0x2a')]['describe']()['then'](respondWithResult(_0x4c2e89,null))['catch'](handleError(_0x4c2e89,null));}; \ No newline at end of file +var _0x359a=['request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','OpenchannelTransferReport','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','filters','filter','merge','options','where','includeAll','include','findAll','catch','show','params','keys','rawAttributes','find','create','body','rimraf','zip-dir','fast-json-patch'];(function(_0x4179a5,_0xfbcea7){var _0x59cca3=function(_0x4b348b){while(--_0x4b348b){_0x4179a5['push'](_0x4179a5['shift']());}};_0x59cca3(++_0xfbcea7);}(_0x359a,0x8d));var _0xa359=function(_0x378d78,_0x468c05){_0x378d78=_0x378d78-0x0;var _0x345463=_0x359a[_0x378d78];return _0x345463;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa359('0x0'));var zipdir=require(_0xa359('0x1'));var jsonpatch=require(_0xa359('0x2'));var rp=require(_0xa359('0x3'));var moment=require(_0xa359('0x4'));var BPromise=require(_0xa359('0x5'));var Mustache=require(_0xa359('0x6'));var util=require('util');var path=require(_0xa359('0x7'));var sox=require(_0xa359('0x8'));var csv=require(_0xa359('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa359('0xa'));var _=require(_0xa359('0xb'));var squel=require(_0xa359('0xc'));var crypto=require(_0xa359('0xd'));var jsforce=require(_0xa359('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa359('0x9'));var querystring=require(_0xa359('0xf'));var Papa=require(_0xa359('0x10'));var Redis=require(_0xa359('0x11'));var authService=require(_0xa359('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa359('0x13'));var hardwareService=require(_0xa359('0x14'));var logger=require('../../config/logger')(_0xa359('0x15'));var utils=require('../../config/utils');var config=require(_0xa359('0x16'));var licenseUtil=require(_0xa359('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x148d54,_0x561a4f){_0x561a4f=_0x561a4f||0xcc;return function(_0x36bc98){if(_0x36bc98){return _0x148d54['sendStatus'](_0x561a4f);}return _0x148d54[_0xa359('0x18')](_0x561a4f)[_0xa359('0x19')]();};}function respondWithResult(_0x410f98,_0x1dd950){_0x1dd950=_0x1dd950||0xc8;return function(_0x5324f4){if(_0x5324f4){return _0x410f98[_0xa359('0x18')](_0x1dd950)['json'](_0x5324f4);}};}function respondWithFilteredResult(_0x1e0824,_0x4327e6){return function(_0x493541){if(_0x493541){var _0x1f7d73=typeof _0x4327e6[_0xa359('0x1a')]===_0xa359('0x1b')&&typeof _0x4327e6['limit']===_0xa359('0x1b');var _0x2a021e=_0x493541[_0xa359('0x1c')];var _0xddd753=_0x1f7d73?0x0:_0x4327e6[_0xa359('0x1a')];var _0x2c0f22=_0x1f7d73?_0x493541['count']:_0x4327e6[_0xa359('0x1a')]+_0x4327e6[_0xa359('0x1d')];var _0x317848;if(_0x2c0f22>=_0x2a021e){_0x2c0f22=_0x2a021e;_0x317848=0xc8;}else{_0x317848=0xce;}_0x1e0824[_0xa359('0x18')](_0x317848);return _0x1e0824[_0xa359('0x1e')](_0xa359('0x1f'),_0xddd753+'-'+_0x2c0f22+'/'+_0x2a021e)[_0xa359('0x20')](_0x493541);}return null;};}function patchUpdates(_0x5cdc39){return function(_0x4aba8e){try{jsonpatch[_0xa359('0x21')](_0x4aba8e,_0x5cdc39,!![]);}catch(_0x52b473){return BPromise['reject'](_0x52b473);}return _0x4aba8e[_0xa359('0x22')]();};}function saveUpdates(_0xebf466,_0x475b35){return function(_0x3df611){if(_0x3df611){return _0x3df611[_0xa359('0x23')](_0xebf466)[_0xa359('0x24')](function(_0x3f796a){return _0x3f796a;});}return null;};}function removeEntity(_0x2b2e61,_0x59081d){return function(_0x45618c){if(_0x45618c){return _0x45618c[_0xa359('0x25')]()[_0xa359('0x24')](function(){_0x2b2e61['status'](0xcc)[_0xa359('0x19')]();});}};}function handleEntityNotFound(_0x580335,_0x7e4633){return function(_0x3481ef){if(!_0x3481ef){_0x580335[_0xa359('0x26')](0x194);}return _0x3481ef;};}function handleError(_0x29da99,_0x1fe741){_0x1fe741=_0x1fe741||0x1f4;return function(_0x4cc4c0){logger[_0xa359('0x27')](_0x4cc4c0[_0xa359('0x28')]);if(_0x4cc4c0[_0xa359('0x29')]){delete _0x4cc4c0[_0xa359('0x29')];}_0x29da99[_0xa359('0x18')](_0x1fe741)[_0xa359('0x2a')](_0x4cc4c0);};}exports[_0xa359('0x2b')]=function(_0x1c8057,_0x1ff294){var _0x2b965b={},_0x14e23e={},_0x49dc9e={'count':0x0,'rows':[]};var _0x44b3fe=_[_0xa359('0x2c')](db[_0xa359('0x2d')]['rawAttributes'],function(_0x59d716){return{'name':_0x59d716[_0xa359('0x2e')],'type':_0x59d716[_0xa359('0x2f')][_0xa359('0x30')]};});_0x14e23e[_0xa359('0x31')]=_[_0xa359('0x2c')](_0x44b3fe,_0xa359('0x29'));_0x14e23e[_0xa359('0x32')]=_['keys'](_0x1c8057[_0xa359('0x32')]);_0x14e23e['filters']=_[_0xa359('0x33')](_0x14e23e['model'],_0x14e23e[_0xa359('0x32')]);_0x2b965b[_0xa359('0x34')]=_[_0xa359('0x33')](_0x14e23e[_0xa359('0x31')],qs[_0xa359('0x35')](_0x1c8057[_0xa359('0x32')][_0xa359('0x35')]));_0x2b965b['attributes']=_0x2b965b[_0xa359('0x34')]['length']?_0x2b965b[_0xa359('0x34')]:_0x14e23e[_0xa359('0x31')];if(!_0x1c8057['query'][_0xa359('0x36')](_0xa359('0x37'))){_0x2b965b['limit']=qs[_0xa359('0x1d')](_0x1c8057[_0xa359('0x32')][_0xa359('0x1d')]);_0x2b965b[_0xa359('0x1a')]=qs[_0xa359('0x1a')](_0x1c8057['query'][_0xa359('0x1a')]);}_0x2b965b['order']=qs['sort'](_0x1c8057[_0xa359('0x32')]['sort']);_0x2b965b['where']=qs[_0xa359('0x38')](_['pick'](_0x1c8057[_0xa359('0x32')],_0x14e23e[_0xa359('0x38')]),_0x44b3fe);if(_0x1c8057[_0xa359('0x32')][_0xa359('0x39')]){_0x2b965b['where']=_[_0xa359('0x3a')](_0x2b965b['where'],{'$or':_[_0xa359('0x2c')](_0x44b3fe,function(_0x5c1245){if(_0x5c1245[_0xa359('0x2f')]!=='VIRTUAL'){var _0x415350={};_0x415350[_0x5c1245[_0xa359('0x29')]]={'$like':'%'+_0x1c8057['query'][_0xa359('0x39')]+'%'};return _0x415350;}})});}_0x2b965b=_[_0xa359('0x3a')]({},_0x2b965b,_0x1c8057[_0xa359('0x3b')]);var _0x5f474a={'where':_0x2b965b[_0xa359('0x3c')]};return db[_0xa359('0x2d')][_0xa359('0x1c')](_0x5f474a)[_0xa359('0x24')](function(_0x5335b1){_0x49dc9e[_0xa359('0x1c')]=_0x5335b1;if(_0x1c8057[_0xa359('0x32')][_0xa359('0x3d')]){_0x2b965b[_0xa359('0x3e')]=[{'all':!![]}];}return db[_0xa359('0x2d')][_0xa359('0x3f')](_0x2b965b);})[_0xa359('0x24')](function(_0x369a99){_0x49dc9e['rows']=_0x369a99;return _0x49dc9e;})[_0xa359('0x24')](respondWithFilteredResult(_0x1ff294,_0x2b965b))[_0xa359('0x40')](handleError(_0x1ff294,null));};exports[_0xa359('0x41')]=function(_0x137cd1,_0x22f7f3){var _0x4e444d={'raw':!![],'where':{'id':_0x137cd1[_0xa359('0x42')]['id']}},_0x2e13ca={};_0x2e13ca[_0xa359('0x31')]=_[_0xa359('0x43')](db['OpenchannelTransferReport'][_0xa359('0x44')]);_0x2e13ca[_0xa359('0x32')]=_[_0xa359('0x43')](_0x137cd1[_0xa359('0x32')]);_0x2e13ca[_0xa359('0x38')]=_[_0xa359('0x33')](_0x2e13ca[_0xa359('0x31')],_0x2e13ca['query']);_0x4e444d[_0xa359('0x34')]=_['intersection'](_0x2e13ca[_0xa359('0x31')],qs[_0xa359('0x35')](_0x137cd1[_0xa359('0x32')][_0xa359('0x35')]));_0x4e444d[_0xa359('0x34')]=_0x4e444d[_0xa359('0x34')]['length']?_0x4e444d[_0xa359('0x34')]:_0x2e13ca[_0xa359('0x31')];if(_0x137cd1['query'][_0xa359('0x3d')]){_0x4e444d[_0xa359('0x3e')]=[{'all':!![]}];}_0x4e444d=_[_0xa359('0x3a')]({},_0x4e444d,_0x137cd1['options']);return db['OpenchannelTransferReport'][_0xa359('0x45')](_0x4e444d)[_0xa359('0x24')](handleEntityNotFound(_0x22f7f3,null))[_0xa359('0x24')](respondWithResult(_0x22f7f3,null))['catch'](handleError(_0x22f7f3,null));};exports[_0xa359('0x46')]=function(_0x2dac01,_0x2fbaa8){return db['OpenchannelTransferReport'][_0xa359('0x46')](_0x2dac01[_0xa359('0x47')],{})[_0xa359('0x24')](respondWithResult(_0x2fbaa8,0xc9))['catch'](handleError(_0x2fbaa8,null));};exports[_0xa359('0x23')]=function(_0x4c976a,_0x5b70e9){if(_0x4c976a[_0xa359('0x47')]['id']){delete _0x4c976a['body']['id'];}return db['OpenchannelTransferReport'][_0xa359('0x45')]({'where':{'id':_0x4c976a[_0xa359('0x42')]['id']}})[_0xa359('0x24')](handleEntityNotFound(_0x5b70e9,null))['then'](saveUpdates(_0x4c976a['body'],null))[_0xa359('0x24')](respondWithResult(_0x5b70e9,null))[_0xa359('0x40')](handleError(_0x5b70e9,null));};exports[_0xa359('0x25')]=function(_0x465e6e,_0x31e95f){return db[_0xa359('0x2d')][_0xa359('0x45')]({'where':{'id':_0x465e6e['params']['id']}})[_0xa359('0x24')](handleEntityNotFound(_0x31e95f,null))[_0xa359('0x24')](removeEntity(_0x31e95f,null))['catch'](handleError(_0x31e95f,null));};exports['describe']=function(_0xe5b90c,_0x2f031c){return db[_0xa359('0x2d')]['describe']()[_0xa359('0x24')](respondWithResult(_0x2f031c,null))['catch'](handleError(_0x2f031c,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 9c2d58e..7fc2089 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 _0x3cbd=['request-promise','path','rimraf','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x5535d1,_0x44ad8f){var _0x2ebc63=function(_0x4a01d6){while(--_0x4a01d6){_0x5535d1['push'](_0x5535d1['shift']());}};_0x2ebc63(++_0x44ad8f);}(_0x3cbd,0x105));var _0xd3cb=function(_0x1d8b1d,_0x11d691){_0x1d8b1d=_0x1d8b1d-0x0;var _0x109ed1=_0x3cbd[_0x1d8b1d];return _0x109ed1;};'use strict';var _=require(_0xd3cb('0x0'));var util=require(_0xd3cb('0x1'));var logger=require(_0xd3cb('0x2'))(_0xd3cb('0x3'));var moment=require(_0xd3cb('0x4'));var BPromise=require('bluebird');var rp=require(_0xd3cb('0x5'));var fs=require('fs');var path=require(_0xd3cb('0x6'));var rimraf=require(_0xd3cb('0x7'));var config=require('../../config/environment');var attributes=require(_0xd3cb('0x8'));module[_0xd3cb('0x9')]=function(_0x30c06e,_0x19bfaa){return _0x30c06e[_0xd3cb('0xa')](_0xd3cb('0xb'),attributes,{'tableName':_0xd3cb('0xc'),'paranoid':![],'indexes':[{'name':_0xd3cb('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5127=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid'];(function(_0x50e7b8,_0x2cdb30){var _0x955d48=function(_0x5a4494){while(--_0x5a4494){_0x50e7b8['push'](_0x50e7b8['shift']());}};_0x955d48(++_0x2cdb30);}(_0x5127,0x16c));var _0x7512=function(_0x4fadaf,_0x179d85){_0x4fadaf=_0x4fadaf-0x0;var _0x4738a8=_0x5127[_0x4fadaf];return _0x4738a8;};'use strict';var _=require('lodash');var util=require(_0x7512('0x0'));var logger=require(_0x7512('0x1'))('api');var moment=require(_0x7512('0x2'));var BPromise=require(_0x7512('0x3'));var rp=require(_0x7512('0x4'));var fs=require('fs');var path=require(_0x7512('0x5'));var rimraf=require(_0x7512('0x6'));var config=require(_0x7512('0x7'));var attributes=require(_0x7512('0x8'));module[_0x7512('0x9')]=function(_0x2ed5c7,_0x1ce563){return _0x2ed5c7[_0x7512('0xa')](_0x7512('0xb'),attributes,{'tableName':_0x7512('0xc'),'paranoid':![],'indexes':[{'name':_0x7512('0xd'),'fields':[_0x7512('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index edded27..f44ff64 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 _0x277c=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','moment','bluebird'];(function(_0x45e258,_0x4252c8){var _0x12c3c5=function(_0x3b1f7f){while(--_0x3b1f7f){_0x45e258['push'](_0x45e258['shift']());}};_0x12c3c5(++_0x4252c8);}(_0x277c,0x153));var _0xc277=function(_0x106eba,_0x4ef353){_0x106eba=_0x106eba-0x0;var _0x2fe56f=_0x277c[_0x106eba];return _0x2fe56f;};'use strict';var _=require(_0xc277('0x0'));var util=require('util');var moment=require(_0xc277('0x1'));var BPromise=require(_0xc277('0x2'));var rs=require(_0xc277('0x3'));var fs=require('fs');var Redis=require(_0xc277('0x4'));var db=require(_0xc277('0x5'))['db'];var utils=require(_0xc277('0x6'));var logger=require(_0xc277('0x7'))(_0xc277('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc277('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x77e168,_0x54d634,_0x378158){return new BPromise(function(_0x17a2fe,_0x55be1f){return client[_0xc277('0xa')](_0x77e168,_0x378158)[_0xc277('0xb')](function(_0xfdf694){logger[_0xc277('0xc')](_0xc277('0xd'),_0x54d634,_0xc277('0xe'));logger['debug']('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x54d634,_0xc277('0xe'),JSON[_0xc277('0xf')](_0xfdf694));if(_0xfdf694[_0xc277('0x10')]){if(_0xfdf694[_0xc277('0x10')]['code']===0x1f4){logger[_0xc277('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x54d634,_0xfdf694[_0xc277('0x10')][_0xc277('0x11')]);return _0x55be1f(_0xfdf694[_0xc277('0x10')][_0xc277('0x11')]);}logger['error'](_0xc277('0xd'),_0x54d634,_0xfdf694[_0xc277('0x10')][_0xc277('0x11')]);return _0x17a2fe(_0xfdf694['error']['message']);}else{logger[_0xc277('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x54d634,_0xc277('0xe'));_0x17a2fe(_0xfdf694['result'][_0xc277('0x11')]);}})[_0xc277('0x12')](function(_0x15f560){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x54d634,_0x15f560);_0x55be1f(_0x15f560);});});} \ No newline at end of file +var _0x3ca4=['debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x7bc63a,_0x26422a){var _0xed898e=function(_0x4a222a){while(--_0x4a222a){_0x7bc63a['push'](_0x7bc63a['shift']());}};_0xed898e(++_0x26422a);}(_0x3ca4,0x17d));var _0x43ca=function(_0x676f93,_0x4c953f){_0x676f93=_0x676f93-0x0;var _0x475222=_0x3ca4[_0x676f93];return _0x475222;};'use strict';var _=require(_0x43ca('0x0'));var util=require(_0x43ca('0x1'));var moment=require(_0x43ca('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x43ca('0x3'));var db=require(_0x43ca('0x4'))['db'];var utils=require(_0x43ca('0x5'));var logger=require(_0x43ca('0x6'))(_0x43ca('0x7'));var config=require(_0x43ca('0x8'));var jayson=require(_0x43ca('0x9'));var client=jayson['client'][_0x43ca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ba987,_0x2e6edf,_0x609e75){return new BPromise(function(_0x3147b3,_0x4669f5){return client[_0x43ca('0xb')](_0x1ba987,_0x609e75)[_0x43ca('0xc')](function(_0x4cd9b6){logger['info'](_0x43ca('0xd'),_0x2e6edf,_0x43ca('0xe'));logger[_0x43ca('0xf')](_0x43ca('0x10'),_0x2e6edf,'request\x20sent',JSON[_0x43ca('0x11')](_0x4cd9b6));if(_0x4cd9b6[_0x43ca('0x12')]){if(_0x4cd9b6[_0x43ca('0x12')][_0x43ca('0x13')]===0x1f4){logger[_0x43ca('0x12')](_0x43ca('0xd'),_0x2e6edf,_0x4cd9b6[_0x43ca('0x12')][_0x43ca('0x14')]);return _0x4669f5(_0x4cd9b6[_0x43ca('0x12')]['message']);}logger[_0x43ca('0x12')](_0x43ca('0xd'),_0x2e6edf,_0x4cd9b6['error'][_0x43ca('0x14')]);return _0x3147b3(_0x4cd9b6['error'][_0x43ca('0x14')]);}else{logger['info'](_0x43ca('0xd'),_0x2e6edf,_0x43ca('0xe'));_0x3147b3(_0x4cd9b6['result'][_0x43ca('0x14')]);}})[_0x43ca('0x15')](function(_0x14f9af){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x2e6edf,_0x14f9af);_0x4669f5(_0x14f9af);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index f8b07d9..6a5d79b 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 _0x8346=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./pause.controller','get','isAuthenticated','/:id','show','create','put','update','delete'];(function(_0x5c49f4,_0x2fa313){var _0x293c9d=function(_0x475b4e){while(--_0x475b4e){_0x5c49f4['push'](_0x5c49f4['shift']());}};_0x293c9d(++_0x2fa313);}(_0x8346,0x1b7));var _0x6834=function(_0x2d9e90,_0x59173b){_0x2d9e90=_0x2d9e90-0x0;var _0x31d721=_0x8346[_0x2d9e90];return _0x31d721;};'use strict';var multer=require(_0x6834('0x0'));var util=require(_0x6834('0x1'));var path=require('path');var timeout=require(_0x6834('0x2'));var express=require(_0x6834('0x3'));var router=express[_0x6834('0x4')]();var fs_extra=require(_0x6834('0x5'));var auth=require(_0x6834('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6834('0x7'));var controller=require(_0x6834('0x8'));router[_0x6834('0x9')]('/',auth[_0x6834('0xa')](),controller['index']);router[_0x6834('0x9')](_0x6834('0xb'),auth['isAuthenticated'](),controller[_0x6834('0xc')]);router['post']('/',auth[_0x6834('0xa')](),controller[_0x6834('0xd')]);router[_0x6834('0xe')]('/:id',auth[_0x6834('0xa')](),controller[_0x6834('0xf')]);router[_0x6834('0x10')](_0x6834('0xb'),auth['isAuthenticated'](),controller[_0x6834('0x11')]);module[_0x6834('0x12')]=router; \ No newline at end of file +var _0x6e7f=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./pause.controller','isAuthenticated','index','get','/:id','show'];(function(_0x9ff9c7,_0x4b2197){var _0x524562=function(_0x1d0a6e){while(--_0x1d0a6e){_0x9ff9c7['push'](_0x9ff9c7['shift']());}};_0x524562(++_0x4b2197);}(_0x6e7f,0xc4));var _0xf6e7=function(_0x6309ea,_0x18dac4){_0x6309ea=_0x6309ea-0x0;var _0x4cd031=_0x6e7f[_0x6309ea];return _0x4cd031;};'use strict';var multer=require(_0xf6e7('0x0'));var util=require(_0xf6e7('0x1'));var path=require(_0xf6e7('0x2'));var timeout=require(_0xf6e7('0x3'));var express=require(_0xf6e7('0x4'));var router=express[_0xf6e7('0x5')]();var fs_extra=require(_0xf6e7('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf6e7('0x7'));var controller=require(_0xf6e7('0x8'));router['get']('/',auth[_0xf6e7('0x9')](),controller[_0xf6e7('0xa')]);router[_0xf6e7('0xb')](_0xf6e7('0xc'),auth[_0xf6e7('0x9')](),controller[_0xf6e7('0xd')]);router[_0xf6e7('0xe')]('/',auth[_0xf6e7('0x9')](),controller[_0xf6e7('0xf')]);router[_0xf6e7('0x10')]('/:id',auth[_0xf6e7('0x9')](),controller[_0xf6e7('0x11')]);router[_0xf6e7('0x12')](_0xf6e7('0xc'),auth[_0xf6e7('0x9')](),controller[_0xf6e7('0x13')]);module[_0xf6e7('0x14')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 7f601db..a166c83 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 _0x15eb=['exports','STRING','name','sequelize'];(function(_0x147b36,_0x2f20c1){var _0x3f5ac4=function(_0x44d92f){while(--_0x44d92f){_0x147b36['push'](_0x147b36['shift']());}};_0x3f5ac4(++_0x2f20c1);}(_0x15eb,0x103));var _0xb15e=function(_0x361b1a,_0x14019c){_0x361b1a=_0x361b1a-0x0;var _0x39c323=_0x15eb[_0x361b1a];return _0x39c323;};'use strict';var Sequelize=require(_0xb15e('0x0'));module[_0xb15e('0x1')]={'name':{'type':Sequelize[_0xb15e('0x2')],'unique':_0xb15e('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 50debf0..3d10983 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 _0xfc65=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','get','Pauses','UserProfileResource','error','stack','name','send','index','Pause','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','keys','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x26c48e,_0x386c31){var _0xfbe8dd=function(_0x200328){while(--_0x200328){_0x26c48e['push'](_0x26c48e['shift']());}};_0xfbe8dd(++_0x386c31);}(_0xfc65,0x147));var _0x5fc6=function(_0x22e156,_0x1b6ae8){_0x22e156=_0x22e156-0x0;var _0x18c14e=_0xfc65[_0x22e156];return _0x18c14e;};'use strict';var emlformat=require(_0x5fc6('0x0'));var rimraf=require(_0x5fc6('0x1'));var zipdir=require(_0x5fc6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5fc6('0x3'));var moment=require(_0x5fc6('0x4'));var BPromise=require(_0x5fc6('0x5'));var Mustache=require(_0x5fc6('0x6'));var util=require(_0x5fc6('0x7'));var path=require(_0x5fc6('0x8'));var sox=require(_0x5fc6('0x9'));var csv=require('to-csv');var ejs=require(_0x5fc6('0xa'));var fs=require('fs');var fs_extra=require(_0x5fc6('0xb'));var _=require(_0x5fc6('0xc'));var squel=require(_0x5fc6('0xd'));var crypto=require(_0x5fc6('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5fc6('0xf'));var toCsv=require(_0x5fc6('0x10'));var querystring=require('querystring');var Papa=require(_0x5fc6('0x11'));var Redis=require(_0x5fc6('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5fc6('0x13'));var as=require(_0x5fc6('0x14'));var hardwareService=require(_0x5fc6('0x15'));var logger=require(_0x5fc6('0x16'))(_0x5fc6('0x17'));var utils=require(_0x5fc6('0x18'));var config=require(_0x5fc6('0x19'));var licenseUtil=require(_0x5fc6('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c1f01,_0x3e74a4){_0x3e74a4=_0x3e74a4||0xcc;return function(_0x569b07){if(_0x569b07){return _0x1c1f01[_0x5fc6('0x1b')](_0x3e74a4);}return _0x1c1f01[_0x5fc6('0x1c')](_0x3e74a4)[_0x5fc6('0x1d')]();};}function respondWithResult(_0x41de01,_0x413766){_0x413766=_0x413766||0xc8;return function(_0x482b7b){if(_0x482b7b){return _0x41de01[_0x5fc6('0x1c')](_0x413766)[_0x5fc6('0x1e')](_0x482b7b);}};}function respondWithFilteredResult(_0x3cecbb,_0x11dcc5){return function(_0x591e09){if(_0x591e09){var _0x1ce267=typeof _0x11dcc5[_0x5fc6('0x1f')]===_0x5fc6('0x20')&&typeof _0x11dcc5[_0x5fc6('0x21')]===_0x5fc6('0x20');var _0x59a8a3=_0x591e09['count'];var _0x292efb=_0x1ce267?0x0:_0x11dcc5[_0x5fc6('0x1f')];var _0x248272=_0x1ce267?_0x591e09[_0x5fc6('0x22')]:_0x11dcc5['offset']+_0x11dcc5[_0x5fc6('0x21')];var _0x54ac15;if(_0x248272>=_0x59a8a3){_0x248272=_0x59a8a3;_0x54ac15=0xc8;}else{_0x54ac15=0xce;}_0x3cecbb[_0x5fc6('0x1c')](_0x54ac15);return _0x3cecbb[_0x5fc6('0x23')](_0x5fc6('0x24'),_0x292efb+'-'+_0x248272+'/'+_0x59a8a3)[_0x5fc6('0x1e')](_0x591e09);}return null;};}function patchUpdates(_0x529671){return function(_0x2ff7bb){try{jsonpatch[_0x5fc6('0x25')](_0x2ff7bb,_0x529671,!![]);}catch(_0x5becfc){return BPromise['reject'](_0x5becfc);}return _0x2ff7bb[_0x5fc6('0x26')]();};}function saveUpdates(_0x481125,_0x34dd83){return function(_0x3415c9){if(_0x3415c9){return _0x3415c9['update'](_0x481125)[_0x5fc6('0x27')](function(_0x7692a){return _0x7692a;});}return null;};}function removeEntity(_0x5c20cb,_0x5d67d6){return function(_0x30853a){if(_0x30853a){return _0x30853a[_0x5fc6('0x28')]()[_0x5fc6('0x27')](function(){var _0x2e7c3a=_0x30853a[_0x5fc6('0x29')]({'plain':!![]});var _0x8227ef=_0x5fc6('0x2a');return db[_0x5fc6('0x2b')][_0x5fc6('0x28')]({'where':{'type':_0x8227ef,'resourceId':_0x2e7c3a['id']}})[_0x5fc6('0x27')](function(){return _0x30853a;});})[_0x5fc6('0x27')](function(){_0x5c20cb[_0x5fc6('0x1c')](0xcc)[_0x5fc6('0x1d')]();});}};}function handleEntityNotFound(_0x5f0e76,_0x3ea096){return function(_0x53d4de){if(!_0x53d4de){_0x5f0e76[_0x5fc6('0x1b')](0x194);}return _0x53d4de;};}function handleError(_0x2b0cc5,_0x5eba75){_0x5eba75=_0x5eba75||0x1f4;return function(_0x4487e9){logger[_0x5fc6('0x2c')](_0x4487e9[_0x5fc6('0x2d')]);if(_0x4487e9[_0x5fc6('0x2e')]){delete _0x4487e9[_0x5fc6('0x2e')];}_0x2b0cc5[_0x5fc6('0x1c')](_0x5eba75)[_0x5fc6('0x2f')](_0x4487e9);};}exports[_0x5fc6('0x30')]=function(_0x2b03cd,_0x450392){var _0x3437fb={},_0x2bc096={},_0x5b5478={'count':0x0,'rows':[]};var _0x1a3bf2=_['map'](db[_0x5fc6('0x31')]['rawAttributes'],function(_0x5a4076){return{'name':_0x5a4076[_0x5fc6('0x32')],'type':_0x5a4076[_0x5fc6('0x33')][_0x5fc6('0x34')]};});_0x2bc096[_0x5fc6('0x35')]=_[_0x5fc6('0x36')](_0x1a3bf2,_0x5fc6('0x2e'));_0x2bc096[_0x5fc6('0x37')]=_['keys'](_0x2b03cd[_0x5fc6('0x37')]);_0x2bc096[_0x5fc6('0x38')]=_[_0x5fc6('0x39')](_0x2bc096[_0x5fc6('0x35')],_0x2bc096[_0x5fc6('0x37')]);_0x3437fb[_0x5fc6('0x3a')]=_[_0x5fc6('0x39')](_0x2bc096[_0x5fc6('0x35')],qs[_0x5fc6('0x3b')](_0x2b03cd[_0x5fc6('0x37')][_0x5fc6('0x3b')]));_0x3437fb[_0x5fc6('0x3a')]=_0x3437fb[_0x5fc6('0x3a')][_0x5fc6('0x3c')]?_0x3437fb[_0x5fc6('0x3a')]:_0x2bc096['model'];if(!_0x2b03cd[_0x5fc6('0x37')][_0x5fc6('0x3d')](_0x5fc6('0x3e'))){_0x3437fb['limit']=qs[_0x5fc6('0x21')](_0x2b03cd['query'][_0x5fc6('0x21')]);_0x3437fb[_0x5fc6('0x1f')]=qs[_0x5fc6('0x1f')](_0x2b03cd['query'][_0x5fc6('0x1f')]);}_0x3437fb[_0x5fc6('0x3f')]=qs[_0x5fc6('0x40')](_0x2b03cd['query'][_0x5fc6('0x40')]);_0x3437fb[_0x5fc6('0x41')]=qs[_0x5fc6('0x38')](_[_0x5fc6('0x42')](_0x2b03cd[_0x5fc6('0x37')],_0x2bc096[_0x5fc6('0x38')]),_0x1a3bf2);if(_0x2b03cd['query'][_0x5fc6('0x43')]){_0x3437fb[_0x5fc6('0x41')]=_[_0x5fc6('0x44')](_0x3437fb[_0x5fc6('0x41')],{'$or':_[_0x5fc6('0x36')](_0x1a3bf2,function(_0x1efb0e){if(_0x1efb0e[_0x5fc6('0x33')]!=='VIRTUAL'){var _0x4cbcc0={};_0x4cbcc0[_0x1efb0e[_0x5fc6('0x2e')]]={'$like':'%'+_0x2b03cd['query']['filter']+'%'};return _0x4cbcc0;}})});}_0x3437fb=_[_0x5fc6('0x44')]({},_0x3437fb,_0x2b03cd[_0x5fc6('0x45')]);var _0x831e78={'where':_0x3437fb['where']};return db[_0x5fc6('0x31')][_0x5fc6('0x22')](_0x831e78)['then'](function(_0x31961a){_0x5b5478[_0x5fc6('0x22')]=_0x31961a;if(_0x2b03cd[_0x5fc6('0x37')][_0x5fc6('0x46')]){_0x3437fb['include']=[{'all':!![]}];}return db[_0x5fc6('0x31')][_0x5fc6('0x47')](_0x3437fb);})[_0x5fc6('0x27')](function(_0x539b71){_0x5b5478[_0x5fc6('0x48')]=_0x539b71;return _0x5b5478;})[_0x5fc6('0x27')](respondWithFilteredResult(_0x450392,_0x3437fb))['catch'](handleError(_0x450392,null));};exports[_0x5fc6('0x49')]=function(_0x4dc246,_0x18ede6){var _0x6cb9a6={'raw':!![],'where':{'id':_0x4dc246['params']['id']}},_0x1edbdd={};_0x1edbdd[_0x5fc6('0x35')]=_[_0x5fc6('0x4a')](db[_0x5fc6('0x31')]['rawAttributes']);_0x1edbdd[_0x5fc6('0x37')]=_[_0x5fc6('0x4a')](_0x4dc246[_0x5fc6('0x37')]);_0x1edbdd[_0x5fc6('0x38')]=_['intersection'](_0x1edbdd['model'],_0x1edbdd[_0x5fc6('0x37')]);_0x6cb9a6['attributes']=_[_0x5fc6('0x39')](_0x1edbdd[_0x5fc6('0x35')],qs[_0x5fc6('0x3b')](_0x4dc246[_0x5fc6('0x37')][_0x5fc6('0x3b')]));_0x6cb9a6[_0x5fc6('0x3a')]=_0x6cb9a6['attributes']['length']?_0x6cb9a6[_0x5fc6('0x3a')]:_0x1edbdd[_0x5fc6('0x35')];if(_0x4dc246[_0x5fc6('0x37')][_0x5fc6('0x46')]){_0x6cb9a6[_0x5fc6('0x4b')]=[{'all':!![]}];}_0x6cb9a6=_[_0x5fc6('0x44')]({},_0x6cb9a6,_0x4dc246['options']);return db['Pause'][_0x5fc6('0x4c')](_0x6cb9a6)[_0x5fc6('0x27')](handleEntityNotFound(_0x18ede6,null))['then'](respondWithResult(_0x18ede6,null))['catch'](handleError(_0x18ede6,null));};exports[_0x5fc6('0x4d')]=function(_0x4ab96e,_0xf57961){return db[_0x5fc6('0x31')][_0x5fc6('0x4d')](_0x4ab96e[_0x5fc6('0x4e')],{})[_0x5fc6('0x27')](function(_0x3f1552){var _0x2619bd=_0x4ab96e[_0x5fc6('0x4f')][_0x5fc6('0x29')]({'plain':!![]});if(!_0x2619bd)throw new Error(_0x5fc6('0x50'));if(_0x2619bd['role']===_0x5fc6('0x4f')){var _0x2b3482=_0x3f1552[_0x5fc6('0x29')]({'plain':!![]});var _0x11f851=_0x5fc6('0x2a');return db[_0x5fc6('0x51')][_0x5fc6('0x4c')]({'where':{'name':_0x11f851,'userProfileId':_0x2619bd['userProfileId']},'raw':!![]})[_0x5fc6('0x27')](function(_0x3c75f0){if(_0x3c75f0&&_0x3c75f0[_0x5fc6('0x52')]===0x0){return db[_0x5fc6('0x2b')][_0x5fc6('0x4d')]({'name':_0x2b3482[_0x5fc6('0x2e')],'resourceId':_0x2b3482['id'],'type':_0x3c75f0['name'],'sectionId':_0x3c75f0['id']},{})[_0x5fc6('0x27')](function(){return _0x3f1552;});}else{return _0x3f1552;}})[_0x5fc6('0x53')](function(_0x41e5b9){logger[_0x5fc6('0x2c')](_0x5fc6('0x54'),_0x41e5b9);throw _0x41e5b9;});}return _0x3f1552;})[_0x5fc6('0x27')](respondWithResult(_0xf57961,0xc9))[_0x5fc6('0x53')](handleError(_0xf57961,null));};exports[_0x5fc6('0x55')]=function(_0x3e1c94,_0x435426){if(_0x3e1c94[_0x5fc6('0x4e')]['id']){delete _0x3e1c94[_0x5fc6('0x4e')]['id'];}return db[_0x5fc6('0x31')][_0x5fc6('0x4c')]({'where':{'id':_0x3e1c94[_0x5fc6('0x56')]['id']}})[_0x5fc6('0x27')](handleEntityNotFound(_0x435426,null))[_0x5fc6('0x27')](saveUpdates(_0x3e1c94[_0x5fc6('0x4e')],null))['then'](respondWithResult(_0x435426,null))['catch'](handleError(_0x435426,null));};exports[_0x5fc6('0x28')]=function(_0x4c9031,_0x221484){return db[_0x5fc6('0x31')][_0x5fc6('0x4c')]({'where':{'id':_0x4c9031[_0x5fc6('0x56')]['id']}})[_0x5fc6('0x27')](handleEntityNotFound(_0x221484,null))['then'](removeEntity(_0x221484,null))[_0x5fc6('0x53')](handleError(_0x221484,null));}; \ No newline at end of file +var _0x1e61=['send','Pause','fieldName','key','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','where','type','filter','merge','options','count','includeAll','include','rows','catch','show','model','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','offset','limit','set','apply','reject','save','update','then','get','Pauses','UserProfileResource','destroy','sendStatus','error','stack','name'];(function(_0x495503,_0x1cbf12){var _0x2dccd2=function(_0x4633f3){while(--_0x4633f3){_0x495503['push'](_0x495503['shift']());}};_0x2dccd2(++_0x1cbf12);}(_0x1e61,0xcd));var _0x11e6=function(_0x5d5eda,_0x5c9838){_0x5d5eda=_0x5d5eda-0x0;var _0x4b88d7=_0x1e61[_0x5d5eda];return _0x4b88d7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x11e6('0x0'));var zipdir=require(_0x11e6('0x1'));var jsonpatch=require(_0x11e6('0x2'));var rp=require(_0x11e6('0x3'));var moment=require(_0x11e6('0x4'));var BPromise=require(_0x11e6('0x5'));var Mustache=require(_0x11e6('0x6'));var util=require(_0x11e6('0x7'));var path=require(_0x11e6('0x8'));var sox=require(_0x11e6('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x11e6('0xa'));var _=require('lodash');var squel=require(_0x11e6('0xb'));var crypto=require(_0x11e6('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x11e6('0xd'));var Papa=require(_0x11e6('0xe'));var Redis=require(_0x11e6('0xf'));var authService=require(_0x11e6('0x10'));var qs=require(_0x11e6('0x11'));var as=require(_0x11e6('0x12'));var hardwareService=require(_0x11e6('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x11e6('0x14'));var config=require(_0x11e6('0x15'));var licenseUtil=require(_0x11e6('0x16'));var db=require(_0x11e6('0x17'))['db'];function respondWithStatusCode(_0x23f4c1,_0x53a3f3){_0x53a3f3=_0x53a3f3||0xcc;return function(_0x54548b){if(_0x54548b){return _0x23f4c1['sendStatus'](_0x53a3f3);}return _0x23f4c1[_0x11e6('0x18')](_0x53a3f3)[_0x11e6('0x19')]();};}function respondWithResult(_0x5efdd4,_0x3f825b){_0x3f825b=_0x3f825b||0xc8;return function(_0x338bf6){if(_0x338bf6){return _0x5efdd4[_0x11e6('0x18')](_0x3f825b)[_0x11e6('0x1a')](_0x338bf6);}};}function respondWithFilteredResult(_0x1ecbae,_0x5b9087){return function(_0x53a039){if(_0x53a039){var _0x2b0b4e=typeof _0x5b9087['offset']==='undefined'&&typeof _0x5b9087['limit']===_0x11e6('0x1b');var _0x27c339=_0x53a039['count'];var _0x366640=_0x2b0b4e?0x0:_0x5b9087[_0x11e6('0x1c')];var _0x360282=_0x2b0b4e?_0x53a039['count']:_0x5b9087[_0x11e6('0x1c')]+_0x5b9087[_0x11e6('0x1d')];var _0x2ce7c4;if(_0x360282>=_0x27c339){_0x360282=_0x27c339;_0x2ce7c4=0xc8;}else{_0x2ce7c4=0xce;}_0x1ecbae['status'](_0x2ce7c4);return _0x1ecbae[_0x11e6('0x1e')]('Content-Range',_0x366640+'-'+_0x360282+'/'+_0x27c339)[_0x11e6('0x1a')](_0x53a039);}return null;};}function patchUpdates(_0x1cffc8){return function(_0x5be904){try{jsonpatch[_0x11e6('0x1f')](_0x5be904,_0x1cffc8,!![]);}catch(_0x1ac406){return BPromise[_0x11e6('0x20')](_0x1ac406);}return _0x5be904[_0x11e6('0x21')]();};}function saveUpdates(_0x52a950,_0xdb39fe){return function(_0xddb412){if(_0xddb412){return _0xddb412[_0x11e6('0x22')](_0x52a950)[_0x11e6('0x23')](function(_0x3cfe1b){return _0x3cfe1b;});}return null;};}function removeEntity(_0x5e55d1,_0x2c640b){return function(_0x563015){if(_0x563015){return _0x563015['destroy']()['then'](function(){var _0x1c35ae=_0x563015[_0x11e6('0x24')]({'plain':!![]});var _0xfad9f4=_0x11e6('0x25');return db[_0x11e6('0x26')][_0x11e6('0x27')]({'where':{'type':_0xfad9f4,'resourceId':_0x1c35ae['id']}})[_0x11e6('0x23')](function(){return _0x563015;});})[_0x11e6('0x23')](function(){_0x5e55d1[_0x11e6('0x18')](0xcc)[_0x11e6('0x19')]();});}};}function handleEntityNotFound(_0x576142,_0x2940e1){return function(_0x347b13){if(!_0x347b13){_0x576142[_0x11e6('0x28')](0x194);}return _0x347b13;};}function handleError(_0xa53fbc,_0x30cf59){_0x30cf59=_0x30cf59||0x1f4;return function(_0x2d9ba5){logger[_0x11e6('0x29')](_0x2d9ba5[_0x11e6('0x2a')]);if(_0x2d9ba5['name']){delete _0x2d9ba5[_0x11e6('0x2b')];}_0xa53fbc[_0x11e6('0x18')](_0x30cf59)[_0x11e6('0x2c')](_0x2d9ba5);};}exports['index']=function(_0x4cc1ba,_0x2e8411){var _0x44d365={},_0x53f678={},_0xc6f84c={'count':0x0,'rows':[]};var _0x106aed=_['map'](db[_0x11e6('0x2d')]['rawAttributes'],function(_0x4c7da4){return{'name':_0x4c7da4[_0x11e6('0x2e')],'type':_0x4c7da4['type'][_0x11e6('0x2f')]};});_0x53f678['model']=_['map'](_0x106aed,'name');_0x53f678[_0x11e6('0x30')]=_[_0x11e6('0x31')](_0x4cc1ba[_0x11e6('0x30')]);_0x53f678[_0x11e6('0x32')]=_['intersection'](_0x53f678['model'],_0x53f678[_0x11e6('0x30')]);_0x44d365[_0x11e6('0x33')]=_[_0x11e6('0x34')](_0x53f678['model'],qs[_0x11e6('0x35')](_0x4cc1ba['query'][_0x11e6('0x35')]));_0x44d365[_0x11e6('0x33')]=_0x44d365[_0x11e6('0x33')][_0x11e6('0x36')]?_0x44d365['attributes']:_0x53f678['model'];if(!_0x4cc1ba[_0x11e6('0x30')][_0x11e6('0x37')]('nolimit')){_0x44d365[_0x11e6('0x1d')]=qs[_0x11e6('0x1d')](_0x4cc1ba[_0x11e6('0x30')][_0x11e6('0x1d')]);_0x44d365[_0x11e6('0x1c')]=qs[_0x11e6('0x1c')](_0x4cc1ba[_0x11e6('0x30')][_0x11e6('0x1c')]);}_0x44d365[_0x11e6('0x38')]=qs[_0x11e6('0x39')](_0x4cc1ba['query'][_0x11e6('0x39')]);_0x44d365['where']=qs['filters'](_[_0x11e6('0x3a')](_0x4cc1ba['query'],_0x53f678[_0x11e6('0x32')]),_0x106aed);if(_0x4cc1ba['query']['filter']){_0x44d365['where']=_['merge'](_0x44d365[_0x11e6('0x3b')],{'$or':_['map'](_0x106aed,function(_0x3ba8dd){if(_0x3ba8dd[_0x11e6('0x3c')]!=='VIRTUAL'){var _0x338718={};_0x338718[_0x3ba8dd[_0x11e6('0x2b')]]={'$like':'%'+_0x4cc1ba[_0x11e6('0x30')][_0x11e6('0x3d')]+'%'};return _0x338718;}})});}_0x44d365=_[_0x11e6('0x3e')]({},_0x44d365,_0x4cc1ba[_0x11e6('0x3f')]);var _0x475360={'where':_0x44d365[_0x11e6('0x3b')]};return db['Pause'][_0x11e6('0x40')](_0x475360)[_0x11e6('0x23')](function(_0xa406c1){_0xc6f84c[_0x11e6('0x40')]=_0xa406c1;if(_0x4cc1ba[_0x11e6('0x30')][_0x11e6('0x41')]){_0x44d365[_0x11e6('0x42')]=[{'all':!![]}];}return db[_0x11e6('0x2d')]['findAll'](_0x44d365);})[_0x11e6('0x23')](function(_0x71f08c){_0xc6f84c[_0x11e6('0x43')]=_0x71f08c;return _0xc6f84c;})[_0x11e6('0x23')](respondWithFilteredResult(_0x2e8411,_0x44d365))[_0x11e6('0x44')](handleError(_0x2e8411,null));};exports[_0x11e6('0x45')]=function(_0x536d55,_0x41b0b7){var _0x5f323a={'raw':!![],'where':{'id':_0x536d55['params']['id']}},_0x23bffa={};_0x23bffa[_0x11e6('0x46')]=_[_0x11e6('0x31')](db[_0x11e6('0x2d')][_0x11e6('0x47')]);_0x23bffa['query']=_[_0x11e6('0x31')](_0x536d55[_0x11e6('0x30')]);_0x23bffa[_0x11e6('0x32')]=_['intersection'](_0x23bffa[_0x11e6('0x46')],_0x23bffa[_0x11e6('0x30')]);_0x5f323a['attributes']=_['intersection'](_0x23bffa[_0x11e6('0x46')],qs[_0x11e6('0x35')](_0x536d55[_0x11e6('0x30')][_0x11e6('0x35')]));_0x5f323a['attributes']=_0x5f323a[_0x11e6('0x33')][_0x11e6('0x36')]?_0x5f323a[_0x11e6('0x33')]:_0x23bffa['model'];if(_0x536d55['query'][_0x11e6('0x41')]){_0x5f323a['include']=[{'all':!![]}];}_0x5f323a=_[_0x11e6('0x3e')]({},_0x5f323a,_0x536d55[_0x11e6('0x3f')]);return db['Pause'][_0x11e6('0x48')](_0x5f323a)[_0x11e6('0x23')](handleEntityNotFound(_0x41b0b7,null))['then'](respondWithResult(_0x41b0b7,null))['catch'](handleError(_0x41b0b7,null));};exports['create']=function(_0x1252bd,_0x2f4c23){return db[_0x11e6('0x2d')][_0x11e6('0x49')](_0x1252bd[_0x11e6('0x4a')],{})['then'](function(_0x20342c){var _0x494e1b=_0x1252bd[_0x11e6('0x4b')][_0x11e6('0x24')]({'plain':!![]});if(!_0x494e1b)throw new Error(_0x11e6('0x4c'));if(_0x494e1b[_0x11e6('0x4d')]===_0x11e6('0x4b')){var _0x1fd098=_0x20342c[_0x11e6('0x24')]({'plain':!![]});var _0x4a9c67=_0x11e6('0x25');return db[_0x11e6('0x4e')][_0x11e6('0x48')]({'where':{'name':_0x4a9c67,'userProfileId':_0x494e1b[_0x11e6('0x4f')]},'raw':!![]})[_0x11e6('0x23')](function(_0x536f11){if(_0x536f11&&_0x536f11[_0x11e6('0x50')]===0x0){return db[_0x11e6('0x26')][_0x11e6('0x49')]({'name':_0x1fd098[_0x11e6('0x2b')],'resourceId':_0x1fd098['id'],'type':_0x536f11[_0x11e6('0x2b')],'sectionId':_0x536f11['id']},{})['then'](function(){return _0x20342c;});}else{return _0x20342c;}})['catch'](function(_0x31a05f){logger['error'](_0x11e6('0x51'),_0x31a05f);throw _0x31a05f;});}return _0x20342c;})[_0x11e6('0x23')](respondWithResult(_0x2f4c23,0xc9))[_0x11e6('0x44')](handleError(_0x2f4c23,null));};exports[_0x11e6('0x22')]=function(_0x32deaf,_0x380ff4){if(_0x32deaf[_0x11e6('0x4a')]['id']){delete _0x32deaf[_0x11e6('0x4a')]['id'];}return db[_0x11e6('0x2d')]['find']({'where':{'id':_0x32deaf[_0x11e6('0x52')]['id']}})[_0x11e6('0x23')](handleEntityNotFound(_0x380ff4,null))[_0x11e6('0x23')](saveUpdates(_0x32deaf[_0x11e6('0x4a')],null))[_0x11e6('0x23')](respondWithResult(_0x380ff4,null))[_0x11e6('0x44')](handleError(_0x380ff4,null));};exports[_0x11e6('0x27')]=function(_0x56f05a,_0x1ca7a4){return db['Pause'][_0x11e6('0x48')]({'where':{'id':_0x56f05a[_0x11e6('0x52')]['id']}})[_0x11e6('0x23')](handleEntityNotFound(_0x1ca7a4,null))[_0x11e6('0x23')](removeEntity(_0x1ca7a4,null))[_0x11e6('0x44')](handleError(_0x1ca7a4,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 31cef7e..3c192ab 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 _0x7217=['../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x12b683,_0x124186){var _0xfb150b=function(_0x565ce7){while(--_0x565ce7){_0x12b683['push'](_0x12b683['shift']());}};_0xfb150b(++_0x124186);}(_0x7217,0x19e));var _0x7721=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x7217[_0x9df060];return _0x338dfe;};'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 _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x2f3412,_0x2b8d24){_0x2f3412=_0x2f3412-0x0;var _0x4071d6=_0x7fbe[_0x2f3412];return _0x4071d6;};'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 31ed9ea..61469a6 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0xb9fc0c,_0x5e580d){var _0x4674b0=function(_0x4e478e){while(--_0x4e478e){_0xb9fc0c['push'](_0xb9fc0c['shift']());}};_0x4674b0(++_0x5e580d);}(_0xb10b,0x12a));var _0xbb10=function(_0x2a3746,_0x4a8a46){_0x2a3746=_0x2a3746-0x0;var _0x1d7e9a=_0xb10b[_0x2a3746];return _0x1d7e9a;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _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(_0x47756d,_0x4dc7ca){var _0x32fd63=function(_0x3e07d5){while(--_0x3e07d5){_0x47756d['push'](_0x47756d['shift']());}};_0x32fd63(++_0x4dc7ca);}(_0xb10b,0x12a));var _0xbb10=function(_0x10f060,_0x312a7b){_0x10f060=_0x10f060-0x0;var _0x512722=_0xb10b[_0x10f060];return _0x512722;};'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 7d12bd1..fc8470a 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 _0x0c02=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/:id','show','/:id/download','join','root','server/files/plugins','replace','format','%s-%s%s','basename','originalname','extname','now','post','single','file','upload','/webhook','update','delete','exports'];(function(_0x367e57,_0x4edc0f){var _0xdbf67f=function(_0x4f4e3f){while(--_0x4f4e3f){_0x367e57['push'](_0x367e57['shift']());}};_0xdbf67f(++_0x4edc0f);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x20c0('0x0'));var path=require(_0x20c0('0x1'));var timeout=require('connect-timeout');var express=require(_0x20c0('0x2'));var router=express[_0x20c0('0x3')]();var fs_extra=require(_0x20c0('0x4'));var auth=require(_0x20c0('0x5'));var interaction=require(_0x20c0('0x6'));var config=require(_0x20c0('0x7'));var controller=require(_0x20c0('0x8'));router[_0x20c0('0x9')]('/',auth[_0x20c0('0xa')](),controller[_0x20c0('0xb')]);router['get']('/webhook',controller['webhookGet']);router['get'](_0x20c0('0xc'),auth[_0x20c0('0xa')](),controller[_0x20c0('0xd')]);router[_0x20c0('0x9')](_0x20c0('0xe'),auth[_0x20c0('0xa')](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x52eb0d,_0x578592,_0x56770a){_0x56770a(null,path[_0x20c0('0xf')](config[_0x20c0('0x10')],_0x20c0('0x11')));},'filename':function(_0x207b1e,_0x4ed79e,_0x56fa09){_0x4ed79e['originalname']=_0x4ed79e['originalname'][_0x20c0('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x56fa09(null,util[_0x20c0('0x13')](_0x20c0('0x14'),path[_0x20c0('0x15')](_0x4ed79e[_0x20c0('0x16')],path[_0x20c0('0x17')](_0x4ed79e[_0x20c0('0x16')])),Date[_0x20c0('0x18')](),path[_0x20c0('0x17')](_0x4ed79e['originalname'])));}})});router[_0x20c0('0x19')]('/',upload[_0x20c0('0x1a')](_0x20c0('0x1b')),controller[_0x20c0('0x1c')]);router[_0x20c0('0x19')](_0x20c0('0x1d'),controller['webhookPost']);router['put']('/:id',auth[_0x20c0('0xa')](),controller[_0x20c0('0x1e')]);router[_0x20c0('0x1f')](_0x20c0('0xc'),auth['isAuthenticated'](),controller[_0x20c0('0x1f')]);module[_0x20c0('0x20')]=router; \ No newline at end of file +var _0x0faf=['extname','now','post','single','file','webhookPost','put','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','isAuthenticated','index','get','/webhook','webhookGet','/:id','/:id/download','download','diskStorage','join','server/files/plugins','originalname','replace','basename'];(function(_0x195c21,_0x332612){var _0x3576a8=function(_0xa4bde2){while(--_0xa4bde2){_0x195c21['push'](_0x195c21['shift']());}};_0x3576a8(++_0x332612);}(_0x0faf,0x132));var _0xf0fa=function(_0x277107,_0x3420dc){_0x277107=_0x277107-0x0;var _0x1da046=_0x0faf[_0x277107];return _0x1da046;};'use strict';var multer=require(_0xf0fa('0x0'));var util=require('util');var path=require(_0xf0fa('0x1'));var timeout=require(_0xf0fa('0x2'));var express=require(_0xf0fa('0x3'));var router=express[_0xf0fa('0x4')]();var fs_extra=require(_0xf0fa('0x5'));var auth=require(_0xf0fa('0x6'));var interaction=require(_0xf0fa('0x7'));var config=require(_0xf0fa('0x8'));var controller=require(_0xf0fa('0x9'));router['get']('/',auth[_0xf0fa('0xa')](),controller[_0xf0fa('0xb')]);router[_0xf0fa('0xc')](_0xf0fa('0xd'),controller[_0xf0fa('0xe')]);router['get'](_0xf0fa('0xf'),auth[_0xf0fa('0xa')](),controller['show']);router['get'](_0xf0fa('0x10'),auth[_0xf0fa('0xa')](),controller[_0xf0fa('0x11')]);var upload=multer({'storage':multer[_0xf0fa('0x12')]({'destination':function(_0x2bd807,_0x1151ea,_0x379ff6){_0x379ff6(null,path[_0xf0fa('0x13')](config['root'],_0xf0fa('0x14')));},'filename':function(_0x5b38fa,_0x2f46ff,_0x521034){_0x2f46ff[_0xf0fa('0x15')]=_0x2f46ff[_0xf0fa('0x15')][_0xf0fa('0x16')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x521034(null,util['format']('%s-%s%s',path[_0xf0fa('0x17')](_0x2f46ff['originalname'],path[_0xf0fa('0x18')](_0x2f46ff[_0xf0fa('0x15')])),Date[_0xf0fa('0x19')](),path[_0xf0fa('0x18')](_0x2f46ff[_0xf0fa('0x15')])));}})});router[_0xf0fa('0x1a')]('/',upload[_0xf0fa('0x1b')](_0xf0fa('0x1c')),controller['upload']);router[_0xf0fa('0x1a')](_0xf0fa('0xd'),controller[_0xf0fa('0x1d')]);router[_0xf0fa('0x1e')](_0xf0fa('0xf'),auth[_0xf0fa('0xa')](),controller['update']);router['delete'](_0xf0fa('0xf'),auth[_0xf0fa('0xa')](),controller[_0xf0fa('0x1f')]);module[_0xf0fa('0x20')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 6cc4a17..c5e68d6 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 _0x57f8=['always','never','ENUM','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly'];(function(_0x55118f,_0x1abfea){var _0x4f37fa=function(_0xf0cf99){while(--_0xf0cf99){_0x55118f['push'](_0x55118f['shift']());}};_0x4f37fa(++_0x1abfea);}(_0x57f8,0x16a));var _0x857f=function(_0xf6074f,_0x40fe18){_0xf6074f=_0xf6074f-0x0;var _0x4c6c10=_0x57f8[_0xf6074f];return _0x4c6c10;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x857f('0x0')]('html','script')},'description':{'type':Sequelize[_0x857f('0x1')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x857f('0x2')],'comment':_0x857f('0x3')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x857f('0x4')},'sidebar':{'type':Sequelize['ENUM'](_0x857f('0x5'),_0x857f('0x6'),_0x857f('0x7'),_0x857f('0x8')),'defaultValue':_0x857f('0x7'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x857f('0x2')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x857f('0x2')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x857f('0x2')]}}; \ No newline at end of file +var _0xd099=['sequelize','exports','ENUM','html','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'];(function(_0x89ace6,_0x39064b){var _0x302694=function(_0x7dd49){while(--_0x7dd49){_0x89ace6['push'](_0x89ace6['shift']());}};_0x302694(++_0x39064b);}(_0xd099,0xf0));var _0x9d09=function(_0x460fd9,_0x4b4b97){_0x460fd9=_0x460fd9-0x0;var _0x424e18=_0xd099[_0x460fd9];return _0x424e18;};'use strict';var Sequelize=require(_0x9d09('0x0'));module[_0x9d09('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x9d09('0x2')](_0x9d09('0x3'),'script')},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x9d09('0x4')]},'path':{'type':Sequelize[_0x9d09('0x5')],'comment':_0x9d09('0x6')},'active':{'type':Sequelize[_0x9d09('0x7')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x9d09('0x2')](_0x9d09('0x8'),_0x9d09('0x9'),'always','never'),'defaultValue':_0x9d09('0xa'),'comment':_0x9d09('0xb')},'icon':{'type':Sequelize[_0x9d09('0x5')]},'adminUrl':{'type':Sequelize[_0x9d09('0x5')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x9d09('0x5')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 75acb3b..0c818f1 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 _0x5b3d=['reject','save','update','then','destroy','get','Plugins','UserProfileResource','sendStatus','error','stack','name','send','index','map','Plugin','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','find','download','join','root','server/files/plugins','format','%s.zip','createWriteStream','zip','warning','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','dirname','basename','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','catch','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','length','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','Invalid\x20manifest:\x20name\x20missing','undefined','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','Invalid\x20manifest:\x20views\x20missing','views','script','sidebar','always','icon','icon-apps','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','scriptName','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','json','encoding','method','%s%s','headers','content-length','set','endsWith','statusCode','webhookPost','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','extract-zip','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./plugin.socket','register','status','end','offset','limit','count','Content-Range','apply'];(function(_0x23dda5,_0x221860){var _0x32c24e=function(_0x431a9d){while(--_0x431a9d){_0x23dda5['push'](_0x23dda5['shift']());}};_0x32c24e(++_0x221860);}(_0x5b3d,0x129));var _0xd5b3=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0x5b3d[_0x58e469];return _0x4c01c5;};'use strict';var emlformat=require(_0xd5b3('0x0'));var rimraf=require(_0xd5b3('0x1'));var zipdir=require(_0xd5b3('0x2'));var jsonpatch=require(_0xd5b3('0x3'));var rp=require(_0xd5b3('0x4'));var moment=require(_0xd5b3('0x5'));var BPromise=require(_0xd5b3('0x6'));var Mustache=require('mustache');var util=require(_0xd5b3('0x7'));var path=require(_0xd5b3('0x8'));var sox=require(_0xd5b3('0x9'));var csv=require(_0xd5b3('0xa'));var ejs=require(_0xd5b3('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd5b3('0xc'));var squel=require('squel');var crypto=require(_0xd5b3('0xd'));var jsforce=require(_0xd5b3('0xe'));var deskjs=require(_0xd5b3('0xf'));var toCsv=require(_0xd5b3('0xa'));var querystring=require(_0xd5b3('0x10'));var Papa=require('papaparse');var extract=require(_0xd5b3('0x11'));var rimraf=require('rimraf');var archiver=require('archiver');var Redis=require(_0xd5b3('0x12'));var authService=require(_0xd5b3('0x13'));var qs=require(_0xd5b3('0x14'));var as=require(_0xd5b3('0x15'));var hardwareService=require(_0xd5b3('0x16'));var logger=require(_0xd5b3('0x17'))(_0xd5b3('0x18'));var utils=require('../../config/utils');var config=require(_0xd5b3('0x19'));var licenseUtil=require(_0xd5b3('0x1a'));var db=require(_0xd5b3('0x1b'))['db'];config[_0xd5b3('0x1c')]=_['defaults'](config[_0xd5b3('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xd5b3('0x1d'))(new Redis(config[_0xd5b3('0x1c')]));require(_0xd5b3('0x1e'))[_0xd5b3('0x1f')](socket);function respondWithStatusCode(_0x2f5204,_0xc88442){_0xc88442=_0xc88442||0xcc;return function(_0x392f47){if(_0x392f47){return _0x2f5204['sendStatus'](_0xc88442);}return _0x2f5204[_0xd5b3('0x20')](_0xc88442)[_0xd5b3('0x21')]();};}function respondWithResult(_0xc62809,_0xa3e890){_0xa3e890=_0xa3e890||0xc8;return function(_0x2768f5){if(_0x2768f5){return _0xc62809[_0xd5b3('0x20')](_0xa3e890)['json'](_0x2768f5);}};}function respondWithFilteredResult(_0x376fc4,_0x478900){return function(_0x4b26af){if(_0x4b26af){var _0x14b491=typeof _0x478900[_0xd5b3('0x22')]==='undefined'&&typeof _0x478900[_0xd5b3('0x23')]==='undefined';var _0x1874f6=_0x4b26af[_0xd5b3('0x24')];var _0x365b17=_0x14b491?0x0:_0x478900[_0xd5b3('0x22')];var _0x538dde=_0x14b491?_0x4b26af[_0xd5b3('0x24')]:_0x478900[_0xd5b3('0x22')]+_0x478900[_0xd5b3('0x23')];var _0x16da1f;if(_0x538dde>=_0x1874f6){_0x538dde=_0x1874f6;_0x16da1f=0xc8;}else{_0x16da1f=0xce;}_0x376fc4[_0xd5b3('0x20')](_0x16da1f);return _0x376fc4['set'](_0xd5b3('0x25'),_0x365b17+'-'+_0x538dde+'/'+_0x1874f6)['json'](_0x4b26af);}return null;};}function patchUpdates(_0x300b79){return function(_0x31691b){try{jsonpatch[_0xd5b3('0x26')](_0x31691b,_0x300b79,!![]);}catch(_0x422f4d){return BPromise[_0xd5b3('0x27')](_0x422f4d);}return _0x31691b[_0xd5b3('0x28')]();};}function saveUpdates(_0x1ba246,_0x404598){return function(_0x2a6471){if(_0x2a6471){return _0x2a6471[_0xd5b3('0x29')](_0x1ba246)[_0xd5b3('0x2a')](function(_0x6f2437){return _0x6f2437;});}return null;};}function removeEntity(_0x464011,_0x3c5ece){return function(_0x362264){if(_0x362264){return _0x362264[_0xd5b3('0x2b')]()[_0xd5b3('0x2a')](function(){var _0x24f036=_0x362264[_0xd5b3('0x2c')]({'plain':!![]});var _0xfe2956=_0xd5b3('0x2d');return db[_0xd5b3('0x2e')]['destroy']({'where':{'type':_0xfe2956,'resourceId':_0x24f036['id']}})[_0xd5b3('0x2a')](function(){return _0x362264;});})[_0xd5b3('0x2a')](function(){_0x464011[_0xd5b3('0x20')](0xcc)[_0xd5b3('0x21')]();});}};}function handleEntityNotFound(_0x4b002b,_0x5a9d15){return function(_0x4fcc07){if(!_0x4fcc07){_0x4b002b[_0xd5b3('0x2f')](0x194);}return _0x4fcc07;};}function handleError(_0x55392b,_0x521645){_0x521645=_0x521645||0x1f4;return function(_0x24a2da){logger[_0xd5b3('0x30')](_0x24a2da[_0xd5b3('0x31')]);if(_0x24a2da[_0xd5b3('0x32')]){delete _0x24a2da[_0xd5b3('0x32')];}_0x55392b['status'](_0x521645)[_0xd5b3('0x33')](_0x24a2da);};}exports[_0xd5b3('0x34')]=function(_0x21c693,_0x359877){var _0x1691ef={},_0xd1d737={},_0x3a4906={'count':0x0,'rows':[]};var _0x51f8b8=_[_0xd5b3('0x35')](db[_0xd5b3('0x36')]['rawAttributes'],function(_0x79324e){return{'name':_0x79324e['fieldName'],'type':_0x79324e[_0xd5b3('0x37')][_0xd5b3('0x38')]};});_0xd1d737[_0xd5b3('0x39')]=_['map'](_0x51f8b8,_0xd5b3('0x32'));_0xd1d737[_0xd5b3('0x3a')]=_[_0xd5b3('0x3b')](_0x21c693[_0xd5b3('0x3a')]);_0xd1d737[_0xd5b3('0x3c')]=_[_0xd5b3('0x3d')](_0xd1d737['model'],_0xd1d737[_0xd5b3('0x3a')]);_0x1691ef[_0xd5b3('0x3e')]=_[_0xd5b3('0x3d')](_0xd1d737[_0xd5b3('0x39')],qs[_0xd5b3('0x3f')](_0x21c693[_0xd5b3('0x3a')]['fields']));_0x1691ef[_0xd5b3('0x3e')]=_0x1691ef[_0xd5b3('0x3e')]['length']?_0x1691ef['attributes']:_0xd1d737[_0xd5b3('0x39')];if(!_0x21c693[_0xd5b3('0x3a')][_0xd5b3('0x40')](_0xd5b3('0x41'))){_0x1691ef[_0xd5b3('0x23')]=qs['limit'](_0x21c693[_0xd5b3('0x3a')][_0xd5b3('0x23')]);_0x1691ef[_0xd5b3('0x22')]=qs[_0xd5b3('0x22')](_0x21c693['query'][_0xd5b3('0x22')]);}_0x1691ef[_0xd5b3('0x42')]=qs['sort'](_0x21c693[_0xd5b3('0x3a')][_0xd5b3('0x43')]);_0x1691ef[_0xd5b3('0x44')]=qs[_0xd5b3('0x3c')](_[_0xd5b3('0x45')](_0x21c693[_0xd5b3('0x3a')],_0xd1d737[_0xd5b3('0x3c')]),_0x51f8b8);if(_0x21c693[_0xd5b3('0x3a')][_0xd5b3('0x46')]){_0x1691ef[_0xd5b3('0x44')]=_[_0xd5b3('0x47')](_0x1691ef[_0xd5b3('0x44')],{'$or':_[_0xd5b3('0x35')](_0x51f8b8,function(_0x18abf3){if(_0x18abf3[_0xd5b3('0x37')]!=='VIRTUAL'){var _0x2a465d={};_0x2a465d[_0x18abf3[_0xd5b3('0x32')]]={'$like':'%'+_0x21c693[_0xd5b3('0x3a')][_0xd5b3('0x46')]+'%'};return _0x2a465d;}})});}_0x1691ef=_[_0xd5b3('0x47')]({},_0x1691ef,_0x21c693[_0xd5b3('0x48')]);var _0x16258d={'where':_0x1691ef[_0xd5b3('0x44')]};return db['Plugin'][_0xd5b3('0x24')](_0x16258d)[_0xd5b3('0x2a')](function(_0x11dd0b){_0x3a4906['count']=_0x11dd0b;if(_0x21c693[_0xd5b3('0x3a')][_0xd5b3('0x49')]){_0x1691ef[_0xd5b3('0x4a')]=[{'all':!![]}];}return db[_0xd5b3('0x36')][_0xd5b3('0x4b')](_0x1691ef);})[_0xd5b3('0x2a')](function(_0x1fa406){_0x3a4906[_0xd5b3('0x4c')]=_0x1fa406;return _0x3a4906;})['then'](respondWithFilteredResult(_0x359877,_0x1691ef))['catch'](handleError(_0x359877,null));};exports[_0xd5b3('0x4d')]=function(_0x1db824,_0x28b2d6){var _0x459f3b={'raw':!![],'where':{'id':_0x1db824[_0xd5b3('0x4e')]['id']}},_0x3a3b32={};_0x3a3b32[_0xd5b3('0x39')]=_[_0xd5b3('0x3b')](db['Plugin']['rawAttributes']);_0x3a3b32[_0xd5b3('0x3a')]=_[_0xd5b3('0x3b')](_0x1db824['query']);_0x3a3b32[_0xd5b3('0x3c')]=_['intersection'](_0x3a3b32[_0xd5b3('0x39')],_0x3a3b32['query']);_0x459f3b[_0xd5b3('0x3e')]=_[_0xd5b3('0x3d')](_0x3a3b32[_0xd5b3('0x39')],qs['fields'](_0x1db824[_0xd5b3('0x3a')]['fields']));_0x459f3b[_0xd5b3('0x3e')]=_0x459f3b[_0xd5b3('0x3e')]['length']?_0x459f3b[_0xd5b3('0x3e')]:_0x3a3b32['model'];if(_0x1db824[_0xd5b3('0x3a')][_0xd5b3('0x49')]){_0x459f3b[_0xd5b3('0x4a')]=[{'all':!![]}];}_0x459f3b=_[_0xd5b3('0x47')]({},_0x459f3b,_0x1db824[_0xd5b3('0x48')]);return db['Plugin'][_0xd5b3('0x4f')](_0x459f3b)['then'](handleEntityNotFound(_0x28b2d6,null))[_0xd5b3('0x2a')](respondWithResult(_0x28b2d6,null))['catch'](handleError(_0x28b2d6,null));};exports[_0xd5b3('0x50')]=function(_0x40f667,_0x1ce72e,_0x5b6d22){return db[_0xd5b3('0x36')][_0xd5b3('0x4f')]({'where':{'id':_0x40f667[_0xd5b3('0x4e')]['id']},'attributes':[_0xd5b3('0x32'),_0xd5b3('0x8')],'raw':!![]})[_0xd5b3('0x2a')](handleEntityNotFound(_0x1ce72e,null))['then'](function(_0xff5fae){if(_0xff5fae){var _0x7259df=path[_0xd5b3('0x51')](config[_0xd5b3('0x52')],_0xd5b3('0x53'),util[_0xd5b3('0x54')](_0xd5b3('0x55'),path['basename'](_0xff5fae[_0xd5b3('0x8')])));var _0x4e1992=fs[_0xd5b3('0x56')](_0x7259df);var _0x3e0dd0=archiver(_0xd5b3('0x57'),{'zlib':{'level':0x9}});_0x3e0dd0['on'](_0xd5b3('0x58'),function(_0x1e2474){if(_0x1e2474['code']===_0xd5b3('0x59')){logger['error'](_0x1e2474);}else{throw new db[(_0xd5b3('0x5a'))][(_0xd5b3('0x5b'))](_0xd5b3('0x5c'));}});_0x3e0dd0['on'](_0xd5b3('0x30'),function(_0x53ebee){throw new db[(_0xd5b3('0x5a'))][(_0xd5b3('0x5b'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x3e0dd0['pipe'](_0x4e1992);_0x3e0dd0[_0xd5b3('0x5d')]('**/*',{'cwd':path['join'](config[_0xd5b3('0x52')],_0xd5b3('0x53'),path[_0xd5b3('0x5e')](_0xff5fae['path'])),'ignore':[path[_0xd5b3('0x51')](path['basename'](_0xff5fae[_0xd5b3('0x8')]),'node_modules/**/*'),path[_0xd5b3('0x51')](path[_0xd5b3('0x5f')](_0xff5fae[_0xd5b3('0x8')]),_0xd5b3('0x60'))],'nodir':!![]})[_0xd5b3('0x61')]();_0x4e1992['on'](_0xd5b3('0x62'),function(){if(!fs[_0xd5b3('0x63')](_0x7259df)){throw new db[(_0xd5b3('0x5a'))][(_0xd5b3('0x5b'))](_0xd5b3('0x64'));}return _0x1ce72e[_0xd5b3('0x50')](_0x7259df,util[_0xd5b3('0x54')](_0xd5b3('0x55'),path[_0xd5b3('0x5f')](_0xff5fae['path'])),function(_0x25985d){if(_0x25985d){throw new db[(_0xd5b3('0x5a'))]['Error'](_0xd5b3('0x65'));}fs[_0xd5b3('0x66')](_0x7259df);logger[_0xd5b3('0x67')](_0xd5b3('0x68'));logger[_0xd5b3('0x67')]('Temporary\x20file\x20removed');});});}return null;})[_0xd5b3('0x69')](handleError(_0x1ce72e,null));};exports[_0xd5b3('0x6a')]=function(_0x3d7e76,_0x3b2a39,_0x257714){var _0x3e3235=path[_0xd5b3('0x5f')](_0x3d7e76[_0xd5b3('0x6b')][_0xd5b3('0x6c')],path['extname'](_0x3d7e76['file'][_0xd5b3('0x6c')]));var _0x279673=path[_0xd5b3('0x51')](config[_0xd5b3('0x52')],'server/files/plugins',_0x3d7e76[_0xd5b3('0x6b')][_0xd5b3('0x6c')]);var _0x39b293=path['join'](config[_0xd5b3('0x52')],_0xd5b3('0x53'),_0x3e3235);logger[_0xd5b3('0x67')](_0xd5b3('0x6d'),_0x279673);logger[_0xd5b3('0x67')](_0xd5b3('0x6e'),_0x39b293);try{fs[_0xd5b3('0x6f')](_0x279673,parseInt('0777',0x8));extract(_0x279673,{'dir':_0x39b293},function(_0x4efaf8){if(_0x4efaf8){logger[_0xd5b3('0x30')](_0x4efaf8);handleError(_0x4efaf8,!![]);};var _0x3d82bf=fs[_0xd5b3('0x70')](_0x39b293);if(_0x3d82bf[_0xd5b3('0x71')]>0x1){removeReferences(_0x279673,_0x39b293);logger[_0xd5b3('0x30')](_0xd5b3('0x72'));return _0x257714(new Error(_0xd5b3('0x72')));}var _0x308a06=fs[_0xd5b3('0x73')](path[_0xd5b3('0x51')](_0x39b293,_0x3d82bf[0x0]));if(_0x308a06[_0xd5b3('0x74')]()){removeReferences(_0x279673,_0x39b293);logger[_0xd5b3('0x30')](_0xd5b3('0x72'));return _0x257714(new Error('Invalid\x20plugin\x20structure'));}if(_0x308a06[_0xd5b3('0x75')]()){var _0x2df0eb=fs[_0xd5b3('0x70')](path[_0xd5b3('0x51')](_0x39b293,_0x3d82bf[0x0]));if(_0x2df0eb[_0xd5b3('0x71')]===0x0){removeReferences(_0x279673,_0x39b293);logger[_0xd5b3('0x30')](_0xd5b3('0x72'));return _0x257714(new Error('Invalid\x20plugin\x20structure'));}var _0x23f5d1=_0x2df0eb[_0xd5b3('0x76')](function(_0x1cd413){return _0x1cd413===_0xd5b3('0x77');});if(!_0x23f5d1){return _0x257714(new Error(_0xd5b3('0x78')));}var _0x3d98bd=fs['readFileSync'](path[_0xd5b3('0x51')](_0x39b293,_0x3d82bf[0x0],'manifest.json'));var _0x307ee2=JSON['parse'](_0x3d98bd);if('undefined'==typeof _0x307ee2[_0xd5b3('0x32')]){return _0x257714(new Error(_0xd5b3('0x79')));}if(_0xd5b3('0x7a')==typeof _0x307ee2[_0xd5b3('0x37')]){return _0x257714(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0xd5b3('0x7a')==typeof _0x307ee2[_0xd5b3('0x7b')]){return _0x257714(new Error(_0xd5b3('0x7c')));}if(_0xd5b3('0x7a')==typeof _0x307ee2['parameters']){return _0x257714(new Error(_0xd5b3('0x7d')));}if(_0x307ee2[_0xd5b3('0x37')]===_0xd5b3('0x7e')){if(_0xd5b3('0x7a')==typeof _0x307ee2[_0xd5b3('0x7f')]['views']){return _0x257714(new Error(_0xd5b3('0x80')));}if(_0xd5b3('0x7a')==typeof _0x307ee2[_0xd5b3('0x7f')][_0xd5b3('0x81')]['admin']&&_0xd5b3('0x7a')==typeof _0x307ee2['parameters'][_0xd5b3('0x81')]['agent']){return _0x257714(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x307ee2[_0xd5b3('0x37')]===_0xd5b3('0x82')){if(_0xd5b3('0x7a')==typeof _0x307ee2['parameters']['scriptName']){return _0x257714(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0xd5b3('0x7a')==typeof _0x307ee2[_0xd5b3('0x7f')]['scriptPath']){return _0x257714(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x257714(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x578f12=_0x307ee2[_0xd5b3('0x32')];var _0x7a52a2=_0x307ee2['description'];var _0x136b20=_0x307ee2[_0xd5b3('0x37')];var _0x57681f=_0x307ee2[_0xd5b3('0x83')]?_0x307ee2[_0xd5b3('0x83')]:_0xd5b3('0x84');var _0x39dcf6=_0x307ee2[_0xd5b3('0x85')]?_0x307ee2[_0xd5b3('0x85')]:_0xd5b3('0x86');var _0x51e42d='';var _0x1465fc='';var _0x2daf56='';var _0x554303='';var _0x1776c0=_0x307ee2[_0xd5b3('0x7b')];if(_0x136b20===_0xd5b3('0x7e')){if(_0xd5b3('0x7a')!=typeof _0x307ee2[_0xd5b3('0x7f')][_0xd5b3('0x81')][_0xd5b3('0x87')]){var _0x50b895=_0x307ee2[_0xd5b3('0x7f')][_0xd5b3('0x81')][_0xd5b3('0x87')];if(!/^(f|ht)tps?:\/\//i[_0xd5b3('0x88')](_0x50b895)){_0x51e42d=path[_0xd5b3('0x51')](_0xd5b3('0x89'),_0x3e3235,_0x3d82bf[0x0],_0x50b895);}else{_0x51e42d=_0x50b895;}}else{logger[_0xd5b3('0x67')](_0xd5b3('0x8a'));}if(_0xd5b3('0x7a')!=typeof _0x307ee2[_0xd5b3('0x7f')][_0xd5b3('0x81')]['agent']){var _0x4b4273=_0x307ee2[_0xd5b3('0x7f')][_0xd5b3('0x81')][_0xd5b3('0x8b')];if(!/^(f|ht)tps?:\/\//i[_0xd5b3('0x88')](_0x4b4273)){_0x1465fc=path['join'](_0xd5b3('0x89'),_0x3e3235,_0x3d82bf[0x0],_0x4b4273);}else{_0x1465fc=_0x4b4273;}}else{logger[_0xd5b3('0x67')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x136b20==='script'){_0x2daf56=_0x307ee2['parameters'][_0xd5b3('0x8c')];_0x554303=_0x307ee2[_0xd5b3('0x7f')]['scriptPath'];if('undefined'!=typeof _0x307ee2['parameters'][_0xd5b3('0x81')]){if('undefined'!=typeof _0x307ee2[_0xd5b3('0x7f')]['views'][_0xd5b3('0x87')]){var _0x50b895=_0x307ee2[_0xd5b3('0x7f')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0xd5b3('0x88')](_0x50b895)){_0x51e42d=path[_0xd5b3('0x51')](_0xd5b3('0x89'),_0x3e3235,_0x3d82bf[0x0],_0x50b895);}else{_0x51e42d=_0x50b895;}}if(_0xd5b3('0x7a')!=typeof _0x307ee2[_0xd5b3('0x7f')][_0xd5b3('0x81')]['agent']){var _0x4b4273=_0x307ee2['parameters'][_0xd5b3('0x81')][_0xd5b3('0x8b')];if(!/^(f|ht)tps?:\/\//i[_0xd5b3('0x88')](_0x4b4273)){_0x1465fc=path['join'](_0xd5b3('0x89'),_0x3e3235,_0x3d82bf[0x0],_0x4b4273);}else{_0x1465fc=_0x4b4273;}}}}var _0x39e85d={'name':_0x578f12,'description':_0x7a52a2,'path':path[_0xd5b3('0x51')](_0x3e3235,_0x3d82bf[0x0]),'type':_0x136b20,'sidebar':_0x57681f,'icon':_0x39dcf6,'adminUrl':_0x51e42d,'agentUrl':_0x1465fc,'scriptName':_0x2daf56,'scriptPath':_0x554303,'version':_0x1776c0};removeReferences(_0x279673,null);return db[_0xd5b3('0x36')][_0xd5b3('0x8d')](_0x39e85d)[_0xd5b3('0x2a')](function(_0x1daf11){var _0x1809d4={'role':_0x3d7e76[_0xd5b3('0x8e')][_0xd5b3('0x8f')],'userProfileId':_0x3d7e76[_0xd5b3('0x8e')]['userProfileId']};if(!_0x1809d4)throw new Error(_0xd5b3('0x90'));if(_0x1809d4[_0xd5b3('0x8f')]===_0xd5b3('0x91')){var _0x44d4a5=_0x1daf11[_0xd5b3('0x2c')]({'plain':!![]});return db[_0xd5b3('0x92')][_0xd5b3('0x4f')]({'where':{'name':_0xd5b3('0x2d'),'userProfileId':_0x1809d4[_0xd5b3('0x93')]},'raw':!![]})[_0xd5b3('0x2a')](function(_0x1cc34d){if(_0x1cc34d&&_0x1cc34d[_0xd5b3('0x94')]===0x0){return db['UserProfileResource'][_0xd5b3('0x8d')]({'name':_0x44d4a5['name'],'resourceId':_0x44d4a5['id'],'type':_0x1cc34d[_0xd5b3('0x32')],'sectionId':_0x1cc34d['id']},{})[_0xd5b3('0x2a')](function(){return _0x1daf11;});}else{return _0x1daf11;}})[_0xd5b3('0x69')](function(_0x17c276){logger[_0xd5b3('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17c276);throw _0x17c276;});}return _0x1daf11;})[_0xd5b3('0x2a')](respondWithResult(_0x3b2a39,null))[_0xd5b3('0x69')](handleError(_0x3b2a39,null));}});}catch(_0x189851){_0x3b2a39[_0xd5b3('0x20')](0x1f4)[_0xd5b3('0x33')](_0x189851);}};function removeReferences(_0x297459,_0x506f6b){try{if(_0x297459){fs[_0xd5b3('0x66')](_0x297459);logger[_0xd5b3('0x67')]('Zip\x20archive\x20removed');}if(_0x506f6b){rimraf(_0x506f6b,function(){});logger['info'](_0xd5b3('0x95'));}}catch(_0x2767f8){logger[_0xd5b3('0x30')](_0x2767f8);}}exports[_0xd5b3('0x29')]=function(_0x29ffa,_0x5d9bd6,_0xd80ff8){return db['Plugin'][_0xd5b3('0x4f')]({'where':{'id':_0x29ffa['params']['id']}})[_0xd5b3('0x2a')](handleEntityNotFound(_0x5d9bd6,null))[_0xd5b3('0x2a')](saveUpdates(_0x29ffa[_0xd5b3('0x8e')],null))[_0xd5b3('0x2a')](respondWithResult(_0x5d9bd6,null))[_0xd5b3('0x69')](handleError(_0x5d9bd6,null));};exports[_0xd5b3('0x96')]=function(_0x12cf23,_0x29d78d,_0x4be04e){return db[_0xd5b3('0x36')][_0xd5b3('0x4f')]({'where':{'id':_0x12cf23['params']['id']}})[_0xd5b3('0x2a')](function(_0x412cfd){if(_0x412cfd){return _0x412cfd[_0xd5b3('0x2b')]();}})[_0xd5b3('0x2a')](function(_0x336c45){rimraf(path[_0xd5b3('0x51')](config[_0xd5b3('0x52')],'server/files/plugins',path[_0xd5b3('0x5e')](_0x336c45[_0xd5b3('0x8')])),function(){});return _0x336c45;})['then'](handleEntityNotFound(_0x29d78d,null))[_0xd5b3('0x2a')](respondWithStatusCode(_0x29d78d,null))[_0xd5b3('0x69')](handleError(_0x29d78d,null));};exports[_0xd5b3('0x97')]=function(_0x2d23ba,_0x3b1de3,_0x13223b){return BPromise[_0xd5b3('0x98')]()[_0xd5b3('0x2a')](function(){if(!_0x2d23ba[_0xd5b3('0x3a')]['path']){throw new Error(_0xd5b3('0x99'));}if(!_0x2d23ba[_0xd5b3('0x3a')][_0xd5b3('0x9a')]){throw new Error(_0xd5b3('0x9b'));}var _0x59f092=_0x2d23ba[_0xd5b3('0x3a')]['hostname']?_0x2d23ba[_0xd5b3('0x3a')][_0xd5b3('0x9c')]+':'+_0x2d23ba['query'][_0xd5b3('0x9a')]:_0xd5b3('0x9d')+_0x2d23ba[_0xd5b3('0x3a')][_0xd5b3('0x9a')];var _0x39bbd8=_0x2d23ba[_0xd5b3('0x3a')][_0xd5b3('0x9e')]?_0x2d23ba[_0xd5b3('0x3a')][_0xd5b3('0x9e')]:!![];var _0x72c96f=_0x2d23ba['query'][_0xd5b3('0x9f')]?_0x2d23ba['query'][_0xd5b3('0x9f')]:null;var _0x256657={'method':_0x2d23ba[_0xd5b3('0xa0')],'uri':util[_0xd5b3('0x54')](_0xd5b3('0xa1'),_0x59f092,_0x2d23ba['query'][_0xd5b3('0x8')]),'json':_0x39bbd8,'resolveWithFullResponse':!![],'encoding':_0x72c96f,'qs':_0x2d23ba['query']};if(_0x2d23ba[_0xd5b3('0xa2')]){_0x256657[_0xd5b3('0xa2')]=_0x2d23ba['headers'];if(_0x256657[_0xd5b3('0xa2')][_0xd5b3('0xa3')]){delete _0x256657[_0xd5b3('0xa2')][_0xd5b3('0xa3')];}}if(_0x256657['headers']['content-type']){delete _0x256657[_0xd5b3('0xa2')]['content-type'];}return rp(_0x256657);})[_0xd5b3('0x2a')](function(_0x436af0){if(_0x436af0){_0x3b1de3[_0xd5b3('0xa4')](_0x436af0[_0xd5b3('0xa2')]);logger['info'](_0x436af0[_0xd5b3('0x8e')]);if(_[_0xd5b3('0xa5')](_0x2d23ba[_0xd5b3('0x3a')][_0xd5b3('0x8')],_0xd5b3('0x50'))&&_0x436af0[_0xd5b3('0xa6')]==0x1f4){return _0x3b1de3[_0xd5b3('0x2f')](_0x436af0[_0xd5b3('0xa6')]);}else{return _0x3b1de3[_0xd5b3('0x20')](_0x436af0[_0xd5b3('0xa6')])[_0xd5b3('0x33')](_0x436af0[_0xd5b3('0x8e')]);}}else{return _0x3b1de3[_0xd5b3('0x2f')](0xc8);}})['catch'](handleError(_0x3b1de3,null));};exports[_0xd5b3('0xa7')]=function(_0x3eb2e2,_0x49345d,_0x531420){return BPromise[_0xd5b3('0x98')]()[_0xd5b3('0x2a')](function(){if(!_0x3eb2e2[_0xd5b3('0x3a')][_0xd5b3('0x8')]){throw new Error(_0xd5b3('0x99'));}if(!_0x3eb2e2[_0xd5b3('0x3a')][_0xd5b3('0x9a')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0xcf9c75=_0x3eb2e2[_0xd5b3('0x3a')][_0xd5b3('0x9c')]?_0x3eb2e2[_0xd5b3('0x3a')][_0xd5b3('0x9c')]+':'+_0x3eb2e2[_0xd5b3('0x3a')]['port']:_0xd5b3('0x9d')+_0x3eb2e2[_0xd5b3('0x3a')][_0xd5b3('0x9a')];var _0x3b6fcb=_0x3eb2e2[_0xd5b3('0x3a')][_0xd5b3('0x9e')]?_0x3eb2e2[_0xd5b3('0x3a')][_0xd5b3('0x9e')]:!![];var _0x2cb3c9=_0x3eb2e2['query'][_0xd5b3('0x9f')]?_0x3eb2e2[_0xd5b3('0x3a')]['encoding']:null;var _0x50d802={'method':_0x3eb2e2[_0xd5b3('0xa0')],'uri':util[_0xd5b3('0x54')](_0xd5b3('0xa1'),_0xcf9c75,_0x3eb2e2['query']['path']),'json':_0x3b6fcb,'resolveWithFullResponse':!![],'encoding':_0x2cb3c9,'body':_0x3eb2e2[_0xd5b3('0x8e')]};if(_0x3eb2e2['headers']){_0x50d802[_0xd5b3('0xa2')]=_0x3eb2e2['headers'];if(_0x50d802['headers'][_0xd5b3('0xa3')]){delete _0x50d802[_0xd5b3('0xa2')][_0xd5b3('0xa3')];}}if(_0x50d802[_0xd5b3('0xa2')]['content-type']){delete _0x50d802[_0xd5b3('0xa2')]['content-type'];}return rp(_0x50d802);})['then'](function(_0x597484){if(_0x597484){_0x49345d[_0xd5b3('0xa4')](_0x597484[_0xd5b3('0xa2')]);logger[_0xd5b3('0x67')](_0x597484[_0xd5b3('0x8e')]);return _0x49345d[_0xd5b3('0x20')](_0x597484[_0xd5b3('0xa6')])[_0xd5b3('0x33')](_0x597484['body']);}else{return _0x49345d[_0xd5b3('0x2f')](0xc8);}})[_0xd5b3('0x69')](handleError(_0x49345d,null));}; \ No newline at end of file +var _0xa29f=['test','plugins','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','dirname','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','set','endsWith','statusCode','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','jsforce','desk.js','querystring','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','register','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','Plugins','UserProfileResource','sendStatus','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','params','options','find','join','server/files/plugins','format','%s.zip','basename','createWriteStream','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','node_modules/**/*','attachments/**/*','finalize','existsSync','Plugin\x20not\x20found','download','Download\x20completed','Temporary\x20file\x20removed','upload','filename','file','root','Plugin\x20upload\x20filepath:\x20%s','info','Plugin\x20upload\x20destination:\x20%s','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','readdirSync','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','type','Invalid\x20manifest:\x20type\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','Invalid\x20manifest:\x20views\x20missing','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','always'];(function(_0x1b8c68,_0x12a950){var _0x3b0788=function(_0x57f7ca){while(--_0x57f7ca){_0x1b8c68['push'](_0x1b8c68['shift']());}};_0x3b0788(++_0x12a950);}(_0xa29f,0xc4));var _0xfa29=function(_0x475be2,_0xf0639){_0x475be2=_0x475be2-0x0;var _0x4ff8b1=_0xa29f[_0x475be2];return _0x4ff8b1;};'use strict';var emlformat=require(_0xfa29('0x0'));var rimraf=require(_0xfa29('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfa29('0x2'));var moment=require(_0xfa29('0x3'));var BPromise=require(_0xfa29('0x4'));var Mustache=require(_0xfa29('0x5'));var util=require(_0xfa29('0x6'));var path=require(_0xfa29('0x7'));var sox=require('sox');var csv=require(_0xfa29('0x8'));var ejs=require(_0xfa29('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfa29('0xa'));var crypto=require('crypto');var jsforce=require(_0xfa29('0xb'));var deskjs=require(_0xfa29('0xc'));var toCsv=require(_0xfa29('0x8'));var querystring=require(_0xfa29('0xd'));var Papa=require('papaparse');var extract=require(_0xfa29('0xe'));var rimraf=require(_0xfa29('0x1'));var archiver=require(_0xfa29('0xf'));var Redis=require(_0xfa29('0x10'));var authService=require(_0xfa29('0x11'));var qs=require(_0xfa29('0x12'));var as=require(_0xfa29('0x13'));var hardwareService=require(_0xfa29('0x14'));var logger=require('../../config/logger')(_0xfa29('0x15'));var utils=require(_0xfa29('0x16'));var config=require(_0xfa29('0x17'));var licenseUtil=require(_0xfa29('0x18'));var db=require(_0xfa29('0x19'))['db'];config['redis']=_[_0xfa29('0x1a')](config[_0xfa29('0x1b')],{'host':_0xfa29('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfa29('0x1b')]));require('./plugin.socket')[_0xfa29('0x1d')](socket);function respondWithStatusCode(_0x3a0451,_0x230ae6){_0x230ae6=_0x230ae6||0xcc;return function(_0x59d109){if(_0x59d109){return _0x3a0451['sendStatus'](_0x230ae6);}return _0x3a0451[_0xfa29('0x1e')](_0x230ae6)[_0xfa29('0x1f')]();};}function respondWithResult(_0x34d066,_0x4c8355){_0x4c8355=_0x4c8355||0xc8;return function(_0x3da3a6){if(_0x3da3a6){return _0x34d066['status'](_0x4c8355)[_0xfa29('0x20')](_0x3da3a6);}};}function respondWithFilteredResult(_0x601459,_0x453549){return function(_0x47eb9c){if(_0x47eb9c){var _0x41c275=typeof _0x453549[_0xfa29('0x21')]===_0xfa29('0x22')&&typeof _0x453549[_0xfa29('0x23')]===_0xfa29('0x22');var _0x1a5311=_0x47eb9c['count'];var _0x51e0eb=_0x41c275?0x0:_0x453549['offset'];var _0x4e4cd1=_0x41c275?_0x47eb9c[_0xfa29('0x24')]:_0x453549[_0xfa29('0x21')]+_0x453549[_0xfa29('0x23')];var _0x166918;if(_0x4e4cd1>=_0x1a5311){_0x4e4cd1=_0x1a5311;_0x166918=0xc8;}else{_0x166918=0xce;}_0x601459['status'](_0x166918);return _0x601459['set'](_0xfa29('0x25'),_0x51e0eb+'-'+_0x4e4cd1+'/'+_0x1a5311)[_0xfa29('0x20')](_0x47eb9c);}return null;};}function patchUpdates(_0x28a5f0){return function(_0x541b2d){try{jsonpatch[_0xfa29('0x26')](_0x541b2d,_0x28a5f0,!![]);}catch(_0x39e7a6){return BPromise[_0xfa29('0x27')](_0x39e7a6);}return _0x541b2d[_0xfa29('0x28')]();};}function saveUpdates(_0x4bada7,_0x228e46){return function(_0x122c9c){if(_0x122c9c){return _0x122c9c[_0xfa29('0x29')](_0x4bada7)[_0xfa29('0x2a')](function(_0x413517){return _0x413517;});}return null;};}function removeEntity(_0x30e4ec,_0x202b68){return function(_0x238165){if(_0x238165){return _0x238165[_0xfa29('0x2b')]()[_0xfa29('0x2a')](function(){var _0x51a292=_0x238165[_0xfa29('0x2c')]({'plain':!![]});var _0x5e8175=_0xfa29('0x2d');return db[_0xfa29('0x2e')][_0xfa29('0x2b')]({'where':{'type':_0x5e8175,'resourceId':_0x51a292['id']}})[_0xfa29('0x2a')](function(){return _0x238165;});})[_0xfa29('0x2a')](function(){_0x30e4ec['status'](0xcc)[_0xfa29('0x1f')]();});}};}function handleEntityNotFound(_0x12f9be,_0xafdbb2){return function(_0x5c0273){if(!_0x5c0273){_0x12f9be[_0xfa29('0x2f')](0x194);}return _0x5c0273;};}function handleError(_0x43b935,_0x360eca){_0x360eca=_0x360eca||0x1f4;return function(_0x18806b){logger[_0xfa29('0x30')](_0x18806b[_0xfa29('0x31')]);if(_0x18806b['name']){delete _0x18806b[_0xfa29('0x32')];}_0x43b935[_0xfa29('0x1e')](_0x360eca)[_0xfa29('0x33')](_0x18806b);};}exports[_0xfa29('0x34')]=function(_0x549b18,_0x3d97be){var _0x5ce1fd={},_0x5edee7={},_0x1f82b3={'count':0x0,'rows':[]};var _0x524001=_[_0xfa29('0x35')](db[_0xfa29('0x36')][_0xfa29('0x37')],function(_0x20a227){return{'name':_0x20a227[_0xfa29('0x38')],'type':_0x20a227['type']['key']};});_0x5edee7[_0xfa29('0x39')]=_[_0xfa29('0x35')](_0x524001,'name');_0x5edee7[_0xfa29('0x3a')]=_[_0xfa29('0x3b')](_0x549b18[_0xfa29('0x3a')]);_0x5edee7[_0xfa29('0x3c')]=_[_0xfa29('0x3d')](_0x5edee7[_0xfa29('0x39')],_0x5edee7['query']);_0x5ce1fd[_0xfa29('0x3e')]=_[_0xfa29('0x3d')](_0x5edee7[_0xfa29('0x39')],qs[_0xfa29('0x3f')](_0x549b18[_0xfa29('0x3a')][_0xfa29('0x3f')]));_0x5ce1fd[_0xfa29('0x3e')]=_0x5ce1fd['attributes'][_0xfa29('0x40')]?_0x5ce1fd[_0xfa29('0x3e')]:_0x5edee7['model'];if(!_0x549b18[_0xfa29('0x3a')][_0xfa29('0x41')](_0xfa29('0x42'))){_0x5ce1fd[_0xfa29('0x23')]=qs[_0xfa29('0x23')](_0x549b18[_0xfa29('0x3a')][_0xfa29('0x23')]);_0x5ce1fd[_0xfa29('0x21')]=qs[_0xfa29('0x21')](_0x549b18[_0xfa29('0x3a')][_0xfa29('0x21')]);}_0x5ce1fd['order']=qs[_0xfa29('0x43')](_0x549b18['query'][_0xfa29('0x43')]);_0x5ce1fd[_0xfa29('0x44')]=qs[_0xfa29('0x3c')](_[_0xfa29('0x45')](_0x549b18[_0xfa29('0x3a')],_0x5edee7[_0xfa29('0x3c')]),_0x524001);if(_0x549b18[_0xfa29('0x3a')][_0xfa29('0x46')]){_0x5ce1fd[_0xfa29('0x44')]=_[_0xfa29('0x47')](_0x5ce1fd[_0xfa29('0x44')],{'$or':_[_0xfa29('0x35')](_0x524001,function(_0x43ed9a){if(_0x43ed9a['type']!=='VIRTUAL'){var _0x3dbff5={};_0x3dbff5[_0x43ed9a[_0xfa29('0x32')]]={'$like':'%'+_0x549b18['query'][_0xfa29('0x46')]+'%'};return _0x3dbff5;}})});}_0x5ce1fd=_['merge']({},_0x5ce1fd,_0x549b18['options']);var _0x3c03ea={'where':_0x5ce1fd['where']};return db[_0xfa29('0x36')]['count'](_0x3c03ea)[_0xfa29('0x2a')](function(_0x70d3b8){_0x1f82b3[_0xfa29('0x24')]=_0x70d3b8;if(_0x549b18[_0xfa29('0x3a')][_0xfa29('0x48')]){_0x5ce1fd[_0xfa29('0x49')]=[{'all':!![]}];}return db['Plugin']['findAll'](_0x5ce1fd);})[_0xfa29('0x2a')](function(_0x58332a){_0x1f82b3[_0xfa29('0x4a')]=_0x58332a;return _0x1f82b3;})['then'](respondWithFilteredResult(_0x3d97be,_0x5ce1fd))[_0xfa29('0x4b')](handleError(_0x3d97be,null));};exports[_0xfa29('0x4c')]=function(_0x4db4c4,_0x45b1e6){var _0x3b580e={'raw':!![],'where':{'id':_0x4db4c4[_0xfa29('0x4d')]['id']}},_0x3b15fd={};_0x3b15fd['model']=_[_0xfa29('0x3b')](db[_0xfa29('0x36')][_0xfa29('0x37')]);_0x3b15fd['query']=_[_0xfa29('0x3b')](_0x4db4c4['query']);_0x3b15fd[_0xfa29('0x3c')]=_['intersection'](_0x3b15fd[_0xfa29('0x39')],_0x3b15fd['query']);_0x3b580e[_0xfa29('0x3e')]=_[_0xfa29('0x3d')](_0x3b15fd[_0xfa29('0x39')],qs[_0xfa29('0x3f')](_0x4db4c4[_0xfa29('0x3a')][_0xfa29('0x3f')]));_0x3b580e['attributes']=_0x3b580e[_0xfa29('0x3e')]['length']?_0x3b580e[_0xfa29('0x3e')]:_0x3b15fd[_0xfa29('0x39')];if(_0x4db4c4[_0xfa29('0x3a')][_0xfa29('0x48')]){_0x3b580e['include']=[{'all':!![]}];}_0x3b580e=_[_0xfa29('0x47')]({},_0x3b580e,_0x4db4c4[_0xfa29('0x4e')]);return db['Plugin'][_0xfa29('0x4f')](_0x3b580e)[_0xfa29('0x2a')](handleEntityNotFound(_0x45b1e6,null))[_0xfa29('0x2a')](respondWithResult(_0x45b1e6,null))['catch'](handleError(_0x45b1e6,null));};exports['download']=function(_0x1f34ce,_0x5f4d0c,_0x2df217){return db[_0xfa29('0x36')]['find']({'where':{'id':_0x1f34ce[_0xfa29('0x4d')]['id']},'attributes':[_0xfa29('0x32'),_0xfa29('0x7')],'raw':!![]})[_0xfa29('0x2a')](handleEntityNotFound(_0x5f4d0c,null))[_0xfa29('0x2a')](function(_0x4d1021){if(_0x4d1021){var _0x27541a=path[_0xfa29('0x50')](config['root'],_0xfa29('0x51'),util[_0xfa29('0x52')](_0xfa29('0x53'),path[_0xfa29('0x54')](_0x4d1021[_0xfa29('0x7')])));var _0x1a97c8=fs[_0xfa29('0x55')](_0x27541a);var _0x158cdf=archiver('zip',{'zlib':{'level':0x9}});_0x158cdf['on']('warning',function(_0x5ab47f){if(_0x5ab47f[_0xfa29('0x56')]===_0xfa29('0x57')){logger[_0xfa29('0x30')](_0x5ab47f);}else{throw new db[(_0xfa29('0x58'))][(_0xfa29('0x59'))](_0xfa29('0x5a'));}});_0x158cdf['on'](_0xfa29('0x30'),function(_0x2bf6f3){throw new db[(_0xfa29('0x58'))][(_0xfa29('0x59'))](_0xfa29('0x5a'));});_0x158cdf['pipe'](_0x1a97c8);_0x158cdf[_0xfa29('0x5b')](_0xfa29('0x5c'),{'cwd':path[_0xfa29('0x50')](config['root'],_0xfa29('0x51'),path['dirname'](_0x4d1021[_0xfa29('0x7')])),'ignore':[path['join'](path[_0xfa29('0x54')](_0x4d1021[_0xfa29('0x7')]),_0xfa29('0x5d')),path['join'](path[_0xfa29('0x54')](_0x4d1021[_0xfa29('0x7')]),_0xfa29('0x5e'))],'nodir':!![]})[_0xfa29('0x5f')]();_0x1a97c8['on']('close',function(){if(!fs[_0xfa29('0x60')](_0x27541a)){throw new db[(_0xfa29('0x58'))][(_0xfa29('0x59'))](_0xfa29('0x61'));}return _0x5f4d0c[_0xfa29('0x62')](_0x27541a,util['format'](_0xfa29('0x53'),path[_0xfa29('0x54')](_0x4d1021[_0xfa29('0x7')])),function(_0x5bf43f){if(_0x5bf43f){throw new db[(_0xfa29('0x58'))][(_0xfa29('0x59'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs['unlinkSync'](_0x27541a);logger['info'](_0xfa29('0x63'));logger['info'](_0xfa29('0x64'));});});}return null;})[_0xfa29('0x4b')](handleError(_0x5f4d0c,null));};exports[_0xfa29('0x65')]=function(_0x43feb4,_0x3d6ff6,_0x211923){var _0x54055b=path[_0xfa29('0x54')](_0x43feb4['file'][_0xfa29('0x66')],path['extname'](_0x43feb4[_0xfa29('0x67')][_0xfa29('0x66')]));var _0x5a499f=path['join'](config[_0xfa29('0x68')],_0xfa29('0x51'),_0x43feb4[_0xfa29('0x67')]['filename']);var _0x332f77=path['join'](config['root'],'server/files/plugins',_0x54055b);logger['info'](_0xfa29('0x69'),_0x5a499f);logger[_0xfa29('0x6a')](_0xfa29('0x6b'),_0x332f77);try{fs['chmodSync'](_0x5a499f,parseInt(_0xfa29('0x6c'),0x8));extract(_0x5a499f,{'dir':_0x332f77},function(_0x456cbb){if(_0x456cbb){logger[_0xfa29('0x30')](_0x456cbb);handleError(_0x456cbb,!![]);};var _0x588096=fs['readdirSync'](_0x332f77);if(_0x588096[_0xfa29('0x40')]>0x1){removeReferences(_0x5a499f,_0x332f77);logger[_0xfa29('0x30')](_0xfa29('0x6d'));return _0x211923(new Error(_0xfa29('0x6d')));}var _0x5da688=fs[_0xfa29('0x6e')](path[_0xfa29('0x50')](_0x332f77,_0x588096[0x0]));if(_0x5da688[_0xfa29('0x6f')]()){removeReferences(_0x5a499f,_0x332f77);logger[_0xfa29('0x30')](_0xfa29('0x6d'));return _0x211923(new Error('Invalid\x20plugin\x20structure'));}if(_0x5da688[_0xfa29('0x70')]()){var _0x4360f6=fs[_0xfa29('0x71')](path[_0xfa29('0x50')](_0x332f77,_0x588096[0x0]));if(_0x4360f6['length']===0x0){removeReferences(_0x5a499f,_0x332f77);logger[_0xfa29('0x30')](_0xfa29('0x6d'));return _0x211923(new Error(_0xfa29('0x6d')));}var _0x112055=_0x4360f6['some'](function(_0x457259){return _0x457259===_0xfa29('0x72');});if(!_0x112055){return _0x211923(new Error(_0xfa29('0x73')));}var _0x416293=fs[_0xfa29('0x74')](path['join'](_0x332f77,_0x588096[0x0],_0xfa29('0x72')));var _0x58771c=JSON[_0xfa29('0x75')](_0x416293);if('undefined'==typeof _0x58771c[_0xfa29('0x32')]){return _0x211923(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0xfa29('0x22')==typeof _0x58771c[_0xfa29('0x76')]){return _0x211923(new Error(_0xfa29('0x77')));}if('undefined'==typeof _0x58771c[_0xfa29('0x78')]){return _0x211923(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xfa29('0x22')==typeof _0x58771c[_0xfa29('0x79')]){return _0x211923(new Error(_0xfa29('0x7a')));}if(_0x58771c[_0xfa29('0x76')]===_0xfa29('0x7b')){if(_0xfa29('0x22')==typeof _0x58771c['parameters']['views']){return _0x211923(new Error(_0xfa29('0x7c')));}if(_0xfa29('0x22')==typeof _0x58771c[_0xfa29('0x79')][_0xfa29('0x7d')][_0xfa29('0x7e')]&&_0xfa29('0x22')==typeof _0x58771c[_0xfa29('0x79')][_0xfa29('0x7d')][_0xfa29('0x7f')]){return _0x211923(new Error(_0xfa29('0x80')));}}else if(_0x58771c[_0xfa29('0x76')]==='script'){if(_0xfa29('0x22')==typeof _0x58771c[_0xfa29('0x79')][_0xfa29('0x81')]){return _0x211923(new Error(_0xfa29('0x82')));}if(_0xfa29('0x22')==typeof _0x58771c[_0xfa29('0x79')][_0xfa29('0x83')]){return _0x211923(new Error(_0xfa29('0x84')));}}else{return _0x211923(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x2b8727=_0x58771c[_0xfa29('0x32')];var _0x555509=_0x58771c[_0xfa29('0x85')];var _0x13dde1=_0x58771c[_0xfa29('0x76')];var _0x28b738=_0x58771c[_0xfa29('0x86')]?_0x58771c[_0xfa29('0x86')]:_0xfa29('0x87');var _0x5157ac=_0x58771c['icon']?_0x58771c['icon']:'icon-apps';var _0xd3c945='';var _0x4c7f7a='';var _0x3a4aa3='';var _0x140929='';var _0x2dd5f9=_0x58771c['version'];if(_0x13dde1===_0xfa29('0x7b')){if('undefined'!=typeof _0x58771c[_0xfa29('0x79')][_0xfa29('0x7d')][_0xfa29('0x7e')]){var _0x2e34cb=_0x58771c['parameters'][_0xfa29('0x7d')][_0xfa29('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0xfa29('0x88')](_0x2e34cb)){_0xd3c945=path[_0xfa29('0x50')](_0xfa29('0x89'),_0x54055b,_0x588096[0x0],_0x2e34cb);}else{_0xd3c945=_0x2e34cb;}}else{logger['info']('Warning:\x20admin\x20view\x20not\x20specified');}if('undefined'!=typeof _0x58771c[_0xfa29('0x79')][_0xfa29('0x7d')][_0xfa29('0x7f')]){var _0x331da7=_0x58771c['parameters'][_0xfa29('0x7d')][_0xfa29('0x7f')];if(!/^(f|ht)tps?:\/\//i['test'](_0x331da7)){_0x4c7f7a=path[_0xfa29('0x50')](_0xfa29('0x89'),_0x54055b,_0x588096[0x0],_0x331da7);}else{_0x4c7f7a=_0x331da7;}}else{logger[_0xfa29('0x6a')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x13dde1==='script'){_0x3a4aa3=_0x58771c[_0xfa29('0x79')][_0xfa29('0x81')];_0x140929=_0x58771c['parameters'][_0xfa29('0x83')];if(_0xfa29('0x22')!=typeof _0x58771c[_0xfa29('0x79')][_0xfa29('0x7d')]){if('undefined'!=typeof _0x58771c[_0xfa29('0x79')][_0xfa29('0x7d')][_0xfa29('0x7e')]){var _0x2e34cb=_0x58771c[_0xfa29('0x79')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0xfa29('0x88')](_0x2e34cb)){_0xd3c945=path[_0xfa29('0x50')]('plugins',_0x54055b,_0x588096[0x0],_0x2e34cb);}else{_0xd3c945=_0x2e34cb;}}if(_0xfa29('0x22')!=typeof _0x58771c['parameters'][_0xfa29('0x7d')][_0xfa29('0x7f')]){var _0x331da7=_0x58771c[_0xfa29('0x79')][_0xfa29('0x7d')][_0xfa29('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0xfa29('0x88')](_0x331da7)){_0x4c7f7a=path[_0xfa29('0x50')]('plugins',_0x54055b,_0x588096[0x0],_0x331da7);}else{_0x4c7f7a=_0x331da7;}}}}var _0x1a166b={'name':_0x2b8727,'description':_0x555509,'path':path['join'](_0x54055b,_0x588096[0x0]),'type':_0x13dde1,'sidebar':_0x28b738,'icon':_0x5157ac,'adminUrl':_0xd3c945,'agentUrl':_0x4c7f7a,'scriptName':_0x3a4aa3,'scriptPath':_0x140929,'version':_0x2dd5f9};removeReferences(_0x5a499f,null);return db[_0xfa29('0x36')]['create'](_0x1a166b)[_0xfa29('0x2a')](function(_0x3c0cfa){var _0x55de0f={'role':_0x43feb4[_0xfa29('0x8a')][_0xfa29('0x8b')],'userProfileId':_0x43feb4[_0xfa29('0x8a')][_0xfa29('0x8c')]};if(!_0x55de0f)throw new Error(_0xfa29('0x8d'));if(_0x55de0f[_0xfa29('0x8b')]===_0xfa29('0x8e')){var _0x237070=_0x3c0cfa[_0xfa29('0x2c')]({'plain':!![]});return db[_0xfa29('0x8f')][_0xfa29('0x4f')]({'where':{'name':'Plugins','userProfileId':_0x55de0f['userProfileId']},'raw':!![]})[_0xfa29('0x2a')](function(_0x421d56){if(_0x421d56&&_0x421d56['autoAssociation']===0x0){return db[_0xfa29('0x2e')][_0xfa29('0x90')]({'name':_0x237070[_0xfa29('0x32')],'resourceId':_0x237070['id'],'type':_0x421d56['name'],'sectionId':_0x421d56['id']},{})['then'](function(){return _0x3c0cfa;});}else{return _0x3c0cfa;}})[_0xfa29('0x4b')](function(_0x1a7fad){logger[_0xfa29('0x30')](_0xfa29('0x91'),_0x1a7fad);throw _0x1a7fad;});}return _0x3c0cfa;})['then'](respondWithResult(_0x3d6ff6,null))['catch'](handleError(_0x3d6ff6,null));}});}catch(_0x424415){_0x3d6ff6[_0xfa29('0x1e')](0x1f4)['send'](_0x424415);}};function removeReferences(_0x20f119,_0x14aca2){try{if(_0x20f119){fs[_0xfa29('0x92')](_0x20f119);logger[_0xfa29('0x6a')](_0xfa29('0x93'));}if(_0x14aca2){rimraf(_0x14aca2,function(){});logger[_0xfa29('0x6a')](_0xfa29('0x94'));}}catch(_0x58a5ed){logger[_0xfa29('0x30')](_0x58a5ed);}}exports[_0xfa29('0x29')]=function(_0x199e89,_0x569aaa,_0xdf30a3){return db[_0xfa29('0x36')][_0xfa29('0x4f')]({'where':{'id':_0x199e89[_0xfa29('0x4d')]['id']}})['then'](handleEntityNotFound(_0x569aaa,null))[_0xfa29('0x2a')](saveUpdates(_0x199e89[_0xfa29('0x8a')],null))[_0xfa29('0x2a')](respondWithResult(_0x569aaa,null))[_0xfa29('0x4b')](handleError(_0x569aaa,null));};exports[_0xfa29('0x95')]=function(_0x268755,_0xf2a6,_0x5728b3){return db[_0xfa29('0x36')][_0xfa29('0x4f')]({'where':{'id':_0x268755[_0xfa29('0x4d')]['id']}})[_0xfa29('0x2a')](function(_0x250a67){if(_0x250a67){return _0x250a67[_0xfa29('0x2b')]();}})[_0xfa29('0x2a')](function(_0x4acd37){rimraf(path[_0xfa29('0x50')](config[_0xfa29('0x68')],_0xfa29('0x51'),path[_0xfa29('0x96')](_0x4acd37[_0xfa29('0x7')])),function(){});return _0x4acd37;})[_0xfa29('0x2a')](handleEntityNotFound(_0xf2a6,null))[_0xfa29('0x2a')](respondWithStatusCode(_0xf2a6,null))[_0xfa29('0x4b')](handleError(_0xf2a6,null));};exports[_0xfa29('0x97')]=function(_0xc9ae8d,_0x30d48a,_0x20f4a6){return BPromise[_0xfa29('0x98')]()[_0xfa29('0x2a')](function(){if(!_0xc9ae8d[_0xfa29('0x3a')][_0xfa29('0x7')]){throw new Error(_0xfa29('0x99'));}if(!_0xc9ae8d[_0xfa29('0x3a')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x3d423d=_0xc9ae8d[_0xfa29('0x3a')]['hostname']?_0xc9ae8d[_0xfa29('0x3a')][_0xfa29('0x9a')]+':'+_0xc9ae8d['query'][_0xfa29('0x9b')]:_0xfa29('0x9c')+_0xc9ae8d[_0xfa29('0x3a')][_0xfa29('0x9b')];var _0x53cc67=_0xc9ae8d['query']['json']?_0xc9ae8d[_0xfa29('0x3a')][_0xfa29('0x20')]:!![];var _0x159e56=_0xc9ae8d[_0xfa29('0x3a')][_0xfa29('0x9d')]?_0xc9ae8d[_0xfa29('0x3a')][_0xfa29('0x9d')]:null;var _0x515d27={'method':_0xc9ae8d[_0xfa29('0x9e')],'uri':util['format'](_0xfa29('0x9f'),_0x3d423d,_0xc9ae8d['query'][_0xfa29('0x7')]),'json':_0x53cc67,'resolveWithFullResponse':!![],'encoding':_0x159e56,'qs':_0xc9ae8d[_0xfa29('0x3a')]};if(_0xc9ae8d[_0xfa29('0xa0')]){_0x515d27[_0xfa29('0xa0')]=_0xc9ae8d['headers'];if(_0x515d27[_0xfa29('0xa0')][_0xfa29('0xa1')]){delete _0x515d27['headers'][_0xfa29('0xa1')];}}if(_0x515d27[_0xfa29('0xa0')][_0xfa29('0xa2')]){delete _0x515d27[_0xfa29('0xa0')]['content-type'];}return rp(_0x515d27);})['then'](function(_0x414905){if(_0x414905){_0x30d48a[_0xfa29('0xa3')](_0x414905[_0xfa29('0xa0')]);logger[_0xfa29('0x6a')](_0x414905[_0xfa29('0x8a')]);if(_[_0xfa29('0xa4')](_0xc9ae8d['query']['path'],_0xfa29('0x62'))&&_0x414905[_0xfa29('0xa5')]==0x1f4){return _0x30d48a[_0xfa29('0x2f')](_0x414905[_0xfa29('0xa5')]);}else{return _0x30d48a['status'](_0x414905[_0xfa29('0xa5')])[_0xfa29('0x33')](_0x414905[_0xfa29('0x8a')]);}}else{return _0x30d48a[_0xfa29('0x2f')](0xc8);}})['catch'](handleError(_0x30d48a,null));};exports['webhookPost']=function(_0x34a0a3,_0x48ceb2,_0x1c37da){return BPromise[_0xfa29('0x98')]()[_0xfa29('0x2a')](function(){if(!_0x34a0a3['query']['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x34a0a3[_0xfa29('0x3a')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x314411=_0x34a0a3[_0xfa29('0x3a')][_0xfa29('0x9a')]?_0x34a0a3[_0xfa29('0x3a')][_0xfa29('0x9a')]+':'+_0x34a0a3['query'][_0xfa29('0x9b')]:'http://localhost:'+_0x34a0a3['query'][_0xfa29('0x9b')];var _0x4161a8=_0x34a0a3[_0xfa29('0x3a')][_0xfa29('0x20')]?_0x34a0a3['query'][_0xfa29('0x20')]:!![];var _0x1bb067=_0x34a0a3[_0xfa29('0x3a')]['encoding']?_0x34a0a3[_0xfa29('0x3a')]['encoding']:null;var _0x3957d8={'method':_0x34a0a3[_0xfa29('0x9e')],'uri':util[_0xfa29('0x52')](_0xfa29('0x9f'),_0x314411,_0x34a0a3['query']['path']),'json':_0x4161a8,'resolveWithFullResponse':!![],'encoding':_0x1bb067,'body':_0x34a0a3[_0xfa29('0x8a')]};if(_0x34a0a3['headers']){_0x3957d8['headers']=_0x34a0a3[_0xfa29('0xa0')];if(_0x3957d8['headers'][_0xfa29('0xa1')]){delete _0x3957d8['headers'][_0xfa29('0xa1')];}}if(_0x3957d8[_0xfa29('0xa0')][_0xfa29('0xa2')]){delete _0x3957d8[_0xfa29('0xa0')]['content-type'];}return rp(_0x3957d8);})[_0xfa29('0x2a')](function(_0x342084){if(_0x342084){_0x48ceb2[_0xfa29('0xa3')](_0x342084[_0xfa29('0xa0')]);logger[_0xfa29('0x6a')](_0x342084[_0xfa29('0x8a')]);return _0x48ceb2['status'](_0x342084[_0xfa29('0xa5')])[_0xfa29('0x33')](_0x342084[_0xfa29('0x8a')]);}else{return _0x48ceb2[_0xfa29('0x2f')](0xc8);}})[_0xfa29('0x4b')](handleError(_0x48ceb2,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 9f55cc5..0151459 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 _0x9f5a=['events','../../mysqldb','Plugin','setMaxListeners','update','remove','emit','hook','exports'];(function(_0x30079f,_0xcf2fe3){var _0x587f91=function(_0x3bdd1a){while(--_0x3bdd1a){_0x30079f['push'](_0x30079f['shift']());}};_0x587f91(++_0xcf2fe3);}(_0x9f5a,0xbd));var _0xa9f5=function(_0x32f9c2,_0x4642dc){_0x32f9c2=_0x32f9c2-0x0;var _0x82b81b=_0x9f5a[_0x32f9c2];return _0x82b81b;};'use strict';var EventEmitter=require(_0xa9f5('0x0'));var Plugin=require(_0xa9f5('0x1'))['db'][_0xa9f5('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xa9f5('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa9f5('0x4'),'afterDestroy':_0xa9f5('0x5')};function emitEvent(_0x3cdf79){return function(_0x4eeedd,_0x20f51f,_0x4c611b){PluginEvents[_0xa9f5('0x6')](_0x3cdf79+':'+_0x4eeedd['id'],_0x4eeedd);PluginEvents[_0xa9f5('0x6')](_0x3cdf79,_0x4eeedd);_0x4c611b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0xa9f5('0x7')](e,emitEvent(event));}}module[_0xa9f5('0x8')]=PluginEvents; \ No newline at end of file +var _0xa423=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','Plugin','setMaxListeners','save'];(function(_0xc36487,_0x3c81cd){var _0x4b5d91=function(_0x128f15){while(--_0x128f15){_0xc36487['push'](_0xc36487['shift']());}};_0x4b5d91(++_0x3c81cd);}(_0xa423,0x16c));var _0x3a42=function(_0x5e0ca0,_0x3f3560){_0x5e0ca0=_0x5e0ca0-0x0;var _0x3dd119=_0xa423[_0x5e0ca0];return _0x3dd119;};'use strict';var EventEmitter=require(_0x3a42('0x0'));var Plugin=require(_0x3a42('0x1'))['db'][_0x3a42('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x3a42('0x3')](0x0);var events={'afterCreate':_0x3a42('0x4'),'afterUpdate':'update','afterDestroy':_0x3a42('0x5')};function emitEvent(_0x857de4){return function(_0x5c4f6a,_0xc6780b,_0x33f87e){PluginEvents[_0x3a42('0x6')](_0x857de4+':'+_0x5c4f6a['id'],_0x5c4f6a);PluginEvents[_0x3a42('0x6')](_0x857de4,_0x5c4f6a);_0x33f87e(null);};}for(var e in events){if(events[_0x3a42('0x7')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x3a42('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 099ffe7..623528d 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 _0xf878=['exports','define','Plugin','plugins','../../config/logger','moment','bluebird','request-promise','path','rimraf','./plugin.attributes'];(function(_0x29e43c,_0x55d4c6){var _0x18d115=function(_0x1fb6e6){while(--_0x1fb6e6){_0x29e43c['push'](_0x29e43c['shift']());}};_0x18d115(++_0x55d4c6);}(_0xf878,0x88));var _0x8f87=function(_0x3b9329,_0x414164){_0x3b9329=_0x3b9329-0x0;var _0x375ace=_0xf878[_0x3b9329];return _0x375ace;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8f87('0x0'))('api');var moment=require(_0x8f87('0x1'));var BPromise=require(_0x8f87('0x2'));var rp=require(_0x8f87('0x3'));var fs=require('fs');var path=require(_0x8f87('0x4'));var rimraf=require(_0x8f87('0x5'));var config=require('../../config/environment');var attributes=require(_0x8f87('0x6'));module[_0x8f87('0x7')]=function(_0x3fe6d5,_0x2f4ab5){return _0x3fe6d5[_0x8f87('0x8')](_0x8f87('0x9'),attributes,{'tableName':_0x8f87('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf794=['path','rimraf','../../config/environment','./plugin.attributes','exports','define','../../config/logger','api','moment','request-promise'];(function(_0x685346,_0x3ef2e5){var _0x52e15b=function(_0x4435da){while(--_0x4435da){_0x685346['push'](_0x685346['shift']());}};_0x52e15b(++_0x3ef2e5);}(_0xf794,0x150));var _0x4f79=function(_0x471e11,_0xf0e1c8){_0x471e11=_0x471e11-0x0;var _0x31b85d=_0xf794[_0x471e11];return _0x31b85d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4f79('0x0'))(_0x4f79('0x1'));var moment=require(_0x4f79('0x2'));var BPromise=require('bluebird');var rp=require(_0x4f79('0x3'));var fs=require('fs');var path=require(_0x4f79('0x4'));var rimraf=require(_0x4f79('0x5'));var config=require(_0x4f79('0x6'));var attributes=require(_0x4f79('0x7'));module[_0x4f79('0x8')]=function(_0x559bb4,_0x31e533){return _0x559bb4[_0x4f79('0x9')]('Plugin',attributes,{'tableName':'plugins','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 cbadfad..d0fbc68 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 _0x36b7=['redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','info','debug','request\x20sent','stringify','error','code','Plugin,\x20%s,\x20%s','message','result','catch','CreatePlugin','create','body','options','raw','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x22390f,_0x3765a7){var _0x2ae9e3=function(_0x490d06){while(--_0x490d06){_0x22390f['push'](_0x22390f['shift']());}};_0x2ae9e3(++_0x3765a7);}(_0x36b7,0x1bb));var _0x736b=function(_0x44ade4,_0x4869d6){_0x44ade4=_0x44ade4-0x0;var _0x5b5f4b=_0x36b7[_0x44ade4];return _0x5b5f4b;};'use strict';var _=require(_0x736b('0x0'));var util=require(_0x736b('0x1'));var moment=require(_0x736b('0x2'));var BPromise=require(_0x736b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x736b('0x4'));var db=require(_0x736b('0x5'))['db'];var utils=require(_0x736b('0x6'));var logger=require(_0x736b('0x7'))(_0x736b('0x8'));var config=require('../../config/environment');var jayson=require(_0x736b('0x9'));var client=jayson[_0x736b('0xa')][_0x736b('0xb')]({'port':0x232a});config[_0x736b('0xc')]=_[_0x736b('0xd')](config[_0x736b('0xc')],{'host':_0x736b('0xe'),'port':0x18eb});var socket=require(_0x736b('0xf'))(new Redis(config[_0x736b('0xc')]));require(_0x736b('0x10'))[_0x736b('0x11')](socket);function respondWithRpcPromise(_0x35b5dd,_0x5dd540,_0x737486){return new BPromise(function(_0x93f6d1,_0x5157ea){return client[_0x736b('0x12')](_0x35b5dd,_0x737486)['then'](function(_0x1db7f2){logger[_0x736b('0x13')]('Plugin,\x20%s,\x20%s',_0x5dd540,'request\x20sent');logger[_0x736b('0x14')]('Plugin,\x20%s,\x20%s,\x20%s',_0x5dd540,_0x736b('0x15'),JSON[_0x736b('0x16')](_0x1db7f2));if(_0x1db7f2[_0x736b('0x17')]){if(_0x1db7f2[_0x736b('0x17')][_0x736b('0x18')]===0x1f4){logger[_0x736b('0x17')](_0x736b('0x19'),_0x5dd540,_0x1db7f2['error']['message']);return _0x5157ea(_0x1db7f2[_0x736b('0x17')][_0x736b('0x1a')]);}logger[_0x736b('0x17')](_0x736b('0x19'),_0x5dd540,_0x1db7f2['error'][_0x736b('0x1a')]);return _0x93f6d1(_0x1db7f2['error'][_0x736b('0x1a')]);}else{logger[_0x736b('0x13')](_0x736b('0x19'),_0x5dd540,'request\x20sent');_0x93f6d1(_0x1db7f2[_0x736b('0x1b')]['message']);}})[_0x736b('0x1c')](function(_0x2d01fc){logger['error'](_0x736b('0x19'),_0x5dd540,_0x2d01fc);_0x5157ea(_0x2d01fc);});});}exports[_0x736b('0x1d')]=function(_0x193036){var _0x2bf7ec=this;return new Promise(function(_0x3b5c1f,_0x1d5aa0){return db['Plugin'][_0x736b('0x1e')](_0x193036[_0x736b('0x1f')],{'raw':_0x193036[_0x736b('0x20')]?_0x193036[_0x736b('0x20')][_0x736b('0x21')]===undefined?!![]:![]:!![]})[_0x736b('0x22')](function(_0x5c768c){logger[_0x736b('0x13')](_0x736b('0x1d'),_0x193036);logger[_0x736b('0x14')](_0x736b('0x1d'),_0x193036,JSON[_0x736b('0x16')](_0x5c768c));_0x3b5c1f(_0x5c768c);})[_0x736b('0x1c')](function(_0x541bab){logger[_0x736b('0x17')](_0x736b('0x1d'),_0x541bab['message'],_0x193036);_0x1d5aa0(_0x2bf7ec[_0x736b('0x17')](0x1f4,_0x541bab[_0x736b('0x1a')]));});});}; \ No newline at end of file +var _0xa5db=['debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreatePlugin','create','options','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent'];(function(_0x175375,_0xa7c84c){var _0x3c0b17=function(_0xf409fa){while(--_0xf409fa){_0x175375['push'](_0x175375['shift']());}};_0x3c0b17(++_0xa7c84c);}(_0xa5db,0x7e));var _0xba5d=function(_0x19e2a9,_0x1b98a1){_0x19e2a9=_0x19e2a9-0x0;var _0x1f7b24=_0xa5db[_0x19e2a9];return _0x1f7b24;};'use strict';var _=require(_0xba5d('0x0'));var util=require(_0xba5d('0x1'));var moment=require(_0xba5d('0x2'));var BPromise=require('bluebird');var rs=require(_0xba5d('0x3'));var fs=require('fs');var Redis=require(_0xba5d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xba5d('0x5'))(_0xba5d('0x6'));var config=require(_0xba5d('0x7'));var jayson=require(_0xba5d('0x8'));var client=jayson[_0xba5d('0x9')][_0xba5d('0xa')]({'port':0x232a});config[_0xba5d('0xb')]=_['defaults'](config[_0xba5d('0xb')],{'host':_0xba5d('0xc'),'port':0x18eb});var socket=require(_0xba5d('0xd'))(new Redis(config[_0xba5d('0xb')]));require('./plugin.socket')['register'](socket);function respondWithRpcPromise(_0x259e63,_0x40fcad,_0xbdab40){return new BPromise(function(_0x12e170,_0x4e6109){return client[_0xba5d('0xe')](_0x259e63,_0xbdab40)[_0xba5d('0xf')](function(_0x503487){logger[_0xba5d('0x10')](_0xba5d('0x11'),_0x40fcad,_0xba5d('0x12'));logger[_0xba5d('0x13')](_0xba5d('0x14'),_0x40fcad,_0xba5d('0x12'),JSON[_0xba5d('0x15')](_0x503487));if(_0x503487[_0xba5d('0x16')]){if(_0x503487[_0xba5d('0x16')]['code']===0x1f4){logger[_0xba5d('0x16')]('Plugin,\x20%s,\x20%s',_0x40fcad,_0x503487[_0xba5d('0x16')][_0xba5d('0x17')]);return _0x4e6109(_0x503487[_0xba5d('0x16')][_0xba5d('0x17')]);}logger[_0xba5d('0x16')](_0xba5d('0x11'),_0x40fcad,_0x503487[_0xba5d('0x16')][_0xba5d('0x17')]);return _0x12e170(_0x503487[_0xba5d('0x16')][_0xba5d('0x17')]);}else{logger['info'](_0xba5d('0x11'),_0x40fcad,_0xba5d('0x12'));_0x12e170(_0x503487[_0xba5d('0x18')]['message']);}})[_0xba5d('0x19')](function(_0x4add8d){logger[_0xba5d('0x16')]('Plugin,\x20%s,\x20%s',_0x40fcad,_0x4add8d);_0x4e6109(_0x4add8d);});});}exports[_0xba5d('0x1a')]=function(_0x2bb137){var _0x44503e=this;return new Promise(function(_0x3c567a,_0x13fc98){return db['Plugin'][_0xba5d('0x1b')](_0x2bb137['body'],{'raw':_0x2bb137[_0xba5d('0x1c')]?_0x2bb137[_0xba5d('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1ef26d){logger['info'](_0xba5d('0x1a'),_0x2bb137);logger['debug'](_0xba5d('0x1a'),_0x2bb137,JSON[_0xba5d('0x15')](_0x1ef26d));_0x3c567a(_0x1ef26d);})[_0xba5d('0x19')](function(_0x550dea){logger[_0xba5d('0x16')](_0xba5d('0x1a'),_0x550dea[_0xba5d('0x17')],_0x2bb137);_0x13fc98(_0x44503e[_0xba5d('0x16')](0x1f4,_0x550dea[_0xba5d('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 2c08b3c..bf7f806 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 _0xeecd=['plugin:','./plugin.events','save','remove','emit','removeListener','register','length'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0xeecd,0x189));var _0xdeec=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xeecd[_0x20a584];return _0x4b41a8;};'use strict';var PluginEvents=require(_0xdeec('0x0'));var events=[_0xdeec('0x1'),_0xdeec('0x2'),'update'];function createListener(_0xfeacbc,_0x270cf9){return function(_0x247cd9){_0x270cf9[_0xdeec('0x3')](_0xfeacbc,_0x247cd9);};}function removeListener(_0x40985f,_0x286cb4){return function(){PluginEvents[_0xdeec('0x4')](_0x40985f,_0x286cb4);};}exports[_0xdeec('0x5')]=function(_0x2c1b80){for(var _0x34207f=0x0,_0x4ddeec=events[_0xdeec('0x6')];_0x34207f<_0x4ddeec;_0x34207f++){var _0x178c5b=events[_0x34207f];var _0x272821=createListener(_0xdeec('0x7')+_0x178c5b,_0x2c1b80);PluginEvents['on'](_0x178c5b,_0x272821);}}; \ No newline at end of file +var _0x8098=['register','plugin:','save','remove','update','emit','removeListener'];(function(_0x176259,_0x30e46f){var _0x48dc40=function(_0x3aa524){while(--_0x3aa524){_0x176259['push'](_0x176259['shift']());}};_0x48dc40(++_0x30e46f);}(_0x8098,0x11a));var _0x8809=function(_0x51908c,_0x207a9c){_0x51908c=_0x51908c-0x0;var _0xb4c6be=_0x8098[_0x51908c];return _0xb4c6be;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x8809('0x0'),_0x8809('0x1'),_0x8809('0x2')];function createListener(_0x397305,_0x51563b){return function(_0x403a08){_0x51563b[_0x8809('0x3')](_0x397305,_0x403a08);};}function removeListener(_0x87f106,_0x5854d9){return function(){PluginEvents[_0x8809('0x4')](_0x87f106,_0x5854d9);};}exports[_0x8809('0x5')]=function(_0x5dee31){for(var _0x5eccf1=0x0,_0x1c9c04=events['length'];_0x5eccf1<_0x1c9c04;_0x5eccf1++){var _0x4207c1=events[_0x5eccf1];var _0x26e12e=createListener(_0x8809('0x6')+_0x4207c1,_0x5dee31);PluginEvents['on'](_0x4207c1,_0x26e12e);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index f3d06ac..bbe75c9 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(_0x20cb01,_0x433c80){var _0x2582c2=function(_0x5e5bdb){while(--_0x5e5bdb){_0x20cb01['push'](_0x20cb01['shift']());}};_0x2582c2(++_0x433c80);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file +var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x15c333,_0x5f4fb1){var _0x1cf512=function(_0xfccfb9){while(--_0xfccfb9){_0x15c333['push'](_0x15c333['shift']());}};_0x1cf512(++_0x5f4fb1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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 83cac4c..c50da50 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 _0x6324=['params','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','child_process','bluebird','sendStatus','json','error','stack','status','send','npm\x20install','info','index','list','reject','name','motion2','length','then','catch','describe','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','destroy'];(function(_0x1eb70d,_0x2525b1){var _0x397c6b=function(_0x331a5c){while(--_0x331a5c){_0x1eb70d['push'](_0x1eb70d['shift']());}};_0x397c6b(++_0x2525b1);}(_0x6324,0x142));var _0x4632=function(_0x3a07d4,_0xa80b88){_0x3a07d4=_0x3a07d4-0x0;var _0x2c352=_0x6324[_0x3a07d4];return _0x2c352;};'use strict';var _=require(_0x4632('0x0'));var pm2=require(_0x4632('0x1'));var logger=require(_0x4632('0x2'))(_0x4632('0x3'));var path=require('path');var exec=require(_0x4632('0x4'))['exec'];var BPromise=require(_0x4632('0x5'));function handleEntityNotFound(_0x54c200,_0x13b218){return function(_0x592e39){if(!_0x592e39){_0x54c200[_0x4632('0x6')](0x194);;}return _0x592e39;};}function respondWithResult(_0x24aba6,_0x1f3077){_0x1f3077=_0x1f3077||0xc8;return function(_0x126e9a){if(_0x126e9a){return _0x24aba6['status'](_0x1f3077)[_0x4632('0x7')](_0x126e9a);}return null;};}function handleError(_0x44dd6d,_0x390a46){_0x390a46=_0x390a46||0x1f4;return function(_0x5a523b){logger[_0x4632('0x8')](_0x5a523b[_0x4632('0x9')]);if(_0x5a523b['name']){delete _0x5a523b['name'];}_0x44dd6d[_0x4632('0xa')](_0x390a46)[_0x4632('0xb')](_0x5a523b);};}function execChildProcess(){return new BPromise(function(_0x30a7cf,_0x3e26d9){exec(_0x4632('0xc'),function(_0xe28f38,_0x1b2729,_0x17f9d1){logger['info'](_0x1b2729);logger[_0x4632('0xd')](_0x17f9d1);if(_0xe28f38){logger['error'](_0xe28f38);return _0x3e26d9(_0xe28f38);}return _0x30a7cf(_0x1b2729);});});}exports[_0x4632('0xe')]=function(_0x299073,_0x3ef228){return pm2[_0x4632('0xf')]()['then'](function(_0x3ba361){if(_0x3ba361){var _0x255882=_[_0x4632('0x10')](_0x3ba361,function(_0x37d798){return _0x37d798[_0x4632('0x11')]==='express'||_0x37d798['name']===_0x4632('0x12');});return{'rows':_0x255882,'count':_0x255882[_0x4632('0x13')]};}return null;})[_0x4632('0x14')](respondWithResult(_0x3ef228,null))[_0x4632('0x15')](handleError(_0x3ef228,null));};exports['show']=function(_0x158831,_0x113872){return pm2[_0x4632('0x16')](_0x158831['params']['id'])[_0x4632('0x14')](respondWithResult(_0x113872,null))[_0x4632('0x14')](handleEntityNotFound(_0x113872,null))['catch'](handleError(_0x113872,null));};exports['create']=function(_0x1c0523,_0x3cf2bd){if(_0x1c0523[_0x4632('0x17')][_0x4632('0x11')]&&_0x1c0523[_0x4632('0x17')][_0x4632('0x18')]){var _0x9ab826=path[_0x4632('0x19')](__dirname,_0x4632('0x1a'),_0x1c0523[_0x4632('0x17')][_0x4632('0x18')]);var _0x2d656a=process[_0x4632('0x1b')]();process[_0x4632('0x1c')](path[_0x4632('0x1d')](_0x9ab826));return execChildProcess()[_0x4632('0x14')](function(_0x4264d5){process[_0x4632('0x1c')](_0x2d656a);return pm2[_0x4632('0x1e')]({'name':_0x1c0523[_0x4632('0x17')][_0x4632('0x11')],'script':_0x9ab826});})[_0x4632('0x14')](function(_0x3b0823){pm2[_0x4632('0x1f')]();return _0x3b0823[0x0];})[_0x4632('0x14')](respondWithResult(_0x3cf2bd,0xc9))[_0x4632('0x15')](handleError(_0x3cf2bd,null));}else{return _0x3cf2bd[_0x4632('0xa')](0x1f4)[_0x4632('0xb')]({'message':_0x4632('0x20')});}};exports[_0x4632('0x21')]=function(_0x22d0f5,_0x2a0b11){if(_0x22d0f5[_0x4632('0x17')]['id']){delete _0x22d0f5['body']['id'];}var _0x57798a={'online':_0x4632('0x22'),'stopped':_0x4632('0x23')};if(_0x57798a[_0x4632('0x24')](_0x22d0f5[_0x4632('0x17')][_0x4632('0xa')])){return pm2[_0x57798a[_0x22d0f5[_0x4632('0x17')][_0x4632('0xa')]]](_0x22d0f5['params']['id'])[_0x4632('0x14')](respondWithResult(_0x2a0b11,0xc8))[_0x4632('0x15')](handleError(_0x2a0b11,null));}else{return _0x2a0b11['status'](0x1f4)[_0x4632('0xb')]({'message':'Unknown\x20status'});}};exports[_0x4632('0x25')]=function(_0x4cb661,_0x4fda35){if(_0x4cb661[_0x4632('0x17')]['id']){delete _0x4cb661[_0x4632('0x17')]['id'];}if(_0x4cb661[_0x4632('0x26')]['id']){return pm2['delete'](_0x4cb661['params']['id'])[_0x4632('0x14')](function(_0x7671ab){pm2['dump']();return _0x7671ab[0x0];})['then'](respondWithResult(_0x4fda35,null))[_0x4632('0x15')](handleError(_0x4fda35,null));}else{return _0x4fda35[_0x4632('0xa')](0x1f4)['send']({'message':_0x4632('0x27')});}}; \ No newline at end of file +var _0x41bb=['restart','stop','hasOwnProperty','Unknown\x20status','delete','dump','Unknown\x20id','lodash','../../config/pm2','api','child_process','exec','bluebird','sendStatus','json','error','stack','name','status','send','info','index','list','then','express','motion2','catch','show','describe','params','create','body','join','../../files/plugins','script','dirname','start','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x41bb,0xc5));var _0xb41b=function(_0x43bc1c,_0xb21fc1){_0x43bc1c=_0x43bc1c-0x0;var _0x4bfe93=_0x41bb[_0x43bc1c];return _0x4bfe93;};'use strict';var _=require(_0xb41b('0x0'));var pm2=require(_0xb41b('0x1'));var logger=require('../../config/logger')(_0xb41b('0x2'));var path=require('path');var exec=require(_0xb41b('0x3'))[_0xb41b('0x4')];var BPromise=require(_0xb41b('0x5'));function handleEntityNotFound(_0x448c8e,_0x4ee21b){return function(_0x12cea3){if(!_0x12cea3){_0x448c8e[_0xb41b('0x6')](0x194);;}return _0x12cea3;};}function respondWithResult(_0x2dbaa3,_0x50bc62){_0x50bc62=_0x50bc62||0xc8;return function(_0x5455ce){if(_0x5455ce){return _0x2dbaa3['status'](_0x50bc62)[_0xb41b('0x7')](_0x5455ce);}return null;};}function handleError(_0x29c30d,_0x53722a){_0x53722a=_0x53722a||0x1f4;return function(_0x13d44e){logger[_0xb41b('0x8')](_0x13d44e[_0xb41b('0x9')]);if(_0x13d44e[_0xb41b('0xa')]){delete _0x13d44e[_0xb41b('0xa')];}_0x29c30d[_0xb41b('0xb')](_0x53722a)[_0xb41b('0xc')](_0x13d44e);};}function execChildProcess(){return new BPromise(function(_0x4baa03,_0x1a9e2c){exec('npm\x20install',function(_0x2e906c,_0xb02d60,_0x1e1c82){logger[_0xb41b('0xd')](_0xb02d60);logger[_0xb41b('0xd')](_0x1e1c82);if(_0x2e906c){logger['error'](_0x2e906c);return _0x1a9e2c(_0x2e906c);}return _0x4baa03(_0xb02d60);});});}exports[_0xb41b('0xe')]=function(_0x2d947a,_0x33d1b5){return pm2[_0xb41b('0xf')]()[_0xb41b('0x10')](function(_0x4e8603){if(_0x4e8603){var _0x4e7f11=_['reject'](_0x4e8603,function(_0x1a09ec){return _0x1a09ec[_0xb41b('0xa')]===_0xb41b('0x11')||_0x1a09ec[_0xb41b('0xa')]===_0xb41b('0x12');});return{'rows':_0x4e7f11,'count':_0x4e7f11['length']};}return null;})[_0xb41b('0x10')](respondWithResult(_0x33d1b5,null))[_0xb41b('0x13')](handleError(_0x33d1b5,null));};exports[_0xb41b('0x14')]=function(_0xcf0728,_0x43f4ea){return pm2[_0xb41b('0x15')](_0xcf0728[_0xb41b('0x16')]['id'])['then'](respondWithResult(_0x43f4ea,null))['then'](handleEntityNotFound(_0x43f4ea,null))['catch'](handleError(_0x43f4ea,null));};exports[_0xb41b('0x17')]=function(_0x503e86,_0x307633){if(_0x503e86[_0xb41b('0x18')][_0xb41b('0xa')]&&_0x503e86['body']['script']){var _0x1a1386=path[_0xb41b('0x19')](__dirname,_0xb41b('0x1a'),_0x503e86[_0xb41b('0x18')][_0xb41b('0x1b')]);var _0x42dccb=process['cwd']();process['chdir'](path[_0xb41b('0x1c')](_0x1a1386));return execChildProcess()[_0xb41b('0x10')](function(_0x871b35){process['chdir'](_0x42dccb);return pm2[_0xb41b('0x1d')]({'name':_0x503e86[_0xb41b('0x18')]['name'],'script':_0x1a1386});})[_0xb41b('0x10')](function(_0x34f908){pm2['dump']();return _0x34f908[0x0];})[_0xb41b('0x10')](respondWithResult(_0x307633,0xc9))['catch'](handleError(_0x307633,null));}else{return _0x307633[_0xb41b('0xb')](0x1f4)[_0xb41b('0xc')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0xb41b('0x1e')]=function(_0x4265b8,_0x583099){if(_0x4265b8['body']['id']){delete _0x4265b8[_0xb41b('0x18')]['id'];}var _0x46aecf={'online':_0xb41b('0x1f'),'stopped':_0xb41b('0x20')};if(_0x46aecf[_0xb41b('0x21')](_0x4265b8[_0xb41b('0x18')][_0xb41b('0xb')])){return pm2[_0x46aecf[_0x4265b8['body'][_0xb41b('0xb')]]](_0x4265b8[_0xb41b('0x16')]['id'])['then'](respondWithResult(_0x583099,0xc8))[_0xb41b('0x13')](handleError(_0x583099,null));}else{return _0x583099['status'](0x1f4)[_0xb41b('0xc')]({'message':_0xb41b('0x22')});}};exports['destroy']=function(_0x23a6ed,_0x4a95e7){if(_0x23a6ed[_0xb41b('0x18')]['id']){delete _0x23a6ed[_0xb41b('0x18')]['id'];}if(_0x23a6ed['params']['id']){return pm2[_0xb41b('0x23')](_0x23a6ed[_0xb41b('0x16')]['id'])[_0xb41b('0x10')](function(_0x4503cf){pm2[_0xb41b('0x24')]();return _0x4503cf[0x0];})[_0xb41b('0x10')](respondWithResult(_0x4a95e7,null))[_0xb41b('0x13')](handleError(_0x4a95e7,null));}else{return _0x4a95e7[_0xb41b('0xb')](0x1f4)[_0xb41b('0xc')]({'message':_0xb41b('0x25')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 669025f..988c424 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 _0x2dce=['express','../../components/auth/service','get','/agents','isAuthenticated','exports'];(function(_0x47bb4f,_0x21ab9d){var _0x38f781=function(_0x1d2e17){while(--_0x1d2e17){_0x47bb4f['push'](_0x47bb4f['shift']());}};_0x38f781(++_0x21ab9d);}(_0x2dce,0x1f2));var _0xe2dc=function(_0x287fcb,_0x5af3b3){_0x287fcb=_0x287fcb-0x0;var _0x510541=_0x2dce[_0x287fcb];return _0x510541;};'use strict';var express=require(_0xe2dc('0x0'));var router=express['Router']();var auth=require(_0xe2dc('0x1'));var controller=require('./realtime.controller');router[_0xe2dc('0x2')](_0xe2dc('0x3'),auth[_0xe2dc('0x4')](),controller['getAgents']);router[_0xe2dc('0x2')]('/queues',auth[_0xe2dc('0x4')](),controller['getQueues']);module[_0xe2dc('0x5')]=router; \ No newline at end of file +var _0x1a5b=['Router','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getAgents','/queues','getQueues','exports'];(function(_0xde9818,_0x170d51){var _0x33edee=function(_0x23d6f5){while(--_0x23d6f5){_0xde9818['push'](_0xde9818['shift']());}};_0x33edee(++_0x170d51);}(_0x1a5b,0x190));var _0xb1a5=function(_0x537078,_0x4875be){_0x537078=_0x537078-0x0;var _0x38c754=_0x1a5b[_0x537078];return _0x38c754;};'use strict';var express=require('express');var router=express[_0xb1a5('0x0')]();var auth=require(_0xb1a5('0x1'));var controller=require(_0xb1a5('0x2'));router[_0xb1a5('0x3')](_0xb1a5('0x4'),auth[_0xb1a5('0x5')](),controller[_0xb1a5('0x6')]);router[_0xb1a5('0x3')](_0xb1a5('0x7'),auth[_0xb1a5('0x5')](),controller[_0xb1a5('0x8')]);module[_0xb1a5('0x9')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 771961b..4432d8a 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 _0x3508=['getOptions','push','literal','FIELD(id,','forEach','where','merge','user','userProfileId','Agents','extraQueryConditions','assign','getResources','User','map','find','filterAgentAttributes','globalStatus','getAgentStatus','includes','pause','voice','voiceStatus','talking','Status','sortAgentsByStatus','split','pick','catch','resolve','Queue','key','outbound','dialMethod','QueueCampaigns','name','UserProfile','initializeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','undefined','count','limit','status','set','Content-Range','json','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','*pause','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','fields','join','order','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','rawAttributes','fieldName','type','role','online'];(function(_0x31be62,_0x594f12){var _0x16fa51=function(_0x457f6e){while(--_0x457f6e){_0x31be62['push'](_0x31be62['shift']());}};_0x16fa51(++_0x594f12);}(_0x3508,0x1c0));var _0x8350=function(_0x394cc3,_0x3d906b){_0x394cc3=_0x394cc3-0x0;var _0x5819b9=_0x3508[_0x394cc3];return _0x5819b9;};'use strict';var _=require(_0x8350('0x0'));var util=require(_0x8350('0x1'));var rta=require(_0x8350('0x2'));var rtq=require(_0x8350('0x3'));var qs=require(_0x8350('0x4'));var utils=require(_0x8350('0x5'));var db=require(_0x8350('0x6'))['db'];var APIBadRequestError=require(_0x8350('0x7'))[_0x8350('0x8')];var APIHandleError=require('../../errors/api')[_0x8350('0x9')];function respondWithFilteredResult(_0x3fcf53,_0x32ae9c){return function(_0x5826a2){if(_0x5826a2){var _0x32944a=typeof _0x32ae9c[_0x8350('0xa')]==='undefined'&&typeof _0x32ae9c['limit']===_0x8350('0xb');var _0xc51b3d=_0x5826a2[_0x8350('0xc')];var _0x481804=_0x32944a?0x0:_0x32ae9c[_0x8350('0xa')];var _0x2a9652=_0x32944a?_0x5826a2[_0x8350('0xc')]:_0x32ae9c[_0x8350('0xa')]+_0x32ae9c[_0x8350('0xd')];var _0x2992c4;if(_0x2a9652>=_0xc51b3d){_0x2a9652=_0xc51b3d;_0x2992c4=0xc8;}else{_0x2992c4=0xce;}_0x3fcf53[_0x8350('0xe')](_0x2992c4);return _0x3fcf53[_0x8350('0xf')](_0x8350('0x10'),_0x481804+'-'+_0x2a9652+'/'+_0xc51b3d)[_0x8350('0x11')](_0x5826a2);}return null;};}exports[_0x8350('0x12')]=function(_0x26c757,_0x50f04e){var _0x3662be={'count':0x0,'rows':[]};var _0x1d8c00={};var _0x8e4efd;var _0x4bf134=utils[_0x8350('0x13')]();var _0x35ff90;var _0x27bed7;var _0x8ec264=_0x26c757[_0x8350('0x14')][_0x8350('0x15')];var _0x32a1cc=_0x26c757[_0x8350('0x14')][_0x8350('0x16')];var _0x3b4d7a=_0x26c757[_0x8350('0x14')][_0x8350('0x17')];var _0x3bd932=_0x32a1cc==='pause'||_0x32a1cc===_0x8350('0x18')?!![]:![];var _0x236dc4=[];var _0x31f3a5;var _0x1b3d8a;Promise['resolve']()[_0x8350('0x19')](function(){if(_0x26c757[_0x8350('0x14')][_0x8350('0x1a')]){if(!utils[_0x8350('0x1b')](_0x26c757[_0x8350('0x14')][_0x8350('0x1a')])){throw new APIBadRequestError(util[_0x8350('0x1c')](_0x8350('0x1d'),_0x26c757[_0x8350('0x14')][_0x8350('0x1a')]));}_0x8e4efd=_0x26c757['query'][_0x8350('0x1a')][_0x8350('0x1e')]();}if(!_0x26c757['query'][_0x8350('0x1f')]||!_0x26c757[_0x8350('0x14')]['sort']['includes']('globalStatus')){_0x26c757[_0x8350('0x14')][_0x8350('0x1f')]=rta['validateSortParameter'](_0x26c757['query'][_0x8350('0x1f')]);return;}var _0x2d72f8=rta['getUpdatedSortOptions'](_0x26c757[_0x8350('0x14')][_0x8350('0x1f')]);_0x26c757['query'][_0x8350('0x1f')]=_0x2d72f8[_0x8350('0x20')][_0x8350('0x21')](',');_0x31f3a5=_0x2d72f8[_0x8350('0x22')];})['then'](function(){if(!_0x8ec264){return[];}return rta['getAgentIdsByQueues'](_0x8ec264,_0x8e4efd);})[_0x8350('0x19')](function(_0x1cc707){_0x236dc4=_0x1cc707;return rta[_0x8350('0x23')]();})['then'](function(_0x5bd68f){_0x27bed7=_0x5bd68f[_0x8350('0x24')];if((!_0x32a1cc||_0x3bd932)&&!_0x31f3a5){return _0x236dc4;}if(_0x31f3a5&&!_0x32a1cc){return rta[_0x8350('0x25')](_0x27bed7,_0x236dc4,_0x31f3a5);}else{return rta[_0x8350('0x26')](_0x27bed7,_0x236dc4,_0x32a1cc);}})[_0x8350('0x19')](function(_0x2c3215){_0x236dc4=_0x2c3215;var _0x1b9a54=![];if(_0x236dc4['length']===0x0){if(_0x8ec264||_0x32a1cc){_0x1b9a54=!![];}if(_0x3bd932){_0x1b9a54=![];}}if(_0x1b9a54){return _0x3662be;}var _0x2c5213=_['map'](db['User'][_0x8350('0x27')],function(_0x3b13b6){return{'name':_0x3b13b6[_0x8350('0x28')],'type':_0x3b13b6[_0x8350('0x29')]['key']};});_0x26c757['query'][_0x8350('0x2a')]='agent';_0x26c757[_0x8350('0x14')][_0x8350('0x2b')]=!![];_0x1d8c00=qs[_0x8350('0x2c')](_0x2c5213,_0x26c757);_0x1d8c00['raw']=!![];var _0x1ae905=[];if(_0x236dc4['length']>0x0){_0x1ae905[_0x8350('0x2d')]({'id':{'$in':_0x236dc4}});if(_0x31f3a5&&!_0x32a1cc){_0x1b3d8a=[db['sequelize'][_0x8350('0x2e')](_0x8350('0x2f')+_0x236dc4+')')];_0x1d8c00[_0x8350('0x22')]=_0x1b3d8a;}}if(_0x3bd932){_0x4bf134['forEach'](function(_0x3526ec){var _0x93c6af=!![];if(_0x32a1cc===_0x8350('0x18')&&_0x8e4efd!==_0x3526ec){_0x93c6af=![];}_0x1ae905[_0x8350('0x2d')]({[_0x3526ec+'Pause']:_0x93c6af});});if(_0x3b4d7a){_0x1ae905[_0x8350('0x2d')]({'pauseType':_0x3b4d7a});}}else if(_0x32a1cc){_0x4bf134[_0x8350('0x30')](function(_0x5edb03){_0x1ae905[_0x8350('0x2d')]({[_0x5edb03+'Pause']:![]});});}_0x1d8c00[_0x8350('0x31')]=_[_0x8350('0x32')](_0x1d8c00[_0x8350('0x31')],{'$and':_0x1ae905});if(_0x26c757['user'][_0x8350('0x2a')]===_0x8350('0x33')){var _0x510104={'params':{'id':_0x26c757[_0x8350('0x33')][_0x8350('0x34')]},'query':{'section':_0x8350('0x35'),'role':'agent','online':!![],'raw':!![],'ids':_0x236dc4,'customSorting':_0x1b3d8a}};if(_0x3bd932){_0x510104[_0x8350('0x14')][_0x8350('0x36')]=_0x1ae905;}_0x510104[_0x8350('0x14')]=Object[_0x8350('0x37')](_0x510104[_0x8350('0x14')],_0x26c757[_0x8350('0x14')]);delete _0x510104[_0x8350('0x14')]['id'];return db['UserProfile'][_0x8350('0x38')](_0x510104);}return db[_0x8350('0x39')]['findAndCountAll'](_0x1d8c00);})[_0x8350('0x19')](function(_0x10279d){_0x3662be['count']=_0x10279d[_0x8350('0xc')];_0x35ff90=_0x10279d[_0x8350('0x24')];return _0x35ff90[_0x8350('0x3a')](function(_0x120920){var _0xbcdf0c=_[_0x8350('0x3b')](_0x27bed7,['id',_0x120920['id']]);if(_0xbcdf0c){var _0x4082f1=rta[_0x8350('0x3c')](_0xbcdf0c);_[_0x8350('0x32')](_0x120920,_0x4082f1);}_0x120920[_0x8350('0x3d')]=rta[_0x8350('0x3e')](_0x120920);if(_0x120920['globalStatus'][_0x8350('0x3f')](_0x8350('0x40'))){_0x4bf134[_0x8350('0x30')](function(_0x2b29aa){if(_0x120920[_0x2b29aa+'Pause']){if(_0x2b29aa===_0x8350('0x41')){if(_0x120920[_0x8350('0x42')]!==_0x8350('0x43')){_0x120920[_0x8350('0x42')]=_0x8350('0x40');}}else{_0x120920[_0x2b29aa+_0x8350('0x44')]=_0x8350('0x40');}}});}return _0x120920;});})[_0x8350('0x19')](function(_0x2a3520){if(!_0x31f3a5||_0x1b3d8a){return _0x2a3520;}return rta[_0x8350('0x45')](_0x2a3520,_0x31f3a5);})[_0x8350('0x19')](function(_0x2c835b){var _0x480c93=null;if(_0x26c757[_0x8350('0x14')][_0x8350('0x20')]){var _0x37dd25=_0x26c757[_0x8350('0x14')]['fields'][_0x8350('0x46')](',');_0x480c93=_0x2c835b[_0x8350('0x3a')](function(_0xd5683a){return _[_0x8350('0x47')](_0xd5683a,_0x37dd25);});}_0x3662be[_0x8350('0x24')]=_0x480c93||_0x2c835b;return _0x3662be;})[_0x8350('0x19')](respondWithFilteredResult(_0x50f04e,_0x1d8c00))[_0x8350('0x48')](APIHandleError(_0x50f04e));};exports['getQueues']=function(_0x4b1054,_0x55a097){var _0x5273ca={'count':0x0,'rows':[]};var _0x94e506={};var _0x13be1d;var _0x1b286a;var _0x20f09b;Promise[_0x8350('0x49')]()[_0x8350('0x19')](function(){if(_0x4b1054[_0x8350('0x14')][_0x8350('0x1a')]){if(!utils[_0x8350('0x1b')](_0x4b1054[_0x8350('0x14')][_0x8350('0x1a')])){throw new APIBadRequestError(util[_0x8350('0x1c')](_0x8350('0x1d'),_0x4b1054[_0x8350('0x14')][_0x8350('0x1a')]));}_0x13be1d=_0x4b1054[_0x8350('0x14')][_0x8350('0x1a')][_0x8350('0x1e')]();}var _0x43b6da=_['startCase'](_0x13be1d)+_0x8350('0x4a');var _0x38bff8=_[_0x8350('0x3a')](db[_0x43b6da][_0x8350('0x27')],function(_0x2b0bb2){return{'name':_0x2b0bb2['fieldName'],'type':_0x2b0bb2[_0x8350('0x29')][_0x8350('0x4b')]};});if(!_0x4b1054[_0x8350('0x14')][_0x8350('0x20')]){var _0x50ccf2=['id','name'];if(_0x13be1d===_0x8350('0x41')){_0x50ccf2[_0x8350('0x2d')]('type');if(_0x4b1054[_0x8350('0x14')]['type']===_0x8350('0x4c')){_0x50ccf2[_0x8350('0x2d')](['dialActive',_0x8350('0x4d')]);}}_0x4b1054[_0x8350('0x14')][_0x8350('0x20')]=_0x50ccf2[_0x8350('0x21')](',');}_0x94e506=qs[_0x8350('0x2c')](_0x38bff8,_0x4b1054);if(_0x4b1054['user'][_0x8350('0x2a')]===_0x8350('0x33')){var _0x2df9bb={'params':{'id':_0x4b1054['user'][_0x8350('0x34')]},'query':{'section':_0x13be1d===_0x8350('0x41')&&_0x4b1054[_0x8350('0x14')][_0x8350('0x29')]===_0x8350('0x4c')?_0x8350('0x4e'):_['startCase'](_0x13be1d)+'Queues','type':_0x4b1054[_0x8350('0x14')]['type'],'nolimit':!![],'sort':_0x8350('0x4f'),'filter':_0x4b1054[_0x8350('0x14')]['filter']}};_0x2df9bb[_0x8350('0x14')]=Object[_0x8350('0x37')](_0x2df9bb['query'],_0x4b1054[_0x8350('0x14')]);delete _0x2df9bb[_0x8350('0x14')]['id'];return db[_0x8350('0x50')]['getResources'](_0x2df9bb);}return db[_0x43b6da]['findAndCountAll'](_0x94e506);})['then'](function(_0x1fe6c5){_0x5273ca['count']=_0x1fe6c5[_0x8350('0xc')];_0x1b286a=_0x1fe6c5[_0x8350('0x24')];return rtq['getRealtimeQueues'](_0x4b1054,_0x13be1d);})[_0x8350('0x19')](function(_0x585c6c){_0x20f09b=_0x585c6c['rows'];return rtq[_0x8350('0x51')](_0x1b286a,_0x20f09b,_0x13be1d,_0x4b1054[_0x8350('0x14')]['type']);})[_0x8350('0x19')](function(_0x3e1c38){_0x5273ca['rows']=_0x3e1c38;return _0x5273ca;})[_0x8350('0x19')](respondWithFilteredResult(_0x55a097,_0x94e506))[_0x8350('0x48')](APIHandleError(_0x55a097));}; \ No newline at end of file +var _0xea4f=['push','FIELD(id,','order','forEach','*pause','Pause','where','merge','user','userProfileId','Agents','extraQueryConditions','assign','UserProfile','getResources','filterAgentAttributes','getAgentStatus','voice','talking','voiceStatus','sortAgentsByStatus','fields','split','catch','getQueues','isValidChannel','Queue','fieldName','name','outbound','dialActive','role','QueueCampaigns','Queues','filter','findAndCountAll','getRealtimeQueues','initializeQueues','lodash','util','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','handleError','undefined','limit','count','offset','status','set','Content-Range','getAgents','getChannels','globalQueueFilter','query','globalStatusFilter','pauseTypeFilter','pause','resolve','then','channel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','join','getAgentIdsByQueues','rows','getSortedAgentsIdsByStatus','length','map','User','rawAttributes','type','key','agent','online','getOptions','raw'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xea4f,0x7a));var _0xfea4=function(_0xef0eb1,_0x545c1d){_0xef0eb1=_0xef0eb1-0x0;var _0x5c26a4=_0xea4f[_0xef0eb1];return _0x5c26a4;};'use strict';var _=require(_0xfea4('0x0'));var util=require(_0xfea4('0x1'));var rta=require('../../components/realtime/agents');var rtq=require(_0xfea4('0x2'));var qs=require(_0xfea4('0x3'));var utils=require(_0xfea4('0x4'));var db=require(_0xfea4('0x5'))['db'];var APIBadRequestError=require('../../errors/api')['APIBadRequestError'];var APIHandleError=require('../../errors/api')[_0xfea4('0x6')];function respondWithFilteredResult(_0x56292a,_0x5518a2){return function(_0x545d11){if(_0x545d11){var _0x1ab647=typeof _0x5518a2['offset']===_0xfea4('0x7')&&typeof _0x5518a2[_0xfea4('0x8')]==='undefined';var _0x5b37a5=_0x545d11[_0xfea4('0x9')];var _0x3d490f=_0x1ab647?0x0:_0x5518a2[_0xfea4('0xa')];var _0x556a83=_0x1ab647?_0x545d11[_0xfea4('0x9')]:_0x5518a2['offset']+_0x5518a2['limit'];var _0x526a49;if(_0x556a83>=_0x5b37a5){_0x556a83=_0x5b37a5;_0x526a49=0xc8;}else{_0x526a49=0xce;}_0x56292a[_0xfea4('0xb')](_0x526a49);return _0x56292a[_0xfea4('0xc')](_0xfea4('0xd'),_0x3d490f+'-'+_0x556a83+'/'+_0x5b37a5)['json'](_0x545d11);}return null;};}exports[_0xfea4('0xe')]=function(_0x3bfc53,_0x27d0f1){var _0x384ddd={'count':0x0,'rows':[]};var _0xbd63d2={};var _0x276c92;var _0x10879a=utils[_0xfea4('0xf')]();var _0x3038f5;var _0x490932;var _0x8532c3=_0x3bfc53['query'][_0xfea4('0x10')];var _0x48c7e3=_0x3bfc53[_0xfea4('0x11')][_0xfea4('0x12')];var _0x58894d=_0x3bfc53[_0xfea4('0x11')][_0xfea4('0x13')];var _0x3b6494=_0x48c7e3===_0xfea4('0x14')||_0x48c7e3==='*pause'?!![]:![];var _0x5eacf1=[];var _0x171eb4;var _0x59ff58;Promise[_0xfea4('0x15')]()[_0xfea4('0x16')](function(){if(_0x3bfc53[_0xfea4('0x11')]['channel']){if(!utils['isValidChannel'](_0x3bfc53[_0xfea4('0x11')][_0xfea4('0x17')])){throw new APIBadRequestError(util[_0xfea4('0x18')](_0xfea4('0x19'),_0x3bfc53[_0xfea4('0x11')][_0xfea4('0x17')]));}_0x276c92=_0x3bfc53[_0xfea4('0x11')][_0xfea4('0x17')][_0xfea4('0x1a')]();}if(!_0x3bfc53[_0xfea4('0x11')]['sort']||!_0x3bfc53[_0xfea4('0x11')][_0xfea4('0x1b')][_0xfea4('0x1c')](_0xfea4('0x1d'))){_0x3bfc53[_0xfea4('0x11')][_0xfea4('0x1b')]=rta[_0xfea4('0x1e')](_0x3bfc53[_0xfea4('0x11')][_0xfea4('0x1b')]);return;}var _0x174372=rta[_0xfea4('0x1f')](_0x3bfc53[_0xfea4('0x11')][_0xfea4('0x1b')]);_0x3bfc53[_0xfea4('0x11')][_0xfea4('0x1b')]=_0x174372['fields'][_0xfea4('0x20')](',');_0x171eb4=_0x174372['order'];})[_0xfea4('0x16')](function(){if(!_0x8532c3){return[];}return rta[_0xfea4('0x21')](_0x8532c3,_0x276c92);})[_0xfea4('0x16')](function(_0x823675){_0x5eacf1=_0x823675;return rta['getRealtimeAgents']();})[_0xfea4('0x16')](function(_0x4bb16a){_0x490932=_0x4bb16a[_0xfea4('0x22')];if((!_0x48c7e3||_0x3b6494)&&!_0x171eb4){return _0x5eacf1;}if(_0x171eb4&&!_0x48c7e3){return rta[_0xfea4('0x23')](_0x490932,_0x5eacf1,_0x171eb4);}else{return rta['getAgentIdsByStatus'](_0x490932,_0x5eacf1,_0x48c7e3);}})[_0xfea4('0x16')](function(_0x4a12da){_0x5eacf1=_0x4a12da;var _0x4e8ecf=![];if(_0x5eacf1[_0xfea4('0x24')]===0x0){if(_0x8532c3||_0x48c7e3){_0x4e8ecf=!![];}if(_0x3b6494){_0x4e8ecf=![];}}if(_0x4e8ecf){return _0x384ddd;}var _0x1b51d3=_[_0xfea4('0x25')](db[_0xfea4('0x26')][_0xfea4('0x27')],function(_0x590e2a){return{'name':_0x590e2a['fieldName'],'type':_0x590e2a[_0xfea4('0x28')][_0xfea4('0x29')]};});_0x3bfc53[_0xfea4('0x11')]['role']=_0xfea4('0x2a');_0x3bfc53[_0xfea4('0x11')][_0xfea4('0x2b')]=!![];_0xbd63d2=qs[_0xfea4('0x2c')](_0x1b51d3,_0x3bfc53);_0xbd63d2[_0xfea4('0x2d')]=!![];var _0x5c7680=[];if(_0x5eacf1['length']>0x0){_0x5c7680[_0xfea4('0x2e')]({'id':{'$in':_0x5eacf1}});if(_0x171eb4&&!_0x48c7e3){_0x59ff58=[db['sequelize']['literal'](_0xfea4('0x2f')+_0x5eacf1+')')];_0xbd63d2[_0xfea4('0x30')]=_0x59ff58;}}if(_0x3b6494){_0x10879a[_0xfea4('0x31')](function(_0x4e2655){var _0x1f4a39=!![];if(_0x48c7e3===_0xfea4('0x32')&&_0x276c92!==_0x4e2655){_0x1f4a39=![];}_0x5c7680['push']({[_0x4e2655+_0xfea4('0x33')]:_0x1f4a39});});if(_0x58894d){_0x5c7680[_0xfea4('0x2e')]({'pauseType':_0x58894d});}}else if(_0x48c7e3){_0x10879a[_0xfea4('0x31')](function(_0x3851bb){_0x5c7680[_0xfea4('0x2e')]({[_0x3851bb+_0xfea4('0x33')]:![]});});}_0xbd63d2[_0xfea4('0x34')]=_[_0xfea4('0x35')](_0xbd63d2[_0xfea4('0x34')],{'$and':_0x5c7680});if(_0x3bfc53[_0xfea4('0x36')]['role']==='user'){var _0x174580={'params':{'id':_0x3bfc53[_0xfea4('0x36')][_0xfea4('0x37')]},'query':{'section':_0xfea4('0x38'),'role':'agent','online':!![],'raw':!![],'ids':_0x5eacf1,'customSorting':_0x59ff58}};if(_0x3b6494){_0x174580[_0xfea4('0x11')][_0xfea4('0x39')]=_0x5c7680;}_0x174580[_0xfea4('0x11')]=Object[_0xfea4('0x3a')](_0x174580[_0xfea4('0x11')],_0x3bfc53[_0xfea4('0x11')]);delete _0x174580['query']['id'];return db[_0xfea4('0x3b')][_0xfea4('0x3c')](_0x174580);}return db[_0xfea4('0x26')]['findAndCountAll'](_0xbd63d2);})[_0xfea4('0x16')](function(_0x6741c0){_0x384ddd[_0xfea4('0x9')]=_0x6741c0[_0xfea4('0x9')];_0x3038f5=_0x6741c0[_0xfea4('0x22')];return _0x3038f5['map'](function(_0x56c9d2){var _0x106b7c=_['find'](_0x490932,['id',_0x56c9d2['id']]);if(_0x106b7c){var _0x1cdc33=rta[_0xfea4('0x3d')](_0x106b7c);_['merge'](_0x56c9d2,_0x1cdc33);}_0x56c9d2['globalStatus']=rta[_0xfea4('0x3e')](_0x56c9d2);if(_0x56c9d2['globalStatus'][_0xfea4('0x1c')](_0xfea4('0x14'))){_0x10879a[_0xfea4('0x31')](function(_0x5a29a3){if(_0x56c9d2[_0x5a29a3+_0xfea4('0x33')]){if(_0x5a29a3===_0xfea4('0x3f')){if(_0x56c9d2['voiceStatus']!==_0xfea4('0x40')){_0x56c9d2[_0xfea4('0x41')]='pause';}}else{_0x56c9d2[_0x5a29a3+'Status']=_0xfea4('0x14');}}});}return _0x56c9d2;});})[_0xfea4('0x16')](function(_0xe633ed){if(!_0x171eb4||_0x59ff58){return _0xe633ed;}return rta[_0xfea4('0x42')](_0xe633ed,_0x171eb4);})[_0xfea4('0x16')](function(_0x38ab1a){var _0x25429c=null;if(_0x3bfc53[_0xfea4('0x11')][_0xfea4('0x43')]){var _0x100bb0=_0x3bfc53['query'][_0xfea4('0x43')][_0xfea4('0x44')](',');_0x25429c=_0x38ab1a[_0xfea4('0x25')](function(_0x208f87){return _['pick'](_0x208f87,_0x100bb0);});}_0x384ddd[_0xfea4('0x22')]=_0x25429c||_0x38ab1a;return _0x384ddd;})[_0xfea4('0x16')](respondWithFilteredResult(_0x27d0f1,_0xbd63d2))[_0xfea4('0x45')](APIHandleError(_0x27d0f1));};exports[_0xfea4('0x46')]=function(_0x16e3a0,_0x4ba8dc){var _0xd8910={'count':0x0,'rows':[]};var _0x18022e={};var _0x2e2a7f;var _0x317289;var _0x3e4e5a;Promise[_0xfea4('0x15')]()['then'](function(){if(_0x16e3a0['query']['channel']){if(!utils[_0xfea4('0x47')](_0x16e3a0[_0xfea4('0x11')][_0xfea4('0x17')])){throw new APIBadRequestError(util[_0xfea4('0x18')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x16e3a0[_0xfea4('0x11')][_0xfea4('0x17')]));}_0x2e2a7f=_0x16e3a0[_0xfea4('0x11')]['channel'][_0xfea4('0x1a')]();}var _0x4f55aa=_['startCase'](_0x2e2a7f)+_0xfea4('0x48');var _0x5336a5=_[_0xfea4('0x25')](db[_0x4f55aa][_0xfea4('0x27')],function(_0x1d5a6d){return{'name':_0x1d5a6d[_0xfea4('0x49')],'type':_0x1d5a6d['type'][_0xfea4('0x29')]};});if(!_0x16e3a0['query'][_0xfea4('0x43')]){var _0x40cbb3=['id',_0xfea4('0x4a')];if(_0x2e2a7f==='voice'){_0x40cbb3['push']('type');if(_0x16e3a0[_0xfea4('0x11')][_0xfea4('0x28')]===_0xfea4('0x4b')){_0x40cbb3[_0xfea4('0x2e')]([_0xfea4('0x4c'),'dialMethod']);}}_0x16e3a0['query'][_0xfea4('0x43')]=_0x40cbb3[_0xfea4('0x20')](',');}_0x18022e=qs[_0xfea4('0x2c')](_0x5336a5,_0x16e3a0);if(_0x16e3a0['user'][_0xfea4('0x4d')]==='user'){var _0x137d8c={'params':{'id':_0x16e3a0[_0xfea4('0x36')][_0xfea4('0x37')]},'query':{'section':_0x2e2a7f===_0xfea4('0x3f')&&_0x16e3a0[_0xfea4('0x11')][_0xfea4('0x28')]===_0xfea4('0x4b')?_0xfea4('0x4e'):_['startCase'](_0x2e2a7f)+_0xfea4('0x4f'),'type':_0x16e3a0[_0xfea4('0x11')][_0xfea4('0x28')],'nolimit':!![],'sort':_0xfea4('0x4a'),'filter':_0x16e3a0['query'][_0xfea4('0x50')]}};_0x137d8c[_0xfea4('0x11')]=Object[_0xfea4('0x3a')](_0x137d8c['query'],_0x16e3a0[_0xfea4('0x11')]);delete _0x137d8c[_0xfea4('0x11')]['id'];return db[_0xfea4('0x3b')][_0xfea4('0x3c')](_0x137d8c);}return db[_0x4f55aa][_0xfea4('0x51')](_0x18022e);})[_0xfea4('0x16')](function(_0x38ecc9){_0xd8910[_0xfea4('0x9')]=_0x38ecc9[_0xfea4('0x9')];_0x317289=_0x38ecc9[_0xfea4('0x22')];return rtq[_0xfea4('0x52')](_0x16e3a0,_0x2e2a7f);})[_0xfea4('0x16')](function(_0x27f138){_0x3e4e5a=_0x27f138[_0xfea4('0x22')];return rtq[_0xfea4('0x53')](_0x317289,_0x3e4e5a,_0x2e2a7f,_0x16e3a0[_0xfea4('0x11')]['type']);})[_0xfea4('0x16')](function(_0x43c83c){_0xd8910[_0xfea4('0x22')]=_0x43c83c;return _0xd8910;})['then'](respondWithFilteredResult(_0x4ba8dc,_0x18022e))['catch'](APIHandleError(_0x4ba8dc));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 28764fb..be4fa33 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x11df66,_0x9eabf){var _0xc2dca1=function(_0x2f8c9a){while(--_0x2f8c9a){_0x11df66['push'](_0x11df66['shift']());}};_0xc2dca1(++_0x9eabf);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x5a09e2,_0x316998){var _0x520f45=function(_0x4f5774){while(--_0x4f5774){_0x5a09e2['push'](_0x5a09e2['shift']());}};_0x520f45(++_0x316998);}(_0x70e0,0x17b));var _0x070e=function(_0x100c86,_0x2a7b56){_0x100c86=_0x100c86-0x0;var _0x46d982=_0x70e0[_0x100c86];return _0x46d982;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 6298db0..6a9a892 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 _0x39d9=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x2783a6,_0x43343f){var _0x634b4e=function(_0x54d2cb){while(--_0x54d2cb){_0x2783a6['push'](_0x2783a6['shift']());}};_0x634b4e(++_0x43343f);}(_0x39d9,0x17f));var _0x939d=function(_0x2c6ed7,_0x165312){_0x2c6ed7=_0x2c6ed7-0x0;var _0x34b3a0=_0x39d9[_0x2c6ed7];return _0x34b3a0;};'use strict';var Sequelize=require(_0x939d('0x0'));module[_0x939d('0x1')]={'state':{'type':Sequelize[_0x939d('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x939d('0x3')]},'scheduledat':{'type':Sequelize[_0x939d('0x4')]},'uniqueid':{'type':Sequelize[_0x939d('0x3')]},'starttime':{'type':Sequelize[_0x939d('0x4')]},'responsetime':{'type':Sequelize[_0x939d('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x939d('0x3')]},'campaigntype':{'type':Sequelize[_0x939d('0x3')]},'membername':{'type':Sequelize[_0x939d('0x3')]}}; \ No newline at end of file +var _0xd69e=['sequelize','exports','INTEGER','DATE','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd69e,0xa0));var _0xed69=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xd69e[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0xed69('0x0'));module[_0xed69('0x1')]={'state':{'type':Sequelize[_0xed69('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xed69('0x3')]},'uniqueid':{'type':Sequelize[_0xed69('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xed69('0x4')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 2579ec5..bd00722 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 _0xc958=['path','rimraf','./reportAgentPreview.attributes','define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x19bba9,_0x2e69e7){var _0x32dca4=function(_0x143f51){while(--_0x143f51){_0x19bba9['push'](_0x19bba9['shift']());}};_0x32dca4(++_0x2e69e7);}(_0xc958,0xde));var _0x8c95=function(_0x3d5fa9,_0x17170d){_0x3d5fa9=_0x3d5fa9-0x0;var _0x56e5a8=_0xc958[_0x3d5fa9];return _0x56e5a8;};'use strict';var _=require(_0x8c95('0x0'));var util=require(_0x8c95('0x1'));var logger=require(_0x8c95('0x2'))(_0x8c95('0x3'));var moment=require(_0x8c95('0x4'));var BPromise=require('bluebird');var rp=require(_0x8c95('0x5'));var fs=require('fs');var path=require(_0x8c95('0x6'));var rimraf=require(_0x8c95('0x7'));var config=require('../../config/environment');var attributes=require(_0x8c95('0x8'));module['exports']=function(_0x3b73ad,_0x1f4823){return _0x3b73ad[_0x8c95('0x9')](_0x8c95('0xa'),attributes,{'tableName':_0x8c95('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7acd=['lodash','util','moment','bluebird','./reportAgentPreview.attributes','exports','ReportAgentPreview','report_agent_preview'];(function(_0x9bf10f,_0x35bc96){var _0x13eeb3=function(_0x1f137b){while(--_0x1f137b){_0x9bf10f['push'](_0x9bf10f['shift']());}};_0x13eeb3(++_0x35bc96);}(_0x7acd,0x1d8));var _0xd7ac=function(_0x166790,_0x267c72){_0x166790=_0x166790-0x0;var _0x404e1e=_0x7acd[_0x166790];return _0x404e1e;};'use strict';var _=require(_0xd7ac('0x0'));var util=require(_0xd7ac('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd7ac('0x2'));var BPromise=require(_0xd7ac('0x3'));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(_0xd7ac('0x4'));module[_0xd7ac('0x5')]=function(_0x57cc49,_0x171807){return _0x57cc49['define'](_0xd7ac('0x6'),attributes,{'tableName':_0xd7ac('0x7'),'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 b4a6737..d3f63f8 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 _0xfd2f=['rpc','../../config/environment','then','info','ReportAgentPreview,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','raw','stringify','lodash','util','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x302ef6,_0x584b17){var _0x57c6a6=function(_0x4f3a75){while(--_0x4f3a75){_0x302ef6['push'](_0x302ef6['shift']());}};_0x57c6a6(++_0x584b17);}(_0xfd2f,0x14a));var _0xffd2=function(_0x511463,_0x272b54){_0x511463=_0x511463-0x0;var _0x2aaa61=_0xfd2f[_0x511463];return _0x2aaa61;};'use strict';var _=require(_0xffd2('0x0'));var util=require(_0xffd2('0x1'));var moment=require(_0xffd2('0x2'));var BPromise=require('bluebird');var rs=require(_0xffd2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xffd2('0x4'))['db'];var utils=require(_0xffd2('0x5'));var logger=require('../../config/logger')(_0xffd2('0x6'));var config=require(_0xffd2('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xd5e752,_0x2074e0,_0x56a1e2){return new BPromise(function(_0x35d327,_0x5b24ca){return client['request'](_0xd5e752,_0x56a1e2)[_0xffd2('0x8')](function(_0x15e33f){logger[_0xffd2('0x9')](_0xffd2('0xa'),_0x2074e0,'request\x20sent');logger[_0xffd2('0xb')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x2074e0,'request\x20sent',JSON['stringify'](_0x15e33f));if(_0x15e33f[_0xffd2('0xc')]){if(_0x15e33f[_0xffd2('0xc')][_0xffd2('0xd')]===0x1f4){logger[_0xffd2('0xc')](_0xffd2('0xa'),_0x2074e0,_0x15e33f[_0xffd2('0xc')][_0xffd2('0xe')]);return _0x5b24ca(_0x15e33f['error']['message']);}logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x2074e0,_0x15e33f[_0xffd2('0xc')][_0xffd2('0xe')]);return _0x35d327(_0x15e33f['error'][_0xffd2('0xe')]);}else{logger[_0xffd2('0x9')](_0xffd2('0xa'),_0x2074e0,_0xffd2('0xf'));_0x35d327(_0x15e33f[_0xffd2('0x10')][_0xffd2('0xe')]);}})[_0xffd2('0x11')](function(_0x132d38){logger[_0xffd2('0xc')]('ReportAgentPreview,\x20%s,\x20%s',_0x2074e0,_0x132d38);_0x5b24ca(_0x132d38);});});}exports[_0xffd2('0x12')]=function(_0x1f3c23){var _0x214737=this;return new Promise(function(_0x53f6e6,_0x2b2f71){return db[_0xffd2('0x13')][_0xffd2('0x14')](_0x1f3c23[_0xffd2('0x15')],{'raw':_0x1f3c23['options']?_0x1f3c23['options'][_0xffd2('0x16')]===undefined?!![]:![]:!![]})[_0xffd2('0x8')](function(_0x40a88c){logger['info'](_0xffd2('0x12'),_0x1f3c23);logger['debug'](_0xffd2('0x12'),_0x1f3c23,JSON[_0xffd2('0x17')](_0x40a88c));_0x53f6e6(_0x40a88c);})['catch'](function(_0x3ed47f){logger[_0xffd2('0xc')](_0xffd2('0x12'),_0x3ed47f[_0xffd2('0xe')],_0x1f3c23);_0x2b2f71(_0x214737[_0xffd2('0xc')](0x1f4,_0x3ed47f[_0xffd2('0xe')]));});});}; \ No newline at end of file +var _0xfebb=['raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','body','options'];(function(_0x4a9b4c,_0x304b67){var _0x2a9402=function(_0x51a227){while(--_0x51a227){_0x4a9b4c['push'](_0x4a9b4c['shift']());}};_0x2a9402(++_0x304b67);}(_0xfebb,0xf1));var _0xbfeb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfebb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbfeb('0x0'));var util=require(_0xbfeb('0x1'));var moment=require(_0xbfeb('0x2'));var BPromise=require(_0xbfeb('0x3'));var rs=require(_0xbfeb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbfeb('0x5'))['db'];var utils=require(_0xbfeb('0x6'));var logger=require('../../config/logger')(_0xbfeb('0x7'));var config=require(_0xbfeb('0x8'));var jayson=require(_0xbfeb('0x9'));var client=jayson[_0xbfeb('0xa')][_0xbfeb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa366b5,_0xf055d4,_0x3da896){return new BPromise(function(_0x4e774a,_0x33ecef){return client[_0xbfeb('0xc')](_0xa366b5,_0x3da896)[_0xbfeb('0xd')](function(_0x34e24a){logger[_0xbfeb('0xe')](_0xbfeb('0xf'),_0xf055d4,_0xbfeb('0x10'));logger[_0xbfeb('0x11')](_0xbfeb('0x12'),_0xf055d4,_0xbfeb('0x10'),JSON[_0xbfeb('0x13')](_0x34e24a));if(_0x34e24a[_0xbfeb('0x14')]){if(_0x34e24a[_0xbfeb('0x14')][_0xbfeb('0x15')]===0x1f4){logger[_0xbfeb('0x14')](_0xbfeb('0xf'),_0xf055d4,_0x34e24a[_0xbfeb('0x14')]['message']);return _0x33ecef(_0x34e24a[_0xbfeb('0x14')][_0xbfeb('0x16')]);}logger[_0xbfeb('0x14')](_0xbfeb('0xf'),_0xf055d4,_0x34e24a[_0xbfeb('0x14')][_0xbfeb('0x16')]);return _0x4e774a(_0x34e24a[_0xbfeb('0x14')][_0xbfeb('0x16')]);}else{logger[_0xbfeb('0xe')](_0xbfeb('0xf'),_0xf055d4,'request\x20sent');_0x4e774a(_0x34e24a[_0xbfeb('0x17')][_0xbfeb('0x16')]);}})[_0xbfeb('0x18')](function(_0xfca601){logger[_0xbfeb('0x14')]('ReportAgentPreview,\x20%s,\x20%s',_0xf055d4,_0xfca601);_0x33ecef(_0xfca601);});});}exports[_0xbfeb('0x19')]=function(_0x14b469){var _0x48f1c3=this;return new Promise(function(_0x264518,_0x3047db){return db[_0xbfeb('0x1a')]['create'](_0x14b469[_0xbfeb('0x1b')],{'raw':_0x14b469[_0xbfeb('0x1c')]?_0x14b469[_0xbfeb('0x1c')][_0xbfeb('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x20fbfe){logger[_0xbfeb('0xe')](_0xbfeb('0x19'),_0x14b469);logger[_0xbfeb('0x11')](_0xbfeb('0x19'),_0x14b469,JSON[_0xbfeb('0x13')](_0x20fbfe));_0x264518(_0x20fbfe);})[_0xbfeb('0x18')](function(_0x582907){logger['error']('CreateReportAgentPreview',_0x582907[_0xbfeb('0x16')],_0x14b469);_0x3047db(_0x48f1c3['error'](0x1f4,_0x582907[_0xbfeb('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 9104d66..c07d836 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 _0xc109=['agentNotify','exports','multer','util','path','express','Router','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','chatQueues','/mail/queues','/mail/accounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelRedirect','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','put','agentCapacity','/telephones','telephones','/trunks','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','fax','/fax/queues/:id','openchannel','/openchannel/queues/:id','showOpenchannelQueues','post','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc109,0xf2));var _0x9c10=function(_0x4c29f9,_0x5bddd4){_0x4c29f9=_0x4c29f9-0x0;var _0x4e17b8=_0xc109[_0x4c29f9];return _0x4e17b8;};'use strict';var multer=require(_0x9c10('0x0'));var util=require(_0x9c10('0x1'));var path=require(_0x9c10('0x2'));var express=require(_0x9c10('0x3'));var router=express[_0x9c10('0x4')]();var auth=require('../../components/auth/service');var controller=require(_0x9c10('0x5'));router[_0x9c10('0x6')](_0x9c10('0x7'),auth[_0x9c10('0x8')](),controller[_0x9c10('0x9')]);router['get'](_0x9c10('0xa'),auth[_0x9c10('0x8')](),controller[_0x9c10('0xb')]);router['get'](_0x9c10('0xc'),auth[_0x9c10('0x8')](),controller[_0x9c10('0xd')]);router[_0x9c10('0x6')](_0x9c10('0xe'),auth[_0x9c10('0x8')](),controller[_0x9c10('0xf')]);router[_0x9c10('0x6')]('/chat/queues',auth[_0x9c10('0x8')](),controller[_0x9c10('0x10')]);router['get'](_0x9c10('0x11'),auth[_0x9c10('0x8')](),controller['mailQueues']);router[_0x9c10('0x6')](_0x9c10('0x12'),auth[_0x9c10('0x8')](),controller['mailAccounts']);router[_0x9c10('0x6')](_0x9c10('0x13'),auth[_0x9c10('0x8')](),controller[_0x9c10('0x14')]);router[_0x9c10('0x6')](_0x9c10('0x15'),auth[_0x9c10('0x8')](),controller[_0x9c10('0x16')]);router[_0x9c10('0x6')](_0x9c10('0x17'),auth['isAuthenticated'](),controller[_0x9c10('0x18')]);router['get'](_0x9c10('0x19'),auth[_0x9c10('0x8')](),controller[_0x9c10('0x1a')]);router[_0x9c10('0x6')](_0x9c10('0x1b'),auth[_0x9c10('0x8')](),controller['voiceQueuesPreview']);router[_0x9c10('0x6')](_0x9c10('0x1c'),auth[_0x9c10('0x8')](),controller[_0x9c10('0x1d')]);router[_0x9c10('0x6')](_0x9c10('0x1e'),auth[_0x9c10('0x8')](),controller[_0x9c10('0x1f')]);router[_0x9c10('0x6')]('/voice/queues/channels/:uniqueid/hangup',auth[_0x9c10('0x8')](),controller['voiceQueuesChannelHangup']);router[_0x9c10('0x6')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x9c10('0x8')](),controller[_0x9c10('0x20')]);router[_0x9c10('0x6')](_0x9c10('0x21'),auth[_0x9c10('0x8')](),controller['showVoiceQueues']);router['put']('/voice/queues/:id',auth[_0x9c10('0x8')](),controller[_0x9c10('0x22')]);router['get'](_0x9c10('0x23'),auth['isAuthenticated'](),controller[_0x9c10('0x24')]);router[_0x9c10('0x6')](_0x9c10('0x25'),auth['isAuthenticated'](),controller[_0x9c10('0x26')]);router['get'](_0x9c10('0x27'),auth[_0x9c10('0x8')](),controller['agents']);router[_0x9c10('0x28')]('/agents/:id/capacity',auth[_0x9c10('0x8')](),controller[_0x9c10('0x29')]);router[_0x9c10('0x6')](_0x9c10('0x2a'),auth[_0x9c10('0x8')](),controller[_0x9c10('0x2b')]);router[_0x9c10('0x6')](_0x9c10('0x2c'),auth[_0x9c10('0x8')](),controller['trunks']);router[_0x9c10('0x6')]('/campaigns',auth[_0x9c10('0x8')](),controller[_0x9c10('0x2d')]);router[_0x9c10('0x6')](_0x9c10('0x2e'),auth[_0x9c10('0x8')](),controller[_0x9c10('0x2f')]);router['get'](_0x9c10('0x30'),auth[_0x9c10('0x8')](),controller['chatQueuesWaitingInteractions']);router[_0x9c10('0x6')](_0x9c10('0x31'),auth['isAuthenticated'](),controller[_0x9c10('0x32')]);router['get'](_0x9c10('0x33'),auth[_0x9c10('0x8')](),controller['openchannelQueuesWaitingInteractions']);router[_0x9c10('0x6')]('/openchannel/queues/:id/waitinginteractions',auth['isAuthenticated'](),controller[_0x9c10('0x34')]);router['get'](_0x9c10('0x35'),auth[_0x9c10('0x8')](),controller['smsQueuesWaitingInteractions']);router[_0x9c10('0x6')]('/whatsapp/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x9c10('0x36')]);router[_0x9c10('0x6')]('/fax/queues/waitinginteractions',auth[_0x9c10('0x8')](),controller[_0x9c10('0x37')]);router['post'](_0x9c10('0x38'),auth[_0x9c10('0x8')](),controller[_0x9c10('0x39')](_0x9c10('0x3a')));router['get'](_0x9c10('0x3b'),auth['isAuthenticated'](),controller[_0x9c10('0x3c')]);router['post'](_0x9c10('0x3d'),auth[_0x9c10('0x8')](),controller[_0x9c10('0x39')](_0x9c10('0x3e')));router[_0x9c10('0x6')](_0x9c10('0x3f'),auth['isAuthenticated'](),controller[_0x9c10('0x40')]);router['post']('/fax/queues/:id/notify',auth['isAuthenticated'](),controller[_0x9c10('0x39')](_0x9c10('0x41')));router[_0x9c10('0x6')](_0x9c10('0x42'),auth[_0x9c10('0x8')](),controller['showFaxQueues']);router['post']('/openchannel/queues/:id/notify',auth[_0x9c10('0x8')](),controller[_0x9c10('0x39')](_0x9c10('0x43')));router[_0x9c10('0x6')](_0x9c10('0x44'),auth['isAuthenticated'](),controller[_0x9c10('0x45')]);router[_0x9c10('0x46')](_0x9c10('0x47'),auth[_0x9c10('0x8')](),controller['queueNotify'](_0x9c10('0x48')));router['post'](_0x9c10('0x49'),auth[_0x9c10('0x8')](),controller[_0x9c10('0x39')](_0x9c10('0x4a')));router[_0x9c10('0x6')]('/sms/queues/:id',auth[_0x9c10('0x8')](),controller[_0x9c10('0x4b')]);router[_0x9c10('0x6')](_0x9c10('0x4c'),auth[_0x9c10('0x8')](),controller['showWhatsappQueues']);router[_0x9c10('0x46')](_0x9c10('0x4d'),auth['isAuthenticated'](),controller[_0x9c10('0x4e')]);module[_0x9c10('0x4f')]=router; \ No newline at end of file +var _0x76cb=['voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','/outbound','/outbound/channels','agents','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','post','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','showWhatsappQueues','agentNotify','exports','multer','util','path','express','../../components/auth/service','./rpc.controller','voiceChannels','get','isAuthenticated','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','chatQueues','/mail/queues','mailQueues','/mail/accounts','openchannelQueues','/sms/queues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','voiceQueuesPreview','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten'];(function(_0x20c3d5,_0x3c84f4){var _0x2b1677=function(_0x10aa53){while(--_0x10aa53){_0x20c3d5['push'](_0x20c3d5['shift']());}};_0x2b1677(++_0x3c84f4);}(_0x76cb,0x1e4));var _0xb76c=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0x76cb[_0x5a95fa];return _0x1a61b8;};'use strict';var multer=require(_0xb76c('0x0'));var util=require(_0xb76c('0x1'));var path=require(_0xb76c('0x2'));var express=require(_0xb76c('0x3'));var router=express['Router']();var auth=require(_0xb76c('0x4'));var controller=require(_0xb76c('0x5'));router['get']('/voice/channels',auth['isAuthenticated'](),controller[_0xb76c('0x6')]);router[_0xb76c('0x7')]('/voice/channels/:uniqueid/mixmonitor',auth[_0xb76c('0x8')](),controller[_0xb76c('0x9')]);router[_0xb76c('0x7')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0xb76c('0x8')](),controller[_0xb76c('0xa')]);router[_0xb76c('0x7')](_0xb76c('0xb'),auth[_0xb76c('0x8')](),controller[_0xb76c('0xc')]);router['get']('/chat/queues',auth[_0xb76c('0x8')](),controller[_0xb76c('0xd')]);router[_0xb76c('0x7')](_0xb76c('0xe'),auth[_0xb76c('0x8')](),controller[_0xb76c('0xf')]);router[_0xb76c('0x7')](_0xb76c('0x10'),auth[_0xb76c('0x8')](),controller['mailAccounts']);router['get']('/openchannel/queues',auth[_0xb76c('0x8')](),controller[_0xb76c('0x11')]);router[_0xb76c('0x7')](_0xb76c('0x12'),auth[_0xb76c('0x8')](),controller['smsQueues']);router['get'](_0xb76c('0x13'),auth[_0xb76c('0x8')](),controller[_0xb76c('0x14')]);router[_0xb76c('0x7')](_0xb76c('0x15'),auth[_0xb76c('0x8')](),controller[_0xb76c('0x16')]);router[_0xb76c('0x7')]('/voice/queues/preview/:id',auth[_0xb76c('0x8')](),controller[_0xb76c('0x17')]);router['get']('/voice/queues/channels',auth[_0xb76c('0x8')](),controller['voiceQueuesChannels']);router[_0xb76c('0x7')]('/voice/queues/channels/:uniqueid',auth[_0xb76c('0x8')](),controller[_0xb76c('0x18')]);router[_0xb76c('0x7')]('/voice/queues/channels/:uniqueid/hangup',auth[_0xb76c('0x8')](),controller[_0xb76c('0x19')]);router[_0xb76c('0x7')](_0xb76c('0x1a'),auth[_0xb76c('0x8')](),controller[_0xb76c('0x1b')]);router[_0xb76c('0x7')](_0xb76c('0x1c'),auth[_0xb76c('0x8')](),controller[_0xb76c('0x1d')]);router[_0xb76c('0x1e')]('/voice/queues/:id',auth[_0xb76c('0x8')](),controller['updateVoiceQueue']);router[_0xb76c('0x7')](_0xb76c('0x1f'),auth[_0xb76c('0x8')](),controller['outbound']);router[_0xb76c('0x7')](_0xb76c('0x20'),auth[_0xb76c('0x8')](),controller['outboundChannels']);router[_0xb76c('0x7')]('/agents',auth[_0xb76c('0x8')](),controller[_0xb76c('0x21')]);router[_0xb76c('0x1e')]('/agents/:id/capacity',auth['isAuthenticated'](),controller['agentCapacity']);router[_0xb76c('0x7')](_0xb76c('0x22'),auth[_0xb76c('0x8')](),controller[_0xb76c('0x23')]);router['get'](_0xb76c('0x24'),auth['isAuthenticated'](),controller[_0xb76c('0x25')]);router['get'](_0xb76c('0x26'),auth[_0xb76c('0x8')](),controller[_0xb76c('0x27')]);router[_0xb76c('0x7')](_0xb76c('0x28'),auth[_0xb76c('0x8')](),controller[_0xb76c('0x29')]);router[_0xb76c('0x7')](_0xb76c('0x2a'),auth[_0xb76c('0x8')](),controller['chatQueuesWaitingInteractions']);router[_0xb76c('0x7')]('/mail/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xb76c('0x2b')]);router['get'](_0xb76c('0x2c'),auth[_0xb76c('0x8')](),controller[_0xb76c('0x2d')]);router[_0xb76c('0x7')](_0xb76c('0x2e'),auth[_0xb76c('0x8')](),controller[_0xb76c('0x2f')]);router[_0xb76c('0x7')]('/sms/queues/waitinginteractions',auth[_0xb76c('0x8')](),controller['smsQueuesWaitingInteractions']);router['get'](_0xb76c('0x30'),auth[_0xb76c('0x8')](),controller[_0xb76c('0x31')]);router[_0xb76c('0x7')](_0xb76c('0x32'),auth[_0xb76c('0x8')](),controller['faxQueuesWaitingInteractions']);router['post'](_0xb76c('0x33'),auth[_0xb76c('0x8')](),controller[_0xb76c('0x34')](_0xb76c('0x35')));router[_0xb76c('0x7')](_0xb76c('0x36'),auth[_0xb76c('0x8')](),controller[_0xb76c('0x37')]);router['post'](_0xb76c('0x38'),auth[_0xb76c('0x8')](),controller['queueNotify'](_0xb76c('0x39')));router['get'](_0xb76c('0x3a'),auth[_0xb76c('0x8')](),controller[_0xb76c('0x3b')]);router[_0xb76c('0x3c')]('/fax/queues/:id/notify',auth['isAuthenticated'](),controller[_0xb76c('0x34')](_0xb76c('0x3d')));router['get'](_0xb76c('0x3e'),auth[_0xb76c('0x8')](),controller[_0xb76c('0x3f')]);router[_0xb76c('0x3c')]('/openchannel/queues/:id/notify',auth['isAuthenticated'](),controller[_0xb76c('0x34')]('openchannel'));router['get'](_0xb76c('0x40'),auth[_0xb76c('0x8')](),controller['showOpenchannelQueues']);router['post']('/sms/queues/:id/notify',auth[_0xb76c('0x8')](),controller[_0xb76c('0x34')](_0xb76c('0x41')));router['post'](_0xb76c('0x42'),auth[_0xb76c('0x8')](),controller[_0xb76c('0x34')](_0xb76c('0x43')));router[_0xb76c('0x7')](_0xb76c('0x44'),auth[_0xb76c('0x8')](),controller[_0xb76c('0x45')]);router[_0xb76c('0x7')]('/whatsapp/queues/:id',auth[_0xb76c('0x8')](),controller[_0xb76c('0x46')]);router[_0xb76c('0x3c')]('/agents/:id/notify',auth[_0xb76c('0x8')](),controller[_0xb76c('0x47')]);module[_0xb76c('0x48')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 808c694..3991977 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 _0x4e92=['rows','find','voiceChannels','query','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','OutboundChannels','agents','Agents','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity','Telephones','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','faxQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','Website','Account','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','Agent\x20not\x20found','messageId','bluebird','moment','lodash','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','error','message','result','status','json','sendStatus','stack','name','send','isNil'];(function(_0x1138da,_0x8cadf4){var _0x19eeeb=function(_0x427def){while(--_0x427def){_0x1138da['push'](_0x1138da['shift']());}};_0x19eeeb(++_0x8cadf4);}(_0x4e92,0xf8));var _0x24e9=function(_0x867b0a,_0x587ccf){_0x867b0a=_0x867b0a-0x0;var _0x137438=_0x4e92[_0x867b0a];return _0x137438;};'use strict';var BPromise=require(_0x24e9('0x0'));var moment=require(_0x24e9('0x1'));var _=require(_0x24e9('0x2'));var util=require('util');var db=require(_0x24e9('0x3'))['db'];var logger=require(_0x24e9('0x4'))('api');var jayson=require(_0x24e9('0x5'));var amiClient=jayson[_0x24e9('0x6')]['http']({'port':0x232a});var mailClient=jayson[_0x24e9('0x6')][_0x24e9('0x7')]({'port':0x232b});var routingClient=jayson[_0x24e9('0x6')]['http']({'port':0x232c});function respondWithRpcPromise(_0x136a16,_0x1e4c43,_0x1f8b01){return new BPromise(function(_0x33e58a,_0xa5a733){var _0x27b11d=_0x1f8b01?_0x1f8b01:amiClient;return _0x27b11d[_0x24e9('0x8')](_0x136a16,_0x1e4c43)[_0x24e9('0x9')](function(_0x212dca){if(_0x212dca[_0x24e9('0xa')]){if(_0x212dca[_0x24e9('0xa')]['code']===0x1f4){return _0xa5a733(_0x212dca[_0x24e9('0xa')][_0x24e9('0xb')]);}return _0x33e58a(_0x212dca['error'][_0x24e9('0xb')]);}else{_0x33e58a(_0x212dca[_0x24e9('0xc')]);}})['catch'](function(_0x4ac924){_0xa5a733(_0x4ac924);});});}function respondWithResult(_0x36ae4f,_0x1fe634){_0x1fe634=_0x1fe634||0xc8;return function(_0x43f504){if(_0x43f504){return _0x36ae4f[_0x24e9('0xd')](_0x1fe634)[_0x24e9('0xe')](_0x43f504);}return _0x36ae4f[_0x24e9('0xf')](0x194);};}function handleError(_0x50c25f,_0x3fe4a4){_0x3fe4a4=_0x3fe4a4||0x1f4;return function(_0x4c11f4){logger[_0x24e9('0xa')](_0x4c11f4[_0x24e9('0x10')]);if(_0x4c11f4[_0x24e9('0x11')]){delete _0x4c11f4[_0x24e9('0x11')];}_0x50c25f[_0x24e9('0xd')](_0x3fe4a4)[_0x24e9('0x12')](_0x4c11f4);};}function findById(_0x38f5da){return function(_0x3eb14a){if(!_[_0x24e9('0x13')](_0x38f5da)&&!_[_0x24e9('0x13')](_0x3eb14a)&&!_[_0x24e9('0x13')](_0x3eb14a[_0x24e9('0x14')])){return _[_0x24e9('0x15')](_0x3eb14a[_0x24e9('0x14')],function(_0x588a37){return _0x588a37['id']==_0x38f5da;});}return null;};}exports[_0x24e9('0x16')]=function(_0xf29c49,_0x97c4d6){return respondWithRpcPromise('VoiceChannels',_0xf29c49[_0x24e9('0x17')])[_0x24e9('0x9')](respondWithResult(_0x97c4d6,null))[_0x24e9('0x18')](handleError(_0x97c4d6,null));};exports[_0x24e9('0x19')]=function(_0x514431,_0x289d1d){return respondWithRpcPromise(_0x24e9('0x1a'),_[_0x24e9('0x1b')](_0x514431[_0x24e9('0x17')],_0x514431[_0x24e9('0x1c')]))[_0x24e9('0x9')](respondWithResult(_0x289d1d,null))[_0x24e9('0x18')](handleError(_0x289d1d,null));};exports[_0x24e9('0x1d')]=function(_0x363101,_0x3408bd){return respondWithRpcPromise(_0x24e9('0x1e'),_[_0x24e9('0x1b')](_0x363101[_0x24e9('0x17')],_0x363101[_0x24e9('0x1c')]))[_0x24e9('0x9')](respondWithResult(_0x3408bd,null))[_0x24e9('0x18')](handleError(_0x3408bd,null));};exports[_0x24e9('0x1f')]=function(_0x51f65b,_0x328303){return respondWithRpcPromise(_0x24e9('0x20'),_0x51f65b['query'])[_0x24e9('0x9')](respondWithResult(_0x328303,null))['catch'](handleError(_0x328303,null));};exports[_0x24e9('0x21')]=function(_0x58d69e,_0x1f8c4d){return respondWithRpcPromise(_0x24e9('0x20'),_0x58d69e[_0x24e9('0x17')])[_0x24e9('0x9')](findById(_0x58d69e['params']['id']))[_0x24e9('0x9')](respondWithResult(_0x1f8c4d,null))[_0x24e9('0x18')](handleError(_0x1f8c4d,null));};exports[_0x24e9('0x22')]=function(_0x140052,_0x177c4f){return respondWithRpcPromise(_0x24e9('0x23'),_['merge'](_0x140052[_0x24e9('0x24')],_0x140052[_0x24e9('0x1c')]))['then'](respondWithResult(_0x177c4f,null))[_0x24e9('0x18')](handleError(_0x177c4f,null));};exports['voiceQueuesPreview']=function(_0x3f8466,_0x39f5c1){return respondWithRpcPromise(_0x24e9('0x25'),_[_0x24e9('0x1b')](_0x3f8466[_0x24e9('0x17')],_0x3f8466[_0x24e9('0x1c')]))['then'](respondWithResult(_0x39f5c1,null))[_0x24e9('0x18')](handleError(_0x39f5c1,null));};exports['voiceQueuesChannels']=function(_0x4b282b,_0x2bac0b){return respondWithRpcPromise(_0x24e9('0x26'),_0x4b282b[_0x24e9('0x17')])[_0x24e9('0x9')](respondWithResult(_0x2bac0b,null))['catch'](handleError(_0x2bac0b,null));};exports[_0x24e9('0x27')]=function(_0x342384,_0x274ed7){return respondWithRpcPromise(_0x24e9('0x28'),_[_0x24e9('0x1b')](_0x342384[_0x24e9('0x17')],_0x342384[_0x24e9('0x1c')]))['then'](respondWithResult(_0x274ed7,null))[_0x24e9('0x18')](handleError(_0x274ed7,null));};exports[_0x24e9('0x29')]=function(_0x5361d4,_0x4f6bbb){return respondWithRpcPromise(_0x24e9('0x2a'),_[_0x24e9('0x1b')](_0x5361d4[_0x24e9('0x17')],_0x5361d4['params']))[_0x24e9('0x9')](respondWithResult(_0x4f6bbb,null))[_0x24e9('0x18')](handleError(_0x4f6bbb,null));};exports[_0x24e9('0x2b')]=function(_0x349610,_0x214377){return respondWithRpcPromise(_0x24e9('0x2c'),_[_0x24e9('0x1b')](_0x349610['query'],_0x349610[_0x24e9('0x1c')]))[_0x24e9('0x9')](respondWithResult(_0x214377,null))[_0x24e9('0x18')](handleError(_0x214377,null));};exports[_0x24e9('0x2d')]=function(_0x4a9eee,_0x52c081){return respondWithRpcPromise('Outbound',_0x4a9eee[_0x24e9('0x17')])[_0x24e9('0x9')](respondWithResult(_0x52c081,null))['catch'](handleError(_0x52c081,null));};exports['outboundChannels']=function(_0x5e5888,_0x1602b9){return respondWithRpcPromise(_0x24e9('0x2e'),_0x5e5888[_0x24e9('0x17')])[_0x24e9('0x9')](respondWithResult(_0x1602b9,null))['catch'](handleError(_0x1602b9,null));};exports[_0x24e9('0x2f')]=function(_0x2cef40,_0x4f5308){var _0x5de709;return respondWithRpcPromise(_0x24e9('0x30'),_0x2cef40[_0x24e9('0x17')])[_0x24e9('0x9')](function(_0x15a11e){_0x5de709=_0x15a11e;return respondWithRpcPromise(_0x24e9('0x30'),_0x2cef40[_0x24e9('0x17')],routingClient);})[_0x24e9('0x9')](function(_0x35c541){return _[_0x24e9('0x1b')]({},_0x35c541,_0x5de709);})[_0x24e9('0x9')](respondWithResult(_0x4f5308,null))[_0x24e9('0x18')](handleError(_0x4f5308,null));};exports['agentCapacity']=function(_0x43523f,_0x58f9aa){if(_0x43523f[_0x24e9('0x24')]&&_0x43523f[_0x24e9('0x24')][_0x24e9('0x31')]&&_0x43523f[_0x24e9('0x32')]&&_0x43523f[_0x24e9('0x32')][_0x24e9('0x11')]){for(var _0x29c88f in _0x43523f['body'][_0x24e9('0x31')]){if(_0x43523f['body'][_0x24e9('0x31')][_0x24e9('0x33')](_0x29c88f)){db[_0x24e9('0x34')][_0x24e9('0x35')]({'where':{'channel':_0x29c88f,'membername':_0x43523f[_0x24e9('0x32')][_0x24e9('0x11')],'type':_0x24e9('0x36'),'exitAt':null,'uniqueid':_0x43523f[_0x24e9('0x24')][_0x24e9('0x31')][_0x29c88f]&&_0x43523f['body']['interaction'][_0x29c88f][_0x24e9('0x37')]?{'$notIn':_0x43523f[_0x24e9('0x24')][_0x24e9('0x31')][_0x29c88f]}:{'$ne':null}}})['then'](function(_0x41349b){var _0x23e8ad=moment()[_0x24e9('0x38')](_0x24e9('0x39'));for(var _0x169373=0x0,_0x301684=_0x41349b[_0x24e9('0x37')];_0x169373<_0x301684;_0x169373+=0x1){_0x41349b[_0x169373][_0x24e9('0x3a')]({'exitAt':_0x23e8ad});}});for(var _0x2c3b61=0x0;_0x2c3b61<_0x43523f['body'][_0x24e9('0x31')][_0x29c88f][_0x24e9('0x37')];_0x2c3b61+=0x1){db[_0x24e9('0x34')][_0x24e9('0x3b')]({'where':{'channel':_0x29c88f,'membername':_0x43523f[_0x24e9('0x32')][_0x24e9('0x11')],'type':_0x24e9('0x36'),'uniqueid':_0x43523f['body'][_0x24e9('0x31')][_0x29c88f][_0x2c3b61],'exitAt':null},'defaults':{'channel':_0x29c88f,'membername':_0x43523f[_0x24e9('0x32')][_0x24e9('0x11')],'interface':_[_0x24e9('0x13')](_0x43523f['user'][_0x24e9('0x3c')])?util[_0x24e9('0x38')](_0x24e9('0x3d'),_0x43523f[_0x24e9('0x32')][_0x24e9('0x11')]):_0x43523f[_0x24e9('0x32')][_0x24e9('0x3c')],'type':_0x24e9('0x36'),'enterAt':moment()[_0x24e9('0x38')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x24e9('0x3e'),'internal':_0x43523f[_0x24e9('0x32')][_0x24e9('0x3f')],'uniqueid':_0x43523f[_0x24e9('0x24')][_0x24e9('0x31')][_0x29c88f][_0x2c3b61]}});}}}}return respondWithRpcPromise(_0x24e9('0x40'),{'id':_0x43523f['params']['id'],'capacity':_0x43523f['body'][_0x24e9('0x41')]},routingClient)[_0x24e9('0x9')](respondWithResult(_0x58f9aa,null))[_0x24e9('0x18')](handleError(_0x58f9aa,null));};exports['telephones']=function(_0x20028d,_0x344285){return respondWithRpcPromise(_0x24e9('0x42'),_0x20028d[_0x24e9('0x17')])[_0x24e9('0x9')](respondWithResult(_0x344285,null))[_0x24e9('0x18')](handleError(_0x344285,null));};exports['trunks']=function(_0x3541c4,_0x19ff52){return respondWithRpcPromise(_0x24e9('0x43'),_0x3541c4[_0x24e9('0x17')])[_0x24e9('0x9')](respondWithResult(_0x19ff52,null))[_0x24e9('0x18')](handleError(_0x19ff52,null));};exports[_0x24e9('0x44')]=function(_0x4fc567,_0x3cdc15){return respondWithRpcPromise(_0x24e9('0x45'),_0x4fc567['query'])['then'](respondWithResult(_0x3cdc15,null))[_0x24e9('0x18')](handleError(_0x3cdc15,null));};exports[_0x24e9('0x46')]=function(_0x102d74,_0x1bba05){return respondWithRpcPromise(_0x24e9('0x47'),_0x102d74[_0x24e9('0x17')],routingClient)['then'](respondWithResult(_0x1bba05,null))[_0x24e9('0x18')](handleError(_0x1bba05,null));};exports[_0x24e9('0x48')]=function(_0x3a5340,_0x10e67f){return respondWithRpcPromise(_0x24e9('0x47'),_0x3a5340[_0x24e9('0x17')],routingClient)['then'](findById(_0x3a5340[_0x24e9('0x1c')]['id']))[_0x24e9('0x9')](respondWithResult(_0x10e67f,null))['catch'](handleError(_0x10e67f,null));};exports['mailQueues']=function(_0x5156ef,_0x20d5ce){return respondWithRpcPromise(_0x24e9('0x49'),_0x5156ef[_0x24e9('0x17')],routingClient)[_0x24e9('0x9')](respondWithResult(_0x20d5ce,null))[_0x24e9('0x18')](handleError(_0x20d5ce,null));};exports[_0x24e9('0x4a')]=function(_0x5dd301,_0x23cb17){return respondWithRpcPromise(_0x24e9('0x49'),_0x5dd301[_0x24e9('0x17')],routingClient)[_0x24e9('0x9')](findById(_0x5dd301[_0x24e9('0x1c')]['id']))[_0x24e9('0x9')](respondWithResult(_0x23cb17,null))[_0x24e9('0x18')](handleError(_0x23cb17,null));};exports[_0x24e9('0x4b')]=function(_0x17037d,_0x30ad04){return respondWithRpcPromise('MailAccounts',_0x17037d[_0x24e9('0x17')],mailClient)[_0x24e9('0x9')](respondWithResult(_0x30ad04,null))[_0x24e9('0x18')](handleError(_0x30ad04,null));};exports[_0x24e9('0x4c')]=function(_0x403d49,_0x33ea6c){return respondWithRpcPromise(_0x24e9('0x4d'),_0x403d49[_0x24e9('0x17')],routingClient)['then'](respondWithResult(_0x33ea6c,null))['catch'](handleError(_0x33ea6c,null));};exports[_0x24e9('0x4e')]=function(_0x1d9f94,_0x21a487){return respondWithRpcPromise(_0x24e9('0x4d'),_0x1d9f94[_0x24e9('0x17')],routingClient)[_0x24e9('0x9')](findById(_0x1d9f94[_0x24e9('0x1c')]['id']))['then'](respondWithResult(_0x21a487,null))[_0x24e9('0x18')](handleError(_0x21a487,null));};exports[_0x24e9('0x4f')]=function(_0x2e073e,_0x2f4ca7){return respondWithRpcPromise(_0x24e9('0x50'),_0x2e073e['query'],routingClient)['then'](respondWithResult(_0x2f4ca7,null))[_0x24e9('0x18')](handleError(_0x2f4ca7,null));};exports[_0x24e9('0x51')]=function(_0x5ccca4,_0x4931c7){return respondWithRpcPromise(_0x24e9('0x50'),_0x5ccca4['query'],routingClient)[_0x24e9('0x9')](findById(_0x5ccca4[_0x24e9('0x1c')]['id']))[_0x24e9('0x9')](respondWithResult(_0x4931c7,null))[_0x24e9('0x18')](handleError(_0x4931c7,null));};exports[_0x24e9('0x52')]=function(_0x25c56b,_0x3dd2ce){return respondWithRpcPromise('WhatsappQueues',_0x25c56b[_0x24e9('0x17')],routingClient)[_0x24e9('0x9')](respondWithResult(_0x3dd2ce,null))[_0x24e9('0x18')](handleError(_0x3dd2ce,null));};exports[_0x24e9('0x53')]=function(_0x11548d,_0x5a515b){return respondWithRpcPromise(_0x24e9('0x54'),_0x11548d['query'],routingClient)[_0x24e9('0x9')](findById(_0x11548d[_0x24e9('0x1c')]['id']))[_0x24e9('0x9')](respondWithResult(_0x5a515b,null))['catch'](handleError(_0x5a515b,null));};exports[_0x24e9('0x55')]=function(_0x391f49,_0x3477bb){return respondWithRpcPromise(_0x24e9('0x56'),_0x391f49[_0x24e9('0x17')],routingClient)[_0x24e9('0x9')](respondWithResult(_0x3477bb,null))[_0x24e9('0x18')](handleError(_0x3477bb,null));};exports['showFaxQueues']=function(_0x1eb458,_0x176bda){return respondWithRpcPromise(_0x24e9('0x56'),_0x1eb458[_0x24e9('0x17')],routingClient)[_0x24e9('0x9')](findById(_0x1eb458[_0x24e9('0x1c')]['id']))[_0x24e9('0x9')](respondWithResult(_0x176bda,null))[_0x24e9('0x18')](handleError(_0x176bda,null));};exports[_0x24e9('0x57')]=function(_0x4a1511,_0x180320){return respondWithRpcPromise(_0x24e9('0x58'),_0x4a1511['query'])[_0x24e9('0x9')](respondWithResult(_0x180320,null))[_0x24e9('0x18')](handleError(_0x180320,null));};exports[_0x24e9('0x59')]=function(_0x4884c6,_0xe83d6e){return respondWithRpcPromise(_0x24e9('0x5a'),_0x4884c6['query'],routingClient)[_0x24e9('0x9')](respondWithResult(_0xe83d6e,null))['catch'](handleError(_0xe83d6e,null));};exports['mailQueuesWaitingInteractions']=function(_0x6d14d0,_0x458292){return respondWithRpcPromise(_0x24e9('0x5b'),_0x6d14d0[_0x24e9('0x17')],routingClient)[_0x24e9('0x9')](respondWithResult(_0x458292,null))[_0x24e9('0x18')](handleError(_0x458292,null));};exports[_0x24e9('0x5c')]=function(_0x3c06d1,_0x243614){return respondWithRpcPromise(_0x24e9('0x5d'),_0x3c06d1[_0x24e9('0x17')],routingClient)['then'](respondWithResult(_0x243614,null))[_0x24e9('0x18')](handleError(_0x243614,null));};exports[_0x24e9('0x5e')]=function(_0x22a590,_0x53863a){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x22a590[_0x24e9('0x17')],routingClient)['then'](function(_0x16288e){if(_0x22a590['query'][_0x24e9('0x5f')]!==undefined){var _0x4f4ecb=_(_0x16288e[_0x24e9('0x14')])[_0x24e9('0x60')]([_0x22a590[_0x24e9('0x17')][_0x24e9('0x5f')],_0x22a590['params']['id']])[_0x24e9('0x61')](_0x24e9('0x62'))[_0x24e9('0x63')]()[_0x24e9('0x64')]();return _0x16288e['rows']['filter'](function(_0x2d44b9){return _0x4f4ecb[_0x24e9('0x65')](_0x2d44b9['queue_id'])>-0x1;});}else{return _0x16288e['rows']['filter'](function(_0x224d31){return _0x224d31[_0x24e9('0x62')]===parseInt(_0x22a590[_0x24e9('0x1c')]['id']);});}})[_0x24e9('0x9')](respondWithResult(_0x53863a,null))[_0x24e9('0x18')](handleError(_0x53863a,null));};exports[_0x24e9('0x66')]=function(_0x10acd4,_0x40735d){return respondWithRpcPromise(_0x24e9('0x67'),_0x10acd4[_0x24e9('0x17')],routingClient)[_0x24e9('0x9')](respondWithResult(_0x40735d,null))['catch'](handleError(_0x40735d,null));};exports[_0x24e9('0x68')]=function(_0x2ce5e9,_0x42e966){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x2ce5e9[_0x24e9('0x17')],routingClient)[_0x24e9('0x9')](respondWithResult(_0x42e966,null))[_0x24e9('0x18')](handleError(_0x42e966,null));};exports[_0x24e9('0x69')]=function(_0x4600d9,_0x1fe068){return respondWithRpcPromise(_0x24e9('0x6a'),_0x4600d9[_0x24e9('0x17')],routingClient)[_0x24e9('0x9')](respondWithResult(_0x1fe068,null))['catch'](handleError(_0x1fe068,null));};exports[_0x24e9('0x6b')]=function(_0x187022){return function(_0x4d0e43,_0xe6eecd){var _0x26c410,_0x54d8d0;var _0x2ad5aa=_['capitalize'](_0x187022);var _0xbf81f2=_0x187022==='chat'?_0x24e9('0x6c'):_0x24e9('0x6d');return db[_0x2ad5aa+_0x24e9('0x6e')]['findOne']({'raw':!![],'where':{'id':_0x4d0e43[_0x24e9('0x1c')]['id']}})[_0x24e9('0x9')](function(_0x56c2e6){if(_[_0x24e9('0x13')](_0x56c2e6)){throw new Error(_0x2ad5aa+_0x24e9('0x6f'));}_0x26c410=_0x56c2e6;return db[_0x2ad5aa+_0x24e9('0x70')][_0x24e9('0x71')]({'where':{'id':_0x4d0e43[_0x24e9('0x24')]['messageId']},'include':[{'model':db[_0x2ad5aa+_0x24e9('0x72')],'as':_0x24e9('0x72')},{'model':db[_0x2ad5aa+_0xbf81f2],'as':_0x24e9('0x6d')}]});})[_0x24e9('0x9')](function(_0x4befa0){if(_['isNil'](_0x4befa0)){throw new Error(_0x2ad5aa+_0x24e9('0x73'));}_0x54d8d0=_0x4befa0;return _0x4befa0[_0x24e9('0x74')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x413f4b={'uniqueid':_0x187022+'.'+_0x54d8d0['id']+'.'+_0x54d8d0[_0x24e9('0x72')]['id'],'FromUserId':_0x4d0e43[_0x24e9('0x32')]['id'],'type':_0x24e9('0x75')};_0x413f4b[_0x2ad5aa+_0x24e9('0x76')]=_0x54d8d0['id'];_0x413f4b[_0x2ad5aa+_0x24e9('0x77')]=_0x54d8d0['Interaction']['id'];_0x413f4b[_0x24e9('0x78')+_0x2ad5aa+_0xbf81f2+'Id']=_0x54d8d0[_0x24e9('0x6d')]['id'];_0x413f4b['To'+_0x2ad5aa+_0x24e9('0x79')]=_0x26c410['id'];return db[_0x2ad5aa+_0x24e9('0x7a')][_0x24e9('0x7b')](_0x413f4b);})[_0x24e9('0x9')](function(){return respondWithRpcPromise(_0x24e9('0x7c'),{'channel':_0x187022,'interaction':_0x54d8d0[_0x24e9('0x72')],'message':_0x54d8d0,'account':_0x54d8d0[_0x24e9('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x24e9('0x75'),'appdata':_0x26c410[_0x24e9('0x11')]+','+(_0x54d8d0['Account'][_0x24e9('0x7d')]||0x12c),'interval':_0x24e9('0x7e')}]},routingClient);})['then'](respondWithResult(_0xe6eecd,null))[_0x24e9('0x18')](handleError(_0xe6eecd,null));};};exports[_0x24e9('0x7f')]=function(_0x56d9c6,_0x4edc9f){var _0x3f1c81,_0x3daea1;if(_[_0x24e9('0x13')](_0x56d9c6[_0x24e9('0x24')][_0x24e9('0x80')])){throw new Error(_0x24e9('0x81'));}var _0x4dc081=_0x56d9c6['body'][_0x24e9('0x80')];var _0x5b4680=_['capitalize'](_0x4dc081);var _0x3867c5=_0x4dc081===_0x24e9('0x82')?_0x24e9('0x6c'):'Account';return db[_0x24e9('0x83')][_0x24e9('0x71')]({'raw':!![],'where':{'id':_0x56d9c6['params']['id'],'role':'agent'}})[_0x24e9('0x9')](function(_0x298880){if(_[_0x24e9('0x13')](_0x298880)){throw new Error(_0x24e9('0x84'));}_0x3f1c81=_0x298880;return db[_0x5b4680+_0x24e9('0x70')]['findOne']({'where':{'id':_0x56d9c6[_0x24e9('0x24')][_0x24e9('0x85')]},'include':[{'model':db[_0x5b4680+_0x24e9('0x72')],'as':_0x24e9('0x72')},{'model':db[_0x5b4680+_0x3867c5],'as':_0x24e9('0x6d')}]});})[_0x24e9('0x9')](function(_0x461557){if(_[_0x24e9('0x13')](_0x461557)){throw new Error(_0x5b4680+_0x24e9('0x73'));}_0x3daea1=_0x461557;return _0x461557['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x423d99={'uniqueid':_0x4dc081+'.'+_0x3daea1['id']+'.'+_0x3daea1[_0x24e9('0x72')]['id'],'FromUserId':_0x56d9c6[_0x24e9('0x32')]['id'],'type':_0x24e9('0x3e'),'ToUserId':_0x3f1c81['id']};_0x423d99[_0x5b4680+'MessageId']=_0x3daea1['id'];_0x423d99[_0x5b4680+_0x24e9('0x77')]=_0x3daea1[_0x24e9('0x72')]['id'];_0x423d99['From'+_0x5b4680+_0x3867c5+'Id']=_0x3daea1['Account']['id'];return db[_0x5b4680+_0x24e9('0x7a')][_0x24e9('0x7b')](_0x423d99);})['then'](function(){return respondWithRpcPromise(_0x24e9('0x7c'),{'channel':_0x4dc081,'interaction':_0x3daea1[_0x24e9('0x72')],'message':_0x3daea1,'account':_0x3daea1[_0x24e9('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x3f1c81[_0x24e9('0x11')]+','+(_0x3daea1[_0x24e9('0x6d')]['agentTransferTimeout']||0x12c),'interval':_0x24e9('0x7e')}]},routingClient);})[_0x24e9('0x9')](respondWithResult(_0x4edc9f,null))[_0x24e9('0x18')](handleError(_0x4edc9f,null));}; \ No newline at end of file +var _0x4bf3=['mailAccounts','MailAccounts','OpenchannelQueues','smsQueues','SmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','uniq','value','indexOf','queue_id','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','chat','Website','Account','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','From','TransferReport','create','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','User','Agent\x20not\x20found','Start','bluebird','lodash','jayson/promise','client','http','request','then','error','code','message','result','catch','status','sendStatus','stack','name','send','isNil','rows','voiceChannels','VoiceChannels','query','VoiceChannelMixMonitor','merge','params','voiceQueues','VoiceQueues','updateVoiceQueue','body','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','findAll','length','format','updateAttributes','MemberReport','findOrCreate','INTERACTION','SIP/%s','interface','YYYY-MM-DD\x20HH:mm:ss','agent','internal','AgentCapacity','Telephones','Trunks','Campaigns','chatQueues','showChatQueues','mailQueues'];(function(_0x3df223,_0x1740fc){var _0x562d11=function(_0x343009){while(--_0x343009){_0x3df223['push'](_0x3df223['shift']());}};_0x562d11(++_0x1740fc);}(_0x4bf3,0x19d));var _0x34bf=function(_0x2c629b,_0x31f36f){_0x2c629b=_0x2c629b-0x0;var _0x4a73d8=_0x4bf3[_0x2c629b];return _0x4a73d8;};'use strict';var BPromise=require(_0x34bf('0x0'));var moment=require('moment');var _=require(_0x34bf('0x1'));var util=require('util');var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')('api');var jayson=require(_0x34bf('0x2'));var amiClient=jayson['client']['http']({'port':0x232a});var mailClient=jayson[_0x34bf('0x3')][_0x34bf('0x4')]({'port':0x232b});var routingClient=jayson[_0x34bf('0x3')]['http']({'port':0x232c});function respondWithRpcPromise(_0x28d3f6,_0x4334af,_0x339090){return new BPromise(function(_0x14a57c,_0x54722a){var _0x4d9df8=_0x339090?_0x339090:amiClient;return _0x4d9df8[_0x34bf('0x5')](_0x28d3f6,_0x4334af)[_0x34bf('0x6')](function(_0x5592f6){if(_0x5592f6[_0x34bf('0x7')]){if(_0x5592f6[_0x34bf('0x7')][_0x34bf('0x8')]===0x1f4){return _0x54722a(_0x5592f6[_0x34bf('0x7')][_0x34bf('0x9')]);}return _0x14a57c(_0x5592f6[_0x34bf('0x7')]['message']);}else{_0x14a57c(_0x5592f6[_0x34bf('0xa')]);}})[_0x34bf('0xb')](function(_0x3823ce){_0x54722a(_0x3823ce);});});}function respondWithResult(_0x6c980,_0x439685){_0x439685=_0x439685||0xc8;return function(_0x26dad8){if(_0x26dad8){return _0x6c980[_0x34bf('0xc')](_0x439685)['json'](_0x26dad8);}return _0x6c980[_0x34bf('0xd')](0x194);};}function handleError(_0x10e96d,_0x135cb9){_0x135cb9=_0x135cb9||0x1f4;return function(_0x5516ed){logger[_0x34bf('0x7')](_0x5516ed[_0x34bf('0xe')]);if(_0x5516ed[_0x34bf('0xf')]){delete _0x5516ed[_0x34bf('0xf')];}_0x10e96d['status'](_0x135cb9)[_0x34bf('0x10')](_0x5516ed);};}function findById(_0x52e541){return function(_0x544693){if(!_[_0x34bf('0x11')](_0x52e541)&&!_[_0x34bf('0x11')](_0x544693)&&!_[_0x34bf('0x11')](_0x544693[_0x34bf('0x12')])){return _['find'](_0x544693[_0x34bf('0x12')],function(_0x72400a){return _0x72400a['id']==_0x52e541;});}return null;};}exports[_0x34bf('0x13')]=function(_0x17a8bb,_0x42d5c4){return respondWithRpcPromise(_0x34bf('0x14'),_0x17a8bb[_0x34bf('0x15')])['then'](respondWithResult(_0x42d5c4,null))[_0x34bf('0xb')](handleError(_0x42d5c4,null));};exports['voiceChannelMixMonitor']=function(_0x39a7d4,_0x29e39f){return respondWithRpcPromise(_0x34bf('0x16'),_[_0x34bf('0x17')](_0x39a7d4[_0x34bf('0x15')],_0x39a7d4[_0x34bf('0x18')]))[_0x34bf('0x6')](respondWithResult(_0x29e39f,null))[_0x34bf('0xb')](handleError(_0x29e39f,null));};exports['voiceChannelStopMixMonitor']=function(_0x306bdc,_0x4d37a9){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_['merge'](_0x306bdc[_0x34bf('0x15')],_0x306bdc[_0x34bf('0x18')]))[_0x34bf('0x6')](respondWithResult(_0x4d37a9,null))[_0x34bf('0xb')](handleError(_0x4d37a9,null));};exports[_0x34bf('0x19')]=function(_0x1305a9,_0xf722fc){return respondWithRpcPromise(_0x34bf('0x1a'),_0x1305a9[_0x34bf('0x15')])[_0x34bf('0x6')](respondWithResult(_0xf722fc,null))[_0x34bf('0xb')](handleError(_0xf722fc,null));};exports['showVoiceQueues']=function(_0x227f08,_0xde53b1){return respondWithRpcPromise(_0x34bf('0x1a'),_0x227f08[_0x34bf('0x15')])[_0x34bf('0x6')](findById(_0x227f08[_0x34bf('0x18')]['id']))[_0x34bf('0x6')](respondWithResult(_0xde53b1,null))[_0x34bf('0xb')](handleError(_0xde53b1,null));};exports[_0x34bf('0x1b')]=function(_0x5f0aa0,_0x4b6cd4){return respondWithRpcPromise('UpdateVoiceQueue',_[_0x34bf('0x17')](_0x5f0aa0[_0x34bf('0x1c')],_0x5f0aa0[_0x34bf('0x18')]))['then'](respondWithResult(_0x4b6cd4,null))[_0x34bf('0xb')](handleError(_0x4b6cd4,null));};exports[_0x34bf('0x1d')]=function(_0x3c4e7e,_0x5c686b){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x34bf('0x17')](_0x3c4e7e[_0x34bf('0x15')],_0x3c4e7e[_0x34bf('0x18')]))[_0x34bf('0x6')](respondWithResult(_0x5c686b,null))[_0x34bf('0xb')](handleError(_0x5c686b,null));};exports[_0x34bf('0x1e')]=function(_0x2304b6,_0x5e50ca){return respondWithRpcPromise(_0x34bf('0x1f'),_0x2304b6[_0x34bf('0x15')])[_0x34bf('0x6')](respondWithResult(_0x5e50ca,null))['catch'](handleError(_0x5e50ca,null));};exports[_0x34bf('0x20')]=function(_0x54b2ee,_0x26fca9){return respondWithRpcPromise(_0x34bf('0x21'),_[_0x34bf('0x17')](_0x54b2ee['query'],_0x54b2ee[_0x34bf('0x18')]))[_0x34bf('0x6')](respondWithResult(_0x26fca9,null))[_0x34bf('0xb')](handleError(_0x26fca9,null));};exports[_0x34bf('0x22')]=function(_0x2140c6,_0x13b5e7){return respondWithRpcPromise(_0x34bf('0x23'),_['merge'](_0x2140c6[_0x34bf('0x15')],_0x2140c6[_0x34bf('0x18')]))[_0x34bf('0x6')](respondWithResult(_0x13b5e7,null))['catch'](handleError(_0x13b5e7,null));};exports[_0x34bf('0x24')]=function(_0x417e2f,_0x2ba640){return respondWithRpcPromise(_0x34bf('0x25'),_[_0x34bf('0x17')](_0x417e2f[_0x34bf('0x15')],_0x417e2f['params']))[_0x34bf('0x6')](respondWithResult(_0x2ba640,null))[_0x34bf('0xb')](handleError(_0x2ba640,null));};exports[_0x34bf('0x26')]=function(_0x10634f,_0x1790c0){return respondWithRpcPromise(_0x34bf('0x27'),_0x10634f[_0x34bf('0x15')])[_0x34bf('0x6')](respondWithResult(_0x1790c0,null))[_0x34bf('0xb')](handleError(_0x1790c0,null));};exports[_0x34bf('0x28')]=function(_0x5096d5,_0x33a274){return respondWithRpcPromise(_0x34bf('0x29'),_0x5096d5['query'])[_0x34bf('0x6')](respondWithResult(_0x33a274,null))[_0x34bf('0xb')](handleError(_0x33a274,null));};exports[_0x34bf('0x2a')]=function(_0x25ce7c,_0x1dff55){var _0x755873;return respondWithRpcPromise(_0x34bf('0x2b'),_0x25ce7c['query'])['then'](function(_0x453a3c){_0x755873=_0x453a3c;return respondWithRpcPromise('Agents',_0x25ce7c[_0x34bf('0x15')],routingClient);})[_0x34bf('0x6')](function(_0x5f16fb){return _['merge']({},_0x5f16fb,_0x755873);})[_0x34bf('0x6')](respondWithResult(_0x1dff55,null))['catch'](handleError(_0x1dff55,null));};exports[_0x34bf('0x2c')]=function(_0x2efc85,_0x3134ad){if(_0x2efc85['body']&&_0x2efc85[_0x34bf('0x1c')][_0x34bf('0x2d')]&&_0x2efc85[_0x34bf('0x2e')]&&_0x2efc85[_0x34bf('0x2e')][_0x34bf('0xf')]){for(var _0x2166a1 in _0x2efc85[_0x34bf('0x1c')][_0x34bf('0x2d')]){if(_0x2efc85['body'][_0x34bf('0x2d')][_0x34bf('0x2f')](_0x2166a1)){db['MemberReport'][_0x34bf('0x30')]({'where':{'channel':_0x2166a1,'membername':_0x2efc85['user']['name'],'type':'INTERACTION','exitAt':null,'uniqueid':_0x2efc85[_0x34bf('0x1c')][_0x34bf('0x2d')][_0x2166a1]&&_0x2efc85[_0x34bf('0x1c')]['interaction'][_0x2166a1][_0x34bf('0x31')]?{'$notIn':_0x2efc85['body']['interaction'][_0x2166a1]}:{'$ne':null}}})['then'](function(_0x557f52){var _0x6638ce=moment()[_0x34bf('0x32')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x5ea3c7=0x0,_0x1a8963=_0x557f52[_0x34bf('0x31')];_0x5ea3c7<_0x1a8963;_0x5ea3c7+=0x1){_0x557f52[_0x5ea3c7][_0x34bf('0x33')]({'exitAt':_0x6638ce});}});for(var _0x29dd38=0x0;_0x29dd38<_0x2efc85[_0x34bf('0x1c')]['interaction'][_0x2166a1][_0x34bf('0x31')];_0x29dd38+=0x1){db[_0x34bf('0x34')][_0x34bf('0x35')]({'where':{'channel':_0x2166a1,'membername':_0x2efc85[_0x34bf('0x2e')]['name'],'type':_0x34bf('0x36'),'uniqueid':_0x2efc85['body'][_0x34bf('0x2d')][_0x2166a1][_0x29dd38],'exitAt':null},'defaults':{'channel':_0x2166a1,'membername':_0x2efc85[_0x34bf('0x2e')][_0x34bf('0xf')],'interface':_['isNil'](_0x2efc85[_0x34bf('0x2e')]['interface'])?util[_0x34bf('0x32')](_0x34bf('0x37'),_0x2efc85[_0x34bf('0x2e')]['name']):_0x2efc85['user'][_0x34bf('0x38')],'type':'INTERACTION','enterAt':moment()[_0x34bf('0x32')](_0x34bf('0x39')),'role':_0x34bf('0x3a'),'internal':_0x2efc85[_0x34bf('0x2e')][_0x34bf('0x3b')],'uniqueid':_0x2efc85[_0x34bf('0x1c')][_0x34bf('0x2d')][_0x2166a1][_0x29dd38]}});}}}}return respondWithRpcPromise(_0x34bf('0x3c'),{'id':_0x2efc85[_0x34bf('0x18')]['id'],'capacity':_0x2efc85['body']['capacity']},routingClient)[_0x34bf('0x6')](respondWithResult(_0x3134ad,null))[_0x34bf('0xb')](handleError(_0x3134ad,null));};exports['telephones']=function(_0x58969a,_0x395838){return respondWithRpcPromise(_0x34bf('0x3d'),_0x58969a[_0x34bf('0x15')])['then'](respondWithResult(_0x395838,null))[_0x34bf('0xb')](handleError(_0x395838,null));};exports['trunks']=function(_0x416184,_0x3eddb9){return respondWithRpcPromise(_0x34bf('0x3e'),_0x416184['query'])[_0x34bf('0x6')](respondWithResult(_0x3eddb9,null))[_0x34bf('0xb')](handleError(_0x3eddb9,null));};exports['campaigns']=function(_0x30fcc4,_0x35ebb5){return respondWithRpcPromise(_0x34bf('0x3f'),_0x30fcc4[_0x34bf('0x15')])[_0x34bf('0x6')](respondWithResult(_0x35ebb5,null))[_0x34bf('0xb')](handleError(_0x35ebb5,null));};exports[_0x34bf('0x40')]=function(_0x36fd04,_0x51cefa){return respondWithRpcPromise('ChatQueues',_0x36fd04[_0x34bf('0x15')],routingClient)[_0x34bf('0x6')](respondWithResult(_0x51cefa,null))[_0x34bf('0xb')](handleError(_0x51cefa,null));};exports[_0x34bf('0x41')]=function(_0x5a99e8,_0x3b0212){return respondWithRpcPromise('ChatQueues',_0x5a99e8['query'],routingClient)[_0x34bf('0x6')](findById(_0x5a99e8['params']['id']))[_0x34bf('0x6')](respondWithResult(_0x3b0212,null))[_0x34bf('0xb')](handleError(_0x3b0212,null));};exports[_0x34bf('0x42')]=function(_0x3b9c19,_0x2e4f9a){return respondWithRpcPromise('MailQueues',_0x3b9c19[_0x34bf('0x15')],routingClient)[_0x34bf('0x6')](respondWithResult(_0x2e4f9a,null))[_0x34bf('0xb')](handleError(_0x2e4f9a,null));};exports['showMailQueues']=function(_0x128a90,_0x1c70fc){return respondWithRpcPromise('MailQueues',_0x128a90[_0x34bf('0x15')],routingClient)[_0x34bf('0x6')](findById(_0x128a90[_0x34bf('0x18')]['id']))[_0x34bf('0x6')](respondWithResult(_0x1c70fc,null))['catch'](handleError(_0x1c70fc,null));};exports[_0x34bf('0x43')]=function(_0x2e442f,_0x3b9150){return respondWithRpcPromise(_0x34bf('0x44'),_0x2e442f[_0x34bf('0x15')],mailClient)['then'](respondWithResult(_0x3b9150,null))['catch'](handleError(_0x3b9150,null));};exports['openchannelQueues']=function(_0x2536b9,_0x1233fb){return respondWithRpcPromise(_0x34bf('0x45'),_0x2536b9['query'],routingClient)[_0x34bf('0x6')](respondWithResult(_0x1233fb,null))[_0x34bf('0xb')](handleError(_0x1233fb,null));};exports['showOpenchannelQueues']=function(_0x1a735c,_0x25d8df){return respondWithRpcPromise('OpenchannelQueues',_0x1a735c[_0x34bf('0x15')],routingClient)[_0x34bf('0x6')](findById(_0x1a735c[_0x34bf('0x18')]['id']))['then'](respondWithResult(_0x25d8df,null))[_0x34bf('0xb')](handleError(_0x25d8df,null));};exports[_0x34bf('0x46')]=function(_0x1ad05c,_0x14f0c5){return respondWithRpcPromise(_0x34bf('0x47'),_0x1ad05c[_0x34bf('0x15')],routingClient)[_0x34bf('0x6')](respondWithResult(_0x14f0c5,null))['catch'](handleError(_0x14f0c5,null));};exports['showSmsQueues']=function(_0x3000e7,_0x9af4e){return respondWithRpcPromise(_0x34bf('0x47'),_0x3000e7[_0x34bf('0x15')],routingClient)[_0x34bf('0x6')](findById(_0x3000e7[_0x34bf('0x18')]['id']))[_0x34bf('0x6')](respondWithResult(_0x9af4e,null))[_0x34bf('0xb')](handleError(_0x9af4e,null));};exports['whatsappQueues']=function(_0x330a67,_0x7aeb53){return respondWithRpcPromise(_0x34bf('0x48'),_0x330a67[_0x34bf('0x15')],routingClient)['then'](respondWithResult(_0x7aeb53,null))['catch'](handleError(_0x7aeb53,null));};exports[_0x34bf('0x49')]=function(_0x439021,_0x299e54){return respondWithRpcPromise(_0x34bf('0x48'),_0x439021['query'],routingClient)['then'](findById(_0x439021[_0x34bf('0x18')]['id']))[_0x34bf('0x6')](respondWithResult(_0x299e54,null))[_0x34bf('0xb')](handleError(_0x299e54,null));};exports[_0x34bf('0x4a')]=function(_0x48ff2c,_0x3c588a){return respondWithRpcPromise(_0x34bf('0x4b'),_0x48ff2c[_0x34bf('0x15')],routingClient)['then'](respondWithResult(_0x3c588a,null))[_0x34bf('0xb')](handleError(_0x3c588a,null));};exports[_0x34bf('0x4c')]=function(_0xce7df7,_0x4715ca){return respondWithRpcPromise(_0x34bf('0x4b'),_0xce7df7[_0x34bf('0x15')],routingClient)[_0x34bf('0x6')](findById(_0xce7df7[_0x34bf('0x18')]['id']))[_0x34bf('0x6')](respondWithResult(_0x4715ca,null))['catch'](handleError(_0x4715ca,null));};exports['faxAccounts']=function(_0x3039fa,_0x1169fb){return respondWithRpcPromise(_0x34bf('0x4d'),_0x3039fa[_0x34bf('0x15')])['then'](respondWithResult(_0x1169fb,null))[_0x34bf('0xb')](handleError(_0x1169fb,null));};exports[_0x34bf('0x4e')]=function(_0x48684b,_0x2495d9){return respondWithRpcPromise(_0x34bf('0x4f'),_0x48684b[_0x34bf('0x15')],routingClient)[_0x34bf('0x6')](respondWithResult(_0x2495d9,null))[_0x34bf('0xb')](handleError(_0x2495d9,null));};exports[_0x34bf('0x50')]=function(_0x3c0193,_0x1d4e30){return respondWithRpcPromise(_0x34bf('0x51'),_0x3c0193[_0x34bf('0x15')],routingClient)[_0x34bf('0x6')](respondWithResult(_0x1d4e30,null))[_0x34bf('0xb')](handleError(_0x1d4e30,null));};exports[_0x34bf('0x52')]=function(_0x2f0348,_0x30174a){return respondWithRpcPromise(_0x34bf('0x53'),_0x2f0348[_0x34bf('0x15')],routingClient)[_0x34bf('0x6')](respondWithResult(_0x30174a,null))[_0x34bf('0xb')](handleError(_0x30174a,null));};exports[_0x34bf('0x54')]=function(_0x5e907e,_0x4ce018){return respondWithRpcPromise(_0x34bf('0x53'),_0x5e907e[_0x34bf('0x15')],routingClient)[_0x34bf('0x6')](function(_0x4bbeea){if(_0x5e907e[_0x34bf('0x15')][_0x34bf('0x55')]!==undefined){var _0x157eec=_(_0x4bbeea['rows'])[_0x34bf('0x56')]([_0x5e907e[_0x34bf('0x15')][_0x34bf('0x55')],_0x5e907e[_0x34bf('0x18')]['id']])[_0x34bf('0x57')]('queue_id')[_0x34bf('0x58')]()[_0x34bf('0x59')]();return _0x4bbeea[_0x34bf('0x12')][_0x34bf('0x56')](function(_0x1dacb0){return _0x157eec[_0x34bf('0x5a')](_0x1dacb0[_0x34bf('0x5b')])>-0x1;});}else{return _0x4bbeea['rows'][_0x34bf('0x56')](function(_0x3482c7){return _0x3482c7[_0x34bf('0x5b')]===parseInt(_0x5e907e[_0x34bf('0x18')]['id']);});}})[_0x34bf('0x6')](respondWithResult(_0x4ce018,null))[_0x34bf('0xb')](handleError(_0x4ce018,null));};exports[_0x34bf('0x5c')]=function(_0x4b9bcc,_0x1979a3){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x4b9bcc[_0x34bf('0x15')],routingClient)[_0x34bf('0x6')](respondWithResult(_0x1979a3,null))[_0x34bf('0xb')](handleError(_0x1979a3,null));};exports[_0x34bf('0x5d')]=function(_0x4ab453,_0x1aa7e3){return respondWithRpcPromise(_0x34bf('0x5e'),_0x4ab453[_0x34bf('0x15')],routingClient)[_0x34bf('0x6')](respondWithResult(_0x1aa7e3,null))[_0x34bf('0xb')](handleError(_0x1aa7e3,null));};exports['faxQueuesWaitingInteractions']=function(_0x2af5d3,_0x4c1363){return respondWithRpcPromise(_0x34bf('0x5f'),_0x2af5d3[_0x34bf('0x15')],routingClient)[_0x34bf('0x6')](respondWithResult(_0x4c1363,null))['catch'](handleError(_0x4c1363,null));};exports['queueNotify']=function(_0x152618){return function(_0x324647,_0xcb611b){var _0x36cf39,_0x2b0266;var _0x4c571d=_[_0x34bf('0x60')](_0x152618);var _0x4e65d3=_0x152618===_0x34bf('0x61')?_0x34bf('0x62'):_0x34bf('0x63');return db[_0x4c571d+'Queue'][_0x34bf('0x64')]({'raw':!![],'where':{'id':_0x324647[_0x34bf('0x18')]['id']}})[_0x34bf('0x6')](function(_0x336920){if(_[_0x34bf('0x11')](_0x336920)){throw new Error(_0x4c571d+_0x34bf('0x65'));}_0x36cf39=_0x336920;return db[_0x4c571d+_0x34bf('0x66')][_0x34bf('0x64')]({'where':{'id':_0x324647[_0x34bf('0x1c')][_0x34bf('0x67')]},'include':[{'model':db[_0x4c571d+_0x34bf('0x68')],'as':_0x34bf('0x68')},{'model':db[_0x4c571d+_0x4e65d3],'as':_0x34bf('0x63')}]});})['then'](function(_0x462ea9){if(_[_0x34bf('0x11')](_0x462ea9)){throw new Error(_0x4c571d+_0x34bf('0x69'));}_0x2b0266=_0x462ea9;return _0x462ea9[_0x34bf('0x6a')]({'read':0x0,'readAt':null,'UserId':null});})[_0x34bf('0x6')](function(){var _0x5f330c={'uniqueid':_0x152618+'.'+_0x2b0266['id']+'.'+_0x2b0266[_0x34bf('0x68')]['id'],'FromUserId':_0x324647[_0x34bf('0x2e')]['id'],'type':_0x34bf('0x6b')};_0x5f330c[_0x4c571d+_0x34bf('0x6c')]=_0x2b0266['id'];_0x5f330c[_0x4c571d+'InteractionId']=_0x2b0266['Interaction']['id'];_0x5f330c[_0x34bf('0x6d')+_0x4c571d+_0x4e65d3+'Id']=_0x2b0266['Account']['id'];_0x5f330c['To'+_0x4c571d+'QueueId']=_0x36cf39['id'];return db[_0x4c571d+_0x34bf('0x6e')][_0x34bf('0x6f')](_0x5f330c);})[_0x34bf('0x6')](function(){return respondWithRpcPromise('Start',{'channel':_0x152618,'interaction':_0x2b0266['Interaction'],'message':_0x2b0266,'account':_0x2b0266['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x34bf('0x6b'),'appdata':_0x36cf39['name']+','+(_0x2b0266['Account'][_0x34bf('0x70')]||0x12c),'interval':_0x34bf('0x71')}]},routingClient);})['then'](respondWithResult(_0xcb611b,null))['catch'](handleError(_0xcb611b,null));};};exports[_0x34bf('0x72')]=function(_0xc310ab,_0x4b909e){var _0x24178f,_0x57cb9e;if(_[_0x34bf('0x11')](_0xc310ab[_0x34bf('0x1c')]['channel'])){throw new Error(_0x34bf('0x73'));}var _0x361202=_0xc310ab['body'][_0x34bf('0x74')];var _0x4fa6ed=_[_0x34bf('0x60')](_0x361202);var _0x47d595=_0x361202===_0x34bf('0x61')?_0x34bf('0x62'):_0x34bf('0x63');return db[_0x34bf('0x75')][_0x34bf('0x64')]({'raw':!![],'where':{'id':_0xc310ab[_0x34bf('0x18')]['id'],'role':_0x34bf('0x3a')}})['then'](function(_0xccc925){if(_[_0x34bf('0x11')](_0xccc925)){throw new Error(_0x34bf('0x76'));}_0x24178f=_0xccc925;return db[_0x4fa6ed+_0x34bf('0x66')]['findOne']({'where':{'id':_0xc310ab[_0x34bf('0x1c')][_0x34bf('0x67')]},'include':[{'model':db[_0x4fa6ed+_0x34bf('0x68')],'as':_0x34bf('0x68')},{'model':db[_0x4fa6ed+_0x47d595],'as':_0x34bf('0x63')}]});})[_0x34bf('0x6')](function(_0x2f35a6){if(_[_0x34bf('0x11')](_0x2f35a6)){throw new Error(_0x4fa6ed+_0x34bf('0x69'));}_0x57cb9e=_0x2f35a6;return _0x2f35a6[_0x34bf('0x6a')]({'read':0x0,'readAt':null,'UserId':null});})[_0x34bf('0x6')](function(){var _0x432f05={'uniqueid':_0x361202+'.'+_0x57cb9e['id']+'.'+_0x57cb9e['Interaction']['id'],'FromUserId':_0xc310ab[_0x34bf('0x2e')]['id'],'type':'agent','ToUserId':_0x24178f['id']};_0x432f05[_0x4fa6ed+'MessageId']=_0x57cb9e['id'];_0x432f05[_0x4fa6ed+'InteractionId']=_0x57cb9e[_0x34bf('0x68')]['id'];_0x432f05[_0x34bf('0x6d')+_0x4fa6ed+_0x47d595+'Id']=_0x57cb9e[_0x34bf('0x63')]['id'];return db[_0x4fa6ed+_0x34bf('0x6e')]['create'](_0x432f05);})[_0x34bf('0x6')](function(){return respondWithRpcPromise(_0x34bf('0x77'),{'channel':_0x361202,'interaction':_0x57cb9e[_0x34bf('0x68')],'message':_0x57cb9e,'account':_0x57cb9e[_0x34bf('0x63')],'applications':[{'id':0x0,'priority':0x1,'app':_0x34bf('0x3a'),'appdata':_0x24178f[_0x34bf('0xf')]+','+(_0x57cb9e[_0x34bf('0x63')]['agentTransferTimeout']||0x12c),'interval':_0x34bf('0x71')}]},routingClient);})[_0x34bf('0x6')](respondWithResult(_0x4b909e,null))['catch'](handleError(_0x4b909e,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 08d6824..6129d38 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 _0x8119=['create','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','./schedule.controller','isAuthenticated','index','get','/:id','show','/:id/run','run','post'];(function(_0x386b55,_0x1cb443){var _0x21e80b=function(_0x1cb944){while(--_0x1cb944){_0x386b55['push'](_0x386b55['shift']());}};_0x21e80b(++_0x1cb443);}(_0x8119,0x1d1));var _0x9811=function(_0x30bc33,_0x4bc04c){_0x30bc33=_0x30bc33-0x0;var _0x1ee4cf=_0x8119[_0x30bc33];return _0x1ee4cf;};'use strict';var multer=require(_0x9811('0x0'));var util=require(_0x9811('0x1'));var path=require(_0x9811('0x2'));var timeout=require(_0x9811('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9811('0x4'));var auth=require(_0x9811('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9811('0x6'));router['get']('/',auth[_0x9811('0x7')](),controller[_0x9811('0x8')]);router[_0x9811('0x9')](_0x9811('0xa'),auth[_0x9811('0x7')](),controller[_0x9811('0xb')]);router['get'](_0x9811('0xc'),auth[_0x9811('0x7')](),controller[_0x9811('0xd')]);router[_0x9811('0xe')]('/',auth[_0x9811('0x7')](),controller[_0x9811('0xf')]);router['put'](_0x9811('0xa'),auth[_0x9811('0x7')](),controller[_0x9811('0x10')]);router[_0x9811('0x11')]('/:id',auth[_0x9811('0x7')](),controller[_0x9811('0x12')]);module[_0x9811('0x13')]=router; \ No newline at end of file +var _0x8367=['create','put','update','delete','destroy','exports','express','Router','fs-extra','../../components/interaction/service','./schedule.controller','get','index','/:id','isAuthenticated','show','/:id/run','run','post'];(function(_0x1aa2ac,_0x298bb4){var _0x327b6f=function(_0x4f10f6){while(--_0x4f10f6){_0x1aa2ac['push'](_0x1aa2ac['shift']());}};_0x327b6f(++_0x298bb4);}(_0x8367,0x15c));var _0x7836=function(_0x2f421,_0x5144c4){_0x2f421=_0x2f421-0x0;var _0x27b4af=_0x8367[_0x2f421];return _0x27b4af;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7836('0x0'));var router=express[_0x7836('0x1')]();var fs_extra=require(_0x7836('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x7836('0x3'));var config=require('../../config/environment');var controller=require(_0x7836('0x4'));router[_0x7836('0x5')]('/',auth['isAuthenticated'](),controller[_0x7836('0x6')]);router[_0x7836('0x5')](_0x7836('0x7'),auth[_0x7836('0x8')](),controller[_0x7836('0x9')]);router[_0x7836('0x5')](_0x7836('0xa'),auth[_0x7836('0x8')](),controller[_0x7836('0xb')]);router[_0x7836('0xc')]('/',auth['isAuthenticated'](),controller[_0x7836('0xd')]);router[_0x7836('0xe')]('/:id',auth[_0x7836('0x8')](),controller[_0x7836('0xf')]);router[_0x7836('0x10')](_0x7836('0x7'),auth[_0x7836('0x8')](),controller[_0x7836('0x11')]);module[_0x7836('0x12')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 43fc4b3..8d004c1 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 _0x402a=['BOOLEAN','TEXT','sequelize','exports','STRING','DATE','ENUM','years','quarters','months','days','hours','csv','pdf','xlsx','custom','default'];(function(_0x57803c,_0x489296){var _0x5434e0=function(_0x44d7d5){while(--_0x44d7d5){_0x57803c['push'](_0x57803c['shift']());}};_0x5434e0(++_0x489296);}(_0x402a,0x1cd));var _0xa402=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x402a[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require(_0xa402('0x0'));module[_0xa402('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xa402('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0xa402('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0xa402('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xa402('0x4')](_0xa402('0x5'),_0xa402('0x6'),_0xa402('0x7'),'weeks',_0xa402('0x8'),_0xa402('0x9'),'minutes'),'allowNull':![],'defaultValue':_0xa402('0x8')},'output':{'type':Sequelize[_0xa402('0x4')](_0xa402('0xa'),_0xa402('0xb'),_0xa402('0xc')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0xa402('0x4')](_0xa402('0xd'),_0xa402('0xe')),'allowNull':![],'defaultValue':_0xa402('0xd')},'sendMail':{'type':Sequelize[_0xa402('0xf')],'defaultValue':![]},'email':{'type':Sequelize[_0xa402('0x2')]},'cc':{'type':Sequelize[_0xa402('0x10')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x1529=['exports','STRING','DATE','INTEGER','ENUM','years','months','weeks','days','minutes','csv','pdf','xlsx','custom','BOOLEAN','TEXT'];(function(_0x3bccfa,_0x51fbc5){var _0x513f2b=function(_0x3d6c50){while(--_0x3d6c50){_0x3bccfa['push'](_0x3bccfa['shift']());}};_0x513f2b(++_0x51fbc5);}(_0x1529,0xd0));var _0x9152=function(_0x2a7f29,_0x2c89dc){_0x2a7f29=_0x2a7f29-0x0;var _0x38924b=_0x1529[_0x2a7f29];return _0x38924b;};'use strict';var Sequelize=require('sequelize');module[_0x9152('0x0')]={'name':{'type':Sequelize[_0x9152('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x9152('0x1')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x9152('0x2')],'allowNull':![]},'endAt':{'type':Sequelize[_0x9152('0x2')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x9152('0x3')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x9152('0x4')](_0x9152('0x5'),'quarters',_0x9152('0x6'),_0x9152('0x7'),_0x9152('0x8'),'hours',_0x9152('0x9')),'allowNull':![],'defaultValue':_0x9152('0x8')},'output':{'type':Sequelize[_0x9152('0x4')](_0x9152('0xa'),_0x9152('0xb'),_0x9152('0xc')),'allowNull':![],'defaultValue':_0x9152('0xa')},'type':{'type':Sequelize['ENUM'](_0x9152('0xd'),'default'),'allowNull':![],'defaultValue':_0x9152('0xd')},'sendMail':{'type':Sequelize[_0x9152('0xe')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x9152('0xf')]},'bcc':{'type':Sequelize[_0x9152('0xf')]},'sendIfEmpty':{'type':Sequelize[_0x9152('0xe')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index c7135e3..dc177c0 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 _0x1e1e=['offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','then','get','Scheduler','UserProfileResource','destroy','end','sendStatus','stack','name','send','index','map','Schedule','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0xcde2ee,_0x4d32cc){var _0x6eb7b2=function(_0x241253){while(--_0x241253){_0xcde2ee['push'](_0xcde2ee['shift']());}};_0x6eb7b2(++_0x4d32cc);}(_0x1e1e,0x98));var _0xe1e1=function(_0xe8129c,_0x2fb03c){_0xe8129c=_0xe8129c-0x0;var _0x709fc5=_0x1e1e[_0xe8129c];return _0x709fc5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe1e1('0x0'));var zipdir=require(_0xe1e1('0x1'));var jsonpatch=require(_0xe1e1('0x2'));var rp=require('request-promise');var moment=require(_0xe1e1('0x3'));var BPromise=require(_0xe1e1('0x4'));var Mustache=require(_0xe1e1('0x5'));var util=require(_0xe1e1('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xe1e1('0x7'));var ejs=require(_0xe1e1('0x8'));var fs=require('fs');var fs_extra=require(_0xe1e1('0x9'));var _=require(_0xe1e1('0xa'));var squel=require(_0xe1e1('0xb'));var crypto=require('crypto');var jsforce=require(_0xe1e1('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe1e1('0x7'));var querystring=require(_0xe1e1('0xd'));var Papa=require(_0xe1e1('0xe'));var Redis=require('ioredis');var authService=require(_0xe1e1('0xf'));var qs=require(_0xe1e1('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe1e1('0x11'));var logger=require(_0xe1e1('0x12'))(_0xe1e1('0x13'));var utils=require('../../config/utils');var config=require(_0xe1e1('0x14'));var licenseUtil=require(_0xe1e1('0x15'));var db=require(_0xe1e1('0x16'))['db'];function respondWithStatusCode(_0x57fae2,_0x7293be){_0x7293be=_0x7293be||0xcc;return function(_0x4f4c5c){if(_0x4f4c5c){return _0x57fae2['sendStatus'](_0x7293be);}return _0x57fae2['status'](_0x7293be)['end']();};}function respondWithResult(_0x4c666e,_0x3848bc){_0x3848bc=_0x3848bc||0xc8;return function(_0x675c7f){if(_0x675c7f){return _0x4c666e[_0xe1e1('0x17')](_0x3848bc)['json'](_0x675c7f);}};}function respondWithFilteredResult(_0x44d222,_0x200256){return function(_0x2226e3){if(_0x2226e3){var _0xf09e6c=typeof _0x200256[_0xe1e1('0x18')]===_0xe1e1('0x19')&&typeof _0x200256['limit']===_0xe1e1('0x19');var _0x1169cb=_0x2226e3[_0xe1e1('0x1a')];var _0x531c06=_0xf09e6c?0x0:_0x200256[_0xe1e1('0x18')];var _0x54334e=_0xf09e6c?_0x2226e3[_0xe1e1('0x1a')]:_0x200256[_0xe1e1('0x18')]+_0x200256[_0xe1e1('0x1b')];var _0x3f54fe;if(_0x54334e>=_0x1169cb){_0x54334e=_0x1169cb;_0x3f54fe=0xc8;}else{_0x3f54fe=0xce;}_0x44d222[_0xe1e1('0x17')](_0x3f54fe);return _0x44d222[_0xe1e1('0x1c')](_0xe1e1('0x1d'),_0x531c06+'-'+_0x54334e+'/'+_0x1169cb)[_0xe1e1('0x1e')](_0x2226e3);}return null;};}function patchUpdates(_0x543501){return function(_0x55ab09){try{jsonpatch[_0xe1e1('0x1f')](_0x55ab09,_0x543501,!![]);}catch(_0x12e075){return BPromise[_0xe1e1('0x20')](_0x12e075);}return _0x55ab09['save']();};}function saveUpdates(_0x59fcaf,_0x324e14){return function(_0x1cacce){if(_0x1cacce){return _0x1cacce[_0xe1e1('0x21')](_0x59fcaf)[_0xe1e1('0x22')](function(_0x40cff0){return _0x40cff0;});}return null;};}function removeEntity(_0x43afc9,_0x13a178){return function(_0x1f105a){if(_0x1f105a){return _0x1f105a['destroy']()['then'](function(){var _0x5185a4=_0x1f105a[_0xe1e1('0x23')]({'plain':!![]});var _0x25999a=_0xe1e1('0x24');return db[_0xe1e1('0x25')][_0xe1e1('0x26')]({'where':{'type':_0x25999a,'resourceId':_0x5185a4['id']}})['then'](function(){return _0x1f105a;});})[_0xe1e1('0x22')](function(){_0x43afc9[_0xe1e1('0x17')](0xcc)[_0xe1e1('0x27')]();});}};}function handleEntityNotFound(_0x259d85,_0x4e9b06){return function(_0x1dea8f){if(!_0x1dea8f){_0x259d85[_0xe1e1('0x28')](0x194);}return _0x1dea8f;};}function handleError(_0x158332,_0x437f50){_0x437f50=_0x437f50||0x1f4;return function(_0x44628a){logger['error'](_0x44628a[_0xe1e1('0x29')]);if(_0x44628a['name']){delete _0x44628a[_0xe1e1('0x2a')];}_0x158332[_0xe1e1('0x17')](_0x437f50)[_0xe1e1('0x2b')](_0x44628a);};}exports[_0xe1e1('0x2c')]=function(_0x3be07c,_0x1f7202){var _0x163b68={},_0x3a61d6={},_0x485fe6={'count':0x0,'rows':[]};var _0x1bd39a=_[_0xe1e1('0x2d')](db[_0xe1e1('0x2e')][_0xe1e1('0x2f')],function(_0x3d231c){return{'name':_0x3d231c['fieldName'],'type':_0x3d231c[_0xe1e1('0x30')][_0xe1e1('0x31')]};});_0x3a61d6[_0xe1e1('0x32')]=_[_0xe1e1('0x2d')](_0x1bd39a,'name');_0x3a61d6[_0xe1e1('0x33')]=_[_0xe1e1('0x34')](_0x3be07c[_0xe1e1('0x33')]);_0x3a61d6[_0xe1e1('0x35')]=_[_0xe1e1('0x36')](_0x3a61d6[_0xe1e1('0x32')],_0x3a61d6[_0xe1e1('0x33')]);_0x163b68['attributes']=_[_0xe1e1('0x36')](_0x3a61d6['model'],qs[_0xe1e1('0x37')](_0x3be07c[_0xe1e1('0x33')][_0xe1e1('0x37')]));_0x163b68[_0xe1e1('0x38')]=_0x163b68[_0xe1e1('0x38')][_0xe1e1('0x39')]?_0x163b68['attributes']:_0x3a61d6[_0xe1e1('0x32')];if(!_0x3be07c['query'][_0xe1e1('0x3a')](_0xe1e1('0x3b'))){_0x163b68['limit']=qs[_0xe1e1('0x1b')](_0x3be07c[_0xe1e1('0x33')][_0xe1e1('0x1b')]);_0x163b68[_0xe1e1('0x18')]=qs[_0xe1e1('0x18')](_0x3be07c[_0xe1e1('0x33')][_0xe1e1('0x18')]);}_0x163b68[_0xe1e1('0x3c')]=qs['sort'](_0x3be07c['query'][_0xe1e1('0x3d')]);_0x163b68[_0xe1e1('0x3e')]=qs[_0xe1e1('0x35')](_[_0xe1e1('0x3f')](_0x3be07c[_0xe1e1('0x33')],_0x3a61d6[_0xe1e1('0x35')]),_0x1bd39a);if(_0x3be07c['query'][_0xe1e1('0x40')]){_0x163b68['where']=_[_0xe1e1('0x41')](_0x163b68[_0xe1e1('0x3e')],{'$or':_[_0xe1e1('0x2d')](_0x1bd39a,function(_0x5e668c){if(_0x5e668c['type']!==_0xe1e1('0x42')){var _0x3e9a2c={};_0x3e9a2c[_0x5e668c[_0xe1e1('0x2a')]]={'$like':'%'+_0x3be07c[_0xe1e1('0x33')]['filter']+'%'};return _0x3e9a2c;}})});}_0x163b68=_[_0xe1e1('0x41')]({},_0x163b68,_0x3be07c[_0xe1e1('0x43')]);var _0x5742b2={'where':_0x163b68[_0xe1e1('0x3e')]};return db[_0xe1e1('0x2e')]['count'](_0x5742b2)[_0xe1e1('0x22')](function(_0x448055){_0x485fe6[_0xe1e1('0x1a')]=_0x448055;if(_0x3be07c['query']['includeAll']){_0x163b68[_0xe1e1('0x44')]=[{'all':!![]}];}return db[_0xe1e1('0x2e')][_0xe1e1('0x45')](_0x163b68);})['then'](function(_0x36d678){_0x485fe6[_0xe1e1('0x46')]=_0x36d678;return _0x485fe6;})[_0xe1e1('0x22')](respondWithFilteredResult(_0x1f7202,_0x163b68))[_0xe1e1('0x47')](handleError(_0x1f7202,null));};exports[_0xe1e1('0x48')]=function(_0x4d5425,_0x4fef3e){var _0x3fbaa2={'raw':![],'where':{'id':_0x4d5425[_0xe1e1('0x49')]['id']}},_0xbd2b12={};_0xbd2b12[_0xe1e1('0x32')]=_[_0xe1e1('0x34')](db['Schedule'][_0xe1e1('0x2f')]);_0xbd2b12['query']=_[_0xe1e1('0x34')](_0x4d5425['query']);_0xbd2b12[_0xe1e1('0x35')]=_[_0xe1e1('0x36')](_0xbd2b12[_0xe1e1('0x32')],_0xbd2b12['query']);_0x3fbaa2[_0xe1e1('0x38')]=_[_0xe1e1('0x36')](_0xbd2b12[_0xe1e1('0x32')],qs[_0xe1e1('0x37')](_0x4d5425[_0xe1e1('0x33')]['fields']));_0x3fbaa2[_0xe1e1('0x38')]=_0x3fbaa2['attributes'][_0xe1e1('0x39')]?_0x3fbaa2[_0xe1e1('0x38')]:_0xbd2b12['model'];if(_0x4d5425['query'][_0xe1e1('0x4a')]){_0x3fbaa2['include']=[{'all':!![]}];}_0x3fbaa2=_['merge']({},_0x3fbaa2,_0x4d5425['options']);return db['Schedule'][_0xe1e1('0x4b')](_0x3fbaa2)['then'](handleEntityNotFound(_0x4fef3e,null))[_0xe1e1('0x22')](respondWithResult(_0x4fef3e,null))[_0xe1e1('0x47')](handleError(_0x4fef3e,null));};exports[_0xe1e1('0x4c')]=function(_0x46faa1,_0xeee037){return db[_0xe1e1('0x2e')][_0xe1e1('0x4c')](_0x46faa1[_0xe1e1('0x4d')],{})['then'](function(_0xcd4467){var _0x224bd3=_0x46faa1['user'][_0xe1e1('0x23')]({'plain':!![]});if(!_0x224bd3)throw new Error(_0xe1e1('0x4e'));if(_0x224bd3[_0xe1e1('0x4f')]===_0xe1e1('0x50')){var _0x5c4258=_0xcd4467['get']({'plain':!![]});var _0x12065e=_0xe1e1('0x24');return db[_0xe1e1('0x51')][_0xe1e1('0x4b')]({'where':{'name':_0x12065e,'userProfileId':_0x224bd3[_0xe1e1('0x52')]},'raw':!![]})[_0xe1e1('0x22')](function(_0xf70306){if(_0xf70306&&_0xf70306[_0xe1e1('0x53')]===0x0){return db['UserProfileResource'][_0xe1e1('0x4c')]({'name':_0x5c4258[_0xe1e1('0x2a')],'resourceId':_0x5c4258['id'],'type':_0xf70306['name'],'sectionId':_0xf70306['id']},{})['then'](function(){return _0xcd4467;});}else{return _0xcd4467;}})[_0xe1e1('0x47')](function(_0x1c7a13){logger[_0xe1e1('0x54')](_0xe1e1('0x55'),_0x1c7a13);throw _0x1c7a13;});}return _0xcd4467;})[_0xe1e1('0x22')](respondWithResult(_0xeee037,0xc9))[_0xe1e1('0x47')](handleError(_0xeee037,null));};exports['update']=function(_0x2ebde6,_0x1dbdb4){if(_0x2ebde6[_0xe1e1('0x4d')]['id']){delete _0x2ebde6[_0xe1e1('0x4d')]['id'];}return db[_0xe1e1('0x2e')][_0xe1e1('0x4b')]({'where':{'id':_0x2ebde6[_0xe1e1('0x49')]['id']}})['then'](handleEntityNotFound(_0x1dbdb4,null))[_0xe1e1('0x22')](saveUpdates(_0x2ebde6['body'],null))[_0xe1e1('0x22')](respondWithResult(_0x1dbdb4,null))['catch'](handleError(_0x1dbdb4,null));};exports[_0xe1e1('0x26')]=function(_0x56bad4,_0x431bdf){return db['Schedule']['find']({'where':{'id':_0x56bad4[_0xe1e1('0x49')]['id']}})[_0xe1e1('0x22')](handleEntityNotFound(_0x431bdf,null))[_0xe1e1('0x22')](removeEntity(_0x431bdf,null))[_0xe1e1('0x47')](handleError(_0x431bdf,null));};exports[_0xe1e1('0x56')]=function(_0x29d5cd,_0x11879b,_0x44cd40){var _0xad8c8b=require(_0xe1e1('0x57'));return db['Schedule'][_0xe1e1('0x4b')]({'where':{'id':_0x29d5cd[_0xe1e1('0x49')]['id']},'raw':!![]})[_0xe1e1('0x22')](handleEntityNotFound(_0x11879b,null))[_0xe1e1('0x22')](function(){_0xad8c8b[_0xe1e1('0x56')](_0x29d5cd[_0xe1e1('0x49')]['id']);})[_0xe1e1('0x22')](respondWithStatusCode(_0x11879b,null))[_0xe1e1('0x47')](handleError(_0x11879b,null));}; \ No newline at end of file +var _0x5495=['VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','get','Scheduler','UserProfileResource','end','name','send','index','map','Schedule','rawAttributes','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge'];(function(_0x592d48,_0x23f1ba){var _0x5d789e=function(_0x156900){while(--_0x156900){_0x592d48['push'](_0x592d48['shift']());}};_0x5d789e(++_0x23f1ba);}(_0x5495,0x1ce));var _0x5549=function(_0x340a71,_0x167ff7){_0x340a71=_0x340a71-0x0;var _0x2dbd05=_0x5495[_0x340a71];return _0x2dbd05;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5549('0x0'));var jsonpatch=require(_0x5549('0x1'));var rp=require(_0x5549('0x2'));var moment=require(_0x5549('0x3'));var BPromise=require(_0x5549('0x4'));var Mustache=require('mustache');var util=require(_0x5549('0x5'));var path=require(_0x5549('0x6'));var sox=require(_0x5549('0x7'));var csv=require(_0x5549('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5549('0x9'));var _=require(_0x5549('0xa'));var squel=require(_0x5549('0xb'));var crypto=require(_0x5549('0xc'));var jsforce=require(_0x5549('0xd'));var deskjs=require(_0x5549('0xe'));var toCsv=require(_0x5549('0x8'));var querystring=require(_0x5549('0xf'));var Papa=require('papaparse');var Redis=require(_0x5549('0x10'));var authService=require(_0x5549('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5549('0x12'));var hardwareService=require(_0x5549('0x13'));var logger=require('../../config/logger')(_0x5549('0x14'));var utils=require(_0x5549('0x15'));var config=require(_0x5549('0x16'));var licenseUtil=require(_0x5549('0x17'));var db=require(_0x5549('0x18'))['db'];function respondWithStatusCode(_0x598424,_0x585d3e){_0x585d3e=_0x585d3e||0xcc;return function(_0x3dadd8){if(_0x3dadd8){return _0x598424[_0x5549('0x19')](_0x585d3e);}return _0x598424[_0x5549('0x1a')](_0x585d3e)['end']();};}function respondWithResult(_0x1ea241,_0xa7d974){_0xa7d974=_0xa7d974||0xc8;return function(_0x4a0518){if(_0x4a0518){return _0x1ea241[_0x5549('0x1a')](_0xa7d974)[_0x5549('0x1b')](_0x4a0518);}};}function respondWithFilteredResult(_0x41b135,_0x563340){return function(_0xbfc5f6){if(_0xbfc5f6){var _0x208301=typeof _0x563340[_0x5549('0x1c')]==='undefined'&&typeof _0x563340[_0x5549('0x1d')]===_0x5549('0x1e');var _0xe87ec8=_0xbfc5f6[_0x5549('0x1f')];var _0x12219e=_0x208301?0x0:_0x563340['offset'];var _0x14cc9a=_0x208301?_0xbfc5f6[_0x5549('0x1f')]:_0x563340[_0x5549('0x1c')]+_0x563340[_0x5549('0x1d')];var _0x48eba6;if(_0x14cc9a>=_0xe87ec8){_0x14cc9a=_0xe87ec8;_0x48eba6=0xc8;}else{_0x48eba6=0xce;}_0x41b135['status'](_0x48eba6);return _0x41b135[_0x5549('0x20')](_0x5549('0x21'),_0x12219e+'-'+_0x14cc9a+'/'+_0xe87ec8)['json'](_0xbfc5f6);}return null;};}function patchUpdates(_0x3172ca){return function(_0x552a9f){try{jsonpatch[_0x5549('0x22')](_0x552a9f,_0x3172ca,!![]);}catch(_0x42af38){return BPromise[_0x5549('0x23')](_0x42af38);}return _0x552a9f[_0x5549('0x24')]();};}function saveUpdates(_0xb0d4,_0x1938d5){return function(_0x52b473){if(_0x52b473){return _0x52b473[_0x5549('0x25')](_0xb0d4)['then'](function(_0x64ad94){return _0x64ad94;});}return null;};}function removeEntity(_0x1ea038,_0x15a62d){return function(_0x1b31f3){if(_0x1b31f3){return _0x1b31f3[_0x5549('0x26')]()[_0x5549('0x27')](function(){var _0xcdedcb=_0x1b31f3[_0x5549('0x28')]({'plain':!![]});var _0x290924=_0x5549('0x29');return db[_0x5549('0x2a')][_0x5549('0x26')]({'where':{'type':_0x290924,'resourceId':_0xcdedcb['id']}})[_0x5549('0x27')](function(){return _0x1b31f3;});})['then'](function(){_0x1ea038[_0x5549('0x1a')](0xcc)[_0x5549('0x2b')]();});}};}function handleEntityNotFound(_0x172fd0,_0x20af4d){return function(_0x5a4968){if(!_0x5a4968){_0x172fd0[_0x5549('0x19')](0x194);}return _0x5a4968;};}function handleError(_0x32a160,_0x373c5a){_0x373c5a=_0x373c5a||0x1f4;return function(_0x2a88ef){logger['error'](_0x2a88ef['stack']);if(_0x2a88ef[_0x5549('0x2c')]){delete _0x2a88ef[_0x5549('0x2c')];}_0x32a160['status'](_0x373c5a)[_0x5549('0x2d')](_0x2a88ef);};}exports[_0x5549('0x2e')]=function(_0x16f8c8,_0x1d5dfd){var _0x5ebe40={},_0x25ef3a={},_0x1de060={'count':0x0,'rows':[]};var _0x439437=_[_0x5549('0x2f')](db[_0x5549('0x30')][_0x5549('0x31')],function(_0x52131b){return{'name':_0x52131b['fieldName'],'type':_0x52131b[_0x5549('0x32')][_0x5549('0x33')]};});_0x25ef3a[_0x5549('0x34')]=_[_0x5549('0x2f')](_0x439437,_0x5549('0x2c'));_0x25ef3a[_0x5549('0x35')]=_['keys'](_0x16f8c8['query']);_0x25ef3a[_0x5549('0x36')]=_['intersection'](_0x25ef3a[_0x5549('0x34')],_0x25ef3a[_0x5549('0x35')]);_0x5ebe40[_0x5549('0x37')]=_['intersection'](_0x25ef3a[_0x5549('0x34')],qs['fields'](_0x16f8c8[_0x5549('0x35')][_0x5549('0x38')]));_0x5ebe40[_0x5549('0x37')]=_0x5ebe40[_0x5549('0x37')][_0x5549('0x39')]?_0x5ebe40['attributes']:_0x25ef3a[_0x5549('0x34')];if(!_0x16f8c8[_0x5549('0x35')][_0x5549('0x3a')](_0x5549('0x3b'))){_0x5ebe40[_0x5549('0x1d')]=qs['limit'](_0x16f8c8[_0x5549('0x35')][_0x5549('0x1d')]);_0x5ebe40[_0x5549('0x1c')]=qs[_0x5549('0x1c')](_0x16f8c8['query'][_0x5549('0x1c')]);}_0x5ebe40[_0x5549('0x3c')]=qs[_0x5549('0x3d')](_0x16f8c8[_0x5549('0x35')][_0x5549('0x3d')]);_0x5ebe40['where']=qs[_0x5549('0x36')](_[_0x5549('0x3e')](_0x16f8c8[_0x5549('0x35')],_0x25ef3a['filters']),_0x439437);if(_0x16f8c8['query'][_0x5549('0x3f')]){_0x5ebe40[_0x5549('0x40')]=_[_0x5549('0x41')](_0x5ebe40[_0x5549('0x40')],{'$or':_[_0x5549('0x2f')](_0x439437,function(_0x3f8a24){if(_0x3f8a24['type']!==_0x5549('0x42')){var _0x15bbfc={};_0x15bbfc[_0x3f8a24[_0x5549('0x2c')]]={'$like':'%'+_0x16f8c8[_0x5549('0x35')][_0x5549('0x3f')]+'%'};return _0x15bbfc;}})});}_0x5ebe40=_[_0x5549('0x41')]({},_0x5ebe40,_0x16f8c8[_0x5549('0x43')]);var _0x573884={'where':_0x5ebe40[_0x5549('0x40')]};return db[_0x5549('0x30')][_0x5549('0x1f')](_0x573884)['then'](function(_0x29d76c){_0x1de060[_0x5549('0x1f')]=_0x29d76c;if(_0x16f8c8['query'][_0x5549('0x44')]){_0x5ebe40[_0x5549('0x45')]=[{'all':!![]}];}return db['Schedule'][_0x5549('0x46')](_0x5ebe40);})[_0x5549('0x27')](function(_0x1ec690){_0x1de060['rows']=_0x1ec690;return _0x1de060;})['then'](respondWithFilteredResult(_0x1d5dfd,_0x5ebe40))[_0x5549('0x47')](handleError(_0x1d5dfd,null));};exports[_0x5549('0x48')]=function(_0x438e3d,_0x17cf71){var _0xfc38d6={'raw':![],'where':{'id':_0x438e3d[_0x5549('0x49')]['id']}},_0x341182={};_0x341182[_0x5549('0x34')]=_['keys'](db[_0x5549('0x30')][_0x5549('0x31')]);_0x341182[_0x5549('0x35')]=_[_0x5549('0x4a')](_0x438e3d[_0x5549('0x35')]);_0x341182[_0x5549('0x36')]=_[_0x5549('0x4b')](_0x341182[_0x5549('0x34')],_0x341182[_0x5549('0x35')]);_0xfc38d6[_0x5549('0x37')]=_[_0x5549('0x4b')](_0x341182[_0x5549('0x34')],qs[_0x5549('0x38')](_0x438e3d[_0x5549('0x35')][_0x5549('0x38')]));_0xfc38d6[_0x5549('0x37')]=_0xfc38d6[_0x5549('0x37')][_0x5549('0x39')]?_0xfc38d6[_0x5549('0x37')]:_0x341182[_0x5549('0x34')];if(_0x438e3d[_0x5549('0x35')][_0x5549('0x44')]){_0xfc38d6[_0x5549('0x45')]=[{'all':!![]}];}_0xfc38d6=_[_0x5549('0x41')]({},_0xfc38d6,_0x438e3d['options']);return db[_0x5549('0x30')][_0x5549('0x4c')](_0xfc38d6)[_0x5549('0x27')](handleEntityNotFound(_0x17cf71,null))['then'](respondWithResult(_0x17cf71,null))[_0x5549('0x47')](handleError(_0x17cf71,null));};exports[_0x5549('0x4d')]=function(_0x502eb7,_0x5297d0){return db[_0x5549('0x30')][_0x5549('0x4d')](_0x502eb7[_0x5549('0x4e')],{})[_0x5549('0x27')](function(_0x365383){var _0x547a4a=_0x502eb7[_0x5549('0x4f')]['get']({'plain':!![]});if(!_0x547a4a)throw new Error(_0x5549('0x50'));if(_0x547a4a[_0x5549('0x51')]===_0x5549('0x4f')){var _0x802cc7=_0x365383[_0x5549('0x28')]({'plain':!![]});var _0x113c27=_0x5549('0x29');return db[_0x5549('0x52')]['find']({'where':{'name':_0x113c27,'userProfileId':_0x547a4a['userProfileId']},'raw':!![]})['then'](function(_0x5b2cee){if(_0x5b2cee&&_0x5b2cee[_0x5549('0x53')]===0x0){return db[_0x5549('0x2a')][_0x5549('0x4d')]({'name':_0x802cc7[_0x5549('0x2c')],'resourceId':_0x802cc7['id'],'type':_0x5b2cee['name'],'sectionId':_0x5b2cee['id']},{})[_0x5549('0x27')](function(){return _0x365383;});}else{return _0x365383;}})['catch'](function(_0x248c8){logger[_0x5549('0x54')](_0x5549('0x55'),_0x248c8);throw _0x248c8;});}return _0x365383;})[_0x5549('0x27')](respondWithResult(_0x5297d0,0xc9))[_0x5549('0x47')](handleError(_0x5297d0,null));};exports[_0x5549('0x25')]=function(_0xc80ed9,_0xa4cc8f){if(_0xc80ed9['body']['id']){delete _0xc80ed9[_0x5549('0x4e')]['id'];}return db[_0x5549('0x30')][_0x5549('0x4c')]({'where':{'id':_0xc80ed9[_0x5549('0x49')]['id']}})['then'](handleEntityNotFound(_0xa4cc8f,null))[_0x5549('0x27')](saveUpdates(_0xc80ed9[_0x5549('0x4e')],null))[_0x5549('0x27')](respondWithResult(_0xa4cc8f,null))['catch'](handleError(_0xa4cc8f,null));};exports[_0x5549('0x26')]=function(_0x568b67,_0x51a528){return db[_0x5549('0x30')][_0x5549('0x4c')]({'where':{'id':_0x568b67[_0x5549('0x49')]['id']}})[_0x5549('0x27')](handleEntityNotFound(_0x51a528,null))[_0x5549('0x27')](removeEntity(_0x51a528,null))[_0x5549('0x47')](handleError(_0x51a528,null));};exports[_0x5549('0x56')]=function(_0x688c8b,_0xaf7897,_0x1b84a1){var _0x2c8c5d=require(_0x5549('0x57'));return db['Schedule'][_0x5549('0x4c')]({'where':{'id':_0x688c8b[_0x5549('0x49')]['id']},'raw':!![]})[_0x5549('0x27')](handleEntityNotFound(_0xaf7897,null))[_0x5549('0x27')](function(){_0x2c8c5d[_0x5549('0x56')](_0x688c8b[_0x5549('0x49')]['id']);})[_0x5549('0x27')](respondWithStatusCode(_0xaf7897,null))['catch'](handleError(_0xaf7897,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 0914a73..86c56a0 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 _0xb566=['tools_schedules','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./schedule.attributes','exports','Schedule'];(function(_0x52085a,_0x3717ca){var _0x5afc1a=function(_0x2aa175){while(--_0x2aa175){_0x52085a['push'](_0x52085a['shift']());}};_0x5afc1a(++_0x3717ca);}(_0xb566,0x1ae));var _0x6b56=function(_0x3a0c4f,_0x5dd1a3){_0x3a0c4f=_0x3a0c4f-0x0;var _0x247049=_0xb566[_0x3a0c4f];return _0x247049;};'use strict';var _=require(_0x6b56('0x0'));var util=require(_0x6b56('0x1'));var logger=require(_0x6b56('0x2'))(_0x6b56('0x3'));var moment=require(_0x6b56('0x4'));var BPromise=require(_0x6b56('0x5'));var rp=require(_0x6b56('0x6'));var fs=require('fs');var path=require(_0x6b56('0x7'));var rimraf=require(_0x6b56('0x8'));var config=require('../../config/environment');var attributes=require(_0x6b56('0x9'));module[_0x6b56('0xa')]=function(_0x4d8eec,_0xa22691){return _0x4d8eec['define'](_0x6b56('0xb'),attributes,{'tableName':_0x6b56('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb59=['request-promise','path','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','util','api','moment','bluebird'];(function(_0xafcf00,_0x4429a3){var _0x513af4=function(_0x59554d){while(--_0x59554d){_0xafcf00['push'](_0xafcf00['shift']());}};_0x513af4(++_0x4429a3);}(_0xeb59,0x7d));var _0x9eb5=function(_0x20d54d,_0x1adc8e){_0x20d54d=_0x20d54d-0x0;var _0x516e8b=_0xeb59[_0x20d54d];return _0x516e8b;};'use strict';var _=require(_0x9eb5('0x0'));var util=require(_0x9eb5('0x1'));var logger=require('../../config/logger')(_0x9eb5('0x2'));var moment=require(_0x9eb5('0x3'));var BPromise=require(_0x9eb5('0x4'));var rp=require(_0x9eb5('0x5'));var fs=require('fs');var path=require(_0x9eb5('0x6'));var rimraf=require('rimraf');var config=require(_0x9eb5('0x7'));var attributes=require(_0x9eb5('0x8'));module[_0x9eb5('0x9')]=function(_0x1078fc,_0x1d400a){return _0x1078fc[_0x9eb5('0xa')](_0x9eb5('0xb'),attributes,{'tableName':_0x9eb5('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 276605b..6dc1f42 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 _0x984b=['stringify','error','message','info','result','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','Schedule,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x9a85cd,_0x51e751){var _0x15b2f8=function(_0x1aeb20){while(--_0x1aeb20){_0x9a85cd['push'](_0x9a85cd['shift']());}};_0x15b2f8(++_0x51e751);}(_0x984b,0x15b));var _0xb984=function(_0x227f2e,_0x58e028){_0x227f2e=_0x227f2e-0x0;var _0x31e433=_0x984b[_0x227f2e];return _0x31e433;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb984('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb984('0x1'))['db'];var utils=require(_0xb984('0x2'));var logger=require('../../config/logger')(_0xb984('0x3'));var config=require(_0xb984('0x4'));var jayson=require(_0xb984('0x5'));var client=jayson[_0xb984('0x6')][_0xb984('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x550a5d,_0x3f237c,_0x6a96a6){return new BPromise(function(_0x3d8ea2,_0x4f9bf6){return client[_0xb984('0x8')](_0x550a5d,_0x6a96a6)[_0xb984('0x9')](function(_0x58b56e){logger['info'](_0xb984('0xa'),_0x3f237c,_0xb984('0xb'));logger[_0xb984('0xc')]('Schedule,\x20%s,\x20%s,\x20%s',_0x3f237c,_0xb984('0xb'),JSON[_0xb984('0xd')](_0x58b56e));if(_0x58b56e[_0xb984('0xe')]){if(_0x58b56e[_0xb984('0xe')]['code']===0x1f4){logger[_0xb984('0xe')](_0xb984('0xa'),_0x3f237c,_0x58b56e[_0xb984('0xe')]['message']);return _0x4f9bf6(_0x58b56e[_0xb984('0xe')][_0xb984('0xf')]);}logger[_0xb984('0xe')]('Schedule,\x20%s,\x20%s',_0x3f237c,_0x58b56e[_0xb984('0xe')]['message']);return _0x3d8ea2(_0x58b56e[_0xb984('0xe')][_0xb984('0xf')]);}else{logger[_0xb984('0x10')](_0xb984('0xa'),_0x3f237c,'request\x20sent');_0x3d8ea2(_0x58b56e[_0xb984('0x11')][_0xb984('0xf')]);}})['catch'](function(_0x1c4eb9){logger[_0xb984('0xe')](_0xb984('0xa'),_0x3f237c,_0x1c4eb9);_0x4f9bf6(_0x1c4eb9);});});} \ No newline at end of file +var _0x1aa4=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','moment','randomstring','ioredis'];(function(_0x2088ba,_0x4b91c5){var _0x496632=function(_0x4ec6d6){while(--_0x4ec6d6){_0x2088ba['push'](_0x2088ba['shift']());}};_0x496632(++_0x4b91c5);}(_0x1aa4,0xd3));var _0x41aa=function(_0x28097c,_0x16aa54){_0x28097c=_0x28097c-0x0;var _0x1c2573=_0x1aa4[_0x28097c];return _0x1c2573;};'use strict';var _=require(_0x41aa('0x0'));var util=require(_0x41aa('0x1'));var moment=require(_0x41aa('0x2'));var BPromise=require('bluebird');var rs=require(_0x41aa('0x3'));var fs=require('fs');var Redis=require(_0x41aa('0x4'));var db=require(_0x41aa('0x5'))['db'];var utils=require(_0x41aa('0x6'));var logger=require(_0x41aa('0x7'))(_0x41aa('0x8'));var config=require(_0x41aa('0x9'));var jayson=require(_0x41aa('0xa'));var client=jayson[_0x41aa('0xb')][_0x41aa('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x31fde8,_0x55c99f,_0x4de830){return new BPromise(function(_0x144b1a,_0x19803a){return client[_0x41aa('0xd')](_0x31fde8,_0x4de830)[_0x41aa('0xe')](function(_0x3ad1c7){logger[_0x41aa('0xf')](_0x41aa('0x10'),_0x55c99f,'request\x20sent');logger[_0x41aa('0x11')](_0x41aa('0x12'),_0x55c99f,_0x41aa('0x13'),JSON['stringify'](_0x3ad1c7));if(_0x3ad1c7[_0x41aa('0x14')]){if(_0x3ad1c7[_0x41aa('0x14')][_0x41aa('0x15')]===0x1f4){logger[_0x41aa('0x14')](_0x41aa('0x10'),_0x55c99f,_0x3ad1c7['error'][_0x41aa('0x16')]);return _0x19803a(_0x3ad1c7[_0x41aa('0x14')][_0x41aa('0x16')]);}logger[_0x41aa('0x14')](_0x41aa('0x10'),_0x55c99f,_0x3ad1c7[_0x41aa('0x14')][_0x41aa('0x16')]);return _0x144b1a(_0x3ad1c7[_0x41aa('0x14')]['message']);}else{logger[_0x41aa('0xf')](_0x41aa('0x10'),_0x55c99f,_0x41aa('0x13'));_0x144b1a(_0x3ad1c7[_0x41aa('0x17')][_0x41aa('0x16')]);}})['catch'](function(_0x83bfb5){logger[_0x41aa('0x14')](_0x41aa('0x10'),_0x55c99f,_0x83bfb5);_0x19803a(_0x83bfb5);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 18b5d3e..b471f38 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 _0x47d5=['show','post','create','put','update','delete','destroy','exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0x47d5,0x1eb));var _0x547d=function(_0x6ee433,_0x4d669d){_0x6ee433=_0x6ee433-0x0;var _0x284cf4=_0x47d5[_0x6ee433];return _0x284cf4;};'use strict';var multer=require('multer');var util=require(_0x547d('0x0'));var path=require(_0x547d('0x1'));var timeout=require('connect-timeout');var express=require(_0x547d('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x547d('0x3'));var interaction=require(_0x547d('0x4'));var config=require(_0x547d('0x5'));var controller=require(_0x547d('0x6'));router[_0x547d('0x7')]('/',auth[_0x547d('0x8')](),controller[_0x547d('0x9')]);router['get'](_0x547d('0xa'),auth['isAuthenticated'](),controller[_0x547d('0xb')]);router[_0x547d('0x7')](_0x547d('0xc'),auth[_0x547d('0x8')](),controller[_0x547d('0xd')]);router[_0x547d('0x7')]('/:id/download',auth[_0x547d('0x8')](),controller['download']);router[_0x547d('0xe')]('/',auth[_0x547d('0x8')](),controller[_0x547d('0xf')]);router[_0x547d('0x10')](_0x547d('0xc'),auth[_0x547d('0x8')](),controller[_0x547d('0x11')]);router[_0x547d('0x12')](_0x547d('0xc'),auth[_0x547d('0x8')](),controller[_0x547d('0x13')]);module[_0x547d('0x14')]=router; \ No newline at end of file +var _0xc0c2=['./screenRecording.controller','get','isAuthenticated','index','describe','show','/:id/download','download','create','/:id','update','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xc0c2,0x19b));var _0x2c0c=function(_0x44508f,_0x3d2edc){_0x44508f=_0x44508f-0x0;var _0x3cc7b9=_0xc0c2[_0x44508f];return _0x3cc7b9;};'use strict';var multer=require(_0x2c0c('0x0'));var util=require(_0x2c0c('0x1'));var path=require(_0x2c0c('0x2'));var timeout=require(_0x2c0c('0x3'));var express=require('express');var router=express[_0x2c0c('0x4')]();var fs_extra=require(_0x2c0c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2c0c('0x6'));var config=require('../../config/environment');var controller=require(_0x2c0c('0x7'));router[_0x2c0c('0x8')]('/',auth[_0x2c0c('0x9')](),controller[_0x2c0c('0xa')]);router[_0x2c0c('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x2c0c('0xb')]);router['get']('/:id',auth[_0x2c0c('0x9')](),controller[_0x2c0c('0xc')]);router[_0x2c0c('0x8')](_0x2c0c('0xd'),auth[_0x2c0c('0x9')](),controller[_0x2c0c('0xe')]);router['post']('/',auth[_0x2c0c('0x9')](),controller[_0x2c0c('0xf')]);router['put'](_0x2c0c('0x10'),auth[_0x2c0c('0x9')](),controller[_0x2c0c('0x11')]);router[_0x2c0c('0x12')]('/:id',auth[_0x2c0c('0x9')](),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 3393059..7485837 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 _0x02a7=['format','updatedAt','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','subtract','closedAt','duration','DATE','startedAt','MM-DD-YYYY\x20HH:mm','toString'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x02a7,0x1a6));var _0x702a=function(_0x532be0,_0x5e4270){_0x532be0=_0x532be0-0x0;var _0x21c3df=_0x02a7[_0x532be0];return _0x21c3df;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x702a('0x0'));var path=require(_0x702a('0x1'));var config=require(_0x702a('0x2'));module[_0x702a('0x3')]={'format':{'type':Sequelize[_0x702a('0x4')],'get':function(){return this[_0x702a('0x5')](_0x702a('0x6'))?path[_0x702a('0x7')](this[_0x702a('0x5')](_0x702a('0x6'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x702a('0x8')],'set':function(_0x4b6736){var _0x27bfc7=_0x4b6736[_0x702a('0x9')](/\\/g,'/');this['setDataValue']('value',_0x27bfc7);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x3cb569){this[_0x702a('0xa')]('startedAt',moment()[_0x702a('0xb')](_0x3cb569,'ms'));this[_0x702a('0xa')](_0x702a('0xc'),moment());this[_0x702a('0xa')](_0x702a('0xd'),_0x3cb569);}},'startedAt':{'type':Sequelize[_0x702a('0xe')],'get':function(){return moment(this[_0x702a('0x5')](_0x702a('0xf')))['format'](_0x702a('0x10'))[_0x702a('0x11')]();}},'closedAt':{'type':Sequelize[_0x702a('0xe')],'get':function(){return moment(this[_0x702a('0x5')]('closedAt'))[_0x702a('0x12')](_0x702a('0x10'))[_0x702a('0x11')]();}},'createdAt':{'type':Sequelize[_0x702a('0xe')],'get':function(){return moment(this[_0x702a('0x5')]('createdAt'))[_0x702a('0x12')](_0x702a('0x10'))[_0x702a('0x11')]();}},'updatedAt':{'type':Sequelize[_0x702a('0xe')],'get':function(){return moment(this[_0x702a('0x5')](_0x702a('0x13')))[_0x702a('0x12')]('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file +var _0xa32b=['DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','path','VIRTUAL','getDataValue','value','STRING','setDataValue','INTEGER'];(function(_0x3bcb7c,_0x5af870){var _0x584411=function(_0x4b9a67){while(--_0x4b9a67){_0x3bcb7c['push'](_0x3bcb7c['shift']());}};_0x584411(++_0x5af870);}(_0xa32b,0x68));var _0xba32=function(_0x3438cf,_0x73b174){_0x3438cf=_0x3438cf-0x0;var _0x278698=_0xa32b[_0x3438cf];return _0x278698;};'use strict';var Sequelize=require(_0xba32('0x0'));var moment=require('moment');var path=require(_0xba32('0x1'));var config=require('../../config/environment');module['exports']={'format':{'type':Sequelize[_0xba32('0x2')],'get':function(){return this[_0xba32('0x3')](_0xba32('0x4'))?path['extname'](this[_0xba32('0x3')](_0xba32('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0xba32('0x5')]},'channel':{'type':Sequelize[_0xba32('0x5')]},'value':{'type':Sequelize[_0xba32('0x5')],'set':function(_0x5c5a59){var _0x1b1332=_0x5c5a59['replace'](/\\/g,'/');this[_0xba32('0x6')](_0xba32('0x4'),_0x1b1332);}},'rating':{'type':Sequelize[_0xba32('0x7')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xba32('0x7')],'set':function(_0x5d8f64){this['setDataValue']('startedAt',moment()['subtract'](_0x5d8f64,'ms'));this[_0xba32('0x6')]('closedAt',moment());this[_0xba32('0x6')]('duration',_0x5d8f64);}},'startedAt':{'type':Sequelize[_0xba32('0x8')],'get':function(){return moment(this['getDataValue']('startedAt'))[_0xba32('0x9')](_0xba32('0xa'))[_0xba32('0xb')]();}},'closedAt':{'type':Sequelize[_0xba32('0x8')],'get':function(){return moment(this[_0xba32('0x3')]('closedAt'))[_0xba32('0x9')](_0xba32('0xa'))[_0xba32('0xb')]();}},'createdAt':{'type':Sequelize[_0xba32('0x8')],'get':function(){return moment(this[_0xba32('0x3')](_0xba32('0xc')))[_0xba32('0x9')]('MM-DD-YYYY\x20HH:mm')[_0xba32('0xb')]();}},'updatedAt':{'type':Sequelize[_0xba32('0x8')],'get':function(){return moment(this[_0xba32('0x3')](_0xba32('0xd')))[_0xba32('0x9')]('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 1a86750..319c2e3 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 _0xb4c7=['rawAttributes','fieldName','type','format','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','keys','include','find','create','body','duration','createdAt','closedAt','value','describe','../../components/encryptor','uniqueid','params','join','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','root','ValidationError','download','filename','extname','unlink','message','Not\x20found','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','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','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ScreenRecording'];(function(_0x38af48,_0x400460){var _0x445384=function(_0x464435){while(--_0x464435){_0x38af48['push'](_0x38af48['shift']());}};_0x445384(++_0x400460);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x44d78e,_0x1c4faa){_0x44d78e=_0x44d78e-0x0;var _0xe44508=_0xb4c7[_0x44d78e];return _0xe44508;};'use strict';var emlformat=require(_0x7b4c('0x0'));var rimraf=require(_0x7b4c('0x1'));var zipdir=require(_0x7b4c('0x2'));var jsonpatch=require(_0x7b4c('0x3'));var rp=require(_0x7b4c('0x4'));var moment=require('moment');var BPromise=require(_0x7b4c('0x5'));var Mustache=require(_0x7b4c('0x6'));var util=require(_0x7b4c('0x7'));var path=require(_0x7b4c('0x8'));var sox=require(_0x7b4c('0x9'));var csv=require('to-csv');var ejs=require(_0x7b4c('0xa'));var fs=require('fs');var fs_extra=require(_0x7b4c('0xb'));var _=require(_0x7b4c('0xc'));var squel=require('squel');var crypto=require(_0x7b4c('0xd'));var jsforce=require(_0x7b4c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7b4c('0xf'));var querystring=require(_0x7b4c('0x10'));var Papa=require(_0x7b4c('0x11'));var Redis=require(_0x7b4c('0x12'));var authService=require(_0x7b4c('0x13'));var qs=require(_0x7b4c('0x14'));var as=require(_0x7b4c('0x15'));var hardwareService=require(_0x7b4c('0x16'));var logger=require(_0x7b4c('0x17'))(_0x7b4c('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7b4c('0x19'));var db=require(_0x7b4c('0x1a'))['db'];function respondWithStatusCode(_0x38656b,_0x1722ad){_0x1722ad=_0x1722ad||0xcc;return function(_0x3e1558){if(_0x3e1558){return _0x38656b[_0x7b4c('0x1b')](_0x1722ad);}return _0x38656b[_0x7b4c('0x1c')](_0x1722ad)[_0x7b4c('0x1d')]();};}function respondWithResult(_0x25b90b,_0x387488){_0x387488=_0x387488||0xc8;return function(_0x593a19){if(_0x593a19){return _0x25b90b[_0x7b4c('0x1c')](_0x387488)[_0x7b4c('0x1e')](_0x593a19);}};}function respondWithFilteredResult(_0xdc71cd,_0x2a0e2f){return function(_0xa0a812){if(_0xa0a812){var _0x2471b3=typeof _0x2a0e2f[_0x7b4c('0x1f')]===_0x7b4c('0x20')&&typeof _0x2a0e2f['limit']===_0x7b4c('0x20');var _0xe71d88=_0xa0a812[_0x7b4c('0x21')];var _0x36c02a=_0x2471b3?0x0:_0x2a0e2f['offset'];var _0x3ce10c=_0x2471b3?_0xa0a812[_0x7b4c('0x21')]:_0x2a0e2f[_0x7b4c('0x1f')]+_0x2a0e2f[_0x7b4c('0x22')];var _0x2d4c72;if(_0x3ce10c>=_0xe71d88){_0x3ce10c=_0xe71d88;_0x2d4c72=0xc8;}else{_0x2d4c72=0xce;}_0xdc71cd[_0x7b4c('0x1c')](_0x2d4c72);return _0xdc71cd[_0x7b4c('0x23')](_0x7b4c('0x24'),_0x36c02a+'-'+_0x3ce10c+'/'+_0xe71d88)[_0x7b4c('0x1e')](_0xa0a812);}return null;};}function patchUpdates(_0x55e3df){return function(_0x1f06ec){try{jsonpatch[_0x7b4c('0x25')](_0x1f06ec,_0x55e3df,!![]);}catch(_0x11996d){return BPromise[_0x7b4c('0x26')](_0x11996d);}return _0x1f06ec[_0x7b4c('0x27')]();};}function saveUpdates(_0x168ac9,_0x176704){return function(_0x3d4826){if(_0x3d4826){return _0x3d4826[_0x7b4c('0x28')](_0x168ac9)[_0x7b4c('0x29')](function(_0x5eec1e){return _0x5eec1e;});}return null;};}function removeEntity(_0x45438c,_0x4350c9){return function(_0x276271){if(_0x276271){return _0x276271[_0x7b4c('0x2a')]()[_0x7b4c('0x29')](function(){_0x45438c[_0x7b4c('0x1c')](0xcc)[_0x7b4c('0x1d')]();});}};}function handleEntityNotFound(_0x459eb4,_0x1f311e){return function(_0x1a69db){if(!_0x1a69db){_0x459eb4[_0x7b4c('0x1b')](0x194);}return _0x1a69db;};}function handleError(_0x257da2,_0x316e5f){_0x316e5f=_0x316e5f||0x1f4;return function(_0x501f75){logger[_0x7b4c('0x2b')](_0x501f75[_0x7b4c('0x2c')]);if(_0x501f75[_0x7b4c('0x2d')]){delete _0x501f75[_0x7b4c('0x2d')];}_0x257da2[_0x7b4c('0x1c')](_0x316e5f)[_0x7b4c('0x2e')](_0x501f75);};}exports[_0x7b4c('0x2f')]=function(_0x2552f9,_0x3e4a46){var _0x9a799b={},_0x3585cd={},_0x130ace={'count':0x0,'rows':[]};var _0x3544bc=_[_0x7b4c('0x30')](db[_0x7b4c('0x31')][_0x7b4c('0x32')],function(_0x1d0724){return{'name':_0x1d0724[_0x7b4c('0x33')],'type':_0x1d0724[_0x7b4c('0x34')]['key']};});_0x3585cd['model']=_['differenceBy'](_[_0x7b4c('0x30')](_0x3544bc,_0x7b4c('0x2d')),[_0x7b4c('0x35')]);_0x3585cd[_0x7b4c('0x36')]=_['keys'](_0x2552f9[_0x7b4c('0x36')]);_0x3585cd[_0x7b4c('0x37')]=_['intersection'](_0x3585cd[_0x7b4c('0x38')],_0x3585cd['query']);_0x9a799b[_0x7b4c('0x39')]=_[_0x7b4c('0x3a')](_0x3585cd[_0x7b4c('0x38')],qs['fields'](_0x2552f9[_0x7b4c('0x36')][_0x7b4c('0x3b')]));_0x9a799b['attributes']=_0x9a799b[_0x7b4c('0x39')][_0x7b4c('0x3c')]?_0x9a799b[_0x7b4c('0x39')]:_0x3585cd[_0x7b4c('0x38')];if(!_0x2552f9['query']['hasOwnProperty'](_0x7b4c('0x3d'))){_0x9a799b[_0x7b4c('0x22')]=qs['limit'](_0x2552f9[_0x7b4c('0x36')]['limit']);_0x9a799b['offset']=qs[_0x7b4c('0x1f')](_0x2552f9[_0x7b4c('0x36')][_0x7b4c('0x1f')]);}_0x9a799b[_0x7b4c('0x3e')]=qs['sort'](_0x2552f9[_0x7b4c('0x36')][_0x7b4c('0x3f')]);_0x9a799b[_0x7b4c('0x40')]=qs[_0x7b4c('0x37')](_[_0x7b4c('0x41')](_0x2552f9[_0x7b4c('0x36')],_0x3585cd[_0x7b4c('0x37')]),_0x3544bc);if(_0x2552f9['query']['filter']){_0x9a799b[_0x7b4c('0x40')]=_[_0x7b4c('0x42')](_0x9a799b[_0x7b4c('0x40')],{'$or':_[_0x7b4c('0x30')](_0x3544bc,function(_0xb8486d){if(_0xb8486d['type']!==_0x7b4c('0x43')){var _0x902367={};_0x902367[_0xb8486d[_0x7b4c('0x2d')]]={'$like':'%'+_0x2552f9[_0x7b4c('0x36')][_0x7b4c('0x44')]+'%'};return _0x902367;}})});}_0x9a799b=_[_0x7b4c('0x42')]({},_0x9a799b,_0x2552f9[_0x7b4c('0x45')]);var _0x1080fc={'where':_0x9a799b[_0x7b4c('0x40')]};return db['ScreenRecording'][_0x7b4c('0x21')](_0x1080fc)['then'](function(_0x2a3a74){_0x130ace['count']=_0x2a3a74;if(_0x2552f9[_0x7b4c('0x36')][_0x7b4c('0x46')]){_0x9a799b['include']=[{'all':!![]}];}return db['ScreenRecording'][_0x7b4c('0x47')](_0x9a799b);})[_0x7b4c('0x29')](function(_0x1def44){_0x130ace[_0x7b4c('0x48')]=_0x1def44;return _0x130ace;})['then'](respondWithFilteredResult(_0x3e4a46,_0x9a799b))[_0x7b4c('0x49')](handleError(_0x3e4a46,null));};exports[_0x7b4c('0x4a')]=function(_0x100774,_0x5d4ed8){var _0x45ad59={'raw':![],'where':{'id':_0x100774['params']['id']}},_0x4b4757={};_0x4b4757[_0x7b4c('0x38')]=_['keys'](db[_0x7b4c('0x31')][_0x7b4c('0x32')]);_0x4b4757[_0x7b4c('0x36')]=_[_0x7b4c('0x4b')](_0x100774[_0x7b4c('0x36')]);_0x4b4757[_0x7b4c('0x37')]=_[_0x7b4c('0x3a')](_0x4b4757[_0x7b4c('0x38')],_0x4b4757[_0x7b4c('0x36')]);_0x45ad59['attributes']=_[_0x7b4c('0x3a')](_0x4b4757['model'],qs['fields'](_0x100774[_0x7b4c('0x36')][_0x7b4c('0x3b')]));_0x45ad59['attributes']=_0x45ad59['attributes'][_0x7b4c('0x3c')]?_0x45ad59[_0x7b4c('0x39')]:_0x4b4757[_0x7b4c('0x38')];if(_0x100774[_0x7b4c('0x36')][_0x7b4c('0x46')]){_0x45ad59[_0x7b4c('0x4c')]=[{'all':!![]}];}_0x45ad59=_[_0x7b4c('0x42')]({},_0x45ad59,_0x100774[_0x7b4c('0x45')]);return db['ScreenRecording'][_0x7b4c('0x4d')](_0x45ad59)[_0x7b4c('0x29')](handleEntityNotFound(_0x5d4ed8,null))[_0x7b4c('0x29')](respondWithResult(_0x5d4ed8,null))[_0x7b4c('0x49')](handleError(_0x5d4ed8,null));};exports[_0x7b4c('0x4e')]=function(_0x379f15,_0x11a6f9){return db[_0x7b4c('0x31')][_0x7b4c('0x4e')](_0x379f15['body'],{})['then'](respondWithResult(_0x11a6f9,0xc9))[_0x7b4c('0x49')](handleError(_0x11a6f9,null));};exports[_0x7b4c('0x28')]=function(_0x97eadf,_0x5d4192){if(_0x97eadf[_0x7b4c('0x4f')]['id']){delete _0x97eadf[_0x7b4c('0x4f')]['id'];}delete _0x97eadf['body'][_0x7b4c('0x50')];delete _0x97eadf['body'][_0x7b4c('0x51')];delete _0x97eadf['body'][_0x7b4c('0x52')];delete _0x97eadf['body'][_0x7b4c('0x53')];return db[_0x7b4c('0x31')]['find']({'where':{'id':_0x97eadf['params']['id']}})[_0x7b4c('0x29')](handleEntityNotFound(_0x5d4192,null))[_0x7b4c('0x29')](saveUpdates(_0x97eadf[_0x7b4c('0x4f')],null))['then'](respondWithResult(_0x5d4192,null))['catch'](handleError(_0x5d4192,null));};exports[_0x7b4c('0x54')]=function(_0x1c118a,_0x4cbf1b){return db['ScreenRecording'][_0x7b4c('0x54')]()[_0x7b4c('0x29')](respondWithResult(_0x4cbf1b,null))[_0x7b4c('0x49')](handleError(_0x4cbf1b,null));};exports['download']=function(_0x1d017d,_0x2f009a,_0x4aaf57){var _0x484e80=require(_0x7b4c('0x55'));var _0x4d8491=![];var _0x59db20={};if(_0x1d017d[_0x7b4c('0x36')]['type']&&_0x1d017d['query'][_0x7b4c('0x34')]===_0x7b4c('0x56')){_0x59db20[_0x7b4c('0x56')]=_0x1d017d[_0x7b4c('0x57')]['id'];}else{_0x59db20['id']=_0x1d017d['params']['id'];}return db['ScreenRecording'][_0x7b4c('0x4d')]({'where':_0x59db20,'attributes':['id',_0x7b4c('0x53')],'raw':!![]})[_0x7b4c('0x29')](handleEntityNotFound(_0x2f009a,null))['then'](function(_0x255262){if(_0x255262){var _0x3d81fb=path[_0x7b4c('0x58')](config['root'],_0x7b4c('0x59'),_0x255262[_0x7b4c('0x53')]);var _0x529803=util[_0x7b4c('0x35')](_0x7b4c('0x5a'),_0x3d81fb);if(fs[_0x7b4c('0x5b')](_0x529803)){_0x4d8491=!![];return _0x484e80[_0x7b4c('0x5c')](_0x529803,_0x3d81fb,config[_0x7b4c('0x5d')][_0x7b4c('0x5e')])[_0x7b4c('0x29')](function(){return _0x255262;});}return _0x255262;}})['then'](function(_0x4443d0){if(_0x4443d0){var _0x2dc79a=path['join'](config[_0x7b4c('0x5f')],_0x7b4c('0x59'),_0x4443d0[_0x7b4c('0x53')]);if(!fs[_0x7b4c('0x5b')](_0x2dc79a)){throw new db['Sequelize'][(_0x7b4c('0x60'))]('ScreenRecording\x20not\x20found');}if(_0x4443d0['filename']){return _0x2f009a[_0x7b4c('0x61')](_0x2dc79a,_0x4443d0[_0x7b4c('0x62')]+path[_0x7b4c('0x63')](_0x2dc79a),function(){if(_0x4d8491){fs[_0x7b4c('0x64')](_0x2dc79a);}});}else{return _0x2f009a[_0x7b4c('0x61')](_0x2dc79a,function(_0x5b24f6){if(_0x4d8491){fs['unlink'](_0x2dc79a);}});}}})[_0x7b4c('0x49')](function(_0x3c84af){if(_0x3c84af[_0x7b4c('0x65')]==='ScreenRecording\x20not\x20found'){_0x2f009a[_0x7b4c('0x1c')](0x194)[_0x7b4c('0x2e')](_0x7b4c('0x66'));}else{return handleError(_0x2f009a,null);}});};exports['destroy']=function(_0x222b47,_0x3b2144){return db[_0x7b4c('0x31')]['find']({'where':{'id':_0x222b47[_0x7b4c('0x57')]['id']}})[_0x7b4c('0x29')](function(_0x4ac03e){if(_[_0x7b4c('0x67')](_0x4ac03e)){throw new ReferenceError('Entity\x20not\x20found');}return _0x4ac03e;})[_0x7b4c('0x29')](function(_0x11ae6e){var _0x3a3713=path['join'](config['root'],_0x7b4c('0x59'),_0x11ae6e[_0x7b4c('0x53')]);logger[_0x7b4c('0x68')]('cancellazione\x20fisica\x20documento\x20%s',_0x3a3713);if(!_[_0x7b4c('0x67')](_0x11ae6e['value'])&&fs[_0x7b4c('0x5b')](_0x3a3713)){logger[_0x7b4c('0x68')](_0x7b4c('0x69')+_0x3a3713+_0x7b4c('0x6a'));fs[_0x7b4c('0x6b')](_0x3a3713);}_0x3a3713=_0x3a3713+'.cypher';if(!_[_0x7b4c('0x67')](_0x11ae6e[_0x7b4c('0x53')])&&fs['existsSync'](_0x3a3713)){logger[_0x7b4c('0x68')](_0x7b4c('0x69')+_0x3a3713+_0x7b4c('0x6a'));fs[_0x7b4c('0x6b')](_0x3a3713);}return _0x11ae6e;})[_0x7b4c('0x29')](function(_0x2befd7){if(!_0x2befd7)throw new InternalError();return _0x2befd7[_0x7b4c('0x2a')]();})[_0x7b4c('0x29')](function(){_0x3b2144['status'](0xcc)[_0x7b4c('0x1d')]();})[_0x7b4c('0x49')](handleError(_0x3b2144,null));}; \ No newline at end of file +var _0xb458=['differenceBy','format','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','filter','options','ScreenRecording','includeAll','rows','catch','show','params','include','create','body','createdAt','closedAt','find','describe','download','uniqueid','value','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model'];(function(_0x50558f,_0x2b9e95){var _0x3a4834=function(_0x18f2f6){while(--_0x18f2f6){_0x50558f['push'](_0x50558f['shift']());}};_0x3a4834(++_0x2b9e95);}(_0xb458,0x103));var _0x8b45=function(_0x2420c8,_0x59cdcc){_0x2420c8=_0x2420c8-0x0;var _0x46e13d=_0xb458[_0x2420c8];return _0x46e13d;};'use strict';var emlformat=require(_0x8b45('0x0'));var rimraf=require(_0x8b45('0x1'));var zipdir=require(_0x8b45('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8b45('0x3'));var BPromise=require(_0x8b45('0x4'));var Mustache=require(_0x8b45('0x5'));var util=require(_0x8b45('0x6'));var path=require('path');var sox=require(_0x8b45('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b45('0x8'));var _=require(_0x8b45('0x9'));var squel=require(_0x8b45('0xa'));var crypto=require(_0x8b45('0xb'));var jsforce=require(_0x8b45('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8b45('0xd'));var querystring=require(_0x8b45('0xe'));var Papa=require(_0x8b45('0xf'));var Redis=require(_0x8b45('0x10'));var authService=require(_0x8b45('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8b45('0x12'));var hardwareService=require(_0x8b45('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8b45('0x14'));var db=require(_0x8b45('0x15'))['db'];function respondWithStatusCode(_0x37c220,_0x52c4db){_0x52c4db=_0x52c4db||0xcc;return function(_0x30d38c){if(_0x30d38c){return _0x37c220[_0x8b45('0x16')](_0x52c4db);}return _0x37c220[_0x8b45('0x17')](_0x52c4db)[_0x8b45('0x18')]();};}function respondWithResult(_0x32babc,_0x2ad2ae){_0x2ad2ae=_0x2ad2ae||0xc8;return function(_0x5f0b20){if(_0x5f0b20){return _0x32babc['status'](_0x2ad2ae)[_0x8b45('0x19')](_0x5f0b20);}};}function respondWithFilteredResult(_0x23f1dd,_0x445170){return function(_0x39c1d1){if(_0x39c1d1){var _0x4781d7=typeof _0x445170[_0x8b45('0x1a')]===_0x8b45('0x1b')&&typeof _0x445170[_0x8b45('0x1c')]===_0x8b45('0x1b');var _0x391d1e=_0x39c1d1[_0x8b45('0x1d')];var _0x21d5b2=_0x4781d7?0x0:_0x445170[_0x8b45('0x1a')];var _0x43ffb7=_0x4781d7?_0x39c1d1[_0x8b45('0x1d')]:_0x445170[_0x8b45('0x1a')]+_0x445170[_0x8b45('0x1c')];var _0x309e23;if(_0x43ffb7>=_0x391d1e){_0x43ffb7=_0x391d1e;_0x309e23=0xc8;}else{_0x309e23=0xce;}_0x23f1dd['status'](_0x309e23);return _0x23f1dd[_0x8b45('0x1e')](_0x8b45('0x1f'),_0x21d5b2+'-'+_0x43ffb7+'/'+_0x391d1e)[_0x8b45('0x19')](_0x39c1d1);}return null;};}function patchUpdates(_0x46e21a){return function(_0x3e1438){try{jsonpatch[_0x8b45('0x20')](_0x3e1438,_0x46e21a,!![]);}catch(_0x2f4f1c){return BPromise[_0x8b45('0x21')](_0x2f4f1c);}return _0x3e1438['save']();};}function saveUpdates(_0x52f93f,_0x41154a){return function(_0x580e17){if(_0x580e17){return _0x580e17[_0x8b45('0x22')](_0x52f93f)[_0x8b45('0x23')](function(_0x30f405){return _0x30f405;});}return null;};}function removeEntity(_0x45e2db,_0x165570){return function(_0x2b8526){if(_0x2b8526){return _0x2b8526[_0x8b45('0x24')]()['then'](function(){_0x45e2db['status'](0xcc)[_0x8b45('0x18')]();});}};}function handleEntityNotFound(_0x2c2c06,_0x500044){return function(_0x5723a2){if(!_0x5723a2){_0x2c2c06[_0x8b45('0x16')](0x194);}return _0x5723a2;};}function handleError(_0x32f6f0,_0x2ca2d9){_0x2ca2d9=_0x2ca2d9||0x1f4;return function(_0x2f37bc){logger['error'](_0x2f37bc[_0x8b45('0x25')]);if(_0x2f37bc[_0x8b45('0x26')]){delete _0x2f37bc[_0x8b45('0x26')];}_0x32f6f0[_0x8b45('0x17')](_0x2ca2d9)[_0x8b45('0x27')](_0x2f37bc);};}exports[_0x8b45('0x28')]=function(_0x461017,_0x234f62){var _0x1733a7={},_0xf21bd1={},_0x339c73={'count':0x0,'rows':[]};var _0x1ba2d4=_[_0x8b45('0x29')](db['ScreenRecording'][_0x8b45('0x2a')],function(_0x36db96){return{'name':_0x36db96[_0x8b45('0x2b')],'type':_0x36db96[_0x8b45('0x2c')][_0x8b45('0x2d')]};});_0xf21bd1[_0x8b45('0x2e')]=_[_0x8b45('0x2f')](_[_0x8b45('0x29')](_0x1ba2d4,'name'),[_0x8b45('0x30')]);_0xf21bd1[_0x8b45('0x31')]=_[_0x8b45('0x32')](_0x461017[_0x8b45('0x31')]);_0xf21bd1[_0x8b45('0x33')]=_['intersection'](_0xf21bd1[_0x8b45('0x2e')],_0xf21bd1['query']);_0x1733a7['attributes']=_[_0x8b45('0x34')](_0xf21bd1[_0x8b45('0x2e')],qs[_0x8b45('0x35')](_0x461017[_0x8b45('0x31')][_0x8b45('0x35')]));_0x1733a7[_0x8b45('0x36')]=_0x1733a7['attributes'][_0x8b45('0x37')]?_0x1733a7[_0x8b45('0x36')]:_0xf21bd1[_0x8b45('0x2e')];if(!_0x461017[_0x8b45('0x31')]['hasOwnProperty'](_0x8b45('0x38'))){_0x1733a7[_0x8b45('0x1c')]=qs[_0x8b45('0x1c')](_0x461017['query'][_0x8b45('0x1c')]);_0x1733a7[_0x8b45('0x1a')]=qs[_0x8b45('0x1a')](_0x461017['query'][_0x8b45('0x1a')]);}_0x1733a7[_0x8b45('0x39')]=qs[_0x8b45('0x3a')](_0x461017[_0x8b45('0x31')]['sort']);_0x1733a7[_0x8b45('0x3b')]=qs[_0x8b45('0x33')](_[_0x8b45('0x3c')](_0x461017[_0x8b45('0x31')],_0xf21bd1[_0x8b45('0x33')]),_0x1ba2d4);if(_0x461017[_0x8b45('0x31')]['filter']){_0x1733a7['where']=_[_0x8b45('0x3d')](_0x1733a7[_0x8b45('0x3b')],{'$or':_[_0x8b45('0x29')](_0x1ba2d4,function(_0x12d4b2){if(_0x12d4b2[_0x8b45('0x2c')]!=='VIRTUAL'){var _0x120068={};_0x120068[_0x12d4b2['name']]={'$like':'%'+_0x461017[_0x8b45('0x31')][_0x8b45('0x3e')]+'%'};return _0x120068;}})});}_0x1733a7=_[_0x8b45('0x3d')]({},_0x1733a7,_0x461017[_0x8b45('0x3f')]);var _0x254f17={'where':_0x1733a7[_0x8b45('0x3b')]};return db[_0x8b45('0x40')][_0x8b45('0x1d')](_0x254f17)[_0x8b45('0x23')](function(_0x2ca00e){_0x339c73[_0x8b45('0x1d')]=_0x2ca00e;if(_0x461017['query'][_0x8b45('0x41')]){_0x1733a7['include']=[{'all':!![]}];}return db[_0x8b45('0x40')]['findAll'](_0x1733a7);})[_0x8b45('0x23')](function(_0x224c45){_0x339c73[_0x8b45('0x42')]=_0x224c45;return _0x339c73;})[_0x8b45('0x23')](respondWithFilteredResult(_0x234f62,_0x1733a7))[_0x8b45('0x43')](handleError(_0x234f62,null));};exports[_0x8b45('0x44')]=function(_0x58e663,_0x6fbca4){var _0x5916c7={'raw':![],'where':{'id':_0x58e663[_0x8b45('0x45')]['id']}},_0x4c56c8={};_0x4c56c8[_0x8b45('0x2e')]=_[_0x8b45('0x32')](db['ScreenRecording'][_0x8b45('0x2a')]);_0x4c56c8['query']=_[_0x8b45('0x32')](_0x58e663[_0x8b45('0x31')]);_0x4c56c8[_0x8b45('0x33')]=_[_0x8b45('0x34')](_0x4c56c8[_0x8b45('0x2e')],_0x4c56c8[_0x8b45('0x31')]);_0x5916c7['attributes']=_[_0x8b45('0x34')](_0x4c56c8[_0x8b45('0x2e')],qs[_0x8b45('0x35')](_0x58e663[_0x8b45('0x31')][_0x8b45('0x35')]));_0x5916c7[_0x8b45('0x36')]=_0x5916c7[_0x8b45('0x36')][_0x8b45('0x37')]?_0x5916c7[_0x8b45('0x36')]:_0x4c56c8[_0x8b45('0x2e')];if(_0x58e663[_0x8b45('0x31')][_0x8b45('0x41')]){_0x5916c7[_0x8b45('0x46')]=[{'all':!![]}];}_0x5916c7=_[_0x8b45('0x3d')]({},_0x5916c7,_0x58e663[_0x8b45('0x3f')]);return db[_0x8b45('0x40')]['find'](_0x5916c7)['then'](handleEntityNotFound(_0x6fbca4,null))['then'](respondWithResult(_0x6fbca4,null))[_0x8b45('0x43')](handleError(_0x6fbca4,null));};exports[_0x8b45('0x47')]=function(_0x3a1621,_0x473530){return db[_0x8b45('0x40')][_0x8b45('0x47')](_0x3a1621[_0x8b45('0x48')],{})[_0x8b45('0x23')](respondWithResult(_0x473530,0xc9))['catch'](handleError(_0x473530,null));};exports[_0x8b45('0x22')]=function(_0x5d5be2,_0x23b5c6){if(_0x5d5be2[_0x8b45('0x48')]['id']){delete _0x5d5be2[_0x8b45('0x48')]['id'];}delete _0x5d5be2[_0x8b45('0x48')]['duration'];delete _0x5d5be2[_0x8b45('0x48')][_0x8b45('0x49')];delete _0x5d5be2['body'][_0x8b45('0x4a')];delete _0x5d5be2[_0x8b45('0x48')]['value'];return db[_0x8b45('0x40')][_0x8b45('0x4b')]({'where':{'id':_0x5d5be2[_0x8b45('0x45')]['id']}})[_0x8b45('0x23')](handleEntityNotFound(_0x23b5c6,null))[_0x8b45('0x23')](saveUpdates(_0x5d5be2[_0x8b45('0x48')],null))['then'](respondWithResult(_0x23b5c6,null))['catch'](handleError(_0x23b5c6,null));};exports[_0x8b45('0x4c')]=function(_0x2a2e59,_0x2d5b31){return db['ScreenRecording'][_0x8b45('0x4c')]()[_0x8b45('0x23')](respondWithResult(_0x2d5b31,null))[_0x8b45('0x43')](handleError(_0x2d5b31,null));};exports[_0x8b45('0x4d')]=function(_0x2d6b66,_0x597402,_0x34c05d){var _0xa92a05=require('../../components/encryptor');var _0x422da0=![];var _0x4c3f38={};if(_0x2d6b66[_0x8b45('0x31')][_0x8b45('0x2c')]&&_0x2d6b66[_0x8b45('0x31')][_0x8b45('0x2c')]==='uniqueid'){_0x4c3f38[_0x8b45('0x4e')]=_0x2d6b66[_0x8b45('0x45')]['id'];}else{_0x4c3f38['id']=_0x2d6b66[_0x8b45('0x45')]['id'];}return db[_0x8b45('0x40')][_0x8b45('0x4b')]({'where':_0x4c3f38,'attributes':['id',_0x8b45('0x4f')],'raw':!![]})[_0x8b45('0x23')](handleEntityNotFound(_0x597402,null))[_0x8b45('0x23')](function(_0x446fe5){if(_0x446fe5){var _0x5ba878=path[_0x8b45('0x50')](config[_0x8b45('0x51')],_0x8b45('0x52'),_0x446fe5[_0x8b45('0x4f')]);var _0x1851c2=util['format'](_0x8b45('0x53'),_0x5ba878);if(fs[_0x8b45('0x54')](_0x1851c2)){_0x422da0=!![];return _0xa92a05[_0x8b45('0x55')](_0x1851c2,_0x5ba878,config['secrets'][_0x8b45('0x56')])[_0x8b45('0x23')](function(){return _0x446fe5;});}return _0x446fe5;}})[_0x8b45('0x23')](function(_0x9eacc1){if(_0x9eacc1){var _0x5795ca=path[_0x8b45('0x50')](config[_0x8b45('0x51')],_0x8b45('0x52'),_0x9eacc1[_0x8b45('0x4f')]);if(!fs['existsSync'](_0x5795ca)){throw new db[(_0x8b45('0x57'))][(_0x8b45('0x58'))](_0x8b45('0x59'));}if(_0x9eacc1[_0x8b45('0x5a')]){return _0x597402[_0x8b45('0x4d')](_0x5795ca,_0x9eacc1['filename']+path[_0x8b45('0x5b')](_0x5795ca),function(){if(_0x422da0){fs['unlink'](_0x5795ca);}});}else{return _0x597402[_0x8b45('0x4d')](_0x5795ca,function(_0x2f7ab0){if(_0x422da0){fs[_0x8b45('0x5c')](_0x5795ca);}});}}})[_0x8b45('0x43')](function(_0x6a77bd){if(_0x6a77bd[_0x8b45('0x5d')]==='ScreenRecording\x20not\x20found'){_0x597402['status'](0x194)[_0x8b45('0x27')](_0x8b45('0x5e'));}else{return handleError(_0x597402,null);}});};exports['destroy']=function(_0x461c83,_0x239330){return db[_0x8b45('0x40')]['find']({'where':{'id':_0x461c83['params']['id']}})[_0x8b45('0x23')](function(_0x8e5a41){if(_['isNil'](_0x8e5a41)){throw new ReferenceError(_0x8b45('0x5f'));}return _0x8e5a41;})['then'](function(_0xf1ab37){var _0x560c51=path['join'](config[_0x8b45('0x51')],_0x8b45('0x52'),_0xf1ab37['value']);logger[_0x8b45('0x60')](_0x8b45('0x61'),_0x560c51);if(!_[_0x8b45('0x62')](_0xf1ab37[_0x8b45('0x4f')])&&fs[_0x8b45('0x54')](_0x560c51)){logger['info'](_0x8b45('0x63')+_0x560c51+_0x8b45('0x64'));fs[_0x8b45('0x65')](_0x560c51);}_0x560c51=_0x560c51+'.cypher';if(!_['isNil'](_0xf1ab37[_0x8b45('0x4f')])&&fs['existsSync'](_0x560c51)){logger[_0x8b45('0x60')]('File:\x20\x22'+_0x560c51+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x560c51);}return _0xf1ab37;})[_0x8b45('0x23')](function(_0x4df581){if(!_0x4df581)throw new InternalError();return _0x4df581[_0x8b45('0x24')]();})[_0x8b45('0x23')](function(){_0x239330['status'](0xcc)[_0x8b45('0x18')]();})[_0x8b45('0x43')](handleError(_0x239330,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index c0d8ab1..9b5cadf 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 _0x2189=['ScreenRecording','interactionid','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define'];(function(_0x35463b,_0x69245e){var _0x33716f=function(_0x498f25){while(--_0x498f25){_0x35463b['push'](_0x35463b['shift']());}};_0x33716f(++_0x69245e);}(_0x2189,0xc2));var _0x9218=function(_0x7add71,_0x5c3250){_0x7add71=_0x7add71-0x0;var _0x2acd3b=_0x2189[_0x7add71];return _0x2acd3b;};'use strict';var _=require(_0x9218('0x0'));var util=require('util');var logger=require(_0x9218('0x1'))(_0x9218('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9218('0x3'));var fs=require('fs');var path=require(_0x9218('0x4'));var rimraf=require(_0x9218('0x5'));var config=require(_0x9218('0x6'));var attributes=require(_0x9218('0x7'));module[_0x9218('0x8')]=function(_0x5417f6,_0x29a86f){return _0x5417f6[_0x9218('0x9')](_0x9218('0xa'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x9218('0xb'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3153=['util','../../config/logger','api','moment','path','./screenRecording.attributes','exports','define','ScreenRecording','interactionid'];(function(_0x30a7ba,_0x1cfe64){var _0x3148ec=function(_0x8f3886){while(--_0x8f3886){_0x30a7ba['push'](_0x30a7ba['shift']());}};_0x3148ec(++_0x1cfe64);}(_0x3153,0xfa));var _0x3315=function(_0x21a8b3,_0x3f069e){_0x21a8b3=_0x21a8b3-0x0;var _0x56149e=_0x3153[_0x21a8b3];return _0x56149e;};'use strict';var _=require('lodash');var util=require(_0x3315('0x0'));var logger=require(_0x3315('0x1'))(_0x3315('0x2'));var moment=require(_0x3315('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3315('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3315('0x5'));module[_0x3315('0x6')]=function(_0x3f538f,_0x4eeee5){return _0x3f538f[_0x3315('0x7')](_0x3315('0x8'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x3315('0x9'),'fields':[_0x3315('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index c70753b..235dbba 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 _0x44d5=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x44d5,0xfb));var _0x544d=function(_0x3e6898,_0x25681e){_0x3e6898=_0x3e6898-0x0;var _0x419360=_0x44d5[_0x3e6898];return _0x419360;};'use strict';var _=require(_0x544d('0x0'));var util=require(_0x544d('0x1'));var moment=require(_0x544d('0x2'));var BPromise=require(_0x544d('0x3'));var rs=require(_0x544d('0x4'));var fs=require('fs');var Redis=require(_0x544d('0x5'));var db=require(_0x544d('0x6'))['db'];var utils=require(_0x544d('0x7'));var logger=require(_0x544d('0x8'))(_0x544d('0x9'));var config=require(_0x544d('0xa'));var jayson=require(_0x544d('0xb'));var client=jayson[_0x544d('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54f7ba,_0x2451b4,_0x3f97b3){return new BPromise(function(_0x2250a9,_0x455a73){return client[_0x544d('0xd')](_0x54f7ba,_0x3f97b3)[_0x544d('0xe')](function(_0xe19bf0){logger[_0x544d('0xf')](_0x544d('0x10'),_0x2451b4,_0x544d('0x11'));logger[_0x544d('0x12')](_0x544d('0x13'),_0x2451b4,_0x544d('0x11'),JSON[_0x544d('0x14')](_0xe19bf0));if(_0xe19bf0['error']){if(_0xe19bf0['error'][_0x544d('0x15')]===0x1f4){logger[_0x544d('0x16')](_0x544d('0x10'),_0x2451b4,_0xe19bf0[_0x544d('0x16')][_0x544d('0x17')]);return _0x455a73(_0xe19bf0[_0x544d('0x16')][_0x544d('0x17')]);}logger[_0x544d('0x16')](_0x544d('0x10'),_0x2451b4,_0xe19bf0[_0x544d('0x16')][_0x544d('0x17')]);return _0x2250a9(_0xe19bf0[_0x544d('0x16')][_0x544d('0x17')]);}else{logger[_0x544d('0xf')](_0x544d('0x10'),_0x2451b4,'request\x20sent');_0x2250a9(_0xe19bf0[_0x544d('0x18')][_0x544d('0x17')]);}})['catch'](function(_0x28b7a8){logger[_0x544d('0x16')](_0x544d('0x10'),_0x2451b4,_0x28b7a8);_0x455a73(_0x28b7a8);});});} \ No newline at end of file +var _0x3341=['catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','error','code','message','ScreenRecording,\x20%s,\x20%s','request\x20sent','result'];(function(_0x1771ce,_0x10ec39){var _0x33c568=function(_0x1bfefd){while(--_0x1bfefd){_0x1771ce['push'](_0x1771ce['shift']());}};_0x33c568(++_0x10ec39);}(_0x3341,0x1a3));var _0x1334=function(_0x4dabe8,_0x11240b){_0x4dabe8=_0x4dabe8-0x0;var _0x56a5a9=_0x3341[_0x4dabe8];return _0x56a5a9;};'use strict';var _=require('lodash');var util=require(_0x1334('0x0'));var moment=require(_0x1334('0x1'));var BPromise=require(_0x1334('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1334('0x3'));var db=require(_0x1334('0x4'))['db'];var utils=require(_0x1334('0x5'));var logger=require(_0x1334('0x6'))(_0x1334('0x7'));var config=require(_0x1334('0x8'));var jayson=require(_0x1334('0x9'));var client=jayson['client'][_0x1334('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18f023,_0x17870c,_0x5e1ef4){return new BPromise(function(_0x51c614,_0x59248b){return client[_0x1334('0xb')](_0x18f023,_0x5e1ef4)[_0x1334('0xc')](function(_0x47f4f2){logger[_0x1334('0xd')]('ScreenRecording,\x20%s,\x20%s',_0x17870c,'request\x20sent');logger[_0x1334('0xe')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x17870c,'request\x20sent',JSON['stringify'](_0x47f4f2));if(_0x47f4f2[_0x1334('0xf')]){if(_0x47f4f2[_0x1334('0xf')][_0x1334('0x10')]===0x1f4){logger[_0x1334('0xf')]('ScreenRecording,\x20%s,\x20%s',_0x17870c,_0x47f4f2[_0x1334('0xf')][_0x1334('0x11')]);return _0x59248b(_0x47f4f2[_0x1334('0xf')][_0x1334('0x11')]);}logger[_0x1334('0xf')](_0x1334('0x12'),_0x17870c,_0x47f4f2[_0x1334('0xf')]['message']);return _0x51c614(_0x47f4f2[_0x1334('0xf')][_0x1334('0x11')]);}else{logger[_0x1334('0xd')]('ScreenRecording,\x20%s,\x20%s',_0x17870c,_0x1334('0x13'));_0x51c614(_0x47f4f2[_0x1334('0x14')][_0x1334('0x11')]);}})[_0x1334('0x15')](function(_0x16e3cc){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x17870c,_0x16e3cc);_0x59248b(_0x16e3cc);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index d19c4c4..2aaae62 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 _0x1a21=['/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','extname','post','single','file','originalname','addLogoLogin','preferred','addPreferred','favicon','addFavicon','put','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/:id','show','/:id/logo','getLogo','/:id/logo_login'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1a21,0x1bd));var _0x11a2=function(_0x3e8cae,_0x4cb96a){_0x3e8cae=_0x3e8cae-0x0;var _0x45c4d6=_0x1a21[_0x3e8cae];return _0x45c4d6;};'use strict';var multer=require(_0x11a2('0x0'));var util=require(_0x11a2('0x1'));var path=require(_0x11a2('0x2'));var timeout=require(_0x11a2('0x3'));var express=require(_0x11a2('0x4'));var router=express[_0x11a2('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x11a2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x11a2('0x7'));var controller=require(_0x11a2('0x8'));router[_0x11a2('0x9')]('/',auth[_0x11a2('0xa')](),controller[_0x11a2('0xb')]);router['get']('/now',controller['getDate']);router[_0x11a2('0x9')](_0x11a2('0xc'),controller[_0x11a2('0xd')]);router['get'](_0x11a2('0xe'),controller[_0x11a2('0xf')]);router['get'](_0x11a2('0x10'),controller['getLogoLogin']);router[_0x11a2('0x9')](_0x11a2('0x11'),controller[_0x11a2('0x12')]);router[_0x11a2('0x9')](_0x11a2('0x13'),controller[_0x11a2('0x14')]);router['get'](_0x11a2('0x15'),controller[_0x11a2('0x16')]);var upload=multer({'storage':multer[_0x11a2('0x17')]({'destination':function(_0x2a82e6,_0x3dc284,_0x358be2){_0x358be2(null,path[_0x11a2('0x18')](config[_0x11a2('0x19')],_0x11a2('0x1a')));},'filename':function(_0x1894dd,_0x29c4b0,_0x33b592){_0x33b592(null,util[_0x11a2('0x1b')](_0x11a2('0x1c'),_0x11a2('0x1d'),path[_0x11a2('0x1e')](_0x29c4b0['originalname'])));}})});router[_0x11a2('0x1f')](_0x11a2('0xe'),upload[_0x11a2('0x20')](_0x11a2('0x21')),controller['addLogo']);var upload=multer({'storage':multer[_0x11a2('0x17')]({'destination':function(_0x3c45b1,_0x1e9ca4,_0x448fe7){_0x448fe7(null,path[_0x11a2('0x18')](config[_0x11a2('0x19')],_0x11a2('0x1a')));},'filename':function(_0x4fdbf8,_0x6d64eb,_0x48f955){_0x48f955(null,util[_0x11a2('0x1b')]('%s%s','logologin',path['extname'](_0x6d64eb[_0x11a2('0x22')])));}})});router[_0x11a2('0x1f')](_0x11a2('0x10'),upload[_0x11a2('0x20')](_0x11a2('0x21')),controller[_0x11a2('0x23')]);var upload=multer({'storage':multer[_0x11a2('0x17')]({'destination':function(_0x40c32e,_0x47c727,_0x29c51f){_0x29c51f(null,path[_0x11a2('0x18')](config[_0x11a2('0x19')],_0x11a2('0x1a')));},'filename':function(_0x57b73c,_0xab5a49,_0x3f3416){_0x3f3416(null,util[_0x11a2('0x1b')]('%s%s',_0x11a2('0x24'),path[_0x11a2('0x1e')](_0xab5a49[_0x11a2('0x22')])));}})});router[_0x11a2('0x1f')](_0x11a2('0x13'),upload[_0x11a2('0x20')]('file'),controller[_0x11a2('0x25')]);var upload=multer({'storage':multer[_0x11a2('0x17')]({'destination':function(_0x6db9ca,_0xa8b874,_0x5a0f0f){_0x5a0f0f(null,path[_0x11a2('0x18')](config['root'],_0x11a2('0x1a')));},'filename':function(_0x1c2bb2,_0x3c016f,_0x2b6a8a){_0x2b6a8a(null,util[_0x11a2('0x1b')](_0x11a2('0x1c'),_0x11a2('0x26'),path['extname'](_0x3c016f[_0x11a2('0x22')])));}})});router[_0x11a2('0x1f')]('/:id/favicon',upload[_0x11a2('0x20')](_0x11a2('0x21')),controller[_0x11a2('0x27')]);router[_0x11a2('0x28')]('/:id',auth['isAuthenticated'](),controller['update']);module[_0x11a2('0x29')]=router; \ No newline at end of file +var _0x9bf4=['extname','/:id/logo_login','single','favicon','addFavicon','put','isAuthenticated','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./setting.controller','index','get','/now','getDate','/:id','show','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','join','root','server/files/images/logos/','format','%s%s','logo','originalname','post','file','addLogo','diskStorage','logologin'];(function(_0x34db27,_0x4534d4){var _0x137db0=function(_0x39d929){while(--_0x39d929){_0x34db27['push'](_0x34db27['shift']());}};_0x137db0(++_0x4534d4);}(_0x9bf4,0x80));var _0x49bf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9bf4[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x49bf('0x0'));var util=require('util');var path=require(_0x49bf('0x1'));var timeout=require(_0x49bf('0x2'));var express=require('express');var router=express[_0x49bf('0x3')]();var fs_extra=require(_0x49bf('0x4'));var auth=require(_0x49bf('0x5'));var interaction=require(_0x49bf('0x6'));var config=require('../../config/environment');var controller=require(_0x49bf('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x49bf('0x8')]);router[_0x49bf('0x9')](_0x49bf('0xa'),controller[_0x49bf('0xb')]);router[_0x49bf('0x9')](_0x49bf('0xc'),controller[_0x49bf('0xd')]);router['get']('/:id/logo',controller['getLogo']);router[_0x49bf('0x9')]('/:id/logo_login',controller['getLogoLogin']);router['get'](_0x49bf('0xe'),controller[_0x49bf('0xf')]);router[_0x49bf('0x9')](_0x49bf('0x10'),controller[_0x49bf('0x11')]);router[_0x49bf('0x9')](_0x49bf('0x12'),controller[_0x49bf('0x13')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xc5bcbc,_0x1bbe5b,_0x1f338c){_0x1f338c(null,path[_0x49bf('0x14')](config[_0x49bf('0x15')],_0x49bf('0x16')));},'filename':function(_0x3e12e7,_0x4c63ca,_0x363260){_0x363260(null,util[_0x49bf('0x17')](_0x49bf('0x18'),_0x49bf('0x19'),path['extname'](_0x4c63ca[_0x49bf('0x1a')])));}})});router[_0x49bf('0x1b')]('/:id/logo',upload['single'](_0x49bf('0x1c')),controller[_0x49bf('0x1d')]);var upload=multer({'storage':multer[_0x49bf('0x1e')]({'destination':function(_0x1dd717,_0x4f51bb,_0x48d6ea){_0x48d6ea(null,path[_0x49bf('0x14')](config[_0x49bf('0x15')],_0x49bf('0x16')));},'filename':function(_0x512e92,_0x34dbea,_0x1cf005){_0x1cf005(null,util[_0x49bf('0x17')](_0x49bf('0x18'),_0x49bf('0x1f'),path[_0x49bf('0x20')](_0x34dbea[_0x49bf('0x1a')])));}})});router[_0x49bf('0x1b')](_0x49bf('0x21'),upload[_0x49bf('0x22')]('file'),controller['addLogoLogin']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2191db,_0x51fe18,_0x3098bb){_0x3098bb(null,path[_0x49bf('0x14')](config[_0x49bf('0x15')],_0x49bf('0x16')));},'filename':function(_0x32973a,_0xd77781,_0x14aeb6){_0x14aeb6(null,util[_0x49bf('0x17')](_0x49bf('0x18'),'preferred',path['extname'](_0xd77781[_0x49bf('0x1a')])));}})});router['post'](_0x49bf('0x10'),upload[_0x49bf('0x22')](_0x49bf('0x1c')),controller['addPreferred']);var upload=multer({'storage':multer[_0x49bf('0x1e')]({'destination':function(_0x3d8c2f,_0x5383e9,_0x2dc90a){_0x2dc90a(null,path['join'](config[_0x49bf('0x15')],_0x49bf('0x16')));},'filename':function(_0x14108e,_0x15b2f8,_0x9540a6){_0x9540a6(null,util['format'](_0x49bf('0x18'),_0x49bf('0x23'),path[_0x49bf('0x20')](_0x15b2f8['originalname'])));}})});router[_0x49bf('0x1b')](_0x49bf('0x12'),upload['single'](_0x49bf('0x1c')),controller[_0x49bf('0x24')]);router[_0x49bf('0x25')](_0x49bf('0xc'),auth[_0x49bf('0x26')](),controller['update']);module[_0x49bf('0x27')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 225c4df..f1916d2 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(_0x43c9ea,_0x152945){var _0x1169e8=function(_0x4944a8){while(--_0x4944a8){_0x43c9ea['push'](_0x43c9ea['shift']());}};_0x1169e8(++_0x152945);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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(_0x33995f,_0x5532d8){var _0x275726=function(_0x43dc43){while(--_0x43dc43){_0x33995f['push'](_0x33995f['shift']());}};_0x275726(++_0x5532d8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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 59a5594..85f0bec 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 _0xdcd9=['default_favicon.ico','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','catch','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','name','send','index','map','Setting','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','body','addLogo','file','filename','logo','addLogoLogin','getLogo','server/files/images/logos','loginLogo','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','join','root','toLower','default','upperFirst','default_logo.svg','ValidationError','getLogoLogin','getLicense','favicon','default_loginLogo.svg','custom','existsSync','Sequelize','\x20not\x20found','download','gdpr','addFavicon'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xdcd9,0xf5));var _0x9dcd=function(_0x641540,_0x4e591d){_0x641540=_0x641540-0x0;var _0x45346d=_0xdcd9[_0x641540];return _0x45346d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9dcd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9dcd('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9dcd('0x2'));var Mustache=require(_0x9dcd('0x3'));var util=require(_0x9dcd('0x4'));var path=require(_0x9dcd('0x5'));var sox=require(_0x9dcd('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9dcd('0x7'));var _=require(_0x9dcd('0x8'));var squel=require(_0x9dcd('0x9'));var crypto=require(_0x9dcd('0xa'));var jsforce=require(_0x9dcd('0xb'));var deskjs=require(_0x9dcd('0xc'));var toCsv=require(_0x9dcd('0xd'));var querystring=require(_0x9dcd('0xe'));var Papa=require(_0x9dcd('0xf'));var Redis=require(_0x9dcd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9dcd('0x11'));var as=require(_0x9dcd('0x12'));var hardwareService=require(_0x9dcd('0x13'));var logger=require(_0x9dcd('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x9dcd('0x15'));var licenseUtil=require(_0x9dcd('0x16'));var db=require(_0x9dcd('0x17'))['db'];var jayson=require(_0x9dcd('0x18'));var client=jayson[_0x9dcd('0x19')][_0x9dcd('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x31cb53,_0x31a764,_0xf0f83b,_0x5e7fa8){return new BPromise(function(_0x38a8e8,_0x22d809){var _0x2e9e61=_0x5e7fa8||client;return _0x2e9e61[_0x9dcd('0x1b')](_0x31cb53,_0xf0f83b)[_0x9dcd('0x1c')](function(_0x18e795){logger[_0x9dcd('0x1d')](_0x9dcd('0x1e'),_0x31a764,_0x9dcd('0x1f'));logger[_0x9dcd('0x20')](_0x9dcd('0x21'),_0x31a764,_0x9dcd('0x1f'),JSON['stringify'](_0x18e795));if(_0x18e795[_0x9dcd('0x22')]){if(_0x18e795[_0x9dcd('0x22')][_0x9dcd('0x23')]===0x1f4){logger[_0x9dcd('0x22')](_0x9dcd('0x1e'),_0x31a764,_0x18e795['error'][_0x9dcd('0x24')]);return _0x22d809(_0x18e795[_0x9dcd('0x22')][_0x9dcd('0x24')]);}logger[_0x9dcd('0x22')](_0x9dcd('0x1e'),_0x31a764,_0x18e795[_0x9dcd('0x22')][_0x9dcd('0x24')]);return _0x38a8e8(_0x18e795[_0x9dcd('0x22')][_0x9dcd('0x24')]);}else{logger[_0x9dcd('0x1d')]('Setting,\x20%s,\x20%s',_0x31a764,_0x9dcd('0x1f'));_0x38a8e8(_0x18e795['result'][_0x9dcd('0x24')]);}})[_0x9dcd('0x25')](function(_0x24e6c2){logger[_0x9dcd('0x22')]('Setting,\x20%s,\x20%s',_0x31a764,_0x24e6c2);_0x22d809(_0x24e6c2);});});}function respondWithStatusCode(_0x4c6866,_0x348f0d){_0x348f0d=_0x348f0d||0xcc;return function(_0xa1176b){if(_0xa1176b){return _0x4c6866['sendStatus'](_0x348f0d);}return _0x4c6866['status'](_0x348f0d)[_0x9dcd('0x26')]();};}function respondWithResult(_0x1535c5,_0x5ddd69){_0x5ddd69=_0x5ddd69||0xc8;return function(_0x10d07c){if(_0x10d07c){return _0x1535c5[_0x9dcd('0x27')](_0x5ddd69)[_0x9dcd('0x28')](_0x10d07c);}};}function respondWithFilteredResult(_0x3c4b99,_0x97d79d){return function(_0x3c98c2){if(_0x3c98c2){var _0x478751=typeof _0x97d79d[_0x9dcd('0x29')]===_0x9dcd('0x2a')&&typeof _0x97d79d['limit']===_0x9dcd('0x2a');var _0x3ebd92=_0x3c98c2['count'];var _0x5f4b26=_0x478751?0x0:_0x97d79d[_0x9dcd('0x29')];var _0x1d1caf=_0x478751?_0x3c98c2[_0x9dcd('0x2b')]:_0x97d79d[_0x9dcd('0x29')]+_0x97d79d[_0x9dcd('0x2c')];var _0x3b27da;if(_0x1d1caf>=_0x3ebd92){_0x1d1caf=_0x3ebd92;_0x3b27da=0xc8;}else{_0x3b27da=0xce;}_0x3c4b99[_0x9dcd('0x27')](_0x3b27da);return _0x3c4b99[_0x9dcd('0x2d')](_0x9dcd('0x2e'),_0x5f4b26+'-'+_0x1d1caf+'/'+_0x3ebd92)[_0x9dcd('0x28')](_0x3c98c2);}return null;};}function patchUpdates(_0x12a582){return function(_0xbfe0c5){try{jsonpatch[_0x9dcd('0x2f')](_0xbfe0c5,_0x12a582,!![]);}catch(_0x6e3771){return BPromise[_0x9dcd('0x30')](_0x6e3771);}return _0xbfe0c5[_0x9dcd('0x31')]();};}function saveUpdates(_0x245f25,_0x1adc41){return function(_0x39895f){if(_0x39895f){return _0x39895f[_0x9dcd('0x32')](_0x245f25)[_0x9dcd('0x1c')](function(_0x2271cd){return _0x2271cd;});}return null;};}function removeEntity(_0x35ac1f,_0x2c61d7){return function(_0x21c4af){if(_0x21c4af){return _0x21c4af[_0x9dcd('0x33')]()['then'](function(){_0x35ac1f[_0x9dcd('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbad301,_0x12f9ea){return function(_0x30d2e8){if(!_0x30d2e8){_0xbad301[_0x9dcd('0x34')](0x194);}return _0x30d2e8;};}function handleError(_0x13cd99,_0x4240b7){_0x4240b7=_0x4240b7||0x1f4;return function(_0xca3f1c){logger['error'](_0xca3f1c['stack']);if(_0xca3f1c[_0x9dcd('0x35')]){delete _0xca3f1c[_0x9dcd('0x35')];}_0x13cd99[_0x9dcd('0x27')](_0x4240b7)[_0x9dcd('0x36')](_0xca3f1c);};}exports[_0x9dcd('0x37')]=function(_0x74346c,_0x55df41){var _0x360dfa={},_0x51b3c2={},_0x3b3b4e={'count':0x0,'rows':[]};var _0x54d49b=_[_0x9dcd('0x38')](db[_0x9dcd('0x39')][_0x9dcd('0x3a')],function(_0x28a68d){return{'name':_0x28a68d[_0x9dcd('0x3b')],'type':_0x28a68d[_0x9dcd('0x3c')][_0x9dcd('0x3d')]};});_0x51b3c2[_0x9dcd('0x3e')]=_[_0x9dcd('0x38')](_0x54d49b,_0x9dcd('0x35'));_0x51b3c2['query']=_[_0x9dcd('0x3f')](_0x74346c[_0x9dcd('0x40')]);_0x51b3c2[_0x9dcd('0x41')]=_['intersection'](_0x51b3c2[_0x9dcd('0x3e')],_0x51b3c2[_0x9dcd('0x40')]);_0x360dfa[_0x9dcd('0x42')]=_[_0x9dcd('0x43')](_0x51b3c2[_0x9dcd('0x3e')],qs[_0x9dcd('0x44')](_0x74346c['query']['fields']));_0x360dfa[_0x9dcd('0x42')]=_0x360dfa[_0x9dcd('0x42')][_0x9dcd('0x45')]?_0x360dfa[_0x9dcd('0x42')]:_0x51b3c2[_0x9dcd('0x3e')];if(!_0x74346c[_0x9dcd('0x40')][_0x9dcd('0x46')]('nolimit')){_0x360dfa[_0x9dcd('0x2c')]=qs[_0x9dcd('0x2c')](_0x74346c['query'][_0x9dcd('0x2c')]);_0x360dfa[_0x9dcd('0x29')]=qs['offset'](_0x74346c['query'][_0x9dcd('0x29')]);}_0x360dfa['order']=qs[_0x9dcd('0x47')](_0x74346c[_0x9dcd('0x40')][_0x9dcd('0x47')]);_0x360dfa[_0x9dcd('0x48')]=qs[_0x9dcd('0x41')](_['pick'](_0x74346c[_0x9dcd('0x40')],_0x51b3c2[_0x9dcd('0x41')]),_0x54d49b);if(_0x74346c['query'][_0x9dcd('0x49')]){_0x360dfa[_0x9dcd('0x48')]=_[_0x9dcd('0x4a')](_0x360dfa[_0x9dcd('0x48')],{'$or':_[_0x9dcd('0x38')](_0x54d49b,function(_0x3e115a){if(_0x3e115a['type']!==_0x9dcd('0x4b')){var _0x2aa246={};_0x2aa246[_0x3e115a[_0x9dcd('0x35')]]={'$like':'%'+_0x74346c[_0x9dcd('0x40')][_0x9dcd('0x49')]+'%'};return _0x2aa246;}})});}_0x360dfa=_[_0x9dcd('0x4a')]({},_0x360dfa,_0x74346c[_0x9dcd('0x4c')]);var _0x371cb1={'where':_0x360dfa['where']};return db['Setting']['count'](_0x371cb1)[_0x9dcd('0x1c')](function(_0x2cf6c8){_0x3b3b4e[_0x9dcd('0x2b')]=_0x2cf6c8;if(_0x74346c[_0x9dcd('0x40')][_0x9dcd('0x4d')]){_0x360dfa[_0x9dcd('0x4e')]=[{'all':!![]}];}return db['Setting'][_0x9dcd('0x4f')](_0x360dfa);})['then'](function(_0x115916){_0x3b3b4e[_0x9dcd('0x50')]=_0x115916;return _0x3b3b4e;})[_0x9dcd('0x1c')](respondWithFilteredResult(_0x55df41,_0x360dfa))[_0x9dcd('0x25')](handleError(_0x55df41,null));};exports['show']=function(_0x41e3cf,_0x3a48c5){var _0xe18425={'raw':![],'where':{'id':_0x41e3cf[_0x9dcd('0x51')]['id']}},_0x4aa1af={};_0x4aa1af['model']=_[_0x9dcd('0x3f')](db[_0x9dcd('0x39')][_0x9dcd('0x3a')]);_0x4aa1af[_0x9dcd('0x40')]=_[_0x9dcd('0x3f')](_0x41e3cf['query']);_0x4aa1af[_0x9dcd('0x41')]=_[_0x9dcd('0x43')](_0x4aa1af[_0x9dcd('0x3e')],_0x4aa1af[_0x9dcd('0x40')]);_0xe18425[_0x9dcd('0x42')]=_[_0x9dcd('0x43')](_0x4aa1af['model'],qs['fields'](_0x41e3cf[_0x9dcd('0x40')][_0x9dcd('0x44')]));_0xe18425[_0x9dcd('0x42')]=_0xe18425[_0x9dcd('0x42')][_0x9dcd('0x45')]?_0xe18425[_0x9dcd('0x42')]:_0x4aa1af[_0x9dcd('0x3e')];if(_0x41e3cf['query'][_0x9dcd('0x4d')]){_0xe18425['include']=[{'all':!![]}];}_0xe18425=_[_0x9dcd('0x4a')]({},_0xe18425,_0x41e3cf[_0x9dcd('0x4c')]);return db['Setting'][_0x9dcd('0x52')](_0xe18425)[_0x9dcd('0x1c')](handleEntityNotFound(_0x3a48c5,null))[_0x9dcd('0x1c')](respondWithResult(_0x3a48c5,null))[_0x9dcd('0x25')](handleError(_0x3a48c5,null));};exports[_0x9dcd('0x32')]=function(_0x130ab0,_0x1d071b){if(_0x130ab0[_0x9dcd('0x53')]['id']){delete _0x130ab0[_0x9dcd('0x53')]['id'];}return db['Setting'][_0x9dcd('0x52')]({'where':{'id':_0x130ab0[_0x9dcd('0x51')]['id']}})[_0x9dcd('0x1c')](handleEntityNotFound(_0x1d071b,null))[_0x9dcd('0x1c')](saveUpdates(_0x130ab0[_0x9dcd('0x53')],null))[_0x9dcd('0x1c')](respondWithResult(_0x1d071b,null))['catch'](handleError(_0x1d071b,null));};exports[_0x9dcd('0x54')]=function(_0x5a987e,_0x15e441,_0x544822){if(_0x5a987e[_0x9dcd('0x55')]&&_0x5a987e[_0x9dcd('0x55')][_0x9dcd('0x56')]){_0x5a987e[_0x9dcd('0x53')][_0x9dcd('0x57')]=_0x5a987e[_0x9dcd('0x55')]['filename'];}return db[_0x9dcd('0x39')]['find']({'where':{'id':_0x5a987e[_0x9dcd('0x51')]['id']}})[_0x9dcd('0x1c')](handleEntityNotFound(_0x15e441,null))[_0x9dcd('0x1c')](saveUpdates(_0x5a987e[_0x9dcd('0x53')],null))[_0x9dcd('0x1c')](respondWithResult(_0x15e441,null))[_0x9dcd('0x25')](handleError(_0x15e441,null));};exports[_0x9dcd('0x58')]=function(_0x5db851,_0x6f0b3,_0x4c8ce9){if(_0x5db851['file']&&_0x5db851[_0x9dcd('0x55')][_0x9dcd('0x56')]){_0x5db851[_0x9dcd('0x53')]['loginLogo']=_0x5db851[_0x9dcd('0x55')][_0x9dcd('0x56')];}return db[_0x9dcd('0x39')][_0x9dcd('0x52')]({'where':{'id':_0x5db851[_0x9dcd('0x51')]['id']}})[_0x9dcd('0x1c')](handleEntityNotFound(_0x6f0b3,null))[_0x9dcd('0x1c')](saveUpdates(_0x5db851[_0x9dcd('0x53')],null))['then'](respondWithResult(_0x6f0b3,null))[_0x9dcd('0x25')](handleError(_0x6f0b3,null));};var utilLicense=require(_0x9dcd('0x16'));exports[_0x9dcd('0x59')]=function(_0x5dce09,_0x15e423,_0x4d2bcd){var _0x3ad642=_0x9dcd('0x5a');var _0x2622db={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x49092f){if(_0x49092f){_0x2622db=_0x49092f;}return db[_0x9dcd('0x39')]['find']({'where':{'id':_0x5dce09[_0x9dcd('0x51')]['id']},'attributes':['logo',_0x9dcd('0x5b'),_0x9dcd('0x5c'),'favicon',_0x9dcd('0x5d'),_0x9dcd('0x5e'),_0x9dcd('0x5f'),_0x9dcd('0x60')],'raw':!![]});})[_0x9dcd('0x1c')](handleEntityNotFound(_0x15e423,null))[_0x9dcd('0x1c')](function(_0x109152){if(_0x109152){var _0x22a319=_0x109152[_0x9dcd('0x57')]&&fs['existsSync'](path[_0x9dcd('0x61')](config[_0x9dcd('0x62')],_0x3ad642,_[_0x9dcd('0x63')](_0x109152[_0x9dcd('0x57')])))?path[_0x9dcd('0x61')](config[_0x9dcd('0x62')],_0x3ad642,_[_0x9dcd('0x63')](_0x109152[_0x9dcd('0x57')])):path[_0x9dcd('0x61')](config[_0x9dcd('0x62')],_0x3ad642,_['toLower']('default_logo.svg'));var _0x21dc2f=_0x9dcd('0x64')+_[_0x9dcd('0x65')](_0x9dcd('0x57'));if(_0x109152[_0x21dc2f]||!_0x2622db['custom']){_0x22a319=path[_0x9dcd('0x61')](config[_0x9dcd('0x62')],_0x3ad642,_[_0x9dcd('0x63')](_0x9dcd('0x66')));}if(!fs['existsSync'](_0x22a319)){throw new db['Sequelize'][(_0x9dcd('0x67'))](_[_0x9dcd('0x65')](_0x9dcd('0x57'))+'\x20not\x20found');}return _0x15e423['download'](_0x22a319);}})['catch'](handleError(_0x15e423,null));};var utilLicense=require(_0x9dcd('0x16'));exports[_0x9dcd('0x68')]=function(_0x2c18d0,_0x1f99c3,_0x658e89){var _0x2dbaf7=_0x9dcd('0x5a');var _0x46cf18={'custom':![]};return utilLicense[_0x9dcd('0x69')]()['then'](function(_0xe7bb2e){if(_0xe7bb2e){_0x46cf18=_0xe7bb2e;}return db[_0x9dcd('0x39')][_0x9dcd('0x52')]({'where':{'id':_0x2c18d0['params']['id']},'attributes':[_0x9dcd('0x57'),_0x9dcd('0x5b'),_0x9dcd('0x5c'),_0x9dcd('0x6a'),'defaultLogo',_0x9dcd('0x5e'),_0x9dcd('0x5f'),_0x9dcd('0x60')],'raw':!![]});})[_0x9dcd('0x1c')](handleEntityNotFound(_0x1f99c3,null))[_0x9dcd('0x1c')](function(_0xa1d142){if(_0xa1d142){var _0x4b7fd7=_0xa1d142[_0x9dcd('0x5b')]&&fs['existsSync'](path['join'](config[_0x9dcd('0x62')],_0x2dbaf7,_[_0x9dcd('0x63')](_0xa1d142['loginLogo'])))?path[_0x9dcd('0x61')](config[_0x9dcd('0x62')],_0x2dbaf7,_['toLower'](_0xa1d142['loginLogo'])):path[_0x9dcd('0x61')](config['root'],_0x2dbaf7,_[_0x9dcd('0x63')](_0x9dcd('0x6b')));var _0x8fc655=_0x9dcd('0x64')+_[_0x9dcd('0x65')](_0x9dcd('0x5b'));if(_0xa1d142[_0x8fc655]||!_0x46cf18[_0x9dcd('0x6c')]){_0x4b7fd7=path[_0x9dcd('0x61')](config[_0x9dcd('0x62')],_0x2dbaf7,_['toLower']('default_loginLogo.svg'));}if(!fs[_0x9dcd('0x6d')](_0x4b7fd7)){throw new db[(_0x9dcd('0x6e'))][(_0x9dcd('0x67'))](_[_0x9dcd('0x65')]('loginLogo')+_0x9dcd('0x6f'));}return _0x1f99c3[_0x9dcd('0x70')](_0x4b7fd7);}})[_0x9dcd('0x25')](handleError(_0x1f99c3,null));};exports[_0x9dcd('0x71')]=function(_0x3338d3,_0x2e5a54){return db[_0x9dcd('0x39')][_0x9dcd('0x52')]({'where':{'id':_0x3338d3[_0x9dcd('0x51')]['id']},'attributes':['securePassword']})['then'](respondWithResult(_0x2e5a54,null))[_0x9dcd('0x25')](handleError(_0x2e5a54,null));};exports['addPreferred']=function(_0x4e71e1,_0x294c64,_0x5798e5){if(_0x4e71e1[_0x9dcd('0x55')]&&_0x4e71e1[_0x9dcd('0x55')]['filename']){_0x4e71e1[_0x9dcd('0x53')][_0x9dcd('0x5c')]=_0x4e71e1[_0x9dcd('0x55')][_0x9dcd('0x56')];}return db['Setting'][_0x9dcd('0x52')]({'where':{'id':_0x4e71e1['params']['id']}})[_0x9dcd('0x1c')](handleEntityNotFound(_0x294c64,null))['then'](saveUpdates(_0x4e71e1[_0x9dcd('0x53')],null))[_0x9dcd('0x1c')](respondWithResult(_0x294c64,null))['catch'](handleError(_0x294c64,null));};var utilLicense=require('../../config/license/util');exports['getPreferred']=function(_0x41821e,_0x4c15f4,_0x379740){var _0x45ff50=_0x9dcd('0x5a');var _0x429a92={'custom':![]};return utilLicense[_0x9dcd('0x69')]()[_0x9dcd('0x1c')](function(_0x32a026){if(_0x32a026){_0x429a92=_0x32a026;}return db[_0x9dcd('0x39')][_0x9dcd('0x52')]({'where':{'id':_0x41821e[_0x9dcd('0x51')]['id']},'attributes':['logo',_0x9dcd('0x5b'),_0x9dcd('0x5c'),_0x9dcd('0x6a'),_0x9dcd('0x5d'),_0x9dcd('0x5e'),'defaultPreferred',_0x9dcd('0x60')],'raw':!![]});})[_0x9dcd('0x1c')](handleEntityNotFound(_0x4c15f4,null))[_0x9dcd('0x1c')](function(_0x5ab34e){if(_0x5ab34e){var _0x241f3c=_0x5ab34e['preferred']&&fs['existsSync'](path['join'](config[_0x9dcd('0x62')],_0x45ff50,_[_0x9dcd('0x63')](_0x5ab34e[_0x9dcd('0x5c')])))?path[_0x9dcd('0x61')](config['root'],_0x45ff50,_[_0x9dcd('0x63')](_0x5ab34e['preferred'])):path[_0x9dcd('0x61')](config[_0x9dcd('0x62')],_0x45ff50,_[_0x9dcd('0x63')]('default_preferred.png'));var _0x1f6d5b=_0x9dcd('0x64')+_['upperFirst'](_0x9dcd('0x5c'));if(_0x5ab34e[_0x1f6d5b]||!_0x429a92[_0x9dcd('0x6c')]||!_0x429a92[_0x9dcd('0x5c')]){_0x241f3c=path[_0x9dcd('0x61')](config[_0x9dcd('0x62')],_0x45ff50,_['toLower']('default_preferred.png'));}if(!fs[_0x9dcd('0x6d')](_0x241f3c)){throw new db[(_0x9dcd('0x6e'))][(_0x9dcd('0x67'))](_[_0x9dcd('0x65')]('preferred')+_0x9dcd('0x6f'));}return _0x4c15f4[_0x9dcd('0x70')](_0x241f3c);}})['catch'](handleError(_0x4c15f4,null));};exports[_0x9dcd('0x72')]=function(_0x1b6c3c,_0x7c9ab2,_0xafb282){if(_0x1b6c3c[_0x9dcd('0x55')]&&_0x1b6c3c[_0x9dcd('0x55')][_0x9dcd('0x56')]){_0x1b6c3c['body'][_0x9dcd('0x6a')]=_0x1b6c3c['file']['filename'];}return db[_0x9dcd('0x39')][_0x9dcd('0x52')]({'where':{'id':_0x1b6c3c[_0x9dcd('0x51')]['id']}})[_0x9dcd('0x1c')](handleEntityNotFound(_0x7c9ab2,null))[_0x9dcd('0x1c')](saveUpdates(_0x1b6c3c[_0x9dcd('0x53')],null))[_0x9dcd('0x1c')](respondWithResult(_0x7c9ab2,null))[_0x9dcd('0x25')](handleError(_0x7c9ab2,null));};var utilLicense=require('../../config/license/util');exports['getFavicon']=function(_0x5531d4,_0x1640e6,_0x191f89){var _0x4ca654=_0x9dcd('0x5a');var _0x2f2a1a={'custom':![]};return utilLicense[_0x9dcd('0x69')]()['then'](function(_0x35277a){if(_0x35277a){_0x2f2a1a=_0x35277a;}return db[_0x9dcd('0x39')]['find']({'where':{'id':_0x5531d4[_0x9dcd('0x51')]['id']},'attributes':[_0x9dcd('0x57'),_0x9dcd('0x5b'),_0x9dcd('0x5c'),_0x9dcd('0x6a'),_0x9dcd('0x5d'),_0x9dcd('0x5e'),_0x9dcd('0x5f'),_0x9dcd('0x60')],'raw':!![]});})['then'](handleEntityNotFound(_0x1640e6,null))['then'](function(_0x29daca){if(_0x29daca){var _0x38f068=_0x29daca[_0x9dcd('0x6a')]&&fs[_0x9dcd('0x6d')](path[_0x9dcd('0x61')](config[_0x9dcd('0x62')],_0x4ca654,_[_0x9dcd('0x63')](_0x29daca[_0x9dcd('0x6a')])))?path['join'](config[_0x9dcd('0x62')],_0x4ca654,_[_0x9dcd('0x63')](_0x29daca[_0x9dcd('0x6a')])):path[_0x9dcd('0x61')](config['root'],_0x4ca654,_[_0x9dcd('0x63')](_0x9dcd('0x73')));var _0x467466=_0x9dcd('0x64')+_[_0x9dcd('0x65')]('favicon');if(_0x29daca[_0x467466]||!_0x2f2a1a[_0x9dcd('0x6c')]){_0x38f068=path['join'](config[_0x9dcd('0x62')],_0x4ca654,_[_0x9dcd('0x63')]('default_favicon.ico'));}if(!fs[_0x9dcd('0x6d')](_0x38f068)){throw new db[(_0x9dcd('0x6e'))][(_0x9dcd('0x67'))](_[_0x9dcd('0x65')](_0x9dcd('0x6a'))+'\x20not\x20found');}return _0x1640e6[_0x9dcd('0x70')](_0x38f068);}})[_0x9dcd('0x25')](handleError(_0x1640e6,null));};exports[_0x9dcd('0x74')]=function(_0x2fc876,_0x26e0a0){var _0x36c81a={'offset':moment()[_0x9dcd('0x75')]()};_0x36c81a['now']=moment()[_0x9dcd('0x75')](_0x36c81a[_0x9dcd('0x29')])[_0x9dcd('0x76')](_0x9dcd('0x77'));return _0x26e0a0[_0x9dcd('0x27')](0xc8)['send'](_0x36c81a);}; \ No newline at end of file +var _0x48c6=['getLicense','preferred','defaultLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','\x20not\x20found','download','getLogoLogin','favicon','defaultLoginLogo','Sequelize','ValidationError','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','default_favicon.ico','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','request','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','Setting,\x20%s,\x20%s','result','catch','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','name','send','index','map','Setting','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','find','body','addLogo','file','filename','logo','loginLogo','getLogo','server/files/images/logos'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x48c6,0x17d));var _0x648c=function(_0x41e9af,_0x32f8aa){_0x41e9af=_0x41e9af-0x0;var _0x1a08f9=_0x48c6[_0x41e9af];return _0x1a08f9;};'use strict';var emlformat=require(_0x648c('0x0'));var rimraf=require(_0x648c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x648c('0x2'));var rp=require(_0x648c('0x3'));var moment=require('moment');var BPromise=require(_0x648c('0x4'));var Mustache=require('mustache');var util=require(_0x648c('0x5'));var path=require(_0x648c('0x6'));var sox=require(_0x648c('0x7'));var csv=require(_0x648c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x648c('0x9'));var crypto=require(_0x648c('0xa'));var jsforce=require(_0x648c('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x648c('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x648c('0xc'));var authService=require(_0x648c('0xd'));var qs=require(_0x648c('0xe'));var as=require(_0x648c('0xf'));var hardwareService=require(_0x648c('0x10'));var logger=require(_0x648c('0x11'))(_0x648c('0x12'));var utils=require('../../config/utils');var config=require(_0x648c('0x13'));var licenseUtil=require(_0x648c('0x14'));var db=require(_0x648c('0x15'))['db'];var jayson=require(_0x648c('0x16'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2f5cc1,_0x3de2b4,_0x485d5d,_0x2d0862){return new BPromise(function(_0x5105e7,_0x35f10e){var _0xf706ad=_0x2d0862||client;return _0xf706ad[_0x648c('0x17')](_0x2f5cc1,_0x485d5d)['then'](function(_0x1dd08d){logger[_0x648c('0x18')]('Setting,\x20%s,\x20%s',_0x3de2b4,_0x648c('0x19'));logger[_0x648c('0x1a')](_0x648c('0x1b'),_0x3de2b4,'request\x20sent',JSON[_0x648c('0x1c')](_0x1dd08d));if(_0x1dd08d[_0x648c('0x1d')]){if(_0x1dd08d[_0x648c('0x1d')]['code']===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x3de2b4,_0x1dd08d[_0x648c('0x1d')][_0x648c('0x1e')]);return _0x35f10e(_0x1dd08d[_0x648c('0x1d')]['message']);}logger[_0x648c('0x1d')](_0x648c('0x1f'),_0x3de2b4,_0x1dd08d['error']['message']);return _0x5105e7(_0x1dd08d[_0x648c('0x1d')]['message']);}else{logger[_0x648c('0x18')]('Setting,\x20%s,\x20%s',_0x3de2b4,_0x648c('0x19'));_0x5105e7(_0x1dd08d[_0x648c('0x20')][_0x648c('0x1e')]);}})[_0x648c('0x21')](function(_0x261785){logger['error'](_0x648c('0x1f'),_0x3de2b4,_0x261785);_0x35f10e(_0x261785);});});}function respondWithStatusCode(_0x5415f7,_0x5bdfa1){_0x5bdfa1=_0x5bdfa1||0xcc;return function(_0x422b7b){if(_0x422b7b){return _0x5415f7['sendStatus'](_0x5bdfa1);}return _0x5415f7[_0x648c('0x22')](_0x5bdfa1)[_0x648c('0x23')]();};}function respondWithResult(_0x3d9d9f,_0x1a4124){_0x1a4124=_0x1a4124||0xc8;return function(_0x4bfba7){if(_0x4bfba7){return _0x3d9d9f[_0x648c('0x22')](_0x1a4124)[_0x648c('0x24')](_0x4bfba7);}};}function respondWithFilteredResult(_0xd36efd,_0x3ff637){return function(_0x2d9b30){if(_0x2d9b30){var _0x4e5223=typeof _0x3ff637['offset']===_0x648c('0x25')&&typeof _0x3ff637[_0x648c('0x26')]===_0x648c('0x25');var _0x47c2cf=_0x2d9b30[_0x648c('0x27')];var _0x5f7323=_0x4e5223?0x0:_0x3ff637[_0x648c('0x28')];var _0x6f6768=_0x4e5223?_0x2d9b30[_0x648c('0x27')]:_0x3ff637[_0x648c('0x28')]+_0x3ff637['limit'];var _0x15ea60;if(_0x6f6768>=_0x47c2cf){_0x6f6768=_0x47c2cf;_0x15ea60=0xc8;}else{_0x15ea60=0xce;}_0xd36efd[_0x648c('0x22')](_0x15ea60);return _0xd36efd[_0x648c('0x29')]('Content-Range',_0x5f7323+'-'+_0x6f6768+'/'+_0x47c2cf)['json'](_0x2d9b30);}return null;};}function patchUpdates(_0x3d6e7e){return function(_0x52db81){try{jsonpatch[_0x648c('0x2a')](_0x52db81,_0x3d6e7e,!![]);}catch(_0x4eb89c){return BPromise[_0x648c('0x2b')](_0x4eb89c);}return _0x52db81[_0x648c('0x2c')]();};}function saveUpdates(_0x410271,_0x17fda8){return function(_0x2c191b){if(_0x2c191b){return _0x2c191b[_0x648c('0x2d')](_0x410271)[_0x648c('0x2e')](function(_0x193b3b){return _0x193b3b;});}return null;};}function removeEntity(_0x4564f8,_0x567faf){return function(_0x4b0c85){if(_0x4b0c85){return _0x4b0c85['destroy']()[_0x648c('0x2e')](function(){_0x4564f8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x50c2a2,_0x2c9950){return function(_0x4b0a27){if(!_0x4b0a27){_0x50c2a2['sendStatus'](0x194);}return _0x4b0a27;};}function handleError(_0x4505af,_0x15fefb){_0x15fefb=_0x15fefb||0x1f4;return function(_0x138c1f){logger[_0x648c('0x1d')](_0x138c1f['stack']);if(_0x138c1f[_0x648c('0x2f')]){delete _0x138c1f[_0x648c('0x2f')];}_0x4505af[_0x648c('0x22')](_0x15fefb)[_0x648c('0x30')](_0x138c1f);};}exports[_0x648c('0x31')]=function(_0x36b36f,_0xc1c72){var _0x1dbeb1={},_0x379aba={},_0x275503={'count':0x0,'rows':[]};var _0x21ec61=_[_0x648c('0x32')](db[_0x648c('0x33')][_0x648c('0x34')],function(_0x1e277d){return{'name':_0x1e277d[_0x648c('0x35')],'type':_0x1e277d['type'][_0x648c('0x36')]};});_0x379aba[_0x648c('0x37')]=_[_0x648c('0x32')](_0x21ec61,'name');_0x379aba[_0x648c('0x38')]=_[_0x648c('0x39')](_0x36b36f[_0x648c('0x38')]);_0x379aba['filters']=_[_0x648c('0x3a')](_0x379aba[_0x648c('0x37')],_0x379aba[_0x648c('0x38')]);_0x1dbeb1[_0x648c('0x3b')]=_[_0x648c('0x3a')](_0x379aba[_0x648c('0x37')],qs[_0x648c('0x3c')](_0x36b36f[_0x648c('0x38')]['fields']));_0x1dbeb1['attributes']=_0x1dbeb1[_0x648c('0x3b')][_0x648c('0x3d')]?_0x1dbeb1[_0x648c('0x3b')]:_0x379aba[_0x648c('0x37')];if(!_0x36b36f[_0x648c('0x38')][_0x648c('0x3e')](_0x648c('0x3f'))){_0x1dbeb1[_0x648c('0x26')]=qs[_0x648c('0x26')](_0x36b36f[_0x648c('0x38')][_0x648c('0x26')]);_0x1dbeb1[_0x648c('0x28')]=qs[_0x648c('0x28')](_0x36b36f[_0x648c('0x38')][_0x648c('0x28')]);}_0x1dbeb1[_0x648c('0x40')]=qs[_0x648c('0x41')](_0x36b36f['query'][_0x648c('0x41')]);_0x1dbeb1['where']=qs['filters'](_['pick'](_0x36b36f[_0x648c('0x38')],_0x379aba[_0x648c('0x42')]),_0x21ec61);if(_0x36b36f[_0x648c('0x38')][_0x648c('0x43')]){_0x1dbeb1[_0x648c('0x44')]=_[_0x648c('0x45')](_0x1dbeb1[_0x648c('0x44')],{'$or':_[_0x648c('0x32')](_0x21ec61,function(_0x486727){if(_0x486727[_0x648c('0x46')]!==_0x648c('0x47')){var _0x76b669={};_0x76b669[_0x486727[_0x648c('0x2f')]]={'$like':'%'+_0x36b36f[_0x648c('0x38')]['filter']+'%'};return _0x76b669;}})});}_0x1dbeb1=_['merge']({},_0x1dbeb1,_0x36b36f[_0x648c('0x48')]);var _0x4d2e2a={'where':_0x1dbeb1[_0x648c('0x44')]};return db['Setting']['count'](_0x4d2e2a)[_0x648c('0x2e')](function(_0x211d31){_0x275503[_0x648c('0x27')]=_0x211d31;if(_0x36b36f[_0x648c('0x38')][_0x648c('0x49')]){_0x1dbeb1[_0x648c('0x4a')]=[{'all':!![]}];}return db[_0x648c('0x33')][_0x648c('0x4b')](_0x1dbeb1);})[_0x648c('0x2e')](function(_0xa3ef71){_0x275503['rows']=_0xa3ef71;return _0x275503;})[_0x648c('0x2e')](respondWithFilteredResult(_0xc1c72,_0x1dbeb1))['catch'](handleError(_0xc1c72,null));};exports[_0x648c('0x4c')]=function(_0x35436a,_0x14e3bc){var _0x10b0c5={'raw':![],'where':{'id':_0x35436a[_0x648c('0x4d')]['id']}},_0x533b1f={};_0x533b1f['model']=_[_0x648c('0x39')](db[_0x648c('0x33')]['rawAttributes']);_0x533b1f[_0x648c('0x38')]=_[_0x648c('0x39')](_0x35436a[_0x648c('0x38')]);_0x533b1f['filters']=_[_0x648c('0x3a')](_0x533b1f[_0x648c('0x37')],_0x533b1f[_0x648c('0x38')]);_0x10b0c5[_0x648c('0x3b')]=_[_0x648c('0x3a')](_0x533b1f['model'],qs['fields'](_0x35436a[_0x648c('0x38')][_0x648c('0x3c')]));_0x10b0c5[_0x648c('0x3b')]=_0x10b0c5['attributes']['length']?_0x10b0c5[_0x648c('0x3b')]:_0x533b1f[_0x648c('0x37')];if(_0x35436a[_0x648c('0x38')][_0x648c('0x49')]){_0x10b0c5[_0x648c('0x4a')]=[{'all':!![]}];}_0x10b0c5=_[_0x648c('0x45')]({},_0x10b0c5,_0x35436a[_0x648c('0x48')]);return db[_0x648c('0x33')][_0x648c('0x4e')](_0x10b0c5)[_0x648c('0x2e')](handleEntityNotFound(_0x14e3bc,null))['then'](respondWithResult(_0x14e3bc,null))[_0x648c('0x21')](handleError(_0x14e3bc,null));};exports[_0x648c('0x2d')]=function(_0x4d7cdc,_0x5d87ad){if(_0x4d7cdc[_0x648c('0x4f')]['id']){delete _0x4d7cdc[_0x648c('0x4f')]['id'];}return db[_0x648c('0x33')][_0x648c('0x4e')]({'where':{'id':_0x4d7cdc[_0x648c('0x4d')]['id']}})[_0x648c('0x2e')](handleEntityNotFound(_0x5d87ad,null))[_0x648c('0x2e')](saveUpdates(_0x4d7cdc[_0x648c('0x4f')],null))[_0x648c('0x2e')](respondWithResult(_0x5d87ad,null))[_0x648c('0x21')](handleError(_0x5d87ad,null));};exports[_0x648c('0x50')]=function(_0x237279,_0x193df4,_0x590a8d){if(_0x237279[_0x648c('0x51')]&&_0x237279[_0x648c('0x51')][_0x648c('0x52')]){_0x237279[_0x648c('0x4f')][_0x648c('0x53')]=_0x237279[_0x648c('0x51')][_0x648c('0x52')];}return db[_0x648c('0x33')]['find']({'where':{'id':_0x237279[_0x648c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x193df4,null))['then'](saveUpdates(_0x237279['body'],null))[_0x648c('0x2e')](respondWithResult(_0x193df4,null))['catch'](handleError(_0x193df4,null));};exports['addLogoLogin']=function(_0x2e7b12,_0x46896f,_0x4adacc){if(_0x2e7b12['file']&&_0x2e7b12[_0x648c('0x51')][_0x648c('0x52')]){_0x2e7b12['body'][_0x648c('0x54')]=_0x2e7b12[_0x648c('0x51')][_0x648c('0x52')];}return db[_0x648c('0x33')][_0x648c('0x4e')]({'where':{'id':_0x2e7b12[_0x648c('0x4d')]['id']}})[_0x648c('0x2e')](handleEntityNotFound(_0x46896f,null))[_0x648c('0x2e')](saveUpdates(_0x2e7b12['body'],null))[_0x648c('0x2e')](respondWithResult(_0x46896f,null))[_0x648c('0x21')](handleError(_0x46896f,null));};var utilLicense=require(_0x648c('0x14'));exports[_0x648c('0x55')]=function(_0x1f34a6,_0x5e1690,_0x315513){var _0x4544f0=_0x648c('0x56');var _0x5ecd3f={'custom':![]};return utilLicense[_0x648c('0x57')]()['then'](function(_0x48ce18){if(_0x48ce18){_0x5ecd3f=_0x48ce18;}return db[_0x648c('0x33')][_0x648c('0x4e')]({'where':{'id':_0x1f34a6['params']['id']},'attributes':[_0x648c('0x53'),_0x648c('0x54'),_0x648c('0x58'),'favicon',_0x648c('0x59'),'defaultLoginLogo',_0x648c('0x5a'),_0x648c('0x5b')],'raw':!![]});})[_0x648c('0x2e')](handleEntityNotFound(_0x5e1690,null))[_0x648c('0x2e')](function(_0x55e55f){if(_0x55e55f){var _0x130b4b=_0x55e55f[_0x648c('0x53')]&&fs[_0x648c('0x5c')](path[_0x648c('0x5d')](config[_0x648c('0x5e')],_0x4544f0,_[_0x648c('0x5f')](_0x55e55f[_0x648c('0x53')])))?path[_0x648c('0x5d')](config[_0x648c('0x5e')],_0x4544f0,_[_0x648c('0x5f')](_0x55e55f[_0x648c('0x53')])):path[_0x648c('0x5d')](config[_0x648c('0x5e')],_0x4544f0,_[_0x648c('0x5f')](_0x648c('0x60')));var _0x35516e=_0x648c('0x61')+_[_0x648c('0x62')](_0x648c('0x53'));if(_0x55e55f[_0x35516e]||!_0x5ecd3f[_0x648c('0x63')]){_0x130b4b=path[_0x648c('0x5d')](config[_0x648c('0x5e')],_0x4544f0,_['toLower'](_0x648c('0x60')));}if(!fs['existsSync'](_0x130b4b)){throw new db['Sequelize']['ValidationError'](_[_0x648c('0x62')](_0x648c('0x53'))+_0x648c('0x64'));}return _0x5e1690[_0x648c('0x65')](_0x130b4b);}})[_0x648c('0x21')](handleError(_0x5e1690,null));};var utilLicense=require(_0x648c('0x14'));exports[_0x648c('0x66')]=function(_0x46b4ac,_0x2ffa36,_0x41a167){var _0x4e9e42='server/files/images/logos';var _0x3f0ab2={'custom':![]};return utilLicense[_0x648c('0x57')]()[_0x648c('0x2e')](function(_0x4b7f22){if(_0x4b7f22){_0x3f0ab2=_0x4b7f22;}return db[_0x648c('0x33')][_0x648c('0x4e')]({'where':{'id':_0x46b4ac[_0x648c('0x4d')]['id']},'attributes':['logo',_0x648c('0x54'),_0x648c('0x58'),_0x648c('0x67'),_0x648c('0x59'),_0x648c('0x68'),_0x648c('0x5a'),_0x648c('0x5b')],'raw':!![]});})[_0x648c('0x2e')](handleEntityNotFound(_0x2ffa36,null))['then'](function(_0x3deb7a){if(_0x3deb7a){var _0x12e9d9=_0x3deb7a[_0x648c('0x54')]&&fs[_0x648c('0x5c')](path[_0x648c('0x5d')](config[_0x648c('0x5e')],_0x4e9e42,_[_0x648c('0x5f')](_0x3deb7a[_0x648c('0x54')])))?path[_0x648c('0x5d')](config[_0x648c('0x5e')],_0x4e9e42,_[_0x648c('0x5f')](_0x3deb7a[_0x648c('0x54')])):path['join'](config[_0x648c('0x5e')],_0x4e9e42,_[_0x648c('0x5f')]('default_loginLogo.svg'));var _0x21f88f=_0x648c('0x61')+_['upperFirst'](_0x648c('0x54'));if(_0x3deb7a[_0x21f88f]||!_0x3f0ab2[_0x648c('0x63')]){_0x12e9d9=path[_0x648c('0x5d')](config[_0x648c('0x5e')],_0x4e9e42,_[_0x648c('0x5f')]('default_loginLogo.svg'));}if(!fs['existsSync'](_0x12e9d9)){throw new db[(_0x648c('0x69'))][(_0x648c('0x6a'))](_[_0x648c('0x62')](_0x648c('0x54'))+_0x648c('0x64'));}return _0x2ffa36[_0x648c('0x65')](_0x12e9d9);}})[_0x648c('0x21')](handleError(_0x2ffa36,null));};exports['gdpr']=function(_0x202101,_0x37f250){return db[_0x648c('0x33')]['find']({'where':{'id':_0x202101[_0x648c('0x4d')]['id']},'attributes':[_0x648c('0x6b')]})[_0x648c('0x2e')](respondWithResult(_0x37f250,null))['catch'](handleError(_0x37f250,null));};exports[_0x648c('0x6c')]=function(_0x1ff72e,_0x28976c,_0x48063c){if(_0x1ff72e[_0x648c('0x51')]&&_0x1ff72e['file'][_0x648c('0x52')]){_0x1ff72e[_0x648c('0x4f')][_0x648c('0x58')]=_0x1ff72e['file'][_0x648c('0x52')];}return db[_0x648c('0x33')][_0x648c('0x4e')]({'where':{'id':_0x1ff72e[_0x648c('0x4d')]['id']}})[_0x648c('0x2e')](handleEntityNotFound(_0x28976c,null))[_0x648c('0x2e')](saveUpdates(_0x1ff72e[_0x648c('0x4f')],null))['then'](respondWithResult(_0x28976c,null))[_0x648c('0x21')](handleError(_0x28976c,null));};var utilLicense=require(_0x648c('0x14'));exports[_0x648c('0x6d')]=function(_0x5582ff,_0xbbd7a5,_0x2af2ed){var _0x552390=_0x648c('0x56');var _0x4e19eb={'custom':![]};return utilLicense['getLicense']()[_0x648c('0x2e')](function(_0x46743a){if(_0x46743a){_0x4e19eb=_0x46743a;}return db[_0x648c('0x33')][_0x648c('0x4e')]({'where':{'id':_0x5582ff['params']['id']},'attributes':['logo',_0x648c('0x54'),_0x648c('0x58'),_0x648c('0x67'),_0x648c('0x59'),'defaultLoginLogo',_0x648c('0x5a'),_0x648c('0x5b')],'raw':!![]});})['then'](handleEntityNotFound(_0xbbd7a5,null))[_0x648c('0x2e')](function(_0x45451e){if(_0x45451e){var _0x323729=_0x45451e['preferred']&&fs[_0x648c('0x5c')](path[_0x648c('0x5d')](config[_0x648c('0x5e')],_0x552390,_[_0x648c('0x5f')](_0x45451e[_0x648c('0x58')])))?path[_0x648c('0x5d')](config[_0x648c('0x5e')],_0x552390,_[_0x648c('0x5f')](_0x45451e[_0x648c('0x58')])):path['join'](config[_0x648c('0x5e')],_0x552390,_[_0x648c('0x5f')](_0x648c('0x6e')));var _0x4fa36d=_0x648c('0x61')+_['upperFirst']('preferred');if(_0x45451e[_0x4fa36d]||!_0x4e19eb[_0x648c('0x63')]||!_0x4e19eb['preferred']){_0x323729=path[_0x648c('0x5d')](config[_0x648c('0x5e')],_0x552390,_['toLower'](_0x648c('0x6e')));}if(!fs[_0x648c('0x5c')](_0x323729)){throw new db[(_0x648c('0x69'))]['ValidationError'](_[_0x648c('0x62')]('preferred')+_0x648c('0x64'));}return _0xbbd7a5[_0x648c('0x65')](_0x323729);}})[_0x648c('0x21')](handleError(_0xbbd7a5,null));};exports[_0x648c('0x6f')]=function(_0x4a734b,_0x43271d,_0x100fe7){if(_0x4a734b[_0x648c('0x51')]&&_0x4a734b[_0x648c('0x51')]['filename']){_0x4a734b[_0x648c('0x4f')]['favicon']=_0x4a734b['file'][_0x648c('0x52')];}return db[_0x648c('0x33')][_0x648c('0x4e')]({'where':{'id':_0x4a734b[_0x648c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x43271d,null))['then'](saveUpdates(_0x4a734b[_0x648c('0x4f')],null))['then'](respondWithResult(_0x43271d,null))[_0x648c('0x21')](handleError(_0x43271d,null));};var utilLicense=require(_0x648c('0x14'));exports['getFavicon']=function(_0x507797,_0x265576,_0x12783d){var _0x5c012a=_0x648c('0x56');var _0x255756={'custom':![]};return utilLicense[_0x648c('0x57')]()[_0x648c('0x2e')](function(_0xf16e17){if(_0xf16e17){_0x255756=_0xf16e17;}return db[_0x648c('0x33')][_0x648c('0x4e')]({'where':{'id':_0x507797['params']['id']},'attributes':['logo','loginLogo',_0x648c('0x58'),_0x648c('0x67'),'defaultLogo','defaultLoginLogo','defaultPreferred',_0x648c('0x5b')],'raw':!![]});})['then'](handleEntityNotFound(_0x265576,null))[_0x648c('0x2e')](function(_0x45832f){if(_0x45832f){var _0x41f5ff=_0x45832f['favicon']&&fs[_0x648c('0x5c')](path[_0x648c('0x5d')](config['root'],_0x5c012a,_[_0x648c('0x5f')](_0x45832f[_0x648c('0x67')])))?path[_0x648c('0x5d')](config[_0x648c('0x5e')],_0x5c012a,_[_0x648c('0x5f')](_0x45832f[_0x648c('0x67')])):path[_0x648c('0x5d')](config[_0x648c('0x5e')],_0x5c012a,_[_0x648c('0x5f')](_0x648c('0x70')));var _0x499a06=_0x648c('0x61')+_['upperFirst'](_0x648c('0x67'));if(_0x45832f[_0x499a06]||!_0x255756[_0x648c('0x63')]){_0x41f5ff=path[_0x648c('0x5d')](config[_0x648c('0x5e')],_0x5c012a,_[_0x648c('0x5f')](_0x648c('0x70')));}if(!fs['existsSync'](_0x41f5ff)){throw new db[(_0x648c('0x69'))][(_0x648c('0x6a'))](_['upperFirst'](_0x648c('0x67'))+_0x648c('0x64'));}return _0x265576[_0x648c('0x65')](_0x41f5ff);}})[_0x648c('0x21')](handleError(_0x265576,null));};exports[_0x648c('0x71')]=function(_0x1201a5,_0x5151a1){var _0x202acd={'offset':moment()[_0x648c('0x72')]()};_0x202acd['now']=moment()[_0x648c('0x72')](_0x202acd[_0x648c('0x28')])[_0x648c('0x73')](_0x648c('0x74'));return _0x5151a1[_0x648c('0x22')](0xc8)['send'](_0x202acd);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 6815880..5597b4b 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x4aa87,_0x4a73e9){var _0x5e6b5c=function(_0x3d39c1){while(--_0x3d39c1){_0x4aa87['push'](_0x4aa87['shift']());}};_0x5e6b5c(++_0x4a73e9);}(_0xedd9,0xfc));var _0x9edd=function(_0x54a56c,_0x1efaba){_0x54a56c=_0x54a56c-0x0;var _0x1bbacd=_0xedd9[_0x54a56c];return _0x1bbacd;};'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':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x366388,_0x4595a6){var _0x41c97e=function(_0x4b9fff){while(--_0x4b9fff){_0x366388['push'](_0x366388['shift']());}};_0x41c97e(++_0x4595a6);}(_0x7217,0x19e));var _0x7721=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x7217[_0xbe200f];return _0x192597;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 4ea347c..9aecd8b 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 _0xc6f7=['debug','ShowSetting','catch','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','Setting','options','raw','where','map','include','model','attributes'];(function(_0x188360,_0x3d93f8){var _0x1fbe6d=function(_0x3d9d32){while(--_0x3d9d32){_0x188360['push'](_0x188360['shift']());}};_0x1fbe6d(++_0x3d93f8);}(_0xc6f7,0x196));var _0x7c6f=function(_0x654ee8,_0x55a7bb){_0x654ee8=_0x654ee8-0x0;var _0x4ca77e=_0xc6f7[_0x654ee8];return _0x4ca77e;};'use strict';var _=require('lodash');var util=require(_0x7c6f('0x0'));var moment=require(_0x7c6f('0x1'));var BPromise=require('bluebird');var rs=require(_0x7c6f('0x2'));var fs=require('fs');var Redis=require(_0x7c6f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7c6f('0x4'));var logger=require('../../config/logger')(_0x7c6f('0x5'));var config=require(_0x7c6f('0x6'));var jayson=require(_0x7c6f('0x7'));var client=jayson[_0x7c6f('0x8')][_0x7c6f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11692f,_0x383d97,_0x266841){return new BPromise(function(_0xf9b565,_0x2e1504){return client['request'](_0x11692f,_0x266841)[_0x7c6f('0xa')](function(_0x576e9c){logger[_0x7c6f('0xb')](_0x7c6f('0xc'),_0x383d97,_0x7c6f('0xd'));logger['debug'](_0x7c6f('0xe'),_0x383d97,_0x7c6f('0xd'),JSON[_0x7c6f('0xf')](_0x576e9c));if(_0x576e9c['error']){if(_0x576e9c[_0x7c6f('0x10')][_0x7c6f('0x11')]===0x1f4){logger[_0x7c6f('0x10')](_0x7c6f('0xc'),_0x383d97,_0x576e9c[_0x7c6f('0x10')]['message']);return _0x2e1504(_0x576e9c[_0x7c6f('0x10')][_0x7c6f('0x12')]);}logger['error']('Setting,\x20%s,\x20%s',_0x383d97,_0x576e9c['error'][_0x7c6f('0x12')]);return _0xf9b565(_0x576e9c[_0x7c6f('0x10')][_0x7c6f('0x12')]);}else{logger[_0x7c6f('0xb')](_0x7c6f('0xc'),_0x383d97,_0x7c6f('0xd'));_0xf9b565(_0x576e9c[_0x7c6f('0x13')][_0x7c6f('0x12')]);}})['catch'](function(_0x10f6fc){logger[_0x7c6f('0x10')](_0x7c6f('0xc'),_0x383d97,_0x10f6fc);_0x2e1504(_0x10f6fc);});});}exports['ShowSetting']=function(_0x3c0422){var _0x919ece=this;return new Promise(function(_0x4bfb89,_0x523262){return db[_0x7c6f('0x14')]['find']({'raw':_0x3c0422[_0x7c6f('0x15')]?_0x3c0422[_0x7c6f('0x15')][_0x7c6f('0x16')]===undefined?!![]:![]:!![],'where':_0x3c0422[_0x7c6f('0x15')]?_0x3c0422[_0x7c6f('0x15')][_0x7c6f('0x17')]||null:null,'attributes':_0x3c0422[_0x7c6f('0x15')]?_0x3c0422[_0x7c6f('0x15')]['attributes']||null:null,'include':_0x3c0422[_0x7c6f('0x15')]?_0x3c0422[_0x7c6f('0x15')]['include']?_[_0x7c6f('0x18')](_0x3c0422[_0x7c6f('0x15')][_0x7c6f('0x19')],function(_0x43e4ee){return{'model':db[_0x43e4ee[_0x7c6f('0x1a')]],'as':_0x43e4ee['as'],'attributes':_0x43e4ee[_0x7c6f('0x1b')],'include':_0x43e4ee['include']?_[_0x7c6f('0x18')](_0x43e4ee[_0x7c6f('0x19')],function(_0x28f8b8){return{'model':db[_0x28f8b8['model']],'as':_0x28f8b8['as'],'attributes':_0x28f8b8[_0x7c6f('0x1b')],'include':_0x28f8b8['include']?_['map'](_0x28f8b8['include'],function(_0x37b232){return{'model':db[_0x37b232[_0x7c6f('0x1a')]],'as':_0x37b232['as'],'attributes':_0x37b232[_0x7c6f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7c6f('0xa')](function(_0x6c7b41){logger[_0x7c6f('0xb')]('ShowSetting',_0x3c0422);logger[_0x7c6f('0x1c')](_0x7c6f('0x1d'),_0x3c0422,JSON[_0x7c6f('0xf')](_0x6c7b41));_0x4bfb89(_0x6c7b41);})[_0x7c6f('0x1e')](function(_0x1ba558){logger[_0x7c6f('0x10')](_0x7c6f('0x1d'),_0x1ba558[_0x7c6f('0x12')],_0x3c0422);_0x523262(_0x919ece[_0x7c6f('0x10')](0x1f4,_0x1ba558['message']));});});}; \ No newline at end of file +var _0x9b61=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','ShowSetting','Setting','find','options','raw','where','attributes','include','map','model','lodash','util'];(function(_0x2fc026,_0xdc4f7a){var _0x34d056=function(_0x457d02){while(--_0x457d02){_0x2fc026['push'](_0x2fc026['shift']());}};_0x34d056(++_0xdc4f7a);}(_0x9b61,0x174));var _0x19b6=function(_0x4f3b12,_0x3e0790){_0x4f3b12=_0x4f3b12-0x0;var _0x3d15e4=_0x9b61[_0x4f3b12];return _0x3d15e4;};'use strict';var _=require(_0x19b6('0x0'));var util=require(_0x19b6('0x1'));var moment=require(_0x19b6('0x2'));var BPromise=require(_0x19b6('0x3'));var rs=require(_0x19b6('0x4'));var fs=require('fs');var Redis=require(_0x19b6('0x5'));var db=require(_0x19b6('0x6'))['db'];var utils=require(_0x19b6('0x7'));var logger=require(_0x19b6('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x19b6('0x9'));var client=jayson[_0x19b6('0xa')][_0x19b6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x196048,_0x234ab4,_0x2d4503){return new BPromise(function(_0x37d577,_0xdbde05){return client[_0x19b6('0xc')](_0x196048,_0x2d4503)[_0x19b6('0xd')](function(_0x38b426){logger[_0x19b6('0xe')](_0x19b6('0xf'),_0x234ab4,'request\x20sent');logger[_0x19b6('0x10')](_0x19b6('0x11'),_0x234ab4,_0x19b6('0x12'),JSON[_0x19b6('0x13')](_0x38b426));if(_0x38b426[_0x19b6('0x14')]){if(_0x38b426[_0x19b6('0x14')]['code']===0x1f4){logger['error'](_0x19b6('0xf'),_0x234ab4,_0x38b426[_0x19b6('0x14')][_0x19b6('0x15')]);return _0xdbde05(_0x38b426[_0x19b6('0x14')][_0x19b6('0x15')]);}logger[_0x19b6('0x14')](_0x19b6('0xf'),_0x234ab4,_0x38b426[_0x19b6('0x14')][_0x19b6('0x15')]);return _0x37d577(_0x38b426[_0x19b6('0x14')][_0x19b6('0x15')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x234ab4,_0x19b6('0x12'));_0x37d577(_0x38b426[_0x19b6('0x16')]['message']);}})[_0x19b6('0x17')](function(_0x3fc45e){logger['error']('Setting,\x20%s,\x20%s',_0x234ab4,_0x3fc45e);_0xdbde05(_0x3fc45e);});});}exports[_0x19b6('0x18')]=function(_0x109a5f){var _0x2d4bd7=this;return new Promise(function(_0x1da206,_0x3b46de){return db[_0x19b6('0x19')][_0x19b6('0x1a')]({'raw':_0x109a5f['options']?_0x109a5f[_0x19b6('0x1b')][_0x19b6('0x1c')]===undefined?!![]:![]:!![],'where':_0x109a5f[_0x19b6('0x1b')]?_0x109a5f[_0x19b6('0x1b')][_0x19b6('0x1d')]||null:null,'attributes':_0x109a5f['options']?_0x109a5f[_0x19b6('0x1b')][_0x19b6('0x1e')]||null:null,'include':_0x109a5f[_0x19b6('0x1b')]?_0x109a5f[_0x19b6('0x1b')][_0x19b6('0x1f')]?_[_0x19b6('0x20')](_0x109a5f[_0x19b6('0x1b')]['include'],function(_0x5cd453){return{'model':db[_0x5cd453['model']],'as':_0x5cd453['as'],'attributes':_0x5cd453[_0x19b6('0x1e')],'include':_0x5cd453[_0x19b6('0x1f')]?_[_0x19b6('0x20')](_0x5cd453[_0x19b6('0x1f')],function(_0x15474f){return{'model':db[_0x15474f[_0x19b6('0x21')]],'as':_0x15474f['as'],'attributes':_0x15474f[_0x19b6('0x1e')],'include':_0x15474f[_0x19b6('0x1f')]?_[_0x19b6('0x20')](_0x15474f[_0x19b6('0x1f')],function(_0xd4c121){return{'model':db[_0xd4c121[_0x19b6('0x21')]],'as':_0xd4c121['as'],'attributes':_0xd4c121[_0x19b6('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x19b6('0xd')](function(_0x1f9ee4){logger[_0x19b6('0xe')]('ShowSetting',_0x109a5f);logger[_0x19b6('0x10')](_0x19b6('0x18'),_0x109a5f,JSON['stringify'](_0x1f9ee4));_0x1da206(_0x1f9ee4);})[_0x19b6('0x17')](function(_0x4fc728){logger[_0x19b6('0x14')](_0x19b6('0x18'),_0x4fc728['message'],_0x109a5f);_0x3b46de(_0x2d4bd7['error'](0x1f4,_0x4fc728[_0x19b6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 13743de..732bc84 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 _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0xfe0469,_0x3b4160){var _0x30a0ac=function(_0x3312d4){while(--_0x3312d4){_0xfe0469['push'](_0xfe0469['shift']());}};_0x30a0ac(++_0x3b4160);}(_0x7a54,0x106));var _0x47a5=function(_0x2a9b3a,_0x49046e){_0x2a9b3a=_0x2a9b3a-0x0;var _0x11a482=_0x7a54[_0x2a9b3a];return _0x11a482;};'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['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file +var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x1c3f8e,_0x2f7794){var _0x40b720=function(_0xd92bec){while(--_0xd92bec){_0x1c3f8e['push'](_0x1c3f8e['shift']());}};_0x40b720(++_0x2f7794);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('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 7f5c515..f1c0194 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 _0xe467=['infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','ENUM','connectel','clicksend','bandwidth'];(function(_0x8a30cf,_0x40f19b){var _0x20f439=function(_0x157a5d){while(--_0x157a5d){_0x8a30cf['push'](_0x8a30cf['shift']());}};_0x20f439(++_0x40f19b);}(_0xe467,0x97));var _0x7e46=function(_0x3632fa,_0x30c819){_0x3632fa=_0x3632fa-0x0;var _0x35c4cf=_0xe467[_0x3632fa];return _0x35c4cf;};'use strict';var Sequelize=require(_0x7e46('0x0'));var rs=require(_0x7e46('0x1'));module[_0x7e46('0x2')]={'name':{'type':Sequelize[_0x7e46('0x3')],'unique':_0x7e46('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x7e46('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x7e46('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x7e46('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x7e46('0x3')]},'type':{'type':Sequelize[_0x7e46('0x5')]('twilio','skebby',_0x7e46('0x6'),_0x7e46('0x7'),'plivo','clickatell',_0x7e46('0x8'),'csc',_0x7e46('0x9'),_0x7e46('0xa'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x7e46('0x3')]},'authToken':{'type':Sequelize[_0x7e46('0x3')]},'smsMethod':{'type':Sequelize[_0x7e46('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x7e46('0x3')]},'password':{'type':Sequelize[_0x7e46('0x3')]},'apiKey':{'type':Sequelize[_0x7e46('0x3')]},'applicationId':{'type':Sequelize[_0x7e46('0x3')]},'accountId':{'type':Sequelize[_0x7e46('0x3')]},'senderString':{'type':Sequelize[_0x7e46('0x3')]},'deliveryReport':{'type':Sequelize[_0x7e46('0xb')],'defaultValue':![]},'description':{'type':Sequelize[_0x7e46('0x3')]},'notificationTemplate':{'type':Sequelize[_0x7e46('0xc')],'defaultValue':function(){return _0x7e46('0xd');}},'notificationSound':{'type':Sequelize[_0x7e46('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7e46('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x7e46('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7e46('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7e46('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7e46('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7e46('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x7e46('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7e46('0xe')],'comment':_0x7e46('0xf')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x7e46('0x10'),'set':function(_0x4c8145){if(!_0x4c8145)this[_0x7e46('0x11')](_0x7e46('0x12'),null);this[_0x7e46('0x11')](_0x7e46('0x13'),_0x4c8145);}}}; \ No newline at end of file +var _0x3cc0=['clickatell','bandwidth','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','ENUM','twilio','skebby','clicksend'];(function(_0x52f159,_0x419d8a){var _0x156799=function(_0xf168e8){while(--_0xf168e8){_0x52f159['push'](_0x52f159['shift']());}};_0x156799(++_0x419d8a);}(_0x3cc0,0x199));var _0x03cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3cc0[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x03cc('0x0'));var rs=require(_0x03cc('0x1'));module[_0x03cc('0x2')]={'name':{'type':Sequelize[_0x03cc('0x3')],'unique':_0x03cc('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x03cc('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x03cc('0x3')]},'type':{'type':Sequelize[_0x03cc('0x5')](_0x03cc('0x6'),_0x03cc('0x7'),'connectel',_0x03cc('0x8'),'plivo',_0x03cc('0x9'),_0x03cc('0xa'),'csc','infobip','intelepeer')},'accountSid':{'type':Sequelize[_0x03cc('0x3')]},'authId':{'type':Sequelize[_0x03cc('0x3')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x03cc('0x5')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x03cc('0x3')]},'apiKey':{'type':Sequelize[_0x03cc('0x3')]},'applicationId':{'type':Sequelize[_0x03cc('0x3')]},'accountId':{'type':Sequelize[_0x03cc('0x3')]},'senderString':{'type':Sequelize[_0x03cc('0x3')]},'deliveryReport':{'type':Sequelize[_0x03cc('0xb')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x03cc('0xc')],'defaultValue':function(){return _0x03cc('0xd');}},'notificationSound':{'type':Sequelize[_0x03cc('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x03cc('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x03cc('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x03cc('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x03cc('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x03cc('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x03cc('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x03cc('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x03cc('0xe')],'comment':_0x03cc('0xf')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x03cc('0x10'),'set':function(_0x4eea4f){if(!_0x4eea4f)this[_0x03cc('0x11')]('mandatoryDispositionPauseId',null);this[_0x03cc('0x11')](_0x03cc('0x12'),_0x4eea4f);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index b37d659..857061c 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 _0x9605=['UserProfileResource','end','stack','name','Pause','map','SmsAccount','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','show','params','keys','options','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','SmsAccountId','getDispositions','order','Disposition','removeDispositions','ids','findOne','CannedAnswer','removeAnswers','notify','Applications','applications','orderBy','priority','asc','account','ValidationError','difference','updatedAt','CompanyId','ListId','mobile','twilio','from','Body','messageId','MessageSid','skebby','sender','connectel','clicksend','From','MessageUUID','infobip','results','text','csc','originatingAddress','replyMessageId','bandwidth','intelepeer','isNil','Sequelize','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmContact','Contacts','list','omit','contact','SmsInteraction','spread','interaction','created','unmanaged','*,*,*,*','ContactId','UserId','User','agent','waitForTheAssignedAgent','queueId','SmsQueue','unshift','queue','Start','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','send','\x0a','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','SmsApplication','bulkCreate','finally','getApplications','Contact','fullname','internal','Tag','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','CmList','List','DESC','out','Messages','SmsMessage','dataValues','push','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','message_id','status_code','groupName','redif','error_code','DELIVERED','RECEIVED_BY_RECIPIENT','clickatell','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','debug','error','code','message','request\x20sent','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','update','destroy','SmsAccounts'];(function(_0x6da815,_0x261d8a){var _0x322545=function(_0x57f421){while(--_0x57f421){_0x6da815['push'](_0x6da815['shift']());}};_0x322545(++_0x261d8a);}(_0x9605,0xae));var _0x5960=function(_0x3b06fa,_0x472a69){_0x3b06fa=_0x3b06fa-0x0;var _0x48dc32=_0x9605[_0x3b06fa];return _0x48dc32;};'use strict';var emlformat=require(_0x5960('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5960('0x1'));var jsonpatch=require(_0x5960('0x2'));var rp=require(_0x5960('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5960('0x4'));var util=require(_0x5960('0x5'));var path=require(_0x5960('0x6'));var sox=require(_0x5960('0x7'));var csv=require(_0x5960('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5960('0x9'));var _=require(_0x5960('0xa'));var squel=require(_0x5960('0xb'));var crypto=require(_0x5960('0xc'));var jsforce=require(_0x5960('0xd'));var deskjs=require(_0x5960('0xe'));var toCsv=require(_0x5960('0x8'));var querystring=require('querystring');var Papa=require(_0x5960('0xf'));var Redis=require(_0x5960('0x10'));var authService=require(_0x5960('0x11'));var qs=require(_0x5960('0x12'));var as=require(_0x5960('0x13'));var hardwareService=require(_0x5960('0x14'));var logger=require(_0x5960('0x15'))(_0x5960('0x16'));var utils=require('../../config/utils');var config=require(_0x5960('0x17'));var licenseUtil=require(_0x5960('0x18'));var db=require(_0x5960('0x19'))['db'];config[_0x5960('0x1a')]=_[_0x5960('0x1b')](config['redis'],{'host':_0x5960('0x1c'),'port':0x18eb});var socket=require(_0x5960('0x1d'))(new Redis(config[_0x5960('0x1a')]));require(_0x5960('0x1e'))[_0x5960('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x5960('0x20')][_0x5960('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x1df16b,_0x3ea84f,_0x570b7e,_0x85d207){return new BPromise(function(_0x32700b,_0xe80468){var _0x18314e=_0x85d207||client;return _0x18314e[_0x5960('0x22')](_0x1df16b,_0x570b7e)[_0x5960('0x23')](function(_0x3a628f){logger[_0x5960('0x24')](_0x5960('0x25'),_0x3ea84f,'request\x20sent');logger[_0x5960('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3ea84f,'request\x20sent',JSON['stringify'](_0x3a628f));if(_0x3a628f[_0x5960('0x27')]){if(_0x3a628f[_0x5960('0x27')][_0x5960('0x28')]===0x1f4){logger[_0x5960('0x27')](_0x5960('0x25'),_0x3ea84f,_0x3a628f['error'][_0x5960('0x29')]);return _0xe80468(_0x3a628f[_0x5960('0x27')][_0x5960('0x29')]);}logger[_0x5960('0x27')](_0x5960('0x25'),_0x3ea84f,_0x3a628f['error'][_0x5960('0x29')]);return _0x32700b(_0x3a628f[_0x5960('0x27')]['message']);}else{logger[_0x5960('0x24')](_0x5960('0x25'),_0x3ea84f,_0x5960('0x2a'));_0x32700b(_0x3a628f['result'][_0x5960('0x29')]);}})['catch'](function(_0xa2586d){logger['error']('SmsAccount,\x20%s,\x20%s',_0x3ea84f,_0xa2586d);_0xe80468(_0xa2586d);});});}function respondWithStatusCode(_0x1ccd69,_0x5df8e0){_0x5df8e0=_0x5df8e0||0xcc;return function(_0x102788){if(_0x102788){return _0x1ccd69[_0x5960('0x2b')](_0x5df8e0);}return _0x1ccd69[_0x5960('0x2c')](_0x5df8e0)['end']();};}function respondWithResult(_0x556cda,_0x23ee16){_0x23ee16=_0x23ee16||0xc8;return function(_0x2e44ed){if(_0x2e44ed){return _0x556cda[_0x5960('0x2c')](_0x23ee16)[_0x5960('0x2d')](_0x2e44ed);}};}function respondWithFilteredResult(_0x577324,_0xdc755f){return function(_0x16e533){if(_0x16e533){var _0x3ba560=typeof _0xdc755f[_0x5960('0x2e')]===_0x5960('0x2f')&&typeof _0xdc755f['limit']==='undefined';var _0x4d5bde=_0x16e533[_0x5960('0x30')];var _0x5b40c6=_0x3ba560?0x0:_0xdc755f['offset'];var _0x4059d6=_0x3ba560?_0x16e533[_0x5960('0x30')]:_0xdc755f[_0x5960('0x2e')]+_0xdc755f['limit'];var _0x29ae57;if(_0x4059d6>=_0x4d5bde){_0x4059d6=_0x4d5bde;_0x29ae57=0xc8;}else{_0x29ae57=0xce;}_0x577324[_0x5960('0x2c')](_0x29ae57);return _0x577324[_0x5960('0x31')](_0x5960('0x32'),_0x5b40c6+'-'+_0x4059d6+'/'+_0x4d5bde)[_0x5960('0x2d')](_0x16e533);}return null;};}function patchUpdates(_0x4c436c){return function(_0x56d4d1){try{jsonpatch[_0x5960('0x33')](_0x56d4d1,_0x4c436c,!![]);}catch(_0x23ea96){return BPromise[_0x5960('0x34')](_0x23ea96);}return _0x56d4d1['save']();};}function saveUpdates(_0x33bbf4,_0x4ba6ef){return function(_0x132054){if(_0x132054){return _0x132054[_0x5960('0x35')](_0x33bbf4)['then'](function(_0x43fe86){return _0x43fe86;});}return null;};}function removeEntity(_0x1ab9a0,_0x59bde6){return function(_0x1a387b){if(_0x1a387b){return _0x1a387b[_0x5960('0x36')]()[_0x5960('0x23')](function(){var _0x32b86f=_0x1a387b['get']({'plain':!![]});var _0x4cdf1a=_0x5960('0x37');return db[_0x5960('0x38')]['destroy']({'where':{'type':_0x4cdf1a,'resourceId':_0x32b86f['id']}})[_0x5960('0x23')](function(){return _0x1a387b;});})['then'](function(){_0x1ab9a0['status'](0xcc)[_0x5960('0x39')]();});}};}function handleEntityNotFound(_0x2b0fbc,_0x256d08){return function(_0x4a942a){if(!_0x4a942a){_0x2b0fbc[_0x5960('0x2b')](0x194);}return _0x4a942a;};}function handleError(_0x3a643e,_0x518670){_0x518670=_0x518670||0x1f4;return function(_0x19b159){logger[_0x5960('0x27')](_0x19b159[_0x5960('0x3a')]);if(_0x19b159[_0x5960('0x3b')]){delete _0x19b159['name'];}_0x3a643e[_0x5960('0x2c')](_0x518670)['send'](_0x19b159);};}exports['index']=function(_0x17e196,_0x47d017){var _0x4c1e62={'include':[{'model':db[_0x5960('0x3c')],'as':'mandatoryDispositionPause'}]},_0x3f6815={},_0x3c96dc={'count':0x0,'rows':[]};var _0x49c308=_[_0x5960('0x3d')](db[_0x5960('0x3e')][_0x5960('0x3f')],function(_0x422418){return{'name':_0x422418['fieldName'],'type':_0x422418[_0x5960('0x40')][_0x5960('0x41')]};});_0x3f6815[_0x5960('0x42')]=_[_0x5960('0x3d')](_0x49c308,_0x5960('0x3b'));_0x3f6815[_0x5960('0x43')]=_['keys'](_0x17e196[_0x5960('0x43')]);_0x3f6815[_0x5960('0x44')]=_[_0x5960('0x45')](_0x3f6815['model'],_0x3f6815[_0x5960('0x43')]);_0x4c1e62[_0x5960('0x46')]=_['intersection'](_0x3f6815[_0x5960('0x42')],qs[_0x5960('0x47')](_0x17e196[_0x5960('0x43')][_0x5960('0x47')]));_0x4c1e62['attributes']=_0x4c1e62[_0x5960('0x46')][_0x5960('0x48')]?_0x4c1e62[_0x5960('0x46')]:_0x3f6815[_0x5960('0x42')];if(!_0x17e196[_0x5960('0x43')][_0x5960('0x49')](_0x5960('0x4a'))){_0x4c1e62[_0x5960('0x4b')]=qs[_0x5960('0x4b')](_0x17e196[_0x5960('0x43')][_0x5960('0x4b')]);_0x4c1e62['offset']=qs[_0x5960('0x2e')](_0x17e196[_0x5960('0x43')][_0x5960('0x2e')]);}_0x4c1e62['order']=qs[_0x5960('0x4c')](_0x17e196['query'][_0x5960('0x4c')]);_0x4c1e62[_0x5960('0x4d')]=qs['filters'](_[_0x5960('0x4e')](_0x17e196[_0x5960('0x43')],_0x3f6815[_0x5960('0x44')]),_0x49c308);if(_0x17e196[_0x5960('0x43')][_0x5960('0x4f')]){_0x4c1e62[_0x5960('0x4d')]=_[_0x5960('0x50')](_0x4c1e62['where'],{'$or':_[_0x5960('0x3d')](_0x49c308,function(_0x27147c){if(_0x27147c[_0x5960('0x40')]!=='VIRTUAL'){var _0x424725={};_0x424725[_0x27147c[_0x5960('0x3b')]]={'$like':'%'+_0x17e196[_0x5960('0x43')]['filter']+'%'};return _0x424725;}})});}_0x4c1e62=_[_0x5960('0x50')]({},_0x4c1e62,_0x17e196['options']);var _0x2d765d={'where':_0x4c1e62[_0x5960('0x4d')]};return db['SmsAccount']['count'](_0x2d765d)[_0x5960('0x23')](function(_0x347a30){_0x3c96dc[_0x5960('0x30')]=_0x347a30;if(_0x17e196['query'][_0x5960('0x51')]){_0x4c1e62[_0x5960('0x52')]=[{'all':!![]}];}return db['SmsAccount'][_0x5960('0x53')](_0x4c1e62);})[_0x5960('0x23')](function(_0x415976){_0x3c96dc[_0x5960('0x54')]=_0x415976;return _0x3c96dc;})['then'](respondWithFilteredResult(_0x47d017,_0x4c1e62))['catch'](handleError(_0x47d017,null));};exports[_0x5960('0x55')]=function(_0xc72be5,_0x53dd2a){var _0x1c9b1e={'raw':![],'where':{'id':_0xc72be5[_0x5960('0x56')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x2c232e={};_0x2c232e[_0x5960('0x42')]=_[_0x5960('0x57')](db[_0x5960('0x3e')][_0x5960('0x3f')]);_0x2c232e['query']=_[_0x5960('0x57')](_0xc72be5[_0x5960('0x43')]);_0x2c232e[_0x5960('0x44')]=_[_0x5960('0x45')](_0x2c232e[_0x5960('0x42')],_0x2c232e[_0x5960('0x43')]);_0x1c9b1e[_0x5960('0x46')]=_[_0x5960('0x45')](_0x2c232e[_0x5960('0x42')],qs[_0x5960('0x47')](_0xc72be5[_0x5960('0x43')]['fields']));_0x1c9b1e['attributes']=_0x1c9b1e[_0x5960('0x46')][_0x5960('0x48')]?_0x1c9b1e[_0x5960('0x46')]:_0x2c232e[_0x5960('0x42')];if(_0xc72be5['query'][_0x5960('0x51')]){_0x1c9b1e['include']=[{'all':!![]}];}_0x1c9b1e=_[_0x5960('0x50')]({},_0x1c9b1e,_0xc72be5[_0x5960('0x58')]);return db['SmsAccount'][_0x5960('0x59')](_0x1c9b1e)['then'](handleEntityNotFound(_0x53dd2a,null))['then'](respondWithResult(_0x53dd2a,null))[_0x5960('0x5a')](handleError(_0x53dd2a,null));};exports[_0x5960('0x5b')]=function(_0x54aee3,_0x46fdf3){return db[_0x5960('0x3e')][_0x5960('0x5b')](_0x54aee3['body'],{})[_0x5960('0x23')](function(_0x388a1f){var _0x1a5c26=_0x54aee3[_0x5960('0x5c')][_0x5960('0x5d')]({'plain':!![]});if(!_0x1a5c26)throw new Error(_0x5960('0x5e'));if(_0x1a5c26['role']===_0x5960('0x5c')){var _0x7b7cbd=_0x388a1f[_0x5960('0x5d')]({'plain':!![]});var _0x3735ec='SmsAccounts';return db[_0x5960('0x5f')][_0x5960('0x59')]({'where':{'name':_0x3735ec,'userProfileId':_0x1a5c26[_0x5960('0x60')]},'raw':!![]})[_0x5960('0x23')](function(_0x2b67cd){if(_0x2b67cd&&_0x2b67cd[_0x5960('0x61')]===0x0){return db['UserProfileResource']['create']({'name':_0x7b7cbd[_0x5960('0x3b')],'resourceId':_0x7b7cbd['id'],'type':_0x2b67cd[_0x5960('0x3b')],'sectionId':_0x2b67cd['id']},{})[_0x5960('0x23')](function(){return _0x388a1f;});}else{return _0x388a1f;}})[_0x5960('0x5a')](function(_0x4d6496){logger[_0x5960('0x27')](_0x5960('0x62'),_0x4d6496);throw _0x4d6496;});}return _0x388a1f;})[_0x5960('0x23')](respondWithResult(_0x46fdf3,0xc9))[_0x5960('0x5a')](handleError(_0x46fdf3,null));};exports['update']=function(_0x358524,_0x17d635){if(_0x358524[_0x5960('0x63')]['id']){delete _0x358524[_0x5960('0x63')]['id'];}return db[_0x5960('0x3e')][_0x5960('0x59')]({'where':{'id':_0x358524[_0x5960('0x56')]['id']},'include':[{'model':db[_0x5960('0x3c')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x17d635,null))[_0x5960('0x23')](saveUpdates(_0x358524[_0x5960('0x63')],null))[_0x5960('0x23')](respondWithResult(_0x17d635,null))['catch'](handleError(_0x17d635,null));};exports[_0x5960('0x36')]=function(_0x4c4c28,_0x31ab72){return db['SmsAccount'][_0x5960('0x59')]({'where':{'id':_0x4c4c28['params']['id']}})[_0x5960('0x23')](handleEntityNotFound(_0x31ab72,null))['then'](removeEntity(_0x31ab72,null))[_0x5960('0x5a')](handleError(_0x31ab72,null));};exports[_0x5960('0x64')]=function(_0x3c5431,_0x422ef4){return db[_0x5960('0x3e')][_0x5960('0x64')]()[_0x5960('0x23')](respondWithResult(_0x422ef4,null))[_0x5960('0x5a')](handleError(_0x422ef4,null));};exports[_0x5960('0x65')]=function(_0x57f65c,_0x30a14b,_0x1ac20e){if(_0x57f65c['body']['id']){delete _0x57f65c['body']['id'];}return db[_0x5960('0x3e')][_0x5960('0x59')]({'where':{'id':_0x57f65c[_0x5960('0x56')]['id']}})['then'](handleEntityNotFound(_0x30a14b,null))[_0x5960('0x23')](function(_0x25fb99){if(_0x25fb99){_0x57f65c[_0x5960('0x63')][_0x5960('0x66')]=_0x25fb99['id'];return db['Disposition'][_0x5960('0x5b')](_0x57f65c[_0x5960('0x63')]);}})['then'](respondWithResult(_0x30a14b,null))[_0x5960('0x5a')](handleError(_0x30a14b,null));};exports[_0x5960('0x67')]=function(_0x44b245,_0x2a76a5,_0x233c6c){var _0x3714b4={'raw':![],'where':{}};var _0x4e30b8={};var _0x4bc036={'count':0x0,'rows':[]};return db[_0x5960('0x3e')]['findOne']({'where':{'id':_0x44b245[_0x5960('0x56')]['id']}})[_0x5960('0x23')](handleEntityNotFound(_0x2a76a5,null))[_0x5960('0x23')](function(_0x16a4e2){if(_0x16a4e2){_0x4e30b8['model']=_[_0x5960('0x57')](db['Disposition'][_0x5960('0x3f')]);_0x4e30b8[_0x5960('0x43')]=_[_0x5960('0x57')](_0x44b245[_0x5960('0x43')]);_0x4e30b8[_0x5960('0x44')]=_['intersection'](_0x4e30b8[_0x5960('0x42')],_0x4e30b8['query']);_0x3714b4[_0x5960('0x46')]=_[_0x5960('0x45')](_0x4e30b8[_0x5960('0x42')],qs['fields'](_0x44b245[_0x5960('0x43')][_0x5960('0x47')]));_0x3714b4[_0x5960('0x46')]=_0x3714b4[_0x5960('0x46')][_0x5960('0x48')]?_0x3714b4[_0x5960('0x46')]:_0x4e30b8['model'];if(!_0x44b245[_0x5960('0x43')][_0x5960('0x49')](_0x5960('0x4a'))){_0x3714b4[_0x5960('0x4b')]=qs[_0x5960('0x4b')](_0x44b245['query'][_0x5960('0x4b')]);_0x3714b4[_0x5960('0x2e')]=qs[_0x5960('0x2e')](_0x44b245[_0x5960('0x43')][_0x5960('0x2e')]);}_0x3714b4[_0x5960('0x68')]=qs[_0x5960('0x4c')](_0x44b245[_0x5960('0x43')][_0x5960('0x4c')]);_0x3714b4['where']=qs['filters'](_[_0x5960('0x4e')](_0x44b245[_0x5960('0x43')],_0x4e30b8['filters']));_0x3714b4['where'][_0x5960('0x66')]=_0x16a4e2['id'];if(_0x44b245[_0x5960('0x43')]['filter']){_0x3714b4[_0x5960('0x4d')]=_[_0x5960('0x50')](_0x3714b4['where'],{'$or':_[_0x5960('0x3d')](_0x3714b4[_0x5960('0x46')],function(_0xad397f){var _0x50b5a9={};_0x50b5a9[_0xad397f]={'$like':'%'+_0x44b245[_0x5960('0x43')]['filter']+'%'};return _0x50b5a9;})});}_0x3714b4=_[_0x5960('0x50')]({},_0x3714b4,_0x44b245['options']);return db[_0x5960('0x69')][_0x5960('0x30')]({'where':_0x3714b4[_0x5960('0x4d')]})[_0x5960('0x23')](function(_0x223695){_0x4bc036[_0x5960('0x30')]=_0x223695;if(_0x44b245[_0x5960('0x43')][_0x5960('0x51')]){_0x3714b4[_0x5960('0x52')]=[{'all':!![]}];}return db[_0x5960('0x69')][_0x5960('0x53')](_0x3714b4);})[_0x5960('0x23')](function(_0x3d2500){_0x4bc036[_0x5960('0x54')]=_0x3d2500;return _0x4bc036;});}})[_0x5960('0x23')](respondWithFilteredResult(_0x2a76a5,_0x3714b4))[_0x5960('0x5a')](handleError(_0x2a76a5,null));};exports[_0x5960('0x6a')]=function(_0x3784af,_0x20d85c,_0x1178db){return db['SmsAccount'][_0x5960('0x59')]({'where':{'id':_0x3784af[_0x5960('0x56')]['id']}})[_0x5960('0x23')](handleEntityNotFound(_0x20d85c,null))[_0x5960('0x23')](function(_0x1476fe){if(_0x1476fe){return _0x1476fe['removeDispositions'](_0x3784af[_0x5960('0x43')][_0x5960('0x6b')]);}})['then'](respondWithStatusCode(_0x20d85c,null))[_0x5960('0x5a')](handleError(_0x20d85c,null));};exports['addAnswer']=function(_0x1990da,_0x2a2a38,_0x125ef0){if(_0x1990da['body']['id']){delete _0x1990da[_0x5960('0x63')]['id'];}return db['SmsAccount'][_0x5960('0x59')]({'where':{'id':_0x1990da['params']['id']}})[_0x5960('0x23')](handleEntityNotFound(_0x2a2a38,null))['then'](function(_0x53d3e5){if(_0x53d3e5){_0x1990da['body'][_0x5960('0x66')]=_0x53d3e5['id'];return db['CannedAnswer']['create'](_0x1990da['body']);}})[_0x5960('0x23')](respondWithResult(_0x2a2a38,null))[_0x5960('0x5a')](handleError(_0x2a2a38,null));};exports['getAnswers']=function(_0xb2190b,_0x383b5c,_0x274d3d){var _0x46c0cc={'raw':![],'where':{}};var _0x4d709a={};var _0xbdce4e={'count':0x0,'rows':[]};return db[_0x5960('0x3e')][_0x5960('0x6c')]({'where':{'id':_0xb2190b[_0x5960('0x56')]['id']}})[_0x5960('0x23')](handleEntityNotFound(_0x383b5c,null))[_0x5960('0x23')](function(_0x30ecdf){if(_0x30ecdf){_0x4d709a[_0x5960('0x42')]=_[_0x5960('0x57')](db['CannedAnswer'][_0x5960('0x3f')]);_0x4d709a[_0x5960('0x43')]=_['keys'](_0xb2190b['query']);_0x4d709a[_0x5960('0x44')]=_[_0x5960('0x45')](_0x4d709a[_0x5960('0x42')],_0x4d709a[_0x5960('0x43')]);_0x46c0cc['attributes']=_[_0x5960('0x45')](_0x4d709a[_0x5960('0x42')],qs[_0x5960('0x47')](_0xb2190b[_0x5960('0x43')][_0x5960('0x47')]));_0x46c0cc[_0x5960('0x46')]=_0x46c0cc['attributes'][_0x5960('0x48')]?_0x46c0cc[_0x5960('0x46')]:_0x4d709a['model'];if(!_0xb2190b['query'][_0x5960('0x49')](_0x5960('0x4a'))){_0x46c0cc[_0x5960('0x4b')]=qs[_0x5960('0x4b')](_0xb2190b[_0x5960('0x43')][_0x5960('0x4b')]);_0x46c0cc[_0x5960('0x2e')]=qs[_0x5960('0x2e')](_0xb2190b[_0x5960('0x43')][_0x5960('0x2e')]);}_0x46c0cc[_0x5960('0x68')]=qs[_0x5960('0x4c')](_0xb2190b[_0x5960('0x43')][_0x5960('0x4c')]);_0x46c0cc[_0x5960('0x4d')]=qs[_0x5960('0x44')](_['pick'](_0xb2190b['query'],_0x4d709a[_0x5960('0x44')]));_0x46c0cc['where'][_0x5960('0x66')]=_0x30ecdf['id'];if(_0xb2190b[_0x5960('0x43')]['filter']){_0x46c0cc[_0x5960('0x4d')]=_['merge'](_0x46c0cc[_0x5960('0x4d')],{'$or':_['map'](_0x46c0cc[_0x5960('0x46')],function(_0x46abe0){var _0x47a1dd={};_0x47a1dd[_0x46abe0]={'$like':'%'+_0xb2190b['query']['filter']+'%'};return _0x47a1dd;})});}_0x46c0cc=_[_0x5960('0x50')]({},_0x46c0cc,_0xb2190b[_0x5960('0x58')]);return db[_0x5960('0x6d')][_0x5960('0x30')]({'where':_0x46c0cc['where']})['then'](function(_0x12162e){_0xbdce4e[_0x5960('0x30')]=_0x12162e;if(_0xb2190b[_0x5960('0x43')]['includeAll']){_0x46c0cc[_0x5960('0x52')]=[{'all':!![]}];}return db[_0x5960('0x6d')]['findAll'](_0x46c0cc);})['then'](function(_0x47d4d4){_0xbdce4e[_0x5960('0x54')]=_0x47d4d4;return _0xbdce4e;});}})[_0x5960('0x23')](respondWithFilteredResult(_0x383b5c,_0x46c0cc))[_0x5960('0x5a')](handleError(_0x383b5c,null));};exports[_0x5960('0x6e')]=function(_0x17d3c8,_0x32e75d,_0x51df7){return db[_0x5960('0x3e')][_0x5960('0x59')]({'where':{'id':_0x17d3c8[_0x5960('0x56')]['id']}})['then'](handleEntityNotFound(_0x32e75d,null))[_0x5960('0x23')](function(_0x2aa0d8){if(_0x2aa0d8){return _0x2aa0d8[_0x5960('0x6e')](_0x17d3c8[_0x5960('0x43')][_0x5960('0x6b')]);}})[_0x5960('0x23')](respondWithStatusCode(_0x32e75d,null))['catch'](handleError(_0x32e75d,null));};exports[_0x5960('0x6f')]=function(_0x12be83,_0xa9db20,_0x5f0457){var _0x24b761={'channel':'sms'};var _0x45fd89=[];var _0x1f5238=[];var _0x2a530e={};return db[_0x5960('0x3e')][_0x5960('0x59')]({'where':{'id':_0x12be83[_0x5960('0x56')]['id']},'include':[{'model':db['SmsApplication'],'as':_0x5960('0x70')}]})['then'](handleEntityNotFound(_0xa9db20,null))[_0x5960('0x23')](function(_0x3a2912){_0x24b761['account']=_0x3a2912;_0x24b761[_0x5960('0x71')]=_[_0x5960('0x72')](_0x3a2912[_0x5960('0x70')],[_0x5960('0x73')],[_0x5960('0x74')]);if(_0x24b761[_0x5960('0x75')][_0x5960('0x70')]){delete _0x24b761[_0x5960('0x75')]['Applications'];}return db['CmContact'][_0x5960('0x64')]();})['then'](function(_0x52ac80){if(!_0x52ac80){throw new db['Sequelize'][(_0x5960('0x76'))]('no\x20available\x20attributes');}_0x45fd89=_[_0x5960('0x77')](_['keys'](_0x52ac80),['createdAt',_0x5960('0x78')]);_0x1f5238=_[_0x5960('0x77')](_['keys'](_0x52ac80),['createdAt',_0x5960('0x78'),_0x5960('0x79'),_0x5960('0x7a')]);_0x24b761[_0x5960('0x63')]={'mapKey':_0x5960('0x7b')};if(_0x24b761['account']['type']){switch(_0x24b761['account']['type']){case _0x5960('0x7c'):_0x24b761[_0x5960('0x63')][_0x5960('0x7d')]=_0x12be83[_0x5960('0x63')]['From'];_0x24b761['body']['body']=_0x12be83['body'][_0x5960('0x7e')];_0x24b761['body'][_0x5960('0x7f')]=_0x12be83[_0x5960('0x63')][_0x5960('0x80')];break;case _0x5960('0x81'):_0x24b761[_0x5960('0x63')]['from']='+'+_0x12be83[_0x5960('0x63')][_0x5960('0x82')];_0x24b761[_0x5960('0x63')][_0x5960('0x63')]=_0x12be83[_0x5960('0x63')]['text'];break;case _0x5960('0x83'):_0x24b761[_0x5960('0x63')][_0x5960('0x7d')]=_0x12be83[_0x5960('0x63')]['from'];_0x24b761[_0x5960('0x63')][_0x5960('0x63')]=_0x12be83[_0x5960('0x63')]['message'];break;case _0x5960('0x84'):_0x24b761['body'][_0x5960('0x7d')]=_0x12be83[_0x5960('0x63')]['from'];_0x24b761[_0x5960('0x63')][_0x5960('0x63')]=_0x12be83[_0x5960('0x63')]['body'];_0x24b761[_0x5960('0x63')]['messageId']=_0x12be83[_0x5960('0x63')]['message_id'];break;case'plivo':_0x24b761[_0x5960('0x63')][_0x5960('0x7d')]=_0x12be83['body'][_0x5960('0x85')];_0x24b761[_0x5960('0x63')][_0x5960('0x63')]=_0x12be83[_0x5960('0x63')]['Text'];_0x24b761[_0x5960('0x63')]['messageId']=_0x12be83['body'][_0x5960('0x86')];break;case _0x5960('0x87'):_0x24b761[_0x5960('0x63')][_0x5960('0x7d')]='+'+_0x12be83['body']['results'][0x0][_0x5960('0x7d')];_0x24b761[_0x5960('0x63')][_0x5960('0x63')]=_0x12be83[_0x5960('0x63')][_0x5960('0x88')][0x0][_0x5960('0x89')];_0x24b761[_0x5960('0x63')][_0x5960('0x7f')]=_0x12be83[_0x5960('0x63')][_0x5960('0x88')][0x0][_0x5960('0x7f')];break;case _0x5960('0x8a'):_0x24b761[_0x5960('0x63')][_0x5960('0x7d')]=_0x12be83['body'][_0x5960('0x8b')];_0x24b761[_0x5960('0x63')][_0x5960('0x63')]=_0x12be83['body']['segmentedMessage']['message'];break;case'clickatell':_0x24b761['body'][_0x5960('0x7d')]=_0x12be83[_0x5960('0x63')]['fromNumber'];_0x24b761['body']['body']=_0x12be83[_0x5960('0x63')][_0x5960('0x89')];_0x24b761['body']['messageId']=_0x12be83[_0x5960('0x63')][_0x5960('0x8c')];break;case _0x5960('0x8d'):_0x24b761[_0x5960('0x63')][_0x5960('0x7f')]=_0x12be83['body'][0x0][_0x5960('0x29')]['id'];_0x24b761[_0x5960('0x63')][_0x5960('0x7d')]=_0x12be83['body'][0x0][_0x5960('0x29')][_0x5960('0x7d')];_0x24b761[_0x5960('0x63')][_0x5960('0x63')]=_0x12be83[_0x5960('0x63')][0x0][_0x5960('0x29')][_0x5960('0x89')];break;case _0x5960('0x8e'):_0x24b761[_0x5960('0x63')][_0x5960('0x7d')]=_0x12be83[_0x5960('0x63')][_0x5960('0x7d')];_0x24b761['body']['body']=_0x12be83[_0x5960('0x63')][_0x5960('0x29')];_0x24b761[_0x5960('0x63')][_0x5960('0x7f')]=_0x12be83[_0x5960('0x63')]['refid'];break;}}if(_0x24b761[_0x5960('0x63')]['id']){delete _0x24b761['body']['id'];}if(_[_0x5960('0x8f')](_0x24b761[_0x5960('0x63')][_0x5960('0x7d')])){throw new db[(_0x5960('0x90'))][(_0x5960('0x76'))](_0x5960('0x91'));}if(_[_0x5960('0x8f')](_0x24b761[_0x5960('0x63')][_0x5960('0x63')])||_0x24b761[_0x5960('0x63')][_0x5960('0x63')]===''){throw new db[(_0x5960('0x90'))][(_0x5960('0x76'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x24b761[_0x5960('0x63')][_0x5960('0x92')])){throw new db[(_0x5960('0x90'))][(_0x5960('0x76'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1f5238);}if(!_[_0x5960('0x93')](_0x1f5238,_0x24b761[_0x5960('0x63')][_0x5960('0x92')])){throw new db[(_0x5960('0x90'))]['ValidationError'](_0x5960('0x94')+_0x1f5238);}_0x2a530e[_0x24b761[_0x5960('0x63')][_0x5960('0x92')]]=_0x24b761[_0x5960('0x63')][_0x5960('0x7d')];return db['CmList'][_0x5960('0x59')]({'where':{'id':_0x24b761[_0x5960('0x75')][_0x5960('0x7a')]},'include':[{'model':db[_0x5960('0x95')],'as':_0x5960('0x96'),'where':_0x2a530e,'limit':0x1,'order':[[_0x5960('0x78'),'DESC']]}]});})[_0x5960('0x23')](handleEntityNotFound(_0xa9db20,null))[_0x5960('0x23')](function(_0x195efa){if(_0x195efa){_0x24b761[_0x5960('0x97')]=_[_0x5960('0x98')](_0x195efa,['Contacts']);if(_0x195efa[_0x5960('0x96')][_0x5960('0x48')]){return _0x195efa[_0x5960('0x96')][0x0];}var _0x11c3b4=_['defaults'](_0x24b761['body'],{'firstName':_0x24b761[_0x5960('0x63')][_0x5960('0x7d')],'ListId':_0x195efa['id']});_0x11c3b4[_0x24b761['body'][_0x5960('0x92')]]=_0x24b761[_0x5960('0x63')][_0x5960('0x7d')];return db['CmContact'][_0x5960('0x5b')](_0x11c3b4,{'fields':_0x45fd89,'raw':!![]});}})[_0x5960('0x23')](handleEntityNotFound(_0xa9db20,null))[_0x5960('0x23')](function(_0x2dfda6){if(_0x2dfda6){_0x24b761[_0x5960('0x99')]=_0x2dfda6;var _0x2da548={'ContactId':_0x2dfda6['id'],'phone':_0x24b761['body'][_0x5960('0x7d')],'SmsAccountId':_0x12be83[_0x5960('0x56')]['id']};var _0x34a6e8={'ContactId':_0x2dfda6['id'],'SmsAccountId':_0x12be83['params']['id'],'closed':![]};return db[_0x5960('0x9a')][_0x5960('0x59')]({'where':_0x34a6e8})[_0x5960('0x23')](function(_0x2bcf35){if(_0x2bcf35){return[_0x2bcf35,![]];}return db[_0x5960('0x9a')][_0x5960('0x5b')](_0x2da548)[_0x5960('0x23')](function(_0x597a57){return[_0x597a57,!![]];});});}})[_0x5960('0x9b')](function(_0x4abcf0,_0x3ca5c7){_0x24b761[_0x5960('0x9c')]=_0x4abcf0[_0x5960('0x5d')]({'plain':!![]});_0x24b761[_0x5960('0x9c')][_0x5960('0x9d')]=![];if(_0x3ca5c7){if(_0x24b761['account']['autoclose']){_0x24b761[_0x5960('0x71')]['push']({'id':0x0,'priority':_0x24b761[_0x5960('0x71')][_0x5960('0x48')]+0x1,'app':'close','appdata':_0x5960('0x9e'),'interval':_0x5960('0x9f')});}_0x24b761[_0x5960('0x9c')]['created']=!![];}return db['SmsMessage']['create']({'phone':_0x24b761[_0x5960('0x63')][_0x5960('0x7d')],'messageId':_0x24b761['body'][_0x5960('0x7f')],'body':_0x24b761['body'][_0x5960('0x63')],'SmsAccountId':_0x12be83[_0x5960('0x56')]['id'],'SmsInteractionId':_0x4abcf0['id'],'direction':'in','ContactId':_0x4abcf0[_0x5960('0xa0')],'AttachmentId':_0x24b761['body']['AttachmentId']});})[_0x5960('0x23')](function(_0x527551){_0x24b761[_0x5960('0x29')]=_0x527551;if(!_0x24b761[_0x5960('0x9c')][_0x5960('0xa1')])return;return db[_0x5960('0xa2')]['find']({'attributes':['id','name'],'where':{'id':_0x24b761['interaction'][_0x5960('0xa1')]}});})[_0x5960('0x23')](function(_0x26effa){if(_0x26effa){_0x24b761[_0x5960('0x71')]['unshift']({'id':0x0,'priority':0x0,'app':_0x5960('0xa3'),'appdata':_0x26effa[_0x5960('0x3b')]+','+(_0x24b761[_0x5960('0x75')][_0x5960('0xa4')]||0xa),'interval':_0x5960('0x9f')});}if(!_0x24b761[_0x5960('0x9c')][_0x5960('0xa5')])return;return db[_0x5960('0xa6')]['find']({'attributes':['id',_0x5960('0x3b')],'where':{'id':_0x24b761[_0x5960('0x9c')][_0x5960('0xa5')]}});})['then'](function(_0xa69e10){if(_0xa69e10){_0x24b761[_0x5960('0x71')][_0x5960('0xa7')]({'id':0x0,'priority':0x1,'app':_0x5960('0xa8'),'appdata':_0xa69e10['name']+','+(_0x24b761[_0x5960('0x75')]['waitForTheAssignedQueue']||0x12c),'interval':_0x5960('0x9f')});}return respondWithRpcPromise(_0x5960('0xa9'),'startRouting',_0x24b761);})[_0x5960('0x23')](function(_0x82b679){if(_0x82b679){var _0x539b5b=0xc8;var _0x25f1fb=_0x5960('0xaa');logger[_0x5960('0x24')](_0x5960('0xab'),_0x25f1fb,_0x539b5b,_0x5960('0xac'));logger[_0x5960('0x26')](_0x5960('0xad'),_0x25f1fb,_0x539b5b,'entity\x20found',JSON[_0x5960('0xae')](_0x82b679));if(_0x24b761['account'][_0x5960('0x40')]==='twilio'){return _0xa9db20['status'](_0x539b5b)['set'](_0x5960('0xaf'),_0x5960('0xb0'))[_0x5960('0xb1')](_0x5960('0xb2'));}else{return _0xa9db20['status'](_0x539b5b)['json'](_0x82b679);}}})[_0x5960('0x5a')](handleError(_0xa9db20,null));};exports[_0x5960('0xb3')]=function(_0x1ce8de,_0x54d470){var _0x3fa0bd=_0x1ce8de[_0x5960('0x56')]['id'];var _0x2d3a0c=_0x1ce8de[_0x5960('0x63')];var _0x4c4fed=0xc8;var _0x58d784=null;return db[_0x5960('0xb4')]['transaction']({'isolationLevel':db[_0x5960('0xb4')][_0x5960('0xb5')][_0x5960('0xb6')][_0x5960('0xb7')]},function(_0x215b19){return db[_0x5960('0x3e')][_0x5960('0x6c')]({'where':{'id':_0x3fa0bd},'transaction':_0x215b19})[_0x5960('0x23')](function(_0x294fcd){if(_0x294fcd){return db[_0x5960('0xb8')][_0x5960('0x36')]({'where':{'SmsAccountId':_0x3fa0bd},'transaction':_0x215b19})['then'](function(){var _0x2d9911=_['map'](_0x2d3a0c,function(_0x376cbc){_0x376cbc['SmsAccountId']=_0x3fa0bd;return _0x376cbc;});return db[_0x5960('0xb8')][_0x5960('0xb9')](_0x2d9911,{'transaction':_0x215b19});});}else{_0x4c4fed=0x194;_0x58d784=[];}});})[_0x5960('0x23')](function(){if(_0x4c4fed!==0x194){return db[_0x5960('0xb8')]['findAndCountAll']({'where':{'SmsAccountId':_0x3fa0bd},'order':_0x5960('0x73')})[_0x5960('0x23')](function(_0xd5c380){_0x58d784=_0xd5c380;});}})[_0x5960('0x5a')](function(_0xedb7b3){_0x4c4fed=0x1f4;logger[_0x5960('0x27')](_0xedb7b3['stack']);if(_0xedb7b3[_0x5960('0x3b')]){delete _0xedb7b3[_0x5960('0x3b')];}_0x58d784=_0xedb7b3;})[_0x5960('0xba')](function(){if(_0x58d784===null){_0x54d470['sendStatus'](_0x4c4fed);}else{if(_0x4c4fed===0x1f4){_0x54d470[_0x5960('0x2c')](_0x4c4fed)['send'](_0x58d784);}else{_0x54d470['status'](_0x4c4fed)[_0x5960('0x2d')](_0x58d784);}}});};exports[_0x5960('0xbb')]=function(_0x2c0e19,_0x5e4b5d,_0x20b39f){var _0x368699={};var _0x3bc38d={};var _0x25d8ea;var _0x5362d9;return db[_0x5960('0x3e')][_0x5960('0x6c')]({'where':{'id':_0x2c0e19[_0x5960('0x56')]['id']}})[_0x5960('0x23')](handleEntityNotFound(_0x5e4b5d,null))[_0x5960('0x23')](function(_0x568229){if(_0x568229){_0x25d8ea=_0x568229;_0x3bc38d['model']=_['keys'](db[_0x5960('0xb8')][_0x5960('0x3f')]);_0x3bc38d[_0x5960('0x43')]=_[_0x5960('0x57')](_0x2c0e19[_0x5960('0x43')]);_0x3bc38d[_0x5960('0x44')]=_[_0x5960('0x45')](_0x3bc38d['model'],_0x3bc38d[_0x5960('0x43')]);_0x368699[_0x5960('0x46')]=_[_0x5960('0x45')](_0x3bc38d['model'],qs[_0x5960('0x47')](_0x2c0e19['query'][_0x5960('0x47')]));_0x368699[_0x5960('0x46')]=_0x368699['attributes'][_0x5960('0x48')]?_0x368699['attributes']:_0x3bc38d[_0x5960('0x42')];_0x368699[_0x5960('0x68')]=qs[_0x5960('0x4c')](_0x2c0e19[_0x5960('0x43')][_0x5960('0x4c')]);_0x368699['where']=qs[_0x5960('0x44')](_[_0x5960('0x4e')](_0x2c0e19[_0x5960('0x43')],_0x3bc38d[_0x5960('0x44')]));if(_0x2c0e19[_0x5960('0x43')][_0x5960('0x4f')]){_0x368699['where']=_[_0x5960('0x50')](_0x368699[_0x5960('0x4d')],{'$or':_[_0x5960('0x3d')](_0x368699[_0x5960('0x46')],function(_0x1a3c94){var _0x48ff3b={};_0x48ff3b[_0x1a3c94]={'$like':'%'+_0x2c0e19['query']['filter']+'%'};return _0x48ff3b;})});}_0x368699=_[_0x5960('0x50')]({},_0x368699,_0x2c0e19['options']);return _0x25d8ea['getApplications'](_0x368699);}})[_0x5960('0x23')](function(_0x34318e){if(_0x34318e){_0x5362d9=_0x34318e['length'];if(!_0x2c0e19[_0x5960('0x43')][_0x5960('0x49')]('nolimit')){_0x368699[_0x5960('0x4b')]=qs[_0x5960('0x4b')](_0x2c0e19['query'][_0x5960('0x4b')]);_0x368699[_0x5960('0x2e')]=qs['offset'](_0x2c0e19['query'][_0x5960('0x2e')]);}return _0x25d8ea['getApplications'](_0x368699);}})[_0x5960('0x23')](function(_0x36add1){if(_0x36add1){return _0x36add1?{'count':_0x5362d9,'rows':_0x36add1}:null;}})[_0x5960('0x23')](respondWithResult(_0x5e4b5d,null))[_0x5960('0x5a')](handleError(_0x5e4b5d,null));};exports['getInteractions']=function(_0x912887,_0x39cbf9,_0x1ff4c5){var _0x1bc4fa={'raw':![],'where':{}};var _0x548b64={};var _0x428e8f={'count':0x0,'rows':[]};return db[_0x5960('0x3e')]['findOne']({'where':{'id':_0x912887[_0x5960('0x56')]['id']}})[_0x5960('0x23')](handleEntityNotFound(_0x39cbf9,null))[_0x5960('0x23')](function(_0x1cc50c){if(_0x1cc50c){_0x548b64[_0x5960('0x42')]=_['keys'](db[_0x5960('0x9a')]['rawAttributes']);_0x548b64[_0x5960('0x43')]=_[_0x5960('0x57')](_0x912887[_0x5960('0x43')]);_0x548b64[_0x5960('0x44')]=_[_0x5960('0x45')](_0x548b64[_0x5960('0x42')],_0x548b64[_0x5960('0x43')]);_0x1bc4fa[_0x5960('0x46')]=_[_0x5960('0x45')](_0x548b64[_0x5960('0x42')],qs[_0x5960('0x47')](_0x912887[_0x5960('0x43')]['fields']));_0x1bc4fa[_0x5960('0x46')]=_0x1bc4fa[_0x5960('0x46')][_0x5960('0x48')]?_0x1bc4fa['attributes']:_0x548b64[_0x5960('0x42')];if(!_0x912887[_0x5960('0x43')][_0x5960('0x49')]('nolimit')){_0x1bc4fa[_0x5960('0x4b')]=qs[_0x5960('0x4b')](_0x912887[_0x5960('0x43')][_0x5960('0x4b')]);_0x1bc4fa[_0x5960('0x2e')]=qs[_0x5960('0x2e')](_0x912887['query'][_0x5960('0x2e')]);}_0x1bc4fa[_0x5960('0x68')]=qs[_0x5960('0x4c')](_0x912887[_0x5960('0x43')]['sort']);_0x1bc4fa[_0x5960('0x4d')]=qs[_0x5960('0x44')](_['pick'](_0x912887['query'],_0x548b64['filters']));_0x1bc4fa['where']['SmsAccountId']=_0x1cc50c['id'];if(_0x912887[_0x5960('0x43')][_0x5960('0x4f')]){_0x1bc4fa[_0x5960('0x4d')]=_[_0x5960('0x50')](_0x1bc4fa[_0x5960('0x4d')],{'$or':_[_0x5960('0x3d')](_0x1bc4fa[_0x5960('0x46')],function(_0xb17a81){var _0x1406cf={};_0x1406cf[_0xb17a81]={'$like':'%'+_0x912887[_0x5960('0x43')][_0x5960('0x4f')]+'%'};return _0x1406cf;})});}_0x1bc4fa=_['merge']({},_0x1bc4fa,_0x912887[_0x5960('0x58')]);return db[_0x5960('0x9a')]['count']({'where':_0x1bc4fa[_0x5960('0x4d')]})[_0x5960('0x23')](function(_0x22f38a){_0x428e8f[_0x5960('0x30')]=_0x22f38a;if(_0x912887[_0x5960('0x43')]['includeAll']){_0x1bc4fa['include']=[{'model':db['CmContact'],'as':_0x5960('0xbc'),'required':![]},{'model':db[_0x5960('0xa2')],'as':'Owner','attributes':[_0x5960('0x3b'),_0x5960('0xbd'),_0x5960('0xbe')],'required':![]},{'model':db[_0x5960('0xbf')],'as':_0x5960('0xc0'),'attributes':['id',_0x5960('0x3b'),_0x5960('0xc1')],'where':_0x912887[_0x5960('0x43')]['tag']?{'id':_0x912887[_0x5960('0x43')][_0x5960('0xc2')]}:undefined,'required':_0x912887[_0x5960('0x43')][_0x5960('0xc2')]?!![]:![]}];}return db['SmsInteraction'][_0x5960('0x53')](_0x1bc4fa);})[_0x5960('0x23')](function(_0x5ec779){_0x428e8f[_0x5960('0x54')]=_0x5ec779;return _0x428e8f;});}})[_0x5960('0x23')](respondWithFilteredResult(_0x39cbf9,_0x1bc4fa))['catch'](handleError(_0x39cbf9,null));};exports[_0x5960('0xb1')]=function(_0x5867bd,_0x45db3f,_0x41f990){var _0x5b4c76,_0x538f72,_0x3946a1;if(_[_0x5960('0x8f')](_0x5867bd[_0x5960('0x63')][_0x5960('0x63')])||_0x5867bd[_0x5960('0x63')][_0x5960('0x63')]===''){throw new db[(_0x5960('0x90'))][(_0x5960('0x76'))](_0x5960('0xc3'));}if(_[_0x5960('0x8f')](_0x5867bd['body']['to'])){throw new db[(_0x5960('0x90'))][(_0x5960('0x76'))](_0x5960('0xc4'));}_0x5b4c76=_0x5867bd[_0x5960('0x63')]['to'];return db[_0x5960('0x3e')][_0x5960('0x59')]({'where':{'id':_0x5867bd[_0x5960('0x56')]['id']},'include':[{'model':db[_0x5960('0xc5')],'as':_0x5960('0xc6'),'include':[{'model':db[_0x5960('0x95')],'as':'Contacts','where':{'mobile':_0x5b4c76},'limit':0x1,'order':[[_0x5960('0x78'),_0x5960('0xc7')]]}]}]})[_0x5960('0x23')](handleEntityNotFound(_0x45db3f,null))[_0x5960('0x23')](function(_0x3b1c24){if(_0x3b1c24&&_0x3b1c24[_0x5960('0xc6')]){_0x538f72=_0x3b1c24['get']({'plain':!![]});if(_0x538f72[_0x5960('0xc6')]&&_0x538f72[_0x5960('0xc6')][_0x5960('0x96')]['length']){return _0x538f72[_0x5960('0xc6')]['Contacts'][0x0];}return db['CmContact'][_0x5960('0x5b')](_[_0x5960('0x1b')](_0x5867bd[_0x5960('0x63')],{'firstName':_0x5b4c76,'mobile':_0x5b4c76,'phone':_0x5b4c76,'ListId':_0x538f72[_0x5960('0x7a')]}));}})[_0x5960('0x23')](handleEntityNotFound(_0x45db3f,null))[_0x5960('0x23')](function(_0x30a63d){if(_0x30a63d){_0x3946a1=_0x30a63d;return db[_0x5960('0x9a')][_0x5960('0x59')]({'where':{'ContactId':_0x3946a1['id'],'closed':![],'SmsAccountId':_0x538f72['id']}})[_0x5960('0x23')](function(_0x19d459){if(_0x19d459){return[_0x19d459,![]];}return db['SmsInteraction'][_0x5960('0x5b')]({'UserId':_0x5867bd[_0x5960('0x5c')]['id'],'ContactId':_0x3946a1['id'],'SmsAccountId':_0x538f72['id'],'phone':_0x5b4c76,'firstMsgDirection':_0x5960('0xc8'),'Messages':[_[_0x5960('0x50')](_0x5867bd[_0x5960('0x63')],{'read':![],'body':_0x5867bd[_0x5960('0x63')]['body'],'phone':_0x5b4c76,'SmsAccountId':_0x538f72['id'],'UserId':_0x5867bd[_0x5960('0x5c')]['id'],'ContactId':_0x3946a1['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x5960('0xc9')}]})[_0x5960('0x23')](function(_0x31aba3){return[_0x31aba3,!![]];});});}})[_0x5960('0x9b')](function(_0x467a10,_0x105a86){if(_0x105a86){return _0x467a10;}return db[_0x5960('0xca')][_0x5960('0x5b')](_['merge'](_0x5867bd[_0x5960('0x63')],{'read':![],'body':_0x5867bd['body']['body'],'phone':_0x5b4c76,'SmsAccountId':_0x538f72['id'],'SmsInteractionId':_0x467a10['id'],'UserId':_0x5867bd[_0x5960('0x5c')]['id'],'ContactId':_0x3946a1['id']}))[_0x5960('0x23')](function(_0x1bc04a){_0x467a10[_0x5960('0xcb')][_0x5960('0xc9')]=[];_0x467a10[_0x5960('0xcb')][_0x5960('0xc9')][_0x5960('0xcc')](_0x1bc04a[_0x5960('0xcb')]);return _0x467a10;});})[_0x5960('0x23')](respondWithResult(_0x45db3f,null))[_0x5960('0x5a')](handleError(_0x45db3f,null));};exports[_0x5960('0x2c')]=function(_0x1eb255,_0x158c6c,_0x51998b){if(_0x1eb255[_0x5960('0x63')]['id']){delete _0x1eb255[_0x5960('0x63')]['id'];}var _0x29b15c,_0x2f3525,_0x40223b;return db[_0x5960('0x3e')][_0x5960('0x59')]({'where':{'id':_0x1eb255['params']['id']}})['then'](handleEntityNotFound(_0x158c6c,null))[_0x5960('0x23')](function(_0x4a8556){if(_0x4a8556){_0x40223b=_0x4a8556;logger[_0x5960('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5960('0x2c'),_0x5960('0xcd'),_0x4a8556[_0x5960('0x40')],util[_0x5960('0xce')](_0x1eb255[_0x5960('0x63')],{'showHidden':![],'depth':null}));switch(_0x4a8556[_0x5960('0x40')]){case _0x5960('0x81'):if(_0x1eb255[_0x5960('0x63')][_0x5960('0xcf')]&&_0x1eb255['body'][_0x5960('0x2c')]){_0x2f3525=_0x1eb255[_0x5960('0x63')]['status'];return db[_0x5960('0xca')][_0x5960('0x59')]({'where':{'messageId':_0x1eb255[_0x5960('0x63')][_0x5960('0xcf')]}});}break;case _0x5960('0x83'):if(_0x1eb255[_0x5960('0x63')][_0x5960('0xd0')]&&_0x1eb255[_0x5960('0x63')][_0x5960('0xd1')]){_0x2f3525=_0x1eb255[_0x5960('0x63')][_0x5960('0xd1')];return db[_0x5960('0xca')][_0x5960('0x59')]({'where':{'messageId':_0x1eb255[_0x5960('0x63')]['requestid']}});}break;case _0x5960('0x84'):if(_0x1eb255[_0x5960('0x63')][_0x5960('0xd2')]&&_0x1eb255[_0x5960('0x63')][_0x5960('0xd3')]){_0x2f3525=_0x1eb255['body'][_0x5960('0xd3')];return db['SmsMessage'][_0x5960('0x59')]({'where':{'messageId':_0x1eb255[_0x5960('0x63')][_0x5960('0xd2')]}});}break;case _0x5960('0x87'):var _0x5be6c8=_0x1eb255[_0x5960('0x63')][_0x5960('0x88')][0x0];if(_0x5be6c8['messageId']&&_0x5be6c8[_0x5960('0x2c')][_0x5960('0xd4')]==='DELIVERED'){_0x2f3525=_0x5be6c8[_0x5960('0x2c')]['groupName'];return db[_0x5960('0xca')][_0x5960('0x59')]({'where':{'messageId':_0x5be6c8[_0x5960('0x7f')]}});}break;case'clickatell':if(_0x1eb255[_0x5960('0x63')]['messageId']&&_0x1eb255[_0x5960('0x63')][_0x5960('0x2c')]){_0x2f3525=_0x1eb255['body'][_0x5960('0x2c')];return db[_0x5960('0xca')][_0x5960('0x59')]({'where':{'messageId':_0x1eb255[_0x5960('0x63')][_0x5960('0x7f')]}});}break;case _0x5960('0x8d'):if(_0x1eb255['body'][0x0][_0x5960('0x29')]['id']){_0x2f3525=_0x1eb255['body'][0x0][_0x5960('0x40')];return db['SmsMessage'][_0x5960('0x59')]({'where':{'messageId':_0x1eb255[_0x5960('0x63')][0x0][_0x5960('0x29')]['id']}});}break;case _0x5960('0x8e'):if(_0x1eb255['body'][_0x5960('0xd5')]&&_0x1eb255[_0x5960('0x63')][_0x5960('0x2c')]){_0x2f3525=_0x1eb255[_0x5960('0x63')][_0x5960('0x2c')];return db[_0x5960('0xca')][_0x5960('0x59')]({'where':{'messageId':_0x1eb255['body']['redif']}});}break;}}})[_0x5960('0x23')](handleEntityNotFound(_0x158c6c,null))[_0x5960('0x23')](function(_0x1c16d4){if(_0x1c16d4){_0x29b15c=_0x1c16d4;switch(_0x40223b[_0x5960('0x40')]){case _0x5960('0x81'):if(_0x2f3525==='DELIVERED'){return _0x29b15c[_0x5960('0x35')]({'read':!![]});}else{logger[_0x5960('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5960('0x2c'),'skebby',util['inspect'](_0x1eb255[_0x5960('0x63')],{'showHidden':![],'depth':null}));}break;case _0x5960('0x83'):if(_0x2f3525==='1'){return _0x29b15c[_0x5960('0x35')]({'read':!![]});}else{logger[_0x5960('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5960('0x2c'),_0x5960('0x81'),util[_0x5960('0xce')](_0x1eb255['body'],{'showHidden':![],'depth':null}));}break;case _0x5960('0x84'):if(!_0x1eb255[_0x5960('0x63')][_0x5960('0xd6')]&&_0x2f3525>=0xc8&&_0x2f3525<=0xce){return _0x29b15c['update']({'read':!![]});}else{logger[_0x5960('0x27')](_0x5960('0xab'),'status',_0x5960('0x84'),util[_0x5960('0xce')](_0x1eb255['body'],{'showHidden':![],'depth':null}));}break;case _0x5960('0x87'):var _0x9bd8ff=_0x1eb255[_0x5960('0x63')][_0x5960('0x88')][0x0];if(_0x9bd8ff['status']['groupName']===_0x5960('0xd7')){return _0x29b15c['update']({'read':!![]});}else{logger[_0x5960('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5960('0x2c'),_0x5960('0x87'),util['inspect'](_0x1eb255['body'],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x2f3525=='DELIVERED_TO_GATEWAY'||_0x2f3525==_0x5960('0xd8')){return _0x29b15c['update']({'read':!![]});}else{logger[_0x5960('0x27')](_0x5960('0xab'),_0x5960('0x2c'),_0x5960('0xd9'),util['inspect'](_0x1eb255[_0x5960('0x63')],{'showHidden':![],'depth':null}));}break;case _0x5960('0x8d'):if(_0x2f3525==_0x5960('0xda')){return _0x29b15c['update']({'read':!![]});}else{logger[_0x5960('0x27')](_0x5960('0xab'),_0x5960('0x2c'),'bandwidth',util['inspect'](_0x1eb255['body'],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x2f3525===_0x5960('0xdb')||_0x2f3525===_0x5960('0xdc')){return _0x29b15c[_0x5960('0x35')]({'read':!![]});}else{logger[_0x5960('0x27')](_0x5960('0xab'),_0x5960('0x2c'),'intelepeer',util[_0x5960('0xce')](_0x1eb255[_0x5960('0x63')],{'showHidden':![],'depth':null}));}break;}return _0x29b15c;}})[_0x5960('0x23')](respondWithResult(_0x158c6c,null))[_0x5960('0x5a')](handleError(_0x158c6c,null));};exports[_0x5960('0xdd')]=function(_0x51bdc3,_0x17a608,_0x4de4c4){var _0x2cadd5,_0x19a33d,_0x37da;return db[_0x5960('0x3e')][_0x5960('0x59')]({'where':{'id':_0x51bdc3['params']['id']}})[_0x5960('0x23')](handleEntityNotFound(_0x17a608,null))['then'](function(_0x1e2f5a){if(_0x1e2f5a){_0x37da=_0x1e2f5a;logger[_0x5960('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5960('0x2c'),_0x5960('0xcd'),_0x1e2f5a['type'],util[_0x5960('0xce')](_0x51bdc3[_0x5960('0x43')],{'showHidden':![],'depth':null}));switch(_0x1e2f5a[_0x5960('0x40')]){case _0x5960('0x8a'):if(_0x51bdc3[_0x5960('0x43')][_0x5960('0xde')]&&_0x51bdc3[_0x5960('0x43')][_0x5960('0xdf')]){_0x19a33d=_0x51bdc3[_0x5960('0x43')][_0x5960('0xdf')];return db[_0x5960('0xca')][_0x5960('0x59')]({'where':{'messageId':_0x51bdc3['query'][_0x5960('0xde')]}});}break;}}})['then'](handleEntityNotFound(_0x17a608,null))['then'](function(_0x1dcdfc){if(_0x1dcdfc){_0x2cadd5=_0x1dcdfc;switch(_0x37da['type']){case'csc':if(_0x19a33d==='2'||_0x19a33d==='6'){return _0x2cadd5[_0x5960('0x35')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5960('0x2c'),_0x5960('0x8a'),util[_0x5960('0xce')](_0x51bdc3[_0x5960('0x43')],{'showHidden':![],'depth':null}));};break;}return _0x2cadd5;}})[_0x5960('0x23')](respondWithResult(_0x17a608,null))[_0x5960('0x5a')](handleError(_0x17a608,null));};exports[_0x5960('0xe0')]=function(_0x28ea57,_0x30899c,_0x42493f){return db[_0x5960('0x3e')][_0x5960('0x59')]({'where':{'id':_0x28ea57['params']['id']}})['then'](handleEntityNotFound(_0x30899c,null))[_0x5960('0x23')](function(_0x4fd712){if(_0x4fd712){return _0x4fd712[_0x5960('0xe0')](_0x28ea57[_0x5960('0x63')][_0x5960('0x6b')],_[_0x5960('0x98')](_0x28ea57['body'],['ids','id'])||{})['spread'](function(_0x34ae72){for(var _0x3296f2=0x0;_0x3296f2<_0x28ea57[_0x5960('0x63')][_0x5960('0x6b')][_0x5960('0x48')];_0x3296f2+=0x1){socket[_0x5960('0xe1')](_0x5960('0xe2'),{'UserId':Number(_0x28ea57[_0x5960('0x63')][_0x5960('0x6b')][_0x3296f2]),'SmsAccountId':Number(_0x28ea57[_0x5960('0x56')]['id'])});}return _0x34ae72;});}})[_0x5960('0x23')](respondWithResult(_0x30899c,null))[_0x5960('0x5a')](handleError(_0x30899c,null));};exports[_0x5960('0xe3')]=function(_0x294e9a,_0x1e564e,_0x14e7c1){return db['SmsAccount'][_0x5960('0x59')]({'where':{'id':_0x294e9a[_0x5960('0x56')]['id']}})[_0x5960('0x23')](handleEntityNotFound(_0x1e564e,null))[_0x5960('0x23')](function(_0x55b3c6){if(_0x55b3c6){return _0x55b3c6[_0x5960('0xe3')](_0x294e9a['query'][_0x5960('0x6b')])[_0x5960('0x23')](function(){if(_['isArray'](_0x294e9a['query'][_0x5960('0x6b')])){for(var _0x48d085=0x0;_0x48d085<_0x294e9a[_0x5960('0x43')][_0x5960('0x6b')][_0x5960('0x48')];_0x48d085+=0x1){socket['emit'](_0x5960('0xe4'),{'UserId':Number(_0x294e9a['query'][_0x5960('0x6b')][_0x48d085]),'SmsAccountId':Number(_0x294e9a[_0x5960('0x56')]['id'])});}}else{socket[_0x5960('0xe1')]('userSmsAccount:remove',{'UserId':Number(_0x294e9a['query'][_0x5960('0x6b')]),'SmsAccountId':Number(_0x294e9a[_0x5960('0x56')]['id'])});}});}})[_0x5960('0x23')](respondWithStatusCode(_0x1e564e,null))[_0x5960('0x5a')](handleError(_0x1e564e,null));};exports[_0x5960('0xe5')]=function(_0x2559e2,_0x2ce894,_0x331f25){var _0x5bc8ac={};var _0x283269={};var _0x289df6;var _0x5a9aa3;return db[_0x5960('0x3e')]['findOne']({'where':{'id':_0x2559e2[_0x5960('0x56')]['id']}})[_0x5960('0x23')](handleEntityNotFound(_0x2ce894,null))[_0x5960('0x23')](function(_0x3e8e6b){if(_0x3e8e6b){_0x289df6=_0x3e8e6b;_0x283269[_0x5960('0x42')]=_[_0x5960('0x57')](db[_0x5960('0xa2')][_0x5960('0x3f')]);_0x283269[_0x5960('0x43')]=_['keys'](_0x2559e2[_0x5960('0x43')]);_0x283269[_0x5960('0x44')]=_[_0x5960('0x45')](_0x283269[_0x5960('0x42')],_0x283269[_0x5960('0x43')]);_0x5bc8ac[_0x5960('0x46')]=_['intersection'](_0x283269[_0x5960('0x42')],qs[_0x5960('0x47')](_0x2559e2['query'][_0x5960('0x47')]));_0x5bc8ac['attributes']=_0x5bc8ac[_0x5960('0x46')][_0x5960('0x48')]?_0x5bc8ac[_0x5960('0x46')]:_0x283269['model'];_0x5bc8ac[_0x5960('0x68')]=qs[_0x5960('0x4c')](_0x2559e2[_0x5960('0x43')][_0x5960('0x4c')]);_0x5bc8ac[_0x5960('0x4d')]=qs[_0x5960('0x44')](_[_0x5960('0x4e')](_0x2559e2[_0x5960('0x43')],_0x283269['filters']));if(_0x2559e2[_0x5960('0x43')][_0x5960('0x4f')]){_0x5bc8ac['where']=_[_0x5960('0x50')](_0x5bc8ac[_0x5960('0x4d')],{'$or':_[_0x5960('0x3d')](_0x5bc8ac[_0x5960('0x46')],function(_0x4e17e5){var _0x18efc3={};_0x18efc3[_0x4e17e5]={'$like':'%'+_0x2559e2['query'][_0x5960('0x4f')]+'%'};return _0x18efc3;})});}_0x5bc8ac=_[_0x5960('0x50')]({},_0x5bc8ac,_0x2559e2['options']);return _0x289df6['getAgents'](_0x5bc8ac);}})[_0x5960('0x23')](function(_0x130694){if(_0x130694){_0x5a9aa3=_0x130694['length'];if(!_0x2559e2[_0x5960('0x43')]['hasOwnProperty'](_0x5960('0x4a'))){_0x5bc8ac[_0x5960('0x4b')]=qs[_0x5960('0x4b')](_0x2559e2['query'][_0x5960('0x4b')]);_0x5bc8ac['offset']=qs['offset'](_0x2559e2[_0x5960('0x43')][_0x5960('0x2e')]);}return _0x289df6[_0x5960('0xe5')](_0x5bc8ac);}})[_0x5960('0x23')](function(_0x1f03f7){if(_0x1f03f7){return _0x1f03f7?{'count':_0x5a9aa3,'rows':_0x1f03f7}:null;}})[_0x5960('0x23')](respondWithResult(_0x2ce894,null))[_0x5960('0x5a')](handleError(_0x2ce894,null));}; \ No newline at end of file +var _0x2f00=['set','Content-Range','apply','save','update','destroy','SmsAccounts','UserProfileResource','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','where','filter','merge','VIRTUAL','includeAll','findAll','show','params','include','options','find','create','body','user','get','role','userProfileId','autoAssociation','describe','addDisposition','SmsAccountId','Disposition','findOne','order','sort','pick','rows','removeDispositions','ids','CannedAnswer','getAnswers','hasOwnProperty','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','Sequelize','ValidationError','difference','updatedAt','ListId','mobile','from','From','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','plivo','MessageUUID','infobip','results','segmentedMessage','clickatell','bandwidth','intelepeer','refid','isNil','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','CmContact','Contacts','DESC','omit','contact','SmsInteraction','spread','interaction','created','autoclose','push','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','SmsQueue','queue','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','Owner','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','status_code','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','csc','message-id','state','addAgents','emit','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','register','jayson/promise','client','request','then','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsAccount,\x20%s,\x20%s','info','result','catch','status','end','json','offset','undefined','limit','count'];(function(_0x19264b,_0x3351a3){var _0x38f854=function(_0xeb3a7b){while(--_0xeb3a7b){_0x19264b['push'](_0x19264b['shift']());}};_0x38f854(++_0x3351a3);}(_0x2f00,0x19a));var _0x02f0=function(_0x357588,_0x4cb7a5){_0x357588=_0x357588-0x0;var _0x118264=_0x2f00[_0x357588];return _0x118264;};'use strict';var emlformat=require(_0x02f0('0x0'));var rimraf=require(_0x02f0('0x1'));var zipdir=require(_0x02f0('0x2'));var jsonpatch=require(_0x02f0('0x3'));var rp=require(_0x02f0('0x4'));var moment=require(_0x02f0('0x5'));var BPromise=require(_0x02f0('0x6'));var Mustache=require(_0x02f0('0x7'));var util=require(_0x02f0('0x8'));var path=require(_0x02f0('0x9'));var sox=require(_0x02f0('0xa'));var csv=require('to-csv');var ejs=require(_0x02f0('0xb'));var fs=require('fs');var fs_extra=require(_0x02f0('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x02f0('0xd'));var jsforce=require(_0x02f0('0xe'));var deskjs=require(_0x02f0('0xf'));var toCsv=require('to-csv');var querystring=require(_0x02f0('0x10'));var Papa=require(_0x02f0('0x11'));var Redis=require(_0x02f0('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x02f0('0x13'));var hardwareService=require(_0x02f0('0x14'));var logger=require(_0x02f0('0x15'))(_0x02f0('0x16'));var utils=require(_0x02f0('0x17'));var config=require(_0x02f0('0x18'));var licenseUtil=require(_0x02f0('0x19'));var db=require(_0x02f0('0x1a'))['db'];config[_0x02f0('0x1b')]=_[_0x02f0('0x1c')](config[_0x02f0('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x02f0('0x1b')]));require('./smsAccount.socket')[_0x02f0('0x1d')](socket);var jayson=require(_0x02f0('0x1e'));var client=jayson[_0x02f0('0x1f')]['http']({'port':0x232c});function respondWithRpcPromise(_0x3b798b,_0x254e34,_0x1c85a4,_0x4cf734){return new BPromise(function(_0x20d8ea,_0x9a17ad){var _0x506633=_0x4cf734||client;return _0x506633[_0x02f0('0x20')](_0x3b798b,_0x1c85a4)[_0x02f0('0x21')](function(_0x3ef2f2){logger['info']('SmsAccount,\x20%s,\x20%s',_0x254e34,_0x02f0('0x22'));logger[_0x02f0('0x23')](_0x02f0('0x24'),_0x254e34,_0x02f0('0x22'),JSON[_0x02f0('0x25')](_0x3ef2f2));if(_0x3ef2f2[_0x02f0('0x26')]){if(_0x3ef2f2[_0x02f0('0x26')][_0x02f0('0x27')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x254e34,_0x3ef2f2[_0x02f0('0x26')][_0x02f0('0x28')]);return _0x9a17ad(_0x3ef2f2[_0x02f0('0x26')][_0x02f0('0x28')]);}logger['error'](_0x02f0('0x29'),_0x254e34,_0x3ef2f2[_0x02f0('0x26')]['message']);return _0x20d8ea(_0x3ef2f2['error']['message']);}else{logger[_0x02f0('0x2a')](_0x02f0('0x29'),_0x254e34,'request\x20sent');_0x20d8ea(_0x3ef2f2[_0x02f0('0x2b')][_0x02f0('0x28')]);}})[_0x02f0('0x2c')](function(_0x356412){logger[_0x02f0('0x26')]('SmsAccount,\x20%s,\x20%s',_0x254e34,_0x356412);_0x9a17ad(_0x356412);});});}function respondWithStatusCode(_0x307f18,_0x43e2a3){_0x43e2a3=_0x43e2a3||0xcc;return function(_0x4e4660){if(_0x4e4660){return _0x307f18['sendStatus'](_0x43e2a3);}return _0x307f18[_0x02f0('0x2d')](_0x43e2a3)[_0x02f0('0x2e')]();};}function respondWithResult(_0x12d86b,_0xfa3357){_0xfa3357=_0xfa3357||0xc8;return function(_0x43c7cd){if(_0x43c7cd){return _0x12d86b[_0x02f0('0x2d')](_0xfa3357)[_0x02f0('0x2f')](_0x43c7cd);}};}function respondWithFilteredResult(_0x1a8c5d,_0x4c1073){return function(_0x1aea24){if(_0x1aea24){var _0x777c02=typeof _0x4c1073[_0x02f0('0x30')]===_0x02f0('0x31')&&typeof _0x4c1073[_0x02f0('0x32')]==='undefined';var _0x5c2a79=_0x1aea24[_0x02f0('0x33')];var _0x574c1c=_0x777c02?0x0:_0x4c1073[_0x02f0('0x30')];var _0x23a8a0=_0x777c02?_0x1aea24[_0x02f0('0x33')]:_0x4c1073['offset']+_0x4c1073[_0x02f0('0x32')];var _0x41994f;if(_0x23a8a0>=_0x5c2a79){_0x23a8a0=_0x5c2a79;_0x41994f=0xc8;}else{_0x41994f=0xce;}_0x1a8c5d[_0x02f0('0x2d')](_0x41994f);return _0x1a8c5d[_0x02f0('0x34')](_0x02f0('0x35'),_0x574c1c+'-'+_0x23a8a0+'/'+_0x5c2a79)['json'](_0x1aea24);}return null;};}function patchUpdates(_0x3f752a){return function(_0x1b0f17){try{jsonpatch[_0x02f0('0x36')](_0x1b0f17,_0x3f752a,!![]);}catch(_0x15e2ce){return BPromise['reject'](_0x15e2ce);}return _0x1b0f17[_0x02f0('0x37')]();};}function saveUpdates(_0x32ce4b,_0x95c18f){return function(_0x1586c8){if(_0x1586c8){return _0x1586c8[_0x02f0('0x38')](_0x32ce4b)['then'](function(_0x37d61d){return _0x37d61d;});}return null;};}function removeEntity(_0x3156b0,_0x328dcc){return function(_0x330d08){if(_0x330d08){return _0x330d08[_0x02f0('0x39')]()['then'](function(){var _0x2ba9df=_0x330d08['get']({'plain':!![]});var _0x44517a=_0x02f0('0x3a');return db[_0x02f0('0x3b')][_0x02f0('0x39')]({'where':{'type':_0x44517a,'resourceId':_0x2ba9df['id']}})[_0x02f0('0x21')](function(){return _0x330d08;});})[_0x02f0('0x21')](function(){_0x3156b0[_0x02f0('0x2d')](0xcc)[_0x02f0('0x2e')]();});}};}function handleEntityNotFound(_0x1834d1,_0x5865a4){return function(_0x269599){if(!_0x269599){_0x1834d1[_0x02f0('0x3c')](0x194);}return _0x269599;};}function handleError(_0x26aed0,_0x12eacc){_0x12eacc=_0x12eacc||0x1f4;return function(_0xdc10cf){logger['error'](_0xdc10cf[_0x02f0('0x3d')]);if(_0xdc10cf['name']){delete _0xdc10cf[_0x02f0('0x3e')];}_0x26aed0[_0x02f0('0x2d')](_0x12eacc)[_0x02f0('0x3f')](_0xdc10cf);};}exports[_0x02f0('0x40')]=function(_0x17a716,_0x258787){var _0x17384b={'include':[{'model':db[_0x02f0('0x41')],'as':_0x02f0('0x42')}]},_0x26aa24={},_0x143b9d={'count':0x0,'rows':[]};var _0x10ce10=_[_0x02f0('0x43')](db[_0x02f0('0x44')][_0x02f0('0x45')],function(_0x2d2752){return{'name':_0x2d2752[_0x02f0('0x46')],'type':_0x2d2752[_0x02f0('0x47')]['key']};});_0x26aa24[_0x02f0('0x48')]=_[_0x02f0('0x43')](_0x10ce10,'name');_0x26aa24[_0x02f0('0x49')]=_[_0x02f0('0x4a')](_0x17a716['query']);_0x26aa24[_0x02f0('0x4b')]=_[_0x02f0('0x4c')](_0x26aa24['model'],_0x26aa24['query']);_0x17384b[_0x02f0('0x4d')]=_[_0x02f0('0x4c')](_0x26aa24[_0x02f0('0x48')],qs[_0x02f0('0x4e')](_0x17a716[_0x02f0('0x49')][_0x02f0('0x4e')]));_0x17384b['attributes']=_0x17384b[_0x02f0('0x4d')][_0x02f0('0x4f')]?_0x17384b[_0x02f0('0x4d')]:_0x26aa24[_0x02f0('0x48')];if(!_0x17a716[_0x02f0('0x49')]['hasOwnProperty'](_0x02f0('0x50'))){_0x17384b['limit']=qs[_0x02f0('0x32')](_0x17a716[_0x02f0('0x49')]['limit']);_0x17384b[_0x02f0('0x30')]=qs[_0x02f0('0x30')](_0x17a716[_0x02f0('0x49')]['offset']);}_0x17384b['order']=qs['sort'](_0x17a716['query']['sort']);_0x17384b[_0x02f0('0x51')]=qs['filters'](_['pick'](_0x17a716[_0x02f0('0x49')],_0x26aa24[_0x02f0('0x4b')]),_0x10ce10);if(_0x17a716[_0x02f0('0x49')][_0x02f0('0x52')]){_0x17384b['where']=_[_0x02f0('0x53')](_0x17384b[_0x02f0('0x51')],{'$or':_[_0x02f0('0x43')](_0x10ce10,function(_0x231cf6){if(_0x231cf6[_0x02f0('0x47')]!==_0x02f0('0x54')){var _0x14e4d1={};_0x14e4d1[_0x231cf6[_0x02f0('0x3e')]]={'$like':'%'+_0x17a716[_0x02f0('0x49')]['filter']+'%'};return _0x14e4d1;}})});}_0x17384b=_['merge']({},_0x17384b,_0x17a716['options']);var _0x555347={'where':_0x17384b[_0x02f0('0x51')]};return db[_0x02f0('0x44')]['count'](_0x555347)[_0x02f0('0x21')](function(_0xf14346){_0x143b9d['count']=_0xf14346;if(_0x17a716[_0x02f0('0x49')][_0x02f0('0x55')]){_0x17384b['include']=[{'all':!![]}];}return db[_0x02f0('0x44')][_0x02f0('0x56')](_0x17384b);})[_0x02f0('0x21')](function(_0x477b73){_0x143b9d['rows']=_0x477b73;return _0x143b9d;})[_0x02f0('0x21')](respondWithFilteredResult(_0x258787,_0x17384b))['catch'](handleError(_0x258787,null));};exports[_0x02f0('0x57')]=function(_0x15d8d7,_0x58eeac){var _0x171670={'raw':![],'where':{'id':_0x15d8d7[_0x02f0('0x58')]['id']},'include':[{'model':db[_0x02f0('0x41')],'as':_0x02f0('0x42')}]},_0x5d77b0={};_0x5d77b0['model']=_['keys'](db[_0x02f0('0x44')][_0x02f0('0x45')]);_0x5d77b0[_0x02f0('0x49')]=_['keys'](_0x15d8d7[_0x02f0('0x49')]);_0x5d77b0['filters']=_[_0x02f0('0x4c')](_0x5d77b0[_0x02f0('0x48')],_0x5d77b0[_0x02f0('0x49')]);_0x171670[_0x02f0('0x4d')]=_[_0x02f0('0x4c')](_0x5d77b0[_0x02f0('0x48')],qs['fields'](_0x15d8d7[_0x02f0('0x49')][_0x02f0('0x4e')]));_0x171670[_0x02f0('0x4d')]=_0x171670[_0x02f0('0x4d')][_0x02f0('0x4f')]?_0x171670['attributes']:_0x5d77b0[_0x02f0('0x48')];if(_0x15d8d7[_0x02f0('0x49')]['includeAll']){_0x171670[_0x02f0('0x59')]=[{'all':!![]}];}_0x171670=_[_0x02f0('0x53')]({},_0x171670,_0x15d8d7[_0x02f0('0x5a')]);return db[_0x02f0('0x44')][_0x02f0('0x5b')](_0x171670)['then'](handleEntityNotFound(_0x58eeac,null))['then'](respondWithResult(_0x58eeac,null))[_0x02f0('0x2c')](handleError(_0x58eeac,null));};exports[_0x02f0('0x5c')]=function(_0x4689d3,_0x25d263){return db[_0x02f0('0x44')][_0x02f0('0x5c')](_0x4689d3[_0x02f0('0x5d')],{})['then'](function(_0x2ecd29){var _0xac7727=_0x4689d3[_0x02f0('0x5e')][_0x02f0('0x5f')]({'plain':!![]});if(!_0xac7727)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xac7727[_0x02f0('0x60')]==='user'){var _0x4a390e=_0x2ecd29[_0x02f0('0x5f')]({'plain':!![]});var _0x37320c=_0x02f0('0x3a');return db['UserProfileSection'][_0x02f0('0x5b')]({'where':{'name':_0x37320c,'userProfileId':_0xac7727[_0x02f0('0x61')]},'raw':!![]})[_0x02f0('0x21')](function(_0x13436c){if(_0x13436c&&_0x13436c[_0x02f0('0x62')]===0x0){return db[_0x02f0('0x3b')]['create']({'name':_0x4a390e[_0x02f0('0x3e')],'resourceId':_0x4a390e['id'],'type':_0x13436c[_0x02f0('0x3e')],'sectionId':_0x13436c['id']},{})['then'](function(){return _0x2ecd29;});}else{return _0x2ecd29;}})[_0x02f0('0x2c')](function(_0x509b57){logger[_0x02f0('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x509b57);throw _0x509b57;});}return _0x2ecd29;})['then'](respondWithResult(_0x25d263,0xc9))[_0x02f0('0x2c')](handleError(_0x25d263,null));};exports['update']=function(_0x2a4b3f,_0x59df12){if(_0x2a4b3f['body']['id']){delete _0x2a4b3f['body']['id'];}return db[_0x02f0('0x44')]['find']({'where':{'id':_0x2a4b3f[_0x02f0('0x58')]['id']},'include':[{'model':db[_0x02f0('0x41')],'as':_0x02f0('0x42')}]})[_0x02f0('0x21')](handleEntityNotFound(_0x59df12,null))[_0x02f0('0x21')](saveUpdates(_0x2a4b3f[_0x02f0('0x5d')],null))[_0x02f0('0x21')](respondWithResult(_0x59df12,null))[_0x02f0('0x2c')](handleError(_0x59df12,null));};exports['destroy']=function(_0x1971ff,_0x7d115c){return db['SmsAccount'][_0x02f0('0x5b')]({'where':{'id':_0x1971ff[_0x02f0('0x58')]['id']}})[_0x02f0('0x21')](handleEntityNotFound(_0x7d115c,null))[_0x02f0('0x21')](removeEntity(_0x7d115c,null))['catch'](handleError(_0x7d115c,null));};exports['describe']=function(_0x1d1459,_0x176a78){return db[_0x02f0('0x44')][_0x02f0('0x63')]()[_0x02f0('0x21')](respondWithResult(_0x176a78,null))[_0x02f0('0x2c')](handleError(_0x176a78,null));};exports[_0x02f0('0x64')]=function(_0x19df38,_0x4e51a3,_0x265c24){if(_0x19df38[_0x02f0('0x5d')]['id']){delete _0x19df38[_0x02f0('0x5d')]['id'];}return db[_0x02f0('0x44')][_0x02f0('0x5b')]({'where':{'id':_0x19df38['params']['id']}})[_0x02f0('0x21')](handleEntityNotFound(_0x4e51a3,null))['then'](function(_0x497d1c){if(_0x497d1c){_0x19df38[_0x02f0('0x5d')][_0x02f0('0x65')]=_0x497d1c['id'];return db[_0x02f0('0x66')][_0x02f0('0x5c')](_0x19df38['body']);}})[_0x02f0('0x21')](respondWithResult(_0x4e51a3,null))[_0x02f0('0x2c')](handleError(_0x4e51a3,null));};exports['getDispositions']=function(_0x4ec86e,_0x22481c,_0x4b7324){var _0x12eac9={'raw':![],'where':{}};var _0x33657b={};var _0x1a09e5={'count':0x0,'rows':[]};return db[_0x02f0('0x44')][_0x02f0('0x67')]({'where':{'id':_0x4ec86e['params']['id']}})[_0x02f0('0x21')](handleEntityNotFound(_0x22481c,null))[_0x02f0('0x21')](function(_0x5b9a24){if(_0x5b9a24){_0x33657b[_0x02f0('0x48')]=_[_0x02f0('0x4a')](db[_0x02f0('0x66')][_0x02f0('0x45')]);_0x33657b[_0x02f0('0x49')]=_['keys'](_0x4ec86e[_0x02f0('0x49')]);_0x33657b['filters']=_[_0x02f0('0x4c')](_0x33657b[_0x02f0('0x48')],_0x33657b[_0x02f0('0x49')]);_0x12eac9['attributes']=_[_0x02f0('0x4c')](_0x33657b['model'],qs[_0x02f0('0x4e')](_0x4ec86e[_0x02f0('0x49')][_0x02f0('0x4e')]));_0x12eac9[_0x02f0('0x4d')]=_0x12eac9[_0x02f0('0x4d')][_0x02f0('0x4f')]?_0x12eac9[_0x02f0('0x4d')]:_0x33657b[_0x02f0('0x48')];if(!_0x4ec86e[_0x02f0('0x49')]['hasOwnProperty'](_0x02f0('0x50'))){_0x12eac9[_0x02f0('0x32')]=qs[_0x02f0('0x32')](_0x4ec86e[_0x02f0('0x49')]['limit']);_0x12eac9['offset']=qs[_0x02f0('0x30')](_0x4ec86e[_0x02f0('0x49')]['offset']);}_0x12eac9[_0x02f0('0x68')]=qs[_0x02f0('0x69')](_0x4ec86e[_0x02f0('0x49')][_0x02f0('0x69')]);_0x12eac9['where']=qs[_0x02f0('0x4b')](_[_0x02f0('0x6a')](_0x4ec86e[_0x02f0('0x49')],_0x33657b['filters']));_0x12eac9[_0x02f0('0x51')][_0x02f0('0x65')]=_0x5b9a24['id'];if(_0x4ec86e[_0x02f0('0x49')][_0x02f0('0x52')]){_0x12eac9[_0x02f0('0x51')]=_[_0x02f0('0x53')](_0x12eac9[_0x02f0('0x51')],{'$or':_[_0x02f0('0x43')](_0x12eac9[_0x02f0('0x4d')],function(_0x363b35){var _0x492fc9={};_0x492fc9[_0x363b35]={'$like':'%'+_0x4ec86e['query'][_0x02f0('0x52')]+'%'};return _0x492fc9;})});}_0x12eac9=_['merge']({},_0x12eac9,_0x4ec86e['options']);return db['Disposition']['count']({'where':_0x12eac9['where']})[_0x02f0('0x21')](function(_0x5801d2){_0x1a09e5[_0x02f0('0x33')]=_0x5801d2;if(_0x4ec86e['query']['includeAll']){_0x12eac9['include']=[{'all':!![]}];}return db[_0x02f0('0x66')][_0x02f0('0x56')](_0x12eac9);})[_0x02f0('0x21')](function(_0xf948f8){_0x1a09e5[_0x02f0('0x6b')]=_0xf948f8;return _0x1a09e5;});}})[_0x02f0('0x21')](respondWithFilteredResult(_0x22481c,_0x12eac9))[_0x02f0('0x2c')](handleError(_0x22481c,null));};exports[_0x02f0('0x6c')]=function(_0x574ded,_0x24cf4e,_0x142c41){return db[_0x02f0('0x44')][_0x02f0('0x5b')]({'where':{'id':_0x574ded[_0x02f0('0x58')]['id']}})[_0x02f0('0x21')](handleEntityNotFound(_0x24cf4e,null))['then'](function(_0xcf6c14){if(_0xcf6c14){return _0xcf6c14['removeDispositions'](_0x574ded[_0x02f0('0x49')][_0x02f0('0x6d')]);}})[_0x02f0('0x21')](respondWithStatusCode(_0x24cf4e,null))[_0x02f0('0x2c')](handleError(_0x24cf4e,null));};exports['addAnswer']=function(_0x2cfec1,_0x153d43,_0x287f4b){if(_0x2cfec1[_0x02f0('0x5d')]['id']){delete _0x2cfec1[_0x02f0('0x5d')]['id'];}return db[_0x02f0('0x44')][_0x02f0('0x5b')]({'where':{'id':_0x2cfec1[_0x02f0('0x58')]['id']}})[_0x02f0('0x21')](handleEntityNotFound(_0x153d43,null))[_0x02f0('0x21')](function(_0xacc670){if(_0xacc670){_0x2cfec1[_0x02f0('0x5d')]['SmsAccountId']=_0xacc670['id'];return db[_0x02f0('0x6e')][_0x02f0('0x5c')](_0x2cfec1[_0x02f0('0x5d')]);}})[_0x02f0('0x21')](respondWithResult(_0x153d43,null))[_0x02f0('0x2c')](handleError(_0x153d43,null));};exports[_0x02f0('0x6f')]=function(_0x264072,_0x9dd816,_0x69de5b){var _0x53b21d={'raw':![],'where':{}};var _0x1a011f={};var _0x4f59e2={'count':0x0,'rows':[]};return db[_0x02f0('0x44')][_0x02f0('0x67')]({'where':{'id':_0x264072[_0x02f0('0x58')]['id']}})[_0x02f0('0x21')](handleEntityNotFound(_0x9dd816,null))[_0x02f0('0x21')](function(_0xe04749){if(_0xe04749){_0x1a011f['model']=_[_0x02f0('0x4a')](db[_0x02f0('0x6e')][_0x02f0('0x45')]);_0x1a011f[_0x02f0('0x49')]=_[_0x02f0('0x4a')](_0x264072[_0x02f0('0x49')]);_0x1a011f['filters']=_[_0x02f0('0x4c')](_0x1a011f[_0x02f0('0x48')],_0x1a011f[_0x02f0('0x49')]);_0x53b21d['attributes']=_[_0x02f0('0x4c')](_0x1a011f[_0x02f0('0x48')],qs[_0x02f0('0x4e')](_0x264072[_0x02f0('0x49')][_0x02f0('0x4e')]));_0x53b21d[_0x02f0('0x4d')]=_0x53b21d[_0x02f0('0x4d')][_0x02f0('0x4f')]?_0x53b21d['attributes']:_0x1a011f[_0x02f0('0x48')];if(!_0x264072[_0x02f0('0x49')][_0x02f0('0x70')](_0x02f0('0x50'))){_0x53b21d[_0x02f0('0x32')]=qs[_0x02f0('0x32')](_0x264072[_0x02f0('0x49')][_0x02f0('0x32')]);_0x53b21d[_0x02f0('0x30')]=qs[_0x02f0('0x30')](_0x264072[_0x02f0('0x49')][_0x02f0('0x30')]);}_0x53b21d[_0x02f0('0x68')]=qs[_0x02f0('0x69')](_0x264072[_0x02f0('0x49')][_0x02f0('0x69')]);_0x53b21d[_0x02f0('0x51')]=qs['filters'](_[_0x02f0('0x6a')](_0x264072[_0x02f0('0x49')],_0x1a011f[_0x02f0('0x4b')]));_0x53b21d[_0x02f0('0x51')][_0x02f0('0x65')]=_0xe04749['id'];if(_0x264072[_0x02f0('0x49')][_0x02f0('0x52')]){_0x53b21d[_0x02f0('0x51')]=_[_0x02f0('0x53')](_0x53b21d['where'],{'$or':_[_0x02f0('0x43')](_0x53b21d[_0x02f0('0x4d')],function(_0x55980a){var _0x50275c={};_0x50275c[_0x55980a]={'$like':'%'+_0x264072[_0x02f0('0x49')][_0x02f0('0x52')]+'%'};return _0x50275c;})});}_0x53b21d=_['merge']({},_0x53b21d,_0x264072[_0x02f0('0x5a')]);return db['CannedAnswer'][_0x02f0('0x33')]({'where':_0x53b21d[_0x02f0('0x51')]})[_0x02f0('0x21')](function(_0xf86e51){_0x4f59e2[_0x02f0('0x33')]=_0xf86e51;if(_0x264072['query']['includeAll']){_0x53b21d[_0x02f0('0x59')]=[{'all':!![]}];}return db[_0x02f0('0x6e')][_0x02f0('0x56')](_0x53b21d);})['then'](function(_0x4bef75){_0x4f59e2['rows']=_0x4bef75;return _0x4f59e2;});}})[_0x02f0('0x21')](respondWithFilteredResult(_0x9dd816,_0x53b21d))[_0x02f0('0x2c')](handleError(_0x9dd816,null));};exports[_0x02f0('0x71')]=function(_0x5cc062,_0x577235,_0x38e3c2){return db[_0x02f0('0x44')][_0x02f0('0x5b')]({'where':{'id':_0x5cc062[_0x02f0('0x58')]['id']}})[_0x02f0('0x21')](handleEntityNotFound(_0x577235,null))[_0x02f0('0x21')](function(_0x5d4e12){if(_0x5d4e12){return _0x5d4e12['removeAnswers'](_0x5cc062[_0x02f0('0x49')][_0x02f0('0x6d')]);}})[_0x02f0('0x21')](respondWithStatusCode(_0x577235,null))[_0x02f0('0x2c')](handleError(_0x577235,null));};exports[_0x02f0('0x72')]=function(_0x2edbf2,_0x4df5c8,_0x538608){var _0xe9ada1={'channel':_0x02f0('0x73')};var _0x244f0b=[];var _0x39c321=[];var _0x3425e8={};return db['SmsAccount']['find']({'where':{'id':_0x2edbf2[_0x02f0('0x58')]['id']},'include':[{'model':db[_0x02f0('0x74')],'as':_0x02f0('0x75')}]})[_0x02f0('0x21')](handleEntityNotFound(_0x4df5c8,null))[_0x02f0('0x21')](function(_0x561810){_0xe9ada1[_0x02f0('0x76')]=_0x561810;_0xe9ada1[_0x02f0('0x77')]=_[_0x02f0('0x78')](_0x561810[_0x02f0('0x75')],[_0x02f0('0x79')],[_0x02f0('0x7a')]);if(_0xe9ada1[_0x02f0('0x76')][_0x02f0('0x75')]){delete _0xe9ada1[_0x02f0('0x76')][_0x02f0('0x75')];}return db['CmContact'][_0x02f0('0x63')]();})[_0x02f0('0x21')](function(_0x4f559b){if(!_0x4f559b){throw new db[(_0x02f0('0x7b'))][(_0x02f0('0x7c'))]('no\x20available\x20attributes');}_0x244f0b=_[_0x02f0('0x7d')](_['keys'](_0x4f559b),['createdAt',_0x02f0('0x7e')]);_0x39c321=_[_0x02f0('0x7d')](_[_0x02f0('0x4a')](_0x4f559b),['createdAt','updatedAt','CompanyId',_0x02f0('0x7f')]);_0xe9ada1[_0x02f0('0x5d')]={'mapKey':_0x02f0('0x80')};if(_0xe9ada1[_0x02f0('0x76')][_0x02f0('0x47')]){switch(_0xe9ada1['account']['type']){case'twilio':_0xe9ada1[_0x02f0('0x5d')][_0x02f0('0x81')]=_0x2edbf2['body'][_0x02f0('0x82')];_0xe9ada1[_0x02f0('0x5d')][_0x02f0('0x5d')]=_0x2edbf2[_0x02f0('0x5d')][_0x02f0('0x83')];_0xe9ada1['body'][_0x02f0('0x84')]=_0x2edbf2[_0x02f0('0x5d')][_0x02f0('0x85')];break;case _0x02f0('0x86'):_0xe9ada1[_0x02f0('0x5d')]['from']='+'+_0x2edbf2[_0x02f0('0x5d')][_0x02f0('0x87')];_0xe9ada1[_0x02f0('0x5d')]['body']=_0x2edbf2[_0x02f0('0x5d')][_0x02f0('0x88')];break;case _0x02f0('0x89'):_0xe9ada1['body']['from']=_0x2edbf2['body']['from'];_0xe9ada1[_0x02f0('0x5d')][_0x02f0('0x5d')]=_0x2edbf2[_0x02f0('0x5d')][_0x02f0('0x28')];break;case _0x02f0('0x8a'):_0xe9ada1[_0x02f0('0x5d')][_0x02f0('0x81')]=_0x2edbf2[_0x02f0('0x5d')][_0x02f0('0x81')];_0xe9ada1[_0x02f0('0x5d')][_0x02f0('0x5d')]=_0x2edbf2[_0x02f0('0x5d')][_0x02f0('0x5d')];_0xe9ada1[_0x02f0('0x5d')][_0x02f0('0x84')]=_0x2edbf2['body'][_0x02f0('0x8b')];break;case _0x02f0('0x8c'):_0xe9ada1[_0x02f0('0x5d')]['from']=_0x2edbf2['body'][_0x02f0('0x82')];_0xe9ada1[_0x02f0('0x5d')]['body']=_0x2edbf2[_0x02f0('0x5d')]['Text'];_0xe9ada1[_0x02f0('0x5d')]['messageId']=_0x2edbf2['body'][_0x02f0('0x8d')];break;case _0x02f0('0x8e'):_0xe9ada1[_0x02f0('0x5d')][_0x02f0('0x81')]='+'+_0x2edbf2[_0x02f0('0x5d')][_0x02f0('0x8f')][0x0]['from'];_0xe9ada1[_0x02f0('0x5d')][_0x02f0('0x5d')]=_0x2edbf2[_0x02f0('0x5d')][_0x02f0('0x8f')][0x0][_0x02f0('0x88')];_0xe9ada1['body'][_0x02f0('0x84')]=_0x2edbf2[_0x02f0('0x5d')][_0x02f0('0x8f')][0x0][_0x02f0('0x84')];break;case'csc':_0xe9ada1['body'][_0x02f0('0x81')]=_0x2edbf2['body']['originatingAddress'];_0xe9ada1[_0x02f0('0x5d')][_0x02f0('0x5d')]=_0x2edbf2[_0x02f0('0x5d')][_0x02f0('0x90')][_0x02f0('0x28')];break;case _0x02f0('0x91'):_0xe9ada1[_0x02f0('0x5d')][_0x02f0('0x81')]=_0x2edbf2['body']['fromNumber'];_0xe9ada1[_0x02f0('0x5d')]['body']=_0x2edbf2[_0x02f0('0x5d')][_0x02f0('0x88')];_0xe9ada1[_0x02f0('0x5d')]['messageId']=_0x2edbf2[_0x02f0('0x5d')]['replyMessageId'];break;case _0x02f0('0x92'):_0xe9ada1['body'][_0x02f0('0x84')]=_0x2edbf2[_0x02f0('0x5d')][0x0][_0x02f0('0x28')]['id'];_0xe9ada1[_0x02f0('0x5d')][_0x02f0('0x81')]=_0x2edbf2['body'][0x0][_0x02f0('0x28')][_0x02f0('0x81')];_0xe9ada1[_0x02f0('0x5d')]['body']=_0x2edbf2[_0x02f0('0x5d')][0x0][_0x02f0('0x28')][_0x02f0('0x88')];break;case _0x02f0('0x93'):_0xe9ada1['body'][_0x02f0('0x81')]=_0x2edbf2[_0x02f0('0x5d')][_0x02f0('0x81')];_0xe9ada1[_0x02f0('0x5d')][_0x02f0('0x5d')]=_0x2edbf2['body'][_0x02f0('0x28')];_0xe9ada1[_0x02f0('0x5d')][_0x02f0('0x84')]=_0x2edbf2[_0x02f0('0x5d')][_0x02f0('0x94')];break;}}if(_0xe9ada1[_0x02f0('0x5d')]['id']){delete _0xe9ada1['body']['id'];}if(_[_0x02f0('0x95')](_0xe9ada1['body'][_0x02f0('0x81')])){throw new db['Sequelize'][(_0x02f0('0x7c'))](_0x02f0('0x96'));}if(_[_0x02f0('0x95')](_0xe9ada1[_0x02f0('0x5d')]['body'])||_0xe9ada1[_0x02f0('0x5d')][_0x02f0('0x5d')]===''){throw new db[(_0x02f0('0x7b'))]['ValidationError'](_0x02f0('0x97'));}if(_[_0x02f0('0x95')](_0xe9ada1[_0x02f0('0x5d')]['mapKey'])){throw new db['Sequelize']['ValidationError'](_0x02f0('0x98')+_0x39c321);}if(!_[_0x02f0('0x99')](_0x39c321,_0xe9ada1[_0x02f0('0x5d')][_0x02f0('0x9a')])){throw new db[(_0x02f0('0x7b'))][(_0x02f0('0x7c'))](_0x02f0('0x9b')+_0x39c321);}_0x3425e8[_0xe9ada1[_0x02f0('0x5d')][_0x02f0('0x9a')]]=_0xe9ada1['body'][_0x02f0('0x81')];return db['CmList'][_0x02f0('0x5b')]({'where':{'id':_0xe9ada1['account'][_0x02f0('0x7f')]},'include':[{'model':db[_0x02f0('0x9c')],'as':_0x02f0('0x9d'),'where':_0x3425e8,'limit':0x1,'order':[['updatedAt',_0x02f0('0x9e')]]}]});})['then'](handleEntityNotFound(_0x4df5c8,null))['then'](function(_0x14cf71){if(_0x14cf71){_0xe9ada1['list']=_[_0x02f0('0x9f')](_0x14cf71,[_0x02f0('0x9d')]);if(_0x14cf71[_0x02f0('0x9d')][_0x02f0('0x4f')]){return _0x14cf71[_0x02f0('0x9d')][0x0];}var _0x5a2e28=_[_0x02f0('0x1c')](_0xe9ada1[_0x02f0('0x5d')],{'firstName':_0xe9ada1[_0x02f0('0x5d')][_0x02f0('0x81')],'ListId':_0x14cf71['id']});_0x5a2e28[_0xe9ada1[_0x02f0('0x5d')][_0x02f0('0x9a')]]=_0xe9ada1['body'][_0x02f0('0x81')];return db['CmContact'][_0x02f0('0x5c')](_0x5a2e28,{'fields':_0x244f0b,'raw':!![]});}})[_0x02f0('0x21')](handleEntityNotFound(_0x4df5c8,null))['then'](function(_0x22349c){if(_0x22349c){_0xe9ada1[_0x02f0('0xa0')]=_0x22349c;var _0x806f0c={'ContactId':_0x22349c['id'],'phone':_0xe9ada1['body'][_0x02f0('0x81')],'SmsAccountId':_0x2edbf2[_0x02f0('0x58')]['id']};var _0x127d27={'ContactId':_0x22349c['id'],'SmsAccountId':_0x2edbf2['params']['id'],'closed':![]};return db['SmsInteraction'][_0x02f0('0x5b')]({'where':_0x127d27})[_0x02f0('0x21')](function(_0x7e4c2d){if(_0x7e4c2d){return[_0x7e4c2d,![]];}return db[_0x02f0('0xa1')]['create'](_0x806f0c)[_0x02f0('0x21')](function(_0x10cb02){return[_0x10cb02,!![]];});});}})[_0x02f0('0xa2')](function(_0x388c8e,_0x38149e){_0xe9ada1[_0x02f0('0xa3')]=_0x388c8e[_0x02f0('0x5f')]({'plain':!![]});_0xe9ada1['interaction'][_0x02f0('0xa4')]=![];if(_0x38149e){if(_0xe9ada1['account'][_0x02f0('0xa5')]){_0xe9ada1[_0x02f0('0x77')][_0x02f0('0xa6')]({'id':0x0,'priority':_0xe9ada1['applications'][_0x02f0('0x4f')]+0x1,'app':'close','appdata':_0x02f0('0xa7'),'interval':_0x02f0('0xa8')});}_0xe9ada1['interaction'][_0x02f0('0xa4')]=!![];}return db[_0x02f0('0xa9')][_0x02f0('0x5c')]({'phone':_0xe9ada1['body'][_0x02f0('0x81')],'messageId':_0xe9ada1[_0x02f0('0x5d')][_0x02f0('0x84')],'body':_0xe9ada1['body'][_0x02f0('0x5d')],'SmsAccountId':_0x2edbf2[_0x02f0('0x58')]['id'],'SmsInteractionId':_0x388c8e['id'],'direction':'in','ContactId':_0x388c8e[_0x02f0('0xaa')],'AttachmentId':_0xe9ada1[_0x02f0('0x5d')][_0x02f0('0xab')]});})['then'](function(_0x5d755c){_0xe9ada1[_0x02f0('0x28')]=_0x5d755c;if(!_0xe9ada1['interaction'][_0x02f0('0xac')])return;return db[_0x02f0('0xad')]['find']({'attributes':['id','name'],'where':{'id':_0xe9ada1[_0x02f0('0xa3')]['UserId']}});})[_0x02f0('0x21')](function(_0x228cae){if(_0x228cae){_0xe9ada1[_0x02f0('0x77')][_0x02f0('0xae')]({'id':0x0,'priority':0x0,'app':_0x02f0('0xaf'),'appdata':_0x228cae[_0x02f0('0x3e')]+','+(_0xe9ada1['account'][_0x02f0('0xb0')]||0xa),'interval':'*,*,*,*'});}if(!_0xe9ada1[_0x02f0('0xa3')]['queueId'])return;return db[_0x02f0('0xb1')][_0x02f0('0x5b')]({'attributes':['id',_0x02f0('0x3e')],'where':{'id':_0xe9ada1[_0x02f0('0xa3')]['queueId']}});})[_0x02f0('0x21')](function(_0x296b8e){if(_0x296b8e){_0xe9ada1[_0x02f0('0x77')][_0x02f0('0xae')]({'id':0x0,'priority':0x1,'app':_0x02f0('0xb2'),'appdata':_0x296b8e[_0x02f0('0x3e')]+','+(_0xe9ada1[_0x02f0('0x76')]['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x02f0('0xb3'),_0x02f0('0xb4'),_0xe9ada1);})[_0x02f0('0x21')](function(_0x13474c){if(_0x13474c){var _0xda6967=0xc8;var _0x360337=_0x02f0('0xb5');logger[_0x02f0('0x2a')](_0x02f0('0x24'),_0x360337,_0xda6967,_0x02f0('0xb6'));logger[_0x02f0('0x23')](_0x02f0('0xb7'),_0x360337,_0xda6967,_0x02f0('0xb6'),JSON[_0x02f0('0x25')](_0x13474c));if(_0xe9ada1[_0x02f0('0x76')][_0x02f0('0x47')]==='twilio'){return _0x4df5c8[_0x02f0('0x2d')](_0xda6967)[_0x02f0('0x34')](_0x02f0('0xb8'),_0x02f0('0xb9'))[_0x02f0('0x3f')]('\x0a');}else{return _0x4df5c8['status'](_0xda6967)[_0x02f0('0x2f')](_0x13474c);}}})[_0x02f0('0x2c')](handleError(_0x4df5c8,null));};exports[_0x02f0('0xba')]=function(_0x2fc4d6,_0x59c952){var _0x3b0374=_0x2fc4d6['params']['id'];var _0x188d5e=_0x2fc4d6[_0x02f0('0x5d')];var _0x1517c1=0xc8;var _0x46e77f=null;return db[_0x02f0('0xbb')][_0x02f0('0xbc')]({'isolationLevel':db['sequelize'][_0x02f0('0xbd')][_0x02f0('0xbe')][_0x02f0('0xbf')]},function(_0x517f3b){return db[_0x02f0('0x44')][_0x02f0('0x67')]({'where':{'id':_0x3b0374},'transaction':_0x517f3b})['then'](function(_0x1c674){if(_0x1c674){return db[_0x02f0('0x74')][_0x02f0('0x39')]({'where':{'SmsAccountId':_0x3b0374},'transaction':_0x517f3b})[_0x02f0('0x21')](function(){var _0x4546c0=_[_0x02f0('0x43')](_0x188d5e,function(_0x5e96d3){_0x5e96d3['SmsAccountId']=_0x3b0374;return _0x5e96d3;});return db[_0x02f0('0x74')]['bulkCreate'](_0x4546c0,{'transaction':_0x517f3b});});}else{_0x1517c1=0x194;_0x46e77f=[];}});})[_0x02f0('0x21')](function(){if(_0x1517c1!==0x194){return db['SmsApplication'][_0x02f0('0xc0')]({'where':{'SmsAccountId':_0x3b0374},'order':_0x02f0('0x79')})[_0x02f0('0x21')](function(_0x21b259){_0x46e77f=_0x21b259;});}})['catch'](function(_0x13f47f){_0x1517c1=0x1f4;logger['error'](_0x13f47f['stack']);if(_0x13f47f[_0x02f0('0x3e')]){delete _0x13f47f[_0x02f0('0x3e')];}_0x46e77f=_0x13f47f;})[_0x02f0('0xc1')](function(){if(_0x46e77f===null){_0x59c952[_0x02f0('0x3c')](_0x1517c1);}else{if(_0x1517c1===0x1f4){_0x59c952['status'](_0x1517c1)[_0x02f0('0x3f')](_0x46e77f);}else{_0x59c952['status'](_0x1517c1)['json'](_0x46e77f);}}});};exports[_0x02f0('0xc2')]=function(_0x18c988,_0x4bc92c,_0x544bbc){var _0x36bd71={};var _0x1fd9e1={};var _0x5bcd61;var _0x1c77bb;return db[_0x02f0('0x44')][_0x02f0('0x67')]({'where':{'id':_0x18c988['params']['id']}})['then'](handleEntityNotFound(_0x4bc92c,null))[_0x02f0('0x21')](function(_0x31bf8c){if(_0x31bf8c){_0x5bcd61=_0x31bf8c;_0x1fd9e1['model']=_[_0x02f0('0x4a')](db['SmsApplication']['rawAttributes']);_0x1fd9e1[_0x02f0('0x49')]=_[_0x02f0('0x4a')](_0x18c988[_0x02f0('0x49')]);_0x1fd9e1[_0x02f0('0x4b')]=_['intersection'](_0x1fd9e1['model'],_0x1fd9e1['query']);_0x36bd71['attributes']=_[_0x02f0('0x4c')](_0x1fd9e1[_0x02f0('0x48')],qs['fields'](_0x18c988[_0x02f0('0x49')][_0x02f0('0x4e')]));_0x36bd71[_0x02f0('0x4d')]=_0x36bd71[_0x02f0('0x4d')][_0x02f0('0x4f')]?_0x36bd71[_0x02f0('0x4d')]:_0x1fd9e1[_0x02f0('0x48')];_0x36bd71[_0x02f0('0x68')]=qs[_0x02f0('0x69')](_0x18c988[_0x02f0('0x49')]['sort']);_0x36bd71[_0x02f0('0x51')]=qs['filters'](_[_0x02f0('0x6a')](_0x18c988[_0x02f0('0x49')],_0x1fd9e1[_0x02f0('0x4b')]));if(_0x18c988[_0x02f0('0x49')][_0x02f0('0x52')]){_0x36bd71[_0x02f0('0x51')]=_[_0x02f0('0x53')](_0x36bd71[_0x02f0('0x51')],{'$or':_['map'](_0x36bd71[_0x02f0('0x4d')],function(_0x2694e6){var _0x7c12e5={};_0x7c12e5[_0x2694e6]={'$like':'%'+_0x18c988[_0x02f0('0x49')][_0x02f0('0x52')]+'%'};return _0x7c12e5;})});}_0x36bd71=_[_0x02f0('0x53')]({},_0x36bd71,_0x18c988[_0x02f0('0x5a')]);return _0x5bcd61[_0x02f0('0xc2')](_0x36bd71);}})[_0x02f0('0x21')](function(_0x1f10b8){if(_0x1f10b8){_0x1c77bb=_0x1f10b8['length'];if(!_0x18c988['query'][_0x02f0('0x70')](_0x02f0('0x50'))){_0x36bd71[_0x02f0('0x32')]=qs[_0x02f0('0x32')](_0x18c988['query'][_0x02f0('0x32')]);_0x36bd71['offset']=qs['offset'](_0x18c988[_0x02f0('0x49')]['offset']);}return _0x5bcd61[_0x02f0('0xc2')](_0x36bd71);}})[_0x02f0('0x21')](function(_0x2b5738){if(_0x2b5738){return _0x2b5738?{'count':_0x1c77bb,'rows':_0x2b5738}:null;}})[_0x02f0('0x21')](respondWithResult(_0x4bc92c,null))[_0x02f0('0x2c')](handleError(_0x4bc92c,null));};exports['getInteractions']=function(_0x195c14,_0x2dbae5,_0x92413f){var _0x402dc4={'raw':![],'where':{}};var _0x1f38a5={};var _0x2aa01a={'count':0x0,'rows':[]};return db[_0x02f0('0x44')][_0x02f0('0x67')]({'where':{'id':_0x195c14[_0x02f0('0x58')]['id']}})[_0x02f0('0x21')](handleEntityNotFound(_0x2dbae5,null))[_0x02f0('0x21')](function(_0x15a574){if(_0x15a574){_0x1f38a5['model']=_[_0x02f0('0x4a')](db[_0x02f0('0xa1')][_0x02f0('0x45')]);_0x1f38a5[_0x02f0('0x49')]=_[_0x02f0('0x4a')](_0x195c14[_0x02f0('0x49')]);_0x1f38a5['filters']=_['intersection'](_0x1f38a5[_0x02f0('0x48')],_0x1f38a5[_0x02f0('0x49')]);_0x402dc4[_0x02f0('0x4d')]=_['intersection'](_0x1f38a5['model'],qs[_0x02f0('0x4e')](_0x195c14[_0x02f0('0x49')][_0x02f0('0x4e')]));_0x402dc4[_0x02f0('0x4d')]=_0x402dc4['attributes'][_0x02f0('0x4f')]?_0x402dc4[_0x02f0('0x4d')]:_0x1f38a5[_0x02f0('0x48')];if(!_0x195c14[_0x02f0('0x49')]['hasOwnProperty'](_0x02f0('0x50'))){_0x402dc4[_0x02f0('0x32')]=qs[_0x02f0('0x32')](_0x195c14[_0x02f0('0x49')][_0x02f0('0x32')]);_0x402dc4['offset']=qs[_0x02f0('0x30')](_0x195c14[_0x02f0('0x49')]['offset']);}_0x402dc4[_0x02f0('0x68')]=qs[_0x02f0('0x69')](_0x195c14['query'][_0x02f0('0x69')]);_0x402dc4[_0x02f0('0x51')]=qs[_0x02f0('0x4b')](_[_0x02f0('0x6a')](_0x195c14['query'],_0x1f38a5[_0x02f0('0x4b')]));_0x402dc4[_0x02f0('0x51')][_0x02f0('0x65')]=_0x15a574['id'];if(_0x195c14[_0x02f0('0x49')][_0x02f0('0x52')]){_0x402dc4['where']=_['merge'](_0x402dc4[_0x02f0('0x51')],{'$or':_[_0x02f0('0x43')](_0x402dc4['attributes'],function(_0x4fdf84){var _0x443bc6={};_0x443bc6[_0x4fdf84]={'$like':'%'+_0x195c14[_0x02f0('0x49')][_0x02f0('0x52')]+'%'};return _0x443bc6;})});}_0x402dc4=_[_0x02f0('0x53')]({},_0x402dc4,_0x195c14['options']);return db['SmsInteraction'][_0x02f0('0x33')]({'where':_0x402dc4[_0x02f0('0x51')]})[_0x02f0('0x21')](function(_0x435371){_0x2aa01a[_0x02f0('0x33')]=_0x435371;if(_0x195c14['query'][_0x02f0('0x55')]){_0x402dc4['include']=[{'model':db[_0x02f0('0x9c')],'as':'Contact','required':![]},{'model':db[_0x02f0('0xad')],'as':_0x02f0('0xc3'),'attributes':[_0x02f0('0x3e'),_0x02f0('0xc4'),_0x02f0('0xc5')],'required':![]},{'model':db[_0x02f0('0xc6')],'as':_0x02f0('0xc7'),'attributes':['id',_0x02f0('0x3e'),_0x02f0('0xc8')],'where':_0x195c14[_0x02f0('0x49')][_0x02f0('0xc9')]?{'id':_0x195c14['query']['tag']}:undefined,'required':_0x195c14[_0x02f0('0x49')]['tag']?!![]:![]}];}return db[_0x02f0('0xa1')]['findAll'](_0x402dc4);})[_0x02f0('0x21')](function(_0x468f92){_0x2aa01a[_0x02f0('0x6b')]=_0x468f92;return _0x2aa01a;});}})[_0x02f0('0x21')](respondWithFilteredResult(_0x2dbae5,_0x402dc4))['catch'](handleError(_0x2dbae5,null));};exports[_0x02f0('0x3f')]=function(_0x44488e,_0x1d54db,_0x42a9aa){var _0x104d8d,_0x462975,_0x1ca57e;if(_[_0x02f0('0x95')](_0x44488e[_0x02f0('0x5d')]['body'])||_0x44488e[_0x02f0('0x5d')][_0x02f0('0x5d')]===''){throw new db[(_0x02f0('0x7b'))][(_0x02f0('0x7c'))](_0x02f0('0x97'));}if(_['isNil'](_0x44488e[_0x02f0('0x5d')]['to'])){throw new db['Sequelize'][(_0x02f0('0x7c'))](_0x02f0('0xca'));}_0x104d8d=_0x44488e[_0x02f0('0x5d')]['to'];return db[_0x02f0('0x44')][_0x02f0('0x5b')]({'where':{'id':_0x44488e['params']['id']},'include':[{'model':db['CmList'],'as':_0x02f0('0xcb'),'include':[{'model':db[_0x02f0('0x9c')],'as':_0x02f0('0x9d'),'where':{'mobile':_0x104d8d},'limit':0x1,'order':[[_0x02f0('0x7e'),_0x02f0('0x9e')]]}]}]})[_0x02f0('0x21')](handleEntityNotFound(_0x1d54db,null))[_0x02f0('0x21')](function(_0x4d479d){if(_0x4d479d&&_0x4d479d['List']){_0x462975=_0x4d479d[_0x02f0('0x5f')]({'plain':!![]});if(_0x462975[_0x02f0('0xcb')]&&_0x462975[_0x02f0('0xcb')][_0x02f0('0x9d')]['length']){return _0x462975[_0x02f0('0xcb')][_0x02f0('0x9d')][0x0];}return db[_0x02f0('0x9c')][_0x02f0('0x5c')](_[_0x02f0('0x1c')](_0x44488e[_0x02f0('0x5d')],{'firstName':_0x104d8d,'mobile':_0x104d8d,'phone':_0x104d8d,'ListId':_0x462975[_0x02f0('0x7f')]}));}})[_0x02f0('0x21')](handleEntityNotFound(_0x1d54db,null))[_0x02f0('0x21')](function(_0x13405a){if(_0x13405a){_0x1ca57e=_0x13405a;return db[_0x02f0('0xa1')][_0x02f0('0x5b')]({'where':{'ContactId':_0x1ca57e['id'],'closed':![],'SmsAccountId':_0x462975['id']}})['then'](function(_0x7c6a70){if(_0x7c6a70){return[_0x7c6a70,![]];}return db[_0x02f0('0xa1')][_0x02f0('0x5c')]({'UserId':_0x44488e[_0x02f0('0x5e')]['id'],'ContactId':_0x1ca57e['id'],'SmsAccountId':_0x462975['id'],'phone':_0x104d8d,'firstMsgDirection':_0x02f0('0xcc'),'Messages':[_[_0x02f0('0x53')](_0x44488e[_0x02f0('0x5d')],{'read':![],'body':_0x44488e[_0x02f0('0x5d')][_0x02f0('0x5d')],'phone':_0x104d8d,'SmsAccountId':_0x462975['id'],'UserId':_0x44488e[_0x02f0('0x5e')]['id'],'ContactId':_0x1ca57e['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x02f0('0xcd')}]})[_0x02f0('0x21')](function(_0x13d29e){return[_0x13d29e,!![]];});});}})['spread'](function(_0x5a90c1,_0x5a3b7b){if(_0x5a3b7b){return _0x5a90c1;}return db[_0x02f0('0xa9')]['create'](_[_0x02f0('0x53')](_0x44488e['body'],{'read':![],'body':_0x44488e['body']['body'],'phone':_0x104d8d,'SmsAccountId':_0x462975['id'],'SmsInteractionId':_0x5a90c1['id'],'UserId':_0x44488e['user']['id'],'ContactId':_0x1ca57e['id']}))[_0x02f0('0x21')](function(_0x426be8){_0x5a90c1[_0x02f0('0xce')][_0x02f0('0xcd')]=[];_0x5a90c1['dataValues']['Messages'][_0x02f0('0xa6')](_0x426be8[_0x02f0('0xce')]);return _0x5a90c1;});})[_0x02f0('0x21')](respondWithResult(_0x1d54db,null))[_0x02f0('0x2c')](handleError(_0x1d54db,null));};exports[_0x02f0('0x2d')]=function(_0x532dce,_0x5677ae,_0x62fff4){if(_0x532dce[_0x02f0('0x5d')]['id']){delete _0x532dce['body']['id'];}var _0x46a17d,_0x166719,_0xec6a7;return db['SmsAccount'][_0x02f0('0x5b')]({'where':{'id':_0x532dce['params']['id']}})[_0x02f0('0x21')](handleEntityNotFound(_0x5677ae,null))[_0x02f0('0x21')](function(_0x2680fd){if(_0x2680fd){_0xec6a7=_0x2680fd;logger[_0x02f0('0x23')](_0x02f0('0x24'),_0x02f0('0x2d'),_0x02f0('0xcf'),_0x2680fd[_0x02f0('0x47')],util[_0x02f0('0xd0')](_0x532dce[_0x02f0('0x5d')],{'showHidden':![],'depth':null}));switch(_0x2680fd['type']){case _0x02f0('0x86'):if(_0x532dce[_0x02f0('0x5d')][_0x02f0('0xd1')]&&_0x532dce['body'][_0x02f0('0x2d')]){_0x166719=_0x532dce[_0x02f0('0x5d')][_0x02f0('0x2d')];return db['SmsMessage'][_0x02f0('0x5b')]({'where':{'messageId':_0x532dce[_0x02f0('0x5d')][_0x02f0('0xd1')]}});}break;case _0x02f0('0x89'):if(_0x532dce[_0x02f0('0x5d')]['requestid']&&_0x532dce[_0x02f0('0x5d')][_0x02f0('0xd2')]){_0x166719=_0x532dce[_0x02f0('0x5d')]['statusInt'];return db[_0x02f0('0xa9')][_0x02f0('0x5b')]({'where':{'messageId':_0x532dce['body']['requestid']}});}break;case _0x02f0('0x8a'):if(_0x532dce['body']['message_id']&&_0x532dce[_0x02f0('0x5d')][_0x02f0('0xd3')]){_0x166719=_0x532dce[_0x02f0('0x5d')][_0x02f0('0xd3')];return db['SmsMessage']['find']({'where':{'messageId':_0x532dce[_0x02f0('0x5d')][_0x02f0('0x8b')]}});}break;case _0x02f0('0x8e'):var _0x2bf921=_0x532dce[_0x02f0('0x5d')]['results'][0x0];if(_0x2bf921[_0x02f0('0x84')]&&_0x2bf921['status'][_0x02f0('0xd4')]===_0x02f0('0xd5')){_0x166719=_0x2bf921['status'][_0x02f0('0xd4')];return db[_0x02f0('0xa9')][_0x02f0('0x5b')]({'where':{'messageId':_0x2bf921[_0x02f0('0x84')]}});}break;case _0x02f0('0x91'):if(_0x532dce[_0x02f0('0x5d')][_0x02f0('0x84')]&&_0x532dce['body'][_0x02f0('0x2d')]){_0x166719=_0x532dce[_0x02f0('0x5d')][_0x02f0('0x2d')];return db[_0x02f0('0xa9')]['find']({'where':{'messageId':_0x532dce[_0x02f0('0x5d')][_0x02f0('0x84')]}});}break;case'bandwidth':if(_0x532dce['body'][0x0][_0x02f0('0x28')]['id']){_0x166719=_0x532dce[_0x02f0('0x5d')][0x0]['type'];return db[_0x02f0('0xa9')][_0x02f0('0x5b')]({'where':{'messageId':_0x532dce['body'][0x0]['message']['id']}});}break;case _0x02f0('0x93'):if(_0x532dce['body'][_0x02f0('0xd6')]&&_0x532dce[_0x02f0('0x5d')]['status']){_0x166719=_0x532dce['body'][_0x02f0('0x2d')];return db[_0x02f0('0xa9')]['find']({'where':{'messageId':_0x532dce[_0x02f0('0x5d')][_0x02f0('0xd6')]}});}break;}}})[_0x02f0('0x21')](handleEntityNotFound(_0x5677ae,null))[_0x02f0('0x21')](function(_0x4d8073){if(_0x4d8073){_0x46a17d=_0x4d8073;switch(_0xec6a7[_0x02f0('0x47')]){case'skebby':if(_0x166719===_0x02f0('0xd5')){return _0x46a17d[_0x02f0('0x38')]({'read':!![]});}else{logger['error'](_0x02f0('0x24'),_0x02f0('0x2d'),_0x02f0('0x86'),util[_0x02f0('0xd0')](_0x532dce[_0x02f0('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x02f0('0x89'):if(_0x166719==='1'){return _0x46a17d[_0x02f0('0x38')]({'read':!![]});}else{logger[_0x02f0('0x26')](_0x02f0('0x24'),_0x02f0('0x2d'),'skebby',util[_0x02f0('0xd0')](_0x532dce[_0x02f0('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x02f0('0x8a'):if(!_0x532dce['body'][_0x02f0('0xd7')]&&_0x166719>=0xc8&&_0x166719<=0xce){return _0x46a17d[_0x02f0('0x38')]({'read':!![]});}else{logger[_0x02f0('0x26')](_0x02f0('0x24'),_0x02f0('0x2d'),'clicksend',util['inspect'](_0x532dce[_0x02f0('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x02f0('0x8e'):var _0x1eaca5=_0x532dce[_0x02f0('0x5d')]['results'][0x0];if(_0x1eaca5[_0x02f0('0x2d')][_0x02f0('0xd4')]===_0x02f0('0xd5')){return _0x46a17d[_0x02f0('0x38')]({'read':!![]});}else{logger[_0x02f0('0x26')](_0x02f0('0x24'),_0x02f0('0x2d'),'infobip',util[_0x02f0('0xd0')](_0x532dce[_0x02f0('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x02f0('0x91'):if(_0x166719==_0x02f0('0xd8')||_0x166719==_0x02f0('0xd9')){return _0x46a17d[_0x02f0('0x38')]({'read':!![]});}else{logger[_0x02f0('0x26')](_0x02f0('0x24'),'status','clickatell',util[_0x02f0('0xd0')](_0x532dce[_0x02f0('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x02f0('0x92'):if(_0x166719==_0x02f0('0xda')){return _0x46a17d['update']({'read':!![]});}else{logger[_0x02f0('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x02f0('0x2d'),_0x02f0('0x92'),util[_0x02f0('0xd0')](_0x532dce[_0x02f0('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x02f0('0x93'):if(_0x166719===_0x02f0('0xdb')||_0x166719===_0x02f0('0xdc')){return _0x46a17d['update']({'read':!![]});}else{logger[_0x02f0('0x26')](_0x02f0('0x24'),'status',_0x02f0('0x93'),util[_0x02f0('0xd0')](_0x532dce['body'],{'showHidden':![],'depth':null}));}break;}return _0x46a17d;}})['then'](respondWithResult(_0x5677ae,null))[_0x02f0('0x2c')](handleError(_0x5677ae,null));};exports[_0x02f0('0xdd')]=function(_0x3a165c,_0x275315,_0x511624){var _0x1e9544,_0x157a3d,_0x2eb61b;return db[_0x02f0('0x44')][_0x02f0('0x5b')]({'where':{'id':_0x3a165c[_0x02f0('0x58')]['id']}})['then'](handleEntityNotFound(_0x275315,null))['then'](function(_0x425626){if(_0x425626){_0x2eb61b=_0x425626;logger[_0x02f0('0x23')](_0x02f0('0x24'),_0x02f0('0x2d'),_0x02f0('0xcf'),_0x425626[_0x02f0('0x47')],util['inspect'](_0x3a165c[_0x02f0('0x49')],{'showHidden':![],'depth':null}));switch(_0x425626[_0x02f0('0x47')]){case _0x02f0('0xde'):if(_0x3a165c[_0x02f0('0x49')][_0x02f0('0xdf')]&&_0x3a165c[_0x02f0('0x49')][_0x02f0('0xe0')]){_0x157a3d=_0x3a165c['query'][_0x02f0('0xe0')];return db[_0x02f0('0xa9')][_0x02f0('0x5b')]({'where':{'messageId':_0x3a165c[_0x02f0('0x49')][_0x02f0('0xdf')]}});}break;}}})[_0x02f0('0x21')](handleEntityNotFound(_0x275315,null))[_0x02f0('0x21')](function(_0x43f8e0){if(_0x43f8e0){_0x1e9544=_0x43f8e0;switch(_0x2eb61b[_0x02f0('0x47')]){case _0x02f0('0xde'):if(_0x157a3d==='2'||_0x157a3d==='6'){return _0x1e9544[_0x02f0('0x38')]({'read':!![]});}else{logger[_0x02f0('0x26')](_0x02f0('0x24'),'status',_0x02f0('0xde'),util[_0x02f0('0xd0')](_0x3a165c['query'],{'showHidden':![],'depth':null}));};break;}return _0x1e9544;}})['then'](respondWithResult(_0x275315,null))[_0x02f0('0x2c')](handleError(_0x275315,null));};exports['addAgents']=function(_0x43dc57,_0x3a23d3,_0x4d9286){return db['SmsAccount']['find']({'where':{'id':_0x43dc57[_0x02f0('0x58')]['id']}})[_0x02f0('0x21')](handleEntityNotFound(_0x3a23d3,null))[_0x02f0('0x21')](function(_0x177bc2){if(_0x177bc2){return _0x177bc2[_0x02f0('0xe1')](_0x43dc57[_0x02f0('0x5d')][_0x02f0('0x6d')],_[_0x02f0('0x9f')](_0x43dc57['body'],[_0x02f0('0x6d'),'id'])||{})[_0x02f0('0xa2')](function(_0x238eb3){for(var _0x4b07de=0x0;_0x4b07de<_0x43dc57[_0x02f0('0x5d')][_0x02f0('0x6d')][_0x02f0('0x4f')];_0x4b07de+=0x1){socket[_0x02f0('0xe2')]('userSmsAccount:save',{'UserId':Number(_0x43dc57[_0x02f0('0x5d')][_0x02f0('0x6d')][_0x4b07de]),'SmsAccountId':Number(_0x43dc57[_0x02f0('0x58')]['id'])});}return _0x238eb3;});}})[_0x02f0('0x21')](respondWithResult(_0x3a23d3,null))['catch'](handleError(_0x3a23d3,null));};exports[_0x02f0('0xe3')]=function(_0x44b519,_0x564b28,_0x24ba25){return db[_0x02f0('0x44')][_0x02f0('0x5b')]({'where':{'id':_0x44b519[_0x02f0('0x58')]['id']}})['then'](handleEntityNotFound(_0x564b28,null))[_0x02f0('0x21')](function(_0x56f464){if(_0x56f464){return _0x56f464[_0x02f0('0xe3')](_0x44b519['query'][_0x02f0('0x6d')])['then'](function(){if(_[_0x02f0('0xe4')](_0x44b519[_0x02f0('0x49')][_0x02f0('0x6d')])){for(var _0x1faf96=0x0;_0x1faf96<_0x44b519[_0x02f0('0x49')]['ids'][_0x02f0('0x4f')];_0x1faf96+=0x1){socket[_0x02f0('0xe2')](_0x02f0('0xe5'),{'UserId':Number(_0x44b519[_0x02f0('0x49')][_0x02f0('0x6d')][_0x1faf96]),'SmsAccountId':Number(_0x44b519[_0x02f0('0x58')]['id'])});}}else{socket[_0x02f0('0xe2')](_0x02f0('0xe5'),{'UserId':Number(_0x44b519[_0x02f0('0x49')]['ids']),'SmsAccountId':Number(_0x44b519['params']['id'])});}});}})['then'](respondWithStatusCode(_0x564b28,null))[_0x02f0('0x2c')](handleError(_0x564b28,null));};exports[_0x02f0('0xe6')]=function(_0x1a0b7b,_0x5f4b16,_0x23f79c){var _0x2612ba={};var _0x367a7d={};var _0x420577;var _0xb86407;return db[_0x02f0('0x44')][_0x02f0('0x67')]({'where':{'id':_0x1a0b7b['params']['id']}})[_0x02f0('0x21')](handleEntityNotFound(_0x5f4b16,null))[_0x02f0('0x21')](function(_0x1d8297){if(_0x1d8297){_0x420577=_0x1d8297;_0x367a7d[_0x02f0('0x48')]=_[_0x02f0('0x4a')](db[_0x02f0('0xad')][_0x02f0('0x45')]);_0x367a7d[_0x02f0('0x49')]=_[_0x02f0('0x4a')](_0x1a0b7b[_0x02f0('0x49')]);_0x367a7d['filters']=_['intersection'](_0x367a7d['model'],_0x367a7d[_0x02f0('0x49')]);_0x2612ba[_0x02f0('0x4d')]=_[_0x02f0('0x4c')](_0x367a7d[_0x02f0('0x48')],qs[_0x02f0('0x4e')](_0x1a0b7b['query']['fields']));_0x2612ba[_0x02f0('0x4d')]=_0x2612ba[_0x02f0('0x4d')][_0x02f0('0x4f')]?_0x2612ba['attributes']:_0x367a7d['model'];_0x2612ba['order']=qs[_0x02f0('0x69')](_0x1a0b7b[_0x02f0('0x49')][_0x02f0('0x69')]);_0x2612ba[_0x02f0('0x51')]=qs['filters'](_[_0x02f0('0x6a')](_0x1a0b7b['query'],_0x367a7d[_0x02f0('0x4b')]));if(_0x1a0b7b[_0x02f0('0x49')][_0x02f0('0x52')]){_0x2612ba[_0x02f0('0x51')]=_[_0x02f0('0x53')](_0x2612ba['where'],{'$or':_[_0x02f0('0x43')](_0x2612ba[_0x02f0('0x4d')],function(_0x3f85ca){var _0x42e139={};_0x42e139[_0x3f85ca]={'$like':'%'+_0x1a0b7b[_0x02f0('0x49')][_0x02f0('0x52')]+'%'};return _0x42e139;})});}_0x2612ba=_[_0x02f0('0x53')]({},_0x2612ba,_0x1a0b7b[_0x02f0('0x5a')]);return _0x420577[_0x02f0('0xe6')](_0x2612ba);}})[_0x02f0('0x21')](function(_0xf4b8c){if(_0xf4b8c){_0xb86407=_0xf4b8c[_0x02f0('0x4f')];if(!_0x1a0b7b[_0x02f0('0x49')][_0x02f0('0x70')](_0x02f0('0x50'))){_0x2612ba[_0x02f0('0x32')]=qs[_0x02f0('0x32')](_0x1a0b7b[_0x02f0('0x49')][_0x02f0('0x32')]);_0x2612ba[_0x02f0('0x30')]=qs[_0x02f0('0x30')](_0x1a0b7b['query'][_0x02f0('0x30')]);}return _0x420577[_0x02f0('0xe6')](_0x2612ba);}})[_0x02f0('0x21')](function(_0x477c92){if(_0x477c92){return _0x477c92?{'count':_0xb86407,'rows':_0x477c92}:null;}})['then'](respondWithResult(_0x5f4b16,null))[_0x02f0('0x2c')](handleError(_0x5f4b16,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 520ff7e..37f2cb8 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 _0x2edb=['hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount','setMaxListeners','save','remove','emit'];(function(_0x1f2104,_0x3d1a56){var _0x590031=function(_0x16e37d){while(--_0x16e37d){_0x1f2104['push'](_0x1f2104['shift']());}};_0x590031(++_0x3d1a56);}(_0x2edb,0x1c5));var _0xb2ed=function(_0xb64e9e,_0x519fb2){_0xb64e9e=_0xb64e9e-0x0;var _0x1c63f4=_0x2edb[_0xb64e9e];return _0x1c63f4;};'use strict';var EventEmitter=require(_0xb2ed('0x0'));var SmsAccount=require(_0xb2ed('0x1'))['db'][_0xb2ed('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xb2ed('0x3')](0x0);var events={'afterCreate':_0xb2ed('0x4'),'afterUpdate':'update','afterDestroy':_0xb2ed('0x5')};function emitEvent(_0xa8efbe){return function(_0x127e31,_0x50e6ef,_0x3e2af2){SmsAccountEvents['emit'](_0xa8efbe+':'+_0x127e31['id'],_0x127e31);SmsAccountEvents[_0xb2ed('0x6')](_0xa8efbe,_0x127e31);_0x3e2af2(null);};}for(var e in events){if(events[_0xb2ed('0x7')](e)){var event=events[e];SmsAccount[_0xb2ed('0x8')](e,emitEvent(event));}}module[_0xb2ed('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0x32b4=['hook','events','../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x166027,_0x16c5e7){var _0x43fa9e=function(_0x19d0f8){while(--_0x19d0f8){_0x166027['push'](_0x166027['shift']());}};_0x43fa9e(++_0x16c5e7);}(_0x32b4,0x141));var _0x432b=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x32b4[_0x2d7f0e];return _0x110b07;};'use strict';var EventEmitter=require(_0x432b('0x0'));var SmsAccount=require(_0x432b('0x1'))['db'][_0x432b('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x432b('0x3')](0x0);var events={'afterCreate':_0x432b('0x4'),'afterUpdate':_0x432b('0x5'),'afterDestroy':_0x432b('0x6')};function emitEvent(_0xe8cdc2){return function(_0xf81145,_0x567a71,_0x2efe52){SmsAccountEvents[_0x432b('0x7')](_0xe8cdc2+':'+_0xf81145['id'],_0xf81145);SmsAccountEvents['emit'](_0xe8cdc2,_0xf81145);_0x2efe52(null);};}for(var e in events){if(events[_0x432b('0x8')](e)){var event=events[e];SmsAccount[_0x432b('0x9')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 42b0ba2..82bd492 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 _0x30e7=['exports','sms_accounts','util','api','bluebird','request-promise','path','./smsAccount.attributes'];(function(_0xf1c384,_0xb11b24){var _0x3542cd=function(_0x1d4aba){while(--_0x1d4aba){_0xf1c384['push'](_0xf1c384['shift']());}};_0x3542cd(++_0xb11b24);}(_0x30e7,0x1a2));var _0x730e=function(_0x599c32,_0x4a26b1){_0x599c32=_0x599c32-0x0;var _0x22ed59=_0x30e7[_0x599c32];return _0x22ed59;};'use strict';var _=require('lodash');var util=require(_0x730e('0x0'));var logger=require('../../config/logger')(_0x730e('0x1'));var moment=require('moment');var BPromise=require(_0x730e('0x2'));var rp=require(_0x730e('0x3'));var fs=require('fs');var path=require(_0x730e('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x730e('0x5'));module[_0x730e('0x6')]=function(_0x29498f,_0x3f072c){return _0x29498f['define']('SmsAccount',attributes,{'tableName':_0x730e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b4a=['sms_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsAccount'];(function(_0x1030ce,_0xbe3f74){var _0x3367fd=function(_0x387153){while(--_0x387153){_0x1030ce['push'](_0x1030ce['shift']());}};_0x3367fd(++_0xbe3f74);}(_0x2b4a,0x1ae));var _0xa2b4=function(_0x4ab3fb,_0x776775){_0x4ab3fb=_0x4ab3fb-0x0;var _0x34fe1e=_0x2b4a[_0x4ab3fb];return _0x34fe1e;};'use strict';var _=require(_0xa2b4('0x0'));var util=require(_0xa2b4('0x1'));var logger=require(_0xa2b4('0x2'))(_0xa2b4('0x3'));var moment=require('moment');var BPromise=require(_0xa2b4('0x4'));var rp=require(_0xa2b4('0x5'));var fs=require('fs');var path=require(_0xa2b4('0x6'));var rimraf=require(_0xa2b4('0x7'));var config=require(_0xa2b4('0x8'));var attributes=require('./smsAccount.attributes');module[_0xa2b4('0x9')]=function(_0x55828e,_0x2c0028){return _0x55828e[_0xa2b4('0xa')](_0xa2b4('0xb'),attributes,{'tableName':_0xa2b4('0xc'),'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 a68c797..1c9e969 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 _0x4fa9=['stringify','error','code','message','result','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','model','map','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','./smsAccount.socket','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s'];(function(_0xd5246e,_0x90d9d2){var _0x57397d=function(_0x3268f3){while(--_0x3268f3){_0xd5246e['push'](_0xd5246e['shift']());}};_0x57397d(++_0x90d9d2);}(_0x4fa9,0x1eb));var _0x94fa=function(_0x3a5704,_0x45964f){_0x3a5704=_0x3a5704-0x0;var _0x3f34df=_0x4fa9[_0x3a5704];return _0x3f34df;};'use strict';var _=require(_0x94fa('0x0'));var util=require(_0x94fa('0x1'));var moment=require('moment');var BPromise=require(_0x94fa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x94fa('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x94fa('0x4'));var logger=require(_0x94fa('0x5'))('rpc');var config=require(_0x94fa('0x6'));var jayson=require(_0x94fa('0x7'));var client=jayson[_0x94fa('0x8')][_0x94fa('0x9')]({'port':0x232a});config[_0x94fa('0xa')]=_['defaults'](config['redis'],{'host':_0x94fa('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x94fa('0xa')]));require(_0x94fa('0xc'))['register'](socket);function respondWithRpcPromise(_0x2addef,_0x28d86c,_0x1d23a7){return new BPromise(function(_0x38e458,_0x43c7e8){return client[_0x94fa('0xd')](_0x2addef,_0x1d23a7)[_0x94fa('0xe')](function(_0x3ea630){logger[_0x94fa('0xf')](_0x94fa('0x10'),_0x28d86c,_0x94fa('0x11'));logger['debug'](_0x94fa('0x12'),_0x28d86c,_0x94fa('0x11'),JSON[_0x94fa('0x13')](_0x3ea630));if(_0x3ea630[_0x94fa('0x14')]){if(_0x3ea630['error'][_0x94fa('0x15')]===0x1f4){logger[_0x94fa('0x14')]('SmsAccount,\x20%s,\x20%s',_0x28d86c,_0x3ea630[_0x94fa('0x14')][_0x94fa('0x16')]);return _0x43c7e8(_0x3ea630[_0x94fa('0x14')][_0x94fa('0x16')]);}logger[_0x94fa('0x14')](_0x94fa('0x10'),_0x28d86c,_0x3ea630[_0x94fa('0x14')][_0x94fa('0x16')]);return _0x38e458(_0x3ea630[_0x94fa('0x14')][_0x94fa('0x16')]);}else{logger[_0x94fa('0xf')](_0x94fa('0x10'),_0x28d86c,_0x94fa('0x11'));_0x38e458(_0x3ea630[_0x94fa('0x17')][_0x94fa('0x16')]);}})['catch'](function(_0x5c06d6){logger['error'](_0x94fa('0x10'),_0x28d86c,_0x5c06d6);_0x43c7e8(_0x5c06d6);});});}exports[_0x94fa('0x18')]=function(_0x501e63){var _0x24fcdb=this;return new Promise(function(_0x63e2d0,_0x106697){return db[_0x94fa('0x19')][_0x94fa('0x1a')]({'raw':_0x501e63[_0x94fa('0x1b')]?_0x501e63['options'][_0x94fa('0x1c')]===undefined?!![]:![]:!![],'where':_0x501e63[_0x94fa('0x1b')]?_0x501e63[_0x94fa('0x1b')][_0x94fa('0x1d')]||null:null,'attributes':_0x501e63[_0x94fa('0x1b')]?_0x501e63[_0x94fa('0x1b')][_0x94fa('0x1e')]||null:null,'include':_0x501e63[_0x94fa('0x1b')]?_0x501e63[_0x94fa('0x1b')][_0x94fa('0x1f')]?_['map'](_0x501e63[_0x94fa('0x1b')][_0x94fa('0x1f')],function(_0x284e6b){return{'model':db[_0x284e6b[_0x94fa('0x20')]],'as':_0x284e6b['as'],'attributes':_0x284e6b['attributes'],'include':_0x284e6b[_0x94fa('0x1f')]?_[_0x94fa('0x21')](_0x284e6b[_0x94fa('0x1f')],function(_0x2d4fec){return{'model':db[_0x2d4fec[_0x94fa('0x20')]],'as':_0x2d4fec['as'],'attributes':_0x2d4fec[_0x94fa('0x1e')],'include':_0x2d4fec['include']?_[_0x94fa('0x21')](_0x2d4fec['include'],function(_0xf9621a){return{'model':db[_0xf9621a[_0x94fa('0x20')]],'as':_0xf9621a['as'],'attributes':_0xf9621a[_0x94fa('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x94fa('0xe')](function(_0x364df7){logger[_0x94fa('0xf')](_0x94fa('0x18'),_0x501e63);logger['debug']('ShowSmsAccount',_0x501e63,JSON[_0x94fa('0x13')](_0x364df7));_0x63e2d0(_0x364df7);})['catch'](function(_0x4d5670){logger[_0x94fa('0x14')](_0x94fa('0x18'),_0x4d5670[_0x94fa('0x16')],_0x501e63);_0x106697(_0x24fcdb[_0x94fa('0x14')](0x1f4,_0x4d5670['message']));});});}; \ No newline at end of file +var _0xe03c=['debug','stringify','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','then','info','SmsAccount,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowSmsAccount','SmsAccount','options','raw','attributes','map','include','model'];(function(_0x84d6e4,_0x5d60ef){var _0x206733=function(_0x2c6b7c){while(--_0x2c6b7c){_0x84d6e4['push'](_0x84d6e4['shift']());}};_0x206733(++_0x5d60ef);}(_0xe03c,0x122));var _0xce03=function(_0x8b3778,_0x4453db){_0x8b3778=_0x8b3778-0x0;var _0x53bdc8=_0xe03c[_0x8b3778];return _0x53bdc8;};'use strict';var _=require(_0xce03('0x0'));var util=require('util');var moment=require(_0xce03('0x1'));var BPromise=require(_0xce03('0x2'));var rs=require(_0xce03('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xce03('0x4'));var logger=require('../../config/logger')(_0xce03('0x5'));var config=require(_0xce03('0x6'));var jayson=require(_0xce03('0x7'));var client=jayson[_0xce03('0x8')][_0xce03('0x9')]({'port':0x232a});config[_0xce03('0xa')]=_[_0xce03('0xb')](config[_0xce03('0xa')],{'host':_0xce03('0xc'),'port':0x18eb});var socket=require(_0xce03('0xd'))(new Redis(config['redis']));require(_0xce03('0xe'))[_0xce03('0xf')](socket);function respondWithRpcPromise(_0x521fb7,_0x5088cb,_0x4f2597){return new BPromise(function(_0x18b76b,_0x279cce){return client['request'](_0x521fb7,_0x4f2597)[_0xce03('0x10')](function(_0x3bdf71){logger[_0xce03('0x11')](_0xce03('0x12'),_0x5088cb,'request\x20sent');logger['debug'](_0xce03('0x13'),_0x5088cb,_0xce03('0x14'),JSON['stringify'](_0x3bdf71));if(_0x3bdf71[_0xce03('0x15')]){if(_0x3bdf71[_0xce03('0x15')][_0xce03('0x16')]===0x1f4){logger['error'](_0xce03('0x12'),_0x5088cb,_0x3bdf71[_0xce03('0x15')]['message']);return _0x279cce(_0x3bdf71[_0xce03('0x15')][_0xce03('0x17')]);}logger[_0xce03('0x15')](_0xce03('0x12'),_0x5088cb,_0x3bdf71[_0xce03('0x15')][_0xce03('0x17')]);return _0x18b76b(_0x3bdf71['error'][_0xce03('0x17')]);}else{logger[_0xce03('0x11')](_0xce03('0x12'),_0x5088cb,_0xce03('0x14'));_0x18b76b(_0x3bdf71[_0xce03('0x18')][_0xce03('0x17')]);}})[_0xce03('0x19')](function(_0x575014){logger[_0xce03('0x15')](_0xce03('0x12'),_0x5088cb,_0x575014);_0x279cce(_0x575014);});});}exports[_0xce03('0x1a')]=function(_0x4105d5){var _0x1e7966=this;return new Promise(function(_0x4fabab,_0x25800e){return db[_0xce03('0x1b')]['find']({'raw':_0x4105d5[_0xce03('0x1c')]?_0x4105d5[_0xce03('0x1c')][_0xce03('0x1d')]===undefined?!![]:![]:!![],'where':_0x4105d5['options']?_0x4105d5[_0xce03('0x1c')]['where']||null:null,'attributes':_0x4105d5[_0xce03('0x1c')]?_0x4105d5[_0xce03('0x1c')][_0xce03('0x1e')]||null:null,'include':_0x4105d5['options']?_0x4105d5[_0xce03('0x1c')]['include']?_[_0xce03('0x1f')](_0x4105d5[_0xce03('0x1c')][_0xce03('0x20')],function(_0x320bc7){return{'model':db[_0x320bc7[_0xce03('0x21')]],'as':_0x320bc7['as'],'attributes':_0x320bc7[_0xce03('0x1e')],'include':_0x320bc7['include']?_[_0xce03('0x1f')](_0x320bc7[_0xce03('0x20')],function(_0x49cfb0){return{'model':db[_0x49cfb0[_0xce03('0x21')]],'as':_0x49cfb0['as'],'attributes':_0x49cfb0['attributes'],'include':_0x49cfb0[_0xce03('0x20')]?_['map'](_0x49cfb0[_0xce03('0x20')],function(_0x4dedb1){return{'model':db[_0x4dedb1[_0xce03('0x21')]],'as':_0x4dedb1['as'],'attributes':_0x4dedb1[_0xce03('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc8fc5){logger[_0xce03('0x11')](_0xce03('0x1a'),_0x4105d5);logger[_0xce03('0x22')](_0xce03('0x1a'),_0x4105d5,JSON[_0xce03('0x23')](_0xc8fc5));_0x4fabab(_0xc8fc5);})['catch'](function(_0x59801f){logger[_0xce03('0x15')]('ShowSmsAccount',_0x59801f[_0xce03('0x17')],_0x4105d5);_0x25800e(_0x1e7966[_0xce03('0x15')](0x1f4,_0x59801f[_0xce03('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 981452a..114cfec 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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 65c4227..5a8f55a 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 _0x55ca=['update','delete','/:id','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','show','create'];(function(_0x29b9c9,_0x2fe4df){var _0x4c6b0f=function(_0x4ff096){while(--_0x4ff096){_0x29b9c9['push'](_0x29b9c9['shift']());}};_0x4c6b0f(++_0x2fe4df);}(_0x55ca,0x126));var _0xa55c=function(_0x3be7ff,_0x12e714){_0x3be7ff=_0x3be7ff-0x0;var _0x186721=_0x55ca[_0x3be7ff];return _0x186721;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['post']('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0xb')]);router['put']('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);module[_0xa55c('0x10')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_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('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/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index d3085df..22d799a 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 _0xc5ea=['STRING','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x221604,_0x598a3f){var _0x38aa4b=function(_0xb5b460){while(--_0xb5b460){_0x221604['push'](_0x221604['shift']());}};_0x38aa4b(++_0x598a3f);}(_0xc5ea,0x16b));var _0xac5e=function(_0x918732,_0x1abae3){_0x918732=_0x918732-0x0;var _0x246a9a=_0xc5ea[_0x918732];return _0x246a9a;};'use strict';var Sequelize=require(_0xac5e('0x0'));module[_0xac5e('0x1')]={'priority':{'type':Sequelize[_0xac5e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xac5e('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xac5e('0x4')]()},'description':{'type':Sequelize[_0xac5e('0x3')]},'interval':{'type':Sequelize[_0xac5e('0x3')],'defaultValue':_0xac5e('0x5')}}; \ No newline at end of file +var _0x8ebb=['noop','TEXT','STRING','*,*,*,*','sequelize','INTEGER'];(function(_0x53cfb9,_0x10bfb6){var _0x5072c7=function(_0x2120d7){while(--_0x2120d7){_0x53cfb9['push'](_0x53cfb9['shift']());}};_0x5072c7(++_0x10bfb6);}(_0x8ebb,0x76));var _0xb8eb=function(_0x1aee95,_0x57b0fa){_0x1aee95=_0x1aee95-0x0;var _0x586bcf=_0x8ebb[_0x1aee95];return _0x586bcf;};'use strict';var Sequelize=require(_0xb8eb('0x0'));module['exports']={'priority':{'type':Sequelize[_0xb8eb('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb8eb('0x2')},'appdata':{'type':Sequelize[_0xb8eb('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xb8eb('0x4')],'defaultValue':_0xb8eb('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 4cc6678..30c0fa3 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 _0x9070=['limit','apply','reject','then','destroy','error','stack','name','send','map','SmsApplication','rawAttributes','fieldName','type','model','query','filters','fields','attributes','length','nolimit','offset','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','keys','intersection','find','create','body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','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','sendStatus','end','status','json','undefined','count'];(function(_0x12aaee,_0x5bf50c){var _0x37c350=function(_0x182775){while(--_0x182775){_0x12aaee['push'](_0x12aaee['shift']());}};_0x37c350(++_0x5bf50c);}(_0x9070,0x18b));var _0x0907=function(_0x14490c,_0x50e8ab){_0x14490c=_0x14490c-0x0;var _0x2f6825=_0x9070[_0x14490c];return _0x2f6825;};'use strict';var emlformat=require(_0x0907('0x0'));var rimraf=require(_0x0907('0x1'));var zipdir=require(_0x0907('0x2'));var jsonpatch=require(_0x0907('0x3'));var rp=require(_0x0907('0x4'));var moment=require('moment');var BPromise=require(_0x0907('0x5'));var Mustache=require(_0x0907('0x6'));var util=require(_0x0907('0x7'));var path=require(_0x0907('0x8'));var sox=require('sox');var csv=require(_0x0907('0x9'));var ejs=require(_0x0907('0xa'));var fs=require('fs');var fs_extra=require(_0x0907('0xb'));var _=require('lodash');var squel=require(_0x0907('0xc'));var crypto=require(_0x0907('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0907('0xe'));var toCsv=require(_0x0907('0x9'));var querystring=require(_0x0907('0xf'));var Papa=require(_0x0907('0x10'));var Redis=require(_0x0907('0x11'));var authService=require(_0x0907('0x12'));var qs=require(_0x0907('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0907('0x14'));var logger=require(_0x0907('0x15'))(_0x0907('0x16'));var utils=require(_0x0907('0x17'));var config=require(_0x0907('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25f7e1,_0x527aa8){_0x527aa8=_0x527aa8||0xcc;return function(_0x13db9b){if(_0x13db9b){return _0x25f7e1[_0x0907('0x19')](_0x527aa8);}return _0x25f7e1['status'](_0x527aa8)[_0x0907('0x1a')]();};}function respondWithResult(_0x31c917,_0x5ebb20){_0x5ebb20=_0x5ebb20||0xc8;return function(_0x5179d4){if(_0x5179d4){return _0x31c917[_0x0907('0x1b')](_0x5ebb20)[_0x0907('0x1c')](_0x5179d4);}};}function respondWithFilteredResult(_0x4b4bf4,_0x43d554){return function(_0x5cc5c){if(_0x5cc5c){var _0x577f30=typeof _0x43d554['offset']===_0x0907('0x1d')&&typeof _0x43d554['limit']===_0x0907('0x1d');var _0x2bd2c0=_0x5cc5c[_0x0907('0x1e')];var _0x3f21b9=_0x577f30?0x0:_0x43d554['offset'];var _0x385f9c=_0x577f30?_0x5cc5c[_0x0907('0x1e')]:_0x43d554['offset']+_0x43d554[_0x0907('0x1f')];var _0x5f33ac;if(_0x385f9c>=_0x2bd2c0){_0x385f9c=_0x2bd2c0;_0x5f33ac=0xc8;}else{_0x5f33ac=0xce;}_0x4b4bf4[_0x0907('0x1b')](_0x5f33ac);return _0x4b4bf4['set']('Content-Range',_0x3f21b9+'-'+_0x385f9c+'/'+_0x2bd2c0)[_0x0907('0x1c')](_0x5cc5c);}return null;};}function patchUpdates(_0x151106){return function(_0x467f4f){try{jsonpatch[_0x0907('0x20')](_0x467f4f,_0x151106,!![]);}catch(_0x17ebe7){return BPromise[_0x0907('0x21')](_0x17ebe7);}return _0x467f4f['save']();};}function saveUpdates(_0x474a49,_0x5d51a9){return function(_0x128e7e){if(_0x128e7e){return _0x128e7e['update'](_0x474a49)[_0x0907('0x22')](function(_0x1459e2){return _0x1459e2;});}return null;};}function removeEntity(_0x416897,_0x74615c){return function(_0x328918){if(_0x328918){return _0x328918[_0x0907('0x23')]()[_0x0907('0x22')](function(){_0x416897[_0x0907('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x174f26,_0x13199b){return function(_0x2cb958){if(!_0x2cb958){_0x174f26['sendStatus'](0x194);}return _0x2cb958;};}function handleError(_0x2597a8,_0x13ce07){_0x13ce07=_0x13ce07||0x1f4;return function(_0x51f957){logger[_0x0907('0x24')](_0x51f957[_0x0907('0x25')]);if(_0x51f957[_0x0907('0x26')]){delete _0x51f957['name'];}_0x2597a8[_0x0907('0x1b')](_0x13ce07)[_0x0907('0x27')](_0x51f957);};}exports['index']=function(_0x160000,_0x57f10e){var _0x3bf050={},_0x2df529={},_0x15e526={'count':0x0,'rows':[]};var _0x44bcdd=_[_0x0907('0x28')](db[_0x0907('0x29')][_0x0907('0x2a')],function(_0x12d07e){return{'name':_0x12d07e[_0x0907('0x2b')],'type':_0x12d07e[_0x0907('0x2c')]['key']};});_0x2df529[_0x0907('0x2d')]=_[_0x0907('0x28')](_0x44bcdd,_0x0907('0x26'));_0x2df529[_0x0907('0x2e')]=_['keys'](_0x160000['query']);_0x2df529[_0x0907('0x2f')]=_['intersection'](_0x2df529['model'],_0x2df529[_0x0907('0x2e')]);_0x3bf050['attributes']=_['intersection'](_0x2df529[_0x0907('0x2d')],qs[_0x0907('0x30')](_0x160000[_0x0907('0x2e')][_0x0907('0x30')]));_0x3bf050[_0x0907('0x31')]=_0x3bf050[_0x0907('0x31')][_0x0907('0x32')]?_0x3bf050['attributes']:_0x2df529['model'];if(!_0x160000[_0x0907('0x2e')]['hasOwnProperty'](_0x0907('0x33'))){_0x3bf050['limit']=qs[_0x0907('0x1f')](_0x160000[_0x0907('0x2e')][_0x0907('0x1f')]);_0x3bf050[_0x0907('0x34')]=qs[_0x0907('0x34')](_0x160000[_0x0907('0x2e')][_0x0907('0x34')]);}_0x3bf050[_0x0907('0x35')]=qs[_0x0907('0x36')](_0x160000['query'][_0x0907('0x36')]);_0x3bf050[_0x0907('0x37')]=qs[_0x0907('0x2f')](_['pick'](_0x160000[_0x0907('0x2e')],_0x2df529['filters']),_0x44bcdd);if(_0x160000[_0x0907('0x2e')][_0x0907('0x38')]){_0x3bf050[_0x0907('0x37')]=_[_0x0907('0x39')](_0x3bf050[_0x0907('0x37')],{'$or':_[_0x0907('0x28')](_0x44bcdd,function(_0x2e1b0d){if(_0x2e1b0d[_0x0907('0x2c')]!==_0x0907('0x3a')){var _0x1dcf19={};_0x1dcf19[_0x2e1b0d[_0x0907('0x26')]]={'$like':'%'+_0x160000[_0x0907('0x2e')]['filter']+'%'};return _0x1dcf19;}})});}_0x3bf050=_[_0x0907('0x39')]({},_0x3bf050,_0x160000[_0x0907('0x3b')]);var _0x2ed923={'where':_0x3bf050[_0x0907('0x37')]};return db[_0x0907('0x29')][_0x0907('0x1e')](_0x2ed923)['then'](function(_0x498e18){_0x15e526[_0x0907('0x1e')]=_0x498e18;if(_0x160000[_0x0907('0x2e')][_0x0907('0x3c')]){_0x3bf050[_0x0907('0x3d')]=[{'all':!![]}];}return db['SmsApplication']['findAll'](_0x3bf050);})['then'](function(_0x56bd81){_0x15e526[_0x0907('0x3e')]=_0x56bd81;return _0x15e526;})[_0x0907('0x22')](respondWithFilteredResult(_0x57f10e,_0x3bf050))[_0x0907('0x3f')](handleError(_0x57f10e,null));};exports['show']=function(_0x58d329,_0x428053){var _0x2ee9d8={'raw':!![],'where':{'id':_0x58d329['params']['id']}},_0xcfc4={};_0xcfc4[_0x0907('0x2d')]=_[_0x0907('0x40')](db[_0x0907('0x29')][_0x0907('0x2a')]);_0xcfc4['query']=_[_0x0907('0x40')](_0x58d329[_0x0907('0x2e')]);_0xcfc4[_0x0907('0x2f')]=_[_0x0907('0x41')](_0xcfc4['model'],_0xcfc4['query']);_0x2ee9d8[_0x0907('0x31')]=_['intersection'](_0xcfc4[_0x0907('0x2d')],qs[_0x0907('0x30')](_0x58d329[_0x0907('0x2e')][_0x0907('0x30')]));_0x2ee9d8[_0x0907('0x31')]=_0x2ee9d8[_0x0907('0x31')][_0x0907('0x32')]?_0x2ee9d8[_0x0907('0x31')]:_0xcfc4[_0x0907('0x2d')];if(_0x58d329[_0x0907('0x2e')][_0x0907('0x3c')]){_0x2ee9d8['include']=[{'all':!![]}];}_0x2ee9d8=_['merge']({},_0x2ee9d8,_0x58d329[_0x0907('0x3b')]);return db[_0x0907('0x29')][_0x0907('0x42')](_0x2ee9d8)[_0x0907('0x22')](handleEntityNotFound(_0x428053,null))['then'](respondWithResult(_0x428053,null))[_0x0907('0x3f')](handleError(_0x428053,null));};exports[_0x0907('0x43')]=function(_0x3d3b1d,_0x4db6e6){return db[_0x0907('0x29')][_0x0907('0x43')](_0x3d3b1d[_0x0907('0x44')],{})[_0x0907('0x22')](respondWithResult(_0x4db6e6,0xc9))[_0x0907('0x3f')](handleError(_0x4db6e6,null));};exports[_0x0907('0x45')]=function(_0x25a24c,_0x5b67a4){if(_0x25a24c[_0x0907('0x44')]['id']){delete _0x25a24c['body']['id'];}return db['SmsApplication'][_0x0907('0x42')]({'where':{'id':_0x25a24c[_0x0907('0x46')]['id']}})[_0x0907('0x22')](handleEntityNotFound(_0x5b67a4,null))[_0x0907('0x22')](saveUpdates(_0x25a24c['body'],null))[_0x0907('0x22')](respondWithResult(_0x5b67a4,null))[_0x0907('0x3f')](handleError(_0x5b67a4,null));};exports[_0x0907('0x23')]=function(_0x6d7cdb,_0xbbd26){return db[_0x0907('0x29')][_0x0907('0x42')]({'where':{'id':_0x6d7cdb[_0x0907('0x46')]['id']}})[_0x0907('0x22')](handleEntityNotFound(_0xbbd26,null))[_0x0907('0x22')](removeEntity(_0xbbd26,null))[_0x0907('0x3f')](handleError(_0xbbd26,null));}; \ No newline at end of file +var _0x9541=['json','offset','undefined','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','sort','where','merge','type','options','includeAll','include','rows','catch','show','length','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x49c049,_0x4bcc9c){var _0x38d57c=function(_0xe859b9){while(--_0xe859b9){_0x49c049['push'](_0x49c049['shift']());}};_0x38d57c(++_0x4bcc9c);}(_0x9541,0x14d));var _0x1954=function(_0x10c9fa,_0x2c6859){_0x10c9fa=_0x10c9fa-0x0;var _0x4e4f5b=_0x9541[_0x10c9fa];return _0x4e4f5b;};'use strict';var emlformat=require(_0x1954('0x0'));var rimraf=require(_0x1954('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1954('0x2'));var rp=require(_0x1954('0x3'));var moment=require(_0x1954('0x4'));var BPromise=require(_0x1954('0x5'));var Mustache=require(_0x1954('0x6'));var util=require(_0x1954('0x7'));var path=require(_0x1954('0x8'));var sox=require(_0x1954('0x9'));var csv=require(_0x1954('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1954('0xb'));var _=require(_0x1954('0xc'));var squel=require(_0x1954('0xd'));var crypto=require(_0x1954('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1954('0xa'));var querystring=require(_0x1954('0xf'));var Papa=require(_0x1954('0x10'));var Redis=require('ioredis');var authService=require(_0x1954('0x11'));var qs=require(_0x1954('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1954('0x13'))(_0x1954('0x14'));var utils=require('../../config/utils');var config=require(_0x1954('0x15'));var licenseUtil=require(_0x1954('0x16'));var db=require(_0x1954('0x17'))['db'];function respondWithStatusCode(_0x3cd67d,_0x3eae9a){_0x3eae9a=_0x3eae9a||0xcc;return function(_0x13d7d5){if(_0x13d7d5){return _0x3cd67d[_0x1954('0x18')](_0x3eae9a);}return _0x3cd67d[_0x1954('0x19')](_0x3eae9a)[_0x1954('0x1a')]();};}function respondWithResult(_0x12c41a,_0x5ba060){_0x5ba060=_0x5ba060||0xc8;return function(_0x38953d){if(_0x38953d){return _0x12c41a['status'](_0x5ba060)[_0x1954('0x1b')](_0x38953d);}};}function respondWithFilteredResult(_0x163432,_0x54f374){return function(_0x4842c7){if(_0x4842c7){var _0x17e4c6=typeof _0x54f374[_0x1954('0x1c')]==='undefined'&&typeof _0x54f374['limit']===_0x1954('0x1d');var _0x443787=_0x4842c7[_0x1954('0x1e')];var _0x22ee93=_0x17e4c6?0x0:_0x54f374['offset'];var _0x350fcd=_0x17e4c6?_0x4842c7['count']:_0x54f374[_0x1954('0x1c')]+_0x54f374['limit'];var _0xd09cda;if(_0x350fcd>=_0x443787){_0x350fcd=_0x443787;_0xd09cda=0xc8;}else{_0xd09cda=0xce;}_0x163432[_0x1954('0x19')](_0xd09cda);return _0x163432[_0x1954('0x1f')]('Content-Range',_0x22ee93+'-'+_0x350fcd+'/'+_0x443787)['json'](_0x4842c7);}return null;};}function patchUpdates(_0x3c7f8f){return function(_0x2fca3b){try{jsonpatch[_0x1954('0x20')](_0x2fca3b,_0x3c7f8f,!![]);}catch(_0x5e12c7){return BPromise[_0x1954('0x21')](_0x5e12c7);}return _0x2fca3b[_0x1954('0x22')]();};}function saveUpdates(_0xfeca7,_0x2030cd){return function(_0x448b4f){if(_0x448b4f){return _0x448b4f[_0x1954('0x23')](_0xfeca7)[_0x1954('0x24')](function(_0x2f0a81){return _0x2f0a81;});}return null;};}function removeEntity(_0x381fe5,_0x36a16b){return function(_0x48851e){if(_0x48851e){return _0x48851e[_0x1954('0x25')]()[_0x1954('0x24')](function(){_0x381fe5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ec94d,_0x88fe62){return function(_0x5718ae){if(!_0x5718ae){_0x2ec94d[_0x1954('0x18')](0x194);}return _0x5718ae;};}function handleError(_0x576c31,_0x1284b4){_0x1284b4=_0x1284b4||0x1f4;return function(_0x2783ce){logger[_0x1954('0x26')](_0x2783ce[_0x1954('0x27')]);if(_0x2783ce[_0x1954('0x28')]){delete _0x2783ce[_0x1954('0x28')];}_0x576c31['status'](_0x1284b4)[_0x1954('0x29')](_0x2783ce);};}exports[_0x1954('0x2a')]=function(_0x121ce9,_0x2f5a2d){var _0xe23684={},_0x64e472={},_0x469e23={'count':0x0,'rows':[]};var _0x58939d=_[_0x1954('0x2b')](db[_0x1954('0x2c')][_0x1954('0x2d')],function(_0x4242aa){return{'name':_0x4242aa[_0x1954('0x2e')],'type':_0x4242aa['type'][_0x1954('0x2f')]};});_0x64e472[_0x1954('0x30')]=_[_0x1954('0x2b')](_0x58939d,_0x1954('0x28'));_0x64e472[_0x1954('0x31')]=_[_0x1954('0x32')](_0x121ce9[_0x1954('0x31')]);_0x64e472[_0x1954('0x33')]=_[_0x1954('0x34')](_0x64e472[_0x1954('0x30')],_0x64e472['query']);_0xe23684[_0x1954('0x35')]=_['intersection'](_0x64e472[_0x1954('0x30')],qs[_0x1954('0x36')](_0x121ce9[_0x1954('0x31')][_0x1954('0x36')]));_0xe23684[_0x1954('0x35')]=_0xe23684['attributes']['length']?_0xe23684[_0x1954('0x35')]:_0x64e472[_0x1954('0x30')];if(!_0x121ce9[_0x1954('0x31')][_0x1954('0x37')]('nolimit')){_0xe23684[_0x1954('0x38')]=qs[_0x1954('0x38')](_0x121ce9['query']['limit']);_0xe23684[_0x1954('0x1c')]=qs[_0x1954('0x1c')](_0x121ce9[_0x1954('0x31')][_0x1954('0x1c')]);}_0xe23684['order']=qs[_0x1954('0x39')](_0x121ce9['query'][_0x1954('0x39')]);_0xe23684[_0x1954('0x3a')]=qs[_0x1954('0x33')](_['pick'](_0x121ce9['query'],_0x64e472[_0x1954('0x33')]),_0x58939d);if(_0x121ce9[_0x1954('0x31')]['filter']){_0xe23684[_0x1954('0x3a')]=_[_0x1954('0x3b')](_0xe23684[_0x1954('0x3a')],{'$or':_[_0x1954('0x2b')](_0x58939d,function(_0x4d48fb){if(_0x4d48fb[_0x1954('0x3c')]!=='VIRTUAL'){var _0x102532={};_0x102532[_0x4d48fb[_0x1954('0x28')]]={'$like':'%'+_0x121ce9[_0x1954('0x31')]['filter']+'%'};return _0x102532;}})});}_0xe23684=_[_0x1954('0x3b')]({},_0xe23684,_0x121ce9[_0x1954('0x3d')]);var _0x483fc1={'where':_0xe23684['where']};return db[_0x1954('0x2c')][_0x1954('0x1e')](_0x483fc1)['then'](function(_0x2808d4){_0x469e23[_0x1954('0x1e')]=_0x2808d4;if(_0x121ce9[_0x1954('0x31')][_0x1954('0x3e')]){_0xe23684[_0x1954('0x3f')]=[{'all':!![]}];}return db[_0x1954('0x2c')]['findAll'](_0xe23684);})['then'](function(_0x2cb3a5){_0x469e23[_0x1954('0x40')]=_0x2cb3a5;return _0x469e23;})[_0x1954('0x24')](respondWithFilteredResult(_0x2f5a2d,_0xe23684))[_0x1954('0x41')](handleError(_0x2f5a2d,null));};exports[_0x1954('0x42')]=function(_0x39a030,_0x22c8e2){var _0x3a2644={'raw':!![],'where':{'id':_0x39a030['params']['id']}},_0x41b693={};_0x41b693[_0x1954('0x30')]=_[_0x1954('0x32')](db[_0x1954('0x2c')][_0x1954('0x2d')]);_0x41b693['query']=_['keys'](_0x39a030[_0x1954('0x31')]);_0x41b693['filters']=_[_0x1954('0x34')](_0x41b693[_0x1954('0x30')],_0x41b693[_0x1954('0x31')]);_0x3a2644[_0x1954('0x35')]=_[_0x1954('0x34')](_0x41b693[_0x1954('0x30')],qs['fields'](_0x39a030[_0x1954('0x31')][_0x1954('0x36')]));_0x3a2644[_0x1954('0x35')]=_0x3a2644[_0x1954('0x35')][_0x1954('0x43')]?_0x3a2644[_0x1954('0x35')]:_0x41b693[_0x1954('0x30')];if(_0x39a030[_0x1954('0x31')][_0x1954('0x3e')]){_0x3a2644[_0x1954('0x3f')]=[{'all':!![]}];}_0x3a2644=_[_0x1954('0x3b')]({},_0x3a2644,_0x39a030['options']);return db[_0x1954('0x2c')][_0x1954('0x44')](_0x3a2644)[_0x1954('0x24')](handleEntityNotFound(_0x22c8e2,null))[_0x1954('0x24')](respondWithResult(_0x22c8e2,null))[_0x1954('0x41')](handleError(_0x22c8e2,null));};exports[_0x1954('0x45')]=function(_0x10f92a,_0xd4e258){return db[_0x1954('0x2c')][_0x1954('0x45')](_0x10f92a[_0x1954('0x46')],{})[_0x1954('0x24')](respondWithResult(_0xd4e258,0xc9))[_0x1954('0x41')](handleError(_0xd4e258,null));};exports[_0x1954('0x23')]=function(_0xb396f4,_0x38546f){if(_0xb396f4[_0x1954('0x46')]['id']){delete _0xb396f4[_0x1954('0x46')]['id'];}return db[_0x1954('0x2c')][_0x1954('0x44')]({'where':{'id':_0xb396f4['params']['id']}})[_0x1954('0x24')](handleEntityNotFound(_0x38546f,null))[_0x1954('0x24')](saveUpdates(_0xb396f4[_0x1954('0x46')],null))[_0x1954('0x24')](respondWithResult(_0x38546f,null))[_0x1954('0x41')](handleError(_0x38546f,null));};exports[_0x1954('0x25')]=function(_0x1fca00,_0x104f30){return db[_0x1954('0x2c')]['find']({'where':{'id':_0x1fca00[_0x1954('0x47')]['id']}})[_0x1954('0x24')](handleEntityNotFound(_0x104f30,null))[_0x1954('0x24')](removeEntity(_0x104f30,null))['catch'](handleError(_0x104f30,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 66dd7b6..3069704 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 _0x3527=['./smsApplication.attributes','exports','define','sms_applications','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x3b936a,_0x1961be){var _0x594d1e=function(_0x5f09ec){while(--_0x5f09ec){_0x3b936a['push'](_0x3b936a['shift']());}};_0x594d1e(++_0x1961be);}(_0x3527,0x1e9));var _0x7352=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x3527[_0x18ab2a];return _0x16dcee;};'use strict';var _=require(_0x7352('0x0'));var util=require(_0x7352('0x1'));var logger=require(_0x7352('0x2'))('api');var moment=require(_0x7352('0x3'));var BPromise=require(_0x7352('0x4'));var rp=require(_0x7352('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7352('0x6'));module[_0x7352('0x7')]=function(_0x2824ac,_0xc064e6){return _0x2824ac[_0x7352('0x8')]('SmsApplication',attributes,{'tableName':_0x7352('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7352('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8fef=['define','SmsApplication','utf8mb4','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports'];(function(_0x35c0cc,_0x3135d6){var _0x25bee3=function(_0x19ac3c){while(--_0x19ac3c){_0x35c0cc['push'](_0x35c0cc['shift']());}};_0x25bee3(++_0x3135d6);}(_0x8fef,0x1e4));var _0xf8fe=function(_0x592b1f,_0x3aa34f){_0x592b1f=_0x592b1f-0x0;var _0x4950ef=_0x8fef[_0x592b1f];return _0x4950ef;};'use strict';var _=require(_0xf8fe('0x0'));var util=require(_0xf8fe('0x1'));var logger=require(_0xf8fe('0x2'))('api');var moment=require(_0xf8fe('0x3'));var BPromise=require('bluebird');var rp=require(_0xf8fe('0x4'));var fs=require('fs');var path=require(_0xf8fe('0x5'));var rimraf=require(_0xf8fe('0x6'));var config=require(_0xf8fe('0x7'));var attributes=require(_0xf8fe('0x8'));module[_0xf8fe('0x9')]=function(_0x5949fb,_0x9ca0cc){return _0x5949fb[_0xf8fe('0xa')](_0xf8fe('0xb'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf8fe('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 4d3a2af..87b9f34 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 _0xe2ab=['SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','SmsApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','info','request\x20sent','debug'];(function(_0x90e3d5,_0x3eea2b){var _0x5c2252=function(_0x3c7a2e){while(--_0x3c7a2e){_0x90e3d5['push'](_0x90e3d5['shift']());}};_0x5c2252(++_0x3eea2b);}(_0xe2ab,0xc4));var _0xbe2a=function(_0xbc833f,_0x32493d){_0xbc833f=_0xbc833f-0x0;var _0x3edc3b=_0xe2ab[_0xbc833f];return _0x3edc3b;};'use strict';var _=require(_0xbe2a('0x0'));var util=require(_0xbe2a('0x1'));var moment=require(_0xbe2a('0x2'));var BPromise=require(_0xbe2a('0x3'));var rs=require(_0xbe2a('0x4'));var fs=require('fs');var Redis=require(_0xbe2a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe2a('0x6'));var logger=require(_0xbe2a('0x7'))(_0xbe2a('0x8'));var config=require(_0xbe2a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xbe2a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f504b,_0x58b8f1,_0x5a8a5d){return new BPromise(function(_0xfccbff,_0x232194){return client['request'](_0x2f504b,_0x5a8a5d)['then'](function(_0x83d775){logger[_0xbe2a('0xb')]('SmsApplication,\x20%s,\x20%s',_0x58b8f1,_0xbe2a('0xc'));logger[_0xbe2a('0xd')](_0xbe2a('0xe'),_0x58b8f1,_0xbe2a('0xc'),JSON[_0xbe2a('0xf')](_0x83d775));if(_0x83d775['error']){if(_0x83d775['error']['code']===0x1f4){logger[_0xbe2a('0x10')](_0xbe2a('0x11'),_0x58b8f1,_0x83d775[_0xbe2a('0x10')][_0xbe2a('0x12')]);return _0x232194(_0x83d775[_0xbe2a('0x10')]['message']);}logger[_0xbe2a('0x10')](_0xbe2a('0x11'),_0x58b8f1,_0x83d775[_0xbe2a('0x10')]['message']);return _0xfccbff(_0x83d775[_0xbe2a('0x10')][_0xbe2a('0x12')]);}else{logger[_0xbe2a('0xb')](_0xbe2a('0x11'),_0x58b8f1,_0xbe2a('0xc'));_0xfccbff(_0x83d775[_0xbe2a('0x13')][_0xbe2a('0x12')]);}})[_0xbe2a('0x14')](function(_0x4395fe){logger['error'](_0xbe2a('0x11'),_0x58b8f1,_0x4395fe);_0x232194(_0x4395fe);});});} \ No newline at end of file +var _0x8f25=['catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x20409e,_0xbab0e5){var _0x466379=function(_0x928e52){while(--_0x928e52){_0x20409e['push'](_0x20409e['shift']());}};_0x466379(++_0xbab0e5);}(_0x8f25,0x14b));var _0x58f2=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x8f25[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x58f2('0x0'));var util=require(_0x58f2('0x1'));var moment=require(_0x58f2('0x2'));var BPromise=require(_0x58f2('0x3'));var rs=require(_0x58f2('0x4'));var fs=require('fs');var Redis=require(_0x58f2('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x58f2('0x6'));var config=require(_0x58f2('0x7'));var jayson=require(_0x58f2('0x8'));var client=jayson['client'][_0x58f2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26f94f,_0x3d5efe,_0x107b61){return new BPromise(function(_0xf47f9,_0x1209e2){return client[_0x58f2('0xa')](_0x26f94f,_0x107b61)[_0x58f2('0xb')](function(_0x4b56c1){logger[_0x58f2('0xc')](_0x58f2('0xd'),_0x3d5efe,_0x58f2('0xe'));logger[_0x58f2('0xf')](_0x58f2('0x10'),_0x3d5efe,'request\x20sent',JSON[_0x58f2('0x11')](_0x4b56c1));if(_0x4b56c1[_0x58f2('0x12')]){if(_0x4b56c1[_0x58f2('0x12')]['code']===0x1f4){logger[_0x58f2('0x12')](_0x58f2('0xd'),_0x3d5efe,_0x4b56c1['error'][_0x58f2('0x13')]);return _0x1209e2(_0x4b56c1[_0x58f2('0x12')]['message']);}logger[_0x58f2('0x12')](_0x58f2('0xd'),_0x3d5efe,_0x4b56c1[_0x58f2('0x12')][_0x58f2('0x13')]);return _0xf47f9(_0x4b56c1[_0x58f2('0x12')][_0x58f2('0x13')]);}else{logger[_0x58f2('0xc')](_0x58f2('0xd'),_0x3d5efe,_0x58f2('0xe'));_0xf47f9(_0x4b56c1[_0x58f2('0x14')][_0x58f2('0x13')]);}})[_0x58f2('0x15')](function(_0x4af52c){logger[_0x58f2('0x12')]('SmsApplication,\x20%s,\x20%s',_0x3d5efe,_0x4af52c);_0x1209e2(_0x4af52c);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index e27979d..f5f8510 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 _0xdd4f=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','sms','addTags','put','tracked','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','express'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x293ef9,_0x54dc41){_0x293ef9=_0x293ef9-0x0;var _0x42cf0=_0xdd4f[_0x293ef9];return _0x42cf0;};'use strict';var multer=require(_0xfdd4('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfdd4('0x1'));var router=express[_0xfdd4('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xfdd4('0x3'));var interaction=require(_0xfdd4('0x4'));var config=require(_0xfdd4('0x5'));var controller=require('./smsInteraction.controller');router[_0xfdd4('0x6')]('/',auth[_0xfdd4('0x7')](),controller[_0xfdd4('0x8')]);router[_0xfdd4('0x6')](_0xfdd4('0x9'),auth['isAuthenticated'](),controller[_0xfdd4('0xa')]);router['get'](_0xfdd4('0xb'),auth[_0xfdd4('0x7')](),controller[_0xfdd4('0xc')]);router['get'](_0xfdd4('0xd'),auth['isAuthenticated'](),controller[_0xfdd4('0xe')]);router[_0xfdd4('0x6')](_0xfdd4('0xf'),auth[_0xfdd4('0x7')](),controller[_0xfdd4('0x10')]);router[_0xfdd4('0x11')]('/',auth[_0xfdd4('0x7')](),controller[_0xfdd4('0x12')]);router[_0xfdd4('0x11')](_0xfdd4('0xd'),auth[_0xfdd4('0x7')](),controller['addMessage']);router[_0xfdd4('0x11')](_0xfdd4('0x13'),auth[_0xfdd4('0x7')](),interaction['tracked'](_0xfdd4('0x14'),'smsinteraction:addtags'),controller[_0xfdd4('0x15')]);router[_0xfdd4('0x16')](_0xfdd4('0xb'),auth[_0xfdd4('0x7')](),interaction[_0xfdd4('0x17')]('sms','smsinteraction:update'),controller['update']);router[_0xfdd4('0x18')](_0xfdd4('0xb'),auth[_0xfdd4('0x7')](),interaction[_0xfdd4('0x17')](_0xfdd4('0x14'),_0xfdd4('0x19')),controller[_0xfdd4('0x1a')]);router[_0xfdd4('0x18')](_0xfdd4('0x13'),auth['isAuthenticated'](),controller[_0xfdd4('0x1b')]);module[_0xfdd4('0x1c')]=router; \ No newline at end of file +var _0x3266=['isAuthenticated','index','get','/:id','show','getMessages','/:id/download','download','post','create','addMessage','sms','smsinteraction:addtags','addTags','put','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsInteraction.controller'];(function(_0x4b7152,_0x19db55){var _0x17547a=function(_0x5931c1){while(--_0x5931c1){_0x4b7152['push'](_0x4b7152['shift']());}};_0x17547a(++_0x19db55);}(_0x3266,0x6a));var _0x6326=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0x3266[_0x101e7b];return _0x4995c0;};'use strict';var multer=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var path=require(_0x6326('0x2'));var timeout=require(_0x6326('0x3'));var express=require(_0x6326('0x4'));var router=express[_0x6326('0x5')]();var fs_extra=require(_0x6326('0x6'));var auth=require(_0x6326('0x7'));var interaction=require(_0x6326('0x8'));var config=require('../../config/environment');var controller=require(_0x6326('0x9'));router['get']('/',auth[_0x6326('0xa')](),controller[_0x6326('0xb')]);router[_0x6326('0xc')]('/describe',auth[_0x6326('0xa')](),controller['describe']);router[_0x6326('0xc')](_0x6326('0xd'),auth[_0x6326('0xa')](),controller[_0x6326('0xe')]);router[_0x6326('0xc')]('/:id/messages',auth[_0x6326('0xa')](),controller[_0x6326('0xf')]);router[_0x6326('0xc')](_0x6326('0x10'),auth[_0x6326('0xa')](),controller[_0x6326('0x11')]);router[_0x6326('0x12')]('/',auth[_0x6326('0xa')](),controller[_0x6326('0x13')]);router[_0x6326('0x12')]('/:id/messages',auth['isAuthenticated'](),controller[_0x6326('0x14')]);router[_0x6326('0x12')]('/:id/tags',auth[_0x6326('0xa')](),interaction['tracked'](_0x6326('0x15'),_0x6326('0x16')),controller[_0x6326('0x17')]);router[_0x6326('0x18')](_0x6326('0xd'),auth[_0x6326('0xa')](),interaction['tracked'](_0x6326('0x15'),'smsinteraction:update'),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x6326('0x15'),_0x6326('0x19')),controller[_0x6326('0x1a')]);router['delete']('/:id/tags',auth[_0x6326('0xa')](),controller[_0x6326('0x1b')]);module[_0x6326('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index da66d45..0952923 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 _0x11f3=['BOOLEAN','sequelize','moment','exports','DATE','STRING','ENUM','out'];(function(_0x8e3e14,_0x148377){var _0x3eed52=function(_0x40d222){while(--_0x40d222){_0x8e3e14['push'](_0x8e3e14['shift']());}};_0x3eed52(++_0x148377);}(_0x11f3,0x149));var _0x311f=function(_0x3aa12b,_0x1cea89){_0x3aa12b=_0x3aa12b-0x0;var _0x1acb6f=_0x11f3[_0x3aa12b];return _0x1acb6f;};'use strict';var Sequelize=require(_0x311f('0x0'));var moment=require(_0x311f('0x1'));module[_0x311f('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x311f('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x311f('0x4')]},'thirdDisposition':{'type':Sequelize[_0x311f('0x4')]},'note':{'type':Sequelize[_0x311f('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x311f('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x311f('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x311f('0x5')]('in',_0x311f('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x311f('0x7')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x1516=['STRING','out','ENUM','BOOLEAN','INTEGER','sequelize','moment','exports','DATE'];(function(_0x18bf1f,_0x1e7405){var _0x49bde6=function(_0x5521c9){while(--_0x5521c9){_0x18bf1f['push'](_0x18bf1f['shift']());}};_0x49bde6(++_0x1e7405);}(_0x1516,0xb0));var _0x6151=function(_0x53b531,_0x5e3d4d){_0x53b531=_0x53b531-0x0;var _0x39a5fc=_0x1516[_0x53b531];return _0x39a5fc;};'use strict';var Sequelize=require(_0x6151('0x0'));var moment=require(_0x6151('0x1'));module[_0x6151('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6151('0x3')]},'disposition':{'type':Sequelize[_0x6151('0x4')]},'secondDisposition':{'type':Sequelize[_0x6151('0x4')]},'thirdDisposition':{'type':Sequelize[_0x6151('0x4')]},'note':{'type':Sequelize[_0x6151('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x6151('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x6151('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6151('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x6151('0x6')]('in',_0x6151('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x6151('0x7')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x6151('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 7ff1ee5..f87864f 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 _0xce72=['emit','removeTags','download','root','server','files','tmp','join','format','transcript-%d-%s.zip','User','fullname','CmContact','Contact','firstName','Messages','createdAt','direction','secret','read','push','SmsAccount','Owner','get','mkdirSync','Sms','Account','N.A.','toString','out','System','lastName','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','err','rimraf','zip-dir','bluebird','util','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./smsInteraction.socket','sendStatus','end','json','offset','undefined','count','Content-Range','update','destroy','then','status','error','stack','name','index','map','SmsInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','sms','user','catch','show','params','model','keys','query','filters','intersection','attributes','fields','length','includeAll','include','merge','find','create','body','describe','addMessage','SmsMessage','omit','findOne','hasOwnProperty','limit','order','sort','where','pick','SmsInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','options','rows','setTags','ids','Tag','color'];(function(_0x4d78fb,_0x280202){var _0x2898bf=function(_0x11ba3c){while(--_0x11ba3c){_0x4d78fb['push'](_0x4d78fb['shift']());}};_0x2898bf(++_0x280202);}(_0xce72,0x111));var _0x2ce7=function(_0x5e1536,_0x3751a8){_0x5e1536=_0x5e1536-0x0;var _0x566ab7=_0xce72[_0x5e1536];return _0x566ab7;};'use strict';var rimraf=require(_0x2ce7('0x0'));var zipdir=require(_0x2ce7('0x1'));var moment=require('moment');var BPromise=require(_0x2ce7('0x2'));var util=require(_0x2ce7('0x3'));var path=require('path');var ejs=require(_0x2ce7('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x2ce7('0x5'));var interaction=require(_0x2ce7('0x6'));var qs=require(_0x2ce7('0x7'));var pdf=require('../../components/export/pdf');var logger=require(_0x2ce7('0x8'))(_0x2ce7('0x9'));var config=require(_0x2ce7('0xa'));var db=require('../../mysqldb')['db'];config[_0x2ce7('0xb')]=_['defaults'](config['redis'],{'host':_0x2ce7('0xc'),'port':0x18eb});var socket=require(_0x2ce7('0xd'))(new Redis(config[_0x2ce7('0xb')]));require(_0x2ce7('0xe'))['register'](socket);function respondWithStatusCode(_0x267a2e,_0x152f27){_0x152f27=_0x152f27||0xcc;return function(_0x4a113c){if(_0x4a113c){return _0x267a2e[_0x2ce7('0xf')](_0x152f27);}return _0x267a2e['status'](_0x152f27)[_0x2ce7('0x10')]();};}function respondWithResult(_0x5d3188,_0x1197b9){_0x1197b9=_0x1197b9||0xc8;return function(_0x1a03b6){if(_0x1a03b6){return _0x5d3188['status'](_0x1197b9)[_0x2ce7('0x11')](_0x1a03b6);}};}function respondWithFilteredResult(_0x4e3d76,_0x4e3010){return function(_0x93f14){if(_0x93f14){var _0x470abc=typeof _0x4e3010[_0x2ce7('0x12')]===_0x2ce7('0x13')&&typeof _0x4e3010['limit']==='undefined';var _0x3d219f=_0x93f14['count'];var _0x343f7d=_0x470abc?0x0:_0x4e3010[_0x2ce7('0x12')];var _0x14d45d=_0x470abc?_0x93f14[_0x2ce7('0x14')]:_0x4e3010['offset']+_0x4e3010['limit'];var _0x6e4ad6;if(_0x14d45d>=_0x3d219f){_0x14d45d=_0x3d219f;_0x6e4ad6=0xc8;}else{_0x6e4ad6=0xce;}_0x4e3d76['status'](_0x6e4ad6);return _0x4e3d76['set'](_0x2ce7('0x15'),_0x343f7d+'-'+_0x14d45d+'/'+_0x3d219f)[_0x2ce7('0x11')](_0x93f14);}return null;};}function saveUpdates(_0x693ccc){return function(_0x5ac3a0){if(_0x5ac3a0){return _0x5ac3a0[_0x2ce7('0x16')](_0x693ccc)['then'](function(_0x11a55d){return _0x11a55d;});}return null;};}function removeEntity(_0x4f18c4){return function(_0x334ad8){if(_0x334ad8){return _0x334ad8[_0x2ce7('0x17')]()[_0x2ce7('0x18')](function(){_0x4f18c4[_0x2ce7('0x19')](0xcc)[_0x2ce7('0x10')]();});}};}function handleEntityNotFound(_0x24cb3b){return function(_0x185672){if(!_0x185672){_0x24cb3b[_0x2ce7('0xf')](0x194);}return _0x185672;};}function handleError(_0x4689dd,_0x3e2042){_0x3e2042=_0x3e2042||0x1f4;return function(_0x467728){logger[_0x2ce7('0x1a')](_0x467728[_0x2ce7('0x1b')]);if(_0x467728[_0x2ce7('0x1c')]){delete _0x467728['name'];}_0x4689dd['status'](_0x3e2042)['send'](_0x467728);};}exports[_0x2ce7('0x1d')]=function(_0x48801d,_0x372fb8){var _0x48e635={};var _0xd2ade=_[_0x2ce7('0x1e')](db[_0x2ce7('0x1f')][_0x2ce7('0x20')],function(_0x3881bb){return{'name':_0x3881bb[_0x2ce7('0x21')],'type':_0x3881bb[_0x2ce7('0x22')][_0x2ce7('0x23')]};});_0x48e635=qs[_0x2ce7('0x24')](_0xd2ade,_0x48801d);return interaction[_0x2ce7('0x25')](_0x2ce7('0x26'),_0x48801d['query'],_0x48801d[_0x2ce7('0x27')],_0x48e635,_0xd2ade)[_0x2ce7('0x18')](respondWithFilteredResult(_0x372fb8,_0x48e635))[_0x2ce7('0x28')](handleError(_0x372fb8,null));};exports[_0x2ce7('0x29')]=function(_0x284a6c,_0x2235cc){var _0x356f3c={'raw':![],'where':{'id':_0x284a6c[_0x2ce7('0x2a')]['id']}},_0x3557f4={};_0x3557f4[_0x2ce7('0x2b')]=_[_0x2ce7('0x2c')](db[_0x2ce7('0x1f')][_0x2ce7('0x20')]);_0x3557f4[_0x2ce7('0x2d')]=_[_0x2ce7('0x2c')](_0x284a6c[_0x2ce7('0x2d')]);_0x3557f4[_0x2ce7('0x2e')]=_[_0x2ce7('0x2f')](_0x3557f4[_0x2ce7('0x2b')],_0x3557f4[_0x2ce7('0x2d')]);_0x356f3c[_0x2ce7('0x30')]=_[_0x2ce7('0x2f')](_0x3557f4[_0x2ce7('0x2b')],qs[_0x2ce7('0x31')](_0x284a6c[_0x2ce7('0x2d')][_0x2ce7('0x31')]));_0x356f3c['attributes']=_0x356f3c[_0x2ce7('0x30')][_0x2ce7('0x32')]?_0x356f3c['attributes']:_0x3557f4[_0x2ce7('0x2b')];if(_0x284a6c[_0x2ce7('0x2d')][_0x2ce7('0x33')]){_0x356f3c[_0x2ce7('0x34')]=[{'all':!![]}];}_0x356f3c=_[_0x2ce7('0x35')]({},_0x356f3c,_0x284a6c['options']);return db[_0x2ce7('0x1f')][_0x2ce7('0x36')](_0x356f3c)[_0x2ce7('0x18')](handleEntityNotFound(_0x2235cc,null))[_0x2ce7('0x18')](respondWithResult(_0x2235cc,null))[_0x2ce7('0x28')](handleError(_0x2235cc,null));};exports[_0x2ce7('0x37')]=function(_0x13f49d,_0x491926){return db[_0x2ce7('0x1f')][_0x2ce7('0x37')](_0x13f49d[_0x2ce7('0x38')],{})[_0x2ce7('0x18')](respondWithResult(_0x491926,0xc9))['catch'](handleError(_0x491926,null));};exports[_0x2ce7('0x16')]=function(_0x2f6109,_0x38dc7e){if(_0x2f6109['body']['id']){delete _0x2f6109[_0x2ce7('0x38')]['id'];}return db[_0x2ce7('0x1f')][_0x2ce7('0x36')]({'where':{'id':_0x2f6109[_0x2ce7('0x2a')]['id']}})['then'](handleEntityNotFound(_0x38dc7e,null))[_0x2ce7('0x18')](saveUpdates(_0x2f6109[_0x2ce7('0x38')],null))[_0x2ce7('0x18')](respondWithResult(_0x38dc7e,null))[_0x2ce7('0x28')](handleError(_0x38dc7e,null));};exports['destroy']=function(_0x4502b2,_0x12eb01){return db['SmsInteraction'][_0x2ce7('0x36')]({'where':{'id':_0x4502b2[_0x2ce7('0x2a')]['id']}})[_0x2ce7('0x18')](handleEntityNotFound(_0x12eb01,null))[_0x2ce7('0x18')](removeEntity(_0x12eb01,null))[_0x2ce7('0x28')](handleError(_0x12eb01,null));};exports[_0x2ce7('0x39')]=function(_0x5e8187,_0x17593c){return db['SmsInteraction']['describe']()['then'](respondWithResult(_0x17593c,null))[_0x2ce7('0x28')](handleError(_0x17593c,null));};exports[_0x2ce7('0x3a')]=function(_0x216ded,_0x32b60b){return db[_0x2ce7('0x3b')][_0x2ce7('0x36')]({'where':{'id':_0x216ded[_0x2ce7('0x2a')]['id']}})[_0x2ce7('0x18')](handleEntityNotFound(_0x32b60b,null))[_0x2ce7('0x18')](function(_0x574376){if(_0x574376){return _0x574376[_0x2ce7('0x3a')](_0x216ded[_0x2ce7('0x38')]['ids'],_[_0x2ce7('0x3c')](_0x216ded[_0x2ce7('0x38')],['ids','id'])||{});}})[_0x2ce7('0x18')](respondWithResult(_0x32b60b,null))[_0x2ce7('0x28')](handleError(_0x32b60b,null));};exports['getMessages']=function(_0x36c2f6,_0x386a99){var _0x51fc92={'raw':![],'where':{}};var _0x5e2202={};var _0x1e9b92={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x2ce7('0x3d')]({'where':{'id':_0x36c2f6['params']['id']}})['then'](handleEntityNotFound(_0x386a99,null))[_0x2ce7('0x18')](function(_0x68e1ae){if(_0x68e1ae){_0x5e2202['model']=_['keys'](db[_0x2ce7('0x3b')]['rawAttributes']);_0x5e2202[_0x2ce7('0x2d')]=_[_0x2ce7('0x2c')](_0x36c2f6[_0x2ce7('0x2d')]);_0x5e2202[_0x2ce7('0x2e')]=_[_0x2ce7('0x2f')](_0x5e2202[_0x2ce7('0x2b')],_0x5e2202[_0x2ce7('0x2d')]);_0x51fc92[_0x2ce7('0x30')]=_['intersection'](_0x5e2202[_0x2ce7('0x2b')],qs['fields'](_0x36c2f6[_0x2ce7('0x2d')][_0x2ce7('0x31')]));_0x51fc92[_0x2ce7('0x30')]=_0x51fc92[_0x2ce7('0x30')][_0x2ce7('0x32')]?_0x51fc92['attributes']:_0x5e2202[_0x2ce7('0x2b')];if(!_0x36c2f6[_0x2ce7('0x2d')][_0x2ce7('0x3e')]('nolimit')){_0x51fc92[_0x2ce7('0x3f')]=qs[_0x2ce7('0x3f')](_0x36c2f6[_0x2ce7('0x2d')][_0x2ce7('0x3f')]);_0x51fc92[_0x2ce7('0x12')]=qs[_0x2ce7('0x12')](_0x36c2f6[_0x2ce7('0x2d')]['offset']);}_0x51fc92[_0x2ce7('0x40')]=qs[_0x2ce7('0x41')](_0x36c2f6[_0x2ce7('0x2d')][_0x2ce7('0x41')]);_0x51fc92[_0x2ce7('0x42')]=qs['filters'](_[_0x2ce7('0x43')](_0x36c2f6[_0x2ce7('0x2d')],_0x5e2202[_0x2ce7('0x2e')]));_0x51fc92[_0x2ce7('0x42')][_0x2ce7('0x44')]=_0x68e1ae['id'];if(_0x36c2f6[_0x2ce7('0x2d')][_0x2ce7('0x45')]){_0x51fc92[_0x2ce7('0x42')]=_[_0x2ce7('0x35')](_0x51fc92['where'],{'$or':_[_0x2ce7('0x1e')](_0x51fc92[_0x2ce7('0x30')],function(_0x1acac){var _0x2058cd={};_0x2058cd[_0x1acac]={'$like':'%'+_0x36c2f6[_0x2ce7('0x2d')][_0x2ce7('0x45')]+'%'};return _0x2058cd;})});}if(_0x36c2f6[_0x2ce7('0x2d')][_0x2ce7('0x46')]){var _0xe07c0f=_0x36c2f6[_0x2ce7('0x2d')][_0x2ce7('0x46')]['split'](',');var _0x1d19f1={};_0x1d19f1[_0xe07c0f[0x0]]={'$gte':moment(_0xe07c0f[0x1])['format'](_0x2ce7('0x47'))};_0x51fc92[_0x2ce7('0x42')]=_['merge'](_0x51fc92[_0x2ce7('0x42')],_0x1d19f1);}_0x51fc92=_[_0x2ce7('0x35')]({},_0x51fc92,_0x36c2f6[_0x2ce7('0x48')]);return db[_0x2ce7('0x3b')][_0x2ce7('0x14')]({'where':_0x51fc92[_0x2ce7('0x42')]})[_0x2ce7('0x18')](function(_0x188522){_0x1e9b92[_0x2ce7('0x14')]=_0x188522;if(_0x36c2f6[_0x2ce7('0x2d')][_0x2ce7('0x33')]){_0x51fc92['include']=[{'all':!![]}];}return db[_0x2ce7('0x3b')][_0x2ce7('0x25')](_0x51fc92);})['then'](function(_0x500e23){_0x1e9b92[_0x2ce7('0x49')]=_0x500e23;return _0x1e9b92;});}})[_0x2ce7('0x18')](respondWithFilteredResult(_0x386a99,_0x51fc92))[_0x2ce7('0x28')](handleError(_0x386a99,null));};exports['addTags']=function(_0x34ef60,_0x5c0653){return db[_0x2ce7('0x1f')][_0x2ce7('0x36')]({'where':{'id':_0x34ef60[_0x2ce7('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5c0653,null))[_0x2ce7('0x18')](function(_0x4a7b2e){if(_0x4a7b2e){return _0x4a7b2e[_0x2ce7('0x4a')](_0x34ef60[_0x2ce7('0x38')][_0x2ce7('0x4b')],_[_0x2ce7('0x3c')](_0x34ef60[_0x2ce7('0x38')],[_0x2ce7('0x4b'),'id'])||{})['spread'](function(){return db[_0x2ce7('0x4c')]['findAll']({'attributes':['id','name',_0x2ce7('0x4d')],'where':{'id':_0x34ef60['body']['ids']}});})[_0x2ce7('0x18')](function(_0x2b7c5a){socket[_0x2ce7('0x4e')]('smsInteractionTags:save',{'id':Number(_0x34ef60[_0x2ce7('0x2a')]['id']),'tags':_0x2b7c5a||[]});return{'id':Number(_0x34ef60[_0x2ce7('0x2a')]['id']),'tags':_0x2b7c5a||[]};});}})[_0x2ce7('0x18')](respondWithResult(_0x5c0653,null))[_0x2ce7('0x28')](handleError(_0x5c0653,null));};exports[_0x2ce7('0x4f')]=function(_0x592771,_0x403809){return db['SmsInteraction'][_0x2ce7('0x36')]({'where':{'id':_0x592771[_0x2ce7('0x2a')]['id']}})[_0x2ce7('0x18')](handleEntityNotFound(_0x403809,null))[_0x2ce7('0x18')](function(_0x3d3eff){if(_0x3d3eff){return _0x3d3eff[_0x2ce7('0x4f')](_0x592771[_0x2ce7('0x2d')]['ids']);}})[_0x2ce7('0x18')](respondWithStatusCode(_0x403809,null))[_0x2ce7('0x28')](handleError(_0x403809,null));};exports[_0x2ce7('0x50')]=function(_0x26b10f,_0x261202){var _0x34cd59=moment()['unix']()['toString']();var _0x18cd05=path['join'](config[_0x2ce7('0x51')],_0x2ce7('0x52'),_0x2ce7('0x53'),_0x2ce7('0x54'));var _0x3f4c45=path[_0x2ce7('0x55')](_0x18cd05,_0x34cd59);var _0x4f294b=util[_0x2ce7('0x56')](_0x2ce7('0x57'),_0x26b10f[_0x2ce7('0x2a')]['id'],_0x34cd59);var _0x2c212c=path['join'](_0x18cd05,_0x4f294b);var _0x1682ca=[];_0x1682ca['push']({'model':db[_0x2ce7('0x58')],'as':'User','attributes':['id',_0x2ce7('0x59')],'raw':!![]});_0x1682ca['push']({'model':db[_0x2ce7('0x5a')],'as':_0x2ce7('0x5b'),'attributes':['id',_0x2ce7('0x5c'),'lastName'],'raw':!![]});var _0x18a9d4=[{'model':db[_0x2ce7('0x3b')],'as':_0x2ce7('0x5d'),'attributes':['id',_0x2ce7('0x38'),_0x2ce7('0x5e'),_0x2ce7('0x5f'),_0x2ce7('0x60'),_0x2ce7('0x61')],'include':_0x1682ca}];_0x18a9d4[_0x2ce7('0x62')]({'model':db[_0x2ce7('0x63')],'as':'Account','attributes':['id',_0x2ce7('0x1c')]});_0x18a9d4[_0x2ce7('0x62')]({'model':db['User'],'as':_0x2ce7('0x64'),'attributes':['id','fullname']});return db[_0x2ce7('0x1f')][_0x2ce7('0x36')]({'where':{'id':_0x26b10f[_0x2ce7('0x2a')]['id']},'include':_0x18a9d4})[_0x2ce7('0x18')](handleEntityNotFound(_0x261202,null))[_0x2ce7('0x18')](function(_0x9835fb){if(_0x9835fb){var _0x2d8e6c=_0x9835fb[_0x2ce7('0x65')]({'plain':!![]});fs[_0x2ce7('0x66')](_0x3f4c45);var _0x3f5a7c={'channel':_0x2ce7('0x67'),'account':_0x2d8e6c[_0x2ce7('0x68')][_0x2ce7('0x1c')],'agent':_0x2d8e6c[_0x2ce7('0x64')]?_0x2d8e6c[_0x2ce7('0x64')][_0x2ce7('0x59')]:_0x2ce7('0x69'),'createdAt':moment(_0x2d8e6c['createdAt'])[_0x2ce7('0x56')]('YYYY-MM-DD\x20HH:mm:ss')[_0x2ce7('0x6a')](),'closedAt':_0x2d8e6c['closed']?moment(_0x2d8e6c['closedAt'])[_0x2ce7('0x56')](_0x2ce7('0x47'))[_0x2ce7('0x6a')]():'','disposition':_0x2d8e6c['disposition'],'messages':_(_0x2d8e6c['Messages'])[_0x2ce7('0x45')]({'secret':![]})[_0x2ce7('0x1e')](function(_0xa6cd00){return{'date':moment(_0xa6cd00[_0x2ce7('0x5e')])[_0x2ce7('0x56')](_0x2ce7('0x47'))[_0x2ce7('0x6a')](),'sender':_0xa6cd00[_0x2ce7('0x5f')]===_0x2ce7('0x6b')?_0xa6cd00[_0x2ce7('0x58')]?_0xa6cd00[_0x2ce7('0x58')][_0x2ce7('0x59')]:_0x2ce7('0x6c'):_0xa6cd00[_0x2ce7('0x5b')][_0x2ce7('0x5c')]+(_0xa6cd00[_0x2ce7('0x5b')]['lastName']?'\x20'+_0xa6cd00[_0x2ce7('0x5b')][_0x2ce7('0x6d')]:''),'body':_0xa6cd00[_0x2ce7('0x38')],'direction':_0xa6cd00[_0x2ce7('0x5f')]==='out'?'A':'C','secret':_0xa6cd00['secret'],'read':_0xa6cd00[_0x2ce7('0x61')]};})['value']()};return ejs[_0x2ce7('0x6e')](path[_0x2ce7('0x55')](config[_0x2ce7('0x51')],_0x2ce7('0x52'),_0x2ce7('0x6f'),_0x2ce7('0x70')),{'interaction':_0x3f5a7c})[_0x2ce7('0x18')](function(_0x48b81f){var _0x5d3ded=path[_0x2ce7('0x55')](_0x3f4c45,_0x2ce7('0x71')+_0x2d8e6c['id']+'-'+_0x34cd59+'.pdf');var _0x36ae63={'path':_0x5d3ded,'channel':'Sms','interactionId':_0x2d8e6c['id']};return pdf[_0x2ce7('0x72')](_0x48b81f,_0x36ae63);})['then'](function(){return new BPromise(function(_0x97b2fa,_0x4fce0d){zipdir(_0x3f4c45,{'saveTo':_0x2c212c},function(_0x5ab89d,_0x5d1f31){if(_0x5ab89d)return _0x4fce0d(_0x5ab89d);return _0x97b2fa(_0x5d1f31);});})[_0x2ce7('0x18')](function(){return new BPromise(function(_0x317708,_0x4a0fbf){rimraf(_0x3f4c45,function(_0x74e9ce){if(_0x74e9ce)_0x4a0fbf(_0x74e9ce);return _0x317708();});});})['then'](function(){return _0x261202[_0x2ce7('0x50')](_0x2c212c,_0x4f294b,function(_0x34ed76){if(_0x34ed76){console[_0x2ce7('0x73')](_0x2ce7('0x74'),_0x34ed76);}else{fs['unlinkSync'](_0x2c212c);}});});});}else{return _0x261202[_0x2ce7('0xf')](0xc8);}})[_0x2ce7('0x28')](handleError(_0x261202,null));}; \ No newline at end of file +var _0xcea1=['findAll','sms','query','show','model','keys','filters','intersection','attributes','fields','length','include','options','find','catch','create','body','params','describe','addMessage','SmsMessage','omit','ids','getMessages','findOne','rawAttributes','hasOwnProperty','nolimit','order','sort','pick','where','SmsInteractionId','merge','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','addTags','spread','smsInteractionTags:save','removeTags','unix','toString','root','server','files','tmp','join','push','User','fullname','CmContact','Contact','firstName','lastName','Messages','direction','secret','read','SmsAccount','Account','get','mkdirSync','Sms','Owner','N.A.','createdAt','closed','closedAt','out','System','value','renderFile','transcript-','createPdfFromHTML','download','log','err','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','localhost','socket.io-emitter','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','error','name','send','index','map','SmsInteraction','fieldName','type','getOptions'];(function(_0x42ab95,_0x1deee9){var _0x3073cd=function(_0x32fa5c){while(--_0x32fa5c){_0x42ab95['push'](_0x42ab95['shift']());}};_0x3073cd(++_0x1deee9);}(_0xcea1,0x1b1));var _0x1cea=function(_0x11a05f,_0x38a6af){_0x11a05f=_0x11a05f-0x0;var _0xdfea63=_0xcea1[_0x11a05f];return _0xdfea63;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x1cea('0x0'));var moment=require(_0x1cea('0x1'));var BPromise=require(_0x1cea('0x2'));var util=require(_0x1cea('0x3'));var path=require(_0x1cea('0x4'));var ejs=require(_0x1cea('0x5'));var fs=require('fs');var _=require(_0x1cea('0x6'));var Redis=require(_0x1cea('0x7'));var interaction=require(_0x1cea('0x8'));var qs=require(_0x1cea('0x9'));var pdf=require(_0x1cea('0xa'));var logger=require(_0x1cea('0xb'))(_0x1cea('0xc'));var config=require(_0x1cea('0xd'));var db=require(_0x1cea('0xe'))['db'];config['redis']=_['defaults'](config[_0x1cea('0xf')],{'host':_0x1cea('0x10'),'port':0x18eb});var socket=require(_0x1cea('0x11'))(new Redis(config[_0x1cea('0xf')]));require('./smsInteraction.socket')['register'](socket);function respondWithStatusCode(_0x2956ed,_0x169b98){_0x169b98=_0x169b98||0xcc;return function(_0x420004){if(_0x420004){return _0x2956ed[_0x1cea('0x12')](_0x169b98);}return _0x2956ed[_0x1cea('0x13')](_0x169b98)['end']();};}function respondWithResult(_0xdaf641,_0x5e48a9){_0x5e48a9=_0x5e48a9||0xc8;return function(_0x18157d){if(_0x18157d){return _0xdaf641['status'](_0x5e48a9)[_0x1cea('0x14')](_0x18157d);}};}function respondWithFilteredResult(_0x258d75,_0x271dd0){return function(_0x43e59d){if(_0x43e59d){var _0xb1ce24=typeof _0x271dd0['offset']===_0x1cea('0x15')&&typeof _0x271dd0[_0x1cea('0x16')]===_0x1cea('0x15');var _0x4a0e78=_0x43e59d[_0x1cea('0x17')];var _0x19aa24=_0xb1ce24?0x0:_0x271dd0['offset'];var _0x2afd5d=_0xb1ce24?_0x43e59d['count']:_0x271dd0[_0x1cea('0x18')]+_0x271dd0[_0x1cea('0x16')];var _0xb342e0;if(_0x2afd5d>=_0x4a0e78){_0x2afd5d=_0x4a0e78;_0xb342e0=0xc8;}else{_0xb342e0=0xce;}_0x258d75['status'](_0xb342e0);return _0x258d75[_0x1cea('0x19')](_0x1cea('0x1a'),_0x19aa24+'-'+_0x2afd5d+'/'+_0x4a0e78)[_0x1cea('0x14')](_0x43e59d);}return null;};}function saveUpdates(_0x47a028){return function(_0x90eb92){if(_0x90eb92){return _0x90eb92[_0x1cea('0x1b')](_0x47a028)[_0x1cea('0x1c')](function(_0x5397da){return _0x5397da;});}return null;};}function removeEntity(_0x6f1641){return function(_0x38fdbc){if(_0x38fdbc){return _0x38fdbc[_0x1cea('0x1d')]()[_0x1cea('0x1c')](function(){_0x6f1641[_0x1cea('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x259dc5){return function(_0x2b77b3){if(!_0x2b77b3){_0x259dc5[_0x1cea('0x12')](0x194);}return _0x2b77b3;};}function handleError(_0x820cbb,_0x7109e9){_0x7109e9=_0x7109e9||0x1f4;return function(_0x551503){logger[_0x1cea('0x1e')](_0x551503['stack']);if(_0x551503[_0x1cea('0x1f')]){delete _0x551503['name'];}_0x820cbb[_0x1cea('0x13')](_0x7109e9)[_0x1cea('0x20')](_0x551503);};}exports[_0x1cea('0x21')]=function(_0x3858f5,_0x27c545){var _0x115518={};var _0x43ab9e=_[_0x1cea('0x22')](db[_0x1cea('0x23')]['rawAttributes'],function(_0xd41192){return{'name':_0xd41192[_0x1cea('0x24')],'type':_0xd41192[_0x1cea('0x25')]['key']};});_0x115518=qs[_0x1cea('0x26')](_0x43ab9e,_0x3858f5);return interaction[_0x1cea('0x27')](_0x1cea('0x28'),_0x3858f5[_0x1cea('0x29')],_0x3858f5['user'],_0x115518,_0x43ab9e)[_0x1cea('0x1c')](respondWithFilteredResult(_0x27c545,_0x115518))['catch'](handleError(_0x27c545,null));};exports[_0x1cea('0x2a')]=function(_0x590132,_0x2ec096){var _0x236bf1={'raw':![],'where':{'id':_0x590132['params']['id']}},_0xc0235f={};_0xc0235f[_0x1cea('0x2b')]=_[_0x1cea('0x2c')](db[_0x1cea('0x23')]['rawAttributes']);_0xc0235f[_0x1cea('0x29')]=_[_0x1cea('0x2c')](_0x590132[_0x1cea('0x29')]);_0xc0235f[_0x1cea('0x2d')]=_[_0x1cea('0x2e')](_0xc0235f['model'],_0xc0235f[_0x1cea('0x29')]);_0x236bf1[_0x1cea('0x2f')]=_[_0x1cea('0x2e')](_0xc0235f[_0x1cea('0x2b')],qs[_0x1cea('0x30')](_0x590132[_0x1cea('0x29')][_0x1cea('0x30')]));_0x236bf1[_0x1cea('0x2f')]=_0x236bf1[_0x1cea('0x2f')][_0x1cea('0x31')]?_0x236bf1[_0x1cea('0x2f')]:_0xc0235f[_0x1cea('0x2b')];if(_0x590132['query']['includeAll']){_0x236bf1[_0x1cea('0x32')]=[{'all':!![]}];}_0x236bf1=_['merge']({},_0x236bf1,_0x590132[_0x1cea('0x33')]);return db['SmsInteraction'][_0x1cea('0x34')](_0x236bf1)['then'](handleEntityNotFound(_0x2ec096,null))['then'](respondWithResult(_0x2ec096,null))[_0x1cea('0x35')](handleError(_0x2ec096,null));};exports[_0x1cea('0x36')]=function(_0x2da4a8,_0x26cce0){return db[_0x1cea('0x23')][_0x1cea('0x36')](_0x2da4a8[_0x1cea('0x37')],{})[_0x1cea('0x1c')](respondWithResult(_0x26cce0,0xc9))[_0x1cea('0x35')](handleError(_0x26cce0,null));};exports[_0x1cea('0x1b')]=function(_0x579506,_0x22f4ee){if(_0x579506[_0x1cea('0x37')]['id']){delete _0x579506['body']['id'];}return db['SmsInteraction']['find']({'where':{'id':_0x579506[_0x1cea('0x38')]['id']}})['then'](handleEntityNotFound(_0x22f4ee,null))[_0x1cea('0x1c')](saveUpdates(_0x579506[_0x1cea('0x37')],null))['then'](respondWithResult(_0x22f4ee,null))[_0x1cea('0x35')](handleError(_0x22f4ee,null));};exports['destroy']=function(_0x158480,_0x208441){return db[_0x1cea('0x23')][_0x1cea('0x34')]({'where':{'id':_0x158480['params']['id']}})[_0x1cea('0x1c')](handleEntityNotFound(_0x208441,null))[_0x1cea('0x1c')](removeEntity(_0x208441,null))[_0x1cea('0x35')](handleError(_0x208441,null));};exports[_0x1cea('0x39')]=function(_0x155895,_0x67be3c){return db[_0x1cea('0x23')][_0x1cea('0x39')]()[_0x1cea('0x1c')](respondWithResult(_0x67be3c,null))[_0x1cea('0x35')](handleError(_0x67be3c,null));};exports[_0x1cea('0x3a')]=function(_0x2108f2,_0x930e4a){return db[_0x1cea('0x3b')]['find']({'where':{'id':_0x2108f2[_0x1cea('0x38')]['id']}})[_0x1cea('0x1c')](handleEntityNotFound(_0x930e4a,null))[_0x1cea('0x1c')](function(_0x19843a){if(_0x19843a){return _0x19843a[_0x1cea('0x3a')](_0x2108f2[_0x1cea('0x37')]['ids'],_[_0x1cea('0x3c')](_0x2108f2[_0x1cea('0x37')],[_0x1cea('0x3d'),'id'])||{});}})[_0x1cea('0x1c')](respondWithResult(_0x930e4a,null))[_0x1cea('0x35')](handleError(_0x930e4a,null));};exports[_0x1cea('0x3e')]=function(_0x148bf6,_0x319c3f){var _0x2dfc6b={'raw':![],'where':{}};var _0x127c29={};var _0x59d00d={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x1cea('0x3f')]({'where':{'id':_0x148bf6[_0x1cea('0x38')]['id']}})['then'](handleEntityNotFound(_0x319c3f,null))[_0x1cea('0x1c')](function(_0x407a84){if(_0x407a84){_0x127c29['model']=_[_0x1cea('0x2c')](db[_0x1cea('0x3b')][_0x1cea('0x40')]);_0x127c29['query']=_['keys'](_0x148bf6[_0x1cea('0x29')]);_0x127c29['filters']=_[_0x1cea('0x2e')](_0x127c29[_0x1cea('0x2b')],_0x127c29[_0x1cea('0x29')]);_0x2dfc6b[_0x1cea('0x2f')]=_[_0x1cea('0x2e')](_0x127c29[_0x1cea('0x2b')],qs[_0x1cea('0x30')](_0x148bf6[_0x1cea('0x29')]['fields']));_0x2dfc6b[_0x1cea('0x2f')]=_0x2dfc6b['attributes'][_0x1cea('0x31')]?_0x2dfc6b[_0x1cea('0x2f')]:_0x127c29['model'];if(!_0x148bf6[_0x1cea('0x29')][_0x1cea('0x41')](_0x1cea('0x42'))){_0x2dfc6b['limit']=qs[_0x1cea('0x16')](_0x148bf6['query']['limit']);_0x2dfc6b[_0x1cea('0x18')]=qs['offset'](_0x148bf6[_0x1cea('0x29')][_0x1cea('0x18')]);}_0x2dfc6b[_0x1cea('0x43')]=qs[_0x1cea('0x44')](_0x148bf6[_0x1cea('0x29')][_0x1cea('0x44')]);_0x2dfc6b['where']=qs['filters'](_[_0x1cea('0x45')](_0x148bf6[_0x1cea('0x29')],_0x127c29[_0x1cea('0x2d')]));_0x2dfc6b[_0x1cea('0x46')][_0x1cea('0x47')]=_0x407a84['id'];if(_0x148bf6['query']['filter']){_0x2dfc6b[_0x1cea('0x46')]=_[_0x1cea('0x48')](_0x2dfc6b['where'],{'$or':_['map'](_0x2dfc6b[_0x1cea('0x2f')],function(_0x5b3bd9){var _0x5c0793={};_0x5c0793[_0x5b3bd9]={'$like':'%'+_0x148bf6['query'][_0x1cea('0x49')]+'%'};return _0x5c0793;})});}if(_0x148bf6[_0x1cea('0x29')][_0x1cea('0x4a')]){var _0x2f6bbb=_0x148bf6[_0x1cea('0x29')][_0x1cea('0x4a')]['split'](',');var _0x9f3fb5={};_0x9f3fb5[_0x2f6bbb[0x0]]={'$gte':moment(_0x2f6bbb[0x1])[_0x1cea('0x4b')](_0x1cea('0x4c'))};_0x2dfc6b[_0x1cea('0x46')]=_[_0x1cea('0x48')](_0x2dfc6b[_0x1cea('0x46')],_0x9f3fb5);}_0x2dfc6b=_['merge']({},_0x2dfc6b,_0x148bf6[_0x1cea('0x33')]);return db[_0x1cea('0x3b')]['count']({'where':_0x2dfc6b[_0x1cea('0x46')]})[_0x1cea('0x1c')](function(_0x1d7134){_0x59d00d[_0x1cea('0x17')]=_0x1d7134;if(_0x148bf6['query']['includeAll']){_0x2dfc6b[_0x1cea('0x32')]=[{'all':!![]}];}return db[_0x1cea('0x3b')][_0x1cea('0x27')](_0x2dfc6b);})['then'](function(_0x578d38){_0x59d00d['rows']=_0x578d38;return _0x59d00d;});}})[_0x1cea('0x1c')](respondWithFilteredResult(_0x319c3f,_0x2dfc6b))[_0x1cea('0x35')](handleError(_0x319c3f,null));};exports[_0x1cea('0x4d')]=function(_0x5e1fd4,_0x555532){return db['SmsInteraction'][_0x1cea('0x34')]({'where':{'id':_0x5e1fd4['params']['id']}})['then'](handleEntityNotFound(_0x555532,null))['then'](function(_0x2f69b6){if(_0x2f69b6){return _0x2f69b6['setTags'](_0x5e1fd4[_0x1cea('0x37')][_0x1cea('0x3d')],_[_0x1cea('0x3c')](_0x5e1fd4[_0x1cea('0x37')],['ids','id'])||{})[_0x1cea('0x4e')](function(){return db['Tag'][_0x1cea('0x27')]({'attributes':['id',_0x1cea('0x1f'),'color'],'where':{'id':_0x5e1fd4[_0x1cea('0x37')]['ids']}});})[_0x1cea('0x1c')](function(_0x5e4a4a){socket['emit'](_0x1cea('0x4f'),{'id':Number(_0x5e1fd4[_0x1cea('0x38')]['id']),'tags':_0x5e4a4a||[]});return{'id':Number(_0x5e1fd4[_0x1cea('0x38')]['id']),'tags':_0x5e4a4a||[]};});}})['then'](respondWithResult(_0x555532,null))[_0x1cea('0x35')](handleError(_0x555532,null));};exports[_0x1cea('0x50')]=function(_0x5a8006,_0x572ce3){return db[_0x1cea('0x23')][_0x1cea('0x34')]({'where':{'id':_0x5a8006[_0x1cea('0x38')]['id']}})[_0x1cea('0x1c')](handleEntityNotFound(_0x572ce3,null))[_0x1cea('0x1c')](function(_0x1757c8){if(_0x1757c8){return _0x1757c8[_0x1cea('0x50')](_0x5a8006[_0x1cea('0x29')][_0x1cea('0x3d')]);}})[_0x1cea('0x1c')](respondWithStatusCode(_0x572ce3,null))[_0x1cea('0x35')](handleError(_0x572ce3,null));};exports['download']=function(_0x137b9b,_0x477dff){var _0x5ada5a=moment()[_0x1cea('0x51')]()[_0x1cea('0x52')]();var _0x274ff1=path['join'](config[_0x1cea('0x53')],_0x1cea('0x54'),_0x1cea('0x55'),_0x1cea('0x56'));var _0x33b623=path[_0x1cea('0x57')](_0x274ff1,_0x5ada5a);var _0x30d2d3=util[_0x1cea('0x4b')]('transcript-%d-%s.zip',_0x137b9b[_0x1cea('0x38')]['id'],_0x5ada5a);var _0x136852=path[_0x1cea('0x57')](_0x274ff1,_0x30d2d3);var _0x44e9ab=[];_0x44e9ab[_0x1cea('0x58')]({'model':db['User'],'as':_0x1cea('0x59'),'attributes':['id',_0x1cea('0x5a')],'raw':!![]});_0x44e9ab['push']({'model':db[_0x1cea('0x5b')],'as':_0x1cea('0x5c'),'attributes':['id',_0x1cea('0x5d'),_0x1cea('0x5e')],'raw':!![]});var _0x4d88d5=[{'model':db[_0x1cea('0x3b')],'as':_0x1cea('0x5f'),'attributes':['id','body','createdAt',_0x1cea('0x60'),_0x1cea('0x61'),_0x1cea('0x62')],'include':_0x44e9ab}];_0x4d88d5[_0x1cea('0x58')]({'model':db[_0x1cea('0x63')],'as':_0x1cea('0x64'),'attributes':['id',_0x1cea('0x1f')]});_0x4d88d5[_0x1cea('0x58')]({'model':db['User'],'as':'Owner','attributes':['id',_0x1cea('0x5a')]});return db[_0x1cea('0x23')][_0x1cea('0x34')]({'where':{'id':_0x137b9b[_0x1cea('0x38')]['id']},'include':_0x4d88d5})[_0x1cea('0x1c')](handleEntityNotFound(_0x477dff,null))[_0x1cea('0x1c')](function(_0x22e066){if(_0x22e066){var _0x178eda=_0x22e066[_0x1cea('0x65')]({'plain':!![]});fs[_0x1cea('0x66')](_0x33b623);var _0x494d70={'channel':_0x1cea('0x67'),'account':_0x178eda[_0x1cea('0x64')][_0x1cea('0x1f')],'agent':_0x178eda[_0x1cea('0x68')]?_0x178eda[_0x1cea('0x68')]['fullname']:_0x1cea('0x69'),'createdAt':moment(_0x178eda[_0x1cea('0x6a')])[_0x1cea('0x4b')](_0x1cea('0x4c'))[_0x1cea('0x52')](),'closedAt':_0x178eda[_0x1cea('0x6b')]?moment(_0x178eda[_0x1cea('0x6c')])[_0x1cea('0x4b')](_0x1cea('0x4c'))[_0x1cea('0x52')]():'','disposition':_0x178eda['disposition'],'messages':_(_0x178eda['Messages'])[_0x1cea('0x49')]({'secret':![]})['map'](function(_0x4a4dcf){return{'date':moment(_0x4a4dcf[_0x1cea('0x6a')])['format'](_0x1cea('0x4c'))[_0x1cea('0x52')](),'sender':_0x4a4dcf[_0x1cea('0x60')]===_0x1cea('0x6d')?_0x4a4dcf[_0x1cea('0x59')]?_0x4a4dcf[_0x1cea('0x59')][_0x1cea('0x5a')]:_0x1cea('0x6e'):_0x4a4dcf[_0x1cea('0x5c')][_0x1cea('0x5d')]+(_0x4a4dcf[_0x1cea('0x5c')]['lastName']?'\x20'+_0x4a4dcf[_0x1cea('0x5c')]['lastName']:''),'body':_0x4a4dcf[_0x1cea('0x37')],'direction':_0x4a4dcf[_0x1cea('0x60')]==='out'?'A':'C','secret':_0x4a4dcf[_0x1cea('0x61')],'read':_0x4a4dcf[_0x1cea('0x62')]};})[_0x1cea('0x6f')]()};return ejs[_0x1cea('0x70')](path[_0x1cea('0x57')](config[_0x1cea('0x53')],'server','views','downloadInteraction.ejs'),{'interaction':_0x494d70})[_0x1cea('0x1c')](function(_0x1adc9b){var _0x512933=path[_0x1cea('0x57')](_0x33b623,_0x1cea('0x71')+_0x178eda['id']+'-'+_0x5ada5a+'.pdf');var _0x41ad7e={'path':_0x512933,'channel':_0x1cea('0x67'),'interactionId':_0x178eda['id']};return pdf[_0x1cea('0x72')](_0x1adc9b,_0x41ad7e);})[_0x1cea('0x1c')](function(){return new BPromise(function(_0x242428,_0x524f6a){zipdir(_0x33b623,{'saveTo':_0x136852},function(_0x384c79,_0x2f55a2){if(_0x384c79)return _0x524f6a(_0x384c79);return _0x242428(_0x2f55a2);});})['then'](function(){return new BPromise(function(_0x1a57ec,_0xd93940){rimraf(_0x33b623,function(_0x4cc174){if(_0x4cc174)_0xd93940(_0x4cc174);return _0x1a57ec();});});})[_0x1cea('0x1c')](function(){return _0x477dff[_0x1cea('0x73')](_0x136852,_0x30d2d3,function(_0x42d232){if(_0x42d232){console[_0x1cea('0x74')](_0x1cea('0x75'),_0x42d232);}else{fs['unlinkSync'](_0x136852);}});});});}else{return _0x477dff['sendStatus'](0xc8);}})[_0x1cea('0x35')](handleError(_0x477dff,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index e874426..e4df214 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 _0xb016=['setDataValue','Users','findAll','then','unreadMessages','emit','catch','hasOwnProperty','exports','events','../../mysqldb','SmsMessage','save','update','remove','getUsers'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0xb016,0x159));var _0x6b01=function(_0x2566c0,_0x53d098){_0x2566c0=_0x2566c0-0x0;var _0x2f4787=_0xb016[_0x2566c0];return _0x2f4787;};'use strict';var EventEmitter=require(_0x6b01('0x0'));var SmsInteraction=require(_0x6b01('0x1'))['db']['SmsInteraction'];var SmsMessage=require('../../mysqldb')['db'][_0x6b01('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6b01('0x3'),'afterUpdate':_0x6b01('0x4'),'afterDestroy':_0x6b01('0x5')};function emitEvent(_0x3b9de1){return function(_0x5964ca,_0x1b7dd6,_0x65407a){_0x5964ca[_0x6b01('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5c5bfb){_0x5964ca[_0x6b01('0x7')](_0x6b01('0x8'),_0x5c5bfb['map'](function(_0x5f4636){return{'id':_0x5f4636['id']};}));return SmsMessage[_0x6b01('0x9')]({'where':{'SmsInteractionId':_0x5964ca['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6b01('0xa')](function(_0x2c4e48){_0x5964ca[_0x6b01('0x7')](_0x6b01('0xb'),_0x2c4e48['length']);SmsInteractionEvents['emit'](_0x3b9de1+':'+_0x5964ca['id'],_0x5964ca);SmsInteractionEvents[_0x6b01('0xc')](_0x3b9de1,_0x5964ca);_0x65407a(null);})[_0x6b01('0xd')](_0x65407a(null));};}for(var e in events){if(events[_0x6b01('0xe')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x6b01('0xf')]=SmsInteractionEvents; \ No newline at end of file +var _0x0424=['SmsInteraction','../../mysqldb','SmsMessage','setMaxListeners','update','getUsers','then','setDataValue','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook'];(function(_0x2af748,_0x308fdd){var _0x110c65=function(_0x3c988d){while(--_0x3c988d){_0x2af748['push'](_0x2af748['shift']());}};_0x110c65(++_0x308fdd);}(_0x0424,0x159));var _0x4042=function(_0x56c2d5,_0x3908fe){_0x56c2d5=_0x56c2d5-0x0;var _0x2e2133=_0x0424[_0x56c2d5];return _0x2e2133;};'use strict';var EventEmitter=require('events');var SmsInteraction=require('../../mysqldb')['db'][_0x4042('0x0')];var SmsMessage=require(_0x4042('0x1'))['db'][_0x4042('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x4042('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4042('0x4'),'afterDestroy':'remove'};function emitEvent(_0x491eae){return function(_0x20d8df,_0x24fdfd,_0x472795){_0x20d8df[_0x4042('0x5')]({'attributes':['id'],'raw':!![]})[_0x4042('0x6')](function(_0xa5310f){_0x20d8df[_0x4042('0x7')]('Users',_0xa5310f['map'](function(_0x280cd6){return{'id':_0x280cd6['id']};}));return SmsMessage[_0x4042('0x8')]({'where':{'SmsInteractionId':_0x20d8df['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4042('0x6')](function(_0x4b92d2){_0x20d8df[_0x4042('0x7')](_0x4042('0x9'),_0x4b92d2[_0x4042('0xa')]);SmsInteractionEvents[_0x4042('0xb')](_0x491eae+':'+_0x20d8df['id'],_0x20d8df);SmsInteractionEvents[_0x4042('0xb')](_0x491eae,_0x20d8df);_0x472795(null);})[_0x4042('0xc')](_0x472795(null));};}for(var e in events){if(events[_0x4042('0xd')](e)){var event=events[e];SmsInteraction[_0x4042('0xe')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 0a3cabc..79580da 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 _0x40be=['exports','SmsInteraction','sms_interactions','changed','closed','closedAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./smsInteraction.attributes'];(function(_0x40bc01,_0x22a9a9){var _0x42365b=function(_0x2d3d88){while(--_0x2d3d88){_0x40bc01['push'](_0x40bc01['shift']());}};_0x42365b(++_0x22a9a9);}(_0x40be,0x1c8));var _0xe40b=function(_0x1e5a41,_0x172855){_0x1e5a41=_0x1e5a41-0x0;var _0x1380fc=_0x40be[_0x1e5a41];return _0x1380fc;};'use strict';var _=require(_0xe40b('0x0'));var util=require(_0xe40b('0x1'));var logger=require(_0xe40b('0x2'))(_0xe40b('0x3'));var moment=require(_0xe40b('0x4'));var BPromise=require(_0xe40b('0x5'));var rp=require(_0xe40b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe40b('0x7'));var config=require('../../config/environment');var attributes=require(_0xe40b('0x8'));module[_0xe40b('0x9')]=function(_0x2f9697,_0x4180b5){return _0x2f9697['define'](_0xe40b('0xa'),attributes,{'tableName':_0xe40b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3f1000,_0x389c64,_0x1e30ba){if(_0x3f1000[_0xe40b('0xc')](_0xe40b('0xd'))){_0x3f1000[_0xe40b('0xe')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x1e30ba(null,_0x3f1000);}}});}; \ No newline at end of file +var _0x0056=['rimraf','../../config/environment','./smsInteraction.attributes','exports','sms_interactions','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x21ed0f,_0x46582d){var _0x30bae2=function(_0x493808){while(--_0x493808){_0x21ed0f['push'](_0x21ed0f['shift']());}};_0x30bae2(++_0x46582d);}(_0x0056,0x17f));var _0x6005=function(_0x470f24,_0x2436a9){_0x470f24=_0x470f24-0x0;var _0x2c6fc8=_0x0056[_0x470f24];return _0x2c6fc8;};'use strict';var _=require(_0x6005('0x0'));var util=require(_0x6005('0x1'));var logger=require(_0x6005('0x2'))(_0x6005('0x3'));var moment=require(_0x6005('0x4'));var BPromise=require(_0x6005('0x5'));var rp=require(_0x6005('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6005('0x7'));var config=require(_0x6005('0x8'));var attributes=require(_0x6005('0x9'));module[_0x6005('0xa')]=function(_0x2e1fb7,_0x2919d3){return _0x2e1fb7['define']('SmsInteraction',attributes,{'tableName':_0x6005('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5f0e71,_0x436920,_0x14e1c1){if(_0x5f0e71['changed'](_0x6005('0xc'))){_0x5f0e71['closedAt']=moment()[_0x6005('0xd')](_0x6005('0xe'));}_0x14e1c1(null,_0x5f0e71);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index fce3fe9..10c2b8e 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 _0x28ab=['http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','request','then','info','SmsInteraction,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','UpdateSmsInteraction','update','options','raw','attributes','limit','catch','AddTagsToSmsInteraction','SmsInteraction','find','where','addTags','body','AddTags','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5b996a,_0x278f5a){var _0x34a11c=function(_0x559a54){while(--_0x559a54){_0x5b996a['push'](_0x5b996a['shift']());}};_0x34a11c(++_0x278f5a);}(_0x28ab,0x190));var _0xb28a=function(_0x198209,_0x508c1c){_0x198209=_0x198209-0x0;var _0x272e87=_0x28ab[_0x198209];return _0x272e87;};'use strict';var _=require(_0xb28a('0x0'));var util=require(_0xb28a('0x1'));var moment=require(_0xb28a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb28a('0x3'))['db'];var utils=require(_0xb28a('0x4'));var logger=require(_0xb28a('0x5'))(_0xb28a('0x6'));var config=require(_0xb28a('0x7'));var jayson=require(_0xb28a('0x8'));var client=jayson[_0xb28a('0x9')][_0xb28a('0xa')]({'port':0x232a});config[_0xb28a('0xb')]=_[_0xb28a('0xc')](config[_0xb28a('0xb')],{'host':_0xb28a('0xd'),'port':0x18eb});var socket=require(_0xb28a('0xe'))(new Redis(config[_0xb28a('0xb')]));require(_0xb28a('0xf'))['register'](socket);function respondWithRpcPromise(_0x19a483,_0x254d37,_0x2035ba){return new BPromise(function(_0x37ea4a,_0x3ad206){return client[_0xb28a('0x10')](_0x19a483,_0x2035ba)[_0xb28a('0x11')](function(_0x3cefa2){logger[_0xb28a('0x12')](_0xb28a('0x13'),_0x254d37,'request\x20sent');logger[_0xb28a('0x14')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x254d37,'request\x20sent',JSON[_0xb28a('0x15')](_0x3cefa2));if(_0x3cefa2[_0xb28a('0x16')]){if(_0x3cefa2[_0xb28a('0x16')][_0xb28a('0x17')]===0x1f4){logger[_0xb28a('0x16')](_0xb28a('0x13'),_0x254d37,_0x3cefa2[_0xb28a('0x16')][_0xb28a('0x18')]);return _0x3ad206(_0x3cefa2[_0xb28a('0x16')][_0xb28a('0x18')]);}logger[_0xb28a('0x16')](_0xb28a('0x13'),_0x254d37,_0x3cefa2[_0xb28a('0x16')][_0xb28a('0x18')]);return _0x37ea4a(_0x3cefa2[_0xb28a('0x16')][_0xb28a('0x18')]);}else{logger[_0xb28a('0x12')](_0xb28a('0x13'),_0x254d37,_0xb28a('0x19'));_0x37ea4a(_0x3cefa2[_0xb28a('0x1a')][_0xb28a('0x18')]);}})['catch'](function(_0x4e80f0){logger[_0xb28a('0x16')](_0xb28a('0x13'),_0x254d37,_0x4e80f0);_0x3ad206(_0x4e80f0);});});}exports[_0xb28a('0x1b')]=function(_0x30e85b){var _0x36d53f=this;return new Promise(function(_0x5b123f,_0x320691){return db['SmsInteraction'][_0xb28a('0x1c')](_0x30e85b['body'],{'raw':_0x30e85b[_0xb28a('0x1d')]?_0x30e85b['options'][_0xb28a('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30e85b[_0xb28a('0x1d')]?_0x30e85b[_0xb28a('0x1d')]['where']||null:null,'attributes':_0x30e85b[_0xb28a('0x1d')]?_0x30e85b['options'][_0xb28a('0x1f')]||null:null,'limit':_0x30e85b[_0xb28a('0x1d')]?_0x30e85b['options'][_0xb28a('0x20')]||null:null})[_0xb28a('0x11')](function(_0x2710b3){logger['info'](_0xb28a('0x1b'),_0x30e85b);logger[_0xb28a('0x14')]('UpdateSmsInteraction',_0x30e85b,JSON[_0xb28a('0x15')](_0x2710b3));_0x5b123f(_0x2710b3);})[_0xb28a('0x21')](function(_0x172b9e){logger[_0xb28a('0x16')]('UpdateSmsInteraction',_0x172b9e['message'],_0x30e85b);_0x320691(_0x36d53f[_0xb28a('0x16')](0x1f4,_0x172b9e[_0xb28a('0x18')]));});});};exports[_0xb28a('0x22')]=function(_0x235fa2){return new Promise(function(_0x47db53,_0x571340){return db[_0xb28a('0x23')][_0xb28a('0x24')]({'where':_0x235fa2[_0xb28a('0x1d')]?_0x235fa2['options'][_0xb28a('0x25')]||null:null})[_0xb28a('0x11')](function(_0x32047a){if(_0x32047a){return _0x32047a[_0xb28a('0x26')](_0x235fa2[_0xb28a('0x27')]['ids'],_['omit'](_0x235fa2[_0xb28a('0x27')],['ids','id'])||{});}})['spread'](function(_0xaa9d98){logger[_0xb28a('0x12')]('AddTags',_0x235fa2);logger[_0xb28a('0x14')](_0xb28a('0x28'),_0x235fa2,JSON[_0xb28a('0x15')](_0xaa9d98));_0x47db53(_0xaa9d98);})[_0xb28a('0x21')](function(_0x37a8a2){logger[_0xb28a('0x16')](_0xb28a('0x28'),_0x37a8a2[_0xb28a('0x18')],_0x235fa2);_0x571340(_this['error'](0x1f4,_0x37a8a2[_0xb28a('0x18')]));});});}; \ No newline at end of file +var _0x67d4=['where','addTags','ids','spread','AddTags','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateSmsInteraction','update','body','options','raw','attributes','limit','debug','SmsInteraction'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x67d4,0x13d));var _0x467d=function(_0x1d1668,_0x54ba09){_0x1d1668=_0x1d1668-0x0;var _0x52b289=_0x67d4[_0x1d1668];return _0x52b289;};'use strict';var _=require(_0x467d('0x0'));var util=require(_0x467d('0x1'));var moment=require(_0x467d('0x2'));var BPromise=require('bluebird');var rs=require(_0x467d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x467d('0x4'));var logger=require(_0x467d('0x5'))(_0x467d('0x6'));var config=require(_0x467d('0x7'));var jayson=require(_0x467d('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x467d('0x9')]=_[_0x467d('0xa')](config[_0x467d('0x9')],{'host':_0x467d('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x467d('0x9')]));require(_0x467d('0xc'))[_0x467d('0xd')](socket);function respondWithRpcPromise(_0x222e07,_0x32067c,_0xd8e34f){return new BPromise(function(_0x16eb73,_0x18ed5f){return client[_0x467d('0xe')](_0x222e07,_0xd8e34f)[_0x467d('0xf')](function(_0x436555){logger[_0x467d('0x10')](_0x467d('0x11'),_0x32067c,_0x467d('0x12'));logger['debug'](_0x467d('0x13'),_0x32067c,_0x467d('0x12'),JSON[_0x467d('0x14')](_0x436555));if(_0x436555[_0x467d('0x15')]){if(_0x436555[_0x467d('0x15')]['code']===0x1f4){logger[_0x467d('0x15')](_0x467d('0x11'),_0x32067c,_0x436555[_0x467d('0x15')][_0x467d('0x16')]);return _0x18ed5f(_0x436555[_0x467d('0x15')][_0x467d('0x16')]);}logger[_0x467d('0x15')](_0x467d('0x11'),_0x32067c,_0x436555[_0x467d('0x15')][_0x467d('0x16')]);return _0x16eb73(_0x436555['error'][_0x467d('0x16')]);}else{logger['info'](_0x467d('0x11'),_0x32067c,_0x467d('0x12'));_0x16eb73(_0x436555[_0x467d('0x17')][_0x467d('0x16')]);}})[_0x467d('0x18')](function(_0x29f2d2){logger[_0x467d('0x15')](_0x467d('0x11'),_0x32067c,_0x29f2d2);_0x18ed5f(_0x29f2d2);});});}exports[_0x467d('0x19')]=function(_0x17aeb3){var _0x7c122f=this;return new Promise(function(_0x17c4bf,_0x15d51d){return db['SmsInteraction'][_0x467d('0x1a')](_0x17aeb3[_0x467d('0x1b')],{'raw':_0x17aeb3['options']?_0x17aeb3[_0x467d('0x1c')][_0x467d('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17aeb3[_0x467d('0x1c')]?_0x17aeb3[_0x467d('0x1c')]['where']||null:null,'attributes':_0x17aeb3[_0x467d('0x1c')]?_0x17aeb3['options'][_0x467d('0x1e')]||null:null,'limit':_0x17aeb3[_0x467d('0x1c')]?_0x17aeb3['options'][_0x467d('0x1f')]||null:null})[_0x467d('0xf')](function(_0x754b6){logger[_0x467d('0x10')](_0x467d('0x19'),_0x17aeb3);logger[_0x467d('0x20')]('UpdateSmsInteraction',_0x17aeb3,JSON[_0x467d('0x14')](_0x754b6));_0x17c4bf(_0x754b6);})[_0x467d('0x18')](function(_0x4d5800){logger[_0x467d('0x15')](_0x467d('0x19'),_0x4d5800[_0x467d('0x16')],_0x17aeb3);_0x15d51d(_0x7c122f['error'](0x1f4,_0x4d5800[_0x467d('0x16')]));});});};exports['AddTagsToSmsInteraction']=function(_0xa074a6){return new Promise(function(_0x4ddce6,_0x585def){return db[_0x467d('0x21')]['find']({'where':_0xa074a6[_0x467d('0x1c')]?_0xa074a6[_0x467d('0x1c')][_0x467d('0x22')]||null:null})['then'](function(_0x236d6b){if(_0x236d6b){return _0x236d6b[_0x467d('0x23')](_0xa074a6['body']['ids'],_['omit'](_0xa074a6[_0x467d('0x1b')],[_0x467d('0x24'),'id'])||{});}})[_0x467d('0x25')](function(_0x5f2ecb){logger[_0x467d('0x10')](_0x467d('0x26'),_0xa074a6);logger[_0x467d('0x20')](_0x467d('0x26'),_0xa074a6,JSON[_0x467d('0x14')](_0x5f2ecb));_0x4ddce6(_0x5f2ecb);})[_0x467d('0x18')](function(_0x57c35e){logger[_0x467d('0x15')]('AddTags',_0x57c35e[_0x467d('0x16')],_0xa074a6);_0x585def(_this[_0x467d('0x15')](0x1f4,_0x57c35e['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index f34c6ae..f64b148 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 _0x770a=['save','remove','removeListener','length','./smsInteraction.events'];(function(_0xa8c303,_0x19923b){var _0x262d3e=function(_0x9cff22){while(--_0x9cff22){_0xa8c303['push'](_0xa8c303['shift']());}};_0x262d3e(++_0x19923b);}(_0x770a,0x90));var _0xa770=function(_0x2fe619,_0x49d94e){_0x2fe619=_0x2fe619-0x0;var _0x22adc6=_0x770a[_0x2fe619];return _0x22adc6;};'use strict';var SmsInteractionEvents=require(_0xa770('0x0'));var events=[_0xa770('0x1'),_0xa770('0x2'),'update'];function createListener(_0x3e73df,_0x264037){return function(_0x5a6bd4){_0x264037['emit'](_0x3e73df,_0x5a6bd4);};}function removeListener(_0x2fc9b7,_0x2d59e5){return function(){SmsInteractionEvents[_0xa770('0x3')](_0x2fc9b7,_0x2d59e5);};}exports['register']=function(_0x5b2f29){for(var _0x135760=0x0,_0x158317=events[_0xa770('0x4')];_0x135760<_0x158317;_0x135760++){var _0x4e94df=events[_0x135760];var _0xa0b6f=createListener('smsInteraction:'+_0x4e94df,_0x5b2f29);SmsInteractionEvents['on'](_0x4e94df,_0xa0b6f);}}; \ No newline at end of file +var _0x874f=['update','emit','register','./smsInteraction.events'];(function(_0x271958,_0x572d25){var _0x18206f=function(_0x42af2c){while(--_0x42af2c){_0x271958['push'](_0x271958['shift']());}};_0x18206f(++_0x572d25);}(_0x874f,0x1b7));var _0xf874=function(_0x1cd674,_0x8d3638){_0x1cd674=_0x1cd674-0x0;var _0x27928f=_0x874f[_0x1cd674];return _0x27928f;};'use strict';var SmsInteractionEvents=require(_0xf874('0x0'));var events=['save','remove',_0xf874('0x1')];function createListener(_0x1b4318,_0x5a8dac){return function(_0x3aa8a5){_0x5a8dac[_0xf874('0x2')](_0x1b4318,_0x3aa8a5);};}function removeListener(_0x5dab03,_0x1e9edb){return function(){SmsInteractionEvents['removeListener'](_0x5dab03,_0x1e9edb);};}exports[_0xf874('0x3')]=function(_0x196dab){for(var _0x114aa1=0x0,_0x104b75=events['length'];_0x114aa1<_0x104b75;_0x114aa1++){var _0x38e0b5=events[_0x114aa1];var _0x257bdd=createListener('smsInteraction:'+_0x38e0b5,_0x196dab);SmsInteractionEvents['on'](_0x38e0b5,_0x257bdd);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index a780d67..ecbc5b9 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 _0xdfe9=['fs-extra','../../components/auth/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','tracked','smsmessage:create','create','/:id/status','status','update','put','/:id/accept','reject','delete','destroy','util','path','express','Router'];(function(_0x594004,_0x529cef){var _0x3755e8=function(_0x5b1e79){while(--_0x5b1e79){_0x594004['push'](_0x594004['shift']());}};_0x3755e8(++_0x529cef);}(_0xdfe9,0x14e));var _0x9dfe=function(_0x4d5724,_0x568758){_0x4d5724=_0x4d5724-0x0;var _0xe53c6d=_0xdfe9[_0x4d5724];return _0xe53c6d;};'use strict';var multer=require('multer');var util=require(_0x9dfe('0x0'));var path=require(_0x9dfe('0x1'));var timeout=require('connect-timeout');var express=require(_0x9dfe('0x2'));var router=express[_0x9dfe('0x3')]();var fs_extra=require(_0x9dfe('0x4'));var auth=require(_0x9dfe('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9dfe('0x6'));var controller=require(_0x9dfe('0x7'));router[_0x9dfe('0x8')]('/',auth[_0x9dfe('0x9')](),controller['index']);router[_0x9dfe('0x8')](_0x9dfe('0xa'),auth[_0x9dfe('0x9')](),controller[_0x9dfe('0xb')]);router[_0x9dfe('0x8')](_0x9dfe('0xc'),auth['isAuthenticated'](),controller[_0x9dfe('0xd')]);router[_0x9dfe('0xe')]('/',auth['isAuthenticated'](),interaction[_0x9dfe('0xf')]('sms',_0x9dfe('0x10')),controller[_0x9dfe('0x11')]);router[_0x9dfe('0xe')](_0x9dfe('0x12'),controller[_0x9dfe('0x13')]);router['put'](_0x9dfe('0xc'),auth[_0x9dfe('0x9')](),controller[_0x9dfe('0x14')]);router[_0x9dfe('0x15')](_0x9dfe('0x16'),auth[_0x9dfe('0x9')](),controller['accept']);router[_0x9dfe('0x15')]('/:id/reject',auth[_0x9dfe('0x9')](),controller[_0x9dfe('0x17')]);router[_0x9dfe('0x18')](_0x9dfe('0xc'),auth[_0x9dfe('0x9')](),controller[_0x9dfe('0x19')]);module['exports']=router; \ No newline at end of file +var _0xbf1c=['tracked','sms','smsmessage:create','create','post','/:id/status','put','accept','/:id/reject','reject','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x2bf31e,_0x3d5db7){var _0x528176=function(_0x4f8d63){while(--_0x4f8d63){_0x2bf31e['push'](_0x2bf31e['shift']());}};_0x528176(++_0x3d5db7);}(_0xbf1c,0x1a1));var _0xcbf1=function(_0x594bed,_0x420ecc){_0x594bed=_0x594bed-0x0;var _0x52818c=_0xbf1c[_0x594bed];return _0x52818c;};'use strict';var multer=require(_0xcbf1('0x0'));var util=require(_0xcbf1('0x1'));var path=require(_0xcbf1('0x2'));var timeout=require(_0xcbf1('0x3'));var express=require(_0xcbf1('0x4'));var router=express[_0xcbf1('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xcbf1('0x6'));var config=require(_0xcbf1('0x7'));var controller=require(_0xcbf1('0x8'));router[_0xcbf1('0x9')]('/',auth[_0xcbf1('0xa')](),controller['index']);router[_0xcbf1('0x9')](_0xcbf1('0xb'),auth['isAuthenticated'](),controller[_0xcbf1('0xc')]);router[_0xcbf1('0x9')](_0xcbf1('0xd'),auth[_0xcbf1('0xa')](),controller[_0xcbf1('0xe')]);router['post']('/',auth[_0xcbf1('0xa')](),interaction[_0xcbf1('0xf')](_0xcbf1('0x10'),_0xcbf1('0x11')),controller[_0xcbf1('0x12')]);router[_0xcbf1('0x13')](_0xcbf1('0x14'),controller['status']);router[_0xcbf1('0x15')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xcbf1('0x15')]('/:id/accept',auth[_0xcbf1('0xa')](),controller[_0xcbf1('0x16')]);router[_0xcbf1('0x15')](_0xcbf1('0x17'),auth[_0xcbf1('0xa')](),controller[_0xcbf1('0x18')]);router[_0xcbf1('0x19')](_0xcbf1('0xd'),auth[_0xcbf1('0xa')](),controller['destroy']);module[_0xcbf1('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 7cc7a63..acb97a4 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 _0x1782=['STRING','DATE','exports','TEXT','ENUM','out'];(function(_0xc985a6,_0x697817){var _0x3e0c34=function(_0x42b0b6){while(--_0x42b0b6){_0xc985a6['push'](_0xc985a6['shift']());}};_0x3e0c34(++_0x697817);}(_0x1782,0x188));var _0x2178=function(_0x108917,_0x2bf905){_0x108917=_0x108917-0x0;var _0x12dfcd=_0x1782[_0x108917];return _0x12dfcd;};'use strict';var Sequelize=require('sequelize');module[_0x2178('0x0')]={'body':{'type':Sequelize[_0x2178('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x2178('0x2')]('in','out'),'defaultValue':_0x2178('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x2178('0x4')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x2178('0x5')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x2178('0x4')]},'providerResponse':{'type':Sequelize[_0x2178('0x1')]}}; \ No newline at end of file +var _0xaf6c=['TEXT','BOOLEAN','ENUM','out','STRING','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaf6c,0x13d));var _0xcaf6=function(_0x6f9188,_0x2d8260){_0x6f9188=_0x6f9188-0x0;var _0x4c808e=_0xaf6c[_0x6f9188];return _0x4c808e;};'use strict';var Sequelize=require('sequelize');module[_0xcaf6('0x0')]={'body':{'type':Sequelize[_0xcaf6('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xcaf6('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xcaf6('0x3')]('in',_0xcaf6('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xcaf6('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xcaf6('0x5')]},'providerResponse':{'type':Sequelize[_0xcaf6('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index eb18a77..d95effc 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 _0xb43c=['isNil','read1stAt','format','interaction','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','fullname','email','internal','manual','interface','channel','event','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','SELECT','SIP/%s','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','plivo','MessageUUID','indexOf','sent','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','end','name','send','map','SmsMessage','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','sort','where','pick','filter','VIRTUAL','merge','include','findAll','show','params','rawAttributes','includeAll','options','create','body','find','describe','sms-interactions','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId'];(function(_0x1b8d1c,_0x395b3b){var _0x159a0b=function(_0x564655){while(--_0x564655){_0x1b8d1c['push'](_0x1b8d1c['shift']());}};_0x159a0b(++_0x395b3b);}(_0xb43c,0x1ea));var _0xcb43=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb43c[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xcb43('0x0'));var rimraf=require(_0xcb43('0x1'));var zipdir=require(_0xcb43('0x2'));var jsonpatch=require(_0xcb43('0x3'));var rp=require(_0xcb43('0x4'));var moment=require(_0xcb43('0x5'));var BPromise=require(_0xcb43('0x6'));var Mustache=require(_0xcb43('0x7'));var util=require(_0xcb43('0x8'));var path=require(_0xcb43('0x9'));var sox=require(_0xcb43('0xa'));var csv=require(_0xcb43('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcb43('0xc'));var _=require(_0xcb43('0xd'));var squel=require(_0xcb43('0xe'));var crypto=require(_0xcb43('0xf'));var jsforce=require(_0xcb43('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xcb43('0xb'));var querystring=require(_0xcb43('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xcb43('0x12'));var qs=require(_0xcb43('0x13'));var as=require(_0xcb43('0x14'));var hardwareService=require(_0xcb43('0x15'));var logger=require(_0xcb43('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xcb43('0x17'));var db=require(_0xcb43('0x18'))['db'];config[_0xcb43('0x19')]=_[_0xcb43('0x1a')](config['redis'],{'host':_0xcb43('0x1b'),'port':0x18eb});var socket=require(_0xcb43('0x1c'))(new Redis(config[_0xcb43('0x19')]));require(_0xcb43('0x1d'))[_0xcb43('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0xcb43('0x1f')][_0xcb43('0x20')]({'port':0x232c});var client9002=jayson[_0xcb43('0x1f')][_0xcb43('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x11b5e6,_0x8e4800,_0x294be5,_0x3646b8){return new BPromise(function(_0x52cf03,_0x9dcaba){var _0x301f5f=_0x3646b8||client;return _0x301f5f[_0xcb43('0x21')](_0x11b5e6,_0x294be5)[_0xcb43('0x22')](function(_0x525b16){logger[_0xcb43('0x23')](_0xcb43('0x24'),_0x8e4800,_0xcb43('0x25'));logger[_0xcb43('0x26')](_0xcb43('0x27'),_0x8e4800,'request\x20sent',JSON[_0xcb43('0x28')](_0x525b16));if(_0x525b16[_0xcb43('0x29')]){if(_0x525b16[_0xcb43('0x29')][_0xcb43('0x2a')]===0x1f4){logger[_0xcb43('0x29')](_0xcb43('0x24'),_0x8e4800,_0x525b16[_0xcb43('0x29')][_0xcb43('0x2b')]);return _0x9dcaba(_0x525b16['error'][_0xcb43('0x2b')]);}logger[_0xcb43('0x29')](_0xcb43('0x24'),_0x8e4800,_0x525b16[_0xcb43('0x29')]['message']);return _0x52cf03(_0x525b16[_0xcb43('0x29')]['message']);}else{logger[_0xcb43('0x23')](_0xcb43('0x24'),_0x8e4800,'request\x20sent');_0x52cf03(_0x525b16[_0xcb43('0x2c')][_0xcb43('0x2b')]);}})[_0xcb43('0x2d')](function(_0x468eb6){logger[_0xcb43('0x29')](_0xcb43('0x24'),_0x8e4800,_0x468eb6);_0x9dcaba(_0x468eb6);});});}function respondWithStatusCode(_0x53cf37,_0x3aee3d){_0x3aee3d=_0x3aee3d||0xcc;return function(_0x235a23){if(_0x235a23){return _0x53cf37[_0xcb43('0x2e')](_0x3aee3d);}return _0x53cf37[_0xcb43('0x2f')](_0x3aee3d)['end']();};}function respondWithResult(_0x5b25df,_0x34b278){_0x34b278=_0x34b278||0xc8;return function(_0x1c0d69){if(_0x1c0d69){return _0x5b25df['status'](_0x34b278)['json'](_0x1c0d69);}};}function respondWithFilteredResult(_0x19cf6f,_0x50b0f8){return function(_0x596db3){if(_0x596db3){var _0x243ec6=typeof _0x50b0f8[_0xcb43('0x30')]==='undefined'&&typeof _0x50b0f8['limit']===_0xcb43('0x31');var _0x586d78=_0x596db3[_0xcb43('0x32')];var _0x68b8aa=_0x243ec6?0x0:_0x50b0f8['offset'];var _0x350653=_0x243ec6?_0x596db3[_0xcb43('0x32')]:_0x50b0f8[_0xcb43('0x30')]+_0x50b0f8['limit'];var _0x51116a;if(_0x350653>=_0x586d78){_0x350653=_0x586d78;_0x51116a=0xc8;}else{_0x51116a=0xce;}_0x19cf6f['status'](_0x51116a);return _0x19cf6f[_0xcb43('0x33')](_0xcb43('0x34'),_0x68b8aa+'-'+_0x350653+'/'+_0x586d78)['json'](_0x596db3);}return null;};}function patchUpdates(_0x2d9e4b){return function(_0x487bce){try{jsonpatch[_0xcb43('0x35')](_0x487bce,_0x2d9e4b,!![]);}catch(_0x567b5b){return BPromise[_0xcb43('0x36')](_0x567b5b);}return _0x487bce[_0xcb43('0x37')]();};}function saveUpdates(_0x3c267f,_0x30045c){return function(_0x15ae1c){if(_0x15ae1c){return _0x15ae1c[_0xcb43('0x38')](_0x3c267f)[_0xcb43('0x22')](function(_0x38251c){return _0x38251c;});}return null;};}function removeEntity(_0x35832d,_0x4970da){return function(_0x162b33){if(_0x162b33){return _0x162b33[_0xcb43('0x39')]()[_0xcb43('0x22')](function(){_0x35832d[_0xcb43('0x2f')](0xcc)[_0xcb43('0x3a')]();});}};}function handleEntityNotFound(_0x2e66a6,_0xb55f46){return function(_0xfa5564){if(!_0xfa5564){_0x2e66a6[_0xcb43('0x2e')](0x194);}return _0xfa5564;};}function handleError(_0x268984,_0x196a51){_0x196a51=_0x196a51||0x1f4;return function(_0x110e40){logger[_0xcb43('0x29')](_0x110e40['stack']);if(_0x110e40[_0xcb43('0x3b')]){delete _0x110e40['name'];}_0x268984[_0xcb43('0x2f')](_0x196a51)[_0xcb43('0x3c')](_0x110e40);};}exports['index']=function(_0x3976b2,_0x183aa6){var _0x446f09={},_0x5a8ec0={},_0x15f3db={'count':0x0,'rows':[]};var _0x1ca7b2=_[_0xcb43('0x3d')](db[_0xcb43('0x3e')]['rawAttributes'],function(_0x437b99){return{'name':_0x437b99['fieldName'],'type':_0x437b99[_0xcb43('0x3f')]['key']};});_0x5a8ec0[_0xcb43('0x40')]=_[_0xcb43('0x3d')](_0x1ca7b2,_0xcb43('0x3b'));_0x5a8ec0['query']=_[_0xcb43('0x41')](_0x3976b2[_0xcb43('0x42')]);_0x5a8ec0[_0xcb43('0x43')]=_[_0xcb43('0x44')](_0x5a8ec0[_0xcb43('0x40')],_0x5a8ec0[_0xcb43('0x42')]);_0x446f09[_0xcb43('0x45')]=_[_0xcb43('0x44')](_0x5a8ec0['model'],qs[_0xcb43('0x46')](_0x3976b2[_0xcb43('0x42')][_0xcb43('0x46')]));_0x446f09[_0xcb43('0x45')]=_0x446f09['attributes'][_0xcb43('0x47')]?_0x446f09[_0xcb43('0x45')]:_0x5a8ec0[_0xcb43('0x40')];if(!_0x3976b2[_0xcb43('0x42')]['hasOwnProperty'](_0xcb43('0x48'))){_0x446f09[_0xcb43('0x49')]=qs['limit'](_0x3976b2[_0xcb43('0x42')][_0xcb43('0x49')]);_0x446f09[_0xcb43('0x30')]=qs['offset'](_0x3976b2[_0xcb43('0x42')][_0xcb43('0x30')]);}_0x446f09['order']=qs[_0xcb43('0x4a')](_0x3976b2[_0xcb43('0x42')]['sort']);_0x446f09[_0xcb43('0x4b')]=qs[_0xcb43('0x43')](_[_0xcb43('0x4c')](_0x3976b2[_0xcb43('0x42')],_0x5a8ec0[_0xcb43('0x43')]),_0x1ca7b2);if(_0x3976b2[_0xcb43('0x42')][_0xcb43('0x4d')]){_0x446f09[_0xcb43('0x4b')]=_['merge'](_0x446f09[_0xcb43('0x4b')],{'$or':_[_0xcb43('0x3d')](_0x1ca7b2,function(_0x219485){if(_0x219485['type']!==_0xcb43('0x4e')){var _0x217c76={};_0x217c76[_0x219485[_0xcb43('0x3b')]]={'$like':'%'+_0x3976b2[_0xcb43('0x42')][_0xcb43('0x4d')]+'%'};return _0x217c76;}})});}_0x446f09=_[_0xcb43('0x4f')]({},_0x446f09,_0x3976b2['options']);var _0x104b88={'where':_0x446f09[_0xcb43('0x4b')]};return db['SmsMessage']['count'](_0x104b88)[_0xcb43('0x22')](function(_0x2c2aa7){_0x15f3db['count']=_0x2c2aa7;if(_0x3976b2['query']['includeAll']){_0x446f09[_0xcb43('0x50')]=[{'all':!![]}];}return db[_0xcb43('0x3e')][_0xcb43('0x51')](_0x446f09);})[_0xcb43('0x22')](function(_0x39b448){_0x15f3db['rows']=_0x39b448;return _0x15f3db;})[_0xcb43('0x22')](respondWithFilteredResult(_0x183aa6,_0x446f09))['catch'](handleError(_0x183aa6,null));};exports[_0xcb43('0x52')]=function(_0x299322,_0x2cf704){var _0x36df76={'raw':!![],'where':{'id':_0x299322[_0xcb43('0x53')]['id']}},_0x4fd6f8={};_0x4fd6f8['model']=_[_0xcb43('0x41')](db[_0xcb43('0x3e')][_0xcb43('0x54')]);_0x4fd6f8[_0xcb43('0x42')]=_[_0xcb43('0x41')](_0x299322[_0xcb43('0x42')]);_0x4fd6f8[_0xcb43('0x43')]=_[_0xcb43('0x44')](_0x4fd6f8['model'],_0x4fd6f8[_0xcb43('0x42')]);_0x36df76['attributes']=_[_0xcb43('0x44')](_0x4fd6f8['model'],qs[_0xcb43('0x46')](_0x299322[_0xcb43('0x42')][_0xcb43('0x46')]));_0x36df76[_0xcb43('0x45')]=_0x36df76['attributes'][_0xcb43('0x47')]?_0x36df76[_0xcb43('0x45')]:_0x4fd6f8[_0xcb43('0x40')];if(_0x299322[_0xcb43('0x42')][_0xcb43('0x55')]){_0x36df76['include']=[{'all':!![]}];}_0x36df76=_[_0xcb43('0x4f')]({},_0x36df76,_0x299322[_0xcb43('0x56')]);return db[_0xcb43('0x3e')]['find'](_0x36df76)['then'](handleEntityNotFound(_0x2cf704,null))[_0xcb43('0x22')](respondWithResult(_0x2cf704,null))['catch'](handleError(_0x2cf704,null));};exports[_0xcb43('0x57')]=function(_0x6df34,_0x517396){return db[_0xcb43('0x3e')][_0xcb43('0x57')](_0x6df34[_0xcb43('0x58')],{})[_0xcb43('0x22')](respondWithResult(_0x517396,0xc9))[_0xcb43('0x2d')](handleError(_0x517396,null));};exports[_0xcb43('0x38')]=function(_0x3c3449,_0x3b2917){if(_0x3c3449['body']['id']){delete _0x3c3449['body']['id'];}return db[_0xcb43('0x3e')][_0xcb43('0x59')]({'where':{'id':_0x3c3449[_0xcb43('0x53')]['id']}})['then'](handleEntityNotFound(_0x3b2917,null))['then'](saveUpdates(_0x3c3449[_0xcb43('0x58')],null))[_0xcb43('0x22')](respondWithResult(_0x3b2917,null))[_0xcb43('0x2d')](handleError(_0x3b2917,null));};exports[_0xcb43('0x39')]=function(_0x20e33d,_0x5a6497){return db[_0xcb43('0x3e')]['find']({'where':{'id':_0x20e33d['params']['id']}})[_0xcb43('0x22')](handleEntityNotFound(_0x5a6497,null))[_0xcb43('0x22')](removeEntity(_0x5a6497,null))[_0xcb43('0x2d')](handleError(_0x5a6497,null));};exports['describe']=function(_0x23c3ff,_0x115d72){return db['SmsMessage'][_0xcb43('0x5a')]()[_0xcb43('0x22')](respondWithResult(_0x115d72,null))['catch'](handleError(_0x115d72,null));};var interaction_log=require(_0xcb43('0x16'))(_0xcb43('0x5b'));exports[_0xcb43('0x5c')]=function(_0x3bbfa0,_0x423ca6,_0x1cff71){var _0x2c350f={'agent':{},'channel':'sms'};if(_0x3bbfa0[_0xcb43('0x58')]['id']){delete _0x3bbfa0['body']['id'];}_0x3bbfa0[_0xcb43('0x58')][_0xcb43('0x5d')]=!![];_0x3bbfa0[_0xcb43('0x58')][_0xcb43('0x5e')]=moment()['format'](_0xcb43('0x5f'));_0x3bbfa0[_0xcb43('0x58')]['UserId']=_0x3bbfa0[_0xcb43('0x58')][_0xcb43('0x60')]||_0x3bbfa0[_0xcb43('0x61')]['id'];_0x2c350f[_0xcb43('0x62')]['id']=_0x3bbfa0['body'][_0xcb43('0x60')];return db[_0xcb43('0x3e')]['find']({'where':{'id':_0x3bbfa0['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x423ca6,null))[_0xcb43('0x22')](saveUpdates(_0x3bbfa0[_0xcb43('0x58')],null))[_0xcb43('0x22')](function(_0x5c8cf7){if(_0x5c8cf7){_0x2c350f[_0xcb43('0x2b')]=_0x5c8cf7[_0xcb43('0x63')]({'plain':!![]});return db[_0xcb43('0x64')][_0xcb43('0x59')]({'where':{'id':_0x5c8cf7[_0xcb43('0x65')]}});}return null;})[_0xcb43('0x22')](handleEntityNotFound(_0x423ca6,null))[_0xcb43('0x22')](function(_0x167db3){if(_0x167db3){return _0x167db3[_0xcb43('0x38')]({'UserId':_0x3bbfa0['body'][_0xcb43('0x60')],'read1stAt':_[_0xcb43('0x66')](_0x167db3[_0xcb43('0x67')])?moment()[_0xcb43('0x68')](_0xcb43('0x5f')):undefined});}return null;})['then'](function(_0x9b7a77){if(_0x9b7a77){_0x2c350f[_0xcb43('0x69')]=_0x9b7a77[_0xcb43('0x63')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3bbfa0[_0xcb43('0x61')]['id'],_0x3bbfa0[_0xcb43('0x61')][_0xcb43('0x3b')],_0x3bbfa0['user'][_0xcb43('0x6a')],_0x2c350f['interaction']['id'],_0x3bbfa0[_0xcb43('0x58')]?JSON[_0xcb43('0x28')](_0x3bbfa0[_0xcb43('0x58')]):_0xcb43('0x6b'));return respondWithRpcPromise(_0xcb43('0x6c'),_0xcb43('0x6d'),_0x2c350f);}return null;})[_0xcb43('0x22')](function(_0xc6a5a1){var _0x5e6b5d=_0xcb43('0x6e')+_0xc6a5a1[_0xcb43('0x2b')][_0xcb43('0x6f')];return db[_0xcb43('0x70')]['query'](_0x5e6b5d,{'type':db[_0xcb43('0x71')][_0xcb43('0x72')]['SELECT'],'raw':!![]})[_0xcb43('0x22')](function(_0x3c1543){return _0x3c1543;});})[_0xcb43('0x22')](function(_0x6fce12){if(_0x6fce12){_0x2c350f[_0xcb43('0x2b')][_0xcb43('0x73')]=_0x6fce12[0x0];if(!_0x3bbfa0[_0xcb43('0x58')]['UserId'])return;return db[_0xcb43('0x74')]['find']({'where':{'id':_0x3bbfa0[_0xcb43('0x58')][_0xcb43('0x60')],'role':_0xcb43('0x62')},'attributes':['id','name',_0xcb43('0x75'),_0xcb43('0x76'),_0xcb43('0x77')],'raw':!![]});}return null;})['then'](function(_0x511371){if(!_0x511371)return null;_0x2c350f[_0xcb43('0x2b')][_0xcb43('0x62')]=_0x511371;return _0x2c350f;})['then'](function(_0x925811){if(_0x925811){if(_0x3bbfa0[_0xcb43('0x58')][_0xcb43('0x78')]){_0x2c350f[_0xcb43('0x2b')][_0xcb43('0x79')]=util[_0xcb43('0x68')]('SIP/%s',_0x3bbfa0[_0xcb43('0x61')][_0xcb43('0x3b')]);_0x2c350f[_0xcb43('0x2b')][_0xcb43('0x7a')]=_0x2c350f[_0xcb43('0x7a')];_0x2c350f[_0xcb43('0x2b')]['motionChannel']=_0x2c350f[_0xcb43('0x7a')];_0x2c350f['message'][_0xcb43('0x7b')]=_0xcb43('0x5c');return respondWithRpcPromise(_0xcb43('0x7c'),'EventManager',{'event':_0xcb43('0x7d'),'message':_0x2c350f['message']},client9002)[_0xcb43('0x22')](function(){return _0x2c350f;});}return _0x2c350f;}return null;})[_0xcb43('0x22')](respondWithResult(_0x423ca6,null))[_0xcb43('0x2d')](handleError(_0x423ca6,null));};var interaction_log=require(_0xcb43('0x16'))(_0xcb43('0x5b'));exports['reject']=function(_0x244ebd,_0x1ba729,_0x562eef){var _0x3daf08={'agent':{},'channel':'sms'};if(_0x244ebd['body']['id']){delete _0x244ebd[_0xcb43('0x58')]['id'];}_0x244ebd['body']['UserId']=_0x244ebd[_0xcb43('0x58')]['UserId']||_0x244ebd['user']['id'];_0x3daf08[_0xcb43('0x62')]['id']=_0x244ebd[_0xcb43('0x58')][_0xcb43('0x60')];return db[_0xcb43('0x3e')][_0xcb43('0x59')]({'where':{'id':_0x244ebd[_0xcb43('0x53')]['id'],'UserId':null}})[_0xcb43('0x22')](handleEntityNotFound(_0x1ba729,null))[_0xcb43('0x22')](function(_0x2b727c){if(_0x2b727c){_0x3daf08[_0xcb43('0x2b')]=_0x2b727c[_0xcb43('0x63')]({'plain':!![]});return db[_0xcb43('0x64')][_0xcb43('0x59')]({'where':{'id':_0x2b727c[_0xcb43('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x1ba729,null))[_0xcb43('0x22')](function(_0x44cb53){if(_0x44cb53){_0x3daf08[_0xcb43('0x69')]=_0x44cb53[_0xcb43('0x63')]({'plain':!![]});interaction_log[_0xcb43('0x23')](_0xcb43('0x7e'),_0x244ebd[_0xcb43('0x61')]['id'],_0x244ebd[_0xcb43('0x61')][_0xcb43('0x3b')],_0x244ebd[_0xcb43('0x61')][_0xcb43('0x6a')],_0x3daf08[_0xcb43('0x69')]['id'],_0x244ebd[_0xcb43('0x58')]?JSON[_0xcb43('0x28')](_0x244ebd[_0xcb43('0x58')]):'null');return respondWithRpcPromise('RejectMessage','rejectMessage',_0x3daf08);}return null;})['then'](function(_0x505040){var _0x2f3b36=_0xcb43('0x6e')+_0x505040[_0xcb43('0x2b')][_0xcb43('0x6f')];return db['sequelize'][_0xcb43('0x42')](_0x2f3b36,{'type':db[_0xcb43('0x71')][_0xcb43('0x72')][_0xcb43('0x7f')],'raw':!![]})['then'](function(_0x822d0b){return _0x822d0b;});})[_0xcb43('0x22')](function(_0xd56087){if(_0xd56087){_0x3daf08['message'][_0xcb43('0x73')]=_0xd56087[0x0];if(!_0x244ebd[_0xcb43('0x58')][_0xcb43('0x60')])return;return db[_0xcb43('0x74')][_0xcb43('0x59')]({'where':{'id':_0x244ebd[_0xcb43('0x58')][_0xcb43('0x60')],'role':_0xcb43('0x62')},'attributes':['id',_0xcb43('0x3b'),_0xcb43('0x75'),'email',_0xcb43('0x77')],'raw':!![]});}return null;})[_0xcb43('0x22')](function(_0x486f06){if(!_0x486f06)return null;_0x3daf08[_0xcb43('0x2b')]['agent']=_0x486f06;return _0x3daf08;})[_0xcb43('0x22')](function(_0x1eb5cf){if(_0x1eb5cf){_0x1eb5cf[_0xcb43('0x2b')][_0xcb43('0x79')]=util[_0xcb43('0x68')](_0xcb43('0x80'),_0x244ebd[_0xcb43('0x61')][_0xcb43('0x3b')]);_0x1eb5cf['message'][_0xcb43('0x7a')]=_0x3daf08[_0xcb43('0x7a')];_0x1eb5cf['message']['motionChannel']=_0x3daf08[_0xcb43('0x7a')];_0x1eb5cf[_0xcb43('0x2b')]['event']='reject';respondWithRpcPromise(_0xcb43('0x7c'),_0xcb43('0x7c'),{'event':_0xcb43('0x81'),'message':_0x1eb5cf[_0xcb43('0x2b')]},client9002);return _0x3daf08;}return null;})['then'](respondWithResult(_0x1ba729,null))[_0xcb43('0x2d')](handleError(_0x1ba729,null));};exports['status']=function(_0x1725cf,_0x357601,_0x529470){if(_0x1725cf[_0xcb43('0x58')]['id']){delete _0x1725cf[_0xcb43('0x58')]['id'];}var _0x940d10;return db[_0xcb43('0x3e')][_0xcb43('0x59')]({'where':{'id':_0x1725cf[_0xcb43('0x53')]['id']}})[_0xcb43('0x22')](handleEntityNotFound(_0x357601,null))[_0xcb43('0x22')](function(_0x541b65){if(_0x541b65){_0x940d10=_0x541b65;return db[_0xcb43('0x82')]['find']({'where':{'id':_0x541b65[_0xcb43('0x83')]}});}})[_0xcb43('0x22')](handleEntityNotFound(_0x357601,null))['then'](function(_0x33ed19){if(_0x33ed19){logger[_0xcb43('0x26')](_0xcb43('0x27'),_0xcb43('0x2f'),_0xcb43('0x84'),_0x33ed19[_0xcb43('0x3f')],util[_0xcb43('0x85')](_0x1725cf['body'],{'showHidden':![],'depth':null}));switch(_0x33ed19[_0xcb43('0x3f')]){case _0xcb43('0x86'):if(_0x1725cf[_0xcb43('0x58')]['MessageSid']&&_0x1725cf['body'][_0xcb43('0x87')]===_0x940d10[_0xcb43('0x88')]){return _0x940d10[_0xcb43('0x38')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xcb43('0x2f'),'twilio',util[_0xcb43('0x85')](_0x1725cf[_0xcb43('0x58')],{'showHidden':![],'depth':null}));}break;case _0xcb43('0x89'):if(_0x1725cf[_0xcb43('0x58')][_0xcb43('0x8a')]&&_0x1725cf['body'][_0xcb43('0x8a')]===_0x940d10['messageId']&&_[_0xcb43('0x8b')]([_0xcb43('0x8c'),_0xcb43('0x8d')],_0x1725cf[_0xcb43('0x58')][_0xcb43('0x8e')])>=0x0){return _0x940d10[_0xcb43('0x38')]({'read':!![]});}else{logger[_0xcb43('0x29')](_0xcb43('0x8f'),_0xcb43('0x2f'),_0xcb43('0x90'),util[_0xcb43('0x85')](_0x1725cf[_0xcb43('0x58')],{'showHidden':![],'depth':null}));}break;case _0xcb43('0x91'):var _0x2539c1=_0x1725cf[_0xcb43('0x58')]['results'][0x0];if(_0x2539c1[_0xcb43('0x2f')][_0xcb43('0x92')]===_0xcb43('0x93')){return _0x940d10[_0xcb43('0x38')]({'read':!![]});}else{logger[_0xcb43('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xcb43('0x2f'),_0xcb43('0x91'),util[_0xcb43('0x85')](_0x1725cf[_0xcb43('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x940d10;}})[_0xcb43('0x22')](respondWithResult(_0x357601,null))[_0xcb43('0x2d')](handleError(_0x357601,null));}; \ No newline at end of file +var _0xf604=['then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','stack','send','index','map','rawAttributes','fieldName','key','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','type','options','SmsMessage','includeAll','include','findAll','find','create','body','params','describe','sms-interactions','accept','sms','read','readAt','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','format','YYYY-MM-DD\x20HH:mm:ss','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','fullname','email','internal','manual','interface','SIP/%s','channel','EventManager','acceptmessage','role','null','RejectMessage','rejectMessage','ContactId','SELECT','User','motionChannel','event','rejectmessage','SmsAccount','SmsAccountId','debug','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','Status','plivio','results','groupName','DELIVERED','infobip','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','http','client','request'];(function(_0x54a892,_0x1a4eeb){var _0x1f24f1=function(_0x2044d5){while(--_0x2044d5){_0x54a892['push'](_0x54a892['shift']());}};_0x1f24f1(++_0x1a4eeb);}(_0xf604,0x1a4));var _0x4f60=function(_0x4f0317,_0xb2e5a1){_0x4f0317=_0x4f0317-0x0;var _0x4e24e3=_0xf604[_0x4f0317];return _0x4e24e3;};'use strict';var emlformat=require(_0x4f60('0x0'));var rimraf=require(_0x4f60('0x1'));var zipdir=require(_0x4f60('0x2'));var jsonpatch=require(_0x4f60('0x3'));var rp=require(_0x4f60('0x4'));var moment=require(_0x4f60('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4f60('0x6'));var path=require(_0x4f60('0x7'));var sox=require(_0x4f60('0x8'));var csv=require(_0x4f60('0x9'));var ejs=require(_0x4f60('0xa'));var fs=require('fs');var fs_extra=require(_0x4f60('0xb'));var _=require(_0x4f60('0xc'));var squel=require('squel');var crypto=require(_0x4f60('0xd'));var jsforce=require(_0x4f60('0xe'));var deskjs=require(_0x4f60('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4f60('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4f60('0x11'));var as=require(_0x4f60('0x12'));var hardwareService=require(_0x4f60('0x13'));var logger=require(_0x4f60('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4f60('0x15'));var db=require(_0x4f60('0x16'))['db'];config[_0x4f60('0x17')]=_[_0x4f60('0x18')](config['redis'],{'host':_0x4f60('0x19'),'port':0x18eb});var socket=require(_0x4f60('0x1a'))(new Redis(config['redis']));require(_0x4f60('0x1b'))[_0x4f60('0x1c')](socket);var jayson=require(_0x4f60('0x1d'));var client=jayson['client'][_0x4f60('0x1e')]({'port':0x232c});var client9002=jayson[_0x4f60('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x241569,_0xb34938,_0x10a431,_0x45598f){return new BPromise(function(_0x5a93e9,_0x1a4f66){var _0x47d38d=_0x45598f||client;return _0x47d38d[_0x4f60('0x20')](_0x241569,_0x10a431)[_0x4f60('0x21')](function(_0x529f4e){logger[_0x4f60('0x22')](_0x4f60('0x23'),_0xb34938,_0x4f60('0x24'));logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb34938,_0x4f60('0x24'),JSON['stringify'](_0x529f4e));if(_0x529f4e['error']){if(_0x529f4e[_0x4f60('0x25')][_0x4f60('0x26')]===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0xb34938,_0x529f4e['error'][_0x4f60('0x27')]);return _0x1a4f66(_0x529f4e[_0x4f60('0x25')][_0x4f60('0x27')]);}logger['error'](_0x4f60('0x23'),_0xb34938,_0x529f4e[_0x4f60('0x25')][_0x4f60('0x27')]);return _0x5a93e9(_0x529f4e[_0x4f60('0x25')][_0x4f60('0x27')]);}else{logger[_0x4f60('0x22')](_0x4f60('0x23'),_0xb34938,_0x4f60('0x24'));_0x5a93e9(_0x529f4e[_0x4f60('0x28')]['message']);}})[_0x4f60('0x29')](function(_0x5116e1){logger[_0x4f60('0x25')](_0x4f60('0x23'),_0xb34938,_0x5116e1);_0x1a4f66(_0x5116e1);});});}function respondWithStatusCode(_0x4b590d,_0xc7da86){_0xc7da86=_0xc7da86||0xcc;return function(_0x373585){if(_0x373585){return _0x4b590d[_0x4f60('0x2a')](_0xc7da86);}return _0x4b590d[_0x4f60('0x2b')](_0xc7da86)[_0x4f60('0x2c')]();};}function respondWithResult(_0x3b24b8,_0x458625){_0x458625=_0x458625||0xc8;return function(_0x52237d){if(_0x52237d){return _0x3b24b8[_0x4f60('0x2b')](_0x458625)['json'](_0x52237d);}};}function respondWithFilteredResult(_0x2c01ec,_0x123d51){return function(_0x1502c1){if(_0x1502c1){var _0x3c2d09=typeof _0x123d51[_0x4f60('0x2d')]===_0x4f60('0x2e')&&typeof _0x123d51[_0x4f60('0x2f')]===_0x4f60('0x2e');var _0x197af4=_0x1502c1[_0x4f60('0x30')];var _0x44b642=_0x3c2d09?0x0:_0x123d51[_0x4f60('0x2d')];var _0x10779a=_0x3c2d09?_0x1502c1[_0x4f60('0x30')]:_0x123d51[_0x4f60('0x2d')]+_0x123d51['limit'];var _0x52ce28;if(_0x10779a>=_0x197af4){_0x10779a=_0x197af4;_0x52ce28=0xc8;}else{_0x52ce28=0xce;}_0x2c01ec['status'](_0x52ce28);return _0x2c01ec[_0x4f60('0x31')]('Content-Range',_0x44b642+'-'+_0x10779a+'/'+_0x197af4)[_0x4f60('0x32')](_0x1502c1);}return null;};}function patchUpdates(_0x460428){return function(_0x361add){try{jsonpatch[_0x4f60('0x33')](_0x361add,_0x460428,!![]);}catch(_0x454b66){return BPromise[_0x4f60('0x34')](_0x454b66);}return _0x361add[_0x4f60('0x35')]();};}function saveUpdates(_0x3347e2,_0x53b887){return function(_0x5bf2d9){if(_0x5bf2d9){return _0x5bf2d9[_0x4f60('0x36')](_0x3347e2)[_0x4f60('0x21')](function(_0x1a2d98){return _0x1a2d98;});}return null;};}function removeEntity(_0x5d802d,_0x241c5e){return function(_0x236f65){if(_0x236f65){return _0x236f65[_0x4f60('0x37')]()['then'](function(){_0x5d802d[_0x4f60('0x2b')](0xcc)[_0x4f60('0x2c')]();});}};}function handleEntityNotFound(_0xba1a64,_0x4073f4){return function(_0x2a94aa){if(!_0x2a94aa){_0xba1a64[_0x4f60('0x2a')](0x194);}return _0x2a94aa;};}function handleError(_0x509375,_0x215bde){_0x215bde=_0x215bde||0x1f4;return function(_0x2938b4){logger[_0x4f60('0x25')](_0x2938b4[_0x4f60('0x38')]);if(_0x2938b4['name']){delete _0x2938b4['name'];}_0x509375[_0x4f60('0x2b')](_0x215bde)[_0x4f60('0x39')](_0x2938b4);};}exports[_0x4f60('0x3a')]=function(_0x22cbb5,_0x2a97c0){var _0x37706a={},_0x1732d4={},_0xe74d92={'count':0x0,'rows':[]};var _0x433e5f=_[_0x4f60('0x3b')](db['SmsMessage'][_0x4f60('0x3c')],function(_0x4a4fa0){return{'name':_0x4a4fa0[_0x4f60('0x3d')],'type':_0x4a4fa0['type'][_0x4f60('0x3e')]};});_0x1732d4[_0x4f60('0x3f')]=_[_0x4f60('0x3b')](_0x433e5f,_0x4f60('0x40'));_0x1732d4[_0x4f60('0x41')]=_[_0x4f60('0x42')](_0x22cbb5[_0x4f60('0x41')]);_0x1732d4['filters']=_[_0x4f60('0x43')](_0x1732d4[_0x4f60('0x3f')],_0x1732d4['query']);_0x37706a[_0x4f60('0x44')]=_[_0x4f60('0x43')](_0x1732d4[_0x4f60('0x3f')],qs[_0x4f60('0x45')](_0x22cbb5[_0x4f60('0x41')][_0x4f60('0x45')]));_0x37706a[_0x4f60('0x44')]=_0x37706a[_0x4f60('0x44')][_0x4f60('0x46')]?_0x37706a['attributes']:_0x1732d4['model'];if(!_0x22cbb5[_0x4f60('0x41')][_0x4f60('0x47')](_0x4f60('0x48'))){_0x37706a[_0x4f60('0x2f')]=qs[_0x4f60('0x2f')](_0x22cbb5[_0x4f60('0x41')]['limit']);_0x37706a[_0x4f60('0x2d')]=qs[_0x4f60('0x2d')](_0x22cbb5[_0x4f60('0x41')]['offset']);}_0x37706a[_0x4f60('0x49')]=qs['sort'](_0x22cbb5[_0x4f60('0x41')]['sort']);_0x37706a[_0x4f60('0x4a')]=qs[_0x4f60('0x4b')](_[_0x4f60('0x4c')](_0x22cbb5[_0x4f60('0x41')],_0x1732d4['filters']),_0x433e5f);if(_0x22cbb5[_0x4f60('0x41')][_0x4f60('0x4d')]){_0x37706a[_0x4f60('0x4a')]=_[_0x4f60('0x4e')](_0x37706a[_0x4f60('0x4a')],{'$or':_[_0x4f60('0x3b')](_0x433e5f,function(_0x44094c){if(_0x44094c[_0x4f60('0x4f')]!=='VIRTUAL'){var _0xf78967={};_0xf78967[_0x44094c[_0x4f60('0x40')]]={'$like':'%'+_0x22cbb5['query']['filter']+'%'};return _0xf78967;}})});}_0x37706a=_[_0x4f60('0x4e')]({},_0x37706a,_0x22cbb5[_0x4f60('0x50')]);var _0x2d69c2={'where':_0x37706a[_0x4f60('0x4a')]};return db[_0x4f60('0x51')][_0x4f60('0x30')](_0x2d69c2)[_0x4f60('0x21')](function(_0x15449f){_0xe74d92[_0x4f60('0x30')]=_0x15449f;if(_0x22cbb5[_0x4f60('0x41')][_0x4f60('0x52')]){_0x37706a[_0x4f60('0x53')]=[{'all':!![]}];}return db[_0x4f60('0x51')][_0x4f60('0x54')](_0x37706a);})[_0x4f60('0x21')](function(_0x55e017){_0xe74d92['rows']=_0x55e017;return _0xe74d92;})[_0x4f60('0x21')](respondWithFilteredResult(_0x2a97c0,_0x37706a))[_0x4f60('0x29')](handleError(_0x2a97c0,null));};exports['show']=function(_0x486731,_0x53e439){var _0x282d88={'raw':!![],'where':{'id':_0x486731['params']['id']}},_0x4aa035={};_0x4aa035[_0x4f60('0x3f')]=_['keys'](db[_0x4f60('0x51')][_0x4f60('0x3c')]);_0x4aa035[_0x4f60('0x41')]=_[_0x4f60('0x42')](_0x486731[_0x4f60('0x41')]);_0x4aa035['filters']=_[_0x4f60('0x43')](_0x4aa035[_0x4f60('0x3f')],_0x4aa035[_0x4f60('0x41')]);_0x282d88[_0x4f60('0x44')]=_[_0x4f60('0x43')](_0x4aa035[_0x4f60('0x3f')],qs[_0x4f60('0x45')](_0x486731[_0x4f60('0x41')]['fields']));_0x282d88[_0x4f60('0x44')]=_0x282d88[_0x4f60('0x44')][_0x4f60('0x46')]?_0x282d88['attributes']:_0x4aa035[_0x4f60('0x3f')];if(_0x486731['query'][_0x4f60('0x52')]){_0x282d88[_0x4f60('0x53')]=[{'all':!![]}];}_0x282d88=_[_0x4f60('0x4e')]({},_0x282d88,_0x486731[_0x4f60('0x50')]);return db[_0x4f60('0x51')][_0x4f60('0x55')](_0x282d88)[_0x4f60('0x21')](handleEntityNotFound(_0x53e439,null))['then'](respondWithResult(_0x53e439,null))[_0x4f60('0x29')](handleError(_0x53e439,null));};exports['create']=function(_0x30e6c1,_0x55a3a7){return db[_0x4f60('0x51')][_0x4f60('0x56')](_0x30e6c1[_0x4f60('0x57')],{})['then'](respondWithResult(_0x55a3a7,0xc9))['catch'](handleError(_0x55a3a7,null));};exports[_0x4f60('0x36')]=function(_0x370a16,_0x5b83ef){if(_0x370a16[_0x4f60('0x57')]['id']){delete _0x370a16[_0x4f60('0x57')]['id'];}return db[_0x4f60('0x51')][_0x4f60('0x55')]({'where':{'id':_0x370a16[_0x4f60('0x58')]['id']}})[_0x4f60('0x21')](handleEntityNotFound(_0x5b83ef,null))['then'](saveUpdates(_0x370a16[_0x4f60('0x57')],null))[_0x4f60('0x21')](respondWithResult(_0x5b83ef,null))[_0x4f60('0x29')](handleError(_0x5b83ef,null));};exports[_0x4f60('0x37')]=function(_0xbab734,_0x23caca){return db[_0x4f60('0x51')][_0x4f60('0x55')]({'where':{'id':_0xbab734['params']['id']}})[_0x4f60('0x21')](handleEntityNotFound(_0x23caca,null))[_0x4f60('0x21')](removeEntity(_0x23caca,null))[_0x4f60('0x29')](handleError(_0x23caca,null));};exports[_0x4f60('0x59')]=function(_0x54ea2d,_0x2ec399){return db[_0x4f60('0x51')][_0x4f60('0x59')]()[_0x4f60('0x21')](respondWithResult(_0x2ec399,null))[_0x4f60('0x29')](handleError(_0x2ec399,null));};var interaction_log=require(_0x4f60('0x14'))(_0x4f60('0x5a'));exports[_0x4f60('0x5b')]=function(_0x552dee,_0x1dacd9,_0x17280a){var _0x2d2841={'agent':{},'channel':_0x4f60('0x5c')};if(_0x552dee[_0x4f60('0x57')]['id']){delete _0x552dee[_0x4f60('0x57')]['id'];}_0x552dee[_0x4f60('0x57')][_0x4f60('0x5d')]=!![];_0x552dee[_0x4f60('0x57')][_0x4f60('0x5e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x552dee[_0x4f60('0x57')][_0x4f60('0x5f')]=_0x552dee[_0x4f60('0x57')][_0x4f60('0x5f')]||_0x552dee[_0x4f60('0x60')]['id'];_0x2d2841[_0x4f60('0x61')]['id']=_0x552dee[_0x4f60('0x57')][_0x4f60('0x5f')];return db[_0x4f60('0x51')][_0x4f60('0x55')]({'where':{'id':_0x552dee[_0x4f60('0x58')]['id'],'UserId':null}})[_0x4f60('0x21')](handleEntityNotFound(_0x1dacd9,null))[_0x4f60('0x21')](saveUpdates(_0x552dee[_0x4f60('0x57')],null))[_0x4f60('0x21')](function(_0x612555){if(_0x612555){_0x2d2841['message']=_0x612555[_0x4f60('0x62')]({'plain':!![]});return db[_0x4f60('0x63')]['find']({'where':{'id':_0x612555[_0x4f60('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x1dacd9,null))[_0x4f60('0x21')](function(_0x42246a){if(_0x42246a){return _0x42246a[_0x4f60('0x36')]({'UserId':_0x552dee[_0x4f60('0x57')][_0x4f60('0x5f')],'read1stAt':_[_0x4f60('0x65')](_0x42246a['read1stAt'])?moment()[_0x4f60('0x66')](_0x4f60('0x67')):undefined});}return null;})[_0x4f60('0x21')](function(_0x21d560){if(_0x21d560){_0x2d2841[_0x4f60('0x68')]=_0x21d560[_0x4f60('0x62')]({'plain':!![]});interaction_log[_0x4f60('0x22')](_0x4f60('0x69'),_0x552dee[_0x4f60('0x60')]['id'],_0x552dee['user'][_0x4f60('0x40')],_0x552dee[_0x4f60('0x60')]['role'],_0x2d2841['interaction']['id'],_0x552dee['body']?JSON[_0x4f60('0x6a')](_0x552dee[_0x4f60('0x57')]):'null');return respondWithRpcPromise(_0x4f60('0x6b'),_0x4f60('0x6c'),_0x2d2841);}return null;})[_0x4f60('0x21')](function(_0x530cb0){var _0x3e5881=_0x4f60('0x6d')+_0x530cb0['message']['ContactId'];return db[_0x4f60('0x6e')][_0x4f60('0x41')](_0x3e5881,{'type':db[_0x4f60('0x6f')][_0x4f60('0x70')]['SELECT'],'raw':!![]})['then'](function(_0x4db646){return _0x4db646;});})['then'](function(_0x455bd2){if(_0x455bd2){_0x2d2841['message']['contact']=_0x455bd2[0x0];if(!_0x552dee['body'][_0x4f60('0x5f')])return;return db['User']['find']({'where':{'id':_0x552dee[_0x4f60('0x57')]['UserId'],'role':_0x4f60('0x61')},'attributes':['id',_0x4f60('0x40'),_0x4f60('0x71'),_0x4f60('0x72'),_0x4f60('0x73')],'raw':!![]});}return null;})[_0x4f60('0x21')](function(_0x331348){if(!_0x331348)return null;_0x2d2841[_0x4f60('0x27')]['agent']=_0x331348;return _0x2d2841;})[_0x4f60('0x21')](function(_0x5bdab2){if(_0x5bdab2){if(_0x552dee['body'][_0x4f60('0x74')]){_0x2d2841[_0x4f60('0x27')][_0x4f60('0x75')]=util[_0x4f60('0x66')](_0x4f60('0x76'),_0x552dee[_0x4f60('0x60')][_0x4f60('0x40')]);_0x2d2841['message'][_0x4f60('0x77')]=_0x2d2841['channel'];_0x2d2841[_0x4f60('0x27')]['motionChannel']=_0x2d2841['channel'];_0x2d2841[_0x4f60('0x27')]['event']=_0x4f60('0x5b');return respondWithRpcPromise(_0x4f60('0x78'),_0x4f60('0x78'),{'event':_0x4f60('0x79'),'message':_0x2d2841[_0x4f60('0x27')]},client9002)['then'](function(){return _0x2d2841;});}return _0x2d2841;}return null;})[_0x4f60('0x21')](respondWithResult(_0x1dacd9,null))[_0x4f60('0x29')](handleError(_0x1dacd9,null));};var interaction_log=require(_0x4f60('0x14'))(_0x4f60('0x5a'));exports[_0x4f60('0x34')]=function(_0x23325c,_0xa4bfca,_0x189700){var _0x212e58={'agent':{},'channel':'sms'};if(_0x23325c['body']['id']){delete _0x23325c['body']['id'];}_0x23325c[_0x4f60('0x57')][_0x4f60('0x5f')]=_0x23325c['body']['UserId']||_0x23325c[_0x4f60('0x60')]['id'];_0x212e58[_0x4f60('0x61')]['id']=_0x23325c['body'][_0x4f60('0x5f')];return db[_0x4f60('0x51')][_0x4f60('0x55')]({'where':{'id':_0x23325c['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0xa4bfca,null))[_0x4f60('0x21')](function(_0xb3a634){if(_0xb3a634){_0x212e58[_0x4f60('0x27')]=_0xb3a634['get']({'plain':!![]});return db[_0x4f60('0x63')][_0x4f60('0x55')]({'where':{'id':_0xb3a634[_0x4f60('0x64')]}});}return null;})[_0x4f60('0x21')](handleEntityNotFound(_0xa4bfca,null))[_0x4f60('0x21')](function(_0x585a9c){if(_0x585a9c){_0x212e58['interaction']=_0x585a9c[_0x4f60('0x62')]({'plain':!![]});interaction_log[_0x4f60('0x22')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x23325c['user']['id'],_0x23325c[_0x4f60('0x60')][_0x4f60('0x40')],_0x23325c[_0x4f60('0x60')][_0x4f60('0x7a')],_0x212e58[_0x4f60('0x68')]['id'],_0x23325c[_0x4f60('0x57')]?JSON[_0x4f60('0x6a')](_0x23325c['body']):_0x4f60('0x7b'));return respondWithRpcPromise(_0x4f60('0x7c'),_0x4f60('0x7d'),_0x212e58);}return null;})[_0x4f60('0x21')](function(_0x17d708){var _0xb0f2f='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x17d708[_0x4f60('0x27')][_0x4f60('0x7e')];return db[_0x4f60('0x6e')][_0x4f60('0x41')](_0xb0f2f,{'type':db['Sequelize'][_0x4f60('0x70')][_0x4f60('0x7f')],'raw':!![]})[_0x4f60('0x21')](function(_0x4f8766){return _0x4f8766;});})['then'](function(_0x427756){if(_0x427756){_0x212e58[_0x4f60('0x27')]['contact']=_0x427756[0x0];if(!_0x23325c[_0x4f60('0x57')][_0x4f60('0x5f')])return;return db[_0x4f60('0x80')][_0x4f60('0x55')]({'where':{'id':_0x23325c[_0x4f60('0x57')][_0x4f60('0x5f')],'role':_0x4f60('0x61')},'attributes':['id',_0x4f60('0x40'),_0x4f60('0x71'),_0x4f60('0x72'),_0x4f60('0x73')],'raw':!![]});}return null;})['then'](function(_0x154459){if(!_0x154459)return null;_0x212e58[_0x4f60('0x27')]['agent']=_0x154459;return _0x212e58;})[_0x4f60('0x21')](function(_0x46dba7){if(_0x46dba7){_0x46dba7[_0x4f60('0x27')][_0x4f60('0x75')]=util['format'](_0x4f60('0x76'),_0x23325c['user'][_0x4f60('0x40')]);_0x46dba7[_0x4f60('0x27')][_0x4f60('0x77')]=_0x212e58[_0x4f60('0x77')];_0x46dba7[_0x4f60('0x27')][_0x4f60('0x81')]=_0x212e58[_0x4f60('0x77')];_0x46dba7['message'][_0x4f60('0x82')]=_0x4f60('0x34');respondWithRpcPromise(_0x4f60('0x78'),'EventManager',{'event':_0x4f60('0x83'),'message':_0x46dba7[_0x4f60('0x27')]},client9002);return _0x212e58;}return null;})['then'](respondWithResult(_0xa4bfca,null))[_0x4f60('0x29')](handleError(_0xa4bfca,null));};exports['status']=function(_0x1e7439,_0x1d6ea7,_0x2d05f9){if(_0x1e7439[_0x4f60('0x57')]['id']){delete _0x1e7439[_0x4f60('0x57')]['id'];}var _0x571c20;return db[_0x4f60('0x51')]['find']({'where':{'id':_0x1e7439[_0x4f60('0x58')]['id']}})[_0x4f60('0x21')](handleEntityNotFound(_0x1d6ea7,null))['then'](function(_0x373650){if(_0x373650){_0x571c20=_0x373650;return db[_0x4f60('0x84')][_0x4f60('0x55')]({'where':{'id':_0x373650[_0x4f60('0x85')]}});}})[_0x4f60('0x21')](handleEntityNotFound(_0x1d6ea7,null))[_0x4f60('0x21')](function(_0x2615b3){if(_0x2615b3){logger[_0x4f60('0x86')](_0x4f60('0x87'),_0x4f60('0x2b'),_0x4f60('0x88'),_0x2615b3[_0x4f60('0x4f')],util[_0x4f60('0x89')](_0x1e7439[_0x4f60('0x57')],{'showHidden':![],'depth':null}));switch(_0x2615b3[_0x4f60('0x4f')]){case'twilio':if(_0x1e7439[_0x4f60('0x57')][_0x4f60('0x8a')]&&_0x1e7439[_0x4f60('0x57')]['MessageSid']===_0x571c20[_0x4f60('0x8b')]){return _0x571c20[_0x4f60('0x36')]({'read':!![]});}else{logger['error'](_0x4f60('0x8c'),'status','twilio',util[_0x4f60('0x89')](_0x1e7439[_0x4f60('0x57')],{'showHidden':![],'depth':null}));}break;case _0x4f60('0x8d'):if(_0x1e7439[_0x4f60('0x57')]['MessageUUID']&&_0x1e7439['body'][_0x4f60('0x8e')]===_0x571c20[_0x4f60('0x8b')]&&_[_0x4f60('0x8f')]([_0x4f60('0x90'),'delivered'],_0x1e7439[_0x4f60('0x57')][_0x4f60('0x91')])>=0x0){return _0x571c20[_0x4f60('0x36')]({'read':!![]});}else{logger['error'](_0x4f60('0x8c'),_0x4f60('0x2b'),_0x4f60('0x92'),util[_0x4f60('0x89')](_0x1e7439[_0x4f60('0x57')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x14b552=_0x1e7439[_0x4f60('0x57')][_0x4f60('0x93')][0x0];if(_0x14b552[_0x4f60('0x2b')][_0x4f60('0x94')]===_0x4f60('0x95')){return _0x571c20[_0x4f60('0x36')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4f60('0x2b'),_0x4f60('0x96'),util[_0x4f60('0x89')](_0x1e7439[_0x4f60('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x571c20;}})['then'](respondWithResult(_0x1d6ea7,null))[_0x4f60('0x29')](handleError(_0x1d6ea7,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 7f059f6..1d8d0fc 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 _0xcd36=['hasOwnProperty','events','../../mysqldb','save','remove','emit'];(function(_0x4defd6,_0x37bbd3){var _0x4c9276=function(_0x1d7a3d){while(--_0x1d7a3d){_0x4defd6['push'](_0x4defd6['shift']());}};_0x4c9276(++_0x37bbd3);}(_0xcd36,0x1c3));var _0x6cd3=function(_0x480bcd,_0x408c23){_0x480bcd=_0x480bcd-0x0;var _0x354c9b=_0xcd36[_0x480bcd];return _0x354c9b;};'use strict';var EventEmitter=require(_0x6cd3('0x0'));var SmsMessage=require(_0x6cd3('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6cd3('0x2'),'afterUpdate':'update','afterDestroy':_0x6cd3('0x3')};function emitEvent(_0x366258){return function(_0x366413,_0x52a6be,_0x1d5dfd){SmsMessageEvents[_0x6cd3('0x4')](_0x366258+':'+_0x366413['id'],_0x366413);SmsMessageEvents['emit'](_0x366258,_0x366413);_0x1d5dfd(null);};}for(var e in events){if(events[_0x6cd3('0x5')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0xbe2b=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','SmsMessage'];(function(_0x56c3ce,_0x1f8b29){var _0x5a3866=function(_0x142a2f){while(--_0x142a2f){_0x56c3ce['push'](_0x56c3ce['shift']());}};_0x5a3866(++_0x1f8b29);}(_0xbe2b,0x7f));var _0xbbe2=function(_0x1283c0,_0x1512cb){_0x1283c0=_0x1283c0-0x0;var _0x27dc72=_0xbe2b[_0x1283c0];return _0x27dc72;};'use strict';var EventEmitter=require(_0xbbe2('0x0'));var SmsMessage=require(_0xbbe2('0x1'))['db'][_0xbbe2('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xbbe2('0x3')](0x0);var events={'afterCreate':_0xbbe2('0x4'),'afterUpdate':_0xbbe2('0x5'),'afterDestroy':_0xbbe2('0x6')};function emitEvent(_0xe1cfa5){return function(_0x20d83f,_0x188528,_0x10d1a5){SmsMessageEvents[_0xbbe2('0x7')](_0xe1cfa5+':'+_0x20d83f['id'],_0x20d83f);SmsMessageEvents[_0xbbe2('0x7')](_0xe1cfa5,_0x20d83f);_0x10d1a5(null);};}for(var e in events){if(events[_0xbbe2('0x8')](e)){var event=events[e];SmsMessage[_0xbbe2('0x9')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index d7fa9fd..6bdd1db 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 _0x6778=['skebby','username','smsMethod','sender','login?username=','&password=','password','GET','split','POST','user_key','session_key','internal_order_id','deliveryReport','read','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','connectel','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','infobip','/auth/1/session','baseUrl','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','apiKey','login','text','timestamp','keys','sort','length','createHash','md5','digest','signature=','/external/get/send.php?','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','message','Bearer\x20','refid','Token\x20not\x20received','finally','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./smsMessage.attributes','exports','define','sms_messages','messageId','fti_sms_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','update','createdAt','catch','SmsAccount','then','type','twilio','accountSid','authToken','phone','messages','create','body','remote','/api/sms/messages/','/status?token=','token','sid','error','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken'];(function(_0xfed19f,_0x510931){var _0x507042=function(_0x50d508){while(--_0x50d508){_0xfed19f['push'](_0xfed19f['shift']());}};_0x507042(++_0x510931);}(_0x6778,0x1bb));var _0x8677=function(_0x4953da,_0x5adaca){_0x4953da=_0x4953da-0x0;var _0x2d3780=_0x6778[_0x4953da];return _0x2d3780;};'use strict';var _=require(_0x8677('0x0'));var util=require(_0x8677('0x1'));var logger=require(_0x8677('0x2'))(_0x8677('0x3'));var moment=require(_0x8677('0x4'));var BPromise=require(_0x8677('0x5'));var rp=require(_0x8677('0x6'));var fs=require('fs');var path=require(_0x8677('0x7'));var rimraf=require(_0x8677('0x8'));var config=require('../../config/environment');var attributes=require(_0x8677('0x9'));module[_0x8677('0xa')]=function(_0x53033f,_0x4abbad){return _0x53033f[_0x8677('0xb')]('SmsMessage',attributes,{'tableName':_0x8677('0xc'),'paranoid':![],'indexes':[{'name':_0x8677('0xd'),'fields':[_0x8677('0xd')]},{'name':_0x8677('0xe'),'fields':['body'],'type':_0x8677('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x334357,_0x2ea6cb,_0x3c36b3){var _0x5d93c8=_0x53033f[_0x8677('0x10')];var _0x36ed8f=_0x334357[_0x8677('0x11')]({'plain':!![]});if(_0x36ed8f[_0x8677('0x12')][_0x8677('0x13')]()==='in'||_0x36ed8f[_0x8677('0x12')][_0x8677('0x13')]()===_0x8677('0x14')&&!_0x36ed8f[_0x8677('0x15')]&&!_[_0x8677('0x16')](_0x36ed8f[_0x8677('0x17')])&&!_[_0x8677('0x16')](_0x36ed8f[_0x8677('0x18')])){_0x5d93c8[_0x8677('0x19')]['findOne']({'where':{'id':_0x36ed8f[_0x8677('0x18')]}})['then'](function(_0x5c460c){if(_0x5c460c){_0x5c460c[_0x8677('0x1a')]({'lastMsgAt':_0x36ed8f[_0x8677('0x1b')],'lastMsgDirection':_0x36ed8f['direction'][_0x8677('0x13')]()});}})[_0x8677('0x1c')](function(_0x4a65dd){console['error'](_0x4a65dd);});}if(_0x36ed8f['direction']===_0x8677('0x14')&&!_0x36ed8f[_0x8677('0x15')]){var _0x51c107;_0x5d93c8[_0x8677('0x1d')]['find']({'where':{'id':_0x36ed8f['SmsAccountId']},'raw':!![]})[_0x8677('0x1e')](function(_0xe4c580){_0x51c107=_0xe4c580;if(_0x51c107&&_0x51c107[_0x8677('0x1f')]){switch(_0x51c107['type']){case _0x8677('0x20'):var _0x57949f=require(_0x8677('0x20'));if(_0x51c107[_0x8677('0x21')]&&_0x51c107[_0x8677('0x22')]&&_0x51c107[_0x8677('0x23')]){var _0x5907b3=new _0x57949f(_0x51c107[_0x8677('0x21')],_0x51c107[_0x8677('0x22')]);_0x5907b3[_0x8677('0x24')][_0x8677('0x25')]({'body':_0x36ed8f[_0x8677('0x26')],'to':_0x36ed8f[_0x8677('0x23')],'from':_0x51c107[_0x8677('0x23')],'statusCallback':_0x51c107[_0x8677('0x27')]+_0x8677('0x28')+_0x36ed8f['id']+_0x8677('0x29')+_0x51c107[_0x8677('0x2a')]})[_0x8677('0x1e')](function(_0x5f1af4){if(_0x5f1af4[_0x8677('0x2b')]){return _0x334357[_0x8677('0x1a')]({'messageId':_0x5f1af4[_0x8677('0x2b')]});}})[_0x8677('0x1c')](function(_0xfdf86e){logger[_0x8677('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8677('0x2d'),_0x8677('0x20'),util[_0x8677('0x2e')](_0xfdf86e,{'showHidden':![],'depth':null}));});}else{logger[_0x8677('0x2c')](_0x8677('0x2f'),_0x8677('0x2d'),_0x8677('0x20'),_0x8677('0x30'));}break;case _0x8677('0x31'):var _0x54e980='https://api.skebby.it/API/v1.0/REST/';if(_0x51c107[_0x8677('0x32')]&&_0x51c107['password']){var _0x35b1ab={'recipient':[_0x36ed8f[_0x8677('0x23')]],'message':_0x36ed8f[_0x8677('0x26')],'message_type':_0x51c107['smsMethod']};if(_0x51c107[_0x8677('0x33')]&&_0x51c107[_0x8677('0x33')]!=='SI'){_0x35b1ab[_0x8677('0x34')]=_0x51c107[_0x8677('0x23')];}var _0x252ef4={'url':_0x54e980+_0x8677('0x35')+_0x51c107[_0x8677('0x32')]+_0x8677('0x36')+_0x51c107[_0x8677('0x37')],'method':_0x8677('0x38')};rp(_0x252ef4)[_0x8677('0x1e')](function(_0x2f5fe2){var _0x48202a=_0x2f5fe2[_0x8677('0x39')](';');var _0x3991ef={'user_key':_0x48202a[0x0],'session_key':_0x48202a[0x1]};_0x252ef4={'url':_0x54e980+'sms','method':_0x8677('0x3a'),'headers':{'user_key':_0x3991ef[_0x8677('0x3b')],'Session_key':_0x3991ef[_0x8677('0x3c')]},'json':!![],'body':_0x35b1ab};return rp(_0x252ef4);})[_0x8677('0x1e')](function(_0x118543){if(_0x118543['total_sent']>=0x1){var _0x4eafbb={'messageId':_0x118543[_0x8677('0x3d')]};if(_0x51c107['smsMethod']!=='GP'||!_0x51c107[_0x8677('0x3e')]){_0x4eafbb[_0x8677('0x3f')]=!![];}return _0x334357[_0x8677('0x1a')](_0x4eafbb);}else{return logger['error'](_0x8677('0x2f'),_0x8677('0x2d'),_0x8677('0x31'),util[_0x8677('0x2e')](_0x118543,{'showHidden':![],'depth':null}));}})[_0x8677('0x1c')](function(_0x5617a){return logger[_0x8677('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x8677('0x31'),util[_0x8677('0x2e')](_0x5617a,{'showHidden':![],'depth':null}));});}else{logger[_0x8677('0x2c')](_0x8677('0x2f'),_0x8677('0x2d'),'skebby','Missing\x20parameters:\x20username,\x20password');}break;case'connectel':if(_0x51c107[_0x8677('0x22')]){var _0x452b6b={'recipient':_0x36ed8f[_0x8677('0x23')],'message':_0x36ed8f[_0x8677('0x26')],'sender':_0x51c107[_0x8677('0x40')]||_0x51c107[_0x8677('0x23')],'authorization':_0x51c107[_0x8677('0x22')]};var _0x2ea6cb={'method':_0x8677('0x3a'),'uri':_0x8677('0x41'),'body':_0x452b6b,'json':!![]};rp(_0x2ea6cb)[_0x8677('0x1e')](function(_0xd4062){var _0xa0d2a9={'messageId':_0xd4062[_0x8677('0x42')]};if(!_0x51c107[_0x8677('0x3e')]){_0xa0d2a9['read']=!![];}return _0x334357[_0x8677('0x1a')](_0xa0d2a9);})[_0x8677('0x1c')](function(_0x230e2c){logger[_0x8677('0x2c')](_0x8677('0x2f'),_0x8677('0x2d'),'connectel',util[_0x8677('0x2e')](_0x230e2c,{'showHidden':![],'depth':null}));});}else{logger[_0x8677('0x2c')](_0x8677('0x2f'),_0x8677('0x2d'),_0x8677('0x43'),'Missing\x20parameters:\x20authToken');}break;case _0x8677('0x44'):if(_0x51c107[_0x8677('0x32')]&&_0x51c107[_0x8677('0x37')]){var _0x452b6b={'messages':[{'source':_0x8677('0x45'),'to':_0x36ed8f[_0x8677('0x23')],'body':_0x36ed8f[_0x8677('0x26')],'from':_0x51c107[_0x8677('0x40')]||_0x51c107[_0x8677('0x23')]}]};var _0x2399b4=util[_0x8677('0x46')](_0x8677('0x47'),_0x51c107[_0x8677('0x32')],_0x51c107[_0x8677('0x37')]);var _0x2ea6cb={'method':_0x8677('0x3a'),'uri':_0x8677('0x48'),'body':_0x452b6b,'headers':{'Authorization':util['format'](_0x8677('0x49'),new Buffer(_0x2399b4)[_0x8677('0x4a')](_0x8677('0x4b')))},'json':!![]};rp(_0x2ea6cb)[_0x8677('0x1e')](function(_0x481111){if(_0x481111[_0x8677('0x4c')]>=0xc8&&_0x481111[_0x8677('0x4c')]<=0xce){if(_0x481111[_0x8677('0x4d')]&&_0x481111[_0x8677('0x4d')][_0x8677('0x4e')]>0x0){var _0x50e1ff=_[_0x8677('0x4f')](_0x481111[_0x8677('0x4d')]['messages']);var _0x52930d={'messageId':_0x50e1ff[_0x8677('0x50')]};if(!_0x51c107[_0x8677('0x3e')]){_0x52930d[_0x8677('0x3f')]=!![];}return _0x334357['update'](_0x52930d);}else{logger[_0x8677('0x2c')](_0x8677('0x2f'),'afterCreate','clickSend',util[_0x8677('0x2e')](_0x481111,{'showHidden':![],'depth':null}));}}else{logger[_0x8677('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8677('0x2d'),_0x8677('0x51'),util[_0x8677('0x2e')](_0x481111,{'showHidden':![],'depth':null}));}})[_0x8677('0x1c')](function(_0x2901cb){logger['error'](_0x8677('0x2f'),_0x8677('0x2d'),_0x8677('0x51'),util['inspect'](_0x2901cb,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x8677('0x2f'),_0x8677('0x2d'),_0x8677('0x51'),_0x8677('0x52'));}break;case _0x8677('0x53'):if(_0x51c107[_0x8677('0x54')]&&_0x51c107[_0x8677('0x22')]){var _0x452b6b={'dst':_0x36ed8f[_0x8677('0x23')],'text':_0x36ed8f[_0x8677('0x26')],'src':_0x51c107['senderString']||_0x51c107['phone'],'url':_0x51c107['remote']+_0x8677('0x28')+_0x36ed8f['id']+_0x8677('0x29')+_0x51c107[_0x8677('0x2a')]};var _0x2399b4=util[_0x8677('0x46')](_0x8677('0x47'),_0x51c107[_0x8677('0x54')],_0x51c107[_0x8677('0x22')]);var _0x2ea6cb={'method':_0x8677('0x3a'),'uri':util[_0x8677('0x46')](_0x8677('0x55'),_0x51c107[_0x8677('0x54')]),'body':_0x452b6b,'headers':{'Authorization':util[_0x8677('0x46')](_0x8677('0x49'),new Buffer(_0x2399b4)[_0x8677('0x4a')](_0x8677('0x4b')))},'json':!![]};rp(_0x2ea6cb)['then'](function(_0x26b81e){var _0x2805b7={'messageId':_0x26b81e[_0x8677('0x56')][0x0]};return _0x334357[_0x8677('0x1a')](_0x2805b7);})[_0x8677('0x1c')](function(_0x1fc65a){logger[_0x8677('0x2c')](_0x8677('0x2f'),'afterCreate',_0x8677('0x53'),util[_0x8677('0x2e')](_0x1fc65a,{'showHidden':![],'depth':null}));});}else{logger[_0x8677('0x2c')](_0x8677('0x2f'),_0x8677('0x2d'),_0x8677('0x53'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x8677('0x57'):if(_0x51c107[_0x8677('0x32')]&&_0x51c107[_0x8677('0x37')]){if(_0x51c107['baseUrl']){var _0x5b2413={'method':_0x8677('0x3a'),'uri':_0x51c107['baseUrl']+_0x8677('0x58'),'body':{'username':_0x51c107[_0x8677('0x32')],'password':_0x51c107['password']},'json':!![]};return rp(_0x5b2413)['then'](function(_0x19768b){var _0x2496f8={'method':_0x8677('0x3a'),'uri':_0x51c107[_0x8677('0x59')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x51c107[_0x8677('0x23')],'destinations':[{'to':_0x36ed8f[_0x8677('0x23')]}],'text':_0x36ed8f[_0x8677('0x26')],'notifyUrl':_0x51c107['remote']+_0x8677('0x28')+_0x36ed8f['id']+_0x8677('0x29')+_0x51c107[_0x8677('0x2a')],'notifyContentType':_0x8677('0x5a'),'callbackData':_0x51c107[_0x8677('0x23')]+';'+_0x36ed8f['body']}]},'headers':{'Authorization':_0x8677('0x5b')+_0x19768b['token']},'json':!![]};return rp(_0x2496f8)[_0x8677('0x1e')](function(_0x5a6bbf){if(_0x5a6bbf[_0x8677('0x24')]){var _0x6c0b4e={'messageId':_0x5a6bbf[_0x8677('0x24')][0x0][_0x8677('0xd')]};if(!_0x51c107['deliveryReport']){_0x6c0b4e[_0x8677('0x3f')]=!![];}return _0x334357[_0x8677('0x1a')](_0x6c0b4e);}else{return logger[_0x8677('0x2c')](_0x8677('0x2f'),'afterCreate','infobip',util[_0x8677('0x2e')](_0x5a6bbf,{'showHidden':![],'depth':null}));}});})[_0x8677('0x1c')](function(_0x5f3634){return logger['error'](_0x8677('0x2f'),_0x8677('0x2d'),_0x8677('0x57'),util[_0x8677('0x2e')](_0x5f3634,{'showHidden':![],'depth':null}));});}else{logger[_0x8677('0x2c')](_0x8677('0x2f'),_0x8677('0x2d'),'infobip',_0x8677('0x5c'));}}else{logger[_0x8677('0x2c')](_0x8677('0x2f'),_0x8677('0x2d'),_0x8677('0x57'),'Missing\x20parameters:\x20username,\x20password');}break;case'csc':var _0x4906f6=require('crypto');if(_0x51c107[_0x8677('0x5d')]){var _0x9dec1e={};_0x9dec1e[_0x8677('0x5e')]=_0x51c107['username'];_0x9dec1e['phone']=_0x36ed8f[_0x8677('0x23')];_0x9dec1e['sender']=_0x51c107[_0x8677('0x23')];_0x9dec1e[_0x8677('0x5f')]=_0x36ed8f[_0x8677('0x26')];_0x9dec1e[_0x8677('0x60')]=+new Date();var _0x499fd5='';var _0x43a4ad='';var _0x2355e3=Object[_0x8677('0x61')](_0x9dec1e);_0x2355e3[_0x8677('0x62')]();for(var _0x37d22c=0x0;_0x37d22c<_0x2355e3[_0x8677('0x63')];_0x37d22c++){if(_0x499fd5!=''){_0x499fd5+='&';}_0x499fd5+=_0x2355e3[_0x37d22c]+'='+encodeURIComponent(_0x9dec1e[_0x2355e3[_0x37d22c]]);_0x43a4ad+=_0x9dec1e[_0x2355e3[_0x37d22c]];}_0x43a4ad+=_0x51c107[_0x8677('0x5d')];_0x43a4ad=_0x4906f6[_0x8677('0x64')](_0x8677('0x65'))[_0x8677('0x1a')](_0x43a4ad)[_0x8677('0x66')]('hex');if(_0x499fd5!==''){_0x499fd5+='&';}_0x499fd5+=_0x8677('0x67')+_0x43a4ad;var _0x252ef4={'method':'GET','uri':_0x51c107[_0x8677('0x59')]+_0x8677('0x68')+_0x499fd5,'json':!![]};return rp(_0x252ef4)[_0x8677('0x1e')](function(_0x386f72){var _0x2fa8bb=Object['keys'](_0x386f72);if(_0x386f72[_0x2fa8bb[0x0]][_0x8677('0x2c')]&&parseInt(_0x386f72[_0x2fa8bb[0x0]][_0x8677('0x2c')])===0x0){var _0x1aaafe={'messageId':_0x386f72[_0x2fa8bb[0x0]]['id_sms']};if(!_0x51c107[_0x8677('0x3e')]){_0x1aaafe[_0x8677('0x3f')]=!![];}return _0x334357[_0x8677('0x1a')](_0x1aaafe);}else{return logger['error'](_0x8677('0x2f'),_0x8677('0x2d'),_0x8677('0x69'),util[_0x8677('0x2e')](_0x386f72[_0x8677('0x2c')],{'showHidden':![],'depth':null}));}})[_0x8677('0x1c')](function(_0x46005e){return logger[_0x8677('0x2c')](_0x8677('0x2f'),_0x8677('0x2d'),'csc',util[_0x8677('0x2e')](_0x46005e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x8677('0x2f'),_0x8677('0x2d'),_0x8677('0x69'),_0x8677('0x6a'));}break;case _0x8677('0x6b'):if(_0x51c107[_0x8677('0x5d')]){var _0x162eb7={'method':'POST','uri':_0x8677('0x6c'),'headers':{'Authorization':_0x51c107[_0x8677('0x5d')]},'body':{'content':_0x36ed8f[_0x8677('0x26')],'to':[_0x36ed8f['phone']],'from':_0x51c107[_0x8677('0x23')],'binary':![],'clientMessageId':'uuid','charset':_0x8677('0x6d')},'json':!![]};rp(_0x162eb7)['then'](function(_0x4fb113){if(!_0x4fb113[_0x8677('0x2c')]){var _0x327837={'messageId':_0x4fb113[_0x8677('0x24')][0x0][_0x8677('0x6e')]};if(!_0x51c107[_0x8677('0x3e')]){_0x327837['read']=!![];}return _0x334357['update'](_0x327837);}else{return logger[_0x8677('0x2c')](_0x8677('0x2f'),_0x8677('0x2d'),_0x8677('0x6b'),util[_0x8677('0x2e')](_0x4fb113[_0x8677('0x2c')],{'showHidden':![],'depth':null}));}})[_0x8677('0x1c')](function(_0x39665c){return logger[_0x8677('0x2c')](_0x8677('0x2f'),_0x8677('0x2d'),_0x8677('0x6b'),util[_0x8677('0x2e')](_0x39665c,{'showHidden':![],'depth':null}));});}else{logger[_0x8677('0x2c')](_0x8677('0x2f'),'afterCreate','clickatell',_0x8677('0x6a'));}break;case _0x8677('0x6f'):if(_0x51c107[_0x8677('0x32')]&&_0x51c107[_0x8677('0x37')]){var _0x2399b4=util[_0x8677('0x46')](_0x8677('0x47'),_0x51c107[_0x8677('0x32')],_0x51c107[_0x8677('0x37')]);var _0x2ea6cb={'method':_0x8677('0x3a'),'uri':_0x8677('0x70')+_0x51c107[_0x8677('0x71')]+_0x8677('0x72'),'body':{'to':[_0x36ed8f[_0x8677('0x23')]],'text':_0x36ed8f[_0x8677('0x26')],'from':_0x51c107[_0x8677('0x23')],'applicationId':_0x51c107[_0x8677('0x73')]},'headers':{'Authorization':util[_0x8677('0x46')]('Basic\x20%s',new Buffer(_0x2399b4)['toString'](_0x8677('0x4b')))},'json':!![]};rp(_0x2ea6cb)['then'](function(_0x54df43){if(_0x54df43['id']){var _0x591462={'messageId':_0x54df43['id']};return _0x334357[_0x8677('0x1a')](_0x591462);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8677('0x2d'),_0x8677('0x6f'),util['inspect'](_0x54df43,{'showHidden':![],'depth':null}));}})[_0x8677('0x1c')](function(_0xa0bb9d){logger[_0x8677('0x2c')](_0x8677('0x2f'),_0x8677('0x2d'),_0x8677('0x6f'),util[_0x8677('0x2e')](_0xa0bb9d,{'showHidden':![],'depth':null}));});}else{logger[_0x8677('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8677('0x2d'),_0x8677('0x6f'),_0x8677('0x52'));}break;case _0x8677('0x74'):if(_0x51c107[_0x8677('0x5d')]){var _0x2762cf={};var _0x252ef4={'method':_0x8677('0x3a'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':'Bearer\x20'+_0x51c107[_0x8677('0x5d')],'Content-Type':'application/json'},'body':{'from':_0x51c107[_0x8677('0x23')],'to':_0x36ed8f[_0x8677('0x23')],'text':_0x36ed8f[_0x8677('0x26')]},'json':!![]};return rp(_0x252ef4)[_0x8677('0x1e')](function(_0x20bf75){if(_0x20bf75['code']==0xca){_0x2762cf[_0x8677('0x75')]=_0x20bf75;var _0x546fa0={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x8677('0x76')+_0x51c107[_0x8677('0x5d')],'Content-Type':_0x8677('0x5a')},'body':{'refid':_0x2762cf[_0x8677('0x75')]['refid']},'json':!![]};return rp(_0x546fa0)[_0x8677('0x1e')](function(_0x205477){_0x2762cf['status']=_0x205477;var _0x4f37de={'messageId':_0x2762cf[_0x8677('0x75')][_0x8677('0x77')],'read':!![]};return _0x334357['update'](_0x4f37de);});}else{return logger[_0x8677('0x2c')](_0x8677('0x2f'),_0x8677('0x2d'),_0x8677('0x74'),util[_0x8677('0x2e')](_0x20bf75,{'showHidden':![],'depth':null}));}})['catch'](function(_0x45088f){return logger[_0x8677('0x2c')](_0x8677('0x2f'),'afterCreate','intelepeer',util[_0x8677('0x2e')](_0x45088f,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x8677('0x2f'),_0x8677('0x2d'),_0x8677('0x74'),_0x8677('0x78'));}break;}}})[_0x8677('0x79')](function(){_0x3c36b3();});}else{_0x3c36b3();}}},'charset':_0x8677('0x7a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8bc9=['body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','SmsInteractionId','SmsInteraction','findOne','then','update','createdAt','SmsAccountId','type','twilio','authToken','phone','remote','/api/sms/messages/','/status?token=','token','sid','catch','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','login?username=','&password=','GET','split','sms','POST','user_key','read','Missing\x20parameters:\x20username,\x20password','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','queued_count','head','data','messages','message_id','clickSend','plivo','authId','message_uuid','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','crypto','apiKey','login','sender','text','timestamp','keys','sort','length','md5','digest','hex','signature=','/external/get/send.php?','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','apiMessageId','https://messaging.bandwidth.com/api/v2/users/','/messages','applicationId','bandwidth','https://api.intelepeer.com/_rest/v4/app/sms/send','message','Bearer\x20','refid','intelepeer','Token\x20not\x20received','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','SmsMessage','messageId','fti_sms_messages'];(function(_0x1d29d1,_0x12888e){var _0x5b69cb=function(_0x4ac505){while(--_0x4ac505){_0x1d29d1['push'](_0x1d29d1['shift']());}};_0x5b69cb(++_0x12888e);}(_0x8bc9,0x69));var _0x98bc=function(_0x567ff1,_0x25c261){_0x567ff1=_0x567ff1-0x0;var _0x3aecc3=_0x8bc9[_0x567ff1];return _0x3aecc3;};'use strict';var _=require(_0x98bc('0x0'));var util=require(_0x98bc('0x1'));var logger=require(_0x98bc('0x2'))(_0x98bc('0x3'));var moment=require(_0x98bc('0x4'));var BPromise=require('bluebird');var rp=require(_0x98bc('0x5'));var fs=require('fs');var path=require(_0x98bc('0x6'));var rimraf=require(_0x98bc('0x7'));var config=require(_0x98bc('0x8'));var attributes=require(_0x98bc('0x9'));module[_0x98bc('0xa')]=function(_0x5a77fd,_0x584c0e){return _0x5a77fd['define'](_0x98bc('0xb'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x98bc('0xc'),'fields':['messageId']},{'name':_0x98bc('0xd'),'fields':[_0x98bc('0xe')],'type':_0x98bc('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1cb7ae,_0x7cbf0,_0x23f605){var _0x34c2b6=_0x5a77fd['models'];var _0x4327a3=_0x1cb7ae[_0x98bc('0x10')]({'plain':!![]});if(_0x4327a3[_0x98bc('0x11')][_0x98bc('0x12')]()==='in'||_0x4327a3['direction'][_0x98bc('0x12')]()===_0x98bc('0x13')&&!_0x4327a3[_0x98bc('0x14')]&&!_[_0x98bc('0x15')](_0x4327a3['UserId'])&&!_[_0x98bc('0x15')](_0x4327a3[_0x98bc('0x16')])){_0x34c2b6[_0x98bc('0x17')][_0x98bc('0x18')]({'where':{'id':_0x4327a3[_0x98bc('0x16')]}})[_0x98bc('0x19')](function(_0x5529bb){if(_0x5529bb){_0x5529bb[_0x98bc('0x1a')]({'lastMsgAt':_0x4327a3[_0x98bc('0x1b')],'lastMsgDirection':_0x4327a3[_0x98bc('0x11')][_0x98bc('0x12')]()});}})['catch'](function(_0x3cde06){console['error'](_0x3cde06);});}if(_0x4327a3[_0x98bc('0x11')]===_0x98bc('0x13')&&!_0x4327a3[_0x98bc('0x14')]){var _0x5c9a46;_0x34c2b6['SmsAccount']['find']({'where':{'id':_0x4327a3[_0x98bc('0x1c')]},'raw':!![]})[_0x98bc('0x19')](function(_0x5ab614){_0x5c9a46=_0x5ab614;if(_0x5c9a46&&_0x5c9a46['type']){switch(_0x5c9a46[_0x98bc('0x1d')]){case _0x98bc('0x1e'):var _0x1e1c61=require('twilio');if(_0x5c9a46['accountSid']&&_0x5c9a46[_0x98bc('0x1f')]&&_0x5c9a46['phone']){var _0x35bf4e=new _0x1e1c61(_0x5c9a46['accountSid'],_0x5c9a46[_0x98bc('0x1f')]);_0x35bf4e['messages']['create']({'body':_0x4327a3['body'],'to':_0x4327a3[_0x98bc('0x20')],'from':_0x5c9a46['phone'],'statusCallback':_0x5c9a46[_0x98bc('0x21')]+_0x98bc('0x22')+_0x4327a3['id']+_0x98bc('0x23')+_0x5c9a46[_0x98bc('0x24')]})[_0x98bc('0x19')](function(_0x1e7c58){if(_0x1e7c58['sid']){return _0x1cb7ae['update']({'messageId':_0x1e7c58[_0x98bc('0x25')]});}})[_0x98bc('0x26')](function(_0x4060c1){logger[_0x98bc('0x27')](_0x98bc('0x28'),_0x98bc('0x29'),_0x98bc('0x1e'),util[_0x98bc('0x2a')](_0x4060c1,{'showHidden':![],'depth':null}));});}else{logger[_0x98bc('0x27')](_0x98bc('0x28'),_0x98bc('0x29'),'twilio',_0x98bc('0x2b'));}break;case _0x98bc('0x2c'):var _0x646295=_0x98bc('0x2d');if(_0x5c9a46[_0x98bc('0x2e')]&&_0x5c9a46[_0x98bc('0x2f')]){var _0x427d93={'recipient':[_0x4327a3[_0x98bc('0x20')]],'message':_0x4327a3['body'],'message_type':_0x5c9a46['smsMethod']};if(_0x5c9a46[_0x98bc('0x30')]&&_0x5c9a46[_0x98bc('0x30')]!=='SI'){_0x427d93['sender']=_0x5c9a46['phone'];}var _0x8fbbb6={'url':_0x646295+_0x98bc('0x31')+_0x5c9a46[_0x98bc('0x2e')]+_0x98bc('0x32')+_0x5c9a46[_0x98bc('0x2f')],'method':_0x98bc('0x33')};rp(_0x8fbbb6)[_0x98bc('0x19')](function(_0x33943b){var _0x23ba9b=_0x33943b[_0x98bc('0x34')](';');var _0x180ad1={'user_key':_0x23ba9b[0x0],'session_key':_0x23ba9b[0x1]};_0x8fbbb6={'url':_0x646295+_0x98bc('0x35'),'method':_0x98bc('0x36'),'headers':{'user_key':_0x180ad1[_0x98bc('0x37')],'Session_key':_0x180ad1['session_key']},'json':!![],'body':_0x427d93};return rp(_0x8fbbb6);})[_0x98bc('0x19')](function(_0x540674){if(_0x540674['total_sent']>=0x1){var _0x1c5e90={'messageId':_0x540674['internal_order_id']};if(_0x5c9a46['smsMethod']!=='GP'||!_0x5c9a46['deliveryReport']){_0x1c5e90[_0x98bc('0x38')]=!![];}return _0x1cb7ae[_0x98bc('0x1a')](_0x1c5e90);}else{return logger[_0x98bc('0x27')](_0x98bc('0x28'),_0x98bc('0x29'),_0x98bc('0x2c'),util[_0x98bc('0x2a')](_0x540674,{'showHidden':![],'depth':null}));}})[_0x98bc('0x26')](function(_0x8b78e3){return logger[_0x98bc('0x27')](_0x98bc('0x28'),_0x98bc('0x29'),_0x98bc('0x2c'),util[_0x98bc('0x2a')](_0x8b78e3,{'showHidden':![],'depth':null}));});}else{logger[_0x98bc('0x27')](_0x98bc('0x28'),'afterCreate','skebby',_0x98bc('0x39'));}break;case'connectel':if(_0x5c9a46[_0x98bc('0x1f')]){var _0x2fded5={'recipient':_0x4327a3['phone'],'message':_0x4327a3[_0x98bc('0xe')],'sender':_0x5c9a46[_0x98bc('0x3a')]||_0x5c9a46[_0x98bc('0x20')],'authorization':_0x5c9a46[_0x98bc('0x1f')]};var _0x7cbf0={'method':'POST','uri':_0x98bc('0x3b'),'body':_0x2fded5,'json':!![]};rp(_0x7cbf0)[_0x98bc('0x19')](function(_0x39ea3f){var _0x40011b={'messageId':_0x39ea3f[_0x98bc('0x3c')]};if(!_0x5c9a46[_0x98bc('0x3d')]){_0x40011b[_0x98bc('0x38')]=!![];}return _0x1cb7ae[_0x98bc('0x1a')](_0x40011b);})[_0x98bc('0x26')](function(_0x54b22e){logger['error'](_0x98bc('0x28'),'afterCreate','connectel',util[_0x98bc('0x2a')](_0x54b22e,{'showHidden':![],'depth':null}));});}else{logger[_0x98bc('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x98bc('0x29'),'connectel',_0x98bc('0x3e'));}break;case _0x98bc('0x3f'):if(_0x5c9a46['username']&&_0x5c9a46[_0x98bc('0x2f')]){var _0x2fded5={'messages':[{'source':_0x98bc('0x40'),'to':_0x4327a3[_0x98bc('0x20')],'body':_0x4327a3[_0x98bc('0xe')],'from':_0x5c9a46['senderString']||_0x5c9a46[_0x98bc('0x20')]}]};var _0x41ded2=util[_0x98bc('0x41')]('%s:%s',_0x5c9a46['username'],_0x5c9a46['password']);var _0x7cbf0={'method':_0x98bc('0x36'),'uri':_0x98bc('0x42'),'body':_0x2fded5,'headers':{'Authorization':util['format'](_0x98bc('0x43'),new Buffer(_0x41ded2)[_0x98bc('0x44')](_0x98bc('0x45')))},'json':!![]};rp(_0x7cbf0)['then'](function(_0xb8e1f7){if(_0xb8e1f7['http_code']>=0xc8&&_0xb8e1f7[_0x98bc('0x46')]<=0xce){if(_0xb8e1f7['data']&&_0xb8e1f7['data'][_0x98bc('0x47')]>0x0){var _0x40e42b=_[_0x98bc('0x48')](_0xb8e1f7[_0x98bc('0x49')][_0x98bc('0x4a')]);var _0x30cbdb={'messageId':_0x40e42b[_0x98bc('0x4b')]};if(!_0x5c9a46[_0x98bc('0x3d')]){_0x30cbdb['read']=!![];}return _0x1cb7ae[_0x98bc('0x1a')](_0x30cbdb);}else{logger[_0x98bc('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x98bc('0x29'),_0x98bc('0x4c'),util[_0x98bc('0x2a')](_0xb8e1f7,{'showHidden':![],'depth':null}));}}else{logger[_0x98bc('0x27')](_0x98bc('0x28'),_0x98bc('0x29'),_0x98bc('0x4c'),util[_0x98bc('0x2a')](_0xb8e1f7,{'showHidden':![],'depth':null}));}})['catch'](function(_0x35d833){logger['error'](_0x98bc('0x28'),'afterCreate','clickSend',util[_0x98bc('0x2a')](_0x35d833,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x98bc('0x28'),_0x98bc('0x29'),_0x98bc('0x4c'),_0x98bc('0x39'));}break;case _0x98bc('0x4d'):if(_0x5c9a46[_0x98bc('0x4e')]&&_0x5c9a46[_0x98bc('0x1f')]){var _0x2fded5={'dst':_0x4327a3[_0x98bc('0x20')],'text':_0x4327a3[_0x98bc('0xe')],'src':_0x5c9a46[_0x98bc('0x3a')]||_0x5c9a46['phone'],'url':_0x5c9a46[_0x98bc('0x21')]+'/api/sms/messages/'+_0x4327a3['id']+'/status?token='+_0x5c9a46[_0x98bc('0x24')]};var _0x41ded2=util[_0x98bc('0x41')]('%s:%s',_0x5c9a46[_0x98bc('0x4e')],_0x5c9a46[_0x98bc('0x1f')]);var _0x7cbf0={'method':_0x98bc('0x36'),'uri':util[_0x98bc('0x41')]('https://api.plivo.com/v1/Account/%s/Message/',_0x5c9a46[_0x98bc('0x4e')]),'body':_0x2fded5,'headers':{'Authorization':util[_0x98bc('0x41')](_0x98bc('0x43'),new Buffer(_0x41ded2)['toString'](_0x98bc('0x45')))},'json':!![]};rp(_0x7cbf0)['then'](function(_0x48a9c9){var _0xea2084={'messageId':_0x48a9c9[_0x98bc('0x4f')][0x0]};return _0x1cb7ae['update'](_0xea2084);})['catch'](function(_0x1a1dd2){logger[_0x98bc('0x27')](_0x98bc('0x28'),'afterCreate',_0x98bc('0x4d'),util[_0x98bc('0x2a')](_0x1a1dd2,{'showHidden':![],'depth':null}));});}else{logger[_0x98bc('0x27')](_0x98bc('0x28'),_0x98bc('0x29'),_0x98bc('0x4d'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case'infobip':if(_0x5c9a46[_0x98bc('0x2e')]&&_0x5c9a46[_0x98bc('0x2f')]){if(_0x5c9a46[_0x98bc('0x50')]){var _0xbd1655={'method':_0x98bc('0x36'),'uri':_0x5c9a46[_0x98bc('0x50')]+_0x98bc('0x51'),'body':{'username':_0x5c9a46[_0x98bc('0x2e')],'password':_0x5c9a46[_0x98bc('0x2f')]},'json':!![]};return rp(_0xbd1655)[_0x98bc('0x19')](function(_0x22d199){var _0x2b15c4={'method':_0x98bc('0x36'),'uri':_0x5c9a46[_0x98bc('0x50')]+_0x98bc('0x52'),'body':{'messages':[{'from':_0x5c9a46[_0x98bc('0x20')],'destinations':[{'to':_0x4327a3[_0x98bc('0x20')]}],'text':_0x4327a3['body'],'notifyUrl':_0x5c9a46[_0x98bc('0x21')]+_0x98bc('0x22')+_0x4327a3['id']+_0x98bc('0x23')+_0x5c9a46[_0x98bc('0x24')],'notifyContentType':_0x98bc('0x53'),'callbackData':_0x5c9a46[_0x98bc('0x20')]+';'+_0x4327a3[_0x98bc('0xe')]}]},'headers':{'Authorization':_0x98bc('0x54')+_0x22d199[_0x98bc('0x24')]},'json':!![]};return rp(_0x2b15c4)[_0x98bc('0x19')](function(_0x1838ee){if(_0x1838ee['messages']){var _0xf996c2={'messageId':_0x1838ee[_0x98bc('0x4a')][0x0][_0x98bc('0xc')]};if(!_0x5c9a46['deliveryReport']){_0xf996c2[_0x98bc('0x38')]=!![];}return _0x1cb7ae[_0x98bc('0x1a')](_0xf996c2);}else{return logger[_0x98bc('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x98bc('0x29'),_0x98bc('0x55'),util['inspect'](_0x1838ee,{'showHidden':![],'depth':null}));}});})[_0x98bc('0x26')](function(_0x5583f6){return logger['error'](_0x98bc('0x28'),'afterCreate','infobip',util[_0x98bc('0x2a')](_0x5583f6,{'showHidden':![],'depth':null}));});}else{logger[_0x98bc('0x27')](_0x98bc('0x28'),_0x98bc('0x29'),_0x98bc('0x55'),_0x98bc('0x56'));}}else{logger[_0x98bc('0x27')](_0x98bc('0x28'),_0x98bc('0x29'),_0x98bc('0x55'),_0x98bc('0x39'));}break;case'csc':var _0x14d682=require(_0x98bc('0x57'));if(_0x5c9a46[_0x98bc('0x58')]){var _0x19a054={};_0x19a054[_0x98bc('0x59')]=_0x5c9a46['username'];_0x19a054[_0x98bc('0x20')]=_0x4327a3[_0x98bc('0x20')];_0x19a054[_0x98bc('0x5a')]=_0x5c9a46[_0x98bc('0x20')];_0x19a054[_0x98bc('0x5b')]=_0x4327a3[_0x98bc('0xe')];_0x19a054[_0x98bc('0x5c')]=+new Date();var _0x5c907f='';var _0x4b3d84='';var _0x3789df=Object[_0x98bc('0x5d')](_0x19a054);_0x3789df[_0x98bc('0x5e')]();for(var _0x32d729=0x0;_0x32d729<_0x3789df[_0x98bc('0x5f')];_0x32d729++){if(_0x5c907f!=''){_0x5c907f+='&';}_0x5c907f+=_0x3789df[_0x32d729]+'='+encodeURIComponent(_0x19a054[_0x3789df[_0x32d729]]);_0x4b3d84+=_0x19a054[_0x3789df[_0x32d729]];}_0x4b3d84+=_0x5c9a46[_0x98bc('0x58')];_0x4b3d84=_0x14d682['createHash'](_0x98bc('0x60'))[_0x98bc('0x1a')](_0x4b3d84)[_0x98bc('0x61')](_0x98bc('0x62'));if(_0x5c907f!==''){_0x5c907f+='&';}_0x5c907f+=_0x98bc('0x63')+_0x4b3d84;var _0x8fbbb6={'method':_0x98bc('0x33'),'uri':_0x5c9a46[_0x98bc('0x50')]+_0x98bc('0x64')+_0x5c907f,'json':!![]};return rp(_0x8fbbb6)['then'](function(_0x560975){var _0x4f9a28=Object[_0x98bc('0x5d')](_0x560975);if(_0x560975[_0x4f9a28[0x0]][_0x98bc('0x27')]&&parseInt(_0x560975[_0x4f9a28[0x0]]['error'])===0x0){var _0x1898bf={'messageId':_0x560975[_0x4f9a28[0x0]]['id_sms']};if(!_0x5c9a46['deliveryReport']){_0x1898bf[_0x98bc('0x38')]=!![];}return _0x1cb7ae[_0x98bc('0x1a')](_0x1898bf);}else{return logger[_0x98bc('0x27')](_0x98bc('0x28'),_0x98bc('0x29'),_0x98bc('0x65'),util[_0x98bc('0x2a')](_0x560975[_0x98bc('0x27')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x856fd8){return logger[_0x98bc('0x27')](_0x98bc('0x28'),_0x98bc('0x29'),_0x98bc('0x65'),util['inspect'](_0x856fd8,{'showHidden':![],'depth':null}));});}else{logger[_0x98bc('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x98bc('0x29'),_0x98bc('0x65'),_0x98bc('0x66'));}break;case _0x98bc('0x67'):if(_0x5c9a46[_0x98bc('0x58')]){var _0x5be797={'method':_0x98bc('0x36'),'uri':_0x98bc('0x68'),'headers':{'Authorization':_0x5c9a46[_0x98bc('0x58')]},'body':{'content':_0x4327a3[_0x98bc('0xe')],'to':[_0x4327a3[_0x98bc('0x20')]],'from':_0x5c9a46['phone'],'binary':![],'clientMessageId':_0x98bc('0x69'),'charset':'UTF-8'},'json':!![]};rp(_0x5be797)[_0x98bc('0x19')](function(_0x4b7114){if(!_0x4b7114[_0x98bc('0x27')]){var _0x5b2637={'messageId':_0x4b7114[_0x98bc('0x4a')][0x0][_0x98bc('0x6a')]};if(!_0x5c9a46[_0x98bc('0x3d')]){_0x5b2637[_0x98bc('0x38')]=!![];}return _0x1cb7ae[_0x98bc('0x1a')](_0x5b2637);}else{return logger[_0x98bc('0x27')](_0x98bc('0x28'),'afterCreate',_0x98bc('0x67'),util['inspect'](_0x4b7114['error'],{'showHidden':![],'depth':null}));}})[_0x98bc('0x26')](function(_0x1db240){return logger[_0x98bc('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x98bc('0x29'),'clickatell',util['inspect'](_0x1db240,{'showHidden':![],'depth':null}));});}else{logger[_0x98bc('0x27')](_0x98bc('0x28'),_0x98bc('0x29'),'clickatell',_0x98bc('0x66'));}break;case'bandwidth':if(_0x5c9a46[_0x98bc('0x2e')]&&_0x5c9a46['password']){var _0x41ded2=util[_0x98bc('0x41')]('%s:%s',_0x5c9a46[_0x98bc('0x2e')],_0x5c9a46[_0x98bc('0x2f')]);var _0x7cbf0={'method':'POST','uri':_0x98bc('0x6b')+_0x5c9a46['accountId']+_0x98bc('0x6c'),'body':{'to':[_0x4327a3[_0x98bc('0x20')]],'text':_0x4327a3[_0x98bc('0xe')],'from':_0x5c9a46[_0x98bc('0x20')],'applicationId':_0x5c9a46[_0x98bc('0x6d')]},'headers':{'Authorization':util[_0x98bc('0x41')](_0x98bc('0x43'),new Buffer(_0x41ded2)[_0x98bc('0x44')](_0x98bc('0x45')))},'json':!![]};rp(_0x7cbf0)[_0x98bc('0x19')](function(_0x2ab172){if(_0x2ab172['id']){var _0x515e88={'messageId':_0x2ab172['id']};return _0x1cb7ae['update'](_0x515e88);}else{logger['error'](_0x98bc('0x28'),_0x98bc('0x29'),'bandwidth',util[_0x98bc('0x2a')](_0x2ab172,{'showHidden':![],'depth':null}));}})[_0x98bc('0x26')](function(_0x3d1754){logger['error'](_0x98bc('0x28'),_0x98bc('0x29'),'bandwidth',util[_0x98bc('0x2a')](_0x3d1754,{'showHidden':![],'depth':null}));});}else{logger[_0x98bc('0x27')](_0x98bc('0x28'),_0x98bc('0x29'),_0x98bc('0x6e'),_0x98bc('0x39'));}break;case'intelepeer':if(_0x5c9a46[_0x98bc('0x58')]){var _0x20685b={};var _0x8fbbb6={'method':'POST','uri':_0x98bc('0x6f'),'headers':{'Authorization':'Bearer\x20'+_0x5c9a46['apiKey'],'Content-Type':_0x98bc('0x53')},'body':{'from':_0x5c9a46[_0x98bc('0x20')],'to':_0x4327a3['phone'],'text':_0x4327a3[_0x98bc('0xe')]},'json':!![]};return rp(_0x8fbbb6)[_0x98bc('0x19')](function(_0x485cdb){if(_0x485cdb['code']==0xca){_0x20685b[_0x98bc('0x70')]=_0x485cdb;var _0x414f95={'method':_0x98bc('0x36'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x98bc('0x71')+_0x5c9a46[_0x98bc('0x58')],'Content-Type':_0x98bc('0x53')},'body':{'refid':_0x20685b[_0x98bc('0x70')][_0x98bc('0x72')]},'json':!![]};return rp(_0x414f95)[_0x98bc('0x19')](function(_0x2fc826){_0x20685b['status']=_0x2fc826;var _0x30ab1f={'messageId':_0x20685b[_0x98bc('0x70')][_0x98bc('0x72')],'read':!![]};return _0x1cb7ae[_0x98bc('0x1a')](_0x30ab1f);});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x98bc('0x73'),util[_0x98bc('0x2a')](_0x485cdb,{'showHidden':![],'depth':null}));}})[_0x98bc('0x26')](function(_0x5f2278){return logger[_0x98bc('0x27')](_0x98bc('0x28'),_0x98bc('0x29'),_0x98bc('0x73'),util[_0x98bc('0x2a')](_0x5f2278,{'showHidden':![],'depth':null}));});}else{return logger[_0x98bc('0x27')](_0x98bc('0x28'),_0x98bc('0x29'),_0x98bc('0x73'),_0x98bc('0x74'));}break;}}})['finally'](function(){_0x23f605();});}else{_0x23f605();}}},'charset':_0x98bc('0x75'),'collate':_0x98bc('0x76')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index d2a3cdf..d271e88 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 _0x18e9=['SmsMessage,\x20%s,\x20%s','message','result','CreateSmsMessage','SmsMessage','body','options','raw','stringify','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x460f81,_0x553431){var _0x423f0d=function(_0x267a6b){while(--_0x267a6b){_0x460f81['push'](_0x460f81['shift']());}};_0x423f0d(++_0x553431);}(_0x18e9,0x121));var _0x918e=function(_0x1df7b8,_0x2fe5e5){_0x1df7b8=_0x1df7b8-0x0;var _0x29d911=_0x18e9[_0x1df7b8];return _0x29d911;};'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(_0x918e('0x5'));var logger=require(_0x918e('0x6'))(_0x918e('0x7'));var config=require(_0x918e('0x8'));var jayson=require(_0x918e('0x9'));var client=jayson[_0x918e('0xa')][_0x918e('0xb')]({'port':0x232a});config['redis']=_[_0x918e('0xc')](config[_0x918e('0xd')],{'host':_0x918e('0xe'),'port':0x18eb});var socket=require(_0x918e('0xf'))(new Redis(config[_0x918e('0xd')]));require(_0x918e('0x10'))[_0x918e('0x11')](socket);function respondWithRpcPromise(_0x333dd4,_0x373306,_0x278adb){return new BPromise(function(_0x4ec4c3,_0x174a26){return client[_0x918e('0x12')](_0x333dd4,_0x278adb)[_0x918e('0x13')](function(_0x19a28a){logger[_0x918e('0x14')]('SmsMessage,\x20%s,\x20%s',_0x373306,_0x918e('0x15'));logger[_0x918e('0x16')](_0x918e('0x17'),_0x373306,_0x918e('0x15'),JSON['stringify'](_0x19a28a));if(_0x19a28a['error']){if(_0x19a28a[_0x918e('0x18')][_0x918e('0x19')]===0x1f4){logger[_0x918e('0x18')](_0x918e('0x1a'),_0x373306,_0x19a28a[_0x918e('0x18')][_0x918e('0x1b')]);return _0x174a26(_0x19a28a[_0x918e('0x18')]['message']);}logger[_0x918e('0x18')](_0x918e('0x1a'),_0x373306,_0x19a28a[_0x918e('0x18')]['message']);return _0x4ec4c3(_0x19a28a[_0x918e('0x18')]['message']);}else{logger[_0x918e('0x14')]('SmsMessage,\x20%s,\x20%s',_0x373306,_0x918e('0x15'));_0x4ec4c3(_0x19a28a[_0x918e('0x1c')][_0x918e('0x1b')]);}})['catch'](function(_0x248709){logger[_0x918e('0x18')]('SmsMessage,\x20%s,\x20%s',_0x373306,_0x248709);_0x174a26(_0x248709);});});}exports[_0x918e('0x1d')]=function(_0x519495){var _0x5d14cc=this;return new Promise(function(_0x180404,_0x1cc261){return db[_0x918e('0x1e')]['create'](_0x519495[_0x918e('0x1f')],{'raw':_0x519495[_0x918e('0x20')]?_0x519495['options'][_0x918e('0x21')]===undefined?!![]:![]:!![]})[_0x918e('0x13')](function(_0x202e17){logger[_0x918e('0x14')](_0x918e('0x1d'),_0x519495);logger[_0x918e('0x16')](_0x918e('0x1d'),_0x519495,JSON[_0x918e('0x22')](_0x202e17));_0x180404(_0x202e17);})['catch'](function(_0x41d633){logger[_0x918e('0x18')](_0x918e('0x1d'),_0x41d633[_0x918e('0x1b')],_0x519495);_0x1cc261(_0x5d14cc[_0x918e('0x18')](0x1f4,_0x41d633[_0x918e('0x1b')]));});});}; \ No newline at end of file +var _0x35a4=['defaults','redis','socket.io-emitter','request','then','info','SmsMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','CreateSmsMessage','SmsMessage','create','body','options','raw','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http'];(function(_0x5c5b4d,_0x3b4781){var _0x448a9e=function(_0x44710f){while(--_0x44710f){_0x5c5b4d['push'](_0x5c5b4d['shift']());}};_0x448a9e(++_0x3b4781);}(_0x35a4,0xaa));var _0x435a=function(_0xdd82b4,_0x5cd8b8){_0xdd82b4=_0xdd82b4-0x0;var _0x549bb2=_0x35a4[_0xdd82b4];return _0x549bb2;};'use strict';var _=require(_0x435a('0x0'));var util=require(_0x435a('0x1'));var moment=require(_0x435a('0x2'));var BPromise=require(_0x435a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x435a('0x4'));var db=require(_0x435a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x435a('0x6'))(_0x435a('0x7'));var config=require(_0x435a('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x435a('0x9')]({'port':0x232a});config['redis']=_[_0x435a('0xa')](config[_0x435a('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x435a('0xc'))(new Redis(config[_0x435a('0xb')]));require('./smsMessage.socket')['register'](socket);function respondWithRpcPromise(_0x4154fd,_0x529b20,_0x3c0a08){return new BPromise(function(_0x55ee98,_0x4ab5d6){return client[_0x435a('0xd')](_0x4154fd,_0x3c0a08)[_0x435a('0xe')](function(_0x425e86){logger[_0x435a('0xf')](_0x435a('0x10'),_0x529b20,'request\x20sent');logger[_0x435a('0x11')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x529b20,_0x435a('0x12'),JSON[_0x435a('0x13')](_0x425e86));if(_0x425e86[_0x435a('0x14')]){if(_0x425e86[_0x435a('0x14')][_0x435a('0x15')]===0x1f4){logger[_0x435a('0x14')](_0x435a('0x10'),_0x529b20,_0x425e86[_0x435a('0x14')][_0x435a('0x16')]);return _0x4ab5d6(_0x425e86[_0x435a('0x14')][_0x435a('0x16')]);}logger['error'](_0x435a('0x10'),_0x529b20,_0x425e86['error'][_0x435a('0x16')]);return _0x55ee98(_0x425e86[_0x435a('0x14')][_0x435a('0x16')]);}else{logger[_0x435a('0xf')](_0x435a('0x10'),_0x529b20,_0x435a('0x12'));_0x55ee98(_0x425e86['result'][_0x435a('0x16')]);}})['catch'](function(_0x418cc2){logger[_0x435a('0x14')](_0x435a('0x10'),_0x529b20,_0x418cc2);_0x4ab5d6(_0x418cc2);});});}exports[_0x435a('0x17')]=function(_0x46c449){var _0x360f11=this;return new Promise(function(_0xde5464,_0x33a6fc){return db[_0x435a('0x18')][_0x435a('0x19')](_0x46c449[_0x435a('0x1a')],{'raw':_0x46c449[_0x435a('0x1b')]?_0x46c449['options'][_0x435a('0x1c')]===undefined?!![]:![]:!![]})[_0x435a('0xe')](function(_0x3a1269){logger['info']('CreateSmsMessage',_0x46c449);logger[_0x435a('0x11')](_0x435a('0x17'),_0x46c449,JSON[_0x435a('0x13')](_0x3a1269));_0xde5464(_0x3a1269);})[_0x435a('0x1d')](function(_0x2ec942){logger[_0x435a('0x14')]('CreateSmsMessage',_0x2ec942[_0x435a('0x16')],_0x46c449);_0x33a6fc(_0x360f11[_0x435a('0x14')](0x1f4,_0x2ec942[_0x435a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index b183a09..48fa81a 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 _0xb1b4=['length','smsMessage:','emit','removeListener','register'];(function(_0x114bdf,_0x119ada){var _0x5658f6=function(_0xff3dc){while(--_0xff3dc){_0x114bdf['push'](_0x114bdf['shift']());}};_0x5658f6(++_0x119ada);}(_0xb1b4,0x11a));var _0x4b1b=function(_0x4a8893,_0x38f6ee){_0x4a8893=_0x4a8893-0x0;var _0x2b6e06=_0xb1b4[_0x4a8893];return _0x2b6e06;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=['save','remove','update'];function createListener(_0x210e59,_0x37dc2e){return function(_0x19163e){_0x37dc2e[_0x4b1b('0x0')](_0x210e59,_0x19163e);};}function removeListener(_0x2058be,_0x44efbe){return function(){SmsMessageEvents[_0x4b1b('0x1')](_0x2058be,_0x44efbe);};}exports[_0x4b1b('0x2')]=function(_0xe2b3c5){for(var _0x20089a=0x0,_0x33c572=events[_0x4b1b('0x3')];_0x20089a<_0x33c572;_0x20089a++){var _0x3b5525=events[_0x20089a];var _0x5d52fb=createListener(_0x4b1b('0x4')+_0x3b5525,_0xe2b3c5);SmsMessageEvents['on'](_0x3b5525,_0x5d52fb);}}; \ No newline at end of file +var _0xcb1b=['update','emit','removeListener','length','smsMessage:','./smsMessage.events','save','remove'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xcb1b,0x85));var _0xbcb1=function(_0x2b0545,_0x2a1ee2){_0x2b0545=_0x2b0545-0x0;var _0x28c825=_0xcb1b[_0x2b0545];return _0x28c825;};'use strict';var SmsMessageEvents=require(_0xbcb1('0x0'));var events=[_0xbcb1('0x1'),_0xbcb1('0x2'),_0xbcb1('0x3')];function createListener(_0x40223d,_0x568294){return function(_0x5f1ae4){_0x568294[_0xbcb1('0x4')](_0x40223d,_0x5f1ae4);};}function removeListener(_0x2c802e,_0x257126){return function(){SmsMessageEvents[_0xbcb1('0x5')](_0x2c802e,_0x257126);};}exports['register']=function(_0x5cc34d){for(var _0xb473ec=0x0,_0x498bde=events[_0xbcb1('0x6')];_0xb473ec<_0x498bde;_0xb473ec++){var _0x2b2585=events[_0xb473ec];var _0xf2ad97=createListener(_0xbcb1('0x7')+_0x2b2585,_0x5cc34d);SmsMessageEvents['on'](_0x2b2585,_0xf2ad97);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index ceb8c19..9208f6a 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 _0xf253=['getTeams','post','create','/:id/teams','/:id/users','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers'];(function(_0x3d35f2,_0x1e5a96){var _0x362671=function(_0x592553){while(--_0x592553){_0x3d35f2['push'](_0x3d35f2['shift']());}};_0x362671(++_0x1e5a96);}(_0xf253,0xdf));var _0x3f25=function(_0xba0da5,_0x2ac024){_0xba0da5=_0xba0da5-0x0;var _0x3a5f98=_0xf253[_0xba0da5];return _0x3a5f98;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x3f25('0x0'));var express=require(_0x3f25('0x1'));var router=express[_0x3f25('0x2')]();var fs_extra=require(_0x3f25('0x3'));var auth=require(_0x3f25('0x4'));var interaction=require(_0x3f25('0x5'));var config=require(_0x3f25('0x6'));var controller=require(_0x3f25('0x7'));router[_0x3f25('0x8')]('/',auth[_0x3f25('0x9')](),controller[_0x3f25('0xa')]);router[_0x3f25('0x8')](_0x3f25('0xb'),auth[_0x3f25('0x9')](),controller[_0x3f25('0xc')]);router[_0x3f25('0x8')](_0x3f25('0xd'),auth['isAuthenticated'](),controller[_0x3f25('0xe')]);router['get'](_0x3f25('0xf'),auth['isAuthenticated'](),controller[_0x3f25('0x10')]);router[_0x3f25('0x8')]('/:id/teams',auth[_0x3f25('0x9')](),controller[_0x3f25('0x11')]);router[_0x3f25('0x8')]('/:id/users',auth[_0x3f25('0x9')](),controller['getAgents']);router[_0x3f25('0x12')]('/',auth[_0x3f25('0x9')](),controller[_0x3f25('0x13')]);router['post'](_0x3f25('0x14'),auth[_0x3f25('0x9')](),controller['addTeams']);router['post'](_0x3f25('0x15'),auth['isAuthenticated'](),controller[_0x3f25('0x16')]);router[_0x3f25('0x17')](_0x3f25('0xd'),auth[_0x3f25('0x9')](),controller[_0x3f25('0x18')]);router[_0x3f25('0x19')]('/:id',auth[_0x3f25('0x9')](),controller[_0x3f25('0x1a')]);router[_0x3f25('0x19')](_0x3f25('0x14'),auth['isAuthenticated'](),controller[_0x3f25('0x1b')]);router[_0x3f25('0x19')]('/:id/users',auth['isAuthenticated'](),controller[_0x3f25('0x1c')]);module[_0x3f25('0x1d')]=router; \ No newline at end of file +var _0xce4a=['create','addTeams','addAgents','put','update','delete','destroy','removeTeams','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueue.controller','isAuthenticated','index','get','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post'];(function(_0x1602fb,_0x20b6b3){var _0x461831=function(_0x4a19f1){while(--_0x4a19f1){_0x1602fb['push'](_0x1602fb['shift']());}};_0x461831(++_0x20b6b3);}(_0xce4a,0x7d));var _0xace4=function(_0x256cef,_0x148e2d){_0x256cef=_0x256cef-0x0;var _0x5d34a7=_0xce4a[_0x256cef];return _0x5d34a7;};'use strict';var multer=require(_0xace4('0x0'));var util=require(_0xace4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xace4('0x2'));var router=express[_0xace4('0x3')]();var fs_extra=require(_0xace4('0x4'));var auth=require(_0xace4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xace4('0x6'));var controller=require(_0xace4('0x7'));router['get']('/',auth[_0xace4('0x8')](),controller[_0xace4('0x9')]);router[_0xace4('0xa')]('/describe',auth[_0xace4('0x8')](),controller[_0xace4('0xb')]);router['get'](_0xace4('0xc'),auth[_0xace4('0x8')](),controller['show']);router[_0xace4('0xa')](_0xace4('0xd'),auth['isAuthenticated'](),controller[_0xace4('0xe')]);router[_0xace4('0xa')](_0xace4('0xf'),auth[_0xace4('0x8')](),controller[_0xace4('0x10')]);router['get'](_0xace4('0x11'),auth[_0xace4('0x8')](),controller[_0xace4('0x12')]);router[_0xace4('0x13')]('/',auth[_0xace4('0x8')](),controller[_0xace4('0x14')]);router[_0xace4('0x13')]('/:id/teams',auth[_0xace4('0x8')](),controller[_0xace4('0x15')]);router[_0xace4('0x13')](_0xace4('0x11'),auth[_0xace4('0x8')](),controller[_0xace4('0x16')]);router[_0xace4('0x17')](_0xace4('0xc'),auth['isAuthenticated'](),controller[_0xace4('0x18')]);router[_0xace4('0x19')](_0xace4('0xc'),auth['isAuthenticated'](),controller[_0xace4('0x1a')]);router['delete'](_0xace4('0xf'),auth[_0xace4('0x8')](),controller[_0xace4('0x1b')]);router[_0xace4('0x19')](_0xace4('0x11'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xace4('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index d67eebb..23ff823 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 _0xfe5c=['sequelize','exports','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xfe5c,0xb6));var _0xcfe5=function(_0x1a1347,_0x2bce26){_0x1a1347=_0x1a1347-0x0;var _0x151af8=_0xfe5c[_0x1a1347];return _0x151af8;};'use strict';var Sequelize=require(_0xcfe5('0x0'));module[_0xcfe5('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xcfe5('0x2')]},'timeout':{'type':Sequelize[_0xcfe5('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcfe5('0x4')](_0xcfe5('0x5'),_0xcfe5('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x32e8=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','name','STRING'];(function(_0x4738d7,_0x46a6e0){var _0x27ab9b=function(_0x1e1e69){while(--_0x1e1e69){_0x4738d7['push'](_0x4738d7['shift']());}};_0x27ab9b(++_0x46a6e0);}(_0x32e8,0x101));var _0x832e=function(_0x3d86b4,_0x460b8f){_0x3d86b4=_0x3d86b4-0x0;var _0x82ea2=_0x32e8[_0x3d86b4];return _0x82ea2;};'use strict';var Sequelize=require(_0x832e('0x0'));module[_0x832e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x832e('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x832e('0x3')]},'timeout':{'type':Sequelize[_0x832e('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x832e('0x5')](_0x832e('0x6'),_0x832e('0x7'),_0x832e('0x8'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 0060234..8cc9e81 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 _0xc692=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','options','UserSmsQueue','findAndCountAll','UserId','agent','smsPause','rows','%s/%s','SIP','updatedAt','getTeams','Team','addTeams','User','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','removeTeams','ids','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','QueryTypes','SELECT','every','TeamId','includes','all','union','value','transaction','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','userSmsQueue:save','isArray','getAgents','findOne','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./smsQueue.socket','register','end','undefined','limit','count','offset','status','set','json','apply','reject','update','then','destroy','get','SmsQueues','UserProfileResource','sendStatus','name','index','map','SmsQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','show','params','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error'];(function(_0x1e0b23,_0x447f13){var _0x9e049c=function(_0x41f9e3){while(--_0x41f9e3){_0x1e0b23['push'](_0x1e0b23['shift']());}};_0x9e049c(++_0x447f13);}(_0xc692,0x15f));var _0x2c69=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xc692[_0x1035c1];return _0x308d67;};'use strict';var emlformat=require(_0x2c69('0x0'));var rimraf=require(_0x2c69('0x1'));var zipdir=require(_0x2c69('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2c69('0x3'));var BPromise=require(_0x2c69('0x4'));var Mustache=require(_0x2c69('0x5'));var util=require(_0x2c69('0x6'));var path=require(_0x2c69('0x7'));var sox=require(_0x2c69('0x8'));var csv=require(_0x2c69('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2c69('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2c69('0xb'));var jsforce=require(_0x2c69('0xc'));var deskjs=require(_0x2c69('0xd'));var toCsv=require(_0x2c69('0x9'));var querystring=require(_0x2c69('0xe'));var Papa=require(_0x2c69('0xf'));var Redis=require('ioredis');var authService=require(_0x2c69('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2c69('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2c69('0x12'))(_0x2c69('0x13'));var utils=require(_0x2c69('0x14'));var config=require(_0x2c69('0x15'));var licenseUtil=require(_0x2c69('0x16'));var db=require(_0x2c69('0x17'))['db'];config['redis']=_[_0x2c69('0x18')](config['redis'],{'host':_0x2c69('0x19'),'port':0x18eb});var socket=require(_0x2c69('0x1a'))(new Redis(config[_0x2c69('0x1b')]));require(_0x2c69('0x1c'))[_0x2c69('0x1d')](socket);function respondWithStatusCode(_0x211496,_0x5747d8){_0x5747d8=_0x5747d8||0xcc;return function(_0x2d0df5){if(_0x2d0df5){return _0x211496['sendStatus'](_0x5747d8);}return _0x211496['status'](_0x5747d8)[_0x2c69('0x1e')]();};}function respondWithResult(_0x4cabe5,_0x11649b){_0x11649b=_0x11649b||0xc8;return function(_0x5f5bd5){if(_0x5f5bd5){return _0x4cabe5['status'](_0x11649b)['json'](_0x5f5bd5);}};}function respondWithFilteredResult(_0x3bd4a3,_0x35d604){return function(_0xa1c51){if(_0xa1c51){var _0x5b4ca0=typeof _0x35d604['offset']===_0x2c69('0x1f')&&typeof _0x35d604[_0x2c69('0x20')]===_0x2c69('0x1f');var _0x5a9d56=_0xa1c51[_0x2c69('0x21')];var _0x5c3af1=_0x5b4ca0?0x0:_0x35d604[_0x2c69('0x22')];var _0x6f3a7e=_0x5b4ca0?_0xa1c51[_0x2c69('0x21')]:_0x35d604[_0x2c69('0x22')]+_0x35d604['limit'];var _0x823db7;if(_0x6f3a7e>=_0x5a9d56){_0x6f3a7e=_0x5a9d56;_0x823db7=0xc8;}else{_0x823db7=0xce;}_0x3bd4a3[_0x2c69('0x23')](_0x823db7);return _0x3bd4a3[_0x2c69('0x24')]('Content-Range',_0x5c3af1+'-'+_0x6f3a7e+'/'+_0x5a9d56)[_0x2c69('0x25')](_0xa1c51);}return null;};}function patchUpdates(_0x5775fa){return function(_0x528683){try{jsonpatch[_0x2c69('0x26')](_0x528683,_0x5775fa,!![]);}catch(_0x5cc6dc){return BPromise[_0x2c69('0x27')](_0x5cc6dc);}return _0x528683['save']();};}function saveUpdates(_0x58f00f,_0x3fb15c){return function(_0x39f7db){if(_0x39f7db){return _0x39f7db[_0x2c69('0x28')](_0x58f00f)[_0x2c69('0x29')](function(_0x12dbca){return _0x12dbca;});}return null;};}function removeEntity(_0x2edc86,_0x16425d){return function(_0x2a0569){if(_0x2a0569){return _0x2a0569[_0x2c69('0x2a')]()['then'](function(){var _0x7dd85a=_0x2a0569[_0x2c69('0x2b')]({'plain':!![]});var _0x4a7ebf=_0x2c69('0x2c');return db[_0x2c69('0x2d')][_0x2c69('0x2a')]({'where':{'type':_0x4a7ebf,'resourceId':_0x7dd85a['id']}})['then'](function(){return _0x2a0569;});})[_0x2c69('0x29')](function(){_0x2edc86[_0x2c69('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ae236,_0x3d6e87){return function(_0x27150a){if(!_0x27150a){_0x2ae236[_0x2c69('0x2e')](0x194);}return _0x27150a;};}function handleError(_0x4fb92d,_0x271205){_0x271205=_0x271205||0x1f4;return function(_0x77babf){logger['error'](_0x77babf['stack']);if(_0x77babf['name']){delete _0x77babf[_0x2c69('0x2f')];}_0x4fb92d['status'](_0x271205)['send'](_0x77babf);};}exports[_0x2c69('0x30')]=function(_0x21f0bf,_0x389dbf){var _0x22be4b={},_0x368201={},_0x5a9a13={'count':0x0,'rows':[]};var _0x302d3e=_[_0x2c69('0x31')](db[_0x2c69('0x32')][_0x2c69('0x33')],function(_0x4f3398){return{'name':_0x4f3398[_0x2c69('0x34')],'type':_0x4f3398[_0x2c69('0x35')][_0x2c69('0x36')]};});_0x368201[_0x2c69('0x37')]=_[_0x2c69('0x31')](_0x302d3e,'name');_0x368201[_0x2c69('0x38')]=_[_0x2c69('0x39')](_0x21f0bf[_0x2c69('0x38')]);_0x368201[_0x2c69('0x3a')]=_[_0x2c69('0x3b')](_0x368201[_0x2c69('0x37')],_0x368201['query']);_0x22be4b['attributes']=_[_0x2c69('0x3b')](_0x368201[_0x2c69('0x37')],qs[_0x2c69('0x3c')](_0x21f0bf['query'][_0x2c69('0x3c')]));_0x22be4b[_0x2c69('0x3d')]=_0x22be4b[_0x2c69('0x3d')]['length']?_0x22be4b[_0x2c69('0x3d')]:_0x368201[_0x2c69('0x37')];if(!_0x21f0bf[_0x2c69('0x38')][_0x2c69('0x3e')](_0x2c69('0x3f'))){_0x22be4b['limit']=qs[_0x2c69('0x20')](_0x21f0bf[_0x2c69('0x38')][_0x2c69('0x20')]);_0x22be4b[_0x2c69('0x22')]=qs[_0x2c69('0x22')](_0x21f0bf['query'][_0x2c69('0x22')]);}_0x22be4b[_0x2c69('0x40')]=qs[_0x2c69('0x41')](_0x21f0bf[_0x2c69('0x38')][_0x2c69('0x41')]);_0x22be4b[_0x2c69('0x42')]=qs[_0x2c69('0x3a')](_[_0x2c69('0x43')](_0x21f0bf['query'],_0x368201[_0x2c69('0x3a')]),_0x302d3e);if(_0x21f0bf['query']['filter']){_0x22be4b['where']=_[_0x2c69('0x44')](_0x22be4b[_0x2c69('0x42')],{'$or':_['map'](_0x302d3e,function(_0x3a23f2){if(_0x3a23f2[_0x2c69('0x35')]!==_0x2c69('0x45')){var _0x5afacc={};_0x5afacc[_0x3a23f2['name']]={'$like':'%'+_0x21f0bf[_0x2c69('0x38')][_0x2c69('0x46')]+'%'};return _0x5afacc;}})});}_0x22be4b=_['merge']({},_0x22be4b,_0x21f0bf['options']);var _0x3e2ee2={'where':_0x22be4b[_0x2c69('0x42')]};return db[_0x2c69('0x32')]['count'](_0x3e2ee2)[_0x2c69('0x29')](function(_0xd63179){_0x5a9a13[_0x2c69('0x21')]=_0xd63179;if(_0x21f0bf['query'][_0x2c69('0x47')]){_0x22be4b[_0x2c69('0x48')]=[{'all':!![]}];}return db['SmsQueue'][_0x2c69('0x49')](_0x22be4b);})[_0x2c69('0x29')](function(_0x2068a0){_0x5a9a13['rows']=_0x2068a0;return _0x5a9a13;})[_0x2c69('0x29')](respondWithFilteredResult(_0x389dbf,_0x22be4b))['catch'](handleError(_0x389dbf,null));};exports[_0x2c69('0x4a')]=function(_0x50e115,_0x468a0f){var _0xea55ed={'raw':!![],'where':{'id':_0x50e115[_0x2c69('0x4b')]['id']}},_0x4af9c7={};_0x4af9c7[_0x2c69('0x37')]=_[_0x2c69('0x39')](db[_0x2c69('0x32')][_0x2c69('0x33')]);_0x4af9c7[_0x2c69('0x38')]=_['keys'](_0x50e115[_0x2c69('0x38')]);_0x4af9c7['filters']=_[_0x2c69('0x3b')](_0x4af9c7[_0x2c69('0x37')],_0x4af9c7[_0x2c69('0x38')]);_0xea55ed[_0x2c69('0x3d')]=_['intersection'](_0x4af9c7[_0x2c69('0x37')],qs[_0x2c69('0x3c')](_0x50e115['query']['fields']));_0xea55ed[_0x2c69('0x3d')]=_0xea55ed[_0x2c69('0x3d')][_0x2c69('0x4c')]?_0xea55ed[_0x2c69('0x3d')]:_0x4af9c7[_0x2c69('0x37')];if(_0x50e115['query']['includeAll']){_0xea55ed[_0x2c69('0x48')]=[{'all':!![]}];}_0xea55ed=_[_0x2c69('0x44')]({},_0xea55ed,_0x50e115['options']);return db[_0x2c69('0x32')][_0x2c69('0x4d')](_0xea55ed)[_0x2c69('0x29')](handleEntityNotFound(_0x468a0f,null))[_0x2c69('0x29')](respondWithResult(_0x468a0f,null))[_0x2c69('0x4e')](handleError(_0x468a0f,null));};exports[_0x2c69('0x4f')]=function(_0x3ca9ff,_0x114beb){return db[_0x2c69('0x32')][_0x2c69('0x4f')](_0x3ca9ff[_0x2c69('0x50')],{})[_0x2c69('0x29')](function(_0x40d1dd){var _0x3fa256=_0x3ca9ff[_0x2c69('0x51')]['get']({'plain':!![]});if(!_0x3fa256)throw new Error(_0x2c69('0x52'));if(_0x3fa256[_0x2c69('0x53')]==='user'){var _0x2b2aea=_0x40d1dd['get']({'plain':!![]});var _0xf0aa2f=_0x2c69('0x2c');return db['UserProfileSection'][_0x2c69('0x4d')]({'where':{'name':_0xf0aa2f,'userProfileId':_0x3fa256[_0x2c69('0x54')]},'raw':!![]})[_0x2c69('0x29')](function(_0x1c10c0){if(_0x1c10c0&&_0x1c10c0[_0x2c69('0x55')]===0x0){return db[_0x2c69('0x2d')][_0x2c69('0x4f')]({'name':_0x2b2aea[_0x2c69('0x2f')],'resourceId':_0x2b2aea['id'],'type':_0x1c10c0[_0x2c69('0x2f')],'sectionId':_0x1c10c0['id']},{})[_0x2c69('0x29')](function(){return _0x40d1dd;});}else{return _0x40d1dd;}})['catch'](function(_0x1c50dd){logger[_0x2c69('0x56')](_0x2c69('0x57'),_0x1c50dd);throw _0x1c50dd;});}return _0x40d1dd;})[_0x2c69('0x29')](respondWithResult(_0x114beb,0xc9))[_0x2c69('0x4e')](handleError(_0x114beb,null));};exports[_0x2c69('0x28')]=function(_0x358cbe,_0x5c03b7){if(_0x358cbe[_0x2c69('0x50')]['id']){delete _0x358cbe[_0x2c69('0x50')]['id'];}return db['SmsQueue']['find']({'where':{'id':_0x358cbe['params']['id']}})[_0x2c69('0x29')](handleEntityNotFound(_0x5c03b7,null))[_0x2c69('0x29')](saveUpdates(_0x358cbe[_0x2c69('0x50')],null))['then'](respondWithResult(_0x5c03b7,null))['catch'](handleError(_0x5c03b7,null));};exports[_0x2c69('0x2a')]=function(_0x49617e,_0x1e065e){return db[_0x2c69('0x32')][_0x2c69('0x4d')]({'where':{'id':_0x49617e[_0x2c69('0x4b')]['id']}})[_0x2c69('0x29')](handleEntityNotFound(_0x1e065e,null))[_0x2c69('0x29')](removeEntity(_0x1e065e,null))[_0x2c69('0x4e')](handleError(_0x1e065e,null));};exports[_0x2c69('0x58')]=function(_0x57205a,_0xfb795a){return db[_0x2c69('0x32')][_0x2c69('0x58')]()[_0x2c69('0x29')](respondWithResult(_0xfb795a,null))['catch'](handleError(_0xfb795a,null));};exports[_0x2c69('0x59')]=function(_0x25b079,_0x3465c9,_0x381719){var _0x58d425={'raw':!![],'where':{}},_0x1b122f={},_0x12f224;return db[_0x2c69('0x32')]['findOne']({'where':{'id':_0x25b079[_0x2c69('0x4b')]['id']}})[_0x2c69('0x29')](handleEntityNotFound(_0x3465c9,null))[_0x2c69('0x29')](function(_0x494f49){if(_0x494f49){_0x12f224=_0x494f49[_0x2c69('0x2b')]({'plain':!![]});_0x1b122f[_0x2c69('0x37')]=_[_0x2c69('0x39')](db['UserSmsQueue'][_0x2c69('0x33')]);_0x1b122f[_0x2c69('0x38')]=_[_0x2c69('0x39')](_0x25b079[_0x2c69('0x38')]);_0x1b122f['filters']=_[_0x2c69('0x3b')](_0x1b122f['model'],_0x1b122f[_0x2c69('0x38')]);_0x58d425['attributes']=_[_0x2c69('0x3b')](_0x1b122f[_0x2c69('0x37')],qs['fields'](_0x25b079[_0x2c69('0x38')][_0x2c69('0x3c')]));_0x58d425[_0x2c69('0x3d')]=_0x58d425[_0x2c69('0x3d')][_0x2c69('0x4c')]?_0x58d425[_0x2c69('0x3d')]:_0x1b122f['model'];if(!_0x25b079[_0x2c69('0x38')][_0x2c69('0x3e')](_0x2c69('0x3f'))){_0x58d425[_0x2c69('0x20')]=qs['limit'](_0x25b079['query'][_0x2c69('0x20')]);_0x58d425[_0x2c69('0x22')]=qs[_0x2c69('0x22')](_0x25b079[_0x2c69('0x38')][_0x2c69('0x22')]);}_0x58d425[_0x2c69('0x40')]=qs[_0x2c69('0x41')](_0x25b079[_0x2c69('0x38')]['sort']);_0x58d425['where']=qs[_0x2c69('0x3a')](_[_0x2c69('0x43')](_0x25b079['query'],_0x1b122f[_0x2c69('0x3a')]));_0x58d425[_0x2c69('0x42')]['SmsQueueId']=_0x494f49['id'];if(_0x25b079['query'][_0x2c69('0x46')]){_0x58d425[_0x2c69('0x42')]=_[_0x2c69('0x44')](_0x58d425[_0x2c69('0x42')],{'$or':_[_0x2c69('0x31')](_0x58d425[_0x2c69('0x3d')],function(_0xa21e89){var _0x4a5e58={};_0x4a5e58[_0xa21e89]={'$like':'%'+_0x25b079['query'][_0x2c69('0x46')]+'%'};return _0x4a5e58;})});}_0x58d425=_[_0x2c69('0x44')]({},_0x58d425,_0x25b079[_0x2c69('0x5a')]);return db[_0x2c69('0x5b')][_0x2c69('0x49')](_0x58d425);}})[_0x2c69('0x29')](function(_0x47148d){if(_0x47148d){return db['User'][_0x2c69('0x5c')]({'where':{'id':_[_0x2c69('0x31')](_0x47148d,_0x2c69('0x5d')),'role':_0x2c69('0x5e')},'attributes':['id',_0x2c69('0x2f'),_0x2c69('0x5f'),'updatedAt','createdAt']});}})['then'](function(_0x1e78ef){if(_0x1e78ef){return{'count':_0x1e78ef['count'],'rows':_[_0x2c69('0x31')](_0x1e78ef[_0x2c69('0x60')],function(_0x2cf853){return{'membername':_0x2cf853[_0x2c69('0x2f')],'UserId':_0x2cf853['id'],'queue_name':_0x12f224[_0x2c69('0x2f')],'SmsQueueId':_0x12f224['id'],'interface':util['format'](_0x2c69('0x61'),_0x2c69('0x62'),_0x2cf853[_0x2c69('0x2f')]),'penalty':0x0,'paused':_0x2cf853['smsPause'],'createdAt':_0x2cf853['createdAt'],'updatedAt':_0x2cf853[_0x2c69('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2c69('0x29')](respondWithFilteredResult(_0x3465c9,_0x58d425))['catch'](handleError(_0x3465c9,null));};exports[_0x2c69('0x64')]=function(_0x2f3383,_0x3a2de0,_0x195909){var _0x1ef843={};var _0x1e4e34={};var _0x178de7;var _0x284182;return db[_0x2c69('0x32')]['findOne']({'where':{'id':_0x2f3383[_0x2c69('0x4b')]['id']}})[_0x2c69('0x29')](handleEntityNotFound(_0x3a2de0,null))[_0x2c69('0x29')](function(_0x36c09c){if(_0x36c09c){_0x178de7=_0x36c09c;_0x1e4e34[_0x2c69('0x37')]=_[_0x2c69('0x39')](db[_0x2c69('0x65')][_0x2c69('0x33')]);_0x1e4e34[_0x2c69('0x38')]=_['keys'](_0x2f3383['query']);_0x1e4e34[_0x2c69('0x3a')]=_['intersection'](_0x1e4e34['model'],_0x1e4e34[_0x2c69('0x38')]);_0x1ef843[_0x2c69('0x3d')]=_[_0x2c69('0x3b')](_0x1e4e34[_0x2c69('0x37')],qs[_0x2c69('0x3c')](_0x2f3383[_0x2c69('0x38')][_0x2c69('0x3c')]));_0x1ef843[_0x2c69('0x3d')]=_0x1ef843['attributes'][_0x2c69('0x4c')]?_0x1ef843[_0x2c69('0x3d')]:_0x1e4e34['model'];_0x1ef843['order']=qs[_0x2c69('0x41')](_0x2f3383[_0x2c69('0x38')][_0x2c69('0x41')]);_0x1ef843[_0x2c69('0x42')]=qs[_0x2c69('0x3a')](_['pick'](_0x2f3383[_0x2c69('0x38')],_0x1e4e34[_0x2c69('0x3a')]));if(_0x2f3383[_0x2c69('0x38')][_0x2c69('0x46')]){_0x1ef843[_0x2c69('0x42')]=_[_0x2c69('0x44')](_0x1ef843['where'],{'$or':_[_0x2c69('0x31')](_0x1ef843[_0x2c69('0x3d')],function(_0x4e12a6){var _0x246713={};_0x246713[_0x4e12a6]={'$like':'%'+_0x2f3383[_0x2c69('0x38')][_0x2c69('0x46')]+'%'};return _0x246713;})});}_0x1ef843=_[_0x2c69('0x44')]({},_0x1ef843,_0x2f3383[_0x2c69('0x5a')]);return _0x178de7['getTeams'](_0x1ef843);}})[_0x2c69('0x29')](function(_0x4771f5){if(_0x4771f5){_0x284182=_0x4771f5[_0x2c69('0x4c')];if(!_0x2f3383[_0x2c69('0x38')]['hasOwnProperty'](_0x2c69('0x3f'))){_0x1ef843[_0x2c69('0x20')]=qs[_0x2c69('0x20')](_0x2f3383[_0x2c69('0x38')][_0x2c69('0x20')]);_0x1ef843['offset']=qs['offset'](_0x2f3383['query'][_0x2c69('0x22')]);}return _0x178de7[_0x2c69('0x64')](_0x1ef843);}})[_0x2c69('0x29')](function(_0xeb2ada){if(_0xeb2ada){return _0xeb2ada?{'count':_0x284182,'rows':_0xeb2ada}:null;}})[_0x2c69('0x29')](respondWithResult(_0x3a2de0,null))['catch'](handleError(_0x3a2de0,null));};exports[_0x2c69('0x66')]=function(_0x1707a1,_0x2589c5,_0x5415c4){var _0x5bcc1b=_0x1707a1[_0x2c69('0x50')]['ids'];return db[_0x2c69('0x65')][_0x2c69('0x49')]({'where':{'id':_0x5bcc1b},'attributes':['id'],'include':[{'model':db[_0x2c69('0x67')],'as':_0x2c69('0x68'),'attributes':['id',_0x2c69('0x2f'),_0x2c69('0x69'),_0x2c69('0x6a'),_0x2c69('0x6b')],'raw':!![]}]})['then'](function(_0x3f2fb5){if(_0x3f2fb5){var _0x197c9b=_[_0x2c69('0x6c')](_0x3f2fb5,function(_0x569183){var _0x4a6bd3=_0x569183[_0x2c69('0x2b')]({'plain':!![]});return _0x4a6bd3[_0x2c69('0x68')];});return db['SmsQueue']['find']({'where':{'id':_0x1707a1[_0x2c69('0x4b')]['id']}})[_0x2c69('0x29')](function(_0x560d63){return db[_0x2c69('0x6d')]['transaction'](function(_0x27015e){return _0x560d63[_0x2c69('0x66')](_0x5bcc1b,{'transaction':_0x27015e})['then'](function(){return BPromise[_0x2c69('0x6e')](_0x197c9b,function(_0x3c8299){return db[_0x2c69('0x5b')][_0x2c69('0x6f')]({'where':{'UserId':_0x3c8299['id'],'SmsQueueId':_0x1707a1[_0x2c69('0x4b')]['id']},'transaction':_0x27015e});});})['then'](function(){_0x197c9b[_0x2c69('0x70')](function(_0x1a3351){socket[_0x2c69('0x71')]('userSmsQueue:save',{'UserId':_0x1a3351['id'],'SmsQueueId':_0x560d63['id']});});});});});}})[_0x2c69('0x29')](respondWithStatusCode(_0x2589c5,null))['catch'](handleError(_0x2589c5,null));};exports[_0x2c69('0x72')]=function(_0x587746,_0x86c468,_0x3920ab){return db['Team']['findAll']({'where':{'id':_0x587746['query'][_0x2c69('0x73')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2c69('0x68'),'attributes':['id'],'raw':!![]}]})[_0x2c69('0x29')](handleEntityNotFound(_0x86c468,null))[_0x2c69('0x29')](function(_0x1d5cae){var _0x2f5b58=_[_0x2c69('0x31')](_0x1d5cae,'id');var _0x32cc7a=[];var _0x204ced=[];var _0x5f5809=squel[_0x2c69('0x74')]();_0x5f5809[_0x2c69('0x75')]('tq.TeamId')[_0x2c69('0x76')](_0x2c69('0x77'),'tq')[_0x2c69('0x78')](_0x2c69('0x79'),'ut',_0x2c69('0x7a'))[_0x2c69('0x42')](_0x2c69('0x7b'),_0x587746[_0x2c69('0x4b')]['id']);for(var _0x4ed55d=0x0;_0x4ed55d<_0x1d5cae[_0x2c69('0x4c')];_0x4ed55d+=0x1){let _0x20ed19=_0x1d5cae[_0x4ed55d];for(var _0x50514a=0x0;_0x50514a<_0x20ed19[_0x2c69('0x68')][_0x2c69('0x4c')];_0x50514a+=0x1){let _0x57fe4a=_0x20ed19['Agents'][_0x50514a];var _0x5c5c1e=_0x5f5809[_0x2c69('0x7c')]();_0x5c5c1e[_0x2c69('0x42')](_0x2c69('0x7d'),_0x57fe4a['id']);_0x204ced[_0x2c69('0x7e')](db[_0x2c69('0x6d')][_0x2c69('0x38')](_0x5c5c1e['toString'](),{'type':db[_0x2c69('0x6d')][_0x2c69('0x7f')][_0x2c69('0x80')]})['then'](function(_0x1d1fa9){if(_0x1d1fa9[_0x2c69('0x4c')]===0x1){return _0x57fe4a['id'];}else{var _0x164110=_[_0x2c69('0x81')](_['map'](_0x1d1fa9,_0x2c69('0x82')),function(_0x5caa1d){return _[_0x2c69('0x83')](_0x2f5b58,_0x5caa1d);});if(_0x164110){return _0x57fe4a['id'];}}}));}}return BPromise[_0x2c69('0x84')](_0x204ced)['then'](function(_0xccf1b9){_0x32cc7a=_(_0x32cc7a)[_0x2c69('0x85')](_0xccf1b9)['compact']()[_0x2c69('0x86')]();return db[_0x2c69('0x32')][_0x2c69('0x4d')]({'where':{'id':_0x587746['params']['id']}})[_0x2c69('0x29')](function(_0x239f12){return db[_0x2c69('0x6d')][_0x2c69('0x87')](function(_0x3483cf){return _0x239f12[_0x2c69('0x72')](_0x587746['query'][_0x2c69('0x73')],{'transaction':_0x3483cf})[_0x2c69('0x29')](function(){if(!_[_0x2c69('0x88')](_0x32cc7a)){return _0x239f12[_0x2c69('0x89')](_0x32cc7a,{'transaction':_0x3483cf});}})['then'](function(){_0x32cc7a[_0x2c69('0x70')](function(_0x7e2643){socket['emit'](_0x2c69('0x8a'),{'UserId':_0x7e2643,'SmsQueueId':_0x239f12['id']});});});});});});})['then'](respondWithStatusCode(_0x86c468,null))[_0x2c69('0x4e')](handleError(_0x86c468,null));};exports[_0x2c69('0x8b')]=function(_0x54099f,_0x35d057,_0x4e5660){return db['SmsQueue']['find']({'where':{'id':_0x54099f[_0x2c69('0x4b')]['id']}})[_0x2c69('0x29')](handleEntityNotFound(_0x35d057,null))[_0x2c69('0x29')](function(_0x24751c){if(_0x24751c){return _0x24751c[_0x2c69('0x8b')](_0x54099f[_0x2c69('0x50')][_0x2c69('0x73')],_[_0x2c69('0x8c')](_0x54099f[_0x2c69('0x50')],[_0x2c69('0x73'),'id'])||{})[_0x2c69('0x8d')](function(_0x385c72){for(var _0xa75601=0x0;_0xa75601<_0x54099f[_0x2c69('0x50')][_0x2c69('0x73')][_0x2c69('0x4c')];_0xa75601+=0x1){socket['emit'](_0x2c69('0x8e'),{'UserId':Number(_0x54099f[_0x2c69('0x50')][_0x2c69('0x73')][_0xa75601]),'SmsQueueId':Number(_0x54099f[_0x2c69('0x4b')]['id'])});}return _0x385c72;});}})[_0x2c69('0x29')](respondWithResult(_0x35d057,null))[_0x2c69('0x4e')](handleError(_0x35d057,null));};exports['removeAgents']=function(_0x5be429,_0xaf1ac9,_0x388f34){return db[_0x2c69('0x32')]['find']({'where':{'id':_0x5be429[_0x2c69('0x4b')]['id']}})[_0x2c69('0x29')](handleEntityNotFound(_0xaf1ac9,null))['then'](function(_0x4231b3){if(_0x4231b3){return _0x4231b3[_0x2c69('0x89')](_0x5be429[_0x2c69('0x38')][_0x2c69('0x73')])[_0x2c69('0x29')](function(){if(_[_0x2c69('0x8f')](_0x5be429[_0x2c69('0x38')]['ids'])){for(var _0xdcb52c=0x0;_0xdcb52c<_0x5be429[_0x2c69('0x38')][_0x2c69('0x73')]['length'];_0xdcb52c+=0x1){socket[_0x2c69('0x71')](_0x2c69('0x8a'),{'UserId':Number(_0x5be429[_0x2c69('0x38')][_0x2c69('0x73')][_0xdcb52c]),'SmsQueueId':Number(_0x5be429[_0x2c69('0x4b')]['id'])});}}else{socket['emit'](_0x2c69('0x8a'),{'UserId':Number(_0x5be429['query']['ids']),'SmsQueueId':Number(_0x5be429[_0x2c69('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0xaf1ac9,null))[_0x2c69('0x4e')](handleError(_0xaf1ac9,null));};exports[_0x2c69('0x90')]=function(_0x39a87c,_0x465e6b,_0x5e71e6){var _0x16db8a={};var _0x307d11={};var _0x58edd9;var _0xb1e380;return db[_0x2c69('0x32')][_0x2c69('0x91')]({'where':{'id':_0x39a87c[_0x2c69('0x4b')]['id']}})[_0x2c69('0x29')](handleEntityNotFound(_0x465e6b,null))[_0x2c69('0x29')](function(_0x1836f6){if(_0x1836f6){_0x58edd9=_0x1836f6;_0x307d11['model']=_[_0x2c69('0x39')](db[_0x2c69('0x67')][_0x2c69('0x33')]);_0x307d11['query']=_[_0x2c69('0x39')](_0x39a87c['query']);_0x307d11[_0x2c69('0x3a')]=_[_0x2c69('0x3b')](_0x307d11[_0x2c69('0x37')],_0x307d11['query']);_0x16db8a[_0x2c69('0x3d')]=_['intersection'](_0x307d11['model'],qs[_0x2c69('0x3c')](_0x39a87c[_0x2c69('0x38')][_0x2c69('0x3c')]));_0x16db8a[_0x2c69('0x3d')]=_0x16db8a['attributes']['length']?_0x16db8a[_0x2c69('0x3d')]:_0x307d11[_0x2c69('0x37')];_0x16db8a[_0x2c69('0x40')]=qs['sort'](_0x39a87c[_0x2c69('0x38')]['sort']);_0x16db8a['where']=qs[_0x2c69('0x3a')](_[_0x2c69('0x43')](_0x39a87c['query'],_0x307d11[_0x2c69('0x3a')]));if(_0x39a87c['query'][_0x2c69('0x46')]){_0x16db8a[_0x2c69('0x42')]=_[_0x2c69('0x44')](_0x16db8a[_0x2c69('0x42')],{'$or':_[_0x2c69('0x31')](_0x16db8a['attributes'],function(_0x44e79d){var _0x59eb00={};_0x59eb00[_0x44e79d]={'$like':'%'+_0x39a87c[_0x2c69('0x38')][_0x2c69('0x46')]+'%'};return _0x59eb00;})});}_0x16db8a=_[_0x2c69('0x44')]({},_0x16db8a,_0x39a87c['options']);return _0x58edd9[_0x2c69('0x90')](_0x16db8a);}})[_0x2c69('0x29')](function(_0x3605d8){if(_0x3605d8){_0xb1e380=_0x3605d8[_0x2c69('0x4c')];if(!_0x39a87c[_0x2c69('0x38')][_0x2c69('0x3e')](_0x2c69('0x3f'))){_0x16db8a[_0x2c69('0x20')]=qs['limit'](_0x39a87c['query'][_0x2c69('0x20')]);_0x16db8a[_0x2c69('0x22')]=qs[_0x2c69('0x22')](_0x39a87c[_0x2c69('0x38')]['offset']);}return _0x58edd9[_0x2c69('0x90')](_0x16db8a);}})['then'](function(_0x52a334){if(_0x52a334){return _0x52a334?{'count':_0xb1e380,'rows':_0x52a334}:null;}})[_0x2c69('0x29')](respondWithResult(_0x465e6b,null))['catch'](handleError(_0x465e6b,null));}; \ No newline at end of file +var _0x9be8=['../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','update','destroy','get','UserProfileResource','then','stack','name','index','map','SmsQueue','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','VIRTUAL','where','includeAll','findAll','rows','catch','show','params','include','options','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','SmsQueues','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','pick','SmsQueueId','UserSmsQueue','findAndCountAll','smsPause','createdAt','format','%s/%s','updatedAt','getTeams','addTeams','ids','Team','Agents','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','User','select','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','includes','union','compact','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0xd2a1d4,_0x475be0){var _0x5927cc=function(_0x351a93){while(--_0x351a93){_0xd2a1d4['push'](_0xd2a1d4['shift']());}};_0x5927cc(++_0x475be0);}(_0x9be8,0x103));var _0x89be=function(_0x23516c,_0x16ea34){_0x23516c=_0x23516c-0x0;var _0x591310=_0x9be8[_0x23516c];return _0x591310;};'use strict';var emlformat=require(_0x89be('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x89be('0x1'));var jsonpatch=require(_0x89be('0x2'));var rp=require(_0x89be('0x3'));var moment=require(_0x89be('0x4'));var BPromise=require(_0x89be('0x5'));var Mustache=require(_0x89be('0x6'));var util=require(_0x89be('0x7'));var path=require('path');var sox=require(_0x89be('0x8'));var csv=require('to-csv');var ejs=require(_0x89be('0x9'));var fs=require('fs');var fs_extra=require(_0x89be('0xa'));var _=require(_0x89be('0xb'));var squel=require(_0x89be('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x89be('0xd'));var toCsv=require(_0x89be('0xe'));var querystring=require(_0x89be('0xf'));var Papa=require('papaparse');var Redis=require(_0x89be('0x10'));var authService=require(_0x89be('0x11'));var qs=require(_0x89be('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x89be('0x13'));var logger=require(_0x89be('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x89be('0x15'));var licenseUtil=require(_0x89be('0x16'));var db=require(_0x89be('0x17'))['db'];config[_0x89be('0x18')]=_[_0x89be('0x19')](config[_0x89be('0x18')],{'host':_0x89be('0x1a'),'port':0x18eb});var socket=require(_0x89be('0x1b'))(new Redis(config[_0x89be('0x18')]));require(_0x89be('0x1c'))[_0x89be('0x1d')](socket);function respondWithStatusCode(_0x1c7bf7,_0x10e3e6){_0x10e3e6=_0x10e3e6||0xcc;return function(_0x5c3a6e){if(_0x5c3a6e){return _0x1c7bf7[_0x89be('0x1e')](_0x10e3e6);}return _0x1c7bf7[_0x89be('0x1f')](_0x10e3e6)[_0x89be('0x20')]();};}function respondWithResult(_0xab6a3a,_0x58103c){_0x58103c=_0x58103c||0xc8;return function(_0x529e2e){if(_0x529e2e){return _0xab6a3a[_0x89be('0x1f')](_0x58103c)['json'](_0x529e2e);}};}function respondWithFilteredResult(_0x3e9b24,_0x132b3f){return function(_0x45173e){if(_0x45173e){var _0x4a77ac=typeof _0x132b3f[_0x89be('0x21')]===_0x89be('0x22')&&typeof _0x132b3f[_0x89be('0x23')]===_0x89be('0x22');var _0x5edaad=_0x45173e[_0x89be('0x24')];var _0x406897=_0x4a77ac?0x0:_0x132b3f[_0x89be('0x21')];var _0x24e85c=_0x4a77ac?_0x45173e['count']:_0x132b3f[_0x89be('0x21')]+_0x132b3f[_0x89be('0x23')];var _0x1cbe07;if(_0x24e85c>=_0x5edaad){_0x24e85c=_0x5edaad;_0x1cbe07=0xc8;}else{_0x1cbe07=0xce;}_0x3e9b24['status'](_0x1cbe07);return _0x3e9b24[_0x89be('0x25')]('Content-Range',_0x406897+'-'+_0x24e85c+'/'+_0x5edaad)['json'](_0x45173e);}return null;};}function patchUpdates(_0x3f2944){return function(_0x3a02ca){try{jsonpatch[_0x89be('0x26')](_0x3a02ca,_0x3f2944,!![]);}catch(_0x390b8f){return BPromise[_0x89be('0x27')](_0x390b8f);}return _0x3a02ca['save']();};}function saveUpdates(_0x58d521,_0x3a6e54){return function(_0xc89675){if(_0xc89675){return _0xc89675[_0x89be('0x28')](_0x58d521)['then'](function(_0x3d2ff6){return _0x3d2ff6;});}return null;};}function removeEntity(_0x276756,_0x417b6c){return function(_0x169673){if(_0x169673){return _0x169673[_0x89be('0x29')]()['then'](function(){var _0x184f7d=_0x169673[_0x89be('0x2a')]({'plain':!![]});var _0x2054ce='SmsQueues';return db[_0x89be('0x2b')]['destroy']({'where':{'type':_0x2054ce,'resourceId':_0x184f7d['id']}})['then'](function(){return _0x169673;});})[_0x89be('0x2c')](function(){_0x276756[_0x89be('0x1f')](0xcc)[_0x89be('0x20')]();});}};}function handleEntityNotFound(_0x1916dd,_0x3be5bc){return function(_0x440071){if(!_0x440071){_0x1916dd[_0x89be('0x1e')](0x194);}return _0x440071;};}function handleError(_0x4e9b03,_0x4af787){_0x4af787=_0x4af787||0x1f4;return function(_0x474a23){logger['error'](_0x474a23[_0x89be('0x2d')]);if(_0x474a23[_0x89be('0x2e')]){delete _0x474a23['name'];}_0x4e9b03['status'](_0x4af787)['send'](_0x474a23);};}exports[_0x89be('0x2f')]=function(_0x5b889d,_0x54298f){var _0x1c2618={},_0x513e5e={},_0x27b2c0={'count':0x0,'rows':[]};var _0x5a503f=_[_0x89be('0x30')](db[_0x89be('0x31')][_0x89be('0x32')],function(_0x17a6d9){return{'name':_0x17a6d9[_0x89be('0x33')],'type':_0x17a6d9['type'][_0x89be('0x34')]};});_0x513e5e['model']=_[_0x89be('0x30')](_0x5a503f,_0x89be('0x2e'));_0x513e5e[_0x89be('0x35')]=_[_0x89be('0x36')](_0x5b889d['query']);_0x513e5e[_0x89be('0x37')]=_[_0x89be('0x38')](_0x513e5e[_0x89be('0x39')],_0x513e5e[_0x89be('0x35')]);_0x1c2618[_0x89be('0x3a')]=_[_0x89be('0x38')](_0x513e5e[_0x89be('0x39')],qs[_0x89be('0x3b')](_0x5b889d[_0x89be('0x35')]['fields']));_0x1c2618['attributes']=_0x1c2618[_0x89be('0x3a')][_0x89be('0x3c')]?_0x1c2618[_0x89be('0x3a')]:_0x513e5e[_0x89be('0x39')];if(!_0x5b889d[_0x89be('0x35')][_0x89be('0x3d')](_0x89be('0x3e'))){_0x1c2618[_0x89be('0x23')]=qs[_0x89be('0x23')](_0x5b889d[_0x89be('0x35')]['limit']);_0x1c2618[_0x89be('0x21')]=qs[_0x89be('0x21')](_0x5b889d['query'][_0x89be('0x21')]);}_0x1c2618[_0x89be('0x3f')]=qs[_0x89be('0x40')](_0x5b889d['query'][_0x89be('0x40')]);_0x1c2618['where']=qs[_0x89be('0x37')](_['pick'](_0x5b889d[_0x89be('0x35')],_0x513e5e['filters']),_0x5a503f);if(_0x5b889d[_0x89be('0x35')][_0x89be('0x41')]){_0x1c2618['where']=_[_0x89be('0x42')](_0x1c2618['where'],{'$or':_['map'](_0x5a503f,function(_0x6d3626){if(_0x6d3626['type']!==_0x89be('0x43')){var _0x5e1458={};_0x5e1458[_0x6d3626[_0x89be('0x2e')]]={'$like':'%'+_0x5b889d['query'][_0x89be('0x41')]+'%'};return _0x5e1458;}})});}_0x1c2618=_['merge']({},_0x1c2618,_0x5b889d['options']);var _0xea59ba={'where':_0x1c2618[_0x89be('0x44')]};return db[_0x89be('0x31')][_0x89be('0x24')](_0xea59ba)['then'](function(_0xa4bfcf){_0x27b2c0[_0x89be('0x24')]=_0xa4bfcf;if(_0x5b889d[_0x89be('0x35')][_0x89be('0x45')]){_0x1c2618['include']=[{'all':!![]}];}return db[_0x89be('0x31')][_0x89be('0x46')](_0x1c2618);})[_0x89be('0x2c')](function(_0x5538d1){_0x27b2c0[_0x89be('0x47')]=_0x5538d1;return _0x27b2c0;})[_0x89be('0x2c')](respondWithFilteredResult(_0x54298f,_0x1c2618))[_0x89be('0x48')](handleError(_0x54298f,null));};exports[_0x89be('0x49')]=function(_0x18151e,_0x35ae5d){var _0x4752d7={'raw':!![],'where':{'id':_0x18151e[_0x89be('0x4a')]['id']}},_0x1786f5={};_0x1786f5[_0x89be('0x39')]=_['keys'](db['SmsQueue'][_0x89be('0x32')]);_0x1786f5['query']=_[_0x89be('0x36')](_0x18151e[_0x89be('0x35')]);_0x1786f5[_0x89be('0x37')]=_[_0x89be('0x38')](_0x1786f5[_0x89be('0x39')],_0x1786f5['query']);_0x4752d7[_0x89be('0x3a')]=_[_0x89be('0x38')](_0x1786f5['model'],qs['fields'](_0x18151e['query'][_0x89be('0x3b')]));_0x4752d7[_0x89be('0x3a')]=_0x4752d7[_0x89be('0x3a')]['length']?_0x4752d7['attributes']:_0x1786f5[_0x89be('0x39')];if(_0x18151e[_0x89be('0x35')]['includeAll']){_0x4752d7[_0x89be('0x4b')]=[{'all':!![]}];}_0x4752d7=_['merge']({},_0x4752d7,_0x18151e[_0x89be('0x4c')]);return db[_0x89be('0x31')][_0x89be('0x4d')](_0x4752d7)[_0x89be('0x2c')](handleEntityNotFound(_0x35ae5d,null))['then'](respondWithResult(_0x35ae5d,null))[_0x89be('0x48')](handleError(_0x35ae5d,null));};exports['create']=function(_0x69e136,_0x4e6485){return db[_0x89be('0x31')]['create'](_0x69e136[_0x89be('0x4e')],{})[_0x89be('0x2c')](function(_0x20b58d){var _0x21c825=_0x69e136['user'][_0x89be('0x2a')]({'plain':!![]});if(!_0x21c825)throw new Error(_0x89be('0x4f'));if(_0x21c825[_0x89be('0x50')]===_0x89be('0x51')){var _0x4116fb=_0x20b58d[_0x89be('0x2a')]({'plain':!![]});var _0xfb1c01=_0x89be('0x52');return db[_0x89be('0x53')][_0x89be('0x4d')]({'where':{'name':_0xfb1c01,'userProfileId':_0x21c825[_0x89be('0x54')]},'raw':!![]})[_0x89be('0x2c')](function(_0x2e9275){if(_0x2e9275&&_0x2e9275['autoAssociation']===0x0){return db[_0x89be('0x2b')][_0x89be('0x55')]({'name':_0x4116fb[_0x89be('0x2e')],'resourceId':_0x4116fb['id'],'type':_0x2e9275[_0x89be('0x2e')],'sectionId':_0x2e9275['id']},{})[_0x89be('0x2c')](function(){return _0x20b58d;});}else{return _0x20b58d;}})[_0x89be('0x48')](function(_0x5e084d){logger['error'](_0x89be('0x56'),_0x5e084d);throw _0x5e084d;});}return _0x20b58d;})[_0x89be('0x2c')](respondWithResult(_0x4e6485,0xc9))[_0x89be('0x48')](handleError(_0x4e6485,null));};exports[_0x89be('0x28')]=function(_0x2ba70c,_0x2d41aa){if(_0x2ba70c[_0x89be('0x4e')]['id']){delete _0x2ba70c[_0x89be('0x4e')]['id'];}return db[_0x89be('0x31')][_0x89be('0x4d')]({'where':{'id':_0x2ba70c[_0x89be('0x4a')]['id']}})[_0x89be('0x2c')](handleEntityNotFound(_0x2d41aa,null))[_0x89be('0x2c')](saveUpdates(_0x2ba70c[_0x89be('0x4e')],null))[_0x89be('0x2c')](respondWithResult(_0x2d41aa,null))[_0x89be('0x48')](handleError(_0x2d41aa,null));};exports[_0x89be('0x29')]=function(_0x3353f8,_0x380d93){return db[_0x89be('0x31')]['find']({'where':{'id':_0x3353f8[_0x89be('0x4a')]['id']}})[_0x89be('0x2c')](handleEntityNotFound(_0x380d93,null))[_0x89be('0x2c')](removeEntity(_0x380d93,null))[_0x89be('0x48')](handleError(_0x380d93,null));};exports[_0x89be('0x57')]=function(_0x244f7e,_0x44ab62){return db[_0x89be('0x31')][_0x89be('0x57')]()[_0x89be('0x2c')](respondWithResult(_0x44ab62,null))[_0x89be('0x48')](handleError(_0x44ab62,null));};exports[_0x89be('0x58')]=function(_0x51dcfe,_0x168720,_0x23653a){var _0x1f8618={'raw':!![],'where':{}},_0x4fec42={},_0x1206ba;return db[_0x89be('0x31')][_0x89be('0x59')]({'where':{'id':_0x51dcfe[_0x89be('0x4a')]['id']}})[_0x89be('0x2c')](handleEntityNotFound(_0x168720,null))[_0x89be('0x2c')](function(_0x557839){if(_0x557839){_0x1206ba=_0x557839[_0x89be('0x2a')]({'plain':!![]});_0x4fec42[_0x89be('0x39')]=_['keys'](db['UserSmsQueue'][_0x89be('0x32')]);_0x4fec42[_0x89be('0x35')]=_[_0x89be('0x36')](_0x51dcfe[_0x89be('0x35')]);_0x4fec42['filters']=_[_0x89be('0x38')](_0x4fec42['model'],_0x4fec42[_0x89be('0x35')]);_0x1f8618[_0x89be('0x3a')]=_[_0x89be('0x38')](_0x4fec42[_0x89be('0x39')],qs[_0x89be('0x3b')](_0x51dcfe['query'][_0x89be('0x3b')]));_0x1f8618[_0x89be('0x3a')]=_0x1f8618[_0x89be('0x3a')][_0x89be('0x3c')]?_0x1f8618[_0x89be('0x3a')]:_0x4fec42[_0x89be('0x39')];if(!_0x51dcfe[_0x89be('0x35')]['hasOwnProperty'](_0x89be('0x3e'))){_0x1f8618[_0x89be('0x23')]=qs[_0x89be('0x23')](_0x51dcfe['query'][_0x89be('0x23')]);_0x1f8618[_0x89be('0x21')]=qs[_0x89be('0x21')](_0x51dcfe[_0x89be('0x35')]['offset']);}_0x1f8618[_0x89be('0x3f')]=qs[_0x89be('0x40')](_0x51dcfe[_0x89be('0x35')]['sort']);_0x1f8618['where']=qs[_0x89be('0x37')](_[_0x89be('0x5a')](_0x51dcfe[_0x89be('0x35')],_0x4fec42[_0x89be('0x37')]));_0x1f8618[_0x89be('0x44')][_0x89be('0x5b')]=_0x557839['id'];if(_0x51dcfe[_0x89be('0x35')][_0x89be('0x41')]){_0x1f8618[_0x89be('0x44')]=_[_0x89be('0x42')](_0x1f8618[_0x89be('0x44')],{'$or':_[_0x89be('0x30')](_0x1f8618[_0x89be('0x3a')],function(_0x2f48b6){var _0x46c611={};_0x46c611[_0x2f48b6]={'$like':'%'+_0x51dcfe[_0x89be('0x35')]['filter']+'%'};return _0x46c611;})});}_0x1f8618=_[_0x89be('0x42')]({},_0x1f8618,_0x51dcfe['options']);return db[_0x89be('0x5c')][_0x89be('0x46')](_0x1f8618);}})[_0x89be('0x2c')](function(_0x339b4d){if(_0x339b4d){return db['User'][_0x89be('0x5d')]({'where':{'id':_['map'](_0x339b4d,'UserId'),'role':'agent'},'attributes':['id',_0x89be('0x2e'),_0x89be('0x5e'),'updatedAt',_0x89be('0x5f')]});}})[_0x89be('0x2c')](function(_0x1220a4){if(_0x1220a4){return{'count':_0x1220a4[_0x89be('0x24')],'rows':_['map'](_0x1220a4[_0x89be('0x47')],function(_0x54cec6){return{'membername':_0x54cec6['name'],'UserId':_0x54cec6['id'],'queue_name':_0x1206ba[_0x89be('0x2e')],'SmsQueueId':_0x1206ba['id'],'interface':util[_0x89be('0x60')](_0x89be('0x61'),'SIP',_0x54cec6[_0x89be('0x2e')]),'penalty':0x0,'paused':_0x54cec6[_0x89be('0x5e')],'createdAt':_0x54cec6['createdAt'],'updatedAt':_0x54cec6[_0x89be('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x168720,_0x1f8618))[_0x89be('0x48')](handleError(_0x168720,null));};exports[_0x89be('0x63')]=function(_0x2f8c39,_0x303baa,_0x5dd959){var _0x3d3d5c={};var _0x55f8fe={};var _0x1be6f8;var _0x2024d8;return db['SmsQueue']['findOne']({'where':{'id':_0x2f8c39[_0x89be('0x4a')]['id']}})[_0x89be('0x2c')](handleEntityNotFound(_0x303baa,null))['then'](function(_0x15635b){if(_0x15635b){_0x1be6f8=_0x15635b;_0x55f8fe['model']=_[_0x89be('0x36')](db['Team'][_0x89be('0x32')]);_0x55f8fe[_0x89be('0x35')]=_['keys'](_0x2f8c39['query']);_0x55f8fe[_0x89be('0x37')]=_[_0x89be('0x38')](_0x55f8fe[_0x89be('0x39')],_0x55f8fe['query']);_0x3d3d5c[_0x89be('0x3a')]=_['intersection'](_0x55f8fe[_0x89be('0x39')],qs['fields'](_0x2f8c39[_0x89be('0x35')][_0x89be('0x3b')]));_0x3d3d5c[_0x89be('0x3a')]=_0x3d3d5c[_0x89be('0x3a')]['length']?_0x3d3d5c[_0x89be('0x3a')]:_0x55f8fe[_0x89be('0x39')];_0x3d3d5c[_0x89be('0x3f')]=qs[_0x89be('0x40')](_0x2f8c39[_0x89be('0x35')]['sort']);_0x3d3d5c['where']=qs[_0x89be('0x37')](_[_0x89be('0x5a')](_0x2f8c39[_0x89be('0x35')],_0x55f8fe['filters']));if(_0x2f8c39[_0x89be('0x35')][_0x89be('0x41')]){_0x3d3d5c[_0x89be('0x44')]=_[_0x89be('0x42')](_0x3d3d5c[_0x89be('0x44')],{'$or':_[_0x89be('0x30')](_0x3d3d5c['attributes'],function(_0x2b7de0){var _0x372208={};_0x372208[_0x2b7de0]={'$like':'%'+_0x2f8c39[_0x89be('0x35')]['filter']+'%'};return _0x372208;})});}_0x3d3d5c=_[_0x89be('0x42')]({},_0x3d3d5c,_0x2f8c39[_0x89be('0x4c')]);return _0x1be6f8['getTeams'](_0x3d3d5c);}})[_0x89be('0x2c')](function(_0x4af7d1){if(_0x4af7d1){_0x2024d8=_0x4af7d1['length'];if(!_0x2f8c39[_0x89be('0x35')]['hasOwnProperty'](_0x89be('0x3e'))){_0x3d3d5c[_0x89be('0x23')]=qs[_0x89be('0x23')](_0x2f8c39[_0x89be('0x35')][_0x89be('0x23')]);_0x3d3d5c[_0x89be('0x21')]=qs[_0x89be('0x21')](_0x2f8c39[_0x89be('0x35')][_0x89be('0x21')]);}return _0x1be6f8['getTeams'](_0x3d3d5c);}})[_0x89be('0x2c')](function(_0x3916f0){if(_0x3916f0){return _0x3916f0?{'count':_0x2024d8,'rows':_0x3916f0}:null;}})['then'](respondWithResult(_0x303baa,null))[_0x89be('0x48')](handleError(_0x303baa,null));};exports[_0x89be('0x64')]=function(_0x2ef74c,_0x3c8b5c,_0x5792f4){var _0x1acc3e=_0x2ef74c[_0x89be('0x4e')][_0x89be('0x65')];return db[_0x89be('0x66')]['findAll']({'where':{'id':_0x1acc3e},'attributes':['id'],'include':[{'model':db['User'],'as':_0x89be('0x67'),'attributes':['id',_0x89be('0x2e'),'online',_0x89be('0x68'),'interface'],'raw':!![]}]})[_0x89be('0x2c')](function(_0x4aa13b){if(_0x4aa13b){var _0x4c521c=_[_0x89be('0x69')](_0x4aa13b,function(_0x370779){var _0x52d884=_0x370779[_0x89be('0x2a')]({'plain':!![]});return _0x52d884['Agents'];});return db['SmsQueue'][_0x89be('0x4d')]({'where':{'id':_0x2ef74c[_0x89be('0x4a')]['id']}})[_0x89be('0x2c')](function(_0x214bf8){return db[_0x89be('0x6a')][_0x89be('0x6b')](function(_0x7e5828){return _0x214bf8['addTeams'](_0x1acc3e,{'transaction':_0x7e5828})[_0x89be('0x2c')](function(){return BPromise[_0x89be('0x6c')](_0x4c521c,function(_0x217d59){return db['UserSmsQueue'][_0x89be('0x6d')]({'where':{'UserId':_0x217d59['id'],'SmsQueueId':_0x2ef74c[_0x89be('0x4a')]['id']},'transaction':_0x7e5828});});})[_0x89be('0x2c')](function(){_0x4c521c[_0x89be('0x6e')](function(_0x4ad433){socket[_0x89be('0x6f')](_0x89be('0x70'),{'UserId':_0x4ad433['id'],'SmsQueueId':_0x214bf8['id']});});});});});}})[_0x89be('0x2c')](respondWithStatusCode(_0x3c8b5c,null))[_0x89be('0x48')](handleError(_0x3c8b5c,null));};exports[_0x89be('0x71')]=function(_0x1d9c7f,_0x34bd51,_0x4a7490){return db[_0x89be('0x66')][_0x89be('0x46')]({'where':{'id':_0x1d9c7f[_0x89be('0x35')]['ids']},'attributes':['id'],'include':[{'model':db[_0x89be('0x72')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x89be('0x2c')](handleEntityNotFound(_0x34bd51,null))[_0x89be('0x2c')](function(_0x5c6b84){var _0x2d0921=_['map'](_0x5c6b84,'id');var _0x282cea=[];var _0x4d0fe0=[];var _0x332315=squel[_0x89be('0x73')]();_0x332315['field'](_0x89be('0x74'))[_0x89be('0x75')](_0x89be('0x76'),'tq')[_0x89be('0x77')](_0x89be('0x78'),'ut',_0x89be('0x79'))['where'](_0x89be('0x7a'),_0x1d9c7f[_0x89be('0x4a')]['id']);for(var _0x51e958=0x0;_0x51e958<_0x5c6b84[_0x89be('0x3c')];_0x51e958+=0x1){let _0x663cd6=_0x5c6b84[_0x51e958];for(var _0x5215d7=0x0;_0x5215d7<_0x663cd6[_0x89be('0x67')]['length'];_0x5215d7+=0x1){let _0xf156a6=_0x663cd6[_0x89be('0x67')][_0x5215d7];var _0x50a159=_0x332315[_0x89be('0x7b')]();_0x50a159[_0x89be('0x44')](_0x89be('0x7c'),_0xf156a6['id']);_0x4d0fe0[_0x89be('0x7d')](db[_0x89be('0x6a')][_0x89be('0x35')](_0x50a159['toString'](),{'type':db[_0x89be('0x6a')][_0x89be('0x7e')][_0x89be('0x7f')]})[_0x89be('0x2c')](function(_0x329433){if(_0x329433[_0x89be('0x3c')]===0x1){return _0xf156a6['id'];}else{var _0x3a7d04=_[_0x89be('0x80')](_['map'](_0x329433,'TeamId'),function(_0x222a8b){return _[_0x89be('0x81')](_0x2d0921,_0x222a8b);});if(_0x3a7d04){return _0xf156a6['id'];}}}));}}return BPromise['all'](_0x4d0fe0)['then'](function(_0x79265e){_0x282cea=_(_0x282cea)[_0x89be('0x82')](_0x79265e)[_0x89be('0x83')]()['value']();return db[_0x89be('0x31')][_0x89be('0x4d')]({'where':{'id':_0x1d9c7f[_0x89be('0x4a')]['id']}})[_0x89be('0x2c')](function(_0x2fc088){return db['sequelize']['transaction'](function(_0x57d099){return _0x2fc088[_0x89be('0x71')](_0x1d9c7f[_0x89be('0x35')][_0x89be('0x65')],{'transaction':_0x57d099})[_0x89be('0x2c')](function(){if(!_[_0x89be('0x84')](_0x282cea)){return _0x2fc088[_0x89be('0x85')](_0x282cea,{'transaction':_0x57d099});}})['then'](function(){_0x282cea[_0x89be('0x6e')](function(_0x5e29c9){socket[_0x89be('0x6f')](_0x89be('0x86'),{'UserId':_0x5e29c9,'SmsQueueId':_0x2fc088['id']});});});});});});})[_0x89be('0x2c')](respondWithStatusCode(_0x34bd51,null))[_0x89be('0x48')](handleError(_0x34bd51,null));};exports[_0x89be('0x87')]=function(_0x458910,_0x978726,_0x402383){return db['SmsQueue'][_0x89be('0x4d')]({'where':{'id':_0x458910[_0x89be('0x4a')]['id']}})[_0x89be('0x2c')](handleEntityNotFound(_0x978726,null))[_0x89be('0x2c')](function(_0x51ab24){if(_0x51ab24){return _0x51ab24[_0x89be('0x87')](_0x458910[_0x89be('0x4e')]['ids'],_[_0x89be('0x88')](_0x458910[_0x89be('0x4e')],[_0x89be('0x65'),'id'])||{})[_0x89be('0x89')](function(_0x14ea33){for(var _0x497d65=0x0;_0x497d65<_0x458910[_0x89be('0x4e')][_0x89be('0x65')][_0x89be('0x3c')];_0x497d65+=0x1){socket['emit'](_0x89be('0x70'),{'UserId':Number(_0x458910[_0x89be('0x4e')][_0x89be('0x65')][_0x497d65]),'SmsQueueId':Number(_0x458910[_0x89be('0x4a')]['id'])});}return _0x14ea33;});}})['then'](respondWithResult(_0x978726,null))['catch'](handleError(_0x978726,null));};exports['removeAgents']=function(_0x36f31a,_0x463742,_0x27f3ba){return db[_0x89be('0x31')][_0x89be('0x4d')]({'where':{'id':_0x36f31a['params']['id']}})['then'](handleEntityNotFound(_0x463742,null))[_0x89be('0x2c')](function(_0x204ae0){if(_0x204ae0){return _0x204ae0[_0x89be('0x85')](_0x36f31a[_0x89be('0x35')]['ids'])[_0x89be('0x2c')](function(){if(_['isArray'](_0x36f31a[_0x89be('0x35')][_0x89be('0x65')])){for(var _0x3be8bd=0x0;_0x3be8bd<_0x36f31a['query'][_0x89be('0x65')][_0x89be('0x3c')];_0x3be8bd+=0x1){socket[_0x89be('0x6f')](_0x89be('0x86'),{'UserId':Number(_0x36f31a[_0x89be('0x35')][_0x89be('0x65')][_0x3be8bd]),'SmsQueueId':Number(_0x36f31a[_0x89be('0x4a')]['id'])});}}else{socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x36f31a[_0x89be('0x35')][_0x89be('0x65')]),'SmsQueueId':Number(_0x36f31a['params']['id'])});}});}})[_0x89be('0x2c')](respondWithStatusCode(_0x463742,null))[_0x89be('0x48')](handleError(_0x463742,null));};exports[_0x89be('0x8a')]=function(_0x2edbdf,_0x1f6be8,_0x200c5c){var _0x2a5bc4={};var _0x5439e2={};var _0x4f9115;var _0x4c5537;return db[_0x89be('0x31')]['findOne']({'where':{'id':_0x2edbdf[_0x89be('0x4a')]['id']}})[_0x89be('0x2c')](handleEntityNotFound(_0x1f6be8,null))[_0x89be('0x2c')](function(_0x3bf41f){if(_0x3bf41f){_0x4f9115=_0x3bf41f;_0x5439e2['model']=_[_0x89be('0x36')](db['User'][_0x89be('0x32')]);_0x5439e2[_0x89be('0x35')]=_[_0x89be('0x36')](_0x2edbdf[_0x89be('0x35')]);_0x5439e2[_0x89be('0x37')]=_[_0x89be('0x38')](_0x5439e2[_0x89be('0x39')],_0x5439e2[_0x89be('0x35')]);_0x2a5bc4['attributes']=_[_0x89be('0x38')](_0x5439e2['model'],qs[_0x89be('0x3b')](_0x2edbdf[_0x89be('0x35')]['fields']));_0x2a5bc4[_0x89be('0x3a')]=_0x2a5bc4['attributes']['length']?_0x2a5bc4[_0x89be('0x3a')]:_0x5439e2['model'];_0x2a5bc4[_0x89be('0x3f')]=qs[_0x89be('0x40')](_0x2edbdf[_0x89be('0x35')][_0x89be('0x40')]);_0x2a5bc4[_0x89be('0x44')]=qs[_0x89be('0x37')](_[_0x89be('0x5a')](_0x2edbdf['query'],_0x5439e2[_0x89be('0x37')]));if(_0x2edbdf['query'][_0x89be('0x41')]){_0x2a5bc4[_0x89be('0x44')]=_['merge'](_0x2a5bc4[_0x89be('0x44')],{'$or':_[_0x89be('0x30')](_0x2a5bc4['attributes'],function(_0x88b4d5){var _0x568d30={};_0x568d30[_0x88b4d5]={'$like':'%'+_0x2edbdf[_0x89be('0x35')][_0x89be('0x41')]+'%'};return _0x568d30;})});}_0x2a5bc4=_[_0x89be('0x42')]({},_0x2a5bc4,_0x2edbdf[_0x89be('0x4c')]);return _0x4f9115[_0x89be('0x8a')](_0x2a5bc4);}})[_0x89be('0x2c')](function(_0x6282){if(_0x6282){_0x4c5537=_0x6282[_0x89be('0x3c')];if(!_0x2edbdf[_0x89be('0x35')]['hasOwnProperty'](_0x89be('0x3e'))){_0x2a5bc4[_0x89be('0x23')]=qs['limit'](_0x2edbdf[_0x89be('0x35')][_0x89be('0x23')]);_0x2a5bc4[_0x89be('0x21')]=qs['offset'](_0x2edbdf[_0x89be('0x35')][_0x89be('0x21')]);}return _0x4f9115['getAgents'](_0x2a5bc4);}})[_0x89be('0x2c')](function(_0xf15dab){if(_0xf15dab){return _0xf15dab?{'count':_0x4c5537,'rows':_0xf15dab}:null;}})[_0x89be('0x2c')](respondWithResult(_0x1f6be8,null))[_0x89be('0x48')](handleError(_0x1f6be8,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 3870d97..d4fbed1 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 _0x23d8=['update','emit','hasOwnProperty','hook','../../mysqldb','SmsQueue','setMaxListeners','save'];(function(_0x43464b,_0x3e1c7f){var _0x26dc35=function(_0x5ab503){while(--_0x5ab503){_0x43464b['push'](_0x43464b['shift']());}};_0x26dc35(++_0x3e1c7f);}(_0x23d8,0x1b4));var _0x823d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x23d8[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x823d('0x0'))['db'][_0x823d('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x823d('0x2')](0x0);var events={'afterCreate':_0x823d('0x3'),'afterUpdate':_0x823d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x36ba62){return function(_0x44d31f,_0x1180d1,_0x3f56c1){SmsQueueEvents[_0x823d('0x5')](_0x36ba62+':'+_0x44d31f['id'],_0x44d31f);SmsQueueEvents[_0x823d('0x5')](_0x36ba62,_0x44d31f);_0x3f56c1(null);};}for(var e in events){if(events[_0x823d('0x6')](e)){var event=events[e];SmsQueue[_0x823d('0x7')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0x2ff9=['SmsQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x496df6,_0x10f7bc){var _0x3370c6=function(_0x18f197){while(--_0x18f197){_0x496df6['push'](_0x496df6['shift']());}};_0x3370c6(++_0x10f7bc);}(_0x2ff9,0x1c0));var _0x92ff=function(_0x11b008,_0x2ce50e){_0x11b008=_0x11b008-0x0;var _0x371a1a=_0x2ff9[_0x11b008];return _0x371a1a;};'use strict';var EventEmitter=require(_0x92ff('0x0'));var SmsQueue=require(_0x92ff('0x1'))['db'][_0x92ff('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x92ff('0x3')](0x0);var events={'afterCreate':_0x92ff('0x4'),'afterUpdate':_0x92ff('0x5'),'afterDestroy':_0x92ff('0x6')};function emitEvent(_0x5b989d){return function(_0x2ffb5f,_0x489141,_0x4db749){SmsQueueEvents[_0x92ff('0x7')](_0x5b989d+':'+_0x2ffb5f['id'],_0x2ffb5f);SmsQueueEvents[_0x92ff('0x7')](_0x5b989d,_0x2ffb5f);_0x4db749(null);};}for(var e in events){if(events[_0x92ff('0x8')](e)){var event=events[e];SmsQueue[_0x92ff('0x9')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 8e061c7..0f0091a 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 _0x6c99=['moment','bluebird','request-promise','path','rimraf','exports','define','SmsQueue','sms_queues','../../config/logger'];(function(_0x42d5a4,_0x2bb7b6){var _0x3a2520=function(_0xc1ffdb){while(--_0xc1ffdb){_0x42d5a4['push'](_0x42d5a4['shift']());}};_0x3a2520(++_0x2bb7b6);}(_0x6c99,0x9f));var _0x96c9=function(_0x2bc3f4,_0x470b26){_0x2bc3f4=_0x2bc3f4-0x0;var _0x14ac53=_0x6c99[_0x2bc3f4];return _0x14ac53;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x96c9('0x0'))('api');var moment=require(_0x96c9('0x1'));var BPromise=require(_0x96c9('0x2'));var rp=require(_0x96c9('0x3'));var fs=require('fs');var path=require(_0x96c9('0x4'));var rimraf=require(_0x96c9('0x5'));var config=require('../../config/environment');var attributes=require('./smsQueue.attributes');module[_0x96c9('0x6')]=function(_0x5bc3ec,_0x3a6650){return _0x5bc3ec[_0x96c9('0x7')](_0x96c9('0x8'),attributes,{'tableName':_0x96c9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x620f=['SmsQueue','sms_queues','util','../../config/logger','moment','request-promise','path','rimraf','./smsQueue.attributes','exports','define'];(function(_0x30fbfa,_0x281783){var _0x4e891=function(_0x2dd79f){while(--_0x2dd79f){_0x30fbfa['push'](_0x30fbfa['shift']());}};_0x4e891(++_0x281783);}(_0x620f,0x1e6));var _0xf620=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x620f[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require(_0xf620('0x0'));var logger=require(_0xf620('0x1'))('api');var moment=require(_0xf620('0x2'));var BPromise=require('bluebird');var rp=require(_0xf620('0x3'));var fs=require('fs');var path=require(_0xf620('0x4'));var rimraf=require(_0xf620('0x5'));var config=require('../../config/environment');var attributes=require(_0xf620('0x6'));module[_0xf620('0x7')]=function(_0x502005,_0x1f97d1){return _0x502005[_0xf620('0x8')](_0xf620('0x9'),attributes,{'tableName':_0xf620('0xa'),'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 3b569e2..896ad87 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 _0xa5c6=['then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetSmsQueue','options','raw','where','limit','include','model','map','attributes','debug','ShowSmsQueue','SmsQueue','find','stringify','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request'];(function(_0x4cbf20,_0x1bfa66){var _0x582ae4=function(_0x5eca38){while(--_0x5eca38){_0x4cbf20['push'](_0x4cbf20['shift']());}};_0x582ae4(++_0x1bfa66);}(_0xa5c6,0x90));var _0x6a5c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa5c6[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6a5c('0x0'));var util=require('util');var moment=require(_0x6a5c('0x1'));var BPromise=require(_0x6a5c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6a5c('0x3'))['db'];var utils=require(_0x6a5c('0x4'));var logger=require(_0x6a5c('0x5'))(_0x6a5c('0x6'));var config=require('../../config/environment');var jayson=require(_0x6a5c('0x7'));var client=jayson[_0x6a5c('0x8')]['http']({'port':0x232a});config[_0x6a5c('0x9')]=_[_0x6a5c('0xa')](config[_0x6a5c('0x9')],{'host':_0x6a5c('0xb'),'port':0x18eb});var socket=require(_0x6a5c('0xc'))(new Redis(config[_0x6a5c('0x9')]));require(_0x6a5c('0xd'))[_0x6a5c('0xe')](socket);function respondWithRpcPromise(_0x349a52,_0x385d18,_0x535f0d){return new BPromise(function(_0x9c5306,_0x521130){return client[_0x6a5c('0xf')](_0x349a52,_0x535f0d)[_0x6a5c('0x10')](function(_0x4864c3){logger[_0x6a5c('0x11')](_0x6a5c('0x12'),_0x385d18,_0x6a5c('0x13'));logger['debug'](_0x6a5c('0x14'),_0x385d18,_0x6a5c('0x13'),JSON['stringify'](_0x4864c3));if(_0x4864c3['error']){if(_0x4864c3[_0x6a5c('0x15')][_0x6a5c('0x16')]===0x1f4){logger[_0x6a5c('0x15')]('SmsQueue,\x20%s,\x20%s',_0x385d18,_0x4864c3[_0x6a5c('0x15')]['message']);return _0x521130(_0x4864c3[_0x6a5c('0x15')][_0x6a5c('0x17')]);}logger[_0x6a5c('0x15')]('SmsQueue,\x20%s,\x20%s',_0x385d18,_0x4864c3['error'][_0x6a5c('0x17')]);return _0x9c5306(_0x4864c3[_0x6a5c('0x15')][_0x6a5c('0x17')]);}else{logger[_0x6a5c('0x11')](_0x6a5c('0x12'),_0x385d18,'request\x20sent');_0x9c5306(_0x4864c3[_0x6a5c('0x18')][_0x6a5c('0x17')]);}})[_0x6a5c('0x19')](function(_0x599fb8){logger['error'](_0x6a5c('0x12'),_0x385d18,_0x599fb8);_0x521130(_0x599fb8);});});}exports[_0x6a5c('0x1a')]=function(_0x4aed5f){var _0xb24667=this;return new Promise(function(_0x43d7db,_0x278edd){return db['SmsQueue']['findAll']({'raw':_0x4aed5f[_0x6a5c('0x1b')]?_0x4aed5f[_0x6a5c('0x1b')][_0x6a5c('0x1c')]===undefined?!![]:![]:!![],'where':_0x4aed5f[_0x6a5c('0x1b')]?_0x4aed5f[_0x6a5c('0x1b')][_0x6a5c('0x1d')]||null:null,'attributes':_0x4aed5f[_0x6a5c('0x1b')]?_0x4aed5f['options']['attributes']||null:null,'limit':_0x4aed5f[_0x6a5c('0x1b')]?_0x4aed5f[_0x6a5c('0x1b')][_0x6a5c('0x1e')]||null:null,'include':_0x4aed5f[_0x6a5c('0x1b')]?_0x4aed5f[_0x6a5c('0x1b')]['include']?_['map'](_0x4aed5f['options'][_0x6a5c('0x1f')],function(_0x1bf968){return{'model':db[_0x1bf968[_0x6a5c('0x20')]],'as':_0x1bf968['as'],'attributes':_0x1bf968['attributes'],'include':_0x1bf968[_0x6a5c('0x1f')]?_[_0x6a5c('0x21')](_0x1bf968['include'],function(_0x51a097){return{'model':db[_0x51a097['model']],'as':_0x51a097['as'],'attributes':_0x51a097[_0x6a5c('0x22')],'include':_0x51a097[_0x6a5c('0x1f')]?_['map'](_0x51a097['include'],function(_0x36b03b){return{'model':db[_0x36b03b[_0x6a5c('0x20')]],'as':_0x36b03b['as'],'attributes':_0x36b03b[_0x6a5c('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x465ec2){logger[_0x6a5c('0x11')](_0x6a5c('0x1a'),_0x4aed5f);logger[_0x6a5c('0x23')](_0x6a5c('0x1a'),_0x4aed5f,JSON['stringify'](_0x465ec2));_0x43d7db(_0x465ec2);})['catch'](function(_0x18bf32){logger[_0x6a5c('0x15')](_0x6a5c('0x1a'),_0x18bf32[_0x6a5c('0x17')],_0x4aed5f);_0x278edd(_0xb24667['error'](0x1f4,_0x18bf32[_0x6a5c('0x17')]));});});};exports[_0x6a5c('0x24')]=function(_0x1b8cbe){var _0x3178b5=this;return new Promise(function(_0x5db773,_0x4feae3){return db[_0x6a5c('0x25')][_0x6a5c('0x26')]({'raw':_0x1b8cbe['options']?_0x1b8cbe[_0x6a5c('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1b8cbe[_0x6a5c('0x1b')]?_0x1b8cbe['options'][_0x6a5c('0x1d')]||null:null,'attributes':_0x1b8cbe[_0x6a5c('0x1b')]?_0x1b8cbe[_0x6a5c('0x1b')][_0x6a5c('0x22')]||null:null,'include':_0x1b8cbe[_0x6a5c('0x1b')]?_0x1b8cbe[_0x6a5c('0x1b')][_0x6a5c('0x1f')]?_[_0x6a5c('0x21')](_0x1b8cbe[_0x6a5c('0x1b')][_0x6a5c('0x1f')],function(_0x11783f){return{'model':db[_0x11783f[_0x6a5c('0x20')]],'as':_0x11783f['as'],'attributes':_0x11783f[_0x6a5c('0x22')],'include':_0x11783f[_0x6a5c('0x1f')]?_[_0x6a5c('0x21')](_0x11783f[_0x6a5c('0x1f')],function(_0x5be3f1){return{'model':db[_0x5be3f1['model']],'as':_0x5be3f1['as'],'attributes':_0x5be3f1[_0x6a5c('0x22')],'include':_0x5be3f1[_0x6a5c('0x1f')]?_[_0x6a5c('0x21')](_0x5be3f1['include'],function(_0x580387){return{'model':db[_0x580387['model']],'as':_0x580387['as'],'attributes':_0x580387[_0x6a5c('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x299339){logger[_0x6a5c('0x11')](_0x6a5c('0x24'),_0x1b8cbe);logger[_0x6a5c('0x23')](_0x6a5c('0x24'),_0x1b8cbe,JSON[_0x6a5c('0x27')](_0x299339));_0x5db773(_0x299339);})[_0x6a5c('0x19')](function(_0x1e776b){logger[_0x6a5c('0x15')](_0x6a5c('0x24'),_0x1e776b['message'],_0x1b8cbe);_0x4feae3(_0x3178b5[_0x6a5c('0x15')](0x1f4,_0x1e776b[_0x6a5c('0x17')]));});});}; \ No newline at end of file +var _0x5dcb=['debug','ShowSmsQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetSmsQueue','findAll','raw','options','where','attributes','limit','include','model','map'];(function(_0x471755,_0x49b2d4){var _0x577fc2=function(_0x528e78){while(--_0x528e78){_0x471755['push'](_0x471755['shift']());}};_0x577fc2(++_0x49b2d4);}(_0x5dcb,0x130));var _0xb5dc=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x5dcb[_0x565ed7];return _0x183ad7;};'use strict';var _=require(_0xb5dc('0x0'));var util=require(_0xb5dc('0x1'));var moment=require(_0xb5dc('0x2'));var BPromise=require(_0xb5dc('0x3'));var rs=require(_0xb5dc('0x4'));var fs=require('fs');var Redis=require(_0xb5dc('0x5'));var db=require(_0xb5dc('0x6'))['db'];var utils=require(_0xb5dc('0x7'));var logger=require(_0xb5dc('0x8'))(_0xb5dc('0x9'));var config=require(_0xb5dc('0xa'));var jayson=require(_0xb5dc('0xb'));var client=jayson['client'][_0xb5dc('0xc')]({'port':0x232a});config[_0xb5dc('0xd')]=_[_0xb5dc('0xe')](config['redis'],{'host':_0xb5dc('0xf'),'port':0x18eb});var socket=require(_0xb5dc('0x10'))(new Redis(config[_0xb5dc('0xd')]));require(_0xb5dc('0x11'))[_0xb5dc('0x12')](socket);function respondWithRpcPromise(_0x11947a,_0x43385f,_0x1816ff){return new BPromise(function(_0x5b20b3,_0x381353){return client[_0xb5dc('0x13')](_0x11947a,_0x1816ff)[_0xb5dc('0x14')](function(_0x337d06){logger[_0xb5dc('0x15')](_0xb5dc('0x16'),_0x43385f,_0xb5dc('0x17'));logger['debug'](_0xb5dc('0x18'),_0x43385f,'request\x20sent',JSON[_0xb5dc('0x19')](_0x337d06));if(_0x337d06[_0xb5dc('0x1a')]){if(_0x337d06[_0xb5dc('0x1a')]['code']===0x1f4){logger['error'](_0xb5dc('0x16'),_0x43385f,_0x337d06['error'][_0xb5dc('0x1b')]);return _0x381353(_0x337d06[_0xb5dc('0x1a')]['message']);}logger[_0xb5dc('0x1a')]('SmsQueue,\x20%s,\x20%s',_0x43385f,_0x337d06[_0xb5dc('0x1a')][_0xb5dc('0x1b')]);return _0x5b20b3(_0x337d06[_0xb5dc('0x1a')][_0xb5dc('0x1b')]);}else{logger[_0xb5dc('0x15')](_0xb5dc('0x16'),_0x43385f,'request\x20sent');_0x5b20b3(_0x337d06[_0xb5dc('0x1c')][_0xb5dc('0x1b')]);}})[_0xb5dc('0x1d')](function(_0x1dd43d){logger[_0xb5dc('0x1a')](_0xb5dc('0x16'),_0x43385f,_0x1dd43d);_0x381353(_0x1dd43d);});});}exports[_0xb5dc('0x1e')]=function(_0x5ae734){var _0x4ac628=this;return new Promise(function(_0x4864df,_0x5116f6){return db['SmsQueue'][_0xb5dc('0x1f')]({'raw':_0x5ae734['options']?_0x5ae734['options'][_0xb5dc('0x20')]===undefined?!![]:![]:!![],'where':_0x5ae734[_0xb5dc('0x21')]?_0x5ae734[_0xb5dc('0x21')][_0xb5dc('0x22')]||null:null,'attributes':_0x5ae734[_0xb5dc('0x21')]?_0x5ae734[_0xb5dc('0x21')][_0xb5dc('0x23')]||null:null,'limit':_0x5ae734[_0xb5dc('0x21')]?_0x5ae734[_0xb5dc('0x21')][_0xb5dc('0x24')]||null:null,'include':_0x5ae734['options']?_0x5ae734['options'][_0xb5dc('0x25')]?_['map'](_0x5ae734[_0xb5dc('0x21')][_0xb5dc('0x25')],function(_0x399f25){return{'model':db[_0x399f25[_0xb5dc('0x26')]],'as':_0x399f25['as'],'attributes':_0x399f25[_0xb5dc('0x23')],'include':_0x399f25[_0xb5dc('0x25')]?_[_0xb5dc('0x27')](_0x399f25[_0xb5dc('0x25')],function(_0x3cf2c5){return{'model':db[_0x3cf2c5[_0xb5dc('0x26')]],'as':_0x3cf2c5['as'],'attributes':_0x3cf2c5[_0xb5dc('0x23')],'include':_0x3cf2c5['include']?_[_0xb5dc('0x27')](_0x3cf2c5[_0xb5dc('0x25')],function(_0x535b10){return{'model':db[_0x535b10[_0xb5dc('0x26')]],'as':_0x535b10['as'],'attributes':_0x535b10[_0xb5dc('0x23')]};}):[]};}):[]};}):[]:[]})[_0xb5dc('0x14')](function(_0x2e24f7){logger[_0xb5dc('0x15')](_0xb5dc('0x1e'),_0x5ae734);logger[_0xb5dc('0x28')]('GetSmsQueue',_0x5ae734,JSON[_0xb5dc('0x19')](_0x2e24f7));_0x4864df(_0x2e24f7);})['catch'](function(_0x284118){logger[_0xb5dc('0x1a')]('GetSmsQueue',_0x284118[_0xb5dc('0x1b')],_0x5ae734);_0x5116f6(_0x4ac628[_0xb5dc('0x1a')](0x1f4,_0x284118[_0xb5dc('0x1b')]));});});};exports[_0xb5dc('0x29')]=function(_0x2a0d61){var _0x5c213e=this;return new Promise(function(_0x20031e,_0x46b5ce){return db['SmsQueue'][_0xb5dc('0x2a')]({'raw':_0x2a0d61[_0xb5dc('0x21')]?_0x2a0d61[_0xb5dc('0x21')][_0xb5dc('0x20')]===undefined?!![]:![]:!![],'where':_0x2a0d61[_0xb5dc('0x21')]?_0x2a0d61[_0xb5dc('0x21')][_0xb5dc('0x22')]||null:null,'attributes':_0x2a0d61[_0xb5dc('0x21')]?_0x2a0d61[_0xb5dc('0x21')][_0xb5dc('0x23')]||null:null,'include':_0x2a0d61['options']?_0x2a0d61['options'][_0xb5dc('0x25')]?_[_0xb5dc('0x27')](_0x2a0d61[_0xb5dc('0x21')]['include'],function(_0x3de775){return{'model':db[_0x3de775['model']],'as':_0x3de775['as'],'attributes':_0x3de775[_0xb5dc('0x23')],'include':_0x3de775[_0xb5dc('0x25')]?_[_0xb5dc('0x27')](_0x3de775[_0xb5dc('0x25')],function(_0x4f4294){return{'model':db[_0x4f4294[_0xb5dc('0x26')]],'as':_0x4f4294['as'],'attributes':_0x4f4294[_0xb5dc('0x23')],'include':_0x4f4294[_0xb5dc('0x25')]?_[_0xb5dc('0x27')](_0x4f4294[_0xb5dc('0x25')],function(_0x86fbe2){return{'model':db[_0x86fbe2[_0xb5dc('0x26')]],'as':_0x86fbe2['as'],'attributes':_0x86fbe2['attributes']};}):[]};}):[]};}):[]:[]})[_0xb5dc('0x14')](function(_0x1775ff){logger[_0xb5dc('0x15')](_0xb5dc('0x29'),_0x2a0d61);logger[_0xb5dc('0x28')]('ShowSmsQueue',_0x2a0d61,JSON[_0xb5dc('0x19')](_0x1775ff));_0x20031e(_0x1775ff);})['catch'](function(_0x564d92){logger[_0xb5dc('0x1a')](_0xb5dc('0x29'),_0x564d92[_0xb5dc('0x1b')],_0x2a0d61);_0x46b5ce(_0x5c213e[_0xb5dc('0x1a')](0x1f4,_0x564d92[_0xb5dc('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index b941788..ab16a9c 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 _0xfc1c=['./smsQueue.events','save','remove','update','emit','removeListener','register','length','smsQueue:'];(function(_0x4915b3,_0x253437){var _0xb41114=function(_0x3048bd){while(--_0x3048bd){_0x4915b3['push'](_0x4915b3['shift']());}};_0xb41114(++_0x253437);}(_0xfc1c,0x129));var _0xcfc1=function(_0x59ad89,_0x41cdbd){_0x59ad89=_0x59ad89-0x0;var _0x463e97=_0xfc1c[_0x59ad89];return _0x463e97;};'use strict';var SmsQueueEvents=require(_0xcfc1('0x0'));var events=[_0xcfc1('0x1'),_0xcfc1('0x2'),_0xcfc1('0x3')];function createListener(_0xcafa13,_0x4b9826){return function(_0x59b866){_0x4b9826[_0xcfc1('0x4')](_0xcafa13,_0x59b866);};}function removeListener(_0x1d0a12,_0x27308d){return function(){SmsQueueEvents[_0xcfc1('0x5')](_0x1d0a12,_0x27308d);};}exports[_0xcfc1('0x6')]=function(_0x2307bf){for(var _0x277461=0x0,_0x1d62a1=events[_0xcfc1('0x7')];_0x277461<_0x1d62a1;_0x277461++){var _0x5a2b4a=events[_0x277461];var _0x35d316=createListener(_0xcfc1('0x8')+_0x5a2b4a,_0x2307bf);SmsQueueEvents['on'](_0x5a2b4a,_0x35d316);}}; \ No newline at end of file +var _0x6234=['smsQueue:','./smsQueue.events','save','remove','update','emit','removeListener','register','length'];(function(_0x419a30,_0x49ae79){var _0x1e6978=function(_0x3340c8){while(--_0x3340c8){_0x419a30['push'](_0x419a30['shift']());}};_0x1e6978(++_0x49ae79);}(_0x6234,0x196));var _0x4623=function(_0x114d90,_0x5b2c57){_0x114d90=_0x114d90-0x0;var _0xb2a2ab=_0x6234[_0x114d90];return _0xb2a2ab;};'use strict';var SmsQueueEvents=require(_0x4623('0x0'));var events=[_0x4623('0x1'),_0x4623('0x2'),_0x4623('0x3')];function createListener(_0x2f04c9,_0x1bffaa){return function(_0x9584c7){_0x1bffaa[_0x4623('0x4')](_0x2f04c9,_0x9584c7);};}function removeListener(_0x2c4fca,_0x2cf151){return function(){SmsQueueEvents[_0x4623('0x5')](_0x2c4fca,_0x2cf151);};}exports[_0x4623('0x6')]=function(_0x242959){for(var _0xde4c7c=0x0,_0x50c280=events[_0x4623('0x7')];_0xde4c7c<_0x50c280;_0xde4c7c++){var _0x525a50=events[_0xde4c7c];var _0x3e8e1f=createListener(_0x4623('0x8')+_0x525a50,_0x242959);SmsQueueEvents['on'](_0x525a50,_0x3e8e1f);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index eb9f2db..717d4e5 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 _0x8b5b=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','show','post','create','/:id','update','delete','destroy','exports','path','connect-timeout','express','Router'];(function(_0x5ab6a6,_0x3b5b91){var _0x19c478=function(_0x146a22){while(--_0x146a22){_0x5ab6a6['push'](_0x5ab6a6['shift']());}};_0x19c478(++_0x3b5b91);}(_0x8b5b,0x137));var _0xb8b5=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x8b5b[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb8b5('0x0'));var timeout=require(_0xb8b5('0x1'));var express=require(_0xb8b5('0x2'));var router=express[_0xb8b5('0x3')]();var fs_extra=require(_0xb8b5('0x4'));var auth=require(_0xb8b5('0x5'));var interaction=require(_0xb8b5('0x6'));var config=require(_0xb8b5('0x7'));var controller=require(_0xb8b5('0x8'));router[_0xb8b5('0x9')]('/',auth[_0xb8b5('0xa')](),controller[_0xb8b5('0xb')]);router['get'](_0xb8b5('0xc'),auth[_0xb8b5('0xa')](),controller['describe']);router[_0xb8b5('0x9')]('/:id',auth[_0xb8b5('0xa')](),controller[_0xb8b5('0xd')]);router[_0xb8b5('0xe')]('/',auth[_0xb8b5('0xa')](),controller[_0xb8b5('0xf')]);router['put'](_0xb8b5('0x10'),auth['isAuthenticated'](),controller[_0xb8b5('0x11')]);router[_0xb8b5('0x12')](_0xb8b5('0x10'),auth[_0xb8b5('0xa')](),controller[_0xb8b5('0x13')]);module[_0xb8b5('0x14')]=router; \ No newline at end of file +var _0x3d3d=['create','put','update','/:id','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','show'];(function(_0x192de1,_0x3819c8){var _0x1aa624=function(_0x4c3f73){while(--_0x4c3f73){_0x192de1['push'](_0x192de1['shift']());}};_0x1aa624(++_0x3819c8);}(_0x3d3d,0x12c));var _0xd3d3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d3d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xd3d3('0x0'));var path=require(_0xd3d3('0x1'));var timeout=require(_0xd3d3('0x2'));var express=require(_0xd3d3('0x3'));var router=express[_0xd3d3('0x4')]();var fs_extra=require(_0xd3d3('0x5'));var auth=require(_0xd3d3('0x6'));var interaction=require(_0xd3d3('0x7'));var config=require(_0xd3d3('0x8'));var controller=require(_0xd3d3('0x9'));router[_0xd3d3('0xa')]('/',auth[_0xd3d3('0xb')](),controller[_0xd3d3('0xc')]);router['get'](_0xd3d3('0xd'),auth[_0xd3d3('0xb')](),controller['describe']);router[_0xd3d3('0xa')]('/:id',auth[_0xd3d3('0xb')](),controller[_0xd3d3('0xe')]);router['post']('/',auth[_0xd3d3('0xb')](),controller[_0xd3d3('0xf')]);router[_0xd3d3('0x10')]('/:id',auth[_0xd3d3('0xb')](),controller[_0xd3d3('0x11')]);router['delete'](_0xd3d3('0x12'),auth['isAuthenticated'](),controller[_0xd3d3('0x13')]);module[_0xd3d3('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index b6f5305..dcf801b 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 _0x2737=['DATE','sequelize','exports','STRING'];(function(_0x15cd7d,_0x121d3b){var _0x56a058=function(_0x20547a){while(--_0x20547a){_0x15cd7d['push'](_0x15cd7d['shift']());}};_0x56a058(++_0x121d3b);}(_0x2737,0x11d));var _0x7273=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x2737[_0x3947c9];return _0x2e7871;};'use strict';var moment=require('moment');var Sequelize=require(_0x7273('0x0'));module[_0x7273('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x7273('0x2')]},'joinAt':{'type':Sequelize[_0x7273('0x3')]},'leaveAt':{'type':Sequelize[_0x7273('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x7273('0x2')]}}; \ No newline at end of file +var _0xaf41=['STRING','DATE','moment','sequelize','exports'];(function(_0x2e41f4,_0x218364){var _0x4566a4=function(_0x4fd3a5){while(--_0x4fd3a5){_0x2e41f4['push'](_0x2e41f4['shift']());}};_0x4566a4(++_0x218364);}(_0xaf41,0x13d));var _0x1af4=function(_0x52a5e0,_0x4e05c4){_0x52a5e0=_0x52a5e0-0x0;var _0x5b94ca=_0xaf41[_0x52a5e0];return _0x5b94ca;};'use strict';var moment=require(_0x1af4('0x0'));var Sequelize=require(_0x1af4('0x1'));module[_0x1af4('0x2')]={'uniqueid':{'type':Sequelize[_0x1af4('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x1af4('0x3')]},'joinAt':{'type':Sequelize[_0x1af4('0x4')]},'leaveAt':{'type':Sequelize[_0x1af4('0x4')]},'acceptAt':{'type':Sequelize[_0x1af4('0x4')]},'exitAt':{'type':Sequelize[_0x1af4('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index b6b6e9c..7d8df19 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 _0xd23c=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','SmsQueueReport','count','findAll','rows','show','params','includeAll','options','find','create','body','catch','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x2ed0c8,_0x5c909f){var _0x792203=function(_0x1e776e){while(--_0x1e776e){_0x2ed0c8['push'](_0x2ed0c8['shift']());}};_0x792203(++_0x5c909f);}(_0xd23c,0x1a4));var _0xcd23=function(_0x28496f,_0x5497ee){_0x28496f=_0x28496f-0x0;var _0x30a9d8=_0xd23c[_0x28496f];return _0x30a9d8;};'use strict';var emlformat=require(_0xcd23('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcd23('0x1'));var jsonpatch=require(_0xcd23('0x2'));var rp=require(_0xcd23('0x3'));var moment=require(_0xcd23('0x4'));var BPromise=require(_0xcd23('0x5'));var Mustache=require('mustache');var util=require(_0xcd23('0x6'));var path=require(_0xcd23('0x7'));var sox=require(_0xcd23('0x8'));var csv=require('to-csv');var ejs=require(_0xcd23('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcd23('0xa'));var squel=require(_0xcd23('0xb'));var crypto=require(_0xcd23('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xcd23('0xd'));var toCsv=require(_0xcd23('0xe'));var querystring=require('querystring');var Papa=require(_0xcd23('0xf'));var Redis=require(_0xcd23('0x10'));var authService=require(_0xcd23('0x11'));var qs=require(_0xcd23('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcd23('0x13'))(_0xcd23('0x14'));var utils=require(_0xcd23('0x15'));var config=require(_0xcd23('0x16'));var licenseUtil=require(_0xcd23('0x17'));var db=require(_0xcd23('0x18'))['db'];function respondWithStatusCode(_0x387b3b,_0x33bcf4){_0x33bcf4=_0x33bcf4||0xcc;return function(_0x199cb7){if(_0x199cb7){return _0x387b3b[_0xcd23('0x19')](_0x33bcf4);}return _0x387b3b[_0xcd23('0x1a')](_0x33bcf4)[_0xcd23('0x1b')]();};}function respondWithResult(_0x23096c,_0x20487d){_0x20487d=_0x20487d||0xc8;return function(_0x302633){if(_0x302633){return _0x23096c[_0xcd23('0x1a')](_0x20487d)[_0xcd23('0x1c')](_0x302633);}};}function respondWithFilteredResult(_0x27a4d8,_0x1b6212){return function(_0x57e4c9){if(_0x57e4c9){var _0x48b3c5=typeof _0x1b6212[_0xcd23('0x1d')]===_0xcd23('0x1e')&&typeof _0x1b6212[_0xcd23('0x1f')]===_0xcd23('0x1e');var _0x286bba=_0x57e4c9['count'];var _0x21d788=_0x48b3c5?0x0:_0x1b6212[_0xcd23('0x1d')];var _0x1f7b02=_0x48b3c5?_0x57e4c9['count']:_0x1b6212[_0xcd23('0x1d')]+_0x1b6212[_0xcd23('0x1f')];var _0xdeef5d;if(_0x1f7b02>=_0x286bba){_0x1f7b02=_0x286bba;_0xdeef5d=0xc8;}else{_0xdeef5d=0xce;}_0x27a4d8[_0xcd23('0x1a')](_0xdeef5d);return _0x27a4d8[_0xcd23('0x20')](_0xcd23('0x21'),_0x21d788+'-'+_0x1f7b02+'/'+_0x286bba)['json'](_0x57e4c9);}return null;};}function patchUpdates(_0x5c05af){return function(_0x31a16e){try{jsonpatch[_0xcd23('0x22')](_0x31a16e,_0x5c05af,!![]);}catch(_0x414f0b){return BPromise[_0xcd23('0x23')](_0x414f0b);}return _0x31a16e[_0xcd23('0x24')]();};}function saveUpdates(_0x337aca,_0x163d6b){return function(_0x1f3e61){if(_0x1f3e61){return _0x1f3e61[_0xcd23('0x25')](_0x337aca)[_0xcd23('0x26')](function(_0x1e9b7b){return _0x1e9b7b;});}return null;};}function removeEntity(_0x28e844,_0x2a3537){return function(_0x82281a){if(_0x82281a){return _0x82281a[_0xcd23('0x27')]()[_0xcd23('0x26')](function(){_0x28e844['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fcb7c,_0x4abab3){return function(_0x1c1b70){if(!_0x1c1b70){_0x4fcb7c[_0xcd23('0x19')](0x194);}return _0x1c1b70;};}function handleError(_0xad118a,_0x50cae5){_0x50cae5=_0x50cae5||0x1f4;return function(_0x505a74){logger[_0xcd23('0x28')](_0x505a74['stack']);if(_0x505a74[_0xcd23('0x29')]){delete _0x505a74[_0xcd23('0x29')];}_0xad118a[_0xcd23('0x1a')](_0x50cae5)[_0xcd23('0x2a')](_0x505a74);};}exports[_0xcd23('0x2b')]=function(_0x496acc,_0x539325){var _0x15cb30={},_0x38884e={},_0x456a63={'count':0x0,'rows':[]};var _0x134b0c=_[_0xcd23('0x2c')](db['SmsQueueReport'][_0xcd23('0x2d')],function(_0x20f913){return{'name':_0x20f913[_0xcd23('0x2e')],'type':_0x20f913[_0xcd23('0x2f')][_0xcd23('0x30')]};});_0x38884e[_0xcd23('0x31')]=_[_0xcd23('0x2c')](_0x134b0c,'name');_0x38884e[_0xcd23('0x32')]=_[_0xcd23('0x33')](_0x496acc[_0xcd23('0x32')]);_0x38884e[_0xcd23('0x34')]=_[_0xcd23('0x35')](_0x38884e[_0xcd23('0x31')],_0x38884e[_0xcd23('0x32')]);_0x15cb30[_0xcd23('0x36')]=_[_0xcd23('0x35')](_0x38884e[_0xcd23('0x31')],qs[_0xcd23('0x37')](_0x496acc[_0xcd23('0x32')]['fields']));_0x15cb30['attributes']=_0x15cb30['attributes'][_0xcd23('0x38')]?_0x15cb30[_0xcd23('0x36')]:_0x38884e[_0xcd23('0x31')];if(!_0x496acc[_0xcd23('0x32')][_0xcd23('0x39')](_0xcd23('0x3a'))){_0x15cb30[_0xcd23('0x1f')]=qs['limit'](_0x496acc[_0xcd23('0x32')][_0xcd23('0x1f')]);_0x15cb30['offset']=qs[_0xcd23('0x1d')](_0x496acc[_0xcd23('0x32')][_0xcd23('0x1d')]);}_0x15cb30[_0xcd23('0x3b')]=qs[_0xcd23('0x3c')](_0x496acc[_0xcd23('0x32')][_0xcd23('0x3c')]);_0x15cb30[_0xcd23('0x3d')]=qs['filters'](_[_0xcd23('0x3e')](_0x496acc[_0xcd23('0x32')],_0x38884e['filters']),_0x134b0c);if(_0x496acc['query']['filter']){_0x15cb30[_0xcd23('0x3d')]=_[_0xcd23('0x3f')](_0x15cb30['where'],{'$or':_[_0xcd23('0x2c')](_0x134b0c,function(_0x49458f){if(_0x49458f['type']!==_0xcd23('0x40')){var _0x52c033={};_0x52c033[_0x49458f[_0xcd23('0x29')]]={'$like':'%'+_0x496acc[_0xcd23('0x32')][_0xcd23('0x41')]+'%'};return _0x52c033;}})});}_0x15cb30=_[_0xcd23('0x3f')]({},_0x15cb30,_0x496acc['options']);var _0x1933fb={'where':_0x15cb30[_0xcd23('0x3d')]};return db[_0xcd23('0x42')]['count'](_0x1933fb)[_0xcd23('0x26')](function(_0x25506b){_0x456a63[_0xcd23('0x43')]=_0x25506b;if(_0x496acc[_0xcd23('0x32')]['includeAll']){_0x15cb30['include']=[{'all':!![]}];}return db[_0xcd23('0x42')][_0xcd23('0x44')](_0x15cb30);})[_0xcd23('0x26')](function(_0x874b76){_0x456a63[_0xcd23('0x45')]=_0x874b76;return _0x456a63;})['then'](respondWithFilteredResult(_0x539325,_0x15cb30))['catch'](handleError(_0x539325,null));};exports[_0xcd23('0x46')]=function(_0x4f16c6,_0x576337){var _0x327325={'raw':!![],'where':{'id':_0x4f16c6[_0xcd23('0x47')]['id']}},_0x206f9e={};_0x206f9e[_0xcd23('0x31')]=_['keys'](db[_0xcd23('0x42')][_0xcd23('0x2d')]);_0x206f9e[_0xcd23('0x32')]=_[_0xcd23('0x33')](_0x4f16c6['query']);_0x206f9e[_0xcd23('0x34')]=_[_0xcd23('0x35')](_0x206f9e['model'],_0x206f9e[_0xcd23('0x32')]);_0x327325[_0xcd23('0x36')]=_[_0xcd23('0x35')](_0x206f9e['model'],qs[_0xcd23('0x37')](_0x4f16c6[_0xcd23('0x32')][_0xcd23('0x37')]));_0x327325[_0xcd23('0x36')]=_0x327325[_0xcd23('0x36')][_0xcd23('0x38')]?_0x327325[_0xcd23('0x36')]:_0x206f9e['model'];if(_0x4f16c6['query'][_0xcd23('0x48')]){_0x327325['include']=[{'all':!![]}];}_0x327325=_[_0xcd23('0x3f')]({},_0x327325,_0x4f16c6[_0xcd23('0x49')]);return db[_0xcd23('0x42')][_0xcd23('0x4a')](_0x327325)[_0xcd23('0x26')](handleEntityNotFound(_0x576337,null))[_0xcd23('0x26')](respondWithResult(_0x576337,null))['catch'](handleError(_0x576337,null));};exports[_0xcd23('0x4b')]=function(_0x29d0f4,_0x34b03d){return db[_0xcd23('0x42')][_0xcd23('0x4b')](_0x29d0f4[_0xcd23('0x4c')],{})[_0xcd23('0x26')](respondWithResult(_0x34b03d,0xc9))[_0xcd23('0x4d')](handleError(_0x34b03d,null));};exports[_0xcd23('0x25')]=function(_0x77b1af,_0x264350){if(_0x77b1af[_0xcd23('0x4c')]['id']){delete _0x77b1af['body']['id'];}return db[_0xcd23('0x42')][_0xcd23('0x4a')]({'where':{'id':_0x77b1af[_0xcd23('0x47')]['id']}})['then'](handleEntityNotFound(_0x264350,null))['then'](saveUpdates(_0x77b1af[_0xcd23('0x4c')],null))[_0xcd23('0x26')](respondWithResult(_0x264350,null))['catch'](handleError(_0x264350,null));};exports['destroy']=function(_0x17da10,_0xe7b575){return db[_0xcd23('0x42')]['find']({'where':{'id':_0x17da10['params']['id']}})[_0xcd23('0x26')](handleEntityNotFound(_0xe7b575,null))[_0xcd23('0x26')](removeEntity(_0xe7b575,null))[_0xcd23('0x4d')](handleError(_0xe7b575,null));};exports[_0xcd23('0x4e')]=function(_0x560e6f,_0x331b26){return db[_0xcd23('0x42')][_0xcd23('0x4e')]()['then'](respondWithResult(_0x331b26,null))[_0xcd23('0x4d')](handleError(_0x331b26,null));}; \ No newline at end of file +var _0x596a=['destroy','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','limit','set','apply','reject','save','update','then'];(function(_0xdfe827,_0x134436){var _0xa174b=function(_0x4cd985){while(--_0x4cd985){_0xdfe827['push'](_0xdfe827['shift']());}};_0xa174b(++_0x134436);}(_0x596a,0x1b1));var _0xa596=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x596a[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require(_0xa596('0x0'));var rimraf=require(_0xa596('0x1'));var zipdir=require(_0xa596('0x2'));var jsonpatch=require(_0xa596('0x3'));var rp=require(_0xa596('0x4'));var moment=require(_0xa596('0x5'));var BPromise=require(_0xa596('0x6'));var Mustache=require('mustache');var util=require(_0xa596('0x7'));var path=require(_0xa596('0x8'));var sox=require(_0xa596('0x9'));var csv=require(_0xa596('0xa'));var ejs=require(_0xa596('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa596('0xc'));var squel=require(_0xa596('0xd'));var crypto=require(_0xa596('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa596('0xf'));var Papa=require(_0xa596('0x10'));var Redis=require(_0xa596('0x11'));var authService=require(_0xa596('0x12'));var qs=require(_0xa596('0x13'));var as=require(_0xa596('0x14'));var hardwareService=require(_0xa596('0x15'));var logger=require(_0xa596('0x16'))(_0xa596('0x17'));var utils=require('../../config/utils');var config=require(_0xa596('0x18'));var licenseUtil=require(_0xa596('0x19'));var db=require(_0xa596('0x1a'))['db'];function respondWithStatusCode(_0x3304cd,_0x25ee6f){_0x25ee6f=_0x25ee6f||0xcc;return function(_0x41734f){if(_0x41734f){return _0x3304cd[_0xa596('0x1b')](_0x25ee6f);}return _0x3304cd['status'](_0x25ee6f)[_0xa596('0x1c')]();};}function respondWithResult(_0x25858d,_0x3d4c95){_0x3d4c95=_0x3d4c95||0xc8;return function(_0x4baf4b){if(_0x4baf4b){return _0x25858d[_0xa596('0x1d')](_0x3d4c95)[_0xa596('0x1e')](_0x4baf4b);}};}function respondWithFilteredResult(_0x224b99,_0x3436c1){return function(_0x2ce12e){if(_0x2ce12e){var _0x280778=typeof _0x3436c1['offset']==='undefined'&&typeof _0x3436c1['limit']===_0xa596('0x1f');var _0x5deece=_0x2ce12e[_0xa596('0x20')];var _0x16b9f3=_0x280778?0x0:_0x3436c1[_0xa596('0x21')];var _0x2d3969=_0x280778?_0x2ce12e[_0xa596('0x20')]:_0x3436c1[_0xa596('0x21')]+_0x3436c1[_0xa596('0x22')];var _0x5461d1;if(_0x2d3969>=_0x5deece){_0x2d3969=_0x5deece;_0x5461d1=0xc8;}else{_0x5461d1=0xce;}_0x224b99[_0xa596('0x1d')](_0x5461d1);return _0x224b99[_0xa596('0x23')]('Content-Range',_0x16b9f3+'-'+_0x2d3969+'/'+_0x5deece)[_0xa596('0x1e')](_0x2ce12e);}return null;};}function patchUpdates(_0x4ca081){return function(_0x50cacf){try{jsonpatch[_0xa596('0x24')](_0x50cacf,_0x4ca081,!![]);}catch(_0x346970){return BPromise[_0xa596('0x25')](_0x346970);}return _0x50cacf[_0xa596('0x26')]();};}function saveUpdates(_0x27fcf6,_0x4b02a1){return function(_0x500db9){if(_0x500db9){return _0x500db9[_0xa596('0x27')](_0x27fcf6)[_0xa596('0x28')](function(_0x569cde){return _0x569cde;});}return null;};}function removeEntity(_0x20b09a,_0x4e7331){return function(_0xd7e184){if(_0xd7e184){return _0xd7e184[_0xa596('0x29')]()[_0xa596('0x28')](function(){_0x20b09a[_0xa596('0x1d')](0xcc)[_0xa596('0x1c')]();});}};}function handleEntityNotFound(_0x2677ab,_0x4af32f){return function(_0x3d98bf){if(!_0x3d98bf){_0x2677ab['sendStatus'](0x194);}return _0x3d98bf;};}function handleError(_0x275758,_0x7212e0){_0x7212e0=_0x7212e0||0x1f4;return function(_0x5ed726){logger[_0xa596('0x2a')](_0x5ed726[_0xa596('0x2b')]);if(_0x5ed726['name']){delete _0x5ed726[_0xa596('0x2c')];}_0x275758['status'](_0x7212e0)[_0xa596('0x2d')](_0x5ed726);};}exports[_0xa596('0x2e')]=function(_0xbebca,_0x4c7dfe){var _0x3cdec8={},_0x3ca0e3={},_0x105367={'count':0x0,'rows':[]};var _0x299f42=_[_0xa596('0x2f')](db[_0xa596('0x30')][_0xa596('0x31')],function(_0x243823){return{'name':_0x243823[_0xa596('0x32')],'type':_0x243823['type'][_0xa596('0x33')]};});_0x3ca0e3[_0xa596('0x34')]=_[_0xa596('0x2f')](_0x299f42,'name');_0x3ca0e3[_0xa596('0x35')]=_[_0xa596('0x36')](_0xbebca[_0xa596('0x35')]);_0x3ca0e3[_0xa596('0x37')]=_[_0xa596('0x38')](_0x3ca0e3[_0xa596('0x34')],_0x3ca0e3[_0xa596('0x35')]);_0x3cdec8['attributes']=_[_0xa596('0x38')](_0x3ca0e3['model'],qs[_0xa596('0x39')](_0xbebca['query']['fields']));_0x3cdec8['attributes']=_0x3cdec8[_0xa596('0x3a')][_0xa596('0x3b')]?_0x3cdec8[_0xa596('0x3a')]:_0x3ca0e3[_0xa596('0x34')];if(!_0xbebca[_0xa596('0x35')]['hasOwnProperty']('nolimit')){_0x3cdec8[_0xa596('0x22')]=qs[_0xa596('0x22')](_0xbebca[_0xa596('0x35')]['limit']);_0x3cdec8[_0xa596('0x21')]=qs['offset'](_0xbebca['query'][_0xa596('0x21')]);}_0x3cdec8[_0xa596('0x3c')]=qs[_0xa596('0x3d')](_0xbebca['query'][_0xa596('0x3d')]);_0x3cdec8['where']=qs[_0xa596('0x37')](_['pick'](_0xbebca[_0xa596('0x35')],_0x3ca0e3[_0xa596('0x37')]),_0x299f42);if(_0xbebca[_0xa596('0x35')][_0xa596('0x3e')]){_0x3cdec8[_0xa596('0x3f')]=_[_0xa596('0x40')](_0x3cdec8['where'],{'$or':_[_0xa596('0x2f')](_0x299f42,function(_0x1f4178){if(_0x1f4178[_0xa596('0x41')]!==_0xa596('0x42')){var _0x37177e={};_0x37177e[_0x1f4178[_0xa596('0x2c')]]={'$like':'%'+_0xbebca[_0xa596('0x35')][_0xa596('0x3e')]+'%'};return _0x37177e;}})});}_0x3cdec8=_[_0xa596('0x40')]({},_0x3cdec8,_0xbebca[_0xa596('0x43')]);var _0x388a0c={'where':_0x3cdec8['where']};return db[_0xa596('0x30')][_0xa596('0x20')](_0x388a0c)['then'](function(_0x51c74f){_0x105367[_0xa596('0x20')]=_0x51c74f;if(_0xbebca[_0xa596('0x35')][_0xa596('0x44')]){_0x3cdec8[_0xa596('0x45')]=[{'all':!![]}];}return db['SmsQueueReport'][_0xa596('0x46')](_0x3cdec8);})[_0xa596('0x28')](function(_0x43ba3c){_0x105367[_0xa596('0x47')]=_0x43ba3c;return _0x105367;})[_0xa596('0x28')](respondWithFilteredResult(_0x4c7dfe,_0x3cdec8))[_0xa596('0x48')](handleError(_0x4c7dfe,null));};exports[_0xa596('0x49')]=function(_0x47590f,_0x23de86){var _0xf8b055={'raw':!![],'where':{'id':_0x47590f['params']['id']}},_0x49f278={};_0x49f278[_0xa596('0x34')]=_[_0xa596('0x36')](db['SmsQueueReport']['rawAttributes']);_0x49f278[_0xa596('0x35')]=_['keys'](_0x47590f[_0xa596('0x35')]);_0x49f278[_0xa596('0x37')]=_[_0xa596('0x38')](_0x49f278[_0xa596('0x34')],_0x49f278[_0xa596('0x35')]);_0xf8b055['attributes']=_[_0xa596('0x38')](_0x49f278[_0xa596('0x34')],qs[_0xa596('0x39')](_0x47590f[_0xa596('0x35')][_0xa596('0x39')]));_0xf8b055[_0xa596('0x3a')]=_0xf8b055[_0xa596('0x3a')]['length']?_0xf8b055['attributes']:_0x49f278[_0xa596('0x34')];if(_0x47590f[_0xa596('0x35')][_0xa596('0x44')]){_0xf8b055['include']=[{'all':!![]}];}_0xf8b055=_['merge']({},_0xf8b055,_0x47590f[_0xa596('0x43')]);return db[_0xa596('0x30')][_0xa596('0x4a')](_0xf8b055)[_0xa596('0x28')](handleEntityNotFound(_0x23de86,null))[_0xa596('0x28')](respondWithResult(_0x23de86,null))[_0xa596('0x48')](handleError(_0x23de86,null));};exports[_0xa596('0x4b')]=function(_0x4fe131,_0x1117ee){return db[_0xa596('0x30')][_0xa596('0x4b')](_0x4fe131[_0xa596('0x4c')],{})[_0xa596('0x28')](respondWithResult(_0x1117ee,0xc9))['catch'](handleError(_0x1117ee,null));};exports[_0xa596('0x27')]=function(_0xf6234b,_0x53b2b7){if(_0xf6234b[_0xa596('0x4c')]['id']){delete _0xf6234b[_0xa596('0x4c')]['id'];}return db[_0xa596('0x30')][_0xa596('0x4a')]({'where':{'id':_0xf6234b[_0xa596('0x4d')]['id']}})['then'](handleEntityNotFound(_0x53b2b7,null))[_0xa596('0x28')](saveUpdates(_0xf6234b[_0xa596('0x4c')],null))[_0xa596('0x28')](respondWithResult(_0x53b2b7,null))[_0xa596('0x48')](handleError(_0x53b2b7,null));};exports[_0xa596('0x29')]=function(_0xa42068,_0x4e0ae4){return db[_0xa596('0x30')][_0xa596('0x4a')]({'where':{'id':_0xa42068[_0xa596('0x4d')]['id']}})[_0xa596('0x28')](handleEntityNotFound(_0x4e0ae4,null))[_0xa596('0x28')](removeEntity(_0x4e0ae4,null))[_0xa596('0x48')](handleError(_0x4e0ae4,null));};exports[_0xa596('0x4e')]=function(_0x3f34bc,_0x29dc29){return db[_0xa596('0x30')]['describe']()[_0xa596('0x28')](respondWithResult(_0x29dc29,null))['catch'](handleError(_0x29dc29,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index cb5f14f..dbfe067 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 _0xcb91=['path','rimraf','./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x4c03fc,_0x518830){var _0x1e148d=function(_0x17b53e){while(--_0x17b53e){_0x4c03fc['push'](_0x4c03fc['shift']());}};_0x1e148d(++_0x518830);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4429e0,_0xee6f1f){_0x4429e0=_0x4429e0-0x0;var _0x51a5b3=_0xcb91[_0x4429e0];return _0x51a5b3;};'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 +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x1b515f,_0x52aa6b){var _0x66ff73=function(_0x2cc081){while(--_0x2cc081){_0x1b515f['push'](_0x1b515f['shift']());}};_0x66ff73(++_0x52aa6b);}(_0xe706,0xa3));var _0x6e70=function(_0x47b03c,_0x2b8a51){_0x47b03c=_0x47b03c-0x0;var _0x2a3db5=_0xe706[_0x47b03c];return _0x2a3db5;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index e7c0da4..fb5fe12 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 _0xaeec=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','options','raw','UpdateSmsQueueReport','body','where','limit','stringify'];(function(_0x4ed37d,_0x1a84c9){var _0x4fb2c5=function(_0x5c9013){while(--_0x5c9013){_0x4ed37d['push'](_0x4ed37d['shift']());}};_0x4fb2c5(++_0x1a84c9);}(_0xaeec,0xe0));var _0xcaee=function(_0x3aa930,_0x377828){_0x3aa930=_0x3aa930-0x0;var _0x2f15b4=_0xaeec[_0x3aa930];return _0x2f15b4;};'use strict';var _=require(_0xcaee('0x0'));var util=require(_0xcaee('0x1'));var moment=require(_0xcaee('0x2'));var BPromise=require(_0xcaee('0x3'));var rs=require(_0xcaee('0x4'));var fs=require('fs');var Redis=require(_0xcaee('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xcaee('0x6'));var logger=require(_0xcaee('0x7'))(_0xcaee('0x8'));var config=require(_0xcaee('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4b2435,_0xb1359b,_0x2c5d6a){return new BPromise(function(_0x1f35d6,_0x8da65d){return client[_0xcaee('0xa')](_0x4b2435,_0x2c5d6a)[_0xcaee('0xb')](function(_0x40fbf6){logger[_0xcaee('0xc')](_0xcaee('0xd'),_0xb1359b,'request\x20sent');logger[_0xcaee('0xe')](_0xcaee('0xf'),_0xb1359b,_0xcaee('0x10'),JSON['stringify'](_0x40fbf6));if(_0x40fbf6[_0xcaee('0x11')]){if(_0x40fbf6[_0xcaee('0x11')][_0xcaee('0x12')]===0x1f4){logger[_0xcaee('0x11')](_0xcaee('0xd'),_0xb1359b,_0x40fbf6[_0xcaee('0x11')][_0xcaee('0x13')]);return _0x8da65d(_0x40fbf6[_0xcaee('0x11')][_0xcaee('0x13')]);}logger[_0xcaee('0x11')](_0xcaee('0xd'),_0xb1359b,_0x40fbf6[_0xcaee('0x11')][_0xcaee('0x13')]);return _0x1f35d6(_0x40fbf6[_0xcaee('0x11')][_0xcaee('0x13')]);}else{logger[_0xcaee('0xc')](_0xcaee('0xd'),_0xb1359b,'request\x20sent');_0x1f35d6(_0x40fbf6[_0xcaee('0x14')]['message']);}})[_0xcaee('0x15')](function(_0x1500ed){logger['error'](_0xcaee('0xd'),_0xb1359b,_0x1500ed);_0x8da65d(_0x1500ed);});});}exports[_0xcaee('0x16')]=function(_0x3310fa){var _0x3f95b1=this;return new Promise(function(_0x245734,_0x193342){return db[_0xcaee('0x17')][_0xcaee('0x18')](_0x3310fa['body'],{'raw':_0x3310fa[_0xcaee('0x19')]?_0x3310fa[_0xcaee('0x19')][_0xcaee('0x1a')]===undefined?!![]:![]:!![]})[_0xcaee('0xb')](function(_0x47dbed){logger[_0xcaee('0xc')](_0xcaee('0x16'),_0x3310fa);logger[_0xcaee('0xe')](_0xcaee('0x16'),_0x3310fa,JSON['stringify'](_0x47dbed));_0x245734(_0x47dbed);})[_0xcaee('0x15')](function(_0x24e16f){logger[_0xcaee('0x11')](_0xcaee('0x16'),_0x24e16f['message'],_0x3310fa);_0x193342(_0x3f95b1[_0xcaee('0x11')](0x1f4,_0x24e16f[_0xcaee('0x13')]));});});};exports[_0xcaee('0x1b')]=function(_0x4b2e0e){var _0x1de40a=this;return new Promise(function(_0x44aee5,_0x3432e0){return db[_0xcaee('0x17')]['update'](_0x4b2e0e[_0xcaee('0x1c')],{'raw':_0x4b2e0e[_0xcaee('0x19')]?_0x4b2e0e['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b2e0e[_0xcaee('0x19')]?_0x4b2e0e['options'][_0xcaee('0x1d')]||null:null,'attributes':_0x4b2e0e['options']?_0x4b2e0e['options']['attributes']||null:null,'limit':_0x4b2e0e[_0xcaee('0x19')]?_0x4b2e0e['options'][_0xcaee('0x1e')]||null:null})['then'](function(_0xe36ab7){logger[_0xcaee('0xc')]('UpdateSmsQueueReport',_0x4b2e0e);logger[_0xcaee('0xe')](_0xcaee('0x1b'),_0x4b2e0e,JSON[_0xcaee('0x1f')](_0xe36ab7));_0x44aee5(_0xe36ab7);})['catch'](function(_0x44a27b){logger[_0xcaee('0x11')](_0xcaee('0x1b'),_0x44a27b[_0xcaee('0x13')],_0x4b2e0e);_0x3432e0(_0x1de40a[_0xcaee('0x11')](0x1f4,_0x44a27b['message']));});});}; \ No newline at end of file +var _0x6c1b=['result','SmsQueueReport','options','raw','CreateSmsQueueReport','stringify','catch','UpdateSmsQueueReport','update','body','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x6c1b,0x1e1));var _0xb6c1=function(_0x1eaeef,_0x4682d2){_0x1eaeef=_0x1eaeef-0x0;var _0x4e4165=_0x6c1b[_0x1eaeef];return _0x4e4165;};'use strict';var _=require(_0xb6c1('0x0'));var util=require(_0xb6c1('0x1'));var moment=require(_0xb6c1('0x2'));var BPromise=require(_0xb6c1('0x3'));var rs=require(_0xb6c1('0x4'));var fs=require('fs');var Redis=require(_0xb6c1('0x5'));var db=require(_0xb6c1('0x6'))['db'];var utils=require(_0xb6c1('0x7'));var logger=require(_0xb6c1('0x8'))(_0xb6c1('0x9'));var config=require(_0xb6c1('0xa'));var jayson=require(_0xb6c1('0xb'));var client=jayson[_0xb6c1('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d1afe,_0xa3d074,_0x3fc705){return new BPromise(function(_0x5bee6c,_0x102416){return client[_0xb6c1('0xd')](_0x4d1afe,_0x3fc705)[_0xb6c1('0xe')](function(_0x4c773a){logger[_0xb6c1('0xf')](_0xb6c1('0x10'),_0xa3d074,_0xb6c1('0x11'));logger[_0xb6c1('0x12')](_0xb6c1('0x13'),_0xa3d074,'request\x20sent',JSON['stringify'](_0x4c773a));if(_0x4c773a[_0xb6c1('0x14')]){if(_0x4c773a[_0xb6c1('0x14')][_0xb6c1('0x15')]===0x1f4){logger[_0xb6c1('0x14')](_0xb6c1('0x10'),_0xa3d074,_0x4c773a[_0xb6c1('0x14')][_0xb6c1('0x16')]);return _0x102416(_0x4c773a['error'][_0xb6c1('0x16')]);}logger[_0xb6c1('0x14')]('SmsQueueReport,\x20%s,\x20%s',_0xa3d074,_0x4c773a[_0xb6c1('0x14')][_0xb6c1('0x16')]);return _0x5bee6c(_0x4c773a[_0xb6c1('0x14')][_0xb6c1('0x16')]);}else{logger[_0xb6c1('0xf')](_0xb6c1('0x10'),_0xa3d074,_0xb6c1('0x11'));_0x5bee6c(_0x4c773a[_0xb6c1('0x17')][_0xb6c1('0x16')]);}})['catch'](function(_0x3fbe65){logger[_0xb6c1('0x14')](_0xb6c1('0x10'),_0xa3d074,_0x3fbe65);_0x102416(_0x3fbe65);});});}exports['CreateSmsQueueReport']=function(_0xe8c43f){var _0x28226f=this;return new Promise(function(_0x496c5a,_0x13b51d){return db[_0xb6c1('0x18')]['create'](_0xe8c43f['body'],{'raw':_0xe8c43f[_0xb6c1('0x19')]?_0xe8c43f[_0xb6c1('0x19')][_0xb6c1('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x4a1a08){logger[_0xb6c1('0xf')](_0xb6c1('0x1b'),_0xe8c43f);logger[_0xb6c1('0x12')](_0xb6c1('0x1b'),_0xe8c43f,JSON[_0xb6c1('0x1c')](_0x4a1a08));_0x496c5a(_0x4a1a08);})[_0xb6c1('0x1d')](function(_0xd60671){logger[_0xb6c1('0x14')](_0xb6c1('0x1b'),_0xd60671[_0xb6c1('0x16')],_0xe8c43f);_0x13b51d(_0x28226f[_0xb6c1('0x14')](0x1f4,_0xd60671[_0xb6c1('0x16')]));});});};exports[_0xb6c1('0x1e')]=function(_0x289bab){var _0xde1c6d=this;return new Promise(function(_0x1ce853,_0x121296){return db[_0xb6c1('0x18')][_0xb6c1('0x1f')](_0x289bab[_0xb6c1('0x20')],{'raw':_0x289bab['options']?_0x289bab[_0xb6c1('0x19')][_0xb6c1('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x289bab['options']?_0x289bab['options'][_0xb6c1('0x21')]||null:null,'attributes':_0x289bab[_0xb6c1('0x19')]?_0x289bab[_0xb6c1('0x19')][_0xb6c1('0x22')]||null:null,'limit':_0x289bab['options']?_0x289bab[_0xb6c1('0x19')][_0xb6c1('0x23')]||null:null})[_0xb6c1('0xe')](function(_0x4ab2cc){logger[_0xb6c1('0xf')](_0xb6c1('0x1e'),_0x289bab);logger['debug'](_0xb6c1('0x1e'),_0x289bab,JSON[_0xb6c1('0x1c')](_0x4ab2cc));_0x1ce853(_0x4ab2cc);})[_0xb6c1('0x1d')](function(_0x3ba35d){logger[_0xb6c1('0x14')](_0xb6c1('0x1e'),_0x3ba35d[_0xb6c1('0x16')],_0x289bab);_0x121296(_0xde1c6d[_0xb6c1('0x14')](0x1f4,_0x3ba35d[_0xb6c1('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index bd85691..894ccbb 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 _0x7bae=['isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get'];(function(_0x5b0898,_0x293165){var _0x506e88=function(_0x1483ab){while(--_0x1483ab){_0x5b0898['push'](_0x5b0898['shift']());}};_0x506e88(++_0x293165);}(_0x7bae,0x13b));var _0xe7ba=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0x7bae[_0xa8883];return _0x479426;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7ba('0x0'));var timeout=require(_0xe7ba('0x1'));var express=require('express');var router=express[_0xe7ba('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xe7ba('0x3'));var interaction=require(_0xe7ba('0x4'));var config=require(_0xe7ba('0x5'));var controller=require(_0xe7ba('0x6'));router[_0xe7ba('0x7')]('/',auth[_0xe7ba('0x8')](),controller[_0xe7ba('0x9')]);router[_0xe7ba('0x7')](_0xe7ba('0xa'),auth[_0xe7ba('0x8')](),controller[_0xe7ba('0xb')]);router[_0xe7ba('0x7')](_0xe7ba('0xc'),auth[_0xe7ba('0x8')](),controller['show']);router[_0xe7ba('0xd')]('/',auth[_0xe7ba('0x8')](),controller[_0xe7ba('0xe')]);router[_0xe7ba('0xf')](_0xe7ba('0xc'),auth[_0xe7ba('0x8')](),controller[_0xe7ba('0x10')]);router[_0xe7ba('0x11')](_0xe7ba('0xc'),auth['isAuthenticated'](),controller[_0xe7ba('0x12')]);module['exports']=router; \ No newline at end of file +var _0x86f4=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x86f4,0x18a));var _0x486f=function(_0xd2c27a,_0x1a8e89){_0xd2c27a=_0xd2c27a-0x0;var _0x196582=_0x86f4[_0xd2c27a];return _0x196582;};'use strict';var multer=require(_0x486f('0x0'));var util=require(_0x486f('0x1'));var path=require(_0x486f('0x2'));var timeout=require(_0x486f('0x3'));var express=require(_0x486f('0x4'));var router=express[_0x486f('0x5')]();var fs_extra=require(_0x486f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x486f('0x7'));var config=require(_0x486f('0x8'));var controller=require('./smsTransferReport.controller');router[_0x486f('0x9')]('/',auth[_0x486f('0xa')](),controller[_0x486f('0xb')]);router[_0x486f('0x9')](_0x486f('0xc'),auth[_0x486f('0xa')](),controller['describe']);router[_0x486f('0x9')](_0x486f('0xd'),auth[_0x486f('0xa')](),controller[_0x486f('0xe')]);router[_0x486f('0xf')]('/',auth[_0x486f('0xa')](),controller[_0x486f('0x10')]);router[_0x486f('0x11')](_0x486f('0xd'),auth[_0x486f('0xa')](),controller[_0x486f('0x12')]);router[_0x486f('0x13')](_0x486f('0xd'),auth[_0x486f('0xa')](),controller[_0x486f('0x14')]);module[_0x486f('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index e7ed5ff..2c65206 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x5708ad,_0x53b5ae){var _0x3c2993=function(_0x535060){while(--_0x535060){_0x5708ad['push'](_0x5708ad['shift']());}};_0x3c2993(++_0x53b5ae);}(_0x00bb,0x1d8));var _0xb00b=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x00bb[_0xc6be3a];return _0x56a310;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x42e85e,_0x1cf165){var _0x2d3278=function(_0x1f75cf){while(--_0x1f75cf){_0x42e85e['push'](_0x42e85e['shift']());}};_0x2d3278(++_0x1cf165);}(_0x00bb,0x1d8));var _0xb00b=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x00bb[_0xb0f7c3];return _0x28ea68;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 0c3e242..4c22fd7 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 _0x7b4c=['key','model','query','keys','intersection','attributes','fields','length','order','sort','filters','pick','filter','where','merge','VIRTUAL','count','findAll','rows','includeAll','include','options','find','create','body','catch','update','params','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','save','then','destroy','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x7b4c,0x17f));var _0xc7b4=function(_0x369010,_0x5349e0){_0x369010=_0x369010-0x0;var _0x1c8ef1=_0x7b4c[_0x369010];return _0x1c8ef1;};'use strict';var emlformat=require(_0xc7b4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc7b4('0x1'));var rp=require(_0xc7b4('0x2'));var moment=require(_0xc7b4('0x3'));var BPromise=require(_0xc7b4('0x4'));var Mustache=require(_0xc7b4('0x5'));var util=require(_0xc7b4('0x6'));var path=require(_0xc7b4('0x7'));var sox=require(_0xc7b4('0x8'));var csv=require(_0xc7b4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc7b4('0xa'));var _=require(_0xc7b4('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc7b4('0xc'));var deskjs=require(_0xc7b4('0xd'));var toCsv=require(_0xc7b4('0x9'));var querystring=require(_0xc7b4('0xe'));var Papa=require('papaparse');var Redis=require(_0xc7b4('0xf'));var authService=require(_0xc7b4('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc7b4('0x11'));var hardwareService=require(_0xc7b4('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc7b4('0x13'));var licenseUtil=require(_0xc7b4('0x14'));var db=require(_0xc7b4('0x15'))['db'];function respondWithStatusCode(_0xecc844,_0x2624eb){_0x2624eb=_0x2624eb||0xcc;return function(_0x11cba8){if(_0x11cba8){return _0xecc844[_0xc7b4('0x16')](_0x2624eb);}return _0xecc844[_0xc7b4('0x17')](_0x2624eb)[_0xc7b4('0x18')]();};}function respondWithResult(_0xa1140,_0xa8c303){_0xa8c303=_0xa8c303||0xc8;return function(_0x2a7b57){if(_0x2a7b57){return _0xa1140[_0xc7b4('0x17')](_0xa8c303)[_0xc7b4('0x19')](_0x2a7b57);}};}function respondWithFilteredResult(_0x5c73a8,_0x95811a){return function(_0x34a3d8){if(_0x34a3d8){var _0x51cc44=typeof _0x95811a[_0xc7b4('0x1a')]===_0xc7b4('0x1b')&&typeof _0x95811a[_0xc7b4('0x1c')]==='undefined';var _0x3ead52=_0x34a3d8['count'];var _0xc40052=_0x51cc44?0x0:_0x95811a[_0xc7b4('0x1a')];var _0x438ab8=_0x51cc44?_0x34a3d8['count']:_0x95811a['offset']+_0x95811a[_0xc7b4('0x1c')];var _0xb1f384;if(_0x438ab8>=_0x3ead52){_0x438ab8=_0x3ead52;_0xb1f384=0xc8;}else{_0xb1f384=0xce;}_0x5c73a8[_0xc7b4('0x17')](_0xb1f384);return _0x5c73a8[_0xc7b4('0x1d')](_0xc7b4('0x1e'),_0xc40052+'-'+_0x438ab8+'/'+_0x3ead52)[_0xc7b4('0x19')](_0x34a3d8);}return null;};}function patchUpdates(_0x577af9){return function(_0x4954e4){try{jsonpatch['apply'](_0x4954e4,_0x577af9,!![]);}catch(_0x3b3be8){return BPromise['reject'](_0x3b3be8);}return _0x4954e4[_0xc7b4('0x1f')]();};}function saveUpdates(_0x333fae,_0x4f1cc0){return function(_0x4f75e1){if(_0x4f75e1){return _0x4f75e1['update'](_0x333fae)[_0xc7b4('0x20')](function(_0x2db1ed){return _0x2db1ed;});}return null;};}function removeEntity(_0x51870c,_0x5e381f){return function(_0xf47f8d){if(_0xf47f8d){return _0xf47f8d[_0xc7b4('0x21')]()['then'](function(){_0x51870c[_0xc7b4('0x17')](0xcc)[_0xc7b4('0x18')]();});}};}function handleEntityNotFound(_0x1e911b,_0xfeaf1d){return function(_0x207514){if(!_0x207514){_0x1e911b[_0xc7b4('0x16')](0x194);}return _0x207514;};}function handleError(_0x2c26e4,_0x3feb2d){_0x3feb2d=_0x3feb2d||0x1f4;return function(_0x265e79){logger['error'](_0x265e79[_0xc7b4('0x22')]);if(_0x265e79[_0xc7b4('0x23')]){delete _0x265e79[_0xc7b4('0x23')];}_0x2c26e4[_0xc7b4('0x17')](_0x3feb2d)[_0xc7b4('0x24')](_0x265e79);};}exports[_0xc7b4('0x25')]=function(_0x16bb48,_0x44cf1f){var _0x4df7bf={},_0x3ed794={},_0x54d980={'count':0x0,'rows':[]};var _0xc03bae=_[_0xc7b4('0x26')](db[_0xc7b4('0x27')][_0xc7b4('0x28')],function(_0x24de22){return{'name':_0x24de22[_0xc7b4('0x29')],'type':_0x24de22[_0xc7b4('0x2a')][_0xc7b4('0x2b')]};});_0x3ed794[_0xc7b4('0x2c')]=_['map'](_0xc03bae,_0xc7b4('0x23'));_0x3ed794[_0xc7b4('0x2d')]=_[_0xc7b4('0x2e')](_0x16bb48[_0xc7b4('0x2d')]);_0x3ed794['filters']=_[_0xc7b4('0x2f')](_0x3ed794['model'],_0x3ed794['query']);_0x4df7bf[_0xc7b4('0x30')]=_[_0xc7b4('0x2f')](_0x3ed794['model'],qs[_0xc7b4('0x31')](_0x16bb48[_0xc7b4('0x2d')][_0xc7b4('0x31')]));_0x4df7bf[_0xc7b4('0x30')]=_0x4df7bf['attributes'][_0xc7b4('0x32')]?_0x4df7bf['attributes']:_0x3ed794[_0xc7b4('0x2c')];if(!_0x16bb48[_0xc7b4('0x2d')]['hasOwnProperty']('nolimit')){_0x4df7bf['limit']=qs[_0xc7b4('0x1c')](_0x16bb48[_0xc7b4('0x2d')][_0xc7b4('0x1c')]);_0x4df7bf[_0xc7b4('0x1a')]=qs[_0xc7b4('0x1a')](_0x16bb48[_0xc7b4('0x2d')]['offset']);}_0x4df7bf[_0xc7b4('0x33')]=qs[_0xc7b4('0x34')](_0x16bb48[_0xc7b4('0x2d')]['sort']);_0x4df7bf['where']=qs[_0xc7b4('0x35')](_[_0xc7b4('0x36')](_0x16bb48['query'],_0x3ed794[_0xc7b4('0x35')]),_0xc03bae);if(_0x16bb48[_0xc7b4('0x2d')][_0xc7b4('0x37')]){_0x4df7bf[_0xc7b4('0x38')]=_[_0xc7b4('0x39')](_0x4df7bf[_0xc7b4('0x38')],{'$or':_[_0xc7b4('0x26')](_0xc03bae,function(_0x3a238e){if(_0x3a238e[_0xc7b4('0x2a')]!==_0xc7b4('0x3a')){var _0xe204e9={};_0xe204e9[_0x3a238e[_0xc7b4('0x23')]]={'$like':'%'+_0x16bb48[_0xc7b4('0x2d')][_0xc7b4('0x37')]+'%'};return _0xe204e9;}})});}_0x4df7bf=_['merge']({},_0x4df7bf,_0x16bb48['options']);var _0x41b631={'where':_0x4df7bf['where']};return db['SmsTransferReport'][_0xc7b4('0x3b')](_0x41b631)[_0xc7b4('0x20')](function(_0xf3939d){_0x54d980['count']=_0xf3939d;if(_0x16bb48[_0xc7b4('0x2d')]['includeAll']){_0x4df7bf['include']=[{'all':!![]}];}return db[_0xc7b4('0x27')][_0xc7b4('0x3c')](_0x4df7bf);})[_0xc7b4('0x20')](function(_0x5e4454){_0x54d980[_0xc7b4('0x3d')]=_0x5e4454;return _0x54d980;})[_0xc7b4('0x20')](respondWithFilteredResult(_0x44cf1f,_0x4df7bf))['catch'](handleError(_0x44cf1f,null));};exports['show']=function(_0x590cc1,_0x330e73){var _0x1388b9={'raw':!![],'where':{'id':_0x590cc1['params']['id']}},_0x33ea6f={};_0x33ea6f['model']=_[_0xc7b4('0x2e')](db[_0xc7b4('0x27')]['rawAttributes']);_0x33ea6f['query']=_[_0xc7b4('0x2e')](_0x590cc1['query']);_0x33ea6f['filters']=_[_0xc7b4('0x2f')](_0x33ea6f[_0xc7b4('0x2c')],_0x33ea6f[_0xc7b4('0x2d')]);_0x1388b9['attributes']=_['intersection'](_0x33ea6f[_0xc7b4('0x2c')],qs[_0xc7b4('0x31')](_0x590cc1[_0xc7b4('0x2d')][_0xc7b4('0x31')]));_0x1388b9[_0xc7b4('0x30')]=_0x1388b9['attributes']['length']?_0x1388b9[_0xc7b4('0x30')]:_0x33ea6f['model'];if(_0x590cc1['query'][_0xc7b4('0x3e')]){_0x1388b9[_0xc7b4('0x3f')]=[{'all':!![]}];}_0x1388b9=_[_0xc7b4('0x39')]({},_0x1388b9,_0x590cc1[_0xc7b4('0x40')]);return db[_0xc7b4('0x27')][_0xc7b4('0x41')](_0x1388b9)[_0xc7b4('0x20')](handleEntityNotFound(_0x330e73,null))[_0xc7b4('0x20')](respondWithResult(_0x330e73,null))['catch'](handleError(_0x330e73,null));};exports['create']=function(_0x23b3a,_0x162952){return db['SmsTransferReport'][_0xc7b4('0x42')](_0x23b3a[_0xc7b4('0x43')],{})['then'](respondWithResult(_0x162952,0xc9))[_0xc7b4('0x44')](handleError(_0x162952,null));};exports[_0xc7b4('0x45')]=function(_0x44c8a4,_0x4d315d){if(_0x44c8a4[_0xc7b4('0x43')]['id']){delete _0x44c8a4[_0xc7b4('0x43')]['id'];}return db[_0xc7b4('0x27')][_0xc7b4('0x41')]({'where':{'id':_0x44c8a4['params']['id']}})['then'](handleEntityNotFound(_0x4d315d,null))[_0xc7b4('0x20')](saveUpdates(_0x44c8a4[_0xc7b4('0x43')],null))[_0xc7b4('0x20')](respondWithResult(_0x4d315d,null))[_0xc7b4('0x44')](handleError(_0x4d315d,null));};exports[_0xc7b4('0x21')]=function(_0x39c38d,_0x1a00fe){return db['SmsTransferReport'][_0xc7b4('0x41')]({'where':{'id':_0x39c38d[_0xc7b4('0x46')]['id']}})[_0xc7b4('0x20')](handleEntityNotFound(_0x1a00fe,null))[_0xc7b4('0x20')](removeEntity(_0x1a00fe,null))[_0xc7b4('0x44')](handleError(_0x1a00fe,null));};exports['describe']=function(_0x3003bb,_0x2605a1){return db[_0xc7b4('0x27')]['describe']()[_0xc7b4('0x20')](respondWithResult(_0x2605a1,null))['catch'](handleError(_0x2605a1,null));}; \ No newline at end of file +var _0x6436=['index','map','SmsTransferReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','rawAttributes','length','include','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','name'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0x6436,0x1e5));var _0x6643=function(_0x14ded1,_0x4ff84b){_0x14ded1=_0x14ded1-0x0;var _0x2bbae3=_0x6436[_0x14ded1];return _0x2bbae3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6643('0x0'));var zipdir=require(_0x6643('0x1'));var jsonpatch=require(_0x6643('0x2'));var rp=require(_0x6643('0x3'));var moment=require('moment');var BPromise=require(_0x6643('0x4'));var Mustache=require(_0x6643('0x5'));var util=require(_0x6643('0x6'));var path=require(_0x6643('0x7'));var sox=require(_0x6643('0x8'));var csv=require(_0x6643('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6643('0xa'));var squel=require(_0x6643('0xb'));var crypto=require('crypto');var jsforce=require(_0x6643('0xc'));var deskjs=require(_0x6643('0xd'));var toCsv=require(_0x6643('0x9'));var querystring=require(_0x6643('0xe'));var Papa=require(_0x6643('0xf'));var Redis=require(_0x6643('0x10'));var authService=require(_0x6643('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6643('0x12'));var logger=require(_0x6643('0x13'))(_0x6643('0x14'));var utils=require('../../config/utils');var config=require(_0x6643('0x15'));var licenseUtil=require(_0x6643('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35fc37,_0x2c5c99){_0x2c5c99=_0x2c5c99||0xcc;return function(_0xfe15ce){if(_0xfe15ce){return _0x35fc37[_0x6643('0x17')](_0x2c5c99);}return _0x35fc37[_0x6643('0x18')](_0x2c5c99)[_0x6643('0x19')]();};}function respondWithResult(_0x336baf,_0x578e0e){_0x578e0e=_0x578e0e||0xc8;return function(_0x75aca9){if(_0x75aca9){return _0x336baf[_0x6643('0x18')](_0x578e0e)['json'](_0x75aca9);}};}function respondWithFilteredResult(_0x4d6d67,_0x4df801){return function(_0x38ec57){if(_0x38ec57){var _0x51131c=typeof _0x4df801['offset']===_0x6643('0x1a')&&typeof _0x4df801[_0x6643('0x1b')]===_0x6643('0x1a');var _0xee2a31=_0x38ec57[_0x6643('0x1c')];var _0x1a42ad=_0x51131c?0x0:_0x4df801['offset'];var _0x1b3dda=_0x51131c?_0x38ec57['count']:_0x4df801[_0x6643('0x1d')]+_0x4df801[_0x6643('0x1b')];var _0x5c6f8b;if(_0x1b3dda>=_0xee2a31){_0x1b3dda=_0xee2a31;_0x5c6f8b=0xc8;}else{_0x5c6f8b=0xce;}_0x4d6d67[_0x6643('0x18')](_0x5c6f8b);return _0x4d6d67[_0x6643('0x1e')](_0x6643('0x1f'),_0x1a42ad+'-'+_0x1b3dda+'/'+_0xee2a31)[_0x6643('0x20')](_0x38ec57);}return null;};}function patchUpdates(_0xc359cb){return function(_0x202e44){try{jsonpatch[_0x6643('0x21')](_0x202e44,_0xc359cb,!![]);}catch(_0x5bcdf6){return BPromise[_0x6643('0x22')](_0x5bcdf6);}return _0x202e44[_0x6643('0x23')]();};}function saveUpdates(_0x49939c,_0x198906){return function(_0x36216f){if(_0x36216f){return _0x36216f[_0x6643('0x24')](_0x49939c)[_0x6643('0x25')](function(_0x26dd7f){return _0x26dd7f;});}return null;};}function removeEntity(_0x180c99,_0x5e30e1){return function(_0x24c5d2){if(_0x24c5d2){return _0x24c5d2[_0x6643('0x26')]()['then'](function(){_0x180c99[_0x6643('0x18')](0xcc)[_0x6643('0x19')]();});}};}function handleEntityNotFound(_0x1fb5a0,_0x49a186){return function(_0x48daa0){if(!_0x48daa0){_0x1fb5a0[_0x6643('0x17')](0x194);}return _0x48daa0;};}function handleError(_0x794350,_0xa4ac7b){_0xa4ac7b=_0xa4ac7b||0x1f4;return function(_0x206b87){logger['error'](_0x206b87['stack']);if(_0x206b87['name']){delete _0x206b87[_0x6643('0x27')];}_0x794350[_0x6643('0x18')](_0xa4ac7b)['send'](_0x206b87);};}exports[_0x6643('0x28')]=function(_0x3f9757,_0x323a39){var _0x5b51d7={},_0x557681={},_0x2a7255={'count':0x0,'rows':[]};var _0x5e052d=_[_0x6643('0x29')](db[_0x6643('0x2a')]['rawAttributes'],function(_0x1d8d57){return{'name':_0x1d8d57[_0x6643('0x2b')],'type':_0x1d8d57[_0x6643('0x2c')][_0x6643('0x2d')]};});_0x557681[_0x6643('0x2e')]=_[_0x6643('0x29')](_0x5e052d,_0x6643('0x27'));_0x557681[_0x6643('0x2f')]=_[_0x6643('0x30')](_0x3f9757[_0x6643('0x2f')]);_0x557681[_0x6643('0x31')]=_[_0x6643('0x32')](_0x557681[_0x6643('0x2e')],_0x557681['query']);_0x5b51d7['attributes']=_[_0x6643('0x32')](_0x557681['model'],qs['fields'](_0x3f9757[_0x6643('0x2f')][_0x6643('0x33')]));_0x5b51d7[_0x6643('0x34')]=_0x5b51d7[_0x6643('0x34')]['length']?_0x5b51d7[_0x6643('0x34')]:_0x557681[_0x6643('0x2e')];if(!_0x3f9757[_0x6643('0x2f')][_0x6643('0x35')](_0x6643('0x36'))){_0x5b51d7[_0x6643('0x1b')]=qs[_0x6643('0x1b')](_0x3f9757[_0x6643('0x2f')][_0x6643('0x1b')]);_0x5b51d7['offset']=qs[_0x6643('0x1d')](_0x3f9757['query']['offset']);}_0x5b51d7[_0x6643('0x37')]=qs['sort'](_0x3f9757['query'][_0x6643('0x38')]);_0x5b51d7[_0x6643('0x39')]=qs[_0x6643('0x31')](_[_0x6643('0x3a')](_0x3f9757[_0x6643('0x2f')],_0x557681[_0x6643('0x31')]),_0x5e052d);if(_0x3f9757[_0x6643('0x2f')]['filter']){_0x5b51d7[_0x6643('0x39')]=_[_0x6643('0x3b')](_0x5b51d7[_0x6643('0x39')],{'$or':_[_0x6643('0x29')](_0x5e052d,function(_0x272f30){if(_0x272f30[_0x6643('0x2c')]!==_0x6643('0x3c')){var _0x2d85bd={};_0x2d85bd[_0x272f30[_0x6643('0x27')]]={'$like':'%'+_0x3f9757[_0x6643('0x2f')][_0x6643('0x3d')]+'%'};return _0x2d85bd;}})});}_0x5b51d7=_[_0x6643('0x3b')]({},_0x5b51d7,_0x3f9757['options']);var _0x44f78b={'where':_0x5b51d7['where']};return db[_0x6643('0x2a')][_0x6643('0x1c')](_0x44f78b)[_0x6643('0x25')](function(_0x565cee){_0x2a7255['count']=_0x565cee;if(_0x3f9757[_0x6643('0x2f')][_0x6643('0x3e')]){_0x5b51d7['include']=[{'all':!![]}];}return db['SmsTransferReport'][_0x6643('0x3f')](_0x5b51d7);})['then'](function(_0x5a62a1){_0x2a7255[_0x6643('0x40')]=_0x5a62a1;return _0x2a7255;})[_0x6643('0x25')](respondWithFilteredResult(_0x323a39,_0x5b51d7))[_0x6643('0x41')](handleError(_0x323a39,null));};exports[_0x6643('0x42')]=function(_0x411b83,_0x122fd4){var _0x1f1a37={'raw':!![],'where':{'id':_0x411b83[_0x6643('0x43')]['id']}},_0x48c6b0={};_0x48c6b0[_0x6643('0x2e')]=_[_0x6643('0x30')](db[_0x6643('0x2a')][_0x6643('0x44')]);_0x48c6b0[_0x6643('0x2f')]=_[_0x6643('0x30')](_0x411b83[_0x6643('0x2f')]);_0x48c6b0[_0x6643('0x31')]=_['intersection'](_0x48c6b0[_0x6643('0x2e')],_0x48c6b0[_0x6643('0x2f')]);_0x1f1a37[_0x6643('0x34')]=_[_0x6643('0x32')](_0x48c6b0[_0x6643('0x2e')],qs[_0x6643('0x33')](_0x411b83['query'][_0x6643('0x33')]));_0x1f1a37[_0x6643('0x34')]=_0x1f1a37[_0x6643('0x34')][_0x6643('0x45')]?_0x1f1a37[_0x6643('0x34')]:_0x48c6b0[_0x6643('0x2e')];if(_0x411b83[_0x6643('0x2f')]['includeAll']){_0x1f1a37[_0x6643('0x46')]=[{'all':!![]}];}_0x1f1a37=_[_0x6643('0x3b')]({},_0x1f1a37,_0x411b83['options']);return db[_0x6643('0x2a')][_0x6643('0x47')](_0x1f1a37)[_0x6643('0x25')](handleEntityNotFound(_0x122fd4,null))[_0x6643('0x25')](respondWithResult(_0x122fd4,null))[_0x6643('0x41')](handleError(_0x122fd4,null));};exports['create']=function(_0xf33a44,_0x23ae5a){return db[_0x6643('0x2a')][_0x6643('0x48')](_0xf33a44[_0x6643('0x49')],{})[_0x6643('0x25')](respondWithResult(_0x23ae5a,0xc9))[_0x6643('0x41')](handleError(_0x23ae5a,null));};exports['update']=function(_0x9c2d6b,_0x1c6ef4){if(_0x9c2d6b[_0x6643('0x49')]['id']){delete _0x9c2d6b[_0x6643('0x49')]['id'];}return db['SmsTransferReport'][_0x6643('0x47')]({'where':{'id':_0x9c2d6b[_0x6643('0x43')]['id']}})[_0x6643('0x25')](handleEntityNotFound(_0x1c6ef4,null))[_0x6643('0x25')](saveUpdates(_0x9c2d6b[_0x6643('0x49')],null))[_0x6643('0x25')](respondWithResult(_0x1c6ef4,null))['catch'](handleError(_0x1c6ef4,null));};exports[_0x6643('0x26')]=function(_0x22b0d5,_0xf053eb){return db[_0x6643('0x2a')]['find']({'where':{'id':_0x22b0d5[_0x6643('0x43')]['id']}})[_0x6643('0x25')](handleEntityNotFound(_0xf053eb,null))[_0x6643('0x25')](removeEntity(_0xf053eb,null))['catch'](handleError(_0xf053eb,null));};exports[_0x6643('0x4a')]=function(_0x2f6ae7,_0xec832e){return db[_0x6643('0x2a')]['describe']()['then'](respondWithResult(_0xec832e,null))[_0x6643('0x41')](handleError(_0xec832e,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 101b3bd..d9e22cb 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 _0x0360=['./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x46e1b4,_0x1789c3){var _0x586a03=function(_0x4d775b){while(--_0x4d775b){_0x46e1b4['push'](_0x46e1b4['shift']());}};_0x586a03(++_0x1789c3);}(_0x0360,0xae));var _0x0036=function(_0x21eb4e,_0x3345fe){_0x21eb4e=_0x21eb4e-0x0;var _0x42fabc=_0x0360[_0x21eb4e];return _0x42fabc;};'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('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1433=['SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','api','moment','bluebird','request-promise','../../config/environment','./smsTransferReport.attributes','exports','define'];(function(_0x156a0d,_0x3946ce){var _0x98a9ba=function(_0x46c1b2){while(--_0x46c1b2){_0x156a0d['push'](_0x156a0d['shift']());}};_0x98a9ba(++_0x3946ce);}(_0x1433,0x121));var _0x3143=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1433[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3143('0x0'));var util=require(_0x3143('0x1'));var logger=require('../../config/logger')(_0x3143('0x2'));var moment=require(_0x3143('0x3'));var BPromise=require(_0x3143('0x4'));var rp=require(_0x3143('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3143('0x6'));var attributes=require(_0x3143('0x7'));module[_0x3143('0x8')]=function(_0x216e7a,_0xe029e4){return _0x216e7a[_0x3143('0x9')](_0x3143('0xa'),attributes,{'tableName':_0x3143('0xb'),'paranoid':![],'indexes':[{'name':_0x3143('0xc'),'fields':[_0x3143('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index d68e60a..be4d8b1 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 _0xf3a7=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','request\x20sent','debug','error','code','SmsTransferReport,\x20%s,\x20%s','message','info','result','catch','util'];(function(_0x547a9c,_0x5bebda){var _0x424b78=function(_0x527541){while(--_0x527541){_0x547a9c['push'](_0x547a9c['shift']());}};_0x424b78(++_0x5bebda);}(_0xf3a7,0x99));var _0x7f3a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf3a7[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x7f3a('0x0'));var moment=require(_0x7f3a('0x1'));var BPromise=require(_0x7f3a('0x2'));var rs=require(_0x7f3a('0x3'));var fs=require('fs');var Redis=require(_0x7f3a('0x4'));var db=require(_0x7f3a('0x5'))['db'];var utils=require(_0x7f3a('0x6'));var logger=require(_0x7f3a('0x7'))(_0x7f3a('0x8'));var config=require(_0x7f3a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7f3a('0xa')][_0x7f3a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a7d66,_0x2c6b8b,_0x1dd804){return new BPromise(function(_0x36beee,_0x25db47){return client['request'](_0x2a7d66,_0x1dd804)[_0x7f3a('0xc')](function(_0x4654df){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x2c6b8b,_0x7f3a('0xd'));logger[_0x7f3a('0xe')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x2c6b8b,_0x7f3a('0xd'),JSON['stringify'](_0x4654df));if(_0x4654df[_0x7f3a('0xf')]){if(_0x4654df['error'][_0x7f3a('0x10')]===0x1f4){logger[_0x7f3a('0xf')](_0x7f3a('0x11'),_0x2c6b8b,_0x4654df[_0x7f3a('0xf')][_0x7f3a('0x12')]);return _0x25db47(_0x4654df[_0x7f3a('0xf')][_0x7f3a('0x12')]);}logger[_0x7f3a('0xf')](_0x7f3a('0x11'),_0x2c6b8b,_0x4654df['error'][_0x7f3a('0x12')]);return _0x36beee(_0x4654df['error'][_0x7f3a('0x12')]);}else{logger[_0x7f3a('0x13')](_0x7f3a('0x11'),_0x2c6b8b,_0x7f3a('0xd'));_0x36beee(_0x4654df[_0x7f3a('0x14')][_0x7f3a('0x12')]);}})[_0x7f3a('0x15')](function(_0x4bb60a){logger[_0x7f3a('0xf')](_0x7f3a('0x11'),_0x2c6b8b,_0x4bb60a);_0x25db47(_0x4bb60a);});});} \ No newline at end of file +var _0x47d6=['../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','ioredis','../../mysqldb'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x47d6,0x1de));var _0x647d=function(_0x570231,_0x4bc2da){_0x570231=_0x570231-0x0;var _0x165454=_0x47d6[_0x570231];return _0x165454;};'use strict';var _=require(_0x647d('0x0'));var util=require(_0x647d('0x1'));var moment=require(_0x647d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x647d('0x3'));var db=require(_0x647d('0x4'))['db'];var utils=require(_0x647d('0x5'));var logger=require('../../config/logger')(_0x647d('0x6'));var config=require(_0x647d('0x7'));var jayson=require(_0x647d('0x8'));var client=jayson['client'][_0x647d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a77b3,_0xeab7f7,_0xe5937){return new BPromise(function(_0x2a9508,_0x11a337){return client[_0x647d('0xa')](_0x2a77b3,_0xe5937)[_0x647d('0xb')](function(_0x3ed97f){logger[_0x647d('0xc')](_0x647d('0xd'),_0xeab7f7,_0x647d('0xe'));logger['debug'](_0x647d('0xf'),_0xeab7f7,_0x647d('0xe'),JSON[_0x647d('0x10')](_0x3ed97f));if(_0x3ed97f[_0x647d('0x11')]){if(_0x3ed97f[_0x647d('0x11')][_0x647d('0x12')]===0x1f4){logger[_0x647d('0x11')](_0x647d('0xd'),_0xeab7f7,_0x3ed97f[_0x647d('0x11')][_0x647d('0x13')]);return _0x11a337(_0x3ed97f[_0x647d('0x11')][_0x647d('0x13')]);}logger[_0x647d('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0xeab7f7,_0x3ed97f[_0x647d('0x11')][_0x647d('0x13')]);return _0x2a9508(_0x3ed97f[_0x647d('0x11')]['message']);}else{logger[_0x647d('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0xeab7f7,_0x647d('0xe'));_0x2a9508(_0x3ed97f['result'][_0x647d('0x13')]);}})[_0x647d('0x14')](function(_0x598186){logger[_0x647d('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0xeab7f7,_0x598186);_0x11a337(_0x598186);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index cd3a97c..64222f9 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 _0x220c=['join','root','server/files/sounds/original/','originalname','format','%s-%s%s','basename','extname','now','post','single','file','create','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage'];(function(_0x4b0821,_0x269f68){var _0x29155a=function(_0x5bfc06){while(--_0x5bfc06){_0x4b0821['push'](_0x4b0821['shift']());}};_0x29155a(++_0x269f68);}(_0x220c,0x74));var _0xc220=function(_0x427214,_0xaa01af){_0x427214=_0x427214-0x0;var _0x4a9fe0=_0x220c[_0x427214];return _0x4a9fe0;};'use strict';var multer=require(_0xc220('0x0'));var util=require(_0xc220('0x1'));var path=require(_0xc220('0x2'));var timeout=require(_0xc220('0x3'));var express=require(_0xc220('0x4'));var router=express['Router']();var fs_extra=require(_0xc220('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc220('0x6'));var controller=require(_0xc220('0x7'));router[_0xc220('0x8')]('/',auth[_0xc220('0x9')](),controller[_0xc220('0xa')]);router[_0xc220('0x8')](_0xc220('0xb'),auth[_0xc220('0x9')](),controller[_0xc220('0xc')]);router['get'](_0xc220('0xd'),auth[_0xc220('0x9')](),controller[_0xc220('0xe')]);var upload=multer({'storage':multer[_0xc220('0xf')]({'destination':function(_0x504430,_0x178723,_0x5d9463){_0x5d9463(null,path[_0xc220('0x10')](config[_0xc220('0x11')],_0xc220('0x12')));},'filename':function(_0x110cfb,_0x233d4e,_0xeb3bc){_0x233d4e[_0xc220('0x13')]=_0x233d4e[_0xc220('0x13')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xeb3bc(null,util[_0xc220('0x14')](_0xc220('0x15'),path[_0xc220('0x16')](_0x233d4e[_0xc220('0x13')],path[_0xc220('0x17')](_0x233d4e['originalname'])),Date[_0xc220('0x18')](),path[_0xc220('0x17')](_0x233d4e['originalname'])));}})});router[_0xc220('0x19')]('/',upload[_0xc220('0x1a')](_0xc220('0x1b')),controller[_0xc220('0x1c')]);router[_0xc220('0x1d')](_0xc220('0xb'),auth[_0xc220('0x9')](),controller[_0xc220('0x1e')]);router[_0xc220('0x1f')]('/:id',auth[_0xc220('0x9')](),controller[_0xc220('0x1f')]);module[_0xc220('0x20')]=router; \ No newline at end of file +var _0x666d=['server/files/sounds/original/','originalname','replace','basename','now','file','create','update','delete','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','/:id/download','download','diskStorage','join','root'];(function(_0x59e2d9,_0xd88352){var _0x132155=function(_0x5adb33){while(--_0x5adb33){_0x59e2d9['push'](_0x59e2d9['shift']());}};_0x132155(++_0xd88352);}(_0x666d,0xe2));var _0xd666=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x666d[_0x413feb];return _0x40ee88;};'use strict';var multer=require(_0xd666('0x0'));var util=require('util');var path=require(_0xd666('0x1'));var timeout=require('connect-timeout');var express=require(_0xd666('0x2'));var router=express[_0xd666('0x3')]();var fs_extra=require(_0xd666('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd666('0x5'));var config=require(_0xd666('0x6'));var controller=require(_0xd666('0x7'));router[_0xd666('0x8')]('/',auth[_0xd666('0x9')](),controller[_0xd666('0xa')]);router['get'](_0xd666('0xb'),auth[_0xd666('0x9')](),controller['show']);router[_0xd666('0x8')](_0xd666('0xc'),auth['isAuthenticated'](),controller[_0xd666('0xd')]);var upload=multer({'storage':multer[_0xd666('0xe')]({'destination':function(_0x52c9d7,_0x15fbf8,_0x1e245e){_0x1e245e(null,path[_0xd666('0xf')](config[_0xd666('0x10')],_0xd666('0x11')));},'filename':function(_0x5bf67b,_0x40b2e9,_0x36a28a){_0x40b2e9[_0xd666('0x12')]=_0x40b2e9[_0xd666('0x12')][_0xd666('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x36a28a(null,util['format']('%s-%s%s',path[_0xd666('0x14')](_0x40b2e9['originalname'],path['extname'](_0x40b2e9[_0xd666('0x12')])),Date[_0xd666('0x15')](),path['extname'](_0x40b2e9[_0xd666('0x12')])));}})});router['post']('/',upload['single'](_0xd666('0x16')),controller[_0xd666('0x17')]);router['put'](_0xd666('0xb'),auth['isAuthenticated'](),controller[_0xd666('0x18')]);router[_0xd666('0x19')](_0xd666('0xb'),auth[_0xd666('0x9')](),controller[_0xd666('0x19')]);module[_0xd666('0x1a')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index c545856..26404cf 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 _0x5a1c=['FLOAT','BIGINT','INTEGER','STRING'];(function(_0x3ec862,_0x19858d){var _0x506520=function(_0x4b7aa2){while(--_0x4b7aa2){_0x3ec862['push'](_0x3ec862['shift']());}};_0x506520(++_0x19858d);}(_0x5a1c,0xd3));var _0xc5a1=function(_0x18789c,_0x280bca){_0x18789c=_0x18789c-0x0;var _0x18faf1=_0x5a1c[_0x18789c];return _0x18faf1;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc5a1('0x0')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0xc5a1('0x0')]},'display_name':{'type':Sequelize[_0xc5a1('0x0')],'defaultValue':''},'description':{'type':Sequelize[_0xc5a1('0x0')]},'original_format':{'type':Sequelize[_0xc5a1('0x0')]},'original_duration':{'type':Sequelize[_0xc5a1('0x1')]},'original_sampleCount':{'type':Sequelize[_0xc5a1('0x2')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0xc5a1('0x2')]},'original_sampleRate':{'type':Sequelize[_0xc5a1('0x3')]},'converted_format':{'type':Sequelize[_0xc5a1('0x0')]},'converted_duration':{'type':Sequelize[_0xc5a1('0x1')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0xc5a1('0x3')]},'converted_bitRate':{'type':Sequelize[_0xc5a1('0x2')]},'converted_sampleRate':{'type':Sequelize[_0xc5a1('0x3')]}}; \ No newline at end of file +var _0xa884=['STRING','BIGINT','INTEGER','FLOAT','exports','name'];(function(_0x118caf,_0x2a1c36){var _0x4e587d=function(_0x24d87c){while(--_0x24d87c){_0x118caf['push'](_0x118caf['shift']());}};_0x4e587d(++_0x2a1c36);}(_0xa884,0x94));var _0x4a88=function(_0x24fa1a,_0x16d9c2){_0x24fa1a=_0x24fa1a-0x0;var _0xc5621f=_0xa884[_0x24fa1a];return _0xc5621f;};'use strict';var Sequelize=require('sequelize');module[_0x4a88('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x4a88('0x1'),'allowNull':![]},'save_name':{'type':Sequelize[_0x4a88('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x4a88('0x2')]},'original_format':{'type':Sequelize[_0x4a88('0x2')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x4a88('0x3')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x4a88('0x4')]},'converted_format':{'type':Sequelize[_0x4a88('0x2')]},'converted_duration':{'type':Sequelize[_0x4a88('0x5')]},'converted_sampleCount':{'type':Sequelize[_0x4a88('0x3')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x4a88('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index c8f7315..c0a71de 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 _0x9cc6=['reject','update','then','destroy','get','UserProfileResource','error','name','send','map','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','Sound','includeAll','include','rows','catch','params','length','download','find','save_name','existsSync','join','server/files/sounds/converted','converted_format','Sound\x20not\x20found','format','%s.%s','basename','originalname','extname','file','filename','wav','root','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Sounds','autoAssociation','start','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','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','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply'];(function(_0x10afec,_0x5ee21b){var _0x3424f8=function(_0x5f413a){while(--_0x5f413a){_0x10afec['push'](_0x10afec['shift']());}};_0x3424f8(++_0x5ee21b);}(_0x9cc6,0xd0));var _0x69cc=function(_0x549d16,_0x4d069a){_0x549d16=_0x549d16-0x0;var _0x344ccc=_0x9cc6[_0x549d16];return _0x344ccc;};'use strict';var emlformat=require(_0x69cc('0x0'));var rimraf=require(_0x69cc('0x1'));var zipdir=require(_0x69cc('0x2'));var jsonpatch=require(_0x69cc('0x3'));var rp=require(_0x69cc('0x4'));var moment=require('moment');var BPromise=require(_0x69cc('0x5'));var Mustache=require('mustache');var util=require(_0x69cc('0x6'));var path=require(_0x69cc('0x7'));var sox=require(_0x69cc('0x8'));var csv=require('to-csv');var ejs=require(_0x69cc('0x9'));var fs=require('fs');var fs_extra=require(_0x69cc('0xa'));var _=require(_0x69cc('0xb'));var squel=require(_0x69cc('0xc'));var crypto=require(_0x69cc('0xd'));var jsforce=require(_0x69cc('0xe'));var deskjs=require(_0x69cc('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x69cc('0x10'));var Redis=require(_0x69cc('0x11'));var authService=require(_0x69cc('0x12'));var qs=require(_0x69cc('0x13'));var as=require(_0x69cc('0x14'));var hardwareService=require(_0x69cc('0x15'));var logger=require(_0x69cc('0x16'))(_0x69cc('0x17'));var utils=require(_0x69cc('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x69cc('0x19'));var db=require(_0x69cc('0x1a'))['db'];function respondWithStatusCode(_0x3caede,_0x231e7f){_0x231e7f=_0x231e7f||0xcc;return function(_0x125918){if(_0x125918){return _0x3caede[_0x69cc('0x1b')](_0x231e7f);}return _0x3caede[_0x69cc('0x1c')](_0x231e7f)[_0x69cc('0x1d')]();};}function respondWithResult(_0x5c0a65,_0x3bcd57){_0x3bcd57=_0x3bcd57||0xc8;return function(_0x39fd17){if(_0x39fd17){return _0x5c0a65['status'](_0x3bcd57)[_0x69cc('0x1e')](_0x39fd17);}};}function respondWithFilteredResult(_0x2196e8,_0x5bf6be){return function(_0x189975){if(_0x189975){var _0x2f8984=typeof _0x5bf6be[_0x69cc('0x1f')]===_0x69cc('0x20')&&typeof _0x5bf6be['limit']==='undefined';var _0xa1d8f0=_0x189975[_0x69cc('0x21')];var _0x3899b6=_0x2f8984?0x0:_0x5bf6be['offset'];var _0x1f9a3d=_0x2f8984?_0x189975[_0x69cc('0x21')]:_0x5bf6be[_0x69cc('0x1f')]+_0x5bf6be[_0x69cc('0x22')];var _0x4000d5;if(_0x1f9a3d>=_0xa1d8f0){_0x1f9a3d=_0xa1d8f0;_0x4000d5=0xc8;}else{_0x4000d5=0xce;}_0x2196e8[_0x69cc('0x1c')](_0x4000d5);return _0x2196e8[_0x69cc('0x23')](_0x69cc('0x24'),_0x3899b6+'-'+_0x1f9a3d+'/'+_0xa1d8f0)['json'](_0x189975);}return null;};}function patchUpdates(_0x49b7f2){return function(_0x3f867c){try{jsonpatch[_0x69cc('0x25')](_0x3f867c,_0x49b7f2,!![]);}catch(_0x2bb30b){return BPromise[_0x69cc('0x26')](_0x2bb30b);}return _0x3f867c['save']();};}function saveUpdates(_0x58dcb1,_0xc2aadb){return function(_0x3108ca){if(_0x3108ca){return _0x3108ca[_0x69cc('0x27')](_0x58dcb1)[_0x69cc('0x28')](function(_0x134e87){return _0x134e87;});}return null;};}function removeEntity(_0x525544,_0xd316ef){return function(_0x3fce58){if(_0x3fce58){return _0x3fce58[_0x69cc('0x29')]()[_0x69cc('0x28')](function(){var _0x2751ed=_0x3fce58[_0x69cc('0x2a')]({'plain':!![]});var _0x53e11d='Sounds';return db[_0x69cc('0x2b')][_0x69cc('0x29')]({'where':{'type':_0x53e11d,'resourceId':_0x2751ed['id']}})[_0x69cc('0x28')](function(){return _0x3fce58;});})['then'](function(){_0x525544[_0x69cc('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19daf5,_0x5323be){return function(_0x4d2d8d){if(!_0x4d2d8d){_0x19daf5[_0x69cc('0x1b')](0x194);}return _0x4d2d8d;};}function handleError(_0x323dc7,_0x1f52bb){_0x1f52bb=_0x1f52bb||0x1f4;return function(_0x2ddf52){logger[_0x69cc('0x2c')](_0x2ddf52['stack']);if(_0x2ddf52[_0x69cc('0x2d')]){delete _0x2ddf52[_0x69cc('0x2d')];}_0x323dc7[_0x69cc('0x1c')](_0x1f52bb)[_0x69cc('0x2e')](_0x2ddf52);};}exports['index']=function(_0x14fd2f,_0x3c533b){var _0x33132c={},_0x5bb8c1={},_0x188541={'count':0x0,'rows':[]};var _0x4725b4=_[_0x69cc('0x2f')](db['Sound']['rawAttributes'],function(_0xb95f1c){return{'name':_0xb95f1c['fieldName'],'type':_0xb95f1c[_0x69cc('0x30')][_0x69cc('0x31')]};});_0x5bb8c1[_0x69cc('0x32')]=_[_0x69cc('0x2f')](_0x4725b4,_0x69cc('0x2d'));_0x5bb8c1[_0x69cc('0x33')]=_[_0x69cc('0x34')](_0x14fd2f[_0x69cc('0x33')]);_0x5bb8c1[_0x69cc('0x35')]=_[_0x69cc('0x36')](_0x5bb8c1[_0x69cc('0x32')],_0x5bb8c1['query']);_0x33132c[_0x69cc('0x37')]=_[_0x69cc('0x36')](_0x5bb8c1['model'],qs[_0x69cc('0x38')](_0x14fd2f[_0x69cc('0x33')]['fields']));_0x33132c[_0x69cc('0x37')]=_0x33132c[_0x69cc('0x37')]['length']?_0x33132c['attributes']:_0x5bb8c1['model'];if(!_0x14fd2f[_0x69cc('0x33')][_0x69cc('0x39')](_0x69cc('0x3a'))){_0x33132c[_0x69cc('0x22')]=qs[_0x69cc('0x22')](_0x14fd2f[_0x69cc('0x33')][_0x69cc('0x22')]);_0x33132c[_0x69cc('0x1f')]=qs[_0x69cc('0x1f')](_0x14fd2f[_0x69cc('0x33')][_0x69cc('0x1f')]);}_0x33132c[_0x69cc('0x3b')]=qs[_0x69cc('0x3c')](_0x14fd2f[_0x69cc('0x33')][_0x69cc('0x3c')]);_0x33132c[_0x69cc('0x3d')]=qs[_0x69cc('0x35')](_[_0x69cc('0x3e')](_0x14fd2f[_0x69cc('0x33')],_0x5bb8c1[_0x69cc('0x35')]),_0x4725b4);if(_0x14fd2f[_0x69cc('0x33')][_0x69cc('0x3f')]){_0x33132c['where']=_[_0x69cc('0x40')](_0x33132c[_0x69cc('0x3d')],{'$or':_[_0x69cc('0x2f')](_0x4725b4,function(_0x2cde7c){if(_0x2cde7c[_0x69cc('0x30')]!=='VIRTUAL'){var _0x2fccb7={};_0x2fccb7[_0x2cde7c[_0x69cc('0x2d')]]={'$like':'%'+_0x14fd2f[_0x69cc('0x33')]['filter']+'%'};return _0x2fccb7;}})});}_0x33132c=_[_0x69cc('0x40')]({},_0x33132c,_0x14fd2f[_0x69cc('0x41')]);var _0x5040d3={'where':_0x33132c[_0x69cc('0x3d')]};return db[_0x69cc('0x42')][_0x69cc('0x21')](_0x5040d3)['then'](function(_0xf2409d){_0x188541[_0x69cc('0x21')]=_0xf2409d;if(_0x14fd2f['query'][_0x69cc('0x43')]){_0x33132c[_0x69cc('0x44')]=[{'all':!![]}];}return db[_0x69cc('0x42')]['findAll'](_0x33132c);})[_0x69cc('0x28')](function(_0x1fbb59){_0x188541[_0x69cc('0x45')]=_0x1fbb59;return _0x188541;})[_0x69cc('0x28')](respondWithFilteredResult(_0x3c533b,_0x33132c))[_0x69cc('0x46')](handleError(_0x3c533b,null));};exports['show']=function(_0xb7c5b8,_0x2df1f4){var _0x5d520c={'raw':!![],'where':{'id':_0xb7c5b8[_0x69cc('0x47')]['id']}},_0x47b8c5={};_0x47b8c5['model']=_[_0x69cc('0x34')](db['Sound']['rawAttributes']);_0x47b8c5['query']=_['keys'](_0xb7c5b8[_0x69cc('0x33')]);_0x47b8c5[_0x69cc('0x35')]=_[_0x69cc('0x36')](_0x47b8c5[_0x69cc('0x32')],_0x47b8c5['query']);_0x5d520c['attributes']=_[_0x69cc('0x36')](_0x47b8c5['model'],qs[_0x69cc('0x38')](_0xb7c5b8['query'][_0x69cc('0x38')]));_0x5d520c[_0x69cc('0x37')]=_0x5d520c[_0x69cc('0x37')][_0x69cc('0x48')]?_0x5d520c[_0x69cc('0x37')]:_0x47b8c5['model'];if(_0xb7c5b8[_0x69cc('0x33')][_0x69cc('0x43')]){_0x5d520c[_0x69cc('0x44')]=[{'all':!![]}];}_0x5d520c=_['merge']({},_0x5d520c,_0xb7c5b8[_0x69cc('0x41')]);return db[_0x69cc('0x42')]['find'](_0x5d520c)[_0x69cc('0x28')](handleEntityNotFound(_0x2df1f4,null))[_0x69cc('0x28')](respondWithResult(_0x2df1f4,null))[_0x69cc('0x46')](handleError(_0x2df1f4,null));};exports[_0x69cc('0x49')]=function(_0x25f423,_0x28bdc3,_0x5836a7){return db[_0x69cc('0x42')][_0x69cc('0x4a')]({'where':{'id':_0x25f423[_0x69cc('0x47')]['id']},'attributes':[_0x69cc('0x2d'),_0x69cc('0x4b'),'converted_format'],'raw':!![]})[_0x69cc('0x28')](handleEntityNotFound(_0x28bdc3,null))[_0x69cc('0x28')](function(_0x10a506){if(_0x10a506){if(!fs[_0x69cc('0x4c')](path[_0x69cc('0x4d')](config['root'],_0x69cc('0x4e'),_0x10a506[_0x69cc('0x4b')]+'.'+_0x10a506[_0x69cc('0x4f')]))){throw new db['Sequelize']['ValidationError'](_0x69cc('0x50'));}return _0x28bdc3[_0x69cc('0x49')](path['join'](config['root'],_0x69cc('0x4e'),util[_0x69cc('0x51')](_0x69cc('0x52'),_0x10a506[_0x69cc('0x4b')],_0x10a506[_0x69cc('0x4f')])),util[_0x69cc('0x51')](_0x69cc('0x52'),_0x10a506['name'],_0x10a506[_0x69cc('0x4f')]));}return null;})[_0x69cc('0x46')](handleError(_0x28bdc3,null));};exports['create']=function(_0x3d6a11,_0x2be71c,_0x3b8c4b){var _0x2d994d={'name':path[_0x69cc('0x53')](_0x3d6a11['file'][_0x69cc('0x54')],path[_0x69cc('0x55')](_0x3d6a11['file']['originalname'])),'save_name':path['basename'](_0x3d6a11[_0x69cc('0x56')][_0x69cc('0x57')],path['extname'](_0x3d6a11[_0x69cc('0x56')][_0x69cc('0x57')])),'original_format':path[_0x69cc('0x55')](_0x3d6a11[_0x69cc('0x56')][_0x69cc('0x54')])['substring'](0x1),'converted_format':_0x69cc('0x58')};var _0x4dd80e=path[_0x69cc('0x4d')](config[_0x69cc('0x59')],_0x69cc('0x5a'),_0x3d6a11[_0x69cc('0x56')][_0x69cc('0x57')]);var _0x780366=path[_0x69cc('0x4d')](config[_0x69cc('0x59')],'server/files/sounds/converted',util[_0x69cc('0x51')](_0x69cc('0x52'),path['basename'](_0x3d6a11[_0x69cc('0x56')][_0x69cc('0x57')],path['extname'](_0x3d6a11[_0x69cc('0x56')][_0x69cc('0x57')])),_0x2d994d['converted_format']));logger[_0x69cc('0x5b')](_0x69cc('0x5c'),_0x4dd80e);logger[_0x69cc('0x5b')]('Sound\x20upload\x20destination:\x20%s',_0x780366);try{fs[_0x69cc('0x5d')](_0x4dd80e,parseInt(_0x69cc('0x5e'),0x8));var _0xa4de7e=sox[_0x69cc('0x5f')](_0x4dd80e,_0x780366,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xa4de7e['on'](_0x69cc('0x2c'),function(_0x20f379){fs[_0x69cc('0x60')](_0x4dd80e);_0x2be71c[_0x69cc('0x1c')](0x1f4)[_0x69cc('0x2e')](_0x20f379);});_0xa4de7e['on'](_0x69cc('0x61'),function(_0x2c766e){_0x2d994d[_0x69cc('0x62')]=isNaN(_0x2c766e[_0x69cc('0x63')])?null:_0x2c766e['duration']*0x3e8;_0x2d994d[_0x69cc('0x64')]=isNaN(_0x2c766e['sampleCount'])?null:_0x2c766e[_0x69cc('0x65')];_0x2d994d[_0x69cc('0x66')]=isNaN(_0x2c766e[_0x69cc('0x67')])?null:_0x2c766e['channelCount'];_0x2d994d['original_bitRate']=isNaN(_0x2c766e['bitRate'])?null:_0x2c766e[_0x69cc('0x68')];_0x2d994d[_0x69cc('0x69')]=isNaN(_0x2c766e['sampleRate'])?null:_0x2c766e[_0x69cc('0x6a')];});_0xa4de7e['on'](_0x69cc('0x6b'),function(_0x3e3d0b){_0x2d994d[_0x69cc('0x6c')]=isNaN(_0x3e3d0b[_0x69cc('0x63')])?null:_0x3e3d0b[_0x69cc('0x63')]*0x3e8;_0x2d994d[_0x69cc('0x6d')]=isNaN(_0x3e3d0b['sampleCount'])?null:_0x3e3d0b[_0x69cc('0x65')];_0x2d994d[_0x69cc('0x6e')]=isNaN(_0x3e3d0b[_0x69cc('0x67')])?null:_0x3e3d0b['channelCount'];_0x2d994d[_0x69cc('0x6f')]=isNaN(_0x3e3d0b[_0x69cc('0x68')])?null:_0x3e3d0b[_0x69cc('0x68')];_0x2d994d[_0x69cc('0x70')]=isNaN(_0x3e3d0b[_0x69cc('0x6a')])?null:_0x3e3d0b['sampleRate'];});_0xa4de7e['on'](_0x69cc('0x1d'),function(){fs['chmodSync'](_0x780366,parseInt('0777',0x8));return db[_0x69cc('0x42')][_0x69cc('0x71')](_0x2d994d)['then'](function(_0x580aa0){var _0x533eda={'role':_0x3d6a11[_0x69cc('0x72')][_0x69cc('0x73')],'userProfileId':_0x3d6a11[_0x69cc('0x72')][_0x69cc('0x74')]};if(!_0x533eda)throw new Error(_0x69cc('0x75'));if(_0x533eda['role']===_0x69cc('0x76')){var _0x1003e0=_0x580aa0[_0x69cc('0x2a')]({'plain':!![]});return db[_0x69cc('0x77')][_0x69cc('0x4a')]({'where':{'name':_0x69cc('0x78'),'userProfileId':_0x533eda[_0x69cc('0x74')]},'raw':!![]})['then'](function(_0x13fca8){if(_0x13fca8&&_0x13fca8[_0x69cc('0x79')]===0x0){return db[_0x69cc('0x2b')][_0x69cc('0x71')]({'name':_0x1003e0[_0x69cc('0x2d')],'resourceId':_0x1003e0['id'],'type':_0x13fca8[_0x69cc('0x2d')],'sectionId':_0x13fca8['id']},{})['then'](function(){return _0x580aa0;});}else{return _0x580aa0;}})[_0x69cc('0x46')](function(_0x26cc99){logger[_0x69cc('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x26cc99);throw _0x26cc99;});}return _0x580aa0;})[_0x69cc('0x28')](respondWithResult(_0x2be71c,null))['catch'](handleError(_0x2be71c,null));});_0xa4de7e[_0x69cc('0x7a')]();}catch(_0x4e69f4){_0x2be71c['status'](0x1f4)['send'](_0x4e69f4);}};exports[_0x69cc('0x27')]=function(_0x273fa8,_0x29c67b,_0xa57029){return db[_0x69cc('0x42')][_0x69cc('0x4a')]({'where':{'id':_0x273fa8[_0x69cc('0x47')]['id']}})[_0x69cc('0x28')](handleEntityNotFound(_0x29c67b,null))[_0x69cc('0x28')](saveUpdates(_[_0x69cc('0x3e')](_0x273fa8[_0x69cc('0x72')],[_0x69cc('0x2d'),'description']),null))['then'](respondWithResult(_0x29c67b,null))['catch'](handleError(_0x29c67b,null));};exports['delete']=function(_0x29663d,_0x36b132,_0x59a5bb){return db[_0x69cc('0x42')]['find']({'where':{'id':_0x29663d[_0x69cc('0x47')]['id']}})[_0x69cc('0x28')](function(_0x273650){if(_0x273650){return _0x273650[_0x69cc('0x29')]();}})[_0x69cc('0x28')](function(_0x12c238){var _0x5c00cf=path[_0x69cc('0x4d')](config[_0x69cc('0x59')],_0x69cc('0x5a'),util[_0x69cc('0x51')](_0x69cc('0x52'),_0x12c238[_0x69cc('0x4b')],_0x12c238['original_format']));var _0x85df39=path[_0x69cc('0x4d')](config['root'],_0x69cc('0x4e'),util[_0x69cc('0x51')]('%s.%s',_0x12c238[_0x69cc('0x4b')],_0x12c238[_0x69cc('0x4f')]));fs['unlinkSync'](_0x5c00cf);fs[_0x69cc('0x60')](_0x85df39);return _0x12c238;})[_0x69cc('0x28')](function(_0x5c5401){if(_0x5c5401){return _0x36b132['status'](0xcc)['end']();}})['then'](handleEntityNotFound(_0x36b132,null))[_0x69cc('0x46')](handleError(_0x36b132,null));}; \ No newline at end of file +var _0xc936=['sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','Sounds','UserProfileResource','stack','name','send','index','map','Sound','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','fields','find','catch','download','save_name','existsSync','server/files/sounds/converted','converted_format','Sequelize','root','format','%s.%s','create','basename','file','originalname','extname','filename','substring','wav','join','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','error','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','body','role','UserProfileSection','userProfileId','autoAssociation','start','description','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','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'];(function(_0x55b449,_0x399dd4){var _0x33a90b=function(_0x331304){while(--_0x331304){_0x55b449['push'](_0x55b449['shift']());}};_0x33a90b(++_0x399dd4);}(_0xc936,0xdf));var _0x6c93=function(_0xe6caf7,_0x51ced6){_0xe6caf7=_0xe6caf7-0x0;var _0x4759d0=_0xc936[_0xe6caf7];return _0x4759d0;};'use strict';var emlformat=require(_0x6c93('0x0'));var rimraf=require(_0x6c93('0x1'));var zipdir=require(_0x6c93('0x2'));var jsonpatch=require(_0x6c93('0x3'));var rp=require(_0x6c93('0x4'));var moment=require(_0x6c93('0x5'));var BPromise=require(_0x6c93('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6c93('0x7'));var sox=require(_0x6c93('0x8'));var csv=require(_0x6c93('0x9'));var ejs=require(_0x6c93('0xa'));var fs=require('fs');var fs_extra=require(_0x6c93('0xb'));var _=require(_0x6c93('0xc'));var squel=require(_0x6c93('0xd'));var crypto=require(_0x6c93('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6c93('0x9'));var querystring=require('querystring');var Papa=require(_0x6c93('0xf'));var Redis=require(_0x6c93('0x10'));var authService=require(_0x6c93('0x11'));var qs=require(_0x6c93('0x12'));var as=require(_0x6c93('0x13'));var hardwareService=require(_0x6c93('0x14'));var logger=require(_0x6c93('0x15'))(_0x6c93('0x16'));var utils=require(_0x6c93('0x17'));var config=require(_0x6c93('0x18'));var licenseUtil=require(_0x6c93('0x19'));var db=require(_0x6c93('0x1a'))['db'];function respondWithStatusCode(_0x590ced,_0x4fd7d2){_0x4fd7d2=_0x4fd7d2||0xcc;return function(_0x522f20){if(_0x522f20){return _0x590ced[_0x6c93('0x1b')](_0x4fd7d2);}return _0x590ced[_0x6c93('0x1c')](_0x4fd7d2)[_0x6c93('0x1d')]();};}function respondWithResult(_0x4c970a,_0x58d95f){_0x58d95f=_0x58d95f||0xc8;return function(_0x287d3b){if(_0x287d3b){return _0x4c970a[_0x6c93('0x1c')](_0x58d95f)[_0x6c93('0x1e')](_0x287d3b);}};}function respondWithFilteredResult(_0xeffc4b,_0x4c2caf){return function(_0x2bd012){if(_0x2bd012){var _0x3c30b2=typeof _0x4c2caf[_0x6c93('0x1f')]===_0x6c93('0x20')&&typeof _0x4c2caf[_0x6c93('0x21')]===_0x6c93('0x20');var _0x13b526=_0x2bd012[_0x6c93('0x22')];var _0x3e890=_0x3c30b2?0x0:_0x4c2caf[_0x6c93('0x1f')];var _0xd48d38=_0x3c30b2?_0x2bd012[_0x6c93('0x22')]:_0x4c2caf[_0x6c93('0x1f')]+_0x4c2caf['limit'];var _0xbe6d2a;if(_0xd48d38>=_0x13b526){_0xd48d38=_0x13b526;_0xbe6d2a=0xc8;}else{_0xbe6d2a=0xce;}_0xeffc4b[_0x6c93('0x1c')](_0xbe6d2a);return _0xeffc4b[_0x6c93('0x23')]('Content-Range',_0x3e890+'-'+_0xd48d38+'/'+_0x13b526)[_0x6c93('0x1e')](_0x2bd012);}return null;};}function patchUpdates(_0x5673b1){return function(_0x4abc1e){try{jsonpatch[_0x6c93('0x24')](_0x4abc1e,_0x5673b1,!![]);}catch(_0xe59f4a){return BPromise[_0x6c93('0x25')](_0xe59f4a);}return _0x4abc1e[_0x6c93('0x26')]();};}function saveUpdates(_0x53c23a,_0x27b340){return function(_0xb920b6){if(_0xb920b6){return _0xb920b6[_0x6c93('0x27')](_0x53c23a)[_0x6c93('0x28')](function(_0x41de46){return _0x41de46;});}return null;};}function removeEntity(_0x43e24f,_0x4f159a){return function(_0x4264cc){if(_0x4264cc){return _0x4264cc[_0x6c93('0x29')]()[_0x6c93('0x28')](function(){var _0x171d5e=_0x4264cc[_0x6c93('0x2a')]({'plain':!![]});var _0x1acffa=_0x6c93('0x2b');return db[_0x6c93('0x2c')][_0x6c93('0x29')]({'where':{'type':_0x1acffa,'resourceId':_0x171d5e['id']}})['then'](function(){return _0x4264cc;});})['then'](function(){_0x43e24f['status'](0xcc)[_0x6c93('0x1d')]();});}};}function handleEntityNotFound(_0x314d1d,_0x5511be){return function(_0x5be68a){if(!_0x5be68a){_0x314d1d[_0x6c93('0x1b')](0x194);}return _0x5be68a;};}function handleError(_0x405100,_0xa3adb2){_0xa3adb2=_0xa3adb2||0x1f4;return function(_0x1cd365){logger['error'](_0x1cd365[_0x6c93('0x2d')]);if(_0x1cd365[_0x6c93('0x2e')]){delete _0x1cd365[_0x6c93('0x2e')];}_0x405100[_0x6c93('0x1c')](_0xa3adb2)[_0x6c93('0x2f')](_0x1cd365);};}exports[_0x6c93('0x30')]=function(_0x256147,_0x4c41d9){var _0x2e4658={},_0x1435b7={},_0x1918e2={'count':0x0,'rows':[]};var _0x416555=_[_0x6c93('0x31')](db[_0x6c93('0x32')][_0x6c93('0x33')],function(_0x17b91b){return{'name':_0x17b91b[_0x6c93('0x34')],'type':_0x17b91b[_0x6c93('0x35')]['key']};});_0x1435b7[_0x6c93('0x36')]=_[_0x6c93('0x31')](_0x416555,_0x6c93('0x2e'));_0x1435b7[_0x6c93('0x37')]=_[_0x6c93('0x38')](_0x256147[_0x6c93('0x37')]);_0x1435b7[_0x6c93('0x39')]=_[_0x6c93('0x3a')](_0x1435b7[_0x6c93('0x36')],_0x1435b7[_0x6c93('0x37')]);_0x2e4658[_0x6c93('0x3b')]=_[_0x6c93('0x3a')](_0x1435b7[_0x6c93('0x36')],qs['fields'](_0x256147[_0x6c93('0x37')]['fields']));_0x2e4658['attributes']=_0x2e4658['attributes'][_0x6c93('0x3c')]?_0x2e4658[_0x6c93('0x3b')]:_0x1435b7[_0x6c93('0x36')];if(!_0x256147['query'][_0x6c93('0x3d')](_0x6c93('0x3e'))){_0x2e4658[_0x6c93('0x21')]=qs['limit'](_0x256147[_0x6c93('0x37')][_0x6c93('0x21')]);_0x2e4658[_0x6c93('0x1f')]=qs[_0x6c93('0x1f')](_0x256147[_0x6c93('0x37')][_0x6c93('0x1f')]);}_0x2e4658['order']=qs[_0x6c93('0x3f')](_0x256147[_0x6c93('0x37')][_0x6c93('0x3f')]);_0x2e4658[_0x6c93('0x40')]=qs[_0x6c93('0x39')](_[_0x6c93('0x41')](_0x256147['query'],_0x1435b7[_0x6c93('0x39')]),_0x416555);if(_0x256147[_0x6c93('0x37')][_0x6c93('0x42')]){_0x2e4658['where']=_[_0x6c93('0x43')](_0x2e4658['where'],{'$or':_[_0x6c93('0x31')](_0x416555,function(_0x5bae0c){if(_0x5bae0c['type']!==_0x6c93('0x44')){var _0x5f0cf7={};_0x5f0cf7[_0x5bae0c[_0x6c93('0x2e')]]={'$like':'%'+_0x256147[_0x6c93('0x37')]['filter']+'%'};return _0x5f0cf7;}})});}_0x2e4658=_['merge']({},_0x2e4658,_0x256147[_0x6c93('0x45')]);var _0x41ad22={'where':_0x2e4658[_0x6c93('0x40')]};return db[_0x6c93('0x32')]['count'](_0x41ad22)['then'](function(_0x4d70ab){_0x1918e2[_0x6c93('0x22')]=_0x4d70ab;if(_0x256147[_0x6c93('0x37')][_0x6c93('0x46')]){_0x2e4658[_0x6c93('0x47')]=[{'all':!![]}];}return db[_0x6c93('0x32')][_0x6c93('0x48')](_0x2e4658);})['then'](function(_0xc9a333){_0x1918e2[_0x6c93('0x49')]=_0xc9a333;return _0x1918e2;})['then'](respondWithFilteredResult(_0x4c41d9,_0x2e4658))['catch'](handleError(_0x4c41d9,null));};exports[_0x6c93('0x4a')]=function(_0x3ab5fd,_0x54da93){var _0x3bb55b={'raw':!![],'where':{'id':_0x3ab5fd[_0x6c93('0x4b')]['id']}},_0x3bbc10={};_0x3bbc10[_0x6c93('0x36')]=_[_0x6c93('0x38')](db[_0x6c93('0x32')]['rawAttributes']);_0x3bbc10[_0x6c93('0x37')]=_[_0x6c93('0x38')](_0x3ab5fd['query']);_0x3bbc10[_0x6c93('0x39')]=_[_0x6c93('0x3a')](_0x3bbc10[_0x6c93('0x36')],_0x3bbc10[_0x6c93('0x37')]);_0x3bb55b[_0x6c93('0x3b')]=_[_0x6c93('0x3a')](_0x3bbc10['model'],qs[_0x6c93('0x4c')](_0x3ab5fd['query']['fields']));_0x3bb55b[_0x6c93('0x3b')]=_0x3bb55b[_0x6c93('0x3b')][_0x6c93('0x3c')]?_0x3bb55b['attributes']:_0x3bbc10['model'];if(_0x3ab5fd[_0x6c93('0x37')]['includeAll']){_0x3bb55b[_0x6c93('0x47')]=[{'all':!![]}];}_0x3bb55b=_[_0x6c93('0x43')]({},_0x3bb55b,_0x3ab5fd[_0x6c93('0x45')]);return db[_0x6c93('0x32')][_0x6c93('0x4d')](_0x3bb55b)[_0x6c93('0x28')](handleEntityNotFound(_0x54da93,null))['then'](respondWithResult(_0x54da93,null))[_0x6c93('0x4e')](handleError(_0x54da93,null));};exports[_0x6c93('0x4f')]=function(_0x25b139,_0x40658e,_0x2e303b){return db[_0x6c93('0x32')][_0x6c93('0x4d')]({'where':{'id':_0x25b139[_0x6c93('0x4b')]['id']},'attributes':[_0x6c93('0x2e'),_0x6c93('0x50'),'converted_format'],'raw':!![]})[_0x6c93('0x28')](handleEntityNotFound(_0x40658e,null))[_0x6c93('0x28')](function(_0x129d5c){if(_0x129d5c){if(!fs[_0x6c93('0x51')](path['join'](config['root'],_0x6c93('0x52'),_0x129d5c[_0x6c93('0x50')]+'.'+_0x129d5c[_0x6c93('0x53')]))){throw new db[(_0x6c93('0x54'))]['ValidationError']('Sound\x20not\x20found');}return _0x40658e[_0x6c93('0x4f')](path['join'](config[_0x6c93('0x55')],'server/files/sounds/converted',util[_0x6c93('0x56')]('%s.%s',_0x129d5c[_0x6c93('0x50')],_0x129d5c[_0x6c93('0x53')])),util['format'](_0x6c93('0x57'),_0x129d5c[_0x6c93('0x2e')],_0x129d5c[_0x6c93('0x53')]));}return null;})['catch'](handleError(_0x40658e,null));};exports[_0x6c93('0x58')]=function(_0x528b2c,_0x2df399,_0x268c0c){var _0x1508fa={'name':path[_0x6c93('0x59')](_0x528b2c[_0x6c93('0x5a')]['originalname'],path['extname'](_0x528b2c[_0x6c93('0x5a')][_0x6c93('0x5b')])),'save_name':path[_0x6c93('0x59')](_0x528b2c['file']['filename'],path[_0x6c93('0x5c')](_0x528b2c[_0x6c93('0x5a')][_0x6c93('0x5d')])),'original_format':path[_0x6c93('0x5c')](_0x528b2c[_0x6c93('0x5a')][_0x6c93('0x5b')])[_0x6c93('0x5e')](0x1),'converted_format':_0x6c93('0x5f')};var _0x5c14f5=path[_0x6c93('0x60')](config[_0x6c93('0x55')],_0x6c93('0x61'),_0x528b2c[_0x6c93('0x5a')]['filename']);var _0x19d41d=path[_0x6c93('0x60')](config[_0x6c93('0x55')],_0x6c93('0x52'),util['format'](_0x6c93('0x57'),path[_0x6c93('0x59')](_0x528b2c[_0x6c93('0x5a')][_0x6c93('0x5d')],path[_0x6c93('0x5c')](_0x528b2c[_0x6c93('0x5a')][_0x6c93('0x5d')])),_0x1508fa[_0x6c93('0x53')]));logger[_0x6c93('0x62')]('Sound\x20upload\x20filepath:\x20%s',_0x5c14f5);logger[_0x6c93('0x62')](_0x6c93('0x63'),_0x19d41d);try{fs[_0x6c93('0x64')](_0x5c14f5,parseInt(_0x6c93('0x65'),0x8));var _0x5ddbb0=sox[_0x6c93('0x66')](_0x5c14f5,_0x19d41d,{'sampleRate':0x1f40,'format':_0x6c93('0x5f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5ddbb0['on'](_0x6c93('0x67'),function(_0x4d4f51){fs[_0x6c93('0x68')](_0x5c14f5);_0x2df399[_0x6c93('0x1c')](0x1f4)['send'](_0x4d4f51);});_0x5ddbb0['on'](_0x6c93('0x69'),function(_0x18cd1f){_0x1508fa[_0x6c93('0x6a')]=isNaN(_0x18cd1f[_0x6c93('0x6b')])?null:_0x18cd1f[_0x6c93('0x6b')]*0x3e8;_0x1508fa[_0x6c93('0x6c')]=isNaN(_0x18cd1f[_0x6c93('0x6d')])?null:_0x18cd1f[_0x6c93('0x6d')];_0x1508fa[_0x6c93('0x6e')]=isNaN(_0x18cd1f[_0x6c93('0x6f')])?null:_0x18cd1f[_0x6c93('0x6f')];_0x1508fa['original_bitRate']=isNaN(_0x18cd1f['bitRate'])?null:_0x18cd1f[_0x6c93('0x70')];_0x1508fa[_0x6c93('0x71')]=isNaN(_0x18cd1f[_0x6c93('0x72')])?null:_0x18cd1f[_0x6c93('0x72')];});_0x5ddbb0['on']('dest',function(_0x4ab9f6){_0x1508fa[_0x6c93('0x73')]=isNaN(_0x4ab9f6[_0x6c93('0x6b')])?null:_0x4ab9f6[_0x6c93('0x6b')]*0x3e8;_0x1508fa[_0x6c93('0x74')]=isNaN(_0x4ab9f6[_0x6c93('0x6d')])?null:_0x4ab9f6[_0x6c93('0x6d')];_0x1508fa['converted_channelCount']=isNaN(_0x4ab9f6[_0x6c93('0x6f')])?null:_0x4ab9f6[_0x6c93('0x6f')];_0x1508fa['converted_bitRate']=isNaN(_0x4ab9f6[_0x6c93('0x70')])?null:_0x4ab9f6[_0x6c93('0x70')];_0x1508fa['converted_sampleRate']=isNaN(_0x4ab9f6[_0x6c93('0x72')])?null:_0x4ab9f6[_0x6c93('0x72')];});_0x5ddbb0['on'](_0x6c93('0x1d'),function(){fs['chmodSync'](_0x19d41d,parseInt('0777',0x8));return db[_0x6c93('0x32')][_0x6c93('0x58')](_0x1508fa)['then'](function(_0x276af6){var _0x553b84={'role':_0x528b2c[_0x6c93('0x75')][_0x6c93('0x76')],'userProfileId':_0x528b2c[_0x6c93('0x75')]['userProfileId']};if(!_0x553b84)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x553b84[_0x6c93('0x76')]==='user'){var _0x266c32=_0x276af6[_0x6c93('0x2a')]({'plain':!![]});return db[_0x6c93('0x77')][_0x6c93('0x4d')]({'where':{'name':'Sounds','userProfileId':_0x553b84[_0x6c93('0x78')]},'raw':!![]})[_0x6c93('0x28')](function(_0x512d4b){if(_0x512d4b&&_0x512d4b[_0x6c93('0x79')]===0x0){return db['UserProfileResource']['create']({'name':_0x266c32[_0x6c93('0x2e')],'resourceId':_0x266c32['id'],'type':_0x512d4b[_0x6c93('0x2e')],'sectionId':_0x512d4b['id']},{})[_0x6c93('0x28')](function(){return _0x276af6;});}else{return _0x276af6;}})[_0x6c93('0x4e')](function(_0xf09a80){logger[_0x6c93('0x67')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf09a80);throw _0xf09a80;});}return _0x276af6;})[_0x6c93('0x28')](respondWithResult(_0x2df399,null))[_0x6c93('0x4e')](handleError(_0x2df399,null));});_0x5ddbb0[_0x6c93('0x7a')]();}catch(_0x266cc5){_0x2df399[_0x6c93('0x1c')](0x1f4)[_0x6c93('0x2f')](_0x266cc5);}};exports[_0x6c93('0x27')]=function(_0x24969d,_0x50b2a7,_0x956260){return db[_0x6c93('0x32')][_0x6c93('0x4d')]({'where':{'id':_0x24969d[_0x6c93('0x4b')]['id']}})[_0x6c93('0x28')](handleEntityNotFound(_0x50b2a7,null))['then'](saveUpdates(_[_0x6c93('0x41')](_0x24969d[_0x6c93('0x75')],[_0x6c93('0x2e'),_0x6c93('0x7b')]),null))[_0x6c93('0x28')](respondWithResult(_0x50b2a7,null))[_0x6c93('0x4e')](handleError(_0x50b2a7,null));};exports['delete']=function(_0x248d8b,_0xe00286,_0x3d0bba){return db['Sound'][_0x6c93('0x4d')]({'where':{'id':_0x248d8b[_0x6c93('0x4b')]['id']}})[_0x6c93('0x28')](function(_0x280624){if(_0x280624){return _0x280624[_0x6c93('0x29')]();}})[_0x6c93('0x28')](function(_0x3e4a92){var _0x25793f=path['join'](config['root'],'server/files/sounds/original',util[_0x6c93('0x56')]('%s.%s',_0x3e4a92[_0x6c93('0x50')],_0x3e4a92[_0x6c93('0x7c')]));var _0x4a46ce=path[_0x6c93('0x60')](config[_0x6c93('0x55')],'server/files/sounds/converted',util[_0x6c93('0x56')]('%s.%s',_0x3e4a92[_0x6c93('0x50')],_0x3e4a92['converted_format']));fs[_0x6c93('0x68')](_0x25793f);fs[_0x6c93('0x68')](_0x4a46ce);return _0x3e4a92;})['then'](function(_0x892dc9){if(_0x892dc9){return _0xe00286[_0x6c93('0x1c')](0xcc)[_0x6c93('0x1d')]();}})[_0x6c93('0x28')](handleEntityNotFound(_0xe00286,null))['catch'](handleError(_0xe00286,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 8251f8f..df230e5 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 _0xe934=['bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','util','api','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe934,0x8c));var _0x4e93=function(_0x37026d,_0x402bf4){_0x37026d=_0x37026d-0x0;var _0x5b1ff2=_0xe934[_0x37026d];return _0x5b1ff2;};'use strict';var _=require('lodash');var util=require(_0x4e93('0x0'));var logger=require('../../config/logger')(_0x4e93('0x1'));var moment=require(_0x4e93('0x2'));var BPromise=require(_0x4e93('0x3'));var rp=require(_0x4e93('0x4'));var fs=require('fs');var path=require(_0x4e93('0x5'));var rimraf=require(_0x4e93('0x6'));var config=require(_0x4e93('0x7'));var attributes=require(_0x4e93('0x8'));module[_0x4e93('0x9')]=function(_0x379d66,_0x95aa88){return _0x379d66[_0x4e93('0xa')](_0x4e93('0xb'),attributes,{'tableName':_0x4e93('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8933=['./sound.attributes','exports','define','Sound','tools_sounds','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x51d932,_0x15db9f){var _0x55ccfe=function(_0xc08695){while(--_0xc08695){_0x51d932['push'](_0x51d932['shift']());}};_0x55ccfe(++_0x15db9f);}(_0x8933,0x17e));var _0x3893=function(_0x2e6e79,_0x44c753){_0x2e6e79=_0x2e6e79-0x0;var _0x31a825=_0x8933[_0x2e6e79];return _0x31a825;};'use strict';var _=require(_0x3893('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3893('0x1'));var moment=require(_0x3893('0x2'));var BPromise=require(_0x3893('0x3'));var rp=require(_0x3893('0x4'));var fs=require('fs');var path=require(_0x3893('0x5'));var rimraf=require(_0x3893('0x6'));var config=require(_0x3893('0x7'));var attributes=require(_0x3893('0x8'));module[_0x3893('0x9')]=function(_0x5c9e57,_0xdfd578){return _0x5c9e57[_0x3893('0xa')](_0x3893('0xb'),attributes,{'tableName':_0x3893('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index c47fed2..762805a 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 _0x510a=['Sound','find','options','where','attributes','include','model','map','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','stringify','error','code','Sound,\x20%s,\x20%s','message','request\x20sent','result','catch','ShowSound'];(function(_0x16dbfd,_0x2f9431){var _0x382254=function(_0x19dade){while(--_0x19dade){_0x16dbfd['push'](_0x16dbfd['shift']());}};_0x382254(++_0x2f9431);}(_0x510a,0x1c8));var _0xa510=function(_0x3f005c,_0x3ac9ad){_0x3f005c=_0x3f005c-0x0;var _0x57754a=_0x510a[_0x3f005c];return _0x57754a;};'use strict';var _=require(_0xa510('0x0'));var util=require('util');var moment=require(_0xa510('0x1'));var BPromise=require(_0xa510('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa510('0x3'));var db=require(_0xa510('0x4'))['db'];var utils=require(_0xa510('0x5'));var logger=require(_0xa510('0x6'))(_0xa510('0x7'));var config=require(_0xa510('0x8'));var jayson=require(_0xa510('0x9'));var client=jayson['client'][_0xa510('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44402c,_0x138e32,_0x50c5eb){return new BPromise(function(_0x2d8bb0,_0x5ba48d){return client[_0xa510('0xb')](_0x44402c,_0x50c5eb)[_0xa510('0xc')](function(_0x582550){logger[_0xa510('0xd')]('Sound,\x20%s,\x20%s',_0x138e32,'request\x20sent');logger[_0xa510('0xe')]('Sound,\x20%s,\x20%s,\x20%s',_0x138e32,'request\x20sent',JSON[_0xa510('0xf')](_0x582550));if(_0x582550[_0xa510('0x10')]){if(_0x582550[_0xa510('0x10')][_0xa510('0x11')]===0x1f4){logger[_0xa510('0x10')](_0xa510('0x12'),_0x138e32,_0x582550[_0xa510('0x10')][_0xa510('0x13')]);return _0x5ba48d(_0x582550[_0xa510('0x10')]['message']);}logger['error'](_0xa510('0x12'),_0x138e32,_0x582550[_0xa510('0x10')]['message']);return _0x2d8bb0(_0x582550['error'][_0xa510('0x13')]);}else{logger[_0xa510('0xd')](_0xa510('0x12'),_0x138e32,_0xa510('0x14'));_0x2d8bb0(_0x582550[_0xa510('0x15')][_0xa510('0x13')]);}})[_0xa510('0x16')](function(_0x3b2585){logger[_0xa510('0x10')](_0xa510('0x12'),_0x138e32,_0x3b2585);_0x5ba48d(_0x3b2585);});});}exports[_0xa510('0x17')]=function(_0x4218fe){var _0x176187=this;return new Promise(function(_0x2a7b5f,_0x3e352b){return db[_0xa510('0x18')][_0xa510('0x19')]({'raw':_0x4218fe[_0xa510('0x1a')]?_0x4218fe[_0xa510('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4218fe[_0xa510('0x1a')]?_0x4218fe[_0xa510('0x1a')][_0xa510('0x1b')]||null:null,'attributes':_0x4218fe[_0xa510('0x1a')]?_0x4218fe[_0xa510('0x1a')][_0xa510('0x1c')]||null:null,'include':_0x4218fe['options']?_0x4218fe[_0xa510('0x1a')][_0xa510('0x1d')]?_['map'](_0x4218fe['options'][_0xa510('0x1d')],function(_0x5594de){return{'model':db[_0x5594de[_0xa510('0x1e')]],'as':_0x5594de['as'],'attributes':_0x5594de[_0xa510('0x1c')],'include':_0x5594de[_0xa510('0x1d')]?_[_0xa510('0x1f')](_0x5594de[_0xa510('0x1d')],function(_0x5655b8){return{'model':db[_0x5655b8[_0xa510('0x1e')]],'as':_0x5655b8['as'],'attributes':_0x5655b8[_0xa510('0x1c')],'include':_0x5655b8[_0xa510('0x1d')]?_[_0xa510('0x1f')](_0x5655b8[_0xa510('0x1d')],function(_0xd91867){return{'model':db[_0xd91867[_0xa510('0x1e')]],'as':_0xd91867['as'],'attributes':_0xd91867[_0xa510('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa510('0xc')](function(_0x231da0){logger['info'](_0xa510('0x17'),_0x4218fe);logger[_0xa510('0xe')]('ShowSound',_0x4218fe,JSON['stringify'](_0x231da0));_0x2a7b5f(_0x231da0);})[_0xa510('0x16')](function(_0x415025){logger[_0xa510('0x10')]('ShowSound',_0x415025[_0xa510('0x13')],_0x4218fe);_0x3e352b(_0x176187[_0xa510('0x10')](0x1f4,_0x415025[_0xa510('0x13')]));});});}; \ No newline at end of file +var _0x5d66=['message','result','catch','ShowSound','find','options','raw','attributes','include','map','model','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1fe749,_0x55b852){var _0x81df3a=function(_0x4522c1){while(--_0x4522c1){_0x1fe749['push'](_0x1fe749['shift']());}};_0x81df3a(++_0x55b852);}(_0x5d66,0xa1));var _0x65d6=function(_0x2a425a,_0x59cadb){_0x2a425a=_0x2a425a-0x0;var _0x2b7958=_0x5d66[_0x2a425a];return _0x2b7958;};'use strict';var _=require(_0x65d6('0x0'));var util=require(_0x65d6('0x1'));var moment=require(_0x65d6('0x2'));var BPromise=require('bluebird');var rs=require(_0x65d6('0x3'));var fs=require('fs');var Redis=require(_0x65d6('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x65d6('0x5'))(_0x65d6('0x6'));var config=require(_0x65d6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x65d6('0x8')][_0x65d6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1bacc0,_0x2a0ecd,_0x444c2e){return new BPromise(function(_0x34e5c7,_0x11e1cd){return client[_0x65d6('0xa')](_0x1bacc0,_0x444c2e)['then'](function(_0x1f4f3c){logger[_0x65d6('0xb')](_0x65d6('0xc'),_0x2a0ecd,_0x65d6('0xd'));logger[_0x65d6('0xe')](_0x65d6('0xf'),_0x2a0ecd,_0x65d6('0xd'),JSON[_0x65d6('0x10')](_0x1f4f3c));if(_0x1f4f3c[_0x65d6('0x11')]){if(_0x1f4f3c['error'][_0x65d6('0x12')]===0x1f4){logger[_0x65d6('0x11')](_0x65d6('0xc'),_0x2a0ecd,_0x1f4f3c['error'][_0x65d6('0x13')]);return _0x11e1cd(_0x1f4f3c[_0x65d6('0x11')][_0x65d6('0x13')]);}logger[_0x65d6('0x11')](_0x65d6('0xc'),_0x2a0ecd,_0x1f4f3c[_0x65d6('0x11')][_0x65d6('0x13')]);return _0x34e5c7(_0x1f4f3c['error'][_0x65d6('0x13')]);}else{logger[_0x65d6('0xb')](_0x65d6('0xc'),_0x2a0ecd,_0x65d6('0xd'));_0x34e5c7(_0x1f4f3c[_0x65d6('0x14')][_0x65d6('0x13')]);}})[_0x65d6('0x15')](function(_0x58b986){logger[_0x65d6('0x11')](_0x65d6('0xc'),_0x2a0ecd,_0x58b986);_0x11e1cd(_0x58b986);});});}exports[_0x65d6('0x16')]=function(_0x220135){var _0x51809a=this;return new Promise(function(_0x103979,_0x443a4d){return db['Sound'][_0x65d6('0x17')]({'raw':_0x220135[_0x65d6('0x18')]?_0x220135[_0x65d6('0x18')][_0x65d6('0x19')]===undefined?!![]:![]:!![],'where':_0x220135[_0x65d6('0x18')]?_0x220135[_0x65d6('0x18')]['where']||null:null,'attributes':_0x220135[_0x65d6('0x18')]?_0x220135[_0x65d6('0x18')][_0x65d6('0x1a')]||null:null,'include':_0x220135[_0x65d6('0x18')]?_0x220135[_0x65d6('0x18')][_0x65d6('0x1b')]?_[_0x65d6('0x1c')](_0x220135['options'][_0x65d6('0x1b')],function(_0x2c0233){return{'model':db[_0x2c0233[_0x65d6('0x1d')]],'as':_0x2c0233['as'],'attributes':_0x2c0233['attributes'],'include':_0x2c0233['include']?_['map'](_0x2c0233['include'],function(_0x5a4d04){return{'model':db[_0x5a4d04[_0x65d6('0x1d')]],'as':_0x5a4d04['as'],'attributes':_0x5a4d04[_0x65d6('0x1a')],'include':_0x5a4d04[_0x65d6('0x1b')]?_[_0x65d6('0x1c')](_0x5a4d04[_0x65d6('0x1b')],function(_0x562453){return{'model':db[_0x562453[_0x65d6('0x1d')]],'as':_0x562453['as'],'attributes':_0x562453['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2da622){logger[_0x65d6('0xb')](_0x65d6('0x16'),_0x220135);logger[_0x65d6('0xe')]('ShowSound',_0x220135,JSON[_0x65d6('0x10')](_0x2da622));_0x103979(_0x2da622);})['catch'](function(_0x4c5d91){logger[_0x65d6('0x11')](_0x65d6('0x16'),_0x4c5d91[_0x65d6('0x13')],_0x220135);_0x443a4d(_0x51809a[_0x65d6('0x11')](0x1f4,_0x4c5d91['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index c0e7613..3d41871 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 _0x757a=['destroy','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','index','isAuthenticated','show','post','create','/:id','update','delete'];(function(_0x3a2438,_0x28d286){var _0x1e2dc9=function(_0x1a9332){while(--_0x1a9332){_0x3a2438['push'](_0x3a2438['shift']());}};_0x1e2dc9(++_0x28d286);}(_0x757a,0xde));var _0xa757=function(_0x2f75fa,_0x2c56f6){_0x2f75fa=_0x2f75fa-0x0;var _0x36c954=_0x757a[_0x2f75fa];return _0x36c954;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0xb')]('/',auth[_0xa757('0x9')](),controller[_0xa757('0xc')]);router['put'](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0xe')]);router[_0xa757('0xf')](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0x10')]);module['exports']=router; \ No newline at end of file +var _0xda3f=['../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util','path','fs-extra','../../components/interaction/service'];(function(_0x5eb4cc,_0x15af2d){var _0x5e9e44=function(_0x4c8668){while(--_0x4c8668){_0x5eb4cc['push'](_0x5eb4cc['shift']());}};_0x5e9e44(++_0x15af2d);}(_0xda3f,0xec));var _0xfda3=function(_0x3e6934,_0x297153){_0x3e6934=_0x3e6934-0x0;var _0x1438ce=_0xda3f[_0x3e6934];return _0x1438ce;};'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('./squareMessage.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x9')]('/',auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0xb')](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0xd')](_0xfda3('0x7'),auth['isAuthenticated'](),controller[_0xfda3('0xe')]);module[_0xfda3('0xf')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 62a32d7..eb74096 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 _0x119e=['medium','ENUM','out','sequelize','exports','STRING','TEXT'];(function(_0x3cbfad,_0x16e192){var _0x2b1541=function(_0x94b54a){while(--_0x94b54a){_0x3cbfad['push'](_0x3cbfad['shift']());}};_0x2b1541(++_0x16e192);}(_0x119e,0x106));var _0xe119=function(_0x184604,_0x1fc1a5){_0x184604=_0x184604-0x0;var _0x4a022a=_0x119e[_0x184604];return _0x4a022a;};'use strict';var Sequelize=require(_0xe119('0x0'));module[_0xe119('0x1')]={'uniqueid':{'type':Sequelize[_0xe119('0x2')]},'body':{'type':Sequelize[_0xe119('0x3')](_0xe119('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0xe119('0x5')]('in','out'),'defaultValue':_0xe119('0x6'),'allowNull':![]},'providerName':{'type':Sequelize[_0xe119('0x2')]},'providerResponse':{'type':Sequelize[_0xe119('0x3')]}}; \ No newline at end of file +var _0x0360=['ENUM','out','sequelize','exports','STRING','TEXT','medium'];(function(_0xced83,_0x2b0fd5){var _0x5cc77c=function(_0x296584){while(--_0x296584){_0xced83['push'](_0xced83['shift']());}};_0x5cc77c(++_0x2b0fd5);}(_0x0360,0xdb));var _0x0036=function(_0x23790a,_0xde883e){_0x23790a=_0x23790a-0x0;var _0x1e57b9=_0x0360[_0x23790a];return _0x1e57b9;};'use strict';var Sequelize=require(_0x0036('0x0'));module[_0x0036('0x1')]={'uniqueid':{'type':Sequelize[_0x0036('0x2')]},'body':{'type':Sequelize[_0x0036('0x3')](_0x0036('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x0036('0x5')]('in',_0x0036('0x6')),'defaultValue':_0x0036('0x6'),'allowNull':![]},'providerName':{'type':Sequelize[_0x0036('0x2')]},'providerResponse':{'type':Sequelize[_0x0036('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index b2e0454..cdd86d3 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 _0xe924=['mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','apply','reject','save','update','then','destroy','stack','name','send','index','SquareMessage','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','intersection','length','include','merge','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x168f89,_0xefd614){var _0x44d536=function(_0x47689e){while(--_0x47689e){_0x168f89['push'](_0x168f89['shift']());}};_0x44d536(++_0xefd614);}(_0xe924,0x141));var _0x4e92=function(_0x568661,_0x146f1d){_0x568661=_0x568661-0x0;var _0x1b45e0=_0xe924[_0x568661];return _0x1b45e0;};'use strict';var emlformat=require(_0x4e92('0x0'));var rimraf=require(_0x4e92('0x1'));var zipdir=require(_0x4e92('0x2'));var jsonpatch=require(_0x4e92('0x3'));var rp=require(_0x4e92('0x4'));var moment=require(_0x4e92('0x5'));var BPromise=require(_0x4e92('0x6'));var Mustache=require(_0x4e92('0x7'));var util=require(_0x4e92('0x8'));var path=require(_0x4e92('0x9'));var sox=require(_0x4e92('0xa'));var csv=require('to-csv');var ejs=require(_0x4e92('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4e92('0xc'));var squel=require(_0x4e92('0xd'));var crypto=require(_0x4e92('0xe'));var jsforce=require(_0x4e92('0xf'));var deskjs=require(_0x4e92('0x10'));var toCsv=require(_0x4e92('0x11'));var querystring=require(_0x4e92('0x12'));var Papa=require(_0x4e92('0x13'));var Redis=require(_0x4e92('0x14'));var authService=require(_0x4e92('0x15'));var qs=require(_0x4e92('0x16'));var as=require(_0x4e92('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4e92('0x18'))(_0x4e92('0x19'));var utils=require(_0x4e92('0x1a'));var config=require(_0x4e92('0x1b'));var licenseUtil=require(_0x4e92('0x1c'));var db=require(_0x4e92('0x1d'))['db'];function respondWithStatusCode(_0x3c7de5,_0x1b4fd3){_0x1b4fd3=_0x1b4fd3||0xcc;return function(_0x231db7){if(_0x231db7){return _0x3c7de5[_0x4e92('0x1e')](_0x1b4fd3);}return _0x3c7de5[_0x4e92('0x1f')](_0x1b4fd3)[_0x4e92('0x20')]();};}function respondWithResult(_0x394561,_0x38b369){_0x38b369=_0x38b369||0xc8;return function(_0x20a489){if(_0x20a489){return _0x394561[_0x4e92('0x1f')](_0x38b369)[_0x4e92('0x21')](_0x20a489);}};}function respondWithFilteredResult(_0xefc085,_0x42d74f){return function(_0xcbe9ef){if(_0xcbe9ef){var _0x2ee304=typeof _0x42d74f[_0x4e92('0x22')]==='undefined'&&typeof _0x42d74f['limit']===_0x4e92('0x23');var _0x1a8e31=_0xcbe9ef[_0x4e92('0x24')];var _0x3b77a7=_0x2ee304?0x0:_0x42d74f[_0x4e92('0x22')];var _0x5b3700=_0x2ee304?_0xcbe9ef[_0x4e92('0x24')]:_0x42d74f[_0x4e92('0x22')]+_0x42d74f['limit'];var _0x59b910;if(_0x5b3700>=_0x1a8e31){_0x5b3700=_0x1a8e31;_0x59b910=0xc8;}else{_0x59b910=0xce;}_0xefc085[_0x4e92('0x1f')](_0x59b910);return _0xefc085['set']('Content-Range',_0x3b77a7+'-'+_0x5b3700+'/'+_0x1a8e31)[_0x4e92('0x21')](_0xcbe9ef);}return null;};}function patchUpdates(_0x2ac15b){return function(_0x3a565e){try{jsonpatch[_0x4e92('0x25')](_0x3a565e,_0x2ac15b,!![]);}catch(_0x2eafc7){return BPromise[_0x4e92('0x26')](_0x2eafc7);}return _0x3a565e[_0x4e92('0x27')]();};}function saveUpdates(_0x18ff2a,_0x3e905e){return function(_0x400835){if(_0x400835){return _0x400835[_0x4e92('0x28')](_0x18ff2a)[_0x4e92('0x29')](function(_0x3a6410){return _0x3a6410;});}return null;};}function removeEntity(_0xd05434,_0x3e8cdb){return function(_0x33f0ef){if(_0x33f0ef){return _0x33f0ef[_0x4e92('0x2a')]()[_0x4e92('0x29')](function(){_0xd05434[_0x4e92('0x1f')](0xcc)[_0x4e92('0x20')]();});}};}function handleEntityNotFound(_0x223012,_0x294299){return function(_0x26240e){if(!_0x26240e){_0x223012['sendStatus'](0x194);}return _0x26240e;};}function handleError(_0x4b448f,_0x25cf3f){_0x25cf3f=_0x25cf3f||0x1f4;return function(_0x40e9bd){logger['error'](_0x40e9bd[_0x4e92('0x2b')]);if(_0x40e9bd[_0x4e92('0x2c')]){delete _0x40e9bd[_0x4e92('0x2c')];}_0x4b448f[_0x4e92('0x1f')](_0x25cf3f)[_0x4e92('0x2d')](_0x40e9bd);};}exports[_0x4e92('0x2e')]=function(_0x2430ce,_0x508b8e){var _0x58b9ee={},_0x3bccba={},_0x335ad0={'count':0x0,'rows':[]};var _0x26bbc7=_['map'](db[_0x4e92('0x2f')][_0x4e92('0x30')],function(_0x1f6c65){return{'name':_0x1f6c65[_0x4e92('0x31')],'type':_0x1f6c65[_0x4e92('0x32')][_0x4e92('0x33')]};});_0x3bccba['model']=_[_0x4e92('0x34')](_0x26bbc7,_0x4e92('0x2c'));_0x3bccba[_0x4e92('0x35')]=_[_0x4e92('0x36')](_0x2430ce[_0x4e92('0x35')]);_0x3bccba[_0x4e92('0x37')]=_['intersection'](_0x3bccba[_0x4e92('0x38')],_0x3bccba[_0x4e92('0x35')]);_0x58b9ee[_0x4e92('0x39')]=_['intersection'](_0x3bccba[_0x4e92('0x38')],qs[_0x4e92('0x3a')](_0x2430ce[_0x4e92('0x35')][_0x4e92('0x3a')]));_0x58b9ee['attributes']=_0x58b9ee['attributes']['length']?_0x58b9ee[_0x4e92('0x39')]:_0x3bccba[_0x4e92('0x38')];if(!_0x2430ce['query'][_0x4e92('0x3b')](_0x4e92('0x3c'))){_0x58b9ee[_0x4e92('0x3d')]=qs['limit'](_0x2430ce['query'][_0x4e92('0x3d')]);_0x58b9ee['offset']=qs[_0x4e92('0x22')](_0x2430ce[_0x4e92('0x35')][_0x4e92('0x22')]);}_0x58b9ee[_0x4e92('0x3e')]=qs[_0x4e92('0x3f')](_0x2430ce[_0x4e92('0x35')][_0x4e92('0x3f')]);_0x58b9ee[_0x4e92('0x40')]=qs[_0x4e92('0x37')](_[_0x4e92('0x41')](_0x2430ce[_0x4e92('0x35')],_0x3bccba[_0x4e92('0x37')]),_0x26bbc7);if(_0x2430ce[_0x4e92('0x35')][_0x4e92('0x42')]){_0x58b9ee[_0x4e92('0x40')]=_['merge'](_0x58b9ee['where'],{'$or':_['map'](_0x26bbc7,function(_0x18e1a0){if(_0x18e1a0['type']!==_0x4e92('0x43')){var _0x3f60dc={};_0x3f60dc[_0x18e1a0[_0x4e92('0x2c')]]={'$like':'%'+_0x2430ce[_0x4e92('0x35')][_0x4e92('0x42')]+'%'};return _0x3f60dc;}})});}_0x58b9ee=_['merge']({},_0x58b9ee,_0x2430ce[_0x4e92('0x44')]);var _0x52d653={'where':_0x58b9ee[_0x4e92('0x40')]};return db[_0x4e92('0x2f')][_0x4e92('0x24')](_0x52d653)[_0x4e92('0x29')](function(_0x495808){_0x335ad0[_0x4e92('0x24')]=_0x495808;if(_0x2430ce[_0x4e92('0x35')][_0x4e92('0x45')]){_0x58b9ee['include']=[{'all':!![]}];}return db[_0x4e92('0x2f')][_0x4e92('0x46')](_0x58b9ee);})[_0x4e92('0x29')](function(_0xa44239){_0x335ad0[_0x4e92('0x47')]=_0xa44239;return _0x335ad0;})[_0x4e92('0x29')](respondWithFilteredResult(_0x508b8e,_0x58b9ee))[_0x4e92('0x48')](handleError(_0x508b8e,null));};exports[_0x4e92('0x49')]=function(_0x49abc2,_0x3a96eb){var _0x553b5e={'raw':!![],'where':{'id':_0x49abc2[_0x4e92('0x4a')]['id']}},_0x3b50da={};_0x3b50da[_0x4e92('0x38')]=_[_0x4e92('0x36')](db[_0x4e92('0x2f')][_0x4e92('0x30')]);_0x3b50da['query']=_['keys'](_0x49abc2['query']);_0x3b50da[_0x4e92('0x37')]=_['intersection'](_0x3b50da[_0x4e92('0x38')],_0x3b50da['query']);_0x553b5e['attributes']=_[_0x4e92('0x4b')](_0x3b50da['model'],qs[_0x4e92('0x3a')](_0x49abc2[_0x4e92('0x35')]['fields']));_0x553b5e[_0x4e92('0x39')]=_0x553b5e['attributes'][_0x4e92('0x4c')]?_0x553b5e[_0x4e92('0x39')]:_0x3b50da[_0x4e92('0x38')];if(_0x49abc2[_0x4e92('0x35')][_0x4e92('0x45')]){_0x553b5e[_0x4e92('0x4d')]=[{'all':!![]}];}_0x553b5e=_[_0x4e92('0x4e')]({},_0x553b5e,_0x49abc2[_0x4e92('0x44')]);return db[_0x4e92('0x2f')]['find'](_0x553b5e)[_0x4e92('0x29')](handleEntityNotFound(_0x3a96eb,null))[_0x4e92('0x29')](respondWithResult(_0x3a96eb,null))[_0x4e92('0x48')](handleError(_0x3a96eb,null));};exports['create']=function(_0x207747,_0x4a64a2){return db[_0x4e92('0x2f')][_0x4e92('0x4f')](_0x207747[_0x4e92('0x50')],{})[_0x4e92('0x29')](respondWithResult(_0x4a64a2,0xc9))[_0x4e92('0x48')](handleError(_0x4a64a2,null));};exports[_0x4e92('0x28')]=function(_0x42ebe2,_0xcf73eb){if(_0x42ebe2[_0x4e92('0x50')]['id']){delete _0x42ebe2[_0x4e92('0x50')]['id'];}return db[_0x4e92('0x2f')]['find']({'where':{'id':_0x42ebe2[_0x4e92('0x4a')]['id']}})['then'](handleEntityNotFound(_0xcf73eb,null))[_0x4e92('0x29')](saveUpdates(_0x42ebe2[_0x4e92('0x50')],null))['then'](respondWithResult(_0xcf73eb,null))[_0x4e92('0x48')](handleError(_0xcf73eb,null));};exports[_0x4e92('0x2a')]=function(_0x45d6be,_0x4f019c){return db[_0x4e92('0x2f')][_0x4e92('0x51')]({'where':{'id':_0x45d6be[_0x4e92('0x4a')]['id']}})[_0x4e92('0x29')](handleEntityNotFound(_0x4f019c,null))[_0x4e92('0x29')](removeEntity(_0x4f019c,null))[_0x4e92('0x48')](handleError(_0x4f019c,null));}; \ No newline at end of file +var _0xdb9a=['../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','end','error','name','send','index','map','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','SquareMessage','includeAll','include','rows','show','params','rawAttributes','options','find','catch','create','body','eml-format','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdb9a,0xce));var _0xadb9=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xdb9a[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0xadb9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xadb9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xadb9('0x2'));var moment=require(_0xadb9('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xadb9('0x4'));var path=require(_0xadb9('0x5'));var sox=require(_0xadb9('0x6'));var csv=require(_0xadb9('0x7'));var ejs=require(_0xadb9('0x8'));var fs=require('fs');var fs_extra=require(_0xadb9('0x9'));var _=require(_0xadb9('0xa'));var squel=require(_0xadb9('0xb'));var crypto=require('crypto');var jsforce=require(_0xadb9('0xc'));var deskjs=require(_0xadb9('0xd'));var toCsv=require(_0xadb9('0x7'));var querystring=require(_0xadb9('0xe'));var Papa=require(_0xadb9('0xf'));var Redis=require('ioredis');var authService=require(_0xadb9('0x10'));var qs=require(_0xadb9('0x11'));var as=require(_0xadb9('0x12'));var hardwareService=require(_0xadb9('0x13'));var logger=require(_0xadb9('0x14'))(_0xadb9('0x15'));var utils=require(_0xadb9('0x16'));var config=require(_0xadb9('0x17'));var licenseUtil=require(_0xadb9('0x18'));var db=require(_0xadb9('0x19'))['db'];function respondWithStatusCode(_0x569fe0,_0x11a7d3){_0x11a7d3=_0x11a7d3||0xcc;return function(_0x566d06){if(_0x566d06){return _0x569fe0[_0xadb9('0x1a')](_0x11a7d3);}return _0x569fe0[_0xadb9('0x1b')](_0x11a7d3)['end']();};}function respondWithResult(_0x3cce1d,_0x9e6483){_0x9e6483=_0x9e6483||0xc8;return function(_0x317e47){if(_0x317e47){return _0x3cce1d['status'](_0x9e6483)[_0xadb9('0x1c')](_0x317e47);}};}function respondWithFilteredResult(_0x5021d3,_0x4d6025){return function(_0x3e784e){if(_0x3e784e){var _0xf9b577=typeof _0x4d6025[_0xadb9('0x1d')]===_0xadb9('0x1e')&&typeof _0x4d6025[_0xadb9('0x1f')]===_0xadb9('0x1e');var _0x580e52=_0x3e784e[_0xadb9('0x20')];var _0x247227=_0xf9b577?0x0:_0x4d6025[_0xadb9('0x1d')];var _0x5c523f=_0xf9b577?_0x3e784e[_0xadb9('0x20')]:_0x4d6025[_0xadb9('0x1d')]+_0x4d6025[_0xadb9('0x1f')];var _0x4330bb;if(_0x5c523f>=_0x580e52){_0x5c523f=_0x580e52;_0x4330bb=0xc8;}else{_0x4330bb=0xce;}_0x5021d3[_0xadb9('0x1b')](_0x4330bb);return _0x5021d3[_0xadb9('0x21')](_0xadb9('0x22'),_0x247227+'-'+_0x5c523f+'/'+_0x580e52)[_0xadb9('0x1c')](_0x3e784e);}return null;};}function patchUpdates(_0x1fddac){return function(_0x11e8c0){try{jsonpatch[_0xadb9('0x23')](_0x11e8c0,_0x1fddac,!![]);}catch(_0x3119ed){return BPromise['reject'](_0x3119ed);}return _0x11e8c0[_0xadb9('0x24')]();};}function saveUpdates(_0x5d2e27,_0x16496a){return function(_0x5ec7cc){if(_0x5ec7cc){return _0x5ec7cc[_0xadb9('0x25')](_0x5d2e27)[_0xadb9('0x26')](function(_0x566c8c){return _0x566c8c;});}return null;};}function removeEntity(_0x4f5be9,_0x43d689){return function(_0x3b5d2c){if(_0x3b5d2c){return _0x3b5d2c[_0xadb9('0x27')]()[_0xadb9('0x26')](function(){_0x4f5be9['status'](0xcc)[_0xadb9('0x28')]();});}};}function handleEntityNotFound(_0x413756,_0x1f61bb){return function(_0x5ac6e3){if(!_0x5ac6e3){_0x413756[_0xadb9('0x1a')](0x194);}return _0x5ac6e3;};}function handleError(_0x5be912,_0x16cfc9){_0x16cfc9=_0x16cfc9||0x1f4;return function(_0xfbd858){logger[_0xadb9('0x29')](_0xfbd858['stack']);if(_0xfbd858[_0xadb9('0x2a')]){delete _0xfbd858[_0xadb9('0x2a')];}_0x5be912[_0xadb9('0x1b')](_0x16cfc9)[_0xadb9('0x2b')](_0xfbd858);};}exports[_0xadb9('0x2c')]=function(_0x3ae164,_0x4d161b){var _0x1a05ac={},_0x483146={},_0x4c8def={'count':0x0,'rows':[]};var _0x38b67c=_[_0xadb9('0x2d')](db['SquareMessage']['rawAttributes'],function(_0x3880f4){return{'name':_0x3880f4[_0xadb9('0x2e')],'type':_0x3880f4[_0xadb9('0x2f')][_0xadb9('0x30')]};});_0x483146[_0xadb9('0x31')]=_[_0xadb9('0x2d')](_0x38b67c,_0xadb9('0x2a'));_0x483146['query']=_[_0xadb9('0x32')](_0x3ae164['query']);_0x483146[_0xadb9('0x33')]=_[_0xadb9('0x34')](_0x483146[_0xadb9('0x31')],_0x483146[_0xadb9('0x35')]);_0x1a05ac[_0xadb9('0x36')]=_['intersection'](_0x483146['model'],qs[_0xadb9('0x37')](_0x3ae164[_0xadb9('0x35')][_0xadb9('0x37')]));_0x1a05ac[_0xadb9('0x36')]=_0x1a05ac['attributes'][_0xadb9('0x38')]?_0x1a05ac[_0xadb9('0x36')]:_0x483146['model'];if(!_0x3ae164[_0xadb9('0x35')]['hasOwnProperty'](_0xadb9('0x39'))){_0x1a05ac[_0xadb9('0x1f')]=qs[_0xadb9('0x1f')](_0x3ae164[_0xadb9('0x35')][_0xadb9('0x1f')]);_0x1a05ac['offset']=qs[_0xadb9('0x1d')](_0x3ae164[_0xadb9('0x35')]['offset']);}_0x1a05ac[_0xadb9('0x3a')]=qs[_0xadb9('0x3b')](_0x3ae164[_0xadb9('0x35')][_0xadb9('0x3b')]);_0x1a05ac['where']=qs['filters'](_[_0xadb9('0x3c')](_0x3ae164[_0xadb9('0x35')],_0x483146[_0xadb9('0x33')]),_0x38b67c);if(_0x3ae164[_0xadb9('0x35')][_0xadb9('0x3d')]){_0x1a05ac[_0xadb9('0x3e')]=_[_0xadb9('0x3f')](_0x1a05ac[_0xadb9('0x3e')],{'$or':_[_0xadb9('0x2d')](_0x38b67c,function(_0x48139e){if(_0x48139e[_0xadb9('0x2f')]!==_0xadb9('0x40')){var _0x153302={};_0x153302[_0x48139e['name']]={'$like':'%'+_0x3ae164[_0xadb9('0x35')][_0xadb9('0x3d')]+'%'};return _0x153302;}})});}_0x1a05ac=_[_0xadb9('0x3f')]({},_0x1a05ac,_0x3ae164['options']);var _0x6d2852={'where':_0x1a05ac['where']};return db[_0xadb9('0x41')][_0xadb9('0x20')](_0x6d2852)['then'](function(_0x1fdfc0){_0x4c8def[_0xadb9('0x20')]=_0x1fdfc0;if(_0x3ae164['query'][_0xadb9('0x42')]){_0x1a05ac[_0xadb9('0x43')]=[{'all':!![]}];}return db['SquareMessage']['findAll'](_0x1a05ac);})[_0xadb9('0x26')](function(_0x4dc10d){_0x4c8def[_0xadb9('0x44')]=_0x4dc10d;return _0x4c8def;})[_0xadb9('0x26')](respondWithFilteredResult(_0x4d161b,_0x1a05ac))['catch'](handleError(_0x4d161b,null));};exports[_0xadb9('0x45')]=function(_0x6d93f8,_0x1c63f1){var _0x1f1882={'raw':!![],'where':{'id':_0x6d93f8[_0xadb9('0x46')]['id']}},_0x113b47={};_0x113b47['model']=_[_0xadb9('0x32')](db[_0xadb9('0x41')][_0xadb9('0x47')]);_0x113b47[_0xadb9('0x35')]=_[_0xadb9('0x32')](_0x6d93f8[_0xadb9('0x35')]);_0x113b47[_0xadb9('0x33')]=_[_0xadb9('0x34')](_0x113b47[_0xadb9('0x31')],_0x113b47[_0xadb9('0x35')]);_0x1f1882[_0xadb9('0x36')]=_[_0xadb9('0x34')](_0x113b47[_0xadb9('0x31')],qs[_0xadb9('0x37')](_0x6d93f8[_0xadb9('0x35')][_0xadb9('0x37')]));_0x1f1882[_0xadb9('0x36')]=_0x1f1882[_0xadb9('0x36')][_0xadb9('0x38')]?_0x1f1882[_0xadb9('0x36')]:_0x113b47[_0xadb9('0x31')];if(_0x6d93f8['query'][_0xadb9('0x42')]){_0x1f1882[_0xadb9('0x43')]=[{'all':!![]}];}_0x1f1882=_[_0xadb9('0x3f')]({},_0x1f1882,_0x6d93f8[_0xadb9('0x48')]);return db[_0xadb9('0x41')][_0xadb9('0x49')](_0x1f1882)[_0xadb9('0x26')](handleEntityNotFound(_0x1c63f1,null))[_0xadb9('0x26')](respondWithResult(_0x1c63f1,null))[_0xadb9('0x4a')](handleError(_0x1c63f1,null));};exports[_0xadb9('0x4b')]=function(_0xc661e0,_0x2c7e8e){return db[_0xadb9('0x41')][_0xadb9('0x4b')](_0xc661e0[_0xadb9('0x4c')],{})[_0xadb9('0x26')](respondWithResult(_0x2c7e8e,0xc9))[_0xadb9('0x4a')](handleError(_0x2c7e8e,null));};exports[_0xadb9('0x25')]=function(_0x8548b6,_0xbf9ce7){if(_0x8548b6['body']['id']){delete _0x8548b6[_0xadb9('0x4c')]['id'];}return db[_0xadb9('0x41')][_0xadb9('0x49')]({'where':{'id':_0x8548b6[_0xadb9('0x46')]['id']}})[_0xadb9('0x26')](handleEntityNotFound(_0xbf9ce7,null))[_0xadb9('0x26')](saveUpdates(_0x8548b6[_0xadb9('0x4c')],null))[_0xadb9('0x26')](respondWithResult(_0xbf9ce7,null))[_0xadb9('0x4a')](handleError(_0xbf9ce7,null));};exports[_0xadb9('0x27')]=function(_0x1fc4e1,_0x17b2e3){return db[_0xadb9('0x41')][_0xadb9('0x49')]({'where':{'id':_0x1fc4e1['params']['id']}})[_0xadb9('0x26')](handleEntityNotFound(_0x17b2e3,null))[_0xadb9('0x26')](removeEntity(_0x17b2e3,null))[_0xadb9('0x4a')](handleError(_0x17b2e3,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index b5b66e3..6a2e2d5 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 _0x2f18=['rimraf','./squareMessage.attributes','exports','define','square_messages','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x810e4d,_0x909ef4){var _0x13f01c=function(_0x12fd89){while(--_0x12fd89){_0x810e4d['push'](_0x810e4d['shift']());}};_0x13f01c(++_0x909ef4);}(_0x2f18,0xd1));var _0x82f1=function(_0x7dee2e,_0x3ce93b){_0x7dee2e=_0x7dee2e-0x0;var _0x344a84=_0x2f18[_0x7dee2e];return _0x344a84;};'use strict';var _=require(_0x82f1('0x0'));var util=require(_0x82f1('0x1'));var logger=require(_0x82f1('0x2'))(_0x82f1('0x3'));var moment=require(_0x82f1('0x4'));var BPromise=require(_0x82f1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x82f1('0x6'));var rimraf=require(_0x82f1('0x7'));var config=require('../../config/environment');var attributes=require(_0x82f1('0x8'));module[_0x82f1('0x9')]=function(_0x18e5ed,_0x207c88){return _0x18e5ed[_0x82f1('0xa')]('SquareMessage',attributes,{'tableName':_0x82f1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd0ca=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','SquareMessage','square_messages','lodash','util','../../config/logger'];(function(_0x3fbc36,_0x2cd3bc){var _0x2907c5=function(_0x27a380){while(--_0x27a380){_0x3fbc36['push'](_0x3fbc36['shift']());}};_0x2907c5(++_0x2cd3bc);}(_0xd0ca,0x177));var _0xad0c=function(_0x29dbae,_0x3e1a1a){_0x29dbae=_0x29dbae-0x0;var _0x502aaa=_0xd0ca[_0x29dbae];return _0x502aaa;};'use strict';var _=require(_0xad0c('0x0'));var util=require(_0xad0c('0x1'));var logger=require(_0xad0c('0x2'))(_0xad0c('0x3'));var moment=require(_0xad0c('0x4'));var BPromise=require(_0xad0c('0x5'));var rp=require(_0xad0c('0x6'));var fs=require('fs');var path=require(_0xad0c('0x7'));var rimraf=require(_0xad0c('0x8'));var config=require(_0xad0c('0x9'));var attributes=require(_0xad0c('0xa'));module[_0xad0c('0xb')]=function(_0x48ef62,_0x4e9011){return _0x48ef62['define'](_0xad0c('0xc'),attributes,{'tableName':_0xad0c('0xd'),'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 1e8fc76..472f990 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 _0x6e37=['CreateSquareMessage','debug','lodash','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','body','options','raw'];(function(_0x4b3e49,_0x9e566c){var _0x57e339=function(_0x1430e9){while(--_0x1430e9){_0x4b3e49['push'](_0x4b3e49['shift']());}};_0x57e339(++_0x9e566c);}(_0x6e37,0x18e));var _0x76e3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6e37[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x76e3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x76e3('0x1'));var rs=require(_0x76e3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x76e3('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x76e3('0x4'));var config=require('../../config/environment');var jayson=require(_0x76e3('0x5'));var client=jayson['client'][_0x76e3('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1560b8,_0x4e6f5c,_0x2f6918){return new BPromise(function(_0xbbced8,_0x16cd9e){return client[_0x76e3('0x7')](_0x1560b8,_0x2f6918)[_0x76e3('0x8')](function(_0x3296bb){logger[_0x76e3('0x9')](_0x76e3('0xa'),_0x4e6f5c,_0x76e3('0xb'));logger['debug'](_0x76e3('0xc'),_0x4e6f5c,_0x76e3('0xb'),JSON[_0x76e3('0xd')](_0x3296bb));if(_0x3296bb[_0x76e3('0xe')]){if(_0x3296bb[_0x76e3('0xe')]['code']===0x1f4){logger[_0x76e3('0xe')](_0x76e3('0xa'),_0x4e6f5c,_0x3296bb[_0x76e3('0xe')][_0x76e3('0xf')]);return _0x16cd9e(_0x3296bb[_0x76e3('0xe')][_0x76e3('0xf')]);}logger[_0x76e3('0xe')](_0x76e3('0xa'),_0x4e6f5c,_0x3296bb['error'][_0x76e3('0xf')]);return _0xbbced8(_0x3296bb[_0x76e3('0xe')][_0x76e3('0xf')]);}else{logger['info']('SquareMessage,\x20%s,\x20%s',_0x4e6f5c,_0x76e3('0xb'));_0xbbced8(_0x3296bb[_0x76e3('0x10')][_0x76e3('0xf')]);}})['catch'](function(_0x11017d){logger[_0x76e3('0xe')](_0x76e3('0xa'),_0x4e6f5c,_0x11017d);_0x16cd9e(_0x11017d);});});}exports['CreateSquareMessage']=function(_0x23f3ff){var _0x25ef2a=this;return new Promise(function(_0x51512f,_0x3b1943){return db['SquareMessage']['create'](_0x23f3ff[_0x76e3('0x11')],{'raw':_0x23f3ff[_0x76e3('0x12')]?_0x23f3ff[_0x76e3('0x12')][_0x76e3('0x13')]===undefined?!![]:![]:!![]})[_0x76e3('0x8')](function(_0x95dfeb){logger[_0x76e3('0x9')](_0x76e3('0x14'),_0x23f3ff);logger[_0x76e3('0x15')](_0x76e3('0x14'),_0x23f3ff,JSON[_0x76e3('0xd')](_0x95dfeb));_0x51512f(_0x95dfeb);})['catch'](function(_0xbb81d7){logger['error'](_0x76e3('0x14'),_0xbb81d7[_0x76e3('0xf')],_0x23f3ff);_0x3b1943(_0x25ef2a[_0x76e3('0xe')](0x1f4,_0xbb81d7['message']));});});}; \ No newline at end of file +var _0x9593=['SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','SquareMessage,\x20%s,\x20%s','message','info','result','catch','CreateSquareMessage','SquareMessage','body','raw','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','request\x20sent','debug'];(function(_0x7896ff,_0x276975){var _0x3683d9=function(_0x51a255){while(--_0x51a255){_0x7896ff['push'](_0x7896ff['shift']());}};_0x3683d9(++_0x276975);}(_0x9593,0xcc));var _0x3959=function(_0x40b2ed,_0x2b1765){_0x40b2ed=_0x40b2ed-0x0;var _0x18397d=_0x9593[_0x40b2ed];return _0x18397d;};'use strict';var _=require('lodash');var util=require(_0x3959('0x0'));var moment=require('moment');var BPromise=require(_0x3959('0x1'));var rs=require(_0x3959('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3959('0x3'))['db'];var utils=require(_0x3959('0x4'));var logger=require('../../config/logger')(_0x3959('0x5'));var config=require('../../config/environment');var jayson=require(_0x3959('0x6'));var client=jayson[_0x3959('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17952f,_0x4307b5,_0x345df1){return new BPromise(function(_0x5c782b,_0x44fda4){return client[_0x3959('0x8')](_0x17952f,_0x345df1)[_0x3959('0x9')](function(_0x5bd88a){logger['info']('SquareMessage,\x20%s,\x20%s',_0x4307b5,_0x3959('0xa'));logger[_0x3959('0xb')](_0x3959('0xc'),_0x4307b5,_0x3959('0xa'),JSON[_0x3959('0xd')](_0x5bd88a));if(_0x5bd88a[_0x3959('0xe')]){if(_0x5bd88a[_0x3959('0xe')]['code']===0x1f4){logger['error'](_0x3959('0xf'),_0x4307b5,_0x5bd88a[_0x3959('0xe')][_0x3959('0x10')]);return _0x44fda4(_0x5bd88a[_0x3959('0xe')]['message']);}logger[_0x3959('0xe')](_0x3959('0xf'),_0x4307b5,_0x5bd88a[_0x3959('0xe')][_0x3959('0x10')]);return _0x5c782b(_0x5bd88a[_0x3959('0xe')]['message']);}else{logger[_0x3959('0x11')](_0x3959('0xf'),_0x4307b5,_0x3959('0xa'));_0x5c782b(_0x5bd88a[_0x3959('0x12')][_0x3959('0x10')]);}})[_0x3959('0x13')](function(_0x5911db){logger[_0x3959('0xe')](_0x3959('0xf'),_0x4307b5,_0x5911db);_0x44fda4(_0x5911db);});});}exports[_0x3959('0x14')]=function(_0x1ddffa){var _0x26afb1=this;return new Promise(function(_0x5c6999,_0x298762){return db[_0x3959('0x15')]['create'](_0x1ddffa[_0x3959('0x16')],{'raw':_0x1ddffa['options']?_0x1ddffa['options'][_0x3959('0x17')]===undefined?!![]:![]:!![]})[_0x3959('0x9')](function(_0x575afa){logger[_0x3959('0x11')]('CreateSquareMessage',_0x1ddffa);logger[_0x3959('0xb')](_0x3959('0x14'),_0x1ddffa,JSON['stringify'](_0x575afa));_0x5c6999(_0x575afa);})['catch'](function(_0x409df5){logger[_0x3959('0xe')](_0x3959('0x14'),_0x409df5[_0x3959('0x10')],_0x1ddffa);_0x298762(_0x26afb1[_0x3959('0xe')](0x1f4,_0x409df5[_0x3959('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 529d4d6..4ffeb5a 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 _0x715a=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','isAuthenticated','index','get','/:id','show','test','post','create','put','update','delete'];(function(_0x29cdfa,_0x570a32){var _0x35e441=function(_0x331d77){while(--_0x331d77){_0x29cdfa['push'](_0x29cdfa['shift']());}};_0x35e441(++_0x570a32);}(_0x715a,0xe8));var _0xa715=function(_0x28a925,_0x30ec2c){_0x28a925=_0x28a925-0x0;var _0x1f6e59=_0x715a[_0x28a925];return _0x1f6e59;};'use strict';var multer=require(_0xa715('0x0'));var util=require(_0xa715('0x1'));var path=require(_0xa715('0x2'));var timeout=require(_0xa715('0x3'));var express=require('express');var router=express[_0xa715('0x4')]();var fs_extra=require(_0xa715('0x5'));var auth=require(_0xa715('0x6'));var interaction=require(_0xa715('0x7'));var config=require(_0xa715('0x8'));var controller=require(_0xa715('0x9'));router['get']('/',auth[_0xa715('0xa')](),controller[_0xa715('0xb')]);router[_0xa715('0xc')](_0xa715('0xd'),auth[_0xa715('0xa')](),controller[_0xa715('0xe')]);router[_0xa715('0xc')]('/:id/test',auth[_0xa715('0xa')](),timeout('15s'),controller[_0xa715('0xf')]);router[_0xa715('0x10')]('/',auth[_0xa715('0xa')](),controller[_0xa715('0x11')]);router[_0xa715('0x12')]('/:id',auth[_0xa715('0xa')](),controller[_0xa715('0x13')]);router[_0xa715('0x14')](_0xa715('0xd'),auth[_0xa715('0xa')](),controller[_0xa715('0x15')]);module[_0xa715('0x16')]=router; \ No newline at end of file +var _0xe34a=['get','index','/:id','isAuthenticated','show','15s','post','create','update','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2869f8,_0x9756fb){var _0x2a9fe6=function(_0x18c01a){while(--_0x18c01a){_0x2869f8['push'](_0x2869f8['shift']());}};_0x2a9fe6(++_0x9756fb);}(_0xe34a,0x88));var _0xae34=function(_0x102ff9,_0x907658){_0x102ff9=_0x102ff9-0x0;var _0x24fa97=_0xe34a[_0x102ff9];return _0x24fa97;};'use strict';var multer=require(_0xae34('0x0'));var util=require(_0xae34('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xae34('0x2'));var router=express[_0xae34('0x3')]();var fs_extra=require(_0xae34('0x4'));var auth=require(_0xae34('0x5'));var interaction=require(_0xae34('0x6'));var config=require(_0xae34('0x7'));var controller=require('./squareOdbc.controller');router[_0xae34('0x8')]('/',auth['isAuthenticated'](),controller[_0xae34('0x9')]);router['get'](_0xae34('0xa'),auth[_0xae34('0xb')](),controller[_0xae34('0xc')]);router[_0xae34('0x8')]('/:id/test',auth[_0xae34('0xb')](),timeout(_0xae34('0xd')),controller['test']);router[_0xae34('0xe')]('/',auth[_0xae34('0xb')](),controller[_0xae34('0xf')]);router['put'](_0xae34('0xa'),auth['isAuthenticated'](),controller[_0xae34('0x10')]);router['delete'](_0xae34('0xa'),auth[_0xae34('0xb')](),controller['destroy']);module[_0xae34('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 0190b56..8a4dacc 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 _0x02ef=['STRING','name','exports'];(function(_0x4ea7d7,_0x29d3ab){var _0x1b4990=function(_0xa40fd9){while(--_0xa40fd9){_0x4ea7d7['push'](_0x4ea7d7['shift']());}};_0x1b4990(++_0x29d3ab);}(_0x02ef,0x12b));var _0xf02e=function(_0x1081a3,_0x2ac784){_0x1081a3=_0x1081a3-0x0;var _0x5696a2=_0x02ef[_0x1081a3];return _0x5696a2;};'use strict';var Sequelize=require('sequelize');module[_0xf02e('0x0')]={'name':{'type':Sequelize[_0xf02e('0x1')],'unique':_0xf02e('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0xf02e('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4e78=['name','exports','STRING'];(function(_0x27e792,_0x5b9697){var _0x174071=function(_0x1b9509){while(--_0x1b9509){_0x27e792['push'](_0x27e792['shift']());}};_0x174071(++_0x5b9697);}(_0x4e78,0xca));var _0x84e7=function(_0xef4ef0,_0x3c72f9){_0xef4ef0=_0xef4ef0-0x0;var _0x39b60b=_0x4e78[_0xef4ef0];return _0x39b60b;};'use strict';var Sequelize=require('sequelize');module[_0x84e7('0x0')]={'name':{'type':Sequelize[_0x84e7('0x1')],'unique':_0x84e7('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x84e7('0x1')]},'description':{'type':Sequelize[_0x84e7('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 5864e7a..2491652 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 _0x0f9f=['pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','ODBC','UserProfileResource','error','stack','name','status','send','index','map','SquareOdbc','rawAttributes','fieldName','type','model','query','attributes','fields','length','nolimit','sort','where','filters'];(function(_0x5e21ab,_0x244485){var _0xdf1c04=function(_0x274d2){while(--_0x274d2){_0x5e21ab['push'](_0x5e21ab['shift']());}};_0xdf1c04(++_0x244485);}(_0x0f9f,0xd9));var _0xf0f9=function(_0xbb46b8,_0x22eaa8){_0xbb46b8=_0xbb46b8-0x0;var _0x5e3b6a=_0x0f9f[_0xbb46b8];return _0x5e3b6a;};'use strict';var emlformat=require(_0xf0f9('0x0'));var rimraf=require(_0xf0f9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf0f9('0x2'));var rp=require(_0xf0f9('0x3'));var moment=require(_0xf0f9('0x4'));var BPromise=require(_0xf0f9('0x5'));var Mustache=require(_0xf0f9('0x6'));var util=require(_0xf0f9('0x7'));var path=require(_0xf0f9('0x8'));var sox=require(_0xf0f9('0x9'));var csv=require(_0xf0f9('0xa'));var ejs=require(_0xf0f9('0xb'));var fs=require('fs');var fs_extra=require(_0xf0f9('0xc'));var _=require(_0xf0f9('0xd'));var squel=require(_0xf0f9('0xe'));var crypto=require('crypto');var jsforce=require(_0xf0f9('0xf'));var deskjs=require(_0xf0f9('0x10'));var toCsv=require(_0xf0f9('0xa'));var querystring=require('querystring');var Papa=require(_0xf0f9('0x11'));var Redis=require(_0xf0f9('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xf0f9('0x13'));var as=require(_0xf0f9('0x14'));var hardwareService=require(_0xf0f9('0x15'));var logger=require(_0xf0f9('0x16'))('api');var utils=require(_0xf0f9('0x17'));var config=require(_0xf0f9('0x18'));var licenseUtil=require(_0xf0f9('0x19'));var db=require(_0xf0f9('0x1a'))['db'];function respondWithStatusCode(_0x43cc48,_0x44caa1){_0x44caa1=_0x44caa1||0xcc;return function(_0x3dfa62){if(_0x3dfa62){return _0x43cc48[_0xf0f9('0x1b')](_0x44caa1);}return _0x43cc48['status'](_0x44caa1)[_0xf0f9('0x1c')]();};}function respondWithResult(_0x5461c5,_0x1eee95){_0x1eee95=_0x1eee95||0xc8;return function(_0xed6cfa){if(_0xed6cfa){return _0x5461c5['status'](_0x1eee95)[_0xf0f9('0x1d')](_0xed6cfa);}};}function respondWithFilteredResult(_0x1f5a3d,_0xdac1e8){return function(_0x39b115){if(_0x39b115){var _0x4e0fe0=typeof _0xdac1e8[_0xf0f9('0x1e')]===_0xf0f9('0x1f')&&typeof _0xdac1e8['limit']==='undefined';var _0x51779c=_0x39b115[_0xf0f9('0x20')];var _0x2c8b37=_0x4e0fe0?0x0:_0xdac1e8['offset'];var _0x2fe2a0=_0x4e0fe0?_0x39b115['count']:_0xdac1e8[_0xf0f9('0x1e')]+_0xdac1e8[_0xf0f9('0x21')];var _0x132898;if(_0x2fe2a0>=_0x51779c){_0x2fe2a0=_0x51779c;_0x132898=0xc8;}else{_0x132898=0xce;}_0x1f5a3d['status'](_0x132898);return _0x1f5a3d[_0xf0f9('0x22')](_0xf0f9('0x23'),_0x2c8b37+'-'+_0x2fe2a0+'/'+_0x51779c)['json'](_0x39b115);}return null;};}function patchUpdates(_0x4ef6e2){return function(_0x3dde28){try{jsonpatch[_0xf0f9('0x24')](_0x3dde28,_0x4ef6e2,!![]);}catch(_0x3f8f19){return BPromise[_0xf0f9('0x25')](_0x3f8f19);}return _0x3dde28[_0xf0f9('0x26')]();};}function saveUpdates(_0x88e6d4,_0x31de36){return function(_0x2b3d8f){if(_0x2b3d8f){return _0x2b3d8f[_0xf0f9('0x27')](_0x88e6d4)[_0xf0f9('0x28')](function(_0x5d9197){return _0x5d9197;});}return null;};}function removeEntity(_0x4f92bb,_0x4ac8d4){return function(_0x39c88b){if(_0x39c88b){return _0x39c88b[_0xf0f9('0x29')]()[_0xf0f9('0x28')](function(){var _0x196b62=_0x39c88b[_0xf0f9('0x2a')]({'plain':!![]});var _0x1183b6=_0xf0f9('0x2b');return db[_0xf0f9('0x2c')]['destroy']({'where':{'type':_0x1183b6,'resourceId':_0x196b62['id']}})[_0xf0f9('0x28')](function(){return _0x39c88b;});})[_0xf0f9('0x28')](function(){_0x4f92bb['status'](0xcc)[_0xf0f9('0x1c')]();});}};}function handleEntityNotFound(_0x452a8a,_0x246d98){return function(_0x7ec81a){if(!_0x7ec81a){_0x452a8a[_0xf0f9('0x1b')](0x194);}return _0x7ec81a;};}function handleError(_0xd32ecc,_0x2e3d06){_0x2e3d06=_0x2e3d06||0x1f4;return function(_0x5a0a14){logger[_0xf0f9('0x2d')](_0x5a0a14[_0xf0f9('0x2e')]);if(_0x5a0a14[_0xf0f9('0x2f')]){delete _0x5a0a14['name'];}_0xd32ecc[_0xf0f9('0x30')](_0x2e3d06)[_0xf0f9('0x31')](_0x5a0a14);};}exports[_0xf0f9('0x32')]=function(_0x52b36d,_0x70936){var _0xa8f76d={},_0x279f56={},_0x134fb5={'count':0x0,'rows':[]};var _0x2d6ab5=_[_0xf0f9('0x33')](db[_0xf0f9('0x34')][_0xf0f9('0x35')],function(_0xa1f835){return{'name':_0xa1f835[_0xf0f9('0x36')],'type':_0xa1f835[_0xf0f9('0x37')]['key']};});_0x279f56[_0xf0f9('0x38')]=_[_0xf0f9('0x33')](_0x2d6ab5,_0xf0f9('0x2f'));_0x279f56[_0xf0f9('0x39')]=_['keys'](_0x52b36d['query']);_0x279f56['filters']=_['intersection'](_0x279f56[_0xf0f9('0x38')],_0x279f56[_0xf0f9('0x39')]);_0xa8f76d[_0xf0f9('0x3a')]=_['intersection'](_0x279f56[_0xf0f9('0x38')],qs[_0xf0f9('0x3b')](_0x52b36d[_0xf0f9('0x39')][_0xf0f9('0x3b')]));_0xa8f76d[_0xf0f9('0x3a')]=_0xa8f76d[_0xf0f9('0x3a')][_0xf0f9('0x3c')]?_0xa8f76d[_0xf0f9('0x3a')]:_0x279f56['model'];if(!_0x52b36d[_0xf0f9('0x39')]['hasOwnProperty'](_0xf0f9('0x3d'))){_0xa8f76d['limit']=qs[_0xf0f9('0x21')](_0x52b36d[_0xf0f9('0x39')][_0xf0f9('0x21')]);_0xa8f76d[_0xf0f9('0x1e')]=qs['offset'](_0x52b36d[_0xf0f9('0x39')][_0xf0f9('0x1e')]);}_0xa8f76d['order']=qs[_0xf0f9('0x3e')](_0x52b36d[_0xf0f9('0x39')][_0xf0f9('0x3e')]);_0xa8f76d[_0xf0f9('0x3f')]=qs[_0xf0f9('0x40')](_[_0xf0f9('0x41')](_0x52b36d[_0xf0f9('0x39')],_0x279f56[_0xf0f9('0x40')]),_0x2d6ab5);if(_0x52b36d[_0xf0f9('0x39')]['filter']){_0xa8f76d['where']=_[_0xf0f9('0x42')](_0xa8f76d[_0xf0f9('0x3f')],{'$or':_[_0xf0f9('0x33')](_0x2d6ab5,function(_0x407046){if(_0x407046['type']!==_0xf0f9('0x43')){var _0x2dfcc2={};_0x2dfcc2[_0x407046[_0xf0f9('0x2f')]]={'$like':'%'+_0x52b36d[_0xf0f9('0x39')][_0xf0f9('0x44')]+'%'};return _0x2dfcc2;}})});}_0xa8f76d=_[_0xf0f9('0x42')]({},_0xa8f76d,_0x52b36d[_0xf0f9('0x45')]);var _0x4c7a17={'where':_0xa8f76d[_0xf0f9('0x3f')]};return db['SquareOdbc'][_0xf0f9('0x20')](_0x4c7a17)[_0xf0f9('0x28')](function(_0x35691a){_0x134fb5[_0xf0f9('0x20')]=_0x35691a;if(_0x52b36d['query'][_0xf0f9('0x46')]){_0xa8f76d[_0xf0f9('0x47')]=[{'all':!![]}];}return db[_0xf0f9('0x34')][_0xf0f9('0x48')](_0xa8f76d);})['then'](function(_0x5aa7b2){_0x134fb5[_0xf0f9('0x49')]=_0x5aa7b2;return _0x134fb5;})[_0xf0f9('0x28')](respondWithFilteredResult(_0x70936,_0xa8f76d))[_0xf0f9('0x4a')](handleError(_0x70936,null));};exports[_0xf0f9('0x4b')]=function(_0x50c2c8,_0x3a7b1f){var _0xae8ebb={'raw':!![],'where':{'id':_0x50c2c8[_0xf0f9('0x4c')]['id']}},_0x3a3204={};_0x3a3204[_0xf0f9('0x38')]=_[_0xf0f9('0x4d')](db[_0xf0f9('0x34')][_0xf0f9('0x35')]);_0x3a3204[_0xf0f9('0x39')]=_[_0xf0f9('0x4d')](_0x50c2c8[_0xf0f9('0x39')]);_0x3a3204[_0xf0f9('0x40')]=_['intersection'](_0x3a3204[_0xf0f9('0x38')],_0x3a3204[_0xf0f9('0x39')]);_0xae8ebb[_0xf0f9('0x3a')]=_[_0xf0f9('0x4e')](_0x3a3204[_0xf0f9('0x38')],qs[_0xf0f9('0x3b')](_0x50c2c8['query'][_0xf0f9('0x3b')]));_0xae8ebb[_0xf0f9('0x3a')]=_0xae8ebb['attributes'][_0xf0f9('0x3c')]?_0xae8ebb[_0xf0f9('0x3a')]:_0x3a3204[_0xf0f9('0x38')];if(_0x50c2c8[_0xf0f9('0x39')][_0xf0f9('0x46')]){_0xae8ebb['include']=[{'all':!![]}];}_0xae8ebb=_[_0xf0f9('0x42')]({},_0xae8ebb,_0x50c2c8[_0xf0f9('0x45')]);return db['SquareOdbc'][_0xf0f9('0x4f')](_0xae8ebb)['then'](handleEntityNotFound(_0x3a7b1f,null))[_0xf0f9('0x28')](respondWithResult(_0x3a7b1f,null))[_0xf0f9('0x4a')](handleError(_0x3a7b1f,null));};exports[_0xf0f9('0x50')]=function(_0xb68315,_0x552986){return db[_0xf0f9('0x34')][_0xf0f9('0x50')](_0xb68315[_0xf0f9('0x51')],{})[_0xf0f9('0x28')](function(_0x25e1ca){var _0x12e05e=_0xb68315[_0xf0f9('0x52')][_0xf0f9('0x2a')]({'plain':!![]});if(!_0x12e05e)throw new Error(_0xf0f9('0x53'));if(_0x12e05e[_0xf0f9('0x54')]===_0xf0f9('0x52')){var _0x4fd457=_0x25e1ca[_0xf0f9('0x2a')]({'plain':!![]});var _0xd45e6=_0xf0f9('0x2b');return db[_0xf0f9('0x55')][_0xf0f9('0x4f')]({'where':{'name':_0xd45e6,'userProfileId':_0x12e05e[_0xf0f9('0x56')]},'raw':!![]})[_0xf0f9('0x28')](function(_0x4eb342){if(_0x4eb342&&_0x4eb342[_0xf0f9('0x57')]===0x0){return db['UserProfileResource'][_0xf0f9('0x50')]({'name':_0x4fd457[_0xf0f9('0x2f')],'resourceId':_0x4fd457['id'],'type':_0x4eb342['name'],'sectionId':_0x4eb342['id']},{})[_0xf0f9('0x28')](function(){return _0x25e1ca;});}else{return _0x25e1ca;}})['catch'](function(_0x166f69){logger['error'](_0xf0f9('0x58'),_0x166f69);throw _0x166f69;});}return _0x25e1ca;})[_0xf0f9('0x28')](respondWithResult(_0x552986,0xc9))[_0xf0f9('0x4a')](handleError(_0x552986,null));};exports[_0xf0f9('0x27')]=function(_0x4cba2b,_0x1abb56){if(_0x4cba2b[_0xf0f9('0x51')]['id']){delete _0x4cba2b['body']['id'];}return db[_0xf0f9('0x34')][_0xf0f9('0x4f')]({'where':{'id':_0x4cba2b[_0xf0f9('0x4c')]['id']}})[_0xf0f9('0x28')](handleEntityNotFound(_0x1abb56,null))['then'](saveUpdates(_0x4cba2b['body'],null))[_0xf0f9('0x28')](respondWithResult(_0x1abb56,null))[_0xf0f9('0x4a')](handleError(_0x1abb56,null));};exports[_0xf0f9('0x29')]=function(_0x49a087,_0x48667e){return db[_0xf0f9('0x34')][_0xf0f9('0x4f')]({'where':{'id':_0x49a087[_0xf0f9('0x4c')]['id']}})[_0xf0f9('0x28')](handleEntityNotFound(_0x48667e,null))['then'](removeEntity(_0x48667e,null))[_0xf0f9('0x4a')](handleError(_0x48667e,null));};exports[_0xf0f9('0x59')]=function(_0x126d08,_0x926b70,_0x434761){var _0x37d283;return db[_0xf0f9('0x34')][_0xf0f9('0x4f')]({'where':{'id':_0x126d08[_0xf0f9('0x4c')]['id']},'attributes':['id',_0xf0f9('0x5a')]})['then'](handleEntityNotFound(_0x926b70,null))['then'](function(_0x458e52){if(_0x458e52){var _0x5b1725=require(_0xf0f9('0x5b'))();_0x5b1725[_0xf0f9('0x5c')](_0x458e52[_0xf0f9('0x5a')]);_0x5b1725[_0xf0f9('0x5d')]();return _0x458e52;}})[_0xf0f9('0x28')](respondWithResult(_0x926b70,null))[_0xf0f9('0x4a')](handleError(_0x926b70,null));}; \ No newline at end of file +var _0x8867=['../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','ODBC','error','stack','name','send','map','SquareOdbc','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','include','findAll','rows','params','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','odbc','dsn','closeSync','eml-format','zip-dir','request-promise','moment','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x59300a,_0x523eb7){var _0x309cb4=function(_0x21350b){while(--_0x21350b){_0x59300a['push'](_0x59300a['shift']());}};_0x309cb4(++_0x523eb7);}(_0x8867,0x98));var _0x7886=function(_0x2f4de8,_0x313395){_0x2f4de8=_0x2f4de8-0x0;var _0x4569cb=_0x8867[_0x2f4de8];return _0x4569cb;};'use strict';var emlformat=require(_0x7886('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7886('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7886('0x2'));var moment=require(_0x7886('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7886('0x4'));var util=require(_0x7886('0x5'));var path=require(_0x7886('0x6'));var sox=require('sox');var csv=require(_0x7886('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7886('0x8'));var squel=require(_0x7886('0x9'));var crypto=require(_0x7886('0xa'));var jsforce=require(_0x7886('0xb'));var deskjs=require(_0x7886('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7886('0xd'));var Papa=require(_0x7886('0xe'));var Redis=require(_0x7886('0xf'));var authService=require(_0x7886('0x10'));var qs=require(_0x7886('0x11'));var as=require(_0x7886('0x12'));var hardwareService=require(_0x7886('0x13'));var logger=require(_0x7886('0x14'))(_0x7886('0x15'));var utils=require(_0x7886('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7886('0x17'))['db'];function respondWithStatusCode(_0x35a114,_0x781120){_0x781120=_0x781120||0xcc;return function(_0x3440f7){if(_0x3440f7){return _0x35a114[_0x7886('0x18')](_0x781120);}return _0x35a114[_0x7886('0x19')](_0x781120)['end']();};}function respondWithResult(_0x384780,_0xfa5745){_0xfa5745=_0xfa5745||0xc8;return function(_0x4dcd89){if(_0x4dcd89){return _0x384780[_0x7886('0x19')](_0xfa5745)[_0x7886('0x1a')](_0x4dcd89);}};}function respondWithFilteredResult(_0x44169f,_0x5beb9d){return function(_0x1e097a){if(_0x1e097a){var _0x27dc0f=typeof _0x5beb9d[_0x7886('0x1b')]===_0x7886('0x1c')&&typeof _0x5beb9d[_0x7886('0x1d')]===_0x7886('0x1c');var _0x422f5c=_0x1e097a[_0x7886('0x1e')];var _0x5625a2=_0x27dc0f?0x0:_0x5beb9d[_0x7886('0x1b')];var _0x38f62e=_0x27dc0f?_0x1e097a[_0x7886('0x1e')]:_0x5beb9d[_0x7886('0x1b')]+_0x5beb9d[_0x7886('0x1d')];var _0x35059e;if(_0x38f62e>=_0x422f5c){_0x38f62e=_0x422f5c;_0x35059e=0xc8;}else{_0x35059e=0xce;}_0x44169f[_0x7886('0x19')](_0x35059e);return _0x44169f[_0x7886('0x1f')](_0x7886('0x20'),_0x5625a2+'-'+_0x38f62e+'/'+_0x422f5c)[_0x7886('0x1a')](_0x1e097a);}return null;};}function patchUpdates(_0x1357a5){return function(_0x4ddce4){try{jsonpatch[_0x7886('0x21')](_0x4ddce4,_0x1357a5,!![]);}catch(_0x5b03ca){return BPromise[_0x7886('0x22')](_0x5b03ca);}return _0x4ddce4[_0x7886('0x23')]();};}function saveUpdates(_0x244c58,_0x575f7b){return function(_0x515f1a){if(_0x515f1a){return _0x515f1a[_0x7886('0x24')](_0x244c58)['then'](function(_0x46bfe2){return _0x46bfe2;});}return null;};}function removeEntity(_0xe32c58,_0x393826){return function(_0x3d7c05){if(_0x3d7c05){return _0x3d7c05[_0x7886('0x25')]()[_0x7886('0x26')](function(){var _0x40c696=_0x3d7c05['get']({'plain':!![]});var _0x4b9ef8=_0x7886('0x27');return db['UserProfileResource'][_0x7886('0x25')]({'where':{'type':_0x4b9ef8,'resourceId':_0x40c696['id']}})[_0x7886('0x26')](function(){return _0x3d7c05;});})['then'](function(){_0xe32c58[_0x7886('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52b95c,_0x1ba17c){return function(_0x2bf80e){if(!_0x2bf80e){_0x52b95c['sendStatus'](0x194);}return _0x2bf80e;};}function handleError(_0x45c8bf,_0x10331b){_0x10331b=_0x10331b||0x1f4;return function(_0x3a43f8){logger[_0x7886('0x28')](_0x3a43f8[_0x7886('0x29')]);if(_0x3a43f8[_0x7886('0x2a')]){delete _0x3a43f8[_0x7886('0x2a')];}_0x45c8bf['status'](_0x10331b)[_0x7886('0x2b')](_0x3a43f8);};}exports['index']=function(_0x32724f,_0xdc8db3){var _0x35b361={},_0x24da10={},_0x3c1ba3={'count':0x0,'rows':[]};var _0x2c4261=_[_0x7886('0x2c')](db[_0x7886('0x2d')][_0x7886('0x2e')],function(_0x699852){return{'name':_0x699852[_0x7886('0x2f')],'type':_0x699852[_0x7886('0x30')][_0x7886('0x31')]};});_0x24da10['model']=_['map'](_0x2c4261,_0x7886('0x2a'));_0x24da10[_0x7886('0x32')]=_[_0x7886('0x33')](_0x32724f[_0x7886('0x32')]);_0x24da10[_0x7886('0x34')]=_[_0x7886('0x35')](_0x24da10[_0x7886('0x36')],_0x24da10[_0x7886('0x32')]);_0x35b361['attributes']=_['intersection'](_0x24da10[_0x7886('0x36')],qs['fields'](_0x32724f[_0x7886('0x32')][_0x7886('0x37')]));_0x35b361[_0x7886('0x38')]=_0x35b361[_0x7886('0x38')][_0x7886('0x39')]?_0x35b361['attributes']:_0x24da10[_0x7886('0x36')];if(!_0x32724f[_0x7886('0x32')][_0x7886('0x3a')]('nolimit')){_0x35b361[_0x7886('0x1d')]=qs[_0x7886('0x1d')](_0x32724f[_0x7886('0x32')][_0x7886('0x1d')]);_0x35b361[_0x7886('0x1b')]=qs[_0x7886('0x1b')](_0x32724f['query'][_0x7886('0x1b')]);}_0x35b361[_0x7886('0x3b')]=qs[_0x7886('0x3c')](_0x32724f[_0x7886('0x32')][_0x7886('0x3c')]);_0x35b361[_0x7886('0x3d')]=qs['filters'](_[_0x7886('0x3e')](_0x32724f['query'],_0x24da10[_0x7886('0x34')]),_0x2c4261);if(_0x32724f[_0x7886('0x32')]['filter']){_0x35b361[_0x7886('0x3d')]=_[_0x7886('0x3f')](_0x35b361[_0x7886('0x3d')],{'$or':_[_0x7886('0x2c')](_0x2c4261,function(_0x5440f6){if(_0x5440f6['type']!==_0x7886('0x40')){var _0x1e866c={};_0x1e866c[_0x5440f6[_0x7886('0x2a')]]={'$like':'%'+_0x32724f[_0x7886('0x32')]['filter']+'%'};return _0x1e866c;}})});}_0x35b361=_[_0x7886('0x3f')]({},_0x35b361,_0x32724f[_0x7886('0x41')]);var _0x43fab6={'where':_0x35b361['where']};return db[_0x7886('0x2d')]['count'](_0x43fab6)[_0x7886('0x26')](function(_0x462b48){_0x3c1ba3['count']=_0x462b48;if(_0x32724f[_0x7886('0x32')]['includeAll']){_0x35b361[_0x7886('0x42')]=[{'all':!![]}];}return db[_0x7886('0x2d')][_0x7886('0x43')](_0x35b361);})[_0x7886('0x26')](function(_0x1d47a3){_0x3c1ba3[_0x7886('0x44')]=_0x1d47a3;return _0x3c1ba3;})[_0x7886('0x26')](respondWithFilteredResult(_0xdc8db3,_0x35b361))['catch'](handleError(_0xdc8db3,null));};exports['show']=function(_0x40bea5,_0x34c796){var _0x1a28e4={'raw':!![],'where':{'id':_0x40bea5[_0x7886('0x45')]['id']}},_0x4daae9={};_0x4daae9[_0x7886('0x36')]=_['keys'](db[_0x7886('0x2d')][_0x7886('0x2e')]);_0x4daae9[_0x7886('0x32')]=_[_0x7886('0x33')](_0x40bea5['query']);_0x4daae9['filters']=_[_0x7886('0x35')](_0x4daae9[_0x7886('0x36')],_0x4daae9[_0x7886('0x32')]);_0x1a28e4['attributes']=_[_0x7886('0x35')](_0x4daae9['model'],qs[_0x7886('0x37')](_0x40bea5[_0x7886('0x32')][_0x7886('0x37')]));_0x1a28e4[_0x7886('0x38')]=_0x1a28e4['attributes'][_0x7886('0x39')]?_0x1a28e4[_0x7886('0x38')]:_0x4daae9[_0x7886('0x36')];if(_0x40bea5[_0x7886('0x32')]['includeAll']){_0x1a28e4[_0x7886('0x42')]=[{'all':!![]}];}_0x1a28e4=_['merge']({},_0x1a28e4,_0x40bea5['options']);return db[_0x7886('0x2d')][_0x7886('0x46')](_0x1a28e4)['then'](handleEntityNotFound(_0x34c796,null))[_0x7886('0x26')](respondWithResult(_0x34c796,null))[_0x7886('0x47')](handleError(_0x34c796,null));};exports[_0x7886('0x48')]=function(_0x591cd6,_0x3add54){return db['SquareOdbc'][_0x7886('0x48')](_0x591cd6[_0x7886('0x49')],{})['then'](function(_0x58e168){var _0x23937b=_0x591cd6['user'][_0x7886('0x4a')]({'plain':!![]});if(!_0x23937b)throw new Error(_0x7886('0x4b'));if(_0x23937b[_0x7886('0x4c')]===_0x7886('0x4d')){var _0x27c067=_0x58e168[_0x7886('0x4a')]({'plain':!![]});var _0x41f899=_0x7886('0x27');return db[_0x7886('0x4e')][_0x7886('0x46')]({'where':{'name':_0x41f899,'userProfileId':_0x23937b[_0x7886('0x4f')]},'raw':!![]})[_0x7886('0x26')](function(_0x2eab93){if(_0x2eab93&&_0x2eab93[_0x7886('0x50')]===0x0){return db[_0x7886('0x51')][_0x7886('0x48')]({'name':_0x27c067[_0x7886('0x2a')],'resourceId':_0x27c067['id'],'type':_0x2eab93[_0x7886('0x2a')],'sectionId':_0x2eab93['id']},{})['then'](function(){return _0x58e168;});}else{return _0x58e168;}})[_0x7886('0x47')](function(_0x587f17){logger['error'](_0x7886('0x52'),_0x587f17);throw _0x587f17;});}return _0x58e168;})[_0x7886('0x26')](respondWithResult(_0x3add54,0xc9))['catch'](handleError(_0x3add54,null));};exports[_0x7886('0x24')]=function(_0x5de58b,_0x374bdc){if(_0x5de58b[_0x7886('0x49')]['id']){delete _0x5de58b['body']['id'];}return db[_0x7886('0x2d')][_0x7886('0x46')]({'where':{'id':_0x5de58b['params']['id']}})[_0x7886('0x26')](handleEntityNotFound(_0x374bdc,null))[_0x7886('0x26')](saveUpdates(_0x5de58b['body'],null))[_0x7886('0x26')](respondWithResult(_0x374bdc,null))['catch'](handleError(_0x374bdc,null));};exports['destroy']=function(_0x15b292,_0x406e7f){return db['SquareOdbc'][_0x7886('0x46')]({'where':{'id':_0x15b292[_0x7886('0x45')]['id']}})[_0x7886('0x26')](handleEntityNotFound(_0x406e7f,null))['then'](removeEntity(_0x406e7f,null))[_0x7886('0x47')](handleError(_0x406e7f,null));};exports[_0x7886('0x53')]=function(_0x4c6585,_0x222b87,_0x187a51){var _0x5aefdd;return db[_0x7886('0x2d')]['find']({'where':{'id':_0x4c6585['params']['id']},'attributes':['id','dsn']})['then'](handleEntityNotFound(_0x222b87,null))[_0x7886('0x26')](function(_0x575896){if(_0x575896){var _0x4fe573=require(_0x7886('0x54'))();_0x4fe573['openSync'](_0x575896[_0x7886('0x55')]);_0x4fe573[_0x7886('0x56')]();return _0x575896;}})[_0x7886('0x26')](respondWithResult(_0x222b87,null))['catch'](handleError(_0x222b87,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index e0cc21d..45e03d7 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 _0x20d4=['../../config/environment','define','SquareOdbc','square_odbc','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x57dc85,_0x3a6d51){var _0x563a2e=function(_0x5713b2){while(--_0x5713b2){_0x57dc85['push'](_0x57dc85['shift']());}};_0x563a2e(++_0x3a6d51);}(_0x20d4,0xdc));var _0x420d=function(_0x3538ca,_0x361fa7){_0x3538ca=_0x3538ca-0x0;var _0x57ec27=_0x20d4[_0x3538ca];return _0x57ec27;};'use strict';var _=require(_0x420d('0x0'));var util=require(_0x420d('0x1'));var logger=require(_0x420d('0x2'))(_0x420d('0x3'));var moment=require(_0x420d('0x4'));var BPromise=require(_0x420d('0x5'));var rp=require(_0x420d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x420d('0x7'));var config=require(_0x420d('0x8'));var attributes=require('./squareOdbc.attributes');module['exports']=function(_0x9a2d62,_0x2fe5a9){return _0x9a2d62[_0x420d('0x9')](_0x420d('0xa'),attributes,{'tableName':_0x420d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff52=['SquareOdbc','square_odbc','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define'];(function(_0xec9ec3,_0x1d0083){var _0x2653f8=function(_0x3ded26){while(--_0x3ded26){_0xec9ec3['push'](_0xec9ec3['shift']());}};_0x2653f8(++_0x1d0083);}(_0xff52,0x1c2));var _0x2ff5=function(_0x35949a,_0xece70){_0x35949a=_0x35949a-0x0;var _0x9e2198=_0xff52[_0x35949a];return _0x9e2198;};'use strict';var _=require(_0x2ff5('0x0'));var util=require(_0x2ff5('0x1'));var logger=require(_0x2ff5('0x2'))(_0x2ff5('0x3'));var moment=require('moment');var BPromise=require(_0x2ff5('0x4'));var rp=require(_0x2ff5('0x5'));var fs=require('fs');var path=require(_0x2ff5('0x6'));var rimraf=require(_0x2ff5('0x7'));var config=require(_0x2ff5('0x8'));var attributes=require(_0x2ff5('0x9'));module[_0x2ff5('0xa')]=function(_0x1dba10,_0x348986){return _0x1dba10[_0x2ff5('0xb')](_0x2ff5('0xc'),attributes,{'tableName':_0x2ff5('0xd'),'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 89f826b..d0eb32c 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 _0xf29d=['code','message','result','catch','SquareOdbc','find','options','raw','attributes','map','include','model','ShowSquareOdbc','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x597173,_0x139201){var _0x126916=function(_0x15e526){while(--_0x15e526){_0x597173['push'](_0x597173['shift']());}};_0x126916(++_0x139201);}(_0xf29d,0xb2));var _0xdf29=function(_0x4b2693,_0x4db694){_0x4b2693=_0x4b2693-0x0;var _0x4886ff=_0xf29d[_0x4b2693];return _0x4886ff;};'use strict';var _=require(_0xdf29('0x0'));var util=require(_0xdf29('0x1'));var moment=require(_0xdf29('0x2'));var BPromise=require(_0xdf29('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf29('0x4'))['db'];var utils=require(_0xdf29('0x5'));var logger=require(_0xdf29('0x6'))(_0xdf29('0x7'));var config=require(_0xdf29('0x8'));var jayson=require(_0xdf29('0x9'));var client=jayson['client'][_0xdf29('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b3b57,_0x5f42bc,_0x1d77fd){return new BPromise(function(_0x3ef84e,_0x4815c7){return client[_0xdf29('0xb')](_0x4b3b57,_0x1d77fd)[_0xdf29('0xc')](function(_0x5baeb4){logger[_0xdf29('0xd')](_0xdf29('0xe'),_0x5f42bc,_0xdf29('0xf'));logger[_0xdf29('0x10')](_0xdf29('0x11'),_0x5f42bc,_0xdf29('0xf'),JSON[_0xdf29('0x12')](_0x5baeb4));if(_0x5baeb4[_0xdf29('0x13')]){if(_0x5baeb4['error'][_0xdf29('0x14')]===0x1f4){logger[_0xdf29('0x13')](_0xdf29('0xe'),_0x5f42bc,_0x5baeb4[_0xdf29('0x13')][_0xdf29('0x15')]);return _0x4815c7(_0x5baeb4[_0xdf29('0x13')][_0xdf29('0x15')]);}logger[_0xdf29('0x13')](_0xdf29('0xe'),_0x5f42bc,_0x5baeb4[_0xdf29('0x13')][_0xdf29('0x15')]);return _0x3ef84e(_0x5baeb4[_0xdf29('0x13')][_0xdf29('0x15')]);}else{logger['info'](_0xdf29('0xe'),_0x5f42bc,'request\x20sent');_0x3ef84e(_0x5baeb4[_0xdf29('0x16')][_0xdf29('0x15')]);}})[_0xdf29('0x17')](function(_0x96d57){logger[_0xdf29('0x13')](_0xdf29('0xe'),_0x5f42bc,_0x96d57);_0x4815c7(_0x96d57);});});}exports['ShowSquareOdbc']=function(_0x4f276b){var _0x47ac08=this;return new Promise(function(_0x644d97,_0x4d63ce){return db[_0xdf29('0x18')][_0xdf29('0x19')]({'raw':_0x4f276b['options']?_0x4f276b[_0xdf29('0x1a')][_0xdf29('0x1b')]===undefined?!![]:![]:!![],'where':_0x4f276b[_0xdf29('0x1a')]?_0x4f276b[_0xdf29('0x1a')]['where']||null:null,'attributes':_0x4f276b[_0xdf29('0x1a')]?_0x4f276b[_0xdf29('0x1a')][_0xdf29('0x1c')]||null:null,'include':_0x4f276b['options']?_0x4f276b[_0xdf29('0x1a')]['include']?_[_0xdf29('0x1d')](_0x4f276b[_0xdf29('0x1a')][_0xdf29('0x1e')],function(_0x39adc5){return{'model':db[_0x39adc5[_0xdf29('0x1f')]],'as':_0x39adc5['as'],'attributes':_0x39adc5[_0xdf29('0x1c')],'include':_0x39adc5[_0xdf29('0x1e')]?_['map'](_0x39adc5[_0xdf29('0x1e')],function(_0xb47c29){return{'model':db[_0xb47c29[_0xdf29('0x1f')]],'as':_0xb47c29['as'],'attributes':_0xb47c29[_0xdf29('0x1c')],'include':_0xb47c29[_0xdf29('0x1e')]?_[_0xdf29('0x1d')](_0xb47c29[_0xdf29('0x1e')],function(_0x376037){return{'model':db[_0x376037[_0xdf29('0x1f')]],'as':_0x376037['as'],'attributes':_0x376037[_0xdf29('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x6059ad){logger[_0xdf29('0xd')]('ShowSquareOdbc',_0x4f276b);logger[_0xdf29('0x10')]('ShowSquareOdbc',_0x4f276b,JSON[_0xdf29('0x12')](_0x6059ad));_0x644d97(_0x6059ad);})['catch'](function(_0x21d836){logger[_0xdf29('0x13')](_0xdf29('0x20'),_0x21d836[_0xdf29('0x15')],_0x4f276b);_0x4d63ce(_0x47ac08[_0xdf29('0x13')](0x1f4,_0x21d836['message']));});});}; \ No newline at end of file +var _0x1bea=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareOdbc,\x20%s,\x20%s','message','result','catch','find','options','raw','where','map','include','model','attributes','info','ShowSquareOdbc','lodash','util','moment'];(function(_0x4eb05d,_0xbdd9c4){var _0xad239=function(_0x22798b){while(--_0x22798b){_0x4eb05d['push'](_0x4eb05d['shift']());}};_0xad239(++_0xbdd9c4);}(_0x1bea,0x9d));var _0xa1be=function(_0x4005fa,_0x3e1b03){_0x4005fa=_0x4005fa-0x0;var _0x48672d=_0x1bea[_0x4005fa];return _0x48672d;};'use strict';var _=require(_0xa1be('0x0'));var util=require(_0xa1be('0x1'));var moment=require(_0xa1be('0x2'));var BPromise=require(_0xa1be('0x3'));var rs=require(_0xa1be('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa1be('0x5'))['db'];var utils=require(_0xa1be('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xa1be('0x7'));var jayson=require(_0xa1be('0x8'));var client=jayson[_0xa1be('0x9')][_0xa1be('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2628ad,_0x4ad292,_0x2ce20d){return new BPromise(function(_0x3a43c2,_0x3fbb83){return client['request'](_0x2628ad,_0x2ce20d)[_0xa1be('0xb')](function(_0x238476){logger['info']('SquareOdbc,\x20%s,\x20%s',_0x4ad292,_0xa1be('0xc'));logger[_0xa1be('0xd')](_0xa1be('0xe'),_0x4ad292,_0xa1be('0xc'),JSON[_0xa1be('0xf')](_0x238476));if(_0x238476[_0xa1be('0x10')]){if(_0x238476[_0xa1be('0x10')][_0xa1be('0x11')]===0x1f4){logger[_0xa1be('0x10')](_0xa1be('0x12'),_0x4ad292,_0x238476[_0xa1be('0x10')][_0xa1be('0x13')]);return _0x3fbb83(_0x238476[_0xa1be('0x10')][_0xa1be('0x13')]);}logger[_0xa1be('0x10')](_0xa1be('0x12'),_0x4ad292,_0x238476[_0xa1be('0x10')][_0xa1be('0x13')]);return _0x3a43c2(_0x238476['error'][_0xa1be('0x13')]);}else{logger['info'](_0xa1be('0x12'),_0x4ad292,'request\x20sent');_0x3a43c2(_0x238476[_0xa1be('0x14')][_0xa1be('0x13')]);}})[_0xa1be('0x15')](function(_0x49213b){logger[_0xa1be('0x10')](_0xa1be('0x12'),_0x4ad292,_0x49213b);_0x3fbb83(_0x49213b);});});}exports['ShowSquareOdbc']=function(_0x579e5b){var _0x21ca69=this;return new Promise(function(_0x47231b,_0x48519c){return db['SquareOdbc'][_0xa1be('0x16')]({'raw':_0x579e5b[_0xa1be('0x17')]?_0x579e5b[_0xa1be('0x17')][_0xa1be('0x18')]===undefined?!![]:![]:!![],'where':_0x579e5b['options']?_0x579e5b[_0xa1be('0x17')][_0xa1be('0x19')]||null:null,'attributes':_0x579e5b['options']?_0x579e5b[_0xa1be('0x17')]['attributes']||null:null,'include':_0x579e5b['options']?_0x579e5b[_0xa1be('0x17')]['include']?_[_0xa1be('0x1a')](_0x579e5b['options'][_0xa1be('0x1b')],function(_0x408e8d){return{'model':db[_0x408e8d[_0xa1be('0x1c')]],'as':_0x408e8d['as'],'attributes':_0x408e8d[_0xa1be('0x1d')],'include':_0x408e8d[_0xa1be('0x1b')]?_['map'](_0x408e8d['include'],function(_0x3c3642){return{'model':db[_0x3c3642[_0xa1be('0x1c')]],'as':_0x3c3642['as'],'attributes':_0x3c3642[_0xa1be('0x1d')],'include':_0x3c3642[_0xa1be('0x1b')]?_[_0xa1be('0x1a')](_0x3c3642[_0xa1be('0x1b')],function(_0x209f36){return{'model':db[_0x209f36['model']],'as':_0x209f36['as'],'attributes':_0x209f36[_0xa1be('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3db041){logger[_0xa1be('0x1e')](_0xa1be('0x1f'),_0x579e5b);logger['debug'](_0xa1be('0x1f'),_0x579e5b,JSON['stringify'](_0x3db041));_0x47231b(_0x3db041);})[_0xa1be('0x15')](function(_0x3e3d88){logger['error']('ShowSquareOdbc',_0x3e3d88[_0xa1be('0x13')],_0x579e5b);_0x48519c(_0x21ca69[_0xa1be('0x10')](0x1f4,_0x3e3d88['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 2e348f4..fdfd4aa 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 _0x6054=['index','/:id','isAuthenticated','show','post','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x6054,0xdb));var _0x4605=function(_0x46622b,_0x39c3ef){_0x46622b=_0x46622b-0x0;var _0x3835eb=_0x6054[_0x46622b];return _0x3835eb;};'use strict';var multer=require(_0x4605('0x0'));var util=require(_0x4605('0x1'));var path=require(_0x4605('0x2'));var timeout=require(_0x4605('0x3'));var express=require(_0x4605('0x4'));var router=express[_0x4605('0x5')]();var fs_extra=require(_0x4605('0x6'));var auth=require(_0x4605('0x7'));var interaction=require(_0x4605('0x8'));var config=require(_0x4605('0x9'));var controller=require(_0x4605('0xa'));router[_0x4605('0xb')]('/',auth['isAuthenticated'](),controller[_0x4605('0xc')]);router[_0x4605('0xb')](_0x4605('0xd'),auth[_0x4605('0xe')](),controller[_0x4605('0xf')]);router[_0x4605('0x10')]('/',auth[_0x4605('0xe')](),controller[_0x4605('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x4605('0x12')]);router[_0x4605('0x13')](_0x4605('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x4605('0x14')]=router; \ No newline at end of file +var _0x501b=['get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareProject.controller'];(function(_0xff9fa7,_0x5eb1ef){var _0x29bb2c=function(_0x3142f7){while(--_0x3142f7){_0xff9fa7['push'](_0xff9fa7['shift']());}};_0x29bb2c(++_0x5eb1ef);}(_0x501b,0x1e6));var _0xb501=function(_0x32ca62,_0x4fcb47){_0x32ca62=_0x32ca62-0x0;var _0x3847d9=_0x501b[_0x32ca62];return _0x3847d9;};'use strict';var multer=require(_0xb501('0x0'));var util=require('util');var path=require(_0xb501('0x1'));var timeout=require(_0xb501('0x2'));var express=require(_0xb501('0x3'));var router=express[_0xb501('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb501('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb501('0x6'));var controller=require(_0xb501('0x7'));router[_0xb501('0x8')]('/',auth['isAuthenticated'](),controller[_0xb501('0x9')]);router[_0xb501('0x8')](_0xb501('0xa'),auth[_0xb501('0xb')](),controller[_0xb501('0xc')]);router[_0xb501('0xd')]('/',auth[_0xb501('0xb')](),controller[_0xb501('0xe')]);router[_0xb501('0xf')]('/:id',auth[_0xb501('0xb')](),controller[_0xb501('0x10')]);router[_0xb501('0x11')](_0xb501('0xa'),auth[_0xb501('0xb')](),controller[_0xb501('0x12')]);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 510e009..48534d6 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 _0x30b6=['BLOB','long','getDataValue','toString','utf8','production','DATE','sequelize','STRING','TEXT'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x30b6,0x16f));var _0x630b=function(_0x25010a,_0x5e2dbb){_0x25010a=_0x25010a-0x0;var _0x431b1c=_0x30b6[_0x25010a];return _0x431b1c;};'use strict';var Sequelize=require(_0x630b('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x630b('0x1')]},'notes':{'type':Sequelize[_0x630b('0x2')]},'preproduction':{'type':Sequelize[_0x630b('0x3')](_0x630b('0x4')),'get':function(){if(this['getDataValue']('preproduction')){return this[_0x630b('0x5')]('preproduction')[_0x630b('0x6')](_0x630b('0x7'));}}},'production':{'type':Sequelize[_0x630b('0x3')](_0x630b('0x4')),'get':function(){if(this[_0x630b('0x5')](_0x630b('0x8'))){return this[_0x630b('0x5')](_0x630b('0x8'))['toString']('utf8');}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0x630b('0x9')]}}; \ No newline at end of file +var _0xb4eb=['TEXT','long','getDataValue','toString','utf8','BLOB','DATE','sequelize','exports','STRING','name'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0xb4eb,0xa1));var _0xbb4e=function(_0xb20d04,_0x47170c){_0xb20d04=_0xb20d04-0x0;var _0x40e7c7=_0xb4eb[_0xb20d04];return _0x40e7c7;};'use strict';var Sequelize=require(_0xbb4e('0x0'));module[_0xbb4e('0x1')]={'name':{'type':Sequelize[_0xbb4e('0x2')],'unique':_0xbb4e('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xbb4e('0x4')]},'preproduction':{'type':Sequelize['BLOB'](_0xbb4e('0x5')),'get':function(){if(this[_0xbb4e('0x6')]('preproduction')){return this[_0xbb4e('0x6')]('preproduction')[_0xbb4e('0x7')](_0xbb4e('0x8'));}}},'production':{'type':Sequelize[_0xbb4e('0x9')]('long'),'get':function(){if(this[_0xbb4e('0x6')]('production')){return this['getDataValue']('production')[_0xbb4e('0x7')](_0xbb4e('0x8'));}}},'savedAt':{'type':Sequelize[_0xbb4e('0xa')]},'publishedAt':{'type':Sequelize[_0xbb4e('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 89e14bd..b318823 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 _0x928a=['fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','role','UserProfileSection','update','production','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./squareProject.socket','register','status','json','offset','undefined','count','limit','set','Content-Range','then','destroy','get','SquareProjects','UserProfileResource','publish','agi','stringify','sendStatus','error','name','send','index','map','SquareProject','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection'];(function(_0x2a0fc2,_0x53bc54){var _0x3dcbd9=function(_0x982184){while(--_0x982184){_0x2a0fc2['push'](_0x2a0fc2['shift']());}};_0x3dcbd9(++_0x53bc54);}(_0x928a,0xa6));var _0xa928=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x928a[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require(_0xa928('0x0'));var Redis=require(_0xa928('0x1'));var qs=require(_0xa928('0x2'));var logger=require(_0xa928('0x3'))(_0xa928('0x4'));var config=require(_0xa928('0x5'));var db=require(_0xa928('0x6'))['db'];config[_0xa928('0x7')]=_['defaults'](config['redis'],{'host':_0xa928('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa928('0x9'))[_0xa928('0xa')](socket);function respondWithResult(_0x387838,_0x897eda){_0x897eda=_0x897eda||0xc8;return function(_0x12059f){if(_0x12059f){return _0x387838[_0xa928('0xb')](_0x897eda)[_0xa928('0xc')](_0x12059f);}};}function respondWithFilteredResult(_0x44db67,_0x552da9){return function(_0x348531){if(_0x348531){var _0x185c55=typeof _0x552da9[_0xa928('0xd')]===_0xa928('0xe')&&typeof _0x552da9['limit']===_0xa928('0xe');var _0x422cbf=_0x348531[_0xa928('0xf')];var _0x45c12e=_0x185c55?0x0:_0x552da9['offset'];var _0x4a0fe7=_0x185c55?_0x348531[_0xa928('0xf')]:_0x552da9['offset']+_0x552da9[_0xa928('0x10')];var _0x235b58;if(_0x4a0fe7>=_0x422cbf){_0x4a0fe7=_0x422cbf;_0x235b58=0xc8;}else{_0x235b58=0xce;}_0x44db67['status'](_0x235b58);return _0x44db67[_0xa928('0x11')](_0xa928('0x12'),_0x45c12e+'-'+_0x4a0fe7+'/'+_0x422cbf)[_0xa928('0xc')](_0x348531);}return null;};}function saveUpdates(_0x4b1d74){return function(_0x4bfeef){if(_0x4bfeef){return _0x4bfeef['update'](_0x4b1d74)[_0xa928('0x13')](function(_0xdd8119){return _0xdd8119;});}return null;};}function removeEntity(_0x32dc71){return function(_0x19eeda){if(_0x19eeda){return _0x19eeda[_0xa928('0x14')]()[_0xa928('0x13')](function(){var _0x4c5ba3=_0x19eeda[_0xa928('0x15')]({'plain':!![]});var _0x2575f5=_0xa928('0x16');return db[_0xa928('0x17')][_0xa928('0x14')]({'where':{'type':_0x2575f5,'resourceId':_0x4c5ba3['id']}})[_0xa928('0x13')](function(){return _0x19eeda;});})[_0xa928('0x13')](function(){var _0x53a721=new Redis(config[_0xa928('0x7')]);_0x53a721[_0xa928('0x18')](_0xa928('0x19'),JSON[_0xa928('0x1a')]({'id':_0x19eeda['id'],'deleted':!![]}));})[_0xa928('0x13')](function(){_0x32dc71[_0xa928('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0x95271){return function(_0x3ba7b5){if(!_0x3ba7b5){_0x95271[_0xa928('0x1b')](0x194);}return _0x3ba7b5;};}function handleError(_0x580586,_0x296384){_0x296384=_0x296384||0x1f4;return function(_0x2f6bc6){logger[_0xa928('0x1c')](_0x2f6bc6['stack']);if(_0x2f6bc6[_0xa928('0x1d')]){delete _0x2f6bc6[_0xa928('0x1d')];}_0x580586[_0xa928('0xb')](_0x296384)[_0xa928('0x1e')](_0x2f6bc6);};}exports[_0xa928('0x1f')]=function(_0x5709e6,_0x39e61c){var _0xe5bdc={},_0x3a51dd={},_0x230f7e={'count':0x0,'rows':[]};var _0x579e94=_[_0xa928('0x20')](db[_0xa928('0x21')][_0xa928('0x22')],function(_0x1e85a5){return{'name':_0x1e85a5[_0xa928('0x23')],'type':_0x1e85a5[_0xa928('0x24')][_0xa928('0x25')]};});_0x3a51dd[_0xa928('0x26')]=_[_0xa928('0x20')](_0x579e94,_0xa928('0x1d'));_0x3a51dd['query']=_[_0xa928('0x27')](_0x5709e6[_0xa928('0x28')]);_0x3a51dd[_0xa928('0x29')]=_['intersection'](_0x3a51dd['model'],_0x3a51dd['query']);_0xe5bdc[_0xa928('0x2a')]=_[_0xa928('0x2b')](_0x3a51dd[_0xa928('0x26')],qs[_0xa928('0x2c')](_0x5709e6[_0xa928('0x28')][_0xa928('0x2c')]));_0xe5bdc[_0xa928('0x2a')]=_0xe5bdc[_0xa928('0x2a')]['length']?_0xe5bdc[_0xa928('0x2a')]:_0x3a51dd['model'];if(!_0x5709e6[_0xa928('0x28')][_0xa928('0x2d')](_0xa928('0x2e'))){_0xe5bdc[_0xa928('0x10')]=qs[_0xa928('0x10')](_0x5709e6[_0xa928('0x28')][_0xa928('0x10')]);_0xe5bdc[_0xa928('0xd')]=qs[_0xa928('0xd')](_0x5709e6['query']['offset']);}_0xe5bdc[_0xa928('0x2f')]=qs[_0xa928('0x30')](_0x5709e6[_0xa928('0x28')]['sort']);_0xe5bdc[_0xa928('0x31')]=qs['filters'](_[_0xa928('0x32')](_0x5709e6['query'],_0x3a51dd[_0xa928('0x29')]),_0x579e94);if(_0x5709e6['query'][_0xa928('0x33')]){_0xe5bdc[_0xa928('0x31')]=_['merge'](_0xe5bdc[_0xa928('0x31')],{'$or':_['map'](_0x579e94,function(_0x9d0525){if(_0x9d0525[_0xa928('0x24')]!==_0xa928('0x34')){var _0x16ce6d={};_0x16ce6d[_0x9d0525[_0xa928('0x1d')]]={'$like':'%'+_0x5709e6[_0xa928('0x28')][_0xa928('0x33')]+'%'};return _0x16ce6d;}})});}_0xe5bdc=_[_0xa928('0x35')]({},_0xe5bdc,_0x5709e6['options']);var _0x43d276={'where':_0xe5bdc[_0xa928('0x31')]};return db[_0xa928('0x21')][_0xa928('0xf')](_0x43d276)['then'](function(_0x59ab02){_0x230f7e['count']=_0x59ab02;if(_0x5709e6[_0xa928('0x28')][_0xa928('0x36')]){_0xe5bdc[_0xa928('0x37')]=[{'all':!![]}];}return db[_0xa928('0x21')][_0xa928('0x38')](_0xe5bdc);})['then'](function(_0x330ade){_0x230f7e[_0xa928('0x39')]=_0x330ade;return _0x230f7e;})[_0xa928('0x13')](respondWithFilteredResult(_0x39e61c,_0xe5bdc))[_0xa928('0x3a')](handleError(_0x39e61c,null));};exports[_0xa928('0x3b')]=function(_0x3fe89c,_0x2affb1){var _0x2eb869={'raw':![],'where':{'id':_0x3fe89c[_0xa928('0x3c')]['id']}},_0x93a575={};_0x93a575['model']=_['keys'](db['SquareProject'][_0xa928('0x22')]);_0x93a575['query']=_[_0xa928('0x27')](_0x3fe89c['query']);_0x93a575[_0xa928('0x29')]=_[_0xa928('0x2b')](_0x93a575[_0xa928('0x26')],_0x93a575[_0xa928('0x28')]);_0x2eb869[_0xa928('0x2a')]=_[_0xa928('0x2b')](_0x93a575[_0xa928('0x26')],qs['fields'](_0x3fe89c[_0xa928('0x28')][_0xa928('0x2c')]));_0x2eb869[_0xa928('0x2a')]=_0x2eb869[_0xa928('0x2a')][_0xa928('0x3d')]?_0x2eb869[_0xa928('0x2a')]:_0x93a575['model'];if(_0x3fe89c['query'][_0xa928('0x36')]){_0x2eb869[_0xa928('0x37')]=[{'all':!![]}];}_0x2eb869=_[_0xa928('0x35')]({},_0x2eb869,_0x3fe89c['options']);return db['SquareProject'][_0xa928('0x3e')](_0x2eb869)[_0xa928('0x13')](handleEntityNotFound(_0x2affb1,null))[_0xa928('0x13')](respondWithResult(_0x2affb1,null))[_0xa928('0x3a')](handleError(_0x2affb1,null));};exports[_0xa928('0x3f')]=function(_0x567014,_0x4c4d50){return db['SquareProject'][_0xa928('0x3f')](_0x567014[_0xa928('0x40')],{})[_0xa928('0x13')](function(_0x3adbf4){var _0x5159c1=_0x567014[_0xa928('0x41')][_0xa928('0x15')]({'plain':!![]});if(!_0x5159c1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5159c1[_0xa928('0x42')]===_0xa928('0x41')){var _0x4f3aa1=_0x3adbf4[_0xa928('0x15')]({'plain':!![]});var _0x20969d=_0xa928('0x16');return db[_0xa928('0x43')]['find']({'where':{'name':_0x20969d,'userProfileId':_0x5159c1['userProfileId']},'raw':!![]})[_0xa928('0x13')](function(_0xf438b3){if(_0xf438b3&&_0xf438b3['autoAssociation']===0x0){return db[_0xa928('0x17')]['create']({'name':_0x4f3aa1[_0xa928('0x1d')],'resourceId':_0x4f3aa1['id'],'type':_0xf438b3[_0xa928('0x1d')],'sectionId':_0xf438b3['id']},{})[_0xa928('0x13')](function(){return _0x3adbf4;});}else{return _0x3adbf4;}})[_0xa928('0x3a')](function(_0x242366){logger[_0xa928('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x242366);throw _0x242366;});}return _0x3adbf4;})[_0xa928('0x13')](respondWithResult(_0x4c4d50,0xc9))[_0xa928('0x3a')](handleError(_0x4c4d50,null));};exports[_0xa928('0x44')]=function(_0x57e565,_0x5bb0c4){if(_0x57e565[_0xa928('0x40')]['id']){delete _0x57e565[_0xa928('0x40')]['id'];}return db[_0xa928('0x21')][_0xa928('0x3e')]({'where':{'id':_0x57e565[_0xa928('0x3c')]['id']}})[_0xa928('0x13')](handleEntityNotFound(_0x5bb0c4,null))[_0xa928('0x13')](saveUpdates(_0x57e565[_0xa928('0x40')],null))[_0xa928('0x13')](function(_0x162177){if(!_0x162177)return;var _0x923dc5=_0x162177[_0xa928('0x15')]({'plain':!![]});return _0x923dc5;})[_0xa928('0x13')](function(_0x574575){var _0x3a1f0a=new Redis(config[_0xa928('0x7')]);_0x3a1f0a[_0xa928('0x18')]('agi',JSON[_0xa928('0x1a')](_[_0xa928('0x32')](_0x574575,['id',_0xa928('0x1d'),_0xa928('0x45')])));return _0x574575;})[_0xa928('0x13')](respondWithResult(_0x5bb0c4,null))[_0xa928('0x3a')](handleError(_0x5bb0c4,null));};exports[_0xa928('0x14')]=function(_0x353447,_0x5392dd){return db[_0xa928('0x21')][_0xa928('0x3e')]({'where':{'id':_0x353447[_0xa928('0x3c')]['id']}})[_0xa928('0x13')](handleEntityNotFound(_0x5392dd,null))['then'](removeEntity(_0x5392dd,null))[_0xa928('0x3a')](handleError(_0x5392dd,null));}; \ No newline at end of file +var _0xf5dd=['user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','agi','pick','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','./squareProject.socket','register','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','SquareProjects','UserProfileResource','publish','stringify','end','sendStatus','error','stack','name','send','SquareProject','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','map','VIRTUAL','includeAll','include','catch','show','params','options','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x5f52ef,_0x30055c){var _0x5e6135=function(_0x3faaef){while(--_0x3faaef){_0x5f52ef['push'](_0x5f52ef['shift']());}};_0x5e6135(++_0x30055c);}(_0xf5dd,0x1dc));var _0xdf5d=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xf5dd[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xdf5d('0x0'));var Redis=require(_0xdf5d('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xdf5d('0x2'))(_0xdf5d('0x3'));var config=require(_0xdf5d('0x4'));var db=require(_0xdf5d('0x5'))['db'];config['redis']=_[_0xdf5d('0x6')](config[_0xdf5d('0x7')],{'host':_0xdf5d('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdf5d('0x7')]));require(_0xdf5d('0x9'))[_0xdf5d('0xa')](socket);function respondWithResult(_0x426fea,_0x5ef996){_0x5ef996=_0x5ef996||0xc8;return function(_0x422312){if(_0x422312){return _0x426fea[_0xdf5d('0xb')](_0x5ef996)[_0xdf5d('0xc')](_0x422312);}};}function respondWithFilteredResult(_0x3fc2d7,_0x49545a){return function(_0x8f36f1){if(_0x8f36f1){var _0x382c3b=typeof _0x49545a[_0xdf5d('0xd')]===_0xdf5d('0xe')&&typeof _0x49545a[_0xdf5d('0xf')]===_0xdf5d('0xe');var _0x392051=_0x8f36f1[_0xdf5d('0x10')];var _0xe7bbc2=_0x382c3b?0x0:_0x49545a[_0xdf5d('0xd')];var _0x3af7a5=_0x382c3b?_0x8f36f1[_0xdf5d('0x10')]:_0x49545a[_0xdf5d('0xd')]+_0x49545a[_0xdf5d('0xf')];var _0x142f5e;if(_0x3af7a5>=_0x392051){_0x3af7a5=_0x392051;_0x142f5e=0xc8;}else{_0x142f5e=0xce;}_0x3fc2d7[_0xdf5d('0xb')](_0x142f5e);return _0x3fc2d7['set'](_0xdf5d('0x11'),_0xe7bbc2+'-'+_0x3af7a5+'/'+_0x392051)[_0xdf5d('0xc')](_0x8f36f1);}return null;};}function saveUpdates(_0x1fd85a){return function(_0x151eb3){if(_0x151eb3){return _0x151eb3[_0xdf5d('0x12')](_0x1fd85a)[_0xdf5d('0x13')](function(_0x2f008f){return _0x2f008f;});}return null;};}function removeEntity(_0x1f0a7f){return function(_0x3792bb){if(_0x3792bb){return _0x3792bb[_0xdf5d('0x14')]()['then'](function(){var _0x2321a6=_0x3792bb['get']({'plain':!![]});var _0x2cd059=_0xdf5d('0x15');return db[_0xdf5d('0x16')][_0xdf5d('0x14')]({'where':{'type':_0x2cd059,'resourceId':_0x2321a6['id']}})['then'](function(){return _0x3792bb;});})['then'](function(){var _0x3eac5e=new Redis(config[_0xdf5d('0x7')]);_0x3eac5e[_0xdf5d('0x17')]('agi',JSON[_0xdf5d('0x18')]({'id':_0x3792bb['id'],'deleted':!![]}));})[_0xdf5d('0x13')](function(){_0x1f0a7f[_0xdf5d('0xb')](0xcc)[_0xdf5d('0x19')]();});}};}function handleEntityNotFound(_0x27fc94){return function(_0x2b3dc2){if(!_0x2b3dc2){_0x27fc94[_0xdf5d('0x1a')](0x194);}return _0x2b3dc2;};}function handleError(_0x37ca36,_0x5a27eb){_0x5a27eb=_0x5a27eb||0x1f4;return function(_0x517cd9){logger[_0xdf5d('0x1b')](_0x517cd9[_0xdf5d('0x1c')]);if(_0x517cd9[_0xdf5d('0x1d')]){delete _0x517cd9[_0xdf5d('0x1d')];}_0x37ca36[_0xdf5d('0xb')](_0x5a27eb)[_0xdf5d('0x1e')](_0x517cd9);};}exports['index']=function(_0x272192,_0xb969f3){var _0x1f4842={},_0xc13f31={},_0x1da306={'count':0x0,'rows':[]};var _0x596eaf=_['map'](db[_0xdf5d('0x1f')][_0xdf5d('0x20')],function(_0x552860){return{'name':_0x552860[_0xdf5d('0x21')],'type':_0x552860['type']['key']};});_0xc13f31[_0xdf5d('0x22')]=_['map'](_0x596eaf,_0xdf5d('0x1d'));_0xc13f31['query']=_[_0xdf5d('0x23')](_0x272192[_0xdf5d('0x24')]);_0xc13f31[_0xdf5d('0x25')]=_[_0xdf5d('0x26')](_0xc13f31[_0xdf5d('0x22')],_0xc13f31['query']);_0x1f4842[_0xdf5d('0x27')]=_[_0xdf5d('0x26')](_0xc13f31[_0xdf5d('0x22')],qs[_0xdf5d('0x28')](_0x272192[_0xdf5d('0x24')][_0xdf5d('0x28')]));_0x1f4842[_0xdf5d('0x27')]=_0x1f4842[_0xdf5d('0x27')]['length']?_0x1f4842[_0xdf5d('0x27')]:_0xc13f31['model'];if(!_0x272192[_0xdf5d('0x24')][_0xdf5d('0x29')](_0xdf5d('0x2a'))){_0x1f4842[_0xdf5d('0xf')]=qs[_0xdf5d('0xf')](_0x272192['query'][_0xdf5d('0xf')]);_0x1f4842['offset']=qs['offset'](_0x272192['query'][_0xdf5d('0xd')]);}_0x1f4842['order']=qs[_0xdf5d('0x2b')](_0x272192[_0xdf5d('0x24')][_0xdf5d('0x2b')]);_0x1f4842[_0xdf5d('0x2c')]=qs[_0xdf5d('0x25')](_['pick'](_0x272192[_0xdf5d('0x24')],_0xc13f31['filters']),_0x596eaf);if(_0x272192[_0xdf5d('0x24')][_0xdf5d('0x2d')]){_0x1f4842[_0xdf5d('0x2c')]=_[_0xdf5d('0x2e')](_0x1f4842[_0xdf5d('0x2c')],{'$or':_[_0xdf5d('0x2f')](_0x596eaf,function(_0x35822b){if(_0x35822b['type']!==_0xdf5d('0x30')){var _0x1473a9={};_0x1473a9[_0x35822b[_0xdf5d('0x1d')]]={'$like':'%'+_0x272192[_0xdf5d('0x24')][_0xdf5d('0x2d')]+'%'};return _0x1473a9;}})});}_0x1f4842=_[_0xdf5d('0x2e')]({},_0x1f4842,_0x272192['options']);var _0x49d311={'where':_0x1f4842[_0xdf5d('0x2c')]};return db['SquareProject'][_0xdf5d('0x10')](_0x49d311)[_0xdf5d('0x13')](function(_0x3a77fe){_0x1da306[_0xdf5d('0x10')]=_0x3a77fe;if(_0x272192[_0xdf5d('0x24')][_0xdf5d('0x31')]){_0x1f4842[_0xdf5d('0x32')]=[{'all':!![]}];}return db[_0xdf5d('0x1f')]['findAll'](_0x1f4842);})[_0xdf5d('0x13')](function(_0x1477dd){_0x1da306['rows']=_0x1477dd;return _0x1da306;})[_0xdf5d('0x13')](respondWithFilteredResult(_0xb969f3,_0x1f4842))[_0xdf5d('0x33')](handleError(_0xb969f3,null));};exports[_0xdf5d('0x34')]=function(_0xb9c63c,_0x350ce7){var _0x14b8a6={'raw':![],'where':{'id':_0xb9c63c[_0xdf5d('0x35')]['id']}},_0x295bc6={};_0x295bc6[_0xdf5d('0x22')]=_['keys'](db[_0xdf5d('0x1f')][_0xdf5d('0x20')]);_0x295bc6[_0xdf5d('0x24')]=_['keys'](_0xb9c63c['query']);_0x295bc6['filters']=_[_0xdf5d('0x26')](_0x295bc6[_0xdf5d('0x22')],_0x295bc6[_0xdf5d('0x24')]);_0x14b8a6[_0xdf5d('0x27')]=_[_0xdf5d('0x26')](_0x295bc6['model'],qs[_0xdf5d('0x28')](_0xb9c63c[_0xdf5d('0x24')][_0xdf5d('0x28')]));_0x14b8a6['attributes']=_0x14b8a6[_0xdf5d('0x27')]['length']?_0x14b8a6[_0xdf5d('0x27')]:_0x295bc6['model'];if(_0xb9c63c[_0xdf5d('0x24')]['includeAll']){_0x14b8a6[_0xdf5d('0x32')]=[{'all':!![]}];}_0x14b8a6=_['merge']({},_0x14b8a6,_0xb9c63c[_0xdf5d('0x36')]);return db[_0xdf5d('0x1f')]['find'](_0x14b8a6)[_0xdf5d('0x13')](handleEntityNotFound(_0x350ce7,null))['then'](respondWithResult(_0x350ce7,null))[_0xdf5d('0x33')](handleError(_0x350ce7,null));};exports[_0xdf5d('0x37')]=function(_0x2d6e1b,_0x95168a){return db[_0xdf5d('0x1f')]['create'](_0x2d6e1b[_0xdf5d('0x38')],{})['then'](function(_0x561be7){var _0x49ac54=_0x2d6e1b['user'][_0xdf5d('0x39')]({'plain':!![]});if(!_0x49ac54)throw new Error(_0xdf5d('0x3a'));if(_0x49ac54[_0xdf5d('0x3b')]===_0xdf5d('0x3c')){var _0x5e6f27=_0x561be7[_0xdf5d('0x39')]({'plain':!![]});var _0x1b6ecb=_0xdf5d('0x15');return db[_0xdf5d('0x3d')][_0xdf5d('0x3e')]({'where':{'name':_0x1b6ecb,'userProfileId':_0x49ac54['userProfileId']},'raw':!![]})['then'](function(_0x37078d){if(_0x37078d&&_0x37078d[_0xdf5d('0x3f')]===0x0){return db[_0xdf5d('0x16')]['create']({'name':_0x5e6f27['name'],'resourceId':_0x5e6f27['id'],'type':_0x37078d['name'],'sectionId':_0x37078d['id']},{})['then'](function(){return _0x561be7;});}else{return _0x561be7;}})[_0xdf5d('0x33')](function(_0x26666c){logger[_0xdf5d('0x1b')](_0xdf5d('0x40'),_0x26666c);throw _0x26666c;});}return _0x561be7;})[_0xdf5d('0x13')](respondWithResult(_0x95168a,0xc9))[_0xdf5d('0x33')](handleError(_0x95168a,null));};exports['update']=function(_0x2214e3,_0x41168f){if(_0x2214e3[_0xdf5d('0x38')]['id']){delete _0x2214e3[_0xdf5d('0x38')]['id'];}return db['SquareProject'][_0xdf5d('0x3e')]({'where':{'id':_0x2214e3['params']['id']}})[_0xdf5d('0x13')](handleEntityNotFound(_0x41168f,null))[_0xdf5d('0x13')](saveUpdates(_0x2214e3[_0xdf5d('0x38')],null))[_0xdf5d('0x13')](function(_0x270d0a){if(!_0x270d0a)return;var _0x3433b4=_0x270d0a['get']({'plain':!![]});return _0x3433b4;})[_0xdf5d('0x13')](function(_0x378b26){var _0x2fb8ac=new Redis(config['redis']);_0x2fb8ac[_0xdf5d('0x17')](_0xdf5d('0x41'),JSON[_0xdf5d('0x18')](_[_0xdf5d('0x42')](_0x378b26,['id','name','production'])));return _0x378b26;})['then'](respondWithResult(_0x41168f,null))['catch'](handleError(_0x41168f,null));};exports['destroy']=function(_0x32fda8,_0x4b5f97){return db[_0xdf5d('0x1f')][_0xdf5d('0x3e')]({'where':{'id':_0x32fda8[_0xdf5d('0x35')]['id']}})[_0xdf5d('0x13')](handleEntityNotFound(_0x4b5f97,null))[_0xdf5d('0x13')](removeEntity(_0x4b5f97,null))[_0xdf5d('0x33')](handleError(_0x4b5f97,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 390dd5b..474cd49 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 _0x7939=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb','SquareProject'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x7939,0x16f));var _0x9793=function(_0x22847c,_0x1f490){_0x22847c=_0x22847c-0x0;var _0x126003=_0x7939[_0x22847c];return _0x126003;};'use strict';var EventEmitter=require(_0x9793('0x0'));var SquareProject=require(_0x9793('0x1'))['db'][_0x9793('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x9793('0x3')](0x0);var events={'afterCreate':_0x9793('0x4'),'afterUpdate':_0x9793('0x5'),'afterDestroy':_0x9793('0x6')};function emitEvent(_0x35053b){return function(_0x281ce7,_0x4cd8c7,_0x1e4032){SquareProjectEvents['emit'](_0x35053b+':'+_0x281ce7['id'],_0x281ce7);SquareProjectEvents[_0x9793('0x7')](_0x35053b,_0x281ce7);_0x1e4032(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x9793('0x8')](e,emitEvent(event));}}module[_0x9793('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0xb51b=['SquareProject','save','update','emit','hook','exports','events','../../mysqldb'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xb51b,0x186));var _0xbb51=function(_0x247d0a,_0x1d31b6){_0x247d0a=_0x247d0a-0x0;var _0x19c38f=_0xb51b[_0x247d0a];return _0x19c38f;};'use strict';var EventEmitter=require(_0xbb51('0x0'));var SquareProject=require(_0xbb51('0x1'))['db'][_0xbb51('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbb51('0x3'),'afterUpdate':_0xbb51('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4b22b4){return function(_0x435403,_0x4fedf8,_0x4647a8){SquareProjectEvents[_0xbb51('0x5')](_0x4b22b4+':'+_0x435403['id'],_0x435403);SquareProjectEvents['emit'](_0x4b22b4,_0x435403);_0x4647a8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0xbb51('0x6')](e,emitEvent(event));}}module[_0xbb51('0x7')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 45ace5c..fe9a8f5 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 _0x689b=['YYYY-MM-DD\x20HH:mm:ss','production','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','./squareProject.attributes','exports','define','SquareProject','changed','preproduction','savedAt','format'];(function(_0x5eda6b,_0x498d53){var _0x57b82f=function(_0x27ce96){while(--_0x27ce96){_0x5eda6b['push'](_0x5eda6b['shift']());}};_0x57b82f(++_0x498d53);}(_0x689b,0x1de));var _0xb689=function(_0x1272ad,_0x585331){_0x1272ad=_0x1272ad-0x0;var _0x321085=_0x689b[_0x1272ad];return _0x321085;};'use strict';var _=require(_0xb689('0x0'));var util=require(_0xb689('0x1'));var logger=require(_0xb689('0x2'))(_0xb689('0x3'));var moment=require(_0xb689('0x4'));var BPromise=require('bluebird');var rp=require(_0xb689('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb689('0x6'));var attributes=require(_0xb689('0x7'));module[_0xb689('0x8')]=function(_0xa1ed55,_0x498f6e){return _0xa1ed55[_0xb689('0x9')](_0xb689('0xa'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x34c848,_0x33bb68,_0x55e95f){if(_0x34c848[_0xb689('0xb')](_0xb689('0xc'))){_0x34c848[_0xb689('0xd')]=moment()[_0xb689('0xe')](_0xb689('0xf'));}if(_0x34c848[_0xb689('0xb')](_0xb689('0x10'))){_0x34c848['publishedAt']=moment()[_0xb689('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x55e95f(null,_0x34c848);}}});}; \ No newline at end of file +var _0x965e=['exports','define','SquareProject','square_projects','changed','preproduction','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./squareProject.attributes'];(function(_0x30805d,_0x487d81){var _0x48477b=function(_0x196711){while(--_0x196711){_0x30805d['push'](_0x30805d['shift']());}};_0x48477b(++_0x487d81);}(_0x965e,0x1de));var _0xe965=function(_0x30cf23,_0x1994a2){_0x30cf23=_0x30cf23-0x0;var _0x2123e4=_0x965e[_0x30cf23];return _0x2123e4;};'use strict';var _=require(_0xe965('0x0'));var util=require(_0xe965('0x1'));var logger=require(_0xe965('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe965('0x3'));var rp=require(_0xe965('0x4'));var fs=require('fs');var path=require(_0xe965('0x5'));var rimraf=require(_0xe965('0x6'));var config=require('../../config/environment');var attributes=require(_0xe965('0x7'));module[_0xe965('0x8')]=function(_0x1be798,_0x3891c6){return _0x1be798[_0xe965('0x9')](_0xe965('0xa'),attributes,{'tableName':_0xe965('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5dbe89,_0x43db38,_0xd620d6){if(_0x5dbe89[_0xe965('0xc')](_0xe965('0xd'))){_0x5dbe89['savedAt']=moment()[_0xe965('0xe')](_0xe965('0xf'));}if(_0x5dbe89['changed'](_0xe965('0x10'))){_0x5dbe89[_0xe965('0x11')]=moment()[_0xe965('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0xd620d6(null,_0x5dbe89);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index e6e620d..73c1ccc 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 _0x3d02=['debug','error','message','ShowSquareProject','ioredis','../../mysqldb','../../config/logger','../../config/environment','redis','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','where','attributes','include','model','map','then','info'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x3d02,0xe0));var _0x23d0=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x3d02[_0x87b0ff];return _0x3bc0b2;};'use strict';var _=require('lodash');var Redis=require(_0x23d0('0x0'));var db=require(_0x23d0('0x1'))['db'];var logger=require(_0x23d0('0x2'))('rpc');var config=require(_0x23d0('0x3'));config[_0x23d0('0x4')]=_['defaults'](config[_0x23d0('0x4')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x23d0('0x4')]));require(_0x23d0('0x5'))[_0x23d0('0x6')](socket);exports[_0x23d0('0x7')]=function(_0x320bb8){var _0x58592a=this;return new Promise(function(_0x8134c5,_0x3b9d09){return db[_0x23d0('0x8')][_0x23d0('0x9')]({'raw':_0x320bb8[_0x23d0('0xa')]?_0x320bb8[_0x23d0('0xa')]['raw']===undefined?!![]:![]:!![],'where':_0x320bb8[_0x23d0('0xa')]?_0x320bb8[_0x23d0('0xa')][_0x23d0('0xb')]||null:null,'attributes':_0x320bb8[_0x23d0('0xa')]?_0x320bb8[_0x23d0('0xa')][_0x23d0('0xc')]||null:null,'limit':_0x320bb8[_0x23d0('0xa')]?_0x320bb8[_0x23d0('0xa')]['limit']||null:null,'include':_0x320bb8[_0x23d0('0xa')]?_0x320bb8[_0x23d0('0xa')][_0x23d0('0xd')]?_['map'](_0x320bb8[_0x23d0('0xa')][_0x23d0('0xd')],function(_0x554957){return{'model':db[_0x554957[_0x23d0('0xe')]],'as':_0x554957['as'],'attributes':_0x554957['attributes'],'include':_0x554957[_0x23d0('0xd')]?_[_0x23d0('0xf')](_0x554957[_0x23d0('0xd')],function(_0xde08d3){return{'model':db[_0xde08d3[_0x23d0('0xe')]],'as':_0xde08d3['as'],'attributes':_0xde08d3['attributes'],'include':_0xde08d3[_0x23d0('0xd')]?_[_0x23d0('0xf')](_0xde08d3[_0x23d0('0xd')],function(_0x4b66f2){return{'model':db[_0x4b66f2[_0x23d0('0xe')]],'as':_0x4b66f2['as'],'attributes':_0x4b66f2[_0x23d0('0xc')]};}):[]};}):[]};}):[]:[]})[_0x23d0('0x10')](function(_0x3d6251){logger[_0x23d0('0x11')](_0x23d0('0x7'),_0x320bb8);logger[_0x23d0('0x12')](_0x23d0('0x7'),_0x320bb8,JSON['stringify'](_0x3d6251));_0x8134c5(_0x3d6251);})['catch'](function(_0x132c07){logger[_0x23d0('0x13')](_0x23d0('0x7'),_0x132c07[_0x23d0('0x14')],_0x320bb8);_0x3b9d09(_0x58592a[_0x23d0('0x13')](0x1f4,_0x132c07[_0x23d0('0x14')]));});});};exports[_0x23d0('0x15')]=function(_0x28c0c2){var _0xe6b29=this;return new Promise(function(_0x2cb4f6,_0x51a342){return db[_0x23d0('0x8')]['find']({'raw':_0x28c0c2[_0x23d0('0xa')]?_0x28c0c2['options']['raw']===undefined?!![]:![]:!![],'where':_0x28c0c2[_0x23d0('0xa')]?_0x28c0c2['options'][_0x23d0('0xb')]||null:null,'attributes':_0x28c0c2[_0x23d0('0xa')]?_0x28c0c2[_0x23d0('0xa')][_0x23d0('0xc')]||null:null,'include':_0x28c0c2[_0x23d0('0xa')]?_0x28c0c2[_0x23d0('0xa')][_0x23d0('0xd')]?_['map'](_0x28c0c2[_0x23d0('0xa')][_0x23d0('0xd')],function(_0x5188a0){return{'model':db[_0x5188a0['model']],'as':_0x5188a0['as'],'attributes':_0x5188a0[_0x23d0('0xc')],'include':_0x5188a0[_0x23d0('0xd')]?_['map'](_0x5188a0[_0x23d0('0xd')],function(_0x103c78){return{'model':db[_0x103c78[_0x23d0('0xe')]],'as':_0x103c78['as'],'attributes':_0x103c78[_0x23d0('0xc')],'include':_0x103c78[_0x23d0('0xd')]?_['map'](_0x103c78[_0x23d0('0xd')],function(_0x346eb9){return{'model':db[_0x346eb9[_0x23d0('0xe')]],'as':_0x346eb9['as'],'attributes':_0x346eb9[_0x23d0('0xc')]};}):[]};}):[]};}):[]:[]})[_0x23d0('0x10')](function(_0x146087){logger[_0x23d0('0x11')]('ShowSquareProject',_0x28c0c2);logger['debug'](_0x23d0('0x15'),_0x28c0c2,JSON['stringify'](_0x146087));_0x2cb4f6(_0x146087);})['catch'](function(_0x2883b1){logger['error'](_0x23d0('0x15'),_0x2883b1['message'],_0x28c0c2);_0x51a342(_0xe6b29[_0x23d0('0x13')](0x1f4,_0x2883b1[_0x23d0('0x14')]));});});}; \ No newline at end of file +var _0x4a62=['message','ShowSquareProject','find','stringify','ioredis','../../mysqldb','../../config/logger','rpc','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','where','attributes','limit','include','model','map','then','info','debug','catch','error'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x4a62,0x78));var _0x24a6=function(_0x29f1df,_0x55904e){_0x29f1df=_0x29f1df-0x0;var _0x450882=_0x4a62[_0x29f1df];return _0x450882;};'use strict';var _=require('lodash');var Redis=require(_0x24a6('0x0'));var db=require(_0x24a6('0x1'))['db'];var logger=require(_0x24a6('0x2'))(_0x24a6('0x3'));var config=require('../../config/environment');config['redis']=_[_0x24a6('0x4')](config[_0x24a6('0x5')],{'host':_0x24a6('0x6'),'port':0x18eb});var socket=require(_0x24a6('0x7'))(new Redis(config[_0x24a6('0x5')]));require(_0x24a6('0x8'))[_0x24a6('0x9')](socket);exports[_0x24a6('0xa')]=function(_0x5206c6){var _0x469f28=this;return new Promise(function(_0x1152fd,_0x236bd8){return db[_0x24a6('0xb')][_0x24a6('0xc')]({'raw':_0x5206c6['options']?_0x5206c6[_0x24a6('0xd')]['raw']===undefined?!![]:![]:!![],'where':_0x5206c6[_0x24a6('0xd')]?_0x5206c6['options'][_0x24a6('0xe')]||null:null,'attributes':_0x5206c6['options']?_0x5206c6[_0x24a6('0xd')][_0x24a6('0xf')]||null:null,'limit':_0x5206c6['options']?_0x5206c6[_0x24a6('0xd')][_0x24a6('0x10')]||null:null,'include':_0x5206c6[_0x24a6('0xd')]?_0x5206c6[_0x24a6('0xd')]['include']?_['map'](_0x5206c6[_0x24a6('0xd')][_0x24a6('0x11')],function(_0x2b743d){return{'model':db[_0x2b743d[_0x24a6('0x12')]],'as':_0x2b743d['as'],'attributes':_0x2b743d['attributes'],'include':_0x2b743d['include']?_[_0x24a6('0x13')](_0x2b743d[_0x24a6('0x11')],function(_0x51b7bd){return{'model':db[_0x51b7bd['model']],'as':_0x51b7bd['as'],'attributes':_0x51b7bd[_0x24a6('0xf')],'include':_0x51b7bd[_0x24a6('0x11')]?_[_0x24a6('0x13')](_0x51b7bd[_0x24a6('0x11')],function(_0x35a16c){return{'model':db[_0x35a16c[_0x24a6('0x12')]],'as':_0x35a16c['as'],'attributes':_0x35a16c['attributes']};}):[]};}):[]};}):[]:[]})[_0x24a6('0x14')](function(_0x120af1){logger[_0x24a6('0x15')]('GetSquareProjects',_0x5206c6);logger[_0x24a6('0x16')]('GetSquareProjects',_0x5206c6,JSON['stringify'](_0x120af1));_0x1152fd(_0x120af1);})[_0x24a6('0x17')](function(_0x2d639f){logger[_0x24a6('0x18')](_0x24a6('0xa'),_0x2d639f[_0x24a6('0x19')],_0x5206c6);_0x236bd8(_0x469f28[_0x24a6('0x18')](0x1f4,_0x2d639f['message']));});});};exports[_0x24a6('0x1a')]=function(_0x3f0271){var _0xdc5b5b=this;return new Promise(function(_0x162e82,_0x4c4f31){return db[_0x24a6('0xb')][_0x24a6('0x1b')]({'raw':_0x3f0271[_0x24a6('0xd')]?_0x3f0271[_0x24a6('0xd')]['raw']===undefined?!![]:![]:!![],'where':_0x3f0271['options']?_0x3f0271['options'][_0x24a6('0xe')]||null:null,'attributes':_0x3f0271[_0x24a6('0xd')]?_0x3f0271['options'][_0x24a6('0xf')]||null:null,'include':_0x3f0271['options']?_0x3f0271['options'][_0x24a6('0x11')]?_['map'](_0x3f0271['options'][_0x24a6('0x11')],function(_0x54f76a){return{'model':db[_0x54f76a[_0x24a6('0x12')]],'as':_0x54f76a['as'],'attributes':_0x54f76a['attributes'],'include':_0x54f76a[_0x24a6('0x11')]?_[_0x24a6('0x13')](_0x54f76a['include'],function(_0x30969c){return{'model':db[_0x30969c['model']],'as':_0x30969c['as'],'attributes':_0x30969c[_0x24a6('0xf')],'include':_0x30969c[_0x24a6('0x11')]?_['map'](_0x30969c[_0x24a6('0x11')],function(_0x22e621){return{'model':db[_0x22e621[_0x24a6('0x12')]],'as':_0x22e621['as'],'attributes':_0x22e621['attributes']};}):[]};}):[]};}):[]:[]})[_0x24a6('0x14')](function(_0x2aad5a){logger[_0x24a6('0x15')](_0x24a6('0x1a'),_0x3f0271);logger['debug'](_0x24a6('0x1a'),_0x3f0271,JSON[_0x24a6('0x1c')](_0x2aad5a));_0x162e82(_0x2aad5a);})[_0x24a6('0x17')](function(_0x3a15fc){logger[_0x24a6('0x18')]('ShowSquareProject',_0x3a15fc['message'],_0x3f0271);_0x4c4f31(_0xdc5b5b[_0x24a6('0x18')](0x1f4,_0x3a15fc[_0x24a6('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 0f9b2b8..05da79f 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 _0x4885=['removeListener','register','squareProject:','./squareProject.events','emit'];(function(_0x11caa3,_0x7f2ae6){var _0x4fb170=function(_0x568829){while(--_0x568829){_0x11caa3['push'](_0x11caa3['shift']());}};_0x4fb170(++_0x7f2ae6);}(_0x4885,0x116));var _0x5488=function(_0x149b68,_0x1a6a53){_0x149b68=_0x149b68-0x0;var _0x330e45=_0x4885[_0x149b68];return _0x330e45;};'use strict';var SquareProjectEvents=require(_0x5488('0x0'));var events=['save','remove','update'];function createListener(_0x246ba2,_0x537cc2){return function(_0x3cdc3b){_0x537cc2[_0x5488('0x1')](_0x246ba2,_0x3cdc3b);};}function removeListener(_0x2dba82,_0x45373e){return function(){SquareProjectEvents[_0x5488('0x2')](_0x2dba82,_0x45373e);};}exports[_0x5488('0x3')]=function(_0x57583d){for(var _0x11f309=0x0,_0x1c89a4=events['length'];_0x11f309<_0x1c89a4;_0x11f309++){var _0x7a44fa=events[_0x11f309];var _0x428c39=createListener(_0x5488('0x4')+_0x7a44fa,_0x57583d);SquareProjectEvents['on'](_0x7a44fa,_0x428c39);}}; \ No newline at end of file +var _0x220f=['removeListener','register','squareProject:','./squareProject.events','save','update','emit'];(function(_0x57882c,_0x465094){var _0x49c23a=function(_0x249df6){while(--_0x249df6){_0x57882c['push'](_0x57882c['shift']());}};_0x49c23a(++_0x465094);}(_0x220f,0x96));var _0xf220=function(_0x13eea0,_0x54229c){_0x13eea0=_0x13eea0-0x0;var _0x18fac4=_0x220f[_0x13eea0];return _0x18fac4;};'use strict';var SquareProjectEvents=require(_0xf220('0x0'));var events=[_0xf220('0x1'),'remove',_0xf220('0x2')];function createListener(_0x5241cc,_0x18dde9){return function(_0x172323){_0x18dde9[_0xf220('0x3')](_0x5241cc,_0x172323);};}function removeListener(_0x1e019e,_0x1a6e1f){return function(){SquareProjectEvents[_0xf220('0x4')](_0x1e019e,_0x1a6e1f);};}exports[_0xf220('0x5')]=function(_0x27890f){for(var _0x2e78d2=0x0,_0x267efe=events['length'];_0x2e78d2<_0x267efe;_0x2e78d2++){var _0x34ae2d=events[_0x2e78d2];var _0x341953=createListener(_0xf220('0x6')+_0x34ae2d,_0x27890f);SquareProjectEvents['on'](_0x34ae2d,_0x341953);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 6fe2ed5..affdd16 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 _0x814b=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','create','put','delete','destroy','exports'];(function(_0x2d93bc,_0x23cb72){var _0x2412d4=function(_0x3d8ff9){while(--_0x3d8ff9){_0x2d93bc['push'](_0x2d93bc['shift']());}};_0x2412d4(++_0x23cb72);}(_0x814b,0x1a2));var _0xb814=function(_0x1b1f88,_0x3fe1cb){_0x1b1f88=_0x1b1f88-0x0;var _0x5045b9=_0x814b[_0x1b1f88];return _0x5045b9;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0x10')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0x12')](_0xb814('0xc'),auth[_0xb814('0xb')](),controller['update']);router[_0xb814('0x13')]('/:id',auth[_0xb814('0xb')](),controller[_0xb814('0x14')]);module[_0xb814('0x15')]=router; \ No newline at end of file +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(_0x2f550c,_0x4f7b){var _0x3796c9=function(_0x93cecb){while(--_0x93cecb){_0x2f550c['push'](_0x2f550c['shift']());}};_0x3796c9(++_0x4f7b);}(_0x1cb9,0x14e));var _0x91cb=function(_0x3df2e2,_0x48a6f3){_0x3df2e2=_0x3df2e2-0x0;var _0x38b34c=_0x1cb9[_0x3df2e2];return _0x38b34c;};'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 diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 7e4673e..7aae61b 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 _0xa630=['substring','sequelize','exports','STRING','VIRTUAL','getDataValue','savePath'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa630,0xbe));var _0x0a63=function(_0x4aa52c,_0x555b4e){_0x4aa52c=_0x4aa52c-0x0;var _0xb5c1e6=_0xa630[_0x4aa52c];return _0xb5c1e6;};'use strict';var Sequelize=require(_0x0a63('0x0'));module[_0x0a63('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0a63('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x0a63('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x0a63('0x2')]},'dnid':{'type':Sequelize[_0x0a63('0x2')]},'projectName':{'type':Sequelize[_0x0a63('0x2')]},'saveName':{'type':Sequelize[_0x0a63('0x2')]},'filename':{'type':Sequelize[_0x0a63('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x0a63('0x3')],'get':function(){var _0x3d5f0b='';var _0xc2dcd7=this[_0x0a63('0x4')](_0x0a63('0x5'));if(_0xc2dcd7){_0x3d5f0b=_0xc2dcd7[_0x0a63('0x6')](_0xc2dcd7['lastIndexOf']('.'));}return _0x3d5f0b;}}}; \ No newline at end of file +var _0x7bae=['savePath','substring','lastIndexOf','STRING','VIRTUAL','getDataValue'];(function(_0x867b0a,_0x587ccf){var _0x137438=function(_0xbeafa6){while(--_0xbeafa6){_0x867b0a['push'](_0x867b0a['shift']());}};_0x137438(++_0x587ccf);}(_0x7bae,0x13b));var _0xe7ba=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x7bae[_0x56482c];return _0x5aae7a;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xe7ba('0x0')]},'callerid':{'type':Sequelize[_0xe7ba('0x0')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xe7ba('0x0')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xe7ba('0x0')]},'accountcode':{'type':Sequelize[_0xe7ba('0x0')]},'dnid':{'type':Sequelize[_0xe7ba('0x0')]},'projectName':{'type':Sequelize[_0xe7ba('0x0')]},'saveName':{'type':Sequelize[_0xe7ba('0x0')]},'filename':{'type':Sequelize[_0xe7ba('0x0')]},'savePath':{'type':Sequelize[_0xe7ba('0x0')]},'format':{'type':Sequelize[_0xe7ba('0x1')],'get':function(){var _0x10b307='';var _0x34fb18=this[_0xe7ba('0x2')](_0xe7ba('0x3'));if(_0x34fb18){_0x10b307=_0x34fb18[_0xe7ba('0x4')](_0x34fb18[_0xe7ba('0x5')]('.'));}return _0x10b307;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 9b1c632..b794689 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 _0x35c2=['destroy','end','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','SquareRecording','includeAll','include','findAll','rows','catch','show','params','create','body','download','../../components/encryptor','uniqueid','find','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','isNil','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','apply','reject','save','update','then'];(function(_0x2e212c,_0x42b6c0){var _0x27ebf3=function(_0x5425de){while(--_0x5425de){_0x2e212c['push'](_0x2e212c['shift']());}};_0x27ebf3(++_0x42b6c0);}(_0x35c2,0xa4));var _0x235c=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x35c2[_0x27af45];return _0x18df21;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x235c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x235c('0x1'));var moment=require(_0x235c('0x2'));var BPromise=require(_0x235c('0x3'));var Mustache=require('mustache');var util=require(_0x235c('0x4'));var path=require(_0x235c('0x5'));var sox=require(_0x235c('0x6'));var csv=require(_0x235c('0x7'));var ejs=require(_0x235c('0x8'));var fs=require('fs');var fs_extra=require(_0x235c('0x9'));var _=require(_0x235c('0xa'));var squel=require(_0x235c('0xb'));var crypto=require(_0x235c('0xc'));var jsforce=require(_0x235c('0xd'));var deskjs=require(_0x235c('0xe'));var toCsv=require(_0x235c('0x7'));var querystring=require(_0x235c('0xf'));var Papa=require(_0x235c('0x10'));var Redis=require(_0x235c('0x11'));var authService=require(_0x235c('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x235c('0x13'))(_0x235c('0x14'));var utils=require(_0x235c('0x15'));var config=require(_0x235c('0x16'));var licenseUtil=require(_0x235c('0x17'));var db=require(_0x235c('0x18'))['db'];function respondWithStatusCode(_0x538ea3,_0x4471b0){_0x4471b0=_0x4471b0||0xcc;return function(_0x20a4cc){if(_0x20a4cc){return _0x538ea3[_0x235c('0x19')](_0x4471b0);}return _0x538ea3[_0x235c('0x1a')](_0x4471b0)['end']();};}function respondWithResult(_0x175e33,_0x1dd253){_0x1dd253=_0x1dd253||0xc8;return function(_0x2ba211){if(_0x2ba211){return _0x175e33[_0x235c('0x1a')](_0x1dd253)[_0x235c('0x1b')](_0x2ba211);}};}function respondWithFilteredResult(_0x1cac91,_0x97a284){return function(_0x836d4b){if(_0x836d4b){var _0xf10e5d=typeof _0x97a284[_0x235c('0x1c')]===_0x235c('0x1d')&&typeof _0x97a284['limit']===_0x235c('0x1d');var _0x5d1555=_0x836d4b[_0x235c('0x1e')];var _0x5e3fcf=_0xf10e5d?0x0:_0x97a284[_0x235c('0x1c')];var _0x57c8c7=_0xf10e5d?_0x836d4b[_0x235c('0x1e')]:_0x97a284[_0x235c('0x1c')]+_0x97a284['limit'];var _0x34b5da;if(_0x57c8c7>=_0x5d1555){_0x57c8c7=_0x5d1555;_0x34b5da=0xc8;}else{_0x34b5da=0xce;}_0x1cac91[_0x235c('0x1a')](_0x34b5da);return _0x1cac91['set']('Content-Range',_0x5e3fcf+'-'+_0x57c8c7+'/'+_0x5d1555)[_0x235c('0x1b')](_0x836d4b);}return null;};}function patchUpdates(_0x2eb248){return function(_0x431435){try{jsonpatch[_0x235c('0x1f')](_0x431435,_0x2eb248,!![]);}catch(_0xe6ff7c){return BPromise[_0x235c('0x20')](_0xe6ff7c);}return _0x431435[_0x235c('0x21')]();};}function saveUpdates(_0x591a65,_0x4111e5){return function(_0x5ef25c){if(_0x5ef25c){return _0x5ef25c[_0x235c('0x22')](_0x591a65)[_0x235c('0x23')](function(_0x4bfcc8){return _0x4bfcc8;});}return null;};}function removeEntity(_0x643c6b,_0x209446){return function(_0x34b675){if(_0x34b675){return _0x34b675[_0x235c('0x24')]()[_0x235c('0x23')](function(){_0x643c6b[_0x235c('0x1a')](0xcc)[_0x235c('0x25')]();});}};}function handleEntityNotFound(_0x23fedf,_0x5d166d){return function(_0x2d4650){if(!_0x2d4650){_0x23fedf[_0x235c('0x19')](0x194);}return _0x2d4650;};}function handleError(_0x472f89,_0x4e4c1c){_0x4e4c1c=_0x4e4c1c||0x1f4;return function(_0x53e4c6){logger[_0x235c('0x26')](_0x53e4c6[_0x235c('0x27')]);if(_0x53e4c6['name']){delete _0x53e4c6[_0x235c('0x28')];}_0x472f89[_0x235c('0x1a')](_0x4e4c1c)[_0x235c('0x29')](_0x53e4c6);};}exports['index']=function(_0x5db709,_0x4e8d25){var _0x56232e={},_0x5c3a7f={},_0x2a41b9={'count':0x0,'rows':[]};var _0x510f20=_[_0x235c('0x2a')](db['SquareRecording'][_0x235c('0x2b')],function(_0x64c23c){return{'name':_0x64c23c[_0x235c('0x2c')],'type':_0x64c23c[_0x235c('0x2d')][_0x235c('0x2e')]};});_0x5c3a7f[_0x235c('0x2f')]=_['map'](_0x510f20,'name');_0x5c3a7f[_0x235c('0x30')]=_[_0x235c('0x31')](_0x5db709[_0x235c('0x30')]);_0x5c3a7f[_0x235c('0x32')]=_[_0x235c('0x33')](_0x5c3a7f[_0x235c('0x2f')],_0x5c3a7f[_0x235c('0x30')]);_0x56232e[_0x235c('0x34')]=_['intersection'](_0x5c3a7f[_0x235c('0x2f')],qs[_0x235c('0x35')](_0x5db709[_0x235c('0x30')][_0x235c('0x35')]));_0x56232e[_0x235c('0x34')]=_0x56232e[_0x235c('0x34')][_0x235c('0x36')]?_0x56232e[_0x235c('0x34')]:_0x5c3a7f[_0x235c('0x2f')];if(!_0x5db709[_0x235c('0x30')]['hasOwnProperty'](_0x235c('0x37'))){_0x56232e[_0x235c('0x38')]=qs[_0x235c('0x38')](_0x5db709[_0x235c('0x30')][_0x235c('0x38')]);_0x56232e[_0x235c('0x1c')]=qs[_0x235c('0x1c')](_0x5db709[_0x235c('0x30')]['offset']);}_0x56232e[_0x235c('0x39')]=qs['sort'](_0x5db709['query'][_0x235c('0x3a')]);_0x56232e[_0x235c('0x3b')]=qs['filters'](_[_0x235c('0x3c')](_0x5db709[_0x235c('0x30')],_0x5c3a7f[_0x235c('0x32')]),_0x510f20);if(_0x5db709['query'][_0x235c('0x3d')]){_0x56232e[_0x235c('0x3b')]=_[_0x235c('0x3e')](_0x56232e[_0x235c('0x3b')],{'$or':_[_0x235c('0x2a')](_0x510f20,function(_0x3533a6){if(_0x3533a6['type']!==_0x235c('0x3f')){var _0x49c67d={};_0x49c67d[_0x3533a6[_0x235c('0x28')]]={'$like':'%'+_0x5db709[_0x235c('0x30')][_0x235c('0x3d')]+'%'};return _0x49c67d;}})});}_0x56232e=_[_0x235c('0x3e')]({},_0x56232e,_0x5db709[_0x235c('0x40')]);var _0x4ca28e={'where':_0x56232e[_0x235c('0x3b')]};return db[_0x235c('0x41')]['count'](_0x4ca28e)['then'](function(_0x4ee7eb){_0x2a41b9[_0x235c('0x1e')]=_0x4ee7eb;if(_0x5db709[_0x235c('0x30')][_0x235c('0x42')]){_0x56232e[_0x235c('0x43')]=[{'all':!![]}];}return db[_0x235c('0x41')][_0x235c('0x44')](_0x56232e);})[_0x235c('0x23')](function(_0x473bbe){_0x2a41b9[_0x235c('0x45')]=_0x473bbe;return _0x2a41b9;})[_0x235c('0x23')](respondWithFilteredResult(_0x4e8d25,_0x56232e))[_0x235c('0x46')](handleError(_0x4e8d25,null));};exports[_0x235c('0x47')]=function(_0x1d64b0,_0x11c228){var _0x4bfc8f={'raw':!![],'where':{'id':_0x1d64b0[_0x235c('0x48')]['id']}},_0x2b071b={};_0x2b071b['model']=_['keys'](db[_0x235c('0x41')][_0x235c('0x2b')]);_0x2b071b['query']=_[_0x235c('0x31')](_0x1d64b0[_0x235c('0x30')]);_0x2b071b[_0x235c('0x32')]=_['intersection'](_0x2b071b[_0x235c('0x2f')],_0x2b071b[_0x235c('0x30')]);_0x4bfc8f[_0x235c('0x34')]=_[_0x235c('0x33')](_0x2b071b[_0x235c('0x2f')],qs[_0x235c('0x35')](_0x1d64b0[_0x235c('0x30')][_0x235c('0x35')]));_0x4bfc8f['attributes']=_0x4bfc8f[_0x235c('0x34')]['length']?_0x4bfc8f[_0x235c('0x34')]:_0x2b071b[_0x235c('0x2f')];if(_0x1d64b0[_0x235c('0x30')]['includeAll']){_0x4bfc8f[_0x235c('0x43')]=[{'all':!![]}];}_0x4bfc8f=_[_0x235c('0x3e')]({},_0x4bfc8f,_0x1d64b0[_0x235c('0x40')]);return db[_0x235c('0x41')]['find'](_0x4bfc8f)['then'](handleEntityNotFound(_0x11c228,null))[_0x235c('0x23')](respondWithResult(_0x11c228,null))[_0x235c('0x46')](handleError(_0x11c228,null));};exports[_0x235c('0x49')]=function(_0x4d1553,_0x3ba850){return db[_0x235c('0x41')][_0x235c('0x49')](_0x4d1553[_0x235c('0x4a')],{})['then'](respondWithResult(_0x3ba850,0xc9))[_0x235c('0x46')](handleError(_0x3ba850,null));};exports[_0x235c('0x22')]=function(_0x20107c,_0x3ceb26){if(_0x20107c[_0x235c('0x4a')]['id']){delete _0x20107c['body']['id'];}return db['SquareRecording']['find']({'where':{'id':_0x20107c[_0x235c('0x48')]['id']}})[_0x235c('0x23')](handleEntityNotFound(_0x3ceb26,null))['then'](saveUpdates(_0x20107c[_0x235c('0x4a')],null))[_0x235c('0x23')](respondWithResult(_0x3ceb26,null))[_0x235c('0x46')](handleError(_0x3ceb26,null));};exports[_0x235c('0x4b')]=function(_0x5d4935,_0x7184e3,_0x1daafa){var _0x5be574=require(_0x235c('0x4c'));var _0x4a0c47=![];var _0x4a2894={};if(_0x5d4935[_0x235c('0x30')][_0x235c('0x2d')]&&_0x5d4935['query'][_0x235c('0x2d')]===_0x235c('0x4d')){_0x4a2894[_0x235c('0x4d')]=_0x5d4935[_0x235c('0x48')]['id'];}else{_0x4a2894['id']=_0x5d4935[_0x235c('0x48')]['id'];}return db[_0x235c('0x41')][_0x235c('0x4e')]({'where':_0x4a2894,'attributes':['id',_0x235c('0x4f'),_0x235c('0x50')],'raw':!![]})[_0x235c('0x23')](handleEntityNotFound(_0x7184e3,null))['then'](function(_0x2dcb92){if(_0x2dcb92){var _0x293fc2=_0x2dcb92[_0x235c('0x4f')];var _0x332c3b=util[_0x235c('0x51')](_0x235c('0x52'),_0x293fc2);if(fs[_0x235c('0x53')](_0x332c3b)){_0x4a0c47=!![];return _0x5be574[_0x235c('0x54')](_0x332c3b,_0x293fc2,config[_0x235c('0x55')]['recording'])[_0x235c('0x23')](function(){return _0x2dcb92;});}return _0x2dcb92;}})[_0x235c('0x23')](function(_0x24cd9b){if(_0x24cd9b){var _0x4d198b=_0x24cd9b['savePath'];if(!fs['existsSync'](_0x4d198b)){throw new db[(_0x235c('0x56'))][(_0x235c('0x57'))](_0x235c('0x58'));}if(_0x24cd9b[_0x235c('0x50')]){return _0x7184e3[_0x235c('0x4b')](_0x4d198b,_0x24cd9b[_0x235c('0x50')]+path[_0x235c('0x59')](_0x4d198b),function(){if(_0x4a0c47){fs[_0x235c('0x5a')](_0x4d198b);}});}else{return _0x7184e3['download'](_0x4d198b,function(_0x3d5f00){if(_0x4a0c47){fs[_0x235c('0x5a')](_0x4d198b);}});}}})[_0x235c('0x46')](function(_0x885730){if(_0x885730[_0x235c('0x5b')]===_0x235c('0x58')){_0x7184e3[_0x235c('0x1a')](0x194)[_0x235c('0x29')](_0x235c('0x5c'));}else{return handleError(_0x7184e3,null);}});};exports[_0x235c('0x24')]=function(_0x497ab7,_0x181a9c){return db['SquareRecording'][_0x235c('0x4e')]({'where':{'id':_0x497ab7[_0x235c('0x48')]['id']}})[_0x235c('0x23')](function(_0x4e1740){if(_['isNil'](_0x4e1740)){throw new ReferenceError(_0x235c('0x5d'));}return _0x4e1740;})[_0x235c('0x23')](function(_0x227d8f){var _0x4820da=_0x227d8f[_0x235c('0x4f')];logger[_0x235c('0x5e')](_0x235c('0x5f'),_0x4820da);if(!_['isNil'](_0x227d8f[_0x235c('0x4f')])&&fs[_0x235c('0x53')](_0x4820da)){logger[_0x235c('0x5e')](_0x235c('0x60')+_0x4820da+_0x235c('0x61'));fs[_0x235c('0x62')](_0x4820da);}_0x4820da=_0x4820da+'.cypher';if(!_[_0x235c('0x63')](_0x227d8f[_0x235c('0x4f')])&&fs[_0x235c('0x53')](_0x4820da)){logger[_0x235c('0x5e')]('File:\x20\x22'+_0x4820da+_0x235c('0x61'));fs[_0x235c('0x62')](_0x4820da);}return _0x227d8f;})[_0x235c('0x23')](function(_0x29c82a){if(!_0x29c82a)throw new InternalError();return _0x29c82a[_0x235c('0x24')]();})[_0x235c('0x23')](function(){_0x181a9c[_0x235c('0x1a')](0xcc)[_0x235c('0x25')]();})[_0x235c('0x46')](handleError(_0x181a9c,null));}; \ No newline at end of file +var _0xcde0=['options','then','includeAll','findAll','rows','catch','show','params','include','find','create','body','download','../../components/encryptor','uniqueid','savePath','filename','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','extname','unlink','message','SquareRecording\x20not\x20found','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','File:\x20\x22','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','undefined','limit','count','offset','set','apply','save','update','destroy','status','error','stack','name','map','SquareRecording','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL'];(function(_0x567f1b,_0x1992a0){var _0x19b2bf=function(_0x2538f6){while(--_0x2538f6){_0x567f1b['push'](_0x567f1b['shift']());}};_0x19b2bf(++_0x1992a0);}(_0xcde0,0x149));var _0x0cde=function(_0x1f8957,_0xaab60f){_0x1f8957=_0x1f8957-0x0;var _0x517502=_0xcde0[_0x1f8957];return _0x517502;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0cde('0x0'));var zipdir=require(_0x0cde('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0cde('0x2'));var moment=require(_0x0cde('0x3'));var BPromise=require(_0x0cde('0x4'));var Mustache=require(_0x0cde('0x5'));var util=require(_0x0cde('0x6'));var path=require(_0x0cde('0x7'));var sox=require('sox');var csv=require(_0x0cde('0x8'));var ejs=require(_0x0cde('0x9'));var fs=require('fs');var fs_extra=require(_0x0cde('0xa'));var _=require('lodash');var squel=require(_0x0cde('0xb'));var crypto=require(_0x0cde('0xc'));var jsforce=require(_0x0cde('0xd'));var deskjs=require(_0x0cde('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0cde('0xf'));var Papa=require(_0x0cde('0x10'));var Redis=require(_0x0cde('0x11'));var authService=require(_0x0cde('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0cde('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0cde('0x14'))(_0x0cde('0x15'));var utils=require(_0x0cde('0x16'));var config=require(_0x0cde('0x17'));var licenseUtil=require(_0x0cde('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a730f,_0x38cc58){_0x38cc58=_0x38cc58||0xcc;return function(_0x14d305){if(_0x14d305){return _0x2a730f[_0x0cde('0x19')](_0x38cc58);}return _0x2a730f['status'](_0x38cc58)[_0x0cde('0x1a')]();};}function respondWithResult(_0x5d0a42,_0x562eda){_0x562eda=_0x562eda||0xc8;return function(_0x521cf9){if(_0x521cf9){return _0x5d0a42['status'](_0x562eda)[_0x0cde('0x1b')](_0x521cf9);}};}function respondWithFilteredResult(_0xdeb8f8,_0x17fcfa){return function(_0x30c370){if(_0x30c370){var _0x833878=typeof _0x17fcfa['offset']===_0x0cde('0x1c')&&typeof _0x17fcfa[_0x0cde('0x1d')]===_0x0cde('0x1c');var _0x4d349a=_0x30c370[_0x0cde('0x1e')];var _0x57ae12=_0x833878?0x0:_0x17fcfa[_0x0cde('0x1f')];var _0x141ccd=_0x833878?_0x30c370[_0x0cde('0x1e')]:_0x17fcfa[_0x0cde('0x1f')]+_0x17fcfa[_0x0cde('0x1d')];var _0xef954;if(_0x141ccd>=_0x4d349a){_0x141ccd=_0x4d349a;_0xef954=0xc8;}else{_0xef954=0xce;}_0xdeb8f8['status'](_0xef954);return _0xdeb8f8[_0x0cde('0x20')]('Content-Range',_0x57ae12+'-'+_0x141ccd+'/'+_0x4d349a)['json'](_0x30c370);}return null;};}function patchUpdates(_0x2dbb53){return function(_0x1ef3fe){try{jsonpatch[_0x0cde('0x21')](_0x1ef3fe,_0x2dbb53,!![]);}catch(_0x74f857){return BPromise['reject'](_0x74f857);}return _0x1ef3fe[_0x0cde('0x22')]();};}function saveUpdates(_0x5deee3,_0x378c3b){return function(_0x25e37a){if(_0x25e37a){return _0x25e37a[_0x0cde('0x23')](_0x5deee3)['then'](function(_0x570fc7){return _0x570fc7;});}return null;};}function removeEntity(_0x4caaa7,_0x124255){return function(_0x148ffc){if(_0x148ffc){return _0x148ffc[_0x0cde('0x24')]()['then'](function(){_0x4caaa7[_0x0cde('0x25')](0xcc)[_0x0cde('0x1a')]();});}};}function handleEntityNotFound(_0x2aa90b,_0x28301b){return function(_0xc84575){if(!_0xc84575){_0x2aa90b['sendStatus'](0x194);}return _0xc84575;};}function handleError(_0x3a91ef,_0x17cbda){_0x17cbda=_0x17cbda||0x1f4;return function(_0x1b6413){logger[_0x0cde('0x26')](_0x1b6413[_0x0cde('0x27')]);if(_0x1b6413[_0x0cde('0x28')]){delete _0x1b6413['name'];}_0x3a91ef[_0x0cde('0x25')](_0x17cbda)['send'](_0x1b6413);};}exports['index']=function(_0x162a34,_0x11faca){var _0x2d2a53={},_0x2fdbb6={},_0x5a9de5={'count':0x0,'rows':[]};var _0x1cdafd=_[_0x0cde('0x29')](db[_0x0cde('0x2a')][_0x0cde('0x2b')],function(_0x462db3){return{'name':_0x462db3[_0x0cde('0x2c')],'type':_0x462db3[_0x0cde('0x2d')][_0x0cde('0x2e')]};});_0x2fdbb6[_0x0cde('0x2f')]=_['map'](_0x1cdafd,_0x0cde('0x28'));_0x2fdbb6['query']=_[_0x0cde('0x30')](_0x162a34[_0x0cde('0x31')]);_0x2fdbb6[_0x0cde('0x32')]=_['intersection'](_0x2fdbb6[_0x0cde('0x2f')],_0x2fdbb6['query']);_0x2d2a53['attributes']=_[_0x0cde('0x33')](_0x2fdbb6['model'],qs[_0x0cde('0x34')](_0x162a34[_0x0cde('0x31')][_0x0cde('0x34')]));_0x2d2a53[_0x0cde('0x35')]=_0x2d2a53[_0x0cde('0x35')][_0x0cde('0x36')]?_0x2d2a53['attributes']:_0x2fdbb6[_0x0cde('0x2f')];if(!_0x162a34[_0x0cde('0x31')][_0x0cde('0x37')](_0x0cde('0x38'))){_0x2d2a53[_0x0cde('0x1d')]=qs[_0x0cde('0x1d')](_0x162a34['query'][_0x0cde('0x1d')]);_0x2d2a53[_0x0cde('0x1f')]=qs[_0x0cde('0x1f')](_0x162a34[_0x0cde('0x31')][_0x0cde('0x1f')]);}_0x2d2a53[_0x0cde('0x39')]=qs[_0x0cde('0x3a')](_0x162a34[_0x0cde('0x31')]['sort']);_0x2d2a53[_0x0cde('0x3b')]=qs[_0x0cde('0x32')](_['pick'](_0x162a34[_0x0cde('0x31')],_0x2fdbb6[_0x0cde('0x32')]),_0x1cdafd);if(_0x162a34[_0x0cde('0x31')][_0x0cde('0x3c')]){_0x2d2a53[_0x0cde('0x3b')]=_[_0x0cde('0x3d')](_0x2d2a53[_0x0cde('0x3b')],{'$or':_[_0x0cde('0x29')](_0x1cdafd,function(_0x6c9264){if(_0x6c9264['type']!==_0x0cde('0x3e')){var _0x5b1be1={};_0x5b1be1[_0x6c9264[_0x0cde('0x28')]]={'$like':'%'+_0x162a34['query'][_0x0cde('0x3c')]+'%'};return _0x5b1be1;}})});}_0x2d2a53=_[_0x0cde('0x3d')]({},_0x2d2a53,_0x162a34[_0x0cde('0x3f')]);var _0x406743={'where':_0x2d2a53[_0x0cde('0x3b')]};return db[_0x0cde('0x2a')][_0x0cde('0x1e')](_0x406743)[_0x0cde('0x40')](function(_0x489b93){_0x5a9de5[_0x0cde('0x1e')]=_0x489b93;if(_0x162a34[_0x0cde('0x31')][_0x0cde('0x41')]){_0x2d2a53['include']=[{'all':!![]}];}return db['SquareRecording'][_0x0cde('0x42')](_0x2d2a53);})[_0x0cde('0x40')](function(_0x2e45d0){_0x5a9de5[_0x0cde('0x43')]=_0x2e45d0;return _0x5a9de5;})[_0x0cde('0x40')](respondWithFilteredResult(_0x11faca,_0x2d2a53))[_0x0cde('0x44')](handleError(_0x11faca,null));};exports[_0x0cde('0x45')]=function(_0x26dfae,_0x36f692){var _0x13fe05={'raw':!![],'where':{'id':_0x26dfae[_0x0cde('0x46')]['id']}},_0x42fdd={};_0x42fdd[_0x0cde('0x2f')]=_[_0x0cde('0x30')](db['SquareRecording']['rawAttributes']);_0x42fdd[_0x0cde('0x31')]=_[_0x0cde('0x30')](_0x26dfae[_0x0cde('0x31')]);_0x42fdd[_0x0cde('0x32')]=_[_0x0cde('0x33')](_0x42fdd[_0x0cde('0x2f')],_0x42fdd[_0x0cde('0x31')]);_0x13fe05[_0x0cde('0x35')]=_[_0x0cde('0x33')](_0x42fdd[_0x0cde('0x2f')],qs[_0x0cde('0x34')](_0x26dfae[_0x0cde('0x31')]['fields']));_0x13fe05[_0x0cde('0x35')]=_0x13fe05[_0x0cde('0x35')][_0x0cde('0x36')]?_0x13fe05[_0x0cde('0x35')]:_0x42fdd[_0x0cde('0x2f')];if(_0x26dfae[_0x0cde('0x31')][_0x0cde('0x41')]){_0x13fe05[_0x0cde('0x47')]=[{'all':!![]}];}_0x13fe05=_[_0x0cde('0x3d')]({},_0x13fe05,_0x26dfae['options']);return db[_0x0cde('0x2a')][_0x0cde('0x48')](_0x13fe05)[_0x0cde('0x40')](handleEntityNotFound(_0x36f692,null))[_0x0cde('0x40')](respondWithResult(_0x36f692,null))['catch'](handleError(_0x36f692,null));};exports['create']=function(_0x489f25,_0x5d32ee){return db['SquareRecording'][_0x0cde('0x49')](_0x489f25[_0x0cde('0x4a')],{})[_0x0cde('0x40')](respondWithResult(_0x5d32ee,0xc9))[_0x0cde('0x44')](handleError(_0x5d32ee,null));};exports[_0x0cde('0x23')]=function(_0x9e5e81,_0x1e7cbe){if(_0x9e5e81['body']['id']){delete _0x9e5e81[_0x0cde('0x4a')]['id'];}return db[_0x0cde('0x2a')][_0x0cde('0x48')]({'where':{'id':_0x9e5e81[_0x0cde('0x46')]['id']}})[_0x0cde('0x40')](handleEntityNotFound(_0x1e7cbe,null))[_0x0cde('0x40')](saveUpdates(_0x9e5e81[_0x0cde('0x4a')],null))[_0x0cde('0x40')](respondWithResult(_0x1e7cbe,null))[_0x0cde('0x44')](handleError(_0x1e7cbe,null));};exports[_0x0cde('0x4b')]=function(_0x1d7cff,_0x20a5f8,_0x262219){var _0x44b18d=require(_0x0cde('0x4c'));var _0x191d27=![];var _0x493bd2={};if(_0x1d7cff[_0x0cde('0x31')]['type']&&_0x1d7cff['query'][_0x0cde('0x2d')]===_0x0cde('0x4d')){_0x493bd2[_0x0cde('0x4d')]=_0x1d7cff[_0x0cde('0x46')]['id'];}else{_0x493bd2['id']=_0x1d7cff[_0x0cde('0x46')]['id'];}return db[_0x0cde('0x2a')]['find']({'where':_0x493bd2,'attributes':['id',_0x0cde('0x4e'),_0x0cde('0x4f')],'raw':!![]})[_0x0cde('0x40')](handleEntityNotFound(_0x20a5f8,null))[_0x0cde('0x40')](function(_0x395de4){if(_0x395de4){var _0x4cc603=_0x395de4[_0x0cde('0x4e')];var _0x21cf88=util['format'](_0x0cde('0x50'),_0x4cc603);if(fs[_0x0cde('0x51')](_0x21cf88)){_0x191d27=!![];return _0x44b18d[_0x0cde('0x52')](_0x21cf88,_0x4cc603,config[_0x0cde('0x53')][_0x0cde('0x54')])['then'](function(){return _0x395de4;});}return _0x395de4;}})[_0x0cde('0x40')](function(_0x315b62){if(_0x315b62){var _0x5b9c86=_0x315b62['savePath'];if(!fs[_0x0cde('0x51')](_0x5b9c86)){throw new db[(_0x0cde('0x55'))][(_0x0cde('0x56'))]('SquareRecording\x20not\x20found');}if(_0x315b62[_0x0cde('0x4f')]){return _0x20a5f8[_0x0cde('0x4b')](_0x5b9c86,_0x315b62[_0x0cde('0x4f')]+path[_0x0cde('0x57')](_0x5b9c86),function(){if(_0x191d27){fs[_0x0cde('0x58')](_0x5b9c86);}});}else{return _0x20a5f8['download'](_0x5b9c86,function(_0xfa8986){if(_0x191d27){fs['unlink'](_0x5b9c86);}});}}})[_0x0cde('0x44')](function(_0x2e2e47){if(_0x2e2e47[_0x0cde('0x59')]===_0x0cde('0x5a')){_0x20a5f8[_0x0cde('0x25')](0x194)['send'](_0x0cde('0x5b'));}else{return handleError(_0x20a5f8,null);}});};exports[_0x0cde('0x24')]=function(_0x279887,_0x17d15b){return db[_0x0cde('0x2a')][_0x0cde('0x48')]({'where':{'id':_0x279887[_0x0cde('0x46')]['id']}})[_0x0cde('0x40')](function(_0x20ad29){if(_[_0x0cde('0x5c')](_0x20ad29)){throw new ReferenceError('Entity\x20not\x20found');}return _0x20ad29;})['then'](function(_0x2b4da4){var _0x1f66b9=_0x2b4da4[_0x0cde('0x4e')];logger[_0x0cde('0x5d')](_0x0cde('0x5e'),_0x1f66b9);if(!_[_0x0cde('0x5c')](_0x2b4da4[_0x0cde('0x4e')])&&fs['existsSync'](_0x1f66b9)){logger[_0x0cde('0x5d')]('File:\x20\x22'+_0x1f66b9+_0x0cde('0x5f'));fs[_0x0cde('0x60')](_0x1f66b9);}_0x1f66b9=_0x1f66b9+'.cypher';if(!_[_0x0cde('0x5c')](_0x2b4da4[_0x0cde('0x4e')])&&fs['existsSync'](_0x1f66b9)){logger[_0x0cde('0x5d')](_0x0cde('0x61')+_0x1f66b9+_0x0cde('0x5f'));fs[_0x0cde('0x60')](_0x1f66b9);}return _0x2b4da4;})[_0x0cde('0x40')](function(_0x1757a1){if(!_0x1757a1)throw new InternalError();return _0x1757a1[_0x0cde('0x24')]();})[_0x0cde('0x40')](function(){_0x17d15b[_0x0cde('0x25')](0xcc)[_0x0cde('0x1a')]();})[_0x0cde('0x44')](handleError(_0x17d15b,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 4d3ebe5..63cfa07 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 _0x5a4f=['./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x33b1b2,_0x1051a4){var _0x4664c2=function(_0x575425){while(--_0x575425){_0x33b1b2['push'](_0x33b1b2['shift']());}};_0x4664c2(++_0x1051a4);}(_0x5a4f,0x10d));var _0xf5a4=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0x5a4f[_0xc67528];return _0x38e26d;};'use strict';var _=require(_0xf5a4('0x0'));var util=require('util');var logger=require(_0xf5a4('0x1'))('api');var moment=require(_0xf5a4('0x2'));var BPromise=require('bluebird');var rp=require(_0xf5a4('0x3'));var fs=require('fs');var path=require(_0xf5a4('0x4'));var rimraf=require(_0xf5a4('0x5'));var config=require(_0xf5a4('0x6'));var attributes=require(_0xf5a4('0x7'));module[_0xf5a4('0x8')]=function(_0x431162,_0x5d2a8c){return _0x431162[_0xf5a4('0x9')](_0xf5a4('0xa'),attributes,{'tableName':_0xf5a4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4819=['square_recordings','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','SquareRecording'];(function(_0x183159,_0x299719){var _0x42f764=function(_0x1bcafb){while(--_0x1bcafb){_0x183159['push'](_0x183159['shift']());}};_0x42f764(++_0x299719);}(_0x4819,0xcd));var _0x9481=function(_0x32b30c,_0x2d5ec8){_0x32b30c=_0x32b30c-0x0;var _0xcfc212=_0x4819[_0x32b30c];return _0xcfc212;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var logger=require(_0x9481('0x1'))(_0x9481('0x2'));var moment=require(_0x9481('0x3'));var BPromise=require(_0x9481('0x4'));var rp=require(_0x9481('0x5'));var fs=require('fs');var path=require(_0x9481('0x6'));var rimraf=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var attributes=require(_0x9481('0x9'));module['exports']=function(_0x4d9e3a,_0x5def07){return _0x4d9e3a['define'](_0x9481('0xa'),attributes,{'tableName':_0x9481('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 10869fe..1ca6ea9 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 _0x21f0=['../../config/environment','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','stringify','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x590a52,_0x375773){var _0x3f8dd4=function(_0x514839){while(--_0x514839){_0x590a52['push'](_0x590a52['shift']());}};_0x3f8dd4(++_0x375773);}(_0x21f0,0x174));var _0x021f=function(_0x2f0d47,_0x1a0c12){_0x2f0d47=_0x2f0d47-0x0;var _0x242ded=_0x21f0[_0x2f0d47];return _0x242ded;};'use strict';var _=require('lodash');var util=require(_0x021f('0x0'));var moment=require(_0x021f('0x1'));var BPromise=require(_0x021f('0x2'));var rs=require(_0x021f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x021f('0x4'))['db'];var utils=require(_0x021f('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x021f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x021f('0x7')][_0x021f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5ed895,_0x42d20b,_0x225a52){return new BPromise(function(_0x11302c,_0x5788a6){return client[_0x021f('0x9')](_0x5ed895,_0x225a52)[_0x021f('0xa')](function(_0x1518e9){logger[_0x021f('0xb')](_0x021f('0xc'),_0x42d20b,_0x021f('0xd'));logger['debug'](_0x021f('0xe'),_0x42d20b,_0x021f('0xd'),JSON['stringify'](_0x1518e9));if(_0x1518e9[_0x021f('0xf')]){if(_0x1518e9[_0x021f('0xf')][_0x021f('0x10')]===0x1f4){logger[_0x021f('0xf')]('SquareRecording,\x20%s,\x20%s',_0x42d20b,_0x1518e9[_0x021f('0xf')][_0x021f('0x11')]);return _0x5788a6(_0x1518e9[_0x021f('0xf')][_0x021f('0x11')]);}logger['error'](_0x021f('0xc'),_0x42d20b,_0x1518e9[_0x021f('0xf')][_0x021f('0x11')]);return _0x11302c(_0x1518e9[_0x021f('0xf')][_0x021f('0x11')]);}else{logger[_0x021f('0xb')](_0x021f('0xc'),_0x42d20b,_0x021f('0xd'));_0x11302c(_0x1518e9[_0x021f('0x12')][_0x021f('0x11')]);}})[_0x021f('0x13')](function(_0x4bf1cf){logger[_0x021f('0xf')](_0x021f('0xc'),_0x42d20b,_0x4bf1cf);_0x5788a6(_0x4bf1cf);});});}exports[_0x021f('0x14')]=function(_0x36de2f){var _0x5df801=this;return new Promise(function(_0x5eb785,_0x437660){return db[_0x021f('0x15')][_0x021f('0x16')](_0x36de2f[_0x021f('0x17')],{'raw':_0x36de2f[_0x021f('0x18')]?_0x36de2f[_0x021f('0x18')][_0x021f('0x19')]===undefined?!![]:![]:!![]})[_0x021f('0xa')](function(_0x1a41a7){logger[_0x021f('0xb')](_0x021f('0x14'),_0x36de2f);logger['debug'](_0x021f('0x14'),_0x36de2f,JSON[_0x021f('0x1a')](_0x1a41a7));_0x5eb785(_0x1a41a7);})[_0x021f('0x13')](function(_0x3fbcb4){logger['error'](_0x021f('0x14'),_0x3fbcb4['message'],_0x36de2f);_0x437660(_0x5df801[_0x021f('0xf')](0x1f4,_0x3fbcb4[_0x021f('0x11')]));});});}; \ No newline at end of file +var _0xae8a=['request','info','SquareRecording,\x20%s,\x20%s','SquareRecording,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSquareRecording','SquareRecording','body','options','raw','then','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xae8a,0xcf));var _0xaae8=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xae8a[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0xaae8('0x0'));var util=require('util');var moment=require(_0xaae8('0x1'));var BPromise=require('bluebird');var rs=require(_0xaae8('0x2'));var fs=require('fs');var Redis=require(_0xaae8('0x3'));var db=require(_0xaae8('0x4'))['db'];var utils=require(_0xaae8('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xaae8('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xaae8('0x7')][_0xaae8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4d7f47,_0x29c018,_0x41019e){return new BPromise(function(_0x39b23d,_0x3807aa){return client[_0xaae8('0x9')](_0x4d7f47,_0x41019e)['then'](function(_0x2df71b){logger[_0xaae8('0xa')](_0xaae8('0xb'),_0x29c018,'request\x20sent');logger['debug'](_0xaae8('0xc'),_0x29c018,'request\x20sent',JSON['stringify'](_0x2df71b));if(_0x2df71b[_0xaae8('0xd')]){if(_0x2df71b[_0xaae8('0xd')][_0xaae8('0xe')]===0x1f4){logger[_0xaae8('0xd')](_0xaae8('0xb'),_0x29c018,_0x2df71b['error'][_0xaae8('0xf')]);return _0x3807aa(_0x2df71b[_0xaae8('0xd')][_0xaae8('0xf')]);}logger[_0xaae8('0xd')](_0xaae8('0xb'),_0x29c018,_0x2df71b[_0xaae8('0xd')][_0xaae8('0xf')]);return _0x39b23d(_0x2df71b[_0xaae8('0xd')][_0xaae8('0xf')]);}else{logger[_0xaae8('0xa')](_0xaae8('0xb'),_0x29c018,'request\x20sent');_0x39b23d(_0x2df71b[_0xaae8('0x10')][_0xaae8('0xf')]);}})[_0xaae8('0x11')](function(_0x584eea){logger['error'](_0xaae8('0xb'),_0x29c018,_0x584eea);_0x3807aa(_0x584eea);});});}exports[_0xaae8('0x12')]=function(_0x134b09){var _0x19a9fc=this;return new Promise(function(_0x42f6ec,_0x1ea0a3){return db[_0xaae8('0x13')]['create'](_0x134b09[_0xaae8('0x14')],{'raw':_0x134b09[_0xaae8('0x15')]?_0x134b09[_0xaae8('0x15')][_0xaae8('0x16')]===undefined?!![]:![]:!![]})[_0xaae8('0x17')](function(_0x15e5f3){logger['info']('CreateSquareRecording',_0x134b09);logger['debug'](_0xaae8('0x12'),_0x134b09,JSON['stringify'](_0x15e5f3));_0x42f6ec(_0x15e5f3);})[_0xaae8('0x11')](function(_0x4da7b4){logger['error'](_0xaae8('0x12'),_0x4da7b4[_0xaae8('0xf')],_0x134b09);_0x1ea0a3(_0x19a9fc['error'](0x1f4,_0x4da7b4[_0xaae8('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index b7f2ce9..06b087c 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x5b44ed,_0x4a4851){var _0x2f0615=function(_0x194aaf){while(--_0x194aaf){_0x5b44ed['push'](_0x5b44ed['shift']());}};_0x2f0615(++_0x4a4851);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaf0[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x323720,_0x308064){var _0x200623=function(_0x1aaf1f){while(--_0x1aaf1f){_0x323720['push'](_0x323720['shift']());}};_0x200623(++_0x308064);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index d180473..4c30463 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 _0x8df3=['BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x4511b1,_0x308bee){var _0x152171=function(_0x14a0a0){while(--_0x14a0a0){_0x4511b1['push'](_0x4511b1['shift']());}};_0x152171(++_0x308bee);}(_0x8df3,0x65));var _0x38df=function(_0x5307d6,_0x3829cd){_0x5307d6=_0x5307d6-0x0;var _0x2fe36d=_0x8df3[_0x5307d6];return _0x2fe36d;};'use strict';var Sequelize=require(_0x38df('0x0'));module[_0x38df('0x1')]={'network':{'type':Sequelize[_0x38df('0x2')]},'network_script':{'type':Sequelize[_0x38df('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x38df('0x2')]},'language':{'type':Sequelize[_0x38df('0x2')]},'type':{'type':Sequelize[_0x38df('0x2')]},'uniqueid':{'type':Sequelize[_0x38df('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x38df('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x38df('0x2')]},'callingani2':{'type':Sequelize[_0x38df('0x2')]},'callington':{'type':Sequelize[_0x38df('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x38df('0x2')]},'extension':{'type':Sequelize[_0x38df('0x2')]},'priority':{'type':Sequelize[_0x38df('0x2')]},'enhanced':{'type':Sequelize[_0x38df('0x2')]},'accountcode':{'type':Sequelize[_0x38df('0x2')]},'threadid':{'type':Sequelize[_0x38df('0x2')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x38df('0x3')]},'bot':{'type':Sequelize[_0x38df('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x3f62=['exports','STRING','DATE','BOOLEAN'];(function(_0x4aa21f,_0x441927){var _0x4055b8=function(_0x1b0f5c){while(--_0x1b0f5c){_0x4aa21f['push'](_0x4aa21f['shift']());}};_0x4055b8(++_0x441927);}(_0x3f62,0x144));var _0x23f6=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x3f62[_0x30ae5e];return _0x1f2e93;};'use strict';var Sequelize=require('sequelize');module[_0x23f6('0x0')]={'network':{'type':Sequelize[_0x23f6('0x1')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x23f6('0x1')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x23f6('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x23f6('0x1')]},'callerid':{'type':Sequelize[_0x23f6('0x1')]},'calleridname':{'type':Sequelize[_0x23f6('0x1')]},'callingpres':{'type':Sequelize[_0x23f6('0x1')]},'callingani2':{'type':Sequelize[_0x23f6('0x1')]},'callington':{'type':Sequelize[_0x23f6('0x1')]},'callingtns':{'type':Sequelize[_0x23f6('0x1')]},'dnid':{'type':Sequelize[_0x23f6('0x1')]},'rdnis':{'type':Sequelize[_0x23f6('0x1')]},'context':{'type':Sequelize[_0x23f6('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x23f6('0x1')]},'enhanced':{'type':Sequelize[_0x23f6('0x1')]},'accountcode':{'type':Sequelize[_0x23f6('0x1')]},'threadid':{'type':Sequelize[_0x23f6('0x1')]},'project_name':{'type':Sequelize[_0x23f6('0x1')]},'joinAt':{'type':Sequelize[_0x23f6('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x23f6('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 fd68dcf..84b3e64 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 _0x8c4d=['fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','limit','undefined','count','offset','json','reject','save','update','then','end','error','name','map','SquareReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox'];(function(_0x2e9c7e,_0x516020){var _0x471e05=function(_0x208138){while(--_0x208138){_0x2e9c7e['push'](_0x2e9c7e['shift']());}};_0x471e05(++_0x516020);}(_0x8c4d,0x112));var _0xd8c4=function(_0x458f49,_0x1a1af1){_0x458f49=_0x458f49-0x0;var _0x36e8c9=_0x8c4d[_0x458f49];return _0x36e8c9;};'use strict';var emlformat=require(_0xd8c4('0x0'));var rimraf=require(_0xd8c4('0x1'));var zipdir=require(_0xd8c4('0x2'));var jsonpatch=require(_0xd8c4('0x3'));var rp=require('request-promise');var moment=require(_0xd8c4('0x4'));var BPromise=require(_0xd8c4('0x5'));var Mustache=require(_0xd8c4('0x6'));var util=require(_0xd8c4('0x7'));var path=require(_0xd8c4('0x8'));var sox=require(_0xd8c4('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd8c4('0xa'));var _=require('lodash');var squel=require(_0xd8c4('0xb'));var crypto=require(_0xd8c4('0xc'));var jsforce=require(_0xd8c4('0xd'));var deskjs=require(_0xd8c4('0xe'));var toCsv=require(_0xd8c4('0xf'));var querystring=require(_0xd8c4('0x10'));var Papa=require(_0xd8c4('0x11'));var Redis=require(_0xd8c4('0x12'));var authService=require(_0xd8c4('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd8c4('0x14'))(_0xd8c4('0x15'));var utils=require(_0xd8c4('0x16'));var config=require(_0xd8c4('0x17'));var licenseUtil=require(_0xd8c4('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51c7ee,_0x1f7743){_0x1f7743=_0x1f7743||0xcc;return function(_0xe2595a){if(_0xe2595a){return _0x51c7ee[_0xd8c4('0x19')](_0x1f7743);}return _0x51c7ee['status'](_0x1f7743)['end']();};}function respondWithResult(_0x3b6348,_0x358d1a){_0x358d1a=_0x358d1a||0xc8;return function(_0x294c67){if(_0x294c67){return _0x3b6348[_0xd8c4('0x1a')](_0x358d1a)['json'](_0x294c67);}};}function respondWithFilteredResult(_0x239537,_0x17fd5c){return function(_0x5cd48c){if(_0x5cd48c){var _0x4eb8eb=typeof _0x17fd5c['offset']==='undefined'&&typeof _0x17fd5c[_0xd8c4('0x1b')]===_0xd8c4('0x1c');var _0x370c10=_0x5cd48c[_0xd8c4('0x1d')];var _0x1ae1ea=_0x4eb8eb?0x0:_0x17fd5c[_0xd8c4('0x1e')];var _0x128409=_0x4eb8eb?_0x5cd48c[_0xd8c4('0x1d')]:_0x17fd5c[_0xd8c4('0x1e')]+_0x17fd5c[_0xd8c4('0x1b')];var _0x2ac570;if(_0x128409>=_0x370c10){_0x128409=_0x370c10;_0x2ac570=0xc8;}else{_0x2ac570=0xce;}_0x239537[_0xd8c4('0x1a')](_0x2ac570);return _0x239537['set']('Content-Range',_0x1ae1ea+'-'+_0x128409+'/'+_0x370c10)[_0xd8c4('0x1f')](_0x5cd48c);}return null;};}function patchUpdates(_0x570a60){return function(_0x1c9c77){try{jsonpatch['apply'](_0x1c9c77,_0x570a60,!![]);}catch(_0x50ed60){return BPromise[_0xd8c4('0x20')](_0x50ed60);}return _0x1c9c77[_0xd8c4('0x21')]();};}function saveUpdates(_0x13d605,_0x3b623b){return function(_0x555e0d){if(_0x555e0d){return _0x555e0d[_0xd8c4('0x22')](_0x13d605)['then'](function(_0x219b81){return _0x219b81;});}return null;};}function removeEntity(_0x3a13fd,_0x52548a){return function(_0x59cda2){if(_0x59cda2){return _0x59cda2['destroy']()[_0xd8c4('0x23')](function(){_0x3a13fd['status'](0xcc)[_0xd8c4('0x24')]();});}};}function handleEntityNotFound(_0x3e96ac,_0x3613e2){return function(_0x47c5d3){if(!_0x47c5d3){_0x3e96ac[_0xd8c4('0x19')](0x194);}return _0x47c5d3;};}function handleError(_0x5dd2d6,_0x16869b){_0x16869b=_0x16869b||0x1f4;return function(_0xe0caba){logger[_0xd8c4('0x25')](_0xe0caba['stack']);if(_0xe0caba[_0xd8c4('0x26')]){delete _0xe0caba[_0xd8c4('0x26')];}_0x5dd2d6[_0xd8c4('0x1a')](_0x16869b)['send'](_0xe0caba);};}exports['index']=function(_0x42ed34,_0x4b942e){var _0xd05a6b={},_0x51348d={},_0x3f2247={'count':0x0,'rows':[]};var _0x46b4dd=_[_0xd8c4('0x27')](db[_0xd8c4('0x28')]['rawAttributes'],function(_0x13ec02){return{'name':_0x13ec02[_0xd8c4('0x29')],'type':_0x13ec02[_0xd8c4('0x2a')][_0xd8c4('0x2b')]};});_0x51348d[_0xd8c4('0x2c')]=_['map'](_0x46b4dd,_0xd8c4('0x26'));_0x51348d[_0xd8c4('0x2d')]=_[_0xd8c4('0x2e')](_0x42ed34['query']);_0x51348d[_0xd8c4('0x2f')]=_[_0xd8c4('0x30')](_0x51348d[_0xd8c4('0x2c')],_0x51348d[_0xd8c4('0x2d')]);_0xd05a6b['attributes']=_['intersection'](_0x51348d[_0xd8c4('0x2c')],qs[_0xd8c4('0x31')](_0x42ed34[_0xd8c4('0x2d')]['fields']));_0xd05a6b[_0xd8c4('0x32')]=_0xd05a6b[_0xd8c4('0x32')][_0xd8c4('0x33')]?_0xd05a6b['attributes']:_0x51348d[_0xd8c4('0x2c')];if(!_0x42ed34[_0xd8c4('0x2d')]['hasOwnProperty']('nolimit')){_0xd05a6b[_0xd8c4('0x1b')]=qs[_0xd8c4('0x1b')](_0x42ed34[_0xd8c4('0x2d')][_0xd8c4('0x1b')]);_0xd05a6b['offset']=qs[_0xd8c4('0x1e')](_0x42ed34['query'][_0xd8c4('0x1e')]);}_0xd05a6b['order']=qs[_0xd8c4('0x34')](_0x42ed34['query']['sort']);_0xd05a6b[_0xd8c4('0x35')]=qs[_0xd8c4('0x2f')](_['pick'](_0x42ed34['query'],_0x51348d[_0xd8c4('0x2f')]),_0x46b4dd);if(_0x42ed34[_0xd8c4('0x2d')][_0xd8c4('0x36')]){_0xd05a6b[_0xd8c4('0x35')]=_[_0xd8c4('0x37')](_0xd05a6b[_0xd8c4('0x35')],{'$or':_['map'](_0x46b4dd,function(_0x5e35ae){if(_0x5e35ae[_0xd8c4('0x2a')]!==_0xd8c4('0x38')){var _0x4c5511={};_0x4c5511[_0x5e35ae[_0xd8c4('0x26')]]={'$like':'%'+_0x42ed34[_0xd8c4('0x2d')][_0xd8c4('0x36')]+'%'};return _0x4c5511;}})});}_0xd05a6b=_[_0xd8c4('0x37')]({},_0xd05a6b,_0x42ed34[_0xd8c4('0x39')]);var _0x4901af={'where':_0xd05a6b['where']};return db[_0xd8c4('0x28')][_0xd8c4('0x1d')](_0x4901af)[_0xd8c4('0x23')](function(_0x300e0e){_0x3f2247[_0xd8c4('0x1d')]=_0x300e0e;if(_0x42ed34[_0xd8c4('0x2d')][_0xd8c4('0x3a')]){_0xd05a6b['include']=[{'all':!![]}];}return db[_0xd8c4('0x28')][_0xd8c4('0x3b')](_0xd05a6b);})['then'](function(_0x3da172){_0x3f2247[_0xd8c4('0x3c')]=_0x3da172;return _0x3f2247;})['then'](respondWithFilteredResult(_0x4b942e,_0xd05a6b))[_0xd8c4('0x3d')](handleError(_0x4b942e,null));};exports[_0xd8c4('0x3e')]=function(_0x297501,_0x475026){var _0x127f61={'raw':!![],'where':{'id':_0x297501[_0xd8c4('0x3f')]['id']}},_0x185d23={};_0x185d23[_0xd8c4('0x2c')]=_['keys'](db[_0xd8c4('0x28')][_0xd8c4('0x40')]);_0x185d23[_0xd8c4('0x2d')]=_[_0xd8c4('0x2e')](_0x297501[_0xd8c4('0x2d')]);_0x185d23[_0xd8c4('0x2f')]=_[_0xd8c4('0x30')](_0x185d23[_0xd8c4('0x2c')],_0x185d23[_0xd8c4('0x2d')]);_0x127f61[_0xd8c4('0x32')]=_[_0xd8c4('0x30')](_0x185d23['model'],qs[_0xd8c4('0x31')](_0x297501[_0xd8c4('0x2d')][_0xd8c4('0x31')]));_0x127f61['attributes']=_0x127f61[_0xd8c4('0x32')][_0xd8c4('0x33')]?_0x127f61[_0xd8c4('0x32')]:_0x185d23['model'];if(_0x297501[_0xd8c4('0x2d')]['includeAll']){_0x127f61[_0xd8c4('0x41')]=[{'all':!![]}];}_0x127f61=_['merge']({},_0x127f61,_0x297501['options']);return db[_0xd8c4('0x28')][_0xd8c4('0x42')](_0x127f61)['then'](handleEntityNotFound(_0x475026,null))[_0xd8c4('0x23')](respondWithResult(_0x475026,null))[_0xd8c4('0x3d')](handleError(_0x475026,null));};exports[_0xd8c4('0x43')]=function(_0x407865,_0x13a0b3){return db[_0xd8c4('0x28')][_0xd8c4('0x43')](_0x407865[_0xd8c4('0x44')],{})[_0xd8c4('0x23')](respondWithResult(_0x13a0b3,0xc9))[_0xd8c4('0x3d')](handleError(_0x13a0b3,null));};exports[_0xd8c4('0x22')]=function(_0x156dbe,_0x45875a){if(_0x156dbe[_0xd8c4('0x44')]['id']){delete _0x156dbe[_0xd8c4('0x44')]['id'];}return db[_0xd8c4('0x28')][_0xd8c4('0x42')]({'where':{'id':_0x156dbe[_0xd8c4('0x3f')]['id']}})[_0xd8c4('0x23')](handleEntityNotFound(_0x45875a,null))[_0xd8c4('0x23')](saveUpdates(_0x156dbe[_0xd8c4('0x44')],null))[_0xd8c4('0x23')](respondWithResult(_0x45875a,null))[_0xd8c4('0x3d')](handleError(_0x45875a,null));};exports[_0xd8c4('0x45')]=function(_0x434b72,_0x40b899){return db[_0xd8c4('0x28')][_0xd8c4('0x42')]({'where':{'id':_0x434b72[_0xd8c4('0x3f')]['id']}})['then'](handleEntityNotFound(_0x40b899,null))[_0xd8c4('0x23')](removeEntity(_0x40b899,null))[_0xd8c4('0x3d')](handleError(_0x40b899,null));};exports[_0xd8c4('0x46')]=function(_0x143026,_0x14f276){return db[_0xd8c4('0x28')][_0xd8c4('0x46')]()['then'](respondWithResult(_0x14f276,null))[_0xd8c4('0x3d')](handleError(_0x14f276,null));}; \ No newline at end of file +var _0x1ba6=['sort','where','merge','type','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','intersection','options','find','create','body','describe','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x597d97,_0xe8f243){var _0x1ecb6e=function(_0x44f32f){while(--_0x44f32f){_0x597d97['push'](_0x597d97['shift']());}};_0x1ecb6e(++_0xe8f243);}(_0x1ba6,0x64));var _0x61ba=function(_0x1cb770,_0x3a3e89){_0x1cb770=_0x1cb770-0x0;var _0x400cac=_0x1ba6[_0x1cb770];return _0x400cac;};'use strict';var emlformat=require(_0x61ba('0x0'));var rimraf=require(_0x61ba('0x1'));var zipdir=require(_0x61ba('0x2'));var jsonpatch=require(_0x61ba('0x3'));var rp=require(_0x61ba('0x4'));var moment=require(_0x61ba('0x5'));var BPromise=require(_0x61ba('0x6'));var Mustache=require(_0x61ba('0x7'));var util=require(_0x61ba('0x8'));var path=require('path');var sox=require(_0x61ba('0x9'));var csv=require(_0x61ba('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x61ba('0xb'));var _=require(_0x61ba('0xc'));var squel=require(_0x61ba('0xd'));var crypto=require(_0x61ba('0xe'));var jsforce=require(_0x61ba('0xf'));var deskjs=require(_0x61ba('0x10'));var toCsv=require(_0x61ba('0xa'));var querystring=require(_0x61ba('0x11'));var Papa=require(_0x61ba('0x12'));var Redis=require(_0x61ba('0x13'));var authService=require(_0x61ba('0x14'));var qs=require(_0x61ba('0x15'));var as=require(_0x61ba('0x16'));var hardwareService=require(_0x61ba('0x17'));var logger=require(_0x61ba('0x18'))(_0x61ba('0x19'));var utils=require(_0x61ba('0x1a'));var config=require(_0x61ba('0x1b'));var licenseUtil=require(_0x61ba('0x1c'));var db=require(_0x61ba('0x1d'))['db'];function respondWithStatusCode(_0x3416a4,_0x23fbd6){_0x23fbd6=_0x23fbd6||0xcc;return function(_0x259802){if(_0x259802){return _0x3416a4['sendStatus'](_0x23fbd6);}return _0x3416a4[_0x61ba('0x1e')](_0x23fbd6)[_0x61ba('0x1f')]();};}function respondWithResult(_0x204c7f,_0x4b52a4){_0x4b52a4=_0x4b52a4||0xc8;return function(_0x16f425){if(_0x16f425){return _0x204c7f[_0x61ba('0x1e')](_0x4b52a4)[_0x61ba('0x20')](_0x16f425);}};}function respondWithFilteredResult(_0x48634d,_0x2c44fa){return function(_0x1a0ba9){if(_0x1a0ba9){var _0xcf6db6=typeof _0x2c44fa[_0x61ba('0x21')]==='undefined'&&typeof _0x2c44fa[_0x61ba('0x22')]==='undefined';var _0x35c814=_0x1a0ba9[_0x61ba('0x23')];var _0x41389f=_0xcf6db6?0x0:_0x2c44fa[_0x61ba('0x21')];var _0x11e658=_0xcf6db6?_0x1a0ba9[_0x61ba('0x23')]:_0x2c44fa[_0x61ba('0x21')]+_0x2c44fa['limit'];var _0x34bcc9;if(_0x11e658>=_0x35c814){_0x11e658=_0x35c814;_0x34bcc9=0xc8;}else{_0x34bcc9=0xce;}_0x48634d[_0x61ba('0x1e')](_0x34bcc9);return _0x48634d[_0x61ba('0x24')](_0x61ba('0x25'),_0x41389f+'-'+_0x11e658+'/'+_0x35c814)[_0x61ba('0x20')](_0x1a0ba9);}return null;};}function patchUpdates(_0x1f7f2f){return function(_0x1aae1c){try{jsonpatch[_0x61ba('0x26')](_0x1aae1c,_0x1f7f2f,!![]);}catch(_0x381fd6){return BPromise[_0x61ba('0x27')](_0x381fd6);}return _0x1aae1c[_0x61ba('0x28')]();};}function saveUpdates(_0x23c5c4,_0x377219){return function(_0x5ee071){if(_0x5ee071){return _0x5ee071[_0x61ba('0x29')](_0x23c5c4)[_0x61ba('0x2a')](function(_0xc0a194){return _0xc0a194;});}return null;};}function removeEntity(_0x563303,_0x45633d){return function(_0x15f81f){if(_0x15f81f){return _0x15f81f[_0x61ba('0x2b')]()[_0x61ba('0x2a')](function(){_0x563303['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x9582d8,_0x145ecb){return function(_0x3634b8){if(!_0x3634b8){_0x9582d8[_0x61ba('0x2c')](0x194);}return _0x3634b8;};}function handleError(_0x27db80,_0x349c9b){_0x349c9b=_0x349c9b||0x1f4;return function(_0x1a19b7){logger['error'](_0x1a19b7[_0x61ba('0x2d')]);if(_0x1a19b7[_0x61ba('0x2e')]){delete _0x1a19b7[_0x61ba('0x2e')];}_0x27db80[_0x61ba('0x1e')](_0x349c9b)[_0x61ba('0x2f')](_0x1a19b7);};}exports[_0x61ba('0x30')]=function(_0x2ea427,_0x360874){var _0x3bc46c={},_0x4155e2={},_0x1b6234={'count':0x0,'rows':[]};var _0xdd79e2=_[_0x61ba('0x31')](db[_0x61ba('0x32')][_0x61ba('0x33')],function(_0x41bbbb){return{'name':_0x41bbbb[_0x61ba('0x34')],'type':_0x41bbbb['type']['key']};});_0x4155e2[_0x61ba('0x35')]=_[_0x61ba('0x31')](_0xdd79e2,_0x61ba('0x2e'));_0x4155e2[_0x61ba('0x36')]=_[_0x61ba('0x37')](_0x2ea427['query']);_0x4155e2[_0x61ba('0x38')]=_['intersection'](_0x4155e2[_0x61ba('0x35')],_0x4155e2['query']);_0x3bc46c[_0x61ba('0x39')]=_['intersection'](_0x4155e2[_0x61ba('0x35')],qs[_0x61ba('0x3a')](_0x2ea427[_0x61ba('0x36')][_0x61ba('0x3a')]));_0x3bc46c[_0x61ba('0x39')]=_0x3bc46c[_0x61ba('0x39')][_0x61ba('0x3b')]?_0x3bc46c['attributes']:_0x4155e2['model'];if(!_0x2ea427[_0x61ba('0x36')][_0x61ba('0x3c')](_0x61ba('0x3d'))){_0x3bc46c[_0x61ba('0x22')]=qs['limit'](_0x2ea427[_0x61ba('0x36')][_0x61ba('0x22')]);_0x3bc46c[_0x61ba('0x21')]=qs[_0x61ba('0x21')](_0x2ea427['query'][_0x61ba('0x21')]);}_0x3bc46c['order']=qs[_0x61ba('0x3e')](_0x2ea427[_0x61ba('0x36')]['sort']);_0x3bc46c[_0x61ba('0x3f')]=qs[_0x61ba('0x38')](_['pick'](_0x2ea427[_0x61ba('0x36')],_0x4155e2[_0x61ba('0x38')]),_0xdd79e2);if(_0x2ea427[_0x61ba('0x36')]['filter']){_0x3bc46c[_0x61ba('0x3f')]=_[_0x61ba('0x40')](_0x3bc46c[_0x61ba('0x3f')],{'$or':_[_0x61ba('0x31')](_0xdd79e2,function(_0x21f528){if(_0x21f528[_0x61ba('0x41')]!==_0x61ba('0x42')){var _0x403829={};_0x403829[_0x21f528[_0x61ba('0x2e')]]={'$like':'%'+_0x2ea427[_0x61ba('0x36')][_0x61ba('0x43')]+'%'};return _0x403829;}})});}_0x3bc46c=_['merge']({},_0x3bc46c,_0x2ea427['options']);var _0x5cd8d8={'where':_0x3bc46c[_0x61ba('0x3f')]};return db[_0x61ba('0x32')][_0x61ba('0x23')](_0x5cd8d8)[_0x61ba('0x2a')](function(_0x14d4d7){_0x1b6234[_0x61ba('0x23')]=_0x14d4d7;if(_0x2ea427[_0x61ba('0x36')][_0x61ba('0x44')]){_0x3bc46c[_0x61ba('0x45')]=[{'all':!![]}];}return db['SquareReport'][_0x61ba('0x46')](_0x3bc46c);})['then'](function(_0x2f4aef){_0x1b6234[_0x61ba('0x47')]=_0x2f4aef;return _0x1b6234;})[_0x61ba('0x2a')](respondWithFilteredResult(_0x360874,_0x3bc46c))[_0x61ba('0x48')](handleError(_0x360874,null));};exports[_0x61ba('0x49')]=function(_0x3e3b74,_0x232da6){var _0x5e2d0f={'raw':!![],'where':{'id':_0x3e3b74[_0x61ba('0x4a')]['id']}},_0x4474f4={};_0x4474f4['model']=_[_0x61ba('0x37')](db[_0x61ba('0x32')]['rawAttributes']);_0x4474f4[_0x61ba('0x36')]=_[_0x61ba('0x37')](_0x3e3b74[_0x61ba('0x36')]);_0x4474f4[_0x61ba('0x38')]=_['intersection'](_0x4474f4[_0x61ba('0x35')],_0x4474f4['query']);_0x5e2d0f[_0x61ba('0x39')]=_[_0x61ba('0x4b')](_0x4474f4[_0x61ba('0x35')],qs['fields'](_0x3e3b74[_0x61ba('0x36')]['fields']));_0x5e2d0f[_0x61ba('0x39')]=_0x5e2d0f[_0x61ba('0x39')][_0x61ba('0x3b')]?_0x5e2d0f[_0x61ba('0x39')]:_0x4474f4['model'];if(_0x3e3b74[_0x61ba('0x36')][_0x61ba('0x44')]){_0x5e2d0f['include']=[{'all':!![]}];}_0x5e2d0f=_['merge']({},_0x5e2d0f,_0x3e3b74[_0x61ba('0x4c')]);return db['SquareReport'][_0x61ba('0x4d')](_0x5e2d0f)[_0x61ba('0x2a')](handleEntityNotFound(_0x232da6,null))[_0x61ba('0x2a')](respondWithResult(_0x232da6,null))[_0x61ba('0x48')](handleError(_0x232da6,null));};exports[_0x61ba('0x4e')]=function(_0x402b46,_0x3d8490){return db[_0x61ba('0x32')]['create'](_0x402b46[_0x61ba('0x4f')],{})[_0x61ba('0x2a')](respondWithResult(_0x3d8490,0xc9))[_0x61ba('0x48')](handleError(_0x3d8490,null));};exports['update']=function(_0x5187a8,_0x5e772b){if(_0x5187a8[_0x61ba('0x4f')]['id']){delete _0x5187a8[_0x61ba('0x4f')]['id'];}return db[_0x61ba('0x32')]['find']({'where':{'id':_0x5187a8[_0x61ba('0x4a')]['id']}})[_0x61ba('0x2a')](handleEntityNotFound(_0x5e772b,null))[_0x61ba('0x2a')](saveUpdates(_0x5187a8[_0x61ba('0x4f')],null))[_0x61ba('0x2a')](respondWithResult(_0x5e772b,null))['catch'](handleError(_0x5e772b,null));};exports[_0x61ba('0x2b')]=function(_0x171297,_0x5b8b73){return db[_0x61ba('0x32')][_0x61ba('0x4d')]({'where':{'id':_0x171297[_0x61ba('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5b8b73,null))[_0x61ba('0x2a')](removeEntity(_0x5b8b73,null))[_0x61ba('0x48')](handleError(_0x5b8b73,null));};exports[_0x61ba('0x50')]=function(_0x2f85f0,_0x4aa5e6){return db[_0x61ba('0x32')][_0x61ba('0x50')]()[_0x61ba('0x2a')](respondWithResult(_0x4aa5e6,null))[_0x61ba('0x48')](handleError(_0x4aa5e6,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 324a6d3..c74905a 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 _0xa97d=['SquareReport','report_square','uid_pname','project_name','leaveAt','util','moment','rimraf','../../config/environment','./squareReport.attributes','exports'];(function(_0x11dde4,_0x1d4852){var _0x6eea94=function(_0x182859){while(--_0x182859){_0x11dde4['push'](_0x11dde4['shift']());}};_0x6eea94(++_0x1d4852);}(_0xa97d,0x1d3));var _0xda97=function(_0x1b96ee,_0x32ffef){_0x1b96ee=_0x1b96ee-0x0;var _0x1aef42=_0xa97d[_0x1b96ee];return _0x1aef42;};'use strict';var _=require('lodash');var util=require(_0xda97('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xda97('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xda97('0x2'));var config=require(_0xda97('0x3'));var attributes=require(_0xda97('0x4'));module[_0xda97('0x5')]=function(_0x13806f,_0x12419b){return _0x13806f['define'](_0xda97('0x6'),attributes,{'tableName':_0xda97('0x7'),'paranoid':![],'indexes':[{'name':_0xda97('0x8'),'fields':['uniqueid',_0xda97('0x9')]},{'name':_0xda97('0xa'),'fields':[_0xda97('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xff7e=['./squareReport.attributes','exports','define','SquareReport','uid_pname','project_name','leaveAt','lodash','../../config/logger','request-promise','path','rimraf','../../config/environment'];(function(_0x14e207,_0x111c5b){var _0x56e8e0=function(_0x2acb0c){while(--_0x2acb0c){_0x14e207['push'](_0x14e207['shift']());}};_0x56e8e0(++_0x111c5b);}(_0xff7e,0xd7));var _0xeff7=function(_0x1aef77,_0x5d2523){_0x1aef77=_0x1aef77-0x0;var _0x1881be=_0xff7e[_0x1aef77];return _0x1881be;};'use strict';var _=require(_0xeff7('0x0'));var util=require('util');var logger=require(_0xeff7('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xeff7('0x2'));var fs=require('fs');var path=require(_0xeff7('0x3'));var rimraf=require(_0xeff7('0x4'));var config=require(_0xeff7('0x5'));var attributes=require(_0xeff7('0x6'));module[_0xeff7('0x7')]=function(_0x119ed3,_0x3f69c4){return _0x119ed3[_0xeff7('0x8')](_0xeff7('0x9'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0xeff7('0xa'),'fields':['uniqueid',_0xeff7('0xb')]},{'name':_0xeff7('0xc'),'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 08b664f..6ad6afc 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 _0x094d=['SquareReport','create','body','options','raw','catch','UpdateSquareReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateSquareReport'];(function(_0x28d391,_0x1357b3){var _0x3c8bf0=function(_0x55bac9){while(--_0x55bac9){_0x28d391['push'](_0x28d391['shift']());}};_0x3c8bf0(++_0x1357b3);}(_0x094d,0xc4));var _0xd094=function(_0x41aad0,_0x379f88){_0x41aad0=_0x41aad0-0x0;var _0x325285=_0x094d[_0x41aad0];return _0x325285;};'use strict';var _=require(_0xd094('0x0'));var util=require(_0xd094('0x1'));var moment=require(_0xd094('0x2'));var BPromise=require(_0xd094('0x3'));var rs=require(_0xd094('0x4'));var fs=require('fs');var Redis=require(_0xd094('0x5'));var db=require(_0xd094('0x6'))['db'];var utils=require(_0xd094('0x7'));var logger=require(_0xd094('0x8'))(_0xd094('0x9'));var config=require(_0xd094('0xa'));var jayson=require(_0xd094('0xb'));var client=jayson[_0xd094('0xc')][_0xd094('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2cded1,_0x4c191e,_0x1c26a2){return new BPromise(function(_0x5460c6,_0x539f84){return client[_0xd094('0xe')](_0x2cded1,_0x1c26a2)[_0xd094('0xf')](function(_0x1ce81e){logger[_0xd094('0x10')](_0xd094('0x11'),_0x4c191e,'request\x20sent');logger[_0xd094('0x12')](_0xd094('0x13'),_0x4c191e,_0xd094('0x14'),JSON[_0xd094('0x15')](_0x1ce81e));if(_0x1ce81e[_0xd094('0x16')]){if(_0x1ce81e[_0xd094('0x16')]['code']===0x1f4){logger['error']('SquareReport,\x20%s,\x20%s',_0x4c191e,_0x1ce81e['error'][_0xd094('0x17')]);return _0x539f84(_0x1ce81e[_0xd094('0x16')][_0xd094('0x17')]);}logger[_0xd094('0x16')](_0xd094('0x11'),_0x4c191e,_0x1ce81e[_0xd094('0x16')][_0xd094('0x17')]);return _0x5460c6(_0x1ce81e[_0xd094('0x16')][_0xd094('0x17')]);}else{logger['info']('SquareReport,\x20%s,\x20%s',_0x4c191e,_0xd094('0x14'));_0x5460c6(_0x1ce81e[_0xd094('0x18')][_0xd094('0x17')]);}})['catch'](function(_0x249f64){logger[_0xd094('0x16')](_0xd094('0x11'),_0x4c191e,_0x249f64);_0x539f84(_0x249f64);});});}exports[_0xd094('0x19')]=function(_0x4d99ae){var _0x4ffa15=this;return new Promise(function(_0x484602,_0x3bdb72){return db[_0xd094('0x1a')][_0xd094('0x1b')](_0x4d99ae[_0xd094('0x1c')],{'raw':_0x4d99ae['options']?_0x4d99ae[_0xd094('0x1d')][_0xd094('0x1e')]===undefined?!![]:![]:!![]})[_0xd094('0xf')](function(_0x5583b2){logger['info'](_0xd094('0x19'),_0x4d99ae);logger[_0xd094('0x12')](_0xd094('0x19'),_0x4d99ae,JSON[_0xd094('0x15')](_0x5583b2));_0x484602(_0x5583b2);})[_0xd094('0x1f')](function(_0xdfb19b){logger[_0xd094('0x16')]('CreateSquareReport',_0xdfb19b[_0xd094('0x17')],_0x4d99ae);_0x3bdb72(_0x4ffa15[_0xd094('0x16')](0x1f4,_0xdfb19b[_0xd094('0x17')]));});});};exports[_0xd094('0x20')]=function(_0x268565){var _0x41d55a=this;return new Promise(function(_0x3f262d,_0x1d3152){return db[_0xd094('0x1a')][_0xd094('0x21')](_0x268565[_0xd094('0x1c')],{'raw':_0x268565['options']?_0x268565['options'][_0xd094('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x268565['options']?_0x268565[_0xd094('0x1d')][_0xd094('0x22')]||null:null,'attributes':_0x268565[_0xd094('0x1d')]?_0x268565['options'][_0xd094('0x23')]||null:null,'limit':_0x268565[_0xd094('0x1d')]?_0x268565[_0xd094('0x1d')][_0xd094('0x24')]||null:null})[_0xd094('0xf')](function(_0x2f04e2){logger['info'](_0xd094('0x20'),_0x268565);logger[_0xd094('0x12')](_0xd094('0x20'),_0x268565,JSON['stringify'](_0x2f04e2));_0x3f262d(_0x2f04e2);})[_0xd094('0x1f')](function(_0x201465){logger['error'](_0xd094('0x20'),_0x201465[_0xd094('0x17')],_0x268565);_0x1d3152(_0x41d55a['error'](0x1f4,_0x201465[_0xd094('0x17')]));});});}; \ No newline at end of file +var _0x153a=['SquareReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSquareReport','SquareReport','create','body','options','raw','debug','update','where','attributes','limit','stringify','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','SquareReport,\x20%s,\x20%s','request\x20sent'];(function(_0x403e43,_0x4b62e8){var _0x329411=function(_0x238978){while(--_0x238978){_0x403e43['push'](_0x403e43['shift']());}};_0x329411(++_0x4b62e8);}(_0x153a,0x1b2));var _0xa153=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x153a[_0xa148b7];return _0x51efd3;};'use strict';var _=require('lodash');var util=require(_0xa153('0x0'));var moment=require('moment');var BPromise=require(_0xa153('0x1'));var rs=require(_0xa153('0x2'));var fs=require('fs');var Redis=require(_0xa153('0x3'));var db=require(_0xa153('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa153('0x5'))(_0xa153('0x6'));var config=require('../../config/environment');var jayson=require(_0xa153('0x7'));var client=jayson[_0xa153('0x8')][_0xa153('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4fff74,_0x5001c1,_0x5749d6){return new BPromise(function(_0x535fb0,_0x12c49f){return client['request'](_0x4fff74,_0x5749d6)[_0xa153('0xa')](function(_0x1e89f3){logger[_0xa153('0xb')](_0xa153('0xc'),_0x5001c1,_0xa153('0xd'));logger['debug'](_0xa153('0xe'),_0x5001c1,_0xa153('0xd'),JSON['stringify'](_0x1e89f3));if(_0x1e89f3['error']){if(_0x1e89f3[_0xa153('0xf')][_0xa153('0x10')]===0x1f4){logger['error'](_0xa153('0xc'),_0x5001c1,_0x1e89f3[_0xa153('0xf')][_0xa153('0x11')]);return _0x12c49f(_0x1e89f3[_0xa153('0xf')][_0xa153('0x11')]);}logger[_0xa153('0xf')](_0xa153('0xc'),_0x5001c1,_0x1e89f3['error'][_0xa153('0x11')]);return _0x535fb0(_0x1e89f3[_0xa153('0xf')]['message']);}else{logger[_0xa153('0xb')](_0xa153('0xc'),_0x5001c1,_0xa153('0xd'));_0x535fb0(_0x1e89f3[_0xa153('0x12')]['message']);}})[_0xa153('0x13')](function(_0x566e6c){logger['error'](_0xa153('0xc'),_0x5001c1,_0x566e6c);_0x12c49f(_0x566e6c);});});}exports[_0xa153('0x14')]=function(_0x26eb8d){var _0x214c87=this;return new Promise(function(_0x26d217,_0x37d35b){return db[_0xa153('0x15')][_0xa153('0x16')](_0x26eb8d[_0xa153('0x17')],{'raw':_0x26eb8d[_0xa153('0x18')]?_0x26eb8d[_0xa153('0x18')][_0xa153('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x3ee746){logger[_0xa153('0xb')](_0xa153('0x14'),_0x26eb8d);logger[_0xa153('0x1a')](_0xa153('0x14'),_0x26eb8d,JSON['stringify'](_0x3ee746));_0x26d217(_0x3ee746);})[_0xa153('0x13')](function(_0x374746){logger['error'](_0xa153('0x14'),_0x374746['message'],_0x26eb8d);_0x37d35b(_0x214c87[_0xa153('0xf')](0x1f4,_0x374746['message']));});});};exports['UpdateSquareReport']=function(_0x4af545){var _0x390cbc=this;return new Promise(function(_0x469f93,_0x243114){return db[_0xa153('0x15')][_0xa153('0x1b')](_0x4af545[_0xa153('0x17')],{'raw':_0x4af545[_0xa153('0x18')]?_0x4af545[_0xa153('0x18')][_0xa153('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4af545[_0xa153('0x18')]?_0x4af545['options'][_0xa153('0x1c')]||null:null,'attributes':_0x4af545[_0xa153('0x18')]?_0x4af545[_0xa153('0x18')][_0xa153('0x1d')]||null:null,'limit':_0x4af545[_0xa153('0x18')]?_0x4af545[_0xa153('0x18')][_0xa153('0x1e')]||null:null})[_0xa153('0xa')](function(_0x3dcf4f){logger[_0xa153('0xb')]('UpdateSquareReport',_0x4af545);logger[_0xa153('0x1a')]('UpdateSquareReport',_0x4af545,JSON[_0xa153('0x1f')](_0x3dcf4f));_0x469f93(_0x3dcf4f);})['catch'](function(_0x314357){logger['error']('UpdateSquareReport',_0x314357[_0xa153('0x11')],_0x4af545);_0x243114(_0x390cbc['error'](0x1f4,_0x314357['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 22baca6..4888bc8 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 _0xb7cf=['update','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create'];(function(_0x262c15,_0x3e7c46){var _0x4e1d25=function(_0x11f6d1){while(--_0x11f6d1){_0x262c15['push'](_0x262c15['shift']());}};_0x4e1d25(++_0x3e7c46);}(_0xb7cf,0xec));var _0xfb7c=function(_0x38a653,_0x1a5872){_0x38a653=_0x38a653-0x0;var _0x370492=_0xb7cf[_0x38a653];return _0x370492;};'use strict';var multer=require(_0xfb7c('0x0'));var util=require('util');var path=require(_0xfb7c('0x1'));var timeout=require(_0xfb7c('0x2'));var express=require(_0xfb7c('0x3'));var router=express['Router']();var fs_extra=require(_0xfb7c('0x4'));var auth=require(_0xfb7c('0x5'));var interaction=require(_0xfb7c('0x6'));var config=require('../../config/environment');var controller=require(_0xfb7c('0x7'));router[_0xfb7c('0x8')]('/',auth[_0xfb7c('0x9')](),controller['index']);router[_0xfb7c('0x8')](_0xfb7c('0xa'),auth[_0xfb7c('0x9')](),controller[_0xfb7c('0xb')]);router[_0xfb7c('0x8')](_0xfb7c('0xc'),auth[_0xfb7c('0x9')](),controller[_0xfb7c('0xd')]);router[_0xfb7c('0xe')]('/',auth[_0xfb7c('0x9')](),controller[_0xfb7c('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xfb7c('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xfb7c('0x11')]=router; \ No newline at end of file +var _0x8f3e=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x41d505,_0x4bb480){var _0x45e857=function(_0x4d9a7e){while(--_0x4d9a7e){_0x41d505['push'](_0x41d505['shift']());}};_0x45e857(++_0x4bb480);}(_0x8f3e,0x16f));var _0xe8f3=function(_0x3ffb89,_0x455739){_0x3ffb89=_0x3ffb89-0x0;var _0x5bda92=_0x8f3e[_0x3ffb89];return _0x5bda92;};'use strict';var multer=require('multer');var util=require(_0xe8f3('0x0'));var path=require(_0xe8f3('0x1'));var timeout=require(_0xe8f3('0x2'));var express=require(_0xe8f3('0x3'));var router=express[_0xe8f3('0x4')]();var fs_extra=require(_0xe8f3('0x5'));var auth=require(_0xe8f3('0x6'));var interaction=require(_0xe8f3('0x7'));var config=require(_0xe8f3('0x8'));var controller=require('./squareReportDetail.controller');router[_0xe8f3('0x9')]('/',auth[_0xe8f3('0xa')](),controller[_0xe8f3('0xb')]);router[_0xe8f3('0x9')](_0xe8f3('0xc'),auth[_0xe8f3('0xa')](),controller[_0xe8f3('0xd')]);router[_0xe8f3('0x9')](_0xe8f3('0xe'),auth[_0xe8f3('0xa')](),controller[_0xe8f3('0xf')]);router[_0xe8f3('0x10')]('/',auth[_0xe8f3('0xa')](),controller[_0xe8f3('0x11')]);router[_0xe8f3('0x12')](_0xe8f3('0xe'),auth[_0xe8f3('0xa')](),controller[_0xe8f3('0x13')]);router[_0xe8f3('0x14')](_0xe8f3('0xe'),auth[_0xe8f3('0xa')](),controller['destroy']);module[_0xe8f3('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 58e3dc1..a569ec3 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 _0x76d5=['TEXT','sequelize','STRING'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x76d5,0x1c0));var _0x576d=function(_0x2850f5,_0xdb9239){_0x2850f5=_0x2850f5-0x0;var _0x404113=_0x76d5[_0x2850f5];return _0x404113;};'use strict';var Sequelize=require(_0x576d('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x576d('0x1')]},'node':{'type':Sequelize[_0x576d('0x1')]},'application':{'type':Sequelize[_0x576d('0x1')]},'data':{'type':Sequelize[_0x576d('0x2')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x576d('0x1')]}}; \ No newline at end of file +var _0x505a=['STRING','TEXT','sequelize'];(function(_0xbcafa0,_0x28c9e9){var _0x3bcaaa=function(_0xd46bdb){while(--_0xd46bdb){_0xbcafa0['push'](_0xbcafa0['shift']());}};_0x3bcaaa(++_0x28c9e9);}(_0x505a,0x1f1));var _0xa505=function(_0x41b748,_0x491aeb){_0x41b748=_0x41b748-0x0;var _0x55984a=_0x505a[_0x41b748];return _0x55984a;};'use strict';var Sequelize=require(_0xa505('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0xa505('0x1')]},'application':{'type':Sequelize[_0xa505('0x1')]},'data':{'type':Sequelize[_0xa505('0x2')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xa505('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index a22596d..ac0976e 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 _0x0db9=['SquareDetailsReport','includeAll','include','findAll','rows','catch','show','keys','options','find','create','body','params','destroy','describe','eml-format','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge'];(function(_0x39a8c0,_0x24bff6){var _0x2e0f03=function(_0x10b844){while(--_0x10b844){_0x39a8c0['push'](_0x39a8c0['shift']());}};_0x2e0f03(++_0x24bff6);}(_0x0db9,0xa3));var _0x90db=function(_0x26a818,_0x40708a){_0x26a818=_0x26a818-0x0;var _0x5d8ca0=_0x0db9[_0x26a818];return _0x5d8ca0;};'use strict';var emlformat=require(_0x90db('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x90db('0x1'));var moment=require(_0x90db('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x90db('0x3'));var util=require('util');var path=require(_0x90db('0x4'));var sox=require(_0x90db('0x5'));var csv=require('to-csv');var ejs=require(_0x90db('0x6'));var fs=require('fs');var fs_extra=require(_0x90db('0x7'));var _=require(_0x90db('0x8'));var squel=require(_0x90db('0x9'));var crypto=require(_0x90db('0xa'));var jsforce=require(_0x90db('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x90db('0xc'));var querystring=require(_0x90db('0xd'));var Papa=require(_0x90db('0xe'));var Redis=require(_0x90db('0xf'));var authService=require(_0x90db('0x10'));var qs=require(_0x90db('0x11'));var as=require(_0x90db('0x12'));var hardwareService=require(_0x90db('0x13'));var logger=require(_0x90db('0x14'))(_0x90db('0x15'));var utils=require(_0x90db('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x90db('0x17'));var db=require(_0x90db('0x18'))['db'];function respondWithStatusCode(_0x45ad3c,_0x436327){_0x436327=_0x436327||0xcc;return function(_0x1b410d){if(_0x1b410d){return _0x45ad3c[_0x90db('0x19')](_0x436327);}return _0x45ad3c[_0x90db('0x1a')](_0x436327)[_0x90db('0x1b')]();};}function respondWithResult(_0x7826f7,_0x309aea){_0x309aea=_0x309aea||0xc8;return function(_0x334e22){if(_0x334e22){return _0x7826f7[_0x90db('0x1a')](_0x309aea)[_0x90db('0x1c')](_0x334e22);}};}function respondWithFilteredResult(_0xda2abe,_0x544226){return function(_0x3124d4){if(_0x3124d4){var _0x5ef456=typeof _0x544226[_0x90db('0x1d')]===_0x90db('0x1e')&&typeof _0x544226[_0x90db('0x1f')]===_0x90db('0x1e');var _0x32ff04=_0x3124d4[_0x90db('0x20')];var _0x15e33e=_0x5ef456?0x0:_0x544226[_0x90db('0x1d')];var _0x24a16a=_0x5ef456?_0x3124d4[_0x90db('0x20')]:_0x544226['offset']+_0x544226[_0x90db('0x1f')];var _0x445a22;if(_0x24a16a>=_0x32ff04){_0x24a16a=_0x32ff04;_0x445a22=0xc8;}else{_0x445a22=0xce;}_0xda2abe['status'](_0x445a22);return _0xda2abe['set'](_0x90db('0x21'),_0x15e33e+'-'+_0x24a16a+'/'+_0x32ff04)[_0x90db('0x1c')](_0x3124d4);}return null;};}function patchUpdates(_0x300dc2){return function(_0x3a58c4){try{jsonpatch[_0x90db('0x22')](_0x3a58c4,_0x300dc2,!![]);}catch(_0x168eaf){return BPromise[_0x90db('0x23')](_0x168eaf);}return _0x3a58c4['save']();};}function saveUpdates(_0xb45340,_0x1aeab9){return function(_0x23934a){if(_0x23934a){return _0x23934a[_0x90db('0x24')](_0xb45340)['then'](function(_0x43028e){return _0x43028e;});}return null;};}function removeEntity(_0x5a98f6,_0x459068){return function(_0x19f9c6){if(_0x19f9c6){return _0x19f9c6['destroy']()[_0x90db('0x25')](function(){_0x5a98f6[_0x90db('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f8469,_0x3e3fbd){return function(_0x5b3c09){if(!_0x5b3c09){_0x2f8469[_0x90db('0x19')](0x194);}return _0x5b3c09;};}function handleError(_0xe026cf,_0x1cc660){_0x1cc660=_0x1cc660||0x1f4;return function(_0x94cd84){logger['error'](_0x94cd84[_0x90db('0x26')]);if(_0x94cd84[_0x90db('0x27')]){delete _0x94cd84[_0x90db('0x27')];}_0xe026cf[_0x90db('0x1a')](_0x1cc660)[_0x90db('0x28')](_0x94cd84);};}exports[_0x90db('0x29')]=function(_0x44b5b6,_0x3c7f67){var _0x4c6311={},_0x3489d1={},_0x552c2e={'count':0x0,'rows':[]};var _0xa2bb=_[_0x90db('0x2a')](db['SquareDetailsReport'][_0x90db('0x2b')],function(_0xfc4ceb){return{'name':_0xfc4ceb[_0x90db('0x2c')],'type':_0xfc4ceb[_0x90db('0x2d')]['key']};});_0x3489d1[_0x90db('0x2e')]=_[_0x90db('0x2a')](_0xa2bb,_0x90db('0x27'));_0x3489d1['query']=_['keys'](_0x44b5b6[_0x90db('0x2f')]);_0x3489d1[_0x90db('0x30')]=_[_0x90db('0x31')](_0x3489d1['model'],_0x3489d1[_0x90db('0x2f')]);_0x4c6311[_0x90db('0x32')]=_['intersection'](_0x3489d1[_0x90db('0x2e')],qs[_0x90db('0x33')](_0x44b5b6['query'][_0x90db('0x33')]));_0x4c6311[_0x90db('0x32')]=_0x4c6311[_0x90db('0x32')][_0x90db('0x34')]?_0x4c6311['attributes']:_0x3489d1['model'];if(!_0x44b5b6[_0x90db('0x2f')]['hasOwnProperty'](_0x90db('0x35'))){_0x4c6311[_0x90db('0x1f')]=qs[_0x90db('0x1f')](_0x44b5b6['query'][_0x90db('0x1f')]);_0x4c6311['offset']=qs[_0x90db('0x1d')](_0x44b5b6[_0x90db('0x2f')]['offset']);}_0x4c6311[_0x90db('0x36')]=qs[_0x90db('0x37')](_0x44b5b6[_0x90db('0x2f')][_0x90db('0x37')]);_0x4c6311[_0x90db('0x38')]=qs[_0x90db('0x30')](_['pick'](_0x44b5b6[_0x90db('0x2f')],_0x3489d1[_0x90db('0x30')]),_0xa2bb);if(_0x44b5b6['query'][_0x90db('0x39')]){_0x4c6311[_0x90db('0x38')]=_[_0x90db('0x3a')](_0x4c6311['where'],{'$or':_[_0x90db('0x2a')](_0xa2bb,function(_0x2c9f57){if(_0x2c9f57['type']!=='VIRTUAL'){var _0x57c06b={};_0x57c06b[_0x2c9f57['name']]={'$like':'%'+_0x44b5b6[_0x90db('0x2f')][_0x90db('0x39')]+'%'};return _0x57c06b;}})});}_0x4c6311=_[_0x90db('0x3a')]({},_0x4c6311,_0x44b5b6['options']);var _0x55b0b2={'where':_0x4c6311[_0x90db('0x38')]};return db[_0x90db('0x3b')]['count'](_0x55b0b2)[_0x90db('0x25')](function(_0x592c01){_0x552c2e[_0x90db('0x20')]=_0x592c01;if(_0x44b5b6[_0x90db('0x2f')][_0x90db('0x3c')]){_0x4c6311[_0x90db('0x3d')]=[{'all':!![]}];}return db[_0x90db('0x3b')][_0x90db('0x3e')](_0x4c6311);})[_0x90db('0x25')](function(_0x1d6f9a){_0x552c2e[_0x90db('0x3f')]=_0x1d6f9a;return _0x552c2e;})['then'](respondWithFilteredResult(_0x3c7f67,_0x4c6311))[_0x90db('0x40')](handleError(_0x3c7f67,null));};exports[_0x90db('0x41')]=function(_0x2e1fc8,_0xd45db3){var _0x4611f1={'raw':!![],'where':{'id':_0x2e1fc8['params']['id']}},_0x4f0b46={};_0x4f0b46[_0x90db('0x2e')]=_['keys'](db[_0x90db('0x3b')][_0x90db('0x2b')]);_0x4f0b46[_0x90db('0x2f')]=_[_0x90db('0x42')](_0x2e1fc8[_0x90db('0x2f')]);_0x4f0b46['filters']=_['intersection'](_0x4f0b46['model'],_0x4f0b46[_0x90db('0x2f')]);_0x4611f1[_0x90db('0x32')]=_[_0x90db('0x31')](_0x4f0b46['model'],qs[_0x90db('0x33')](_0x2e1fc8[_0x90db('0x2f')][_0x90db('0x33')]));_0x4611f1[_0x90db('0x32')]=_0x4611f1['attributes'][_0x90db('0x34')]?_0x4611f1[_0x90db('0x32')]:_0x4f0b46[_0x90db('0x2e')];if(_0x2e1fc8[_0x90db('0x2f')]['includeAll']){_0x4611f1['include']=[{'all':!![]}];}_0x4611f1=_[_0x90db('0x3a')]({},_0x4611f1,_0x2e1fc8[_0x90db('0x43')]);return db[_0x90db('0x3b')][_0x90db('0x44')](_0x4611f1)['then'](handleEntityNotFound(_0xd45db3,null))[_0x90db('0x25')](respondWithResult(_0xd45db3,null))['catch'](handleError(_0xd45db3,null));};exports[_0x90db('0x45')]=function(_0x2e4a8a,_0x576449){return db[_0x90db('0x3b')][_0x90db('0x45')](_0x2e4a8a[_0x90db('0x46')],{})[_0x90db('0x25')](respondWithResult(_0x576449,0xc9))[_0x90db('0x40')](handleError(_0x576449,null));};exports[_0x90db('0x24')]=function(_0x407f50,_0x62b965){if(_0x407f50[_0x90db('0x46')]['id']){delete _0x407f50[_0x90db('0x46')]['id'];}return db[_0x90db('0x3b')]['find']({'where':{'id':_0x407f50[_0x90db('0x47')]['id']}})[_0x90db('0x25')](handleEntityNotFound(_0x62b965,null))[_0x90db('0x25')](saveUpdates(_0x407f50[_0x90db('0x46')],null))[_0x90db('0x25')](respondWithResult(_0x62b965,null))[_0x90db('0x40')](handleError(_0x62b965,null));};exports[_0x90db('0x48')]=function(_0x3a768b,_0x43c760){return db[_0x90db('0x3b')][_0x90db('0x44')]({'where':{'id':_0x3a768b[_0x90db('0x47')]['id']}})['then'](handleEntityNotFound(_0x43c760,null))[_0x90db('0x25')](removeEntity(_0x43c760,null))['catch'](handleError(_0x43c760,null));};exports[_0x90db('0x49')]=function(_0x1eb7d2,_0x2760b4){return db[_0x90db('0x3b')][_0x90db('0x49')]()['then'](respondWithResult(_0x2760b4,null))[_0x90db('0x40')](handleError(_0x2760b4,null));}; \ No newline at end of file +var _0xa54f=['sendStatus','status','end','json','undefined','count','offset','set','reject','then','destroy','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','fs-extra','lodash','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x19b351,_0x547358){var _0x104803=function(_0x412161){while(--_0x412161){_0x19b351['push'](_0x19b351['shift']());}};_0x104803(++_0x547358);}(_0xa54f,0x1e9));var _0xfa54=function(_0x5e7913,_0x3d4099){_0x5e7913=_0x5e7913-0x0;var _0x1d50a2=_0xa54f[_0x5e7913];return _0x1d50a2;};'use strict';var emlformat=require(_0xfa54('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfa54('0x1'));var jsonpatch=require(_0xfa54('0x2'));var rp=require(_0xfa54('0x3'));var moment=require(_0xfa54('0x4'));var BPromise=require(_0xfa54('0x5'));var Mustache=require(_0xfa54('0x6'));var util=require('util');var path=require('path');var sox=require(_0xfa54('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfa54('0x8'));var _=require(_0xfa54('0x9'));var squel=require('squel');var crypto=require(_0xfa54('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfa54('0xb'));var querystring=require(_0xfa54('0xc'));var Papa=require(_0xfa54('0xd'));var Redis=require(_0xfa54('0xe'));var authService=require(_0xfa54('0xf'));var qs=require(_0xfa54('0x10'));var as=require(_0xfa54('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfa54('0x12'))('api');var utils=require(_0xfa54('0x13'));var config=require(_0xfa54('0x14'));var licenseUtil=require(_0xfa54('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27af07,_0x55c429){_0x55c429=_0x55c429||0xcc;return function(_0x37f618){if(_0x37f618){return _0x27af07[_0xfa54('0x16')](_0x55c429);}return _0x27af07[_0xfa54('0x17')](_0x55c429)[_0xfa54('0x18')]();};}function respondWithResult(_0x247873,_0x49b480){_0x49b480=_0x49b480||0xc8;return function(_0x9f17f0){if(_0x9f17f0){return _0x247873['status'](_0x49b480)[_0xfa54('0x19')](_0x9f17f0);}};}function respondWithFilteredResult(_0x1811da,_0xd20bf4){return function(_0xb866d7){if(_0xb866d7){var _0x412e1d=typeof _0xd20bf4['offset']==='undefined'&&typeof _0xd20bf4['limit']===_0xfa54('0x1a');var _0x293ef1=_0xb866d7[_0xfa54('0x1b')];var _0x3bb7f9=_0x412e1d?0x0:_0xd20bf4[_0xfa54('0x1c')];var _0x19368c=_0x412e1d?_0xb866d7[_0xfa54('0x1b')]:_0xd20bf4['offset']+_0xd20bf4['limit'];var _0x7653db;if(_0x19368c>=_0x293ef1){_0x19368c=_0x293ef1;_0x7653db=0xc8;}else{_0x7653db=0xce;}_0x1811da[_0xfa54('0x17')](_0x7653db);return _0x1811da[_0xfa54('0x1d')]('Content-Range',_0x3bb7f9+'-'+_0x19368c+'/'+_0x293ef1)['json'](_0xb866d7);}return null;};}function patchUpdates(_0x39af5b){return function(_0x2f371f){try{jsonpatch['apply'](_0x2f371f,_0x39af5b,!![]);}catch(_0x356f8c){return BPromise[_0xfa54('0x1e')](_0x356f8c);}return _0x2f371f['save']();};}function saveUpdates(_0x5b977f,_0x1756ac){return function(_0x437705){if(_0x437705){return _0x437705['update'](_0x5b977f)[_0xfa54('0x1f')](function(_0x475372){return _0x475372;});}return null;};}function removeEntity(_0x4c9895,_0x148b98){return function(_0x5e25f3){if(_0x5e25f3){return _0x5e25f3[_0xfa54('0x20')]()['then'](function(){_0x4c9895['status'](0xcc)[_0xfa54('0x18')]();});}};}function handleEntityNotFound(_0x4e0b0f,_0x336716){return function(_0x1595e0){if(!_0x1595e0){_0x4e0b0f[_0xfa54('0x16')](0x194);}return _0x1595e0;};}function handleError(_0x1b01c9,_0x1888dc){_0x1888dc=_0x1888dc||0x1f4;return function(_0x499350){logger[_0xfa54('0x21')](_0x499350[_0xfa54('0x22')]);if(_0x499350['name']){delete _0x499350[_0xfa54('0x23')];}_0x1b01c9['status'](_0x1888dc)[_0xfa54('0x24')](_0x499350);};}exports[_0xfa54('0x25')]=function(_0x23e6d5,_0x250f0b){var _0x2d5ab3={},_0x515287={},_0x45421e={'count':0x0,'rows':[]};var _0x14c8b9=_[_0xfa54('0x26')](db[_0xfa54('0x27')][_0xfa54('0x28')],function(_0x478c07){return{'name':_0x478c07[_0xfa54('0x29')],'type':_0x478c07[_0xfa54('0x2a')][_0xfa54('0x2b')]};});_0x515287[_0xfa54('0x2c')]=_['map'](_0x14c8b9,_0xfa54('0x23'));_0x515287['query']=_[_0xfa54('0x2d')](_0x23e6d5[_0xfa54('0x2e')]);_0x515287['filters']=_[_0xfa54('0x2f')](_0x515287[_0xfa54('0x2c')],_0x515287[_0xfa54('0x2e')]);_0x2d5ab3[_0xfa54('0x30')]=_['intersection'](_0x515287[_0xfa54('0x2c')],qs['fields'](_0x23e6d5[_0xfa54('0x2e')][_0xfa54('0x31')]));_0x2d5ab3[_0xfa54('0x30')]=_0x2d5ab3['attributes'][_0xfa54('0x32')]?_0x2d5ab3[_0xfa54('0x30')]:_0x515287['model'];if(!_0x23e6d5[_0xfa54('0x2e')][_0xfa54('0x33')](_0xfa54('0x34'))){_0x2d5ab3[_0xfa54('0x35')]=qs[_0xfa54('0x35')](_0x23e6d5['query'][_0xfa54('0x35')]);_0x2d5ab3[_0xfa54('0x1c')]=qs[_0xfa54('0x1c')](_0x23e6d5[_0xfa54('0x2e')][_0xfa54('0x1c')]);}_0x2d5ab3['order']=qs[_0xfa54('0x36')](_0x23e6d5[_0xfa54('0x2e')][_0xfa54('0x36')]);_0x2d5ab3[_0xfa54('0x37')]=qs[_0xfa54('0x38')](_[_0xfa54('0x39')](_0x23e6d5[_0xfa54('0x2e')],_0x515287[_0xfa54('0x38')]),_0x14c8b9);if(_0x23e6d5[_0xfa54('0x2e')][_0xfa54('0x3a')]){_0x2d5ab3[_0xfa54('0x37')]=_[_0xfa54('0x3b')](_0x2d5ab3['where'],{'$or':_['map'](_0x14c8b9,function(_0x5a53d4){if(_0x5a53d4[_0xfa54('0x2a')]!==_0xfa54('0x3c')){var _0x418bf2={};_0x418bf2[_0x5a53d4[_0xfa54('0x23')]]={'$like':'%'+_0x23e6d5[_0xfa54('0x2e')]['filter']+'%'};return _0x418bf2;}})});}_0x2d5ab3=_[_0xfa54('0x3b')]({},_0x2d5ab3,_0x23e6d5[_0xfa54('0x3d')]);var _0x13be75={'where':_0x2d5ab3[_0xfa54('0x37')]};return db[_0xfa54('0x27')][_0xfa54('0x1b')](_0x13be75)['then'](function(_0x261db9){_0x45421e[_0xfa54('0x1b')]=_0x261db9;if(_0x23e6d5[_0xfa54('0x2e')][_0xfa54('0x3e')]){_0x2d5ab3['include']=[{'all':!![]}];}return db[_0xfa54('0x27')][_0xfa54('0x3f')](_0x2d5ab3);})[_0xfa54('0x1f')](function(_0x516f23){_0x45421e[_0xfa54('0x40')]=_0x516f23;return _0x45421e;})['then'](respondWithFilteredResult(_0x250f0b,_0x2d5ab3))['catch'](handleError(_0x250f0b,null));};exports[_0xfa54('0x41')]=function(_0x1ea048,_0x3fbf9a){var _0x3ab3d2={'raw':!![],'where':{'id':_0x1ea048[_0xfa54('0x42')]['id']}},_0x5b8bcc={};_0x5b8bcc['model']=_[_0xfa54('0x2d')](db[_0xfa54('0x27')][_0xfa54('0x28')]);_0x5b8bcc['query']=_[_0xfa54('0x2d')](_0x1ea048[_0xfa54('0x2e')]);_0x5b8bcc[_0xfa54('0x38')]=_[_0xfa54('0x2f')](_0x5b8bcc[_0xfa54('0x2c')],_0x5b8bcc[_0xfa54('0x2e')]);_0x3ab3d2[_0xfa54('0x30')]=_[_0xfa54('0x2f')](_0x5b8bcc['model'],qs[_0xfa54('0x31')](_0x1ea048[_0xfa54('0x2e')][_0xfa54('0x31')]));_0x3ab3d2[_0xfa54('0x30')]=_0x3ab3d2[_0xfa54('0x30')]['length']?_0x3ab3d2[_0xfa54('0x30')]:_0x5b8bcc[_0xfa54('0x2c')];if(_0x1ea048[_0xfa54('0x2e')][_0xfa54('0x3e')]){_0x3ab3d2[_0xfa54('0x43')]=[{'all':!![]}];}_0x3ab3d2=_['merge']({},_0x3ab3d2,_0x1ea048['options']);return db[_0xfa54('0x27')][_0xfa54('0x44')](_0x3ab3d2)[_0xfa54('0x1f')](handleEntityNotFound(_0x3fbf9a,null))[_0xfa54('0x1f')](respondWithResult(_0x3fbf9a,null))[_0xfa54('0x45')](handleError(_0x3fbf9a,null));};exports[_0xfa54('0x46')]=function(_0x3a9f5e,_0x308eb2){return db[_0xfa54('0x27')]['create'](_0x3a9f5e[_0xfa54('0x47')],{})['then'](respondWithResult(_0x308eb2,0xc9))[_0xfa54('0x45')](handleError(_0x308eb2,null));};exports['update']=function(_0x1c03a4,_0x144954){if(_0x1c03a4[_0xfa54('0x47')]['id']){delete _0x1c03a4[_0xfa54('0x47')]['id'];}return db[_0xfa54('0x27')][_0xfa54('0x44')]({'where':{'id':_0x1c03a4[_0xfa54('0x42')]['id']}})[_0xfa54('0x1f')](handleEntityNotFound(_0x144954,null))[_0xfa54('0x1f')](saveUpdates(_0x1c03a4[_0xfa54('0x47')],null))[_0xfa54('0x1f')](respondWithResult(_0x144954,null))[_0xfa54('0x45')](handleError(_0x144954,null));};exports[_0xfa54('0x20')]=function(_0x2b6131,_0x7abc9e){return db[_0xfa54('0x27')]['find']({'where':{'id':_0x2b6131['params']['id']}})[_0xfa54('0x1f')](handleEntityNotFound(_0x7abc9e,null))['then'](removeEntity(_0x7abc9e,null))['catch'](handleError(_0x7abc9e,null));};exports[_0xfa54('0x48')]=function(_0x5df481,_0x3d6183){return db['SquareDetailsReport']['describe']()[_0xfa54('0x1f')](respondWithResult(_0x3d6183,null))[_0xfa54('0x45')](handleError(_0x3d6183,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index cb05a00..fa93b50 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 _0x7fee=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger'];(function(_0x143ee7,_0x18e5d3){var _0x31b693=function(_0xbe2612){while(--_0xbe2612){_0x143ee7['push'](_0x143ee7['shift']());}};_0x31b693(++_0x18e5d3);}(_0x7fee,0x189));var _0xe7fe=function(_0x3718b7,_0x2da677){_0x3718b7=_0x3718b7-0x0;var _0xf8c91e=_0x7fee[_0x3718b7];return _0xf8c91e;};'use strict';var _=require(_0xe7fe('0x0'));var util=require(_0xe7fe('0x1'));var logger=require(_0xe7fe('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe7fe('0x3'));var rp=require(_0xe7fe('0x4'));var fs=require('fs');var path=require(_0xe7fe('0x5'));var rimraf=require(_0xe7fe('0x6'));var config=require(_0xe7fe('0x7'));var attributes=require('./squareReportDetail.attributes');module[_0xe7fe('0x8')]=function(_0x2c6efa,_0x148dbd){return _0x2c6efa[_0xe7fe('0x9')](_0xe7fe('0xa'),attributes,{'tableName':_0xe7fe('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba52=['./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0xd9dbce,_0x4c3192){var _0x49ce7d=function(_0x5c8832){while(--_0x5c8832){_0xd9dbce['push'](_0xd9dbce['shift']());}};_0x49ce7d(++_0x4c3192);}(_0xba52,0x1bf));var _0x2ba5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xba52[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x2ba5('0x0'));var util=require(_0x2ba5('0x1'));var logger=require(_0x2ba5('0x2'))(_0x2ba5('0x3'));var moment=require(_0x2ba5('0x4'));var BPromise=require('bluebird');var rp=require(_0x2ba5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2ba5('0x6'));var config=require(_0x2ba5('0x7'));var attributes=require(_0x2ba5('0x8'));module[_0x2ba5('0x9')]=function(_0xe3342a,_0x13ca85){return _0xe3342a[_0x2ba5('0xa')](_0x2ba5('0xb'),attributes,{'tableName':_0x2ba5('0xc'),'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 52e9d37..c46b5eb 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 _0xdc9b=['code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','body','options','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdc9b,0x70));var _0xbdc9=function(_0x3ba2ba,_0x28833b){_0x3ba2ba=_0x3ba2ba-0x0;var _0x13cf52=_0xdc9b[_0x3ba2ba];return _0x13cf52;};'use strict';var _=require(_0xbdc9('0x0'));var util=require(_0xbdc9('0x1'));var moment=require(_0xbdc9('0x2'));var BPromise=require('bluebird');var rs=require(_0xbdc9('0x3'));var fs=require('fs');var Redis=require(_0xbdc9('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbdc9('0x5'))(_0xbdc9('0x6'));var config=require('../../config/environment');var jayson=require(_0xbdc9('0x7'));var client=jayson[_0xbdc9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x472956,_0x597a18,_0x3a3dc9){return new BPromise(function(_0x15236a,_0x3b3cbd){return client[_0xbdc9('0x9')](_0x472956,_0x3a3dc9)[_0xbdc9('0xa')](function(_0x33f353){logger[_0xbdc9('0xb')](_0xbdc9('0xc'),_0x597a18,_0xbdc9('0xd'));logger[_0xbdc9('0xe')](_0xbdc9('0xf'),_0x597a18,_0xbdc9('0xd'),JSON[_0xbdc9('0x10')](_0x33f353));if(_0x33f353[_0xbdc9('0x11')]){if(_0x33f353[_0xbdc9('0x11')][_0xbdc9('0x12')]===0x1f4){logger[_0xbdc9('0x11')](_0xbdc9('0xc'),_0x597a18,_0x33f353[_0xbdc9('0x11')][_0xbdc9('0x13')]);return _0x3b3cbd(_0x33f353[_0xbdc9('0x11')]['message']);}logger[_0xbdc9('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x597a18,_0x33f353['error'][_0xbdc9('0x13')]);return _0x15236a(_0x33f353[_0xbdc9('0x11')]['message']);}else{logger[_0xbdc9('0xb')](_0xbdc9('0xc'),_0x597a18,_0xbdc9('0xd'));_0x15236a(_0x33f353[_0xbdc9('0x14')][_0xbdc9('0x13')]);}})[_0xbdc9('0x15')](function(_0x4f6125){logger['error'](_0xbdc9('0xc'),_0x597a18,_0x4f6125);_0x3b3cbd(_0x4f6125);});});}exports[_0xbdc9('0x16')]=function(_0x32b094){var _0x54add5=this;return new Promise(function(_0x4f60f4,_0x333488){return db[_0xbdc9('0x17')]['create'](_0x32b094[_0xbdc9('0x18')],{'raw':_0x32b094[_0xbdc9('0x19')]?_0x32b094[_0xbdc9('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xbdc9('0xa')](function(_0x37e81f){logger[_0xbdc9('0xb')](_0xbdc9('0x16'),_0x32b094);logger[_0xbdc9('0xe')](_0xbdc9('0x16'),_0x32b094,JSON['stringify'](_0x37e81f));_0x4f60f4(_0x37e81f);})['catch'](function(_0x2d9831){logger[_0xbdc9('0x11')](_0xbdc9('0x16'),_0x2d9831['message'],_0x32b094);_0x333488(_0x54add5[_0xbdc9('0x11')](0x1f4,_0x2d9831[_0xbdc9('0x13')]));});});}; \ No newline at end of file +var _0xbbbc=['options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','request\x20sent','error','message','result','catch','CreateSquareDetailsReport','create','body'];(function(_0xa2ee05,_0x3add08){var _0xeac894=function(_0x391ce9){while(--_0x391ce9){_0xa2ee05['push'](_0xa2ee05['shift']());}};_0xeac894(++_0x3add08);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x319b0c,_0xbeb58a){_0x319b0c=_0x319b0c-0x0;var _0x1e9dbe=_0xbbbc[_0x319b0c];return _0x1e9dbe;};'use strict';var _=require(_0xcbbb('0x0'));var util=require(_0xcbbb('0x1'));var moment=require(_0xcbbb('0x2'));var BPromise=require(_0xcbbb('0x3'));var rs=require(_0xcbbb('0x4'));var fs=require('fs');var Redis=require(_0xcbbb('0x5'));var db=require(_0xcbbb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcbbb('0x7'))(_0xcbbb('0x8'));var config=require(_0xcbbb('0x9'));var jayson=require(_0xcbbb('0xa'));var client=jayson[_0xcbbb('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x388197,_0x1796b4,_0x32ec9c){return new BPromise(function(_0x6f4fd8,_0x356249){return client[_0xcbbb('0xc')](_0x388197,_0x32ec9c)[_0xcbbb('0xd')](function(_0x4ec90a){logger[_0xcbbb('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x1796b4,'request\x20sent');logger[_0xcbbb('0xf')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x1796b4,_0xcbbb('0x10'),JSON['stringify'](_0x4ec90a));if(_0x4ec90a[_0xcbbb('0x11')]){if(_0x4ec90a[_0xcbbb('0x11')]['code']===0x1f4){logger[_0xcbbb('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x1796b4,_0x4ec90a[_0xcbbb('0x11')]['message']);return _0x356249(_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);}logger[_0xcbbb('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x1796b4,_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);return _0x6f4fd8(_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);}else{logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x1796b4,_0xcbbb('0x10'));_0x6f4fd8(_0x4ec90a[_0xcbbb('0x13')][_0xcbbb('0x12')]);}})[_0xcbbb('0x14')](function(_0x5e25ca){logger[_0xcbbb('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x1796b4,_0x5e25ca);_0x356249(_0x5e25ca);});});}exports[_0xcbbb('0x15')]=function(_0x3436af){var _0x3572bb=this;return new Promise(function(_0x5052df,_0x57c5e9){return db['SquareDetailsReport'][_0xcbbb('0x16')](_0x3436af[_0xcbbb('0x17')],{'raw':_0x3436af[_0xcbbb('0x18')]?_0x3436af[_0xcbbb('0x18')][_0xcbbb('0x19')]===undefined?!![]:![]:!![]})[_0xcbbb('0xd')](function(_0x45de5f){logger[_0xcbbb('0xe')](_0xcbbb('0x15'),_0x3436af);logger[_0xcbbb('0xf')]('CreateSquareDetailsReport',_0x3436af,JSON[_0xcbbb('0x1a')](_0x45de5f));_0x5052df(_0x45de5f);})[_0xcbbb('0x14')](function(_0x159c62){logger[_0xcbbb('0x11')](_0xcbbb('0x15'),_0x159c62[_0xcbbb('0x12')],_0x3436af);_0x57c5e9(_0x3572bb[_0xcbbb('0x11')](0x1f4,_0x159c62[_0xcbbb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 8989c45..5956e40 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 _0x7283=['index','/process/:pid/kill','exports','Router','../../components/auth/service','./system.controller','get','isAuthenticated'];(function(_0x566168,_0x4c39af){var _0x4e1f7a=function(_0x5ec3ee){while(--_0x5ec3ee){_0x566168['push'](_0x566168['shift']());}};_0x4e1f7a(++_0x4c39af);}(_0x7283,0x1db));var _0x3728=function(_0x48d59d,_0x3fa5bc){_0x48d59d=_0x48d59d-0x0;var _0x280dd9=_0x7283[_0x48d59d];return _0x280dd9;};'use strict';var express=require('express');var router=express[_0x3728('0x0')]();var auth=require(_0x3728('0x1'));var controller=require(_0x3728('0x2'));router[_0x3728('0x3')]('/',auth[_0x3728('0x4')](),controller[_0x3728('0x5')]);router['get'](_0x3728('0x6'),auth['isAuthenticated'](),controller['killProcess']);module[_0x3728('0x7')]=router; \ No newline at end of file +var _0x669e=['/process/:pid/kill','killProcess','exports','express','Router','../../components/auth/service','./system.controller','isAuthenticated','get'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x669e,0x1c5));var _0xe669=function(_0x20d7b0,_0x5b3533){_0x20d7b0=_0x20d7b0-0x0;var _0x13e0ba=_0x669e[_0x20d7b0];return _0x13e0ba;};'use strict';var express=require(_0xe669('0x0'));var router=express[_0xe669('0x1')]();var auth=require(_0xe669('0x2'));var controller=require(_0xe669('0x3'));router['get']('/',auth[_0xe669('0x4')](),controller['index']);router[_0xe669('0x5')](_0xe669('0x6'),auth[_0xe669('0x4')](),controller[_0xe669('0x7')]);module[_0xe669('0x8')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 647be97..c6f49e0 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 _0xfc4f=['format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','exec','../../config/logger','api','util','bluebird','lodash','error','inspect','name','send','index','then','status','json','catch','killProcess','components/import/cm'];(function(_0x2f4d78,_0x32843d){var _0x52dc04=function(_0x3f9b68){while(--_0x3f9b68){_0x2f4d78['push'](_0x2f4d78['shift']());}};_0x52dc04(++_0x32843d);}(_0xfc4f,0x192));var _0xffc4=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xfc4f[_0x432682];return _0x463d05;};'use strict';var info=require('systeminformation');var exec=require(_0xffc4('0x0'))[_0xffc4('0x1')];var logger=require(_0xffc4('0x2'))(_0xffc4('0x3'));var util=require(_0xffc4('0x4'));var BPromise=require(_0xffc4('0x5'));var _=require(_0xffc4('0x6'));function handleError(_0x5943be,_0x289659,_0x211cfa){_0x289659=_0x289659||0x1f4;return function(_0x4ebd84){logger[_0xffc4('0x7')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x211cfa,_0x289659,util[_0xffc4('0x8')](_0x4ebd84,{'showHidden':![],'depth':null}));delete _0x4ebd84[_0xffc4('0x9')];_0x5943be['status'](_0x289659)[_0xffc4('0xa')](_0x4ebd84);};}exports[_0xffc4('0xb')]=function(_0x12d5eb,_0x247ab1){return info['getAllData']()[_0xffc4('0xc')](function(_0x22d03a){return _0x247ab1[_0xffc4('0xd')](0xc8)[_0xffc4('0xe')](_0x22d03a);})[_0xffc4('0xf')](function(_0x332ab5){return _0x247ab1['status'](0x1f4)[_0xffc4('0xe')](_0x332ab5);});};exports[_0xffc4('0x10')]=function(_0x2766b4,_0x260d02){var _0x3608c5=[_0xffc4('0x11')];return new BPromise(function(_0xfd810f,_0x53ae32){return exec(util[_0xffc4('0x12')](_0xffc4('0x13'),_0x2766b4['params'][_0xffc4('0x14')]),function(_0x2f6e00,_0x515412,_0x2ed4c8){if(_0x2f6e00){return _0x53ae32(_0x2f6e00);}return _0xfd810f(_0x515412);});})[_0xffc4('0xc')](function(_0x4690ae){var _0x21a41f=![];var _0x56c731=_0x4690ae[_0xffc4('0x15')](/\n/);for(var _0x3c6d5f=0x0,_0x3d3baa=_0x3608c5[_0xffc4('0x16')];_0x3c6d5f<_0x3d3baa,_0x21a41f===![];_0x3c6d5f+=0x1){if(_0x4690ae[_0xffc4('0x17')](_0x3608c5[_0x3c6d5f])>=0x0){_0x21a41f=!![];}}if(!_0x21a41f){throw new Error(util[_0xffc4('0x12')](_0xffc4('0x18'),_0x2766b4[_0xffc4('0x19')][_0xffc4('0x14')]));}process[_0xffc4('0x1a')](_0x2766b4['params'][_0xffc4('0x14')],'SIGINT');return _0x260d02['status'](0xc8)[_0xffc4('0xe')]({'message':util[_0xffc4('0x12')](_0xffc4('0x1b'),_0x2766b4['params'][_0xffc4('0x14')])});})[_0xffc4('0xf')](handleError(_0x260d02,null,_0xffc4('0x10')));}; \ No newline at end of file +var _0x179b=['inspect','name','status','send','index','then','json','catch','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','exec','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s'];(function(_0x19ddb6,_0x55187f){var _0x2af936=function(_0x438910){while(--_0x438910){_0x19ddb6['push'](_0x19ddb6['shift']());}};_0x2af936(++_0x55187f);}(_0x179b,0x171));var _0xb179=function(_0x2ff238,_0x1811d2){_0x2ff238=_0x2ff238-0x0;var _0x204a56=_0x179b[_0x2ff238];return _0x204a56;};'use strict';var info=require(_0xb179('0x0'));var exec=require('child_process')[_0xb179('0x1')];var logger=require(_0xb179('0x2'))(_0xb179('0x3'));var util=require(_0xb179('0x4'));var BPromise=require(_0xb179('0x5'));var _=require(_0xb179('0x6'));function handleError(_0x455e10,_0xf10601,_0x2fe619){_0xf10601=_0xf10601||0x1f4;return function(_0x26adfc){logger[_0xb179('0x7')](_0xb179('0x8'),_0x2fe619,_0xf10601,util[_0xb179('0x9')](_0x26adfc,{'showHidden':![],'depth':null}));delete _0x26adfc[_0xb179('0xa')];_0x455e10[_0xb179('0xb')](_0xf10601)[_0xb179('0xc')](_0x26adfc);};}exports[_0xb179('0xd')]=function(_0xf22967,_0x54ce28){return info['getAllData']()[_0xb179('0xe')](function(_0x55bbe0){return _0x54ce28[_0xb179('0xb')](0xc8)[_0xb179('0xf')](_0x55bbe0);})[_0xb179('0x10')](function(_0x494dda){return _0x54ce28[_0xb179('0xb')](0x1f4)[_0xb179('0xf')](_0x494dda);});};exports[_0xb179('0x11')]=function(_0x29de85,_0x3aac09){var _0x31804e=['components/import/cm'];return new BPromise(function(_0x25aada,_0x20f575){return exec(util[_0xb179('0x12')](_0xb179('0x13'),_0x29de85[_0xb179('0x14')][_0xb179('0x15')]),function(_0x5547d4,_0x479a63,_0x416869){if(_0x5547d4){return _0x20f575(_0x5547d4);}return _0x25aada(_0x479a63);});})[_0xb179('0xe')](function(_0x38e551){var _0x14751b=![];var _0x1903fb=_0x38e551[_0xb179('0x16')](/\n/);for(var _0x6d6bc4=0x0,_0xeb06c5=_0x31804e[_0xb179('0x17')];_0x6d6bc4<_0xeb06c5,_0x14751b===![];_0x6d6bc4+=0x1){if(_0x38e551['indexOf'](_0x31804e[_0x6d6bc4])>=0x0){_0x14751b=!![];}}if(!_0x14751b){throw new Error(util[_0xb179('0x12')](_0xb179('0x18'),_0x29de85[_0xb179('0x14')][_0xb179('0x15')]));}process[_0xb179('0x19')](_0x29de85[_0xb179('0x14')]['pid'],'SIGINT');return _0x3aac09[_0xb179('0xb')](0xc8)[_0xb179('0xf')]({'message':util[_0xb179('0x12')](_0xb179('0x1a'),_0x29de85[_0xb179('0x14')][_0xb179('0x15')])});})['catch'](handleError(_0x3aac09,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index eaa2c65..f447779 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 _0x22ab=['multer','util','path','connect-timeout','express','Router','../../config/environment','./tag.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports'];(function(_0x470bfb,_0x389787){var _0x2f5d97=function(_0x3431b4){while(--_0x3431b4){_0x470bfb['push'](_0x470bfb['shift']());}};_0x2f5d97(++_0x389787);}(_0x22ab,0x78));var _0xb22a=function(_0x542da8,_0x509c26){_0x542da8=_0x542da8-0x0;var _0x533d7e=_0x22ab[_0x542da8];return _0x533d7e;};'use strict';var multer=require(_0xb22a('0x0'));var util=require(_0xb22a('0x1'));var path=require(_0xb22a('0x2'));var timeout=require(_0xb22a('0x3'));var express=require(_0xb22a('0x4'));var router=express[_0xb22a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb22a('0x6'));var controller=require(_0xb22a('0x7'));router[_0xb22a('0x8')]('/',auth[_0xb22a('0x9')](),controller[_0xb22a('0xa')]);router[_0xb22a('0x8')]('/:id',auth[_0xb22a('0x9')](),controller[_0xb22a('0xb')]);router[_0xb22a('0xc')]('/',auth[_0xb22a('0x9')](),controller[_0xb22a('0xd')]);router[_0xb22a('0xe')](_0xb22a('0xf'),auth[_0xb22a('0x9')](),controller[_0xb22a('0x10')]);router[_0xb22a('0x11')](_0xb22a('0xf'),auth[_0xb22a('0x9')](),controller[_0xb22a('0x12')]);module[_0xb22a('0x13')]=router; \ No newline at end of file +var _0x5790=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','show','post','create','update','multer'];(function(_0x382d98,_0x2b92f3){var _0xc7ec28=function(_0x3a3661){while(--_0x3a3661){_0x382d98['push'](_0x382d98['shift']());}};_0xc7ec28(++_0x2b92f3);}(_0x5790,0xa1));var _0x0579=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x5790[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0x0579('0x0'));var util=require('util');var path=require(_0x0579('0x1'));var timeout=require(_0x0579('0x2'));var express=require(_0x0579('0x3'));var router=express[_0x0579('0x4')]();var fs_extra=require(_0x0579('0x5'));var auth=require(_0x0579('0x6'));var interaction=require(_0x0579('0x7'));var config=require(_0x0579('0x8'));var controller=require(_0x0579('0x9'));router[_0x0579('0xa')]('/',auth[_0x0579('0xb')](),controller[_0x0579('0xc')]);router[_0x0579('0xa')](_0x0579('0xd'),auth[_0x0579('0xb')](),controller[_0x0579('0xe')]);router[_0x0579('0xf')]('/',auth[_0x0579('0xb')](),controller[_0x0579('0x10')]);router['put']('/:id',auth[_0x0579('0xb')](),controller[_0x0579('0x11')]);router['delete'](_0x0579('0xd'),auth[_0x0579('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 9e0ab02..29d1120 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 _0xb7aa=['name','#0091EA','sequelize','exports','STRING'];(function(_0x16f8d6,_0xeae008){var _0x30d2ff=function(_0x1e5cd9){while(--_0x1e5cd9){_0x16f8d6['push'](_0x16f8d6['shift']());}};_0x30d2ff(++_0xeae008);}(_0xb7aa,0x11a));var _0xab7a=function(_0x3c6ac3,_0xe22b48){_0x3c6ac3=_0x3c6ac3-0x0;var _0x348b12=_0xb7aa[_0x3c6ac3];return _0x348b12;};'use strict';var Sequelize=require(_0xab7a('0x0'));module[_0xab7a('0x1')]={'name':{'type':Sequelize[_0xab7a('0x2')],'unique':_0xab7a('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xab7a('0x2')],'defaultValue':_0xab7a('0x4')},'description':{'type':Sequelize[_0xab7a('0x2')]}}; \ No newline at end of file +var _0x73a1=['name','#0091EA','STRING'];(function(_0x35e8e3,_0xfa7bcd){var _0x42de5f=function(_0x32993b){while(--_0x32993b){_0x35e8e3['push'](_0x35e8e3['shift']());}};_0x42de5f(++_0xfa7bcd);}(_0x73a1,0x161));var _0x173a=function(_0x4f11cb,_0x14e174){_0x4f11cb=_0x4f11cb-0x0;var _0x491488=_0x73a1[_0x4f11cb];return _0x491488;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x173a('0x0')],'unique':_0x173a('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x173a('0x2')},'description':{'type':Sequelize[_0x173a('0x0')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index ef02261..3b4aa45 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 _0xf120=['apply','reject','update','then','destroy','Tags','UserProfileResource','error','stack','name','send','map','Tag','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','filters','pick','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','Content-Range'];(function(_0x57e4b0,_0x3750f7){var _0x33a822=function(_0x527d41){while(--_0x527d41){_0x57e4b0['push'](_0x57e4b0['shift']());}};_0x33a822(++_0x3750f7);}(_0xf120,0x179));var _0x0f12=function(_0x2cc4cb,_0x1e4cfe){_0x2cc4cb=_0x2cc4cb-0x0;var _0x2c9c3a=_0xf120[_0x2cc4cb];return _0x2c9c3a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0f12('0x0'));var zipdir=require(_0x0f12('0x1'));var jsonpatch=require(_0x0f12('0x2'));var rp=require('request-promise');var moment=require(_0x0f12('0x3'));var BPromise=require(_0x0f12('0x4'));var Mustache=require(_0x0f12('0x5'));var util=require('util');var path=require(_0x0f12('0x6'));var sox=require(_0x0f12('0x7'));var csv=require(_0x0f12('0x8'));var ejs=require(_0x0f12('0x9'));var fs=require('fs');var fs_extra=require(_0x0f12('0xa'));var _=require(_0x0f12('0xb'));var squel=require(_0x0f12('0xc'));var crypto=require(_0x0f12('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0f12('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0f12('0xf'));var Papa=require(_0x0f12('0x10'));var Redis=require(_0x0f12('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0f12('0x12'));var hardwareService=require(_0x0f12('0x13'));var logger=require(_0x0f12('0x14'))(_0x0f12('0x15'));var utils=require(_0x0f12('0x16'));var config=require(_0x0f12('0x17'));var licenseUtil=require(_0x0f12('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf75042,_0x11a236){_0x11a236=_0x11a236||0xcc;return function(_0xb80905){if(_0xb80905){return _0xf75042[_0x0f12('0x19')](_0x11a236);}return _0xf75042[_0x0f12('0x1a')](_0x11a236)[_0x0f12('0x1b')]();};}function respondWithResult(_0x35ef6f,_0x7f1ae7){_0x7f1ae7=_0x7f1ae7||0xc8;return function(_0x215a7a){if(_0x215a7a){return _0x35ef6f[_0x0f12('0x1a')](_0x7f1ae7)[_0x0f12('0x1c')](_0x215a7a);}};}function respondWithFilteredResult(_0x3f2716,_0xe61624){return function(_0x27addc){if(_0x27addc){var _0xeccb7c=typeof _0xe61624['offset']===_0x0f12('0x1d')&&typeof _0xe61624['limit']===_0x0f12('0x1d');var _0x3a7041=_0x27addc[_0x0f12('0x1e')];var _0x12eb6c=_0xeccb7c?0x0:_0xe61624[_0x0f12('0x1f')];var _0xa2168f=_0xeccb7c?_0x27addc['count']:_0xe61624[_0x0f12('0x1f')]+_0xe61624['limit'];var _0x18d689;if(_0xa2168f>=_0x3a7041){_0xa2168f=_0x3a7041;_0x18d689=0xc8;}else{_0x18d689=0xce;}_0x3f2716['status'](_0x18d689);return _0x3f2716['set'](_0x0f12('0x20'),_0x12eb6c+'-'+_0xa2168f+'/'+_0x3a7041)[_0x0f12('0x1c')](_0x27addc);}return null;};}function patchUpdates(_0x46e682){return function(_0x5e4af9){try{jsonpatch[_0x0f12('0x21')](_0x5e4af9,_0x46e682,!![]);}catch(_0x4bfc5d){return BPromise[_0x0f12('0x22')](_0x4bfc5d);}return _0x5e4af9['save']();};}function saveUpdates(_0x9f283b,_0x379851){return function(_0x4f06bd){if(_0x4f06bd){return _0x4f06bd[_0x0f12('0x23')](_0x9f283b)[_0x0f12('0x24')](function(_0x3a28ae){return _0x3a28ae;});}return null;};}function removeEntity(_0x3821dd,_0x44f3b1){return function(_0x59d65b){if(_0x59d65b){return _0x59d65b[_0x0f12('0x25')]()['then'](function(){var _0x4c3a28=_0x59d65b['get']({'plain':!![]});var _0xee18d0=_0x0f12('0x26');return db[_0x0f12('0x27')][_0x0f12('0x25')]({'where':{'type':_0xee18d0,'resourceId':_0x4c3a28['id']}})['then'](function(){return _0x59d65b;});})[_0x0f12('0x24')](function(){_0x3821dd[_0x0f12('0x1a')](0xcc)[_0x0f12('0x1b')]();});}};}function handleEntityNotFound(_0x5ca297,_0x13baa0){return function(_0x2fdde4){if(!_0x2fdde4){_0x5ca297[_0x0f12('0x19')](0x194);}return _0x2fdde4;};}function handleError(_0x5cb12b,_0xeee65){_0xeee65=_0xeee65||0x1f4;return function(_0x25a5dc){logger[_0x0f12('0x28')](_0x25a5dc[_0x0f12('0x29')]);if(_0x25a5dc[_0x0f12('0x2a')]){delete _0x25a5dc['name'];}_0x5cb12b['status'](_0xeee65)[_0x0f12('0x2b')](_0x25a5dc);};}exports['index']=function(_0x3516f8,_0x3c6ce5){var _0x453f9e={},_0x52fc14={},_0x12a575={'count':0x0,'rows':[]};var _0x45a39a=_[_0x0f12('0x2c')](db[_0x0f12('0x2d')][_0x0f12('0x2e')],function(_0x25d56e){return{'name':_0x25d56e['fieldName'],'type':_0x25d56e[_0x0f12('0x2f')][_0x0f12('0x30')]};});_0x52fc14[_0x0f12('0x31')]=_['map'](_0x45a39a,_0x0f12('0x2a'));_0x52fc14[_0x0f12('0x32')]=_[_0x0f12('0x33')](_0x3516f8[_0x0f12('0x32')]);_0x52fc14['filters']=_[_0x0f12('0x34')](_0x52fc14[_0x0f12('0x31')],_0x52fc14[_0x0f12('0x32')]);_0x453f9e[_0x0f12('0x35')]=_[_0x0f12('0x34')](_0x52fc14[_0x0f12('0x31')],qs[_0x0f12('0x36')](_0x3516f8['query'][_0x0f12('0x36')]));_0x453f9e[_0x0f12('0x35')]=_0x453f9e['attributes'][_0x0f12('0x37')]?_0x453f9e[_0x0f12('0x35')]:_0x52fc14['model'];if(!_0x3516f8[_0x0f12('0x32')][_0x0f12('0x38')]('nolimit')){_0x453f9e[_0x0f12('0x39')]=qs['limit'](_0x3516f8[_0x0f12('0x32')][_0x0f12('0x39')]);_0x453f9e[_0x0f12('0x1f')]=qs[_0x0f12('0x1f')](_0x3516f8[_0x0f12('0x32')][_0x0f12('0x1f')]);}_0x453f9e[_0x0f12('0x3a')]=qs[_0x0f12('0x3b')](_0x3516f8[_0x0f12('0x32')][_0x0f12('0x3b')]);_0x453f9e['where']=qs[_0x0f12('0x3c')](_[_0x0f12('0x3d')](_0x3516f8[_0x0f12('0x32')],_0x52fc14['filters']),_0x45a39a);if(_0x3516f8['query']['filter']){_0x453f9e[_0x0f12('0x3e')]=_[_0x0f12('0x3f')](_0x453f9e['where'],{'$or':_['map'](_0x45a39a,function(_0x21be62){if(_0x21be62[_0x0f12('0x2f')]!==_0x0f12('0x40')){var _0x51b8c8={};_0x51b8c8[_0x21be62[_0x0f12('0x2a')]]={'$like':'%'+_0x3516f8[_0x0f12('0x32')]['filter']+'%'};return _0x51b8c8;}})});}_0x453f9e=_[_0x0f12('0x3f')]({},_0x453f9e,_0x3516f8[_0x0f12('0x41')]);var _0x226be0={'where':_0x453f9e[_0x0f12('0x3e')]};return db[_0x0f12('0x2d')][_0x0f12('0x1e')](_0x226be0)[_0x0f12('0x24')](function(_0x4d9e11){_0x12a575[_0x0f12('0x1e')]=_0x4d9e11;if(_0x3516f8['query'][_0x0f12('0x42')]){_0x453f9e[_0x0f12('0x43')]=[{'all':!![]}];}return db['Tag'][_0x0f12('0x44')](_0x453f9e);})[_0x0f12('0x24')](function(_0x249dd4){_0x12a575['rows']=_0x249dd4;return _0x12a575;})['then'](respondWithFilteredResult(_0x3c6ce5,_0x453f9e))[_0x0f12('0x45')](handleError(_0x3c6ce5,null));};exports[_0x0f12('0x46')]=function(_0x106f93,_0x1637cb){var _0x5061bf={'raw':!![],'where':{'id':_0x106f93[_0x0f12('0x47')]['id']}},_0xbe1aca={};_0xbe1aca[_0x0f12('0x31')]=_[_0x0f12('0x33')](db['Tag'][_0x0f12('0x2e')]);_0xbe1aca[_0x0f12('0x32')]=_['keys'](_0x106f93['query']);_0xbe1aca[_0x0f12('0x3c')]=_[_0x0f12('0x34')](_0xbe1aca[_0x0f12('0x31')],_0xbe1aca['query']);_0x5061bf['attributes']=_[_0x0f12('0x34')](_0xbe1aca[_0x0f12('0x31')],qs['fields'](_0x106f93[_0x0f12('0x32')]['fields']));_0x5061bf[_0x0f12('0x35')]=_0x5061bf[_0x0f12('0x35')]['length']?_0x5061bf['attributes']:_0xbe1aca[_0x0f12('0x31')];if(_0x106f93[_0x0f12('0x32')][_0x0f12('0x42')]){_0x5061bf[_0x0f12('0x43')]=[{'all':!![]}];}_0x5061bf=_[_0x0f12('0x3f')]({},_0x5061bf,_0x106f93[_0x0f12('0x41')]);return db[_0x0f12('0x2d')][_0x0f12('0x48')](_0x5061bf)['then'](handleEntityNotFound(_0x1637cb,null))[_0x0f12('0x24')](respondWithResult(_0x1637cb,null))['catch'](handleError(_0x1637cb,null));};exports[_0x0f12('0x49')]=function(_0x52f1c2,_0x4add76){return db[_0x0f12('0x2d')]['create'](_0x52f1c2[_0x0f12('0x4a')],{})[_0x0f12('0x24')](function(_0x4298c8){var _0x284422=_0x52f1c2['user'][_0x0f12('0x4b')]({'plain':!![]});if(!_0x284422)throw new Error(_0x0f12('0x4c'));if(_0x284422[_0x0f12('0x4d')]===_0x0f12('0x4e')){var _0x48acec=_0x4298c8['get']({'plain':!![]});var _0x122a57=_0x0f12('0x26');return db[_0x0f12('0x4f')][_0x0f12('0x48')]({'where':{'name':_0x122a57,'userProfileId':_0x284422[_0x0f12('0x50')]},'raw':!![]})['then'](function(_0x48b7ec){if(_0x48b7ec&&_0x48b7ec['autoAssociation']===0x0){return db[_0x0f12('0x27')][_0x0f12('0x49')]({'name':_0x48acec[_0x0f12('0x2a')],'resourceId':_0x48acec['id'],'type':_0x48b7ec[_0x0f12('0x2a')],'sectionId':_0x48b7ec['id']},{})[_0x0f12('0x24')](function(){return _0x4298c8;});}else{return _0x4298c8;}})[_0x0f12('0x45')](function(_0x104ced){logger[_0x0f12('0x28')](_0x0f12('0x51'),_0x104ced);throw _0x104ced;});}return _0x4298c8;})[_0x0f12('0x24')](respondWithResult(_0x4add76,0xc9))[_0x0f12('0x45')](handleError(_0x4add76,null));};exports['update']=function(_0x1f05f6,_0x3dff95){if(_0x1f05f6[_0x0f12('0x4a')]['id']){delete _0x1f05f6[_0x0f12('0x4a')]['id'];}return db['Tag']['find']({'where':{'id':_0x1f05f6[_0x0f12('0x47')]['id']}})[_0x0f12('0x24')](handleEntityNotFound(_0x3dff95,null))[_0x0f12('0x24')](saveUpdates(_0x1f05f6[_0x0f12('0x4a')],null))[_0x0f12('0x24')](respondWithResult(_0x3dff95,null))[_0x0f12('0x45')](handleError(_0x3dff95,null));};exports[_0x0f12('0x25')]=function(_0x45da7f,_0x5b2bb1){return db[_0x0f12('0x2d')][_0x0f12('0x48')]({'where':{'id':_0x45da7f['params']['id']}})[_0x0f12('0x24')](handleEntityNotFound(_0x5b2bb1,null))[_0x0f12('0x24')](removeEntity(_0x5b2bb1,null))[_0x0f12('0x45')](handleError(_0x5b2bb1,null));}; \ No newline at end of file +var _0x6737=['error','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','reject','update','then','destroy','get','Tags','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','merge','options','Tag','include','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6737,0xe2));var _0x7673=function(_0x4e435e,_0x1b4952){_0x4e435e=_0x4e435e-0x0;var _0x5e3f4a=_0x6737[_0x4e435e];return _0x5e3f4a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7673('0x0'));var zipdir=require(_0x7673('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7673('0x2'));var moment=require(_0x7673('0x3'));var BPromise=require(_0x7673('0x4'));var Mustache=require(_0x7673('0x5'));var util=require('util');var path=require(_0x7673('0x6'));var sox=require(_0x7673('0x7'));var csv=require('to-csv');var ejs=require(_0x7673('0x8'));var fs=require('fs');var fs_extra=require(_0x7673('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7673('0xa'));var toCsv=require('to-csv');var querystring=require(_0x7673('0xb'));var Papa=require(_0x7673('0xc'));var Redis=require('ioredis');var authService=require(_0x7673('0xd'));var qs=require(_0x7673('0xe'));var as=require(_0x7673('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7673('0x10'));var utils=require('../../config/utils');var config=require(_0x7673('0x11'));var licenseUtil=require(_0x7673('0x12'));var db=require(_0x7673('0x13'))['db'];function respondWithStatusCode(_0x451c87,_0x41d6bd){_0x41d6bd=_0x41d6bd||0xcc;return function(_0x119e42){if(_0x119e42){return _0x451c87[_0x7673('0x14')](_0x41d6bd);}return _0x451c87[_0x7673('0x15')](_0x41d6bd)[_0x7673('0x16')]();};}function respondWithResult(_0x20a649,_0x5c8626){_0x5c8626=_0x5c8626||0xc8;return function(_0x26f0c4){if(_0x26f0c4){return _0x20a649[_0x7673('0x15')](_0x5c8626)[_0x7673('0x17')](_0x26f0c4);}};}function respondWithFilteredResult(_0x2c83d,_0x224cea){return function(_0x2e83c4){if(_0x2e83c4){var _0x2a2840=typeof _0x224cea['offset']==='undefined'&&typeof _0x224cea[_0x7673('0x18')]===_0x7673('0x19');var _0x50f8d9=_0x2e83c4[_0x7673('0x1a')];var _0x17699a=_0x2a2840?0x0:_0x224cea['offset'];var _0x33ff7d=_0x2a2840?_0x2e83c4[_0x7673('0x1a')]:_0x224cea[_0x7673('0x1b')]+_0x224cea['limit'];var _0x50f22d;if(_0x33ff7d>=_0x50f8d9){_0x33ff7d=_0x50f8d9;_0x50f22d=0xc8;}else{_0x50f22d=0xce;}_0x2c83d[_0x7673('0x15')](_0x50f22d);return _0x2c83d[_0x7673('0x1c')]('Content-Range',_0x17699a+'-'+_0x33ff7d+'/'+_0x50f8d9)[_0x7673('0x17')](_0x2e83c4);}return null;};}function patchUpdates(_0x29bbd9){return function(_0x2e1260){try{jsonpatch[_0x7673('0x1d')](_0x2e1260,_0x29bbd9,!![]);}catch(_0x4245bf){return BPromise[_0x7673('0x1e')](_0x4245bf);}return _0x2e1260['save']();};}function saveUpdates(_0x557161,_0xea9b37){return function(_0x21774f){if(_0x21774f){return _0x21774f[_0x7673('0x1f')](_0x557161)[_0x7673('0x20')](function(_0x16bb16){return _0x16bb16;});}return null;};}function removeEntity(_0x54f38d,_0x2009e1){return function(_0x3b2a75){if(_0x3b2a75){return _0x3b2a75[_0x7673('0x21')]()[_0x7673('0x20')](function(){var _0x132dc6=_0x3b2a75[_0x7673('0x22')]({'plain':!![]});var _0x538280=_0x7673('0x23');return db[_0x7673('0x24')][_0x7673('0x21')]({'where':{'type':_0x538280,'resourceId':_0x132dc6['id']}})[_0x7673('0x20')](function(){return _0x3b2a75;});})['then'](function(){_0x54f38d['status'](0xcc)[_0x7673('0x16')]();});}};}function handleEntityNotFound(_0x11b42b,_0x291d10){return function(_0x9d9eab){if(!_0x9d9eab){_0x11b42b[_0x7673('0x14')](0x194);}return _0x9d9eab;};}function handleError(_0x45a045,_0x442f42){_0x442f42=_0x442f42||0x1f4;return function(_0x5a59f9){logger['error'](_0x5a59f9[_0x7673('0x25')]);if(_0x5a59f9[_0x7673('0x26')]){delete _0x5a59f9[_0x7673('0x26')];}_0x45a045[_0x7673('0x15')](_0x442f42)[_0x7673('0x27')](_0x5a59f9);};}exports[_0x7673('0x28')]=function(_0x224122,_0x4f12b9){var _0x4fcacc={},_0xe7e528={},_0x36c841={'count':0x0,'rows':[]};var _0x268863=_[_0x7673('0x29')](db['Tag'][_0x7673('0x2a')],function(_0x497760){return{'name':_0x497760[_0x7673('0x2b')],'type':_0x497760[_0x7673('0x2c')][_0x7673('0x2d')]};});_0xe7e528[_0x7673('0x2e')]=_[_0x7673('0x29')](_0x268863,_0x7673('0x26'));_0xe7e528[_0x7673('0x2f')]=_[_0x7673('0x30')](_0x224122[_0x7673('0x2f')]);_0xe7e528[_0x7673('0x31')]=_[_0x7673('0x32')](_0xe7e528[_0x7673('0x2e')],_0xe7e528[_0x7673('0x2f')]);_0x4fcacc['attributes']=_[_0x7673('0x32')](_0xe7e528[_0x7673('0x2e')],qs[_0x7673('0x33')](_0x224122[_0x7673('0x2f')][_0x7673('0x33')]));_0x4fcacc[_0x7673('0x34')]=_0x4fcacc[_0x7673('0x34')]['length']?_0x4fcacc['attributes']:_0xe7e528[_0x7673('0x2e')];if(!_0x224122[_0x7673('0x2f')][_0x7673('0x35')](_0x7673('0x36'))){_0x4fcacc[_0x7673('0x18')]=qs[_0x7673('0x18')](_0x224122[_0x7673('0x2f')]['limit']);_0x4fcacc[_0x7673('0x1b')]=qs[_0x7673('0x1b')](_0x224122['query'][_0x7673('0x1b')]);}_0x4fcacc[_0x7673('0x37')]=qs[_0x7673('0x38')](_0x224122[_0x7673('0x2f')]['sort']);_0x4fcacc[_0x7673('0x39')]=qs[_0x7673('0x31')](_['pick'](_0x224122[_0x7673('0x2f')],_0xe7e528[_0x7673('0x31')]),_0x268863);if(_0x224122[_0x7673('0x2f')]['filter']){_0x4fcacc[_0x7673('0x39')]=_[_0x7673('0x3a')](_0x4fcacc[_0x7673('0x39')],{'$or':_['map'](_0x268863,function(_0x4c6106){if(_0x4c6106[_0x7673('0x2c')]!=='VIRTUAL'){var _0x4ba2b4={};_0x4ba2b4[_0x4c6106[_0x7673('0x26')]]={'$like':'%'+_0x224122[_0x7673('0x2f')]['filter']+'%'};return _0x4ba2b4;}})});}_0x4fcacc=_[_0x7673('0x3a')]({},_0x4fcacc,_0x224122[_0x7673('0x3b')]);var _0x2645a2={'where':_0x4fcacc[_0x7673('0x39')]};return db[_0x7673('0x3c')][_0x7673('0x1a')](_0x2645a2)['then'](function(_0x1edb82){_0x36c841['count']=_0x1edb82;if(_0x224122[_0x7673('0x2f')]['includeAll']){_0x4fcacc[_0x7673('0x3d')]=[{'all':!![]}];}return db[_0x7673('0x3c')]['findAll'](_0x4fcacc);})['then'](function(_0x1cac93){_0x36c841['rows']=_0x1cac93;return _0x36c841;})[_0x7673('0x20')](respondWithFilteredResult(_0x4f12b9,_0x4fcacc))[_0x7673('0x3e')](handleError(_0x4f12b9,null));};exports[_0x7673('0x3f')]=function(_0x3b6223,_0x1895df){var _0x545357={'raw':!![],'where':{'id':_0x3b6223[_0x7673('0x40')]['id']}},_0x4ea8b3={};_0x4ea8b3[_0x7673('0x2e')]=_['keys'](db[_0x7673('0x3c')][_0x7673('0x2a')]);_0x4ea8b3[_0x7673('0x2f')]=_['keys'](_0x3b6223[_0x7673('0x2f')]);_0x4ea8b3[_0x7673('0x31')]=_[_0x7673('0x32')](_0x4ea8b3[_0x7673('0x2e')],_0x4ea8b3[_0x7673('0x2f')]);_0x545357[_0x7673('0x34')]=_[_0x7673('0x32')](_0x4ea8b3[_0x7673('0x2e')],qs[_0x7673('0x33')](_0x3b6223['query'][_0x7673('0x33')]));_0x545357[_0x7673('0x34')]=_0x545357[_0x7673('0x34')][_0x7673('0x41')]?_0x545357[_0x7673('0x34')]:_0x4ea8b3[_0x7673('0x2e')];if(_0x3b6223[_0x7673('0x2f')]['includeAll']){_0x545357[_0x7673('0x3d')]=[{'all':!![]}];}_0x545357=_[_0x7673('0x3a')]({},_0x545357,_0x3b6223[_0x7673('0x3b')]);return db[_0x7673('0x3c')][_0x7673('0x42')](_0x545357)['then'](handleEntityNotFound(_0x1895df,null))[_0x7673('0x20')](respondWithResult(_0x1895df,null))[_0x7673('0x3e')](handleError(_0x1895df,null));};exports[_0x7673('0x43')]=function(_0x2397fb,_0x3f76a3){return db['Tag']['create'](_0x2397fb[_0x7673('0x44')],{})[_0x7673('0x20')](function(_0x510960){var _0x2314e7=_0x2397fb[_0x7673('0x45')][_0x7673('0x22')]({'plain':!![]});if(!_0x2314e7)throw new Error(_0x7673('0x46'));if(_0x2314e7[_0x7673('0x47')]==='user'){var _0x23789d=_0x510960[_0x7673('0x22')]({'plain':!![]});var _0x2a275b=_0x7673('0x23');return db['UserProfileSection'][_0x7673('0x42')]({'where':{'name':_0x2a275b,'userProfileId':_0x2314e7[_0x7673('0x48')]},'raw':!![]})[_0x7673('0x20')](function(_0xa93124){if(_0xa93124&&_0xa93124[_0x7673('0x49')]===0x0){return db[_0x7673('0x24')][_0x7673('0x43')]({'name':_0x23789d[_0x7673('0x26')],'resourceId':_0x23789d['id'],'type':_0xa93124[_0x7673('0x26')],'sectionId':_0xa93124['id']},{})[_0x7673('0x20')](function(){return _0x510960;});}else{return _0x510960;}})[_0x7673('0x3e')](function(_0x572119){logger[_0x7673('0x4a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x572119);throw _0x572119;});}return _0x510960;})[_0x7673('0x20')](respondWithResult(_0x3f76a3,0xc9))[_0x7673('0x3e')](handleError(_0x3f76a3,null));};exports[_0x7673('0x1f')]=function(_0x523698,_0x185ec5){if(_0x523698[_0x7673('0x44')]['id']){delete _0x523698[_0x7673('0x44')]['id'];}return db[_0x7673('0x3c')][_0x7673('0x42')]({'where':{'id':_0x523698[_0x7673('0x40')]['id']}})[_0x7673('0x20')](handleEntityNotFound(_0x185ec5,null))[_0x7673('0x20')](saveUpdates(_0x523698[_0x7673('0x44')],null))[_0x7673('0x20')](respondWithResult(_0x185ec5,null))[_0x7673('0x3e')](handleError(_0x185ec5,null));};exports[_0x7673('0x21')]=function(_0x9be9a4,_0xb3c9e9){return db['Tag'][_0x7673('0x42')]({'where':{'id':_0x9be9a4['params']['id']}})[_0x7673('0x20')](handleEntityNotFound(_0xb3c9e9,null))[_0x7673('0x20')](removeEntity(_0xb3c9e9,null))[_0x7673('0x3e')](handleError(_0xb3c9e9,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 2302391..32b05b8 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 _0x831c=['tools_tags','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./tag.attributes','exports','Tag'];(function(_0x480fad,_0xc0c4d5){var _0x3275c6=function(_0x46cad7){while(--_0x46cad7){_0x480fad['push'](_0x480fad['shift']());}};_0x3275c6(++_0xc0c4d5);}(_0x831c,0x112));var _0xc831=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x831c[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require(_0xc831('0x0'));var util=require(_0xc831('0x1'));var logger=require(_0xc831('0x2'))(_0xc831('0x3'));var moment=require(_0xc831('0x4'));var BPromise=require(_0xc831('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc831('0x6'));var rimraf=require(_0xc831('0x7'));var config=require(_0xc831('0x8'));var attributes=require(_0xc831('0x9'));module[_0xc831('0xa')]=function(_0x23abbd,_0x1dfdf6){return _0x23abbd['define'](_0xc831('0xb'),attributes,{'tableName':_0xc831('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x68fc=['Tag','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./tag.attributes','exports','define'];(function(_0x94fadc,_0x280e92){var _0x45a7c8=function(_0x583696){while(--_0x583696){_0x94fadc['push'](_0x94fadc['shift']());}};_0x45a7c8(++_0x280e92);}(_0x68fc,0x9d));var _0xc68f=function(_0x53d8ef,_0x15e923){_0x53d8ef=_0x53d8ef-0x0;var _0x1625c3=_0x68fc[_0x53d8ef];return _0x1625c3;};'use strict';var _=require(_0xc68f('0x0'));var util=require(_0xc68f('0x1'));var logger=require('../../config/logger')(_0xc68f('0x2'));var moment=require(_0xc68f('0x3'));var BPromise=require(_0xc68f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc68f('0x5'));var rimraf=require(_0xc68f('0x6'));var config=require(_0xc68f('0x7'));var attributes=require(_0xc68f('0x8'));module[_0xc68f('0x9')]=function(_0x300557,_0x41ceff){return _0x300557[_0xc68f('0xa')](_0xc68f('0xb'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 6e06f64..95c72b3 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 _0x008c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Tag,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x008c,0x188));var _0xc008=function(_0x48b4a1,_0x3c2bf4){_0x48b4a1=_0x48b4a1-0x0;var _0x2df379=_0x008c[_0x48b4a1];return _0x2df379;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('Tag,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('Tag,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('Tag,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('Tag,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});} \ No newline at end of file +var _0xde64=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x1781ee,_0x2ba611){var _0x367e53=function(_0x478385){while(--_0x478385){_0x1781ee['push'](_0x1781ee['shift']());}};_0x367e53(++_0x2ba611);}(_0xde64,0x17c));var _0x4de6=function(_0x2b58c6,_0x28e7fb){_0x2b58c6=_0x2b58c6-0x0;var _0x2c15df=_0xde64[_0x2b58c6];return _0x2c15df;};'use strict';var _=require(_0x4de6('0x0'));var util=require(_0x4de6('0x1'));var moment=require(_0x4de6('0x2'));var BPromise=require(_0x4de6('0x3'));var rs=require(_0x4de6('0x4'));var fs=require('fs');var Redis=require(_0x4de6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4de6('0x6'));var logger=require(_0x4de6('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4de6('0x8'));var client=jayson[_0x4de6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x568496,_0x24edef,_0x35ae72){return new BPromise(function(_0x475fb9,_0x248e39){return client[_0x4de6('0xa')](_0x568496,_0x35ae72)[_0x4de6('0xb')](function(_0x48a974){logger[_0x4de6('0xc')](_0x4de6('0xd'),_0x24edef,_0x4de6('0xe'));logger['debug'](_0x4de6('0xf'),_0x24edef,_0x4de6('0xe'),JSON[_0x4de6('0x10')](_0x48a974));if(_0x48a974[_0x4de6('0x11')]){if(_0x48a974[_0x4de6('0x11')]['code']===0x1f4){logger[_0x4de6('0x11')](_0x4de6('0xd'),_0x24edef,_0x48a974[_0x4de6('0x11')]['message']);return _0x248e39(_0x48a974[_0x4de6('0x11')][_0x4de6('0x12')]);}logger[_0x4de6('0x11')](_0x4de6('0xd'),_0x24edef,_0x48a974['error'][_0x4de6('0x12')]);return _0x475fb9(_0x48a974[_0x4de6('0x11')][_0x4de6('0x12')]);}else{logger['info'](_0x4de6('0xd'),_0x24edef,'request\x20sent');_0x475fb9(_0x48a974['result'][_0x4de6('0x12')]);}})[_0x4de6('0x13')](function(_0x6dbcf3){logger[_0x4de6('0x11')](_0x4de6('0xd'),_0x24edef,_0x6dbcf3);_0x248e39(_0x6dbcf3);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index eb7baef..e34a8e1 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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 d81cb96..73cee0d 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 _0x757a=['exports','STRING'];(function(_0x5431f0,_0x580383){var _0x1166b8=function(_0x32c486){while(--_0x32c486){_0x5431f0['push'](_0x5431f0['shift']());}};_0x1166b8(++_0x580383);}(_0x757a,0xde));var _0xa757=function(_0x2d4441,_0x253e4c){_0x2d4441=_0x2d4441-0x0;var _0x4d4fcd=_0x757a[_0x2d4441];return _0x4d4fcd;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x38cebd,_0x19ae37){var _0x58f9b9=function(_0x262634){while(--_0x262634){_0x38cebd['push'](_0x38cebd['shift']());}};_0x58f9b9(++_0x19ae37);}(_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 52bd89e..9799dbd 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 _0xb495=['mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','socket.io-emitter','redis','register','status','end','json','offset','count','limit','set','Content-Range','apply','reject','save','then','sendStatus','send','index','map','Team','rawAttributes','fieldName','type','key','model','name','query','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','intersection','merge','create','body','user','role','get','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','destroy','sequelize','transaction','Sequelize','QueryTypes','SELECT','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','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserVoicePrefix','VoicePrefixId','findOne','isValidChannel','channel','ValidationError','capitalize','toLowerCase','Queues','addQueues','Unknown\x20channel','ids','removeQueues','remove','isArray','Voice','Chat','Sms','Fax','Openchannel','Whatsapp','through','QueueId','defaults','TeamVoiceQueue','Queue','findOrCreate','emit','online','UserVoiceQueueRt','upsert','isNil','interface','SIP/%s','voicePause','penalty','all','addAgents','spread','removeAgents','TeamVoicePrefix','User','getAgents','nolimit','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb495,0x1b9));var _0x5b49=function(_0x1a44b0,_0x38d998){_0x1a44b0=_0x1a44b0-0x0;var _0x50bfab=_0xb495[_0x1a44b0];return _0x50bfab;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5b49('0x0'));var zipdir=require(_0x5b49('0x1'));var jsonpatch=require(_0x5b49('0x2'));var rp=require(_0x5b49('0x3'));var moment=require(_0x5b49('0x4'));var BPromise=require(_0x5b49('0x5'));var Mustache=require(_0x5b49('0x6'));var util=require('util');var path=require(_0x5b49('0x7'));var sox=require(_0x5b49('0x8'));var csv=require(_0x5b49('0x9'));var ejs=require(_0x5b49('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5b49('0xb'));var squel=require(_0x5b49('0xc'));var crypto=require(_0x5b49('0xd'));var jsforce=require(_0x5b49('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5b49('0x9'));var querystring=require(_0x5b49('0xf'));var Papa=require(_0x5b49('0x10'));var Redis=require(_0x5b49('0x11'));var authService=require(_0x5b49('0x12'));var qs=require(_0x5b49('0x13'));var as=require(_0x5b49('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x5b49('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5b49('0x16'))(new Redis(config[_0x5b49('0x17')]));require('./team.socket')[_0x5b49('0x18')](socket);function respondWithStatusCode(_0x4df0b4,_0x5f55b6){_0x5f55b6=_0x5f55b6||0xcc;return function(_0x498135){if(_0x498135){return _0x4df0b4['sendStatus'](_0x5f55b6);}return _0x4df0b4[_0x5b49('0x19')](_0x5f55b6)[_0x5b49('0x1a')]();};}function respondWithResult(_0x194fe1,_0x3505f4){_0x3505f4=_0x3505f4||0xc8;return function(_0x1a57c0){if(_0x1a57c0){return _0x194fe1[_0x5b49('0x19')](_0x3505f4)[_0x5b49('0x1b')](_0x1a57c0);}};}function respondWithFilteredResult(_0x2a29f1,_0x1af438){return function(_0x490d51){if(_0x490d51){var _0x384641=typeof _0x1af438[_0x5b49('0x1c')]==='undefined'&&typeof _0x1af438['limit']==='undefined';var _0x474b79=_0x490d51[_0x5b49('0x1d')];var _0x48e902=_0x384641?0x0:_0x1af438[_0x5b49('0x1c')];var _0xa50cd0=_0x384641?_0x490d51[_0x5b49('0x1d')]:_0x1af438[_0x5b49('0x1c')]+_0x1af438[_0x5b49('0x1e')];var _0x5e74a2;if(_0xa50cd0>=_0x474b79){_0xa50cd0=_0x474b79;_0x5e74a2=0xc8;}else{_0x5e74a2=0xce;}_0x2a29f1['status'](_0x5e74a2);return _0x2a29f1[_0x5b49('0x1f')](_0x5b49('0x20'),_0x48e902+'-'+_0xa50cd0+'/'+_0x474b79)[_0x5b49('0x1b')](_0x490d51);}return null;};}function patchUpdates(_0x1b7c2a){return function(_0x116c48){try{jsonpatch[_0x5b49('0x21')](_0x116c48,_0x1b7c2a,!![]);}catch(_0x46d8b4){return BPromise[_0x5b49('0x22')](_0x46d8b4);}return _0x116c48[_0x5b49('0x23')]();};}function saveUpdates(_0x39f0b9,_0x15ccc5){return function(_0x506a57){if(_0x506a57){return _0x506a57['update'](_0x39f0b9)[_0x5b49('0x24')](function(_0x345298){return _0x345298;});}return null;};}function handleEntityNotFound(_0x48e2a6,_0x94eea5){return function(_0x16a824){if(!_0x16a824){_0x48e2a6[_0x5b49('0x25')](0x194);}return _0x16a824;};}function handleError(_0x660b2e,_0x596796){_0x596796=_0x596796||0x1f4;return function(_0x12fdaa){logger['error'](_0x12fdaa['stack']);if(_0x12fdaa['name']){delete _0x12fdaa['name'];}_0x660b2e[_0x5b49('0x19')](_0x596796)[_0x5b49('0x26')](_0x12fdaa);};}exports[_0x5b49('0x27')]=function(_0x3ffbbd,_0x2e3dfc){var _0x151278={},_0x382755={},_0xa5bf22={'count':0x0,'rows':[]};var _0x5da415=_[_0x5b49('0x28')](db[_0x5b49('0x29')][_0x5b49('0x2a')],function(_0x10e2a4){return{'name':_0x10e2a4[_0x5b49('0x2b')],'type':_0x10e2a4[_0x5b49('0x2c')][_0x5b49('0x2d')]};});_0x382755[_0x5b49('0x2e')]=_[_0x5b49('0x28')](_0x5da415,_0x5b49('0x2f'));_0x382755[_0x5b49('0x30')]=_['keys'](_0x3ffbbd[_0x5b49('0x30')]);_0x382755['filters']=_['intersection'](_0x382755['model'],_0x382755[_0x5b49('0x30')]);_0x151278[_0x5b49('0x31')]=_['intersection'](_0x382755[_0x5b49('0x2e')],qs[_0x5b49('0x32')](_0x3ffbbd[_0x5b49('0x30')][_0x5b49('0x32')]));_0x151278[_0x5b49('0x31')]=_0x151278[_0x5b49('0x31')][_0x5b49('0x33')]?_0x151278[_0x5b49('0x31')]:_0x382755[_0x5b49('0x2e')];if(!_0x3ffbbd[_0x5b49('0x30')][_0x5b49('0x34')]('nolimit')){_0x151278[_0x5b49('0x1e')]=qs['limit'](_0x3ffbbd[_0x5b49('0x30')]['limit']);_0x151278['offset']=qs[_0x5b49('0x1c')](_0x3ffbbd[_0x5b49('0x30')][_0x5b49('0x1c')]);}_0x151278[_0x5b49('0x35')]=qs[_0x5b49('0x36')](_0x3ffbbd[_0x5b49('0x30')][_0x5b49('0x36')]);_0x151278[_0x5b49('0x37')]=qs[_0x5b49('0x38')](_[_0x5b49('0x39')](_0x3ffbbd[_0x5b49('0x30')],_0x382755[_0x5b49('0x38')]),_0x5da415);if(_0x3ffbbd[_0x5b49('0x30')][_0x5b49('0x3a')]){_0x151278[_0x5b49('0x37')]=_['merge'](_0x151278[_0x5b49('0x37')],{'$or':_['map'](_0x5da415,function(_0x45053d){if(_0x45053d[_0x5b49('0x2c')]!==_0x5b49('0x3b')){var _0x418866={};_0x418866[_0x45053d[_0x5b49('0x2f')]]={'$like':'%'+_0x3ffbbd[_0x5b49('0x30')][_0x5b49('0x3a')]+'%'};return _0x418866;}})});}_0x151278=_['merge']({},_0x151278,_0x3ffbbd[_0x5b49('0x3c')]);var _0x2103c5={'where':_0x151278[_0x5b49('0x37')]};return db[_0x5b49('0x29')][_0x5b49('0x1d')](_0x2103c5)[_0x5b49('0x24')](function(_0x3a09e3){_0xa5bf22[_0x5b49('0x1d')]=_0x3a09e3;if(_0x3ffbbd[_0x5b49('0x30')][_0x5b49('0x3d')]){_0x151278[_0x5b49('0x3e')]=[{'all':!![]}];}return db['Team'][_0x5b49('0x3f')](_0x151278);})[_0x5b49('0x24')](function(_0x2f0cfc){_0xa5bf22[_0x5b49('0x40')]=_0x2f0cfc;return _0xa5bf22;})[_0x5b49('0x24')](respondWithFilteredResult(_0x2e3dfc,_0x151278))[_0x5b49('0x41')](handleError(_0x2e3dfc,null));};exports[_0x5b49('0x42')]=function(_0x55608f,_0x22eae3){var _0x4f49c8={'raw':![],'where':{'id':_0x55608f[_0x5b49('0x43')]['id']}},_0x2383da={};_0x2383da[_0x5b49('0x2e')]=_[_0x5b49('0x44')](db[_0x5b49('0x29')][_0x5b49('0x2a')]);_0x2383da[_0x5b49('0x30')]=_[_0x5b49('0x44')](_0x55608f['query']);_0x2383da['filters']=_['intersection'](_0x2383da[_0x5b49('0x2e')],_0x2383da[_0x5b49('0x30')]);_0x4f49c8['attributes']=_[_0x5b49('0x45')](_0x2383da[_0x5b49('0x2e')],qs[_0x5b49('0x32')](_0x55608f[_0x5b49('0x30')]['fields']));_0x4f49c8[_0x5b49('0x31')]=_0x4f49c8[_0x5b49('0x31')][_0x5b49('0x33')]?_0x4f49c8[_0x5b49('0x31')]:_0x2383da[_0x5b49('0x2e')];if(_0x55608f[_0x5b49('0x30')][_0x5b49('0x3d')]){_0x4f49c8[_0x5b49('0x3e')]=[{'all':!![]}];}_0x4f49c8=_[_0x5b49('0x46')]({},_0x4f49c8,_0x55608f[_0x5b49('0x3c')]);return db['Team']['find'](_0x4f49c8)['then'](handleEntityNotFound(_0x22eae3,null))[_0x5b49('0x24')](respondWithResult(_0x22eae3,null))[_0x5b49('0x41')](handleError(_0x22eae3,null));};exports[_0x5b49('0x47')]=function(_0x6465cd,_0x4d503a){return db[_0x5b49('0x29')]['create'](_0x6465cd[_0x5b49('0x48')],{})[_0x5b49('0x24')](function(_0x4b25b7){var _0x4a9115=_0x6465cd[_0x5b49('0x49')]['get']({'plain':!![]});if(!_0x4a9115)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4a9115[_0x5b49('0x4a')]===_0x5b49('0x49')){var _0x4213c1=_0x4b25b7[_0x5b49('0x4b')]({'plain':!![]});var _0x4acf74=_0x5b49('0x4c');return db[_0x5b49('0x4d')]['find']({'where':{'name':_0x4acf74,'userProfileId':_0x4a9115[_0x5b49('0x4e')]},'raw':!![]})['then'](function(_0x8221db){if(_0x8221db&&_0x8221db[_0x5b49('0x4f')]===0x0){return db[_0x5b49('0x50')]['create']({'name':_0x4213c1[_0x5b49('0x2f')],'resourceId':_0x4213c1['id'],'type':_0x8221db[_0x5b49('0x2f')],'sectionId':_0x8221db['id']},{})[_0x5b49('0x24')](function(){return _0x4b25b7;});}else{return _0x4b25b7;}})[_0x5b49('0x41')](function(_0x22775e){logger[_0x5b49('0x51')](_0x5b49('0x52'),_0x22775e);throw _0x22775e;});}return _0x4b25b7;})[_0x5b49('0x24')](respondWithResult(_0x4d503a,0xc9))['catch'](handleError(_0x4d503a,null));};exports[_0x5b49('0x53')]=function(_0x11d55f,_0x24c200){if(_0x11d55f[_0x5b49('0x48')]['id']){delete _0x11d55f[_0x5b49('0x48')]['id'];}return db['Team'][_0x5b49('0x54')]({'where':{'id':_0x11d55f[_0x5b49('0x43')]['id']}})[_0x5b49('0x24')](handleEntityNotFound(_0x24c200,null))['then'](saveUpdates(_0x11d55f[_0x5b49('0x48')],null))[_0x5b49('0x24')](respondWithResult(_0x24c200,null))[_0x5b49('0x41')](handleError(_0x24c200,null));};exports[_0x5b49('0x55')]=function(_0x21f747,_0x5597cc){var _0x3f0320=_0x21f747[_0x5b49('0x43')]['id'];var _0x4ded46=[];return db[_0x5b49('0x56')][_0x5b49('0x57')](function(_0x114a44){var _0x2005be='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x3f0320;return db[_0x5b49('0x56')][_0x5b49('0x30')](_0x2005be,{'type':db[_0x5b49('0x58')][_0x5b49('0x59')][_0x5b49('0x5a')],'raw':!![],'transaction':_0x114a44})[_0x5b49('0x24')](function(_0x2eda25){_0x4ded46=_[_0x5b49('0x28')](_0x2eda25,function(_0x49c633){return Number(_0x49c633['UserId']);});})[_0x5b49('0x24')](function(){var _0x5063fb=_0x5b49('0x5b')+_0x3f0320;return db['sequelize'][_0x5b49('0x30')](_0x5063fb,{'type':db[_0x5b49('0x58')][_0x5b49('0x59')][_0x5b49('0x5a')],'raw':!![],'transaction':_0x114a44});})[_0x5b49('0x24')](function(_0x345855){var _0x20f084=_[_0x5b49('0x28')](_0x345855,function(_0x170ec4){return Number(_0x170ec4['VoiceQueueId']);});return db[_0x5b49('0x5c')][_0x5b49('0x55')]({'where':{'UserId':{'$in':_0x4ded46},'VoiceQueueId':{'$in':_0x20f084}},'transaction':_0x114a44});})['then'](function(){var _0x4ebd5e=_0x5b49('0x5d')+_0x3f0320;return db['sequelize'][_0x5b49('0x30')](_0x4ebd5e,{'type':db[_0x5b49('0x58')][_0x5b49('0x59')][_0x5b49('0x5a')],'raw':!![],'transaction':_0x114a44});})[_0x5b49('0x24')](function(_0x468ecc){var _0x1dca69=_[_0x5b49('0x28')](_0x468ecc,function(_0x30eecc){return Number(_0x30eecc['MailQueueId']);});return db['UserMailQueue'][_0x5b49('0x55')]({'where':{'UserId':{'$in':_0x4ded46},'MailQueueId':{'$in':_0x1dca69}},'transaction':_0x114a44});})['then'](function(){var _0x321f1a=_0x5b49('0x5e')+_0x3f0320;return db[_0x5b49('0x56')][_0x5b49('0x30')](_0x321f1a,{'type':db['Sequelize'][_0x5b49('0x59')]['SELECT'],'raw':!![],'transaction':_0x114a44});})[_0x5b49('0x24')](function(_0x26e79c){var _0xb1e967=_[_0x5b49('0x28')](_0x26e79c,function(_0x217866){return Number(_0x217866[_0x5b49('0x5f')]);});return db['UserSmsQueue'][_0x5b49('0x55')]({'where':{'UserId':{'$in':_0x4ded46},'SmsQueueId':{'$in':_0xb1e967}},'transaction':_0x114a44});})[_0x5b49('0x24')](function(){var _0x4ad7b3=_0x5b49('0x60')+_0x3f0320;return db[_0x5b49('0x56')][_0x5b49('0x30')](_0x4ad7b3,{'type':db[_0x5b49('0x58')][_0x5b49('0x59')]['SELECT'],'raw':!![],'transaction':_0x114a44});})[_0x5b49('0x24')](function(_0x1382e8){var _0x27649a=_[_0x5b49('0x28')](_0x1382e8,function(_0x2d06f8){return Number(_0x2d06f8[_0x5b49('0x61')]);});return db[_0x5b49('0x62')][_0x5b49('0x55')]({'where':{'UserId':{'$in':_0x4ded46},'ChatQueueId':{'$in':_0x27649a}},'transaction':_0x114a44});})[_0x5b49('0x24')](function(){var _0x4aa7ae=_0x5b49('0x63')+_0x3f0320;return db[_0x5b49('0x56')][_0x5b49('0x30')](_0x4aa7ae,{'type':db[_0x5b49('0x58')][_0x5b49('0x59')][_0x5b49('0x5a')],'raw':!![],'transaction':_0x114a44});})[_0x5b49('0x24')](function(_0x28a9b3){var _0x4b7d3a=_[_0x5b49('0x28')](_0x28a9b3,function(_0x278080){return Number(_0x278080['FaxQueueId']);});return db[_0x5b49('0x64')][_0x5b49('0x55')]({'where':{'UserId':{'$in':_0x4ded46},'FaxQueueId':{'$in':_0x4b7d3a}},'transaction':_0x114a44});})[_0x5b49('0x24')](function(){var _0x7f51a8=_0x5b49('0x65')+_0x3f0320;return db[_0x5b49('0x56')][_0x5b49('0x30')](_0x7f51a8,{'type':db[_0x5b49('0x58')][_0x5b49('0x59')][_0x5b49('0x5a')],'raw':!![],'transaction':_0x114a44});})[_0x5b49('0x24')](function(_0xa5cc6e){var _0x3a05b3=_[_0x5b49('0x28')](_0xa5cc6e,function(_0x465148){return Number(_0x465148[_0x5b49('0x66')]);});return db['UserOpenchannelQueue'][_0x5b49('0x55')]({'where':{'UserId':{'$in':_0x4ded46},'OpenchannelQueueId':{'$in':_0x3a05b3}},'transaction':_0x114a44});})['then'](function(){var _0x1586ec=_0x5b49('0x67')+_0x3f0320;return db['sequelize'][_0x5b49('0x30')](_0x1586ec,{'type':db[_0x5b49('0x58')][_0x5b49('0x59')][_0x5b49('0x5a')],'raw':!![],'transaction':_0x114a44});})['then'](function(_0x49365e){var _0xed97c0=_[_0x5b49('0x28')](_0x49365e,function(_0x4b9979){return Number(_0x4b9979[_0x5b49('0x68')]);});return db['UserWhatsappQueue'][_0x5b49('0x55')]({'where':{'UserId':{'$in':_0x4ded46},'WhatsappQueueId':{'$in':_0xed97c0}},'transaction':_0x114a44});})[_0x5b49('0x24')](function(){return db['TeamVoicePrefix'][_0x5b49('0x54')]({'where':{'TeamId':_0x3f0320}});})[_0x5b49('0x24')](function(_0x12d97f){if(_0x12d97f===null){return;}return db[_0x5b49('0x69')]['destroy']({'where':{'UserId':{'$in':_0x4ded46},'VoicePrefixId':_0x12d97f[_0x5b49('0x6a')]},'transaction':_0x114a44});})['then'](function(){return db[_0x5b49('0x29')]['destroy']({'where':{'id':_0x3f0320},'cascade':!![],'transaction':_0x114a44});})[_0x5b49('0x24')](function(_0x3ae4a6){if(_0x3ae4a6===0x0){_0x5597cc[_0x5b49('0x25')](0x194);}else{return db['UserProfileResource'][_0x5b49('0x55')]({'where':{'type':_0x5b49('0x4c'),'resourceId':_0x3f0320},'cascade':!![],'transaction':_0x114a44})['then'](function(){_0x5597cc[_0x5b49('0x19')](0xcc)[_0x5b49('0x1a')]();});}})[_0x5b49('0x41')](function(_0xbe72f1){_0x5597cc['status'](0x1f4)['send'](_0xbe72f1);});});};exports['getQueues']=function(_0x5196d1,_0x46cb33,_0x48fb5c){return db[_0x5b49('0x29')][_0x5b49('0x6b')]({'where':{'id':_0x5196d1[_0x5b49('0x43')]['id']}})['then'](handleEntityNotFound(_0x46cb33,null))[_0x5b49('0x24')](function(_0x29f669){if(!_0x5196d1['query']['channel']||!utils[_0x5b49('0x6c')](_0x5196d1[_0x5b49('0x30')][_0x5b49('0x6d')])){throw new db['Sequelize'][(_0x5b49('0x6e'))]('Unknown\x20channel');}var _0x1cc882={};var _0x519602={};_0x519602[_0x5b49('0x2e')]=_['keys'](db[_[_0x5b49('0x6f')](_0x5196d1['query']['channel']['toLowerCase']())+'Queue'][_0x5b49('0x2a')]);_0x519602[_0x5b49('0x30')]=_[_0x5b49('0x44')](_0x5196d1['query']);_0x519602[_0x5b49('0x38')]=_[_0x5b49('0x45')](_0x519602['model'],_0x519602[_0x5b49('0x30')]);_0x1cc882[_0x5b49('0x31')]=_[_0x5b49('0x45')](_0x519602['model'],qs[_0x5b49('0x32')](_0x5196d1[_0x5b49('0x30')][_0x5b49('0x32')]));_0x1cc882[_0x5b49('0x31')]=_0x1cc882[_0x5b49('0x31')][_0x5b49('0x33')]?_0x1cc882[_0x5b49('0x31')]:_0x519602[_0x5b49('0x2e')];_0x1cc882[_0x5b49('0x1e')]=qs[_0x5b49('0x1e')](_0x5196d1[_0x5b49('0x30')][_0x5b49('0x1e')]);_0x1cc882[_0x5b49('0x1c')]=qs['offset'](_0x5196d1['query'][_0x5b49('0x1c')]);_0x1cc882[_0x5b49('0x35')]=qs[_0x5b49('0x36')](_0x5196d1[_0x5b49('0x30')][_0x5b49('0x36')]);_0x1cc882[_0x5b49('0x37')]=qs[_0x5b49('0x38')](_['pick'](_0x5196d1[_0x5b49('0x30')],_0x519602[_0x5b49('0x38')]));_0x1cc882=_[_0x5b49('0x46')]({},_0x1cc882,_0x5196d1[_0x5b49('0x3c')]);return _0x29f669[_0x5b49('0x4b')+_[_0x5b49('0x6f')](_0x5196d1[_0x5b49('0x30')][_0x5b49('0x6d')][_0x5b49('0x70')]())+_0x5b49('0x71')](_0x1cc882);})[_0x5b49('0x24')](respondWithResult(_0x46cb33,null))['catch'](handleError(_0x46cb33,null));};exports[_0x5b49('0x72')]=function(_0x1ad0d9,_0x4e446e,_0x54742d){return db['Team'][_0x5b49('0x6b')]({'where':{'id':_0x1ad0d9[_0x5b49('0x43')]['id']}})[_0x5b49('0x24')](function(_0x2d4266){if(_0x2d4266){if(!_0x1ad0d9[_0x5b49('0x48')][_0x5b49('0x6d')]||!utils[_0x5b49('0x6c')](_0x1ad0d9[_0x5b49('0x48')][_0x5b49('0x6d')])){throw new db[(_0x5b49('0x58'))]['ValidationError'](_0x5b49('0x73'));}return _0x2d4266['add'+_['capitalize'](_0x1ad0d9[_0x5b49('0x48')]['channel'][_0x5b49('0x70')]())+_0x5b49('0x71')](_0x1ad0d9[_0x5b49('0x48')][_0x5b49('0x74')]);}return null;})[_0x5b49('0x24')](handleEntityNotFound(_0x4e446e,null))[_0x5b49('0x24')](respondWithStatusCode(_0x4e446e,null))[_0x5b49('0x41')](handleError(_0x4e446e,null));};exports[_0x5b49('0x75')]=function(_0x13fd1c,_0x3cde1c,_0x3c916a){return db[_0x5b49('0x29')][_0x5b49('0x6b')]({'where':{'id':_0x13fd1c[_0x5b49('0x43')]['id']}})['then'](function(_0x175214){if(_0x175214){if(!_0x13fd1c['query'][_0x5b49('0x6d')]||!utils[_0x5b49('0x6c')](_0x13fd1c[_0x5b49('0x30')][_0x5b49('0x6d')])){throw new db[(_0x5b49('0x58'))][(_0x5b49('0x6e'))](_0x5b49('0x73'));}return _0x175214[_0x5b49('0x76')+_['capitalize'](_0x13fd1c[_0x5b49('0x30')]['channel'][_0x5b49('0x70')]())+_0x5b49('0x71')](_0x13fd1c['query']['ids']);}return null;})[_0x5b49('0x24')](handleEntityNotFound(_0x3cde1c,null))[_0x5b49('0x24')](respondWithStatusCode(_0x3cde1c,null))[_0x5b49('0x41')](handleError(_0x3cde1c,null));};exports['addAgents']=function(_0x10e7f9,_0x4f98e3){var _0x4e1764=_[_0x5b49('0x77')](_0x10e7f9[_0x5b49('0x48')][_0x5b49('0x74')])?_0x10e7f9[_0x5b49('0x48')][_0x5b49('0x74')]:[_0x10e7f9['body'][_0x5b49('0x74')]];var _0x5da5d0=_0x10e7f9[_0x5b49('0x43')]['id'];return db[_0x5b49('0x29')]['find']({'where':{'id':_0x5da5d0}})[_0x5b49('0x24')](handleEntityNotFound(_0x4f98e3,null))[_0x5b49('0x24')](function(_0x5a69bc){if(_0x5a69bc){var _0x16b573=[_0x5b49('0x78'),_0x5b49('0x79'),'Mail',_0x5b49('0x7a'),_0x5b49('0x7b'),_0x5b49('0x7c'),_0x5b49('0x7d')];return db[_0x5b49('0x56')]['transaction'](function(_0x5d2d24){var _0x10b407=_['map'](_0x16b573,function(_0x5b5679){var _0x450686={'attributes':['id',_0x5b49('0x2f')]};if(_0x5b5679===_0x5b49('0x78')){_0x450686[_0x5b49('0x7e')]={'attributes':['penalty']};}return _0x5a69bc[_0x5b49('0x4b')+_0x5b5679+_0x5b49('0x71')](_0x450686)[_0x5b49('0x24')](function(_0x372b9d){var _0x3e2a37=_[_0x5b49('0x28')](_0x372b9d,function(_0x45415e){var _0xb93587=_[_0x5b49('0x28')](_0x4e1764,function(_0x2cd1b6){var _0x48dd87={'where':{'UserId':_0x2cd1b6,[_0x5b5679+_0x5b49('0x7f')]:_0x45415e['id']},'transaction':_0x5d2d24};if(_0x5b5679===_0x5b49('0x78')){_0x48dd87[_0x5b49('0x80')]={'penalty':_0x45415e[_0x5b49('0x81')]['penalty']};}return db['User'+_0x5b5679+_0x5b49('0x82')][_0x5b49('0x83')](_0x48dd87)[_0x5b49('0x24')](function(){socket[_0x5b49('0x84')](_0x5b49('0x49')+_0x5b5679+'Queue:save',{'UserId':_0x2cd1b6,[_0x5b5679+'QueueId']:_0x45415e['id']});if(_0x5b5679!=='Voice'){return;}return db['User']['findAll']({'where':{'id':_0x4e1764,'online':0x1},'attributes':['id',_0x5b49('0x2f'),_0x5b49('0x85'),'voicePause','interface'],'raw':!![]})[_0x5b49('0x24')](function(_0x23f098){var _0x5c347e=_['map'](_0x23f098,function(_0x17d9a4){return db[_0x5b49('0x86')][_0x5b49('0x87')]({'membername':_0x17d9a4[_0x5b49('0x2f')],'UserId':_0x17d9a4['id'],'queue_name':_0x45415e[_0x5b49('0x2f')],'VoiceQueueId':_0x45415e['id'],'interface':_[_0x5b49('0x88')](_0x17d9a4[_0x5b49('0x89')])?util['format'](_0x5b49('0x8a'),_0x17d9a4[_0x5b49('0x2f')]):_0x17d9a4[_0x5b49('0x89')],'paused':_0x17d9a4[_0x5b49('0x8b')]||![],'penalty':_0x45415e[_0x5b49('0x81')][_0x5b49('0x8c')]},{'transaction':_0x5d2d24});});return Promise[_0x5b49('0x8d')](_0x5c347e);});});});return Promise[_0x5b49('0x8d')](_0xb93587);});return Promise[_0x5b49('0x8d')](_0x3e2a37);})[_0x5b49('0x24')](function(){return db['TeamVoicePrefix'][_0x5b49('0x6b')]({'where':{'teamId':_0x5da5d0}})[_0x5b49('0x24')](function(_0x5a35a1){if(_0x5a35a1){var _0x5882a0=_['map'](_0x4e1764,function(_0x93d6d5){db[_0x5b49('0x69')][_0x5b49('0x87')]({'UserId':_0x93d6d5,'VoicePrefixId':_0x5a35a1[_0x5b49('0x6a')]});});return Promise[_0x5b49('0x8d')](_0x5882a0);}});});});return Promise['all'](_0x10b407)['then'](function(){return _0x5a69bc[_0x5b49('0x8e')](_0x4e1764,{'transaction':_0x5d2d24})[_0x5b49('0x8f')](function(_0x2d0804){return _0x2d0804;});});});}})[_0x5b49('0x24')](respondWithResult(_0x4f98e3,null))[_0x5b49('0x41')](handleError(_0x4f98e3,null));};exports['removeAgents']=function(_0x383544,_0x14c0f){var _0x5e33e2=_[_0x5b49('0x77')](_0x383544[_0x5b49('0x30')]['ids'])?_0x383544[_0x5b49('0x30')][_0x5b49('0x74')]:[_0x383544[_0x5b49('0x30')][_0x5b49('0x74')]];var _0x4e0cde=_0x383544[_0x5b49('0x43')]['id'];return db[_0x5b49('0x29')][_0x5b49('0x54')]({'where':{'id':_0x4e0cde}})[_0x5b49('0x24')](handleEntityNotFound(_0x14c0f,null))[_0x5b49('0x24')](function(_0x446a89){if(_0x446a89){var _0x7f9263=[_0x5b49('0x78'),_0x5b49('0x79'),'Mail',_0x5b49('0x7a'),'Fax',_0x5b49('0x7c'),'Whatsapp'];return db[_0x5b49('0x56')][_0x5b49('0x57')](function(_0x4d8f34){var _0x54af98=_[_0x5b49('0x28')](_0x7f9263,function(_0x375c52){var _0x2d6193={'attributes':['id',_0x5b49('0x2f')]};return _0x446a89[_0x5b49('0x4b')+_0x375c52+'Queues'](_0x2d6193)[_0x5b49('0x24')](function(_0x4a54c2){var _0x3ffcb3=_[_0x5b49('0x28')](_0x4a54c2,function(_0x25e4d9){return _0x25e4d9[_0x5b49('0x90')](_0x5e33e2,{'transaction':_0x4d8f34})[_0x5b49('0x24')](function(){var _0xbb0f7a=_[_0x5b49('0x28')](_0x5e33e2,function(_0x2a0808){socket[_0x5b49('0x84')](_0x5b49('0x49')+_0x375c52+'Queue:remove',{'UserId':Number(_0x2a0808),[_0x375c52+_0x5b49('0x7f')]:_0x25e4d9['id']});if(_0x375c52!==_0x5b49('0x78')){return;}return db[_0x5b49('0x86')][_0x5b49('0x55')]({'where':{'VoiceQueueId':_0x25e4d9['id'],'UserId':_0x2a0808},'transaction':_0x4d8f34});});return Promise[_0x5b49('0x8d')](_0xbb0f7a);});});return Promise[_0x5b49('0x8d')](_0x3ffcb3);});});return Promise[_0x5b49('0x8d')](_0x54af98)[_0x5b49('0x24')](function(){return _0x446a89['removeAgents'](_0x5e33e2,{'transaction':_0x4d8f34});})['then'](function(){return db[_0x5b49('0x91')][_0x5b49('0x6b')]({'where':{'teamId':_0x4e0cde}})['then'](function(_0x333535){if(_0x333535){var _0x2c70dc=_[_0x5b49('0x28')](_0x5e33e2,function(_0x7dbfa7){db['UserVoicePrefix'][_0x5b49('0x55')]({'where':{'UserId':_0x7dbfa7,'VoicePrefixId':_0x333535[_0x5b49('0x6a')]}});});return Promise['all'](_0x2c70dc);}});});});}})[_0x5b49('0x24')](respondWithStatusCode(_0x14c0f,null))[_0x5b49('0x41')](handleError(_0x14c0f,null));};exports['getAgents']=function(_0x5b3448,_0x2b1466,_0x3ed33a){var _0x8a1876={};var _0x38d229={};var _0x518f2c;var _0x127137;return db['Team'][_0x5b49('0x6b')]({'where':{'id':_0x5b3448[_0x5b49('0x43')]['id']}})[_0x5b49('0x24')](handleEntityNotFound(_0x2b1466,null))['then'](function(_0x7c1cb5){if(_0x7c1cb5){_0x518f2c=_0x7c1cb5;_0x38d229['model']=_['keys'](db[_0x5b49('0x92')][_0x5b49('0x2a')]);_0x38d229[_0x5b49('0x30')]=_[_0x5b49('0x44')](_0x5b3448[_0x5b49('0x30')]);_0x38d229[_0x5b49('0x38')]=_['intersection'](_0x38d229[_0x5b49('0x2e')],_0x38d229['query']);_0x8a1876[_0x5b49('0x31')]=_[_0x5b49('0x45')](_0x38d229[_0x5b49('0x2e')],qs['fields'](_0x5b3448['query'][_0x5b49('0x32')]));_0x8a1876['attributes']=_0x8a1876['attributes'][_0x5b49('0x33')]?_0x8a1876[_0x5b49('0x31')]:_0x38d229[_0x5b49('0x2e')];_0x8a1876[_0x5b49('0x35')]=qs[_0x5b49('0x36')](_0x5b3448['query'][_0x5b49('0x36')]);_0x8a1876[_0x5b49('0x37')]=qs[_0x5b49('0x38')](_[_0x5b49('0x39')](_0x5b3448[_0x5b49('0x30')],_0x38d229[_0x5b49('0x38')]));if(_0x5b3448[_0x5b49('0x30')][_0x5b49('0x3a')]){_0x8a1876[_0x5b49('0x37')]=_[_0x5b49('0x46')](_0x8a1876[_0x5b49('0x37')],{'$or':_[_0x5b49('0x28')](_0x8a1876['attributes'],function(_0x4e053e){var _0x24fb63={};_0x24fb63[_0x4e053e]={'$like':'%'+_0x5b3448['query'][_0x5b49('0x3a')]+'%'};return _0x24fb63;})});}_0x8a1876=_[_0x5b49('0x46')]({},_0x8a1876,_0x5b3448[_0x5b49('0x3c')]);return _0x518f2c[_0x5b49('0x93')](_0x8a1876);}})[_0x5b49('0x24')](function(_0x3f2e49){if(_0x3f2e49){_0x127137=_0x3f2e49[_0x5b49('0x33')];if(!_0x5b3448[_0x5b49('0x30')][_0x5b49('0x34')](_0x5b49('0x94'))){_0x8a1876[_0x5b49('0x1e')]=qs[_0x5b49('0x1e')](_0x5b3448['query'][_0x5b49('0x1e')]);_0x8a1876[_0x5b49('0x1c')]=qs[_0x5b49('0x1c')](_0x5b3448[_0x5b49('0x30')][_0x5b49('0x1c')]);}return _0x518f2c[_0x5b49('0x93')](_0x8a1876);}})['then'](function(_0x334007){if(_0x334007){return _0x334007?{'count':_0x127137,'rows':_0x334007}:null;}})['then'](respondWithResult(_0x2b1466,null))[_0x5b49('0x41')](handleError(_0x2b1466,null));}; \ No newline at end of file +var _0x3978=['isArray','Chat','Sms','Fax','Openchannel','Whatsapp','Voice','through','penalty','QueueId','TeamVoiceQueue','findOrCreate','User','online','interface','UserVoiceQueueRt','format','all','upsert','removeAgents','Mail','emit','filter','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','stack','name','send','Team','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','map','options','includeAll','include','findAll','rows','catch','params','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Teams','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','SELECT','VoiceQueueId','UserVoiceQueue','destroy','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','FaxQueueId','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getQueues','findOne','channel','isValidChannel','capitalize','toLowerCase','Queue','order','pick','Queues','addQueues','Unknown\x20channel','add','ids','removeQueues','ValidationError','remove','addAgents'];(function(_0x278209,_0x7fe4ec){var _0xf16350=function(_0xd805be){while(--_0xd805be){_0x278209['push'](_0x278209['shift']());}};_0xf16350(++_0x7fe4ec);}(_0x3978,0x148));var _0x8397=function(_0x560205,_0x2ce4f6){_0x560205=_0x560205-0x0;var _0x1b8ef2=_0x3978[_0x560205];return _0x1b8ef2;};'use strict';var emlformat=require(_0x8397('0x0'));var rimraf=require(_0x8397('0x1'));var zipdir=require(_0x8397('0x2'));var jsonpatch=require(_0x8397('0x3'));var rp=require(_0x8397('0x4'));var moment=require(_0x8397('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8397('0x6'));var util=require(_0x8397('0x7'));var path=require(_0x8397('0x8'));var sox=require('sox');var csv=require(_0x8397('0x9'));var ejs=require(_0x8397('0xa'));var fs=require('fs');var fs_extra=require(_0x8397('0xb'));var _=require(_0x8397('0xc'));var squel=require('squel');var crypto=require(_0x8397('0xd'));var jsforce=require(_0x8397('0xe'));var deskjs=require(_0x8397('0xf'));var toCsv=require(_0x8397('0x9'));var querystring=require(_0x8397('0x10'));var Papa=require(_0x8397('0x11'));var Redis=require(_0x8397('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8397('0x13'));var as=require(_0x8397('0x14'));var hardwareService=require(_0x8397('0x15'));var logger=require(_0x8397('0x16'))(_0x8397('0x17'));var utils=require(_0x8397('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8397('0x19'));var db=require(_0x8397('0x1a'))['db'];config[_0x8397('0x1b')]=_[_0x8397('0x1c')](config[_0x8397('0x1b')],{'host':_0x8397('0x1d'),'port':0x18eb});var socket=require(_0x8397('0x1e'))(new Redis(config[_0x8397('0x1b')]));require('./team.socket')['register'](socket);function respondWithStatusCode(_0x3246a9,_0x5c72d9){_0x5c72d9=_0x5c72d9||0xcc;return function(_0x5614bf){if(_0x5614bf){return _0x3246a9[_0x8397('0x1f')](_0x5c72d9);}return _0x3246a9[_0x8397('0x20')](_0x5c72d9)[_0x8397('0x21')]();};}function respondWithResult(_0x2ed611,_0x1fa6a7){_0x1fa6a7=_0x1fa6a7||0xc8;return function(_0x1ae88b){if(_0x1ae88b){return _0x2ed611[_0x8397('0x20')](_0x1fa6a7)[_0x8397('0x22')](_0x1ae88b);}};}function respondWithFilteredResult(_0x5c1730,_0x2e9459){return function(_0x125781){if(_0x125781){var _0x44d6b0=typeof _0x2e9459[_0x8397('0x23')]===_0x8397('0x24')&&typeof _0x2e9459[_0x8397('0x25')]==='undefined';var _0x12b062=_0x125781['count'];var _0xa5d648=_0x44d6b0?0x0:_0x2e9459[_0x8397('0x23')];var _0x48b03c=_0x44d6b0?_0x125781[_0x8397('0x26')]:_0x2e9459[_0x8397('0x23')]+_0x2e9459[_0x8397('0x25')];var _0x530c02;if(_0x48b03c>=_0x12b062){_0x48b03c=_0x12b062;_0x530c02=0xc8;}else{_0x530c02=0xce;}_0x5c1730['status'](_0x530c02);return _0x5c1730['set'](_0x8397('0x27'),_0xa5d648+'-'+_0x48b03c+'/'+_0x12b062)[_0x8397('0x22')](_0x125781);}return null;};}function patchUpdates(_0x20c3a0){return function(_0x4af78f){try{jsonpatch[_0x8397('0x28')](_0x4af78f,_0x20c3a0,!![]);}catch(_0x5b62a3){return BPromise[_0x8397('0x29')](_0x5b62a3);}return _0x4af78f['save']();};}function saveUpdates(_0x24ff6f,_0x147867){return function(_0x5cf5f7){if(_0x5cf5f7){return _0x5cf5f7[_0x8397('0x2a')](_0x24ff6f)[_0x8397('0x2b')](function(_0x4a4052){return _0x4a4052;});}return null;};}function handleEntityNotFound(_0x1f9070,_0x2b26d8){return function(_0x2d0c45){if(!_0x2d0c45){_0x1f9070[_0x8397('0x1f')](0x194);}return _0x2d0c45;};}function handleError(_0x2525f4,_0x5c3849){_0x5c3849=_0x5c3849||0x1f4;return function(_0x1a1233){logger['error'](_0x1a1233[_0x8397('0x2c')]);if(_0x1a1233[_0x8397('0x2d')]){delete _0x1a1233[_0x8397('0x2d')];}_0x2525f4[_0x8397('0x20')](_0x5c3849)[_0x8397('0x2e')](_0x1a1233);};}exports['index']=function(_0x1545f1,_0x130b1){var _0x53ff34={},_0x5f38be={},_0x38ff7f={'count':0x0,'rows':[]};var _0x1d5e09=_['map'](db[_0x8397('0x2f')][_0x8397('0x30')],function(_0x5b671a){return{'name':_0x5b671a['fieldName'],'type':_0x5b671a[_0x8397('0x31')][_0x8397('0x32')]};});_0x5f38be[_0x8397('0x33')]=_['map'](_0x1d5e09,'name');_0x5f38be[_0x8397('0x34')]=_[_0x8397('0x35')](_0x1545f1[_0x8397('0x34')]);_0x5f38be[_0x8397('0x36')]=_['intersection'](_0x5f38be[_0x8397('0x33')],_0x5f38be['query']);_0x53ff34[_0x8397('0x37')]=_['intersection'](_0x5f38be[_0x8397('0x33')],qs[_0x8397('0x38')](_0x1545f1['query'][_0x8397('0x38')]));_0x53ff34['attributes']=_0x53ff34[_0x8397('0x37')][_0x8397('0x39')]?_0x53ff34[_0x8397('0x37')]:_0x5f38be['model'];if(!_0x1545f1['query'][_0x8397('0x3a')](_0x8397('0x3b'))){_0x53ff34[_0x8397('0x25')]=qs['limit'](_0x1545f1[_0x8397('0x34')][_0x8397('0x25')]);_0x53ff34[_0x8397('0x23')]=qs[_0x8397('0x23')](_0x1545f1[_0x8397('0x34')][_0x8397('0x23')]);}_0x53ff34['order']=qs['sort'](_0x1545f1[_0x8397('0x34')][_0x8397('0x3c')]);_0x53ff34['where']=qs[_0x8397('0x36')](_['pick'](_0x1545f1[_0x8397('0x34')],_0x5f38be[_0x8397('0x36')]),_0x1d5e09);if(_0x1545f1[_0x8397('0x34')]['filter']){_0x53ff34[_0x8397('0x3d')]=_[_0x8397('0x3e')](_0x53ff34[_0x8397('0x3d')],{'$or':_[_0x8397('0x3f')](_0x1d5e09,function(_0x3358b8){if(_0x3358b8[_0x8397('0x31')]!=='VIRTUAL'){var _0x10ff3c={};_0x10ff3c[_0x3358b8[_0x8397('0x2d')]]={'$like':'%'+_0x1545f1['query']['filter']+'%'};return _0x10ff3c;}})});}_0x53ff34=_['merge']({},_0x53ff34,_0x1545f1[_0x8397('0x40')]);var _0x2e51d2={'where':_0x53ff34[_0x8397('0x3d')]};return db[_0x8397('0x2f')]['count'](_0x2e51d2)[_0x8397('0x2b')](function(_0x4eeb2e){_0x38ff7f['count']=_0x4eeb2e;if(_0x1545f1[_0x8397('0x34')][_0x8397('0x41')]){_0x53ff34[_0x8397('0x42')]=[{'all':!![]}];}return db[_0x8397('0x2f')][_0x8397('0x43')](_0x53ff34);})[_0x8397('0x2b')](function(_0x430bd2){_0x38ff7f[_0x8397('0x44')]=_0x430bd2;return _0x38ff7f;})[_0x8397('0x2b')](respondWithFilteredResult(_0x130b1,_0x53ff34))[_0x8397('0x45')](handleError(_0x130b1,null));};exports['show']=function(_0x279289,_0x1da8db){var _0x2464ec={'raw':![],'where':{'id':_0x279289[_0x8397('0x46')]['id']}},_0x39f742={};_0x39f742[_0x8397('0x33')]=_['keys'](db[_0x8397('0x2f')][_0x8397('0x30')]);_0x39f742[_0x8397('0x34')]=_[_0x8397('0x35')](_0x279289[_0x8397('0x34')]);_0x39f742[_0x8397('0x36')]=_[_0x8397('0x47')](_0x39f742[_0x8397('0x33')],_0x39f742[_0x8397('0x34')]);_0x2464ec[_0x8397('0x37')]=_['intersection'](_0x39f742['model'],qs[_0x8397('0x38')](_0x279289['query']['fields']));_0x2464ec[_0x8397('0x37')]=_0x2464ec[_0x8397('0x37')][_0x8397('0x39')]?_0x2464ec[_0x8397('0x37')]:_0x39f742[_0x8397('0x33')];if(_0x279289[_0x8397('0x34')][_0x8397('0x41')]){_0x2464ec[_0x8397('0x42')]=[{'all':!![]}];}_0x2464ec=_[_0x8397('0x3e')]({},_0x2464ec,_0x279289[_0x8397('0x40')]);return db[_0x8397('0x2f')][_0x8397('0x48')](_0x2464ec)[_0x8397('0x2b')](handleEntityNotFound(_0x1da8db,null))[_0x8397('0x2b')](respondWithResult(_0x1da8db,null))['catch'](handleError(_0x1da8db,null));};exports[_0x8397('0x49')]=function(_0x54ca17,_0x2b72c3){return db[_0x8397('0x2f')][_0x8397('0x49')](_0x54ca17[_0x8397('0x4a')],{})[_0x8397('0x2b')](function(_0x1505d6){var _0x101526=_0x54ca17[_0x8397('0x4b')]['get']({'plain':!![]});if(!_0x101526)throw new Error(_0x8397('0x4c'));if(_0x101526[_0x8397('0x4d')]===_0x8397('0x4b')){var _0x1a3c2a=_0x1505d6[_0x8397('0x4e')]({'plain':!![]});var _0x45837f=_0x8397('0x4f');return db['UserProfileSection'][_0x8397('0x48')]({'where':{'name':_0x45837f,'userProfileId':_0x101526[_0x8397('0x50')]},'raw':!![]})[_0x8397('0x2b')](function(_0x49c28f){if(_0x49c28f&&_0x49c28f[_0x8397('0x51')]===0x0){return db[_0x8397('0x52')][_0x8397('0x49')]({'name':_0x1a3c2a[_0x8397('0x2d')],'resourceId':_0x1a3c2a['id'],'type':_0x49c28f[_0x8397('0x2d')],'sectionId':_0x49c28f['id']},{})['then'](function(){return _0x1505d6;});}else{return _0x1505d6;}})['catch'](function(_0x3652fb){logger[_0x8397('0x53')](_0x8397('0x54'),_0x3652fb);throw _0x3652fb;});}return _0x1505d6;})[_0x8397('0x2b')](respondWithResult(_0x2b72c3,0xc9))[_0x8397('0x45')](handleError(_0x2b72c3,null));};exports['update']=function(_0x4a509e,_0x1a3900){if(_0x4a509e['body']['id']){delete _0x4a509e[_0x8397('0x4a')]['id'];}return db['Team']['find']({'where':{'id':_0x4a509e[_0x8397('0x46')]['id']}})[_0x8397('0x2b')](handleEntityNotFound(_0x1a3900,null))[_0x8397('0x2b')](saveUpdates(_0x4a509e['body'],null))['then'](respondWithResult(_0x1a3900,null))[_0x8397('0x45')](handleError(_0x1a3900,null));};exports['destroy']=function(_0x22b86d,_0x4574b8){var _0x1f9c85=_0x22b86d[_0x8397('0x46')]['id'];var _0xa8580a=[];return db[_0x8397('0x55')][_0x8397('0x56')](function(_0x4d3c79){var _0x4edc05=_0x8397('0x57')+_0x1f9c85;return db[_0x8397('0x55')][_0x8397('0x34')](_0x4edc05,{'type':db[_0x8397('0x58')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x4d3c79})[_0x8397('0x2b')](function(_0x31e236){_0xa8580a=_[_0x8397('0x3f')](_0x31e236,function(_0x83aadc){return Number(_0x83aadc[_0x8397('0x59')]);});})[_0x8397('0x2b')](function(){var _0x104278=_0x8397('0x5a')+_0x1f9c85;return db[_0x8397('0x55')][_0x8397('0x34')](_0x104278,{'type':db[_0x8397('0x58')][_0x8397('0x5b')][_0x8397('0x5c')],'raw':!![],'transaction':_0x4d3c79});})[_0x8397('0x2b')](function(_0x1f6c41){var _0xf25517=_[_0x8397('0x3f')](_0x1f6c41,function(_0x7869b3){return Number(_0x7869b3[_0x8397('0x5d')]);});return db[_0x8397('0x5e')][_0x8397('0x5f')]({'where':{'UserId':{'$in':_0xa8580a},'VoiceQueueId':{'$in':_0xf25517}},'transaction':_0x4d3c79});})[_0x8397('0x2b')](function(){var _0x3e71c9=_0x8397('0x60')+_0x1f9c85;return db[_0x8397('0x55')]['query'](_0x3e71c9,{'type':db['Sequelize'][_0x8397('0x5b')]['SELECT'],'raw':!![],'transaction':_0x4d3c79});})[_0x8397('0x2b')](function(_0x460259){var _0x304e52=_[_0x8397('0x3f')](_0x460259,function(_0x3b3604){return Number(_0x3b3604['MailQueueId']);});return db[_0x8397('0x61')][_0x8397('0x5f')]({'where':{'UserId':{'$in':_0xa8580a},'MailQueueId':{'$in':_0x304e52}},'transaction':_0x4d3c79});})[_0x8397('0x2b')](function(){var _0x5ba6f0=_0x8397('0x62')+_0x1f9c85;return db['sequelize']['query'](_0x5ba6f0,{'type':db[_0x8397('0x58')][_0x8397('0x5b')][_0x8397('0x5c')],'raw':!![],'transaction':_0x4d3c79});})[_0x8397('0x2b')](function(_0x2c1a20){var _0x3c7b86=_[_0x8397('0x3f')](_0x2c1a20,function(_0x5468a7){return Number(_0x5468a7[_0x8397('0x63')]);});return db['UserSmsQueue']['destroy']({'where':{'UserId':{'$in':_0xa8580a},'SmsQueueId':{'$in':_0x3c7b86}},'transaction':_0x4d3c79});})[_0x8397('0x2b')](function(){var _0x5d49f6=_0x8397('0x64')+_0x1f9c85;return db[_0x8397('0x55')]['query'](_0x5d49f6,{'type':db[_0x8397('0x58')]['QueryTypes'][_0x8397('0x5c')],'raw':!![],'transaction':_0x4d3c79});})['then'](function(_0x5e1a0a){var _0x80eea5=_[_0x8397('0x3f')](_0x5e1a0a,function(_0x5b4876){return Number(_0x5b4876[_0x8397('0x65')]);});return db[_0x8397('0x66')][_0x8397('0x5f')]({'where':{'UserId':{'$in':_0xa8580a},'ChatQueueId':{'$in':_0x80eea5}},'transaction':_0x4d3c79});})[_0x8397('0x2b')](function(){var _0xf3313b='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1f9c85;return db[_0x8397('0x55')][_0x8397('0x34')](_0xf3313b,{'type':db[_0x8397('0x58')][_0x8397('0x5b')][_0x8397('0x5c')],'raw':!![],'transaction':_0x4d3c79});})['then'](function(_0x52bb8d){var _0x2655bc=_[_0x8397('0x3f')](_0x52bb8d,function(_0x2aa322){return Number(_0x2aa322[_0x8397('0x67')]);});return db['UserFaxQueue'][_0x8397('0x5f')]({'where':{'UserId':{'$in':_0xa8580a},'FaxQueueId':{'$in':_0x2655bc}},'transaction':_0x4d3c79});})[_0x8397('0x2b')](function(){var _0x355709='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1f9c85;return db[_0x8397('0x55')]['query'](_0x355709,{'type':db[_0x8397('0x58')][_0x8397('0x5b')][_0x8397('0x5c')],'raw':!![],'transaction':_0x4d3c79});})[_0x8397('0x2b')](function(_0x566911){var _0x5ae727=_[_0x8397('0x3f')](_0x566911,function(_0x1efa88){return Number(_0x1efa88[_0x8397('0x68')]);});return db['UserOpenchannelQueue'][_0x8397('0x5f')]({'where':{'UserId':{'$in':_0xa8580a},'OpenchannelQueueId':{'$in':_0x5ae727}},'transaction':_0x4d3c79});})[_0x8397('0x2b')](function(){var _0x3982da=_0x8397('0x69')+_0x1f9c85;return db[_0x8397('0x55')][_0x8397('0x34')](_0x3982da,{'type':db[_0x8397('0x58')][_0x8397('0x5b')][_0x8397('0x5c')],'raw':!![],'transaction':_0x4d3c79});})['then'](function(_0x4fb357){var _0x4a88d6=_[_0x8397('0x3f')](_0x4fb357,function(_0x2e6430){return Number(_0x2e6430[_0x8397('0x6a')]);});return db['UserWhatsappQueue'][_0x8397('0x5f')]({'where':{'UserId':{'$in':_0xa8580a},'WhatsappQueueId':{'$in':_0x4a88d6}},'transaction':_0x4d3c79});})[_0x8397('0x2b')](function(){return db[_0x8397('0x6b')][_0x8397('0x48')]({'where':{'TeamId':_0x1f9c85}});})[_0x8397('0x2b')](function(_0xda4bf1){if(_0xda4bf1===null){return;}return db[_0x8397('0x6c')][_0x8397('0x5f')]({'where':{'UserId':{'$in':_0xa8580a},'VoicePrefixId':_0xda4bf1[_0x8397('0x6d')]},'transaction':_0x4d3c79});})['then'](function(){return db[_0x8397('0x2f')]['destroy']({'where':{'id':_0x1f9c85},'cascade':!![],'transaction':_0x4d3c79});})[_0x8397('0x2b')](function(_0xe5d528){if(_0xe5d528===0x0){_0x4574b8[_0x8397('0x1f')](0x194);}else{return db[_0x8397('0x52')][_0x8397('0x5f')]({'where':{'type':_0x8397('0x4f'),'resourceId':_0x1f9c85},'cascade':!![],'transaction':_0x4d3c79})[_0x8397('0x2b')](function(){_0x4574b8['status'](0xcc)[_0x8397('0x21')]();});}})[_0x8397('0x45')](function(_0x2c789c){_0x4574b8[_0x8397('0x20')](0x1f4)[_0x8397('0x2e')](_0x2c789c);});});};exports[_0x8397('0x6e')]=function(_0x3f2362,_0x3a38fe,_0x3c82f9){return db[_0x8397('0x2f')][_0x8397('0x6f')]({'where':{'id':_0x3f2362[_0x8397('0x46')]['id']}})[_0x8397('0x2b')](handleEntityNotFound(_0x3a38fe,null))[_0x8397('0x2b')](function(_0x1a507e){if(!_0x3f2362[_0x8397('0x34')][_0x8397('0x70')]||!utils[_0x8397('0x71')](_0x3f2362[_0x8397('0x34')]['channel'])){throw new db[(_0x8397('0x58'))]['ValidationError']('Unknown\x20channel');}var _0x1d3bd7={};var _0x217013={};_0x217013[_0x8397('0x33')]=_[_0x8397('0x35')](db[_[_0x8397('0x72')](_0x3f2362[_0x8397('0x34')]['channel'][_0x8397('0x73')]())+_0x8397('0x74')]['rawAttributes']);_0x217013[_0x8397('0x34')]=_[_0x8397('0x35')](_0x3f2362[_0x8397('0x34')]);_0x217013[_0x8397('0x36')]=_[_0x8397('0x47')](_0x217013[_0x8397('0x33')],_0x217013[_0x8397('0x34')]);_0x1d3bd7[_0x8397('0x37')]=_[_0x8397('0x47')](_0x217013[_0x8397('0x33')],qs[_0x8397('0x38')](_0x3f2362[_0x8397('0x34')][_0x8397('0x38')]));_0x1d3bd7['attributes']=_0x1d3bd7[_0x8397('0x37')][_0x8397('0x39')]?_0x1d3bd7['attributes']:_0x217013[_0x8397('0x33')];_0x1d3bd7[_0x8397('0x25')]=qs[_0x8397('0x25')](_0x3f2362[_0x8397('0x34')]['limit']);_0x1d3bd7[_0x8397('0x23')]=qs[_0x8397('0x23')](_0x3f2362['query']['offset']);_0x1d3bd7[_0x8397('0x75')]=qs[_0x8397('0x3c')](_0x3f2362[_0x8397('0x34')][_0x8397('0x3c')]);_0x1d3bd7[_0x8397('0x3d')]=qs[_0x8397('0x36')](_[_0x8397('0x76')](_0x3f2362['query'],_0x217013[_0x8397('0x36')]));_0x1d3bd7=_[_0x8397('0x3e')]({},_0x1d3bd7,_0x3f2362['options']);return _0x1a507e[_0x8397('0x4e')+_[_0x8397('0x72')](_0x3f2362[_0x8397('0x34')]['channel'][_0x8397('0x73')]())+_0x8397('0x77')](_0x1d3bd7);})[_0x8397('0x2b')](respondWithResult(_0x3a38fe,null))[_0x8397('0x45')](handleError(_0x3a38fe,null));};exports[_0x8397('0x78')]=function(_0x4c168a,_0x314de2,_0x3f6552){return db[_0x8397('0x2f')][_0x8397('0x6f')]({'where':{'id':_0x4c168a[_0x8397('0x46')]['id']}})[_0x8397('0x2b')](function(_0x16e3ea){if(_0x16e3ea){if(!_0x4c168a[_0x8397('0x4a')]['channel']||!utils[_0x8397('0x71')](_0x4c168a[_0x8397('0x4a')][_0x8397('0x70')])){throw new db[(_0x8397('0x58'))]['ValidationError'](_0x8397('0x79'));}return _0x16e3ea[_0x8397('0x7a')+_[_0x8397('0x72')](_0x4c168a['body'][_0x8397('0x70')]['toLowerCase']())+_0x8397('0x77')](_0x4c168a['body'][_0x8397('0x7b')]);}return null;})[_0x8397('0x2b')](handleEntityNotFound(_0x314de2,null))['then'](respondWithStatusCode(_0x314de2,null))[_0x8397('0x45')](handleError(_0x314de2,null));};exports[_0x8397('0x7c')]=function(_0x55f6cb,_0x3ec435,_0x45165a){return db[_0x8397('0x2f')]['findOne']({'where':{'id':_0x55f6cb[_0x8397('0x46')]['id']}})[_0x8397('0x2b')](function(_0x1d9fbc){if(_0x1d9fbc){if(!_0x55f6cb[_0x8397('0x34')][_0x8397('0x70')]||!utils[_0x8397('0x71')](_0x55f6cb['query']['channel'])){throw new db['Sequelize'][(_0x8397('0x7d'))](_0x8397('0x79'));}return _0x1d9fbc[_0x8397('0x7e')+_[_0x8397('0x72')](_0x55f6cb['query'][_0x8397('0x70')][_0x8397('0x73')]())+_0x8397('0x77')](_0x55f6cb[_0x8397('0x34')]['ids']);}return null;})[_0x8397('0x2b')](handleEntityNotFound(_0x3ec435,null))['then'](respondWithStatusCode(_0x3ec435,null))['catch'](handleError(_0x3ec435,null));};exports[_0x8397('0x7f')]=function(_0x23d7c1,_0xac3eab){var _0x4f074e=_[_0x8397('0x80')](_0x23d7c1[_0x8397('0x4a')][_0x8397('0x7b')])?_0x23d7c1[_0x8397('0x4a')]['ids']:[_0x23d7c1['body'][_0x8397('0x7b')]];var _0x651963=_0x23d7c1['params']['id'];return db['Team']['find']({'where':{'id':_0x651963}})[_0x8397('0x2b')](handleEntityNotFound(_0xac3eab,null))['then'](function(_0x2cf83f){if(_0x2cf83f){var _0xef25a4=['Voice',_0x8397('0x81'),'Mail',_0x8397('0x82'),_0x8397('0x83'),_0x8397('0x84'),_0x8397('0x85')];return db[_0x8397('0x55')][_0x8397('0x56')](function(_0x5964d3){var _0x21d0b2=_[_0x8397('0x3f')](_0xef25a4,function(_0x438a77){var _0x49a132={'attributes':['id',_0x8397('0x2d')]};if(_0x438a77===_0x8397('0x86')){_0x49a132[_0x8397('0x87')]={'attributes':[_0x8397('0x88')]};}return _0x2cf83f[_0x8397('0x4e')+_0x438a77+_0x8397('0x77')](_0x49a132)[_0x8397('0x2b')](function(_0x107c99){var _0x792457=_[_0x8397('0x3f')](_0x107c99,function(_0x4404d5){var _0x334a9b=_[_0x8397('0x3f')](_0x4f074e,function(_0x26afe5){var _0x435f73={'where':{'UserId':_0x26afe5,[_0x438a77+_0x8397('0x89')]:_0x4404d5['id']},'transaction':_0x5964d3};if(_0x438a77==='Voice'){_0x435f73[_0x8397('0x1c')]={'penalty':_0x4404d5[_0x8397('0x8a')][_0x8397('0x88')]};}return db['User'+_0x438a77+_0x8397('0x74')][_0x8397('0x8b')](_0x435f73)[_0x8397('0x2b')](function(){socket['emit'](_0x8397('0x4b')+_0x438a77+'Queue:save',{'UserId':_0x26afe5,[_0x438a77+_0x8397('0x89')]:_0x4404d5['id']});if(_0x438a77!=='Voice'){return;}return db[_0x8397('0x8c')][_0x8397('0x43')]({'where':{'id':_0x4f074e,'online':0x1},'attributes':['id',_0x8397('0x2d'),_0x8397('0x8d'),'voicePause',_0x8397('0x8e')],'raw':!![]})['then'](function(_0x39e08d){var _0x5a267b=_[_0x8397('0x3f')](_0x39e08d,function(_0x3c7ba3){return db[_0x8397('0x8f')]['upsert']({'membername':_0x3c7ba3['name'],'UserId':_0x3c7ba3['id'],'queue_name':_0x4404d5[_0x8397('0x2d')],'VoiceQueueId':_0x4404d5['id'],'interface':_['isNil'](_0x3c7ba3[_0x8397('0x8e')])?util[_0x8397('0x90')]('SIP/%s',_0x3c7ba3['name']):_0x3c7ba3[_0x8397('0x8e')],'paused':_0x3c7ba3['voicePause']||![],'penalty':_0x4404d5[_0x8397('0x8a')][_0x8397('0x88')]},{'transaction':_0x5964d3});});return Promise[_0x8397('0x91')](_0x5a267b);});});});return Promise[_0x8397('0x91')](_0x334a9b);});return Promise[_0x8397('0x91')](_0x792457);})['then'](function(){return db['TeamVoicePrefix'][_0x8397('0x6f')]({'where':{'teamId':_0x651963}})[_0x8397('0x2b')](function(_0x5d0853){if(_0x5d0853){var _0x974659=_[_0x8397('0x3f')](_0x4f074e,function(_0x2f5625){db[_0x8397('0x6c')][_0x8397('0x92')]({'UserId':_0x2f5625,'VoicePrefixId':_0x5d0853['VoicePrefixId']});});return Promise['all'](_0x974659);}});});});return Promise[_0x8397('0x91')](_0x21d0b2)[_0x8397('0x2b')](function(){return _0x2cf83f['addAgents'](_0x4f074e,{'transaction':_0x5964d3})['spread'](function(_0x47fc84){return _0x47fc84;});});});}})['then'](respondWithResult(_0xac3eab,null))['catch'](handleError(_0xac3eab,null));};exports[_0x8397('0x93')]=function(_0x5ad4b6,_0x27b453){var _0x2b4566=_[_0x8397('0x80')](_0x5ad4b6[_0x8397('0x34')][_0x8397('0x7b')])?_0x5ad4b6[_0x8397('0x34')][_0x8397('0x7b')]:[_0x5ad4b6[_0x8397('0x34')][_0x8397('0x7b')]];var _0x27ae6a=_0x5ad4b6[_0x8397('0x46')]['id'];return db[_0x8397('0x2f')][_0x8397('0x48')]({'where':{'id':_0x27ae6a}})[_0x8397('0x2b')](handleEntityNotFound(_0x27b453,null))['then'](function(_0xc6d6d1){if(_0xc6d6d1){var _0x1fc25c=['Voice',_0x8397('0x81'),_0x8397('0x94'),_0x8397('0x82'),_0x8397('0x83'),_0x8397('0x84'),_0x8397('0x85')];return db[_0x8397('0x55')][_0x8397('0x56')](function(_0x572564){var _0x491f03=_[_0x8397('0x3f')](_0x1fc25c,function(_0x4eccee){var _0x19cb50={'attributes':['id',_0x8397('0x2d')]};return _0xc6d6d1[_0x8397('0x4e')+_0x4eccee+_0x8397('0x77')](_0x19cb50)[_0x8397('0x2b')](function(_0x207e2c){var _0x4ac97c=_[_0x8397('0x3f')](_0x207e2c,function(_0x11be4a){return _0x11be4a[_0x8397('0x93')](_0x2b4566,{'transaction':_0x572564})[_0x8397('0x2b')](function(){var _0x2921e7=_[_0x8397('0x3f')](_0x2b4566,function(_0x17315c){socket[_0x8397('0x95')](_0x8397('0x4b')+_0x4eccee+'Queue:remove',{'UserId':Number(_0x17315c),[_0x4eccee+_0x8397('0x89')]:_0x11be4a['id']});if(_0x4eccee!=='Voice'){return;}return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x11be4a['id'],'UserId':_0x17315c},'transaction':_0x572564});});return Promise[_0x8397('0x91')](_0x2921e7);});});return Promise['all'](_0x4ac97c);});});return Promise[_0x8397('0x91')](_0x491f03)[_0x8397('0x2b')](function(){return _0xc6d6d1[_0x8397('0x93')](_0x2b4566,{'transaction':_0x572564});})[_0x8397('0x2b')](function(){return db[_0x8397('0x6b')][_0x8397('0x6f')]({'where':{'teamId':_0x27ae6a}})[_0x8397('0x2b')](function(_0x5ade84){if(_0x5ade84){var _0x55ee25=_[_0x8397('0x3f')](_0x2b4566,function(_0x2edd23){db[_0x8397('0x6c')][_0x8397('0x5f')]({'where':{'UserId':_0x2edd23,'VoicePrefixId':_0x5ade84[_0x8397('0x6d')]}});});return Promise['all'](_0x55ee25);}});});});}})[_0x8397('0x2b')](respondWithStatusCode(_0x27b453,null))[_0x8397('0x45')](handleError(_0x27b453,null));};exports['getAgents']=function(_0x5e6680,_0x2865a0,_0x3a4d2c){var _0x253cfa={};var _0x3ad77f={};var _0x244a12;var _0x48442d;return db[_0x8397('0x2f')][_0x8397('0x6f')]({'where':{'id':_0x5e6680[_0x8397('0x46')]['id']}})[_0x8397('0x2b')](handleEntityNotFound(_0x2865a0,null))[_0x8397('0x2b')](function(_0x509ace){if(_0x509ace){_0x244a12=_0x509ace;_0x3ad77f[_0x8397('0x33')]=_[_0x8397('0x35')](db[_0x8397('0x8c')][_0x8397('0x30')]);_0x3ad77f[_0x8397('0x34')]=_[_0x8397('0x35')](_0x5e6680['query']);_0x3ad77f[_0x8397('0x36')]=_[_0x8397('0x47')](_0x3ad77f[_0x8397('0x33')],_0x3ad77f[_0x8397('0x34')]);_0x253cfa[_0x8397('0x37')]=_['intersection'](_0x3ad77f['model'],qs[_0x8397('0x38')](_0x5e6680[_0x8397('0x34')][_0x8397('0x38')]));_0x253cfa[_0x8397('0x37')]=_0x253cfa[_0x8397('0x37')][_0x8397('0x39')]?_0x253cfa[_0x8397('0x37')]:_0x3ad77f[_0x8397('0x33')];_0x253cfa[_0x8397('0x75')]=qs[_0x8397('0x3c')](_0x5e6680[_0x8397('0x34')][_0x8397('0x3c')]);_0x253cfa[_0x8397('0x3d')]=qs['filters'](_[_0x8397('0x76')](_0x5e6680[_0x8397('0x34')],_0x3ad77f[_0x8397('0x36')]));if(_0x5e6680[_0x8397('0x34')]['filter']){_0x253cfa[_0x8397('0x3d')]=_['merge'](_0x253cfa[_0x8397('0x3d')],{'$or':_[_0x8397('0x3f')](_0x253cfa['attributes'],function(_0x3697cf){var _0x2a968b={};_0x2a968b[_0x3697cf]={'$like':'%'+_0x5e6680['query'][_0x8397('0x96')]+'%'};return _0x2a968b;})});}_0x253cfa=_[_0x8397('0x3e')]({},_0x253cfa,_0x5e6680[_0x8397('0x40')]);return _0x244a12[_0x8397('0x97')](_0x253cfa);}})[_0x8397('0x2b')](function(_0x54f43b){if(_0x54f43b){_0x48442d=_0x54f43b[_0x8397('0x39')];if(!_0x5e6680[_0x8397('0x34')][_0x8397('0x3a')]('nolimit')){_0x253cfa[_0x8397('0x25')]=qs[_0x8397('0x25')](_0x5e6680[_0x8397('0x34')][_0x8397('0x25')]);_0x253cfa[_0x8397('0x23')]=qs[_0x8397('0x23')](_0x5e6680['query'][_0x8397('0x23')]);}return _0x244a12['getAgents'](_0x253cfa);}})[_0x8397('0x2b')](function(_0x40bdee){if(_0x40bdee){return _0x40bdee?{'count':_0x48442d,'rows':_0x40bdee}:null;}})[_0x8397('0x2b')](respondWithResult(_0x2865a0,null))[_0x8397('0x45')](handleError(_0x2865a0,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 390fc0c..3b0d6d5 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 _0x5d93=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','emit'];(function(_0x65c50e,_0x1aa926){var _0x4573e7=function(_0x5bc049){while(--_0x5bc049){_0x65c50e['push'](_0x65c50e['shift']());}};_0x4573e7(++_0x1aa926);}(_0x5d93,0x15b));var _0x35d9=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x5d93[_0x5f309e];return _0x487b5e;};'use strict';var EventEmitter=require(_0x35d9('0x0'));var Team=require(_0x35d9('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x35d9('0x2')](0x0);var events={'afterCreate':_0x35d9('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x469166){return function(_0x4fe3a7,_0x214838,_0x30f363){TeamEvents[_0x35d9('0x4')](_0x469166+':'+_0x4fe3a7['id'],_0x4fe3a7);TeamEvents[_0x35d9('0x4')](_0x469166,_0x4fe3a7);_0x30f363(null);};}for(var e in events){if(events[_0x35d9('0x5')](e)){var event=events[e];Team[_0x35d9('0x6')](e,emitEvent(event));}}module[_0x35d9('0x7')]=TeamEvents; \ No newline at end of file +var _0xb1f3=['events','../../mysqldb','Team','setMaxListeners','save','update','emit','hook','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb1f3,0x120));var _0x3b1f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb1f3[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x3b1f('0x0'));var Team=require(_0x3b1f('0x1'))['db'][_0x3b1f('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x3b1f('0x3')](0x0);var events={'afterCreate':_0x3b1f('0x4'),'afterUpdate':_0x3b1f('0x5'),'afterDestroy':'remove'};function emitEvent(_0x9ed4ec){return function(_0x2b5d23,_0x4bf65b,_0x49e2b7){TeamEvents[_0x3b1f('0x6')](_0x9ed4ec+':'+_0x2b5d23['id'],_0x2b5d23);TeamEvents[_0x3b1f('0x6')](_0x9ed4ec,_0x2b5d23);_0x49e2b7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x3b1f('0x7')](e,emitEvent(event));}}module[_0x3b1f('0x8')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 6aff173..5e3c288 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 _0xd80e=['Chat','Fax','Mail','Openchannel','Sms','Voice','resolve','lodash','./team.attributes','get','Queues','then','map','setDataValue','channel','exports','define','Team'];(function(_0x305839,_0x16378a){var _0x814c6f=function(_0x3edcdf){while(--_0x3edcdf){_0x305839['push'](_0x305839['shift']());}};_0x814c6f(++_0x16378a);}(_0xd80e,0xf1));var _0xed80=function(_0xbe25fa,_0x271bd5){_0xbe25fa=_0xbe25fa-0x0;var _0x4ba275=_0xd80e[_0xbe25fa];return _0x4ba275;};'use strict';var _=require(_0xed80('0x0'));var attributes=require(_0xed80('0x1'));function getQueuesByChannel(_0x2d702c,_0x3e00ad){var _0x47b383=_0xed80('0x2')+_0x3e00ad+_0xed80('0x3');return _0x2d702c[_0x47b383]()[_0xed80('0x4')](function(_0x18fad2){return _[_0xed80('0x5')](_0x18fad2,function(_0x4d9ee5){_0x4d9ee5[_0xed80('0x6')](_0xed80('0x7'),_0x3e00ad);return _0x4d9ee5;});})['catch'](function(_0x408793){throw _0x408793;});}module[_0xed80('0x8')]=function(_0x432381){return _0x432381[_0xed80('0x9')](_0xed80('0xa'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x3458c8=this;var _0x49420b=[_0xed80('0xb'),_0xed80('0xc'),_0xed80('0xd'),_0xed80('0xe'),_0xed80('0xf'),_0xed80('0x10'),'Whatsapp'];return Promise[_0xed80('0x11')]()['then'](function(){var _0x4fb834=_[_0xed80('0x5')](_0x49420b,function(_0xd8a86a){return getQueuesByChannel(_0x3458c8,_0xd8a86a);});return Promise['all'](_0x4fb834);})['catch'](function(_0x29141e){throw _0x29141e;});}}});}; \ No newline at end of file +var _0xfce2=['catch','exports','define','teams','Chat','Fax','Mail','Openchannel','Sms','Whatsapp','resolve','all','lodash','get','Queues','then','map','setDataValue','channel'];(function(_0x583a65,_0x5a6186){var _0x37e901=function(_0x24eacc){while(--_0x24eacc){_0x583a65['push'](_0x583a65['shift']());}};_0x37e901(++_0x5a6186);}(_0xfce2,0xb7));var _0x2fce=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfce2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2fce('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0x4b893b,_0x17c13d){var _0x3a98ca=_0x2fce('0x1')+_0x17c13d+_0x2fce('0x2');return _0x4b893b[_0x3a98ca]()[_0x2fce('0x3')](function(_0x3d238e){return _[_0x2fce('0x4')](_0x3d238e,function(_0x22c9e6){_0x22c9e6[_0x2fce('0x5')](_0x2fce('0x6'),_0x17c13d);return _0x22c9e6;});})[_0x2fce('0x7')](function(_0x320430){throw _0x320430;});}module[_0x2fce('0x8')]=function(_0x188ba5){return _0x188ba5[_0x2fce('0x9')]('Team',attributes,{'tableName':_0x2fce('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x501fca=this;var _0x114701=[_0x2fce('0xb'),_0x2fce('0xc'),_0x2fce('0xd'),_0x2fce('0xe'),_0x2fce('0xf'),'Voice',_0x2fce('0x10')];return Promise[_0x2fce('0x11')]()[_0x2fce('0x3')](function(){var _0x10d5cc=_['map'](_0x114701,function(_0x291646){return getQueuesByChannel(_0x501fca,_0x291646);});return Promise[_0x2fce('0x12')](_0x10d5cc);})['catch'](function(_0x4b0dbc){throw _0x4b0dbc;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 9003c8f..498ef0f 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 _0x83ff=['code','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','defaults','redis','localhost','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'];(function(_0x5d9867,_0x5e9030){var _0x7d2118=function(_0x2e5149){while(--_0x2e5149){_0x5d9867['push'](_0x5d9867['shift']());}};_0x7d2118(++_0x5e9030);}(_0x83ff,0x1ea));var _0xf83f=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0x83ff[_0x1477ef];return _0x164acd;};'use strict';var _=require(_0xf83f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf83f('0x1'));var fs=require('fs');var Redis=require(_0xf83f('0x2'));var db=require(_0xf83f('0x3'))['db'];var utils=require(_0xf83f('0x4'));var logger=require('../../config/logger')(_0xf83f('0x5'));var config=require('../../config/environment');var jayson=require(_0xf83f('0x6'));var client=jayson[_0xf83f('0x7')][_0xf83f('0x8')]({'port':0x232a});config['redis']=_[_0xf83f('0x9')](config[_0xf83f('0xa')],{'host':_0xf83f('0xb'),'port':0x18eb});var socket=require(_0xf83f('0xc'))(new Redis(config[_0xf83f('0xa')]));require(_0xf83f('0xd'))[_0xf83f('0xe')](socket);function respondWithRpcPromise(_0x3ec2b1,_0x5b03e3,_0x2207d2){return new BPromise(function(_0xfece1,_0x41a72e){return client[_0xf83f('0xf')](_0x3ec2b1,_0x2207d2)['then'](function(_0x4fe442){logger[_0xf83f('0x10')](_0xf83f('0x11'),_0x5b03e3,_0xf83f('0x12'));logger[_0xf83f('0x13')](_0xf83f('0x14'),_0x5b03e3,'request\x20sent',JSON[_0xf83f('0x15')](_0x4fe442));if(_0x4fe442[_0xf83f('0x16')]){if(_0x4fe442['error'][_0xf83f('0x17')]===0x1f4){logger['error']('Team,\x20%s,\x20%s',_0x5b03e3,_0x4fe442[_0xf83f('0x16')][_0xf83f('0x18')]);return _0x41a72e(_0x4fe442[_0xf83f('0x16')]['message']);}logger[_0xf83f('0x16')](_0xf83f('0x11'),_0x5b03e3,_0x4fe442[_0xf83f('0x16')][_0xf83f('0x18')]);return _0xfece1(_0x4fe442[_0xf83f('0x16')]['message']);}else{logger[_0xf83f('0x10')]('Team,\x20%s,\x20%s',_0x5b03e3,'request\x20sent');_0xfece1(_0x4fe442[_0xf83f('0x19')][_0xf83f('0x18')]);}})[_0xf83f('0x1a')](function(_0x28995a){logger['error']('Team,\x20%s,\x20%s',_0x5b03e3,_0x28995a);_0x41a72e(_0x28995a);});});} \ No newline at end of file +var _0x7bc9=['bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment'];(function(_0x44f52f,_0x1e6517){var _0x57b667=function(_0x32bb8f){while(--_0x32bb8f){_0x44f52f['push'](_0x44f52f['shift']());}};_0x57b667(++_0x1e6517);}(_0x7bc9,0x1c8));var _0x97bc=function(_0x47da19,_0x52ca57){_0x47da19=_0x47da19-0x0;var _0xf92051=_0x7bc9[_0x47da19];return _0xf92051;};'use strict';var _=require(_0x97bc('0x0'));var util=require(_0x97bc('0x1'));var moment=require(_0x97bc('0x2'));var BPromise=require(_0x97bc('0x3'));var rs=require(_0x97bc('0x4'));var fs=require('fs');var Redis=require(_0x97bc('0x5'));var db=require(_0x97bc('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x97bc('0x7'));var jayson=require(_0x97bc('0x8'));var client=jayson[_0x97bc('0x9')][_0x97bc('0xa')]({'port':0x232a});config[_0x97bc('0xb')]=_['defaults'](config[_0x97bc('0xb')],{'host':_0x97bc('0xc'),'port':0x18eb});var socket=require(_0x97bc('0xd'))(new Redis(config['redis']));require(_0x97bc('0xe'))[_0x97bc('0xf')](socket);function respondWithRpcPromise(_0xf299f7,_0x530aaf,_0x1af56b){return new BPromise(function(_0x598d85,_0x8b12ee){return client[_0x97bc('0x10')](_0xf299f7,_0x1af56b)[_0x97bc('0x11')](function(_0x5dd25d){logger[_0x97bc('0x12')](_0x97bc('0x13'),_0x530aaf,_0x97bc('0x14'));logger[_0x97bc('0x15')](_0x97bc('0x16'),_0x530aaf,_0x97bc('0x14'),JSON[_0x97bc('0x17')](_0x5dd25d));if(_0x5dd25d['error']){if(_0x5dd25d[_0x97bc('0x18')]['code']===0x1f4){logger[_0x97bc('0x18')](_0x97bc('0x13'),_0x530aaf,_0x5dd25d[_0x97bc('0x18')][_0x97bc('0x19')]);return _0x8b12ee(_0x5dd25d[_0x97bc('0x18')]['message']);}logger['error'](_0x97bc('0x13'),_0x530aaf,_0x5dd25d[_0x97bc('0x18')][_0x97bc('0x19')]);return _0x598d85(_0x5dd25d[_0x97bc('0x18')][_0x97bc('0x19')]);}else{logger[_0x97bc('0x12')](_0x97bc('0x13'),_0x530aaf,_0x97bc('0x14'));_0x598d85(_0x5dd25d['result'][_0x97bc('0x19')]);}})[_0x97bc('0x1a')](function(_0x66762d){logger[_0x97bc('0x18')](_0x97bc('0x13'),_0x530aaf,_0x66762d);_0x8b12ee(_0x66762d);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 4f7d9af..5b4a76e 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 _0x8b54=['./team.events','save','update','emit','removeListener','register','length','team:'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x8b54,0x1a8));var _0x48b5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8b54[_0x3dd15e];return _0x231fd0;};'use strict';var TeamEvents=require(_0x48b5('0x0'));var events=[_0x48b5('0x1'),'remove',_0x48b5('0x2')];function createListener(_0x21f0a5,_0x5c6631){return function(_0x157c47){_0x5c6631[_0x48b5('0x3')](_0x21f0a5,_0x157c47);};}function removeListener(_0x59b8bd,_0x4f665d){return function(){TeamEvents[_0x48b5('0x4')](_0x59b8bd,_0x4f665d);};}exports[_0x48b5('0x5')]=function(_0x129382){for(var _0x33064f=0x0,_0x56d614=events[_0x48b5('0x6')];_0x33064f<_0x56d614;_0x33064f++){var _0x431310=events[_0x33064f];var _0x37d1f4=createListener(_0x48b5('0x7')+_0x431310,_0x129382);TeamEvents['on'](_0x431310,_0x37d1f4);}}; \ No newline at end of file +var _0xa83a=['emit','removeListener','register','team:','save','remove'];(function(_0x310027,_0x43b355){var _0x37a8fc=function(_0x459df6){while(--_0x459df6){_0x310027['push'](_0x310027['shift']());}};_0x37a8fc(++_0x43b355);}(_0xa83a,0x88));var _0xaa83=function(_0x19f7bb,_0x497d6a){_0x19f7bb=_0x19f7bb-0x0;var _0x333876=_0xa83a[_0x19f7bb];return _0x333876;};'use strict';var TeamEvents=require('./team.events');var events=[_0xaa83('0x0'),_0xaa83('0x1'),'update'];function createListener(_0x4b12fa,_0x17a8bd){return function(_0x1f3808){_0x17a8bd[_0xaa83('0x2')](_0x4b12fa,_0x1f3808);};}function removeListener(_0x46b692,_0x57f849){return function(){TeamEvents[_0xaa83('0x3')](_0x46b692,_0x57f849);};}exports[_0xaa83('0x4')]=function(_0x280637){for(var _0x9c332d=0x0,_0x31d733=events['length'];_0x9c332d<_0x31d733;_0x9c332d++){var _0x5d5a47=events[_0x9c332d];var _0x582edf=createListener(_0xaa83('0x5')+_0x5d5a47,_0x280637);TeamEvents['on'](_0x5d5a47,_0x582edf);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 340056f..12e2924 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 _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'TeamId':{'type':Sequelize[_0x0a9e('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x21a3=['sequelize','INTEGER'];(function(_0x355ce8,_0x5f1d0a){var _0x1db8b8=function(_0x277eb2){while(--_0x277eb2){_0x355ce8['push'](_0x355ce8['shift']());}};_0x1db8b8(++_0x5f1d0a);}(_0x21a3,0x66));var _0x321a=function(_0x441964,_0x3070ae){_0x441964=_0x441964-0x0;var _0x4211f0=_0x21a3[_0x441964];return _0x4211f0;};'use strict';var Sequelize=require(_0x321a('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0x321a('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x321a('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index bb48063..77d4275 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 _0xbecf=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes'];(function(_0x17c5bb,_0x527953){var _0x47df9e=function(_0x1fdc9e){while(--_0x1fdc9e){_0x17c5bb['push'](_0x17c5bb['shift']());}};_0x47df9e(++_0x527953);}(_0xbecf,0x15c));var _0xfbec=function(_0x45bfbf,_0x5e9b3e){_0x45bfbf=_0x45bfbf-0x0;var _0x33108a=_0xbecf[_0x45bfbf];return _0x33108a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfbec('0x0'))(_0xfbec('0x1'));var moment=require(_0xfbec('0x2'));var BPromise=require(_0xfbec('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfbec('0x4'));var rimraf=require(_0xfbec('0x5'));var config=require(_0xfbec('0x6'));var attributes=require(_0xfbec('0x7'));module[_0xfbec('0x8')]=function(_0x5bd6f1,_0x297f85){return _0x5bd6f1[_0xfbec('0x9')](_0xfbec('0xa'),attributes,{'tableName':_0xfbec('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3013=['rimraf','../../config/environment','./teamVoicePrefix.attributes','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x532b5b,_0xce6ec8){var _0x169ff9=function(_0x4d2804){while(--_0x4d2804){_0x532b5b['push'](_0x532b5b['shift']());}};_0x169ff9(++_0xce6ec8);}(_0x3013,0xea));var _0x3301=function(_0x84b170,_0x1b59a1){_0x84b170=_0x84b170-0x0;var _0x126a0b=_0x3013[_0x84b170];return _0x126a0b;};'use strict';var _=require(_0x3301('0x0'));var util=require(_0x3301('0x1'));var logger=require(_0x3301('0x2'))(_0x3301('0x3'));var moment=require('moment');var BPromise=require(_0x3301('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3301('0x5'));var rimraf=require(_0x3301('0x6'));var config=require(_0x3301('0x7'));var attributes=require(_0x3301('0x8'));module['exports']=function(_0x30b608,_0x52515d){return _0x30b608[_0x3301('0x9')](_0x3301('0xa'),attributes,{'tableName':_0x3301('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index a24a251..441a15f 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x12aa98,_0x39916d){var _0x42935f=function(_0x37d922){while(--_0x37d922){_0x12aa98['push'](_0x12aa98['shift']());}};_0x42935f(++_0x39916d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x57cf49,_0x4878e5){var _0x1aa22d=function(_0x3c4edf){while(--_0x3c4edf){_0x57cf49['push'](_0x57cf49['shift']());}};_0x1aa22d(++_0x4878e5);}(_0x70e0,0x17b));var _0x070e=function(_0x5ddc5f,_0x59adf6){_0x5ddc5f=_0x5ddc5f-0x0;var _0x1affa0=_0x70e0[_0x5ddc5f];return _0x1affa0;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 858bfdc..63e5b57 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 _0x77aa=['exports','INTEGER','sequelize'];(function(_0x8acd24,_0x5ac818){var _0x451e0a=function(_0x528f17){while(--_0x528f17){_0x8acd24['push'](_0x8acd24['shift']());}};_0x451e0a(++_0x5ac818);}(_0x77aa,0x89));var _0xa77a=function(_0x1b99c5,_0x2ff8fb){_0x1b99c5=_0x1b99c5-0x0;var _0x5528d9=_0x77aa[_0x1b99c5];return _0x5528d9;};'use strict';var Sequelize=require(_0xa77a('0x0'));module[_0xa77a('0x1')]={'penalty':{'type':Sequelize[_0xa77a('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6935=['sequelize','exports','INTEGER'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x6935,0x1c5));var _0x5693=function(_0x5a540e,_0x350d12){_0x5a540e=_0x5a540e-0x0;var _0x8eba2c=_0x6935[_0x5a540e];return _0x8eba2c;};'use strict';var Sequelize=require(_0x5693('0x0'));module[_0x5693('0x1')]={'penalty':{'type':Sequelize[_0x5693('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 ef2958b..127f9d8 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 _0x6953=['../../config/environment','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','bluebird','path','rimraf'];(function(_0x558df4,_0x4818bb){var _0x495586=function(_0x439145){while(--_0x439145){_0x558df4['push'](_0x558df4['shift']());}};_0x495586(++_0x4818bb);}(_0x6953,0x91));var _0x3695=function(_0x49ba30,_0x5cb169){_0x49ba30=_0x49ba30-0x0;var _0x47d95f=_0x6953[_0x49ba30];return _0x47d95f;};'use strict';var _=require(_0x3695('0x0'));var util=require(_0x3695('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x3695('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3695('0x3'));var rimraf=require(_0x3695('0x4'));var config=require(_0x3695('0x5'));var attributes=require('./teamVoiceQueue.attributes');module[_0x3695('0x6')]=function(_0x558026,_0x2d7d98){return _0x558026[_0x3695('0x7')](_0x3695('0x8'),attributes,{'tableName':_0x3695('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe739=['TeamVoiceQueue','lodash','../../config/logger','api','moment','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define'];(function(_0x231ca3,_0x572d42){var _0x55fffa=function(_0x490bd7){while(--_0x490bd7){_0x231ca3['push'](_0x231ca3['shift']());}};_0x55fffa(++_0x572d42);}(_0xe739,0x105));var _0x9e73=function(_0x128835,_0x546e7d){_0x128835=_0x128835-0x0;var _0x36fc61=_0xe739[_0x128835];return _0x36fc61;};'use strict';var _=require(_0x9e73('0x0'));var util=require('util');var logger=require(_0x9e73('0x1'))(_0x9e73('0x2'));var moment=require(_0x9e73('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9e73('0x4'));var config=require(_0x9e73('0x5'));var attributes=require(_0x9e73('0x6'));module[_0x9e73('0x7')]=function(_0x4cb2ed,_0x3db8fa){return _0x4cb2ed[_0x9e73('0x8')](_0x9e73('0x9'),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 5997585..0940889 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 _0xbb67=['debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0xbb67,0x8b));var _0x7bb6=function(_0x458324,_0x283051){_0x458324=_0x458324-0x0;var _0x3aecec=_0xbb67[_0x458324];return _0x3aecec;};'use strict';var _=require(_0x7bb6('0x0'));var util=require(_0x7bb6('0x1'));var moment=require(_0x7bb6('0x2'));var BPromise=require(_0x7bb6('0x3'));var rs=require(_0x7bb6('0x4'));var fs=require('fs');var Redis=require(_0x7bb6('0x5'));var db=require(_0x7bb6('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7bb6('0x7'));var config=require('../../config/environment');var jayson=require(_0x7bb6('0x8'));var client=jayson[_0x7bb6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5780e2,_0xc2211c,_0x376041){return new BPromise(function(_0x21a07a,_0xb062a1){return client[_0x7bb6('0xa')](_0x5780e2,_0x376041)[_0x7bb6('0xb')](function(_0x14f502){logger[_0x7bb6('0xc')](_0x7bb6('0xd'),_0xc2211c,_0x7bb6('0xe'));logger[_0x7bb6('0xf')](_0x7bb6('0x10'),_0xc2211c,_0x7bb6('0xe'),JSON[_0x7bb6('0x11')](_0x14f502));if(_0x14f502[_0x7bb6('0x12')]){if(_0x14f502[_0x7bb6('0x12')][_0x7bb6('0x13')]===0x1f4){logger['error'](_0x7bb6('0xd'),_0xc2211c,_0x14f502[_0x7bb6('0x12')]['message']);return _0xb062a1(_0x14f502[_0x7bb6('0x12')]['message']);}logger[_0x7bb6('0x12')]('TeamVoiceQueue,\x20%s,\x20%s',_0xc2211c,_0x14f502['error']['message']);return _0x21a07a(_0x14f502['error'][_0x7bb6('0x14')]);}else{logger[_0x7bb6('0xc')](_0x7bb6('0xd'),_0xc2211c,_0x7bb6('0xe'));_0x21a07a(_0x14f502[_0x7bb6('0x15')][_0x7bb6('0x14')]);}})['catch'](function(_0x19c359){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0xc2211c,_0x19c359);_0xb062a1(_0x19c359);});});} \ No newline at end of file +var _0x0af7=['info','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','TeamVoiceQueue,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x5ea360,_0x3c055a){var _0x32c402=function(_0x3ea669){while(--_0x3ea669){_0x5ea360['push'](_0x5ea360['shift']());}};_0x32c402(++_0x3c055a);}(_0x0af7,0x17b));var _0x70af=function(_0x5ce892,_0x27ea78){_0x5ce892=_0x5ce892-0x0;var _0x5b9a5d=_0x0af7[_0x5ce892];return _0x5b9a5d;};'use strict';var _=require(_0x70af('0x0'));var util=require('util');var moment=require(_0x70af('0x1'));var BPromise=require(_0x70af('0x2'));var rs=require(_0x70af('0x3'));var fs=require('fs');var Redis=require(_0x70af('0x4'));var db=require(_0x70af('0x5'))['db'];var utils=require(_0x70af('0x6'));var logger=require('../../config/logger')(_0x70af('0x7'));var config=require(_0x70af('0x8'));var jayson=require(_0x70af('0x9'));var client=jayson[_0x70af('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc71ed2,_0x24ea50,_0x16e98a){return new BPromise(function(_0x53a4b8,_0x270c17){return client['request'](_0xc71ed2,_0x16e98a)[_0x70af('0xb')](function(_0x36ab41){logger[_0x70af('0xc')]('TeamVoiceQueue,\x20%s,\x20%s',_0x24ea50,_0x70af('0xd'));logger[_0x70af('0xe')](_0x70af('0xf'),_0x24ea50,_0x70af('0xd'),JSON[_0x70af('0x10')](_0x36ab41));if(_0x36ab41[_0x70af('0x11')]){if(_0x36ab41[_0x70af('0x11')][_0x70af('0x12')]===0x1f4){logger[_0x70af('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x24ea50,_0x36ab41[_0x70af('0x11')][_0x70af('0x13')]);return _0x270c17(_0x36ab41[_0x70af('0x11')]['message']);}logger[_0x70af('0x11')](_0x70af('0x14'),_0x24ea50,_0x36ab41[_0x70af('0x11')][_0x70af('0x13')]);return _0x53a4b8(_0x36ab41[_0x70af('0x11')][_0x70af('0x13')]);}else{logger[_0x70af('0xc')]('TeamVoiceQueue,\x20%s,\x20%s',_0x24ea50,_0x70af('0xd'));_0x53a4b8(_0x36ab41[_0x70af('0x15')][_0x70af('0x13')]);}})[_0x70af('0x16')](function(_0x3f068b){logger[_0x70af('0x11')](_0x70af('0x14'),_0x24ea50,_0x3f068b);_0x270c17(_0x3f068b);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 566375b..e62c3be 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 _0x13c5=['create','put','/:id','delete','exports','multer','../../components/auth/service','./template.controller','get','isAuthenticated','index','show','post'];(function(_0x4c1bfc,_0xab6586){var _0x476c31=function(_0x443c0b){while(--_0x443c0b){_0x4c1bfc['push'](_0x4c1bfc['shift']());}};_0x476c31(++_0xab6586);}(_0x13c5,0x7a));var _0x513c=function(_0x1f43b6,_0x597a47){_0x1f43b6=_0x1f43b6-0x0;var _0x23a8db=_0x13c5[_0x1f43b6];return _0x23a8db;};'use strict';var multer=require(_0x513c('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x513c('0x1'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x513c('0x2'));router[_0x513c('0x3')]('/',auth[_0x513c('0x4')](),controller[_0x513c('0x5')]);router['get']('/:id',auth[_0x513c('0x4')](),controller[_0x513c('0x6')]);router[_0x513c('0x7')]('/',auth[_0x513c('0x4')](),controller[_0x513c('0x8')]);router[_0x513c('0x9')](_0x513c('0xa'),auth[_0x513c('0x4')](),controller['update']);router[_0x513c('0xb')](_0x513c('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x513c('0xc')]=router; \ No newline at end of file +var _0xf8f2=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x5babc6,_0x3760bc){var _0x4afdb1=function(_0x5070c9){while(--_0x5070c9){_0x5babc6['push'](_0x5babc6['shift']());}};_0x4afdb1(++_0x3760bc);}(_0xf8f2,0xc2));var _0x2f8f=function(_0x38ed44,_0x23c2c4){_0x38ed44=_0x38ed44-0x0;var _0x7712a3=_0xf8f2[_0x38ed44];return _0x7712a3;};'use strict';var multer=require(_0x2f8f('0x0'));var util=require(_0x2f8f('0x1'));var path=require(_0x2f8f('0x2'));var timeout=require(_0x2f8f('0x3'));var express=require('express');var router=express[_0x2f8f('0x4')]();var fs_extra=require(_0x2f8f('0x5'));var auth=require(_0x2f8f('0x6'));var interaction=require(_0x2f8f('0x7'));var config=require(_0x2f8f('0x8'));var controller=require('./template.controller');router[_0x2f8f('0x9')]('/',auth[_0x2f8f('0xa')](),controller[_0x2f8f('0xb')]);router[_0x2f8f('0x9')](_0x2f8f('0xc'),auth[_0x2f8f('0xa')](),controller[_0x2f8f('0xd')]);router[_0x2f8f('0xe')]('/',auth['isAuthenticated'](),controller[_0x2f8f('0xf')]);router[_0x2f8f('0x10')](_0x2f8f('0xc'),auth[_0x2f8f('0xa')](),controller['update']);router[_0x2f8f('0x11')](_0x2f8f('0xc'),auth['isAuthenticated'](),controller[_0x2f8f('0x12')]);module[_0x2f8f('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 d29c4bf..2e6973a 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 _0x72d0=['TEXT','exports','STRING'];(function(_0x1447d,_0x10a22f){var _0x14f8f9=function(_0x323fe3){while(--_0x323fe3){_0x1447d['push'](_0x1447d['shift']());}};_0x14f8f9(++_0x10a22f);}(_0x72d0,0x1a2));var _0x072d=function(_0x163555,_0x27ce78){_0x163555=_0x163555-0x0;var _0x250307=_0x72d0[_0x163555];return _0x250307;};'use strict';var Sequelize=require('sequelize');module[_0x072d('0x0')]={'name':{'type':Sequelize[_0x072d('0x1')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x072d('0x2')]}}; \ No newline at end of file +var _0xdb74=['STRING','TEXT','sequelize'];(function(_0x227f85,_0x32616f){var _0x324afe=function(_0x51794a){while(--_0x51794a){_0x227f85['push'](_0x227f85['shift']());}};_0x324afe(++_0x32616f);}(_0xdb74,0x92));var _0x4db7=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xdb74[_0x1035c1];return _0x308d67;};'use strict';var Sequelize=require(_0x4db7('0x0'));module['exports']={'name':{'type':Sequelize[_0x4db7('0x1')]},'description':{'type':Sequelize[_0x4db7('0x1')]},'html':{'type':Sequelize[_0x4db7('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 8487cd5..c1ba755 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 _0x0f51=['options','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Templates','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','json','limit','offset','count','set','Content-Range','reject','save','update','then','destroy','UserProfileResource','end','error','name','send','rawAttributes','type','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','Template','includeAll','include','findAll','rows','show','params'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x0f51,0xfa));var _0x10f5=function(_0x4b9878,_0x32fe17){_0x4b9878=_0x4b9878-0x0;var _0x14808b=_0x0f51[_0x4b9878];return _0x14808b;};'use strict';var emlformat=require(_0x10f5('0x0'));var rimraf=require(_0x10f5('0x1'));var zipdir=require(_0x10f5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x10f5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x10f5('0x4'));var path=require(_0x10f5('0x5'));var sox=require(_0x10f5('0x6'));var csv=require(_0x10f5('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x10f5('0x8'));var _=require('lodash');var squel=require(_0x10f5('0x9'));var crypto=require(_0x10f5('0xa'));var jsforce=require(_0x10f5('0xb'));var deskjs=require(_0x10f5('0xc'));var toCsv=require(_0x10f5('0x7'));var querystring=require(_0x10f5('0xd'));var Papa=require(_0x10f5('0xe'));var Redis=require('ioredis');var authService=require(_0x10f5('0xf'));var qs=require(_0x10f5('0x10'));var as=require(_0x10f5('0x11'));var hardwareService=require(_0x10f5('0x12'));var logger=require(_0x10f5('0x13'))('api');var utils=require(_0x10f5('0x14'));var config=require(_0x10f5('0x15'));var licenseUtil=require(_0x10f5('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e59bc,_0x19abe2){_0x19abe2=_0x19abe2||0xcc;return function(_0x4936f4){if(_0x4936f4){return _0x3e59bc['sendStatus'](_0x19abe2);}return _0x3e59bc[_0x10f5('0x17')](_0x19abe2)['end']();};}function respondWithResult(_0x5a3116,_0x435fb5){_0x435fb5=_0x435fb5||0xc8;return function(_0x3e2ea9){if(_0x3e2ea9){return _0x5a3116[_0x10f5('0x17')](_0x435fb5)[_0x10f5('0x18')](_0x3e2ea9);}};}function respondWithFilteredResult(_0x50feb3,_0x37170e){return function(_0x455a52){if(_0x455a52){var _0x401919=typeof _0x37170e['offset']==='undefined'&&typeof _0x37170e[_0x10f5('0x19')]==='undefined';var _0x670ca=_0x455a52['count'];var _0x6a4fe0=_0x401919?0x0:_0x37170e[_0x10f5('0x1a')];var _0x39d41a=_0x401919?_0x455a52[_0x10f5('0x1b')]:_0x37170e[_0x10f5('0x1a')]+_0x37170e['limit'];var _0x5d5f88;if(_0x39d41a>=_0x670ca){_0x39d41a=_0x670ca;_0x5d5f88=0xc8;}else{_0x5d5f88=0xce;}_0x50feb3[_0x10f5('0x17')](_0x5d5f88);return _0x50feb3[_0x10f5('0x1c')](_0x10f5('0x1d'),_0x6a4fe0+'-'+_0x39d41a+'/'+_0x670ca)[_0x10f5('0x18')](_0x455a52);}return null;};}function patchUpdates(_0x33aa54){return function(_0x3b6717){try{jsonpatch['apply'](_0x3b6717,_0x33aa54,!![]);}catch(_0x153938){return BPromise[_0x10f5('0x1e')](_0x153938);}return _0x3b6717[_0x10f5('0x1f')]();};}function saveUpdates(_0x199df8,_0x33e7e7){return function(_0x3a7a34){if(_0x3a7a34){return _0x3a7a34[_0x10f5('0x20')](_0x199df8)[_0x10f5('0x21')](function(_0x2fe8c2){return _0x2fe8c2;});}return null;};}function removeEntity(_0x25b779,_0xe7615a){return function(_0x4ac5bc){if(_0x4ac5bc){return _0x4ac5bc[_0x10f5('0x22')]()['then'](function(){var _0x7c2ce=_0x4ac5bc['get']({'plain':!![]});var _0x34e29d='Templates';return db[_0x10f5('0x23')][_0x10f5('0x22')]({'where':{'type':_0x34e29d,'resourceId':_0x7c2ce['id']}})[_0x10f5('0x21')](function(){return _0x4ac5bc;});})[_0x10f5('0x21')](function(){_0x25b779[_0x10f5('0x17')](0xcc)[_0x10f5('0x24')]();});}};}function handleEntityNotFound(_0x1ecd69,_0x5c5236){return function(_0x461316){if(!_0x461316){_0x1ecd69['sendStatus'](0x194);}return _0x461316;};}function handleError(_0x4fde6a,_0x20db5e){_0x20db5e=_0x20db5e||0x1f4;return function(_0x2e204d){logger[_0x10f5('0x25')](_0x2e204d['stack']);if(_0x2e204d[_0x10f5('0x26')]){delete _0x2e204d[_0x10f5('0x26')];}_0x4fde6a[_0x10f5('0x17')](_0x20db5e)[_0x10f5('0x27')](_0x2e204d);};}exports['index']=function(_0x377971,_0x5e5d0f){var _0x7aaa05={},_0x2042fa={},_0xa6758d={'count':0x0,'rows':[]};var _0x41f096=_['map'](db['Template'][_0x10f5('0x28')],function(_0x209bbd){return{'name':_0x209bbd['fieldName'],'type':_0x209bbd[_0x10f5('0x29')]['key']};});_0x2042fa[_0x10f5('0x2a')]=_[_0x10f5('0x2b')](_0x41f096,'name');_0x2042fa['query']=_[_0x10f5('0x2c')](_0x377971['query']);_0x2042fa[_0x10f5('0x2d')]=_[_0x10f5('0x2e')](_0x2042fa[_0x10f5('0x2a')],_0x2042fa[_0x10f5('0x2f')]);_0x7aaa05[_0x10f5('0x30')]=_['intersection'](_0x2042fa['model'],qs['fields'](_0x377971['query'][_0x10f5('0x31')]));_0x7aaa05[_0x10f5('0x30')]=_0x7aaa05['attributes'][_0x10f5('0x32')]?_0x7aaa05[_0x10f5('0x30')]:_0x2042fa['model'];if(!_0x377971[_0x10f5('0x2f')][_0x10f5('0x33')](_0x10f5('0x34'))){_0x7aaa05[_0x10f5('0x19')]=qs[_0x10f5('0x19')](_0x377971[_0x10f5('0x2f')][_0x10f5('0x19')]);_0x7aaa05[_0x10f5('0x1a')]=qs['offset'](_0x377971[_0x10f5('0x2f')][_0x10f5('0x1a')]);}_0x7aaa05[_0x10f5('0x35')]=qs[_0x10f5('0x36')](_0x377971[_0x10f5('0x2f')][_0x10f5('0x36')]);_0x7aaa05[_0x10f5('0x37')]=qs[_0x10f5('0x2d')](_[_0x10f5('0x38')](_0x377971[_0x10f5('0x2f')],_0x2042fa[_0x10f5('0x2d')]),_0x41f096);if(_0x377971[_0x10f5('0x2f')]['filter']){_0x7aaa05[_0x10f5('0x37')]=_[_0x10f5('0x39')](_0x7aaa05[_0x10f5('0x37')],{'$or':_[_0x10f5('0x2b')](_0x41f096,function(_0x5084fa){if(_0x5084fa[_0x10f5('0x29')]!==_0x10f5('0x3a')){var _0x209ae5={};_0x209ae5[_0x5084fa['name']]={'$like':'%'+_0x377971[_0x10f5('0x2f')]['filter']+'%'};return _0x209ae5;}})});}_0x7aaa05=_[_0x10f5('0x39')]({},_0x7aaa05,_0x377971['options']);var _0x219dd3={'where':_0x7aaa05[_0x10f5('0x37')]};return db[_0x10f5('0x3b')][_0x10f5('0x1b')](_0x219dd3)[_0x10f5('0x21')](function(_0x4377fd){_0xa6758d['count']=_0x4377fd;if(_0x377971[_0x10f5('0x2f')][_0x10f5('0x3c')]){_0x7aaa05[_0x10f5('0x3d')]=[{'all':!![]}];}return db[_0x10f5('0x3b')][_0x10f5('0x3e')](_0x7aaa05);})[_0x10f5('0x21')](function(_0x4fe53a){_0xa6758d[_0x10f5('0x3f')]=_0x4fe53a;return _0xa6758d;})[_0x10f5('0x21')](respondWithFilteredResult(_0x5e5d0f,_0x7aaa05))['catch'](handleError(_0x5e5d0f,null));};exports[_0x10f5('0x40')]=function(_0x9f708e,_0x3307f1){var _0x1ca837={'raw':!![],'where':{'id':_0x9f708e[_0x10f5('0x41')]['id']}},_0x18d14a={};_0x18d14a['model']=_[_0x10f5('0x2c')](db[_0x10f5('0x3b')][_0x10f5('0x28')]);_0x18d14a['query']=_[_0x10f5('0x2c')](_0x9f708e[_0x10f5('0x2f')]);_0x18d14a[_0x10f5('0x2d')]=_[_0x10f5('0x2e')](_0x18d14a['model'],_0x18d14a[_0x10f5('0x2f')]);_0x1ca837[_0x10f5('0x30')]=_[_0x10f5('0x2e')](_0x18d14a[_0x10f5('0x2a')],qs['fields'](_0x9f708e[_0x10f5('0x2f')]['fields']));_0x1ca837[_0x10f5('0x30')]=_0x1ca837[_0x10f5('0x30')][_0x10f5('0x32')]?_0x1ca837[_0x10f5('0x30')]:_0x18d14a[_0x10f5('0x2a')];if(_0x9f708e[_0x10f5('0x2f')]['includeAll']){_0x1ca837['include']=[{'all':!![]}];}_0x1ca837=_[_0x10f5('0x39')]({},_0x1ca837,_0x9f708e[_0x10f5('0x42')]);return db[_0x10f5('0x3b')][_0x10f5('0x43')](_0x1ca837)[_0x10f5('0x21')](handleEntityNotFound(_0x3307f1,null))['then'](respondWithResult(_0x3307f1,null))[_0x10f5('0x44')](handleError(_0x3307f1,null));};exports[_0x10f5('0x45')]=function(_0x402d3c,_0x1b26f5){return db[_0x10f5('0x3b')][_0x10f5('0x45')](_0x402d3c[_0x10f5('0x46')],{})[_0x10f5('0x21')](function(_0x460495){var _0x5d2cc5=_0x402d3c[_0x10f5('0x47')][_0x10f5('0x48')]({'plain':!![]});if(!_0x5d2cc5)throw new Error(_0x10f5('0x49'));if(_0x5d2cc5[_0x10f5('0x4a')]===_0x10f5('0x47')){var _0x29c57a=_0x460495[_0x10f5('0x48')]({'plain':!![]});var _0x3bf6ec=_0x10f5('0x4b');return db[_0x10f5('0x4c')]['find']({'where':{'name':_0x3bf6ec,'userProfileId':_0x5d2cc5['userProfileId']},'raw':!![]})[_0x10f5('0x21')](function(_0x47835a){if(_0x47835a&&_0x47835a[_0x10f5('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x29c57a[_0x10f5('0x26')],'resourceId':_0x29c57a['id'],'type':_0x47835a[_0x10f5('0x26')],'sectionId':_0x47835a['id']},{})['then'](function(){return _0x460495;});}else{return _0x460495;}})[_0x10f5('0x44')](function(_0x5a5a17){logger[_0x10f5('0x25')](_0x10f5('0x4e'),_0x5a5a17);throw _0x5a5a17;});}return _0x460495;})[_0x10f5('0x21')](respondWithResult(_0x1b26f5,0xc9))[_0x10f5('0x44')](handleError(_0x1b26f5,null));};exports[_0x10f5('0x20')]=function(_0x246d57,_0x4c3bfe){if(_0x246d57[_0x10f5('0x46')]['id']){delete _0x246d57[_0x10f5('0x46')]['id'];}return db[_0x10f5('0x3b')][_0x10f5('0x43')]({'where':{'id':_0x246d57[_0x10f5('0x41')]['id']}})[_0x10f5('0x21')](handleEntityNotFound(_0x4c3bfe,null))['then'](saveUpdates(_0x246d57[_0x10f5('0x46')],null))[_0x10f5('0x21')](respondWithResult(_0x4c3bfe,null))[_0x10f5('0x44')](handleError(_0x4c3bfe,null));};exports[_0x10f5('0x22')]=function(_0x21413f,_0x451717){return db['Template']['find']({'where':{'id':_0x21413f[_0x10f5('0x41')]['id']}})[_0x10f5('0x21')](handleEntityNotFound(_0x451717,null))['then'](removeEntity(_0x451717,null))[_0x10f5('0x44')](handleError(_0x451717,null));}; \ No newline at end of file +var _0x8370=['update','params','rimraf','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','then','get','UserProfileResource','destroy','name','send','index','Template','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','fields','find','body','user','Templates','userProfileId','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x547f53,_0x1794e6){var _0x1e94b6=function(_0x2e256b){while(--_0x2e256b){_0x547f53['push'](_0x547f53['shift']());}};_0x1e94b6(++_0x1794e6);}(_0x8370,0x1ca));var _0x0837=function(_0x2583fc,_0x5c906e){_0x2583fc=_0x2583fc-0x0;var _0x1202ce=_0x8370[_0x2583fc];return _0x1202ce;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0837('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0837('0x1'));var rp=require(_0x0837('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0837('0x3'));var util=require(_0x0837('0x4'));var path=require(_0x0837('0x5'));var sox=require('sox');var csv=require(_0x0837('0x6'));var ejs=require(_0x0837('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0837('0x8'));var squel=require(_0x0837('0x9'));var crypto=require(_0x0837('0xa'));var jsforce=require(_0x0837('0xb'));var deskjs=require(_0x0837('0xc'));var toCsv=require(_0x0837('0x6'));var querystring=require(_0x0837('0xd'));var Papa=require(_0x0837('0xe'));var Redis=require('ioredis');var authService=require(_0x0837('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0837('0x10'))(_0x0837('0x11'));var utils=require(_0x0837('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x0837('0x13'));var db=require(_0x0837('0x14'))['db'];function respondWithStatusCode(_0x561e27,_0x4e81b5){_0x4e81b5=_0x4e81b5||0xcc;return function(_0x3d4b51){if(_0x3d4b51){return _0x561e27['sendStatus'](_0x4e81b5);}return _0x561e27[_0x0837('0x15')](_0x4e81b5)[_0x0837('0x16')]();};}function respondWithResult(_0x14fca8,_0x59dce9){_0x59dce9=_0x59dce9||0xc8;return function(_0x5cc335){if(_0x5cc335){return _0x14fca8[_0x0837('0x15')](_0x59dce9)[_0x0837('0x17')](_0x5cc335);}};}function respondWithFilteredResult(_0x5e81e7,_0x249c6e){return function(_0x15bcaa){if(_0x15bcaa){var _0x24edeb=typeof _0x249c6e[_0x0837('0x18')]==='undefined'&&typeof _0x249c6e['limit']===_0x0837('0x19');var _0x3d2d8f=_0x15bcaa[_0x0837('0x1a')];var _0x33e81f=_0x24edeb?0x0:_0x249c6e[_0x0837('0x18')];var _0x8622b8=_0x24edeb?_0x15bcaa['count']:_0x249c6e[_0x0837('0x18')]+_0x249c6e[_0x0837('0x1b')];var _0x1b85dc;if(_0x8622b8>=_0x3d2d8f){_0x8622b8=_0x3d2d8f;_0x1b85dc=0xc8;}else{_0x1b85dc=0xce;}_0x5e81e7[_0x0837('0x15')](_0x1b85dc);return _0x5e81e7[_0x0837('0x1c')](_0x0837('0x1d'),_0x33e81f+'-'+_0x8622b8+'/'+_0x3d2d8f)['json'](_0x15bcaa);}return null;};}function patchUpdates(_0x2a336b){return function(_0x3c42b8){try{jsonpatch[_0x0837('0x1e')](_0x3c42b8,_0x2a336b,!![]);}catch(_0x2fef39){return BPromise[_0x0837('0x1f')](_0x2fef39);}return _0x3c42b8['save']();};}function saveUpdates(_0x4d6416,_0x1cb475){return function(_0x13b9f8){if(_0x13b9f8){return _0x13b9f8['update'](_0x4d6416)[_0x0837('0x20')](function(_0xde409c){return _0xde409c;});}return null;};}function removeEntity(_0x224eb7,_0x1948e8){return function(_0x1a1014){if(_0x1a1014){return _0x1a1014['destroy']()[_0x0837('0x20')](function(){var _0x26901a=_0x1a1014[_0x0837('0x21')]({'plain':!![]});var _0x32fe79='Templates';return db[_0x0837('0x22')][_0x0837('0x23')]({'where':{'type':_0x32fe79,'resourceId':_0x26901a['id']}})[_0x0837('0x20')](function(){return _0x1a1014;});})['then'](function(){_0x224eb7[_0x0837('0x15')](0xcc)[_0x0837('0x16')]();});}};}function handleEntityNotFound(_0x1f4167,_0x754d09){return function(_0x24dd27){if(!_0x24dd27){_0x1f4167['sendStatus'](0x194);}return _0x24dd27;};}function handleError(_0x1b5893,_0x2defb0){_0x2defb0=_0x2defb0||0x1f4;return function(_0x96afb){logger['error'](_0x96afb['stack']);if(_0x96afb[_0x0837('0x24')]){delete _0x96afb['name'];}_0x1b5893[_0x0837('0x15')](_0x2defb0)[_0x0837('0x25')](_0x96afb);};}exports[_0x0837('0x26')]=function(_0x64d04f,_0x51110a){var _0x42be7d={},_0x152337={},_0x193f2d={'count':0x0,'rows':[]};var _0x4daf46=_['map'](db[_0x0837('0x27')][_0x0837('0x28')],function(_0x3b931f){return{'name':_0x3b931f[_0x0837('0x29')],'type':_0x3b931f[_0x0837('0x2a')][_0x0837('0x2b')]};});_0x152337[_0x0837('0x2c')]=_[_0x0837('0x2d')](_0x4daf46,_0x0837('0x24'));_0x152337[_0x0837('0x2e')]=_['keys'](_0x64d04f['query']);_0x152337[_0x0837('0x2f')]=_[_0x0837('0x30')](_0x152337[_0x0837('0x2c')],_0x152337[_0x0837('0x2e')]);_0x42be7d[_0x0837('0x31')]=_[_0x0837('0x30')](_0x152337[_0x0837('0x2c')],qs['fields'](_0x64d04f[_0x0837('0x2e')]['fields']));_0x42be7d[_0x0837('0x31')]=_0x42be7d[_0x0837('0x31')][_0x0837('0x32')]?_0x42be7d[_0x0837('0x31')]:_0x152337[_0x0837('0x2c')];if(!_0x64d04f[_0x0837('0x2e')][_0x0837('0x33')](_0x0837('0x34'))){_0x42be7d['limit']=qs['limit'](_0x64d04f[_0x0837('0x2e')][_0x0837('0x1b')]);_0x42be7d['offset']=qs[_0x0837('0x18')](_0x64d04f[_0x0837('0x2e')][_0x0837('0x18')]);}_0x42be7d[_0x0837('0x35')]=qs['sort'](_0x64d04f[_0x0837('0x2e')][_0x0837('0x36')]);_0x42be7d[_0x0837('0x37')]=qs[_0x0837('0x2f')](_[_0x0837('0x38')](_0x64d04f['query'],_0x152337['filters']),_0x4daf46);if(_0x64d04f[_0x0837('0x2e')][_0x0837('0x39')]){_0x42be7d[_0x0837('0x37')]=_[_0x0837('0x3a')](_0x42be7d[_0x0837('0x37')],{'$or':_['map'](_0x4daf46,function(_0x13afd7){if(_0x13afd7[_0x0837('0x2a')]!=='VIRTUAL'){var _0x175c75={};_0x175c75[_0x13afd7[_0x0837('0x24')]]={'$like':'%'+_0x64d04f[_0x0837('0x2e')][_0x0837('0x39')]+'%'};return _0x175c75;}})});}_0x42be7d=_[_0x0837('0x3a')]({},_0x42be7d,_0x64d04f[_0x0837('0x3b')]);var _0x3b1687={'where':_0x42be7d['where']};return db['Template'][_0x0837('0x1a')](_0x3b1687)[_0x0837('0x20')](function(_0x21b341){_0x193f2d['count']=_0x21b341;if(_0x64d04f[_0x0837('0x2e')][_0x0837('0x3c')]){_0x42be7d[_0x0837('0x3d')]=[{'all':!![]}];}return db[_0x0837('0x27')][_0x0837('0x3e')](_0x42be7d);})[_0x0837('0x20')](function(_0x2a619d){_0x193f2d['rows']=_0x2a619d;return _0x193f2d;})[_0x0837('0x20')](respondWithFilteredResult(_0x51110a,_0x42be7d))[_0x0837('0x3f')](handleError(_0x51110a,null));};exports['show']=function(_0xa5beb3,_0x2ab971){var _0x410902={'raw':!![],'where':{'id':_0xa5beb3['params']['id']}},_0x1b6f16={};_0x1b6f16['model']=_['keys'](db['Template']['rawAttributes']);_0x1b6f16['query']=_['keys'](_0xa5beb3['query']);_0x1b6f16[_0x0837('0x2f')]=_[_0x0837('0x30')](_0x1b6f16[_0x0837('0x2c')],_0x1b6f16[_0x0837('0x2e')]);_0x410902[_0x0837('0x31')]=_['intersection'](_0x1b6f16[_0x0837('0x2c')],qs[_0x0837('0x40')](_0xa5beb3[_0x0837('0x2e')][_0x0837('0x40')]));_0x410902[_0x0837('0x31')]=_0x410902['attributes'][_0x0837('0x32')]?_0x410902[_0x0837('0x31')]:_0x1b6f16[_0x0837('0x2c')];if(_0xa5beb3['query'][_0x0837('0x3c')]){_0x410902[_0x0837('0x3d')]=[{'all':!![]}];}_0x410902=_[_0x0837('0x3a')]({},_0x410902,_0xa5beb3['options']);return db[_0x0837('0x27')][_0x0837('0x41')](_0x410902)[_0x0837('0x20')](handleEntityNotFound(_0x2ab971,null))[_0x0837('0x20')](respondWithResult(_0x2ab971,null))[_0x0837('0x3f')](handleError(_0x2ab971,null));};exports['create']=function(_0x3b7428,_0x111fa6){return db[_0x0837('0x27')]['create'](_0x3b7428[_0x0837('0x42')],{})[_0x0837('0x20')](function(_0x533595){var _0x569f5d=_0x3b7428[_0x0837('0x43')][_0x0837('0x21')]({'plain':!![]});if(!_0x569f5d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x569f5d['role']==='user'){var _0x4e17bc=_0x533595[_0x0837('0x21')]({'plain':!![]});var _0x52e1ab=_0x0837('0x44');return db['UserProfileSection'][_0x0837('0x41')]({'where':{'name':_0x52e1ab,'userProfileId':_0x569f5d[_0x0837('0x45')]},'raw':!![]})[_0x0837('0x20')](function(_0x30b6b4){if(_0x30b6b4&&_0x30b6b4[_0x0837('0x46')]===0x0){return db['UserProfileResource'][_0x0837('0x47')]({'name':_0x4e17bc[_0x0837('0x24')],'resourceId':_0x4e17bc['id'],'type':_0x30b6b4[_0x0837('0x24')],'sectionId':_0x30b6b4['id']},{})['then'](function(){return _0x533595;});}else{return _0x533595;}})[_0x0837('0x3f')](function(_0x4110b4){logger[_0x0837('0x48')](_0x0837('0x49'),_0x4110b4);throw _0x4110b4;});}return _0x533595;})['then'](respondWithResult(_0x111fa6,0xc9))[_0x0837('0x3f')](handleError(_0x111fa6,null));};exports[_0x0837('0x4a')]=function(_0x2ce030,_0x26a9df){if(_0x2ce030[_0x0837('0x42')]['id']){delete _0x2ce030['body']['id'];}return db[_0x0837('0x27')][_0x0837('0x41')]({'where':{'id':_0x2ce030['params']['id']}})['then'](handleEntityNotFound(_0x26a9df,null))[_0x0837('0x20')](saveUpdates(_0x2ce030[_0x0837('0x42')],null))['then'](respondWithResult(_0x26a9df,null))[_0x0837('0x3f')](handleError(_0x26a9df,null));};exports['destroy']=function(_0x50d719,_0x2fb97e){return db[_0x0837('0x27')][_0x0837('0x41')]({'where':{'id':_0x50d719[_0x0837('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2fb97e,null))[_0x0837('0x20')](removeEntity(_0x2fb97e,null))[_0x0837('0x3f')](handleError(_0x2fb97e,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 3a2a484..0285b74 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 _0x9639=['path','../../config/environment','./template.attributes','exports','Template','tools_templates','lodash','../../config/logger','api','moment','request-promise'];(function(_0x46df63,_0x5cbc34){var _0x236616=function(_0x3281ba){while(--_0x3281ba){_0x46df63['push'](_0x46df63['shift']());}};_0x236616(++_0x5cbc34);}(_0x9639,0x187));var _0x9963=function(_0x3bbcbd,_0x18366c){_0x3bbcbd=_0x3bbcbd-0x0;var _0x4a5514=_0x9639[_0x3bbcbd];return _0x4a5514;};'use strict';var _=require(_0x9963('0x0'));var util=require('util');var logger=require(_0x9963('0x1'))(_0x9963('0x2'));var moment=require(_0x9963('0x3'));var BPromise=require('bluebird');var rp=require(_0x9963('0x4'));var fs=require('fs');var path=require(_0x9963('0x5'));var rimraf=require('rimraf');var config=require(_0x9963('0x6'));var attributes=require(_0x9963('0x7'));module[_0x9963('0x8')]=function(_0xf7f5c4,_0x73b913){return _0xf7f5c4['define'](_0x9963('0x9'),attributes,{'tableName':_0x9963('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaece=['../../config/environment','exports','define','Template','tools_templates','lodash','util','api','path','rimraf'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xaece,0x7d));var _0xeaec=function(_0x32ca48,_0x3417de){_0x32ca48=_0x32ca48-0x0;var _0x8d6415=_0xaece[_0x32ca48];return _0x8d6415;};'use strict';var _=require(_0xeaec('0x0'));var util=require(_0xeaec('0x1'));var logger=require('../../config/logger')(_0xeaec('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeaec('0x3'));var rimraf=require(_0xeaec('0x4'));var config=require(_0xeaec('0x5'));var attributes=require('./template.attributes');module[_0xeaec('0x6')]=function(_0x51a77d,_0x1543c7){return _0x51a77d[_0xeaec('0x7')](_0xeaec('0x8'),attributes,{'tableName':_0xeaec('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index fe69be3..18a57be 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 _0x7462=['raw','where','attributes','include','model','info','lodash','util','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','Template,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetTemplate','findAll','options'];(function(_0x1c11d2,_0x3cddd1){var _0xb1fc58=function(_0x5b3f24){while(--_0x5b3f24){_0x1c11d2['push'](_0x1c11d2['shift']());}};_0xb1fc58(++_0x3cddd1);}(_0x7462,0x165));var _0x2746=function(_0x421725,_0x318a04){_0x421725=_0x421725-0x0;var _0x51b322=_0x7462[_0x421725];return _0x51b322;};'use strict';var _=require(_0x2746('0x0'));var util=require(_0x2746('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2746('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2746('0x3'));var logger=require(_0x2746('0x4'))('rpc');var config=require(_0x2746('0x5'));var jayson=require(_0x2746('0x6'));var client=jayson[_0x2746('0x7')][_0x2746('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2a2f42,_0x2940d8,_0x1447bc){return new BPromise(function(_0x40ad2b,_0x283327){return client['request'](_0x2a2f42,_0x1447bc)[_0x2746('0x9')](function(_0x2e4713){logger['info'](_0x2746('0xa'),_0x2940d8,_0x2746('0xb'));logger[_0x2746('0xc')]('Template,\x20%s,\x20%s,\x20%s',_0x2940d8,_0x2746('0xb'),JSON[_0x2746('0xd')](_0x2e4713));if(_0x2e4713[_0x2746('0xe')]){if(_0x2e4713[_0x2746('0xe')][_0x2746('0xf')]===0x1f4){logger[_0x2746('0xe')](_0x2746('0xa'),_0x2940d8,_0x2e4713[_0x2746('0xe')][_0x2746('0x10')]);return _0x283327(_0x2e4713[_0x2746('0xe')][_0x2746('0x10')]);}logger['error']('Template,\x20%s,\x20%s',_0x2940d8,_0x2e4713[_0x2746('0xe')][_0x2746('0x10')]);return _0x40ad2b(_0x2e4713[_0x2746('0xe')][_0x2746('0x10')]);}else{logger['info'](_0x2746('0xa'),_0x2940d8,_0x2746('0xb'));_0x40ad2b(_0x2e4713['result']['message']);}})[_0x2746('0x11')](function(_0x43f06c){logger[_0x2746('0xe')](_0x2746('0xa'),_0x2940d8,_0x43f06c);_0x283327(_0x43f06c);});});}exports[_0x2746('0x12')]=function(_0x232108){var _0x3556b5=this;return new Promise(function(_0x6102f3,_0x25c122){return db['Template'][_0x2746('0x13')]({'raw':_0x232108['options']?_0x232108[_0x2746('0x14')][_0x2746('0x15')]===undefined?!![]:![]:!![],'where':_0x232108[_0x2746('0x14')]?_0x232108[_0x2746('0x14')][_0x2746('0x16')]||null:null,'attributes':_0x232108[_0x2746('0x14')]?_0x232108[_0x2746('0x14')][_0x2746('0x17')]||null:null,'limit':_0x232108[_0x2746('0x14')]?_0x232108['options']['limit']||null:null,'include':_0x232108[_0x2746('0x14')]?_0x232108[_0x2746('0x14')][_0x2746('0x18')]?_['map'](_0x232108[_0x2746('0x14')][_0x2746('0x18')],function(_0x55fe95){return{'model':db[_0x55fe95[_0x2746('0x19')]],'as':_0x55fe95['as'],'attributes':_0x55fe95['attributes'],'include':_0x55fe95['include']?_['map'](_0x55fe95['include'],function(_0xe5a485){return{'model':db[_0xe5a485[_0x2746('0x19')]],'as':_0xe5a485['as'],'attributes':_0xe5a485['attributes'],'include':_0xe5a485[_0x2746('0x18')]?_['map'](_0xe5a485[_0x2746('0x18')],function(_0x150cc8){return{'model':db[_0x150cc8[_0x2746('0x19')]],'as':_0x150cc8['as'],'attributes':_0x150cc8[_0x2746('0x17')]};}):[]};}):[]};}):[]:[]})[_0x2746('0x9')](function(_0x433526){logger[_0x2746('0x1a')](_0x2746('0x12'),_0x232108);logger['debug'](_0x2746('0x12'),_0x232108,JSON[_0x2746('0xd')](_0x433526));_0x6102f3(_0x433526);})['catch'](function(_0x5881dc){logger['error']('GetTemplate',_0x5881dc['message'],_0x232108);_0x25c122(_0x3556b5[_0x2746('0xe')](0x1f4,_0x5881dc[_0x2746('0x10')]));});});}; \ No newline at end of file +var _0xff83=['request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','Template,\x20%s,\x20%s','message','result','GetTemplate','Template','findAll','options','where','attributes','limit','include','model','map','info','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','then'];(function(_0xb417b5,_0x1abab0){var _0x330211=function(_0x27e4ee){while(--_0x27e4ee){_0xb417b5['push'](_0xb417b5['shift']());}};_0x330211(++_0x1abab0);}(_0xff83,0xee));var _0x3ff8=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xff83[_0x373dee];return _0x46798f;};'use strict';var _=require('lodash');var util=require(_0x3ff8('0x0'));var moment=require(_0x3ff8('0x1'));var BPromise=require('bluebird');var rs=require(_0x3ff8('0x2'));var fs=require('fs');var Redis=require(_0x3ff8('0x3'));var db=require(_0x3ff8('0x4'))['db'];var utils=require(_0x3ff8('0x5'));var logger=require('../../config/logger')(_0x3ff8('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3ff8('0x7')][_0x3ff8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3fa008,_0x3eb04c,_0x380507){return new BPromise(function(_0x1027ca,_0x20973c){return client['request'](_0x3fa008,_0x380507)[_0x3ff8('0x9')](function(_0x33e0fd){logger['info']('Template,\x20%s,\x20%s',_0x3eb04c,_0x3ff8('0xa'));logger[_0x3ff8('0xb')](_0x3ff8('0xc'),_0x3eb04c,_0x3ff8('0xa'),JSON[_0x3ff8('0xd')](_0x33e0fd));if(_0x33e0fd[_0x3ff8('0xe')]){if(_0x33e0fd['error'][_0x3ff8('0xf')]===0x1f4){logger['error'](_0x3ff8('0x10'),_0x3eb04c,_0x33e0fd[_0x3ff8('0xe')][_0x3ff8('0x11')]);return _0x20973c(_0x33e0fd['error'][_0x3ff8('0x11')]);}logger['error'](_0x3ff8('0x10'),_0x3eb04c,_0x33e0fd[_0x3ff8('0xe')][_0x3ff8('0x11')]);return _0x1027ca(_0x33e0fd[_0x3ff8('0xe')]['message']);}else{logger['info'](_0x3ff8('0x10'),_0x3eb04c,_0x3ff8('0xa'));_0x1027ca(_0x33e0fd[_0x3ff8('0x12')]['message']);}})['catch'](function(_0x1e0a08){logger[_0x3ff8('0xe')]('Template,\x20%s,\x20%s',_0x3eb04c,_0x1e0a08);_0x20973c(_0x1e0a08);});});}exports[_0x3ff8('0x13')]=function(_0x25be45){var _0x2b3449=this;return new Promise(function(_0xebadbf,_0x361ea2){return db[_0x3ff8('0x14')][_0x3ff8('0x15')]({'raw':_0x25be45['options']?_0x25be45[_0x3ff8('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x25be45[_0x3ff8('0x16')]?_0x25be45[_0x3ff8('0x16')][_0x3ff8('0x17')]||null:null,'attributes':_0x25be45[_0x3ff8('0x16')]?_0x25be45[_0x3ff8('0x16')][_0x3ff8('0x18')]||null:null,'limit':_0x25be45[_0x3ff8('0x16')]?_0x25be45[_0x3ff8('0x16')][_0x3ff8('0x19')]||null:null,'include':_0x25be45[_0x3ff8('0x16')]?_0x25be45[_0x3ff8('0x16')][_0x3ff8('0x1a')]?_['map'](_0x25be45['options'][_0x3ff8('0x1a')],function(_0x454a5c){return{'model':db[_0x454a5c[_0x3ff8('0x1b')]],'as':_0x454a5c['as'],'attributes':_0x454a5c['attributes'],'include':_0x454a5c[_0x3ff8('0x1a')]?_[_0x3ff8('0x1c')](_0x454a5c[_0x3ff8('0x1a')],function(_0x1ebf2c){return{'model':db[_0x1ebf2c[_0x3ff8('0x1b')]],'as':_0x1ebf2c['as'],'attributes':_0x1ebf2c[_0x3ff8('0x18')],'include':_0x1ebf2c[_0x3ff8('0x1a')]?_[_0x3ff8('0x1c')](_0x1ebf2c[_0x3ff8('0x1a')],function(_0x5ecd84){return{'model':db[_0x5ecd84[_0x3ff8('0x1b')]],'as':_0x5ecd84['as'],'attributes':_0x5ecd84[_0x3ff8('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3ff8('0x9')](function(_0x22dfce){logger[_0x3ff8('0x1d')]('GetTemplate',_0x25be45);logger[_0x3ff8('0xb')](_0x3ff8('0x13'),_0x25be45,JSON[_0x3ff8('0xd')](_0x22dfce));_0xebadbf(_0x22dfce);})[_0x3ff8('0x1e')](function(_0x4cc030){logger['error'](_0x3ff8('0x13'),_0x4cc030[_0x3ff8('0x11')],_0x25be45);_0x361ea2(_0x2b3449[_0x3ff8('0xe')](0x1f4,_0x4cc030['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 1ab57e0..35737a0 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 _0x8234=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./trigger.controller','isAuthenticated','get','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','/:id/actions','getActions','create','post','addAllCondition','addAnyCondition','addAction','update','delete','destroy'];(function(_0x261335,_0x120afb){var _0xa257eb=function(_0x5cce88){while(--_0x5cce88){_0x261335['push'](_0x261335['shift']());}};_0xa257eb(++_0x120afb);}(_0x8234,0x1cb));var _0x4823=function(_0x474241,_0xaa4c69){_0x474241=_0x474241-0x0;var _0x510a20=_0x8234[_0x474241];return _0x510a20;};'use strict';var multer=require(_0x4823('0x0'));var util=require(_0x4823('0x1'));var path=require(_0x4823('0x2'));var timeout=require(_0x4823('0x3'));var express=require(_0x4823('0x4'));var router=express[_0x4823('0x5')]();var fs_extra=require(_0x4823('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4823('0x7'));var config=require(_0x4823('0x8'));var controller=require(_0x4823('0x9'));router['get']('/',auth[_0x4823('0xa')](),controller['index']);router[_0x4823('0xb')](_0x4823('0xc'),auth['isAuthenticated'](),controller[_0x4823('0xd')]);router['get'](_0x4823('0xe'),auth[_0x4823('0xa')](),controller[_0x4823('0xf')]);router[_0x4823('0xb')](_0x4823('0x10'),auth[_0x4823('0xa')](),controller['getAnyConditions']);router[_0x4823('0xb')](_0x4823('0x11'),auth[_0x4823('0xa')](),controller[_0x4823('0x12')]);router['post']('/',auth[_0x4823('0xa')](),controller[_0x4823('0x13')]);router[_0x4823('0x14')](_0x4823('0xe'),auth['isAuthenticated'](),controller[_0x4823('0x15')]);router[_0x4823('0x14')](_0x4823('0x10'),auth['isAuthenticated'](),controller[_0x4823('0x16')]);router['post'](_0x4823('0x11'),auth['isAuthenticated'](),controller[_0x4823('0x17')]);router['put']('/:id',auth[_0x4823('0xa')](),controller[_0x4823('0x18')]);router[_0x4823('0x19')](_0x4823('0xc'),auth[_0x4823('0xa')](),controller[_0x4823('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x805a=['/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','addAction','put','update','delete','destroy','exports','path','express','fs-extra','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index'];(function(_0x27973c,_0x2d8b16){var _0x2ef123=function(_0x557ebb){while(--_0x557ebb){_0x27973c['push'](_0x27973c['shift']());}};_0x2ef123(++_0x2d8b16);}(_0x805a,0xad));var _0xa805=function(_0xc28702,_0x145b87){_0xc28702=_0xc28702-0x0;var _0x3b6e9e=_0x805a[_0xc28702];return _0x3b6e9e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa805('0x0'));var timeout=require('connect-timeout');var express=require(_0xa805('0x1'));var router=express['Router']();var fs_extra=require(_0xa805('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xa805('0x3'));var config=require(_0xa805('0x4'));var controller=require(_0xa805('0x5'));router[_0xa805('0x6')]('/',auth[_0xa805('0x7')](),controller[_0xa805('0x8')]);router['get'](_0xa805('0x9'),auth[_0xa805('0x7')](),controller[_0xa805('0xa')]);router[_0xa805('0x6')](_0xa805('0xb'),auth[_0xa805('0x7')](),controller[_0xa805('0xc')]);router[_0xa805('0x6')](_0xa805('0xd'),auth[_0xa805('0x7')](),controller[_0xa805('0xe')]);router[_0xa805('0x6')](_0xa805('0xf'),auth[_0xa805('0x7')](),controller[_0xa805('0x10')]);router[_0xa805('0x11')]('/',auth[_0xa805('0x7')](),controller[_0xa805('0x12')]);router[_0xa805('0x11')](_0xa805('0xb'),auth[_0xa805('0x7')](),controller[_0xa805('0x13')]);router[_0xa805('0x11')]('/:id/any_conditions',auth[_0xa805('0x7')](),controller['addAnyCondition']);router[_0xa805('0x11')](_0xa805('0xf'),auth[_0xa805('0x7')](),controller[_0xa805('0x14')]);router[_0xa805('0x15')]('/:id',auth[_0xa805('0x7')](),controller[_0xa805('0x16')]);router[_0xa805('0x17')](_0xa805('0x9'),auth['isAuthenticated'](),controller[_0xa805('0x18')]);module[_0xa805('0x19')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index ecb3ff0..3b8cbe9 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 _0x8972=['exports','STRING','BOOLEAN','sequelize'];(function(_0xe114ac,_0x4913f0){var _0x3e3b84=function(_0x121b58){while(--_0x121b58){_0xe114ac['push'](_0xe114ac['shift']());}};_0x3e3b84(++_0x4913f0);}(_0x8972,0x1df));var _0x2897=function(_0x222244,_0x56eaf0){_0x222244=_0x222244-0x0;var _0x532668=_0x8972[_0x222244];return _0x532668;};'use strict';var Sequelize=require(_0x2897('0x0'));module[_0x2897('0x1')]={'name':{'type':Sequelize[_0x2897('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2897('0x2')]},'status':{'type':Sequelize[_0x2897('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xf8cc=['sequelize','exports','STRING','BOOLEAN'];(function(_0x40ab1c,_0x2ac5c5){var _0x28acce=function(_0x43c73d){while(--_0x43c73d){_0x40ab1c['push'](_0x40ab1c['shift']());}};_0x28acce(++_0x2ac5c5);}(_0xf8cc,0x1e4));var _0xcf8c=function(_0x492b3d,_0x16b26d){_0x492b3d=_0x492b3d-0x0;var _0x25c10c=_0xf8cc[_0x492b3d];return _0x25c10c;};'use strict';var Sequelize=require(_0xcf8c('0x0'));module[_0xcf8c('0x1')]={'name':{'type':Sequelize[_0xcf8c('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xcf8c('0x2')]},'status':{'type':Sequelize[_0xcf8c('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index e63502f..f42a830 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 _0x1578=['apply','save','update','then','destroy','get','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','create','addAllCondition','TriggerAllId','Condition','TriggerAnyId','findOne','pick','options','getAllConditions','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x1578,0x9c));var _0x8157=function(_0x3861ed,_0x194e94){_0x3861ed=_0x3861ed-0x0;var _0x524099=_0x1578[_0x3861ed];return _0x524099;};'use strict';var emlformat=require(_0x8157('0x0'));var rimraf=require(_0x8157('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8157('0x2'));var moment=require(_0x8157('0x3'));var BPromise=require(_0x8157('0x4'));var Mustache=require(_0x8157('0x5'));var util=require('util');var path=require(_0x8157('0x6'));var sox=require(_0x8157('0x7'));var csv=require(_0x8157('0x8'));var ejs=require(_0x8157('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8157('0xa'));var crypto=require(_0x8157('0xb'));var jsforce=require(_0x8157('0xc'));var deskjs=require(_0x8157('0xd'));var toCsv=require(_0x8157('0x8'));var querystring=require('querystring');var Papa=require(_0x8157('0xe'));var Redis=require(_0x8157('0xf'));var authService=require(_0x8157('0x10'));var qs=require(_0x8157('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8157('0x12'));var logger=require(_0x8157('0x13'))(_0x8157('0x14'));var utils=require(_0x8157('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x8157('0x16'));var db=require(_0x8157('0x17'))['db'];function respondWithStatusCode(_0xafbf38,_0x5302b5){_0x5302b5=_0x5302b5||0xcc;return function(_0x3dc505){if(_0x3dc505){return _0xafbf38['sendStatus'](_0x5302b5);}return _0xafbf38[_0x8157('0x18')](_0x5302b5)['end']();};}function respondWithResult(_0x54c6cb,_0x1bba9e){_0x1bba9e=_0x1bba9e||0xc8;return function(_0x45f4a8){if(_0x45f4a8){return _0x54c6cb[_0x8157('0x18')](_0x1bba9e)[_0x8157('0x19')](_0x45f4a8);}};}function respondWithFilteredResult(_0x5d9d5c,_0x404457){return function(_0x2484a8){if(_0x2484a8){var _0x234550=typeof _0x404457[_0x8157('0x1a')]===_0x8157('0x1b')&&typeof _0x404457[_0x8157('0x1c')]===_0x8157('0x1b');var _0x2778ef=_0x2484a8[_0x8157('0x1d')];var _0x1fb13e=_0x234550?0x0:_0x404457[_0x8157('0x1a')];var _0x109033=_0x234550?_0x2484a8[_0x8157('0x1d')]:_0x404457[_0x8157('0x1a')]+_0x404457[_0x8157('0x1c')];var _0x403952;if(_0x109033>=_0x2778ef){_0x109033=_0x2778ef;_0x403952=0xc8;}else{_0x403952=0xce;}_0x5d9d5c[_0x8157('0x18')](_0x403952);return _0x5d9d5c[_0x8157('0x1e')](_0x8157('0x1f'),_0x1fb13e+'-'+_0x109033+'/'+_0x2778ef)[_0x8157('0x19')](_0x2484a8);}return null;};}function patchUpdates(_0x4fb7e1){return function(_0x13c9b5){try{jsonpatch[_0x8157('0x20')](_0x13c9b5,_0x4fb7e1,!![]);}catch(_0x2c26e7){return BPromise['reject'](_0x2c26e7);}return _0x13c9b5[_0x8157('0x21')]();};}function saveUpdates(_0x498080,_0x430b40){return function(_0x5da30a){if(_0x5da30a){return _0x5da30a[_0x8157('0x22')](_0x498080)[_0x8157('0x23')](function(_0x1505cc){return _0x1505cc;});}return null;};}function removeEntity(_0x1c58f1,_0x4b778e){return function(_0x31a01e){if(_0x31a01e){return _0x31a01e[_0x8157('0x24')]()[_0x8157('0x23')](function(){var _0xfba24b=_0x31a01e[_0x8157('0x25')]({'plain':!![]});var _0x37e170='Triggers';return db[_0x8157('0x26')][_0x8157('0x24')]({'where':{'type':_0x37e170,'resourceId':_0xfba24b['id']}})[_0x8157('0x23')](function(){return _0x31a01e;});})[_0x8157('0x23')](function(){_0x1c58f1[_0x8157('0x18')](0xcc)[_0x8157('0x27')]();});}};}function handleEntityNotFound(_0xb29ac9,_0x3d94a0){return function(_0x47e710){if(!_0x47e710){_0xb29ac9[_0x8157('0x28')](0x194);}return _0x47e710;};}function handleError(_0x2bd879,_0x309142){_0x309142=_0x309142||0x1f4;return function(_0x2330e4){logger[_0x8157('0x29')](_0x2330e4[_0x8157('0x2a')]);if(_0x2330e4[_0x8157('0x2b')]){delete _0x2330e4[_0x8157('0x2b')];}_0x2bd879[_0x8157('0x18')](_0x309142)[_0x8157('0x2c')](_0x2330e4);};}exports[_0x8157('0x2d')]=function(_0x17005f,_0x154d94){var _0x341891={},_0x59605d={},_0x34d8df={'count':0x0,'rows':[]};var _0x454946=_[_0x8157('0x2e')](db[_0x8157('0x2f')][_0x8157('0x30')],function(_0x5830bf){return{'name':_0x5830bf[_0x8157('0x31')],'type':_0x5830bf[_0x8157('0x32')][_0x8157('0x33')]};});_0x59605d[_0x8157('0x34')]=_['map'](_0x454946,_0x8157('0x2b'));_0x59605d[_0x8157('0x35')]=_[_0x8157('0x36')](_0x17005f[_0x8157('0x35')]);_0x59605d[_0x8157('0x37')]=_[_0x8157('0x38')](_0x59605d[_0x8157('0x34')],_0x59605d[_0x8157('0x35')]);_0x341891['attributes']=_[_0x8157('0x38')](_0x59605d[_0x8157('0x34')],qs[_0x8157('0x39')](_0x17005f['query'][_0x8157('0x39')]));_0x341891[_0x8157('0x3a')]=_0x341891['attributes'][_0x8157('0x3b')]?_0x341891['attributes']:_0x59605d['model'];if(!_0x17005f[_0x8157('0x35')][_0x8157('0x3c')](_0x8157('0x3d'))){_0x341891['limit']=qs[_0x8157('0x1c')](_0x17005f[_0x8157('0x35')][_0x8157('0x1c')]);_0x341891[_0x8157('0x1a')]=qs[_0x8157('0x1a')](_0x17005f[_0x8157('0x35')][_0x8157('0x1a')]);}_0x341891[_0x8157('0x3e')]=qs[_0x8157('0x3f')](_0x17005f[_0x8157('0x35')][_0x8157('0x3f')]);_0x341891[_0x8157('0x40')]=qs['filters'](_['pick'](_0x17005f[_0x8157('0x35')],_0x59605d['filters']),_0x454946);if(_0x17005f[_0x8157('0x35')][_0x8157('0x41')]){_0x341891['where']=_[_0x8157('0x42')](_0x341891[_0x8157('0x40')],{'$or':_[_0x8157('0x2e')](_0x454946,function(_0x5c4bcc){if(_0x5c4bcc[_0x8157('0x32')]!==_0x8157('0x43')){var _0x9c6e6d={};_0x9c6e6d[_0x5c4bcc[_0x8157('0x2b')]]={'$like':'%'+_0x17005f['query'][_0x8157('0x41')]+'%'};return _0x9c6e6d;}})});}_0x341891=_[_0x8157('0x42')]({},_0x341891,_0x17005f['options']);var _0x5a44e8={'where':_0x341891['where']};return db[_0x8157('0x2f')]['count'](_0x5a44e8)['then'](function(_0x2a56cf){_0x34d8df['count']=_0x2a56cf;if(_0x17005f['query'][_0x8157('0x44')]){_0x341891[_0x8157('0x45')]=[{'all':!![]}];}return db[_0x8157('0x2f')][_0x8157('0x46')](_0x341891);})[_0x8157('0x23')](function(_0x535312){_0x34d8df[_0x8157('0x47')]=_0x535312;return _0x34d8df;})[_0x8157('0x23')](respondWithFilteredResult(_0x154d94,_0x341891))[_0x8157('0x48')](handleError(_0x154d94,null));};exports[_0x8157('0x49')]=function(_0x3aeb15,_0x4602c5){var _0x33cfe5={'raw':![],'where':{'id':_0x3aeb15[_0x8157('0x4a')]['id']}},_0x35fa08={};_0x35fa08[_0x8157('0x34')]=_[_0x8157('0x36')](db[_0x8157('0x2f')]['rawAttributes']);_0x35fa08['query']=_[_0x8157('0x36')](_0x3aeb15['query']);_0x35fa08[_0x8157('0x37')]=_[_0x8157('0x38')](_0x35fa08['model'],_0x35fa08[_0x8157('0x35')]);_0x33cfe5['attributes']=_[_0x8157('0x38')](_0x35fa08[_0x8157('0x34')],qs[_0x8157('0x39')](_0x3aeb15['query'][_0x8157('0x39')]));_0x33cfe5[_0x8157('0x3a')]=_0x33cfe5[_0x8157('0x3a')]['length']?_0x33cfe5[_0x8157('0x3a')]:_0x35fa08[_0x8157('0x34')];if(_0x3aeb15[_0x8157('0x35')][_0x8157('0x44')]){_0x33cfe5['include']=[{'all':!![]}];}_0x33cfe5=_[_0x8157('0x42')]({},_0x33cfe5,_0x3aeb15['options']);return db[_0x8157('0x2f')][_0x8157('0x4b')](_0x33cfe5)[_0x8157('0x23')](handleEntityNotFound(_0x4602c5,null))[_0x8157('0x23')](respondWithResult(_0x4602c5,null))[_0x8157('0x48')](handleError(_0x4602c5,null));};exports['create']=function(_0x488942,_0x22fcfd){return db[_0x8157('0x2f')]['create'](_0x488942[_0x8157('0x4c')],{})['then'](function(_0x3b5b01){var _0x548829=_0x488942['user']['get']({'plain':!![]});if(!_0x548829)throw new Error(_0x8157('0x4d'));if(_0x548829[_0x8157('0x4e')]==='user'){var _0x5d2f2b=_0x3b5b01[_0x8157('0x25')]({'plain':!![]});var _0x2cda7f='Triggers';return db['UserProfileSection'][_0x8157('0x4b')]({'where':{'name':_0x2cda7f,'userProfileId':_0x548829[_0x8157('0x4f')]},'raw':!![]})['then'](function(_0x328796){if(_0x328796&&_0x328796['autoAssociation']===0x0){return db[_0x8157('0x26')][_0x8157('0x50')]({'name':_0x5d2f2b[_0x8157('0x2b')],'resourceId':_0x5d2f2b['id'],'type':_0x328796[_0x8157('0x2b')],'sectionId':_0x328796['id']},{})[_0x8157('0x23')](function(){return _0x3b5b01;});}else{return _0x3b5b01;}})['catch'](function(_0x44e3fe){logger[_0x8157('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x44e3fe);throw _0x44e3fe;});}return _0x3b5b01;})['then'](respondWithResult(_0x22fcfd,0xc9))['catch'](handleError(_0x22fcfd,null));};exports[_0x8157('0x22')]=function(_0x327193,_0x55298f){if(_0x327193[_0x8157('0x4c')]['id']){delete _0x327193[_0x8157('0x4c')]['id'];}return db[_0x8157('0x2f')][_0x8157('0x4b')]({'where':{'id':_0x327193[_0x8157('0x4a')]['id']}})[_0x8157('0x23')](handleEntityNotFound(_0x55298f,null))['then'](saveUpdates(_0x327193[_0x8157('0x4c')],null))[_0x8157('0x23')](respondWithResult(_0x55298f,null))[_0x8157('0x48')](handleError(_0x55298f,null));};exports[_0x8157('0x24')]=function(_0x1fd575,_0x44c958){return db[_0x8157('0x2f')][_0x8157('0x4b')]({'where':{'id':_0x1fd575['params']['id']}})[_0x8157('0x23')](handleEntityNotFound(_0x44c958,null))[_0x8157('0x23')](removeEntity(_0x44c958,null))[_0x8157('0x48')](handleError(_0x44c958,null));};exports[_0x8157('0x51')]=function(_0xa73205,_0x1ad52d,_0x233578){if(_0xa73205['body']['id']){delete _0xa73205[_0x8157('0x4c')]['id'];}return db[_0x8157('0x2f')][_0x8157('0x4b')]({'where':{'id':_0xa73205[_0x8157('0x4a')]['id']}})[_0x8157('0x23')](handleEntityNotFound(_0x1ad52d,null))[_0x8157('0x23')](function(_0x594080){if(_0x594080){_0xa73205[_0x8157('0x4c')][_0x8157('0x52')]=_0x594080['id'];return db[_0x8157('0x53')][_0x8157('0x50')](_0xa73205['body']);}})[_0x8157('0x23')](respondWithResult(_0x1ad52d,null))['catch'](handleError(_0x1ad52d,null));};exports['addAnyCondition']=function(_0x2e59e7,_0x2810d5,_0x420209){if(_0x2e59e7[_0x8157('0x4c')]['id']){delete _0x2e59e7['body']['id'];}return db[_0x8157('0x2f')][_0x8157('0x4b')]({'where':{'id':_0x2e59e7[_0x8157('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2810d5,null))[_0x8157('0x23')](function(_0x27a7ae){if(_0x27a7ae){_0x2e59e7[_0x8157('0x4c')][_0x8157('0x54')]=_0x27a7ae['id'];return db[_0x8157('0x53')][_0x8157('0x50')](_0x2e59e7[_0x8157('0x4c')]);}})[_0x8157('0x23')](respondWithResult(_0x2810d5,null))[_0x8157('0x48')](handleError(_0x2810d5,null));};exports['getAllConditions']=function(_0x46e4aa,_0x3e892e,_0xec15a0){var _0x19bdb7={};var _0x4ccf2d={};var _0x429a0d;var _0x316773;return db[_0x8157('0x2f')][_0x8157('0x55')]({'where':{'id':_0x46e4aa[_0x8157('0x4a')]['id']}})[_0x8157('0x23')](handleEntityNotFound(_0x3e892e,null))[_0x8157('0x23')](function(_0x30b0f3){if(_0x30b0f3){_0x429a0d=_0x30b0f3;_0x4ccf2d['model']=_['keys'](db[_0x8157('0x53')][_0x8157('0x30')]);_0x4ccf2d['query']=_[_0x8157('0x36')](_0x46e4aa[_0x8157('0x35')]);_0x4ccf2d[_0x8157('0x37')]=_[_0x8157('0x38')](_0x4ccf2d['model'],_0x4ccf2d[_0x8157('0x35')]);_0x19bdb7[_0x8157('0x3a')]=_[_0x8157('0x38')](_0x4ccf2d['model'],qs[_0x8157('0x39')](_0x46e4aa[_0x8157('0x35')]['fields']));_0x19bdb7['attributes']=_0x19bdb7[_0x8157('0x3a')][_0x8157('0x3b')]?_0x19bdb7[_0x8157('0x3a')]:_0x4ccf2d['model'];_0x19bdb7['order']=qs[_0x8157('0x3f')](_0x46e4aa['query'][_0x8157('0x3f')]);_0x19bdb7[_0x8157('0x40')]=qs[_0x8157('0x37')](_[_0x8157('0x56')](_0x46e4aa[_0x8157('0x35')],_0x4ccf2d[_0x8157('0x37')]));if(_0x46e4aa[_0x8157('0x35')][_0x8157('0x41')]){_0x19bdb7['where']=_[_0x8157('0x42')](_0x19bdb7[_0x8157('0x40')],{'$or':_['map'](_0x19bdb7[_0x8157('0x3a')],function(_0x2bd3e5){var _0x4bc594={};_0x4bc594[_0x2bd3e5]={'$like':'%'+_0x46e4aa['query']['filter']+'%'};return _0x4bc594;})});}_0x19bdb7=_['merge']({},_0x19bdb7,_0x46e4aa[_0x8157('0x57')]);return _0x429a0d[_0x8157('0x58')](_0x19bdb7);}})[_0x8157('0x23')](function(_0x16abea){if(_0x16abea){_0x316773=_0x16abea['length'];if(!_0x46e4aa[_0x8157('0x35')][_0x8157('0x3c')]('nolimit')){_0x19bdb7['limit']=qs['limit'](_0x46e4aa[_0x8157('0x35')][_0x8157('0x1c')]);_0x19bdb7[_0x8157('0x1a')]=qs[_0x8157('0x1a')](_0x46e4aa['query']['offset']);}return _0x429a0d[_0x8157('0x58')](_0x19bdb7);}})[_0x8157('0x23')](function(_0xfd76c3){if(_0xfd76c3){return _0xfd76c3?{'count':_0x316773,'rows':_0xfd76c3}:null;}})[_0x8157('0x23')](respondWithResult(_0x3e892e,null))[_0x8157('0x48')](handleError(_0x3e892e,null));};exports[_0x8157('0x59')]=function(_0x103955,_0x294a59,_0x1bf262){var _0x2e47a8={};var _0x315813={};var _0x4f51f8;var _0x3205c8;return db['Trigger']['findOne']({'where':{'id':_0x103955[_0x8157('0x4a')]['id']}})[_0x8157('0x23')](handleEntityNotFound(_0x294a59,null))[_0x8157('0x23')](function(_0x1a4024){if(_0x1a4024){_0x4f51f8=_0x1a4024;_0x315813[_0x8157('0x34')]=_[_0x8157('0x36')](db[_0x8157('0x53')]['rawAttributes']);_0x315813[_0x8157('0x35')]=_[_0x8157('0x36')](_0x103955[_0x8157('0x35')]);_0x315813['filters']=_['intersection'](_0x315813[_0x8157('0x34')],_0x315813[_0x8157('0x35')]);_0x2e47a8['attributes']=_[_0x8157('0x38')](_0x315813[_0x8157('0x34')],qs[_0x8157('0x39')](_0x103955[_0x8157('0x35')][_0x8157('0x39')]));_0x2e47a8[_0x8157('0x3a')]=_0x2e47a8[_0x8157('0x3a')]['length']?_0x2e47a8[_0x8157('0x3a')]:_0x315813[_0x8157('0x34')];_0x2e47a8[_0x8157('0x3e')]=qs[_0x8157('0x3f')](_0x103955[_0x8157('0x35')][_0x8157('0x3f')]);_0x2e47a8[_0x8157('0x40')]=qs[_0x8157('0x37')](_[_0x8157('0x56')](_0x103955['query'],_0x315813[_0x8157('0x37')]));if(_0x103955[_0x8157('0x35')][_0x8157('0x41')]){_0x2e47a8[_0x8157('0x40')]=_[_0x8157('0x42')](_0x2e47a8[_0x8157('0x40')],{'$or':_['map'](_0x2e47a8[_0x8157('0x3a')],function(_0xa222c6){var _0x3a03f8={};_0x3a03f8[_0xa222c6]={'$like':'%'+_0x103955[_0x8157('0x35')][_0x8157('0x41')]+'%'};return _0x3a03f8;})});}_0x2e47a8=_[_0x8157('0x42')]({},_0x2e47a8,_0x103955[_0x8157('0x57')]);return _0x4f51f8[_0x8157('0x59')](_0x2e47a8);}})['then'](function(_0x566cae){if(_0x566cae){_0x3205c8=_0x566cae[_0x8157('0x3b')];if(!_0x103955[_0x8157('0x35')][_0x8157('0x3c')](_0x8157('0x3d'))){_0x2e47a8[_0x8157('0x1c')]=qs[_0x8157('0x1c')](_0x103955[_0x8157('0x35')][_0x8157('0x1c')]);_0x2e47a8['offset']=qs[_0x8157('0x1a')](_0x103955['query'][_0x8157('0x1a')]);}return _0x4f51f8[_0x8157('0x59')](_0x2e47a8);}})['then'](function(_0x28fd2b){if(_0x28fd2b){return _0x28fd2b?{'count':_0x3205c8,'rows':_0x28fd2b}:null;}})[_0x8157('0x23')](respondWithResult(_0x294a59,null))['catch'](handleError(_0x294a59,null));};exports[_0x8157('0x5a')]=function(_0x4cd218,_0x18ec7c,_0xe39d5e){if(_0x4cd218['body']['id']){delete _0x4cd218['body']['id'];}return db['Trigger']['find']({'where':{'id':_0x4cd218[_0x8157('0x4a')]['id']}})[_0x8157('0x23')](handleEntityNotFound(_0x18ec7c,null))[_0x8157('0x23')](function(_0x5147b2){if(_0x5147b2){_0x4cd218[_0x8157('0x4c')][_0x8157('0x5b')]=_0x5147b2['id'];return db[_0x8157('0x5c')][_0x8157('0x50')](_0x4cd218[_0x8157('0x4c')]);}})[_0x8157('0x23')](respondWithResult(_0x18ec7c,null))['catch'](handleError(_0x18ec7c,null));};exports[_0x8157('0x5d')]=function(_0x7e82fb,_0x4e4fed,_0x1b6311){var _0x1dc23d={};var _0x1d5a44={};var _0x54b926;var _0x490236;return db[_0x8157('0x2f')][_0x8157('0x55')]({'where':{'id':_0x7e82fb[_0x8157('0x4a')]['id']}})[_0x8157('0x23')](handleEntityNotFound(_0x4e4fed,null))[_0x8157('0x23')](function(_0x4572f4){if(_0x4572f4){_0x54b926=_0x4572f4;_0x1d5a44['model']=_[_0x8157('0x36')](db['Action'][_0x8157('0x30')]);_0x1d5a44[_0x8157('0x35')]=_[_0x8157('0x36')](_0x7e82fb[_0x8157('0x35')]);_0x1d5a44['filters']=_[_0x8157('0x38')](_0x1d5a44['model'],_0x1d5a44[_0x8157('0x35')]);_0x1dc23d[_0x8157('0x3a')]=_[_0x8157('0x38')](_0x1d5a44['model'],qs['fields'](_0x7e82fb[_0x8157('0x35')][_0x8157('0x39')]));_0x1dc23d['attributes']=_0x1dc23d[_0x8157('0x3a')][_0x8157('0x3b')]?_0x1dc23d[_0x8157('0x3a')]:_0x1d5a44[_0x8157('0x34')];_0x1dc23d[_0x8157('0x3e')]=qs[_0x8157('0x3f')](_0x7e82fb[_0x8157('0x35')][_0x8157('0x3f')]);_0x1dc23d[_0x8157('0x40')]=qs[_0x8157('0x37')](_[_0x8157('0x56')](_0x7e82fb[_0x8157('0x35')],_0x1d5a44[_0x8157('0x37')]));if(_0x7e82fb[_0x8157('0x35')][_0x8157('0x41')]){_0x1dc23d['where']=_[_0x8157('0x42')](_0x1dc23d['where'],{'$or':_[_0x8157('0x2e')](_0x1dc23d[_0x8157('0x3a')],function(_0x1a2ab2){var _0x3d6f25={};_0x3d6f25[_0x1a2ab2]={'$like':'%'+_0x7e82fb[_0x8157('0x35')][_0x8157('0x41')]+'%'};return _0x3d6f25;})});}_0x1dc23d=_[_0x8157('0x42')]({},_0x1dc23d,_0x7e82fb['options']);return _0x54b926[_0x8157('0x5d')](_0x1dc23d);}})[_0x8157('0x23')](function(_0x35c6ad){if(_0x35c6ad){_0x490236=_0x35c6ad[_0x8157('0x3b')];if(!_0x7e82fb['query'][_0x8157('0x3c')](_0x8157('0x3d'))){_0x1dc23d[_0x8157('0x1c')]=qs[_0x8157('0x1c')](_0x7e82fb[_0x8157('0x35')][_0x8157('0x1c')]);_0x1dc23d['offset']=qs[_0x8157('0x1a')](_0x7e82fb['query'][_0x8157('0x1a')]);}return _0x54b926[_0x8157('0x5d')](_0x1dc23d);}})[_0x8157('0x23')](function(_0x27c77e){if(_0x27c77e){return _0x27c77e?{'count':_0x490236,'rows':_0x27c77e}:null;}})[_0x8157('0x23')](respondWithResult(_0x4e4fed,null))[_0x8157('0x48')](handleError(_0x4e4fed,null));}; \ No newline at end of file +var _0x3ac0=['findOne','order','options','getAllConditions','nolimit','getAnyConditions','addAction','TriggerId','getActions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','reject','destroy','then','get','Triggers','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','Trigger','count','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','update','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId'];(function(_0x506b35,_0x53e1a3){var _0x575deb=function(_0x3a06e0){while(--_0x3a06e0){_0x506b35['push'](_0x506b35['shift']());}};_0x575deb(++_0x53e1a3);}(_0x3ac0,0x66));var _0x03ac=function(_0x53b53e,_0x498437){_0x53b53e=_0x53b53e-0x0;var _0xbb6179=_0x3ac0[_0x53b53e];return _0xbb6179;};'use strict';var emlformat=require(_0x03ac('0x0'));var rimraf=require(_0x03ac('0x1'));var zipdir=require(_0x03ac('0x2'));var jsonpatch=require(_0x03ac('0x3'));var rp=require('request-promise');var moment=require(_0x03ac('0x4'));var BPromise=require(_0x03ac('0x5'));var Mustache=require(_0x03ac('0x6'));var util=require(_0x03ac('0x7'));var path=require(_0x03ac('0x8'));var sox=require('sox');var csv=require(_0x03ac('0x9'));var ejs=require(_0x03ac('0xa'));var fs=require('fs');var fs_extra=require(_0x03ac('0xb'));var _=require('lodash');var squel=require(_0x03ac('0xc'));var crypto=require(_0x03ac('0xd'));var jsforce=require(_0x03ac('0xe'));var deskjs=require(_0x03ac('0xf'));var toCsv=require(_0x03ac('0x9'));var querystring=require(_0x03ac('0x10'));var Papa=require('papaparse');var Redis=require(_0x03ac('0x11'));var authService=require(_0x03ac('0x12'));var qs=require(_0x03ac('0x13'));var as=require(_0x03ac('0x14'));var hardwareService=require(_0x03ac('0x15'));var logger=require('../../config/logger')(_0x03ac('0x16'));var utils=require(_0x03ac('0x17'));var config=require(_0x03ac('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5f1914,_0x24c0b4){_0x24c0b4=_0x24c0b4||0xcc;return function(_0x49d5ab){if(_0x49d5ab){return _0x5f1914[_0x03ac('0x19')](_0x24c0b4);}return _0x5f1914[_0x03ac('0x1a')](_0x24c0b4)[_0x03ac('0x1b')]();};}function respondWithResult(_0x54e27d,_0x40321){_0x40321=_0x40321||0xc8;return function(_0x11dc89){if(_0x11dc89){return _0x54e27d[_0x03ac('0x1a')](_0x40321)[_0x03ac('0x1c')](_0x11dc89);}};}function respondWithFilteredResult(_0x5373dd,_0xe16eea){return function(_0x3cfe73){if(_0x3cfe73){var _0x2b216d=typeof _0xe16eea['offset']===_0x03ac('0x1d')&&typeof _0xe16eea[_0x03ac('0x1e')]===_0x03ac('0x1d');var _0x2c1e3d=_0x3cfe73['count'];var _0x3670db=_0x2b216d?0x0:_0xe16eea[_0x03ac('0x1f')];var _0x2f94db=_0x2b216d?_0x3cfe73['count']:_0xe16eea[_0x03ac('0x1f')]+_0xe16eea[_0x03ac('0x1e')];var _0x341f97;if(_0x2f94db>=_0x2c1e3d){_0x2f94db=_0x2c1e3d;_0x341f97=0xc8;}else{_0x341f97=0xce;}_0x5373dd['status'](_0x341f97);return _0x5373dd[_0x03ac('0x20')](_0x03ac('0x21'),_0x3670db+'-'+_0x2f94db+'/'+_0x2c1e3d)[_0x03ac('0x1c')](_0x3cfe73);}return null;};}function patchUpdates(_0x4bc719){return function(_0x172c22){try{jsonpatch['apply'](_0x172c22,_0x4bc719,!![]);}catch(_0x558625){return BPromise[_0x03ac('0x22')](_0x558625);}return _0x172c22['save']();};}function saveUpdates(_0x58332a,_0xdf7d49){return function(_0x22149b){if(_0x22149b){return _0x22149b['update'](_0x58332a)['then'](function(_0x5b9691){return _0x5b9691;});}return null;};}function removeEntity(_0x10cd96,_0x1029ef){return function(_0x43aec4){if(_0x43aec4){return _0x43aec4[_0x03ac('0x23')]()[_0x03ac('0x24')](function(){var _0x523b4b=_0x43aec4[_0x03ac('0x25')]({'plain':!![]});var _0x307416=_0x03ac('0x26');return db[_0x03ac('0x27')][_0x03ac('0x23')]({'where':{'type':_0x307416,'resourceId':_0x523b4b['id']}})['then'](function(){return _0x43aec4;});})['then'](function(){_0x10cd96[_0x03ac('0x1a')](0xcc)[_0x03ac('0x1b')]();});}};}function handleEntityNotFound(_0x16d4ab,_0x2e33e8){return function(_0x30fe06){if(!_0x30fe06){_0x16d4ab['sendStatus'](0x194);}return _0x30fe06;};}function handleError(_0x1504ce,_0x3c1d24){_0x3c1d24=_0x3c1d24||0x1f4;return function(_0x29d761){logger[_0x03ac('0x28')](_0x29d761[_0x03ac('0x29')]);if(_0x29d761['name']){delete _0x29d761[_0x03ac('0x2a')];}_0x1504ce[_0x03ac('0x1a')](_0x3c1d24)['send'](_0x29d761);};}exports[_0x03ac('0x2b')]=function(_0x44bd7,_0x50b52f){var _0x1c10f8={},_0x5eaa75={},_0x316ef1={'count':0x0,'rows':[]};var _0x37887f=_[_0x03ac('0x2c')](db['Trigger'][_0x03ac('0x2d')],function(_0x319360){return{'name':_0x319360[_0x03ac('0x2e')],'type':_0x319360['type']['key']};});_0x5eaa75[_0x03ac('0x2f')]=_['map'](_0x37887f,_0x03ac('0x2a'));_0x5eaa75[_0x03ac('0x30')]=_[_0x03ac('0x31')](_0x44bd7[_0x03ac('0x30')]);_0x5eaa75[_0x03ac('0x32')]=_[_0x03ac('0x33')](_0x5eaa75[_0x03ac('0x2f')],_0x5eaa75[_0x03ac('0x30')]);_0x1c10f8[_0x03ac('0x34')]=_[_0x03ac('0x33')](_0x5eaa75[_0x03ac('0x2f')],qs[_0x03ac('0x35')](_0x44bd7[_0x03ac('0x30')][_0x03ac('0x35')]));_0x1c10f8[_0x03ac('0x34')]=_0x1c10f8[_0x03ac('0x34')]['length']?_0x1c10f8[_0x03ac('0x34')]:_0x5eaa75[_0x03ac('0x2f')];if(!_0x44bd7[_0x03ac('0x30')][_0x03ac('0x36')]('nolimit')){_0x1c10f8['limit']=qs[_0x03ac('0x1e')](_0x44bd7[_0x03ac('0x30')][_0x03ac('0x1e')]);_0x1c10f8[_0x03ac('0x1f')]=qs[_0x03ac('0x1f')](_0x44bd7[_0x03ac('0x30')]['offset']);}_0x1c10f8['order']=qs[_0x03ac('0x37')](_0x44bd7['query'][_0x03ac('0x37')]);_0x1c10f8['where']=qs[_0x03ac('0x32')](_[_0x03ac('0x38')](_0x44bd7[_0x03ac('0x30')],_0x5eaa75[_0x03ac('0x32')]),_0x37887f);if(_0x44bd7[_0x03ac('0x30')][_0x03ac('0x39')]){_0x1c10f8[_0x03ac('0x3a')]=_[_0x03ac('0x3b')](_0x1c10f8[_0x03ac('0x3a')],{'$or':_['map'](_0x37887f,function(_0x1b4a0f){if(_0x1b4a0f['type']!==_0x03ac('0x3c')){var _0x543a94={};_0x543a94[_0x1b4a0f['name']]={'$like':'%'+_0x44bd7['query'][_0x03ac('0x39')]+'%'};return _0x543a94;}})});}_0x1c10f8=_[_0x03ac('0x3b')]({},_0x1c10f8,_0x44bd7['options']);var _0xf7caec={'where':_0x1c10f8['where']};return db[_0x03ac('0x3d')][_0x03ac('0x3e')](_0xf7caec)[_0x03ac('0x24')](function(_0x43a81a){_0x316ef1[_0x03ac('0x3e')]=_0x43a81a;if(_0x44bd7[_0x03ac('0x30')][_0x03ac('0x3f')]){_0x1c10f8[_0x03ac('0x40')]=[{'all':!![]}];}return db[_0x03ac('0x3d')][_0x03ac('0x41')](_0x1c10f8);})[_0x03ac('0x24')](function(_0x2fab77){_0x316ef1[_0x03ac('0x42')]=_0x2fab77;return _0x316ef1;})['then'](respondWithFilteredResult(_0x50b52f,_0x1c10f8))[_0x03ac('0x43')](handleError(_0x50b52f,null));};exports[_0x03ac('0x44')]=function(_0x4127c4,_0x50a486){var _0x131eb5={'raw':![],'where':{'id':_0x4127c4[_0x03ac('0x45')]['id']}},_0x6d21c2={};_0x6d21c2[_0x03ac('0x2f')]=_[_0x03ac('0x31')](db[_0x03ac('0x3d')][_0x03ac('0x2d')]);_0x6d21c2['query']=_[_0x03ac('0x31')](_0x4127c4['query']);_0x6d21c2[_0x03ac('0x32')]=_[_0x03ac('0x33')](_0x6d21c2['model'],_0x6d21c2[_0x03ac('0x30')]);_0x131eb5[_0x03ac('0x34')]=_['intersection'](_0x6d21c2[_0x03ac('0x2f')],qs[_0x03ac('0x35')](_0x4127c4[_0x03ac('0x30')][_0x03ac('0x35')]));_0x131eb5[_0x03ac('0x34')]=_0x131eb5[_0x03ac('0x34')][_0x03ac('0x46')]?_0x131eb5['attributes']:_0x6d21c2['model'];if(_0x4127c4['query'][_0x03ac('0x3f')]){_0x131eb5[_0x03ac('0x40')]=[{'all':!![]}];}_0x131eb5=_['merge']({},_0x131eb5,_0x4127c4['options']);return db[_0x03ac('0x3d')][_0x03ac('0x47')](_0x131eb5)[_0x03ac('0x24')](handleEntityNotFound(_0x50a486,null))[_0x03ac('0x24')](respondWithResult(_0x50a486,null))['catch'](handleError(_0x50a486,null));};exports[_0x03ac('0x48')]=function(_0x747834,_0x3cece2){return db[_0x03ac('0x3d')][_0x03ac('0x48')](_0x747834[_0x03ac('0x49')],{})[_0x03ac('0x24')](function(_0x4626ba){var _0x1fc764=_0x747834[_0x03ac('0x4a')]['get']({'plain':!![]});if(!_0x1fc764)throw new Error(_0x03ac('0x4b'));if(_0x1fc764['role']===_0x03ac('0x4a')){var _0x141098=_0x4626ba['get']({'plain':!![]});var _0x17335c='Triggers';return db['UserProfileSection'][_0x03ac('0x47')]({'where':{'name':_0x17335c,'userProfileId':_0x1fc764[_0x03ac('0x4c')]},'raw':!![]})[_0x03ac('0x24')](function(_0x243765){if(_0x243765&&_0x243765[_0x03ac('0x4d')]===0x0){return db[_0x03ac('0x27')][_0x03ac('0x48')]({'name':_0x141098[_0x03ac('0x2a')],'resourceId':_0x141098['id'],'type':_0x243765[_0x03ac('0x2a')],'sectionId':_0x243765['id']},{})[_0x03ac('0x24')](function(){return _0x4626ba;});}else{return _0x4626ba;}})[_0x03ac('0x43')](function(_0x16f5d2){logger[_0x03ac('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x16f5d2);throw _0x16f5d2;});}return _0x4626ba;})[_0x03ac('0x24')](respondWithResult(_0x3cece2,0xc9))[_0x03ac('0x43')](handleError(_0x3cece2,null));};exports[_0x03ac('0x4e')]=function(_0x3afcd8,_0x3ba7a){if(_0x3afcd8[_0x03ac('0x49')]['id']){delete _0x3afcd8['body']['id'];}return db[_0x03ac('0x3d')][_0x03ac('0x47')]({'where':{'id':_0x3afcd8['params']['id']}})[_0x03ac('0x24')](handleEntityNotFound(_0x3ba7a,null))[_0x03ac('0x24')](saveUpdates(_0x3afcd8[_0x03ac('0x49')],null))[_0x03ac('0x24')](respondWithResult(_0x3ba7a,null))[_0x03ac('0x43')](handleError(_0x3ba7a,null));};exports[_0x03ac('0x23')]=function(_0x5d2ad9,_0x192943){return db['Trigger'][_0x03ac('0x47')]({'where':{'id':_0x5d2ad9[_0x03ac('0x45')]['id']}})[_0x03ac('0x24')](handleEntityNotFound(_0x192943,null))[_0x03ac('0x24')](removeEntity(_0x192943,null))[_0x03ac('0x43')](handleError(_0x192943,null));};exports[_0x03ac('0x4f')]=function(_0x3491c7,_0xebb9,_0x5da7c8){if(_0x3491c7[_0x03ac('0x49')]['id']){delete _0x3491c7['body']['id'];}return db[_0x03ac('0x3d')][_0x03ac('0x47')]({'where':{'id':_0x3491c7[_0x03ac('0x45')]['id']}})['then'](handleEntityNotFound(_0xebb9,null))[_0x03ac('0x24')](function(_0x224808){if(_0x224808){_0x3491c7[_0x03ac('0x49')][_0x03ac('0x50')]=_0x224808['id'];return db[_0x03ac('0x51')][_0x03ac('0x48')](_0x3491c7[_0x03ac('0x49')]);}})['then'](respondWithResult(_0xebb9,null))[_0x03ac('0x43')](handleError(_0xebb9,null));};exports[_0x03ac('0x52')]=function(_0xbcd2b,_0x44be74,_0x338a01){if(_0xbcd2b[_0x03ac('0x49')]['id']){delete _0xbcd2b['body']['id'];}return db[_0x03ac('0x3d')][_0x03ac('0x47')]({'where':{'id':_0xbcd2b[_0x03ac('0x45')]['id']}})[_0x03ac('0x24')](handleEntityNotFound(_0x44be74,null))['then'](function(_0x457a98){if(_0x457a98){_0xbcd2b[_0x03ac('0x49')][_0x03ac('0x53')]=_0x457a98['id'];return db[_0x03ac('0x51')][_0x03ac('0x48')](_0xbcd2b['body']);}})[_0x03ac('0x24')](respondWithResult(_0x44be74,null))[_0x03ac('0x43')](handleError(_0x44be74,null));};exports['getAllConditions']=function(_0x507ce3,_0x32f8d0,_0x2e185f){var _0x105747={};var _0x3a43dd={};var _0x11dd14;var _0x1f5015;return db[_0x03ac('0x3d')][_0x03ac('0x54')]({'where':{'id':_0x507ce3[_0x03ac('0x45')]['id']}})[_0x03ac('0x24')](handleEntityNotFound(_0x32f8d0,null))[_0x03ac('0x24')](function(_0xa31fb7){if(_0xa31fb7){_0x11dd14=_0xa31fb7;_0x3a43dd[_0x03ac('0x2f')]=_[_0x03ac('0x31')](db['Condition'][_0x03ac('0x2d')]);_0x3a43dd[_0x03ac('0x30')]=_['keys'](_0x507ce3[_0x03ac('0x30')]);_0x3a43dd['filters']=_[_0x03ac('0x33')](_0x3a43dd[_0x03ac('0x2f')],_0x3a43dd[_0x03ac('0x30')]);_0x105747[_0x03ac('0x34')]=_[_0x03ac('0x33')](_0x3a43dd[_0x03ac('0x2f')],qs[_0x03ac('0x35')](_0x507ce3[_0x03ac('0x30')][_0x03ac('0x35')]));_0x105747[_0x03ac('0x34')]=_0x105747['attributes']['length']?_0x105747[_0x03ac('0x34')]:_0x3a43dd['model'];_0x105747[_0x03ac('0x55')]=qs[_0x03ac('0x37')](_0x507ce3['query']['sort']);_0x105747[_0x03ac('0x3a')]=qs[_0x03ac('0x32')](_[_0x03ac('0x38')](_0x507ce3['query'],_0x3a43dd[_0x03ac('0x32')]));if(_0x507ce3[_0x03ac('0x30')][_0x03ac('0x39')]){_0x105747[_0x03ac('0x3a')]=_[_0x03ac('0x3b')](_0x105747[_0x03ac('0x3a')],{'$or':_[_0x03ac('0x2c')](_0x105747[_0x03ac('0x34')],function(_0xfcab62){var _0x114251={};_0x114251[_0xfcab62]={'$like':'%'+_0x507ce3[_0x03ac('0x30')][_0x03ac('0x39')]+'%'};return _0x114251;})});}_0x105747=_[_0x03ac('0x3b')]({},_0x105747,_0x507ce3[_0x03ac('0x56')]);return _0x11dd14[_0x03ac('0x57')](_0x105747);}})[_0x03ac('0x24')](function(_0x27e9ca){if(_0x27e9ca){_0x1f5015=_0x27e9ca['length'];if(!_0x507ce3[_0x03ac('0x30')][_0x03ac('0x36')](_0x03ac('0x58'))){_0x105747['limit']=qs[_0x03ac('0x1e')](_0x507ce3[_0x03ac('0x30')][_0x03ac('0x1e')]);_0x105747[_0x03ac('0x1f')]=qs[_0x03ac('0x1f')](_0x507ce3[_0x03ac('0x30')]['offset']);}return _0x11dd14['getAllConditions'](_0x105747);}})[_0x03ac('0x24')](function(_0x16f19a){if(_0x16f19a){return _0x16f19a?{'count':_0x1f5015,'rows':_0x16f19a}:null;}})[_0x03ac('0x24')](respondWithResult(_0x32f8d0,null))[_0x03ac('0x43')](handleError(_0x32f8d0,null));};exports['getAnyConditions']=function(_0x9537fd,_0x42ef2f,_0x263802){var _0x25e94c={};var _0x2a8dd7={};var _0x36c8a9;var _0x5e2792;return db['Trigger'][_0x03ac('0x54')]({'where':{'id':_0x9537fd[_0x03ac('0x45')]['id']}})[_0x03ac('0x24')](handleEntityNotFound(_0x42ef2f,null))[_0x03ac('0x24')](function(_0x377a64){if(_0x377a64){_0x36c8a9=_0x377a64;_0x2a8dd7[_0x03ac('0x2f')]=_[_0x03ac('0x31')](db[_0x03ac('0x51')][_0x03ac('0x2d')]);_0x2a8dd7[_0x03ac('0x30')]=_[_0x03ac('0x31')](_0x9537fd[_0x03ac('0x30')]);_0x2a8dd7[_0x03ac('0x32')]=_[_0x03ac('0x33')](_0x2a8dd7['model'],_0x2a8dd7[_0x03ac('0x30')]);_0x25e94c[_0x03ac('0x34')]=_[_0x03ac('0x33')](_0x2a8dd7[_0x03ac('0x2f')],qs[_0x03ac('0x35')](_0x9537fd[_0x03ac('0x30')][_0x03ac('0x35')]));_0x25e94c['attributes']=_0x25e94c[_0x03ac('0x34')][_0x03ac('0x46')]?_0x25e94c[_0x03ac('0x34')]:_0x2a8dd7['model'];_0x25e94c['order']=qs['sort'](_0x9537fd['query'][_0x03ac('0x37')]);_0x25e94c[_0x03ac('0x3a')]=qs['filters'](_[_0x03ac('0x38')](_0x9537fd[_0x03ac('0x30')],_0x2a8dd7[_0x03ac('0x32')]));if(_0x9537fd[_0x03ac('0x30')]['filter']){_0x25e94c[_0x03ac('0x3a')]=_[_0x03ac('0x3b')](_0x25e94c[_0x03ac('0x3a')],{'$or':_[_0x03ac('0x2c')](_0x25e94c['attributes'],function(_0x148b77){var _0x2dfcdc={};_0x2dfcdc[_0x148b77]={'$like':'%'+_0x9537fd[_0x03ac('0x30')][_0x03ac('0x39')]+'%'};return _0x2dfcdc;})});}_0x25e94c=_[_0x03ac('0x3b')]({},_0x25e94c,_0x9537fd[_0x03ac('0x56')]);return _0x36c8a9[_0x03ac('0x59')](_0x25e94c);}})[_0x03ac('0x24')](function(_0x39220c){if(_0x39220c){_0x5e2792=_0x39220c[_0x03ac('0x46')];if(!_0x9537fd[_0x03ac('0x30')][_0x03ac('0x36')](_0x03ac('0x58'))){_0x25e94c['limit']=qs[_0x03ac('0x1e')](_0x9537fd[_0x03ac('0x30')][_0x03ac('0x1e')]);_0x25e94c[_0x03ac('0x1f')]=qs['offset'](_0x9537fd['query'][_0x03ac('0x1f')]);}return _0x36c8a9[_0x03ac('0x59')](_0x25e94c);}})['then'](function(_0x27356a){if(_0x27356a){return _0x27356a?{'count':_0x5e2792,'rows':_0x27356a}:null;}})[_0x03ac('0x24')](respondWithResult(_0x42ef2f,null))[_0x03ac('0x43')](handleError(_0x42ef2f,null));};exports[_0x03ac('0x5a')]=function(_0x131567,_0x59e31a,_0x85d172){if(_0x131567[_0x03ac('0x49')]['id']){delete _0x131567[_0x03ac('0x49')]['id'];}return db[_0x03ac('0x3d')][_0x03ac('0x47')]({'where':{'id':_0x131567[_0x03ac('0x45')]['id']}})[_0x03ac('0x24')](handleEntityNotFound(_0x59e31a,null))[_0x03ac('0x24')](function(_0x1cce0){if(_0x1cce0){_0x131567[_0x03ac('0x49')][_0x03ac('0x5b')]=_0x1cce0['id'];return db['Action']['create'](_0x131567['body']);}})[_0x03ac('0x24')](respondWithResult(_0x59e31a,null))[_0x03ac('0x43')](handleError(_0x59e31a,null));};exports[_0x03ac('0x5c')]=function(_0x16b07a,_0xc9f83,_0x384253){var _0x30ee46={};var _0x16e171={};var _0x313332;var _0x37f934;return db[_0x03ac('0x3d')]['findOne']({'where':{'id':_0x16b07a[_0x03ac('0x45')]['id']}})[_0x03ac('0x24')](handleEntityNotFound(_0xc9f83,null))[_0x03ac('0x24')](function(_0x236931){if(_0x236931){_0x313332=_0x236931;_0x16e171[_0x03ac('0x2f')]=_['keys'](db['Action'][_0x03ac('0x2d')]);_0x16e171[_0x03ac('0x30')]=_[_0x03ac('0x31')](_0x16b07a[_0x03ac('0x30')]);_0x16e171[_0x03ac('0x32')]=_[_0x03ac('0x33')](_0x16e171[_0x03ac('0x2f')],_0x16e171['query']);_0x30ee46[_0x03ac('0x34')]=_[_0x03ac('0x33')](_0x16e171[_0x03ac('0x2f')],qs[_0x03ac('0x35')](_0x16b07a[_0x03ac('0x30')]['fields']));_0x30ee46['attributes']=_0x30ee46[_0x03ac('0x34')][_0x03ac('0x46')]?_0x30ee46[_0x03ac('0x34')]:_0x16e171[_0x03ac('0x2f')];_0x30ee46[_0x03ac('0x55')]=qs[_0x03ac('0x37')](_0x16b07a['query'][_0x03ac('0x37')]);_0x30ee46[_0x03ac('0x3a')]=qs['filters'](_['pick'](_0x16b07a['query'],_0x16e171[_0x03ac('0x32')]));if(_0x16b07a['query'][_0x03ac('0x39')]){_0x30ee46['where']=_[_0x03ac('0x3b')](_0x30ee46['where'],{'$or':_['map'](_0x30ee46['attributes'],function(_0x5b6339){var _0x11f40b={};_0x11f40b[_0x5b6339]={'$like':'%'+_0x16b07a[_0x03ac('0x30')][_0x03ac('0x39')]+'%'};return _0x11f40b;})});}_0x30ee46=_[_0x03ac('0x3b')]({},_0x30ee46,_0x16b07a['options']);return _0x313332[_0x03ac('0x5c')](_0x30ee46);}})[_0x03ac('0x24')](function(_0x5f4ee6){if(_0x5f4ee6){_0x37f934=_0x5f4ee6[_0x03ac('0x46')];if(!_0x16b07a[_0x03ac('0x30')]['hasOwnProperty']('nolimit')){_0x30ee46[_0x03ac('0x1e')]=qs[_0x03ac('0x1e')](_0x16b07a[_0x03ac('0x30')][_0x03ac('0x1e')]);_0x30ee46[_0x03ac('0x1f')]=qs[_0x03ac('0x1f')](_0x16b07a[_0x03ac('0x30')][_0x03ac('0x1f')]);}return _0x313332['getActions'](_0x30ee46);}})[_0x03ac('0x24')](function(_0x565a22){if(_0x565a22){return _0x565a22?{'count':_0x37f934,'rows':_0x565a22}:null;}})[_0x03ac('0x24')](respondWithResult(_0xc9f83,null))[_0x03ac('0x43')](handleError(_0xc9f83,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index d97dee1..b4b8f93 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 _0x3164=['Trigger','tools_triggers','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','exports','define'];(function(_0x2e4f4a,_0x1f295a){var _0x1094c7=function(_0x568743){while(--_0x568743){_0x2e4f4a['push'](_0x2e4f4a['shift']());}};_0x1094c7(++_0x1f295a);}(_0x3164,0x182));var _0x4316=function(_0x52db3f,_0x37ab5f){_0x52db3f=_0x52db3f-0x0;var _0x41b731=_0x3164[_0x52db3f];return _0x41b731;};'use strict';var _=require(_0x4316('0x0'));var util=require(_0x4316('0x1'));var logger=require(_0x4316('0x2'))(_0x4316('0x3'));var moment=require(_0x4316('0x4'));var BPromise=require('bluebird');var rp=require(_0x4316('0x5'));var fs=require('fs');var path=require(_0x4316('0x6'));var rimraf=require(_0x4316('0x7'));var config=require('../../config/environment');var attributes=require('./trigger.attributes');module[_0x4316('0x8')]=function(_0x25827b,_0xf88ba4){return _0x25827b[_0x4316('0x9')](_0x4316('0xa'),attributes,{'tableName':_0x4316('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec39=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./trigger.attributes','define','Trigger','tools_triggers','lodash'];(function(_0x1ff5d5,_0x39c705){var _0x4f3e8b=function(_0x28a22a){while(--_0x28a22a){_0x1ff5d5['push'](_0x1ff5d5['shift']());}};_0x4f3e8b(++_0x39c705);}(_0xec39,0x19f));var _0x9ec3=function(_0x8d0092,_0x5c2a3d){_0x8d0092=_0x8d0092-0x0;var _0x533d47=_0xec39[_0x8d0092];return _0x533d47;};'use strict';var _=require(_0x9ec3('0x0'));var util=require(_0x9ec3('0x1'));var logger=require(_0x9ec3('0x2'))(_0x9ec3('0x3'));var moment=require(_0x9ec3('0x4'));var BPromise=require(_0x9ec3('0x5'));var rp=require(_0x9ec3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9ec3('0x7'));var config=require(_0x9ec3('0x8'));var attributes=require(_0x9ec3('0x9'));module['exports']=function(_0x49ddff,_0x55adba){return _0x49ddff[_0x9ec3('0xa')](_0x9ec3('0xb'),attributes,{'tableName':_0x9ec3('0xc'),'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 5d83193..6bb9a88 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 _0x9304=['debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','Trigger','options','where','attributes','limit','include','map','model','then','GetTrigger','ShowTrigger','find','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','Trigger,\x20%s,\x20%s','request\x20sent'];(function(_0x22ee97,_0x4a153d){var _0x787f23=function(_0x432a6e){while(--_0x432a6e){_0x22ee97['push'](_0x22ee97['shift']());}};_0x787f23(++_0x4a153d);}(_0x9304,0xb9));var _0x4930=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9304[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4930('0x0'));var util=require(_0x4930('0x1'));var moment=require('moment');var BPromise=require(_0x4930('0x2'));var rs=require(_0x4930('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4930('0x4'));var logger=require(_0x4930('0x5'))('rpc');var config=require(_0x4930('0x6'));var jayson=require(_0x4930('0x7'));var client=jayson[_0x4930('0x8')][_0x4930('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x246849,_0x46dcac,_0x4af309){return new BPromise(function(_0xa7cb2,_0x3ac5db){return client[_0x4930('0xa')](_0x246849,_0x4af309)['then'](function(_0x44c4df){logger['info'](_0x4930('0xb'),_0x46dcac,_0x4930('0xc'));logger[_0x4930('0xd')](_0x4930('0xe'),_0x46dcac,_0x4930('0xc'),JSON[_0x4930('0xf')](_0x44c4df));if(_0x44c4df[_0x4930('0x10')]){if(_0x44c4df[_0x4930('0x10')][_0x4930('0x11')]===0x1f4){logger['error'](_0x4930('0xb'),_0x46dcac,_0x44c4df[_0x4930('0x10')]['message']);return _0x3ac5db(_0x44c4df['error'][_0x4930('0x12')]);}logger[_0x4930('0x10')]('Trigger,\x20%s,\x20%s',_0x46dcac,_0x44c4df[_0x4930('0x10')][_0x4930('0x12')]);return _0xa7cb2(_0x44c4df[_0x4930('0x10')][_0x4930('0x12')]);}else{logger[_0x4930('0x13')](_0x4930('0xb'),_0x46dcac,_0x4930('0xc'));_0xa7cb2(_0x44c4df['result'][_0x4930('0x12')]);}})[_0x4930('0x14')](function(_0x4cdd67){logger['error'](_0x4930('0xb'),_0x46dcac,_0x4cdd67);_0x3ac5db(_0x4cdd67);});});}exports['GetTrigger']=function(_0x576843){var _0x5e0044=this;return new Promise(function(_0x2ba837,_0x3a386f){return db[_0x4930('0x15')]['findAll']({'raw':_0x576843[_0x4930('0x16')]?_0x576843[_0x4930('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x576843[_0x4930('0x16')]?_0x576843[_0x4930('0x16')][_0x4930('0x17')]||null:null,'attributes':_0x576843['options']?_0x576843['options'][_0x4930('0x18')]||null:null,'limit':_0x576843[_0x4930('0x16')]?_0x576843['options'][_0x4930('0x19')]||null:null,'include':_0x576843[_0x4930('0x16')]?_0x576843[_0x4930('0x16')][_0x4930('0x1a')]?_[_0x4930('0x1b')](_0x576843[_0x4930('0x16')][_0x4930('0x1a')],function(_0x4e7667){return{'model':db[_0x4e7667['model']],'as':_0x4e7667['as'],'attributes':_0x4e7667[_0x4930('0x18')],'include':_0x4e7667[_0x4930('0x1a')]?_[_0x4930('0x1b')](_0x4e7667['include'],function(_0x8b4b5d){return{'model':db[_0x8b4b5d['model']],'as':_0x8b4b5d['as'],'attributes':_0x8b4b5d[_0x4930('0x18')],'include':_0x8b4b5d['include']?_[_0x4930('0x1b')](_0x8b4b5d[_0x4930('0x1a')],function(_0x47a6bb){return{'model':db[_0x47a6bb[_0x4930('0x1c')]],'as':_0x47a6bb['as'],'attributes':_0x47a6bb['attributes']};}):[]};}):[]};}):[]:[]})[_0x4930('0x1d')](function(_0x5d83e7){logger['info'](_0x4930('0x1e'),_0x576843);logger['debug'](_0x4930('0x1e'),_0x576843,JSON[_0x4930('0xf')](_0x5d83e7));_0x2ba837(_0x5d83e7);})[_0x4930('0x14')](function(_0x4fe11a){logger[_0x4930('0x10')](_0x4930('0x1e'),_0x4fe11a[_0x4930('0x12')],_0x576843);_0x3a386f(_0x5e0044[_0x4930('0x10')](0x1f4,_0x4fe11a['message']));});});};exports[_0x4930('0x1f')]=function(_0x4e5b21){var _0x42fe6c=this;return new Promise(function(_0x6736a8,_0x2a4d8c){return db[_0x4930('0x15')][_0x4930('0x20')]({'raw':_0x4e5b21[_0x4930('0x16')]?_0x4e5b21[_0x4930('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4e5b21[_0x4930('0x16')]?_0x4e5b21['options'][_0x4930('0x17')]||null:null,'attributes':_0x4e5b21[_0x4930('0x16')]?_0x4e5b21[_0x4930('0x16')]['attributes']||null:null,'include':_0x4e5b21[_0x4930('0x16')]?_0x4e5b21['options'][_0x4930('0x1a')]?_[_0x4930('0x1b')](_0x4e5b21[_0x4930('0x16')][_0x4930('0x1a')],function(_0x2d22a5){return{'model':db[_0x2d22a5['model']],'as':_0x2d22a5['as'],'attributes':_0x2d22a5[_0x4930('0x18')],'include':_0x2d22a5['include']?_[_0x4930('0x1b')](_0x2d22a5[_0x4930('0x1a')],function(_0x529020){return{'model':db[_0x529020[_0x4930('0x1c')]],'as':_0x529020['as'],'attributes':_0x529020[_0x4930('0x18')],'include':_0x529020[_0x4930('0x1a')]?_[_0x4930('0x1b')](_0x529020[_0x4930('0x1a')],function(_0x4eb892){return{'model':db[_0x4eb892[_0x4930('0x1c')]],'as':_0x4eb892['as'],'attributes':_0x4eb892[_0x4930('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4930('0x1d')](function(_0x134318){logger[_0x4930('0x13')](_0x4930('0x1f'),_0x4e5b21);logger[_0x4930('0xd')](_0x4930('0x1f'),_0x4e5b21,JSON['stringify'](_0x134318));_0x6736a8(_0x134318);})['catch'](function(_0x56042a){logger[_0x4930('0x10')](_0x4930('0x1f'),_0x56042a[_0x4930('0x12')],_0x4e5b21);_0x2a4d8c(_0x42fe6c[_0x4930('0x10')](0x1f4,_0x56042a[_0x4930('0x12')]));});});}; \ No newline at end of file +var _0x5dfc=['code','message','info','catch','GetTrigger','Trigger','options','raw','where','attributes','limit','include','map','model','ShowTrigger','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3cd285,_0x3da025){var _0x12673a=function(_0x5501f4){while(--_0x5501f4){_0x3cd285['push'](_0x3cd285['shift']());}};_0x12673a(++_0x3da025);}(_0x5dfc,0x1e4));var _0xc5df=function(_0x8bb4c1,_0x2d6e53){_0x8bb4c1=_0x8bb4c1-0x0;var _0x67a6e1=_0x5dfc[_0x8bb4c1];return _0x67a6e1;};'use strict';var _=require(_0xc5df('0x0'));var util=require(_0xc5df('0x1'));var moment=require(_0xc5df('0x2'));var BPromise=require(_0xc5df('0x3'));var rs=require(_0xc5df('0x4'));var fs=require('fs');var Redis=require(_0xc5df('0x5'));var db=require(_0xc5df('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc5df('0x7'))(_0xc5df('0x8'));var config=require(_0xc5df('0x9'));var jayson=require(_0xc5df('0xa'));var client=jayson[_0xc5df('0xb')][_0xc5df('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1834f6,_0x904b3a,_0xddfdf8){return new BPromise(function(_0x28899a,_0x40585e){return client[_0xc5df('0xd')](_0x1834f6,_0xddfdf8)['then'](function(_0x23b4e8){logger['info'](_0xc5df('0xe'),_0x904b3a,_0xc5df('0xf'));logger[_0xc5df('0x10')](_0xc5df('0x11'),_0x904b3a,'request\x20sent',JSON[_0xc5df('0x12')](_0x23b4e8));if(_0x23b4e8[_0xc5df('0x13')]){if(_0x23b4e8['error'][_0xc5df('0x14')]===0x1f4){logger[_0xc5df('0x13')](_0xc5df('0xe'),_0x904b3a,_0x23b4e8[_0xc5df('0x13')][_0xc5df('0x15')]);return _0x40585e(_0x23b4e8['error'][_0xc5df('0x15')]);}logger[_0xc5df('0x13')](_0xc5df('0xe'),_0x904b3a,_0x23b4e8[_0xc5df('0x13')][_0xc5df('0x15')]);return _0x28899a(_0x23b4e8[_0xc5df('0x13')][_0xc5df('0x15')]);}else{logger[_0xc5df('0x16')](_0xc5df('0xe'),_0x904b3a,_0xc5df('0xf'));_0x28899a(_0x23b4e8['result'][_0xc5df('0x15')]);}})[_0xc5df('0x17')](function(_0x5462f5){logger[_0xc5df('0x13')](_0xc5df('0xe'),_0x904b3a,_0x5462f5);_0x40585e(_0x5462f5);});});}exports[_0xc5df('0x18')]=function(_0x142431){var _0x320f6f=this;return new Promise(function(_0x57a092,_0x492037){return db[_0xc5df('0x19')]['findAll']({'raw':_0x142431[_0xc5df('0x1a')]?_0x142431[_0xc5df('0x1a')][_0xc5df('0x1b')]===undefined?!![]:![]:!![],'where':_0x142431['options']?_0x142431['options'][_0xc5df('0x1c')]||null:null,'attributes':_0x142431[_0xc5df('0x1a')]?_0x142431[_0xc5df('0x1a')][_0xc5df('0x1d')]||null:null,'limit':_0x142431[_0xc5df('0x1a')]?_0x142431['options'][_0xc5df('0x1e')]||null:null,'include':_0x142431[_0xc5df('0x1a')]?_0x142431[_0xc5df('0x1a')][_0xc5df('0x1f')]?_[_0xc5df('0x20')](_0x142431['options'][_0xc5df('0x1f')],function(_0x467b51){return{'model':db[_0x467b51['model']],'as':_0x467b51['as'],'attributes':_0x467b51[_0xc5df('0x1d')],'include':_0x467b51[_0xc5df('0x1f')]?_[_0xc5df('0x20')](_0x467b51[_0xc5df('0x1f')],function(_0x4263b0){return{'model':db[_0x4263b0[_0xc5df('0x21')]],'as':_0x4263b0['as'],'attributes':_0x4263b0[_0xc5df('0x1d')],'include':_0x4263b0[_0xc5df('0x1f')]?_[_0xc5df('0x20')](_0x4263b0[_0xc5df('0x1f')],function(_0x175ef3){return{'model':db[_0x175ef3[_0xc5df('0x21')]],'as':_0x175ef3['as'],'attributes':_0x175ef3[_0xc5df('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ca98b){logger[_0xc5df('0x16')](_0xc5df('0x18'),_0x142431);logger[_0xc5df('0x10')]('GetTrigger',_0x142431,JSON[_0xc5df('0x12')](_0x3ca98b));_0x57a092(_0x3ca98b);})[_0xc5df('0x17')](function(_0x26790b){logger[_0xc5df('0x13')](_0xc5df('0x18'),_0x26790b[_0xc5df('0x15')],_0x142431);_0x492037(_0x320f6f['error'](0x1f4,_0x26790b[_0xc5df('0x15')]));});});};exports[_0xc5df('0x22')]=function(_0xe9f8b7){var _0x4ce0da=this;return new Promise(function(_0x5e3aaf,_0x52841c){return db[_0xc5df('0x19')]['find']({'raw':_0xe9f8b7[_0xc5df('0x1a')]?_0xe9f8b7[_0xc5df('0x1a')][_0xc5df('0x1b')]===undefined?!![]:![]:!![],'where':_0xe9f8b7[_0xc5df('0x1a')]?_0xe9f8b7[_0xc5df('0x1a')][_0xc5df('0x1c')]||null:null,'attributes':_0xe9f8b7[_0xc5df('0x1a')]?_0xe9f8b7[_0xc5df('0x1a')][_0xc5df('0x1d')]||null:null,'include':_0xe9f8b7[_0xc5df('0x1a')]?_0xe9f8b7[_0xc5df('0x1a')][_0xc5df('0x1f')]?_[_0xc5df('0x20')](_0xe9f8b7[_0xc5df('0x1a')][_0xc5df('0x1f')],function(_0x3ce44e){return{'model':db[_0x3ce44e[_0xc5df('0x21')]],'as':_0x3ce44e['as'],'attributes':_0x3ce44e[_0xc5df('0x1d')],'include':_0x3ce44e[_0xc5df('0x1f')]?_[_0xc5df('0x20')](_0x3ce44e[_0xc5df('0x1f')],function(_0x520e7f){return{'model':db[_0x520e7f['model']],'as':_0x520e7f['as'],'attributes':_0x520e7f[_0xc5df('0x1d')],'include':_0x520e7f[_0xc5df('0x1f')]?_['map'](_0x520e7f[_0xc5df('0x1f')],function(_0x5c3e71){return{'model':db[_0x5c3e71[_0xc5df('0x21')]],'as':_0x5c3e71['as'],'attributes':_0x5c3e71[_0xc5df('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc5df('0x23')](function(_0x2cc75f){logger[_0xc5df('0x16')](_0xc5df('0x22'),_0xe9f8b7);logger['debug'](_0xc5df('0x22'),_0xe9f8b7,JSON[_0xc5df('0x12')](_0x2cc75f));_0x5e3aaf(_0x2cc75f);})['catch'](function(_0x27c4ea){logger[_0xc5df('0x13')](_0xc5df('0x22'),_0x27c4ea['message'],_0xe9f8b7);_0x52841c(_0x4ce0da[_0xc5df('0x13')](0x1f4,_0x27c4ea[_0xc5df('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index d87d442..6501a44 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 _0xacaf=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','post','/:id/clone','clone','create','/:id','delete','destroy','multer'];(function(_0x4cd2eb,_0x204468){var _0x252608=function(_0x11a1cd){while(--_0x11a1cd){_0x4cd2eb['push'](_0x4cd2eb['shift']());}};_0x252608(++_0x204468);}(_0xacaf,0x1e5));var _0xfaca=function(_0x40f9a0,_0x3458cc){_0x40f9a0=_0x40f9a0-0x0;var _0x3e3144=_0xacaf[_0x40f9a0];return _0x3e3144;};'use strict';var multer=require(_0xfaca('0x0'));var util=require('util');var path=require(_0xfaca('0x1'));var timeout=require(_0xfaca('0x2'));var express=require(_0xfaca('0x3'));var router=express[_0xfaca('0x4')]();var fs_extra=require(_0xfaca('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xfaca('0x6'));var config=require(_0xfaca('0x7'));var controller=require('./trunk.controller');router[_0xfaca('0x8')]('/',auth['isAuthenticated'](),controller[_0xfaca('0x9')]);router[_0xfaca('0x8')]('/:id',auth[_0xfaca('0xa')](),controller['show']);router[_0xfaca('0xb')](_0xfaca('0xc'),auth['isAuthenticated'](),controller[_0xfaca('0xd')]);router[_0xfaca('0xb')]('/',auth['isAuthenticated'](),controller[_0xfaca('0xe')]);router['put'](_0xfaca('0xf'),auth[_0xfaca('0xa')](),controller['update']);router[_0xfaca('0x10')]('/:id',auth[_0xfaca('0xa')](),controller[_0xfaca('0x11')]);module['exports']=router; \ No newline at end of file +var _0xccb4=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','isAuthenticated','index','get','/:id','/:id/clone','clone','put','delete','destroy'];(function(_0x210bb9,_0xc0d44c){var _0x2434ce=function(_0x50ea91){while(--_0x50ea91){_0x210bb9['push'](_0x210bb9['shift']());}};_0x2434ce(++_0xc0d44c);}(_0xccb4,0xb5));var _0x4ccb=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0xccb4[_0x10004e];return _0x5af990;};'use strict';var multer=require(_0x4ccb('0x0'));var util=require(_0x4ccb('0x1'));var path=require(_0x4ccb('0x2'));var timeout=require(_0x4ccb('0x3'));var express=require('express');var router=express[_0x4ccb('0x4')]();var fs_extra=require(_0x4ccb('0x5'));var auth=require(_0x4ccb('0x6'));var interaction=require(_0x4ccb('0x7'));var config=require(_0x4ccb('0x8'));var controller=require(_0x4ccb('0x9'));router['get']('/',auth[_0x4ccb('0xa')](),controller[_0x4ccb('0xb')]);router[_0x4ccb('0xc')](_0x4ccb('0xd'),auth['isAuthenticated'](),controller['show']);router['post'](_0x4ccb('0xe'),auth['isAuthenticated'](),controller[_0x4ccb('0xf')]);router['post']('/',auth[_0x4ccb('0xa')](),controller['create']);router[_0x4ccb('0x10')](_0x4ccb('0xd'),auth[_0x4ccb('0xa')](),controller['update']);router[_0x4ccb('0x11')](_0x4ccb('0xd'),auth[_0x4ccb('0xa')](),controller[_0x4ccb('0x12')]);module[_0x4ccb('0x13')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 1d61820..79ca582 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 _0x746b=['transport','join','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','yes','nonat','update','force_rport,comedia','nat','all','allow','ulaw;alaw;gsm','split','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','uas','fingerprint','active','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','setDataValue'];(function(_0x5034a0,_0x1aa2cb){var _0x159b17=function(_0xda9d20){while(--_0xda9d20){_0x5034a0['push'](_0x5034a0['shift']());}};_0x159b17(++_0x1aa2cb);}(_0x746b,0x1bf));var _0xb746=function(_0x107e48,_0x4afe56){_0x107e48=_0x107e48-0x0;var _0x1b54c5=_0x746b[_0x107e48];return _0x1b54c5;};'use strict';var Sequelize=require(_0xb746('0x0'));module[_0xb746('0x1')]={'name':{'type':Sequelize[_0xb746('0x2')],'allowNull':![],'unique':_0xb746('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xb746('0x4')](_0xb746('0x5'),'user','peer'),'allowNull':![],'defaultValue':_0xb746('0x5')},'context':{'type':Sequelize[_0xb746('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize['ENUM'](_0xb746('0x6'),_0xb746('0x7'),'ALLOWED_FAILED_SCREEN',_0xb746('0x8'),_0xb746('0x9'),'PROHIB_PASSED_SCREEN',_0xb746('0xa'),_0xb746('0xb'))},'deny':{'type':Sequelize[_0xb746('0x2')]},'permit':{'type':Sequelize[_0xb746('0x2')]},'secret':{'type':Sequelize[_0xb746('0x2')]},'md5secret':{'type':Sequelize[_0xb746('0x2')]},'remotesecret':{'type':Sequelize[_0xb746('0x2')]},'transport':{'type':Sequelize[_0xb746('0x2')],'defaultValue':'udp','set':function(_0x3ffba8){this[_0xb746('0xc')](_0xb746('0xd'),_0x3ffba8?_0x3ffba8[_0xb746('0xe')](','):null);},'get':function(){return this[_0xb746('0xf')](_0xb746('0xd'))?this[_0xb746('0xf')](_0xb746('0xd'))['split'](','):null;},'comment':_0xb746('0x10')},'dtmfmode':{'type':Sequelize[_0xb746('0x4')](_0xb746('0x11'),'info',_0xb746('0x12'),_0xb746('0x13'),_0xb746('0x14')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xb746('0x4')](_0xb746('0x15'),'no',_0xb746('0x16'),_0xb746('0x17'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xb746('0x4')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xb746('0x2')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0xb746('0x2')],'defaultValue':_0xb746('0x18'),'set':function(_0x567e8a){this[_0xb746('0xc')](_0xb746('0x19'),_0x567e8a?_0x567e8a[_0xb746('0xe')](','):null);},'get':function(){return this[_0xb746('0xf')](_0xb746('0x19'))?this[_0xb746('0xf')]('nat')['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xb746('0x2')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xb746('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xb746('0x2')]},'language':{'type':Sequelize[_0xb746('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xb746('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xb746('0x2')],'defaultValue':_0xb746('0x1a')},'allow':{'type':Sequelize[_0xb746('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x181cbf){this[_0xb746('0xc')](_0xb746('0x1b'),_0x181cbf?_0x181cbf['join'](';'):_0xb746('0x1c'));},'get':function(){return this['getDataValue'](_0xb746('0x1b'))?this[_0xb746('0xf')](_0xb746('0x1b'))[_0xb746('0x1d')](';'):null;},'comment':_0xb746('0x1e')},'autoframing':{'type':Sequelize[_0xb746('0x4')](_0xb746('0x15'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':'port,invite','set':function(_0x28ef39){this['setDataValue'](_0xb746('0x1f'),_0x28ef39?_0x28ef39[_0xb746('0xe')](','):null);},'get':function(){return this[_0xb746('0xf')]('insecure')?this[_0xb746('0xf')](_0xb746('0x1f'))[_0xb746('0x1d')](','):null;},'comment':_0xb746('0x20')},'trustrpid':{'type':Sequelize['ENUM'](_0xb746('0x15'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xb746('0x4')](_0xb746('0x15'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xb746('0x4')](_0xb746('0x15'),'no',_0xb746('0x21'))},'promiscredir':{'type':Sequelize['ENUM'](_0xb746('0x15'),'no')},'useclientcode':{'type':Sequelize[_0xb746('0x4')](_0xb746('0x15'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0xb746('0x2')]},'callerid':{'type':Sequelize[_0xb746('0x2')],'defaultValue':_0xb746('0x22')},'amaflags':{'type':Sequelize[_0xb746('0x2')]},'callcounter':{'type':Sequelize[_0xb746('0x4')](_0xb746('0x15'),'no'),'defaultValue':_0xb746('0x15')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0xb746('0x4')](_0xb746('0x15'),'no')},'allowsubscribe':{'type':Sequelize[_0xb746('0x4')]('yes','no')},'allowtransfer':{'type':Sequelize['ENUM']('yes','no')},'ignoresdpversion':{'type':Sequelize[_0xb746('0x4')](_0xb746('0x15'),'no')},'subscribecontext':{'type':Sequelize[_0xb746('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0xb746('0x4')](_0xb746('0x15'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xb746('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xb746('0x4')]('yes','no')},'mailbox':{'type':Sequelize[_0xb746('0x2')]},'session_timers':{'type':Sequelize[_0xb746('0x4')]('accept',_0xb746('0x24'),_0xb746('0x25'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0xb746('0x23')](0xb)},'session_refresher':{'type':Sequelize[_0xb746('0x4')]('uac',_0xb746('0x26')),'defaultValue':_0xb746('0x26')},'t38pt_usertpsource':{'type':Sequelize[_0xb746('0x2')]},'regexten':{'type':Sequelize[_0xb746('0x2')]},'fromdomain':{'type':Sequelize[_0xb746('0x2')]},'fromuser':{'type':Sequelize[_0xb746('0x2')]},'port':{'type':Sequelize[_0xb746('0x23')](0x5)},'qualify':{'type':Sequelize[_0xb746('0x4')](_0xb746('0x15'),'no'),'defaultValue':_0xb746('0x15')},'keepalive':{'type':Sequelize[_0xb746('0x23')](0xb)},'defaultip':{'type':Sequelize[_0xb746('0x2')]},'defaultuser':{'type':Sequelize[_0xb746('0x2')]},'rtptimeout':{'type':Sequelize[_0xb746('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xb746('0x23')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0xb746('0x15'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xb746('0x2')]},'callbackextension':{'type':Sequelize[_0xb746('0x2')]},'timert1':{'type':Sequelize[_0xb746('0x23')](0xb)},'timerb':{'type':Sequelize[_0xb746('0x23')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0xb746('0x2')]},'contactdeny':{'type':Sequelize[_0xb746('0x2')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0xb746('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0xb746('0x23')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xb746('0x15'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xb746('0x4')](_0xb746('0x15'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0xb746('0x15'),'no')},'icesupport':{'type':Sequelize[_0xb746('0x4')](_0xb746('0x15'),'no')},'dtlsenable':{'type':Sequelize['ENUM']('yes','no')},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0xb746('0x27'),'certificate')},'dtlsrekey':{'type':Sequelize[_0xb746('0x23')](0xb)},'dtlscertfile':{'type':Sequelize[_0xb746('0x2')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0xb746('0x2')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0xb746('0x2')]},'dtlssetup':{'type':Sequelize['ENUM'](_0xb746('0x28'),_0xb746('0x29'),_0xb746('0x2a')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize['ENUM'](_0xb746('0x15'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xb746('0x2')]},'recordofffeature':{'type':Sequelize[_0xb746('0x2')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xb746('0x4')](_0xb746('0x15'),'no')},'subscribemwi':{'type':Sequelize[_0xb746('0x4')](_0xb746('0x15'),'no')},'vmexten':{'type':Sequelize[_0xb746('0x2')]},'mohinterpret':{'type':Sequelize[_0xb746('0x2')]},'mohsuggest':{'type':Sequelize[_0xb746('0x2')]},'parkinglot':{'type':Sequelize[_0xb746('0x2')]},'description':{'type':Sequelize[_0xb746('0x2')]},'host':{'type':Sequelize[_0xb746('0x2')],'defaultValue':_0xb746('0x2b')},'canreinvite':{'type':Sequelize[_0xb746('0x4')]('yes','no',_0xb746('0x16'),_0xb746('0x17'),_0xb746('0x2c')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xb746('0x2')]},'otherFields':{'type':Sequelize[_0xb746('0x2')]},'active':{'type':Sequelize[_0xb746('0x2d')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0xb75d=['yes','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','always','refuse','uac','uas','fingerprint','active','passive','actpass','BOOLEAN','sequelize','exports','STRING','name','ENUM','user','peer','friend','from-voip-provider','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','getDataValue','split','rfc2833','inband','auto','nonat','update','outgoing','force_rport,comedia','setDataValue','join','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'];(function(_0x1d7ba0,_0x433fa6){var _0x279a19=function(_0x556fb2){while(--_0x556fb2){_0x1d7ba0['push'](_0x1d7ba0['shift']());}};_0x279a19(++_0x433fa6);}(_0xb75d,0xc7));var _0xdb75=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xb75d[_0x7e2eb0];return _0xd92de4;};'use strict';var Sequelize=require(_0xdb75('0x0'));module[_0xdb75('0x1')]={'name':{'type':Sequelize[_0xdb75('0x2')],'allowNull':![],'unique':_0xdb75('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xdb75('0x4')]('friend',_0xdb75('0x5'),_0xdb75('0x6')),'allowNull':![],'defaultValue':_0xdb75('0x7')},'context':{'type':Sequelize[_0xdb75('0x2')],'allowNull':![],'defaultValue':_0xdb75('0x8')},'callingpres':{'type':Sequelize[_0xdb75('0x4')]('ALLOWED_NOT_SCREENED',_0xdb75('0x9'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0xdb75('0xa'),_0xdb75('0xb'),_0xdb75('0xc'),_0xdb75('0xd'))},'deny':{'type':Sequelize[_0xdb75('0x2')]},'permit':{'type':Sequelize[_0xdb75('0x2')]},'secret':{'type':Sequelize[_0xdb75('0x2')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0xdb75('0x2')]},'transport':{'type':Sequelize[_0xdb75('0x2')],'defaultValue':'udp','set':function(_0x2b0e81){this['setDataValue'](_0xdb75('0xe'),_0x2b0e81?_0x2b0e81['join'](','):null);},'get':function(){return this[_0xdb75('0xf')](_0xdb75('0xe'))?this[_0xdb75('0xf')]('transport')[_0xdb75('0x10')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xdb75('0x4')](_0xdb75('0x11'),'info','shortinfo',_0xdb75('0x12'),_0xdb75('0x13')),'defaultValue':_0xdb75('0x11')},'directmedia':{'type':Sequelize['ENUM']('yes','no',_0xdb75('0x14'),_0xdb75('0x15'),_0xdb75('0x16')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xdb75('0x2')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize['STRING'],'defaultValue':_0xdb75('0x17'),'set':function(_0x23cfc1){this[_0xdb75('0x18')]('nat',_0x23cfc1?_0x23cfc1[_0xdb75('0x19')](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0xdb75('0xf')](_0xdb75('0x1a'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xdb75('0x2')]},'pickupgroup':{'type':Sequelize[_0xdb75('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xdb75('0x2')]},'language':{'type':Sequelize[_0xdb75('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xdb75('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xdb75('0x2')],'defaultValue':_0xdb75('0x1b')},'allow':{'type':Sequelize[_0xdb75('0x2')],'allowNull':![],'defaultValue':_0xdb75('0x1c'),'set':function(_0x75462b){this[_0xdb75('0x18')]('allow',_0x75462b?_0x75462b['join'](';'):_0xdb75('0x1c'));},'get':function(){return this['getDataValue'](_0xdb75('0x1d'))?this[_0xdb75('0xf')](_0xdb75('0x1d'))[_0xdb75('0x10')](';'):null;},'comment':_0xdb75('0x1e')},'autoframing':{'type':Sequelize[_0xdb75('0x4')](_0xdb75('0x1f'),'no')},'insecure':{'type':Sequelize[_0xdb75('0x2')],'defaultValue':_0xdb75('0x20'),'set':function(_0x5621f3){this[_0xdb75('0x18')](_0xdb75('0x21'),_0x5621f3?_0x5621f3['join'](','):null);},'get':function(){return this['getDataValue'](_0xdb75('0x21'))?this[_0xdb75('0xf')](_0xdb75('0x21'))[_0xdb75('0x10')](','):null;},'comment':_0xdb75('0x22')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xdb75('0x4')](_0xdb75('0x1f'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xdb75('0x1f'),'no','never')},'promiscredir':{'type':Sequelize[_0xdb75('0x4')](_0xdb75('0x1f'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0xdb75('0x1f'),'no')},'accountcode':{'type':Sequelize[_0xdb75('0x23')](0xb)},'setvar':{'type':Sequelize[_0xdb75('0x2')]},'callerid':{'type':Sequelize[_0xdb75('0x2')],'defaultValue':_0xdb75('0x24')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xdb75('0x1f')},'busylevel':{'type':Sequelize[_0xdb75('0x23')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0xdb75('0x1f'),'no')},'allowsubscribe':{'type':Sequelize[_0xdb75('0x4')](_0xdb75('0x1f'),'no')},'allowtransfer':{'type':Sequelize[_0xdb75('0x4')](_0xdb75('0x1f'),'no')},'ignoresdpversion':{'type':Sequelize[_0xdb75('0x4')](_0xdb75('0x1f'),'no')},'subscribecontext':{'type':Sequelize[_0xdb75('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0xdb75('0x4')]('yes','no',_0xdb75('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xdb75('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xdb75('0x4')](_0xdb75('0x1f'),'no')},'mailbox':{'type':Sequelize[_0xdb75('0x2')]},'session_timers':{'type':Sequelize[_0xdb75('0x4')]('accept',_0xdb75('0x26'),'originate')},'session_expires':{'type':Sequelize[_0xdb75('0x23')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0xdb75('0x27'),_0xdb75('0x28')),'defaultValue':_0xdb75('0x28')},'t38pt_usertpsource':{'type':Sequelize[_0xdb75('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0xdb75('0x2')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xdb75('0x23')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0xdb75('0x1f'),'no'),'defaultValue':_0xdb75('0x1f')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0xdb75('0x2')]},'defaultuser':{'type':Sequelize[_0xdb75('0x2')]},'rtptimeout':{'type':Sequelize[_0xdb75('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xdb75('0x23')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0xdb75('0x1f'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xdb75('0x2')]},'callbackextension':{'type':Sequelize[_0xdb75('0x2')]},'timert1':{'type':Sequelize[_0xdb75('0x23')](0xb)},'timerb':{'type':Sequelize[_0xdb75('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0xdb75('0x23')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0xdb75('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xdb75('0x2')]},'use_q850_reason':{'type':Sequelize[_0xdb75('0x2')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0xdb75('0x4')](_0xdb75('0x1f'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xdb75('0x4')](_0xdb75('0x1f'),'no')},'force_avp':{'type':Sequelize[_0xdb75('0x4')](_0xdb75('0x1f'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0xdb75('0x1f'),'no')},'dtlsenable':{'type':Sequelize[_0xdb75('0x4')](_0xdb75('0x1f'),'no')},'dtlsverify':{'type':Sequelize[_0xdb75('0x4')](_0xdb75('0x1f'),'no',_0xdb75('0x29'),'certificate')},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0xdb75('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xdb75('0x2')]},'dtlscipher':{'type':Sequelize[_0xdb75('0x2')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0xdb75('0x4')](_0xdb75('0x2a'),_0xdb75('0x2b'),_0xdb75('0x2c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xdb75('0x2')]},'usereqphone':{'type':Sequelize[_0xdb75('0x4')](_0xdb75('0x1f'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0xdb75('0x2')]},'call_limit':{'type':Sequelize[_0xdb75('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xdb75('0x4')]('yes','no')},'subscribemwi':{'type':Sequelize[_0xdb75('0x4')](_0xdb75('0x1f'),'no')},'vmexten':{'type':Sequelize[_0xdb75('0x2')]},'mohinterpret':{'type':Sequelize[_0xdb75('0x2')]},'mohsuggest':{'type':Sequelize[_0xdb75('0x2')]},'parkinglot':{'type':Sequelize[_0xdb75('0x2')]},'description':{'type':Sequelize[_0xdb75('0x2')]},'host':{'type':Sequelize[_0xdb75('0x2')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0xdb75('0x4')](_0xdb75('0x1f'),'no','nonat',_0xdb75('0x15'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0xdb75('0x2')]},'otherFields':{'type':Sequelize[_0xdb75('0x2')]},'active':{'type':Sequelize[_0xdb75('0x2d')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 8bf872f..4617f12 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 _0x9f62=['updatedAt','body','create','user','role','UserProfileSection','autoAssociation','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','writeFileSync','registry','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','render','/etc/asterisk/sip_xcally_trunks.conf','Reload','server/files/templates/registry.ejs','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','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','json','offset','limit','undefined','count','set','Content-Range','reject','update','destroy','get','Trunks','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','key','map','keys','filters','intersection','query','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','Trunk','findAll','rows','show','params','clone','find','omit','createdAt'];(function(_0x43b4b5,_0x3efc1b){var _0x2df432=function(_0x10b3bb){while(--_0x10b3bb){_0x43b4b5['push'](_0x43b4b5['shift']());}};_0x2df432(++_0x3efc1b);}(_0x9f62,0x154));var _0x29f6=function(_0x4c666e,_0x2a62b1){_0x4c666e=_0x4c666e-0x0;var _0x4d227e=_0x9f62[_0x4c666e];return _0x4d227e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x29f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x29f6('0x1'));var rp=require(_0x29f6('0x2'));var moment=require(_0x29f6('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x29f6('0x4'));var path=require(_0x29f6('0x5'));var sox=require(_0x29f6('0x6'));var csv=require(_0x29f6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x29f6('0x8'));var _=require(_0x29f6('0x9'));var squel=require(_0x29f6('0xa'));var crypto=require(_0x29f6('0xb'));var jsforce=require(_0x29f6('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x29f6('0xd'));var authService=require(_0x29f6('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x29f6('0xf'));var logger=require(_0x29f6('0x10'))('api');var utils=require(_0x29f6('0x11'));var config=require(_0x29f6('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x29f6('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x55cf4,_0x189344,_0x11a1fd,_0x17de6e){return new BPromise(function(_0x156c96,_0x35d2e2){var _0x2418ee=_0x17de6e||client;return _0x2418ee[_0x29f6('0x14')](_0x55cf4,_0x11a1fd)[_0x29f6('0x15')](function(_0x28d314){logger[_0x29f6('0x16')](_0x29f6('0x17'),_0x189344,_0x29f6('0x18'));logger[_0x29f6('0x19')](_0x29f6('0x1a'),_0x189344,_0x29f6('0x18'),JSON['stringify'](_0x28d314));if(_0x28d314['error']){if(_0x28d314[_0x29f6('0x1b')][_0x29f6('0x1c')]===0x1f4){logger[_0x29f6('0x1b')]('Trunk,\x20%s,\x20%s',_0x189344,_0x28d314[_0x29f6('0x1b')][_0x29f6('0x1d')]);return _0x35d2e2(_0x28d314['error'][_0x29f6('0x1d')]);}logger[_0x29f6('0x1b')](_0x29f6('0x17'),_0x189344,_0x28d314[_0x29f6('0x1b')][_0x29f6('0x1d')]);return _0x156c96(_0x28d314[_0x29f6('0x1b')]['message']);}else{logger[_0x29f6('0x16')]('Trunk,\x20%s,\x20%s',_0x189344,'request\x20sent');_0x156c96(_0x28d314[_0x29f6('0x1e')][_0x29f6('0x1d')]);}})[_0x29f6('0x1f')](function(_0xafb5dd){logger['error'](_0x29f6('0x17'),_0x189344,_0xafb5dd);_0x35d2e2(_0xafb5dd);});});}function respondWithStatusCode(_0x49f67d,_0xd4179c){_0xd4179c=_0xd4179c||0xcc;return function(_0xcce041){if(_0xcce041){return _0x49f67d[_0x29f6('0x20')](_0xd4179c);}return _0x49f67d[_0x29f6('0x21')](_0xd4179c)['end']();};}function respondWithResult(_0x4290a2,_0x4d494f){_0x4d494f=_0x4d494f||0xc8;return function(_0x47c385){if(_0x47c385){return _0x4290a2[_0x29f6('0x21')](_0x4d494f)[_0x29f6('0x22')](_0x47c385);}};}function respondWithFilteredResult(_0x2519ac,_0x342038){return function(_0x84ccb7){if(_0x84ccb7){var _0x4333bc=typeof _0x342038[_0x29f6('0x23')]==='undefined'&&typeof _0x342038[_0x29f6('0x24')]===_0x29f6('0x25');var _0x1ab8d8=_0x84ccb7[_0x29f6('0x26')];var _0xda0a63=_0x4333bc?0x0:_0x342038[_0x29f6('0x23')];var _0x3790f5=_0x4333bc?_0x84ccb7[_0x29f6('0x26')]:_0x342038[_0x29f6('0x23')]+_0x342038[_0x29f6('0x24')];var _0x2915bc;if(_0x3790f5>=_0x1ab8d8){_0x3790f5=_0x1ab8d8;_0x2915bc=0xc8;}else{_0x2915bc=0xce;}_0x2519ac[_0x29f6('0x21')](_0x2915bc);return _0x2519ac[_0x29f6('0x27')](_0x29f6('0x28'),_0xda0a63+'-'+_0x3790f5+'/'+_0x1ab8d8)[_0x29f6('0x22')](_0x84ccb7);}return null;};}function patchUpdates(_0x218931){return function(_0x3a7249){try{jsonpatch['apply'](_0x3a7249,_0x218931,!![]);}catch(_0x5582d3){return BPromise[_0x29f6('0x29')](_0x5582d3);}return _0x3a7249['save']();};}function saveUpdates(_0x341071,_0xc8d2c5){return function(_0x1e1bb6){if(_0x1e1bb6){return _0x1e1bb6[_0x29f6('0x2a')](_0x341071)['then'](function(_0x53e11f){return _0x53e11f;});}return null;};}function removeEntity(_0x1bde69,_0xa6377c){return function(_0x2edc2e){if(_0x2edc2e){return _0x2edc2e[_0x29f6('0x2b')]()[_0x29f6('0x15')](function(){var _0x20bc5e=_0x2edc2e[_0x29f6('0x2c')]({'plain':!![]});var _0x1c3f0f=_0x29f6('0x2d');return db[_0x29f6('0x2e')][_0x29f6('0x2b')]({'where':{'type':_0x1c3f0f,'resourceId':_0x20bc5e['id']}})[_0x29f6('0x15')](function(){return _0x2edc2e;});})[_0x29f6('0x15')](function(){_0x1bde69[_0x29f6('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e31dd,_0x206beb){return function(_0x44cf19){if(!_0x44cf19){_0x5e31dd[_0x29f6('0x20')](0x194);}return _0x44cf19;};}function handleError(_0x5416dc,_0x3e1e25){_0x3e1e25=_0x3e1e25||0x1f4;return function(_0x749b9d){logger[_0x29f6('0x1b')](_0x749b9d[_0x29f6('0x2f')]);if(_0x749b9d[_0x29f6('0x30')]){delete _0x749b9d['name'];}_0x5416dc[_0x29f6('0x21')](_0x3e1e25)[_0x29f6('0x31')](_0x749b9d);};}exports[_0x29f6('0x32')]=function(_0x1b51cc,_0x4f5fe1){var _0x30d747={},_0x2a09e8={},_0x14b392={'count':0x0,'rows':[]};var _0x105557=_['map'](db['Trunk'][_0x29f6('0x33')],function(_0x4bfc80){return{'name':_0x4bfc80[_0x29f6('0x34')],'type':_0x4bfc80['type'][_0x29f6('0x35')]};});_0x2a09e8['model']=_[_0x29f6('0x36')](_0x105557,_0x29f6('0x30'));_0x2a09e8['query']=_[_0x29f6('0x37')](_0x1b51cc['query']);_0x2a09e8[_0x29f6('0x38')]=_[_0x29f6('0x39')](_0x2a09e8['model'],_0x2a09e8[_0x29f6('0x3a')]);_0x30d747[_0x29f6('0x3b')]=_[_0x29f6('0x39')](_0x2a09e8[_0x29f6('0x3c')],qs['fields'](_0x1b51cc[_0x29f6('0x3a')][_0x29f6('0x3d')]));_0x30d747[_0x29f6('0x3b')]=_0x30d747[_0x29f6('0x3b')][_0x29f6('0x3e')]?_0x30d747['attributes']:_0x2a09e8[_0x29f6('0x3c')];if(!_0x1b51cc['query'][_0x29f6('0x3f')]('nolimit')){_0x30d747[_0x29f6('0x24')]=qs[_0x29f6('0x24')](_0x1b51cc['query'][_0x29f6('0x24')]);_0x30d747[_0x29f6('0x23')]=qs[_0x29f6('0x23')](_0x1b51cc[_0x29f6('0x3a')]['offset']);}_0x30d747[_0x29f6('0x40')]=qs[_0x29f6('0x41')](_0x1b51cc[_0x29f6('0x3a')]['sort']);_0x30d747[_0x29f6('0x42')]=qs['filters'](_[_0x29f6('0x43')](_0x1b51cc['query'],_0x2a09e8['filters']),_0x105557);if(_0x1b51cc['query'][_0x29f6('0x44')]){_0x30d747[_0x29f6('0x42')]=_[_0x29f6('0x45')](_0x30d747[_0x29f6('0x42')],{'$or':_[_0x29f6('0x36')](_0x105557,function(_0x270842){if(_0x270842[_0x29f6('0x46')]!==_0x29f6('0x47')){var _0x352119={};_0x352119[_0x270842[_0x29f6('0x30')]]={'$like':'%'+_0x1b51cc['query']['filter']+'%'};return _0x352119;}})});}_0x30d747=_[_0x29f6('0x45')]({},_0x30d747,_0x1b51cc[_0x29f6('0x48')]);var _0x7a65c0={'where':_0x30d747[_0x29f6('0x42')]};return db['Trunk'][_0x29f6('0x26')](_0x7a65c0)[_0x29f6('0x15')](function(_0x532df5){_0x14b392[_0x29f6('0x26')]=_0x532df5;if(_0x1b51cc[_0x29f6('0x3a')][_0x29f6('0x49')]){_0x30d747[_0x29f6('0x4a')]=[{'all':!![]}];}return db[_0x29f6('0x4b')][_0x29f6('0x4c')](_0x30d747);})[_0x29f6('0x15')](function(_0x1f03b6){_0x14b392[_0x29f6('0x4d')]=_0x1f03b6;return _0x14b392;})[_0x29f6('0x15')](respondWithFilteredResult(_0x4f5fe1,_0x30d747))[_0x29f6('0x1f')](handleError(_0x4f5fe1,null));};exports[_0x29f6('0x4e')]=function(_0x58ea69,_0x416c24){var _0x463551={'raw':![],'where':{'id':_0x58ea69[_0x29f6('0x4f')]['id']}},_0x335ec1={};_0x335ec1[_0x29f6('0x3c')]=_['keys'](db[_0x29f6('0x4b')]['rawAttributes']);_0x335ec1['query']=_[_0x29f6('0x37')](_0x58ea69[_0x29f6('0x3a')]);_0x335ec1[_0x29f6('0x38')]=_[_0x29f6('0x39')](_0x335ec1[_0x29f6('0x3c')],_0x335ec1['query']);_0x463551[_0x29f6('0x3b')]=_[_0x29f6('0x39')](_0x335ec1['model'],qs[_0x29f6('0x3d')](_0x58ea69['query'][_0x29f6('0x3d')]));_0x463551[_0x29f6('0x3b')]=_0x463551[_0x29f6('0x3b')][_0x29f6('0x3e')]?_0x463551['attributes']:_0x335ec1[_0x29f6('0x3c')];if(_0x58ea69[_0x29f6('0x3a')][_0x29f6('0x49')]){_0x463551[_0x29f6('0x4a')]=[{'all':!![]}];}_0x463551=_[_0x29f6('0x45')]({},_0x463551,_0x58ea69[_0x29f6('0x48')]);return db[_0x29f6('0x4b')]['find'](_0x463551)[_0x29f6('0x15')](handleEntityNotFound(_0x416c24,null))[_0x29f6('0x15')](respondWithResult(_0x416c24,null))[_0x29f6('0x1f')](handleError(_0x416c24,null));};exports[_0x29f6('0x50')]=function(_0x36e52c,_0x1ac20d){var _0x37c3c1={'where':{'id':_0x36e52c[_0x29f6('0x4f')]['id']}},_0x2f356d={};_0x2f356d[_0x29f6('0x3c')]=_['keys'](db['Trunk'][_0x29f6('0x33')]);_0x37c3c1[_0x29f6('0x3b')]=_[_0x29f6('0x39')](_0x2f356d['model'],qs[_0x29f6('0x3d')](_0x36e52c['query']['fields']));_0x37c3c1[_0x29f6('0x3b')]=_0x37c3c1[_0x29f6('0x3b')]['length']?_0x37c3c1['attributes']:_0x2f356d[_0x29f6('0x3c')];if(_0x36e52c[_0x29f6('0x3a')][_0x29f6('0x49')]){_0x37c3c1['include']=[{'all':!![]}];}_0x37c3c1=_[_0x29f6('0x45')]({},_0x37c3c1,_0x36e52c[_0x29f6('0x48')]);return db[_0x29f6('0x4b')][_0x29f6('0x51')](_0x37c3c1)[_0x29f6('0x15')](handleEntityNotFound(_0x1ac20d,null))[_0x29f6('0x15')](function(_0x7700da){if(_0x7700da){var _0x33b1d7=_0x7700da[_0x29f6('0x2c')]({'plain':!![]});_0x33b1d7=qs[_0x29f6('0x52')](_0x33b1d7,['id',_0x29f6('0x53'),_0x29f6('0x54')]);_0x36e52c[_0x29f6('0x55')]=_['omit'](_0x36e52c['body'],['id',_0x29f6('0x53'),'updatedAt']);return db[_0x29f6('0x4b')][_0x29f6('0x56')](_[_0x29f6('0x45')](_0x33b1d7,_0x36e52c[_0x29f6('0x55')]),{'include':_0x36e52c[_0x29f6('0x3a')]['includeAll']?[{'all':!![]}]:undefined})[_0x29f6('0x15')](function(_0x38d684){var _0x2f694e=_0x36e52c[_0x29f6('0x57')][_0x29f6('0x2c')]({'plain':!![]});if(!_0x2f694e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f694e[_0x29f6('0x58')]==='user'){var _0x51b9dc=_0x38d684[_0x29f6('0x2c')]({'plain':!![]});var _0x336b8e='Trunks';return db[_0x29f6('0x59')][_0x29f6('0x51')]({'where':{'name':_0x336b8e,'userProfileId':_0x2f694e['userProfileId']},'raw':!![]})[_0x29f6('0x15')](function(_0x2ba44c){if(_0x2ba44c&&_0x2ba44c[_0x29f6('0x5a')]===0x0){return db[_0x29f6('0x2e')][_0x29f6('0x56')]({'name':_0x51b9dc[_0x29f6('0x30')],'resourceId':_0x51b9dc['id'],'type':_0x2ba44c[_0x29f6('0x30')],'sectionId':_0x2ba44c['id']},{})['then'](function(){return _0x38d684;});}else{return _0x38d684;}})[_0x29f6('0x1f')](function(_0x50ddd6){logger[_0x29f6('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50ddd6);throw _0x50ddd6;});}return _0x38d684;});}})['then'](respondWithResult(_0x1ac20d,0xc9))[_0x29f6('0x1f')](handleError(_0x1ac20d,null));};exports[_0x29f6('0x56')]=function(_0x195887,_0x536b0c,_0x6ae738){var _0x373cf6;return db[_0x29f6('0x4b')]['create'](_0x195887[_0x29f6('0x55')],{'raw':!![]})[_0x29f6('0x15')](function(_0x66a7bb){_0x373cf6=_0x66a7bb;return db[_0x29f6('0x4b')][_0x29f6('0x4c')]({'raw':!![]});})[_0x29f6('0x15')](function(_0x6587f3){var _0x41c1b9=fs['readFileSync'](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x5d')),_0x29f6('0x5e'));var _0x1636f1=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],'server/files/templates/registry.ejs'),_0x29f6('0x5e'));var _0x1ca187=ejs['render'](_0x41c1b9,{'trunks':_0x6587f3||[]});fs[_0x29f6('0x60')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1ca187);if(_0x373cf6[_0x29f6('0x61')]){var _0x5a383f=ejs['render'](_0x1636f1,{'trunks':_0x6587f3||[]});fs[_0x29f6('0x60')](_0x29f6('0x62'),_0x5a383f);}})['then'](function(){return respondWithRpcPromise('Reload','create',{'module':_0x29f6('0x63')});})[_0x29f6('0x15')](function(){var _0x144c76=_0x195887[_0x29f6('0x57')][_0x29f6('0x2c')]({'plain':!![]});if(!_0x144c76)throw new Error(_0x29f6('0x64'));if(_0x144c76[_0x29f6('0x58')]==='user'){var _0x11ef85=_0x373cf6[_0x29f6('0x2c')]({'plain':!![]});return db[_0x29f6('0x59')][_0x29f6('0x51')]({'where':{'name':'Trunks','userProfileId':_0x144c76[_0x29f6('0x65')]},'raw':!![]})[_0x29f6('0x15')](function(_0x32a862){if(_0x32a862&&_0x32a862[_0x29f6('0x5a')]===0x0){return db[_0x29f6('0x2e')]['create']({'name':_0x11ef85[_0x29f6('0x30')],'resourceId':_0x11ef85['id'],'type':_0x32a862[_0x29f6('0x30')],'sectionId':_0x32a862['id']},{})[_0x29f6('0x15')](function(){return _0x373cf6;});}else{return _0x373cf6;}})[_0x29f6('0x1f')](function(_0x4273a3){logger[_0x29f6('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4273a3);throw _0x4273a3;});}return _0x373cf6;})[_0x29f6('0x15')](respondWithResult(_0x536b0c,0xc9))['catch'](handleError(_0x536b0c,null));};exports['update']=function(_0x4f9907,_0x842ae3,_0x5bcf90){var _0x425da2;return db[_0x29f6('0x4b')][_0x29f6('0x51')]({'where':{'id':_0x4f9907[_0x29f6('0x4f')]['id']}})[_0x29f6('0x15')](handleEntityNotFound(_0x842ae3,null))[_0x29f6('0x15')](saveUpdates(_0x4f9907[_0x29f6('0x55')],null))['then'](function(_0x3a23f3){if(_0x3a23f3){_0x425da2=_0x3a23f3;return db['Trunk'][_0x29f6('0x4c')]({'raw':!![]});}})[_0x29f6('0x15')](function(_0x32fa77){if(_0x32fa77){var _0x1d6e32=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x5d')),_0x29f6('0x5e'));var _0xe14459=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config['root'],'server/files/templates/registry.ejs'),'utf8');var _0xa31c7d=ejs[_0x29f6('0x66')](_0x1d6e32,{'trunks':_0x32fa77||[]});fs['writeFileSync'](_0x29f6('0x67'),_0xa31c7d);var _0x57b9fb=ejs[_0x29f6('0x66')](_0xe14459,{'trunks':_0x32fa77||[]});fs[_0x29f6('0x60')](_0x29f6('0x62'),_0x57b9fb);return respondWithRpcPromise(_0x29f6('0x68'),_0x29f6('0x2a'),{'module':_0x29f6('0x63')});}return null;})[_0x29f6('0x15')](function(_0x4203f1){if(_0x4203f1){return _0x425da2;}})[_0x29f6('0x15')](respondWithResult(_0x842ae3,null))[_0x29f6('0x1f')](handleError(_0x842ae3,null));};exports['destroy']=function(_0x1d61ff,_0x4c0acc,_0x16bb3c){var _0x144d8c;return db[_0x29f6('0x4b')][_0x29f6('0x51')]({'where':{'id':_0x1d61ff[_0x29f6('0x4f')]['id']}})[_0x29f6('0x15')](handleEntityNotFound(_0x4c0acc,null))[_0x29f6('0x15')](removeEntity(_0x4c0acc,null))[_0x29f6('0x15')](function(){return db['Trunk'][_0x29f6('0x4c')]({'raw':!![]});})[_0x29f6('0x15')](function(_0x4e185f){var _0x4bb53f=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x5d')),_0x29f6('0x5e'));var _0x906098=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x69')),_0x29f6('0x5e'));var _0x3f51fa=ejs['render'](_0x4bb53f,{'trunks':_0x4e185f});var _0x4b9631=ejs[_0x29f6('0x66')](_0x906098,{'trunks':_0x4e185f});fs[_0x29f6('0x60')]('/etc/asterisk/sip_xcally_trunks.conf',_0x3f51fa);fs[_0x29f6('0x60')](_0x29f6('0x62'),_0x4b9631);return respondWithRpcPromise(_0x29f6('0x68'),_0x29f6('0x2b'),{'module':_0x29f6('0x63')});})[_0x29f6('0x1f')](handleError(_0x4c0acc,null));}; \ No newline at end of file +var _0x008c=['update','destroy','get','Trunks','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','Trunk','findAll','show','params','includeAll','include','options','clone','find','omit','createdAt','updatedAt','body','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','root','utf8','server/files/templates/registry.ejs','render','/etc/asterisk/sip_xcally_trunks.conf','registry','writeFileSync','Reload','chan_sip.so','server/files/templates/trunk.ejs','join','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','Trunk,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save'];(function(_0x2c534a,_0x18a19e){var _0x3f5c99=function(_0x4c085f){while(--_0x4c085f){_0x2c534a['push'](_0x2c534a['shift']());}};_0x3f5c99(++_0x18a19e);}(_0x008c,0x188));var _0xc008=function(_0x5108bf,_0x1e9b2a){_0x5108bf=_0x5108bf-0x0;var _0x343c7e=_0x008c[_0x5108bf];return _0x343c7e;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];var jayson=require(_0xc008('0x18'));var client=jayson[_0xc008('0x19')][_0xc008('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x593f7a,_0x560e28,_0x33f44c,_0x50c1ab){return new BPromise(function(_0x25e13f,_0x4584e1){var _0x2073ef=_0x50c1ab||client;return _0x2073ef[_0xc008('0x1b')](_0x593f7a,_0x33f44c)[_0xc008('0x1c')](function(_0x5ee00b){logger['info']('Trunk,\x20%s,\x20%s',_0x560e28,_0xc008('0x1d'));logger[_0xc008('0x1e')](_0xc008('0x1f'),_0x560e28,_0xc008('0x1d'),JSON['stringify'](_0x5ee00b));if(_0x5ee00b['error']){if(_0x5ee00b['error']['code']===0x1f4){logger[_0xc008('0x20')](_0xc008('0x21'),_0x560e28,_0x5ee00b['error'][_0xc008('0x22')]);return _0x4584e1(_0x5ee00b['error']['message']);}logger['error']('Trunk,\x20%s,\x20%s',_0x560e28,_0x5ee00b[_0xc008('0x20')]['message']);return _0x25e13f(_0x5ee00b['error']['message']);}else{logger['info']('Trunk,\x20%s,\x20%s',_0x560e28,_0xc008('0x1d'));_0x25e13f(_0x5ee00b[_0xc008('0x23')][_0xc008('0x22')]);}})[_0xc008('0x24')](function(_0x11cc75){logger[_0xc008('0x20')]('Trunk,\x20%s,\x20%s',_0x560e28,_0x11cc75);_0x4584e1(_0x11cc75);});});}function respondWithStatusCode(_0x459fd9,_0x5c85f2){_0x5c85f2=_0x5c85f2||0xcc;return function(_0x58a6ea){if(_0x58a6ea){return _0x459fd9[_0xc008('0x25')](_0x5c85f2);}return _0x459fd9[_0xc008('0x26')](_0x5c85f2)[_0xc008('0x27')]();};}function respondWithResult(_0x3cb28c,_0x5410f5){_0x5410f5=_0x5410f5||0xc8;return function(_0x48582b){if(_0x48582b){return _0x3cb28c['status'](_0x5410f5)[_0xc008('0x28')](_0x48582b);}};}function respondWithFilteredResult(_0x15dade,_0x92c582){return function(_0x2e31c2){if(_0x2e31c2){var _0x5bebd9=typeof _0x92c582['offset']==='undefined'&&typeof _0x92c582['limit']==='undefined';var _0x3865c0=_0x2e31c2[_0xc008('0x29')];var _0x25eae4=_0x5bebd9?0x0:_0x92c582['offset'];var _0x24c14c=_0x5bebd9?_0x2e31c2[_0xc008('0x29')]:_0x92c582[_0xc008('0x2a')]+_0x92c582[_0xc008('0x2b')];var _0x4c5dec;if(_0x24c14c>=_0x3865c0){_0x24c14c=_0x3865c0;_0x4c5dec=0xc8;}else{_0x4c5dec=0xce;}_0x15dade[_0xc008('0x26')](_0x4c5dec);return _0x15dade[_0xc008('0x2c')]('Content-Range',_0x25eae4+'-'+_0x24c14c+'/'+_0x3865c0)['json'](_0x2e31c2);}return null;};}function patchUpdates(_0x539766){return function(_0x1032b2){try{jsonpatch[_0xc008('0x2d')](_0x1032b2,_0x539766,!![]);}catch(_0xf831f2){return BPromise[_0xc008('0x2e')](_0xf831f2);}return _0x1032b2[_0xc008('0x2f')]();};}function saveUpdates(_0xceebc3,_0x294f97){return function(_0x22d8e8){if(_0x22d8e8){return _0x22d8e8[_0xc008('0x30')](_0xceebc3)[_0xc008('0x1c')](function(_0x2f4b6b){return _0x2f4b6b;});}return null;};}function removeEntity(_0x1ac7c8,_0x596ee8){return function(_0x334a09){if(_0x334a09){return _0x334a09[_0xc008('0x31')]()['then'](function(){var _0xaf4b84=_0x334a09[_0xc008('0x32')]({'plain':!![]});var _0x383be7=_0xc008('0x33');return db[_0xc008('0x34')][_0xc008('0x31')]({'where':{'type':_0x383be7,'resourceId':_0xaf4b84['id']}})[_0xc008('0x1c')](function(){return _0x334a09;});})[_0xc008('0x1c')](function(){_0x1ac7c8[_0xc008('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x415b87,_0x389a40){return function(_0x459df4){if(!_0x459df4){_0x415b87[_0xc008('0x25')](0x194);}return _0x459df4;};}function handleError(_0x40002f,_0x315562){_0x315562=_0x315562||0x1f4;return function(_0x1667a0){logger['error'](_0x1667a0[_0xc008('0x35')]);if(_0x1667a0[_0xc008('0x36')]){delete _0x1667a0['name'];}_0x40002f[_0xc008('0x26')](_0x315562)[_0xc008('0x37')](_0x1667a0);};}exports['index']=function(_0x263473,_0x2e4ae1){var _0x280e9b={},_0x55ff48={},_0x53b353={'count':0x0,'rows':[]};var _0x478810=_[_0xc008('0x38')](db['Trunk'][_0xc008('0x39')],function(_0x3884dd){return{'name':_0x3884dd[_0xc008('0x3a')],'type':_0x3884dd[_0xc008('0x3b')][_0xc008('0x3c')]};});_0x55ff48[_0xc008('0x3d')]=_[_0xc008('0x38')](_0x478810,_0xc008('0x36'));_0x55ff48[_0xc008('0x3e')]=_[_0xc008('0x3f')](_0x263473[_0xc008('0x3e')]);_0x55ff48[_0xc008('0x40')]=_[_0xc008('0x41')](_0x55ff48[_0xc008('0x3d')],_0x55ff48['query']);_0x280e9b[_0xc008('0x42')]=_[_0xc008('0x41')](_0x55ff48[_0xc008('0x3d')],qs[_0xc008('0x43')](_0x263473['query'][_0xc008('0x43')]));_0x280e9b[_0xc008('0x42')]=_0x280e9b[_0xc008('0x42')][_0xc008('0x44')]?_0x280e9b[_0xc008('0x42')]:_0x55ff48['model'];if(!_0x263473[_0xc008('0x3e')][_0xc008('0x45')](_0xc008('0x46'))){_0x280e9b[_0xc008('0x2b')]=qs[_0xc008('0x2b')](_0x263473['query'][_0xc008('0x2b')]);_0x280e9b[_0xc008('0x2a')]=qs[_0xc008('0x2a')](_0x263473[_0xc008('0x3e')]['offset']);}_0x280e9b[_0xc008('0x47')]=qs[_0xc008('0x48')](_0x263473[_0xc008('0x3e')]['sort']);_0x280e9b[_0xc008('0x49')]=qs['filters'](_[_0xc008('0x4a')](_0x263473['query'],_0x55ff48[_0xc008('0x40')]),_0x478810);if(_0x263473[_0xc008('0x3e')]['filter']){_0x280e9b[_0xc008('0x49')]=_[_0xc008('0x4b')](_0x280e9b[_0xc008('0x49')],{'$or':_['map'](_0x478810,function(_0x1cec64){if(_0x1cec64[_0xc008('0x3b')]!==_0xc008('0x4c')){var _0x44fc5d={};_0x44fc5d[_0x1cec64[_0xc008('0x36')]]={'$like':'%'+_0x263473[_0xc008('0x3e')]['filter']+'%'};return _0x44fc5d;}})});}_0x280e9b=_['merge']({},_0x280e9b,_0x263473['options']);var _0x4552ed={'where':_0x280e9b[_0xc008('0x49')]};return db[_0xc008('0x4d')][_0xc008('0x29')](_0x4552ed)[_0xc008('0x1c')](function(_0x24f6a4){_0x53b353[_0xc008('0x29')]=_0x24f6a4;if(_0x263473[_0xc008('0x3e')]['includeAll']){_0x280e9b['include']=[{'all':!![]}];}return db['Trunk'][_0xc008('0x4e')](_0x280e9b);})[_0xc008('0x1c')](function(_0x158eae){_0x53b353['rows']=_0x158eae;return _0x53b353;})[_0xc008('0x1c')](respondWithFilteredResult(_0x2e4ae1,_0x280e9b))[_0xc008('0x24')](handleError(_0x2e4ae1,null));};exports[_0xc008('0x4f')]=function(_0x1c2c50,_0x4981b4){var _0x56e4ac={'raw':![],'where':{'id':_0x1c2c50[_0xc008('0x50')]['id']}},_0x17ec90={};_0x17ec90[_0xc008('0x3d')]=_[_0xc008('0x3f')](db['Trunk']['rawAttributes']);_0x17ec90[_0xc008('0x3e')]=_['keys'](_0x1c2c50[_0xc008('0x3e')]);_0x17ec90[_0xc008('0x40')]=_[_0xc008('0x41')](_0x17ec90['model'],_0x17ec90[_0xc008('0x3e')]);_0x56e4ac[_0xc008('0x42')]=_[_0xc008('0x41')](_0x17ec90[_0xc008('0x3d')],qs[_0xc008('0x43')](_0x1c2c50['query'][_0xc008('0x43')]));_0x56e4ac[_0xc008('0x42')]=_0x56e4ac['attributes'][_0xc008('0x44')]?_0x56e4ac[_0xc008('0x42')]:_0x17ec90['model'];if(_0x1c2c50['query'][_0xc008('0x51')]){_0x56e4ac[_0xc008('0x52')]=[{'all':!![]}];}_0x56e4ac=_[_0xc008('0x4b')]({},_0x56e4ac,_0x1c2c50[_0xc008('0x53')]);return db[_0xc008('0x4d')]['find'](_0x56e4ac)['then'](handleEntityNotFound(_0x4981b4,null))[_0xc008('0x1c')](respondWithResult(_0x4981b4,null))['catch'](handleError(_0x4981b4,null));};exports[_0xc008('0x54')]=function(_0x25d351,_0xf94fcb){var _0x2f1105={'where':{'id':_0x25d351[_0xc008('0x50')]['id']}},_0x44f42d={};_0x44f42d['model']=_[_0xc008('0x3f')](db[_0xc008('0x4d')][_0xc008('0x39')]);_0x2f1105[_0xc008('0x42')]=_[_0xc008('0x41')](_0x44f42d['model'],qs[_0xc008('0x43')](_0x25d351['query']['fields']));_0x2f1105['attributes']=_0x2f1105[_0xc008('0x42')][_0xc008('0x44')]?_0x2f1105[_0xc008('0x42')]:_0x44f42d['model'];if(_0x25d351[_0xc008('0x3e')][_0xc008('0x51')]){_0x2f1105[_0xc008('0x52')]=[{'all':!![]}];}_0x2f1105=_['merge']({},_0x2f1105,_0x25d351[_0xc008('0x53')]);return db[_0xc008('0x4d')][_0xc008('0x55')](_0x2f1105)[_0xc008('0x1c')](handleEntityNotFound(_0xf94fcb,null))['then'](function(_0x4022dd){if(_0x4022dd){var _0x4eaa6d=_0x4022dd[_0xc008('0x32')]({'plain':!![]});_0x4eaa6d=qs[_0xc008('0x56')](_0x4eaa6d,['id',_0xc008('0x57'),_0xc008('0x58')]);_0x25d351[_0xc008('0x59')]=_[_0xc008('0x56')](_0x25d351['body'],['id',_0xc008('0x57'),'updatedAt']);return db['Trunk'][_0xc008('0x5a')](_[_0xc008('0x4b')](_0x4eaa6d,_0x25d351['body']),{'include':_0x25d351[_0xc008('0x3e')][_0xc008('0x51')]?[{'all':!![]}]:undefined})[_0xc008('0x1c')](function(_0x4517c0){var _0x21ee6d=_0x25d351[_0xc008('0x5b')][_0xc008('0x32')]({'plain':!![]});if(!_0x21ee6d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x21ee6d[_0xc008('0x5c')]===_0xc008('0x5b')){var _0x3bfb15=_0x4517c0[_0xc008('0x32')]({'plain':!![]});var _0xb3ca0f=_0xc008('0x33');return db[_0xc008('0x5d')][_0xc008('0x55')]({'where':{'name':_0xb3ca0f,'userProfileId':_0x21ee6d[_0xc008('0x5e')]},'raw':!![]})[_0xc008('0x1c')](function(_0x1bef66){if(_0x1bef66&&_0x1bef66[_0xc008('0x5f')]===0x0){return db[_0xc008('0x34')][_0xc008('0x5a')]({'name':_0x3bfb15['name'],'resourceId':_0x3bfb15['id'],'type':_0x1bef66[_0xc008('0x36')],'sectionId':_0x1bef66['id']},{})[_0xc008('0x1c')](function(){return _0x4517c0;});}else{return _0x4517c0;}})[_0xc008('0x24')](function(_0x566dea){logger[_0xc008('0x20')](_0xc008('0x60'),_0x566dea);throw _0x566dea;});}return _0x4517c0;});}})['then'](respondWithResult(_0xf94fcb,0xc9))['catch'](handleError(_0xf94fcb,null));};exports[_0xc008('0x5a')]=function(_0x2a4c2b,_0x7bad14,_0x39083c){var _0x1a2ce7;return db[_0xc008('0x4d')][_0xc008('0x5a')](_0x2a4c2b[_0xc008('0x59')],{'raw':!![]})[_0xc008('0x1c')](function(_0x1b059b){_0x1a2ce7=_0x1b059b;return db[_0xc008('0x4d')]['findAll']({'raw':!![]});})[_0xc008('0x1c')](function(_0x25a52b){var _0xfdb5e3=fs[_0xc008('0x61')](path['join'](config[_0xc008('0x62')],'server/files/templates/trunk.ejs'),_0xc008('0x63'));var _0x46fa7b=fs[_0xc008('0x61')](path['join'](config[_0xc008('0x62')],_0xc008('0x64')),_0xc008('0x63'));var _0x553f5c=ejs[_0xc008('0x65')](_0xfdb5e3,{'trunks':_0x25a52b||[]});fs['writeFileSync'](_0xc008('0x66'),_0x553f5c);if(_0x1a2ce7[_0xc008('0x67')]){var _0x23012c=ejs[_0xc008('0x65')](_0x46fa7b,{'trunks':_0x25a52b||[]});fs[_0xc008('0x68')]('/etc/asterisk/sip_xcally_registers.conf',_0x23012c);}})[_0xc008('0x1c')](function(){return respondWithRpcPromise(_0xc008('0x69'),'create',{'module':_0xc008('0x6a')});})['then'](function(){var _0x278cbe=_0x2a4c2b['user'][_0xc008('0x32')]({'plain':!![]});if(!_0x278cbe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x278cbe[_0xc008('0x5c')]===_0xc008('0x5b')){var _0x33d8e4=_0x1a2ce7[_0xc008('0x32')]({'plain':!![]});return db['UserProfileSection'][_0xc008('0x55')]({'where':{'name':_0xc008('0x33'),'userProfileId':_0x278cbe[_0xc008('0x5e')]},'raw':!![]})[_0xc008('0x1c')](function(_0x321500){if(_0x321500&&_0x321500[_0xc008('0x5f')]===0x0){return db[_0xc008('0x34')][_0xc008('0x5a')]({'name':_0x33d8e4['name'],'resourceId':_0x33d8e4['id'],'type':_0x321500[_0xc008('0x36')],'sectionId':_0x321500['id']},{})['then'](function(){return _0x1a2ce7;});}else{return _0x1a2ce7;}})['catch'](function(_0x4c84da){logger[_0xc008('0x20')](_0xc008('0x60'),_0x4c84da);throw _0x4c84da;});}return _0x1a2ce7;})[_0xc008('0x1c')](respondWithResult(_0x7bad14,0xc9))[_0xc008('0x24')](handleError(_0x7bad14,null));};exports[_0xc008('0x30')]=function(_0x2e9646,_0x23ef42,_0x519328){var _0x127bdf;return db['Trunk'][_0xc008('0x55')]({'where':{'id':_0x2e9646[_0xc008('0x50')]['id']}})[_0xc008('0x1c')](handleEntityNotFound(_0x23ef42,null))[_0xc008('0x1c')](saveUpdates(_0x2e9646[_0xc008('0x59')],null))[_0xc008('0x1c')](function(_0x23d4ff){if(_0x23d4ff){_0x127bdf=_0x23d4ff;return db[_0xc008('0x4d')][_0xc008('0x4e')]({'raw':!![]});}})[_0xc008('0x1c')](function(_0x334ed8){if(_0x334ed8){var _0x1dd9fe=fs['readFileSync'](path['join'](config[_0xc008('0x62')],_0xc008('0x6b')),_0xc008('0x63'));var _0x572d93=fs[_0xc008('0x61')](path[_0xc008('0x6c')](config['root'],'server/files/templates/registry.ejs'),'utf8');var _0x3fc44f=ejs[_0xc008('0x65')](_0x1dd9fe,{'trunks':_0x334ed8||[]});fs[_0xc008('0x68')](_0xc008('0x66'),_0x3fc44f);var _0x1101b8=ejs[_0xc008('0x65')](_0x572d93,{'trunks':_0x334ed8||[]});fs[_0xc008('0x68')](_0xc008('0x6d'),_0x1101b8);return respondWithRpcPromise(_0xc008('0x69'),_0xc008('0x30'),{'module':'chan_sip.so'});}return null;})['then'](function(_0xc644fe){if(_0xc644fe){return _0x127bdf;}})[_0xc008('0x1c')](respondWithResult(_0x23ef42,null))[_0xc008('0x24')](handleError(_0x23ef42,null));};exports[_0xc008('0x31')]=function(_0x2b94b2,_0x37fc2c,_0x4b434f){var _0x5794fe;return db[_0xc008('0x4d')][_0xc008('0x55')]({'where':{'id':_0x2b94b2[_0xc008('0x50')]['id']}})['then'](handleEntityNotFound(_0x37fc2c,null))['then'](removeEntity(_0x37fc2c,null))['then'](function(){return db['Trunk']['findAll']({'raw':!![]});})['then'](function(_0x276de2){var _0x52bf60=fs[_0xc008('0x61')](path['join'](config[_0xc008('0x62')],_0xc008('0x6b')),_0xc008('0x63'));var _0x5bc8b0=fs['readFileSync'](path[_0xc008('0x6c')](config['root'],_0xc008('0x64')),_0xc008('0x63'));var _0x544519=ejs[_0xc008('0x65')](_0x52bf60,{'trunks':_0x276de2});var _0x4db90b=ejs['render'](_0x5bc8b0,{'trunks':_0x276de2});fs[_0xc008('0x68')](_0xc008('0x66'),_0x544519);fs['writeFileSync'](_0xc008('0x6d'),_0x4db90b);return respondWithRpcPromise(_0xc008('0x69'),_0xc008('0x31'),{'module':'chan_sip.so'});})[_0xc008('0x24')](handleError(_0x37fc2c,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 7a369c4..4e65264 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 _0x4323=['util','api','moment','bluebird','request-promise','path','./trunk.attributes','exports','define','Trunk'];(function(_0x3eff53,_0x487d6b){var _0x26844d=function(_0x316b2a){while(--_0x316b2a){_0x3eff53['push'](_0x3eff53['shift']());}};_0x26844d(++_0x487d6b);}(_0x4323,0x190));var _0x3432=function(_0x110d8c,_0xba39b8){_0x110d8c=_0x110d8c-0x0;var _0x152de0=_0x4323[_0x110d8c];return _0x152de0;};'use strict';var _=require('lodash');var util=require(_0x3432('0x0'));var logger=require('../../config/logger')(_0x3432('0x1'));var moment=require(_0x3432('0x2'));var BPromise=require(_0x3432('0x3'));var rp=require(_0x3432('0x4'));var fs=require('fs');var path=require(_0x3432('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3432('0x6'));module[_0x3432('0x7')]=function(_0x6c77a3,_0x5ae8ea){return _0x6c77a3[_0x3432('0x8')](_0x3432('0x9'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x35f4=['rimraf','../../config/environment','./trunk.attributes','define','tools_trunks','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x42911f,_0xea437a){var _0xe7c3b=function(_0x304670){while(--_0x304670){_0x42911f['push'](_0x42911f['shift']());}};_0xe7c3b(++_0xea437a);}(_0x35f4,0x102));var _0x435f=function(_0x4fda88,_0x1a4d19){_0x4fda88=_0x4fda88-0x0;var _0xe37511=_0x35f4[_0x4fda88];return _0xe37511;};'use strict';var _=require(_0x435f('0x0'));var util=require('util');var logger=require(_0x435f('0x1'))('api');var moment=require(_0x435f('0x2'));var BPromise=require(_0x435f('0x3'));var rp=require(_0x435f('0x4'));var fs=require('fs');var path=require(_0x435f('0x5'));var rimraf=require(_0x435f('0x6'));var config=require(_0x435f('0x7'));var attributes=require(_0x435f('0x8'));module['exports']=function(_0x5204c0,_0x31d6c){return _0x5204c0[_0x435f('0x9')]('Trunk',attributes,{'tableName':_0x435f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 611e212..3832a16 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 _0xa270=['limit','include','map','attributes','model','then','stringify','ShowTrunk','Trunk','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetTrunk','options','raw'];(function(_0xf2726b,_0x87deb7){var _0xa61a5=function(_0x27759c){while(--_0x27759c){_0xf2726b['push'](_0xf2726b['shift']());}};_0xa61a5(++_0x87deb7);}(_0xa270,0x1de));var _0x0a27=function(_0x2a92bd,_0x471ddd){_0x2a92bd=_0x2a92bd-0x0;var _0x552c5d=_0xa270[_0x2a92bd];return _0x552c5d;};'use strict';var _=require(_0x0a27('0x0'));var util=require(_0x0a27('0x1'));var moment=require(_0x0a27('0x2'));var BPromise=require('bluebird');var rs=require(_0x0a27('0x3'));var fs=require('fs');var Redis=require(_0x0a27('0x4'));var db=require(_0x0a27('0x5'))['db'];var utils=require(_0x0a27('0x6'));var logger=require(_0x0a27('0x7'))(_0x0a27('0x8'));var config=require(_0x0a27('0x9'));var jayson=require(_0x0a27('0xa'));var client=jayson[_0x0a27('0xb')][_0x0a27('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5c32bf,_0x2d37f2,_0x584f4a){return new BPromise(function(_0x4be786,_0x1f7905){return client[_0x0a27('0xd')](_0x5c32bf,_0x584f4a)['then'](function(_0x5bbe8f){logger[_0x0a27('0xe')](_0x0a27('0xf'),_0x2d37f2,_0x0a27('0x10'));logger[_0x0a27('0x11')]('Trunk,\x20%s,\x20%s,\x20%s',_0x2d37f2,_0x0a27('0x10'),JSON['stringify'](_0x5bbe8f));if(_0x5bbe8f[_0x0a27('0x12')]){if(_0x5bbe8f['error'][_0x0a27('0x13')]===0x1f4){logger[_0x0a27('0x12')]('Trunk,\x20%s,\x20%s',_0x2d37f2,_0x5bbe8f[_0x0a27('0x12')]['message']);return _0x1f7905(_0x5bbe8f['error'][_0x0a27('0x14')]);}logger[_0x0a27('0x12')]('Trunk,\x20%s,\x20%s',_0x2d37f2,_0x5bbe8f[_0x0a27('0x12')]['message']);return _0x4be786(_0x5bbe8f[_0x0a27('0x12')][_0x0a27('0x14')]);}else{logger[_0x0a27('0xe')](_0x0a27('0xf'),_0x2d37f2,_0x0a27('0x10'));_0x4be786(_0x5bbe8f[_0x0a27('0x15')][_0x0a27('0x14')]);}})[_0x0a27('0x16')](function(_0x3f35d9){logger[_0x0a27('0x12')](_0x0a27('0xf'),_0x2d37f2,_0x3f35d9);_0x1f7905(_0x3f35d9);});});}exports[_0x0a27('0x17')]=function(_0x2af698){var _0x213b81=this;return new Promise(function(_0x21bc0d,_0x142061){return db['Trunk']['findAll']({'raw':_0x2af698[_0x0a27('0x18')]?_0x2af698[_0x0a27('0x18')][_0x0a27('0x19')]===undefined?!![]:![]:!![],'where':_0x2af698[_0x0a27('0x18')]?_0x2af698['options']['where']||null:null,'attributes':_0x2af698[_0x0a27('0x18')]?_0x2af698[_0x0a27('0x18')]['attributes']||null:null,'limit':_0x2af698['options']?_0x2af698[_0x0a27('0x18')][_0x0a27('0x1a')]||null:null,'include':_0x2af698['options']?_0x2af698['options'][_0x0a27('0x1b')]?_[_0x0a27('0x1c')](_0x2af698[_0x0a27('0x18')][_0x0a27('0x1b')],function(_0x1fdf35){return{'model':db[_0x1fdf35['model']],'as':_0x1fdf35['as'],'attributes':_0x1fdf35[_0x0a27('0x1d')],'include':_0x1fdf35[_0x0a27('0x1b')]?_[_0x0a27('0x1c')](_0x1fdf35[_0x0a27('0x1b')],function(_0xfba9a1){return{'model':db[_0xfba9a1[_0x0a27('0x1e')]],'as':_0xfba9a1['as'],'attributes':_0xfba9a1[_0x0a27('0x1d')],'include':_0xfba9a1['include']?_[_0x0a27('0x1c')](_0xfba9a1['include'],function(_0x5d3a32){return{'model':db[_0x5d3a32[_0x0a27('0x1e')]],'as':_0x5d3a32['as'],'attributes':_0x5d3a32[_0x0a27('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0a27('0x1f')](function(_0x2b0019){logger[_0x0a27('0xe')](_0x0a27('0x17'),_0x2af698);logger[_0x0a27('0x11')](_0x0a27('0x17'),_0x2af698,JSON[_0x0a27('0x20')](_0x2b0019));_0x21bc0d(_0x2b0019);})[_0x0a27('0x16')](function(_0x9ad028){logger[_0x0a27('0x12')](_0x0a27('0x17'),_0x9ad028[_0x0a27('0x14')],_0x2af698);_0x142061(_0x213b81[_0x0a27('0x12')](0x1f4,_0x9ad028[_0x0a27('0x14')]));});});};exports[_0x0a27('0x21')]=function(_0x28f3e1){var _0x2792bf=this;return new Promise(function(_0x7b69fa,_0x454fe9){return db[_0x0a27('0x22')][_0x0a27('0x23')]({'raw':_0x28f3e1[_0x0a27('0x18')]?_0x28f3e1[_0x0a27('0x18')][_0x0a27('0x19')]===undefined?!![]:![]:!![],'where':_0x28f3e1[_0x0a27('0x18')]?_0x28f3e1['options']['where']||null:null,'attributes':_0x28f3e1[_0x0a27('0x18')]?_0x28f3e1[_0x0a27('0x18')][_0x0a27('0x1d')]||null:null,'include':_0x28f3e1[_0x0a27('0x18')]?_0x28f3e1['options'][_0x0a27('0x1b')]?_['map'](_0x28f3e1['options'][_0x0a27('0x1b')],function(_0x5a3b7e){return{'model':db[_0x5a3b7e[_0x0a27('0x1e')]],'as':_0x5a3b7e['as'],'attributes':_0x5a3b7e[_0x0a27('0x1d')],'include':_0x5a3b7e[_0x0a27('0x1b')]?_[_0x0a27('0x1c')](_0x5a3b7e[_0x0a27('0x1b')],function(_0x5186f9){return{'model':db[_0x5186f9[_0x0a27('0x1e')]],'as':_0x5186f9['as'],'attributes':_0x5186f9[_0x0a27('0x1d')],'include':_0x5186f9['include']?_[_0x0a27('0x1c')](_0x5186f9[_0x0a27('0x1b')],function(_0x1da2c9){return{'model':db[_0x1da2c9[_0x0a27('0x1e')]],'as':_0x1da2c9['as'],'attributes':_0x1da2c9[_0x0a27('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x59b096){logger['info']('ShowTrunk',_0x28f3e1);logger[_0x0a27('0x11')](_0x0a27('0x21'),_0x28f3e1,JSON['stringify'](_0x59b096));_0x7b69fa(_0x59b096);})['catch'](function(_0x4f4b77){logger[_0x0a27('0x12')](_0x0a27('0x21'),_0x4f4b77[_0x0a27('0x14')],_0x28f3e1);_0x454fe9(_0x2792bf[_0x0a27('0x12')](0x1f4,_0x4f4b77[_0x0a27('0x14')]));});});}; \ No newline at end of file +var _0x66ae=['model','ShowTrunk','find','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetTrunk','Trunk','findAll','options','raw','attributes','limit','include','map'];(function(_0x408200,_0x330d05){var _0x57c693=function(_0x10fca8){while(--_0x10fca8){_0x408200['push'](_0x408200['shift']());}};_0x57c693(++_0x330d05);}(_0x66ae,0x11c));var _0xe66a=function(_0x213187,_0x11df6e){_0x213187=_0x213187-0x0;var _0x542d9a=_0x66ae[_0x213187];return _0x542d9a;};'use strict';var _=require(_0xe66a('0x0'));var util=require(_0xe66a('0x1'));var moment=require(_0xe66a('0x2'));var BPromise=require(_0xe66a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe66a('0x4'));var db=require(_0xe66a('0x5'))['db'];var utils=require(_0xe66a('0x6'));var logger=require('../../config/logger')(_0xe66a('0x7'));var config=require('../../config/environment');var jayson=require(_0xe66a('0x8'));var client=jayson[_0xe66a('0x9')][_0xe66a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f113a,_0x55629d,_0x5b79b9){return new BPromise(function(_0x1037cf,_0xcd2410){return client[_0xe66a('0xb')](_0x1f113a,_0x5b79b9)['then'](function(_0x45ef7c){logger[_0xe66a('0xc')]('Trunk,\x20%s,\x20%s',_0x55629d,'request\x20sent');logger[_0xe66a('0xd')](_0xe66a('0xe'),_0x55629d,'request\x20sent',JSON[_0xe66a('0xf')](_0x45ef7c));if(_0x45ef7c[_0xe66a('0x10')]){if(_0x45ef7c['error'][_0xe66a('0x11')]===0x1f4){logger[_0xe66a('0x10')]('Trunk,\x20%s,\x20%s',_0x55629d,_0x45ef7c[_0xe66a('0x10')][_0xe66a('0x12')]);return _0xcd2410(_0x45ef7c[_0xe66a('0x10')][_0xe66a('0x12')]);}logger[_0xe66a('0x10')]('Trunk,\x20%s,\x20%s',_0x55629d,_0x45ef7c['error'][_0xe66a('0x12')]);return _0x1037cf(_0x45ef7c[_0xe66a('0x10')][_0xe66a('0x12')]);}else{logger[_0xe66a('0xc')]('Trunk,\x20%s,\x20%s',_0x55629d,_0xe66a('0x13'));_0x1037cf(_0x45ef7c[_0xe66a('0x14')][_0xe66a('0x12')]);}})[_0xe66a('0x15')](function(_0x293746){logger[_0xe66a('0x10')]('Trunk,\x20%s,\x20%s',_0x55629d,_0x293746);_0xcd2410(_0x293746);});});}exports[_0xe66a('0x16')]=function(_0x4975be){var _0x216c0e=this;return new Promise(function(_0x55562d,_0x5e4456){return db[_0xe66a('0x17')][_0xe66a('0x18')]({'raw':_0x4975be[_0xe66a('0x19')]?_0x4975be[_0xe66a('0x19')][_0xe66a('0x1a')]===undefined?!![]:![]:!![],'where':_0x4975be[_0xe66a('0x19')]?_0x4975be[_0xe66a('0x19')]['where']||null:null,'attributes':_0x4975be['options']?_0x4975be[_0xe66a('0x19')][_0xe66a('0x1b')]||null:null,'limit':_0x4975be[_0xe66a('0x19')]?_0x4975be[_0xe66a('0x19')][_0xe66a('0x1c')]||null:null,'include':_0x4975be[_0xe66a('0x19')]?_0x4975be['options'][_0xe66a('0x1d')]?_[_0xe66a('0x1e')](_0x4975be['options'][_0xe66a('0x1d')],function(_0x2d3f68){return{'model':db[_0x2d3f68['model']],'as':_0x2d3f68['as'],'attributes':_0x2d3f68['attributes'],'include':_0x2d3f68['include']?_['map'](_0x2d3f68[_0xe66a('0x1d')],function(_0x38aae7){return{'model':db[_0x38aae7[_0xe66a('0x1f')]],'as':_0x38aae7['as'],'attributes':_0x38aae7['attributes'],'include':_0x38aae7['include']?_[_0xe66a('0x1e')](_0x38aae7['include'],function(_0xdbea46){return{'model':db[_0xdbea46['model']],'as':_0xdbea46['as'],'attributes':_0xdbea46['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4cd9b2){logger['info'](_0xe66a('0x16'),_0x4975be);logger[_0xe66a('0xd')]('GetTrunk',_0x4975be,JSON[_0xe66a('0xf')](_0x4cd9b2));_0x55562d(_0x4cd9b2);})[_0xe66a('0x15')](function(_0x2eb66c){logger[_0xe66a('0x10')](_0xe66a('0x16'),_0x2eb66c[_0xe66a('0x12')],_0x4975be);_0x5e4456(_0x216c0e[_0xe66a('0x10')](0x1f4,_0x2eb66c[_0xe66a('0x12')]));});});};exports[_0xe66a('0x20')]=function(_0x41af31){var _0x3db5fd=this;return new Promise(function(_0x5691c6,_0x2cd043){return db[_0xe66a('0x17')][_0xe66a('0x21')]({'raw':_0x41af31[_0xe66a('0x19')]?_0x41af31[_0xe66a('0x19')][_0xe66a('0x1a')]===undefined?!![]:![]:!![],'where':_0x41af31['options']?_0x41af31[_0xe66a('0x19')]['where']||null:null,'attributes':_0x41af31[_0xe66a('0x19')]?_0x41af31[_0xe66a('0x19')][_0xe66a('0x1b')]||null:null,'include':_0x41af31[_0xe66a('0x19')]?_0x41af31[_0xe66a('0x19')][_0xe66a('0x1d')]?_[_0xe66a('0x1e')](_0x41af31[_0xe66a('0x19')]['include'],function(_0x42b82c){return{'model':db[_0x42b82c[_0xe66a('0x1f')]],'as':_0x42b82c['as'],'attributes':_0x42b82c['attributes'],'include':_0x42b82c[_0xe66a('0x1d')]?_[_0xe66a('0x1e')](_0x42b82c[_0xe66a('0x1d')],function(_0x15cc63){return{'model':db[_0x15cc63[_0xe66a('0x1f')]],'as':_0x15cc63['as'],'attributes':_0x15cc63['attributes'],'include':_0x15cc63['include']?_[_0xe66a('0x1e')](_0x15cc63[_0xe66a('0x1d')],function(_0x13144a){return{'model':db[_0x13144a[_0xe66a('0x1f')]],'as':_0x13144a['as'],'attributes':_0x13144a[_0xe66a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe66a('0x22')](function(_0x4bbb2d){logger[_0xe66a('0xc')]('ShowTrunk',_0x41af31);logger[_0xe66a('0xd')](_0xe66a('0x20'),_0x41af31,JSON[_0xe66a('0xf')](_0x4bbb2d));_0x5691c6(_0x4bbb2d);})[_0xe66a('0x15')](function(_0x672a7){logger[_0xe66a('0x10')]('ShowTrunk',_0x672a7[_0xe66a('0x12')],_0x41af31);_0x2cd043(_0x3db5fd[_0xe66a('0x10')](0x1f4,_0x672a7[_0xe66a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 551f99b..c1460f3 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 _0x2142=['Router','../../components/auth/service','./user-setting.controller','/:id','isAuthenticated','update','exports','express'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x2142,0x1e7));var _0x2214=function(_0x3488e1,_0x5bcc18){_0x3488e1=_0x3488e1-0x0;var _0x4845ac=_0x2142[_0x3488e1];return _0x4845ac;};'use strict';var express=require(_0x2214('0x0'));var router=express[_0x2214('0x1')]();var auth=require(_0x2214('0x2'));var controller=require(_0x2214('0x3'));router['put'](_0x2214('0x4'),auth[_0x2214('0x5')](),controller[_0x2214('0x6')]);module[_0x2214('0x7')]=router; \ No newline at end of file +var _0x2190=['exports','express','Router','put','isAuthenticated','update'];(function(_0x46a56d,_0x1e0da6){var _0x4eb0f0=function(_0x4bebec){while(--_0x4bebec){_0x46a56d['push'](_0x46a56d['shift']());}};_0x4eb0f0(++_0x1e0da6);}(_0x2190,0xc1));var _0x0219=function(_0x17cccf,_0x4bc109){_0x17cccf=_0x17cccf-0x0;var _0x36f8f1=_0x2190[_0x17cccf];return _0x36f8f1;};'use strict';var express=require(_0x0219('0x0'));var router=express[_0x0219('0x1')]();var auth=require('../../components/auth/service');var controller=require('./user-setting.controller');router[_0x0219('0x2')]('/:id',auth[_0x0219('0x3')](),controller[_0x0219('0x4')]);module[_0x0219('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 9a43cdf..e2df008 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 _0x36ff=['UserId','sequelize','warning','debug','ENUM','BOOLEAN','TEXT','DATE','INTEGER'];(function(_0x10d536,_0x5b84ab){var _0x1f2341=function(_0x3e695a){while(--_0x3e695a){_0x10d536['push'](_0x10d536['shift']());}};_0x1f2341(++_0x5b84ab);}(_0x36ff,0x1a8));var _0xf36f=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x36ff[_0x46aff0];return _0x9d78cf;};'use strict';var Sequelize=require(_0xf36f('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0xf36f('0x1'),'info',_0xf36f('0x2')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0xf36f('0x3')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xf36f('0x4')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xf36f('0x5')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xf36f('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xf36f('0x7')],'unique':_0xf36f('0x8')}}; \ No newline at end of file +var _0x1965=['BOOLEAN','TEXT','DATE','sequelize','error','warning','info','debug','exports','ENUM'];(function(_0x1c0bbe,_0x4977c8){var _0x224bec=function(_0x7c427f){while(--_0x7c427f){_0x1c0bbe['push'](_0x1c0bbe['shift']());}};_0x224bec(++_0x4977c8);}(_0x1965,0xd5));var _0x5196=function(_0x3ad592,_0x1f624d){_0x3ad592=_0x3ad592-0x0;var _0x3909d7=_0x1965[_0x3ad592];return _0x3909d7;};'use strict';var Sequelize=require(_0x5196('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x5196('0x1'),_0x5196('0x2'),_0x5196('0x3'),_0x5196('0x4')];module[_0x5196('0x5')]={'clientSideLoggingLevel':{'type':Sequelize[_0x5196('0x6')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x5196('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x5196('0x7')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x5196('0x8')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x5196('0x9')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':'UserId'}}; \ 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 8ba1318..b8de68f 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 _0x3b75=['socket.io-emitter','./user-setting.socket','redis','defaults','localhost','status','json','then','sendStatus','error','stack','name','send','update','user','params','Invalid\x20user\x20setting\x20id','UserSetting','body','catch','lodash','ioredis','../../config/logger','api','../../config/environment'];(function(_0xa388a2,_0x40bde6){var _0x7ce7f6=function(_0x5a242a){while(--_0x5a242a){_0xa388a2['push'](_0xa388a2['shift']());}};_0x7ce7f6(++_0x40bde6);}(_0x3b75,0xdc));var _0x53b7=function(_0x404957,_0x5192a4){_0x404957=_0x404957-0x0;var _0x4e0365=_0x3b75[_0x404957];return _0x4e0365;};'use strict';var _=require(_0x53b7('0x0'));var Redis=require(_0x53b7('0x1'));var logger=require(_0x53b7('0x2'))(_0x53b7('0x3'));var config=require(_0x53b7('0x4'));var db=require('../../mysqldb')['db'];var socket=require(_0x53b7('0x5'))(new Redis(config['redis']));require(_0x53b7('0x6'))['register'](socket);config[_0x53b7('0x7')]=_[_0x53b7('0x8')](config[_0x53b7('0x7')],{'host':_0x53b7('0x9'),'port':0x18eb});function respondWithResult(_0x7e5139,_0x5ee630){_0x5ee630=_0x5ee630||0xc8;return function(_0x1f89b7){if(_0x1f89b7){return _0x7e5139[_0x53b7('0xa')](_0x5ee630)[_0x53b7('0xb')](_0x1f89b7);}};}function saveUpdates(_0x509608){return function(_0x1f438f){if(_0x1f438f){return _0x1f438f['update'](_0x509608)[_0x53b7('0xc')](function(_0x3b358e){return _0x3b358e;});}return null;};}function handleEntityNotFound(_0x2fa631){return function(_0x3dae32){if(!_0x3dae32){_0x2fa631[_0x53b7('0xd')](0x194);}return _0x3dae32;};}function handleError(_0x5438cb,_0x387f1e){_0x387f1e=_0x387f1e||0x1f4;return function(_0x340aba){logger[_0x53b7('0xe')](_0x340aba[_0x53b7('0xf')]);if(_0x340aba[_0x53b7('0x10')]){delete _0x340aba[_0x53b7('0x10')];}_0x5438cb[_0x53b7('0xa')](_0x387f1e)[_0x53b7('0x11')](_0x340aba);};}exports[_0x53b7('0x12')]=function(_0x47a9e6,_0xee6476){if(_0x47a9e6[_0x53b7('0x13')]['role']!=='admin')throw new Error('Unauthorized');if(isNaN(Number(_0x47a9e6[_0x53b7('0x14')]['id'])))throw new Error(_0x53b7('0x15'));return db[_0x53b7('0x16')]['find']({'where':{'id':_0x47a9e6[_0x53b7('0x14')]['id']}})[_0x53b7('0xc')](handleEntityNotFound(_0xee6476,null))[_0x53b7('0xc')](saveUpdates(_0x47a9e6[_0x53b7('0x17')],null))[_0x53b7('0xc')](respondWithResult(_0xee6476,null))[_0x53b7('0x18')](handleError(_0xee6476,null));}; \ No newline at end of file +var _0x00bb=['name','send','update','user','role','Unauthorized','params','find','body','catch','lodash','ioredis','../../config/logger','../../config/environment','socket.io-emitter','redis','register','status','json','then','sendStatus'];(function(_0xe50e1,_0x30bf72){var _0x441f9a=function(_0x40ac92){while(--_0x40ac92){_0xe50e1['push'](_0xe50e1['shift']());}};_0x441f9a(++_0x30bf72);}(_0x00bb,0x1d8));var _0xb00b=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x00bb[_0x42245d];return _0x4b211a;};'use strict';var _=require(_0xb00b('0x0'));var Redis=require(_0xb00b('0x1'));var logger=require(_0xb00b('0x2'))('api');var config=require(_0xb00b('0x3'));var db=require('../../mysqldb')['db'];var socket=require(_0xb00b('0x4'))(new Redis(config[_0xb00b('0x5')]));require('./user-setting.socket')[_0xb00b('0x6')](socket);config[_0xb00b('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});function respondWithResult(_0x36e363,_0xf737d0){_0xf737d0=_0xf737d0||0xc8;return function(_0x41dfc9){if(_0x41dfc9){return _0x36e363[_0xb00b('0x7')](_0xf737d0)[_0xb00b('0x8')](_0x41dfc9);}};}function saveUpdates(_0x3c36c5){return function(_0x5b0c03){if(_0x5b0c03){return _0x5b0c03['update'](_0x3c36c5)[_0xb00b('0x9')](function(_0x1e9b7b){return _0x1e9b7b;});}return null;};}function handleEntityNotFound(_0x5851d4){return function(_0x46a25c){if(!_0x46a25c){_0x5851d4[_0xb00b('0xa')](0x194);}return _0x46a25c;};}function handleError(_0x48e125,_0x3182db){_0x3182db=_0x3182db||0x1f4;return function(_0x5a63ed){logger['error'](_0x5a63ed['stack']);if(_0x5a63ed[_0xb00b('0xb')]){delete _0x5a63ed[_0xb00b('0xb')];}_0x48e125[_0xb00b('0x7')](_0x3182db)[_0xb00b('0xc')](_0x5a63ed);};}exports[_0xb00b('0xd')]=function(_0x1f1c1d,_0x4ada81){if(_0x1f1c1d[_0xb00b('0xe')][_0xb00b('0xf')]!=='admin')throw new Error(_0xb00b('0x10'));if(isNaN(Number(_0x1f1c1d[_0xb00b('0x11')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db['UserSetting'][_0xb00b('0x12')]({'where':{'id':_0x1f1c1d['params']['id']}})['then'](handleEntityNotFound(_0x4ada81,null))[_0xb00b('0x9')](saveUpdates(_0x1f1c1d[_0xb00b('0x13')],null))[_0xb00b('0x9')](respondWithResult(_0x4ada81,null))[_0xb00b('0x14')](handleError(_0x4ada81,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 0a6844a..b3fabb6 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 _0x0f12=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x2b5396,_0xc1d0aa){var _0x2a5fe7=function(_0x1507d5){while(--_0x1507d5){_0x2b5396['push'](_0x2b5396['shift']());}};_0x2a5fe7(++_0xc1d0aa);}(_0x0f12,0xa6));var _0x20f1=function(_0x390b72,_0x8419d8){_0x390b72=_0x390b72-0x0;var _0x2e934a=_0x0f12[_0x390b72];return _0x2e934a;};'use strict';var EventEmitter=require(_0x20f1('0x0'));var UserSetting=require(_0x20f1('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x20f1('0x2')](0x0);var events={'afterCreate':_0x20f1('0x3'),'afterUpdate':_0x20f1('0x4'),'afterDestroy':_0x20f1('0x5')};function emitEvent(_0x2c15ce){return function(_0x3ede61,_0xb05d9e,_0x5673dc){UserSettingEvents[_0x20f1('0x6')](_0x2c15ce+':'+_0x3ede61['id'],_0x3ede61);UserSettingEvents[_0x20f1('0x6')](_0x2c15ce,_0x3ede61);_0x5673dc(null);};}for(var e in events){if(events[_0x20f1('0x7')](e)){var event=events[e];UserSetting[_0x20f1('0x8')](e,emitEvent(event));}}module[_0x20f1('0x9')]=UserSettingEvents; \ No newline at end of file +var _0x186f=['events','../../mysqldb','UserSetting','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x112787,_0x2cb349){var _0x578c26=function(_0x1e1e38){while(--_0x1e1e38){_0x112787['push'](_0x112787['shift']());}};_0x578c26(++_0x2cb349);}(_0x186f,0x18c));var _0xf186=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x186f[_0x1facfa];return _0x9ec701;};'use strict';var EventEmitter=require(_0xf186('0x0'));var UserSetting=require(_0xf186('0x1'))['db'][_0xf186('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xf186('0x3')](0x0);var events={'afterCreate':_0xf186('0x4'),'afterUpdate':_0xf186('0x5'),'afterDestroy':_0xf186('0x6')};function emitEvent(_0x5da1a9){return function(_0x348208,_0x57daf9,_0x420cc1){UserSettingEvents[_0xf186('0x7')](_0x5da1a9+':'+_0x348208['id'],_0x348208);UserSettingEvents[_0xf186('0x7')](_0x5da1a9,_0x348208);_0x420cc1(null);};}for(var e in events){if(events[_0xf186('0x8')](e)){var event=events[e];UserSetting[_0xf186('0x9')](e,emitEvent(event));}}module[_0xf186('0xa')]=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 8b98a21..48ebd09 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 _0xcb91=['define','UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince'];(function(_0x47b415,_0x1c476c){var _0xcb417a=function(_0x7a8de8){while(--_0x7a8de8){_0x47b415['push'](_0x47b415['shift']());}};_0xcb417a(++_0x1c476c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x421263,_0x18187d){_0x421263=_0x421263-0x0;var _0x34e4b5=_0xcb91[_0x421263];return _0x34e4b5;};'use strict';var attributes=require('./user-setting.attributes');module['exports']=function(_0x26fe42){return _0x26fe42[_0x1cb9('0x0')](_0x1cb9('0x1'),attributes,{'tableName':_0x1cb9('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4c37e8){if(!_0x4c37e8[_0x1cb9('0x3')])_0x4c37e8[_0x1cb9('0x4')]=null;else if(_0x4c37e8['clientSideLoggingEnabledSince']===null)_0x4c37e8[_0x1cb9('0x4')]=new Date();}}});}; \ No newline at end of file +var _0x43c8=['clientSideLoggingEnabledSince','exports','define','UserSetting','user_settings','clientSideLoggingEnabled'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x43c8,0xaf));var _0x843c=function(_0x2ad495,_0x1c76e0){_0x2ad495=_0x2ad495-0x0;var _0x557ec0=_0x43c8[_0x2ad495];return _0x557ec0;};'use strict';var attributes=require('./user-setting.attributes');module[_0x843c('0x0')]=function(_0x5e8751){return _0x5e8751[_0x843c('0x1')](_0x843c('0x2'),attributes,{'tableName':_0x843c('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x302fdb){if(!_0x302fdb[_0x843c('0x4')])_0x302fdb[_0x843c('0x5')]=null;else if(_0x302fdb[_0x843c('0x5')]===null)_0x302fdb['clientSideLoggingEnabledSince']=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 7ebfc8d..7679fde 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 _0x5d8e=['UserId','length','user-setting:','remove','update','emit','user-setting:update:user-'];(function(_0x59e75c,_0x5e2203){var _0x8c7ecb=function(_0x57c159){while(--_0x57c159){_0x59e75c['push'](_0x59e75c['shift']());}};_0x8c7ecb(++_0x5e2203);}(_0x5d8e,0xb2));var _0xe5d8=function(_0x5f0459,_0x4d8160){_0x5f0459=_0x5f0459-0x0;var _0x549603=_0x5d8e[_0x5f0459];return _0x549603;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=['save',_0xe5d8('0x0'),_0xe5d8('0x1')];function createListener(_0x1f1f2f,_0x347bbd){return function(_0x2e97f2){_0x347bbd[_0xe5d8('0x2')](_0x1f1f2f,_0x2e97f2);if(_0x1f1f2f==='user-setting:update'){_0x347bbd[_0xe5d8('0x2')](_0xe5d8('0x3')+_0x2e97f2[_0xe5d8('0x4')],_0x2e97f2);}};}exports['register']=function(_0x5e7f59){for(var _0x313fd1=0x0,_0x5a6521=events[_0xe5d8('0x5')];_0x313fd1<_0x5a6521;_0x313fd1++){var _0x464473=events[_0x313fd1];var _0x1c95f4=createListener(_0xe5d8('0x6')+_0x464473,_0x5e7f59);UserSettingEvents['on'](_0x464473,_0x1c95f4);}}; \ No newline at end of file +var _0x30ba=['UserId','register','length','user-setting:','./user-setting.events','remove','update','emit','user-setting:update:user-'];(function(_0x32062c,_0x43ee1f){var _0xa8ccf1=function(_0x501489){while(--_0x501489){_0x32062c['push'](_0x32062c['shift']());}};_0xa8ccf1(++_0x43ee1f);}(_0x30ba,0xca));var _0xa30b=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x30ba[_0x2641f9];return _0x585741;};'use strict';var UserSettingEvents=require(_0xa30b('0x0'));var events=['save',_0xa30b('0x1'),_0xa30b('0x2')];function createListener(_0x2c5796,_0x4e80e5){return function(_0x26045f){_0x4e80e5['emit'](_0x2c5796,_0x26045f);if(_0x2c5796==='user-setting:update'){_0x4e80e5[_0xa30b('0x3')](_0xa30b('0x4')+_0x26045f[_0xa30b('0x5')],_0x26045f);}};}exports[_0xa30b('0x6')]=function(_0x505111){for(var _0x15511d=0x0,_0x52a48d=events[_0xa30b('0x7')];_0x15511d<_0x52a48d;_0x15511d++){var _0x39f67d=events[_0x15511d];var _0x3a57c4=createListener(_0xa30b('0x8')+_0x39f67d,_0x505111);UserSettingEvents['on'](_0x39f67d,_0x3a57c4);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index cdcc9f9..8a5fae2 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 _0xe027=['/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','put','/:id/password','delete','destroy','removeChatInteractions','/:id/mail_interactions','removeMailInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','/:id/fax_accounts','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','index','/describe','get','isAuthenticated','whoami','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getContacts','/:id/queues','getQueues','getVoiceQueuesRt','/:id/groups','getGroups','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','getLists','getAgents','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','addContacts','create','/create_many','bulkCreate','post','diskStorage','join','root','format','%s-%s','now','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addMailInteractions'];(function(_0x43aad1,_0x38f9f3){var _0x424dbc=function(_0x59092f){while(--_0x59092f){_0x43aad1['push'](_0x43aad1['shift']());}};_0x424dbc(++_0x38f9f3);}(_0xe027,0x106));var _0x7e02=function(_0x40804e,_0x26955c){_0x40804e=_0x40804e-0x0;var _0xc9c710=_0xe027[_0x40804e];return _0xc9c710;};'use strict';var multer=require(_0x7e02('0x0'));var util=require(_0x7e02('0x1'));var path=require(_0x7e02('0x2'));var timeout=require(_0x7e02('0x3'));var express=require(_0x7e02('0x4'));var router=express[_0x7e02('0x5')]();var fs_extra=require(_0x7e02('0x6'));var auth=require(_0x7e02('0x7'));var interaction=require(_0x7e02('0x8'));var config=require(_0x7e02('0x9'));var controller=require(_0x7e02('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x7e02('0xb')]);router['get'](_0x7e02('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x7e02('0xd')]('/whoami',auth[_0x7e02('0xe')](),controller[_0x7e02('0xf')]);router[_0x7e02('0xd')](_0x7e02('0x10'),auth[_0x7e02('0xe')](),controller[_0x7e02('0x11')]);router['get'](_0x7e02('0x12'),auth['isAuthenticated'](),controller[_0x7e02('0x13')]);router[_0x7e02('0xd')](_0x7e02('0x14'),controller[_0x7e02('0x15')]);router[_0x7e02('0xd')](_0x7e02('0x16'),auth[_0x7e02('0xe')](),controller['getOpenTabs']);router[_0x7e02('0xd')]('/:id/contacts',auth[_0x7e02('0xe')](),controller[_0x7e02('0x17')]);router[_0x7e02('0xd')](_0x7e02('0x18'),auth[_0x7e02('0xe')](),controller[_0x7e02('0x19')]);router['get']('/:id/queues_rt',auth['isAuthenticated'](),controller[_0x7e02('0x1a')]);router['get'](_0x7e02('0x1b'),auth[_0x7e02('0xe')](),controller[_0x7e02('0x1c')]);router[_0x7e02('0xd')]('/:id/recordings',auth[_0x7e02('0xe')](),controller[_0x7e02('0x1d')]);router['get'](_0x7e02('0x1e'),auth[_0x7e02('0xe')](),controller[_0x7e02('0x1f')]);router[_0x7e02('0xd')](_0x7e02('0x20'),auth[_0x7e02('0xe')](),controller['getChatInteractions']);router[_0x7e02('0xd')](_0x7e02('0x21'),auth['isAuthenticated'](),controller[_0x7e02('0x22')]);router[_0x7e02('0xd')]('/:id/mail/interactions',auth[_0x7e02('0xe')](),controller[_0x7e02('0x23')]);router['get'](_0x7e02('0x24'),auth[_0x7e02('0xe')](),controller['getSmsInteractions']);router['get'](_0x7e02('0x25'),auth[_0x7e02('0xe')](),controller[_0x7e02('0x26')]);router[_0x7e02('0xd')](_0x7e02('0x27'),auth[_0x7e02('0xe')](),controller['getWhatsappInteractions']);router['get'](_0x7e02('0x28'),auth[_0x7e02('0xe')](),controller['getTeams']);router[_0x7e02('0xd')]('/:id/lists',auth[_0x7e02('0xe')](),controller[_0x7e02('0x29')]);router[_0x7e02('0xd')]('/:id/agents',auth[_0x7e02('0xe')](),controller[_0x7e02('0x2a')]);router[_0x7e02('0xd')]('/:id/prefixes',auth['isAuthenticated'](),controller[_0x7e02('0x2b')]);router[_0x7e02('0xd')]('/:id/fax_accounts',auth[_0x7e02('0xe')](),controller[_0x7e02('0x2c')]);router[_0x7e02('0xd')](_0x7e02('0x2d'),auth['isAuthenticated'](),controller[_0x7e02('0x2e')]);router[_0x7e02('0xd')](_0x7e02('0x2f'),auth[_0x7e02('0xe')](),controller[_0x7e02('0x30')]);router[_0x7e02('0xd')](_0x7e02('0x31'),auth[_0x7e02('0xe')](),controller[_0x7e02('0x32')]);router[_0x7e02('0xd')](_0x7e02('0x33'),auth[_0x7e02('0xe')](),controller[_0x7e02('0x34')]);router[_0x7e02('0xd')](_0x7e02('0x35'),auth['isAuthenticated'](),controller[_0x7e02('0x36')]);router[_0x7e02('0xd')](_0x7e02('0x37'),auth[_0x7e02('0xe')](),controller[_0x7e02('0x38')]);router[_0x7e02('0xd')](_0x7e02('0x39'),auth['isAuthenticated'](),controller['getApiKey']);router['post']('/:id/contacts',auth[_0x7e02('0xe')](),controller[_0x7e02('0x3a')]);router['post']('/',auth[_0x7e02('0xe')](),controller[_0x7e02('0x3b')]);router['post'](_0x7e02('0x3c'),auth[_0x7e02('0xe')](),controller[_0x7e02('0x3d')]);router[_0x7e02('0x3e')](_0x7e02('0x18'),auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer[_0x7e02('0x3f')]({'destination':function(_0x59672f,_0x212dde,_0x467548){_0x467548(null,path[_0x7e02('0x40')](config[_0x7e02('0x41')],'server/files/images/'));},'filename':function(_0x29ce63,_0x54b206,_0x149aad){_0x149aad(null,util[_0x7e02('0x42')](_0x7e02('0x43'),Date[_0x7e02('0x44')](),_0x54b206['originalname']));}})});router[_0x7e02('0x3e')](_0x7e02('0x14'),upload[_0x7e02('0x45')](_0x7e02('0x46')),controller[_0x7e02('0x47')]);router[_0x7e02('0x3e')](_0x7e02('0x48'),auth[_0x7e02('0xe')](),controller[_0x7e02('0x49')]);router[_0x7e02('0x3e')](_0x7e02('0x4a'),auth[_0x7e02('0xe')](),controller[_0x7e02('0x4b')]);router[_0x7e02('0x3e')](_0x7e02('0x4c'),auth[_0x7e02('0xe')](),controller[_0x7e02('0x4d')]);router[_0x7e02('0x3e')](_0x7e02('0x4e'),auth[_0x7e02('0xe')](),controller[_0x7e02('0x4f')]);router['post'](_0x7e02('0x28'),auth[_0x7e02('0xe')](),controller[_0x7e02('0x50')]);router[_0x7e02('0x3e')](_0x7e02('0x51'),auth[_0x7e02('0xe')](),controller['addChatInteractions']);router[_0x7e02('0x3e')]('/:id/mail_interactions',auth[_0x7e02('0xe')](),controller[_0x7e02('0x52')]);router[_0x7e02('0x3e')](_0x7e02('0x53'),auth[_0x7e02('0xe')](),controller[_0x7e02('0x54')]);router['post'](_0x7e02('0x55'),auth[_0x7e02('0xe')](),controller[_0x7e02('0x56')]);router[_0x7e02('0x3e')](_0x7e02('0x57'),auth[_0x7e02('0xe')](),controller['addOpenchannelInteractions']);router[_0x7e02('0x3e')](_0x7e02('0x58'),auth[_0x7e02('0xe')](),controller[_0x7e02('0x59')]);router[_0x7e02('0x3e')]('/:id/fax_accounts',auth[_0x7e02('0xe')](),controller[_0x7e02('0x5a')]);router[_0x7e02('0x3e')]('/:id/mail_accounts',auth[_0x7e02('0xe')](),controller[_0x7e02('0x5b')]);router[_0x7e02('0x3e')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0x7e02('0x5c')]);router[_0x7e02('0x3e')](_0x7e02('0x31'),auth[_0x7e02('0xe')](),controller[_0x7e02('0x5d')]);router['post']('/:id/chat_websites',auth['isAuthenticated'](),controller[_0x7e02('0x5e')]);router[_0x7e02('0x3e')](_0x7e02('0x35'),auth[_0x7e02('0xe')](),controller[_0x7e02('0x5f')]);router['post'](_0x7e02('0x39'),auth[_0x7e02('0xe')](),controller[_0x7e02('0x60')]);router[_0x7e02('0x61')](_0x7e02('0x12'),auth[_0x7e02('0xe')](),controller['update']);router[_0x7e02('0x61')](_0x7e02('0x62'),auth[_0x7e02('0xe')](),controller['changePassword']);router['delete'](_0x7e02('0x18'),auth[_0x7e02('0xe')](),controller['removeQueues']);router[_0x7e02('0x63')]('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router[_0x7e02('0x63')](_0x7e02('0x12'),auth[_0x7e02('0xe')](),controller[_0x7e02('0x64')]);router[_0x7e02('0x63')]('/:id/chat_interactions',auth[_0x7e02('0xe')](),controller[_0x7e02('0x65')]);router[_0x7e02('0x63')](_0x7e02('0x66'),auth[_0x7e02('0xe')](),controller[_0x7e02('0x67')]);router['delete']('/:id/fax_interactions',auth[_0x7e02('0xe')](),controller['removeFaxInteractions']);router[_0x7e02('0x63')]('/:id/sms_interactions',auth[_0x7e02('0xe')](),controller[_0x7e02('0x68')]);router[_0x7e02('0x63')](_0x7e02('0x57'),auth['isAuthenticated'](),controller[_0x7e02('0x69')]);router[_0x7e02('0x63')](_0x7e02('0x58'),auth[_0x7e02('0xe')](),controller[_0x7e02('0x6a')]);router['delete'](_0x7e02('0x6b'),auth['isAuthenticated'](),controller[_0x7e02('0x6c')]);router[_0x7e02('0x63')]('/:id/mail_accounts',auth[_0x7e02('0xe')](),controller[_0x7e02('0x6d')]);router['delete'](_0x7e02('0x2f'),auth[_0x7e02('0xe')](),controller[_0x7e02('0x6e')]);router[_0x7e02('0x63')](_0x7e02('0x31'),auth[_0x7e02('0xe')](),controller['removeSmsAccounts']);router['delete'](_0x7e02('0x33'),auth[_0x7e02('0xe')](),controller[_0x7e02('0x6f')]);router[_0x7e02('0x63')](_0x7e02('0x35'),auth[_0x7e02('0xe')](),controller[_0x7e02('0x70')]);router['delete'](_0x7e02('0x39'),auth['isAuthenticated'](),controller[_0x7e02('0x71')]);module[_0x7e02('0x72')]=router; \ No newline at end of file +var _0x40a3=['removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','exports','multer','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','/describe','describe','/whoami','whoami','/presence','getPresence','/:id','show','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','/:id/sms/interactions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/agents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','create','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','/:id/avatar','file','addAvatar','/:id/login','login','/:id/logout','/:id/pause','pause','/:id/unpause','addTeams','addChatInteractions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','createApiKey','put','update','/:id/password','delete','removeQueues','removeTeams','destroy','removeMailInteractions','/:id/fax_interactions'];(function(_0x5d6e35,_0x4d1ac0){var _0x5d7ada=function(_0x2f7dd3){while(--_0x2f7dd3){_0x5d6e35['push'](_0x5d6e35['shift']());}};_0x5d7ada(++_0x4d1ac0);}(_0x40a3,0x153));var _0x340a=function(_0x1b43de,_0x242829){_0x1b43de=_0x1b43de-0x0;var _0x3cf9a6=_0x40a3[_0x1b43de];return _0x3cf9a6;};'use strict';var multer=require(_0x340a('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x340a('0x1'));var router=express['Router']();var fs_extra=require(_0x340a('0x2'));var auth=require(_0x340a('0x3'));var interaction=require(_0x340a('0x4'));var config=require(_0x340a('0x5'));var controller=require(_0x340a('0x6'));router[_0x340a('0x7')]('/',auth[_0x340a('0x8')](),controller['index']);router[_0x340a('0x7')](_0x340a('0x9'),auth['isAuthenticated'](),controller[_0x340a('0xa')]);router[_0x340a('0x7')](_0x340a('0xb'),auth[_0x340a('0x8')](),controller[_0x340a('0xc')]);router['get'](_0x340a('0xd'),auth[_0x340a('0x8')](),controller[_0x340a('0xe')]);router['get'](_0x340a('0xf'),auth['isAuthenticated'](),controller[_0x340a('0x10')]);router[_0x340a('0x7')]('/:id/avatar',controller[_0x340a('0x11')]);router[_0x340a('0x7')](_0x340a('0x12'),auth[_0x340a('0x8')](),controller[_0x340a('0x13')]);router[_0x340a('0x7')](_0x340a('0x14'),auth[_0x340a('0x8')](),controller[_0x340a('0x15')]);router[_0x340a('0x7')](_0x340a('0x16'),auth[_0x340a('0x8')](),controller[_0x340a('0x17')]);router[_0x340a('0x7')](_0x340a('0x18'),auth['isAuthenticated'](),controller[_0x340a('0x19')]);router['get']('/:id/groups',auth[_0x340a('0x8')](),controller[_0x340a('0x1a')]);router[_0x340a('0x7')](_0x340a('0x1b'),auth[_0x340a('0x8')](),controller[_0x340a('0x1c')]);router[_0x340a('0x7')](_0x340a('0x1d'),auth[_0x340a('0x8')](),controller[_0x340a('0x1e')]);router['get'](_0x340a('0x1f'),auth['isAuthenticated'](),controller[_0x340a('0x20')]);router[_0x340a('0x7')](_0x340a('0x21'),auth[_0x340a('0x8')](),controller['getOpenchannelInteractions']);router['get'](_0x340a('0x22'),auth[_0x340a('0x8')](),controller['getMailInteractions']);router[_0x340a('0x7')](_0x340a('0x23'),auth[_0x340a('0x8')](),controller['getSmsInteractions']);router['get'](_0x340a('0x24'),auth[_0x340a('0x8')](),controller['getFaxInteractions']);router[_0x340a('0x7')](_0x340a('0x25'),auth[_0x340a('0x8')](),controller[_0x340a('0x26')]);router[_0x340a('0x7')](_0x340a('0x27'),auth[_0x340a('0x8')](),controller[_0x340a('0x28')]);router[_0x340a('0x7')]('/:id/lists',auth[_0x340a('0x8')](),controller['getLists']);router[_0x340a('0x7')](_0x340a('0x29'),auth['isAuthenticated'](),controller['getAgents']);router['get'](_0x340a('0x2a'),auth[_0x340a('0x8')](),controller[_0x340a('0x2b')]);router['get'](_0x340a('0x2c'),auth[_0x340a('0x8')](),controller['getFaxAccounts']);router[_0x340a('0x7')](_0x340a('0x2d'),auth[_0x340a('0x8')](),controller[_0x340a('0x2e')]);router[_0x340a('0x7')](_0x340a('0x2f'),auth['isAuthenticated'](),controller[_0x340a('0x30')]);router[_0x340a('0x7')](_0x340a('0x31'),auth[_0x340a('0x8')](),controller[_0x340a('0x32')]);router[_0x340a('0x7')](_0x340a('0x33'),auth[_0x340a('0x8')](),controller[_0x340a('0x34')]);router[_0x340a('0x7')]('/:id/whatsapp_accounts',auth[_0x340a('0x8')](),controller[_0x340a('0x35')]);router[_0x340a('0x7')](_0x340a('0x36'),auth['isAuthenticated'](),controller[_0x340a('0x37')]);router['get'](_0x340a('0x38'),auth['isAuthenticated'](),controller[_0x340a('0x39')]);router['post']('/:id/contacts',auth[_0x340a('0x8')](),controller['addContacts']);router[_0x340a('0x3a')]('/',auth[_0x340a('0x8')](),controller[_0x340a('0x3b')]);router[_0x340a('0x3a')]('/create_many',auth['isAuthenticated'](),controller['bulkCreate']);router[_0x340a('0x3a')](_0x340a('0x16'),auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer[_0x340a('0x3c')]({'destination':function(_0x45d63f,_0x55ff97,_0x1aceb7){_0x1aceb7(null,path[_0x340a('0x3d')](config[_0x340a('0x3e')],_0x340a('0x3f')));},'filename':function(_0x701166,_0x1cd25a,_0x1ddfba){_0x1ddfba(null,util[_0x340a('0x40')](_0x340a('0x41'),Date[_0x340a('0x42')](),_0x1cd25a[_0x340a('0x43')]));}})});router[_0x340a('0x3a')](_0x340a('0x44'),upload['single'](_0x340a('0x45')),controller[_0x340a('0x46')]);router[_0x340a('0x3a')](_0x340a('0x47'),auth[_0x340a('0x8')](),controller[_0x340a('0x48')]);router[_0x340a('0x3a')](_0x340a('0x49'),auth[_0x340a('0x8')](),controller['logout']);router[_0x340a('0x3a')](_0x340a('0x4a'),auth['isAuthenticated'](),controller[_0x340a('0x4b')]);router[_0x340a('0x3a')](_0x340a('0x4c'),auth[_0x340a('0x8')](),controller['unpause']);router[_0x340a('0x3a')]('/:id/teams',auth[_0x340a('0x8')](),controller[_0x340a('0x4d')]);router[_0x340a('0x3a')]('/:id/chat_interactions',auth[_0x340a('0x8')](),controller[_0x340a('0x4e')]);router[_0x340a('0x3a')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0x340a('0x4f')]);router[_0x340a('0x3a')]('/:id/fax_interactions',auth[_0x340a('0x8')](),controller[_0x340a('0x50')]);router[_0x340a('0x3a')](_0x340a('0x51'),auth[_0x340a('0x8')](),controller['addSmsInteractions']);router[_0x340a('0x3a')](_0x340a('0x52'),auth[_0x340a('0x8')](),controller[_0x340a('0x53')]);router[_0x340a('0x3a')](_0x340a('0x54'),auth[_0x340a('0x8')](),controller[_0x340a('0x55')]);router[_0x340a('0x3a')](_0x340a('0x2c'),auth['isAuthenticated'](),controller[_0x340a('0x56')]);router[_0x340a('0x3a')](_0x340a('0x2d'),auth['isAuthenticated'](),controller[_0x340a('0x57')]);router[_0x340a('0x3a')](_0x340a('0x2f'),auth['isAuthenticated'](),controller['addOpenchannelAccounts']);router[_0x340a('0x3a')]('/:id/sms_accounts',auth[_0x340a('0x8')](),controller[_0x340a('0x58')]);router[_0x340a('0x3a')](_0x340a('0x33'),auth[_0x340a('0x8')](),controller[_0x340a('0x59')]);router[_0x340a('0x3a')](_0x340a('0x5a'),auth[_0x340a('0x8')](),controller['addWhatsappAccounts']);router[_0x340a('0x3a')]('/:id/api_key',auth[_0x340a('0x8')](),controller[_0x340a('0x5b')]);router[_0x340a('0x5c')](_0x340a('0xf'),auth[_0x340a('0x8')](),controller[_0x340a('0x5d')]);router[_0x340a('0x5c')](_0x340a('0x5e'),auth[_0x340a('0x8')](),controller['changePassword']);router[_0x340a('0x5f')](_0x340a('0x16'),auth[_0x340a('0x8')](),controller[_0x340a('0x60')]);router[_0x340a('0x5f')]('/:id/teams',auth[_0x340a('0x8')](),controller[_0x340a('0x61')]);router[_0x340a('0x5f')](_0x340a('0xf'),auth[_0x340a('0x8')](),controller[_0x340a('0x62')]);router[_0x340a('0x5f')]('/:id/chat_interactions',auth[_0x340a('0x8')](),controller['removeChatInteractions']);router[_0x340a('0x5f')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0x340a('0x63')]);router['delete'](_0x340a('0x64'),auth[_0x340a('0x8')](),controller[_0x340a('0x65')]);router['delete']('/:id/sms_interactions',auth[_0x340a('0x8')](),controller[_0x340a('0x66')]);router[_0x340a('0x5f')](_0x340a('0x52'),auth[_0x340a('0x8')](),controller[_0x340a('0x67')]);router[_0x340a('0x5f')](_0x340a('0x54'),auth[_0x340a('0x8')](),controller['removeWhatsappInteractions']);router[_0x340a('0x5f')]('/:id/fax_accounts',auth[_0x340a('0x8')](),controller['removeFaxAccounts']);router[_0x340a('0x5f')](_0x340a('0x2d'),auth['isAuthenticated'](),controller[_0x340a('0x68')]);router[_0x340a('0x5f')](_0x340a('0x2f'),auth['isAuthenticated'](),controller[_0x340a('0x69')]);router[_0x340a('0x5f')]('/:id/sms_accounts',auth[_0x340a('0x8')](),controller[_0x340a('0x6a')]);router[_0x340a('0x5f')](_0x340a('0x33'),auth[_0x340a('0x8')](),controller[_0x340a('0x6b')]);router[_0x340a('0x5f')](_0x340a('0x5a'),auth[_0x340a('0x8')](),controller[_0x340a('0x6c')]);router[_0x340a('0x5f')](_0x340a('0x38'),auth[_0x340a('0x8')](),controller['removeApiKey']);module[_0x340a('0x6d')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index f142ef0..c3c3df0 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 _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(_0xf81317,_0x2acba0){var _0x50b040=function(_0x51c034){while(--_0x51c034){_0xf81317['push'](_0xf81317['shift']());}};_0x50b040(++_0x2acba0);}(_0xedd9,0xfc));var _0x9edd=function(_0x41bde7,_0x32f956){_0x41bde7=_0x41bde7-0x0;var _0x456baf=_0xedd9[_0x41bde7];return _0x456baf;};'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 +var _0xcb91=['toLowerCase','ENUM','admin','user','local','INTEGER','accountcode','\x22%s\x22\x20<%s>','getDataValue','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','insecure','never','always','accept','originate','uac','uas','fingerprint','certificate','active','passive','update','showWebBar','get','isArray','encryption','avpf','icesupport','dtlsverify','dtlssetup','rtcp_mux','wss','force_avp','dtlscertfile','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','loginAttempts','UNSIGNED','util','lodash','exports','STRING','setDataValue','defaultuser','fullname','format','internal','email'];(function(_0x2f8c08,_0x8f3194){var _0x31aee3=function(_0x192894){while(--_0x192894){_0x2f8c08['push'](_0x2f8c08['shift']());}};_0x31aee3(++_0x8f3194);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xcb91[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0x1cb9('0x0'));var _=require(_0x1cb9('0x1'));module[_0x1cb9('0x2')]={'name':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x8c392f){this[_0x1cb9('0x4')]('name',_0x8c392f);this[_0x1cb9('0x4')](_0x1cb9('0x5'),_0x8c392f);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'set':function(_0x3f7deb){this['setDataValue'](_0x1cb9('0x6'),_0x3f7deb);this[_0x1cb9('0x4')]('callerid',util[_0x1cb9('0x7')]('\x22%s\x22\x20<%s>',_0x3f7deb,this['getDataValue'](_0x1cb9('0x8'))));}},'alias':{'type':Sequelize[_0x1cb9('0x3')]},'email':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'unique':_0x1cb9('0x9'),'validate':{'isEmail':!![]},'set':function(_0x2fc627){if(_0x2fc627){this['setDataValue'](_0x1cb9('0x9'),_0x2fc627[_0x1cb9('0xa')]());}}},'role':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0xc'),_0x1cb9('0xd'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':_0x1cb9('0xe')},'internal':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':![],'unique':_0x1cb9('0x8'),'set':function(_0x56884d){this[_0x1cb9('0x4')](_0x1cb9('0x8'),_0x56884d);this[_0x1cb9('0x4')](_0x1cb9('0x10'),_0x56884d);this[_0x1cb9('0x4')]('callerid',util['format'](_0x1cb9('0x11'),this[_0x1cb9('0x12')](_0x1cb9('0x6')),_0x56884d));}},'salt':{'type':Sequelize[_0x1cb9('0x3')]},'phone':{'type':Sequelize[_0x1cb9('0x3')]},'mobile':{'type':Sequelize[_0x1cb9('0x3')]},'address':{'type':Sequelize[_0x1cb9('0x3')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x1cb9('0x3')]},'country':{'type':Sequelize[_0x1cb9('0x3')]},'online':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x1cb9('0x14')]},'voicePause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':_0x1cb9('0x15')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x1cb9('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'description':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1cb9('0x16')},'ipaddr':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x17'),_0x1cb9('0xd'),_0x1cb9('0x18')),'allowNull':!![],'defaultValue':_0x1cb9('0x17')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1cb9('0x19')},'callingpres':{'type':Sequelize['ENUM'](_0x1cb9('0x1a'),'ALLOWED_PASSED_SCREEN',_0x1cb9('0x1b'),_0x1cb9('0x1c'),_0x1cb9('0x1d'),_0x1cb9('0x1e'),'PROHIB_FAILED_SCREEN',_0x1cb9('0x1f')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x3a3543){this['setDataValue'](_0x1cb9('0x20'),_0x3a3543?_0x3a3543[_0x1cb9('0x21')](','):null);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x20'))?this['getDataValue'](_0x1cb9('0x20'))[_0x1cb9('0x22')](','):null;},'comment':_0x1cb9('0x23')},'dtmfmode':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x24'),_0x1cb9('0x25'),_0x1cb9('0x26'),_0x1cb9('0x27'),_0x1cb9('0x28')),'allowNull':!![],'defaultValue':_0x1cb9('0x24')},'directmedia':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no',_0x1cb9('0x2a'),'update','outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'defaultValue':_0x1cb9('0x2b'),'set':function(_0x35f5e8){this[_0x1cb9('0x4')]('nat',_0x35f5e8?_0x35f5e8[_0x1cb9('0x21')](','):null);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x2c'))?this['getDataValue'](_0x1cb9('0x2c'))['split'](','):null;},'comment':_0x1cb9('0x2d')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x1cb9('0x3')]},'pickupgroup':{'type':Sequelize[_0x1cb9('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x1cb9('0x3')]},'language':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1cb9('0x3')]},'disallow':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'defaultValue':_0x1cb9('0x2e')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x4111b8){this[_0x1cb9('0x4')](_0x1cb9('0x2f'),_0x4111b8?_0x4111b8[_0x1cb9('0x21')](';'):_0x1cb9('0x30'));},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x2f'))?this['getDataValue'](_0x1cb9('0x2f'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'set':function(_0x1bf51c){this[_0x1cb9('0x4')](_0x1cb9('0x31'),_0x1bf51c?_0x1bf51c['join'](','):null);},'get':function(){return this[_0x1cb9('0x12')]('insecure')?this[_0x1cb9('0x12')](_0x1cb9('0x31'))[_0x1cb9('0x22')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0x1cb9('0x32')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':_0x1cb9('0x29')},'busylevel':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x1cb9('0xb')]('yes','no',_0x1cb9('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x1cb9('0x34'),'refuse',_0x1cb9('0x35')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x36'),_0x1cb9('0x37')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':_0x1cb9('0x29')},'keepalive':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0x1cb9('0x38'),_0x1cb9('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x3a'),_0x1cb9('0x3b'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no',_0x1cb9('0x2a'),_0x1cb9('0x3c'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x1cb9('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x1cb9('0x14')]},'passwordResetAt':{'type':Sequelize[_0x1cb9('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x319358){this[_0x1cb9('0x4')](_0x1cb9('0x3d'),_0x319358);var _0x173db5=this[_0x1cb9('0x3e')]({'plain':!![]});switch(_0x319358){case 0x0:case 0x1:var _0x75c734=_0x173db5[_0x1cb9('0x20')]?_[_0x1cb9('0x3f')](_0x173db5['transport'])?_0x173db5['transport'][_0x1cb9('0x21')]():_0x173db5['transport']:'udp';if(_0x75c734==='wss'){_0x75c734='udp';}this['setDataValue'](_0x1cb9('0x20'),_0x75c734);this[_0x1cb9('0x4')](_0x1cb9('0x40'),'no');this[_0x1cb9('0x4')](_0x1cb9('0x41'),null);this[_0x1cb9('0x4')]('force_avp',null);this[_0x1cb9('0x4')](_0x1cb9('0x42'),null);this['setDataValue']('dtlsenable',null);this[_0x1cb9('0x4')](_0x1cb9('0x43'),null);this[_0x1cb9('0x4')](_0x1cb9('0x44'),null);this[_0x1cb9('0x4')]('dtlscertfile',null);this['setDataValue']('dtlsprivatekey',null);this[_0x1cb9('0x4')](_0x1cb9('0x45'),'no');break;case 0x2:this[_0x1cb9('0x4')](_0x1cb9('0x20'),_0x1cb9('0x46'));this['setDataValue'](_0x1cb9('0x40'),_0x1cb9('0x29'));this['setDataValue']('avpf',_0x1cb9('0x29'));this['setDataValue'](_0x1cb9('0x47'),_0x1cb9('0x29'));this[_0x1cb9('0x4')](_0x1cb9('0x42'),_0x1cb9('0x29'));this[_0x1cb9('0x4')]('dtlsenable',_0x1cb9('0x29'));this[_0x1cb9('0x4')](_0x1cb9('0x43'),'no');this[_0x1cb9('0x4')]('dtlssetup','actpass');this[_0x1cb9('0x4')](_0x1cb9('0x48'),_0x173db5[_0x1cb9('0x48')]||_0x1cb9('0x49'));this[_0x1cb9('0x4')](_0x1cb9('0x4a'),_0x173db5['dtlsprivatekey']||_0x1cb9('0x4b'));this['setDataValue'](_0x1cb9('0x45'),_0x1cb9('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0xf5b006){this[_0x1cb9('0x4')](_0x1cb9('0x4c'),_0xf5b006?_0xf5b006['join'](','):[]);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x4c'))?_[_0x1cb9('0x4d')](this[_0x1cb9('0x12')](_0x1cb9('0x4c'))[_0x1cb9('0x22')](','),function(_0x5a3f1d){return parseInt(_0x5a3f1d,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x1cb9('0x4e')],'get':function(){return this['getDataValue'](_0x1cb9('0x4f'))?this['getDataValue'](_0x1cb9('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![],'set':function(_0x4f8d74){if(typeof _0x4f8d74===_0x1cb9('0x50')){var _0x4cb014=_0x4f8d74==='1'?!![]:_0x4f8d74==='0'?![]:_0x4f8d74===_0x1cb9('0x51')?!![]:_0x4f8d74===_0x1cb9('0x52')?![]:![];this[_0x1cb9('0x4')](_0x1cb9('0x53'),_0x4cb014);}else{this[_0x1cb9('0x4')](_0x1cb9('0x53'),_0x4f8d74);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x3db146){this[_0x1cb9('0x4')]('blocked',_0x3db146);if(_0x3db146===!![]){this[_0x1cb9('0x4')](_0x1cb9('0x54'),moment());this[_0x1cb9('0x4')](_0x1cb9('0x55'),0x0);}else{this[_0x1cb9('0x4')](_0x1cb9('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x1cb9('0x14')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x1cb9('0xf')](0x5)[_0x1cb9('0x56')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'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 2ae4316..f474d0e 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 _0x69a4=['passwordResetAt','md5secret','index','getOptions','where','User','query','includeAll','userSetting','UserSetting','attributes','findAll','rows','openTabs','length','push','chat','sms','dataValues','fax','mail','openchannel','whatsapp','all','catch','show','params','include','true','merge','options','body','describe','addContacts','ids','internal','Setting','findById','securePassword','validatePasswordPattern','password','max','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','SELECT','from','voicemail','mailbox','fullname','email','permissions','101','102','103','104','105','106','109','100','111','114','115','create','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','VoiceMail','UserProfileSection','userProfileId','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','isEmpty','compact','changePassword','newPassword','Sequelize','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','oldPassword','ValidationError','Wrong\x20credentials','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','updatePasswordsHistory','addQueues','channel','online','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','spread','QueueId','Queue:save','voice','format','SIP/%s','upsert','isArray','Queue:remove','userpic','file','filename','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','getOpenTabs','ChatOpenTabs','CHAT','FaxOpenTabs','createdAt','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','getContacts','hasOwnProperty','CmList','List','Tag','Tags','color','tag','getQueues','model','keys','Queue','filters','intersection','order','sort','pick','Unknown\x20role','getVoiceQueuesRt','UserVoiceQueueRt','fields','nolimit','getGroups','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','MailInteraction','getSmsInteractions','SmsInteraction','FaxInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','login','phone','mobile','loginInPause','LOCAL/%s@from-sip/n','intrf','user:%s','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','PAUSE','LOGININPAUSE','pause','updateAttributes','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','Team','getTeams','resolve','transaction','getAssociatedQueues','flattenDeep','addAgent','getDataValue','Voice','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','omit','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','WhatsappAccount','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','CmHopper','$and','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$like','$notLike','$iLike','$notILike','$overlap','$contains','$any','firstName','lastName','CmContact','Contact','dialActive','getApiKey','token','json','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','nonce','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','teams','queues','inbound','flatten','toString','desc','asc','uniqBy','orderBy','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','offline','unknown','unavailable','ringing','voiceStatus','busy','slice','toUpperCase','QueryTypes','select','field','ui.','InteractionId','ui.createdAt','ui.UserId\x20=\x20?','moment','squel','jayson/promise','ioredis','../../components/auth/service','../../config/logger','api','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','socket.io-emitter','redis','./user.socket','register','defaults','localhost','client','http','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','update','role','agent','emit','then','get','admin','user','Agents','Telephones','telephone','filter','ignore','map','value','includes','find','name','destroy','error','stack','send','rawAttributes','fieldName','type','key','salt','previousPasswords','resetPasswordToken','resetPasswordExpires'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x69a4,0x14a));var _0x469a=function(_0x35024a,_0x5ad01e){_0x35024a=_0x35024a-0x0;var _0x549b24=_0x69a4[_0x35024a];return _0x549b24;};'use strict';var moment=require(_0x469a('0x0'));var util=require('util');var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x469a('0x1'));var jayson=require(_0x469a('0x2'));var Redis=require(_0x469a('0x3'));var authService=require(_0x469a('0x4'));var contacts=require('../../components/contacts');var qs=require('../../components/parsers/qs');var logger=require(_0x469a('0x5'))(_0x469a('0x6'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x469a('0x7'));var APIBadRequestError=require(_0x469a('0x8'))[_0x469a('0x9')];var APINotFoundError=require(_0x469a('0x8'))[_0x469a('0xa')];var APIHandleError=require(_0x469a('0x8'))['handleError'];var db=require('../../mysqldb')['db'];var socket=require(_0x469a('0xb'))(new Redis(config[_0x469a('0xc')]));require(_0x469a('0xd'))[_0x469a('0xe')](socket);config[_0x469a('0xc')]=_[_0x469a('0xf')](config['redis'],{'host':_0x469a('0x10'),'port':0x18eb});var amiClient=jayson[_0x469a('0x11')][_0x469a('0x12')]({'port':0x232a});var values;function respondWithStatusCode(_0x57abd2,_0x18f912){_0x18f912=_0x18f912||0xcc;return function(_0x130629){if(_0x130629){return _0x57abd2[_0x469a('0x13')](_0x18f912);}return _0x57abd2[_0x469a('0x14')](_0x18f912)[_0x469a('0x15')]();};}function respondWithResult(_0x465e04,_0x5b9556){_0x5b9556=_0x5b9556||0xc8;return function(_0x4b2f52){if(_0x4b2f52){return _0x465e04[_0x469a('0x14')](_0x5b9556)['json'](_0x4b2f52);}};}function respondWithFilteredResult(_0x115334,_0x270894){return function(_0x5343c0){if(_0x5343c0){var _0x572761=typeof _0x270894['offset']===_0x469a('0x16')&&typeof _0x270894[_0x469a('0x17')]===_0x469a('0x16');var _0x3c41e6=_0x5343c0['count'];var _0x4d46d1=_0x572761?0x0:_0x270894[_0x469a('0x18')];var _0x11bf5f=_0x572761?_0x5343c0[_0x469a('0x19')]:_0x270894[_0x469a('0x18')]+_0x270894[_0x469a('0x17')];var _0x508d40;if(_0x11bf5f>=_0x3c41e6){_0x11bf5f=_0x3c41e6;_0x508d40=0xc8;}else{_0x508d40=0xce;}_0x115334['status'](_0x508d40);return _0x115334[_0x469a('0x1a')](_0x469a('0x1b'),_0x4d46d1+'-'+_0x11bf5f+'/'+_0x3c41e6)['json'](_0x5343c0);}return null;};}function saveUpdates(_0x2a1ecd){return function(_0x4c79a7){if(_0x4c79a7){return _0x4c79a7[_0x469a('0x1c')](_0x2a1ecd)['then'](function(_0xc61bbc){if(_0xc61bbc[_0x469a('0x1d')]===_0x469a('0x1e')){socket[_0x469a('0x1f')]('userNotification:recalc:'+_0xc61bbc['id'],_0xc61bbc);}return _0xc61bbc;});}return null;};}function removeEntity(_0x4da791){return function(_0x2d0230){if(_0x2d0230){return _0x2d0230['destroy']()[_0x469a('0x20')](function(){var _0xaebe72=_0x2d0230[_0x469a('0x21')]({'plain':!![]});if(_0xaebe72[_0x469a('0x1d')]===_0x469a('0x22'))return;var _0x3183f4=[{'name':'Users','value':_0x469a('0x23'),'ignore':!![]},{'name':_0x469a('0x24'),'value':_0x469a('0x1e'),'ignore':![]},{'name':_0x469a('0x25'),'value':_0x469a('0x26'),'ignore':![]}];var _0x4e5f3f=_(_0x3183f4)[_0x469a('0x27')](_0x469a('0x28'))[_0x469a('0x29')](_0x469a('0x2a'))[_0x469a('0x2a')]();if(_[_0x469a('0x2b')](_0x4e5f3f,_0xaebe72[_0x469a('0x1d')])){return;}var _0x35de9d=_[_0x469a('0x2c')](_0x3183f4,['value',_0xaebe72[_0x469a('0x1d')]])[_0x469a('0x2d')];return db['UserProfileResource'][_0x469a('0x2e')]({'where':{'type':_0x35de9d,'resourceId':_0xaebe72['id']}})[_0x469a('0x20')](function(){return _0x2d0230;});})[_0x469a('0x20')](function(){_0x4da791['status'](0xcc)[_0x469a('0x15')]();});}};}function handleEntityNotFound(_0x429858){return function(_0x4233cb){if(!_0x4233cb){_0x429858['sendStatus'](0x194);}return _0x4233cb;};}function handleError(_0x4f1abb,_0x3e67fd){_0x3e67fd=_0x3e67fd||0x1f4;return function(_0x23e4f2){logger[_0x469a('0x2f')](_0x23e4f2[_0x469a('0x30')]);if(_0x23e4f2[_0x469a('0x2d')]){delete _0x23e4f2[_0x469a('0x2d')];}_0x4f1abb[_0x469a('0x14')](_0x3e67fd)[_0x469a('0x31')](_0x23e4f2);};}function getUserAttributes(){return _(db['User'][_0x469a('0x32')])[_0x469a('0x29')](function(_0x28fb55){return{'name':_0x28fb55[_0x469a('0x33')],'type':_0x28fb55[_0x469a('0x34')][_0x469a('0x35')]};})[_0x469a('0x27')](function(_0x223bbb){return!['password',_0x469a('0x36'),_0x469a('0x37'),_0x469a('0x38'),_0x469a('0x39'),_0x469a('0x3a'),_0x469a('0x3b')]['includes'](_0x223bbb[_0x469a('0x2d')]);})[_0x469a('0x2a')]();}exports[_0x469a('0x3c')]=function(_0x52ca08,_0xf0ad07){var _0x391bc5={},_0x4f6cc6={'count':0x0,'rows':[]};var _0x2e566b=getUserAttributes();_0x391bc5=qs[_0x469a('0x3d')](_0x2e566b,_0x52ca08);var _0x4ee0bf={'where':_0x391bc5[_0x469a('0x3e')]};return db[_0x469a('0x3f')][_0x469a('0x19')](_0x4ee0bf)[_0x469a('0x20')](function(_0x46018d){_0x4f6cc6[_0x469a('0x19')]=_0x46018d;if(_0x52ca08[_0x469a('0x40')][_0x469a('0x41')]){_0x391bc5['include']=[{'all':!![]}];}if(_0x52ca08[_0x469a('0x40')][_0x469a('0x42')]==='true'){_0x391bc5['include']=[{'model':db[_0x469a('0x43')],'as':_0x469a('0x42')}];}if(!_[_0x469a('0x2b')](_0x391bc5[_0x469a('0x44')],'id')){_0x391bc5[_0x469a('0x44')]['push']('id');}return db['User'][_0x469a('0x45')](_0x391bc5);})[_0x469a('0x20')](function(_0x1cf933){_0x4f6cc6[_0x469a('0x46')]=_0x1cf933;if(_0x52ca08['query'][_0x469a('0x47')]==='true'){var _0x43665c=[];for(var _0x3312d8=0x0;_0x3312d8<_0x4f6cc6[_0x469a('0x46')][_0x469a('0x48')];_0x3312d8++){_0x43665c[_0x469a('0x49')](get_open_tabs(_0x469a('0x4a'),_0x4f6cc6[_0x469a('0x46')][_0x3312d8]['dataValues']));_0x43665c[_0x469a('0x49')](get_open_tabs(_0x469a('0x4b'),_0x4f6cc6[_0x469a('0x46')][_0x3312d8][_0x469a('0x4c')]));_0x43665c['push'](get_open_tabs(_0x469a('0x4d'),_0x4f6cc6['rows'][_0x3312d8][_0x469a('0x4c')]));_0x43665c[_0x469a('0x49')](get_open_tabs(_0x469a('0x4e'),_0x4f6cc6[_0x469a('0x46')][_0x3312d8][_0x469a('0x4c')]));_0x43665c[_0x469a('0x49')](get_open_tabs(_0x469a('0x4f'),_0x4f6cc6['rows'][_0x3312d8][_0x469a('0x4c')]));_0x43665c[_0x469a('0x49')](get_open_tabs(_0x469a('0x50'),_0x4f6cc6[_0x469a('0x46')][_0x3312d8][_0x469a('0x4c')]));}return Promise[_0x469a('0x51')](_0x43665c)[_0x469a('0x20')](function(){return _0x4f6cc6;});}else{return _0x4f6cc6;}})[_0x469a('0x20')](respondWithFilteredResult(_0xf0ad07,_0x391bc5))[_0x469a('0x52')](handleError(_0xf0ad07,null));};exports[_0x469a('0x53')]=function(_0x2442db,_0x1bb082){var _0x85c799=getUserAttributes();_0x2442db['query']['id']=_0x2442db[_0x469a('0x54')]['id'];var _0x1b12d0=qs['getOptions'](_0x85c799,_0x2442db);if(_0x2442db[_0x469a('0x40')]['includeAll']){_0x1b12d0[_0x469a('0x55')]=[{'all':!![]}];}if(_0x2442db['query']['userSetting']===_0x469a('0x56')){_0x1b12d0[_0x469a('0x55')]=[{'model':db['UserSetting'],'as':_0x469a('0x42')}];}_0x1b12d0=_[_0x469a('0x57')]({},_0x1b12d0,_0x2442db[_0x469a('0x58')]);if(!_[_0x469a('0x2b')](_0x1b12d0[_0x469a('0x44')],'id')){_0x1b12d0[_0x469a('0x44')][_0x469a('0x49')]('id');}return db[_0x469a('0x3f')][_0x469a('0x2c')](_0x1b12d0)[_0x469a('0x20')](handleEntityNotFound(_0x1bb082,null))['then'](function(_0x1de174){var _0x13fe80=[];values=_0x1de174;if(_0x2442db[_0x469a('0x40')][_0x469a('0x47')]==='true'){_0x13fe80[_0x469a('0x49')](get_open_tabs(_0x469a('0x4a'),_0x1de174[_0x469a('0x4c')]));_0x13fe80['push'](get_open_tabs('sms',_0x1de174[_0x469a('0x4c')]));_0x13fe80[_0x469a('0x49')](get_open_tabs(_0x469a('0x4f'),_0x1de174['dataValues']));_0x13fe80[_0x469a('0x49')](get_open_tabs(_0x469a('0x50'),_0x1de174[_0x469a('0x4c')]));_0x13fe80[_0x469a('0x49')](get_open_tabs(_0x469a('0x4d'),_0x1de174[_0x469a('0x4c')]));_0x13fe80[_0x469a('0x49')](get_open_tabs('mail',_0x1de174[_0x469a('0x4c')]));return Promise['all'](_0x13fe80);}else{return values;}})[_0x469a('0x20')](function(){return values;})[_0x469a('0x20')](respondWithResult(_0x1bb082,null))[_0x469a('0x52')](handleError(_0x1bb082,null));};exports[_0x469a('0x1c')]=function(_0x5e0d26,_0x41fce2){if(_0x5e0d26[_0x469a('0x59')]['id']){delete _0x5e0d26[_0x469a('0x59')]['id'];}delete _0x5e0d26[_0x469a('0x59')][_0x469a('0x1d')];return db[_0x469a('0x3f')][_0x469a('0x2c')]({'where':{'id':_0x5e0d26[_0x469a('0x54')]['id']}})['then'](handleEntityNotFound(_0x41fce2,null))[_0x469a('0x20')](saveUpdates(_0x5e0d26[_0x469a('0x59')],null))['then'](respondWithResult(_0x41fce2,null))[_0x469a('0x52')](handleError(_0x41fce2,null));};exports[_0x469a('0x5a')]=function(_0x2ff151,_0x150ce0){return db['User'][_0x469a('0x5a')]()['then'](respondWithResult(_0x150ce0,null))[_0x469a('0x52')](handleError(_0x150ce0,null));};exports[_0x469a('0x5b')]=function(_0x4abc51,_0x5896bd){return db['User'][_0x469a('0x2c')]({'where':{'id':_0x4abc51['params']['id']}})[_0x469a('0x20')](handleEntityNotFound(_0x5896bd,null))[_0x469a('0x20')](function(_0x239ab6){if(_0x239ab6){return _0x239ab6[_0x469a('0x5b')](_0x4abc51[_0x469a('0x59')]['ids'],_['omit'](_0x4abc51[_0x469a('0x59')],[_0x469a('0x5c'),'id'])||{});}})[_0x469a('0x20')](respondWithResult(_0x5896bd,null))[_0x469a('0x52')](handleError(_0x5896bd,null));};function validateUser(_0x2e2ae1){return new Promise(function(_0x2770b7,_0xef4b1a){if(_0x2e2ae1[_0x469a('0x5d')])return _0x2770b7(_0x2e2ae1);return db[_0x469a('0x5e')][_0x469a('0x5f')](0x1)['then'](function(_0x415324){if(_0x415324[_0x469a('0x60')])authService[_0x469a('0x61')](_0x2e2ae1[_0x469a('0x62')]);db['User'][_0x469a('0x63')]('internal')['then'](function(_0x55e119){if(_[_0x469a('0x64')](_0x55e119)){_0x2e2ae1[_0x469a('0x5d')]=_0x415324[_0x469a('0x65')]||0x1;return;}if(_[_0x469a('0x64')](_0x415324[_0x469a('0x65')])||_0x415324['min_internal']===_0x55e119){_0x2e2ae1[_0x469a('0x5d')]=_0x55e119+0x1;return;}if(_0x415324['min_internal']>_0x55e119){_0x2e2ae1[_0x469a('0x5d')]=_0x415324[_0x469a('0x65')];return;}return db[_0x469a('0x66')]['query'](_0x469a('0x67'),{'type':db['sequelize']['QueryTypes'][_0x469a('0x68')]})['then'](function(_0x305b47){if(_0x305b47&&_0x305b47[_0x469a('0x48')]){for(var _0x17428c=0x0,_0x386ac0=_0x305b47[_0x469a('0x48')];_0x17428c<_0x386ac0&&_[_0x469a('0x64')](_0x2e2ae1[_0x469a('0x5d')]);_0x17428c++){if(_0x415324[_0x469a('0x65')]<=_0x305b47[_0x17428c][_0x469a('0x69')]){_0x2e2ae1[_0x469a('0x5d')]=_0x305b47[_0x17428c]['from'];}else if(_0x415324[_0x469a('0x65')]>_0x305b47[_0x17428c]['from']&&_0x415324[_0x469a('0x65')]<=_0x305b47[_0x17428c]['to']){_0x2e2ae1[_0x469a('0x5d')]=_0x415324['min_internal'];}}}if(_[_0x469a('0x64')](_0x2e2ae1[_0x469a('0x5d')])){_0x2e2ae1[_0x469a('0x5d')]=_0x55e119+0x1;}return _0x2770b7(_0x2e2ae1);});});})[_0x469a('0x52')](function(_0x292fd9){_0xef4b1a(_0x292fd9);});});}function updateUser(_0x4b8ea3){return new Promise(function(_0x2aca8a,_0x5afe9d){try{if(_0x4b8ea3[_0x469a('0x6a')]){_0x4b8ea3[_0x469a('0x6b')]=_0x4b8ea3[_0x469a('0x5d')];_0x4b8ea3['VoiceMail']={'mailbox':_0x4b8ea3[_0x469a('0x5d')],'password':_0x4b8ea3[_0x469a('0x62')],'fullname':_0x4b8ea3[_0x469a('0x6c')],'email':_0x4b8ea3[_0x469a('0x6d')]};}if(_0x4b8ea3[_0x469a('0x1d')]===_0x469a('0x1e')){if(!_0x4b8ea3[_0x469a('0x6e')])_0x4b8ea3[_0x469a('0x6e')]=[_0x469a('0x6f'),_0x469a('0x70'),_0x469a('0x71'),'113','110',_0x469a('0x72'),_0x469a('0x73'),_0x469a('0x74'),'107','108',_0x469a('0x75'),_0x469a('0x76'),_0x469a('0x77'),_0x469a('0x78'),_0x469a('0x79')];}_0x2aca8a(_0x4b8ea3);}catch(_0x52f402){_0x5afe9d(_0x52f402);}});}exports[_0x469a('0x7a')]=function(_0x48ace9,_0x8dc32e){if(_0x48ace9['user'][_0x469a('0x1d')]===_0x469a('0x1e'))throw new Error('Unauthorized');if(_0x48ace9[_0x469a('0x59')][_0x469a('0x1d')]===_0x469a('0x23')&&_0x48ace9[_0x469a('0x23')]['role']!==_0x469a('0x22')){throw new Error(_0x469a('0x7b'));}if(_0x48ace9[_0x469a('0x59')][_0x469a('0x1d')]===_0x469a('0x22')&&_0x48ace9['user']['role']!==_0x469a('0x22')){throw new Error(_0x469a('0x7c'));}return licenseUtil[_0x469a('0x7d')]([_0x48ace9['body']])[_0x469a('0x20')](function(){return validateUser(_0x48ace9[_0x469a('0x59')]);})[_0x469a('0x20')](function(_0x55ba69){return updateUser(_0x55ba69)[_0x469a('0x20')](function(_0x252a95){if(_0x252a95[_0x469a('0x1d')]==='admin'){_0x252a95['settingsEnabled']=_0x48ace9['user']['settingsEnabled'];delete _0x252a95['userProfileId'];}return _0x252a95;});})[_0x469a('0x20')](function(_0x65bb10){return db[_0x469a('0x3f')][_0x469a('0x7a')](_0x65bb10,{'include':[{'model':db[_0x469a('0x7e')],'as':_0x469a('0x7e')}]});})[_0x469a('0x20')](function(_0x23d57){if(_0x48ace9['body'][_0x469a('0x1d')]===_0x469a('0x23'))return _0x23d57;if(_0x48ace9[_0x469a('0x23')][_0x469a('0x1d')]!=='user')return _0x23d57;return db[_0x469a('0x7f')][_0x469a('0x2c')]({'where':{'name':_0x23d57['role']===_0x469a('0x1e')?'Agents':_0x469a('0x25'),'userProfileId':_0x48ace9[_0x469a('0x23')][_0x469a('0x80')]},'raw':!![]})[_0x469a('0x20')](function(_0x438025){if(!_0x438025||_0x438025['autoAssociation']!=0x0)return _0x23d57;return db[_0x469a('0x81')][_0x469a('0x7a')]({'name':_0x23d57[_0x469a('0x2d')],'resourceId':_0x23d57['id'],'type':_0x438025[_0x469a('0x2d')],'sectionId':_0x438025['id']},{})[_0x469a('0x20')](function(){return _0x23d57;});})[_0x469a('0x52')](function(_0x45f9e4){logger[_0x469a('0x2f')](_0x469a('0x82'),_0x45f9e4);throw _0x45f9e4;});})['then'](respondWithResult(_0x8dc32e,0xc9))[_0x469a('0x52')](handleError(_0x8dc32e,null));};exports[_0x469a('0x83')]=function(_0x47a9d1,_0x36e37f){var _0x4d132d=_0x47a9d1[_0x469a('0x59')];var _0xff2d1=[];if(_0x47a9d1[_0x469a('0x23')][_0x469a('0x1d')]==='agent')throw new Error(_0x469a('0x84'));if(_[_0x469a('0x85')](_0x4d132d,[_0x469a('0x1d'),'user'])&&_0x47a9d1[_0x469a('0x23')][_0x469a('0x1d')]!==_0x469a('0x22')){throw new Error(_0x469a('0x7b'));}if(_[_0x469a('0x85')](_0x4d132d,[_0x469a('0x1d'),'admin'])&&_0x47a9d1['user'][_0x469a('0x1d')]!=='admin'){throw new Error(_0x469a('0x86'));}return licenseUtil[_0x469a('0x7d')](_0x4d132d)['then'](function(){return validateUser(_0x4d132d[0x0]);})[_0x469a('0x20')](function(){for(var _0x1d5331=0x1;_0x1d5331<_0x4d132d[_0x469a('0x48')];_0x1d5331++){var _0x494fe2=_0x4d132d[_0x1d5331-0x1]['internal'];if(!_0x4d132d[_0x1d5331][_0x469a('0x5d')])_0x4d132d[_0x1d5331][_0x469a('0x5d')]=_0x494fe2+0x1;_0xff2d1[_0x469a('0x49')](validateUser(_0x4d132d[_0x1d5331]));}return Promise[_0x469a('0x51')](_0xff2d1);})[_0x469a('0x20')](function(){_0xff2d1=[];for(var _0x5e3560=0x0;_0x5e3560<_0x4d132d[_0x469a('0x48')];_0x5e3560++){_0xff2d1[_0x469a('0x49')](updateUser(_0x4d132d[_0x5e3560]));}return Promise[_0x469a('0x51')](_0xff2d1);})[_0x469a('0x20')](function(){_0xff2d1=_0x4d132d['map'](function(_0x514f95){return db[_0x469a('0x3f')][_0x469a('0x7a')](_0x514f95,{'include':[{'model':db[_0x469a('0x7e')],'as':_0x469a('0x7e')}]})[_0x469a('0x20')](function(_0x247f75){_0x514f95['id']=_0x247f75['id'];return _0x514f95;});});return Promise[_0x469a('0x51')](_0xff2d1);})[_0x469a('0x20')](function(_0x24fc60){if(_0x47a9d1[_0x469a('0x59')][_0x469a('0x1d')]==='user')return _0x24fc60;if(_0x47a9d1['user'][_0x469a('0x1d')]!=='user')return _0x24fc60;var _0x1f3891=_[_0x469a('0x85')](_0x24fc60,function(_0x500d42){return _0x500d42[_0x469a('0x1d')]===_0x469a('0x1e')||_0x500d42[_0x469a('0x1d')]===_0x469a('0x26');});if(!_0x1f3891)return _0x24fc60;return db['UserProfileSection'][_0x469a('0x45')]({'where':{'name':{'$or':[_0x469a('0x24'),_0x469a('0x25')]},'userProfileId':_0x47a9d1[_0x469a('0x23')][_0x469a('0x80')]},'raw':!![]})[_0x469a('0x20')](function(_0x4c860c){if(_[_0x469a('0x87')](_0x4c860c)||!_[_0x469a('0x85')](_0x4c860c,['autoAssociation',0x0]))return _0x24fc60;_0xff2d1=[];var _0x5f5288=_(_0x4c860c)[_0x469a('0x29')](function(_0x2f728e){if(_0x2f728e['autoAssociation']===0x1)return;return _0x2f728e[_0x469a('0x2d')]===_0x469a('0x24')?'agent':_0x469a('0x26');})[_0x469a('0x88')]()['value']();for(var _0x33790d=0x0;_0x33790d<_0x24fc60[_0x469a('0x48')];_0x33790d++){if(!_['includes'](_0x5f5288,_0x24fc60[_0x33790d][_0x469a('0x1d')]))return;var _0x55071b=_0x24fc60[_0x33790d][_0x469a('0x1d')]===_0x469a('0x1e')?_0x469a('0x24'):_0x469a('0x25');_0xff2d1[_0x469a('0x49')](db[_0x469a('0x81')][_0x469a('0x7a')]({'name':_0x24fc60[_0x33790d][_0x469a('0x2d')],'resourceId':_0x24fc60[_0x33790d]['id'],'type':_0x55071b,'sectionId':_[_0x469a('0x2c')](_0x4c860c,['name',_0x55071b])['id']},{}));}return Promise[_0x469a('0x51')](_0xff2d1);});})[_0x469a('0x20')](respondWithResult(_0x36e37f,0xc9))[_0x469a('0x52')](handleError(_0x36e37f,null));};exports[_0x469a('0x89')]=function(_0x88ba9e,_0x3696f3){if(_0x88ba9e[_0x469a('0x59')]['id']){delete _0x88ba9e['body']['id'];}return db[_0x469a('0x3f')][_0x469a('0x2c')]({'where':{'id':_0x88ba9e[_0x469a('0x54')]['id']}})[_0x469a('0x20')](function(_0x56ecdb){if(!_0x56ecdb)return null;if(_0x56ecdb['id']===_0x88ba9e[_0x469a('0x23')]['id']){if(!_0x88ba9e['body']['oldPassword']||!_0x88ba9e[_0x469a('0x59')][_0x469a('0x8a')]){throw new db[(_0x469a('0x8b'))]['ValidationError'](_0x469a('0x8c'));}if(!_0x56ecdb[_0x469a('0x8d')](_0x88ba9e[_0x469a('0x59')][_0x469a('0x8e')])){throw new db[(_0x469a('0x8b'))][(_0x469a('0x8f'))](_0x469a('0x90'));}if(_0x88ba9e['body'][_0x469a('0x8e')]===_0x88ba9e['body'][_0x469a('0x8a')]){throw new db[(_0x469a('0x8b'))][(_0x469a('0x8f'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x88ba9e[_0x469a('0x23')]['role']==='admin'){if(!_0x88ba9e[_0x469a('0x59')][_0x469a('0x8a')]){throw new db[(_0x469a('0x8b'))][(_0x469a('0x8f'))](_0x469a('0x91'));}}else if(_0x88ba9e[_0x469a('0x23')]['role']===_0x469a('0x23')){if(!_0x88ba9e['body']['newPassword']){throw new db['Sequelize'][(_0x469a('0x8f'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x56ecdb[_0x469a('0x1d')]!==_0x469a('0x1e')){throw new db[(_0x469a('0x8b'))]['ValidationError'](_0x469a('0x84'));}}else{throw new db[(_0x469a('0x8b'))]['ValidationError'](_0x469a('0x84'));}return _0x56ecdb;})['then'](handleEntityNotFound(_0x3696f3,null))[_0x469a('0x20')](function(_0x4b10de){return db['Setting'][_0x469a('0x92')]({'attributes':['id',_0x469a('0x60'),_0x469a('0x93'),_0x469a('0x94')]})[_0x469a('0x20')](function(_0x5e9c3e){if(_0x5e9c3e[_0x469a('0x60')])authService[_0x469a('0x61')](_0x88ba9e[_0x469a('0x59')][_0x469a('0x8a')]);if(!_0x5e9c3e[_0x469a('0x93')]||!_0x4b10de['previousPasswords'])return _0x4b10de;authService['validatePasswordHistory'](_0x88ba9e[_0x469a('0x59')][_0x469a('0x8a')],_0x4b10de['previousPasswords'],_0x5e9c3e[_0x469a('0x94')]);return _0x4b10de;})[_0x469a('0x20')](saveUpdates({'password':_0x88ba9e['body'][_0x469a('0x8a')],'passwordResetAt':_0x88ba9e[_0x469a('0x23')]['id']==_0x88ba9e[_0x469a('0x54')]['id']?moment():null,'previousPasswords':authService[_0x469a('0x95')](_0x88ba9e['body']['newPassword'],_0x4b10de[_0x469a('0x37')])},null));})[_0x469a('0x20')](respondWithResult(_0x3696f3,null))[_0x469a('0x52')](handleError(_0x3696f3,null));};exports[_0x469a('0x96')]=function(_0x467f89,_0x57ba88){var _0x2d910f=_0x467f89[_0x469a('0x59')][_0x469a('0x97')];return db[_0x469a('0x3f')][_0x469a('0x2c')]({'where':{'id':_0x467f89['params']['id']},'attributes':['id',_0x469a('0x2d'),'role',_0x469a('0x98'),'loginInPause',_0x469a('0x99'),_0x469a('0x9a')]})[_0x469a('0x20')](handleEntityNotFound(_0x57ba88,null))['then'](function(_0x53568b){if(_0x53568b){if(!utils[_0x469a('0x9b')](_0x2d910f)){throw new db[(_0x469a('0x8b'))][(_0x469a('0x8f'))](_0x469a('0x9c'));}return _0x53568b[_0x469a('0x9d')+_[_0x469a('0x9e')](_0x2d910f[_0x469a('0x9f')]())+_0x469a('0xa0')](_0x467f89[_0x469a('0x59')][_0x469a('0x5c')],{'penalty':_0x467f89[_0x469a('0x59')][_0x469a('0xa1')]||0x0})[_0x469a('0xa2')](function(_0x143785){for(var _0x4c5d4e=0x0;_0x4c5d4e<_0x467f89[_0x469a('0x59')][_0x469a('0x5c')]['length'];_0x4c5d4e+=0x1){var _0x40ac09={'UserId':Number(_0x467f89[_0x469a('0x54')]['id'])};_0x40ac09[_[_0x469a('0x9e')](_0x2d910f['toLowerCase']())+_0x469a('0xa3')]=Number(_0x467f89[_0x469a('0x59')]['ids'][_0x4c5d4e]);socket[_0x469a('0x1f')](_0x469a('0x23')+_[_0x469a('0x9e')](_0x2d910f['toLowerCase']())+_0x469a('0xa4'),_0x40ac09);}return _0x143785;})[_0x469a('0x20')](function(){if(_0x2d910f===_0x469a('0xa5')){return db['VoiceQueue']['findAll']({'where':{'id':_0x467f89['body'][_0x469a('0x5c')]||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0x16014b){var _0x321fc4=_0x53568b[_0x469a('0x21')]({'plain':!![]});var _0x120c0a=[];if(_0x2d910f===_0x469a('0xa5')&&_0x321fc4[_0x469a('0x1d')]===_0x469a('0x1e')&&_0x321fc4[_0x469a('0x98')]){for(let _0x383297=0x0;_0x383297<_0x16014b[_0x469a('0x48')];_0x383297+=0x1){_0x120c0a[_0x469a('0x49')]({'membername':_0x321fc4[_0x469a('0x2d')],'UserId':_0x321fc4['id'],'queue_name':_0x16014b[_0x383297][_0x469a('0x2d')],'VoiceQueueId':_0x16014b[_0x383297]['id'],'interface':_[_0x469a('0x64')](_0x321fc4[_0x469a('0x9a')])?util[_0x469a('0xa6')](_0x469a('0xa7'),_0x321fc4[_0x469a('0x2d')]):_0x321fc4['interface'],'paused':_0x321fc4[_0x469a('0x99')]||![],'penalty':_0x467f89[_0x469a('0x59')]['penalty']||0x0});}return Promise[_0x469a('0x51')](_0x120c0a[_0x469a('0x29')](function(_0x53a781){return db['UserVoiceQueueRt'][_0x469a('0xa8')](_0x53a781);}));}return _0x53568b;});}})['then'](respondWithStatusCode(_0x57ba88,null))[_0x469a('0x52')](handleError(_0x57ba88,null));};exports['removeQueues']=function(_0x55e34b,_0x238f74){var _0x42e6e4,_0xeaacad;return db[_0x469a('0x3f')]['find']({'where':{'id':_0x55e34b[_0x469a('0x54')]['id']},'attributes':['id','name','role']})[_0x469a('0x20')](handleEntityNotFound(_0x238f74,null))['then'](function(_0x55bfe9){if(_0x55bfe9){_0x42e6e4=_0x55bfe9;if(!_0x55e34b[_0x469a('0x40')]['channel']||!utils[_0x469a('0x9b')](_0x55e34b[_0x469a('0x40')][_0x469a('0x97')])){throw new db[(_0x469a('0x8b'))][(_0x469a('0x8f'))](_0x469a('0x9c'));}return _0x55bfe9['remove'+_[_0x469a('0x9e')](_0x55e34b['query']['channel']['toLowerCase']())+_0x469a('0xa0')](_0x55e34b[_0x469a('0x40')][_0x469a('0x5c')]);}})['then'](function(_0x568a0b){if(_[_0x469a('0xa9')](_0x55e34b[_0x469a('0x40')][_0x469a('0x5c')])){for(var _0x45e10c=0x0;_0x45e10c<_0x55e34b[_0x469a('0x40')][_0x469a('0x5c')][_0x469a('0x48')];_0x45e10c+=0x1){_0xeaacad={'UserId':Number(_0x55e34b['params']['id'])};_0xeaacad[_['capitalize'](_0x55e34b['query'][_0x469a('0x97')]['toLowerCase']())+'QueueId']=Number(_0x55e34b['query'][_0x469a('0x5c')][_0x45e10c]);socket[_0x469a('0x1f')](_0x469a('0x23')+_[_0x469a('0x9e')](_0x55e34b[_0x469a('0x40')][_0x469a('0x97')][_0x469a('0x9f')]())+_0x469a('0xaa'),_0xeaacad);}}else{_0xeaacad={'UserId':Number(_0x55e34b['params']['id'])};_0xeaacad[_['capitalize'](_0x55e34b['query'][_0x469a('0x97')][_0x469a('0x9f')]())+'QueueId']=Number(_0x55e34b[_0x469a('0x40')]['ids']);socket['emit'](_0x469a('0x23')+_[_0x469a('0x9e')](_0x55e34b[_0x469a('0x40')][_0x469a('0x97')][_0x469a('0x9f')]())+_0x469a('0xaa'),_0xeaacad);}return _0x568a0b;})[_0x469a('0x20')](function(){if(_0x55e34b[_0x469a('0x40')]['channel']===_0x469a('0xa5')){return db['UserVoiceQueueRt']['destroy']({'where':{'UserId':_0x55e34b[_0x469a('0x54')]['id'],'VoiceQueueId':_0x55e34b[_0x469a('0x40')][_0x469a('0x5c')]},'individualHooks':!![]})[_0x469a('0x20')](function(){return _0x42e6e4;});}return _0x42e6e4;})[_0x469a('0x20')](respondWithStatusCode(_0x238f74,null))[_0x469a('0x52')](handleError(_0x238f74,null));};exports['addAvatar']=function(_0x32b2cf,_0x598c13){_0x32b2cf[_0x469a('0x59')][_0x469a('0xab')]=_0x32b2cf[_0x469a('0xac')][_0x469a('0xad')];return db['User'][_0x469a('0x2c')]({'where':{'id':_0x32b2cf[_0x469a('0x54')]['id']}})[_0x469a('0x20')](handleEntityNotFound(_0x598c13,null))[_0x469a('0x20')](saveUpdates(_0x32b2cf['body'],null))['then'](respondWithResult(_0x598c13,null))[_0x469a('0x52')](handleError(_0x598c13,null));};exports['getAvatar']=function(_0xec8b1d,_0x5a47fc){var _0x1cca42=path[_0x469a('0xae')](config[_0x469a('0xaf')],_0x469a('0xb0'));return db[_0x469a('0x3f')][_0x469a('0x2c')]({'where':{'id':_0xec8b1d['params']['id']},'attributes':['id',_0x469a('0xab')],'raw':!![]})[_0x469a('0x20')](handleEntityNotFound(_0x5a47fc,null))[_0x469a('0x20')](function(_0x4aa9de){if(_0x4aa9de){if(_[_0x469a('0x64')](_0x4aa9de[_0x469a('0xab')])){return _0x5a47fc[_0x469a('0xb1')](_0x1cca42);}else{if(!fs[_0x469a('0xb2')](path[_0x469a('0xae')](config['root'],_0x469a('0xb3'),_0x4aa9de['userpic']))){return _0x5a47fc[_0x469a('0xb1')](_0x1cca42);}return _0x5a47fc['download'](path[_0x469a('0xae')](config[_0x469a('0xaf')],'server/files/images/',_0x4aa9de[_0x469a('0xab')]));}}})[_0x469a('0x52')](handleError(_0x5a47fc,null));};exports[_0x469a('0xb4')]=function(_0x49ce0b,_0x1d5d8f){return db['User'][_0x469a('0x2c')]({'where':{'id':_0x49ce0b['params']['id']},'attributes':['id']})[_0x469a('0x20')](handleEntityNotFound(_0x1d5d8f,null))[_0x469a('0x20')](function(_0x114c24){var _0x555c17=[];values=_0x114c24[_0x469a('0x4c')];_0x555c17[_0x469a('0x49')](get_open_tabs(_0x469a('0x4a'),_0x114c24[_0x469a('0x4c')]));_0x555c17[_0x469a('0x49')](get_open_tabs(_0x469a('0x4b'),_0x114c24[_0x469a('0x4c')]));_0x555c17[_0x469a('0x49')](get_open_tabs('openchannel',_0x114c24[_0x469a('0x4c')]));_0x555c17[_0x469a('0x49')](get_open_tabs(_0x469a('0x50'),_0x114c24['dataValues']));_0x555c17[_0x469a('0x49')](get_open_tabs(_0x469a('0x4d'),_0x114c24[_0x469a('0x4c')]));_0x555c17[_0x469a('0x49')](get_open_tabs('mail',_0x114c24[_0x469a('0x4c')]));return Promise[_0x469a('0x51')](_0x555c17);})[_0x469a('0x20')](function(_0x1c3d8c){if(_0x1c3d8c){var _0x364cbd=_[_0x469a('0x29')](values[_0x469a('0xb5')],function(_0x282514){return{'channel':_0x469a('0xb6'),'id':_0x282514['id'],'createdAt':_0x282514['createdAt']};});var _0x4b2761=_[_0x469a('0x29')](values[_0x469a('0xb7')],function(_0xf745b4){return{'channel':'FAX','id':_0xf745b4['id'],'createdAt':_0xf745b4[_0x469a('0xb8')]};});var _0x5e8f2a=_[_0x469a('0x29')](values[_0x469a('0xb9')],function(_0x345a17){return{'channel':_0x469a('0xba'),'id':_0x345a17['id'],'createdAt':_0x345a17['createdAt']};});var _0x2f11c3=_[_0x469a('0x29')](values[_0x469a('0xbb')],function(_0x466efe){return{'channel':_0x469a('0xbc'),'id':_0x466efe['id'],'createdAt':_0x466efe[_0x469a('0xb8')]};});var _0xd8879b=_[_0x469a('0x29')](values[_0x469a('0xbd')],function(_0x1970b7){return{'channel':_0x469a('0xbe'),'id':_0x1970b7['id'],'createdAt':_0x1970b7['createdAt']};});var _0x27996f=_[_0x469a('0x29')](values[_0x469a('0xbf')],function(_0x32df65){return{'channel':_0x469a('0xc0'),'id':_0x32df65['id'],'createdAt':_0x32df65[_0x469a('0xb8')]};});var _0x16bfe0=_[_0x469a('0xc1')](_0x364cbd,_0x4b2761,_0x5e8f2a,_0x2f11c3,_0xd8879b,_0x27996f);var _0x473762={'count':_0x16bfe0[_0x469a('0x48')],'rows':_0x16bfe0};return _0x473762;}else return null;})[_0x469a('0x20')](respondWithResult(_0x1d5d8f,null))[_0x469a('0x52')](handleError(_0x1d5d8f,null));};exports[_0x469a('0xc2')]=function(_0x34d7ec,_0x471394){var _0x3f73f3={};return db['User'][_0x469a('0x92')]({'where':{'id':_0x34d7ec[_0x469a('0x54')]['id']}})[_0x469a('0x20')](function(_0x44c138){if(!_0x44c138){throw new APINotFoundError(util[_0x469a('0xa6')]('User\x20with\x20id\x20%s\x20not\x20found',_0x34d7ec['params']['id']));}return contacts['describe']();})[_0x469a('0x20')](function(_0x3d8207){_0x34d7ec[_0x469a('0x40')][_0x469a('0x3f')]=_0x34d7ec[_0x469a('0x54')]['id'];_0x3f73f3=qs[_0x469a('0x3d')](_0x3d8207,_0x34d7ec);if(_0x34d7ec[_0x469a('0x40')][_0x469a('0xc3')](_0x469a('0x41'))){_0x3f73f3[_0x469a('0x55')]=[{'model':db[_0x469a('0xc4')],'as':_0x469a('0xc5'),'required':![]},{'model':db[_0x469a('0xc6')],'as':_0x469a('0xc7'),'attributes':['id',_0x469a('0x2d'),_0x469a('0xc8')],'where':_0x34d7ec[_0x469a('0x40')]['tag']?{'id':_0x34d7ec[_0x469a('0x40')]['tag']}:undefined,'required':_0x34d7ec[_0x469a('0x40')][_0x469a('0xc9')]?!![]:![]}];}return contacts['findAll'](_0x34d7ec[_0x469a('0x40')],_0x34d7ec[_0x469a('0x23')],_0x3f73f3,_0x3d8207);})[_0x469a('0x20')](respondWithFilteredResult(_0x471394,_0x3f73f3))[_0x469a('0x52')](APIHandleError(_0x471394));};exports[_0x469a('0xca')]=function(_0x52f5fb,_0x464eff){var _0x25c1d4;var _0x520fa5={};var _0x202c33;return db[_0x469a('0x3f')][_0x469a('0x92')]({'where':{'id':_0x52f5fb[_0x469a('0x54')]['id']},'attributes':['id','name',_0x469a('0x1d')]})[_0x469a('0x20')](handleEntityNotFound(_0x464eff,null))['then'](function(_0x52b457){if(!utils[_0x469a('0x9b')](_0x52f5fb[_0x469a('0x40')][_0x469a('0x97')])){throw new db[(_0x469a('0x8b'))][(_0x469a('0x8f'))](_0x469a('0x9c'));}_0x25c1d4=_0x52b457;var _0x3f4ede={};_0x3f4ede[_0x469a('0xcb')]=_[_0x469a('0xcc')](db[_[_0x469a('0x9e')](_0x52f5fb[_0x469a('0x40')]['channel'])+_0x469a('0xcd')]['rawAttributes']);_0x3f4ede[_0x469a('0x40')]=_[_0x469a('0xcc')](_0x52f5fb['query']);_0x3f4ede[_0x469a('0xce')]=_[_0x469a('0xcf')](_0x3f4ede[_0x469a('0xcb')],_0x3f4ede[_0x469a('0x40')]);_0x520fa5[_0x469a('0x44')]=_[_0x469a('0xcf')](_0x3f4ede[_0x469a('0xcb')],qs['fields'](_0x52f5fb[_0x469a('0x40')]['fields']));_0x520fa5[_0x469a('0x44')]=_0x520fa5[_0x469a('0x44')][_0x469a('0x48')]?_0x520fa5[_0x469a('0x44')]:_0x3f4ede[_0x469a('0xcb')];_0x520fa5[_0x469a('0xd0')]=qs[_0x469a('0xd1')](_0x52f5fb[_0x469a('0x40')][_0x469a('0xd1')]);_0x520fa5[_0x469a('0x3e')]=qs[_0x469a('0xce')](_[_0x469a('0xd2')](_0x52f5fb[_0x469a('0x40')],_0x3f4ede[_0x469a('0xce')]));if(_0x52f5fb[_0x469a('0x40')]['filter']){_0x520fa5['where']=_['merge'](_0x520fa5['where'],{'$or':_[_0x469a('0x29')](_0x520fa5[_0x469a('0x44')],function(_0xf59014){var _0x38c303={};_0x38c303[_0xf59014]={'$like':'%'+_0x52f5fb['query'][_0x469a('0x27')]+'%'};return _0x38c303;})});}_0x520fa5=_[_0x469a('0x57')]({},_0x520fa5,_0x52f5fb[_0x469a('0x58')]);switch(_0x25c1d4['role']){case _0x469a('0x22'):return db[_['capitalize'](_0x52f5fb[_0x469a('0x40')][_0x469a('0x97')])+_0x469a('0xcd')]['findAll'](_0x520fa5);case _0x469a('0x23'):case _0x469a('0x1e'):return _0x25c1d4[_0x469a('0x21')+_[_0x469a('0x9e')](_0x52f5fb[_0x469a('0x40')][_0x469a('0x97')])+_0x469a('0xa0')](_0x520fa5);default:throw new db[(_0x469a('0x8b'))][(_0x469a('0x8f'))](_0x469a('0xd3'));}})[_0x469a('0x20')](function(_0x5a802a){_0x202c33=_0x5a802a[_0x469a('0x48')];if(!_0x52f5fb[_0x469a('0x40')]['hasOwnProperty']('nolimit')){_0x520fa5[_0x469a('0x17')]=qs[_0x469a('0x17')](_0x52f5fb[_0x469a('0x40')]['limit']);_0x520fa5[_0x469a('0x18')]=qs[_0x469a('0x18')](_0x52f5fb['query']['offset']);}switch(_0x25c1d4[_0x469a('0x1d')]){case _0x469a('0x22'):return db[_[_0x469a('0x9e')](_0x52f5fb[_0x469a('0x40')][_0x469a('0x97')])+_0x469a('0xcd')]['findAll'](_0x520fa5);case _0x469a('0x23'):case _0x469a('0x1e'):return _0x25c1d4[_0x469a('0x21')+_[_0x469a('0x9e')](_0x52f5fb['query'][_0x469a('0x97')])+_0x469a('0xa0')](_0x520fa5);}})[_0x469a('0x20')](function(_0x2418e2){return{'count':_0x202c33,'rows':_0x2418e2};})[_0x469a('0x20')](respondWithResult(_0x464eff,null))['catch'](handleError(_0x464eff,null));};exports[_0x469a('0xd4')]=function(_0x53646b,_0x51b9d4){var _0x5b9cc6={};var _0x4a94f1={};var _0x5eed96;var _0x50f9ad;return db[_0x469a('0x3f')]['findOne']({'where':{'id':_0x53646b['params']['id']}})[_0x469a('0x20')](handleEntityNotFound(_0x51b9d4,null))[_0x469a('0x20')](function(_0x1c0d5a){if(_0x1c0d5a){_0x5eed96=_0x1c0d5a;_0x4a94f1[_0x469a('0xcb')]=_['keys'](db[_0x469a('0xd5')][_0x469a('0x32')]);_0x4a94f1[_0x469a('0x40')]=_[_0x469a('0xcc')](_0x53646b[_0x469a('0x40')]);_0x4a94f1[_0x469a('0xce')]=_[_0x469a('0xcf')](_0x4a94f1[_0x469a('0xcb')],_0x4a94f1[_0x469a('0x40')]);_0x5b9cc6[_0x469a('0x44')]=_[_0x469a('0xcf')](_0x4a94f1[_0x469a('0xcb')],qs[_0x469a('0xd6')](_0x53646b[_0x469a('0x40')]['fields']));_0x5b9cc6[_0x469a('0x44')]=_0x5b9cc6[_0x469a('0x44')][_0x469a('0x48')]?_0x5b9cc6['attributes']:_0x4a94f1[_0x469a('0xcb')];_0x5b9cc6['order']=qs[_0x469a('0xd1')](_0x53646b['query'][_0x469a('0xd1')]);_0x5b9cc6[_0x469a('0x3e')]=qs[_0x469a('0xce')](_[_0x469a('0xd2')](_0x53646b['query'],_0x4a94f1[_0x469a('0xce')]));if(_0x53646b[_0x469a('0x40')][_0x469a('0x27')]){_0x5b9cc6[_0x469a('0x3e')]=_[_0x469a('0x57')](_0x5b9cc6[_0x469a('0x3e')],{'$or':_[_0x469a('0x29')](_0x5b9cc6[_0x469a('0x44')],function(_0x3819ab){var _0x47fde5={};_0x47fde5[_0x3819ab]={'$like':'%'+_0x53646b[_0x469a('0x40')][_0x469a('0x27')]+'%'};return _0x47fde5;})});}_0x5b9cc6=_[_0x469a('0x57')]({},_0x5b9cc6,_0x53646b['options']);return _0x5eed96[_0x469a('0xd4')](_0x5b9cc6);}})[_0x469a('0x20')](function(_0x4868ce){if(_0x4868ce){_0x50f9ad=_0x4868ce[_0x469a('0x48')];if(!_0x53646b[_0x469a('0x40')][_0x469a('0xc3')]('nolimit')){_0x5b9cc6[_0x469a('0x17')]=qs[_0x469a('0x17')](_0x53646b[_0x469a('0x40')]['limit']);_0x5b9cc6[_0x469a('0x18')]=qs[_0x469a('0x18')](_0x53646b[_0x469a('0x40')][_0x469a('0x18')]);}return _0x5eed96[_0x469a('0xd4')](_0x5b9cc6);}})[_0x469a('0x20')](function(_0x1d285a){if(_0x1d285a){return _0x1d285a?{'count':_0x50f9ad,'rows':_0x1d285a}:null;}})[_0x469a('0x20')](respondWithResult(_0x51b9d4,null))['catch'](handleError(_0x51b9d4,null));};exports['getGroups']=function(_0x125abc,_0x2d500d){var _0x4b4482={};var _0x2e4ec0={};var _0x3d78fe;var _0x5b5ccb;return db[_0x469a('0x3f')][_0x469a('0x92')]({'where':{'id':_0x125abc[_0x469a('0x54')]['id']}})[_0x469a('0x20')](handleEntityNotFound(_0x2d500d,null))[_0x469a('0x20')](function(_0x1b9872){if(_0x1b9872){_0x3d78fe=_0x1b9872;_0x2e4ec0[_0x469a('0xcb')]=_['keys'](db['ChatGroup']['rawAttributes']);_0x2e4ec0[_0x469a('0x40')]=_[_0x469a('0xcc')](_0x125abc['query']);_0x2e4ec0[_0x469a('0xce')]=_[_0x469a('0xcf')](_0x2e4ec0[_0x469a('0xcb')],_0x2e4ec0[_0x469a('0x40')]);_0x4b4482[_0x469a('0x44')]=_[_0x469a('0xcf')](_0x2e4ec0[_0x469a('0xcb')],qs[_0x469a('0xd6')](_0x125abc[_0x469a('0x40')][_0x469a('0xd6')]));_0x4b4482['attributes']=_0x4b4482[_0x469a('0x44')]['length']?_0x4b4482['attributes']:_0x2e4ec0['model'];_0x4b4482[_0x469a('0xd0')]=qs[_0x469a('0xd1')](_0x125abc[_0x469a('0x40')][_0x469a('0xd1')]);_0x4b4482[_0x469a('0x3e')]=qs[_0x469a('0xce')](_[_0x469a('0xd2')](_0x125abc[_0x469a('0x40')],_0x2e4ec0[_0x469a('0xce')]));if(_0x125abc[_0x469a('0x40')][_0x469a('0x27')]){_0x4b4482['where']=_[_0x469a('0x57')](_0x4b4482[_0x469a('0x3e')],{'$or':_[_0x469a('0x29')](_0x4b4482[_0x469a('0x44')],function(_0x289f0c){var _0x54aab7={};_0x54aab7[_0x289f0c]={'$like':'%'+_0x125abc[_0x469a('0x40')][_0x469a('0x27')]+'%'};return _0x54aab7;})});}_0x4b4482=_['merge']({},_0x4b4482,_0x125abc[_0x469a('0x58')]);return _0x3d78fe['getGroups'](_0x4b4482);}})[_0x469a('0x20')](function(_0x36a232){if(_0x36a232){_0x5b5ccb=_0x36a232[_0x469a('0x48')];if(!_0x125abc['query'][_0x469a('0xc3')](_0x469a('0xd7'))){_0x4b4482[_0x469a('0x17')]=qs[_0x469a('0x17')](_0x125abc['query']['limit']);_0x4b4482[_0x469a('0x18')]=qs['offset'](_0x125abc[_0x469a('0x40')][_0x469a('0x18')]);}return _0x3d78fe[_0x469a('0xd8')](_0x4b4482);}})['then'](function(_0x3056e5){if(_0x3056e5){return _0x3056e5?{'count':_0x5b5ccb,'rows':_0x3056e5}:null;}})['then'](respondWithResult(_0x2d500d,null))['catch'](handleError(_0x2d500d,null));};exports['getRecordings']=function(_0x5d2018,_0x13ebc0){var _0x48d5e0={'raw':!![],'where':{}};var _0x1e89b1={};var _0x271c5e={'count':0x0,'rows':[]};return db['User'][_0x469a('0x92')]({'where':{'id':_0x5d2018[_0x469a('0x54')]['id']}})[_0x469a('0x20')](handleEntityNotFound(_0x13ebc0,null))[_0x469a('0x20')](function(_0x9d86fe){if(_0x9d86fe){_0x1e89b1[_0x469a('0xcb')]=_['keys'](db[_0x469a('0xd9')][_0x469a('0x32')]);_0x1e89b1[_0x469a('0x40')]=_[_0x469a('0xcc')](_0x5d2018['query']);_0x1e89b1[_0x469a('0xce')]=_[_0x469a('0xcf')](_0x1e89b1[_0x469a('0xcb')],_0x1e89b1[_0x469a('0x40')]);_0x48d5e0[_0x469a('0x44')]=_[_0x469a('0xcf')](_0x1e89b1[_0x469a('0xcb')],qs[_0x469a('0xd6')](_0x5d2018[_0x469a('0x40')]['fields']));_0x48d5e0[_0x469a('0x44')]=_0x48d5e0['attributes'][_0x469a('0x48')]?_0x48d5e0['attributes']:_0x1e89b1[_0x469a('0xcb')];if(!_0x5d2018['query'][_0x469a('0xc3')](_0x469a('0xd7'))){_0x48d5e0[_0x469a('0x17')]=qs['limit'](_0x5d2018['query'][_0x469a('0x17')]);_0x48d5e0[_0x469a('0x18')]=qs[_0x469a('0x18')](_0x5d2018['query'][_0x469a('0x18')]);}_0x48d5e0[_0x469a('0xd0')]=qs[_0x469a('0xd1')](_0x5d2018[_0x469a('0x40')][_0x469a('0xd1')]);_0x48d5e0['where']=qs[_0x469a('0xce')](_[_0x469a('0xd2')](_0x5d2018['query'],_0x1e89b1[_0x469a('0xce')]));_0x48d5e0[_0x469a('0x3e')][_0x469a('0xda')]=_0x9d86fe['id'];if(_0x5d2018[_0x469a('0x40')][_0x469a('0x27')]){_0x48d5e0[_0x469a('0x3e')]=_[_0x469a('0x57')](_0x48d5e0[_0x469a('0x3e')],{'$or':_[_0x469a('0x29')](_0x48d5e0['attributes'],function(_0x24f6ad){var _0x115c4c={};_0x115c4c[_0x24f6ad]={'$like':'%'+_0x5d2018['query'][_0x469a('0x27')]+'%'};return _0x115c4c;})});}_0x48d5e0=_[_0x469a('0x57')]({},_0x48d5e0,_0x5d2018[_0x469a('0x58')]);return db[_0x469a('0xd9')][_0x469a('0x19')]({'where':_0x48d5e0[_0x469a('0x3e')]})['then'](function(_0x55c1f6){_0x271c5e[_0x469a('0x19')]=_0x55c1f6;if(_0x5d2018[_0x469a('0x40')][_0x469a('0x41')]){_0x48d5e0[_0x469a('0x55')]=[{'all':!![]}];}return db[_0x469a('0xd9')][_0x469a('0x45')](_0x48d5e0);})[_0x469a('0x20')](function(_0x2199d1){_0x271c5e[_0x469a('0x46')]=_0x2199d1;return _0x271c5e;});}})['then'](respondWithFilteredResult(_0x13ebc0,_0x48d5e0))[_0x469a('0x52')](handleError(_0x13ebc0,null));};exports[_0x469a('0xdb')]=function(_0x49a875,_0x4f65b2){var _0x3562f4={'raw':!![],'where':{}};var _0x46e773={};var _0x1af2a1={'count':0x0,'rows':[]};return db[_0x469a('0x3f')]['findOne']({'where':{'id':_0x49a875[_0x469a('0x54')]['id']}})[_0x469a('0x20')](handleEntityNotFound(_0x4f65b2,null))[_0x469a('0x20')](function(_0x5b3d98){if(_0x5b3d98){_0x46e773[_0x469a('0xcb')]=_['keys'](db[_0x469a('0xdc')]['rawAttributes']);_0x46e773[_0x469a('0x40')]=_[_0x469a('0xcc')](_0x49a875[_0x469a('0x40')]);_0x46e773[_0x469a('0xce')]=_[_0x469a('0xcf')](_0x46e773[_0x469a('0xcb')],_0x46e773['query']);_0x3562f4[_0x469a('0x44')]=_[_0x469a('0xcf')](_0x46e773[_0x469a('0xcb')],qs[_0x469a('0xd6')](_0x49a875[_0x469a('0x40')]['fields']));_0x3562f4[_0x469a('0x44')]=_0x3562f4['attributes'][_0x469a('0x48')]?_0x3562f4['attributes']:_0x46e773[_0x469a('0xcb')];if(!_0x49a875[_0x469a('0x40')][_0x469a('0xc3')](_0x469a('0xd7'))){_0x3562f4[_0x469a('0x17')]=qs[_0x469a('0x17')](_0x49a875[_0x469a('0x40')]['limit']);_0x3562f4[_0x469a('0x18')]=qs['offset'](_0x49a875[_0x469a('0x40')][_0x469a('0x18')]);}_0x3562f4[_0x469a('0xd0')]=qs[_0x469a('0xd1')](_0x49a875[_0x469a('0x40')][_0x469a('0xd1')]);_0x3562f4['where']=qs[_0x469a('0xce')](_[_0x469a('0xd2')](_0x49a875['query'],_0x46e773['filters']));_0x3562f4[_0x469a('0x3e')][_0x469a('0xda')]=_0x5b3d98['id'];if(_0x49a875[_0x469a('0x40')]['filter']){_0x3562f4[_0x469a('0x3e')]=_['merge'](_0x3562f4[_0x469a('0x3e')],{'$or':_['map'](_0x3562f4[_0x469a('0x44')],function(_0x3548f0){var _0x431f0a={};_0x431f0a[_0x3548f0]={'$like':'%'+_0x49a875[_0x469a('0x40')]['filter']+'%'};return _0x431f0a;})});}_0x3562f4=_[_0x469a('0x57')]({},_0x3562f4,_0x49a875[_0x469a('0x58')]);return db[_0x469a('0xdc')][_0x469a('0x19')]({'where':_0x3562f4['where']})[_0x469a('0x20')](function(_0x127ad2){_0x1af2a1['count']=_0x127ad2;if(_0x49a875[_0x469a('0x40')]['includeAll']){_0x3562f4[_0x469a('0x55')]=[{'all':!![]}];}return db['ScreenRecording'][_0x469a('0x45')](_0x3562f4);})[_0x469a('0x20')](function(_0xca9005){_0x1af2a1[_0x469a('0x46')]=_0xca9005;return _0x1af2a1;});}})['then'](respondWithFilteredResult(_0x4f65b2,_0x3562f4))[_0x469a('0x52')](handleError(_0x4f65b2,null));};exports['getChatInteractions']=function(_0x41f0c1,_0x147b3f){var _0x1e7ea5={};var _0x5db33b={};var _0x1673a4;var _0x43a075;return db[_0x469a('0x3f')][_0x469a('0x92')]({'where':{'id':_0x41f0c1[_0x469a('0x54')]['id']}})['then'](handleEntityNotFound(_0x147b3f,null))[_0x469a('0x20')](function(_0x4bd395){if(_0x4bd395){_0x1673a4=_0x4bd395;_0x5db33b['model']=_['keys'](db['ChatInteraction'][_0x469a('0x32')]);_0x5db33b[_0x469a('0x40')]=_[_0x469a('0xcc')](_0x41f0c1[_0x469a('0x40')]);_0x5db33b[_0x469a('0xce')]=_[_0x469a('0xcf')](_0x5db33b['model'],_0x5db33b[_0x469a('0x40')]);_0x1e7ea5['attributes']=_[_0x469a('0xcf')](_0x5db33b[_0x469a('0xcb')],qs[_0x469a('0xd6')](_0x41f0c1[_0x469a('0x40')][_0x469a('0xd6')]));_0x1e7ea5[_0x469a('0x44')]=_0x1e7ea5[_0x469a('0x44')][_0x469a('0x48')]?_0x1e7ea5[_0x469a('0x44')]:_0x5db33b['model'];_0x1e7ea5['order']=qs['sort'](_0x41f0c1[_0x469a('0x40')][_0x469a('0xd1')]);_0x1e7ea5[_0x469a('0x3e')]=qs[_0x469a('0xce')](_[_0x469a('0xd2')](_0x41f0c1['query'],_0x5db33b['filters']));if(_0x41f0c1[_0x469a('0x40')][_0x469a('0x27')]){_0x1e7ea5[_0x469a('0x3e')]=_[_0x469a('0x57')](_0x1e7ea5[_0x469a('0x3e')],{'$or':_[_0x469a('0x29')](_0x1e7ea5[_0x469a('0x44')],function(_0x45404a){var _0x213ff0={};_0x213ff0[_0x45404a]={'$like':'%'+_0x41f0c1['query'][_0x469a('0x27')]+'%'};return _0x213ff0;})});}_0x1e7ea5=_[_0x469a('0x57')]({},_0x1e7ea5,_0x41f0c1[_0x469a('0x58')]);return _0x1673a4[_0x469a('0xdd')](_0x1e7ea5);}})[_0x469a('0x20')](function(_0xbf346f){if(_0xbf346f){_0x43a075=_0xbf346f['length'];if(!_0x41f0c1['query'][_0x469a('0xc3')](_0x469a('0xd7'))){_0x1e7ea5[_0x469a('0x17')]=qs['limit'](_0x41f0c1['query'][_0x469a('0x17')]);_0x1e7ea5[_0x469a('0x18')]=qs['offset'](_0x41f0c1[_0x469a('0x40')][_0x469a('0x18')]);}return _0x1673a4[_0x469a('0xdd')](_0x1e7ea5);}})[_0x469a('0x20')](function(_0x496099){if(_0x496099){return _0x496099?{'count':_0x43a075,'rows':_0x496099}:null;}})['then'](respondWithResult(_0x147b3f,null))[_0x469a('0x52')](handleError(_0x147b3f,null));};exports['getOpenchannelInteractions']=function(_0x1633ed,_0x274e45){var _0xd2e59c={};var _0x36f82d={};var _0x1b3bc5;var _0x76dbaa;return db[_0x469a('0x3f')][_0x469a('0x92')]({'where':{'id':_0x1633ed['params']['id']}})['then'](handleEntityNotFound(_0x274e45,null))[_0x469a('0x20')](function(_0x4d6db9){if(_0x4d6db9){_0x1b3bc5=_0x4d6db9;_0x36f82d[_0x469a('0xcb')]=_[_0x469a('0xcc')](db['OpenchannelInteraction'][_0x469a('0x32')]);_0x36f82d['query']=_[_0x469a('0xcc')](_0x1633ed['query']);_0x36f82d[_0x469a('0xce')]=_['intersection'](_0x36f82d['model'],_0x36f82d[_0x469a('0x40')]);_0xd2e59c[_0x469a('0x44')]=_[_0x469a('0xcf')](_0x36f82d[_0x469a('0xcb')],qs[_0x469a('0xd6')](_0x1633ed['query']['fields']));_0xd2e59c[_0x469a('0x44')]=_0xd2e59c[_0x469a('0x44')][_0x469a('0x48')]?_0xd2e59c[_0x469a('0x44')]:_0x36f82d['model'];_0xd2e59c[_0x469a('0xd0')]=qs['sort'](_0x1633ed[_0x469a('0x40')][_0x469a('0xd1')]);_0xd2e59c[_0x469a('0x3e')]=qs['filters'](_[_0x469a('0xd2')](_0x1633ed['query'],_0x36f82d['filters']));if(_0x1633ed[_0x469a('0x40')][_0x469a('0x27')]){_0xd2e59c[_0x469a('0x3e')]=_['merge'](_0xd2e59c[_0x469a('0x3e')],{'$or':_[_0x469a('0x29')](_0xd2e59c[_0x469a('0x44')],function(_0x2a7fc0){var _0x43e1da={};_0x43e1da[_0x2a7fc0]={'$like':'%'+_0x1633ed[_0x469a('0x40')][_0x469a('0x27')]+'%'};return _0x43e1da;})});}_0xd2e59c=_['merge']({},_0xd2e59c,_0x1633ed[_0x469a('0x58')]);return _0x1b3bc5['getOpenchannelInteractions'](_0xd2e59c);}})[_0x469a('0x20')](function(_0x36f0aa){if(_0x36f0aa){_0x76dbaa=_0x36f0aa[_0x469a('0x48')];if(!_0x1633ed['query'][_0x469a('0xc3')](_0x469a('0xd7'))){_0xd2e59c[_0x469a('0x17')]=qs[_0x469a('0x17')](_0x1633ed[_0x469a('0x40')]['limit']);_0xd2e59c[_0x469a('0x18')]=qs['offset'](_0x1633ed['query'][_0x469a('0x18')]);}return _0x1b3bc5['getOpenchannelInteractions'](_0xd2e59c);}})[_0x469a('0x20')](function(_0x5ec864){if(_0x5ec864){return _0x5ec864?{'count':_0x76dbaa,'rows':_0x5ec864}:null;}})['then'](respondWithResult(_0x274e45,null))['catch'](handleError(_0x274e45,null));};exports['getMailInteractions']=function(_0x1370f8,_0x5685ac){var _0x3d4a61={'raw':!![],'where':{}};var _0x32b681={};var _0x321bed={'count':0x0,'rows':[]};return db['User'][_0x469a('0x92')]({'where':{'id':_0x1370f8[_0x469a('0x54')]['id']}})['then'](handleEntityNotFound(_0x5685ac,null))['then'](function(_0x21276f){if(_0x21276f){_0x32b681['model']=_[_0x469a('0xcc')](db[_0x469a('0xde')][_0x469a('0x32')]);_0x32b681['query']=_[_0x469a('0xcc')](_0x1370f8['query']);_0x32b681[_0x469a('0xce')]=_[_0x469a('0xcf')](_0x32b681[_0x469a('0xcb')],_0x32b681[_0x469a('0x40')]);_0x3d4a61['attributes']=_[_0x469a('0xcf')](_0x32b681[_0x469a('0xcb')],qs[_0x469a('0xd6')](_0x1370f8['query'][_0x469a('0xd6')]));_0x3d4a61['attributes']=_0x3d4a61[_0x469a('0x44')][_0x469a('0x48')]?_0x3d4a61[_0x469a('0x44')]:_0x32b681[_0x469a('0xcb')];if(!_0x1370f8[_0x469a('0x40')][_0x469a('0xc3')](_0x469a('0xd7'))){_0x3d4a61[_0x469a('0x17')]=qs[_0x469a('0x17')](_0x1370f8['query']['limit']);_0x3d4a61[_0x469a('0x18')]=qs[_0x469a('0x18')](_0x1370f8[_0x469a('0x40')][_0x469a('0x18')]);}_0x3d4a61[_0x469a('0xd0')]=qs[_0x469a('0xd1')](_0x1370f8[_0x469a('0x40')]['sort']);_0x3d4a61['where']=qs['filters'](_['pick'](_0x1370f8[_0x469a('0x40')],_0x32b681[_0x469a('0xce')]));_0x3d4a61[_0x469a('0x3e')][_0x469a('0xda')]=_0x21276f['id'];if(_0x1370f8['query']['filter']){_0x3d4a61[_0x469a('0x3e')]=_['merge'](_0x3d4a61[_0x469a('0x3e')],{'$or':_[_0x469a('0x29')](_0x3d4a61[_0x469a('0x44')],function(_0x3a76b7){var _0x243c03={};_0x243c03[_0x3a76b7]={'$like':'%'+_0x1370f8[_0x469a('0x40')][_0x469a('0x27')]+'%'};return _0x243c03;})});}_0x3d4a61=_[_0x469a('0x57')]({},_0x3d4a61,_0x1370f8[_0x469a('0x58')]);return db[_0x469a('0xde')][_0x469a('0x19')]({'where':_0x3d4a61[_0x469a('0x3e')]})[_0x469a('0x20')](function(_0x532102){_0x321bed[_0x469a('0x19')]=_0x532102;if(_0x1370f8[_0x469a('0x40')][_0x469a('0x41')]){_0x3d4a61['include']=[{'all':!![]}];}return db[_0x469a('0xde')]['findAll'](_0x3d4a61);})[_0x469a('0x20')](function(_0xcb7ef5){_0x321bed[_0x469a('0x46')]=_0xcb7ef5;return _0x321bed;});}})[_0x469a('0x20')](respondWithFilteredResult(_0x5685ac,_0x3d4a61))[_0x469a('0x52')](handleError(_0x5685ac,null));};exports[_0x469a('0xdf')]=function(_0x558206,_0x58025e){var _0x15b432={};var _0x262990={};var _0x1412c1;var _0x240ebb;return db[_0x469a('0x3f')][_0x469a('0x92')]({'where':{'id':_0x558206[_0x469a('0x54')]['id']}})[_0x469a('0x20')](handleEntityNotFound(_0x58025e,null))[_0x469a('0x20')](function(_0x239d9e){if(_0x239d9e){_0x1412c1=_0x239d9e;_0x262990[_0x469a('0xcb')]=_[_0x469a('0xcc')](db[_0x469a('0xe0')][_0x469a('0x32')]);_0x262990[_0x469a('0x40')]=_[_0x469a('0xcc')](_0x558206[_0x469a('0x40')]);_0x262990[_0x469a('0xce')]=_[_0x469a('0xcf')](_0x262990[_0x469a('0xcb')],_0x262990[_0x469a('0x40')]);_0x15b432[_0x469a('0x44')]=_[_0x469a('0xcf')](_0x262990[_0x469a('0xcb')],qs[_0x469a('0xd6')](_0x558206['query'][_0x469a('0xd6')]));_0x15b432[_0x469a('0x44')]=_0x15b432['attributes'][_0x469a('0x48')]?_0x15b432[_0x469a('0x44')]:_0x262990['model'];_0x15b432['order']=qs[_0x469a('0xd1')](_0x558206[_0x469a('0x40')]['sort']);_0x15b432[_0x469a('0x3e')]=qs[_0x469a('0xce')](_['pick'](_0x558206[_0x469a('0x40')],_0x262990[_0x469a('0xce')]));if(_0x558206[_0x469a('0x40')][_0x469a('0x27')]){_0x15b432[_0x469a('0x3e')]=_[_0x469a('0x57')](_0x15b432['where'],{'$or':_[_0x469a('0x29')](_0x15b432[_0x469a('0x44')],function(_0xbaa44e){var _0x48786={};_0x48786[_0xbaa44e]={'$like':'%'+_0x558206[_0x469a('0x40')][_0x469a('0x27')]+'%'};return _0x48786;})});}_0x15b432=_[_0x469a('0x57')]({},_0x15b432,_0x558206['options']);return _0x1412c1[_0x469a('0xdf')](_0x15b432);}})['then'](function(_0x2568ba){if(_0x2568ba){_0x240ebb=_0x2568ba[_0x469a('0x48')];if(!_0x558206[_0x469a('0x40')][_0x469a('0xc3')](_0x469a('0xd7'))){_0x15b432[_0x469a('0x17')]=qs[_0x469a('0x17')](_0x558206[_0x469a('0x40')][_0x469a('0x17')]);_0x15b432[_0x469a('0x18')]=qs[_0x469a('0x18')](_0x558206[_0x469a('0x40')][_0x469a('0x18')]);}return _0x1412c1[_0x469a('0xdf')](_0x15b432);}})[_0x469a('0x20')](function(_0x1899da){if(_0x1899da){return _0x1899da?{'count':_0x240ebb,'rows':_0x1899da}:null;}})['then'](respondWithResult(_0x58025e,null))[_0x469a('0x52')](handleError(_0x58025e,null));};exports['getFaxInteractions']=function(_0x597610,_0x48a0c0){var _0x586f24={};var _0x553266={};var _0x335f77;var _0x241948;return db[_0x469a('0x3f')][_0x469a('0x92')]({'where':{'id':_0x597610[_0x469a('0x54')]['id']}})[_0x469a('0x20')](handleEntityNotFound(_0x48a0c0,null))[_0x469a('0x20')](function(_0x179b81){if(_0x179b81){_0x335f77=_0x179b81;_0x553266[_0x469a('0xcb')]=_[_0x469a('0xcc')](db[_0x469a('0xe1')][_0x469a('0x32')]);_0x553266['query']=_[_0x469a('0xcc')](_0x597610[_0x469a('0x40')]);_0x553266[_0x469a('0xce')]=_[_0x469a('0xcf')](_0x553266[_0x469a('0xcb')],_0x553266[_0x469a('0x40')]);_0x586f24['attributes']=_[_0x469a('0xcf')](_0x553266[_0x469a('0xcb')],qs['fields'](_0x597610[_0x469a('0x40')][_0x469a('0xd6')]));_0x586f24[_0x469a('0x44')]=_0x586f24[_0x469a('0x44')][_0x469a('0x48')]?_0x586f24[_0x469a('0x44')]:_0x553266['model'];_0x586f24['order']=qs[_0x469a('0xd1')](_0x597610['query']['sort']);_0x586f24[_0x469a('0x3e')]=qs[_0x469a('0xce')](_['pick'](_0x597610['query'],_0x553266[_0x469a('0xce')]));if(_0x597610['query']['filter']){_0x586f24['where']=_[_0x469a('0x57')](_0x586f24[_0x469a('0x3e')],{'$or':_['map'](_0x586f24[_0x469a('0x44')],function(_0xe98122){var _0x5ce59d={};_0x5ce59d[_0xe98122]={'$like':'%'+_0x597610[_0x469a('0x40')]['filter']+'%'};return _0x5ce59d;})});}_0x586f24=_[_0x469a('0x57')]({},_0x586f24,_0x597610['options']);return _0x335f77[_0x469a('0xe2')](_0x586f24);}})[_0x469a('0x20')](function(_0x72aa6f){if(_0x72aa6f){_0x241948=_0x72aa6f[_0x469a('0x48')];if(!_0x597610[_0x469a('0x40')]['hasOwnProperty'](_0x469a('0xd7'))){_0x586f24[_0x469a('0x17')]=qs[_0x469a('0x17')](_0x597610[_0x469a('0x40')][_0x469a('0x17')]);_0x586f24[_0x469a('0x18')]=qs[_0x469a('0x18')](_0x597610['query']['offset']);}return _0x335f77['getFaxInteractions'](_0x586f24);}})['then'](function(_0x24c43b){if(_0x24c43b){return _0x24c43b?{'count':_0x241948,'rows':_0x24c43b}:null;}})[_0x469a('0x20')](respondWithResult(_0x48a0c0,null))[_0x469a('0x52')](handleError(_0x48a0c0,null));};exports[_0x469a('0xe3')]=function(_0x4d06de,_0x3c353b){var _0x4d529c={};var _0x45acc2={};var _0x8b0e2c;var _0x20ee1d;return db['User'][_0x469a('0x92')]({'where':{'id':_0x4d06de['params']['id']}})[_0x469a('0x20')](handleEntityNotFound(_0x3c353b,null))['then'](function(_0x1f2bd4){if(_0x1f2bd4){_0x8b0e2c=_0x1f2bd4;_0x45acc2['model']=_[_0x469a('0xcc')](db[_0x469a('0xe4')]['rawAttributes']);_0x45acc2[_0x469a('0x40')]=_[_0x469a('0xcc')](_0x4d06de[_0x469a('0x40')]);_0x45acc2[_0x469a('0xce')]=_[_0x469a('0xcf')](_0x45acc2[_0x469a('0xcb')],_0x45acc2['query']);_0x4d529c[_0x469a('0x44')]=_[_0x469a('0xcf')](_0x45acc2[_0x469a('0xcb')],qs[_0x469a('0xd6')](_0x4d06de['query']['fields']));_0x4d529c[_0x469a('0x44')]=_0x4d529c['attributes']['length']?_0x4d529c[_0x469a('0x44')]:_0x45acc2[_0x469a('0xcb')];_0x4d529c['order']=qs['sort'](_0x4d06de[_0x469a('0x40')]['sort']);_0x4d529c[_0x469a('0x3e')]=qs['filters'](_['pick'](_0x4d06de[_0x469a('0x40')],_0x45acc2[_0x469a('0xce')]));if(_0x4d06de[_0x469a('0x40')][_0x469a('0x27')]){_0x4d529c['where']=_[_0x469a('0x57')](_0x4d529c[_0x469a('0x3e')],{'$or':_[_0x469a('0x29')](_0x4d529c[_0x469a('0x44')],function(_0x55abcf){var _0x2baf03={};_0x2baf03[_0x55abcf]={'$like':'%'+_0x4d06de[_0x469a('0x40')]['filter']+'%'};return _0x2baf03;})});}_0x4d529c=_[_0x469a('0x57')]({},_0x4d529c,_0x4d06de[_0x469a('0x58')]);return _0x8b0e2c[_0x469a('0xe3')](_0x4d529c);}})['then'](function(_0x444726){if(_0x444726){_0x20ee1d=_0x444726['length'];if(!_0x4d06de[_0x469a('0x40')][_0x469a('0xc3')](_0x469a('0xd7'))){_0x4d529c[_0x469a('0x17')]=qs[_0x469a('0x17')](_0x4d06de['query'][_0x469a('0x17')]);_0x4d529c[_0x469a('0x18')]=qs[_0x469a('0x18')](_0x4d06de[_0x469a('0x40')]['offset']);}return _0x8b0e2c['getWhatsappInteractions'](_0x4d529c);}})[_0x469a('0x20')](function(_0xa0d353){if(_0xa0d353){return _0xa0d353?{'count':_0x20ee1d,'rows':_0xa0d353}:null;}})[_0x469a('0x20')](respondWithResult(_0x3c353b,null))[_0x469a('0x52')](handleError(_0x3c353b,null));};exports[_0x469a('0xe5')]=function(_0x194fc9,_0x539fac,_0x454ec9){var _0xe8775e;var _0x50e4f1;var _0x2f8e53;var _0x5c1311=!_['isNil'](_0x194fc9['params']['id'])?_0x194fc9[_0x469a('0x54')]['id']:!_[_0x469a('0x64')](_0x194fc9[_0x469a('0x23')]['id'])?_0x194fc9[_0x469a('0x23')]['id']:null;return db[_0x469a('0x3f')][_0x469a('0x2c')]({'where':{'id':_0x5c1311,'role':{'$or':[_0x469a('0x22'),_0x469a('0x23'),_0x469a('0x1e')]}},'attributes':['id','name',_0x469a('0xe6'),_0x469a('0xe7'),_0x469a('0x1d'),_0x469a('0x5d'),_0x469a('0xe8')]})['then'](function(_0x3e850e){if(_0x3e850e){if(_0x3e850e['role']===_0x469a('0x1e')){_0xe8775e=_0x3e850e;if(_0x194fc9[_0x469a('0x59')][_0x469a('0x9a')]){_0x2f8e53=util[_0x469a('0xa6')](_0x469a('0xe9'),_0xe8775e[_0x194fc9['body'][_0x469a('0x9a')]]);}else if(_0x194fc9[_0x469a('0x59')][_0x469a('0xea')]){_0x2f8e53=util[_0x469a('0xa6')](_0x469a('0xa7'),_0x194fc9[_0x469a('0x59')][_0x469a('0xea')]);}else{_0x2f8e53=util['format'](_0x469a('0xa7'),_0xe8775e[_0x469a('0x2d')]);}socket['to'](util['format'](_0x469a('0xeb'),_0xe8775e[_0x469a('0x2d')]))[_0x469a('0x1f')]('user:forcelogout',{'user':{'id':_0xe8775e['id'],'name':_0xe8775e[_0x469a('0x2d')]},'ip':_0x194fc9['headers'][_0x469a('0xec')]||_0x194fc9[_0x469a('0xed')][_0x469a('0xee')]||_0x194fc9[_0x469a('0xef')]['remoteAddress']||_0x194fc9[_0x469a('0xed')][_0x469a('0xef')][_0x469a('0xee')]});return db[_0x469a('0xd5')][_0x469a('0x2e')]({'where':{'membername':_0xe8775e[_0x469a('0x2d')]},'individualHooks':!![]});}}else{throw new db[(_0x469a('0x8b'))]['ValidationError'](_0x469a('0xf0'));}})[_0x469a('0x20')](function(){if(_0xe8775e){return _0xe8775e[_0x469a('0xf1')]({'raw':!![]});}})[_0x469a('0x20')](function(_0x4a6fc4){if(_0xe8775e){if(_0x4a6fc4){_0x50e4f1=_0x4a6fc4;if(_0x50e4f1['length']){var _0x4afede=_0x50e4f1[_0x469a('0x29')](function(_0xad22f0){var _0x4ec0cb={'membername':_0xe8775e['name'],'UserId':_0xe8775e['id'],'queue_name':_0xad22f0[_0x469a('0x2d')],'VoiceQueueId':_0xad22f0['id'],'interface':_0x2f8e53,'paused':_0xe8775e[_0x469a('0xe8')]||![],'penalty':_0xad22f0[_0x469a('0xf2')]||0x0};return db[_0x469a('0xd5')][_0x469a('0xa8')](_0x4ec0cb);});return Promise[_0x469a('0x51')](_0x4afede);}}}})[_0x469a('0x20')](function(){if(_0xe8775e){return db[_0x469a('0xf3')][_0x469a('0x45')]({'where':{'membername':_0xe8775e[_0x469a('0x2d')],'exitAt':null}});}})[_0x469a('0x20')](function(_0xfb2cf4){if(_0xe8775e){var _0x1c6d74=[];_0xfb2cf4[_0x469a('0xf4')](function(_0x1376fa){_0x1c6d74[_0x469a('0x49')](_0x1376fa[_0x469a('0x1c')]({'exitAt':moment()[_0x469a('0xa6')](_0x469a('0xf5'))}));});return Promise[_0x469a('0x51')](_0x1c6d74);}})[_0x469a('0x20')](function(){if(_0xe8775e){var _0x183fdd=[];var _0x1e5974=[];var _0x384113=utils[_0x469a('0xf6')]();var _0x2a7b5b={'membername':_0xe8775e[_0x469a('0x2d')],'interface':_0x2f8e53,'enterAt':moment()[_0x469a('0xa6')](_0x469a('0xf5')),'role':_0xe8775e['role'],'internal':_0xe8775e[_0x469a('0x5d')]};_0x384113['forEach'](function(_0x1783a0){_0x183fdd['push'](_[_0x469a('0x57')]({'channel':_0x1783a0,'type':_0x469a('0xf7'),'data1':_0x194fc9[_0x469a('0x59')]['device'],'data2':_0x2f8e53},_0x2a7b5b));if(_0xe8775e[_0x469a('0xe8')]){_0x1e5974[_0x469a('0x49')](_['merge']({'channel':_0x1783a0,'type':_0x469a('0xf8'),'data1':_0x469a('0xf9')},_0x2a7b5b));}});return db['MemberReport'][_0x469a('0x83')](_0x183fdd[_0x469a('0xc1')](_0x1e5974),{'individualHooks':!![]});}})[_0x469a('0x20')](function(){if(_0xe8775e){return _0xe8775e['update']({'online':!![],'lastLoginAt':moment()[_0x469a('0xa6')](_0x469a('0xf5')),'voicePause':_0xe8775e['loginInPause']||![],'mailPause':_0xe8775e[_0x469a('0xe8')]||![],'chatPause':_0xe8775e[_0x469a('0xe8')]||![],'faxPause':_0xe8775e[_0x469a('0xe8')]||![],'smsPause':_0xe8775e[_0x469a('0xe8')]||![],'openchannelPause':_0xe8775e['loginInPause']||![],'whatsappPause':_0xe8775e[_0x469a('0xe8')]||![],'pauseType':_0xe8775e[_0x469a('0xe8')]?_0x469a('0xf9'):null,'interface':_0x2f8e53,'lastPauseAt':moment()['format'](_0x469a('0xf5'))});}})[_0x469a('0x20')](function(_0x5b861e){if(_0x194fc9['isMiddleware']){return _0x454ec9();}else{return Promise['resolve'](_0x5b861e)[_0x469a('0x20')](respondWithResult(_0x539fac,null));}})['catch'](handleError(_0x539fac,null));};exports['logout']=function(_0x4eb2af,_0x4231f7){var _0x3b554f;return db[_0x469a('0x3f')][_0x469a('0x2c')]({'where':{'id':_0x4eb2af['params']['id'],'role':_0x469a('0x1e')},'attributes':['id',_0x469a('0x2d'),_0x469a('0x1d')]})[_0x469a('0x20')](handleEntityNotFound(_0x4231f7,null))[_0x469a('0x20')](function(_0xfd3824){if(_0xfd3824){_0x3b554f=_0xfd3824;return db[_0x469a('0xd5')]['destroy']({'where':{'membername':_0x3b554f['name']},'individualHooks':!![]});}})[_0x469a('0x20')](function(){return db[_0x469a('0xf3')][_0x469a('0x45')]({'where':{'membername':_0x3b554f[_0x469a('0x2d')],'exitAt':null}});})[_0x469a('0x20')](function(_0x2b0f62){var _0x548439=[];_0x2b0f62['forEach'](function(_0x1761b3){_0x548439[_0x469a('0x49')](_0x1761b3[_0x469a('0x1c')]({'exitAt':moment()[_0x469a('0xa6')](_0x469a('0xf5'))}));});return Promise['all'](_0x548439);})[_0x469a('0x20')](function(){return _0x3b554f[_0x469a('0x1c')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x469a('0x20')](respondWithResult(_0x4231f7,null))[_0x469a('0x52')](handleError(_0x4231f7,null));};exports[_0x469a('0xfa')]=function(_0x412afb,_0x327311){var _0x586a2e;return db['UserVoiceQueueRt'][_0x469a('0x1c')]({'paused':0x1},{'where':{'UserId':_0x412afb[_0x469a('0x54')]['id']},'individualHooks':!![]})[_0x469a('0x20')](function(){return db[_0x469a('0x3f')]['find']({'where':{'id':_0x412afb[_0x469a('0x54')]['id'],'role':_0x469a('0x1e')},'attributes':['id','name','role',_0x469a('0x5d'),_0x469a('0x9a'),_0x469a('0x98')]});})[_0x469a('0x20')](handleEntityNotFound(_0x327311,null))[_0x469a('0x20')](function(_0x54e44c){if(_0x54e44c){_0x586a2e=_0x54e44c;return db[_0x469a('0xf3')]['findAll']({'where':{'membername':_0x586a2e[_0x469a('0x2d')],'type':'PAUSE','exitAt':null}});}})[_0x469a('0x20')](function(_0x40e8b3){if(_0x40e8b3[_0x469a('0x48')]){var _0x3edb78=moment()[_0x469a('0xa6')](_0x469a('0xf5'));for(var _0x42466f=0x0,_0x21e631=_0x40e8b3['length'];_0x42466f<_0x21e631;_0x42466f++){_0x40e8b3[_0x42466f][_0x469a('0xfb')]({'exitAt':_0x3edb78});}}})[_0x469a('0x20')](function(){var _0x2396ca=[];var _0x48e8c6=utils[_0x469a('0xf6')]();_0x48e8c6[_0x469a('0xf4')](function(_0x24cedc){_0x2396ca[_0x469a('0x49')]({'channel':_0x24cedc,'membername':_0x586a2e[_0x469a('0x2d')],'interface':_[_0x469a('0x64')](_0x586a2e[_0x469a('0x9a')])?util[_0x469a('0xa6')](_0x469a('0xa7'),_0x586a2e[_0x469a('0x2d')]):_0x586a2e[_0x469a('0x9a')],'type':_0x469a('0xf8'),'enterAt':moment()['format'](_0x469a('0xf5')),'data1':_0x412afb[_0x469a('0x59')][_0x469a('0x34')]||_0x469a('0xfc'),'role':_0x586a2e[_0x469a('0x1d')],'internal':_0x586a2e[_0x469a('0x5d')]});});return db['MemberReport'][_0x469a('0x83')](_0x2396ca,{'individualHooks':!![]});})['then'](function(){return _0x586a2e[_0x469a('0x1c')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x412afb[_0x469a('0x59')][_0x469a('0x34')]||_0x469a('0xfc'),'lastPauseAt':moment()[_0x469a('0xa6')]('YYYY-MM-DD\x20HH:mm:ss')});})['then'](respondWithResult(_0x327311,null))[_0x469a('0x52')](handleError(_0x327311,null));};exports[_0x469a('0xfd')]=function(_0x33944f,_0x2ed98a){if(_0x33944f[_0x469a('0x59')]['channel']&&!utils[_0x469a('0x9b')](_0x33944f['body']['channel'])){throw new APIBadRequestError(util[_0x469a('0xa6')](_0x469a('0xfe'),_0x33944f['body'][_0x469a('0x97')]));}return db['User'][_0x469a('0x2c')]({'where':{'id':_0x33944f[_0x469a('0x54')]['id']},'attributes':['id',_0x469a('0x2d'),_0x469a('0x1d'),'internal',_0x469a('0x9a'),_0x469a('0x98'),_0x469a('0x99'),_0x469a('0xff'),'chatPause','faxPause',_0x469a('0x100'),_0x469a('0x101'),_0x469a('0x102'),_0x469a('0x103'),_0x469a('0x104')]})[_0x469a('0x20')](function(_0x23bd61){if(!_0x23bd61){throw new APINotFoundError(util[_0x469a('0xa6')](_0x469a('0x105'),_0x33944f[_0x469a('0x54')]['id']));}return _0x23bd61[_0x469a('0xfd')](_0x33944f['body']['channel']);})['then'](respondWithResult(_0x2ed98a,null))[_0x469a('0x52')](APIHandleError(_0x2ed98a));};exports['getTeams']=function(_0x5f0f57,_0x3761be){var _0x50856e={};var _0x4e223a={};var _0x51b64e;var _0x261097;return db[_0x469a('0x3f')][_0x469a('0x92')]({'where':{'id':_0x5f0f57[_0x469a('0x54')]['id']}})['then'](handleEntityNotFound(_0x3761be,null))['then'](function(_0x5f15f7){if(_0x5f15f7){_0x51b64e=_0x5f15f7;_0x4e223a[_0x469a('0xcb')]=_[_0x469a('0xcc')](db[_0x469a('0x106')][_0x469a('0x32')]);_0x4e223a['query']=_['keys'](_0x5f0f57[_0x469a('0x40')]);_0x4e223a[_0x469a('0xce')]=_[_0x469a('0xcf')](_0x4e223a[_0x469a('0xcb')],_0x4e223a[_0x469a('0x40')]);_0x50856e['attributes']=_[_0x469a('0xcf')](_0x4e223a[_0x469a('0xcb')],qs[_0x469a('0xd6')](_0x5f0f57[_0x469a('0x40')][_0x469a('0xd6')]));_0x50856e['attributes']=_0x50856e[_0x469a('0x44')][_0x469a('0x48')]?_0x50856e[_0x469a('0x44')]:_0x4e223a['model'];_0x50856e[_0x469a('0xd0')]=qs[_0x469a('0xd1')](_0x5f0f57['query'][_0x469a('0xd1')]);_0x50856e[_0x469a('0x3e')]=qs['filters'](_[_0x469a('0xd2')](_0x5f0f57[_0x469a('0x40')],_0x4e223a[_0x469a('0xce')]));if(_0x5f0f57[_0x469a('0x40')][_0x469a('0x27')]){_0x50856e[_0x469a('0x3e')]=_['merge'](_0x50856e[_0x469a('0x3e')],{'$or':_['map'](_0x50856e[_0x469a('0x44')],function(_0x2df5f3){var _0x5c4da1={};_0x5c4da1[_0x2df5f3]={'$like':'%'+_0x5f0f57[_0x469a('0x40')]['filter']+'%'};return _0x5c4da1;})});}_0x50856e=_[_0x469a('0x57')]({},_0x50856e,_0x5f0f57[_0x469a('0x58')]);return _0x51b64e[_0x469a('0x107')](_0x50856e);}})[_0x469a('0x20')](function(_0x115cc6){if(_0x115cc6){_0x261097=_0x115cc6[_0x469a('0x48')];if(!_0x5f0f57[_0x469a('0x40')][_0x469a('0xc3')]('nolimit')){_0x50856e[_0x469a('0x17')]=qs['limit'](_0x5f0f57[_0x469a('0x40')][_0x469a('0x17')]);_0x50856e['offset']=qs[_0x469a('0x18')](_0x5f0f57[_0x469a('0x40')][_0x469a('0x18')]);}return _0x51b64e['getTeams'](_0x50856e);}})[_0x469a('0x20')](function(_0x181e26){if(_0x181e26){return _0x181e26?{'count':_0x261097,'rows':_0x181e26}:null;}})[_0x469a('0x20')](respondWithResult(_0x3761be,null))[_0x469a('0x52')](handleError(_0x3761be,null));};exports['addTeams']=function(_0x4b4b08,_0x5343f5){var _0x5110ab=_0x4b4b08[_0x469a('0x54')]['id'];var _0x58f37d=_0x4b4b08[_0x469a('0x59')]?_0x4b4b08[_0x469a('0x59')][_0x469a('0x5c')]:null;var _0x30b4f7=[];return Promise[_0x469a('0x108')]()[_0x469a('0x20')](function(){if(!_0x58f37d)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x469a('0x20')](function(){return db[_0x469a('0x3f')][_0x469a('0x92')]({'where':{'id':_0x5110ab}});})[_0x469a('0x20')](function(_0x309dfd){if(!_0x309dfd)throw new APINotFoundError(util[_0x469a('0xa6')]('User\x20with\x20id\x20%s\x20not\x20found',_0x4b4b08['params']['id']));return db[_0x469a('0x66')][_0x469a('0x109')](function(_0x20742b){return _0x309dfd['addTeams'](_0x58f37d,{'transaction':_0x20742b})[_0x469a('0x20')](function(){return db[_0x469a('0x106')][_0x469a('0x45')]({'where':{'id':{'$in':_0x58f37d}}});})[_0x469a('0x20')](function(_0x560402){var _0x39e0ce=_[_0x469a('0x29')](_0x560402,function(_0x5c05e2){return _0x5c05e2[_0x469a('0x10a')]();});return Promise[_0x469a('0x51')](_0x39e0ce);})['then'](function(_0x1d3da3){_0x30b4f7=_[_0x469a('0x10b')](_0x1d3da3);var _0x48e9c7=_[_0x469a('0x29')](_0x30b4f7,function(_0x26e01a){return _0x26e01a[_0x469a('0x10c')](_0x309dfd['id'],{'transaction':_0x20742b});});return Promise['all'](_0x48e9c7);})[_0x469a('0x20')](function(){if(!_0x309dfd[_0x469a('0x98')])return;var _0x1271a9=_[_0x469a('0x27')](_0x30b4f7,function(_0x576418){return _0x576418[_0x469a('0x10d')]('channel')===_0x469a('0x10e');});var _0x4e41ff=_[_0x469a('0x29')](_0x1271a9,function(_0x2855b6){return db[_0x469a('0xd5')][_0x469a('0xa8')]({'membername':_0x309dfd['name'],'UserId':_0x309dfd['id'],'queue_name':_0x2855b6[_0x469a('0x2d')],'VoiceQueueId':_0x2855b6['id'],'interface':_[_0x469a('0x64')](_0x309dfd[_0x469a('0x9a')])?util[_0x469a('0xa6')](_0x469a('0xa7'),_0x309dfd[_0x469a('0x2d')]):_0x309dfd[_0x469a('0x9a')],'paused':_0x309dfd['voicePause']||![],'penalty':_0x309dfd[_0x469a('0xa1')]},{'transaction':_0x20742b});});return Promise[_0x469a('0x51')](_0x4e41ff);})[_0x469a('0x20')](function(){return db[_0x469a('0x10f')][_0x469a('0x45')]({'where':{'teamId':{'$in':_0x58f37d}}});})[_0x469a('0x20')](function(_0x28341e){var _0x1136ec=_[_0x469a('0x29')](_0x28341e,function(_0x3c5028){return db[_0x469a('0x110')][_0x469a('0x7a')]({'UserId':_0x309dfd['id'],'VoicePrefixId':_0x3c5028[_0x469a('0x111')]},{'transaction':_0x20742b});});return Promise[_0x469a('0x51')](_0x1136ec);});});})['then'](function(){for(var _0x50875a=0x0;_0x50875a<_0x30b4f7[_0x469a('0x48')];_0x50875a++){var _0x5348bb=_0x30b4f7[_0x50875a][_0x469a('0x10d')](_0x469a('0x97'));var _0x14f95f=_0x5348bb+'QueueId';socket[_0x469a('0x1f')]('user'+_0x5348bb+_0x469a('0xa4'),{'UserId':_0x5110ab,['queueField']:_0x30b4f7[_0x50875a]['id']});}})['then'](respondWithStatusCode(_0x5343f5,null))['catch'](APIHandleError(_0x5343f5));};exports[_0x469a('0x112')]=function(_0x111925,_0x2210a7){var _0x2be8b5=_0x111925['params']['id'];var _0x3c57a8=null;if(_0x111925[_0x469a('0x40')][_0x469a('0x5c')]){_0x3c57a8=_['isArray'](_0x111925['query'][_0x469a('0x5c')])?_0x111925[_0x469a('0x40')]['ids']:[_0x111925[_0x469a('0x40')][_0x469a('0x5c')]];}var _0x54324e=[];return Promise[_0x469a('0x108')]()[_0x469a('0x20')](function(){if(!_0x3c57a8)throw new APIBadRequestError(_0x469a('0x113'));})[_0x469a('0x20')](function(){return db[_0x469a('0x3f')]['findOne']({'where':{'id':_0x2be8b5}});})['then'](function(_0x5532a6){if(!_0x5532a6)throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x111925['params']['id']));return db['sequelize'][_0x469a('0x109')](function(_0x229953){return _0x5532a6['removeTeams'](_0x3c57a8,{'transaction':_0x229953})[_0x469a('0x20')](function(){return db[_0x469a('0x106')][_0x469a('0x45')]({'where':{'id':{'$in':_0x3c57a8}}});})[_0x469a('0x20')](function(_0x4a1b12){var _0x3d2235=_['map'](_0x4a1b12,function(_0x6cb0b5){return _0x6cb0b5[_0x469a('0x10a')]();});return Promise[_0x469a('0x51')](_0x3d2235);})[_0x469a('0x20')](function(_0x3e9014){_0x54324e=_[_0x469a('0x10b')](_0x3e9014);var _0x56a0ae=_[_0x469a('0x29')](_0x54324e,function(_0x39ca53){return _0x39ca53['removeAgent'](_0x5532a6['id'],{'transaction':_0x229953});});return Promise[_0x469a('0x51')](_0x56a0ae);})['then'](function(){if(!_0x5532a6[_0x469a('0x98')])return;var _0xbc9253=_[_0x469a('0x27')](_0x54324e,function(_0x533a32){return _0x533a32['getDataValue'](_0x469a('0x97'))===_0x469a('0x10e');});var _0xc85f11=_[_0x469a('0x29')](_0xbc9253,function(_0x31562c){return db['UserVoiceQueueRt'][_0x469a('0x2e')]({'where':{'VoiceQueueId':_0x31562c['id'],'UserId':_0x5532a6['id']},'transaction':_0x229953});});return Promise[_0x469a('0x51')](_0xc85f11);})[_0x469a('0x20')](function(){return db[_0x469a('0x10f')]['findAll']({'where':{'teamId':{'$in':_0x3c57a8}}});})['then'](function(_0x5305f2){var _0x12f066=_[_0x469a('0x29')](_0x5305f2,function(_0x3ea580){return db[_0x469a('0x110')]['destroy']({'where':{'UserId':_0x5532a6['id'],'VoicePrefixId':_0x3ea580[_0x469a('0x111')]}},{'transaction':_0x229953});});return Promise[_0x469a('0x51')](_0x12f066);});});})['then'](function(){for(var _0x1d4c8e=0x0;_0x1d4c8e<_0x54324e[_0x469a('0x48')];_0x1d4c8e++){var _0xbf9a81=_0x54324e[_0x1d4c8e][_0x469a('0x10d')]('channel');var _0x2443fa=_0xbf9a81+'QueueId';socket[_0x469a('0x1f')]('user'+_0xbf9a81+_0x469a('0xaa'),{'UserId':_0x2be8b5,['queueField']:_0x54324e[_0x1d4c8e]['id']});}})[_0x469a('0x20')](respondWithStatusCode(_0x2210a7,null))[_0x469a('0x52')](APIHandleError(_0x2210a7));};exports['getLists']=function(_0x5c3549,_0x12f06b){var _0x26a5a2={};var _0xc4b0cf={};var _0x2248ca;var _0x40b8d7;return db[_0x469a('0x3f')][_0x469a('0x92')]({'where':{'id':_0x5c3549[_0x469a('0x54')]['id']}})[_0x469a('0x20')](handleEntityNotFound(_0x12f06b,null))['then'](function(_0x5b72cc){if(_0x5b72cc){_0x2248ca=_0x5b72cc;_0xc4b0cf[_0x469a('0xcb')]=_[_0x469a('0xcc')](db['CmList'][_0x469a('0x32')]);_0xc4b0cf['query']=_['keys'](_0x5c3549[_0x469a('0x40')]);_0xc4b0cf['filters']=_[_0x469a('0xcf')](_0xc4b0cf['model'],_0xc4b0cf[_0x469a('0x40')]);_0x26a5a2[_0x469a('0x44')]=_[_0x469a('0xcf')](_0xc4b0cf[_0x469a('0xcb')],qs['fields'](_0x5c3549['query'][_0x469a('0xd6')]));_0x26a5a2[_0x469a('0x44')]=_0x26a5a2[_0x469a('0x44')][_0x469a('0x48')]?_0x26a5a2[_0x469a('0x44')]:_0xc4b0cf[_0x469a('0xcb')];_0x26a5a2[_0x469a('0xd0')]=qs[_0x469a('0xd1')](_0x5c3549[_0x469a('0x40')][_0x469a('0xd1')]);_0x26a5a2['where']=qs['filters'](_[_0x469a('0xd2')](_0x5c3549[_0x469a('0x40')],_0xc4b0cf[_0x469a('0xce')]));if(_0x5c3549[_0x469a('0x40')]['filter']){_0x26a5a2[_0x469a('0x3e')]=_[_0x469a('0x57')](_0x26a5a2['where'],{'$or':_[_0x469a('0x29')](_0x26a5a2['attributes'],function(_0x2ed872){var _0x21b5f3={};_0x21b5f3[_0x2ed872]={'$like':'%'+_0x5c3549['query'][_0x469a('0x27')]+'%'};return _0x21b5f3;})});}_0x26a5a2=_[_0x469a('0x57')]({},_0x26a5a2,_0x5c3549[_0x469a('0x58')]);return _0x2248ca[_0x469a('0x114')](_0x26a5a2);}})[_0x469a('0x20')](function(_0x2e3341){if(_0x2e3341){_0x40b8d7=_0x2e3341['length'];if(!_0x5c3549[_0x469a('0x40')]['hasOwnProperty'](_0x469a('0xd7'))){_0x26a5a2[_0x469a('0x17')]=qs[_0x469a('0x17')](_0x5c3549[_0x469a('0x40')]['limit']);_0x26a5a2[_0x469a('0x18')]=qs['offset'](_0x5c3549['query'][_0x469a('0x18')]);}return _0x2248ca[_0x469a('0x114')](_0x26a5a2);}})[_0x469a('0x20')](function(_0x3f0529){if(_0x3f0529){return _0x3f0529?{'count':_0x40b8d7,'rows':_0x3f0529}:null;}})[_0x469a('0x20')](respondWithResult(_0x12f06b,null))['catch'](handleError(_0x12f06b,null));};exports[_0x469a('0x115')]=function(_0x39cff9,_0x4beffe){var _0x263228={};var _0x3b5cef={};var _0x413411;return db['User'][_0x469a('0x92')]({'where':{'id':_0x39cff9[_0x469a('0x54')]['id']}})[_0x469a('0x20')](handleEntityNotFound(_0x4beffe,null))['then'](function(_0x3f34b2){if(_0x3f34b2){_0x413411=_0x3f34b2;_0x3b5cef['model']=_[_0x469a('0xcc')](db['User']['rawAttributes']);_0x3b5cef['query']=_[_0x469a('0xcc')](_0x39cff9[_0x469a('0x40')]);_0x3b5cef[_0x469a('0xce')]=_[_0x469a('0xcf')](_0x3b5cef[_0x469a('0xcb')],_0x3b5cef[_0x469a('0x40')]);_0x263228[_0x469a('0x44')]=_[_0x469a('0xcf')](_0x3b5cef['model'],qs[_0x469a('0xd6')](_0x39cff9['query'][_0x469a('0xd6')]));_0x263228[_0x469a('0x44')]=_0x263228['attributes']['length']?_0x263228['attributes']:_0x3b5cef['model'];_0x263228[_0x469a('0xd0')]=qs[_0x469a('0xd1')](_0x39cff9['query']['sort']);_0x263228[_0x469a('0x3e')]=qs['filters'](_[_0x469a('0xd2')](_0x39cff9[_0x469a('0x40')],_0x3b5cef['filters']));if(_0x39cff9[_0x469a('0x40')][_0x469a('0x27')]){_0x263228['where']=_[_0x469a('0x57')](_0x263228['where'],{'$or':_[_0x469a('0x29')](_0x263228[_0x469a('0x44')],function(_0x5eeb8e){var _0x49bf82={};_0x49bf82[_0x5eeb8e]={'$like':'%'+_0x39cff9[_0x469a('0x40')][_0x469a('0x27')]+'%'};return _0x49bf82;})});}_0x263228[_0x469a('0xcb')]=db['User'];_0x263228['as']=_0x469a('0x24');_0x263228=_['merge']({},_0x263228,_0x39cff9[_0x469a('0x58')]);return _0x413411[_0x469a('0xf1')]({'include':[_0x263228]});}})[_0x469a('0x20')](function(_0x344c9d){if(_0x344c9d){var _0x59db6e={},_0x1fa03c=[];for(var _0x3727a1=0x0;_0x3727a1<_0x344c9d[_0x469a('0x48')];_0x3727a1+=0x1){for(var _0x559157=0x0,_0x36b287;_0x559157<_0x344c9d[_0x3727a1][_0x469a('0x24')]['length'];_0x559157+=0x1){_0x36b287=_0x344c9d[_0x3727a1]['Agents'][_0x559157][_0x469a('0x21')]({'plain':!![]});_0x59db6e[_0x36b287['id']]=_0x36b287;}}_0x59db6e=_[_0x469a('0x116')](_0x59db6e);for(var _0x1e1e45=qs[_0x469a('0x18')](_0x39cff9['query'][_0x469a('0x18')]);_0x1e1e45<_0x59db6e['length']&&_0x1fa03c[_0x469a('0x48')]=_0x145bde){_0x5e63e9=_0x145bde;_0x96c401=0xc8;}else{_0x96c401=0xce;}_0x1c5c01[_0x18c3('0x1f')](_0x96c401);return _0x1c5c01['set']('Content-Range',_0x603825+'-'+_0x5e63e9+'/'+_0x145bde)[_0x18c3('0x1a')](_0xdcff43);}return null;};}function saveUpdates(_0x166300){return function(_0x119018){if(_0x119018){return _0x119018['update'](_0x166300)[_0x18c3('0x20')](function(_0x49e19a){if(_0x49e19a[_0x18c3('0x21')]===_0x18c3('0x22')){socket[_0x18c3('0x23')](_0x18c3('0x24')+_0x49e19a['id'],_0x49e19a);}return _0x49e19a;});}return null;};}function removeEntity(_0x3c4326){return function(_0x2a4cb6){if(_0x2a4cb6){return _0x2a4cb6['destroy']()['then'](function(){var _0x46e74e=_0x2a4cb6[_0x18c3('0x25')]({'plain':!![]});if(_0x46e74e[_0x18c3('0x21')]==='admin')return;var _0x5d0022=[{'name':_0x18c3('0x26'),'value':_0x18c3('0x27'),'ignore':!![]},{'name':'Agents','value':_0x18c3('0x22'),'ignore':![]},{'name':_0x18c3('0x28'),'value':_0x18c3('0x29'),'ignore':![]}];var _0x4882ae=_(_0x5d0022)['filter'](_0x18c3('0x2a'))[_0x18c3('0x2b')](_0x18c3('0x2c'))['value']();if(_[_0x18c3('0x2d')](_0x4882ae,_0x46e74e[_0x18c3('0x21')])){return;}var _0xfcf20a=_[_0x18c3('0x2e')](_0x5d0022,['value',_0x46e74e[_0x18c3('0x21')]])[_0x18c3('0x2f')];return db[_0x18c3('0x30')][_0x18c3('0x31')]({'where':{'type':_0xfcf20a,'resourceId':_0x46e74e['id']}})['then'](function(){return _0x2a4cb6;});})[_0x18c3('0x20')](function(){_0x3c4326['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x47a365){return function(_0x2ba1c2){if(!_0x2ba1c2){_0x47a365[_0x18c3('0x18')](0x194);}return _0x2ba1c2;};}function handleError(_0x1d29b8,_0x513814){_0x513814=_0x513814||0x1f4;return function(_0x1eae5f){logger[_0x18c3('0x32')](_0x1eae5f['stack']);if(_0x1eae5f[_0x18c3('0x2f')]){delete _0x1eae5f[_0x18c3('0x2f')];}_0x1d29b8[_0x18c3('0x1f')](_0x513814)[_0x18c3('0x33')](_0x1eae5f);};}function getUserAttributes(){return _(db[_0x18c3('0x34')]['rawAttributes'])[_0x18c3('0x2b')](function(_0xa9b2bc){return{'name':_0xa9b2bc[_0x18c3('0x35')],'type':_0xa9b2bc[_0x18c3('0x36')]['key']};})[_0x18c3('0x37')](function(_0x329065){return![_0x18c3('0x38'),'salt',_0x18c3('0x39'),_0x18c3('0x3a'),_0x18c3('0x3b'),_0x18c3('0x3c'),'md5secret'][_0x18c3('0x2d')](_0x329065[_0x18c3('0x2f')]);})[_0x18c3('0x2c')]();}exports['index']=function(_0x14b675,_0x289220){var _0x4d6228={},_0x46297d={'count':0x0,'rows':[]};var _0x223853=getUserAttributes();_0x4d6228=qs[_0x18c3('0x3d')](_0x223853,_0x14b675);var _0x26bef6={'where':_0x4d6228[_0x18c3('0x3e')]};return db[_0x18c3('0x34')][_0x18c3('0x1e')](_0x26bef6)['then'](function(_0x5700d6){_0x46297d[_0x18c3('0x1e')]=_0x5700d6;if(_0x14b675[_0x18c3('0x3f')]['includeAll']){_0x4d6228[_0x18c3('0x40')]=[{'all':!![]}];}if(_0x14b675[_0x18c3('0x3f')][_0x18c3('0x41')]===_0x18c3('0x42')){_0x4d6228[_0x18c3('0x40')]=[{'model':db['UserSetting'],'as':_0x18c3('0x41')}];}if(!_[_0x18c3('0x2d')](_0x4d6228[_0x18c3('0x43')],'id')){_0x4d6228[_0x18c3('0x43')][_0x18c3('0x44')]('id');}return db[_0x18c3('0x34')]['findAll'](_0x4d6228);})['then'](function(_0x188f92){_0x46297d['rows']=_0x188f92;if(_0x14b675[_0x18c3('0x3f')][_0x18c3('0x45')]===_0x18c3('0x42')){var _0x3b46d4=[];for(var _0x11f456=0x0;_0x11f456<_0x46297d[_0x18c3('0x46')][_0x18c3('0x47')];_0x11f456++){_0x3b46d4[_0x18c3('0x44')](get_open_tabs(_0x18c3('0x48'),_0x46297d[_0x18c3('0x46')][_0x11f456][_0x18c3('0x49')]));_0x3b46d4[_0x18c3('0x44')](get_open_tabs(_0x18c3('0x4a'),_0x46297d['rows'][_0x11f456][_0x18c3('0x49')]));_0x3b46d4['push'](get_open_tabs(_0x18c3('0x4b'),_0x46297d[_0x18c3('0x46')][_0x11f456][_0x18c3('0x49')]));_0x3b46d4['push'](get_open_tabs(_0x18c3('0x4c'),_0x46297d['rows'][_0x11f456][_0x18c3('0x49')]));_0x3b46d4[_0x18c3('0x44')](get_open_tabs('openchannel',_0x46297d[_0x18c3('0x46')][_0x11f456][_0x18c3('0x49')]));_0x3b46d4[_0x18c3('0x44')](get_open_tabs(_0x18c3('0x4d'),_0x46297d[_0x18c3('0x46')][_0x11f456][_0x18c3('0x49')]));}return Promise[_0x18c3('0x4e')](_0x3b46d4)[_0x18c3('0x20')](function(){return _0x46297d;});}else{return _0x46297d;}})['then'](respondWithFilteredResult(_0x289220,_0x4d6228))[_0x18c3('0x4f')](handleError(_0x289220,null));};exports[_0x18c3('0x50')]=function(_0x4d89f0,_0x429269){var _0x4773d6=getUserAttributes();_0x4d89f0['query']['id']=_0x4d89f0[_0x18c3('0x51')]['id'];var _0x4d7d38=qs[_0x18c3('0x3d')](_0x4773d6,_0x4d89f0);if(_0x4d89f0[_0x18c3('0x3f')][_0x18c3('0x52')]){_0x4d7d38[_0x18c3('0x40')]=[{'all':!![]}];}if(_0x4d89f0[_0x18c3('0x3f')][_0x18c3('0x41')]===_0x18c3('0x42')){_0x4d7d38[_0x18c3('0x40')]=[{'model':db[_0x18c3('0x53')],'as':'userSetting'}];}_0x4d7d38=_[_0x18c3('0x54')]({},_0x4d7d38,_0x4d89f0[_0x18c3('0x55')]);if(!_[_0x18c3('0x2d')](_0x4d7d38[_0x18c3('0x43')],'id')){_0x4d7d38[_0x18c3('0x43')][_0x18c3('0x44')]('id');}return db[_0x18c3('0x34')][_0x18c3('0x2e')](_0x4d7d38)[_0x18c3('0x20')](handleEntityNotFound(_0x429269,null))[_0x18c3('0x20')](function(_0x356aff){var _0x25b9e1=[];values=_0x356aff;if(_0x4d89f0[_0x18c3('0x3f')][_0x18c3('0x45')]===_0x18c3('0x42')){_0x25b9e1[_0x18c3('0x44')](get_open_tabs(_0x18c3('0x48'),_0x356aff[_0x18c3('0x49')]));_0x25b9e1[_0x18c3('0x44')](get_open_tabs(_0x18c3('0x4a'),_0x356aff[_0x18c3('0x49')]));_0x25b9e1['push'](get_open_tabs(_0x18c3('0x56'),_0x356aff[_0x18c3('0x49')]));_0x25b9e1[_0x18c3('0x44')](get_open_tabs(_0x18c3('0x4d'),_0x356aff['dataValues']));_0x25b9e1[_0x18c3('0x44')](get_open_tabs(_0x18c3('0x4b'),_0x356aff[_0x18c3('0x49')]));_0x25b9e1[_0x18c3('0x44')](get_open_tabs('mail',_0x356aff['dataValues']));return Promise['all'](_0x25b9e1);}else{return values;}})[_0x18c3('0x20')](function(){return values;})[_0x18c3('0x20')](respondWithResult(_0x429269,null))['catch'](handleError(_0x429269,null));};exports['update']=function(_0x23dd41,_0x2b2abc){if(_0x23dd41[_0x18c3('0x57')]['id']){delete _0x23dd41['body']['id'];}delete _0x23dd41[_0x18c3('0x57')]['role'];return db[_0x18c3('0x34')][_0x18c3('0x2e')]({'where':{'id':_0x23dd41[_0x18c3('0x51')]['id']}})[_0x18c3('0x20')](handleEntityNotFound(_0x2b2abc,null))[_0x18c3('0x20')](saveUpdates(_0x23dd41[_0x18c3('0x57')],null))[_0x18c3('0x20')](respondWithResult(_0x2b2abc,null))[_0x18c3('0x4f')](handleError(_0x2b2abc,null));};exports['describe']=function(_0x4431cc,_0x3021ca){return db[_0x18c3('0x34')][_0x18c3('0x58')]()[_0x18c3('0x20')](respondWithResult(_0x3021ca,null))[_0x18c3('0x4f')](handleError(_0x3021ca,null));};exports['addContacts']=function(_0x380a86,_0x96449){return db['User'][_0x18c3('0x2e')]({'where':{'id':_0x380a86['params']['id']}})[_0x18c3('0x20')](handleEntityNotFound(_0x96449,null))['then'](function(_0x3a752c){if(_0x3a752c){return _0x3a752c[_0x18c3('0x59')](_0x380a86[_0x18c3('0x57')][_0x18c3('0x5a')],_[_0x18c3('0x5b')](_0x380a86[_0x18c3('0x57')],[_0x18c3('0x5a'),'id'])||{});}})[_0x18c3('0x20')](respondWithResult(_0x96449,null))[_0x18c3('0x4f')](handleError(_0x96449,null));};function validateUser(_0x5cce83){return new Promise(function(_0x429660,_0x49de15){if(_0x5cce83[_0x18c3('0x5c')])return _0x429660(_0x5cce83);return db[_0x18c3('0x5d')][_0x18c3('0x5e')](0x1)[_0x18c3('0x20')](function(_0x15ca66){if(_0x15ca66[_0x18c3('0x5f')])authService[_0x18c3('0x60')](_0x5cce83[_0x18c3('0x38')]);db[_0x18c3('0x34')]['max'](_0x18c3('0x5c'))[_0x18c3('0x20')](function(_0x2b504a){if(_['isNil'](_0x2b504a)){_0x5cce83[_0x18c3('0x5c')]=_0x15ca66[_0x18c3('0x61')]||0x1;return;}if(_['isNil'](_0x15ca66[_0x18c3('0x61')])||_0x15ca66[_0x18c3('0x61')]===_0x2b504a){_0x5cce83[_0x18c3('0x5c')]=_0x2b504a+0x1;return;}if(_0x15ca66[_0x18c3('0x61')]>_0x2b504a){_0x5cce83['internal']=_0x15ca66['min_internal'];return;}return db[_0x18c3('0x62')][_0x18c3('0x3f')](_0x18c3('0x63'),{'type':db[_0x18c3('0x62')][_0x18c3('0x64')]['SELECT']})[_0x18c3('0x20')](function(_0x3357b1){if(_0x3357b1&&_0x3357b1[_0x18c3('0x47')]){for(var _0x29eb17=0x0,_0x2d0cd5=_0x3357b1[_0x18c3('0x47')];_0x29eb17<_0x2d0cd5&&_['isNil'](_0x5cce83[_0x18c3('0x5c')]);_0x29eb17++){if(_0x15ca66[_0x18c3('0x61')]<=_0x3357b1[_0x29eb17][_0x18c3('0x65')]){_0x5cce83[_0x18c3('0x5c')]=_0x3357b1[_0x29eb17][_0x18c3('0x65')];}else if(_0x15ca66[_0x18c3('0x61')]>_0x3357b1[_0x29eb17][_0x18c3('0x65')]&&_0x15ca66[_0x18c3('0x61')]<=_0x3357b1[_0x29eb17]['to']){_0x5cce83[_0x18c3('0x5c')]=_0x15ca66[_0x18c3('0x61')];}}}if(_[_0x18c3('0x66')](_0x5cce83['internal'])){_0x5cce83[_0x18c3('0x5c')]=_0x2b504a+0x1;}return _0x429660(_0x5cce83);});});})[_0x18c3('0x4f')](function(_0x4893b1){_0x49de15(_0x4893b1);});});}function updateUser(_0x27d708){return new Promise(function(_0x22d3e6,_0x536fc6){try{if(_0x27d708['voicemail']){_0x27d708[_0x18c3('0x67')]=_0x27d708[_0x18c3('0x5c')];_0x27d708[_0x18c3('0x68')]={'mailbox':_0x27d708[_0x18c3('0x5c')],'password':_0x27d708[_0x18c3('0x38')],'fullname':_0x27d708['fullname'],'email':_0x27d708['email']};}if(_0x27d708['role']===_0x18c3('0x22')){if(!_0x27d708[_0x18c3('0x69')])_0x27d708[_0x18c3('0x69')]=[_0x18c3('0x6a'),'102',_0x18c3('0x6b'),_0x18c3('0x6c'),_0x18c3('0x6d'),_0x18c3('0x6e'),_0x18c3('0x6f'),_0x18c3('0x70'),_0x18c3('0x71'),_0x18c3('0x72'),_0x18c3('0x73'),_0x18c3('0x74'),_0x18c3('0x75'),_0x18c3('0x76'),_0x18c3('0x77')];}_0x22d3e6(_0x27d708);}catch(_0x1fb397){_0x536fc6(_0x1fb397);}});}exports['create']=function(_0x120499,_0x31368d){if(_0x120499[_0x18c3('0x27')][_0x18c3('0x21')]===_0x18c3('0x22'))throw new Error(_0x18c3('0x78'));if(_0x120499['body'][_0x18c3('0x21')]==='user'&&_0x120499[_0x18c3('0x27')]['role']!==_0x18c3('0x79')){throw new Error(_0x18c3('0x7a'));}if(_0x120499['body'][_0x18c3('0x21')]===_0x18c3('0x79')&&_0x120499['user'][_0x18c3('0x21')]!==_0x18c3('0x79')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x18c3('0x7b')]([_0x120499['body']])[_0x18c3('0x20')](function(){return validateUser(_0x120499['body']);})[_0x18c3('0x20')](function(_0x2332f3){return updateUser(_0x2332f3)[_0x18c3('0x20')](function(_0x24a7ef){if(_0x24a7ef[_0x18c3('0x21')]==='admin'){_0x24a7ef[_0x18c3('0x7c')]=_0x120499[_0x18c3('0x27')][_0x18c3('0x7c')];delete _0x24a7ef['userProfileId'];}return _0x24a7ef;});})[_0x18c3('0x20')](function(_0x2404be){return db[_0x18c3('0x34')]['create'](_0x2404be,{'include':[{'model':db[_0x18c3('0x68')],'as':'VoiceMail'}]});})[_0x18c3('0x20')](function(_0x37b44f){if(_0x120499[_0x18c3('0x57')][_0x18c3('0x21')]==='user')return _0x37b44f;if(_0x120499['user']['role']!==_0x18c3('0x27'))return _0x37b44f;return db[_0x18c3('0x7d')]['find']({'where':{'name':_0x37b44f[_0x18c3('0x21')]===_0x18c3('0x22')?_0x18c3('0x7e'):'Telephones','userProfileId':_0x120499[_0x18c3('0x27')][_0x18c3('0x7f')]},'raw':!![]})[_0x18c3('0x20')](function(_0x1e4c90){if(!_0x1e4c90||_0x1e4c90[_0x18c3('0x80')]!=0x0)return _0x37b44f;return db[_0x18c3('0x30')][_0x18c3('0x81')]({'name':_0x37b44f[_0x18c3('0x2f')],'resourceId':_0x37b44f['id'],'type':_0x1e4c90[_0x18c3('0x2f')],'sectionId':_0x1e4c90['id']},{})[_0x18c3('0x20')](function(){return _0x37b44f;});})['catch'](function(_0x5632b8){logger[_0x18c3('0x32')](_0x18c3('0x82'),_0x5632b8);throw _0x5632b8;});})[_0x18c3('0x20')](respondWithResult(_0x31368d,0xc9))[_0x18c3('0x4f')](handleError(_0x31368d,null));};exports[_0x18c3('0x83')]=function(_0x2f9752,_0x11e308){var _0x227b69=_0x2f9752['body'];var _0xdbb5c3=[];if(_0x2f9752[_0x18c3('0x27')][_0x18c3('0x21')]==='agent')throw new Error('Unauthorized');if(_[_0x18c3('0x84')](_0x227b69,[_0x18c3('0x21'),'user'])&&_0x2f9752['user'][_0x18c3('0x21')]!=='admin'){throw new Error(_0x18c3('0x7a'));}if(_['some'](_0x227b69,[_0x18c3('0x21'),_0x18c3('0x79')])&&_0x2f9752[_0x18c3('0x27')]['role']!==_0x18c3('0x79')){throw new Error(_0x18c3('0x85'));}return licenseUtil[_0x18c3('0x7b')](_0x227b69)[_0x18c3('0x20')](function(){return validateUser(_0x227b69[0x0]);})[_0x18c3('0x20')](function(){for(var _0x1e76b7=0x1;_0x1e76b7<_0x227b69[_0x18c3('0x47')];_0x1e76b7++){var _0x35d67b=_0x227b69[_0x1e76b7-0x1][_0x18c3('0x5c')];if(!_0x227b69[_0x1e76b7][_0x18c3('0x5c')])_0x227b69[_0x1e76b7][_0x18c3('0x5c')]=_0x35d67b+0x1;_0xdbb5c3['push'](validateUser(_0x227b69[_0x1e76b7]));}return Promise[_0x18c3('0x4e')](_0xdbb5c3);})[_0x18c3('0x20')](function(){_0xdbb5c3=[];for(var _0xd72ef4=0x0;_0xd72ef4<_0x227b69['length'];_0xd72ef4++){_0xdbb5c3[_0x18c3('0x44')](updateUser(_0x227b69[_0xd72ef4]));}return Promise['all'](_0xdbb5c3);})['then'](function(){_0xdbb5c3=_0x227b69[_0x18c3('0x2b')](function(_0x5c11bc){return db[_0x18c3('0x34')][_0x18c3('0x81')](_0x5c11bc,{'include':[{'model':db[_0x18c3('0x68')],'as':_0x18c3('0x68')}]})['then'](function(_0x257a77){_0x5c11bc['id']=_0x257a77['id'];return _0x5c11bc;});});return Promise[_0x18c3('0x4e')](_0xdbb5c3);})[_0x18c3('0x20')](function(_0x1ac9e2){if(_0x2f9752[_0x18c3('0x57')][_0x18c3('0x21')]===_0x18c3('0x27'))return _0x1ac9e2;if(_0x2f9752['user'][_0x18c3('0x21')]!==_0x18c3('0x27'))return _0x1ac9e2;var _0x49c2d0=_['some'](_0x1ac9e2,function(_0x4c2d2c){return _0x4c2d2c[_0x18c3('0x21')]==='agent'||_0x4c2d2c[_0x18c3('0x21')]===_0x18c3('0x29');});if(!_0x49c2d0)return _0x1ac9e2;return db[_0x18c3('0x7d')][_0x18c3('0x86')]({'where':{'name':{'$or':['Agents',_0x18c3('0x28')]},'userProfileId':_0x2f9752[_0x18c3('0x27')][_0x18c3('0x7f')]},'raw':!![]})[_0x18c3('0x20')](function(_0x3422a6){if(_[_0x18c3('0x87')](_0x3422a6)||!_['some'](_0x3422a6,[_0x18c3('0x80'),0x0]))return _0x1ac9e2;_0xdbb5c3=[];var _0x4dcec8=_(_0x3422a6)['map'](function(_0x190e98){if(_0x190e98[_0x18c3('0x80')]===0x1)return;return _0x190e98[_0x18c3('0x2f')]===_0x18c3('0x7e')?_0x18c3('0x22'):_0x18c3('0x29');})[_0x18c3('0x88')]()[_0x18c3('0x2c')]();for(var _0x5edeb7=0x0;_0x5edeb7<_0x1ac9e2[_0x18c3('0x47')];_0x5edeb7++){if(!_[_0x18c3('0x2d')](_0x4dcec8,_0x1ac9e2[_0x5edeb7][_0x18c3('0x21')]))return;var _0x42bf46=_0x1ac9e2[_0x5edeb7][_0x18c3('0x21')]==='agent'?_0x18c3('0x7e'):_0x18c3('0x28');_0xdbb5c3[_0x18c3('0x44')](db[_0x18c3('0x30')][_0x18c3('0x81')]({'name':_0x1ac9e2[_0x5edeb7]['name'],'resourceId':_0x1ac9e2[_0x5edeb7]['id'],'type':_0x42bf46,'sectionId':_[_0x18c3('0x2e')](_0x3422a6,['name',_0x42bf46])['id']},{}));}return Promise[_0x18c3('0x4e')](_0xdbb5c3);});})['then'](respondWithResult(_0x11e308,0xc9))[_0x18c3('0x4f')](handleError(_0x11e308,null));};exports['changePassword']=function(_0x4b5742,_0x417ead){if(_0x4b5742[_0x18c3('0x57')]['id']){delete _0x4b5742[_0x18c3('0x57')]['id'];}return db[_0x18c3('0x34')][_0x18c3('0x2e')]({'where':{'id':_0x4b5742[_0x18c3('0x51')]['id']}})['then'](function(_0xb6dbe2){if(!_0xb6dbe2)return null;if(_0xb6dbe2['id']===_0x4b5742[_0x18c3('0x27')]['id']){if(!_0x4b5742[_0x18c3('0x57')][_0x18c3('0x89')]||!_0x4b5742[_0x18c3('0x57')]['newPassword']){throw new db[(_0x18c3('0x8a'))]['ValidationError'](_0x18c3('0x8b'));}if(!_0xb6dbe2['authenticate'](_0x4b5742[_0x18c3('0x57')][_0x18c3('0x89')])){throw new db[(_0x18c3('0x8a'))][(_0x18c3('0x8c'))](_0x18c3('0x8d'));}if(_0x4b5742['body']['oldPassword']===_0x4b5742[_0x18c3('0x57')][_0x18c3('0x8e')]){throw new db[(_0x18c3('0x8a'))]['ValidationError']('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x4b5742[_0x18c3('0x27')]['role']===_0x18c3('0x79')){if(!_0x4b5742[_0x18c3('0x57')]['newPassword']){throw new db[(_0x18c3('0x8a'))][(_0x18c3('0x8c'))](_0x18c3('0x8f'));}}else if(_0x4b5742[_0x18c3('0x27')][_0x18c3('0x21')]===_0x18c3('0x27')){if(!_0x4b5742[_0x18c3('0x57')][_0x18c3('0x8e')]){throw new db[(_0x18c3('0x8a'))][(_0x18c3('0x8c'))](_0x18c3('0x8f'));}if(_0xb6dbe2[_0x18c3('0x21')]!==_0x18c3('0x22')){throw new db[(_0x18c3('0x8a'))][(_0x18c3('0x8c'))](_0x18c3('0x78'));}}else{throw new db[(_0x18c3('0x8a'))][(_0x18c3('0x8c'))](_0x18c3('0x78'));}return _0xb6dbe2;})[_0x18c3('0x20')](handleEntityNotFound(_0x417ead,null))[_0x18c3('0x20')](function(_0x46c877){return db['Setting'][_0x18c3('0x90')]({'attributes':['id',_0x18c3('0x5f'),'enforcePasswordHistory',_0x18c3('0x91')]})['then'](function(_0x2bbbd7){if(_0x2bbbd7[_0x18c3('0x5f')])authService[_0x18c3('0x60')](_0x4b5742[_0x18c3('0x57')][_0x18c3('0x8e')]);if(!_0x2bbbd7['enforcePasswordHistory']||!_0x46c877[_0x18c3('0x39')])return _0x46c877;authService[_0x18c3('0x92')](_0x4b5742[_0x18c3('0x57')][_0x18c3('0x8e')],_0x46c877[_0x18c3('0x39')],_0x2bbbd7['passwordHistoryLimit']);return _0x46c877;})[_0x18c3('0x20')](saveUpdates({'password':_0x4b5742[_0x18c3('0x57')][_0x18c3('0x8e')],'passwordResetAt':_0x4b5742['user']['id']==_0x4b5742['params']['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x4b5742[_0x18c3('0x57')]['newPassword'],_0x46c877[_0x18c3('0x39')])},null));})['then'](respondWithResult(_0x417ead,null))['catch'](handleError(_0x417ead,null));};exports[_0x18c3('0x93')]=function(_0x12be27,_0x3e057b){var _0x58a1ab=_0x12be27[_0x18c3('0x57')][_0x18c3('0x94')];return db[_0x18c3('0x34')]['find']({'where':{'id':_0x12be27[_0x18c3('0x51')]['id']},'attributes':['id','name',_0x18c3('0x21'),_0x18c3('0x95'),_0x18c3('0x96'),_0x18c3('0x97'),'interface']})[_0x18c3('0x20')](handleEntityNotFound(_0x3e057b,null))[_0x18c3('0x20')](function(_0x2eff9){if(_0x2eff9){if(!utils[_0x18c3('0x98')](_0x58a1ab)){throw new db[(_0x18c3('0x8a'))][(_0x18c3('0x8c'))](_0x18c3('0x99'));}return _0x2eff9['add'+_['capitalize'](_0x58a1ab['toLowerCase']())+_0x18c3('0x9a')](_0x12be27[_0x18c3('0x57')][_0x18c3('0x5a')],{'penalty':_0x12be27['body'][_0x18c3('0x9b')]||0x0})['spread'](function(_0x559d6d){for(var _0x4a3268=0x0;_0x4a3268<_0x12be27['body'][_0x18c3('0x5a')][_0x18c3('0x47')];_0x4a3268+=0x1){var _0x11c40a={'UserId':Number(_0x12be27[_0x18c3('0x51')]['id'])};_0x11c40a[_[_0x18c3('0x9c')](_0x58a1ab[_0x18c3('0x9d')]())+'QueueId']=Number(_0x12be27[_0x18c3('0x57')]['ids'][_0x4a3268]);socket[_0x18c3('0x23')](_0x18c3('0x27')+_[_0x18c3('0x9c')](_0x58a1ab[_0x18c3('0x9d')]())+_0x18c3('0x9e'),_0x11c40a);}return _0x559d6d;})[_0x18c3('0x20')](function(){if(_0x58a1ab===_0x18c3('0x9f')){return db['VoiceQueue'][_0x18c3('0x86')]({'where':{'id':_0x12be27[_0x18c3('0x57')][_0x18c3('0x5a')]||[]},'raw':!![],'attributes':['id',_0x18c3('0x2f')]});}})[_0x18c3('0x20')](function(_0x31f6a2){var _0x5545f6=_0x2eff9[_0x18c3('0x25')]({'plain':!![]});var _0x1175e6=[];if(_0x58a1ab===_0x18c3('0x9f')&&_0x5545f6['role']===_0x18c3('0x22')&&_0x5545f6[_0x18c3('0x95')]){for(let _0x3fc5f2=0x0;_0x3fc5f2<_0x31f6a2[_0x18c3('0x47')];_0x3fc5f2+=0x1){_0x1175e6[_0x18c3('0x44')]({'membername':_0x5545f6['name'],'UserId':_0x5545f6['id'],'queue_name':_0x31f6a2[_0x3fc5f2]['name'],'VoiceQueueId':_0x31f6a2[_0x3fc5f2]['id'],'interface':_[_0x18c3('0x66')](_0x5545f6[_0x18c3('0xa0')])?util[_0x18c3('0xa1')](_0x18c3('0xa2'),_0x5545f6[_0x18c3('0x2f')]):_0x5545f6[_0x18c3('0xa0')],'paused':_0x5545f6['voicePause']||![],'penalty':_0x12be27[_0x18c3('0x57')][_0x18c3('0x9b')]||0x0});}return Promise[_0x18c3('0x4e')](_0x1175e6[_0x18c3('0x2b')](function(_0x2370f1){return db[_0x18c3('0xa3')]['upsert'](_0x2370f1);}));}return _0x2eff9;});}})[_0x18c3('0x20')](respondWithStatusCode(_0x3e057b,null))[_0x18c3('0x4f')](handleError(_0x3e057b,null));};exports['removeQueues']=function(_0x504eb0,_0x404a6c){var _0x24511d,_0x385809;return db[_0x18c3('0x34')]['find']({'where':{'id':_0x504eb0[_0x18c3('0x51')]['id']},'attributes':['id','name',_0x18c3('0x21')]})[_0x18c3('0x20')](handleEntityNotFound(_0x404a6c,null))[_0x18c3('0x20')](function(_0x1ab2b1){if(_0x1ab2b1){_0x24511d=_0x1ab2b1;if(!_0x504eb0['query']['channel']||!utils[_0x18c3('0x98')](_0x504eb0[_0x18c3('0x3f')][_0x18c3('0x94')])){throw new db[(_0x18c3('0x8a'))][(_0x18c3('0x8c'))](_0x18c3('0x99'));}return _0x1ab2b1['remove'+_['capitalize'](_0x504eb0[_0x18c3('0x3f')][_0x18c3('0x94')][_0x18c3('0x9d')]())+_0x18c3('0x9a')](_0x504eb0[_0x18c3('0x3f')][_0x18c3('0x5a')]);}})[_0x18c3('0x20')](function(_0x443c8d){if(_[_0x18c3('0xa4')](_0x504eb0['query']['ids'])){for(var _0xaa89b2=0x0;_0xaa89b2<_0x504eb0['query'][_0x18c3('0x5a')][_0x18c3('0x47')];_0xaa89b2+=0x1){_0x385809={'UserId':Number(_0x504eb0[_0x18c3('0x51')]['id'])};_0x385809[_['capitalize'](_0x504eb0[_0x18c3('0x3f')][_0x18c3('0x94')]['toLowerCase']())+'QueueId']=Number(_0x504eb0[_0x18c3('0x3f')][_0x18c3('0x5a')][_0xaa89b2]);socket[_0x18c3('0x23')](_0x18c3('0x27')+_[_0x18c3('0x9c')](_0x504eb0[_0x18c3('0x3f')][_0x18c3('0x94')][_0x18c3('0x9d')]())+_0x18c3('0xa5'),_0x385809);}}else{_0x385809={'UserId':Number(_0x504eb0[_0x18c3('0x51')]['id'])};_0x385809[_[_0x18c3('0x9c')](_0x504eb0[_0x18c3('0x3f')][_0x18c3('0x94')][_0x18c3('0x9d')]())+_0x18c3('0xa6')]=Number(_0x504eb0[_0x18c3('0x3f')]['ids']);socket[_0x18c3('0x23')](_0x18c3('0x27')+_['capitalize'](_0x504eb0[_0x18c3('0x3f')][_0x18c3('0x94')][_0x18c3('0x9d')]())+_0x18c3('0xa5'),_0x385809);}return _0x443c8d;})[_0x18c3('0x20')](function(){if(_0x504eb0[_0x18c3('0x3f')][_0x18c3('0x94')]===_0x18c3('0x9f')){return db[_0x18c3('0xa3')][_0x18c3('0x31')]({'where':{'UserId':_0x504eb0[_0x18c3('0x51')]['id'],'VoiceQueueId':_0x504eb0[_0x18c3('0x3f')][_0x18c3('0x5a')]},'individualHooks':!![]})[_0x18c3('0x20')](function(){return _0x24511d;});}return _0x24511d;})['then'](respondWithStatusCode(_0x404a6c,null))[_0x18c3('0x4f')](handleError(_0x404a6c,null));};exports['addAvatar']=function(_0x18c471,_0xc10d5d){_0x18c471[_0x18c3('0x57')][_0x18c3('0xa7')]=_0x18c471[_0x18c3('0xa8')][_0x18c3('0xa9')];return db[_0x18c3('0x34')]['find']({'where':{'id':_0x18c471[_0x18c3('0x51')]['id']}})['then'](handleEntityNotFound(_0xc10d5d,null))[_0x18c3('0x20')](saveUpdates(_0x18c471[_0x18c3('0x57')],null))[_0x18c3('0x20')](respondWithResult(_0xc10d5d,null))['catch'](handleError(_0xc10d5d,null));};exports[_0x18c3('0xaa')]=function(_0x19c5a4,_0x40154f){var _0x3a62c4=path[_0x18c3('0xab')](config[_0x18c3('0xac')],_0x18c3('0xad'));return db['User'][_0x18c3('0x2e')]({'where':{'id':_0x19c5a4[_0x18c3('0x51')]['id']},'attributes':['id',_0x18c3('0xa7')],'raw':!![]})[_0x18c3('0x20')](handleEntityNotFound(_0x40154f,null))[_0x18c3('0x20')](function(_0x5d140f){if(_0x5d140f){if(_[_0x18c3('0x66')](_0x5d140f[_0x18c3('0xa7')])){return _0x40154f[_0x18c3('0xae')](_0x3a62c4);}else{if(!fs[_0x18c3('0xaf')](path[_0x18c3('0xab')](config['root'],_0x18c3('0xb0'),_0x5d140f['userpic']))){return _0x40154f[_0x18c3('0xae')](_0x3a62c4);}return _0x40154f[_0x18c3('0xae')](path[_0x18c3('0xab')](config['root'],_0x18c3('0xb0'),_0x5d140f[_0x18c3('0xa7')]));}}})[_0x18c3('0x4f')](handleError(_0x40154f,null));};exports[_0x18c3('0xb1')]=function(_0x517064,_0x160e22){return db[_0x18c3('0x34')][_0x18c3('0x2e')]({'where':{'id':_0x517064[_0x18c3('0x51')]['id']},'attributes':['id']})[_0x18c3('0x20')](handleEntityNotFound(_0x160e22,null))['then'](function(_0x129a78){var _0x1e22c5=[];values=_0x129a78[_0x18c3('0x49')];_0x1e22c5[_0x18c3('0x44')](get_open_tabs(_0x18c3('0x48'),_0x129a78[_0x18c3('0x49')]));_0x1e22c5[_0x18c3('0x44')](get_open_tabs('sms',_0x129a78[_0x18c3('0x49')]));_0x1e22c5['push'](get_open_tabs(_0x18c3('0x56'),_0x129a78[_0x18c3('0x49')]));_0x1e22c5['push'](get_open_tabs('whatsapp',_0x129a78[_0x18c3('0x49')]));_0x1e22c5[_0x18c3('0x44')](get_open_tabs(_0x18c3('0x4b'),_0x129a78[_0x18c3('0x49')]));_0x1e22c5[_0x18c3('0x44')](get_open_tabs('mail',_0x129a78[_0x18c3('0x49')]));return Promise[_0x18c3('0x4e')](_0x1e22c5);})['then'](function(_0x150c11){if(_0x150c11){var _0x30d3d6=_['map'](values[_0x18c3('0xb2')],function(_0xcffddb){return{'channel':_0x18c3('0xb3'),'id':_0xcffddb['id'],'createdAt':_0xcffddb[_0x18c3('0xb4')]};});var _0x181613=_[_0x18c3('0x2b')](values[_0x18c3('0xb5')],function(_0x3cbda3){return{'channel':'FAX','id':_0x3cbda3['id'],'createdAt':_0x3cbda3[_0x18c3('0xb4')]};});var _0x236c7f=_[_0x18c3('0x2b')](values[_0x18c3('0xb6')],function(_0x343cd9){return{'channel':_0x18c3('0xb7'),'id':_0x343cd9['id'],'createdAt':_0x343cd9[_0x18c3('0xb4')]};});var _0x54dd69=_['map'](values[_0x18c3('0xb8')],function(_0x318155){return{'channel':_0x18c3('0xb9'),'id':_0x318155['id'],'createdAt':_0x318155[_0x18c3('0xb4')]};});var _0x38fc3d=_[_0x18c3('0x2b')](values[_0x18c3('0xba')],function(_0xf3e7af){return{'channel':_0x18c3('0xbb'),'id':_0xf3e7af['id'],'createdAt':_0xf3e7af[_0x18c3('0xb4')]};});var _0x194111=_['map'](values[_0x18c3('0xbc')],function(_0x192dfd){return{'channel':_0x18c3('0xbd'),'id':_0x192dfd['id'],'createdAt':_0x192dfd[_0x18c3('0xb4')]};});var _0x3d6223=_[_0x18c3('0xbe')](_0x30d3d6,_0x181613,_0x236c7f,_0x54dd69,_0x38fc3d,_0x194111);var _0x4ac557={'count':_0x3d6223[_0x18c3('0x47')],'rows':_0x3d6223};return _0x4ac557;}else return null;})['then'](respondWithResult(_0x160e22,null))[_0x18c3('0x4f')](handleError(_0x160e22,null));};exports[_0x18c3('0xbf')]=function(_0xbbec2b,_0x4270c6){var _0x32171e={};return db[_0x18c3('0x34')][_0x18c3('0x90')]({'where':{'id':_0xbbec2b[_0x18c3('0x51')]['id']}})[_0x18c3('0x20')](function(_0x3f4791){if(!_0x3f4791){throw new APINotFoundError(util[_0x18c3('0xa1')](_0x18c3('0xc0'),_0xbbec2b[_0x18c3('0x51')]['id']));}return contacts[_0x18c3('0x58')]();})[_0x18c3('0x20')](function(_0x37bd82){_0xbbec2b[_0x18c3('0x3f')][_0x18c3('0x34')]=_0xbbec2b[_0x18c3('0x51')]['id'];_0x32171e=qs['getOptions'](_0x37bd82,_0xbbec2b);if(_0xbbec2b[_0x18c3('0x3f')][_0x18c3('0xc1')]('includeAll')){_0x32171e[_0x18c3('0x40')]=[{'model':db[_0x18c3('0xc2')],'as':'List','required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x18c3('0x2f'),'color'],'where':_0xbbec2b[_0x18c3('0x3f')][_0x18c3('0xc3')]?{'id':_0xbbec2b[_0x18c3('0x3f')][_0x18c3('0xc3')]}:undefined,'required':_0xbbec2b[_0x18c3('0x3f')][_0x18c3('0xc3')]?!![]:![]}];}return contacts[_0x18c3('0x86')](_0xbbec2b[_0x18c3('0x3f')],_0xbbec2b[_0x18c3('0x27')],_0x32171e,_0x37bd82);})[_0x18c3('0x20')](respondWithFilteredResult(_0x4270c6,_0x32171e))['catch'](APIHandleError(_0x4270c6));};exports[_0x18c3('0xc4')]=function(_0x338017,_0x414272){var _0x5247c0;var _0x302658={};var _0x67b12d;return db[_0x18c3('0x34')][_0x18c3('0x90')]({'where':{'id':_0x338017['params']['id']},'attributes':['id',_0x18c3('0x2f'),_0x18c3('0x21')]})[_0x18c3('0x20')](handleEntityNotFound(_0x414272,null))[_0x18c3('0x20')](function(_0x366153){if(!utils[_0x18c3('0x98')](_0x338017[_0x18c3('0x3f')][_0x18c3('0x94')])){throw new db['Sequelize'][(_0x18c3('0x8c'))]('Unknown\x20channel');}_0x5247c0=_0x366153;var _0x436625={};_0x436625['model']=_[_0x18c3('0xc5')](db[_[_0x18c3('0x9c')](_0x338017[_0x18c3('0x3f')][_0x18c3('0x94')])+'Queue']['rawAttributes']);_0x436625['query']=_['keys'](_0x338017[_0x18c3('0x3f')]);_0x436625[_0x18c3('0xc6')]=_[_0x18c3('0xc7')](_0x436625[_0x18c3('0xc8')],_0x436625[_0x18c3('0x3f')]);_0x302658[_0x18c3('0x43')]=_[_0x18c3('0xc7')](_0x436625[_0x18c3('0xc8')],qs[_0x18c3('0xc9')](_0x338017[_0x18c3('0x3f')][_0x18c3('0xc9')]));_0x302658['attributes']=_0x302658[_0x18c3('0x43')][_0x18c3('0x47')]?_0x302658[_0x18c3('0x43')]:_0x436625[_0x18c3('0xc8')];_0x302658[_0x18c3('0xca')]=qs[_0x18c3('0xcb')](_0x338017[_0x18c3('0x3f')][_0x18c3('0xcb')]);_0x302658[_0x18c3('0x3e')]=qs[_0x18c3('0xc6')](_['pick'](_0x338017[_0x18c3('0x3f')],_0x436625[_0x18c3('0xc6')]));if(_0x338017[_0x18c3('0x3f')][_0x18c3('0x37')]){_0x302658[_0x18c3('0x3e')]=_['merge'](_0x302658[_0x18c3('0x3e')],{'$or':_[_0x18c3('0x2b')](_0x302658['attributes'],function(_0x328ea5){var _0x1ece63={};_0x1ece63[_0x328ea5]={'$like':'%'+_0x338017[_0x18c3('0x3f')][_0x18c3('0x37')]+'%'};return _0x1ece63;})});}_0x302658=_[_0x18c3('0x54')]({},_0x302658,_0x338017[_0x18c3('0x55')]);switch(_0x5247c0[_0x18c3('0x21')]){case'admin':return db[_[_0x18c3('0x9c')](_0x338017['query'][_0x18c3('0x94')])+_0x18c3('0xcc')]['findAll'](_0x302658);case _0x18c3('0x27'):case _0x18c3('0x22'):return _0x5247c0[_0x18c3('0x25')+_[_0x18c3('0x9c')](_0x338017['query'][_0x18c3('0x94')])+_0x18c3('0x9a')](_0x302658);default:throw new db[(_0x18c3('0x8a'))]['ValidationError'](_0x18c3('0xcd'));}})[_0x18c3('0x20')](function(_0x308168){_0x67b12d=_0x308168[_0x18c3('0x47')];if(!_0x338017['query']['hasOwnProperty'](_0x18c3('0xce'))){_0x302658[_0x18c3('0x1d')]=qs[_0x18c3('0x1d')](_0x338017[_0x18c3('0x3f')][_0x18c3('0x1d')]);_0x302658[_0x18c3('0x1b')]=qs['offset'](_0x338017[_0x18c3('0x3f')][_0x18c3('0x1b')]);}switch(_0x5247c0[_0x18c3('0x21')]){case _0x18c3('0x79'):return db[_['capitalize'](_0x338017[_0x18c3('0x3f')][_0x18c3('0x94')])+_0x18c3('0xcc')][_0x18c3('0x86')](_0x302658);case _0x18c3('0x27'):case'agent':return _0x5247c0[_0x18c3('0x25')+_[_0x18c3('0x9c')](_0x338017['query'][_0x18c3('0x94')])+'Queues'](_0x302658);}})[_0x18c3('0x20')](function(_0x1b16fb){return{'count':_0x67b12d,'rows':_0x1b16fb};})['then'](respondWithResult(_0x414272,null))[_0x18c3('0x4f')](handleError(_0x414272,null));};exports[_0x18c3('0xcf')]=function(_0x55ef04,_0x30fd62){var _0x2e8218={};var _0x1bef46={};var _0x136ba4;var _0x2c4505;return db['User'][_0x18c3('0x90')]({'where':{'id':_0x55ef04[_0x18c3('0x51')]['id']}})['then'](handleEntityNotFound(_0x30fd62,null))[_0x18c3('0x20')](function(_0x592756){if(_0x592756){_0x136ba4=_0x592756;_0x1bef46[_0x18c3('0xc8')]=_[_0x18c3('0xc5')](db[_0x18c3('0xa3')][_0x18c3('0xd0')]);_0x1bef46[_0x18c3('0x3f')]=_[_0x18c3('0xc5')](_0x55ef04[_0x18c3('0x3f')]);_0x1bef46[_0x18c3('0xc6')]=_[_0x18c3('0xc7')](_0x1bef46[_0x18c3('0xc8')],_0x1bef46[_0x18c3('0x3f')]);_0x2e8218[_0x18c3('0x43')]=_[_0x18c3('0xc7')](_0x1bef46[_0x18c3('0xc8')],qs[_0x18c3('0xc9')](_0x55ef04['query'][_0x18c3('0xc9')]));_0x2e8218['attributes']=_0x2e8218[_0x18c3('0x43')][_0x18c3('0x47')]?_0x2e8218[_0x18c3('0x43')]:_0x1bef46[_0x18c3('0xc8')];_0x2e8218[_0x18c3('0xca')]=qs['sort'](_0x55ef04[_0x18c3('0x3f')][_0x18c3('0xcb')]);_0x2e8218[_0x18c3('0x3e')]=qs[_0x18c3('0xc6')](_['pick'](_0x55ef04[_0x18c3('0x3f')],_0x1bef46[_0x18c3('0xc6')]));if(_0x55ef04[_0x18c3('0x3f')][_0x18c3('0x37')]){_0x2e8218[_0x18c3('0x3e')]=_['merge'](_0x2e8218[_0x18c3('0x3e')],{'$or':_[_0x18c3('0x2b')](_0x2e8218['attributes'],function(_0x38159e){var _0x3c9762={};_0x3c9762[_0x38159e]={'$like':'%'+_0x55ef04[_0x18c3('0x3f')][_0x18c3('0x37')]+'%'};return _0x3c9762;})});}_0x2e8218=_[_0x18c3('0x54')]({},_0x2e8218,_0x55ef04[_0x18c3('0x55')]);return _0x136ba4['getVoiceQueuesRt'](_0x2e8218);}})[_0x18c3('0x20')](function(_0x4ea2ef){if(_0x4ea2ef){_0x2c4505=_0x4ea2ef[_0x18c3('0x47')];if(!_0x55ef04[_0x18c3('0x3f')][_0x18c3('0xc1')](_0x18c3('0xce'))){_0x2e8218[_0x18c3('0x1d')]=qs[_0x18c3('0x1d')](_0x55ef04[_0x18c3('0x3f')][_0x18c3('0x1d')]);_0x2e8218['offset']=qs[_0x18c3('0x1b')](_0x55ef04['query'][_0x18c3('0x1b')]);}return _0x136ba4[_0x18c3('0xcf')](_0x2e8218);}})[_0x18c3('0x20')](function(_0x5e3d83){if(_0x5e3d83){return _0x5e3d83?{'count':_0x2c4505,'rows':_0x5e3d83}:null;}})[_0x18c3('0x20')](respondWithResult(_0x30fd62,null))['catch'](handleError(_0x30fd62,null));};exports[_0x18c3('0xd1')]=function(_0x1594fd,_0xfbb8aa){var _0x621702={};var _0x521f0b={};var _0x79076b;var _0x5c8430;return db[_0x18c3('0x34')][_0x18c3('0x90')]({'where':{'id':_0x1594fd[_0x18c3('0x51')]['id']}})['then'](handleEntityNotFound(_0xfbb8aa,null))[_0x18c3('0x20')](function(_0x2af582){if(_0x2af582){_0x79076b=_0x2af582;_0x521f0b[_0x18c3('0xc8')]=_[_0x18c3('0xc5')](db['ChatGroup'][_0x18c3('0xd0')]);_0x521f0b[_0x18c3('0x3f')]=_[_0x18c3('0xc5')](_0x1594fd[_0x18c3('0x3f')]);_0x521f0b[_0x18c3('0xc6')]=_[_0x18c3('0xc7')](_0x521f0b['model'],_0x521f0b[_0x18c3('0x3f')]);_0x621702[_0x18c3('0x43')]=_['intersection'](_0x521f0b[_0x18c3('0xc8')],qs[_0x18c3('0xc9')](_0x1594fd[_0x18c3('0x3f')]['fields']));_0x621702['attributes']=_0x621702[_0x18c3('0x43')][_0x18c3('0x47')]?_0x621702['attributes']:_0x521f0b['model'];_0x621702['order']=qs[_0x18c3('0xcb')](_0x1594fd[_0x18c3('0x3f')][_0x18c3('0xcb')]);_0x621702[_0x18c3('0x3e')]=qs[_0x18c3('0xc6')](_[_0x18c3('0xd2')](_0x1594fd[_0x18c3('0x3f')],_0x521f0b[_0x18c3('0xc6')]));if(_0x1594fd['query'][_0x18c3('0x37')]){_0x621702[_0x18c3('0x3e')]=_[_0x18c3('0x54')](_0x621702[_0x18c3('0x3e')],{'$or':_['map'](_0x621702[_0x18c3('0x43')],function(_0x53ead7){var _0x21ec55={};_0x21ec55[_0x53ead7]={'$like':'%'+_0x1594fd['query'][_0x18c3('0x37')]+'%'};return _0x21ec55;})});}_0x621702=_[_0x18c3('0x54')]({},_0x621702,_0x1594fd['options']);return _0x79076b[_0x18c3('0xd1')](_0x621702);}})[_0x18c3('0x20')](function(_0x2e8e43){if(_0x2e8e43){_0x5c8430=_0x2e8e43[_0x18c3('0x47')];if(!_0x1594fd[_0x18c3('0x3f')]['hasOwnProperty']('nolimit')){_0x621702[_0x18c3('0x1d')]=qs[_0x18c3('0x1d')](_0x1594fd[_0x18c3('0x3f')]['limit']);_0x621702[_0x18c3('0x1b')]=qs[_0x18c3('0x1b')](_0x1594fd[_0x18c3('0x3f')][_0x18c3('0x1b')]);}return _0x79076b[_0x18c3('0xd1')](_0x621702);}})[_0x18c3('0x20')](function(_0x5b2c68){if(_0x5b2c68){return _0x5b2c68?{'count':_0x5c8430,'rows':_0x5b2c68}:null;}})[_0x18c3('0x20')](respondWithResult(_0xfbb8aa,null))[_0x18c3('0x4f')](handleError(_0xfbb8aa,null));};exports[_0x18c3('0xd3')]=function(_0x2bca3b,_0x23a9b5){var _0x201988={'raw':!![],'where':{}};var _0x1a974a={};var _0x18777a={'count':0x0,'rows':[]};return db[_0x18c3('0x34')]['findOne']({'where':{'id':_0x2bca3b[_0x18c3('0x51')]['id']}})[_0x18c3('0x20')](handleEntityNotFound(_0x23a9b5,null))[_0x18c3('0x20')](function(_0x8e0ef7){if(_0x8e0ef7){_0x1a974a['model']=_[_0x18c3('0xc5')](db[_0x18c3('0xd4')][_0x18c3('0xd0')]);_0x1a974a['query']=_['keys'](_0x2bca3b[_0x18c3('0x3f')]);_0x1a974a[_0x18c3('0xc6')]=_[_0x18c3('0xc7')](_0x1a974a[_0x18c3('0xc8')],_0x1a974a[_0x18c3('0x3f')]);_0x201988[_0x18c3('0x43')]=_[_0x18c3('0xc7')](_0x1a974a['model'],qs[_0x18c3('0xc9')](_0x2bca3b[_0x18c3('0x3f')][_0x18c3('0xc9')]));_0x201988[_0x18c3('0x43')]=_0x201988[_0x18c3('0x43')][_0x18c3('0x47')]?_0x201988[_0x18c3('0x43')]:_0x1a974a[_0x18c3('0xc8')];if(!_0x2bca3b[_0x18c3('0x3f')][_0x18c3('0xc1')](_0x18c3('0xce'))){_0x201988[_0x18c3('0x1d')]=qs[_0x18c3('0x1d')](_0x2bca3b[_0x18c3('0x3f')]['limit']);_0x201988[_0x18c3('0x1b')]=qs[_0x18c3('0x1b')](_0x2bca3b[_0x18c3('0x3f')][_0x18c3('0x1b')]);}_0x201988['order']=qs[_0x18c3('0xcb')](_0x2bca3b[_0x18c3('0x3f')][_0x18c3('0xcb')]);_0x201988[_0x18c3('0x3e')]=qs[_0x18c3('0xc6')](_[_0x18c3('0xd2')](_0x2bca3b['query'],_0x1a974a[_0x18c3('0xc6')]));_0x201988[_0x18c3('0x3e')][_0x18c3('0xd5')]=_0x8e0ef7['id'];if(_0x2bca3b[_0x18c3('0x3f')][_0x18c3('0x37')]){_0x201988[_0x18c3('0x3e')]=_[_0x18c3('0x54')](_0x201988['where'],{'$or':_['map'](_0x201988[_0x18c3('0x43')],function(_0x4a102e){var _0x13b335={};_0x13b335[_0x4a102e]={'$like':'%'+_0x2bca3b[_0x18c3('0x3f')][_0x18c3('0x37')]+'%'};return _0x13b335;})});}_0x201988=_['merge']({},_0x201988,_0x2bca3b[_0x18c3('0x55')]);return db[_0x18c3('0xd4')]['count']({'where':_0x201988[_0x18c3('0x3e')]})[_0x18c3('0x20')](function(_0x48d632){_0x18777a[_0x18c3('0x1e')]=_0x48d632;if(_0x2bca3b['query'][_0x18c3('0x52')]){_0x201988[_0x18c3('0x40')]=[{'all':!![]}];}return db[_0x18c3('0xd4')][_0x18c3('0x86')](_0x201988);})[_0x18c3('0x20')](function(_0x160a17){_0x18777a[_0x18c3('0x46')]=_0x160a17;return _0x18777a;});}})[_0x18c3('0x20')](respondWithFilteredResult(_0x23a9b5,_0x201988))[_0x18c3('0x4f')](handleError(_0x23a9b5,null));};exports['getScreenRecordings']=function(_0xdc1fe0,_0x5f4afb){var _0xf14ff8={'raw':!![],'where':{}};var _0x5f5765={};var _0x2d2600={'count':0x0,'rows':[]};return db[_0x18c3('0x34')]['findOne']({'where':{'id':_0xdc1fe0['params']['id']}})[_0x18c3('0x20')](handleEntityNotFound(_0x5f4afb,null))['then'](function(_0x37e619){if(_0x37e619){_0x5f5765['model']=_[_0x18c3('0xc5')](db[_0x18c3('0xd6')][_0x18c3('0xd0')]);_0x5f5765[_0x18c3('0x3f')]=_[_0x18c3('0xc5')](_0xdc1fe0[_0x18c3('0x3f')]);_0x5f5765[_0x18c3('0xc6')]=_[_0x18c3('0xc7')](_0x5f5765['model'],_0x5f5765[_0x18c3('0x3f')]);_0xf14ff8[_0x18c3('0x43')]=_['intersection'](_0x5f5765[_0x18c3('0xc8')],qs[_0x18c3('0xc9')](_0xdc1fe0[_0x18c3('0x3f')][_0x18c3('0xc9')]));_0xf14ff8[_0x18c3('0x43')]=_0xf14ff8[_0x18c3('0x43')][_0x18c3('0x47')]?_0xf14ff8[_0x18c3('0x43')]:_0x5f5765['model'];if(!_0xdc1fe0[_0x18c3('0x3f')]['hasOwnProperty'](_0x18c3('0xce'))){_0xf14ff8[_0x18c3('0x1d')]=qs[_0x18c3('0x1d')](_0xdc1fe0[_0x18c3('0x3f')]['limit']);_0xf14ff8[_0x18c3('0x1b')]=qs[_0x18c3('0x1b')](_0xdc1fe0[_0x18c3('0x3f')][_0x18c3('0x1b')]);}_0xf14ff8[_0x18c3('0xca')]=qs['sort'](_0xdc1fe0[_0x18c3('0x3f')][_0x18c3('0xcb')]);_0xf14ff8[_0x18c3('0x3e')]=qs[_0x18c3('0xc6')](_['pick'](_0xdc1fe0[_0x18c3('0x3f')],_0x5f5765['filters']));_0xf14ff8[_0x18c3('0x3e')][_0x18c3('0xd5')]=_0x37e619['id'];if(_0xdc1fe0[_0x18c3('0x3f')][_0x18c3('0x37')]){_0xf14ff8[_0x18c3('0x3e')]=_[_0x18c3('0x54')](_0xf14ff8[_0x18c3('0x3e')],{'$or':_[_0x18c3('0x2b')](_0xf14ff8[_0x18c3('0x43')],function(_0x3a0785){var _0x51bf47={};_0x51bf47[_0x3a0785]={'$like':'%'+_0xdc1fe0[_0x18c3('0x3f')][_0x18c3('0x37')]+'%'};return _0x51bf47;})});}_0xf14ff8=_[_0x18c3('0x54')]({},_0xf14ff8,_0xdc1fe0['options']);return db['ScreenRecording'][_0x18c3('0x1e')]({'where':_0xf14ff8[_0x18c3('0x3e')]})['then'](function(_0x188982){_0x2d2600[_0x18c3('0x1e')]=_0x188982;if(_0xdc1fe0['query'][_0x18c3('0x52')]){_0xf14ff8[_0x18c3('0x40')]=[{'all':!![]}];}return db[_0x18c3('0xd6')][_0x18c3('0x86')](_0xf14ff8);})[_0x18c3('0x20')](function(_0x5413cb){_0x2d2600[_0x18c3('0x46')]=_0x5413cb;return _0x2d2600;});}})[_0x18c3('0x20')](respondWithFilteredResult(_0x5f4afb,_0xf14ff8))['catch'](handleError(_0x5f4afb,null));};exports[_0x18c3('0xd7')]=function(_0x3fa28a,_0x45c84b){var _0x1c434e={};var _0x4494df={};var _0x39e21c;var _0x34eb9d;return db['User']['findOne']({'where':{'id':_0x3fa28a['params']['id']}})[_0x18c3('0x20')](handleEntityNotFound(_0x45c84b,null))['then'](function(_0x476321){if(_0x476321){_0x39e21c=_0x476321;_0x4494df[_0x18c3('0xc8')]=_[_0x18c3('0xc5')](db[_0x18c3('0xd8')]['rawAttributes']);_0x4494df['query']=_[_0x18c3('0xc5')](_0x3fa28a[_0x18c3('0x3f')]);_0x4494df[_0x18c3('0xc6')]=_[_0x18c3('0xc7')](_0x4494df['model'],_0x4494df[_0x18c3('0x3f')]);_0x1c434e[_0x18c3('0x43')]=_[_0x18c3('0xc7')](_0x4494df[_0x18c3('0xc8')],qs[_0x18c3('0xc9')](_0x3fa28a['query'][_0x18c3('0xc9')]));_0x1c434e['attributes']=_0x1c434e[_0x18c3('0x43')][_0x18c3('0x47')]?_0x1c434e['attributes']:_0x4494df[_0x18c3('0xc8')];_0x1c434e[_0x18c3('0xca')]=qs[_0x18c3('0xcb')](_0x3fa28a[_0x18c3('0x3f')][_0x18c3('0xcb')]);_0x1c434e[_0x18c3('0x3e')]=qs['filters'](_[_0x18c3('0xd2')](_0x3fa28a[_0x18c3('0x3f')],_0x4494df[_0x18c3('0xc6')]));if(_0x3fa28a['query'][_0x18c3('0x37')]){_0x1c434e['where']=_[_0x18c3('0x54')](_0x1c434e['where'],{'$or':_[_0x18c3('0x2b')](_0x1c434e[_0x18c3('0x43')],function(_0x27caf1){var _0x18adb0={};_0x18adb0[_0x27caf1]={'$like':'%'+_0x3fa28a['query']['filter']+'%'};return _0x18adb0;})});}_0x1c434e=_[_0x18c3('0x54')]({},_0x1c434e,_0x3fa28a[_0x18c3('0x55')]);return _0x39e21c['getChatInteractions'](_0x1c434e);}})[_0x18c3('0x20')](function(_0x3aab80){if(_0x3aab80){_0x34eb9d=_0x3aab80[_0x18c3('0x47')];if(!_0x3fa28a[_0x18c3('0x3f')]['hasOwnProperty'](_0x18c3('0xce'))){_0x1c434e[_0x18c3('0x1d')]=qs['limit'](_0x3fa28a[_0x18c3('0x3f')]['limit']);_0x1c434e[_0x18c3('0x1b')]=qs[_0x18c3('0x1b')](_0x3fa28a['query'][_0x18c3('0x1b')]);}return _0x39e21c['getChatInteractions'](_0x1c434e);}})[_0x18c3('0x20')](function(_0xfefbda){if(_0xfefbda){return _0xfefbda?{'count':_0x34eb9d,'rows':_0xfefbda}:null;}})[_0x18c3('0x20')](respondWithResult(_0x45c84b,null))[_0x18c3('0x4f')](handleError(_0x45c84b,null));};exports['getOpenchannelInteractions']=function(_0xb54b74,_0x13456d){var _0x12646d={};var _0x406d7d={};var _0x46c044;var _0x15a073;return db[_0x18c3('0x34')][_0x18c3('0x90')]({'where':{'id':_0xb54b74['params']['id']}})[_0x18c3('0x20')](handleEntityNotFound(_0x13456d,null))['then'](function(_0xe7b6dd){if(_0xe7b6dd){_0x46c044=_0xe7b6dd;_0x406d7d['model']=_[_0x18c3('0xc5')](db[_0x18c3('0xd9')][_0x18c3('0xd0')]);_0x406d7d[_0x18c3('0x3f')]=_[_0x18c3('0xc5')](_0xb54b74[_0x18c3('0x3f')]);_0x406d7d[_0x18c3('0xc6')]=_['intersection'](_0x406d7d[_0x18c3('0xc8')],_0x406d7d[_0x18c3('0x3f')]);_0x12646d[_0x18c3('0x43')]=_[_0x18c3('0xc7')](_0x406d7d[_0x18c3('0xc8')],qs[_0x18c3('0xc9')](_0xb54b74['query'][_0x18c3('0xc9')]));_0x12646d[_0x18c3('0x43')]=_0x12646d[_0x18c3('0x43')][_0x18c3('0x47')]?_0x12646d[_0x18c3('0x43')]:_0x406d7d[_0x18c3('0xc8')];_0x12646d[_0x18c3('0xca')]=qs[_0x18c3('0xcb')](_0xb54b74['query'][_0x18c3('0xcb')]);_0x12646d[_0x18c3('0x3e')]=qs[_0x18c3('0xc6')](_[_0x18c3('0xd2')](_0xb54b74['query'],_0x406d7d[_0x18c3('0xc6')]));if(_0xb54b74[_0x18c3('0x3f')][_0x18c3('0x37')]){_0x12646d['where']=_[_0x18c3('0x54')](_0x12646d[_0x18c3('0x3e')],{'$or':_[_0x18c3('0x2b')](_0x12646d[_0x18c3('0x43')],function(_0xb75b0){var _0x2868f5={};_0x2868f5[_0xb75b0]={'$like':'%'+_0xb54b74['query']['filter']+'%'};return _0x2868f5;})});}_0x12646d=_[_0x18c3('0x54')]({},_0x12646d,_0xb54b74[_0x18c3('0x55')]);return _0x46c044[_0x18c3('0xda')](_0x12646d);}})[_0x18c3('0x20')](function(_0x4d3e29){if(_0x4d3e29){_0x15a073=_0x4d3e29['length'];if(!_0xb54b74[_0x18c3('0x3f')]['hasOwnProperty']('nolimit')){_0x12646d[_0x18c3('0x1d')]=qs[_0x18c3('0x1d')](_0xb54b74['query'][_0x18c3('0x1d')]);_0x12646d[_0x18c3('0x1b')]=qs[_0x18c3('0x1b')](_0xb54b74['query'][_0x18c3('0x1b')]);}return _0x46c044['getOpenchannelInteractions'](_0x12646d);}})[_0x18c3('0x20')](function(_0x3e701e){if(_0x3e701e){return _0x3e701e?{'count':_0x15a073,'rows':_0x3e701e}:null;}})[_0x18c3('0x20')](respondWithResult(_0x13456d,null))[_0x18c3('0x4f')](handleError(_0x13456d,null));};exports[_0x18c3('0xdb')]=function(_0x5acc60,_0x40ff3d){var _0x49f086={'raw':!![],'where':{}};var _0x377842={};var _0x456bc6={'count':0x0,'rows':[]};return db['User'][_0x18c3('0x90')]({'where':{'id':_0x5acc60['params']['id']}})['then'](handleEntityNotFound(_0x40ff3d,null))['then'](function(_0x167014){if(_0x167014){_0x377842[_0x18c3('0xc8')]=_[_0x18c3('0xc5')](db[_0x18c3('0xdc')][_0x18c3('0xd0')]);_0x377842[_0x18c3('0x3f')]=_['keys'](_0x5acc60[_0x18c3('0x3f')]);_0x377842[_0x18c3('0xc6')]=_[_0x18c3('0xc7')](_0x377842[_0x18c3('0xc8')],_0x377842[_0x18c3('0x3f')]);_0x49f086[_0x18c3('0x43')]=_['intersection'](_0x377842[_0x18c3('0xc8')],qs['fields'](_0x5acc60[_0x18c3('0x3f')][_0x18c3('0xc9')]));_0x49f086[_0x18c3('0x43')]=_0x49f086[_0x18c3('0x43')][_0x18c3('0x47')]?_0x49f086[_0x18c3('0x43')]:_0x377842[_0x18c3('0xc8')];if(!_0x5acc60[_0x18c3('0x3f')][_0x18c3('0xc1')]('nolimit')){_0x49f086[_0x18c3('0x1d')]=qs[_0x18c3('0x1d')](_0x5acc60['query']['limit']);_0x49f086[_0x18c3('0x1b')]=qs[_0x18c3('0x1b')](_0x5acc60[_0x18c3('0x3f')][_0x18c3('0x1b')]);}_0x49f086[_0x18c3('0xca')]=qs['sort'](_0x5acc60['query'][_0x18c3('0xcb')]);_0x49f086[_0x18c3('0x3e')]=qs[_0x18c3('0xc6')](_[_0x18c3('0xd2')](_0x5acc60[_0x18c3('0x3f')],_0x377842[_0x18c3('0xc6')]));_0x49f086[_0x18c3('0x3e')][_0x18c3('0xd5')]=_0x167014['id'];if(_0x5acc60[_0x18c3('0x3f')][_0x18c3('0x37')]){_0x49f086[_0x18c3('0x3e')]=_[_0x18c3('0x54')](_0x49f086[_0x18c3('0x3e')],{'$or':_[_0x18c3('0x2b')](_0x49f086['attributes'],function(_0x54b79e){var _0x421806={};_0x421806[_0x54b79e]={'$like':'%'+_0x5acc60[_0x18c3('0x3f')][_0x18c3('0x37')]+'%'};return _0x421806;})});}_0x49f086=_[_0x18c3('0x54')]({},_0x49f086,_0x5acc60[_0x18c3('0x55')]);return db[_0x18c3('0xdc')][_0x18c3('0x1e')]({'where':_0x49f086['where']})[_0x18c3('0x20')](function(_0x2849f5){_0x456bc6['count']=_0x2849f5;if(_0x5acc60[_0x18c3('0x3f')]['includeAll']){_0x49f086[_0x18c3('0x40')]=[{'all':!![]}];}return db[_0x18c3('0xdc')][_0x18c3('0x86')](_0x49f086);})[_0x18c3('0x20')](function(_0x5d0b2d){_0x456bc6[_0x18c3('0x46')]=_0x5d0b2d;return _0x456bc6;});}})['then'](respondWithFilteredResult(_0x40ff3d,_0x49f086))[_0x18c3('0x4f')](handleError(_0x40ff3d,null));};exports[_0x18c3('0xdd')]=function(_0x5c048f,_0x4f55a1){var _0x43cfee={};var _0x350a6a={};var _0x3f981b;var _0x42ff56;return db['User'][_0x18c3('0x90')]({'where':{'id':_0x5c048f['params']['id']}})['then'](handleEntityNotFound(_0x4f55a1,null))[_0x18c3('0x20')](function(_0x2d411a){if(_0x2d411a){_0x3f981b=_0x2d411a;_0x350a6a['model']=_[_0x18c3('0xc5')](db[_0x18c3('0xde')]['rawAttributes']);_0x350a6a[_0x18c3('0x3f')]=_[_0x18c3('0xc5')](_0x5c048f['query']);_0x350a6a[_0x18c3('0xc6')]=_[_0x18c3('0xc7')](_0x350a6a[_0x18c3('0xc8')],_0x350a6a[_0x18c3('0x3f')]);_0x43cfee[_0x18c3('0x43')]=_[_0x18c3('0xc7')](_0x350a6a[_0x18c3('0xc8')],qs[_0x18c3('0xc9')](_0x5c048f['query']['fields']));_0x43cfee[_0x18c3('0x43')]=_0x43cfee['attributes']['length']?_0x43cfee[_0x18c3('0x43')]:_0x350a6a[_0x18c3('0xc8')];_0x43cfee['order']=qs[_0x18c3('0xcb')](_0x5c048f[_0x18c3('0x3f')]['sort']);_0x43cfee[_0x18c3('0x3e')]=qs[_0x18c3('0xc6')](_[_0x18c3('0xd2')](_0x5c048f[_0x18c3('0x3f')],_0x350a6a['filters']));if(_0x5c048f[_0x18c3('0x3f')][_0x18c3('0x37')]){_0x43cfee[_0x18c3('0x3e')]=_['merge'](_0x43cfee[_0x18c3('0x3e')],{'$or':_[_0x18c3('0x2b')](_0x43cfee['attributes'],function(_0x5ad5e1){var _0x2b25d4={};_0x2b25d4[_0x5ad5e1]={'$like':'%'+_0x5c048f[_0x18c3('0x3f')]['filter']+'%'};return _0x2b25d4;})});}_0x43cfee=_[_0x18c3('0x54')]({},_0x43cfee,_0x5c048f[_0x18c3('0x55')]);return _0x3f981b['getSmsInteractions'](_0x43cfee);}})[_0x18c3('0x20')](function(_0x46b706){if(_0x46b706){_0x42ff56=_0x46b706[_0x18c3('0x47')];if(!_0x5c048f[_0x18c3('0x3f')][_0x18c3('0xc1')](_0x18c3('0xce'))){_0x43cfee[_0x18c3('0x1d')]=qs[_0x18c3('0x1d')](_0x5c048f[_0x18c3('0x3f')][_0x18c3('0x1d')]);_0x43cfee[_0x18c3('0x1b')]=qs['offset'](_0x5c048f[_0x18c3('0x3f')]['offset']);}return _0x3f981b[_0x18c3('0xdd')](_0x43cfee);}})[_0x18c3('0x20')](function(_0xa65312){if(_0xa65312){return _0xa65312?{'count':_0x42ff56,'rows':_0xa65312}:null;}})[_0x18c3('0x20')](respondWithResult(_0x4f55a1,null))['catch'](handleError(_0x4f55a1,null));};exports[_0x18c3('0xdf')]=function(_0x4982eb,_0x366f62){var _0x2586a9={};var _0x1c945a={};var _0x46fe21;var _0x2d5726;return db[_0x18c3('0x34')][_0x18c3('0x90')]({'where':{'id':_0x4982eb[_0x18c3('0x51')]['id']}})['then'](handleEntityNotFound(_0x366f62,null))[_0x18c3('0x20')](function(_0x4916c1){if(_0x4916c1){_0x46fe21=_0x4916c1;_0x1c945a[_0x18c3('0xc8')]=_[_0x18c3('0xc5')](db[_0x18c3('0xe0')][_0x18c3('0xd0')]);_0x1c945a[_0x18c3('0x3f')]=_[_0x18c3('0xc5')](_0x4982eb[_0x18c3('0x3f')]);_0x1c945a[_0x18c3('0xc6')]=_[_0x18c3('0xc7')](_0x1c945a[_0x18c3('0xc8')],_0x1c945a['query']);_0x2586a9[_0x18c3('0x43')]=_[_0x18c3('0xc7')](_0x1c945a[_0x18c3('0xc8')],qs[_0x18c3('0xc9')](_0x4982eb[_0x18c3('0x3f')][_0x18c3('0xc9')]));_0x2586a9['attributes']=_0x2586a9['attributes'][_0x18c3('0x47')]?_0x2586a9['attributes']:_0x1c945a[_0x18c3('0xc8')];_0x2586a9[_0x18c3('0xca')]=qs[_0x18c3('0xcb')](_0x4982eb[_0x18c3('0x3f')]['sort']);_0x2586a9[_0x18c3('0x3e')]=qs[_0x18c3('0xc6')](_[_0x18c3('0xd2')](_0x4982eb[_0x18c3('0x3f')],_0x1c945a[_0x18c3('0xc6')]));if(_0x4982eb[_0x18c3('0x3f')][_0x18c3('0x37')]){_0x2586a9[_0x18c3('0x3e')]=_[_0x18c3('0x54')](_0x2586a9[_0x18c3('0x3e')],{'$or':_['map'](_0x2586a9[_0x18c3('0x43')],function(_0x290763){var _0x2368dc={};_0x2368dc[_0x290763]={'$like':'%'+_0x4982eb[_0x18c3('0x3f')][_0x18c3('0x37')]+'%'};return _0x2368dc;})});}_0x2586a9=_[_0x18c3('0x54')]({},_0x2586a9,_0x4982eb[_0x18c3('0x55')]);return _0x46fe21[_0x18c3('0xdf')](_0x2586a9);}})[_0x18c3('0x20')](function(_0x145b9a){if(_0x145b9a){_0x2d5726=_0x145b9a[_0x18c3('0x47')];if(!_0x4982eb[_0x18c3('0x3f')][_0x18c3('0xc1')]('nolimit')){_0x2586a9[_0x18c3('0x1d')]=qs[_0x18c3('0x1d')](_0x4982eb['query'][_0x18c3('0x1d')]);_0x2586a9['offset']=qs[_0x18c3('0x1b')](_0x4982eb[_0x18c3('0x3f')][_0x18c3('0x1b')]);}return _0x46fe21[_0x18c3('0xdf')](_0x2586a9);}})['then'](function(_0x2f960b){if(_0x2f960b){return _0x2f960b?{'count':_0x2d5726,'rows':_0x2f960b}:null;}})['then'](respondWithResult(_0x366f62,null))['catch'](handleError(_0x366f62,null));};exports[_0x18c3('0xe1')]=function(_0x38377d,_0x3adb62){var _0x420ad8={};var _0x17278e={};var _0x37bc54;var _0x1cc5e3;return db[_0x18c3('0x34')][_0x18c3('0x90')]({'where':{'id':_0x38377d['params']['id']}})['then'](handleEntityNotFound(_0x3adb62,null))[_0x18c3('0x20')](function(_0x543c20){if(_0x543c20){_0x37bc54=_0x543c20;_0x17278e['model']=_[_0x18c3('0xc5')](db[_0x18c3('0xe2')][_0x18c3('0xd0')]);_0x17278e['query']=_[_0x18c3('0xc5')](_0x38377d[_0x18c3('0x3f')]);_0x17278e[_0x18c3('0xc6')]=_[_0x18c3('0xc7')](_0x17278e[_0x18c3('0xc8')],_0x17278e[_0x18c3('0x3f')]);_0x420ad8[_0x18c3('0x43')]=_['intersection'](_0x17278e['model'],qs[_0x18c3('0xc9')](_0x38377d[_0x18c3('0x3f')][_0x18c3('0xc9')]));_0x420ad8[_0x18c3('0x43')]=_0x420ad8[_0x18c3('0x43')][_0x18c3('0x47')]?_0x420ad8[_0x18c3('0x43')]:_0x17278e[_0x18c3('0xc8')];_0x420ad8['order']=qs[_0x18c3('0xcb')](_0x38377d[_0x18c3('0x3f')][_0x18c3('0xcb')]);_0x420ad8[_0x18c3('0x3e')]=qs['filters'](_['pick'](_0x38377d[_0x18c3('0x3f')],_0x17278e[_0x18c3('0xc6')]));if(_0x38377d[_0x18c3('0x3f')]['filter']){_0x420ad8[_0x18c3('0x3e')]=_[_0x18c3('0x54')](_0x420ad8[_0x18c3('0x3e')],{'$or':_[_0x18c3('0x2b')](_0x420ad8[_0x18c3('0x43')],function(_0x39fde9){var _0x5752d8={};_0x5752d8[_0x39fde9]={'$like':'%'+_0x38377d['query']['filter']+'%'};return _0x5752d8;})});}_0x420ad8=_[_0x18c3('0x54')]({},_0x420ad8,_0x38377d['options']);return _0x37bc54[_0x18c3('0xe1')](_0x420ad8);}})[_0x18c3('0x20')](function(_0x427bf0){if(_0x427bf0){_0x1cc5e3=_0x427bf0[_0x18c3('0x47')];if(!_0x38377d[_0x18c3('0x3f')][_0x18c3('0xc1')]('nolimit')){_0x420ad8[_0x18c3('0x1d')]=qs[_0x18c3('0x1d')](_0x38377d[_0x18c3('0x3f')]['limit']);_0x420ad8[_0x18c3('0x1b')]=qs[_0x18c3('0x1b')](_0x38377d[_0x18c3('0x3f')][_0x18c3('0x1b')]);}return _0x37bc54['getWhatsappInteractions'](_0x420ad8);}})[_0x18c3('0x20')](function(_0x26a58c){if(_0x26a58c){return _0x26a58c?{'count':_0x1cc5e3,'rows':_0x26a58c}:null;}})[_0x18c3('0x20')](respondWithResult(_0x3adb62,null))['catch'](handleError(_0x3adb62,null));};exports['login']=function(_0x5c5382,_0x508634,_0x16b6eb){var _0x82e5da;var _0x1dc553;var _0x1c39bc;var _0x30a670=!_[_0x18c3('0x66')](_0x5c5382[_0x18c3('0x51')]['id'])?_0x5c5382[_0x18c3('0x51')]['id']:!_[_0x18c3('0x66')](_0x5c5382['user']['id'])?_0x5c5382[_0x18c3('0x27')]['id']:null;return db[_0x18c3('0x34')][_0x18c3('0x2e')]({'where':{'id':_0x30a670,'role':{'$or':[_0x18c3('0x79'),'user',_0x18c3('0x22')]}},'attributes':['id',_0x18c3('0x2f'),_0x18c3('0xe3'),'mobile',_0x18c3('0x21'),_0x18c3('0x5c'),_0x18c3('0x96')]})[_0x18c3('0x20')](function(_0x1d1e48){if(_0x1d1e48){if(_0x1d1e48[_0x18c3('0x21')]===_0x18c3('0x22')){_0x82e5da=_0x1d1e48;if(_0x5c5382[_0x18c3('0x57')][_0x18c3('0xa0')]){_0x1c39bc=util['format'](_0x18c3('0xe4'),_0x82e5da[_0x5c5382[_0x18c3('0x57')][_0x18c3('0xa0')]]);}else if(_0x5c5382['body'][_0x18c3('0xe5')]){_0x1c39bc=util[_0x18c3('0xa1')](_0x18c3('0xa2'),_0x5c5382[_0x18c3('0x57')][_0x18c3('0xe5')]);}else{_0x1c39bc=util[_0x18c3('0xa1')](_0x18c3('0xa2'),_0x82e5da['name']);}socket['to'](util[_0x18c3('0xa1')](_0x18c3('0xe6'),_0x82e5da[_0x18c3('0x2f')]))['emit'](_0x18c3('0xe7'),{'user':{'id':_0x82e5da['id'],'name':_0x82e5da[_0x18c3('0x2f')]},'ip':_0x5c5382[_0x18c3('0xe8')][_0x18c3('0xe9')]||_0x5c5382[_0x18c3('0xea')][_0x18c3('0xeb')]||_0x5c5382[_0x18c3('0xec')][_0x18c3('0xeb')]||_0x5c5382['connection'][_0x18c3('0xec')]['remoteAddress']});return db[_0x18c3('0xa3')][_0x18c3('0x31')]({'where':{'membername':_0x82e5da[_0x18c3('0x2f')]},'individualHooks':!![]});}}else{throw new db[(_0x18c3('0x8a'))][(_0x18c3('0x8c'))](_0x18c3('0xed'));}})[_0x18c3('0x20')](function(){if(_0x82e5da){return _0x82e5da[_0x18c3('0xee')]({'raw':!![]});}})[_0x18c3('0x20')](function(_0x502dd4){if(_0x82e5da){if(_0x502dd4){_0x1dc553=_0x502dd4;if(_0x1dc553[_0x18c3('0x47')]){var _0x5efa00=_0x1dc553['map'](function(_0x3131ec){var _0x4e3125={'membername':_0x82e5da[_0x18c3('0x2f')],'UserId':_0x82e5da['id'],'queue_name':_0x3131ec['name'],'VoiceQueueId':_0x3131ec['id'],'interface':_0x1c39bc,'paused':_0x82e5da[_0x18c3('0x96')]||![],'penalty':_0x3131ec[_0x18c3('0xef')]||0x0};return db[_0x18c3('0xa3')]['upsert'](_0x4e3125);});return Promise[_0x18c3('0x4e')](_0x5efa00);}}}})[_0x18c3('0x20')](function(){if(_0x82e5da){return db[_0x18c3('0xf0')][_0x18c3('0x86')]({'where':{'membername':_0x82e5da[_0x18c3('0x2f')],'exitAt':null}});}})[_0x18c3('0x20')](function(_0x5dd4b9){if(_0x82e5da){var _0x5aaa8c=[];_0x5dd4b9['forEach'](function(_0x245992){_0x5aaa8c[_0x18c3('0x44')](_0x245992[_0x18c3('0xf1')]({'exitAt':moment()[_0x18c3('0xa1')](_0x18c3('0xf2'))}));});return Promise[_0x18c3('0x4e')](_0x5aaa8c);}})['then'](function(){if(_0x82e5da){var _0x6e37d2=[];var _0xa5a44c=[];var _0xa09319=utils[_0x18c3('0xf3')]();var _0x2e9706={'membername':_0x82e5da[_0x18c3('0x2f')],'interface':_0x1c39bc,'enterAt':moment()['format'](_0x18c3('0xf2')),'role':_0x82e5da[_0x18c3('0x21')],'internal':_0x82e5da['internal']};_0xa09319[_0x18c3('0xf4')](function(_0x102b7c){_0x6e37d2[_0x18c3('0x44')](_[_0x18c3('0x54')]({'channel':_0x102b7c,'type':_0x18c3('0xf5'),'data1':_0x5c5382['body']['device'],'data2':_0x1c39bc},_0x2e9706));if(_0x82e5da[_0x18c3('0x96')]){_0xa5a44c[_0x18c3('0x44')](_[_0x18c3('0x54')]({'channel':_0x102b7c,'type':_0x18c3('0xf6'),'data1':_0x18c3('0xf7')},_0x2e9706));}});return db[_0x18c3('0xf0')][_0x18c3('0x83')](_0x6e37d2[_0x18c3('0xbe')](_0xa5a44c),{'individualHooks':!![]});}})[_0x18c3('0x20')](function(){if(_0x82e5da){return _0x82e5da[_0x18c3('0xf1')]({'online':!![],'lastLoginAt':moment()['format'](_0x18c3('0xf2')),'voicePause':_0x82e5da[_0x18c3('0x96')]||![],'mailPause':_0x82e5da[_0x18c3('0x96')]||![],'chatPause':_0x82e5da[_0x18c3('0x96')]||![],'faxPause':_0x82e5da[_0x18c3('0x96')]||![],'smsPause':_0x82e5da[_0x18c3('0x96')]||![],'openchannelPause':_0x82e5da[_0x18c3('0x96')]||![],'whatsappPause':_0x82e5da['loginInPause']||![],'pauseType':_0x82e5da[_0x18c3('0x96')]?_0x18c3('0xf7'):null,'interface':_0x1c39bc,'lastPauseAt':moment()[_0x18c3('0xa1')]('YYYY-MM-DD\x20HH:mm:ss')});}})['then'](function(_0x3c2f6b){if(_0x5c5382[_0x18c3('0xf8')]){return _0x16b6eb();}else{return Promise[_0x18c3('0xf9')](_0x3c2f6b)['then'](respondWithResult(_0x508634,null));}})[_0x18c3('0x4f')](handleError(_0x508634,null));};exports[_0x18c3('0xfa')]=function(_0x34827e,_0x29bf97){var _0x33e906;return db[_0x18c3('0x34')][_0x18c3('0x2e')]({'where':{'id':_0x34827e['params']['id'],'role':'agent'},'attributes':['id',_0x18c3('0x2f'),'role']})[_0x18c3('0x20')](handleEntityNotFound(_0x29bf97,null))[_0x18c3('0x20')](function(_0x18888c){if(_0x18888c){_0x33e906=_0x18888c;return db[_0x18c3('0xa3')]['destroy']({'where':{'membername':_0x33e906['name']},'individualHooks':!![]});}})[_0x18c3('0x20')](function(){return db[_0x18c3('0xf0')]['findAll']({'where':{'membername':_0x33e906[_0x18c3('0x2f')],'exitAt':null}});})[_0x18c3('0x20')](function(_0x2f7432){var _0x4274a0=[];_0x2f7432[_0x18c3('0xf4')](function(_0x27c0fb){_0x4274a0[_0x18c3('0x44')](_0x27c0fb[_0x18c3('0xf1')]({'exitAt':moment()[_0x18c3('0xa1')](_0x18c3('0xf2'))}));});return Promise['all'](_0x4274a0);})[_0x18c3('0x20')](function(){return _0x33e906[_0x18c3('0xf1')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x18c3('0x20')](respondWithResult(_0x29bf97,null))[_0x18c3('0x4f')](handleError(_0x29bf97,null));};exports[_0x18c3('0xfb')]=function(_0x3ddcc9,_0x3fe6b4){var _0x1da2cb;return db['UserVoiceQueueRt']['update']({'paused':0x1},{'where':{'UserId':_0x3ddcc9[_0x18c3('0x51')]['id']},'individualHooks':!![]})[_0x18c3('0x20')](function(){return db['User'][_0x18c3('0x2e')]({'where':{'id':_0x3ddcc9[_0x18c3('0x51')]['id'],'role':'agent'},'attributes':['id',_0x18c3('0x2f'),_0x18c3('0x21'),_0x18c3('0x5c'),_0x18c3('0xa0'),_0x18c3('0x95')]});})['then'](handleEntityNotFound(_0x3fe6b4,null))['then'](function(_0x1fa8a2){if(_0x1fa8a2){_0x1da2cb=_0x1fa8a2;return db[_0x18c3('0xf0')][_0x18c3('0x86')]({'where':{'membername':_0x1da2cb[_0x18c3('0x2f')],'type':'PAUSE','exitAt':null}});}})[_0x18c3('0x20')](function(_0x21cff6){if(_0x21cff6[_0x18c3('0x47')]){var _0x44acc2=moment()['format'](_0x18c3('0xf2'));for(var _0x928e35=0x0,_0x3de665=_0x21cff6[_0x18c3('0x47')];_0x928e35<_0x3de665;_0x928e35++){_0x21cff6[_0x928e35]['updateAttributes']({'exitAt':_0x44acc2});}}})[_0x18c3('0x20')](function(){var _0x581e29=[];var _0x440b9c=utils[_0x18c3('0xf3')]();_0x440b9c[_0x18c3('0xf4')](function(_0x535671){_0x581e29[_0x18c3('0x44')]({'channel':_0x535671,'membername':_0x1da2cb[_0x18c3('0x2f')],'interface':_[_0x18c3('0x66')](_0x1da2cb[_0x18c3('0xa0')])?util[_0x18c3('0xa1')](_0x18c3('0xa2'),_0x1da2cb[_0x18c3('0x2f')]):_0x1da2cb['interface'],'type':_0x18c3('0xf6'),'enterAt':moment()[_0x18c3('0xa1')](_0x18c3('0xf2')),'data1':_0x3ddcc9['body'][_0x18c3('0x36')]||_0x18c3('0xfc'),'role':_0x1da2cb[_0x18c3('0x21')],'internal':_0x1da2cb['internal']});});return db['MemberReport']['bulkCreate'](_0x581e29,{'individualHooks':!![]});})[_0x18c3('0x20')](function(){return _0x1da2cb[_0x18c3('0xf1')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x3ddcc9[_0x18c3('0x57')][_0x18c3('0x36')]||_0x18c3('0xfc'),'lastPauseAt':moment()[_0x18c3('0xa1')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x18c3('0x20')](respondWithResult(_0x3fe6b4,null))[_0x18c3('0x4f')](handleError(_0x3fe6b4,null));};exports['unpause']=function(_0x2d4a97,_0x101be8){if(_0x2d4a97[_0x18c3('0x57')]['channel']&&!utils['isValidChannel'](_0x2d4a97[_0x18c3('0x57')][_0x18c3('0x94')])){throw new APIBadRequestError(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x2d4a97[_0x18c3('0x57')][_0x18c3('0x94')]));}return db[_0x18c3('0x34')][_0x18c3('0x2e')]({'where':{'id':_0x2d4a97[_0x18c3('0x51')]['id']},'attributes':['id','name',_0x18c3('0x21'),_0x18c3('0x5c'),_0x18c3('0xa0'),_0x18c3('0x95'),_0x18c3('0x97'),'mailPause','chatPause',_0x18c3('0xfd'),_0x18c3('0xfe'),_0x18c3('0xff'),_0x18c3('0x100'),'pauseType',_0x18c3('0x101')]})[_0x18c3('0x20')](function(_0x707a70){if(!_0x707a70){throw new APINotFoundError(util[_0x18c3('0xa1')]('User\x20with\x20id\x20%s\x20not\x20found',_0x2d4a97[_0x18c3('0x51')]['id']));}return _0x707a70['unpause'](_0x2d4a97[_0x18c3('0x57')][_0x18c3('0x94')]);})[_0x18c3('0x20')](respondWithResult(_0x101be8,null))['catch'](APIHandleError(_0x101be8));};exports[_0x18c3('0x102')]=function(_0x55c50e,_0x282dcb){var _0x5db1c4={};var _0x10b49d={};var _0x517823;var _0x26ce50;return db[_0x18c3('0x34')][_0x18c3('0x90')]({'where':{'id':_0x55c50e[_0x18c3('0x51')]['id']}})[_0x18c3('0x20')](handleEntityNotFound(_0x282dcb,null))['then'](function(_0x363133){if(_0x363133){_0x517823=_0x363133;_0x10b49d[_0x18c3('0xc8')]=_['keys'](db[_0x18c3('0x103')]['rawAttributes']);_0x10b49d[_0x18c3('0x3f')]=_['keys'](_0x55c50e[_0x18c3('0x3f')]);_0x10b49d[_0x18c3('0xc6')]=_[_0x18c3('0xc7')](_0x10b49d['model'],_0x10b49d['query']);_0x5db1c4[_0x18c3('0x43')]=_[_0x18c3('0xc7')](_0x10b49d[_0x18c3('0xc8')],qs[_0x18c3('0xc9')](_0x55c50e[_0x18c3('0x3f')][_0x18c3('0xc9')]));_0x5db1c4[_0x18c3('0x43')]=_0x5db1c4[_0x18c3('0x43')][_0x18c3('0x47')]?_0x5db1c4[_0x18c3('0x43')]:_0x10b49d['model'];_0x5db1c4['order']=qs[_0x18c3('0xcb')](_0x55c50e[_0x18c3('0x3f')][_0x18c3('0xcb')]);_0x5db1c4[_0x18c3('0x3e')]=qs[_0x18c3('0xc6')](_['pick'](_0x55c50e[_0x18c3('0x3f')],_0x10b49d['filters']));if(_0x55c50e[_0x18c3('0x3f')][_0x18c3('0x37')]){_0x5db1c4[_0x18c3('0x3e')]=_[_0x18c3('0x54')](_0x5db1c4[_0x18c3('0x3e')],{'$or':_['map'](_0x5db1c4['attributes'],function(_0x13a3bc){var _0x5c39f1={};_0x5c39f1[_0x13a3bc]={'$like':'%'+_0x55c50e['query'][_0x18c3('0x37')]+'%'};return _0x5c39f1;})});}_0x5db1c4=_['merge']({},_0x5db1c4,_0x55c50e[_0x18c3('0x55')]);return _0x517823[_0x18c3('0x102')](_0x5db1c4);}})[_0x18c3('0x20')](function(_0x2bdbd8){if(_0x2bdbd8){_0x26ce50=_0x2bdbd8['length'];if(!_0x55c50e[_0x18c3('0x3f')][_0x18c3('0xc1')](_0x18c3('0xce'))){_0x5db1c4['limit']=qs[_0x18c3('0x1d')](_0x55c50e[_0x18c3('0x3f')][_0x18c3('0x1d')]);_0x5db1c4['offset']=qs['offset'](_0x55c50e[_0x18c3('0x3f')][_0x18c3('0x1b')]);}return _0x517823[_0x18c3('0x102')](_0x5db1c4);}})[_0x18c3('0x20')](function(_0x4a4c7f){if(_0x4a4c7f){return _0x4a4c7f?{'count':_0x26ce50,'rows':_0x4a4c7f}:null;}})['then'](respondWithResult(_0x282dcb,null))['catch'](handleError(_0x282dcb,null));};exports[_0x18c3('0x104')]=function(_0x575084,_0x17ed5f){var _0x390b97=_0x575084[_0x18c3('0x51')]['id'];var _0x50ed89=_0x575084[_0x18c3('0x57')]?_0x575084['body']['ids']:null;var _0x381b5d=[];return Promise[_0x18c3('0xf9')]()['then'](function(){if(!_0x50ed89)throw new APIBadRequestError(_0x18c3('0x105'));})[_0x18c3('0x20')](function(){return db[_0x18c3('0x34')][_0x18c3('0x90')]({'where':{'id':_0x390b97}});})[_0x18c3('0x20')](function(_0xd1287b){if(!_0xd1287b)throw new APINotFoundError(util[_0x18c3('0xa1')]('User\x20with\x20id\x20%s\x20not\x20found',_0x575084[_0x18c3('0x51')]['id']));return db['sequelize']['transaction'](function(_0x29723d){return _0xd1287b['addTeams'](_0x50ed89,{'transaction':_0x29723d})['then'](function(){return db[_0x18c3('0x103')][_0x18c3('0x86')]({'where':{'id':{'$in':_0x50ed89}}});})[_0x18c3('0x20')](function(_0x36e5c5){var _0x594336=_['map'](_0x36e5c5,function(_0x178b3a){return _0x178b3a['getAssociatedQueues']();});return Promise[_0x18c3('0x4e')](_0x594336);})[_0x18c3('0x20')](function(_0x2cca0a){_0x381b5d=_[_0x18c3('0x106')](_0x2cca0a);var _0x5d2471=_[_0x18c3('0x2b')](_0x381b5d,function(_0x3414c5){return _0x3414c5[_0x18c3('0x107')](_0xd1287b['id'],{'transaction':_0x29723d});});return Promise[_0x18c3('0x4e')](_0x5d2471);})['then'](function(){if(!_0xd1287b[_0x18c3('0x95')])return;var _0x437f05=_[_0x18c3('0x37')](_0x381b5d,function(_0x2c2f08){return _0x2c2f08['getDataValue'](_0x18c3('0x94'))==='Voice';});var _0x4791ed=_['map'](_0x437f05,function(_0x586bca){return db['UserVoiceQueueRt'][_0x18c3('0x108')]({'membername':_0xd1287b[_0x18c3('0x2f')],'UserId':_0xd1287b['id'],'queue_name':_0x586bca[_0x18c3('0x2f')],'VoiceQueueId':_0x586bca['id'],'interface':_[_0x18c3('0x66')](_0xd1287b['interface'])?util[_0x18c3('0xa1')](_0x18c3('0xa2'),_0xd1287b['name']):_0xd1287b[_0x18c3('0xa0')],'paused':_0xd1287b[_0x18c3('0x97')]||![],'penalty':_0xd1287b[_0x18c3('0x9b')]},{'transaction':_0x29723d});});return Promise['all'](_0x4791ed);})[_0x18c3('0x20')](function(){return db[_0x18c3('0x109')]['findAll']({'where':{'teamId':{'$in':_0x50ed89}}});})[_0x18c3('0x20')](function(_0x4b117b){var _0x425f0b=_['map'](_0x4b117b,function(_0x57ab55){return db[_0x18c3('0x10a')][_0x18c3('0x81')]({'UserId':_0xd1287b['id'],'VoicePrefixId':_0x57ab55[_0x18c3('0x10b')]},{'transaction':_0x29723d});});return Promise[_0x18c3('0x4e')](_0x425f0b);});});})[_0x18c3('0x20')](function(){for(var _0x21df63=0x0;_0x21df63<_0x381b5d[_0x18c3('0x47')];_0x21df63++){var _0x5b0010=_0x381b5d[_0x21df63][_0x18c3('0x10c')](_0x18c3('0x94'));var _0x8c3104=_0x5b0010+_0x18c3('0xa6');socket[_0x18c3('0x23')]('user'+_0x5b0010+'Queue:save',{'UserId':_0x390b97,['queueField']:_0x381b5d[_0x21df63]['id']});}})['then'](respondWithStatusCode(_0x17ed5f,null))[_0x18c3('0x4f')](APIHandleError(_0x17ed5f));};exports[_0x18c3('0x10d')]=function(_0x10622e,_0x52ac02){var _0x4fafde=_0x10622e[_0x18c3('0x51')]['id'];var _0x5dcd99=null;if(_0x10622e[_0x18c3('0x3f')][_0x18c3('0x5a')]){_0x5dcd99=_[_0x18c3('0xa4')](_0x10622e[_0x18c3('0x3f')][_0x18c3('0x5a')])?_0x10622e[_0x18c3('0x3f')][_0x18c3('0x5a')]:[_0x10622e[_0x18c3('0x3f')][_0x18c3('0x5a')]];}var _0x21d3d5=[];return Promise[_0x18c3('0xf9')]()['then'](function(){if(!_0x5dcd99)throw new APIBadRequestError(_0x18c3('0x10e'));})[_0x18c3('0x20')](function(){return db['User']['findOne']({'where':{'id':_0x4fafde}});})[_0x18c3('0x20')](function(_0x48f5d9){if(!_0x48f5d9)throw new APINotFoundError(util[_0x18c3('0xa1')](_0x18c3('0xc0'),_0x10622e[_0x18c3('0x51')]['id']));return db[_0x18c3('0x62')][_0x18c3('0x10f')](function(_0x44c591){return _0x48f5d9[_0x18c3('0x10d')](_0x5dcd99,{'transaction':_0x44c591})[_0x18c3('0x20')](function(){return db[_0x18c3('0x103')][_0x18c3('0x86')]({'where':{'id':{'$in':_0x5dcd99}}});})[_0x18c3('0x20')](function(_0x2a0047){var _0x172cfb=_[_0x18c3('0x2b')](_0x2a0047,function(_0x14c6cf){return _0x14c6cf[_0x18c3('0x110')]();});return Promise[_0x18c3('0x4e')](_0x172cfb);})[_0x18c3('0x20')](function(_0x5dc8a9){_0x21d3d5=_[_0x18c3('0x106')](_0x5dc8a9);var _0x2686b3=_[_0x18c3('0x2b')](_0x21d3d5,function(_0x17c489){return _0x17c489['removeAgent'](_0x48f5d9['id'],{'transaction':_0x44c591});});return Promise[_0x18c3('0x4e')](_0x2686b3);})['then'](function(){if(!_0x48f5d9[_0x18c3('0x95')])return;var _0xb4f6f3=_[_0x18c3('0x37')](_0x21d3d5,function(_0x47a3ea){return _0x47a3ea[_0x18c3('0x10c')](_0x18c3('0x94'))==='Voice';});var _0x5bf349=_[_0x18c3('0x2b')](_0xb4f6f3,function(_0x5c43c8){return db[_0x18c3('0xa3')][_0x18c3('0x31')]({'where':{'VoiceQueueId':_0x5c43c8['id'],'UserId':_0x48f5d9['id']},'transaction':_0x44c591});});return Promise[_0x18c3('0x4e')](_0x5bf349);})[_0x18c3('0x20')](function(){return db[_0x18c3('0x109')][_0x18c3('0x86')]({'where':{'teamId':{'$in':_0x5dcd99}}});})[_0x18c3('0x20')](function(_0x354254){var _0x4878f2=_[_0x18c3('0x2b')](_0x354254,function(_0x288bf8){return db[_0x18c3('0x10a')][_0x18c3('0x31')]({'where':{'UserId':_0x48f5d9['id'],'VoicePrefixId':_0x288bf8['VoicePrefixId']}},{'transaction':_0x44c591});});return Promise['all'](_0x4878f2);});});})['then'](function(){for(var _0x54ab72=0x0;_0x54ab72<_0x21d3d5['length'];_0x54ab72++){var _0x34fab9=_0x21d3d5[_0x54ab72]['getDataValue']('channel');var _0x58e3a6=_0x34fab9+_0x18c3('0xa6');socket[_0x18c3('0x23')](_0x18c3('0x27')+_0x34fab9+'Queue:remove',{'UserId':_0x4fafde,['queueField']:_0x21d3d5[_0x54ab72]['id']});}})[_0x18c3('0x20')](respondWithStatusCode(_0x52ac02,null))[_0x18c3('0x4f')](APIHandleError(_0x52ac02));};exports['getLists']=function(_0x1ba0c9,_0x2fd491){var _0x21efa8={};var _0x3f01af={};var _0x1409fa;var _0x52d1d5;return db[_0x18c3('0x34')]['findOne']({'where':{'id':_0x1ba0c9['params']['id']}})[_0x18c3('0x20')](handleEntityNotFound(_0x2fd491,null))[_0x18c3('0x20')](function(_0x497d73){if(_0x497d73){_0x1409fa=_0x497d73;_0x3f01af[_0x18c3('0xc8')]=_[_0x18c3('0xc5')](db['CmList'][_0x18c3('0xd0')]);_0x3f01af['query']=_[_0x18c3('0xc5')](_0x1ba0c9[_0x18c3('0x3f')]);_0x3f01af[_0x18c3('0xc6')]=_[_0x18c3('0xc7')](_0x3f01af[_0x18c3('0xc8')],_0x3f01af[_0x18c3('0x3f')]);_0x21efa8['attributes']=_[_0x18c3('0xc7')](_0x3f01af[_0x18c3('0xc8')],qs[_0x18c3('0xc9')](_0x1ba0c9[_0x18c3('0x3f')][_0x18c3('0xc9')]));_0x21efa8[_0x18c3('0x43')]=_0x21efa8['attributes']['length']?_0x21efa8['attributes']:_0x3f01af[_0x18c3('0xc8')];_0x21efa8['order']=qs[_0x18c3('0xcb')](_0x1ba0c9[_0x18c3('0x3f')]['sort']);_0x21efa8['where']=qs[_0x18c3('0xc6')](_[_0x18c3('0xd2')](_0x1ba0c9[_0x18c3('0x3f')],_0x3f01af['filters']));if(_0x1ba0c9[_0x18c3('0x3f')][_0x18c3('0x37')]){_0x21efa8[_0x18c3('0x3e')]=_['merge'](_0x21efa8['where'],{'$or':_[_0x18c3('0x2b')](_0x21efa8['attributes'],function(_0x21f905){var _0x7a3295={};_0x7a3295[_0x21f905]={'$like':'%'+_0x1ba0c9[_0x18c3('0x3f')][_0x18c3('0x37')]+'%'};return _0x7a3295;})});}_0x21efa8=_[_0x18c3('0x54')]({},_0x21efa8,_0x1ba0c9[_0x18c3('0x55')]);return _0x1409fa[_0x18c3('0x111')](_0x21efa8);}})['then'](function(_0x5b7fdd){if(_0x5b7fdd){_0x52d1d5=_0x5b7fdd[_0x18c3('0x47')];if(!_0x1ba0c9[_0x18c3('0x3f')][_0x18c3('0xc1')](_0x18c3('0xce'))){_0x21efa8[_0x18c3('0x1d')]=qs['limit'](_0x1ba0c9[_0x18c3('0x3f')][_0x18c3('0x1d')]);_0x21efa8[_0x18c3('0x1b')]=qs['offset'](_0x1ba0c9['query'][_0x18c3('0x1b')]);}return _0x1409fa[_0x18c3('0x111')](_0x21efa8);}})[_0x18c3('0x20')](function(_0x3df97d){if(_0x3df97d){return _0x3df97d?{'count':_0x52d1d5,'rows':_0x3df97d}:null;}})[_0x18c3('0x20')](respondWithResult(_0x2fd491,null))[_0x18c3('0x4f')](handleError(_0x2fd491,null));};exports[_0x18c3('0x112')]=function(_0x14f476,_0x1a0430){var _0x388f32={};var _0x1f9f10={};var _0x47cbb7;return db['User'][_0x18c3('0x90')]({'where':{'id':_0x14f476['params']['id']}})[_0x18c3('0x20')](handleEntityNotFound(_0x1a0430,null))[_0x18c3('0x20')](function(_0x231749){if(_0x231749){_0x47cbb7=_0x231749;_0x1f9f10[_0x18c3('0xc8')]=_[_0x18c3('0xc5')](db[_0x18c3('0x34')]['rawAttributes']);_0x1f9f10[_0x18c3('0x3f')]=_['keys'](_0x14f476[_0x18c3('0x3f')]);_0x1f9f10[_0x18c3('0xc6')]=_['intersection'](_0x1f9f10[_0x18c3('0xc8')],_0x1f9f10[_0x18c3('0x3f')]);_0x388f32['attributes']=_[_0x18c3('0xc7')](_0x1f9f10[_0x18c3('0xc8')],qs[_0x18c3('0xc9')](_0x14f476[_0x18c3('0x3f')]['fields']));_0x388f32['attributes']=_0x388f32[_0x18c3('0x43')]['length']?_0x388f32[_0x18c3('0x43')]:_0x1f9f10['model'];_0x388f32[_0x18c3('0xca')]=qs[_0x18c3('0xcb')](_0x14f476[_0x18c3('0x3f')][_0x18c3('0xcb')]);_0x388f32[_0x18c3('0x3e')]=qs['filters'](_['pick'](_0x14f476[_0x18c3('0x3f')],_0x1f9f10['filters']));if(_0x14f476['query']['filter']){_0x388f32[_0x18c3('0x3e')]=_[_0x18c3('0x54')](_0x388f32[_0x18c3('0x3e')],{'$or':_['map'](_0x388f32[_0x18c3('0x43')],function(_0xb00d11){var _0x3bcaa5={};_0x3bcaa5[_0xb00d11]={'$like':'%'+_0x14f476[_0x18c3('0x3f')][_0x18c3('0x37')]+'%'};return _0x3bcaa5;})});}_0x388f32[_0x18c3('0xc8')]=db[_0x18c3('0x34')];_0x388f32['as']=_0x18c3('0x7e');_0x388f32=_[_0x18c3('0x54')]({},_0x388f32,_0x14f476[_0x18c3('0x55')]);return _0x47cbb7['getVoiceQueues']({'include':[_0x388f32]});}})[_0x18c3('0x20')](function(_0x4fbfc5){if(_0x4fbfc5){var _0x4a81b0={},_0x58b125=[];for(var _0x2a7eae=0x0;_0x2a7eae<_0x4fbfc5[_0x18c3('0x47')];_0x2a7eae+=0x1){for(var _0x59cf45=0x0,_0x21fd77;_0x59cf45<_0x4fbfc5[_0x2a7eae][_0x18c3('0x7e')][_0x18c3('0x47')];_0x59cf45+=0x1){_0x21fd77=_0x4fbfc5[_0x2a7eae][_0x18c3('0x7e')][_0x59cf45][_0x18c3('0x25')]({'plain':!![]});_0x4a81b0[_0x21fd77['id']]=_0x21fd77;}}_0x4a81b0=_[_0x18c3('0x113')](_0x4a81b0);for(var _0xbaa27f=qs[_0x18c3('0x1b')](_0x14f476['query'][_0x18c3('0x1b')]);_0xbaa27f<_0x4a81b0[_0x18c3('0x47')]&&_0x58b125['length']=_0x5234f2[_0xaf9f('0x4d')]){throw new Error(_0xaf9f('0x4e'));}})[_0xaf9f('0x18')](function(){if(_0x495daa){return db[_0xaf9f('0x26')]['destroy']({'where':{'membername':_0x495daa[_0xaf9f('0x2e')]},'individualHooks':!![]});}})[_0xaf9f('0x18')](function(){if(_0x495daa){return _0x495daa['getVoiceQueues']({'raw':!![]});}})[_0xaf9f('0x18')](function(_0x5cbbda){if(_0x495daa){if(_0x5cbbda){var _0x63e6c2=[];_0x58b731=_0x5cbbda;if(_0x58b731[_0xaf9f('0x2a')]){for(var _0x1355ac=0x0;_0x1355ac<_0x58b731[_0xaf9f('0x2a')];_0x1355ac++){_0x63e6c2[_0xaf9f('0x4f')](db[_0xaf9f('0x26')][_0xaf9f('0x50')]({'membername':_0x495daa[_0xaf9f('0x2e')],'UserId':_0x495daa['id'],'queue_name':_0x58b731[_0x1355ac][_0xaf9f('0x2e')],'VoiceQueueId':_0x58b731[_0x1355ac]['id'],'interface':_0x474558,'paused':_0x495daa[_0xaf9f('0x49')]||![],'penalty':_0x58b731[_0x1355ac][_0xaf9f('0x51')]||0x0}));}return BPromise[_0xaf9f('0x45')](_0x63e6c2);}}}})['then'](function(){if(_0x495daa){return db[_0xaf9f('0x28')][_0xaf9f('0x11')]({'where':{'membername':_0x495daa[_0xaf9f('0x2e')],'exitAt':null}});}})[_0xaf9f('0x18')](function(_0x4c5e87){if(_0x495daa){if(_0x4c5e87&&_0x4c5e87['length']){var _0x34ebe9=[];_0x4c5e87[_0xaf9f('0x2d')](function(_0x444a0b){_0x34ebe9[_0xaf9f('0x4f')](_0x444a0b[_0xaf9f('0x27')]({'exitAt':moment()[_0xaf9f('0x24')](_0xaf9f('0x2b'))}));});return BPromise[_0xaf9f('0x45')](_0x34ebe9);}}})['then'](function(){if(_0x495daa){var _0x3d0fd0=[];var _0x256c01=[];var _0x3462d9=utils[_0xaf9f('0x2c')]();var _0x4b2296={'membername':_0x495daa['name'],'interface':_0x474558,'enterAt':moment()[_0xaf9f('0x24')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x495daa[_0xaf9f('0x34')],'internal':_0x495daa[_0xaf9f('0x22')]};_0x3462d9[_0xaf9f('0x2d')](function(_0x541217){_0x3d0fd0[_0xaf9f('0x4f')](_[_0xaf9f('0x52')]({'channel':_0x541217,'type':_0xaf9f('0x53'),'data1':_0xaf9f('0x54'),'data2':_0x474558},_0x4b2296));if(_0x495daa['loginInPause']){_0x256c01[_0xaf9f('0x4f')](_['merge']({'channel':_0x541217,'type':_0xaf9f('0x29'),'data1':_0xaf9f('0x55')},_0x4b2296));}});return db[_0xaf9f('0x28')][_0xaf9f('0x35')](_0x3d0fd0[_0xaf9f('0x56')](_0x256c01),{'individualHooks':!![]});}})[_0xaf9f('0x18')](function(){if(_0x495daa){return _0x495daa[_0xaf9f('0x27')]({'online':!![],'lastLoginAt':moment()['format'](_0xaf9f('0x2b')),'voicePause':_0x495daa[_0xaf9f('0x49')]||![],'mailPause':_0x495daa[_0xaf9f('0x49')]||![],'chatPause':_0x495daa[_0xaf9f('0x49')]||![],'faxPause':_0x495daa['loginInPause']||![],'smsPause':_0x495daa[_0xaf9f('0x49')]||![],'openchannelPause':_0x495daa[_0xaf9f('0x49')]||![],'pauseType':_0x495daa[_0xaf9f('0x49')]?_0xaf9f('0x55'):null,'lastPauseAt':moment()[_0xaf9f('0x24')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x474558});}})['then'](function(_0x26ce6a){_0x5a633e(_0x26ce6a);})['catch'](function(_0x5adf92){_0x5d0ad2(_0x3a807d[_0xaf9f('0x1c')](0x1f4,_0x5adf92[_0xaf9f('0x1d')]));});});}; \ No newline at end of file +var _0x90d7=['then','format','User\x20with\x20id\x20%s\x20not\x20found','params','update','MemberReport','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','forEach','push','isNil','interface','SIP/%s','body','type','DEFAULT\x20PAUSE','uniqueid','bulkCreate','UnpauseUser','resolve','isValidChannel','channel','online','voicePause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','unpause','system','LogoutUser','findOne','UserVoiceQueueRt','destroy','all','LoginUser','phone','loginInPause','../../config/license/util','getLicense','agents','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','LOGIN','callysquare','LOGININPAUSE','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','./user.socket','register','GetUser','findAll','options','raw','where','attributes','limit','include','map','model','info','debug','stringify','catch','message','error','ShowUser','User','find','PauseUser','name','role','internal'];(function(_0x8dc04d,_0xaa7559){var _0x2f5f28=function(_0xdd2d1d){while(--_0xdd2d1d){_0x8dc04d['push'](_0x8dc04d['shift']());}};_0x2f5f28(++_0xaa7559);}(_0x90d7,0x8b));var _0x790d=function(_0x247ab8,_0x47cd65){_0x247ab8=_0x247ab8-0x0;var _0x4a02aa=_0x90d7[_0x247ab8];return _0x4a02aa;};'use strict';var _=require(_0x790d('0x0'));var util=require(_0x790d('0x1'));var moment=require(_0x790d('0x2'));var BPromise=require(_0x790d('0x3'));var Redis=require(_0x790d('0x4'));var db=require(_0x790d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x790d('0x6'))(_0x790d('0x7'));var config=require(_0x790d('0x8'));config['redis']=_['defaults'](config[_0x790d('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x790d('0x9')]));require(_0x790d('0xa'))[_0x790d('0xb')](socket);exports[_0x790d('0xc')]=function(_0x1d85b3){var _0x2de94d=this;return new Promise(function(_0x508726,_0x5bb06b){return db['User'][_0x790d('0xd')]({'raw':_0x1d85b3[_0x790d('0xe')]?_0x1d85b3[_0x790d('0xe')][_0x790d('0xf')]===undefined?!![]:![]:!![],'where':_0x1d85b3[_0x790d('0xe')]?_0x1d85b3[_0x790d('0xe')][_0x790d('0x10')]||null:null,'attributes':_0x1d85b3[_0x790d('0xe')]?_0x1d85b3[_0x790d('0xe')][_0x790d('0x11')]||null:null,'limit':_0x1d85b3[_0x790d('0xe')]?_0x1d85b3[_0x790d('0xe')][_0x790d('0x12')]||null:null,'include':_0x1d85b3[_0x790d('0xe')]?_0x1d85b3[_0x790d('0xe')][_0x790d('0x13')]?_[_0x790d('0x14')](_0x1d85b3[_0x790d('0xe')][_0x790d('0x13')],function(_0x5abe35){return{'model':db[_0x5abe35[_0x790d('0x15')]],'as':_0x5abe35['as'],'attributes':_0x5abe35['attributes'],'include':_0x5abe35['include']?_[_0x790d('0x14')](_0x5abe35['include'],function(_0x25af90){return{'model':db[_0x25af90['model']],'as':_0x25af90['as'],'attributes':_0x25af90[_0x790d('0x11')],'include':_0x25af90[_0x790d('0x13')]?_[_0x790d('0x14')](_0x25af90[_0x790d('0x13')],function(_0x502faf){return{'model':db[_0x502faf[_0x790d('0x15')]],'as':_0x502faf['as'],'attributes':_0x502faf['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x41ae8e){logger[_0x790d('0x16')](_0x790d('0xc'),_0x1d85b3);logger[_0x790d('0x17')](_0x790d('0xc'),_0x1d85b3,JSON[_0x790d('0x18')](_0x41ae8e));_0x508726(_0x41ae8e);})[_0x790d('0x19')](function(_0x519630){logger['error'](_0x790d('0xc'),_0x519630[_0x790d('0x1a')],_0x1d85b3);_0x5bb06b(_0x2de94d[_0x790d('0x1b')](0x1f4,_0x519630['message']));});});};exports[_0x790d('0x1c')]=function(_0x3cb3ad){var _0x5ae142=this;return new Promise(function(_0x3c0ff2,_0x19225e){return db[_0x790d('0x1d')][_0x790d('0x1e')]({'raw':_0x3cb3ad['options']?_0x3cb3ad[_0x790d('0xe')]['raw']===undefined?!![]:![]:!![],'where':_0x3cb3ad['options']?_0x3cb3ad[_0x790d('0xe')][_0x790d('0x10')]||null:null,'attributes':_0x3cb3ad['options']?_0x3cb3ad[_0x790d('0xe')]['attributes']||null:null,'include':_0x3cb3ad[_0x790d('0xe')]?_0x3cb3ad['options'][_0x790d('0x13')]?_[_0x790d('0x14')](_0x3cb3ad[_0x790d('0xe')][_0x790d('0x13')],function(_0x238568){return{'model':db[_0x238568[_0x790d('0x15')]],'as':_0x238568['as'],'attributes':_0x238568[_0x790d('0x11')],'include':_0x238568['include']?_['map'](_0x238568['include'],function(_0x45c78f){return{'model':db[_0x45c78f[_0x790d('0x15')]],'as':_0x45c78f['as'],'attributes':_0x45c78f['attributes'],'include':_0x45c78f[_0x790d('0x13')]?_[_0x790d('0x14')](_0x45c78f['include'],function(_0x57a41a){return{'model':db[_0x57a41a[_0x790d('0x15')]],'as':_0x57a41a['as'],'attributes':_0x57a41a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x32a2a5){logger[_0x790d('0x16')](_0x790d('0x1c'),_0x3cb3ad);logger[_0x790d('0x17')](_0x790d('0x1c'),_0x3cb3ad,JSON[_0x790d('0x18')](_0x32a2a5));_0x3c0ff2(_0x32a2a5);})[_0x790d('0x19')](function(_0x369d89){logger[_0x790d('0x1b')]('ShowUser',_0x369d89['message'],_0x3cb3ad);_0x19225e(_0x5ae142[_0x790d('0x1b')](0x1f4,_0x369d89['message']));});});};exports[_0x790d('0x1f')]=function(_0x529e29){var _0x49fd9c;return db['User'][_0x790d('0x1e')]({'where':_0x529e29[_0x790d('0xe')][_0x790d('0x10')]||{},'attributes':['id',_0x790d('0x20'),_0x790d('0x21'),_0x790d('0x22'),'interface']})[_0x790d('0x23')](function(_0x4e5c82){if(!_0x4e5c82){throw new Error(util[_0x790d('0x24')](_0x790d('0x25'),_0x529e29[_0x790d('0x26')]['id']));}_0x49fd9c=_0x4e5c82;return db['UserVoiceQueueRt'][_0x790d('0x27')]({'paused':0x1},{'where':{'UserId':_0x49fd9c['id']},'individualHooks':!![]});})[_0x790d('0x23')](function(){return db[_0x790d('0x28')][_0x790d('0xd')]({'where':{'membername':_0x49fd9c[_0x790d('0x20')],'type':_0x790d('0x29'),'exitAt':null}});})[_0x790d('0x23')](function(_0x4d4e1c){if(_0x4d4e1c&&_0x4d4e1c[_0x790d('0x2a')]){var _0x41e4da=moment()[_0x790d('0x24')](_0x790d('0x2b'));for(var _0x27f932=0x0,_0x91d1=_0x4d4e1c[_0x790d('0x2a')];_0x27f932<_0x91d1;_0x27f932++){_0x4d4e1c[_0x27f932][_0x790d('0x2c')]({'exitAt':_0x41e4da});}}})[_0x790d('0x23')](function(){var _0x45b53e=[];var _0x29fcac=utils['getChannels']();_0x29fcac[_0x790d('0x2d')](function(_0x249c2d){_0x45b53e[_0x790d('0x2e')]({'channel':_0x249c2d,'membername':_0x49fd9c[_0x790d('0x20')],'interface':_[_0x790d('0x2f')](_0x49fd9c[_0x790d('0x30')])?util['format'](_0x790d('0x31'),_0x49fd9c[_0x790d('0x20')]):_0x49fd9c[_0x790d('0x30')],'type':'PAUSE','enterAt':moment()[_0x790d('0x24')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x529e29[_0x790d('0x32')][_0x790d('0x33')]||_0x790d('0x34'),'role':_0x49fd9c['role'],'internal':_0x49fd9c[_0x790d('0x22')],'uniqueid':_0x529e29[_0x790d('0x32')][_0x790d('0x35')]||null});});return db[_0x790d('0x28')][_0x790d('0x36')](_0x45b53e,{'individualHooks':!![]});})[_0x790d('0x23')](function(){return _0x49fd9c['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x529e29[_0x790d('0x32')][_0x790d('0x33')]||_0x790d('0x34'),'lastPauseAt':moment()[_0x790d('0x24')](_0x790d('0x2b'))});})[_0x790d('0x19')](function(_0xaf793c){throw _0xaf793c;});};exports[_0x790d('0x37')]=function(_0x35f838){return Promise[_0x790d('0x38')]()['then'](function(){if(_0x35f838['body']['channel']&&!utils[_0x790d('0x39')](_0x35f838[_0x790d('0x32')][_0x790d('0x3a')])){throw new Error(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x35f838[_0x790d('0x32')][_0x790d('0x3a')]));}return db[_0x790d('0x1d')]['findOne']({'where':_0x35f838[_0x790d('0xe')][_0x790d('0x10')]||{},'attributes':['id','name',_0x790d('0x21'),_0x790d('0x22'),'interface',_0x790d('0x3b'),_0x790d('0x3c'),'mailPause',_0x790d('0x3d'),_0x790d('0x3e'),_0x790d('0x3f'),_0x790d('0x40'),_0x790d('0x41'),_0x790d('0x42'),'lastPauseAt']});})[_0x790d('0x23')](function(_0x31b88c){if(!_0x31b88c){throw new Error(util[_0x790d('0x24')]('User\x20with\x20id\x20%s\x20not\x20found',_0x35f838['params']['id']));}return _0x31b88c[_0x790d('0x43')](_0x35f838[_0x790d('0x32')][_0x790d('0x3a')],_0x790d('0x44'));})['catch'](function(_0x519f75){throw _0x519f75;});};exports[_0x790d('0x45')]=function(_0x5105f1){var _0x3c470e=this;return new Promise(function(_0xf8201,_0x5106ff){var _0x2d59dd;return db['User'][_0x790d('0x46')]({'where':_0x5105f1[_0x790d('0xe')]['where']||{},'attributes':['id','name']})[_0x790d('0x23')](function(_0x481f1b){if(_0x481f1b){_0x2d59dd=_0x481f1b;return db[_0x790d('0x47')][_0x790d('0x48')]({'where':{'membername':_0x2d59dd['name']},'individualHooks':!![]});}})[_0x790d('0x23')](function(){if(_0x2d59dd){return db[_0x790d('0x28')][_0x790d('0xd')]({'where':{'membername':_0x2d59dd[_0x790d('0x20')],'exitAt':null}});}})[_0x790d('0x23')](function(_0x4d3434){if(_0x2d59dd){if(_0x4d3434&&_0x4d3434[_0x790d('0x2a')]){var _0x4d3a6f=[];_0x4d3434[_0x790d('0x2d')](function(_0x34b734){_0x4d3a6f['push'](_0x34b734[_0x790d('0x27')]({'exitAt':moment()['format'](_0x790d('0x2b'))}));});return BPromise[_0x790d('0x49')](_0x4d3a6f);}}})['then'](function(){if(_0x2d59dd){return _0x2d59dd['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x790d('0x23')](function(_0x5da179){_0xf8201(_0x5da179);})[_0x790d('0x19')](function(_0x2bd794){_0x5106ff(_0x3c470e[_0x790d('0x1b')](0x1f4,_0x2bd794[_0x790d('0x1a')]));});});};exports[_0x790d('0x4a')]=function(_0x5d4feb){var _0x190ec1=this;return new Promise(function(_0x55b8bb,_0x551bed){var _0x52af7b;var _0x499b3e;var _0x429ddb;var _0x2970b1;return db[_0x790d('0x1d')]['findOne']({'where':_0x5d4feb[_0x790d('0xe')][_0x790d('0x10')]||{},'attributes':['id','name',_0x790d('0x21'),'mobile',_0x790d('0x4b'),_0x790d('0x22'),_0x790d('0x4c'),'interface']})['then'](function(_0x294b03){if(_0x294b03){_0x52af7b=_0x294b03;_0x2970b1=_0x5d4feb[_0x790d('0x32')][_0x790d('0x30')]?_0x5d4feb[_0x790d('0x32')][_0x790d('0x30')]:util[_0x790d('0x24')](_0x790d('0x31'),_0x52af7b[_0x790d('0x20')]);return db[_0x790d('0x1d')]['count']({'where':{'role':'agent','online':!![],'id':{'$ne':_0x52af7b['id']}}});}})[_0x790d('0x23')](function(_0x1680db){if(_0x1680db){_0x429ddb=_0x1680db;return require(_0x790d('0x4d'))[_0x790d('0x4e')]();}})[_0x790d('0x23')](function(_0x46bfd6){if(_0x46bfd6&&_0x46bfd6[_0x790d('0x4f')]&&_0x429ddb>=_0x46bfd6['agents']){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x790d('0x23')](function(){if(_0x52af7b){return db[_0x790d('0x47')][_0x790d('0x48')]({'where':{'membername':_0x52af7b[_0x790d('0x20')]},'individualHooks':!![]});}})[_0x790d('0x23')](function(){if(_0x52af7b){return _0x52af7b[_0x790d('0x50')]({'raw':!![]});}})[_0x790d('0x23')](function(_0x48ffc8){if(_0x52af7b){if(_0x48ffc8){var _0x1ce463=[];_0x499b3e=_0x48ffc8;if(_0x499b3e['length']){for(var _0x14436f=0x0;_0x14436f<_0x499b3e[_0x790d('0x2a')];_0x14436f++){_0x1ce463[_0x790d('0x2e')](db[_0x790d('0x47')][_0x790d('0x51')]({'membername':_0x52af7b[_0x790d('0x20')],'UserId':_0x52af7b['id'],'queue_name':_0x499b3e[_0x14436f][_0x790d('0x20')],'VoiceQueueId':_0x499b3e[_0x14436f]['id'],'interface':_0x2970b1,'paused':_0x52af7b[_0x790d('0x4c')]||![],'penalty':_0x499b3e[_0x14436f][_0x790d('0x52')]||0x0}));}return BPromise['all'](_0x1ce463);}}}})[_0x790d('0x23')](function(){if(_0x52af7b){return db[_0x790d('0x28')]['findAll']({'where':{'membername':_0x52af7b[_0x790d('0x20')],'exitAt':null}});}})[_0x790d('0x23')](function(_0x294ec7){if(_0x52af7b){if(_0x294ec7&&_0x294ec7[_0x790d('0x2a')]){var _0x12d59c=[];_0x294ec7[_0x790d('0x2d')](function(_0x1e9a20){_0x12d59c['push'](_0x1e9a20[_0x790d('0x27')]({'exitAt':moment()[_0x790d('0x24')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x790d('0x49')](_0x12d59c);}}})[_0x790d('0x23')](function(){if(_0x52af7b){var _0x4b99ff=[];var _0x114b37=[];var _0x1cd640=utils['getChannels']();var _0x5e949a={'membername':_0x52af7b[_0x790d('0x20')],'interface':_0x2970b1,'enterAt':moment()[_0x790d('0x24')](_0x790d('0x2b')),'role':_0x52af7b[_0x790d('0x21')],'internal':_0x52af7b[_0x790d('0x22')]};_0x1cd640[_0x790d('0x2d')](function(_0x31e6b9){_0x4b99ff['push'](_[_0x790d('0x53')]({'channel':_0x31e6b9,'type':_0x790d('0x54'),'data1':_0x790d('0x55'),'data2':_0x2970b1},_0x5e949a));if(_0x52af7b['loginInPause']){_0x114b37[_0x790d('0x2e')](_[_0x790d('0x53')]({'channel':_0x31e6b9,'type':_0x790d('0x29'),'data1':_0x790d('0x56')},_0x5e949a));}});return db[_0x790d('0x28')][_0x790d('0x36')](_0x4b99ff['concat'](_0x114b37),{'individualHooks':!![]});}})[_0x790d('0x23')](function(){if(_0x52af7b){return _0x52af7b['update']({'online':!![],'lastLoginAt':moment()['format'](_0x790d('0x2b')),'voicePause':_0x52af7b[_0x790d('0x4c')]||![],'mailPause':_0x52af7b[_0x790d('0x4c')]||![],'chatPause':_0x52af7b[_0x790d('0x4c')]||![],'faxPause':_0x52af7b[_0x790d('0x4c')]||![],'smsPause':_0x52af7b[_0x790d('0x4c')]||![],'openchannelPause':_0x52af7b[_0x790d('0x4c')]||![],'pauseType':_0x52af7b[_0x790d('0x4c')]?_0x790d('0x56'):null,'lastPauseAt':moment()[_0x790d('0x24')](_0x790d('0x2b')),'interface':_0x2970b1});}})[_0x790d('0x23')](function(_0x37d6bd){_0x55b8bb(_0x37d6bd);})['catch'](function(_0x283b33){_0x551bed(_0x190ec1['error'](0x1f4,_0x283b33[_0x790d('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 280709d..4756244 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 _0xc124=['./user.events','remove','update','emit','removeListener','register','user:'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0xc124,0x1e3));var _0x4c12=function(_0x35fa51,_0x5c44a5){_0x35fa51=_0x35fa51-0x0;var _0x178c2e=_0xc124[_0x35fa51];return _0x178c2e;};'use strict';var UserEvents=require(_0x4c12('0x0'));var events=['save',_0x4c12('0x1'),_0x4c12('0x2')];function createListener(_0x5733c0,_0xd18580){return function(_0xdab4e8){_0xd18580[_0x4c12('0x3')](_0x5733c0,_0xdab4e8);};}function removeListener(_0x35853f,_0x573412){return function(){UserEvents[_0x4c12('0x4')](_0x35853f,_0x573412);};}exports[_0x4c12('0x5')]=function(_0x49b5fc){for(var _0x14e036=0x0,_0x18bf0d=events['length'];_0x14e036<_0x18bf0d;_0x14e036++){var _0x4d2b0c=events[_0x14e036];var _0x1f6077=createListener(_0x4c12('0x6')+_0x4d2b0c,_0x49b5fc);UserEvents['on'](_0x4d2b0c,_0x1f6077);}}; \ No newline at end of file +var _0x0284=['removeListener','register','length','user:','./user.events','remove','update','emit'];(function(_0x19ace3,_0x5c4453){var _0x1fd7fa=function(_0x843ca6){while(--_0x843ca6){_0x19ace3['push'](_0x19ace3['shift']());}};_0x1fd7fa(++_0x5c4453);}(_0x0284,0x134));var _0x4028=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x0284[_0x263a74];return _0x2aa86c;};'use strict';var UserEvents=require(_0x4028('0x0'));var events=['save',_0x4028('0x1'),_0x4028('0x2')];function createListener(_0x1affbd,_0x4b336e){return function(_0xdaaa5d){_0x4b336e[_0x4028('0x3')](_0x1affbd,_0xdaaa5d);};}function removeListener(_0x19bd96,_0x3123ba){return function(){UserEvents[_0x4028('0x4')](_0x19bd96,_0x3123ba);};}exports[_0x4028('0x5')]=function(_0x8fb713){for(var _0x42e2d8=0x0,_0x5363e4=events[_0x4028('0x6')];_0x42e2d8<_0x5363e4;_0x42e2d8++){var _0x1bfecd=events[_0x42e2d8];var _0x470b39=createListener(_0x4028('0x7')+_0x1bfecd,_0x8fb713);UserEvents['on'](_0x1bfecd,_0x470b39);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index bb38c07..1079f61 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2b4ecf,_0x58a97){var _0x34faa4=function(_0x10210e){while(--_0x10210e){_0x2b4ecf['push'](_0x2b4ecf['shift']());}};_0x34faa4(++_0x58a97);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x27ff4d,_0x41a7d6){var _0x803d72=function(_0x4767cc){while(--_0x4767cc){_0x27ff4d['push'](_0x27ff4d['shift']());}};_0x803d72(++_0x41a7d6);}(_0x9c44,0x178));var _0x49c4=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x9c44[_0x2d2c16];return _0x53f2fb;};'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 7921553..c267c4f 100644 --- a/server/api/userChatQueue/userChatQueue.attributes.js +++ b/server/api/userChatQueue/userChatQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x40c2=['sequelize','exports'];(function(_0x127241,_0xb4877e){var _0x102abb=function(_0x76ec4f){while(--_0x76ec4f){_0x127241['push'](_0x127241['shift']());}};_0x102abb(++_0xb4877e);}(_0x40c2,0x1b8));var _0x240c=function(_0x23deec,_0x207fc0){_0x23deec=_0x23deec-0x0;var _0xe9659e=_0x40c2[_0x23deec];return _0xe9659e;};'use strict';var Sequelize=require(_0x240c('0x0'));module[_0x240c('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x7690=['sequelize','exports','INTEGER'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x7690,0x18c));var _0x0769=function(_0x34a686,_0x402659){_0x34a686=_0x34a686-0x0;var _0x10c51c=_0x7690[_0x34a686];return _0x10c51c;};'use strict';var Sequelize=require(_0x0769('0x0'));module[_0x0769('0x1')]={'penalty':{'type':Sequelize[_0x0769('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 ac2aed7..b173cec 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 _0xc5d9=['request-promise','path','rimraf','define','UserChatQueue','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xc5d9,0x15a));var _0x9c5d=function(_0x58b9e5,_0x57c068){_0x58b9e5=_0x58b9e5-0x0;var _0x234509=_0xc5d9[_0x58b9e5];return _0x234509;};'use strict';var _=require(_0x9c5d('0x0'));var util=require(_0x9c5d('0x1'));var logger=require(_0x9c5d('0x2'))(_0x9c5d('0x3'));var moment=require(_0x9c5d('0x4'));var BPromise=require(_0x9c5d('0x5'));var rp=require(_0x9c5d('0x6'));var fs=require('fs');var path=require(_0x9c5d('0x7'));var rimraf=require(_0x9c5d('0x8'));var config=require('../../config/environment');var attributes=require('./userChatQueue.attributes');module['exports']=function(_0x4d0a90,_0x26f24f){return _0x4d0a90[_0x9c5d('0x9')](_0x9c5d('0xa'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x00a1=['rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','moment','request-promise'];(function(_0xb1df97,_0x393088){var _0x2d5dea=function(_0x50d2fd){while(--_0x50d2fd){_0xb1df97['push'](_0xb1df97['shift']());}};_0x2d5dea(++_0x393088);}(_0x00a1,0x103));var _0x100a=function(_0x1083ab,_0x2bffbb){_0x1083ab=_0x1083ab-0x0;var _0x247ba6=_0x00a1[_0x1083ab];return _0x247ba6;};'use strict';var _=require(_0x100a('0x0'));var util=require(_0x100a('0x1'));var logger=require(_0x100a('0x2'))('api');var moment=require(_0x100a('0x3'));var BPromise=require('bluebird');var rp=require(_0x100a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x100a('0x5'));var config=require(_0x100a('0x6'));var attributes=require(_0x100a('0x7'));module[_0x100a('0x8')]=function(_0x34f48e,_0x1a6b9a){return _0x34f48e[_0x100a('0x9')](_0x100a('0xa'),attributes,{'tableName':_0x100a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index c1d7f63..c100f14 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 _0x8dac=['../../config/environment','client','http','then','info','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','error','message','UserChatQueue,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc'];(function(_0x2de0eb,_0x2a208a){var _0x7124fc=function(_0x5a8d46){while(--_0x5a8d46){_0x2de0eb['push'](_0x2de0eb['shift']());}};_0x7124fc(++_0x2a208a);}(_0x8dac,0x1d9));var _0xc8da=function(_0x6d7fb3,_0x5dfc4f){_0x6d7fb3=_0x6d7fb3-0x0;var _0x32b8c4=_0x8dac[_0x6d7fb3];return _0x32b8c4;};'use strict';var _=require(_0xc8da('0x0'));var util=require(_0xc8da('0x1'));var moment=require(_0xc8da('0x2'));var BPromise=require(_0xc8da('0x3'));var rs=require(_0xc8da('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc8da('0x5'))(_0xc8da('0x6'));var config=require(_0xc8da('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc8da('0x8')][_0xc8da('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x43141a,_0xe4b3b4,_0x1cce5c){return new BPromise(function(_0x568a0c,_0x13c9cd){return client['request'](_0x43141a,_0x1cce5c)[_0xc8da('0xa')](function(_0x364170){logger[_0xc8da('0xb')]('UserChatQueue,\x20%s,\x20%s',_0xe4b3b4,_0xc8da('0xc'));logger[_0xc8da('0xd')](_0xc8da('0xe'),_0xe4b3b4,'request\x20sent',JSON['stringify'](_0x364170));if(_0x364170[_0xc8da('0xf')]){if(_0x364170[_0xc8da('0xf')]['code']===0x1f4){logger[_0xc8da('0xf')]('UserChatQueue,\x20%s,\x20%s',_0xe4b3b4,_0x364170['error']['message']);return _0x13c9cd(_0x364170['error'][_0xc8da('0x10')]);}logger[_0xc8da('0xf')](_0xc8da('0x11'),_0xe4b3b4,_0x364170[_0xc8da('0xf')][_0xc8da('0x10')]);return _0x568a0c(_0x364170['error'][_0xc8da('0x10')]);}else{logger[_0xc8da('0xb')](_0xc8da('0x11'),_0xe4b3b4,_0xc8da('0xc'));_0x568a0c(_0x364170[_0xc8da('0x12')][_0xc8da('0x10')]);}})[_0xc8da('0x13')](function(_0x252615){logger['error']('UserChatQueue,\x20%s,\x20%s',_0xe4b3b4,_0x252615);_0x13c9cd(_0x252615);});});} \ No newline at end of file +var _0xf912=['debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','UserChatQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x1b28de,_0xc8f29c){var _0x287080=function(_0x188a98){while(--_0x188a98){_0x1b28de['push'](_0x1b28de['shift']());}};_0x287080(++_0xc8f29c);}(_0xf912,0x142));var _0x2f91=function(_0x12b248,_0x5c70ab){_0x12b248=_0x12b248-0x0;var _0x1f2a48=_0xf912[_0x12b248];return _0x1f2a48;};'use strict';var _=require(_0x2f91('0x0'));var util=require(_0x2f91('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2f91('0x2'));var fs=require('fs');var Redis=require(_0x2f91('0x3'));var db=require(_0x2f91('0x4'))['db'];var utils=require(_0x2f91('0x5'));var logger=require(_0x2f91('0x6'))(_0x2f91('0x7'));var config=require(_0x2f91('0x8'));var jayson=require(_0x2f91('0x9'));var client=jayson[_0x2f91('0xa')][_0x2f91('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6d3f79,_0x162d30,_0x129072){return new BPromise(function(_0x497670,_0x9db7b5){return client['request'](_0x6d3f79,_0x129072)['then'](function(_0x2faeb2){logger['info'](_0x2f91('0xc'),_0x162d30,_0x2f91('0xd'));logger[_0x2f91('0xe')](_0x2f91('0xf'),_0x162d30,_0x2f91('0xd'),JSON[_0x2f91('0x10')](_0x2faeb2));if(_0x2faeb2[_0x2f91('0x11')]){if(_0x2faeb2['error'][_0x2f91('0x12')]===0x1f4){logger[_0x2f91('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x162d30,_0x2faeb2['error']['message']);return _0x9db7b5(_0x2faeb2[_0x2f91('0x11')][_0x2f91('0x13')]);}logger[_0x2f91('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x162d30,_0x2faeb2[_0x2f91('0x11')][_0x2f91('0x13')]);return _0x497670(_0x2faeb2[_0x2f91('0x11')][_0x2f91('0x13')]);}else{logger['info'](_0x2f91('0xc'),_0x162d30,_0x2f91('0xd'));_0x497670(_0x2faeb2[_0x2f91('0x14')][_0x2f91('0x13')]);}})['catch'](function(_0x154959){logger[_0x2f91('0x11')](_0x2f91('0xc'),_0x162d30,_0x154959);_0x9db7b5(_0x154959);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 46d5b6b..94b74fb 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x5b48a9,_0x577cee){var _0x1f07a9=function(_0x2a37c7){while(--_0x2a37c7){_0x5b48a9['push'](_0x5b48a9['shift']());}};_0x1f07a9(++_0x577cee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x16faac,_0x334619){var _0xba07d2=function(_0x1208b4){while(--_0x1208b4){_0x16faac['push'](_0x16faac['shift']());}};_0xba07d2(++_0x334619);}(_0x70e0,0x17b));var _0x070e=function(_0x1ebd54,_0x59ad3a){_0x1ebd54=_0x1ebd54-0x0;var _0x24c853=_0x70e0[_0x1ebd54];return _0x24c853;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 09ea69d..c621b18 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 _0x2ed9=['STRING','sequelize','INTEGER'];(function(_0x4ede39,_0x1c294b){var _0x46d9e1=function(_0x1eb147){while(--_0x1eb147){_0x4ede39['push'](_0x4ede39['shift']());}};_0x46d9e1(++_0x1c294b);}(_0x2ed9,0x1d8));var _0x92ed=function(_0x1d50f2,_0x3c3ec6){_0x1d50f2=_0x1d50f2-0x0;var _0x3769b8=_0x2ed9[_0x1d50f2];return _0x3769b8;};'use strict';var Sequelize=require(_0x92ed('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x92ed('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x92ed('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x92ed('0x2')]}}; \ No newline at end of file +var _0xc39e=['INTEGER','sequelize','exports'];(function(_0x3138de,_0x16b5c0){var _0x2499d4=function(_0x2b7fd7){while(--_0x2b7fd7){_0x3138de['push'](_0x3138de['shift']());}};_0x2499d4(++_0x16b5c0);}(_0xc39e,0x6a));var _0xec39=function(_0x469a3c,_0x5ebc10){_0x469a3c=_0x469a3c-0x0;var _0x968f4=_0xc39e[_0x469a3c];return _0x968f4;};'use strict';var Sequelize=require(_0xec39('0x0'));module[_0xec39('0x1')]={'penalty':{'type':Sequelize[_0xec39('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xec39('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index e2b1a0c..b53897e 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 _0x4d5d=['../../config/logger','api','request-promise','path','rimraf','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util'];(function(_0x874cf1,_0x2a4954){var _0x233579=function(_0xa6e939){while(--_0xa6e939){_0x874cf1['push'](_0x874cf1['shift']());}};_0x233579(++_0x2a4954);}(_0x4d5d,0xf0));var _0xd4d5=function(_0xe33b12,_0x2a9761){_0xe33b12=_0xe33b12-0x0;var _0x30699d=_0x4d5d[_0xe33b12];return _0x30699d;};'use strict';var _=require(_0xd4d5('0x0'));var util=require(_0xd4d5('0x1'));var logger=require(_0xd4d5('0x2'))(_0xd4d5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd4d5('0x4'));var fs=require('fs');var path=require(_0xd4d5('0x5'));var rimraf=require(_0xd4d5('0x6'));var config=require('../../config/environment');var attributes=require('./userFaxQueue.attributes');module[_0xd4d5('0x7')]=function(_0x24849f,_0x4dfa97){return _0x24849f[_0xd4d5('0x8')](_0xd4d5('0x9'),attributes,{'tableName':_0xd4d5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f59=['define','UserFaxQueue','lodash','util','api','moment','request-promise','exports'];(function(_0x521e46,_0x34ca5b){var _0x1cac52=function(_0x62a4c9){while(--_0x62a4c9){_0x521e46['push'](_0x521e46['shift']());}};_0x1cac52(++_0x34ca5b);}(_0x8f59,0xba));var _0x98f5=function(_0x5628a0,_0x1adf2b){_0x5628a0=_0x5628a0-0x0;var _0x12f9a9=_0x8f59[_0x5628a0];return _0x12f9a9;};'use strict';var _=require(_0x98f5('0x0'));var util=require(_0x98f5('0x1'));var logger=require('../../config/logger')(_0x98f5('0x2'));var moment=require(_0x98f5('0x3'));var BPromise=require('bluebird');var rp=require(_0x98f5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userFaxQueue.attributes');module[_0x98f5('0x5')]=function(_0x12f0f0,_0x18c724){return _0x12f0f0[_0x98f5('0x6')](_0x98f5('0x7'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 9dbc3b6..3575833 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 _0xe582=['../../config/logger','rpc','jayson/promise','request','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2056d4,_0x434f26){var _0x4dd331=function(_0x119908){while(--_0x119908){_0x2056d4['push'](_0x2056d4['shift']());}};_0x4dd331(++_0x434f26);}(_0xe582,0x187));var _0x2e58=function(_0x22e003,_0x544b4e){_0x22e003=_0x22e003-0x0;var _0x58178e=_0xe582[_0x22e003];return _0x58178e;};'use strict';var _=require(_0x2e58('0x0'));var util=require(_0x2e58('0x1'));var moment=require(_0x2e58('0x2'));var BPromise=require(_0x2e58('0x3'));var rs=require(_0x2e58('0x4'));var fs=require('fs');var Redis=require(_0x2e58('0x5'));var db=require(_0x2e58('0x6'))['db'];var utils=require(_0x2e58('0x7'));var logger=require(_0x2e58('0x8'))(_0x2e58('0x9'));var config=require('../../config/environment');var jayson=require(_0x2e58('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x47636e,_0x21d3ef,_0x165963){return new BPromise(function(_0x1f4084,_0x103ff4){return client[_0x2e58('0xb')](_0x47636e,_0x165963)['then'](function(_0x4eb627){logger[_0x2e58('0xc')](_0x2e58('0xd'),_0x21d3ef,_0x2e58('0xe'));logger[_0x2e58('0xf')](_0x2e58('0x10'),_0x21d3ef,_0x2e58('0xe'),JSON[_0x2e58('0x11')](_0x4eb627));if(_0x4eb627[_0x2e58('0x12')]){if(_0x4eb627['error']['code']===0x1f4){logger[_0x2e58('0x12')](_0x2e58('0xd'),_0x21d3ef,_0x4eb627[_0x2e58('0x12')][_0x2e58('0x13')]);return _0x103ff4(_0x4eb627[_0x2e58('0x12')][_0x2e58('0x13')]);}logger['error'](_0x2e58('0xd'),_0x21d3ef,_0x4eb627[_0x2e58('0x12')][_0x2e58('0x13')]);return _0x1f4084(_0x4eb627['error'][_0x2e58('0x13')]);}else{logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x21d3ef,_0x2e58('0xe'));_0x1f4084(_0x4eb627[_0x2e58('0x14')][_0x2e58('0x13')]);}})['catch'](function(_0x234c0d){logger[_0x2e58('0x12')](_0x2e58('0xd'),_0x21d3ef,_0x234c0d);_0x103ff4(_0x234c0d);});});} \ No newline at end of file +var _0x73d8=['request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x73d8,0x1ef));var _0x873d=function(_0x3502ba,_0x24bd45){_0x3502ba=_0x3502ba-0x0;var _0x46f52f=_0x73d8[_0x3502ba];return _0x46f52f;};'use strict';var _=require(_0x873d('0x0'));var util=require(_0x873d('0x1'));var moment=require('moment');var BPromise=require(_0x873d('0x2'));var rs=require(_0x873d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x873d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x873d('0x5'))(_0x873d('0x6'));var config=require(_0x873d('0x7'));var jayson=require(_0x873d('0x8'));var client=jayson[_0x873d('0x9')][_0x873d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b55b5,_0x193575,_0x3d548b){return new BPromise(function(_0x300151,_0x551d81){return client[_0x873d('0xb')](_0x5b55b5,_0x3d548b)[_0x873d('0xc')](function(_0x1b577d){logger[_0x873d('0xd')](_0x873d('0xe'),_0x193575,_0x873d('0xf'));logger[_0x873d('0x10')](_0x873d('0x11'),_0x193575,_0x873d('0xf'),JSON[_0x873d('0x12')](_0x1b577d));if(_0x1b577d[_0x873d('0x13')]){if(_0x1b577d[_0x873d('0x13')][_0x873d('0x14')]===0x1f4){logger[_0x873d('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x193575,_0x1b577d['error'][_0x873d('0x15')]);return _0x551d81(_0x1b577d[_0x873d('0x13')][_0x873d('0x15')]);}logger[_0x873d('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x193575,_0x1b577d[_0x873d('0x13')][_0x873d('0x15')]);return _0x300151(_0x1b577d[_0x873d('0x13')][_0x873d('0x15')]);}else{logger[_0x873d('0xd')](_0x873d('0xe'),_0x193575,'request\x20sent');_0x300151(_0x1b577d[_0x873d('0x16')][_0x873d('0x15')]);}})['catch'](function(_0x28bb18){logger[_0x873d('0x13')](_0x873d('0xe'),_0x193575,_0x28bb18);_0x551d81(_0x28bb18);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index fbfac4f..b3649bb 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x507c27,_0x20bcfa){var _0xab74ca=function(_0x25d01a){while(--_0x25d01a){_0x507c27['push'](_0x507c27['shift']());}};_0xab74ca(++_0x20bcfa);}(_0x70e0,0x17b));var _0x070e=function(_0x2370f1,_0x1dcf98){_0x2370f1=_0x2370f1-0x0;var _0x46817a=_0x70e0[_0x2370f1];return _0x46817a;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0xf23b21,_0x5cf018){var _0x4b997b=function(_0x242610){while(--_0x242610){_0xf23b21['push'](_0xf23b21['shift']());}};_0x4b997b(++_0x5cf018);}(_0x70e0,0x17b));var _0x070e=function(_0x481fa7,_0x1ffd91){_0x481fa7=_0x481fa7-0x0;var _0x1fae65=_0x70e0[_0x481fa7];return _0x1fae65;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index a395a9a..ec5b2ae 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 _0x4796=['INTEGER'];(function(_0x3b3639,_0x47b655){var _0x544b76=function(_0x3d3715){while(--_0x3d3715){_0x3b3639['push'](_0x3b3639['shift']());}};_0x544b76(++_0x47b655);}(_0x4796,0x18e));var _0x6479=function(_0x3ad6aa,_0x4da572){_0x3ad6aa=_0x3ad6aa-0x0;var _0x3e5d1d=_0x4796[_0x3ad6aa];return _0x3e5d1d;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x6479('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa26d=['INTEGER','sequelize','exports'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0xa26d,0xc4));var _0xda26=function(_0xb403be,_0x2d9ab0){_0xb403be=_0xb403be-0x0;var _0x3575d5=_0xa26d[_0xb403be];return _0x3575d5;};'use strict';var Sequelize=require(_0xda26('0x0'));module[_0xda26('0x1')]={'penalty':{'type':Sequelize[_0xda26('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 030b9e7..3119170 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 _0xb567=['rimraf','../../config/environment','exports','define','user_has_mail_queues','lodash','../../config/logger','api','moment'];(function(_0x52c7cc,_0x53ae96){var _0x5086ce=function(_0x285479){while(--_0x285479){_0x52c7cc['push'](_0x52c7cc['shift']());}};_0x5086ce(++_0x53ae96);}(_0xb567,0x1ac));var _0x7b56=function(_0x2028b0,_0x2e2c44){_0x2028b0=_0x2028b0-0x0;var _0x2771ea=_0xb567[_0x2028b0];return _0x2771ea;};'use strict';var _=require(_0x7b56('0x0'));var util=require('util');var logger=require(_0x7b56('0x1'))(_0x7b56('0x2'));var moment=require(_0x7b56('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7b56('0x4'));var config=require(_0x7b56('0x5'));var attributes=require('./userMailQueue.attributes');module[_0x7b56('0x6')]=function(_0x46ebf2,_0x2b2563){return _0x46ebf2[_0x7b56('0x7')]('UserMailQueue',attributes,{'tableName':_0x7b56('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x71d0=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','user_has_mail_queues'];(function(_0x1efddd,_0x204fb6){var _0x385447=function(_0x3927a1){while(--_0x3927a1){_0x1efddd['push'](_0x1efddd['shift']());}};_0x385447(++_0x204fb6);}(_0x71d0,0x6c));var _0x071d=function(_0x94f59,_0x2fee93){_0x94f59=_0x94f59-0x0;var _0x5bef8a=_0x71d0[_0x94f59];return _0x5bef8a;};'use strict';var _=require(_0x071d('0x0'));var util=require(_0x071d('0x1'));var logger=require(_0x071d('0x2'))(_0x071d('0x3'));var moment=require('moment');var BPromise=require(_0x071d('0x4'));var rp=require(_0x071d('0x5'));var fs=require('fs');var path=require(_0x071d('0x6'));var rimraf=require(_0x071d('0x7'));var config=require(_0x071d('0x8'));var attributes=require('./userMailQueue.attributes');module[_0x071d('0x9')]=function(_0x346b4a,_0x3ae032){return _0x346b4a[_0x071d('0xa')]('UserMailQueue',attributes,{'tableName':_0x071d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index a3b5ff1..b885784 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 _0x7fbe=['request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\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(_0x283a94,_0x410ea2){var _0x35af76=function(_0x20fdf1){while(--_0x20fdf1){_0x283a94['push'](_0x283a94['shift']());}};_0x35af76(++_0x410ea2);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x309458,_0xba6e63){_0x309458=_0x309458-0x0;var _0x3306ee=_0x7fbe[_0x309458];return _0x3306ee;};'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 _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x588d1e,_0xcfa3f0){var _0x2f5bc6=function(_0x441640){while(--_0x441640){_0x588d1e['push'](_0x588d1e['shift']());}};_0x2f5bc6(++_0xcfa3f0);}(_0x34e8,0x12c));var _0x834e=function(_0x50c89f,_0xe3451d){_0x50c89f=_0x50c89f-0x0;var _0x9b2fa7=_0x34e8[_0x50c89f];return _0x9b2fa7;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index baf3da9..24b7cac 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 _0x1678=['exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','post','sendUserNotification'];(function(_0x30bd4d,_0x50eb60){var _0x306915=function(_0x5ae782){while(--_0x5ae782){_0x30bd4d['push'](_0x30bd4d['shift']());}};_0x306915(++_0x50eb60);}(_0x1678,0xfb));var _0x8167=function(_0x18267e,_0x17d9ff){_0x18267e=_0x18267e-0x0;var _0x288a1d=_0x1678[_0x18267e];return _0x288a1d;};'use strict';var multer=require(_0x8167('0x0'));var util=require(_0x8167('0x1'));var path=require(_0x8167('0x2'));var timeout=require('connect-timeout');var express=require(_0x8167('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8167('0x4'));var interaction=require(_0x8167('0x5'));var config=require(_0x8167('0x6'));var controller=require('./userNotification.controller');router[_0x8167('0x7')]('/',auth['isAuthenticated'](),controller[_0x8167('0x8')]);module[_0x8167('0x9')]=router; \ No newline at end of file +var _0x754a=['post','isAuthenticated','sendUserNotification','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller'];(function(_0x1b3a09,_0x20c774){var _0x357bb8=function(_0xd7c6d2){while(--_0xd7c6d2){_0x1b3a09['push'](_0x1b3a09['shift']());}};_0x357bb8(++_0x20c774);}(_0x754a,0x1c6));var _0xa754=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0x754a[_0xd09668];return _0x68726;};'use strict';var multer=require(_0xa754('0x0'));var util=require(_0xa754('0x1'));var path=require(_0xa754('0x2'));var timeout=require(_0xa754('0x3'));var express=require(_0xa754('0x4'));var router=express[_0xa754('0x5')]();var fs_extra=require(_0xa754('0x6'));var auth=require(_0xa754('0x7'));var interaction=require(_0xa754('0x8'));var config=require(_0xa754('0x9'));var controller=require(_0xa754('0xa'));router[_0xa754('0xb')]('/',auth[_0xa754('0xc')](),controller[_0xa754('0xd')]);module[_0xa754('0xe')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 22fe34d..4bd9f2e 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 _0x6e12=['sequelize','exports','TEXT'];(function(_0x3cfc46,_0xd66864){var _0x2ec35d=function(_0x4f9783){while(--_0x4f9783){_0x3cfc46['push'](_0x3cfc46['shift']());}};_0x2ec35d(++_0xd66864);}(_0x6e12,0x72));var _0x26e1=function(_0x5ae985,_0x52be1c){_0x5ae985=_0x5ae985-0x0;var _0xeb06ae=_0x6e12[_0x5ae985];return _0xeb06ae;};'use strict';var Sequelize=require(_0x26e1('0x0'));module[_0x26e1('0x1')]={'body':{'type':Sequelize[_0x26e1('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x26e1('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0x4619=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x271a80,_0x268bac){var _0xf8233e=function(_0x825987){while(--_0x825987){_0x271a80['push'](_0x271a80['shift']());}};_0xf8233e(++_0x268bac);}(_0x4619,0xf3));var _0x9461=function(_0x36c888,_0x6e5847){_0x36c888=_0x36c888-0x0;var _0x488fcd=_0x4619[_0x36c888];return _0x488fcd;};'use strict';var Sequelize=require(_0x9461('0x0'));module[_0x9461('0x1')]={'body':{'type':Sequelize[_0x9461('0x2')]},'senderName':{'type':Sequelize[_0x9461('0x3')]},'recipientsId':{'type':Sequelize[_0x9461('0x2')]},'recipientsDescription':{'type':Sequelize[_0x9461('0x3')]},'beep':{'type':Sequelize[_0x9461('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 03e7922..71e5421 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 _0x21ea=['User','ids','queue','replace','Queue','push','all','flatten','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','./userNotification.socket','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','save','then','destroy','sendStatus','stack','name','send','sendUserNotification','text','TemplateId','Sequelize','ValidationError','body','hasOwnProperty','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sequelize','transaction','UserNotification','forEach','recipient','emit','userNotification:send','catch','Template','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase'];(function(_0x26034c,_0x251444){var _0x1862db=function(_0x3f5497){while(--_0x3f5497){_0x26034c['push'](_0x26034c['shift']());}};_0x1862db(++_0x251444);}(_0x21ea,0x1a1));var _0xa21e=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x21ea[_0x55e08b];return _0xd1a7ff;};'use strict';var emlformat=require(_0xa21e('0x0'));var rimraf=require(_0xa21e('0x1'));var zipdir=require(_0xa21e('0x2'));var jsonpatch=require(_0xa21e('0x3'));var rp=require(_0xa21e('0x4'));var moment=require('moment');var BPromise=require(_0xa21e('0x5'));var Mustache=require(_0xa21e('0x6'));var util=require(_0xa21e('0x7'));var path=require(_0xa21e('0x8'));var sox=require('sox');var csv=require(_0xa21e('0x9'));var ejs=require(_0xa21e('0xa'));var fs=require('fs');var fs_extra=require(_0xa21e('0xb'));var _=require('lodash');var squel=require(_0xa21e('0xc'));var crypto=require(_0xa21e('0xd'));var jsforce=require(_0xa21e('0xe'));var deskjs=require(_0xa21e('0xf'));var toCsv=require(_0xa21e('0x9'));var querystring=require(_0xa21e('0x10'));var Papa=require(_0xa21e('0x11'));var Redis=require(_0xa21e('0x12'));var authService=require(_0xa21e('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa21e('0x14'));var hardwareService=require(_0xa21e('0x15'));var logger=require(_0xa21e('0x16'))(_0xa21e('0x17'));var utils=require('../../config/utils');var config=require(_0xa21e('0x18'));var licenseUtil=require(_0xa21e('0x19'));var db=require('../../mysqldb')['db'];config[_0xa21e('0x1a')]=_[_0xa21e('0x1b')](config[_0xa21e('0x1a')],{'host':_0xa21e('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa21e('0x1a')]));require(_0xa21e('0x1d'))['register'](socket);function respondWithStatusCode(_0x1f8c86,_0x5d2402){_0x5d2402=_0x5d2402||0xcc;return function(_0x1e7929){if(_0x1e7929){return _0x1f8c86['sendStatus'](_0x5d2402);}return _0x1f8c86[_0xa21e('0x1e')](_0x5d2402)[_0xa21e('0x1f')]();};}function respondWithResult(_0x344f32,_0x5f289d){_0x5f289d=_0x5f289d||0xc8;return function(_0x330a61){if(_0x330a61){return _0x344f32[_0xa21e('0x1e')](_0x5f289d)['json'](_0x330a61);}};}function respondWithFilteredResult(_0x4c8e61,_0x4e4b55){return function(_0x423a5c){if(_0x423a5c){var _0x4f7ad8=typeof _0x4e4b55['offset']===_0xa21e('0x20')&&typeof _0x4e4b55['limit']==='undefined';var _0x375417=_0x423a5c[_0xa21e('0x21')];var _0x1bbf8=_0x4f7ad8?0x0:_0x4e4b55[_0xa21e('0x22')];var _0x3b0edb=_0x4f7ad8?_0x423a5c['count']:_0x4e4b55[_0xa21e('0x22')]+_0x4e4b55[_0xa21e('0x23')];var _0x913c7d;if(_0x3b0edb>=_0x375417){_0x3b0edb=_0x375417;_0x913c7d=0xc8;}else{_0x913c7d=0xce;}_0x4c8e61['status'](_0x913c7d);return _0x4c8e61[_0xa21e('0x24')](_0xa21e('0x25'),_0x1bbf8+'-'+_0x3b0edb+'/'+_0x375417)[_0xa21e('0x26')](_0x423a5c);}return null;};}function patchUpdates(_0x21b8fa){return function(_0x8a1687){try{jsonpatch[_0xa21e('0x27')](_0x8a1687,_0x21b8fa,!![]);}catch(_0x13fa55){return BPromise['reject'](_0x13fa55);}return _0x8a1687[_0xa21e('0x28')]();};}function saveUpdates(_0x3daa17,_0x3077ac){return function(_0x52ccb6){if(_0x52ccb6){return _0x52ccb6['update'](_0x3daa17)[_0xa21e('0x29')](function(_0x2ded07){return _0x2ded07;});}return null;};}function removeEntity(_0x4c2096,_0x5e2a5a){return function(_0x54f691){if(_0x54f691){return _0x54f691[_0xa21e('0x2a')]()[_0xa21e('0x29')](function(){_0x4c2096['status'](0xcc)[_0xa21e('0x1f')]();});}};}function handleEntityNotFound(_0x4dfc79,_0x52ac59){return function(_0x4f6925){if(!_0x4f6925){_0x4dfc79[_0xa21e('0x2b')](0x194);}return _0x4f6925;};}function handleError(_0x4f95cc,_0x76a1ee){_0x76a1ee=_0x76a1ee||0x1f4;return function(_0xde9161){logger['error'](_0xde9161[_0xa21e('0x2c')]);if(_0xde9161[_0xa21e('0x2d')]){delete _0xde9161[_0xa21e('0x2d')];}_0x4f95cc[_0xa21e('0x1e')](_0x76a1ee)[_0xa21e('0x2e')](_0xde9161);};}exports[_0xa21e('0x2f')]=function(_0xd94451,_0x2cec56,_0x440de2){if(!_0xd94451['body']['hasOwnProperty'](_0xa21e('0x30'))&&!_0xd94451['body']['hasOwnProperty'](_0xa21e('0x31'))){throw new db[(_0xa21e('0x32'))][(_0xa21e('0x33'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0xd94451[_0xa21e('0x34')][_0xa21e('0x35')](_0xa21e('0x31'))&&!_0xd94451[_0xa21e('0x34')]['hasOwnProperty'](_0xa21e('0x36'))){throw new db[(_0xa21e('0x32'))][(_0xa21e('0x33'))](_0xa21e('0x37'));}if(!_0xd94451[_0xa21e('0x34')]['hasOwnProperty'](_0xa21e('0x38'))){throw new db['Sequelize'][(_0xa21e('0x33'))](_0xa21e('0x39'));}else{try{var _0x9df500=JSON[_0xa21e('0x3a')](_0xd94451['body'][_0xa21e('0x38')]);}catch(_0x425a7a){logger[_0xa21e('0x3b')](_0x425a7a);throw new db[(_0xa21e('0x32'))]['ValidationError'](_0xa21e('0x3c'));}var _0x58e190=[_0xa21e('0x3d'),_0xa21e('0x3e'),_0xa21e('0x3f'),_0xa21e('0x40'),_0xa21e('0x41'),_0xa21e('0x42'),_0xa21e('0x43'),_0xa21e('0x44'),_0xa21e('0x45')];if(_['some'](_0x9df500,function(_0x39e9a3){return!_[_0xa21e('0x46')](_0x58e190,_0x39e9a3[_0xa21e('0x47')]['toLowerCase']());})){throw new db[(_0xa21e('0x32'))][(_0xa21e('0x33'))](_0xa21e('0x48'));}}}var _0x52eb31={};_0x52eb31[_0xa21e('0x49')]=_0xd94451['body'][_0xa21e('0x35')](_0xa21e('0x49'))?_0xd94451[_0xa21e('0x34')]['senderName']:_0xd94451[_0xa21e('0x45')][_0xa21e('0x4a')];_0x52eb31[_0xa21e('0x4b')]=_[_0xa21e('0x4c')](_0xd94451[_0xa21e('0x34')]['recipientsDescription'])?null:_0xd94451['body'][_0xa21e('0x4b')];_0x52eb31[_0xa21e('0x4d')]=_0xd94451[_0xa21e('0x34')][_0xa21e('0x4d')]||![];_0x52eb31[_0xa21e('0x4e')]=_0xd94451[_0xa21e('0x45')]['id'];return getContent(_0xd94451[_0xa21e('0x34')])['then'](function(_0x4b8ead){_0x52eb31[_0xa21e('0x34')]=_0x4b8ead;return getRecipients(_0x9df500);})[_0xa21e('0x29')](function(_0x1aa7de){_0x52eb31[_0xa21e('0x4f')]=_['sortBy'](_0x1aa7de)['join'](',');return db[_0xa21e('0x50')][_0xa21e('0x51')](function(_0x3a12ac){return db[_0xa21e('0x52')]['create'](_0x52eb31,{'raw':!![],'transaction':_0x3a12ac})[_0xa21e('0x29')](function(_0x1df5d6){var _0x318612={'sender':_0x52eb31[_0xa21e('0x49')],'description':_0x52eb31[_0xa21e('0x4b')],'content':_0x52eb31[_0xa21e('0x34')],'beep':_0x52eb31[_0xa21e('0x4d')]};_0x1aa7de[_0xa21e('0x53')](function(_0x30680f){_0x318612[_0xa21e('0x54')]=_0x30680f;socket[_0xa21e('0x55')](_0xa21e('0x56'),_0x318612);});return _0x1df5d6;});});})['then'](respondWithResult(_0x2cec56,0xc9))[_0xa21e('0x57')](handleError(_0x2cec56,null));};function getContent(_0x493e4c){return new BPromise(function(_0x4a3593,_0x1dc9ff){if(_0x493e4c[_0xa21e('0x30')]){_0x4a3593(_0x493e4c[_0xa21e('0x30')]);return;}return db[_0xa21e('0x58')]['findOne']({'attributes':[_0xa21e('0x59')],'where':{'id':_0x493e4c[_0xa21e('0x31')]},'raw':!![]})['then'](function(_0x2eb9b2){if(!_0x2eb9b2)throw new db['Sequelize'][(_0xa21e('0x33'))](_0xa21e('0x5a'));var _0x26a727=Mustache[_0xa21e('0x5b')](_0x2eb9b2[_0xa21e('0x59')],_0x493e4c[_0xa21e('0x36')]);_0x4a3593(_0x26a727);})[_0xa21e('0x57')](function(_0x5791cd){_0x1dc9ff(_0x5791cd);});});}function getRecipients(_0x2b6077){return new BPromise(function(_0x3be771,_0x4d395d){var _0x17002f=[];var _0x30fd03=[];_0x2b6077[_0xa21e('0x53')](function(_0x369fc9){var _0x279168=_[_0xa21e('0x5c')](_0x369fc9[_0xa21e('0x47')]['toLowerCase']());if(_0x279168===_0xa21e('0x5d')){_0x17002f=_['union'](_0x17002f,_0x369fc9[_0xa21e('0x5e')]);}else{if(_[_0xa21e('0x46')](_0x279168,_0xa21e('0x5f')))_0x279168=_0x279168[_0xa21e('0x60')](_0xa21e('0x5f'),_0xa21e('0x61'));_0x369fc9['ids'][_0xa21e('0x53')](function(_0x5c5923){_0x30fd03[_0xa21e('0x62')](getAgents(_0x279168,_0x5c5923));});}});return BPromise[_0xa21e('0x63')](_0x30fd03)[_0xa21e('0x29')](function(_0x5ddc11){_0x17002f=_['union'](_0x17002f,_[_0xa21e('0x64')](_0x5ddc11));_0x3be771(_0x17002f);})[_0xa21e('0x57')](function(_0x3d2435){_0x4d395d(_0x3d2435);});});}function getAgents(_0x1c569b,_0x131140){return new BPromise(function(_0x14dda2,_0x1b852c){return db[_0x1c569b][_0xa21e('0x65')]({'where':{'id':_0x131140}})['then'](function(_0x144da9){return _0x144da9['getAgents']({'attributes':['id'],'raw':!![]})[_0xa21e('0x29')](function(_0x11a39d){var _0x503211=_['map'](_0x11a39d,'id');_0x14dda2(_0x503211);});})['catch'](function(_0x35f776){_0x1b852c(_0x35f776);});});} \ No newline at end of file +var _0xaf21=['ejs','fs-extra','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','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','stack','name','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27recipients\x27\x20parameter','parse','error','Invalid\x20\x27recipients\x27\x20object','faxqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','join','sequelize','create','userNotification:send','catch','Template','html','render','forEach','startCase','User','union','queue','Queue','ids','push','all','findOne','getAgents','map','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv'];(function(_0x4c9191,_0xe10c76){var _0x593642=function(_0x11e43b){while(--_0x11e43b){_0x4c9191['push'](_0x4c9191['shift']());}};_0x593642(++_0xe10c76);}(_0xaf21,0x11a));var _0x1af2=function(_0x10c895,_0x762ef6){_0x10c895=_0x10c895-0x0;var _0x34484c=_0xaf21[_0x10c895];return _0x34484c;};'use strict';var emlformat=require(_0x1af2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1af2('0x1'));var jsonpatch=require(_0x1af2('0x2'));var rp=require(_0x1af2('0x3'));var moment=require(_0x1af2('0x4'));var BPromise=require(_0x1af2('0x5'));var Mustache=require(_0x1af2('0x6'));var util=require(_0x1af2('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x1af2('0x8'));var ejs=require(_0x1af2('0x9'));var fs=require('fs');var fs_extra=require(_0x1af2('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1af2('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1af2('0xc'));var toCsv=require(_0x1af2('0x8'));var querystring=require(_0x1af2('0xd'));var Papa=require(_0x1af2('0xe'));var Redis=require(_0x1af2('0xf'));var authService=require(_0x1af2('0x10'));var qs=require(_0x1af2('0x11'));var as=require(_0x1af2('0x12'));var hardwareService=require(_0x1af2('0x13'));var logger=require(_0x1af2('0x14'))(_0x1af2('0x15'));var utils=require(_0x1af2('0x16'));var config=require(_0x1af2('0x17'));var licenseUtil=require(_0x1af2('0x18'));var db=require('../../mysqldb')['db'];config[_0x1af2('0x19')]=_[_0x1af2('0x1a')](config[_0x1af2('0x19')],{'host':_0x1af2('0x1b'),'port':0x18eb});var socket=require(_0x1af2('0x1c'))(new Redis(config[_0x1af2('0x19')]));require(_0x1af2('0x1d'))[_0x1af2('0x1e')](socket);function respondWithStatusCode(_0x1785fa,_0x1ac365){_0x1ac365=_0x1ac365||0xcc;return function(_0x1972cb){if(_0x1972cb){return _0x1785fa[_0x1af2('0x1f')](_0x1ac365);}return _0x1785fa['status'](_0x1ac365)['end']();};}function respondWithResult(_0x1f6158,_0x2e09b3){_0x2e09b3=_0x2e09b3||0xc8;return function(_0x37e0b5){if(_0x37e0b5){return _0x1f6158[_0x1af2('0x20')](_0x2e09b3)[_0x1af2('0x21')](_0x37e0b5);}};}function respondWithFilteredResult(_0x1a9a77,_0x424d43){return function(_0x3767c3){if(_0x3767c3){var _0x48b181=typeof _0x424d43[_0x1af2('0x22')]===_0x1af2('0x23')&&typeof _0x424d43[_0x1af2('0x24')]===_0x1af2('0x23');var _0x313abd=_0x3767c3[_0x1af2('0x25')];var _0x7e2746=_0x48b181?0x0:_0x424d43[_0x1af2('0x22')];var _0x2ce5b7=_0x48b181?_0x3767c3[_0x1af2('0x25')]:_0x424d43[_0x1af2('0x22')]+_0x424d43['limit'];var _0x2dd5ab;if(_0x2ce5b7>=_0x313abd){_0x2ce5b7=_0x313abd;_0x2dd5ab=0xc8;}else{_0x2dd5ab=0xce;}_0x1a9a77['status'](_0x2dd5ab);return _0x1a9a77['set'](_0x1af2('0x26'),_0x7e2746+'-'+_0x2ce5b7+'/'+_0x313abd)[_0x1af2('0x21')](_0x3767c3);}return null;};}function patchUpdates(_0x135c37){return function(_0x44220b){try{jsonpatch[_0x1af2('0x27')](_0x44220b,_0x135c37,!![]);}catch(_0x56ae95){return BPromise[_0x1af2('0x28')](_0x56ae95);}return _0x44220b[_0x1af2('0x29')]();};}function saveUpdates(_0x2f20a9,_0x4485ee){return function(_0x3b8a19){if(_0x3b8a19){return _0x3b8a19['update'](_0x2f20a9)[_0x1af2('0x2a')](function(_0x23ecef){return _0x23ecef;});}return null;};}function removeEntity(_0x59ea15,_0x1c1cbc){return function(_0x146beb){if(_0x146beb){return _0x146beb[_0x1af2('0x2b')]()[_0x1af2('0x2a')](function(){_0x59ea15[_0x1af2('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6831b0,_0x9d318e){return function(_0x2f654e){if(!_0x2f654e){_0x6831b0[_0x1af2('0x1f')](0x194);}return _0x2f654e;};}function handleError(_0x146edb,_0x558433){_0x558433=_0x558433||0x1f4;return function(_0x2ae240){logger['error'](_0x2ae240[_0x1af2('0x2c')]);if(_0x2ae240[_0x1af2('0x2d')]){delete _0x2ae240[_0x1af2('0x2d')];}_0x146edb['status'](_0x558433)['send'](_0x2ae240);};}exports[_0x1af2('0x2e')]=function(_0x58812a,_0x2d88c5,_0x2195fa){if(!_0x58812a[_0x1af2('0x2f')][_0x1af2('0x30')](_0x1af2('0x31'))&&!_0x58812a[_0x1af2('0x2f')][_0x1af2('0x30')](_0x1af2('0x32'))){throw new db[(_0x1af2('0x33'))][(_0x1af2('0x34'))](_0x1af2('0x35'));}else{if(_0x58812a['body'][_0x1af2('0x30')](_0x1af2('0x32'))&&!_0x58812a[_0x1af2('0x2f')][_0x1af2('0x30')](_0x1af2('0x36'))){throw new db[(_0x1af2('0x33'))][(_0x1af2('0x34'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x58812a[_0x1af2('0x2f')][_0x1af2('0x30')]('recipients')){throw new db['Sequelize'][(_0x1af2('0x34'))](_0x1af2('0x37'));}else{try{var _0x5c78a1=JSON[_0x1af2('0x38')](_0x58812a['body']['recipients']);}catch(_0xcda234){logger[_0x1af2('0x39')](_0xcda234);throw new db[(_0x1af2('0x33'))]['ValidationError'](_0x1af2('0x3a'));}var _0x573402=['chatqueue',_0x1af2('0x3b'),'mailqueue',_0x1af2('0x3c'),_0x1af2('0x3d'),_0x1af2('0x3e'),_0x1af2('0x3f'),_0x1af2('0x40'),_0x1af2('0x41')];if(_[_0x1af2('0x42')](_0x5c78a1,function(_0x53e61c){return!_['includes'](_0x573402,_0x53e61c[_0x1af2('0x43')][_0x1af2('0x44')]());})){throw new db[(_0x1af2('0x33'))][(_0x1af2('0x34'))](_0x1af2('0x45'));}}}var _0x1fff93={};_0x1fff93[_0x1af2('0x46')]=_0x58812a['body']['hasOwnProperty'](_0x1af2('0x46'))?_0x58812a['body'][_0x1af2('0x46')]:_0x58812a[_0x1af2('0x41')][_0x1af2('0x47')];_0x1fff93[_0x1af2('0x48')]=_[_0x1af2('0x49')](_0x58812a[_0x1af2('0x2f')][_0x1af2('0x48')])?null:_0x58812a[_0x1af2('0x2f')][_0x1af2('0x48')];_0x1fff93[_0x1af2('0x4a')]=_0x58812a['body'][_0x1af2('0x4a')]||![];_0x1fff93[_0x1af2('0x4b')]=_0x58812a[_0x1af2('0x41')]['id'];return getContent(_0x58812a[_0x1af2('0x2f')])[_0x1af2('0x2a')](function(_0x9de364){_0x1fff93[_0x1af2('0x2f')]=_0x9de364;return getRecipients(_0x5c78a1);})[_0x1af2('0x2a')](function(_0x4aeef9){_0x1fff93[_0x1af2('0x4c')]=_['sortBy'](_0x4aeef9)[_0x1af2('0x4d')](',');return db[_0x1af2('0x4e')]['transaction'](function(_0x5823c5){return db['UserNotification'][_0x1af2('0x4f')](_0x1fff93,{'raw':!![],'transaction':_0x5823c5})[_0x1af2('0x2a')](function(_0x303ad3){var _0x306058={'sender':_0x1fff93['senderName'],'description':_0x1fff93[_0x1af2('0x48')],'content':_0x1fff93[_0x1af2('0x2f')],'beep':_0x1fff93['beep']};_0x4aeef9['forEach'](function(_0x1ae127){_0x306058['recipient']=_0x1ae127;socket['emit'](_0x1af2('0x50'),_0x306058);});return _0x303ad3;});});})[_0x1af2('0x2a')](respondWithResult(_0x2d88c5,0xc9))[_0x1af2('0x51')](handleError(_0x2d88c5,null));};function getContent(_0x35905e){return new BPromise(function(_0x5d9817,_0x2f1545){if(_0x35905e['text']){_0x5d9817(_0x35905e[_0x1af2('0x31')]);return;}return db[_0x1af2('0x52')]['findOne']({'attributes':[_0x1af2('0x53')],'where':{'id':_0x35905e[_0x1af2('0x32')]},'raw':!![]})[_0x1af2('0x2a')](function(_0x5cf2f6){if(!_0x5cf2f6)throw new db[(_0x1af2('0x33'))]['ValidationError']('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x3f70da=Mustache[_0x1af2('0x54')](_0x5cf2f6[_0x1af2('0x53')],_0x35905e[_0x1af2('0x36')]);_0x5d9817(_0x3f70da);})['catch'](function(_0x4b260d){_0x2f1545(_0x4b260d);});});}function getRecipients(_0x29d952){return new BPromise(function(_0x506de4,_0x4b95ac){var _0x458b77=[];var _0x402f3c=[];_0x29d952[_0x1af2('0x55')](function(_0x3f583c){var _0x511246=_[_0x1af2('0x56')](_0x3f583c[_0x1af2('0x43')][_0x1af2('0x44')]());if(_0x511246===_0x1af2('0x57')){_0x458b77=_[_0x1af2('0x58')](_0x458b77,_0x3f583c['ids']);}else{if(_['includes'](_0x511246,_0x1af2('0x59')))_0x511246=_0x511246['replace'](_0x1af2('0x59'),_0x1af2('0x5a'));_0x3f583c[_0x1af2('0x5b')][_0x1af2('0x55')](function(_0x25f41e){_0x402f3c[_0x1af2('0x5c')](getAgents(_0x511246,_0x25f41e));});}});return BPromise[_0x1af2('0x5d')](_0x402f3c)['then'](function(_0x28e045){_0x458b77=_[_0x1af2('0x58')](_0x458b77,_['flatten'](_0x28e045));_0x506de4(_0x458b77);})[_0x1af2('0x51')](function(_0x1a5c62){_0x4b95ac(_0x1a5c62);});});}function getAgents(_0x94b899,_0x39569d){return new BPromise(function(_0x296dc3,_0x4c34ef){return db[_0x94b899][_0x1af2('0x5e')]({'where':{'id':_0x39569d}})['then'](function(_0x5618ce){return _0x5618ce[_0x1af2('0x5f')]({'attributes':['id'],'raw':!![]})[_0x1af2('0x2a')](function(_0x39dc68){var _0x504f3c=_[_0x1af2('0x60')](_0x39dc68,'id');_0x296dc3(_0x504f3c);});})[_0x1af2('0x51')](function(_0x2a854f){_0x4c34ef(_0x2a854f);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 5ebb152..318a32d 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 _0x1ccc=['events','../../mysqldb','UserNotification','setMaxListeners','save','remove','emit','hasOwnProperty','exports'];(function(_0x250493,_0x269ffe){var _0x2a86a8=function(_0x4dc220){while(--_0x4dc220){_0x250493['push'](_0x250493['shift']());}};_0x2a86a8(++_0x269ffe);}(_0x1ccc,0x144));var _0xc1cc=function(_0x154192,_0x2d360f){_0x154192=_0x154192-0x0;var _0x3c2792=_0x1ccc[_0x154192];return _0x3c2792;};'use strict';var EventEmitter=require(_0xc1cc('0x0'));var UserNotification=require(_0xc1cc('0x1'))['db'][_0xc1cc('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xc1cc('0x3')](0x0);var events={'afterCreate':_0xc1cc('0x4'),'afterUpdate':'update','afterDestroy':_0xc1cc('0x5')};function emitEvent(_0x17dec3){return function(_0x435d2e,_0x5d4e45,_0x6a926f){UserNotificationEvents['emit'](_0x17dec3+':'+_0x435d2e['id'],_0x435d2e);UserNotificationEvents[_0xc1cc('0x6')](_0x17dec3,_0x435d2e);_0x6a926f(null);};}for(var e in events){if(events[_0xc1cc('0x7')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0xc1cc('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0x3efd=['save','update','remove','emit','hook','exports','events','UserNotification','setMaxListeners'];(function(_0x83487c,_0x1104d8){var _0x25ce18=function(_0x5814dd){while(--_0x5814dd){_0x83487c['push'](_0x83487c['shift']());}};_0x25ce18(++_0x1104d8);}(_0x3efd,0x10b));var _0xd3ef=function(_0x7105eb,_0x5a4150){_0x7105eb=_0x7105eb-0x0;var _0x47d89b=_0x3efd[_0x7105eb];return _0x47d89b;};'use strict';var EventEmitter=require(_0xd3ef('0x0'));var UserNotification=require('../../mysqldb')['db'][_0xd3ef('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xd3ef('0x2')](0x0);var events={'afterCreate':_0xd3ef('0x3'),'afterUpdate':_0xd3ef('0x4'),'afterDestroy':_0xd3ef('0x5')};function emitEvent(_0x31208f){return function(_0x2e6db6,_0x3bfc0b,_0x21696e){UserNotificationEvents[_0xd3ef('0x6')](_0x31208f+':'+_0x2e6db6['id'],_0x2e6db6);UserNotificationEvents[_0xd3ef('0x6')](_0x31208f,_0x2e6db6);_0x21696e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0xd3ef('0x7')](e,emitEvent(event));}}module[_0xd3ef('0x8')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index b5d0b25..0a7ce7d 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 _0x4ddf=['request-promise','path','rimraf','../../config/environment','exports','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x501732,_0x53aaa0){var _0x588ae8=function(_0x2ad1fd){while(--_0x2ad1fd){_0x501732['push'](_0x501732['shift']());}};_0x588ae8(++_0x53aaa0);}(_0x4ddf,0x9f));var _0xf4dd=function(_0x4c9bd1,_0x3d528d){_0x4c9bd1=_0x4c9bd1-0x0;var _0x2a5696=_0x4ddf[_0x4c9bd1];return _0x2a5696;};'use strict';var _=require(_0xf4dd('0x0'));var util=require(_0xf4dd('0x1'));var logger=require(_0xf4dd('0x2'))(_0xf4dd('0x3'));var moment=require(_0xf4dd('0x4'));var BPromise=require(_0xf4dd('0x5'));var rp=require(_0xf4dd('0x6'));var fs=require('fs');var path=require(_0xf4dd('0x7'));var rimraf=require(_0xf4dd('0x8'));var config=require(_0xf4dd('0x9'));var attributes=require('./userNotification.attributes');module[_0xf4dd('0xa')]=function(_0x451018,_0x4ab30a){return _0x451018['define'](_0xf4dd('0xb'),attributes,{'tableName':_0xf4dd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf4dd('0xd'),'collate':_0xf4dd('0xe')});}; \ No newline at end of file +var _0x4565=['request-promise','path','rimraf','../../config/environment','exports','define','UserNotification','utf8mb4','lodash','util','bluebird'];(function(_0x3b82a1,_0x41df30){var _0x36425d=function(_0x25a5f1){while(--_0x25a5f1){_0x3b82a1['push'](_0x3b82a1['shift']());}};_0x36425d(++_0x41df30);}(_0x4565,0x147));var _0x5456=function(_0x3710f1,_0x4d55cf){_0x3710f1=_0x3710f1-0x0;var _0x1ef269=_0x4565[_0x3710f1];return _0x1ef269;};'use strict';var _=require(_0x5456('0x0'));var util=require(_0x5456('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x5456('0x2'));var rp=require(_0x5456('0x3'));var fs=require('fs');var path=require(_0x5456('0x4'));var rimraf=require(_0x5456('0x5'));var config=require(_0x5456('0x6'));var attributes=require('./userNotification.attributes');module[_0x5456('0x7')]=function(_0x3219e5,_0x5410e5){return _0x3219e5[_0x5456('0x8')](_0x5456('0x9'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5456('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index ab17318..821f5f1 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 _0x18ed=['stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s'];(function(_0x40015e,_0x1cc77b){var _0x21598e=function(_0x4dcc39){while(--_0x4dcc39){_0x40015e['push'](_0x40015e['shift']());}};_0x21598e(++_0x1cc77b);}(_0x18ed,0x17f));var _0xd18e=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x18ed[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xd18e('0x0'));var util=require(_0xd18e('0x1'));var moment=require(_0xd18e('0x2'));var BPromise=require(_0xd18e('0x3'));var rs=require(_0xd18e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd18e('0x5'))['db'];var utils=require(_0xd18e('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xd18e('0x7'));var jayson=require(_0xd18e('0x8'));var client=jayson[_0xd18e('0x9')][_0xd18e('0xa')]({'port':0x232a});config[_0xd18e('0xb')]=_[_0xd18e('0xc')](config['redis'],{'host':_0xd18e('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd18e('0xb')]));require(_0xd18e('0xe'))[_0xd18e('0xf')](socket);function respondWithRpcPromise(_0x1096c6,_0x264c05,_0x55a4f2){return new BPromise(function(_0x536e1e,_0x1d373a){return client[_0xd18e('0x10')](_0x1096c6,_0x55a4f2)[_0xd18e('0x11')](function(_0x50893f){logger[_0xd18e('0x12')](_0xd18e('0x13'),_0x264c05,_0xd18e('0x14'));logger['debug'](_0xd18e('0x15'),_0x264c05,_0xd18e('0x14'),JSON[_0xd18e('0x16')](_0x50893f));if(_0x50893f[_0xd18e('0x17')]){if(_0x50893f[_0xd18e('0x17')]['code']===0x1f4){logger[_0xd18e('0x17')](_0xd18e('0x13'),_0x264c05,_0x50893f[_0xd18e('0x17')]['message']);return _0x1d373a(_0x50893f[_0xd18e('0x17')]['message']);}logger[_0xd18e('0x17')](_0xd18e('0x13'),_0x264c05,_0x50893f['error'][_0xd18e('0x18')]);return _0x536e1e(_0x50893f['error']['message']);}else{logger[_0xd18e('0x12')](_0xd18e('0x13'),_0x264c05,'request\x20sent');_0x536e1e(_0x50893f[_0xd18e('0x19')][_0xd18e('0x18')]);}})[_0xd18e('0x1a')](function(_0x83ca67){logger[_0xd18e('0x17')](_0xd18e('0x13'),_0x264c05,_0x83ca67);_0x1d373a(_0x83ca67);});});} \ No newline at end of file +var _0x1988=['./userNotification.socket','register','request','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter'];(function(_0xc8797e,_0x313567){var _0xda950b=function(_0x39a69e){while(--_0x39a69e){_0xc8797e['push'](_0xc8797e['shift']());}};_0xda950b(++_0x313567);}(_0x1988,0x1f2));var _0x8198=function(_0x55506e,_0x193876){_0x55506e=_0x55506e-0x0;var _0x4dca86=_0x1988[_0x55506e];return _0x4dca86;};'use strict';var _=require(_0x8198('0x0'));var util=require(_0x8198('0x1'));var moment=require(_0x8198('0x2'));var BPromise=require(_0x8198('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8198('0x4'));var db=require(_0x8198('0x5'))['db'];var utils=require(_0x8198('0x6'));var logger=require('../../config/logger')(_0x8198('0x7'));var config=require(_0x8198('0x8'));var jayson=require(_0x8198('0x9'));var client=jayson[_0x8198('0xa')][_0x8198('0xb')]({'port':0x232a});config['redis']=_[_0x8198('0xc')](config[_0x8198('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x8198('0xe'))(new Redis(config[_0x8198('0xd')]));require(_0x8198('0xf'))[_0x8198('0x10')](socket);function respondWithRpcPromise(_0x58740e,_0x17db5c,_0x23624a){return new BPromise(function(_0x13f055,_0x50c0bc){return client[_0x8198('0x11')](_0x58740e,_0x23624a)['then'](function(_0x1bcb35){logger[_0x8198('0x12')](_0x8198('0x13'),_0x17db5c,_0x8198('0x14'));logger[_0x8198('0x15')](_0x8198('0x16'),_0x17db5c,_0x8198('0x14'),JSON[_0x8198('0x17')](_0x1bcb35));if(_0x1bcb35[_0x8198('0x18')]){if(_0x1bcb35[_0x8198('0x18')][_0x8198('0x19')]===0x1f4){logger[_0x8198('0x18')](_0x8198('0x13'),_0x17db5c,_0x1bcb35[_0x8198('0x18')][_0x8198('0x1a')]);return _0x50c0bc(_0x1bcb35[_0x8198('0x18')][_0x8198('0x1a')]);}logger[_0x8198('0x18')](_0x8198('0x13'),_0x17db5c,_0x1bcb35[_0x8198('0x18')][_0x8198('0x1a')]);return _0x13f055(_0x1bcb35[_0x8198('0x18')]['message']);}else{logger['info'](_0x8198('0x13'),_0x17db5c,_0x8198('0x14'));_0x13f055(_0x1bcb35['result'][_0x8198('0x1a')]);}})['catch'](function(_0x46aecc){logger[_0x8198('0x18')]('UserNotification,\x20%s,\x20%s',_0x17db5c,_0x46aecc);_0x50c0bc(_0x46aecc);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 3189d6b..451cda6 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 _0x09af=['update','length','userNotification:','save','remove'];(function(_0x344e5b,_0x15339b){var _0x57219=function(_0x3ac996){while(--_0x3ac996){_0x344e5b['push'](_0x344e5b['shift']());}};_0x57219(++_0x15339b);}(_0x09af,0xee));var _0xf09a=function(_0x117010,_0xc11f2d){_0x117010=_0x117010-0x0;var _0x1cf822=_0x09af[_0x117010];return _0x1cf822;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0xf09a('0x0'),_0xf09a('0x1'),_0xf09a('0x2')];function createListener(_0x41da51,_0x1adf20){return function(_0x466b59){_0x1adf20['emit'](_0x41da51,_0x466b59);};}function removeListener(_0x176aa3,_0x2194ce){return function(){UserNotificationEvents['removeListener'](_0x176aa3,_0x2194ce);};}exports['register']=function(_0xa8cb83){for(var _0x3fba45=0x0,_0x21a010=events[_0xf09a('0x3')];_0x3fba45<_0x21a010;_0x3fba45++){var _0x2df9d4=events[_0x3fba45];var _0x250a78=createListener(_0xf09a('0x4')+_0x2df9d4,_0xa8cb83);UserNotificationEvents['on'](_0x2df9d4,_0x250a78);}}; \ No newline at end of file +var _0xbe70=['userNotification:','save','remove','update'];(function(_0x3be2e2,_0x5c166d){var _0x53b9c5=function(_0x248aa7){while(--_0x248aa7){_0x3be2e2['push'](_0x3be2e2['shift']());}};_0x53b9c5(++_0x5c166d);}(_0xbe70,0x1d5));var _0x0be7=function(_0x1773a5,_0x5a005b){_0x1773a5=_0x1773a5-0x0;var _0x80007c=_0xbe70[_0x1773a5];return _0x80007c;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x0be7('0x0'),_0x0be7('0x1'),_0x0be7('0x2')];function createListener(_0x1e5b70,_0x55909f){return function(_0x5ce69c){_0x55909f['emit'](_0x1e5b70,_0x5ce69c);};}function removeListener(_0x2b8e7e,_0x17ce8d){return function(){UserNotificationEvents['removeListener'](_0x2b8e7e,_0x17ce8d);};}exports['register']=function(_0x1cd108){for(var _0x29c96d=0x0,_0x3b8804=events['length'];_0x29c96d<_0x3b8804;_0x29c96d++){var _0x28a074=events[_0x29c96d];var _0x4d0197=createListener(_0x0be7('0x3')+_0x28a074,_0x1cd108);UserNotificationEvents['on'](_0x28a074,_0x4d0197);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 2a2fa31..4b9bd42 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x148752,_0x1bd423){var _0x4424a2=function(_0x3c491a){while(--_0x3c491a){_0x148752['push'](_0x148752['shift']());}};_0x4424a2(++_0x1bd423);}(_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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x3a1d35,_0xb3ce46){var _0x4a585c=function(_0x10d491){while(--_0x10d491){_0x3a1d35['push'](_0x3a1d35['shift']());}};_0x4a585c(++_0xb3ce46);}(_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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index b714e2a..f4af817 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 _0xb9f0=['exports','sequelize'];(function(_0xb37e39,_0x27b4e4){var _0x4bdaa0=function(_0x3b3785){while(--_0x3b3785){_0xb37e39['push'](_0xb37e39['shift']());}};_0x4bdaa0(++_0x27b4e4);}(_0xb9f0,0x1df));var _0x0b9f=function(_0x40ab41,_0x5d535e){_0x40ab41=_0x40ab41-0x0;var _0x36962d=_0xb9f0[_0x40ab41];return _0x36962d;};'use strict';var Sequelize=require(_0x0b9f('0x0'));module[_0x0b9f('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xfc9a=['INTEGER','sequelize'];(function(_0x8dec24,_0x903de0){var _0x381de1=function(_0x1aceb4){while(--_0x1aceb4){_0x8dec24['push'](_0x8dec24['shift']());}};_0x381de1(++_0x903de0);}(_0xfc9a,0x147));var _0xafc9=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xfc9a[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0xafc9('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xafc9('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 9ada56a..d4a4c48 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 _0x5f54=['util','bluebird','rimraf','./userOpenchannelQueue.attributes','define','user_has_openchannel_queues'];(function(_0x38bd9b,_0x334592){var _0x3bea01=function(_0x479b25){while(--_0x479b25){_0x38bd9b['push'](_0x38bd9b['shift']());}};_0x3bea01(++_0x334592);}(_0x5f54,0x162));var _0x45f5=function(_0x258b4f,_0x3000be){_0x258b4f=_0x258b4f-0x0;var _0x20ab7a=_0x5f54[_0x258b4f];return _0x20ab7a;};'use strict';var _=require('lodash');var util=require(_0x45f5('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x45f5('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x45f5('0x2'));var config=require('../../config/environment');var attributes=require(_0x45f5('0x3'));module['exports']=function(_0x20d052,_0x586cbc){return _0x20d052[_0x45f5('0x4')]('UserOpenchannelQueue',attributes,{'tableName':_0x45f5('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x134b=['rimraf','../../config/environment','exports','user_has_openchannel_queues','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x411e71,_0xf9652){var _0x226ae3=function(_0x1339f6){while(--_0x1339f6){_0x411e71['push'](_0x411e71['shift']());}};_0x226ae3(++_0xf9652);}(_0x134b,0x67));var _0xb134=function(_0x286bfb,_0x46ac3c){_0x286bfb=_0x286bfb-0x0;var _0x52b683=_0x134b[_0x286bfb];return _0x52b683;};'use strict';var _=require('lodash');var util=require(_0xb134('0x0'));var logger=require(_0xb134('0x1'))(_0xb134('0x2'));var moment=require(_0xb134('0x3'));var BPromise=require(_0xb134('0x4'));var rp=require(_0xb134('0x5'));var fs=require('fs');var path=require(_0xb134('0x6'));var rimraf=require(_0xb134('0x7'));var config=require(_0xb134('0x8'));var attributes=require('./userOpenchannelQueue.attributes');module[_0xb134('0x9')]=function(_0x3d6625,_0x456d12){return _0x3d6625['define']('UserOpenchannelQueue',attributes,{'tableName':_0xb134('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 8dc114c..bfdc849 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 _0x6bbc=['stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6bbc,0x15c));var _0xc6bb=function(_0x3a96d3,_0x31efc0){_0x3a96d3=_0x3a96d3-0x0;var _0x4f42c4=_0x6bbc[_0x3a96d3];return _0x4f42c4;};'use strict';var _=require(_0xc6bb('0x0'));var util=require(_0xc6bb('0x1'));var moment=require('moment');var BPromise=require(_0xc6bb('0x2'));var rs=require(_0xc6bb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc6bb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc6bb('0x5'))(_0xc6bb('0x6'));var config=require(_0xc6bb('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3605c8,_0x29ca0a,_0x161bda){return new BPromise(function(_0x47595e,_0xf54dd1){return client[_0xc6bb('0x8')](_0x3605c8,_0x161bda)[_0xc6bb('0x9')](function(_0x169bcb){logger[_0xc6bb('0xa')](_0xc6bb('0xb'),_0x29ca0a,'request\x20sent');logger['debug']('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x29ca0a,_0xc6bb('0xc'),JSON[_0xc6bb('0xd')](_0x169bcb));if(_0x169bcb[_0xc6bb('0xe')]){if(_0x169bcb[_0xc6bb('0xe')][_0xc6bb('0xf')]===0x1f4){logger['error'](_0xc6bb('0xb'),_0x29ca0a,_0x169bcb[_0xc6bb('0xe')][_0xc6bb('0x10')]);return _0xf54dd1(_0x169bcb['error'][_0xc6bb('0x10')]);}logger['error'](_0xc6bb('0xb'),_0x29ca0a,_0x169bcb[_0xc6bb('0xe')][_0xc6bb('0x10')]);return _0x47595e(_0x169bcb[_0xc6bb('0xe')][_0xc6bb('0x10')]);}else{logger[_0xc6bb('0xa')](_0xc6bb('0xb'),_0x29ca0a,_0xc6bb('0xc'));_0x47595e(_0x169bcb[_0xc6bb('0x11')][_0xc6bb('0x10')]);}})[_0xc6bb('0x12')](function(_0x2e436e){logger['error'](_0xc6bb('0xb'),_0x29ca0a,_0x2e436e);_0xf54dd1(_0x2e436e);});});} \ No newline at end of file +var _0x2c24=['info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then'];(function(_0x32ab1a,_0x1896ab){var _0x5956c5=function(_0x10f2d4){while(--_0x10f2d4){_0x32ab1a['push'](_0x32ab1a['shift']());}};_0x5956c5(++_0x1896ab);}(_0x2c24,0x10e));var _0x42c2=function(_0x35452d,_0x28d745){_0x35452d=_0x35452d-0x0;var _0x2dc5e2=_0x2c24[_0x35452d];return _0x2dc5e2;};'use strict';var _=require(_0x42c2('0x0'));var util=require(_0x42c2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x42c2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x42c2('0x3'))['db'];var utils=require(_0x42c2('0x4'));var logger=require(_0x42c2('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x42c2('0x6'));var client=jayson['client'][_0x42c2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3d13b0,_0x1d5d77,_0x4590aa){return new BPromise(function(_0x2291fb,_0x1aaea2){return client[_0x42c2('0x8')](_0x3d13b0,_0x4590aa)[_0x42c2('0x9')](function(_0xeae76b){logger[_0x42c2('0xa')](_0x42c2('0xb'),_0x1d5d77,'request\x20sent');logger[_0x42c2('0xc')](_0x42c2('0xd'),_0x1d5d77,_0x42c2('0xe'),JSON[_0x42c2('0xf')](_0xeae76b));if(_0xeae76b['error']){if(_0xeae76b[_0x42c2('0x10')][_0x42c2('0x11')]===0x1f4){logger[_0x42c2('0x10')](_0x42c2('0xb'),_0x1d5d77,_0xeae76b[_0x42c2('0x10')][_0x42c2('0x12')]);return _0x1aaea2(_0xeae76b['error'][_0x42c2('0x12')]);}logger[_0x42c2('0x10')](_0x42c2('0xb'),_0x1d5d77,_0xeae76b[_0x42c2('0x10')][_0x42c2('0x12')]);return _0x2291fb(_0xeae76b[_0x42c2('0x10')]['message']);}else{logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x1d5d77,_0x42c2('0xe'));_0x2291fb(_0xeae76b[_0x42c2('0x13')][_0x42c2('0x12')]);}})['catch'](function(_0x5e4126){logger[_0x42c2('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x1d5d77,_0x5e4126);_0x1aaea2(_0x5e4126);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index ce1ad29..4f7bbbe 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 _0xbd59=['get','isAuthenticated','index','/describe','describe','/:id','getSections','getResources','post','create','/:id/clone','/:id/sections','addSections','/:id/resources','addResources','put','update','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfile.controller'];(function(_0x2dc0db,_0x372bec){var _0x53d01a=function(_0x1ac128){while(--_0x1ac128){_0x2dc0db['push'](_0x2dc0db['shift']());}};_0x53d01a(++_0x372bec);}(_0xbd59,0x173));var _0x9bd5=function(_0x2718d0,_0x345e8c){_0x2718d0=_0x2718d0-0x0;var _0x5c229b=_0xbd59[_0x2718d0];return _0x5c229b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9bd5('0x0'));var timeout=require(_0x9bd5('0x1'));var express=require(_0x9bd5('0x2'));var router=express['Router']();var fs_extra=require(_0x9bd5('0x3'));var auth=require(_0x9bd5('0x4'));var interaction=require(_0x9bd5('0x5'));var config=require('../../config/environment');var controller=require(_0x9bd5('0x6'));router[_0x9bd5('0x7')]('/',auth[_0x9bd5('0x8')](),controller[_0x9bd5('0x9')]);router[_0x9bd5('0x7')](_0x9bd5('0xa'),auth[_0x9bd5('0x8')](),controller[_0x9bd5('0xb')]);router[_0x9bd5('0x7')](_0x9bd5('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x9bd5('0x7')]('/:id/sections',auth[_0x9bd5('0x8')](),controller[_0x9bd5('0xd')]);router['get']('/:id/resources',auth['isAuthenticated'](),controller[_0x9bd5('0xe')]);router[_0x9bd5('0xf')]('/',auth[_0x9bd5('0x8')](),controller[_0x9bd5('0x10')]);router['post'](_0x9bd5('0x11'),auth[_0x9bd5('0x8')](),controller['clone']);router[_0x9bd5('0xf')](_0x9bd5('0x12'),auth[_0x9bd5('0x8')](),controller[_0x9bd5('0x13')]);router[_0x9bd5('0xf')](_0x9bd5('0x14'),auth[_0x9bd5('0x8')](),controller[_0x9bd5('0x15')]);router[_0x9bd5('0x16')](_0x9bd5('0xc'),auth['isAuthenticated'](),controller[_0x9bd5('0x17')]);router[_0x9bd5('0x18')](_0x9bd5('0xc'),auth['isAuthenticated'](),controller[_0x9bd5('0x19')]);router[_0x9bd5('0x18')](_0x9bd5('0x12'),auth[_0x9bd5('0x8')](),controller['removeSections']);router['delete']('/:id/resources',auth[_0x9bd5('0x8')](),controller['removeResources']);module[_0x9bd5('0x1a')]=router; \ No newline at end of file +var _0xb02e=['exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','getSections','/:id/resources','create','/:id/clone','clone','post','/:id/sections','addSections','addResources','update','delete','destroy','removeResources'];(function(_0x5f365a,_0x5da547){var _0x276814=function(_0x3a74f0){while(--_0x3a74f0){_0x5f365a['push'](_0x5f365a['shift']());}};_0x276814(++_0x5da547);}(_0xb02e,0x1ee));var _0xeb02=function(_0x122a41,_0x3f2c65){_0x122a41=_0x122a41-0x0;var _0xafc039=_0xb02e[_0x122a41];return _0xafc039;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xeb02('0x0'));var timeout=require(_0xeb02('0x1'));var express=require(_0xeb02('0x2'));var router=express[_0xeb02('0x3')]();var fs_extra=require(_0xeb02('0x4'));var auth=require(_0xeb02('0x5'));var interaction=require(_0xeb02('0x6'));var config=require(_0xeb02('0x7'));var controller=require(_0xeb02('0x8'));router[_0xeb02('0x9')]('/',auth[_0xeb02('0xa')](),controller[_0xeb02('0xb')]);router[_0xeb02('0x9')](_0xeb02('0xc'),auth[_0xeb02('0xa')](),controller[_0xeb02('0xd')]);router[_0xeb02('0x9')](_0xeb02('0xe'),auth[_0xeb02('0xa')](),controller['show']);router[_0xeb02('0x9')]('/:id/sections',auth[_0xeb02('0xa')](),controller[_0xeb02('0xf')]);router[_0xeb02('0x9')](_0xeb02('0x10'),auth[_0xeb02('0xa')](),controller['getResources']);router['post']('/',auth[_0xeb02('0xa')](),controller[_0xeb02('0x11')]);router['post'](_0xeb02('0x12'),auth[_0xeb02('0xa')](),controller[_0xeb02('0x13')]);router[_0xeb02('0x14')](_0xeb02('0x15'),auth['isAuthenticated'](),controller[_0xeb02('0x16')]);router[_0xeb02('0x14')](_0xeb02('0x10'),auth[_0xeb02('0xa')](),controller[_0xeb02('0x17')]);router['put']('/:id',auth[_0xeb02('0xa')](),controller[_0xeb02('0x18')]);router[_0xeb02('0x19')](_0xeb02('0xe'),auth['isAuthenticated'](),controller[_0xeb02('0x1a')]);router['delete'](_0xeb02('0x15'),auth[_0xeb02('0xa')](),controller['removeSections']);router['delete']('/:id/resources',auth[_0xeb02('0xa')](),controller[_0xeb02('0x1b')]);module[_0xeb02('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 fe38a16..675d78a 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 _0x93c2=['crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','exports','name','STRING'];(function(_0x21d7b4,_0x211548){var _0x1c4a8a=function(_0x3fb18a){while(--_0x3fb18a){_0x21d7b4['push'](_0x21d7b4['shift']());}};_0x1c4a8a(++_0x211548);}(_0x93c2,0x8c));var _0x293c=function(_0x51d0b1,_0x3b3da1){_0x51d0b1=_0x51d0b1-0x0;var _0x10e4ff=_0x93c2[_0x51d0b1];return _0x10e4ff;};'use strict';var Sequelize=require(_0x293c('0x0'));module[_0x293c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x293c('0x2')},'crudPermissions':{'type':Sequelize[_0x293c('0x3')],'set':function(_0x18599a){this['setDataValue'](_0x293c('0x4'),_0x18599a?_0x18599a[_0x293c('0x5')](''):[]);},'get':function(){return this[_0x293c('0x6')](_0x293c('0x4'))?this[_0x293c('0x6')](_0x293c('0x4'))[_0x293c('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x293c('0x3')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x293c('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x293c('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x293c('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x293c('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x293c('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0xb542=['BOOLEAN','sequelize','exports','name','STRING','crudPermissions','join','getDataValue','split'];(function(_0x1ee9a1,_0x5f1434){var _0x21270f=function(_0x303251){while(--_0x303251){_0x1ee9a1['push'](_0x1ee9a1['shift']());}};_0x21270f(++_0x5f1434);}(_0xb542,0xb5));var _0x2b54=function(_0x271c5b,_0x46d768){_0x271c5b=_0x271c5b-0x0;var _0x1d36eb=_0xb542[_0x271c5b];return _0x1d36eb;};'use strict';var Sequelize=require(_0x2b54('0x0'));module[_0x2b54('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2b54('0x2')},'crudPermissions':{'type':Sequelize[_0x2b54('0x3')],'set':function(_0x17f18c){this['setDataValue'](_0x2b54('0x4'),_0x17f18c?_0x17f18c[_0x2b54('0x5')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0x2b54('0x6')](_0x2b54('0x4'))[_0x2b54('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x2b54('0x3')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x2b54('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x2b54('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x2b54('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x2b54('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x2b54('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x2b54('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x2b54('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 2326c0c..71037cf 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 _0xa95c=['key','model','map','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','findAll','catch','show','params','length','includeAll','include','options','find','create','body','get','omit','createdAt','crudPermissions','updatedAt','sequelize','transaction','UserProfileSection','autoAssociation','UserProfileResource','sectionId','Resources','addSections','userProfileId','each','removeSections','ids','getSections','enabled','isEmpty','includes','subsections','concat','push','findOne','Dashboard','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./userProfile.socket','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','destroy','then','error','name','send','index','UserProfile','rawAttributes','fieldName','type'];(function(_0x9bfd,_0x13b6a5){var _0x32c1f6=function(_0x33767f){while(--_0x33767f){_0x9bfd['push'](_0x9bfd['shift']());}};_0x32c1f6(++_0x13b6a5);}(_0xa95c,0x12b));var _0xca95=function(_0x52736e,_0x4d3b9a){_0x52736e=_0x52736e-0x0;var _0x4dedb5=_0xa95c[_0x52736e];return _0x4dedb5;};'use strict';var emlformat=require(_0xca95('0x0'));var rimraf=require(_0xca95('0x1'));var zipdir=require(_0xca95('0x2'));var jsonpatch=require(_0xca95('0x3'));var rp=require(_0xca95('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xca95('0x5'));var util=require(_0xca95('0x6'));var path=require(_0xca95('0x7'));var sox=require(_0xca95('0x8'));var csv=require(_0xca95('0x9'));var ejs=require(_0xca95('0xa'));var fs=require('fs');var fs_extra=require(_0xca95('0xb'));var _=require('lodash');var squel=require(_0xca95('0xc'));var crypto=require(_0xca95('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xca95('0xe'));var toCsv=require(_0xca95('0x9'));var querystring=require(_0xca95('0xf'));var Papa=require(_0xca95('0x10'));var Redis=require(_0xca95('0x11'));var authService=require(_0xca95('0x12'));var qs=require(_0xca95('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xca95('0x14'));var logger=require(_0xca95('0x15'))('api');var utils=require(_0xca95('0x16'));var config=require(_0xca95('0x17'));var licenseUtil=require(_0xca95('0x18'));var db=require('../../mysqldb')['db'];config[_0xca95('0x19')]=_[_0xca95('0x1a')](config[_0xca95('0x19')],{'host':_0xca95('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xca95('0x1c'))['register'](socket);function respondWithStatusCode(_0x1d2e91,_0x47456d){_0x47456d=_0x47456d||0xcc;return function(_0x15c375){if(_0x15c375){return _0x1d2e91[_0xca95('0x1d')](_0x47456d);}return _0x1d2e91[_0xca95('0x1e')](_0x47456d)[_0xca95('0x1f')]();};}function respondWithResult(_0x37d5b1,_0x5ada08){_0x5ada08=_0x5ada08||0xc8;return function(_0x29df3d){if(_0x29df3d){return _0x37d5b1['status'](_0x5ada08)[_0xca95('0x20')](_0x29df3d);}};}function respondWithFilteredResult(_0x5ccf60,_0x5bf9ea){return function(_0x240c70){if(_0x240c70){var _0x549348=typeof _0x5bf9ea['offset']===_0xca95('0x21')&&typeof _0x5bf9ea[_0xca95('0x22')]===_0xca95('0x21');var _0x4464d8=_0x240c70[_0xca95('0x23')];var _0x48a579=_0x549348?0x0:_0x5bf9ea[_0xca95('0x24')];var _0x5e00d7=_0x549348?_0x240c70[_0xca95('0x23')]:_0x5bf9ea[_0xca95('0x24')]+_0x5bf9ea['limit'];var _0x34f479;if(_0x5e00d7>=_0x4464d8){_0x5e00d7=_0x4464d8;_0x34f479=0xc8;}else{_0x34f479=0xce;}_0x5ccf60[_0xca95('0x1e')](_0x34f479);return _0x5ccf60[_0xca95('0x25')](_0xca95('0x26'),_0x48a579+'-'+_0x5e00d7+'/'+_0x4464d8)[_0xca95('0x20')](_0x240c70);}return null;};}function patchUpdates(_0x27b2e0){return function(_0x574820){try{jsonpatch[_0xca95('0x27')](_0x574820,_0x27b2e0,!![]);}catch(_0x5f37cb){return BPromise[_0xca95('0x28')](_0x5f37cb);}return _0x574820['save']();};}function saveUpdates(_0x559cb8,_0x17c0e1){return function(_0x1db753){if(_0x1db753){return _0x1db753[_0xca95('0x29')](_0x559cb8)['then'](function(_0x27205a){return _0x27205a;});}return null;};}function removeEntity(_0x283b39,_0x32abed){return function(_0x46510e){if(_0x46510e){return _0x46510e[_0xca95('0x2a')]()[_0xca95('0x2b')](function(){_0x283b39[_0xca95('0x1e')](0xcc)[_0xca95('0x1f')]();});}};}function handleEntityNotFound(_0x5a4839,_0x5ddc6f){return function(_0x53feb6){if(!_0x53feb6){_0x5a4839[_0xca95('0x1d')](0x194);}return _0x53feb6;};}function handleError(_0x49dcde,_0x407cb4){_0x407cb4=_0x407cb4||0x1f4;return function(_0x4fbd6a){logger[_0xca95('0x2c')](_0x4fbd6a['stack']);if(_0x4fbd6a['name']){delete _0x4fbd6a[_0xca95('0x2d')];}_0x49dcde[_0xca95('0x1e')](_0x407cb4)[_0xca95('0x2e')](_0x4fbd6a);};}exports[_0xca95('0x2f')]=function(_0x43ee54,_0x53f7e9){var _0x5adca6={},_0x34b046={},_0xbb09e4={'count':0x0,'rows':[]};var _0x555310=_['map'](db[_0xca95('0x30')][_0xca95('0x31')],function(_0x59710c){return{'name':_0x59710c[_0xca95('0x32')],'type':_0x59710c[_0xca95('0x33')][_0xca95('0x34')]};});_0x34b046[_0xca95('0x35')]=_[_0xca95('0x36')](_0x555310,_0xca95('0x2d'));_0x34b046['query']=_[_0xca95('0x37')](_0x43ee54[_0xca95('0x38')]);_0x34b046['filters']=_[_0xca95('0x39')](_0x34b046[_0xca95('0x35')],_0x34b046['query']);_0x5adca6[_0xca95('0x3a')]=_['intersection'](_0x34b046['model'],qs[_0xca95('0x3b')](_0x43ee54[_0xca95('0x38')]['fields']));_0x5adca6['attributes']=_0x5adca6['attributes']['length']?_0x5adca6['attributes']:_0x34b046[_0xca95('0x35')];if(!_0x43ee54[_0xca95('0x38')][_0xca95('0x3c')](_0xca95('0x3d'))){_0x5adca6['limit']=qs[_0xca95('0x22')](_0x43ee54[_0xca95('0x38')][_0xca95('0x22')]);_0x5adca6[_0xca95('0x24')]=qs[_0xca95('0x24')](_0x43ee54['query'][_0xca95('0x24')]);}_0x5adca6[_0xca95('0x3e')]=qs[_0xca95('0x3f')](_0x43ee54[_0xca95('0x38')][_0xca95('0x3f')]);_0x5adca6[_0xca95('0x40')]=qs[_0xca95('0x41')](_[_0xca95('0x42')](_0x43ee54['query'],_0x34b046['filters']),_0x555310);if(_0x43ee54['query'][_0xca95('0x43')]){_0x5adca6['where']=_[_0xca95('0x44')](_0x5adca6['where'],{'$or':_[_0xca95('0x36')](_0x555310,function(_0x2e2d98){if(_0x2e2d98[_0xca95('0x33')]!==_0xca95('0x45')){var _0x28da90={};_0x28da90[_0x2e2d98['name']]={'$like':'%'+_0x43ee54[_0xca95('0x38')][_0xca95('0x43')]+'%'};return _0x28da90;}})});}_0x5adca6=_[_0xca95('0x44')]({},_0x5adca6,_0x43ee54['options']);var _0x19986b={'where':_0x5adca6['where']};return db[_0xca95('0x30')][_0xca95('0x23')](_0x19986b)[_0xca95('0x2b')](function(_0x505a23){_0xbb09e4[_0xca95('0x23')]=_0x505a23;if(_0x43ee54['query']['includeAll']){_0x5adca6['include']=[{'all':!![]}];}return db[_0xca95('0x30')][_0xca95('0x46')](_0x5adca6);})[_0xca95('0x2b')](function(_0x85804b){_0xbb09e4['rows']=_0x85804b;return _0xbb09e4;})[_0xca95('0x2b')](respondWithFilteredResult(_0x53f7e9,_0x5adca6))[_0xca95('0x47')](handleError(_0x53f7e9,null));};exports[_0xca95('0x48')]=function(_0x1fd7cc,_0x3d760a){var _0x566351={'raw':![],'where':{'id':_0x1fd7cc[_0xca95('0x49')]['id']}},_0x6720ee={};_0x6720ee['model']=_[_0xca95('0x37')](db['UserProfile'][_0xca95('0x31')]);_0x6720ee['query']=_['keys'](_0x1fd7cc['query']);_0x6720ee[_0xca95('0x41')]=_[_0xca95('0x39')](_0x6720ee[_0xca95('0x35')],_0x6720ee[_0xca95('0x38')]);_0x566351['attributes']=_[_0xca95('0x39')](_0x6720ee[_0xca95('0x35')],qs[_0xca95('0x3b')](_0x1fd7cc[_0xca95('0x38')][_0xca95('0x3b')]));_0x566351[_0xca95('0x3a')]=_0x566351['attributes'][_0xca95('0x4a')]?_0x566351['attributes']:_0x6720ee[_0xca95('0x35')];if(_0x1fd7cc['query'][_0xca95('0x4b')]){_0x566351[_0xca95('0x4c')]=[{'all':!![]}];}_0x566351=_['merge']({},_0x566351,_0x1fd7cc[_0xca95('0x4d')]);return db[_0xca95('0x30')][_0xca95('0x4e')](_0x566351)[_0xca95('0x2b')](handleEntityNotFound(_0x3d760a,null))[_0xca95('0x2b')](respondWithResult(_0x3d760a,null))['catch'](handleError(_0x3d760a,null));};exports[_0xca95('0x4f')]=function(_0x166f85,_0x167f56){return db[_0xca95('0x30')]['create'](_0x166f85[_0xca95('0x50')],{})[_0xca95('0x2b')](respondWithResult(_0x167f56,0xc9))[_0xca95('0x47')](handleError(_0x167f56,null));};exports['clone']=function(_0x291a86,_0x63f260){var _0x5156c0={'where':{'id':_0x291a86['params']['id']}},_0xb36547={};_0xb36547['model']=_[_0xca95('0x37')](db[_0xca95('0x30')]['rawAttributes']);_0x5156c0[_0xca95('0x3a')]=_[_0xca95('0x39')](_0xb36547[_0xca95('0x35')],qs['fields'](_0x291a86[_0xca95('0x38')][_0xca95('0x3b')]));_0x5156c0[_0xca95('0x3a')]=_0x5156c0['attributes'][_0xca95('0x4a')]?_0x5156c0[_0xca95('0x3a')]:_0xb36547[_0xca95('0x35')];if(_0x291a86[_0xca95('0x38')][_0xca95('0x4b')]){_0x5156c0['include']=[{'all':!![]}];}_0x5156c0=_['merge']({},_0x5156c0,_0x291a86[_0xca95('0x4d')]);return db['UserProfile'][_0xca95('0x4e')](_0x5156c0)['then'](handleEntityNotFound(_0x63f260,null))[_0xca95('0x2b')](function(_0x3f955e){if(_0x3f955e){var _0x193d8c=_0x3f955e[_0xca95('0x51')]({'plain':!![]});_0x193d8c=qs[_0xca95('0x52')](_0x193d8c,['id',_0xca95('0x53'),'updatedAt',_0xca95('0x54')]);_0x291a86['body']=_[_0xca95('0x52')](_0x291a86[_0xca95('0x50')],['id',_0xca95('0x53'),_0xca95('0x55')]);return db[_0xca95('0x56')][_0xca95('0x57')](function(_0x82c19f){return db[_0xca95('0x30')]['create'](_[_0xca95('0x44')](_0x193d8c,_0x291a86[_0xca95('0x50')]),{'include':_0x291a86[_0xca95('0x38')][_0xca95('0x4b')]?[{'all':!![]}]:undefined,'transaction':_0x82c19f})[_0xca95('0x2b')](function(_0x5c355d){var _0x159b8b=_0x5c355d[_0xca95('0x51')]({'plain':!![]});return db[_0xca95('0x58')][_0xca95('0x46')]({'where':{'userProfileId':_0x291a86['params']['id']},'raw':!![]})[_0xca95('0x2b')](function(_0x47c4e6){if(_0x47c4e6){return BPromise['each'](_0x47c4e6,function(_0x53af60){return new BPromise(function(_0x242d14,_0x5a1b34){if(_0x53af60[_0xca95('0x59')]===null||_0x53af60['autoAssociation']===0x1)_0x242d14(null);return db[_0xca95('0x5a')][_0xca95('0x46')]({'where':{'sectionId':_0x53af60['id']},'raw':!![]})[_0xca95('0x2b')](function(_0x492e04){var _0x45f5d6=_['map'](_0x492e04,function(_0x543cda){return qs[_0xca95('0x52')](_0x543cda,['id',_0xca95('0x53'),_0xca95('0x55'),_0xca95('0x5b')]);});_0x242d14(_0x45f5d6);})[_0xca95('0x47')](function(_0x34e973){_0x5a1b34(_0x34e973);});})[_0xca95('0x2b')](function(_0x24cf61){var _0x318dcf=qs['omit'](_0x53af60,['id','createdAt',_0xca95('0x55')]);_0x318dcf['userProfileId']=_0x159b8b['id'];if(_0x24cf61)_0x318dcf[_0xca95('0x5c')]=_0x24cf61;return _0x318dcf;})[_0xca95('0x2b')](function(_0x5c5276){return db[_0xca95('0x58')]['create'](_0x5c5276,{'include':[{'model':db[_0xca95('0x5a')],'as':_0xca95('0x5c')}],'raw':!![],'transaction':_0x82c19f});});})[_0xca95('0x2b')](function(){return _0x159b8b;});}});});});}})[_0xca95('0x2b')](respondWithResult(_0x63f260,0xc9))[_0xca95('0x47')](handleError(_0x63f260,null));};exports[_0xca95('0x29')]=function(_0x499791,_0x55cea5){if(_0x499791[_0xca95('0x50')]['id']){delete _0x499791['body']['id'];}return db[_0xca95('0x30')][_0xca95('0x4e')]({'where':{'id':_0x499791['params']['id']}})[_0xca95('0x2b')](handleEntityNotFound(_0x55cea5,null))[_0xca95('0x2b')](saveUpdates(_0x499791[_0xca95('0x50')],null))[_0xca95('0x2b')](respondWithResult(_0x55cea5,null))[_0xca95('0x47')](handleError(_0x55cea5,null));};exports['destroy']=function(_0x29c96e,_0x160750){return db['UserProfile'][_0xca95('0x4e')]({'where':{'id':_0x29c96e[_0xca95('0x49')]['id']}})[_0xca95('0x2b')](handleEntityNotFound(_0x160750,null))[_0xca95('0x2b')](removeEntity(_0x160750,null))['catch'](handleError(_0x160750,null));};exports['describe']=function(_0x4318f5,_0x43495c){return db[_0xca95('0x30')]['describe']()[_0xca95('0x2b')](respondWithResult(_0x43495c,null))[_0xca95('0x47')](handleError(_0x43495c,null));};exports[_0xca95('0x5d')]=function(_0x39826c,_0x56667f){var _0x9dc975=_0x39826c[_0xca95('0x50')];return db[_0xca95('0x30')][_0xca95('0x4e')]({'where':{'id':_0x39826c[_0xca95('0x49')]['id']}})[_0xca95('0x2b')](handleEntityNotFound(_0x56667f,null))[_0xca95('0x2b')](function(_0x5a59ba){if(_0x5a59ba){return db['sequelize']['transaction'](function(_0x32e20e){return db[_0xca95('0x58')][_0xca95('0x2a')]({'where':{'userProfileId':_0x39826c['params']['id'],'sectionId':_[_0xca95('0x36')](_0x9dc975,function(_0x2b878f){return _0x2b878f[_0xca95('0x5b')];})},'transaction':_0x32e20e})[_0xca95('0x2b')](function(){var _0x7da531=_[_0xca95('0x36')](_0x9dc975,function(_0x2c4651){_0x2c4651[_0xca95('0x5e')]=_0x39826c[_0xca95('0x49')]['id'];return _0x2c4651;});var _0x1253b4=[];return BPromise[_0xca95('0x5f')](_0x7da531,function(_0x53f5d4){return db['UserProfileSection'][_0xca95('0x4f')](_0x53f5d4,{'include':[{'model':db[_0xca95('0x5a')],'as':'Resources'}],'raw':!![],'transaction':_0x32e20e})[_0xca95('0x2b')](function(_0xcaa7bd){_0x1253b4['push'](_0xcaa7bd[_0xca95('0x51')]({'plain':!![]}));});})[_0xca95('0x2b')](function(){return _0x1253b4;});});});}})[_0xca95('0x2b')](function(_0x3d6dc2){return _0x3d6dc2;})[_0xca95('0x2b')](respondWithResult(_0x56667f,null))[_0xca95('0x47')](handleError(_0x56667f,null));};exports[_0xca95('0x60')]=function(_0x3973ac,_0x59d3d8){var _0x39bdc0;return db[_0xca95('0x30')]['find']({'where':{'id':_0x3973ac[_0xca95('0x49')]['id']},'attributes':['id',_0xca95('0x2d')]})[_0xca95('0x2b')](handleEntityNotFound(_0x59d3d8,null))[_0xca95('0x2b')](function(_0x4ab1a0){if(_0x4ab1a0){_0x39bdc0=_0x4ab1a0;return db[_0xca95('0x58')][_0xca95('0x2a')]({'where':{'userProfileId':_0x3973ac[_0xca95('0x49')]['id'],'sectionId':_0x3973ac['query'][_0xca95('0x61')]}});}})[_0xca95('0x2b')](function(){return _0x39bdc0;})[_0xca95('0x2b')](respondWithStatusCode(_0x59d3d8,null))[_0xca95('0x47')](handleError(_0x59d3d8,null));};exports[_0xca95('0x62')]=function(_0x2584d1,_0x1f4017){var _0x1959a1=[];var _0x49c587=[];return db[_0xca95('0x58')][_0xca95('0x46')]({'where':{'userProfileId':_0x2584d1[_0xca95('0x49')]['id']},'raw':!![]})[_0xca95('0x2b')](function(_0x28ce09){_0x1959a1=_[_0xca95('0x43')](_0x28ce09,function(_0x94e89a){return _0x94e89a[_0xca95('0x63')]===0x1||_['includes']([0x3eb,0x709],_0x94e89a[_0xca95('0x5b')]);});if(!_[_0xca95('0x64')](_0x1959a1)){return _['map'](_0x1959a1,function(_0x156075){return _0x156075[_0xca95('0x5b')];});}else{return;}})[_0xca95('0x2b')](function(_0x552bbd){if(_0x552bbd)_0x49c587=_0x552bbd;if(_['includes'](_0x49c587,0x64)){var _0x17fb46=_['find'](_0x1959a1,{'sectionId':0x64});return hasDefaultDashboard(_0x17fb46)['then'](function(_0x19fee7){return _[_0xca95('0x36')](_0x1959a1,function(_0x29b785){if(_0x29b785[_0xca95('0x5b')]===0x64){_0x29b785['subsections']=_0x19fee7;}return _0x29b785;});});}else{return;}})['then'](function(_0x190cab){if(_0x190cab)_0x1959a1=_0x190cab;if(_[_0xca95('0x65')](_0x49c587,0x3eb)){var _0x5a470b=_[_0xca95('0x4e')](_0x1959a1,{'sectionId':0x3eb});return getCustomDashboards(_0x5a470b)[_0xca95('0x2b')](function(_0x5b2c83){return _[_0xca95('0x36')](_0x1959a1,function(_0x5c1658){if(_0x5a470b[_0xca95('0x63')]){if(_0x5c1658[_0xca95('0x5b')]===0x3eb){_0x5c1658[_0xca95('0x66')]=_0x5b2c83;}}else{if(_0x5c1658[_0xca95('0x5b')]===0x64){if(!_0x5c1658[_0xca95('0x66')]){_0x5c1658[_0xca95('0x66')]=[];}_0x5c1658[_0xca95('0x66')]=_0x5c1658[_0xca95('0x66')][_0xca95('0x67')](_0x5b2c83);}}return _0x5c1658;});});}else{return;}})[_0xca95('0x2b')](function(_0x2ab6a6){if(_0x2ab6a6)_0x1959a1=_0x2ab6a6;if(_[_0xca95('0x65')](_0x49c587,0x709)){var _0x14d5ff=_['find'](_0x1959a1,{'sectionId':0x709});return getPlugins(_0x14d5ff)['then'](function(_0x14ebab){if(_0x14d5ff['enabled']){return _[_0xca95('0x36')](_0x1959a1,function(_0x17e1ad){if(_0x17e1ad[_0xca95('0x5b')]===0x709){_0x17e1ad[_0xca95('0x66')]=_0x14ebab;}return _0x17e1ad;});}else{var _0x16a400={'sectionId':0x76c,'enabled':0x1,'subsections':_0x14ebab};var _0x4236e2=_[_0xca95('0x36')](_0x1959a1);_0x4236e2[_0xca95('0x68')](_0x16a400);return _0x4236e2;}});}else{return;}})[_0xca95('0x2b')](function(_0xdd14cf){if(_0xdd14cf)_0x1959a1=_0xdd14cf;return _[_0xca95('0x43')](_0x1959a1,[_0xca95('0x63'),0x1]);})[_0xca95('0x2b')](respondWithResult(_0x1f4017,null))[_0xca95('0x47')](handleError(_0x1f4017,null));};function hasDefaultDashboard(_0x2c67a9){var _0x254ef8=[0x65];return new BPromise(function(_0x5de46c,_0x439547){try{if(_0x2c67a9['autoAssociation']){_0x5de46c(_0x254ef8);}else{return db[_0xca95('0x5a')][_0xca95('0x69')]({'where':{'sectionId':_0x2c67a9['id']},'raw':!![]})['then'](function(_0x301a95){_0x301a95?_0x5de46c(_0x254ef8):_0x5de46c();});}}catch(_0x48f1fc){_0x439547(_0x48f1fc);}});}function getCustomDashboards(_0x4aeb7a){var _0x11bbea=[];return new BPromise(function(_0x55b64e,_0x1f80e0){try{if(_0x4aeb7a['autoAssociation']){return db[_0xca95('0x6a')][_0xca95('0x46')]({'raw':!![]})['then'](function(_0x3bd9da){_0x3bd9da[_0xca95('0x6b')](function(_0x1c2045){_0x11bbea[_0xca95('0x68')](_0x1c2045['id']+0x1869f);});_0x55b64e(_0x11bbea);});}else{return db[_0xca95('0x5a')][_0xca95('0x46')]({'where':{'sectionId':_0x4aeb7a['id']},'raw':!![]})[_0xca95('0x2b')](function(_0x5a341d){_0x5a341d[_0xca95('0x6b')](function(_0xbb4161){_0x11bbea[_0xca95('0x68')](_0xbb4161['resourceId']+0x1869f);});_0x55b64e(_0x11bbea);});}}catch(_0x38741b){_0x1f80e0(_0x38741b);}});}function getPlugins(_0x1e7e4c){var _0x2e5b5e=[];return new BPromise(function(_0x348fdf,_0x4a144b){try{if(_0x1e7e4c[_0xca95('0x59')]){return db[_0xca95('0x6c')][_0xca95('0x46')]({'raw':!![]})['then'](function(_0x357958){_0x357958[_0xca95('0x6b')](function(_0x214e96){_0x2e5b5e[_0xca95('0x68')](_0x214e96['id']+0x15b38);});_0x348fdf(_0x2e5b5e);});}else{return db[_0xca95('0x5a')][_0xca95('0x46')]({'where':{'sectionId':_0x1e7e4c['id']},'raw':!![]})[_0xca95('0x2b')](function(_0x29077b){_0x29077b[_0xca95('0x6b')](function(_0x52d102){_0x2e5b5e[_0xca95('0x68')](_0x52d102[_0xca95('0x6d')]+0x15b38);});_0x348fdf(_0x2e5b5e);});}}catch(_0x969321){_0x4a144b(_0x969321);}});}exports[_0xca95('0x6e')]=function(_0x5ed96b,_0x3d6a9d){return db[_0xca95('0x30')][_0xca95('0x4e')]({'where':{'id':_0x5ed96b['params']['id']}})[_0xca95('0x2b')](handleEntityNotFound(_0x3d6a9d,null))[_0xca95('0x2b')](function(_0x4caca8){if(_0x4caca8){return db[_0xca95('0x56')][_0xca95('0x57')](function(_0x10b9d6){return db['UserProfileSection'][_0xca95('0x46')]({'where':{'userProfileId':_0x5ed96b[_0xca95('0x49')]['id']},'attributes':['id'],'raw':!![]})[_0xca95('0x2b')](function(_0x5a3a8d){if(_0x5a3a8d){return db[_0xca95('0x58')][_0xca95('0x2a')]({'where':{'userProfileId':_0x5ed96b['params']['id'],'id':_[_0xca95('0x36')](_0x5a3a8d,function(_0x1b4af5){return _0x1b4af5['id'];})},'transaction':_0x10b9d6});}})['then'](function(_0x7989da){var _0x476753=_[_0xca95('0x36')](_0x5ed96b[_0xca95('0x50')],function(_0xff3efe){_0xff3efe[_0xca95('0x5e')]=_0x5ed96b[_0xca95('0x49')]['id'];return _0xff3efe;});return db['UserProfileSection']['bulkCreate'](_0x476753,{'raw':!![],'transaction':_0x10b9d6});})['then'](function(_0x1288a2){var _0x5d3e20=_[_0xca95('0x43')](_[_0xca95('0x36')](_0x1288a2,function(_0x590c1e){return _0x590c1e[_0xca95('0x51')]({'plain':!![]});}),{'includeAll':![]});if(_0x5d3e20){return db[_0xca95('0x58')]['findAll']({'where':{'userProfileId':_0x5ed96b[_0xca95('0x49')]['id'],'sectionId':_['map'](_0x5d3e20,function(_0x756798){return _0x756798[_0xca95('0x5b')];})},'attributes':['id','sectionId'],'raw':!![]})[_0xca95('0x2b')](function(_0xa4efa9){var _0x5c3977=_[_0xca95('0x36')](_0x5ed96b[_0xca95('0x50')],function(_0x493b57){_0x493b57[_0xca95('0x5e')]=_0x5ed96b[_0xca95('0x49')]['id'];return _0x493b57;});return db[_0xca95('0x5a')][_0xca95('0x6f')](_0x5c3977,{'raw':!![],'transaction':_0x10b9d6});});}})[_0xca95('0x47')](handleError(_0x3d6a9d,null));});}})[_0xca95('0x2b')](function(_0x47bdcc){var _0x506720=_[_0xca95('0x36')](_0x47bdcc,function(_0x45f3e5){return _0x45f3e5[_0xca95('0x51')]({'plain':!![]});});})['then'](respondWithResult(_0x3d6a9d,null))['catch'](handleError(_0x3d6a9d,null));};exports[_0xca95('0x70')]=function(_0x4b8fba,_0x39d9fa,_0x32d4d2){return db[_0xca95('0x30')]['find']({'where':{'id':_0x4b8fba[_0xca95('0x49')]['id']}})[_0xca95('0x2b')](handleEntityNotFound(_0x39d9fa,null))[_0xca95('0x2b')](function(_0x3b9429){if(_0x3b9429){return _0x3b9429[_0xca95('0x70')](_0x4b8fba[_0xca95('0x38')][_0xca95('0x61')]);}})['then'](respondWithStatusCode(_0x39d9fa,null))[_0xca95('0x47')](handleError(_0x39d9fa,null));};exports[_0xca95('0x71')]=function(_0x1cae59,_0x4e24df){var _0x4daf56={};if(!_0x1cae59[_0xca95('0x38')][_0xca95('0x72')])throw new Error(_0xca95('0x73'));if(!_0x1cae59[_0xca95('0x38')][_0xca95('0x3c')]('nolimit')){_0x4daf56[_0xca95('0x22')]=qs[_0xca95('0x22')](_0x1cae59[_0xca95('0x38')][_0xca95('0x22')]);_0x4daf56[_0xca95('0x24')]=qs[_0xca95('0x24')](_0x1cae59[_0xca95('0x38')][_0xca95('0x24')]);}return db[_0xca95('0x30')][_0xca95('0x4e')]({'where':{'id':_0x1cae59[_0xca95('0x49')]['id']}})['then'](function(_0x7a7d81){if(!_0x7a7d81)throw new Error(_0xca95('0x74')+_0x1cae59[_0xca95('0x49')]['id']);return db[_0xca95('0x30')][_0xca95('0x71')](_0x1cae59);})['then'](respondWithFilteredResult(_0x4e24df,_0x4daf56))[_0xca95('0x47')](handleError(_0x4e24df,null));}; \ No newline at end of file +var _0x5e01=['model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','type','VIRTUAL','merge','options','UserProfile','includeAll','include','findAll','catch','show','find','create','body','clone','params','get','omit','createdAt','updatedAt','crudPermissions','sequelize','UserProfileSection','each','autoAssociation','UserProfileResource','Resources','describe','transaction','sectionId','userProfileId','removeSections','getSections','isEmpty','includes','subsections','concat','enabled','push','forEach','resourceId','addResources','removeResources','ids','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','path','sox','ejs','fs-extra','lodash','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','key'];(function(_0x481129,_0x12c455){var _0x5a8edb=function(_0x4237ba){while(--_0x4237ba){_0x481129['push'](_0x481129['shift']());}};_0x5a8edb(++_0x12c455);}(_0x5e01,0x18e));var _0x15e0=function(_0x1e500e,_0x2c9d74){_0x1e500e=_0x1e500e-0x0;var _0x10dc5e=_0x5e01[_0x1e500e];return _0x10dc5e;};'use strict';var emlformat=require(_0x15e0('0x0'));var rimraf=require(_0x15e0('0x1'));var zipdir=require(_0x15e0('0x2'));var jsonpatch=require(_0x15e0('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x15e0('0x4'));var sox=require(_0x15e0('0x5'));var csv=require('to-csv');var ejs=require(_0x15e0('0x6'));var fs=require('fs');var fs_extra=require(_0x15e0('0x7'));var _=require(_0x15e0('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x15e0('0x9'));var toCsv=require(_0x15e0('0xa'));var querystring=require(_0x15e0('0xb'));var Papa=require(_0x15e0('0xc'));var Redis=require(_0x15e0('0xd'));var authService=require(_0x15e0('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x15e0('0xf'));var hardwareService=require(_0x15e0('0x10'));var logger=require('../../config/logger')(_0x15e0('0x11'));var utils=require(_0x15e0('0x12'));var config=require(_0x15e0('0x13'));var licenseUtil=require(_0x15e0('0x14'));var db=require(_0x15e0('0x15'))['db'];config['redis']=_[_0x15e0('0x16')](config[_0x15e0('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x15e0('0x18'))(new Redis(config['redis']));require('./userProfile.socket')[_0x15e0('0x19')](socket);function respondWithStatusCode(_0x3862b4,_0x329d59){_0x329d59=_0x329d59||0xcc;return function(_0x4576f0){if(_0x4576f0){return _0x3862b4[_0x15e0('0x1a')](_0x329d59);}return _0x3862b4[_0x15e0('0x1b')](_0x329d59)[_0x15e0('0x1c')]();};}function respondWithResult(_0x401a77,_0x1eed10){_0x1eed10=_0x1eed10||0xc8;return function(_0x442f0f){if(_0x442f0f){return _0x401a77['status'](_0x1eed10)[_0x15e0('0x1d')](_0x442f0f);}};}function respondWithFilteredResult(_0x48d907,_0x3e13b3){return function(_0x294057){if(_0x294057){var _0x175c1f=typeof _0x3e13b3[_0x15e0('0x1e')]===_0x15e0('0x1f')&&typeof _0x3e13b3[_0x15e0('0x20')]===_0x15e0('0x1f');var _0x4ef564=_0x294057[_0x15e0('0x21')];var _0x459ba3=_0x175c1f?0x0:_0x3e13b3[_0x15e0('0x1e')];var _0x2055c0=_0x175c1f?_0x294057[_0x15e0('0x21')]:_0x3e13b3['offset']+_0x3e13b3['limit'];var _0x5547a6;if(_0x2055c0>=_0x4ef564){_0x2055c0=_0x4ef564;_0x5547a6=0xc8;}else{_0x5547a6=0xce;}_0x48d907[_0x15e0('0x1b')](_0x5547a6);return _0x48d907[_0x15e0('0x22')](_0x15e0('0x23'),_0x459ba3+'-'+_0x2055c0+'/'+_0x4ef564)[_0x15e0('0x1d')](_0x294057);}return null;};}function patchUpdates(_0x30f8be){return function(_0x48dab1){try{jsonpatch[_0x15e0('0x24')](_0x48dab1,_0x30f8be,!![]);}catch(_0x3e555a){return BPromise['reject'](_0x3e555a);}return _0x48dab1[_0x15e0('0x25')]();};}function saveUpdates(_0x7db6c9,_0x221b40){return function(_0x4e180a){if(_0x4e180a){return _0x4e180a[_0x15e0('0x26')](_0x7db6c9)['then'](function(_0x308672){return _0x308672;});}return null;};}function removeEntity(_0xfd3662,_0x4d3550){return function(_0x3afb73){if(_0x3afb73){return _0x3afb73[_0x15e0('0x27')]()[_0x15e0('0x28')](function(){_0xfd3662[_0x15e0('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46a50b,_0x5f1a42){return function(_0x8726df){if(!_0x8726df){_0x46a50b['sendStatus'](0x194);}return _0x8726df;};}function handleError(_0x22ac51,_0x478377){_0x478377=_0x478377||0x1f4;return function(_0x35f5be){logger[_0x15e0('0x29')](_0x35f5be[_0x15e0('0x2a')]);if(_0x35f5be[_0x15e0('0x2b')]){delete _0x35f5be[_0x15e0('0x2b')];}_0x22ac51[_0x15e0('0x1b')](_0x478377)[_0x15e0('0x2c')](_0x35f5be);};}exports[_0x15e0('0x2d')]=function(_0x3fe475,_0x5b3f48){var _0x3e54cf={},_0x5533ad={},_0xf8a68f={'count':0x0,'rows':[]};var _0x53133c=_[_0x15e0('0x2e')](db['UserProfile'][_0x15e0('0x2f')],function(_0x1113a6){return{'name':_0x1113a6[_0x15e0('0x30')],'type':_0x1113a6['type'][_0x15e0('0x31')]};});_0x5533ad[_0x15e0('0x32')]=_[_0x15e0('0x2e')](_0x53133c,'name');_0x5533ad[_0x15e0('0x33')]=_[_0x15e0('0x34')](_0x3fe475[_0x15e0('0x33')]);_0x5533ad['filters']=_[_0x15e0('0x35')](_0x5533ad[_0x15e0('0x32')],_0x5533ad['query']);_0x3e54cf[_0x15e0('0x36')]=_['intersection'](_0x5533ad[_0x15e0('0x32')],qs[_0x15e0('0x37')](_0x3fe475[_0x15e0('0x33')]['fields']));_0x3e54cf[_0x15e0('0x36')]=_0x3e54cf[_0x15e0('0x36')][_0x15e0('0x38')]?_0x3e54cf[_0x15e0('0x36')]:_0x5533ad[_0x15e0('0x32')];if(!_0x3fe475[_0x15e0('0x33')][_0x15e0('0x39')](_0x15e0('0x3a'))){_0x3e54cf[_0x15e0('0x20')]=qs['limit'](_0x3fe475[_0x15e0('0x33')]['limit']);_0x3e54cf[_0x15e0('0x1e')]=qs[_0x15e0('0x1e')](_0x3fe475[_0x15e0('0x33')][_0x15e0('0x1e')]);}_0x3e54cf[_0x15e0('0x3b')]=qs[_0x15e0('0x3c')](_0x3fe475[_0x15e0('0x33')][_0x15e0('0x3c')]);_0x3e54cf[_0x15e0('0x3d')]=qs['filters'](_[_0x15e0('0x3e')](_0x3fe475[_0x15e0('0x33')],_0x5533ad[_0x15e0('0x3f')]),_0x53133c);if(_0x3fe475[_0x15e0('0x33')][_0x15e0('0x40')]){_0x3e54cf[_0x15e0('0x3d')]=_['merge'](_0x3e54cf[_0x15e0('0x3d')],{'$or':_[_0x15e0('0x2e')](_0x53133c,function(_0x1cd197){if(_0x1cd197[_0x15e0('0x41')]!==_0x15e0('0x42')){var _0x1b3200={};_0x1b3200[_0x1cd197[_0x15e0('0x2b')]]={'$like':'%'+_0x3fe475['query'][_0x15e0('0x40')]+'%'};return _0x1b3200;}})});}_0x3e54cf=_[_0x15e0('0x43')]({},_0x3e54cf,_0x3fe475[_0x15e0('0x44')]);var _0x241284={'where':_0x3e54cf[_0x15e0('0x3d')]};return db[_0x15e0('0x45')]['count'](_0x241284)[_0x15e0('0x28')](function(_0x3060ba){_0xf8a68f[_0x15e0('0x21')]=_0x3060ba;if(_0x3fe475[_0x15e0('0x33')][_0x15e0('0x46')]){_0x3e54cf[_0x15e0('0x47')]=[{'all':!![]}];}return db[_0x15e0('0x45')][_0x15e0('0x48')](_0x3e54cf);})[_0x15e0('0x28')](function(_0x5ce60d){_0xf8a68f['rows']=_0x5ce60d;return _0xf8a68f;})[_0x15e0('0x28')](respondWithFilteredResult(_0x5b3f48,_0x3e54cf))[_0x15e0('0x49')](handleError(_0x5b3f48,null));};exports[_0x15e0('0x4a')]=function(_0x497ead,_0x19c139){var _0x660ee4={'raw':![],'where':{'id':_0x497ead['params']['id']}},_0x22cccd={};_0x22cccd[_0x15e0('0x32')]=_[_0x15e0('0x34')](db[_0x15e0('0x45')]['rawAttributes']);_0x22cccd['query']=_['keys'](_0x497ead[_0x15e0('0x33')]);_0x22cccd[_0x15e0('0x3f')]=_['intersection'](_0x22cccd[_0x15e0('0x32')],_0x22cccd[_0x15e0('0x33')]);_0x660ee4[_0x15e0('0x36')]=_[_0x15e0('0x35')](_0x22cccd[_0x15e0('0x32')],qs['fields'](_0x497ead[_0x15e0('0x33')][_0x15e0('0x37')]));_0x660ee4[_0x15e0('0x36')]=_0x660ee4['attributes'][_0x15e0('0x38')]?_0x660ee4[_0x15e0('0x36')]:_0x22cccd[_0x15e0('0x32')];if(_0x497ead[_0x15e0('0x33')][_0x15e0('0x46')]){_0x660ee4[_0x15e0('0x47')]=[{'all':!![]}];}_0x660ee4=_[_0x15e0('0x43')]({},_0x660ee4,_0x497ead['options']);return db[_0x15e0('0x45')][_0x15e0('0x4b')](_0x660ee4)['then'](handleEntityNotFound(_0x19c139,null))['then'](respondWithResult(_0x19c139,null))[_0x15e0('0x49')](handleError(_0x19c139,null));};exports[_0x15e0('0x4c')]=function(_0x5b4e9b,_0x1b64db){return db[_0x15e0('0x45')][_0x15e0('0x4c')](_0x5b4e9b[_0x15e0('0x4d')],{})[_0x15e0('0x28')](respondWithResult(_0x1b64db,0xc9))[_0x15e0('0x49')](handleError(_0x1b64db,null));};exports[_0x15e0('0x4e')]=function(_0x40dbc0,_0x16b2a4){var _0x45c803={'where':{'id':_0x40dbc0[_0x15e0('0x4f')]['id']}},_0x13d886={};_0x13d886['model']=_[_0x15e0('0x34')](db[_0x15e0('0x45')]['rawAttributes']);_0x45c803['attributes']=_['intersection'](_0x13d886[_0x15e0('0x32')],qs['fields'](_0x40dbc0[_0x15e0('0x33')][_0x15e0('0x37')]));_0x45c803['attributes']=_0x45c803[_0x15e0('0x36')]['length']?_0x45c803[_0x15e0('0x36')]:_0x13d886['model'];if(_0x40dbc0['query'][_0x15e0('0x46')]){_0x45c803[_0x15e0('0x47')]=[{'all':!![]}];}_0x45c803=_[_0x15e0('0x43')]({},_0x45c803,_0x40dbc0[_0x15e0('0x44')]);return db['UserProfile'][_0x15e0('0x4b')](_0x45c803)[_0x15e0('0x28')](handleEntityNotFound(_0x16b2a4,null))['then'](function(_0x3a1bdb){if(_0x3a1bdb){var _0x41d0eb=_0x3a1bdb[_0x15e0('0x50')]({'plain':!![]});_0x41d0eb=qs[_0x15e0('0x51')](_0x41d0eb,['id',_0x15e0('0x52'),_0x15e0('0x53'),_0x15e0('0x54')]);_0x40dbc0[_0x15e0('0x4d')]=_[_0x15e0('0x51')](_0x40dbc0[_0x15e0('0x4d')],['id',_0x15e0('0x52'),_0x15e0('0x53')]);return db[_0x15e0('0x55')]['transaction'](function(_0x4b8c70){return db[_0x15e0('0x45')]['create'](_[_0x15e0('0x43')](_0x41d0eb,_0x40dbc0['body']),{'include':_0x40dbc0[_0x15e0('0x33')][_0x15e0('0x46')]?[{'all':!![]}]:undefined,'transaction':_0x4b8c70})[_0x15e0('0x28')](function(_0x1e2b6b){var _0x4b5f84=_0x1e2b6b[_0x15e0('0x50')]({'plain':!![]});return db[_0x15e0('0x56')]['findAll']({'where':{'userProfileId':_0x40dbc0[_0x15e0('0x4f')]['id']},'raw':!![]})['then'](function(_0x427a6c){if(_0x427a6c){return BPromise[_0x15e0('0x57')](_0x427a6c,function(_0x156977){return new BPromise(function(_0x1ad30d,_0x1844b0){if(_0x156977[_0x15e0('0x58')]===null||_0x156977['autoAssociation']===0x1)_0x1ad30d(null);return db[_0x15e0('0x59')][_0x15e0('0x48')]({'where':{'sectionId':_0x156977['id']},'raw':!![]})['then'](function(_0x489d21){var _0x55d955=_[_0x15e0('0x2e')](_0x489d21,function(_0x287c58){return qs[_0x15e0('0x51')](_0x287c58,['id','createdAt',_0x15e0('0x53'),'sectionId']);});_0x1ad30d(_0x55d955);})[_0x15e0('0x49')](function(_0x442504){_0x1844b0(_0x442504);});})[_0x15e0('0x28')](function(_0x4a7b05){var _0x47bf2f=qs['omit'](_0x156977,['id','createdAt','updatedAt']);_0x47bf2f['userProfileId']=_0x4b5f84['id'];if(_0x4a7b05)_0x47bf2f[_0x15e0('0x5a')]=_0x4a7b05;return _0x47bf2f;})['then'](function(_0x268526){return db[_0x15e0('0x56')][_0x15e0('0x4c')](_0x268526,{'include':[{'model':db[_0x15e0('0x59')],'as':_0x15e0('0x5a')}],'raw':!![],'transaction':_0x4b8c70});});})[_0x15e0('0x28')](function(){return _0x4b5f84;});}});});});}})['then'](respondWithResult(_0x16b2a4,0xc9))[_0x15e0('0x49')](handleError(_0x16b2a4,null));};exports[_0x15e0('0x26')]=function(_0x567bf,_0x301675){if(_0x567bf['body']['id']){delete _0x567bf['body']['id'];}return db[_0x15e0('0x45')][_0x15e0('0x4b')]({'where':{'id':_0x567bf[_0x15e0('0x4f')]['id']}})[_0x15e0('0x28')](handleEntityNotFound(_0x301675,null))[_0x15e0('0x28')](saveUpdates(_0x567bf[_0x15e0('0x4d')],null))[_0x15e0('0x28')](respondWithResult(_0x301675,null))['catch'](handleError(_0x301675,null));};exports[_0x15e0('0x27')]=function(_0x3b3e9a,_0xdf2897){return db['UserProfile']['find']({'where':{'id':_0x3b3e9a[_0x15e0('0x4f')]['id']}})['then'](handleEntityNotFound(_0xdf2897,null))[_0x15e0('0x28')](removeEntity(_0xdf2897,null))['catch'](handleError(_0xdf2897,null));};exports[_0x15e0('0x5b')]=function(_0x3c2803,_0x1a32c6){return db['UserProfile'][_0x15e0('0x5b')]()['then'](respondWithResult(_0x1a32c6,null))[_0x15e0('0x49')](handleError(_0x1a32c6,null));};exports['addSections']=function(_0x3cefd0,_0x3dbf1b){var _0x5ed959=_0x3cefd0['body'];return db[_0x15e0('0x45')][_0x15e0('0x4b')]({'where':{'id':_0x3cefd0[_0x15e0('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3dbf1b,null))[_0x15e0('0x28')](function(_0x4afbe6){if(_0x4afbe6){return db[_0x15e0('0x55')][_0x15e0('0x5c')](function(_0x49c619){return db['UserProfileSection'][_0x15e0('0x27')]({'where':{'userProfileId':_0x3cefd0[_0x15e0('0x4f')]['id'],'sectionId':_[_0x15e0('0x2e')](_0x5ed959,function(_0x57a9ff){return _0x57a9ff[_0x15e0('0x5d')];})},'transaction':_0x49c619})['then'](function(){var _0x1b1547=_[_0x15e0('0x2e')](_0x5ed959,function(_0xe6c44a){_0xe6c44a[_0x15e0('0x5e')]=_0x3cefd0[_0x15e0('0x4f')]['id'];return _0xe6c44a;});var _0x4eaf1b=[];return BPromise[_0x15e0('0x57')](_0x1b1547,function(_0x1b8756){return db[_0x15e0('0x56')]['create'](_0x1b8756,{'include':[{'model':db[_0x15e0('0x59')],'as':_0x15e0('0x5a')}],'raw':!![],'transaction':_0x49c619})['then'](function(_0x5f2c11){_0x4eaf1b['push'](_0x5f2c11[_0x15e0('0x50')]({'plain':!![]}));});})[_0x15e0('0x28')](function(){return _0x4eaf1b;});});});}})[_0x15e0('0x28')](function(_0x4bd9df){return _0x4bd9df;})['then'](respondWithResult(_0x3dbf1b,null))['catch'](handleError(_0x3dbf1b,null));};exports[_0x15e0('0x5f')]=function(_0x693552,_0x1ba39a){var _0x42b465;return db[_0x15e0('0x45')][_0x15e0('0x4b')]({'where':{'id':_0x693552[_0x15e0('0x4f')]['id']},'attributes':['id','name']})[_0x15e0('0x28')](handleEntityNotFound(_0x1ba39a,null))[_0x15e0('0x28')](function(_0x4acd07){if(_0x4acd07){_0x42b465=_0x4acd07;return db[_0x15e0('0x56')][_0x15e0('0x27')]({'where':{'userProfileId':_0x693552[_0x15e0('0x4f')]['id'],'sectionId':_0x693552[_0x15e0('0x33')]['ids']}});}})[_0x15e0('0x28')](function(){return _0x42b465;})[_0x15e0('0x28')](respondWithStatusCode(_0x1ba39a,null))[_0x15e0('0x49')](handleError(_0x1ba39a,null));};exports[_0x15e0('0x60')]=function(_0x2f8a8f,_0x4001b0){var _0x1003be=[];var _0x2ba789=[];return db[_0x15e0('0x56')][_0x15e0('0x48')]({'where':{'userProfileId':_0x2f8a8f[_0x15e0('0x4f')]['id']},'raw':!![]})[_0x15e0('0x28')](function(_0x36699e){_0x1003be=_['filter'](_0x36699e,function(_0x4e6182){return _0x4e6182['enabled']===0x1||_['includes']([0x3eb,0x709],_0x4e6182[_0x15e0('0x5d')]);});if(!_[_0x15e0('0x61')](_0x1003be)){return _[_0x15e0('0x2e')](_0x1003be,function(_0x3abaa5){return _0x3abaa5['sectionId'];});}else{return;}})[_0x15e0('0x28')](function(_0x18a2bc){if(_0x18a2bc)_0x2ba789=_0x18a2bc;if(_[_0x15e0('0x62')](_0x2ba789,0x64)){var _0x6cfa19=_[_0x15e0('0x4b')](_0x1003be,{'sectionId':0x64});return hasDefaultDashboard(_0x6cfa19)[_0x15e0('0x28')](function(_0x489e9d){return _[_0x15e0('0x2e')](_0x1003be,function(_0x210691){if(_0x210691[_0x15e0('0x5d')]===0x64){_0x210691[_0x15e0('0x63')]=_0x489e9d;}return _0x210691;});});}else{return;}})['then'](function(_0x473655){if(_0x473655)_0x1003be=_0x473655;if(_[_0x15e0('0x62')](_0x2ba789,0x3eb)){var _0x1be6ed=_[_0x15e0('0x4b')](_0x1003be,{'sectionId':0x3eb});return getCustomDashboards(_0x1be6ed)['then'](function(_0x2b0513){return _[_0x15e0('0x2e')](_0x1003be,function(_0x5452cb){if(_0x1be6ed['enabled']){if(_0x5452cb['sectionId']===0x3eb){_0x5452cb[_0x15e0('0x63')]=_0x2b0513;}}else{if(_0x5452cb[_0x15e0('0x5d')]===0x64){if(!_0x5452cb['subsections']){_0x5452cb[_0x15e0('0x63')]=[];}_0x5452cb[_0x15e0('0x63')]=_0x5452cb['subsections'][_0x15e0('0x64')](_0x2b0513);}}return _0x5452cb;});});}else{return;}})[_0x15e0('0x28')](function(_0x574051){if(_0x574051)_0x1003be=_0x574051;if(_['includes'](_0x2ba789,0x709)){var _0xeb682d=_[_0x15e0('0x4b')](_0x1003be,{'sectionId':0x709});return getPlugins(_0xeb682d)[_0x15e0('0x28')](function(_0x43ce9e){if(_0xeb682d[_0x15e0('0x65')]){return _[_0x15e0('0x2e')](_0x1003be,function(_0x1b92d8){if(_0x1b92d8[_0x15e0('0x5d')]===0x709){_0x1b92d8['subsections']=_0x43ce9e;}return _0x1b92d8;});}else{var _0x5173bd={'sectionId':0x76c,'enabled':0x1,'subsections':_0x43ce9e};var _0x2efc21=_[_0x15e0('0x2e')](_0x1003be);_0x2efc21[_0x15e0('0x66')](_0x5173bd);return _0x2efc21;}});}else{return;}})[_0x15e0('0x28')](function(_0x1727d7){if(_0x1727d7)_0x1003be=_0x1727d7;return _['filter'](_0x1003be,['enabled',0x1]);})[_0x15e0('0x28')](respondWithResult(_0x4001b0,null))[_0x15e0('0x49')](handleError(_0x4001b0,null));};function hasDefaultDashboard(_0x54bbac){var _0xeccb40=[0x65];return new BPromise(function(_0x160bf1,_0x1179fe){try{if(_0x54bbac[_0x15e0('0x58')]){_0x160bf1(_0xeccb40);}else{return db['UserProfileResource']['findOne']({'where':{'sectionId':_0x54bbac['id']},'raw':!![]})[_0x15e0('0x28')](function(_0x4932ce){_0x4932ce?_0x160bf1(_0xeccb40):_0x160bf1();});}}catch(_0x4f50f8){_0x1179fe(_0x4f50f8);}});}function getCustomDashboards(_0x1310e6){var _0x475ace=[];return new BPromise(function(_0x3790ee,_0x3162dc){try{if(_0x1310e6[_0x15e0('0x58')]){return db['Dashboard'][_0x15e0('0x48')]({'raw':!![]})[_0x15e0('0x28')](function(_0x4bc1f9){_0x4bc1f9['forEach'](function(_0x4d916a){_0x475ace[_0x15e0('0x66')](_0x4d916a['id']+0x1869f);});_0x3790ee(_0x475ace);});}else{return db[_0x15e0('0x59')][_0x15e0('0x48')]({'where':{'sectionId':_0x1310e6['id']},'raw':!![]})[_0x15e0('0x28')](function(_0x44c6e3){_0x44c6e3[_0x15e0('0x67')](function(_0x17551e){_0x475ace['push'](_0x17551e[_0x15e0('0x68')]+0x1869f);});_0x3790ee(_0x475ace);});}}catch(_0x31550f){_0x3162dc(_0x31550f);}});}function getPlugins(_0x2e50c1){var _0x2bf705=[];return new BPromise(function(_0x22e0e4,_0x19c936){try{if(_0x2e50c1[_0x15e0('0x58')]){return db['Plugin']['findAll']({'raw':!![]})[_0x15e0('0x28')](function(_0xe56685){_0xe56685[_0x15e0('0x67')](function(_0x1797f7){_0x2bf705[_0x15e0('0x66')](_0x1797f7['id']+0x15b38);});_0x22e0e4(_0x2bf705);});}else{return db['UserProfileResource'][_0x15e0('0x48')]({'where':{'sectionId':_0x2e50c1['id']},'raw':!![]})[_0x15e0('0x28')](function(_0x2ce768){_0x2ce768[_0x15e0('0x67')](function(_0xd7c397){_0x2bf705['push'](_0xd7c397[_0x15e0('0x68')]+0x15b38);});_0x22e0e4(_0x2bf705);});}}catch(_0x1d38ea){_0x19c936(_0x1d38ea);}});}exports[_0x15e0('0x69')]=function(_0x564933,_0x30129e){return db[_0x15e0('0x45')][_0x15e0('0x4b')]({'where':{'id':_0x564933[_0x15e0('0x4f')]['id']}})['then'](handleEntityNotFound(_0x30129e,null))['then'](function(_0x1f02b2){if(_0x1f02b2){return db['sequelize'][_0x15e0('0x5c')](function(_0x45f4cf){return db[_0x15e0('0x56')]['findAll']({'where':{'userProfileId':_0x564933[_0x15e0('0x4f')]['id']},'attributes':['id'],'raw':!![]})[_0x15e0('0x28')](function(_0x1b082a){if(_0x1b082a){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x564933['params']['id'],'id':_[_0x15e0('0x2e')](_0x1b082a,function(_0x1993e9){return _0x1993e9['id'];})},'transaction':_0x45f4cf});}})[_0x15e0('0x28')](function(_0x6750d7){var _0x259fce=_['map'](_0x564933['body'],function(_0x2995bd){_0x2995bd[_0x15e0('0x5e')]=_0x564933[_0x15e0('0x4f')]['id'];return _0x2995bd;});return db[_0x15e0('0x56')]['bulkCreate'](_0x259fce,{'raw':!![],'transaction':_0x45f4cf});})[_0x15e0('0x28')](function(_0x466a35){var _0x1d2b53=_[_0x15e0('0x40')](_[_0x15e0('0x2e')](_0x466a35,function(_0x1f12cd){return _0x1f12cd[_0x15e0('0x50')]({'plain':!![]});}),{'includeAll':![]});if(_0x1d2b53){return db[_0x15e0('0x56')][_0x15e0('0x48')]({'where':{'userProfileId':_0x564933['params']['id'],'sectionId':_[_0x15e0('0x2e')](_0x1d2b53,function(_0x125e43){return _0x125e43[_0x15e0('0x5d')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x15e0('0x28')](function(_0x1873db){var _0x121c9d=_['map'](_0x564933[_0x15e0('0x4d')],function(_0x381e65){_0x381e65[_0x15e0('0x5e')]=_0x564933[_0x15e0('0x4f')]['id'];return _0x381e65;});return db[_0x15e0('0x59')]['bulkCreate'](_0x121c9d,{'raw':!![],'transaction':_0x45f4cf});});}})[_0x15e0('0x49')](handleError(_0x30129e,null));});}})[_0x15e0('0x28')](function(_0x34026d){var _0x5ca4bf=_['map'](_0x34026d,function(_0x47b319){return _0x47b319[_0x15e0('0x50')]({'plain':!![]});});})[_0x15e0('0x28')](respondWithResult(_0x30129e,null))['catch'](handleError(_0x30129e,null));};exports[_0x15e0('0x6a')]=function(_0x41b953,_0xc8de30,_0x477b6b){return db[_0x15e0('0x45')][_0x15e0('0x4b')]({'where':{'id':_0x41b953[_0x15e0('0x4f')]['id']}})[_0x15e0('0x28')](handleEntityNotFound(_0xc8de30,null))['then'](function(_0x965f8e){if(_0x965f8e){return _0x965f8e[_0x15e0('0x6a')](_0x41b953[_0x15e0('0x33')][_0x15e0('0x6b')]);}})[_0x15e0('0x28')](respondWithStatusCode(_0xc8de30,null))['catch'](handleError(_0xc8de30,null));};exports[_0x15e0('0x6c')]=function(_0x154a52,_0x3a51b8){var _0x49451d={};if(!_0x154a52[_0x15e0('0x33')][_0x15e0('0x6d')])throw new Error(_0x15e0('0x6e'));if(!_0x154a52[_0x15e0('0x33')][_0x15e0('0x39')](_0x15e0('0x3a'))){_0x49451d[_0x15e0('0x20')]=qs['limit'](_0x154a52['query'][_0x15e0('0x20')]);_0x49451d[_0x15e0('0x1e')]=qs[_0x15e0('0x1e')](_0x154a52['query']['offset']);}return db['UserProfile'][_0x15e0('0x4b')]({'where':{'id':_0x154a52[_0x15e0('0x4f')]['id']}})['then'](function(_0x495400){if(!_0x495400)throw new Error(_0x15e0('0x6f')+_0x154a52['params']['id']);return db[_0x15e0('0x45')][_0x15e0('0x6c')](_0x154a52);})[_0x15e0('0x28')](respondWithFilteredResult(_0x3a51b8,_0x49451d))['catch'](handleError(_0x3a51b8,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 8bed603..ed96bbc 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 _0x761c=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','UserProfile'];(function(_0x4b0b31,_0x54751a){var _0x4ad4db=function(_0x3514fa){while(--_0x3514fa){_0x4b0b31['push'](_0x4b0b31['shift']());}};_0x4ad4db(++_0x54751a);}(_0x761c,0x18a));var _0xc761=function(_0x42d397,_0x3674db){_0x42d397=_0x42d397-0x0;var _0x12c0bf=_0x761c[_0x42d397];return _0x12c0bf;};'use strict';var EventEmitter=require(_0xc761('0x0'));var UserProfile=require('../../mysqldb')['db'][_0xc761('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xc761('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc761('0x3'),'afterDestroy':_0xc761('0x4')};function emitEvent(_0x15d8dc){return function(_0x4b63a5,_0x1bb07e,_0x4ec1c2){UserProfileEvents[_0xc761('0x5')](_0x15d8dc+':'+_0x4b63a5['id'],_0x4b63a5);UserProfileEvents[_0xc761('0x5')](_0x15d8dc,_0x4b63a5);_0x4ec1c2(null);};}for(var e in events){if(events[_0xc761('0x6')](e)){var event=events[e];UserProfile[_0xc761('0x7')](e,emitEvent(event));}}module[_0xc761('0x8')]=UserProfileEvents; \ No newline at end of file +var _0x3d49=['emit','../../mysqldb','UserProfile','setMaxListeners','save','remove'];(function(_0x10d97f,_0x8f36fd){var _0x1ca3c1=function(_0x24283b){while(--_0x24283b){_0x10d97f['push'](_0x10d97f['shift']());}};_0x1ca3c1(++_0x8f36fd);}(_0x3d49,0x151));var _0x93d4=function(_0x22c169,_0x3298a6){_0x22c169=_0x22c169-0x0;var _0x30cc6f=_0x3d49[_0x22c169];return _0x30cc6f;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x93d4('0x0'))['db'][_0x93d4('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x93d4('0x2')](0x0);var events={'afterCreate':_0x93d4('0x3'),'afterUpdate':'update','afterDestroy':_0x93d4('0x4')};function emitEvent(_0x9846c2){return function(_0xa1de2e,_0x41313a,_0x20e6c7){UserProfileEvents[_0x93d4('0x5')](_0x9846c2+':'+_0xa1de2e['id'],_0xa1de2e);UserProfileEvents['emit'](_0x9846c2,_0xa1de2e);_0x20e6c7(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 diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 1ca3e7e..47f9cd3 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 _0xbcfc=['rawAttributes','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','key','foreignKey','options','include','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','includeAll','CmContact','Tags','color','tag','ThroughTags','true','chat','dataValues','sms','mail','openchannel','lodash','../../components/parsers/qs','squel','models','filter','value','findAll','associatedResources','map','catch','field','model','then','name','resolve','AnalyticExtractedReport','resourceId','type','squareprojects','SquareProject','odbc','childModel','squarerecordings','SquareRecording','parentSections','SquareProjects','JscriptyProject','Lists','ListId','lists','CmList','companies','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','FaxAccount','inboundroutes','internalroutes','VoiceExtension','VoiceContext','voicemails','voicerecordings','VoiceRecording','Agents','membername','User','Telephones','role','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','VoiceChanSpy','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','OpenchannelQueue','OpenchannelAccount','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','queuecampaigns','users','agents','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','customdashboards','intervals','Interval','pauses','Pause','scheduler','Schedule','tags','Tag','Template','triggers','Trigger','trunks','Trunk','variables','Variable','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','Sequelize','QueryTypes','SELECT','ui.','InteractionId','from','user_has_','where','ui.UserId\x20=\x20?','sequelize','toString','OpenTabs','define','UserProfile','user_profiles','query','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','UserProfileSection','find','params','ignore','union','push','autoAssociation','all'];(function(_0x24c24e,_0x1649a0){var _0x2b0732=function(_0x112e87){while(--_0x112e87){_0x24c24e['push'](_0x24c24e['shift']());}};_0x2b0732(++_0x1649a0);}(_0xbcfc,0xe7));var _0xcbcf=function(_0x402ad4,_0x39e219){_0x402ad4=_0x402ad4-0x0;var _0x2a6c97=_0xbcfc[_0x402ad4];return _0x2a6c97;};'use strict';var _=require(_0xcbcf('0x0'));var attributes=require('./userProfile.attributes');var qs=require(_0xcbcf('0x1'));var squel=require(_0xcbcf('0x2'));module['exports']=function(_0x56f1dc){var _0x839a2b=_0x56f1dc[_0xcbcf('0x3')];function _0x5c8090(_0x38d114,_0x1bca33){return new Promise(function(_0x1646c5,_0x1ffcf4){if(!_0x1bca33)return _0x1646c5(null);var _0x1c141a=_0x1bca33[_0xcbcf('0x4')]?{[_0x1bca33[_0xcbcf('0x4')]['field']]:_0x1bca33[_0xcbcf('0x4')][_0xcbcf('0x5')]}:undefined;return _0x839a2b[_0x38d114][_0xcbcf('0x6')]({'where':_0x1c141a,'raw':!![]})['then'](function(_0x1a4c3a){_0x1bca33[_0xcbcf('0x7')]=_[_0xcbcf('0x8')](_0x1a4c3a,'id');_0x1646c5(_0x1bca33);})[_0xcbcf('0x9')](function(_0x8b1118){_0x1ffcf4(_0x8b1118);});});}function _0x514f66(_0xaf4999,_0x523071){return new Promise(function(_0x1ae482,_0x8c9397){var _0x1b7912=_0xaf4999['filter']?{[_0xaf4999['filter'][_0xcbcf('0xa')]]:_0xaf4999[_0xcbcf('0x4')][_0xcbcf('0x5')]}:undefined;return _0x839a2b[_0xaf4999[_0xcbcf('0xb')]][_0xcbcf('0x6')]({'where':_0x1b7912,'raw':!![]})[_0xcbcf('0xc')](function(_0x203c92){_0x523071['associatedResources']=_[_0xcbcf('0x8')](_0x203c92,function(_0x111001){return _0x111001[_0xcbcf('0xd')];});_0x1ae482(_0x523071);})['catch'](function(_0x44da69){_0x8c9397(_0x44da69);});});}function _0x10eb1b(_0x16186f,_0x238af1,_0xbe50ce){if(!_0x238af1)return Promise[_0xcbcf('0xe')](null);return new Promise(function(_0x184785,_0x426612){return _0x839a2b['UserProfileResource'][_0xcbcf('0x6')]({'where':{'sectionId':_0x238af1['id']},'raw':!![]})['then'](function(_0x4e460c){if(_0x16186f[_0xcbcf('0xa')]&&_0x16186f[_0xcbcf('0xa')]!=='id'){_0x238af1[_0xcbcf('0x7')]=_[_0xcbcf('0x8')](_0x4e460c,function(_0x1e3c55){return _0x1e3c55[_0x16186f[_0xcbcf('0xa')]];});}else{if(_0xbe50ce===_0xcbcf('0xf')){_0x238af1[_0xcbcf('0x7')]=_[_0xcbcf('0x8')](_0x4e460c,function(_0x26b014){return{'id':_0x26b014[_0xcbcf('0x10')],'type':_0x26b014[_0xcbcf('0x11')]};});}else{_0x238af1[_0xcbcf('0x7')]=_[_0xcbcf('0x8')](_0x4e460c,function(_0x2c8ff0){return _0x2c8ff0['resourceId'];});}}_0x184785(_0x238af1);})[_0xcbcf('0x9')](function(_0x232415){_0x426612(_0x232415);});});}function _0x76b4cb(_0x313097,_0x16832b){var _0x455b18={'parentSections':[]};switch(_0x313097['toLowerCase']()){case _0xcbcf('0x12'):_0x455b18['childModel']=_0xcbcf('0x13');break;case _0xcbcf('0x14'):_0x455b18[_0xcbcf('0x15')]='SquareOdbc';break;case _0xcbcf('0x16'):_0x455b18[_0xcbcf('0x15')]=_0xcbcf('0x17');_0x455b18[_0xcbcf('0x18')]=[{'name':_0xcbcf('0x19'),'field':_0xcbcf('0xd'),'foreignKey':'projectName'}];break;case'projects':_0x455b18['childModel']=_0xcbcf('0x1a');break;case'contacts':_0x455b18[_0xcbcf('0x15')]='CmContact';_0x455b18[_0xcbcf('0x18')]=[{'name':_0xcbcf('0x1b'),'field':'id','foreignKey':_0xcbcf('0x1c')}];break;case _0xcbcf('0x1d'):_0x455b18[_0xcbcf('0x15')]=_0xcbcf('0x1e');break;case _0xcbcf('0x1f'):_0x455b18['childModel']='CmCompany';break;case'globalcustomfields':_0x455b18[_0xcbcf('0x15')]=_0xcbcf('0x20');break;case _0xcbcf('0x21'):_0x455b18[_0xcbcf('0x15')]=_0xcbcf('0x22');break;case _0xcbcf('0x23'):_0x455b18[_0xcbcf('0x15')]=_0xcbcf('0x24');break;case _0xcbcf('0x25'):_0x455b18['childModel']=_0xcbcf('0x26');break;case'faxaccounts':_0x455b18[_0xcbcf('0x15')]=_0xcbcf('0x27');break;case _0xcbcf('0x28'):case _0xcbcf('0x29'):case'outboundroutes':_0x455b18[_0xcbcf('0x15')]=_0xcbcf('0x2a');break;case'contexts':_0x455b18['childModel']=_0xcbcf('0x2b');break;case _0xcbcf('0x2c'):_0x455b18[_0xcbcf('0x15')]='VoiceMail';break;case _0xcbcf('0x2d'):_0x455b18[_0xcbcf('0x15')]=_0xcbcf('0x2e');_0x455b18[_0xcbcf('0x18')]=[{'name':_0xcbcf('0x2f'),'field':_0xcbcf('0xd'),'foreignKey':_0xcbcf('0x30'),'model':_0xcbcf('0x31'),'filter':{'field':'role','value':['agent']}},{'name':_0xcbcf('0x32'),'field':_0xcbcf('0xd'),'foreignKey':_0xcbcf('0x30'),'model':'User','filter':{'field':_0xcbcf('0x33'),'value':[_0xcbcf('0x34')]}},{'name':_0xcbcf('0x35'),'field':'name','foreignKey':_0xcbcf('0x36'),'model':_0xcbcf('0x37'),'filter':{'field':_0xcbcf('0x11'),'value':[_0xcbcf('0x38')]}},{'name':_0xcbcf('0x39'),'field':_0xcbcf('0xd'),'foreignKey':_0xcbcf('0x36'),'model':'VoiceQueue','filter':{'field':_0xcbcf('0x11'),'value':[_0xcbcf('0x3a')]}}];break;case _0xcbcf('0x3b'):_0x455b18[_0xcbcf('0x15')]=_0xcbcf('0x3c');break;case'chanspies':_0x455b18[_0xcbcf('0x15')]=_0xcbcf('0x3d');break;case'voiceprefixes':_0x455b18[_0xcbcf('0x15')]=_0xcbcf('0x3e');break;case _0xcbcf('0x3f'):_0x455b18[_0xcbcf('0x15')]=_0xcbcf('0x40');break;case _0xcbcf('0x41'):_0x455b18[_0xcbcf('0x15')]=_0xcbcf('0x42');break;case _0xcbcf('0x43'):_0x455b18['childModel']=_0xcbcf('0x44');break;case _0xcbcf('0x45'):_0x455b18[_0xcbcf('0x15')]=_0xcbcf('0x46');break;case'openchannelqueues':_0x455b18[_0xcbcf('0x15')]=_0xcbcf('0x47');break;case'openchannelaccounts':_0x455b18['childModel']=_0xcbcf('0x48');break;case'smsqueues':_0x455b18[_0xcbcf('0x15')]=_0xcbcf('0x49');break;case _0xcbcf('0x4a'):_0x455b18[_0xcbcf('0x15')]='SmsAccount';break;case _0xcbcf('0x4b'):_0x455b18[_0xcbcf('0x15')]=_0xcbcf('0x4c');break;case _0xcbcf('0x4d'):_0x455b18['childModel']=_0xcbcf('0x4e');break;case _0xcbcf('0x4f'):_0x455b18[_0xcbcf('0x15')]=_0xcbcf('0x50');break;case'voicequeues':case _0xcbcf('0x51'):_0x455b18[_0xcbcf('0x15')]='VoiceQueue';if(_0x16832b){_0x455b18[_0xcbcf('0x18')]=[{'name':_0xcbcf('0x35')},{'name':_0xcbcf('0x39')}];}break;case _0xcbcf('0x52'):case _0xcbcf('0x53'):case'telephones':_0x455b18[_0xcbcf('0x15')]=_0xcbcf('0x31');if(_0x16832b){_0x455b18[_0xcbcf('0x18')]=[{'name':_0xcbcf('0x54'),'filter':{'field':_0xcbcf('0x33'),'value':[_0xcbcf('0x55'),_0xcbcf('0x56')]},'ignore':!![]},{'name':_0xcbcf('0x2f')},{'name':_0xcbcf('0x32')}];}break;case _0xcbcf('0x57'):_0x455b18[_0xcbcf('0x15')]=_0xcbcf('0x58');break;case _0xcbcf('0x59'):_0x455b18[_0xcbcf('0x15')]=_0xcbcf('0x5a');break;case _0xcbcf('0x5b'):_0x455b18[_0xcbcf('0x15')]='FreshdeskAccount';break;case _0xcbcf('0x5c'):_0x455b18[_0xcbcf('0x15')]=_0xcbcf('0x5d');break;case _0xcbcf('0x5e'):_0x455b18[_0xcbcf('0x15')]='DeskAccount';break;case _0xcbcf('0x5f'):_0x455b18[_0xcbcf('0x15')]=_0xcbcf('0x60');break;case _0xcbcf('0x61'):_0x455b18[_0xcbcf('0x15')]='User';break;case _0xcbcf('0x62'):_0x455b18[_0xcbcf('0x15')]=_0xcbcf('0x63');break;case _0xcbcf('0x64'):_0x455b18[_0xcbcf('0x15')]='Disposition';break;case _0xcbcf('0x65'):_0x455b18[_0xcbcf('0x15')]='Dashboard';break;case _0xcbcf('0x66'):_0x455b18['childModel']=_0xcbcf('0x67');break;case _0xcbcf('0x68'):_0x455b18['childModel']=_0xcbcf('0x69');break;case _0xcbcf('0x6a'):_0x455b18['childModel']=_0xcbcf('0x6b');break;case'sounds':_0x455b18['childModel']='Sound';break;case _0xcbcf('0x6c'):_0x455b18[_0xcbcf('0x15')]=_0xcbcf('0x6d');break;case'templates':_0x455b18[_0xcbcf('0x15')]=_0xcbcf('0x6e');break;case _0xcbcf('0x6f'):_0x455b18['childModel']=_0xcbcf('0x70');break;case _0xcbcf('0x71'):_0x455b18[_0xcbcf('0x15')]=_0xcbcf('0x72');break;case _0xcbcf('0x73'):_0x455b18[_0xcbcf('0x15')]=_0xcbcf('0x74');break;case'plugins':_0x455b18[_0xcbcf('0x15')]=_0xcbcf('0x75');break;case _0xcbcf('0x76'):_0x455b18[_0xcbcf('0x15')]=_0xcbcf('0xf');_0x455b18[_0xcbcf('0x18')]=[{'name':_0xcbcf('0x77'),'field':'id','foreignKey':_0xcbcf('0x78')}];break;case _0xcbcf('0x79'):_0x455b18[_0xcbcf('0x15')]=_0xcbcf('0x7a');break;}return _0x455b18;}function _0xdaa03b(_0x551908,_0x446f5b){var _0x265cbe=_0x551908[_0xcbcf('0x7b')](0x0)[_0xcbcf('0x7c')]()+_0x551908['slice'](0x1);var _0x52a0a3={'type':_0x839a2b[_0xcbcf('0x7d')][_0xcbcf('0x7e')][_0xcbcf('0x7f')],'raw':!![]};return new Promise(function(_0x8f6cd5,_0x45e8ff){var _0x3081a8=squel['select']()['field'](_0xcbcf('0x80')+_0x265cbe+_0xcbcf('0x81'),'id')[_0xcbcf('0xa')]('ui.createdAt')[_0xcbcf('0x82')](_0xcbcf('0x83')+_0x551908+'_interactions','ui')[_0xcbcf('0x84')](_0xcbcf('0x85'),_0x446f5b['id']);return _0x839a2b[_0xcbcf('0x86')]['query'](_0x3081a8[_0xcbcf('0x87')](),_0x52a0a3)['then'](function(_0x2b1aa2){_0x446f5b[_0x265cbe+_0xcbcf('0x88')]=_0x2b1aa2;_0x8f6cd5(_0x2b1aa2);})['catch'](function(_0x3584c7){_0x45e8ff(_0x3584c7);});});}return _0x56f1dc[_0xcbcf('0x89')](_0xcbcf('0x8a'),attributes,{'tableName':_0xcbcf('0x8b'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x5c8667){var _0x26afe0={'raw':_0x5c8667[_0xcbcf('0x8c')][_0xcbcf('0x8d')],'where':{}};var _0x46224e={};var _0x3a21dd={'count':0x0,'rows':[]};var _0x11bc9d=_0x5c8667[_0xcbcf('0x8c')][_0xcbcf('0x8e')];var _0x21ef78=_0x5c8667['query'][_0xcbcf('0x8f')]||![];var _0xe2b5a8=_0x76b4cb(_0x11bc9d,_0x21ef78);if(!_0xe2b5a8['childModel'])throw new Error(_0xcbcf('0x90')+_0x11bc9d+'\x27');var _0x27d182=[{'name':_0x11bc9d}];if(!_[_0xcbcf('0x91')](_0xe2b5a8[_0xcbcf('0x18')]))_0x27d182=_0xe2b5a8['parentSections'];var _0x421372=[];for(var _0xf5f604=0x0;_0xf5f604<_0x27d182[_0xcbcf('0x92')];_0xf5f604++){_0x421372['push'](_0x839a2b[_0xcbcf('0x93')][_0xcbcf('0x94')]({'where':{'userProfileId':_0x5c8667[_0xcbcf('0x95')]['id'],'name':_0x27d182[_0xf5f604][_0xcbcf('0xd')]},'raw':!![]}));}return Promise['all'](_0x421372)['then'](function(_0x5a41cf){var _0x562021=_['filter'](_0x5a41cf,function(_0x425ba2){return _0x425ba2?_0x425ba2:undefined;});var _0x1e1a0d=_[_0xcbcf('0x4')](_0x27d182,[_0xcbcf('0x96'),!![]]);var _0x40b8c6=_[_0xcbcf('0x91')](_0x562021)&&_[_0xcbcf('0x91')](_0x1e1a0d)?null:_[_0xcbcf('0x97')](_0x1e1a0d,_0x562021);if(!_0x40b8c6)return null;var _0x24b749=[];for(var _0x2b2b28=0x0;_0x2b2b28<_0x40b8c6[_0xcbcf('0x92')];_0x2b2b28++){var _0x4b14f3=_[_0xcbcf('0x94')](_0x27d182,function(_0x208fe3){return _0x40b8c6[_0x2b2b28]?_0x208fe3[_0xcbcf('0xd')]===_0x40b8c6[_0x2b2b28][_0xcbcf('0xd')]:null;});if(_0x4b14f3){if(_0x40b8c6[_0x2b2b28][_0xcbcf('0x96')]){_0x24b749[_0xcbcf('0x98')](_0x5c8090(_0xe2b5a8[_0xcbcf('0x15')],_0x40b8c6[_0x2b2b28]));}else{if(!_0x40b8c6[_0x2b2b28][_0xcbcf('0x99')]){_0x24b749[_0xcbcf('0x98')](_0x10eb1b(_0x4b14f3,_0x40b8c6[_0x2b2b28],_0xe2b5a8[_0xcbcf('0x15')]));}else{if(_0x4b14f3['model']){_0x24b749[_0xcbcf('0x98')](_0x514f66(_0x4b14f3,_0x40b8c6[_0x2b2b28]));}}}}}return Promise[_0xcbcf('0x9a')](_0x24b749);})[_0xcbcf('0xc')](function(_0x1c15ef){var _0x306393=_0x1c15ef;var _0xe0cbd0=null;if(_0x306393){_0xe0cbd0=_0x306393['length']===0x1?_0x306393[0x0]:null;}if(!_0xe0cbd0&&!_0x306393)return _0x3a21dd;var _0x19699f=_0x839a2b[_0xe2b5a8[_0xcbcf('0x15')]][_0xcbcf('0x9b')];_0x46224e[_0xcbcf('0xb')]=_[_0xcbcf('0x9c')](_0x19699f);_0x46224e[_0xcbcf('0x8c')]=_[_0xcbcf('0x9c')](_0x5c8667[_0xcbcf('0x8c')]);_0x46224e[_0xcbcf('0x9d')]=_['intersection'](_0x46224e[_0xcbcf('0xb')],_0x46224e[_0xcbcf('0x8c')]);_0x26afe0['attributes']=_[_0xcbcf('0x9e')](_0x46224e[_0xcbcf('0xb')],qs[_0xcbcf('0x9f')](_0x5c8667[_0xcbcf('0x8c')][_0xcbcf('0x9f')]));_0x26afe0[_0xcbcf('0xa0')]=_0x26afe0[_0xcbcf('0xa0')]['length']?_0x26afe0[_0xcbcf('0xa0')]:_0x46224e[_0xcbcf('0xb')];if(!_0x5c8667[_0xcbcf('0x8c')][_0xcbcf('0xa1')](_0xcbcf('0xa2'))){_0x26afe0[_0xcbcf('0xa3')]=qs[_0xcbcf('0xa3')](_0x5c8667[_0xcbcf('0x8c')]['limit']);_0x26afe0[_0xcbcf('0xa4')]=qs[_0xcbcf('0xa4')](_0x5c8667[_0xcbcf('0x8c')]['offset']);}_0x26afe0[_0xcbcf('0xa5')]=qs[_0xcbcf('0xa6')](_0x5c8667[_0xcbcf('0x8c')]['sort']);_0x26afe0[_0xcbcf('0x84')]=qs[_0xcbcf('0x9d')](_[_0xcbcf('0xa7')](_0x5c8667[_0xcbcf('0x8c')],_0x46224e['filters']));if(_0x5c8667[_0xcbcf('0x8c')][_0xcbcf('0x4')]){_0x26afe0['where']=_[_0xcbcf('0xa8')](_0x26afe0['where'],{'$or':_[_0xcbcf('0x8')](_0x19699f,function(_0x2f2cdf){if(_0x2f2cdf[_0xcbcf('0x11')][_0xcbcf('0xa9')]!=='VIRTUAL'){var _0x501024={};_0x501024[_0x2f2cdf[_0xcbcf('0xa')]]={'$like':'%'+_0x5c8667['query'][_0xcbcf('0x4')]+'%'};return _0x501024;}})});}var _0xff2f92=[];var _0x550de8=null;var _0x2499e1={};if(_0xe0cbd0){_0x550de8=_['find'](_0x27d182,[_0xcbcf('0xd'),_0xe0cbd0[_0xcbcf('0xd')]]);if(_0x550de8[_0xcbcf('0xa')]){_0x2499e1={};if(_0xe2b5a8['childModel']===_0xcbcf('0xf')){_0x2499e1[_0x550de8[_0xcbcf('0xaa')]]=_[_0xcbcf('0x8')](_0xe0cbd0[_0xcbcf('0x7')],'id');}else{_0x2499e1[_0x550de8[_0xcbcf('0xaa')]]=_0xe0cbd0[_0xcbcf('0x7')];}_0xff2f92[_0xcbcf('0x98')](_0x2499e1);}else{_0x26afe0['where']['id']=_0xe0cbd0[_0xcbcf('0x7')];}}else{for(var _0x5ad506=0x0;_0x5ad506<_0x306393[_0xcbcf('0x92')];_0x5ad506++){_0x550de8=_[_0xcbcf('0x94')](_0x27d182,[_0xcbcf('0xd'),_0x306393[_0x5ad506][_0xcbcf('0xd')]]);if(_0x550de8[_0xcbcf('0xa')]){_0x2499e1={};_0x2499e1[_0x550de8['foreignKey']]=_0x306393[_0x5ad506][_0xcbcf('0x7')];_0xff2f92['push'](_0x2499e1);}else{if(!_0x26afe0[_0xcbcf('0x84')]['id'])_0x26afe0[_0xcbcf('0x84')]['id']=[];_0x306393[_0x5ad506]['associatedResources']['forEach'](function(_0x3d4490){_0x26afe0[_0xcbcf('0x84')]['id'][_0xcbcf('0x98')](_0x3d4490);});}}}if(!_[_0xcbcf('0x91')](_0xff2f92)){_0x26afe0[_0xcbcf('0x84')]=_[_0xcbcf('0xa8')](_0x26afe0[_0xcbcf('0x84')],{'$and':{'$or':_0xff2f92}});}_0x26afe0=_[_0xcbcf('0xa8')]({},_0x26afe0,_0x5c8667[_0xcbcf('0xab')]);if(_0xe0cbd0&&!_0xe0cbd0[_0xcbcf('0x99')]&&_0xe2b5a8[_0xcbcf('0x15')]===_0xcbcf('0xf')){if(_0x5c8667[_0xcbcf('0x8c')]['includeAll']){_0x26afe0[_0xcbcf('0xac')]=[{'all':!![]}];}return _0x839a2b[_0xe2b5a8[_0xcbcf('0x15')]]['findAll'](_0x26afe0)[_0xcbcf('0xc')](function(_0x51f227){var _0x42b30e=[];_0x51f227['forEach'](function(_0x191a53){var _0x1ea101;switch(_0x191a53['reportType']){case'default':_0x1ea101=_['find'](_0xe0cbd0[_0xcbcf('0x7')],function(_0x493ffc){return _0x493ffc['id']===_0x191a53[_0xcbcf('0x78')]&&_0x493ffc['type']===_0xcbcf('0xad');});break;case _0xcbcf('0xae'):_0x1ea101=_[_0xcbcf('0x94')](_0xe0cbd0[_0xcbcf('0x7')],function(_0xb246dd){return _0xb246dd['id']===_0x191a53['reportId']&&_0xb246dd[_0xcbcf('0x11')]===_0xcbcf('0xaf');});break;}if(_0x1ea101)_0x42b30e['push'](_0x191a53);});_0x3a21dd[_0xcbcf('0xb0')]=_0x42b30e['length'];_0x3a21dd[_0xcbcf('0xb1')]=_0x42b30e;return _0x3a21dd;});}else{if(!_[_0xcbcf('0x91')](_0x5c8667[_0xcbcf('0x8c')]['ids'])){_0x26afe0[_0xcbcf('0x84')]['id']=_0x26afe0[_0xcbcf('0x84')]['id']?_[_0xcbcf('0x9e')](_0x26afe0[_0xcbcf('0x84')]['id'],_0x5c8667['query'][_0xcbcf('0xb2')]):_0x5c8667[_0xcbcf('0x8c')][_0xcbcf('0xb2')];if(_0x5c8667['query']['customSorting']){_0x26afe0['order']=_0x5c8667[_0xcbcf('0x8c')][_0xcbcf('0xb3')];}}if(_0x5c8667[_0xcbcf('0x8c')]['extraQueryConditions']){_0x26afe0['where']=_[_0xcbcf('0xa8')](_0x26afe0[_0xcbcf('0x84')],{'$and':_0x5c8667[_0xcbcf('0x8c')][_0xcbcf('0xb4')]});}return _0x839a2b[_0xe2b5a8[_0xcbcf('0x15')]][_0xcbcf('0xb0')]({'where':_0x26afe0['where']})[_0xcbcf('0xc')](function(_0x273cbe){_0x3a21dd[_0xcbcf('0xb0')]=_0x273cbe;if(_0x5c8667['query'][_0xcbcf('0xb5')]){if(_0xe2b5a8[_0xcbcf('0x15')]===_0xcbcf('0xb6')){_0x26afe0['include']=[{'model':_0x839a2b[_0xcbcf('0x6d')],'as':_0xcbcf('0xb7'),'attributes':['id','name',_0xcbcf('0xb8')],'required':_0x5c8667[_0xcbcf('0x8c')][_0xcbcf('0xb9')]?!![]:![]},{'model':_0x839a2b[_0xcbcf('0x6d')],'as':_0xcbcf('0xba'),'attributes':['id',_0xcbcf('0xd'),_0xcbcf('0xb8')],'through':_0x5c8667['query'][_0xcbcf('0xb9')]?{'attributes':[],'where':{'TagId':_0x5c8667[_0xcbcf('0x8c')]['tag']||undefined}}:{},'required':_0x5c8667[_0xcbcf('0x8c')][_0xcbcf('0xb9')]?!![]:![]}];}else{_0x26afe0[_0xcbcf('0xac')]=[{'all':!![]}];}}return _0x839a2b[_0xe2b5a8[_0xcbcf('0x15')]][_0xcbcf('0x6')](_0x26afe0);})['then'](function(_0x3ee494){_0x3a21dd['rows']=_0x3ee494;if(_0x11bc9d===_0xcbcf('0x2f')&&_0x5c8667[_0xcbcf('0x8c')]['openTabs']===_0xcbcf('0xbb')){var _0x552f76=[];for(var _0x17b435=0x0;_0x17b435<_0x3a21dd[_0xcbcf('0xb1')]['length'];_0x17b435++){_0x552f76[_0xcbcf('0x98')](_0xdaa03b(_0xcbcf('0xbc'),_0x3a21dd[_0xcbcf('0xb1')][_0x17b435][_0xcbcf('0xbd')]));_0x552f76['push'](_0xdaa03b(_0xcbcf('0xbe'),_0x3a21dd[_0xcbcf('0xb1')][_0x17b435][_0xcbcf('0xbd')]));_0x552f76[_0xcbcf('0x98')](_0xdaa03b('fax',_0x3a21dd[_0xcbcf('0xb1')][_0x17b435][_0xcbcf('0xbd')]));_0x552f76[_0xcbcf('0x98')](_0xdaa03b(_0xcbcf('0xbf'),_0x3a21dd[_0xcbcf('0xb1')][_0x17b435]['dataValues']));_0x552f76[_0xcbcf('0x98')](_0xdaa03b(_0xcbcf('0xc0'),_0x3a21dd[_0xcbcf('0xb1')][_0x17b435][_0xcbcf('0xbd')]));_0x552f76[_0xcbcf('0x98')](_0xdaa03b('whatsapp',_0x3a21dd[_0xcbcf('0xb1')][_0x17b435]['dataValues']));}return Promise[_0xcbcf('0x9a')](_0x552f76)[_0xcbcf('0xc')](function(){return _0x3a21dd;});}return _0x3a21dd;});}});}}});}; \ No newline at end of file +var _0x6728=['push','UserProfileSection','find','params','all','ignore','isEmpty','autoAssociation','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','sort','pick','merge','key','VIRTUAL','foreignKey','forEach','options','include','reportType','default','DefaultReports','CustomReports','count','ids','customSorting','order','extraQueryConditions','includeAll','Tags','color','tag','ThroughTags','rows','openTabs','dataValues','sms','fax','mail','openchannel','lodash','../../components/parsers/qs','squel','exports','models','filter','value','then','map','field','model','associatedResources','name','catch','resolve','findAll','AnalyticExtractedReport','resourceId','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','parentSections','SquareProjects','projectName','JscriptyProject','CmContact','Lists','ListId','CmList','companies','CmCustomField','chatqueues','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','outboundroutes','contexts','VoiceContext','voicemails','VoiceMail','Agents','membername','User','role','agent','telephone','VoiceQueues','queue','VoiceQueue','type','inbound','outbound','VoiceMusicOnHold','chanspies','voiceprefixes','ivrcampaigns','Campaign','mailqueues','MailQueue','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','user','zendeskaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','zohoaccounts','vtigeraccounts','dispositions','Dashboard','intervals','Interval','pauses','scheduler','Schedule','sounds','Sound','tags','Tag','Template','triggers','trunks','Variable','plugins','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','where','ui.UserId\x20=\x20?','query','toString','OpenTabs','user_profiles','section','Invalid\x20section\x20\x27','length'];(function(_0x2dce47,_0x80c9e){var _0x413bf5=function(_0x1e648a){while(--_0x1e648a){_0x2dce47['push'](_0x2dce47['shift']());}};_0x413bf5(++_0x80c9e);}(_0x6728,0x199));var _0x8672=function(_0x8ba19a,_0x1d2b2b){_0x8ba19a=_0x8ba19a-0x0;var _0x2bd8b4=_0x6728[_0x8ba19a];return _0x2bd8b4;};'use strict';var _=require(_0x8672('0x0'));var attributes=require('./userProfile.attributes');var qs=require(_0x8672('0x1'));var squel=require(_0x8672('0x2'));module[_0x8672('0x3')]=function(_0x54cf0a){var _0x266d9a=_0x54cf0a[_0x8672('0x4')];function _0x41297f(_0x239fd6,_0x317494){return new Promise(function(_0x91afa9,_0x3894d9){if(!_0x317494)return _0x91afa9(null);var _0x3eee07=_0x317494[_0x8672('0x5')]?{[_0x317494[_0x8672('0x5')]['field']]:_0x317494[_0x8672('0x5')][_0x8672('0x6')]}:undefined;return _0x266d9a[_0x239fd6]['findAll']({'where':_0x3eee07,'raw':!![]})[_0x8672('0x7')](function(_0x2dcd38){_0x317494['associatedResources']=_[_0x8672('0x8')](_0x2dcd38,'id');_0x91afa9(_0x317494);})['catch'](function(_0x1230a7){_0x3894d9(_0x1230a7);});});}function _0x3dec69(_0x48362c,_0x1283fb){return new Promise(function(_0x52596e,_0x561ff4){var _0x33e57a=_0x48362c[_0x8672('0x5')]?{[_0x48362c[_0x8672('0x5')][_0x8672('0x9')]]:_0x48362c[_0x8672('0x5')]['value']}:undefined;return _0x266d9a[_0x48362c[_0x8672('0xa')]]['findAll']({'where':_0x33e57a,'raw':!![]})[_0x8672('0x7')](function(_0x11751f){_0x1283fb[_0x8672('0xb')]=_[_0x8672('0x8')](_0x11751f,function(_0x264201){return _0x264201[_0x8672('0xc')];});_0x52596e(_0x1283fb);})[_0x8672('0xd')](function(_0x54c7ec){_0x561ff4(_0x54c7ec);});});}function _0x452c5a(_0x33131a,_0x29cf29,_0x2e3eb3){if(!_0x29cf29)return Promise[_0x8672('0xe')](null);return new Promise(function(_0x205db0,_0x2a2a1e){return _0x266d9a['UserProfileResource'][_0x8672('0xf')]({'where':{'sectionId':_0x29cf29['id']},'raw':!![]})['then'](function(_0xb67399){if(_0x33131a[_0x8672('0x9')]&&_0x33131a['field']!=='id'){_0x29cf29['associatedResources']=_[_0x8672('0x8')](_0xb67399,function(_0x3616d1){return _0x3616d1[_0x33131a[_0x8672('0x9')]];});}else{if(_0x2e3eb3===_0x8672('0x10')){_0x29cf29[_0x8672('0xb')]=_[_0x8672('0x8')](_0xb67399,function(_0x48de81){return{'id':_0x48de81[_0x8672('0x11')],'type':_0x48de81['type']};});}else{_0x29cf29['associatedResources']=_[_0x8672('0x8')](_0xb67399,function(_0x39a96d){return _0x39a96d[_0x8672('0x11')];});}}_0x205db0(_0x29cf29);})[_0x8672('0xd')](function(_0x4f615a){_0x2a2a1e(_0x4f615a);});});}function _0x58151d(_0x4fb02a,_0x3d2fd8){var _0x545455={'parentSections':[]};switch(_0x4fb02a[_0x8672('0x12')]()){case _0x8672('0x13'):_0x545455[_0x8672('0x14')]=_0x8672('0x15');break;case _0x8672('0x16'):_0x545455['childModel']=_0x8672('0x17');break;case'squarerecordings':_0x545455['childModel']='SquareRecording';_0x545455[_0x8672('0x18')]=[{'name':_0x8672('0x19'),'field':_0x8672('0xc'),'foreignKey':_0x8672('0x1a')}];break;case'projects':_0x545455['childModel']=_0x8672('0x1b');break;case'contacts':_0x545455[_0x8672('0x14')]=_0x8672('0x1c');_0x545455[_0x8672('0x18')]=[{'name':_0x8672('0x1d'),'field':'id','foreignKey':_0x8672('0x1e')}];break;case'lists':_0x545455[_0x8672('0x14')]=_0x8672('0x1f');break;case _0x8672('0x20'):_0x545455['childModel']='CmCompany';break;case'globalcustomfields':_0x545455[_0x8672('0x14')]=_0x8672('0x21');break;case _0x8672('0x22'):_0x545455[_0x8672('0x14')]='ChatQueue';break;case _0x8672('0x23'):_0x545455[_0x8672('0x14')]=_0x8672('0x24');break;case _0x8672('0x25'):_0x545455[_0x8672('0x14')]=_0x8672('0x26');break;case _0x8672('0x27'):_0x545455[_0x8672('0x14')]=_0x8672('0x28');break;case'inboundroutes':case'internalroutes':case _0x8672('0x29'):_0x545455[_0x8672('0x14')]='VoiceExtension';break;case _0x8672('0x2a'):_0x545455[_0x8672('0x14')]=_0x8672('0x2b');break;case _0x8672('0x2c'):_0x545455[_0x8672('0x14')]=_0x8672('0x2d');break;case'voicerecordings':_0x545455[_0x8672('0x14')]='VoiceRecording';_0x545455['parentSections']=[{'name':_0x8672('0x2e'),'field':'name','foreignKey':_0x8672('0x2f'),'model':_0x8672('0x30'),'filter':{'field':_0x8672('0x31'),'value':[_0x8672('0x32')]}},{'name':'Telephones','field':'name','foreignKey':_0x8672('0x2f'),'model':_0x8672('0x30'),'filter':{'field':_0x8672('0x31'),'value':[_0x8672('0x33')]}},{'name':_0x8672('0x34'),'field':_0x8672('0xc'),'foreignKey':_0x8672('0x35'),'model':_0x8672('0x36'),'filter':{'field':_0x8672('0x37'),'value':[_0x8672('0x38')]}},{'name':'QueueCampaigns','field':_0x8672('0xc'),'foreignKey':_0x8672('0x35'),'model':_0x8672('0x36'),'filter':{'field':_0x8672('0x37'),'value':[_0x8672('0x39')]}}];break;case'musiconholds':_0x545455[_0x8672('0x14')]=_0x8672('0x3a');break;case _0x8672('0x3b'):_0x545455['childModel']='VoiceChanSpy';break;case _0x8672('0x3c'):_0x545455[_0x8672('0x14')]='VoicePrefix';break;case _0x8672('0x3d'):_0x545455[_0x8672('0x14')]=_0x8672('0x3e');break;case _0x8672('0x3f'):_0x545455['childModel']=_0x8672('0x40');break;case'mailaccounts':_0x545455[_0x8672('0x14')]=_0x8672('0x41');break;case _0x8672('0x42'):_0x545455[_0x8672('0x14')]=_0x8672('0x43');break;case _0x8672('0x44'):_0x545455[_0x8672('0x14')]=_0x8672('0x45');break;case _0x8672('0x46'):_0x545455[_0x8672('0x14')]='OpenchannelAccount';break;case'smsqueues':_0x545455[_0x8672('0x14')]=_0x8672('0x47');break;case _0x8672('0x48'):_0x545455['childModel']=_0x8672('0x49');break;case _0x8672('0x4a'):_0x545455[_0x8672('0x14')]='WhatsappQueue';break;case _0x8672('0x4b'):_0x545455[_0x8672('0x14')]=_0x8672('0x4c');break;case _0x8672('0x4d'):_0x545455['childModel']=_0x8672('0x4e');break;case _0x8672('0x4f'):case _0x8672('0x50'):_0x545455[_0x8672('0x14')]='VoiceQueue';if(_0x3d2fd8){_0x545455[_0x8672('0x18')]=[{'name':_0x8672('0x34')},{'name':'QueueCampaigns'}];}break;case _0x8672('0x51'):case _0x8672('0x52'):case _0x8672('0x53'):_0x545455[_0x8672('0x14')]=_0x8672('0x30');if(_0x3d2fd8){_0x545455[_0x8672('0x18')]=[{'name':'Users','filter':{'field':_0x8672('0x31'),'value':['admin',_0x8672('0x54')]},'ignore':!![]},{'name':_0x8672('0x2e')},{'name':'Telephones'}];}break;case _0x8672('0x55'):_0x545455[_0x8672('0x14')]='ZendeskAccount';break;case'salesforceaccounts':_0x545455[_0x8672('0x14')]=_0x8672('0x56');break;case'freshdeskaccounts':_0x545455['childModel']=_0x8672('0x57');break;case _0x8672('0x58'):_0x545455[_0x8672('0x14')]=_0x8672('0x59');break;case'deskaccounts':_0x545455[_0x8672('0x14')]='DeskAccount';break;case _0x8672('0x5a'):_0x545455[_0x8672('0x14')]='ZohoAccount';break;case _0x8672('0x5b'):_0x545455['childModel']=_0x8672('0x30');break;case'cannedanswers':_0x545455['childModel']='CannedAnswer';break;case _0x8672('0x5c'):_0x545455[_0x8672('0x14')]='Disposition';break;case'customdashboards':_0x545455[_0x8672('0x14')]=_0x8672('0x5d');break;case _0x8672('0x5e'):_0x545455[_0x8672('0x14')]=_0x8672('0x5f');break;case _0x8672('0x60'):_0x545455[_0x8672('0x14')]='Pause';break;case _0x8672('0x61'):_0x545455[_0x8672('0x14')]=_0x8672('0x62');break;case _0x8672('0x63'):_0x545455[_0x8672('0x14')]=_0x8672('0x64');break;case _0x8672('0x65'):_0x545455['childModel']=_0x8672('0x66');break;case'templates':_0x545455['childModel']=_0x8672('0x67');break;case _0x8672('0x68'):_0x545455[_0x8672('0x14')]='Trigger';break;case _0x8672('0x69'):_0x545455['childModel']='Trunk';break;case'variables':_0x545455['childModel']=_0x8672('0x6a');break;case _0x8672('0x6b'):_0x545455['childModel']='Plugin';break;case _0x8672('0x6c'):_0x545455['childModel']=_0x8672('0x10');_0x545455['parentSections']=[{'name':_0x8672('0x6d'),'field':'id','foreignKey':_0x8672('0x6e')}];break;case _0x8672('0x6f'):_0x545455['childModel']=_0x8672('0x70');break;}return _0x545455;}function _0x8be1a0(_0x3c5208,_0x5f3bc9){var _0x340ca2=_0x3c5208[_0x8672('0x71')](0x0)[_0x8672('0x72')]()+_0x3c5208[_0x8672('0x73')](0x1);var _0x561fe0={'type':_0x266d9a[_0x8672('0x74')][_0x8672('0x75')][_0x8672('0x76')],'raw':!![]};return new Promise(function(_0x446029,_0x597371){var _0x42fc7d=squel[_0x8672('0x77')]()[_0x8672('0x9')](_0x8672('0x78')+_0x340ca2+_0x8672('0x79'),'id')[_0x8672('0x9')](_0x8672('0x7a'))[_0x8672('0x7b')](_0x8672('0x7c')+_0x3c5208+'_interactions','ui')[_0x8672('0x7d')](_0x8672('0x7e'),_0x5f3bc9['id']);return _0x266d9a['sequelize'][_0x8672('0x7f')](_0x42fc7d[_0x8672('0x80')](),_0x561fe0)[_0x8672('0x7')](function(_0x716616){_0x5f3bc9[_0x340ca2+_0x8672('0x81')]=_0x716616;_0x446029(_0x716616);})[_0x8672('0xd')](function(_0x39796b){_0x597371(_0x39796b);});});}return _0x54cf0a['define']('UserProfile',attributes,{'tableName':_0x8672('0x82'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x3bbaf6){var _0x11da8d={'raw':_0x3bbaf6[_0x8672('0x7f')]['raw'],'where':{}};var _0x4afbce={};var _0x1c1cff={'count':0x0,'rows':[]};var _0x1c4fb5=_0x3bbaf6['query'][_0x8672('0x83')];var _0x4a4e76=_0x3bbaf6[_0x8672('0x7f')]['mergeResources']||![];var _0x52a341=_0x58151d(_0x1c4fb5,_0x4a4e76);if(!_0x52a341[_0x8672('0x14')])throw new Error(_0x8672('0x84')+_0x1c4fb5+'\x27');var _0x5372e4=[{'name':_0x1c4fb5}];if(!_['isEmpty'](_0x52a341['parentSections']))_0x5372e4=_0x52a341[_0x8672('0x18')];var _0x150cb6=[];for(var _0xfcff60=0x0;_0xfcff60<_0x5372e4[_0x8672('0x85')];_0xfcff60++){_0x150cb6[_0x8672('0x86')](_0x266d9a[_0x8672('0x87')][_0x8672('0x88')]({'where':{'userProfileId':_0x3bbaf6[_0x8672('0x89')]['id'],'name':_0x5372e4[_0xfcff60][_0x8672('0xc')]},'raw':!![]}));}return Promise[_0x8672('0x8a')](_0x150cb6)[_0x8672('0x7')](function(_0x1d7d41){var _0x1f0994=_[_0x8672('0x5')](_0x1d7d41,function(_0x333614){return _0x333614?_0x333614:undefined;});var _0x30da70=_[_0x8672('0x5')](_0x5372e4,[_0x8672('0x8b'),!![]]);var _0x1d4338=_['isEmpty'](_0x1f0994)&&_[_0x8672('0x8c')](_0x30da70)?null:_['union'](_0x30da70,_0x1f0994);if(!_0x1d4338)return null;var _0x10f385=[];for(var _0x1a3f0e=0x0;_0x1a3f0e<_0x1d4338[_0x8672('0x85')];_0x1a3f0e++){var _0x2aa140=_['find'](_0x5372e4,function(_0x188dbf){return _0x1d4338[_0x1a3f0e]?_0x188dbf[_0x8672('0xc')]===_0x1d4338[_0x1a3f0e][_0x8672('0xc')]:null;});if(_0x2aa140){if(_0x1d4338[_0x1a3f0e][_0x8672('0x8b')]){_0x10f385[_0x8672('0x86')](_0x41297f(_0x52a341[_0x8672('0x14')],_0x1d4338[_0x1a3f0e]));}else{if(!_0x1d4338[_0x1a3f0e][_0x8672('0x8d')]){_0x10f385['push'](_0x452c5a(_0x2aa140,_0x1d4338[_0x1a3f0e],_0x52a341[_0x8672('0x14')]));}else{if(_0x2aa140['model']){_0x10f385[_0x8672('0x86')](_0x3dec69(_0x2aa140,_0x1d4338[_0x1a3f0e]));}}}}}return Promise[_0x8672('0x8a')](_0x10f385);})['then'](function(_0x761070){var _0x1ad19c=_0x761070;var _0x22c514=null;if(_0x1ad19c){_0x22c514=_0x1ad19c[_0x8672('0x85')]===0x1?_0x1ad19c[0x0]:null;}if(!_0x22c514&&!_0x1ad19c)return _0x1c1cff;var _0x4f0d65=_0x266d9a[_0x52a341[_0x8672('0x14')]]['rawAttributes'];_0x4afbce[_0x8672('0xa')]=_[_0x8672('0x8e')](_0x4f0d65);_0x4afbce[_0x8672('0x7f')]=_[_0x8672('0x8e')](_0x3bbaf6[_0x8672('0x7f')]);_0x4afbce[_0x8672('0x8f')]=_[_0x8672('0x90')](_0x4afbce['model'],_0x4afbce[_0x8672('0x7f')]);_0x11da8d[_0x8672('0x91')]=_['intersection'](_0x4afbce[_0x8672('0xa')],qs[_0x8672('0x92')](_0x3bbaf6['query'][_0x8672('0x92')]));_0x11da8d['attributes']=_0x11da8d[_0x8672('0x91')][_0x8672('0x85')]?_0x11da8d[_0x8672('0x91')]:_0x4afbce[_0x8672('0xa')];if(!_0x3bbaf6[_0x8672('0x7f')][_0x8672('0x93')](_0x8672('0x94'))){_0x11da8d[_0x8672('0x95')]=qs['limit'](_0x3bbaf6[_0x8672('0x7f')][_0x8672('0x95')]);_0x11da8d[_0x8672('0x96')]=qs[_0x8672('0x96')](_0x3bbaf6[_0x8672('0x7f')]['offset']);}_0x11da8d['order']=qs[_0x8672('0x97')](_0x3bbaf6[_0x8672('0x7f')][_0x8672('0x97')]);_0x11da8d[_0x8672('0x7d')]=qs[_0x8672('0x8f')](_[_0x8672('0x98')](_0x3bbaf6[_0x8672('0x7f')],_0x4afbce[_0x8672('0x8f')]));if(_0x3bbaf6[_0x8672('0x7f')][_0x8672('0x5')]){_0x11da8d['where']=_[_0x8672('0x99')](_0x11da8d[_0x8672('0x7d')],{'$or':_[_0x8672('0x8')](_0x4f0d65,function(_0x4c847d){if(_0x4c847d['type'][_0x8672('0x9a')]!==_0x8672('0x9b')){var _0x35ceb5={};_0x35ceb5[_0x4c847d[_0x8672('0x9')]]={'$like':'%'+_0x3bbaf6[_0x8672('0x7f')][_0x8672('0x5')]+'%'};return _0x35ceb5;}})});}var _0x55c69c=[];var _0x16c373=null;var _0x4ead6c={};if(_0x22c514){_0x16c373=_[_0x8672('0x88')](_0x5372e4,[_0x8672('0xc'),_0x22c514[_0x8672('0xc')]]);if(_0x16c373[_0x8672('0x9')]){_0x4ead6c={};if(_0x52a341['childModel']===_0x8672('0x10')){_0x4ead6c[_0x16c373['foreignKey']]=_[_0x8672('0x8')](_0x22c514['associatedResources'],'id');}else{_0x4ead6c[_0x16c373[_0x8672('0x9c')]]=_0x22c514[_0x8672('0xb')];}_0x55c69c[_0x8672('0x86')](_0x4ead6c);}else{_0x11da8d['where']['id']=_0x22c514[_0x8672('0xb')];}}else{for(var _0x5166d6=0x0;_0x5166d6<_0x1ad19c[_0x8672('0x85')];_0x5166d6++){_0x16c373=_['find'](_0x5372e4,[_0x8672('0xc'),_0x1ad19c[_0x5166d6][_0x8672('0xc')]]);if(_0x16c373[_0x8672('0x9')]){_0x4ead6c={};_0x4ead6c[_0x16c373[_0x8672('0x9c')]]=_0x1ad19c[_0x5166d6]['associatedResources'];_0x55c69c[_0x8672('0x86')](_0x4ead6c);}else{if(!_0x11da8d[_0x8672('0x7d')]['id'])_0x11da8d['where']['id']=[];_0x1ad19c[_0x5166d6][_0x8672('0xb')][_0x8672('0x9d')](function(_0x50181a){_0x11da8d[_0x8672('0x7d')]['id'][_0x8672('0x86')](_0x50181a);});}}}if(!_['isEmpty'](_0x55c69c)){_0x11da8d['where']=_[_0x8672('0x99')](_0x11da8d[_0x8672('0x7d')],{'$and':{'$or':_0x55c69c}});}_0x11da8d=_[_0x8672('0x99')]({},_0x11da8d,_0x3bbaf6[_0x8672('0x9e')]);if(_0x22c514&&!_0x22c514[_0x8672('0x8d')]&&_0x52a341['childModel']===_0x8672('0x10')){if(_0x3bbaf6[_0x8672('0x7f')]['includeAll']){_0x11da8d[_0x8672('0x9f')]=[{'all':!![]}];}return _0x266d9a[_0x52a341[_0x8672('0x14')]][_0x8672('0xf')](_0x11da8d)[_0x8672('0x7')](function(_0x504e05){var _0x14c509=[];_0x504e05['forEach'](function(_0x1e6fe7){var _0x3dc41f;switch(_0x1e6fe7[_0x8672('0xa0')]){case _0x8672('0xa1'):_0x3dc41f=_[_0x8672('0x88')](_0x22c514[_0x8672('0xb')],function(_0x14ff44){return _0x14ff44['id']===_0x1e6fe7[_0x8672('0x6e')]&&_0x14ff44['type']===_0x8672('0xa2');});break;case'custom':_0x3dc41f=_[_0x8672('0x88')](_0x22c514['associatedResources'],function(_0x4b0912){return _0x4b0912['id']===_0x1e6fe7[_0x8672('0x6e')]&&_0x4b0912[_0x8672('0x37')]===_0x8672('0xa3');});break;}if(_0x3dc41f)_0x14c509['push'](_0x1e6fe7);});_0x1c1cff[_0x8672('0xa4')]=_0x14c509[_0x8672('0x85')];_0x1c1cff['rows']=_0x14c509;return _0x1c1cff;});}else{if(!_[_0x8672('0x8c')](_0x3bbaf6['query'][_0x8672('0xa5')])){_0x11da8d[_0x8672('0x7d')]['id']=_0x11da8d[_0x8672('0x7d')]['id']?_[_0x8672('0x90')](_0x11da8d[_0x8672('0x7d')]['id'],_0x3bbaf6[_0x8672('0x7f')][_0x8672('0xa5')]):_0x3bbaf6[_0x8672('0x7f')][_0x8672('0xa5')];if(_0x3bbaf6[_0x8672('0x7f')][_0x8672('0xa6')]){_0x11da8d[_0x8672('0xa7')]=_0x3bbaf6['query'][_0x8672('0xa6')];}}if(_0x3bbaf6[_0x8672('0x7f')]['extraQueryConditions']){_0x11da8d['where']=_[_0x8672('0x99')](_0x11da8d[_0x8672('0x7d')],{'$and':_0x3bbaf6[_0x8672('0x7f')][_0x8672('0xa8')]});}return _0x266d9a[_0x52a341[_0x8672('0x14')]][_0x8672('0xa4')]({'where':_0x11da8d[_0x8672('0x7d')]})['then'](function(_0x5e630c){_0x1c1cff['count']=_0x5e630c;if(_0x3bbaf6[_0x8672('0x7f')][_0x8672('0xa9')]){if(_0x52a341[_0x8672('0x14')]===_0x8672('0x1c')){_0x11da8d['include']=[{'model':_0x266d9a['Tag'],'as':_0x8672('0xaa'),'attributes':['id',_0x8672('0xc'),_0x8672('0xab')],'required':_0x3bbaf6[_0x8672('0x7f')][_0x8672('0xac')]?!![]:![]},{'model':_0x266d9a[_0x8672('0x66')],'as':_0x8672('0xad'),'attributes':['id',_0x8672('0xc'),'color'],'through':_0x3bbaf6[_0x8672('0x7f')]['tag']?{'attributes':[],'where':{'TagId':_0x3bbaf6[_0x8672('0x7f')][_0x8672('0xac')]||undefined}}:{},'required':_0x3bbaf6[_0x8672('0x7f')][_0x8672('0xac')]?!![]:![]}];}else{_0x11da8d[_0x8672('0x9f')]=[{'all':!![]}];}}return _0x266d9a[_0x52a341[_0x8672('0x14')]][_0x8672('0xf')](_0x11da8d);})[_0x8672('0x7')](function(_0x5ace73){_0x1c1cff[_0x8672('0xae')]=_0x5ace73;if(_0x1c4fb5===_0x8672('0x2e')&&_0x3bbaf6[_0x8672('0x7f')][_0x8672('0xaf')]==='true'){var _0x2b0ceb=[];for(var _0x1e6e6f=0x0;_0x1e6e6f<_0x1c1cff[_0x8672('0xae')][_0x8672('0x85')];_0x1e6e6f++){_0x2b0ceb['push'](_0x8be1a0('chat',_0x1c1cff[_0x8672('0xae')][_0x1e6e6f][_0x8672('0xb0')]));_0x2b0ceb['push'](_0x8be1a0(_0x8672('0xb1'),_0x1c1cff['rows'][_0x1e6e6f][_0x8672('0xb0')]));_0x2b0ceb[_0x8672('0x86')](_0x8be1a0(_0x8672('0xb2'),_0x1c1cff['rows'][_0x1e6e6f]['dataValues']));_0x2b0ceb[_0x8672('0x86')](_0x8be1a0(_0x8672('0xb3'),_0x1c1cff[_0x8672('0xae')][_0x1e6e6f][_0x8672('0xb0')]));_0x2b0ceb[_0x8672('0x86')](_0x8be1a0(_0x8672('0xb4'),_0x1c1cff[_0x8672('0xae')][_0x1e6e6f][_0x8672('0xb0')]));_0x2b0ceb[_0x8672('0x86')](_0x8be1a0('whatsapp',_0x1c1cff[_0x8672('0xae')][_0x1e6e6f]['dataValues']));}return Promise[_0x8672('0x8a')](_0x2b0ceb)[_0x8672('0x7')](function(){return _0x1c1cff;});}return _0x1c1cff;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 8df5a73..584405f 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 _0xd98a=['debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserProfile,\x20%s,\x20%s','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','request','then','request\x20sent'];(function(_0x41a773,_0x330a41){var _0x36eaef=function(_0x1d4726){while(--_0x1d4726){_0x41a773['push'](_0x41a773['shift']());}};_0x36eaef(++_0x330a41);}(_0xd98a,0xfc));var _0xad98=function(_0x261c2c,_0x49f55e){_0x261c2c=_0x261c2c-0x0;var _0x5be28e=_0xd98a[_0x261c2c];return _0x5be28e;};'use strict';var _=require(_0xad98('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xad98('0x1'));var rs=require(_0xad98('0x2'));var fs=require('fs');var Redis=require(_0xad98('0x3'));var db=require(_0xad98('0x4'))['db'];var utils=require(_0xad98('0x5'));var logger=require(_0xad98('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xad98('0x7'));var client=jayson[_0xad98('0x8')][_0xad98('0x9')]({'port':0x232a});config[_0xad98('0xa')]=_[_0xad98('0xb')](config['redis'],{'host':_0xad98('0xc'),'port':0x18eb});var socket=require(_0xad98('0xd'))(new Redis(config['redis']));require(_0xad98('0xe'))['register'](socket);function respondWithRpcPromise(_0x145cbe,_0x525e32,_0x4cf45b){return new BPromise(function(_0x5d5f3b,_0x15ca48){return client[_0xad98('0xf')](_0x145cbe,_0x4cf45b)[_0xad98('0x10')](function(_0x120abe){logger['info']('UserProfile,\x20%s,\x20%s',_0x525e32,_0xad98('0x11'));logger[_0xad98('0x12')](_0xad98('0x13'),_0x525e32,_0xad98('0x11'),JSON[_0xad98('0x14')](_0x120abe));if(_0x120abe[_0xad98('0x15')]){if(_0x120abe[_0xad98('0x15')][_0xad98('0x16')]===0x1f4){logger[_0xad98('0x15')]('UserProfile,\x20%s,\x20%s',_0x525e32,_0x120abe[_0xad98('0x15')][_0xad98('0x17')]);return _0x15ca48(_0x120abe[_0xad98('0x15')][_0xad98('0x17')]);}logger[_0xad98('0x15')](_0xad98('0x18'),_0x525e32,_0x120abe[_0xad98('0x15')][_0xad98('0x17')]);return _0x5d5f3b(_0x120abe[_0xad98('0x15')]['message']);}else{logger['info'](_0xad98('0x18'),_0x525e32,'request\x20sent');_0x5d5f3b(_0x120abe[_0xad98('0x19')][_0xad98('0x17')]);}})[_0xad98('0x1a')](function(_0x1b2a36){logger[_0xad98('0x15')](_0xad98('0x18'),_0x525e32,_0x1b2a36);_0x15ca48(_0x1b2a36);});});} \ No newline at end of file +var _0x79a3=['rpc','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','redis','./userProfile.socket','register','info','UserProfile,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','ioredis'];(function(_0x2823a6,_0x5d46e4){var _0x4210b3=function(_0x48f54a){while(--_0x48f54a){_0x2823a6['push'](_0x2823a6['shift']());}};_0x4210b3(++_0x5d46e4);}(_0x79a3,0x80));var _0x379a=function(_0xea9e1c,_0x577088){_0xea9e1c=_0xea9e1c-0x0;var _0x3bdb61=_0x79a3[_0xea9e1c];return _0x3bdb61;};'use strict';var _=require(_0x379a('0x0'));var util=require('util');var moment=require(_0x379a('0x1'));var BPromise=require(_0x379a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x379a('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x379a('0x4'));var config=require(_0x379a('0x5'));var jayson=require(_0x379a('0x6'));var client=jayson[_0x379a('0x7')][_0x379a('0x8')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x379a('0x9'),'port':0x18eb});var socket=require(_0x379a('0xa'))(new Redis(config[_0x379a('0xb')]));require(_0x379a('0xc'))[_0x379a('0xd')](socket);function respondWithRpcPromise(_0x819320,_0xfcd926,_0x5206aa){return new BPromise(function(_0x4d017c,_0x1f163a){return client['request'](_0x819320,_0x5206aa)['then'](function(_0x6b51ec){logger[_0x379a('0xe')](_0x379a('0xf'),_0xfcd926,_0x379a('0x10'));logger['debug']('UserProfile,\x20%s,\x20%s,\x20%s',_0xfcd926,'request\x20sent',JSON[_0x379a('0x11')](_0x6b51ec));if(_0x6b51ec[_0x379a('0x12')]){if(_0x6b51ec[_0x379a('0x12')][_0x379a('0x13')]===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0xfcd926,_0x6b51ec[_0x379a('0x12')][_0x379a('0x14')]);return _0x1f163a(_0x6b51ec[_0x379a('0x12')][_0x379a('0x14')]);}logger['error']('UserProfile,\x20%s,\x20%s',_0xfcd926,_0x6b51ec[_0x379a('0x12')]['message']);return _0x4d017c(_0x6b51ec[_0x379a('0x12')][_0x379a('0x14')]);}else{logger[_0x379a('0xe')]('UserProfile,\x20%s,\x20%s',_0xfcd926,'request\x20sent');_0x4d017c(_0x6b51ec[_0x379a('0x15')][_0x379a('0x14')]);}})['catch'](function(_0x200cfd){logger[_0x379a('0x12')]('UserProfile,\x20%s,\x20%s',_0xfcd926,_0x200cfd);_0x1f163a(_0x200cfd);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 2b77df3..3a04adf 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 _0xcbfd=['update','removeListener','register','userProfile:','remove'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0xcbfd,0x6d));var _0xdcbf=function(_0x3034f8,_0x3e1d96){_0x3034f8=_0x3034f8-0x0;var _0xc99483=_0xcbfd[_0x3034f8];return _0xc99483;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=['save',_0xdcbf('0x0'),_0xdcbf('0x1')];function createListener(_0x1ccd35,_0xc50281){return function(_0x44ba13){_0xc50281['emit'](_0x1ccd35,_0x44ba13);};}function removeListener(_0x48dfdb,_0xf10c4a){return function(){UserProfileEvents[_0xdcbf('0x2')](_0x48dfdb,_0xf10c4a);};}exports[_0xdcbf('0x3')]=function(_0xec473c){for(var _0x5ebe52=0x0,_0x5f5dfd=events['length'];_0x5ebe52<_0x5f5dfd;_0x5ebe52++){var _0x2a2901=events[_0x5ebe52];var _0x39fa30=createListener(_0xdcbf('0x4')+_0x2a2901,_0xec473c);UserProfileEvents['on'](_0x2a2901,_0x39fa30);}}; \ No newline at end of file +var _0xe7ef=['register','userProfile:','./userProfile.events','save','remove','update','emit','removeListener'];(function(_0xcbf03b,_0x2ddbfd){var _0x2384a6=function(_0x58a614){while(--_0x58a614){_0xcbf03b['push'](_0xcbf03b['shift']());}};_0x2384a6(++_0x2ddbfd);}(_0xe7ef,0xda));var _0xfe7e=function(_0x1f3383,_0x169045){_0x1f3383=_0x1f3383-0x0;var _0x13c2f6=_0xe7ef[_0x1f3383];return _0x13c2f6;};'use strict';var UserProfileEvents=require(_0xfe7e('0x0'));var events=[_0xfe7e('0x1'),_0xfe7e('0x2'),_0xfe7e('0x3')];function createListener(_0x1772c4,_0x591c0b){return function(_0x11ccff){_0x591c0b[_0xfe7e('0x4')](_0x1772c4,_0x11ccff);};}function removeListener(_0x1ea029,_0x41453c){return function(){UserProfileEvents[_0xfe7e('0x5')](_0x1ea029,_0x41453c);};}exports[_0xfe7e('0x6')]=function(_0x149f6c){for(var _0x1c477e=0x0,_0x242576=events['length'];_0x1c477e<_0x242576;_0x1c477e++){var _0x4893f2=events[_0x1c477e];var _0x209ac8=createListener(_0xfe7e('0x7')+_0x4893f2,_0x149f6c);UserProfileEvents['on'](_0x4893f2,_0x209ac8);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 00c0a8d..3e07335 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 _0x026f=['/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe'];(function(_0xd6de6b,_0x43d977){var _0x1d9a4a=function(_0xf22d42){while(--_0xf22d42){_0xd6de6b['push'](_0xd6de6b['shift']());}};_0x1d9a4a(++_0x43d977);}(_0x026f,0x110));var _0xf026=function(_0x58ee5a,_0x23275b){_0x58ee5a=_0x58ee5a-0x0;var _0x2fb8e9=_0x026f[_0x58ee5a];return _0x2fb8e9;};'use strict';var multer=require(_0xf026('0x0'));var util=require(_0xf026('0x1'));var path=require(_0xf026('0x2'));var timeout=require(_0xf026('0x3'));var express=require('express');var router=express[_0xf026('0x4')]();var fs_extra=require(_0xf026('0x5'));var auth=require(_0xf026('0x6'));var interaction=require(_0xf026('0x7'));var config=require('../../config/environment');var controller=require(_0xf026('0x8'));router[_0xf026('0x9')]('/',auth[_0xf026('0xa')](),controller[_0xf026('0xb')]);router[_0xf026('0x9')](_0xf026('0xc'),auth[_0xf026('0xa')](),controller[_0xf026('0xd')]);router[_0xf026('0x9')](_0xf026('0xe'),auth[_0xf026('0xa')](),controller[_0xf026('0xf')]);router['post']('/',auth[_0xf026('0xa')](),controller[_0xf026('0x10')]);router[_0xf026('0x11')](_0xf026('0xe'),auth[_0xf026('0xa')](),controller[_0xf026('0x12')]);router[_0xf026('0x13')](_0xf026('0xe'),auth[_0xf026('0xa')](),controller[_0xf026('0x14')]);module[_0xf026('0x15')]=router; \ No newline at end of file +var _0x450f=['isAuthenticated','index','/describe','describe','post','create','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x450f,0xbc));var _0xf450=function(_0x149ad5,_0x12b417){_0x149ad5=_0x149ad5-0x0;var _0x2566b7=_0x450f[_0x149ad5];return _0x2566b7;};'use strict';var multer=require(_0xf450('0x0'));var util=require(_0xf450('0x1'));var path=require(_0xf450('0x2'));var timeout=require(_0xf450('0x3'));var express=require('express');var router=express[_0xf450('0x4')]();var fs_extra=require(_0xf450('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf450('0x6'));var config=require(_0xf450('0x7'));var controller=require(_0xf450('0x8'));router[_0xf450('0x9')]('/',auth[_0xf450('0xa')](),controller[_0xf450('0xb')]);router[_0xf450('0x9')](_0xf450('0xc'),auth['isAuthenticated'](),controller[_0xf450('0xd')]);router[_0xf450('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xf450('0xe')]('/',auth[_0xf450('0xa')](),controller[_0xf450('0xf')]);router['put']('/:id',auth[_0xf450('0xa')](),controller[_0xf450('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xf450('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index a000593..53519ff 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 _0x10c9=['exports','STRING','INTEGER','sequelize'];(function(_0x812d85,_0x4e5cb4){var _0xa98fc2=function(_0x3de0d4){while(--_0x3de0d4){_0x812d85['push'](_0x812d85['shift']());}};_0xa98fc2(++_0x4e5cb4);}(_0x10c9,0xef));var _0x910c=function(_0x3aa59d,_0x551895){_0x3aa59d=_0x3aa59d-0x0;var _0xacea82=_0x10c9[_0x3aa59d];return _0xacea82;};'use strict';var Sequelize=require(_0x910c('0x0'));module[_0x910c('0x1')]={'name':{'type':Sequelize[_0x910c('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x910c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x910c('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x2106=['STRING','sequelize'];(function(_0x510c2d,_0x162f3a){var _0x2ee78a=function(_0x106b9e){while(--_0x106b9e){_0x510c2d['push'](_0x510c2d['shift']());}};_0x2ee78a(++_0x162f3a);}(_0x2106,0xa7));var _0x6210=function(_0x3a31da,_0x4b2b96){_0x3a31da=_0x3a31da-0x0;var _0x2ed528=_0x2106[_0x3a31da];return _0x2ed528;};'use strict';var Sequelize=require(_0x6210('0x0'));module['exports']={'name':{'type':Sequelize[_0x6210('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x6210('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 97fd130..85e1035 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 _0x9536=['rawAttributes','intersection','length','options','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','error','stack','name','index','map','UserProfileResource','fieldName','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','then','includeAll','include','findAll','rows','catch','params'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9536,0x179));var _0x6953=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0x9536[_0x166742];return _0xb7814a;};'use strict';var emlformat=require(_0x6953('0x0'));var rimraf=require(_0x6953('0x1'));var zipdir=require(_0x6953('0x2'));var jsonpatch=require(_0x6953('0x3'));var rp=require('request-promise');var moment=require(_0x6953('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6953('0x5'));var util=require(_0x6953('0x6'));var path=require(_0x6953('0x7'));var sox=require(_0x6953('0x8'));var csv=require(_0x6953('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6953('0xa'));var _=require(_0x6953('0xb'));var squel=require(_0x6953('0xc'));var crypto=require(_0x6953('0xd'));var jsforce=require(_0x6953('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6953('0x9'));var querystring=require(_0x6953('0xf'));var Papa=require(_0x6953('0x10'));var Redis=require('ioredis');var authService=require(_0x6953('0x11'));var qs=require(_0x6953('0x12'));var as=require(_0x6953('0x13'));var hardwareService=require(_0x6953('0x14'));var logger=require(_0x6953('0x15'))(_0x6953('0x16'));var utils=require(_0x6953('0x17'));var config=require(_0x6953('0x18'));var licenseUtil=require(_0x6953('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x358388,_0x513dd0){_0x513dd0=_0x513dd0||0xcc;return function(_0x8de91e){if(_0x8de91e){return _0x358388[_0x6953('0x1a')](_0x513dd0);}return _0x358388[_0x6953('0x1b')](_0x513dd0)[_0x6953('0x1c')]();};}function respondWithResult(_0x1b5221,_0x244713){_0x244713=_0x244713||0xc8;return function(_0x175fa9){if(_0x175fa9){return _0x1b5221[_0x6953('0x1b')](_0x244713)[_0x6953('0x1d')](_0x175fa9);}};}function respondWithFilteredResult(_0x31d182,_0xae5515){return function(_0x548473){if(_0x548473){var _0x5f49db=typeof _0xae5515[_0x6953('0x1e')]===_0x6953('0x1f')&&typeof _0xae5515[_0x6953('0x20')]===_0x6953('0x1f');var _0x510d46=_0x548473[_0x6953('0x21')];var _0x2da771=_0x5f49db?0x0:_0xae5515['offset'];var _0x10858a=_0x5f49db?_0x548473[_0x6953('0x21')]:_0xae5515[_0x6953('0x1e')]+_0xae5515[_0x6953('0x20')];var _0xc714d3;if(_0x10858a>=_0x510d46){_0x10858a=_0x510d46;_0xc714d3=0xc8;}else{_0xc714d3=0xce;}_0x31d182['status'](_0xc714d3);return _0x31d182[_0x6953('0x22')](_0x6953('0x23'),_0x2da771+'-'+_0x10858a+'/'+_0x510d46)[_0x6953('0x1d')](_0x548473);}return null;};}function patchUpdates(_0x2ba433){return function(_0x41f021){try{jsonpatch['apply'](_0x41f021,_0x2ba433,!![]);}catch(_0xf96d07){return BPromise[_0x6953('0x24')](_0xf96d07);}return _0x41f021['save']();};}function saveUpdates(_0x317979,_0x40c9d1){return function(_0xb92529){if(_0xb92529){return _0xb92529[_0x6953('0x25')](_0x317979)['then'](function(_0x37f339){return _0x37f339;});}return null;};}function removeEntity(_0x231cb2,_0x2a7f6a){return function(_0x508ea7){if(_0x508ea7){return _0x508ea7['destroy']()['then'](function(){_0x231cb2[_0x6953('0x1b')](0xcc)[_0x6953('0x1c')]();});}};}function handleEntityNotFound(_0x550be4,_0x1a32f4){return function(_0x587df0){if(!_0x587df0){_0x550be4[_0x6953('0x1a')](0x194);}return _0x587df0;};}function handleError(_0x2bf39b,_0xcdbce8){_0xcdbce8=_0xcdbce8||0x1f4;return function(_0x2cc01e){logger[_0x6953('0x26')](_0x2cc01e[_0x6953('0x27')]);if(_0x2cc01e['name']){delete _0x2cc01e[_0x6953('0x28')];}_0x2bf39b[_0x6953('0x1b')](_0xcdbce8)['send'](_0x2cc01e);};}exports[_0x6953('0x29')]=function(_0x4af39d,_0x173b3c){var _0x3b1175={},_0x426c7c={},_0x4b0325={'count':0x0,'rows':[]};var _0x131992=_[_0x6953('0x2a')](db[_0x6953('0x2b')]['rawAttributes'],function(_0x4c49fc){return{'name':_0x4c49fc[_0x6953('0x2c')],'type':_0x4c49fc['type']['key']};});_0x426c7c[_0x6953('0x2d')]=_[_0x6953('0x2a')](_0x131992,_0x6953('0x28'));_0x426c7c[_0x6953('0x2e')]=_[_0x6953('0x2f')](_0x4af39d['query']);_0x426c7c[_0x6953('0x30')]=_['intersection'](_0x426c7c[_0x6953('0x2d')],_0x426c7c[_0x6953('0x2e')]);_0x3b1175['attributes']=_['intersection'](_0x426c7c[_0x6953('0x2d')],qs[_0x6953('0x31')](_0x4af39d[_0x6953('0x2e')]['fields']));_0x3b1175[_0x6953('0x32')]=_0x3b1175['attributes']['length']?_0x3b1175['attributes']:_0x426c7c['model'];if(!_0x4af39d[_0x6953('0x2e')][_0x6953('0x33')](_0x6953('0x34'))){_0x3b1175[_0x6953('0x20')]=qs[_0x6953('0x20')](_0x4af39d[_0x6953('0x2e')]['limit']);_0x3b1175[_0x6953('0x1e')]=qs['offset'](_0x4af39d[_0x6953('0x2e')]['offset']);}_0x3b1175[_0x6953('0x35')]=qs[_0x6953('0x36')](_0x4af39d[_0x6953('0x2e')][_0x6953('0x36')]);_0x3b1175['where']=qs[_0x6953('0x30')](_[_0x6953('0x37')](_0x4af39d[_0x6953('0x2e')],_0x426c7c[_0x6953('0x30')]),_0x131992);if(_0x4af39d[_0x6953('0x2e')][_0x6953('0x38')]){_0x3b1175[_0x6953('0x39')]=_[_0x6953('0x3a')](_0x3b1175[_0x6953('0x39')],{'$or':_[_0x6953('0x2a')](_0x131992,function(_0x2d9d81){if(_0x2d9d81['type']!==_0x6953('0x3b')){var _0x3c03ab={};_0x3c03ab[_0x2d9d81[_0x6953('0x28')]]={'$like':'%'+_0x4af39d['query']['filter']+'%'};return _0x3c03ab;}})});}_0x3b1175=_[_0x6953('0x3a')]({},_0x3b1175,_0x4af39d['options']);var _0x5abaf2={'where':_0x3b1175[_0x6953('0x39')]};return db[_0x6953('0x2b')]['count'](_0x5abaf2)[_0x6953('0x3c')](function(_0x263728){_0x4b0325[_0x6953('0x21')]=_0x263728;if(_0x4af39d[_0x6953('0x2e')][_0x6953('0x3d')]){_0x3b1175[_0x6953('0x3e')]=[{'all':!![]}];}return db['UserProfileResource'][_0x6953('0x3f')](_0x3b1175);})[_0x6953('0x3c')](function(_0x30a27a){_0x4b0325[_0x6953('0x40')]=_0x30a27a;return _0x4b0325;})[_0x6953('0x3c')](respondWithFilteredResult(_0x173b3c,_0x3b1175))[_0x6953('0x41')](handleError(_0x173b3c,null));};exports['show']=function(_0x5a40de,_0xeef91a){var _0x54d7c2={'raw':![],'where':{'id':_0x5a40de[_0x6953('0x42')]['id']}},_0x588ff8={};_0x588ff8[_0x6953('0x2d')]=_[_0x6953('0x2f')](db[_0x6953('0x2b')][_0x6953('0x43')]);_0x588ff8['query']=_['keys'](_0x5a40de[_0x6953('0x2e')]);_0x588ff8[_0x6953('0x30')]=_['intersection'](_0x588ff8[_0x6953('0x2d')],_0x588ff8['query']);_0x54d7c2[_0x6953('0x32')]=_[_0x6953('0x44')](_0x588ff8[_0x6953('0x2d')],qs[_0x6953('0x31')](_0x5a40de['query'][_0x6953('0x31')]));_0x54d7c2[_0x6953('0x32')]=_0x54d7c2['attributes'][_0x6953('0x45')]?_0x54d7c2[_0x6953('0x32')]:_0x588ff8[_0x6953('0x2d')];if(_0x5a40de[_0x6953('0x2e')][_0x6953('0x3d')]){_0x54d7c2[_0x6953('0x3e')]=[{'all':!![]}];}_0x54d7c2=_[_0x6953('0x3a')]({},_0x54d7c2,_0x5a40de[_0x6953('0x46')]);return db[_0x6953('0x2b')][_0x6953('0x47')](_0x54d7c2)[_0x6953('0x3c')](handleEntityNotFound(_0xeef91a,null))['then'](respondWithResult(_0xeef91a,null))[_0x6953('0x41')](handleError(_0xeef91a,null));};exports['create']=function(_0x15c142,_0x1d5979){return db[_0x6953('0x2b')]['create'](_0x15c142[_0x6953('0x48')],{})[_0x6953('0x3c')](respondWithResult(_0x1d5979,0xc9))['catch'](handleError(_0x1d5979,null));};exports['update']=function(_0xbf5b61,_0x265b44){if(_0xbf5b61[_0x6953('0x48')]['id']){delete _0xbf5b61[_0x6953('0x48')]['id'];}return db[_0x6953('0x2b')][_0x6953('0x47')]({'where':{'id':_0xbf5b61[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0x265b44,null))[_0x6953('0x3c')](saveUpdates(_0xbf5b61[_0x6953('0x48')],null))[_0x6953('0x3c')](respondWithResult(_0x265b44,null))['catch'](handleError(_0x265b44,null));};exports['destroy']=function(_0x14a7bf,_0x38e3e8){return db[_0x6953('0x2b')][_0x6953('0x47')]({'where':{'id':_0x14a7bf[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0x38e3e8,null))[_0x6953('0x3c')](removeEntity(_0x38e3e8,null))[_0x6953('0x41')](handleError(_0x38e3e8,null));};exports[_0x6953('0x49')]=function(_0x50b962,_0x5f15b0){return db['UserProfileResource']['describe']()[_0x6953('0x3c')](respondWithResult(_0x5f15b0,null))[_0x6953('0x41')](handleError(_0x5f15b0,null));}; \ No newline at end of file +var _0x2ef3=['name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','UserProfileResource','then','includeAll','include','findAll','catch','show','params','keys','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack'];(function(_0x267a1f,_0x420bb7){var _0x558f8c=function(_0x7de767){while(--_0x7de767){_0x267a1f['push'](_0x267a1f['shift']());}};_0x558f8c(++_0x420bb7);}(_0x2ef3,0xba));var _0x32ef=function(_0x202fce,_0x49e347){_0x202fce=_0x202fce-0x0;var _0x51f62b=_0x2ef3[_0x202fce];return _0x51f62b;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['UserProfileResource'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'all':!![]}];}return db[_0x32ef('0x3d')][_0x32ef('0x41')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x3c0e44){_0x3c569d['rows']=_0x3c0e44;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x42')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x43')]=function(_0x2a33dd,_0x765c63){var _0x5dca14={'raw':![],'where':{'id':_0x2a33dd[_0x32ef('0x44')]['id']}},_0x2901a1={};_0x2901a1['model']=_[_0x32ef('0x45')](db['UserProfileResource'][_0x32ef('0x2a')]);_0x2901a1[_0x32ef('0x2f')]=_[_0x32ef('0x45')](_0x2a33dd[_0x32ef('0x2f')]);_0x2901a1[_0x32ef('0x30')]=_[_0x32ef('0x32')](_0x2901a1[_0x32ef('0x2e')],_0x2901a1[_0x32ef('0x2f')]);_0x5dca14[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2901a1['model'],qs[_0x32ef('0x33')](_0x2a33dd['query'][_0x32ef('0x33')]));_0x5dca14[_0x32ef('0x31')]=_0x5dca14[_0x32ef('0x31')]['length']?_0x5dca14[_0x32ef('0x31')]:_0x2901a1[_0x32ef('0x2e')];if(_0x2a33dd[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5dca14[_0x32ef('0x40')]=[{'all':!![]}];}_0x5dca14=_[_0x32ef('0x3b')]({},_0x5dca14,_0x2a33dd[_0x32ef('0x3c')]);return db['UserProfileResource']['find'](_0x5dca14)[_0x32ef('0x3e')](handleEntityNotFound(_0x765c63,null))[_0x32ef('0x3e')](respondWithResult(_0x765c63,null))[_0x32ef('0x42')](handleError(_0x765c63,null));};exports[_0x32ef('0x46')]=function(_0x209361,_0xd67dc9){return db[_0x32ef('0x3d')][_0x32ef('0x46')](_0x209361[_0x32ef('0x47')],{})[_0x32ef('0x3e')](respondWithResult(_0xd67dc9,0xc9))[_0x32ef('0x42')](handleError(_0xd67dc9,null));};exports[_0x32ef('0x24')]=function(_0x36a65c,_0x4c2534){if(_0x36a65c[_0x32ef('0x47')]['id']){delete _0x36a65c[_0x32ef('0x47')]['id'];}return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x36a65c[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x4c2534,null))[_0x32ef('0x3e')](saveUpdates(_0x36a65c[_0x32ef('0x47')],null))[_0x32ef('0x3e')](respondWithResult(_0x4c2534,null))[_0x32ef('0x42')](handleError(_0x4c2534,null));};exports[_0x32ef('0x49')]=function(_0x29d456,_0x272377){return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x29d456[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x272377,null))[_0x32ef('0x3e')](removeEntity(_0x272377,null))['catch'](handleError(_0x272377,null));};exports['describe']=function(_0x179c2f,_0x259c32){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]()[_0x32ef('0x3e')](respondWithResult(_0x259c32,null))[_0x32ef('0x42')](handleError(_0x259c32,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index d91996c..ec99fde 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 _0x85de=['lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','UserProfileResource','resourceId','sectionId'];(function(_0x1fa2de,_0x3ca81c){var _0x5a82a5=function(_0x510389){while(--_0x510389){_0x1fa2de['push'](_0x1fa2de['shift']());}};_0x5a82a5(++_0x3ca81c);}(_0x85de,0x12c));var _0xe85d=function(_0x5d9140,_0x375712){_0x5d9140=_0x5d9140-0x0;var _0x9de5b6=_0x85de[_0x5d9140];return _0x9de5b6;};'use strict';var _=require(_0xe85d('0x0'));var util=require('util');var logger=require(_0xe85d('0x1'))('api');var moment=require(_0xe85d('0x2'));var BPromise=require('bluebird');var rp=require(_0xe85d('0x3'));var fs=require('fs');var path=require(_0xe85d('0x4'));var rimraf=require(_0xe85d('0x5'));var config=require(_0xe85d('0x6'));var attributes=require(_0xe85d('0x7'));module[_0xe85d('0x8')]=function(_0xa6179c,_0x4d22ad){return _0xa6179c['define'](_0xe85d('0x9'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xe85d('0xa'),_0xe85d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4b89=['bluebird','request-promise','rimraf','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','api'];(function(_0x147f34,_0x57d43d){var _0x4988b0=function(_0x18ddfc){while(--_0x18ddfc){_0x147f34['push'](_0x147f34['shift']());}};_0x4988b0(++_0x57d43d);}(_0x4b89,0x8f));var _0x94b8=function(_0x1465c1,_0xa8fd77){_0x1465c1=_0x1465c1-0x0;var _0x104621=_0x4b89[_0x1465c1];return _0x104621;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x94b8('0x0'));var moment=require('moment');var BPromise=require(_0x94b8('0x1'));var rp=require(_0x94b8('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x94b8('0x3'));var config=require('../../config/environment');var attributes=require(_0x94b8('0x4'));module[_0x94b8('0x5')]=function(_0x29e839,_0x4bbc39){return _0x29e839[_0x94b8('0x6')](_0x94b8('0x7'),attributes,{'tableName':_0x94b8('0x8'),'paranoid':![],'indexes':[{'name':_0x94b8('0x9'),'fields':[_0x94b8('0xa'),_0x94b8('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 75079bc..b4474de 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 _0x4734=['jayson/promise','client','http','request','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x57c5ea,_0xbc0387){var _0x29210a=function(_0x2fc73b){while(--_0x2fc73b){_0x57c5ea['push'](_0x57c5ea['shift']());}};_0x29210a(++_0xbc0387);}(_0x4734,0x133));var _0x4473=function(_0x159981,_0x2a9674){_0x159981=_0x159981-0x0;var _0x410e60=_0x4734[_0x159981];return _0x410e60;};'use strict';var _=require('lodash');var util=require(_0x4473('0x0'));var moment=require(_0x4473('0x1'));var BPromise=require(_0x4473('0x2'));var rs=require(_0x4473('0x3'));var fs=require('fs');var Redis=require(_0x4473('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4473('0x5'));var logger=require('../../config/logger')(_0x4473('0x6'));var config=require(_0x4473('0x7'));var jayson=require(_0x4473('0x8'));var client=jayson[_0x4473('0x9')][_0x4473('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x540e8e,_0x34e7c6,_0x257b53){return new BPromise(function(_0x422018,_0x37cb86){return client[_0x4473('0xb')](_0x540e8e,_0x257b53)['then'](function(_0x1b0b51){logger[_0x4473('0xc')](_0x4473('0xd'),_0x34e7c6,_0x4473('0xe'));logger[_0x4473('0xf')](_0x4473('0x10'),_0x34e7c6,'request\x20sent',JSON[_0x4473('0x11')](_0x1b0b51));if(_0x1b0b51[_0x4473('0x12')]){if(_0x1b0b51[_0x4473('0x12')][_0x4473('0x13')]===0x1f4){logger[_0x4473('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x34e7c6,_0x1b0b51[_0x4473('0x12')]['message']);return _0x37cb86(_0x1b0b51[_0x4473('0x12')][_0x4473('0x14')]);}logger['error'](_0x4473('0xd'),_0x34e7c6,_0x1b0b51['error'][_0x4473('0x14')]);return _0x422018(_0x1b0b51[_0x4473('0x12')][_0x4473('0x14')]);}else{logger[_0x4473('0xc')](_0x4473('0xd'),_0x34e7c6,_0x4473('0xe'));_0x422018(_0x1b0b51['result'][_0x4473('0x14')]);}})['catch'](function(_0x4edc0a){logger[_0x4473('0x12')](_0x4473('0xd'),_0x34e7c6,_0x4edc0a);_0x37cb86(_0x4edc0a);});});} \ No newline at end of file +var _0x065f=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x4e9ef6,_0x5dc18f){var _0x2d758b=function(_0x25cfa2){while(--_0x25cfa2){_0x4e9ef6['push'](_0x4e9ef6['shift']());}};_0x2d758b(++_0x5dc18f);}(_0x065f,0xff));var _0xf065=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x065f[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xf065('0x0'));var util=require(_0xf065('0x1'));var moment=require(_0xf065('0x2'));var BPromise=require(_0xf065('0x3'));var rs=require(_0xf065('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf065('0x5'))['db'];var utils=require(_0xf065('0x6'));var logger=require(_0xf065('0x7'))(_0xf065('0x8'));var config=require('../../config/environment');var jayson=require(_0xf065('0x9'));var client=jayson['client'][_0xf065('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5cd5b7,_0xb57017,_0x149fd6){return new BPromise(function(_0x6dd12a,_0x26f8f4){return client['request'](_0x5cd5b7,_0x149fd6)[_0xf065('0xb')](function(_0x13bf96){logger[_0xf065('0xc')](_0xf065('0xd'),_0xb57017,'request\x20sent');logger[_0xf065('0xe')](_0xf065('0xf'),_0xb57017,'request\x20sent',JSON['stringify'](_0x13bf96));if(_0x13bf96[_0xf065('0x10')]){if(_0x13bf96[_0xf065('0x10')]['code']===0x1f4){logger['error'](_0xf065('0xd'),_0xb57017,_0x13bf96[_0xf065('0x10')][_0xf065('0x11')]);return _0x26f8f4(_0x13bf96[_0xf065('0x10')][_0xf065('0x11')]);}logger['error'](_0xf065('0xd'),_0xb57017,_0x13bf96[_0xf065('0x10')][_0xf065('0x11')]);return _0x6dd12a(_0x13bf96[_0xf065('0x10')][_0xf065('0x11')]);}else{logger['info'](_0xf065('0xd'),_0xb57017,'request\x20sent');_0x6dd12a(_0x13bf96[_0xf065('0x12')][_0xf065('0x11')]);}})[_0xf065('0x13')](function(_0x9d98f9){logger[_0xf065('0x10')](_0xf065('0xd'),_0xb57017,_0x9d98f9);_0x26f8f4(_0x9d98f9);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 9b8238a..cad3084 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 _0x786a=['describe','/:id','post','create','put','update','delete','destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','get','isAuthenticated','index','/describe'];(function(_0x44268d,_0xad8443){var _0x4be92d=function(_0x8a57ff){while(--_0x8a57ff){_0x44268d['push'](_0x44268d['shift']());}};_0x4be92d(++_0xad8443);}(_0x786a,0xd0));var _0xa786=function(_0x119425,_0xd51a6){_0x119425=_0x119425-0x0;var _0x3de6d3=_0x786a[_0x119425];return _0x3de6d3;};'use strict';var multer=require('multer');var util=require(_0xa786('0x0'));var path=require('path');var timeout=require(_0xa786('0x1'));var express=require(_0xa786('0x2'));var router=express[_0xa786('0x3')]();var fs_extra=require(_0xa786('0x4'));var auth=require(_0xa786('0x5'));var interaction=require(_0xa786('0x6'));var config=require('../../config/environment');var controller=require(_0xa786('0x7'));router[_0xa786('0x8')]('/',auth[_0xa786('0x9')](),controller[_0xa786('0xa')]);router[_0xa786('0x8')](_0xa786('0xb'),auth[_0xa786('0x9')](),controller[_0xa786('0xc')]);router[_0xa786('0x8')](_0xa786('0xd'),auth[_0xa786('0x9')](),controller['show']);router[_0xa786('0xe')]('/',auth[_0xa786('0x9')](),controller[_0xa786('0xf')]);router[_0xa786('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xa786('0x11')]);router[_0xa786('0x12')](_0xa786('0xd'),auth[_0xa786('0x9')](),controller[_0xa786('0x13')]);module['exports']=router; \ No newline at end of file +var _0xe266=['util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','index','/describe','isAuthenticated','describe','show','post','create','put','/:id','update','delete','destroy','exports'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0xe266,0x18f));var _0x6e26=function(_0x2bd669,_0x387154){_0x2bd669=_0x2bd669-0x0;var _0x3f2537=_0xe266[_0x2bd669];return _0x3f2537;};'use strict';var multer=require('multer');var util=require(_0x6e26('0x0'));var path=require('path');var timeout=require(_0x6e26('0x1'));var express=require(_0x6e26('0x2'));var router=express[_0x6e26('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6e26('0x4'));var config=require(_0x6e26('0x5'));var controller=require(_0x6e26('0x6'));router[_0x6e26('0x7')]('/',auth['isAuthenticated'](),controller[_0x6e26('0x8')]);router['get'](_0x6e26('0x9'),auth[_0x6e26('0xa')](),controller[_0x6e26('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x6e26('0xc')]);router[_0x6e26('0xd')]('/',auth[_0x6e26('0xa')](),controller[_0x6e26('0xe')]);router[_0x6e26('0xf')](_0x6e26('0x10'),auth[_0x6e26('0xa')](),controller[_0x6e26('0x11')]);router[_0x6e26('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x6e26('0x13')]);module[_0x6e26('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 7c07733..3d0588d 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 _0x6cb4=['exports','STRING','INTEGER','BOOLEAN','crudPermissions','getDataValue','split','sequelize'];(function(_0x321e1f,_0x508656){var _0x58e590=function(_0x55bfbb){while(--_0x55bfbb){_0x321e1f['push'](_0x321e1f['shift']());}};_0x58e590(++_0x508656);}(_0x6cb4,0xff));var _0x46cb=function(_0x3fa453,_0x2a5867){_0x3fa453=_0x3fa453-0x0;var _0x20144a=_0x6cb4[_0x3fa453];return _0x20144a;};'use strict';var Sequelize=require(_0x46cb('0x0'));module[_0x46cb('0x1')]={'name':{'type':Sequelize[_0x46cb('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x46cb('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x46cb('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x46cb('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x46cb('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x46cb('0x2')],'set':function(_0x2efd19){this['setDataValue'](_0x46cb('0x5'),_0x2efd19?_0x2efd19['join'](''):[]);},'get':function(){return this[_0x46cb('0x6')]('crudPermissions')?this[_0x46cb('0x6')](_0x46cb('0x5'))[_0x46cb('0x7')](''):[];}}}; \ No newline at end of file +var _0x955f=['split','sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue','join','getDataValue','crudPermissions'];(function(_0x467464,_0x4a5f19){var _0x3ad37b=function(_0x1a93bf){while(--_0x1a93bf){_0x467464['push'](_0x467464['shift']());}};_0x3ad37b(++_0x4a5f19);}(_0x955f,0x1eb));var _0xf955=function(_0x2a5ca3,_0x10afe2){_0x2a5ca3=_0x2a5ca3-0x0;var _0x1222f5=_0x955f[_0x2a5ca3];return _0x1222f5;};'use strict';var Sequelize=require(_0xf955('0x0'));module[_0xf955('0x1')]={'name':{'type':Sequelize[_0xf955('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xf955('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xf955('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xf955('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x5d0c95){this[_0xf955('0x5')]('crudPermissions',_0x5d0c95?_0x5d0c95[_0xf955('0x6')](''):[]);},'get':function(){return this[_0xf955('0x7')](_0xf955('0x8'))?this['getDataValue'](_0xf955('0x8'))[_0xf955('0x9')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index f099878..1f0e28a 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 _0x68ed=['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','undefined','count','offset','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','UserProfileSection','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','catch','params','options','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','desk.js','querystring'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x68ed,0x116));var _0xd68e=function(_0x3760bb,_0x528f93){_0x3760bb=_0x3760bb-0x0;var _0x48f6b5=_0x68ed[_0x3760bb];return _0x48f6b5;};'use strict';var emlformat=require(_0xd68e('0x0'));var rimraf=require(_0xd68e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd68e('0x2'));var rp=require(_0xd68e('0x3'));var moment=require(_0xd68e('0x4'));var BPromise=require(_0xd68e('0x5'));var Mustache=require(_0xd68e('0x6'));var util=require(_0xd68e('0x7'));var path=require(_0xd68e('0x8'));var sox=require(_0xd68e('0x9'));var csv=require(_0xd68e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd68e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd68e('0xc'));var toCsv=require(_0xd68e('0xa'));var querystring=require(_0xd68e('0xd'));var Papa=require(_0xd68e('0xe'));var Redis=require('ioredis');var authService=require(_0xd68e('0xf'));var qs=require(_0xd68e('0x10'));var as=require(_0xd68e('0x11'));var hardwareService=require(_0xd68e('0x12'));var logger=require(_0xd68e('0x13'))(_0xd68e('0x14'));var utils=require(_0xd68e('0x15'));var config=require(_0xd68e('0x16'));var licenseUtil=require(_0xd68e('0x17'));var db=require(_0xd68e('0x18'))['db'];function respondWithStatusCode(_0x3b13db,_0x2e0576){_0x2e0576=_0x2e0576||0xcc;return function(_0x3c6b10){if(_0x3c6b10){return _0x3b13db[_0xd68e('0x19')](_0x2e0576);}return _0x3b13db[_0xd68e('0x1a')](_0x2e0576)[_0xd68e('0x1b')]();};}function respondWithResult(_0x506672,_0x477724){_0x477724=_0x477724||0xc8;return function(_0xf2ac4c){if(_0xf2ac4c){return _0x506672[_0xd68e('0x1a')](_0x477724)[_0xd68e('0x1c')](_0xf2ac4c);}};}function respondWithFilteredResult(_0x4f2504,_0x5c3253){return function(_0x11dbd7){if(_0x11dbd7){var _0x340fa6=typeof _0x5c3253['offset']===_0xd68e('0x1d')&&typeof _0x5c3253['limit']===_0xd68e('0x1d');var _0x230302=_0x11dbd7[_0xd68e('0x1e')];var _0x4da5aa=_0x340fa6?0x0:_0x5c3253['offset'];var _0x371c34=_0x340fa6?_0x11dbd7[_0xd68e('0x1e')]:_0x5c3253[_0xd68e('0x1f')]+_0x5c3253['limit'];var _0x551a48;if(_0x371c34>=_0x230302){_0x371c34=_0x230302;_0x551a48=0xc8;}else{_0x551a48=0xce;}_0x4f2504[_0xd68e('0x1a')](_0x551a48);return _0x4f2504['set'](_0xd68e('0x20'),_0x4da5aa+'-'+_0x371c34+'/'+_0x230302)[_0xd68e('0x1c')](_0x11dbd7);}return null;};}function patchUpdates(_0x59ba03){return function(_0x1ed5dd){try{jsonpatch['apply'](_0x1ed5dd,_0x59ba03,!![]);}catch(_0x34ae55){return BPromise[_0xd68e('0x21')](_0x34ae55);}return _0x1ed5dd[_0xd68e('0x22')]();};}function saveUpdates(_0x3b966d,_0x15d72d){return function(_0x18a9a1){if(_0x18a9a1){return _0x18a9a1[_0xd68e('0x23')](_0x3b966d)['then'](function(_0x2a2d21){return _0x2a2d21;});}return null;};}function removeEntity(_0x13609b,_0x4d0852){return function(_0x332dd0){if(_0x332dd0){return _0x332dd0[_0xd68e('0x24')]()[_0xd68e('0x25')](function(){_0x13609b[_0xd68e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ce3d3,_0x26138a){return function(_0x1a416a){if(!_0x1a416a){_0x2ce3d3[_0xd68e('0x19')](0x194);}return _0x1a416a;};}function handleError(_0x3718c3,_0x383720){_0x383720=_0x383720||0x1f4;return function(_0x3b1032){logger[_0xd68e('0x26')](_0x3b1032[_0xd68e('0x27')]);if(_0x3b1032[_0xd68e('0x28')]){delete _0x3b1032['name'];}_0x3718c3[_0xd68e('0x1a')](_0x383720)[_0xd68e('0x29')](_0x3b1032);};}exports[_0xd68e('0x2a')]=function(_0x2cf192,_0x26fd9b){var _0x3133d7={},_0x480239={},_0x21bddb={'count':0x0,'rows':[]};var _0x5b8f8e=_[_0xd68e('0x2b')](db[_0xd68e('0x2c')]['rawAttributes'],function(_0x3c2ce4){return{'name':_0x3c2ce4[_0xd68e('0x2d')],'type':_0x3c2ce4[_0xd68e('0x2e')]['key']};});_0x480239['model']=_[_0xd68e('0x2b')](_0x5b8f8e,_0xd68e('0x28'));_0x480239[_0xd68e('0x2f')]=_[_0xd68e('0x30')](_0x2cf192[_0xd68e('0x2f')]);_0x480239['filters']=_[_0xd68e('0x31')](_0x480239[_0xd68e('0x32')],_0x480239[_0xd68e('0x2f')]);_0x3133d7[_0xd68e('0x33')]=_[_0xd68e('0x31')](_0x480239['model'],qs[_0xd68e('0x34')](_0x2cf192[_0xd68e('0x2f')]['fields']));_0x3133d7['attributes']=_0x3133d7['attributes'][_0xd68e('0x35')]?_0x3133d7[_0xd68e('0x33')]:_0x480239[_0xd68e('0x32')];if(!_0x2cf192[_0xd68e('0x2f')][_0xd68e('0x36')]('nolimit')){_0x3133d7[_0xd68e('0x37')]=qs[_0xd68e('0x37')](_0x2cf192[_0xd68e('0x2f')][_0xd68e('0x37')]);_0x3133d7[_0xd68e('0x1f')]=qs['offset'](_0x2cf192[_0xd68e('0x2f')][_0xd68e('0x1f')]);}_0x3133d7[_0xd68e('0x38')]=qs[_0xd68e('0x39')](_0x2cf192['query']['sort']);_0x3133d7[_0xd68e('0x3a')]=qs[_0xd68e('0x3b')](_['pick'](_0x2cf192['query'],_0x480239['filters']),_0x5b8f8e);if(_0x2cf192[_0xd68e('0x2f')][_0xd68e('0x3c')]){_0x3133d7['where']=_[_0xd68e('0x3d')](_0x3133d7['where'],{'$or':_['map'](_0x5b8f8e,function(_0x230735){if(_0x230735[_0xd68e('0x2e')]!==_0xd68e('0x3e')){var _0x2de364={};_0x2de364[_0x230735[_0xd68e('0x28')]]={'$like':'%'+_0x2cf192[_0xd68e('0x2f')][_0xd68e('0x3c')]+'%'};return _0x2de364;}})});}_0x3133d7=_[_0xd68e('0x3d')]({},_0x3133d7,_0x2cf192['options']);var _0x3d0357={'where':_0x3133d7[_0xd68e('0x3a')]};return db[_0xd68e('0x2c')]['count'](_0x3d0357)[_0xd68e('0x25')](function(_0x260d55){_0x21bddb[_0xd68e('0x1e')]=_0x260d55;if(_0x2cf192[_0xd68e('0x2f')][_0xd68e('0x3f')]){_0x3133d7[_0xd68e('0x40')]=[{'all':!![]}];}return db[_0xd68e('0x2c')][_0xd68e('0x41')](_0x3133d7);})[_0xd68e('0x25')](function(_0x3830c1){_0x21bddb['rows']=_0x3830c1;return _0x21bddb;})[_0xd68e('0x25')](respondWithFilteredResult(_0x26fd9b,_0x3133d7))[_0xd68e('0x42')](handleError(_0x26fd9b,null));};exports['show']=function(_0x5072b5,_0x1bd6f9){var _0x5c9bcf={'raw':![],'where':{'id':_0x5072b5[_0xd68e('0x43')]['id']}},_0x54842e={};_0x54842e[_0xd68e('0x32')]=_['keys'](db['UserProfileSection']['rawAttributes']);_0x54842e[_0xd68e('0x2f')]=_['keys'](_0x5072b5[_0xd68e('0x2f')]);_0x54842e['filters']=_[_0xd68e('0x31')](_0x54842e['model'],_0x54842e[_0xd68e('0x2f')]);_0x5c9bcf['attributes']=_[_0xd68e('0x31')](_0x54842e['model'],qs['fields'](_0x5072b5[_0xd68e('0x2f')][_0xd68e('0x34')]));_0x5c9bcf[_0xd68e('0x33')]=_0x5c9bcf[_0xd68e('0x33')][_0xd68e('0x35')]?_0x5c9bcf[_0xd68e('0x33')]:_0x54842e['model'];if(_0x5072b5[_0xd68e('0x2f')][_0xd68e('0x3f')]){_0x5c9bcf['include']=[{'all':!![]}];}_0x5c9bcf=_[_0xd68e('0x3d')]({},_0x5c9bcf,_0x5072b5[_0xd68e('0x44')]);return db[_0xd68e('0x2c')][_0xd68e('0x45')](_0x5c9bcf)['then'](handleEntityNotFound(_0x1bd6f9,null))[_0xd68e('0x25')](respondWithResult(_0x1bd6f9,null))['catch'](handleError(_0x1bd6f9,null));};exports[_0xd68e('0x46')]=function(_0x3246d1,_0x2f1dce){return db[_0xd68e('0x2c')][_0xd68e('0x46')](_0x3246d1[_0xd68e('0x47')],{})[_0xd68e('0x25')](respondWithResult(_0x2f1dce,0xc9))[_0xd68e('0x42')](handleError(_0x2f1dce,null));};exports[_0xd68e('0x23')]=function(_0x5aa6a8,_0x4d40d){if(_0x5aa6a8[_0xd68e('0x47')]['id']){delete _0x5aa6a8[_0xd68e('0x47')]['id'];}return db[_0xd68e('0x2c')][_0xd68e('0x45')]({'where':{'id':_0x5aa6a8[_0xd68e('0x43')]['id']}})['then'](handleEntityNotFound(_0x4d40d,null))[_0xd68e('0x25')](saveUpdates(_0x5aa6a8['body'],null))['then'](respondWithResult(_0x4d40d,null))[_0xd68e('0x42')](handleError(_0x4d40d,null));};exports[_0xd68e('0x24')]=function(_0x4fe573,_0x37ac2c){return db[_0xd68e('0x2c')][_0xd68e('0x45')]({'where':{'id':_0x4fe573[_0xd68e('0x43')]['id']}})[_0xd68e('0x25')](handleEntityNotFound(_0x37ac2c,null))[_0xd68e('0x25')](removeEntity(_0x37ac2c,null))[_0xd68e('0x42')](handleError(_0x37ac2c,null));};exports[_0xd68e('0x48')]=function(_0x213f21,_0x1225ff){return db[_0xd68e('0x2c')][_0xd68e('0x48')]()[_0xd68e('0x25')](respondWithResult(_0x1225ff,null))['catch'](handleError(_0x1225ff,null));}; \ No newline at end of file +var _0x850c=['nolimit','order','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','length','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','lodash','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','sendStatus','error','stack','name','index','map','UserProfileSection','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty'];(function(_0x34ff32,_0x59528a){var _0x2a8108=function(_0x476907){while(--_0x476907){_0x34ff32['push'](_0x34ff32['shift']());}};_0x2a8108(++_0x59528a);}(_0x850c,0x17b));var _0xc850=function(_0x10eebc,_0x1fc52b){_0x10eebc=_0x10eebc-0x0;var _0x3f04c7=_0x850c[_0x10eebc];return _0x3f04c7;};'use strict';var emlformat=require(_0xc850('0x0'));var rimraf=require(_0xc850('0x1'));var zipdir=require(_0xc850('0x2'));var jsonpatch=require(_0xc850('0x3'));var rp=require(_0xc850('0x4'));var moment=require('moment');var BPromise=require(_0xc850('0x5'));var Mustache=require('mustache');var util=require(_0xc850('0x6'));var path=require(_0xc850('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(_0xc850('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc850('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xc850('0xa'));var querystring=require('querystring');var Papa=require(_0xc850('0xb'));var Redis=require('ioredis');var authService=require(_0xc850('0xc'));var qs=require(_0xc850('0xd'));var as=require(_0xc850('0xe'));var hardwareService=require(_0xc850('0xf'));var logger=require(_0xc850('0x10'))(_0xc850('0x11'));var utils=require(_0xc850('0x12'));var config=require(_0xc850('0x13'));var licenseUtil=require(_0xc850('0x14'));var db=require(_0xc850('0x15'))['db'];function respondWithStatusCode(_0x52c9c2,_0x23fa5c){_0x23fa5c=_0x23fa5c||0xcc;return function(_0x3d9fe8){if(_0x3d9fe8){return _0x52c9c2['sendStatus'](_0x23fa5c);}return _0x52c9c2[_0xc850('0x16')](_0x23fa5c)[_0xc850('0x17')]();};}function respondWithResult(_0x20e661,_0xf01bfa){_0xf01bfa=_0xf01bfa||0xc8;return function(_0x3524bd){if(_0x3524bd){return _0x20e661['status'](_0xf01bfa)[_0xc850('0x18')](_0x3524bd);}};}function respondWithFilteredResult(_0x5ccce2,_0x6c0d87){return function(_0x5ec34e){if(_0x5ec34e){var _0x3e13bb=typeof _0x6c0d87[_0xc850('0x19')]===_0xc850('0x1a')&&typeof _0x6c0d87[_0xc850('0x1b')]===_0xc850('0x1a');var _0x1a955e=_0x5ec34e[_0xc850('0x1c')];var _0x509f3c=_0x3e13bb?0x0:_0x6c0d87[_0xc850('0x19')];var _0x4439fe=_0x3e13bb?_0x5ec34e[_0xc850('0x1c')]:_0x6c0d87[_0xc850('0x19')]+_0x6c0d87['limit'];var _0x84fa1c;if(_0x4439fe>=_0x1a955e){_0x4439fe=_0x1a955e;_0x84fa1c=0xc8;}else{_0x84fa1c=0xce;}_0x5ccce2[_0xc850('0x16')](_0x84fa1c);return _0x5ccce2[_0xc850('0x1d')](_0xc850('0x1e'),_0x509f3c+'-'+_0x4439fe+'/'+_0x1a955e)[_0xc850('0x18')](_0x5ec34e);}return null;};}function patchUpdates(_0x3c9ffd){return function(_0x161439){try{jsonpatch['apply'](_0x161439,_0x3c9ffd,!![]);}catch(_0x468ba8){return BPromise[_0xc850('0x1f')](_0x468ba8);}return _0x161439['save']();};}function saveUpdates(_0xa03e53,_0x463f1e){return function(_0x18458e){if(_0x18458e){return _0x18458e[_0xc850('0x20')](_0xa03e53)[_0xc850('0x21')](function(_0x3f9b91){return _0x3f9b91;});}return null;};}function removeEntity(_0x146e1a,_0x2d3d23){return function(_0x1a6fd2){if(_0x1a6fd2){return _0x1a6fd2[_0xc850('0x22')]()[_0xc850('0x21')](function(){_0x146e1a[_0xc850('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4861e0,_0x1994cd){return function(_0xae73e3){if(!_0xae73e3){_0x4861e0[_0xc850('0x23')](0x194);}return _0xae73e3;};}function handleError(_0x482bf5,_0x4ea24f){_0x4ea24f=_0x4ea24f||0x1f4;return function(_0x40031b){logger[_0xc850('0x24')](_0x40031b[_0xc850('0x25')]);if(_0x40031b[_0xc850('0x26')]){delete _0x40031b[_0xc850('0x26')];}_0x482bf5[_0xc850('0x16')](_0x4ea24f)['send'](_0x40031b);};}exports[_0xc850('0x27')]=function(_0x309166,_0x27d9f3){var _0x501ce6={},_0x3a6a8d={},_0x3dc34f={'count':0x0,'rows':[]};var _0x379324=_[_0xc850('0x28')](db[_0xc850('0x29')][_0xc850('0x2a')],function(_0x4efed4){return{'name':_0x4efed4['fieldName'],'type':_0x4efed4[_0xc850('0x2b')][_0xc850('0x2c')]};});_0x3a6a8d[_0xc850('0x2d')]=_[_0xc850('0x28')](_0x379324,_0xc850('0x26'));_0x3a6a8d[_0xc850('0x2e')]=_[_0xc850('0x2f')](_0x309166['query']);_0x3a6a8d[_0xc850('0x30')]=_[_0xc850('0x31')](_0x3a6a8d[_0xc850('0x2d')],_0x3a6a8d['query']);_0x501ce6['attributes']=_[_0xc850('0x31')](_0x3a6a8d[_0xc850('0x2d')],qs[_0xc850('0x32')](_0x309166[_0xc850('0x2e')][_0xc850('0x32')]));_0x501ce6[_0xc850('0x33')]=_0x501ce6[_0xc850('0x33')]['length']?_0x501ce6[_0xc850('0x33')]:_0x3a6a8d[_0xc850('0x2d')];if(!_0x309166['query'][_0xc850('0x34')](_0xc850('0x35'))){_0x501ce6[_0xc850('0x1b')]=qs[_0xc850('0x1b')](_0x309166[_0xc850('0x2e')][_0xc850('0x1b')]);_0x501ce6['offset']=qs[_0xc850('0x19')](_0x309166[_0xc850('0x2e')][_0xc850('0x19')]);}_0x501ce6[_0xc850('0x36')]=qs['sort'](_0x309166[_0xc850('0x2e')]['sort']);_0x501ce6[_0xc850('0x37')]=qs[_0xc850('0x30')](_[_0xc850('0x38')](_0x309166[_0xc850('0x2e')],_0x3a6a8d[_0xc850('0x30')]),_0x379324);if(_0x309166[_0xc850('0x2e')]['filter']){_0x501ce6[_0xc850('0x37')]=_[_0xc850('0x39')](_0x501ce6[_0xc850('0x37')],{'$or':_[_0xc850('0x28')](_0x379324,function(_0x587745){if(_0x587745['type']!==_0xc850('0x3a')){var _0x1b9c33={};_0x1b9c33[_0x587745['name']]={'$like':'%'+_0x309166[_0xc850('0x2e')][_0xc850('0x3b')]+'%'};return _0x1b9c33;}})});}_0x501ce6=_[_0xc850('0x39')]({},_0x501ce6,_0x309166[_0xc850('0x3c')]);var _0xc4b010={'where':_0x501ce6[_0xc850('0x37')]};return db[_0xc850('0x29')][_0xc850('0x1c')](_0xc4b010)[_0xc850('0x21')](function(_0x1650d3){_0x3dc34f[_0xc850('0x1c')]=_0x1650d3;if(_0x309166['query'][_0xc850('0x3d')]){_0x501ce6[_0xc850('0x3e')]=[{'all':!![]}];}return db[_0xc850('0x29')][_0xc850('0x3f')](_0x501ce6);})['then'](function(_0x4e01f4){_0x3dc34f[_0xc850('0x40')]=_0x4e01f4;return _0x3dc34f;})[_0xc850('0x21')](respondWithFilteredResult(_0x27d9f3,_0x501ce6))[_0xc850('0x41')](handleError(_0x27d9f3,null));};exports['show']=function(_0xe6019b,_0x3ea132){var _0x12c92d={'raw':![],'where':{'id':_0xe6019b['params']['id']}},_0x1477ed={};_0x1477ed[_0xc850('0x2d')]=_['keys'](db[_0xc850('0x29')][_0xc850('0x2a')]);_0x1477ed[_0xc850('0x2e')]=_[_0xc850('0x2f')](_0xe6019b[_0xc850('0x2e')]);_0x1477ed['filters']=_[_0xc850('0x31')](_0x1477ed[_0xc850('0x2d')],_0x1477ed[_0xc850('0x2e')]);_0x12c92d[_0xc850('0x33')]=_[_0xc850('0x31')](_0x1477ed[_0xc850('0x2d')],qs[_0xc850('0x32')](_0xe6019b[_0xc850('0x2e')][_0xc850('0x32')]));_0x12c92d[_0xc850('0x33')]=_0x12c92d[_0xc850('0x33')][_0xc850('0x42')]?_0x12c92d[_0xc850('0x33')]:_0x1477ed[_0xc850('0x2d')];if(_0xe6019b[_0xc850('0x2e')][_0xc850('0x3d')]){_0x12c92d['include']=[{'all':!![]}];}_0x12c92d=_[_0xc850('0x39')]({},_0x12c92d,_0xe6019b['options']);return db[_0xc850('0x29')][_0xc850('0x43')](_0x12c92d)[_0xc850('0x21')](handleEntityNotFound(_0x3ea132,null))[_0xc850('0x21')](respondWithResult(_0x3ea132,null))[_0xc850('0x41')](handleError(_0x3ea132,null));};exports[_0xc850('0x44')]=function(_0x546016,_0xc73c6b){return db[_0xc850('0x29')][_0xc850('0x44')](_0x546016['body'],{})['then'](respondWithResult(_0xc73c6b,0xc9))[_0xc850('0x41')](handleError(_0xc73c6b,null));};exports[_0xc850('0x20')]=function(_0x26b46b,_0x2a06ba){if(_0x26b46b[_0xc850('0x45')]['id']){delete _0x26b46b['body']['id'];}return db[_0xc850('0x29')][_0xc850('0x43')]({'where':{'id':_0x26b46b[_0xc850('0x46')]['id']}})['then'](handleEntityNotFound(_0x2a06ba,null))['then'](saveUpdates(_0x26b46b[_0xc850('0x45')],null))[_0xc850('0x21')](respondWithResult(_0x2a06ba,null))['catch'](handleError(_0x2a06ba,null));};exports[_0xc850('0x22')]=function(_0x3e7e53,_0x1f3978){return db[_0xc850('0x29')]['find']({'where':{'id':_0x3e7e53[_0xc850('0x46')]['id']}})['then'](handleEntityNotFound(_0x1f3978,null))[_0xc850('0x21')](removeEntity(_0x1f3978,null))[_0xc850('0x41')](handleError(_0x1f3978,null));};exports[_0xc850('0x47')]=function(_0x54524a,_0x3c8a5b){return db[_0xc850('0x29')][_0xc850('0x47')]()['then'](respondWithResult(_0x3c8a5b,null))[_0xc850('0x41')](handleError(_0x3c8a5b,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 383c007..dabec12 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 _0x21c9=['rimraf','exports','define','UserProfileSection','user_profile_has_sections','userProfileId','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x3d53e6,_0x7a8d60){var _0x5651d5=function(_0x2052f3){while(--_0x2052f3){_0x3d53e6['push'](_0x3d53e6['shift']());}};_0x5651d5(++_0x7a8d60);}(_0x21c9,0xea));var _0x921c=function(_0x2d874c,_0xaa1a49){_0x2d874c=_0x2d874c-0x0;var _0x3c396e=_0x21c9[_0x2d874c];return _0x3c396e;};'use strict';var _=require(_0x921c('0x0'));var util=require(_0x921c('0x1'));var logger=require(_0x921c('0x2'))(_0x921c('0x3'));var moment=require('moment');var BPromise=require(_0x921c('0x4'));var rp=require(_0x921c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x921c('0x6'));var config=require('../../config/environment');var attributes=require('./userProfileSection.attributes');module[_0x921c('0x7')]=function(_0xf27a50,_0xbd5685){return _0xf27a50[_0x921c('0x8')](_0x921c('0x9'),attributes,{'tableName':_0x921c('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['sectionId',_0x921c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0874=['bluebird','request-promise','path','rimraf','./userProfileSection.attributes','exports','UserProfileSection','compositeIndex','sectionId','util','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0874,0xb1));var _0x4087=function(_0x182e3a,_0x1e3513){_0x182e3a=_0x182e3a-0x0;var _0x5317e6=_0x0874[_0x182e3a];return _0x5317e6;};'use strict';var _=require('lodash');var util=require(_0x4087('0x0'));var logger=require('../../config/logger')(_0x4087('0x1'));var moment=require(_0x4087('0x2'));var BPromise=require(_0x4087('0x3'));var rp=require(_0x4087('0x4'));var fs=require('fs');var path=require(_0x4087('0x5'));var rimraf=require(_0x4087('0x6'));var config=require('../../config/environment');var attributes=require(_0x4087('0x7'));module[_0x4087('0x8')]=function(_0x2b1530,_0x217fbc){return _0x2b1530['define'](_0x4087('0x9'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x4087('0xa'),'fields':[_0x4087('0xb'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 5484df1..2cbfe4a 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 _0xf354=['code','message','info','result','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x474791,_0x3a2e1a){var _0x20cca5=function(_0x321c1b){while(--_0x321c1b){_0x474791['push'](_0x474791['shift']());}};_0x20cca5(++_0x3a2e1a);}(_0xf354,0x9e));var _0x4f35=function(_0x53fff1,_0x1804a4){_0x53fff1=_0x53fff1-0x0;var _0x3dd91e=_0xf354[_0x53fff1];return _0x3dd91e;};'use strict';var _=require('lodash');var util=require(_0x4f35('0x0'));var moment=require(_0x4f35('0x1'));var BPromise=require('bluebird');var rs=require(_0x4f35('0x2'));var fs=require('fs');var Redis=require(_0x4f35('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f35('0x4'));var logger=require('../../config/logger')(_0x4f35('0x5'));var config=require(_0x4f35('0x6'));var jayson=require(_0x4f35('0x7'));var client=jayson[_0x4f35('0x8')][_0x4f35('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x25419e,_0x13c14c,_0x470a0f){return new BPromise(function(_0x1e774e,_0x69553b){return client[_0x4f35('0xa')](_0x25419e,_0x470a0f)[_0x4f35('0xb')](function(_0x4addad){logger['info'](_0x4f35('0xc'),_0x13c14c,_0x4f35('0xd'));logger[_0x4f35('0xe')](_0x4f35('0xf'),_0x13c14c,'request\x20sent',JSON[_0x4f35('0x10')](_0x4addad));if(_0x4addad[_0x4f35('0x11')]){if(_0x4addad[_0x4f35('0x11')][_0x4f35('0x12')]===0x1f4){logger[_0x4f35('0x11')](_0x4f35('0xc'),_0x13c14c,_0x4addad[_0x4f35('0x11')]['message']);return _0x69553b(_0x4addad[_0x4f35('0x11')][_0x4f35('0x13')]);}logger[_0x4f35('0x11')](_0x4f35('0xc'),_0x13c14c,_0x4addad[_0x4f35('0x11')]['message']);return _0x1e774e(_0x4addad['error'][_0x4f35('0x13')]);}else{logger[_0x4f35('0x14')](_0x4f35('0xc'),_0x13c14c,_0x4f35('0xd'));_0x1e774e(_0x4addad[_0x4f35('0x15')]['message']);}})['catch'](function(_0x4cf2f8){logger[_0x4f35('0x11')](_0x4f35('0xc'),_0x13c14c,_0x4cf2f8);_0x69553b(_0x4cf2f8);});});} \ No newline at end of file +var _0x015d=['lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x015d,0xd2));var _0xd015=function(_0x4b4f24,_0x5654a8){_0x4b4f24=_0x4b4f24-0x0;var _0x1c13d4=_0x015d[_0x4b4f24];return _0x1c13d4;};'use strict';var _=require(_0xd015('0x0'));var util=require(_0xd015('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd015('0x2'));var db=require(_0xd015('0x3'))['db'];var utils=require(_0xd015('0x4'));var logger=require(_0xd015('0x5'))(_0xd015('0x6'));var config=require(_0xd015('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd015('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1bf4e5,_0x372066,_0x1b4ccf){return new BPromise(function(_0x36f494,_0x185df6){return client[_0xd015('0x9')](_0x1bf4e5,_0x1b4ccf)[_0xd015('0xa')](function(_0x5bf501){logger[_0xd015('0xb')](_0xd015('0xc'),_0x372066,_0xd015('0xd'));logger[_0xd015('0xe')](_0xd015('0xf'),_0x372066,_0xd015('0xd'),JSON[_0xd015('0x10')](_0x5bf501));if(_0x5bf501[_0xd015('0x11')]){if(_0x5bf501['error'][_0xd015('0x12')]===0x1f4){logger[_0xd015('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x372066,_0x5bf501[_0xd015('0x11')][_0xd015('0x13')]);return _0x185df6(_0x5bf501[_0xd015('0x11')]['message']);}logger[_0xd015('0x11')](_0xd015('0xc'),_0x372066,_0x5bf501[_0xd015('0x11')][_0xd015('0x13')]);return _0x36f494(_0x5bf501[_0xd015('0x11')][_0xd015('0x13')]);}else{logger[_0xd015('0xb')](_0xd015('0xc'),_0x372066,_0xd015('0xd'));_0x36f494(_0x5bf501[_0xd015('0x14')]['message']);}})['catch'](function(_0xdb2ce){logger['error'](_0xd015('0xc'),_0x372066,_0xdb2ce);_0x185df6(_0xdb2ce);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 3f21ffb..271a137 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x5bff0,_0x20716d){var _0x3ead2e=function(_0x14f592){while(--_0x14f592){_0x5bff0['push'](_0x5bff0['shift']());}};_0x3ead2e(++_0x20716d);}(_0x9c44,0x178));var _0x49c4=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x9c44[_0x565c49];return _0x20ca34;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x3b16d0,_0x47108d){var _0x5cedad=function(_0x35c2e3){while(--_0x35c2e3){_0x3b16d0['push'](_0x3b16d0['shift']());}};_0x5cedad(++_0x47108d);}(_0x70e0,0x17b));var _0x070e=function(_0x5807f5,_0x2575f0){_0x5807f5=_0x5807f5-0x0;var _0x30f28d=_0x70e0[_0x5807f5];return _0x30f28d;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 94f8ba6..beaa43f 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 _0xff7b=['INTEGER','sequelize','exports'];(function(_0x2c3adf,_0x3b1952){var _0x2719e6=function(_0x408b92){while(--_0x408b92){_0x2c3adf['push'](_0x2c3adf['shift']());}};_0x2719e6(++_0x3b1952);}(_0xff7b,0x127));var _0xbff7=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xff7b[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0xbff7('0x0'));module[_0xbff7('0x1')]={'penalty':{'type':Sequelize[_0xbff7('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5e6d=['sequelize','exports','INTEGER'];(function(_0x3804b6,_0x5020cc){var _0x4caba6=function(_0x142684){while(--_0x142684){_0x3804b6['push'](_0x3804b6['shift']());}};_0x4caba6(++_0x5020cc);}(_0x5e6d,0x1e9));var _0xd5e6=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x5e6d[_0x4e676e];return _0x336a3c;};'use strict';var Sequelize=require(_0xd5e6('0x0'));module[_0xd5e6('0x1')]={'penalty':{'type':Sequelize[_0xd5e6('0x2')],'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 e978041..a7dcad6 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 _0x36c3=['define','UserSmsQueue','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0xcae003,_0x210f7c){var _0xc54178=function(_0x3ac7f0){while(--_0x3ac7f0){_0xcae003['push'](_0xcae003['shift']());}};_0xc54178(++_0x210f7c);}(_0x36c3,0x1a6));var _0x336c=function(_0x1c0b34,_0x425ab7){_0x1c0b34=_0x1c0b34-0x0;var _0x148223=_0x36c3[_0x1c0b34];return _0x148223;};'use strict';var _=require(_0x336c('0x0'));var util=require(_0x336c('0x1'));var logger=require('../../config/logger')(_0x336c('0x2'));var moment=require(_0x336c('0x3'));var BPromise=require(_0x336c('0x4'));var rp=require(_0x336c('0x5'));var fs=require('fs');var path=require(_0x336c('0x6'));var rimraf=require(_0x336c('0x7'));var config=require(_0x336c('0x8'));var attributes=require('./userSmsQueue.attributes');module[_0x336c('0x9')]=function(_0x2e0016,_0x2097a8){return _0x2e0016[_0x336c('0xa')](_0x336c('0xb'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x627e=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','define','UserSmsQueue','user_has_sms_queues'];(function(_0x126c1c,_0xfd21ad){var _0x555111=function(_0x155198){while(--_0x155198){_0x126c1c['push'](_0x126c1c['shift']());}};_0x555111(++_0xfd21ad);}(_0x627e,0x14a));var _0xe627=function(_0x2a3d1d,_0x4d5776){_0x2a3d1d=_0x2a3d1d-0x0;var _0x4c71ce=_0x627e[_0x2a3d1d];return _0x4c71ce;};'use strict';var _=require(_0xe627('0x0'));var util=require(_0xe627('0x1'));var logger=require(_0xe627('0x2'))(_0xe627('0x3'));var moment=require(_0xe627('0x4'));var BPromise=require('bluebird');var rp=require(_0xe627('0x5'));var fs=require('fs');var path=require(_0xe627('0x6'));var rimraf=require(_0xe627('0x7'));var config=require('../../config/environment');var attributes=require('./userSmsQueue.attributes');module['exports']=function(_0x1a1a3d,_0x3f2791){return _0x1a1a3d[_0xe627('0x8')](_0xe627('0x9'),attributes,{'tableName':_0xe627('0xa'),'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 d19add8..a9a949d 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 _0xca78=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','result','catch'];(function(_0x1fead7,_0x55b8b8){var _0x409070=function(_0x201bcc){while(--_0x201bcc){_0x1fead7['push'](_0x1fead7['shift']());}};_0x409070(++_0x55b8b8);}(_0xca78,0x73));var _0x8ca7=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xca78[_0x45d3f0];return _0x314b79;};'use strict';var _=require(_0x8ca7('0x0'));var util=require(_0x8ca7('0x1'));var moment=require(_0x8ca7('0x2'));var BPromise=require(_0x8ca7('0x3'));var rs=require(_0x8ca7('0x4'));var fs=require('fs');var Redis=require(_0x8ca7('0x5'));var db=require(_0x8ca7('0x6'))['db'];var utils=require(_0x8ca7('0x7'));var logger=require('../../config/logger')(_0x8ca7('0x8'));var config=require(_0x8ca7('0x9'));var jayson=require(_0x8ca7('0xa'));var client=jayson[_0x8ca7('0xb')][_0x8ca7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x421053,_0xf30d46,_0x526665){return new BPromise(function(_0xe8d586,_0x2eba4e){return client[_0x8ca7('0xd')](_0x421053,_0x526665)['then'](function(_0x2922f6){logger[_0x8ca7('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0xf30d46,_0x8ca7('0xf'));logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0xf30d46,_0x8ca7('0xf'),JSON[_0x8ca7('0x10')](_0x2922f6));if(_0x2922f6['error']){if(_0x2922f6[_0x8ca7('0x11')][_0x8ca7('0x12')]===0x1f4){logger[_0x8ca7('0x11')](_0x8ca7('0x13'),_0xf30d46,_0x2922f6[_0x8ca7('0x11')][_0x8ca7('0x14')]);return _0x2eba4e(_0x2922f6[_0x8ca7('0x11')][_0x8ca7('0x14')]);}logger['error'](_0x8ca7('0x13'),_0xf30d46,_0x2922f6['error'][_0x8ca7('0x14')]);return _0xe8d586(_0x2922f6[_0x8ca7('0x11')][_0x8ca7('0x14')]);}else{logger[_0x8ca7('0xe')](_0x8ca7('0x13'),_0xf30d46,'request\x20sent');_0xe8d586(_0x2922f6[_0x8ca7('0x15')][_0x8ca7('0x14')]);}})[_0x8ca7('0x16')](function(_0x323f22){logger[_0x8ca7('0x11')](_0x8ca7('0x13'),_0xf30d46,_0x323f22);_0x2eba4e(_0x323f22);});});} \ No newline at end of file +var _0x1c79=['catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x15448d,_0x277307){var _0x597839=function(_0x572fd0){while(--_0x572fd0){_0x15448d['push'](_0x15448d['shift']());}};_0x597839(++_0x277307);}(_0x1c79,0xfd));var _0x91c7=function(_0x1ada41,_0x532f2e){_0x1ada41=_0x1ada41-0x0;var _0x44cd85=_0x1c79[_0x1ada41];return _0x44cd85;};'use strict';var _=require(_0x91c7('0x0'));var util=require(_0x91c7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x91c7('0x2'));var db=require(_0x91c7('0x3'))['db'];var utils=require(_0x91c7('0x4'));var logger=require(_0x91c7('0x5'))(_0x91c7('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x91c7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3d1bec,_0x3bc19e,_0x247fe3){return new BPromise(function(_0x3ce047,_0xad5dbd){return client[_0x91c7('0x8')](_0x3d1bec,_0x247fe3)['then'](function(_0xa4a7e4){logger[_0x91c7('0x9')](_0x91c7('0xa'),_0x3bc19e,_0x91c7('0xb'));logger[_0x91c7('0xc')](_0x91c7('0xd'),_0x3bc19e,_0x91c7('0xb'),JSON['stringify'](_0xa4a7e4));if(_0xa4a7e4['error']){if(_0xa4a7e4[_0x91c7('0xe')][_0x91c7('0xf')]===0x1f4){logger[_0x91c7('0xe')](_0x91c7('0xa'),_0x3bc19e,_0xa4a7e4[_0x91c7('0xe')]['message']);return _0xad5dbd(_0xa4a7e4[_0x91c7('0xe')]['message']);}logger[_0x91c7('0xe')](_0x91c7('0xa'),_0x3bc19e,_0xa4a7e4[_0x91c7('0xe')][_0x91c7('0x10')]);return _0x3ce047(_0xa4a7e4[_0x91c7('0xe')][_0x91c7('0x10')]);}else{logger[_0x91c7('0x9')](_0x91c7('0xa'),_0x3bc19e,_0x91c7('0xb'));_0x3ce047(_0xa4a7e4['result'][_0x91c7('0x10')]);}})[_0x91c7('0x11')](function(_0x4f3b4b){logger[_0x91c7('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x3bc19e,_0x4f3b4b);_0xad5dbd(_0x4f3b4b);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 394e9e4..c1f2e28 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 _0x4940=['sequelize','exports','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4940,0xb4));var _0x0494=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4940[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x0494('0x0'));module[_0x0494('0x1')]={'UserId':{'type':Sequelize[_0x0494('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x0494('0x2')]}}; \ No newline at end of file +var _0x42f3=['INTEGER','sequelize','exports'];(function(_0x2704e0,_0x54970e){var _0x20f2c5=function(_0x309f0e){while(--_0x309f0e){_0x2704e0['push'](_0x2704e0['shift']());}};_0x20f2c5(++_0x54970e);}(_0x42f3,0x12d));var _0x342f=function(_0x69fb6a,_0x46ec8d){_0x69fb6a=_0x69fb6a-0x0;var _0x2faee2=_0x42f3[_0x69fb6a];return _0x2faee2;};'use strict';var Sequelize=require(_0x342f('0x0'));module[_0x342f('0x1')]={'UserId':{'type':Sequelize[_0x342f('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x342f('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 9aaffcd..0ae8e6e 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(_0x302dc2,_0x400d8e){var _0x9707a8=function(_0x47d0cb){while(--_0x47d0cb){_0x302dc2['push'](_0x302dc2['shift']());}};_0x9707a8(++_0x400d8e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0xfb5775,_0x3d5f8a){var _0x327208=function(_0x23231e){while(--_0x23231e){_0xfb5775['push'](_0xfb5775['shift']());}};_0x327208(++_0x3d5f8a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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 1a0017a..a6bdeb4 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x21bd89,_0x5cb3e3){var _0x5a07ee=function(_0x11b36d){while(--_0x11b36d){_0x21bd89['push'](_0x21bd89['shift']());}};_0x5a07ee(++_0x5cb3e3);}(_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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0xdec230,_0x4b3c25){var _0x2fe253=function(_0xeacc88){while(--_0xeacc88){_0xdec230['push'](_0xdec230['shift']());}};_0x2fe253(++_0x4b3c25);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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 ab19d4e..b09a981 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 _0x737f=['exports','sequelize'];(function(_0x3a7e6c,_0x430f0c){var _0x33c325=function(_0x1e497b){while(--_0x1e497b){_0x3a7e6c['push'](_0x3a7e6c['shift']());}};_0x33c325(++_0x430f0c);}(_0x737f,0x79));var _0xf737=function(_0x50dde1,_0x538ea0){_0x50dde1=_0x50dde1-0x0;var _0x53a716=_0x737f[_0x50dde1];return _0x53a716;};'use strict';var Sequelize=require(_0xf737('0x0'));module[_0xf737('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x149e=['exports','sequelize'];(function(_0x38cf8b,_0x153c20){var _0xd8bd8c=function(_0x1d7542){while(--_0x1d7542){_0x38cf8b['push'](_0x38cf8b['shift']());}};_0xd8bd8c(++_0x153c20);}(_0x149e,0x9b));var _0xe149=function(_0x3d8681,_0x4b4629){_0x3d8681=_0x3d8681-0x0;var _0x48652f=_0x149e[_0x3d8681];return _0x48652f;};'use strict';var Sequelize=require(_0xe149('0x0'));module[_0xe149('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index ffe903f..4aef4d8 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 _0xa2aa=['rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x255de5,_0x24802d){var _0x1a6873=function(_0x599193){while(--_0x599193){_0x255de5['push'](_0x255de5['shift']());}};_0x1a6873(++_0x24802d);}(_0xa2aa,0x1db));var _0xaa2a=function(_0x3e32eb,_0x2d50f0){_0x3e32eb=_0x3e32eb-0x0;var _0xeb4e1b=_0xa2aa[_0x3e32eb];return _0xeb4e1b;};'use strict';var _=require(_0xaa2a('0x0'));var util=require(_0xaa2a('0x1'));var logger=require(_0xaa2a('0x2'))('api');var moment=require(_0xaa2a('0x3'));var BPromise=require('bluebird');var rp=require(_0xaa2a('0x4'));var fs=require('fs');var path=require(_0xaa2a('0x5'));var rimraf=require(_0xaa2a('0x6'));var config=require(_0xaa2a('0x7'));var attributes=require(_0xaa2a('0x8'));module[_0xaa2a('0x9')]=function(_0x24099e,_0x17dcf7){return _0x24099e[_0xaa2a('0xa')](_0xaa2a('0xb'),attributes,{'tableName':_0xaa2a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a58=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','lodash','util','../../config/logger','api'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x3a58,0xea));var _0x83a5=function(_0x1c1d38,_0x85f856){_0x1c1d38=_0x1c1d38-0x0;var _0x3cf319=_0x3a58[_0x1c1d38];return _0x3cf319;};'use strict';var _=require(_0x83a5('0x0'));var util=require(_0x83a5('0x1'));var logger=require(_0x83a5('0x2'))(_0x83a5('0x3'));var moment=require(_0x83a5('0x4'));var BPromise=require(_0x83a5('0x5'));var rp=require(_0x83a5('0x6'));var fs=require('fs');var path=require(_0x83a5('0x7'));var rimraf=require(_0x83a5('0x8'));var config=require(_0x83a5('0x9'));var attributes=require(_0x83a5('0xa'));module[_0x83a5('0xb')]=function(_0x55435b,_0x472ec6){return _0x55435b[_0x83a5('0xc')](_0x83a5('0xd'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index b66c167..a9c458e 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 _0x8b9b=['stringify','error','code','message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x263135,_0x3ff9f6){var _0x5c799c=function(_0x817401){while(--_0x817401){_0x263135['push'](_0x263135['shift']());}};_0x5c799c(++_0x3ff9f6);}(_0x8b9b,0x8b));var _0xb8b9=function(_0x19eb43,_0x10c355){_0x19eb43=_0x19eb43-0x0;var _0x57598c=_0x8b9b[_0x19eb43];return _0x57598c;};'use strict';var _=require(_0xb8b9('0x0'));var util=require(_0xb8b9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb8b9('0x2'));var fs=require('fs');var Redis=require(_0xb8b9('0x3'));var db=require(_0xb8b9('0x4'))['db'];var utils=require(_0xb8b9('0x5'));var logger=require(_0xb8b9('0x6'))(_0xb8b9('0x7'));var config=require(_0xb8b9('0x8'));var jayson=require(_0xb8b9('0x9'));var client=jayson[_0xb8b9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35e17c,_0x2f7e17,_0x46744d){return new BPromise(function(_0xd78e80,_0x286040){return client[_0xb8b9('0xb')](_0x35e17c,_0x46744d)['then'](function(_0xfb1059){logger['info'](_0xb8b9('0xc'),_0x2f7e17,_0xb8b9('0xd'));logger['debug'](_0xb8b9('0xe'),_0x2f7e17,_0xb8b9('0xd'),JSON[_0xb8b9('0xf')](_0xfb1059));if(_0xfb1059['error']){if(_0xfb1059[_0xb8b9('0x10')][_0xb8b9('0x11')]===0x1f4){logger[_0xb8b9('0x10')]('UserVoiceQueue,\x20%s,\x20%s',_0x2f7e17,_0xfb1059['error'][_0xb8b9('0x12')]);return _0x286040(_0xfb1059[_0xb8b9('0x10')][_0xb8b9('0x12')]);}logger[_0xb8b9('0x10')](_0xb8b9('0xc'),_0x2f7e17,_0xfb1059[_0xb8b9('0x10')][_0xb8b9('0x12')]);return _0xd78e80(_0xfb1059[_0xb8b9('0x10')]['message']);}else{logger[_0xb8b9('0x13')]('UserVoiceQueue,\x20%s,\x20%s',_0x2f7e17,_0xb8b9('0xd'));_0xd78e80(_0xfb1059[_0xb8b9('0x14')][_0xb8b9('0x12')]);}})[_0xb8b9('0x15')](function(_0x4a706b){logger['error'](_0xb8b9('0xc'),_0x2f7e17,_0x4a706b);_0x286040(_0x4a706b);});});} \ No newline at end of file +var _0x57f1=['then','info','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2ceaff,_0x3574b2){var _0x2db04a=function(_0x2e1fc8){while(--_0x2e1fc8){_0x2ceaff['push'](_0x2ceaff['shift']());}};_0x2db04a(++_0x3574b2);}(_0x57f1,0x172));var _0x157f=function(_0x532317,_0xd2cd14){_0x532317=_0x532317-0x0;var _0x157c23=_0x57f1[_0x532317];return _0x157c23;};'use strict';var _=require(_0x157f('0x0'));var util=require(_0x157f('0x1'));var moment=require(_0x157f('0x2'));var BPromise=require('bluebird');var rs=require(_0x157f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x157f('0x4'));var logger=require(_0x157f('0x5'))(_0x157f('0x6'));var config=require(_0x157f('0x7'));var jayson=require(_0x157f('0x8'));var client=jayson[_0x157f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d46da,_0x49e4a7,_0x219023){return new BPromise(function(_0x154e95,_0x5a2f33){return client['request'](_0x4d46da,_0x219023)[_0x157f('0xa')](function(_0x493638){logger[_0x157f('0xb')]('UserVoiceQueue,\x20%s,\x20%s',_0x49e4a7,_0x157f('0xc'));logger['debug'](_0x157f('0xd'),_0x49e4a7,'request\x20sent',JSON[_0x157f('0xe')](_0x493638));if(_0x493638[_0x157f('0xf')]){if(_0x493638[_0x157f('0xf')][_0x157f('0x10')]===0x1f4){logger[_0x157f('0xf')](_0x157f('0x11'),_0x49e4a7,_0x493638[_0x157f('0xf')][_0x157f('0x12')]);return _0x5a2f33(_0x493638['error'][_0x157f('0x12')]);}logger[_0x157f('0xf')](_0x157f('0x11'),_0x49e4a7,_0x493638[_0x157f('0xf')][_0x157f('0x12')]);return _0x154e95(_0x493638['error'][_0x157f('0x12')]);}else{logger[_0x157f('0xb')](_0x157f('0x11'),_0x49e4a7,_0x157f('0xc'));_0x154e95(_0x493638['result'][_0x157f('0x12')]);}})[_0x157f('0x13')](function(_0x4b8cea){logger[_0x157f('0xf')](_0x157f('0x11'),_0x49e4a7,_0x4b8cea);_0x5a2f33(_0x4b8cea);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 08acd1a..771c5cc 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x58bbb2,_0x38eba4){var _0x1062a1=function(_0x22d2c4){while(--_0x22d2c4){_0x58bbb2['push'](_0x58bbb2['shift']());}};_0x1062a1(++_0x38eba4);}(_0xe706,0xa3));var _0x6e70=function(_0x5a2c7b,_0x441265){_0x5a2c7b=_0x5a2c7b-0x0;var _0x3ad931=_0xe706[_0x5a2c7b];return _0x3ad931;};'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(_0x536068,_0x3de52c){var _0x4a5db2=function(_0x1a8091){while(--_0x1a8091){_0x536068['push'](_0x536068['shift']());}};_0x4a5db2(++_0x3de52c);}(_0x9c44,0x178));var _0x49c4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9c44[_0x8c43de];return _0xa6591b;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 4738dbe..18c28c1 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 _0x7d4f=['Required\x20by\x20Asterisk','STRING','INTEGER','queue_interface','sequelize'];(function(_0x44a6df,_0x5ee254){var _0x2bdbdb=function(_0x486839){while(--_0x486839){_0x44a6df['push'](_0x44a6df['shift']());}};_0x2bdbdb(++_0x5ee254);}(_0x7d4f,0x167));var _0xf7d4=function(_0x575783,_0x4f66f6){_0x575783=_0x575783-0x0;var _0x1aeae0=_0x7d4f[_0x575783];return _0x1aeae0;};'use strict';var Sequelize=require(_0xf7d4('0x0'));module['exports']={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0xf7d4('0x1')},'membername':{'type':Sequelize[_0xf7d4('0x2')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0xf7d4('0x3')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xf7d4('0x2')],'allowNull':![],'unique':_0xf7d4('0x4'),'comment':_0xf7d4('0x1')},'VoiceQueueId':{'type':Sequelize[_0xf7d4('0x3')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf7d4('0x4'),'comment':_0xf7d4('0x1')},'penalty':{'type':Sequelize[_0xf7d4('0x3')](0xb),'defaultValue':0x0,'comment':_0xf7d4('0x1')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0xb2c0=['Required\x20by\x20Asterisk','queue_interface','sequelize','INTEGER','STRING'];(function(_0x2d55c9,_0x199d1e){var _0x593e1c=function(_0x15fa91){while(--_0x15fa91){_0x2d55c9['push'](_0x2d55c9['shift']());}};_0x593e1c(++_0x199d1e);}(_0xb2c0,0x110));var _0x0b2c=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb2c0[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x0b2c('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x0b2c('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x0b2c('0x2')],'allowNull':![],'comment':_0x0b2c('0x3')},'UserId':{'type':Sequelize[_0x0b2c('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x0b2c('0x2')],'allowNull':![],'unique':_0x0b2c('0x4'),'comment':_0x0b2c('0x3')},'VoiceQueueId':{'type':Sequelize[_0x0b2c('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x0b2c('0x2')],'allowNull':![],'unique':_0x0b2c('0x4'),'comment':_0x0b2c('0x3')},'penalty':{'type':Sequelize[_0x0b2c('0x1')](0xb),'defaultValue':0x0,'comment':_0x0b2c('0x3')},'paused':{'type':Sequelize[_0x0b2c('0x1')](0xb),'defaultValue':0x0,'comment':_0x0b2c('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index f631b29..2ad8fea 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 _0x9f0c=['update','remove','emit','hasOwnProperty','hook','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0x9f0c,0x1e2));var _0xc9f0=function(_0x58977e,_0x24b117){_0x58977e=_0x58977e-0x0;var _0x2b7d4e=_0x9f0c[_0x58977e];return _0x2b7d4e;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0xc9f0('0x0'))['db'][_0xc9f0('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xc9f0('0x2')](0x0);var events={'afterCreate':_0xc9f0('0x3'),'afterUpdate':_0xc9f0('0x4'),'afterDestroy':_0xc9f0('0x5')};function emitEvent(_0x13a4b4){return function(_0x46daa7,_0x55bfcf,_0xcf7ffc){UserVoiceQueueRtEvents[_0xc9f0('0x6')](_0x13a4b4+':'+_0x46daa7['id'],_0x46daa7);UserVoiceQueueRtEvents[_0xc9f0('0x6')](_0x13a4b4,_0x46daa7);_0xcf7ffc(null);};}for(var e in events){if(events[_0xc9f0('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0xc9f0('0x8')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x0791=['../../mysqldb','UserVoiceQueueRt','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x1bf6ca,_0xdb4d4b){var _0x5adfc7=function(_0x1fd890){while(--_0x1fd890){_0x1bf6ca['push'](_0x1bf6ca['shift']());}};_0x5adfc7(++_0xdb4d4b);}(_0x0791,0x149));var _0x1079=function(_0x5933fb,_0x9115ad){_0x5933fb=_0x5933fb-0x0;var _0x44d988=_0x0791[_0x5933fb];return _0x44d988;};'use strict';var EventEmitter=require(_0x1079('0x0'));var UserVoiceQueueRt=require(_0x1079('0x1'))['db'][_0x1079('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x1079('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1079('0x4'),'afterDestroy':_0x1079('0x5')};function emitEvent(_0x1e3210){return function(_0x5822c1,_0x5c80a9,_0x5894bd){UserVoiceQueueRtEvents[_0x1079('0x6')](_0x1e3210+':'+_0x5822c1['id'],_0x5822c1);UserVoiceQueueRtEvents[_0x1079('0x6')](_0x1e3210,_0x5822c1);_0x5894bd(null);};}for(var e in events){if(events[_0x1079('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x1079('0x8')](e,emitEvent(event));}}module[_0x1079('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 00ef42e..e2a4f56 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 _0xf9ee=['path','rimraf','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4a9f75,_0x28fe05){var _0x892292=function(_0x129d5d){while(--_0x129d5d){_0x4a9f75['push'](_0x4a9f75['shift']());}};_0x892292(++_0x28fe05);}(_0xf9ee,0x159));var _0xef9e=function(_0x7ff297,_0x85e301){_0x7ff297=_0x7ff297-0x0;var _0xa92754=_0xf9ee[_0x7ff297];return _0xa92754;};'use strict';var _=require(_0xef9e('0x0'));var util=require(_0xef9e('0x1'));var logger=require(_0xef9e('0x2'))(_0xef9e('0x3'));var moment=require(_0xef9e('0x4'));var BPromise=require(_0xef9e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xef9e('0x6'));var rimraf=require(_0xef9e('0x7'));var config=require('../../config/environment');var attributes=require(_0xef9e('0x8'));module[_0xef9e('0x9')]=function(_0x31526a,_0x1953f6){return _0x31526a[_0xef9e('0xa')](_0xef9e('0xb'),attributes,{'tableName':_0xef9e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x97b7=['./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x132b9f,_0x2207ec){var _0x366cc6=function(_0x33627f){while(--_0x33627f){_0x132b9f['push'](_0x132b9f['shift']());}};_0x366cc6(++_0x2207ec);}(_0x97b7,0x12f));var _0x797b=function(_0xe157fb,_0x9594a1){_0xe157fb=_0xe157fb-0x0;var _0x14deb6=_0x97b7[_0xe157fb];return _0x14deb6;};'use strict';var _=require('lodash');var util=require(_0x797b('0x0'));var logger=require(_0x797b('0x1'))(_0x797b('0x2'));var moment=require('moment');var BPromise=require(_0x797b('0x3'));var rp=require(_0x797b('0x4'));var fs=require('fs');var path=require(_0x797b('0x5'));var rimraf=require('rimraf');var config=require(_0x797b('0x6'));var attributes=require(_0x797b('0x7'));module['exports']=function(_0x22a8db,_0x2dd93e){return _0x22a8db[_0x797b('0x8')](_0x797b('0x9'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 0ee6e95..4ab8621 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 _0x6d43=['rpc','../../config/environment','redis','defaults','localhost','register','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','message','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','where','COUNT','sequelize','`paused`\x20=\x201,\x201,\x20null','stringify','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x51da74,_0xed04){var _0x58cbd7=function(_0x3de772){while(--_0x3de772){_0x51da74['push'](_0x51da74['shift']());}};_0x58cbd7(++_0xed04);}(_0x6d43,0x11d));var _0x36d4=function(_0x10e66c,_0x4ccb68){_0x10e66c=_0x10e66c-0x0;var _0x1e6a92=_0x6d43[_0x10e66c];return _0x1e6a92;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x36d4('0x0'));var rs=require(_0x36d4('0x1'));var fs=require('fs');var Redis=require(_0x36d4('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x36d4('0x3'));var logger=require(_0x36d4('0x4'))(_0x36d4('0x5'));var config=require(_0x36d4('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x36d4('0x7')]=_[_0x36d4('0x8')](config[_0x36d4('0x7')],{'host':_0x36d4('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./userVoiceQueueRt.socket')[_0x36d4('0xa')](socket);function respondWithRpcPromise(_0x1cf3a5,_0x25aaae,_0x3d3bcf){return new BPromise(function(_0x508942,_0x5d55f5){return client['request'](_0x1cf3a5,_0x3d3bcf)[_0x36d4('0xb')](function(_0xfce0eb){logger[_0x36d4('0xc')](_0x36d4('0xd'),_0x25aaae,_0x36d4('0xe'));logger[_0x36d4('0xf')](_0x36d4('0x10'),_0x25aaae,_0x36d4('0xe'),JSON['stringify'](_0xfce0eb));if(_0xfce0eb['error']){if(_0xfce0eb[_0x36d4('0x11')]['code']===0x1f4){logger[_0x36d4('0x11')](_0x36d4('0xd'),_0x25aaae,_0xfce0eb[_0x36d4('0x11')][_0x36d4('0x12')]);return _0x5d55f5(_0xfce0eb[_0x36d4('0x11')][_0x36d4('0x12')]);}logger['error'](_0x36d4('0xd'),_0x25aaae,_0xfce0eb[_0x36d4('0x11')]['message']);return _0x508942(_0xfce0eb[_0x36d4('0x11')]['message']);}else{logger[_0x36d4('0xc')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x25aaae,'request\x20sent');_0x508942(_0xfce0eb['result'][_0x36d4('0x12')]);}})[_0x36d4('0x13')](function(_0x95ef1b){logger[_0x36d4('0x11')](_0x36d4('0xd'),_0x25aaae,_0x95ef1b);_0x5d55f5(_0x95ef1b);});});}exports[_0x36d4('0x14')]=function(_0x3499b2){var _0x532c1b=this;return new Promise(function(_0x4509bf,_0x2160b0){return db[_0x36d4('0x15')][_0x36d4('0x16')]({'raw':_0x3499b2[_0x36d4('0x17')]?_0x3499b2['options']['raw']===undefined?!![]:![]:!![],'where':_0x3499b2[_0x36d4('0x17')]?_0x3499b2[_0x36d4('0x17')][_0x36d4('0x18')]||null:null,'attributes':[[db['sequelize']['fn'](_0x36d4('0x19'),db[_0x36d4('0x1a')]['fn']('IF',db['sequelize']['literal'](_0x36d4('0x1b')))),'outboundQueuePauses']]})[_0x36d4('0xb')](function(_0x14ac57){logger[_0x36d4('0xc')](_0x36d4('0x14'),_0x3499b2);logger['debug'](_0x36d4('0x14'),_0x3499b2,JSON[_0x36d4('0x1c')](_0x14ac57));_0x4509bf(_0x14ac57);})[_0x36d4('0x13')](function(_0x5d2a01){logger['error'](_0x36d4('0x14'),_0x5d2a01['message'],_0x3499b2);_0x2160b0(_0x532c1b[_0x36d4('0x11')](0x1f4,_0x5d2a01[_0x36d4('0x12')]));});});}; \ No newline at end of file +var _0x1a9d=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','sequelize','literal','outboundQueuePauses','debug','catch','lodash','moment','bluebird'];(function(_0x49218e,_0x2a7481){var _0x1f9733=function(_0x4a6da0){while(--_0x4a6da0){_0x49218e['push'](_0x49218e['shift']());}};_0x1f9733(++_0x2a7481);}(_0x1a9d,0x6c));var _0xd1a9=function(_0x557d04,_0x586896){_0x557d04=_0x557d04-0x0;var _0x1a5aea=_0x1a9d[_0x557d04];return _0x1a5aea;};'use strict';var _=require(_0xd1a9('0x0'));var util=require('util');var moment=require(_0xd1a9('0x1'));var BPromise=require(_0xd1a9('0x2'));var rs=require(_0xd1a9('0x3'));var fs=require('fs');var Redis=require(_0xd1a9('0x4'));var db=require(_0xd1a9('0x5'))['db'];var utils=require(_0xd1a9('0x6'));var logger=require(_0xd1a9('0x7'))('rpc');var config=require(_0xd1a9('0x8'));var jayson=require(_0xd1a9('0x9'));var client=jayson[_0xd1a9('0xa')][_0xd1a9('0xb')]({'port':0x232a});config['redis']=_[_0xd1a9('0xc')](config[_0xd1a9('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xd1a9('0xe'))(new Redis(config[_0xd1a9('0xd')]));require(_0xd1a9('0xf'))[_0xd1a9('0x10')](socket);function respondWithRpcPromise(_0x3e6a5f,_0x292073,_0x201001){return new BPromise(function(_0x69e966,_0x1aa58c){return client[_0xd1a9('0x11')](_0x3e6a5f,_0x201001)[_0xd1a9('0x12')](function(_0x251049){logger[_0xd1a9('0x13')](_0xd1a9('0x14'),_0x292073,'request\x20sent');logger['debug'](_0xd1a9('0x15'),_0x292073,_0xd1a9('0x16'),JSON[_0xd1a9('0x17')](_0x251049));if(_0x251049[_0xd1a9('0x18')]){if(_0x251049[_0xd1a9('0x18')][_0xd1a9('0x19')]===0x1f4){logger['error'](_0xd1a9('0x14'),_0x292073,_0x251049[_0xd1a9('0x18')][_0xd1a9('0x1a')]);return _0x1aa58c(_0x251049['error'][_0xd1a9('0x1a')]);}logger[_0xd1a9('0x18')](_0xd1a9('0x14'),_0x292073,_0x251049[_0xd1a9('0x18')]['message']);return _0x69e966(_0x251049[_0xd1a9('0x18')]['message']);}else{logger[_0xd1a9('0x13')](_0xd1a9('0x14'),_0x292073,_0xd1a9('0x16'));_0x69e966(_0x251049[_0xd1a9('0x1b')][_0xd1a9('0x1a')]);}})['catch'](function(_0x1657f2){logger['error'](_0xd1a9('0x14'),_0x292073,_0x1657f2);_0x1aa58c(_0x1657f2);});});}exports[_0xd1a9('0x1c')]=function(_0x21757e){var _0x11e2c3=this;return new Promise(function(_0x5622e3,_0x3aa72f){return db[_0xd1a9('0x1d')][_0xd1a9('0x1e')]({'raw':_0x21757e[_0xd1a9('0x1f')]?_0x21757e[_0xd1a9('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x21757e['options']?_0x21757e[_0xd1a9('0x1f')]['where']||null:null,'attributes':[[db[_0xd1a9('0x20')]['fn']('COUNT',db[_0xd1a9('0x20')]['fn']('IF',db[_0xd1a9('0x20')][_0xd1a9('0x21')]('`paused`\x20=\x201,\x201,\x20null'))),_0xd1a9('0x22')]]})[_0xd1a9('0x12')](function(_0x2d4b13){logger['info']('GetVoiceQueueRtPauses',_0x21757e);logger[_0xd1a9('0x23')](_0xd1a9('0x1c'),_0x21757e,JSON[_0xd1a9('0x17')](_0x2d4b13));_0x5622e3(_0x2d4b13);})[_0xd1a9('0x24')](function(_0x2551a8){logger[_0xd1a9('0x18')](_0xd1a9('0x1c'),_0x2551a8[_0xd1a9('0x1a')],_0x21757e);_0x3aa72f(_0x11e2c3[_0xd1a9('0x18')](0x1f4,_0x2551a8[_0xd1a9('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 16de6d8..47d109d 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 _0x3bd7=['update','emit','removeListener','length','remove'];(function(_0xd03f7d,_0xce6913){var _0xbc4548=function(_0xc10805){while(--_0xc10805){_0xd03f7d['push'](_0xd03f7d['shift']());}};_0xbc4548(++_0xce6913);}(_0x3bd7,0x199));var _0x73bd=function(_0x58ceb9,_0x5601df){_0x58ceb9=_0x58ceb9-0x0;var _0x3d0ff5=_0x3bd7[_0x58ceb9];return _0x3d0ff5;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=['save',_0x73bd('0x0'),_0x73bd('0x1')];function createListener(_0x22da7f,_0x4f66a5){return function(_0x4242ff){_0x4f66a5[_0x73bd('0x2')](_0x22da7f,_0x4242ff);};}function removeListener(_0x1b4214,_0x56fbc2){return function(){UserVoiceQueueRtEvents[_0x73bd('0x3')](_0x1b4214,_0x56fbc2);};}exports['register']=function(_0xe20fe9){for(var _0x1aa5e1=0x0,_0x4bca41=events[_0x73bd('0x4')];_0x1aa5e1<_0x4bca41;_0x1aa5e1++){var _0x4c1254=events[_0x1aa5e1];var _0x569bef=createListener('userVoiceQueueRt:'+_0x4c1254,_0xe20fe9);UserVoiceQueueRtEvents['on'](_0x4c1254,_0x569bef);}}; \ No newline at end of file +var _0x8b8e=['emit','removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','remove'];(function(_0x3902c1,_0x1c9eb2){var _0x1266cc=function(_0x50c2c5){while(--_0x50c2c5){_0x3902c1['push'](_0x3902c1['shift']());}};_0x1266cc(++_0x1c9eb2);}(_0x8b8e,0x108));var _0xe8b8=function(_0x5719ec,_0x3a8644){_0x5719ec=_0x5719ec-0x0;var _0x8d49a6=_0x8b8e[_0x5719ec];return _0x8d49a6;};'use strict';var UserVoiceQueueRtEvents=require(_0xe8b8('0x0'));var events=['save',_0xe8b8('0x1'),'update'];function createListener(_0x3f1493,_0x4d012c){return function(_0x4b1992){_0x4d012c[_0xe8b8('0x2')](_0x3f1493,_0x4b1992);};}function removeListener(_0x472a91,_0x13a865){return function(){UserVoiceQueueRtEvents[_0xe8b8('0x3')](_0x472a91,_0x13a865);};}exports[_0xe8b8('0x4')]=function(_0x3f5dd7){for(var _0x1c0548=0x0,_0x2b3269=events[_0xe8b8('0x5')];_0x1c0548<_0x2b3269;_0x1c0548++){var _0x2540e3=events[_0x1c0548];var _0x4ce796=createListener(_0xe8b8('0x6')+_0x2540e3,_0x3f5dd7);UserVoiceQueueRtEvents['on'](_0x2540e3,_0x4ce796);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 3ac3e23..d623a4f 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x3bf8c3,_0x374e06){var _0x2b381c=function(_0x2bcfd2){while(--_0x2bcfd2){_0x3bf8c3['push'](_0x3bf8c3['shift']());}};_0x2b381c(++_0x374e06);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x20a2c8,_0x8c47f8){var _0x2951c2=function(_0x43f72e){while(--_0x43f72e){_0x20a2c8['push'](_0x20a2c8['shift']());}};_0x2951c2(++_0x8c47f8);}(_0xedd9,0xfc));var _0x9edd=function(_0x54445b,_0xbcc01f){_0x54445b=_0x54445b-0x0;var _0x2a0714=_0xedd9[_0x54445b];return _0x2a0714;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index e0e7667..5024262 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 _0xa272=['exports','INTEGER','sequelize'];(function(_0x3fb027,_0xbf3b37){var _0x27788c=function(_0x2255b8){while(--_0x2255b8){_0x3fb027['push'](_0x3fb027['shift']());}};_0x27788c(++_0xbf3b37);}(_0xa272,0x1d6));var _0x2a27=function(_0x2d6937,_0x4f7939){_0x2d6937=_0x2d6937-0x0;var _0x26a7d2=_0xa272[_0x2d6937];return _0x26a7d2;};'use strict';var Sequelize=require(_0x2a27('0x0'));module[_0x2a27('0x1')]={'penalty':{'type':Sequelize[_0x2a27('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xcff4=['INTEGER','sequelize','exports'];(function(_0x5ef659,_0x25cfce){var _0x24d1d4=function(_0x494206){while(--_0x494206){_0x5ef659['push'](_0x5ef659['shift']());}};_0x24d1d4(++_0x25cfce);}(_0xcff4,0x11e));var _0x4cff=function(_0x5879a2,_0x5cf6d5){_0x5879a2=_0x5879a2-0x0;var _0x36cfd8=_0xcff4[_0x5879a2];return _0x36cfd8;};'use strict';var Sequelize=require(_0x4cff('0x0'));module[_0x4cff('0x1')]={'penalty':{'type':Sequelize[_0x4cff('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index f4f3ad0..dd0820e 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 _0x67b7=['../../config/environment','define','UserWhatsappQueue','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x3bc215,_0x26b15b){var _0x51e11d=function(_0x4d042c){while(--_0x4d042c){_0x3bc215['push'](_0x3bc215['shift']());}};_0x51e11d(++_0x26b15b);}(_0x67b7,0x1d9));var _0x767b=function(_0x3fa2e0,_0x433b9c){_0x3fa2e0=_0x3fa2e0-0x0;var _0x13bf03=_0x67b7[_0x3fa2e0];return _0x13bf03;};'use strict';var _=require('lodash');var util=require(_0x767b('0x0'));var logger=require(_0x767b('0x1'))('api');var moment=require(_0x767b('0x2'));var BPromise=require(_0x767b('0x3'));var rp=require(_0x767b('0x4'));var fs=require('fs');var path=require(_0x767b('0x5'));var rimraf=require(_0x767b('0x6'));var config=require(_0x767b('0x7'));var attributes=require('./userWhatsappQueue.attributes');module['exports']=function(_0x4de077,_0x5b72c9){return _0x4de077[_0x767b('0x8')](_0x767b('0x9'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x52a0=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','UserWhatsappQueue','user_has_whatsapp_queues'];(function(_0x1c7b8b,_0x121659){var _0x4e96f1=function(_0x355afb){while(--_0x355afb){_0x1c7b8b['push'](_0x1c7b8b['shift']());}};_0x4e96f1(++_0x121659);}(_0x52a0,0x1ba));var _0x052a=function(_0x2545d0,_0x397e79){_0x2545d0=_0x2545d0-0x0;var _0x10111b=_0x52a0[_0x2545d0];return _0x10111b;};'use strict';var _=require(_0x052a('0x0'));var util=require(_0x052a('0x1'));var logger=require(_0x052a('0x2'))(_0x052a('0x3'));var moment=require(_0x052a('0x4'));var BPromise=require(_0x052a('0x5'));var rp=require(_0x052a('0x6'));var fs=require('fs');var path=require(_0x052a('0x7'));var rimraf=require(_0x052a('0x8'));var config=require(_0x052a('0x9'));var attributes=require('./userWhatsappQueue.attributes');module[_0x052a('0xa')]=function(_0x3677e9,_0x21a6a6){return _0x3677e9['define'](_0x052a('0xb'),attributes,{'tableName':_0x052a('0xc'),'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 b4ac3c8..36f2fe4 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 _0x8a3e=['client','http','request','then','info','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','UserWhatsappQueue,\x20%s,\x20%s','result','util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x27f9be,_0x268da6){var _0x3783a6=function(_0x332e7c){while(--_0x332e7c){_0x27f9be['push'](_0x27f9be['shift']());}};_0x3783a6(++_0x268da6);}(_0x8a3e,0x6c));var _0xe8a3=function(_0x36c4b3,_0x2aac4b){_0x36c4b3=_0x36c4b3-0x0;var _0x12f6e7=_0x8a3e[_0x36c4b3];return _0x12f6e7;};'use strict';var _=require('lodash');var util=require(_0xe8a3('0x0'));var moment=require('moment');var BPromise=require(_0xe8a3('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe8a3('0x2'));var db=require(_0xe8a3('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe8a3('0x4'));var config=require(_0xe8a3('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xe8a3('0x6')][_0xe8a3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x440c1c,_0x5b3ddf,_0x247bfe){return new BPromise(function(_0x5345fe,_0x34dfde){return client[_0xe8a3('0x8')](_0x440c1c,_0x247bfe)[_0xe8a3('0x9')](function(_0x4b7acd){logger[_0xe8a3('0xa')]('UserWhatsappQueue,\x20%s,\x20%s',_0x5b3ddf,_0xe8a3('0xb'));logger[_0xe8a3('0xc')](_0xe8a3('0xd'),_0x5b3ddf,'request\x20sent',JSON[_0xe8a3('0xe')](_0x4b7acd));if(_0x4b7acd[_0xe8a3('0xf')]){if(_0x4b7acd[_0xe8a3('0xf')]['code']===0x1f4){logger[_0xe8a3('0xf')]('UserWhatsappQueue,\x20%s,\x20%s',_0x5b3ddf,_0x4b7acd[_0xe8a3('0xf')][_0xe8a3('0x10')]);return _0x34dfde(_0x4b7acd[_0xe8a3('0xf')]['message']);}logger['error'](_0xe8a3('0x11'),_0x5b3ddf,_0x4b7acd[_0xe8a3('0xf')][_0xe8a3('0x10')]);return _0x5345fe(_0x4b7acd['error'][_0xe8a3('0x10')]);}else{logger[_0xe8a3('0xa')]('UserWhatsappQueue,\x20%s,\x20%s',_0x5b3ddf,_0xe8a3('0xb'));_0x5345fe(_0x4b7acd[_0xe8a3('0x12')][_0xe8a3('0x10')]);}})['catch'](function(_0x164d5c){logger['error'](_0xe8a3('0x11'),_0x5b3ddf,_0x164d5c);_0x34dfde(_0x164d5c);});});} \ No newline at end of file +var _0x14aa=['../../config/environment','jayson/promise','client','request','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserWhatsappQueue,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x447a88,_0x4129ac){var _0x3366a1=function(_0x5a4c7a){while(--_0x5a4c7a){_0x447a88['push'](_0x447a88['shift']());}};_0x3366a1(++_0x4129ac);}(_0x14aa,0x1dc));var _0xa14a=function(_0x1c454c,_0x493627){_0x1c454c=_0x1c454c-0x0;var _0x3a0dac=_0x14aa[_0x1c454c];return _0x3a0dac;};'use strict';var _=require(_0xa14a('0x0'));var util=require(_0xa14a('0x1'));var moment=require(_0xa14a('0x2'));var BPromise=require(_0xa14a('0x3'));var rs=require(_0xa14a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa14a('0x5'))['db'];var utils=require(_0xa14a('0x6'));var logger=require(_0xa14a('0x7'))('rpc');var config=require(_0xa14a('0x8'));var jayson=require(_0xa14a('0x9'));var client=jayson[_0xa14a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b6beb,_0x3da6f4,_0x4c1503){return new BPromise(function(_0x7c1c95,_0x473b7b){return client[_0xa14a('0xb')](_0x2b6beb,_0x4c1503)['then'](function(_0x53185c){logger['info']('UserWhatsappQueue,\x20%s,\x20%s',_0x3da6f4,_0xa14a('0xc'));logger[_0xa14a('0xd')](_0xa14a('0xe'),_0x3da6f4,_0xa14a('0xc'),JSON[_0xa14a('0xf')](_0x53185c));if(_0x53185c[_0xa14a('0x10')]){if(_0x53185c['error'][_0xa14a('0x11')]===0x1f4){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x3da6f4,_0x53185c[_0xa14a('0x10')]['message']);return _0x473b7b(_0x53185c[_0xa14a('0x10')][_0xa14a('0x12')]);}logger[_0xa14a('0x10')](_0xa14a('0x13'),_0x3da6f4,_0x53185c[_0xa14a('0x10')][_0xa14a('0x12')]);return _0x7c1c95(_0x53185c[_0xa14a('0x10')][_0xa14a('0x12')]);}else{logger['info'](_0xa14a('0x13'),_0x3da6f4,_0xa14a('0xc'));_0x7c1c95(_0x53185c[_0xa14a('0x14')][_0xa14a('0x12')]);}})[_0xa14a('0x15')](function(_0x33559d){logger[_0xa14a('0x10')](_0xa14a('0x13'),_0x3da6f4,_0x33559d);_0x473b7b(_0x33559d);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index abaad69..188627f 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 _0x4fdb=['fs-extra','../../components/auth/service','../../components/interaction/service','./variable.controller','isAuthenticated','/:id','show','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0xc298ad,_0xea4dc2){var _0x11b2e6=function(_0xe2314f){while(--_0xe2314f){_0xc298ad['push'](_0xc298ad['shift']());}};_0x11b2e6(++_0xea4dc2);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x1f21c8,_0x43ea8d){_0x1f21c8=_0x1f21c8-0x0;var _0x14fd35=_0x4fdb[_0x1f21c8];return _0x14fd35;};'use strict';var multer=require(_0xb4fd('0x0'));var util=require(_0xb4fd('0x1'));var path=require(_0xb4fd('0x2'));var timeout=require(_0xb4fd('0x3'));var express=require(_0xb4fd('0x4'));var router=express[_0xb4fd('0x5')]();var fs_extra=require(_0xb4fd('0x6'));var auth=require(_0xb4fd('0x7'));var interaction=require(_0xb4fd('0x8'));var config=require('../../config/environment');var controller=require(_0xb4fd('0x9'));router['get']('/',auth[_0xb4fd('0xa')](),controller['index']);router['get'](_0xb4fd('0xb'),auth[_0xb4fd('0xa')](),controller[_0xb4fd('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb4fd('0xd')]);router[_0xb4fd('0xe')](_0xb4fd('0xb'),auth['isAuthenticated'](),controller[_0xb4fd('0xf')]);router[_0xb4fd('0x10')](_0xb4fd('0xb'),auth[_0xb4fd('0xa')](),controller[_0xb4fd('0x11')]);module['exports']=router; \ No newline at end of file +var _0x6fb8=['post','create','update','delete','destroy','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x6fb8,0x104));var _0x86fb=function(_0x26df48,_0x22aa50){_0x26df48=_0x26df48-0x0;var _0x209047=_0x6fb8[_0x26df48];return _0x209047;};'use strict';var multer=require(_0x86fb('0x0'));var util=require('util');var path=require(_0x86fb('0x1'));var timeout=require(_0x86fb('0x2'));var express=require('express');var router=express[_0x86fb('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x86fb('0x4'));var config=require(_0x86fb('0x5'));var controller=require(_0x86fb('0x6'));router[_0x86fb('0x7')]('/',auth[_0x86fb('0x8')](),controller[_0x86fb('0x9')]);router[_0x86fb('0x7')](_0x86fb('0xa'),auth[_0x86fb('0x8')](),controller[_0x86fb('0xb')]);router[_0x86fb('0xc')]('/',auth[_0x86fb('0x8')](),controller[_0x86fb('0xd')]);router['put'](_0x86fb('0xa'),auth['isAuthenticated'](),controller[_0x86fb('0xe')]);router[_0x86fb('0xf')](_0x86fb('0xa'),auth['isAuthenticated'](),controller[_0x86fb('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index cf5833d..47d00de 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 _0x9b08=['STRING','sequelize','exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x9b08,0x1ea));var _0x89b0=function(_0x138d06,_0x33edf2){_0x138d06=_0x138d06-0x0;var _0x1a01eb=_0x9b08[_0x138d06];return _0x1a01eb;};'use strict';var Sequelize=require(_0x89b0('0x0'));module[_0x89b0('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x89b0('0x2')]}}; \ No newline at end of file +var _0x7707=['sequelize','exports','STRING','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7707,0x158));var _0x7770=function(_0x9f9adb,_0x451a80){_0x9f9adb=_0x9f9adb-0x0;var _0x14749f=_0x7707[_0x9f9adb];return _0x14749f;};'use strict';var Sequelize=require(_0x7770('0x0'));module[_0x7770('0x1')]={'name':{'type':Sequelize[_0x7770('0x2')],'unique':_0x7770('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7770('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 01d2fdf..0c17acf 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 _0xca2a=['intersection','fields','attributes','length','hasOwnProperty','sort','filters','pick','merge','where','VIRTUAL','name','filter','options','includeAll','include','findAll','rows','show','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','get','Variables','UserProfileResource','destroy','sendStatus','error','stack','send','index','map','Variable','rawAttributes','fieldName','type','key','model','keys','query'];(function(_0x5c3d7c,_0x59b149){var _0x20a459=function(_0x362188){while(--_0x362188){_0x5c3d7c['push'](_0x5c3d7c['shift']());}};_0x20a459(++_0x59b149);}(_0xca2a,0x74));var _0xaca2=function(_0x3a0bc5,_0x398b4c){_0x3a0bc5=_0x3a0bc5-0x0;var _0x1f236c=_0xca2a[_0x3a0bc5];return _0x1f236c;};'use strict';var emlformat=require(_0xaca2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaca2('0x1'));var jsonpatch=require(_0xaca2('0x2'));var rp=require(_0xaca2('0x3'));var moment=require(_0xaca2('0x4'));var BPromise=require(_0xaca2('0x5'));var Mustache=require(_0xaca2('0x6'));var util=require(_0xaca2('0x7'));var path=require('path');var sox=require(_0xaca2('0x8'));var csv=require('to-csv');var ejs=require(_0xaca2('0x9'));var fs=require('fs');var fs_extra=require(_0xaca2('0xa'));var _=require(_0xaca2('0xb'));var squel=require(_0xaca2('0xc'));var crypto=require(_0xaca2('0xd'));var jsforce=require(_0xaca2('0xe'));var deskjs=require(_0xaca2('0xf'));var toCsv=require(_0xaca2('0x10'));var querystring=require('querystring');var Papa=require(_0xaca2('0x11'));var Redis=require(_0xaca2('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xaca2('0x13'));var as=require(_0xaca2('0x14'));var hardwareService=require(_0xaca2('0x15'));var logger=require(_0xaca2('0x16'))(_0xaca2('0x17'));var utils=require(_0xaca2('0x18'));var config=require(_0xaca2('0x19'));var licenseUtil=require(_0xaca2('0x1a'));var db=require(_0xaca2('0x1b'))['db'];function respondWithStatusCode(_0x4f4281,_0x5767c1){_0x5767c1=_0x5767c1||0xcc;return function(_0x108d86){if(_0x108d86){return _0x4f4281['sendStatus'](_0x5767c1);}return _0x4f4281[_0xaca2('0x1c')](_0x5767c1)[_0xaca2('0x1d')]();};}function respondWithResult(_0x33cea3,_0x47174e){_0x47174e=_0x47174e||0xc8;return function(_0x1f0335){if(_0x1f0335){return _0x33cea3['status'](_0x47174e)[_0xaca2('0x1e')](_0x1f0335);}};}function respondWithFilteredResult(_0x125554,_0x5470e6){return function(_0x272749){if(_0x272749){var _0x41c2e2=typeof _0x5470e6[_0xaca2('0x1f')]===_0xaca2('0x20')&&typeof _0x5470e6[_0xaca2('0x21')]===_0xaca2('0x20');var _0x30c27f=_0x272749[_0xaca2('0x22')];var _0x524ad1=_0x41c2e2?0x0:_0x5470e6[_0xaca2('0x1f')];var _0xb42d5d=_0x41c2e2?_0x272749[_0xaca2('0x22')]:_0x5470e6[_0xaca2('0x1f')]+_0x5470e6[_0xaca2('0x21')];var _0x98fb0;if(_0xb42d5d>=_0x30c27f){_0xb42d5d=_0x30c27f;_0x98fb0=0xc8;}else{_0x98fb0=0xce;}_0x125554['status'](_0x98fb0);return _0x125554['set'](_0xaca2('0x23'),_0x524ad1+'-'+_0xb42d5d+'/'+_0x30c27f)[_0xaca2('0x1e')](_0x272749);}return null;};}function patchUpdates(_0x3df7ce){return function(_0x3f32b0){try{jsonpatch['apply'](_0x3f32b0,_0x3df7ce,!![]);}catch(_0x486824){return BPromise[_0xaca2('0x24')](_0x486824);}return _0x3f32b0[_0xaca2('0x25')]();};}function saveUpdates(_0x4bc2f2,_0x46f41b){return function(_0x348b17){if(_0x348b17){return _0x348b17[_0xaca2('0x26')](_0x4bc2f2)[_0xaca2('0x27')](function(_0x145ebe){return _0x145ebe;});}return null;};}function removeEntity(_0x3d39f7,_0x60f9c9){return function(_0x58a3ae){if(_0x58a3ae){return _0x58a3ae['destroy']()[_0xaca2('0x27')](function(){var _0x438647=_0x58a3ae[_0xaca2('0x28')]({'plain':!![]});var _0x317697=_0xaca2('0x29');return db[_0xaca2('0x2a')][_0xaca2('0x2b')]({'where':{'type':_0x317697,'resourceId':_0x438647['id']}})[_0xaca2('0x27')](function(){return _0x58a3ae;});})[_0xaca2('0x27')](function(){_0x3d39f7[_0xaca2('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x231e13,_0x3c5fe2){return function(_0x260e73){if(!_0x260e73){_0x231e13[_0xaca2('0x2c')](0x194);}return _0x260e73;};}function handleError(_0x478f96,_0x285085){_0x285085=_0x285085||0x1f4;return function(_0x5abd97){logger[_0xaca2('0x2d')](_0x5abd97[_0xaca2('0x2e')]);if(_0x5abd97['name']){delete _0x5abd97['name'];}_0x478f96['status'](_0x285085)[_0xaca2('0x2f')](_0x5abd97);};}exports[_0xaca2('0x30')]=function(_0x53a713,_0x192e64){var _0x51a2e6={},_0x2699ca={},_0x35eb3a={'count':0x0,'rows':[]};var _0x30174f=_[_0xaca2('0x31')](db[_0xaca2('0x32')][_0xaca2('0x33')],function(_0x327fa1){return{'name':_0x327fa1[_0xaca2('0x34')],'type':_0x327fa1[_0xaca2('0x35')][_0xaca2('0x36')]};});_0x2699ca[_0xaca2('0x37')]=_[_0xaca2('0x31')](_0x30174f,'name');_0x2699ca['query']=_[_0xaca2('0x38')](_0x53a713[_0xaca2('0x39')]);_0x2699ca['filters']=_[_0xaca2('0x3a')](_0x2699ca[_0xaca2('0x37')],_0x2699ca['query']);_0x51a2e6['attributes']=_[_0xaca2('0x3a')](_0x2699ca[_0xaca2('0x37')],qs[_0xaca2('0x3b')](_0x53a713[_0xaca2('0x39')]['fields']));_0x51a2e6[_0xaca2('0x3c')]=_0x51a2e6[_0xaca2('0x3c')][_0xaca2('0x3d')]?_0x51a2e6['attributes']:_0x2699ca[_0xaca2('0x37')];if(!_0x53a713[_0xaca2('0x39')][_0xaca2('0x3e')]('nolimit')){_0x51a2e6[_0xaca2('0x21')]=qs[_0xaca2('0x21')](_0x53a713[_0xaca2('0x39')][_0xaca2('0x21')]);_0x51a2e6[_0xaca2('0x1f')]=qs['offset'](_0x53a713['query']['offset']);}_0x51a2e6['order']=qs[_0xaca2('0x3f')](_0x53a713[_0xaca2('0x39')][_0xaca2('0x3f')]);_0x51a2e6['where']=qs[_0xaca2('0x40')](_[_0xaca2('0x41')](_0x53a713[_0xaca2('0x39')],_0x2699ca[_0xaca2('0x40')]),_0x30174f);if(_0x53a713[_0xaca2('0x39')]['filter']){_0x51a2e6['where']=_[_0xaca2('0x42')](_0x51a2e6[_0xaca2('0x43')],{'$or':_[_0xaca2('0x31')](_0x30174f,function(_0x4fb018){if(_0x4fb018['type']!==_0xaca2('0x44')){var _0x460fcd={};_0x460fcd[_0x4fb018[_0xaca2('0x45')]]={'$like':'%'+_0x53a713['query'][_0xaca2('0x46')]+'%'};return _0x460fcd;}})});}_0x51a2e6=_['merge']({},_0x51a2e6,_0x53a713[_0xaca2('0x47')]);var _0x1dccec={'where':_0x51a2e6[_0xaca2('0x43')]};return db[_0xaca2('0x32')][_0xaca2('0x22')](_0x1dccec)[_0xaca2('0x27')](function(_0x2d7a25){_0x35eb3a[_0xaca2('0x22')]=_0x2d7a25;if(_0x53a713[_0xaca2('0x39')][_0xaca2('0x48')]){_0x51a2e6[_0xaca2('0x49')]=[{'all':!![]}];}return db[_0xaca2('0x32')][_0xaca2('0x4a')](_0x51a2e6);})[_0xaca2('0x27')](function(_0x296816){_0x35eb3a[_0xaca2('0x4b')]=_0x296816;return _0x35eb3a;})['then'](respondWithFilteredResult(_0x192e64,_0x51a2e6))['catch'](handleError(_0x192e64,null));};exports[_0xaca2('0x4c')]=function(_0x4264f3,_0x3c8e2c){var _0x3f00ca={'raw':!![],'where':{'id':_0x4264f3[_0xaca2('0x4d')]['id']}},_0x55407b={};_0x55407b[_0xaca2('0x37')]=_[_0xaca2('0x38')](db[_0xaca2('0x32')][_0xaca2('0x33')]);_0x55407b[_0xaca2('0x39')]=_[_0xaca2('0x38')](_0x4264f3[_0xaca2('0x39')]);_0x55407b['filters']=_[_0xaca2('0x3a')](_0x55407b[_0xaca2('0x37')],_0x55407b[_0xaca2('0x39')]);_0x3f00ca[_0xaca2('0x3c')]=_[_0xaca2('0x3a')](_0x55407b['model'],qs[_0xaca2('0x3b')](_0x4264f3[_0xaca2('0x39')][_0xaca2('0x3b')]));_0x3f00ca[_0xaca2('0x3c')]=_0x3f00ca[_0xaca2('0x3c')]['length']?_0x3f00ca[_0xaca2('0x3c')]:_0x55407b['model'];if(_0x4264f3[_0xaca2('0x39')][_0xaca2('0x48')]){_0x3f00ca[_0xaca2('0x49')]=[{'all':!![]}];}_0x3f00ca=_[_0xaca2('0x42')]({},_0x3f00ca,_0x4264f3[_0xaca2('0x47')]);return db[_0xaca2('0x32')]['find'](_0x3f00ca)[_0xaca2('0x27')](handleEntityNotFound(_0x3c8e2c,null))['then'](respondWithResult(_0x3c8e2c,null))[_0xaca2('0x4e')](handleError(_0x3c8e2c,null));};exports[_0xaca2('0x4f')]=function(_0x42b5a1,_0x184488){return db['Variable']['create'](_0x42b5a1[_0xaca2('0x50')],{})[_0xaca2('0x27')](function(_0x3d5383){var _0x16c7f4=_0x42b5a1[_0xaca2('0x51')][_0xaca2('0x28')]({'plain':!![]});if(!_0x16c7f4)throw new Error(_0xaca2('0x52'));if(_0x16c7f4[_0xaca2('0x53')]===_0xaca2('0x51')){var _0x5d5fb9=_0x3d5383[_0xaca2('0x28')]({'plain':!![]});var _0x5ac327=_0xaca2('0x29');return db[_0xaca2('0x54')][_0xaca2('0x55')]({'where':{'name':_0x5ac327,'userProfileId':_0x16c7f4[_0xaca2('0x56')]},'raw':!![]})[_0xaca2('0x27')](function(_0x35ea4f){if(_0x35ea4f&&_0x35ea4f['autoAssociation']===0x0){return db[_0xaca2('0x2a')][_0xaca2('0x4f')]({'name':_0x5d5fb9[_0xaca2('0x45')],'resourceId':_0x5d5fb9['id'],'type':_0x35ea4f['name'],'sectionId':_0x35ea4f['id']},{})[_0xaca2('0x27')](function(){return _0x3d5383;});}else{return _0x3d5383;}})[_0xaca2('0x4e')](function(_0x146a6f){logger[_0xaca2('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x146a6f);throw _0x146a6f;});}return _0x3d5383;})[_0xaca2('0x27')](respondWithResult(_0x184488,0xc9))[_0xaca2('0x4e')](handleError(_0x184488,null));};exports[_0xaca2('0x26')]=function(_0x4050cd,_0x16d7d7){if(_0x4050cd[_0xaca2('0x50')]['id']){delete _0x4050cd[_0xaca2('0x50')]['id'];}return db[_0xaca2('0x32')][_0xaca2('0x55')]({'where':{'id':_0x4050cd[_0xaca2('0x4d')]['id']}})[_0xaca2('0x27')](handleEntityNotFound(_0x16d7d7,null))['then'](saveUpdates(_0x4050cd[_0xaca2('0x50')],null))['then'](respondWithResult(_0x16d7d7,null))['catch'](handleError(_0x16d7d7,null));};exports['destroy']=function(_0x43e747,_0x48b5d5){return db[_0xaca2('0x32')][_0xaca2('0x55')]({'where':{'id':_0x43e747['params']['id']}})[_0xaca2('0x27')](handleEntityNotFound(_0x48b5d5,null))['then'](removeEntity(_0x48b5d5,null))[_0xaca2('0x4e')](handleError(_0x48b5d5,null));}; \ No newline at end of file +var _0xb105=['merge','VIRTUAL','filter','options','Variable','includeAll','findAll','rows','catch','show','params','intersection','length','include','find','create','user','get','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','save','then','destroy','Variables','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick'];(function(_0x1e88ba,_0x38bd8e){var _0x13bd0b=function(_0x2365b7){while(--_0x2365b7){_0x1e88ba['push'](_0x1e88ba['shift']());}};_0x13bd0b(++_0x38bd8e);}(_0xb105,0xc3));var _0x5b10=function(_0x1e0629,_0x2ffbc8){_0x1e0629=_0x1e0629-0x0;var _0x2e1b6e=_0xb105[_0x1e0629];return _0x2e1b6e;};'use strict';var emlformat=require(_0x5b10('0x0'));var rimraf=require(_0x5b10('0x1'));var zipdir=require(_0x5b10('0x2'));var jsonpatch=require(_0x5b10('0x3'));var rp=require(_0x5b10('0x4'));var moment=require(_0x5b10('0x5'));var BPromise=require(_0x5b10('0x6'));var Mustache=require(_0x5b10('0x7'));var util=require('util');var path=require(_0x5b10('0x8'));var sox=require('sox');var csv=require(_0x5b10('0x9'));var ejs=require(_0x5b10('0xa'));var fs=require('fs');var fs_extra=require(_0x5b10('0xb'));var _=require('lodash');var squel=require(_0x5b10('0xc'));var crypto=require(_0x5b10('0xd'));var jsforce=require(_0x5b10('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5b10('0x9'));var querystring=require(_0x5b10('0xf'));var Papa=require(_0x5b10('0x10'));var Redis=require(_0x5b10('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5b10('0x12'));var as=require(_0x5b10('0x13'));var hardwareService=require(_0x5b10('0x14'));var logger=require(_0x5b10('0x15'))(_0x5b10('0x16'));var utils=require(_0x5b10('0x17'));var config=require(_0x5b10('0x18'));var licenseUtil=require(_0x5b10('0x19'));var db=require(_0x5b10('0x1a'))['db'];function respondWithStatusCode(_0xdf41e9,_0x4fcd4e){_0x4fcd4e=_0x4fcd4e||0xcc;return function(_0x51d532){if(_0x51d532){return _0xdf41e9[_0x5b10('0x1b')](_0x4fcd4e);}return _0xdf41e9[_0x5b10('0x1c')](_0x4fcd4e)[_0x5b10('0x1d')]();};}function respondWithResult(_0xc37c50,_0x494bb4){_0x494bb4=_0x494bb4||0xc8;return function(_0x18ebf9){if(_0x18ebf9){return _0xc37c50['status'](_0x494bb4)[_0x5b10('0x1e')](_0x18ebf9);}};}function respondWithFilteredResult(_0x41e8fe,_0x4ed60f){return function(_0x98e59f){if(_0x98e59f){var _0xa19293=typeof _0x4ed60f[_0x5b10('0x1f')]===_0x5b10('0x20')&&typeof _0x4ed60f['limit']===_0x5b10('0x20');var _0x1bd22a=_0x98e59f[_0x5b10('0x21')];var _0x3498b0=_0xa19293?0x0:_0x4ed60f[_0x5b10('0x1f')];var _0x1f060f=_0xa19293?_0x98e59f['count']:_0x4ed60f[_0x5b10('0x1f')]+_0x4ed60f[_0x5b10('0x22')];var _0x5c2ebb;if(_0x1f060f>=_0x1bd22a){_0x1f060f=_0x1bd22a;_0x5c2ebb=0xc8;}else{_0x5c2ebb=0xce;}_0x41e8fe[_0x5b10('0x1c')](_0x5c2ebb);return _0x41e8fe[_0x5b10('0x23')](_0x5b10('0x24'),_0x3498b0+'-'+_0x1f060f+'/'+_0x1bd22a)['json'](_0x98e59f);}return null;};}function patchUpdates(_0xd86475){return function(_0x34ce10){try{jsonpatch['apply'](_0x34ce10,_0xd86475,!![]);}catch(_0x1e5b7a){return BPromise['reject'](_0x1e5b7a);}return _0x34ce10[_0x5b10('0x25')]();};}function saveUpdates(_0x58652d,_0x512284){return function(_0x2f5254){if(_0x2f5254){return _0x2f5254['update'](_0x58652d)[_0x5b10('0x26')](function(_0x3a3a03){return _0x3a3a03;});}return null;};}function removeEntity(_0x36ef20,_0x4fb39){return function(_0x2f5115){if(_0x2f5115){return _0x2f5115[_0x5b10('0x27')]()['then'](function(){var _0x162c5c=_0x2f5115['get']({'plain':!![]});var _0x4f1053=_0x5b10('0x28');return db[_0x5b10('0x29')]['destroy']({'where':{'type':_0x4f1053,'resourceId':_0x162c5c['id']}})[_0x5b10('0x26')](function(){return _0x2f5115;});})[_0x5b10('0x26')](function(){_0x36ef20[_0x5b10('0x1c')](0xcc)[_0x5b10('0x1d')]();});}};}function handleEntityNotFound(_0x26295f,_0x2e6320){return function(_0x1b8f85){if(!_0x1b8f85){_0x26295f[_0x5b10('0x1b')](0x194);}return _0x1b8f85;};}function handleError(_0x5b1fd2,_0x324b0f){_0x324b0f=_0x324b0f||0x1f4;return function(_0x31e69e){logger['error'](_0x31e69e[_0x5b10('0x2a')]);if(_0x31e69e[_0x5b10('0x2b')]){delete _0x31e69e[_0x5b10('0x2b')];}_0x5b1fd2[_0x5b10('0x1c')](_0x324b0f)[_0x5b10('0x2c')](_0x31e69e);};}exports[_0x5b10('0x2d')]=function(_0x379d3d,_0x3507d1){var _0x5a2ece={},_0x45a1ad={},_0x4df555={'count':0x0,'rows':[]};var _0x1c8ad7=_[_0x5b10('0x2e')](db['Variable'][_0x5b10('0x2f')],function(_0xf22fde){return{'name':_0xf22fde[_0x5b10('0x30')],'type':_0xf22fde[_0x5b10('0x31')][_0x5b10('0x32')]};});_0x45a1ad[_0x5b10('0x33')]=_['map'](_0x1c8ad7,_0x5b10('0x2b'));_0x45a1ad[_0x5b10('0x34')]=_[_0x5b10('0x35')](_0x379d3d[_0x5b10('0x34')]);_0x45a1ad['filters']=_['intersection'](_0x45a1ad[_0x5b10('0x33')],_0x45a1ad[_0x5b10('0x34')]);_0x5a2ece[_0x5b10('0x36')]=_['intersection'](_0x45a1ad['model'],qs[_0x5b10('0x37')](_0x379d3d[_0x5b10('0x34')]['fields']));_0x5a2ece['attributes']=_0x5a2ece['attributes']['length']?_0x5a2ece['attributes']:_0x45a1ad[_0x5b10('0x33')];if(!_0x379d3d[_0x5b10('0x34')][_0x5b10('0x38')](_0x5b10('0x39'))){_0x5a2ece[_0x5b10('0x22')]=qs[_0x5b10('0x22')](_0x379d3d[_0x5b10('0x34')]['limit']);_0x5a2ece[_0x5b10('0x1f')]=qs[_0x5b10('0x1f')](_0x379d3d[_0x5b10('0x34')]['offset']);}_0x5a2ece[_0x5b10('0x3a')]=qs[_0x5b10('0x3b')](_0x379d3d[_0x5b10('0x34')][_0x5b10('0x3b')]);_0x5a2ece[_0x5b10('0x3c')]=qs[_0x5b10('0x3d')](_[_0x5b10('0x3e')](_0x379d3d[_0x5b10('0x34')],_0x45a1ad[_0x5b10('0x3d')]),_0x1c8ad7);if(_0x379d3d[_0x5b10('0x34')]['filter']){_0x5a2ece[_0x5b10('0x3c')]=_[_0x5b10('0x3f')](_0x5a2ece[_0x5b10('0x3c')],{'$or':_['map'](_0x1c8ad7,function(_0x3d79f1){if(_0x3d79f1[_0x5b10('0x31')]!==_0x5b10('0x40')){var _0x214429={};_0x214429[_0x3d79f1[_0x5b10('0x2b')]]={'$like':'%'+_0x379d3d[_0x5b10('0x34')][_0x5b10('0x41')]+'%'};return _0x214429;}})});}_0x5a2ece=_[_0x5b10('0x3f')]({},_0x5a2ece,_0x379d3d[_0x5b10('0x42')]);var _0x8c4d7={'where':_0x5a2ece[_0x5b10('0x3c')]};return db[_0x5b10('0x43')][_0x5b10('0x21')](_0x8c4d7)['then'](function(_0x507d21){_0x4df555[_0x5b10('0x21')]=_0x507d21;if(_0x379d3d[_0x5b10('0x34')][_0x5b10('0x44')]){_0x5a2ece['include']=[{'all':!![]}];}return db[_0x5b10('0x43')][_0x5b10('0x45')](_0x5a2ece);})[_0x5b10('0x26')](function(_0x1d4643){_0x4df555[_0x5b10('0x46')]=_0x1d4643;return _0x4df555;})[_0x5b10('0x26')](respondWithFilteredResult(_0x3507d1,_0x5a2ece))[_0x5b10('0x47')](handleError(_0x3507d1,null));};exports[_0x5b10('0x48')]=function(_0x4134e0,_0x4f6ae1){var _0x1f00c4={'raw':!![],'where':{'id':_0x4134e0[_0x5b10('0x49')]['id']}},_0x31c696={};_0x31c696['model']=_[_0x5b10('0x35')](db[_0x5b10('0x43')][_0x5b10('0x2f')]);_0x31c696['query']=_[_0x5b10('0x35')](_0x4134e0['query']);_0x31c696['filters']=_['intersection'](_0x31c696['model'],_0x31c696['query']);_0x1f00c4['attributes']=_[_0x5b10('0x4a')](_0x31c696[_0x5b10('0x33')],qs[_0x5b10('0x37')](_0x4134e0[_0x5b10('0x34')][_0x5b10('0x37')]));_0x1f00c4[_0x5b10('0x36')]=_0x1f00c4[_0x5b10('0x36')][_0x5b10('0x4b')]?_0x1f00c4[_0x5b10('0x36')]:_0x31c696[_0x5b10('0x33')];if(_0x4134e0[_0x5b10('0x34')][_0x5b10('0x44')]){_0x1f00c4[_0x5b10('0x4c')]=[{'all':!![]}];}_0x1f00c4=_[_0x5b10('0x3f')]({},_0x1f00c4,_0x4134e0[_0x5b10('0x42')]);return db['Variable'][_0x5b10('0x4d')](_0x1f00c4)[_0x5b10('0x26')](handleEntityNotFound(_0x4f6ae1,null))[_0x5b10('0x26')](respondWithResult(_0x4f6ae1,null))[_0x5b10('0x47')](handleError(_0x4f6ae1,null));};exports[_0x5b10('0x4e')]=function(_0x40f8d7,_0x3dc0dc){return db[_0x5b10('0x43')][_0x5b10('0x4e')](_0x40f8d7['body'],{})[_0x5b10('0x26')](function(_0x28e357){var _0x38b366=_0x40f8d7[_0x5b10('0x4f')][_0x5b10('0x50')]({'plain':!![]});if(!_0x38b366)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x38b366['role']==='user'){var _0x1f0d2d=_0x28e357[_0x5b10('0x50')]({'plain':!![]});var _0x593ba3=_0x5b10('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x593ba3,'userProfileId':_0x38b366[_0x5b10('0x51')]},'raw':!![]})['then'](function(_0x1c9c14){if(_0x1c9c14&&_0x1c9c14[_0x5b10('0x52')]===0x0){return db['UserProfileResource'][_0x5b10('0x4e')]({'name':_0x1f0d2d['name'],'resourceId':_0x1f0d2d['id'],'type':_0x1c9c14[_0x5b10('0x2b')],'sectionId':_0x1c9c14['id']},{})[_0x5b10('0x26')](function(){return _0x28e357;});}else{return _0x28e357;}})[_0x5b10('0x47')](function(_0x4ceb16){logger[_0x5b10('0x53')](_0x5b10('0x54'),_0x4ceb16);throw _0x4ceb16;});}return _0x28e357;})[_0x5b10('0x26')](respondWithResult(_0x3dc0dc,0xc9))[_0x5b10('0x47')](handleError(_0x3dc0dc,null));};exports['update']=function(_0x4289c3,_0x2eee16){if(_0x4289c3['body']['id']){delete _0x4289c3['body']['id'];}return db[_0x5b10('0x43')][_0x5b10('0x4d')]({'where':{'id':_0x4289c3[_0x5b10('0x49')]['id']}})['then'](handleEntityNotFound(_0x2eee16,null))[_0x5b10('0x26')](saveUpdates(_0x4289c3[_0x5b10('0x55')],null))[_0x5b10('0x26')](respondWithResult(_0x2eee16,null))[_0x5b10('0x47')](handleError(_0x2eee16,null));};exports[_0x5b10('0x27')]=function(_0x337969,_0x2cb71b){return db['Variable'][_0x5b10('0x4d')]({'where':{'id':_0x337969[_0x5b10('0x49')]['id']}})[_0x5b10('0x26')](handleEntityNotFound(_0x2cb71b,null))[_0x5b10('0x26')](removeEntity(_0x2cb71b,null))[_0x5b10('0x47')](handleError(_0x2cb71b,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 98aebaf..6d4121f 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 _0x7c4b=['./variable.attributes','exports','define','tools_variables','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x7c4b,0xc7));var _0xb7c4=function(_0x2e7000,_0x401a34){_0x2e7000=_0x2e7000-0x0;var _0x56db93=_0x7c4b[_0x2e7000];return _0x56db93;};'use strict';var _=require(_0xb7c4('0x0'));var util=require(_0xb7c4('0x1'));var logger=require(_0xb7c4('0x2'))('api');var moment=require(_0xb7c4('0x3'));var BPromise=require(_0xb7c4('0x4'));var rp=require(_0xb7c4('0x5'));var fs=require('fs');var path=require(_0xb7c4('0x6'));var rimraf=require(_0xb7c4('0x7'));var config=require(_0xb7c4('0x8'));var attributes=require(_0xb7c4('0x9'));module[_0xb7c4('0xa')]=function(_0x5cceaa,_0x500dd5){return _0x5cceaa[_0xb7c4('0xb')]('Variable',attributes,{'tableName':_0xb7c4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e1d=['define','Variable','lodash','util','moment','bluebird','path','rimraf','../../config/environment','./variable.attributes','exports'];(function(_0x1e1544,_0x384bae){var _0x450c40=function(_0x244c39){while(--_0x244c39){_0x1e1544['push'](_0x1e1544['shift']());}};_0x450c40(++_0x384bae);}(_0x3e1d,0x91));var _0xd3e1=function(_0x4ccad7,_0x2daf62){_0x4ccad7=_0x4ccad7-0x0;var _0x3a1bc0=_0x3e1d[_0x4ccad7];return _0x3a1bc0;};'use strict';var _=require(_0xd3e1('0x0'));var util=require(_0xd3e1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd3e1('0x2'));var BPromise=require(_0xd3e1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd3e1('0x4'));var rimraf=require(_0xd3e1('0x5'));var config=require(_0xd3e1('0x6'));var attributes=require(_0xd3e1('0x7'));module[_0xd3e1('0x8')]=function(_0x4b509e,_0x28d352){return _0x4b509e[_0xd3e1('0x9')](_0xd3e1('0xa'),attributes,{'tableName':'tools_variables','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 9051ab3..28b9d2f 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 _0x8ef6=['result','catch','Variable','find','options','raw','include','model','attributes','map','ShowVariable','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5d09d9,_0x181abf){var _0x7ce182=function(_0x369277){while(--_0x369277){_0x5d09d9['push'](_0x5d09d9['shift']());}};_0x7ce182(++_0x181abf);}(_0x8ef6,0xf2));var _0x68ef=function(_0x1b68b9,_0x50e1bc){_0x1b68b9=_0x1b68b9-0x0;var _0x1d8196=_0x8ef6[_0x1b68b9];return _0x1d8196;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('Variable,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('Variable,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});}exports['ShowVariable']=function(_0x2633c1){var _0x404870=this;return new Promise(function(_0x4ade0d,_0x527870){return db[_0x68ef('0x18')][_0x68ef('0x19')]({'raw':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1['options'][_0x68ef('0x1b')]===undefined?!![]:![]:!![],'where':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')]['where']||null:null,'attributes':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')]['attributes']||null:null,'include':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')][_0x68ef('0x1c')]?_['map'](_0x2633c1['options']['include'],function(_0x26018d){return{'model':db[_0x26018d[_0x68ef('0x1d')]],'as':_0x26018d['as'],'attributes':_0x26018d[_0x68ef('0x1e')],'include':_0x26018d[_0x68ef('0x1c')]?_[_0x68ef('0x1f')](_0x26018d[_0x68ef('0x1c')],function(_0x258cd5){return{'model':db[_0x258cd5[_0x68ef('0x1d')]],'as':_0x258cd5['as'],'attributes':_0x258cd5[_0x68ef('0x1e')],'include':_0x258cd5[_0x68ef('0x1c')]?_['map'](_0x258cd5[_0x68ef('0x1c')],function(_0x57f9ee){return{'model':db[_0x57f9ee['model']],'as':_0x57f9ee['as'],'attributes':_0x57f9ee['attributes']};}):[]};}):[]};}):[]:[]})[_0x68ef('0xc')](function(_0x268f32){logger[_0x68ef('0xd')](_0x68ef('0x20'),_0x2633c1);logger['debug']('ShowVariable',_0x2633c1,JSON[_0x68ef('0x12')](_0x268f32));_0x4ade0d(_0x268f32);})[_0x68ef('0x17')](function(_0x7bf96){logger[_0x68ef('0x13')](_0x68ef('0x20'),_0x7bf96[_0x68ef('0x15')],_0x2633c1);_0x527870(_0x404870[_0x68ef('0x13')](0x1f4,_0x7bf96[_0x68ef('0x15')]));});});}; \ No newline at end of file +var _0x6aa7=['include','model','attributes','map','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowVariable','find','options','raw','where'];(function(_0x220ab4,_0x5f33e1){var _0x11bf70=function(_0x562ea5){while(--_0x562ea5){_0x220ab4['push'](_0x220ab4['shift']());}};_0x11bf70(++_0x5f33e1);}(_0x6aa7,0x178));var _0x76aa=function(_0x23ab0c,_0x4ce035){_0x23ab0c=_0x23ab0c-0x0;var _0x4e0a10=_0x6aa7[_0x23ab0c];return _0x4e0a10;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});}exports[_0x76aa('0x16')]=function(_0x21c16d){var _0xa1bc7=this;return new Promise(function(_0x3ead3f,_0x496902){return db['Variable'][_0x76aa('0x17')]({'raw':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x19')]===undefined?!![]:![]:!![],'where':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1a')]||null:null,'attributes':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')]['attributes']||null:null,'include':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')]?_['map'](_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')],function(_0x31252f){return{'model':db[_0x31252f[_0x76aa('0x1c')]],'as':_0x31252f['as'],'attributes':_0x31252f[_0x76aa('0x1d')],'include':_0x31252f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x31252f[_0x76aa('0x1b')],function(_0x32bf9f){return{'model':db[_0x32bf9f[_0x76aa('0x1c')]],'as':_0x32bf9f['as'],'attributes':_0x32bf9f[_0x76aa('0x1d')],'include':_0x32bf9f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x32bf9f['include'],function(_0xb5e8a9){return{'model':db[_0xb5e8a9[_0x76aa('0x1c')]],'as':_0xb5e8a9['as'],'attributes':_0xb5e8a9[_0x76aa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x76aa('0xa')](function(_0xa1e6){logger[_0x76aa('0xb')](_0x76aa('0x16'),_0x21c16d);logger[_0x76aa('0xe')](_0x76aa('0x16'),_0x21c16d,JSON[_0x76aa('0x10')](_0xa1e6));_0x3ead3f(_0xa1e6);})['catch'](function(_0x3fcb7f){logger['error'](_0x76aa('0x16'),_0x3fcb7f[_0x76aa('0x13')],_0x21c16d);_0x496902(_0xa1bc7[_0x76aa('0x11')](0x1f4,_0x3fcb7f[_0x76aa('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index a6b0bd1..4402466 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 _0xcbc7=['Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','/reset','reset','/restart','restart','migrations','exports'];(function(_0x5d3896,_0x2c2e33){var _0x139bcf=function(_0x29c7bf){while(--_0x29c7bf){_0x5d3896['push'](_0x5d3896['shift']());}};_0x139bcf(++_0x2c2e33);}(_0xcbc7,0x1ce));var _0x7cbc=function(_0x461467,_0x81d0dd){_0x461467=_0x461467-0x0;var _0x5c47da=_0xcbc7[_0x461467];return _0x5c47da;};'use strict';var express=require('express');var router=express[_0x7cbc('0x0')]();var auth=require(_0x7cbc('0x1'));var controller=require(_0x7cbc('0x2'));router[_0x7cbc('0x3')]('/',controller[_0x7cbc('0x4')]);router[_0x7cbc('0x3')](_0x7cbc('0x5'),auth[_0x7cbc('0x6')](),auth[_0x7cbc('0x7')](),controller['fetch']);router[_0x7cbc('0x3')](_0x7cbc('0x8'),auth[_0x7cbc('0x6')](),auth[_0x7cbc('0x7')](),controller[_0x7cbc('0x9')]);router[_0x7cbc('0x3')]('/pull',auth[_0x7cbc('0x6')](),auth[_0x7cbc('0x7')](),controller['pull']);router[_0x7cbc('0x3')](_0x7cbc('0xa'),auth[_0x7cbc('0x6')](),controller[_0x7cbc('0xb')]);router[_0x7cbc('0x3')]('/migrations',controller[_0x7cbc('0xc')]);module[_0x7cbc('0xd')]=router; \ No newline at end of file +var _0x5576=['isAuthenticated','canUpdate','/reset','pull','/restart','restart','/migrations','migrations','express','Router','./version.controller','get','index','/fetch'];(function(_0x21d6e5,_0x38f9cd){var _0x66a736=function(_0x39de29){while(--_0x39de29){_0x21d6e5['push'](_0x21d6e5['shift']());}};_0x66a736(++_0x38f9cd);}(_0x5576,0xa2));var _0x6557=function(_0x381379,_0x3f3b86){_0x381379=_0x381379-0x0;var _0x3e1063=_0x5576[_0x381379];return _0x3e1063;};'use strict';var express=require(_0x6557('0x0'));var router=express[_0x6557('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x6557('0x2'));router[_0x6557('0x3')]('/',controller[_0x6557('0x4')]);router[_0x6557('0x3')](_0x6557('0x5'),auth[_0x6557('0x6')](),auth[_0x6557('0x7')](),controller['fetch']);router['get'](_0x6557('0x8'),auth['isAuthenticated'](),auth[_0x6557('0x7')](),controller['reset']);router[_0x6557('0x3')]('/pull',auth['isAuthenticated'](),auth[_0x6557('0x7')](),controller[_0x6557('0x9')]);router[_0x6557('0x3')](_0x6557('0xa'),auth[_0x6557('0x6')](),controller[_0x6557('0xb')]);router[_0x6557('0x3')](_0x6557('0xc'),controller[_0x6557('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 9223e4a..73e50aa 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 _0x0f78=['query','latest','fetch','tags','2.0.0','json','status','origin','master','error','info','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','readdirSync','join','server','length','push','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','.js','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../config/environment','../../config/pm2','update','simple-git','root','index','exports'];(function(_0x109946,_0x3494b7){var _0x4ed20b=function(_0x578aa4){while(--_0x578aa4){_0x109946['push'](_0x109946['shift']());}};_0x4ed20b(++_0x3494b7);}(_0x0f78,0x1e0));var _0x80f7=function(_0x45fe06,_0x17904c){_0x45fe06=_0x45fe06-0x0;var _0x1082b0=_0x0f78[_0x45fe06];return _0x1082b0;};'use strict';var Umzug=require(_0x80f7('0x0'));var path=require(_0x80f7('0x1'));var fs=require('fs');var _=require(_0x80f7('0x2'));var pkginfo=require(_0x80f7('0x3'))(module,_0x80f7('0x4'));var compareVersions=require(_0x80f7('0x5'));var exec=require(_0x80f7('0x6'))[_0x80f7('0x7')];var db=require('../../mysqldb')['db'];var config=require(_0x80f7('0x8'));var pm2=require(_0x80f7('0x9'));var logger=require('../../config/logger')(_0x80f7('0xa'));var git=require(_0x80f7('0xb'))(config[_0x80f7('0xc')]);exports[_0x80f7('0xd')]=function(_0xc6ee2f,_0x4d518d){var _0x48b0c8={'current':module[_0x80f7('0xe')][_0x80f7('0x4')],'phonebar':0x2};if(_0xc6ee2f[_0x80f7('0xf')]&&_0xc6ee2f[_0x80f7('0xf')][_0x80f7('0x10')]){return git[_0x80f7('0x11')]()[_0x80f7('0x12')](function(_0x509af9,_0x561432){_0x48b0c8[_0x80f7('0x10')]=(_0x509af9?module['exports'][_0x80f7('0x4')]:_0x561432[_0x80f7('0x10')])||_0x80f7('0x13');return _0x4d518d['status'](0xc8)[_0x80f7('0x14')](_0x48b0c8);});}else{return _0x4d518d[_0x80f7('0x15')](0xc8)[_0x80f7('0x14')](_0x48b0c8);}};exports['fetch']=function(_0xb45676,_0x7ad50f){return git[_0x80f7('0x11')]([_0x80f7('0x16'),_0x80f7('0x17')],function(_0x1dc2d2){if(_0x1dc2d2){logger[_0x80f7('0x18')](_0x1dc2d2);return _0x7ad50f[_0x80f7('0x15')](0x1f4)['json'](_0x1dc2d2);}logger[_0x80f7('0x19')]('git\x20fetch');return _0x7ad50f[_0x80f7('0x15')](0xc8)[_0x80f7('0x14')]({'output':_0x80f7('0x1a')});});};exports[_0x80f7('0x1b')]=function(_0x41220a,_0x3aceae){return git['reset'](['--hard',_0x80f7('0x1c')],function(_0x52a1e9){if(_0x52a1e9){logger[_0x80f7('0x18')](_0x52a1e9);return _0x3aceae[_0x80f7('0x15')](0x1f4)[_0x80f7('0x14')](_0x52a1e9);}logger[_0x80f7('0x19')](_0x80f7('0x1d'));return _0x3aceae['status'](0xc8)[_0x80f7('0x14')]({'output':_0x80f7('0x1e')});});};exports[_0x80f7('0x1f')]=function(_0x9e48f9,_0x4deab2){exec(_0x80f7('0x20'),function(_0x517ca1,_0x32bc82,_0xad296a){logger[_0x80f7('0x19')](_0x32bc82);logger['info'](_0xad296a);if(_0x517ca1){logger[_0x80f7('0x18')](_0x517ca1);return _0x4deab2[_0x80f7('0x15')](0x1f4)[_0x80f7('0x14')](_0x517ca1);}return _0x4deab2[_0x80f7('0x15')](0xc8)[_0x80f7('0x14')]({'output':_0x32bc82});});};exports[_0x80f7('0x21')]=function(_0x3e7338,_0x306745){return pm2[_0x80f7('0x21')]('motion2')['then'](function(_0x588673){logger['info'](_0x80f7('0x22'),_0x588673);return _0x306745[_0x80f7('0x15')](0xc8)['json']({'output':_0x80f7('0x23')});})['catch'](function(_0x56fa22){logger['error'](_0x56fa22);return _0x306745['status'](0x1f4)[_0x80f7('0x14')](_0x56fa22);});};exports[_0x80f7('0x24')]=function(_0x588155,_0x4b4f8c){var _0x49aa65=fs[_0x80f7('0x25')](path[_0x80f7('0x26')](config[_0x80f7('0xc')],_0x80f7('0x27'),_0x80f7('0x24')));var _0x172904=[];for(var _0x16dfe4=0x0;_0x16dfe4<_0x49aa65[_0x80f7('0x28')];_0x16dfe4++){var _0x3d8338=_0x49aa65[_0x16dfe4]['replace']('.js','');if(compareVersions(module[_0x80f7('0xe')][_0x80f7('0x4')],_0x3d8338)===-0x1){_0x172904[_0x80f7('0x29')](_0x3d8338);}}if(_0x172904[_0x80f7('0x28')]){var _0x4e1025=_0x172904[_0x80f7('0x2a')](compareVersions);var _0x13d946=new Umzug({'storage':_0x80f7('0x2b'),'storageOptions':{'model':db[_0x80f7('0x2c')],'modelName':_0x80f7('0x2c'),'columnName':'version'},'migrations':{'params':[db[_0x80f7('0x2b')][_0x80f7('0x2d')](),db[_0x80f7('0x2b')][_0x80f7('0x2e')],function(){throw new Error(_0x80f7('0x2f'));}],'path':path[_0x80f7('0x26')](config[_0x80f7('0xc')],_0x80f7('0x27'),_0x80f7('0x24')),'pattern':/\.js$/}});_0x13d946['up']({'migrations':_[_0x80f7('0x30')](_0x4e1025,function(_0x3284b2){return _0x3284b2+_0x80f7('0x31');})})[_0x80f7('0x32')](function(){return _0x4b4f8c['status'](0xc8)[_0x80f7('0x14')]({'output':_0x80f7('0x33')+module['exports']['version']+_0x80f7('0x34')+_['last'](_0x4e1025),'migrations':_[_0x80f7('0x26')](_0x4e1025)});})['catch'](function(_0x3b614b){if(_0x3b614b instanceof db[_0x80f7('0x2b')][_0x80f7('0x35')]){return _0x4b4f8c[_0x80f7('0x15')](0xc8)[_0x80f7('0x14')]({'output':_0x80f7('0x36')});}else{return _0x4b4f8c['status'](0x1f4)[_0x80f7('0x14')](_0x3b614b);}});}else{return _0x4b4f8c[_0x80f7('0x15')](0xc8)[_0x80f7('0x14')]({'output':_0x80f7('0x36')});}}; \ No newline at end of file +var _0x4147=['Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','query','fetch','tags','latest','2.0.0','status','json','origin','master','error','git\x20fetch','git\x20fetch\x20origin\x20master','info','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync','join','server','migrations','replace','.js','push','length','sort','sequelize','Migration','constructor','map','exports','\x20to\x20','last','UniqueConstraintError'];(function(_0x4028e5,_0x30ab38){var _0x204c26=function(_0x44ffd6){while(--_0x44ffd6){_0x4028e5['push'](_0x4028e5['shift']());}};_0x204c26(++_0x30ab38);}(_0x4147,0x190));var _0x7414=function(_0x128e05,_0x50ba3b){_0x128e05=_0x128e05-0x0;var _0x57d769=_0x4147[_0x128e05];return _0x57d769;};'use strict';var Umzug=require(_0x7414('0x0'));var path=require(_0x7414('0x1'));var fs=require('fs');var _=require(_0x7414('0x2'));var pkginfo=require(_0x7414('0x3'))(module,_0x7414('0x4'));var compareVersions=require(_0x7414('0x5'));var exec=require(_0x7414('0x6'))[_0x7414('0x7')];var db=require(_0x7414('0x8'))['db'];var config=require(_0x7414('0x9'));var pm2=require(_0x7414('0xa'));var logger=require(_0x7414('0xb'))(_0x7414('0xc'));var git=require(_0x7414('0xd'))(config[_0x7414('0xe')]);exports[_0x7414('0xf')]=function(_0xd9934,_0x459b1c){var _0x21bb6f={'current':module['exports'][_0x7414('0x4')],'phonebar':0x2};if(_0xd9934[_0x7414('0x10')]&&_0xd9934[_0x7414('0x10')]['latest']){return git[_0x7414('0x11')]()[_0x7414('0x12')](function(_0x2332d1,_0x17ea5a){_0x21bb6f[_0x7414('0x13')]=(_0x2332d1?module['exports'][_0x7414('0x4')]:_0x17ea5a[_0x7414('0x13')])||_0x7414('0x14');return _0x459b1c[_0x7414('0x15')](0xc8)['json'](_0x21bb6f);});}else{return _0x459b1c['status'](0xc8)[_0x7414('0x16')](_0x21bb6f);}};exports['fetch']=function(_0x2289c5,_0x4a8d1e){return git[_0x7414('0x11')]([_0x7414('0x17'),_0x7414('0x18')],function(_0x47c5be){if(_0x47c5be){logger[_0x7414('0x19')](_0x47c5be);return _0x4a8d1e[_0x7414('0x15')](0x1f4)['json'](_0x47c5be);}logger['info'](_0x7414('0x1a'));return _0x4a8d1e[_0x7414('0x15')](0xc8)[_0x7414('0x16')]({'output':_0x7414('0x1b')});});};exports['reset']=function(_0x347b49,_0x59b957){return git['reset'](['--hard','FETCH_HEAD'],function(_0x105b55){if(_0x105b55){logger[_0x7414('0x19')](_0x105b55);return _0x59b957[_0x7414('0x15')](0x1f4)[_0x7414('0x16')](_0x105b55);}logger[_0x7414('0x1c')](_0x7414('0x1d'));return _0x59b957[_0x7414('0x15')](0xc8)['json']({'output':_0x7414('0x1e')});});};exports[_0x7414('0x1f')]=function(_0x4fbc74,_0x1142fd){exec(_0x7414('0x20'),function(_0x324d4b,_0x25eacc,_0x16ebd3){logger[_0x7414('0x1c')](_0x25eacc);logger[_0x7414('0x1c')](_0x16ebd3);if(_0x324d4b){logger['error'](_0x324d4b);return _0x1142fd[_0x7414('0x15')](0x1f4)[_0x7414('0x16')](_0x324d4b);}return _0x1142fd[_0x7414('0x15')](0xc8)['json']({'output':_0x25eacc});});};exports[_0x7414('0x21')]=function(_0x23ff9c,_0x45a364){return pm2[_0x7414('0x21')](_0x7414('0x22'))[_0x7414('0x23')](function(_0x5f0778){logger[_0x7414('0x1c')](_0x7414('0x24'),_0x5f0778);return _0x45a364['status'](0xc8)['json']({'output':_0x7414('0x25')});})[_0x7414('0x26')](function(_0x24f2a3){logger['error'](_0x24f2a3);return _0x45a364[_0x7414('0x15')](0x1f4)[_0x7414('0x16')](_0x24f2a3);});};exports['migrations']=function(_0xaa92be,_0x3cd508){var _0xbc30cc=fs[_0x7414('0x27')](path[_0x7414('0x28')](config[_0x7414('0xe')],_0x7414('0x29'),_0x7414('0x2a')));var _0x4e7baf=[];for(var _0x1face0=0x0;_0x1face0<_0xbc30cc['length'];_0x1face0++){var _0xd87066=_0xbc30cc[_0x1face0][_0x7414('0x2b')](_0x7414('0x2c'),'');if(compareVersions(module['exports']['version'],_0xd87066)===-0x1){_0x4e7baf[_0x7414('0x2d')](_0xd87066);}}if(_0x4e7baf[_0x7414('0x2e')]){var _0x3227e1=_0x4e7baf[_0x7414('0x2f')](compareVersions);var _0x23dcc8=new Umzug({'storage':_0x7414('0x30'),'storageOptions':{'model':db[_0x7414('0x31')],'modelName':'Migration','columnName':'version'},'migrations':{'params':[db[_0x7414('0x30')]['getQueryInterface'](),db[_0x7414('0x30')][_0x7414('0x32')],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[_0x7414('0x28')](config[_0x7414('0xe')],_0x7414('0x29'),'migrations'),'pattern':/\.js$/}});_0x23dcc8['up']({'migrations':_[_0x7414('0x33')](_0x3227e1,function(_0x3d79bb){return _0x3d79bb+'.js';})})[_0x7414('0x23')](function(){return _0x3cd508['status'](0xc8)[_0x7414('0x16')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x7414('0x34')]['version']+_0x7414('0x35')+_[_0x7414('0x36')](_0x3227e1),'migrations':_['join'](_0x3227e1)});})[_0x7414('0x26')](function(_0x477bc1){if(_0x477bc1 instanceof db[_0x7414('0x30')][_0x7414('0x37')]){return _0x3cd508[_0x7414('0x15')](0xc8)[_0x7414('0x16')]({'output':_0x7414('0x38')});}else{return _0x3cd508[_0x7414('0x15')](0x1f4)['json'](_0x477bc1);}});}else{return _0x3cd508[_0x7414('0x15')](0xc8)[_0x7414('0x16')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index a55d133..2dd248e 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 _0x94e5=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','isAuthenticated','index','/describe','describe','get','/:id','show','create','put','delete','destroy'];(function(_0x3acbc5,_0xcb6d86){var _0x58d591=function(_0x1e7f0c){while(--_0x1e7f0c){_0x3acbc5['push'](_0x3acbc5['shift']());}};_0x58d591(++_0xcb6d86);}(_0x94e5,0x94));var _0x594e=function(_0xe5ab6d,_0x38d227){_0xe5ab6d=_0xe5ab6d-0x0;var _0x253d36=_0x94e5[_0xe5ab6d];return _0x253d36;};'use strict';var multer=require(_0x594e('0x0'));var util=require(_0x594e('0x1'));var path=require(_0x594e('0x2'));var timeout=require(_0x594e('0x3'));var express=require('express');var router=express[_0x594e('0x4')]();var fs_extra=require(_0x594e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x594e('0x6'));var config=require(_0x594e('0x7'));var controller=require(_0x594e('0x8'));router['get']('/',auth[_0x594e('0x9')](),controller[_0x594e('0xa')]);router['get'](_0x594e('0xb'),auth['isAuthenticated'](),controller[_0x594e('0xc')]);router[_0x594e('0xd')](_0x594e('0xe'),auth[_0x594e('0x9')](),controller[_0x594e('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x594e('0x10')]);router[_0x594e('0x11')]('/:id',auth[_0x594e('0x9')](),controller['update']);router[_0x594e('0x12')](_0x594e('0xe'),auth[_0x594e('0x9')](),controller[_0x594e('0x13')]);module[_0x594e('0x14')]=router; \ No newline at end of file +var _0x0722=['path','Router','fs-extra','../../components/interaction/service','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','util'];(function(_0x43146e,_0x6c3f){var _0x460dea=function(_0x4db7b3){while(--_0x4db7b3){_0x43146e['push'](_0x43146e['shift']());}};_0x460dea(++_0x6c3f);}(_0x0722,0xb2));var _0x2072=function(_0x3f9ddf,_0x1f0756){_0x3f9ddf=_0x3f9ddf-0x0;var _0x45a73c=_0x0722[_0x3f9ddf];return _0x45a73c;};'use strict';var multer=require(_0x2072('0x0'));var util=require(_0x2072('0x1'));var path=require(_0x2072('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2072('0x3')]();var fs_extra=require(_0x2072('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2072('0x5'));var config=require('../../config/environment');var controller=require(_0x2072('0x6'));router[_0x2072('0x7')]('/',auth[_0x2072('0x8')](),controller[_0x2072('0x9')]);router[_0x2072('0x7')](_0x2072('0xa'),auth['isAuthenticated'](),controller[_0x2072('0xb')]);router[_0x2072('0x7')](_0x2072('0xc'),auth[_0x2072('0x8')](),controller[_0x2072('0xd')]);router[_0x2072('0xe')]('/',auth[_0x2072('0x8')](),controller[_0x2072('0xf')]);router[_0x2072('0x10')](_0x2072('0xc'),auth[_0x2072('0x8')](),controller[_0x2072('0x11')]);router['delete']('/:id',auth[_0x2072('0x8')](),controller[_0x2072('0x12')]);module[_0x2072('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 122dd35..fe0afe6 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 _0x3de3=['sequelize','STRING','DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x5acbef,_0x36b414){var _0x5e9742=function(_0x1fac54){while(--_0x1fac54){_0x5acbef['push'](_0x5acbef['shift']());}};_0x5e9742(++_0x36b414);}(_0x3de3,0x1ce));var _0x33de=function(_0x5e9eeb,_0x2db54c){_0x5e9eeb=_0x5e9eeb-0x0;var _0x810b55=_0x3de3[_0x5e9eeb];return _0x810b55;};'use strict';var Sequelize=require(_0x33de('0x0'));module['exports']={'type':{'type':Sequelize[_0x33de('0x1')]},'uniqueid':{'type':Sequelize[_0x33de('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x33de('0x1')]},'queue':{'type':Sequelize[_0x33de('0x1')]},'interface':{'type':Sequelize[_0x33de('0x1')]},'membername':{'type':Sequelize[_0x33de('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x33de('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x33de('0x2')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x33de('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x33de('0x3')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x33de('0x3')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x33de('0x3')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x33de('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x33de('0x4')]},'reason':{'type':Sequelize[_0x33de('0x1')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x33de('0x1')]},'channelstate':{'type':Sequelize[_0x33de('0x4')]},'channelstatedesc':{'type':Sequelize[_0x33de('0x1')]},'connectedlinenum':{'type':Sequelize[_0x33de('0x1')]},'connectedlinename':{'type':Sequelize[_0x33de('0x1')]},'language':{'type':Sequelize[_0x33de('0x1')]},'accountcode':{'type':Sequelize[_0x33de('0x1')]},'context':{'type':Sequelize[_0x33de('0x1')]},'exten':{'type':Sequelize[_0x33de('0x1')]},'priority':{'type':Sequelize[_0x33de('0x1')]},'destchannel':{'type':Sequelize[_0x33de('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x33de('0x1')]},'destcalleridnum':{'type':Sequelize[_0x33de('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x33de('0x1')]},'destlanguage':{'type':Sequelize[_0x33de('0x1')]},'destaccountcode':{'type':Sequelize[_0x33de('0x1')]},'destcontext':{'type':Sequelize[_0x33de('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x33de('0x1')]},'destuniqueid':{'type':Sequelize[_0x33de('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x33de('0x3')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x33de('0x1')],'comment':_0x33de('0x5')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x33de('0x1')]},'agententerreason':{'type':Sequelize[_0x33de('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd824=['STRING','DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports'];(function(_0x144b6b,_0x284574){var _0x4d96cd=function(_0x44bafc){while(--_0x44bafc){_0x144b6b['push'](_0x144b6b['shift']());}};_0x4d96cd(++_0x284574);}(_0xd824,0xc2));var _0x4d82=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xd824[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x4d82('0x0'));module[_0x4d82('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x4d82('0x2')]},'calleridname':{'type':Sequelize[_0x4d82('0x2')]},'queue':{'type':Sequelize[_0x4d82('0x2')]},'interface':{'type':Sequelize[_0x4d82('0x2')]},'membername':{'type':Sequelize[_0x4d82('0x2')]},'agentcalledAt':{'type':Sequelize[_0x4d82('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x4d82('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x4d82('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x4d82('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x4d82('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x4d82('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x4d82('0x2')]},'channel':{'type':Sequelize[_0x4d82('0x2')]},'channelstate':{'type':Sequelize[_0x4d82('0x5')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x4d82('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x4d82('0x2')]},'accountcode':{'type':Sequelize[_0x4d82('0x2')]},'context':{'type':Sequelize[_0x4d82('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x4d82('0x2')]},'destchannelstate':{'type':Sequelize[_0x4d82('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0x4d82('0x2')]},'destcalleridnum':{'type':Sequelize[_0x4d82('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x4d82('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x4d82('0x2')]},'destlanguage':{'type':Sequelize[_0x4d82('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x4d82('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x4d82('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x4d82('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x4d82('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x4d82('0x2')],'comment':_0x4d82('0x6')},'transferexten':{'type':Sequelize[_0x4d82('0x2')]},'transferuniqueid':{'type':Sequelize[_0x4d82('0x2')]},'agententerreason':{'type':Sequelize[_0x4d82('0x5')],'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 d59b9b6..951bbe2 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(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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 8857d3c..74bbac9 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 _0x8a28=['destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceAgentReport.attributes','exports','VoiceAgentReport','uniqueid'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x8a28,0xfd));var _0x88a2=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0x8a28[_0x28d18d];return _0x470640;};'use strict';var _=require(_0x88a2('0x0'));var util=require(_0x88a2('0x1'));var logger=require(_0x88a2('0x2'))(_0x88a2('0x3'));var moment=require(_0x88a2('0x4'));var BPromise=require(_0x88a2('0x5'));var rp=require(_0x88a2('0x6'));var fs=require('fs');var path=require(_0x88a2('0x7'));var rimraf=require('rimraf');var config=require(_0x88a2('0x8'));var attributes=require(_0x88a2('0x9'));module[_0x88a2('0xa')]=function(_0x438e32,_0x29ce92){return _0x438e32['define'](_0x88a2('0xb'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x88a2('0xc'),_0x88a2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa630=['../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','moment','request-promise','rimraf'];(function(_0x5eb894,_0x4f0cb0){var _0x522e77=function(_0x2fc35a){while(--_0x2fc35a){_0x5eb894['push'](_0x5eb894['shift']());}};_0x522e77(++_0x4f0cb0);}(_0xa630,0xbe));var _0x0a63=function(_0x5dc3d8,_0x397932){_0x5dc3d8=_0x5dc3d8-0x0;var _0x2dc057=_0xa630[_0x5dc3d8];return _0x2dc057;};'use strict';var _=require(_0x0a63('0x0'));var util=require(_0x0a63('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0a63('0x2'));var BPromise=require('bluebird');var rp=require(_0x0a63('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0a63('0x4'));var config=require(_0x0a63('0x5'));var attributes=require(_0x0a63('0x6'));module[_0x0a63('0x7')]=function(_0x37b4c9,_0x4b7474){return _0x37b4c9[_0x0a63('0x8')](_0x0a63('0x9'),attributes,{'tableName':_0x0a63('0xa'),'paranoid':![],'indexes':[{'fields':[_0x0a63('0xb'),_0x0a63('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index e8a1c4e..fee669d 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 _0x5dcb=['jayson/promise','client','http','request','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','UpdateVoiceAgentReport','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x423097,_0x8a09f4){var _0x3a73f1=function(_0x9314f0){while(--_0x9314f0){_0x423097['push'](_0x423097['shift']());}};_0x3a73f1(++_0x8a09f4);}(_0x5dcb,0x149));var _0xb5dc=function(_0x2962d5,_0x38deda){_0x2962d5=_0x2962d5-0x0;var _0x273406=_0x5dcb[_0x2962d5];return _0x273406;};'use strict';var _=require(_0xb5dc('0x0'));var util=require(_0xb5dc('0x1'));var moment=require(_0xb5dc('0x2'));var BPromise=require(_0xb5dc('0x3'));var rs=require(_0xb5dc('0x4'));var fs=require('fs');var Redis=require(_0xb5dc('0x5'));var db=require(_0xb5dc('0x6'))['db'];var utils=require(_0xb5dc('0x7'));var logger=require(_0xb5dc('0x8'))(_0xb5dc('0x9'));var config=require(_0xb5dc('0xa'));var jayson=require(_0xb5dc('0xb'));var client=jayson[_0xb5dc('0xc')][_0xb5dc('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x19ce7c,_0xb5a049,_0x154eb3){return new BPromise(function(_0x5c04b0,_0x367997){return client[_0xb5dc('0xe')](_0x19ce7c,_0x154eb3)[_0xb5dc('0xf')](function(_0x59b051){logger['info'](_0xb5dc('0x10'),_0xb5a049,_0xb5dc('0x11'));logger[_0xb5dc('0x12')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0xb5a049,'request\x20sent',JSON[_0xb5dc('0x13')](_0x59b051));if(_0x59b051[_0xb5dc('0x14')]){if(_0x59b051[_0xb5dc('0x14')][_0xb5dc('0x15')]===0x1f4){logger[_0xb5dc('0x14')]('VoiceAgentReport,\x20%s,\x20%s',_0xb5a049,_0x59b051[_0xb5dc('0x14')][_0xb5dc('0x16')]);return _0x367997(_0x59b051[_0xb5dc('0x14')][_0xb5dc('0x16')]);}logger[_0xb5dc('0x14')](_0xb5dc('0x10'),_0xb5a049,_0x59b051[_0xb5dc('0x14')]['message']);return _0x5c04b0(_0x59b051[_0xb5dc('0x14')][_0xb5dc('0x16')]);}else{logger[_0xb5dc('0x17')](_0xb5dc('0x10'),_0xb5a049,_0xb5dc('0x11'));_0x5c04b0(_0x59b051[_0xb5dc('0x18')]['message']);}})[_0xb5dc('0x19')](function(_0x25c93b){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0xb5a049,_0x25c93b);_0x367997(_0x25c93b);});});}exports[_0xb5dc('0x1a')]=function(_0x31fb0a){var _0x1ae2bd=this;return new Promise(function(_0xca322d,_0x4e9578){return db[_0xb5dc('0x1b')][_0xb5dc('0x1c')](_0x31fb0a[_0xb5dc('0x1d')],{'raw':_0x31fb0a[_0xb5dc('0x1e')]?_0x31fb0a[_0xb5dc('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0xb5dc('0xf')](function(_0x2b27ac){logger[_0xb5dc('0x17')](_0xb5dc('0x1a'),_0x31fb0a);logger['debug'](_0xb5dc('0x1a'),_0x31fb0a,JSON[_0xb5dc('0x13')](_0x2b27ac));_0xca322d(_0x2b27ac);})[_0xb5dc('0x19')](function(_0x4fe19f){logger['error']('CreateVoiceAgentReport',_0x4fe19f['message'],_0x31fb0a);_0x4e9578(_0x1ae2bd[_0xb5dc('0x14')](0x1f4,_0x4fe19f['message']));});});};exports[_0xb5dc('0x1f')]=function(_0x36decc){var _0x425d06=this;return new Promise(function(_0x5b556c,_0x5c7d93){return db[_0xb5dc('0x1b')]['update'](_0x36decc[_0xb5dc('0x1d')],{'raw':_0x36decc[_0xb5dc('0x1e')]?_0x36decc[_0xb5dc('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36decc['options']?_0x36decc[_0xb5dc('0x1e')][_0xb5dc('0x20')]||null:null,'attributes':_0x36decc['options']?_0x36decc[_0xb5dc('0x1e')][_0xb5dc('0x21')]||null:null,'limit':_0x36decc[_0xb5dc('0x1e')]?_0x36decc[_0xb5dc('0x1e')]['limit']||null:null})[_0xb5dc('0xf')](function(_0x343cd6){logger[_0xb5dc('0x17')](_0xb5dc('0x1f'),_0x36decc);logger['debug']('UpdateVoiceAgentReport',_0x36decc,JSON[_0xb5dc('0x13')](_0x343cd6));_0x5b556c(_0x343cd6);})['catch'](function(_0x4bcebc){logger[_0xb5dc('0x14')](_0xb5dc('0x1f'),_0x4bcebc[_0xb5dc('0x16')],_0x36decc);_0x5c7d93(_0x425d06['error'](0x1f4,_0x4bcebc['message']));});});}; \ No newline at end of file +var _0xcd81=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','result','message','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','UpdateVoiceAgentReport','update','where','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x571040,_0xec76f0){var _0x47e469=function(_0x213bfc){while(--_0x213bfc){_0x571040['push'](_0x571040['shift']());}};_0x47e469(++_0xec76f0);}(_0xcd81,0x19e));var _0x1cd8=function(_0x1b3c36,_0x244927){_0x1b3c36=_0x1b3c36-0x0;var _0x30898c=_0xcd81[_0x1b3c36];return _0x30898c;};'use strict';var _=require('lodash');var util=require(_0x1cd8('0x0'));var moment=require(_0x1cd8('0x1'));var BPromise=require(_0x1cd8('0x2'));var rs=require(_0x1cd8('0x3'));var fs=require('fs');var Redis=require(_0x1cd8('0x4'));var db=require(_0x1cd8('0x5'))['db'];var utils=require(_0x1cd8('0x6'));var logger=require(_0x1cd8('0x7'))(_0x1cd8('0x8'));var config=require(_0x1cd8('0x9'));var jayson=require(_0x1cd8('0xa'));var client=jayson[_0x1cd8('0xb')][_0x1cd8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x90be5e,_0x1fe110,_0x2de5e8){return new BPromise(function(_0x2a59de,_0x16f353){return client[_0x1cd8('0xd')](_0x90be5e,_0x2de5e8)[_0x1cd8('0xe')](function(_0x4a693b){logger[_0x1cd8('0xf')](_0x1cd8('0x10'),_0x1fe110,'request\x20sent');logger[_0x1cd8('0x11')](_0x1cd8('0x12'),_0x1fe110,_0x1cd8('0x13'),JSON[_0x1cd8('0x14')](_0x4a693b));if(_0x4a693b[_0x1cd8('0x15')]){if(_0x4a693b[_0x1cd8('0x15')][_0x1cd8('0x16')]===0x1f4){logger['error'](_0x1cd8('0x10'),_0x1fe110,_0x4a693b[_0x1cd8('0x15')]['message']);return _0x16f353(_0x4a693b['error']['message']);}logger[_0x1cd8('0x15')](_0x1cd8('0x10'),_0x1fe110,_0x4a693b[_0x1cd8('0x15')]['message']);return _0x2a59de(_0x4a693b['error']['message']);}else{logger[_0x1cd8('0xf')]('VoiceAgentReport,\x20%s,\x20%s',_0x1fe110,_0x1cd8('0x13'));_0x2a59de(_0x4a693b[_0x1cd8('0x17')][_0x1cd8('0x18')]);}})[_0x1cd8('0x19')](function(_0x16d485){logger[_0x1cd8('0x15')](_0x1cd8('0x10'),_0x1fe110,_0x16d485);_0x16f353(_0x16d485);});});}exports[_0x1cd8('0x1a')]=function(_0xa258c4){var _0x8a35d0=this;return new Promise(function(_0x1be84f,_0x1ffe4d){return db[_0x1cd8('0x1b')][_0x1cd8('0x1c')](_0xa258c4['body'],{'raw':_0xa258c4[_0x1cd8('0x1d')]?_0xa258c4['options'][_0x1cd8('0x1e')]===undefined?!![]:![]:!![]})[_0x1cd8('0xe')](function(_0x18208c){logger[_0x1cd8('0xf')](_0x1cd8('0x1a'),_0xa258c4);logger[_0x1cd8('0x11')](_0x1cd8('0x1a'),_0xa258c4,JSON[_0x1cd8('0x14')](_0x18208c));_0x1be84f(_0x18208c);})[_0x1cd8('0x19')](function(_0x2bb967){logger[_0x1cd8('0x15')](_0x1cd8('0x1a'),_0x2bb967[_0x1cd8('0x18')],_0xa258c4);_0x1ffe4d(_0x8a35d0[_0x1cd8('0x15')](0x1f4,_0x2bb967[_0x1cd8('0x18')]));});});};exports[_0x1cd8('0x1f')]=function(_0x2972bc){var _0x1282df=this;return new Promise(function(_0x3984bd,_0x2a62f3){return db[_0x1cd8('0x1b')][_0x1cd8('0x20')](_0x2972bc['body'],{'raw':_0x2972bc[_0x1cd8('0x1d')]?_0x2972bc[_0x1cd8('0x1d')][_0x1cd8('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2972bc[_0x1cd8('0x1d')]?_0x2972bc[_0x1cd8('0x1d')][_0x1cd8('0x21')]||null:null,'attributes':_0x2972bc[_0x1cd8('0x1d')]?_0x2972bc['options']['attributes']||null:null,'limit':_0x2972bc['options']?_0x2972bc[_0x1cd8('0x1d')][_0x1cd8('0x22')]||null:null})[_0x1cd8('0xe')](function(_0xf79b3f){logger[_0x1cd8('0xf')](_0x1cd8('0x1f'),_0x2972bc);logger[_0x1cd8('0x11')]('UpdateVoiceAgentReport',_0x2972bc,JSON[_0x1cd8('0x14')](_0xf79b3f));_0x3984bd(_0xf79b3f);})['catch'](function(_0x5a4110){logger['error'](_0x1cd8('0x1f'),_0x5a4110[_0x1cd8('0x18')],_0x2972bc);_0x2a62f3(_0x1282df[_0x1cd8('0x15')](0x1f4,_0x5a4110[_0x1cd8('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 19bfdf9..fc594d5 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 _0x24ca=['delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','/:id','post','create','put','update'];(function(_0x424501,_0x42096d){var _0xb719af=function(_0x37adcf){while(--_0x37adcf){_0x424501['push'](_0x424501['shift']());}};_0xb719af(++_0x42096d);}(_0x24ca,0x1bc));var _0xa24c=function(_0x2de020,_0x252df0){_0x2de020=_0x2de020-0x0;var _0x182b7c=_0x24ca[_0x2de020];return _0x182b7c;};'use strict';var multer=require(_0xa24c('0x0'));var util=require('util');var path=require(_0xa24c('0x1'));var timeout=require(_0xa24c('0x2'));var express=require(_0xa24c('0x3'));var router=express['Router']();var fs_extra=require(_0xa24c('0x4'));var auth=require(_0xa24c('0x5'));var interaction=require(_0xa24c('0x6'));var config=require(_0xa24c('0x7'));var controller=require(_0xa24c('0x8'));router[_0xa24c('0x9')]('/',auth[_0xa24c('0xa')](),controller[_0xa24c('0xb')]);router[_0xa24c('0x9')](_0xa24c('0xc'),auth[_0xa24c('0xa')](),controller['describe']);router[_0xa24c('0x9')](_0xa24c('0xd'),auth[_0xa24c('0xa')](),controller['show']);router[_0xa24c('0xe')]('/',auth[_0xa24c('0xa')](),controller[_0xa24c('0xf')]);router[_0xa24c('0x10')](_0xa24c('0xd'),auth[_0xa24c('0xa')](),controller[_0xa24c('0x11')]);router[_0xa24c('0x12')](_0xa24c('0xd'),auth['isAuthenticated'](),controller[_0xa24c('0x13')]);module[_0xa24c('0x14')]=router; \ No newline at end of file +var _0xac9d=['../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','show','post','create','put','/:id','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xac9d,0x14d));var _0xdac9=function(_0x5c6a78,_0x5c0503){_0x5c6a78=_0x5c6a78-0x0;var _0x236c5e=_0xac9d[_0x5c6a78];return _0x236c5e;};'use strict';var multer=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var path=require(_0xdac9('0x2'));var timeout=require(_0xdac9('0x3'));var express=require(_0xdac9('0x4'));var router=express[_0xdac9('0x5')]();var fs_extra=require(_0xdac9('0x6'));var auth=require(_0xdac9('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xdac9('0x8'));var controller=require('./voiceCallReport.controller');router[_0xdac9('0x9')]('/',auth[_0xdac9('0xa')](),controller[_0xdac9('0xb')]);router[_0xdac9('0x9')](_0xdac9('0xc'),auth[_0xdac9('0xa')](),controller['describe']);router[_0xdac9('0x9')]('/:id',auth[_0xdac9('0xa')](),controller[_0xdac9('0xd')]);router[_0xdac9('0xe')]('/',auth[_0xdac9('0xa')](),controller[_0xdac9('0xf')]);router[_0xdac9('0x10')](_0xdac9('0x11'),auth[_0xdac9('0xa')](),controller[_0xdac9('0x12')]);router['delete'](_0xdac9('0x11'),auth[_0xdac9('0xa')](),controller['destroy']);module[_0xdac9('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 6e28f58..b29ee82 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 _0xc273=['exports','STRING','ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize'];(function(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0xc273,0x137));var _0x3c27=function(_0x4a1412,_0x2b6ee8){_0x4a1412=_0x4a1412-0x0;var _0x2cc456=_0xc273[_0x4a1412];return _0x2cc456;};'use strict';var Sequelize=require(_0x3c27('0x0'));module[_0x3c27('0x1')]={'uniqueid':{'type':Sequelize[_0x3c27('0x2')]},'type':{'type':Sequelize[_0x3c27('0x3')](_0x3c27('0x4'),_0x3c27('0x5'),_0x3c27('0x6'),_0x3c27('0x7'),_0x3c27('0x8'),_0x3c27('0x9'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x3c27('0x2')]},'source':{'type':Sequelize[_0x3c27('0x2')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x3c27('0x2')]},'callerid':{'type':Sequelize[_0x3c27('0x2')]},'channel':{'type':Sequelize[_0x3c27('0x2')]},'destinationchannel':{'type':Sequelize[_0x3c27('0x2')]},'lastapplication':{'type':Sequelize[_0x3c27('0x2')]},'lastdata':{'type':Sequelize[_0x3c27('0xa')]},'starttime':{'type':Sequelize[_0x3c27('0xb')]},'systemanswertime':{'type':Sequelize[_0x3c27('0xb')]},'answertime':{'type':Sequelize[_0x3c27('0xb')]},'endtime':{'type':Sequelize[_0x3c27('0xb')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x3c27('0xc')]},'mohtime':{'type':Sequelize[_0x3c27('0xc')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x3c27('0x2')]},'amaflags':{'type':Sequelize[_0x3c27('0x2')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x3c27('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x3c27('0x2')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x3c27('0x2')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x3c27('0x2')]}}; \ No newline at end of file +var _0xa321=['TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM','internal','outbound','outbound-fax','dialer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa321,0x9d));var _0x1a32=function(_0x388914,_0x3c63f9){_0x388914=_0x388914-0x0;var _0x1f9111=_0xa321[_0x388914];return _0x1f9111;};'use strict';var Sequelize=require(_0x1a32('0x0'));module[_0x1a32('0x1')]={'uniqueid':{'type':Sequelize[_0x1a32('0x2')]},'type':{'type':Sequelize[_0x1a32('0x3')]('inbound',_0x1a32('0x4'),_0x1a32('0x5'),'inbound-fax',_0x1a32('0x6'),_0x1a32('0x7'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x1a32('0x2')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x1a32('0x2')]},'channel':{'type':Sequelize[_0x1a32('0x2')]},'destinationchannel':{'type':Sequelize[_0x1a32('0x2')]},'lastapplication':{'type':Sequelize[_0x1a32('0x2')]},'lastdata':{'type':Sequelize[_0x1a32('0x8')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x1a32('0x9')]},'answertime':{'type':Sequelize[_0x1a32('0x9')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0x1a32('0xa')]},'billableseconds':{'type':Sequelize[_0x1a32('0xa')]},'mohtime':{'type':Sequelize[_0x1a32('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x1a32('0x2')]},'amaflags':{'type':Sequelize[_0x1a32('0x2')]},'userfield':{'type':Sequelize[_0x1a32('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x1a32('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x1a32('0x2')]},'note':{'type':Sequelize[_0x1a32('0x2')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x1a32('0xa')]},'sipcallid':{'type':Sequelize[_0x1a32('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index e72971a..32abdf4 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(_0x1b5a05,_0x2c80de){var _0x347931=function(_0xd39454){while(--_0xd39454){_0x1b5a05['push'](_0x1b5a05['shift']());}};_0x347931(++_0x2c80de);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1672a3,_0x32e3e1){_0x1672a3=_0x1672a3-0x0;var _0x23a83c=_0x5f2f[_0x1672a3];return _0x23a83c;};'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 _0xadb5=['filter','VIRTUAL','merge','options','includeAll','include','fullname','User','findAll','rows','show','rawAttributes','length','find','catch','body','params','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0x3f5dca,_0x59472b){var _0x5b833a=function(_0x1cb84b){while(--_0x1cb84b){_0x3f5dca['push'](_0x3f5dca['shift']());}};_0x5b833a(++_0x59472b);}(_0xadb5,0xad));var _0x5adb=function(_0x34744c,_0x2957c7){_0x34744c=_0x34744c-0x0;var _0xd7b3cf=_0xadb5[_0x34744c];return _0xd7b3cf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['VoiceCallReport']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'attributes':['id',_0x5adb('0x26'),_0x5adb('0x40'),'alias'],'model':db['User'],'as':_0x5adb('0x41')}];}return db['VoiceCallReport'][_0x5adb('0x42')](_0x5d457e);})[_0x5adb('0x22')](function(_0x299746){_0x1eac55[_0x5adb('0x43')]=_0x299746;return _0x1eac55;})[_0x5adb('0x22')](respondWithFilteredResult(_0x49992e,_0x5d457e))['catch'](handleError(_0x49992e,null));};exports[_0x5adb('0x44')]=function(_0x565b03,_0x508690){var _0x4160ad={'raw':!![],'where':{'id':_0x565b03['params']['id']}},_0x1a256c={};_0x1a256c[_0x5adb('0x2e')]=_[_0x5adb('0x30')](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x1a256c[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x565b03[_0x5adb('0x2f')]);_0x1a256c['filters']=_['intersection'](_0x1a256c[_0x5adb('0x2e')],_0x1a256c[_0x5adb('0x2f')]);_0x4160ad[_0x5adb('0x32')]=_[_0x5adb('0x31')](_0x1a256c['model'],qs['fields'](_0x565b03[_0x5adb('0x2f')][_0x5adb('0x33')]));_0x4160ad[_0x5adb('0x32')]=_0x4160ad[_0x5adb('0x32')][_0x5adb('0x46')]?_0x4160ad['attributes']:_0x1a256c[_0x5adb('0x2e')];if(_0x565b03[_0x5adb('0x2f')]['includeAll']){_0x4160ad[_0x5adb('0x3f')]=[{'all':!![]}];}_0x4160ad=_[_0x5adb('0x3c')]({},_0x4160ad,_0x565b03[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')][_0x5adb('0x47')](_0x4160ad)[_0x5adb('0x22')](handleEntityNotFound(_0x508690,null))[_0x5adb('0x22')](respondWithResult(_0x508690,null))[_0x5adb('0x48')](handleError(_0x508690,null));};exports['create']=function(_0x3a925b,_0x57dc8b){return db['VoiceCallReport']['create'](_0x3a925b[_0x5adb('0x49')],{})[_0x5adb('0x22')](respondWithResult(_0x57dc8b,0xc9))[_0x5adb('0x48')](handleError(_0x57dc8b,null));};exports['destroy']=function(_0x2ad69d,_0x5cbab5){return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'id':_0x2ad69d[_0x5adb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cbab5,null))[_0x5adb('0x22')](removeEntity(_0x5cbab5,null))['catch'](handleError(_0x5cbab5,null));};exports[_0x5adb('0x4b')]=function(_0x6dc067,_0x55c535){return db[_0x5adb('0x2a')][_0x5adb('0x4b')]()[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x48')](handleError(_0x55c535,null));};exports[_0x5adb('0x21')]=function(_0x4cb36c,_0x36b847){if(_0x4cb36c[_0x5adb('0x49')][_0x5adb('0x4c')]){delete _0x4cb36c[_0x5adb('0x49')]['uniqueid'];}return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'uniqueid':_0x4cb36c[_0x5adb('0x4a')]['id'],'UserId':{'$or':[null,_0x4cb36c['user']['id']]}}})[_0x5adb('0x22')](handleEntityNotFound(_0x36b847,null))[_0x5adb('0x22')](saveUpdates(_0x4cb36c[_0x5adb('0x49')],null))[_0x5adb('0x22')](respondWithResult(_0x36b847,null))['catch'](handleError(_0x36b847,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 9f5c4de..b6da6fb 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 _0x7f8b=['./voiceCallReport.attributes','report_call','uniqueid','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x1573eb,_0x136ed4){var _0x6b69e2=function(_0x5d5689){while(--_0x5d5689){_0x1573eb['push'](_0x1573eb['shift']());}};_0x6b69e2(++_0x136ed4);}(_0x7f8b,0x10b));var _0xb7f8=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x7f8b[_0x2dadb9];return _0x2f0097;};'use strict';var _=require(_0xb7f8('0x0'));var util=require(_0xb7f8('0x1'));var logger=require(_0xb7f8('0x2'))('api');var moment=require(_0xb7f8('0x3'));var BPromise=require('bluebird');var rp=require(_0xb7f8('0x4'));var fs=require('fs');var path=require(_0xb7f8('0x5'));var rimraf=require(_0xb7f8('0x6'));var config=require(_0xb7f8('0x7'));var attributes=require(_0xb7f8('0x8'));module['exports']=function(_0x2ca6e6,_0x1f5731){return _0x2ca6e6['define']('VoiceCallReport',attributes,{'tableName':_0xb7f8('0x9'),'paranoid':![],'indexes':[{'fields':[_0xb7f8('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x00b7=['moment','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','define','VoiceCallReport','report_call','lodash','util','../../config/logger'];(function(_0x4e284d,_0x12f12e){var _0x3d4703=function(_0x3456dc){while(--_0x3456dc){_0x4e284d['push'](_0x4e284d['shift']());}};_0x3d4703(++_0x12f12e);}(_0x00b7,0x8d));var _0x700b=function(_0xdf34e1,_0x41bec8){_0xdf34e1=_0xdf34e1-0x0;var _0x157d5d=_0x00b7[_0xdf34e1];return _0x157d5d;};'use strict';var _=require(_0x700b('0x0'));var util=require(_0x700b('0x1'));var logger=require(_0x700b('0x2'))('api');var moment=require(_0x700b('0x3'));var BPromise=require('bluebird');var rp=require(_0x700b('0x4'));var fs=require('fs');var path=require(_0x700b('0x5'));var rimraf=require(_0x700b('0x6'));var config=require(_0x700b('0x7'));var attributes=require(_0x700b('0x8'));module['exports']=function(_0x4c1450,_0x9b7fae){return _0x4c1450[_0x700b('0x9')](_0x700b('0xa'),attributes,{'tableName':_0x700b('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 46af94b..44c35b2 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 _0xe8cc=['bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','request','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetVoiceCallReport','findAll','options','where','attributes','limit','include','map','model','CreateVoiceCallReport','VoiceCallReport','create','body','raw','update','UpdateVoiceCallReport','lodash','moment'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0xe8cc,0x11e));var _0xce8c=function(_0x331eae,_0x3e628d){_0x331eae=_0x331eae-0x0;var _0x792ab3=_0xe8cc[_0x331eae];return _0x792ab3;};'use strict';var _=require(_0xce8c('0x0'));var util=require('util');var moment=require(_0xce8c('0x1'));var BPromise=require(_0xce8c('0x2'));var rs=require(_0xce8c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xce8c('0x4'));var logger=require(_0xce8c('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xce8c('0x6'));var client=jayson[_0xce8c('0x7')][_0xce8c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x42ff69,_0x57d013,_0x126553){return new BPromise(function(_0x2e0821,_0x575f7c){return client[_0xce8c('0x9')](_0x42ff69,_0x126553)['then'](function(_0x83fbec){logger['info'](_0xce8c('0xa'),_0x57d013,_0xce8c('0xb'));logger[_0xce8c('0xc')](_0xce8c('0xd'),_0x57d013,'request\x20sent',JSON[_0xce8c('0xe')](_0x83fbec));if(_0x83fbec[_0xce8c('0xf')]){if(_0x83fbec[_0xce8c('0xf')]['code']===0x1f4){logger[_0xce8c('0xf')](_0xce8c('0xa'),_0x57d013,_0x83fbec['error']['message']);return _0x575f7c(_0x83fbec[_0xce8c('0xf')][_0xce8c('0x10')]);}logger[_0xce8c('0xf')](_0xce8c('0xa'),_0x57d013,_0x83fbec[_0xce8c('0xf')]['message']);return _0x2e0821(_0x83fbec[_0xce8c('0xf')][_0xce8c('0x10')]);}else{logger[_0xce8c('0x11')](_0xce8c('0xa'),_0x57d013,_0xce8c('0xb'));_0x2e0821(_0x83fbec[_0xce8c('0x12')][_0xce8c('0x10')]);}})[_0xce8c('0x13')](function(_0x2bc2db){logger[_0xce8c('0xf')](_0xce8c('0xa'),_0x57d013,_0x2bc2db);_0x575f7c(_0x2bc2db);});});}exports[_0xce8c('0x14')]=function(_0x3da5ce){var _0x53c38f=this;return new Promise(function(_0x2b3a86,_0x48931a){return db['VoiceCallReport'][_0xce8c('0x15')]({'raw':_0x3da5ce['options']?_0x3da5ce[_0xce8c('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x3da5ce[_0xce8c('0x16')]?_0x3da5ce[_0xce8c('0x16')][_0xce8c('0x17')]||null:null,'attributes':_0x3da5ce[_0xce8c('0x16')]?_0x3da5ce['options'][_0xce8c('0x18')]||null:null,'limit':_0x3da5ce['options']?_0x3da5ce[_0xce8c('0x16')][_0xce8c('0x19')]||null:null,'include':_0x3da5ce[_0xce8c('0x16')]?_0x3da5ce[_0xce8c('0x16')][_0xce8c('0x1a')]?_[_0xce8c('0x1b')](_0x3da5ce[_0xce8c('0x16')]['include'],function(_0x67e178){return{'model':db[_0x67e178[_0xce8c('0x1c')]],'as':_0x67e178['as'],'attributes':_0x67e178[_0xce8c('0x18')],'include':_0x67e178[_0xce8c('0x1a')]?_[_0xce8c('0x1b')](_0x67e178[_0xce8c('0x1a')],function(_0x3396f1){return{'model':db[_0x3396f1[_0xce8c('0x1c')]],'as':_0x3396f1['as'],'attributes':_0x3396f1[_0xce8c('0x18')],'include':_0x3396f1[_0xce8c('0x1a')]?_[_0xce8c('0x1b')](_0x3396f1['include'],function(_0x58ed28){return{'model':db[_0x58ed28[_0xce8c('0x1c')]],'as':_0x58ed28['as'],'attributes':_0x58ed28[_0xce8c('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3bb4ac){logger[_0xce8c('0x11')](_0xce8c('0x14'),_0x3da5ce);logger[_0xce8c('0xc')](_0xce8c('0x14'),_0x3da5ce,JSON[_0xce8c('0xe')](_0x3bb4ac));_0x2b3a86(_0x3bb4ac);})[_0xce8c('0x13')](function(_0x678913){logger[_0xce8c('0xf')](_0xce8c('0x14'),_0x678913[_0xce8c('0x10')],_0x3da5ce);_0x48931a(_0x53c38f[_0xce8c('0xf')](0x1f4,_0x678913[_0xce8c('0x10')]));});});};exports[_0xce8c('0x1d')]=function(_0x369aed){var _0x4c1de7=this;return new Promise(function(_0x36c179,_0x21e169){return db[_0xce8c('0x1e')][_0xce8c('0x1f')](_0x369aed[_0xce8c('0x20')],{'raw':_0x369aed[_0xce8c('0x16')]?_0x369aed[_0xce8c('0x16')][_0xce8c('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x4522b5){logger['info'](_0xce8c('0x1d'),_0x369aed);logger[_0xce8c('0xc')](_0xce8c('0x1d'),_0x369aed,JSON['stringify'](_0x4522b5));_0x36c179(_0x4522b5);})[_0xce8c('0x13')](function(_0x555f48){logger['error']('CreateVoiceCallReport',_0x555f48['message'],_0x369aed);_0x21e169(_0x4c1de7[_0xce8c('0xf')](0x1f4,_0x555f48[_0xce8c('0x10')]));});});};exports['UpdateVoiceCallReport']=function(_0xc23da3){var _0x47dbd7=this;return new Promise(function(_0x58ff96,_0x29eaf3){return db[_0xce8c('0x1e')][_0xce8c('0x22')](_0xc23da3[_0xce8c('0x20')],{'raw':_0xc23da3[_0xce8c('0x16')]?_0xc23da3[_0xce8c('0x16')][_0xce8c('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc23da3[_0xce8c('0x16')]?_0xc23da3[_0xce8c('0x16')][_0xce8c('0x17')]||null:null,'attributes':_0xc23da3[_0xce8c('0x16')]?_0xc23da3[_0xce8c('0x16')][_0xce8c('0x18')]||null:null,'limit':_0xc23da3[_0xce8c('0x16')]?_0xc23da3['options']['limit']||null:null})['then'](function(_0x3c8dcb){logger[_0xce8c('0x11')](_0xce8c('0x23'),_0xc23da3);logger[_0xce8c('0xc')]('UpdateVoiceCallReport',_0xc23da3,JSON['stringify'](_0x3c8dcb));_0x58ff96(_0x3c8dcb);})[_0xce8c('0x13')](function(_0x526100){logger[_0xce8c('0xf')](_0xce8c('0x23'),_0x526100[_0xce8c('0x10')],_0xc23da3);_0x29eaf3(_0x47dbd7[_0xce8c('0xf')](0x1f4,_0x526100[_0xce8c('0x10')]));});});}; \ No newline at end of file +var _0xff92=['CreateVoiceCallReport','VoiceCallReport','create','UpdateVoiceCallReport','update','body','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetVoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x4e7c8d,_0xa46f72){var _0x2b829c=function(_0x18f076){while(--_0x18f076){_0x4e7c8d['push'](_0x4e7c8d['shift']());}};_0x2b829c(++_0xa46f72);}(_0xff92,0xce));var _0x2ff9=function(_0x29b691,_0x17efd8){_0x29b691=_0x29b691-0x0;var _0x37e5d1=_0xff92[_0x29b691];return _0x37e5d1;};'use strict';var _=require(_0x2ff9('0x0'));var util=require('util');var moment=require(_0x2ff9('0x1'));var BPromise=require(_0x2ff9('0x2'));var rs=require(_0x2ff9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2ff9('0x4'));var logger=require(_0x2ff9('0x5'))(_0x2ff9('0x6'));var config=require(_0x2ff9('0x7'));var jayson=require(_0x2ff9('0x8'));var client=jayson[_0x2ff9('0x9')][_0x2ff9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27b84d,_0x3e83b8,_0x54b543){return new BPromise(function(_0xd215cf,_0x21b281){return client[_0x2ff9('0xb')](_0x27b84d,_0x54b543)[_0x2ff9('0xc')](function(_0x4ef9e4){logger[_0x2ff9('0xd')](_0x2ff9('0xe'),_0x3e83b8,_0x2ff9('0xf'));logger[_0x2ff9('0x10')](_0x2ff9('0x11'),_0x3e83b8,_0x2ff9('0xf'),JSON[_0x2ff9('0x12')](_0x4ef9e4));if(_0x4ef9e4['error']){if(_0x4ef9e4['error'][_0x2ff9('0x13')]===0x1f4){logger[_0x2ff9('0x14')]('VoiceCallReport,\x20%s,\x20%s',_0x3e83b8,_0x4ef9e4[_0x2ff9('0x14')][_0x2ff9('0x15')]);return _0x21b281(_0x4ef9e4[_0x2ff9('0x14')]['message']);}logger[_0x2ff9('0x14')](_0x2ff9('0xe'),_0x3e83b8,_0x4ef9e4['error']['message']);return _0xd215cf(_0x4ef9e4[_0x2ff9('0x14')][_0x2ff9('0x15')]);}else{logger[_0x2ff9('0xd')](_0x2ff9('0xe'),_0x3e83b8,_0x2ff9('0xf'));_0xd215cf(_0x4ef9e4[_0x2ff9('0x16')][_0x2ff9('0x15')]);}})[_0x2ff9('0x17')](function(_0x5f3ede){logger[_0x2ff9('0x14')]('VoiceCallReport,\x20%s,\x20%s',_0x3e83b8,_0x5f3ede);_0x21b281(_0x5f3ede);});});}exports[_0x2ff9('0x18')]=function(_0x168322){var _0x21fd37=this;return new Promise(function(_0x2bc7b1,_0x177f5b){return db['VoiceCallReport'][_0x2ff9('0x19')]({'raw':_0x168322[_0x2ff9('0x1a')]?_0x168322[_0x2ff9('0x1a')][_0x2ff9('0x1b')]===undefined?!![]:![]:!![],'where':_0x168322[_0x2ff9('0x1a')]?_0x168322['options'][_0x2ff9('0x1c')]||null:null,'attributes':_0x168322[_0x2ff9('0x1a')]?_0x168322[_0x2ff9('0x1a')][_0x2ff9('0x1d')]||null:null,'limit':_0x168322['options']?_0x168322[_0x2ff9('0x1a')][_0x2ff9('0x1e')]||null:null,'include':_0x168322['options']?_0x168322['options'][_0x2ff9('0x1f')]?_[_0x2ff9('0x20')](_0x168322[_0x2ff9('0x1a')][_0x2ff9('0x1f')],function(_0x365188){return{'model':db[_0x365188[_0x2ff9('0x21')]],'as':_0x365188['as'],'attributes':_0x365188[_0x2ff9('0x1d')],'include':_0x365188[_0x2ff9('0x1f')]?_[_0x2ff9('0x20')](_0x365188['include'],function(_0x17e4b1){return{'model':db[_0x17e4b1['model']],'as':_0x17e4b1['as'],'attributes':_0x17e4b1['attributes'],'include':_0x17e4b1['include']?_[_0x2ff9('0x20')](_0x17e4b1[_0x2ff9('0x1f')],function(_0x2650cc){return{'model':db[_0x2650cc[_0x2ff9('0x21')]],'as':_0x2650cc['as'],'attributes':_0x2650cc['attributes']};}):[]};}):[]};}):[]:[]})[_0x2ff9('0xc')](function(_0x13d3c8){logger[_0x2ff9('0xd')](_0x2ff9('0x18'),_0x168322);logger[_0x2ff9('0x10')]('GetVoiceCallReport',_0x168322,JSON[_0x2ff9('0x12')](_0x13d3c8));_0x2bc7b1(_0x13d3c8);})[_0x2ff9('0x17')](function(_0x5743d6){logger['error']('GetVoiceCallReport',_0x5743d6[_0x2ff9('0x15')],_0x168322);_0x177f5b(_0x21fd37['error'](0x1f4,_0x5743d6[_0x2ff9('0x15')]));});});};exports[_0x2ff9('0x22')]=function(_0x46d050){var _0x156533=this;return new Promise(function(_0x197548,_0x5a092c){return db[_0x2ff9('0x23')][_0x2ff9('0x24')](_0x46d050['body'],{'raw':_0x46d050[_0x2ff9('0x1a')]?_0x46d050['options'][_0x2ff9('0x1b')]===undefined?!![]:![]:!![]})[_0x2ff9('0xc')](function(_0x5baba5){logger[_0x2ff9('0xd')](_0x2ff9('0x22'),_0x46d050);logger[_0x2ff9('0x10')](_0x2ff9('0x22'),_0x46d050,JSON[_0x2ff9('0x12')](_0x5baba5));_0x197548(_0x5baba5);})[_0x2ff9('0x17')](function(_0x328ab3){logger[_0x2ff9('0x14')](_0x2ff9('0x22'),_0x328ab3['message'],_0x46d050);_0x5a092c(_0x156533[_0x2ff9('0x14')](0x1f4,_0x328ab3[_0x2ff9('0x15')]));});});};exports[_0x2ff9('0x25')]=function(_0x2c0e34){var _0x32b5d7=this;return new Promise(function(_0x265195,_0x2170c6){return db[_0x2ff9('0x23')][_0x2ff9('0x26')](_0x2c0e34[_0x2ff9('0x27')],{'raw':_0x2c0e34[_0x2ff9('0x1a')]?_0x2c0e34[_0x2ff9('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c0e34[_0x2ff9('0x1a')]?_0x2c0e34[_0x2ff9('0x1a')]['where']||null:null,'attributes':_0x2c0e34[_0x2ff9('0x1a')]?_0x2c0e34['options'][_0x2ff9('0x1d')]||null:null,'limit':_0x2c0e34['options']?_0x2c0e34[_0x2ff9('0x1a')][_0x2ff9('0x1e')]||null:null})[_0x2ff9('0xc')](function(_0x38a2b5){logger['info'](_0x2ff9('0x25'),_0x2c0e34);logger['debug'](_0x2ff9('0x25'),_0x2c0e34,JSON[_0x2ff9('0x12')](_0x38a2b5));_0x265195(_0x38a2b5);})['catch'](function(_0x335e8b){logger[_0x2ff9('0x14')]('UpdateVoiceCallReport',_0x335e8b[_0x2ff9('0x15')],_0x2c0e34);_0x2170c6(_0x32b5d7[_0x2ff9('0x14')](0x1f4,_0x335e8b[_0x2ff9('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index ac6cfd8..2ef3ec5 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 _0xdf1b=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','destroy','exports','util','path','connect-timeout'];(function(_0x3a4a64,_0x1d2f5c){var _0x135708=function(_0x3402cc){while(--_0x3402cc){_0x3a4a64['push'](_0x3a4a64['shift']());}};_0x135708(++_0x1d2f5c);}(_0xdf1b,0x90));var _0xbdf1=function(_0x37b3e5,_0x33b516){_0x37b3e5=_0x37b3e5-0x0;var _0x207f20=_0xdf1b[_0x37b3e5];return _0x207f20;};'use strict';var multer=require('multer');var util=require(_0xbdf1('0x0'));var path=require(_0xbdf1('0x1'));var timeout=require(_0xbdf1('0x2'));var express=require(_0xbdf1('0x3'));var router=express[_0xbdf1('0x4')]();var fs_extra=require(_0xbdf1('0x5'));var auth=require(_0xbdf1('0x6'));var interaction=require(_0xbdf1('0x7'));var config=require(_0xbdf1('0x8'));var controller=require(_0xbdf1('0x9'));router[_0xbdf1('0xa')]('/',auth[_0xbdf1('0xb')](),controller[_0xbdf1('0xc')]);router[_0xbdf1('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xbdf1('0xd')]);router[_0xbdf1('0xe')]('/',auth[_0xbdf1('0xb')](),controller[_0xbdf1('0xf')]);router[_0xbdf1('0x10')](_0xbdf1('0x11'),auth['isAuthenticated'](),controller[_0xbdf1('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xbdf1('0x13')]);module[_0xbdf1('0x14')]=router; \ No newline at end of file +var _0xd75b=['/:id','show','post','create','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x439790,_0x2f4e02){var _0x1275ab=function(_0x23eea7){while(--_0x23eea7){_0x439790['push'](_0x439790['shift']());}};_0x1275ab(++_0x2f4e02);}(_0xd75b,0xa8));var _0xbd75=function(_0x2b15c7,_0x1bb79d){_0x2b15c7=_0x2b15c7-0x0;var _0x513151=_0xd75b[_0x2b15c7];return _0x513151;};'use strict';var multer=require(_0xbd75('0x0'));var util=require(_0xbd75('0x1'));var path=require(_0xbd75('0x2'));var timeout=require('connect-timeout');var express=require(_0xbd75('0x3'));var router=express[_0xbd75('0x4')]();var fs_extra=require(_0xbd75('0x5'));var auth=require(_0xbd75('0x6'));var interaction=require(_0xbd75('0x7'));var config=require(_0xbd75('0x8'));var controller=require('./voiceChanSpy.controller');router[_0xbd75('0x9')]('/',auth[_0xbd75('0xa')](),controller[_0xbd75('0xb')]);router[_0xbd75('0x9')](_0xbd75('0xc'),auth['isAuthenticated'](),controller[_0xbd75('0xd')]);router[_0xbd75('0xe')]('/',auth[_0xbd75('0xa')](),controller[_0xbd75('0xf')]);router['put'](_0xbd75('0xc'),auth[_0xbd75('0xa')](),controller[_0xbd75('0x10')]);router[_0xbd75('0x11')]('/:id',auth[_0xbd75('0xa')](),controller[_0xbd75('0x12')]);module[_0xbd75('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 527ada5..a1ebe1f 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 _0xf78c=['exports','STRING','setDataValue','options','join','getDataValue','split','BOOLEAN','sequelize'];(function(_0x1aa21c,_0xe7dedd){var _0x45edb8=function(_0xa003be){while(--_0xa003be){_0x1aa21c['push'](_0x1aa21c['shift']());}};_0x45edb8(++_0xe7dedd);}(_0xf78c,0xbc));var _0xcf78=function(_0x3f9507,_0x48f027){_0x3f9507=_0x3f9507-0x0;var _0x3d6f6d=_0xf78c[_0x3f9507];return _0x3d6f6d;};'use strict';var Sequelize=require(_0xcf78('0x0'));module[_0xcf78('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xcf78('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0xcf78('0x2')],'set':function(_0x2871ad){this[_0xcf78('0x3')](_0xcf78('0x4'),_0x2871ad?_0x2871ad[_0xcf78('0x5')](''):[]);},'get':function(){return this[_0xcf78('0x6')](_0xcf78('0x4'))?this[_0xcf78('0x6')](_0xcf78('0x4'))[_0xcf78('0x7')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0xcf78('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xcf78('0x2')]},'description':{'type':Sequelize[_0xcf78('0x2')]}}; \ No newline at end of file +var _0x52f8=['getDataValue','options','split','BOOLEAN','sequelize','exports','STRING','setDataValue','join'];(function(_0x31273b,_0x235881){var _0x164231=function(_0x385fab){while(--_0x385fab){_0x31273b['push'](_0x31273b['shift']());}};_0x164231(++_0x235881);}(_0x52f8,0x1ea));var _0x852f=function(_0x3b75b5,_0x22c12f){_0x3b75b5=_0x3b75b5-0x0;var _0x8815f9=_0x52f8[_0x3b75b5];return _0x8815f9;};'use strict';var Sequelize=require(_0x852f('0x0'));module[_0x852f('0x1')]={'name':{'type':Sequelize[_0x852f('0x2')]},'prefix':{'type':Sequelize[_0x852f('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x852f('0x2')],'set':function(_0x40ed71){this[_0x852f('0x3')]('options',_0x40ed71?_0x40ed71[_0x852f('0x4')](''):[]);},'get':function(){return this[_0x852f('0x5')](_0x852f('0x6'))?this[_0x852f('0x5')](_0x852f('0x6'))[_0x852f('0x7')](''):[];}},'auth':{'type':Sequelize[_0x852f('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x852f('0x2')]},'record':{'type':Sequelize[_0x852f('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x852f('0x2')]},'description':{'type':Sequelize[_0x852f('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index dfcd20c..aea7cac 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 _0xbdeb=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','type','VIRTUAL','filter','merge','VoiceChanSpy','includeAll','findAll','rows','catch','params','include','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','rimraf','fast-json-patch','moment','bluebird','mustache','util','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','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','limit','count','set','Content-Range','json','reject','save','update','then','destroy','get','ChanSpies','UserProfileResource','error','stack','name','send','index','map','rawAttributes'];(function(_0x317131,_0x3e621e){var _0x235757=function(_0x33d450){while(--_0x33d450){_0x317131['push'](_0x317131['shift']());}};_0x235757(++_0x3e621e);}(_0xbdeb,0x6f));var _0xbbde=function(_0x2b3b07,_0xa237cb){_0x2b3b07=_0x2b3b07-0x0;var _0x553ac5=_0xbdeb[_0x2b3b07];return _0x553ac5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbbde('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbbde('0x1'));var rp=require('request-promise');var moment=require(_0xbbde('0x2'));var BPromise=require(_0xbbde('0x3'));var Mustache=require(_0xbbde('0x4'));var util=require(_0xbbde('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xbbde('0x6'));var ejs=require(_0xbbde('0x7'));var fs=require('fs');var fs_extra=require(_0xbbde('0x8'));var _=require(_0xbbde('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbbde('0xa'));var deskjs=require(_0xbbde('0xb'));var toCsv=require('to-csv');var querystring=require(_0xbbde('0xc'));var Papa=require(_0xbbde('0xd'));var Redis=require(_0xbbde('0xe'));var authService=require(_0xbbde('0xf'));var qs=require(_0xbbde('0x10'));var as=require(_0xbbde('0x11'));var hardwareService=require(_0xbbde('0x12'));var logger=require(_0xbbde('0x13'))(_0xbbde('0x14'));var utils=require(_0xbbde('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbbde('0x16'))['db'];function respondWithStatusCode(_0x5bda89,_0x3d09fa){_0x3d09fa=_0x3d09fa||0xcc;return function(_0x55e439){if(_0x55e439){return _0x5bda89[_0xbbde('0x17')](_0x3d09fa);}return _0x5bda89[_0xbbde('0x18')](_0x3d09fa)[_0xbbde('0x19')]();};}function respondWithResult(_0x397dda,_0x4afa45){_0x4afa45=_0x4afa45||0xc8;return function(_0x374e93){if(_0x374e93){return _0x397dda[_0xbbde('0x18')](_0x4afa45)['json'](_0x374e93);}};}function respondWithFilteredResult(_0x259c16,_0x13db58){return function(_0x4b3c6f){if(_0x4b3c6f){var _0x5ce713=typeof _0x13db58[_0xbbde('0x1a')]==='undefined'&&typeof _0x13db58[_0xbbde('0x1b')]==='undefined';var _0x2b8e3f=_0x4b3c6f[_0xbbde('0x1c')];var _0x593e58=_0x5ce713?0x0:_0x13db58[_0xbbde('0x1a')];var _0x1bc7eb=_0x5ce713?_0x4b3c6f[_0xbbde('0x1c')]:_0x13db58[_0xbbde('0x1a')]+_0x13db58[_0xbbde('0x1b')];var _0x327762;if(_0x1bc7eb>=_0x2b8e3f){_0x1bc7eb=_0x2b8e3f;_0x327762=0xc8;}else{_0x327762=0xce;}_0x259c16['status'](_0x327762);return _0x259c16[_0xbbde('0x1d')](_0xbbde('0x1e'),_0x593e58+'-'+_0x1bc7eb+'/'+_0x2b8e3f)[_0xbbde('0x1f')](_0x4b3c6f);}return null;};}function patchUpdates(_0xc027e7){return function(_0x1a5c58){try{jsonpatch['apply'](_0x1a5c58,_0xc027e7,!![]);}catch(_0x44eca0){return BPromise[_0xbbde('0x20')](_0x44eca0);}return _0x1a5c58[_0xbbde('0x21')]();};}function saveUpdates(_0x19efbb,_0x2c2c14){return function(_0x31b97d){if(_0x31b97d){return _0x31b97d[_0xbbde('0x22')](_0x19efbb)[_0xbbde('0x23')](function(_0x82b9f){return _0x82b9f;});}return null;};}function removeEntity(_0x1b6f82,_0x4ac50b){return function(_0x45db0e){if(_0x45db0e){return _0x45db0e[_0xbbde('0x24')]()[_0xbbde('0x23')](function(){var _0x5c6e6c=_0x45db0e[_0xbbde('0x25')]({'plain':!![]});var _0x34c327=_0xbbde('0x26');return db[_0xbbde('0x27')][_0xbbde('0x24')]({'where':{'type':_0x34c327,'resourceId':_0x5c6e6c['id']}})['then'](function(){return _0x45db0e;});})[_0xbbde('0x23')](function(){_0x1b6f82[_0xbbde('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3efbd7,_0x3d1c58){return function(_0x2854d7){if(!_0x2854d7){_0x3efbd7[_0xbbde('0x17')](0x194);}return _0x2854d7;};}function handleError(_0xd59301,_0x5d9fcd){_0x5d9fcd=_0x5d9fcd||0x1f4;return function(_0x549b1f){logger[_0xbbde('0x28')](_0x549b1f[_0xbbde('0x29')]);if(_0x549b1f['name']){delete _0x549b1f[_0xbbde('0x2a')];}_0xd59301[_0xbbde('0x18')](_0x5d9fcd)[_0xbbde('0x2b')](_0x549b1f);};}exports[_0xbbde('0x2c')]=function(_0x23bc37,_0x4936bd){var _0x387eb3={},_0x28f4ac={},_0xcd1131={'count':0x0,'rows':[]};var _0x32566e=_[_0xbbde('0x2d')](db['VoiceChanSpy'][_0xbbde('0x2e')],function(_0x11fabd){return{'name':_0x11fabd['fieldName'],'type':_0x11fabd['type'][_0xbbde('0x2f')]};});_0x28f4ac[_0xbbde('0x30')]=_[_0xbbde('0x2d')](_0x32566e,_0xbbde('0x2a'));_0x28f4ac[_0xbbde('0x31')]=_[_0xbbde('0x32')](_0x23bc37[_0xbbde('0x31')]);_0x28f4ac[_0xbbde('0x33')]=_[_0xbbde('0x34')](_0x28f4ac['model'],_0x28f4ac[_0xbbde('0x31')]);_0x387eb3[_0xbbde('0x35')]=_[_0xbbde('0x34')](_0x28f4ac[_0xbbde('0x30')],qs['fields'](_0x23bc37['query'][_0xbbde('0x36')]));_0x387eb3[_0xbbde('0x35')]=_0x387eb3[_0xbbde('0x35')][_0xbbde('0x37')]?_0x387eb3['attributes']:_0x28f4ac[_0xbbde('0x30')];if(!_0x23bc37['query'][_0xbbde('0x38')](_0xbbde('0x39'))){_0x387eb3[_0xbbde('0x1b')]=qs[_0xbbde('0x1b')](_0x23bc37[_0xbbde('0x31')]['limit']);_0x387eb3[_0xbbde('0x1a')]=qs[_0xbbde('0x1a')](_0x23bc37['query'][_0xbbde('0x1a')]);}_0x387eb3[_0xbbde('0x3a')]=qs['sort'](_0x23bc37[_0xbbde('0x31')]['sort']);_0x387eb3[_0xbbde('0x3b')]=qs[_0xbbde('0x33')](_[_0xbbde('0x3c')](_0x23bc37['query'],_0x28f4ac[_0xbbde('0x33')]),_0x32566e);if(_0x23bc37[_0xbbde('0x31')]['filter']){_0x387eb3[_0xbbde('0x3b')]=_['merge'](_0x387eb3[_0xbbde('0x3b')],{'$or':_[_0xbbde('0x2d')](_0x32566e,function(_0x4c528d){if(_0x4c528d[_0xbbde('0x3d')]!==_0xbbde('0x3e')){var _0xbc6de1={};_0xbc6de1[_0x4c528d[_0xbbde('0x2a')]]={'$like':'%'+_0x23bc37['query'][_0xbbde('0x3f')]+'%'};return _0xbc6de1;}})});}_0x387eb3=_[_0xbbde('0x40')]({},_0x387eb3,_0x23bc37['options']);var _0x253a96={'where':_0x387eb3[_0xbbde('0x3b')]};return db[_0xbbde('0x41')][_0xbbde('0x1c')](_0x253a96)['then'](function(_0x2a74ce){_0xcd1131[_0xbbde('0x1c')]=_0x2a74ce;if(_0x23bc37['query'][_0xbbde('0x42')]){_0x387eb3['include']=[{'all':!![]}];}return db['VoiceChanSpy'][_0xbbde('0x43')](_0x387eb3);})[_0xbbde('0x23')](function(_0x3110d8){_0xcd1131[_0xbbde('0x44')]=_0x3110d8;return _0xcd1131;})[_0xbbde('0x23')](respondWithFilteredResult(_0x4936bd,_0x387eb3))[_0xbbde('0x45')](handleError(_0x4936bd,null));};exports['show']=function(_0x1e4fc1,_0x1c3600){var _0x2d6719={'raw':![],'where':{'id':_0x1e4fc1[_0xbbde('0x46')]['id']}},_0x6bff1a={};_0x6bff1a['model']=_[_0xbbde('0x32')](db[_0xbbde('0x41')][_0xbbde('0x2e')]);_0x6bff1a['query']=_['keys'](_0x1e4fc1['query']);_0x6bff1a[_0xbbde('0x33')]=_['intersection'](_0x6bff1a[_0xbbde('0x30')],_0x6bff1a[_0xbbde('0x31')]);_0x2d6719[_0xbbde('0x35')]=_[_0xbbde('0x34')](_0x6bff1a['model'],qs[_0xbbde('0x36')](_0x1e4fc1[_0xbbde('0x31')][_0xbbde('0x36')]));_0x2d6719[_0xbbde('0x35')]=_0x2d6719[_0xbbde('0x35')]['length']?_0x2d6719['attributes']:_0x6bff1a['model'];if(_0x1e4fc1[_0xbbde('0x31')][_0xbbde('0x42')]){_0x2d6719[_0xbbde('0x47')]=[{'all':!![]}];}_0x2d6719=_['merge']({},_0x2d6719,_0x1e4fc1['options']);return db[_0xbbde('0x41')]['find'](_0x2d6719)[_0xbbde('0x23')](handleEntityNotFound(_0x1c3600,null))['then'](respondWithResult(_0x1c3600,null))[_0xbbde('0x45')](handleError(_0x1c3600,null));};exports['create']=function(_0x4b204b,_0x356109){return db[_0xbbde('0x41')][_0xbbde('0x48')](_0x4b204b['body'],{})['then'](function(_0x4319c1){var _0x3c12c5=_0x4b204b['user'][_0xbbde('0x25')]({'plain':!![]});if(!_0x3c12c5)throw new Error(_0xbbde('0x49'));if(_0x3c12c5[_0xbbde('0x4a')]==='user'){var _0x779382=_0x4319c1[_0xbbde('0x25')]({'plain':!![]});var _0x222eee='ChanSpies';return db[_0xbbde('0x4b')]['find']({'where':{'name':_0x222eee,'userProfileId':_0x3c12c5[_0xbbde('0x4c')]},'raw':!![]})[_0xbbde('0x23')](function(_0x160e6c){if(_0x160e6c&&_0x160e6c['autoAssociation']===0x0){return db[_0xbbde('0x27')]['create']({'name':_0x779382[_0xbbde('0x2a')],'resourceId':_0x779382['id'],'type':_0x160e6c[_0xbbde('0x2a')],'sectionId':_0x160e6c['id']},{})[_0xbbde('0x23')](function(){return _0x4319c1;});}else{return _0x4319c1;}})[_0xbbde('0x45')](function(_0x278e40){logger['error'](_0xbbde('0x4d'),_0x278e40);throw _0x278e40;});}return _0x4319c1;})['then'](respondWithResult(_0x356109,0xc9))[_0xbbde('0x45')](handleError(_0x356109,null));};exports[_0xbbde('0x22')]=function(_0x47759a,_0x28859f){if(_0x47759a['body']['id']){delete _0x47759a['body']['id'];}return db[_0xbbde('0x41')][_0xbbde('0x4e')]({'where':{'id':_0x47759a['params']['id']}})[_0xbbde('0x23')](handleEntityNotFound(_0x28859f,null))[_0xbbde('0x23')](saveUpdates(_0x47759a['body'],null))[_0xbbde('0x23')](respondWithResult(_0x28859f,null))['catch'](handleError(_0x28859f,null));};exports[_0xbbde('0x24')]=function(_0x514980,_0x28883f){return db[_0xbbde('0x41')][_0xbbde('0x4e')]({'where':{'id':_0x514980[_0xbbde('0x46')]['id']}})[_0xbbde('0x23')](handleEntityNotFound(_0x28883f,null))[_0xbbde('0x23')](removeEntity(_0x28883f,null))[_0xbbde('0x45')](handleError(_0x28883f,null));}; \ No newline at end of file +var _0x4c6d=['apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','VoiceChanSpy','rawAttributes','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','include','findAll','rows','catch','show','includeAll','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','find','userProfileId','autoAssociation','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json'];(function(_0x18b191,_0x4e0684){var _0x43e146=function(_0x4b464e){while(--_0x4b464e){_0x18b191['push'](_0x18b191['shift']());}};_0x43e146(++_0x4e0684);}(_0x4c6d,0x1d0));var _0xd4c6=function(_0x5f57a0,_0x205d16){_0x5f57a0=_0x5f57a0-0x0;var _0x36d2b=_0x4c6d[_0x5f57a0];return _0x36d2b;};'use strict';var emlformat=require(_0xd4c6('0x0'));var rimraf=require(_0xd4c6('0x1'));var zipdir=require(_0xd4c6('0x2'));var jsonpatch=require(_0xd4c6('0x3'));var rp=require(_0xd4c6('0x4'));var moment=require('moment');var BPromise=require(_0xd4c6('0x5'));var Mustache=require(_0xd4c6('0x6'));var util=require(_0xd4c6('0x7'));var path=require('path');var sox=require(_0xd4c6('0x8'));var csv=require(_0xd4c6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd4c6('0xa'));var _=require(_0xd4c6('0xb'));var squel=require(_0xd4c6('0xc'));var crypto=require('crypto');var jsforce=require(_0xd4c6('0xd'));var deskjs=require(_0xd4c6('0xe'));var toCsv=require(_0xd4c6('0x9'));var querystring=require('querystring');var Papa=require(_0xd4c6('0xf'));var Redis=require(_0xd4c6('0x10'));var authService=require(_0xd4c6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd4c6('0x12'));var hardwareService=require(_0xd4c6('0x13'));var logger=require(_0xd4c6('0x14'))(_0xd4c6('0x15'));var utils=require(_0xd4c6('0x16'));var config=require(_0xd4c6('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35b902,_0x489171){_0x489171=_0x489171||0xcc;return function(_0x162681){if(_0x162681){return _0x35b902[_0xd4c6('0x18')](_0x489171);}return _0x35b902[_0xd4c6('0x19')](_0x489171)[_0xd4c6('0x1a')]();};}function respondWithResult(_0x3a2143,_0x384a98){_0x384a98=_0x384a98||0xc8;return function(_0x94f42e){if(_0x94f42e){return _0x3a2143['status'](_0x384a98)['json'](_0x94f42e);}};}function respondWithFilteredResult(_0x11e6c2,_0x3deb85){return function(_0x25e1fb){if(_0x25e1fb){var _0x25204d=typeof _0x3deb85[_0xd4c6('0x1b')]===_0xd4c6('0x1c')&&typeof _0x3deb85[_0xd4c6('0x1d')]==='undefined';var _0x761a3e=_0x25e1fb[_0xd4c6('0x1e')];var _0x23a16f=_0x25204d?0x0:_0x3deb85[_0xd4c6('0x1b')];var _0x31f328=_0x25204d?_0x25e1fb['count']:_0x3deb85[_0xd4c6('0x1b')]+_0x3deb85[_0xd4c6('0x1d')];var _0x359577;if(_0x31f328>=_0x761a3e){_0x31f328=_0x761a3e;_0x359577=0xc8;}else{_0x359577=0xce;}_0x11e6c2['status'](_0x359577);return _0x11e6c2[_0xd4c6('0x1f')](_0xd4c6('0x20'),_0x23a16f+'-'+_0x31f328+'/'+_0x761a3e)[_0xd4c6('0x21')](_0x25e1fb);}return null;};}function patchUpdates(_0x3b1658){return function(_0x48dbf8){try{jsonpatch[_0xd4c6('0x22')](_0x48dbf8,_0x3b1658,!![]);}catch(_0x4a10d8){return BPromise[_0xd4c6('0x23')](_0x4a10d8);}return _0x48dbf8[_0xd4c6('0x24')]();};}function saveUpdates(_0x2750c9,_0x222813){return function(_0xf536e0){if(_0xf536e0){return _0xf536e0[_0xd4c6('0x25')](_0x2750c9)[_0xd4c6('0x26')](function(_0x3f99e8){return _0x3f99e8;});}return null;};}function removeEntity(_0x155cb3,_0x466330){return function(_0x1ebb17){if(_0x1ebb17){return _0x1ebb17[_0xd4c6('0x27')]()['then'](function(){var _0x582326=_0x1ebb17[_0xd4c6('0x28')]({'plain':!![]});var _0x2febbf='ChanSpies';return db[_0xd4c6('0x29')][_0xd4c6('0x27')]({'where':{'type':_0x2febbf,'resourceId':_0x582326['id']}})[_0xd4c6('0x26')](function(){return _0x1ebb17;});})['then'](function(){_0x155cb3[_0xd4c6('0x19')](0xcc)[_0xd4c6('0x1a')]();});}};}function handleEntityNotFound(_0x5614f3,_0x406ed0){return function(_0x8ce066){if(!_0x8ce066){_0x5614f3[_0xd4c6('0x18')](0x194);}return _0x8ce066;};}function handleError(_0x488e7e,_0x3ce942){_0x3ce942=_0x3ce942||0x1f4;return function(_0x3b656d){logger[_0xd4c6('0x2a')](_0x3b656d[_0xd4c6('0x2b')]);if(_0x3b656d[_0xd4c6('0x2c')]){delete _0x3b656d[_0xd4c6('0x2c')];}_0x488e7e[_0xd4c6('0x19')](_0x3ce942)[_0xd4c6('0x2d')](_0x3b656d);};}exports[_0xd4c6('0x2e')]=function(_0x1de7ae,_0x441119){var _0x31e3d0={},_0x15d312={},_0x112969={'count':0x0,'rows':[]};var _0x5d7997=_[_0xd4c6('0x2f')](db[_0xd4c6('0x30')][_0xd4c6('0x31')],function(_0x38d423){return{'name':_0x38d423['fieldName'],'type':_0x38d423['type']['key']};});_0x15d312[_0xd4c6('0x32')]=_[_0xd4c6('0x2f')](_0x5d7997,_0xd4c6('0x2c'));_0x15d312[_0xd4c6('0x33')]=_[_0xd4c6('0x34')](_0x1de7ae[_0xd4c6('0x33')]);_0x15d312[_0xd4c6('0x35')]=_['intersection'](_0x15d312[_0xd4c6('0x32')],_0x15d312[_0xd4c6('0x33')]);_0x31e3d0[_0xd4c6('0x36')]=_['intersection'](_0x15d312[_0xd4c6('0x32')],qs[_0xd4c6('0x37')](_0x1de7ae[_0xd4c6('0x33')]['fields']));_0x31e3d0[_0xd4c6('0x36')]=_0x31e3d0[_0xd4c6('0x36')][_0xd4c6('0x38')]?_0x31e3d0[_0xd4c6('0x36')]:_0x15d312['model'];if(!_0x1de7ae[_0xd4c6('0x33')][_0xd4c6('0x39')](_0xd4c6('0x3a'))){_0x31e3d0[_0xd4c6('0x1d')]=qs[_0xd4c6('0x1d')](_0x1de7ae['query'][_0xd4c6('0x1d')]);_0x31e3d0[_0xd4c6('0x1b')]=qs[_0xd4c6('0x1b')](_0x1de7ae[_0xd4c6('0x33')][_0xd4c6('0x1b')]);}_0x31e3d0[_0xd4c6('0x3b')]=qs['sort'](_0x1de7ae[_0xd4c6('0x33')][_0xd4c6('0x3c')]);_0x31e3d0[_0xd4c6('0x3d')]=qs['filters'](_[_0xd4c6('0x3e')](_0x1de7ae[_0xd4c6('0x33')],_0x15d312[_0xd4c6('0x35')]),_0x5d7997);if(_0x1de7ae[_0xd4c6('0x33')][_0xd4c6('0x3f')]){_0x31e3d0[_0xd4c6('0x3d')]=_[_0xd4c6('0x40')](_0x31e3d0[_0xd4c6('0x3d')],{'$or':_[_0xd4c6('0x2f')](_0x5d7997,function(_0x4c00f0){if(_0x4c00f0[_0xd4c6('0x41')]!=='VIRTUAL'){var _0x55063c={};_0x55063c[_0x4c00f0[_0xd4c6('0x2c')]]={'$like':'%'+_0x1de7ae[_0xd4c6('0x33')][_0xd4c6('0x3f')]+'%'};return _0x55063c;}})});}_0x31e3d0=_[_0xd4c6('0x40')]({},_0x31e3d0,_0x1de7ae[_0xd4c6('0x42')]);var _0x536d65={'where':_0x31e3d0['where']};return db[_0xd4c6('0x30')][_0xd4c6('0x1e')](_0x536d65)[_0xd4c6('0x26')](function(_0x14ee8f){_0x112969['count']=_0x14ee8f;if(_0x1de7ae[_0xd4c6('0x33')]['includeAll']){_0x31e3d0[_0xd4c6('0x43')]=[{'all':!![]}];}return db[_0xd4c6('0x30')][_0xd4c6('0x44')](_0x31e3d0);})['then'](function(_0x470157){_0x112969[_0xd4c6('0x45')]=_0x470157;return _0x112969;})[_0xd4c6('0x26')](respondWithFilteredResult(_0x441119,_0x31e3d0))[_0xd4c6('0x46')](handleError(_0x441119,null));};exports[_0xd4c6('0x47')]=function(_0x3ef1b0,_0x11f62e){var _0x3beb89={'raw':![],'where':{'id':_0x3ef1b0['params']['id']}},_0x343d94={};_0x343d94[_0xd4c6('0x32')]=_[_0xd4c6('0x34')](db[_0xd4c6('0x30')]['rawAttributes']);_0x343d94[_0xd4c6('0x33')]=_[_0xd4c6('0x34')](_0x3ef1b0[_0xd4c6('0x33')]);_0x343d94['filters']=_['intersection'](_0x343d94[_0xd4c6('0x32')],_0x343d94[_0xd4c6('0x33')]);_0x3beb89[_0xd4c6('0x36')]=_['intersection'](_0x343d94[_0xd4c6('0x32')],qs[_0xd4c6('0x37')](_0x3ef1b0[_0xd4c6('0x33')][_0xd4c6('0x37')]));_0x3beb89[_0xd4c6('0x36')]=_0x3beb89[_0xd4c6('0x36')]['length']?_0x3beb89[_0xd4c6('0x36')]:_0x343d94[_0xd4c6('0x32')];if(_0x3ef1b0[_0xd4c6('0x33')][_0xd4c6('0x48')]){_0x3beb89[_0xd4c6('0x43')]=[{'all':!![]}];}_0x3beb89=_[_0xd4c6('0x40')]({},_0x3beb89,_0x3ef1b0[_0xd4c6('0x42')]);return db[_0xd4c6('0x30')]['find'](_0x3beb89)['then'](handleEntityNotFound(_0x11f62e,null))[_0xd4c6('0x26')](respondWithResult(_0x11f62e,null))[_0xd4c6('0x46')](handleError(_0x11f62e,null));};exports[_0xd4c6('0x49')]=function(_0x5bb875,_0x37aa81){return db[_0xd4c6('0x30')][_0xd4c6('0x49')](_0x5bb875['body'],{})[_0xd4c6('0x26')](function(_0xa6bd55){var _0x17193f=_0x5bb875[_0xd4c6('0x4a')]['get']({'plain':!![]});if(!_0x17193f)throw new Error(_0xd4c6('0x4b'));if(_0x17193f[_0xd4c6('0x4c')]===_0xd4c6('0x4a')){var _0x14279d=_0xa6bd55[_0xd4c6('0x28')]({'plain':!![]});var _0x2803ef=_0xd4c6('0x4d');return db['UserProfileSection'][_0xd4c6('0x4e')]({'where':{'name':_0x2803ef,'userProfileId':_0x17193f[_0xd4c6('0x4f')]},'raw':!![]})[_0xd4c6('0x26')](function(_0x4a62a8){if(_0x4a62a8&&_0x4a62a8[_0xd4c6('0x50')]===0x0){return db[_0xd4c6('0x29')][_0xd4c6('0x49')]({'name':_0x14279d[_0xd4c6('0x2c')],'resourceId':_0x14279d['id'],'type':_0x4a62a8[_0xd4c6('0x2c')],'sectionId':_0x4a62a8['id']},{})[_0xd4c6('0x26')](function(){return _0xa6bd55;});}else{return _0xa6bd55;}})[_0xd4c6('0x46')](function(_0x591c7c){logger[_0xd4c6('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x591c7c);throw _0x591c7c;});}return _0xa6bd55;})['then'](respondWithResult(_0x37aa81,0xc9))[_0xd4c6('0x46')](handleError(_0x37aa81,null));};exports['update']=function(_0x868da9,_0x574665){if(_0x868da9[_0xd4c6('0x51')]['id']){delete _0x868da9['body']['id'];}return db['VoiceChanSpy'][_0xd4c6('0x4e')]({'where':{'id':_0x868da9[_0xd4c6('0x52')]['id']}})[_0xd4c6('0x26')](handleEntityNotFound(_0x574665,null))[_0xd4c6('0x26')](saveUpdates(_0x868da9[_0xd4c6('0x51')],null))[_0xd4c6('0x26')](respondWithResult(_0x574665,null))[_0xd4c6('0x46')](handleError(_0x574665,null));};exports[_0xd4c6('0x27')]=function(_0x33fac6,_0x5e52db){return db[_0xd4c6('0x30')][_0xd4c6('0x4e')]({'where':{'id':_0x33fac6[_0xd4c6('0x52')]['id']}})[_0xd4c6('0x26')](handleEntityNotFound(_0x5e52db,null))[_0xd4c6('0x26')](removeEntity(_0x5e52db,null))[_0xd4c6('0x46')](handleError(_0x5e52db,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index f24466a..d1f6355 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 _0x4268=['concat','internal','name','User','findAll','agent','then','exports','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','catch','destroy','lodash','util','bluebird','from-sip','prefix','system','push','merge','Set','format','CDR(type)=%s','MixMonitor','${UNIQUEID}.%s,a','auth','Authenticate','password','SIP/%s,%s','options','join','record','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4268,0x1bf));var _0x8426=function(_0x4ff4bd,_0x525897){_0x4ff4bd=_0x4ff4bd-0x0;var _0x8be1c6=_0x4268[_0x4ff4bd];return _0x8be1c6;};'use strict';var _=require(_0x8426('0x0'));var util=require(_0x8426('0x1'));var BPromise=require(_0x8426('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x26468b,_0x47c35c,_0x48fe98){var _0x7f5911=0x1;var _0x5a758d=[];var _0x54b990={'context':_0x47c35c['context']||_0x8426('0x3'),'exten':util['format']('%s%s',_0x26468b[_0x8426('0x4')],_0x48fe98),'type':_0x8426('0x5'),'isApp':![],'ChanSpyId':_0x26468b['id'],'UserId':_0x47c35c['id']};_0x5a758d[_0x8426('0x6')](_[_0x8426('0x7')]({'app':_0x8426('0x8'),'appdata':util[_0x8426('0x9')](_0x8426('0xa'),'chanspy'),'priority':_0x7f5911++},_0x54b990));if(_0x26468b['record']){_0x5a758d['push'](_[_0x8426('0x7')]({'app':_0x8426('0xb'),'appdata':util[_0x8426('0x9')](_0x8426('0xc'),_0x26468b['recordingFormat']),'priority':_0x7f5911++},_0x54b990));}if(_0x26468b[_0x8426('0xd')]){_0x5a758d[_0x8426('0x6')](_[_0x8426('0x7')]({'app':_0x8426('0xe'),'appdata':_0x26468b[_0x8426('0xf')],'priority':_0x7f5911++},_0x54b990));}_0x5a758d['push'](_[_0x8426('0x7')]({'app':'ChanSpy','appdata':util[_0x8426('0x9')](_0x8426('0x10'),_0x47c35c['name'],_0x26468b[_0x8426('0x11')]?_0x26468b[_0x8426('0x11')][_0x8426('0x12')](''):''),'priority':_0x7f5911++},_0x54b990));if(_0x26468b[_0x8426('0x13')]){_0x5a758d[_0x8426('0x6')](_[_0x8426('0x7')]({'app':'StopMixMonitor','priority':_0x7f5911++},_0x54b990));}return _0x5a758d;};var getChanSpyApplications=function(_0x33e39f,_0x27d45e){var _0x264132=[];for(var _0x3e2ebc=0x0,_0x661687=0x1;_0x3e2ebc<_0x27d45e[_0x8426('0x14')];_0x3e2ebc++,_0x661687=0x1){_0x264132=_0x264132[_0x8426('0x15')](getUserApplications(_0x33e39f,_0x27d45e[_0x3e2ebc],_0x27d45e[_0x3e2ebc][_0x8426('0x16')]));if(_0x27d45e[_0x3e2ebc][_0x8426('0x16')]!=_0x27d45e[_0x3e2ebc][_0x8426('0x17')]){_0x264132=_0x264132['concat'](getUserApplications(_0x33e39f,_0x27d45e[_0x3e2ebc],_0x27d45e[_0x3e2ebc][_0x8426('0x17')]));}}return _0x264132;};var getChanSpyPromise=function(_0x5650d8,_0x3ed73a){return new BPromise(function(_0x1812d9,_0x365f4e){return _0x5650d8[_0x8426('0x18')][_0x8426('0x19')]({'attributes':['id',_0x8426('0x17'),_0x8426('0x16')],'where':{'role':_0x8426('0x1a'),'chanspy':!![]},'raw':!![]})[_0x8426('0x1b')](function(_0x40279b){if(_0x40279b){return _0x1812d9(getChanSpyApplications(_0x3ed73a,_0x40279b));}return _0x1812d9([]);})['catch'](function(_0x5da83d){_0x365f4e(_0x5da83d);});});};module[_0x8426('0x1c')]=function(_0x2b3fce,_0x13d43b){var _0x361c0b=_0x2b3fce['models'];return _0x2b3fce[_0x8426('0x1d')](_0x8426('0x1e'),attributes,{'tableName':_0x8426('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x54ef26,_0x49c720,_0x5ffd5f){return getChanSpyPromise(_0x361c0b,_0x54ef26)[_0x8426('0x1b')](function(_0x18d5ae){if(_0x18d5ae&&_0x18d5ae[_0x8426('0x14')]){return _0x361c0b[_0x8426('0x20')][_0x8426('0x21')](_0x18d5ae);}})[_0x8426('0x1b')](function(){_0x5ffd5f();})[_0x8426('0x22')](function(_0x5825b7){_0x5ffd5f(_0x5825b7);});},'afterUpdate':function(_0x420e05,_0xd9c870,_0x413545){return _0x361c0b[_0x8426('0x20')]['destroy']({'where':{'ChanSpyId':_0x420e05['id']}})['then'](function(){return getChanSpyPromise(_0x361c0b,_0x420e05);})[_0x8426('0x1b')](function(_0x2413a5){if(_0x2413a5&&_0x2413a5['length']){return _0x361c0b['VoiceExtension']['bulkCreate'](_0x2413a5);}})[_0x8426('0x1b')](function(){_0x413545();})[_0x8426('0x22')](function(_0x252598){_0x413545(_0x252598);});},'afterDestroy':function(_0x47d411,_0x960afa,_0x388e0e){return _0x361c0b[_0x8426('0x20')][_0x8426('0x23')]({'where':{'ChanSpyId':_0x47d411['id']}})['then'](function(){_0x388e0e();})['catch'](function(_0x3a20cd){_0x388e0e(_0x3a20cd);});}}});}; \ No newline at end of file +var _0x72ca=['record','push','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','concat','internal','User','findAll','agent','catch','exports','then','length','VoiceExtension','bulkCreate','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','merge','Set','chanspy'];(function(_0xa28a01,_0x20c585){var _0x1c4c30=function(_0x3881d7){while(--_0x3881d7){_0xa28a01['push'](_0xa28a01['shift']());}};_0x1c4c30(++_0x20c585);}(_0x72ca,0x1af));var _0xa72c=function(_0x2a4911,_0x4f9105){_0x2a4911=_0x2a4911-0x0;var _0x139d32=_0x72ca[_0x2a4911];return _0x139d32;};'use strict';var _=require(_0xa72c('0x0'));var util=require(_0xa72c('0x1'));var BPromise=require(_0xa72c('0x2'));var attributes=require(_0xa72c('0x3'));var getUserApplications=function(_0x333087,_0x2daac8,_0x1317f9){var _0x3cee93=0x1;var _0x2fbc6b=[];var _0xbb35={'context':_0x2daac8[_0xa72c('0x4')]||_0xa72c('0x5'),'exten':util[_0xa72c('0x6')](_0xa72c('0x7'),_0x333087[_0xa72c('0x8')],_0x1317f9),'type':_0xa72c('0x9'),'isApp':![],'ChanSpyId':_0x333087['id'],'UserId':_0x2daac8['id']};_0x2fbc6b['push'](_[_0xa72c('0xa')]({'app':_0xa72c('0xb'),'appdata':util['format']('CDR(type)=%s',_0xa72c('0xc')),'priority':_0x3cee93++},_0xbb35));if(_0x333087[_0xa72c('0xd')]){_0x2fbc6b[_0xa72c('0xe')](_[_0xa72c('0xa')]({'app':_0xa72c('0xf'),'appdata':util[_0xa72c('0x6')](_0xa72c('0x10'),_0x333087[_0xa72c('0x11')]),'priority':_0x3cee93++},_0xbb35));}if(_0x333087[_0xa72c('0x12')]){_0x2fbc6b[_0xa72c('0xe')](_[_0xa72c('0xa')]({'app':_0xa72c('0x13'),'appdata':_0x333087['password'],'priority':_0x3cee93++},_0xbb35));}_0x2fbc6b['push'](_[_0xa72c('0xa')]({'app':_0xa72c('0x14'),'appdata':util[_0xa72c('0x6')](_0xa72c('0x15'),_0x2daac8[_0xa72c('0x16')],_0x333087[_0xa72c('0x17')]?_0x333087['options'][_0xa72c('0x18')](''):''),'priority':_0x3cee93++},_0xbb35));if(_0x333087['record']){_0x2fbc6b['push'](_[_0xa72c('0xa')]({'app':_0xa72c('0x19'),'priority':_0x3cee93++},_0xbb35));}return _0x2fbc6b;};var getChanSpyApplications=function(_0x559311,_0x4beec4){var _0x340170=[];for(var _0x590b53=0x0,_0x2e3b9d=0x1;_0x590b53<_0x4beec4['length'];_0x590b53++,_0x2e3b9d=0x1){_0x340170=_0x340170[_0xa72c('0x1a')](getUserApplications(_0x559311,_0x4beec4[_0x590b53],_0x4beec4[_0x590b53][_0xa72c('0x1b')]));if(_0x4beec4[_0x590b53][_0xa72c('0x1b')]!=_0x4beec4[_0x590b53][_0xa72c('0x16')]){_0x340170=_0x340170[_0xa72c('0x1a')](getUserApplications(_0x559311,_0x4beec4[_0x590b53],_0x4beec4[_0x590b53][_0xa72c('0x16')]));}}return _0x340170;};var getChanSpyPromise=function(_0x4cdfc5,_0x2b34d4){return new BPromise(function(_0x2fc710,_0x24cb68){return _0x4cdfc5[_0xa72c('0x1c')][_0xa72c('0x1d')]({'attributes':['id',_0xa72c('0x16'),_0xa72c('0x1b')],'where':{'role':_0xa72c('0x1e'),'chanspy':!![]},'raw':!![]})['then'](function(_0x1c8e5c){if(_0x1c8e5c){return _0x2fc710(getChanSpyApplications(_0x2b34d4,_0x1c8e5c));}return _0x2fc710([]);})[_0xa72c('0x1f')](function(_0x1826af){_0x24cb68(_0x1826af);});});};module[_0xa72c('0x20')]=function(_0x1a6556,_0x3b182f){var _0xa69b06=_0x1a6556['models'];return _0x1a6556['define']('VoiceChanSpy',attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3c6c63,_0x163d0c,_0x5d7a0b){return getChanSpyPromise(_0xa69b06,_0x3c6c63)[_0xa72c('0x21')](function(_0x4a031c){if(_0x4a031c&&_0x4a031c[_0xa72c('0x22')]){return _0xa69b06[_0xa72c('0x23')][_0xa72c('0x24')](_0x4a031c);}})[_0xa72c('0x21')](function(){_0x5d7a0b();})[_0xa72c('0x1f')](function(_0x1287d2){_0x5d7a0b(_0x1287d2);});},'afterUpdate':function(_0x79bcbf,_0x38ebc8,_0x592375){return _0xa69b06['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x79bcbf['id']}})[_0xa72c('0x21')](function(){return getChanSpyPromise(_0xa69b06,_0x79bcbf);})[_0xa72c('0x21')](function(_0x176bc5){if(_0x176bc5&&_0x176bc5[_0xa72c('0x22')]){return _0xa69b06['VoiceExtension'][_0xa72c('0x24')](_0x176bc5);}})[_0xa72c('0x21')](function(){_0x592375();})[_0xa72c('0x1f')](function(_0x541f0a){_0x592375(_0x541f0a);});},'afterDestroy':function(_0x2e81e4,_0x2ed54c,_0x5b60fe){return _0xa69b06[_0xa72c('0x23')]['destroy']({'where':{'ChanSpyId':_0x2e81e4['id']}})[_0xa72c('0x21')](function(){_0x5b60fe();})[_0xa72c('0x1f')](function(_0x1f2644){_0x5b60fe(_0x1f2644);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 62e4e5c..a4fae65 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 _0xe205=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash'];(function(_0x50cd41,_0x4874a7){var _0x399475=function(_0x1946da){while(--_0x1946da){_0x50cd41['push'](_0x50cd41['shift']());}};_0x399475(++_0x4874a7);}(_0xe205,0xa7));var _0x5e20=function(_0x565950,_0x35ee05){_0x565950=_0x565950-0x0;var _0x560f73=_0xe205[_0x565950];return _0x560f73;};'use strict';var _=require(_0x5e20('0x0'));var util=require(_0x5e20('0x1'));var moment=require(_0x5e20('0x2'));var BPromise=require(_0x5e20('0x3'));var rs=require(_0x5e20('0x4'));var fs=require('fs');var Redis=require(_0x5e20('0x5'));var db=require(_0x5e20('0x6'))['db'];var utils=require(_0x5e20('0x7'));var logger=require(_0x5e20('0x8'))('rpc');var config=require(_0x5e20('0x9'));var jayson=require(_0x5e20('0xa'));var client=jayson[_0x5e20('0xb')][_0x5e20('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5eca5c,_0x4cc88d,_0x3a382f){return new BPromise(function(_0x4c9332,_0x533e18){return client[_0x5e20('0xd')](_0x5eca5c,_0x3a382f)[_0x5e20('0xe')](function(_0x5c1eee){logger[_0x5e20('0xf')](_0x5e20('0x10'),_0x4cc88d,_0x5e20('0x11'));logger[_0x5e20('0x12')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x4cc88d,_0x5e20('0x11'),JSON[_0x5e20('0x13')](_0x5c1eee));if(_0x5c1eee[_0x5e20('0x14')]){if(_0x5c1eee[_0x5e20('0x14')][_0x5e20('0x15')]===0x1f4){logger[_0x5e20('0x14')]('VoiceChanSpy,\x20%s,\x20%s',_0x4cc88d,_0x5c1eee[_0x5e20('0x14')][_0x5e20('0x16')]);return _0x533e18(_0x5c1eee[_0x5e20('0x14')]['message']);}logger[_0x5e20('0x14')]('VoiceChanSpy,\x20%s,\x20%s',_0x4cc88d,_0x5c1eee[_0x5e20('0x14')]['message']);return _0x4c9332(_0x5c1eee[_0x5e20('0x14')][_0x5e20('0x16')]);}else{logger[_0x5e20('0xf')](_0x5e20('0x10'),_0x4cc88d,_0x5e20('0x11'));_0x4c9332(_0x5c1eee['result'][_0x5e20('0x16')]);}})[_0x5e20('0x17')](function(_0x166ffd){logger[_0x5e20('0x14')](_0x5e20('0x10'),_0x4cc88d,_0x166ffd);_0x533e18(_0x166ffd);});});} \ No newline at end of file +var _0xa902=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0xa902,0x8d));var _0x2a90=function(_0x622285,_0x5193c0){_0x622285=_0x622285-0x0;var _0x4963e2=_0xa902[_0x622285];return _0x4963e2;};'use strict';var _=require(_0x2a90('0x0'));var util=require(_0x2a90('0x1'));var moment=require(_0x2a90('0x2'));var BPromise=require(_0x2a90('0x3'));var rs=require(_0x2a90('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2a90('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2a90('0x6'));var config=require(_0x2a90('0x7'));var jayson=require(_0x2a90('0x8'));var client=jayson[_0x2a90('0x9')][_0x2a90('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25bcfc,_0x58369a,_0x4109e6){return new BPromise(function(_0x570659,_0x5ec2b9){return client[_0x2a90('0xb')](_0x25bcfc,_0x4109e6)[_0x2a90('0xc')](function(_0xe500bc){logger[_0x2a90('0xd')](_0x2a90('0xe'),_0x58369a,'request\x20sent');logger[_0x2a90('0xf')](_0x2a90('0x10'),_0x58369a,_0x2a90('0x11'),JSON[_0x2a90('0x12')](_0xe500bc));if(_0xe500bc['error']){if(_0xe500bc[_0x2a90('0x13')]['code']===0x1f4){logger[_0x2a90('0x13')]('VoiceChanSpy,\x20%s,\x20%s',_0x58369a,_0xe500bc[_0x2a90('0x13')]['message']);return _0x5ec2b9(_0xe500bc[_0x2a90('0x13')][_0x2a90('0x14')]);}logger[_0x2a90('0x13')]('VoiceChanSpy,\x20%s,\x20%s',_0x58369a,_0xe500bc['error']['message']);return _0x570659(_0xe500bc[_0x2a90('0x13')][_0x2a90('0x14')]);}else{logger['info'](_0x2a90('0xe'),_0x58369a,_0x2a90('0x11'));_0x570659(_0xe500bc[_0x2a90('0x15')][_0x2a90('0x14')]);}})[_0x2a90('0x16')](function(_0x37858e){logger[_0x2a90('0x13')](_0x2a90('0xe'),_0x58369a,_0x37858e);_0x5ec2b9(_0x37858e);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 4825ddb..b48b02c 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 _0x4f94=['show','post','create','put','/:id','delete','destroy','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','index','isAuthenticated'];(function(_0x18db8b,_0x1e64f7){var _0x2ba061=function(_0x110dd5){while(--_0x110dd5){_0x18db8b['push'](_0x18db8b['shift']());}};_0x2ba061(++_0x1e64f7);}(_0x4f94,0x1db));var _0x44f9=function(_0x5e0558,_0x3f1395){_0x5e0558=_0x5e0558-0x0;var _0x35a7c3=_0x4f94[_0x5e0558];return _0x35a7c3;};'use strict';var multer=require('multer');var util=require(_0x44f9('0x0'));var path=require('path');var timeout=require(_0x44f9('0x1'));var express=require('express');var router=express[_0x44f9('0x2')]();var fs_extra=require(_0x44f9('0x3'));var auth=require(_0x44f9('0x4'));var interaction=require(_0x44f9('0x5'));var config=require(_0x44f9('0x6'));var controller=require(_0x44f9('0x7'));router[_0x44f9('0x8')]('/',auth['isAuthenticated'](),controller[_0x44f9('0x9')]);router[_0x44f9('0x8')]('/:id',auth[_0x44f9('0xa')](),controller[_0x44f9('0xb')]);router[_0x44f9('0xc')]('/',auth[_0x44f9('0xa')](),controller[_0x44f9('0xd')]);router[_0x44f9('0xe')](_0x44f9('0xf'),auth[_0x44f9('0xa')](),controller['update']);router[_0x44f9('0x10')](_0x44f9('0xf'),auth[_0x44f9('0xa')](),controller[_0x44f9('0x11')]);module['exports']=router; \ No newline at end of file +var _0x8a87=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','create','put','/:id','delete','destroy','exports','multer','util'];(function(_0x29fc2c,_0x4ff86a){var _0x1adbc8=function(_0x596f87){while(--_0x596f87){_0x29fc2c['push'](_0x29fc2c['shift']());}};_0x1adbc8(++_0x4ff86a);}(_0x8a87,0x1e4));var _0x78a8=function(_0x31ca4c,_0x38802c){_0x31ca4c=_0x31ca4c-0x0;var _0x423753=_0x8a87[_0x31ca4c];return _0x423753;};'use strict';var multer=require(_0x78a8('0x0'));var util=require(_0x78a8('0x1'));var path=require('path');var timeout=require(_0x78a8('0x2'));var express=require('express');var router=express[_0x78a8('0x3')]();var fs_extra=require(_0x78a8('0x4'));var auth=require(_0x78a8('0x5'));var interaction=require(_0x78a8('0x6'));var config=require(_0x78a8('0x7'));var controller=require('./voiceContext.controller');router[_0x78a8('0x8')]('/',auth[_0x78a8('0x9')](),controller['index']);router[_0x78a8('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x78a8('0xa')]);router[_0x78a8('0xb')]('/',auth['isAuthenticated'](),controller[_0x78a8('0xc')]);router[_0x78a8('0xd')](_0x78a8('0xe'),auth[_0x78a8('0x9')](),controller['update']);router[_0x78a8('0xf')](_0x78a8('0xe'),auth[_0x78a8('0x9')](),controller[_0x78a8('0x10')]);module[_0x78a8('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 7edce11..405f05b 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 _0x04c3=['sequelize','exports','STRING','BOOLEAN'];(function(_0x569c95,_0x54f839){var _0x2749b5=function(_0x226c68){while(--_0x226c68){_0x569c95['push'](_0x569c95['shift']());}};_0x2749b5(++_0x54f839);}(_0x04c3,0x12c));var _0x304c=function(_0x2d8e43,_0x1990ee){_0x2d8e43=_0x2d8e43-0x0;var _0x528eab=_0x04c3[_0x2d8e43];return _0x528eab;};'use strict';var Sequelize=require(_0x304c('0x0'));module[_0x304c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0x304c('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x304c('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xba47=['STRING','name'];(function(_0x547acb,_0x226697){var _0x5463b9=function(_0x2aaf69){while(--_0x2aaf69){_0x547acb['push'](_0x547acb['shift']());}};_0x5463b9(++_0x226697);}(_0xba47,0xee));var _0x7ba4=function(_0x4f716a,_0x14f4a0){_0x4f716a=_0x4f716a-0x0;var _0x1e3553=_0xba47[_0x4f716a];return _0x1e3553;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7ba4('0x0')],'unique':_0x7ba4('0x1')},'description':{'type':Sequelize[_0x7ba4('0x0')],'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 a5095e1..ff55e12 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 _0x450b=['querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','client','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','then','destroy','get','Contexts','UserProfileResource','sendStatus','name','index','VoiceContext','fieldName','type','key','map','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','root','server/files/templates/context.ejs','render','writeFileSync','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','readFileSync','join','utf8','/etc/asterisk/extensions_xcally_contexts.conf','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce'];(function(_0xbd7400,_0x5625e7){var _0x2eb7fb=function(_0x2ebe61){while(--_0x2ebe61){_0xbd7400['push'](_0xbd7400['shift']());}};_0x2eb7fb(++_0x5625e7);}(_0x450b,0x11c));var _0xb450=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x450b[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb450('0x0'));var zipdir=require(_0xb450('0x1'));var jsonpatch=require(_0xb450('0x2'));var rp=require(_0xb450('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb450('0x4'));var path=require(_0xb450('0x5'));var sox=require(_0xb450('0x6'));var csv=require(_0xb450('0x7'));var ejs=require(_0xb450('0x8'));var fs=require('fs');var fs_extra=require(_0xb450('0x9'));var _=require(_0xb450('0xa'));var squel=require(_0xb450('0xb'));var crypto=require('crypto');var jsforce=require(_0xb450('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb450('0xd'));var Papa=require(_0xb450('0xe'));var Redis=require('ioredis');var authService=require(_0xb450('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb450('0x10'));var logger=require(_0xb450('0x11'))(_0xb450('0x12'));var utils=require(_0xb450('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xb450('0x14'));var db=require(_0xb450('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xb450('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0x437f51,_0x2e07bf,_0x13c13e,_0x13586b){return new BPromise(function(_0x2487f0,_0x483e51){var _0x25b7e1=_0x13586b||client;return _0x25b7e1[_0xb450('0x17')](_0x437f51,_0x13c13e)['then'](function(_0x71242a){logger[_0xb450('0x18')](_0xb450('0x19'),_0x2e07bf,_0xb450('0x1a'));logger[_0xb450('0x1b')](_0xb450('0x1c'),_0x2e07bf,'request\x20sent',JSON[_0xb450('0x1d')](_0x71242a));if(_0x71242a[_0xb450('0x1e')]){if(_0x71242a[_0xb450('0x1e')][_0xb450('0x1f')]===0x1f4){logger[_0xb450('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x2e07bf,_0x71242a[_0xb450('0x1e')][_0xb450('0x20')]);return _0x483e51(_0x71242a[_0xb450('0x1e')]['message']);}logger[_0xb450('0x1e')](_0xb450('0x19'),_0x2e07bf,_0x71242a[_0xb450('0x1e')]['message']);return _0x2487f0(_0x71242a[_0xb450('0x1e')][_0xb450('0x20')]);}else{logger[_0xb450('0x18')]('VoiceContext,\x20%s,\x20%s',_0x2e07bf,_0xb450('0x1a'));_0x2487f0(_0x71242a['result'][_0xb450('0x20')]);}})[_0xb450('0x21')](function(_0x27a892){logger['error'](_0xb450('0x19'),_0x2e07bf,_0x27a892);_0x483e51(_0x27a892);});});}function respondWithStatusCode(_0x24f946,_0xd0dc78){_0xd0dc78=_0xd0dc78||0xcc;return function(_0x512d1f){if(_0x512d1f){return _0x24f946['sendStatus'](_0xd0dc78);}return _0x24f946[_0xb450('0x22')](_0xd0dc78)[_0xb450('0x23')]();};}function respondWithResult(_0x3d18e5,_0x4d723e){_0x4d723e=_0x4d723e||0xc8;return function(_0x55bae2){if(_0x55bae2){return _0x3d18e5[_0xb450('0x22')](_0x4d723e)[_0xb450('0x24')](_0x55bae2);}};}function respondWithFilteredResult(_0x2da321,_0x22a5f6){return function(_0x531a44){if(_0x531a44){var _0x1b1256=typeof _0x22a5f6[_0xb450('0x25')]==='undefined'&&typeof _0x22a5f6[_0xb450('0x26')]===_0xb450('0x27');var _0x1b4317=_0x531a44[_0xb450('0x28')];var _0xcd05d3=_0x1b1256?0x0:_0x22a5f6['offset'];var _0x45b72e=_0x1b1256?_0x531a44[_0xb450('0x28')]:_0x22a5f6[_0xb450('0x25')]+_0x22a5f6[_0xb450('0x26')];var _0x39f837;if(_0x45b72e>=_0x1b4317){_0x45b72e=_0x1b4317;_0x39f837=0xc8;}else{_0x39f837=0xce;}_0x2da321[_0xb450('0x22')](_0x39f837);return _0x2da321['set'](_0xb450('0x29'),_0xcd05d3+'-'+_0x45b72e+'/'+_0x1b4317)[_0xb450('0x24')](_0x531a44);}return null;};}function patchUpdates(_0x234f83){return function(_0x2caa28){try{jsonpatch[_0xb450('0x2a')](_0x2caa28,_0x234f83,!![]);}catch(_0x1e3f12){return BPromise[_0xb450('0x2b')](_0x1e3f12);}return _0x2caa28['save']();};}function saveUpdates(_0x3742a5,_0x325e9d){return function(_0x58c0eb){if(_0x58c0eb){return _0x58c0eb['update'](_0x3742a5)[_0xb450('0x2c')](function(_0xcda5d0){return _0xcda5d0;});}return null;};}function removeEntity(_0x309c42,_0xca341e){return function(_0x36e343){if(_0x36e343){return _0x36e343[_0xb450('0x2d')]()[_0xb450('0x2c')](function(){var _0x4de519=_0x36e343[_0xb450('0x2e')]({'plain':!![]});var _0x5775d0=_0xb450('0x2f');return db[_0xb450('0x30')]['destroy']({'where':{'type':_0x5775d0,'resourceId':_0x4de519['id']}})[_0xb450('0x2c')](function(){return _0x36e343;});})[_0xb450('0x2c')](function(){_0x309c42['status'](0xcc)[_0xb450('0x23')]();});}};}function handleEntityNotFound(_0x3786b2,_0x427032){return function(_0x4d1ec6){if(!_0x4d1ec6){_0x3786b2[_0xb450('0x31')](0x194);}return _0x4d1ec6;};}function handleError(_0x329a86,_0x418329){_0x418329=_0x418329||0x1f4;return function(_0x449efb){logger[_0xb450('0x1e')](_0x449efb['stack']);if(_0x449efb[_0xb450('0x32')]){delete _0x449efb[_0xb450('0x32')];}_0x329a86['status'](_0x418329)['send'](_0x449efb);};}exports[_0xb450('0x33')]=function(_0x207fc0,_0x1867eb){var _0x4aca33={},_0x2d14fe={},_0x24c0cf={'count':0x0,'rows':[]};var _0x30006b=_['map'](db[_0xb450('0x34')]['rawAttributes'],function(_0x5c3111){return{'name':_0x5c3111[_0xb450('0x35')],'type':_0x5c3111[_0xb450('0x36')][_0xb450('0x37')]};});_0x2d14fe['model']=_[_0xb450('0x38')](_0x30006b,_0xb450('0x32'));_0x2d14fe['query']=_[_0xb450('0x39')](_0x207fc0['query']);_0x2d14fe[_0xb450('0x3a')]=_[_0xb450('0x3b')](_0x2d14fe[_0xb450('0x3c')],_0x2d14fe[_0xb450('0x3d')]);_0x4aca33[_0xb450('0x3e')]=_[_0xb450('0x3b')](_0x2d14fe[_0xb450('0x3c')],qs[_0xb450('0x3f')](_0x207fc0[_0xb450('0x3d')][_0xb450('0x3f')]));_0x4aca33[_0xb450('0x3e')]=_0x4aca33[_0xb450('0x3e')][_0xb450('0x40')]?_0x4aca33[_0xb450('0x3e')]:_0x2d14fe['model'];if(!_0x207fc0['query'][_0xb450('0x41')](_0xb450('0x42'))){_0x4aca33[_0xb450('0x26')]=qs[_0xb450('0x26')](_0x207fc0[_0xb450('0x3d')][_0xb450('0x26')]);_0x4aca33['offset']=qs['offset'](_0x207fc0[_0xb450('0x3d')][_0xb450('0x25')]);}_0x4aca33[_0xb450('0x43')]=qs[_0xb450('0x44')](_0x207fc0[_0xb450('0x3d')]['sort']);_0x4aca33['where']=qs[_0xb450('0x3a')](_['pick'](_0x207fc0[_0xb450('0x3d')],_0x2d14fe[_0xb450('0x3a')]),_0x30006b);if(_0x207fc0[_0xb450('0x3d')][_0xb450('0x45')]){_0x4aca33[_0xb450('0x46')]=_[_0xb450('0x47')](_0x4aca33['where'],{'$or':_[_0xb450('0x38')](_0x30006b,function(_0x253f5b){if(_0x253f5b[_0xb450('0x36')]!=='VIRTUAL'){var _0x20d439={};_0x20d439[_0x253f5b[_0xb450('0x32')]]={'$like':'%'+_0x207fc0[_0xb450('0x3d')][_0xb450('0x45')]+'%'};return _0x20d439;}})});}_0x4aca33=_['merge']({},_0x4aca33,_0x207fc0[_0xb450('0x48')]);var _0x583e84={'where':_0x4aca33[_0xb450('0x46')]};return db['VoiceContext'][_0xb450('0x28')](_0x583e84)[_0xb450('0x2c')](function(_0x2087d6){_0x24c0cf[_0xb450('0x28')]=_0x2087d6;if(_0x207fc0['query'][_0xb450('0x49')]){_0x4aca33[_0xb450('0x4a')]=[{'all':!![]}];}return db[_0xb450('0x34')][_0xb450('0x4b')](_0x4aca33);})[_0xb450('0x2c')](function(_0x4ff3a7){_0x24c0cf[_0xb450('0x4c')]=_0x4ff3a7;return _0x24c0cf;})[_0xb450('0x2c')](respondWithFilteredResult(_0x1867eb,_0x4aca33))[_0xb450('0x21')](handleError(_0x1867eb,null));};exports[_0xb450('0x4d')]=function(_0x37df08,_0x4006df){var _0x10ca00={'raw':![],'where':{'id':_0x37df08[_0xb450('0x4e')]['id']}},_0x1f4e4d={};_0x1f4e4d['model']=_[_0xb450('0x39')](db[_0xb450('0x34')][_0xb450('0x4f')]);_0x1f4e4d[_0xb450('0x3d')]=_[_0xb450('0x39')](_0x37df08[_0xb450('0x3d')]);_0x1f4e4d[_0xb450('0x3a')]=_['intersection'](_0x1f4e4d[_0xb450('0x3c')],_0x1f4e4d['query']);_0x10ca00['attributes']=_['intersection'](_0x1f4e4d['model'],qs[_0xb450('0x3f')](_0x37df08[_0xb450('0x3d')][_0xb450('0x3f')]));_0x10ca00[_0xb450('0x3e')]=_0x10ca00[_0xb450('0x3e')][_0xb450('0x40')]?_0x10ca00[_0xb450('0x3e')]:_0x1f4e4d[_0xb450('0x3c')];if(_0x37df08[_0xb450('0x3d')][_0xb450('0x49')]){_0x10ca00[_0xb450('0x4a')]=[{'all':!![]}];}_0x10ca00=_[_0xb450('0x47')]({},_0x10ca00,_0x37df08['options']);return db['VoiceContext'][_0xb450('0x50')](_0x10ca00)['then'](handleEntityNotFound(_0x4006df,null))['then'](respondWithResult(_0x4006df,null))['catch'](handleError(_0x4006df,null));};exports[_0xb450('0x51')]=function(_0x58fa5b,_0x2f57db,_0x4f7065){var _0x221f96;return db[_0xb450('0x34')][_0xb450('0x51')](_0x58fa5b['body'],{'raw':!![]})[_0xb450('0x2c')](function(_0x106ba2){_0x221f96=_0x106ba2;return db[_0xb450('0x34')][_0xb450('0x4b')]({'raw':!![]});})[_0xb450('0x2c')](function(_0xd09e30){var _0x360cb2=fs['readFileSync'](path['join'](config[_0xb450('0x52')],_0xb450('0x53')),'utf8');var _0x372cc9=ejs[_0xb450('0x54')](_0x360cb2,{'contexts':_0xd09e30||[]});fs[_0xb450('0x55')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x372cc9);})['then'](function(){return respondWithRpcPromise(_0xb450('0x56'),'create',{'module':_0xb450('0x57')});})[_0xb450('0x2c')](function(){var _0x16710a=_0x58fa5b[_0xb450('0x58')]['get']({'plain':!![]});if(!_0x16710a)throw new Error(_0xb450('0x59'));if(_0x16710a['role']===_0xb450('0x58')){var _0x548352=_0x221f96[_0xb450('0x2e')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xb450('0x2f'),'userProfileId':_0x16710a[_0xb450('0x5a')]},'raw':!![]})[_0xb450('0x2c')](function(_0x8beb82){if(_0x8beb82&&_0x8beb82[_0xb450('0x5b')]===0x0){return db[_0xb450('0x30')][_0xb450('0x51')]({'name':_0x548352[_0xb450('0x32')],'resourceId':_0x548352['id'],'type':_0x8beb82['name'],'sectionId':_0x8beb82['id']},{})[_0xb450('0x2c')](function(){return _0x221f96;});}else{return _0x221f96;}})[_0xb450('0x21')](function(_0x485e3f){logger[_0xb450('0x1e')](_0xb450('0x5c'),_0x485e3f);throw _0x485e3f;});}return _0x221f96;})[_0xb450('0x2c')](respondWithResult(_0x2f57db,0xc9))[_0xb450('0x21')](handleError(_0x2f57db,null));};exports[_0xb450('0x5d')]=function(_0x351181,_0x38dd37,_0x12e30f){var _0x384f7d;return db[_0xb450('0x34')][_0xb450('0x50')]({'where':{'id':_0x351181[_0xb450('0x4e')]['id']}})[_0xb450('0x2c')](handleEntityNotFound(_0x38dd37,null))[_0xb450('0x2c')](saveUpdates(_0x351181[_0xb450('0x5e')],null))[_0xb450('0x2c')](function(_0x1b1fec){if(_0x1b1fec){_0x384f7d=_0x1b1fec;return db['VoiceContext'][_0xb450('0x4b')]({'raw':!![]});}})[_0xb450('0x2c')](function(_0x359c7b){var _0x26e052=fs[_0xb450('0x5f')](path[_0xb450('0x60')](config['root'],'server/files/templates/context.ejs'),_0xb450('0x61'));var _0x1e6832=ejs[_0xb450('0x54')](_0x26e052,{'contexts':_0x359c7b||[]});fs[_0xb450('0x55')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x1e6832);})[_0xb450('0x2c')](function(){return respondWithRpcPromise(_0xb450('0x56'),_0xb450('0x5d'),{'module':_0xb450('0x57')});})[_0xb450('0x2c')](function(){return _0x384f7d;})[_0xb450('0x2c')](respondWithResult(_0x38dd37,null))['catch'](handleError(_0x38dd37,null));};exports[_0xb450('0x2d')]=function(_0x1e6811,_0x17ae38,_0x59f8d9){var _0x26aeae;return db['VoiceContext']['find']({'where':{'id':_0x1e6811['params']['id']}})['then'](handleEntityNotFound(_0x17ae38,null))[_0xb450('0x2c')](removeEntity(_0x17ae38,null))['then'](function(){return db['VoiceContext'][_0xb450('0x4b')]({'raw':!![]});})['then'](function(_0x18c14e){var _0x4da456=fs[_0xb450('0x5f')](path['join'](config[_0xb450('0x52')],'server/files/templates/context.ejs'),_0xb450('0x61'));var _0x9d2ca0=ejs[_0xb450('0x54')](_0x4da456,{'contexts':_0x18c14e});fs[_0xb450('0x55')](_0xb450('0x62'),_0x9d2ca0);return respondWithRpcPromise('Reload',_0xb450('0x2d'),{'module':_0xb450('0x57')});})[_0xb450('0x21')](handleError(_0x17ae38,null));}; \ No newline at end of file +var _0xe070=['keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','VoiceContext','includeAll','include','findAll','params','rawAttributes','create','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','Reload','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','request','then','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','destroy','get','Contexts','stack','name','send','map','type','model'];(function(_0x58e8e0,_0x58cbe9){var _0x4b9967=function(_0xba394a){while(--_0xba394a){_0x58e8e0['push'](_0x58e8e0['shift']());}};_0x4b9967(++_0x58cbe9);}(_0xe070,0xee));var _0x0e07=function(_0x3d09c7,_0x3ff87d){_0x3d09c7=_0x3d09c7-0x0;var _0x43db15=_0xe070[_0x3d09c7];return _0x43db15;};'use strict';var emlformat=require(_0x0e07('0x0'));var rimraf=require(_0x0e07('0x1'));var zipdir=require(_0x0e07('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0e07('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0e07('0x4'));var util=require(_0x0e07('0x5'));var path=require(_0x0e07('0x6'));var sox=require(_0x0e07('0x7'));var csv=require('to-csv');var ejs=require(_0x0e07('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0e07('0x9'));var squel=require(_0x0e07('0xa'));var crypto=require(_0x0e07('0xb'));var jsforce=require(_0x0e07('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0e07('0xd'));var querystring=require(_0x0e07('0xe'));var Papa=require(_0x0e07('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0e07('0x10'));var hardwareService=require(_0x0e07('0x11'));var logger=require(_0x0e07('0x12'))(_0x0e07('0x13'));var utils=require(_0x0e07('0x14'));var config=require(_0x0e07('0x15'));var licenseUtil=require(_0x0e07('0x16'));var db=require(_0x0e07('0x17'))['db'];var jayson=require(_0x0e07('0x18'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a7600,_0x1c2283,_0x37c0cc,_0x430122){return new BPromise(function(_0x5bf177,_0x28a3ef){var _0x37d878=_0x430122||client;return _0x37d878[_0x0e07('0x19')](_0x3a7600,_0x37c0cc)[_0x0e07('0x1a')](function(_0x315b80){logger['info'](_0x0e07('0x1b'),_0x1c2283,'request\x20sent');logger[_0x0e07('0x1c')](_0x0e07('0x1d'),_0x1c2283,_0x0e07('0x1e'),JSON[_0x0e07('0x1f')](_0x315b80));if(_0x315b80['error']){if(_0x315b80[_0x0e07('0x20')][_0x0e07('0x21')]===0x1f4){logger[_0x0e07('0x20')](_0x0e07('0x1b'),_0x1c2283,_0x315b80[_0x0e07('0x20')][_0x0e07('0x22')]);return _0x28a3ef(_0x315b80[_0x0e07('0x20')][_0x0e07('0x22')]);}logger[_0x0e07('0x20')]('VoiceContext,\x20%s,\x20%s',_0x1c2283,_0x315b80['error']['message']);return _0x5bf177(_0x315b80[_0x0e07('0x20')][_0x0e07('0x22')]);}else{logger[_0x0e07('0x23')](_0x0e07('0x1b'),_0x1c2283,_0x0e07('0x1e'));_0x5bf177(_0x315b80[_0x0e07('0x24')]['message']);}})[_0x0e07('0x25')](function(_0xd1add8){logger[_0x0e07('0x20')](_0x0e07('0x1b'),_0x1c2283,_0xd1add8);_0x28a3ef(_0xd1add8);});});}function respondWithStatusCode(_0x5b1643,_0x2ec3ba){_0x2ec3ba=_0x2ec3ba||0xcc;return function(_0x25179a){if(_0x25179a){return _0x5b1643[_0x0e07('0x26')](_0x2ec3ba);}return _0x5b1643[_0x0e07('0x27')](_0x2ec3ba)['end']();};}function respondWithResult(_0x319445,_0xf3ecb4){_0xf3ecb4=_0xf3ecb4||0xc8;return function(_0x569cdb){if(_0x569cdb){return _0x319445[_0x0e07('0x27')](_0xf3ecb4)[_0x0e07('0x28')](_0x569cdb);}};}function respondWithFilteredResult(_0x5e60d0,_0x5177d8){return function(_0x20cf71){if(_0x20cf71){var _0x1b3566=typeof _0x5177d8['offset']===_0x0e07('0x29')&&typeof _0x5177d8[_0x0e07('0x2a')]==='undefined';var _0x49f9bc=_0x20cf71[_0x0e07('0x2b')];var _0x37fc7f=_0x1b3566?0x0:_0x5177d8[_0x0e07('0x2c')];var _0x3794d8=_0x1b3566?_0x20cf71['count']:_0x5177d8[_0x0e07('0x2c')]+_0x5177d8[_0x0e07('0x2a')];var _0x479a4d;if(_0x3794d8>=_0x49f9bc){_0x3794d8=_0x49f9bc;_0x479a4d=0xc8;}else{_0x479a4d=0xce;}_0x5e60d0[_0x0e07('0x27')](_0x479a4d);return _0x5e60d0['set'](_0x0e07('0x2d'),_0x37fc7f+'-'+_0x3794d8+'/'+_0x49f9bc)[_0x0e07('0x28')](_0x20cf71);}return null;};}function patchUpdates(_0xb95e5b){return function(_0x584914){try{jsonpatch[_0x0e07('0x2e')](_0x584914,_0xb95e5b,!![]);}catch(_0x2c26b9){return BPromise[_0x0e07('0x2f')](_0x2c26b9);}return _0x584914[_0x0e07('0x30')]();};}function saveUpdates(_0x158d4e,_0x4425ee){return function(_0x5b75ab){if(_0x5b75ab){return _0x5b75ab[_0x0e07('0x31')](_0x158d4e)[_0x0e07('0x1a')](function(_0x2c47e7){return _0x2c47e7;});}return null;};}function removeEntity(_0x308b77,_0x2d0fa1){return function(_0x41269f){if(_0x41269f){return _0x41269f[_0x0e07('0x32')]()[_0x0e07('0x1a')](function(){var _0x21284b=_0x41269f[_0x0e07('0x33')]({'plain':!![]});var _0x5075e2=_0x0e07('0x34');return db['UserProfileResource']['destroy']({'where':{'type':_0x5075e2,'resourceId':_0x21284b['id']}})[_0x0e07('0x1a')](function(){return _0x41269f;});})['then'](function(){_0x308b77[_0x0e07('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c8b5e,_0x51d90e){return function(_0x33da50){if(!_0x33da50){_0x2c8b5e[_0x0e07('0x26')](0x194);}return _0x33da50;};}function handleError(_0x4351c0,_0x5e7467){_0x5e7467=_0x5e7467||0x1f4;return function(_0xcfd699){logger['error'](_0xcfd699[_0x0e07('0x35')]);if(_0xcfd699[_0x0e07('0x36')]){delete _0xcfd699[_0x0e07('0x36')];}_0x4351c0['status'](_0x5e7467)[_0x0e07('0x37')](_0xcfd699);};}exports['index']=function(_0x33b9db,_0x2caa77){var _0x244e17={},_0x48af6f={},_0x33401e={'count':0x0,'rows':[]};var _0x438347=_[_0x0e07('0x38')](db['VoiceContext']['rawAttributes'],function(_0x493126){return{'name':_0x493126['fieldName'],'type':_0x493126[_0x0e07('0x39')]['key']};});_0x48af6f[_0x0e07('0x3a')]=_[_0x0e07('0x38')](_0x438347,_0x0e07('0x36'));_0x48af6f['query']=_[_0x0e07('0x3b')](_0x33b9db[_0x0e07('0x3c')]);_0x48af6f['filters']=_[_0x0e07('0x3d')](_0x48af6f[_0x0e07('0x3a')],_0x48af6f[_0x0e07('0x3c')]);_0x244e17[_0x0e07('0x3e')]=_[_0x0e07('0x3d')](_0x48af6f[_0x0e07('0x3a')],qs[_0x0e07('0x3f')](_0x33b9db[_0x0e07('0x3c')][_0x0e07('0x3f')]));_0x244e17[_0x0e07('0x3e')]=_0x244e17[_0x0e07('0x3e')]['length']?_0x244e17['attributes']:_0x48af6f[_0x0e07('0x3a')];if(!_0x33b9db[_0x0e07('0x3c')][_0x0e07('0x40')](_0x0e07('0x41'))){_0x244e17[_0x0e07('0x2a')]=qs[_0x0e07('0x2a')](_0x33b9db['query'][_0x0e07('0x2a')]);_0x244e17['offset']=qs[_0x0e07('0x2c')](_0x33b9db[_0x0e07('0x3c')]['offset']);}_0x244e17[_0x0e07('0x42')]=qs[_0x0e07('0x43')](_0x33b9db[_0x0e07('0x3c')]['sort']);_0x244e17['where']=qs[_0x0e07('0x44')](_[_0x0e07('0x45')](_0x33b9db[_0x0e07('0x3c')],_0x48af6f[_0x0e07('0x44')]),_0x438347);if(_0x33b9db[_0x0e07('0x3c')][_0x0e07('0x46')]){_0x244e17[_0x0e07('0x47')]=_[_0x0e07('0x48')](_0x244e17[_0x0e07('0x47')],{'$or':_[_0x0e07('0x38')](_0x438347,function(_0x174998){if(_0x174998[_0x0e07('0x39')]!==_0x0e07('0x49')){var _0x5f23f8={};_0x5f23f8[_0x174998[_0x0e07('0x36')]]={'$like':'%'+_0x33b9db[_0x0e07('0x3c')][_0x0e07('0x46')]+'%'};return _0x5f23f8;}})});}_0x244e17=_['merge']({},_0x244e17,_0x33b9db[_0x0e07('0x4a')]);var _0x525e5d={'where':_0x244e17['where']};return db[_0x0e07('0x4b')]['count'](_0x525e5d)['then'](function(_0xf3ca77){_0x33401e['count']=_0xf3ca77;if(_0x33b9db[_0x0e07('0x3c')][_0x0e07('0x4c')]){_0x244e17[_0x0e07('0x4d')]=[{'all':!![]}];}return db[_0x0e07('0x4b')][_0x0e07('0x4e')](_0x244e17);})[_0x0e07('0x1a')](function(_0x102b95){_0x33401e['rows']=_0x102b95;return _0x33401e;})[_0x0e07('0x1a')](respondWithFilteredResult(_0x2caa77,_0x244e17))[_0x0e07('0x25')](handleError(_0x2caa77,null));};exports['show']=function(_0x25270b,_0x1f31c7){var _0x234fa7={'raw':![],'where':{'id':_0x25270b[_0x0e07('0x4f')]['id']}},_0x42e112={};_0x42e112[_0x0e07('0x3a')]=_['keys'](db[_0x0e07('0x4b')][_0x0e07('0x50')]);_0x42e112[_0x0e07('0x3c')]=_[_0x0e07('0x3b')](_0x25270b[_0x0e07('0x3c')]);_0x42e112['filters']=_['intersection'](_0x42e112[_0x0e07('0x3a')],_0x42e112[_0x0e07('0x3c')]);_0x234fa7[_0x0e07('0x3e')]=_[_0x0e07('0x3d')](_0x42e112[_0x0e07('0x3a')],qs[_0x0e07('0x3f')](_0x25270b[_0x0e07('0x3c')][_0x0e07('0x3f')]));_0x234fa7[_0x0e07('0x3e')]=_0x234fa7[_0x0e07('0x3e')]['length']?_0x234fa7['attributes']:_0x42e112[_0x0e07('0x3a')];if(_0x25270b[_0x0e07('0x3c')][_0x0e07('0x4c')]){_0x234fa7[_0x0e07('0x4d')]=[{'all':!![]}];}_0x234fa7=_[_0x0e07('0x48')]({},_0x234fa7,_0x25270b['options']);return db[_0x0e07('0x4b')]['find'](_0x234fa7)[_0x0e07('0x1a')](handleEntityNotFound(_0x1f31c7,null))['then'](respondWithResult(_0x1f31c7,null))[_0x0e07('0x25')](handleError(_0x1f31c7,null));};exports['create']=function(_0x48a54a,_0x4d5831,_0x1447c2){var _0x1dd038;return db[_0x0e07('0x4b')][_0x0e07('0x51')](_0x48a54a['body'],{'raw':!![]})['then'](function(_0x134bfc){_0x1dd038=_0x134bfc;return db[_0x0e07('0x4b')][_0x0e07('0x4e')]({'raw':!![]});})[_0x0e07('0x1a')](function(_0x312b67){var _0x4fd366=fs[_0x0e07('0x52')](path[_0x0e07('0x53')](config[_0x0e07('0x54')],_0x0e07('0x55')),_0x0e07('0x56'));var _0x4e3595=ejs[_0x0e07('0x57')](_0x4fd366,{'contexts':_0x312b67||[]});fs[_0x0e07('0x58')](_0x0e07('0x59'),_0x4e3595);})[_0x0e07('0x1a')](function(){return respondWithRpcPromise('Reload','create',{'module':_0x0e07('0x5a')});})[_0x0e07('0x1a')](function(){var _0x1fc9bc=_0x48a54a[_0x0e07('0x5b')][_0x0e07('0x33')]({'plain':!![]});if(!_0x1fc9bc)throw new Error(_0x0e07('0x5c'));if(_0x1fc9bc[_0x0e07('0x5d')]===_0x0e07('0x5b')){var _0x2649da=_0x1dd038[_0x0e07('0x33')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':'Contexts','userProfileId':_0x1fc9bc[_0x0e07('0x5e')]},'raw':!![]})[_0x0e07('0x1a')](function(_0x1ced57){if(_0x1ced57&&_0x1ced57[_0x0e07('0x5f')]===0x0){return db['UserProfileResource'][_0x0e07('0x51')]({'name':_0x2649da['name'],'resourceId':_0x2649da['id'],'type':_0x1ced57[_0x0e07('0x36')],'sectionId':_0x1ced57['id']},{})['then'](function(){return _0x1dd038;});}else{return _0x1dd038;}})[_0x0e07('0x25')](function(_0x39e5b4){logger['error'](_0x0e07('0x60'),_0x39e5b4);throw _0x39e5b4;});}return _0x1dd038;})['then'](respondWithResult(_0x4d5831,0xc9))[_0x0e07('0x25')](handleError(_0x4d5831,null));};exports[_0x0e07('0x31')]=function(_0x3c43bf,_0x3710b1,_0x3086b8){var _0x4b2216;return db[_0x0e07('0x4b')][_0x0e07('0x61')]({'where':{'id':_0x3c43bf[_0x0e07('0x4f')]['id']}})[_0x0e07('0x1a')](handleEntityNotFound(_0x3710b1,null))[_0x0e07('0x1a')](saveUpdates(_0x3c43bf['body'],null))[_0x0e07('0x1a')](function(_0x3abc94){if(_0x3abc94){_0x4b2216=_0x3abc94;return db['VoiceContext'][_0x0e07('0x4e')]({'raw':!![]});}})[_0x0e07('0x1a')](function(_0x2c29ce){var _0x3b6a11=fs[_0x0e07('0x52')](path[_0x0e07('0x53')](config[_0x0e07('0x54')],_0x0e07('0x55')),_0x0e07('0x56'));var _0x2bfff4=ejs[_0x0e07('0x57')](_0x3b6a11,{'contexts':_0x2c29ce||[]});fs['writeFileSync'](_0x0e07('0x59'),_0x2bfff4);})[_0x0e07('0x1a')](function(){return respondWithRpcPromise(_0x0e07('0x62'),'update',{'module':'chan_sip.so'});})[_0x0e07('0x1a')](function(){return _0x4b2216;})[_0x0e07('0x1a')](respondWithResult(_0x3710b1,null))[_0x0e07('0x25')](handleError(_0x3710b1,null));};exports[_0x0e07('0x32')]=function(_0x202cf3,_0x2a7580,_0x8fbfc3){var _0x1ab77c;return db[_0x0e07('0x4b')]['find']({'where':{'id':_0x202cf3['params']['id']}})[_0x0e07('0x1a')](handleEntityNotFound(_0x2a7580,null))[_0x0e07('0x1a')](removeEntity(_0x2a7580,null))[_0x0e07('0x1a')](function(){return db[_0x0e07('0x4b')][_0x0e07('0x4e')]({'raw':!![]});})[_0x0e07('0x1a')](function(_0x448222){var _0x31e13f=fs[_0x0e07('0x52')](path['join'](config[_0x0e07('0x54')],_0x0e07('0x55')),'utf8');var _0x1386ea=ejs['render'](_0x31e13f,{'contexts':_0x448222});fs['writeFileSync'](_0x0e07('0x59'),_0x1386ea);return respondWithRpcPromise(_0x0e07('0x62'),'destroy',{'module':_0x0e07('0x5a')});})['catch'](handleError(_0x2a7580,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index dd84d12..6f5bf32 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 _0x4aec=['util','bluebird','request-promise','rimraf','../../config/environment','./voiceContext.attributes','exports','define','voice_contexts','lodash'];(function(_0x325108,_0x3c6ed9){var _0x43a1e9=function(_0x43894b){while(--_0x43894b){_0x325108['push'](_0x325108['shift']());}};_0x43a1e9(++_0x3c6ed9);}(_0x4aec,0x1ad));var _0xc4ae=function(_0x38f682,_0x420d36){_0x38f682=_0x38f682-0x0;var _0x55aec5=_0x4aec[_0x38f682];return _0x55aec5;};'use strict';var _=require(_0xc4ae('0x0'));var util=require(_0xc4ae('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc4ae('0x2'));var rp=require(_0xc4ae('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc4ae('0x4'));var config=require(_0xc4ae('0x5'));var attributes=require(_0xc4ae('0x6'));module[_0xc4ae('0x7')]=function(_0x260325,_0x530bcf){return _0x260325[_0xc4ae('0x8')]('VoiceContext',attributes,{'tableName':_0xc4ae('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a17=['define','VoiceContext','../../config/logger','moment','bluebird','request-promise'];(function(_0x36a6d7,_0x5bf4e0){var _0x5763a1=function(_0x1119de){while(--_0x1119de){_0x36a6d7['push'](_0x36a6d7['shift']());}};_0x5763a1(++_0x5bf4e0);}(_0x5a17,0xda));var _0x75a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5a17[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x75a1('0x0'))('api');var moment=require(_0x75a1('0x1'));var BPromise=require(_0x75a1('0x2'));var rp=require(_0x75a1('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceContext.attributes');module['exports']=function(_0x2094f4,_0x2d4fae){return _0x2094f4[_0x75a1('0x4')](_0x75a1('0x5'),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 82957d0..8519daf 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 _0x56dc=['http','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x259d17,_0x220710){var _0x407535=function(_0x49bc38){while(--_0x49bc38){_0x259d17['push'](_0x259d17['shift']());}};_0x407535(++_0x220710);}(_0x56dc,0xfd));var _0xc56d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x56dc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc56d('0x0'));var util=require('util');var moment=require(_0xc56d('0x1'));var BPromise=require(_0xc56d('0x2'));var rs=require(_0xc56d('0x3'));var fs=require('fs');var Redis=require(_0xc56d('0x4'));var db=require(_0xc56d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc56d('0x6'))(_0xc56d('0x7'));var config=require(_0xc56d('0x8'));var jayson=require(_0xc56d('0x9'));var client=jayson[_0xc56d('0xa')][_0xc56d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x571341,_0x452715,_0x24b556){return new BPromise(function(_0x3ac7cd,_0x51ca01){return client[_0xc56d('0xc')](_0x571341,_0x24b556)[_0xc56d('0xd')](function(_0x3ff2cb){logger[_0xc56d('0xe')](_0xc56d('0xf'),_0x452715,'request\x20sent');logger[_0xc56d('0x10')](_0xc56d('0x11'),_0x452715,_0xc56d('0x12'),JSON['stringify'](_0x3ff2cb));if(_0x3ff2cb[_0xc56d('0x13')]){if(_0x3ff2cb[_0xc56d('0x13')][_0xc56d('0x14')]===0x1f4){logger[_0xc56d('0x13')]('VoiceContext,\x20%s,\x20%s',_0x452715,_0x3ff2cb[_0xc56d('0x13')][_0xc56d('0x15')]);return _0x51ca01(_0x3ff2cb[_0xc56d('0x13')]['message']);}logger[_0xc56d('0x13')](_0xc56d('0xf'),_0x452715,_0x3ff2cb[_0xc56d('0x13')][_0xc56d('0x15')]);return _0x3ac7cd(_0x3ff2cb['error'][_0xc56d('0x15')]);}else{logger[_0xc56d('0xe')]('VoiceContext,\x20%s,\x20%s',_0x452715,'request\x20sent');_0x3ac7cd(_0x3ff2cb[_0xc56d('0x16')][_0xc56d('0x15')]);}})[_0xc56d('0x17')](function(_0x1d142c){logger['error'](_0xc56d('0xf'),_0x452715,_0x1d142c);_0x51ca01(_0x1d142c);});});} \ No newline at end of file +var _0x30d6=['client','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0x870b62,_0x2143f9){var _0x2dcb39=function(_0x2fb63d){while(--_0x2fb63d){_0x870b62['push'](_0x870b62['shift']());}};_0x2dcb39(++_0x2143f9);}(_0x30d6,0x1b0));var _0x630d=function(_0x255cca,_0x121536){_0x255cca=_0x255cca-0x0;var _0x16d8de=_0x30d6[_0x255cca];return _0x16d8de;};'use strict';var _=require(_0x630d('0x0'));var util=require(_0x630d('0x1'));var moment=require('moment');var BPromise=require(_0x630d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x630d('0x3'));var db=require(_0x630d('0x4'))['db'];var utils=require(_0x630d('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x630d('0x6'));var jayson=require(_0x630d('0x7'));var client=jayson[_0x630d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8950bb,_0x3aa6f4,_0x2c1b77){return new BPromise(function(_0x4b60c1,_0x533e4f){return client[_0x630d('0x9')](_0x8950bb,_0x2c1b77)[_0x630d('0xa')](function(_0x24d260){logger[_0x630d('0xb')]('VoiceContext,\x20%s,\x20%s',_0x3aa6f4,_0x630d('0xc'));logger[_0x630d('0xd')](_0x630d('0xe'),_0x3aa6f4,_0x630d('0xc'),JSON[_0x630d('0xf')](_0x24d260));if(_0x24d260[_0x630d('0x10')]){if(_0x24d260[_0x630d('0x10')][_0x630d('0x11')]===0x1f4){logger[_0x630d('0x10')](_0x630d('0x12'),_0x3aa6f4,_0x24d260['error'][_0x630d('0x13')]);return _0x533e4f(_0x24d260['error'][_0x630d('0x13')]);}logger[_0x630d('0x10')]('VoiceContext,\x20%s,\x20%s',_0x3aa6f4,_0x24d260[_0x630d('0x10')][_0x630d('0x13')]);return _0x4b60c1(_0x24d260[_0x630d('0x10')][_0x630d('0x13')]);}else{logger[_0x630d('0xb')](_0x630d('0x12'),_0x3aa6f4,_0x630d('0xc'));_0x4b60c1(_0x24d260[_0x630d('0x14')]['message']);}})[_0x630d('0x15')](function(_0x4db79d){logger[_0x630d('0x10')]('VoiceContext,\x20%s,\x20%s',_0x3aa6f4,_0x4db79d);_0x533e4f(_0x4db79d);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 10ed9fd..99da2c7 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 _0x6ff5=['multer','express','fs-extra','../../components/auth/service','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x143361,_0x42c5a0){var _0x299d53=function(_0x5ef806){while(--_0x5ef806){_0x143361['push'](_0x143361['shift']());}};_0x299d53(++_0x42c5a0);}(_0x6ff5,0xab));var _0x56ff=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x6ff5[_0x5f0089];return _0x193892;};'use strict';var multer=require(_0x56ff('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x56ff('0x1'));var router=express['Router']();var fs_extra=require(_0x56ff('0x2'));var auth=require(_0x56ff('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x56ff('0x4'));router[_0x56ff('0x5')]('/',auth[_0x56ff('0x6')](),controller[_0x56ff('0x7')]);router[_0x56ff('0x5')](_0x56ff('0x8'),auth[_0x56ff('0x6')](),controller[_0x56ff('0x9')]);router[_0x56ff('0x5')](_0x56ff('0xa'),auth[_0x56ff('0x6')](),controller[_0x56ff('0xb')]);router[_0x56ff('0xc')]('/',auth[_0x56ff('0x6')](),controller[_0x56ff('0xd')]);router[_0x56ff('0xe')](_0x56ff('0xa'),auth[_0x56ff('0x6')](),controller[_0x56ff('0xf')]);router[_0x56ff('0x10')](_0x56ff('0xa'),auth[_0x56ff('0x6')](),controller[_0x56ff('0x11')]);module[_0x56ff('0x12')]=router; \ No newline at end of file +var _0x054b=['/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x5ed32c,_0x956025){var _0x271ea3=function(_0x206a21){while(--_0x206a21){_0x5ed32c['push'](_0x5ed32c['shift']());}};_0x271ea3(++_0x956025);}(_0x054b,0x11c));var _0xb054=function(_0x3f19c1,_0x3bfe43){_0x3f19c1=_0x3f19c1-0x0;var _0x568f1b=_0x054b[_0x3f19c1];return _0x568f1b;};'use strict';var multer=require(_0xb054('0x0'));var util=require(_0xb054('0x1'));var path=require(_0xb054('0x2'));var timeout=require(_0xb054('0x3'));var express=require(_0xb054('0x4'));var router=express[_0xb054('0x5')]();var fs_extra=require(_0xb054('0x6'));var auth=require(_0xb054('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xb054('0x8'));var controller=require(_0xb054('0x9'));router[_0xb054('0xa')]('/',auth[_0xb054('0xb')](),controller[_0xb054('0xc')]);router[_0xb054('0xa')](_0xb054('0xd'),auth['isAuthenticated'](),controller[_0xb054('0xe')]);router[_0xb054('0xa')](_0xb054('0xf'),auth[_0xb054('0xb')](),controller[_0xb054('0x10')]);router['post']('/',auth[_0xb054('0xb')](),controller[_0xb054('0x11')]);router[_0xb054('0x12')](_0xb054('0xf'),auth[_0xb054('0xb')](),controller[_0xb054('0x13')]);router[_0xb054('0x14')](_0xb054('0xf'),auth[_0xb054('0xb')](),controller[_0xb054('0x15')]);module[_0xb054('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 b35fa16..4c839da 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 _0xedd9=['DATE','called,connect,complete','exports','STRING','INTEGER'];(function(_0x591c44,_0x5f0fc9){var _0x452330=function(_0x5bdee5){while(--_0x5bdee5){_0x591c44['push'](_0x591c44['shift']());}};_0x452330(++_0x5f0fc9);}(_0xedd9,0xfc));var _0x9edd=function(_0x358a37,_0x2b006f){_0x358a37=_0x358a37-0x0;var _0x509dd9=_0xedd9[_0x358a37];return _0x509dd9;};'use strict';var Sequelize=require('sequelize');module[_0x9edd('0x0')]={'privilege':{'type':Sequelize[_0x9edd('0x1')]},'channel':{'type':Sequelize[_0x9edd('0x1')]},'channelstate':{'type':Sequelize[_0x9edd('0x2')]},'channelstatedesc':{'type':Sequelize[_0x9edd('0x1')]},'calleridnum':{'type':Sequelize[_0x9edd('0x1')]},'calleridname':{'type':Sequelize[_0x9edd('0x1')]},'connectedlinenum':{'type':Sequelize[_0x9edd('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x9edd('0x1')]},'accountcode':{'type':Sequelize[_0x9edd('0x1')]},'context':{'type':Sequelize[_0x9edd('0x1')]},'exten':{'type':Sequelize[_0x9edd('0x1')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x9edd('0x1')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x9edd('0x1')]},'destchannelstate':{'type':Sequelize[_0x9edd('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x9edd('0x1')]},'destcalleridnum':{'type':Sequelize[_0x9edd('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x9edd('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x9edd('0x1')]},'destaccountcode':{'type':Sequelize[_0x9edd('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x9edd('0x1')]},'destpriority':{'type':Sequelize[_0x9edd('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x9edd('0x1')]},'dialstring':{'type':Sequelize[_0x9edd('0x1')]},'dialstatus':{'type':Sequelize[_0x9edd('0x1')]},'starttime':{'type':Sequelize[_0x9edd('0x3')]},'answertime':{'type':Sequelize[_0x9edd('0x3')]},'endtime':{'type':Sequelize[_0x9edd('0x3')]},'lastevent':{'type':Sequelize[_0x9edd('0x1')],'comment':_0x9edd('0x4')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0x9edd('0x2')]},'holdtime':{'type':Sequelize[_0x9edd('0x2')]},'billableseconds':{'type':Sequelize[_0x9edd('0x2')]}}; \ No newline at end of file +var _0x81bd=['exports','STRING','INTEGER','DATE','sequelize'];(function(_0x419bac,_0x847e80){var _0x3373d4=function(_0x4e8fce){while(--_0x4e8fce){_0x419bac['push'](_0x419bac['shift']());}};_0x3373d4(++_0x847e80);}(_0x81bd,0x7c));var _0xd81b=function(_0x2e0ffa,_0x451f12){_0x2e0ffa=_0x2e0ffa-0x0;var _0x24d627=_0x81bd[_0x2e0ffa];return _0x24d627;};'use strict';var Sequelize=require(_0xd81b('0x0'));module[_0xd81b('0x1')]={'privilege':{'type':Sequelize[_0xd81b('0x2')]},'channel':{'type':Sequelize[_0xd81b('0x2')]},'channelstate':{'type':Sequelize[_0xd81b('0x3')]},'channelstatedesc':{'type':Sequelize[_0xd81b('0x2')]},'calleridnum':{'type':Sequelize[_0xd81b('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xd81b('0x2')]},'connectedlinename':{'type':Sequelize[_0xd81b('0x2')]},'language':{'type':Sequelize[_0xd81b('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xd81b('0x2')]},'exten':{'type':Sequelize[_0xd81b('0x2')]},'priority':{'type':Sequelize[_0xd81b('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xd81b('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xd81b('0x2')]},'destcalleridnum':{'type':Sequelize[_0xd81b('0x2')]},'destcalleridname':{'type':Sequelize[_0xd81b('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xd81b('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xd81b('0x2')]},'destlanguage':{'type':Sequelize[_0xd81b('0x2')]},'destaccountcode':{'type':Sequelize[_0xd81b('0x2')]},'destcontext':{'type':Sequelize[_0xd81b('0x2')]},'destexten':{'type':Sequelize[_0xd81b('0x2')]},'destpriority':{'type':Sequelize[_0xd81b('0x3')]},'destuniqueid':{'type':Sequelize[_0xd81b('0x2')]},'destlinkedid':{'type':Sequelize[_0xd81b('0x2')]},'dialstring':{'type':Sequelize[_0xd81b('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xd81b('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xd81b('0x4')]},'lastevent':{'type':Sequelize[_0xd81b('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xd81b('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xd81b('0x3')]},'billableseconds':{'type':Sequelize[_0xd81b('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index b3d8586..857abb7 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 _0x08f6=['rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','catch','show','params','options','create','body','find','describe'];(function(_0x993a27,_0x2374b1){var _0x2cc9ba=function(_0x596ba8){while(--_0x596ba8){_0x993a27['push'](_0x993a27['shift']());}};_0x2cc9ba(++_0x2374b1);}(_0x08f6,0x16d));var _0x608f=function(_0x4d79bc,_0x32c905){_0x4d79bc=_0x4d79bc-0x0;var _0x4b4760=_0x08f6[_0x4d79bc];return _0x4b4760;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x608f('0x0'));var zipdir=require(_0x608f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x608f('0x2'));var moment=require(_0x608f('0x3'));var BPromise=require(_0x608f('0x4'));var Mustache=require(_0x608f('0x5'));var util=require('util');var path=require(_0x608f('0x6'));var sox=require(_0x608f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x608f('0x8'));var _=require(_0x608f('0x9'));var squel=require(_0x608f('0xa'));var crypto=require(_0x608f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x608f('0xc'));var toCsv=require(_0x608f('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x608f('0xe'));var authService=require(_0x608f('0xf'));var qs=require(_0x608f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x608f('0x11'));var logger=require(_0x608f('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x608f('0x13'));var licenseUtil=require(_0x608f('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5bdd47,_0x561e27){_0x561e27=_0x561e27||0xcc;return function(_0xa5c9b7){if(_0xa5c9b7){return _0x5bdd47['sendStatus'](_0x561e27);}return _0x5bdd47[_0x608f('0x15')](_0x561e27)['end']();};}function respondWithResult(_0x5a03d5,_0x279937){_0x279937=_0x279937||0xc8;return function(_0x3f8665){if(_0x3f8665){return _0x5a03d5[_0x608f('0x15')](_0x279937)['json'](_0x3f8665);}};}function respondWithFilteredResult(_0x1515e8,_0x125ff8){return function(_0x3fd517){if(_0x3fd517){var _0x3f0642=typeof _0x125ff8[_0x608f('0x16')]===_0x608f('0x17')&&typeof _0x125ff8[_0x608f('0x18')]==='undefined';var _0xde6262=_0x3fd517[_0x608f('0x19')];var _0x4529e4=_0x3f0642?0x0:_0x125ff8[_0x608f('0x16')];var _0x5d6781=_0x3f0642?_0x3fd517[_0x608f('0x19')]:_0x125ff8[_0x608f('0x16')]+_0x125ff8[_0x608f('0x18')];var _0xfdc8bd;if(_0x5d6781>=_0xde6262){_0x5d6781=_0xde6262;_0xfdc8bd=0xc8;}else{_0xfdc8bd=0xce;}_0x1515e8[_0x608f('0x15')](_0xfdc8bd);return _0x1515e8[_0x608f('0x1a')](_0x608f('0x1b'),_0x4529e4+'-'+_0x5d6781+'/'+_0xde6262)[_0x608f('0x1c')](_0x3fd517);}return null;};}function patchUpdates(_0x17d7cb){return function(_0x5150ad){try{jsonpatch[_0x608f('0x1d')](_0x5150ad,_0x17d7cb,!![]);}catch(_0x153f2f){return BPromise[_0x608f('0x1e')](_0x153f2f);}return _0x5150ad[_0x608f('0x1f')]();};}function saveUpdates(_0x3a439f,_0x3461e3){return function(_0x50ed61){if(_0x50ed61){return _0x50ed61[_0x608f('0x20')](_0x3a439f)[_0x608f('0x21')](function(_0x2220b6){return _0x2220b6;});}return null;};}function removeEntity(_0x470511,_0x3412c1){return function(_0x32ef21){if(_0x32ef21){return _0x32ef21[_0x608f('0x22')]()[_0x608f('0x21')](function(){_0x470511[_0x608f('0x15')](0xcc)[_0x608f('0x23')]();});}};}function handleEntityNotFound(_0x1648f6,_0x35a2cc){return function(_0x37f58c){if(!_0x37f58c){_0x1648f6[_0x608f('0x24')](0x194);}return _0x37f58c;};}function handleError(_0x4631be,_0x257870){_0x257870=_0x257870||0x1f4;return function(_0xc8f78c){logger[_0x608f('0x25')](_0xc8f78c[_0x608f('0x26')]);if(_0xc8f78c[_0x608f('0x27')]){delete _0xc8f78c['name'];}_0x4631be[_0x608f('0x15')](_0x257870)['send'](_0xc8f78c);};}exports[_0x608f('0x28')]=function(_0x599843,_0x50e555){var _0x199b89={},_0x1829ca={},_0x33b1b7={'count':0x0,'rows':[]};var _0x520a47=_[_0x608f('0x29')](db[_0x608f('0x2a')][_0x608f('0x2b')],function(_0x58648d){return{'name':_0x58648d[_0x608f('0x2c')],'type':_0x58648d[_0x608f('0x2d')][_0x608f('0x2e')]};});_0x1829ca[_0x608f('0x2f')]=_[_0x608f('0x29')](_0x520a47,_0x608f('0x27'));_0x1829ca[_0x608f('0x30')]=_[_0x608f('0x31')](_0x599843['query']);_0x1829ca[_0x608f('0x32')]=_[_0x608f('0x33')](_0x1829ca[_0x608f('0x2f')],_0x1829ca[_0x608f('0x30')]);_0x199b89['attributes']=_[_0x608f('0x33')](_0x1829ca[_0x608f('0x2f')],qs['fields'](_0x599843['query'][_0x608f('0x34')]));_0x199b89[_0x608f('0x35')]=_0x199b89[_0x608f('0x35')][_0x608f('0x36')]?_0x199b89['attributes']:_0x1829ca[_0x608f('0x2f')];if(!_0x599843[_0x608f('0x30')][_0x608f('0x37')](_0x608f('0x38'))){_0x199b89[_0x608f('0x18')]=qs[_0x608f('0x18')](_0x599843[_0x608f('0x30')][_0x608f('0x18')]);_0x199b89['offset']=qs[_0x608f('0x16')](_0x599843['query']['offset']);}_0x199b89['order']=qs[_0x608f('0x39')](_0x599843['query']['sort']);_0x199b89[_0x608f('0x3a')]=qs['filters'](_[_0x608f('0x3b')](_0x599843[_0x608f('0x30')],_0x1829ca[_0x608f('0x32')]),_0x520a47);if(_0x599843[_0x608f('0x30')][_0x608f('0x3c')]){_0x199b89['where']=_[_0x608f('0x3d')](_0x199b89['where'],{'$or':_[_0x608f('0x29')](_0x520a47,function(_0x229f01){if(_0x229f01[_0x608f('0x2d')]!=='VIRTUAL'){var _0x39805a={};_0x39805a[_0x229f01[_0x608f('0x27')]]={'$like':'%'+_0x599843['query'][_0x608f('0x3c')]+'%'};return _0x39805a;}})});}_0x199b89=_[_0x608f('0x3d')]({},_0x199b89,_0x599843['options']);var _0x212a95={'where':_0x199b89['where']};return db[_0x608f('0x2a')][_0x608f('0x19')](_0x212a95)['then'](function(_0x220346){_0x33b1b7[_0x608f('0x19')]=_0x220346;if(_0x599843[_0x608f('0x30')][_0x608f('0x3e')]){_0x199b89[_0x608f('0x3f')]=[{'all':!![]}];}return db[_0x608f('0x2a')][_0x608f('0x40')](_0x199b89);})[_0x608f('0x21')](function(_0x4e1f51){_0x33b1b7['rows']=_0x4e1f51;return _0x33b1b7;})[_0x608f('0x21')](respondWithFilteredResult(_0x50e555,_0x199b89))[_0x608f('0x41')](handleError(_0x50e555,null));};exports[_0x608f('0x42')]=function(_0x36c0d2,_0x39d0ca){var _0x211d6f={'raw':!![],'where':{'id':_0x36c0d2[_0x608f('0x43')]['id']}},_0x36e515={};_0x36e515[_0x608f('0x2f')]=_['keys'](db[_0x608f('0x2a')][_0x608f('0x2b')]);_0x36e515[_0x608f('0x30')]=_[_0x608f('0x31')](_0x36c0d2['query']);_0x36e515[_0x608f('0x32')]=_['intersection'](_0x36e515['model'],_0x36e515[_0x608f('0x30')]);_0x211d6f['attributes']=_['intersection'](_0x36e515[_0x608f('0x2f')],qs[_0x608f('0x34')](_0x36c0d2[_0x608f('0x30')]['fields']));_0x211d6f[_0x608f('0x35')]=_0x211d6f['attributes']['length']?_0x211d6f[_0x608f('0x35')]:_0x36e515[_0x608f('0x2f')];if(_0x36c0d2[_0x608f('0x30')][_0x608f('0x3e')]){_0x211d6f[_0x608f('0x3f')]=[{'all':!![]}];}_0x211d6f=_['merge']({},_0x211d6f,_0x36c0d2[_0x608f('0x44')]);return db[_0x608f('0x2a')]['find'](_0x211d6f)[_0x608f('0x21')](handleEntityNotFound(_0x39d0ca,null))[_0x608f('0x21')](respondWithResult(_0x39d0ca,null))[_0x608f('0x41')](handleError(_0x39d0ca,null));};exports[_0x608f('0x45')]=function(_0x1c9cf9,_0x249ccb){return db[_0x608f('0x2a')][_0x608f('0x45')](_0x1c9cf9[_0x608f('0x46')],{})[_0x608f('0x21')](respondWithResult(_0x249ccb,0xc9))[_0x608f('0x41')](handleError(_0x249ccb,null));};exports[_0x608f('0x20')]=function(_0x590dbc,_0x17fcd6){if(_0x590dbc[_0x608f('0x46')]['id']){delete _0x590dbc['body']['id'];}return db[_0x608f('0x2a')][_0x608f('0x47')]({'where':{'id':_0x590dbc[_0x608f('0x43')]['id']}})[_0x608f('0x21')](handleEntityNotFound(_0x17fcd6,null))[_0x608f('0x21')](saveUpdates(_0x590dbc[_0x608f('0x46')],null))[_0x608f('0x21')](respondWithResult(_0x17fcd6,null))[_0x608f('0x41')](handleError(_0x17fcd6,null));};exports[_0x608f('0x22')]=function(_0x15f691,_0x2e8b03){return db['VoiceDialReport'][_0x608f('0x47')]({'where':{'id':_0x15f691['params']['id']}})[_0x608f('0x21')](handleEntityNotFound(_0x2e8b03,null))[_0x608f('0x21')](removeEntity(_0x2e8b03,null))[_0x608f('0x41')](handleError(_0x2e8b03,null));};exports[_0x608f('0x48')]=function(_0x1f176f,_0x4fb691){return db[_0x608f('0x2a')][_0x608f('0x48')]()['then'](respondWithResult(_0x4fb691,null))[_0x608f('0x41')](handleError(_0x4fb691,null));}; \ No newline at end of file +var _0x076a=['fields','hasOwnProperty','nolimit','sort','where','map','VIRTUAL','filter','merge','options','then','include','findAll','rows','catch','show','params','intersection','length','includeAll','find','create','body','update','describe','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','reject','save','destroy','error','stack','name','send','index','VoiceDialReport','rawAttributes','type','key','model','query','keys','filters','attributes'];(function(_0x4a72d3,_0x521182){var _0x3bc5a4=function(_0x16964f){while(--_0x16964f){_0x4a72d3['push'](_0x4a72d3['shift']());}};_0x3bc5a4(++_0x521182);}(_0x076a,0x186));var _0xa076=function(_0x1551af,_0x5223c3){_0x1551af=_0x1551af-0x0;var _0xd8eb82=_0x076a[_0x1551af];return _0xd8eb82;};'use strict';var emlformat=require(_0xa076('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa076('0x1'));var moment=require(_0xa076('0x2'));var BPromise=require(_0xa076('0x3'));var Mustache=require(_0xa076('0x4'));var util=require(_0xa076('0x5'));var path=require(_0xa076('0x6'));var sox=require(_0xa076('0x7'));var csv=require(_0xa076('0x8'));var ejs=require(_0xa076('0x9'));var fs=require('fs');var fs_extra=require(_0xa076('0xa'));var _=require('lodash');var squel=require(_0xa076('0xb'));var crypto=require('crypto');var jsforce=require(_0xa076('0xc'));var deskjs=require(_0xa076('0xd'));var toCsv=require(_0xa076('0x8'));var querystring=require(_0xa076('0xe'));var Papa=require('papaparse');var Redis=require(_0xa076('0xf'));var authService=require(_0xa076('0x10'));var qs=require(_0xa076('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa076('0x12'));var logger=require('../../config/logger')(_0xa076('0x13'));var utils=require(_0xa076('0x14'));var config=require(_0xa076('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa076('0x16'))['db'];function respondWithStatusCode(_0x37d2f6,_0x190739){_0x190739=_0x190739||0xcc;return function(_0x5193d6){if(_0x5193d6){return _0x37d2f6[_0xa076('0x17')](_0x190739);}return _0x37d2f6['status'](_0x190739)[_0xa076('0x18')]();};}function respondWithResult(_0x4b35a9,_0x480e6e){_0x480e6e=_0x480e6e||0xc8;return function(_0x108b9e){if(_0x108b9e){return _0x4b35a9[_0xa076('0x19')](_0x480e6e)['json'](_0x108b9e);}};}function respondWithFilteredResult(_0x218a79,_0x27682a){return function(_0x6d26a8){if(_0x6d26a8){var _0x5e53f4=typeof _0x27682a[_0xa076('0x1a')]==='undefined'&&typeof _0x27682a[_0xa076('0x1b')]===_0xa076('0x1c');var _0x163f59=_0x6d26a8['count'];var _0xe05bb7=_0x5e53f4?0x0:_0x27682a['offset'];var _0x10a1bd=_0x5e53f4?_0x6d26a8[_0xa076('0x1d')]:_0x27682a['offset']+_0x27682a['limit'];var _0x176ded;if(_0x10a1bd>=_0x163f59){_0x10a1bd=_0x163f59;_0x176ded=0xc8;}else{_0x176ded=0xce;}_0x218a79[_0xa076('0x19')](_0x176ded);return _0x218a79[_0xa076('0x1e')]('Content-Range',_0xe05bb7+'-'+_0x10a1bd+'/'+_0x163f59)['json'](_0x6d26a8);}return null;};}function patchUpdates(_0x16a427){return function(_0x4ab6e8){try{jsonpatch['apply'](_0x4ab6e8,_0x16a427,!![]);}catch(_0x3c65d2){return BPromise[_0xa076('0x1f')](_0x3c65d2);}return _0x4ab6e8[_0xa076('0x20')]();};}function saveUpdates(_0x1040e3,_0x5b45bb){return function(_0x52f75e){if(_0x52f75e){return _0x52f75e['update'](_0x1040e3)['then'](function(_0x148adc){return _0x148adc;});}return null;};}function removeEntity(_0x928d36,_0x2dfa1d){return function(_0x5bd7ef){if(_0x5bd7ef){return _0x5bd7ef[_0xa076('0x21')]()['then'](function(){_0x928d36['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ae404,_0x412c98){return function(_0x5bbecb){if(!_0x5bbecb){_0x5ae404['sendStatus'](0x194);}return _0x5bbecb;};}function handleError(_0x26c5db,_0x234158){_0x234158=_0x234158||0x1f4;return function(_0x3fc750){logger[_0xa076('0x22')](_0x3fc750[_0xa076('0x23')]);if(_0x3fc750[_0xa076('0x24')]){delete _0x3fc750[_0xa076('0x24')];}_0x26c5db['status'](_0x234158)[_0xa076('0x25')](_0x3fc750);};}exports[_0xa076('0x26')]=function(_0x5d08be,_0x18ed85){var _0x3b64c7={},_0x35832d={},_0x374519={'count':0x0,'rows':[]};var _0x152dbb=_['map'](db[_0xa076('0x27')][_0xa076('0x28')],function(_0x242ebe){return{'name':_0x242ebe['fieldName'],'type':_0x242ebe[_0xa076('0x29')][_0xa076('0x2a')]};});_0x35832d[_0xa076('0x2b')]=_['map'](_0x152dbb,_0xa076('0x24'));_0x35832d[_0xa076('0x2c')]=_[_0xa076('0x2d')](_0x5d08be[_0xa076('0x2c')]);_0x35832d[_0xa076('0x2e')]=_['intersection'](_0x35832d[_0xa076('0x2b')],_0x35832d[_0xa076('0x2c')]);_0x3b64c7[_0xa076('0x2f')]=_['intersection'](_0x35832d[_0xa076('0x2b')],qs[_0xa076('0x30')](_0x5d08be[_0xa076('0x2c')][_0xa076('0x30')]));_0x3b64c7[_0xa076('0x2f')]=_0x3b64c7['attributes']['length']?_0x3b64c7['attributes']:_0x35832d[_0xa076('0x2b')];if(!_0x5d08be[_0xa076('0x2c')][_0xa076('0x31')](_0xa076('0x32'))){_0x3b64c7[_0xa076('0x1b')]=qs[_0xa076('0x1b')](_0x5d08be['query'][_0xa076('0x1b')]);_0x3b64c7['offset']=qs[_0xa076('0x1a')](_0x5d08be[_0xa076('0x2c')]['offset']);}_0x3b64c7['order']=qs[_0xa076('0x33')](_0x5d08be[_0xa076('0x2c')][_0xa076('0x33')]);_0x3b64c7[_0xa076('0x34')]=qs[_0xa076('0x2e')](_['pick'](_0x5d08be[_0xa076('0x2c')],_0x35832d[_0xa076('0x2e')]),_0x152dbb);if(_0x5d08be[_0xa076('0x2c')]['filter']){_0x3b64c7[_0xa076('0x34')]=_['merge'](_0x3b64c7[_0xa076('0x34')],{'$or':_[_0xa076('0x35')](_0x152dbb,function(_0x18af2d){if(_0x18af2d['type']!==_0xa076('0x36')){var _0x506287={};_0x506287[_0x18af2d['name']]={'$like':'%'+_0x5d08be[_0xa076('0x2c')][_0xa076('0x37')]+'%'};return _0x506287;}})});}_0x3b64c7=_[_0xa076('0x38')]({},_0x3b64c7,_0x5d08be[_0xa076('0x39')]);var _0x2bfdd1={'where':_0x3b64c7[_0xa076('0x34')]};return db[_0xa076('0x27')][_0xa076('0x1d')](_0x2bfdd1)[_0xa076('0x3a')](function(_0x51667b){_0x374519[_0xa076('0x1d')]=_0x51667b;if(_0x5d08be[_0xa076('0x2c')]['includeAll']){_0x3b64c7[_0xa076('0x3b')]=[{'all':!![]}];}return db[_0xa076('0x27')][_0xa076('0x3c')](_0x3b64c7);})[_0xa076('0x3a')](function(_0x43ff1){_0x374519[_0xa076('0x3d')]=_0x43ff1;return _0x374519;})[_0xa076('0x3a')](respondWithFilteredResult(_0x18ed85,_0x3b64c7))[_0xa076('0x3e')](handleError(_0x18ed85,null));};exports[_0xa076('0x3f')]=function(_0x544af4,_0x4bc7f4){var _0x41f7f9={'raw':!![],'where':{'id':_0x544af4[_0xa076('0x40')]['id']}},_0x3259cb={};_0x3259cb[_0xa076('0x2b')]=_[_0xa076('0x2d')](db['VoiceDialReport'][_0xa076('0x28')]);_0x3259cb[_0xa076('0x2c')]=_['keys'](_0x544af4[_0xa076('0x2c')]);_0x3259cb['filters']=_[_0xa076('0x41')](_0x3259cb[_0xa076('0x2b')],_0x3259cb['query']);_0x41f7f9[_0xa076('0x2f')]=_[_0xa076('0x41')](_0x3259cb['model'],qs['fields'](_0x544af4[_0xa076('0x2c')][_0xa076('0x30')]));_0x41f7f9['attributes']=_0x41f7f9['attributes'][_0xa076('0x42')]?_0x41f7f9[_0xa076('0x2f')]:_0x3259cb[_0xa076('0x2b')];if(_0x544af4[_0xa076('0x2c')][_0xa076('0x43')]){_0x41f7f9[_0xa076('0x3b')]=[{'all':!![]}];}_0x41f7f9=_['merge']({},_0x41f7f9,_0x544af4[_0xa076('0x39')]);return db['VoiceDialReport'][_0xa076('0x44')](_0x41f7f9)['then'](handleEntityNotFound(_0x4bc7f4,null))[_0xa076('0x3a')](respondWithResult(_0x4bc7f4,null))['catch'](handleError(_0x4bc7f4,null));};exports[_0xa076('0x45')]=function(_0x2f0ba5,_0x568817){return db[_0xa076('0x27')][_0xa076('0x45')](_0x2f0ba5[_0xa076('0x46')],{})[_0xa076('0x3a')](respondWithResult(_0x568817,0xc9))['catch'](handleError(_0x568817,null));};exports[_0xa076('0x47')]=function(_0x56f7ad,_0x2e065a){if(_0x56f7ad[_0xa076('0x46')]['id']){delete _0x56f7ad[_0xa076('0x46')]['id'];}return db['VoiceDialReport'][_0xa076('0x44')]({'where':{'id':_0x56f7ad[_0xa076('0x40')]['id']}})[_0xa076('0x3a')](handleEntityNotFound(_0x2e065a,null))['then'](saveUpdates(_0x56f7ad[_0xa076('0x46')],null))[_0xa076('0x3a')](respondWithResult(_0x2e065a,null))[_0xa076('0x3e')](handleError(_0x2e065a,null));};exports[_0xa076('0x21')]=function(_0x4a910d,_0x50866c){return db[_0xa076('0x27')][_0xa076('0x44')]({'where':{'id':_0x4a910d[_0xa076('0x40')]['id']}})[_0xa076('0x3a')](handleEntityNotFound(_0x50866c,null))[_0xa076('0x3a')](removeEntity(_0x50866c,null))['catch'](handleError(_0x50866c,null));};exports['describe']=function(_0x5394ac,_0x51cd48){return db[_0xa076('0x27')][_0xa076('0x48')]()['then'](respondWithResult(_0x51cd48,null))[_0xa076('0x3e')](handleError(_0x51cd48,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index a465d0b..f583a00 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 _0x6f2b=['VoiceDialReport','uniqueid','../../config/logger','api','bluebird','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define'];(function(_0x1f6f84,_0x2bab55){var _0x177f40=function(_0x384ab4){while(--_0x384ab4){_0x1f6f84['push'](_0x1f6f84['shift']());}};_0x177f40(++_0x2bab55);}(_0x6f2b,0x1d8));var _0xb6f2=function(_0x3a6d9c,_0x25539c){_0x3a6d9c=_0x3a6d9c-0x0;var _0x2e00cb=_0x6f2b[_0x3a6d9c];return _0x2e00cb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb6f2('0x0'))(_0xb6f2('0x1'));var moment=require('moment');var BPromise=require(_0xb6f2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb6f2('0x3'));var config=require(_0xb6f2('0x4'));var attributes=require(_0xb6f2('0x5'));module[_0xb6f2('0x6')]=function(_0x24584a,_0x543b7f){return _0x24584a[_0xb6f2('0x7')](_0xb6f2('0x8'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0xb6f2('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x43d3=['bluebird','request-promise','path','rimraf','./voiceDialReport.attributes','define','VoiceDialReport','report_dial','uniqueid','util','../../config/logger','api','moment'];(function(_0x39b1d8,_0xd5e4d9){var _0x18f8d9=function(_0x58c130){while(--_0x58c130){_0x39b1d8['push'](_0x39b1d8['shift']());}};_0x18f8d9(++_0xd5e4d9);}(_0x43d3,0x182));var _0x343d=function(_0x35a504,_0xc3cc24){_0x35a504=_0x35a504-0x0;var _0x5b0824=_0x43d3[_0x35a504];return _0x5b0824;};'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':[{'fields':[_0x343d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 37171a4..1577dfd 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 _0xebb5=['request','then','info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceDialReport,\x20%s,\x20%s','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','UpdateVoiceDialReport','update','raw','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2134b7,_0x1eb5e2){var _0x6c5914=function(_0x1da201){while(--_0x1da201){_0x2134b7['push'](_0x2134b7['shift']());}};_0x6c5914(++_0x1eb5e2);}(_0xebb5,0xcf));var _0x5ebb=function(_0x240624,_0x342c19){_0x240624=_0x240624-0x0;var _0x2aefab=_0xebb5[_0x240624];return _0x2aefab;};'use strict';var _=require(_0x5ebb('0x0'));var util=require(_0x5ebb('0x1'));var moment=require(_0x5ebb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5ebb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5ebb('0x4'));var logger=require(_0x5ebb('0x5'))(_0x5ebb('0x6'));var config=require(_0x5ebb('0x7'));var jayson=require(_0x5ebb('0x8'));var client=jayson[_0x5ebb('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a5cef,_0x5600d1,_0x29ce45){return new BPromise(function(_0x4a4635,_0x261f70){return client[_0x5ebb('0xa')](_0x5a5cef,_0x29ce45)[_0x5ebb('0xb')](function(_0x368123){logger[_0x5ebb('0xc')]('VoiceDialReport,\x20%s,\x20%s',_0x5600d1,_0x5ebb('0xd'));logger[_0x5ebb('0xe')](_0x5ebb('0xf'),_0x5600d1,_0x5ebb('0xd'),JSON[_0x5ebb('0x10')](_0x368123));if(_0x368123[_0x5ebb('0x11')]){if(_0x368123[_0x5ebb('0x11')][_0x5ebb('0x12')]===0x1f4){logger[_0x5ebb('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x5600d1,_0x368123[_0x5ebb('0x11')][_0x5ebb('0x13')]);return _0x261f70(_0x368123[_0x5ebb('0x11')][_0x5ebb('0x13')]);}logger['error'](_0x5ebb('0x14'),_0x5600d1,_0x368123[_0x5ebb('0x11')][_0x5ebb('0x13')]);return _0x4a4635(_0x368123[_0x5ebb('0x11')]['message']);}else{logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x5600d1,_0x5ebb('0xd'));_0x4a4635(_0x368123[_0x5ebb('0x15')][_0x5ebb('0x13')]);}})[_0x5ebb('0x16')](function(_0x5952d8){logger[_0x5ebb('0x11')](_0x5ebb('0x14'),_0x5600d1,_0x5952d8);_0x261f70(_0x5952d8);});});}exports[_0x5ebb('0x17')]=function(_0x3e21d3){var _0x374cb9=this;return new Promise(function(_0x548b25,_0x8b5003){return db[_0x5ebb('0x18')][_0x5ebb('0x19')](_0x3e21d3[_0x5ebb('0x1a')],{'raw':_0x3e21d3['options']?_0x3e21d3[_0x5ebb('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x5ebb('0xb')](function(_0x5cecda){logger[_0x5ebb('0xc')]('CreateVoiceDialReport',_0x3e21d3);logger[_0x5ebb('0xe')](_0x5ebb('0x17'),_0x3e21d3,JSON[_0x5ebb('0x10')](_0x5cecda));_0x548b25(_0x5cecda);})[_0x5ebb('0x16')](function(_0x51b7a2){logger['error'](_0x5ebb('0x17'),_0x51b7a2['message'],_0x3e21d3);_0x8b5003(_0x374cb9[_0x5ebb('0x11')](0x1f4,_0x51b7a2[_0x5ebb('0x13')]));});});};exports[_0x5ebb('0x1c')]=function(_0x4c524c){var _0xd2044=this;return new Promise(function(_0x4e986b,_0x3bcf47){return db['VoiceDialReport'][_0x5ebb('0x1d')](_0x4c524c['body'],{'raw':_0x4c524c[_0x5ebb('0x1b')]?_0x4c524c[_0x5ebb('0x1b')][_0x5ebb('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c524c[_0x5ebb('0x1b')]?_0x4c524c[_0x5ebb('0x1b')]['where']||null:null,'attributes':_0x4c524c[_0x5ebb('0x1b')]?_0x4c524c[_0x5ebb('0x1b')]['attributes']||null:null,'limit':_0x4c524c[_0x5ebb('0x1b')]?_0x4c524c[_0x5ebb('0x1b')]['limit']||null:null})['then'](function(_0x118ac5){logger['info']('UpdateVoiceDialReport',_0x4c524c);logger['debug'](_0x5ebb('0x1c'),_0x4c524c,JSON['stringify'](_0x118ac5));_0x4e986b(_0x118ac5);})['catch'](function(_0x5651be){logger[_0x5ebb('0x11')]('UpdateVoiceDialReport',_0x5651be[_0x5ebb('0x13')],_0x4c524c);_0x3bcf47(_0xd2044[_0x5ebb('0x11')](0x1f4,_0x5651be[_0x5ebb('0x13')]));});});}; \ No newline at end of file +var _0xd5fb=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateVoiceDialReport','VoiceDialReport','body','options','raw','debug','stringify','UpdateVoiceDialReport','update','where','limit','bluebird','randomstring'];(function(_0x4f0fd2,_0x1c9fe7){var _0x138371=function(_0x3243ab){while(--_0x3243ab){_0x4f0fd2['push'](_0x4f0fd2['shift']());}};_0x138371(++_0x1c9fe7);}(_0xd5fb,0x76));var _0xbd5f=function(_0x2382b7,_0x271ef2){_0x2382b7=_0x2382b7-0x0;var _0x4ea157=_0xd5fb[_0x2382b7];return _0x4ea157;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xbd5f('0x0'));var rs=require(_0xbd5f('0x1'));var fs=require('fs');var Redis=require(_0xbd5f('0x2'));var db=require(_0xbd5f('0x3'))['db'];var utils=require(_0xbd5f('0x4'));var logger=require('../../config/logger')(_0xbd5f('0x5'));var config=require(_0xbd5f('0x6'));var jayson=require(_0xbd5f('0x7'));var client=jayson['client'][_0xbd5f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x522eff,_0x230756,_0x54efa1){return new BPromise(function(_0x303b97,_0x125902){return client[_0xbd5f('0x9')](_0x522eff,_0x54efa1)[_0xbd5f('0xa')](function(_0x865d51){logger[_0xbd5f('0xb')](_0xbd5f('0xc'),_0x230756,_0xbd5f('0xd'));logger['debug'](_0xbd5f('0xe'),_0x230756,_0xbd5f('0xd'),JSON['stringify'](_0x865d51));if(_0x865d51[_0xbd5f('0xf')]){if(_0x865d51[_0xbd5f('0xf')]['code']===0x1f4){logger['error'](_0xbd5f('0xc'),_0x230756,_0x865d51[_0xbd5f('0xf')]['message']);return _0x125902(_0x865d51[_0xbd5f('0xf')]['message']);}logger['error'](_0xbd5f('0xc'),_0x230756,_0x865d51['error'][_0xbd5f('0x10')]);return _0x303b97(_0x865d51[_0xbd5f('0xf')][_0xbd5f('0x10')]);}else{logger[_0xbd5f('0xb')](_0xbd5f('0xc'),_0x230756,_0xbd5f('0xd'));_0x303b97(_0x865d51[_0xbd5f('0x11')][_0xbd5f('0x10')]);}})[_0xbd5f('0x12')](function(_0x56f993){logger[_0xbd5f('0xf')](_0xbd5f('0xc'),_0x230756,_0x56f993);_0x125902(_0x56f993);});});}exports[_0xbd5f('0x13')]=function(_0x5f36b3){var _0x4281ab=this;return new Promise(function(_0x7dae52,_0x5ad7fd){return db[_0xbd5f('0x14')]['create'](_0x5f36b3[_0xbd5f('0x15')],{'raw':_0x5f36b3[_0xbd5f('0x16')]?_0x5f36b3[_0xbd5f('0x16')][_0xbd5f('0x17')]===undefined?!![]:![]:!![]})[_0xbd5f('0xa')](function(_0x12277e){logger[_0xbd5f('0xb')](_0xbd5f('0x13'),_0x5f36b3);logger[_0xbd5f('0x18')](_0xbd5f('0x13'),_0x5f36b3,JSON[_0xbd5f('0x19')](_0x12277e));_0x7dae52(_0x12277e);})[_0xbd5f('0x12')](function(_0x3411ae){logger[_0xbd5f('0xf')](_0xbd5f('0x13'),_0x3411ae[_0xbd5f('0x10')],_0x5f36b3);_0x5ad7fd(_0x4281ab[_0xbd5f('0xf')](0x1f4,_0x3411ae[_0xbd5f('0x10')]));});});};exports[_0xbd5f('0x1a')]=function(_0x187206){var _0x518423=this;return new Promise(function(_0x2d9f88,_0x2fcd37){return db[_0xbd5f('0x14')][_0xbd5f('0x1b')](_0x187206['body'],{'raw':_0x187206[_0xbd5f('0x16')]?_0x187206[_0xbd5f('0x16')][_0xbd5f('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x187206[_0xbd5f('0x16')]?_0x187206[_0xbd5f('0x16')][_0xbd5f('0x1c')]||null:null,'attributes':_0x187206[_0xbd5f('0x16')]?_0x187206[_0xbd5f('0x16')]['attributes']||null:null,'limit':_0x187206['options']?_0x187206[_0xbd5f('0x16')][_0xbd5f('0x1d')]||null:null})[_0xbd5f('0xa')](function(_0x27daa1){logger[_0xbd5f('0xb')](_0xbd5f('0x1a'),_0x187206);logger[_0xbd5f('0x18')](_0xbd5f('0x1a'),_0x187206,JSON[_0xbd5f('0x19')](_0x27daa1));_0x2d9f88(_0x27daa1);})[_0xbd5f('0x12')](function(_0x2fc0fa){logger[_0xbd5f('0xf')](_0xbd5f('0x1a'),_0x2fc0fa[_0xbd5f('0x10')],_0x187206);_0x2fcd37(_0x518423['error'](0x1f4,_0x2fc0fa[_0xbd5f('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 2410fc6..95cd36c 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 _0xda34=['show','create','post','/:id/applications','put','update','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','/:id'];(function(_0x934577,_0x7d872c){var _0x1b0e5c=function(_0x225bce){while(--_0x225bce){_0x934577['push'](_0x934577['shift']());}};_0x1b0e5c(++_0x7d872c);}(_0xda34,0x128));var _0x4da3=function(_0x4a67eb,_0x431aab){_0x4a67eb=_0x4a67eb-0x0;var _0x1fe03b=_0xda34[_0x4a67eb];return _0x1fe03b;};'use strict';var multer=require('multer');var util=require(_0x4da3('0x0'));var path=require('path');var timeout=require(_0x4da3('0x1'));var express=require('express');var router=express[_0x4da3('0x2')]();var fs_extra=require(_0x4da3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x4da3('0x4'));var config=require(_0x4da3('0x5'));var controller=require(_0x4da3('0x6'));router[_0x4da3('0x7')]('/',auth[_0x4da3('0x8')](),controller['index']);router[_0x4da3('0x7')](_0x4da3('0x9'),auth['isAuthenticated'](),controller[_0x4da3('0xa')]);router['post']('/',auth[_0x4da3('0x8')](),controller[_0x4da3('0xb')]);router[_0x4da3('0xc')](_0x4da3('0xd'),auth[_0x4da3('0x8')](),controller['addApplications']);router[_0x4da3('0xe')](_0x4da3('0x9'),auth[_0x4da3('0x8')](),controller[_0x4da3('0xf')]);router['delete'](_0x4da3('0x9'),auth['isAuthenticated'](),controller[_0x4da3('0x10')]);module[_0x4da3('0x11')]=router; \ No newline at end of file +var _0xf9d7=['/:id','isAuthenticated','post','/:id/applications','addApplications','put','update','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceExtension.controller','index'];(function(_0x384447,_0x41669a){var _0x3810db=function(_0x3f1288){while(--_0x3f1288){_0x384447['push'](_0x384447['shift']());}};_0x3810db(++_0x41669a);}(_0xf9d7,0x1ee));var _0x7f9d=function(_0xfcfc35,_0x41125e){_0xfcfc35=_0xfcfc35-0x0;var _0x13a3c7=_0xf9d7[_0xfcfc35];return _0x13a3c7;};'use strict';var multer=require(_0x7f9d('0x0'));var util=require(_0x7f9d('0x1'));var path=require(_0x7f9d('0x2'));var timeout=require(_0x7f9d('0x3'));var express=require('express');var router=express[_0x7f9d('0x4')]();var fs_extra=require(_0x7f9d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7f9d('0x6'));var config=require(_0x7f9d('0x7'));var controller=require(_0x7f9d('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x7f9d('0x9')]);router['get'](_0x7f9d('0xa'),auth[_0x7f9d('0xb')](),controller['show']);router[_0x7f9d('0xc')]('/',auth[_0x7f9d('0xb')](),controller['create']);router[_0x7f9d('0xc')](_0x7f9d('0xd'),auth[_0x7f9d('0xb')](),controller[_0x7f9d('0xe')]);router[_0x7f9d('0xf')](_0x7f9d('0xa'),auth[_0x7f9d('0xb')](),controller[_0x7f9d('0x10')]);router['delete'](_0x7f9d('0xa'),auth['isAuthenticated'](),controller[_0x7f9d('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 4ba0d36..acd3ab0 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 _0x0ef6=['BOOLEAN','wav','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER'];(function(_0xdebcd1,_0x33ca78){var _0x580d23=function(_0x21d7c6){while(--_0x21d7c6){_0xdebcd1['push'](_0xdebcd1['shift']());}};_0x580d23(++_0x33ca78);}(_0x0ef6,0x152));var _0x60ef=function(_0x358ae0,_0x1a3dcb){_0x358ae0=_0x358ae0-0x0;var _0xf0e8a5=_0x0ef6[_0x358ae0];return _0xf0e8a5;};'use strict';var Sequelize=require(_0x60ef('0x0'));module[_0x60ef('0x1')]={'context':{'type':Sequelize[_0x60ef('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x60ef('0x2')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x60ef('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x60ef('0x3')},'tag':{'type':Sequelize[_0x60ef('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x60ef('0x2')],'allowNull':![],'defaultValue':_0x60ef('0x4')},'appdata':{'type':Sequelize[_0x60ef('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x60ef('0x5')](_0x60ef('0x6'),'outbound',_0x60ef('0x7'),_0x60ef('0x8'),_0x60ef('0x9'),_0x60ef('0xa'),_0x60ef('0xb')),'allowNull':![]},'description':{'type':Sequelize[_0x60ef('0x2')]},'interval':{'type':Sequelize[_0x60ef('0x2')],'allowNull':![],'defaultValue':_0x60ef('0xc')},'IntervalId':{'type':Sequelize[_0x60ef('0xd')]},'isApp':{'type':Sequelize[_0x60ef('0xe')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x60ef('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x60ef('0xe')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x60ef('0xd')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x60ef('0xf')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5982d7){return this['getDataValue']('exten');}},'alias':{'type':Sequelize[_0x60ef('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x51b3=['inbound-fax','outbound-fax','system','any','*,*,*,*','BOOLEAN','INTEGER','wav','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal'];(function(_0x312767,_0x422b2e){var _0x516362=function(_0x5a734c){while(--_0x5a734c){_0x312767['push'](_0x312767['shift']());}};_0x516362(++_0x422b2e);}(_0x51b3,0x160));var _0x351b=function(_0x472e60,_0x520908){_0x472e60=_0x472e60-0x0;var _0x5018cd=_0x51b3[_0x472e60];return _0x5018cd;};'use strict';var Sequelize=require(_0x351b('0x0'));module[_0x351b('0x1')]={'context':{'type':Sequelize[_0x351b('0x2')],'allowNull':![],'unique':_0x351b('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x351b('0x2')],'allowNull':![],'unique':_0x351b('0x3')},'priority':{'type':Sequelize[_0x351b('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x351b('0x3')},'tag':{'type':Sequelize[_0x351b('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x351b('0x2')],'allowNull':![],'defaultValue':_0x351b('0x4')},'appdata':{'type':Sequelize[_0x351b('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x351b('0x5')](_0x351b('0x6'),_0x351b('0x7'),_0x351b('0x8'),_0x351b('0x9'),_0x351b('0xa'),_0x351b('0xb'),_0x351b('0xc')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x351b('0x2')],'allowNull':![],'defaultValue':_0x351b('0xd')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0x351b('0xe')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x351b('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x351b('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x351b('0xe')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x351b('0xf')]},'recordingFormat':{'type':Sequelize[_0x351b('0x2')],'defaultValue':_0x351b('0x10')},'answer':{'type':Sequelize[_0x351b('0xe')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0xc5c426){return this[_0x351b('0x11')](_0x351b('0x12'));}},'alias':{'type':Sequelize[_0x351b('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index de952d6..6c17d2e 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 _0x6afc=['role','get','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','context','description','recordingFormat','cutdigits','mandatoryDisposition','addApplications','sequelize','transaction','READ_COMMITTED','VoiceExtensionId','isApp','createRouting','bulkCreate','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','then','InboundRoutes','inbound','OutboundRoutes','InternalRoutes','internal','filter','ignore','map','value','type','UserProfileResource','destroy','end','stack','name','send','index','VoiceExtension','fieldName','model','query','keys','filters','intersection','fields','length','attributes','nolimit','order','sort','where','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','outbound','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x506d83,_0x1899e9){var _0x335e8b=function(_0x4a7044){while(--_0x4a7044){_0x506d83['push'](_0x506d83['shift']());}};_0x335e8b(++_0x1899e9);}(_0x6afc,0x190));var _0xc6af=function(_0x209c36,_0x23b1ad){_0x209c36=_0x209c36-0x0;var _0x4299ac=_0x6afc[_0x209c36];return _0x4299ac;};'use strict';var _=require(_0xc6af('0x0'));var Redis=require(_0xc6af('0x1'));var qs=require(_0xc6af('0x2'));var logger=require(_0xc6af('0x3'))(_0xc6af('0x4'));var config=require(_0xc6af('0x5'));var db=require(_0xc6af('0x6'))['db'];config[_0xc6af('0x7')]=_[_0xc6af('0x8')](config[_0xc6af('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xc6af('0x9'))(new Redis(config[_0xc6af('0x7')]));require('./voiceExtension.socket')[_0xc6af('0xa')](socket);function respondWithStatusCode(_0x3e50c8,_0x3c1b46){_0x3c1b46=_0x3c1b46||0xcc;return function(_0x466bb1){if(_0x466bb1){return _0x3e50c8[_0xc6af('0xb')](_0x3c1b46);}return _0x3e50c8[_0xc6af('0xc')](_0x3c1b46)['end']();};}function respondWithResult(_0x532990,_0x2ede65){_0x2ede65=_0x2ede65||0xc8;return function(_0x78b0c7){if(_0x78b0c7){return _0x532990[_0xc6af('0xc')](_0x2ede65)[_0xc6af('0xd')](_0x78b0c7);}};}function respondWithFilteredResult(_0x435f38,_0x4c1930){return function(_0x3932fc){if(_0x3932fc){var _0x1f1cd2=typeof _0x4c1930[_0xc6af('0xe')]===_0xc6af('0xf')&&typeof _0x4c1930[_0xc6af('0x10')]===_0xc6af('0xf');var _0x230890=_0x3932fc['count'];var _0x560598=_0x1f1cd2?0x0:_0x4c1930[_0xc6af('0xe')];var _0x432f4d=_0x1f1cd2?_0x3932fc[_0xc6af('0x11')]:_0x4c1930[_0xc6af('0xe')]+_0x4c1930[_0xc6af('0x10')];var _0x148694;if(_0x432f4d>=_0x230890){_0x432f4d=_0x230890;_0x148694=0xc8;}else{_0x148694=0xce;}_0x435f38['status'](_0x148694);return _0x435f38[_0xc6af('0x12')](_0xc6af('0x13'),_0x560598+'-'+_0x432f4d+'/'+_0x230890)[_0xc6af('0xd')](_0x3932fc);}return null;};}function removeEntity(_0x3bf279){return function(_0x476499){if(_0x476499){return _0x476499['destroy']()[_0xc6af('0x14')](function(){var _0x3027bc=_0x476499['get']({'plain':!![]});var _0x57da79=[{'name':_0xc6af('0x15'),'value':_0xc6af('0x16'),'ignore':![]},{'name':_0xc6af('0x17'),'value':'outbound','ignore':![]},{'name':_0xc6af('0x18'),'value':_0xc6af('0x19'),'ignore':![]}];var _0x432725=_(_0x57da79)[_0xc6af('0x1a')](_0xc6af('0x1b'))[_0xc6af('0x1c')]('value')[_0xc6af('0x1d')]();if(_['includes'](_0x432725,_0x3027bc[_0xc6af('0x1e')])){return;}var _0x66ae8c=_['find'](_0x57da79,[_0xc6af('0x1d'),_0x3027bc['type']])['name'];return db[_0xc6af('0x1f')][_0xc6af('0x20')]({'where':{'type':_0x66ae8c,'resourceId':_0x3027bc['id']}})[_0xc6af('0x14')](function(){return _0x476499;});})[_0xc6af('0x14')](function(){_0x3bf279[_0xc6af('0xc')](0xcc)[_0xc6af('0x21')]();});}};}function handleEntityNotFound(_0x27c4f3){return function(_0x4f55ef){if(!_0x4f55ef){_0x27c4f3[_0xc6af('0xb')](0x194);}return _0x4f55ef;};}function handleError(_0x9863fa,_0x5a99f2){_0x5a99f2=_0x5a99f2||0x1f4;return function(_0x361665){logger['error'](_0x361665[_0xc6af('0x22')]);if(_0x361665['name']){delete _0x361665[_0xc6af('0x23')];}_0x9863fa['status'](_0x5a99f2)[_0xc6af('0x24')](_0x361665);};}exports[_0xc6af('0x25')]=function(_0x5e4d1e,_0x580f90){var _0xad6efa={},_0x5f4514={},_0x246c02={'count':0x0,'rows':[]};var _0x2a02cf=_[_0xc6af('0x1c')](db[_0xc6af('0x26')]['rawAttributes'],function(_0x42be5a){return{'name':_0x42be5a[_0xc6af('0x27')],'type':_0x42be5a[_0xc6af('0x1e')]['key']};});_0x5f4514[_0xc6af('0x28')]=_[_0xc6af('0x1c')](_0x2a02cf,'name');_0x5f4514[_0xc6af('0x29')]=_[_0xc6af('0x2a')](_0x5e4d1e['query']);_0x5f4514[_0xc6af('0x2b')]=_[_0xc6af('0x2c')](_0x5f4514[_0xc6af('0x28')],_0x5f4514['query']);_0xad6efa['attributes']=_['intersection'](_0x5f4514[_0xc6af('0x28')],qs[_0xc6af('0x2d')](_0x5e4d1e[_0xc6af('0x29')]['fields']));_0xad6efa['attributes']=_0xad6efa['attributes'][_0xc6af('0x2e')]?_0xad6efa[_0xc6af('0x2f')]:_0x5f4514['model'];if(!_0x5e4d1e[_0xc6af('0x29')]['hasOwnProperty'](_0xc6af('0x30'))){_0xad6efa[_0xc6af('0x10')]=qs[_0xc6af('0x10')](_0x5e4d1e[_0xc6af('0x29')][_0xc6af('0x10')]);_0xad6efa[_0xc6af('0xe')]=qs['offset'](_0x5e4d1e[_0xc6af('0x29')]['offset']);}_0xad6efa[_0xc6af('0x31')]=qs['sort'](_0x5e4d1e[_0xc6af('0x29')][_0xc6af('0x32')]);_0xad6efa[_0xc6af('0x33')]=qs[_0xc6af('0x2b')](_['pick'](_0x5e4d1e[_0xc6af('0x29')],_0x5f4514[_0xc6af('0x2b')]),_0x2a02cf);if(_0x5e4d1e['query'][_0xc6af('0x1a')]){_0xad6efa[_0xc6af('0x33')]=_[_0xc6af('0x34')](_0xad6efa['where'],{'$or':_[_0xc6af('0x1c')](_0x2a02cf,function(_0x2d9da5){if(_0x2d9da5[_0xc6af('0x1e')]!=='VIRTUAL'){var _0x1fa5c9={};_0x1fa5c9[_0x2d9da5['name']]={'$like':'%'+_0x5e4d1e[_0xc6af('0x29')][_0xc6af('0x1a')]+'%'};return _0x1fa5c9;}})});}_0xad6efa=_[_0xc6af('0x34')]({},_0xad6efa,_0x5e4d1e[_0xc6af('0x35')]);var _0x1aeb65={'where':_0xad6efa[_0xc6af('0x33')]};return db['VoiceExtension'][_0xc6af('0x11')](_0x1aeb65)[_0xc6af('0x14')](function(_0x425254){_0x246c02[_0xc6af('0x11')]=_0x425254;if(_0x5e4d1e[_0xc6af('0x29')]['includeAll']){_0xad6efa[_0xc6af('0x36')]=[{'all':!![]}];}return db[_0xc6af('0x26')][_0xc6af('0x37')](_0xad6efa);})[_0xc6af('0x14')](function(_0x3ffa76){_0x246c02[_0xc6af('0x38')]=_0x3ffa76;return _0x246c02;})[_0xc6af('0x14')](respondWithFilteredResult(_0x580f90,_0xad6efa))[_0xc6af('0x39')](handleError(_0x580f90,null));};exports[_0xc6af('0x3a')]=function(_0x26401d,_0x2f5531){var _0x299b9b={'raw':![],'where':{'id':_0x26401d[_0xc6af('0x3b')]['id']}},_0x7430ad={};_0x7430ad[_0xc6af('0x28')]=_['keys'](db[_0xc6af('0x26')]['rawAttributes']);_0x7430ad[_0xc6af('0x29')]=_[_0xc6af('0x2a')](_0x26401d[_0xc6af('0x29')]);_0x7430ad['filters']=_['intersection'](_0x7430ad['model'],_0x7430ad['query']);_0x299b9b[_0xc6af('0x2f')]=_[_0xc6af('0x2c')](_0x7430ad[_0xc6af('0x28')],qs[_0xc6af('0x2d')](_0x26401d[_0xc6af('0x29')]['fields']));_0x299b9b['attributes']=_0x299b9b[_0xc6af('0x2f')][_0xc6af('0x2e')]?_0x299b9b['attributes']:_0x7430ad[_0xc6af('0x28')];if(_0x26401d[_0xc6af('0x29')][_0xc6af('0x3c')]){_0x299b9b[_0xc6af('0x36')]=[{'all':!![]}];}_0x299b9b=_[_0xc6af('0x34')]({},_0x299b9b,_0x26401d['options']);return db[_0xc6af('0x26')][_0xc6af('0x3d')](_0x299b9b)[_0xc6af('0x14')](handleEntityNotFound(_0x2f5531,null))[_0xc6af('0x14')](respondWithResult(_0x2f5531,null))[_0xc6af('0x39')](handleError(_0x2f5531,null));};exports[_0xc6af('0x20')]=function(_0x34df7a,_0xf4f226){return db['VoiceExtension'][_0xc6af('0x3d')]({'where':{'id':_0x34df7a['params']['id']}})[_0xc6af('0x14')](handleEntityNotFound(_0xf4f226,null))[_0xc6af('0x14')](removeEntity(_0xf4f226,null))[_0xc6af('0x39')](handleError(_0xf4f226,null));};exports[_0xc6af('0x3e')]=function(_0x41eed5,_0x14f200){if(_0x41eed5[_0xc6af('0x3f')]['type']===_0xc6af('0x40')&&!_[_0xc6af('0x41')](_0x41eed5[_0xc6af('0x3f')][_0xc6af('0x42')],'_')){_0x41eed5[_0xc6af('0x3f')]['exten']='_'[_0xc6af('0x43')](_0x41eed5['body'][_0xc6af('0x42')]);}return db[_0xc6af('0x26')][_0xc6af('0x3e')](_0x41eed5[_0xc6af('0x3f')],{'raw':![]})[_0xc6af('0x14')](function(_0x22e551){var _0xbb5b28=_0x41eed5[_0xc6af('0x44')]['get']({'plain':!![]});if(!_0xbb5b28)throw new Error(_0xc6af('0x45'));if(_0xbb5b28[_0xc6af('0x46')]===_0xc6af('0x44')){var _0x5ce8a4=_0x22e551[_0xc6af('0x47')]({'plain':!![]});var _0x126793=[{'name':_0xc6af('0x15'),'value':'inbound'},{'name':_0xc6af('0x17'),'value':'outbound'},{'name':_0xc6af('0x18'),'value':_0xc6af('0x19')}];var _0x54e20c=_[_0xc6af('0x3d')](_0x126793,[_0xc6af('0x1d'),_0x5ce8a4[_0xc6af('0x1e')]])[_0xc6af('0x23')];return db[_0xc6af('0x48')][_0xc6af('0x3d')]({'where':{'name':_0x54e20c,'userProfileId':_0xbb5b28[_0xc6af('0x49')]},'raw':!![]})['then'](function(_0x54499d){if(_0x54499d&&_0x54499d[_0xc6af('0x4a')]===0x0){return db[_0xc6af('0x1f')]['create']({'name':_0x5ce8a4['name'],'resourceId':_0x5ce8a4['id'],'type':_0x54499d[_0xc6af('0x23')],'sectionId':_0x54499d['id']},{})[_0xc6af('0x14')](function(){return _0x22e551;});}else{return _0x22e551;}})[_0xc6af('0x39')](function(_0x4bc4c7){logger[_0xc6af('0x4b')](_0xc6af('0x4c'),_0x4bc4c7);throw _0x4bc4c7;});}return _0x22e551;})['then'](respondWithResult(_0x14f200,0xc9))[_0xc6af('0x39')](handleError(_0x14f200,null));};exports[_0xc6af('0x4d')]=function(_0xc6623b,_0x24c56b){if(_0xc6623b['body']['id']){delete _0xc6623b['body']['id'];}return db[_0xc6af('0x26')][_0xc6af('0x3d')]({'where':{'id':_0xc6623b[_0xc6af('0x3b')]['id']}})[_0xc6af('0x14')](handleEntityNotFound(_0x24c56b,null))[_0xc6af('0x14')](function(_0x81a1f3){if(_0x81a1f3){return db[_0xc6af('0x26')][_0xc6af('0x4d')](_[_0xc6af('0x4e')](_0xc6623b[_0xc6af('0x3f')],['exten',_0xc6af('0x4f'),_0xc6af('0x50'),_0xc6af('0x51'),_0xc6af('0x52'),_0xc6af('0x53'),'alias']),{'where':{'context':_0x81a1f3[_0xc6af('0x4f')],'exten':_0x81a1f3[_0xc6af('0x42')]},'individualHooks':!![]})[_0xc6af('0x14')](function(_0x1c9fbe){return _0x1c9fbe;});}return null;})[_0xc6af('0x14')](respondWithStatusCode(_0x24c56b,null))[_0xc6af('0x39')](handleError(_0x24c56b,null));};exports[_0xc6af('0x54')]=function(_0x109e93,_0xbfa1c){var _0x102ce8=_0x109e93['params']['id'];var _0x58877f=_0x109e93['body'];var _0x2278d9=0xc8;var _0x2bf7c5=null;return db[_0xc6af('0x55')][_0xc6af('0x56')]({'isolationLevel':db['sequelize']['Transaction']['ISOLATION_LEVELS'][_0xc6af('0x57')]},function(_0x3709fc){return db['VoiceExtension']['findOne']({'where':{'id':_0x102ce8},'transaction':_0x3709fc})[_0xc6af('0x14')](function(_0x36ddb4){if(_0x36ddb4){return db[_0xc6af('0x26')][_0xc6af('0x20')]({'where':{'VoiceExtensionId':_0x102ce8},'transaction':_0x3709fc})['then'](function(){var _0x108723=_[_0xc6af('0x1c')](_0x58877f,function(_0x4fd46c){_0x4fd46c[_0xc6af('0x58')]=_0x102ce8;_0x4fd46c[_0xc6af('0x59')]=!![];return _0x4fd46c;});return _0x36ddb4[_0xc6af('0x5a')](_0x108723);})[_0xc6af('0x14')](function(_0x1758e8){return db[_0xc6af('0x26')][_0xc6af('0x5b')](_0x1758e8,{'transaction':_0x3709fc});});}else{_0x2278d9=0x194;_0x2bf7c5=[];}});})[_0xc6af('0x14')](function(){if(_0x2278d9!==0x194){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x102ce8},'order':_0xc6af('0x5c')})['then'](function(_0x189cf1){_0x2bf7c5=_0x189cf1;});}})['catch'](function(_0x2ea189){_0x2278d9=0x1f4;logger[_0xc6af('0x4b')](_0x2ea189[_0xc6af('0x22')]);if(_0x2ea189[_0xc6af('0x23')]){delete _0x2ea189[_0xc6af('0x23')];}_0x2bf7c5=_0x2ea189;})[_0xc6af('0x5d')](function(){if(_0x2bf7c5===null){_0xbfa1c[_0xc6af('0xb')](_0x2278d9);}else{if(_0x2278d9===0x1f4){_0xbfa1c[_0xc6af('0xc')](_0x2278d9)[_0xc6af('0x24')](_0x2bf7c5);}else{_0xbfa1c[_0xc6af('0xc')](_0x2278d9)[_0xc6af('0xd')](_0x2bf7c5);}}});}; \ No newline at end of file +var _0x7ff7=['InboundRoutes','OutboundRoutes','InternalRoutes','filter','ignore','map','value','includes','find','type','UserProfileResource','error','stack','name','send','index','VoiceExtension','rawAttributes','fieldName','key','query','filters','model','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','pick','merge','VIRTUAL','options','where','includeAll','include','findAll','rows','catch','show','params','keys','fields','body','outbound','startsWith','exten','concat','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','inbound','internal','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','recordingFormat','mandatoryDisposition','alias','context','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','VoiceExtensionId','isApp','createRouting','findAndCountAll','cast(priority\x20as\x20unsigned)','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','destroy','then','get'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7ff7,0x10d));var _0x77ff=function(_0xe2bf2e,_0x201571){_0xe2bf2e=_0xe2bf2e-0x0;var _0x6b13fb=_0x7ff7[_0xe2bf2e];return _0x6b13fb;};'use strict';var _=require('lodash');var Redis=require(_0x77ff('0x0'));var qs=require(_0x77ff('0x1'));var logger=require(_0x77ff('0x2'))(_0x77ff('0x3'));var config=require('../../config/environment');var db=require(_0x77ff('0x4'))['db'];config[_0x77ff('0x5')]=_['defaults'](config[_0x77ff('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0x77ff('0x6'))(new Redis(config[_0x77ff('0x5')]));require(_0x77ff('0x7'))[_0x77ff('0x8')](socket);function respondWithStatusCode(_0x1f770b,_0x1067b2){_0x1067b2=_0x1067b2||0xcc;return function(_0x5363ec){if(_0x5363ec){return _0x1f770b[_0x77ff('0x9')](_0x1067b2);}return _0x1f770b[_0x77ff('0xa')](_0x1067b2)[_0x77ff('0xb')]();};}function respondWithResult(_0x2de3a5,_0xb64684){_0xb64684=_0xb64684||0xc8;return function(_0x23b332){if(_0x23b332){return _0x2de3a5['status'](_0xb64684)[_0x77ff('0xc')](_0x23b332);}};}function respondWithFilteredResult(_0x2fce73,_0x3135fe){return function(_0x463dbd){if(_0x463dbd){var _0x2427f1=typeof _0x3135fe['offset']==='undefined'&&typeof _0x3135fe[_0x77ff('0xd')]===_0x77ff('0xe');var _0x2a4a47=_0x463dbd['count'];var _0x284b57=_0x2427f1?0x0:_0x3135fe[_0x77ff('0xf')];var _0xc2fb2f=_0x2427f1?_0x463dbd[_0x77ff('0x10')]:_0x3135fe['offset']+_0x3135fe[_0x77ff('0xd')];var _0x2a2bab;if(_0xc2fb2f>=_0x2a4a47){_0xc2fb2f=_0x2a4a47;_0x2a2bab=0xc8;}else{_0x2a2bab=0xce;}_0x2fce73[_0x77ff('0xa')](_0x2a2bab);return _0x2fce73[_0x77ff('0x11')](_0x77ff('0x12'),_0x284b57+'-'+_0xc2fb2f+'/'+_0x2a4a47)[_0x77ff('0xc')](_0x463dbd);}return null;};}function removeEntity(_0x509991){return function(_0x8c6ea4){if(_0x8c6ea4){return _0x8c6ea4[_0x77ff('0x13')]()[_0x77ff('0x14')](function(){var _0x455457=_0x8c6ea4[_0x77ff('0x15')]({'plain':!![]});var _0x2b9f38=[{'name':_0x77ff('0x16'),'value':'inbound','ignore':![]},{'name':_0x77ff('0x17'),'value':'outbound','ignore':![]},{'name':_0x77ff('0x18'),'value':'internal','ignore':![]}];var _0x492c90=_(_0x2b9f38)[_0x77ff('0x19')](_0x77ff('0x1a'))[_0x77ff('0x1b')](_0x77ff('0x1c'))[_0x77ff('0x1c')]();if(_[_0x77ff('0x1d')](_0x492c90,_0x455457['type'])){return;}var _0x656b01=_[_0x77ff('0x1e')](_0x2b9f38,[_0x77ff('0x1c'),_0x455457[_0x77ff('0x1f')]])['name'];return db[_0x77ff('0x20')][_0x77ff('0x13')]({'where':{'type':_0x656b01,'resourceId':_0x455457['id']}})[_0x77ff('0x14')](function(){return _0x8c6ea4;});})[_0x77ff('0x14')](function(){_0x509991[_0x77ff('0xa')](0xcc)[_0x77ff('0xb')]();});}};}function handleEntityNotFound(_0x53ac85){return function(_0x2da6ed){if(!_0x2da6ed){_0x53ac85[_0x77ff('0x9')](0x194);}return _0x2da6ed;};}function handleError(_0x47bc0a,_0x2f9b6e){_0x2f9b6e=_0x2f9b6e||0x1f4;return function(_0x28fd4b){logger[_0x77ff('0x21')](_0x28fd4b[_0x77ff('0x22')]);if(_0x28fd4b['name']){delete _0x28fd4b[_0x77ff('0x23')];}_0x47bc0a[_0x77ff('0xa')](_0x2f9b6e)[_0x77ff('0x24')](_0x28fd4b);};}exports[_0x77ff('0x25')]=function(_0x3d5b69,_0x58cc1e){var _0x735e25={},_0x172a71={},_0x2a3b84={'count':0x0,'rows':[]};var _0x52bdb5=_['map'](db[_0x77ff('0x26')][_0x77ff('0x27')],function(_0x451e9c){return{'name':_0x451e9c[_0x77ff('0x28')],'type':_0x451e9c[_0x77ff('0x1f')][_0x77ff('0x29')]};});_0x172a71['model']=_[_0x77ff('0x1b')](_0x52bdb5,_0x77ff('0x23'));_0x172a71[_0x77ff('0x2a')]=_['keys'](_0x3d5b69[_0x77ff('0x2a')]);_0x172a71[_0x77ff('0x2b')]=_['intersection'](_0x172a71[_0x77ff('0x2c')],_0x172a71['query']);_0x735e25[_0x77ff('0x2d')]=_[_0x77ff('0x2e')](_0x172a71[_0x77ff('0x2c')],qs['fields'](_0x3d5b69['query']['fields']));_0x735e25[_0x77ff('0x2d')]=_0x735e25[_0x77ff('0x2d')][_0x77ff('0x2f')]?_0x735e25[_0x77ff('0x2d')]:_0x172a71[_0x77ff('0x2c')];if(!_0x3d5b69['query'][_0x77ff('0x30')](_0x77ff('0x31'))){_0x735e25[_0x77ff('0xd')]=qs['limit'](_0x3d5b69['query'][_0x77ff('0xd')]);_0x735e25[_0x77ff('0xf')]=qs[_0x77ff('0xf')](_0x3d5b69['query'][_0x77ff('0xf')]);}_0x735e25[_0x77ff('0x32')]=qs[_0x77ff('0x33')](_0x3d5b69[_0x77ff('0x2a')][_0x77ff('0x33')]);_0x735e25['where']=qs['filters'](_[_0x77ff('0x34')](_0x3d5b69[_0x77ff('0x2a')],_0x172a71['filters']),_0x52bdb5);if(_0x3d5b69[_0x77ff('0x2a')][_0x77ff('0x19')]){_0x735e25['where']=_[_0x77ff('0x35')](_0x735e25['where'],{'$or':_[_0x77ff('0x1b')](_0x52bdb5,function(_0x3d76c3){if(_0x3d76c3[_0x77ff('0x1f')]!==_0x77ff('0x36')){var _0x30cb66={};_0x30cb66[_0x3d76c3[_0x77ff('0x23')]]={'$like':'%'+_0x3d5b69['query'][_0x77ff('0x19')]+'%'};return _0x30cb66;}})});}_0x735e25=_['merge']({},_0x735e25,_0x3d5b69[_0x77ff('0x37')]);var _0x8721da={'where':_0x735e25[_0x77ff('0x38')]};return db[_0x77ff('0x26')][_0x77ff('0x10')](_0x8721da)[_0x77ff('0x14')](function(_0x3d49b4){_0x2a3b84[_0x77ff('0x10')]=_0x3d49b4;if(_0x3d5b69[_0x77ff('0x2a')][_0x77ff('0x39')]){_0x735e25[_0x77ff('0x3a')]=[{'all':!![]}];}return db['VoiceExtension'][_0x77ff('0x3b')](_0x735e25);})[_0x77ff('0x14')](function(_0x3246b8){_0x2a3b84[_0x77ff('0x3c')]=_0x3246b8;return _0x2a3b84;})[_0x77ff('0x14')](respondWithFilteredResult(_0x58cc1e,_0x735e25))[_0x77ff('0x3d')](handleError(_0x58cc1e,null));};exports[_0x77ff('0x3e')]=function(_0x339bbd,_0x1d1ffb){var _0x2666ce={'raw':![],'where':{'id':_0x339bbd[_0x77ff('0x3f')]['id']}},_0x279a6f={};_0x279a6f[_0x77ff('0x2c')]=_[_0x77ff('0x40')](db[_0x77ff('0x26')][_0x77ff('0x27')]);_0x279a6f[_0x77ff('0x2a')]=_[_0x77ff('0x40')](_0x339bbd['query']);_0x279a6f['filters']=_['intersection'](_0x279a6f[_0x77ff('0x2c')],_0x279a6f[_0x77ff('0x2a')]);_0x2666ce['attributes']=_[_0x77ff('0x2e')](_0x279a6f[_0x77ff('0x2c')],qs['fields'](_0x339bbd[_0x77ff('0x2a')][_0x77ff('0x41')]));_0x2666ce[_0x77ff('0x2d')]=_0x2666ce[_0x77ff('0x2d')]['length']?_0x2666ce[_0x77ff('0x2d')]:_0x279a6f['model'];if(_0x339bbd[_0x77ff('0x2a')][_0x77ff('0x39')]){_0x2666ce[_0x77ff('0x3a')]=[{'all':!![]}];}_0x2666ce=_[_0x77ff('0x35')]({},_0x2666ce,_0x339bbd[_0x77ff('0x37')]);return db[_0x77ff('0x26')]['find'](_0x2666ce)[_0x77ff('0x14')](handleEntityNotFound(_0x1d1ffb,null))['then'](respondWithResult(_0x1d1ffb,null))[_0x77ff('0x3d')](handleError(_0x1d1ffb,null));};exports['destroy']=function(_0x5a4c67,_0x3493f6){return db['VoiceExtension'][_0x77ff('0x1e')]({'where':{'id':_0x5a4c67[_0x77ff('0x3f')]['id']}})[_0x77ff('0x14')](handleEntityNotFound(_0x3493f6,null))[_0x77ff('0x14')](removeEntity(_0x3493f6,null))[_0x77ff('0x3d')](handleError(_0x3493f6,null));};exports['create']=function(_0x49f6a8,_0x249b59){if(_0x49f6a8[_0x77ff('0x42')][_0x77ff('0x1f')]===_0x77ff('0x43')&&!_[_0x77ff('0x44')](_0x49f6a8[_0x77ff('0x42')]['exten'],'_')){_0x49f6a8[_0x77ff('0x42')][_0x77ff('0x45')]='_'[_0x77ff('0x46')](_0x49f6a8[_0x77ff('0x42')]['exten']);}return db['VoiceExtension'][_0x77ff('0x47')](_0x49f6a8[_0x77ff('0x42')],{'raw':![]})['then'](function(_0x481fc8){var _0xfad768=_0x49f6a8[_0x77ff('0x48')]['get']({'plain':!![]});if(!_0xfad768)throw new Error(_0x77ff('0x49'));if(_0xfad768[_0x77ff('0x4a')]===_0x77ff('0x48')){var _0x2d71ad=_0x481fc8[_0x77ff('0x15')]({'plain':!![]});var _0x5e0408=[{'name':_0x77ff('0x16'),'value':_0x77ff('0x4b')},{'name':'OutboundRoutes','value':_0x77ff('0x43')},{'name':'InternalRoutes','value':_0x77ff('0x4c')}];var _0x124617=_[_0x77ff('0x1e')](_0x5e0408,[_0x77ff('0x1c'),_0x2d71ad[_0x77ff('0x1f')]])[_0x77ff('0x23')];return db[_0x77ff('0x4d')][_0x77ff('0x1e')]({'where':{'name':_0x124617,'userProfileId':_0xfad768[_0x77ff('0x4e')]},'raw':!![]})[_0x77ff('0x14')](function(_0x43646a){if(_0x43646a&&_0x43646a[_0x77ff('0x4f')]===0x0){return db[_0x77ff('0x20')][_0x77ff('0x47')]({'name':_0x2d71ad[_0x77ff('0x23')],'resourceId':_0x2d71ad['id'],'type':_0x43646a['name'],'sectionId':_0x43646a['id']},{})[_0x77ff('0x14')](function(){return _0x481fc8;});}else{return _0x481fc8;}})[_0x77ff('0x3d')](function(_0x3154df){logger[_0x77ff('0x21')](_0x77ff('0x50'),_0x3154df);throw _0x3154df;});}return _0x481fc8;})[_0x77ff('0x14')](respondWithResult(_0x249b59,0xc9))['catch'](handleError(_0x249b59,null));};exports[_0x77ff('0x51')]=function(_0x5e04a0,_0x451cd7){if(_0x5e04a0['body']['id']){delete _0x5e04a0[_0x77ff('0x42')]['id'];}return db[_0x77ff('0x26')][_0x77ff('0x1e')]({'where':{'id':_0x5e04a0[_0x77ff('0x3f')]['id']}})[_0x77ff('0x14')](handleEntityNotFound(_0x451cd7,null))[_0x77ff('0x14')](function(_0x23e967){if(_0x23e967){return db[_0x77ff('0x26')][_0x77ff('0x51')](_[_0x77ff('0x34')](_0x5e04a0[_0x77ff('0x42')],['exten','context',_0x77ff('0x52'),_0x77ff('0x53'),'cutdigits',_0x77ff('0x54'),_0x77ff('0x55')]),{'where':{'context':_0x23e967[_0x77ff('0x56')],'exten':_0x23e967[_0x77ff('0x45')]},'individualHooks':!![]})['then'](function(_0x90be13){return _0x90be13;});}return null;})[_0x77ff('0x14')](respondWithStatusCode(_0x451cd7,null))[_0x77ff('0x3d')](handleError(_0x451cd7,null));};exports['addApplications']=function(_0x5e6b0c,_0x131731){var _0x4f12bd=_0x5e6b0c[_0x77ff('0x3f')]['id'];var _0x411a06=_0x5e6b0c[_0x77ff('0x42')];var _0x314009=0xc8;var _0x56f1ff=null;return db[_0x77ff('0x57')][_0x77ff('0x58')]({'isolationLevel':db[_0x77ff('0x57')][_0x77ff('0x59')][_0x77ff('0x5a')][_0x77ff('0x5b')]},function(_0x4f3b18){return db[_0x77ff('0x26')]['findOne']({'where':{'id':_0x4f12bd},'transaction':_0x4f3b18})[_0x77ff('0x14')](function(_0x449101){if(_0x449101){return db['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':_0x4f12bd},'transaction':_0x4f3b18})['then'](function(){var _0x281b29=_[_0x77ff('0x1b')](_0x411a06,function(_0x208007){_0x208007[_0x77ff('0x5c')]=_0x4f12bd;_0x208007[_0x77ff('0x5d')]=!![];return _0x208007;});return _0x449101[_0x77ff('0x5e')](_0x281b29);})[_0x77ff('0x14')](function(_0x40c295){return db['VoiceExtension']['bulkCreate'](_0x40c295,{'transaction':_0x4f3b18});});}else{_0x314009=0x194;_0x56f1ff=[];}});})[_0x77ff('0x14')](function(){if(_0x314009!==0x194){return db[_0x77ff('0x26')][_0x77ff('0x5f')]({'where':{'isApp':!![],'VoiceExtensionId':_0x4f12bd},'order':_0x77ff('0x60')})[_0x77ff('0x14')](function(_0xc690a5){_0x56f1ff=_0xc690a5;});}})[_0x77ff('0x3d')](function(_0xefa5fe){_0x314009=0x1f4;logger[_0x77ff('0x21')](_0xefa5fe['stack']);if(_0xefa5fe[_0x77ff('0x23')]){delete _0xefa5fe[_0x77ff('0x23')];}_0x56f1ff=_0xefa5fe;})['finally'](function(){if(_0x56f1ff===null){_0x131731[_0x77ff('0x9')](_0x314009);}else{if(_0x314009===0x1f4){_0x131731[_0x77ff('0xa')](_0x314009)[_0x77ff('0x24')](_0x56f1ff);}else{_0x131731[_0x77ff('0xa')](_0x314009)['json'](_0x56f1ff);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index f4cb250..3be9cc6 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 _0xc45c=['exports','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x4445f7,_0x2f5432){var _0x438ec1=function(_0x34bc8e){while(--_0x34bc8e){_0x4445f7['push'](_0x4445f7['shift']());}};_0x438ec1(++_0x2f5432);}(_0xc45c,0xf1));var _0xcc45=function(_0x572563,_0x408187){_0x572563=_0x572563-0x0;var _0x408d70=_0xc45c[_0x572563];return _0x408d70;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0xcc45('0x0'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xcc45('0x1')](0x0);var events={'afterCreate':_0xcc45('0x2'),'afterUpdate':_0xcc45('0x3'),'afterDestroy':_0xcc45('0x4')};function emitEvent(_0x1b7af3){return function(_0x4bf207,_0x22ecb0,_0x545354){VoiceExtensionEvents[_0xcc45('0x5')](_0x1b7af3+':'+_0x4bf207['id'],_0x4bf207);VoiceExtensionEvents[_0xcc45('0x5')](_0x1b7af3,_0x4bf207);_0x545354(null);};}for(var e in events){if(events[_0xcc45('0x6')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xcc45('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0xc0ee=['hasOwnProperty','hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','save','update','remove','emit'];(function(_0x2eed55,_0x143ff0){var _0x4141fc=function(_0x1d2915){while(--_0x1d2915){_0x2eed55['push'](_0x2eed55['shift']());}};_0x4141fc(++_0x143ff0);}(_0xc0ee,0x71));var _0xec0e=function(_0x58965a,_0x2e71db){_0x58965a=_0x58965a-0x0;var _0x254efc=_0xc0ee[_0x58965a];return _0x254efc;};'use strict';var EventEmitter=require(_0xec0e('0x0'));var VoiceExtension=require(_0xec0e('0x1'))['db'][_0xec0e('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xec0e('0x3')](0x0);var events={'afterCreate':_0xec0e('0x4'),'afterUpdate':_0xec0e('0x5'),'afterDestroy':_0xec0e('0x6')};function emitEvent(_0x5cd495){return function(_0x18f891,_0x4f784e,_0x5de15c){VoiceExtensionEvents[_0xec0e('0x7')](_0x5cd495+':'+_0x18f891['id'],_0x18f891);VoiceExtensionEvents[_0xec0e('0x7')](_0x5cd495,_0x18f891);_0x5de15c(null);};}for(var e in events){if(events[_0xec0e('0x8')](e)){var event=events[e];VoiceExtension[_0xec0e('0x9')](e,emitEvent(event));}}module[_0xec0e('0xa')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 5926799..9a0b576 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 _0x304b=['callerID','answer','queue','playback','includes','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','appdata','priority','last','concat','catch','VoiceExtension','get','Hangup','./voiceExtension.attributes','exports','models','Set','CDR(type)=','type','context','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','length','name','split','prefix','phone','param','SIP','indexOf','U(xcally-mixmonitor-context)','replace','Interval','interval','IntervalId','then','*,*,*,*','intervals','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'];(function(_0x262923,_0x3639ca){var _0x498cb3=function(_0xcd6382){while(--_0xcd6382){_0x262923['push'](_0x262923['shift']());}};_0x498cb3(++_0x3639ca);}(_0x304b,0xfb));var _0xb304=function(_0x46ef1d,_0x1ce7b4){_0x46ef1d=_0x46ef1d-0x0;var _0xf0fd26=_0x304b[_0x46ef1d];return _0xf0fd26;};'use strict';var _=require('lodash');var attributes=require(_0xb304('0x0'));module[_0xb304('0x1')]=function(_0x26e437){var _0x61902e=_0x26e437[_0xb304('0x2')];function _0x1a54ea(_0x30b63e){var _0xedd10a=0x2;var _0x546729=[{'type':_0x30b63e['type'],'app':_0xb304('0x3'),'appdata':_0xb304('0x4')+_0x30b63e[_0xb304('0x5')],'context':_0x30b63e[_0xb304('0x6')],'exten':_0x30b63e[_0xb304('0x7')],'priority':_0xedd10a++,'VoiceExtensionId':_0x30b63e['id']},{'type':_0x30b63e[_0xb304('0x5')],'app':_0x30b63e[_0xb304('0x8')]?_0xb304('0x3'):_0xb304('0x9'),'appdata':_0x30b63e['alias']?_0xb304('0xa')+_0x30b63e[_0xb304('0x8')]:_0xb304('0xb'),'context':_0x30b63e['context'],'exten':_0x30b63e[_0xb304('0x7')],'priority':_0xedd10a++,'VoiceExtensionId':_0x30b63e['id']}];if(_0x30b63e[_0xb304('0x5')]===_0xb304('0xc')){_0x546729[_0xb304('0xd')]({'type':_0xb304('0xc'),'app':_0xb304('0x3'),'appdata':'CDR(routeid)='+_0x30b63e['id'],'context':_0x30b63e[_0xb304('0x6')],'exten':_0x30b63e[_0xb304('0x7')],'priority':_0xedd10a++,'VoiceExtensionId':_0x30b63e['id']});}_0x546729[_0xb304('0xd')]({'type':_0x30b63e[_0xb304('0x5')],'app':'Set','appdata':_0xb304('0xe'),'context':_0x30b63e[_0xb304('0x6')],'exten':_0x30b63e[_0xb304('0x7')],'priority':_0xedd10a++,'VoiceExtensionId':_0x30b63e['id']},{'type':_0x30b63e[_0xb304('0x5')],'app':_0xb304('0x3'),'appdata':_0xb304('0xf'),'context':_0x30b63e[_0xb304('0x6')],'exten':_0x30b63e[_0xb304('0x7')],'priority':_0xedd10a++,'VoiceExtensionId':_0x30b63e['id']},{'type':_0x30b63e[_0xb304('0x5')],'app':_0xb304('0x3'),'appdata':_0xb304('0x10'),'context':_0x30b63e[_0xb304('0x6')],'exten':_0x30b63e[_0xb304('0x7')],'priority':_0xedd10a++,'VoiceExtensionId':_0x30b63e['id']});return _0x546729;}function _0x5867c0(_0xee0036){var _0x5166c5=0x2;var _0x522fca=[{'type':_0xb304('0x11'),'app':_0xb304('0x3'),'appdata':_0xb304('0x12'),'context':_0xee0036[_0xb304('0x6')],'exten':_0xee0036[_0xb304('0x7')],'priority':_0x5166c5++,'VoiceExtensionId':_0xee0036['id']},{'type':'outbound','app':_0xee0036[_0xb304('0x8')]?'Set':_0xb304('0x9'),'appdata':_0xee0036[_0xb304('0x8')]?'CDR(routeAlias)='+_0xee0036['alias']:'No\x20alias\x20set','context':_0xee0036[_0xb304('0x6')],'exten':_0xee0036[_0xb304('0x7')],'priority':_0x5166c5++,'VoiceExtensionId':_0xee0036['id']},{'type':_0xb304('0x11'),'app':_0xb304('0x3'),'appdata':'CDR(destination)='+(_0xee0036[_0xb304('0x13')]?_0xb304('0x14')+_0xee0036[_0xb304('0x13')]+'}':_0xb304('0x15')),'context':_0xee0036['context'],'exten':_0xee0036['exten'],'priority':_0x5166c5++,'VoiceExtensionId':_0xee0036['id']},{'type':'outbound','app':_0xb304('0x3'),'appdata':'CDR(routeid)='+_0xee0036['id'],'context':_0xee0036[_0xb304('0x6')],'exten':_0xee0036['exten'],'priority':_0x5166c5++,'VoiceExtensionId':_0xee0036['id']},{'type':_0xb304('0x11'),'app':_0xb304('0x16'),'appdata':_0xb304('0x17')+(_0x5166c5+0x2)+'):Goto('+(_0x5166c5+0x1)+')','context':_0xee0036[_0xb304('0x6')],'exten':_0xee0036['exten'],'priority':_0x5166c5++,'VoiceExtensionId':_0xee0036['id']},{'type':_0xb304('0x11'),'app':'Set','appdata':_0xee0036[_0xb304('0x13')]?_0xb304('0x18')+_0xee0036['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0xee0036[_0xb304('0x6')],'exten':_0xee0036[_0xb304('0x7')],'priority':_0x5166c5++,'VoiceExtensionId':_0xee0036['id']},{'type':_0xb304('0x11'),'app':_0xb304('0x3'),'appdata':_0xb304('0xe'),'context':_0xee0036[_0xb304('0x6')],'exten':_0xee0036[_0xb304('0x7')],'priority':_0x5166c5++,'VoiceExtensionId':_0xee0036['id']},{'type':_0xb304('0x11'),'app':_0xb304('0x3'),'appdata':_0xb304('0xf'),'context':_0xee0036['context'],'exten':_0xee0036[_0xb304('0x7')],'priority':_0x5166c5++,'VoiceExtensionId':_0xee0036['id']},{'type':_0xb304('0x11'),'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0xee0036[_0xb304('0x6')],'exten':_0xee0036[_0xb304('0x7')],'priority':_0x5166c5++,'VoiceExtensionId':_0xee0036['id']},{'type':_0xb304('0x11'),'app':'Set','appdata':_0xb304('0x19')+_0xee0036['id'],'context':_0xee0036[_0xb304('0x6')],'exten':_0xee0036['exten'],'priority':_0x5166c5++,'VoiceExtensionId':_0xee0036['id']}];if(_0xee0036[_0xb304('0x1a')](_0xb304('0x1b'))&&_0xee0036[_0xb304('0x1b')]!==_0xb304('0x1c')){_0x522fca[_0xb304('0xd')]({'type':'outbound','app':_0xb304('0x3'),'appdata':_0xb304('0x1d'),'context':_0xee0036[_0xb304('0x6')],'exten':_0xee0036[_0xb304('0x7')],'priority':_0x5166c5++,'VoiceExtensionId':_0xee0036['id']},{'type':_0xb304('0x11'),'app':_0xb304('0x3'),'appdata':_0xb304('0x1e')+_0xee0036[_0xb304('0x1b')]||_0xb304('0x1f'),'context':_0xee0036[_0xb304('0x6')],'exten':_0xee0036[_0xb304('0x7')],'priority':_0x5166c5++,'VoiceExtensionId':_0xee0036['id']});}return _0x522fca;}function _0x224285(_0x8652ac,_0xddb57a){var _0x273300=[{'name':_0xb304('0x20'),'param':0x0},{'name':_0xb304('0x21'),'param':0x1},{'name':_0xb304('0x22'),'param':0x2},{'name':'url','param':0x3}];var _0x111764={};var _0x240e6f=_0xddb57a['split'](',');var _0x3c81ec=[];for(var _0x4ad982=0x0;_0x4ad982<_0x273300[_0xb304('0x23')];_0x4ad982++){switch(_0x273300[_0x4ad982][_0xb304('0x24')]){case _0xb304('0x20'):_0x111764[_0xb304('0x20')]=_0x240e6f[_0x273300[_0x4ad982]['param']][_0xb304('0x25')]('/')[0x1];_0x111764['phone']=_0x240e6f[_0x273300[_0x4ad982]['param']][_0xb304('0x25')]('/')[0x2];_0x111764[_0xb304('0x26')]=_0x111764[_0xb304('0x27')]?_0x111764['phone']['split']('$')[0x0]:undefined;_0x111764[_0xb304('0x27')]=_0x8652ac[_0xb304('0x13')]?(_0x111764[_0xb304('0x26')]||'')+_0xb304('0x14')+_0x8652ac[_0xb304('0x13')]+'}':(_0x111764[_0xb304('0x26')]||'')+'${EXTEN}';_0x3c81ec[_0x273300[_0x4ad982][_0xb304('0x28')]]=[_0xb304('0x29'),_0x111764[_0xb304('0x20')],_0x111764['phone']]['join']('/');break;case'options':_0x111764['options']=_0x240e6f[_0x273300[_0x4ad982][_0xb304('0x28')]];if(_0x8652ac[_0xb304('0x1b')]!=='none'){if(_0x111764[_0xb304('0x22')][_0xb304('0x2a')](_0xb304('0x2b'))<0x0){_0x111764[_0xb304('0x22')]+=_0xb304('0x2b');}}else{_0x111764[_0xb304('0x22')]=_0x111764[_0xb304('0x22')][_0xb304('0x2c')](_0xb304('0x2b'),'');}_0x3c81ec[_0x273300[_0x4ad982][_0xb304('0x28')]]=_0x111764[_0xb304('0x22')];break;default:_0x3c81ec[_0x273300[_0x4ad982][_0xb304('0x28')]]=_0x240e6f[_0x273300[_0x4ad982][_0xb304('0x28')]];}}return _0x3c81ec['join'](',');}function _0x1513a7(_0x3d912d,_0x50b626,_0xeed744){return new Promise(function(_0x4b2707,_0x49011d){var _0x2a3112=[];if(_['isEmpty'](_0x50b626))return _0x4b2707(_0x2a3112);_0x61902e[_0xb304('0x2d')]['findAll']({'attributes':['id',_0xb304('0x2e'),_0xb304('0x2f')],'raw':!![]})[_0xb304('0x30')](function(_0x1db2ce){for(var _0x5c36e4=0x0,_0x4a3c76=0x0;_0x5c36e4<_0x50b626[_0xb304('0x23')];_0x5c36e4++,_0x4a3c76=0x0){var _0x178b19=_0x50b626[_0x5c36e4];var _0x4d6430=[];var _0x423303=[];delete _0x178b19['id'];if(_0x178b19['interval']!==_0xb304('0x31')){_0x178b19[_0xb304('0x32')]=[_0x178b19[_0xb304('0x2e')]];}else{_0x178b19[_0xb304('0x32')]=_0x178b19[_0xb304('0x2f')]?_[_0xb304('0x33')](_[_0xb304('0x34')](_0x1db2ce,{'IntervalId':_0x178b19[_0xb304('0x2f')]}),'interval'):[];}_0x178b19[_0xb304('0x6')]=_0x3d912d[_0xb304('0x6')];_0x178b19[_0xb304('0x7')]=_0x3d912d[_0xb304('0x7')];if(_0x178b19['type'])_0x178b19[_0xb304('0x5')]=_0x178b19[_0xb304('0x5')][_0xb304('0x35')]();if(_0x3d912d[_0xb304('0x5')]===_0xb304('0x11')){if(_0x178b19[_0xb304('0x1a')](_0xb304('0x36'))&&_0x178b19[_0xb304('0x36')]&&_0x178b19[_0xb304('0x36')]!=='--'){_0x4d6430[_0xb304('0xd')]({'type':_0x178b19[_0xb304('0x5')][_0xb304('0x35')](),'app':_0xb304('0x3'),'appdata':_0xb304('0x37')+_0x178b19[_0xb304('0x36')],'context':_0x3d912d[_0xb304('0x6')],'exten':_0x3d912d[_0xb304('0x7')],'priority':_0x178b19[_0xb304('0x32')][_0xb304('0x23')]+_0xeed744+_0x4a3c76++,'VoiceExtensionId':_0x3d912d['id']});}_0x4d6430[_0xb304('0xd')]({'type':_0x178b19[_0xb304('0x5')][_0xb304('0x35')](),'app':_0xb304('0x16'),'appdata':_0xb304('0x38')+(_0x178b19[_0xb304('0x39')]?'Set(CALLERID(all)='+_0x178b19[_0xb304('0x39')]+')':'NoOp(No\x20number\x20available)'),'context':_0x3d912d[_0xb304('0x6')],'exten':_0x3d912d[_0xb304('0x7')],'priority':_0x178b19['intervals']['length']+_0xeed744+_0x4a3c76++,'VoiceExtensionId':_0x3d912d['id']});}else{if(_0x178b19['hasOwnProperty'](_0xb304('0x3a'))){if([_0xb304('0x3b'),_0xb304('0x3c')][_0xb304('0x3d')](_0x178b19['app'][_0xb304('0x35')]())&&_0x178b19[_0xb304('0x3e')]!=='custom'){if(_0x178b19[_0xb304('0x3a')]){_0x4d6430[_0xb304('0xd')]({'type':_0x178b19['type'][_0xb304('0x35')](),'app':_0xb304('0x16'),'appdata':_0xb304('0x3f'),'context':_0x3d912d[_0xb304('0x6')],'exten':_0x3d912d['exten'],'priority':_0x178b19[_0xb304('0x32')][_0xb304('0x23')]+_0xeed744+_0x4a3c76++,'VoiceExtensionId':_0x3d912d['id']});_0x4d6430[_0xb304('0xd')]({'type':_0x178b19[_0xb304('0x5')][_0xb304('0x35')](),'app':_0xb304('0x3'),'appdata':_0xb304('0x40'),'context':_0x3d912d[_0xb304('0x6')],'exten':_0x3d912d[_0xb304('0x7')],'priority':_0x178b19[_0xb304('0x32')][_0xb304('0x23')]+_0xeed744+_0x4a3c76++,'VoiceExtensionId':_0x3d912d['id']});}else{_0x4d6430['push']({'type':_0x178b19[_0xb304('0x5')][_0xb304('0x35')](),'app':_0xb304('0x16'),'appdata':_0xb304('0x41'),'context':_0x3d912d[_0xb304('0x6')],'exten':_0x3d912d['exten'],'priority':_0x178b19[_0xb304('0x32')][_0xb304('0x23')]+_0xeed744+_0x4a3c76++,'VoiceExtensionId':_0x3d912d['id']});_0x4d6430['push']({'type':_0x178b19['type']['toLowerCase'](),'app':'Set','appdata':_0xb304('0x42'),'context':_0x3d912d['context'],'exten':_0x3d912d[_0xb304('0x7')],'priority':_0x178b19[_0xb304('0x32')]['length']+_0xeed744+_0x4a3c76++,'VoiceExtensionId':_0x3d912d['id']});}}}}for(var _0x468625=0x0;_0x468625<_0x178b19[_0xb304('0x32')][_0xb304('0x23')];_0x468625++){var _0x427f85=_0xeed744+_0x178b19[_0xb304('0x32')][_0xb304('0x23')];var _0x3f68d1=_0x468625===_0x178b19['intervals'][_0xb304('0x23')]-0x1?_0xeed744+_0x4d6430[_0xb304('0x23')]+_0x423303[_0xb304('0x23')]+0x2:_0xeed744+_0x468625+0x1;_0x4d6430['splice'](_0x468625,0x0,{'type':_0x3d912d[_0xb304('0x5')],'app':_0xb304('0x43'),'appdata':_0x178b19[_0xb304('0x32')][_0x468625]+'?'+_0x3d912d[_0xb304('0x6')]+_0xb304('0x44')+_0x427f85+':'+_0x3d912d[_0xb304('0x6')]+',${EXTEN},'+_0x3f68d1,'exten':_0x3d912d[_0xb304('0x7')],'context':_0x3d912d[_0xb304('0x6')],'priority':_0xeed744+_0x468625,'VoiceExtensionId':_0x3d912d['id']});}if(_0x178b19[_0xb304('0x3e')]==='outboundDial')_0x178b19['appdata']=_0x224285(_0x3d912d,_0x178b19[_0xb304('0x45')]);_0x178b19[_0xb304('0x46')]=_0x4d6430[_0xb304('0x23')]?_[_0xb304('0x47')](_0x4d6430)[_0xb304('0x46')]+0x1:_0xeed744;_0x2a3112=_[_0xb304('0x48')](_0x2a3112,_0x4d6430,[_0x178b19],_0x423303);_0xeed744=_[_0xb304('0x47')](_0x2a3112)[_0xb304('0x46')]+0x1;}return _0x4b2707(_0x2a3112);})[_0xb304('0x49')](function(_0x21d123){_0x49011d(_0x21d123);});});}return _0x26e437['define'](_0xb304('0x4a'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x11b47b){var _0xf14844=this[_0xb304('0x4b')]({'plain':!![]});var _0x5830e0=_0xf14844[_0xb304('0x5')]===_0xb304('0x11')?_0x5867c0(_0xf14844):_0x1a54ea(_0xf14844);return _0x1513a7(_0xf14844,_0x11b47b,_[_0xb304('0x47')](_0x5830e0)[_0xb304('0x46')]+0x1)[_0xb304('0x30')](function(_0x16fb10){var _0x53b7d7=_['concat'](_0x5830e0,_0x16fb10);_0x53b7d7[_0xb304('0xd')]({'type':_0xf14844[_0xb304('0x5')],'app':_0xb304('0x4c'),'exten':_0xf14844['exten'],'context':_0xf14844[_0xb304('0x6')],'priority':_[_0xb304('0x47')](_0x53b7d7)[_0xb304('0x46')]+0x1,'VoiceExtensionId':_0xf14844['id']});return _0x53b7d7;});}}});}; \ No newline at end of file +var _0xe407=['$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','options','split','length','name','trunk','param','phone','prefix','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','Interval','IntervalId','then','interval','*,*,*,*','intervals','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','answer','queue','playback','includes','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','catch','VoiceExtension','voice_extensions','get','concat','lodash','./voiceExtension.attributes','models','type','CDR(type)=','context','exten','alias','Set','NoOp','CDR(routeAlias)=','inbound','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','No\x20alias\x20set','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf'];(function(_0x2a5deb,_0x3a6a94){var _0x391257=function(_0x56420d){while(--_0x56420d){_0x2a5deb['push'](_0x2a5deb['shift']());}};_0x391257(++_0x3a6a94);}(_0xe407,0x181));var _0x7e40=function(_0x422f76,_0x2333e6){_0x422f76=_0x422f76-0x0;var _0x3f4277=_0xe407[_0x422f76];return _0x3f4277;};'use strict';var _=require(_0x7e40('0x0'));var attributes=require(_0x7e40('0x1'));module['exports']=function(_0x547f71){var _0xdead95=_0x547f71[_0x7e40('0x2')];function _0x3bcecd(_0xb885df){var _0x4d40e9=0x2;var _0x1dfc2a=[{'type':_0xb885df[_0x7e40('0x3')],'app':'Set','appdata':_0x7e40('0x4')+_0xb885df['type'],'context':_0xb885df[_0x7e40('0x5')],'exten':_0xb885df[_0x7e40('0x6')],'priority':_0x4d40e9++,'VoiceExtensionId':_0xb885df['id']},{'type':_0xb885df[_0x7e40('0x3')],'app':_0xb885df[_0x7e40('0x7')]?_0x7e40('0x8'):_0x7e40('0x9'),'appdata':_0xb885df['alias']?_0x7e40('0xa')+_0xb885df['alias']:'No\x20alias\x20set','context':_0xb885df['context'],'exten':_0xb885df[_0x7e40('0x6')],'priority':_0x4d40e9++,'VoiceExtensionId':_0xb885df['id']}];if(_0xb885df[_0x7e40('0x3')]===_0x7e40('0xb')){_0x1dfc2a[_0x7e40('0xc')]({'type':_0x7e40('0xb'),'app':_0x7e40('0x8'),'appdata':'CDR(routeid)='+_0xb885df['id'],'context':_0xb885df['context'],'exten':_0xb885df['exten'],'priority':_0x4d40e9++,'VoiceExtensionId':_0xb885df['id']});}_0x1dfc2a['push']({'type':_0xb885df['type'],'app':_0x7e40('0x8'),'appdata':_0x7e40('0xd'),'context':_0xb885df[_0x7e40('0x5')],'exten':_0xb885df[_0x7e40('0x6')],'priority':_0x4d40e9++,'VoiceExtensionId':_0xb885df['id']},{'type':_0xb885df[_0x7e40('0x3')],'app':_0x7e40('0x8'),'appdata':_0x7e40('0xe'),'context':_0xb885df[_0x7e40('0x5')],'exten':_0xb885df[_0x7e40('0x6')],'priority':_0x4d40e9++,'VoiceExtensionId':_0xb885df['id']},{'type':_0xb885df['type'],'app':_0x7e40('0x8'),'appdata':_0x7e40('0xf'),'context':_0xb885df[_0x7e40('0x5')],'exten':_0xb885df[_0x7e40('0x6')],'priority':_0x4d40e9++,'VoiceExtensionId':_0xb885df['id']});return _0x1dfc2a;}function _0x8729c1(_0x4643b9){var _0x3227ca=0x2;var _0x450c1c=[{'type':_0x7e40('0x10'),'app':'Set','appdata':_0x7e40('0x11'),'context':_0x4643b9[_0x7e40('0x5')],'exten':_0x4643b9[_0x7e40('0x6')],'priority':_0x3227ca++,'VoiceExtensionId':_0x4643b9['id']},{'type':_0x7e40('0x10'),'app':_0x4643b9['alias']?'Set':_0x7e40('0x9'),'appdata':_0x4643b9[_0x7e40('0x7')]?_0x7e40('0xa')+_0x4643b9[_0x7e40('0x7')]:_0x7e40('0x12'),'context':_0x4643b9[_0x7e40('0x5')],'exten':_0x4643b9[_0x7e40('0x6')],'priority':_0x3227ca++,'VoiceExtensionId':_0x4643b9['id']},{'type':_0x7e40('0x10'),'app':'Set','appdata':_0x7e40('0x13')+(_0x4643b9[_0x7e40('0x14')]?_0x7e40('0x15')+_0x4643b9[_0x7e40('0x14')]+'}':_0x7e40('0x16')),'context':_0x4643b9[_0x7e40('0x5')],'exten':_0x4643b9['exten'],'priority':_0x3227ca++,'VoiceExtensionId':_0x4643b9['id']},{'type':'outbound','app':_0x7e40('0x8'),'appdata':_0x7e40('0x17')+_0x4643b9['id'],'context':_0x4643b9['context'],'exten':_0x4643b9[_0x7e40('0x6')],'priority':_0x3227ca++,'VoiceExtensionId':_0x4643b9['id']},{'type':'outbound','app':_0x7e40('0x18'),'appdata':_0x7e40('0x19')+(_0x3227ca+0x2)+_0x7e40('0x1a')+(_0x3227ca+0x1)+')','context':_0x4643b9[_0x7e40('0x5')],'exten':_0x4643b9[_0x7e40('0x6')],'priority':_0x3227ca++,'VoiceExtensionId':_0x4643b9['id']},{'type':_0x7e40('0x10'),'app':_0x7e40('0x8'),'appdata':_0x4643b9[_0x7e40('0x14')]?'CDR(prefix)=${EXTEN:0:'+_0x4643b9[_0x7e40('0x14')]+'}':_0x7e40('0x1b'),'context':_0x4643b9[_0x7e40('0x5')],'exten':_0x4643b9[_0x7e40('0x6')],'priority':_0x3227ca++,'VoiceExtensionId':_0x4643b9['id']},{'type':'outbound','app':'Set','appdata':_0x7e40('0xd'),'context':_0x4643b9[_0x7e40('0x5')],'exten':_0x4643b9['exten'],'priority':_0x3227ca++,'VoiceExtensionId':_0x4643b9['id']},{'type':_0x7e40('0x10'),'app':'Set','appdata':_0x7e40('0xe'),'context':_0x4643b9['context'],'exten':_0x4643b9[_0x7e40('0x6')],'priority':_0x3227ca++,'VoiceExtensionId':_0x4643b9['id']},{'type':_0x7e40('0x10'),'app':_0x7e40('0x8'),'appdata':_0x7e40('0xf'),'context':_0x4643b9[_0x7e40('0x5')],'exten':_0x4643b9[_0x7e40('0x6')],'priority':_0x3227ca++,'VoiceExtensionId':_0x4643b9['id']},{'type':_0x7e40('0x10'),'app':'Set','appdata':_0x7e40('0x1c')+_0x4643b9['id'],'context':_0x4643b9['context'],'exten':_0x4643b9[_0x7e40('0x6')],'priority':_0x3227ca++,'VoiceExtensionId':_0x4643b9['id']}];if(_0x4643b9[_0x7e40('0x1d')](_0x7e40('0x1e'))&&_0x4643b9[_0x7e40('0x1e')]!==_0x7e40('0x1f')){_0x450c1c[_0x7e40('0xc')]({'type':'outbound','app':'Set','appdata':_0x7e40('0x20'),'context':_0x4643b9[_0x7e40('0x5')],'exten':_0x4643b9[_0x7e40('0x6')],'priority':_0x3227ca++,'VoiceExtensionId':_0x4643b9['id']},{'type':_0x7e40('0x10'),'app':_0x7e40('0x8'),'appdata':_0x7e40('0x21')+_0x4643b9['recordingFormat']||'wav','context':_0x4643b9['context'],'exten':_0x4643b9['exten'],'priority':_0x3227ca++,'VoiceExtensionId':_0x4643b9['id']});}return _0x450c1c;}function _0x302b1c(_0x1aa1dc,_0x4e6f65){var _0x1610c8=[{'name':'trunk','param':0x0},{'name':'timeout','param':0x1},{'name':_0x7e40('0x22'),'param':0x2},{'name':'url','param':0x3}];var _0x45bdc6={};var _0x23f73b=_0x4e6f65[_0x7e40('0x23')](',');var _0x11de82=[];for(var _0x2e5aca=0x0;_0x2e5aca<_0x1610c8[_0x7e40('0x24')];_0x2e5aca++){switch(_0x1610c8[_0x2e5aca][_0x7e40('0x25')]){case'trunk':_0x45bdc6[_0x7e40('0x26')]=_0x23f73b[_0x1610c8[_0x2e5aca][_0x7e40('0x27')]]['split']('/')[0x1];_0x45bdc6[_0x7e40('0x28')]=_0x23f73b[_0x1610c8[_0x2e5aca][_0x7e40('0x27')]][_0x7e40('0x23')]('/')[0x2];_0x45bdc6['prefix']=_0x45bdc6[_0x7e40('0x28')]?_0x45bdc6[_0x7e40('0x28')][_0x7e40('0x23')]('$')[0x0]:undefined;_0x45bdc6[_0x7e40('0x28')]=_0x1aa1dc[_0x7e40('0x14')]?(_0x45bdc6[_0x7e40('0x29')]||'')+_0x7e40('0x15')+_0x1aa1dc[_0x7e40('0x14')]+'}':(_0x45bdc6[_0x7e40('0x29')]||'')+'${EXTEN}';_0x11de82[_0x1610c8[_0x2e5aca][_0x7e40('0x27')]]=[_0x7e40('0x2a'),_0x45bdc6[_0x7e40('0x26')],_0x45bdc6[_0x7e40('0x28')]][_0x7e40('0x2b')]('/');break;case _0x7e40('0x22'):_0x45bdc6[_0x7e40('0x22')]=_0x23f73b[_0x1610c8[_0x2e5aca]['param']];if(_0x1aa1dc[_0x7e40('0x1e')]!==_0x7e40('0x1f')){if(_0x45bdc6[_0x7e40('0x22')][_0x7e40('0x2c')](_0x7e40('0x2d'))<0x0){_0x45bdc6[_0x7e40('0x22')]+=_0x7e40('0x2d');}}else{_0x45bdc6['options']=_0x45bdc6['options'][_0x7e40('0x2e')](_0x7e40('0x2d'),'');}_0x11de82[_0x1610c8[_0x2e5aca][_0x7e40('0x27')]]=_0x45bdc6['options'];break;default:_0x11de82[_0x1610c8[_0x2e5aca][_0x7e40('0x27')]]=_0x23f73b[_0x1610c8[_0x2e5aca]['param']];}}return _0x11de82['join'](',');}function _0x2d4b44(_0x5e2228,_0x4518c8,_0x62b69b){return new Promise(function(_0x3fd62c,_0x5d7692){var _0x172635=[];if(_['isEmpty'](_0x4518c8))return _0x3fd62c(_0x172635);_0xdead95[_0x7e40('0x2f')]['findAll']({'attributes':['id','interval',_0x7e40('0x30')],'raw':!![]})[_0x7e40('0x31')](function(_0x3695d0){for(var _0x396dc2=0x0,_0x42c7aa=0x0;_0x396dc2<_0x4518c8[_0x7e40('0x24')];_0x396dc2++,_0x42c7aa=0x0){var _0x7cf398=_0x4518c8[_0x396dc2];var _0x47fa3a=[];var _0x2b50a7=[];delete _0x7cf398['id'];if(_0x7cf398[_0x7e40('0x32')]!==_0x7e40('0x33')){_0x7cf398[_0x7e40('0x34')]=[_0x7cf398[_0x7e40('0x32')]];}else{_0x7cf398[_0x7e40('0x34')]=_0x7cf398['IntervalId']?_[_0x7e40('0x35')](_[_0x7e40('0x36')](_0x3695d0,{'IntervalId':_0x7cf398[_0x7e40('0x30')]}),_0x7e40('0x32')):[];}_0x7cf398[_0x7e40('0x5')]=_0x5e2228[_0x7e40('0x5')];_0x7cf398[_0x7e40('0x6')]=_0x5e2228[_0x7e40('0x6')];if(_0x7cf398[_0x7e40('0x3')])_0x7cf398['type']=_0x7cf398[_0x7e40('0x3')][_0x7e40('0x37')]();if(_0x5e2228[_0x7e40('0x3')]===_0x7e40('0x10')){if(_0x7cf398['hasOwnProperty'](_0x7e40('0x38'))&&_0x7cf398[_0x7e40('0x38')]&&_0x7cf398[_0x7e40('0x38')]!=='--'){_0x47fa3a[_0x7e40('0xc')]({'type':_0x7cf398[_0x7e40('0x3')][_0x7e40('0x37')](),'app':_0x7e40('0x8'),'appdata':_0x7e40('0x39')+_0x7cf398[_0x7e40('0x38')],'context':_0x5e2228[_0x7e40('0x5')],'exten':_0x5e2228[_0x7e40('0x6')],'priority':_0x7cf398[_0x7e40('0x34')][_0x7e40('0x24')]+_0x62b69b+_0x42c7aa++,'VoiceExtensionId':_0x5e2228['id']});}_0x47fa3a[_0x7e40('0xc')]({'type':_0x7cf398[_0x7e40('0x3')][_0x7e40('0x37')](),'app':_0x7e40('0x18'),'appdata':_0x7e40('0x3a')+(_0x7cf398[_0x7e40('0x3b')]?_0x7e40('0x3c')+_0x7cf398[_0x7e40('0x3b')]+')':'NoOp(No\x20number\x20available)'),'context':_0x5e2228[_0x7e40('0x5')],'exten':_0x5e2228[_0x7e40('0x6')],'priority':_0x7cf398['intervals'][_0x7e40('0x24')]+_0x62b69b+_0x42c7aa++,'VoiceExtensionId':_0x5e2228['id']});}else{if(_0x7cf398[_0x7e40('0x1d')](_0x7e40('0x3d'))){if([_0x7e40('0x3e'),_0x7e40('0x3f')][_0x7e40('0x40')](_0x7cf398['app']['toLowerCase']())&&_0x7cf398[_0x7e40('0x41')]!==_0x7e40('0x42')){if(_0x7cf398[_0x7e40('0x3d')]){_0x47fa3a[_0x7e40('0xc')]({'type':_0x7cf398[_0x7e40('0x3')][_0x7e40('0x37')](),'app':_0x7e40('0x18'),'appdata':_0x7e40('0x43'),'context':_0x5e2228[_0x7e40('0x5')],'exten':_0x5e2228['exten'],'priority':_0x7cf398[_0x7e40('0x34')][_0x7e40('0x24')]+_0x62b69b+_0x42c7aa++,'VoiceExtensionId':_0x5e2228['id']});_0x47fa3a[_0x7e40('0xc')]({'type':_0x7cf398[_0x7e40('0x3')][_0x7e40('0x37')](),'app':_0x7e40('0x8'),'appdata':_0x7e40('0x44'),'context':_0x5e2228[_0x7e40('0x5')],'exten':_0x5e2228['exten'],'priority':_0x7cf398[_0x7e40('0x34')][_0x7e40('0x24')]+_0x62b69b+_0x42c7aa++,'VoiceExtensionId':_0x5e2228['id']});}else{_0x47fa3a[_0x7e40('0xc')]({'type':_0x7cf398['type'][_0x7e40('0x37')](),'app':_0x7e40('0x18'),'appdata':_0x7e40('0x45'),'context':_0x5e2228['context'],'exten':_0x5e2228[_0x7e40('0x6')],'priority':_0x7cf398[_0x7e40('0x34')][_0x7e40('0x24')]+_0x62b69b+_0x42c7aa++,'VoiceExtensionId':_0x5e2228['id']});_0x47fa3a['push']({'type':_0x7cf398[_0x7e40('0x3')]['toLowerCase'](),'app':_0x7e40('0x8'),'appdata':_0x7e40('0x46'),'context':_0x5e2228[_0x7e40('0x5')],'exten':_0x5e2228[_0x7e40('0x6')],'priority':_0x7cf398[_0x7e40('0x34')][_0x7e40('0x24')]+_0x62b69b+_0x42c7aa++,'VoiceExtensionId':_0x5e2228['id']});}}}}for(var _0x3eedb4=0x0;_0x3eedb4<_0x7cf398[_0x7e40('0x34')][_0x7e40('0x24')];_0x3eedb4++){var _0x2d3fb4=_0x62b69b+_0x7cf398[_0x7e40('0x34')]['length'];var _0x549aff=_0x3eedb4===_0x7cf398[_0x7e40('0x34')][_0x7e40('0x24')]-0x1?_0x62b69b+_0x47fa3a[_0x7e40('0x24')]+_0x2b50a7[_0x7e40('0x24')]+0x2:_0x62b69b+_0x3eedb4+0x1;_0x47fa3a['splice'](_0x3eedb4,0x0,{'type':_0x5e2228[_0x7e40('0x3')],'app':_0x7e40('0x47'),'appdata':_0x7cf398['intervals'][_0x3eedb4]+'?'+_0x5e2228[_0x7e40('0x5')]+_0x7e40('0x48')+_0x2d3fb4+':'+_0x5e2228[_0x7e40('0x5')]+_0x7e40('0x48')+_0x549aff,'exten':_0x5e2228[_0x7e40('0x6')],'context':_0x5e2228[_0x7e40('0x5')],'priority':_0x62b69b+_0x3eedb4,'VoiceExtensionId':_0x5e2228['id']});}if(_0x7cf398[_0x7e40('0x41')]===_0x7e40('0x49'))_0x7cf398[_0x7e40('0x4a')]=_0x302b1c(_0x5e2228,_0x7cf398[_0x7e40('0x4a')]);_0x7cf398[_0x7e40('0x4b')]=_0x47fa3a['length']?_[_0x7e40('0x4c')](_0x47fa3a)[_0x7e40('0x4b')]+0x1:_0x62b69b;_0x172635=_['concat'](_0x172635,_0x47fa3a,[_0x7cf398],_0x2b50a7);_0x62b69b=_[_0x7e40('0x4c')](_0x172635)[_0x7e40('0x4b')]+0x1;}return _0x3fd62c(_0x172635);})[_0x7e40('0x4d')](function(_0x3903af){_0x5d7692(_0x3903af);});});}return _0x547f71['define'](_0x7e40('0x4e'),attributes,{'tableName':_0x7e40('0x4f'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x3e5f1b){var _0x222c98=this[_0x7e40('0x50')]({'plain':!![]});var _0x2aa33a=_0x222c98['type']===_0x7e40('0x10')?_0x8729c1(_0x222c98):_0x3bcecd(_0x222c98);return _0x2d4b44(_0x222c98,_0x3e5f1b,_['last'](_0x2aa33a)['priority']+0x1)[_0x7e40('0x31')](function(_0x27f0e3){var _0x370580=_[_0x7e40('0x51')](_0x2aa33a,_0x27f0e3);_0x370580[_0x7e40('0xc')]({'type':_0x222c98['type'],'app':'Hangup','exten':_0x222c98[_0x7e40('0x6')],'context':_0x222c98[_0x7e40('0x5')],'priority':_['last'](_0x370580)[_0x7e40('0x4b')]+0x1,'VoiceExtensionId':_0x222c98['id']});return _0x370580;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index feb7713..4f7917f 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 _0xcedf=['VoiceExtension,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','VoiceExtension','options','raw','where','attributes','limit','include','map','model','GetVoiceExtension','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','http','defaults','socket.io-emitter','redis','./voiceExtension.socket','register','request','then','info'];(function(_0x37a826,_0x14f7d6){var _0x68fbd=function(_0x3eddb0){while(--_0x3eddb0){_0x37a826['push'](_0x37a826['shift']());}};_0x68fbd(++_0x14f7d6);}(_0xcedf,0x1b6));var _0xfced=function(_0x4ec5c6,_0x1d7eac){_0x4ec5c6=_0x4ec5c6-0x0;var _0x575358=_0xcedf[_0x4ec5c6];return _0x575358;};'use strict';var _=require(_0xfced('0x0'));var util=require(_0xfced('0x1'));var moment=require(_0xfced('0x2'));var BPromise=require(_0xfced('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfced('0x4'));var db=require(_0xfced('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfced('0x6'));var config=require('../../config/environment');var jayson=require(_0xfced('0x7'));var client=jayson['client'][_0xfced('0x8')]({'port':0x232a});config['redis']=_[_0xfced('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfced('0xa'))(new Redis(config[_0xfced('0xb')]));require(_0xfced('0xc'))[_0xfced('0xd')](socket);function respondWithRpcPromise(_0x4cee14,_0x3dacd0,_0x3487bd){return new BPromise(function(_0x35098c,_0x472717){return client[_0xfced('0xe')](_0x4cee14,_0x3487bd)[_0xfced('0xf')](function(_0x30aaba){logger[_0xfced('0x10')](_0xfced('0x11'),_0x3dacd0,'request\x20sent');logger[_0xfced('0x12')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x3dacd0,_0xfced('0x13'),JSON[_0xfced('0x14')](_0x30aaba));if(_0x30aaba[_0xfced('0x15')]){if(_0x30aaba[_0xfced('0x15')]['code']===0x1f4){logger[_0xfced('0x15')](_0xfced('0x11'),_0x3dacd0,_0x30aaba[_0xfced('0x15')][_0xfced('0x16')]);return _0x472717(_0x30aaba[_0xfced('0x15')][_0xfced('0x16')]);}logger[_0xfced('0x15')](_0xfced('0x11'),_0x3dacd0,_0x30aaba['error'][_0xfced('0x16')]);return _0x35098c(_0x30aaba['error'][_0xfced('0x16')]);}else{logger[_0xfced('0x10')](_0xfced('0x11'),_0x3dacd0,_0xfced('0x13'));_0x35098c(_0x30aaba[_0xfced('0x17')][_0xfced('0x16')]);}})[_0xfced('0x18')](function(_0x31ea41){logger[_0xfced('0x15')](_0xfced('0x11'),_0x3dacd0,_0x31ea41);_0x472717(_0x31ea41);});});}exports['GetVoiceExtension']=function(_0x29494c){var _0x2ffad7=this;return new Promise(function(_0x409f38,_0x1b5f20){return db[_0xfced('0x19')]['findAll']({'raw':_0x29494c['options']?_0x29494c[_0xfced('0x1a')][_0xfced('0x1b')]===undefined?!![]:![]:!![],'where':_0x29494c['options']?_0x29494c[_0xfced('0x1a')][_0xfced('0x1c')]||null:null,'attributes':_0x29494c[_0xfced('0x1a')]?_0x29494c[_0xfced('0x1a')][_0xfced('0x1d')]||null:null,'limit':_0x29494c[_0xfced('0x1a')]?_0x29494c['options'][_0xfced('0x1e')]||null:null,'include':_0x29494c[_0xfced('0x1a')]?_0x29494c[_0xfced('0x1a')][_0xfced('0x1f')]?_[_0xfced('0x20')](_0x29494c['options']['include'],function(_0x3c6fdb){return{'model':db[_0x3c6fdb[_0xfced('0x21')]],'as':_0x3c6fdb['as'],'attributes':_0x3c6fdb[_0xfced('0x1d')],'include':_0x3c6fdb[_0xfced('0x1f')]?_['map'](_0x3c6fdb[_0xfced('0x1f')],function(_0x4ef6a0){return{'model':db[_0x4ef6a0['model']],'as':_0x4ef6a0['as'],'attributes':_0x4ef6a0[_0xfced('0x1d')],'include':_0x4ef6a0[_0xfced('0x1f')]?_['map'](_0x4ef6a0[_0xfced('0x1f')],function(_0x5e3852){return{'model':db[_0x5e3852[_0xfced('0x21')]],'as':_0x5e3852['as'],'attributes':_0x5e3852[_0xfced('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xfced('0xf')](function(_0x3d66c0){logger['info'](_0xfced('0x22'),_0x29494c);logger[_0xfced('0x12')](_0xfced('0x22'),_0x29494c,JSON[_0xfced('0x14')](_0x3d66c0));_0x409f38(_0x3d66c0);})['catch'](function(_0x1fab8d){logger[_0xfced('0x15')](_0xfced('0x22'),_0x1fab8d['message'],_0x29494c);_0x1b5f20(_0x2ffad7[_0xfced('0x15')](0x1f4,_0x1fab8d[_0xfced('0x16')]));});});}; \ No newline at end of file +var _0xe9e7=['http','redis','socket.io-emitter','./voiceExtension.socket','register','request','then','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','VoiceExtension,\x20%s,\x20%s','message','info','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','attributes','limit','include','map','model','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe9e7,0x1f0));var _0x7e9e=function(_0x132056,_0x66c89e){_0x132056=_0x132056-0x0;var _0x2ea820=_0xe9e7[_0x132056];return _0x2ea820;};'use strict';var _=require(_0x7e9e('0x0'));var util=require(_0x7e9e('0x1'));var moment=require(_0x7e9e('0x2'));var BPromise=require('bluebird');var rs=require(_0x7e9e('0x3'));var fs=require('fs');var Redis=require(_0x7e9e('0x4'));var db=require(_0x7e9e('0x5'))['db'];var utils=require(_0x7e9e('0x6'));var logger=require(_0x7e9e('0x7'))(_0x7e9e('0x8'));var config=require(_0x7e9e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7e9e('0xa')][_0x7e9e('0xb')]({'port':0x232a});config[_0x7e9e('0xc')]=_['defaults'](config[_0x7e9e('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x7e9e('0xd'))(new Redis(config[_0x7e9e('0xc')]));require(_0x7e9e('0xe'))[_0x7e9e('0xf')](socket);function respondWithRpcPromise(_0x134203,_0x35605f,_0x7a18bd){return new BPromise(function(_0x399920,_0x402ad2){return client[_0x7e9e('0x10')](_0x134203,_0x7a18bd)[_0x7e9e('0x11')](function(_0xbe8a98){logger['info']('VoiceExtension,\x20%s,\x20%s',_0x35605f,'request\x20sent');logger[_0x7e9e('0x12')](_0x7e9e('0x13'),_0x35605f,_0x7e9e('0x14'),JSON[_0x7e9e('0x15')](_0xbe8a98));if(_0xbe8a98['error']){if(_0xbe8a98['error'][_0x7e9e('0x16')]===0x1f4){logger[_0x7e9e('0x17')](_0x7e9e('0x18'),_0x35605f,_0xbe8a98[_0x7e9e('0x17')][_0x7e9e('0x19')]);return _0x402ad2(_0xbe8a98[_0x7e9e('0x17')][_0x7e9e('0x19')]);}logger['error'](_0x7e9e('0x18'),_0x35605f,_0xbe8a98['error'][_0x7e9e('0x19')]);return _0x399920(_0xbe8a98[_0x7e9e('0x17')][_0x7e9e('0x19')]);}else{logger[_0x7e9e('0x1a')](_0x7e9e('0x18'),_0x35605f,_0x7e9e('0x14'));_0x399920(_0xbe8a98[_0x7e9e('0x1b')]['message']);}})[_0x7e9e('0x1c')](function(_0x22d7f6){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x35605f,_0x22d7f6);_0x402ad2(_0x22d7f6);});});}exports[_0x7e9e('0x1d')]=function(_0x58eef4){var _0x5ac867=this;return new Promise(function(_0x21a466,_0x5f554d){return db[_0x7e9e('0x1e')][_0x7e9e('0x1f')]({'raw':_0x58eef4[_0x7e9e('0x20')]?_0x58eef4[_0x7e9e('0x20')][_0x7e9e('0x21')]===undefined?!![]:![]:!![],'where':_0x58eef4[_0x7e9e('0x20')]?_0x58eef4[_0x7e9e('0x20')]['where']||null:null,'attributes':_0x58eef4[_0x7e9e('0x20')]?_0x58eef4[_0x7e9e('0x20')][_0x7e9e('0x22')]||null:null,'limit':_0x58eef4[_0x7e9e('0x20')]?_0x58eef4['options'][_0x7e9e('0x23')]||null:null,'include':_0x58eef4[_0x7e9e('0x20')]?_0x58eef4[_0x7e9e('0x20')][_0x7e9e('0x24')]?_[_0x7e9e('0x25')](_0x58eef4[_0x7e9e('0x20')][_0x7e9e('0x24')],function(_0x54f7b5){return{'model':db[_0x54f7b5[_0x7e9e('0x26')]],'as':_0x54f7b5['as'],'attributes':_0x54f7b5[_0x7e9e('0x22')],'include':_0x54f7b5[_0x7e9e('0x24')]?_[_0x7e9e('0x25')](_0x54f7b5['include'],function(_0x1b61b4){return{'model':db[_0x1b61b4[_0x7e9e('0x26')]],'as':_0x1b61b4['as'],'attributes':_0x1b61b4[_0x7e9e('0x22')],'include':_0x1b61b4[_0x7e9e('0x24')]?_['map'](_0x1b61b4[_0x7e9e('0x24')],function(_0x5da39e){return{'model':db[_0x5da39e[_0x7e9e('0x26')]],'as':_0x5da39e['as'],'attributes':_0x5da39e[_0x7e9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x7e9e('0x11')](function(_0x203415){logger[_0x7e9e('0x1a')](_0x7e9e('0x1d'),_0x58eef4);logger[_0x7e9e('0x12')](_0x7e9e('0x1d'),_0x58eef4,JSON['stringify'](_0x203415));_0x21a466(_0x203415);})['catch'](function(_0x2d9c81){logger['error'](_0x7e9e('0x1d'),_0x2d9c81[_0x7e9e('0x19')],_0x58eef4);_0x5f554d(_0x5ac867['error'](0x1f4,_0x2d9c81['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 2d41629..affbb39 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 _0x7a54=['remove','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','save'];(function(_0x36ed9f,_0x127da2){var _0x42d123=function(_0x3c6e71){while(--_0x3c6e71){_0x36ed9f['push'](_0x36ed9f['shift']());}};_0x42d123(++_0x127da2);}(_0x7a54,0x106));var _0x47a5=function(_0xd1754d,_0x5db693){_0xd1754d=_0xd1754d-0x0;var _0x23f96c=_0x7a54[_0xd1754d];return _0x23f96c;};'use strict';var VoiceExtensionEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){VoiceExtensionEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);VoiceExtensionEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file +var _0x5fc3=['./voiceExtension.events','save','update','emit','removeListener','register','voiceExtension:'];(function(_0x17c624,_0x2c6f74){var _0x24c927=function(_0x626d01){while(--_0x626d01){_0x17c624['push'](_0x17c624['shift']());}};_0x24c927(++_0x2c6f74);}(_0x5fc3,0xa8));var _0x35fc=function(_0x29aefc,_0x4dcf53){_0x29aefc=_0x29aefc-0x0;var _0x11be36=_0x5fc3[_0x29aefc];return _0x11be36;};'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 ace6ec4..69533a5 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 _0xf2e3=['/:id','show','/:id/messages','getMessages','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','isAuthenticated','index','get'];(function(_0x3d5492,_0x566610){var _0x2c1439=function(_0x34a613){while(--_0x34a613){_0x3d5492['push'](_0x3d5492['shift']());}};_0x2c1439(++_0x566610);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xf2e3[_0x525c7b];return _0x27b33e;};'use strict';var multer=require(_0x3f2e('0x0'));var util=require('util');var path=require(_0x3f2e('0x1'));var timeout=require(_0x3f2e('0x2'));var express=require(_0x3f2e('0x3'));var router=express[_0x3f2e('0x4')]();var fs_extra=require(_0x3f2e('0x5'));var auth=require(_0x3f2e('0x6'));var interaction=require(_0x3f2e('0x7'));var config=require(_0x3f2e('0x8'));var controller=require(_0x3f2e('0x9'));router['get']('/',auth[_0x3f2e('0xa')](),controller[_0x3f2e('0xb')]);router[_0x3f2e('0xc')](_0x3f2e('0xd'),auth[_0x3f2e('0xa')](),controller[_0x3f2e('0xe')]);router[_0x3f2e('0xc')](_0x3f2e('0xf'),auth[_0x3f2e('0xa')](),controller[_0x3f2e('0x10')]);router[_0x3f2e('0x11')]('/',auth[_0x3f2e('0xa')](),controller[_0x3f2e('0x12')]);router[_0x3f2e('0x13')](_0x3f2e('0xd'),auth[_0x3f2e('0xa')](),controller[_0x3f2e('0x14')]);router[_0x3f2e('0x15')](_0x3f2e('0xd'),auth['isAuthenticated'](),controller[_0x3f2e('0x16')]);module[_0x3f2e('0x17')]=router; \ No newline at end of file +var _0xafb9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','isAuthenticated','show','getMessages','post','create','update','delete','/:id','destroy','exports','multer'];(function(_0x467a61,_0x65a4bd){var _0x255ecd=function(_0xf43a9b){while(--_0xf43a9b){_0x467a61['push'](_0x467a61['shift']());}};_0x255ecd(++_0x65a4bd);}(_0xafb9,0x68));var _0x9afb=function(_0xcd13b8,_0x5cf24b){_0xcd13b8=_0xcd13b8-0x0;var _0x56cfaf=_0xafb9[_0xcd13b8];return _0x56cfaf;};'use strict';var multer=require(_0x9afb('0x0'));var util=require(_0x9afb('0x1'));var path=require(_0x9afb('0x2'));var timeout=require(_0x9afb('0x3'));var express=require(_0x9afb('0x4'));var router=express[_0x9afb('0x5')]();var fs_extra=require(_0x9afb('0x6'));var auth=require(_0x9afb('0x7'));var interaction=require(_0x9afb('0x8'));var config=require('../../config/environment');var controller=require('./voiceMail.controller');router[_0x9afb('0x9')]('/',auth['isAuthenticated'](),controller[_0x9afb('0xa')]);router['get']('/:id',auth[_0x9afb('0xb')](),controller[_0x9afb('0xc')]);router[_0x9afb('0x9')]('/:id/messages',auth[_0x9afb('0xb')](),controller[_0x9afb('0xd')]);router[_0x9afb('0xe')]('/',auth[_0x9afb('0xb')](),controller[_0x9afb('0xf')]);router['put']('/:id',auth[_0x9afb('0xb')](),controller[_0x9afb('0x10')]);router[_0x9afb('0x11')](_0x9afb('0x12'),auth[_0x9afb('0xb')](),controller[_0x9afb('0x13')]);module[_0x9afb('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 912e49e..c9c9e2e 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 _0x3c3a=['yes','INTEGER','VIRTUAL','getDataValue','fullname','STRING','contest_mailbox','setDataValue','email','string','trim','ENUM'];(function(_0x3ccfd1,_0x10562a){var _0x2cf511=function(_0x46047b){while(--_0x46047b){_0x3ccfd1['push'](_0x3ccfd1['shift']());}};_0x2cf511(++_0x10562a);}(_0x3c3a,0xad));var _0xa3c3=function(_0x6c27ec,_0x139274){_0x6c27ec=_0x6c27ec-0x0;var _0x295924=_0x3c3a[_0x6c27ec];return _0x295924;};'use strict';var Sequelize=require('sequelize');module['exports']={'customer_id':{'type':Sequelize[_0xa3c3('0x0')]},'context':{'type':Sequelize[_0xa3c3('0x0')],'defaultValue':'from-voicemail','unique':_0xa3c3('0x1')},'mailbox':{'type':Sequelize[_0xa3c3('0x0')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0xa3c3('0x0')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xa3c3('0x0')],'validate':{'isEmail':!![]},'set':function(_0x5abf77){this[_0xa3c3('0x2')](_0xa3c3('0x3'),typeof _0x5abf77===_0xa3c3('0x4')&&_0x5abf77[_0xa3c3('0x5')]()?_0x5abf77[_0xa3c3('0x5')]():null);}},'pager':{'type':Sequelize[_0xa3c3('0x0')]},'tz':{'type':Sequelize[_0xa3c3('0x0')],'defaultValue':'central'},'attach':{'type':Sequelize[_0xa3c3('0x6')](_0xa3c3('0x7'),'no'),'defaultValue':_0xa3c3('0x7'),'allowNull':![]},'saycid':{'type':Sequelize[_0xa3c3('0x6')]('yes','no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0xa3c3('0x0')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize['ENUM'](_0xa3c3('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xa3c3('0x6')](_0xa3c3('0x7'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xa3c3('0x6')](_0xa3c3('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0xa3c3('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xa3c3('0x6')](_0xa3c3('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xa3c3('0x6')](_0xa3c3('0x7'),'no'),'defaultValue':_0xa3c3('0x7'),'allowNull':![]},'forcename':{'type':Sequelize[_0xa3c3('0x6')](_0xa3c3('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xa3c3('0x6')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xa3c3('0x6')](_0xa3c3('0x7'),'no'),'defaultValue':_0xa3c3('0x7'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0xa3c3('0x0')]},'maxsecs':{'type':Sequelize[_0xa3c3('0x8')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xa3c3('0x8')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xa3c3('0x9')],'get':function(){return this[_0xa3c3('0xa')](_0xa3c3('0xb'))+'\x20-\x20'+this[_0xa3c3('0xa')]('mailbox');}}}; \ No newline at end of file +var _0x9595=['from-voicemail','contest_mailbox','email','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','mailbox','sequelize','exports','STRING'];(function(_0x1c19fe,_0x4d3346){var _0x1a1b9b=function(_0x53aeb4){while(--_0x53aeb4){_0x1c19fe['push'](_0x1c19fe['shift']());}};_0x1a1b9b(++_0x4d3346);}(_0x9595,0x10d));var _0x5959=function(_0x16baf9,_0x113fc3){_0x16baf9=_0x16baf9-0x0;var _0x5b157f=_0x9595[_0x16baf9];return _0x5b157f;};'use strict';var Sequelize=require(_0x5959('0x0'));module[_0x5959('0x1')]={'customer_id':{'type':Sequelize[_0x5959('0x2')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x5959('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x5959('0x2')],'defaultValue':'','allowNull':![],'unique':_0x5959('0x4')},'password':{'type':Sequelize[_0x5959('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x5959('0x2')],'validate':{'isEmail':!![]},'set':function(_0x49ad65){this['setDataValue'](_0x5959('0x5'),typeof _0x49ad65==='string'&&_0x49ad65['trim']()?_0x49ad65[_0x5959('0x6')]():null);}},'pager':{'type':Sequelize[_0x5959('0x2')]},'tz':{'type':Sequelize[_0x5959('0x2')],'defaultValue':_0x5959('0x7')},'attach':{'type':Sequelize[_0x5959('0x8')](_0x5959('0x9'),'no'),'defaultValue':_0x5959('0x9'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x5959('0x9'),'no'),'defaultValue':_0x5959('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x5959('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x5959('0x8')](_0x5959('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x5959('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x5959('0x8')](_0x5959('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x5959('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x5959('0x8')](_0x5959('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x5959('0x8')](_0x5959('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x5959('0x8')](_0x5959('0x9'),'no'),'defaultValue':_0x5959('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x5959('0x8')](_0x5959('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x5959('0x8')](_0x5959('0x9'),'no'),'defaultValue':_0x5959('0x9'),'allowNull':![]},'stamp':{'type':_0x5959('0xb')},'emailsubject':{'type':Sequelize[_0x5959('0x2')]},'emailbody':{'type':Sequelize[_0x5959('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x5959('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x5959('0xd')],'get':function(){return this[_0x5959('0xe')](_0x5959('0xf'))+'\x20-\x20'+this['getDataValue'](_0x5959('0x10'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index fc8caa3..84e7a2c 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 _0xb10b=['attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','type','merge','options','VoiceMail','include','findAll','rows','includeAll','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Voicemails','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMessages','findOne','VoiceMailMessage','rawAttributes','mailbox','findAndCountAll','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','get','end','error','stack','name','send','map','fieldName','key','model','query','keys','intersection'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb10b,0x12a));var _0xbb10=function(_0x43afbb,_0x448109){_0x43afbb=_0x43afbb-0x0;var _0xa9ddec=_0xb10b[_0x43afbb];return _0xa9ddec;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x916a32,_0x285009){_0x285009=_0x285009||0xcc;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0x18')](_0x285009);}return _0x916a32[_0xbb10('0x19')](_0x285009)['end']();};}function respondWithResult(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0xc8;return function(_0x45b9d6){if(_0x45b9d6){return _0x26e021[_0xbb10('0x19')](_0x42d7e4)[_0xbb10('0x1a')](_0x45b9d6);}};}function respondWithFilteredResult(_0x2f2ebf,_0x24a57b){return function(_0x36b5e8){if(_0x36b5e8){var _0x3e26f4=typeof _0x24a57b[_0xbb10('0x1b')]==='undefined'&&typeof _0x24a57b[_0xbb10('0x1c')]===_0xbb10('0x1d');var _0x133ac2=_0x36b5e8[_0xbb10('0x1e')];var _0x378da8=_0x3e26f4?0x0:_0x24a57b[_0xbb10('0x1b')];var _0x575cca=_0x3e26f4?_0x36b5e8[_0xbb10('0x1e')]:_0x24a57b[_0xbb10('0x1b')]+_0x24a57b[_0xbb10('0x1c')];var _0x48b6e9;if(_0x575cca>=_0x133ac2){_0x575cca=_0x133ac2;_0x48b6e9=0xc8;}else{_0x48b6e9=0xce;}_0x2f2ebf[_0xbb10('0x19')](_0x48b6e9);return _0x2f2ebf[_0xbb10('0x1f')](_0xbb10('0x20'),_0x378da8+'-'+_0x575cca+'/'+_0x133ac2)[_0xbb10('0x1a')](_0x36b5e8);}return null;};}function patchUpdates(_0xdf237d){return function(_0x44e563){try{jsonpatch['apply'](_0x44e563,_0xdf237d,!![]);}catch(_0x12f888){return BPromise[_0xbb10('0x21')](_0x12f888);}return _0x44e563['save']();};}function saveUpdates(_0x4c4b0d,_0x8e2b97){return function(_0x311abe){if(_0x311abe){return _0x311abe[_0xbb10('0x22')](_0x4c4b0d)[_0xbb10('0x23')](function(_0x445761){return _0x445761;});}return null;};}function removeEntity(_0x1824b7,_0x407cb4){return function(_0x436104){if(_0x436104){return _0x436104[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){var _0x3ba6cd=_0x436104[_0xbb10('0x25')]({'plain':!![]});var _0x537898='Voicemails';return db['UserProfileResource'][_0xbb10('0x24')]({'where':{'type':_0x537898,'resourceId':_0x3ba6cd['id']}})[_0xbb10('0x23')](function(){return _0x436104;});})[_0xbb10('0x23')](function(){_0x1824b7['status'](0xcc)[_0xbb10('0x26')]();});}};}function handleEntityNotFound(_0x24d586,_0x6ed43b){return function(_0x1d5e95){if(!_0x1d5e95){_0x24d586[_0xbb10('0x18')](0x194);}return _0x1d5e95;};}function handleError(_0x20d946,_0x2a0e8b){_0x2a0e8b=_0x2a0e8b||0x1f4;return function(_0x4aabb9){logger[_0xbb10('0x27')](_0x4aabb9[_0xbb10('0x28')]);if(_0x4aabb9[_0xbb10('0x29')]){delete _0x4aabb9[_0xbb10('0x29')];}_0x20d946[_0xbb10('0x19')](_0x2a0e8b)[_0xbb10('0x2a')](_0x4aabb9);};}exports['index']=function(_0x221624,_0x4ee02e){var _0x448d5c={},_0x56f2da={},_0x16ad2a={'count':0x0,'rows':[]};var _0x1dcc9c=_[_0xbb10('0x2b')](db['VoiceMail']['rawAttributes'],function(_0x4c3744){return{'name':_0x4c3744[_0xbb10('0x2c')],'type':_0x4c3744['type'][_0xbb10('0x2d')]};});_0x56f2da[_0xbb10('0x2e')]=_[_0xbb10('0x2b')](_0x1dcc9c,_0xbb10('0x29'));_0x56f2da[_0xbb10('0x2f')]=_[_0xbb10('0x30')](_0x221624[_0xbb10('0x2f')]);_0x56f2da['filters']=_[_0xbb10('0x31')](_0x56f2da[_0xbb10('0x2e')],_0x56f2da[_0xbb10('0x2f')]);_0x448d5c[_0xbb10('0x32')]=_[_0xbb10('0x31')](_0x56f2da[_0xbb10('0x2e')],qs[_0xbb10('0x33')](_0x221624[_0xbb10('0x2f')][_0xbb10('0x33')]));_0x448d5c['attributes']=_0x448d5c[_0xbb10('0x32')][_0xbb10('0x34')]?_0x448d5c[_0xbb10('0x32')]:_0x56f2da[_0xbb10('0x2e')];if(!_0x221624['query'][_0xbb10('0x35')]('nolimit')){_0x448d5c['limit']=qs[_0xbb10('0x1c')](_0x221624[_0xbb10('0x2f')][_0xbb10('0x1c')]);_0x448d5c[_0xbb10('0x1b')]=qs[_0xbb10('0x1b')](_0x221624[_0xbb10('0x2f')]['offset']);}_0x448d5c[_0xbb10('0x36')]=qs[_0xbb10('0x37')](_0x221624['query']['sort']);_0x448d5c['where']=qs[_0xbb10('0x38')](_[_0xbb10('0x39')](_0x221624[_0xbb10('0x2f')],_0x56f2da['filters']),_0x1dcc9c);if(_0x221624[_0xbb10('0x2f')][_0xbb10('0x3a')]){_0x448d5c[_0xbb10('0x3b')]=_['merge'](_0x448d5c[_0xbb10('0x3b')],{'$or':_[_0xbb10('0x2b')](_0x1dcc9c,function(_0x1dcd38){if(_0x1dcd38[_0xbb10('0x3c')]!=='VIRTUAL'){var _0xd238e9={};_0xd238e9[_0x1dcd38[_0xbb10('0x29')]]={'$like':'%'+_0x221624['query'][_0xbb10('0x3a')]+'%'};return _0xd238e9;}})});}_0x448d5c=_[_0xbb10('0x3d')]({},_0x448d5c,_0x221624[_0xbb10('0x3e')]);var _0x3a9934={'where':_0x448d5c[_0xbb10('0x3b')]};return db[_0xbb10('0x3f')]['count'](_0x3a9934)[_0xbb10('0x23')](function(_0x1c7fae){_0x16ad2a[_0xbb10('0x1e')]=_0x1c7fae;if(_0x221624[_0xbb10('0x2f')]['includeAll']){_0x448d5c[_0xbb10('0x40')]=[{'all':!![]}];}return db[_0xbb10('0x3f')][_0xbb10('0x41')](_0x448d5c);})[_0xbb10('0x23')](function(_0x5e2cfa){_0x16ad2a[_0xbb10('0x42')]=_0x5e2cfa;return _0x16ad2a;})[_0xbb10('0x23')](respondWithFilteredResult(_0x4ee02e,_0x448d5c))['catch'](handleError(_0x4ee02e,null));};exports['show']=function(_0x38d78f,_0x4a3ddf){var _0x318984={'raw':!![],'where':{'id':_0x38d78f['params']['id']}},_0x180933={};_0x180933[_0xbb10('0x2e')]=_[_0xbb10('0x30')](db[_0xbb10('0x3f')]['rawAttributes']);_0x180933[_0xbb10('0x2f')]=_[_0xbb10('0x30')](_0x38d78f[_0xbb10('0x2f')]);_0x180933[_0xbb10('0x38')]=_[_0xbb10('0x31')](_0x180933[_0xbb10('0x2e')],_0x180933[_0xbb10('0x2f')]);_0x318984[_0xbb10('0x32')]=_[_0xbb10('0x31')](_0x180933[_0xbb10('0x2e')],qs[_0xbb10('0x33')](_0x38d78f[_0xbb10('0x2f')]['fields']));_0x318984[_0xbb10('0x32')]=_0x318984[_0xbb10('0x32')]['length']?_0x318984[_0xbb10('0x32')]:_0x180933[_0xbb10('0x2e')];if(_0x38d78f[_0xbb10('0x2f')][_0xbb10('0x43')]){_0x318984[_0xbb10('0x40')]=[{'all':!![]}];}_0x318984=_[_0xbb10('0x3d')]({},_0x318984,_0x38d78f[_0xbb10('0x3e')]);return db['VoiceMail']['find'](_0x318984)[_0xbb10('0x23')](handleEntityNotFound(_0x4a3ddf,null))[_0xbb10('0x23')](respondWithResult(_0x4a3ddf,null))[_0xbb10('0x44')](handleError(_0x4a3ddf,null));};exports['create']=function(_0x5f0c12,_0x3cd6f3){return db[_0xbb10('0x3f')][_0xbb10('0x45')](_0x5f0c12[_0xbb10('0x46')],{})[_0xbb10('0x23')](function(_0x22b315){var _0x2f2552=_0x5f0c12[_0xbb10('0x47')][_0xbb10('0x25')]({'plain':!![]});if(!_0x2f2552)throw new Error(_0xbb10('0x48'));if(_0x2f2552['role']==='user'){var _0x412e13=_0x22b315[_0xbb10('0x25')]({'plain':!![]});var _0x36ab7d=_0xbb10('0x49');return db[_0xbb10('0x4a')][_0xbb10('0x4b')]({'where':{'name':_0x36ab7d,'userProfileId':_0x2f2552[_0xbb10('0x4c')]},'raw':!![]})[_0xbb10('0x23')](function(_0x1c0d8f){if(_0x1c0d8f&&_0x1c0d8f[_0xbb10('0x4d')]===0x0){return db[_0xbb10('0x4e')][_0xbb10('0x45')]({'name':_0x412e13[_0xbb10('0x29')],'resourceId':_0x412e13['id'],'type':_0x1c0d8f[_0xbb10('0x29')],'sectionId':_0x1c0d8f['id']},{})[_0xbb10('0x23')](function(){return _0x22b315;});}else{return _0x22b315;}})['catch'](function(_0x124052){logger['error'](_0xbb10('0x4f'),_0x124052);throw _0x124052;});}return _0x22b315;})[_0xbb10('0x23')](respondWithResult(_0x3cd6f3,0xc9))[_0xbb10('0x44')](handleError(_0x3cd6f3,null));};exports[_0xbb10('0x22')]=function(_0x26e66e,_0x32d8e9){if(_0x26e66e[_0xbb10('0x46')]['id']){delete _0x26e66e[_0xbb10('0x46')]['id'];}return db[_0xbb10('0x3f')][_0xbb10('0x4b')]({'where':{'id':_0x26e66e[_0xbb10('0x50')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x32d8e9,null))[_0xbb10('0x23')](saveUpdates(_0x26e66e[_0xbb10('0x46')],null))[_0xbb10('0x23')](respondWithResult(_0x32d8e9,null))['catch'](handleError(_0x32d8e9,null));};exports[_0xbb10('0x24')]=function(_0x466eb7,_0x1b83a9){return db[_0xbb10('0x3f')][_0xbb10('0x4b')]({'where':{'id':_0x466eb7[_0xbb10('0x50')]['id']}})['then'](handleEntityNotFound(_0x1b83a9,null))[_0xbb10('0x23')](removeEntity(_0x1b83a9,null))[_0xbb10('0x44')](handleError(_0x1b83a9,null));};exports[_0xbb10('0x51')]=function(_0x14fed3,_0x432728,_0x22de7f){return db[_0xbb10('0x3f')][_0xbb10('0x52')]({'where':{'id':_0x14fed3[_0xbb10('0x50')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x432728,null))[_0xbb10('0x23')](function(_0x2a1ce1){var _0x16932f;var _0x4e7fac={},_0x4ea1a6={};_0x4ea1a6[_0xbb10('0x2e')]=_[_0xbb10('0x30')](db[_0xbb10('0x53')][_0xbb10('0x54')]);_0x4ea1a6['query']=_['keys'](_0x14fed3[_0xbb10('0x2f')]);_0x4ea1a6[_0xbb10('0x38')]=_[_0xbb10('0x31')](_0x4ea1a6[_0xbb10('0x2e')],_0x4ea1a6[_0xbb10('0x2f')]);_0x4e7fac[_0xbb10('0x32')]=_[_0xbb10('0x31')](_0x4ea1a6['model'],qs[_0xbb10('0x33')](_0x14fed3[_0xbb10('0x2f')]['fields']));_0x4e7fac['attributes']=_0x4e7fac['attributes'][_0xbb10('0x34')]?_0x4e7fac[_0xbb10('0x32')]:_0x4ea1a6[_0xbb10('0x2e')];if(!_0x14fed3['query']['hasOwnProperty']('nolimit')){_0x4e7fac[_0xbb10('0x1c')]=qs[_0xbb10('0x1c')](_0x14fed3[_0xbb10('0x2f')]['limit']);_0x4e7fac[_0xbb10('0x1b')]=qs[_0xbb10('0x1b')](_0x14fed3['query']['offset']);}_0x4e7fac[_0xbb10('0x36')]=qs[_0xbb10('0x37')](_0x14fed3[_0xbb10('0x2f')][_0xbb10('0x37')]);_0x4e7fac['where']=qs[_0xbb10('0x38')](_[_0xbb10('0x39')](_0x14fed3[_0xbb10('0x2f')],_0x4ea1a6['filters']));if(_0x14fed3[_0xbb10('0x2f')][_0xbb10('0x3a')]){_0x4e7fac[_0xbb10('0x3b')]=_['merge'](_0x4e7fac[_0xbb10('0x3b')],{'$or':_[_0xbb10('0x2b')](_0x4e7fac[_0xbb10('0x32')],function(_0x37b65f){var _0x5e4a6e={};_0x5e4a6e[_0x37b65f]={'$like':'%'+_0x14fed3[_0xbb10('0x2f')][_0xbb10('0x3a')]+'%'};return _0x5e4a6e;})});}_0x4e7fac[_0xbb10('0x3b')]=_[_0xbb10('0x3d')](_0x4e7fac['where'],{'mailboxuser':_0x2a1ce1[_0xbb10('0x55')]});_0x4e7fac=_[_0xbb10('0x3d')]({},_0x4e7fac,_0x14fed3[_0xbb10('0x3e')]);return db[_0xbb10('0x53')][_0xbb10('0x56')](_0x4e7fac)[_0xbb10('0x23')](respondWithFilteredResult(_0x432728,_0x4e7fac));})[_0xbb10('0x44')](handleError(_0x432728,null));}; \ No newline at end of file +var _0x9354=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','apply','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','error','name','send','index','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','map','VIRTUAL','filter','merge','options','VoiceMail','include','findAll','catch','params','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','VoiceMailMessage','pick','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service'];(function(_0x2af82b,_0x568514){var _0x5e4dcf=function(_0x333594){while(--_0x333594){_0x2af82b['push'](_0x2af82b['shift']());}};_0x5e4dcf(++_0x568514);}(_0x9354,0x96));var _0x4935=function(_0x7a319d,_0x235959){_0x7a319d=_0x7a319d-0x0;var _0x5c6b4e=_0x9354[_0x7a319d];return _0x5c6b4e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4935('0x0'));var zipdir=require(_0x4935('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4935('0x2'));var moment=require(_0x4935('0x3'));var BPromise=require(_0x4935('0x4'));var Mustache=require(_0x4935('0x5'));var util=require('util');var path=require(_0x4935('0x6'));var sox=require(_0x4935('0x7'));var csv=require(_0x4935('0x8'));var ejs=require(_0x4935('0x9'));var fs=require('fs');var fs_extra=require(_0x4935('0xa'));var _=require(_0x4935('0xb'));var squel=require(_0x4935('0xc'));var crypto=require(_0x4935('0xd'));var jsforce=require(_0x4935('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4935('0x8'));var querystring=require('querystring');var Papa=require(_0x4935('0xf'));var Redis=require(_0x4935('0x10'));var authService=require(_0x4935('0x11'));var qs=require(_0x4935('0x12'));var as=require(_0x4935('0x13'));var hardwareService=require(_0x4935('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x4935('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4935('0x16'))['db'];function respondWithStatusCode(_0x32916f,_0x3bb388){_0x3bb388=_0x3bb388||0xcc;return function(_0x1c6c22){if(_0x1c6c22){return _0x32916f[_0x4935('0x17')](_0x3bb388);}return _0x32916f[_0x4935('0x18')](_0x3bb388)[_0x4935('0x19')]();};}function respondWithResult(_0x3a7c30,_0x57549f){_0x57549f=_0x57549f||0xc8;return function(_0x237e28){if(_0x237e28){return _0x3a7c30[_0x4935('0x18')](_0x57549f)[_0x4935('0x1a')](_0x237e28);}};}function respondWithFilteredResult(_0xa41961,_0x3652c4){return function(_0x24cc99){if(_0x24cc99){var _0x395a43=typeof _0x3652c4['offset']===_0x4935('0x1b')&&typeof _0x3652c4[_0x4935('0x1c')]===_0x4935('0x1b');var _0x123300=_0x24cc99[_0x4935('0x1d')];var _0x429ef3=_0x395a43?0x0:_0x3652c4['offset'];var _0xd70eff=_0x395a43?_0x24cc99[_0x4935('0x1d')]:_0x3652c4['offset']+_0x3652c4[_0x4935('0x1c')];var _0x10407f;if(_0xd70eff>=_0x123300){_0xd70eff=_0x123300;_0x10407f=0xc8;}else{_0x10407f=0xce;}_0xa41961[_0x4935('0x18')](_0x10407f);return _0xa41961['set']('Content-Range',_0x429ef3+'-'+_0xd70eff+'/'+_0x123300)[_0x4935('0x1a')](_0x24cc99);}return null;};}function patchUpdates(_0x6b849f){return function(_0x1ae059){try{jsonpatch[_0x4935('0x1e')](_0x1ae059,_0x6b849f,!![]);}catch(_0x41d76e){return BPromise[_0x4935('0x1f')](_0x41d76e);}return _0x1ae059[_0x4935('0x20')]();};}function saveUpdates(_0xe482a5,_0x58b2f3){return function(_0x2f520a){if(_0x2f520a){return _0x2f520a[_0x4935('0x21')](_0xe482a5)[_0x4935('0x22')](function(_0x2c701f){return _0x2c701f;});}return null;};}function removeEntity(_0x52c65a,_0x53530f){return function(_0x4dc1f5){if(_0x4dc1f5){return _0x4dc1f5[_0x4935('0x23')]()[_0x4935('0x22')](function(){var _0x3786ff=_0x4dc1f5[_0x4935('0x24')]({'plain':!![]});var _0x344e51=_0x4935('0x25');return db[_0x4935('0x26')][_0x4935('0x23')]({'where':{'type':_0x344e51,'resourceId':_0x3786ff['id']}})[_0x4935('0x22')](function(){return _0x4dc1f5;});})[_0x4935('0x22')](function(){_0x52c65a[_0x4935('0x18')](0xcc)[_0x4935('0x19')]();});}};}function handleEntityNotFound(_0x2c47ab,_0xbb00d6){return function(_0x359522){if(!_0x359522){_0x2c47ab['sendStatus'](0x194);}return _0x359522;};}function handleError(_0x5c3aaa,_0x5cec4d){_0x5cec4d=_0x5cec4d||0x1f4;return function(_0x1fc218){logger[_0x4935('0x27')](_0x1fc218['stack']);if(_0x1fc218[_0x4935('0x28')]){delete _0x1fc218[_0x4935('0x28')];}_0x5c3aaa[_0x4935('0x18')](_0x5cec4d)[_0x4935('0x29')](_0x1fc218);};}exports[_0x4935('0x2a')]=function(_0x24262e,_0x28afc2){var _0x2fe6da={},_0x5b3c8e={},_0xb7fe2a={'count':0x0,'rows':[]};var _0x2dcb0b=_['map'](db['VoiceMail'][_0x4935('0x2b')],function(_0x479d28){return{'name':_0x479d28[_0x4935('0x2c')],'type':_0x479d28[_0x4935('0x2d')][_0x4935('0x2e')]};});_0x5b3c8e['model']=_['map'](_0x2dcb0b,_0x4935('0x28'));_0x5b3c8e[_0x4935('0x2f')]=_['keys'](_0x24262e[_0x4935('0x2f')]);_0x5b3c8e[_0x4935('0x30')]=_[_0x4935('0x31')](_0x5b3c8e[_0x4935('0x32')],_0x5b3c8e[_0x4935('0x2f')]);_0x2fe6da['attributes']=_['intersection'](_0x5b3c8e[_0x4935('0x32')],qs[_0x4935('0x33')](_0x24262e['query']['fields']));_0x2fe6da[_0x4935('0x34')]=_0x2fe6da['attributes'][_0x4935('0x35')]?_0x2fe6da[_0x4935('0x34')]:_0x5b3c8e[_0x4935('0x32')];if(!_0x24262e[_0x4935('0x2f')][_0x4935('0x36')](_0x4935('0x37'))){_0x2fe6da['limit']=qs[_0x4935('0x1c')](_0x24262e['query'][_0x4935('0x1c')]);_0x2fe6da['offset']=qs[_0x4935('0x38')](_0x24262e['query'][_0x4935('0x38')]);}_0x2fe6da[_0x4935('0x39')]=qs[_0x4935('0x3a')](_0x24262e[_0x4935('0x2f')][_0x4935('0x3a')]);_0x2fe6da[_0x4935('0x3b')]=qs[_0x4935('0x30')](_['pick'](_0x24262e['query'],_0x5b3c8e[_0x4935('0x30')]),_0x2dcb0b);if(_0x24262e['query']['filter']){_0x2fe6da[_0x4935('0x3b')]=_['merge'](_0x2fe6da[_0x4935('0x3b')],{'$or':_[_0x4935('0x3c')](_0x2dcb0b,function(_0x2d67e3){if(_0x2d67e3[_0x4935('0x2d')]!==_0x4935('0x3d')){var _0x53aac5={};_0x53aac5[_0x2d67e3['name']]={'$like':'%'+_0x24262e[_0x4935('0x2f')][_0x4935('0x3e')]+'%'};return _0x53aac5;}})});}_0x2fe6da=_[_0x4935('0x3f')]({},_0x2fe6da,_0x24262e[_0x4935('0x40')]);var _0x4d9436={'where':_0x2fe6da[_0x4935('0x3b')]};return db[_0x4935('0x41')][_0x4935('0x1d')](_0x4d9436)['then'](function(_0x4e94f6){_0xb7fe2a[_0x4935('0x1d')]=_0x4e94f6;if(_0x24262e[_0x4935('0x2f')]['includeAll']){_0x2fe6da[_0x4935('0x42')]=[{'all':!![]}];}return db[_0x4935('0x41')][_0x4935('0x43')](_0x2fe6da);})[_0x4935('0x22')](function(_0x52ab0c){_0xb7fe2a['rows']=_0x52ab0c;return _0xb7fe2a;})[_0x4935('0x22')](respondWithFilteredResult(_0x28afc2,_0x2fe6da))[_0x4935('0x44')](handleError(_0x28afc2,null));};exports['show']=function(_0x1eaa47,_0x40f5ff){var _0x2195da={'raw':!![],'where':{'id':_0x1eaa47[_0x4935('0x45')]['id']}},_0x5135fd={};_0x5135fd[_0x4935('0x32')]=_[_0x4935('0x46')](db[_0x4935('0x41')][_0x4935('0x2b')]);_0x5135fd[_0x4935('0x2f')]=_[_0x4935('0x46')](_0x1eaa47[_0x4935('0x2f')]);_0x5135fd[_0x4935('0x30')]=_[_0x4935('0x31')](_0x5135fd[_0x4935('0x32')],_0x5135fd[_0x4935('0x2f')]);_0x2195da[_0x4935('0x34')]=_[_0x4935('0x31')](_0x5135fd[_0x4935('0x32')],qs[_0x4935('0x33')](_0x1eaa47[_0x4935('0x2f')][_0x4935('0x33')]));_0x2195da['attributes']=_0x2195da[_0x4935('0x34')]['length']?_0x2195da[_0x4935('0x34')]:_0x5135fd[_0x4935('0x32')];if(_0x1eaa47[_0x4935('0x2f')][_0x4935('0x47')]){_0x2195da['include']=[{'all':!![]}];}_0x2195da=_[_0x4935('0x3f')]({},_0x2195da,_0x1eaa47[_0x4935('0x40')]);return db[_0x4935('0x41')][_0x4935('0x48')](_0x2195da)[_0x4935('0x22')](handleEntityNotFound(_0x40f5ff,null))[_0x4935('0x22')](respondWithResult(_0x40f5ff,null))[_0x4935('0x44')](handleError(_0x40f5ff,null));};exports[_0x4935('0x49')]=function(_0x29b932,_0x392cba){return db['VoiceMail'][_0x4935('0x49')](_0x29b932[_0x4935('0x4a')],{})['then'](function(_0x447a64){var _0x2636f4=_0x29b932[_0x4935('0x4b')][_0x4935('0x24')]({'plain':!![]});if(!_0x2636f4)throw new Error(_0x4935('0x4c'));if(_0x2636f4[_0x4935('0x4d')]===_0x4935('0x4b')){var _0x471fb1=_0x447a64['get']({'plain':!![]});var _0x57d0d9='Voicemails';return db['UserProfileSection'][_0x4935('0x48')]({'where':{'name':_0x57d0d9,'userProfileId':_0x2636f4[_0x4935('0x4e')]},'raw':!![]})[_0x4935('0x22')](function(_0x2072df){if(_0x2072df&&_0x2072df[_0x4935('0x4f')]===0x0){return db['UserProfileResource'][_0x4935('0x49')]({'name':_0x471fb1[_0x4935('0x28')],'resourceId':_0x471fb1['id'],'type':_0x2072df[_0x4935('0x28')],'sectionId':_0x2072df['id']},{})[_0x4935('0x22')](function(){return _0x447a64;});}else{return _0x447a64;}})[_0x4935('0x44')](function(_0x8196b4){logger[_0x4935('0x27')](_0x4935('0x50'),_0x8196b4);throw _0x8196b4;});}return _0x447a64;})[_0x4935('0x22')](respondWithResult(_0x392cba,0xc9))[_0x4935('0x44')](handleError(_0x392cba,null));};exports['update']=function(_0x24b83b,_0x4e99bb){if(_0x24b83b[_0x4935('0x4a')]['id']){delete _0x24b83b[_0x4935('0x4a')]['id'];}return db['VoiceMail'][_0x4935('0x48')]({'where':{'id':_0x24b83b['params']['id']}})['then'](handleEntityNotFound(_0x4e99bb,null))['then'](saveUpdates(_0x24b83b[_0x4935('0x4a')],null))[_0x4935('0x22')](respondWithResult(_0x4e99bb,null))[_0x4935('0x44')](handleError(_0x4e99bb,null));};exports[_0x4935('0x23')]=function(_0xd5a489,_0x56db7f){return db['VoiceMail'][_0x4935('0x48')]({'where':{'id':_0xd5a489[_0x4935('0x45')]['id']}})[_0x4935('0x22')](handleEntityNotFound(_0x56db7f,null))['then'](removeEntity(_0x56db7f,null))[_0x4935('0x44')](handleError(_0x56db7f,null));};exports[_0x4935('0x51')]=function(_0x24141a,_0xc92288,_0x5009c9){return db[_0x4935('0x41')]['findOne']({'where':{'id':_0x24141a['params']['id']}})['then'](handleEntityNotFound(_0xc92288,null))[_0x4935('0x22')](function(_0x10cd78){var _0x47e73d;var _0x3190d2={},_0x395eba={};_0x395eba['model']=_[_0x4935('0x46')](db[_0x4935('0x52')][_0x4935('0x2b')]);_0x395eba[_0x4935('0x2f')]=_[_0x4935('0x46')](_0x24141a[_0x4935('0x2f')]);_0x395eba[_0x4935('0x30')]=_['intersection'](_0x395eba[_0x4935('0x32')],_0x395eba['query']);_0x3190d2['attributes']=_[_0x4935('0x31')](_0x395eba[_0x4935('0x32')],qs['fields'](_0x24141a['query'][_0x4935('0x33')]));_0x3190d2[_0x4935('0x34')]=_0x3190d2[_0x4935('0x34')]['length']?_0x3190d2[_0x4935('0x34')]:_0x395eba['model'];if(!_0x24141a[_0x4935('0x2f')][_0x4935('0x36')](_0x4935('0x37'))){_0x3190d2[_0x4935('0x1c')]=qs[_0x4935('0x1c')](_0x24141a['query'][_0x4935('0x1c')]);_0x3190d2[_0x4935('0x38')]=qs['offset'](_0x24141a[_0x4935('0x2f')][_0x4935('0x38')]);}_0x3190d2[_0x4935('0x39')]=qs[_0x4935('0x3a')](_0x24141a[_0x4935('0x2f')][_0x4935('0x3a')]);_0x3190d2[_0x4935('0x3b')]=qs[_0x4935('0x30')](_[_0x4935('0x53')](_0x24141a[_0x4935('0x2f')],_0x395eba[_0x4935('0x30')]));if(_0x24141a['query'][_0x4935('0x3e')]){_0x3190d2[_0x4935('0x3b')]=_[_0x4935('0x3f')](_0x3190d2[_0x4935('0x3b')],{'$or':_[_0x4935('0x3c')](_0x3190d2[_0x4935('0x34')],function(_0x2c06f5){var _0x9023e={};_0x9023e[_0x2c06f5]={'$like':'%'+_0x24141a[_0x4935('0x2f')][_0x4935('0x3e')]+'%'};return _0x9023e;})});}_0x3190d2[_0x4935('0x3b')]=_[_0x4935('0x3f')](_0x3190d2[_0x4935('0x3b')],{'mailboxuser':_0x10cd78['mailbox']});_0x3190d2=_['merge']({},_0x3190d2,_0x24141a[_0x4935('0x40')]);return db[_0x4935('0x52')]['findAndCountAll'](_0x3190d2)[_0x4935('0x22')](respondWithFilteredResult(_0xc92288,_0x3190d2));})[_0x4935('0x44')](handleError(_0xc92288,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 066dd0f..ed16fb1 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 _0x2942=['voice_voicemail','mailbox','context','util','api','moment','bluebird','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2942,0xc7));var _0x2294=function(_0x38c07a,_0x2fb3c7){_0x38c07a=_0x38c07a-0x0;var _0x5c6641=_0x2942[_0x38c07a];return _0x5c6641;};'use strict';var _=require('lodash');var util=require(_0x2294('0x0'));var logger=require('../../config/logger')(_0x2294('0x1'));var moment=require(_0x2294('0x2'));var BPromise=require(_0x2294('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2294('0x4'));var rimraf=require(_0x2294('0x5'));var config=require(_0x2294('0x6'));var attributes=require(_0x2294('0x7'));module[_0x2294('0x8')]=function(_0x5876ea,_0x4af4b9){return _0x5876ea[_0x2294('0x9')](_0x2294('0xa'),attributes,{'tableName':_0x2294('0xb'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x2294('0xc'),_0x2294('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3efb=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./voiceMail.attributes','exports','define','voice_voicemail','mailbox_context','mailbox','context','lodash','util'];(function(_0x4c8b17,_0x5aa850){var _0x40be22=function(_0x1459bf){while(--_0x1459bf){_0x4c8b17['push'](_0x4c8b17['shift']());}};_0x40be22(++_0x5aa850);}(_0x3efb,0x1a2));var _0xb3ef=function(_0x396466,_0xe9857b){_0x396466=_0x396466-0x0;var _0x5e9ab4=_0x3efb[_0x396466];return _0x5e9ab4;};'use strict';var _=require(_0xb3ef('0x0'));var util=require(_0xb3ef('0x1'));var logger=require(_0xb3ef('0x2'))('api');var moment=require(_0xb3ef('0x3'));var BPromise=require('bluebird');var rp=require(_0xb3ef('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb3ef('0x5'));var config=require(_0xb3ef('0x6'));var attributes=require(_0xb3ef('0x7'));module[_0xb3ef('0x8')]=function(_0x216dc8,_0x6b554e){return _0x216dc8[_0xb3ef('0x9')]('VoiceMail',attributes,{'tableName':_0xb3ef('0xa'),'paranoid':![],'indexes':[{'name':_0xb3ef('0xb'),'fields':[_0xb3ef('0xc'),_0xb3ef('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index de0f59c..f7a151d 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 _0xf62f=['VoiceMail,\x20%s,\x20%s,\x20%s','error','VoiceMail,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug'];(function(_0x2f5594,_0x57f361){var _0x4763f1=function(_0x5743d7){while(--_0x5743d7){_0x2f5594['push'](_0x2f5594['shift']());}};_0x4763f1(++_0x57f361);}(_0xf62f,0x14f));var _0xff62=function(_0x45bc2b,_0x3499a5){_0x45bc2b=_0x45bc2b-0x0;var _0x2c7e67=_0xf62f[_0x45bc2b];return _0x2c7e67;};'use strict';var _=require(_0xff62('0x0'));var util=require(_0xff62('0x1'));var moment=require(_0xff62('0x2'));var BPromise=require('bluebird');var rs=require(_0xff62('0x3'));var fs=require('fs');var Redis=require(_0xff62('0x4'));var db=require(_0xff62('0x5'))['db'];var utils=require(_0xff62('0x6'));var logger=require(_0xff62('0x7'))(_0xff62('0x8'));var config=require(_0xff62('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xff62('0xa')][_0xff62('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bd158,_0x41f56c,_0x53e540){return new BPromise(function(_0x5ddbba,_0x12d4ee){return client[_0xff62('0xc')](_0x1bd158,_0x53e540)[_0xff62('0xd')](function(_0x144ce8){logger[_0xff62('0xe')]('VoiceMail,\x20%s,\x20%s',_0x41f56c,_0xff62('0xf'));logger[_0xff62('0x10')](_0xff62('0x11'),_0x41f56c,'request\x20sent',JSON['stringify'](_0x144ce8));if(_0x144ce8[_0xff62('0x12')]){if(_0x144ce8[_0xff62('0x12')]['code']===0x1f4){logger['error'](_0xff62('0x13'),_0x41f56c,_0x144ce8[_0xff62('0x12')][_0xff62('0x14')]);return _0x12d4ee(_0x144ce8['error'][_0xff62('0x14')]);}logger[_0xff62('0x12')]('VoiceMail,\x20%s,\x20%s',_0x41f56c,_0x144ce8['error'][_0xff62('0x14')]);return _0x5ddbba(_0x144ce8['error']['message']);}else{logger[_0xff62('0xe')]('VoiceMail,\x20%s,\x20%s',_0x41f56c,_0xff62('0xf'));_0x5ddbba(_0x144ce8[_0xff62('0x15')]['message']);}})['catch'](function(_0x3815cd){logger[_0xff62('0x12')](_0xff62('0x13'),_0x41f56c,_0x3815cd);_0x12d4ee(_0x3815cd);});});} \ No newline at end of file +var _0xeaf4=['result','util','moment','randomstring','ioredis','../../config/utils','../../config/environment','client','then','VoiceMail,\x20%s,\x20%s','debug','error','message','request\x20sent'];(function(_0x360a18,_0x2945ce){var _0x52e49c=function(_0x2b1673){while(--_0x2b1673){_0x360a18['push'](_0x360a18['shift']());}};_0x52e49c(++_0x2945ce);}(_0xeaf4,0x197));var _0x4eaf=function(_0x2e2848,_0x3c6c11){_0x2e2848=_0x2e2848-0x0;var _0x2c7a31=_0xeaf4[_0x2e2848];return _0x2c7a31;};'use strict';var _=require('lodash');var util=require(_0x4eaf('0x0'));var moment=require(_0x4eaf('0x1'));var BPromise=require('bluebird');var rs=require(_0x4eaf('0x2'));var fs=require('fs');var Redis=require(_0x4eaf('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4eaf('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4eaf('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x4eaf('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1171b3,_0x48dc0b,_0x48f5fd){return new BPromise(function(_0x59db66,_0x545acb){return client['request'](_0x1171b3,_0x48f5fd)[_0x4eaf('0x7')](function(_0x28a2aa){logger['info'](_0x4eaf('0x8'),_0x48dc0b,'request\x20sent');logger[_0x4eaf('0x9')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x48dc0b,'request\x20sent',JSON['stringify'](_0x28a2aa));if(_0x28a2aa[_0x4eaf('0xa')]){if(_0x28a2aa[_0x4eaf('0xa')]['code']===0x1f4){logger[_0x4eaf('0xa')](_0x4eaf('0x8'),_0x48dc0b,_0x28a2aa[_0x4eaf('0xa')]['message']);return _0x545acb(_0x28a2aa['error'][_0x4eaf('0xb')]);}logger[_0x4eaf('0xa')](_0x4eaf('0x8'),_0x48dc0b,_0x28a2aa['error'][_0x4eaf('0xb')]);return _0x59db66(_0x28a2aa[_0x4eaf('0xa')][_0x4eaf('0xb')]);}else{logger['info'](_0x4eaf('0x8'),_0x48dc0b,_0x4eaf('0xc'));_0x59db66(_0x28a2aa[_0x4eaf('0xd')][_0x4eaf('0xb')]);}})['catch'](function(_0x3a498a){logger[_0x4eaf('0xa')](_0x4eaf('0x8'),_0x48dc0b,_0x3a498a);_0x545acb(_0x3a498a);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 31745bc..d76b6c7 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 _0xaf55=['destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','isAuthenticated','get','show','/:id/download','download','create','put','/:id','update','delete'];(function(_0x23a34a,_0x20b67c){var _0x3c24e4=function(_0x590917){while(--_0x590917){_0x23a34a['push'](_0x23a34a['shift']());}};_0x3c24e4(++_0x20b67c);}(_0xaf55,0x106));var _0x5af5=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xaf55[_0x8c43de];return _0xa6591b;};'use strict';var multer=require(_0x5af5('0x0'));var util=require(_0x5af5('0x1'));var path=require(_0x5af5('0x2'));var timeout=require('connect-timeout');var express=require(_0x5af5('0x3'));var router=express[_0x5af5('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5af5('0x5'));var config=require(_0x5af5('0x6'));var controller=require(_0x5af5('0x7'));router['get']('/',auth[_0x5af5('0x8')](),controller['index']);router[_0x5af5('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x5af5('0xa')]);router[_0x5af5('0x9')](_0x5af5('0xb'),auth['isAuthenticated'](),controller[_0x5af5('0xc')]);router['post']('/',auth[_0x5af5('0x8')](),controller[_0x5af5('0xd')]);router[_0x5af5('0xe')](_0x5af5('0xf'),auth['isAuthenticated'](),controller[_0x5af5('0x10')]);router[_0x5af5('0x11')](_0x5af5('0xf'),auth[_0x5af5('0x8')](),controller[_0x5af5('0x12')]);module[_0x5af5('0x13')]=router; \ No newline at end of file +var _0x0c60=['put','/:id','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','download','post','create'];(function(_0x93333e,_0x291bd7){var _0xbb3fc0=function(_0x28758e){while(--_0x28758e){_0x93333e['push'](_0x93333e['shift']());}};_0xbb3fc0(++_0x291bd7);}(_0x0c60,0x1cd));var _0x00c6=function(_0x19e714,_0x47dc41){_0x19e714=_0x19e714-0x0;var _0x248cf9=_0x0c60[_0x19e714];return _0x248cf9;};'use strict';var multer=require(_0x00c6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x00c6('0x1'));var express=require(_0x00c6('0x2'));var router=express[_0x00c6('0x3')]();var fs_extra=require(_0x00c6('0x4'));var auth=require(_0x00c6('0x5'));var interaction=require(_0x00c6('0x6'));var config=require(_0x00c6('0x7'));var controller=require(_0x00c6('0x8'));router[_0x00c6('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x00c6('0xa')](),controller['show']);router[_0x00c6('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0x00c6('0xb')]);router[_0x00c6('0xc')]('/',auth[_0x00c6('0xa')](),controller[_0x00c6('0xd')]);router[_0x00c6('0xe')](_0x00c6('0xf'),auth[_0x00c6('0xa')](),controller['update']);router[_0x00c6('0x10')](_0x00c6('0xf'),auth['isAuthenticated'](),controller[_0x00c6('0x11')]);module[_0x00c6('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 25f061d..4794139 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 _0xf7fb=['long','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports','VIRTUAL','INTEGER','STRING','BLOB'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xf7fb,0x1b3));var _0xbf7f=function(_0x55de75,_0x39d6b7){_0x55de75=_0x55de75-0x0;var _0x47192d=_0xf7fb[_0x55de75];return _0x47192d;};'use strict';var Sequelize=require('sequelize');module[_0xbf7f('0x0')]={'name':{'type':Sequelize[_0xbf7f('0x1')],'get':function(_0x37cadf){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0xbf7f('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xbf7f('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0xbf7f('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xbf7f('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0xbf7f('0x3')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xbf7f('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xbf7f('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0xbf7f('0x4')](_0xbf7f('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0xbf7f('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xbf7f('0x3')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0xbf7f('0x6')](_0xbf7f('0x7'))}}; \ No newline at end of file +var _0x4e41=['STRING','BLOB','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','INTEGER'];(function(_0x36be38,_0x50b484){var _0x10a629=function(_0x23b8d2){while(--_0x23b8d2){_0x36be38['push'](_0x36be38['shift']());}};_0x10a629(++_0x50b484);}(_0x4e41,0x17d));var _0x14e4=function(_0x26e40c,_0x238027){_0x26e40c=_0x26e40c-0x0;var _0x3a09c6=_0x4e41[_0x26e40c];return _0x3a09c6;};'use strict';var Sequelize=require(_0x14e4('0x0'));module[_0x14e4('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x25860b){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x14e4('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x14e4('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x14e4('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x14e4('0x3')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x14e4('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x14e4('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x14e4('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x14e4('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x14e4('0x4')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x14e4('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x14e4('0x3')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize['literal'](_0x14e4('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index ee2c335..ad16e9d 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 _0x0d51=['create','body','find','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','destroy','error','stack','name','map','VoiceMailMessage','rawAttributes','fieldName','key','model','differenceBy','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','type','options','then','include','findAll','catch','show','params','includeAll','merge'];(function(_0x3ef400,_0x107ab3){var _0x46ee2a=function(_0x1eebe4){while(--_0x1eebe4){_0x3ef400['push'](_0x3ef400['shift']());}};_0x46ee2a(++_0x107ab3);}(_0x0d51,0xbf));var _0x10d5=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x0d51[_0x5c2e3e];return _0x53f64a;};'use strict';var emlformat=require(_0x10d5('0x0'));var rimraf=require(_0x10d5('0x1'));var zipdir=require(_0x10d5('0x2'));var jsonpatch=require(_0x10d5('0x3'));var rp=require(_0x10d5('0x4'));var moment=require(_0x10d5('0x5'));var BPromise=require(_0x10d5('0x6'));var Mustache=require(_0x10d5('0x7'));var util=require('util');var path=require(_0x10d5('0x8'));var sox=require(_0x10d5('0x9'));var csv=require(_0x10d5('0xa'));var ejs=require(_0x10d5('0xb'));var fs=require('fs');var fs_extra=require(_0x10d5('0xc'));var _=require(_0x10d5('0xd'));var squel=require(_0x10d5('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x10d5('0xf'));var toCsv=require(_0x10d5('0xa'));var querystring=require(_0x10d5('0x10'));var Papa=require(_0x10d5('0x11'));var Redis=require('ioredis');var authService=require(_0x10d5('0x12'));var qs=require(_0x10d5('0x13'));var as=require(_0x10d5('0x14'));var hardwareService=require(_0x10d5('0x15'));var logger=require(_0x10d5('0x16'))(_0x10d5('0x17'));var utils=require(_0x10d5('0x18'));var config=require(_0x10d5('0x19'));var licenseUtil=require(_0x10d5('0x1a'));var db=require(_0x10d5('0x1b'))['db'];function respondWithStatusCode(_0x5063d7,_0x35e3af){_0x35e3af=_0x35e3af||0xcc;return function(_0x34cddc){if(_0x34cddc){return _0x5063d7[_0x10d5('0x1c')](_0x35e3af);}return _0x5063d7['status'](_0x35e3af)[_0x10d5('0x1d')]();};}function respondWithResult(_0x206234,_0x1d7fbc){_0x1d7fbc=_0x1d7fbc||0xc8;return function(_0x20ce99){if(_0x20ce99){return _0x206234[_0x10d5('0x1e')](_0x1d7fbc)['json'](_0x20ce99);}};}function respondWithFilteredResult(_0x4b3674,_0x46a578){return function(_0x5d8f3b){if(_0x5d8f3b){var _0x39d71b=typeof _0x46a578[_0x10d5('0x1f')]===_0x10d5('0x20')&&typeof _0x46a578[_0x10d5('0x21')]==='undefined';var _0x590a7d=_0x5d8f3b[_0x10d5('0x22')];var _0x10c995=_0x39d71b?0x0:_0x46a578['offset'];var _0x3f9880=_0x39d71b?_0x5d8f3b[_0x10d5('0x22')]:_0x46a578[_0x10d5('0x1f')]+_0x46a578[_0x10d5('0x21')];var _0xbbc151;if(_0x3f9880>=_0x590a7d){_0x3f9880=_0x590a7d;_0xbbc151=0xc8;}else{_0xbbc151=0xce;}_0x4b3674[_0x10d5('0x1e')](_0xbbc151);return _0x4b3674['set'](_0x10d5('0x23'),_0x10c995+'-'+_0x3f9880+'/'+_0x590a7d)[_0x10d5('0x24')](_0x5d8f3b);}return null;};}function patchUpdates(_0x2df003){return function(_0x1552ae){try{jsonpatch[_0x10d5('0x25')](_0x1552ae,_0x2df003,!![]);}catch(_0x19a3dc){return BPromise[_0x10d5('0x26')](_0x19a3dc);}return _0x1552ae[_0x10d5('0x27')]();};}function saveUpdates(_0x2a26a2,_0xda370c){return function(_0x28e81f){if(_0x28e81f){return _0x28e81f[_0x10d5('0x28')](_0x2a26a2)['then'](function(_0x486039){return _0x486039;});}return null;};}function removeEntity(_0x1470b3,_0x165129){return function(_0x259fb2){if(_0x259fb2){return _0x259fb2[_0x10d5('0x29')]()['then'](function(){_0x1470b3[_0x10d5('0x1e')](0xcc)[_0x10d5('0x1d')]();});}};}function handleEntityNotFound(_0x38771f,_0x339d25){return function(_0x179828){if(!_0x179828){_0x38771f[_0x10d5('0x1c')](0x194);}return _0x179828;};}function handleError(_0x3f7763,_0x109575){_0x109575=_0x109575||0x1f4;return function(_0x223868){logger[_0x10d5('0x2a')](_0x223868[_0x10d5('0x2b')]);if(_0x223868[_0x10d5('0x2c')]){delete _0x223868[_0x10d5('0x2c')];}_0x3f7763[_0x10d5('0x1e')](_0x109575)['send'](_0x223868);};}exports['index']=function(_0x33140a,_0x5106b4){var _0x599366={},_0x223907={},_0x53485f={'count':0x0,'rows':[]};var _0x38ea3c=_[_0x10d5('0x2d')](db[_0x10d5('0x2e')][_0x10d5('0x2f')],function(_0x101d42){return{'name':_0x101d42[_0x10d5('0x30')],'type':_0x101d42['type'][_0x10d5('0x31')]};});_0x223907[_0x10d5('0x32')]=_[_0x10d5('0x33')](_[_0x10d5('0x2d')](_0x38ea3c,_0x10d5('0x2c')),[_0x10d5('0x2c')]);_0x223907[_0x10d5('0x34')]=_[_0x10d5('0x35')](_0x33140a[_0x10d5('0x34')]);_0x223907['filters']=_[_0x10d5('0x36')](_0x223907[_0x10d5('0x32')],_0x223907[_0x10d5('0x34')]);_0x599366['attributes']=_['intersection'](_0x223907['model'],qs['fields'](_0x33140a[_0x10d5('0x34')][_0x10d5('0x37')]));_0x599366[_0x10d5('0x38')]=_0x599366[_0x10d5('0x38')][_0x10d5('0x39')]?_0x599366[_0x10d5('0x38')]:_0x223907[_0x10d5('0x32')];if(!_0x33140a[_0x10d5('0x34')][_0x10d5('0x3a')](_0x10d5('0x3b'))){_0x599366['limit']=qs[_0x10d5('0x21')](_0x33140a['query'][_0x10d5('0x21')]);_0x599366['offset']=qs[_0x10d5('0x1f')](_0x33140a['query']['offset']);}_0x599366[_0x10d5('0x3c')]=qs[_0x10d5('0x3d')](_0x33140a[_0x10d5('0x34')]['sort']);_0x599366[_0x10d5('0x3e')]=qs['filters'](_[_0x10d5('0x3f')](_0x33140a[_0x10d5('0x34')],_0x223907[_0x10d5('0x40')]),_0x38ea3c);if(_0x33140a[_0x10d5('0x34')][_0x10d5('0x41')]){_0x599366[_0x10d5('0x3e')]=_['merge'](_0x599366[_0x10d5('0x3e')],{'$or':_[_0x10d5('0x2d')](_0x38ea3c,function(_0x18647c){if(_0x18647c[_0x10d5('0x42')]!=='VIRTUAL'){var _0x309b63={};_0x309b63[_0x18647c[_0x10d5('0x2c')]]={'$like':'%'+_0x33140a[_0x10d5('0x34')][_0x10d5('0x41')]+'%'};return _0x309b63;}})});}_0x599366=_['merge']({},_0x599366,_0x33140a[_0x10d5('0x43')]);var _0x5ec16a={'where':_0x599366['where']};return db[_0x10d5('0x2e')]['count'](_0x5ec16a)[_0x10d5('0x44')](function(_0x5d5cc2){_0x53485f['count']=_0x5d5cc2;if(_0x33140a['query']['includeAll']){_0x599366[_0x10d5('0x45')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0x10d5('0x46')](_0x599366);})[_0x10d5('0x44')](function(_0x1156f0){_0x53485f['rows']=_0x1156f0;return _0x53485f;})[_0x10d5('0x44')](respondWithFilteredResult(_0x5106b4,_0x599366))[_0x10d5('0x47')](handleError(_0x5106b4,null));};exports[_0x10d5('0x48')]=function(_0x524f5b,_0x2500be){var _0x4777cf={'raw':!![],'where':{'id':_0x524f5b[_0x10d5('0x49')]['id']}},_0x1b409d={};_0x1b409d[_0x10d5('0x32')]=_['keys'](db['VoiceMailMessage'][_0x10d5('0x2f')]);_0x1b409d['query']=_[_0x10d5('0x35')](_0x524f5b['query']);_0x1b409d['filters']=_[_0x10d5('0x36')](_0x1b409d['model'],_0x1b409d[_0x10d5('0x34')]);_0x4777cf[_0x10d5('0x38')]=_[_0x10d5('0x36')](_0x1b409d[_0x10d5('0x32')],qs[_0x10d5('0x37')](_0x524f5b[_0x10d5('0x34')][_0x10d5('0x37')]));_0x4777cf[_0x10d5('0x38')]=_0x4777cf[_0x10d5('0x38')]['length']?_0x4777cf[_0x10d5('0x38')]:_0x1b409d[_0x10d5('0x32')];if(_0x524f5b['query'][_0x10d5('0x4a')]){_0x4777cf[_0x10d5('0x45')]=[{'all':!![]}];}_0x4777cf=_[_0x10d5('0x4b')]({},_0x4777cf,_0x524f5b['options']);return db[_0x10d5('0x2e')]['find'](_0x4777cf)[_0x10d5('0x44')](handleEntityNotFound(_0x2500be,null))[_0x10d5('0x44')](respondWithResult(_0x2500be,null))['catch'](handleError(_0x2500be,null));};exports['create']=function(_0x3b27e6,_0x102675){return db[_0x10d5('0x2e')][_0x10d5('0x4c')](_0x3b27e6[_0x10d5('0x4d')],{})[_0x10d5('0x44')](respondWithResult(_0x102675,0xc9))[_0x10d5('0x47')](handleError(_0x102675,null));};exports[_0x10d5('0x28')]=function(_0x7a0af2,_0x1bd4da){if(_0x7a0af2[_0x10d5('0x4d')]['id']){delete _0x7a0af2[_0x10d5('0x4d')]['id'];}return db['VoiceMailMessage'][_0x10d5('0x4e')]({'where':{'id':_0x7a0af2['params']['id']}})[_0x10d5('0x44')](handleEntityNotFound(_0x1bd4da,null))[_0x10d5('0x44')](saveUpdates(_0x7a0af2[_0x10d5('0x4d')],null))[_0x10d5('0x44')](respondWithResult(_0x1bd4da,null))['catch'](handleError(_0x1bd4da,null));};exports['destroy']=function(_0x21feed,_0x590b4a){return db[_0x10d5('0x2e')][_0x10d5('0x4e')]({'where':{'id':_0x21feed[_0x10d5('0x49')]['id']}})[_0x10d5('0x44')](handleEntityNotFound(_0x590b4a,null))[_0x10d5('0x44')](removeEntity(_0x590b4a,null))['catch'](handleError(_0x590b4a,null));};exports[_0x10d5('0x4f')]=function(_0x4ac268,_0x2261ec,_0x1b4484){return db[_0x10d5('0x2e')][_0x10d5('0x4e')]({'where':{'id':_0x4ac268[_0x10d5('0x49')]['id']},'attributes':['id',_0x10d5('0x50'),_0x10d5('0x51')]})[_0x10d5('0x44')](handleEntityNotFound(_0x2261ec,null))[_0x10d5('0x44')](function(_0x414cbc){if(_0x414cbc){if(!_0x414cbc[_0x10d5('0x50')]){throw new db[(_0x10d5('0x52'))][(_0x10d5('0x53'))](_0x10d5('0x54'));}var _0x440bd9={'Content-Type':_0x10d5('0x55'),'Content-Disposition':_0x10d5('0x56')};if(_0x414cbc['msg_id']){_0x440bd9[_0x10d5('0x57')]='attachment;\x20filename=\x22'+_0x414cbc[_0x10d5('0x51')]+'.wav\x22';}_0x2261ec['set'](_0x440bd9);return _0x2261ec[_0x10d5('0x58')](new Buffer(_0x414cbc[_0x10d5('0x50')]));}})[_0x10d5('0x47')](handleError(_0x2261ec,null));}; \ No newline at end of file +var _0x0fe1=['fieldName','type','key','differenceBy','query','keys','filters','intersection','attributes','model','fields','length','order','sort','where','pick','merge','VIRTUAL','options','include','findAll','rows','show','includeAll','find','catch','create','body','params','destroy','msg_id','recording','Sequelize','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','set','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','Content-Range','json','save','update','then','end','error','stack','name','send','index','VoiceMailMessage','rawAttributes'];(function(_0x3f2dba,_0x604c23){var _0x534a29=function(_0x5745b3){while(--_0x5745b3){_0x3f2dba['push'](_0x3f2dba['shift']());}};_0x534a29(++_0x604c23);}(_0x0fe1,0x17f));var _0x10fe=function(_0x22b80f,_0x63ff14){_0x22b80f=_0x22b80f-0x0;var _0x4c7a4e=_0x0fe1[_0x22b80f];return _0x4c7a4e;};'use strict';var emlformat=require(_0x10fe('0x0'));var rimraf=require(_0x10fe('0x1'));var zipdir=require(_0x10fe('0x2'));var jsonpatch=require(_0x10fe('0x3'));var rp=require(_0x10fe('0x4'));var moment=require(_0x10fe('0x5'));var BPromise=require(_0x10fe('0x6'));var Mustache=require(_0x10fe('0x7'));var util=require(_0x10fe('0x8'));var path=require(_0x10fe('0x9'));var sox=require(_0x10fe('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x10fe('0xb'));var _=require(_0x10fe('0xc'));var squel=require(_0x10fe('0xd'));var crypto=require(_0x10fe('0xe'));var jsforce=require(_0x10fe('0xf'));var deskjs=require(_0x10fe('0x10'));var toCsv=require(_0x10fe('0x11'));var querystring=require(_0x10fe('0x12'));var Papa=require(_0x10fe('0x13'));var Redis=require(_0x10fe('0x14'));var authService=require(_0x10fe('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x10fe('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x10fe('0x17'))('api');var utils=require(_0x10fe('0x18'));var config=require(_0x10fe('0x19'));var licenseUtil=require(_0x10fe('0x1a'));var db=require(_0x10fe('0x1b'))['db'];function respondWithStatusCode(_0x37f5de,_0x4f2c55){_0x4f2c55=_0x4f2c55||0xcc;return function(_0x2a25e9){if(_0x2a25e9){return _0x37f5de[_0x10fe('0x1c')](_0x4f2c55);}return _0x37f5de[_0x10fe('0x1d')](_0x4f2c55)['end']();};}function respondWithResult(_0x16074c,_0x5bdfe3){_0x5bdfe3=_0x5bdfe3||0xc8;return function(_0x2b7349){if(_0x2b7349){return _0x16074c['status'](_0x5bdfe3)['json'](_0x2b7349);}};}function respondWithFilteredResult(_0x5afc4f,_0x44fd36){return function(_0x3214bd){if(_0x3214bd){var _0xf05d81=typeof _0x44fd36[_0x10fe('0x1e')]==='undefined'&&typeof _0x44fd36[_0x10fe('0x1f')]===_0x10fe('0x20');var _0x2dd291=_0x3214bd[_0x10fe('0x21')];var _0x38b37f=_0xf05d81?0x0:_0x44fd36[_0x10fe('0x1e')];var _0x50e939=_0xf05d81?_0x3214bd[_0x10fe('0x21')]:_0x44fd36[_0x10fe('0x1e')]+_0x44fd36['limit'];var _0x4f6d1e;if(_0x50e939>=_0x2dd291){_0x50e939=_0x2dd291;_0x4f6d1e=0xc8;}else{_0x4f6d1e=0xce;}_0x5afc4f['status'](_0x4f6d1e);return _0x5afc4f['set'](_0x10fe('0x22'),_0x38b37f+'-'+_0x50e939+'/'+_0x2dd291)[_0x10fe('0x23')](_0x3214bd);}return null;};}function patchUpdates(_0x22f412){return function(_0x4c80dd){try{jsonpatch['apply'](_0x4c80dd,_0x22f412,!![]);}catch(_0x16d056){return BPromise['reject'](_0x16d056);}return _0x4c80dd[_0x10fe('0x24')]();};}function saveUpdates(_0x3701f0,_0xac7e9c){return function(_0x21c1ec){if(_0x21c1ec){return _0x21c1ec[_0x10fe('0x25')](_0x3701f0)[_0x10fe('0x26')](function(_0x11a53a){return _0x11a53a;});}return null;};}function removeEntity(_0x49f248,_0x153c0c){return function(_0x5d0e25){if(_0x5d0e25){return _0x5d0e25['destroy']()[_0x10fe('0x26')](function(){_0x49f248['status'](0xcc)[_0x10fe('0x27')]();});}};}function handleEntityNotFound(_0x1e04b9,_0x42350b){return function(_0x2e64b8){if(!_0x2e64b8){_0x1e04b9[_0x10fe('0x1c')](0x194);}return _0x2e64b8;};}function handleError(_0x39b46b,_0x4b7d01){_0x4b7d01=_0x4b7d01||0x1f4;return function(_0x2f60d3){logger[_0x10fe('0x28')](_0x2f60d3[_0x10fe('0x29')]);if(_0x2f60d3['name']){delete _0x2f60d3[_0x10fe('0x2a')];}_0x39b46b['status'](_0x4b7d01)[_0x10fe('0x2b')](_0x2f60d3);};}exports[_0x10fe('0x2c')]=function(_0x490f31,_0x392aa8){var _0x26551c={},_0xb06a4b={},_0x541df4={'count':0x0,'rows':[]};var _0x4fbf7b=_['map'](db[_0x10fe('0x2d')][_0x10fe('0x2e')],function(_0x2c60c0){return{'name':_0x2c60c0[_0x10fe('0x2f')],'type':_0x2c60c0[_0x10fe('0x30')][_0x10fe('0x31')]};});_0xb06a4b['model']=_[_0x10fe('0x32')](_['map'](_0x4fbf7b,_0x10fe('0x2a')),[_0x10fe('0x2a')]);_0xb06a4b[_0x10fe('0x33')]=_[_0x10fe('0x34')](_0x490f31[_0x10fe('0x33')]);_0xb06a4b[_0x10fe('0x35')]=_[_0x10fe('0x36')](_0xb06a4b['model'],_0xb06a4b[_0x10fe('0x33')]);_0x26551c[_0x10fe('0x37')]=_['intersection'](_0xb06a4b[_0x10fe('0x38')],qs[_0x10fe('0x39')](_0x490f31['query'][_0x10fe('0x39')]));_0x26551c['attributes']=_0x26551c['attributes'][_0x10fe('0x3a')]?_0x26551c['attributes']:_0xb06a4b[_0x10fe('0x38')];if(!_0x490f31['query']['hasOwnProperty']('nolimit')){_0x26551c['limit']=qs[_0x10fe('0x1f')](_0x490f31[_0x10fe('0x33')][_0x10fe('0x1f')]);_0x26551c[_0x10fe('0x1e')]=qs[_0x10fe('0x1e')](_0x490f31[_0x10fe('0x33')]['offset']);}_0x26551c[_0x10fe('0x3b')]=qs[_0x10fe('0x3c')](_0x490f31[_0x10fe('0x33')][_0x10fe('0x3c')]);_0x26551c[_0x10fe('0x3d')]=qs[_0x10fe('0x35')](_[_0x10fe('0x3e')](_0x490f31['query'],_0xb06a4b[_0x10fe('0x35')]),_0x4fbf7b);if(_0x490f31[_0x10fe('0x33')]['filter']){_0x26551c[_0x10fe('0x3d')]=_[_0x10fe('0x3f')](_0x26551c[_0x10fe('0x3d')],{'$or':_['map'](_0x4fbf7b,function(_0x302fa9){if(_0x302fa9[_0x10fe('0x30')]!==_0x10fe('0x40')){var _0xbcb9e8={};_0xbcb9e8[_0x302fa9[_0x10fe('0x2a')]]={'$like':'%'+_0x490f31[_0x10fe('0x33')]['filter']+'%'};return _0xbcb9e8;}})});}_0x26551c=_['merge']({},_0x26551c,_0x490f31[_0x10fe('0x41')]);var _0x249b46={'where':_0x26551c[_0x10fe('0x3d')]};return db[_0x10fe('0x2d')][_0x10fe('0x21')](_0x249b46)[_0x10fe('0x26')](function(_0x247b5d){_0x541df4[_0x10fe('0x21')]=_0x247b5d;if(_0x490f31[_0x10fe('0x33')]['includeAll']){_0x26551c[_0x10fe('0x42')]=[{'all':!![]}];}return db[_0x10fe('0x2d')][_0x10fe('0x43')](_0x26551c);})[_0x10fe('0x26')](function(_0x2ff436){_0x541df4[_0x10fe('0x44')]=_0x2ff436;return _0x541df4;})['then'](respondWithFilteredResult(_0x392aa8,_0x26551c))['catch'](handleError(_0x392aa8,null));};exports[_0x10fe('0x45')]=function(_0x3cd75f,_0x1bb419){var _0x2c257d={'raw':!![],'where':{'id':_0x3cd75f['params']['id']}},_0xb0c771={};_0xb0c771[_0x10fe('0x38')]=_[_0x10fe('0x34')](db['VoiceMailMessage'][_0x10fe('0x2e')]);_0xb0c771[_0x10fe('0x33')]=_[_0x10fe('0x34')](_0x3cd75f[_0x10fe('0x33')]);_0xb0c771[_0x10fe('0x35')]=_[_0x10fe('0x36')](_0xb0c771[_0x10fe('0x38')],_0xb0c771[_0x10fe('0x33')]);_0x2c257d[_0x10fe('0x37')]=_['intersection'](_0xb0c771[_0x10fe('0x38')],qs['fields'](_0x3cd75f['query'][_0x10fe('0x39')]));_0x2c257d['attributes']=_0x2c257d['attributes']['length']?_0x2c257d[_0x10fe('0x37')]:_0xb0c771[_0x10fe('0x38')];if(_0x3cd75f[_0x10fe('0x33')][_0x10fe('0x46')]){_0x2c257d[_0x10fe('0x42')]=[{'all':!![]}];}_0x2c257d=_[_0x10fe('0x3f')]({},_0x2c257d,_0x3cd75f[_0x10fe('0x41')]);return db[_0x10fe('0x2d')][_0x10fe('0x47')](_0x2c257d)[_0x10fe('0x26')](handleEntityNotFound(_0x1bb419,null))[_0x10fe('0x26')](respondWithResult(_0x1bb419,null))[_0x10fe('0x48')](handleError(_0x1bb419,null));};exports[_0x10fe('0x49')]=function(_0x5bc0c8,_0x48a605){return db[_0x10fe('0x2d')][_0x10fe('0x49')](_0x5bc0c8['body'],{})[_0x10fe('0x26')](respondWithResult(_0x48a605,0xc9))['catch'](handleError(_0x48a605,null));};exports[_0x10fe('0x25')]=function(_0x3f9b39,_0x2fa0c8){if(_0x3f9b39[_0x10fe('0x4a')]['id']){delete _0x3f9b39[_0x10fe('0x4a')]['id'];}return db[_0x10fe('0x2d')][_0x10fe('0x47')]({'where':{'id':_0x3f9b39[_0x10fe('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2fa0c8,null))[_0x10fe('0x26')](saveUpdates(_0x3f9b39['body'],null))[_0x10fe('0x26')](respondWithResult(_0x2fa0c8,null))[_0x10fe('0x48')](handleError(_0x2fa0c8,null));};exports[_0x10fe('0x4c')]=function(_0x425070,_0x2d164a){return db[_0x10fe('0x2d')]['find']({'where':{'id':_0x425070[_0x10fe('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2d164a,null))[_0x10fe('0x26')](removeEntity(_0x2d164a,null))[_0x10fe('0x48')](handleError(_0x2d164a,null));};exports['download']=function(_0x24fd53,_0x249884,_0x2c1415){return db['VoiceMailMessage']['find']({'where':{'id':_0x24fd53['params']['id']},'attributes':['id','recording',_0x10fe('0x4d')]})[_0x10fe('0x26')](handleEntityNotFound(_0x249884,null))['then'](function(_0x6e8364){if(_0x6e8364){if(!_0x6e8364[_0x10fe('0x4e')]){throw new db[(_0x10fe('0x4f'))]['ValidationError']('VoiceMailMessage\x20not\x20found');}var _0x5aaaf6={'Content-Type':_0x10fe('0x50'),'Content-Disposition':_0x10fe('0x51')};if(_0x6e8364[_0x10fe('0x4d')]){_0x5aaaf6[_0x10fe('0x52')]=_0x10fe('0x53')+_0x6e8364[_0x10fe('0x4d')]+_0x10fe('0x54');}_0x249884[_0x10fe('0x55')](_0x5aaaf6);return _0x249884[_0x10fe('0x2b')](new Buffer(_0x6e8364['recording']));}})['catch'](handleError(_0x249884,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index cf2e45c..08491db 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 _0xbedf=['../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x3a1199,_0x1a2cbf){var _0x3e75c2=function(_0x26b0b5){while(--_0x26b0b5){_0x3a1199['push'](_0x3a1199['shift']());}};_0x3e75c2(++_0x1a2cbf);}(_0xbedf,0xac));var _0xfbed=function(_0x54defc,_0x627178){_0x54defc=_0x54defc-0x0;var _0x1955d3=_0xbedf[_0x54defc];return _0x1955d3;};'use strict';var _=require(_0xfbed('0x0'));var util=require(_0xfbed('0x1'));var logger=require(_0xfbed('0x2'))(_0xfbed('0x3'));var moment=require(_0xfbed('0x4'));var BPromise=require(_0xfbed('0x5'));var rp=require(_0xfbed('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfbed('0x7'));var config=require(_0xfbed('0x8'));var attributes=require(_0xfbed('0x9'));module[_0xfbed('0xa')]=function(_0x3c7092,_0x117344){return _0x3c7092[_0xfbed('0xb')](_0xfbed('0xc'),attributes,{'tableName':_0xfbed('0xd'),'paranoid':![],'indexes':[{'name':_0xfbed('0xe'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x1e13=['../../config/environment','exports','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x3345d1,_0x11fd37){var _0x48e0e5=function(_0xfaaf26){while(--_0xfaaf26){_0x3345d1['push'](_0x3345d1['shift']());}};_0x48e0e5(++_0x11fd37);}(_0x1e13,0xbb));var _0x31e1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1e13[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x31e1('0x0'));var util=require(_0x31e1('0x1'));var logger=require(_0x31e1('0x2'))(_0x31e1('0x3'));var moment=require(_0x31e1('0x4'));var BPromise=require(_0x31e1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x31e1('0x6'));var rimraf=require(_0x31e1('0x7'));var config=require(_0x31e1('0x8'));var attributes=require('./voiceMailMessage.attributes');module[_0x31e1('0x9')]=function(_0xaf19fd,_0xc20c7b){return _0xaf19fd['define'](_0x31e1('0xa'),attributes,{'tableName':_0x31e1('0xb'),'paranoid':![],'indexes':[{'name':_0x31e1('0xc'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 0ccd991..e5ef163 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 _0x3c98=['error','code','message','catch','util','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x35a2b7,_0x309591){var _0x29eaee=function(_0x50dd7f){while(--_0x50dd7f){_0x35a2b7['push'](_0x35a2b7['shift']());}};_0x29eaee(++_0x309591);}(_0x3c98,0xc2));var _0x83c9=function(_0x4c2c6f,_0x24faed){_0x4c2c6f=_0x4c2c6f-0x0;var _0xb8dfe1=_0x3c98[_0x4c2c6f];return _0xb8dfe1;};'use strict';var _=require('lodash');var util=require(_0x83c9('0x0'));var moment=require('moment');var BPromise=require(_0x83c9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x83c9('0x2'));var db=require(_0x83c9('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x83c9('0x4'));var config=require('../../config/environment');var jayson=require(_0x83c9('0x5'));var client=jayson[_0x83c9('0x6')][_0x83c9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x425f0b,_0x56c34b,_0x1aa352){return new BPromise(function(_0x46073d,_0x453a6c){return client[_0x83c9('0x8')](_0x425f0b,_0x1aa352)[_0x83c9('0x9')](function(_0x3f9da1){logger[_0x83c9('0xa')](_0x83c9('0xb'),_0x56c34b,'request\x20sent');logger[_0x83c9('0xc')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x56c34b,_0x83c9('0xd'),JSON[_0x83c9('0xe')](_0x3f9da1));if(_0x3f9da1['error']){if(_0x3f9da1[_0x83c9('0xf')][_0x83c9('0x10')]===0x1f4){logger[_0x83c9('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x56c34b,_0x3f9da1['error']['message']);return _0x453a6c(_0x3f9da1[_0x83c9('0xf')][_0x83c9('0x11')]);}logger[_0x83c9('0xf')](_0x83c9('0xb'),_0x56c34b,_0x3f9da1[_0x83c9('0xf')][_0x83c9('0x11')]);return _0x46073d(_0x3f9da1[_0x83c9('0xf')][_0x83c9('0x11')]);}else{logger[_0x83c9('0xa')](_0x83c9('0xb'),_0x56c34b,'request\x20sent');_0x46073d(_0x3f9da1['result'][_0x83c9('0x11')]);}})[_0x83c9('0x12')](function(_0x4b1fcf){logger[_0x83c9('0xf')](_0x83c9('0xb'),_0x56c34b,_0x4b1fcf);_0x453a6c(_0x4b1fcf);});});} \ No newline at end of file +var _0xe233=['catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x5b3ccd,_0x2fd728){var _0x1340d2=function(_0x4d3ea2){while(--_0x4d3ea2){_0x5b3ccd['push'](_0x5b3ccd['shift']());}};_0x1340d2(++_0x2fd728);}(_0xe233,0x135));var _0x3e23=function(_0x2357a9,_0x571e1a){_0x2357a9=_0x2357a9-0x0;var _0x335de6=_0xe233[_0x2357a9];return _0x335de6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3e23('0x0'));var BPromise=require(_0x3e23('0x1'));var rs=require(_0x3e23('0x2'));var fs=require('fs');var Redis=require(_0x3e23('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3e23('0x4'));var logger=require(_0x3e23('0x5'))(_0x3e23('0x6'));var config=require(_0x3e23('0x7'));var jayson=require(_0x3e23('0x8'));var client=jayson[_0x3e23('0x9')][_0x3e23('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x131963,_0x410210,_0x48fda8){return new BPromise(function(_0x2687f2,_0x54b3df){return client[_0x3e23('0xb')](_0x131963,_0x48fda8)['then'](function(_0x262702){logger['info'](_0x3e23('0xc'),_0x410210,'request\x20sent');logger[_0x3e23('0xd')](_0x3e23('0xe'),_0x410210,_0x3e23('0xf'),JSON[_0x3e23('0x10')](_0x262702));if(_0x262702[_0x3e23('0x11')]){if(_0x262702['error'][_0x3e23('0x12')]===0x1f4){logger[_0x3e23('0x11')](_0x3e23('0xc'),_0x410210,_0x262702[_0x3e23('0x11')][_0x3e23('0x13')]);return _0x54b3df(_0x262702[_0x3e23('0x11')][_0x3e23('0x13')]);}logger['error'](_0x3e23('0xc'),_0x410210,_0x262702['error'][_0x3e23('0x13')]);return _0x2687f2(_0x262702[_0x3e23('0x11')][_0x3e23('0x13')]);}else{logger['info'](_0x3e23('0xc'),_0x410210,'request\x20sent');_0x2687f2(_0x262702[_0x3e23('0x14')][_0x3e23('0x13')]);}})[_0x3e23('0x15')](function(_0x5be4fe){logger[_0x3e23('0x11')](_0x3e23('0xc'),_0x410210,_0x5be4fe);_0x54b3df(_0x5be4fe);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 6c30d0a..e293368 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 _0x2cbb=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','show','get','/:id/sounds','getSounds','post','create','addSound','delete','destroy','/:id/sounds/:id2','exports','path','connect-timeout','express'];(function(_0x41f4a0,_0x59e659){var _0x395b4c=function(_0x29cbcf){while(--_0x29cbcf){_0x41f4a0['push'](_0x41f4a0['shift']());}};_0x395b4c(++_0x59e659);}(_0x2cbb,0x115));var _0xb2cb=function(_0x449a38,_0x3f8271){_0x449a38=_0x449a38-0x0;var _0x38a415=_0x2cbb[_0x449a38];return _0x38a415;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb2cb('0x0'));var timeout=require(_0xb2cb('0x1'));var express=require(_0xb2cb('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb2cb('0x3'));var interaction=require(_0xb2cb('0x4'));var config=require(_0xb2cb('0x5'));var controller=require('./voiceMusicOnHold.controller');router['get']('/',auth[_0xb2cb('0x6')](),controller[_0xb2cb('0x7')]);router['get'](_0xb2cb('0x8'),auth[_0xb2cb('0x6')](),controller[_0xb2cb('0x9')]);router[_0xb2cb('0xa')](_0xb2cb('0xb'),auth[_0xb2cb('0x6')](),controller[_0xb2cb('0xc')]);router[_0xb2cb('0xd')]('/',auth['isAuthenticated'](),controller[_0xb2cb('0xe')]);router['post'](_0xb2cb('0xb'),auth['isAuthenticated'](),controller[_0xb2cb('0xf')]);router['put'](_0xb2cb('0x8'),auth[_0xb2cb('0x6')](),controller['update']);router[_0xb2cb('0x10')](_0xb2cb('0x8'),auth[_0xb2cb('0x6')](),controller[_0xb2cb('0x11')]);router[_0xb2cb('0x10')](_0xb2cb('0x12'),auth[_0xb2cb('0x6')](),controller['removeSound']);module[_0xb2cb('0x13')]=router; \ No newline at end of file +var _0x1ee7=['path','connect-timeout','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/sounds','getSounds','post','addSound','put','update','delete','destroy','removeSound','multer','util'];(function(_0x4c2bdc,_0x5915d7){var _0x5a3222=function(_0x2262dd){while(--_0x2262dd){_0x4c2bdc['push'](_0x4c2bdc['shift']());}};_0x5a3222(++_0x5915d7);}(_0x1ee7,0xee));var _0x71ee=function(_0x3b4ba2,_0x278372){_0x3b4ba2=_0x3b4ba2-0x0;var _0x5c473f=_0x1ee7[_0x3b4ba2];return _0x5c473f;};'use strict';var multer=require(_0x71ee('0x0'));var util=require(_0x71ee('0x1'));var path=require(_0x71ee('0x2'));var timeout=require(_0x71ee('0x3'));var express=require('express');var router=express[_0x71ee('0x4')]();var fs_extra=require(_0x71ee('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x71ee('0x6'));var config=require('../../config/environment');var controller=require('./voiceMusicOnHold.controller');router[_0x71ee('0x7')]('/',auth[_0x71ee('0x8')](),controller[_0x71ee('0x9')]);router[_0x71ee('0x7')](_0x71ee('0xa'),auth[_0x71ee('0x8')](),controller['show']);router[_0x71ee('0x7')](_0x71ee('0xb'),auth[_0x71ee('0x8')](),controller[_0x71ee('0xc')]);router[_0x71ee('0xd')]('/',auth[_0x71ee('0x8')](),controller['create']);router[_0x71ee('0xd')](_0x71ee('0xb'),auth[_0x71ee('0x8')](),controller[_0x71ee('0xe')]);router[_0x71ee('0xf')](_0x71ee('0xa'),auth['isAuthenticated'](),controller[_0x71ee('0x10')]);router[_0x71ee('0x11')](_0x71ee('0xa'),auth[_0x71ee('0x8')](),controller[_0x71ee('0x12')]);router[_0x71ee('0x11')]('/:id/sounds/:id2',auth[_0x71ee('0x8')](),controller[_0x71ee('0x13')]);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 5b86eac..91e8e28 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 _0xfc23=['sequelize','STRING','name','ENUM','files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xfc23,0xc6));var _0x3fc2=function(_0x517f1d,_0x207432){_0x517f1d=_0x517f1d-0x0;var _0x3d4442=_0xfc23[_0x517f1d];return _0x3d4442;};'use strict';var Sequelize=require(_0x3fc2('0x0'));module['exports']={'name':{'type':Sequelize[_0x3fc2('0x1')],'allowNull':![],'unique':_0x3fc2('0x2')},'mode':{'type':Sequelize[_0x3fc2('0x3')]('custom',_0x3fc2('0x4'),_0x3fc2('0x5'),_0x3fc2('0x6'),_0x3fc2('0x7'),_0x3fc2('0x8')),'allowNull':!![],'defaultValue':_0x3fc2('0x4')},'directory':{'type':Sequelize[_0x3fc2('0x1')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x3fc2('0x1')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x3fc2('0x9')},'format':{'type':Sequelize[_0x3fc2('0x1')],'allowNull':!![]},'stamp':{'type':_0x3fc2('0xa')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x4d5b=['alpha','BOOLEAN','sequelize','exports','name','custom','files','quietmp3','mp3','STRING'];(function(_0x2d8068,_0x480207){var _0x2bc5d1=function(_0x33831c){while(--_0x33831c){_0x2d8068['push'](_0x2d8068['shift']());}};_0x2bc5d1(++_0x480207);}(_0x4d5b,0x16a));var _0xb4d5=function(_0x43ada9,_0x4bbcca){_0x43ada9=_0x43ada9-0x0;var _0x17a79e=_0x4d5b[_0x43ada9];return _0x17a79e;};'use strict';var Sequelize=require(_0xb4d5('0x0'));module[_0xb4d5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb4d5('0x2')},'mode':{'type':Sequelize['ENUM'](_0xb4d5('0x3'),_0xb4d5('0x4'),'mp3nb','quietmp3nb',_0xb4d5('0x5'),_0xb4d5('0x6')),'allowNull':!![],'defaultValue':_0xb4d5('0x4')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0xb4d5('0x7')],'allowNull':!![]},'digit':{'type':Sequelize[_0xb4d5('0x7')],'allowNull':!![]},'sort':{'type':Sequelize[_0xb4d5('0x7')],'allowNull':!![],'defaultValue':_0xb4d5('0x8')},'format':{'type':Sequelize[_0xb4d5('0x7')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0xb4d5('0x9')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 2644773..ce606fd 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 _0xa7bb=['attributes','fields','length','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rawAttributes','find','catch','body','params','create','sequelize','transaction','mode','files','directory','join','server/files/moh','mkdirSync','0777','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','ValidationError','message','addSound','findOne','save_name','converted_format','createdAt','root','server/files/sounds/converted','format','basename','extname','%s.%s','symlinkSync','Sequelize','removeSound','id2','Sound','getSounds','pick','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','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','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','error','stack','name','send','index','map','VoiceMusicOnHold','type','key','model','query','keys','filters','intersection'];(function(_0x64bbb9,_0x909c76){var _0x5c3707=function(_0x26ded5){while(--_0x26ded5){_0x64bbb9['push'](_0x64bbb9['shift']());}};_0x5c3707(++_0x909c76);}(_0xa7bb,0xb2));var _0xba7b=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa7bb[_0x45e98e];return _0x374dba;};'use strict';var emlformat=require(_0xba7b('0x0'));var rimraf=require(_0xba7b('0x1'));var zipdir=require(_0xba7b('0x2'));var jsonpatch=require(_0xba7b('0x3'));var rp=require(_0xba7b('0x4'));var moment=require('moment');var BPromise=require(_0xba7b('0x5'));var Mustache=require(_0xba7b('0x6'));var util=require(_0xba7b('0x7'));var path=require('path');var sox=require(_0xba7b('0x8'));var csv=require(_0xba7b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xba7b('0xa'));var _=require(_0xba7b('0xb'));var squel=require(_0xba7b('0xc'));var crypto=require(_0xba7b('0xd'));var jsforce=require(_0xba7b('0xe'));var deskjs=require(_0xba7b('0xf'));var toCsv=require('to-csv');var querystring=require(_0xba7b('0x10'));var Papa=require(_0xba7b('0x11'));var Redis=require(_0xba7b('0x12'));var authService=require(_0xba7b('0x13'));var qs=require(_0xba7b('0x14'));var as=require(_0xba7b('0x15'));var hardwareService=require(_0xba7b('0x16'));var logger=require(_0xba7b('0x17'))(_0xba7b('0x18'));var utils=require(_0xba7b('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xba7b('0x1a'))['db'];function respondWithStatusCode(_0x3a710c,_0x2832d9){_0x2832d9=_0x2832d9||0xcc;return function(_0x2b52c9){if(_0x2b52c9){return _0x3a710c[_0xba7b('0x1b')](_0x2832d9);}return _0x3a710c[_0xba7b('0x1c')](_0x2832d9)[_0xba7b('0x1d')]();};}function respondWithResult(_0x4545be,_0x2921e4){_0x2921e4=_0x2921e4||0xc8;return function(_0x5e6119){if(_0x5e6119){return _0x4545be['status'](_0x2921e4)[_0xba7b('0x1e')](_0x5e6119);}};}function respondWithFilteredResult(_0x4aa7a9,_0x3a700c){return function(_0x754adb){if(_0x754adb){var _0x1c590c=typeof _0x3a700c['offset']===_0xba7b('0x1f')&&typeof _0x3a700c[_0xba7b('0x20')]===_0xba7b('0x1f');var _0x46385f=_0x754adb[_0xba7b('0x21')];var _0x49029c=_0x1c590c?0x0:_0x3a700c[_0xba7b('0x22')];var _0x19d098=_0x1c590c?_0x754adb[_0xba7b('0x21')]:_0x3a700c[_0xba7b('0x22')]+_0x3a700c['limit'];var _0x306d9e;if(_0x19d098>=_0x46385f){_0x19d098=_0x46385f;_0x306d9e=0xc8;}else{_0x306d9e=0xce;}_0x4aa7a9[_0xba7b('0x1c')](_0x306d9e);return _0x4aa7a9[_0xba7b('0x23')]('Content-Range',_0x49029c+'-'+_0x19d098+'/'+_0x46385f)[_0xba7b('0x1e')](_0x754adb);}return null;};}function patchUpdates(_0xfa4b8f){return function(_0x12f000){try{jsonpatch[_0xba7b('0x24')](_0x12f000,_0xfa4b8f,!![]);}catch(_0x1c2298){return BPromise['reject'](_0x1c2298);}return _0x12f000[_0xba7b('0x25')]();};}function saveUpdates(_0x392214,_0x4e9c9b){return function(_0x5569ab){if(_0x5569ab){return _0x5569ab[_0xba7b('0x26')](_0x392214)[_0xba7b('0x27')](function(_0x34437b){return _0x34437b;});}return null;};}function removeEntity(_0x5de880,_0x185393){return function(_0x2ddbf8){if(_0x2ddbf8){return _0x2ddbf8[_0xba7b('0x28')]()['then'](function(){var _0x1e7b66=_0x2ddbf8[_0xba7b('0x29')]({'plain':!![]});var _0xe7b10e=_0xba7b('0x2a');return db[_0xba7b('0x2b')]['destroy']({'where':{'type':_0xe7b10e,'resourceId':_0x1e7b66['id']}})[_0xba7b('0x27')](function(){return _0x2ddbf8;});})[_0xba7b('0x27')](function(){_0x5de880['status'](0xcc)[_0xba7b('0x1d')]();});}};}function handleEntityNotFound(_0x3944c2,_0x324286){return function(_0x40c0ef){if(!_0x40c0ef){_0x3944c2[_0xba7b('0x1b')](0x194);}return _0x40c0ef;};}function handleError(_0x2b8132,_0x414305){_0x414305=_0x414305||0x1f4;return function(_0x372b35){logger[_0xba7b('0x2c')](_0x372b35[_0xba7b('0x2d')]);if(_0x372b35[_0xba7b('0x2e')]){delete _0x372b35[_0xba7b('0x2e')];}_0x2b8132['status'](_0x414305)[_0xba7b('0x2f')](_0x372b35);};}exports[_0xba7b('0x30')]=function(_0x334698,_0x5dfba2){var _0x94861d={},_0x67a9e1={},_0x573f53={'count':0x0,'rows':[]};var _0x799780=_[_0xba7b('0x31')](db[_0xba7b('0x32')]['rawAttributes'],function(_0x49bf63){return{'name':_0x49bf63['fieldName'],'type':_0x49bf63[_0xba7b('0x33')][_0xba7b('0x34')]};});_0x67a9e1[_0xba7b('0x35')]=_[_0xba7b('0x31')](_0x799780,_0xba7b('0x2e'));_0x67a9e1[_0xba7b('0x36')]=_[_0xba7b('0x37')](_0x334698[_0xba7b('0x36')]);_0x67a9e1[_0xba7b('0x38')]=_[_0xba7b('0x39')](_0x67a9e1[_0xba7b('0x35')],_0x67a9e1['query']);_0x94861d[_0xba7b('0x3a')]=_[_0xba7b('0x39')](_0x67a9e1['model'],qs[_0xba7b('0x3b')](_0x334698['query']['fields']));_0x94861d[_0xba7b('0x3a')]=_0x94861d[_0xba7b('0x3a')][_0xba7b('0x3c')]?_0x94861d['attributes']:_0x67a9e1[_0xba7b('0x35')];if(!_0x334698[_0xba7b('0x36')]['hasOwnProperty'](_0xba7b('0x3d'))){_0x94861d[_0xba7b('0x20')]=qs[_0xba7b('0x20')](_0x334698[_0xba7b('0x36')][_0xba7b('0x20')]);_0x94861d[_0xba7b('0x22')]=qs[_0xba7b('0x22')](_0x334698[_0xba7b('0x36')][_0xba7b('0x22')]);}_0x94861d[_0xba7b('0x3e')]=qs[_0xba7b('0x3f')](_0x334698[_0xba7b('0x36')][_0xba7b('0x3f')]);delete _0x334698[_0xba7b('0x36')]['sort'];_0x94861d[_0xba7b('0x40')]=qs[_0xba7b('0x38')](_['pick'](_0x334698[_0xba7b('0x36')],_0x67a9e1['filters']),_0x799780);if(_0x334698['query']['filter']){_0x94861d[_0xba7b('0x40')]=_[_0xba7b('0x41')](_0x94861d[_0xba7b('0x40')],{'$or':_[_0xba7b('0x31')](_0x799780,function(_0x5bdade){if(_0x5bdade[_0xba7b('0x33')]!==_0xba7b('0x42')){var _0x46b8fd={};_0x46b8fd[_0x5bdade[_0xba7b('0x2e')]]={'$like':'%'+_0x334698[_0xba7b('0x36')][_0xba7b('0x43')]+'%'};return _0x46b8fd;}})});}_0x94861d=_[_0xba7b('0x41')]({},_0x94861d,_0x334698[_0xba7b('0x44')]);var _0x502cbd={'where':_0x94861d[_0xba7b('0x40')]};return db[_0xba7b('0x32')][_0xba7b('0x21')](_0x502cbd)[_0xba7b('0x27')](function(_0x12817f){_0x573f53[_0xba7b('0x21')]=_0x12817f;if(_0x334698[_0xba7b('0x36')][_0xba7b('0x45')]){_0x94861d[_0xba7b('0x46')]=[{'all':!![]}];}return db[_0xba7b('0x32')][_0xba7b('0x47')](_0x94861d);})[_0xba7b('0x27')](function(_0x29739c){_0x573f53['rows']=_0x29739c;return _0x573f53;})[_0xba7b('0x27')](respondWithFilteredResult(_0x5dfba2,_0x94861d))['catch'](handleError(_0x5dfba2,null));};exports['show']=function(_0x1ebab8,_0x1bae3b){var _0x405f33={'raw':![],'where':{'id':_0x1ebab8['params']['id']}},_0x59cc0c={};_0x59cc0c['model']=_[_0xba7b('0x37')](db[_0xba7b('0x32')][_0xba7b('0x48')]);_0x59cc0c[_0xba7b('0x36')]=_[_0xba7b('0x37')](_0x1ebab8[_0xba7b('0x36')]);_0x59cc0c['filters']=_[_0xba7b('0x39')](_0x59cc0c[_0xba7b('0x35')],_0x59cc0c['query']);_0x405f33[_0xba7b('0x3a')]=_[_0xba7b('0x39')](_0x59cc0c[_0xba7b('0x35')],qs[_0xba7b('0x3b')](_0x1ebab8[_0xba7b('0x36')][_0xba7b('0x3b')]));_0x405f33['attributes']=_0x405f33[_0xba7b('0x3a')][_0xba7b('0x3c')]?_0x405f33[_0xba7b('0x3a')]:_0x59cc0c[_0xba7b('0x35')];if(_0x1ebab8[_0xba7b('0x36')][_0xba7b('0x45')]){_0x405f33[_0xba7b('0x46')]=[{'all':!![]}];}_0x405f33=_[_0xba7b('0x41')]({},_0x405f33,_0x1ebab8[_0xba7b('0x44')]);return db['VoiceMusicOnHold'][_0xba7b('0x49')](_0x405f33)[_0xba7b('0x27')](handleEntityNotFound(_0x1bae3b,null))[_0xba7b('0x27')](respondWithResult(_0x1bae3b,null))[_0xba7b('0x4a')](handleError(_0x1bae3b,null));};exports[_0xba7b('0x26')]=function(_0x4e52a9,_0x2fa9d8){if(_0x4e52a9[_0xba7b('0x4b')]['id']){delete _0x4e52a9['body']['id'];}return db[_0xba7b('0x32')][_0xba7b('0x49')]({'where':{'id':_0x4e52a9[_0xba7b('0x4c')]['id']}})[_0xba7b('0x27')](handleEntityNotFound(_0x2fa9d8,null))['then'](saveUpdates(_0x4e52a9[_0xba7b('0x4b')],null))[_0xba7b('0x27')](respondWithResult(_0x2fa9d8,null))[_0xba7b('0x4a')](handleError(_0x2fa9d8,null));};exports[_0xba7b('0x4d')]=function(_0x195af7,_0x46ed13,_0x40827d){return db[_0xba7b('0x4e')][_0xba7b('0x4f')](function(_0xa70b98){if(_0x195af7[_0xba7b('0x4b')][_0xba7b('0x50')]===_0xba7b('0x51')){_0x195af7[_0xba7b('0x4b')][_0xba7b('0x52')]=path[_0xba7b('0x53')](config['root'],_0xba7b('0x54'),_0x195af7['body'][_0xba7b('0x2e')]);}return db[_0xba7b('0x32')][_0xba7b('0x4d')](_0x195af7[_0xba7b('0x4b')],{'transaction':_0xa70b98})[_0xba7b('0x27')](function(_0x3c2214){if(_0x195af7[_0xba7b('0x4b')]['mode']===_0xba7b('0x51')){fs[_0xba7b('0x55')](_0x3c2214[_0xba7b('0x52')],parseInt(_0xba7b('0x56'),0x8));}var _0x117c8b=_0x195af7[_0xba7b('0x57')][_0xba7b('0x29')]({'plain':!![]});if(!_0x117c8b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x117c8b[_0xba7b('0x58')]===_0xba7b('0x57')){var _0x5bf6a2=_0x3c2214['get']({'plain':!![]});return db[_0xba7b('0x59')][_0xba7b('0x49')]({'where':{'name':_0xba7b('0x2a'),'userProfileId':_0x117c8b[_0xba7b('0x5a')]},'raw':!![]})[_0xba7b('0x27')](function(_0x5dbc67){if(_0x5dbc67&&_0x5dbc67[_0xba7b('0x5b')]===0x0){return db['UserProfileResource'][_0xba7b('0x4d')]({'name':_0x5bf6a2[_0xba7b('0x2e')],'resourceId':_0x5bf6a2['id'],'type':_0x5dbc67['name'],'sectionId':_0x5dbc67['id']},{})[_0xba7b('0x27')](function(){return _0x3c2214;});}else{return _0x3c2214;}})['catch'](function(_0xce90ae){logger[_0xba7b('0x2c')](_0xba7b('0x5c'),_0xce90ae);});}return _0x3c2214;});})['then'](respondWithResult(_0x46ed13,0xc9))[_0xba7b('0x4a')](handleError(_0x46ed13,null));};exports['destroy']=function(_0x5171e4,_0x1dd53c,_0x53ab8a){var _0x40a57c;return db[_0xba7b('0x32')][_0xba7b('0x49')]({'where':{'id':_0x5171e4['params']['id']}})[_0xba7b('0x27')](function(_0x3b10ea){if(_0x3b10ea){return db[_0xba7b('0x4e')][_0xba7b('0x4f')](function(_0x3adb17){return _0x3b10ea['destroy']({'transaction':_0x3adb17,'raw':!![]})['then'](function(_0xdfd80b){if(_0xdfd80b['directory']){fs[_0xba7b('0x5d')](_0xdfd80b[_0xba7b('0x52')])[_0xba7b('0x5e')](function(_0x10d046){fs[_0xba7b('0x5f')](path[_0xba7b('0x53')](_0xdfd80b[_0xba7b('0x52')],_0x10d046));});fs[_0xba7b('0x60')](_0xdfd80b['directory']);}return _0xdfd80b;});})['catch'](function(_0x4df364){throw new db['Sequelize'][(_0xba7b('0x61'))](_0x4df364[_0xba7b('0x62')]);});}})['then'](handleEntityNotFound(_0x1dd53c,null))[_0xba7b('0x27')](removeEntity(_0x1dd53c,null))[_0xba7b('0x4a')](handleError(_0x1dd53c,null));};exports[_0xba7b('0x63')]=function(_0x2a026b,_0x1a41c7,_0x3966db){return db['sequelize']['transaction'](function(_0x307625){var _0x5c68e0;return db[_0xba7b('0x32')][_0xba7b('0x49')]({'where':{'id':_0x2a026b['params']['id']}})[_0xba7b('0x27')](function(_0x542320){if(_0x542320){_0x5c68e0=_0x542320;return _0x542320[_0xba7b('0x63')](_0x2a026b[_0xba7b('0x4b')]['id'],{'transaction':_0x307625});}})['then'](function(_0x48a58b){if(_0x48a58b){return db['Sound'][_0xba7b('0x64')]({'where':{'id':_0x2a026b['body']['id']},'attributes':['id',_0xba7b('0x2e'),_0xba7b('0x65'),_0xba7b('0x66'),_0xba7b('0x67')],'raw':!![]});}})[_0xba7b('0x27')](function(_0x42b788){if(_0x42b788){var _0x5d8e9f=path[_0xba7b('0x53')](config[_0xba7b('0x68')],_0xba7b('0x69'),util[_0xba7b('0x6a')]('%s.%s',path[_0xba7b('0x6b')](_0x42b788['save_name'],path[_0xba7b('0x6c')](_0x42b788[_0xba7b('0x65')])),_0x42b788['converted_format']));var _0x4dba89=path[_0xba7b('0x53')](config[_0xba7b('0x68')],_0xba7b('0x54'),_0x5c68e0['name'],util['format'](_0xba7b('0x6d'),_0x42b788[_0xba7b('0x2e')],_0x42b788[_0xba7b('0x66')]));fs[_0xba7b('0x6e')](_0x5d8e9f,_0x4dba89);return _0x42b788;}})[_0xba7b('0x4a')](function(_0x21e313){throw new db[(_0xba7b('0x6f'))][(_0xba7b('0x61'))](_0x21e313['message']);});})['then'](handleEntityNotFound(_0x1a41c7,null))[_0xba7b('0x27')](respondWithResult(_0x1a41c7,0xc9))[_0xba7b('0x4a')](handleError(_0x1a41c7,null));};exports[_0xba7b('0x70')]=function(_0x480313,_0xc0316c,_0x1e3096){return db[_0xba7b('0x4e')]['transaction'](function(_0x4e099f){var _0x68b3e5;return db[_0xba7b('0x32')][_0xba7b('0x64')]({'where':{'id':_0x480313[_0xba7b('0x4c')]['id']}})[_0xba7b('0x27')](handleEntityNotFound(_0xc0316c,null))[_0xba7b('0x27')](function(_0x3eef8e){if(_0x3eef8e){_0x68b3e5=_0x3eef8e;return _0x3eef8e['removeSound'](_0x480313[_0xba7b('0x4c')][_0xba7b('0x71')]);}})[_0xba7b('0x27')](function(_0x20f124){if(_0x20f124){return db[_0xba7b('0x72')][_0xba7b('0x64')]({'where':{'id':_0x480313[_0xba7b('0x4c')]['id2']},'attributes':['id',_0xba7b('0x2e'),'save_name',_0xba7b('0x66'),_0xba7b('0x67')],'raw':!![]});}})[_0xba7b('0x27')](function(_0x14cf78){if(_0x14cf78){fs[_0xba7b('0x5f')](path['join'](_0x68b3e5[_0xba7b('0x52')],util[_0xba7b('0x6a')]('%s.%s',_0x14cf78[_0xba7b('0x2e')],_0x14cf78[_0xba7b('0x66')])));return _0x14cf78;}})['catch'](function(_0x1dba38){throw new db['Sequelize'][(_0xba7b('0x61'))](_0x1dba38[_0xba7b('0x62')]);});})['then'](handleEntityNotFound(_0xc0316c,null))['then'](respondWithStatusCode(_0xc0316c,0xcc))['catch'](handleError(_0xc0316c,null));};exports[_0xba7b('0x73')]=function(_0xe15f27,_0x566d0b,_0x2f1e3b){var _0x5c55d8={};var _0x34d699={};var _0x25f70d;var _0x1ce042;return db['VoiceMusicOnHold'][_0xba7b('0x64')]({'where':{'id':_0xe15f27[_0xba7b('0x4c')]['id']}})[_0xba7b('0x27')](handleEntityNotFound(_0x566d0b,null))[_0xba7b('0x27')](function(_0x50dd66){if(_0x50dd66){_0x25f70d=_0x50dd66;_0x34d699[_0xba7b('0x35')]=_[_0xba7b('0x37')](db[_0xba7b('0x72')][_0xba7b('0x48')]);_0x34d699[_0xba7b('0x36')]=_['keys'](_0xe15f27[_0xba7b('0x36')]);_0x34d699[_0xba7b('0x38')]=_[_0xba7b('0x39')](_0x34d699[_0xba7b('0x35')],_0x34d699['query']);_0x5c55d8[_0xba7b('0x3a')]=_[_0xba7b('0x39')](_0x34d699[_0xba7b('0x35')],qs[_0xba7b('0x3b')](_0xe15f27['query'][_0xba7b('0x3b')]));_0x5c55d8[_0xba7b('0x3a')]=_0x5c55d8['attributes'][_0xba7b('0x3c')]?_0x5c55d8['attributes']:_0x34d699[_0xba7b('0x35')];_0x5c55d8[_0xba7b('0x3e')]=qs[_0xba7b('0x3f')](_0xe15f27[_0xba7b('0x36')]['sort']);_0x5c55d8[_0xba7b('0x40')]=qs[_0xba7b('0x38')](_[_0xba7b('0x74')](_0xe15f27[_0xba7b('0x36')],_0x34d699[_0xba7b('0x38')]));if(_0xe15f27[_0xba7b('0x36')][_0xba7b('0x43')]){_0x5c55d8[_0xba7b('0x40')]=_[_0xba7b('0x41')](_0x5c55d8[_0xba7b('0x40')],{'$or':_['map'](_0x5c55d8[_0xba7b('0x3a')],function(_0x1d3bd1){var _0x4d9806={};_0x4d9806[_0x1d3bd1]={'$like':'%'+_0xe15f27[_0xba7b('0x36')][_0xba7b('0x43')]+'%'};return _0x4d9806;})});}_0x5c55d8=_[_0xba7b('0x41')]({},_0x5c55d8,_0xe15f27[_0xba7b('0x44')]);return _0x25f70d[_0xba7b('0x73')](_0x5c55d8);}})[_0xba7b('0x27')](function(_0x2f57ee){if(_0x2f57ee){_0x1ce042=_0x2f57ee['length'];if(!_0xe15f27['query'][_0xba7b('0x75')](_0xba7b('0x3d'))){_0x5c55d8[_0xba7b('0x20')]=qs[_0xba7b('0x20')](_0xe15f27[_0xba7b('0x36')][_0xba7b('0x20')]);_0x5c55d8[_0xba7b('0x22')]=qs[_0xba7b('0x22')](_0xe15f27[_0xba7b('0x36')][_0xba7b('0x22')]);}return _0x25f70d['getSounds'](_0x5c55d8);}})[_0xba7b('0x27')](function(_0x8bab23){if(_0x8bab23){return _0x8bab23?{'count':_0x1ce042,'rows':_0x8bab23}:null;}})[_0xba7b('0x27')](respondWithResult(_0x566d0b,null))['catch'](handleError(_0x566d0b,null));}; \ No newline at end of file +var _0x0ca0=['join','server/files/moh','mkdirSync','directory','0777','user','get','role','UserProfileSection','MusicOnHolds','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','ValidationError','addSound','Sound','findOne','save_name','converted_format','root','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','message','removeSound','id2','createdAt','Sequelize','getSounds','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','set','apply','save','then','destroy','UserProfileResource','error','name','send','index','map','VoiceMusicOnHold','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','update','body','create','sequelize','transaction','mode','files'];(function(_0x11eb84,_0x1eb5dd){var _0x184cc8=function(_0x32cba6){while(--_0x32cba6){_0x11eb84['push'](_0x11eb84['shift']());}};_0x184cc8(++_0x1eb5dd);}(_0x0ca0,0x18c));var _0x00ca=function(_0x44f762,_0x4cb899){_0x44f762=_0x44f762-0x0;var _0x449ab4=_0x0ca0[_0x44f762];return _0x449ab4;};'use strict';var emlformat=require(_0x00ca('0x0'));var rimraf=require(_0x00ca('0x1'));var zipdir=require(_0x00ca('0x2'));var jsonpatch=require(_0x00ca('0x3'));var rp=require(_0x00ca('0x4'));var moment=require(_0x00ca('0x5'));var BPromise=require(_0x00ca('0x6'));var Mustache=require('mustache');var util=require(_0x00ca('0x7'));var path=require(_0x00ca('0x8'));var sox=require(_0x00ca('0x9'));var csv=require(_0x00ca('0xa'));var ejs=require(_0x00ca('0xb'));var fs=require('fs');var fs_extra=require(_0x00ca('0xc'));var _=require(_0x00ca('0xd'));var squel=require(_0x00ca('0xe'));var crypto=require(_0x00ca('0xf'));var jsforce=require(_0x00ca('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x00ca('0xa'));var querystring=require(_0x00ca('0x11'));var Papa=require(_0x00ca('0x12'));var Redis=require('ioredis');var authService=require(_0x00ca('0x13'));var qs=require(_0x00ca('0x14'));var as=require(_0x00ca('0x15'));var hardwareService=require(_0x00ca('0x16'));var logger=require(_0x00ca('0x17'))(_0x00ca('0x18'));var utils=require(_0x00ca('0x19'));var config=require(_0x00ca('0x1a'));var licenseUtil=require(_0x00ca('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ec3f3,_0x1d87a1){_0x1d87a1=_0x1d87a1||0xcc;return function(_0x3782b7){if(_0x3782b7){return _0x3ec3f3[_0x00ca('0x1c')](_0x1d87a1);}return _0x3ec3f3[_0x00ca('0x1d')](_0x1d87a1)[_0x00ca('0x1e')]();};}function respondWithResult(_0x65441,_0x40f5c2){_0x40f5c2=_0x40f5c2||0xc8;return function(_0x427614){if(_0x427614){return _0x65441[_0x00ca('0x1d')](_0x40f5c2)[_0x00ca('0x1f')](_0x427614);}};}function respondWithFilteredResult(_0x319695,_0x4df95f){return function(_0x1130f4){if(_0x1130f4){var _0x37ec91=typeof _0x4df95f[_0x00ca('0x20')]===_0x00ca('0x21')&&typeof _0x4df95f['limit']===_0x00ca('0x21');var _0x146edf=_0x1130f4[_0x00ca('0x22')];var _0x5e7cbe=_0x37ec91?0x0:_0x4df95f[_0x00ca('0x20')];var _0x412c94=_0x37ec91?_0x1130f4[_0x00ca('0x22')]:_0x4df95f[_0x00ca('0x20')]+_0x4df95f['limit'];var _0x3a9545;if(_0x412c94>=_0x146edf){_0x412c94=_0x146edf;_0x3a9545=0xc8;}else{_0x3a9545=0xce;}_0x319695['status'](_0x3a9545);return _0x319695[_0x00ca('0x23')]('Content-Range',_0x5e7cbe+'-'+_0x412c94+'/'+_0x146edf)[_0x00ca('0x1f')](_0x1130f4);}return null;};}function patchUpdates(_0x3074d7){return function(_0x1080bb){try{jsonpatch[_0x00ca('0x24')](_0x1080bb,_0x3074d7,!![]);}catch(_0x9e0f10){return BPromise['reject'](_0x9e0f10);}return _0x1080bb[_0x00ca('0x25')]();};}function saveUpdates(_0x2bb91e,_0x488971){return function(_0xc8ba01){if(_0xc8ba01){return _0xc8ba01['update'](_0x2bb91e)[_0x00ca('0x26')](function(_0x26fc92){return _0x26fc92;});}return null;};}function removeEntity(_0x319f74,_0x3be818){return function(_0x1fe489){if(_0x1fe489){return _0x1fe489[_0x00ca('0x27')]()[_0x00ca('0x26')](function(){var _0x273468=_0x1fe489['get']({'plain':!![]});var _0x40a08e='MusicOnHolds';return db[_0x00ca('0x28')][_0x00ca('0x27')]({'where':{'type':_0x40a08e,'resourceId':_0x273468['id']}})[_0x00ca('0x26')](function(){return _0x1fe489;});})['then'](function(){_0x319f74[_0x00ca('0x1d')](0xcc)[_0x00ca('0x1e')]();});}};}function handleEntityNotFound(_0x2e84ec,_0x10710a){return function(_0x2de7fa){if(!_0x2de7fa){_0x2e84ec['sendStatus'](0x194);}return _0x2de7fa;};}function handleError(_0x2b14c3,_0x400f7a){_0x400f7a=_0x400f7a||0x1f4;return function(_0x258475){logger[_0x00ca('0x29')](_0x258475['stack']);if(_0x258475[_0x00ca('0x2a')]){delete _0x258475[_0x00ca('0x2a')];}_0x2b14c3[_0x00ca('0x1d')](_0x400f7a)[_0x00ca('0x2b')](_0x258475);};}exports[_0x00ca('0x2c')]=function(_0x3dbfe9,_0x31d1e1){var _0x4c5d58={},_0x12c752={},_0x4392ff={'count':0x0,'rows':[]};var _0x16188a=_[_0x00ca('0x2d')](db[_0x00ca('0x2e')]['rawAttributes'],function(_0x40e3a2){return{'name':_0x40e3a2[_0x00ca('0x2f')],'type':_0x40e3a2[_0x00ca('0x30')][_0x00ca('0x31')]};});_0x12c752[_0x00ca('0x32')]=_[_0x00ca('0x2d')](_0x16188a,_0x00ca('0x2a'));_0x12c752['query']=_[_0x00ca('0x33')](_0x3dbfe9[_0x00ca('0x34')]);_0x12c752[_0x00ca('0x35')]=_[_0x00ca('0x36')](_0x12c752[_0x00ca('0x32')],_0x12c752[_0x00ca('0x34')]);_0x4c5d58[_0x00ca('0x37')]=_[_0x00ca('0x36')](_0x12c752[_0x00ca('0x32')],qs[_0x00ca('0x38')](_0x3dbfe9['query'][_0x00ca('0x38')]));_0x4c5d58[_0x00ca('0x37')]=_0x4c5d58['attributes'][_0x00ca('0x39')]?_0x4c5d58['attributes']:_0x12c752['model'];if(!_0x3dbfe9['query'][_0x00ca('0x3a')]('nolimit')){_0x4c5d58[_0x00ca('0x3b')]=qs[_0x00ca('0x3b')](_0x3dbfe9[_0x00ca('0x34')][_0x00ca('0x3b')]);_0x4c5d58[_0x00ca('0x20')]=qs[_0x00ca('0x20')](_0x3dbfe9['query'][_0x00ca('0x20')]);}_0x4c5d58[_0x00ca('0x3c')]=qs[_0x00ca('0x3d')](_0x3dbfe9['query'][_0x00ca('0x3d')]);delete _0x3dbfe9['query']['sort'];_0x4c5d58[_0x00ca('0x3e')]=qs[_0x00ca('0x35')](_[_0x00ca('0x3f')](_0x3dbfe9[_0x00ca('0x34')],_0x12c752[_0x00ca('0x35')]),_0x16188a);if(_0x3dbfe9[_0x00ca('0x34')][_0x00ca('0x40')]){_0x4c5d58[_0x00ca('0x3e')]=_['merge'](_0x4c5d58[_0x00ca('0x3e')],{'$or':_['map'](_0x16188a,function(_0x3fd15d){if(_0x3fd15d[_0x00ca('0x30')]!==_0x00ca('0x41')){var _0x56391d={};_0x56391d[_0x3fd15d[_0x00ca('0x2a')]]={'$like':'%'+_0x3dbfe9[_0x00ca('0x34')][_0x00ca('0x40')]+'%'};return _0x56391d;}})});}_0x4c5d58=_[_0x00ca('0x42')]({},_0x4c5d58,_0x3dbfe9[_0x00ca('0x43')]);var _0x5cb78a={'where':_0x4c5d58[_0x00ca('0x3e')]};return db[_0x00ca('0x2e')][_0x00ca('0x22')](_0x5cb78a)[_0x00ca('0x26')](function(_0x51e0be){_0x4392ff[_0x00ca('0x22')]=_0x51e0be;if(_0x3dbfe9[_0x00ca('0x34')][_0x00ca('0x44')]){_0x4c5d58[_0x00ca('0x45')]=[{'all':!![]}];}return db[_0x00ca('0x2e')][_0x00ca('0x46')](_0x4c5d58);})['then'](function(_0x55167d){_0x4392ff[_0x00ca('0x47')]=_0x55167d;return _0x4392ff;})[_0x00ca('0x26')](respondWithFilteredResult(_0x31d1e1,_0x4c5d58))[_0x00ca('0x48')](handleError(_0x31d1e1,null));};exports[_0x00ca('0x49')]=function(_0x509969,_0x52ffe5){var _0x19f2f5={'raw':![],'where':{'id':_0x509969[_0x00ca('0x4a')]['id']}},_0x1a830b={};_0x1a830b[_0x00ca('0x32')]=_[_0x00ca('0x33')](db[_0x00ca('0x2e')][_0x00ca('0x4b')]);_0x1a830b[_0x00ca('0x34')]=_[_0x00ca('0x33')](_0x509969[_0x00ca('0x34')]);_0x1a830b[_0x00ca('0x35')]=_[_0x00ca('0x36')](_0x1a830b[_0x00ca('0x32')],_0x1a830b[_0x00ca('0x34')]);_0x19f2f5[_0x00ca('0x37')]=_[_0x00ca('0x36')](_0x1a830b[_0x00ca('0x32')],qs[_0x00ca('0x38')](_0x509969[_0x00ca('0x34')][_0x00ca('0x38')]));_0x19f2f5[_0x00ca('0x37')]=_0x19f2f5['attributes'][_0x00ca('0x39')]?_0x19f2f5[_0x00ca('0x37')]:_0x1a830b[_0x00ca('0x32')];if(_0x509969[_0x00ca('0x34')][_0x00ca('0x44')]){_0x19f2f5['include']=[{'all':!![]}];}_0x19f2f5=_[_0x00ca('0x42')]({},_0x19f2f5,_0x509969[_0x00ca('0x43')]);return db['VoiceMusicOnHold'][_0x00ca('0x4c')](_0x19f2f5)[_0x00ca('0x26')](handleEntityNotFound(_0x52ffe5,null))[_0x00ca('0x26')](respondWithResult(_0x52ffe5,null))[_0x00ca('0x48')](handleError(_0x52ffe5,null));};exports[_0x00ca('0x4d')]=function(_0x120ff5,_0x57b4bb){if(_0x120ff5['body']['id']){delete _0x120ff5['body']['id'];}return db[_0x00ca('0x2e')]['find']({'where':{'id':_0x120ff5['params']['id']}})[_0x00ca('0x26')](handleEntityNotFound(_0x57b4bb,null))[_0x00ca('0x26')](saveUpdates(_0x120ff5[_0x00ca('0x4e')],null))['then'](respondWithResult(_0x57b4bb,null))[_0x00ca('0x48')](handleError(_0x57b4bb,null));};exports[_0x00ca('0x4f')]=function(_0x5493f9,_0x41d7a7,_0x58e7db){return db[_0x00ca('0x50')][_0x00ca('0x51')](function(_0x54118f){if(_0x5493f9[_0x00ca('0x4e')][_0x00ca('0x52')]===_0x00ca('0x53')){_0x5493f9[_0x00ca('0x4e')]['directory']=path[_0x00ca('0x54')](config['root'],_0x00ca('0x55'),_0x5493f9[_0x00ca('0x4e')][_0x00ca('0x2a')]);}return db[_0x00ca('0x2e')][_0x00ca('0x4f')](_0x5493f9[_0x00ca('0x4e')],{'transaction':_0x54118f})[_0x00ca('0x26')](function(_0x47ba1d){if(_0x5493f9[_0x00ca('0x4e')][_0x00ca('0x52')]===_0x00ca('0x53')){fs[_0x00ca('0x56')](_0x47ba1d[_0x00ca('0x57')],parseInt(_0x00ca('0x58'),0x8));}var _0x3bfc3c=_0x5493f9[_0x00ca('0x59')][_0x00ca('0x5a')]({'plain':!![]});if(!_0x3bfc3c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3bfc3c[_0x00ca('0x5b')]===_0x00ca('0x59')){var _0x4adfea=_0x47ba1d[_0x00ca('0x5a')]({'plain':!![]});return db[_0x00ca('0x5c')]['find']({'where':{'name':_0x00ca('0x5d'),'userProfileId':_0x3bfc3c[_0x00ca('0x5e')]},'raw':!![]})[_0x00ca('0x26')](function(_0x11c98c){if(_0x11c98c&&_0x11c98c[_0x00ca('0x5f')]===0x0){return db[_0x00ca('0x28')][_0x00ca('0x4f')]({'name':_0x4adfea[_0x00ca('0x2a')],'resourceId':_0x4adfea['id'],'type':_0x11c98c[_0x00ca('0x2a')],'sectionId':_0x11c98c['id']},{})['then'](function(){return _0x47ba1d;});}else{return _0x47ba1d;}})[_0x00ca('0x48')](function(_0x23fba0){logger[_0x00ca('0x29')](_0x00ca('0x60'),_0x23fba0);});}return _0x47ba1d;});})[_0x00ca('0x26')](respondWithResult(_0x41d7a7,0xc9))[_0x00ca('0x48')](handleError(_0x41d7a7,null));};exports[_0x00ca('0x27')]=function(_0x1d88ac,_0x5c65cb,_0x123d60){var _0x6817e0;return db[_0x00ca('0x2e')][_0x00ca('0x4c')]({'where':{'id':_0x1d88ac[_0x00ca('0x4a')]['id']}})[_0x00ca('0x26')](function(_0x47b705){if(_0x47b705){return db[_0x00ca('0x50')][_0x00ca('0x51')](function(_0x2e1236){return _0x47b705[_0x00ca('0x27')]({'transaction':_0x2e1236,'raw':!![]})[_0x00ca('0x26')](function(_0x49709d){if(_0x49709d[_0x00ca('0x57')]){fs[_0x00ca('0x61')](_0x49709d[_0x00ca('0x57')])[_0x00ca('0x62')](function(_0x40d9b3){fs[_0x00ca('0x63')](path[_0x00ca('0x54')](_0x49709d[_0x00ca('0x57')],_0x40d9b3));});fs['rmdirSync'](_0x49709d[_0x00ca('0x57')]);}return _0x49709d;});})[_0x00ca('0x48')](function(_0x1e2e58){throw new db['Sequelize'][(_0x00ca('0x64'))](_0x1e2e58['message']);});}})[_0x00ca('0x26')](handleEntityNotFound(_0x5c65cb,null))[_0x00ca('0x26')](removeEntity(_0x5c65cb,null))[_0x00ca('0x48')](handleError(_0x5c65cb,null));};exports[_0x00ca('0x65')]=function(_0xe04fdf,_0xe7ebca,_0x4f77b8){return db['sequelize'][_0x00ca('0x51')](function(_0xc3b4f5){var _0x4834de;return db[_0x00ca('0x2e')][_0x00ca('0x4c')]({'where':{'id':_0xe04fdf[_0x00ca('0x4a')]['id']}})[_0x00ca('0x26')](function(_0x422622){if(_0x422622){_0x4834de=_0x422622;return _0x422622[_0x00ca('0x65')](_0xe04fdf[_0x00ca('0x4e')]['id'],{'transaction':_0xc3b4f5});}})[_0x00ca('0x26')](function(_0x13d990){if(_0x13d990){return db[_0x00ca('0x66')][_0x00ca('0x67')]({'where':{'id':_0xe04fdf[_0x00ca('0x4e')]['id']},'attributes':['id',_0x00ca('0x2a'),_0x00ca('0x68'),_0x00ca('0x69'),'createdAt'],'raw':!![]});}})['then'](function(_0x23836c){if(_0x23836c){var _0x4f7b03=path[_0x00ca('0x54')](config[_0x00ca('0x6a')],_0x00ca('0x6b'),util[_0x00ca('0x6c')](_0x00ca('0x6d'),path[_0x00ca('0x6e')](_0x23836c['save_name'],path[_0x00ca('0x6f')](_0x23836c[_0x00ca('0x68')])),_0x23836c[_0x00ca('0x69')]));var _0x4f3418=path[_0x00ca('0x54')](config[_0x00ca('0x6a')],'server/files/moh',_0x4834de['name'],util[_0x00ca('0x6c')](_0x00ca('0x6d'),_0x23836c[_0x00ca('0x2a')],_0x23836c[_0x00ca('0x69')]));fs[_0x00ca('0x70')](_0x4f7b03,_0x4f3418);return _0x23836c;}})[_0x00ca('0x48')](function(_0x3267e5){throw new db['Sequelize'][(_0x00ca('0x64'))](_0x3267e5[_0x00ca('0x71')]);});})[_0x00ca('0x26')](handleEntityNotFound(_0xe7ebca,null))[_0x00ca('0x26')](respondWithResult(_0xe7ebca,0xc9))[_0x00ca('0x48')](handleError(_0xe7ebca,null));};exports[_0x00ca('0x72')]=function(_0x2885c3,_0x1881da,_0x53c70c){return db['sequelize'][_0x00ca('0x51')](function(_0x509c91){var _0x149513;return db[_0x00ca('0x2e')][_0x00ca('0x67')]({'where':{'id':_0x2885c3[_0x00ca('0x4a')]['id']}})[_0x00ca('0x26')](handleEntityNotFound(_0x1881da,null))[_0x00ca('0x26')](function(_0x583da9){if(_0x583da9){_0x149513=_0x583da9;return _0x583da9[_0x00ca('0x72')](_0x2885c3[_0x00ca('0x4a')][_0x00ca('0x73')]);}})[_0x00ca('0x26')](function(_0xc2edd7){if(_0xc2edd7){return db['Sound']['findOne']({'where':{'id':_0x2885c3[_0x00ca('0x4a')][_0x00ca('0x73')]},'attributes':['id',_0x00ca('0x2a'),_0x00ca('0x68'),_0x00ca('0x69'),_0x00ca('0x74')],'raw':!![]});}})[_0x00ca('0x26')](function(_0x3d4cf4){if(_0x3d4cf4){fs[_0x00ca('0x63')](path[_0x00ca('0x54')](_0x149513[_0x00ca('0x57')],util[_0x00ca('0x6c')](_0x00ca('0x6d'),_0x3d4cf4[_0x00ca('0x2a')],_0x3d4cf4[_0x00ca('0x69')])));return _0x3d4cf4;}})[_0x00ca('0x48')](function(_0x3c7613){throw new db[(_0x00ca('0x75'))][(_0x00ca('0x64'))](_0x3c7613[_0x00ca('0x71')]);});})[_0x00ca('0x26')](handleEntityNotFound(_0x1881da,null))[_0x00ca('0x26')](respondWithStatusCode(_0x1881da,0xcc))[_0x00ca('0x48')](handleError(_0x1881da,null));};exports[_0x00ca('0x76')]=function(_0x57f6ed,_0x2dd7d7,_0x20f01a){var _0x1055c3={};var _0xf163a2={};var _0x568227;var _0x1b0df6;return db[_0x00ca('0x2e')][_0x00ca('0x67')]({'where':{'id':_0x57f6ed[_0x00ca('0x4a')]['id']}})[_0x00ca('0x26')](handleEntityNotFound(_0x2dd7d7,null))[_0x00ca('0x26')](function(_0x48f115){if(_0x48f115){_0x568227=_0x48f115;_0xf163a2[_0x00ca('0x32')]=_[_0x00ca('0x33')](db[_0x00ca('0x66')][_0x00ca('0x4b')]);_0xf163a2['query']=_[_0x00ca('0x33')](_0x57f6ed['query']);_0xf163a2['filters']=_[_0x00ca('0x36')](_0xf163a2[_0x00ca('0x32')],_0xf163a2[_0x00ca('0x34')]);_0x1055c3[_0x00ca('0x37')]=_[_0x00ca('0x36')](_0xf163a2[_0x00ca('0x32')],qs['fields'](_0x57f6ed['query']['fields']));_0x1055c3[_0x00ca('0x37')]=_0x1055c3['attributes'][_0x00ca('0x39')]?_0x1055c3[_0x00ca('0x37')]:_0xf163a2[_0x00ca('0x32')];_0x1055c3[_0x00ca('0x3c')]=qs[_0x00ca('0x3d')](_0x57f6ed[_0x00ca('0x34')][_0x00ca('0x3d')]);_0x1055c3[_0x00ca('0x3e')]=qs[_0x00ca('0x35')](_['pick'](_0x57f6ed[_0x00ca('0x34')],_0xf163a2['filters']));if(_0x57f6ed['query'][_0x00ca('0x40')]){_0x1055c3[_0x00ca('0x3e')]=_[_0x00ca('0x42')](_0x1055c3['where'],{'$or':_[_0x00ca('0x2d')](_0x1055c3['attributes'],function(_0x4fc1e0){var _0x54fbce={};_0x54fbce[_0x4fc1e0]={'$like':'%'+_0x57f6ed['query'][_0x00ca('0x40')]+'%'};return _0x54fbce;})});}_0x1055c3=_[_0x00ca('0x42')]({},_0x1055c3,_0x57f6ed['options']);return _0x568227[_0x00ca('0x76')](_0x1055c3);}})[_0x00ca('0x26')](function(_0x1d5c3a){if(_0x1d5c3a){_0x1b0df6=_0x1d5c3a[_0x00ca('0x39')];if(!_0x57f6ed[_0x00ca('0x34')]['hasOwnProperty'](_0x00ca('0x77'))){_0x1055c3[_0x00ca('0x3b')]=qs[_0x00ca('0x3b')](_0x57f6ed['query'][_0x00ca('0x3b')]);_0x1055c3[_0x00ca('0x20')]=qs[_0x00ca('0x20')](_0x57f6ed[_0x00ca('0x34')][_0x00ca('0x20')]);}return _0x568227[_0x00ca('0x76')](_0x1055c3);}})['then'](function(_0x1a34d8){if(_0x1a34d8){return _0x1a34d8?{'count':_0x1b0df6,'rows':_0x1a34d8}:null;}})[_0x00ca('0x26')](respondWithResult(_0x2dd7d7,null))['catch'](handleError(_0x2dd7d7,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 2abdb52..e8d55d4 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 _0xaee1=['voice_musiconhold','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define'];(function(_0xd8a8af,_0x1e93f0){var _0x5b7278=function(_0x458800){while(--_0x458800){_0xd8a8af['push'](_0xd8a8af['shift']());}};_0x5b7278(++_0x1e93f0);}(_0xaee1,0x156));var _0x1aee=function(_0x4c47fa,_0x4cf8b2){_0x4c47fa=_0x4c47fa-0x0;var _0x2f7a2a=_0xaee1[_0x4c47fa];return _0x2f7a2a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x1aee('0x0'));var moment=require(_0x1aee('0x1'));var BPromise=require(_0x1aee('0x2'));var rp=require(_0x1aee('0x3'));var fs=require('fs');var path=require(_0x1aee('0x4'));var rimraf=require(_0x1aee('0x5'));var config=require(_0x1aee('0x6'));var attributes=require(_0x1aee('0x7'));module[_0x1aee('0x8')]=function(_0x5932a2,_0x31559d){return _0x5932a2[_0x1aee('0x9')]('VoiceMusicOnHold',attributes,{'tableName':_0x1aee('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8066=['voice_musiconhold','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./voiceMusicOnHold.attributes','define'];(function(_0x29c77e,_0x16e0ab){var _0x3a1aed=function(_0x935d55){while(--_0x935d55){_0x29c77e['push'](_0x29c77e['shift']());}};_0x3a1aed(++_0x16e0ab);}(_0x8066,0x83));var _0x6806=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0x8066[_0x3fba9f];return _0x192cf1;};'use strict';var _=require(_0x6806('0x0'));var util=require(_0x6806('0x1'));var logger=require('../../config/logger')(_0x6806('0x2'));var moment=require(_0x6806('0x3'));var BPromise=require(_0x6806('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6806('0x5'));var config=require(_0x6806('0x6'));var attributes=require(_0x6806('0x7'));module['exports']=function(_0x1ec999,_0x38eac6){return _0x1ec999[_0x6806('0x8')]('VoiceMusicOnHold',attributes,{'tableName':_0x6806('0x9'),'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 a6d4cfc..148dd68 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 _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','catch','util'];(function(_0x9e9044,_0x2d3c0f){var _0x1d4943=function(_0xd57c82){while(--_0xd57c82){_0x9e9044['push'](_0x9e9044['shift']());}};_0x1d4943(++_0x2d3c0f);}(_0xedd9,0xfc));var _0x9edd=function(_0x1bdfbd,_0x1c3ea8){_0x1bdfbd=_0x1bdfbd-0x0;var _0x419497=_0xedd9[_0x1bdfbd];return _0x419497;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file +var _0xa9e0=['http','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4463a1,_0x52f0f3){var _0x4dc43d=function(_0x17159f){while(--_0x17159f){_0x4463a1['push'](_0x4463a1['shift']());}};_0x4dc43d(++_0x52f0f3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index db0b21b..c3750ef 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 _0x5343=['getTeams','post','create','/:id/users','addAgents','/:id/teams','put','delete','destroy','removeAgents','removeTeams','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x4cd702,_0x4fa288){var _0x788d54=function(_0x279824){while(--_0x279824){_0x4cd702['push'](_0x4cd702['shift']());}};_0x788d54(++_0x4fa288);}(_0x5343,0x123));var _0x3534=function(_0x3a7cca,_0x15a80d){_0x3a7cca=_0x3a7cca-0x0;var _0x12556a=_0x5343[_0x3a7cca];return _0x12556a;};'use strict';var multer=require(_0x3534('0x0'));var util=require(_0x3534('0x1'));var path=require(_0x3534('0x2'));var timeout=require(_0x3534('0x3'));var express=require('express');var router=express[_0x3534('0x4')]();var fs_extra=require(_0x3534('0x5'));var auth=require(_0x3534('0x6'));var interaction=require(_0x3534('0x7'));var config=require(_0x3534('0x8'));var controller=require(_0x3534('0x9'));router[_0x3534('0xa')]('/',auth[_0x3534('0xb')](),controller[_0x3534('0xc')]);router[_0x3534('0xa')](_0x3534('0xd'),auth[_0x3534('0xb')](),controller[_0x3534('0xe')]);router[_0x3534('0xa')](_0x3534('0xf'),auth[_0x3534('0xb')](),controller[_0x3534('0x10')]);router[_0x3534('0xa')]('/:id/users',auth[_0x3534('0xb')](),controller['getAgents']);router[_0x3534('0xa')]('/:id/teams',auth[_0x3534('0xb')](),controller[_0x3534('0x11')]);router[_0x3534('0x12')]('/',auth[_0x3534('0xb')](),controller[_0x3534('0x13')]);router[_0x3534('0x12')](_0x3534('0x14'),auth[_0x3534('0xb')](),controller[_0x3534('0x15')]);router['post'](_0x3534('0x16'),auth[_0x3534('0xb')](),controller['addTeams']);router[_0x3534('0x17')](_0x3534('0xf'),auth[_0x3534('0xb')](),controller['update']);router[_0x3534('0x18')](_0x3534('0xf'),auth[_0x3534('0xb')](),controller[_0x3534('0x19')]);router[_0x3534('0x18')](_0x3534('0x14'),auth[_0x3534('0xb')](),controller[_0x3534('0x1a')]);router['delete'](_0x3534('0x16'),auth['isAuthenticated'](),controller[_0x3534('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x8375=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/users','/:id/teams','getTeams','post','create','addAgents','addTeams','put','update','delete','destroy','removeAgents','removeTeams','exports','util','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8375,0x132));var _0x5837=function(_0xc0dfa6,_0x78ded){_0xc0dfa6=_0xc0dfa6-0x0;var _0x57ef50=_0x8375[_0xc0dfa6];return _0x57ef50;};'use strict';var multer=require('multer');var util=require(_0x5837('0x0'));var path=require(_0x5837('0x1'));var timeout=require(_0x5837('0x2'));var express=require(_0x5837('0x3'));var router=express[_0x5837('0x4')]();var fs_extra=require(_0x5837('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5837('0x6'));var config=require(_0x5837('0x7'));var controller=require('./voicePrefix.controller');router[_0x5837('0x8')]('/',auth[_0x5837('0x9')](),controller[_0x5837('0xa')]);router[_0x5837('0x8')]('/describe',auth[_0x5837('0x9')](),controller[_0x5837('0xb')]);router[_0x5837('0x8')](_0x5837('0xc'),auth[_0x5837('0x9')](),controller[_0x5837('0xd')]);router[_0x5837('0x8')](_0x5837('0xe'),auth[_0x5837('0x9')](),controller['getAgents']);router[_0x5837('0x8')](_0x5837('0xf'),auth['isAuthenticated'](),controller[_0x5837('0x10')]);router[_0x5837('0x11')]('/',auth['isAuthenticated'](),controller[_0x5837('0x12')]);router['post'](_0x5837('0xe'),auth[_0x5837('0x9')](),controller[_0x5837('0x13')]);router[_0x5837('0x11')]('/:id/teams',auth[_0x5837('0x9')](),controller[_0x5837('0x14')]);router[_0x5837('0x15')]('/:id',auth[_0x5837('0x9')](),controller[_0x5837('0x16')]);router[_0x5837('0x17')](_0x5837('0xc'),auth[_0x5837('0x9')](),controller[_0x5837('0x18')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x5837('0x19')]);router[_0x5837('0x17')](_0x5837('0xf'),auth[_0x5837('0x9')](),controller[_0x5837('0x1a')]);module[_0x5837('0x1b')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index d3030f2..523f43d 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 _0x1d72=['VIRTUAL','sequelize','exports','STRING','name'];(function(_0x47c5bd,_0x7605da){var _0x2447dc=function(_0x1d4bff){while(--_0x1d4bff){_0x47c5bd['push'](_0x47c5bd['shift']());}};_0x2447dc(++_0x7605da);}(_0x1d72,0x1b9));var _0x21d7=function(_0x506c56,_0x1fc61b){_0x506c56=_0x506c56-0x0;var _0x1d6bc3=_0x1d72[_0x506c56];return _0x1d6bc3;};'use strict';var Sequelize=require(_0x21d7('0x0'));module[_0x21d7('0x1')]={'name':{'type':Sequelize[_0x21d7('0x2')],'allowNull':![],'unique':_0x21d7('0x3')},'prefix':{'type':Sequelize[_0x21d7('0x4')],'get':function(_0x6c894e){return'system-'+this['getDataValue'](_0x21d7('0x3'))+'-';}},'description':{'type':Sequelize[_0x21d7('0x2')]},'callerIdAll':{'type':Sequelize[_0x21d7('0x2')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x7650=['STRING','system-','name','INTEGER','exports'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x7650,0x9f));var _0x0765=function(_0xf8de87,_0x59ad61){_0xf8de87=_0xf8de87-0x0;var _0x16002f=_0x7650[_0xf8de87];return _0x16002f;};'use strict';var Sequelize=require('sequelize');module[_0x0765('0x0')]={'name':{'type':Sequelize[_0x0765('0x1')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x3ec8e1){return _0x0765('0x2')+this['getDataValue'](_0x0765('0x3'))+'-';}},'description':{'type':Sequelize[_0x0765('0x1')]},'callerIdAll':{'type':Sequelize[_0x0765('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x0765('0x4')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index cf0875c..dba0092 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 _0xb78e=['userVoicePrefix:remove','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','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/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','update','then','get','VoicePrefixes','destroy','sendStatus','name','index','map','VoicePrefix','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','include','findAll','catch','params','keys','rawAttributes','length','includeAll','find','create','sequelize','transaction','body','VoiceExtension','user','userProfileId','autoAssociation','error','exten','app','system','description','appdata','prefix','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','findById','addAgents','omit','ids','spread','emit','removeAgents','getAgents','User','pick','merge','getTeams','findOne','Team','addTeams','Agents','online','interface','flatMap','each','upsert','UserVoicePrefix','forEach','removeTeams','select','field','tq.TeamId','from','team_has_voice_prefixes','join','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','all','compact','value','isEmpty'];(function(_0x5a4f3b,_0x344159){var _0x33e973=function(_0x2ff5b0){while(--_0x2ff5b0){_0x5a4f3b['push'](_0x5a4f3b['shift']());}};_0x33e973(++_0x344159);}(_0xb78e,0x1c9));var _0xeb78=function(_0x1c91cf,_0x25816c){_0x1c91cf=_0x1c91cf-0x0;var _0x429176=_0xb78e[_0x1c91cf];return _0x429176;};'use strict';var emlformat=require(_0xeb78('0x0'));var rimraf=require(_0xeb78('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeb78('0x2'));var rp=require(_0xeb78('0x3'));var moment=require(_0xeb78('0x4'));var BPromise=require(_0xeb78('0x5'));var Mustache=require(_0xeb78('0x6'));var util=require(_0xeb78('0x7'));var path=require(_0xeb78('0x8'));var sox=require(_0xeb78('0x9'));var csv=require('to-csv');var ejs=require(_0xeb78('0xa'));var fs=require('fs');var fs_extra=require(_0xeb78('0xb'));var _=require(_0xeb78('0xc'));var squel=require(_0xeb78('0xd'));var crypto=require(_0xeb78('0xe'));var jsforce=require(_0xeb78('0xf'));var deskjs=require(_0xeb78('0x10'));var toCsv=require('to-csv');var querystring=require(_0xeb78('0x11'));var Papa=require(_0xeb78('0x12'));var Redis=require(_0xeb78('0x13'));var authService=require(_0xeb78('0x14'));var qs=require(_0xeb78('0x15'));var as=require(_0xeb78('0x16'));var hardwareService=require(_0xeb78('0x17'));var logger=require(_0xeb78('0x18'))(_0xeb78('0x19'));var utils=require('../../config/utils');var config=require(_0xeb78('0x1a'));var licenseUtil=require(_0xeb78('0x1b'));var db=require(_0xeb78('0x1c'))['db'];config[_0xeb78('0x1d')]=_[_0xeb78('0x1e')](config[_0xeb78('0x1d')],{'host':_0xeb78('0x1f'),'port':0x18eb});var socket=require(_0xeb78('0x20'))(new Redis(config[_0xeb78('0x1d')]));require(_0xeb78('0x21'))['register'](socket);function respondWithStatusCode(_0x315914,_0x3e4d24){_0x3e4d24=_0x3e4d24||0xcc;return function(_0x4e8b8c){if(_0x4e8b8c){return _0x315914['sendStatus'](_0x3e4d24);}return _0x315914['status'](_0x3e4d24)[_0xeb78('0x22')]();};}function respondWithResult(_0x50ebae,_0xa28d5e){_0xa28d5e=_0xa28d5e||0xc8;return function(_0x247cb1){if(_0x247cb1){return _0x50ebae['status'](_0xa28d5e)[_0xeb78('0x23')](_0x247cb1);}};}function respondWithFilteredResult(_0x53c811,_0x21c521){return function(_0x92e410){if(_0x92e410){var _0x576802=typeof _0x21c521[_0xeb78('0x24')]===_0xeb78('0x25')&&typeof _0x21c521[_0xeb78('0x26')]==='undefined';var _0x24d845=_0x92e410[_0xeb78('0x27')];var _0x4ab933=_0x576802?0x0:_0x21c521['offset'];var _0x455e30=_0x576802?_0x92e410[_0xeb78('0x27')]:_0x21c521[_0xeb78('0x24')]+_0x21c521[_0xeb78('0x26')];var _0x432b18;if(_0x455e30>=_0x24d845){_0x455e30=_0x24d845;_0x432b18=0xc8;}else{_0x432b18=0xce;}_0x53c811[_0xeb78('0x28')](_0x432b18);return _0x53c811[_0xeb78('0x29')](_0xeb78('0x2a'),_0x4ab933+'-'+_0x455e30+'/'+_0x24d845)[_0xeb78('0x23')](_0x92e410);}return null;};}function patchUpdates(_0x52b8c1){return function(_0x5d3cf8){try{jsonpatch['apply'](_0x5d3cf8,_0x52b8c1,!![]);}catch(_0x5c9e0d){return BPromise[_0xeb78('0x2b')](_0x5c9e0d);}return _0x5d3cf8['save']();};}function saveUpdates(_0x2159c1,_0x1fbf2f){return function(_0x566336){if(_0x566336){return _0x566336[_0xeb78('0x2c')](_0x2159c1)['then'](function(_0x9a00b){return _0x9a00b;});}return null;};}function removeEntity(_0x5fc575,_0x315f98){return function(_0x12b3b2){if(_0x12b3b2){return _0x12b3b2['destroy']()[_0xeb78('0x2d')](function(){var _0x515158=_0x12b3b2[_0xeb78('0x2e')]({'plain':!![]});var _0x23295a=_0xeb78('0x2f');return db['UserProfileResource'][_0xeb78('0x30')]({'where':{'type':_0x23295a,'resourceId':_0x515158['id']}})[_0xeb78('0x2d')](function(){return _0x12b3b2;});})[_0xeb78('0x2d')](function(){_0x5fc575[_0xeb78('0x28')](0xcc)[_0xeb78('0x22')]();});}};}function handleEntityNotFound(_0x3516b8,_0x1131a9){return function(_0x22c25f){if(!_0x22c25f){_0x3516b8[_0xeb78('0x31')](0x194);}return _0x22c25f;};}function handleError(_0x19ad00,_0x1f3a14){_0x1f3a14=_0x1f3a14||0x1f4;return function(_0x505468){logger['error'](_0x505468['stack']);if(_0x505468[_0xeb78('0x32')]){delete _0x505468[_0xeb78('0x32')];}_0x19ad00[_0xeb78('0x28')](_0x1f3a14)['send'](_0x505468);};}exports[_0xeb78('0x33')]=function(_0x1ecdfb,_0x3de59f){var _0x83b35d={},_0x4e720c={},_0x1a0ce6={'count':0x0,'rows':[]};var _0x1ec0bc=_[_0xeb78('0x34')](db[_0xeb78('0x35')]['rawAttributes'],function(_0x3ff33f){return{'name':_0x3ff33f['fieldName'],'type':_0x3ff33f[_0xeb78('0x36')][_0xeb78('0x37')]};});_0x4e720c[_0xeb78('0x38')]=_[_0xeb78('0x34')](_0x1ec0bc,_0xeb78('0x32'));_0x4e720c[_0xeb78('0x39')]=_['keys'](_0x1ecdfb['query']);_0x4e720c[_0xeb78('0x3a')]=_[_0xeb78('0x3b')](_0x4e720c[_0xeb78('0x38')],_0x4e720c[_0xeb78('0x39')]);_0x83b35d[_0xeb78('0x3c')]=_['intersection'](_0x4e720c[_0xeb78('0x38')],qs[_0xeb78('0x3d')](_0x1ecdfb[_0xeb78('0x39')][_0xeb78('0x3d')]));_0x83b35d[_0xeb78('0x3c')]=_0x83b35d[_0xeb78('0x3c')]['length']?_0x83b35d['attributes']:_0x4e720c['model'];if(!_0x1ecdfb['query'][_0xeb78('0x3e')](_0xeb78('0x3f'))){_0x83b35d[_0xeb78('0x26')]=qs['limit'](_0x1ecdfb[_0xeb78('0x39')][_0xeb78('0x26')]);_0x83b35d['offset']=qs['offset'](_0x1ecdfb['query'][_0xeb78('0x24')]);}_0x83b35d[_0xeb78('0x40')]=qs[_0xeb78('0x41')](_0x1ecdfb['query'][_0xeb78('0x41')]);_0x83b35d[_0xeb78('0x42')]=qs[_0xeb78('0x3a')](_['pick'](_0x1ecdfb[_0xeb78('0x39')],_0x4e720c[_0xeb78('0x3a')]),_0x1ec0bc);if(_0x1ecdfb[_0xeb78('0x39')][_0xeb78('0x43')]){_0x83b35d['where']=_['merge'](_0x83b35d[_0xeb78('0x42')],{'$or':_[_0xeb78('0x34')](_0x1ec0bc,function(_0x2e416b){if(_0x2e416b[_0xeb78('0x36')]!==_0xeb78('0x44')){var _0x2fbdb4={};_0x2fbdb4[_0x2e416b[_0xeb78('0x32')]]={'$like':'%'+_0x1ecdfb[_0xeb78('0x39')][_0xeb78('0x43')]+'%'};return _0x2fbdb4;}})});}_0x83b35d=_['merge']({},_0x83b35d,_0x1ecdfb[_0xeb78('0x45')]);var _0xa02a32={'where':_0x83b35d[_0xeb78('0x42')]};return db['VoicePrefix'][_0xeb78('0x27')](_0xa02a32)['then'](function(_0x21f81b){_0x1a0ce6[_0xeb78('0x27')]=_0x21f81b;if(_0x1ecdfb[_0xeb78('0x39')]['includeAll']){_0x83b35d[_0xeb78('0x46')]=[{'all':!![]}];}return db[_0xeb78('0x35')][_0xeb78('0x47')](_0x83b35d);})[_0xeb78('0x2d')](function(_0x2dc9f7){_0x1a0ce6['rows']=_0x2dc9f7;return _0x1a0ce6;})[_0xeb78('0x2d')](respondWithFilteredResult(_0x3de59f,_0x83b35d))[_0xeb78('0x48')](handleError(_0x3de59f,null));};exports['show']=function(_0xece1cb,_0x31a146){var _0x1f2610={'raw':![],'where':{'id':_0xece1cb[_0xeb78('0x49')]['id']}},_0x51dfbc={};_0x51dfbc[_0xeb78('0x38')]=_[_0xeb78('0x4a')](db[_0xeb78('0x35')][_0xeb78('0x4b')]);_0x51dfbc[_0xeb78('0x39')]=_['keys'](_0xece1cb['query']);_0x51dfbc[_0xeb78('0x3a')]=_[_0xeb78('0x3b')](_0x51dfbc['model'],_0x51dfbc[_0xeb78('0x39')]);_0x1f2610[_0xeb78('0x3c')]=_[_0xeb78('0x3b')](_0x51dfbc[_0xeb78('0x38')],qs[_0xeb78('0x3d')](_0xece1cb[_0xeb78('0x39')][_0xeb78('0x3d')]));_0x1f2610[_0xeb78('0x3c')]=_0x1f2610[_0xeb78('0x3c')][_0xeb78('0x4c')]?_0x1f2610[_0xeb78('0x3c')]:_0x51dfbc[_0xeb78('0x38')];if(_0xece1cb[_0xeb78('0x39')][_0xeb78('0x4d')]){_0x1f2610[_0xeb78('0x46')]=[{'all':!![]}];}_0x1f2610=_['merge']({},_0x1f2610,_0xece1cb[_0xeb78('0x45')]);return db[_0xeb78('0x35')][_0xeb78('0x4e')](_0x1f2610)[_0xeb78('0x2d')](handleEntityNotFound(_0x31a146,null))['then'](respondWithResult(_0x31a146,null))[_0xeb78('0x48')](handleError(_0x31a146,null));};exports[_0xeb78('0x30')]=function(_0xcaccc5,_0x3d30a4){return db[_0xeb78('0x35')]['find']({'where':{'id':_0xcaccc5['params']['id']}})['then'](handleEntityNotFound(_0x3d30a4,null))[_0xeb78('0x2d')](removeEntity(_0x3d30a4,null))[_0xeb78('0x48')](handleError(_0x3d30a4,null));};exports['describe']=function(_0x10efdb,_0x43164f){return db[_0xeb78('0x35')]['describe']()['then'](respondWithResult(_0x43164f,null))[_0xeb78('0x48')](handleError(_0x43164f,null));};exports[_0xeb78('0x4f')]=function(_0x1f5b67,_0x4e3f1a){var _0x3c7214;return db[_0xeb78('0x50')][_0xeb78('0x51')](function(_0x4a3c91){return db['VoicePrefix']['create'](_0x1f5b67[_0xeb78('0x52')],{'transaction':_0x4a3c91})[_0xeb78('0x2d')](function(_0x55c643){_0x3c7214=_0x55c643[_0xeb78('0x2e')]({'plain':!![]});return db[_0xeb78('0x53')][_0xeb78('0x4e')]({'where':{'id':_0x3c7214['VoiceExtensionId']},'raw':!![]})[_0xeb78('0x2d')](function(_0x572aaf){return createVoicePrefixExtensions(_0x3c7214,_0x572aaf,_0x4a3c91);});});})[_0xeb78('0x2d')](function(){var _0x151083=_0x1f5b67[_0xeb78('0x54')]['get']({'plain':!![]});if(!_0x151083)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x151083['role']==='user'){var _0x3238e9=_0x3c7214;return db['UserProfileSection'][_0xeb78('0x4e')]({'where':{'name':_0xeb78('0x2f'),'userProfileId':_0x151083[_0xeb78('0x55')]},'raw':!![]})[_0xeb78('0x2d')](function(_0x2a1f7f){if(_0x2a1f7f&&_0x2a1f7f[_0xeb78('0x56')]===0x0){return db['UserProfileResource']['create']({'name':_0x3238e9[_0xeb78('0x32')],'resourceId':_0x3238e9['id'],'type':_0x2a1f7f[_0xeb78('0x32')],'sectionId':_0x2a1f7f['id']},{})[_0xeb78('0x2d')](function(){return _0x3c7214;});}else{return _0x3c7214;}})[_0xeb78('0x48')](function(_0x480093){logger[_0xeb78('0x57')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x480093);throw _0x480093;});}return _0x3c7214;})[_0xeb78('0x2d')](respondWithResult(_0x4e3f1a,null))[_0xeb78('0x48')](handleError(_0x4e3f1a,null));};function Extension(_0x1d4761,_0x5b4998,_0x363cec,_0x37649c){this['context']='from-sip';this[_0xeb78('0x58')]=_0x1d4761;this[_0xeb78('0x59')]=_0x363cec;this['type']=_0xeb78('0x5a');this[_0xeb78('0x5b')]='Voice\x20Prefix\x20Extension';this['priority']=_0x5b4998;this[_0xeb78('0x5c')]=_0x37649c;}function createVoicePrefixExtensions(_0x5baf31,_0x539ad7,_0x2029ea){return new BPromise(function(_0x486899,_0x27b425){var _0x42c249=new Extension(formatPrefixName(_0x5baf31[_0xeb78('0x5d')]),0x1,'NoOp',_0xeb78('0x5e'));_0x42c249[_0xeb78('0x5f')]=_0x5baf31['id'];return db[_0xeb78('0x53')]['create'](_0x42c249,{'transaction':_0x2029ea})[_0xeb78('0x2d')](function(_0x4ec4ec){var _0xd61214=_0x4ec4ec[_0xeb78('0x2e')]({'plain':!![]});var _0x45aeaf=_[_0xeb78('0x34')](addVoicePrefixExtensions(_0x5baf31,_0x539ad7),function(_0x50d38d){_0x50d38d[_0xeb78('0x60')]=_0xd61214['id'];_0x50d38d['VoicePrefixId']=_0x5baf31['id'];return _0x50d38d;});return db[_0xeb78('0x53')][_0xeb78('0x61')](_0x45aeaf,{'transaction':_0x2029ea})[_0xeb78('0x2d')](function(_0x442fa7){if(!_0x442fa7){return _0x27b425(_0xeb78('0x62'));}else{return _0x486899(_0x442fa7);}})['catch'](function(_0x2ffe3b){return _0x27b425(_0x2ffe3b);});});;});};function addVoicePrefixExtensions(_0x2bf5a8,_0xf7eebe){var _0x22aa3a=[];var _0x3eb9c5=formatPrefixName(_0x2bf5a8[_0xeb78('0x5d')]);_0x22aa3a[_0xeb78('0x63')](new Extension(_0x3eb9c5,0x2,_0xeb78('0x64'),_0xeb78('0x65')+_0x2bf5a8[_0xeb78('0x32')]));if(_0x2bf5a8[_0xeb78('0x66')]){_0x22aa3a[_0xeb78('0x63')](new Extension(_0x3eb9c5,0x3,_0xeb78('0x64'),_0xeb78('0x67')+_0x2bf5a8[_0xeb78('0x66')]));}else{_0x22aa3a[_0xeb78('0x63')](new Extension(_0x3eb9c5,0x3,'NoOp',_0xeb78('0x68')));}_0x22aa3a[_0xeb78('0x63')](new Extension(_0x3eb9c5,0x4,_0xeb78('0x69'),_0xf7eebe['context']+','+_0xeb78('0x6a')+(0x8+_0x2bf5a8[_0xeb78('0x32')][_0xeb78('0x4c')])+'}'+','+0x1));return _0x22aa3a;}function formatPrefixName(_0x2208c2){var _0xe88f54='_';for(var _0x2d6f67=0x0;_0x2d6f67<_0x2208c2[_0xeb78('0x4c')];_0x2d6f67++){if(_0x2208c2[_0xeb78('0x6b')](_0x2d6f67)=='-'){_0xe88f54+=_0x2208c2[_0xeb78('0x6b')](_0x2d6f67);}else{_0xe88f54+='['+_0x2208c2['charAt'](_0x2d6f67)+']';}}_0xe88f54+='.';return _0xe88f54;}exports['update']=function(_0x2bf610,_0x129e0e,_0x44a2c8){var _0x30c186=_0x2bf610[_0xeb78('0x52')];_0x30c186[_0xeb78('0x5d')]=_0xeb78('0x6c')+_0x30c186[_0xeb78('0x32')]+'-';return db[_0xeb78('0x50')][_0xeb78('0x51')](function(_0x5c27de){return db[_0xeb78('0x35')][_0xeb78('0x2c')](_0x30c186,{'where':{'id':_0x30c186['id']},'transaction':_0x5c27de})[_0xeb78('0x2d')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x30c186['id']},'transaction':_0x5c27de})['then'](function(){return db['VoiceExtension'][_0xeb78('0x4e')]({'where':{'id':_0x30c186[_0xeb78('0x60')]},'raw':!![]})[_0xeb78('0x2d')](function(_0xf89f26){return createVoicePrefixExtensions(_0x30c186,_0xf89f26,_0x5c27de);});});});})[_0xeb78('0x2d')](function(){return db[_0xeb78('0x35')][_0xeb78('0x6d')](_0x30c186['id']);})[_0xeb78('0x2d')](respondWithResult(_0x129e0e,null))[_0xeb78('0x48')](handleError(_0x129e0e,null));};exports[_0xeb78('0x6e')]=function(_0x259525,_0x53cf73,_0x42cfd1){return db['VoicePrefix'][_0xeb78('0x4e')]({'where':{'id':_0x259525['params']['id']}})[_0xeb78('0x2d')](handleEntityNotFound(_0x53cf73,null))[_0xeb78('0x2d')](function(_0x2a9d4d){if(_0x2a9d4d){return _0x2a9d4d[_0xeb78('0x6e')](_0x259525[_0xeb78('0x52')]['ids'],_[_0xeb78('0x6f')](_0x259525[_0xeb78('0x52')],[_0xeb78('0x70'),'id'])||{})[_0xeb78('0x71')](function(_0x3896a1){for(var _0x2da098=0x0;_0x2da098<_0x259525[_0xeb78('0x52')][_0xeb78('0x70')][_0xeb78('0x4c')];_0x2da098+=0x1){socket[_0xeb78('0x72')]('userVoicePrefix:save',{'UserId':Number(_0x259525[_0xeb78('0x52')][_0xeb78('0x70')][_0x2da098]),'VoicePrefixId':Number(_0x259525[_0xeb78('0x49')]['id'])});}return _0x3896a1;});}})[_0xeb78('0x2d')](respondWithResult(_0x53cf73,null))[_0xeb78('0x48')](handleError(_0x53cf73,null));};exports[_0xeb78('0x73')]=function(_0x37217c,_0x5dbfef,_0x37a587){return db['VoicePrefix'][_0xeb78('0x4e')]({'where':{'id':_0x37217c[_0xeb78('0x49')]['id']}})[_0xeb78('0x2d')](handleEntityNotFound(_0x5dbfef,null))['then'](function(_0x1732e5){if(_0x1732e5){return _0x1732e5[_0xeb78('0x73')](_0x37217c['query'][_0xeb78('0x70')])[_0xeb78('0x2d')](function(){if(_['isArray'](_0x37217c[_0xeb78('0x39')][_0xeb78('0x70')])){for(var _0x1f000b=0x0;_0x1f000b<_0x37217c['query'][_0xeb78('0x70')][_0xeb78('0x4c')];_0x1f000b+=0x1){socket[_0xeb78('0x72')]('userVoicePrefix:remove',{'UserId':Number(_0x37217c[_0xeb78('0x39')][_0xeb78('0x70')][_0x1f000b]),'VoicePrefixId':Number(_0x37217c['params']['id'])});}}else{socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x37217c['query'][_0xeb78('0x70')]),'VoicePrefixId':Number(_0x37217c[_0xeb78('0x49')]['id'])});}});}})[_0xeb78('0x2d')](respondWithStatusCode(_0x5dbfef,null))[_0xeb78('0x48')](handleError(_0x5dbfef,null));};exports[_0xeb78('0x74')]=function(_0x468483,_0x7fc774,_0x34a1f3){var _0x3232a8={};var _0xd3ed51={};var _0x3386f3;var _0x21e3ac;return db[_0xeb78('0x35')]['findOne']({'where':{'id':_0x468483['params']['id']}})[_0xeb78('0x2d')](handleEntityNotFound(_0x7fc774,null))[_0xeb78('0x2d')](function(_0x39f1cc){if(_0x39f1cc){_0x3386f3=_0x39f1cc;_0xd3ed51[_0xeb78('0x38')]=_[_0xeb78('0x4a')](db[_0xeb78('0x75')]['rawAttributes']);_0xd3ed51[_0xeb78('0x39')]=_[_0xeb78('0x4a')](_0x468483['query']);_0xd3ed51[_0xeb78('0x3a')]=_[_0xeb78('0x3b')](_0xd3ed51[_0xeb78('0x38')],_0xd3ed51[_0xeb78('0x39')]);_0x3232a8[_0xeb78('0x3c')]=_[_0xeb78('0x3b')](_0xd3ed51[_0xeb78('0x38')],qs['fields'](_0x468483[_0xeb78('0x39')]['fields']));_0x3232a8[_0xeb78('0x3c')]=_0x3232a8[_0xeb78('0x3c')][_0xeb78('0x4c')]?_0x3232a8[_0xeb78('0x3c')]:_0xd3ed51['model'];_0x3232a8[_0xeb78('0x40')]=qs['sort'](_0x468483['query'][_0xeb78('0x41')]);_0x3232a8[_0xeb78('0x42')]=qs[_0xeb78('0x3a')](_[_0xeb78('0x76')](_0x468483[_0xeb78('0x39')],_0xd3ed51[_0xeb78('0x3a')]));if(_0x468483[_0xeb78('0x39')][_0xeb78('0x43')]){_0x3232a8[_0xeb78('0x42')]=_['merge'](_0x3232a8['where'],{'$or':_[_0xeb78('0x34')](_0x3232a8[_0xeb78('0x3c')],function(_0x2ea1fe){var _0x49936c={};_0x49936c[_0x2ea1fe]={'$like':'%'+_0x468483[_0xeb78('0x39')][_0xeb78('0x43')]+'%'};return _0x49936c;})});}_0x3232a8=_[_0xeb78('0x77')]({},_0x3232a8,_0x468483[_0xeb78('0x45')]);return _0x3386f3['getAgents'](_0x3232a8);}})['then'](function(_0x493f82){if(_0x493f82){_0x21e3ac=_0x493f82['length'];if(!_0x468483[_0xeb78('0x39')][_0xeb78('0x3e')](_0xeb78('0x3f'))){_0x3232a8[_0xeb78('0x26')]=qs[_0xeb78('0x26')](_0x468483[_0xeb78('0x39')]['limit']);_0x3232a8[_0xeb78('0x24')]=qs[_0xeb78('0x24')](_0x468483[_0xeb78('0x39')][_0xeb78('0x24')]);}return _0x3386f3[_0xeb78('0x74')](_0x3232a8);}})[_0xeb78('0x2d')](function(_0x51a349){if(_0x51a349){return _0x51a349?{'count':_0x21e3ac,'rows':_0x51a349}:null;}})[_0xeb78('0x2d')](respondWithResult(_0x7fc774,null))['catch'](handleError(_0x7fc774,null));};exports[_0xeb78('0x78')]=function(_0x506734,_0x30eb7c,_0x43637d){var _0x1ad737={};var _0x25cb1c={};var _0x335008;var _0x5d6506;return db[_0xeb78('0x35')][_0xeb78('0x79')]({'where':{'id':_0x506734['params']['id']}})[_0xeb78('0x2d')](handleEntityNotFound(_0x30eb7c,null))['then'](function(_0x2e9eb9){if(_0x2e9eb9){_0x335008=_0x2e9eb9;_0x25cb1c['model']=_[_0xeb78('0x4a')](db[_0xeb78('0x7a')][_0xeb78('0x4b')]);_0x25cb1c[_0xeb78('0x39')]=_[_0xeb78('0x4a')](_0x506734[_0xeb78('0x39')]);_0x25cb1c[_0xeb78('0x3a')]=_[_0xeb78('0x3b')](_0x25cb1c['model'],_0x25cb1c[_0xeb78('0x39')]);_0x1ad737[_0xeb78('0x3c')]=_['intersection'](_0x25cb1c[_0xeb78('0x38')],qs[_0xeb78('0x3d')](_0x506734[_0xeb78('0x39')][_0xeb78('0x3d')]));_0x1ad737[_0xeb78('0x3c')]=_0x1ad737['attributes'][_0xeb78('0x4c')]?_0x1ad737[_0xeb78('0x3c')]:_0x25cb1c['model'];_0x1ad737[_0xeb78('0x40')]=qs[_0xeb78('0x41')](_0x506734['query'][_0xeb78('0x41')]);_0x1ad737[_0xeb78('0x42')]=qs['filters'](_[_0xeb78('0x76')](_0x506734['query'],_0x25cb1c['filters']));if(_0x506734[_0xeb78('0x39')][_0xeb78('0x43')]){_0x1ad737[_0xeb78('0x42')]=_[_0xeb78('0x77')](_0x1ad737[_0xeb78('0x42')],{'$or':_[_0xeb78('0x34')](_0x1ad737[_0xeb78('0x3c')],function(_0x2da372){var _0x1a929b={};_0x1a929b[_0x2da372]={'$like':'%'+_0x506734[_0xeb78('0x39')]['filter']+'%'};return _0x1a929b;})});}_0x1ad737=_['merge']({},_0x1ad737,_0x506734[_0xeb78('0x45')]);return _0x335008[_0xeb78('0x78')](_0x1ad737);}})[_0xeb78('0x2d')](function(_0x3f99a1){if(_0x3f99a1){_0x5d6506=_0x3f99a1[_0xeb78('0x4c')];if(!_0x506734[_0xeb78('0x39')][_0xeb78('0x3e')](_0xeb78('0x3f'))){_0x1ad737[_0xeb78('0x26')]=qs[_0xeb78('0x26')](_0x506734[_0xeb78('0x39')][_0xeb78('0x26')]);_0x1ad737['offset']=qs['offset'](_0x506734[_0xeb78('0x39')]['offset']);}return _0x335008[_0xeb78('0x78')](_0x1ad737);}})['then'](function(_0x577f5f){if(_0x577f5f){return _0x577f5f?{'count':_0x5d6506,'rows':_0x577f5f}:null;}})[_0xeb78('0x2d')](respondWithResult(_0x30eb7c,null))[_0xeb78('0x48')](handleError(_0x30eb7c,null));};exports[_0xeb78('0x7b')]=function(_0x371c1d,_0x29a90d,_0xb69f0e){var _0x370f7a=_0x371c1d[_0xeb78('0x52')]['ids'];var _0x12773a;return db[_0xeb78('0x7a')]['findAll']({'where':{'id':_0x370f7a},'attributes':['id'],'include':[{'model':db[_0xeb78('0x75')],'as':_0xeb78('0x7c'),'attributes':['id',_0xeb78('0x32'),_0xeb78('0x7d'),'voicePause',_0xeb78('0x7e')],'raw':!![]}]})['then'](function(_0x64848b){if(_0x64848b){_0x12773a=_0x64848b;var _0x15b7d3=_[_0xeb78('0x7f')](_0x64848b,function(_0x523dc9){var _0x2401c8=_0x523dc9[_0xeb78('0x2e')]({'plain':!![]});return _0x2401c8[_0xeb78('0x7c')];});return db[_0xeb78('0x35')][_0xeb78('0x4e')]({'where':{'id':_0x371c1d[_0xeb78('0x49')]['id']}})[_0xeb78('0x2d')](function(_0x12b7d7){return db[_0xeb78('0x50')][_0xeb78('0x51')](function(_0x3e7088){return _0x12b7d7[_0xeb78('0x7b')](_0x370f7a,{'transaction':_0x3e7088})[_0xeb78('0x2d')](function(){return BPromise[_0xeb78('0x80')](_0x12773a,function(_0x5b1d20){return db['TeamVoicePrefix'][_0xeb78('0x81')]({'TeamId':_0x5b1d20['id'],'VoicePrefixId':_0x371c1d[_0xeb78('0x49')]['id']},{'transaction':_0x3e7088});});})[_0xeb78('0x2d')](function(){return BPromise[_0xeb78('0x80')](_0x15b7d3,function(_0x4c2c7e){return db[_0xeb78('0x82')]['findOrCreate']({'where':{'UserId':_0x4c2c7e['id'],'VoicePrefixId':_0x371c1d['params']['id']},'transaction':_0x3e7088});});})['then'](function(){_0x15b7d3[_0xeb78('0x83')](function(_0x1f5d36){socket['emit']('userVoicePrefix:save',{'UserId':_0x1f5d36['id'],'VoicePrefixId':_0x12b7d7['id']});});});});});}})['then'](respondWithStatusCode(_0x29a90d,null))[_0xeb78('0x48')](handleError(_0x29a90d,null));};exports[_0xeb78('0x84')]=function(_0x5fb310,_0x5553cf,_0x3d4163){return db[_0xeb78('0x7a')][_0xeb78('0x47')]({'where':{'id':_0x5fb310[_0xeb78('0x39')][_0xeb78('0x70')]},'attributes':['id'],'include':[{'model':db[_0xeb78('0x75')],'as':_0xeb78('0x7c'),'attributes':['id'],'raw':!![]}]})[_0xeb78('0x2d')](handleEntityNotFound(_0x5553cf,null))[_0xeb78('0x2d')](function(_0x502af6){var _0x32f23a=_[_0xeb78('0x34')](_0x502af6,'id');var _0x5a1c25=[];var _0x3e2374=[];var _0x3a80b7=squel[_0xeb78('0x85')]();_0x3a80b7[_0xeb78('0x86')](_0xeb78('0x87'))[_0xeb78('0x88')](_0xeb78('0x89'),'tq')[_0xeb78('0x8a')]('user_has_teams','ut',_0xeb78('0x8b'))[_0xeb78('0x42')](_0xeb78('0x8c'),_0x5fb310['params']['id']);for(var _0x55515a=0x0;_0x55515a<_0x502af6[_0xeb78('0x4c')];_0x55515a+=0x1){let _0x207202=_0x502af6[_0x55515a];for(var _0x5edbef=0x0;_0x5edbef<_0x207202[_0xeb78('0x7c')][_0xeb78('0x4c')];_0x5edbef+=0x1){let _0x55041b=_0x207202[_0xeb78('0x7c')][_0x5edbef];var _0x13d95b=_0x3a80b7['clone']();_0x13d95b[_0xeb78('0x42')](_0xeb78('0x8d'),_0x55041b['id']);_0x3e2374['push'](db[_0xeb78('0x50')][_0xeb78('0x39')](_0x13d95b[_0xeb78('0x8e')](),{'type':db[_0xeb78('0x50')][_0xeb78('0x8f')][_0xeb78('0x90')]})[_0xeb78('0x2d')](function(_0x5df43e){if(_0x5df43e[_0xeb78('0x4c')]===0x1){return _0x55041b['id'];}else{var _0x399b9c=_[_0xeb78('0x91')](_[_0xeb78('0x34')](_0x5df43e,_0xeb78('0x92')),function(_0x4beb24){return _['includes'](_0x32f23a,_0x4beb24);});if(_0x399b9c){return _0x55041b['id'];}}}));}}return BPromise[_0xeb78('0x93')](_0x3e2374)[_0xeb78('0x2d')](function(_0x497b99){_0x5a1c25=_(_0x5a1c25)['union'](_0x497b99)[_0xeb78('0x94')]()[_0xeb78('0x95')]();return db[_0xeb78('0x35')][_0xeb78('0x4e')]({'where':{'id':_0x5fb310[_0xeb78('0x49')]['id']}})['then'](function(_0x326468){return db['sequelize']['transaction'](function(_0x1170d3){return _0x326468['removeTeams'](_0x5fb310[_0xeb78('0x39')]['ids'],{'transaction':_0x1170d3})['then'](function(){if(!_[_0xeb78('0x96')](_0x5a1c25)){return _0x326468[_0xeb78('0x73')](_0x5a1c25,{'transaction':_0x1170d3});}})['then'](function(){_0x5a1c25[_0xeb78('0x83')](function(_0x10f23e){socket['emit'](_0xeb78('0x97'),{'UserId':_0x10f23e,'VoicePrefixId':_0x326468['id']});});});});});});})[_0xeb78('0x2d')](respondWithStatusCode(_0x5553cf,null))[_0xeb78('0x48')](handleError(_0x5553cf,null));}; \ No newline at end of file +var _0xdb28=['length','nolimit','order','sort','where','filters','pick','filter','merge','VoicePrefix','includeAll','include','findAll','rows','catch','params','fields','describe','create','sequelize','body','VoiceExtension','find','VoiceExtensionId','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','No\x20callerid\x20available','goto','${EXTEN:','charAt','update','system-','findById','addAgents','omit','spread','ids','emit','userVoicePrefix:save','isArray','userVoicePrefix:remove','findOne','User','options','hasOwnProperty','getAgents','getTeams','rawAttributes','addTeams','Team','Agents','online','voicePause','interface','flatMap','transaction','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','all','value','isEmpty','removeAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','get','VoicePrefixes','stack','name','send','map','fieldName','type','key','model','query','keys','intersection','attributes'];(function(_0x13b14f,_0x54f349){var _0x1626b6=function(_0x3e0c0f){while(--_0x3e0c0f){_0x13b14f['push'](_0x13b14f['shift']());}};_0x1626b6(++_0x54f349);}(_0xdb28,0x106));var _0x8db2=function(_0x3a20ab,_0x386d86){_0x3a20ab=_0x3a20ab-0x0;var _0x18331d=_0xdb28[_0x3a20ab];return _0x18331d;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];config[_0x8db2('0x19')]=_[_0x8db2('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8db2('0x1b'))(new Redis(config[_0x8db2('0x19')]));require(_0x8db2('0x1c'))[_0x8db2('0x1d')](socket);function respondWithStatusCode(_0x227355,_0xfa285b){_0xfa285b=_0xfa285b||0xcc;return function(_0x2f177a){if(_0x2f177a){return _0x227355[_0x8db2('0x1e')](_0xfa285b);}return _0x227355[_0x8db2('0x1f')](_0xfa285b)[_0x8db2('0x20')]();};}function respondWithResult(_0x5489a9,_0x13b0f5){_0x13b0f5=_0x13b0f5||0xc8;return function(_0x24da1b){if(_0x24da1b){return _0x5489a9['status'](_0x13b0f5)[_0x8db2('0x21')](_0x24da1b);}};}function respondWithFilteredResult(_0x44957d,_0x21db8c){return function(_0x3fddc2){if(_0x3fddc2){var _0x2efd06=typeof _0x21db8c[_0x8db2('0x22')]==='undefined'&&typeof _0x21db8c['limit']===_0x8db2('0x23');var _0x104e33=_0x3fddc2[_0x8db2('0x24')];var _0x1b64e4=_0x2efd06?0x0:_0x21db8c['offset'];var _0x431d60=_0x2efd06?_0x3fddc2[_0x8db2('0x24')]:_0x21db8c[_0x8db2('0x22')]+_0x21db8c[_0x8db2('0x25')];var _0x3dbe8e;if(_0x431d60>=_0x104e33){_0x431d60=_0x104e33;_0x3dbe8e=0xc8;}else{_0x3dbe8e=0xce;}_0x44957d['status'](_0x3dbe8e);return _0x44957d[_0x8db2('0x26')](_0x8db2('0x27'),_0x1b64e4+'-'+_0x431d60+'/'+_0x104e33)[_0x8db2('0x21')](_0x3fddc2);}return null;};}function patchUpdates(_0x125be2){return function(_0x2260d8){try{jsonpatch[_0x8db2('0x28')](_0x2260d8,_0x125be2,!![]);}catch(_0x796ec1){return BPromise['reject'](_0x796ec1);}return _0x2260d8[_0x8db2('0x29')]();};}function saveUpdates(_0x4f6516,_0x5725f0){return function(_0x52a9ca){if(_0x52a9ca){return _0x52a9ca['update'](_0x4f6516)[_0x8db2('0x2a')](function(_0x29b5cd){return _0x29b5cd;});}return null;};}function removeEntity(_0x3be281,_0x2baed0){return function(_0x145328){if(_0x145328){return _0x145328[_0x8db2('0x2b')]()['then'](function(){var _0x3544ba=_0x145328[_0x8db2('0x2c')]({'plain':!![]});var _0x430dd5=_0x8db2('0x2d');return db['UserProfileResource'][_0x8db2('0x2b')]({'where':{'type':_0x430dd5,'resourceId':_0x3544ba['id']}})[_0x8db2('0x2a')](function(){return _0x145328;});})[_0x8db2('0x2a')](function(){_0x3be281[_0x8db2('0x1f')](0xcc)[_0x8db2('0x20')]();});}};}function handleEntityNotFound(_0x21bae5,_0xa54ea3){return function(_0x3124d5){if(!_0x3124d5){_0x21bae5[_0x8db2('0x1e')](0x194);}return _0x3124d5;};}function handleError(_0x493cab,_0x4718ec){_0x4718ec=_0x4718ec||0x1f4;return function(_0x50b28d){logger['error'](_0x50b28d[_0x8db2('0x2e')]);if(_0x50b28d[_0x8db2('0x2f')]){delete _0x50b28d[_0x8db2('0x2f')];}_0x493cab['status'](_0x4718ec)[_0x8db2('0x30')](_0x50b28d);};}exports['index']=function(_0x3f7aac,_0x2b653b){var _0x14bd12={},_0x4d9e26={},_0x56e9c1={'count':0x0,'rows':[]};var _0x35d337=_[_0x8db2('0x31')](db['VoicePrefix']['rawAttributes'],function(_0x173989){return{'name':_0x173989[_0x8db2('0x32')],'type':_0x173989[_0x8db2('0x33')][_0x8db2('0x34')]};});_0x4d9e26[_0x8db2('0x35')]=_[_0x8db2('0x31')](_0x35d337,_0x8db2('0x2f'));_0x4d9e26[_0x8db2('0x36')]=_[_0x8db2('0x37')](_0x3f7aac[_0x8db2('0x36')]);_0x4d9e26['filters']=_[_0x8db2('0x38')](_0x4d9e26[_0x8db2('0x35')],_0x4d9e26['query']);_0x14bd12[_0x8db2('0x39')]=_[_0x8db2('0x38')](_0x4d9e26['model'],qs['fields'](_0x3f7aac[_0x8db2('0x36')]['fields']));_0x14bd12[_0x8db2('0x39')]=_0x14bd12[_0x8db2('0x39')][_0x8db2('0x3a')]?_0x14bd12[_0x8db2('0x39')]:_0x4d9e26['model'];if(!_0x3f7aac[_0x8db2('0x36')]['hasOwnProperty'](_0x8db2('0x3b'))){_0x14bd12[_0x8db2('0x25')]=qs[_0x8db2('0x25')](_0x3f7aac[_0x8db2('0x36')]['limit']);_0x14bd12['offset']=qs[_0x8db2('0x22')](_0x3f7aac[_0x8db2('0x36')]['offset']);}_0x14bd12[_0x8db2('0x3c')]=qs[_0x8db2('0x3d')](_0x3f7aac[_0x8db2('0x36')]['sort']);_0x14bd12[_0x8db2('0x3e')]=qs[_0x8db2('0x3f')](_[_0x8db2('0x40')](_0x3f7aac[_0x8db2('0x36')],_0x4d9e26[_0x8db2('0x3f')]),_0x35d337);if(_0x3f7aac[_0x8db2('0x36')][_0x8db2('0x41')]){_0x14bd12[_0x8db2('0x3e')]=_[_0x8db2('0x42')](_0x14bd12[_0x8db2('0x3e')],{'$or':_[_0x8db2('0x31')](_0x35d337,function(_0x20bf0b){if(_0x20bf0b[_0x8db2('0x33')]!=='VIRTUAL'){var _0x3ee510={};_0x3ee510[_0x20bf0b[_0x8db2('0x2f')]]={'$like':'%'+_0x3f7aac['query']['filter']+'%'};return _0x3ee510;}})});}_0x14bd12=_[_0x8db2('0x42')]({},_0x14bd12,_0x3f7aac['options']);var _0x130eb9={'where':_0x14bd12[_0x8db2('0x3e')]};return db[_0x8db2('0x43')][_0x8db2('0x24')](_0x130eb9)[_0x8db2('0x2a')](function(_0x30d606){_0x56e9c1[_0x8db2('0x24')]=_0x30d606;if(_0x3f7aac['query'][_0x8db2('0x44')]){_0x14bd12[_0x8db2('0x45')]=[{'all':!![]}];}return db[_0x8db2('0x43')][_0x8db2('0x46')](_0x14bd12);})['then'](function(_0x424c27){_0x56e9c1[_0x8db2('0x47')]=_0x424c27;return _0x56e9c1;})[_0x8db2('0x2a')](respondWithFilteredResult(_0x2b653b,_0x14bd12))[_0x8db2('0x48')](handleError(_0x2b653b,null));};exports['show']=function(_0x12d62d,_0x4e0749){var _0x19bd06={'raw':![],'where':{'id':_0x12d62d[_0x8db2('0x49')]['id']}},_0x116b69={};_0x116b69['model']=_['keys'](db[_0x8db2('0x43')]['rawAttributes']);_0x116b69[_0x8db2('0x36')]=_[_0x8db2('0x37')](_0x12d62d[_0x8db2('0x36')]);_0x116b69[_0x8db2('0x3f')]=_[_0x8db2('0x38')](_0x116b69[_0x8db2('0x35')],_0x116b69[_0x8db2('0x36')]);_0x19bd06[_0x8db2('0x39')]=_[_0x8db2('0x38')](_0x116b69[_0x8db2('0x35')],qs[_0x8db2('0x4a')](_0x12d62d[_0x8db2('0x36')]['fields']));_0x19bd06[_0x8db2('0x39')]=_0x19bd06[_0x8db2('0x39')][_0x8db2('0x3a')]?_0x19bd06[_0x8db2('0x39')]:_0x116b69['model'];if(_0x12d62d['query'][_0x8db2('0x44')]){_0x19bd06[_0x8db2('0x45')]=[{'all':!![]}];}_0x19bd06=_[_0x8db2('0x42')]({},_0x19bd06,_0x12d62d['options']);return db['VoicePrefix']['find'](_0x19bd06)[_0x8db2('0x2a')](handleEntityNotFound(_0x4e0749,null))[_0x8db2('0x2a')](respondWithResult(_0x4e0749,null))[_0x8db2('0x48')](handleError(_0x4e0749,null));};exports[_0x8db2('0x2b')]=function(_0xaab731,_0x4195ef){return db[_0x8db2('0x43')]['find']({'where':{'id':_0xaab731['params']['id']}})[_0x8db2('0x2a')](handleEntityNotFound(_0x4195ef,null))[_0x8db2('0x2a')](removeEntity(_0x4195ef,null))[_0x8db2('0x48')](handleError(_0x4195ef,null));};exports[_0x8db2('0x4b')]=function(_0x3daed6,_0x2bf408){return db[_0x8db2('0x43')][_0x8db2('0x4b')]()[_0x8db2('0x2a')](respondWithResult(_0x2bf408,null))[_0x8db2('0x48')](handleError(_0x2bf408,null));};exports[_0x8db2('0x4c')]=function(_0x319273,_0x345c74){var _0x2d518a;return db[_0x8db2('0x4d')]['transaction'](function(_0x2ded23){return db[_0x8db2('0x43')]['create'](_0x319273[_0x8db2('0x4e')],{'transaction':_0x2ded23})[_0x8db2('0x2a')](function(_0x3af298){_0x2d518a=_0x3af298['get']({'plain':!![]});return db[_0x8db2('0x4f')][_0x8db2('0x50')]({'where':{'id':_0x2d518a[_0x8db2('0x51')]},'raw':!![]})[_0x8db2('0x2a')](function(_0x1167d5){return createVoicePrefixExtensions(_0x2d518a,_0x1167d5,_0x2ded23);});});})['then'](function(){var _0x467505=_0x319273[_0x8db2('0x52')][_0x8db2('0x2c')]({'plain':!![]});if(!_0x467505)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x467505[_0x8db2('0x53')]===_0x8db2('0x52')){var _0x33dddd=_0x2d518a;return db[_0x8db2('0x54')][_0x8db2('0x50')]({'where':{'name':_0x8db2('0x2d'),'userProfileId':_0x467505[_0x8db2('0x55')]},'raw':!![]})['then'](function(_0x39ff90){if(_0x39ff90&&_0x39ff90[_0x8db2('0x56')]===0x0){return db['UserProfileResource'][_0x8db2('0x4c')]({'name':_0x33dddd[_0x8db2('0x2f')],'resourceId':_0x33dddd['id'],'type':_0x39ff90['name'],'sectionId':_0x39ff90['id']},{})[_0x8db2('0x2a')](function(){return _0x2d518a;});}else{return _0x2d518a;}})[_0x8db2('0x48')](function(_0x63e8f7){logger[_0x8db2('0x57')](_0x8db2('0x58'),_0x63e8f7);throw _0x63e8f7;});}return _0x2d518a;})[_0x8db2('0x2a')](respondWithResult(_0x345c74,null))[_0x8db2('0x48')](handleError(_0x345c74,null));};function Extension(_0x33a600,_0x120ef2,_0x173a5e,_0x12fd12){this[_0x8db2('0x59')]=_0x8db2('0x5a');this[_0x8db2('0x5b')]=_0x33a600;this[_0x8db2('0x5c')]=_0x173a5e;this[_0x8db2('0x33')]='system';this[_0x8db2('0x5d')]=_0x8db2('0x5e');this[_0x8db2('0x5f')]=_0x120ef2;this[_0x8db2('0x60')]=_0x12fd12;}function createVoicePrefixExtensions(_0x349db0,_0x53b2dc,_0x3dd6b1){return new BPromise(function(_0x2c3087,_0x3ab670){var _0x1e1c0d=new Extension(formatPrefixName(_0x349db0[_0x8db2('0x61')]),0x1,_0x8db2('0x62'),_0x8db2('0x63'));_0x1e1c0d[_0x8db2('0x64')]=_0x349db0['id'];return db[_0x8db2('0x4f')][_0x8db2('0x4c')](_0x1e1c0d,{'transaction':_0x3dd6b1})[_0x8db2('0x2a')](function(_0xfe6bac){var _0x170a72=_0xfe6bac[_0x8db2('0x2c')]({'plain':!![]});var _0xed9d36=_[_0x8db2('0x31')](addVoicePrefixExtensions(_0x349db0,_0x53b2dc),function(_0x1d7862){_0x1d7862[_0x8db2('0x51')]=_0x170a72['id'];_0x1d7862['VoicePrefixId']=_0x349db0['id'];return _0x1d7862;});return db[_0x8db2('0x4f')]['bulkCreate'](_0xed9d36,{'transaction':_0x3dd6b1})[_0x8db2('0x2a')](function(_0x570c53){if(!_0x570c53){return _0x3ab670(_0x8db2('0x65'));}else{return _0x2c3087(_0x570c53);}})[_0x8db2('0x48')](function(_0xe4fd6a){return _0x3ab670(_0xe4fd6a);});});;});};function addVoicePrefixExtensions(_0x1e2ccd,_0x1e812e){var _0x59a32e=[];var _0x50c5fb=formatPrefixName(_0x1e2ccd[_0x8db2('0x61')]);_0x59a32e[_0x8db2('0x66')](new Extension(_0x50c5fb,0x2,_0x8db2('0x67'),_0x8db2('0x68')+_0x1e2ccd[_0x8db2('0x2f')]));if(_0x1e2ccd[_0x8db2('0x69')]){_0x59a32e[_0x8db2('0x66')](new Extension(_0x50c5fb,0x3,_0x8db2('0x67'),'PREFIX-CALLERIDALL='+_0x1e2ccd[_0x8db2('0x69')]));}else{_0x59a32e[_0x8db2('0x66')](new Extension(_0x50c5fb,0x3,_0x8db2('0x62'),_0x8db2('0x6a')));}_0x59a32e[_0x8db2('0x66')](new Extension(_0x50c5fb,0x4,_0x8db2('0x6b'),_0x1e812e[_0x8db2('0x59')]+','+_0x8db2('0x6c')+(0x8+_0x1e2ccd['name']['length'])+'}'+','+0x1));return _0x59a32e;}function formatPrefixName(_0x358009){var _0x2f8beb='_';for(var _0x1d2dfc=0x0;_0x1d2dfc<_0x358009[_0x8db2('0x3a')];_0x1d2dfc++){if(_0x358009[_0x8db2('0x6d')](_0x1d2dfc)=='-'){_0x2f8beb+=_0x358009['charAt'](_0x1d2dfc);}else{_0x2f8beb+='['+_0x358009['charAt'](_0x1d2dfc)+']';}}_0x2f8beb+='.';return _0x2f8beb;}exports[_0x8db2('0x6e')]=function(_0x364807,_0x54f0d4,_0xa698bd){var _0x2be647=_0x364807[_0x8db2('0x4e')];_0x2be647['prefix']=_0x8db2('0x6f')+_0x2be647[_0x8db2('0x2f')]+'-';return db[_0x8db2('0x4d')]['transaction'](function(_0x3ff023){return db[_0x8db2('0x43')][_0x8db2('0x6e')](_0x2be647,{'where':{'id':_0x2be647['id']},'transaction':_0x3ff023})[_0x8db2('0x2a')](function(){return db[_0x8db2('0x4f')]['destroy']({'where':{'VoicePrefixId':_0x2be647['id']},'transaction':_0x3ff023})[_0x8db2('0x2a')](function(){return db[_0x8db2('0x4f')][_0x8db2('0x50')]({'where':{'id':_0x2be647['VoiceExtensionId']},'raw':!![]})['then'](function(_0x2cdf3c){return createVoicePrefixExtensions(_0x2be647,_0x2cdf3c,_0x3ff023);});});});})[_0x8db2('0x2a')](function(){return db['VoicePrefix'][_0x8db2('0x70')](_0x2be647['id']);})[_0x8db2('0x2a')](respondWithResult(_0x54f0d4,null))[_0x8db2('0x48')](handleError(_0x54f0d4,null));};exports[_0x8db2('0x71')]=function(_0xbf1fce,_0x16848b,_0x395ebb){return db[_0x8db2('0x43')][_0x8db2('0x50')]({'where':{'id':_0xbf1fce[_0x8db2('0x49')]['id']}})[_0x8db2('0x2a')](handleEntityNotFound(_0x16848b,null))[_0x8db2('0x2a')](function(_0x24a52d){if(_0x24a52d){return _0x24a52d['addAgents'](_0xbf1fce[_0x8db2('0x4e')]['ids'],_[_0x8db2('0x72')](_0xbf1fce[_0x8db2('0x4e')],['ids','id'])||{})[_0x8db2('0x73')](function(_0x2fa89d){for(var _0x5cdf53=0x0;_0x5cdf53<_0xbf1fce[_0x8db2('0x4e')][_0x8db2('0x74')][_0x8db2('0x3a')];_0x5cdf53+=0x1){socket[_0x8db2('0x75')](_0x8db2('0x76'),{'UserId':Number(_0xbf1fce[_0x8db2('0x4e')][_0x8db2('0x74')][_0x5cdf53]),'VoicePrefixId':Number(_0xbf1fce[_0x8db2('0x49')]['id'])});}return _0x2fa89d;});}})[_0x8db2('0x2a')](respondWithResult(_0x16848b,null))['catch'](handleError(_0x16848b,null));};exports['removeAgents']=function(_0x198c3b,_0x508f4a,_0xf8afa5){return db[_0x8db2('0x43')][_0x8db2('0x50')]({'where':{'id':_0x198c3b['params']['id']}})[_0x8db2('0x2a')](handleEntityNotFound(_0x508f4a,null))[_0x8db2('0x2a')](function(_0x3e37e7){if(_0x3e37e7){return _0x3e37e7['removeAgents'](_0x198c3b[_0x8db2('0x36')][_0x8db2('0x74')])[_0x8db2('0x2a')](function(){if(_[_0x8db2('0x77')](_0x198c3b['query'][_0x8db2('0x74')])){for(var _0x5f61b8=0x0;_0x5f61b8<_0x198c3b[_0x8db2('0x36')][_0x8db2('0x74')][_0x8db2('0x3a')];_0x5f61b8+=0x1){socket[_0x8db2('0x75')](_0x8db2('0x78'),{'UserId':Number(_0x198c3b[_0x8db2('0x36')][_0x8db2('0x74')][_0x5f61b8]),'VoicePrefixId':Number(_0x198c3b[_0x8db2('0x49')]['id'])});}}else{socket[_0x8db2('0x75')]('userVoicePrefix:remove',{'UserId':Number(_0x198c3b[_0x8db2('0x36')][_0x8db2('0x74')]),'VoicePrefixId':Number(_0x198c3b[_0x8db2('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x508f4a,null))['catch'](handleError(_0x508f4a,null));};exports['getAgents']=function(_0xa09b1d,_0xdba223,_0x3191c8){var _0x454377={};var _0x2ad024={};var _0x313918;var _0x339d09;return db[_0x8db2('0x43')][_0x8db2('0x79')]({'where':{'id':_0xa09b1d[_0x8db2('0x49')]['id']}})[_0x8db2('0x2a')](handleEntityNotFound(_0xdba223,null))['then'](function(_0x360a06){if(_0x360a06){_0x313918=_0x360a06;_0x2ad024[_0x8db2('0x35')]=_[_0x8db2('0x37')](db[_0x8db2('0x7a')]['rawAttributes']);_0x2ad024['query']=_[_0x8db2('0x37')](_0xa09b1d[_0x8db2('0x36')]);_0x2ad024['filters']=_[_0x8db2('0x38')](_0x2ad024[_0x8db2('0x35')],_0x2ad024[_0x8db2('0x36')]);_0x454377['attributes']=_['intersection'](_0x2ad024['model'],qs[_0x8db2('0x4a')](_0xa09b1d[_0x8db2('0x36')][_0x8db2('0x4a')]));_0x454377[_0x8db2('0x39')]=_0x454377[_0x8db2('0x39')]['length']?_0x454377[_0x8db2('0x39')]:_0x2ad024['model'];_0x454377[_0x8db2('0x3c')]=qs[_0x8db2('0x3d')](_0xa09b1d[_0x8db2('0x36')][_0x8db2('0x3d')]);_0x454377[_0x8db2('0x3e')]=qs['filters'](_['pick'](_0xa09b1d[_0x8db2('0x36')],_0x2ad024['filters']));if(_0xa09b1d[_0x8db2('0x36')][_0x8db2('0x41')]){_0x454377[_0x8db2('0x3e')]=_[_0x8db2('0x42')](_0x454377[_0x8db2('0x3e')],{'$or':_[_0x8db2('0x31')](_0x454377['attributes'],function(_0x19f9a0){var _0x222ea2={};_0x222ea2[_0x19f9a0]={'$like':'%'+_0xa09b1d[_0x8db2('0x36')]['filter']+'%'};return _0x222ea2;})});}_0x454377=_[_0x8db2('0x42')]({},_0x454377,_0xa09b1d[_0x8db2('0x7b')]);return _0x313918['getAgents'](_0x454377);}})[_0x8db2('0x2a')](function(_0x7cb97d){if(_0x7cb97d){_0x339d09=_0x7cb97d[_0x8db2('0x3a')];if(!_0xa09b1d[_0x8db2('0x36')][_0x8db2('0x7c')](_0x8db2('0x3b'))){_0x454377[_0x8db2('0x25')]=qs[_0x8db2('0x25')](_0xa09b1d[_0x8db2('0x36')]['limit']);_0x454377[_0x8db2('0x22')]=qs[_0x8db2('0x22')](_0xa09b1d[_0x8db2('0x36')][_0x8db2('0x22')]);}return _0x313918[_0x8db2('0x7d')](_0x454377);}})[_0x8db2('0x2a')](function(_0x16d1c5){if(_0x16d1c5){return _0x16d1c5?{'count':_0x339d09,'rows':_0x16d1c5}:null;}})[_0x8db2('0x2a')](respondWithResult(_0xdba223,null))[_0x8db2('0x48')](handleError(_0xdba223,null));};exports[_0x8db2('0x7e')]=function(_0x5e6fc4,_0x3e79cc,_0x7e4bf){var _0x339ffe={};var _0x1587e8={};var _0x5d371b;var _0x4589c7;return db[_0x8db2('0x43')][_0x8db2('0x79')]({'where':{'id':_0x5e6fc4['params']['id']}})['then'](handleEntityNotFound(_0x3e79cc,null))[_0x8db2('0x2a')](function(_0x6e5a58){if(_0x6e5a58){_0x5d371b=_0x6e5a58;_0x1587e8[_0x8db2('0x35')]=_[_0x8db2('0x37')](db['Team'][_0x8db2('0x7f')]);_0x1587e8[_0x8db2('0x36')]=_[_0x8db2('0x37')](_0x5e6fc4[_0x8db2('0x36')]);_0x1587e8['filters']=_[_0x8db2('0x38')](_0x1587e8[_0x8db2('0x35')],_0x1587e8[_0x8db2('0x36')]);_0x339ffe['attributes']=_['intersection'](_0x1587e8['model'],qs[_0x8db2('0x4a')](_0x5e6fc4[_0x8db2('0x36')][_0x8db2('0x4a')]));_0x339ffe[_0x8db2('0x39')]=_0x339ffe['attributes']['length']?_0x339ffe[_0x8db2('0x39')]:_0x1587e8[_0x8db2('0x35')];_0x339ffe[_0x8db2('0x3c')]=qs[_0x8db2('0x3d')](_0x5e6fc4[_0x8db2('0x36')][_0x8db2('0x3d')]);_0x339ffe['where']=qs[_0x8db2('0x3f')](_['pick'](_0x5e6fc4[_0x8db2('0x36')],_0x1587e8[_0x8db2('0x3f')]));if(_0x5e6fc4[_0x8db2('0x36')][_0x8db2('0x41')]){_0x339ffe[_0x8db2('0x3e')]=_['merge'](_0x339ffe[_0x8db2('0x3e')],{'$or':_[_0x8db2('0x31')](_0x339ffe['attributes'],function(_0x28beec){var _0x1334ea={};_0x1334ea[_0x28beec]={'$like':'%'+_0x5e6fc4[_0x8db2('0x36')][_0x8db2('0x41')]+'%'};return _0x1334ea;})});}_0x339ffe=_['merge']({},_0x339ffe,_0x5e6fc4[_0x8db2('0x7b')]);return _0x5d371b['getTeams'](_0x339ffe);}})['then'](function(_0xaa90b9){if(_0xaa90b9){_0x4589c7=_0xaa90b9[_0x8db2('0x3a')];if(!_0x5e6fc4[_0x8db2('0x36')][_0x8db2('0x7c')](_0x8db2('0x3b'))){_0x339ffe[_0x8db2('0x25')]=qs[_0x8db2('0x25')](_0x5e6fc4['query'][_0x8db2('0x25')]);_0x339ffe['offset']=qs['offset'](_0x5e6fc4[_0x8db2('0x36')]['offset']);}return _0x5d371b['getTeams'](_0x339ffe);}})[_0x8db2('0x2a')](function(_0x1642a7){if(_0x1642a7){return _0x1642a7?{'count':_0x4589c7,'rows':_0x1642a7}:null;}})[_0x8db2('0x2a')](respondWithResult(_0x3e79cc,null))['catch'](handleError(_0x3e79cc,null));};exports[_0x8db2('0x80')]=function(_0xb2ab8e,_0x30d410,_0x555ed0){var _0x27a916=_0xb2ab8e[_0x8db2('0x4e')][_0x8db2('0x74')];var _0x7ff636;return db[_0x8db2('0x81')][_0x8db2('0x46')]({'where':{'id':_0x27a916},'attributes':['id'],'include':[{'model':db[_0x8db2('0x7a')],'as':_0x8db2('0x82'),'attributes':['id','name',_0x8db2('0x83'),_0x8db2('0x84'),_0x8db2('0x85')],'raw':!![]}]})[_0x8db2('0x2a')](function(_0x20d69b){if(_0x20d69b){_0x7ff636=_0x20d69b;var _0x36199d=_[_0x8db2('0x86')](_0x20d69b,function(_0x2910c8){var _0x3a53e2=_0x2910c8[_0x8db2('0x2c')]({'plain':!![]});return _0x3a53e2[_0x8db2('0x82')];});return db['VoicePrefix'][_0x8db2('0x50')]({'where':{'id':_0xb2ab8e[_0x8db2('0x49')]['id']}})[_0x8db2('0x2a')](function(_0x58063b){return db[_0x8db2('0x4d')][_0x8db2('0x87')](function(_0x3c105f){return _0x58063b['addTeams'](_0x27a916,{'transaction':_0x3c105f})['then'](function(){return BPromise[_0x8db2('0x88')](_0x7ff636,function(_0x17d3ee){return db[_0x8db2('0x89')][_0x8db2('0x8a')]({'TeamId':_0x17d3ee['id'],'VoicePrefixId':_0xb2ab8e[_0x8db2('0x49')]['id']},{'transaction':_0x3c105f});});})[_0x8db2('0x2a')](function(){return BPromise[_0x8db2('0x88')](_0x36199d,function(_0x1f1aa5){return db[_0x8db2('0x8b')][_0x8db2('0x8c')]({'where':{'UserId':_0x1f1aa5['id'],'VoicePrefixId':_0xb2ab8e['params']['id']},'transaction':_0x3c105f});});})[_0x8db2('0x2a')](function(){_0x36199d[_0x8db2('0x8d')](function(_0x5b8adc){socket[_0x8db2('0x75')](_0x8db2('0x76'),{'UserId':_0x5b8adc['id'],'VoicePrefixId':_0x58063b['id']});});});});});}})[_0x8db2('0x2a')](respondWithStatusCode(_0x30d410,null))[_0x8db2('0x48')](handleError(_0x30d410,null));};exports[_0x8db2('0x8e')]=function(_0x2e4fb3,_0x8f84e4,_0x372efd){return db[_0x8db2('0x81')][_0x8db2('0x46')]({'where':{'id':_0x2e4fb3[_0x8db2('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0x8db2('0x7a')],'as':_0x8db2('0x82'),'attributes':['id'],'raw':!![]}]})[_0x8db2('0x2a')](handleEntityNotFound(_0x8f84e4,null))[_0x8db2('0x2a')](function(_0x1d27e3){var _0x296981=_['map'](_0x1d27e3,'id');var _0x137788=[];var _0x19bc4d=[];var _0x339dbf=squel[_0x8db2('0x8f')]();_0x339dbf[_0x8db2('0x90')](_0x8db2('0x91'))[_0x8db2('0x92')](_0x8db2('0x93'),'tq')[_0x8db2('0x94')](_0x8db2('0x95'),'ut',_0x8db2('0x96'))['where']('VoicePrefixId\x20=\x20?',_0x2e4fb3[_0x8db2('0x49')]['id']);for(var _0x56f59b=0x0;_0x56f59b<_0x1d27e3[_0x8db2('0x3a')];_0x56f59b+=0x1){let _0xccdab2=_0x1d27e3[_0x56f59b];for(var _0x2428f1=0x0;_0x2428f1<_0xccdab2['Agents'][_0x8db2('0x3a')];_0x2428f1+=0x1){let _0x28cfee=_0xccdab2[_0x8db2('0x82')][_0x2428f1];var _0x3e154a=_0x339dbf['clone']();_0x3e154a[_0x8db2('0x3e')](_0x8db2('0x97'),_0x28cfee['id']);_0x19bc4d[_0x8db2('0x66')](db['sequelize'][_0x8db2('0x36')](_0x3e154a[_0x8db2('0x98')](),{'type':db[_0x8db2('0x4d')]['QueryTypes'][_0x8db2('0x99')]})[_0x8db2('0x2a')](function(_0x41957f){if(_0x41957f['length']===0x1){return _0x28cfee['id'];}else{var _0x18ac5c=_[_0x8db2('0x9a')](_['map'](_0x41957f,_0x8db2('0x9b')),function(_0x231360){return _['includes'](_0x296981,_0x231360);});if(_0x18ac5c){return _0x28cfee['id'];}}}));}}return BPromise[_0x8db2('0x9c')](_0x19bc4d)[_0x8db2('0x2a')](function(_0x3d2729){_0x137788=_(_0x137788)['union'](_0x3d2729)['compact']()[_0x8db2('0x9d')]();return db['VoicePrefix']['find']({'where':{'id':_0x2e4fb3[_0x8db2('0x49')]['id']}})[_0x8db2('0x2a')](function(_0x37fda2){return db[_0x8db2('0x4d')][_0x8db2('0x87')](function(_0x3695cd){return _0x37fda2['removeTeams'](_0x2e4fb3['query'][_0x8db2('0x74')],{'transaction':_0x3695cd})[_0x8db2('0x2a')](function(){if(!_[_0x8db2('0x9e')](_0x137788)){return _0x37fda2[_0x8db2('0x9f')](_0x137788,{'transaction':_0x3695cd});}})['then'](function(){_0x137788[_0x8db2('0x8d')](function(_0x51d15e){socket[_0x8db2('0x75')]('userVoicePrefix:remove',{'UserId':_0x51d15e,'VoicePrefixId':_0x37fda2['id']});});});});});});})[_0x8db2('0x2a')](respondWithStatusCode(_0x8f84e4,null))[_0x8db2('0x48')](handleError(_0x8f84e4,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index a8f0872..e129acc 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 _0x0d29=['events','VoicePrefix','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x434454,_0x201581){var _0xb71208=function(_0x4fc861){while(--_0x4fc861){_0x434454['push'](_0x434454['shift']());}};_0xb71208(++_0x201581);}(_0x0d29,0x120));var _0x90d2=function(_0x2a6e43,_0x3fb67c){_0x2a6e43=_0x2a6e43-0x0;var _0x11c775=_0x0d29[_0x2a6e43];return _0x11c775;};'use strict';var EventEmitter=require(_0x90d2('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0x90d2('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x90d2('0x2')](0x0);var events={'afterCreate':_0x90d2('0x3'),'afterUpdate':_0x90d2('0x4'),'afterDestroy':_0x90d2('0x5')};function emitEvent(_0x30f5e0){return function(_0x570c2c,_0x224b20,_0x278851){VoicePrefixEvents['emit'](_0x30f5e0+':'+_0x570c2c['id'],_0x570c2c);VoicePrefixEvents[_0x90d2('0x6')](_0x30f5e0,_0x570c2c);_0x278851(null);};}for(var e in events){if(events[_0x90d2('0x7')](e)){var event=events[e];VoicePrefix[_0x90d2('0x8')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x4247=['update','remove','emit','hook','events','VoicePrefix','setMaxListeners','save'];(function(_0x1bb6aa,_0x40fe82){var _0x2ef28e=function(_0x32b4eb){while(--_0x32b4eb){_0x1bb6aa['push'](_0x1bb6aa['shift']());}};_0x2ef28e(++_0x40fe82);}(_0x4247,0x1b4));var _0x7424=function(_0x3d1b99,_0x46bc29){_0x3d1b99=_0x3d1b99-0x0;var _0xf50a0f=_0x4247[_0x3d1b99];return _0xf50a0f;};'use strict';var EventEmitter=require(_0x7424('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0x7424('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x7424('0x2')](0x0);var events={'afterCreate':_0x7424('0x3'),'afterUpdate':_0x7424('0x4'),'afterDestroy':_0x7424('0x5')};function emitEvent(_0x167c94){return function(_0x3a3557,_0x2a6212,_0x5a95fe){VoicePrefixEvents[_0x7424('0x6')](_0x167c94+':'+_0x3a3557['id'],_0x3a3557);VoicePrefixEvents[_0x7424('0x6')](_0x167c94,_0x3a3557);_0x5a95fe(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x7424('0x7')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 4e0c937..dcc9559 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 _0xcc42=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','voice_prefixes'];(function(_0xea36c6,_0x20831a){var _0x68ffe1=function(_0x2a6569){while(--_0x2a6569){_0xea36c6['push'](_0xea36c6['shift']());}};_0x68ffe1(++_0x20831a);}(_0xcc42,0x17a));var _0x2cc4=function(_0x1e500e,_0x2c9d74){_0x1e500e=_0x1e500e-0x0;var _0x10dc5e=_0xcc42[_0x1e500e];return _0x10dc5e;};'use strict';var _=require(_0x2cc4('0x0'));var util=require(_0x2cc4('0x1'));var logger=require(_0x2cc4('0x2'))(_0x2cc4('0x3'));var moment=require(_0x2cc4('0x4'));var BPromise=require(_0x2cc4('0x5'));var rp=require(_0x2cc4('0x6'));var fs=require('fs');var path=require(_0x2cc4('0x7'));var rimraf=require(_0x2cc4('0x8'));var config=require(_0x2cc4('0x9'));var attributes=require(_0x2cc4('0xa'));module[_0x2cc4('0xb')]=function(_0x2c3e3c,_0x57687d){return _0x2c3e3c[_0x2cc4('0xc')]('VoicePrefix',attributes,{'tableName':_0x2cc4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd60=['api','bluebird','request-promise','../../config/environment','./voicePrefix.attributes','VoicePrefix','voice_prefixes','lodash','util','../../config/logger'];(function(_0x3559c7,_0x53b4d6){var _0x4c3b8b=function(_0x3687ae){while(--_0x3687ae){_0x3559c7['push'](_0x3559c7['shift']());}};_0x4c3b8b(++_0x53b4d6);}(_0xbd60,0x1b5));var _0x0bd6=function(_0x14ec54,_0x2d5098){_0x14ec54=_0x14ec54-0x0;var _0x2f8c0e=_0xbd60[_0x14ec54];return _0x2f8c0e;};'use strict';var _=require(_0x0bd6('0x0'));var util=require(_0x0bd6('0x1'));var logger=require(_0x0bd6('0x2'))(_0x0bd6('0x3'));var moment=require('moment');var BPromise=require(_0x0bd6('0x4'));var rp=require(_0x0bd6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0bd6('0x6'));var attributes=require(_0x0bd6('0x7'));module['exports']=function(_0x5677cd,_0x50648f){return _0x5677cd['define'](_0x0bd6('0x8'),attributes,{'tableName':_0x0bd6('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 a487d48..ff1e76f 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(_0x388713,_0x42c7ea){var _0x187a1e=function(_0x2bb026){while(--_0x2bb026){_0x388713['push'](_0x388713['shift']());}};_0x187a1e(++_0x42c7ea);}(_0x5ff9,0xa0));var _0x95ff=function(_0x1a529d,_0x5a7f40){_0x1a529d=_0x1a529d-0x0;var _0xd251f7=_0x5ff9[_0x1a529d];return _0xd251f7;};'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 _0x2da6=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x507032,_0x1a0960){var _0x2273a3=function(_0x23234b){while(--_0x23234b){_0x507032['push'](_0x507032['shift']());}};_0x2273a3(++_0x1a0960);}(_0x2da6,0x1dd));var _0x62da=function(_0x4db287,_0x4381c2){_0x4db287=_0x4db287-0x0;var _0x229bc9=_0x2da6[_0x4db287];return _0x229bc9;};'use strict';var _=require(_0x62da('0x0'));var util=require(_0x62da('0x1'));var moment=require(_0x62da('0x2'));var BPromise=require(_0x62da('0x3'));var rs=require(_0x62da('0x4'));var fs=require('fs');var Redis=require(_0x62da('0x5'));var db=require(_0x62da('0x6'))['db'];var utils=require(_0x62da('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x62da('0x8'));var jayson=require(_0x62da('0x9'));var client=jayson[_0x62da('0xa')][_0x62da('0xb')]({'port':0x232a});config[_0x62da('0xc')]=_[_0x62da('0xd')](config[_0x62da('0xc')],{'host':_0x62da('0xe'),'port':0x18eb});var socket=require(_0x62da('0xf'))(new Redis(config['redis']));require(_0x62da('0x10'))[_0x62da('0x11')](socket);function respondWithRpcPromise(_0x2a3d7c,_0x1b68f8,_0x4cd5a2){return new BPromise(function(_0x241090,_0x3afe3b){return client[_0x62da('0x12')](_0x2a3d7c,_0x4cd5a2)[_0x62da('0x13')](function(_0x23be32){logger['info'](_0x62da('0x14'),_0x1b68f8,_0x62da('0x15'));logger[_0x62da('0x16')](_0x62da('0x17'),_0x1b68f8,_0x62da('0x15'),JSON['stringify'](_0x23be32));if(_0x23be32['error']){if(_0x23be32[_0x62da('0x18')][_0x62da('0x19')]===0x1f4){logger[_0x62da('0x18')](_0x62da('0x14'),_0x1b68f8,_0x23be32[_0x62da('0x18')][_0x62da('0x1a')]);return _0x3afe3b(_0x23be32[_0x62da('0x18')][_0x62da('0x1a')]);}logger[_0x62da('0x18')](_0x62da('0x14'),_0x1b68f8,_0x23be32[_0x62da('0x18')][_0x62da('0x1a')]);return _0x241090(_0x23be32[_0x62da('0x18')][_0x62da('0x1a')]);}else{logger['info']('VoicePrefix,\x20%s,\x20%s',_0x1b68f8,_0x62da('0x15'));_0x241090(_0x23be32['result'][_0x62da('0x1a')]);}})[_0x62da('0x1b')](function(_0x15b8d0){logger['error'](_0x62da('0x14'),_0x1b68f8,_0x15b8d0);_0x3afe3b(_0x15b8d0);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 7ab37af..0f1b6df 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 _0x2f3a=['voicePrefix:','./voicePrefix.events','update','emit','removeListener'];(function(_0x4e0f29,_0x50d824){var _0x157d76=function(_0x22c66a){while(--_0x22c66a){_0x4e0f29['push'](_0x4e0f29['shift']());}};_0x157d76(++_0x50d824);}(_0x2f3a,0xfb));var _0xa2f3=function(_0x468cb4,_0x3b5cb8){_0x468cb4=_0x468cb4-0x0;var _0x474032=_0x2f3a[_0x468cb4];return _0x474032;};'use strict';var VoicePrefixEvents=require(_0xa2f3('0x0'));var events=['save','remove',_0xa2f3('0x1')];function createListener(_0x377db3,_0x5551cd){return function(_0x2b064c){_0x5551cd[_0xa2f3('0x2')](_0x377db3,_0x2b064c);};}function removeListener(_0xdf4c17,_0x50ef95){return function(){VoicePrefixEvents[_0xa2f3('0x3')](_0xdf4c17,_0x50ef95);};}exports['register']=function(_0xfe0b09){for(var _0x1ddec0=0x0,_0x4db21d=events['length'];_0x1ddec0<_0x4db21d;_0x1ddec0++){var _0x2faf36=events[_0x1ddec0];var _0x3944a0=createListener(_0xa2f3('0x4')+_0x2faf36,_0xfe0b09);VoicePrefixEvents['on'](_0x2faf36,_0x3944a0);}}; \ No newline at end of file +var _0x652b=['length','voicePrefix:','./voicePrefix.events','save','remove','emit'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x652b,0x68));var _0xb652=function(_0x490be3,_0xf0fca3){_0x490be3=_0x490be3-0x0;var _0x3f5140=_0x652b[_0x490be3];return _0x3f5140;};'use strict';var VoicePrefixEvents=require(_0xb652('0x0'));var events=[_0xb652('0x1'),_0xb652('0x2'),'update'];function createListener(_0x4070c6,_0x4a11b5){return function(_0x5b10a1){_0x4a11b5[_0xb652('0x3')](_0x4070c6,_0x5b10a1);};}function removeListener(_0x1dd99b,_0x1c8fb4){return function(){VoicePrefixEvents['removeListener'](_0x1dd99b,_0x1c8fb4);};}exports['register']=function(_0x43f467){for(var _0x491ce7=0x0,_0x58d168=events[_0xb652('0x4')];_0x491ce7<_0x58d168;_0x491ce7++){var _0x5c0245=events[_0x491ce7];var _0x2b82fd=createListener(_0xb652('0x5')+_0x5c0245,_0x43f467);VoicePrefixEvents['on'](_0x5c0245,_0x2b82fd);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index cbd0adc..c092a1b 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(_0x55e7b8,_0x55899e){var _0x1c641f=function(_0x7cf9e2){while(--_0x7cf9e2){_0x55e7b8['push'](_0x55e7b8['shift']());}};_0x1c641f(++_0x55899e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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(_0xe8f403,_0x21fd86){var _0x3ac6d4=function(_0x3fb88f){while(--_0x3fb88f){_0xe8f403['push'](_0xe8f403['shift']());}};_0x3ac6d4(++_0x21fd86);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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 f98406b..b095cfd 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 _0x5edf=['leastrecent','fewestcalls','random','linear','wrandom','setDataValue','strategy','rrmemory','type','getDataValue','dialMethod','outbound','preview','booked','roundrobin','INTEGER','yes','all','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','agentBusyFactor','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)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','default','ringall'];(function(_0x16e6ce,_0x35bae8){var _0x4fdd00=function(_0x133488){while(--_0x133488){_0x16e6ce['push'](_0x16e6ce['shift']());}};_0x4fdd00(++_0x35bae8);}(_0x5edf,0x9a));var _0xf5ed=function(_0x4695c7,_0xe06c){_0x4695c7=_0x4695c7-0x0;var _0x1ae824=_0x5edf[_0x4695c7];return _0x1ae824;};'use strict';var Sequelize=require(_0xf5ed('0x0'));module[_0xf5ed('0x1')]={'name':{'type':Sequelize[_0xf5ed('0x2')],'allowNull':![],'unique':_0xf5ed('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xf5ed('0x4')]('inbound','outbound'),'allowNull':![],'defaultValue':_0xf5ed('0x5')},'musiconhold':{'type':Sequelize[_0xf5ed('0x2')],'defaultValue':_0xf5ed('0x6')},'announce':{'type':Sequelize[_0xf5ed('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0xf5ed('0x4')]('rr',_0xf5ed('0x7'),_0xf5ed('0x8'),_0xf5ed('0x9'),_0xf5ed('0xa'),'rrmemory',_0xf5ed('0xb'),_0xf5ed('0xc'),'rrordered'),'allowNull':![],'defaultValue':_0xf5ed('0x7'),'set':function(_0x58ad9a){this[_0xf5ed('0xd')](_0xf5ed('0xe'),_0x58ad9a?_0x58ad9a:_0xf5ed('0xf'));},'get':function(){var _0x5c5b46=this['getDataValue'](_0xf5ed('0x10'));var _0x1f01f5=this[_0xf5ed('0x11')](_0xf5ed('0x12'));var _0x40403b=this[_0xf5ed('0x11')]('strategy');if(_0x5c5b46===_0xf5ed('0x13')){if(_0x1f01f5===_0xf5ed('0x14')){return null;}if(_0x1f01f5===_0xf5ed('0x15')&&![_0xf5ed('0xf'),_0xf5ed('0x16')]['includes'](_0x40403b)){this[_0xf5ed('0xd')](_0xf5ed('0xe'),_0xf5ed('0xf'));}}return _0x40403b;}},'servicelevel':{'type':Sequelize[_0xf5ed('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xf5ed('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xf5ed('0x17')](0xb)},'timeout':{'type':Sequelize[_0xf5ed('0x17')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xf5ed('0x2')]},'weight':{'type':Sequelize[_0xf5ed('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xf5ed('0x17')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xf5ed('0x4')](_0xf5ed('0x18'),'no'),'defaultValue':_0xf5ed('0x18')},'autopause':{'type':Sequelize[_0xf5ed('0x4')](_0xf5ed('0x18'),'no',_0xf5ed('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xf5ed('0x17')](0xb)},'autopausebusy':{'type':Sequelize[_0xf5ed('0x4')](_0xf5ed('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xf5ed('0x4')](_0xf5ed('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xf5ed('0x17')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xf5ed('0x4')](_0xf5ed('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xf5ed('0x4')](_0xf5ed('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xf5ed('0x4')](_0xf5ed('0x18'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xf5ed('0x4')](_0xf5ed('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xf5ed('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xf5ed('0x17')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xf5ed('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xf5ed('0x17')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xf5ed('0x4')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xf5ed('0x4')]('yes','no'),'defaultValue':_0xf5ed('0x18')},'announce_holdtime':{'type':Sequelize[_0xf5ed('0x4')](_0xf5ed('0x18'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xf5ed('0x4')]('yes','no')},'announce_position_limit':{'type':Sequelize[_0xf5ed('0x17')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xf5ed('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xf5ed('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xf5ed('0x2')]},'queue_youarenext':{'type':Sequelize[_0xf5ed('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xf5ed('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xf5ed('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xf5ed('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xf5ed('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xf5ed('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0xf5ed('0x2')]},'queue_quantity2':{'type':Sequelize[_0xf5ed('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0xf5ed('0x2')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0xf5ed('0x1a')],'set':function(_0x54ce0d){this[_0xf5ed('0xd')](_0xf5ed('0x1b'),_0x54ce0d?_0x54ce0d[_0xf5ed('0x1c')](','):[]);},'get':function(){return this[_0xf5ed('0x11')](_0xf5ed('0x1b'))?this[_0xf5ed('0x11')]('periodic_announce')[_0xf5ed('0x1d')](','):[];}},'joinempty':{'type':Sequelize[_0xf5ed('0x2')],'defaultValue':_0xf5ed('0x18'),'set':function(_0x5b6e1a){this[_0xf5ed('0xd')](_0xf5ed('0x1e'),_0x5b6e1a?_0x5b6e1a[_0xf5ed('0x1c')](','):undefined);},'get':function(){return this[_0xf5ed('0x11')](_0xf5ed('0x1e'))?this[_0xf5ed('0x11')]('joinempty')['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xf5ed('0x2')],'defaultValue':'no','set':function(_0x255b1d){this[_0xf5ed('0xd')](_0xf5ed('0x1f'),_0x255b1d?_0x255b1d[_0xf5ed('0x1c')](','):undefined);},'get':function(){return this[_0xf5ed('0x11')](_0xf5ed('0x1f'))?this['getDataValue'](_0xf5ed('0x1f'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xf5ed('0x4')](_0xf5ed('0x18'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xf5ed('0x4')](_0xf5ed('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xf5ed('0x4')](_0xf5ed('0x18'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xf5ed('0x2')]},'description':{'type':Sequelize[_0xf5ed('0x2')]},'acw':{'type':Sequelize[_0xf5ed('0x20')],'defaultValue':0x0,'set':function(_0x301f86){this['setDataValue'](_0xf5ed('0x21'),_0x301f86);if(_0x301f86){if(this[_0xf5ed('0x11')](_0xf5ed('0x22'))<0x2){this[_0xf5ed('0xd')](_0xf5ed('0x22'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xf5ed('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xf5ed('0x20')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0xf5ed('0x4')](_0xf5ed('0x14'),_0xf5ed('0x23'),'power','predictive',_0xf5ed('0x15')),'defaultValue':_0xf5ed('0x23'),'comment':_0xf5ed('0x24')},'dialLimitChannel':{'type':Sequelize[_0xf5ed('0x17')](0x4)[_0xf5ed('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xf5ed('0x26')},'dialLimitQueue':{'type':Sequelize[_0xf5ed('0x17')](0x4)[_0xf5ed('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0xf5ed('0x27')](0x2)[_0xf5ed('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0xf5ed('0x4')](_0xf5ed('0x28'),'dropRate'),'defaultValue':_0xf5ed('0x29'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xf5ed('0x27')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xf5ed('0x2a')},'dialPredictiveInterval':{'type':Sequelize[_0xf5ed('0x17')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xf5ed('0x2b')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xf5ed('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xf5ed('0x17')](0x3)[_0xf5ed('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf5ed('0x2c')},'dialQueueOptions':{'type':Sequelize[_0xf5ed('0x2')],'defaultValue':_0xf5ed('0x2d'),'comment':_0xf5ed('0x2e')},'dialQueueTimeout':{'type':Sequelize[_0xf5ed('0x17')](0x3)[_0xf5ed('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf5ed('0x2f')},'dialQueueProject':{'type':Sequelize[_0xf5ed('0x2')],'comment':_0xf5ed('0x30')},'dialCongestionMaxRetry':{'type':Sequelize[_0xf5ed('0x17')](0x3)[_0xf5ed('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf5ed('0x31')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xf5ed('0x17')](0x5)[_0xf5ed('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf5ed('0x32')},'dialBusyMaxRetry':{'type':Sequelize[_0xf5ed('0x17')](0x3)[_0xf5ed('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf5ed('0x33')},'dialBusyRetryFrequency':{'type':Sequelize[_0xf5ed('0x17')](0x5)[_0xf5ed('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf5ed('0x34')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xf5ed('0x35')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf5ed('0x36')},'dialGlobalMaxRetry':{'type':Sequelize[_0xf5ed('0x17')](0x3)[_0xf5ed('0x25')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xf5ed('0x37')},'dialTimezone':{'type':Sequelize[_0xf5ed('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xf5ed('0x38')},'dialPrefix':{'type':Sequelize[_0xf5ed('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xf5ed('0x4')](_0xf5ed('0x39'),'never',_0xf5ed('0x3a')),'defaultValue':_0xf5ed('0x39')},'dialAMDActive':{'type':Sequelize[_0xf5ed('0x20')],'defaultValue':0x0,'comment':_0xf5ed('0x3b')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xf5ed('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xf5ed('0x17')](0x9)[_0xf5ed('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xf5ed('0x3c')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xf5ed('0x17')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xf5ed('0x3d')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xf5ed('0x17')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xf5ed('0x3e')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xf5ed('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xf5ed('0x3f')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xf5ed('0x17')](0x9)[_0xf5ed('0x25')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xf5ed('0x17')](0x9)[_0xf5ed('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xf5ed('0x17')](0x5)[_0xf5ed('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xf5ed('0x17')](0x9)[_0xf5ed('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xf5ed('0x40')},'dialRecallMeTimeout':{'type':Sequelize[_0xf5ed('0x17')](0x5)[_0xf5ed('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xf5ed('0x41')},'dialRecallInQueue':{'type':Sequelize[_0xf5ed('0x20')],'defaultValue':0x0,'comment':_0xf5ed('0x42')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0xf5ed('0x43')),'defaultValue':_0xf5ed('0x44')},'dialQueueProject2':{'type':Sequelize[_0xf5ed('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0xf5ed('0x20')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xf5ed('0x20')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xf5ed('0x17')](0x3)[_0xf5ed('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf5ed('0x45')},'dialCutDigit':{'type':Sequelize[_0xf5ed('0x17')](0x3)[_0xf5ed('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf5ed('0x46')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xf5ed('0x17')](0x3)[_0xf5ed('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xf5ed('0x17')](0x5)[_0xf5ed('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf5ed('0x47')},'dialDropMaxRetry':{'type':Sequelize[_0xf5ed('0x17')](0x3)[_0xf5ed('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf5ed('0x48')},'dialDropRetryFrequency':{'type':Sequelize[_0xf5ed('0x17')](0x5)[_0xf5ed('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf5ed('0x49')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xf5ed('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf5ed('0x4a')},'dialMachineMaxRetry':{'type':Sequelize[_0xf5ed('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf5ed('0x4b')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xf5ed('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf5ed('0x4c')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xf5ed('0x17')](0x3)[_0xf5ed('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xf5ed('0x17')](0x5)[_0xf5ed('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf5ed('0x4d')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf5ed('0x17')],'allowNull':!![],'comment':_0xf5ed('0x4e')},'mandatoryDisposition':{'type':Sequelize[_0xf5ed('0x20')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5c12bd){if(!_0x5c12bd)this[_0xf5ed('0xd')](_0xf5ed('0x4f'),null);this[_0xf5ed('0xd')](_0xf5ed('0x50'),_0x5c12bd);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xf5ed('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xf5ed('0x17')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xf5ed('0x17')](0x3)[_0xf5ed('0x25')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xbb4e=['AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','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','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','outbound','default','fewestcalls','random','rrmemory','wrandom','rrordered','strategy','getDataValue','type','dialMethod','preview','roundrobin','includes','INTEGER','yes','all','once','setDataValue','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','progressive','power','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','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)','tTxX'];(function(_0x34bb68,_0x5b0079){var _0x3db9fb=function(_0x2c87bd){while(--_0x2c87bd){_0x34bb68['push'](_0x34bb68['shift']());}};_0x3db9fb(++_0x5b0079);}(_0xbb4e,0xcd));var _0xebb4=function(_0x737a1f,_0x235fef){_0x737a1f=_0x737a1f-0x0;var _0x16eba1=_0xbb4e[_0x737a1f];return _0x16eba1;};'use strict';var Sequelize=require(_0xebb4('0x0'));module[_0xebb4('0x1')]={'name':{'type':Sequelize[_0xebb4('0x2')],'allowNull':![],'unique':_0xebb4('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xebb4('0x4')](_0xebb4('0x5'),_0xebb4('0x6')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0xebb4('0x2')],'defaultValue':_0xebb4('0x7')},'announce':{'type':Sequelize[_0xebb4('0x2')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr','ringall','leastrecent',_0xebb4('0x8'),_0xebb4('0x9'),_0xebb4('0xa'),'linear',_0xebb4('0xb'),_0xebb4('0xc')),'allowNull':![],'defaultValue':'ringall','set':function(_0x8c0fcb){this['setDataValue'](_0xebb4('0xd'),_0x8c0fcb?_0x8c0fcb:_0xebb4('0xa'));},'get':function(){var _0x9136c1=this[_0xebb4('0xe')](_0xebb4('0xf'));var _0x47dd08=this['getDataValue'](_0xebb4('0x10'));var _0x1139c1=this[_0xebb4('0xe')]('strategy');if(_0x9136c1===_0xebb4('0x6')){if(_0x47dd08===_0xebb4('0x11')){return null;}if(_0x47dd08==='booked'&&![_0xebb4('0xa'),_0xebb4('0x12')][_0xebb4('0x13')](_0x1139c1)){this['setDataValue'](_0xebb4('0xd'),_0xebb4('0xa'));}}return _0x1139c1;}},'servicelevel':{'type':Sequelize[_0xebb4('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xebb4('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xebb4('0x14')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xebb4('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xebb4('0x2')]},'weight':{'type':Sequelize[_0xebb4('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xebb4('0x4')](_0xebb4('0x15'),'no'),'defaultValue':_0xebb4('0x15')},'autopause':{'type':Sequelize['ENUM'](_0xebb4('0x15'),'no',_0xebb4('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xebb4('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0xebb4('0x4')](_0xebb4('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xebb4('0x4')](_0xebb4('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xebb4('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0xebb4('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xebb4('0x4')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0xebb4('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xebb4('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xebb4('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xebb4('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xebb4('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xebb4('0x4')](_0xebb4('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xebb4('0x4')](_0xebb4('0x15'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize['ENUM'](_0xebb4('0x15'),'no',_0xebb4('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xebb4('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xebb4('0x4')](_0xebb4('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0xebb4('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xebb4('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xebb4('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xebb4('0x2')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xebb4('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xebb4('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xebb4('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xebb4('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xebb4('0x2')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0xebb4('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0xebb4('0x2')]},'queue_less_than':{'type':Sequelize[_0xebb4('0x2')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x36311d){this[_0xebb4('0x18')](_0xebb4('0x19'),_0x36311d?_0x36311d[_0xebb4('0x1a')](','):[]);},'get':function(){return this[_0xebb4('0xe')](_0xebb4('0x19'))?this[_0xebb4('0xe')](_0xebb4('0x19'))[_0xebb4('0x1b')](','):[];}},'joinempty':{'type':Sequelize[_0xebb4('0x2')],'defaultValue':_0xebb4('0x15'),'set':function(_0x1beb7e){this['setDataValue'](_0xebb4('0x1c'),_0x1beb7e?_0x1beb7e['join'](','):undefined);},'get':function(){return this[_0xebb4('0xe')](_0xebb4('0x1c'))?this[_0xebb4('0xe')](_0xebb4('0x1c'))[_0xebb4('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xebb4('0x2')],'defaultValue':'no','set':function(_0x5e17ae){this[_0xebb4('0x18')](_0xebb4('0x1d'),_0x5e17ae?_0x5e17ae['join'](','):undefined);},'get':function(){return this['getDataValue'](_0xebb4('0x1d'))?this[_0xebb4('0xe')](_0xebb4('0x1d'))[_0xebb4('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xebb4('0x4')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xebb4('0x4')](_0xebb4('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xebb4('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0xebb4('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xebb4('0x2')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x31485a){this['setDataValue'](_0xebb4('0x1e'),_0x31485a);if(_0x31485a){if(this[_0xebb4('0xe')]('wrapuptime')<0x2){this[_0xebb4('0x18')](_0xebb4('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xebb4('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xebb4('0x20')],'defaultValue':0x0,'comment':_0xebb4('0x21')},'dialMethod':{'type':Sequelize[_0xebb4('0x4')](_0xebb4('0x11'),_0xebb4('0x22'),_0xebb4('0x23'),'predictive','booked'),'defaultValue':_0xebb4('0x22'),'comment':_0xebb4('0x24')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0xebb4('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0xebb4('0x14')](0x4)[_0xebb4('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xebb4('0x26')},'dialPowerLevel':{'type':Sequelize[_0xebb4('0x27')](0x2)[_0xebb4('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xebb4('0x28')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0xebb4('0x29'),_0xebb4('0x2a')),'defaultValue':_0xebb4('0x2a'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xebb4('0x27')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xebb4('0x2b')},'dialPredictiveInterval':{'type':Sequelize[_0xebb4('0x14')](0x3)[_0xebb4('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xebb4('0x2c')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xebb4('0x14')](0x3)[_0xebb4('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xebb4('0x2d')},'dialQueueOptions':{'type':Sequelize[_0xebb4('0x2')],'defaultValue':_0xebb4('0x2e'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xebb4('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0xebb4('0x2')],'comment':_0xebb4('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize[_0xebb4('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xebb4('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xebb4('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xebb4('0x31')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xebb4('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0xebb4('0x14')](0x5)[_0xebb4('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xebb4('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xebb4('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xebb4('0x34')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xebb4('0x35')},'dialGlobalMaxRetry':{'type':Sequelize[_0xebb4('0x14')](0x3)[_0xebb4('0x25')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xebb4('0x36')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xebb4('0x37')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xebb4('0x4')](_0xebb4('0x38'),_0xebb4('0x39'),'onlyIfOpen'),'defaultValue':_0xebb4('0x38')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xebb4('0x3a')},'dialAMDInitialSilence':{'type':Sequelize[_0xebb4('0x14')](0x9)[_0xebb4('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xebb4('0x3b')},'dialAMDGreeting':{'type':Sequelize[_0xebb4('0x14')](0x9)[_0xebb4('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xebb4('0x3c')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xebb4('0x14')](0x9)[_0xebb4('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xebb4('0x3d')},'dialAMDMinWordLength':{'type':Sequelize[_0xebb4('0x14')](0x9)[_0xebb4('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xebb4('0x3e')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xebb4('0x14')](0x9)[_0xebb4('0x25')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xebb4('0x3f')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xebb4('0x14')](0x9)[_0xebb4('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xebb4('0x40')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xebb4('0x14')](0x5)[_0xebb4('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xebb4('0x41')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xebb4('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xebb4('0x42')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0xebb4('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0xebb4('0x20')],'defaultValue':0x0,'comment':_0xebb4('0x43')},'dialOrderByScheduledAt':{'type':Sequelize[_0xebb4('0x4')](_0xebb4('0x44'),_0xebb4('0x45')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0xebb4('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xebb4('0x20')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xebb4('0x14')](0x3)[_0xebb4('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xebb4('0x46')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xebb4('0x47')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xebb4('0x48')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xebb4('0x14')](0x5)[_0xebb4('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xebb4('0x49')},'dialDropMaxRetry':{'type':Sequelize[_0xebb4('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xebb4('0x4a')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xebb4('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xebb4('0x4b')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xebb4('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xebb4('0x4c')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xebb4('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xebb4('0x4d')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xebb4('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xebb4('0x14')](0x5)[_0xebb4('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xebb4('0x4e')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xebb4('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xebb4('0x4f')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xebb4('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xebb4('0x50')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xebb4('0x51'),'set':function(_0x1913fa){if(!_0x1913fa)this[_0xebb4('0x18')](_0xebb4('0x52'),null);this[_0xebb4('0x18')](_0xebb4('0x53'),_0x1913fa);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xebb4('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xebb4('0x14')](0x3)[_0xebb4('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xebb4('0x20')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xebb4('0x14')](0x3)[_0xebb4('0x25')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xebb4('0x20')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 4dd4284..5aa2e44 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 _0xdc86=['CmHopper','getHopperHistories','CmHopperHistory','CmHopperFinal','CmHopperBlack','getTeams','addTeams','teams','Team','online','voicePause','flatMap','Agents','penalty','transaction','each','TeamVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','SIP/%s','interface','forEach','emit','userVoiceQueue:save','User','select','field','tq.TeamId','from','team_has_voice_queues','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','TeamId','all','union','removeTeams','ids','isEmpty','removeAgents','addAgents','spread','upsert','format','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','ListId','phone','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','fromQuery','scheduledAt','ContactId','cm_hopper_additional_phones','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','join','h.ContactId=ci.CmContactId','PHONE','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','rimraf','fast-json-patch','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','./voiceQueue.socket','sendStatus','status','end','offset','count','limit','set','Content-Range','json','apply','save','update','destroy','then','VoiceQueues','inbound','outbound','map','value','includes','type','find','name','error','stack','index','rawAttributes','key','query','keys','filters','intersection','attributes','model','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','VoiceQueue','findAll','rows','catch','show','params','includeAll','include','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','QueueCampaigns','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','length','omit','createdAt','body','updatedAt','user','getHoppers','findOne','hasOwnProperty','VoiceQueueId'];(function(_0x15a99d,_0x4486ea){var _0x2cb908=function(_0x1243c1){while(--_0x1243c1){_0x15a99d['push'](_0x15a99d['shift']());}};_0x2cb908(++_0x4486ea);}(_0xdc86,0x118));var _0x6dc8=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0xdc86[_0x5a9c0c];return _0x53c77d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6dc8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6dc8('0x1'));var rp=require('request-promise');var moment=require(_0x6dc8('0x2'));var BPromise=require(_0x6dc8('0x3'));var Mustache=require(_0x6dc8('0x4'));var util=require(_0x6dc8('0x5'));var path=require(_0x6dc8('0x6'));var sox=require('sox');var csv=require(_0x6dc8('0x7'));var ejs=require(_0x6dc8('0x8'));var fs=require('fs');var fs_extra=require(_0x6dc8('0x9'));var _=require(_0x6dc8('0xa'));var squel=require(_0x6dc8('0xb'));var crypto=require(_0x6dc8('0xc'));var jsforce=require(_0x6dc8('0xd'));var deskjs=require(_0x6dc8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6dc8('0xf'));var Papa=require('papaparse');var Redis=require(_0x6dc8('0x10'));var authService=require(_0x6dc8('0x11'));var qs=require(_0x6dc8('0x12'));var as=require(_0x6dc8('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6dc8('0x14'))(_0x6dc8('0x15'));var utils=require(_0x6dc8('0x16'));var config=require(_0x6dc8('0x17'));var licenseUtil=require(_0x6dc8('0x18'));var db=require(_0x6dc8('0x19'))['db'];config['redis']=_[_0x6dc8('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6dc8('0x1b'))(new Redis(config[_0x6dc8('0x1c')]));require(_0x6dc8('0x1d'))['register'](socket);function respondWithStatusCode(_0x23acc6,_0xfe3af3){_0xfe3af3=_0xfe3af3||0xcc;return function(_0xa4d1cf){if(_0xa4d1cf){return _0x23acc6[_0x6dc8('0x1e')](_0xfe3af3);}return _0x23acc6[_0x6dc8('0x1f')](_0xfe3af3)[_0x6dc8('0x20')]();};}function respondWithResult(_0x351c11,_0x29a9f7){_0x29a9f7=_0x29a9f7||0xc8;return function(_0x34428a){if(_0x34428a){return _0x351c11['status'](_0x29a9f7)['json'](_0x34428a);}};}function respondWithFilteredResult(_0x2702c5,_0x396efc){return function(_0x209ae4){if(_0x209ae4){var _0x3c8a6d=typeof _0x396efc[_0x6dc8('0x21')]==='undefined'&&typeof _0x396efc['limit']==='undefined';var _0x2247c4=_0x209ae4['count'];var _0xdc910d=_0x3c8a6d?0x0:_0x396efc['offset'];var _0x3cd3ce=_0x3c8a6d?_0x209ae4[_0x6dc8('0x22')]:_0x396efc[_0x6dc8('0x21')]+_0x396efc[_0x6dc8('0x23')];var _0x1949be;if(_0x3cd3ce>=_0x2247c4){_0x3cd3ce=_0x2247c4;_0x1949be=0xc8;}else{_0x1949be=0xce;}_0x2702c5[_0x6dc8('0x1f')](_0x1949be);return _0x2702c5[_0x6dc8('0x24')](_0x6dc8('0x25'),_0xdc910d+'-'+_0x3cd3ce+'/'+_0x2247c4)[_0x6dc8('0x26')](_0x209ae4);}return null;};}function patchUpdates(_0x5526cd){return function(_0x2cc8db){try{jsonpatch[_0x6dc8('0x27')](_0x2cc8db,_0x5526cd,!![]);}catch(_0x30afb5){return BPromise['reject'](_0x30afb5);}return _0x2cc8db[_0x6dc8('0x28')]();};}function saveUpdates(_0x5c78db,_0x125df7){return function(_0x3309fa){if(_0x3309fa){return _0x3309fa[_0x6dc8('0x29')](_0x5c78db)['then'](function(_0x56895f){return _0x56895f;});}return null;};}function removeEntity(_0x1983f8,_0x14ec58){return function(_0x57ce0a){if(_0x57ce0a){return _0x57ce0a[_0x6dc8('0x2a')]()[_0x6dc8('0x2b')](function(){var _0x36b904=_0x57ce0a['get']({'plain':!![]});var _0x49ece3=[{'name':_0x6dc8('0x2c'),'value':_0x6dc8('0x2d'),'ignore':![]},{'name':'QueueCampaigns','value':_0x6dc8('0x2e'),'ignore':![]}];var _0x5889e3=_(_0x49ece3)['filter']('ignore')[_0x6dc8('0x2f')](_0x6dc8('0x30'))[_0x6dc8('0x30')]();if(_[_0x6dc8('0x31')](_0x5889e3,_0x36b904[_0x6dc8('0x32')])){return;}var _0x1c2874=_[_0x6dc8('0x33')](_0x49ece3,[_0x6dc8('0x30'),_0x36b904[_0x6dc8('0x32')]])[_0x6dc8('0x34')];return db['UserProfileResource'][_0x6dc8('0x2a')]({'where':{'type':_0x1c2874,'resourceId':_0x36b904['id']}})['then'](function(){return _0x57ce0a;});})['then'](function(){_0x1983f8[_0x6dc8('0x1f')](0xcc)[_0x6dc8('0x20')]();});}};}function handleEntityNotFound(_0x424cbe,_0x312944){return function(_0x5489dd){if(!_0x5489dd){_0x424cbe[_0x6dc8('0x1e')](0x194);}return _0x5489dd;};}function handleError(_0x4caf19,_0x32cbc0){_0x32cbc0=_0x32cbc0||0x1f4;return function(_0x49556d){logger[_0x6dc8('0x35')](_0x49556d[_0x6dc8('0x36')]);if(_0x49556d['name']){delete _0x49556d[_0x6dc8('0x34')];}_0x4caf19[_0x6dc8('0x1f')](_0x32cbc0)['send'](_0x49556d);};}exports[_0x6dc8('0x37')]=function(_0x32a501,_0x452a29){var _0x278798={},_0x2a6371={},_0x4a1c73={'count':0x0,'rows':[]};var _0x5a4e9d=_[_0x6dc8('0x2f')](db['VoiceQueue'][_0x6dc8('0x38')],function(_0x1cf28f){return{'name':_0x1cf28f['fieldName'],'type':_0x1cf28f['type'][_0x6dc8('0x39')]};});_0x2a6371['model']=_[_0x6dc8('0x2f')](_0x5a4e9d,_0x6dc8('0x34'));_0x2a6371[_0x6dc8('0x3a')]=_[_0x6dc8('0x3b')](_0x32a501[_0x6dc8('0x3a')]);_0x2a6371[_0x6dc8('0x3c')]=_[_0x6dc8('0x3d')](_0x2a6371['model'],_0x2a6371[_0x6dc8('0x3a')]);_0x278798[_0x6dc8('0x3e')]=_[_0x6dc8('0x3d')](_0x2a6371[_0x6dc8('0x3f')],qs[_0x6dc8('0x40')](_0x32a501[_0x6dc8('0x3a')][_0x6dc8('0x40')]));_0x278798[_0x6dc8('0x3e')]=_0x278798[_0x6dc8('0x3e')]['length']?_0x278798['attributes']:_0x2a6371[_0x6dc8('0x3f')];if(!_0x32a501[_0x6dc8('0x3a')]['hasOwnProperty'](_0x6dc8('0x41'))){_0x278798[_0x6dc8('0x23')]=qs[_0x6dc8('0x23')](_0x32a501[_0x6dc8('0x3a')][_0x6dc8('0x23')]);_0x278798[_0x6dc8('0x21')]=qs[_0x6dc8('0x21')](_0x32a501[_0x6dc8('0x3a')][_0x6dc8('0x21')]);}_0x278798[_0x6dc8('0x42')]=qs[_0x6dc8('0x43')](_0x32a501[_0x6dc8('0x3a')][_0x6dc8('0x43')]);_0x278798[_0x6dc8('0x44')]=qs[_0x6dc8('0x3c')](_[_0x6dc8('0x45')](_0x32a501[_0x6dc8('0x3a')],_0x2a6371[_0x6dc8('0x3c')]),_0x5a4e9d);if(_0x32a501['query']['filter']){_0x278798[_0x6dc8('0x44')]=_[_0x6dc8('0x46')](_0x278798[_0x6dc8('0x44')],{'$or':_[_0x6dc8('0x2f')](_0x5a4e9d,function(_0x2973b0){if(_0x2973b0[_0x6dc8('0x32')]!==_0x6dc8('0x47')){var _0x14171d={};_0x14171d[_0x2973b0[_0x6dc8('0x34')]]={'$like':'%'+_0x32a501['query'][_0x6dc8('0x48')]+'%'};return _0x14171d;}})});}_0x278798=_[_0x6dc8('0x46')]({},_0x278798,_0x32a501[_0x6dc8('0x49')]);var _0x440e52={'where':_0x278798[_0x6dc8('0x44')]};return db['VoiceQueue'][_0x6dc8('0x22')](_0x440e52)['then'](function(_0x37ea88){_0x4a1c73['count']=_0x37ea88;if(_0x32a501['query']['includeAll']){_0x278798['include']=[{'all':!![]}];}return db[_0x6dc8('0x4a')][_0x6dc8('0x4b')](_0x278798);})[_0x6dc8('0x2b')](function(_0x3ef9ed){_0x4a1c73[_0x6dc8('0x4c')]=_0x3ef9ed;return _0x4a1c73;})[_0x6dc8('0x2b')](respondWithFilteredResult(_0x452a29,_0x278798))[_0x6dc8('0x4d')](handleError(_0x452a29,null));};exports[_0x6dc8('0x4e')]=function(_0x2a1e0c,_0x209400){var _0x511726={'raw':![],'where':{'id':_0x2a1e0c[_0x6dc8('0x4f')]['id']}},_0x535dde={};_0x535dde[_0x6dc8('0x3f')]=_[_0x6dc8('0x3b')](db[_0x6dc8('0x4a')][_0x6dc8('0x38')]);_0x535dde[_0x6dc8('0x3a')]=_[_0x6dc8('0x3b')](_0x2a1e0c[_0x6dc8('0x3a')]);_0x535dde[_0x6dc8('0x3c')]=_['intersection'](_0x535dde[_0x6dc8('0x3f')],_0x535dde[_0x6dc8('0x3a')]);_0x511726[_0x6dc8('0x3e')]=_[_0x6dc8('0x3d')](_0x535dde['model'],qs['fields'](_0x2a1e0c[_0x6dc8('0x3a')]['fields']));_0x511726[_0x6dc8('0x3e')]=_0x511726[_0x6dc8('0x3e')]['length']?_0x511726['attributes']:_0x535dde['model'];if(_0x2a1e0c[_0x6dc8('0x3a')][_0x6dc8('0x50')]){_0x511726[_0x6dc8('0x51')]=[{'all':!![]}];}_0x511726=_['merge']({},_0x511726,_0x2a1e0c[_0x6dc8('0x49')]);return db[_0x6dc8('0x4a')][_0x6dc8('0x33')](_0x511726)[_0x6dc8('0x2b')](handleEntityNotFound(_0x209400,null))[_0x6dc8('0x2b')](respondWithResult(_0x209400,null))[_0x6dc8('0x4d')](handleError(_0x209400,null));};exports['create']=function(_0x97a104,_0x32a6b7){return db['VoiceQueue'][_0x6dc8('0x52')](_0x97a104['body'],{})['then'](function(_0x468325){var _0x5ef592=_0x97a104['user'][_0x6dc8('0x53')]({'plain':!![]});if(!_0x5ef592)throw new Error(_0x6dc8('0x54'));if(_0x5ef592[_0x6dc8('0x55')]==='user'){var _0x1a5115=_0x468325['get']({'plain':!![]});var _0x249843=[{'name':_0x6dc8('0x2c'),'value':_0x6dc8('0x2d')},{'name':_0x6dc8('0x56'),'value':_0x6dc8('0x2e')}];var _0x1b3c3b=_['find'](_0x249843,[_0x6dc8('0x30'),_0x1a5115[_0x6dc8('0x32')]])[_0x6dc8('0x34')];return db[_0x6dc8('0x57')][_0x6dc8('0x33')]({'where':{'name':_0x1b3c3b,'userProfileId':_0x5ef592[_0x6dc8('0x58')]},'raw':!![]})['then'](function(_0x51e290){if(_0x51e290&&_0x51e290[_0x6dc8('0x59')]===0x0){return db[_0x6dc8('0x5a')][_0x6dc8('0x52')]({'name':_0x1a5115[_0x6dc8('0x34')],'resourceId':_0x1a5115['id'],'type':_0x51e290[_0x6dc8('0x34')],'sectionId':_0x51e290['id']},{})[_0x6dc8('0x2b')](function(){return _0x468325;});}else{return _0x468325;}})[_0x6dc8('0x4d')](function(_0x5daff7){logger[_0x6dc8('0x35')](_0x6dc8('0x5b'),_0x5daff7);throw _0x5daff7;});}return _0x468325;})[_0x6dc8('0x2b')](respondWithResult(_0x32a6b7,0xc9))['catch'](handleError(_0x32a6b7,null));};exports['clone']=function(_0x45840b,_0x1a4550){var _0x5b6bd0={'where':{'id':_0x45840b[_0x6dc8('0x4f')]['id']}},_0x1867c2={};_0x1867c2[_0x6dc8('0x3f')]=_[_0x6dc8('0x3b')](db[_0x6dc8('0x4a')]['rawAttributes']);_0x5b6bd0[_0x6dc8('0x3e')]=_['intersection'](_0x1867c2['model'],qs[_0x6dc8('0x40')](_0x45840b['query'][_0x6dc8('0x40')]));_0x5b6bd0[_0x6dc8('0x3e')]=_0x5b6bd0[_0x6dc8('0x3e')][_0x6dc8('0x5c')]?_0x5b6bd0['attributes']:_0x1867c2[_0x6dc8('0x3f')];if(_0x45840b[_0x6dc8('0x3a')]['includeAll']){_0x5b6bd0[_0x6dc8('0x51')]=[{'all':!![]}];}_0x5b6bd0=_['merge']({},_0x5b6bd0,_0x45840b[_0x6dc8('0x49')]);return db[_0x6dc8('0x4a')][_0x6dc8('0x33')](_0x5b6bd0)[_0x6dc8('0x2b')](handleEntityNotFound(_0x1a4550,null))['then'](function(_0xc1a180){if(_0xc1a180){var _0x49ff4b=_0xc1a180[_0x6dc8('0x53')]({'plain':!![]});_0x49ff4b=qs[_0x6dc8('0x5d')](_0x49ff4b,['id',_0x6dc8('0x5e'),'updatedAt']);_0x45840b[_0x6dc8('0x5f')]=_[_0x6dc8('0x5d')](_0x45840b[_0x6dc8('0x5f')],['id','createdAt',_0x6dc8('0x60')]);return db['VoiceQueue']['create'](_['merge'](_0x49ff4b,_0x45840b[_0x6dc8('0x5f')]),{'include':_0x45840b[_0x6dc8('0x3a')]['includeAll']?[{'all':!![]}]:undefined})[_0x6dc8('0x2b')](function(_0x40edb6){var _0x4a27f5=_0x45840b[_0x6dc8('0x61')]['get']({'plain':!![]});if(!_0x4a27f5)throw new Error(_0x6dc8('0x54'));if(_0x4a27f5[_0x6dc8('0x55')]===_0x6dc8('0x61')){var _0x251ea3=_0x40edb6[_0x6dc8('0x53')]({'plain':!![]});var _0x8b896=[{'name':_0x6dc8('0x2c'),'value':_0x6dc8('0x2d')},{'name':'QueueCampaigns','value':_0x6dc8('0x2e')}];var _0x27b144=_[_0x6dc8('0x33')](_0x8b896,[_0x6dc8('0x30'),_0x251ea3[_0x6dc8('0x32')]])['name'];return db['UserProfileSection'][_0x6dc8('0x33')]({'where':{'name':_0x27b144,'userProfileId':_0x4a27f5[_0x6dc8('0x58')]},'raw':!![]})[_0x6dc8('0x2b')](function(_0x10a870){if(_0x10a870&&_0x10a870['autoAssociation']===0x0){return db[_0x6dc8('0x5a')]['create']({'name':_0x251ea3['name'],'resourceId':_0x251ea3['id'],'type':_0x10a870[_0x6dc8('0x34')],'sectionId':_0x10a870['id']},{})['then'](function(){return _0x40edb6;});}else{return _0x40edb6;}})[_0x6dc8('0x4d')](function(_0x484605){logger['error'](_0x6dc8('0x5b'),_0x484605);throw _0x484605;});}return _0x40edb6;});}})['then'](respondWithResult(_0x1a4550,0xc9))['catch'](handleError(_0x1a4550,null));};exports[_0x6dc8('0x29')]=function(_0x32e13c,_0x51a0bd){if(_0x32e13c['body']['id']){delete _0x32e13c['body']['id'];}return db[_0x6dc8('0x4a')]['find']({'where':{'id':_0x32e13c[_0x6dc8('0x4f')]['id']}})[_0x6dc8('0x2b')](handleEntityNotFound(_0x51a0bd,null))[_0x6dc8('0x2b')](saveUpdates(_0x32e13c['body'],null))['then'](respondWithResult(_0x51a0bd,null))['catch'](handleError(_0x51a0bd,null));};exports[_0x6dc8('0x2a')]=function(_0x420c3b,_0xb3efc1){return db[_0x6dc8('0x4a')][_0x6dc8('0x33')]({'where':{'id':_0x420c3b[_0x6dc8('0x4f')]['id']}})[_0x6dc8('0x2b')](handleEntityNotFound(_0xb3efc1,null))[_0x6dc8('0x2b')](removeEntity(_0xb3efc1,null))['catch'](handleError(_0xb3efc1,null));};exports[_0x6dc8('0x62')]=function(_0x3eac84,_0x1b6809,_0x32c0c2){var _0x13732e={'raw':![],'where':{}};var _0xdbf5fb={};var _0x3b35db={'count':0x0,'rows':[]};return db[_0x6dc8('0x4a')][_0x6dc8('0x63')]({'where':{'id':_0x3eac84['params']['id']}})[_0x6dc8('0x2b')](handleEntityNotFound(_0x1b6809,null))['then'](function(_0x42d4af){if(_0x42d4af){_0xdbf5fb['model']=_[_0x6dc8('0x3b')](db['CmHopper'][_0x6dc8('0x38')]);_0xdbf5fb[_0x6dc8('0x3a')]=_[_0x6dc8('0x3b')](_0x3eac84['query']);_0xdbf5fb[_0x6dc8('0x3c')]=_['intersection'](_0xdbf5fb[_0x6dc8('0x3f')],_0xdbf5fb[_0x6dc8('0x3a')]);_0x13732e[_0x6dc8('0x3e')]=_['intersection'](_0xdbf5fb[_0x6dc8('0x3f')],qs[_0x6dc8('0x40')](_0x3eac84[_0x6dc8('0x3a')][_0x6dc8('0x40')]));_0x13732e['attributes']=_0x13732e[_0x6dc8('0x3e')]['length']?_0x13732e['attributes']:_0xdbf5fb['model'];if(!_0x3eac84[_0x6dc8('0x3a')][_0x6dc8('0x64')](_0x6dc8('0x41'))){_0x13732e[_0x6dc8('0x23')]=qs[_0x6dc8('0x23')](_0x3eac84[_0x6dc8('0x3a')][_0x6dc8('0x23')]);_0x13732e['offset']=qs[_0x6dc8('0x21')](_0x3eac84[_0x6dc8('0x3a')]['offset']);}_0x13732e['order']=qs[_0x6dc8('0x43')](_0x3eac84[_0x6dc8('0x3a')][_0x6dc8('0x43')]);_0x13732e[_0x6dc8('0x44')]=qs[_0x6dc8('0x3c')](_[_0x6dc8('0x45')](_0x3eac84['query'],_0xdbf5fb[_0x6dc8('0x3c')]));_0x13732e[_0x6dc8('0x44')][_0x6dc8('0x65')]=_0x42d4af['id'];if(_0x3eac84[_0x6dc8('0x3a')][_0x6dc8('0x48')]){_0x13732e[_0x6dc8('0x44')]=_[_0x6dc8('0x46')](_0x13732e['where'],{'$or':_[_0x6dc8('0x2f')](_0x13732e[_0x6dc8('0x3e')],function(_0xc70416){var _0x61491e={};_0x61491e[_0xc70416]={'$like':'%'+_0x3eac84[_0x6dc8('0x3a')][_0x6dc8('0x48')]+'%'};return _0x61491e;})});}_0x13732e=_['merge']({},_0x13732e,_0x3eac84[_0x6dc8('0x49')]);return db[_0x6dc8('0x66')][_0x6dc8('0x22')]({'where':_0x13732e['where']})[_0x6dc8('0x2b')](function(_0x87c6ed){_0x3b35db[_0x6dc8('0x22')]=_0x87c6ed;if(_0x3eac84[_0x6dc8('0x3a')][_0x6dc8('0x50')]){_0x13732e[_0x6dc8('0x51')]=[{'all':!![]}];}return db[_0x6dc8('0x66')][_0x6dc8('0x4b')](_0x13732e);})[_0x6dc8('0x2b')](function(_0x5c9c11){_0x3b35db['rows']=_0x5c9c11;return _0x3b35db;});}})[_0x6dc8('0x2b')](respondWithFilteredResult(_0x1b6809,_0x13732e))[_0x6dc8('0x4d')](handleError(_0x1b6809,null));};exports[_0x6dc8('0x67')]=function(_0x2949a5,_0x319048,_0x333534){var _0x3a93a8={'raw':!![],'where':{}};var _0x42d8dc={};var _0x271cc9={'count':0x0,'rows':[]};return db[_0x6dc8('0x4a')][_0x6dc8('0x63')]({'where':{'id':_0x2949a5[_0x6dc8('0x4f')]['id']}})[_0x6dc8('0x2b')](handleEntityNotFound(_0x319048,null))[_0x6dc8('0x2b')](function(_0x2728d2){if(_0x2728d2){_0x42d8dc[_0x6dc8('0x3f')]=_[_0x6dc8('0x3b')](db['CmHopperHistory'][_0x6dc8('0x38')]);_0x42d8dc['query']=_[_0x6dc8('0x3b')](_0x2949a5[_0x6dc8('0x3a')]);_0x42d8dc[_0x6dc8('0x3c')]=_[_0x6dc8('0x3d')](_0x42d8dc[_0x6dc8('0x3f')],_0x42d8dc['query']);_0x3a93a8[_0x6dc8('0x3e')]=_['intersection'](_0x42d8dc['model'],qs[_0x6dc8('0x40')](_0x2949a5['query'][_0x6dc8('0x40')]));_0x3a93a8['attributes']=_0x3a93a8[_0x6dc8('0x3e')][_0x6dc8('0x5c')]?_0x3a93a8[_0x6dc8('0x3e')]:_0x42d8dc[_0x6dc8('0x3f')];if(!_0x2949a5[_0x6dc8('0x3a')][_0x6dc8('0x64')](_0x6dc8('0x41'))){_0x3a93a8['limit']=qs['limit'](_0x2949a5[_0x6dc8('0x3a')]['limit']);_0x3a93a8[_0x6dc8('0x21')]=qs[_0x6dc8('0x21')](_0x2949a5[_0x6dc8('0x3a')]['offset']);}_0x3a93a8['order']=qs['sort'](_0x2949a5['query']['sort']);_0x3a93a8[_0x6dc8('0x44')]=qs[_0x6dc8('0x3c')](_['pick'](_0x2949a5['query'],_0x42d8dc[_0x6dc8('0x3c')]));_0x3a93a8[_0x6dc8('0x44')]['VoiceQueueId']=_0x2728d2['id'];if(_0x2949a5[_0x6dc8('0x3a')][_0x6dc8('0x48')]){_0x3a93a8[_0x6dc8('0x44')]=_['merge'](_0x3a93a8[_0x6dc8('0x44')],{'$or':_['map'](_0x3a93a8[_0x6dc8('0x3e')],function(_0x2ed6a4){var _0x304bf5={};_0x304bf5[_0x2ed6a4]={'$like':'%'+_0x2949a5[_0x6dc8('0x3a')][_0x6dc8('0x48')]+'%'};return _0x304bf5;})});}_0x3a93a8=_[_0x6dc8('0x46')]({},_0x3a93a8,_0x2949a5[_0x6dc8('0x49')]);return db['CmHopperHistory']['count']({'where':_0x3a93a8[_0x6dc8('0x44')]})['then'](function(_0x469192){_0x271cc9[_0x6dc8('0x22')]=_0x469192;if(_0x2949a5[_0x6dc8('0x3a')][_0x6dc8('0x50')]){_0x3a93a8[_0x6dc8('0x51')]=[{'all':!![]}];}return db[_0x6dc8('0x68')][_0x6dc8('0x4b')](_0x3a93a8);})[_0x6dc8('0x2b')](function(_0x29d6b6){_0x271cc9[_0x6dc8('0x4c')]=_0x29d6b6;return _0x271cc9;});}})['then'](respondWithFilteredResult(_0x319048,_0x3a93a8))[_0x6dc8('0x4d')](handleError(_0x319048,null));};exports['getHopperFinals']=function(_0x6215b1,_0x545992,_0x492290){var _0x56a1a7={'raw':!![],'where':{}};var _0x56dbf0={};var _0x45cf9c={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x6dc8('0x63')]({'where':{'id':_0x6215b1['params']['id']}})['then'](handleEntityNotFound(_0x545992,null))['then'](function(_0xf7c32f){if(_0xf7c32f){_0x56dbf0['model']=_['keys'](db[_0x6dc8('0x69')][_0x6dc8('0x38')]);_0x56dbf0[_0x6dc8('0x3a')]=_[_0x6dc8('0x3b')](_0x6215b1[_0x6dc8('0x3a')]);_0x56dbf0[_0x6dc8('0x3c')]=_['intersection'](_0x56dbf0[_0x6dc8('0x3f')],_0x56dbf0[_0x6dc8('0x3a')]);_0x56a1a7[_0x6dc8('0x3e')]=_[_0x6dc8('0x3d')](_0x56dbf0[_0x6dc8('0x3f')],qs[_0x6dc8('0x40')](_0x6215b1[_0x6dc8('0x3a')][_0x6dc8('0x40')]));_0x56a1a7[_0x6dc8('0x3e')]=_0x56a1a7[_0x6dc8('0x3e')][_0x6dc8('0x5c')]?_0x56a1a7[_0x6dc8('0x3e')]:_0x56dbf0[_0x6dc8('0x3f')];if(!_0x6215b1['query'][_0x6dc8('0x64')]('nolimit')){_0x56a1a7[_0x6dc8('0x23')]=qs['limit'](_0x6215b1[_0x6dc8('0x3a')]['limit']);_0x56a1a7['offset']=qs['offset'](_0x6215b1[_0x6dc8('0x3a')][_0x6dc8('0x21')]);}_0x56a1a7[_0x6dc8('0x42')]=qs[_0x6dc8('0x43')](_0x6215b1[_0x6dc8('0x3a')]['sort']);_0x56a1a7[_0x6dc8('0x44')]=qs[_0x6dc8('0x3c')](_[_0x6dc8('0x45')](_0x6215b1[_0x6dc8('0x3a')],_0x56dbf0[_0x6dc8('0x3c')]));_0x56a1a7['where']['VoiceQueueId']=_0xf7c32f['id'];if(_0x6215b1[_0x6dc8('0x3a')]['filter']){_0x56a1a7[_0x6dc8('0x44')]=_[_0x6dc8('0x46')](_0x56a1a7['where'],{'$or':_['map'](_0x56a1a7[_0x6dc8('0x3e')],function(_0x477aba){var _0x33f3a3={};_0x33f3a3[_0x477aba]={'$like':'%'+_0x6215b1[_0x6dc8('0x3a')][_0x6dc8('0x48')]+'%'};return _0x33f3a3;})});}_0x56a1a7=_[_0x6dc8('0x46')]({},_0x56a1a7,_0x6215b1[_0x6dc8('0x49')]);return db[_0x6dc8('0x69')][_0x6dc8('0x22')]({'where':_0x56a1a7[_0x6dc8('0x44')]})[_0x6dc8('0x2b')](function(_0x9e2c1c){_0x45cf9c[_0x6dc8('0x22')]=_0x9e2c1c;if(_0x6215b1[_0x6dc8('0x3a')][_0x6dc8('0x50')]){_0x56a1a7[_0x6dc8('0x51')]=[{'all':!![]}];}return db[_0x6dc8('0x69')]['findAll'](_0x56a1a7);})[_0x6dc8('0x2b')](function(_0x1f8a08){_0x45cf9c[_0x6dc8('0x4c')]=_0x1f8a08;return _0x45cf9c;});}})[_0x6dc8('0x2b')](respondWithFilteredResult(_0x545992,_0x56a1a7))[_0x6dc8('0x4d')](handleError(_0x545992,null));};exports['getHopperBlacks']=function(_0x573f8b,_0x2d2641,_0x385a8c){var _0x268f93={'raw':!![],'where':{}};var _0x5e02a3={};var _0x4f5137={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x6dc8('0x63')]({'where':{'id':_0x573f8b[_0x6dc8('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2d2641,null))[_0x6dc8('0x2b')](function(_0x3af0d4){if(_0x3af0d4){_0x5e02a3[_0x6dc8('0x3f')]=_[_0x6dc8('0x3b')](db[_0x6dc8('0x6a')][_0x6dc8('0x38')]);_0x5e02a3[_0x6dc8('0x3a')]=_[_0x6dc8('0x3b')](_0x573f8b['query']);_0x5e02a3[_0x6dc8('0x3c')]=_['intersection'](_0x5e02a3[_0x6dc8('0x3f')],_0x5e02a3[_0x6dc8('0x3a')]);_0x268f93[_0x6dc8('0x3e')]=_['intersection'](_0x5e02a3[_0x6dc8('0x3f')],qs[_0x6dc8('0x40')](_0x573f8b[_0x6dc8('0x3a')]['fields']));_0x268f93['attributes']=_0x268f93[_0x6dc8('0x3e')][_0x6dc8('0x5c')]?_0x268f93[_0x6dc8('0x3e')]:_0x5e02a3[_0x6dc8('0x3f')];if(!_0x573f8b[_0x6dc8('0x3a')][_0x6dc8('0x64')](_0x6dc8('0x41'))){_0x268f93[_0x6dc8('0x23')]=qs[_0x6dc8('0x23')](_0x573f8b['query'][_0x6dc8('0x23')]);_0x268f93[_0x6dc8('0x21')]=qs[_0x6dc8('0x21')](_0x573f8b['query'][_0x6dc8('0x21')]);}_0x268f93['order']=qs[_0x6dc8('0x43')](_0x573f8b[_0x6dc8('0x3a')]['sort']);_0x268f93[_0x6dc8('0x44')]=qs[_0x6dc8('0x3c')](_['pick'](_0x573f8b[_0x6dc8('0x3a')],_0x5e02a3[_0x6dc8('0x3c')]));_0x268f93[_0x6dc8('0x44')][_0x6dc8('0x65')]=_0x3af0d4['id'];if(_0x573f8b['query'][_0x6dc8('0x48')]){_0x268f93[_0x6dc8('0x44')]=_[_0x6dc8('0x46')](_0x268f93[_0x6dc8('0x44')],{'$or':_[_0x6dc8('0x2f')](_0x268f93[_0x6dc8('0x3e')],function(_0x353d58){var _0x3fbff8={};_0x3fbff8[_0x353d58]={'$like':'%'+_0x573f8b['query'][_0x6dc8('0x48')]+'%'};return _0x3fbff8;})});}_0x268f93=_[_0x6dc8('0x46')]({},_0x268f93,_0x573f8b[_0x6dc8('0x49')]);return db[_0x6dc8('0x6a')]['count']({'where':_0x268f93['where']})[_0x6dc8('0x2b')](function(_0x3307f4){_0x4f5137['count']=_0x3307f4;if(_0x573f8b[_0x6dc8('0x3a')]['includeAll']){_0x268f93[_0x6dc8('0x51')]=[{'all':!![]}];}return db[_0x6dc8('0x6a')][_0x6dc8('0x4b')](_0x268f93);})[_0x6dc8('0x2b')](function(_0x561103){_0x4f5137['rows']=_0x561103;return _0x4f5137;});}})[_0x6dc8('0x2b')](respondWithFilteredResult(_0x2d2641,_0x268f93))[_0x6dc8('0x4d')](handleError(_0x2d2641,null));};exports[_0x6dc8('0x6b')]=function(_0x3fef38,_0x1cf09e,_0x2b464a){var _0x4c720c={};var _0x4083dd={};var _0x4ae4b2;var _0x474c5c;return db[_0x6dc8('0x4a')][_0x6dc8('0x63')]({'where':{'id':_0x3fef38[_0x6dc8('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1cf09e,null))[_0x6dc8('0x2b')](function(_0x4d370a){if(_0x4d370a){_0x4ae4b2=_0x4d370a;_0x4083dd[_0x6dc8('0x3f')]=_[_0x6dc8('0x3b')](db['Team']['rawAttributes']);_0x4083dd['query']=_[_0x6dc8('0x3b')](_0x3fef38[_0x6dc8('0x3a')]);_0x4083dd[_0x6dc8('0x3c')]=_['intersection'](_0x4083dd[_0x6dc8('0x3f')],_0x4083dd[_0x6dc8('0x3a')]);_0x4c720c[_0x6dc8('0x3e')]=_[_0x6dc8('0x3d')](_0x4083dd[_0x6dc8('0x3f')],qs[_0x6dc8('0x40')](_0x3fef38[_0x6dc8('0x3a')]['fields']));_0x4c720c[_0x6dc8('0x3e')]=_0x4c720c[_0x6dc8('0x3e')][_0x6dc8('0x5c')]?_0x4c720c['attributes']:_0x4083dd[_0x6dc8('0x3f')];_0x4c720c[_0x6dc8('0x42')]=qs[_0x6dc8('0x43')](_0x3fef38[_0x6dc8('0x3a')][_0x6dc8('0x43')]);_0x4c720c[_0x6dc8('0x44')]=qs[_0x6dc8('0x3c')](_[_0x6dc8('0x45')](_0x3fef38[_0x6dc8('0x3a')],_0x4083dd['filters']));if(_0x3fef38[_0x6dc8('0x3a')][_0x6dc8('0x48')]){_0x4c720c['where']=_['merge'](_0x4c720c[_0x6dc8('0x44')],{'$or':_[_0x6dc8('0x2f')](_0x4c720c[_0x6dc8('0x3e')],function(_0x534bce){var _0x4fa3fa={};_0x4fa3fa[_0x534bce]={'$like':'%'+_0x3fef38[_0x6dc8('0x3a')][_0x6dc8('0x48')]+'%'};return _0x4fa3fa;})});}_0x4c720c=_[_0x6dc8('0x46')]({},_0x4c720c,_0x3fef38[_0x6dc8('0x49')]);return _0x4ae4b2[_0x6dc8('0x6b')](_0x4c720c);}})[_0x6dc8('0x2b')](function(_0x1513dc){if(_0x1513dc){_0x474c5c=_0x1513dc[_0x6dc8('0x5c')];if(!_0x3fef38['query']['hasOwnProperty'](_0x6dc8('0x41'))){_0x4c720c['limit']=qs['limit'](_0x3fef38[_0x6dc8('0x3a')][_0x6dc8('0x23')]);_0x4c720c['offset']=qs[_0x6dc8('0x21')](_0x3fef38[_0x6dc8('0x3a')]['offset']);}return _0x4ae4b2['getTeams'](_0x4c720c);}})[_0x6dc8('0x2b')](function(_0x1e4293){if(_0x1e4293){return _0x1e4293?{'count':_0x474c5c,'rows':_0x1e4293}:null;}})[_0x6dc8('0x2b')](respondWithResult(_0x1cf09e,null))['catch'](handleError(_0x1cf09e,null));};exports[_0x6dc8('0x6c')]=function(_0x4a4cd1,_0x1fb6f3,_0x5abc02){var _0x2d8d2b=_0x4a4cd1['body'][_0x6dc8('0x6d')];var _0x3e1049=_[_0x6dc8('0x2f')](_0x2d8d2b,'id');return db[_0x6dc8('0x6e')][_0x6dc8('0x4b')]({'where':{'id':_0x3e1049},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0x6dc8('0x6f'),_0x6dc8('0x70'),'interface'],'raw':!![]}]})[_0x6dc8('0x2b')](function(_0x15f1a7){if(_0x15f1a7){var _0x381ac5=_[_0x6dc8('0x71')](_0x15f1a7,function(_0x5abfae){var _0x1bd29b=_0x5abfae[_0x6dc8('0x53')]({'plain':!![]});_0x1bd29b[_0x6dc8('0x72')]['forEach'](function(_0x44992f){_0x44992f[_0x6dc8('0x73')]=_[_0x6dc8('0x33')](_0x2d8d2b,{'id':_0x1bd29b['id']})[_0x6dc8('0x73')];});return _0x1bd29b['Agents'];});return db[_0x6dc8('0x4a')][_0x6dc8('0x33')]({'where':{'id':_0x4a4cd1['params']['id']}})[_0x6dc8('0x2b')](function(_0x2dbfae){return db['sequelize'][_0x6dc8('0x74')](function(_0x4101a9){return _0x2dbfae[_0x6dc8('0x6c')](_0x3e1049,{'transaction':_0x4101a9})[_0x6dc8('0x2b')](function(){return BPromise[_0x6dc8('0x75')](_0x2d8d2b,function(_0x27a08d){return db[_0x6dc8('0x76')]['upsert']({'TeamId':_0x27a08d['id'],'VoiceQueueId':_0x4a4cd1[_0x6dc8('0x4f')]['id'],'penalty':_0x27a08d['penalty']},{'transaction':_0x4101a9});});})['then'](function(){return BPromise[_0x6dc8('0x75')](_0x381ac5,function(_0x23030d){return db['UserVoiceQueue'][_0x6dc8('0x77')]({'where':{'UserId':_0x23030d['id'],'VoiceQueueId':_0x4a4cd1[_0x6dc8('0x4f')]['id']},'defaults':{'penalty':_0x23030d[_0x6dc8('0x73')]},'transaction':_0x4101a9});});})[_0x6dc8('0x2b')](function(){return BPromise['each'](_[_0x6dc8('0x48')](_0x381ac5,{'online':!![]}),function(_0x22090c){return db[_0x6dc8('0x78')]['upsert']({'membername':_0x22090c['name'],'UserId':_0x22090c['id'],'queue_name':_0x2dbfae[_0x6dc8('0x34')],'VoiceQueueId':_0x2dbfae['id'],'interface':_[_0x6dc8('0x79')](_0x22090c['interface'])?util['format'](_0x6dc8('0x7a'),_0x22090c['name']):_0x22090c[_0x6dc8('0x7b')],'paused':_0x22090c[_0x6dc8('0x70')]||![],'penalty':_0x22090c[_0x6dc8('0x73')]},{'transaction':_0x4101a9});});})['then'](function(){_0x381ac5[_0x6dc8('0x7c')](function(_0xe4e2b1){socket[_0x6dc8('0x7d')](_0x6dc8('0x7e'),{'UserId':_0xe4e2b1['id'],'VoiceQueueId':_0x2dbfae['id']});});});});});}})[_0x6dc8('0x2b')](respondWithStatusCode(_0x1fb6f3,null))['catch'](handleError(_0x1fb6f3,null));};exports['removeTeams']=function(_0x5c6cf8,_0x4e5422,_0x501146){return db[_0x6dc8('0x6e')]['findAll']({'where':{'id':_0x5c6cf8['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x6dc8('0x7f')],'as':_0x6dc8('0x72'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4e5422,null))['then'](function(_0x4c0cec){var _0x5d085d=_[_0x6dc8('0x2f')](_0x4c0cec,'id');var _0x47c291=[];var _0x3a86d0=[];var _0x418d83=squel[_0x6dc8('0x80')]();_0x418d83[_0x6dc8('0x81')](_0x6dc8('0x82'))[_0x6dc8('0x83')](_0x6dc8('0x84'),'tq')['join']('user_has_teams','ut',_0x6dc8('0x85'))[_0x6dc8('0x44')](_0x6dc8('0x86'),_0x5c6cf8[_0x6dc8('0x4f')]['id']);for(var _0x3cd81c=0x0;_0x3cd81c<_0x4c0cec[_0x6dc8('0x5c')];_0x3cd81c+=0x1){let _0x54686=_0x4c0cec[_0x3cd81c];for(var _0x8b2492=0x0;_0x8b2492<_0x54686[_0x6dc8('0x72')][_0x6dc8('0x5c')];_0x8b2492+=0x1){let _0x2d0865=_0x54686[_0x6dc8('0x72')][_0x8b2492];var _0x2c6824=_0x418d83[_0x6dc8('0x87')]();_0x2c6824[_0x6dc8('0x44')](_0x6dc8('0x88'),_0x2d0865['id']);_0x3a86d0[_0x6dc8('0x89')](db[_0x6dc8('0x8a')][_0x6dc8('0x3a')](_0x2c6824[_0x6dc8('0x8b')](),{'type':db[_0x6dc8('0x8a')][_0x6dc8('0x8c')][_0x6dc8('0x8d')]})[_0x6dc8('0x2b')](function(_0x249804){if(_0x249804[_0x6dc8('0x5c')]===0x1){return _0x2d0865['id'];}else{var _0x329b56=_['every'](_[_0x6dc8('0x2f')](_0x249804,_0x6dc8('0x8e')),function(_0x372a2f){return _[_0x6dc8('0x31')](_0x5d085d,_0x372a2f);});if(_0x329b56){return _0x2d0865['id'];}}}));}}return BPromise[_0x6dc8('0x8f')](_0x3a86d0)['then'](function(_0x2bb5f4){_0x47c291=_(_0x47c291)[_0x6dc8('0x90')](_0x2bb5f4)['compact']()[_0x6dc8('0x30')]();return db[_0x6dc8('0x4a')][_0x6dc8('0x33')]({'where':{'id':_0x5c6cf8[_0x6dc8('0x4f')]['id']}})[_0x6dc8('0x2b')](function(_0x42a0f1){return db['sequelize'][_0x6dc8('0x74')](function(_0xe17488){return _0x42a0f1[_0x6dc8('0x91')](_0x5c6cf8[_0x6dc8('0x3a')][_0x6dc8('0x92')],{'transaction':_0xe17488})['then'](function(){if(!_[_0x6dc8('0x93')](_0x47c291)){return _0x42a0f1[_0x6dc8('0x94')](_0x47c291,{'transaction':_0xe17488})[_0x6dc8('0x2b')](function(){return db[_0x6dc8('0x78')][_0x6dc8('0x2a')]({'where':{'VoiceQueueId':_0x5c6cf8[_0x6dc8('0x4f')]['id'],'UserId':_0x47c291},'transaction':_0xe17488});});}})[_0x6dc8('0x2b')](function(){_0x47c291[_0x6dc8('0x7c')](function(_0x1369c3){socket['emit']('userVoiceQueue:remove',{'UserId':_0x1369c3,'VoiceQueueId':_0x42a0f1['id']});});});});});});})[_0x6dc8('0x2b')](respondWithStatusCode(_0x4e5422,null))[_0x6dc8('0x4d')](handleError(_0x4e5422,null));};exports[_0x6dc8('0x95')]=function(_0x41a5ea,_0x1c6262,_0x287c56){var _0x377e96,_0x1c4d6c;return db[_0x6dc8('0x4a')][_0x6dc8('0x33')]({'where':{'id':_0x41a5ea['params']['id']}})[_0x6dc8('0x2b')](handleEntityNotFound(_0x1c6262,null))[_0x6dc8('0x2b')](function(_0x1ecb2a){if(_0x1ecb2a){_0x1c4d6c=_0x1ecb2a;return _0x1ecb2a[_0x6dc8('0x95')](_0x41a5ea[_0x6dc8('0x5f')][_0x6dc8('0x92')],_[_0x6dc8('0x5d')](_0x41a5ea['body'],[_0x6dc8('0x92'),'id'])||{})[_0x6dc8('0x96')](function(_0x2944bb){for(var _0xcd5571=0x0;_0xcd5571<_0x41a5ea[_0x6dc8('0x5f')][_0x6dc8('0x92')][_0x6dc8('0x5c')];_0xcd5571+=0x1){socket[_0x6dc8('0x7d')](_0x6dc8('0x7e'),{'UserId':Number(_0x41a5ea[_0x6dc8('0x5f')][_0x6dc8('0x92')][_0xcd5571]),'VoiceQueueId':Number(_0x41a5ea[_0x6dc8('0x4f')]['id'])});}return _0x2944bb;});}})['then'](function(_0x4a7b0e){_0x377e96=_0x4a7b0e||[];if(_0x1c4d6c){return db['User'][_0x6dc8('0x4b')]({'where':{'id':_0x41a5ea[_0x6dc8('0x5f')][_0x6dc8('0x92')]},'attributes':['id',_0x6dc8('0x34'),_0x6dc8('0x6f'),_0x6dc8('0x70'),'interface'],'raw':!![]});}})[_0x6dc8('0x2b')](function(_0x23a764){if(!_[_0x6dc8('0x93')](_0x23a764)){var _0x492fde=[];for(var _0x5388ed=0x0;_0x5388ed<_0x23a764['length'];_0x5388ed++){if(_0x23a764[_0x5388ed]['online']){_0x492fde[_0x6dc8('0x89')](db[_0x6dc8('0x78')][_0x6dc8('0x97')]({'membername':_0x23a764[_0x5388ed]['name'],'UserId':_0x23a764[_0x5388ed]['id'],'queue_name':_0x1c4d6c[_0x6dc8('0x34')],'VoiceQueueId':_0x1c4d6c['id'],'interface':_[_0x6dc8('0x79')](_0x23a764[_0x5388ed]['interface'])?util[_0x6dc8('0x98')]('SIP/%s',_0x23a764[_0x5388ed][_0x6dc8('0x34')]):_0x23a764[_0x5388ed][_0x6dc8('0x7b')],'paused':_0x23a764[_0x5388ed][_0x6dc8('0x70')]||![],'penalty':_0x41a5ea['body'][_0x6dc8('0x73')]||0x0}));}}return BPromise[_0x6dc8('0x8f')](_0x492fde);}})['then'](function(){return _0x377e96;})[_0x6dc8('0x2b')](respondWithResult(_0x1c6262,null))[_0x6dc8('0x4d')](handleError(_0x1c6262,null));};exports[_0x6dc8('0x94')]=function(_0x5d01de,_0x28a7b6,_0x16fa41){return db[_0x6dc8('0x4a')][_0x6dc8('0x33')]({'where':{'id':_0x5d01de[_0x6dc8('0x4f')]['id']}})[_0x6dc8('0x2b')](handleEntityNotFound(_0x28a7b6,null))[_0x6dc8('0x2b')](function(_0x591667){if(_0x591667){return _0x591667[_0x6dc8('0x94')](_0x5d01de[_0x6dc8('0x3a')][_0x6dc8('0x92')])[_0x6dc8('0x2b')](function(){if(_['isArray'](_0x5d01de[_0x6dc8('0x3a')]['ids'])){for(var _0x4e1ad2=0x0;_0x4e1ad2<_0x5d01de[_0x6dc8('0x3a')]['ids']['length'];_0x4e1ad2+=0x1){socket[_0x6dc8('0x7d')](_0x6dc8('0x99'),{'UserId':Number(_0x5d01de['query'][_0x6dc8('0x92')][_0x4e1ad2]),'VoiceQueueId':Number(_0x5d01de[_0x6dc8('0x4f')]['id'])});}}else{socket['emit'](_0x6dc8('0x99'),{'UserId':Number(_0x5d01de[_0x6dc8('0x3a')]['ids']),'VoiceQueueId':Number(_0x5d01de[_0x6dc8('0x4f')]['id'])});}});}})[_0x6dc8('0x2b')](function(_0x50741f){return db[_0x6dc8('0x78')][_0x6dc8('0x2a')]({'where':{'VoiceQueueId':_0x5d01de[_0x6dc8('0x4f')]['id'],'UserId':_0x5d01de[_0x6dc8('0x3a')][_0x6dc8('0x92')]}})[_0x6dc8('0x2b')](function(){return _0x50741f;});})['then'](respondWithStatusCode(_0x28a7b6,null))[_0x6dc8('0x4d')](handleError(_0x28a7b6,null));};exports[_0x6dc8('0x9a')]=function(_0x5bfa51,_0x208d5c,_0x3e0cfd){var _0x5437e0={};var _0x55e6fd={};var _0x323eba;var _0xce79b5;return db[_0x6dc8('0x4a')][_0x6dc8('0x63')]({'where':{'id':_0x5bfa51['params']['id']}})[_0x6dc8('0x2b')](handleEntityNotFound(_0x208d5c,null))['then'](function(_0x57153e){if(_0x57153e){_0x323eba=_0x57153e;_0x55e6fd[_0x6dc8('0x3f')]=_['keys'](db[_0x6dc8('0x7f')][_0x6dc8('0x38')]);_0x55e6fd['query']=_['keys'](_0x5bfa51[_0x6dc8('0x3a')]);_0x55e6fd[_0x6dc8('0x3c')]=_[_0x6dc8('0x3d')](_0x55e6fd['model'],_0x55e6fd[_0x6dc8('0x3a')]);_0x5437e0[_0x6dc8('0x3e')]=_[_0x6dc8('0x3d')](_0x55e6fd['model'],qs[_0x6dc8('0x40')](_0x5bfa51[_0x6dc8('0x3a')][_0x6dc8('0x40')]));_0x5437e0['attributes']=_0x5437e0[_0x6dc8('0x3e')]['length']?_0x5437e0[_0x6dc8('0x3e')]:_0x55e6fd[_0x6dc8('0x3f')];_0x5437e0['order']=qs[_0x6dc8('0x43')](_0x5bfa51[_0x6dc8('0x3a')][_0x6dc8('0x43')]);_0x5437e0[_0x6dc8('0x44')]=qs[_0x6dc8('0x3c')](_[_0x6dc8('0x45')](_0x5bfa51['query'],_0x55e6fd['filters']));if(_0x5bfa51[_0x6dc8('0x3a')]['filter']){_0x5437e0[_0x6dc8('0x44')]=_[_0x6dc8('0x46')](_0x5437e0[_0x6dc8('0x44')],{'$or':_[_0x6dc8('0x2f')](_0x5437e0['attributes'],function(_0x5ecef5){var _0x23a395={};_0x23a395[_0x5ecef5]={'$like':'%'+_0x5bfa51[_0x6dc8('0x3a')][_0x6dc8('0x48')]+'%'};return _0x23a395;})});}_0x5437e0=_['merge']({},_0x5437e0,_0x5bfa51[_0x6dc8('0x49')]);return _0x323eba[_0x6dc8('0x9a')](_0x5437e0);}})[_0x6dc8('0x2b')](function(_0x534ce6){if(_0x534ce6){_0xce79b5=_0x534ce6[_0x6dc8('0x5c')];if(!_0x5bfa51[_0x6dc8('0x3a')]['hasOwnProperty'](_0x6dc8('0x41'))){_0x5437e0['limit']=qs[_0x6dc8('0x23')](_0x5bfa51['query']['limit']);_0x5437e0[_0x6dc8('0x21')]=qs['offset'](_0x5bfa51[_0x6dc8('0x3a')][_0x6dc8('0x21')]);}return _0x323eba[_0x6dc8('0x9a')](_0x5437e0);}})['then'](function(_0x4ea742){if(_0x4ea742){return _0x4ea742?{'count':_0xce79b5,'rows':_0x4ea742}:null;}})[_0x6dc8('0x2b')](respondWithResult(_0x208d5c,null))[_0x6dc8('0x4d')](handleError(_0x208d5c,null));};exports[_0x6dc8('0x9b')]=function(_0x455e7b,_0x3cd2a6,_0x17a7da){var _0x37703e={};var _0x12ccce={};var _0x11c82f;var _0x5b333e;return db[_0x6dc8('0x4a')][_0x6dc8('0x63')]({'where':{'id':_0x455e7b[_0x6dc8('0x4f')]['id']}})[_0x6dc8('0x2b')](handleEntityNotFound(_0x3cd2a6,null))[_0x6dc8('0x2b')](function(_0x5c5ef1){if(_0x5c5ef1){_0x11c82f=_0x5c5ef1;_0x12ccce['model']=_[_0x6dc8('0x3b')](db['UserVoiceQueueRt']['rawAttributes']);_0x12ccce[_0x6dc8('0x3a')]=_[_0x6dc8('0x3b')](_0x455e7b['query']);_0x12ccce[_0x6dc8('0x3c')]=_[_0x6dc8('0x3d')](_0x12ccce['model'],_0x12ccce[_0x6dc8('0x3a')]);_0x37703e[_0x6dc8('0x3e')]=_['intersection'](_0x12ccce[_0x6dc8('0x3f')],qs['fields'](_0x455e7b['query'][_0x6dc8('0x40')]));_0x37703e[_0x6dc8('0x3e')]=_0x37703e[_0x6dc8('0x3e')][_0x6dc8('0x5c')]?_0x37703e['attributes']:_0x12ccce['model'];_0x37703e['order']=qs[_0x6dc8('0x43')](_0x455e7b[_0x6dc8('0x3a')][_0x6dc8('0x43')]);_0x37703e[_0x6dc8('0x44')]=qs['filters'](_['pick'](_0x455e7b[_0x6dc8('0x3a')],_0x12ccce[_0x6dc8('0x3c')]));if(_0x455e7b[_0x6dc8('0x3a')]['filter']){_0x37703e[_0x6dc8('0x44')]=_[_0x6dc8('0x46')](_0x37703e[_0x6dc8('0x44')],{'$or':_[_0x6dc8('0x2f')](_0x37703e[_0x6dc8('0x3e')],function(_0x35553a){var _0x4fa3f2={};_0x4fa3f2[_0x35553a]={'$like':'%'+_0x455e7b[_0x6dc8('0x3a')][_0x6dc8('0x48')]+'%'};return _0x4fa3f2;})});}_0x37703e=_[_0x6dc8('0x46')]({},_0x37703e,_0x455e7b['options']);return _0x11c82f['getMembers'](_0x37703e);}})[_0x6dc8('0x2b')](function(_0xdf699c){if(_0xdf699c){_0x5b333e=_0xdf699c[_0x6dc8('0x5c')];if(!_0x455e7b[_0x6dc8('0x3a')][_0x6dc8('0x64')](_0x6dc8('0x41'))){_0x37703e[_0x6dc8('0x23')]=qs[_0x6dc8('0x23')](_0x455e7b[_0x6dc8('0x3a')]['limit']);_0x37703e[_0x6dc8('0x21')]=qs[_0x6dc8('0x21')](_0x455e7b[_0x6dc8('0x3a')][_0x6dc8('0x21')]);}return _0x11c82f['getMembers'](_0x37703e);}})[_0x6dc8('0x2b')](function(_0x1fff53){return _0x1fff53?{'count':_0x5b333e,'rows':_0x1fff53}:null;})[_0x6dc8('0x2b')](respondWithResult(_0x3cd2a6,null))[_0x6dc8('0x4d')](handleError(_0x3cd2a6,null));};exports[_0x6dc8('0x9c')]=function(_0x47184c,_0x509701,_0x50ce24){var _0x4bbf08={};var _0x198568={};var _0x2d9d21;var _0x273f1d;return db['VoiceQueue'][_0x6dc8('0x63')]({'where':{'id':_0x47184c[_0x6dc8('0x4f')]['id']}})[_0x6dc8('0x2b')](handleEntityNotFound(_0x509701,null))['then'](function(_0x2188a5){if(_0x2188a5){_0x2d9d21=_0x2188a5;_0x198568['model']=_['keys'](db[_0x6dc8('0x9d')][_0x6dc8('0x38')]);_0x198568['query']=_[_0x6dc8('0x3b')](_0x47184c['query']);_0x198568[_0x6dc8('0x3c')]=_['intersection'](_0x198568[_0x6dc8('0x3f')],_0x198568[_0x6dc8('0x3a')]);_0x4bbf08['attributes']=_[_0x6dc8('0x3d')](_0x198568[_0x6dc8('0x3f')],qs[_0x6dc8('0x40')](_0x47184c['query'][_0x6dc8('0x40')]));_0x4bbf08[_0x6dc8('0x3e')]=_0x4bbf08[_0x6dc8('0x3e')][_0x6dc8('0x5c')]?_0x4bbf08[_0x6dc8('0x3e')]:_0x198568['model'];_0x4bbf08[_0x6dc8('0x42')]=qs[_0x6dc8('0x43')](_0x47184c[_0x6dc8('0x3a')][_0x6dc8('0x43')]);_0x4bbf08[_0x6dc8('0x44')]=qs['filters'](_[_0x6dc8('0x45')](_0x47184c[_0x6dc8('0x3a')],_0x198568[_0x6dc8('0x3c')]));if(_0x47184c[_0x6dc8('0x3a')][_0x6dc8('0x48')]){_0x4bbf08['where']=_[_0x6dc8('0x46')](_0x4bbf08[_0x6dc8('0x44')],{'$or':_[_0x6dc8('0x2f')](_0x4bbf08[_0x6dc8('0x3e')],function(_0x580695){var _0x438865={};_0x438865[_0x580695]={'$like':'%'+_0x47184c[_0x6dc8('0x3a')][_0x6dc8('0x48')]+'%'};return _0x438865;})});}_0x4bbf08=_[_0x6dc8('0x46')]({},_0x4bbf08,_0x47184c[_0x6dc8('0x49')]);return _0x2d9d21[_0x6dc8('0x9c')](_0x4bbf08);}})['then'](function(_0x4f0cb5){if(_0x4f0cb5){_0x273f1d=_0x4f0cb5[_0x6dc8('0x5c')];if(!_0x47184c[_0x6dc8('0x3a')][_0x6dc8('0x64')](_0x6dc8('0x41'))){_0x4bbf08[_0x6dc8('0x23')]=qs['limit'](_0x47184c['query'][_0x6dc8('0x23')]);_0x4bbf08['offset']=qs[_0x6dc8('0x21')](_0x47184c[_0x6dc8('0x3a')][_0x6dc8('0x21')]);}return _0x2d9d21[_0x6dc8('0x9c')](_0x4bbf08);}})[_0x6dc8('0x2b')](function(_0x4f9f92){if(_0x4f9f92){return _0x4f9f92?{'count':_0x273f1d,'rows':_0x4f9f92}:null;}})[_0x6dc8('0x2b')](respondWithResult(_0x509701,null))[_0x6dc8('0x4d')](handleError(_0x509701,null));};exports[_0x6dc8('0x9e')]=function(_0x589fd8,_0x5d2825,_0x5aa22a){var _0x49c4a0=moment()[_0x6dc8('0x98')]('YYYY-MM-DD\x20HH:mm:ss');var _0x297a59,_0x5b0886;return db[_0x6dc8('0x4a')]['find']({'where':{'id':_0x589fd8['params']['id']}})[_0x6dc8('0x2b')](handleEntityNotFound(_0x5d2825,null))[_0x6dc8('0x2b')](function(_0xf6a2f1){if(_0xf6a2f1){_0x5b0886=_0xf6a2f1;return _0xf6a2f1[_0x6dc8('0x9e')](_0x589fd8[_0x6dc8('0x5f')][_0x6dc8('0x92')],_['omit'](_0x589fd8[_0x6dc8('0x5f')],[_0x6dc8('0x92'),'id'])||{});}return null;})['spread'](function(_0x16104b){var _0x4d166f;_0x297a59=_0x16104b||[];var _0x4fb590=[];if(_0x16104b){for(var _0x6cfffc=0x0;_0x6cfffc<_0x16104b[_0x6dc8('0x5c')];_0x6cfffc+=0x1){var _0x4c1e7b=_0x16104b[_0x6cfffc]['get']({'plain':!![]});_0x5b0886[_0x6dc8('0x9f')]=_0x589fd8[_0x6dc8('0x5f')]['dialCheckDuplicateType']?_0x589fd8[_0x6dc8('0x5f')][_0x6dc8('0x9f')]:_0x5b0886[_0x6dc8('0x9f')];switch(_0x5b0886['dialCheckDuplicateType']){case _0x6dc8('0xa0'):_0x4d166f=squel[_0x6dc8('0xa1')]()[_0x6dc8('0xa2')]('cm_hopper')['fromQuery'](['phone','scheduledAt','ContactId',_0x6dc8('0xa3'),_0x6dc8('0x65'),_0x6dc8('0x5e'),'updatedAt'],squel[_0x6dc8('0x80')]()[_0x6dc8('0x81')](_0x6dc8('0xa4'),_0x6dc8('0xa4'))['field']('\x27'+_0x49c4a0+'\x27','scheduledAt')[_0x6dc8('0x81')]('id','ContactId')[_0x6dc8('0x81')](_0x4c1e7b[_0x6dc8('0xa5')][_0x6dc8('0x8b')](),_0x6dc8('0xa3'))[_0x6dc8('0x81')](_0x589fd8[_0x6dc8('0x4f')]['id'][_0x6dc8('0x8b')](),_0x6dc8('0x65'))[_0x6dc8('0x81')]('\x27'+_0x49c4a0+'\x27',_0x6dc8('0x5e'))[_0x6dc8('0x81')]('\x27'+_0x49c4a0+'\x27',_0x6dc8('0x60'))[_0x6dc8('0x83')](_0x6dc8('0xa6'))[_0x6dc8('0x44')](_0x6dc8('0xa7'))['where'](_0x6dc8('0xa8'),_0x4c1e7b['CmListId'][_0x6dc8('0x8b')]())[_0x6dc8('0x44')](_0x6dc8('0xa9'))['where'](_0x6dc8('0xaa'),squel[_0x6dc8('0x80')]()['field'](_0x6dc8('0xab'))[_0x6dc8('0x83')](_0x6dc8('0xac'))[_0x6dc8('0x44')]('VoiceQueueId\x20=\x20?',_0x589fd8[_0x6dc8('0x4f')]['id'][_0x6dc8('0x8b')]()))[_0x6dc8('0x44')](_0x6dc8('0xaa'),squel['select']()[_0x6dc8('0x81')](_0x6dc8('0xad'))['from'](_0x6dc8('0xae'))['where'](_0x6dc8('0x86'),_0x589fd8[_0x6dc8('0x4f')]['id']['toString']())))[_0x6dc8('0x8b')]();break;case'onlyIfOpen':_0x4d166f=squel[_0x6dc8('0xa1')]()['into'](_0x6dc8('0xae'))[_0x6dc8('0xaf')]([_0x6dc8('0xa4'),_0x6dc8('0xb0'),_0x6dc8('0xb1'),'ListId',_0x6dc8('0x65'),'createdAt','updatedAt'],squel[_0x6dc8('0x80')]()[_0x6dc8('0x81')](_0x6dc8('0xa4'),_0x6dc8('0xa4'))[_0x6dc8('0x81')]('\x27'+_0x49c4a0+'\x27','scheduledAt')[_0x6dc8('0x81')]('id',_0x6dc8('0xb1'))[_0x6dc8('0x81')](_0x4c1e7b['CmListId'][_0x6dc8('0x8b')](),'ListId')[_0x6dc8('0x81')](_0x589fd8['params']['id'][_0x6dc8('0x8b')](),_0x6dc8('0x65'))['field']('\x27'+_0x49c4a0+'\x27',_0x6dc8('0x5e'))['field']('\x27'+_0x49c4a0+'\x27',_0x6dc8('0x60'))[_0x6dc8('0x83')]('cm_contacts')[_0x6dc8('0x44')](_0x6dc8('0xa7'))[_0x6dc8('0x44')](_0x6dc8('0xa8'),_0x4c1e7b[_0x6dc8('0xa5')]['toString']())[_0x6dc8('0x44')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x6dc8('0xaa'),squel['select']()['field'](_0x6dc8('0xad'))['from'](_0x6dc8('0xae'))['where'](_0x6dc8('0x86'),_0x589fd8['params']['id'][_0x6dc8('0x8b')]())))[_0x6dc8('0x8b')]();break;default:_0x4d166f=squel[_0x6dc8('0xa1')]()[_0x6dc8('0xa2')](_0x6dc8('0xae'))[_0x6dc8('0xaf')]([_0x6dc8('0xa4'),_0x6dc8('0xb0'),_0x6dc8('0xb1'),_0x6dc8('0xa3'),_0x6dc8('0x65'),_0x6dc8('0x5e'),_0x6dc8('0x60')],squel['select']()[_0x6dc8('0x81')]('phone','phone')[_0x6dc8('0x81')]('\x27'+_0x49c4a0+'\x27',_0x6dc8('0xb0'))[_0x6dc8('0x81')]('id',_0x6dc8('0xb1'))[_0x6dc8('0x81')](_0x4c1e7b[_0x6dc8('0xa5')][_0x6dc8('0x8b')](),_0x6dc8('0xa3'))[_0x6dc8('0x81')](_0x589fd8[_0x6dc8('0x4f')]['id']['toString'](),'VoiceQueueId')['field']('\x27'+_0x49c4a0+'\x27',_0x6dc8('0x5e'))[_0x6dc8('0x81')]('\x27'+_0x49c4a0+'\x27','updatedAt')[_0x6dc8('0x83')](_0x6dc8('0xa6'))[_0x6dc8('0x44')]('deletedAt\x20IS\x20NULL')[_0x6dc8('0x44')]('ListId\x20=\x20?',_0x4c1e7b[_0x6dc8('0xa5')][_0x6dc8('0x8b')]())[_0x6dc8('0x44')](_0x6dc8('0xa9')))[_0x6dc8('0x8b')]();}_0x4fb590['push'](db[_0x6dc8('0x8a')][_0x6dc8('0x3a')](_0x4d166f));}return BPromise[_0x6dc8('0x8f')](_0x4fb590);}})[_0x6dc8('0x2b')](function(){var _0x3a36d5=[];var _0x403b71=squel[_0x6dc8('0xa1')]()[_0x6dc8('0xa2')](_0x6dc8('0xb2'))[_0x6dc8('0xaf')](['CmHopperId',_0x6dc8('0xa4'),_0x6dc8('0xb3'),_0x6dc8('0x5e'),'updatedAt'],squel[_0x6dc8('0x80')]()[_0x6dc8('0x81')]('h.id')[_0x6dc8('0x81')](_0x6dc8('0xb4'))['field'](_0x6dc8('0xb5'))['field']('\x27'+_0x49c4a0+'\x27',_0x6dc8('0x5e'))[_0x6dc8('0x81')]('\x27'+_0x49c4a0+'\x27',_0x6dc8('0x60'))[_0x6dc8('0x83')](_0x6dc8('0xb6'),'ci')[_0x6dc8('0xb7')](_0x6dc8('0xae'),'h',_0x6dc8('0xb8'))['where']('h.scheduledat=?',_0x49c4a0)['where']('ci.ItemClass=?',_0x6dc8('0xb9')))[_0x6dc8('0x8b')]();_0x3a36d5[_0x6dc8('0x89')](db[_0x6dc8('0x8a')][_0x6dc8('0x3a')](_0x403b71));return BPromise[_0x6dc8('0x8f')](_0x3a36d5);})[_0x6dc8('0x2b')](function(){return _0x297a59;})[_0x6dc8('0x2b')](respondWithResult(_0x5d2825,null))[_0x6dc8('0x4d')](handleError(_0x5d2825,null));};exports['removeLists']=function(_0x2bb335,_0x43a34d,_0x98b970){return db[_0x6dc8('0x4a')]['find']({'where':{'id':_0x2bb335[_0x6dc8('0x4f')]['id']}})['then'](handleEntityNotFound(_0x43a34d,null))['then'](function(_0x241e59){if(_0x241e59){return _0x241e59['removeLists'](_0x2bb335[_0x6dc8('0x3a')][_0x6dc8('0x92')]);}})[_0x6dc8('0x2b')](function(_0x58f76e){if(_0x58f76e){return db[_0x6dc8('0x66')][_0x6dc8('0x2a')]({'where':{'ListId':_0x2bb335['query'][_0x6dc8('0x92')],'VoiceQueueId':_0x2bb335[_0x6dc8('0x4f')]['id']}})['then'](function(){return _0x58f76e;});}})['then'](respondWithStatusCode(_0x43a34d,null))[_0x6dc8('0x4d')](handleError(_0x43a34d,null));};exports[_0x6dc8('0xba')]=function(_0x354aef,_0xa1654e,_0x53f7c2){var _0x3902fe={};var _0x2f2bdc={};var _0x3994ad;var _0x409882;return db[_0x6dc8('0x4a')]['findOne']({'where':{'id':_0x354aef[_0x6dc8('0x4f')]['id']}})['then'](handleEntityNotFound(_0xa1654e,null))[_0x6dc8('0x2b')](function(_0x38e65e){if(_0x38e65e){_0x3994ad=_0x38e65e;_0x2f2bdc[_0x6dc8('0x3f')]=_[_0x6dc8('0x3b')](db[_0x6dc8('0x9d')]['rawAttributes']);_0x2f2bdc['query']=_['keys'](_0x354aef[_0x6dc8('0x3a')]);_0x2f2bdc[_0x6dc8('0x3c')]=_[_0x6dc8('0x3d')](_0x2f2bdc['model'],_0x2f2bdc['query']);_0x3902fe['attributes']=_[_0x6dc8('0x3d')](_0x2f2bdc[_0x6dc8('0x3f')],qs[_0x6dc8('0x40')](_0x354aef[_0x6dc8('0x3a')]['fields']));_0x3902fe['attributes']=_0x3902fe['attributes'][_0x6dc8('0x5c')]?_0x3902fe['attributes']:_0x2f2bdc[_0x6dc8('0x3f')];_0x3902fe['order']=qs[_0x6dc8('0x43')](_0x354aef['query'][_0x6dc8('0x43')]);_0x3902fe['where']=qs[_0x6dc8('0x3c')](_[_0x6dc8('0x45')](_0x354aef[_0x6dc8('0x3a')],_0x2f2bdc[_0x6dc8('0x3c')]));if(_0x354aef['query'][_0x6dc8('0x48')]){_0x3902fe['where']=_[_0x6dc8('0x46')](_0x3902fe[_0x6dc8('0x44')],{'$or':_[_0x6dc8('0x2f')](_0x3902fe[_0x6dc8('0x3e')],function(_0x159155){var _0x3dd224={};_0x3dd224[_0x159155]={'$like':'%'+_0x354aef['query'][_0x6dc8('0x48')]+'%'};return _0x3dd224;})});}_0x3902fe=_[_0x6dc8('0x46')]({},_0x3902fe,_0x354aef[_0x6dc8('0x49')]);return _0x3994ad[_0x6dc8('0xba')](_0x3902fe);}})[_0x6dc8('0x2b')](function(_0x2f616e){if(_0x2f616e){_0x409882=_0x2f616e[_0x6dc8('0x5c')];if(!_0x354aef[_0x6dc8('0x3a')][_0x6dc8('0x64')](_0x6dc8('0x41'))){_0x3902fe['limit']=qs[_0x6dc8('0x23')](_0x354aef[_0x6dc8('0x3a')][_0x6dc8('0x23')]);_0x3902fe[_0x6dc8('0x21')]=qs[_0x6dc8('0x21')](_0x354aef[_0x6dc8('0x3a')]['offset']);}return _0x3994ad[_0x6dc8('0xba')](_0x3902fe);}})[_0x6dc8('0x2b')](function(_0x2e4dc4){if(_0x2e4dc4){return _0x2e4dc4?{'count':_0x409882,'rows':_0x2e4dc4}:null;}})[_0x6dc8('0x2b')](respondWithResult(_0xa1654e,null))[_0x6dc8('0x4d')](handleError(_0xa1654e,null));};exports['addBlackLists']=function(_0x1ef403,_0x67b1ab,_0x17ed39){var _0x5d2e90,_0x4325a6;return db[_0x6dc8('0x4a')][_0x6dc8('0x33')]({'where':{'id':_0x1ef403['params']['id']}})[_0x6dc8('0x2b')](handleEntityNotFound(_0x67b1ab,null))[_0x6dc8('0x2b')](function(_0x240de0){if(_0x240de0){_0x4325a6=_0x240de0;return _0x240de0[_0x6dc8('0xbb')](_0x1ef403['body'][_0x6dc8('0x92')],_[_0x6dc8('0x5d')](_0x1ef403[_0x6dc8('0x5f')],['ids','id'])||{});}return null;})[_0x6dc8('0x96')](function(_0x5d981e){var _0x2cd287;_0x5d2e90=_0x5d981e||[];var _0x3a0339=[];if(_0x5d981e){for(var _0x20d4f1=0x0;_0x20d4f1<_0x5d981e[_0x6dc8('0x5c')];_0x20d4f1+=0x1){var _0xf6774b=_0x5d981e[_0x20d4f1][_0x6dc8('0x53')]({'plain':!![]});_0x2cd287=squel[_0x6dc8('0xa1')]()['into'](_0x6dc8('0xbc'))[_0x6dc8('0xaf')]([_0x6dc8('0xa4'),_0x6dc8('0xb1'),_0x6dc8('0xa3'),_0x6dc8('0x65'),_0x6dc8('0x5e'),_0x6dc8('0x60')],squel[_0x6dc8('0x80')]()[_0x6dc8('0x81')](_0x6dc8('0xa4'),'phone')[_0x6dc8('0x81')]('id',_0x6dc8('0xb1'))[_0x6dc8('0x81')](_0xf6774b[_0x6dc8('0xa5')][_0x6dc8('0x8b')](),_0x6dc8('0xa3'))[_0x6dc8('0x81')](_0x1ef403[_0x6dc8('0x4f')]['id']['toString'](),_0x6dc8('0x65'))['field'](_0x6dc8('0xbd'),_0x6dc8('0x5e'))[_0x6dc8('0x81')]('NOW()',_0x6dc8('0x60'))[_0x6dc8('0x83')](_0x6dc8('0xa6'))['where'](_0x6dc8('0xa7'))[_0x6dc8('0x44')](_0x6dc8('0xa8'),_0xf6774b['CmListId']['toString']())[_0x6dc8('0x44')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x3a0339['push'](db[_0x6dc8('0x8a')]['query'](_0x2cd287));}return BPromise[_0x6dc8('0x8f')](_0x3a0339);}})[_0x6dc8('0x2b')](function(){return _0x5d2e90;})[_0x6dc8('0x2b')](respondWithResult(_0x67b1ab,null))[_0x6dc8('0x4d')](handleError(_0x67b1ab,null));};exports[_0x6dc8('0xbe')]=function(_0x3ec233,_0x9922eb,_0x4b01b3){return db[_0x6dc8('0x4a')][_0x6dc8('0x33')]({'where':{'id':_0x3ec233['params']['id']}})[_0x6dc8('0x2b')](handleEntityNotFound(_0x9922eb,null))['then'](function(_0x4990a8){if(_0x4990a8){return _0x4990a8['removeBlackLists'](_0x3ec233[_0x6dc8('0x3a')][_0x6dc8('0x92')]);}})[_0x6dc8('0x2b')](function(_0x8fdd85){if(_0x8fdd85){return db[_0x6dc8('0x6a')][_0x6dc8('0x2a')]({'where':{'ListId':_0x3ec233['query'][_0x6dc8('0x92')],'VoiceQueueId':_0x3ec233[_0x6dc8('0x4f')]['id']}})['then'](function(){return _0x8fdd85;});}})['then'](respondWithStatusCode(_0x9922eb,null))[_0x6dc8('0x4d')](handleError(_0x9922eb,null));}; \ No newline at end of file +var _0x77a9=['getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','select','CmListId','ListId','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_contacts','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','cm_contact_has_items','h.ContactId=ci.CmContactId','PHONE','removeLists','getBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','sendStatus','end','json','offset','limit','count','status','set','apply','reject','update','then','get','VoiceQueues','map','value','type','find','name','UserProfileResource','destroy','stack','send','VoiceQueue','fieldName','key','model','keys','filters','query','attributes','intersection','fields','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','inbound','outbound','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','createdAt','updatedAt','QueueCampaigns','autoAssociation','getHoppers','findOne','CmHopper','nolimit','VoiceQueueId','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','Team','User','Agents','voicePause','interface','forEach','penalty','transaction','each','UserVoiceQueue','isNil','format','SIP/%s','emit','userVoiceQueue:save','ids','field','from','team_has_voice_queues','join','user_has_teams','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','toString','SELECT','every','TeamId','includes','all','compact','removeTeams','removeAgents','UserVoiceQueueRt','addAgents','omit','online','isEmpty','push','isArray','userVoiceQueue:remove'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x77a9,0x19e));var _0x977a=function(_0x5d22c2,_0x16670a){_0x5d22c2=_0x5d22c2-0x0;var _0x5d2995=_0x77a9[_0x5d22c2];return _0x5d2995;};'use strict';var emlformat=require(_0x977a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x977a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x977a('0x2'));var moment=require(_0x977a('0x3'));var BPromise=require(_0x977a('0x4'));var Mustache=require(_0x977a('0x5'));var util=require('util');var path=require(_0x977a('0x6'));var sox=require(_0x977a('0x7'));var csv=require(_0x977a('0x8'));var ejs=require(_0x977a('0x9'));var fs=require('fs');var fs_extra=require(_0x977a('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x977a('0xb'));var jsforce=require(_0x977a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x977a('0x8'));var querystring=require(_0x977a('0xd'));var Papa=require(_0x977a('0xe'));var Redis=require(_0x977a('0xf'));var authService=require(_0x977a('0x10'));var qs=require(_0x977a('0x11'));var as=require(_0x977a('0x12'));var hardwareService=require(_0x977a('0x13'));var logger=require(_0x977a('0x14'))(_0x977a('0x15'));var utils=require('../../config/utils');var config=require(_0x977a('0x16'));var licenseUtil=require(_0x977a('0x17'));var db=require(_0x977a('0x18'))['db'];config[_0x977a('0x19')]=_[_0x977a('0x1a')](config[_0x977a('0x19')],{'host':_0x977a('0x1b'),'port':0x18eb});var socket=require(_0x977a('0x1c'))(new Redis(config[_0x977a('0x19')]));require(_0x977a('0x1d'))['register'](socket);function respondWithStatusCode(_0x6b3627,_0x50c631){_0x50c631=_0x50c631||0xcc;return function(_0x1f884a){if(_0x1f884a){return _0x6b3627[_0x977a('0x1e')](_0x50c631);}return _0x6b3627['status'](_0x50c631)[_0x977a('0x1f')]();};}function respondWithResult(_0x432c16,_0x25e169){_0x25e169=_0x25e169||0xc8;return function(_0x1478d0){if(_0x1478d0){return _0x432c16['status'](_0x25e169)[_0x977a('0x20')](_0x1478d0);}};}function respondWithFilteredResult(_0x3178e5,_0x2d47a0){return function(_0x5b57bd){if(_0x5b57bd){var _0x3e7dac=typeof _0x2d47a0[_0x977a('0x21')]==='undefined'&&typeof _0x2d47a0[_0x977a('0x22')]==='undefined';var _0x709863=_0x5b57bd[_0x977a('0x23')];var _0x14994a=_0x3e7dac?0x0:_0x2d47a0[_0x977a('0x21')];var _0x40ea51=_0x3e7dac?_0x5b57bd['count']:_0x2d47a0[_0x977a('0x21')]+_0x2d47a0[_0x977a('0x22')];var _0x93cd9a;if(_0x40ea51>=_0x709863){_0x40ea51=_0x709863;_0x93cd9a=0xc8;}else{_0x93cd9a=0xce;}_0x3178e5[_0x977a('0x24')](_0x93cd9a);return _0x3178e5[_0x977a('0x25')]('Content-Range',_0x14994a+'-'+_0x40ea51+'/'+_0x709863)['json'](_0x5b57bd);}return null;};}function patchUpdates(_0x36c19c){return function(_0x36134f){try{jsonpatch[_0x977a('0x26')](_0x36134f,_0x36c19c,!![]);}catch(_0x10408d){return BPromise[_0x977a('0x27')](_0x10408d);}return _0x36134f['save']();};}function saveUpdates(_0x24a519,_0x5e9ed5){return function(_0x35888f){if(_0x35888f){return _0x35888f[_0x977a('0x28')](_0x24a519)[_0x977a('0x29')](function(_0x5794c6){return _0x5794c6;});}return null;};}function removeEntity(_0x3734ac,_0x1efd0a){return function(_0x1c6195){if(_0x1c6195){return _0x1c6195['destroy']()[_0x977a('0x29')](function(){var _0x49a87a=_0x1c6195[_0x977a('0x2a')]({'plain':!![]});var _0x3184b2=[{'name':_0x977a('0x2b'),'value':'inbound','ignore':![]},{'name':'QueueCampaigns','value':'outbound','ignore':![]}];var _0x4c7256=_(_0x3184b2)['filter']('ignore')[_0x977a('0x2c')]('value')[_0x977a('0x2d')]();if(_['includes'](_0x4c7256,_0x49a87a[_0x977a('0x2e')])){return;}var _0x2935a0=_[_0x977a('0x2f')](_0x3184b2,[_0x977a('0x2d'),_0x49a87a['type']])[_0x977a('0x30')];return db[_0x977a('0x31')][_0x977a('0x32')]({'where':{'type':_0x2935a0,'resourceId':_0x49a87a['id']}})[_0x977a('0x29')](function(){return _0x1c6195;});})[_0x977a('0x29')](function(){_0x3734ac['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x40fe6c,_0x1a706f){return function(_0x30c0be){if(!_0x30c0be){_0x40fe6c['sendStatus'](0x194);}return _0x30c0be;};}function handleError(_0x3ee42a,_0x1ca5f2){_0x1ca5f2=_0x1ca5f2||0x1f4;return function(_0x34de0f){logger['error'](_0x34de0f[_0x977a('0x33')]);if(_0x34de0f[_0x977a('0x30')]){delete _0x34de0f[_0x977a('0x30')];}_0x3ee42a[_0x977a('0x24')](_0x1ca5f2)[_0x977a('0x34')](_0x34de0f);};}exports['index']=function(_0x2242dc,_0xe08a54){var _0x3f7eb2={},_0x3ed20a={},_0x229677={'count':0x0,'rows':[]};var _0x1a0344=_[_0x977a('0x2c')](db[_0x977a('0x35')]['rawAttributes'],function(_0x372007){return{'name':_0x372007[_0x977a('0x36')],'type':_0x372007[_0x977a('0x2e')][_0x977a('0x37')]};});_0x3ed20a[_0x977a('0x38')]=_[_0x977a('0x2c')](_0x1a0344,_0x977a('0x30'));_0x3ed20a['query']=_[_0x977a('0x39')](_0x2242dc['query']);_0x3ed20a[_0x977a('0x3a')]=_['intersection'](_0x3ed20a['model'],_0x3ed20a[_0x977a('0x3b')]);_0x3f7eb2[_0x977a('0x3c')]=_[_0x977a('0x3d')](_0x3ed20a['model'],qs['fields'](_0x2242dc[_0x977a('0x3b')][_0x977a('0x3e')]));_0x3f7eb2[_0x977a('0x3c')]=_0x3f7eb2[_0x977a('0x3c')]['length']?_0x3f7eb2['attributes']:_0x3ed20a[_0x977a('0x38')];if(!_0x2242dc[_0x977a('0x3b')][_0x977a('0x3f')]('nolimit')){_0x3f7eb2[_0x977a('0x22')]=qs['limit'](_0x2242dc['query'][_0x977a('0x22')]);_0x3f7eb2['offset']=qs[_0x977a('0x21')](_0x2242dc[_0x977a('0x3b')][_0x977a('0x21')]);}_0x3f7eb2[_0x977a('0x40')]=qs[_0x977a('0x41')](_0x2242dc[_0x977a('0x3b')][_0x977a('0x41')]);_0x3f7eb2['where']=qs['filters'](_[_0x977a('0x42')](_0x2242dc[_0x977a('0x3b')],_0x3ed20a[_0x977a('0x3a')]),_0x1a0344);if(_0x2242dc[_0x977a('0x3b')][_0x977a('0x43')]){_0x3f7eb2[_0x977a('0x44')]=_[_0x977a('0x45')](_0x3f7eb2[_0x977a('0x44')],{'$or':_[_0x977a('0x2c')](_0x1a0344,function(_0x57a1a4){if(_0x57a1a4[_0x977a('0x2e')]!==_0x977a('0x46')){var _0x99c580={};_0x99c580[_0x57a1a4[_0x977a('0x30')]]={'$like':'%'+_0x2242dc[_0x977a('0x3b')][_0x977a('0x43')]+'%'};return _0x99c580;}})});}_0x3f7eb2=_['merge']({},_0x3f7eb2,_0x2242dc[_0x977a('0x47')]);var _0x3e25c1={'where':_0x3f7eb2[_0x977a('0x44')]};return db['VoiceQueue']['count'](_0x3e25c1)['then'](function(_0x5bed4c){_0x229677[_0x977a('0x23')]=_0x5bed4c;if(_0x2242dc[_0x977a('0x3b')][_0x977a('0x48')]){_0x3f7eb2[_0x977a('0x49')]=[{'all':!![]}];}return db[_0x977a('0x35')][_0x977a('0x4a')](_0x3f7eb2);})[_0x977a('0x29')](function(_0x1c2c1a){_0x229677[_0x977a('0x4b')]=_0x1c2c1a;return _0x229677;})[_0x977a('0x29')](respondWithFilteredResult(_0xe08a54,_0x3f7eb2))[_0x977a('0x4c')](handleError(_0xe08a54,null));};exports[_0x977a('0x4d')]=function(_0x5ee5ee,_0x1773d8){var _0x15fc1b={'raw':![],'where':{'id':_0x5ee5ee['params']['id']}},_0x55d123={};_0x55d123[_0x977a('0x38')]=_[_0x977a('0x39')](db['VoiceQueue'][_0x977a('0x4e')]);_0x55d123['query']=_[_0x977a('0x39')](_0x5ee5ee[_0x977a('0x3b')]);_0x55d123[_0x977a('0x3a')]=_['intersection'](_0x55d123[_0x977a('0x38')],_0x55d123[_0x977a('0x3b')]);_0x15fc1b['attributes']=_[_0x977a('0x3d')](_0x55d123['model'],qs[_0x977a('0x3e')](_0x5ee5ee[_0x977a('0x3b')]['fields']));_0x15fc1b[_0x977a('0x3c')]=_0x15fc1b[_0x977a('0x3c')][_0x977a('0x4f')]?_0x15fc1b[_0x977a('0x3c')]:_0x55d123[_0x977a('0x38')];if(_0x5ee5ee[_0x977a('0x3b')][_0x977a('0x48')]){_0x15fc1b[_0x977a('0x49')]=[{'all':!![]}];}_0x15fc1b=_[_0x977a('0x45')]({},_0x15fc1b,_0x5ee5ee[_0x977a('0x47')]);return db['VoiceQueue']['find'](_0x15fc1b)[_0x977a('0x29')](handleEntityNotFound(_0x1773d8,null))['then'](respondWithResult(_0x1773d8,null))['catch'](handleError(_0x1773d8,null));};exports[_0x977a('0x50')]=function(_0x4eaa24,_0x5994f9){return db['VoiceQueue'][_0x977a('0x50')](_0x4eaa24[_0x977a('0x51')],{})['then'](function(_0x51ea86){var _0xcdca79=_0x4eaa24[_0x977a('0x52')][_0x977a('0x2a')]({'plain':!![]});if(!_0xcdca79)throw new Error(_0x977a('0x53'));if(_0xcdca79[_0x977a('0x54')]===_0x977a('0x52')){var _0x1c064d=_0x51ea86[_0x977a('0x2a')]({'plain':!![]});var _0x69048b=[{'name':_0x977a('0x2b'),'value':_0x977a('0x55')},{'name':'QueueCampaigns','value':_0x977a('0x56')}];var _0x1e8bd4=_[_0x977a('0x2f')](_0x69048b,['value',_0x1c064d[_0x977a('0x2e')]])['name'];return db[_0x977a('0x57')][_0x977a('0x2f')]({'where':{'name':_0x1e8bd4,'userProfileId':_0xcdca79[_0x977a('0x58')]},'raw':!![]})['then'](function(_0x31bf5d){if(_0x31bf5d&&_0x31bf5d['autoAssociation']===0x0){return db[_0x977a('0x31')][_0x977a('0x50')]({'name':_0x1c064d[_0x977a('0x30')],'resourceId':_0x1c064d['id'],'type':_0x31bf5d[_0x977a('0x30')],'sectionId':_0x31bf5d['id']},{})[_0x977a('0x29')](function(){return _0x51ea86;});}else{return _0x51ea86;}})[_0x977a('0x4c')](function(_0x16803a){logger[_0x977a('0x59')](_0x977a('0x5a'),_0x16803a);throw _0x16803a;});}return _0x51ea86;})[_0x977a('0x29')](respondWithResult(_0x5994f9,0xc9))[_0x977a('0x4c')](handleError(_0x5994f9,null));};exports['clone']=function(_0x4d87a6,_0x5ed283){var _0x2a7ce2={'where':{'id':_0x4d87a6[_0x977a('0x5b')]['id']}},_0x205353={};_0x205353[_0x977a('0x38')]=_[_0x977a('0x39')](db[_0x977a('0x35')][_0x977a('0x4e')]);_0x2a7ce2[_0x977a('0x3c')]=_[_0x977a('0x3d')](_0x205353['model'],qs['fields'](_0x4d87a6[_0x977a('0x3b')][_0x977a('0x3e')]));_0x2a7ce2['attributes']=_0x2a7ce2[_0x977a('0x3c')]['length']?_0x2a7ce2[_0x977a('0x3c')]:_0x205353[_0x977a('0x38')];if(_0x4d87a6[_0x977a('0x3b')][_0x977a('0x48')]){_0x2a7ce2['include']=[{'all':!![]}];}_0x2a7ce2=_[_0x977a('0x45')]({},_0x2a7ce2,_0x4d87a6['options']);return db[_0x977a('0x35')]['find'](_0x2a7ce2)[_0x977a('0x29')](handleEntityNotFound(_0x5ed283,null))['then'](function(_0xbfbd28){if(_0xbfbd28){var _0x3bdcd6=_0xbfbd28[_0x977a('0x2a')]({'plain':!![]});_0x3bdcd6=qs['omit'](_0x3bdcd6,['id',_0x977a('0x5c'),_0x977a('0x5d')]);_0x4d87a6[_0x977a('0x51')]=_['omit'](_0x4d87a6[_0x977a('0x51')],['id',_0x977a('0x5c'),_0x977a('0x5d')]);return db['VoiceQueue']['create'](_['merge'](_0x3bdcd6,_0x4d87a6[_0x977a('0x51')]),{'include':_0x4d87a6[_0x977a('0x3b')][_0x977a('0x48')]?[{'all':!![]}]:undefined})['then'](function(_0x3a111c){var _0x1ad976=_0x4d87a6[_0x977a('0x52')][_0x977a('0x2a')]({'plain':!![]});if(!_0x1ad976)throw new Error(_0x977a('0x53'));if(_0x1ad976[_0x977a('0x54')]==='user'){var _0x1122bd=_0x3a111c[_0x977a('0x2a')]({'plain':!![]});var _0x339467=[{'name':_0x977a('0x2b'),'value':_0x977a('0x55')},{'name':_0x977a('0x5e'),'value':_0x977a('0x56')}];var _0x320b4a=_[_0x977a('0x2f')](_0x339467,[_0x977a('0x2d'),_0x1122bd[_0x977a('0x2e')]])[_0x977a('0x30')];return db[_0x977a('0x57')]['find']({'where':{'name':_0x320b4a,'userProfileId':_0x1ad976[_0x977a('0x58')]},'raw':!![]})['then'](function(_0x8ed6b0){if(_0x8ed6b0&&_0x8ed6b0[_0x977a('0x5f')]===0x0){return db[_0x977a('0x31')][_0x977a('0x50')]({'name':_0x1122bd[_0x977a('0x30')],'resourceId':_0x1122bd['id'],'type':_0x8ed6b0[_0x977a('0x30')],'sectionId':_0x8ed6b0['id']},{})['then'](function(){return _0x3a111c;});}else{return _0x3a111c;}})[_0x977a('0x4c')](function(_0x2086c4){logger[_0x977a('0x59')](_0x977a('0x5a'),_0x2086c4);throw _0x2086c4;});}return _0x3a111c;});}})['then'](respondWithResult(_0x5ed283,0xc9))[_0x977a('0x4c')](handleError(_0x5ed283,null));};exports[_0x977a('0x28')]=function(_0x53ef24,_0x2064f1){if(_0x53ef24[_0x977a('0x51')]['id']){delete _0x53ef24[_0x977a('0x51')]['id'];}return db[_0x977a('0x35')][_0x977a('0x2f')]({'where':{'id':_0x53ef24[_0x977a('0x5b')]['id']}})[_0x977a('0x29')](handleEntityNotFound(_0x2064f1,null))[_0x977a('0x29')](saveUpdates(_0x53ef24[_0x977a('0x51')],null))['then'](respondWithResult(_0x2064f1,null))['catch'](handleError(_0x2064f1,null));};exports[_0x977a('0x32')]=function(_0x50b0c2,_0x310099){return db['VoiceQueue'][_0x977a('0x2f')]({'where':{'id':_0x50b0c2['params']['id']}})[_0x977a('0x29')](handleEntityNotFound(_0x310099,null))[_0x977a('0x29')](removeEntity(_0x310099,null))[_0x977a('0x4c')](handleError(_0x310099,null));};exports[_0x977a('0x60')]=function(_0x1e8b02,_0x4b20f9,_0x342f73){var _0x54da94={'raw':![],'where':{}};var _0x250bd2={};var _0x5f5a82={'count':0x0,'rows':[]};return db[_0x977a('0x35')][_0x977a('0x61')]({'where':{'id':_0x1e8b02[_0x977a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4b20f9,null))[_0x977a('0x29')](function(_0x3baa6c){if(_0x3baa6c){_0x250bd2['model']=_[_0x977a('0x39')](db[_0x977a('0x62')]['rawAttributes']);_0x250bd2[_0x977a('0x3b')]=_['keys'](_0x1e8b02[_0x977a('0x3b')]);_0x250bd2[_0x977a('0x3a')]=_[_0x977a('0x3d')](_0x250bd2[_0x977a('0x38')],_0x250bd2[_0x977a('0x3b')]);_0x54da94[_0x977a('0x3c')]=_[_0x977a('0x3d')](_0x250bd2['model'],qs[_0x977a('0x3e')](_0x1e8b02['query']['fields']));_0x54da94[_0x977a('0x3c')]=_0x54da94['attributes'][_0x977a('0x4f')]?_0x54da94[_0x977a('0x3c')]:_0x250bd2[_0x977a('0x38')];if(!_0x1e8b02['query'][_0x977a('0x3f')](_0x977a('0x63'))){_0x54da94[_0x977a('0x22')]=qs[_0x977a('0x22')](_0x1e8b02[_0x977a('0x3b')][_0x977a('0x22')]);_0x54da94[_0x977a('0x21')]=qs[_0x977a('0x21')](_0x1e8b02[_0x977a('0x3b')]['offset']);}_0x54da94[_0x977a('0x40')]=qs['sort'](_0x1e8b02['query'][_0x977a('0x41')]);_0x54da94[_0x977a('0x44')]=qs['filters'](_[_0x977a('0x42')](_0x1e8b02['query'],_0x250bd2[_0x977a('0x3a')]));_0x54da94[_0x977a('0x44')]['VoiceQueueId']=_0x3baa6c['id'];if(_0x1e8b02[_0x977a('0x3b')][_0x977a('0x43')]){_0x54da94[_0x977a('0x44')]=_[_0x977a('0x45')](_0x54da94['where'],{'$or':_[_0x977a('0x2c')](_0x54da94[_0x977a('0x3c')],function(_0x5e22c5){var _0x9790e2={};_0x9790e2[_0x5e22c5]={'$like':'%'+_0x1e8b02['query'][_0x977a('0x43')]+'%'};return _0x9790e2;})});}_0x54da94=_[_0x977a('0x45')]({},_0x54da94,_0x1e8b02[_0x977a('0x47')]);return db[_0x977a('0x62')][_0x977a('0x23')]({'where':_0x54da94[_0x977a('0x44')]})[_0x977a('0x29')](function(_0x11c3dd){_0x5f5a82[_0x977a('0x23')]=_0x11c3dd;if(_0x1e8b02[_0x977a('0x3b')][_0x977a('0x48')]){_0x54da94['include']=[{'all':!![]}];}return db[_0x977a('0x62')]['findAll'](_0x54da94);})[_0x977a('0x29')](function(_0x15863e){_0x5f5a82[_0x977a('0x4b')]=_0x15863e;return _0x5f5a82;});}})[_0x977a('0x29')](respondWithFilteredResult(_0x4b20f9,_0x54da94))['catch'](handleError(_0x4b20f9,null));};exports['getHopperHistories']=function(_0x208c79,_0x113fb8,_0x497939){var _0x456210={'raw':!![],'where':{}};var _0x2922cf={};var _0x11c4d6={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x977a('0x61')]({'where':{'id':_0x208c79[_0x977a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x113fb8,null))[_0x977a('0x29')](function(_0x131066){if(_0x131066){_0x2922cf[_0x977a('0x38')]=_[_0x977a('0x39')](db['CmHopperHistory'][_0x977a('0x4e')]);_0x2922cf['query']=_[_0x977a('0x39')](_0x208c79[_0x977a('0x3b')]);_0x2922cf[_0x977a('0x3a')]=_['intersection'](_0x2922cf[_0x977a('0x38')],_0x2922cf['query']);_0x456210[_0x977a('0x3c')]=_[_0x977a('0x3d')](_0x2922cf['model'],qs[_0x977a('0x3e')](_0x208c79[_0x977a('0x3b')][_0x977a('0x3e')]));_0x456210[_0x977a('0x3c')]=_0x456210[_0x977a('0x3c')][_0x977a('0x4f')]?_0x456210['attributes']:_0x2922cf[_0x977a('0x38')];if(!_0x208c79[_0x977a('0x3b')][_0x977a('0x3f')](_0x977a('0x63'))){_0x456210[_0x977a('0x22')]=qs[_0x977a('0x22')](_0x208c79[_0x977a('0x3b')][_0x977a('0x22')]);_0x456210[_0x977a('0x21')]=qs[_0x977a('0x21')](_0x208c79[_0x977a('0x3b')][_0x977a('0x21')]);}_0x456210['order']=qs['sort'](_0x208c79[_0x977a('0x3b')][_0x977a('0x41')]);_0x456210[_0x977a('0x44')]=qs['filters'](_['pick'](_0x208c79['query'],_0x2922cf[_0x977a('0x3a')]));_0x456210['where'][_0x977a('0x64')]=_0x131066['id'];if(_0x208c79['query'][_0x977a('0x43')]){_0x456210[_0x977a('0x44')]=_[_0x977a('0x45')](_0x456210['where'],{'$or':_[_0x977a('0x2c')](_0x456210['attributes'],function(_0x38dcf1){var _0x3d2ee3={};_0x3d2ee3[_0x38dcf1]={'$like':'%'+_0x208c79['query'][_0x977a('0x43')]+'%'};return _0x3d2ee3;})});}_0x456210=_[_0x977a('0x45')]({},_0x456210,_0x208c79[_0x977a('0x47')]);return db[_0x977a('0x65')][_0x977a('0x23')]({'where':_0x456210[_0x977a('0x44')]})[_0x977a('0x29')](function(_0x2e1ff4){_0x11c4d6[_0x977a('0x23')]=_0x2e1ff4;if(_0x208c79[_0x977a('0x3b')][_0x977a('0x48')]){_0x456210[_0x977a('0x49')]=[{'all':!![]}];}return db[_0x977a('0x65')][_0x977a('0x4a')](_0x456210);})[_0x977a('0x29')](function(_0x5aa2d2){_0x11c4d6[_0x977a('0x4b')]=_0x5aa2d2;return _0x11c4d6;});}})['then'](respondWithFilteredResult(_0x113fb8,_0x456210))['catch'](handleError(_0x113fb8,null));};exports[_0x977a('0x66')]=function(_0x2ca9b3,_0x3d5b60,_0x13e8aa){var _0x595a49={'raw':!![],'where':{}};var _0x2c6431={};var _0x43ddb={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x977a('0x61')]({'where':{'id':_0x2ca9b3['params']['id']}})[_0x977a('0x29')](handleEntityNotFound(_0x3d5b60,null))[_0x977a('0x29')](function(_0x58c222){if(_0x58c222){_0x2c6431[_0x977a('0x38')]=_[_0x977a('0x39')](db[_0x977a('0x67')][_0x977a('0x4e')]);_0x2c6431[_0x977a('0x3b')]=_[_0x977a('0x39')](_0x2ca9b3[_0x977a('0x3b')]);_0x2c6431[_0x977a('0x3a')]=_[_0x977a('0x3d')](_0x2c6431[_0x977a('0x38')],_0x2c6431[_0x977a('0x3b')]);_0x595a49['attributes']=_[_0x977a('0x3d')](_0x2c6431['model'],qs[_0x977a('0x3e')](_0x2ca9b3[_0x977a('0x3b')][_0x977a('0x3e')]));_0x595a49[_0x977a('0x3c')]=_0x595a49[_0x977a('0x3c')][_0x977a('0x4f')]?_0x595a49[_0x977a('0x3c')]:_0x2c6431[_0x977a('0x38')];if(!_0x2ca9b3[_0x977a('0x3b')][_0x977a('0x3f')]('nolimit')){_0x595a49[_0x977a('0x22')]=qs[_0x977a('0x22')](_0x2ca9b3[_0x977a('0x3b')][_0x977a('0x22')]);_0x595a49[_0x977a('0x21')]=qs['offset'](_0x2ca9b3[_0x977a('0x3b')][_0x977a('0x21')]);}_0x595a49[_0x977a('0x40')]=qs[_0x977a('0x41')](_0x2ca9b3['query']['sort']);_0x595a49['where']=qs[_0x977a('0x3a')](_[_0x977a('0x42')](_0x2ca9b3[_0x977a('0x3b')],_0x2c6431[_0x977a('0x3a')]));_0x595a49['where']['VoiceQueueId']=_0x58c222['id'];if(_0x2ca9b3['query'][_0x977a('0x43')]){_0x595a49[_0x977a('0x44')]=_[_0x977a('0x45')](_0x595a49['where'],{'$or':_['map'](_0x595a49[_0x977a('0x3c')],function(_0x195b9f){var _0x133174={};_0x133174[_0x195b9f]={'$like':'%'+_0x2ca9b3[_0x977a('0x3b')]['filter']+'%'};return _0x133174;})});}_0x595a49=_[_0x977a('0x45')]({},_0x595a49,_0x2ca9b3[_0x977a('0x47')]);return db[_0x977a('0x67')]['count']({'where':_0x595a49[_0x977a('0x44')]})[_0x977a('0x29')](function(_0x5cc81f){_0x43ddb[_0x977a('0x23')]=_0x5cc81f;if(_0x2ca9b3[_0x977a('0x3b')]['includeAll']){_0x595a49[_0x977a('0x49')]=[{'all':!![]}];}return db[_0x977a('0x67')][_0x977a('0x4a')](_0x595a49);})['then'](function(_0x4eef3e){_0x43ddb[_0x977a('0x4b')]=_0x4eef3e;return _0x43ddb;});}})[_0x977a('0x29')](respondWithFilteredResult(_0x3d5b60,_0x595a49))['catch'](handleError(_0x3d5b60,null));};exports[_0x977a('0x68')]=function(_0x5984ce,_0x14b47a,_0x56570b){var _0xb82b06={'raw':!![],'where':{}};var _0x122f8d={};var _0x1e44e6={'count':0x0,'rows':[]};return db[_0x977a('0x35')][_0x977a('0x61')]({'where':{'id':_0x5984ce[_0x977a('0x5b')]['id']}})[_0x977a('0x29')](handleEntityNotFound(_0x14b47a,null))[_0x977a('0x29')](function(_0x5e50e3){if(_0x5e50e3){_0x122f8d[_0x977a('0x38')]=_[_0x977a('0x39')](db[_0x977a('0x69')][_0x977a('0x4e')]);_0x122f8d['query']=_[_0x977a('0x39')](_0x5984ce['query']);_0x122f8d[_0x977a('0x3a')]=_[_0x977a('0x3d')](_0x122f8d[_0x977a('0x38')],_0x122f8d[_0x977a('0x3b')]);_0xb82b06[_0x977a('0x3c')]=_[_0x977a('0x3d')](_0x122f8d['model'],qs[_0x977a('0x3e')](_0x5984ce['query'][_0x977a('0x3e')]));_0xb82b06['attributes']=_0xb82b06['attributes']['length']?_0xb82b06[_0x977a('0x3c')]:_0x122f8d['model'];if(!_0x5984ce[_0x977a('0x3b')]['hasOwnProperty'](_0x977a('0x63'))){_0xb82b06[_0x977a('0x22')]=qs['limit'](_0x5984ce[_0x977a('0x3b')]['limit']);_0xb82b06[_0x977a('0x21')]=qs['offset'](_0x5984ce[_0x977a('0x3b')][_0x977a('0x21')]);}_0xb82b06[_0x977a('0x40')]=qs[_0x977a('0x41')](_0x5984ce[_0x977a('0x3b')][_0x977a('0x41')]);_0xb82b06['where']=qs[_0x977a('0x3a')](_['pick'](_0x5984ce[_0x977a('0x3b')],_0x122f8d[_0x977a('0x3a')]));_0xb82b06[_0x977a('0x44')][_0x977a('0x64')]=_0x5e50e3['id'];if(_0x5984ce[_0x977a('0x3b')]['filter']){_0xb82b06[_0x977a('0x44')]=_[_0x977a('0x45')](_0xb82b06['where'],{'$or':_[_0x977a('0x2c')](_0xb82b06[_0x977a('0x3c')],function(_0x117ac0){var _0x3c6ac3={};_0x3c6ac3[_0x117ac0]={'$like':'%'+_0x5984ce[_0x977a('0x3b')][_0x977a('0x43')]+'%'};return _0x3c6ac3;})});}_0xb82b06=_[_0x977a('0x45')]({},_0xb82b06,_0x5984ce['options']);return db['CmHopperBlack'][_0x977a('0x23')]({'where':_0xb82b06[_0x977a('0x44')]})[_0x977a('0x29')](function(_0x9821e3){_0x1e44e6[_0x977a('0x23')]=_0x9821e3;if(_0x5984ce[_0x977a('0x3b')][_0x977a('0x48')]){_0xb82b06['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0x977a('0x4a')](_0xb82b06);})[_0x977a('0x29')](function(_0x175d27){_0x1e44e6[_0x977a('0x4b')]=_0x175d27;return _0x1e44e6;});}})[_0x977a('0x29')](respondWithFilteredResult(_0x14b47a,_0xb82b06))['catch'](handleError(_0x14b47a,null));};exports[_0x977a('0x6a')]=function(_0x1bd03b,_0x16fd0f,_0x5aa309){var _0x45b236={};var _0x49422b={};var _0x48d70a;var _0x28133f;return db[_0x977a('0x35')][_0x977a('0x61')]({'where':{'id':_0x1bd03b[_0x977a('0x5b')]['id']}})[_0x977a('0x29')](handleEntityNotFound(_0x16fd0f,null))[_0x977a('0x29')](function(_0x4e433b){if(_0x4e433b){_0x48d70a=_0x4e433b;_0x49422b[_0x977a('0x38')]=_[_0x977a('0x39')](db['Team'][_0x977a('0x4e')]);_0x49422b[_0x977a('0x3b')]=_[_0x977a('0x39')](_0x1bd03b[_0x977a('0x3b')]);_0x49422b[_0x977a('0x3a')]=_[_0x977a('0x3d')](_0x49422b[_0x977a('0x38')],_0x49422b[_0x977a('0x3b')]);_0x45b236[_0x977a('0x3c')]=_[_0x977a('0x3d')](_0x49422b['model'],qs['fields'](_0x1bd03b[_0x977a('0x3b')][_0x977a('0x3e')]));_0x45b236[_0x977a('0x3c')]=_0x45b236['attributes'][_0x977a('0x4f')]?_0x45b236[_0x977a('0x3c')]:_0x49422b[_0x977a('0x38')];_0x45b236[_0x977a('0x40')]=qs[_0x977a('0x41')](_0x1bd03b['query']['sort']);_0x45b236[_0x977a('0x44')]=qs[_0x977a('0x3a')](_['pick'](_0x1bd03b['query'],_0x49422b[_0x977a('0x3a')]));if(_0x1bd03b['query'][_0x977a('0x43')]){_0x45b236[_0x977a('0x44')]=_['merge'](_0x45b236[_0x977a('0x44')],{'$or':_[_0x977a('0x2c')](_0x45b236['attributes'],function(_0x18b983){var _0x17ceaf={};_0x17ceaf[_0x18b983]={'$like':'%'+_0x1bd03b['query'][_0x977a('0x43')]+'%'};return _0x17ceaf;})});}_0x45b236=_['merge']({},_0x45b236,_0x1bd03b[_0x977a('0x47')]);return _0x48d70a['getTeams'](_0x45b236);}})[_0x977a('0x29')](function(_0x1e8cb8){if(_0x1e8cb8){_0x28133f=_0x1e8cb8[_0x977a('0x4f')];if(!_0x1bd03b[_0x977a('0x3b')][_0x977a('0x3f')](_0x977a('0x63'))){_0x45b236[_0x977a('0x22')]=qs['limit'](_0x1bd03b[_0x977a('0x3b')][_0x977a('0x22')]);_0x45b236[_0x977a('0x21')]=qs[_0x977a('0x21')](_0x1bd03b[_0x977a('0x3b')]['offset']);}return _0x48d70a['getTeams'](_0x45b236);}})[_0x977a('0x29')](function(_0x5a9909){if(_0x5a9909){return _0x5a9909?{'count':_0x28133f,'rows':_0x5a9909}:null;}})[_0x977a('0x29')](respondWithResult(_0x16fd0f,null))[_0x977a('0x4c')](handleError(_0x16fd0f,null));};exports[_0x977a('0x6b')]=function(_0x4cb5a5,_0x7f1fd6,_0xf6b4ad){var _0x50be81=_0x4cb5a5[_0x977a('0x51')]['teams'];var _0xb15707=_['map'](_0x50be81,'id');return db[_0x977a('0x6c')][_0x977a('0x4a')]({'where':{'id':_0xb15707},'attributes':['id'],'include':[{'model':db[_0x977a('0x6d')],'as':_0x977a('0x6e'),'attributes':['id',_0x977a('0x30'),'online',_0x977a('0x6f'),_0x977a('0x70')],'raw':!![]}]})['then'](function(_0x11d451){if(_0x11d451){var _0x333db9=_['flatMap'](_0x11d451,function(_0x28dc7e){var _0x221665=_0x28dc7e[_0x977a('0x2a')]({'plain':!![]});_0x221665['Agents'][_0x977a('0x71')](function(_0x56cd5f){_0x56cd5f[_0x977a('0x72')]=_[_0x977a('0x2f')](_0x50be81,{'id':_0x221665['id']})['penalty'];});return _0x221665['Agents'];});return db['VoiceQueue']['find']({'where':{'id':_0x4cb5a5[_0x977a('0x5b')]['id']}})['then'](function(_0x413875){return db['sequelize'][_0x977a('0x73')](function(_0x5817a7){return _0x413875[_0x977a('0x6b')](_0xb15707,{'transaction':_0x5817a7})[_0x977a('0x29')](function(){return BPromise[_0x977a('0x74')](_0x50be81,function(_0x576d37){return db['TeamVoiceQueue']['upsert']({'TeamId':_0x576d37['id'],'VoiceQueueId':_0x4cb5a5['params']['id'],'penalty':_0x576d37[_0x977a('0x72')]},{'transaction':_0x5817a7});});})[_0x977a('0x29')](function(){return BPromise[_0x977a('0x74')](_0x333db9,function(_0x34a58d){return db[_0x977a('0x75')]['findOrCreate']({'where':{'UserId':_0x34a58d['id'],'VoiceQueueId':_0x4cb5a5[_0x977a('0x5b')]['id']},'defaults':{'penalty':_0x34a58d[_0x977a('0x72')]},'transaction':_0x5817a7});});})[_0x977a('0x29')](function(){return BPromise[_0x977a('0x74')](_[_0x977a('0x43')](_0x333db9,{'online':!![]}),function(_0xaead69){return db['UserVoiceQueueRt']['upsert']({'membername':_0xaead69[_0x977a('0x30')],'UserId':_0xaead69['id'],'queue_name':_0x413875[_0x977a('0x30')],'VoiceQueueId':_0x413875['id'],'interface':_[_0x977a('0x76')](_0xaead69['interface'])?util[_0x977a('0x77')](_0x977a('0x78'),_0xaead69[_0x977a('0x30')]):_0xaead69['interface'],'paused':_0xaead69[_0x977a('0x6f')]||![],'penalty':_0xaead69['penalty']},{'transaction':_0x5817a7});});})[_0x977a('0x29')](function(){_0x333db9['forEach'](function(_0x6c7a8){socket[_0x977a('0x79')](_0x977a('0x7a'),{'UserId':_0x6c7a8['id'],'VoiceQueueId':_0x413875['id']});});});});});}})[_0x977a('0x29')](respondWithStatusCode(_0x7f1fd6,null))['catch'](handleError(_0x7f1fd6,null));};exports['removeTeams']=function(_0x552858,_0x142816,_0x71d950){return db['Team'][_0x977a('0x4a')]({'where':{'id':_0x552858[_0x977a('0x3b')][_0x977a('0x7b')]},'attributes':['id'],'include':[{'model':db[_0x977a('0x6d')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x977a('0x29')](handleEntityNotFound(_0x142816,null))[_0x977a('0x29')](function(_0x2d8f0f){var _0x56fca5=_[_0x977a('0x2c')](_0x2d8f0f,'id');var _0x3870fd=[];var _0x55aacb=[];var _0xb557df=squel['select']();_0xb557df[_0x977a('0x7c')]('tq.TeamId')[_0x977a('0x7d')](_0x977a('0x7e'),'tq')[_0x977a('0x7f')](_0x977a('0x80'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x977a('0x81'),_0x552858[_0x977a('0x5b')]['id']);for(var _0x28d6a9=0x0;_0x28d6a9<_0x2d8f0f[_0x977a('0x4f')];_0x28d6a9+=0x1){let _0x30eda0=_0x2d8f0f[_0x28d6a9];for(var _0x4ab77d=0x0;_0x4ab77d<_0x30eda0[_0x977a('0x6e')][_0x977a('0x4f')];_0x4ab77d+=0x1){let _0xa48d9a=_0x30eda0[_0x977a('0x6e')][_0x4ab77d];var _0x5ad796=_0xb557df[_0x977a('0x82')]();_0x5ad796[_0x977a('0x44')](_0x977a('0x83'),_0xa48d9a['id']);_0x55aacb['push'](db[_0x977a('0x84')][_0x977a('0x3b')](_0x5ad796[_0x977a('0x85')](),{'type':db[_0x977a('0x84')]['QueryTypes'][_0x977a('0x86')]})['then'](function(_0x5129eb){if(_0x5129eb[_0x977a('0x4f')]===0x1){return _0xa48d9a['id'];}else{var _0x236375=_[_0x977a('0x87')](_[_0x977a('0x2c')](_0x5129eb,_0x977a('0x88')),function(_0x54a328){return _[_0x977a('0x89')](_0x56fca5,_0x54a328);});if(_0x236375){return _0xa48d9a['id'];}}}));}}return BPromise[_0x977a('0x8a')](_0x55aacb)[_0x977a('0x29')](function(_0x39e76a){_0x3870fd=_(_0x3870fd)['union'](_0x39e76a)[_0x977a('0x8b')]()[_0x977a('0x2d')]();return db['VoiceQueue'][_0x977a('0x2f')]({'where':{'id':_0x552858[_0x977a('0x5b')]['id']}})[_0x977a('0x29')](function(_0x1b1c2a){return db[_0x977a('0x84')][_0x977a('0x73')](function(_0x4beaa5){return _0x1b1c2a[_0x977a('0x8c')](_0x552858[_0x977a('0x3b')][_0x977a('0x7b')],{'transaction':_0x4beaa5})[_0x977a('0x29')](function(){if(!_['isEmpty'](_0x3870fd)){return _0x1b1c2a[_0x977a('0x8d')](_0x3870fd,{'transaction':_0x4beaa5})[_0x977a('0x29')](function(){return db[_0x977a('0x8e')][_0x977a('0x32')]({'where':{'VoiceQueueId':_0x552858[_0x977a('0x5b')]['id'],'UserId':_0x3870fd},'transaction':_0x4beaa5});});}})[_0x977a('0x29')](function(){_0x3870fd['forEach'](function(_0x55f2eb){socket[_0x977a('0x79')]('userVoiceQueue:remove',{'UserId':_0x55f2eb,'VoiceQueueId':_0x1b1c2a['id']});});});});});});})[_0x977a('0x29')](respondWithStatusCode(_0x142816,null))[_0x977a('0x4c')](handleError(_0x142816,null));};exports[_0x977a('0x8f')]=function(_0x258de3,_0x3adf7c,_0x5a56b2){var _0x126930,_0x334aab;return db[_0x977a('0x35')]['find']({'where':{'id':_0x258de3['params']['id']}})[_0x977a('0x29')](handleEntityNotFound(_0x3adf7c,null))[_0x977a('0x29')](function(_0x375474){if(_0x375474){_0x334aab=_0x375474;return _0x375474[_0x977a('0x8f')](_0x258de3[_0x977a('0x51')][_0x977a('0x7b')],_[_0x977a('0x90')](_0x258de3[_0x977a('0x51')],['ids','id'])||{})['spread'](function(_0x23c932){for(var _0x436ae3=0x0;_0x436ae3<_0x258de3[_0x977a('0x51')][_0x977a('0x7b')][_0x977a('0x4f')];_0x436ae3+=0x1){socket['emit'](_0x977a('0x7a'),{'UserId':Number(_0x258de3['body'][_0x977a('0x7b')][_0x436ae3]),'VoiceQueueId':Number(_0x258de3[_0x977a('0x5b')]['id'])});}return _0x23c932;});}})[_0x977a('0x29')](function(_0x2324e2){_0x126930=_0x2324e2||[];if(_0x334aab){return db[_0x977a('0x6d')][_0x977a('0x4a')]({'where':{'id':_0x258de3[_0x977a('0x51')]['ids']},'attributes':['id',_0x977a('0x30'),_0x977a('0x91'),_0x977a('0x6f'),_0x977a('0x70')],'raw':!![]});}})[_0x977a('0x29')](function(_0x4b3acb){if(!_[_0x977a('0x92')](_0x4b3acb)){var _0x1ab1b3=[];for(var _0x51bb88=0x0;_0x51bb88<_0x4b3acb[_0x977a('0x4f')];_0x51bb88++){if(_0x4b3acb[_0x51bb88][_0x977a('0x91')]){_0x1ab1b3[_0x977a('0x93')](db[_0x977a('0x8e')]['upsert']({'membername':_0x4b3acb[_0x51bb88][_0x977a('0x30')],'UserId':_0x4b3acb[_0x51bb88]['id'],'queue_name':_0x334aab[_0x977a('0x30')],'VoiceQueueId':_0x334aab['id'],'interface':_[_0x977a('0x76')](_0x4b3acb[_0x51bb88]['interface'])?util[_0x977a('0x77')](_0x977a('0x78'),_0x4b3acb[_0x51bb88]['name']):_0x4b3acb[_0x51bb88][_0x977a('0x70')],'paused':_0x4b3acb[_0x51bb88]['voicePause']||![],'penalty':_0x258de3['body'][_0x977a('0x72')]||0x0}));}}return BPromise['all'](_0x1ab1b3);}})[_0x977a('0x29')](function(){return _0x126930;})[_0x977a('0x29')](respondWithResult(_0x3adf7c,null))[_0x977a('0x4c')](handleError(_0x3adf7c,null));};exports['removeAgents']=function(_0x46eb7d,_0x214e88,_0x20447b){return db[_0x977a('0x35')][_0x977a('0x2f')]({'where':{'id':_0x46eb7d['params']['id']}})['then'](handleEntityNotFound(_0x214e88,null))[_0x977a('0x29')](function(_0x5a26d7){if(_0x5a26d7){return _0x5a26d7[_0x977a('0x8d')](_0x46eb7d[_0x977a('0x3b')][_0x977a('0x7b')])[_0x977a('0x29')](function(){if(_[_0x977a('0x94')](_0x46eb7d[_0x977a('0x3b')]['ids'])){for(var _0x247c4c=0x0;_0x247c4c<_0x46eb7d[_0x977a('0x3b')][_0x977a('0x7b')][_0x977a('0x4f')];_0x247c4c+=0x1){socket[_0x977a('0x79')](_0x977a('0x95'),{'UserId':Number(_0x46eb7d['query'][_0x977a('0x7b')][_0x247c4c]),'VoiceQueueId':Number(_0x46eb7d[_0x977a('0x5b')]['id'])});}}else{socket[_0x977a('0x79')](_0x977a('0x95'),{'UserId':Number(_0x46eb7d[_0x977a('0x3b')][_0x977a('0x7b')]),'VoiceQueueId':Number(_0x46eb7d['params']['id'])});}});}})[_0x977a('0x29')](function(_0x2ae45b){return db[_0x977a('0x8e')][_0x977a('0x32')]({'where':{'VoiceQueueId':_0x46eb7d[_0x977a('0x5b')]['id'],'UserId':_0x46eb7d[_0x977a('0x3b')][_0x977a('0x7b')]}})[_0x977a('0x29')](function(){return _0x2ae45b;});})[_0x977a('0x29')](respondWithStatusCode(_0x214e88,null))[_0x977a('0x4c')](handleError(_0x214e88,null));};exports[_0x977a('0x96')]=function(_0x32407a,_0x89b5fb,_0x344041){var _0x519aaf={};var _0x8345d1={};var _0x2297f6;var _0x3e65da;return db[_0x977a('0x35')][_0x977a('0x61')]({'where':{'id':_0x32407a[_0x977a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x89b5fb,null))[_0x977a('0x29')](function(_0x4c6c91){if(_0x4c6c91){_0x2297f6=_0x4c6c91;_0x8345d1[_0x977a('0x38')]=_[_0x977a('0x39')](db[_0x977a('0x6d')][_0x977a('0x4e')]);_0x8345d1[_0x977a('0x3b')]=_[_0x977a('0x39')](_0x32407a[_0x977a('0x3b')]);_0x8345d1[_0x977a('0x3a')]=_[_0x977a('0x3d')](_0x8345d1['model'],_0x8345d1[_0x977a('0x3b')]);_0x519aaf['attributes']=_[_0x977a('0x3d')](_0x8345d1[_0x977a('0x38')],qs[_0x977a('0x3e')](_0x32407a[_0x977a('0x3b')]['fields']));_0x519aaf[_0x977a('0x3c')]=_0x519aaf[_0x977a('0x3c')][_0x977a('0x4f')]?_0x519aaf[_0x977a('0x3c')]:_0x8345d1[_0x977a('0x38')];_0x519aaf[_0x977a('0x40')]=qs[_0x977a('0x41')](_0x32407a[_0x977a('0x3b')][_0x977a('0x41')]);_0x519aaf[_0x977a('0x44')]=qs[_0x977a('0x3a')](_['pick'](_0x32407a['query'],_0x8345d1[_0x977a('0x3a')]));if(_0x32407a[_0x977a('0x3b')][_0x977a('0x43')]){_0x519aaf['where']=_['merge'](_0x519aaf[_0x977a('0x44')],{'$or':_[_0x977a('0x2c')](_0x519aaf[_0x977a('0x3c')],function(_0xf67faf){var _0x12e7a8={};_0x12e7a8[_0xf67faf]={'$like':'%'+_0x32407a[_0x977a('0x3b')]['filter']+'%'};return _0x12e7a8;})});}_0x519aaf=_[_0x977a('0x45')]({},_0x519aaf,_0x32407a[_0x977a('0x47')]);return _0x2297f6[_0x977a('0x96')](_0x519aaf);}})[_0x977a('0x29')](function(_0x191f3c){if(_0x191f3c){_0x3e65da=_0x191f3c['length'];if(!_0x32407a[_0x977a('0x3b')][_0x977a('0x3f')](_0x977a('0x63'))){_0x519aaf['limit']=qs[_0x977a('0x22')](_0x32407a[_0x977a('0x3b')][_0x977a('0x22')]);_0x519aaf[_0x977a('0x21')]=qs[_0x977a('0x21')](_0x32407a[_0x977a('0x3b')][_0x977a('0x21')]);}return _0x2297f6[_0x977a('0x96')](_0x519aaf);}})[_0x977a('0x29')](function(_0x516561){if(_0x516561){return _0x516561?{'count':_0x3e65da,'rows':_0x516561}:null;}})['then'](respondWithResult(_0x89b5fb,null))[_0x977a('0x4c')](handleError(_0x89b5fb,null));};exports[_0x977a('0x97')]=function(_0x490319,_0x59d69c,_0x13533f){var _0x1c9848={};var _0x20e090={};var _0x39f334;var _0x3a253f;return db[_0x977a('0x35')][_0x977a('0x61')]({'where':{'id':_0x490319['params']['id']}})[_0x977a('0x29')](handleEntityNotFound(_0x59d69c,null))[_0x977a('0x29')](function(_0x4baf50){if(_0x4baf50){_0x39f334=_0x4baf50;_0x20e090[_0x977a('0x38')]=_[_0x977a('0x39')](db[_0x977a('0x8e')][_0x977a('0x4e')]);_0x20e090[_0x977a('0x3b')]=_[_0x977a('0x39')](_0x490319[_0x977a('0x3b')]);_0x20e090[_0x977a('0x3a')]=_[_0x977a('0x3d')](_0x20e090['model'],_0x20e090[_0x977a('0x3b')]);_0x1c9848[_0x977a('0x3c')]=_['intersection'](_0x20e090[_0x977a('0x38')],qs['fields'](_0x490319[_0x977a('0x3b')][_0x977a('0x3e')]));_0x1c9848[_0x977a('0x3c')]=_0x1c9848[_0x977a('0x3c')][_0x977a('0x4f')]?_0x1c9848[_0x977a('0x3c')]:_0x20e090[_0x977a('0x38')];_0x1c9848[_0x977a('0x40')]=qs[_0x977a('0x41')](_0x490319[_0x977a('0x3b')][_0x977a('0x41')]);_0x1c9848[_0x977a('0x44')]=qs['filters'](_[_0x977a('0x42')](_0x490319[_0x977a('0x3b')],_0x20e090[_0x977a('0x3a')]));if(_0x490319[_0x977a('0x3b')][_0x977a('0x43')]){_0x1c9848[_0x977a('0x44')]=_[_0x977a('0x45')](_0x1c9848['where'],{'$or':_[_0x977a('0x2c')](_0x1c9848[_0x977a('0x3c')],function(_0x33da61){var _0x470d81={};_0x470d81[_0x33da61]={'$like':'%'+_0x490319[_0x977a('0x3b')][_0x977a('0x43')]+'%'};return _0x470d81;})});}_0x1c9848=_['merge']({},_0x1c9848,_0x490319[_0x977a('0x47')]);return _0x39f334['getMembers'](_0x1c9848);}})[_0x977a('0x29')](function(_0x19f722){if(_0x19f722){_0x3a253f=_0x19f722[_0x977a('0x4f')];if(!_0x490319[_0x977a('0x3b')][_0x977a('0x3f')](_0x977a('0x63'))){_0x1c9848[_0x977a('0x22')]=qs[_0x977a('0x22')](_0x490319[_0x977a('0x3b')][_0x977a('0x22')]);_0x1c9848[_0x977a('0x21')]=qs[_0x977a('0x21')](_0x490319[_0x977a('0x3b')][_0x977a('0x21')]);}return _0x39f334[_0x977a('0x97')](_0x1c9848);}})['then'](function(_0x4207b1){return _0x4207b1?{'count':_0x3a253f,'rows':_0x4207b1}:null;})[_0x977a('0x29')](respondWithResult(_0x59d69c,null))[_0x977a('0x4c')](handleError(_0x59d69c,null));};exports[_0x977a('0x98')]=function(_0x108cde,_0x305fe7,_0x22a727){var _0x40cb76={};var _0x24e4dd={};var _0x55213f;var _0x2b6c35;return db[_0x977a('0x35')][_0x977a('0x61')]({'where':{'id':_0x108cde[_0x977a('0x5b')]['id']}})[_0x977a('0x29')](handleEntityNotFound(_0x305fe7,null))[_0x977a('0x29')](function(_0x2f747e){if(_0x2f747e){_0x55213f=_0x2f747e;_0x24e4dd[_0x977a('0x38')]=_[_0x977a('0x39')](db[_0x977a('0x99')][_0x977a('0x4e')]);_0x24e4dd[_0x977a('0x3b')]=_[_0x977a('0x39')](_0x108cde[_0x977a('0x3b')]);_0x24e4dd[_0x977a('0x3a')]=_[_0x977a('0x3d')](_0x24e4dd[_0x977a('0x38')],_0x24e4dd[_0x977a('0x3b')]);_0x40cb76['attributes']=_[_0x977a('0x3d')](_0x24e4dd[_0x977a('0x38')],qs[_0x977a('0x3e')](_0x108cde[_0x977a('0x3b')][_0x977a('0x3e')]));_0x40cb76[_0x977a('0x3c')]=_0x40cb76[_0x977a('0x3c')][_0x977a('0x4f')]?_0x40cb76[_0x977a('0x3c')]:_0x24e4dd[_0x977a('0x38')];_0x40cb76[_0x977a('0x40')]=qs['sort'](_0x108cde[_0x977a('0x3b')][_0x977a('0x41')]);_0x40cb76[_0x977a('0x44')]=qs[_0x977a('0x3a')](_['pick'](_0x108cde[_0x977a('0x3b')],_0x24e4dd[_0x977a('0x3a')]));if(_0x108cde[_0x977a('0x3b')][_0x977a('0x43')]){_0x40cb76[_0x977a('0x44')]=_['merge'](_0x40cb76[_0x977a('0x44')],{'$or':_[_0x977a('0x2c')](_0x40cb76[_0x977a('0x3c')],function(_0x59e60f){var _0x4d8764={};_0x4d8764[_0x59e60f]={'$like':'%'+_0x108cde[_0x977a('0x3b')][_0x977a('0x43')]+'%'};return _0x4d8764;})});}_0x40cb76=_[_0x977a('0x45')]({},_0x40cb76,_0x108cde[_0x977a('0x47')]);return _0x55213f[_0x977a('0x98')](_0x40cb76);}})[_0x977a('0x29')](function(_0x266a95){if(_0x266a95){_0x2b6c35=_0x266a95[_0x977a('0x4f')];if(!_0x108cde[_0x977a('0x3b')]['hasOwnProperty'](_0x977a('0x63'))){_0x40cb76[_0x977a('0x22')]=qs[_0x977a('0x22')](_0x108cde[_0x977a('0x3b')]['limit']);_0x40cb76[_0x977a('0x21')]=qs['offset'](_0x108cde[_0x977a('0x3b')][_0x977a('0x21')]);}return _0x55213f[_0x977a('0x98')](_0x40cb76);}})[_0x977a('0x29')](function(_0x1ffff4){if(_0x1ffff4){return _0x1ffff4?{'count':_0x2b6c35,'rows':_0x1ffff4}:null;}})[_0x977a('0x29')](respondWithResult(_0x305fe7,null))[_0x977a('0x4c')](handleError(_0x305fe7,null));};exports[_0x977a('0x9a')]=function(_0x1b684b,_0x3dceb7,_0x51fc4c){var _0x242cf2=moment()[_0x977a('0x77')](_0x977a('0x9b'));var _0x583836,_0x1e6287;return db[_0x977a('0x35')][_0x977a('0x2f')]({'where':{'id':_0x1b684b[_0x977a('0x5b')]['id']}})[_0x977a('0x29')](handleEntityNotFound(_0x3dceb7,null))[_0x977a('0x29')](function(_0x3d09ec){if(_0x3d09ec){_0x1e6287=_0x3d09ec;return _0x3d09ec[_0x977a('0x9a')](_0x1b684b['body'][_0x977a('0x7b')],_['omit'](_0x1b684b[_0x977a('0x51')],[_0x977a('0x7b'),'id'])||{});}return null;})[_0x977a('0x9c')](function(_0x4cef22){var _0x1cb8f6;_0x583836=_0x4cef22||[];var _0x3116e5=[];if(_0x4cef22){for(var _0x1776a3=0x0;_0x1776a3<_0x4cef22[_0x977a('0x4f')];_0x1776a3+=0x1){var _0x31223f=_0x4cef22[_0x1776a3][_0x977a('0x2a')]({'plain':!![]});_0x1e6287['dialCheckDuplicateType']=_0x1b684b[_0x977a('0x51')][_0x977a('0x9d')]?_0x1b684b['body']['dialCheckDuplicateType']:_0x1e6287[_0x977a('0x9d')];switch(_0x1e6287['dialCheckDuplicateType']){case'always':_0x1cb8f6=squel[_0x977a('0x9e')]()[_0x977a('0x9f')](_0x977a('0xa0'))[_0x977a('0xa1')]([_0x977a('0xa2'),_0x977a('0xa3'),_0x977a('0xa4'),'ListId','VoiceQueueId','createdAt','updatedAt'],squel[_0x977a('0xa5')]()[_0x977a('0x7c')]('phone','phone')['field']('\x27'+_0x242cf2+'\x27','scheduledAt')[_0x977a('0x7c')]('id',_0x977a('0xa4'))[_0x977a('0x7c')](_0x31223f[_0x977a('0xa6')][_0x977a('0x85')](),_0x977a('0xa7'))[_0x977a('0x7c')](_0x1b684b[_0x977a('0x5b')]['id']['toString'](),_0x977a('0x64'))['field']('\x27'+_0x242cf2+'\x27','createdAt')[_0x977a('0x7c')]('\x27'+_0x242cf2+'\x27','updatedAt')[_0x977a('0x7d')]('cm_contacts')['where'](_0x977a('0xa8'))['where'](_0x977a('0xa9'),_0x31223f[_0x977a('0xa6')][_0x977a('0x85')]())['where'](_0x977a('0xaa'))[_0x977a('0x44')](_0x977a('0xab'),squel[_0x977a('0xa5')]()[_0x977a('0x7c')](_0x977a('0xac'))[_0x977a('0x7d')]('cm_hopper_final')[_0x977a('0x44')](_0x977a('0x81'),_0x1b684b[_0x977a('0x5b')]['id'][_0x977a('0x85')]()))[_0x977a('0x44')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x977a('0x7c')](_0x977a('0xad'))[_0x977a('0x7d')](_0x977a('0xa0'))[_0x977a('0x44')](_0x977a('0x81'),_0x1b684b[_0x977a('0x5b')]['id'][_0x977a('0x85')]())))[_0x977a('0x85')]();break;case _0x977a('0xae'):_0x1cb8f6=squel[_0x977a('0x9e')]()[_0x977a('0x9f')](_0x977a('0xa0'))[_0x977a('0xa1')]([_0x977a('0xa2'),'scheduledAt','ContactId',_0x977a('0xa7'),'VoiceQueueId','createdAt',_0x977a('0x5d')],squel[_0x977a('0xa5')]()[_0x977a('0x7c')]('phone',_0x977a('0xa2'))[_0x977a('0x7c')]('\x27'+_0x242cf2+'\x27',_0x977a('0xa3'))[_0x977a('0x7c')]('id',_0x977a('0xa4'))['field'](_0x31223f['CmListId'][_0x977a('0x85')](),_0x977a('0xa7'))[_0x977a('0x7c')](_0x1b684b['params']['id'][_0x977a('0x85')](),'VoiceQueueId')[_0x977a('0x7c')]('\x27'+_0x242cf2+'\x27',_0x977a('0x5c'))[_0x977a('0x7c')]('\x27'+_0x242cf2+'\x27',_0x977a('0x5d'))[_0x977a('0x7d')](_0x977a('0xaf'))[_0x977a('0x44')](_0x977a('0xa8'))['where'](_0x977a('0xa9'),_0x31223f['CmListId'][_0x977a('0x85')]())[_0x977a('0x44')](_0x977a('0xaa'))[_0x977a('0x44')](_0x977a('0xab'),squel['select']()[_0x977a('0x7c')]('COALESCE(phone,\x27\x27)')['from'](_0x977a('0xa0'))[_0x977a('0x44')](_0x977a('0x81'),_0x1b684b[_0x977a('0x5b')]['id'][_0x977a('0x85')]())))['toString']();break;default:_0x1cb8f6=squel[_0x977a('0x9e')]()[_0x977a('0x9f')]('cm_hopper')[_0x977a('0xa1')]([_0x977a('0xa2'),'scheduledAt',_0x977a('0xa4'),_0x977a('0xa7'),_0x977a('0x64'),_0x977a('0x5c'),_0x977a('0x5d')],squel['select']()[_0x977a('0x7c')](_0x977a('0xa2'),_0x977a('0xa2'))[_0x977a('0x7c')]('\x27'+_0x242cf2+'\x27','scheduledAt')[_0x977a('0x7c')]('id',_0x977a('0xa4'))[_0x977a('0x7c')](_0x31223f[_0x977a('0xa6')][_0x977a('0x85')](),'ListId')[_0x977a('0x7c')](_0x1b684b[_0x977a('0x5b')]['id'][_0x977a('0x85')](),_0x977a('0x64'))['field']('\x27'+_0x242cf2+'\x27',_0x977a('0x5c'))[_0x977a('0x7c')]('\x27'+_0x242cf2+'\x27',_0x977a('0x5d'))[_0x977a('0x7d')](_0x977a('0xaf'))[_0x977a('0x44')]('deletedAt\x20IS\x20NULL')[_0x977a('0x44')](_0x977a('0xa9'),_0x31223f[_0x977a('0xa6')]['toString']())['where'](_0x977a('0xaa')))[_0x977a('0x85')]();}_0x3116e5[_0x977a('0x93')](db[_0x977a('0x84')]['query'](_0x1cb8f6));}return BPromise[_0x977a('0x8a')](_0x3116e5);}})[_0x977a('0x29')](function(){var _0x4bbc35=[];var _0x3463d7=squel[_0x977a('0x9e')]()[_0x977a('0x9f')](_0x977a('0xb0'))[_0x977a('0xa1')]([_0x977a('0xb1'),_0x977a('0xa2'),_0x977a('0xb2'),_0x977a('0x5c'),_0x977a('0x5d')],squel['select']()['field'](_0x977a('0xb3'))[_0x977a('0x7c')]('ci.item')[_0x977a('0x7c')]('ci.OrderBy+1')['field']('\x27'+_0x242cf2+'\x27',_0x977a('0x5c'))[_0x977a('0x7c')]('\x27'+_0x242cf2+'\x27',_0x977a('0x5d'))[_0x977a('0x7d')](_0x977a('0xb4'),'ci')[_0x977a('0x7f')]('cm_hopper','h',_0x977a('0xb5'))[_0x977a('0x44')]('h.scheduledat=?',_0x242cf2)[_0x977a('0x44')]('ci.ItemClass=?',_0x977a('0xb6')))[_0x977a('0x85')]();_0x4bbc35[_0x977a('0x93')](db[_0x977a('0x84')]['query'](_0x3463d7));return BPromise[_0x977a('0x8a')](_0x4bbc35);})[_0x977a('0x29')](function(){return _0x583836;})['then'](respondWithResult(_0x3dceb7,null))[_0x977a('0x4c')](handleError(_0x3dceb7,null));};exports[_0x977a('0xb7')]=function(_0x255cf,_0x42039a,_0x2ecb97){return db[_0x977a('0x35')]['find']({'where':{'id':_0x255cf[_0x977a('0x5b')]['id']}})[_0x977a('0x29')](handleEntityNotFound(_0x42039a,null))[_0x977a('0x29')](function(_0x3b17ce){if(_0x3b17ce){return _0x3b17ce[_0x977a('0xb7')](_0x255cf[_0x977a('0x3b')][_0x977a('0x7b')]);}})[_0x977a('0x29')](function(_0x2d4f9a){if(_0x2d4f9a){return db[_0x977a('0x62')][_0x977a('0x32')]({'where':{'ListId':_0x255cf[_0x977a('0x3b')][_0x977a('0x7b')],'VoiceQueueId':_0x255cf['params']['id']}})[_0x977a('0x29')](function(){return _0x2d4f9a;});}})[_0x977a('0x29')](respondWithStatusCode(_0x42039a,null))['catch'](handleError(_0x42039a,null));};exports[_0x977a('0xb8')]=function(_0x5d0335,_0x1abe60,_0x3ae15e){var _0x1f8d9e={};var _0x5824b2={};var _0x8cd4dc;var _0x103cf5;return db[_0x977a('0x35')]['findOne']({'where':{'id':_0x5d0335[_0x977a('0x5b')]['id']}})[_0x977a('0x29')](handleEntityNotFound(_0x1abe60,null))[_0x977a('0x29')](function(_0xed4f2){if(_0xed4f2){_0x8cd4dc=_0xed4f2;_0x5824b2[_0x977a('0x38')]=_[_0x977a('0x39')](db[_0x977a('0x99')][_0x977a('0x4e')]);_0x5824b2[_0x977a('0x3b')]=_[_0x977a('0x39')](_0x5d0335[_0x977a('0x3b')]);_0x5824b2['filters']=_[_0x977a('0x3d')](_0x5824b2[_0x977a('0x38')],_0x5824b2[_0x977a('0x3b')]);_0x1f8d9e['attributes']=_[_0x977a('0x3d')](_0x5824b2[_0x977a('0x38')],qs['fields'](_0x5d0335['query'][_0x977a('0x3e')]));_0x1f8d9e['attributes']=_0x1f8d9e[_0x977a('0x3c')][_0x977a('0x4f')]?_0x1f8d9e[_0x977a('0x3c')]:_0x5824b2['model'];_0x1f8d9e[_0x977a('0x40')]=qs[_0x977a('0x41')](_0x5d0335[_0x977a('0x3b')][_0x977a('0x41')]);_0x1f8d9e['where']=qs[_0x977a('0x3a')](_[_0x977a('0x42')](_0x5d0335['query'],_0x5824b2['filters']));if(_0x5d0335[_0x977a('0x3b')][_0x977a('0x43')]){_0x1f8d9e[_0x977a('0x44')]=_['merge'](_0x1f8d9e[_0x977a('0x44')],{'$or':_['map'](_0x1f8d9e[_0x977a('0x3c')],function(_0x11cb01){var _0xf1a33={};_0xf1a33[_0x11cb01]={'$like':'%'+_0x5d0335['query']['filter']+'%'};return _0xf1a33;})});}_0x1f8d9e=_[_0x977a('0x45')]({},_0x1f8d9e,_0x5d0335['options']);return _0x8cd4dc[_0x977a('0xb8')](_0x1f8d9e);}})[_0x977a('0x29')](function(_0x500ae4){if(_0x500ae4){_0x103cf5=_0x500ae4[_0x977a('0x4f')];if(!_0x5d0335['query'][_0x977a('0x3f')](_0x977a('0x63'))){_0x1f8d9e[_0x977a('0x22')]=qs[_0x977a('0x22')](_0x5d0335[_0x977a('0x3b')][_0x977a('0x22')]);_0x1f8d9e[_0x977a('0x21')]=qs[_0x977a('0x21')](_0x5d0335[_0x977a('0x3b')][_0x977a('0x21')]);}return _0x8cd4dc[_0x977a('0xb8')](_0x1f8d9e);}})[_0x977a('0x29')](function(_0x7d0d27){if(_0x7d0d27){return _0x7d0d27?{'count':_0x103cf5,'rows':_0x7d0d27}:null;}})[_0x977a('0x29')](respondWithResult(_0x1abe60,null))[_0x977a('0x4c')](handleError(_0x1abe60,null));};exports['addBlackLists']=function(_0x4b0083,_0x250b00,_0x871e34){var _0x120474,_0x42b306;return db[_0x977a('0x35')][_0x977a('0x2f')]({'where':{'id':_0x4b0083[_0x977a('0x5b')]['id']}})[_0x977a('0x29')](handleEntityNotFound(_0x250b00,null))['then'](function(_0x4334e3){if(_0x4334e3){_0x42b306=_0x4334e3;return _0x4334e3['addBlackLists'](_0x4b0083[_0x977a('0x51')][_0x977a('0x7b')],_['omit'](_0x4b0083[_0x977a('0x51')],[_0x977a('0x7b'),'id'])||{});}return null;})[_0x977a('0x9c')](function(_0x17af70){var _0x5c61b5;_0x120474=_0x17af70||[];var _0xfd598b=[];if(_0x17af70){for(var _0x486b88=0x0;_0x486b88<_0x17af70[_0x977a('0x4f')];_0x486b88+=0x1){var _0x3b92ae=_0x17af70[_0x486b88][_0x977a('0x2a')]({'plain':!![]});_0x5c61b5=squel[_0x977a('0x9e')]()['into'](_0x977a('0xb9'))['fromQuery']([_0x977a('0xa2'),_0x977a('0xa4'),_0x977a('0xa7'),_0x977a('0x64'),'createdAt',_0x977a('0x5d')],squel['select']()[_0x977a('0x7c')]('phone',_0x977a('0xa2'))[_0x977a('0x7c')]('id','ContactId')[_0x977a('0x7c')](_0x3b92ae[_0x977a('0xa6')]['toString'](),_0x977a('0xa7'))[_0x977a('0x7c')](_0x4b0083[_0x977a('0x5b')]['id']['toString'](),_0x977a('0x64'))[_0x977a('0x7c')](_0x977a('0xba'),'createdAt')[_0x977a('0x7c')](_0x977a('0xba'),_0x977a('0x5d'))[_0x977a('0x7d')](_0x977a('0xaf'))['where']('deletedAt\x20IS\x20NULL')[_0x977a('0x44')](_0x977a('0xa9'),_0x3b92ae[_0x977a('0xa6')][_0x977a('0x85')]())[_0x977a('0x44')](_0x977a('0xaa')))['toString']();_0xfd598b[_0x977a('0x93')](db[_0x977a('0x84')][_0x977a('0x3b')](_0x5c61b5));}return BPromise[_0x977a('0x8a')](_0xfd598b);}})[_0x977a('0x29')](function(){return _0x120474;})['then'](respondWithResult(_0x250b00,null))[_0x977a('0x4c')](handleError(_0x250b00,null));};exports['removeBlackLists']=function(_0x132698,_0x2b0d25,_0x53d82f){return db['VoiceQueue']['find']({'where':{'id':_0x132698[_0x977a('0x5b')]['id']}})[_0x977a('0x29')](handleEntityNotFound(_0x2b0d25,null))['then'](function(_0xcc2257){if(_0xcc2257){return _0xcc2257[_0x977a('0xbb')](_0x132698[_0x977a('0x3b')][_0x977a('0x7b')]);}})[_0x977a('0x29')](function(_0x5e8e12){if(_0x5e8e12){return db['CmHopperBlack'][_0x977a('0x32')]({'where':{'ListId':_0x132698[_0x977a('0x3b')]['ids'],'VoiceQueueId':_0x132698[_0x977a('0x5b')]['id']}})[_0x977a('0x29')](function(){return _0x5e8e12;});}})[_0x977a('0x29')](respondWithStatusCode(_0x2b0d25,null))[_0x977a('0x4c')](handleError(_0x2b0d25,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 3c48a72..26bc8b6 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 _0x192d=['VoiceQueue','setMaxListeners','save','update','remove','hasOwnProperty','events','../../mysqldb'];(function(_0xdbec07,_0x3555fc){var _0xf91f57=function(_0x1047ab){while(--_0x1047ab){_0xdbec07['push'](_0xdbec07['shift']());}};_0xf91f57(++_0x3555fc);}(_0x192d,0xf6));var _0xd192=function(_0x567b30,_0x496e2a){_0x567b30=_0x567b30-0x0;var _0x29f809=_0x192d[_0x567b30];return _0x29f809;};'use strict';var EventEmitter=require(_0xd192('0x0'));var VoiceQueue=require(_0xd192('0x1'))['db'][_0xd192('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xd192('0x3')](0x0);var events={'afterCreate':_0xd192('0x4'),'afterUpdate':_0xd192('0x5'),'afterDestroy':_0xd192('0x6')};function emitEvent(_0x81dcb1){return function(_0x5f5c3b,_0x8ec796,_0x2d36e2){VoiceQueueEvents['emit'](_0x81dcb1+':'+_0x5f5c3b['id'],_0x5f5c3b);VoiceQueueEvents['emit'](_0x81dcb1,_0x5f5c3b);_0x2d36e2(null);};}for(var e in events){if(events[_0xd192('0x7')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0x30e6=['exports','events','VoiceQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x37e3a0,_0x1cf2c9){var _0x15c76b=function(_0x558e82){while(--_0x558e82){_0x37e3a0['push'](_0x37e3a0['shift']());}};_0x15c76b(++_0x1cf2c9);}(_0x30e6,0xdd));var _0x630e=function(_0x140ac5,_0x1aedfa){_0x140ac5=_0x140ac5-0x0;var _0x49c87d=_0x30e6[_0x140ac5];return _0x49c87d;};'use strict';var EventEmitter=require(_0x630e('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x630e('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x630e('0x2')](0x0);var events={'afterCreate':_0x630e('0x3'),'afterUpdate':_0x630e('0x4'),'afterDestroy':_0x630e('0x5')};function emitEvent(_0xd6959d){return function(_0x173f89,_0x1b065b,_0x41e92c){VoiceQueueEvents[_0x630e('0x6')](_0xd6959d+':'+_0x173f89['id'],_0x173f89);VoiceQueueEvents['emit'](_0xd6959d,_0x173f89);_0x41e92c(null);};}for(var e in events){if(events[_0x630e('0x7')](e)){var event=events[e];VoiceQueue[_0x630e('0x8')](e,emitEvent(event));}}module[_0x630e('0x9')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 59170e6..945a33b 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(_0x2a2716,_0x2ea282){var _0xd93616=function(_0x5b9a81){while(--_0x5b9a81){_0x2a2716['push'](_0x2a2716['shift']());}};_0xd93616(++_0x2ea282);}(_0xedd9,0xfc));var _0x9edd=function(_0x352401,_0x5c29d3){_0x352401=_0x352401-0x0;var _0x2982c5=_0xedd9[_0x352401];return _0x2982c5;};'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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports','VoiceQueue','util'];(function(_0x2b68d8,_0x3a6f2){var _0x22db59=function(_0x44f3f0){while(--_0x44f3f0){_0x2b68d8['push'](_0x2b68d8['shift']());}};_0x22db59(++_0x3a6f2);}(_0xedd9,0xfc));var _0x9edd=function(_0x2e9f19,_0x5db93b){_0x2e9f19=_0x2e9f19-0x0;var _0xb80fdf=_0xedd9[_0x2e9f19];return _0xb80fdf;};'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 diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 0aca09a..25d1724 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 _0x3375=['attributes','limit','include','map','model','then','stringify','ShowVoiceQueue','where','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./voiceQueue.socket','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','GetVoiceQueue','VoiceQueue','options','raw'];(function(_0x23a3f2,_0x250000){var _0x5c8a2b=function(_0x5e0140){while(--_0x5e0140){_0x23a3f2['push'](_0x23a3f2['shift']());}};_0x5c8a2b(++_0x250000);}(_0x3375,0x1cd));var _0x5337=function(_0x133afa,_0x4434de){_0x133afa=_0x133afa-0x0;var _0x5633e9=_0x3375[_0x133afa];return _0x5633e9;};'use strict';var _=require(_0x5337('0x0'));var util=require(_0x5337('0x1'));var moment=require(_0x5337('0x2'));var BPromise=require(_0x5337('0x3'));var rs=require(_0x5337('0x4'));var fs=require('fs');var Redis=require(_0x5337('0x5'));var db=require(_0x5337('0x6'))['db'];var utils=require(_0x5337('0x7'));var logger=require(_0x5337('0x8'))(_0x5337('0x9'));var config=require(_0x5337('0xa'));var jayson=require(_0x5337('0xb'));var client=jayson[_0x5337('0xc')][_0x5337('0xd')]({'port':0x232a});config[_0x5337('0xe')]=_['defaults'](config[_0x5337('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x5337('0xf'))(new Redis(config[_0x5337('0xe')]));require(_0x5337('0x10'))['register'](socket);function respondWithRpcPromise(_0x4c179e,_0x50d462,_0x46093e){return new BPromise(function(_0x459cc6,_0x2212f3){return client[_0x5337('0x11')](_0x4c179e,_0x46093e)['then'](function(_0x2d023f){logger[_0x5337('0x12')](_0x5337('0x13'),_0x50d462,_0x5337('0x14'));logger[_0x5337('0x15')](_0x5337('0x16'),_0x50d462,_0x5337('0x14'),JSON['stringify'](_0x2d023f));if(_0x2d023f['error']){if(_0x2d023f[_0x5337('0x17')][_0x5337('0x18')]===0x1f4){logger[_0x5337('0x17')](_0x5337('0x13'),_0x50d462,_0x2d023f[_0x5337('0x17')][_0x5337('0x19')]);return _0x2212f3(_0x2d023f[_0x5337('0x17')]['message']);}logger['error'](_0x5337('0x13'),_0x50d462,_0x2d023f[_0x5337('0x17')][_0x5337('0x19')]);return _0x459cc6(_0x2d023f[_0x5337('0x17')][_0x5337('0x19')]);}else{logger[_0x5337('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x50d462,_0x5337('0x14'));_0x459cc6(_0x2d023f[_0x5337('0x1a')][_0x5337('0x19')]);}})['catch'](function(_0x1dbec8){logger[_0x5337('0x17')]('VoiceQueue,\x20%s,\x20%s',_0x50d462,_0x1dbec8);_0x2212f3(_0x1dbec8);});});}exports[_0x5337('0x1b')]=function(_0x3d8b0e){var _0x23038e=this;return new Promise(function(_0x5dc915,_0x2902d2){return db[_0x5337('0x1c')]['findAll']({'raw':_0x3d8b0e[_0x5337('0x1d')]?_0x3d8b0e[_0x5337('0x1d')][_0x5337('0x1e')]===undefined?!![]:![]:!![],'where':_0x3d8b0e[_0x5337('0x1d')]?_0x3d8b0e[_0x5337('0x1d')]['where']||null:null,'attributes':_0x3d8b0e[_0x5337('0x1d')]?_0x3d8b0e[_0x5337('0x1d')][_0x5337('0x1f')]||null:null,'limit':_0x3d8b0e[_0x5337('0x1d')]?_0x3d8b0e[_0x5337('0x1d')][_0x5337('0x20')]||null:null,'include':_0x3d8b0e[_0x5337('0x1d')]?_0x3d8b0e[_0x5337('0x1d')][_0x5337('0x21')]?_[_0x5337('0x22')](_0x3d8b0e[_0x5337('0x1d')]['include'],function(_0xbd5d98){return{'model':db[_0xbd5d98[_0x5337('0x23')]],'as':_0xbd5d98['as'],'attributes':_0xbd5d98[_0x5337('0x1f')],'include':_0xbd5d98[_0x5337('0x21')]?_[_0x5337('0x22')](_0xbd5d98[_0x5337('0x21')],function(_0x1b7451){return{'model':db[_0x1b7451[_0x5337('0x23')]],'as':_0x1b7451['as'],'attributes':_0x1b7451['attributes'],'include':_0x1b7451[_0x5337('0x21')]?_['map'](_0x1b7451[_0x5337('0x21')],function(_0x10c186){return{'model':db[_0x10c186[_0x5337('0x23')]],'as':_0x10c186['as'],'attributes':_0x10c186[_0x5337('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5337('0x24')](function(_0x3f6fba){logger['info']('GetVoiceQueue',_0x3d8b0e);logger[_0x5337('0x15')](_0x5337('0x1b'),_0x3d8b0e,JSON[_0x5337('0x25')](_0x3f6fba));_0x5dc915(_0x3f6fba);})['catch'](function(_0x7310a9){logger[_0x5337('0x17')](_0x5337('0x1b'),_0x7310a9['message'],_0x3d8b0e);_0x2902d2(_0x23038e[_0x5337('0x17')](0x1f4,_0x7310a9['message']));});});};exports[_0x5337('0x26')]=function(_0xd60f5e){var _0x26d74b=this;return new Promise(function(_0x125423,_0x5d8308){return db['VoiceQueue']['find']({'raw':_0xd60f5e[_0x5337('0x1d')]?_0xd60f5e[_0x5337('0x1d')][_0x5337('0x1e')]===undefined?!![]:![]:!![],'where':_0xd60f5e[_0x5337('0x1d')]?_0xd60f5e[_0x5337('0x1d')][_0x5337('0x27')]||null:null,'attributes':_0xd60f5e[_0x5337('0x1d')]?_0xd60f5e[_0x5337('0x1d')][_0x5337('0x1f')]||null:null,'include':_0xd60f5e[_0x5337('0x1d')]?_0xd60f5e[_0x5337('0x1d')]['include']?_[_0x5337('0x22')](_0xd60f5e[_0x5337('0x1d')][_0x5337('0x21')],function(_0x4f8c91){return{'model':db[_0x4f8c91['model']],'as':_0x4f8c91['as'],'attributes':_0x4f8c91[_0x5337('0x1f')],'include':_0x4f8c91[_0x5337('0x21')]?_[_0x5337('0x22')](_0x4f8c91[_0x5337('0x21')],function(_0x53c7f8){return{'model':db[_0x53c7f8[_0x5337('0x23')]],'as':_0x53c7f8['as'],'attributes':_0x53c7f8[_0x5337('0x1f')],'include':_0x53c7f8['include']?_[_0x5337('0x22')](_0x53c7f8[_0x5337('0x21')],function(_0x795daa){return{'model':db[_0x795daa['model']],'as':_0x795daa['as'],'attributes':_0x795daa['attributes']};}):[]};}):[]};}):[]:[]})[_0x5337('0x24')](function(_0xfb97e9){logger['info'](_0x5337('0x26'),_0xd60f5e);logger[_0x5337('0x15')](_0x5337('0x26'),_0xd60f5e,JSON[_0x5337('0x25')](_0xfb97e9));_0x125423(_0xfb97e9);})[_0x5337('0x28')](function(_0x58e5ac){logger[_0x5337('0x17')](_0x5337('0x26'),_0x58e5ac[_0x5337('0x19')],_0xd60f5e);_0x5d8308(_0x26d74b['error'](0x1f4,_0x58e5ac[_0x5337('0x19')]));});});}; \ No newline at end of file +var _0x93ea=['raw','limit','include','map','model','attributes','debug','ShowVoiceQueue','find','where','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceQueue','VoiceQueue','findAll','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x93ea,0x1cd));var _0xa93e=function(_0x46b22a,_0x5bf83a){_0x46b22a=_0x46b22a-0x0;var _0x44c2e8=_0x93ea[_0x46b22a];return _0x44c2e8;};'use strict';var _=require('lodash');var util=require(_0xa93e('0x0'));var moment=require(_0xa93e('0x1'));var BPromise=require('bluebird');var rs=require(_0xa93e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa93e('0x3'))['db'];var utils=require(_0xa93e('0x4'));var logger=require(_0xa93e('0x5'))(_0xa93e('0x6'));var config=require(_0xa93e('0x7'));var jayson=require(_0xa93e('0x8'));var client=jayson[_0xa93e('0x9')][_0xa93e('0xa')]({'port':0x232a});config[_0xa93e('0xb')]=_[_0xa93e('0xc')](config[_0xa93e('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xa93e('0xd'))(new Redis(config[_0xa93e('0xb')]));require(_0xa93e('0xe'))[_0xa93e('0xf')](socket);function respondWithRpcPromise(_0x2a8dee,_0x184d3c,_0x55941b){return new BPromise(function(_0x502c7a,_0x5e7499){return client['request'](_0x2a8dee,_0x55941b)[_0xa93e('0x10')](function(_0x15f4d5){logger['info'](_0xa93e('0x11'),_0x184d3c,_0xa93e('0x12'));logger['debug'](_0xa93e('0x13'),_0x184d3c,_0xa93e('0x12'),JSON[_0xa93e('0x14')](_0x15f4d5));if(_0x15f4d5[_0xa93e('0x15')]){if(_0x15f4d5[_0xa93e('0x15')][_0xa93e('0x16')]===0x1f4){logger[_0xa93e('0x15')]('VoiceQueue,\x20%s,\x20%s',_0x184d3c,_0x15f4d5[_0xa93e('0x15')][_0xa93e('0x17')]);return _0x5e7499(_0x15f4d5[_0xa93e('0x15')]['message']);}logger[_0xa93e('0x15')]('VoiceQueue,\x20%s,\x20%s',_0x184d3c,_0x15f4d5['error'][_0xa93e('0x17')]);return _0x502c7a(_0x15f4d5[_0xa93e('0x15')]['message']);}else{logger[_0xa93e('0x18')](_0xa93e('0x11'),_0x184d3c,_0xa93e('0x12'));_0x502c7a(_0x15f4d5[_0xa93e('0x19')][_0xa93e('0x17')]);}})[_0xa93e('0x1a')](function(_0x3748cb){logger['error'](_0xa93e('0x11'),_0x184d3c,_0x3748cb);_0x5e7499(_0x3748cb);});});}exports[_0xa93e('0x1b')]=function(_0x431d88){var _0x2d217e=this;return new Promise(function(_0x26edab,_0x1d267b){return db[_0xa93e('0x1c')][_0xa93e('0x1d')]({'raw':_0x431d88[_0xa93e('0x1e')]?_0x431d88[_0xa93e('0x1e')][_0xa93e('0x1f')]===undefined?!![]:![]:!![],'where':_0x431d88[_0xa93e('0x1e')]?_0x431d88[_0xa93e('0x1e')]['where']||null:null,'attributes':_0x431d88['options']?_0x431d88[_0xa93e('0x1e')]['attributes']||null:null,'limit':_0x431d88[_0xa93e('0x1e')]?_0x431d88[_0xa93e('0x1e')][_0xa93e('0x20')]||null:null,'include':_0x431d88[_0xa93e('0x1e')]?_0x431d88[_0xa93e('0x1e')][_0xa93e('0x21')]?_[_0xa93e('0x22')](_0x431d88['options'][_0xa93e('0x21')],function(_0x62c41a){return{'model':db[_0x62c41a[_0xa93e('0x23')]],'as':_0x62c41a['as'],'attributes':_0x62c41a[_0xa93e('0x24')],'include':_0x62c41a[_0xa93e('0x21')]?_[_0xa93e('0x22')](_0x62c41a[_0xa93e('0x21')],function(_0x2316aa){return{'model':db[_0x2316aa[_0xa93e('0x23')]],'as':_0x2316aa['as'],'attributes':_0x2316aa[_0xa93e('0x24')],'include':_0x2316aa['include']?_['map'](_0x2316aa['include'],function(_0x35cd04){return{'model':db[_0x35cd04[_0xa93e('0x23')]],'as':_0x35cd04['as'],'attributes':_0x35cd04[_0xa93e('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a840){logger['info']('GetVoiceQueue',_0x431d88);logger[_0xa93e('0x25')]('GetVoiceQueue',_0x431d88,JSON['stringify'](_0x3a840));_0x26edab(_0x3a840);})['catch'](function(_0x59b50b){logger[_0xa93e('0x15')](_0xa93e('0x1b'),_0x59b50b[_0xa93e('0x17')],_0x431d88);_0x1d267b(_0x2d217e['error'](0x1f4,_0x59b50b[_0xa93e('0x17')]));});});};exports[_0xa93e('0x26')]=function(_0x14488d){var _0xa0a97f=this;return new Promise(function(_0x2464f3,_0x4e86ab){return db['VoiceQueue'][_0xa93e('0x27')]({'raw':_0x14488d[_0xa93e('0x1e')]?_0x14488d['options']['raw']===undefined?!![]:![]:!![],'where':_0x14488d['options']?_0x14488d['options'][_0xa93e('0x28')]||null:null,'attributes':_0x14488d[_0xa93e('0x1e')]?_0x14488d[_0xa93e('0x1e')][_0xa93e('0x24')]||null:null,'include':_0x14488d['options']?_0x14488d[_0xa93e('0x1e')][_0xa93e('0x21')]?_[_0xa93e('0x22')](_0x14488d[_0xa93e('0x1e')][_0xa93e('0x21')],function(_0x2d7f12){return{'model':db[_0x2d7f12[_0xa93e('0x23')]],'as':_0x2d7f12['as'],'attributes':_0x2d7f12[_0xa93e('0x24')],'include':_0x2d7f12[_0xa93e('0x21')]?_[_0xa93e('0x22')](_0x2d7f12[_0xa93e('0x21')],function(_0x438894){return{'model':db[_0x438894['model']],'as':_0x438894['as'],'attributes':_0x438894[_0xa93e('0x24')],'include':_0x438894['include']?_[_0xa93e('0x22')](_0x438894['include'],function(_0x497090){return{'model':db[_0x497090[_0xa93e('0x23')]],'as':_0x497090['as'],'attributes':_0x497090[_0xa93e('0x24')]};}):[]};}):[]};}):[]:[]})[_0xa93e('0x10')](function(_0x33c212){logger[_0xa93e('0x18')](_0xa93e('0x26'),_0x14488d);logger[_0xa93e('0x25')](_0xa93e('0x26'),_0x14488d,JSON['stringify'](_0x33c212));_0x2464f3(_0x33c212);})[_0xa93e('0x1a')](function(_0x363401){logger[_0xa93e('0x15')](_0xa93e('0x26'),_0x363401[_0xa93e('0x17')],_0x14488d);_0x4e86ab(_0xa0a97f[_0xa93e('0x15')](0x1f4,_0x363401[_0xa93e('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 6910391..9924841 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 _0x2fce=['emit','removeListener','register','length','./voiceQueue.events','save','remove','update'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2fce,0x1d4));var _0xe2fc=function(_0x4fe120,_0x53971b){_0x4fe120=_0x4fe120-0x0;var _0x291746=_0x2fce[_0x4fe120];return _0x291746;};'use strict';var VoiceQueueEvents=require(_0xe2fc('0x0'));var events=[_0xe2fc('0x1'),_0xe2fc('0x2'),_0xe2fc('0x3')];function createListener(_0xa94766,_0x77305b){return function(_0x5a6912){_0x77305b[_0xe2fc('0x4')](_0xa94766,_0x5a6912);};}function removeListener(_0x3e833c,_0x2f95a4){return function(){VoiceQueueEvents[_0xe2fc('0x5')](_0x3e833c,_0x2f95a4);};}exports[_0xe2fc('0x6')]=function(_0x33391b){for(var _0x3fcd75=0x0,_0x1ccbb4=events[_0xe2fc('0x7')];_0x3fcd75<_0x1ccbb4;_0x3fcd75++){var _0x4c99c6=events[_0x3fcd75];var _0x570da4=createListener('voiceQueue:'+_0x4c99c6,_0x33391b);VoiceQueueEvents['on'](_0x4c99c6,_0x570da4);}}; \ No newline at end of file +var _0xf983=['remove','emit','removeListener','register','length','voiceQueue:','./voiceQueue.events','save'];(function(_0x2514ec,_0x51e1c2){var _0x4a4ec3=function(_0x2915ee){while(--_0x2915ee){_0x2514ec['push'](_0x2514ec['shift']());}};_0x4a4ec3(++_0x51e1c2);}(_0xf983,0x8e));var _0x3f98=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0xf983[_0x34843e];return _0x598f7f;};'use strict';var VoiceQueueEvents=require(_0x3f98('0x0'));var events=[_0x3f98('0x1'),_0x3f98('0x2'),'update'];function createListener(_0x3e1fce,_0x546747){return function(_0x2d88c3){_0x546747[_0x3f98('0x3')](_0x3e1fce,_0x2d88c3);};}function removeListener(_0x3a3d1c,_0x450dd6){return function(){VoiceQueueEvents[_0x3f98('0x4')](_0x3a3d1c,_0x450dd6);};}exports[_0x3f98('0x5')]=function(_0x4e7c23){for(var _0x2e2108=0x0,_0x17b119=events[_0x3f98('0x6')];_0x2e2108<_0x17b119;_0x2e2108++){var _0x50f47d=events[_0x2e2108];var _0x240c11=createListener(_0x3f98('0x7')+_0x50f47d,_0x4e7c23);VoiceQueueEvents['on'](_0x50f47d,_0x240c11);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 2a6535c..339c7bd 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 _0x69e7=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','show','post','create','put','update','delete','/:id','multer'];(function(_0x5f0447,_0x3949be){var _0x3a1a12=function(_0x182132){while(--_0x182132){_0x5f0447['push'](_0x5f0447['shift']());}};_0x3a1a12(++_0x3949be);}(_0x69e7,0x99));var _0x769e=function(_0x18a392,_0x542e85){_0x18a392=_0x18a392-0x0;var _0x4520b7=_0x69e7[_0x18a392];return _0x4520b7;};'use strict';var multer=require(_0x769e('0x0'));var util=require('util');var path=require(_0x769e('0x1'));var timeout=require(_0x769e('0x2'));var express=require(_0x769e('0x3'));var router=express[_0x769e('0x4')]();var fs_extra=require(_0x769e('0x5'));var auth=require(_0x769e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x769e('0x7'));var controller=require('./voiceQueueReport.controller');router[_0x769e('0x8')]('/',auth[_0x769e('0x9')](),controller[_0x769e('0xa')]);router[_0x769e('0x8')](_0x769e('0xb'),auth[_0x769e('0x9')](),controller[_0x769e('0xc')]);router[_0x769e('0x8')](_0x769e('0xd'),auth[_0x769e('0x9')](),controller[_0x769e('0xe')]);router[_0x769e('0x8')]('/:id',auth[_0x769e('0x9')](),controller[_0x769e('0xf')]);router[_0x769e('0x10')]('/',auth[_0x769e('0x9')](),controller[_0x769e('0x11')]);router[_0x769e('0x12')]('/:id',auth[_0x769e('0x9')](),controller[_0x769e('0x13')]);router[_0x769e('0x14')](_0x769e('0x15'),auth[_0x769e('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf8b2=['/index','getVoiceQueuesReport','/:id','show','post','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe'];(function(_0x3d4a6b,_0x20dbcb){var _0x55d64a=function(_0x220a50){while(--_0x220a50){_0x3d4a6b['push'](_0x3d4a6b['shift']());}};_0x55d64a(++_0x20dbcb);}(_0xf8b2,0x184));var _0x2f8b=function(_0x59a14a,_0x56b115){_0x59a14a=_0x59a14a-0x0;var _0x1f1baf=_0xf8b2[_0x59a14a];return _0x1f1baf;};'use strict';var multer=require('multer');var util=require(_0x2f8b('0x0'));var path=require('path');var timeout=require(_0x2f8b('0x1'));var express=require(_0x2f8b('0x2'));var router=express[_0x2f8b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2f8b('0x4'));var interaction=require(_0x2f8b('0x5'));var config=require(_0x2f8b('0x6'));var controller=require('./voiceQueueReport.controller');router[_0x2f8b('0x7')]('/',auth[_0x2f8b('0x8')](),controller['index']);router['get'](_0x2f8b('0x9'),auth[_0x2f8b('0x8')](),controller[_0x2f8b('0xa')]);router['get'](_0x2f8b('0xb'),auth[_0x2f8b('0x8')](),controller[_0x2f8b('0xc')]);router['get'](_0x2f8b('0xd'),auth['isAuthenticated'](),controller[_0x2f8b('0xe')]);router[_0x2f8b('0xf')]('/',auth[_0x2f8b('0x8')](),controller['create']);router[_0x2f8b('0x10')](_0x2f8b('0xd'),auth[_0x2f8b('0x8')](),controller[_0x2f8b('0x11')]);router[_0x2f8b('0x12')](_0x2f8b('0xd'),auth[_0x2f8b('0x8')](),controller[_0x2f8b('0x13')]);module[_0x2f8b('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index bfccefa..4e1b9f6 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 _0x1689=['format','YYYY-MM-DD\x20HH:mm:ss','diff','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','moment','STRING','DATE','getDataValue','queuecallerjoinAt'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1689,0xca));var _0x9168=function(_0x185498,_0x490152){_0x185498=_0x185498-0x0;var _0x35ce08=_0x1689[_0x185498];return _0x35ce08;};'use strict';var Sequelize=require(_0x9168('0x0'));var moment=require(_0x9168('0x1'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x9168('0x2')]},'calleridnum':{'type':Sequelize[_0x9168('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x9168('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x9168('0x3')],'set':function(_0x48b867){var _0x4a209c=moment(_0x48b867);var _0x4449be=moment(this[_0x9168('0x4')](_0x9168('0x5')))[_0x9168('0x6')](_0x9168('0x7'));var _0x3e7d6b=_0x4a209c[_0x9168('0x8')](_0x4449be,'seconds');this['setDataValue']('queuecallerleaveAt',_0x48b867);this['setDataValue'](_0x9168('0x9'),_0x3e7d6b||null);}},'position':{'type':Sequelize[_0x9168('0xa')]},'count':{'type':Sequelize[_0x9168('0xa')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x9168('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x9168('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x9168('0x2')],'comment':_0x9168('0xc')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x9168('0x2')]},'connectedlinename':{'type':Sequelize[_0x9168('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x9168('0x2')]},'exten':{'type':Sequelize[_0x9168('0x2')]},'priority':{'type':Sequelize[_0x9168('0x2')]},'holdtime':{'type':Sequelize[_0x9168('0xa')]},'mohtime':{'type':Sequelize[_0x9168('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x9168('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x9168('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x9168('0x2')]},'transferuniqueid':{'type':Sequelize[_0x9168('0x2')]},'disposition':{'type':Sequelize[_0x9168('0x2')]},'secondDisposition':{'type':Sequelize[_0x9168('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize[_0x9168('0x2')]}}; \ No newline at end of file +var _0x7de8=['getDataValue','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE'];(function(_0x1d1034,_0xc52edf){var _0x372f57=function(_0x421f76){while(--_0x421f76){_0x1d1034['push'](_0x1d1034['shift']());}};_0x372f57(++_0xc52edf);}(_0x7de8,0x8b));var _0x87de=function(_0x598603,_0xe79a0a){_0x598603=_0x598603-0x0;var _0x14b45e=_0x7de8[_0x598603];return _0x14b45e;};'use strict';var Sequelize=require(_0x87de('0x0'));var moment=require(_0x87de('0x1'));module[_0x87de('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x87de('0x3')]},'calleridname':{'type':Sequelize[_0x87de('0x3')]},'queue':{'type':Sequelize[_0x87de('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x87de('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x87de('0x4')],'set':function(_0x55050b){var _0x29db15=moment(_0x55050b);var _0x43f446=moment(this[_0x87de('0x5')]('queuecallerjoinAt'))['format'](_0x87de('0x6'));var _0x4bbf6a=_0x29db15[_0x87de('0x7')](_0x43f446,_0x87de('0x8'));this[_0x87de('0x9')](_0x87de('0xa'),_0x55050b);this['setDataValue'](_0x87de('0xb'),_0x4bbf6a||null);}},'position':{'type':Sequelize[_0x87de('0xc')]},'count':{'type':Sequelize[_0x87de('0xc')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x87de('0x4')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x87de('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x87de('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x87de('0x3')],'comment':_0x87de('0xe')},'originalposition':{'type':Sequelize[_0x87de('0xc')]},'channel':{'type':Sequelize[_0x87de('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x87de('0x3')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x87de('0x3')]},'exten':{'type':Sequelize[_0x87de('0x3')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x87de('0xc')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x87de('0x3')]},'transfer':{'type':Sequelize[_0x87de('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x87de('0x3')],'comment':_0x87de('0xf')},'transferexten':{'type':Sequelize[_0x87de('0x3')]},'transferuniqueid':{'type':Sequelize[_0x87de('0x3')]},'disposition':{'type':Sequelize[_0x87de('0x3')]},'secondDisposition':{'type':Sequelize[_0x87de('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x87de('0xc')],'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 3d3b7fa..c00ac75 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 _0xdf80=['options','find','create','body','params','describe','getVoiceQueuesReport','rows','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','end','stack','name','send','index','map','VoiceQueueReport','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','catch','show','rawAttributes','keys'];(function(_0x2461ec,_0xd693c3){var _0x3ba75c=function(_0x5ef7eb){while(--_0x5ef7eb){_0x2461ec['push'](_0x2461ec['shift']());}};_0x3ba75c(++_0xd693c3);}(_0xdf80,0x1ac));var _0x0df8=function(_0x8d823c,_0x4dfa8e){_0x8d823c=_0x8d823c-0x0;var _0x1399a6=_0xdf80[_0x8d823c];return _0x1399a6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0df8('0x0'));var jsonpatch=require(_0x0df8('0x1'));var rp=require('request-promise');var moment=require(_0x0df8('0x2'));var BPromise=require(_0x0df8('0x3'));var Mustache=require(_0x0df8('0x4'));var util=require(_0x0df8('0x5'));var path=require(_0x0df8('0x6'));var sox=require(_0x0df8('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0df8('0x8'));var _=require(_0x0df8('0x9'));var squel=require(_0x0df8('0xa'));var crypto=require(_0x0df8('0xb'));var jsforce=require(_0x0df8('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0df8('0xd'));var querystring=require(_0x0df8('0xe'));var Papa=require(_0x0df8('0xf'));var Redis=require(_0x0df8('0x10'));var authService=require(_0x0df8('0x11'));var qs=require(_0x0df8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0df8('0x13'));var logger=require(_0x0df8('0x14'))(_0x0df8('0x15'));var utils=require(_0x0df8('0x16'));var config=require(_0x0df8('0x17'));var licenseUtil=require(_0x0df8('0x18'));var db=require(_0x0df8('0x19'))['db'];config[_0x0df8('0x1a')]=_[_0x0df8('0x1b')](config['redis'],{'host':_0x0df8('0x1c'),'port':0x18eb});var socket=require(_0x0df8('0x1d'))(new Redis(config[_0x0df8('0x1a')]));require(_0x0df8('0x1e'))['register'](socket);function respondWithStatusCode(_0x5e29fd,_0x11c057){_0x11c057=_0x11c057||0xcc;return function(_0x16d734){if(_0x16d734){return _0x5e29fd[_0x0df8('0x1f')](_0x11c057);}return _0x5e29fd['status'](_0x11c057)['end']();};}function respondWithResult(_0x246a73,_0x24a7fe){_0x24a7fe=_0x24a7fe||0xc8;return function(_0x110ce8){if(_0x110ce8){return _0x246a73[_0x0df8('0x20')](_0x24a7fe)[_0x0df8('0x21')](_0x110ce8);}};}function respondWithFilteredResult(_0x7e1649,_0x3578cf){return function(_0x277e37){if(_0x277e37){var _0x215955=typeof _0x3578cf[_0x0df8('0x22')]===_0x0df8('0x23')&&typeof _0x3578cf[_0x0df8('0x24')]===_0x0df8('0x23');var _0x155b10=_0x277e37['count'];var _0x254349=_0x215955?0x0:_0x3578cf[_0x0df8('0x22')];var _0x48daf8=_0x215955?_0x277e37[_0x0df8('0x25')]:_0x3578cf['offset']+_0x3578cf[_0x0df8('0x24')];var _0x2670cd;if(_0x48daf8>=_0x155b10){_0x48daf8=_0x155b10;_0x2670cd=0xc8;}else{_0x2670cd=0xce;}_0x7e1649[_0x0df8('0x20')](_0x2670cd);return _0x7e1649[_0x0df8('0x26')](_0x0df8('0x27'),_0x254349+'-'+_0x48daf8+'/'+_0x155b10)[_0x0df8('0x21')](_0x277e37);}return null;};}function patchUpdates(_0x1a1973){return function(_0x4527a6){try{jsonpatch[_0x0df8('0x28')](_0x4527a6,_0x1a1973,!![]);}catch(_0x1cd09c){return BPromise['reject'](_0x1cd09c);}return _0x4527a6['save']();};}function saveUpdates(_0x74bc6e,_0x2800d3){return function(_0x32f8e6){if(_0x32f8e6){return _0x32f8e6[_0x0df8('0x29')](_0x74bc6e)[_0x0df8('0x2a')](function(_0x2c80d1){return _0x2c80d1;});}return null;};}function removeEntity(_0x173ff7,_0x4282cf){return function(_0x4e4a26){if(_0x4e4a26){return _0x4e4a26[_0x0df8('0x2b')]()[_0x0df8('0x2a')](function(){_0x173ff7[_0x0df8('0x20')](0xcc)[_0x0df8('0x2c')]();});}};}function handleEntityNotFound(_0x201df9,_0x22eb0e){return function(_0x271d83){if(!_0x271d83){_0x201df9[_0x0df8('0x1f')](0x194);}return _0x271d83;};}function handleError(_0xeb54d8,_0x244e07){_0x244e07=_0x244e07||0x1f4;return function(_0x3b2349){logger['error'](_0x3b2349[_0x0df8('0x2d')]);if(_0x3b2349[_0x0df8('0x2e')]){delete _0x3b2349['name'];}_0xeb54d8[_0x0df8('0x20')](_0x244e07)[_0x0df8('0x2f')](_0x3b2349);};}exports[_0x0df8('0x30')]=function(_0xdeb358,_0x1940a7){var _0x194aa1={},_0x306bbb={},_0x3af71f={'count':0x0,'rows':[]};var _0x23c09d=_[_0x0df8('0x31')](db[_0x0df8('0x32')]['rawAttributes'],function(_0x366ab5){return{'name':_0x366ab5[_0x0df8('0x33')],'type':_0x366ab5[_0x0df8('0x34')][_0x0df8('0x35')]};});_0x306bbb[_0x0df8('0x36')]=_['map'](_0x23c09d,_0x0df8('0x2e'));_0x306bbb[_0x0df8('0x37')]=_['keys'](_0xdeb358[_0x0df8('0x37')]);_0x306bbb['filters']=_[_0x0df8('0x38')](_0x306bbb[_0x0df8('0x36')],_0x306bbb['query']);_0x194aa1[_0x0df8('0x39')]=_[_0x0df8('0x38')](_0x306bbb['model'],qs[_0x0df8('0x3a')](_0xdeb358[_0x0df8('0x37')][_0x0df8('0x3a')]));_0x194aa1[_0x0df8('0x39')]=_0x194aa1[_0x0df8('0x39')][_0x0df8('0x3b')]?_0x194aa1['attributes']:_0x306bbb['model'];if(!_0xdeb358['query'][_0x0df8('0x3c')](_0x0df8('0x3d'))){_0x194aa1[_0x0df8('0x24')]=qs[_0x0df8('0x24')](_0xdeb358[_0x0df8('0x37')][_0x0df8('0x24')]);_0x194aa1[_0x0df8('0x22')]=qs[_0x0df8('0x22')](_0xdeb358[_0x0df8('0x37')][_0x0df8('0x22')]);}_0x194aa1[_0x0df8('0x3e')]=qs[_0x0df8('0x3f')](_0xdeb358['query'][_0x0df8('0x3f')]);_0x194aa1[_0x0df8('0x40')]=qs[_0x0df8('0x41')](_[_0x0df8('0x42')](_0xdeb358[_0x0df8('0x37')],_0x306bbb[_0x0df8('0x41')]),_0x23c09d);if(_0xdeb358[_0x0df8('0x37')][_0x0df8('0x43')]){_0x194aa1[_0x0df8('0x40')]=_[_0x0df8('0x44')](_0x194aa1[_0x0df8('0x40')],{'$or':_[_0x0df8('0x31')](_0x23c09d,function(_0x236875){if(_0x236875['type']!==_0x0df8('0x45')){var _0x716fa4={};_0x716fa4[_0x236875[_0x0df8('0x2e')]]={'$like':'%'+_0xdeb358[_0x0df8('0x37')]['filter']+'%'};return _0x716fa4;}})});}_0x194aa1=_[_0x0df8('0x44')]({},_0x194aa1,_0xdeb358['options']);var _0x3730bb={'where':_0x194aa1[_0x0df8('0x40')]};return db['VoiceQueueReport']['count'](_0x3730bb)[_0x0df8('0x2a')](function(_0x3a638d){_0x3af71f[_0x0df8('0x25')]=_0x3a638d;if(_0xdeb358[_0x0df8('0x37')][_0x0df8('0x46')]){_0x194aa1[_0x0df8('0x47')]=[{'all':!![]}];}return db[_0x0df8('0x32')]['findAll'](_0x194aa1);})[_0x0df8('0x2a')](function(_0x2e0387){_0x3af71f['rows']=_0x2e0387;return _0x3af71f;})[_0x0df8('0x2a')](respondWithFilteredResult(_0x1940a7,_0x194aa1))[_0x0df8('0x48')](handleError(_0x1940a7,null));};exports[_0x0df8('0x49')]=function(_0x279f37,_0x613b86){var _0x9179a2={'raw':![],'where':{'id':_0x279f37['params']['id']}},_0x2ad113={};_0x2ad113['model']=_['keys'](db['VoiceQueueReport'][_0x0df8('0x4a')]);_0x2ad113[_0x0df8('0x37')]=_[_0x0df8('0x4b')](_0x279f37[_0x0df8('0x37')]);_0x2ad113[_0x0df8('0x41')]=_[_0x0df8('0x38')](_0x2ad113[_0x0df8('0x36')],_0x2ad113['query']);_0x9179a2[_0x0df8('0x39')]=_[_0x0df8('0x38')](_0x2ad113[_0x0df8('0x36')],qs[_0x0df8('0x3a')](_0x279f37['query']['fields']));_0x9179a2[_0x0df8('0x39')]=_0x9179a2[_0x0df8('0x39')]['length']?_0x9179a2[_0x0df8('0x39')]:_0x2ad113[_0x0df8('0x36')];if(_0x279f37[_0x0df8('0x37')][_0x0df8('0x46')]){_0x9179a2[_0x0df8('0x47')]=[{'all':!![]}];}_0x9179a2=_[_0x0df8('0x44')]({},_0x9179a2,_0x279f37[_0x0df8('0x4c')]);return db[_0x0df8('0x32')][_0x0df8('0x4d')](_0x9179a2)[_0x0df8('0x2a')](handleEntityNotFound(_0x613b86,null))[_0x0df8('0x2a')](respondWithResult(_0x613b86,null))[_0x0df8('0x48')](handleError(_0x613b86,null));};exports[_0x0df8('0x4e')]=function(_0x451b8e,_0x332af2){return db[_0x0df8('0x32')]['create'](_0x451b8e['body'],{})['then'](respondWithResult(_0x332af2,0xc9))[_0x0df8('0x48')](handleError(_0x332af2,null));};exports[_0x0df8('0x29')]=function(_0xb463fc,_0x462ef6){if(_0xb463fc[_0x0df8('0x4f')]['id']){delete _0xb463fc[_0x0df8('0x4f')]['id'];}return db[_0x0df8('0x32')][_0x0df8('0x4d')]({'where':{'id':_0xb463fc[_0x0df8('0x50')]['id']}})[_0x0df8('0x2a')](handleEntityNotFound(_0x462ef6,null))[_0x0df8('0x2a')](saveUpdates(_0xb463fc['body'],null))['then'](respondWithResult(_0x462ef6,null))['catch'](handleError(_0x462ef6,null));};exports[_0x0df8('0x2b')]=function(_0x286ea5,_0x30a7a4){return db['VoiceQueueReport'][_0x0df8('0x4d')]({'where':{'id':_0x286ea5[_0x0df8('0x50')]['id']}})[_0x0df8('0x2a')](handleEntityNotFound(_0x30a7a4,null))[_0x0df8('0x2a')](removeEntity(_0x30a7a4,null))['catch'](handleError(_0x30a7a4,null));};exports[_0x0df8('0x51')]=function(_0x113605,_0x201920){return db['VoiceQueueReport'][_0x0df8('0x51')]()[_0x0df8('0x2a')](respondWithResult(_0x201920,null))['catch'](handleError(_0x201920,null));};exports[_0x0df8('0x52')]=function(_0x211801,_0x7ce1a5){var _0x4ee64a={},_0x4710ed={},_0x36376d={'count':0x0,'rows':[]};_0x4710ed['model']=_[_0x0df8('0x4b')](db['VoiceQueueReport'][_0x0df8('0x4a')]);_0x4710ed[_0x0df8('0x37')]=_[_0x0df8('0x4b')](_0x211801[_0x0df8('0x37')]);_0x4710ed['filters']=_[_0x0df8('0x38')](_0x4710ed[_0x0df8('0x36')],_0x4710ed[_0x0df8('0x37')]);_0x4ee64a['attributes']=_[_0x0df8('0x38')](_0x4710ed[_0x0df8('0x36')],qs[_0x0df8('0x3a')](_0x211801['query']['fields']));_0x4ee64a['attributes']=_0x4ee64a['attributes'][_0x0df8('0x3b')]?_0x4ee64a[_0x0df8('0x39')]:_0x4710ed[_0x0df8('0x36')];if(!_0x211801[_0x0df8('0x37')][_0x0df8('0x3c')](_0x0df8('0x3d'))){_0x4ee64a[_0x0df8('0x24')]=qs[_0x0df8('0x24')](_0x211801['query'][_0x0df8('0x24')]);_0x4ee64a[_0x0df8('0x22')]=qs[_0x0df8('0x22')](_0x211801[_0x0df8('0x37')]['offset']);}_0x4ee64a[_0x0df8('0x3e')]=qs[_0x0df8('0x3f')](_0x211801[_0x0df8('0x37')][_0x0df8('0x3f')]);_0x4ee64a[_0x0df8('0x40')]=qs[_0x0df8('0x41')](_['pick'](_0x211801[_0x0df8('0x37')],_0x4710ed[_0x0df8('0x41')]));if(_0x211801[_0x0df8('0x37')]['filter']){_0x4ee64a[_0x0df8('0x40')]=_[_0x0df8('0x44')](_0x4ee64a['where'],{'$or':_['map'](_0x4ee64a[_0x0df8('0x39')],function(_0xa5ba6d){var _0x109282={};_0x109282[_0xa5ba6d]={'$like':'%'+_0x211801[_0x0df8('0x37')][_0x0df8('0x43')]+'%'};return _0x109282;})});}_0x4ee64a=_['merge']({},_0x4ee64a,_0x211801[_0x0df8('0x4c')]);var _0x3247a0={'where':_0x4ee64a[_0x0df8('0x40')]};return db[_0x0df8('0x32')][_0x0df8('0x25')](_0x3247a0)[_0x0df8('0x2a')](function(_0xa3875c){_0x36376d[_0x0df8('0x25')]=_0xa3875c;if(_0x211801['query']['includeAll']){_0x4ee64a[_0x0df8('0x47')]=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x4ee64a);})[_0x0df8('0x2a')](function(_0x5b96d4){_0x36376d[_0x0df8('0x53')]=_0x5b96d4;return _0x36376d;})[_0x0df8('0x2a')](respondWithFilteredResult(_0x7ce1a5,_0x4ee64a,_0x0df8('0x52')))[_0x0df8('0x48')](handleError(_0x7ce1a5,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0x0ab7=['eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','VoiceQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','describe','getVoiceQueuesReport','pick'];(function(_0x1cf6cd,_0x2b910a){var _0x37270e=function(_0x3cd42f){while(--_0x3cd42f){_0x1cf6cd['push'](_0x1cf6cd['shift']());}};_0x37270e(++_0x2b910a);}(_0x0ab7,0x1a4));var _0x70ab=function(_0x2399bc,_0x475e0d){_0x2399bc=_0x2399bc-0x0;var _0x3f230a=_0x0ab7[_0x2399bc];return _0x3f230a;};'use strict';var emlformat=require(_0x70ab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x70ab('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x70ab('0x2'));var moment=require(_0x70ab('0x3'));var BPromise=require(_0x70ab('0x4'));var Mustache=require(_0x70ab('0x5'));var util=require(_0x70ab('0x6'));var path=require(_0x70ab('0x7'));var sox=require(_0x70ab('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x70ab('0x9'));var _=require(_0x70ab('0xa'));var squel=require('squel');var crypto=require(_0x70ab('0xb'));var jsforce=require(_0x70ab('0xc'));var deskjs=require(_0x70ab('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x70ab('0xe'));var Redis=require(_0x70ab('0xf'));var authService=require(_0x70ab('0x10'));var qs=require(_0x70ab('0x11'));var as=require(_0x70ab('0x12'));var hardwareService=require(_0x70ab('0x13'));var logger=require(_0x70ab('0x14'))(_0x70ab('0x15'));var utils=require(_0x70ab('0x16'));var config=require(_0x70ab('0x17'));var licenseUtil=require(_0x70ab('0x18'));var db=require(_0x70ab('0x19'))['db'];config[_0x70ab('0x1a')]=_[_0x70ab('0x1b')](config[_0x70ab('0x1a')],{'host':_0x70ab('0x1c'),'port':0x18eb});var socket=require(_0x70ab('0x1d'))(new Redis(config['redis']));require(_0x70ab('0x1e'))['register'](socket);function respondWithStatusCode(_0x448fde,_0x329177){_0x329177=_0x329177||0xcc;return function(_0x3e40f3){if(_0x3e40f3){return _0x448fde[_0x70ab('0x1f')](_0x329177);}return _0x448fde[_0x70ab('0x20')](_0x329177)[_0x70ab('0x21')]();};}function respondWithResult(_0x594d0e,_0x43fe78){_0x43fe78=_0x43fe78||0xc8;return function(_0x3c5a92){if(_0x3c5a92){return _0x594d0e[_0x70ab('0x20')](_0x43fe78)['json'](_0x3c5a92);}};}function respondWithFilteredResult(_0x3f6cc1,_0x9ee336){return function(_0x3163b5){if(_0x3163b5){var _0x2ef48f=typeof _0x9ee336[_0x70ab('0x22')]===_0x70ab('0x23')&&typeof _0x9ee336[_0x70ab('0x24')]===_0x70ab('0x23');var _0x489649=_0x3163b5['count'];var _0x291001=_0x2ef48f?0x0:_0x9ee336[_0x70ab('0x22')];var _0x1c993f=_0x2ef48f?_0x3163b5[_0x70ab('0x25')]:_0x9ee336[_0x70ab('0x22')]+_0x9ee336[_0x70ab('0x24')];var _0x5d4d85;if(_0x1c993f>=_0x489649){_0x1c993f=_0x489649;_0x5d4d85=0xc8;}else{_0x5d4d85=0xce;}_0x3f6cc1[_0x70ab('0x20')](_0x5d4d85);return _0x3f6cc1['set'](_0x70ab('0x26'),_0x291001+'-'+_0x1c993f+'/'+_0x489649)['json'](_0x3163b5);}return null;};}function patchUpdates(_0x36c87f){return function(_0x3cdaf0){try{jsonpatch[_0x70ab('0x27')](_0x3cdaf0,_0x36c87f,!![]);}catch(_0xac11a6){return BPromise[_0x70ab('0x28')](_0xac11a6);}return _0x3cdaf0[_0x70ab('0x29')]();};}function saveUpdates(_0x1b5aea,_0x2f435f){return function(_0x39352d){if(_0x39352d){return _0x39352d['update'](_0x1b5aea)[_0x70ab('0x2a')](function(_0x3b836c){return _0x3b836c;});}return null;};}function removeEntity(_0x5596dc,_0x492fbd){return function(_0x5a0fbf){if(_0x5a0fbf){return _0x5a0fbf[_0x70ab('0x2b')]()['then'](function(){_0x5596dc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c591d,_0x131dcb){return function(_0xb7706b){if(!_0xb7706b){_0x3c591d[_0x70ab('0x1f')](0x194);}return _0xb7706b;};}function handleError(_0x491f31,_0x129bfe){_0x129bfe=_0x129bfe||0x1f4;return function(_0x3ed508){logger[_0x70ab('0x2c')](_0x3ed508[_0x70ab('0x2d')]);if(_0x3ed508[_0x70ab('0x2e')]){delete _0x3ed508[_0x70ab('0x2e')];}_0x491f31[_0x70ab('0x20')](_0x129bfe)[_0x70ab('0x2f')](_0x3ed508);};}exports[_0x70ab('0x30')]=function(_0x3cad99,_0x24bb3e){var _0x47da54={},_0x5c2296={},_0x27ee2d={'count':0x0,'rows':[]};var _0x210e0c=_['map'](db[_0x70ab('0x31')][_0x70ab('0x32')],function(_0x32d812){return{'name':_0x32d812[_0x70ab('0x33')],'type':_0x32d812[_0x70ab('0x34')]['key']};});_0x5c2296[_0x70ab('0x35')]=_['map'](_0x210e0c,_0x70ab('0x2e'));_0x5c2296[_0x70ab('0x36')]=_[_0x70ab('0x37')](_0x3cad99['query']);_0x5c2296[_0x70ab('0x38')]=_['intersection'](_0x5c2296[_0x70ab('0x35')],_0x5c2296[_0x70ab('0x36')]);_0x47da54['attributes']=_[_0x70ab('0x39')](_0x5c2296[_0x70ab('0x35')],qs[_0x70ab('0x3a')](_0x3cad99[_0x70ab('0x36')]['fields']));_0x47da54['attributes']=_0x47da54[_0x70ab('0x3b')][_0x70ab('0x3c')]?_0x47da54[_0x70ab('0x3b')]:_0x5c2296[_0x70ab('0x35')];if(!_0x3cad99[_0x70ab('0x36')][_0x70ab('0x3d')](_0x70ab('0x3e'))){_0x47da54[_0x70ab('0x24')]=qs[_0x70ab('0x24')](_0x3cad99[_0x70ab('0x36')][_0x70ab('0x24')]);_0x47da54[_0x70ab('0x22')]=qs['offset'](_0x3cad99['query'][_0x70ab('0x22')]);}_0x47da54[_0x70ab('0x3f')]=qs[_0x70ab('0x40')](_0x3cad99[_0x70ab('0x36')][_0x70ab('0x40')]);_0x47da54[_0x70ab('0x41')]=qs[_0x70ab('0x38')](_['pick'](_0x3cad99[_0x70ab('0x36')],_0x5c2296[_0x70ab('0x38')]),_0x210e0c);if(_0x3cad99['query'][_0x70ab('0x42')]){_0x47da54['where']=_[_0x70ab('0x43')](_0x47da54[_0x70ab('0x41')],{'$or':_[_0x70ab('0x44')](_0x210e0c,function(_0x28c506){if(_0x28c506[_0x70ab('0x34')]!=='VIRTUAL'){var _0x1b0b36={};_0x1b0b36[_0x28c506[_0x70ab('0x2e')]]={'$like':'%'+_0x3cad99[_0x70ab('0x36')][_0x70ab('0x42')]+'%'};return _0x1b0b36;}})});}_0x47da54=_[_0x70ab('0x43')]({},_0x47da54,_0x3cad99[_0x70ab('0x45')]);var _0x5a5f5e={'where':_0x47da54[_0x70ab('0x41')]};return db[_0x70ab('0x31')][_0x70ab('0x25')](_0x5a5f5e)['then'](function(_0x5b88da){_0x27ee2d[_0x70ab('0x25')]=_0x5b88da;if(_0x3cad99[_0x70ab('0x36')][_0x70ab('0x46')]){_0x47da54[_0x70ab('0x47')]=[{'all':!![]}];}return db[_0x70ab('0x31')][_0x70ab('0x48')](_0x47da54);})[_0x70ab('0x2a')](function(_0x2b6e4b){_0x27ee2d[_0x70ab('0x49')]=_0x2b6e4b;return _0x27ee2d;})[_0x70ab('0x2a')](respondWithFilteredResult(_0x24bb3e,_0x47da54))[_0x70ab('0x4a')](handleError(_0x24bb3e,null));};exports[_0x70ab('0x4b')]=function(_0x3afabc,_0x473ab7){var _0x76356b={'raw':![],'where':{'id':_0x3afabc[_0x70ab('0x4c')]['id']}},_0x52464f={};_0x52464f[_0x70ab('0x35')]=_[_0x70ab('0x37')](db[_0x70ab('0x31')][_0x70ab('0x32')]);_0x52464f[_0x70ab('0x36')]=_['keys'](_0x3afabc[_0x70ab('0x36')]);_0x52464f['filters']=_[_0x70ab('0x39')](_0x52464f[_0x70ab('0x35')],_0x52464f[_0x70ab('0x36')]);_0x76356b['attributes']=_['intersection'](_0x52464f[_0x70ab('0x35')],qs['fields'](_0x3afabc['query'][_0x70ab('0x3a')]));_0x76356b['attributes']=_0x76356b[_0x70ab('0x3b')][_0x70ab('0x3c')]?_0x76356b[_0x70ab('0x3b')]:_0x52464f[_0x70ab('0x35')];if(_0x3afabc[_0x70ab('0x36')][_0x70ab('0x46')]){_0x76356b[_0x70ab('0x47')]=[{'all':!![]}];}_0x76356b=_[_0x70ab('0x43')]({},_0x76356b,_0x3afabc[_0x70ab('0x45')]);return db[_0x70ab('0x31')][_0x70ab('0x4d')](_0x76356b)[_0x70ab('0x2a')](handleEntityNotFound(_0x473ab7,null))[_0x70ab('0x2a')](respondWithResult(_0x473ab7,null))['catch'](handleError(_0x473ab7,null));};exports[_0x70ab('0x4e')]=function(_0x24edb4,_0x16e481){return db[_0x70ab('0x31')][_0x70ab('0x4e')](_0x24edb4[_0x70ab('0x4f')],{})[_0x70ab('0x2a')](respondWithResult(_0x16e481,0xc9))[_0x70ab('0x4a')](handleError(_0x16e481,null));};exports[_0x70ab('0x50')]=function(_0x2169f7,_0x22c720){if(_0x2169f7[_0x70ab('0x4f')]['id']){delete _0x2169f7[_0x70ab('0x4f')]['id'];}return db[_0x70ab('0x31')][_0x70ab('0x4d')]({'where':{'id':_0x2169f7[_0x70ab('0x4c')]['id']}})[_0x70ab('0x2a')](handleEntityNotFound(_0x22c720,null))[_0x70ab('0x2a')](saveUpdates(_0x2169f7[_0x70ab('0x4f')],null))['then'](respondWithResult(_0x22c720,null))[_0x70ab('0x4a')](handleError(_0x22c720,null));};exports[_0x70ab('0x2b')]=function(_0x34cc15,_0x1e9562){return db[_0x70ab('0x31')][_0x70ab('0x4d')]({'where':{'id':_0x34cc15[_0x70ab('0x4c')]['id']}})[_0x70ab('0x2a')](handleEntityNotFound(_0x1e9562,null))[_0x70ab('0x2a')](removeEntity(_0x1e9562,null))[_0x70ab('0x4a')](handleError(_0x1e9562,null));};exports[_0x70ab('0x51')]=function(_0x260e6d,_0x12a6c1){return db[_0x70ab('0x31')][_0x70ab('0x51')]()[_0x70ab('0x2a')](respondWithResult(_0x12a6c1,null))['catch'](handleError(_0x12a6c1,null));};exports[_0x70ab('0x52')]=function(_0x1582fd,_0x5c9a60){var _0x39cad1={},_0x581436={},_0x4a82c1={'count':0x0,'rows':[]};_0x581436[_0x70ab('0x35')]=_[_0x70ab('0x37')](db['VoiceQueueReport'][_0x70ab('0x32')]);_0x581436[_0x70ab('0x36')]=_['keys'](_0x1582fd['query']);_0x581436['filters']=_[_0x70ab('0x39')](_0x581436[_0x70ab('0x35')],_0x581436['query']);_0x39cad1[_0x70ab('0x3b')]=_[_0x70ab('0x39')](_0x581436[_0x70ab('0x35')],qs[_0x70ab('0x3a')](_0x1582fd[_0x70ab('0x36')][_0x70ab('0x3a')]));_0x39cad1[_0x70ab('0x3b')]=_0x39cad1[_0x70ab('0x3b')][_0x70ab('0x3c')]?_0x39cad1[_0x70ab('0x3b')]:_0x581436[_0x70ab('0x35')];if(!_0x1582fd[_0x70ab('0x36')][_0x70ab('0x3d')](_0x70ab('0x3e'))){_0x39cad1['limit']=qs[_0x70ab('0x24')](_0x1582fd[_0x70ab('0x36')][_0x70ab('0x24')]);_0x39cad1[_0x70ab('0x22')]=qs[_0x70ab('0x22')](_0x1582fd['query'][_0x70ab('0x22')]);}_0x39cad1[_0x70ab('0x3f')]=qs[_0x70ab('0x40')](_0x1582fd['query']['sort']);_0x39cad1[_0x70ab('0x41')]=qs[_0x70ab('0x38')](_[_0x70ab('0x53')](_0x1582fd[_0x70ab('0x36')],_0x581436['filters']));if(_0x1582fd[_0x70ab('0x36')]['filter']){_0x39cad1[_0x70ab('0x41')]=_[_0x70ab('0x43')](_0x39cad1[_0x70ab('0x41')],{'$or':_[_0x70ab('0x44')](_0x39cad1[_0x70ab('0x3b')],function(_0x21a7bb){var _0x348d41={};_0x348d41[_0x21a7bb]={'$like':'%'+_0x1582fd[_0x70ab('0x36')]['filter']+'%'};return _0x348d41;})});}_0x39cad1=_['merge']({},_0x39cad1,_0x1582fd[_0x70ab('0x45')]);var _0x50b679={'where':_0x39cad1[_0x70ab('0x41')]};return db[_0x70ab('0x31')]['count'](_0x50b679)[_0x70ab('0x2a')](function(_0x16322a){_0x4a82c1['count']=_0x16322a;if(_0x1582fd[_0x70ab('0x36')][_0x70ab('0x46')]){_0x39cad1[_0x70ab('0x47')]=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x39cad1);})[_0x70ab('0x2a')](function(_0x18886c){_0x4a82c1[_0x70ab('0x49')]=_0x18886c;return _0x4a82c1;})[_0x70ab('0x2a')](respondWithFilteredResult(_0x5c9a60,_0x39cad1,_0x70ab('0x52')))[_0x70ab('0x4a')](handleError(_0x5c9a60,null,_0x70ab('0x52')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 0e1bfd7..b456f54 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 _0x75c2=['VoiceQueueReport','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2feb53,_0x264ef7){var _0x5700ee=function(_0x700c98){while(--_0x700c98){_0x2feb53['push'](_0x2feb53['shift']());}};_0x5700ee(++_0x264ef7);}(_0x75c2,0x1a0));var _0x275c=function(_0x38201f,_0x46c4e9){_0x38201f=_0x38201f-0x0;var _0x58e416=_0x75c2[_0x38201f];return _0x58e416;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require('../../mysqldb')['db'][_0x275c('0x0')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x275c('0x1')](0x0);var events={'afterCreate':_0x275c('0x2'),'afterUpdate':'update','afterDestroy':_0x275c('0x3')};function emitEvent(_0x4b4ed7){return function(_0x2e607b,_0x443f42,_0x1ed178){VoiceQueueReportEvents[_0x275c('0x4')](_0x4b4ed7+':'+_0x2e607b['id'],_0x2e607b);VoiceQueueReportEvents['emit'](_0x4b4ed7,_0x2e607b);_0x1ed178(null);};}for(var e in events){if(events[_0x275c('0x5')](e)){var event=events[e];VoiceQueueReport[_0x275c('0x6')](e,emitEvent(event));}}module[_0x275c('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x0f92=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x0f92,0x10d));var _0x20f9=function(_0x2ce7ae,_0x4f93d3){_0x2ce7ae=_0x2ce7ae-0x0;var _0x3cccf7=_0x0f92[_0x2ce7ae];return _0x3cccf7;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x20f9('0x0'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x20f9('0x1')](0x0);var events={'afterCreate':_0x20f9('0x2'),'afterUpdate':'update','afterDestroy':_0x20f9('0x3')};function emitEvent(_0x48f928){return function(_0x406691,_0x2f194a,_0x131b34){VoiceQueueReportEvents[_0x20f9('0x4')](_0x48f928+':'+_0x406691['id'],_0x406691);VoiceQueueReportEvents[_0x20f9('0x4')](_0x48f928,_0x406691);_0x131b34(null);};}for(var e in events){if(events[_0x20f9('0x5')](e)){var event=events[e];VoiceQueueReport[_0x20f9('0x6')](e,emitEvent(event));}}module[_0x20f9('0x7')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index ebffa5f..eb5eba1 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 _0xd16f=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','calleridnum'];(function(_0x2f6816,_0x3b76fe){var _0x275636=function(_0x421038){while(--_0x421038){_0x2f6816['push'](_0x2f6816['shift']());}};_0x275636(++_0x3b76fe);}(_0xd16f,0x12b));var _0xfd16=function(_0x90ba39,_0x2200a8){_0x90ba39=_0x90ba39-0x0;var _0x575f98=_0xd16f[_0x90ba39];return _0x575f98;};'use strict';var _=require('lodash');var util=require(_0xfd16('0x0'));var logger=require(_0xfd16('0x1'))(_0xfd16('0x2'));var moment=require(_0xfd16('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfd16('0x4'));var rimraf=require(_0xfd16('0x5'));var config=require(_0xfd16('0x6'));var attributes=require(_0xfd16('0x7'));module[_0xfd16('0x8')]=function(_0x13785e,_0x5d903b){return _0x13785e[_0xfd16('0x9')](_0xfd16('0xa'),attributes,{'tableName':_0xfd16('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0xfd16('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4a35=['report_queue','uniqueid','lodash','api','moment','request-promise','path','rimraf','VoiceQueueReport'];(function(_0x4b98d1,_0x211cc6){var _0x1fc164=function(_0x545655){while(--_0x545655){_0x4b98d1['push'](_0x4b98d1['shift']());}};_0x1fc164(++_0x211cc6);}(_0x4a35,0xb6));var _0x54a3=function(_0x2abfa7,_0x326812){_0x2abfa7=_0x2abfa7-0x0;var _0x4ef6ba=_0x4a35[_0x2abfa7];return _0x4ef6ba;};'use strict';var _=require(_0x54a3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x54a3('0x1'));var moment=require(_0x54a3('0x2'));var BPromise=require('bluebird');var rp=require(_0x54a3('0x3'));var fs=require('fs');var path=require(_0x54a3('0x4'));var rimraf=require(_0x54a3('0x5'));var config=require('../../config/environment');var attributes=require('./voiceQueueReport.attributes');module['exports']=function(_0x34ec5a,_0x22a056){return _0x34ec5a['define'](_0x54a3('0x6'),attributes,{'tableName':_0x54a3('0x7'),'paranoid':![],'indexes':[{'fields':[_0x54a3('0x8')]},{'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 ae731ee..a06143f 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 _0x8cfd=['util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','request\x20sent','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','limit','map','include','attributes','model','debug','CreateVoiceQueueReport','create','body','raw','where','UpdateVoiceQueueReport','lodash'];(function(_0x44c35f,_0x505867){var _0x4f7639=function(_0x308371){while(--_0x308371){_0x44c35f['push'](_0x44c35f['shift']());}};_0x4f7639(++_0x505867);}(_0x8cfd,0x133));var _0xd8cf=function(_0x4a80f6,_0x3d43ad){_0x4a80f6=_0x4a80f6-0x0;var _0x5bc762=_0x8cfd[_0x4a80f6];return _0x5bc762;};'use strict';var _=require(_0xd8cf('0x0'));var util=require(_0xd8cf('0x1'));var moment=require(_0xd8cf('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd8cf('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd8cf('0x4'));var logger=require(_0xd8cf('0x5'))(_0xd8cf('0x6'));var config=require(_0xd8cf('0x7'));var jayson=require(_0xd8cf('0x8'));var client=jayson[_0xd8cf('0x9')][_0xd8cf('0xa')]({'port':0x232a});config[_0xd8cf('0xb')]=_[_0xd8cf('0xc')](config[_0xd8cf('0xb')],{'host':_0xd8cf('0xd'),'port':0x18eb});var socket=require(_0xd8cf('0xe'))(new Redis(config['redis']));require(_0xd8cf('0xf'))[_0xd8cf('0x10')](socket);function respondWithRpcPromise(_0x49f011,_0x3e5aba,_0x3efa49){return new BPromise(function(_0x1197d9,_0x433350){return client[_0xd8cf('0x11')](_0x49f011,_0x3efa49)[_0xd8cf('0x12')](function(_0x4d547a){logger[_0xd8cf('0x13')]('VoiceQueueReport,\x20%s,\x20%s',_0x3e5aba,'request\x20sent');logger['debug']('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x3e5aba,'request\x20sent',JSON[_0xd8cf('0x14')](_0x4d547a));if(_0x4d547a['error']){if(_0x4d547a[_0xd8cf('0x15')][_0xd8cf('0x16')]===0x1f4){logger[_0xd8cf('0x15')](_0xd8cf('0x17'),_0x3e5aba,_0x4d547a[_0xd8cf('0x15')][_0xd8cf('0x18')]);return _0x433350(_0x4d547a[_0xd8cf('0x15')][_0xd8cf('0x18')]);}logger['error'](_0xd8cf('0x17'),_0x3e5aba,_0x4d547a[_0xd8cf('0x15')]['message']);return _0x1197d9(_0x4d547a['error'][_0xd8cf('0x18')]);}else{logger[_0xd8cf('0x13')](_0xd8cf('0x17'),_0x3e5aba,_0xd8cf('0x19'));_0x1197d9(_0x4d547a[_0xd8cf('0x1a')][_0xd8cf('0x18')]);}})[_0xd8cf('0x1b')](function(_0x4052ef){logger[_0xd8cf('0x15')](_0xd8cf('0x17'),_0x3e5aba,_0x4052ef);_0x433350(_0x4052ef);});});}exports[_0xd8cf('0x1c')]=function(_0x546d77){var _0x5ea8a7=this;return new Promise(function(_0x1c6bc6,_0x12dafd){return db[_0xd8cf('0x1d')][_0xd8cf('0x1e')]({'raw':_0x546d77[_0xd8cf('0x1f')]?_0x546d77['options']['raw']===undefined?!![]:![]:!![],'where':_0x546d77['options']?_0x546d77[_0xd8cf('0x1f')]['where']||null:null,'attributes':_0x546d77[_0xd8cf('0x1f')]?_0x546d77[_0xd8cf('0x1f')]['attributes']||null:null,'limit':_0x546d77[_0xd8cf('0x1f')]?_0x546d77[_0xd8cf('0x1f')][_0xd8cf('0x20')]||null:null,'include':_0x546d77[_0xd8cf('0x1f')]?_0x546d77[_0xd8cf('0x1f')]['include']?_[_0xd8cf('0x21')](_0x546d77[_0xd8cf('0x1f')][_0xd8cf('0x22')],function(_0x43761c){return{'model':db[_0x43761c['model']],'as':_0x43761c['as'],'attributes':_0x43761c[_0xd8cf('0x23')],'include':_0x43761c[_0xd8cf('0x22')]?_[_0xd8cf('0x21')](_0x43761c[_0xd8cf('0x22')],function(_0x12cfa7){return{'model':db[_0x12cfa7[_0xd8cf('0x24')]],'as':_0x12cfa7['as'],'attributes':_0x12cfa7['attributes'],'include':_0x12cfa7[_0xd8cf('0x22')]?_[_0xd8cf('0x21')](_0x12cfa7[_0xd8cf('0x22')],function(_0x398ded){return{'model':db[_0x398ded[_0xd8cf('0x24')]],'as':_0x398ded['as'],'attributes':_0x398ded[_0xd8cf('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f669a){logger[_0xd8cf('0x13')](_0xd8cf('0x1c'),_0x546d77);logger[_0xd8cf('0x25')](_0xd8cf('0x1c'),_0x546d77,JSON[_0xd8cf('0x14')](_0x2f669a));_0x1c6bc6(_0x2f669a);})['catch'](function(_0x3f4c72){logger['error'](_0xd8cf('0x1c'),_0x3f4c72['message'],_0x546d77);_0x12dafd(_0x5ea8a7[_0xd8cf('0x15')](0x1f4,_0x3f4c72[_0xd8cf('0x18')]));});});};exports[_0xd8cf('0x26')]=function(_0x415db1){var _0x21617a=this;return new Promise(function(_0x142950,_0x396e07){return db[_0xd8cf('0x1d')][_0xd8cf('0x27')](_0x415db1[_0xd8cf('0x28')],{'raw':_0x415db1[_0xd8cf('0x1f')]?_0x415db1[_0xd8cf('0x1f')][_0xd8cf('0x29')]===undefined?!![]:![]:!![]})[_0xd8cf('0x12')](function(_0x29e3cc){logger[_0xd8cf('0x13')](_0xd8cf('0x26'),_0x415db1);logger[_0xd8cf('0x25')](_0xd8cf('0x26'),_0x415db1,JSON['stringify'](_0x29e3cc));_0x142950(_0x29e3cc);})[_0xd8cf('0x1b')](function(_0xcf62f4){logger['error'](_0xd8cf('0x26'),_0xcf62f4[_0xd8cf('0x18')],_0x415db1);_0x396e07(_0x21617a[_0xd8cf('0x15')](0x1f4,_0xcf62f4['message']));});});};exports['UpdateVoiceQueueReport']=function(_0x3e095e){var _0x17ed14=this;return new Promise(function(_0x4216ee,_0x43a9bc){return db[_0xd8cf('0x1d')]['update'](_0x3e095e[_0xd8cf('0x28')],{'raw':_0x3e095e[_0xd8cf('0x1f')]?_0x3e095e[_0xd8cf('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e095e['options']?_0x3e095e[_0xd8cf('0x1f')][_0xd8cf('0x2a')]||null:null,'attributes':_0x3e095e[_0xd8cf('0x1f')]?_0x3e095e[_0xd8cf('0x1f')][_0xd8cf('0x23')]||null:null,'limit':_0x3e095e['options']?_0x3e095e[_0xd8cf('0x1f')][_0xd8cf('0x20')]||null:null})[_0xd8cf('0x12')](function(_0x243fb9){logger[_0xd8cf('0x13')](_0xd8cf('0x2b'),_0x3e095e);logger[_0xd8cf('0x25')](_0xd8cf('0x2b'),_0x3e095e,JSON[_0xd8cf('0x14')](_0x243fb9));_0x4216ee(_0x243fb9);})[_0xd8cf('0x1b')](function(_0x33933a){logger[_0xd8cf('0x15')](_0xd8cf('0x2b'),_0x33933a[_0xd8cf('0x18')],_0x3e095e);_0x43a9bc(_0x17ed14[_0xd8cf('0x15')](0x1f4,_0x33933a[_0xd8cf('0x18')]));});});}; \ No newline at end of file +var _0xffcd=['message','info','catch','GetVoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','debug','stringify','CreateVoiceQueueReport','VoiceQueueReport','create','body','UpdateVoiceQueueReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','request','then','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','VoiceQueueReport,\x20%s,\x20%s'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xffcd,0x185));var _0xdffc=function(_0x3bd0fe,_0x12e16e){_0x3bd0fe=_0x3bd0fe-0x0;var _0x431e8c=_0xffcd[_0x3bd0fe];return _0x431e8c;};'use strict';var _=require(_0xdffc('0x0'));var util=require(_0xdffc('0x1'));var moment=require(_0xdffc('0x2'));var BPromise=require(_0xdffc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdffc('0x4'));var db=require(_0xdffc('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xdffc('0x6'));var jayson=require(_0xdffc('0x7'));var client=jayson[_0xdffc('0x8')][_0xdffc('0x9')]({'port':0x232a});config[_0xdffc('0xa')]=_[_0xdffc('0xb')](config[_0xdffc('0xa')],{'host':_0xdffc('0xc'),'port':0x18eb});var socket=require(_0xdffc('0xd'))(new Redis(config[_0xdffc('0xa')]));require(_0xdffc('0xe'))['register'](socket);function respondWithRpcPromise(_0x331fff,_0xd5bf85,_0x3c5cf7){return new BPromise(function(_0x4f7dfa,_0x5e111d){return client[_0xdffc('0xf')](_0x331fff,_0x3c5cf7)[_0xdffc('0x10')](function(_0x330b69){logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0xd5bf85,'request\x20sent');logger['debug'](_0xdffc('0x11'),_0xd5bf85,_0xdffc('0x12'),JSON['stringify'](_0x330b69));if(_0x330b69[_0xdffc('0x13')]){if(_0x330b69[_0xdffc('0x13')]['code']===0x1f4){logger['error'](_0xdffc('0x14'),_0xd5bf85,_0x330b69[_0xdffc('0x13')][_0xdffc('0x15')]);return _0x5e111d(_0x330b69['error'][_0xdffc('0x15')]);}logger[_0xdffc('0x13')](_0xdffc('0x14'),_0xd5bf85,_0x330b69['error'][_0xdffc('0x15')]);return _0x4f7dfa(_0x330b69['error'][_0xdffc('0x15')]);}else{logger[_0xdffc('0x16')](_0xdffc('0x14'),_0xd5bf85,_0xdffc('0x12'));_0x4f7dfa(_0x330b69['result']['message']);}})[_0xdffc('0x17')](function(_0x70a2df){logger[_0xdffc('0x13')](_0xdffc('0x14'),_0xd5bf85,_0x70a2df);_0x5e111d(_0x70a2df);});});}exports[_0xdffc('0x18')]=function(_0x1668dc){var _0x586f05=this;return new Promise(function(_0x3f8ad4,_0x578463){return db['VoiceQueueReport'][_0xdffc('0x19')]({'raw':_0x1668dc[_0xdffc('0x1a')]?_0x1668dc[_0xdffc('0x1a')][_0xdffc('0x1b')]===undefined?!![]:![]:!![],'where':_0x1668dc[_0xdffc('0x1a')]?_0x1668dc[_0xdffc('0x1a')][_0xdffc('0x1c')]||null:null,'attributes':_0x1668dc[_0xdffc('0x1a')]?_0x1668dc[_0xdffc('0x1a')][_0xdffc('0x1d')]||null:null,'limit':_0x1668dc['options']?_0x1668dc[_0xdffc('0x1a')][_0xdffc('0x1e')]||null:null,'include':_0x1668dc[_0xdffc('0x1a')]?_0x1668dc[_0xdffc('0x1a')]['include']?_['map'](_0x1668dc[_0xdffc('0x1a')][_0xdffc('0x1f')],function(_0x2d1569){return{'model':db[_0x2d1569['model']],'as':_0x2d1569['as'],'attributes':_0x2d1569[_0xdffc('0x1d')],'include':_0x2d1569[_0xdffc('0x1f')]?_[_0xdffc('0x20')](_0x2d1569[_0xdffc('0x1f')],function(_0x3676b1){return{'model':db[_0x3676b1['model']],'as':_0x3676b1['as'],'attributes':_0x3676b1[_0xdffc('0x1d')],'include':_0x3676b1['include']?_['map'](_0x3676b1['include'],function(_0xac126){return{'model':db[_0xac126[_0xdffc('0x21')]],'as':_0xac126['as'],'attributes':_0xac126[_0xdffc('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xdffc('0x10')](function(_0x37e198){logger[_0xdffc('0x16')](_0xdffc('0x18'),_0x1668dc);logger[_0xdffc('0x22')](_0xdffc('0x18'),_0x1668dc,JSON[_0xdffc('0x23')](_0x37e198));_0x3f8ad4(_0x37e198);})[_0xdffc('0x17')](function(_0x1f782a){logger['error'](_0xdffc('0x18'),_0x1f782a[_0xdffc('0x15')],_0x1668dc);_0x578463(_0x586f05['error'](0x1f4,_0x1f782a['message']));});});};exports[_0xdffc('0x24')]=function(_0x1d9e60){var _0xdb1e2c=this;return new Promise(function(_0x430098,_0x4a1e97){return db[_0xdffc('0x25')][_0xdffc('0x26')](_0x1d9e60[_0xdffc('0x27')],{'raw':_0x1d9e60[_0xdffc('0x1a')]?_0x1d9e60[_0xdffc('0x1a')][_0xdffc('0x1b')]===undefined?!![]:![]:!![]})[_0xdffc('0x10')](function(_0x3ca41b){logger[_0xdffc('0x16')](_0xdffc('0x24'),_0x1d9e60);logger[_0xdffc('0x22')](_0xdffc('0x24'),_0x1d9e60,JSON[_0xdffc('0x23')](_0x3ca41b));_0x430098(_0x3ca41b);})[_0xdffc('0x17')](function(_0x9f7474){logger[_0xdffc('0x13')]('CreateVoiceQueueReport',_0x9f7474[_0xdffc('0x15')],_0x1d9e60);_0x4a1e97(_0xdb1e2c[_0xdffc('0x13')](0x1f4,_0x9f7474[_0xdffc('0x15')]));});});};exports[_0xdffc('0x28')]=function(_0xedb910){var _0x111820=this;return new Promise(function(_0xf7295d,_0x3f54d9){return db[_0xdffc('0x25')]['update'](_0xedb910[_0xdffc('0x27')],{'raw':_0xedb910[_0xdffc('0x1a')]?_0xedb910[_0xdffc('0x1a')][_0xdffc('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xedb910[_0xdffc('0x1a')]?_0xedb910[_0xdffc('0x1a')][_0xdffc('0x1c')]||null:null,'attributes':_0xedb910['options']?_0xedb910['options']['attributes']||null:null,'limit':_0xedb910[_0xdffc('0x1a')]?_0xedb910[_0xdffc('0x1a')]['limit']||null:null})['then'](function(_0x1d076f){logger[_0xdffc('0x16')](_0xdffc('0x28'),_0xedb910);logger['debug'](_0xdffc('0x28'),_0xedb910,JSON[_0xdffc('0x23')](_0x1d076f));_0xf7295d(_0x1d076f);})[_0xdffc('0x17')](function(_0x12e2d9){logger['error']('UpdateVoiceQueueReport',_0x12e2d9[_0xdffc('0x15')],_0xedb910);_0x3f54d9(_0x111820['error'](0x1f4,_0x12e2d9['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 3432e4e..9d6c739 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 _0xebfb=['voiceQueueReport:','save','removeListener','register','length'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xebfb,0x10a));var _0xbebf=function(_0x53ca7a,_0x152b01){_0x53ca7a=_0x53ca7a-0x0;var _0x168309=_0xebfb[_0x53ca7a];return _0x168309;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0xbebf('0x0'),'remove','update'];function createListener(_0x35ee4b,_0x546a74){return function(_0x218a69){_0x546a74['emit'](_0x35ee4b,_0x218a69);};}function removeListener(_0x3e68e2,_0x32e701){return function(){VoiceQueueReportEvents[_0xbebf('0x1')](_0x3e68e2,_0x32e701);};}exports[_0xbebf('0x2')]=function(_0x5c973b){for(var _0x315042=0x0,_0x5a976d=events[_0xbebf('0x3')];_0x315042<_0x5a976d;_0x315042++){var _0x267bd9=events[_0x315042];var _0x26dd18=createListener(_0xbebf('0x4')+_0x267bd9,_0x5c973b);VoiceQueueReportEvents['on'](_0x267bd9,_0x26dd18);}}; \ No newline at end of file +var _0x5057=['length','./voiceQueueReport.events','save','remove','emit','removeListener'];(function(_0x26abfc,_0x11db06){var _0xc48c12=function(_0x487737){while(--_0x487737){_0x26abfc['push'](_0x26abfc['shift']());}};_0xc48c12(++_0x11db06);}(_0x5057,0x151));var _0x7505=function(_0x3d867a,_0xef01ff){_0x3d867a=_0x3d867a-0x0;var _0x39e95a=_0x5057[_0x3d867a];return _0x39e95a;};'use strict';var VoiceQueueReportEvents=require(_0x7505('0x0'));var events=[_0x7505('0x1'),_0x7505('0x2'),'update'];function createListener(_0x25f187,_0x1db2e4){return function(_0x3a0a9e){_0x1db2e4[_0x7505('0x3')](_0x25f187,_0x3a0a9e);};}function removeListener(_0x4c1825,_0x1f6d07){return function(){VoiceQueueReportEvents[_0x7505('0x4')](_0x4c1825,_0x1f6d07);};}exports['register']=function(_0x28aadb){for(var _0x3dd50c=0x0,_0x288914=events[_0x7505('0x5')];_0x3dd50c<_0x288914;_0x3dd50c++){var _0x254212=events[_0x3dd50c];var _0x2f2772=createListener('voiceQueueReport:'+_0x254212,_0x28aadb);VoiceQueueReportEvents['on'](_0x254212,_0x2f2772);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 694b0ab..2e1f826 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 _0xf4dd=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./voiceQueuesLog.controller','isAuthenticated','get','post','create','/:id','update','delete','destroy','exports'];(function(_0x180f2b,_0x4ce4fd){var _0x9a8472=function(_0xba6ac7){while(--_0xba6ac7){_0x180f2b['push'](_0x180f2b['shift']());}};_0x9a8472(++_0x4ce4fd);}(_0xf4dd,0xb4));var _0xdf4d=function(_0x2b5468,_0x3bbcfd){_0x2b5468=_0x2b5468-0x0;var _0x45f396=_0xf4dd[_0x2b5468];return _0x45f396;};'use strict';var multer=require(_0xdf4d('0x0'));var util=require(_0xdf4d('0x1'));var path=require(_0xdf4d('0x2'));var timeout=require(_0xdf4d('0x3'));var express=require(_0xdf4d('0x4'));var router=express[_0xdf4d('0x5')]();var fs_extra=require(_0xdf4d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xdf4d('0x7'));var config=require('../../config/environment');var controller=require(_0xdf4d('0x8'));router['get']('/',auth[_0xdf4d('0x9')](),controller['index']);router[_0xdf4d('0xa')]('/:id',auth[_0xdf4d('0x9')](),controller['show']);router[_0xdf4d('0xb')]('/',auth[_0xdf4d('0x9')](),controller[_0xdf4d('0xc')]);router['put'](_0xdf4d('0xd'),auth[_0xdf4d('0x9')](),controller[_0xdf4d('0xe')]);router[_0xdf4d('0xf')](_0xdf4d('0xd'),auth[_0xdf4d('0x9')](),controller[_0xdf4d('0x10')]);module[_0xdf4d('0x11')]=router; \ No newline at end of file +var _0xf757=['../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','show','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x406d8c,_0x1f8337){var _0x4d9024=function(_0x1bef5c){while(--_0x1bef5c){_0x406d8c['push'](_0x406d8c['shift']());}};_0x4d9024(++_0x1f8337);}(_0xf757,0x89));var _0x7f75=function(_0x2431d6,_0x25189a){_0x2431d6=_0x2431d6-0x0;var _0x4d0f9b=_0xf757[_0x2431d6];return _0x4d0f9b;};'use strict';var multer=require(_0x7f75('0x0'));var util=require(_0x7f75('0x1'));var path=require(_0x7f75('0x2'));var timeout=require(_0x7f75('0x3'));var express=require(_0x7f75('0x4'));var router=express[_0x7f75('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7f75('0x6'));var interaction=require(_0x7f75('0x7'));var config=require(_0x7f75('0x8'));var controller=require(_0x7f75('0x9'));router[_0x7f75('0xa')]('/',auth[_0x7f75('0xb')](),controller['index']);router[_0x7f75('0xa')]('/:id',auth[_0x7f75('0xb')](),controller[_0x7f75('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x7f75('0xd')](_0x7f75('0xe'),auth[_0x7f75('0xb')](),controller[_0x7f75('0xf')]);router[_0x7f75('0x10')](_0x7f75('0xe'),auth[_0x7f75('0xb')](),controller['destroy']);module[_0x7f75('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 51363bc..afd4f41 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 _0x1921=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment','STRING','DATE'];(function(_0xda8f68,_0x424fe5){var _0x1b09b7=function(_0xdd9c21){while(--_0xdd9c21){_0xda8f68['push'](_0xda8f68['shift']());}};_0x1b09b7(++_0x424fe5);}(_0x1921,0x1b9));var _0x1192=function(_0x2e4547,_0x14de13){_0x2e4547=_0x2e4547-0x0;var _0x1fa88b=_0x1921[_0x2e4547];return _0x1fa88b;};'use strict';var Sequelize=require(_0x1192('0x0'));var moment=require(_0x1192('0x1'));module['exports']={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x1192('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x1192('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x1192('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x1192('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x1192('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x1192('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x1192('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x1192('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x1192('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x1192('0x3')],'allowNull':![],'defaultValue':Sequelize['literal'](_0x1192('0x4'))}}; \ No newline at end of file +var _0xd87d=['exports','STRING','DATE','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize'];(function(_0x56a7c4,_0x28da10){var _0x5154dc=function(_0x29e676){while(--_0x29e676){_0x56a7c4['push'](_0x56a7c4['shift']());}};_0x5154dc(++_0x28da10);}(_0xd87d,0xdb));var _0xdd87=function(_0x5ed971,_0x23031b){_0x5ed971=_0x5ed971-0x0;var _0x5d8ed2=_0xd87d[_0x5ed971];return _0x5d8ed2;};'use strict';var Sequelize=require(_0xdd87('0x0'));var moment=require('moment');module[_0xdd87('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0xdd87('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xdd87('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xdd87('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xdd87('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xdd87('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xdd87('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xdd87('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xdd87('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xdd87('0x3')],'allowNull':![],'defaultValue':Sequelize['literal'](_0xdd87('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index be2c1f0..a391468 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 _0xa6c2=['keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','VoiceQueuesLog','include','findAll','rows','show','params','rawAttributes','catch','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','fieldName','type','key','model','query'];(function(_0x22b0cb,_0x5a764a){var _0x444178=function(_0x5aed3d){while(--_0x5aed3d){_0x22b0cb['push'](_0x22b0cb['shift']());}};_0x444178(++_0x5a764a);}(_0xa6c2,0xf2));var _0x2a6c=function(_0x2ce9c3,_0x20a165){_0x2ce9c3=_0x2ce9c3-0x0;var _0x109b3a=_0xa6c2[_0x2ce9c3];return _0x109b3a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2a6c('0x0'));var zipdir=require(_0x2a6c('0x1'));var jsonpatch=require(_0x2a6c('0x2'));var rp=require(_0x2a6c('0x3'));var moment=require(_0x2a6c('0x4'));var BPromise=require(_0x2a6c('0x5'));var Mustache=require(_0x2a6c('0x6'));var util=require(_0x2a6c('0x7'));var path=require('path');var sox=require(_0x2a6c('0x8'));var csv=require(_0x2a6c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2a6c('0xa'));var squel=require('squel');var crypto=require(_0x2a6c('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2a6c('0xc'));var Papa=require(_0x2a6c('0xd'));var Redis=require(_0x2a6c('0xe'));var authService=require(_0x2a6c('0xf'));var qs=require(_0x2a6c('0x10'));var as=require(_0x2a6c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2a6c('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2a6c('0x13'));var db=require(_0x2a6c('0x14'))['db'];function respondWithStatusCode(_0x4e6687,_0x2c6f45){_0x2c6f45=_0x2c6f45||0xcc;return function(_0x2ddb3e){if(_0x2ddb3e){return _0x4e6687[_0x2a6c('0x15')](_0x2c6f45);}return _0x4e6687[_0x2a6c('0x16')](_0x2c6f45)[_0x2a6c('0x17')]();};}function respondWithResult(_0x258432,_0x2005f4){_0x2005f4=_0x2005f4||0xc8;return function(_0x38f442){if(_0x38f442){return _0x258432[_0x2a6c('0x16')](_0x2005f4)[_0x2a6c('0x18')](_0x38f442);}};}function respondWithFilteredResult(_0x569471,_0xbf66d0){return function(_0x5ed274){if(_0x5ed274){var _0x46ccbf=typeof _0xbf66d0[_0x2a6c('0x19')]===_0x2a6c('0x1a')&&typeof _0xbf66d0[_0x2a6c('0x1b')]===_0x2a6c('0x1a');var _0x5afb85=_0x5ed274['count'];var _0x5445a0=_0x46ccbf?0x0:_0xbf66d0[_0x2a6c('0x19')];var _0x22f759=_0x46ccbf?_0x5ed274[_0x2a6c('0x1c')]:_0xbf66d0[_0x2a6c('0x19')]+_0xbf66d0['limit'];var _0x17090f;if(_0x22f759>=_0x5afb85){_0x22f759=_0x5afb85;_0x17090f=0xc8;}else{_0x17090f=0xce;}_0x569471[_0x2a6c('0x16')](_0x17090f);return _0x569471[_0x2a6c('0x1d')]('Content-Range',_0x5445a0+'-'+_0x22f759+'/'+_0x5afb85)[_0x2a6c('0x18')](_0x5ed274);}return null;};}function patchUpdates(_0x1a3d2c){return function(_0x173b18){try{jsonpatch[_0x2a6c('0x1e')](_0x173b18,_0x1a3d2c,!![]);}catch(_0x447c64){return BPromise[_0x2a6c('0x1f')](_0x447c64);}return _0x173b18[_0x2a6c('0x20')]();};}function saveUpdates(_0x34ef7c,_0x4b41d3){return function(_0x531c69){if(_0x531c69){return _0x531c69[_0x2a6c('0x21')](_0x34ef7c)[_0x2a6c('0x22')](function(_0x3904eb){return _0x3904eb;});}return null;};}function removeEntity(_0x539e49,_0x40d184){return function(_0x3cfb5d){if(_0x3cfb5d){return _0x3cfb5d[_0x2a6c('0x23')]()['then'](function(){_0x539e49[_0x2a6c('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5dd5a9,_0x2340c1){return function(_0x1a5697){if(!_0x1a5697){_0x5dd5a9['sendStatus'](0x194);}return _0x1a5697;};}function handleError(_0x4d419c,_0x6d30e){_0x6d30e=_0x6d30e||0x1f4;return function(_0x1b4864){logger['error'](_0x1b4864[_0x2a6c('0x24')]);if(_0x1b4864[_0x2a6c('0x25')]){delete _0x1b4864['name'];}_0x4d419c[_0x2a6c('0x16')](_0x6d30e)[_0x2a6c('0x26')](_0x1b4864);};}exports[_0x2a6c('0x27')]=function(_0xebd38a,_0x74ede8){var _0x42152a={},_0x4bfb77={},_0x4122e7={'count':0x0,'rows':[]};var _0x8b392a=_[_0x2a6c('0x28')](db['VoiceQueuesLog']['rawAttributes'],function(_0x465865){return{'name':_0x465865[_0x2a6c('0x29')],'type':_0x465865[_0x2a6c('0x2a')][_0x2a6c('0x2b')]};});_0x4bfb77[_0x2a6c('0x2c')]=_[_0x2a6c('0x28')](_0x8b392a,_0x2a6c('0x25'));_0x4bfb77[_0x2a6c('0x2d')]=_[_0x2a6c('0x2e')](_0xebd38a['query']);_0x4bfb77[_0x2a6c('0x2f')]=_[_0x2a6c('0x30')](_0x4bfb77[_0x2a6c('0x2c')],_0x4bfb77['query']);_0x42152a['attributes']=_[_0x2a6c('0x30')](_0x4bfb77[_0x2a6c('0x2c')],qs[_0x2a6c('0x31')](_0xebd38a[_0x2a6c('0x2d')][_0x2a6c('0x31')]));_0x42152a[_0x2a6c('0x32')]=_0x42152a['attributes'][_0x2a6c('0x33')]?_0x42152a[_0x2a6c('0x32')]:_0x4bfb77[_0x2a6c('0x2c')];if(!_0xebd38a[_0x2a6c('0x2d')][_0x2a6c('0x34')](_0x2a6c('0x35'))){_0x42152a[_0x2a6c('0x1b')]=qs[_0x2a6c('0x1b')](_0xebd38a[_0x2a6c('0x2d')][_0x2a6c('0x1b')]);_0x42152a[_0x2a6c('0x19')]=qs['offset'](_0xebd38a[_0x2a6c('0x2d')][_0x2a6c('0x19')]);}_0x42152a[_0x2a6c('0x36')]=qs[_0x2a6c('0x37')](_0xebd38a[_0x2a6c('0x2d')][_0x2a6c('0x37')]);_0x42152a[_0x2a6c('0x38')]=qs[_0x2a6c('0x2f')](_[_0x2a6c('0x39')](_0xebd38a[_0x2a6c('0x2d')],_0x4bfb77[_0x2a6c('0x2f')]),_0x8b392a);if(_0xebd38a['query'][_0x2a6c('0x3a')]){_0x42152a[_0x2a6c('0x38')]=_[_0x2a6c('0x3b')](_0x42152a[_0x2a6c('0x38')],{'$or':_[_0x2a6c('0x28')](_0x8b392a,function(_0x2f1b40){if(_0x2f1b40['type']!==_0x2a6c('0x3c')){var _0xcabe95={};_0xcabe95[_0x2f1b40[_0x2a6c('0x25')]]={'$like':'%'+_0xebd38a['query'][_0x2a6c('0x3a')]+'%'};return _0xcabe95;}})});}_0x42152a=_[_0x2a6c('0x3b')]({},_0x42152a,_0xebd38a['options']);var _0x4e2050={'where':_0x42152a[_0x2a6c('0x38')]};return db[_0x2a6c('0x3d')][_0x2a6c('0x1c')](_0x4e2050)['then'](function(_0x25deb8){_0x4122e7[_0x2a6c('0x1c')]=_0x25deb8;if(_0xebd38a[_0x2a6c('0x2d')]['includeAll']){_0x42152a[_0x2a6c('0x3e')]=[{'all':!![]}];}return db[_0x2a6c('0x3d')][_0x2a6c('0x3f')](_0x42152a);})[_0x2a6c('0x22')](function(_0x1e315d){_0x4122e7[_0x2a6c('0x40')]=_0x1e315d;return _0x4122e7;})[_0x2a6c('0x22')](respondWithFilteredResult(_0x74ede8,_0x42152a))['catch'](handleError(_0x74ede8,null));};exports[_0x2a6c('0x41')]=function(_0x369cb0,_0x3dfc39){var _0x27273c={'raw':!![],'where':{'id':_0x369cb0[_0x2a6c('0x42')]['id']}},_0x1a99a2={};_0x1a99a2[_0x2a6c('0x2c')]=_[_0x2a6c('0x2e')](db[_0x2a6c('0x3d')][_0x2a6c('0x43')]);_0x1a99a2[_0x2a6c('0x2d')]=_[_0x2a6c('0x2e')](_0x369cb0['query']);_0x1a99a2[_0x2a6c('0x2f')]=_[_0x2a6c('0x30')](_0x1a99a2[_0x2a6c('0x2c')],_0x1a99a2[_0x2a6c('0x2d')]);_0x27273c[_0x2a6c('0x32')]=_[_0x2a6c('0x30')](_0x1a99a2['model'],qs[_0x2a6c('0x31')](_0x369cb0[_0x2a6c('0x2d')][_0x2a6c('0x31')]));_0x27273c[_0x2a6c('0x32')]=_0x27273c[_0x2a6c('0x32')][_0x2a6c('0x33')]?_0x27273c[_0x2a6c('0x32')]:_0x1a99a2[_0x2a6c('0x2c')];if(_0x369cb0[_0x2a6c('0x2d')]['includeAll']){_0x27273c[_0x2a6c('0x3e')]=[{'all':!![]}];}_0x27273c=_[_0x2a6c('0x3b')]({},_0x27273c,_0x369cb0['options']);return db[_0x2a6c('0x3d')]['find'](_0x27273c)['then'](handleEntityNotFound(_0x3dfc39,null))[_0x2a6c('0x22')](respondWithResult(_0x3dfc39,null))[_0x2a6c('0x44')](handleError(_0x3dfc39,null));};exports[_0x2a6c('0x45')]=function(_0x1849e1,_0xe48dcb){return db[_0x2a6c('0x3d')]['create'](_0x1849e1[_0x2a6c('0x46')],{})[_0x2a6c('0x22')](respondWithResult(_0xe48dcb,0xc9))['catch'](handleError(_0xe48dcb,null));};exports['update']=function(_0xc352fa,_0x40be87){if(_0xc352fa[_0x2a6c('0x46')]['id']){delete _0xc352fa[_0x2a6c('0x46')]['id'];}return db[_0x2a6c('0x3d')]['find']({'where':{'id':_0xc352fa['params']['id']}})[_0x2a6c('0x22')](handleEntityNotFound(_0x40be87,null))[_0x2a6c('0x22')](saveUpdates(_0xc352fa[_0x2a6c('0x46')],null))[_0x2a6c('0x22')](respondWithResult(_0x40be87,null))['catch'](handleError(_0x40be87,null));};exports['destroy']=function(_0x9335cd,_0x1fc462){return db['VoiceQueuesLog'][_0x2a6c('0x47')]({'where':{'id':_0x9335cd[_0x2a6c('0x42')]['id']}})[_0x2a6c('0x22')](handleEntityNotFound(_0x1fc462,null))[_0x2a6c('0x22')](removeEntity(_0x1fc462,null))[_0x2a6c('0x44')](handleError(_0x1fc462,null));}; \ No newline at end of file +var _0x85c1=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','options','includeAll','findAll','rows','catch','show','params','rawAttributes','find','create','body','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceQueuesLog','fieldName'];(function(_0x255c48,_0x2a4449){var _0xaebda3=function(_0x12a04e){while(--_0x12a04e){_0x255c48['push'](_0x255c48['shift']());}};_0xaebda3(++_0x2a4449);}(_0x85c1,0xb3));var _0x185c=function(_0x40ddc0,_0x41c082){_0x40ddc0=_0x40ddc0-0x0;var _0x1aebf1=_0x85c1[_0x40ddc0];return _0x1aebf1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x185c('0x0'));var zipdir=require(_0x185c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x185c('0x2'));var moment=require(_0x185c('0x3'));var BPromise=require(_0x185c('0x4'));var Mustache=require('mustache');var util=require(_0x185c('0x5'));var path=require(_0x185c('0x6'));var sox=require(_0x185c('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x185c('0x8'));var crypto=require(_0x185c('0x9'));var jsforce=require(_0x185c('0xa'));var deskjs=require(_0x185c('0xb'));var toCsv=require(_0x185c('0xc'));var querystring=require('querystring');var Papa=require(_0x185c('0xd'));var Redis=require(_0x185c('0xe'));var authService=require(_0x185c('0xf'));var qs=require(_0x185c('0x10'));var as=require(_0x185c('0x11'));var hardwareService=require(_0x185c('0x12'));var logger=require(_0x185c('0x13'))('api');var utils=require(_0x185c('0x14'));var config=require(_0x185c('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17470d,_0x133198){_0x133198=_0x133198||0xcc;return function(_0x18d6aa){if(_0x18d6aa){return _0x17470d['sendStatus'](_0x133198);}return _0x17470d[_0x185c('0x16')](_0x133198)[_0x185c('0x17')]();};}function respondWithResult(_0x16bea4,_0x819de9){_0x819de9=_0x819de9||0xc8;return function(_0x56499a){if(_0x56499a){return _0x16bea4[_0x185c('0x16')](_0x819de9)[_0x185c('0x18')](_0x56499a);}};}function respondWithFilteredResult(_0x39a015,_0x9968f){return function(_0x457e5e){if(_0x457e5e){var _0x2b66ca=typeof _0x9968f[_0x185c('0x19')]===_0x185c('0x1a')&&typeof _0x9968f[_0x185c('0x1b')]===_0x185c('0x1a');var _0x386f23=_0x457e5e[_0x185c('0x1c')];var _0x297f7c=_0x2b66ca?0x0:_0x9968f[_0x185c('0x19')];var _0x29598b=_0x2b66ca?_0x457e5e[_0x185c('0x1c')]:_0x9968f['offset']+_0x9968f['limit'];var _0xf79a54;if(_0x29598b>=_0x386f23){_0x29598b=_0x386f23;_0xf79a54=0xc8;}else{_0xf79a54=0xce;}_0x39a015['status'](_0xf79a54);return _0x39a015[_0x185c('0x1d')](_0x185c('0x1e'),_0x297f7c+'-'+_0x29598b+'/'+_0x386f23)[_0x185c('0x18')](_0x457e5e);}return null;};}function patchUpdates(_0x2429e8){return function(_0x350e54){try{jsonpatch[_0x185c('0x1f')](_0x350e54,_0x2429e8,!![]);}catch(_0x3f3f85){return BPromise[_0x185c('0x20')](_0x3f3f85);}return _0x350e54[_0x185c('0x21')]();};}function saveUpdates(_0x4b1dfc,_0x26f72c){return function(_0x29d9f0){if(_0x29d9f0){return _0x29d9f0[_0x185c('0x22')](_0x4b1dfc)[_0x185c('0x23')](function(_0x59ca64){return _0x59ca64;});}return null;};}function removeEntity(_0x30fa18,_0x4eaa89){return function(_0x361414){if(_0x361414){return _0x361414[_0x185c('0x24')]()[_0x185c('0x23')](function(){_0x30fa18[_0x185c('0x16')](0xcc)[_0x185c('0x17')]();});}};}function handleEntityNotFound(_0xe76aac,_0x478927){return function(_0x506704){if(!_0x506704){_0xe76aac[_0x185c('0x25')](0x194);}return _0x506704;};}function handleError(_0x53d1d0,_0x237a7c){_0x237a7c=_0x237a7c||0x1f4;return function(_0x2941b3){logger[_0x185c('0x26')](_0x2941b3[_0x185c('0x27')]);if(_0x2941b3[_0x185c('0x28')]){delete _0x2941b3[_0x185c('0x28')];}_0x53d1d0[_0x185c('0x16')](_0x237a7c)[_0x185c('0x29')](_0x2941b3);};}exports[_0x185c('0x2a')]=function(_0x162f1e,_0x83a8e3){var _0x13accf={},_0x35cdd8={},_0x4a7612={'count':0x0,'rows':[]};var _0x1c3c21=_[_0x185c('0x2b')](db[_0x185c('0x2c')]['rawAttributes'],function(_0x44ed91){return{'name':_0x44ed91[_0x185c('0x2d')],'type':_0x44ed91['type'][_0x185c('0x2e')]};});_0x35cdd8[_0x185c('0x2f')]=_[_0x185c('0x2b')](_0x1c3c21,_0x185c('0x28'));_0x35cdd8[_0x185c('0x30')]=_[_0x185c('0x31')](_0x162f1e[_0x185c('0x30')]);_0x35cdd8[_0x185c('0x32')]=_[_0x185c('0x33')](_0x35cdd8['model'],_0x35cdd8[_0x185c('0x30')]);_0x13accf[_0x185c('0x34')]=_[_0x185c('0x33')](_0x35cdd8['model'],qs[_0x185c('0x35')](_0x162f1e['query']['fields']));_0x13accf[_0x185c('0x34')]=_0x13accf[_0x185c('0x34')][_0x185c('0x36')]?_0x13accf[_0x185c('0x34')]:_0x35cdd8[_0x185c('0x2f')];if(!_0x162f1e[_0x185c('0x30')][_0x185c('0x37')](_0x185c('0x38'))){_0x13accf[_0x185c('0x1b')]=qs[_0x185c('0x1b')](_0x162f1e[_0x185c('0x30')][_0x185c('0x1b')]);_0x13accf[_0x185c('0x19')]=qs[_0x185c('0x19')](_0x162f1e['query'][_0x185c('0x19')]);}_0x13accf[_0x185c('0x39')]=qs[_0x185c('0x3a')](_0x162f1e[_0x185c('0x30')]['sort']);_0x13accf['where']=qs[_0x185c('0x32')](_[_0x185c('0x3b')](_0x162f1e[_0x185c('0x30')],_0x35cdd8[_0x185c('0x32')]),_0x1c3c21);if(_0x162f1e[_0x185c('0x30')][_0x185c('0x3c')]){_0x13accf[_0x185c('0x3d')]=_[_0x185c('0x3e')](_0x13accf[_0x185c('0x3d')],{'$or':_[_0x185c('0x2b')](_0x1c3c21,function(_0x1e3a70){if(_0x1e3a70[_0x185c('0x3f')]!=='VIRTUAL'){var _0x19cb1a={};_0x19cb1a[_0x1e3a70[_0x185c('0x28')]]={'$like':'%'+_0x162f1e[_0x185c('0x30')][_0x185c('0x3c')]+'%'};return _0x19cb1a;}})});}_0x13accf=_[_0x185c('0x3e')]({},_0x13accf,_0x162f1e[_0x185c('0x40')]);var _0x37f98c={'where':_0x13accf[_0x185c('0x3d')]};return db['VoiceQueuesLog'][_0x185c('0x1c')](_0x37f98c)['then'](function(_0x2c5894){_0x4a7612[_0x185c('0x1c')]=_0x2c5894;if(_0x162f1e[_0x185c('0x30')][_0x185c('0x41')]){_0x13accf['include']=[{'all':!![]}];}return db[_0x185c('0x2c')][_0x185c('0x42')](_0x13accf);})[_0x185c('0x23')](function(_0x3c755){_0x4a7612[_0x185c('0x43')]=_0x3c755;return _0x4a7612;})[_0x185c('0x23')](respondWithFilteredResult(_0x83a8e3,_0x13accf))[_0x185c('0x44')](handleError(_0x83a8e3,null));};exports[_0x185c('0x45')]=function(_0x2d9f97,_0x3546f3){var _0x723256={'raw':!![],'where':{'id':_0x2d9f97[_0x185c('0x46')]['id']}},_0x29cd9d={};_0x29cd9d[_0x185c('0x2f')]=_['keys'](db[_0x185c('0x2c')][_0x185c('0x47')]);_0x29cd9d[_0x185c('0x30')]=_[_0x185c('0x31')](_0x2d9f97[_0x185c('0x30')]);_0x29cd9d['filters']=_[_0x185c('0x33')](_0x29cd9d[_0x185c('0x2f')],_0x29cd9d['query']);_0x723256[_0x185c('0x34')]=_[_0x185c('0x33')](_0x29cd9d[_0x185c('0x2f')],qs[_0x185c('0x35')](_0x2d9f97['query']['fields']));_0x723256[_0x185c('0x34')]=_0x723256[_0x185c('0x34')][_0x185c('0x36')]?_0x723256[_0x185c('0x34')]:_0x29cd9d[_0x185c('0x2f')];if(_0x2d9f97[_0x185c('0x30')]['includeAll']){_0x723256['include']=[{'all':!![]}];}_0x723256=_[_0x185c('0x3e')]({},_0x723256,_0x2d9f97[_0x185c('0x40')]);return db[_0x185c('0x2c')][_0x185c('0x48')](_0x723256)[_0x185c('0x23')](handleEntityNotFound(_0x3546f3,null))[_0x185c('0x23')](respondWithResult(_0x3546f3,null))[_0x185c('0x44')](handleError(_0x3546f3,null));};exports[_0x185c('0x49')]=function(_0x5e2244,_0x487c16){return db[_0x185c('0x2c')]['create'](_0x5e2244[_0x185c('0x4a')],{})[_0x185c('0x23')](respondWithResult(_0x487c16,0xc9))['catch'](handleError(_0x487c16,null));};exports['update']=function(_0x596606,_0x5095c5){if(_0x596606[_0x185c('0x4a')]['id']){delete _0x596606['body']['id'];}return db[_0x185c('0x2c')][_0x185c('0x48')]({'where':{'id':_0x596606[_0x185c('0x46')]['id']}})[_0x185c('0x23')](handleEntityNotFound(_0x5095c5,null))[_0x185c('0x23')](saveUpdates(_0x596606[_0x185c('0x4a')],null))[_0x185c('0x23')](respondWithResult(_0x5095c5,null))[_0x185c('0x44')](handleError(_0x5095c5,null));};exports[_0x185c('0x24')]=function(_0x5eb480,_0x50043b){return db['VoiceQueuesLog'][_0x185c('0x48')]({'where':{'id':_0x5eb480[_0x185c('0x46')]['id']}})['then'](handleEntityNotFound(_0x50043b,null))[_0x185c('0x23')](removeEntity(_0x50043b,null))[_0x185c('0x44')](handleError(_0x50043b,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 8641ae1..ecfb7b6 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 _0xeeaf=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceQueuesLog.attributes','VoiceQueuesLog','dtm'];(function(_0x3e7501,_0x3d72fa){var _0x486e59=function(_0x4a702a){while(--_0x4a702a){_0x3e7501['push'](_0x3e7501['shift']());}};_0x486e59(++_0x3d72fa);}(_0xeeaf,0x1bc));var _0xfeea=function(_0x52aa9f,_0x2b6455){_0x52aa9f=_0x52aa9f-0x0;var _0x304d4d=_0xeeaf[_0x52aa9f];return _0x304d4d;};'use strict';var _=require(_0xfeea('0x0'));var util=require(_0xfeea('0x1'));var logger=require(_0xfeea('0x2'))(_0xfeea('0x3'));var moment=require(_0xfeea('0x4'));var BPromise=require(_0xfeea('0x5'));var rp=require(_0xfeea('0x6'));var fs=require('fs');var path=require(_0xfeea('0x7'));var rimraf=require('rimraf');var config=require(_0xfeea('0x8'));var attributes=require(_0xfeea('0x9'));module['exports']=function(_0x9bc1d7,_0x4b1f35){return _0x9bc1d7['define'](_0xfeea('0xa'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':'event_dtm','fields':['event',_0xfeea('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7cb9=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','event_dtm','event'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x7cb9,0x160));var _0x97cb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7cb9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x97cb('0x0'));var util=require(_0x97cb('0x1'));var logger=require(_0x97cb('0x2'))(_0x97cb('0x3'));var moment=require(_0x97cb('0x4'));var BPromise=require(_0x97cb('0x5'));var rp=require(_0x97cb('0x6'));var fs=require('fs');var path=require(_0x97cb('0x7'));var rimraf=require(_0x97cb('0x8'));var config=require(_0x97cb('0x9'));var attributes=require(_0x97cb('0xa'));module[_0x97cb('0xb')]=function(_0xdb0455,_0xde1ce1){return _0xdb0455[_0x97cb('0xc')](_0x97cb('0xd'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x97cb('0xe'),'fields':[_0x97cb('0xf'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index e1f97f1..e8087f9 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 _0xaa12=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','ioredis'];(function(_0x352e09,_0x37a7da){var _0x1b7094=function(_0x561074){while(--_0x561074){_0x352e09['push'](_0x352e09['shift']());}};_0x1b7094(++_0x37a7da);}(_0xaa12,0xec));var _0x2aa1=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xaa12[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x2aa1('0x0'));var util=require('util');var moment=require(_0x2aa1('0x1'));var BPromise=require(_0x2aa1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2aa1('0x3'));var db=require(_0x2aa1('0x4'))['db'];var utils=require(_0x2aa1('0x5'));var logger=require(_0x2aa1('0x6'))(_0x2aa1('0x7'));var config=require(_0x2aa1('0x8'));var jayson=require(_0x2aa1('0x9'));var client=jayson[_0x2aa1('0xa')][_0x2aa1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x434daf,_0x5100e0,_0x23a396){return new BPromise(function(_0x1e3c57,_0x5d6eb3){return client[_0x2aa1('0xc')](_0x434daf,_0x23a396)[_0x2aa1('0xd')](function(_0xe0f97e){logger[_0x2aa1('0xe')](_0x2aa1('0xf'),_0x5100e0,_0x2aa1('0x10'));logger[_0x2aa1('0x11')](_0x2aa1('0x12'),_0x5100e0,_0x2aa1('0x10'),JSON['stringify'](_0xe0f97e));if(_0xe0f97e['error']){if(_0xe0f97e[_0x2aa1('0x13')][_0x2aa1('0x14')]===0x1f4){logger[_0x2aa1('0x13')]('VoiceQueuesLog,\x20%s,\x20%s',_0x5100e0,_0xe0f97e[_0x2aa1('0x13')]['message']);return _0x5d6eb3(_0xe0f97e[_0x2aa1('0x13')][_0x2aa1('0x15')]);}logger['error'](_0x2aa1('0xf'),_0x5100e0,_0xe0f97e[_0x2aa1('0x13')][_0x2aa1('0x15')]);return _0x1e3c57(_0xe0f97e[_0x2aa1('0x13')][_0x2aa1('0x15')]);}else{logger[_0x2aa1('0xe')](_0x2aa1('0xf'),_0x5100e0,_0x2aa1('0x10'));_0x1e3c57(_0xe0f97e[_0x2aa1('0x16')][_0x2aa1('0x15')]);}})[_0x2aa1('0x17')](function(_0x3cbd9c){logger[_0x2aa1('0x13')](_0x2aa1('0xf'),_0x5100e0,_0x3cbd9c);_0x5d6eb3(_0x3cbd9c);});});} \ No newline at end of file +var _0x1978=['request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x5bdf6c,_0x1fdb2d){var _0x471704=function(_0x56a320){while(--_0x56a320){_0x5bdf6c['push'](_0x5bdf6c['shift']());}};_0x471704(++_0x1fdb2d);}(_0x1978,0x174));var _0x8197=function(_0x3a828f,_0x92bc55){_0x3a828f=_0x3a828f-0x0;var _0xb4590=_0x1978[_0x3a828f];return _0xb4590;};'use strict';var _=require('lodash');var util=require(_0x8197('0x0'));var moment=require(_0x8197('0x1'));var BPromise=require(_0x8197('0x2'));var rs=require(_0x8197('0x3'));var fs=require('fs');var Redis=require(_0x8197('0x4'));var db=require(_0x8197('0x5'))['db'];var utils=require(_0x8197('0x6'));var logger=require(_0x8197('0x7'))(_0x8197('0x8'));var config=require(_0x8197('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8197('0xa')][_0x8197('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x117bf1,_0x374969,_0x3e8799){return new BPromise(function(_0x1bc265,_0x108379){return client[_0x8197('0xc')](_0x117bf1,_0x3e8799)[_0x8197('0xd')](function(_0x3fd8ee){logger[_0x8197('0xe')](_0x8197('0xf'),_0x374969,_0x8197('0x10'));logger[_0x8197('0x11')](_0x8197('0x12'),_0x374969,'request\x20sent',JSON[_0x8197('0x13')](_0x3fd8ee));if(_0x3fd8ee[_0x8197('0x14')]){if(_0x3fd8ee[_0x8197('0x14')][_0x8197('0x15')]===0x1f4){logger[_0x8197('0x14')](_0x8197('0xf'),_0x374969,_0x3fd8ee['error']['message']);return _0x108379(_0x3fd8ee[_0x8197('0x14')][_0x8197('0x16')]);}logger[_0x8197('0x14')](_0x8197('0xf'),_0x374969,_0x3fd8ee[_0x8197('0x14')]['message']);return _0x1bc265(_0x3fd8ee[_0x8197('0x14')]['message']);}else{logger[_0x8197('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0x374969,_0x8197('0x10'));_0x1bc265(_0x3fd8ee['result'][_0x8197('0x16')]);}})[_0x8197('0x17')](function(_0x56fd37){logger[_0x8197('0x14')]('VoiceQueuesLog,\x20%s,\x20%s',_0x374969,_0x56fd37);_0x108379(_0x56fd37);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index c60776f..3148934 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 _0x6eeb=['./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/downloads','/:id/transcribe','downloadTranscribe','post','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x328bd3,_0x9cf5a5){var _0x458149=function(_0x3f60d9){while(--_0x3f60d9){_0x328bd3['push'](_0x328bd3['shift']());}};_0x458149(++_0x9cf5a5);}(_0x6eeb,0x139));var _0xb6ee=function(_0x218994,_0x2cf487){_0x218994=_0x218994-0x0;var _0x3f350b=_0x6eeb[_0x218994];return _0x3f350b;};'use strict';var multer=require('multer');var util=require(_0xb6ee('0x0'));var path=require(_0xb6ee('0x1'));var timeout=require(_0xb6ee('0x2'));var express=require(_0xb6ee('0x3'));var router=express[_0xb6ee('0x4')]();var fs_extra=require(_0xb6ee('0x5'));var auth=require(_0xb6ee('0x6'));var interaction=require(_0xb6ee('0x7'));var config=require(_0xb6ee('0x8'));var controller=require(_0xb6ee('0x9'));router[_0xb6ee('0xa')]('/',auth[_0xb6ee('0xb')](),controller[_0xb6ee('0xc')]);router[_0xb6ee('0xa')](_0xb6ee('0xd'),auth[_0xb6ee('0xb')](),controller[_0xb6ee('0xe')]);router[_0xb6ee('0xa')](_0xb6ee('0xf'),auth[_0xb6ee('0xb')](),controller[_0xb6ee('0x10')]);router['get']('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0xb6ee('0xa')](_0xb6ee('0x11'),controller['downloads']);router[_0xb6ee('0xa')](_0xb6ee('0x12'),auth[_0xb6ee('0xb')](),controller[_0xb6ee('0x13')]);router[_0xb6ee('0x14')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xb6ee('0x12'),auth[_0xb6ee('0xb')](),controller['runTranscribe']);router['put'](_0xb6ee('0xf'),auth[_0xb6ee('0xb')](),controller['update']);router['delete'](_0xb6ee('0xf'),auth[_0xb6ee('0xb')](),controller[_0xb6ee('0x15')]);module[_0xb6ee('0x16')]=router; \ No newline at end of file +var _0x3e3f=['get','/:id','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','./voiceRecording.controller','isAuthenticated'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3e3f,0x1a7));var _0xf3e3=function(_0x3749b0,_0x5826fd){_0x3749b0=_0x3749b0-0x0;var _0xf36003=_0x3e3f[_0x3749b0];return _0xf36003;};'use strict';var multer=require(_0xf3e3('0x0'));var util=require(_0xf3e3('0x1'));var path=require(_0xf3e3('0x2'));var timeout=require(_0xf3e3('0x3'));var express=require(_0xf3e3('0x4'));var router=express['Router']();var fs_extra=require(_0xf3e3('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf3e3('0x6'));var controller=require(_0xf3e3('0x7'));router['get']('/',auth[_0xf3e3('0x8')](),controller['index']);router[_0xf3e3('0x9')]('/describe',auth[_0xf3e3('0x8')](),controller['describe']);router[_0xf3e3('0x9')](_0xf3e3('0xa'),auth[_0xf3e3('0x8')](),controller[_0xf3e3('0xb')]);router[_0xf3e3('0x9')](_0xf3e3('0xc'),auth[_0xf3e3('0x8')](),controller[_0xf3e3('0xd')]);router[_0xf3e3('0x9')](_0xf3e3('0xe'),controller[_0xf3e3('0xf')]);router['get'](_0xf3e3('0x10'),auth[_0xf3e3('0x8')](),controller[_0xf3e3('0x11')]);router[_0xf3e3('0x12')]('/',auth[_0xf3e3('0x8')](),controller['create']);router[_0xf3e3('0x12')](_0xf3e3('0x10'),auth[_0xf3e3('0x8')](),controller[_0xf3e3('0x13')]);router[_0xf3e3('0x14')](_0xf3e3('0xa'),auth['isAuthenticated'](),controller[_0xf3e3('0x15')]);router[_0xf3e3('0x16')](_0xf3e3('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xf3e3('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 b3c08c4..9593482 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(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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 fefcc84..2f8993b 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 _0x7f65=['format','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','count','includeAll','include','rows','show','params','length','find','create','body','catch','describe','../../components/encryptor','uniqueid','value','recording','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','download','message','Not\x20found','downloads','sequelize','MD5','token','$and','push','%s.cypher','secrets','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','Setting','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','writeFile','fileText','root','.txt','Transcript\x20not\x20available','eml-format','fast-json-patch','request-promise','moment','bluebird','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy'];(function(_0x1b745b,_0x3e2d40){var _0x120a9d=function(_0x882a6c){while(--_0x882a6c){_0x1b745b['push'](_0x1b745b['shift']());}};_0x120a9d(++_0x3e2d40);}(_0x7f65,0xfb));var _0x57f6=function(_0x12a7b4,_0x379e75){_0x12a7b4=_0x12a7b4-0x0;var _0x1e72b1=_0x7f65[_0x12a7b4];return _0x1e72b1;};'use strict';var emlformat=require(_0x57f6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x57f6('0x1'));var rp=require(_0x57f6('0x2'));var moment=require(_0x57f6('0x3'));var BPromise=require(_0x57f6('0x4'));var Mustache=require('mustache');var util=require(_0x57f6('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x57f6('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x57f6('0x7'));var _=require(_0x57f6('0x8'));var squel=require(_0x57f6('0x9'));var crypto=require(_0x57f6('0xa'));var jsforce=require(_0x57f6('0xb'));var deskjs=require(_0x57f6('0xc'));var toCsv=require(_0x57f6('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var AWS=require('aws-sdk');var uuidv4=require(_0x57f6('0xd'));var Redis=require(_0x57f6('0xe'));var authService=require(_0x57f6('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x57f6('0x10'));var hardwareService=require(_0x57f6('0x11'));var logger=require(_0x57f6('0x12'))('api');var utils=require(_0x57f6('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x57f6('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1fd68b,_0x50b1ca){_0x50b1ca=_0x50b1ca||0xcc;return function(_0x16c68b){if(_0x16c68b){return _0x1fd68b[_0x57f6('0x15')](_0x50b1ca);}return _0x1fd68b[_0x57f6('0x16')](_0x50b1ca)['end']();};}function respondWithResult(_0x15f45e,_0x4ffb31){_0x4ffb31=_0x4ffb31||0xc8;return function(_0x338dbc){if(_0x338dbc){return _0x15f45e[_0x57f6('0x16')](_0x4ffb31)[_0x57f6('0x17')](_0x338dbc);}};}function respondWithFilteredResult(_0x35f305,_0x15baef){return function(_0x2d9d5e){if(_0x2d9d5e){var _0x4dd4ba=typeof _0x15baef[_0x57f6('0x18')]===_0x57f6('0x19')&&typeof _0x15baef[_0x57f6('0x1a')]==='undefined';var _0x4b2cc5=_0x2d9d5e['count'];var _0x5655ad=_0x4dd4ba?0x0:_0x15baef['offset'];var _0x50e75e=_0x4dd4ba?_0x2d9d5e['count']:_0x15baef[_0x57f6('0x18')]+_0x15baef[_0x57f6('0x1a')];var _0x1bb069;if(_0x50e75e>=_0x4b2cc5){_0x50e75e=_0x4b2cc5;_0x1bb069=0xc8;}else{_0x1bb069=0xce;}_0x35f305[_0x57f6('0x16')](_0x1bb069);return _0x35f305[_0x57f6('0x1b')](_0x57f6('0x1c'),_0x5655ad+'-'+_0x50e75e+'/'+_0x4b2cc5)[_0x57f6('0x17')](_0x2d9d5e);}return null;};}function patchUpdates(_0x1c4b02){return function(_0x55ba04){try{jsonpatch['apply'](_0x55ba04,_0x1c4b02,!![]);}catch(_0x1218be){return BPromise[_0x57f6('0x1d')](_0x1218be);}return _0x55ba04['save']();};}function saveUpdates(_0x10fb82,_0x2713a4){return function(_0x46074e){if(_0x46074e){return _0x46074e[_0x57f6('0x1e')](_0x10fb82)[_0x57f6('0x1f')](function(_0x3dc62c){return _0x3dc62c;});}return null;};}function removeEntity(_0x57584d,_0x7732d){return function(_0x349761){if(_0x349761){return _0x349761[_0x57f6('0x20')]()['then'](function(){_0x57584d['status'](0xcc)[_0x57f6('0x21')]();});}};}function handleEntityNotFound(_0x361d94,_0x4aa808){return function(_0x4a7587){if(!_0x4a7587){_0x361d94[_0x57f6('0x15')](0x194);}return _0x4a7587;};}function handleError(_0x141d1f,_0x6d6753){_0x6d6753=_0x6d6753||0x1f4;return function(_0x2d7b92){logger[_0x57f6('0x22')](_0x2d7b92[_0x57f6('0x23')]);if(_0x2d7b92[_0x57f6('0x24')]){delete _0x2d7b92[_0x57f6('0x24')];}_0x141d1f[_0x57f6('0x16')](_0x6d6753)[_0x57f6('0x25')](_0x2d7b92);};}exports[_0x57f6('0x26')]=function(_0xdf509e,_0x4550bd){var _0x297c4d={},_0x56987b={},_0x3a29c8={'count':0x0,'rows':[]};var _0x420a15=_[_0x57f6('0x27')](db[_0x57f6('0x28')][_0x57f6('0x29')],function(_0x3f4305){return{'name':_0x3f4305[_0x57f6('0x2a')],'type':_0x3f4305[_0x57f6('0x2b')][_0x57f6('0x2c')]};});_0x56987b[_0x57f6('0x2d')]=_[_0x57f6('0x2e')](_[_0x57f6('0x27')](_0x420a15,_0x57f6('0x24')),[_0x57f6('0x2f')]);_0x56987b[_0x57f6('0x30')]=_[_0x57f6('0x31')](_0xdf509e[_0x57f6('0x30')]);_0x56987b[_0x57f6('0x32')]=_[_0x57f6('0x33')](_0x56987b['model'],_0x56987b[_0x57f6('0x30')]);_0x297c4d[_0x57f6('0x34')]=_['intersection'](_0x56987b['model'],qs[_0x57f6('0x35')](_0xdf509e[_0x57f6('0x30')][_0x57f6('0x35')]));_0x297c4d[_0x57f6('0x34')]=_0x297c4d[_0x57f6('0x34')]['length']?_0x297c4d['attributes']:_0x56987b['model'];if(!_0xdf509e[_0x57f6('0x30')][_0x57f6('0x36')]('nolimit')){_0x297c4d[_0x57f6('0x1a')]=qs[_0x57f6('0x1a')](_0xdf509e[_0x57f6('0x30')][_0x57f6('0x1a')]);_0x297c4d['offset']=qs['offset'](_0xdf509e[_0x57f6('0x30')]['offset']);}_0x297c4d[_0x57f6('0x37')]=qs[_0x57f6('0x38')](_0xdf509e[_0x57f6('0x30')][_0x57f6('0x38')]);_0x297c4d['where']=qs[_0x57f6('0x32')](_[_0x57f6('0x39')](_0xdf509e[_0x57f6('0x30')],_0x56987b[_0x57f6('0x32')]),_0x420a15);if(_0xdf509e[_0x57f6('0x30')][_0x57f6('0x3a')]){_0x297c4d[_0x57f6('0x3b')]=_['merge'](_0x297c4d['where'],{'$or':_[_0x57f6('0x27')](_0x420a15,function(_0x3c7dd7){if(_0x3c7dd7[_0x57f6('0x2b')]!==_0x57f6('0x3c')){var _0x1f37e0={};_0x1f37e0[_0x3c7dd7[_0x57f6('0x24')]]={'$like':'%'+_0xdf509e['query']['filter']+'%'};return _0x1f37e0;}})});}_0x297c4d=_[_0x57f6('0x3d')]({},_0x297c4d,_0xdf509e[_0x57f6('0x3e')]);var _0x194db0={'where':_0x297c4d[_0x57f6('0x3b')]};return db[_0x57f6('0x28')]['count'](_0x194db0)['then'](function(_0xc2e312){_0x3a29c8[_0x57f6('0x3f')]=_0xc2e312;if(_0xdf509e['query'][_0x57f6('0x40')]){_0x297c4d[_0x57f6('0x41')]=[{'all':!![]}];}return db[_0x57f6('0x28')]['findAll'](_0x297c4d);})[_0x57f6('0x1f')](function(_0x5220ef){_0x3a29c8[_0x57f6('0x42')]=_0x5220ef;return _0x3a29c8;})['then'](respondWithFilteredResult(_0x4550bd,_0x297c4d))['catch'](handleError(_0x4550bd,null));};exports[_0x57f6('0x43')]=function(_0x102bab,_0x15633c){var _0x5f0a46={'raw':![],'where':{'id':_0x102bab[_0x57f6('0x44')]['id']}},_0x2a0041={};_0x2a0041['model']=_['keys'](db['VoiceRecording'][_0x57f6('0x29')]);_0x2a0041[_0x57f6('0x30')]=_[_0x57f6('0x31')](_0x102bab['query']);_0x2a0041[_0x57f6('0x32')]=_['intersection'](_0x2a0041['model'],_0x2a0041[_0x57f6('0x30')]);_0x5f0a46[_0x57f6('0x34')]=_[_0x57f6('0x33')](_0x2a0041['model'],qs['fields'](_0x102bab[_0x57f6('0x30')][_0x57f6('0x35')]));_0x5f0a46[_0x57f6('0x34')]=_0x5f0a46[_0x57f6('0x34')][_0x57f6('0x45')]?_0x5f0a46[_0x57f6('0x34')]:_0x2a0041['model'];if(_0x102bab['query'][_0x57f6('0x40')]){_0x5f0a46[_0x57f6('0x41')]=[{'all':!![]}];}_0x5f0a46=_[_0x57f6('0x3d')]({},_0x5f0a46,_0x102bab[_0x57f6('0x3e')]);return db[_0x57f6('0x28')][_0x57f6('0x46')](_0x5f0a46)[_0x57f6('0x1f')](handleEntityNotFound(_0x15633c,null))['then'](respondWithResult(_0x15633c,null))['catch'](handleError(_0x15633c,null));};exports[_0x57f6('0x47')]=function(_0x2e8dd5,_0x3a5a28){return db[_0x57f6('0x28')][_0x57f6('0x47')](_0x2e8dd5[_0x57f6('0x48')],{})[_0x57f6('0x1f')](respondWithResult(_0x3a5a28,0xc9))[_0x57f6('0x49')](handleError(_0x3a5a28,null));};exports[_0x57f6('0x1e')]=function(_0x260f39,_0x2edcf3){if(_0x260f39[_0x57f6('0x48')]['id']){delete _0x260f39[_0x57f6('0x48')]['id'];}return db['VoiceRecording'][_0x57f6('0x46')]({'where':{'id':_0x260f39[_0x57f6('0x44')]['id']}})[_0x57f6('0x1f')](handleEntityNotFound(_0x2edcf3,null))[_0x57f6('0x1f')](saveUpdates(_0x260f39[_0x57f6('0x48')],null))[_0x57f6('0x1f')](respondWithResult(_0x2edcf3,null))[_0x57f6('0x49')](handleError(_0x2edcf3,null));};exports[_0x57f6('0x4a')]=function(_0xb491d8,_0x2b3496){return db[_0x57f6('0x28')]['describe']()['then'](respondWithResult(_0x2b3496,null))['catch'](handleError(_0x2b3496,null));};exports['download']=function(_0x10fb6d,_0x1f27ed,_0x4c53ae){var _0x39328e=require(_0x57f6('0x4b'));var _0x8bc787=![];var _0x2e58b2={};if(_0x10fb6d[_0x57f6('0x30')]['type']&&_0x10fb6d['query']['type']==='uniqueid'){_0x2e58b2[_0x57f6('0x4c')]=_0x10fb6d[_0x57f6('0x44')]['id'];}else{_0x2e58b2['id']=_0x10fb6d[_0x57f6('0x44')]['id'];}return db[_0x57f6('0x28')][_0x57f6('0x46')]({'where':_0x2e58b2,'attributes':['id',_0x57f6('0x4d')],'raw':!![]})[_0x57f6('0x1f')](handleEntityNotFound(_0x1f27ed,null))[_0x57f6('0x1f')](function(_0x135343){if(_0x135343){var _0x389428=_0x135343['value'];var _0x4e43d9=util['format']('%s.cypher',_0x389428);if(fs['existsSync'](_0x4e43d9)){_0x8bc787=!![];return _0x39328e['decryptFile'](_0x4e43d9,_0x389428,config['secrets'][_0x57f6('0x4e')])['then'](function(){return _0x135343;});}return _0x135343;}})[_0x57f6('0x1f')](function(_0x3d7152){if(_0x3d7152){var _0x445e42=_0x3d7152['value'];if(!fs[_0x57f6('0x4f')](_0x445e42)){throw new db[(_0x57f6('0x50'))][(_0x57f6('0x51'))](_0x57f6('0x52'));}if(_0x3d7152[_0x57f6('0x53')]){return _0x1f27ed['download'](_0x445e42,_0x3d7152['filename']+path[_0x57f6('0x54')](_0x445e42),function(){if(_0x8bc787){fs[_0x57f6('0x55')](_0x445e42);}});}else{return _0x1f27ed[_0x57f6('0x56')](_0x445e42,function(_0x16b410){if(_0x8bc787){fs[_0x57f6('0x55')](_0x445e42);}});}}})[_0x57f6('0x49')](function(_0x1f2e43){if(_0x1f2e43[_0x57f6('0x57')]===_0x57f6('0x52')){_0x1f27ed[_0x57f6('0x16')](0x194)['send'](_0x57f6('0x58'));}else{return handleError(_0x1f27ed,null);}});};exports[_0x57f6('0x59')]=function(_0x1bbe38,_0x1d1fae,_0x24753c){var _0x45a465=require(_0x57f6('0x4b'));var _0x11bd14=![];var _0x56e4c4={'$and':[db[_0x57f6('0x5a')][_0x57f6('0x3b')](db[_0x57f6('0x5a')]['fn'](_0x57f6('0x5b'),db[_0x57f6('0x5a')]['col']('uniqueid')),_0x1bbe38[_0x57f6('0x30')][_0x57f6('0x5c')])]};if(_0x1bbe38['query'][_0x57f6('0x2b')]&&_0x1bbe38[_0x57f6('0x30')][_0x57f6('0x2b')]==='uniqueid'){_0x56e4c4[_0x57f6('0x5d')][_0x57f6('0x5e')]({'uniqueid':_0x1bbe38[_0x57f6('0x44')]['id']});}else{_0x56e4c4[_0x57f6('0x5d')][_0x57f6('0x5e')]({'id':_0x1bbe38['params']['id']});}return db[_0x57f6('0x28')][_0x57f6('0x46')]({'where':_0x56e4c4,'attributes':['id',_0x57f6('0x4d')],'raw':!![]})[_0x57f6('0x1f')](handleEntityNotFound(_0x1d1fae,null))[_0x57f6('0x1f')](function(_0x41db6d){if(_0x41db6d){var _0x3b9ae4=util['format'](_0x57f6('0x5f'),_0x41db6d[_0x57f6('0x4d')]);if(fs[_0x57f6('0x4f')](_0x3b9ae4)){_0x11bd14=!![];return _0x45a465['decryptFile'](_0x3b9ae4,_0x41db6d[_0x57f6('0x4d')],config[_0x57f6('0x60')][_0x57f6('0x4e')])['then'](function(){return _0x41db6d;});}return _0x41db6d;}})[_0x57f6('0x1f')](function(_0x31fdd8){if(_0x31fdd8){if(!fs[_0x57f6('0x4f')](_0x31fdd8[_0x57f6('0x4d')])){throw new db[(_0x57f6('0x50'))][(_0x57f6('0x51'))]('VoiceRecording\x20not\x20found');}if(_0x31fdd8['filename']){return _0x1d1fae[_0x57f6('0x56')](_0x31fdd8[_0x57f6('0x4d')],_0x31fdd8['filename']+path[_0x57f6('0x54')](_0x31fdd8['value']),function(){if(_0x11bd14){fs['unlink'](_0x31fdd8[_0x57f6('0x4d')]);}});}else{return _0x1d1fae['download'](_0x31fdd8[_0x57f6('0x4d')],function(_0x578794){if(_0x11bd14){fs[_0x57f6('0x55')](_0x31fdd8['value']);}});}}})[_0x57f6('0x49')](handleError(_0x1d1fae,null));};exports[_0x57f6('0x20')]=function(_0x23dcf4,_0x1e515c){return db[_0x57f6('0x28')]['find']({'where':{'id':_0x23dcf4[_0x57f6('0x44')]['id']}})[_0x57f6('0x1f')](function(_0x405299){if(_[_0x57f6('0x61')](_0x405299)){throw new ReferenceError(_0x57f6('0x62'));}return _0x405299;})[_0x57f6('0x1f')](function(_0x5acbdc){var _0x105466=_0x5acbdc[_0x57f6('0x4d')];logger[_0x57f6('0x63')](_0x57f6('0x64'),_0x105466);if(!_[_0x57f6('0x61')](_0x5acbdc[_0x57f6('0x4d')])&&fs['existsSync'](_0x105466)){logger[_0x57f6('0x63')]('File:\x20\x22'+_0x105466+_0x57f6('0x65'));fs['unlinkSync'](_0x105466);}_0x105466=_0x105466+_0x57f6('0x66');if(!_[_0x57f6('0x61')](_0x5acbdc[_0x57f6('0x4d')])&&fs[_0x57f6('0x4f')](_0x105466)){logger[_0x57f6('0x63')]('File:\x20\x22'+_0x105466+_0x57f6('0x65'));fs[_0x57f6('0x67')](_0x105466);}return _0x5acbdc;})[_0x57f6('0x1f')](function(_0x293937){if(!_0x293937)throw new InternalError();return _0x293937[_0x57f6('0x20')]();})[_0x57f6('0x1f')](function(){_0x1e515c[_0x57f6('0x16')](0xcc)[_0x57f6('0x21')]();})[_0x57f6('0x49')](handleError(_0x1e515c,null));};function getBucketslist(_0x578bb7,_0x46e71b,_0x392fb8){return new Promise(function(_0x34b446,_0x1c8ee0){var _0x3d08fe=new AWS['S3']({'accessKeyId':_0x46e71b,'secretAccessKey':_0x578bb7,'region':_0x392fb8});_0x3d08fe[_0x57f6('0x68')]({},function(_0x45cea1,_0x2c02ce){if(_0x45cea1){return _0x1c8ee0(_0x45cea1);}else{return _0x34b446(_0x2c02ce);}});});}function createBucket(_0x551ac6,_0x4f9ce3,_0x3bb2b1,_0x327607){return new Promise(function(_0x5d45a4,_0x596ee8){var _0x5b50eb=new AWS['S3']({'accessKeyId':_0x4f9ce3,'secretAccessKey':_0x551ac6,'region':_0x3bb2b1});_0x5b50eb[_0x57f6('0x69')]({'Bucket':_0x327607},function(_0x5d5954,_0xa5b85f){if(_0x5d5954){return _0x596ee8(_0x5d5954);}else{return _0x5d45a4(_0xa5b85f);}});});}function uploadFile(_0x3e2ba6,_0x35fb81,_0x2f4501,_0x1f4c19,_0x4b148b,_0x3adc6b){return new Promise(function(_0x3e4335,_0x522587){var _0x51159b=new AWS['S3']({'accessKeyId':_0x35fb81,'secretAccessKey':_0x3e2ba6,'region':_0x2f4501});_0x51159b[_0x57f6('0x6a')]({'Bucket':_0x1f4c19,'Key':_0x4b148b,'Body':_0x3adc6b},function(_0x1f9982,_0x2b3224){if(_0x1f9982){return _0x522587(_0x1f9982);}else{return _0x3e4335(_0x2b3224);}});});}function startTranscribe(_0x4c5a13,_0x1e22b2,_0x2c83b6,_0x20f5ed,_0x26f27d,_0x2430ca){return new Promise(function(_0x48bf3e,_0x2f4d79){var _0x1517e6=new AWS[(_0x57f6('0x6b'))]({'accessKeyId':_0x1e22b2,'secretAccessKey':_0x4c5a13,'region':_0x2c83b6});_0x1517e6[_0x57f6('0x6c')]({'TranscriptionJobName':_0x20f5ed,'LanguageCode':_0x26f27d,'Media':{'MediaFileUri':_0x2430ca}},function(_0x1befd9,_0x4cebc3){if(_0x1befd9){return _0x2f4d79(_0x1befd9);}else{return _0x48bf3e(_0x4cebc3);}});});}function transcribe(_0x5ea74e,_0x40575e,_0x1de108,_0x29fbee,_0x52ac8d,_0x123061,_0x53b431){return new Promise(function(_0x263e79,_0x3b9f9c){var _0x37fa20={};logger[_0x57f6('0x63')](util[_0x57f6('0x2f')](_0x57f6('0x6d'),_0x5ea74e,_0x52ac8d));return uploadFile(_0x40575e,_0x1de108,_0x29fbee,_0x52ac8d,path[_0x57f6('0x6e')](_0x123061),fs[_0x57f6('0x6f')](_0x123061))['then'](function(_0x5e005c){logger['info'](util[_0x57f6('0x2f')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x5ea74e,_0x52ac8d,_0x5e005c[_0x57f6('0x70')]));_0x37fa20[_0x57f6('0x71')]=_0x5e005c['Bucket'];_0x37fa20[_0x57f6('0x72')]=_0x5e005c[_0x57f6('0x70')];logger[_0x57f6('0x63')](util[_0x57f6('0x2f')](_0x57f6('0x73'),_0x5ea74e));return startTranscribe(_0x40575e,_0x1de108,_0x29fbee,uuidv4(),_0x53b431,_0x5e005c[_0x57f6('0x70')]);})[_0x57f6('0x1f')](function(_0xb2b992){logger[_0x57f6('0x63')](util[_0x57f6('0x2f')](_0x57f6('0x74'),_0x5ea74e,_0xb2b992[_0x57f6('0x75')][_0x57f6('0x76')]));_0x37fa20[_0x57f6('0x77')]=_0xb2b992[_0x57f6('0x75')]['TranscriptionJobName'];_0x37fa20[_0x57f6('0x78')]=_0xb2b992[_0x57f6('0x75')][_0x57f6('0x79')];return _0x263e79(_0x37fa20);})[_0x57f6('0x49')](function(_0x7195c7){return _0x3b9f9c(_0x7195c7);});});}exports[_0x57f6('0x7a')]=function(_0x2627af,_0x16d94b,_0x67ebcf){var _0x4d25a8;var _0x3a6994;var _0x574185;var _0x5a89e9=require(_0x57f6('0x4b'));return db[_0x57f6('0x28')]['findOne']({'where':{'id':_0x2627af['params']['id']}})['then'](function(_0x451612){if(_0x451612){var _0x3ae231=util[_0x57f6('0x2f')](_0x57f6('0x5f'),_0x451612['value']);if(fs[_0x57f6('0x4f')](_0x3ae231)){cypher=!![];return _0x5a89e9['decryptFile'](_0x3ae231,_0x451612[_0x57f6('0x4d')],config[_0x57f6('0x60')][_0x57f6('0x4e')])[_0x57f6('0x1f')](function(){return _0x451612;});}return _0x451612;}})['then'](function(_0x19b174){if(!_0x19b174){throw new db[(_0x57f6('0x50'))]['ValidationError']('Voice\x20Recording\x20not\x20found');}_0x3a6994=_0x19b174;return db[_0x57f6('0x7b')]['findOne']({'where':{'id':0x1}});})[_0x57f6('0x1f')](handleEntityNotFound(_0x16d94b,null))[_0x57f6('0x1f')](function(_0xf683bf){if(_0xf683bf){_0x4d25a8=_0xf683bf;if(!_0x4d25a8['transcribe']||!_0x4d25a8[_0x57f6('0x7c')]||!_0x4d25a8[_0x57f6('0x7d')]||!_0x4d25a8[_0x57f6('0x7e')]||!_0x4d25a8[_0x57f6('0x71')]){throw new db[(_0x57f6('0x50'))]['ValidationError'](_0x57f6('0x7f'));}if(_0x2627af['body'][_0x57f6('0x80')]&&(!_0x4d25a8[_0x57f6('0x81')]||!_0x4d25a8[_0x57f6('0x82')]||!_0x4d25a8[_0x57f6('0x83')]||!_0x4d25a8[_0x57f6('0x7e')]||!_0x4d25a8[_0x57f6('0x71')])){throw new db[(_0x57f6('0x50'))][(_0x57f6('0x51'))](_0x57f6('0x84'));}return db[_0x57f6('0x85')][_0x57f6('0x86')]({'where':{'id':_0x4d25a8[_0x57f6('0x7c')]}});}})[_0x57f6('0x1f')](function(_0x1f0dee){if(!_0x1f0dee){throw new db['Sequelize'][(_0x57f6('0x51'))](_0x57f6('0x87'));}if(!_0x1f0dee[_0x57f6('0x88')]||!_0x1f0dee[_0x57f6('0x89')]){throw new db[(_0x57f6('0x50'))][(_0x57f6('0x51'))]('Cloud\x20Provider\x20not\x20configured');}_0x574185=_0x1f0dee;return getBucketslist(_0x574185[_0x57f6('0x88')],_0x574185[_0x57f6('0x89')],_0x4d25a8[_0x57f6('0x7d')]);})['then'](function(_0x19d7ec){if(_0x19d7ec&&_0x19d7ec['Buckets']){var _0x2811ca=_[_0x57f6('0x46')](_0x19d7ec[_0x57f6('0x8a')],function(_0x2c2dd4){return _0x2c2dd4['Name']===_0x4d25a8[_0x57f6('0x71')];});if(!_0x2811ca){logger[_0x57f6('0x63')](util[_0x57f6('0x2f')](_0x57f6('0x8b'),_0x2627af[_0x57f6('0x44')]['id'],_0x4d25a8[_0x57f6('0x71')]));return createBucket(_0x574185[_0x57f6('0x88')],_0x574185[_0x57f6('0x89')],_0x4d25a8[_0x57f6('0x7d')],_0x4d25a8['bucket']);}logger[_0x57f6('0x63')](util[_0x57f6('0x2f')](_0x57f6('0x8c'),_0x2627af[_0x57f6('0x44')]['id'],_0x4d25a8[_0x57f6('0x71')]));return;}})[_0x57f6('0x1f')](function(_0x31b024){if(_0x3a6994['transcribeStatus']==='NEW'){return transcribe(_0x2627af['params']['id'],_0x574185[_0x57f6('0x88')],_0x574185['data2'],_0x4d25a8[_0x57f6('0x7d')],_0x4d25a8[_0x57f6('0x71')],_0x3a6994['value'],_0x4d25a8[_0x57f6('0x7e')]);}else{logger[_0x57f6('0x63')](util[_0x57f6('0x2f')](_0x57f6('0x8d'),_0x2627af[_0x57f6('0x44')]['id']));return{'transcribeStatus':_0x57f6('0x8e')};}})[_0x57f6('0x1f')](function(_0x2887a5){if(_0x2887a5){_0x2887a5[_0x57f6('0x8f')]=_0x2627af[_0x57f6('0x48')][_0x57f6('0x80')];return _0x3a6994['updateAttributes'](_0x2887a5);}})[_0x57f6('0x1f')](respondWithResult(_0x16d94b,null))['catch'](handleError(_0x16d94b,null));};function writeFile(_0x393cc6,_0x5e47a5){return new Promise(function(_0x3cad02,_0x186a0f){fs[_0x57f6('0x90')](_0x5e47a5,_0x393cc6,function(_0x597513,_0x7c89c3){if(_0x597513){return _0x186a0f(_0x597513);}else{return _0x3cad02(_0x7c89c3);}});});}exports['downloadTranscribe']=function(_0x140fc4,_0x102ad0,_0x3ac8e3){return db[_0x57f6('0x28')][_0x57f6('0x86')]({'where':{'id':_0x140fc4[_0x57f6('0x44')]['id']}})[_0x57f6('0x1f')](handleEntityNotFound(_0x102ad0))[_0x57f6('0x1f')](function(_0x4bbe6a){if(_0x4bbe6a&&_0x4bbe6a[_0x57f6('0x91')]){var _0x4b670d=_0x4bbe6a[_0x57f6('0x91')];var _0x28c0bd=config[_0x57f6('0x92')]+'/server/files/transcribes/transcribe_'+_0x4bbe6a['id']+_0x57f6('0x93');if(fs[_0x57f6('0x4f')](_0x28c0bd)){return _0x28c0bd;}return writeFile(_0x4b670d,_0x28c0bd)[_0x57f6('0x1f')](function(){return _0x28c0bd;});}else{throw new db[(_0x57f6('0x50'))][(_0x57f6('0x51'))](_0x57f6('0x94'));}})[_0x57f6('0x1f')](function(_0x4b8979){return _0x102ad0[_0x57f6('0x56')](_0x4b8979);})[_0x57f6('0x49')](handleError(_0x102ad0));}; \ No newline at end of file +var _0x53bc=['uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','save','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','merge','where','map','VIRTUAL','options','include','findAll','rows','catch','show','params','VoiceRecording','length','includeAll','find','create','body','update','describe','download','../../components/encryptor','uniqueid','value','format','%s.cypher','existsSync','secrets','recording','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','message','Not\x20found','sequelize','token','$and','push','decryptFile','extname','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','destroy','listBuckets','createBucket','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','transcribeName','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','transcribe','transcribeAccountId','transcribeRegion','language','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sequelize','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','data1','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x53bc,0x8b));var _0xc53b=function(_0x1d7780,_0x380a3e){_0x1d7780=_0x1d7780-0x0;var _0x218a36=_0x53bc[_0x1d7780];return _0x218a36;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc53b('0x0'));var zipdir=require(_0xc53b('0x1'));var jsonpatch=require(_0xc53b('0x2'));var rp=require(_0xc53b('0x3'));var moment=require(_0xc53b('0x4'));var BPromise=require(_0xc53b('0x5'));var Mustache=require('mustache');var util=require(_0xc53b('0x6'));var path=require('path');var sox=require(_0xc53b('0x7'));var csv=require(_0xc53b('0x8'));var ejs=require(_0xc53b('0x9'));var fs=require('fs');var fs_extra=require(_0xc53b('0xa'));var _=require(_0xc53b('0xb'));var squel=require('squel');var crypto=require(_0xc53b('0xc'));var jsforce=require(_0xc53b('0xd'));var deskjs=require(_0xc53b('0xe'));var toCsv=require(_0xc53b('0x8'));var querystring=require('querystring');var Papa=require(_0xc53b('0xf'));var AWS=require('aws-sdk');var uuidv4=require(_0xc53b('0x10'));var Redis=require(_0xc53b('0x11'));var authService=require(_0xc53b('0x12'));var qs=require(_0xc53b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc53b('0x14'));var logger=require(_0xc53b('0x15'))(_0xc53b('0x16'));var utils=require(_0xc53b('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc53b('0x18'));var db=require(_0xc53b('0x19'))['db'];function respondWithStatusCode(_0x31159f,_0x17cd22){_0x17cd22=_0x17cd22||0xcc;return function(_0x1352cc){if(_0x1352cc){return _0x31159f[_0xc53b('0x1a')](_0x17cd22);}return _0x31159f[_0xc53b('0x1b')](_0x17cd22)[_0xc53b('0x1c')]();};}function respondWithResult(_0x500a78,_0xaa86f1){_0xaa86f1=_0xaa86f1||0xc8;return function(_0x1e05d6){if(_0x1e05d6){return _0x500a78[_0xc53b('0x1b')](_0xaa86f1)[_0xc53b('0x1d')](_0x1e05d6);}};}function respondWithFilteredResult(_0xa2588,_0x3540e7){return function(_0x98f98){if(_0x98f98){var _0x51f775=typeof _0x3540e7[_0xc53b('0x1e')]==='undefined'&&typeof _0x3540e7[_0xc53b('0x1f')]==='undefined';var _0x357622=_0x98f98[_0xc53b('0x20')];var _0x229422=_0x51f775?0x0:_0x3540e7[_0xc53b('0x1e')];var _0x2a4dd9=_0x51f775?_0x98f98['count']:_0x3540e7[_0xc53b('0x1e')]+_0x3540e7[_0xc53b('0x1f')];var _0x149a2e;if(_0x2a4dd9>=_0x357622){_0x2a4dd9=_0x357622;_0x149a2e=0xc8;}else{_0x149a2e=0xce;}_0xa2588[_0xc53b('0x1b')](_0x149a2e);return _0xa2588[_0xc53b('0x21')](_0xc53b('0x22'),_0x229422+'-'+_0x2a4dd9+'/'+_0x357622)[_0xc53b('0x1d')](_0x98f98);}return null;};}function patchUpdates(_0x10cd85){return function(_0x545cd9){try{jsonpatch['apply'](_0x545cd9,_0x10cd85,!![]);}catch(_0x359402){return BPromise['reject'](_0x359402);}return _0x545cd9[_0xc53b('0x23')]();};}function saveUpdates(_0x1b2519,_0x59efc4){return function(_0x12aaaf){if(_0x12aaaf){return _0x12aaaf['update'](_0x1b2519)[_0xc53b('0x24')](function(_0x441176){return _0x441176;});}return null;};}function removeEntity(_0x527d2c,_0x1c18d9){return function(_0x3e5c3e){if(_0x3e5c3e){return _0x3e5c3e['destroy']()[_0xc53b('0x24')](function(){_0x527d2c[_0xc53b('0x1b')](0xcc)[_0xc53b('0x1c')]();});}};}function handleEntityNotFound(_0x11ddd4,_0x2490ec){return function(_0x3b8b16){if(!_0x3b8b16){_0x11ddd4[_0xc53b('0x1a')](0x194);}return _0x3b8b16;};}function handleError(_0x1c8610,_0xd3fd36){_0xd3fd36=_0xd3fd36||0x1f4;return function(_0x333c4a){logger[_0xc53b('0x25')](_0x333c4a[_0xc53b('0x26')]);if(_0x333c4a[_0xc53b('0x27')]){delete _0x333c4a[_0xc53b('0x27')];}_0x1c8610[_0xc53b('0x1b')](_0xd3fd36)[_0xc53b('0x28')](_0x333c4a);};}exports[_0xc53b('0x29')]=function(_0x1fa913,_0x1b0320){var _0x56f0cd={},_0x486ab6={},_0x2b2dcd={'count':0x0,'rows':[]};var _0x2bc161=_['map'](db['VoiceRecording'][_0xc53b('0x2a')],function(_0x10c7f3){return{'name':_0x10c7f3[_0xc53b('0x2b')],'type':_0x10c7f3[_0xc53b('0x2c')][_0xc53b('0x2d')]};});_0x486ab6[_0xc53b('0x2e')]=_[_0xc53b('0x2f')](_['map'](_0x2bc161,_0xc53b('0x27')),['format']);_0x486ab6[_0xc53b('0x30')]=_[_0xc53b('0x31')](_0x1fa913[_0xc53b('0x30')]);_0x486ab6[_0xc53b('0x32')]=_[_0xc53b('0x33')](_0x486ab6['model'],_0x486ab6['query']);_0x56f0cd[_0xc53b('0x34')]=_['intersection'](_0x486ab6[_0xc53b('0x2e')],qs[_0xc53b('0x35')](_0x1fa913[_0xc53b('0x30')][_0xc53b('0x35')]));_0x56f0cd[_0xc53b('0x34')]=_0x56f0cd[_0xc53b('0x34')]['length']?_0x56f0cd[_0xc53b('0x34')]:_0x486ab6[_0xc53b('0x2e')];if(!_0x1fa913[_0xc53b('0x30')][_0xc53b('0x36')](_0xc53b('0x37'))){_0x56f0cd[_0xc53b('0x1f')]=qs[_0xc53b('0x1f')](_0x1fa913[_0xc53b('0x30')][_0xc53b('0x1f')]);_0x56f0cd[_0xc53b('0x1e')]=qs[_0xc53b('0x1e')](_0x1fa913[_0xc53b('0x30')][_0xc53b('0x1e')]);}_0x56f0cd[_0xc53b('0x38')]=qs[_0xc53b('0x39')](_0x1fa913[_0xc53b('0x30')][_0xc53b('0x39')]);_0x56f0cd['where']=qs[_0xc53b('0x32')](_['pick'](_0x1fa913[_0xc53b('0x30')],_0x486ab6[_0xc53b('0x32')]),_0x2bc161);if(_0x1fa913[_0xc53b('0x30')][_0xc53b('0x3a')]){_0x56f0cd['where']=_[_0xc53b('0x3b')](_0x56f0cd[_0xc53b('0x3c')],{'$or':_[_0xc53b('0x3d')](_0x2bc161,function(_0x725055){if(_0x725055['type']!==_0xc53b('0x3e')){var _0x43f842={};_0x43f842[_0x725055[_0xc53b('0x27')]]={'$like':'%'+_0x1fa913[_0xc53b('0x30')][_0xc53b('0x3a')]+'%'};return _0x43f842;}})});}_0x56f0cd=_[_0xc53b('0x3b')]({},_0x56f0cd,_0x1fa913[_0xc53b('0x3f')]);var _0x2bcaf9={'where':_0x56f0cd[_0xc53b('0x3c')]};return db['VoiceRecording'][_0xc53b('0x20')](_0x2bcaf9)[_0xc53b('0x24')](function(_0x16ad78){_0x2b2dcd[_0xc53b('0x20')]=_0x16ad78;if(_0x1fa913[_0xc53b('0x30')]['includeAll']){_0x56f0cd[_0xc53b('0x40')]=[{'all':!![]}];}return db['VoiceRecording'][_0xc53b('0x41')](_0x56f0cd);})[_0xc53b('0x24')](function(_0x30ba21){_0x2b2dcd[_0xc53b('0x42')]=_0x30ba21;return _0x2b2dcd;})[_0xc53b('0x24')](respondWithFilteredResult(_0x1b0320,_0x56f0cd))[_0xc53b('0x43')](handleError(_0x1b0320,null));};exports[_0xc53b('0x44')]=function(_0x36058b,_0x41ee1a){var _0x22f3eb={'raw':![],'where':{'id':_0x36058b[_0xc53b('0x45')]['id']}},_0x419a74={};_0x419a74[_0xc53b('0x2e')]=_[_0xc53b('0x31')](db[_0xc53b('0x46')][_0xc53b('0x2a')]);_0x419a74[_0xc53b('0x30')]=_[_0xc53b('0x31')](_0x36058b[_0xc53b('0x30')]);_0x419a74[_0xc53b('0x32')]=_[_0xc53b('0x33')](_0x419a74[_0xc53b('0x2e')],_0x419a74['query']);_0x22f3eb[_0xc53b('0x34')]=_[_0xc53b('0x33')](_0x419a74[_0xc53b('0x2e')],qs[_0xc53b('0x35')](_0x36058b[_0xc53b('0x30')]['fields']));_0x22f3eb[_0xc53b('0x34')]=_0x22f3eb['attributes'][_0xc53b('0x47')]?_0x22f3eb[_0xc53b('0x34')]:_0x419a74['model'];if(_0x36058b[_0xc53b('0x30')][_0xc53b('0x48')]){_0x22f3eb[_0xc53b('0x40')]=[{'all':!![]}];}_0x22f3eb=_[_0xc53b('0x3b')]({},_0x22f3eb,_0x36058b[_0xc53b('0x3f')]);return db['VoiceRecording'][_0xc53b('0x49')](_0x22f3eb)['then'](handleEntityNotFound(_0x41ee1a,null))['then'](respondWithResult(_0x41ee1a,null))[_0xc53b('0x43')](handleError(_0x41ee1a,null));};exports[_0xc53b('0x4a')]=function(_0x2edd21,_0x417a76){return db[_0xc53b('0x46')][_0xc53b('0x4a')](_0x2edd21[_0xc53b('0x4b')],{})[_0xc53b('0x24')](respondWithResult(_0x417a76,0xc9))[_0xc53b('0x43')](handleError(_0x417a76,null));};exports[_0xc53b('0x4c')]=function(_0x434093,_0x3c07aa){if(_0x434093['body']['id']){delete _0x434093[_0xc53b('0x4b')]['id'];}return db[_0xc53b('0x46')][_0xc53b('0x49')]({'where':{'id':_0x434093[_0xc53b('0x45')]['id']}})[_0xc53b('0x24')](handleEntityNotFound(_0x3c07aa,null))[_0xc53b('0x24')](saveUpdates(_0x434093['body'],null))['then'](respondWithResult(_0x3c07aa,null))['catch'](handleError(_0x3c07aa,null));};exports['describe']=function(_0x4081aa,_0x2c3496){return db[_0xc53b('0x46')][_0xc53b('0x4d')]()[_0xc53b('0x24')](respondWithResult(_0x2c3496,null))[_0xc53b('0x43')](handleError(_0x2c3496,null));};exports[_0xc53b('0x4e')]=function(_0x1703d4,_0x1e4afc,_0xcb46f6){var _0x393a68=require(_0xc53b('0x4f'));var _0x242887=![];var _0x451550={};if(_0x1703d4[_0xc53b('0x30')][_0xc53b('0x2c')]&&_0x1703d4[_0xc53b('0x30')]['type']==='uniqueid'){_0x451550[_0xc53b('0x50')]=_0x1703d4['params']['id'];}else{_0x451550['id']=_0x1703d4[_0xc53b('0x45')]['id'];}return db[_0xc53b('0x46')][_0xc53b('0x49')]({'where':_0x451550,'attributes':['id',_0xc53b('0x51')],'raw':!![]})[_0xc53b('0x24')](handleEntityNotFound(_0x1e4afc,null))[_0xc53b('0x24')](function(_0x2cae21){if(_0x2cae21){var _0x18f51f=_0x2cae21['value'];var _0x38620a=util[_0xc53b('0x52')](_0xc53b('0x53'),_0x18f51f);if(fs[_0xc53b('0x54')](_0x38620a)){_0x242887=!![];return _0x393a68['decryptFile'](_0x38620a,_0x18f51f,config[_0xc53b('0x55')][_0xc53b('0x56')])[_0xc53b('0x24')](function(){return _0x2cae21;});}return _0x2cae21;}})['then'](function(_0x1cd162){if(_0x1cd162){var _0x288430=_0x1cd162['value'];if(!fs['existsSync'](_0x288430)){throw new db['Sequelize'][(_0xc53b('0x57'))](_0xc53b('0x58'));}if(_0x1cd162[_0xc53b('0x59')]){return _0x1e4afc[_0xc53b('0x4e')](_0x288430,_0x1cd162['filename']+path['extname'](_0x288430),function(){if(_0x242887){fs[_0xc53b('0x5a')](_0x288430);}});}else{return _0x1e4afc[_0xc53b('0x4e')](_0x288430,function(_0x228854){if(_0x242887){fs[_0xc53b('0x5a')](_0x288430);}});}}})[_0xc53b('0x43')](function(_0x13b519){if(_0x13b519[_0xc53b('0x5b')]===_0xc53b('0x58')){_0x1e4afc[_0xc53b('0x1b')](0x194)[_0xc53b('0x28')](_0xc53b('0x5c'));}else{return handleError(_0x1e4afc,null);}});};exports['downloads']=function(_0x528ebc,_0x14efcb,_0x26005d){var _0x5b132c=require(_0xc53b('0x4f'));var _0x189d94=![];var _0x398102={'$and':[db[_0xc53b('0x5d')][_0xc53b('0x3c')](db[_0xc53b('0x5d')]['fn']('MD5',db[_0xc53b('0x5d')]['col'](_0xc53b('0x50'))),_0x528ebc[_0xc53b('0x30')][_0xc53b('0x5e')])]};if(_0x528ebc[_0xc53b('0x30')][_0xc53b('0x2c')]&&_0x528ebc[_0xc53b('0x30')][_0xc53b('0x2c')]==='uniqueid'){_0x398102[_0xc53b('0x5f')][_0xc53b('0x60')]({'uniqueid':_0x528ebc[_0xc53b('0x45')]['id']});}else{_0x398102[_0xc53b('0x5f')]['push']({'id':_0x528ebc[_0xc53b('0x45')]['id']});}return db[_0xc53b('0x46')][_0xc53b('0x49')]({'where':_0x398102,'attributes':['id','value'],'raw':!![]})[_0xc53b('0x24')](handleEntityNotFound(_0x14efcb,null))[_0xc53b('0x24')](function(_0x22e61f){if(_0x22e61f){var _0x1dc5cf=util['format'](_0xc53b('0x53'),_0x22e61f['value']);if(fs[_0xc53b('0x54')](_0x1dc5cf)){_0x189d94=!![];return _0x5b132c[_0xc53b('0x61')](_0x1dc5cf,_0x22e61f[_0xc53b('0x51')],config[_0xc53b('0x55')]['recording'])[_0xc53b('0x24')](function(){return _0x22e61f;});}return _0x22e61f;}})['then'](function(_0x2d04a7){if(_0x2d04a7){if(!fs[_0xc53b('0x54')](_0x2d04a7['value'])){throw new db['Sequelize'][(_0xc53b('0x57'))](_0xc53b('0x58'));}if(_0x2d04a7[_0xc53b('0x59')]){return _0x14efcb['download'](_0x2d04a7['value'],_0x2d04a7[_0xc53b('0x59')]+path[_0xc53b('0x62')](_0x2d04a7[_0xc53b('0x51')]),function(){if(_0x189d94){fs[_0xc53b('0x5a')](_0x2d04a7[_0xc53b('0x51')]);}});}else{return _0x14efcb[_0xc53b('0x4e')](_0x2d04a7[_0xc53b('0x51')],function(_0x25bcd6){if(_0x189d94){fs[_0xc53b('0x5a')](_0x2d04a7[_0xc53b('0x51')]);}});}}})[_0xc53b('0x43')](handleError(_0x14efcb,null));};exports['destroy']=function(_0x31127,_0x325d78){return db[_0xc53b('0x46')]['find']({'where':{'id':_0x31127['params']['id']}})[_0xc53b('0x24')](function(_0xd271dd){if(_['isNil'](_0xd271dd)){throw new ReferenceError(_0xc53b('0x63'));}return _0xd271dd;})[_0xc53b('0x24')](function(_0x5916e6){var _0x47bbbe=_0x5916e6['value'];logger[_0xc53b('0x64')](_0xc53b('0x65'),_0x47bbbe);if(!_[_0xc53b('0x66')](_0x5916e6[_0xc53b('0x51')])&&fs['existsSync'](_0x47bbbe)){logger[_0xc53b('0x64')]('File:\x20\x22'+_0x47bbbe+_0xc53b('0x67'));fs[_0xc53b('0x68')](_0x47bbbe);}_0x47bbbe=_0x47bbbe+_0xc53b('0x69');if(!_[_0xc53b('0x66')](_0x5916e6[_0xc53b('0x51')])&&fs['existsSync'](_0x47bbbe)){logger['info'](_0xc53b('0x6a')+_0x47bbbe+_0xc53b('0x67'));fs[_0xc53b('0x68')](_0x47bbbe);}return _0x5916e6;})[_0xc53b('0x24')](function(_0x189f1a){if(!_0x189f1a)throw new InternalError();return _0x189f1a[_0xc53b('0x6b')]();})[_0xc53b('0x24')](function(){_0x325d78['status'](0xcc)[_0xc53b('0x1c')]();})[_0xc53b('0x43')](handleError(_0x325d78,null));};function getBucketslist(_0x343624,_0x26dd96,_0x1b83bd){return new Promise(function(_0x60e183,_0x4758f7){var _0x55f04d=new AWS['S3']({'accessKeyId':_0x26dd96,'secretAccessKey':_0x343624,'region':_0x1b83bd});_0x55f04d[_0xc53b('0x6c')]({},function(_0x4375c0,_0x4a0692){if(_0x4375c0){return _0x4758f7(_0x4375c0);}else{return _0x60e183(_0x4a0692);}});});}function createBucket(_0x2259f4,_0x52d919,_0xf07dde,_0x90b44d){return new Promise(function(_0x39aefc,_0x3db225){var _0x3cfaaa=new AWS['S3']({'accessKeyId':_0x52d919,'secretAccessKey':_0x2259f4,'region':_0xf07dde});_0x3cfaaa[_0xc53b('0x6d')]({'Bucket':_0x90b44d},function(_0x207ed7,_0x370cef){if(_0x207ed7){return _0x3db225(_0x207ed7);}else{return _0x39aefc(_0x370cef);}});});}function uploadFile(_0x535e5e,_0x3262ad,_0xf38ce0,_0x244e51,_0x1511dd,_0x4e27ad){return new Promise(function(_0x27b388,_0x1013a4){var _0x464619=new AWS['S3']({'accessKeyId':_0x3262ad,'secretAccessKey':_0x535e5e,'region':_0xf38ce0});_0x464619['upload']({'Bucket':_0x244e51,'Key':_0x1511dd,'Body':_0x4e27ad},function(_0x496723,_0x277480){if(_0x496723){return _0x1013a4(_0x496723);}else{return _0x27b388(_0x277480);}});});}function startTranscribe(_0x27cb11,_0x1ef993,_0x149f70,_0x5b66a8,_0x1f8b22,_0x5b8e38){return new Promise(function(_0x47f9c7,_0x5c0d16){var _0xc9930=new AWS[(_0xc53b('0x6e'))]({'accessKeyId':_0x1ef993,'secretAccessKey':_0x27cb11,'region':_0x149f70});_0xc9930['startTranscriptionJob']({'TranscriptionJobName':_0x5b66a8,'LanguageCode':_0x1f8b22,'Media':{'MediaFileUri':_0x5b8e38}},function(_0x2d5926,_0x3098b2){if(_0x2d5926){return _0x5c0d16(_0x2d5926);}else{return _0x47f9c7(_0x3098b2);}});});}function transcribe(_0x51b578,_0x142383,_0x3393eb,_0x1a949d,_0xe66e61,_0x2972aa,_0x4cb919){return new Promise(function(_0x4baba1,_0x21bcde){var _0x28c0d9={};logger[_0xc53b('0x64')](util['format'](_0xc53b('0x6f'),_0x51b578,_0xe66e61));return uploadFile(_0x142383,_0x3393eb,_0x1a949d,_0xe66e61,path[_0xc53b('0x70')](_0x2972aa),fs[_0xc53b('0x71')](_0x2972aa))[_0xc53b('0x24')](function(_0x205380){logger[_0xc53b('0x64')](util[_0xc53b('0x52')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x51b578,_0xe66e61,_0x205380[_0xc53b('0x72')]));_0x28c0d9[_0xc53b('0x73')]=_0x205380['Bucket'];_0x28c0d9[_0xc53b('0x74')]=_0x205380[_0xc53b('0x72')];logger[_0xc53b('0x64')](util[_0xc53b('0x52')](_0xc53b('0x75'),_0x51b578));return startTranscribe(_0x142383,_0x3393eb,_0x1a949d,uuidv4(),_0x4cb919,_0x205380[_0xc53b('0x72')]);})[_0xc53b('0x24')](function(_0x3ebb52){logger[_0xc53b('0x64')](util[_0xc53b('0x52')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x51b578,_0x3ebb52['TranscriptionJob']['TranscriptionJobName']));_0x28c0d9[_0xc53b('0x76')]=_0x3ebb52[_0xc53b('0x77')][_0xc53b('0x78')];_0x28c0d9[_0xc53b('0x79')]=_0x3ebb52[_0xc53b('0x77')][_0xc53b('0x7a')];return _0x4baba1(_0x28c0d9);})[_0xc53b('0x43')](function(_0x47a974){return _0x21bcde(_0x47a974);});});}exports[_0xc53b('0x7b')]=function(_0x511298,_0x528b54,_0xc3a77b){var _0x29160b;var _0x2456c8;var _0x10096f;var _0xcd7262=require(_0xc53b('0x4f'));return db[_0xc53b('0x46')][_0xc53b('0x7c')]({'where':{'id':_0x511298['params']['id']}})[_0xc53b('0x24')](function(_0x285a81){if(_0x285a81){var _0x1c5bd0=util[_0xc53b('0x52')](_0xc53b('0x53'),_0x285a81[_0xc53b('0x51')]);if(fs[_0xc53b('0x54')](_0x1c5bd0)){cypher=!![];return _0xcd7262[_0xc53b('0x61')](_0x1c5bd0,_0x285a81[_0xc53b('0x51')],config[_0xc53b('0x55')][_0xc53b('0x56')])[_0xc53b('0x24')](function(){return _0x285a81;});}return _0x285a81;}})[_0xc53b('0x24')](function(_0x420d4d){if(!_0x420d4d){throw new db['Sequelize'][(_0xc53b('0x57'))](_0xc53b('0x7d'));}_0x2456c8=_0x420d4d;return db['Setting'][_0xc53b('0x7c')]({'where':{'id':0x1}});})[_0xc53b('0x24')](handleEntityNotFound(_0x528b54,null))[_0xc53b('0x24')](function(_0x223b98){if(_0x223b98){_0x29160b=_0x223b98;if(!_0x29160b[_0xc53b('0x7e')]||!_0x29160b[_0xc53b('0x7f')]||!_0x29160b[_0xc53b('0x80')]||!_0x29160b[_0xc53b('0x81')]||!_0x29160b[_0xc53b('0x73')]){throw new db['Sequelize'][(_0xc53b('0x57'))]('Transcribe\x20not\x20configured');}if(_0x511298[_0xc53b('0x4b')][_0xc53b('0x82')]&&(!_0x29160b[_0xc53b('0x83')]||!_0x29160b[_0xc53b('0x84')]||!_0x29160b[_0xc53b('0x85')]||!_0x29160b[_0xc53b('0x81')]||!_0x29160b['bucket'])){throw new db[(_0xc53b('0x86'))][(_0xc53b('0x57'))](_0xc53b('0x87'));}return db[_0xc53b('0x88')][_0xc53b('0x7c')]({'where':{'id':_0x29160b[_0xc53b('0x7f')]}});}})['then'](function(_0x4d03cb){if(!_0x4d03cb){throw new db[(_0xc53b('0x86'))][(_0xc53b('0x57'))](_0xc53b('0x89'));}if(!_0x4d03cb['data1']||!_0x4d03cb[_0xc53b('0x8a')]){throw new db[(_0xc53b('0x86'))][(_0xc53b('0x57'))](_0xc53b('0x8b'));}_0x10096f=_0x4d03cb;return getBucketslist(_0x10096f['data1'],_0x10096f[_0xc53b('0x8a')],_0x29160b[_0xc53b('0x80')]);})['then'](function(_0x2af12f){if(_0x2af12f&&_0x2af12f[_0xc53b('0x8c')]){var _0x353084=_[_0xc53b('0x49')](_0x2af12f[_0xc53b('0x8c')],function(_0x45d290){return _0x45d290[_0xc53b('0x8d')]===_0x29160b[_0xc53b('0x73')];});if(!_0x353084){logger[_0xc53b('0x64')](util[_0xc53b('0x52')](_0xc53b('0x8e'),_0x511298[_0xc53b('0x45')]['id'],_0x29160b[_0xc53b('0x73')]));return createBucket(_0x10096f[_0xc53b('0x8f')],_0x10096f[_0xc53b('0x8a')],_0x29160b[_0xc53b('0x80')],_0x29160b['bucket']);}logger['info'](util[_0xc53b('0x52')](_0xc53b('0x90'),_0x511298[_0xc53b('0x45')]['id'],_0x29160b[_0xc53b('0x73')]));return;}})[_0xc53b('0x24')](function(_0x50f4bf){if(_0x2456c8[_0xc53b('0x79')]===_0xc53b('0x91')){return transcribe(_0x511298[_0xc53b('0x45')]['id'],_0x10096f[_0xc53b('0x8f')],_0x10096f[_0xc53b('0x8a')],_0x29160b[_0xc53b('0x80')],_0x29160b['bucket'],_0x2456c8[_0xc53b('0x51')],_0x29160b['language']);}else{logger[_0xc53b('0x64')](util[_0xc53b('0x52')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x511298[_0xc53b('0x45')]['id']));return{'transcribeStatus':_0xc53b('0x92')};}})['then'](function(_0x591d93){if(_0x591d93){_0x591d93[_0xc53b('0x93')]=_0x511298[_0xc53b('0x4b')][_0xc53b('0x82')];return _0x2456c8[_0xc53b('0x94')](_0x591d93);}})[_0xc53b('0x24')](respondWithResult(_0x528b54,null))[_0xc53b('0x43')](handleError(_0x528b54,null));};function writeFile(_0x5671c2,_0xec8277){return new Promise(function(_0x6957e5,_0x1905a9){fs[_0xc53b('0x95')](_0xec8277,_0x5671c2,function(_0x4d203a,_0x261c2f){if(_0x4d203a){return _0x1905a9(_0x4d203a);}else{return _0x6957e5(_0x261c2f);}});});}exports['downloadTranscribe']=function(_0x2c0b33,_0x53d419,_0x57520b){return db[_0xc53b('0x46')][_0xc53b('0x7c')]({'where':{'id':_0x2c0b33[_0xc53b('0x45')]['id']}})[_0xc53b('0x24')](handleEntityNotFound(_0x53d419))['then'](function(_0x1b5b1f){if(_0x1b5b1f&&_0x1b5b1f['fileText']){var _0x31a0a2=_0x1b5b1f[_0xc53b('0x96')];var _0x4242ad=config[_0xc53b('0x97')]+_0xc53b('0x98')+_0x1b5b1f['id']+_0xc53b('0x99');if(fs['existsSync'](_0x4242ad)){return _0x4242ad;}return writeFile(_0x31a0a2,_0x4242ad)[_0xc53b('0x24')](function(){return _0x4242ad;});}else{throw new db[(_0xc53b('0x86'))]['ValidationError'](_0xc53b('0x9a'));}})['then'](function(_0x2b030e){return _0x53d419[_0xc53b('0x4e')](_0x2b030e);})[_0xc53b('0x43')](handleError(_0x53d419));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index ecc9e57..080c792 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 _0xee39=['voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','exports','define','VoiceRecording'];(function(_0x551527,_0x4ac3c3){var _0x3ff11b=function(_0x14af27){while(--_0x14af27){_0x551527['push'](_0x551527['shift']());}};_0x3ff11b(++_0x4ac3c3);}(_0xee39,0x1e6));var _0x9ee3=function(_0x1cb409,_0x173f28){_0x1cb409=_0x1cb409-0x0;var _0x849de6=_0xee39[_0x1cb409];return _0x849de6;};'use strict';var attributes=require(_0x9ee3('0x0'));module[_0x9ee3('0x1')]=function(_0xe604cf,_0x58cf62){return _0xe604cf[_0x9ee3('0x2')](_0x9ee3('0x3'),attributes,{'tableName':_0x9ee3('0x4'),'paranoid':![],'indexes':[{'name':_0x9ee3('0x5'),'fields':[_0x9ee3('0x5')]},{'name':_0x9ee3('0x6'),'fields':[_0x9ee3('0x6')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x562d=['voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','exports','VoiceRecording'];(function(_0x545b71,_0x4f44eb){var _0x26e587=function(_0x293b81){while(--_0x293b81){_0x545b71['push'](_0x545b71['shift']());}};_0x26e587(++_0x4f44eb);}(_0x562d,0xe1));var _0xd562=function(_0x4b8377,_0x50d1c3){_0x4b8377=_0x4b8377-0x0;var _0x58506f=_0x562d[_0x4b8377];return _0x58506f;};'use strict';var attributes=require(_0xd562('0x0'));module[_0xd562('0x1')]=function(_0x41a5c7,_0x590061){return _0x41a5c7['define'](_0xd562('0x2'),attributes,{'tableName':_0xd562('0x3'),'paranoid':![],'indexes':[{'name':_0xd562('0x4'),'fields':['uniqueid']},{'name':_0xd562('0x5'),'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 48d5035..1e260a1 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 _0x9536=['util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','CreateVoiceRecording','Setting','callRecordingEncryption','create','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash'];(function(_0x2ddb6d,_0x25d45b){var _0x56c103=function(_0x4f73c4){while(--_0x4f73c4){_0x2ddb6d['push'](_0x2ddb6d['shift']());}};_0x56c103(++_0x25d45b);}(_0x9536,0x179));var _0x6953=function(_0x581249,_0x483f03){_0x581249=_0x581249-0x0;var _0x284bae=_0x9536[_0x581249];return _0x284bae;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var moment=require(_0x6953('0x2'));var BPromise=require(_0x6953('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6953('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6953('0x5'));var logger=require(_0x6953('0x6'))(_0x6953('0x7'));var config=require(_0x6953('0x8'));var jayson=require(_0x6953('0x9'));var client=jayson['client'][_0x6953('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bb026,_0x385f2d,_0x3e1aff){return new BPromise(function(_0x1c8225,_0x58ac30){return client[_0x6953('0xb')](_0x2bb026,_0x3e1aff)[_0x6953('0xc')](function(_0x449acb){logger['info'](_0x6953('0xd'),_0x385f2d,_0x6953('0xe'));logger[_0x6953('0xf')](_0x6953('0x10'),_0x385f2d,_0x6953('0xe'),JSON[_0x6953('0x11')](_0x449acb));if(_0x449acb[_0x6953('0x12')]){if(_0x449acb[_0x6953('0x12')][_0x6953('0x13')]===0x1f4){logger['error'](_0x6953('0xd'),_0x385f2d,_0x449acb['error'][_0x6953('0x14')]);return _0x58ac30(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}logger[_0x6953('0x12')](_0x6953('0xd'),_0x385f2d,_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);return _0x1c8225(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}else{logger[_0x6953('0x15')](_0x6953('0xd'),_0x385f2d,'request\x20sent');_0x1c8225(_0x449acb['result'][_0x6953('0x14')]);}})[_0x6953('0x16')](function(_0x16b79b){logger[_0x6953('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x385f2d,_0x16b79b);_0x58ac30(_0x16b79b);});});}exports[_0x6953('0x17')]=function(_0x2da771){var _0x4b43ae=this;return new Promise(function(_0x10858a,_0x3207dd){return db[_0x6953('0x18')][_0x6953('0x19')](_0x2da771[_0x6953('0x1a')],{'raw':_0x2da771['options']?_0x2da771[_0x6953('0x1b')][_0x6953('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2da771[_0x6953('0x1b')]?_0x2da771[_0x6953('0x1b')][_0x6953('0x1d')]||null:null,'attributes':_0x2da771['options']?_0x2da771[_0x6953('0x1b')][_0x6953('0x1e')]||null:null,'limit':_0x2da771['options']?_0x2da771[_0x6953('0x1b')][_0x6953('0x1f')]||null:null})[_0x6953('0xc')](function(_0x171dd8){logger['info'](_0x6953('0x17'),_0x2da771);logger[_0x6953('0xf')](_0x6953('0x17'),_0x2da771,JSON['stringify'](_0x171dd8));_0x10858a(_0x171dd8);})['catch'](function(_0x5a4cd7){logger[_0x6953('0x12')](_0x6953('0x17'),_0x5a4cd7['message'],_0x2da771);_0x3207dd(_0x4b43ae[_0x6953('0x12')](0x1f4,_0x5a4cd7['message']));});});};exports[_0x6953('0x20')]=function(_0x2bf39b){var _0xcdbce8=this;return new Promise(function(_0x2cc01e,_0x191d80){var _0x1497e3=require('../../components/encryptor');var _0x3dd890;return db[_0x6953('0x21')]['findOne']({'attributes':['id',_0x6953('0x22')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x173b3c){_0x3dd890=_0x173b3c;return db[_0x6953('0x18')][_0x6953('0x23')](_0x2bf39b['body']);})[_0x6953('0xc')](function(_0x3d7b04){if(_0x3dd890[_0x6953('0x22')]&&fs['existsSync'](_0x3d7b04[_0x6953('0x24')])){var _0x132a71=util['format']('%s.cypher',_0x3d7b04[_0x6953('0x24')]);return _0x1497e3[_0x6953('0x25')](_0x3d7b04[_0x6953('0x24')],_0x132a71,config[_0x6953('0x26')][_0x6953('0x27')])['then'](function(){fs[_0x6953('0x28')](_0x3d7b04['value']);logger[_0x6953('0x15')](_0x6953('0x29'));return _0x3d7b04;});}return _0x3d7b04;})['then'](function(_0x4a4d41){logger[_0x6953('0x15')](_0x6953('0x20'),_0x2bf39b);logger[_0x6953('0xf')]('CreateVoiceRecording',_0x2bf39b,JSON[_0x6953('0x11')](_0x4a4d41));_0x2cc01e(_0x4a4d41);})['catch'](function(_0x4e95f1){logger['error']('CreateVoiceRecording',_0x4e95f1[_0x6953('0x14')],_0x2bf39b);_0x191d80(_0xcdbce8[_0x6953('0x12')](0x1f4,_0x4e95f1[_0x6953('0x14')]));});});}; \ No newline at end of file +var _0x160f=['../../config/environment','client','http','then','info','VoiceRecording,\x20%s,\x20%s','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','debug','CreateVoiceRecording','../../components/encryptor','Setting','create','existsSync','format','%s.cypher','encryptFile','value','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x341fd6,_0x9d0e71){var _0x3755d3=function(_0x3b7fd3){while(--_0x3b7fd3){_0x341fd6['push'](_0x341fd6['shift']());}};_0x3755d3(++_0x9d0e71);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf160('0x0'));var util=require(_0xf160('0x1'));var moment=require(_0xf160('0x2'));var BPromise=require(_0xf160('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf160('0x4'));var db=require(_0xf160('0x5'))['db'];var utils=require(_0xf160('0x6'));var logger=require(_0xf160('0x7'))(_0xf160('0x8'));var config=require(_0xf160('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf160('0xa')][_0xf160('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49fe49,_0x59440e,_0x41e909){return new BPromise(function(_0x5b76c8,_0x4bf890){return client['request'](_0x49fe49,_0x41e909)[_0xf160('0xc')](function(_0x90608){logger[_0xf160('0xd')](_0xf160('0xe'),_0x59440e,'request\x20sent');logger['debug'](_0xf160('0xf'),_0x59440e,_0xf160('0x10'),JSON[_0xf160('0x11')](_0x90608));if(_0x90608['error']){if(_0x90608[_0xf160('0x12')][_0xf160('0x13')]===0x1f4){logger[_0xf160('0x12')](_0xf160('0xe'),_0x59440e,_0x90608[_0xf160('0x12')]['message']);return _0x4bf890(_0x90608[_0xf160('0x12')]['message']);}logger[_0xf160('0x12')](_0xf160('0xe'),_0x59440e,_0x90608[_0xf160('0x12')][_0xf160('0x14')]);return _0x5b76c8(_0x90608[_0xf160('0x12')][_0xf160('0x14')]);}else{logger[_0xf160('0xd')](_0xf160('0xe'),_0x59440e,_0xf160('0x10'));_0x5b76c8(_0x90608['result'][_0xf160('0x14')]);}})[_0xf160('0x15')](function(_0x8699a0){logger[_0xf160('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x59440e,_0x8699a0);_0x4bf890(_0x8699a0);});});}exports[_0xf160('0x16')]=function(_0x4b8185){var _0x5388c7=this;return new Promise(function(_0x1cf6ba,_0x1e0c78){return db[_0xf160('0x17')][_0xf160('0x18')](_0x4b8185[_0xf160('0x19')],{'raw':_0x4b8185[_0xf160('0x1a')]?_0x4b8185[_0xf160('0x1a')][_0xf160('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b8185['options']?_0x4b8185[_0xf160('0x1a')][_0xf160('0x1c')]||null:null,'attributes':_0x4b8185[_0xf160('0x1a')]?_0x4b8185['options'][_0xf160('0x1d')]||null:null,'limit':_0x4b8185[_0xf160('0x1a')]?_0x4b8185[_0xf160('0x1a')][_0xf160('0x1e')]||null:null})[_0xf160('0xc')](function(_0x1b0081){logger[_0xf160('0xd')]('UpdateVoiceRecording',_0x4b8185);logger[_0xf160('0x1f')](_0xf160('0x16'),_0x4b8185,JSON[_0xf160('0x11')](_0x1b0081));_0x1cf6ba(_0x1b0081);})[_0xf160('0x15')](function(_0x578f7d){logger[_0xf160('0x12')](_0xf160('0x16'),_0x578f7d['message'],_0x4b8185);_0x1e0c78(_0x5388c7['error'](0x1f4,_0x578f7d[_0xf160('0x14')]));});});};exports[_0xf160('0x20')]=function(_0x39c0e3){var _0x4c0c51=this;return new Promise(function(_0xcfa9bd,_0x73851f){var _0x2851e8=require(_0xf160('0x21'));var _0x135e0f;return db[_0xf160('0x22')]['findOne']({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})['then'](function(_0x26e7b9){_0x135e0f=_0x26e7b9;return db[_0xf160('0x17')][_0xf160('0x23')](_0x39c0e3[_0xf160('0x19')]);})[_0xf160('0xc')](function(_0x563103){if(_0x135e0f['callRecordingEncryption']&&fs[_0xf160('0x24')](_0x563103['value'])){var _0x4ce478=util[_0xf160('0x25')](_0xf160('0x26'),_0x563103['value']);return _0x2851e8[_0xf160('0x27')](_0x563103[_0xf160('0x28')],_0x4ce478,config['secrets']['recording'])['then'](function(){fs['unlink'](_0x563103[_0xf160('0x28')]);logger[_0xf160('0xd')](_0xf160('0x29'));return _0x563103;});}return _0x563103;})[_0xf160('0xc')](function(_0x16c528){logger[_0xf160('0xd')]('CreateVoiceRecording',_0x39c0e3);logger['debug']('CreateVoiceRecording',_0x39c0e3,JSON[_0xf160('0x11')](_0x16c528));_0xcfa9bd(_0x16c528);})['catch'](function(_0x5c65d2){logger[_0xf160('0x12')](_0xf160('0x20'),_0x5c65d2['message'],_0x39c0e3);_0x73851f(_0x4c0c51[_0xf160('0x12')](0x1f4,_0x5c65d2[_0xf160('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 77d9e21..1b73566 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 _0x56bd=['../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','post','/:id','update','delete','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x44f296,_0x208ade){var _0x2745a=function(_0x165d4c){while(--_0x165d4c){_0x44f296['push'](_0x44f296['shift']());}};_0x2745a(++_0x208ade);}(_0x56bd,0x1c2));var _0xd56b=function(_0x528d3f,_0x26dfee){_0x528d3f=_0x528d3f-0x0;var _0x34c455=_0x56bd[_0x528d3f];return _0x34c455;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd56b('0x0'));var timeout=require(_0xd56b('0x1'));var express=require('express');var router=express[_0xd56b('0x2')]();var fs_extra=require(_0xd56b('0x3'));var auth=require(_0xd56b('0x4'));var interaction=require(_0xd56b('0x5'));var config=require(_0xd56b('0x6'));var controller=require(_0xd56b('0x7'));router[_0xd56b('0x8')]('/',auth[_0xd56b('0x9')](),controller[_0xd56b('0xa')]);router[_0xd56b('0x8')](_0xd56b('0xb'),auth['isAuthenticated'](),controller[_0xd56b('0xc')]);router[_0xd56b('0x8')]('/:id',auth[_0xd56b('0x9')](),controller['show']);router[_0xd56b('0xd')]('/',auth[_0xd56b('0x9')](),controller['create']);router['put'](_0xd56b('0xe'),auth[_0xd56b('0x9')](),controller[_0xd56b('0xf')]);router[_0xd56b('0x10')](_0xd56b('0xe'),auth[_0xd56b('0x9')](),controller[_0xd56b('0x11')]);module[_0xd56b('0x12')]=router; \ No newline at end of file +var _0xb08c=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post'];(function(_0x209f29,_0x1c97e1){var _0x358835=function(_0x147a65){while(--_0x147a65){_0x209f29['push'](_0x209f29['shift']());}};_0x358835(++_0x1c97e1);}(_0xb08c,0x1d4));var _0xcb08=function(_0x16705d,_0x510bf9){_0x16705d=_0x16705d-0x0;var _0x1e0b0f=_0xb08c[_0x16705d];return _0x1e0b0f;};'use strict';var multer=require(_0xcb08('0x0'));var util=require(_0xcb08('0x1'));var path=require(_0xcb08('0x2'));var timeout=require(_0xcb08('0x3'));var express=require(_0xcb08('0x4'));var router=express[_0xcb08('0x5')]();var fs_extra=require(_0xcb08('0x6'));var auth=require(_0xcb08('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xcb08('0x8'));var controller=require('./voiceTransferReport.controller');router[_0xcb08('0x9')]('/',auth[_0xcb08('0xa')](),controller[_0xcb08('0xb')]);router['get']('/describe',auth[_0xcb08('0xa')](),controller[_0xcb08('0xc')]);router[_0xcb08('0x9')](_0xcb08('0xd'),auth[_0xcb08('0xa')](),controller[_0xcb08('0xe')]);router[_0xcb08('0xf')]('/',auth[_0xcb08('0xa')](),controller[_0xcb08('0x10')]);router[_0xcb08('0x11')](_0xcb08('0xd'),auth['isAuthenticated'](),controller[_0xcb08('0x12')]);router[_0xcb08('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xcb08('0x14')]);module[_0xcb08('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index de48879..8fbbc4d 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 _0xa2db=['ENUM','moment','exports','STRING'];(function(_0x4008de,_0x15f2e9){var _0x596738=function(_0x2d4060){while(--_0x2d4060){_0x4008de['push'](_0x4008de['shift']());}};_0x596738(++_0x15f2e9);}(_0xa2db,0x65));var _0xba2d=function(_0x45161c,_0x5494fc){_0x45161c=_0x45161c-0x0;var _0x186581=_0xa2db[_0x45161c];return _0x186581;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xba2d('0x0'));module[_0xba2d('0x1')]={'type':{'type':Sequelize['ENUM']('blind','attended')},'result':{'type':Sequelize[_0xba2d('0x2')]},'transfererchannel':{'type':Sequelize[_0xba2d('0x2')]},'transferercalleridnum':{'type':Sequelize[_0xba2d('0x2')]},'transferercalleridname':{'type':Sequelize[_0xba2d('0x2')]},'transfererconnectedlinenum':{'type':Sequelize[_0xba2d('0x2')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0xba2d('0x2')]},'transferercontext':{'type':Sequelize[_0xba2d('0x2')]},'transfererexten':{'type':Sequelize[_0xba2d('0x2')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xba2d('0x2')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0xba2d('0x2')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0xba2d('0x2')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0xba2d('0x2')]},'transfereeexten':{'type':Sequelize[_0xba2d('0x2')]},'transfereelinkedid':{'type':Sequelize[_0xba2d('0x2')]},'isexternal':{'type':Sequelize[_0xba2d('0x3')]('Yes','No')},'context':{'type':Sequelize[_0xba2d('0x2')]},'extension':{'type':Sequelize[_0xba2d('0x2')]}}; \ No newline at end of file +var _0x05e0=['STRING','sequelize','moment','exports','ENUM','blind','attended'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x05e0,0x1ac));var _0x005e=function(_0x391bf0,_0x5080c4){_0x391bf0=_0x391bf0-0x0;var _0x92671e=_0x05e0[_0x391bf0];return _0x92671e;};'use strict';var Sequelize=require(_0x005e('0x0'));var moment=require(_0x005e('0x1'));module[_0x005e('0x2')]={'type':{'type':Sequelize[_0x005e('0x3')](_0x005e('0x4'),_0x005e('0x5'))},'result':{'type':Sequelize[_0x005e('0x6')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x005e('0x6')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x005e('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0x005e('0x6')]},'transfereraccountcode':{'type':Sequelize[_0x005e('0x6')]},'transferercontext':{'type':Sequelize[_0x005e('0x6')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x005e('0x6')]},'transfereechannel':{'type':Sequelize[_0x005e('0x6')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x005e('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x005e('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0x005e('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0x005e('0x6')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x005e('0x6')]},'isexternal':{'type':Sequelize[_0x005e('0x3')]('Yes','No')},'context':{'type':Sequelize[_0x005e('0x6')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 5712502..58c6bf7 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 _0x38d5=['limit','set','apply','reject','update','then','sendStatus','error','stack','name','map','VoiceTransferReport','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','destroy','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','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','end','json','offset','undefined','count'];(function(_0x269348,_0x23f45d){var _0x15edd7=function(_0x4703bc){while(--_0x4703bc){_0x269348['push'](_0x269348['shift']());}};_0x15edd7(++_0x23f45d);}(_0x38d5,0x1a9));var _0x538d=function(_0x50429f,_0x293789){_0x50429f=_0x50429f-0x0;var _0x7ee30e=_0x38d5[_0x50429f];return _0x7ee30e;};'use strict';var emlformat=require(_0x538d('0x0'));var rimraf=require(_0x538d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x538d('0x2'));var moment=require(_0x538d('0x3'));var BPromise=require(_0x538d('0x4'));var Mustache=require(_0x538d('0x5'));var util=require(_0x538d('0x6'));var path=require(_0x538d('0x7'));var sox=require('sox');var csv=require(_0x538d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x538d('0x9'));var _=require(_0x538d('0xa'));var squel=require(_0x538d('0xb'));var crypto=require(_0x538d('0xc'));var jsforce=require(_0x538d('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x538d('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x538d('0xf'));var qs=require(_0x538d('0x10'));var as=require(_0x538d('0x11'));var hardwareService=require(_0x538d('0x12'));var logger=require(_0x538d('0x13'))(_0x538d('0x14'));var utils=require(_0x538d('0x15'));var config=require(_0x538d('0x16'));var licenseUtil=require(_0x538d('0x17'));var db=require(_0x538d('0x18'))['db'];function respondWithStatusCode(_0x4e98be,_0x2283c2){_0x2283c2=_0x2283c2||0xcc;return function(_0x53ddc5){if(_0x53ddc5){return _0x4e98be['sendStatus'](_0x2283c2);}return _0x4e98be[_0x538d('0x19')](_0x2283c2)[_0x538d('0x1a')]();};}function respondWithResult(_0x22fa54,_0xe3ca4){_0xe3ca4=_0xe3ca4||0xc8;return function(_0x4239b0){if(_0x4239b0){return _0x22fa54[_0x538d('0x19')](_0xe3ca4)[_0x538d('0x1b')](_0x4239b0);}};}function respondWithFilteredResult(_0x3e3279,_0x2b2304){return function(_0x55a1ff){if(_0x55a1ff){var _0x122e9f=typeof _0x2b2304[_0x538d('0x1c')]===_0x538d('0x1d')&&typeof _0x2b2304['limit']===_0x538d('0x1d');var _0x32b548=_0x55a1ff[_0x538d('0x1e')];var _0x3343ae=_0x122e9f?0x0:_0x2b2304[_0x538d('0x1c')];var _0x502f5f=_0x122e9f?_0x55a1ff['count']:_0x2b2304[_0x538d('0x1c')]+_0x2b2304[_0x538d('0x1f')];var _0x176b10;if(_0x502f5f>=_0x32b548){_0x502f5f=_0x32b548;_0x176b10=0xc8;}else{_0x176b10=0xce;}_0x3e3279['status'](_0x176b10);return _0x3e3279[_0x538d('0x20')]('Content-Range',_0x3343ae+'-'+_0x502f5f+'/'+_0x32b548)[_0x538d('0x1b')](_0x55a1ff);}return null;};}function patchUpdates(_0x1575ce){return function(_0x190b33){try{jsonpatch[_0x538d('0x21')](_0x190b33,_0x1575ce,!![]);}catch(_0x1ddd79){return BPromise[_0x538d('0x22')](_0x1ddd79);}return _0x190b33['save']();};}function saveUpdates(_0x15315c,_0x19542b){return function(_0x4dd757){if(_0x4dd757){return _0x4dd757[_0x538d('0x23')](_0x15315c)[_0x538d('0x24')](function(_0x59d65d){return _0x59d65d;});}return null;};}function removeEntity(_0x10cd3f,_0x254cda){return function(_0x18347d){if(_0x18347d){return _0x18347d['destroy']()[_0x538d('0x24')](function(){_0x10cd3f[_0x538d('0x19')](0xcc)[_0x538d('0x1a')]();});}};}function handleEntityNotFound(_0x38021c,_0xb785c6){return function(_0x16ef44){if(!_0x16ef44){_0x38021c[_0x538d('0x25')](0x194);}return _0x16ef44;};}function handleError(_0x32b18d,_0x7a79cf){_0x7a79cf=_0x7a79cf||0x1f4;return function(_0x725eba){logger[_0x538d('0x26')](_0x725eba[_0x538d('0x27')]);if(_0x725eba[_0x538d('0x28')]){delete _0x725eba[_0x538d('0x28')];}_0x32b18d[_0x538d('0x19')](_0x7a79cf)['send'](_0x725eba);};}exports['index']=function(_0x298c3b,_0x37f130){var _0x5c9107={},_0xa6d9fc={},_0x39cb7e={'count':0x0,'rows':[]};var _0x19523d=_[_0x538d('0x29')](db[_0x538d('0x2a')]['rawAttributes'],function(_0x2b9e77){return{'name':_0x2b9e77[_0x538d('0x2b')],'type':_0x2b9e77[_0x538d('0x2c')]['key']};});_0xa6d9fc[_0x538d('0x2d')]=_[_0x538d('0x29')](_0x19523d,_0x538d('0x28'));_0xa6d9fc['query']=_['keys'](_0x298c3b[_0x538d('0x2e')]);_0xa6d9fc[_0x538d('0x2f')]=_[_0x538d('0x30')](_0xa6d9fc[_0x538d('0x2d')],_0xa6d9fc['query']);_0x5c9107[_0x538d('0x31')]=_[_0x538d('0x30')](_0xa6d9fc['model'],qs[_0x538d('0x32')](_0x298c3b[_0x538d('0x2e')][_0x538d('0x32')]));_0x5c9107['attributes']=_0x5c9107['attributes'][_0x538d('0x33')]?_0x5c9107['attributes']:_0xa6d9fc[_0x538d('0x2d')];if(!_0x298c3b[_0x538d('0x2e')][_0x538d('0x34')](_0x538d('0x35'))){_0x5c9107[_0x538d('0x1f')]=qs[_0x538d('0x1f')](_0x298c3b[_0x538d('0x2e')]['limit']);_0x5c9107[_0x538d('0x1c')]=qs[_0x538d('0x1c')](_0x298c3b[_0x538d('0x2e')]['offset']);}_0x5c9107[_0x538d('0x36')]=qs[_0x538d('0x37')](_0x298c3b[_0x538d('0x2e')][_0x538d('0x37')]);_0x5c9107['where']=qs[_0x538d('0x2f')](_[_0x538d('0x38')](_0x298c3b[_0x538d('0x2e')],_0xa6d9fc[_0x538d('0x2f')]),_0x19523d);if(_0x298c3b[_0x538d('0x2e')][_0x538d('0x39')]){_0x5c9107[_0x538d('0x3a')]=_[_0x538d('0x3b')](_0x5c9107[_0x538d('0x3a')],{'$or':_['map'](_0x19523d,function(_0x4e887c){if(_0x4e887c['type']!==_0x538d('0x3c')){var _0xa0765b={};_0xa0765b[_0x4e887c[_0x538d('0x28')]]={'$like':'%'+_0x298c3b[_0x538d('0x2e')][_0x538d('0x39')]+'%'};return _0xa0765b;}})});}_0x5c9107=_[_0x538d('0x3b')]({},_0x5c9107,_0x298c3b[_0x538d('0x3d')]);var _0x5c3345={'where':_0x5c9107[_0x538d('0x3a')]};return db['VoiceTransferReport'][_0x538d('0x1e')](_0x5c3345)[_0x538d('0x24')](function(_0x45e017){_0x39cb7e['count']=_0x45e017;if(_0x298c3b[_0x538d('0x2e')][_0x538d('0x3e')]){_0x5c9107[_0x538d('0x3f')]=[{'all':!![]}];}return db[_0x538d('0x2a')][_0x538d('0x40')](_0x5c9107);})[_0x538d('0x24')](function(_0x549dbd){_0x39cb7e[_0x538d('0x41')]=_0x549dbd;return _0x39cb7e;})[_0x538d('0x24')](respondWithFilteredResult(_0x37f130,_0x5c9107))[_0x538d('0x42')](handleError(_0x37f130,null));};exports[_0x538d('0x43')]=function(_0x2cfd8d,_0x3d9b1e){var _0x55b62e={'raw':!![],'where':{'id':_0x2cfd8d[_0x538d('0x44')]['id']}},_0x3d712e={};_0x3d712e['model']=_[_0x538d('0x45')](db[_0x538d('0x2a')][_0x538d('0x46')]);_0x3d712e[_0x538d('0x2e')]=_['keys'](_0x2cfd8d[_0x538d('0x2e')]);_0x3d712e[_0x538d('0x2f')]=_[_0x538d('0x30')](_0x3d712e[_0x538d('0x2d')],_0x3d712e[_0x538d('0x2e')]);_0x55b62e[_0x538d('0x31')]=_[_0x538d('0x30')](_0x3d712e[_0x538d('0x2d')],qs[_0x538d('0x32')](_0x2cfd8d[_0x538d('0x2e')][_0x538d('0x32')]));_0x55b62e[_0x538d('0x31')]=_0x55b62e[_0x538d('0x31')][_0x538d('0x33')]?_0x55b62e['attributes']:_0x3d712e['model'];if(_0x2cfd8d['query'][_0x538d('0x3e')]){_0x55b62e[_0x538d('0x3f')]=[{'all':!![]}];}_0x55b62e=_[_0x538d('0x3b')]({},_0x55b62e,_0x2cfd8d[_0x538d('0x3d')]);return db[_0x538d('0x2a')][_0x538d('0x47')](_0x55b62e)['then'](handleEntityNotFound(_0x3d9b1e,null))[_0x538d('0x24')](respondWithResult(_0x3d9b1e,null))[_0x538d('0x42')](handleError(_0x3d9b1e,null));};exports[_0x538d('0x48')]=function(_0x228aea,_0x451ae8){return db[_0x538d('0x2a')]['create'](_0x228aea[_0x538d('0x49')],{})['then'](respondWithResult(_0x451ae8,0xc9))['catch'](handleError(_0x451ae8,null));};exports['update']=function(_0x87edd0,_0x57e941){if(_0x87edd0['body']['id']){delete _0x87edd0[_0x538d('0x49')]['id'];}return db[_0x538d('0x2a')][_0x538d('0x47')]({'where':{'id':_0x87edd0[_0x538d('0x44')]['id']}})[_0x538d('0x24')](handleEntityNotFound(_0x57e941,null))['then'](saveUpdates(_0x87edd0[_0x538d('0x49')],null))['then'](respondWithResult(_0x57e941,null))[_0x538d('0x42')](handleError(_0x57e941,null));};exports[_0x538d('0x4a')]=function(_0x5d84d6,_0xa1f6b5){return db[_0x538d('0x2a')]['find']({'where':{'id':_0x5d84d6[_0x538d('0x44')]['id']}})['then'](handleEntityNotFound(_0xa1f6b5,null))[_0x538d('0x24')](removeEntity(_0xa1f6b5,null))[_0x538d('0x42')](handleError(_0xa1f6b5,null));};exports[_0x538d('0x4b')]=function(_0xd0fe69,_0x1a59d9){return db[_0x538d('0x2a')][_0x538d('0x4b')]()[_0x538d('0x24')](respondWithResult(_0x1a59d9,null))['catch'](handleError(_0x1a59d9,null));}; \ No newline at end of file +var _0xed3f=['params','describe','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','send','VoiceTransferReport','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','map','VIRTUAL','name','options','findAll','show','includeAll','catch','create','body'];(function(_0x555ef8,_0x43e041){var _0x38cc30=function(_0x105961){while(--_0x105961){_0x555ef8['push'](_0x555ef8['shift']());}};_0x38cc30(++_0x43e041);}(_0xed3f,0x1de));var _0xfed3=function(_0x391154,_0x40fb12){_0x391154=_0x391154-0x0;var _0x4b7767=_0xed3f[_0x391154];return _0x4b7767;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfed3('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfed3('0x1'));var moment=require(_0xfed3('0x2'));var BPromise=require(_0xfed3('0x3'));var Mustache=require('mustache');var util=require(_0xfed3('0x4'));var path=require('path');var sox=require(_0xfed3('0x5'));var csv=require(_0xfed3('0x6'));var ejs=require(_0xfed3('0x7'));var fs=require('fs');var fs_extra=require(_0xfed3('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xfed3('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfed3('0x6'));var querystring=require(_0xfed3('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfed3('0xb'));var qs=require(_0xfed3('0xc'));var as=require(_0xfed3('0xd'));var hardwareService=require(_0xfed3('0xe'));var logger=require(_0xfed3('0xf'))(_0xfed3('0x10'));var utils=require(_0xfed3('0x11'));var config=require(_0xfed3('0x12'));var licenseUtil=require(_0xfed3('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1bd591,_0x39b073){_0x39b073=_0x39b073||0xcc;return function(_0x3b30ec){if(_0x3b30ec){return _0x1bd591['sendStatus'](_0x39b073);}return _0x1bd591[_0xfed3('0x14')](_0x39b073)[_0xfed3('0x15')]();};}function respondWithResult(_0x1a7cab,_0x5c6f6b){_0x5c6f6b=_0x5c6f6b||0xc8;return function(_0x32dadf){if(_0x32dadf){return _0x1a7cab[_0xfed3('0x14')](_0x5c6f6b)[_0xfed3('0x16')](_0x32dadf);}};}function respondWithFilteredResult(_0x2be858,_0xdf63e4){return function(_0x5a3a67){if(_0x5a3a67){var _0x5828a8=typeof _0xdf63e4[_0xfed3('0x17')]===_0xfed3('0x18')&&typeof _0xdf63e4[_0xfed3('0x19')]==='undefined';var _0x4b1f7=_0x5a3a67[_0xfed3('0x1a')];var _0x39e03b=_0x5828a8?0x0:_0xdf63e4[_0xfed3('0x17')];var _0x3561c2=_0x5828a8?_0x5a3a67[_0xfed3('0x1a')]:_0xdf63e4[_0xfed3('0x17')]+_0xdf63e4[_0xfed3('0x19')];var _0x454082;if(_0x3561c2>=_0x4b1f7){_0x3561c2=_0x4b1f7;_0x454082=0xc8;}else{_0x454082=0xce;}_0x2be858[_0xfed3('0x14')](_0x454082);return _0x2be858[_0xfed3('0x1b')](_0xfed3('0x1c'),_0x39e03b+'-'+_0x3561c2+'/'+_0x4b1f7)[_0xfed3('0x16')](_0x5a3a67);}return null;};}function patchUpdates(_0x46e238){return function(_0x3742cd){try{jsonpatch[_0xfed3('0x1d')](_0x3742cd,_0x46e238,!![]);}catch(_0x5824b4){return BPromise[_0xfed3('0x1e')](_0x5824b4);}return _0x3742cd[_0xfed3('0x1f')]();};}function saveUpdates(_0x3cedde,_0x57b237){return function(_0x11908a){if(_0x11908a){return _0x11908a[_0xfed3('0x20')](_0x3cedde)[_0xfed3('0x21')](function(_0x4453c1){return _0x4453c1;});}return null;};}function removeEntity(_0x31ed89,_0x2dd9f4){return function(_0x4a0d6f){if(_0x4a0d6f){return _0x4a0d6f[_0xfed3('0x22')]()[_0xfed3('0x21')](function(){_0x31ed89['status'](0xcc)[_0xfed3('0x15')]();});}};}function handleEntityNotFound(_0x52aa56,_0x2a9e69){return function(_0x478e75){if(!_0x478e75){_0x52aa56[_0xfed3('0x23')](0x194);}return _0x478e75;};}function handleError(_0x385ca2,_0x741a76){_0x741a76=_0x741a76||0x1f4;return function(_0x590d90){logger['error'](_0x590d90['stack']);if(_0x590d90['name']){delete _0x590d90['name'];}_0x385ca2[_0xfed3('0x14')](_0x741a76)[_0xfed3('0x24')](_0x590d90);};}exports['index']=function(_0x50d931,_0x110aaf){var _0x318cdb={},_0x292a0e={},_0x5416fc={'count':0x0,'rows':[]};var _0x500d02=_['map'](db[_0xfed3('0x25')][_0xfed3('0x26')],function(_0x419e62){return{'name':_0x419e62['fieldName'],'type':_0x419e62[_0xfed3('0x27')]['key']};});_0x292a0e[_0xfed3('0x28')]=_['map'](_0x500d02,'name');_0x292a0e[_0xfed3('0x29')]=_[_0xfed3('0x2a')](_0x50d931['query']);_0x292a0e['filters']=_[_0xfed3('0x2b')](_0x292a0e[_0xfed3('0x28')],_0x292a0e['query']);_0x318cdb[_0xfed3('0x2c')]=_[_0xfed3('0x2b')](_0x292a0e['model'],qs[_0xfed3('0x2d')](_0x50d931['query'][_0xfed3('0x2d')]));_0x318cdb[_0xfed3('0x2c')]=_0x318cdb['attributes'][_0xfed3('0x2e')]?_0x318cdb[_0xfed3('0x2c')]:_0x292a0e['model'];if(!_0x50d931[_0xfed3('0x29')][_0xfed3('0x2f')](_0xfed3('0x30'))){_0x318cdb[_0xfed3('0x19')]=qs[_0xfed3('0x19')](_0x50d931[_0xfed3('0x29')][_0xfed3('0x19')]);_0x318cdb[_0xfed3('0x17')]=qs[_0xfed3('0x17')](_0x50d931[_0xfed3('0x29')][_0xfed3('0x17')]);}_0x318cdb[_0xfed3('0x31')]=qs[_0xfed3('0x32')](_0x50d931[_0xfed3('0x29')][_0xfed3('0x32')]);_0x318cdb[_0xfed3('0x33')]=qs['filters'](_[_0xfed3('0x34')](_0x50d931[_0xfed3('0x29')],_0x292a0e[_0xfed3('0x35')]),_0x500d02);if(_0x50d931[_0xfed3('0x29')][_0xfed3('0x36')]){_0x318cdb[_0xfed3('0x33')]=_[_0xfed3('0x37')](_0x318cdb[_0xfed3('0x33')],{'$or':_[_0xfed3('0x38')](_0x500d02,function(_0x100269){if(_0x100269[_0xfed3('0x27')]!==_0xfed3('0x39')){var _0x22d129={};_0x22d129[_0x100269[_0xfed3('0x3a')]]={'$like':'%'+_0x50d931[_0xfed3('0x29')]['filter']+'%'};return _0x22d129;}})});}_0x318cdb=_[_0xfed3('0x37')]({},_0x318cdb,_0x50d931[_0xfed3('0x3b')]);var _0x40698c={'where':_0x318cdb[_0xfed3('0x33')]};return db[_0xfed3('0x25')]['count'](_0x40698c)['then'](function(_0x27909f){_0x5416fc[_0xfed3('0x1a')]=_0x27909f;if(_0x50d931[_0xfed3('0x29')]['includeAll']){_0x318cdb['include']=[{'all':!![]}];}return db['VoiceTransferReport'][_0xfed3('0x3c')](_0x318cdb);})[_0xfed3('0x21')](function(_0x3ba5fa){_0x5416fc['rows']=_0x3ba5fa;return _0x5416fc;})[_0xfed3('0x21')](respondWithFilteredResult(_0x110aaf,_0x318cdb))['catch'](handleError(_0x110aaf,null));};exports[_0xfed3('0x3d')]=function(_0x68ec6a,_0x23e377){var _0x31aa4b={'raw':!![],'where':{'id':_0x68ec6a['params']['id']}},_0x3f91b1={};_0x3f91b1[_0xfed3('0x28')]=_['keys'](db[_0xfed3('0x25')][_0xfed3('0x26')]);_0x3f91b1[_0xfed3('0x29')]=_[_0xfed3('0x2a')](_0x68ec6a[_0xfed3('0x29')]);_0x3f91b1[_0xfed3('0x35')]=_[_0xfed3('0x2b')](_0x3f91b1[_0xfed3('0x28')],_0x3f91b1['query']);_0x31aa4b[_0xfed3('0x2c')]=_['intersection'](_0x3f91b1[_0xfed3('0x28')],qs[_0xfed3('0x2d')](_0x68ec6a[_0xfed3('0x29')][_0xfed3('0x2d')]));_0x31aa4b['attributes']=_0x31aa4b['attributes']['length']?_0x31aa4b[_0xfed3('0x2c')]:_0x3f91b1[_0xfed3('0x28')];if(_0x68ec6a[_0xfed3('0x29')][_0xfed3('0x3e')]){_0x31aa4b['include']=[{'all':!![]}];}_0x31aa4b=_[_0xfed3('0x37')]({},_0x31aa4b,_0x68ec6a[_0xfed3('0x3b')]);return db[_0xfed3('0x25')]['find'](_0x31aa4b)['then'](handleEntityNotFound(_0x23e377,null))[_0xfed3('0x21')](respondWithResult(_0x23e377,null))[_0xfed3('0x3f')](handleError(_0x23e377,null));};exports[_0xfed3('0x40')]=function(_0x3a845a,_0x3381c4){return db[_0xfed3('0x25')][_0xfed3('0x40')](_0x3a845a[_0xfed3('0x41')],{})[_0xfed3('0x21')](respondWithResult(_0x3381c4,0xc9))[_0xfed3('0x3f')](handleError(_0x3381c4,null));};exports[_0xfed3('0x20')]=function(_0x331e19,_0x69af9f){if(_0x331e19['body']['id']){delete _0x331e19[_0xfed3('0x41')]['id'];}return db[_0xfed3('0x25')]['find']({'where':{'id':_0x331e19[_0xfed3('0x42')]['id']}})[_0xfed3('0x21')](handleEntityNotFound(_0x69af9f,null))[_0xfed3('0x21')](saveUpdates(_0x331e19[_0xfed3('0x41')],null))[_0xfed3('0x21')](respondWithResult(_0x69af9f,null))['catch'](handleError(_0x69af9f,null));};exports[_0xfed3('0x22')]=function(_0x29e9aa,_0x2aa01b){return db[_0xfed3('0x25')]['find']({'where':{'id':_0x29e9aa[_0xfed3('0x42')]['id']}})[_0xfed3('0x21')](handleEntityNotFound(_0x2aa01b,null))[_0xfed3('0x21')](removeEntity(_0x2aa01b,null))[_0xfed3('0x3f')](handleError(_0x2aa01b,null));};exports[_0xfed3('0x43')]=function(_0x2d9371,_0x428275){return db[_0xfed3('0x25')][_0xfed3('0x43')]()[_0xfed3('0x21')](respondWithResult(_0x428275,null))[_0xfed3('0x3f')](handleError(_0x428275,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 989a9c7..0ada6a2 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 _0xb8ed=['path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','VoiceTransferReport','report_call_transfer','lodash','api','moment','bluebird','request-promise'];(function(_0x2e937e,_0x363489){var _0x5db8bc=function(_0x4c9dfd){while(--_0x4c9dfd){_0x2e937e['push'](_0x2e937e['shift']());}};_0x5db8bc(++_0x363489);}(_0xb8ed,0x193));var _0xdb8e=function(_0x17b05e,_0x2d38ec){_0x17b05e=_0x17b05e-0x0;var _0x4bef32=_0xb8ed[_0x17b05e];return _0x4bef32;};'use strict';var _=require(_0xdb8e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdb8e('0x1'));var moment=require(_0xdb8e('0x2'));var BPromise=require(_0xdb8e('0x3'));var rp=require(_0xdb8e('0x4'));var fs=require('fs');var path=require(_0xdb8e('0x5'));var rimraf=require(_0xdb8e('0x6'));var config=require(_0xdb8e('0x7'));var attributes=require(_0xdb8e('0x8'));module[_0xdb8e('0x9')]=function(_0x183a10,_0x53f0b9){return _0x183a10['define'](_0xdb8e('0xa'),attributes,{'tableName':_0xdb8e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed93=['request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','define','VoiceTransferReport','report_call_transfer','util','../../config/logger','api','bluebird'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xed93,0x1d0));var _0x3ed9=function(_0x58f71e,_0x3d4a15){_0x58f71e=_0x58f71e-0x0;var _0x306f23=_0xed93[_0x58f71e];return _0x306f23;};'use strict';var _=require('lodash');var util=require(_0x3ed9('0x0'));var logger=require(_0x3ed9('0x1'))(_0x3ed9('0x2'));var moment=require('moment');var BPromise=require(_0x3ed9('0x3'));var rp=require(_0x3ed9('0x4'));var fs=require('fs');var path=require(_0x3ed9('0x5'));var rimraf=require(_0x3ed9('0x6'));var config=require(_0x3ed9('0x7'));var attributes=require(_0x3ed9('0x8'));module['exports']=function(_0x58fc3f,_0x18fb62){return _0x58fc3f[_0x3ed9('0x9')](_0x3ed9('0xa'),attributes,{'tableName':_0x3ed9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 215616f..ca1a3cc 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 _0x539c=['error','VoiceTransferReport,\x20%s,\x20%s','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify'];(function(_0x36b7d9,_0x357da7){var _0x558b85=function(_0x346d6b){while(--_0x346d6b){_0x36b7d9['push'](_0x36b7d9['shift']());}};_0x558b85(++_0x357da7);}(_0x539c,0xb8));var _0xc539=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x539c[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xc539('0x0'));var util=require(_0xc539('0x1'));var moment=require(_0xc539('0x2'));var BPromise=require(_0xc539('0x3'));var rs=require(_0xc539('0x4'));var fs=require('fs');var Redis=require(_0xc539('0x5'));var db=require(_0xc539('0x6'))['db'];var utils=require(_0xc539('0x7'));var logger=require(_0xc539('0x8'))(_0xc539('0x9'));var config=require(_0xc539('0xa'));var jayson=require(_0xc539('0xb'));var client=jayson[_0xc539('0xc')][_0xc539('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x590e87,_0x3fec5c,_0x1d640f){return new BPromise(function(_0x2642ab,_0x3ee3e5){return client[_0xc539('0xe')](_0x590e87,_0x1d640f)[_0xc539('0xf')](function(_0xc14335){logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x3fec5c,_0xc539('0x10'));logger[_0xc539('0x11')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x3fec5c,_0xc539('0x10'),JSON[_0xc539('0x12')](_0xc14335));if(_0xc14335[_0xc539('0x13')]){if(_0xc14335[_0xc539('0x13')]['code']===0x1f4){logger[_0xc539('0x13')](_0xc539('0x14'),_0x3fec5c,_0xc14335[_0xc539('0x13')][_0xc539('0x15')]);return _0x3ee3e5(_0xc14335['error']['message']);}logger[_0xc539('0x13')](_0xc539('0x14'),_0x3fec5c,_0xc14335['error']['message']);return _0x2642ab(_0xc14335[_0xc539('0x13')][_0xc539('0x15')]);}else{logger['info'](_0xc539('0x14'),_0x3fec5c,'request\x20sent');_0x2642ab(_0xc14335[_0xc539('0x16')][_0xc539('0x15')]);}})[_0xc539('0x17')](function(_0x4668de){logger[_0xc539('0x13')](_0xc539('0x14'),_0x3fec5c,_0x4668de);_0x3ee3e5(_0x4668de);});});}exports[_0xc539('0x18')]=function(_0x506519){var _0x49ad0a=this;return new Promise(function(_0x553f66,_0x53c0d5){return db[_0xc539('0x19')][_0xc539('0x1a')](_0x506519[_0xc539('0x1b')],{'raw':_0x506519['options']?_0x506519[_0xc539('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xc539('0xf')](function(_0x1767df){logger['info'](_0xc539('0x18'),_0x506519);logger[_0xc539('0x11')](_0xc539('0x18'),_0x506519,JSON['stringify'](_0x1767df));_0x553f66(_0x1767df);})[_0xc539('0x17')](function(_0x3098e5){logger[_0xc539('0x13')](_0xc539('0x18'),_0x3098e5['message'],_0x506519);_0x53c0d5(_0x49ad0a[_0xc539('0x13')](0x1f4,_0x3098e5['message']));});});}; \ No newline at end of file +var _0x0dd2=['VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','CreateVoiceTransferReport','body','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0dd2,0x98));var _0x20dd=function(_0x19a7d3,_0x487155){_0x19a7d3=_0x19a7d3-0x0;var _0x569a8e=_0x0dd2[_0x19a7d3];return _0x569a8e;};'use strict';var _=require(_0x20dd('0x0'));var util=require(_0x20dd('0x1'));var moment=require(_0x20dd('0x2'));var BPromise=require(_0x20dd('0x3'));var rs=require(_0x20dd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x20dd('0x5'))['db'];var utils=require(_0x20dd('0x6'));var logger=require(_0x20dd('0x7'))(_0x20dd('0x8'));var config=require(_0x20dd('0x9'));var jayson=require(_0x20dd('0xa'));var client=jayson[_0x20dd('0xb')][_0x20dd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x29f803,_0x1c1afa,_0x5676ec){return new BPromise(function(_0x388040,_0x330522){return client[_0x20dd('0xd')](_0x29f803,_0x5676ec)[_0x20dd('0xe')](function(_0x2cc01e){logger[_0x20dd('0xf')](_0x20dd('0x10'),_0x1c1afa,'request\x20sent');logger[_0x20dd('0x11')](_0x20dd('0x12'),_0x1c1afa,'request\x20sent',JSON[_0x20dd('0x13')](_0x2cc01e));if(_0x2cc01e[_0x20dd('0x14')]){if(_0x2cc01e[_0x20dd('0x14')][_0x20dd('0x15')]===0x1f4){logger['error'](_0x20dd('0x10'),_0x1c1afa,_0x2cc01e['error'][_0x20dd('0x16')]);return _0x330522(_0x2cc01e['error'][_0x20dd('0x16')]);}logger['error'](_0x20dd('0x10'),_0x1c1afa,_0x2cc01e[_0x20dd('0x14')][_0x20dd('0x16')]);return _0x388040(_0x2cc01e[_0x20dd('0x14')][_0x20dd('0x16')]);}else{logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x1c1afa,_0x20dd('0x17'));_0x388040(_0x2cc01e['result'][_0x20dd('0x16')]);}})[_0x20dd('0x18')](function(_0x54e80a){logger[_0x20dd('0x14')](_0x20dd('0x10'),_0x1c1afa,_0x54e80a);_0x330522(_0x54e80a);});});}exports[_0x20dd('0x19')]=function(_0x153be7){var _0xcf82c7=this;return new Promise(function(_0x71a3a2,_0x49e737){return db['VoiceTransferReport']['create'](_0x153be7[_0x20dd('0x1a')],{'raw':_0x153be7['options']?_0x153be7['options'][_0x20dd('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x5f06dd){logger[_0x20dd('0xf')](_0x20dd('0x19'),_0x153be7);logger['debug']('CreateVoiceTransferReport',_0x153be7,JSON[_0x20dd('0x13')](_0x5f06dd));_0x71a3a2(_0x5f06dd);})[_0x20dd('0x18')](function(_0x51f608){logger[_0x20dd('0x14')]('CreateVoiceTransferReport',_0x51f608[_0x20dd('0x16')],_0x153be7);_0x49e737(_0xcf82c7[_0x20dd('0x14')](0x1f4,_0x51f608['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index ea060b3..beefcb6 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 _0xedd9=['unhold','/calls','calls','/transfer','exports','Router','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','/answer','answer','/hold','/unhold'];(function(_0x4d07f8,_0x53da75){var _0x5ba332=function(_0x11a6a8){while(--_0x11a6a8){_0x4d07f8['push'](_0x4d07f8['shift']());}};_0x5ba332(++_0x53da75);}(_0xedd9,0xfc));var _0x9edd=function(_0x48ce3e,_0x44caad){_0x48ce3e=_0x48ce3e-0x0;var _0x3abf75=_0xedd9[_0x48ce3e];return _0x3abf75;};'use strict';var express=require('express');var router=express[_0x9edd('0x0')]();var auth=require(_0x9edd('0x1'));var controller=require(_0x9edd('0x2'));router[_0x9edd('0x3')](_0x9edd('0x4'),auth[_0x9edd('0x5')](),auth[_0x9edd('0x6')](),controller[_0x9edd('0x7')]);router['post'](_0x9edd('0x8'),auth[_0x9edd('0x5')](),auth[_0x9edd('0x6')](),controller[_0x9edd('0x9')]);router['post'](_0x9edd('0xa'),auth['isAuthenticated'](),auth[_0x9edd('0x6')](),controller[_0x9edd('0xb')]);router[_0x9edd('0x3')](_0x9edd('0xc'),auth['isAuthenticated'](),auth[_0x9edd('0x6')](),controller['hold']);router[_0x9edd('0x3')](_0x9edd('0xd'),auth['isAuthenticated'](),auth[_0x9edd('0x6')](),controller[_0x9edd('0xe')]);router['post'](_0x9edd('0xf'),auth[_0x9edd('0x5')](),auth[_0x9edd('0x6')](),controller[_0x9edd('0x10')]);router[_0x9edd('0x3')](_0x9edd('0x11'),auth[_0x9edd('0x5')](),auth[_0x9edd('0x6')](),controller['transfer']);module[_0x9edd('0x12')]=router; \ No newline at end of file +var _0xbec5=['exports','express','Router','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','/hangup','hangup','/answer','answer','/hold','/unhold','unhold','/calls','calls','/transfer','transfer'];(function(_0x2ca0a4,_0x15200d){var _0x2ef7e6=function(_0x50485d){while(--_0x50485d){_0x2ca0a4['push'](_0x2ca0a4['shift']());}};_0x2ef7e6(++_0x15200d);}(_0xbec5,0xe5));var _0x5bec=function(_0x55e1d1,_0x3c9376){_0x55e1d1=_0x55e1d1-0x0;var _0x1165db=_0xbec5[_0x55e1d1];return _0x1165db;};'use strict';var express=require(_0x5bec('0x0'));var router=express[_0x5bec('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x5bec('0x2'));router[_0x5bec('0x3')](_0x5bec('0x4'),auth[_0x5bec('0x5')](),auth[_0x5bec('0x6')](),controller['originate']);router[_0x5bec('0x3')](_0x5bec('0x7'),auth[_0x5bec('0x5')](),auth['isWebrtcLicence'](),controller[_0x5bec('0x8')]);router[_0x5bec('0x3')](_0x5bec('0x9'),auth[_0x5bec('0x5')](),auth[_0x5bec('0x6')](),controller[_0x5bec('0xa')]);router[_0x5bec('0x3')](_0x5bec('0xb'),auth['isAuthenticated'](),auth[_0x5bec('0x6')](),controller['hold']);router[_0x5bec('0x3')](_0x5bec('0xc'),auth[_0x5bec('0x5')](),auth['isWebrtcLicence'](),controller[_0x5bec('0xd')]);router[_0x5bec('0x3')](_0x5bec('0xe'),auth['isAuthenticated'](),auth[_0x5bec('0x6')](),controller[_0x5bec('0xf')]);router['post'](_0x5bec('0x10'),auth[_0x5bec('0x5')](),auth[_0x5bec('0x6')](),controller[_0x5bec('0x11')]);module[_0x5bec('0x12')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index d9abff3..fb51b4d 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 _0xd58c=['hangup\x20fired:','length','webbar:hangup','answer','entityFound:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','VoiceChannels','all','filter','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','util','jayson/promise','http','../../config/logger','webbarapi','ioredis','redis','localhost','socket.io-emitter','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','handleError:','error','stack','name','status','send','request','code','message','findOne','then','rows','UserId','sessionId','sessionId\x20','originate','originate\x20fired:','body','json','userId','callerId','callbackUrl','format','user:%s','webbar:originate','originate\x20executed!','catch','hangup'];(function(_0x2c4e1b,_0x48a2dc){var _0x335117=function(_0x3cac61){while(--_0x3cac61){_0x2c4e1b['push'](_0x2c4e1b['shift']());}};_0x335117(++_0x48a2dc);}(_0xd58c,0xb6));var _0xcd58=function(_0x29ac62,_0x1b1f5d){_0x29ac62=_0x29ac62-0x0;var _0x20fb76=_0xd58c[_0x29ac62];return _0x20fb76;};'use strict';var path=require(_0xcd58('0x0'));var fs=require('fs');var _=require(_0xcd58('0x1'));var db=require(_0xcd58('0x2'))['db'];var config=require('../../config/environment');var util=require(_0xcd58('0x3'));var BPromise=require('bluebird');var jayson=require(_0xcd58('0x4'));var amiClient=jayson['client'][_0xcd58('0x5')]({'port':0x232a});var logger=require(_0xcd58('0x6'))(_0xcd58('0x7'));var Redis=require(_0xcd58('0x8'));config[_0xcd58('0x9')]=_['defaults'](config['redis'],{'host':_0xcd58('0xa'),'port':0x18eb});var io=require(_0xcd58('0xb'))(new Redis(config[_0xcd58('0x9')]));var Schema=require(_0xcd58('0xc'));var originateValidation=new Schema({'userId':{'type':_0xcd58('0xd'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0xcd58('0xe'),'required':[!![],_0xcd58('0xf')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0xcd58('0xe')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xcd58('0x10')]},'sessionId':{'type':_0xcd58('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xcd58('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xcd58('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0xcd58('0x10')]},'sessionId':{'type':'string','required':[!![],_0xcd58('0x11')]},'transferNumber':{'type':_0xcd58('0xe'),'required':[!![],_0xcd58('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0xcd58('0xd'),'required':[!![],_0xcd58('0x10')]},'sessionId':{'type':_0xcd58('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xcd58('0xd'),'required':[!![],_0xcd58('0x10')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xcd58('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':_0xcd58('0xd'),'required':[!![],_0xcd58('0x10')]}});function emit(_0x51f5b6,_0x515fc3,_0xea2532){logger[_0xcd58('0x13')](_0x51f5b6,_0x515fc3,JSON[_0xcd58('0x14')](_0xea2532));io['to'](_0x51f5b6)['emit'](_0x515fc3,_0xea2532);}function handleError(_0x4e9b76){return function(_0x3686ad){console['log'](_0xcd58('0x15'),_0x3686ad,_0x3686ad instanceof RangeError);logger[_0xcd58('0x16')](_0x3686ad[_0xcd58('0x17')]);if(_0x3686ad instanceof RangeError){if(_0x3686ad[_0xcd58('0x18')]){delete _0x3686ad['name'];}_0x4e9b76[_0xcd58('0x19')](0x194)['send'](_0x3686ad);}else{if(_0x3686ad['name']){delete _0x3686ad['name'];}_0x4e9b76[_0xcd58('0x19')](0x1f4)[_0xcd58('0x1a')](_0x3686ad);}};}function checkError(){return function(_0x44b002){if(!_0x44b002){throw new RangeError('NotFound');}return _0x44b002;};}function respondWithRpcPromise(_0xb7325f,_0x2a8681){return new BPromise(function(_0x5c241c,_0x18f953){var _0x1765d3=amiClient;return _0x1765d3[_0xcd58('0x1b')](_0xb7325f,_0x2a8681)['then'](function(_0x566d56){if(_0x566d56[_0xcd58('0x16')]){if(_0x566d56[_0xcd58('0x16')][_0xcd58('0x1c')]===0x1f4){return _0x18f953(_0x566d56[_0xcd58('0x16')][_0xcd58('0x1d')]);}return _0x5c241c(_0x566d56[_0xcd58('0x16')][_0xcd58('0x1d')]);}else{_0x5c241c(_0x566d56['result']);}})['catch'](function(_0x19010d){_0x18f953(_0x19010d);});});}function getAgent(_0xaa4a53){return db['User'][_0xcd58('0x1e')]({'where':{'id':_0xaa4a53,'role':'agent'}})[_0xcd58('0x1f')](checkError());}function getAgentCheckSession(_0x2ec6b1,_0x75bb8e){return new BPromise(function(_0x1784ff,_0x2b64b8){var _0x30cf55=respondWithRpcPromise('VoiceChannels');var _0x1c369f=getAgent(_0x2ec6b1);Promise['all']([_0x30cf55,_0x1c369f])[_0xcd58('0x1f')](function(_0x5e1b62){var _0x34d063=_0x5e1b62[0x0];var _0x55c551=_0x5e1b62[0x1];var _0x3499c4=_['filter'](_0x34d063[_0xcd58('0x20')],function(_0x5871da){return _0x5871da[_0xcd58('0x21')]==_0x55c551['id']&&_0x5871da[_0xcd58('0x22')]==_0x75bb8e;});if(_0x3499c4['length']==0x1){_0x1784ff(_0x55c551);}else{_0x2b64b8(new RangeError(_0xcd58('0x23')+_0x75bb8e+'\x20not\x20found!'));}});});}exports[_0xcd58('0x24')]=function(_0x3852c8,_0x2a7ce1){logger[_0xcd58('0x13')](_0xcd58('0x25'),_0x3852c8[_0xcd58('0x26')]);var _0x5b5d90=originateValidation['validate'](_0x3852c8[_0xcd58('0x26')]);if(_0x5b5d90['length']>0x0){return _0x2a7ce1['status'](0x190)[_0xcd58('0x27')](_0x5b5d90);}var _0x3ef48e=_0x3852c8[_0xcd58('0x26')][_0xcd58('0x28')];var _0xd5fc97=_0x3852c8[_0xcd58('0x26')]['callNumber'];var _0x535ad4=_0x3852c8[_0xcd58('0x26')][_0xcd58('0x29')];var _0x1c1ce4=_0x3852c8['body'][_0xcd58('0x2a')];return getAgent(_0x3ef48e)[_0xcd58('0x1f')](function(_0x6a7872){logger['info']('entityFound:',_0x6a7872[_0xcd58('0x18')]);emit(util[_0xcd58('0x2b')](_0xcd58('0x2c'),_0x6a7872[_0xcd58('0x18')]),_0xcd58('0x2d'),{'callNumber':_0xd5fc97,'callerId':_0x535ad4,'callbackUrl':_0x1c1ce4});return _0x2a7ce1[_0xcd58('0x19')](0xc8)[_0xcd58('0x27')]({'error':![],'message':_0xcd58('0x2e')});})[_0xcd58('0x2f')](handleError(_0x2a7ce1));};exports[_0xcd58('0x30')]=function(_0x455ce1,_0x37e840){logger[_0xcd58('0x13')](_0xcd58('0x31'),_0x455ce1[_0xcd58('0x26')]);var _0x1139c2=hangupValidation[_0xcd58('0xc')](_0x455ce1[_0xcd58('0x26')]);if(_0x1139c2[_0xcd58('0x32')]>0x0){return _0x37e840[_0xcd58('0x19')](0x190)[_0xcd58('0x27')](_0x1139c2);}var _0x5cd1eb=_0x455ce1[_0xcd58('0x26')][_0xcd58('0x28')];var _0x464158=_0x455ce1['body'][_0xcd58('0x22')];return getAgent(_0x5cd1eb)[_0xcd58('0x1f')](function(_0x4ced85){logger[_0xcd58('0x13')]('entityFound:',_0x4ced85['name']);emit(util[_0xcd58('0x2b')]('user:%s',_0x4ced85['name']),_0xcd58('0x33'),{'sessionId':_0x464158});return _0x37e840[_0xcd58('0x19')](0xc8)[_0xcd58('0x27')]({'error':![],'message':'hangup\x20executed!'});})['catch'](handleError(_0x37e840));};exports[_0xcd58('0x34')]=function(_0x55fdf9,_0x3ab135){logger[_0xcd58('0x13')]('answer\x20fired:',_0x55fdf9['body']);var _0x1f5e98=answerValidation[_0xcd58('0xc')](_0x55fdf9[_0xcd58('0x26')]);if(_0x1f5e98[_0xcd58('0x32')]>0x0){return _0x3ab135[_0xcd58('0x19')](0x190)[_0xcd58('0x27')](_0x1f5e98);}var _0x14a574=_0x55fdf9[_0xcd58('0x26')][_0xcd58('0x28')];var _0x297478=_0x55fdf9[_0xcd58('0x26')][_0xcd58('0x22')];return getAgent(_0x14a574)[_0xcd58('0x1f')](function(_0x503ee3){logger[_0xcd58('0x13')](_0xcd58('0x35'),_0x503ee3[_0xcd58('0x18')]);emit(util['format'](_0xcd58('0x2c'),_0x503ee3[_0xcd58('0x18')]),_0xcd58('0x36'),{'sessionId':_0x297478});return _0x3ab135[_0xcd58('0x19')](0xc8)['json']({'error':![],'message':_0xcd58('0x37')});})[_0xcd58('0x2f')](handleError(_0x3ab135));};exports[_0xcd58('0x38')]=function(_0x13e0cb,_0x3aa129){logger[_0xcd58('0x13')](_0xcd58('0x39'),_0x13e0cb[_0xcd58('0x26')]);var _0x452e7e=holdValidation[_0xcd58('0xc')](_0x13e0cb['body']);if(_0x452e7e[_0xcd58('0x32')]>0x0){return _0x3aa129[_0xcd58('0x19')](0x190)[_0xcd58('0x27')](_0x452e7e);}var _0x1ead66=_0x13e0cb[_0xcd58('0x26')][_0xcd58('0x28')];var _0x11aa04=_0x13e0cb[_0xcd58('0x26')][_0xcd58('0x22')];return getAgent(_0x1ead66)[_0xcd58('0x1f')](function(_0x1416fa){logger[_0xcd58('0x13')]('entityFound:',_0x1416fa[_0xcd58('0x18')]);emit(util[_0xcd58('0x2b')]('user:%s',_0x1416fa[_0xcd58('0x18')]),_0xcd58('0x3a'),{'sessionId':_0x11aa04});return _0x3aa129[_0xcd58('0x19')](0xc8)[_0xcd58('0x27')]({'error':![],'message':_0xcd58('0x3b')});})[_0xcd58('0x2f')](handleError(_0x3aa129));};exports['unhold']=function(_0x51735b,_0x8a5d52){logger['info'](_0xcd58('0x3c'),_0x51735b[_0xcd58('0x26')]);var _0x3eb747=unholdValidation[_0xcd58('0xc')](_0x51735b['body']);if(_0x3eb747['length']>0x0){return _0x8a5d52[_0xcd58('0x19')](0x190)['json'](_0x3eb747);}var _0x4972b7=_0x51735b[_0xcd58('0x26')][_0xcd58('0x28')];var _0x361422=_0x51735b[_0xcd58('0x26')]['sessionId'];return getAgent(_0x4972b7)[_0xcd58('0x1f')](function(_0x5530f3){logger['info'](_0xcd58('0x35'),_0x5530f3[_0xcd58('0x18')]);emit(util['format'](_0xcd58('0x2c'),_0x5530f3['name']),_0xcd58('0x3d'),{'sessionId':_0x361422});return _0x8a5d52[_0xcd58('0x19')](0xc8)[_0xcd58('0x27')]({'error':![],'message':_0xcd58('0x3e')});})[_0xcd58('0x2f')](handleError(_0x8a5d52));};exports[_0xcd58('0x3f')]=function(_0x2e4157,_0xe1a29a){logger[_0xcd58('0x13')](_0xcd58('0x40'),_0xe1a29a[_0xcd58('0x26')]);var _0x2220af=callsValidation['validate'](_0x2e4157[_0xcd58('0x26')]);if(_0x2220af['length']>0x0){return _0xe1a29a[_0xcd58('0x19')](0x190)[_0xcd58('0x27')](_0x2220af);}var _0x13df99=_0x2e4157[_0xcd58('0x26')]['userId'];var _0x3d2fe7=respondWithRpcPromise(_0xcd58('0x41'));var _0x458157=getAgent(_0x13df99);return Promise[_0xcd58('0x42')]([_0x3d2fe7,_0x458157])['then'](function(_0x5ab979){var _0x2bd97b=_0x5ab979[0x0];var _0x386388=_0x5ab979[0x1];var _0x418fb5=_[_0xcd58('0x43')](_0x2bd97b[_0xcd58('0x20')],function(_0x10cf46){return _0x10cf46[_0xcd58('0x21')]==_0x386388['id'];});return _0xe1a29a['status'](0xc8)[_0xcd58('0x27')]({'count':_0x418fb5[_0xcd58('0x32')],'rows':_0x418fb5});})[_0xcd58('0x2f')](handleError(_0xe1a29a));};exports[_0xcd58('0x44')]=function(_0x3a4699,_0x29f03b){logger[_0xcd58('0x13')](_0xcd58('0x45'),_0x3a4699[_0xcd58('0x26')]);var _0x2d16d0=conferenceValidation[_0xcd58('0xc')](_0x3a4699[_0xcd58('0x26')]);if(_0x2d16d0[_0xcd58('0x32')]>0x0){return _0x29f03b[_0xcd58('0x19')](0x190)[_0xcd58('0x27')](_0x2d16d0);}var _0x322466=_0x3a4699[_0xcd58('0x26')]['userId'];return getAgent(_0x322466)[_0xcd58('0x1f')](function(_0x183762){logger[_0xcd58('0x13')](_0xcd58('0x35'),_0x183762['name']);emit(util[_0xcd58('0x2b')](_0xcd58('0x2c'),_0x183762[_0xcd58('0x18')]),_0xcd58('0x46'));return _0x29f03b[_0xcd58('0x19')](0xc8)['json']({'error':![],'message':_0xcd58('0x47')});})[_0xcd58('0x2f')](handleError(_0x29f03b));};exports[_0xcd58('0x48')]=function(_0x1cc739,_0x3a13ab){logger[_0xcd58('0x13')](_0xcd58('0x49'),_0x1cc739[_0xcd58('0x26')]);var _0x2729dd=transferValidation[_0xcd58('0xc')](_0x1cc739['body']);if(_0x2729dd['length']>0x0){return _0x3a13ab[_0xcd58('0x19')](0x190)[_0xcd58('0x27')](_0x2729dd);}var _0x5913b2=_0x1cc739['body'][_0xcd58('0x28')];var _0x19887d=_0x1cc739['body'][_0xcd58('0x22')];var _0x29d4a4=_0x1cc739[_0xcd58('0x26')][_0xcd58('0x4a')];return getAgent(_0x5913b2)[_0xcd58('0x1f')](function(_0x3c3f38){logger[_0xcd58('0x13')](_0xcd58('0x35'),_0x3c3f38['name']);emit(util['format'](_0xcd58('0x2c'),_0x3c3f38['name']),_0xcd58('0x4b'),{'sessionId':_0x19887d,'transferNumber':_0x29d4a4});return _0x3a13ab['status'](0xc8)[_0xcd58('0x27')]({'error':![],'message':_0xcd58('0x4c')});})[_0xcd58('0x2f')](handleError(_0x3a13ab));}; \ No newline at end of file +var _0x39cb=['transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','stack','name','status','send','NotFound','then','error','code','message','result','catch','User','agent','VoiceChannels','all','rows','UserId','sessionId','length','\x20not\x20found!','originate\x20fired:','body','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','hangup','hangup\x20fired:','validate','json','webbar:hangup','hangup\x20executed!','answer\x20fired:','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls\x20fired:','filter','conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','lodash','../../mysqldb','util','bluebird','client','http','../../config/logger','webbarapi','ioredis','defaults','redis','localhost','socket.io-emitter','number','userId\x20is\x20required','string','callNumber\x20is\x20required'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x39cb,0x1bd));var _0xb39c=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x39cb[_0x3ab51d];return _0x29a04e;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0xb39c('0x0'));var db=require(_0xb39c('0x1'))['db'];var config=require('../../config/environment');var util=require(_0xb39c('0x2'));var BPromise=require(_0xb39c('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0xb39c('0x4')][_0xb39c('0x5')]({'port':0x232a});var logger=require(_0xb39c('0x6'))(_0xb39c('0x7'));var Redis=require(_0xb39c('0x8'));config['redis']=_[_0xb39c('0x9')](config[_0xb39c('0xa')],{'host':_0xb39c('0xb'),'port':0x18eb});var io=require(_0xb39c('0xc'))(new Redis(config['redis']));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0xb39c('0xd'),'required':[!![],_0xb39c('0xe')]},'callNumber':{'type':_0xb39c('0xf'),'required':[!![],_0xb39c('0x10')]},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xb39c('0xe')]},'sessionId':{'type':_0xb39c('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xb39c('0xd'),'required':[!![],_0xb39c('0xe')]},'sessionId':{'type':_0xb39c('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xb39c('0xd'),'required':[!![],_0xb39c('0xe')]},'sessionId':{'type':_0xb39c('0xf'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xb39c('0xf'),'required':[!![],_0xb39c('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0xb39c('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xb39c('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xb39c('0xd'),'required':[!![],_0xb39c('0xe')]},'sessionId':{'type':_0xb39c('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xb39c('0xd'),'required':[!![],_0xb39c('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0xb39c('0xd'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x316c9b,_0x3223f6,_0x10989d){logger[_0xb39c('0x12')](_0x316c9b,_0x3223f6,JSON[_0xb39c('0x13')](_0x10989d));io['to'](_0x316c9b)[_0xb39c('0x14')](_0x3223f6,_0x10989d);}function handleError(_0x1a2f48){return function(_0x4e02cf){console[_0xb39c('0x15')](_0xb39c('0x16'),_0x4e02cf,_0x4e02cf instanceof RangeError);logger['error'](_0x4e02cf[_0xb39c('0x17')]);if(_0x4e02cf instanceof RangeError){if(_0x4e02cf[_0xb39c('0x18')]){delete _0x4e02cf[_0xb39c('0x18')];}_0x1a2f48[_0xb39c('0x19')](0x194)['send'](_0x4e02cf);}else{if(_0x4e02cf[_0xb39c('0x18')]){delete _0x4e02cf[_0xb39c('0x18')];}_0x1a2f48['status'](0x1f4)[_0xb39c('0x1a')](_0x4e02cf);}};}function checkError(){return function(_0x363e52){if(!_0x363e52){throw new RangeError(_0xb39c('0x1b'));}return _0x363e52;};}function respondWithRpcPromise(_0x4ebfca,_0x539d27){return new BPromise(function(_0x2789fd,_0x1a5b9d){var _0x3c8dfd=amiClient;return _0x3c8dfd['request'](_0x4ebfca,_0x539d27)[_0xb39c('0x1c')](function(_0x438207){if(_0x438207[_0xb39c('0x1d')]){if(_0x438207[_0xb39c('0x1d')][_0xb39c('0x1e')]===0x1f4){return _0x1a5b9d(_0x438207['error'][_0xb39c('0x1f')]);}return _0x2789fd(_0x438207[_0xb39c('0x1d')]['message']);}else{_0x2789fd(_0x438207[_0xb39c('0x20')]);}})[_0xb39c('0x21')](function(_0x39116b){_0x1a5b9d(_0x39116b);});});}function getAgent(_0x12be70){return db[_0xb39c('0x22')]['findOne']({'where':{'id':_0x12be70,'role':_0xb39c('0x23')}})[_0xb39c('0x1c')](checkError());}function getAgentCheckSession(_0x132769,_0x4c06fa){return new BPromise(function(_0x41fff2,_0x337532){var _0x52eb5e=respondWithRpcPromise(_0xb39c('0x24'));var _0x4b4458=getAgent(_0x132769);Promise[_0xb39c('0x25')]([_0x52eb5e,_0x4b4458])['then'](function(_0x714d20){var _0x45fed4=_0x714d20[0x0];var _0x59172f=_0x714d20[0x1];var _0x2bc742=_['filter'](_0x45fed4[_0xb39c('0x26')],function(_0x2d2743){return _0x2d2743[_0xb39c('0x27')]==_0x59172f['id']&&_0x2d2743[_0xb39c('0x28')]==_0x4c06fa;});if(_0x2bc742[_0xb39c('0x29')]==0x1){_0x41fff2(_0x59172f);}else{_0x337532(new RangeError('sessionId\x20'+_0x4c06fa+_0xb39c('0x2a')));}});});}exports['originate']=function(_0x351d60,_0x48a888){logger[_0xb39c('0x12')](_0xb39c('0x2b'),_0x351d60[_0xb39c('0x2c')]);var _0x11ad56=originateValidation['validate'](_0x351d60['body']);if(_0x11ad56[_0xb39c('0x29')]>0x0){return _0x48a888[_0xb39c('0x19')](0x190)['json'](_0x11ad56);}var _0x1d7f2a=_0x351d60[_0xb39c('0x2c')][_0xb39c('0x2d')];var _0x1b15e7=_0x351d60[_0xb39c('0x2c')][_0xb39c('0x2e')];var _0x41cdd1=_0x351d60[_0xb39c('0x2c')][_0xb39c('0x2f')];var _0x24e9e8=_0x351d60[_0xb39c('0x2c')][_0xb39c('0x30')];return getAgent(_0x1d7f2a)[_0xb39c('0x1c')](function(_0x2f6b5a){logger[_0xb39c('0x12')](_0xb39c('0x31'),_0x2f6b5a[_0xb39c('0x18')]);emit(util[_0xb39c('0x32')](_0xb39c('0x33'),_0x2f6b5a['name']),_0xb39c('0x34'),{'callNumber':_0x1b15e7,'callerId':_0x41cdd1,'callbackUrl':_0x24e9e8});return _0x48a888[_0xb39c('0x19')](0xc8)['json']({'error':![],'message':'originate\x20executed!'});})['catch'](handleError(_0x48a888));};exports[_0xb39c('0x35')]=function(_0x33e468,_0xe6bc2e){logger['info'](_0xb39c('0x36'),_0x33e468[_0xb39c('0x2c')]);var _0x44afba=hangupValidation[_0xb39c('0x37')](_0x33e468[_0xb39c('0x2c')]);if(_0x44afba['length']>0x0){return _0xe6bc2e[_0xb39c('0x19')](0x190)[_0xb39c('0x38')](_0x44afba);}var _0x51b489=_0x33e468[_0xb39c('0x2c')]['userId'];var _0x1ee418=_0x33e468[_0xb39c('0x2c')][_0xb39c('0x28')];return getAgent(_0x51b489)['then'](function(_0x406fc6){logger[_0xb39c('0x12')](_0xb39c('0x31'),_0x406fc6[_0xb39c('0x18')]);emit(util[_0xb39c('0x32')](_0xb39c('0x33'),_0x406fc6[_0xb39c('0x18')]),_0xb39c('0x39'),{'sessionId':_0x1ee418});return _0xe6bc2e[_0xb39c('0x19')](0xc8)[_0xb39c('0x38')]({'error':![],'message':_0xb39c('0x3a')});})[_0xb39c('0x21')](handleError(_0xe6bc2e));};exports['answer']=function(_0x38e8ba,_0xbeb7b3){logger[_0xb39c('0x12')](_0xb39c('0x3b'),_0x38e8ba[_0xb39c('0x2c')]);var _0x390cd7=answerValidation[_0xb39c('0x37')](_0x38e8ba[_0xb39c('0x2c')]);if(_0x390cd7[_0xb39c('0x29')]>0x0){return _0xbeb7b3['status'](0x190)['json'](_0x390cd7);}var _0x2f88c9=_0x38e8ba[_0xb39c('0x2c')]['userId'];var _0x4bc2be=_0x38e8ba[_0xb39c('0x2c')]['sessionId'];return getAgent(_0x2f88c9)[_0xb39c('0x1c')](function(_0x3e0071){logger[_0xb39c('0x12')](_0xb39c('0x31'),_0x3e0071[_0xb39c('0x18')]);emit(util['format'](_0xb39c('0x33'),_0x3e0071[_0xb39c('0x18')]),'webbar:answer',{'sessionId':_0x4bc2be});return _0xbeb7b3['status'](0xc8)[_0xb39c('0x38')]({'error':![],'message':'answer\x20executed!'});})['catch'](handleError(_0xbeb7b3));};exports[_0xb39c('0x3c')]=function(_0x2ff5ac,_0x4497a7){logger[_0xb39c('0x12')](_0xb39c('0x3d'),_0x2ff5ac[_0xb39c('0x2c')]);var _0x25ca4e=holdValidation[_0xb39c('0x37')](_0x2ff5ac[_0xb39c('0x2c')]);if(_0x25ca4e[_0xb39c('0x29')]>0x0){return _0x4497a7['status'](0x190)[_0xb39c('0x38')](_0x25ca4e);}var _0x7e9750=_0x2ff5ac[_0xb39c('0x2c')][_0xb39c('0x2d')];var _0x40e1dc=_0x2ff5ac[_0xb39c('0x2c')][_0xb39c('0x28')];return getAgent(_0x7e9750)[_0xb39c('0x1c')](function(_0x38bc36){logger[_0xb39c('0x12')](_0xb39c('0x31'),_0x38bc36[_0xb39c('0x18')]);emit(util[_0xb39c('0x32')](_0xb39c('0x33'),_0x38bc36[_0xb39c('0x18')]),_0xb39c('0x3e'),{'sessionId':_0x40e1dc});return _0x4497a7['status'](0xc8)[_0xb39c('0x38')]({'error':![],'message':_0xb39c('0x3f')});})[_0xb39c('0x21')](handleError(_0x4497a7));};exports[_0xb39c('0x40')]=function(_0xa50077,_0x18db8f){logger[_0xb39c('0x12')](_0xb39c('0x41'),_0xa50077['body']);var _0x4886ab=unholdValidation[_0xb39c('0x37')](_0xa50077[_0xb39c('0x2c')]);if(_0x4886ab['length']>0x0){return _0x18db8f['status'](0x190)[_0xb39c('0x38')](_0x4886ab);}var _0x1d1abf=_0xa50077['body'][_0xb39c('0x2d')];var _0x55b6b1=_0xa50077['body'][_0xb39c('0x28')];return getAgent(_0x1d1abf)['then'](function(_0x2c5434){logger[_0xb39c('0x12')](_0xb39c('0x31'),_0x2c5434[_0xb39c('0x18')]);emit(util[_0xb39c('0x32')](_0xb39c('0x33'),_0x2c5434['name']),_0xb39c('0x42'),{'sessionId':_0x55b6b1});return _0x18db8f[_0xb39c('0x19')](0xc8)[_0xb39c('0x38')]({'error':![],'message':_0xb39c('0x43')});})[_0xb39c('0x21')](handleError(_0x18db8f));};exports['calls']=function(_0x285313,_0x4ab58e){logger[_0xb39c('0x12')](_0xb39c('0x44'),_0x4ab58e[_0xb39c('0x2c')]);var _0x9e4e89=callsValidation[_0xb39c('0x37')](_0x285313[_0xb39c('0x2c')]);if(_0x9e4e89[_0xb39c('0x29')]>0x0){return _0x4ab58e[_0xb39c('0x19')](0x190)[_0xb39c('0x38')](_0x9e4e89);}var _0x3c17d1=_0x285313[_0xb39c('0x2c')][_0xb39c('0x2d')];var _0x2620ee=respondWithRpcPromise(_0xb39c('0x24'));var _0xe31742=getAgent(_0x3c17d1);return Promise[_0xb39c('0x25')]([_0x2620ee,_0xe31742])[_0xb39c('0x1c')](function(_0x3a617e){var _0x18431c=_0x3a617e[0x0];var _0x49f118=_0x3a617e[0x1];var _0x57f2f4=_[_0xb39c('0x45')](_0x18431c[_0xb39c('0x26')],function(_0x52daf6){return _0x52daf6[_0xb39c('0x27')]==_0x49f118['id'];});return _0x4ab58e[_0xb39c('0x19')](0xc8)['json']({'count':_0x57f2f4[_0xb39c('0x29')],'rows':_0x57f2f4});})[_0xb39c('0x21')](handleError(_0x4ab58e));};exports[_0xb39c('0x46')]=function(_0x19647a,_0x453a21){logger[_0xb39c('0x12')]('conference\x20fired:',_0x19647a[_0xb39c('0x2c')]);var _0x384f4f=conferenceValidation[_0xb39c('0x37')](_0x19647a[_0xb39c('0x2c')]);if(_0x384f4f[_0xb39c('0x29')]>0x0){return _0x453a21[_0xb39c('0x19')](0x190)[_0xb39c('0x38')](_0x384f4f);}var _0x47dcda=_0x19647a[_0xb39c('0x2c')][_0xb39c('0x2d')];return getAgent(_0x47dcda)[_0xb39c('0x1c')](function(_0x17b0c4){logger[_0xb39c('0x12')]('entityFound:',_0x17b0c4['name']);emit(util[_0xb39c('0x32')](_0xb39c('0x33'),_0x17b0c4[_0xb39c('0x18')]),'webbar:conference');return _0x453a21[_0xb39c('0x19')](0xc8)['json']({'error':![],'message':_0xb39c('0x47')});})['catch'](handleError(_0x453a21));};exports[_0xb39c('0x48')]=function(_0x82b625,_0x6aa1ee){logger['info'](_0xb39c('0x49'),_0x82b625[_0xb39c('0x2c')]);var _0x14b448=transferValidation[_0xb39c('0x37')](_0x82b625[_0xb39c('0x2c')]);if(_0x14b448[_0xb39c('0x29')]>0x0){return _0x6aa1ee[_0xb39c('0x19')](0x190)[_0xb39c('0x38')](_0x14b448);}var _0x14dce7=_0x82b625[_0xb39c('0x2c')][_0xb39c('0x2d')];var _0x227152=_0x82b625[_0xb39c('0x2c')][_0xb39c('0x28')];var _0x1b2138=_0x82b625[_0xb39c('0x2c')][_0xb39c('0x4a')];return getAgent(_0x14dce7)['then'](function(_0x2d936f){logger[_0xb39c('0x12')](_0xb39c('0x31'),_0x2d936f['name']);emit(util[_0xb39c('0x32')]('user:%s',_0x2d936f['name']),_0xb39c('0x4b'),{'sessionId':_0x227152,'transferNumber':_0x1b2138});return _0x6aa1ee[_0xb39c('0x19')](0xc8)[_0xb39c('0x38')]({'error':![],'message':_0xb39c('0x4c')});})[_0xb39c('0x21')](handleError(_0x6aa1ee));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 96a141b..dfe1a4e 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 _0x90bd=['describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/users','getAgents','getApplications','post','create','addDisposition','/:id/canned_answers','addAgents','/:id/applications','addApplications','/:id/notify','notify','/:id/send','send','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','isAuthenticated','index','get'];(function(_0x3f0a47,_0x169185){var _0x599454=function(_0x1e5e7d){while(--_0x1e5e7d){_0x3f0a47['push'](_0x3f0a47['shift']());}};_0x599454(++_0x169185);}(_0x90bd,0x8d));var _0xd90b=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0x90bd[_0x26f702];return _0x11417d;};'use strict';var multer=require('multer');var util=require(_0xd90b('0x0'));var path=require('path');var timeout=require(_0xd90b('0x1'));var express=require(_0xd90b('0x2'));var router=express[_0xd90b('0x3')]();var fs_extra=require(_0xd90b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd90b('0x5'));var config=require(_0xd90b('0x6'));var controller=require(_0xd90b('0x7'));router['get']('/',auth[_0xd90b('0x8')](),controller[_0xd90b('0x9')]);router[_0xd90b('0xa')]('/describe',auth[_0xd90b('0x8')](),controller[_0xd90b('0xb')]);router[_0xd90b('0xa')](_0xd90b('0xc'),auth[_0xd90b('0x8')](),controller[_0xd90b('0xd')]);router['get'](_0xd90b('0xe'),auth[_0xd90b('0x8')](),controller[_0xd90b('0xf')]);router[_0xd90b('0xa')]('/:id/canned_answers',auth[_0xd90b('0x8')](),controller[_0xd90b('0x10')]);router['get'](_0xd90b('0x11'),auth['isAuthenticated'](),controller[_0xd90b('0x12')]);router[_0xd90b('0xa')]('/:id/applications',auth['isAuthenticated'](),controller[_0xd90b('0x13')]);router[_0xd90b('0x14')]('/',auth[_0xd90b('0x8')](),controller[_0xd90b('0x15')]);router[_0xd90b('0x14')](_0xd90b('0xe'),auth[_0xd90b('0x8')](),controller[_0xd90b('0x16')]);router[_0xd90b('0x14')](_0xd90b('0x17'),auth[_0xd90b('0x8')](),controller['addAnswer']);router['post'](_0xd90b('0x11'),auth[_0xd90b('0x8')](),controller[_0xd90b('0x18')]);router['post'](_0xd90b('0x19'),auth[_0xd90b('0x8')](),controller[_0xd90b('0x1a')]);router[_0xd90b('0x14')](_0xd90b('0x1b'),controller[_0xd90b('0x1c')]);router[_0xd90b('0x14')](_0xd90b('0x1d'),auth[_0xd90b('0x8')](),controller[_0xd90b('0x1e')]);router[_0xd90b('0x1f')]('/:id',auth[_0xd90b('0x8')](),controller['update']);router[_0xd90b('0x20')]('/:id',auth[_0xd90b('0x8')](),controller[_0xd90b('0x21')]);router[_0xd90b('0x20')]('/:id/dispositions',auth[_0xd90b('0x8')](),controller[_0xd90b('0x22')]);router[_0xd90b('0x20')]('/:id/canned_answers',auth[_0xd90b('0x8')](),controller[_0xd90b('0x23')]);router['delete'](_0xd90b('0x11'),auth['isAuthenticated'](),controller[_0xd90b('0x24')]);module[_0xd90b('0x25')]=router; \ No newline at end of file +var _0x0a80=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','/:id/dispositions','addDisposition','addAnswer','/:id/notify','notify','/:id/send','send','put','delete','removeAnswers','removeAgents','exports','util','connect-timeout'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x0a80,0x8e));var _0x00a8=function(_0x102470,_0x199a01){_0x102470=_0x102470-0x0;var _0x558eaa=_0x0a80[_0x102470];return _0x558eaa;};'use strict';var multer=require('multer');var util=require(_0x00a8('0x0'));var path=require('path');var timeout=require(_0x00a8('0x1'));var express=require(_0x00a8('0x2'));var router=express[_0x00a8('0x3')]();var fs_extra=require(_0x00a8('0x4'));var auth=require(_0x00a8('0x5'));var interaction=require(_0x00a8('0x6'));var config=require(_0x00a8('0x7'));var controller=require(_0x00a8('0x8'));router[_0x00a8('0x9')]('/',auth[_0x00a8('0xa')](),controller[_0x00a8('0xb')]);router['get'](_0x00a8('0xc'),auth[_0x00a8('0xa')](),controller['describe']);router[_0x00a8('0x9')](_0x00a8('0xd'),auth[_0x00a8('0xa')](),controller[_0x00a8('0xe')]);router[_0x00a8('0x9')]('/:id/dispositions',auth[_0x00a8('0xa')](),controller[_0x00a8('0xf')]);router['get'](_0x00a8('0x10'),auth[_0x00a8('0xa')](),controller[_0x00a8('0x11')]);router[_0x00a8('0x9')](_0x00a8('0x12'),auth[_0x00a8('0xa')](),controller[_0x00a8('0x13')]);router[_0x00a8('0x9')](_0x00a8('0x14'),auth[_0x00a8('0xa')](),controller[_0x00a8('0x15')]);router[_0x00a8('0x16')]('/',auth['isAuthenticated'](),controller[_0x00a8('0x17')]);router[_0x00a8('0x16')](_0x00a8('0x18'),auth[_0x00a8('0xa')](),controller[_0x00a8('0x19')]);router[_0x00a8('0x16')](_0x00a8('0x10'),auth['isAuthenticated'](),controller[_0x00a8('0x1a')]);router[_0x00a8('0x16')](_0x00a8('0x12'),auth[_0x00a8('0xa')](),controller['addAgents']);router['post'](_0x00a8('0x14'),auth[_0x00a8('0xa')](),controller['addApplications']);router[_0x00a8('0x16')](_0x00a8('0x1b'),controller[_0x00a8('0x1c')]);router['post'](_0x00a8('0x1d'),auth[_0x00a8('0xa')](),controller[_0x00a8('0x1e')]);router[_0x00a8('0x1f')]('/:id',auth[_0x00a8('0xa')](),controller['update']);router['delete'](_0x00a8('0xd'),auth[_0x00a8('0xa')](),controller['destroy']);router[_0x00a8('0x20')]('/:id/dispositions',auth[_0x00a8('0xa')](),controller['removeDispositions']);router[_0x00a8('0x20')](_0x00a8('0x10'),auth[_0x00a8('0xa')](),controller[_0x00a8('0x21')]);router[_0x00a8('0x20')](_0x00a8('0x12'),auth[_0x00a8('0xa')](),controller[_0x00a8('0x22')]);module[_0x00a8('0x23')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index c89cb0c..1522cf4 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 _0x59a5=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','STRING','name','ENUM','twilio','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0xe1986f,_0x47a2ea){var _0x257189=function(_0x30c70c){while(--_0x30c70c){_0xe1986f['push'](_0xe1986f['shift']());}};_0x257189(++_0x47a2ea);}(_0x59a5,0x162));var _0x559a=function(_0x2b7cc0,_0xc65023){_0x2b7cc0=_0x2b7cc0-0x0;var _0x383773=_0x59a5[_0x2b7cc0];return _0x383773;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x559a('0x0')],'unique':_0x559a('0x1'),'allowNull':![]},'key':{'type':Sequelize[_0x559a('0x0')],'allowNull':![]},'remote':{'type':Sequelize[_0x559a('0x0')],'allowNull':![]},'token':{'type':Sequelize[_0x559a('0x0')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x559a('0x0')]},'type':{'type':Sequelize[_0x559a('0x2')](_0x559a('0x3'),'sinch')},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0x559a('0x0')]},'authToken':{'type':Sequelize[_0x559a('0x0')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x559a('0x4');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x559a('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x559a('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x559a('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x559a('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x559a('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x559a('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x559a('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x559a('0x6')],'comment':_0x559a('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x45b54f){if(!_0x45b54f){this['setDataValue'](_0x559a('0x8'),null);}this['setDataValue'](_0x559a('0x9'),_0x45b54f);}},'description':{'type':Sequelize[_0x559a('0x0')]}}; \ No newline at end of file +var _0x3bd7=['TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','generate','ENUM','twilio','sinch'];(function(_0x3328b9,_0x41c6c2){var _0x4cbcab=function(_0x49a498){while(--_0x49a498){_0x3328b9['push'](_0x3328b9['shift']());}};_0x4cbcab(++_0x41c6c2);}(_0x3bd7,0x167));var _0x73bd=function(_0x211632,_0x378e2e){_0x211632=_0x211632-0x0;var _0x5a1da1=_0x3bd7[_0x211632];return _0x5a1da1;};'use strict';var Sequelize=require(_0x73bd('0x0'));var rs=require(_0x73bd('0x1'));module[_0x73bd('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x73bd('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x73bd('0x4')],'allowNull':![]},'remote':{'type':Sequelize[_0x73bd('0x4')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x73bd('0x5')]();}},'phone':{'type':Sequelize[_0x73bd('0x4')]},'type':{'type':Sequelize[_0x73bd('0x6')](_0x73bd('0x7'),_0x73bd('0x8'))},'accountSid':{'type':Sequelize[_0x73bd('0x4')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x73bd('0x4')]},'notificationTemplate':{'type':Sequelize[_0x73bd('0x9')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x73bd('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x73bd('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x73bd('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x73bd('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x73bd('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x73bd('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x73bd('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x73bd('0xb')],'comment':_0x73bd('0xc')},'mandatoryDisposition':{'type':Sequelize[_0x73bd('0xa')],'defaultValue':![],'comment':_0x73bd('0xd'),'set':function(_0x5d4e1e){if(!_0x5d4e1e){this[_0x73bd('0xe')]('mandatoryDispositionPauseId',null);}this[_0x73bd('0xe')](_0x73bd('0xf'),_0x5d4e1e);}},'description':{'type':Sequelize[_0x73bd('0x4')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 224b543..9f27649 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 _0x76d5=['ContactId','UserId','unshift','agent','queueId','WhatsappQueue','waitForTheAssignedQueue','Start','startRouting','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','body\x20is\x20mandatory\x20and\x20not\x20empty','CmList','DESC','List','out','spread','dataValues','Messages','eml-format','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','get','WhatsappAccounts','UserProfileResource','destroy','sendStatus','stack','send','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','name','options','WhatsappAccount','includeAll','include','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','getDispositions','findOne','Disposition','hasOwnProperty','WhatsappAccountId','findAll','rows','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addAgents','omit','userWhatsappAccount:save','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','account','sinch','statuses','state','read','WhatsappMessage','orderBy','asc','Applications','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','type','twilio','from','From','whatsapp:','messageId','MessageSid','notifications','message_id','isNil','Sequelize','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','list','WhatsappInteraction','interaction','autoclose','applications','push','close','unmanaged','*,*,*,*','created'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x76d5,0x19b));var _0x576d=function(_0x214e6c,_0x1aba86){_0x214e6c=_0x214e6c-0x0;var _0x229461=_0x76d5[_0x214e6c];return _0x229461;};'use strict';var emlformat=require(_0x576d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x576d('0x1'));var rp=require(_0x576d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x576d('0x3'));var util=require(_0x576d('0x4'));var path=require(_0x576d('0x5'));var sox=require(_0x576d('0x6'));var csv=require('to-csv');var ejs=require(_0x576d('0x7'));var fs=require('fs');var fs_extra=require(_0x576d('0x8'));var _=require(_0x576d('0x9'));var squel=require(_0x576d('0xa'));var crypto=require(_0x576d('0xb'));var jsforce=require(_0x576d('0xc'));var deskjs=require(_0x576d('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x576d('0xe'));var Redis=require(_0x576d('0xf'));var authService=require(_0x576d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x576d('0x11'));var hardwareService=require(_0x576d('0x12'));var logger=require('../../config/logger')(_0x576d('0x13'));var utils=require('../../config/utils');var config=require(_0x576d('0x14'));var licenseUtil=require(_0x576d('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x576d('0x16')](config[_0x576d('0x17')],{'host':_0x576d('0x18'),'port':0x18eb});var socket=require(_0x576d('0x19'))(new Redis(config['redis']));require(_0x576d('0x1a'))[_0x576d('0x1b')](socket);var jayson=require(_0x576d('0x1c'));var client=jayson[_0x576d('0x1d')][_0x576d('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x43a30a,_0x13dc03,_0x4ebe3a,_0x25f7cc){return new BPromise(function(_0xb45c35,_0x548c79){var _0x105120=_0x25f7cc||client;return _0x105120[_0x576d('0x1f')](_0x43a30a,_0x4ebe3a)['then'](function(_0x74c2d7){logger['info'](_0x576d('0x20'),_0x13dc03,_0x576d('0x21'));logger['debug'](_0x576d('0x22'),_0x13dc03,_0x576d('0x21'),JSON[_0x576d('0x23')](_0x74c2d7));if(_0x74c2d7[_0x576d('0x24')]){if(_0x74c2d7[_0x576d('0x24')]['code']===0x1f4){logger[_0x576d('0x24')]('WhatsappAccount,\x20%s,\x20%s',_0x13dc03,_0x74c2d7[_0x576d('0x24')][_0x576d('0x25')]);return _0x548c79(_0x74c2d7[_0x576d('0x24')][_0x576d('0x25')]);}logger[_0x576d('0x24')]('WhatsappAccount,\x20%s,\x20%s',_0x13dc03,_0x74c2d7[_0x576d('0x24')][_0x576d('0x25')]);return _0xb45c35(_0x74c2d7[_0x576d('0x24')][_0x576d('0x25')]);}else{logger[_0x576d('0x26')](_0x576d('0x20'),_0x13dc03,_0x576d('0x21'));_0xb45c35(_0x74c2d7['result'][_0x576d('0x25')]);}})[_0x576d('0x27')](function(_0x3e6f15){logger['error'](_0x576d('0x20'),_0x13dc03,_0x3e6f15);_0x548c79(_0x3e6f15);});});}function respondWithStatusCode(_0x2cb77b,_0x422b7f){_0x422b7f=_0x422b7f||0xcc;return function(_0x20595a){if(_0x20595a){return _0x2cb77b['sendStatus'](_0x422b7f);}return _0x2cb77b[_0x576d('0x28')](_0x422b7f)[_0x576d('0x29')]();};}function respondWithResult(_0x401fd4,_0x3e9194){_0x3e9194=_0x3e9194||0xc8;return function(_0x15c3f6){if(_0x15c3f6){return _0x401fd4[_0x576d('0x28')](_0x3e9194)[_0x576d('0x2a')](_0x15c3f6);}};}function respondWithFilteredResult(_0x2a4eb8,_0x32007d){return function(_0x104b05){if(_0x104b05){var _0x20f62b=typeof _0x32007d[_0x576d('0x2b')]===_0x576d('0x2c')&&typeof _0x32007d['limit']===_0x576d('0x2c');var _0x22edd4=_0x104b05[_0x576d('0x2d')];var _0x22b04b=_0x20f62b?0x0:_0x32007d[_0x576d('0x2b')];var _0x5355d6=_0x20f62b?_0x104b05[_0x576d('0x2d')]:_0x32007d[_0x576d('0x2b')]+_0x32007d[_0x576d('0x2e')];var _0x175ccd;if(_0x5355d6>=_0x22edd4){_0x5355d6=_0x22edd4;_0x175ccd=0xc8;}else{_0x175ccd=0xce;}_0x2a4eb8['status'](_0x175ccd);return _0x2a4eb8[_0x576d('0x2f')](_0x576d('0x30'),_0x22b04b+'-'+_0x5355d6+'/'+_0x22edd4)[_0x576d('0x2a')](_0x104b05);}return null;};}function patchUpdates(_0x23b94e){return function(_0x6e0aec){try{jsonpatch[_0x576d('0x31')](_0x6e0aec,_0x23b94e,!![]);}catch(_0x48e815){return BPromise[_0x576d('0x32')](_0x48e815);}return _0x6e0aec['save']();};}function saveUpdates(_0x19cba7,_0x108f09){return function(_0x49d166){if(_0x49d166){return _0x49d166[_0x576d('0x33')](_0x19cba7)['then'](function(_0x37ecdb){return _0x37ecdb;});}return null;};}function removeEntity(_0x33d4b3,_0x3abf62){return function(_0x2a2d3b){if(_0x2a2d3b){return _0x2a2d3b['destroy']()[_0x576d('0x34')](function(){var _0x433054=_0x2a2d3b[_0x576d('0x35')]({'plain':!![]});var _0x531215=_0x576d('0x36');return db[_0x576d('0x37')][_0x576d('0x38')]({'where':{'type':_0x531215,'resourceId':_0x433054['id']}})[_0x576d('0x34')](function(){return _0x2a2d3b;});})['then'](function(){_0x33d4b3[_0x576d('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3be4b9,_0x387d6f){return function(_0xe060f7){if(!_0xe060f7){_0x3be4b9[_0x576d('0x39')](0x194);}return _0xe060f7;};}function handleError(_0x4ab496,_0x1885d6){_0x1885d6=_0x1885d6||0x1f4;return function(_0x30fbc1){logger[_0x576d('0x24')](_0x30fbc1[_0x576d('0x3a')]);if(_0x30fbc1['name']){delete _0x30fbc1['name'];}_0x4ab496[_0x576d('0x28')](_0x1885d6)[_0x576d('0x3b')](_0x30fbc1);};}exports['index']=function(_0x2946eb,_0x238c47){var _0x2a5258={'include':[{'model':db[_0x576d('0x3c')],'as':_0x576d('0x3d')}]},_0x12449c={},_0x445a5e={'count':0x0,'rows':[]};var _0x590934=_[_0x576d('0x3e')](db['WhatsappAccount'][_0x576d('0x3f')],function(_0x747e63){return{'name':_0x747e63[_0x576d('0x40')],'type':_0x747e63['type'][_0x576d('0x41')]};});_0x12449c['model']=_[_0x576d('0x3e')](_0x590934,'name');_0x12449c[_0x576d('0x42')]=_[_0x576d('0x43')](_0x2946eb['query']);_0x12449c[_0x576d('0x44')]=_[_0x576d('0x45')](_0x12449c[_0x576d('0x46')],_0x12449c[_0x576d('0x42')]);_0x2a5258['attributes']=_[_0x576d('0x45')](_0x12449c[_0x576d('0x46')],qs[_0x576d('0x47')](_0x2946eb[_0x576d('0x42')]['fields']));_0x2a5258[_0x576d('0x48')]=_0x2a5258[_0x576d('0x48')][_0x576d('0x49')]?_0x2a5258[_0x576d('0x48')]:_0x12449c['model'];if(!_0x2946eb[_0x576d('0x42')]['hasOwnProperty'](_0x576d('0x4a'))){_0x2a5258['limit']=qs[_0x576d('0x2e')](_0x2946eb[_0x576d('0x42')]['limit']);_0x2a5258[_0x576d('0x2b')]=qs['offset'](_0x2946eb[_0x576d('0x42')]['offset']);}_0x2a5258[_0x576d('0x4b')]=qs[_0x576d('0x4c')](_0x2946eb[_0x576d('0x42')]['sort']);_0x2a5258[_0x576d('0x4d')]=qs[_0x576d('0x44')](_[_0x576d('0x4e')](_0x2946eb[_0x576d('0x42')],_0x12449c[_0x576d('0x44')]),_0x590934);if(_0x2946eb[_0x576d('0x42')][_0x576d('0x4f')]){_0x2a5258[_0x576d('0x4d')]=_[_0x576d('0x50')](_0x2a5258[_0x576d('0x4d')],{'$or':_[_0x576d('0x3e')](_0x590934,function(_0x2aa35b){if(_0x2aa35b['type']!=='VIRTUAL'){var _0x4e8650={};_0x4e8650[_0x2aa35b[_0x576d('0x51')]]={'$like':'%'+_0x2946eb[_0x576d('0x42')][_0x576d('0x4f')]+'%'};return _0x4e8650;}})});}_0x2a5258=_['merge']({},_0x2a5258,_0x2946eb[_0x576d('0x52')]);var _0xe437bb={'where':_0x2a5258[_0x576d('0x4d')]};return db[_0x576d('0x53')][_0x576d('0x2d')](_0xe437bb)[_0x576d('0x34')](function(_0x3d6d72){_0x445a5e[_0x576d('0x2d')]=_0x3d6d72;if(_0x2946eb[_0x576d('0x42')][_0x576d('0x54')]){_0x2a5258[_0x576d('0x55')]=[{'all':!![]}];}return db[_0x576d('0x53')]['findAll'](_0x2a5258);})['then'](function(_0x3e88c6){_0x445a5e['rows']=_0x3e88c6;return _0x445a5e;})['then'](respondWithFilteredResult(_0x238c47,_0x2a5258))['catch'](handleError(_0x238c47,null));};exports[_0x576d('0x56')]=function(_0x50fd1c,_0x118b1f){var _0x1caeeb={'raw':![],'where':{'id':_0x50fd1c[_0x576d('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0x576d('0x3d')}]},_0xad75a0={};_0xad75a0[_0x576d('0x46')]=_['keys'](db[_0x576d('0x53')][_0x576d('0x3f')]);_0xad75a0[_0x576d('0x42')]=_[_0x576d('0x43')](_0x50fd1c[_0x576d('0x42')]);_0xad75a0[_0x576d('0x44')]=_[_0x576d('0x45')](_0xad75a0[_0x576d('0x46')],_0xad75a0[_0x576d('0x42')]);_0x1caeeb[_0x576d('0x48')]=_[_0x576d('0x45')](_0xad75a0[_0x576d('0x46')],qs[_0x576d('0x47')](_0x50fd1c[_0x576d('0x42')]['fields']));_0x1caeeb['attributes']=_0x1caeeb[_0x576d('0x48')][_0x576d('0x49')]?_0x1caeeb[_0x576d('0x48')]:_0xad75a0[_0x576d('0x46')];if(_0x50fd1c[_0x576d('0x42')][_0x576d('0x54')]){_0x1caeeb[_0x576d('0x55')]=[{'all':!![]}];}_0x1caeeb=_[_0x576d('0x50')]({},_0x1caeeb,_0x50fd1c['options']);return db[_0x576d('0x53')]['find'](_0x1caeeb)[_0x576d('0x34')](handleEntityNotFound(_0x118b1f,null))[_0x576d('0x34')](respondWithResult(_0x118b1f,null))[_0x576d('0x27')](handleError(_0x118b1f,null));};exports[_0x576d('0x58')]=function(_0xa0f280,_0x22ab3f){return db['WhatsappAccount'][_0x576d('0x58')](_0xa0f280[_0x576d('0x59')],{})[_0x576d('0x34')](function(_0x648317){var _0x24928f=_0xa0f280[_0x576d('0x5a')]['get']({'plain':!![]});if(!_0x24928f)throw new Error(_0x576d('0x5b'));if(_0x24928f['role']===_0x576d('0x5a')){var _0x4c860d=_0x648317[_0x576d('0x35')]({'plain':!![]});var _0x1f653e=_0x576d('0x36');return db[_0x576d('0x5c')][_0x576d('0x5d')]({'where':{'name':_0x1f653e,'userProfileId':_0x24928f[_0x576d('0x5e')]},'raw':!![]})[_0x576d('0x34')](function(_0x5b9166){if(_0x5b9166&&_0x5b9166[_0x576d('0x5f')]===0x0){return db[_0x576d('0x37')][_0x576d('0x58')]({'name':_0x4c860d[_0x576d('0x51')],'resourceId':_0x4c860d['id'],'type':_0x5b9166['name'],'sectionId':_0x5b9166['id']},{})[_0x576d('0x34')](function(){return _0x648317;});}else{return _0x648317;}})[_0x576d('0x27')](function(_0x1e0072){logger['error'](_0x576d('0x60'),_0x1e0072);throw _0x1e0072;});}return _0x648317;})['then'](respondWithResult(_0x22ab3f,0xc9))[_0x576d('0x27')](handleError(_0x22ab3f,null));};exports[_0x576d('0x33')]=function(_0x2def6a,_0x5e6cd1){if(_0x2def6a[_0x576d('0x59')]['id']){delete _0x2def6a['body']['id'];}return db[_0x576d('0x53')][_0x576d('0x5d')]({'where':{'id':_0x2def6a[_0x576d('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0x576d('0x3d')}]})[_0x576d('0x34')](handleEntityNotFound(_0x5e6cd1,null))[_0x576d('0x34')](saveUpdates(_0x2def6a[_0x576d('0x59')],null))['then'](respondWithResult(_0x5e6cd1,null))[_0x576d('0x27')](handleError(_0x5e6cd1,null));};exports[_0x576d('0x38')]=function(_0x261dd4,_0x3dd35c){return db[_0x576d('0x53')][_0x576d('0x5d')]({'where':{'id':_0x261dd4[_0x576d('0x57')]['id']}})[_0x576d('0x34')](handleEntityNotFound(_0x3dd35c,null))[_0x576d('0x34')](removeEntity(_0x3dd35c,null))[_0x576d('0x27')](handleError(_0x3dd35c,null));};exports['describe']=function(_0x4d2143,_0xa62fe6){return db[_0x576d('0x53')][_0x576d('0x61')]()[_0x576d('0x34')](respondWithResult(_0xa62fe6,null))[_0x576d('0x27')](handleError(_0xa62fe6,null));};exports[_0x576d('0x62')]=function(_0x524461,_0x252d12,_0x33fb62){if(_0x524461[_0x576d('0x59')]['id']){delete _0x524461[_0x576d('0x59')]['id'];}return db[_0x576d('0x53')][_0x576d('0x5d')]({'where':{'id':_0x524461['params']['id']}})[_0x576d('0x34')](handleEntityNotFound(_0x252d12,null))['then'](function(_0x4cc6e9){if(_0x4cc6e9){_0x524461[_0x576d('0x59')]['WhatsappAccountId']=_0x4cc6e9['id'];return db['Disposition'][_0x576d('0x58')](_0x524461[_0x576d('0x59')]);}})[_0x576d('0x34')](respondWithResult(_0x252d12,null))[_0x576d('0x27')](handleError(_0x252d12,null));};exports[_0x576d('0x63')]=function(_0x43bc48,_0x40f1a8,_0x2d9e37){var _0x3b2155={'raw':![],'where':{}};var _0x505932={};var _0x3cb1bd={'count':0x0,'rows':[]};return db[_0x576d('0x53')][_0x576d('0x64')]({'where':{'id':_0x43bc48[_0x576d('0x57')]['id']}})[_0x576d('0x34')](handleEntityNotFound(_0x40f1a8,null))[_0x576d('0x34')](function(_0x1acd5b){if(_0x1acd5b){_0x505932[_0x576d('0x46')]=_['keys'](db[_0x576d('0x65')][_0x576d('0x3f')]);_0x505932[_0x576d('0x42')]=_['keys'](_0x43bc48['query']);_0x505932[_0x576d('0x44')]=_[_0x576d('0x45')](_0x505932['model'],_0x505932['query']);_0x3b2155[_0x576d('0x48')]=_[_0x576d('0x45')](_0x505932[_0x576d('0x46')],qs[_0x576d('0x47')](_0x43bc48['query'][_0x576d('0x47')]));_0x3b2155[_0x576d('0x48')]=_0x3b2155[_0x576d('0x48')][_0x576d('0x49')]?_0x3b2155[_0x576d('0x48')]:_0x505932[_0x576d('0x46')];if(!_0x43bc48['query'][_0x576d('0x66')](_0x576d('0x4a'))){_0x3b2155[_0x576d('0x2e')]=qs[_0x576d('0x2e')](_0x43bc48[_0x576d('0x42')][_0x576d('0x2e')]);_0x3b2155[_0x576d('0x2b')]=qs[_0x576d('0x2b')](_0x43bc48[_0x576d('0x42')][_0x576d('0x2b')]);}_0x3b2155[_0x576d('0x4b')]=qs[_0x576d('0x4c')](_0x43bc48[_0x576d('0x42')]['sort']);_0x3b2155['where']=qs['filters'](_['pick'](_0x43bc48[_0x576d('0x42')],_0x505932[_0x576d('0x44')]));_0x3b2155[_0x576d('0x4d')][_0x576d('0x67')]=_0x1acd5b['id'];if(_0x43bc48['query'][_0x576d('0x4f')]){_0x3b2155[_0x576d('0x4d')]=_[_0x576d('0x50')](_0x3b2155[_0x576d('0x4d')],{'$or':_[_0x576d('0x3e')](_0x3b2155[_0x576d('0x48')],function(_0x13ccaa){var _0x895ea6={};_0x895ea6[_0x13ccaa]={'$like':'%'+_0x43bc48['query'][_0x576d('0x4f')]+'%'};return _0x895ea6;})});}_0x3b2155=_[_0x576d('0x50')]({},_0x3b2155,_0x43bc48['options']);return db[_0x576d('0x65')][_0x576d('0x2d')]({'where':_0x3b2155[_0x576d('0x4d')]})[_0x576d('0x34')](function(_0x4b4400){_0x3cb1bd['count']=_0x4b4400;if(_0x43bc48[_0x576d('0x42')][_0x576d('0x54')]){_0x3b2155[_0x576d('0x55')]=[{'all':!![]}];}return db['Disposition'][_0x576d('0x68')](_0x3b2155);})[_0x576d('0x34')](function(_0x20dd96){_0x3cb1bd[_0x576d('0x69')]=_0x20dd96;return _0x3cb1bd;});}})['then'](respondWithFilteredResult(_0x40f1a8,_0x3b2155))[_0x576d('0x27')](handleError(_0x40f1a8,null));};exports[_0x576d('0x6a')]=function(_0x26259c,_0x1b32f0,_0x972f00){return db['WhatsappAccount']['find']({'where':{'id':_0x26259c['params']['id']}})[_0x576d('0x34')](handleEntityNotFound(_0x1b32f0,null))[_0x576d('0x34')](function(_0x3b11ee){if(_0x3b11ee){return _0x3b11ee[_0x576d('0x6a')](_0x26259c[_0x576d('0x42')][_0x576d('0x6b')]);}})[_0x576d('0x34')](respondWithStatusCode(_0x1b32f0,null))['catch'](handleError(_0x1b32f0,null));};exports[_0x576d('0x6c')]=function(_0x42675c,_0xf20403,_0xeab096){if(_0x42675c['body']['id']){delete _0x42675c[_0x576d('0x59')]['id'];}return db['WhatsappAccount'][_0x576d('0x5d')]({'where':{'id':_0x42675c[_0x576d('0x57')]['id']}})[_0x576d('0x34')](handleEntityNotFound(_0xf20403,null))[_0x576d('0x34')](function(_0x87ca20){if(_0x87ca20){_0x42675c[_0x576d('0x59')][_0x576d('0x67')]=_0x87ca20['id'];return db['CannedAnswer'][_0x576d('0x58')](_0x42675c[_0x576d('0x59')]);}})[_0x576d('0x34')](respondWithResult(_0xf20403,null))['catch'](handleError(_0xf20403,null));};exports[_0x576d('0x6d')]=function(_0xc0a9f0,_0xd4dc40,_0x13378b){var _0x4519a3={'raw':![],'where':{}};var _0x432da6={};var _0x88c531={'count':0x0,'rows':[]};return db[_0x576d('0x53')][_0x576d('0x64')]({'where':{'id':_0xc0a9f0[_0x576d('0x57')]['id']}})[_0x576d('0x34')](handleEntityNotFound(_0xd4dc40,null))[_0x576d('0x34')](function(_0x1d6bd5){if(_0x1d6bd5){_0x432da6[_0x576d('0x46')]=_[_0x576d('0x43')](db['CannedAnswer'][_0x576d('0x3f')]);_0x432da6[_0x576d('0x42')]=_[_0x576d('0x43')](_0xc0a9f0[_0x576d('0x42')]);_0x432da6[_0x576d('0x44')]=_['intersection'](_0x432da6[_0x576d('0x46')],_0x432da6[_0x576d('0x42')]);_0x4519a3['attributes']=_[_0x576d('0x45')](_0x432da6['model'],qs[_0x576d('0x47')](_0xc0a9f0[_0x576d('0x42')]['fields']));_0x4519a3[_0x576d('0x48')]=_0x4519a3[_0x576d('0x48')]['length']?_0x4519a3['attributes']:_0x432da6['model'];if(!_0xc0a9f0[_0x576d('0x42')][_0x576d('0x66')](_0x576d('0x4a'))){_0x4519a3[_0x576d('0x2e')]=qs[_0x576d('0x2e')](_0xc0a9f0[_0x576d('0x42')][_0x576d('0x2e')]);_0x4519a3['offset']=qs[_0x576d('0x2b')](_0xc0a9f0[_0x576d('0x42')][_0x576d('0x2b')]);}_0x4519a3['order']=qs['sort'](_0xc0a9f0[_0x576d('0x42')][_0x576d('0x4c')]);_0x4519a3[_0x576d('0x4d')]=qs[_0x576d('0x44')](_[_0x576d('0x4e')](_0xc0a9f0['query'],_0x432da6['filters']));_0x4519a3[_0x576d('0x4d')][_0x576d('0x67')]=_0x1d6bd5['id'];if(_0xc0a9f0[_0x576d('0x42')][_0x576d('0x4f')]){_0x4519a3['where']=_[_0x576d('0x50')](_0x4519a3[_0x576d('0x4d')],{'$or':_[_0x576d('0x3e')](_0x4519a3['attributes'],function(_0x4e00b0){var _0x4207d5={};_0x4207d5[_0x4e00b0]={'$like':'%'+_0xc0a9f0[_0x576d('0x42')][_0x576d('0x4f')]+'%'};return _0x4207d5;})});}_0x4519a3=_['merge']({},_0x4519a3,_0xc0a9f0[_0x576d('0x52')]);return db[_0x576d('0x6e')][_0x576d('0x2d')]({'where':_0x4519a3[_0x576d('0x4d')]})[_0x576d('0x34')](function(_0x50cb35){_0x88c531['count']=_0x50cb35;if(_0xc0a9f0['query'][_0x576d('0x54')]){_0x4519a3['include']=[{'all':!![]}];}return db[_0x576d('0x6e')][_0x576d('0x68')](_0x4519a3);})[_0x576d('0x34')](function(_0x2c1bdc){_0x88c531[_0x576d('0x69')]=_0x2c1bdc;return _0x88c531;});}})[_0x576d('0x34')](respondWithFilteredResult(_0xd4dc40,_0x4519a3))[_0x576d('0x27')](handleError(_0xd4dc40,null));};exports['removeAnswers']=function(_0x8b27b6,_0x472da4,_0x2dda4c){return db[_0x576d('0x53')][_0x576d('0x5d')]({'where':{'id':_0x8b27b6[_0x576d('0x57')]['id']}})[_0x576d('0x34')](handleEntityNotFound(_0x472da4,null))['then'](function(_0x10a535){if(_0x10a535){return _0x10a535[_0x576d('0x6f')](_0x8b27b6['query'][_0x576d('0x6b')]);}})[_0x576d('0x34')](respondWithStatusCode(_0x472da4,null))['catch'](handleError(_0x472da4,null));};exports['addAgents']=function(_0x13f192,_0x1f69f6,_0x5b1da6){return db[_0x576d('0x53')][_0x576d('0x5d')]({'where':{'id':_0x13f192[_0x576d('0x57')]['id']}})[_0x576d('0x34')](handleEntityNotFound(_0x1f69f6,null))[_0x576d('0x34')](function(_0x2ea7f2){if(_0x2ea7f2){return _0x2ea7f2[_0x576d('0x70')](_0x13f192[_0x576d('0x59')][_0x576d('0x6b')],_[_0x576d('0x71')](_0x13f192[_0x576d('0x59')],[_0x576d('0x6b'),'id'])||{})['spread'](function(_0x2657d4){for(var _0x2423f5=0x0;_0x2423f5<_0x13f192[_0x576d('0x59')][_0x576d('0x6b')][_0x576d('0x49')];_0x2423f5+=0x1){socket['emit'](_0x576d('0x72'),{'UserId':Number(_0x13f192[_0x576d('0x59')][_0x576d('0x6b')][_0x2423f5]),'WhatsappAccountId':Number(_0x13f192[_0x576d('0x57')]['id'])});}return _0x2657d4;});}})[_0x576d('0x34')](respondWithResult(_0x1f69f6,null))['catch'](handleError(_0x1f69f6,null));};exports['removeAgents']=function(_0x50fc35,_0x57730d,_0x403f5b){return db['WhatsappAccount'][_0x576d('0x5d')]({'where':{'id':_0x50fc35[_0x576d('0x57')]['id']}})[_0x576d('0x34')](handleEntityNotFound(_0x57730d,null))[_0x576d('0x34')](function(_0x3d241d){if(_0x3d241d){return _0x3d241d[_0x576d('0x73')](_0x50fc35[_0x576d('0x42')][_0x576d('0x6b')])[_0x576d('0x34')](function(){if(_[_0x576d('0x74')](_0x50fc35[_0x576d('0x42')][_0x576d('0x6b')])){for(var _0x5125f1=0x0;_0x5125f1<_0x50fc35['query'][_0x576d('0x6b')][_0x576d('0x49')];_0x5125f1+=0x1){socket[_0x576d('0x75')](_0x576d('0x76'),{'UserId':Number(_0x50fc35[_0x576d('0x42')][_0x576d('0x6b')][_0x5125f1]),'WhatsappAccountId':Number(_0x50fc35[_0x576d('0x57')]['id'])});}}else{socket[_0x576d('0x75')](_0x576d('0x76'),{'UserId':Number(_0x50fc35[_0x576d('0x42')][_0x576d('0x6b')]),'WhatsappAccountId':Number(_0x50fc35[_0x576d('0x57')]['id'])});}});}})[_0x576d('0x34')](respondWithStatusCode(_0x57730d,null))[_0x576d('0x27')](handleError(_0x57730d,null));};exports[_0x576d('0x77')]=function(_0x2d8d1a,_0x413c3d,_0x68c981){var _0x17d143={};var _0x138622={};var _0x35a6f6;var _0x3352b1;return db[_0x576d('0x53')][_0x576d('0x64')]({'where':{'id':_0x2d8d1a[_0x576d('0x57')]['id']}})[_0x576d('0x34')](handleEntityNotFound(_0x413c3d,null))[_0x576d('0x34')](function(_0x1d833b){if(_0x1d833b){_0x35a6f6=_0x1d833b;_0x138622['model']=_[_0x576d('0x43')](db[_0x576d('0x78')][_0x576d('0x3f')]);_0x138622[_0x576d('0x42')]=_[_0x576d('0x43')](_0x2d8d1a[_0x576d('0x42')]);_0x138622[_0x576d('0x44')]=_[_0x576d('0x45')](_0x138622[_0x576d('0x46')],_0x138622['query']);_0x17d143[_0x576d('0x48')]=_[_0x576d('0x45')](_0x138622['model'],qs[_0x576d('0x47')](_0x2d8d1a[_0x576d('0x42')]['fields']));_0x17d143['attributes']=_0x17d143[_0x576d('0x48')][_0x576d('0x49')]?_0x17d143[_0x576d('0x48')]:_0x138622[_0x576d('0x46')];_0x17d143[_0x576d('0x4b')]=qs[_0x576d('0x4c')](_0x2d8d1a[_0x576d('0x42')]['sort']);_0x17d143[_0x576d('0x4d')]=qs['filters'](_[_0x576d('0x4e')](_0x2d8d1a['query'],_0x138622[_0x576d('0x44')]));if(_0x2d8d1a['query']['filter']){_0x17d143[_0x576d('0x4d')]=_['merge'](_0x17d143[_0x576d('0x4d')],{'$or':_[_0x576d('0x3e')](_0x17d143[_0x576d('0x48')],function(_0x28e700){var _0x11c284={};_0x11c284[_0x28e700]={'$like':'%'+_0x2d8d1a[_0x576d('0x42')][_0x576d('0x4f')]+'%'};return _0x11c284;})});}_0x17d143=_[_0x576d('0x50')]({},_0x17d143,_0x2d8d1a[_0x576d('0x52')]);return _0x35a6f6[_0x576d('0x77')](_0x17d143);}})[_0x576d('0x34')](function(_0x5f1f15){if(_0x5f1f15){_0x3352b1=_0x5f1f15[_0x576d('0x49')];if(!_0x2d8d1a[_0x576d('0x42')][_0x576d('0x66')]('nolimit')){_0x17d143[_0x576d('0x2e')]=qs[_0x576d('0x2e')](_0x2d8d1a[_0x576d('0x42')][_0x576d('0x2e')]);_0x17d143['offset']=qs[_0x576d('0x2b')](_0x2d8d1a[_0x576d('0x42')][_0x576d('0x2b')]);}return _0x35a6f6[_0x576d('0x77')](_0x17d143);}})['then'](function(_0x45abc0){if(_0x45abc0){return _0x45abc0?{'count':_0x3352b1,'rows':_0x45abc0}:null;}})[_0x576d('0x34')](respondWithResult(_0x413c3d,null))['catch'](handleError(_0x413c3d,null));};exports[_0x576d('0x79')]=function(_0x1ac364,_0x27b9d0){var _0x1aebd3=_0x1ac364[_0x576d('0x57')]['id'];var _0x2c7388=_0x1ac364[_0x576d('0x59')];var _0x53f115=0xc8;var _0x256cd8=null;return db[_0x576d('0x7a')]['transaction']({'isolationLevel':db[_0x576d('0x7a')][_0x576d('0x7b')][_0x576d('0x7c')][_0x576d('0x7d')]},function(_0x6525cd){return db[_0x576d('0x53')][_0x576d('0x64')]({'where':{'id':_0x1aebd3},'transaction':_0x6525cd})['then'](function(_0x907f2){if(_0x907f2){return db[_0x576d('0x7e')]['destroy']({'where':{'WhatsappAccountId':_0x1aebd3},'transaction':_0x6525cd})[_0x576d('0x34')](function(){var _0x4915d0=_[_0x576d('0x3e')](_0x2c7388,function(_0x1e3949){_0x1e3949[_0x576d('0x67')]=_0x1aebd3;return _0x1e3949;});return db[_0x576d('0x7e')][_0x576d('0x7f')](_0x4915d0,{'transaction':_0x6525cd});});}else{_0x53f115=0x194;_0x256cd8=[];}});})[_0x576d('0x34')](function(){if(_0x53f115!==0x194){return db[_0x576d('0x7e')][_0x576d('0x80')]({'where':{'WhatsappAccountId':_0x1aebd3},'order':_0x576d('0x81')})[_0x576d('0x34')](function(_0x5f4713){_0x256cd8=_0x5f4713;});}})['catch'](function(_0x13b057){_0x53f115=0x1f4;logger['error'](_0x13b057[_0x576d('0x3a')]);if(_0x13b057[_0x576d('0x51')]){delete _0x13b057[_0x576d('0x51')];}_0x256cd8=_0x13b057;})[_0x576d('0x82')](function(){if(_0x256cd8===null){_0x27b9d0['sendStatus'](_0x53f115);}else{if(_0x53f115===0x1f4){_0x27b9d0['status'](_0x53f115)[_0x576d('0x3b')](_0x256cd8);}else{_0x27b9d0[_0x576d('0x28')](_0x53f115)['json'](_0x256cd8);}}});};exports[_0x576d('0x83')]=function(_0x1debca,_0x2fc404,_0x5a18d2){var _0x50a8c0={};var _0x406c42={};var _0x40d681;var _0x488987;return db[_0x576d('0x53')][_0x576d('0x64')]({'where':{'id':_0x1debca[_0x576d('0x57')]['id']}})[_0x576d('0x34')](handleEntityNotFound(_0x2fc404,null))['then'](function(_0x3c91a8){if(_0x3c91a8){_0x40d681=_0x3c91a8;_0x406c42[_0x576d('0x46')]=_[_0x576d('0x43')](db[_0x576d('0x7e')][_0x576d('0x3f')]);_0x406c42[_0x576d('0x42')]=_[_0x576d('0x43')](_0x1debca[_0x576d('0x42')]);_0x406c42[_0x576d('0x44')]=_['intersection'](_0x406c42[_0x576d('0x46')],_0x406c42[_0x576d('0x42')]);_0x50a8c0[_0x576d('0x48')]=_['intersection'](_0x406c42[_0x576d('0x46')],qs['fields'](_0x1debca[_0x576d('0x42')]['fields']));_0x50a8c0['attributes']=_0x50a8c0[_0x576d('0x48')][_0x576d('0x49')]?_0x50a8c0[_0x576d('0x48')]:_0x406c42[_0x576d('0x46')];_0x50a8c0[_0x576d('0x4b')]=qs['sort'](_0x1debca[_0x576d('0x42')][_0x576d('0x4c')]);_0x50a8c0[_0x576d('0x4d')]=qs[_0x576d('0x44')](_[_0x576d('0x4e')](_0x1debca['query'],_0x406c42[_0x576d('0x44')]));if(_0x1debca[_0x576d('0x42')][_0x576d('0x4f')]){_0x50a8c0[_0x576d('0x4d')]=_[_0x576d('0x50')](_0x50a8c0['where'],{'$or':_['map'](_0x50a8c0[_0x576d('0x48')],function(_0x331635){var _0x515601={};_0x515601[_0x331635]={'$like':'%'+_0x1debca['query'][_0x576d('0x4f')]+'%'};return _0x515601;})});}_0x50a8c0=_[_0x576d('0x50')]({},_0x50a8c0,_0x1debca[_0x576d('0x52')]);return _0x40d681[_0x576d('0x83')](_0x50a8c0);}})[_0x576d('0x34')](function(_0x38d3a7){if(_0x38d3a7){_0x488987=_0x38d3a7[_0x576d('0x49')];if(!_0x1debca['query'][_0x576d('0x66')](_0x576d('0x4a'))){_0x50a8c0[_0x576d('0x2e')]=qs[_0x576d('0x2e')](_0x1debca[_0x576d('0x42')][_0x576d('0x2e')]);_0x50a8c0['offset']=qs['offset'](_0x1debca[_0x576d('0x42')][_0x576d('0x2b')]);}return _0x40d681[_0x576d('0x83')](_0x50a8c0);}})[_0x576d('0x34')](function(_0x209ccf){if(_0x209ccf){return _0x209ccf?{'count':_0x488987,'rows':_0x209ccf}:null;}})[_0x576d('0x34')](respondWithResult(_0x2fc404,null))[_0x576d('0x27')](handleError(_0x2fc404,null));};exports[_0x576d('0x84')]=function(_0x37258b,_0x4062f6,_0x2a5880){var _0x94d989={'channel':'whatsapp'};var _0xc1c715=[];var _0x182ecd=[];var _0x43516b={};return db[_0x576d('0x53')][_0x576d('0x5d')]({'where':{'id':_0x37258b[_0x576d('0x57')]['id']},'include':[{'model':db[_0x576d('0x7e')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x4062f6,null))[_0x576d('0x34')](function(_0x2fc473){_0x94d989[_0x576d('0x85')]=_0x2fc473;if(_0x94d989['account']&&_0x94d989['account']['type']===_0x576d('0x86')&&_0x37258b[_0x576d('0x59')][_0x576d('0x87')]){if(_0x37258b[_0x576d('0x59')][_0x576d('0x87')][_0x576d('0x49')]===0x0)return;if(_0x37258b['body']['statuses'][0x0][_0x576d('0x88')]!==_0x576d('0x89'))return;return db[_0x576d('0x8a')][_0x576d('0x33')]({'read':!![],'readAt':_0x37258b[_0x576d('0x59')]['statuses'][0x0]['timestamp']},{'where':{'messageId':_0x37258b['body']['statuses'][0x0]['message_id']},'individualHooks':!![]})[_0x576d('0x34')](function(_0x41d694){return _0x4062f6[_0x576d('0x28')](0xc8)[_0x576d('0x2a')](_0x41d694);});}_0x94d989['applications']=_[_0x576d('0x8b')](_0x2fc473['Applications'],[_0x576d('0x81')],[_0x576d('0x8c')]);if(_0x94d989[_0x576d('0x85')][_0x576d('0x8d')]){delete _0x94d989[_0x576d('0x85')][_0x576d('0x8d')];}return db[_0x576d('0x8e')]['describe']()['then'](function(_0x3d814e){if(!_0x3d814e){throw new db['Sequelize'][(_0x576d('0x8f'))](_0x576d('0x90'));}_0xc1c715=_[_0x576d('0x91')](_[_0x576d('0x43')](_0x3d814e),[_0x576d('0x92'),'updatedAt']);_0x182ecd=_['difference'](_[_0x576d('0x43')](_0x3d814e),[_0x576d('0x92'),_0x576d('0x93'),'CompanyId',_0x576d('0x94')]);_0x94d989['body']={'mapKey':_0x576d('0x95')};if(_0x94d989[_0x576d('0x85')]&&_0x94d989[_0x576d('0x85')][_0x576d('0x96')]===_0x576d('0x97')){_0x94d989[_0x576d('0x59')][_0x576d('0x98')]=_0x37258b[_0x576d('0x59')][_0x576d('0x99')]['replace'](_0x576d('0x9a'),'');_0x94d989[_0x576d('0x59')][_0x576d('0x59')]=_0x37258b[_0x576d('0x59')]['Body'];_0x94d989[_0x576d('0x59')][_0x576d('0x9b')]=_0x37258b['body'][_0x576d('0x9c')];}if(_0x94d989[_0x576d('0x85')]&&_0x94d989['account'][_0x576d('0x96')]===_0x576d('0x86')){_0x94d989[_0x576d('0x59')][_0x576d('0x98')]=_0x37258b['body']['notifications'][0x0]['from'];_0x94d989[_0x576d('0x59')][_0x576d('0x59')]=_0x37258b[_0x576d('0x59')][_0x576d('0x9d')][0x0][_0x576d('0x25')][_0x576d('0x59')];_0x94d989[_0x576d('0x59')][_0x576d('0x9b')]=_0x37258b[_0x576d('0x59')][_0x576d('0x9d')][0x0][_0x576d('0x9e')];}if(_0x94d989[_0x576d('0x59')]['id']){delete _0x94d989[_0x576d('0x59')]['id'];}if(_[_0x576d('0x9f')](_0x94d989[_0x576d('0x59')][_0x576d('0x98')])){throw new db['Sequelize']['ValidationError']('from\x20is\x20mandatory');}if(_[_0x576d('0x9f')](_0x94d989[_0x576d('0x59')]['body'])||_0x94d989[_0x576d('0x59')][_0x576d('0x59')]===''){throw new db[(_0x576d('0xa0'))][(_0x576d('0x8f'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x576d('0x9f')](_0x94d989[_0x576d('0x59')][_0x576d('0xa1')])){throw new db[(_0x576d('0xa0'))][(_0x576d('0x8f'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x182ecd);}if(!_['includes'](_0x182ecd,_0x94d989[_0x576d('0x59')][_0x576d('0xa1')])){throw new db[(_0x576d('0xa0'))][(_0x576d('0x8f'))](_0x576d('0xa2')+_0x182ecd);}_0x43516b[_0x94d989['body'][_0x576d('0xa1')]]=_0x94d989[_0x576d('0x59')][_0x576d('0x98')];return db['CmList']['find']({'where':{'id':_0x94d989[_0x576d('0x85')]['ListId']},'include':[{'model':db[_0x576d('0x8e')],'as':_0x576d('0xa3'),'where':_0x43516b,'limit':0x1,'order':[[_0x576d('0x93'),'DESC']]}]});})[_0x576d('0x34')](handleEntityNotFound(_0x4062f6,null))['then'](function(_0x50e46b){if(_0x50e46b){_0x94d989[_0x576d('0xa4')]=_[_0x576d('0x71')](_0x50e46b,[_0x576d('0xa3')]);if(_0x50e46b['Contacts']['length']){return _0x50e46b['Contacts'][0x0];}var _0x1b9eb0=_[_0x576d('0x16')](_0x94d989[_0x576d('0x59')],{'firstName':_0x94d989['body'][_0x576d('0x98')],'ListId':_0x50e46b['id']});_0x1b9eb0[_0x94d989[_0x576d('0x59')][_0x576d('0xa1')]]=_0x94d989[_0x576d('0x59')]['from'];return db[_0x576d('0x8e')][_0x576d('0x58')](_0x1b9eb0,{'fields':_0xc1c715,'raw':!![]});}})[_0x576d('0x34')](handleEntityNotFound(_0x4062f6,null))['then'](function(_0x5eea82){if(_0x5eea82){_0x94d989['contact']=_0x5eea82;var _0x2339a8={'ContactId':_0x5eea82['id'],'phone':_0x94d989[_0x576d('0x59')][_0x576d('0x98')],'WhatsappAccountId':_0x37258b[_0x576d('0x57')]['id']};var _0x4c8f06={'ContactId':_0x5eea82['id'],'WhatsappAccountId':_0x37258b[_0x576d('0x57')]['id'],'closed':![]};return db[_0x576d('0xa5')][_0x576d('0x5d')]({'where':_0x4c8f06})['then'](function(_0x54eec6){if(_0x54eec6){return[_0x54eec6,![]];}return db[_0x576d('0xa5')][_0x576d('0x58')](_0x2339a8)[_0x576d('0x34')](function(_0x2a0efc){return[_0x2a0efc,!![]];});});}})['spread'](function(_0x562114,_0x1799e4){_0x94d989[_0x576d('0xa6')]=_0x562114[_0x576d('0x35')]({'plain':!![]});_0x94d989['interaction']['created']=![];if(_0x1799e4){if(_0x94d989['account'][_0x576d('0xa7')]){_0x94d989[_0x576d('0xa8')][_0x576d('0xa9')]({'id':0x0,'priority':_0x94d989[_0x576d('0xa8')][_0x576d('0x49')]+0x1,'app':_0x576d('0xaa'),'appdata':_0x576d('0xab'),'interval':_0x576d('0xac')});}_0x94d989[_0x576d('0xa6')][_0x576d('0xad')]=!![];}return db[_0x576d('0x8a')][_0x576d('0x58')]({'phone':_0x94d989['body'][_0x576d('0x98')],'messageId':_0x94d989['body'][_0x576d('0x9b')],'body':_0x94d989[_0x576d('0x59')]['body'],'WhatsappAccountId':_0x37258b['params']['id'],'WhatsappInteractionId':_0x562114['id'],'direction':'in','ContactId':_0x562114[_0x576d('0xae')],'AttachmentId':_0x94d989[_0x576d('0x59')]['AttachmentId']});})[_0x576d('0x34')](function(_0x597e70){_0x94d989[_0x576d('0x25')]=_0x597e70;if(!_0x94d989[_0x576d('0xa6')][_0x576d('0xaf')])return;return db[_0x576d('0x78')]['find']({'attributes':['id',_0x576d('0x51')],'where':{'id':_0x94d989[_0x576d('0xa6')][_0x576d('0xaf')]}});})[_0x576d('0x34')](function(_0x5f5c1c){if(_0x5f5c1c){_0x94d989[_0x576d('0xa8')][_0x576d('0xb0')]({'id':0x0,'priority':0x0,'app':_0x576d('0xb1'),'appdata':_0x5f5c1c['name']+','+(_0x94d989[_0x576d('0x85')]['waitForTheAssignedAgent']||0xa),'interval':_0x576d('0xac')});}if(!_0x94d989['interaction'][_0x576d('0xb2')])return;return db[_0x576d('0xb3')]['find']({'attributes':['id','name'],'where':{'id':_0x94d989[_0x576d('0xa6')]['queueId']}});})[_0x576d('0x34')](function(_0x4bbec5){if(_0x4bbec5){_0x94d989[_0x576d('0xa8')][_0x576d('0xb0')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x4bbec5[_0x576d('0x51')]+','+(_0x94d989[_0x576d('0x85')][_0x576d('0xb4')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x576d('0xb5'),_0x576d('0xb6'),_0x94d989);})[_0x576d('0x34')](function(_0x916923){if(_0x916923){var _0x1e25ee=0xc8;var _0x5ed3a7='receiveMessage';logger['info']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x5ed3a7,_0x1e25ee,_0x576d('0xb7'));logger[_0x576d('0xb8')](_0x576d('0xb9'),_0x5ed3a7,_0x1e25ee,'entity\x20found',JSON['stringify'](_0x916923));if(_0x94d989[_0x576d('0x85')][_0x576d('0x96')]==='twilio'){return _0x4062f6[_0x576d('0x28')](_0x1e25ee)[_0x576d('0x2f')]('Content-Type',_0x576d('0xba'))['send']('\x0a');}else{return _0x4062f6[_0x576d('0x28')](_0x1e25ee)[_0x576d('0x2a')](_0x916923);}}});})['catch'](handleError(_0x4062f6,null));};exports[_0x576d('0x3b')]=function(_0x81aada,_0x37c6bc,_0x51dcd6){var _0x575ec0,_0x1923ca,_0x3690f9;if(_[_0x576d('0x9f')](_0x81aada[_0x576d('0x59')][_0x576d('0x59')])||_0x81aada['body']['body']===''){throw new db[(_0x576d('0xa0'))][(_0x576d('0x8f'))](_0x576d('0xbb'));}if(_['isNil'](_0x81aada[_0x576d('0x59')]['to'])){throw new db[(_0x576d('0xa0'))][(_0x576d('0x8f'))]('to\x20is\x20mandatory');}_0x575ec0=_0x81aada[_0x576d('0x59')]['to'];return db['WhatsappAccount']['find']({'where':{'id':_0x81aada[_0x576d('0x57')]['id']},'include':[{'model':db[_0x576d('0xbc')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0x575ec0},'limit':0x1,'order':[[_0x576d('0x93'),_0x576d('0xbd')]]}]}]})['then'](handleEntityNotFound(_0x37c6bc,null))[_0x576d('0x34')](function(_0x4ef696){if(_0x4ef696&&_0x4ef696[_0x576d('0xbe')]){_0x1923ca=_0x4ef696[_0x576d('0x35')]({'plain':!![]});if(_0x1923ca[_0x576d('0xbe')]&&_0x1923ca[_0x576d('0xbe')][_0x576d('0xa3')][_0x576d('0x49')]){return _0x1923ca['List'][_0x576d('0xa3')][0x0];}return db[_0x576d('0x8e')][_0x576d('0x58')](_[_0x576d('0x16')](_0x81aada[_0x576d('0x59')],{'firstName':_0x575ec0,'mobile':_0x575ec0,'phone':_0x575ec0,'ListId':_0x1923ca[_0x576d('0x94')]}));}})[_0x576d('0x34')](handleEntityNotFound(_0x37c6bc,null))[_0x576d('0x34')](function(_0x17d175){if(_0x17d175){_0x3690f9=_0x17d175;return db[_0x576d('0xa5')][_0x576d('0x5d')]({'where':{'ContactId':_0x3690f9['id'],'closed':![],'WhatsappAccountId':_0x1923ca['id']}})[_0x576d('0x34')](function(_0x28032a){if(_0x28032a){return[_0x28032a,![]];}return db['WhatsappInteraction'][_0x576d('0x58')]({'UserId':_0x81aada[_0x576d('0x5a')]['id'],'ContactId':_0x3690f9['id'],'WhatsappAccountId':_0x1923ca['id'],'phone':_0x575ec0,'firstMsgDirection':_0x576d('0xbf'),'Messages':[_[_0x576d('0x50')](_0x81aada[_0x576d('0x59')],{'read':![],'body':_0x81aada['body'][_0x576d('0x59')],'phone':_0x575ec0,'WhatsappAccountId':_0x1923ca['id'],'UserId':_0x81aada[_0x576d('0x5a')]['id'],'ContactId':_0x3690f9['id']})]},{'include':[{'model':db[_0x576d('0x8a')],'as':'Messages'}]})['then'](function(_0x271458){return[_0x271458,!![]];});});}})[_0x576d('0xc0')](function(_0x45b531,_0xe28292){if(_0xe28292){return _0x45b531;}return db['WhatsappMessage'][_0x576d('0x58')](_[_0x576d('0x50')](_0x81aada[_0x576d('0x59')],{'read':![],'body':_0x81aada[_0x576d('0x59')][_0x576d('0x59')],'phone':_0x575ec0,'WhatsappAccountId':_0x1923ca['id'],'WhatsappInteractionId':_0x45b531['id'],'UserId':_0x81aada[_0x576d('0x5a')]['id'],'ContactId':_0x3690f9['id']}))[_0x576d('0x34')](function(_0x3822fb){_0x45b531[_0x576d('0xc1')][_0x576d('0xc2')]=[];_0x45b531[_0x576d('0xc1')][_0x576d('0xc2')][_0x576d('0xa9')](_0x3822fb[_0x576d('0xc1')]);return _0x45b531;});})[_0x576d('0x34')](respondWithResult(_0x37c6bc,null))['catch'](handleError(_0x37c6bc,null));}; \ No newline at end of file +var _0x5758=['./whatsappAccount.socket','register','jayson/promise','client','http','info','request\x20sent','debug','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','destroy','then','get','WhatsappAccounts','name','send','index','Pause','map','WhatsappAccount','rawAttributes','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','mandatoryDispositionPause','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','nolimit','order','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','addAgents','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','WhatsappApplication','bulkCreate','findAndCountAll','finally','getApplications','notify','whatsapp','account','sinch','statuses','read','timestamp','message_id','applications','priority','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','mobile','from','From','replace','whatsapp:','Body','MessageSid','notifications','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','DESC','list','omit','Contacts','defaults','contact','WhatsappInteraction','spread','interaction','autoclose','push','close','*,*,*,*','WhatsappMessage','messageId','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','queue','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','text/xml','\x0a','List','Messages','dataValues','eml-format','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x5758,0xa6));var _0x8575=function(_0x4a9305,_0x44b2e8){_0x4a9305=_0x4a9305-0x0;var _0x55fd86=_0x5758[_0x4a9305];return _0x55fd86;};'use strict';var emlformat=require(_0x8575('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8575('0x1'));var moment=require(_0x8575('0x2'));var BPromise=require(_0x8575('0x3'));var Mustache=require(_0x8575('0x4'));var util=require(_0x8575('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8575('0x6'));var fs=require('fs');var fs_extra=require(_0x8575('0x7'));var _=require('lodash');var squel=require(_0x8575('0x8'));var crypto=require(_0x8575('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x8575('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8575('0xb'));var Redis=require(_0x8575('0xc'));var authService=require(_0x8575('0xd'));var qs=require(_0x8575('0xe'));var as=require(_0x8575('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8575('0x10'))(_0x8575('0x11'));var utils=require(_0x8575('0x12'));var config=require(_0x8575('0x13'));var licenseUtil=require(_0x8575('0x14'));var db=require(_0x8575('0x15'))['db'];config[_0x8575('0x16')]=_['defaults'](config[_0x8575('0x16')],{'host':_0x8575('0x17'),'port':0x18eb});var socket=require(_0x8575('0x18'))(new Redis(config['redis']));require(_0x8575('0x19'))[_0x8575('0x1a')](socket);var jayson=require(_0x8575('0x1b'));var client=jayson[_0x8575('0x1c')][_0x8575('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0xc1211b,_0x4096ad,_0x3d2cb5,_0x56ea95){return new BPromise(function(_0x567679,_0x438de0){var _0x3fbebd=_0x56ea95||client;return _0x3fbebd['request'](_0xc1211b,_0x3d2cb5)['then'](function(_0x5c9f57){logger[_0x8575('0x1e')]('WhatsappAccount,\x20%s,\x20%s',_0x4096ad,_0x8575('0x1f'));logger[_0x8575('0x20')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x4096ad,_0x8575('0x1f'),JSON[_0x8575('0x21')](_0x5c9f57));if(_0x5c9f57[_0x8575('0x22')]){if(_0x5c9f57[_0x8575('0x22')][_0x8575('0x23')]===0x1f4){logger['error'](_0x8575('0x24'),_0x4096ad,_0x5c9f57[_0x8575('0x22')][_0x8575('0x25')]);return _0x438de0(_0x5c9f57[_0x8575('0x22')][_0x8575('0x25')]);}logger['error'](_0x8575('0x24'),_0x4096ad,_0x5c9f57[_0x8575('0x22')][_0x8575('0x25')]);return _0x567679(_0x5c9f57['error']['message']);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x4096ad,_0x8575('0x1f'));_0x567679(_0x5c9f57['result'][_0x8575('0x25')]);}})[_0x8575('0x26')](function(_0x5120e7){logger['error'](_0x8575('0x24'),_0x4096ad,_0x5120e7);_0x438de0(_0x5120e7);});});}function respondWithStatusCode(_0x561457,_0x2e7357){_0x2e7357=_0x2e7357||0xcc;return function(_0x26ff06){if(_0x26ff06){return _0x561457[_0x8575('0x27')](_0x2e7357);}return _0x561457[_0x8575('0x28')](_0x2e7357)[_0x8575('0x29')]();};}function respondWithResult(_0x32f3eb,_0x48616c){_0x48616c=_0x48616c||0xc8;return function(_0x584c54){if(_0x584c54){return _0x32f3eb[_0x8575('0x28')](_0x48616c)[_0x8575('0x2a')](_0x584c54);}};}function respondWithFilteredResult(_0x18e238,_0x37f12a){return function(_0x18935d){if(_0x18935d){var _0x1d542e=typeof _0x37f12a[_0x8575('0x2b')]===_0x8575('0x2c')&&typeof _0x37f12a[_0x8575('0x2d')]==='undefined';var _0x3c04a8=_0x18935d[_0x8575('0x2e')];var _0x1a163e=_0x1d542e?0x0:_0x37f12a['offset'];var _0x1a9257=_0x1d542e?_0x18935d[_0x8575('0x2e')]:_0x37f12a[_0x8575('0x2b')]+_0x37f12a[_0x8575('0x2d')];var _0x2f39e0;if(_0x1a9257>=_0x3c04a8){_0x1a9257=_0x3c04a8;_0x2f39e0=0xc8;}else{_0x2f39e0=0xce;}_0x18e238[_0x8575('0x28')](_0x2f39e0);return _0x18e238[_0x8575('0x2f')]('Content-Range',_0x1a163e+'-'+_0x1a9257+'/'+_0x3c04a8)[_0x8575('0x2a')](_0x18935d);}return null;};}function patchUpdates(_0x220ecc){return function(_0x43619c){try{jsonpatch[_0x8575('0x30')](_0x43619c,_0x220ecc,!![]);}catch(_0x201dca){return BPromise[_0x8575('0x31')](_0x201dca);}return _0x43619c['save']();};}function saveUpdates(_0x539a86,_0x34d8f4){return function(_0x1e72ee){if(_0x1e72ee){return _0x1e72ee['update'](_0x539a86)['then'](function(_0x4ef047){return _0x4ef047;});}return null;};}function removeEntity(_0x207ce9,_0xd9f62d){return function(_0x7535bc){if(_0x7535bc){return _0x7535bc[_0x8575('0x32')]()[_0x8575('0x33')](function(){var _0x2f560b=_0x7535bc[_0x8575('0x34')]({'plain':!![]});var _0x364104=_0x8575('0x35');return db['UserProfileResource'][_0x8575('0x32')]({'where':{'type':_0x364104,'resourceId':_0x2f560b['id']}})[_0x8575('0x33')](function(){return _0x7535bc;});})[_0x8575('0x33')](function(){_0x207ce9[_0x8575('0x28')](0xcc)[_0x8575('0x29')]();});}};}function handleEntityNotFound(_0x6d5f07,_0x154a0b){return function(_0x3ca4f9){if(!_0x3ca4f9){_0x6d5f07['sendStatus'](0x194);}return _0x3ca4f9;};}function handleError(_0x2e6643,_0x314583){_0x314583=_0x314583||0x1f4;return function(_0x35ce73){logger[_0x8575('0x22')](_0x35ce73['stack']);if(_0x35ce73['name']){delete _0x35ce73[_0x8575('0x36')];}_0x2e6643[_0x8575('0x28')](_0x314583)[_0x8575('0x37')](_0x35ce73);};}exports[_0x8575('0x38')]=function(_0x7a166c,_0x30c522){var _0x19f275={'include':[{'model':db[_0x8575('0x39')],'as':'mandatoryDispositionPause'}]},_0x58d8ac={},_0x1909d0={'count':0x0,'rows':[]};var _0xaf15b1=_[_0x8575('0x3a')](db[_0x8575('0x3b')][_0x8575('0x3c')],function(_0x17ab23){return{'name':_0x17ab23['fieldName'],'type':_0x17ab23[_0x8575('0x3d')]['key']};});_0x58d8ac[_0x8575('0x3e')]=_['map'](_0xaf15b1,_0x8575('0x36'));_0x58d8ac['query']=_['keys'](_0x7a166c[_0x8575('0x3f')]);_0x58d8ac[_0x8575('0x40')]=_[_0x8575('0x41')](_0x58d8ac['model'],_0x58d8ac[_0x8575('0x3f')]);_0x19f275[_0x8575('0x42')]=_[_0x8575('0x41')](_0x58d8ac['model'],qs[_0x8575('0x43')](_0x7a166c[_0x8575('0x3f')][_0x8575('0x43')]));_0x19f275[_0x8575('0x42')]=_0x19f275[_0x8575('0x42')]['length']?_0x19f275[_0x8575('0x42')]:_0x58d8ac[_0x8575('0x3e')];if(!_0x7a166c['query'][_0x8575('0x44')]('nolimit')){_0x19f275[_0x8575('0x2d')]=qs[_0x8575('0x2d')](_0x7a166c[_0x8575('0x3f')]['limit']);_0x19f275[_0x8575('0x2b')]=qs[_0x8575('0x2b')](_0x7a166c[_0x8575('0x3f')][_0x8575('0x2b')]);}_0x19f275['order']=qs[_0x8575('0x45')](_0x7a166c[_0x8575('0x3f')]['sort']);_0x19f275[_0x8575('0x46')]=qs[_0x8575('0x40')](_[_0x8575('0x47')](_0x7a166c[_0x8575('0x3f')],_0x58d8ac[_0x8575('0x40')]),_0xaf15b1);if(_0x7a166c['query'][_0x8575('0x48')]){_0x19f275[_0x8575('0x46')]=_[_0x8575('0x49')](_0x19f275['where'],{'$or':_[_0x8575('0x3a')](_0xaf15b1,function(_0x4782ca){if(_0x4782ca[_0x8575('0x3d')]!==_0x8575('0x4a')){var _0x167125={};_0x167125[_0x4782ca[_0x8575('0x36')]]={'$like':'%'+_0x7a166c[_0x8575('0x3f')][_0x8575('0x48')]+'%'};return _0x167125;}})});}_0x19f275=_['merge']({},_0x19f275,_0x7a166c[_0x8575('0x4b')]);var _0xb72f8a={'where':_0x19f275[_0x8575('0x46')]};return db['WhatsappAccount'][_0x8575('0x2e')](_0xb72f8a)[_0x8575('0x33')](function(_0x1e1c7f){_0x1909d0[_0x8575('0x2e')]=_0x1e1c7f;if(_0x7a166c['query'][_0x8575('0x4c')]){_0x19f275[_0x8575('0x4d')]=[{'all':!![]}];}return db[_0x8575('0x3b')][_0x8575('0x4e')](_0x19f275);})[_0x8575('0x33')](function(_0x54501b){_0x1909d0[_0x8575('0x4f')]=_0x54501b;return _0x1909d0;})[_0x8575('0x33')](respondWithFilteredResult(_0x30c522,_0x19f275))[_0x8575('0x26')](handleError(_0x30c522,null));};exports[_0x8575('0x50')]=function(_0x1f65b1,_0x4b6082){var _0x5debd3={'raw':![],'where':{'id':_0x1f65b1[_0x8575('0x51')]['id']},'include':[{'model':db[_0x8575('0x39')],'as':'mandatoryDispositionPause'}]},_0x16bbd8={};_0x16bbd8['model']=_['keys'](db['WhatsappAccount'][_0x8575('0x3c')]);_0x16bbd8[_0x8575('0x3f')]=_[_0x8575('0x52')](_0x1f65b1[_0x8575('0x3f')]);_0x16bbd8[_0x8575('0x40')]=_[_0x8575('0x41')](_0x16bbd8[_0x8575('0x3e')],_0x16bbd8[_0x8575('0x3f')]);_0x5debd3['attributes']=_[_0x8575('0x41')](_0x16bbd8['model'],qs[_0x8575('0x43')](_0x1f65b1[_0x8575('0x3f')]['fields']));_0x5debd3[_0x8575('0x42')]=_0x5debd3[_0x8575('0x42')][_0x8575('0x53')]?_0x5debd3[_0x8575('0x42')]:_0x16bbd8[_0x8575('0x3e')];if(_0x1f65b1[_0x8575('0x3f')]['includeAll']){_0x5debd3[_0x8575('0x4d')]=[{'all':!![]}];}_0x5debd3=_[_0x8575('0x49')]({},_0x5debd3,_0x1f65b1[_0x8575('0x4b')]);return db[_0x8575('0x3b')][_0x8575('0x54')](_0x5debd3)['then'](handleEntityNotFound(_0x4b6082,null))[_0x8575('0x33')](respondWithResult(_0x4b6082,null))[_0x8575('0x26')](handleError(_0x4b6082,null));};exports[_0x8575('0x55')]=function(_0xae9954,_0x2a2d8d){return db[_0x8575('0x3b')][_0x8575('0x55')](_0xae9954[_0x8575('0x56')],{})[_0x8575('0x33')](function(_0x1e41c2){var _0x5a52c6=_0xae9954['user'][_0x8575('0x34')]({'plain':!![]});if(!_0x5a52c6)throw new Error(_0x8575('0x57'));if(_0x5a52c6[_0x8575('0x58')]===_0x8575('0x59')){var _0x4aa604=_0x1e41c2['get']({'plain':!![]});var _0x3534d1='WhatsappAccounts';return db['UserProfileSection'][_0x8575('0x54')]({'where':{'name':_0x3534d1,'userProfileId':_0x5a52c6['userProfileId']},'raw':!![]})[_0x8575('0x33')](function(_0x8d9dfa){if(_0x8d9dfa&&_0x8d9dfa['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x4aa604[_0x8575('0x36')],'resourceId':_0x4aa604['id'],'type':_0x8d9dfa[_0x8575('0x36')],'sectionId':_0x8d9dfa['id']},{})[_0x8575('0x33')](function(){return _0x1e41c2;});}else{return _0x1e41c2;}})[_0x8575('0x26')](function(_0x51d9d3){logger[_0x8575('0x22')](_0x8575('0x5a'),_0x51d9d3);throw _0x51d9d3;});}return _0x1e41c2;})[_0x8575('0x33')](respondWithResult(_0x2a2d8d,0xc9))['catch'](handleError(_0x2a2d8d,null));};exports['update']=function(_0x10feb7,_0x47049f){if(_0x10feb7['body']['id']){delete _0x10feb7['body']['id'];}return db[_0x8575('0x3b')][_0x8575('0x54')]({'where':{'id':_0x10feb7[_0x8575('0x51')]['id']},'include':[{'model':db[_0x8575('0x39')],'as':_0x8575('0x5b')}]})[_0x8575('0x33')](handleEntityNotFound(_0x47049f,null))[_0x8575('0x33')](saveUpdates(_0x10feb7[_0x8575('0x56')],null))[_0x8575('0x33')](respondWithResult(_0x47049f,null))[_0x8575('0x26')](handleError(_0x47049f,null));};exports[_0x8575('0x32')]=function(_0x536120,_0xd89189){return db[_0x8575('0x3b')]['find']({'where':{'id':_0x536120[_0x8575('0x51')]['id']}})['then'](handleEntityNotFound(_0xd89189,null))[_0x8575('0x33')](removeEntity(_0xd89189,null))[_0x8575('0x26')](handleError(_0xd89189,null));};exports[_0x8575('0x5c')]=function(_0x62a863,_0x4a20a0){return db['WhatsappAccount']['describe']()['then'](respondWithResult(_0x4a20a0,null))[_0x8575('0x26')](handleError(_0x4a20a0,null));};exports[_0x8575('0x5d')]=function(_0xfbbfeb,_0x54affc,_0x14c496){if(_0xfbbfeb[_0x8575('0x56')]['id']){delete _0xfbbfeb[_0x8575('0x56')]['id'];}return db[_0x8575('0x3b')]['find']({'where':{'id':_0xfbbfeb[_0x8575('0x51')]['id']}})[_0x8575('0x33')](handleEntityNotFound(_0x54affc,null))[_0x8575('0x33')](function(_0x44d032){if(_0x44d032){_0xfbbfeb[_0x8575('0x56')][_0x8575('0x5e')]=_0x44d032['id'];return db[_0x8575('0x5f')][_0x8575('0x55')](_0xfbbfeb[_0x8575('0x56')]);}})[_0x8575('0x33')](respondWithResult(_0x54affc,null))[_0x8575('0x26')](handleError(_0x54affc,null));};exports[_0x8575('0x60')]=function(_0x2f6166,_0x3b00dd,_0x14effb){var _0x28da69={'raw':![],'where':{}};var _0x46bde8={};var _0x52b7d4={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x8575('0x61')]({'where':{'id':_0x2f6166['params']['id']}})['then'](handleEntityNotFound(_0x3b00dd,null))[_0x8575('0x33')](function(_0x4ad28e){if(_0x4ad28e){_0x46bde8[_0x8575('0x3e')]=_['keys'](db[_0x8575('0x5f')]['rawAttributes']);_0x46bde8[_0x8575('0x3f')]=_[_0x8575('0x52')](_0x2f6166[_0x8575('0x3f')]);_0x46bde8[_0x8575('0x40')]=_[_0x8575('0x41')](_0x46bde8[_0x8575('0x3e')],_0x46bde8[_0x8575('0x3f')]);_0x28da69[_0x8575('0x42')]=_['intersection'](_0x46bde8[_0x8575('0x3e')],qs['fields'](_0x2f6166[_0x8575('0x3f')]['fields']));_0x28da69['attributes']=_0x28da69[_0x8575('0x42')][_0x8575('0x53')]?_0x28da69[_0x8575('0x42')]:_0x46bde8[_0x8575('0x3e')];if(!_0x2f6166['query'][_0x8575('0x44')](_0x8575('0x62'))){_0x28da69['limit']=qs[_0x8575('0x2d')](_0x2f6166[_0x8575('0x3f')][_0x8575('0x2d')]);_0x28da69[_0x8575('0x2b')]=qs[_0x8575('0x2b')](_0x2f6166[_0x8575('0x3f')][_0x8575('0x2b')]);}_0x28da69[_0x8575('0x63')]=qs[_0x8575('0x45')](_0x2f6166[_0x8575('0x3f')]['sort']);_0x28da69[_0x8575('0x46')]=qs['filters'](_[_0x8575('0x47')](_0x2f6166[_0x8575('0x3f')],_0x46bde8[_0x8575('0x40')]));_0x28da69[_0x8575('0x46')]['WhatsappAccountId']=_0x4ad28e['id'];if(_0x2f6166['query'][_0x8575('0x48')]){_0x28da69[_0x8575('0x46')]=_[_0x8575('0x49')](_0x28da69['where'],{'$or':_['map'](_0x28da69[_0x8575('0x42')],function(_0x520dee){var _0x349e79={};_0x349e79[_0x520dee]={'$like':'%'+_0x2f6166['query'][_0x8575('0x48')]+'%'};return _0x349e79;})});}_0x28da69=_[_0x8575('0x49')]({},_0x28da69,_0x2f6166['options']);return db[_0x8575('0x5f')][_0x8575('0x2e')]({'where':_0x28da69['where']})['then'](function(_0x330d5e){_0x52b7d4[_0x8575('0x2e')]=_0x330d5e;if(_0x2f6166['query'][_0x8575('0x4c')]){_0x28da69[_0x8575('0x4d')]=[{'all':!![]}];}return db['Disposition'][_0x8575('0x4e')](_0x28da69);})['then'](function(_0x35c29f){_0x52b7d4[_0x8575('0x4f')]=_0x35c29f;return _0x52b7d4;});}})[_0x8575('0x33')](respondWithFilteredResult(_0x3b00dd,_0x28da69))['catch'](handleError(_0x3b00dd,null));};exports[_0x8575('0x64')]=function(_0x490319,_0x41d817,_0x2719fb){return db[_0x8575('0x3b')][_0x8575('0x54')]({'where':{'id':_0x490319[_0x8575('0x51')]['id']}})[_0x8575('0x33')](handleEntityNotFound(_0x41d817,null))['then'](function(_0x599cbd){if(_0x599cbd){return _0x599cbd['removeDispositions'](_0x490319['query']['ids']);}})[_0x8575('0x33')](respondWithStatusCode(_0x41d817,null))[_0x8575('0x26')](handleError(_0x41d817,null));};exports[_0x8575('0x65')]=function(_0x3ff259,_0x475cc6,_0xe5472d){if(_0x3ff259[_0x8575('0x56')]['id']){delete _0x3ff259['body']['id'];}return db[_0x8575('0x3b')][_0x8575('0x54')]({'where':{'id':_0x3ff259['params']['id']}})[_0x8575('0x33')](handleEntityNotFound(_0x475cc6,null))[_0x8575('0x33')](function(_0x2e5f50){if(_0x2e5f50){_0x3ff259[_0x8575('0x56')][_0x8575('0x5e')]=_0x2e5f50['id'];return db[_0x8575('0x66')]['create'](_0x3ff259[_0x8575('0x56')]);}})['then'](respondWithResult(_0x475cc6,null))['catch'](handleError(_0x475cc6,null));};exports['getAnswers']=function(_0x3d8dc5,_0xd98956,_0x1cf371){var _0x229c97={'raw':![],'where':{}};var _0x596445={};var _0x314ee1={'count':0x0,'rows':[]};return db[_0x8575('0x3b')][_0x8575('0x61')]({'where':{'id':_0x3d8dc5[_0x8575('0x51')]['id']}})[_0x8575('0x33')](handleEntityNotFound(_0xd98956,null))[_0x8575('0x33')](function(_0x15999d){if(_0x15999d){_0x596445[_0x8575('0x3e')]=_['keys'](db[_0x8575('0x66')][_0x8575('0x3c')]);_0x596445[_0x8575('0x3f')]=_[_0x8575('0x52')](_0x3d8dc5[_0x8575('0x3f')]);_0x596445[_0x8575('0x40')]=_[_0x8575('0x41')](_0x596445['model'],_0x596445[_0x8575('0x3f')]);_0x229c97[_0x8575('0x42')]=_[_0x8575('0x41')](_0x596445[_0x8575('0x3e')],qs['fields'](_0x3d8dc5[_0x8575('0x3f')][_0x8575('0x43')]));_0x229c97['attributes']=_0x229c97[_0x8575('0x42')][_0x8575('0x53')]?_0x229c97['attributes']:_0x596445[_0x8575('0x3e')];if(!_0x3d8dc5['query']['hasOwnProperty'](_0x8575('0x62'))){_0x229c97[_0x8575('0x2d')]=qs[_0x8575('0x2d')](_0x3d8dc5[_0x8575('0x3f')][_0x8575('0x2d')]);_0x229c97[_0x8575('0x2b')]=qs[_0x8575('0x2b')](_0x3d8dc5['query'][_0x8575('0x2b')]);}_0x229c97[_0x8575('0x63')]=qs[_0x8575('0x45')](_0x3d8dc5[_0x8575('0x3f')][_0x8575('0x45')]);_0x229c97[_0x8575('0x46')]=qs['filters'](_[_0x8575('0x47')](_0x3d8dc5[_0x8575('0x3f')],_0x596445['filters']));_0x229c97[_0x8575('0x46')][_0x8575('0x5e')]=_0x15999d['id'];if(_0x3d8dc5['query'][_0x8575('0x48')]){_0x229c97[_0x8575('0x46')]=_[_0x8575('0x49')](_0x229c97['where'],{'$or':_['map'](_0x229c97[_0x8575('0x42')],function(_0x31e76e){var _0x26170e={};_0x26170e[_0x31e76e]={'$like':'%'+_0x3d8dc5[_0x8575('0x3f')][_0x8575('0x48')]+'%'};return _0x26170e;})});}_0x229c97=_['merge']({},_0x229c97,_0x3d8dc5[_0x8575('0x4b')]);return db[_0x8575('0x66')]['count']({'where':_0x229c97[_0x8575('0x46')]})[_0x8575('0x33')](function(_0x4bfcf2){_0x314ee1[_0x8575('0x2e')]=_0x4bfcf2;if(_0x3d8dc5[_0x8575('0x3f')][_0x8575('0x4c')]){_0x229c97['include']=[{'all':!![]}];}return db[_0x8575('0x66')][_0x8575('0x4e')](_0x229c97);})[_0x8575('0x33')](function(_0x22f6c3){_0x314ee1['rows']=_0x22f6c3;return _0x314ee1;});}})[_0x8575('0x33')](respondWithFilteredResult(_0xd98956,_0x229c97))['catch'](handleError(_0xd98956,null));};exports['removeAnswers']=function(_0x82b015,_0x19a8a4,_0x111aa){return db['WhatsappAccount'][_0x8575('0x54')]({'where':{'id':_0x82b015['params']['id']}})[_0x8575('0x33')](handleEntityNotFound(_0x19a8a4,null))['then'](function(_0x52191f){if(_0x52191f){return _0x52191f[_0x8575('0x67')](_0x82b015['query'][_0x8575('0x68')]);}})['then'](respondWithStatusCode(_0x19a8a4,null))[_0x8575('0x26')](handleError(_0x19a8a4,null));};exports[_0x8575('0x69')]=function(_0x4b3229,_0xb5a3db,_0x127845){return db[_0x8575('0x3b')]['find']({'where':{'id':_0x4b3229[_0x8575('0x51')]['id']}})[_0x8575('0x33')](handleEntityNotFound(_0xb5a3db,null))['then'](function(_0x33d4f6){if(_0x33d4f6){return _0x33d4f6[_0x8575('0x69')](_0x4b3229[_0x8575('0x56')][_0x8575('0x68')],_['omit'](_0x4b3229[_0x8575('0x56')],[_0x8575('0x68'),'id'])||{})['spread'](function(_0x4c3335){for(var _0x12cb02=0x0;_0x12cb02<_0x4b3229['body']['ids'][_0x8575('0x53')];_0x12cb02+=0x1){socket[_0x8575('0x6a')](_0x8575('0x6b'),{'UserId':Number(_0x4b3229['body'][_0x8575('0x68')][_0x12cb02]),'WhatsappAccountId':Number(_0x4b3229['params']['id'])});}return _0x4c3335;});}})[_0x8575('0x33')](respondWithResult(_0xb5a3db,null))['catch'](handleError(_0xb5a3db,null));};exports['removeAgents']=function(_0x4722e0,_0x31bef6,_0x1c272b){return db[_0x8575('0x3b')][_0x8575('0x54')]({'where':{'id':_0x4722e0[_0x8575('0x51')]['id']}})['then'](handleEntityNotFound(_0x31bef6,null))[_0x8575('0x33')](function(_0x1ba89f){if(_0x1ba89f){return _0x1ba89f[_0x8575('0x6c')](_0x4722e0[_0x8575('0x3f')][_0x8575('0x68')])[_0x8575('0x33')](function(){if(_[_0x8575('0x6d')](_0x4722e0[_0x8575('0x3f')]['ids'])){for(var _0x1a66a5=0x0;_0x1a66a5<_0x4722e0[_0x8575('0x3f')]['ids']['length'];_0x1a66a5+=0x1){socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x4722e0['query'][_0x8575('0x68')][_0x1a66a5]),'WhatsappAccountId':Number(_0x4722e0[_0x8575('0x51')]['id'])});}}else{socket[_0x8575('0x6a')](_0x8575('0x6e'),{'UserId':Number(_0x4722e0[_0x8575('0x3f')][_0x8575('0x68')]),'WhatsappAccountId':Number(_0x4722e0[_0x8575('0x51')]['id'])});}});}})[_0x8575('0x33')](respondWithStatusCode(_0x31bef6,null))['catch'](handleError(_0x31bef6,null));};exports[_0x8575('0x6f')]=function(_0x1dbfcc,_0x1f6c35,_0x1dce5a){var _0x5c71d1={};var _0x1969a6={};var _0x35e71c;var _0x4815d8;return db[_0x8575('0x3b')][_0x8575('0x61')]({'where':{'id':_0x1dbfcc[_0x8575('0x51')]['id']}})[_0x8575('0x33')](handleEntityNotFound(_0x1f6c35,null))[_0x8575('0x33')](function(_0x43c4b6){if(_0x43c4b6){_0x35e71c=_0x43c4b6;_0x1969a6[_0x8575('0x3e')]=_['keys'](db[_0x8575('0x70')][_0x8575('0x3c')]);_0x1969a6[_0x8575('0x3f')]=_[_0x8575('0x52')](_0x1dbfcc[_0x8575('0x3f')]);_0x1969a6[_0x8575('0x40')]=_['intersection'](_0x1969a6['model'],_0x1969a6[_0x8575('0x3f')]);_0x5c71d1['attributes']=_[_0x8575('0x41')](_0x1969a6[_0x8575('0x3e')],qs['fields'](_0x1dbfcc[_0x8575('0x3f')][_0x8575('0x43')]));_0x5c71d1[_0x8575('0x42')]=_0x5c71d1[_0x8575('0x42')][_0x8575('0x53')]?_0x5c71d1['attributes']:_0x1969a6[_0x8575('0x3e')];_0x5c71d1[_0x8575('0x63')]=qs[_0x8575('0x45')](_0x1dbfcc['query'][_0x8575('0x45')]);_0x5c71d1['where']=qs[_0x8575('0x40')](_[_0x8575('0x47')](_0x1dbfcc[_0x8575('0x3f')],_0x1969a6[_0x8575('0x40')]));if(_0x1dbfcc['query'][_0x8575('0x48')]){_0x5c71d1[_0x8575('0x46')]=_['merge'](_0x5c71d1[_0x8575('0x46')],{'$or':_[_0x8575('0x3a')](_0x5c71d1[_0x8575('0x42')],function(_0x5b7a88){var _0x18577d={};_0x18577d[_0x5b7a88]={'$like':'%'+_0x1dbfcc[_0x8575('0x3f')][_0x8575('0x48')]+'%'};return _0x18577d;})});}_0x5c71d1=_['merge']({},_0x5c71d1,_0x1dbfcc[_0x8575('0x4b')]);return _0x35e71c['getAgents'](_0x5c71d1);}})[_0x8575('0x33')](function(_0x57487a){if(_0x57487a){_0x4815d8=_0x57487a[_0x8575('0x53')];if(!_0x1dbfcc['query'][_0x8575('0x44')](_0x8575('0x62'))){_0x5c71d1[_0x8575('0x2d')]=qs[_0x8575('0x2d')](_0x1dbfcc['query'][_0x8575('0x2d')]);_0x5c71d1[_0x8575('0x2b')]=qs['offset'](_0x1dbfcc[_0x8575('0x3f')]['offset']);}return _0x35e71c[_0x8575('0x6f')](_0x5c71d1);}})[_0x8575('0x33')](function(_0x5262e3){if(_0x5262e3){return _0x5262e3?{'count':_0x4815d8,'rows':_0x5262e3}:null;}})['then'](respondWithResult(_0x1f6c35,null))[_0x8575('0x26')](handleError(_0x1f6c35,null));};exports[_0x8575('0x71')]=function(_0x207624,_0x659f86){var _0x207a01=_0x207624[_0x8575('0x51')]['id'];var _0x307847=_0x207624['body'];var _0x95bb03=0xc8;var _0x2c148f=null;return db[_0x8575('0x72')][_0x8575('0x73')]({'isolationLevel':db[_0x8575('0x72')][_0x8575('0x74')][_0x8575('0x75')]['READ_COMMITTED']},function(_0x774fab){return db['WhatsappAccount'][_0x8575('0x61')]({'where':{'id':_0x207a01},'transaction':_0x774fab})[_0x8575('0x33')](function(_0x5e65aa){if(_0x5e65aa){return db[_0x8575('0x76')][_0x8575('0x32')]({'where':{'WhatsappAccountId':_0x207a01},'transaction':_0x774fab})['then'](function(){var _0x47635b=_[_0x8575('0x3a')](_0x307847,function(_0x25b472){_0x25b472['WhatsappAccountId']=_0x207a01;return _0x25b472;});return db[_0x8575('0x76')][_0x8575('0x77')](_0x47635b,{'transaction':_0x774fab});});}else{_0x95bb03=0x194;_0x2c148f=[];}});})['then'](function(){if(_0x95bb03!==0x194){return db[_0x8575('0x76')][_0x8575('0x78')]({'where':{'WhatsappAccountId':_0x207a01},'order':'priority'})[_0x8575('0x33')](function(_0x217ff9){_0x2c148f=_0x217ff9;});}})[_0x8575('0x26')](function(_0x58797d){_0x95bb03=0x1f4;logger[_0x8575('0x22')](_0x58797d['stack']);if(_0x58797d[_0x8575('0x36')]){delete _0x58797d[_0x8575('0x36')];}_0x2c148f=_0x58797d;})[_0x8575('0x79')](function(){if(_0x2c148f===null){_0x659f86[_0x8575('0x27')](_0x95bb03);}else{if(_0x95bb03===0x1f4){_0x659f86[_0x8575('0x28')](_0x95bb03)['send'](_0x2c148f);}else{_0x659f86[_0x8575('0x28')](_0x95bb03)[_0x8575('0x2a')](_0x2c148f);}}});};exports[_0x8575('0x7a')]=function(_0x3caa66,_0x2dbb07,_0x322add){var _0x56523b={};var _0x474446={};var _0x228218;var _0xd9aecb;return db[_0x8575('0x3b')][_0x8575('0x61')]({'where':{'id':_0x3caa66[_0x8575('0x51')]['id']}})['then'](handleEntityNotFound(_0x2dbb07,null))[_0x8575('0x33')](function(_0x57ba4a){if(_0x57ba4a){_0x228218=_0x57ba4a;_0x474446[_0x8575('0x3e')]=_['keys'](db['WhatsappApplication'][_0x8575('0x3c')]);_0x474446[_0x8575('0x3f')]=_[_0x8575('0x52')](_0x3caa66[_0x8575('0x3f')]);_0x474446[_0x8575('0x40')]=_[_0x8575('0x41')](_0x474446[_0x8575('0x3e')],_0x474446[_0x8575('0x3f')]);_0x56523b[_0x8575('0x42')]=_[_0x8575('0x41')](_0x474446[_0x8575('0x3e')],qs[_0x8575('0x43')](_0x3caa66[_0x8575('0x3f')][_0x8575('0x43')]));_0x56523b['attributes']=_0x56523b[_0x8575('0x42')][_0x8575('0x53')]?_0x56523b[_0x8575('0x42')]:_0x474446[_0x8575('0x3e')];_0x56523b[_0x8575('0x63')]=qs['sort'](_0x3caa66[_0x8575('0x3f')]['sort']);_0x56523b[_0x8575('0x46')]=qs[_0x8575('0x40')](_[_0x8575('0x47')](_0x3caa66[_0x8575('0x3f')],_0x474446[_0x8575('0x40')]));if(_0x3caa66[_0x8575('0x3f')][_0x8575('0x48')]){_0x56523b['where']=_['merge'](_0x56523b[_0x8575('0x46')],{'$or':_[_0x8575('0x3a')](_0x56523b[_0x8575('0x42')],function(_0x2ee4b6){var _0x39bc50={};_0x39bc50[_0x2ee4b6]={'$like':'%'+_0x3caa66[_0x8575('0x3f')][_0x8575('0x48')]+'%'};return _0x39bc50;})});}_0x56523b=_[_0x8575('0x49')]({},_0x56523b,_0x3caa66[_0x8575('0x4b')]);return _0x228218['getApplications'](_0x56523b);}})[_0x8575('0x33')](function(_0x237f3f){if(_0x237f3f){_0xd9aecb=_0x237f3f[_0x8575('0x53')];if(!_0x3caa66[_0x8575('0x3f')]['hasOwnProperty'](_0x8575('0x62'))){_0x56523b['limit']=qs[_0x8575('0x2d')](_0x3caa66[_0x8575('0x3f')][_0x8575('0x2d')]);_0x56523b[_0x8575('0x2b')]=qs['offset'](_0x3caa66[_0x8575('0x3f')][_0x8575('0x2b')]);}return _0x228218[_0x8575('0x7a')](_0x56523b);}})[_0x8575('0x33')](function(_0x136aa9){if(_0x136aa9){return _0x136aa9?{'count':_0xd9aecb,'rows':_0x136aa9}:null;}})[_0x8575('0x33')](respondWithResult(_0x2dbb07,null))[_0x8575('0x26')](handleError(_0x2dbb07,null));};exports[_0x8575('0x7b')]=function(_0x14efa0,_0x4882fb,_0x5dbf36){var _0x342b6f={'channel':_0x8575('0x7c')};var _0xad4707=[];var _0xbfe0a2=[];var _0x47380e={};return db[_0x8575('0x3b')]['find']({'where':{'id':_0x14efa0['params']['id']},'include':[{'model':db[_0x8575('0x76')],'as':'Applications'}]})[_0x8575('0x33')](handleEntityNotFound(_0x4882fb,null))[_0x8575('0x33')](function(_0x5c7d0b){_0x342b6f[_0x8575('0x7d')]=_0x5c7d0b;if(_0x342b6f[_0x8575('0x7d')]&&_0x342b6f[_0x8575('0x7d')][_0x8575('0x3d')]===_0x8575('0x7e')&&_0x14efa0[_0x8575('0x56')][_0x8575('0x7f')]){if(_0x14efa0[_0x8575('0x56')][_0x8575('0x7f')]['length']===0x0)return;if(_0x14efa0[_0x8575('0x56')][_0x8575('0x7f')][0x0]['state']!==_0x8575('0x80'))return;return db['WhatsappMessage']['update']({'read':!![],'readAt':_0x14efa0['body'][_0x8575('0x7f')][0x0][_0x8575('0x81')]},{'where':{'messageId':_0x14efa0[_0x8575('0x56')][_0x8575('0x7f')][0x0][_0x8575('0x82')]},'individualHooks':!![]})[_0x8575('0x33')](function(_0x21d431){return _0x4882fb['status'](0xc8)['json'](_0x21d431);});}_0x342b6f[_0x8575('0x83')]=_['orderBy'](_0x5c7d0b['Applications'],[_0x8575('0x84')],['asc']);if(_0x342b6f['account']['Applications']){delete _0x342b6f[_0x8575('0x7d')]['Applications'];}return db[_0x8575('0x85')][_0x8575('0x5c')]()['then'](function(_0x285b0f){if(!_0x285b0f){throw new db[(_0x8575('0x86'))][(_0x8575('0x87'))](_0x8575('0x88'));}_0xad4707=_[_0x8575('0x89')](_[_0x8575('0x52')](_0x285b0f),['createdAt',_0x8575('0x8a')]);_0xbfe0a2=_['difference'](_[_0x8575('0x52')](_0x285b0f),[_0x8575('0x8b'),_0x8575('0x8a'),_0x8575('0x8c'),_0x8575('0x8d')]);_0x342b6f[_0x8575('0x56')]={'mapKey':_0x8575('0x8e')};if(_0x342b6f[_0x8575('0x7d')]&&_0x342b6f['account'][_0x8575('0x3d')]==='twilio'){_0x342b6f[_0x8575('0x56')][_0x8575('0x8f')]=_0x14efa0[_0x8575('0x56')][_0x8575('0x90')][_0x8575('0x91')](_0x8575('0x92'),'');_0x342b6f[_0x8575('0x56')][_0x8575('0x56')]=_0x14efa0[_0x8575('0x56')][_0x8575('0x93')];_0x342b6f['body']['messageId']=_0x14efa0['body'][_0x8575('0x94')];}if(_0x342b6f[_0x8575('0x7d')]&&_0x342b6f['account'][_0x8575('0x3d')]===_0x8575('0x7e')){_0x342b6f['body'][_0x8575('0x8f')]=_0x14efa0[_0x8575('0x56')]['notifications'][0x0][_0x8575('0x8f')];_0x342b6f[_0x8575('0x56')][_0x8575('0x56')]=_0x14efa0['body']['notifications'][0x0][_0x8575('0x25')][_0x8575('0x56')];_0x342b6f[_0x8575('0x56')]['messageId']=_0x14efa0[_0x8575('0x56')][_0x8575('0x95')][0x0][_0x8575('0x82')];}if(_0x342b6f[_0x8575('0x56')]['id']){delete _0x342b6f[_0x8575('0x56')]['id'];}if(_[_0x8575('0x96')](_0x342b6f['body']['from'])){throw new db['Sequelize']['ValidationError']('from\x20is\x20mandatory');}if(_[_0x8575('0x96')](_0x342b6f['body'][_0x8575('0x56')])||_0x342b6f[_0x8575('0x56')][_0x8575('0x56')]===''){throw new db[(_0x8575('0x86'))][(_0x8575('0x87'))](_0x8575('0x97'));}if(_[_0x8575('0x96')](_0x342b6f[_0x8575('0x56')]['mapKey'])){throw new db[(_0x8575('0x86'))][(_0x8575('0x87'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xbfe0a2);}if(!_['includes'](_0xbfe0a2,_0x342b6f[_0x8575('0x56')]['mapKey'])){throw new db[(_0x8575('0x86'))]['ValidationError'](_0x8575('0x98')+_0xbfe0a2);}_0x47380e[_0x342b6f[_0x8575('0x56')][_0x8575('0x99')]]=_0x342b6f['body'][_0x8575('0x8f')];return db[_0x8575('0x9a')][_0x8575('0x54')]({'where':{'id':_0x342b6f['account']['ListId']},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x47380e,'limit':0x1,'order':[[_0x8575('0x8a'),_0x8575('0x9b')]]}]});})[_0x8575('0x33')](handleEntityNotFound(_0x4882fb,null))[_0x8575('0x33')](function(_0x52d02a){if(_0x52d02a){_0x342b6f[_0x8575('0x9c')]=_[_0x8575('0x9d')](_0x52d02a,[_0x8575('0x9e')]);if(_0x52d02a[_0x8575('0x9e')][_0x8575('0x53')]){return _0x52d02a[_0x8575('0x9e')][0x0];}var _0x11023f=_[_0x8575('0x9f')](_0x342b6f[_0x8575('0x56')],{'firstName':_0x342b6f[_0x8575('0x56')][_0x8575('0x8f')],'ListId':_0x52d02a['id']});_0x11023f[_0x342b6f[_0x8575('0x56')]['mapKey']]=_0x342b6f['body'][_0x8575('0x8f')];return db[_0x8575('0x85')][_0x8575('0x55')](_0x11023f,{'fields':_0xad4707,'raw':!![]});}})[_0x8575('0x33')](handleEntityNotFound(_0x4882fb,null))['then'](function(_0x5f269d){if(_0x5f269d){_0x342b6f[_0x8575('0xa0')]=_0x5f269d;var _0x27abc5={'ContactId':_0x5f269d['id'],'phone':_0x342b6f['body']['from'],'WhatsappAccountId':_0x14efa0['params']['id']};var _0x43c715={'ContactId':_0x5f269d['id'],'WhatsappAccountId':_0x14efa0['params']['id'],'closed':![]};return db['WhatsappInteraction'][_0x8575('0x54')]({'where':_0x43c715})[_0x8575('0x33')](function(_0x8c720f){if(_0x8c720f){return[_0x8c720f,![]];}return db[_0x8575('0xa1')][_0x8575('0x55')](_0x27abc5)[_0x8575('0x33')](function(_0x2c5a10){return[_0x2c5a10,!![]];});});}})[_0x8575('0xa2')](function(_0x201c55,_0x2c1afd){_0x342b6f[_0x8575('0xa3')]=_0x201c55[_0x8575('0x34')]({'plain':!![]});_0x342b6f[_0x8575('0xa3')]['created']=![];if(_0x2c1afd){if(_0x342b6f[_0x8575('0x7d')][_0x8575('0xa4')]){_0x342b6f[_0x8575('0x83')][_0x8575('0xa5')]({'id':0x0,'priority':_0x342b6f[_0x8575('0x83')][_0x8575('0x53')]+0x1,'app':_0x8575('0xa6'),'appdata':'unmanaged','interval':_0x8575('0xa7')});}_0x342b6f[_0x8575('0xa3')]['created']=!![];}return db[_0x8575('0xa8')][_0x8575('0x55')]({'phone':_0x342b6f[_0x8575('0x56')][_0x8575('0x8f')],'messageId':_0x342b6f[_0x8575('0x56')][_0x8575('0xa9')],'body':_0x342b6f[_0x8575('0x56')][_0x8575('0x56')],'WhatsappAccountId':_0x14efa0[_0x8575('0x51')]['id'],'WhatsappInteractionId':_0x201c55['id'],'direction':'in','ContactId':_0x201c55[_0x8575('0xaa')],'AttachmentId':_0x342b6f[_0x8575('0x56')][_0x8575('0xab')]});})[_0x8575('0x33')](function(_0x56be8d){_0x342b6f['message']=_0x56be8d;if(!_0x342b6f['interaction'][_0x8575('0xac')])return;return db[_0x8575('0x70')]['find']({'attributes':['id',_0x8575('0x36')],'where':{'id':_0x342b6f['interaction'][_0x8575('0xac')]}});})[_0x8575('0x33')](function(_0x56f7d7){if(_0x56f7d7){_0x342b6f[_0x8575('0x83')][_0x8575('0xad')]({'id':0x0,'priority':0x0,'app':_0x8575('0xae'),'appdata':_0x56f7d7['name']+','+(_0x342b6f[_0x8575('0x7d')][_0x8575('0xaf')]||0xa),'interval':'*,*,*,*'});}if(!_0x342b6f[_0x8575('0xa3')][_0x8575('0xb0')])return;return db[_0x8575('0xb1')]['find']({'attributes':['id',_0x8575('0x36')],'where':{'id':_0x342b6f['interaction'][_0x8575('0xb0')]}});})['then'](function(_0xc14af9){if(_0xc14af9){_0x342b6f[_0x8575('0x83')][_0x8575('0xad')]({'id':0x0,'priority':0x1,'app':_0x8575('0xb2'),'appdata':_0xc14af9[_0x8575('0x36')]+','+(_0x342b6f[_0x8575('0x7d')]['waitForTheAssignedQueue']||0x12c),'interval':_0x8575('0xa7')});}return respondWithRpcPromise(_0x8575('0xb3'),_0x8575('0xb4'),_0x342b6f);})[_0x8575('0x33')](function(_0x5d9c00){if(_0x5d9c00){var _0x45b3ed=0xc8;var _0xd8cc17=_0x8575('0xb5');logger[_0x8575('0x1e')](_0x8575('0xb6'),_0xd8cc17,_0x45b3ed,_0x8575('0xb7'));logger[_0x8575('0x20')](_0x8575('0xb8'),_0xd8cc17,_0x45b3ed,_0x8575('0xb7'),JSON['stringify'](_0x5d9c00));if(_0x342b6f[_0x8575('0x7d')]['type']===_0x8575('0xb9')){return _0x4882fb['status'](_0x45b3ed)[_0x8575('0x2f')]('Content-Type',_0x8575('0xba'))[_0x8575('0x37')](_0x8575('0xbb'));}else{return _0x4882fb['status'](_0x45b3ed)[_0x8575('0x2a')](_0x5d9c00);}}});})[_0x8575('0x26')](handleError(_0x4882fb,null));};exports[_0x8575('0x37')]=function(_0x41a623,_0x31b521,_0x107acd){var _0x12e701,_0xa1d728,_0x353836;if(_[_0x8575('0x96')](_0x41a623[_0x8575('0x56')][_0x8575('0x56')])||_0x41a623['body'][_0x8575('0x56')]===''){throw new db['Sequelize'][(_0x8575('0x87'))](_0x8575('0x97'));}if(_[_0x8575('0x96')](_0x41a623[_0x8575('0x56')]['to'])){throw new db['Sequelize'][(_0x8575('0x87'))]('to\x20is\x20mandatory');}_0x12e701=_0x41a623[_0x8575('0x56')]['to'];return db[_0x8575('0x3b')]['find']({'where':{'id':_0x41a623['params']['id']},'include':[{'model':db[_0x8575('0x9a')],'as':'List','include':[{'model':db[_0x8575('0x85')],'as':_0x8575('0x9e'),'where':{'mobile':_0x12e701},'limit':0x1,'order':[['updatedAt',_0x8575('0x9b')]]}]}]})[_0x8575('0x33')](handleEntityNotFound(_0x31b521,null))['then'](function(_0x289978){if(_0x289978&&_0x289978['List']){_0xa1d728=_0x289978[_0x8575('0x34')]({'plain':!![]});if(_0xa1d728[_0x8575('0xbc')]&&_0xa1d728[_0x8575('0xbc')][_0x8575('0x9e')]['length']){return _0xa1d728[_0x8575('0xbc')][_0x8575('0x9e')][0x0];}return db['CmContact'][_0x8575('0x55')](_['defaults'](_0x41a623[_0x8575('0x56')],{'firstName':_0x12e701,'mobile':_0x12e701,'phone':_0x12e701,'ListId':_0xa1d728[_0x8575('0x8d')]}));}})[_0x8575('0x33')](handleEntityNotFound(_0x31b521,null))[_0x8575('0x33')](function(_0x5e5d95){if(_0x5e5d95){_0x353836=_0x5e5d95;return db['WhatsappInteraction'][_0x8575('0x54')]({'where':{'ContactId':_0x353836['id'],'closed':![],'WhatsappAccountId':_0xa1d728['id']}})['then'](function(_0xf2a2f){if(_0xf2a2f){return[_0xf2a2f,![]];}return db[_0x8575('0xa1')][_0x8575('0x55')]({'UserId':_0x41a623[_0x8575('0x59')]['id'],'ContactId':_0x353836['id'],'WhatsappAccountId':_0xa1d728['id'],'phone':_0x12e701,'firstMsgDirection':'out','Messages':[_[_0x8575('0x49')](_0x41a623[_0x8575('0x56')],{'read':![],'body':_0x41a623['body']['body'],'phone':_0x12e701,'WhatsappAccountId':_0xa1d728['id'],'UserId':_0x41a623[_0x8575('0x59')]['id'],'ContactId':_0x353836['id']})]},{'include':[{'model':db[_0x8575('0xa8')],'as':_0x8575('0xbd')}]})[_0x8575('0x33')](function(_0x25118a){return[_0x25118a,!![]];});});}})[_0x8575('0xa2')](function(_0xc8b322,_0x21f471){if(_0x21f471){return _0xc8b322;}return db[_0x8575('0xa8')][_0x8575('0x55')](_[_0x8575('0x49')](_0x41a623['body'],{'read':![],'body':_0x41a623[_0x8575('0x56')]['body'],'phone':_0x12e701,'WhatsappAccountId':_0xa1d728['id'],'WhatsappInteractionId':_0xc8b322['id'],'UserId':_0x41a623[_0x8575('0x59')]['id'],'ContactId':_0x353836['id']}))[_0x8575('0x33')](function(_0x3ceef4){_0xc8b322['dataValues'][_0x8575('0xbd')]=[];_0xc8b322['dataValues'][_0x8575('0xbd')]['push'](_0x3ceef4[_0x8575('0xbe')]);return _0xc8b322;});})[_0x8575('0x33')](respondWithResult(_0x31b521,null))[_0x8575('0x26')](handleError(_0x31b521,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 2ff41f1..ea7cff4 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 _0xde2f=['hook','exports','../../mysqldb','save','update','remove','emit'];(function(_0x2bc3f4,_0x470b26){var _0x14ac53=function(_0x5121bd){while(--_0x5121bd){_0x2bc3f4['push'](_0x2bc3f4['shift']());}};_0x14ac53(++_0x470b26);}(_0xde2f,0x105));var _0xfde2=function(_0x3d2297,_0x2382f1){_0x3d2297=_0x3d2297-0x0;var _0x3dd836=_0xde2f[_0x3d2297];return _0x3dd836;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xfde2('0x0'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfde2('0x1'),'afterUpdate':_0xfde2('0x2'),'afterDestroy':_0xfde2('0x3')};function emitEvent(_0x29e5a3){return function(_0xa033ee,_0x51251b,_0x464af8){WhatsappAccountEvents[_0xfde2('0x4')](_0x29e5a3+':'+_0xa033ee['id'],_0xa033ee);WhatsappAccountEvents[_0xfde2('0x4')](_0x29e5a3,_0xa033ee);_0x464af8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0xfde2('0x5')](e,emitEvent(event));}}module[_0xfde2('0x6')]=WhatsappAccountEvents; \ No newline at end of file +var _0x0336=['remove','emit','hasOwnProperty','hook','exports','events','WhatsappAccount','setMaxListeners','save'];(function(_0x4f11cb,_0x14e174){var _0x491488=function(_0x2904a9){while(--_0x2904a9){_0x4f11cb['push'](_0x4f11cb['shift']());}};_0x491488(++_0x14e174);}(_0x0336,0xe6));var _0x6033=function(_0x40c4ef,_0x23fad7){_0x40c4ef=_0x40c4ef-0x0;var _0x58b180=_0x0336[_0x40c4ef];return _0x58b180;};'use strict';var EventEmitter=require(_0x6033('0x0'));var WhatsappAccount=require('../../mysqldb')['db'][_0x6033('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x6033('0x2')](0x0);var events={'afterCreate':_0x6033('0x3'),'afterUpdate':'update','afterDestroy':_0x6033('0x4')};function emitEvent(_0x47c419){return function(_0x1146eb,_0x13a376,_0x331c88){WhatsappAccountEvents[_0x6033('0x5')](_0x47c419+':'+_0x1146eb['id'],_0x1146eb);WhatsappAccountEvents['emit'](_0x47c419,_0x1146eb);_0x331c88(null);};}for(var e in events){if(events[_0x6033('0x6')](e)){var event=events[e];WhatsappAccount[_0x6033('0x7')](e,emitEvent(event));}}module[_0x6033('0x8')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 46b9493..4b486cb 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 _0x0078=['exports','whatsapp_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./whatsappAccount.attributes'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0x0078,0x162));var _0x8007=function(_0x29886a,_0x3a34a3){_0x29886a=_0x29886a-0x0;var _0x27288d=_0x0078[_0x29886a];return _0x27288d;};'use strict';var _=require(_0x8007('0x0'));var util=require(_0x8007('0x1'));var logger=require('../../config/logger')(_0x8007('0x2'));var moment=require(_0x8007('0x3'));var BPromise=require(_0x8007('0x4'));var rp=require(_0x8007('0x5'));var fs=require('fs');var path=require(_0x8007('0x6'));var rimraf=require(_0x8007('0x7'));var config=require('../../config/environment');var attributes=require(_0x8007('0x8'));module[_0x8007('0x9')]=function(_0x21db10,_0x30fac5){return _0x21db10['define']('WhatsappAccount',attributes,{'tableName':_0x8007('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd534=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','./whatsappAccount.attributes','exports','WhatsappAccount','whatsapp_accounts','lodash'];(function(_0x32be62,_0x22e6fd){var _0x1a37e9=function(_0x35a9c1){while(--_0x35a9c1){_0x32be62['push'](_0x32be62['shift']());}};_0x1a37e9(++_0x22e6fd);}(_0xd534,0x6b));var _0x4d53=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xd534[_0x15bc81];return _0x59440e;};'use strict';var _=require(_0x4d53('0x0'));var util=require(_0x4d53('0x1'));var logger=require(_0x4d53('0x2'))(_0x4d53('0x3'));var moment=require('moment');var BPromise=require(_0x4d53('0x4'));var rp=require(_0x4d53('0x5'));var fs=require('fs');var path=require(_0x4d53('0x6'));var rimraf=require(_0x4d53('0x7'));var config=require('../../config/environment');var attributes=require(_0x4d53('0x8'));module[_0x4d53('0x9')]=function(_0x2bc10a,_0x3ebb87){return _0x2bc10a['define'](_0x4d53('0xa'),attributes,{'tableName':_0x4d53('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 03c98e9..a4dbdad 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 _0x8cc2=['include','map','model','ShowWhatsappAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','WhatsappAccount','options','raw','where','attributes'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x8cc2,0x1d8));var _0x28cc=function(_0x5c3e41,_0x23488c){_0x5c3e41=_0x5c3e41-0x0;var _0xab48ed=_0x8cc2[_0x5c3e41];return _0xab48ed;};'use strict';var _=require(_0x28cc('0x0'));var util=require(_0x28cc('0x1'));var moment=require(_0x28cc('0x2'));var BPromise=require(_0x28cc('0x3'));var rs=require(_0x28cc('0x4'));var fs=require('fs');var Redis=require(_0x28cc('0x5'));var db=require(_0x28cc('0x6'))['db'];var utils=require(_0x28cc('0x7'));var logger=require('../../config/logger')(_0x28cc('0x8'));var config=require('../../config/environment');var jayson=require(_0x28cc('0x9'));var client=jayson[_0x28cc('0xa')][_0x28cc('0xb')]({'port':0x232a});config[_0x28cc('0xc')]=_[_0x28cc('0xd')](config[_0x28cc('0xc')],{'host':_0x28cc('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappAccount.socket')[_0x28cc('0xf')](socket);function respondWithRpcPromise(_0x543f04,_0x27447d,_0x3f1164){return new BPromise(function(_0x1db128,_0x54f148){return client[_0x28cc('0x10')](_0x543f04,_0x3f1164)[_0x28cc('0x11')](function(_0x40a817){logger[_0x28cc('0x12')](_0x28cc('0x13'),_0x27447d,_0x28cc('0x14'));logger['debug'](_0x28cc('0x15'),_0x27447d,_0x28cc('0x14'),JSON[_0x28cc('0x16')](_0x40a817));if(_0x40a817['error']){if(_0x40a817['error']['code']===0x1f4){logger['error'](_0x28cc('0x13'),_0x27447d,_0x40a817[_0x28cc('0x17')][_0x28cc('0x18')]);return _0x54f148(_0x40a817[_0x28cc('0x17')][_0x28cc('0x18')]);}logger[_0x28cc('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x27447d,_0x40a817[_0x28cc('0x17')]['message']);return _0x1db128(_0x40a817[_0x28cc('0x17')]['message']);}else{logger[_0x28cc('0x12')](_0x28cc('0x13'),_0x27447d,_0x28cc('0x14'));_0x1db128(_0x40a817[_0x28cc('0x19')][_0x28cc('0x18')]);}})[_0x28cc('0x1a')](function(_0x15ac96){logger['error'](_0x28cc('0x13'),_0x27447d,_0x15ac96);_0x54f148(_0x15ac96);});});}exports['ShowWhatsappAccount']=function(_0xf0f0fb){var _0x5ca0db=this;return new Promise(function(_0x2d6201,_0x4a6f9b){return db[_0x28cc('0x1b')]['find']({'raw':_0xf0f0fb[_0x28cc('0x1c')]?_0xf0f0fb['options'][_0x28cc('0x1d')]===undefined?!![]:![]:!![],'where':_0xf0f0fb['options']?_0xf0f0fb[_0x28cc('0x1c')][_0x28cc('0x1e')]||null:null,'attributes':_0xf0f0fb[_0x28cc('0x1c')]?_0xf0f0fb[_0x28cc('0x1c')][_0x28cc('0x1f')]||null:null,'include':_0xf0f0fb[_0x28cc('0x1c')]?_0xf0f0fb[_0x28cc('0x1c')][_0x28cc('0x20')]?_[_0x28cc('0x21')](_0xf0f0fb[_0x28cc('0x1c')]['include'],function(_0x5dfb21){return{'model':db[_0x5dfb21[_0x28cc('0x22')]],'as':_0x5dfb21['as'],'attributes':_0x5dfb21[_0x28cc('0x1f')],'include':_0x5dfb21[_0x28cc('0x20')]?_[_0x28cc('0x21')](_0x5dfb21[_0x28cc('0x20')],function(_0x2b84e3){return{'model':db[_0x2b84e3[_0x28cc('0x22')]],'as':_0x2b84e3['as'],'attributes':_0x2b84e3[_0x28cc('0x1f')],'include':_0x2b84e3[_0x28cc('0x20')]?_[_0x28cc('0x21')](_0x2b84e3[_0x28cc('0x20')],function(_0x2b9cc7){return{'model':db[_0x2b9cc7[_0x28cc('0x22')]],'as':_0x2b9cc7['as'],'attributes':_0x2b9cc7['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b34cb){logger[_0x28cc('0x12')](_0x28cc('0x23'),_0xf0f0fb);logger['debug'](_0x28cc('0x23'),_0xf0f0fb,JSON['stringify'](_0x1b34cb));_0x2d6201(_0x1b34cb);})['catch'](function(_0x48461e){logger[_0x28cc('0x17')](_0x28cc('0x23'),_0x48461e[_0x28cc('0x18')],_0xf0f0fb);_0x4a6f9b(_0x5ca0db['error'](0x1f4,_0x48461e['message']));});});}; \ No newline at end of file +var _0x28f2=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./whatsappAccount.socket','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','model','catch','lodash','util','moment','bluebird'];(function(_0xddbaa0,_0x19e6a3){var _0x3da483=function(_0x563588){while(--_0x563588){_0xddbaa0['push'](_0xddbaa0['shift']());}};_0x3da483(++_0x19e6a3);}(_0x28f2,0x193));var _0x228f=function(_0x1489ef,_0x41e880){_0x1489ef=_0x1489ef-0x0;var _0x3eedec=_0x28f2[_0x1489ef];return _0x3eedec;};'use strict';var _=require(_0x228f('0x0'));var util=require(_0x228f('0x1'));var moment=require(_0x228f('0x2'));var BPromise=require(_0x228f('0x3'));var rs=require(_0x228f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x228f('0x5'))['db'];var utils=require(_0x228f('0x6'));var logger=require(_0x228f('0x7'))(_0x228f('0x8'));var config=require(_0x228f('0x9'));var jayson=require(_0x228f('0xa'));var client=jayson[_0x228f('0xb')]['http']({'port':0x232a});config[_0x228f('0xc')]=_['defaults'](config[_0x228f('0xc')],{'host':_0x228f('0xd'),'port':0x18eb});var socket=require(_0x228f('0xe'))(new Redis(config['redis']));require(_0x228f('0xf'))['register'](socket);function respondWithRpcPromise(_0x212c90,_0x2dfd07,_0x4e26fe){return new BPromise(function(_0x3884c6,_0x40aca5){return client[_0x228f('0x10')](_0x212c90,_0x4e26fe)[_0x228f('0x11')](function(_0x3aa9bf){logger['info'](_0x228f('0x12'),_0x2dfd07,_0x228f('0x13'));logger[_0x228f('0x14')](_0x228f('0x15'),_0x2dfd07,_0x228f('0x13'),JSON[_0x228f('0x16')](_0x3aa9bf));if(_0x3aa9bf[_0x228f('0x17')]){if(_0x3aa9bf[_0x228f('0x17')]['code']===0x1f4){logger[_0x228f('0x17')](_0x228f('0x12'),_0x2dfd07,_0x3aa9bf[_0x228f('0x17')][_0x228f('0x18')]);return _0x40aca5(_0x3aa9bf[_0x228f('0x17')][_0x228f('0x18')]);}logger[_0x228f('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x2dfd07,_0x3aa9bf[_0x228f('0x17')]['message']);return _0x3884c6(_0x3aa9bf[_0x228f('0x17')][_0x228f('0x18')]);}else{logger[_0x228f('0x19')]('WhatsappAccount,\x20%s,\x20%s',_0x2dfd07,_0x228f('0x13'));_0x3884c6(_0x3aa9bf['result'][_0x228f('0x18')]);}})['catch'](function(_0x30cbc2){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x2dfd07,_0x30cbc2);_0x40aca5(_0x30cbc2);});});}exports[_0x228f('0x1a')]=function(_0x52da36){var _0x302d54=this;return new Promise(function(_0x139373,_0x1294a8){return db[_0x228f('0x1b')][_0x228f('0x1c')]({'raw':_0x52da36[_0x228f('0x1d')]?_0x52da36[_0x228f('0x1d')][_0x228f('0x1e')]===undefined?!![]:![]:!![],'where':_0x52da36[_0x228f('0x1d')]?_0x52da36['options'][_0x228f('0x1f')]||null:null,'attributes':_0x52da36[_0x228f('0x1d')]?_0x52da36[_0x228f('0x1d')][_0x228f('0x20')]||null:null,'include':_0x52da36[_0x228f('0x1d')]?_0x52da36[_0x228f('0x1d')][_0x228f('0x21')]?_[_0x228f('0x22')](_0x52da36[_0x228f('0x1d')]['include'],function(_0x6d6613){return{'model':db[_0x6d6613[_0x228f('0x23')]],'as':_0x6d6613['as'],'attributes':_0x6d6613[_0x228f('0x20')],'include':_0x6d6613[_0x228f('0x21')]?_[_0x228f('0x22')](_0x6d6613['include'],function(_0xe8aac){return{'model':db[_0xe8aac['model']],'as':_0xe8aac['as'],'attributes':_0xe8aac[_0x228f('0x20')],'include':_0xe8aac['include']?_['map'](_0xe8aac[_0x228f('0x21')],function(_0x160f68){return{'model':db[_0x160f68[_0x228f('0x23')]],'as':_0x160f68['as'],'attributes':_0x160f68[_0x228f('0x20')]};}):[]};}):[]};}):[]:[]})[_0x228f('0x11')](function(_0x2c964e){logger[_0x228f('0x19')](_0x228f('0x1a'),_0x52da36);logger[_0x228f('0x14')](_0x228f('0x1a'),_0x52da36,JSON[_0x228f('0x16')](_0x2c964e));_0x139373(_0x2c964e);})[_0x228f('0x24')](function(_0xc25917){logger[_0x228f('0x17')](_0x228f('0x1a'),_0xc25917['message'],_0x52da36);_0x1294a8(_0x302d54[_0x228f('0x17')](0x1f4,_0xc25917[_0x228f('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 56dcc14..a2235bf 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 _0x4d83=['removeListener','register','length','./whatsappAccount.events','save','remove','update','emit'];(function(_0x4a747e,_0x4f8f89){var _0x2c1bc3=function(_0x3c334e){while(--_0x3c334e){_0x4a747e['push'](_0x4a747e['shift']());}};_0x2c1bc3(++_0x4f8f89);}(_0x4d83,0x1ab));var _0x34d8=function(_0x2d33d5,_0x373405){_0x2d33d5=_0x2d33d5-0x0;var _0x2bb1ed=_0x4d83[_0x2d33d5];return _0x2bb1ed;};'use strict';var WhatsappAccountEvents=require(_0x34d8('0x0'));var events=[_0x34d8('0x1'),_0x34d8('0x2'),_0x34d8('0x3')];function createListener(_0x34dea2,_0x43530c){return function(_0x25e102){_0x43530c[_0x34d8('0x4')](_0x34dea2,_0x25e102);};}function removeListener(_0xf72b43,_0x242434){return function(){WhatsappAccountEvents[_0x34d8('0x5')](_0xf72b43,_0x242434);};}exports[_0x34d8('0x6')]=function(_0x2b5e74){for(var _0x8a2998=0x0,_0x559020=events[_0x34d8('0x7')];_0x8a2998<_0x559020;_0x8a2998++){var _0x536d1d=events[_0x8a2998];var _0x42a731=createListener('whatsappAccount:'+_0x536d1d,_0x2b5e74);WhatsappAccountEvents['on'](_0x536d1d,_0x42a731);}}; \ No newline at end of file +var _0x3d9f=['whatsappAccount:','./whatsappAccount.events','save','update','emit','removeListener','register','length'];(function(_0x3aa66d,_0x5eb722){var _0x329c74=function(_0x478748){while(--_0x478748){_0x3aa66d['push'](_0x3aa66d['shift']());}};_0x329c74(++_0x5eb722);}(_0x3d9f,0x89));var _0xf3d9=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3d9f[_0x2dafbe];return _0x58a45a;};'use strict';var WhatsappAccountEvents=require(_0xf3d9('0x0'));var events=[_0xf3d9('0x1'),'remove',_0xf3d9('0x2')];function createListener(_0x2dea2c,_0x4c5c13){return function(_0x4d80e1){_0x4c5c13[_0xf3d9('0x3')](_0x2dea2c,_0x4d80e1);};}function removeListener(_0x2e0716,_0x34657a){return function(){WhatsappAccountEvents[_0xf3d9('0x4')](_0x2e0716,_0x34657a);};}exports[_0xf3d9('0x5')]=function(_0x369d9d){for(var _0x5b4795=0x0,_0x3687a6=events[_0xf3d9('0x6')];_0x5b4795<_0x3687a6;_0x5b4795++){var _0x55f12b=events[_0x5b4795];var _0x40c9b9=createListener(_0xf3d9('0x7')+_0x55f12b,_0x369d9d);WhatsappAccountEvents['on'](_0x55f12b,_0x40c9b9);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index a12dbf3..5b51593 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 _0x3da0=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','get'];(function(_0x3dcc9f,_0x152bde){var _0x336af4=function(_0x24dc37){while(--_0x24dc37){_0x3dcc9f['push'](_0x3dcc9f['shift']());}};_0x336af4(++_0x152bde);}(_0x3da0,0x161));var _0x03da=function(_0x2077c2,_0x275ab5){_0x2077c2=_0x2077c2-0x0;var _0x312f9f=_0x3da0[_0x2077c2];return _0x312f9f;};'use strict';var multer=require(_0x03da('0x0'));var util=require(_0x03da('0x1'));var path=require('path');var timeout=require(_0x03da('0x2'));var express=require(_0x03da('0x3'));var router=express['Router']();var fs_extra=require(_0x03da('0x4'));var auth=require(_0x03da('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappApplication.controller');router[_0x03da('0x6')]('/',auth[_0x03da('0x7')](),controller[_0x03da('0x8')]);router[_0x03da('0x6')](_0x03da('0x9'),auth[_0x03da('0x7')](),controller[_0x03da('0xa')]);router[_0x03da('0xb')]('/',auth[_0x03da('0x7')](),controller[_0x03da('0xc')]);router[_0x03da('0xd')]('/:id',auth[_0x03da('0x7')](),controller[_0x03da('0xe')]);router[_0x03da('0xf')](_0x03da('0x9'),auth['isAuthenticated'](),controller[_0x03da('0x10')]);module[_0x03da('0x11')]=router; \ No newline at end of file +var _0x123b=['Router','../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','create','update','destroy','exports','multer','util','connect-timeout','express'];(function(_0x2b9329,_0x4b5b2e){var _0xbaabb2=function(_0x58c948){while(--_0x58c948){_0x2b9329['push'](_0x2b9329['shift']());}};_0xbaabb2(++_0x4b5b2e);}(_0x123b,0xd9));var _0xb123=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x123b[_0x8c43de];return _0xa6591b;};'use strict';var multer=require(_0xb123('0x0'));var util=require(_0xb123('0x1'));var path=require('path');var timeout=require(_0xb123('0x2'));var express=require(_0xb123('0x3'));var router=express[_0xb123('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb123('0x5'));var interaction=require(_0xb123('0x6'));var config=require('../../config/environment');var controller=require(_0xb123('0x7'));router[_0xb123('0x8')]('/',auth[_0xb123('0x9')](),controller[_0xb123('0xa')]);router[_0xb123('0x8')](_0xb123('0xb'),auth[_0xb123('0x9')](),controller[_0xb123('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb123('0xd')]);router['put']('/:id',auth[_0xb123('0x9')](),controller[_0xb123('0xe')]);router['delete'](_0xb123('0xb'),auth['isAuthenticated'](),controller[_0xb123('0xf')]);module[_0xb123('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 3f1af78..253fff9 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 _0x7144=['INTEGER','STRING','noop','TEXT','exports'];(function(_0x396f5e,_0x8a669b){var _0x216284=function(_0x251ed9){while(--_0x251ed9){_0x396f5e['push'](_0x396f5e['shift']());}};_0x216284(++_0x8a669b);}(_0x7144,0x1f3));var _0x4714=function(_0x1d3f23,_0x5a118d){_0x1d3f23=_0x1d3f23-0x0;var _0x33578a=_0x7144[_0x1d3f23];return _0x33578a;};'use strict';var Sequelize=require('sequelize');module[_0x4714('0x0')]={'priority':{'type':Sequelize[_0x4714('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x4714('0x2')],'allowNull':![],'defaultValue':_0x4714('0x3')},'appdata':{'type':Sequelize[_0x4714('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x4714('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x9e60=['STRING','TEXT','exports','INTEGER'];(function(_0x1f21ef,_0x358cfa){var _0x13aac0=function(_0x5ddc72){while(--_0x5ddc72){_0x1f21ef['push'](_0x1f21ef['shift']());}};_0x13aac0(++_0x358cfa);}(_0x9e60,0x18a));var _0x09e6=function(_0x1143a4,_0x171fb8){_0x1143a4=_0x1143a4-0x0;var _0x43e524=_0x9e60[_0x1143a4];return _0x43e524;};'use strict';var Sequelize=require('sequelize');module[_0x09e6('0x0')]={'priority':{'type':Sequelize[_0x09e6('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x09e6('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x09e6('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x09e6('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 302d3ec..2a84438 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 _0x80c4=['order','sort','where','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','find','catch','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','name','WhatsappApplication','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x273268,_0x470307){var _0x57265e=function(_0x25b937){while(--_0x25b937){_0x273268['push'](_0x273268['shift']());}};_0x57265e(++_0x470307);}(_0x80c4,0xa3));var _0x480c=function(_0x553a33,_0x4fd082){_0x553a33=_0x553a33-0x0;var _0x3ec215=_0x80c4[_0x553a33];return _0x3ec215;};'use strict';var emlformat=require(_0x480c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x480c('0x1'));var jsonpatch=require(_0x480c('0x2'));var rp=require(_0x480c('0x3'));var moment=require(_0x480c('0x4'));var BPromise=require(_0x480c('0x5'));var Mustache=require(_0x480c('0x6'));var util=require('util');var path=require(_0x480c('0x7'));var sox=require(_0x480c('0x8'));var csv=require(_0x480c('0x9'));var ejs=require(_0x480c('0xa'));var fs=require('fs');var fs_extra=require(_0x480c('0xb'));var _=require(_0x480c('0xc'));var squel=require(_0x480c('0xd'));var crypto=require(_0x480c('0xe'));var jsforce=require(_0x480c('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x480c('0x9'));var querystring=require(_0x480c('0x10'));var Papa=require(_0x480c('0x11'));var Redis=require(_0x480c('0x12'));var authService=require(_0x480c('0x13'));var qs=require(_0x480c('0x14'));var as=require(_0x480c('0x15'));var hardwareService=require(_0x480c('0x16'));var logger=require(_0x480c('0x17'))(_0x480c('0x18'));var utils=require(_0x480c('0x19'));var config=require(_0x480c('0x1a'));var licenseUtil=require(_0x480c('0x1b'));var db=require(_0x480c('0x1c'))['db'];function respondWithStatusCode(_0x428d08,_0x3f5438){_0x3f5438=_0x3f5438||0xcc;return function(_0x376da3){if(_0x376da3){return _0x428d08[_0x480c('0x1d')](_0x3f5438);}return _0x428d08['status'](_0x3f5438)[_0x480c('0x1e')]();};}function respondWithResult(_0x29613b,_0x5efdbb){_0x5efdbb=_0x5efdbb||0xc8;return function(_0x3b48b6){if(_0x3b48b6){return _0x29613b[_0x480c('0x1f')](_0x5efdbb)[_0x480c('0x20')](_0x3b48b6);}};}function respondWithFilteredResult(_0x513f2d,_0x5ea02c){return function(_0x445635){if(_0x445635){var _0x164428=typeof _0x5ea02c[_0x480c('0x21')]===_0x480c('0x22')&&typeof _0x5ea02c[_0x480c('0x23')]==='undefined';var _0x5b5ea3=_0x445635['count'];var _0xfc8a9f=_0x164428?0x0:_0x5ea02c[_0x480c('0x21')];var _0x54750c=_0x164428?_0x445635[_0x480c('0x24')]:_0x5ea02c['offset']+_0x5ea02c[_0x480c('0x23')];var _0x1507d1;if(_0x54750c>=_0x5b5ea3){_0x54750c=_0x5b5ea3;_0x1507d1=0xc8;}else{_0x1507d1=0xce;}_0x513f2d[_0x480c('0x1f')](_0x1507d1);return _0x513f2d['set'](_0x480c('0x25'),_0xfc8a9f+'-'+_0x54750c+'/'+_0x5b5ea3)[_0x480c('0x20')](_0x445635);}return null;};}function patchUpdates(_0x9e5a12){return function(_0x5840be){try{jsonpatch[_0x480c('0x26')](_0x5840be,_0x9e5a12,!![]);}catch(_0x50bb63){return BPromise[_0x480c('0x27')](_0x50bb63);}return _0x5840be[_0x480c('0x28')]();};}function saveUpdates(_0x5b5a51,_0x3b5bca){return function(_0x3cca31){if(_0x3cca31){return _0x3cca31[_0x480c('0x29')](_0x5b5a51)[_0x480c('0x2a')](function(_0x5dbf8f){return _0x5dbf8f;});}return null;};}function removeEntity(_0x1bc75c,_0x241901){return function(_0x5288f5){if(_0x5288f5){return _0x5288f5[_0x480c('0x2b')]()[_0x480c('0x2a')](function(){_0x1bc75c[_0x480c('0x1f')](0xcc)[_0x480c('0x1e')]();});}};}function handleEntityNotFound(_0x12445d,_0x7f067f){return function(_0x4008ff){if(!_0x4008ff){_0x12445d[_0x480c('0x1d')](0x194);}return _0x4008ff;};}function handleError(_0x72e37b,_0x40def3){_0x40def3=_0x40def3||0x1f4;return function(_0x1363ef){logger['error'](_0x1363ef['stack']);if(_0x1363ef[_0x480c('0x2c')]){delete _0x1363ef['name'];}_0x72e37b['status'](_0x40def3)['send'](_0x1363ef);};}exports['index']=function(_0x4451fe,_0x6019aa){var _0x337816={},_0x377e5c={},_0x592c2b={'count':0x0,'rows':[]};var _0x4a54b2=_['map'](db[_0x480c('0x2d')][_0x480c('0x2e')],function(_0x5c56e5){return{'name':_0x5c56e5[_0x480c('0x2f')],'type':_0x5c56e5['type']['key']};});_0x377e5c[_0x480c('0x30')]=_[_0x480c('0x31')](_0x4a54b2,_0x480c('0x2c'));_0x377e5c[_0x480c('0x32')]=_[_0x480c('0x33')](_0x4451fe[_0x480c('0x32')]);_0x377e5c[_0x480c('0x34')]=_[_0x480c('0x35')](_0x377e5c['model'],_0x377e5c['query']);_0x337816[_0x480c('0x36')]=_[_0x480c('0x35')](_0x377e5c['model'],qs[_0x480c('0x37')](_0x4451fe[_0x480c('0x32')][_0x480c('0x37')]));_0x337816[_0x480c('0x36')]=_0x337816[_0x480c('0x36')][_0x480c('0x38')]?_0x337816[_0x480c('0x36')]:_0x377e5c[_0x480c('0x30')];if(!_0x4451fe[_0x480c('0x32')][_0x480c('0x39')](_0x480c('0x3a'))){_0x337816[_0x480c('0x23')]=qs[_0x480c('0x23')](_0x4451fe[_0x480c('0x32')][_0x480c('0x23')]);_0x337816['offset']=qs[_0x480c('0x21')](_0x4451fe[_0x480c('0x32')][_0x480c('0x21')]);}_0x337816[_0x480c('0x3b')]=qs['sort'](_0x4451fe[_0x480c('0x32')][_0x480c('0x3c')]);_0x337816['where']=qs[_0x480c('0x34')](_['pick'](_0x4451fe[_0x480c('0x32')],_0x377e5c[_0x480c('0x34')]),_0x4a54b2);if(_0x4451fe[_0x480c('0x32')]['filter']){_0x337816[_0x480c('0x3d')]=_[_0x480c('0x3e')](_0x337816[_0x480c('0x3d')],{'$or':_[_0x480c('0x31')](_0x4a54b2,function(_0x588669){if(_0x588669[_0x480c('0x3f')]!==_0x480c('0x40')){var _0x21877b={};_0x21877b[_0x588669[_0x480c('0x2c')]]={'$like':'%'+_0x4451fe[_0x480c('0x32')]['filter']+'%'};return _0x21877b;}})});}_0x337816=_['merge']({},_0x337816,_0x4451fe[_0x480c('0x41')]);var _0x2b5003={'where':_0x337816[_0x480c('0x3d')]};return db[_0x480c('0x2d')]['count'](_0x2b5003)[_0x480c('0x2a')](function(_0x30d983){_0x592c2b[_0x480c('0x24')]=_0x30d983;if(_0x4451fe[_0x480c('0x32')][_0x480c('0x42')]){_0x337816[_0x480c('0x43')]=[{'all':!![]}];}return db[_0x480c('0x2d')]['findAll'](_0x337816);})[_0x480c('0x2a')](function(_0x4ca83c){_0x592c2b[_0x480c('0x44')]=_0x4ca83c;return _0x592c2b;})[_0x480c('0x2a')](respondWithFilteredResult(_0x6019aa,_0x337816))['catch'](handleError(_0x6019aa,null));};exports[_0x480c('0x45')]=function(_0x2aad21,_0x4bee28){var _0xa5e32d={'raw':!![],'where':{'id':_0x2aad21[_0x480c('0x46')]['id']}},_0x4d62fb={};_0x4d62fb[_0x480c('0x30')]=_[_0x480c('0x33')](db['WhatsappApplication'][_0x480c('0x2e')]);_0x4d62fb[_0x480c('0x32')]=_[_0x480c('0x33')](_0x2aad21[_0x480c('0x32')]);_0x4d62fb[_0x480c('0x34')]=_[_0x480c('0x35')](_0x4d62fb[_0x480c('0x30')],_0x4d62fb[_0x480c('0x32')]);_0xa5e32d[_0x480c('0x36')]=_[_0x480c('0x35')](_0x4d62fb[_0x480c('0x30')],qs['fields'](_0x2aad21[_0x480c('0x32')]['fields']));_0xa5e32d[_0x480c('0x36')]=_0xa5e32d['attributes'][_0x480c('0x38')]?_0xa5e32d[_0x480c('0x36')]:_0x4d62fb[_0x480c('0x30')];if(_0x2aad21[_0x480c('0x32')][_0x480c('0x42')]){_0xa5e32d['include']=[{'all':!![]}];}_0xa5e32d=_[_0x480c('0x3e')]({},_0xa5e32d,_0x2aad21['options']);return db[_0x480c('0x2d')][_0x480c('0x47')](_0xa5e32d)['then'](handleEntityNotFound(_0x4bee28,null))['then'](respondWithResult(_0x4bee28,null))[_0x480c('0x48')](handleError(_0x4bee28,null));};exports['create']=function(_0x2649e0,_0x2c1ca6){return db[_0x480c('0x2d')]['create'](_0x2649e0['body'],{})['then'](respondWithResult(_0x2c1ca6,0xc9))[_0x480c('0x48')](handleError(_0x2c1ca6,null));};exports['update']=function(_0x3d7b08,_0x1ec5a2){if(_0x3d7b08[_0x480c('0x49')]['id']){delete _0x3d7b08[_0x480c('0x49')]['id'];}return db['WhatsappApplication'][_0x480c('0x47')]({'where':{'id':_0x3d7b08[_0x480c('0x46')]['id']}})[_0x480c('0x2a')](handleEntityNotFound(_0x1ec5a2,null))[_0x480c('0x2a')](saveUpdates(_0x3d7b08[_0x480c('0x49')],null))[_0x480c('0x2a')](respondWithResult(_0x1ec5a2,null))[_0x480c('0x48')](handleError(_0x1ec5a2,null));};exports[_0x480c('0x2b')]=function(_0x5d5668,_0x41c2d3){return db[_0x480c('0x2d')]['find']({'where':{'id':_0x5d5668['params']['id']}})[_0x480c('0x2a')](handleEntityNotFound(_0x41c2d3,null))['then'](removeEntity(_0x41c2d3,null))['catch'](handleError(_0x41c2d3,null));}; \ No newline at end of file +var _0x955f=['undefined','limit','offset','count','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json'];(function(_0x5b64a1,_0x2ec810){var _0x4b6f55=function(_0x44dd84){while(--_0x44dd84){_0x5b64a1['push'](_0x5b64a1['shift']());}};_0x4b6f55(++_0x2ec810);}(_0x955f,0x1eb));var _0xf955=function(_0x4b56fd,_0x4aed2b){_0x4b56fd=_0x4b56fd-0x0;var _0x28f9fe=_0x955f[_0x4b56fd];return _0x28f9fe;};'use strict';var emlformat=require(_0xf955('0x0'));var rimraf=require(_0xf955('0x1'));var zipdir=require(_0xf955('0x2'));var jsonpatch=require(_0xf955('0x3'));var rp=require(_0xf955('0x4'));var moment=require('moment');var BPromise=require(_0xf955('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf955('0x6'));var sox=require('sox');var csv=require(_0xf955('0x7'));var ejs=require(_0xf955('0x8'));var fs=require('fs');var fs_extra=require(_0xf955('0x9'));var _=require('lodash');var squel=require(_0xf955('0xa'));var crypto=require(_0xf955('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf955('0xc'));var toCsv=require(_0xf955('0x7'));var querystring=require(_0xf955('0xd'));var Papa=require(_0xf955('0xe'));var Redis=require(_0xf955('0xf'));var authService=require(_0xf955('0x10'));var qs=require(_0xf955('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf955('0x12'));var logger=require('../../config/logger')(_0xf955('0x13'));var utils=require(_0xf955('0x14'));var config=require(_0xf955('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf955('0x16'))['db'];function respondWithStatusCode(_0x542347,_0x23e0c6){_0x23e0c6=_0x23e0c6||0xcc;return function(_0x50d9a9){if(_0x50d9a9){return _0x542347[_0xf955('0x17')](_0x23e0c6);}return _0x542347[_0xf955('0x18')](_0x23e0c6)[_0xf955('0x19')]();};}function respondWithResult(_0x109bc5,_0x2080c4){_0x2080c4=_0x2080c4||0xc8;return function(_0x341b8c){if(_0x341b8c){return _0x109bc5[_0xf955('0x18')](_0x2080c4)[_0xf955('0x1a')](_0x341b8c);}};}function respondWithFilteredResult(_0x3c6af7,_0x24e75c){return function(_0x5350e4){if(_0x5350e4){var _0xc29b35=typeof _0x24e75c['offset']===_0xf955('0x1b')&&typeof _0x24e75c[_0xf955('0x1c')]===_0xf955('0x1b');var _0x15c07c=_0x5350e4['count'];var _0x5ac6cb=_0xc29b35?0x0:_0x24e75c[_0xf955('0x1d')];var _0xe6de5c=_0xc29b35?_0x5350e4[_0xf955('0x1e')]:_0x24e75c['offset']+_0x24e75c[_0xf955('0x1c')];var _0x3576fa;if(_0xe6de5c>=_0x15c07c){_0xe6de5c=_0x15c07c;_0x3576fa=0xc8;}else{_0x3576fa=0xce;}_0x3c6af7[_0xf955('0x18')](_0x3576fa);return _0x3c6af7[_0xf955('0x1f')](_0xf955('0x20'),_0x5ac6cb+'-'+_0xe6de5c+'/'+_0x15c07c)['json'](_0x5350e4);}return null;};}function patchUpdates(_0x17d86a){return function(_0x3dbbe8){try{jsonpatch[_0xf955('0x21')](_0x3dbbe8,_0x17d86a,!![]);}catch(_0x488d04){return BPromise[_0xf955('0x22')](_0x488d04);}return _0x3dbbe8['save']();};}function saveUpdates(_0x21ae24,_0x43b078){return function(_0x37143d){if(_0x37143d){return _0x37143d[_0xf955('0x23')](_0x21ae24)[_0xf955('0x24')](function(_0x565641){return _0x565641;});}return null;};}function removeEntity(_0x25f4f2,_0x5fab1c){return function(_0x3585c7){if(_0x3585c7){return _0x3585c7[_0xf955('0x25')]()[_0xf955('0x24')](function(){_0x25f4f2[_0xf955('0x18')](0xcc)[_0xf955('0x19')]();});}};}function handleEntityNotFound(_0x552cf3,_0x18f435){return function(_0x1acf33){if(!_0x1acf33){_0x552cf3[_0xf955('0x17')](0x194);}return _0x1acf33;};}function handleError(_0x406632,_0x2dcd55){_0x2dcd55=_0x2dcd55||0x1f4;return function(_0x13a86d){logger[_0xf955('0x26')](_0x13a86d['stack']);if(_0x13a86d[_0xf955('0x27')]){delete _0x13a86d[_0xf955('0x27')];}_0x406632[_0xf955('0x18')](_0x2dcd55)[_0xf955('0x28')](_0x13a86d);};}exports[_0xf955('0x29')]=function(_0x264f6d,_0x4d4af0){var _0x2232a7={},_0x1e5d37={},_0x4ec3e8={'count':0x0,'rows':[]};var _0x256df5=_[_0xf955('0x2a')](db[_0xf955('0x2b')][_0xf955('0x2c')],function(_0x59bfb5){return{'name':_0x59bfb5[_0xf955('0x2d')],'type':_0x59bfb5['type'][_0xf955('0x2e')]};});_0x1e5d37[_0xf955('0x2f')]=_[_0xf955('0x2a')](_0x256df5,_0xf955('0x27'));_0x1e5d37[_0xf955('0x30')]=_[_0xf955('0x31')](_0x264f6d[_0xf955('0x30')]);_0x1e5d37[_0xf955('0x32')]=_['intersection'](_0x1e5d37[_0xf955('0x2f')],_0x1e5d37[_0xf955('0x30')]);_0x2232a7[_0xf955('0x33')]=_[_0xf955('0x34')](_0x1e5d37['model'],qs[_0xf955('0x35')](_0x264f6d[_0xf955('0x30')][_0xf955('0x35')]));_0x2232a7[_0xf955('0x33')]=_0x2232a7[_0xf955('0x33')]['length']?_0x2232a7['attributes']:_0x1e5d37['model'];if(!_0x264f6d[_0xf955('0x30')][_0xf955('0x36')](_0xf955('0x37'))){_0x2232a7[_0xf955('0x1c')]=qs[_0xf955('0x1c')](_0x264f6d[_0xf955('0x30')]['limit']);_0x2232a7[_0xf955('0x1d')]=qs['offset'](_0x264f6d[_0xf955('0x30')][_0xf955('0x1d')]);}_0x2232a7[_0xf955('0x38')]=qs['sort'](_0x264f6d[_0xf955('0x30')]['sort']);_0x2232a7[_0xf955('0x39')]=qs[_0xf955('0x32')](_[_0xf955('0x3a')](_0x264f6d[_0xf955('0x30')],_0x1e5d37['filters']),_0x256df5);if(_0x264f6d[_0xf955('0x30')][_0xf955('0x3b')]){_0x2232a7['where']=_[_0xf955('0x3c')](_0x2232a7[_0xf955('0x39')],{'$or':_[_0xf955('0x2a')](_0x256df5,function(_0x547ed9){if(_0x547ed9[_0xf955('0x3d')]!==_0xf955('0x3e')){var _0x11b7e2={};_0x11b7e2[_0x547ed9['name']]={'$like':'%'+_0x264f6d[_0xf955('0x30')][_0xf955('0x3b')]+'%'};return _0x11b7e2;}})});}_0x2232a7=_[_0xf955('0x3c')]({},_0x2232a7,_0x264f6d[_0xf955('0x3f')]);var _0x2bfbe4={'where':_0x2232a7[_0xf955('0x39')]};return db[_0xf955('0x2b')][_0xf955('0x1e')](_0x2bfbe4)['then'](function(_0x8fa41b){_0x4ec3e8[_0xf955('0x1e')]=_0x8fa41b;if(_0x264f6d[_0xf955('0x30')][_0xf955('0x40')]){_0x2232a7[_0xf955('0x41')]=[{'all':!![]}];}return db[_0xf955('0x2b')][_0xf955('0x42')](_0x2232a7);})[_0xf955('0x24')](function(_0x47651b){_0x4ec3e8[_0xf955('0x43')]=_0x47651b;return _0x4ec3e8;})[_0xf955('0x24')](respondWithFilteredResult(_0x4d4af0,_0x2232a7))[_0xf955('0x44')](handleError(_0x4d4af0,null));};exports[_0xf955('0x45')]=function(_0x159ae3,_0x3557b5){var _0x248f60={'raw':!![],'where':{'id':_0x159ae3[_0xf955('0x46')]['id']}},_0x356ec2={};_0x356ec2[_0xf955('0x2f')]=_['keys'](db[_0xf955('0x2b')][_0xf955('0x2c')]);_0x356ec2[_0xf955('0x30')]=_['keys'](_0x159ae3[_0xf955('0x30')]);_0x356ec2['filters']=_[_0xf955('0x34')](_0x356ec2['model'],_0x356ec2[_0xf955('0x30')]);_0x248f60[_0xf955('0x33')]=_[_0xf955('0x34')](_0x356ec2[_0xf955('0x2f')],qs['fields'](_0x159ae3[_0xf955('0x30')][_0xf955('0x35')]));_0x248f60[_0xf955('0x33')]=_0x248f60['attributes']['length']?_0x248f60[_0xf955('0x33')]:_0x356ec2[_0xf955('0x2f')];if(_0x159ae3[_0xf955('0x30')][_0xf955('0x40')]){_0x248f60['include']=[{'all':!![]}];}_0x248f60=_[_0xf955('0x3c')]({},_0x248f60,_0x159ae3[_0xf955('0x3f')]);return db[_0xf955('0x2b')]['find'](_0x248f60)[_0xf955('0x24')](handleEntityNotFound(_0x3557b5,null))['then'](respondWithResult(_0x3557b5,null))[_0xf955('0x44')](handleError(_0x3557b5,null));};exports[_0xf955('0x47')]=function(_0x2c867f,_0x4dd592){return db[_0xf955('0x2b')][_0xf955('0x47')](_0x2c867f[_0xf955('0x48')],{})[_0xf955('0x24')](respondWithResult(_0x4dd592,0xc9))['catch'](handleError(_0x4dd592,null));};exports[_0xf955('0x23')]=function(_0x4ff0f1,_0x1c6d76){if(_0x4ff0f1[_0xf955('0x48')]['id']){delete _0x4ff0f1[_0xf955('0x48')]['id'];}return db['WhatsappApplication'][_0xf955('0x49')]({'where':{'id':_0x4ff0f1['params']['id']}})[_0xf955('0x24')](handleEntityNotFound(_0x1c6d76,null))['then'](saveUpdates(_0x4ff0f1[_0xf955('0x48')],null))['then'](respondWithResult(_0x1c6d76,null))['catch'](handleError(_0x1c6d76,null));};exports[_0xf955('0x25')]=function(_0x45c7fe,_0x4961cc){return db[_0xf955('0x2b')]['find']({'where':{'id':_0x45c7fe['params']['id']}})['then'](handleEntityNotFound(_0x4961cc,null))['then'](removeEntity(_0x4961cc,null))[_0xf955('0x44')](handleError(_0x4961cc,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index b639e25..9ec3499 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 _0x4d9e=['lodash','api','bluebird','path','rimraf','./whatsappApplication.attributes','exports','define','WhatsappApplication','utf8mb4','utf8mb4_unicode_ci'];(function(_0x30250c,_0x15b1cb){var _0x307dd5=function(_0x27d82a){while(--_0x27d82a){_0x30250c['push'](_0x30250c['shift']());}};_0x307dd5(++_0x15b1cb);}(_0x4d9e,0x18c));var _0xe4d9=function(_0x19590f,_0x3390c3){_0x19590f=_0x19590f-0x0;var _0x2adbef=_0x4d9e[_0x19590f];return _0x2adbef;};'use strict';var _=require(_0xe4d9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe4d9('0x1'));var moment=require('moment');var BPromise=require(_0xe4d9('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe4d9('0x3'));var rimraf=require(_0xe4d9('0x4'));var config=require('../../config/environment');var attributes=require(_0xe4d9('0x5'));module[_0xe4d9('0x6')]=function(_0x278035,_0x34c2a2){return _0x278035[_0xe4d9('0x7')](_0xe4d9('0x8'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe4d9('0x9'),'collate':_0xe4d9('0xa')});}; \ No newline at end of file +var _0xf3cd=['whatsapp_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','WhatsappApplication'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x1a0e6a,_0x1b43de){_0x1a0e6a=_0x1a0e6a-0x0;var _0x4b3934=_0xf3cd[_0x1a0e6a];return _0x4b3934;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var logger=require(_0xdf3c('0x2'))(_0xdf3c('0x3'));var moment=require(_0xdf3c('0x4'));var BPromise=require(_0xdf3c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf3c('0x6'));var rimraf=require(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var attributes=require('./whatsappApplication.attributes');module[_0xdf3c('0x9')]=function(_0x17d42a,_0x1313d5){return _0x17d42a[_0xdf3c('0xa')](_0xdf3c('0xb'),attributes,{'tableName':_0xdf3c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xdf3c('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index f68fb8e..334fb00 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 _0xbec5=['info','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappApplication,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0xbec8e6,_0x2841b5){var _0x4aa6f2=function(_0x583a0a){while(--_0x583a0a){_0xbec8e6['push'](_0xbec8e6['shift']());}};_0x4aa6f2(++_0x2841b5);}(_0xbec5,0xe5));var _0x5bec=function(_0x2d89ce,_0x24d58d){_0x2d89ce=_0x2d89ce-0x0;var _0x3fad10=_0xbec5[_0x2d89ce];return _0x3fad10;};'use strict';var _=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var moment=require('moment');var BPromise=require(_0x5bec('0x2'));var rs=require(_0x5bec('0x3'));var fs=require('fs');var Redis=require(_0x5bec('0x4'));var db=require(_0x5bec('0x5'))['db'];var utils=require(_0x5bec('0x6'));var logger=require('../../config/logger')(_0x5bec('0x7'));var config=require(_0x5bec('0x8'));var jayson=require(_0x5bec('0x9'));var client=jayson['client'][_0x5bec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28a427,_0x38456e,_0x406e65){return new BPromise(function(_0x43d96e,_0x302aae){return client[_0x5bec('0xb')](_0x28a427,_0x406e65)[_0x5bec('0xc')](function(_0x4d0d29){logger[_0x5bec('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x38456e,_0x5bec('0xe'));logger[_0x5bec('0xf')](_0x5bec('0x10'),_0x38456e,'request\x20sent',JSON[_0x5bec('0x11')](_0x4d0d29));if(_0x4d0d29[_0x5bec('0x12')]){if(_0x4d0d29[_0x5bec('0x12')]['code']===0x1f4){logger[_0x5bec('0x12')](_0x5bec('0x13'),_0x38456e,_0x4d0d29['error'][_0x5bec('0x14')]);return _0x302aae(_0x4d0d29[_0x5bec('0x12')][_0x5bec('0x14')]);}logger[_0x5bec('0x12')](_0x5bec('0x13'),_0x38456e,_0x4d0d29[_0x5bec('0x12')][_0x5bec('0x14')]);return _0x43d96e(_0x4d0d29[_0x5bec('0x12')][_0x5bec('0x14')]);}else{logger[_0x5bec('0xd')](_0x5bec('0x13'),_0x38456e,_0x5bec('0xe'));_0x43d96e(_0x4d0d29[_0x5bec('0x15')]['message']);}})['catch'](function(_0x15af9b){logger[_0x5bec('0x12')](_0x5bec('0x13'),_0x38456e,_0x15af9b);_0x302aae(_0x15af9b);});});} \ No newline at end of file +var _0xeec6=['then','info','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0xeec6,0x1c2));var _0x6eec=function(_0x3feb8a,_0x47c784){_0x3feb8a=_0x3feb8a-0x0;var _0x4523ca=_0xeec6[_0x3feb8a];return _0x4523ca;};'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')]('WhatsappApplication,\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/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 5149af4..8c6234d 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 _0x7a54=['create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','/:id','whatsappinteraction:update','whatsappinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','index','/describe','isAuthenticated','/:id/messages','getMessages','download','post'];(function(_0x286819,_0x84199){var _0x29a0fe=function(_0x5b48b0){while(--_0x5b48b0){_0x286819['push'](_0x286819['shift']());}};_0x29a0fe(++_0x84199);}(_0x7a54,0x106));var _0x47a5=function(_0x51fbc1,_0x57175b){_0x51fbc1=_0x51fbc1-0x0;var _0x40f4e1=_0x7a54[_0x51fbc1];return _0x40f4e1;};'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['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/download',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x10')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0x12')]);router[_0x47a5('0x10')](_0x47a5('0x13'),auth[_0x47a5('0xc')](),interaction[_0x47a5('0x14')](_0x47a5('0x15'),_0x47a5('0x16')),controller[_0x47a5('0x17')]);router['put'](_0x47a5('0x18'),auth[_0x47a5('0xc')](),interaction[_0x47a5('0x14')](_0x47a5('0x15'),_0x47a5('0x19')),controller['update']);router['delete'](_0x47a5('0x18'),auth['isAuthenticated'](),interaction['tracked'](_0x47a5('0x15'),_0x47a5('0x1a')),controller[_0x47a5('0x1b')]);router[_0x47a5('0x1c')](_0x47a5('0x13'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1d')]);module[_0x47a5('0x1e')]=router; \ No newline at end of file +var _0x07e8=['download','post','create','addMessage','/:id/tags','tracked','addTags','put','whatsapp','whatsappinteraction:update','update','delete','destroy','removeTags','exports','multer','util','path','express','fs-extra','../../config/environment','./whatsappInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download'];(function(_0x5d07ff,_0x1f976f){var _0x5226ad=function(_0x1653a4){while(--_0x1653a4){_0x5d07ff['push'](_0x5d07ff['shift']());}};_0x5226ad(++_0x1f976f);}(_0x07e8,0x10f));var _0x807e=function(_0x58a911,_0xbe30d4){_0x58a911=_0x58a911-0x0;var _0x581045=_0x07e8[_0x58a911];return _0x581045;};'use strict';var multer=require(_0x807e('0x0'));var util=require(_0x807e('0x1'));var path=require(_0x807e('0x2'));var timeout=require('connect-timeout');var express=require(_0x807e('0x3'));var router=express['Router']();var fs_extra=require(_0x807e('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x807e('0x5'));var controller=require(_0x807e('0x6'));router[_0x807e('0x7')]('/',auth['isAuthenticated'](),controller[_0x807e('0x8')]);router[_0x807e('0x7')](_0x807e('0x9'),auth[_0x807e('0xa')](),controller[_0x807e('0xb')]);router['get'](_0x807e('0xc'),auth[_0x807e('0xa')](),controller[_0x807e('0xd')]);router[_0x807e('0x7')](_0x807e('0xe'),auth[_0x807e('0xa')](),controller[_0x807e('0xf')]);router[_0x807e('0x7')](_0x807e('0x10'),auth[_0x807e('0xa')](),controller[_0x807e('0x11')]);router[_0x807e('0x12')]('/',auth[_0x807e('0xa')](),controller[_0x807e('0x13')]);router['post'](_0x807e('0xe'),auth[_0x807e('0xa')](),controller[_0x807e('0x14')]);router[_0x807e('0x12')](_0x807e('0x15'),auth[_0x807e('0xa')](),interaction[_0x807e('0x16')]('whatsapp','whatsappinteraction:addtags'),controller[_0x807e('0x17')]);router[_0x807e('0x18')](_0x807e('0xc'),auth[_0x807e('0xa')](),interaction['tracked'](_0x807e('0x19'),_0x807e('0x1a')),controller[_0x807e('0x1b')]);router[_0x807e('0x1c')](_0x807e('0xc'),auth[_0x807e('0xa')](),interaction['tracked'](_0x807e('0x19'),'whatsappinteraction:destroy'),controller[_0x807e('0x1d')]);router[_0x807e('0x1c')](_0x807e('0x15'),auth[_0x807e('0xa')](),controller[_0x807e('0x1e')]);module[_0x807e('0x1f')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 9339201..2a1b194 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 _0xdeb3=['exports','BOOLEAN','STRING','DATE','out','ENUM','INTEGER','moment'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xdeb3,0xb7));var _0x3deb=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xdeb3[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x3deb('0x0'));module[_0x3deb('0x1')]={'closed':{'type':Sequelize[_0x3deb('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x3deb('0x3')]},'thirdDisposition':{'type':Sequelize[_0x3deb('0x3')]},'note':{'type':Sequelize[_0x3deb('0x3')]},'phone':{'type':Sequelize[_0x3deb('0x3')]},'read1stAt':{'type':Sequelize[_0x3deb('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x3deb('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x3deb('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x3deb('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x3deb('0x7')]}}; \ No newline at end of file +var _0xcdd2=['DATE','ENUM','out','sequelize','moment','exports','BOOLEAN','STRING'];(function(_0x1d4fcd,_0x36bc07){var _0x9c44f8=function(_0x1831ec){while(--_0x1831ec){_0x1d4fcd['push'](_0x1d4fcd['shift']());}};_0x9c44f8(++_0x36bc07);}(_0xcdd2,0x83));var _0x2cdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdd2[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2cdd('0x0'));var moment=require(_0x2cdd('0x1'));module[_0x2cdd('0x2')]={'closed':{'type':Sequelize[_0x2cdd('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x2cdd('0x4')]},'secondDisposition':{'type':Sequelize[_0x2cdd('0x4')]},'thirdDisposition':{'type':Sequelize[_0x2cdd('0x4')]},'note':{'type':Sequelize[_0x2cdd('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x2cdd('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x2cdd('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2cdd('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x2cdd('0x6')]('in',_0x2cdd('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x2cdd('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 7ddef10..4b9b538 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 _0xe43b=['map','WhatsappInteraction','rawAttributes','key','getOptions','findAll','whatsapp','query','user','catch','show','model','keys','intersection','fields','attributes','length','includeAll','include','merge','options','find','create','body','params','describe','WhatsappMessage','addMessage','ids','omit','getMessages','findOne','filters','hasOwnProperty','order','sort','where','WhatsappInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','Tag','emit','whatsappInteractionTags:save','removeTags','download','toString','join','files','tmp','root','attachments','push','User','fullname','CmContact','Contact','lastName','Attachment','Messages','direction','secret','WhatsappAccount','Owner','mkdirSync','Whatsapp','Account','createdAt','format','closedAt','disposition','basename','existsSync','createReadStream','createWriteStream','out','System','firstName','read','value','renderFile','server','views','downloadInteraction.ejs','transcript-','.pdf','log','zip-dir','moment','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappInteraction.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','end','error','stack','name','index'];(function(_0x49df51,_0x2ba7ad){var _0x1b18cc=function(_0x3b6670){while(--_0x3b6670){_0x49df51['push'](_0x49df51['shift']());}};_0x1b18cc(++_0x2ba7ad);}(_0xe43b,0x157));var _0xbe43=function(_0x26393b,_0x449a84){_0x26393b=_0x26393b-0x0;var _0x57230a=_0xe43b[_0x26393b];return _0x57230a;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xbe43('0x0'));var moment=require(_0xbe43('0x1'));var BPromise=require('bluebird');var util=require('util');var path=require(_0xbe43('0x2'));var ejs=require(_0xbe43('0x3'));var fs=require('fs');var _=require(_0xbe43('0x4'));var Redis=require(_0xbe43('0x5'));var interaction=require(_0xbe43('0x6'));var qs=require(_0xbe43('0x7'));var pdf=require(_0xbe43('0x8'));var logger=require(_0xbe43('0x9'))(_0xbe43('0xa'));var config=require(_0xbe43('0xb'));var db=require(_0xbe43('0xc'))['db'];config[_0xbe43('0xd')]=_[_0xbe43('0xe')](config[_0xbe43('0xd')],{'host':_0xbe43('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbe43('0xd')]));require(_0xbe43('0x10'))[_0xbe43('0x11')](socket);function respondWithStatusCode(_0x2ad92f,_0x5289f6){_0x5289f6=_0x5289f6||0xcc;return function(_0x4eecc7){if(_0x4eecc7){return _0x2ad92f[_0xbe43('0x12')](_0x5289f6);}return _0x2ad92f[_0xbe43('0x13')](_0x5289f6)['end']();};}function respondWithResult(_0x4e86cf,_0x2fcb86){_0x2fcb86=_0x2fcb86||0xc8;return function(_0x2af947){if(_0x2af947){return _0x4e86cf[_0xbe43('0x13')](_0x2fcb86)[_0xbe43('0x14')](_0x2af947);}};}function respondWithFilteredResult(_0x1a759a,_0x27025b){return function(_0x4022a6){if(_0x4022a6){var _0xc73139=typeof _0x27025b[_0xbe43('0x15')]==='undefined'&&typeof _0x27025b['limit']===_0xbe43('0x16');var _0x42beb4=_0x4022a6[_0xbe43('0x17')];var _0x1c9127=_0xc73139?0x0:_0x27025b[_0xbe43('0x15')];var _0x4bb711=_0xc73139?_0x4022a6['count']:_0x27025b[_0xbe43('0x15')]+_0x27025b[_0xbe43('0x18')];var _0x301f52;if(_0x4bb711>=_0x42beb4){_0x4bb711=_0x42beb4;_0x301f52=0xc8;}else{_0x301f52=0xce;}_0x1a759a[_0xbe43('0x13')](_0x301f52);return _0x1a759a[_0xbe43('0x19')](_0xbe43('0x1a'),_0x1c9127+'-'+_0x4bb711+'/'+_0x42beb4)[_0xbe43('0x14')](_0x4022a6);}return null;};}function saveUpdates(_0x316cf){return function(_0x1c0911){if(_0x1c0911){return _0x1c0911[_0xbe43('0x1b')](_0x316cf)[_0xbe43('0x1c')](function(_0x3469ba){return _0x3469ba;});}return null;};}function removeEntity(_0x12da88){return function(_0x1baf70){if(_0x1baf70){return _0x1baf70[_0xbe43('0x1d')]()['then'](function(){_0x12da88[_0xbe43('0x13')](0xcc)[_0xbe43('0x1e')]();});}};}function handleEntityNotFound(_0x23bd2b){return function(_0x27988e){if(!_0x27988e){_0x23bd2b['sendStatus'](0x194);}return _0x27988e;};}function handleError(_0x34d8af,_0x3c6108){_0x3c6108=_0x3c6108||0x1f4;return function(_0x3d65a8){logger[_0xbe43('0x1f')](_0x3d65a8[_0xbe43('0x20')]);if(_0x3d65a8[_0xbe43('0x21')]){delete _0x3d65a8['name'];}_0x34d8af[_0xbe43('0x13')](_0x3c6108)['send'](_0x3d65a8);};}exports[_0xbe43('0x22')]=function(_0x5a29f8,_0x4f12be){var _0x5eb9c2={};var _0xb005fd=_[_0xbe43('0x23')](db[_0xbe43('0x24')][_0xbe43('0x25')],function(_0x312b67){return{'name':_0x312b67['fieldName'],'type':_0x312b67['type'][_0xbe43('0x26')]};});_0x5eb9c2=qs[_0xbe43('0x27')](_0xb005fd,_0x5a29f8);return interaction[_0xbe43('0x28')](_0xbe43('0x29'),_0x5a29f8[_0xbe43('0x2a')],_0x5a29f8[_0xbe43('0x2b')],_0x5eb9c2,_0xb005fd)[_0xbe43('0x1c')](respondWithFilteredResult(_0x4f12be,_0x5eb9c2))[_0xbe43('0x2c')](handleError(_0x4f12be,null));};exports[_0xbe43('0x2d')]=function(_0x4339f9,_0x2bcf7d){var _0x41f81c={'raw':![],'where':{'id':_0x4339f9['params']['id']}},_0x41eaad={};_0x41eaad[_0xbe43('0x2e')]=_[_0xbe43('0x2f')](db[_0xbe43('0x24')][_0xbe43('0x25')]);_0x41eaad[_0xbe43('0x2a')]=_['keys'](_0x4339f9[_0xbe43('0x2a')]);_0x41eaad['filters']=_[_0xbe43('0x30')](_0x41eaad[_0xbe43('0x2e')],_0x41eaad[_0xbe43('0x2a')]);_0x41f81c['attributes']=_[_0xbe43('0x30')](_0x41eaad[_0xbe43('0x2e')],qs[_0xbe43('0x31')](_0x4339f9[_0xbe43('0x2a')][_0xbe43('0x31')]));_0x41f81c[_0xbe43('0x32')]=_0x41f81c[_0xbe43('0x32')][_0xbe43('0x33')]?_0x41f81c[_0xbe43('0x32')]:_0x41eaad['model'];if(_0x4339f9[_0xbe43('0x2a')][_0xbe43('0x34')]){_0x41f81c[_0xbe43('0x35')]=[{'all':!![]}];}_0x41f81c=_[_0xbe43('0x36')]({},_0x41f81c,_0x4339f9[_0xbe43('0x37')]);return db[_0xbe43('0x24')][_0xbe43('0x38')](_0x41f81c)[_0xbe43('0x1c')](handleEntityNotFound(_0x2bcf7d,null))['then'](respondWithResult(_0x2bcf7d,null))['catch'](handleError(_0x2bcf7d,null));};exports[_0xbe43('0x39')]=function(_0x4172f3,_0x14b0cf){return db[_0xbe43('0x24')][_0xbe43('0x39')](_0x4172f3[_0xbe43('0x3a')],{})[_0xbe43('0x1c')](respondWithResult(_0x14b0cf,0xc9))[_0xbe43('0x2c')](handleError(_0x14b0cf,null));};exports['update']=function(_0x23fe33,_0xda43a2){if(_0x23fe33[_0xbe43('0x3a')]['id']){delete _0x23fe33['body']['id'];}return db['WhatsappInteraction'][_0xbe43('0x38')]({'where':{'id':_0x23fe33[_0xbe43('0x3b')]['id']}})[_0xbe43('0x1c')](handleEntityNotFound(_0xda43a2,null))[_0xbe43('0x1c')](saveUpdates(_0x23fe33[_0xbe43('0x3a')],null))[_0xbe43('0x1c')](respondWithResult(_0xda43a2,null))[_0xbe43('0x2c')](handleError(_0xda43a2,null));};exports[_0xbe43('0x1d')]=function(_0x3fcb6e,_0x152284){return db[_0xbe43('0x24')]['find']({'where':{'id':_0x3fcb6e[_0xbe43('0x3b')]['id']}})[_0xbe43('0x1c')](handleEntityNotFound(_0x152284,null))['then'](removeEntity(_0x152284,null))['catch'](handleError(_0x152284,null));};exports[_0xbe43('0x3c')]=function(_0x599560,_0x469d8a){return db[_0xbe43('0x24')][_0xbe43('0x3c')]()[_0xbe43('0x1c')](respondWithResult(_0x469d8a,null))['catch'](handleError(_0x469d8a,null));};exports['addMessage']=function(_0x5b6475,_0x2cbe5c){return db[_0xbe43('0x3d')][_0xbe43('0x38')]({'where':{'id':_0x5b6475[_0xbe43('0x3b')]['id']}})[_0xbe43('0x1c')](handleEntityNotFound(_0x2cbe5c,null))[_0xbe43('0x1c')](function(_0x2a6159){if(_0x2a6159){return _0x2a6159[_0xbe43('0x3e')](_0x5b6475[_0xbe43('0x3a')][_0xbe43('0x3f')],_[_0xbe43('0x40')](_0x5b6475[_0xbe43('0x3a')],[_0xbe43('0x3f'),'id'])||{});}})[_0xbe43('0x1c')](respondWithResult(_0x2cbe5c,null))[_0xbe43('0x2c')](handleError(_0x2cbe5c,null));};exports[_0xbe43('0x41')]=function(_0x442962,_0x4b34cb){var _0x35032f={'raw':![],'where':{}};var _0x29b51d={};var _0x3dec14={'count':0x0,'rows':[]};return db[_0xbe43('0x24')][_0xbe43('0x42')]({'where':{'id':_0x442962[_0xbe43('0x3b')]['id']}})[_0xbe43('0x1c')](handleEntityNotFound(_0x4b34cb,null))[_0xbe43('0x1c')](function(_0x1e1526){if(_0x1e1526){_0x29b51d[_0xbe43('0x2e')]=_[_0xbe43('0x2f')](db[_0xbe43('0x3d')][_0xbe43('0x25')]);_0x29b51d[_0xbe43('0x2a')]=_[_0xbe43('0x2f')](_0x442962[_0xbe43('0x2a')]);_0x29b51d[_0xbe43('0x43')]=_[_0xbe43('0x30')](_0x29b51d['model'],_0x29b51d[_0xbe43('0x2a')]);_0x35032f[_0xbe43('0x32')]=_[_0xbe43('0x30')](_0x29b51d[_0xbe43('0x2e')],qs[_0xbe43('0x31')](_0x442962[_0xbe43('0x2a')]['fields']));_0x35032f[_0xbe43('0x32')]=_0x35032f[_0xbe43('0x32')][_0xbe43('0x33')]?_0x35032f[_0xbe43('0x32')]:_0x29b51d['model'];if(!_0x442962['query'][_0xbe43('0x44')]('nolimit')){_0x35032f[_0xbe43('0x18')]=qs[_0xbe43('0x18')](_0x442962[_0xbe43('0x2a')][_0xbe43('0x18')]);_0x35032f[_0xbe43('0x15')]=qs['offset'](_0x442962[_0xbe43('0x2a')][_0xbe43('0x15')]);}_0x35032f[_0xbe43('0x45')]=qs[_0xbe43('0x46')](_0x442962['query'][_0xbe43('0x46')]);_0x35032f[_0xbe43('0x47')]=qs['filters'](_['pick'](_0x442962[_0xbe43('0x2a')],_0x29b51d[_0xbe43('0x43')]));_0x35032f[_0xbe43('0x47')][_0xbe43('0x48')]=_0x1e1526['id'];if(_0x442962[_0xbe43('0x2a')][_0xbe43('0x49')]){_0x35032f['where']=_[_0xbe43('0x36')](_0x35032f[_0xbe43('0x47')],{'$or':_[_0xbe43('0x23')](_0x35032f[_0xbe43('0x32')],function(_0x4a001e){var _0x42a5fb={};_0x42a5fb[_0x4a001e]={'$like':'%'+_0x442962[_0xbe43('0x2a')][_0xbe43('0x49')]+'%'};return _0x42a5fb;})});}if(_0x442962[_0xbe43('0x2a')]['$gte']){var _0x44d7c4=_0x442962['query'][_0xbe43('0x4a')][_0xbe43('0x4b')](',');var _0x4d7311={};_0x4d7311[_0x44d7c4[0x0]]={'$gte':moment(_0x44d7c4[0x1])['format'](_0xbe43('0x4c'))};_0x35032f[_0xbe43('0x47')]=_[_0xbe43('0x36')](_0x35032f['where'],_0x4d7311);}_0x35032f=_[_0xbe43('0x36')]({},_0x35032f,_0x442962[_0xbe43('0x37')]);return db[_0xbe43('0x3d')][_0xbe43('0x17')]({'where':_0x35032f['where']})[_0xbe43('0x1c')](function(_0x56424a){_0x3dec14['count']=_0x56424a;if(_0x442962[_0xbe43('0x2a')][_0xbe43('0x34')]){_0x35032f['include']=[{'all':!![]}];}return db[_0xbe43('0x3d')][_0xbe43('0x28')](_0x35032f);})[_0xbe43('0x1c')](function(_0x1327b4){_0x3dec14[_0xbe43('0x4d')]=_0x1327b4;return _0x3dec14;});}})[_0xbe43('0x1c')](respondWithFilteredResult(_0x4b34cb,_0x35032f))[_0xbe43('0x2c')](handleError(_0x4b34cb,null));};exports[_0xbe43('0x4e')]=function(_0x5efcf5,_0x1f2b81){return db[_0xbe43('0x24')][_0xbe43('0x38')]({'where':{'id':_0x5efcf5[_0xbe43('0x3b')]['id']}})[_0xbe43('0x1c')](handleEntityNotFound(_0x1f2b81,null))[_0xbe43('0x1c')](function(_0x2ae143){if(_0x2ae143){return _0x2ae143[_0xbe43('0x4f')](_0x5efcf5[_0xbe43('0x3a')][_0xbe43('0x3f')],_[_0xbe43('0x40')](_0x5efcf5[_0xbe43('0x3a')],[_0xbe43('0x3f'),'id'])||{})['spread'](function(){return db[_0xbe43('0x50')][_0xbe43('0x28')]({'attributes':['id',_0xbe43('0x21'),'color'],'where':{'id':_0x5efcf5[_0xbe43('0x3a')][_0xbe43('0x3f')]}});})[_0xbe43('0x1c')](function(_0x42279e){socket[_0xbe43('0x51')](_0xbe43('0x52'),{'id':Number(_0x5efcf5['params']['id']),'tags':_0x42279e||[]});return{'id':Number(_0x5efcf5[_0xbe43('0x3b')]['id']),'tags':_0x42279e||[]};});}})['then'](respondWithResult(_0x1f2b81,null))[_0xbe43('0x2c')](handleError(_0x1f2b81,null));};exports[_0xbe43('0x53')]=function(_0xdbeeab,_0x3321d5){return db['WhatsappInteraction'][_0xbe43('0x38')]({'where':{'id':_0xdbeeab[_0xbe43('0x3b')]['id']}})[_0xbe43('0x1c')](handleEntityNotFound(_0x3321d5,null))[_0xbe43('0x1c')](function(_0x18a485){if(_0x18a485){return _0x18a485[_0xbe43('0x53')](_0xdbeeab[_0xbe43('0x2a')][_0xbe43('0x3f')]);}})['then'](respondWithStatusCode(_0x3321d5,null))[_0xbe43('0x2c')](handleError(_0x3321d5,null));};exports[_0xbe43('0x54')]=function(_0x440641,_0xa0aef1){var _0x50e43b=moment()['unix']()[_0xbe43('0x55')]();var _0x58147a=path[_0xbe43('0x56')](config['root'],'server',_0xbe43('0x57'),_0xbe43('0x58'));var _0x32e455=path['join'](config[_0xbe43('0x59')],'server',_0xbe43('0x57'),_0xbe43('0x5a'));var _0x52bda2=path[_0xbe43('0x56')](_0x58147a,_0x50e43b);var _0x4b476a=util['format']('transcript-%d-%s.zip',_0x440641[_0xbe43('0x3b')]['id'],_0x50e43b);var _0x587e5a=path[_0xbe43('0x56')](_0x58147a,_0x4b476a);var _0x52a936=[];_0x52a936[_0xbe43('0x5b')]({'model':db[_0xbe43('0x5c')],'as':'User','attributes':['id',_0xbe43('0x5d')],'raw':!![]});_0x52a936[_0xbe43('0x5b')]({'model':db[_0xbe43('0x5e')],'as':_0xbe43('0x5f'),'attributes':['id','firstName',_0xbe43('0x60')],'raw':!![]});if(_0x440641['query'][_0xbe43('0x5a')]){_0x52a936['push']({'model':db[_0xbe43('0x61')],'as':'Attachment','raw':!![]});}var _0x3941b4=[{'model':db[_0xbe43('0x3d')],'as':_0xbe43('0x62'),'attributes':['id','body','createdAt',_0xbe43('0x63'),_0xbe43('0x64'),'read'],'include':_0x52a936}];_0x3941b4[_0xbe43('0x5b')]({'model':db[_0xbe43('0x65')],'as':'Account','attributes':['id',_0xbe43('0x21')]});_0x3941b4[_0xbe43('0x5b')]({'model':db[_0xbe43('0x5c')],'as':_0xbe43('0x66'),'attributes':['id',_0xbe43('0x5d')]});return db[_0xbe43('0x24')][_0xbe43('0x38')]({'where':{'id':_0x440641['params']['id']},'include':_0x3941b4})['then'](handleEntityNotFound(_0xa0aef1,null))[_0xbe43('0x1c')](function(_0xab8c8e){if(_0xab8c8e){var _0x23c46c=_0xab8c8e['get']({'plain':!![]});fs[_0xbe43('0x67')](_0x52bda2);var _0x5bf43d={'channel':_0xbe43('0x68'),'account':_0x23c46c[_0xbe43('0x69')][_0xbe43('0x21')],'agent':_0x23c46c[_0xbe43('0x66')]?_0x23c46c[_0xbe43('0x66')][_0xbe43('0x5d')]:'N.A.','createdAt':moment(_0x23c46c[_0xbe43('0x6a')])[_0xbe43('0x6b')]('YYYY-MM-DD\x20HH:mm:ss')[_0xbe43('0x55')](),'closedAt':_0x23c46c['closed']?moment(_0x23c46c[_0xbe43('0x6c')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xbe43('0x55')]():'','disposition':_0x23c46c[_0xbe43('0x6d')],'messages':_(_0x23c46c['Messages'])[_0xbe43('0x49')]({'secret':![]})[_0xbe43('0x23')](function(_0x157e3d){if(_0x157e3d[_0xbe43('0x61')]){var _0x43ddf8=path[_0xbe43('0x56')](_0x32e455,_0x157e3d[_0xbe43('0x61')][_0xbe43('0x6e')]);if(fs[_0xbe43('0x6f')](_0x43ddf8)){fs[_0xbe43('0x70')](_0x43ddf8)['pipe'](fs[_0xbe43('0x71')](path[_0xbe43('0x56')](_0x52bda2,_0x157e3d[_0xbe43('0x61')][_0xbe43('0x6e')])));}}return{'date':moment(_0x157e3d['createdAt'])[_0xbe43('0x6b')](_0xbe43('0x4c'))[_0xbe43('0x55')](),'sender':_0x157e3d[_0xbe43('0x63')]===_0xbe43('0x72')?_0x157e3d['User']?_0x157e3d[_0xbe43('0x5c')][_0xbe43('0x5d')]:_0xbe43('0x73'):_0x157e3d[_0xbe43('0x5f')][_0xbe43('0x74')]+(_0x157e3d[_0xbe43('0x5f')][_0xbe43('0x60')]?'\x20'+_0x157e3d['Contact']['lastName']:''),'body':_0x157e3d[_0xbe43('0x61')]?_0x157e3d[_0xbe43('0x61')][_0xbe43('0x6e')]:_0x157e3d[_0xbe43('0x3a')],'direction':_0x157e3d[_0xbe43('0x63')]===_0xbe43('0x72')?'A':'C','secret':_0x157e3d[_0xbe43('0x64')],'read':_0x157e3d[_0xbe43('0x75')],'attachment':_0x157e3d['Attachment']};})[_0xbe43('0x76')]()};return ejs[_0xbe43('0x77')](path['join'](config[_0xbe43('0x59')],_0xbe43('0x78'),_0xbe43('0x79'),_0xbe43('0x7a')),{'interaction':_0x5bf43d})[_0xbe43('0x1c')](function(_0x39fd99){var _0x57a6fe=path['join'](_0x52bda2,_0xbe43('0x7b')+_0x23c46c['id']+'-'+_0x50e43b+_0xbe43('0x7c'));var _0x31c002={'path':_0x57a6fe,'channel':_0xbe43('0x68'),'interactionId':_0x23c46c['id']};return pdf['createPdfFromHTML'](_0x39fd99,_0x31c002);})[_0xbe43('0x1c')](function(){return new BPromise(function(_0x2e57fd,_0x42196c){zipdir(_0x52bda2,{'saveTo':_0x587e5a},function(_0x5ecec5,_0x48eb2b){if(_0x5ecec5)return _0x42196c(_0x5ecec5);return _0x2e57fd(_0x48eb2b);});})[_0xbe43('0x1c')](function(){return new BPromise(function(_0x2e5dbd,_0x375cca){rimraf(_0x52bda2,function(_0x32764c){if(_0x32764c)_0x375cca(_0x32764c);return _0x2e5dbd();});});})[_0xbe43('0x1c')](function(){return _0xa0aef1[_0xbe43('0x54')](_0x587e5a,_0x4b476a,function(_0x70d3c4){if(_0x70d3c4){console[_0xbe43('0x7d')]('err',_0x70d3c4);}else{fs['unlinkSync'](_0x587e5a);}});});});}else{return _0xa0aef1[_0xbe43('0x12')](0xc8);}})[_0xbe43('0x2c')](handleError(_0xa0aef1,null));}; \ No newline at end of file +var _0x46ad=['../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','update','then','stack','name','send','rawAttributes','fieldName','type','key','getOptions','findAll','query','user','catch','show','model','keys','filters','intersection','fields','attributes','length','include','merge','options','WhatsappInteraction','create','body','find','params','destroy','describe','addMessage','WhatsappMessage','ids','findOne','hasOwnProperty','nolimit','sort','where','pick','filter','map','$gte','split','includeAll','setTags','omit','Tag','whatsappInteractionTags:save','removeTags','download','join','server','files','tmp','attachments','format','transcript-%d-%s.zip','push','User','CmContact','firstName','lastName','Attachment','Messages','createdAt','Account','Owner','get','mkdirSync','Whatsapp','fullname','toString','closed','disposition','existsSync','createReadStream','pipe','createWriteStream','basename','out','Contact','direction','secret','read','value','renderFile','root','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','rimraf','zip-dir','moment','bluebird','path','ejs','lodash','ioredis'];(function(_0x4e1bd3,_0xda464d){var _0x234e83=function(_0x144f4d){while(--_0x144f4d){_0x4e1bd3['push'](_0x4e1bd3['shift']());}};_0x234e83(++_0xda464d);}(_0x46ad,0x73));var _0xd46a=function(_0x386f48,_0x5a23e9){_0x386f48=_0x386f48-0x0;var _0x2a5fad=_0x46ad[_0x386f48];return _0x2a5fad;};'use strict';var rimraf=require(_0xd46a('0x0'));var zipdir=require(_0xd46a('0x1'));var moment=require(_0xd46a('0x2'));var BPromise=require(_0xd46a('0x3'));var util=require('util');var path=require(_0xd46a('0x4'));var ejs=require(_0xd46a('0x5'));var fs=require('fs');var _=require(_0xd46a('0x6'));var Redis=require(_0xd46a('0x7'));var interaction=require(_0xd46a('0x8'));var qs=require(_0xd46a('0x9'));var pdf=require(_0xd46a('0xa'));var logger=require(_0xd46a('0xb'))('api');var config=require(_0xd46a('0xc'));var db=require(_0xd46a('0xd'))['db'];config['redis']=_['defaults'](config[_0xd46a('0xe')],{'host':_0xd46a('0xf'),'port':0x18eb});var socket=require(_0xd46a('0x10'))(new Redis(config[_0xd46a('0xe')]));require(_0xd46a('0x11'))[_0xd46a('0x12')](socket);function respondWithStatusCode(_0x2e9e0f,_0x39ff43){_0x39ff43=_0x39ff43||0xcc;return function(_0x2a9066){if(_0x2a9066){return _0x2e9e0f[_0xd46a('0x13')](_0x39ff43);}return _0x2e9e0f[_0xd46a('0x14')](_0x39ff43)[_0xd46a('0x15')]();};}function respondWithResult(_0x48d0b6,_0x4a42a8){_0x4a42a8=_0x4a42a8||0xc8;return function(_0x69d642){if(_0x69d642){return _0x48d0b6['status'](_0x4a42a8)[_0xd46a('0x16')](_0x69d642);}};}function respondWithFilteredResult(_0x7914c5,_0x4b1091){return function(_0xb88f78){if(_0xb88f78){var _0x2d4c0b=typeof _0x4b1091[_0xd46a('0x17')]===_0xd46a('0x18')&&typeof _0x4b1091[_0xd46a('0x19')]===_0xd46a('0x18');var _0x3dcfc2=_0xb88f78[_0xd46a('0x1a')];var _0x327a6b=_0x2d4c0b?0x0:_0x4b1091['offset'];var _0x48f434=_0x2d4c0b?_0xb88f78[_0xd46a('0x1a')]:_0x4b1091[_0xd46a('0x17')]+_0x4b1091[_0xd46a('0x19')];var _0x1fa2a6;if(_0x48f434>=_0x3dcfc2){_0x48f434=_0x3dcfc2;_0x1fa2a6=0xc8;}else{_0x1fa2a6=0xce;}_0x7914c5['status'](_0x1fa2a6);return _0x7914c5[_0xd46a('0x1b')]('Content-Range',_0x327a6b+'-'+_0x48f434+'/'+_0x3dcfc2)['json'](_0xb88f78);}return null;};}function saveUpdates(_0x4e578c){return function(_0x4118fa){if(_0x4118fa){return _0x4118fa[_0xd46a('0x1c')](_0x4e578c)['then'](function(_0x10c045){return _0x10c045;});}return null;};}function removeEntity(_0xc1dc2a){return function(_0x93e2f5){if(_0x93e2f5){return _0x93e2f5['destroy']()[_0xd46a('0x1d')](function(){_0xc1dc2a[_0xd46a('0x14')](0xcc)[_0xd46a('0x15')]();});}};}function handleEntityNotFound(_0x160882){return function(_0x4841a0){if(!_0x4841a0){_0x160882[_0xd46a('0x13')](0x194);}return _0x4841a0;};}function handleError(_0x5e97b8,_0x12ed9b){_0x12ed9b=_0x12ed9b||0x1f4;return function(_0xfb7e2c){logger['error'](_0xfb7e2c[_0xd46a('0x1e')]);if(_0xfb7e2c[_0xd46a('0x1f')]){delete _0xfb7e2c[_0xd46a('0x1f')];}_0x5e97b8['status'](_0x12ed9b)[_0xd46a('0x20')](_0xfb7e2c);};}exports['index']=function(_0x598ace,_0x3200d2){var _0x4f1672={};var _0x3b7672=_['map'](db['WhatsappInteraction'][_0xd46a('0x21')],function(_0x498427){return{'name':_0x498427[_0xd46a('0x22')],'type':_0x498427[_0xd46a('0x23')][_0xd46a('0x24')]};});_0x4f1672=qs[_0xd46a('0x25')](_0x3b7672,_0x598ace);return interaction[_0xd46a('0x26')]('whatsapp',_0x598ace[_0xd46a('0x27')],_0x598ace[_0xd46a('0x28')],_0x4f1672,_0x3b7672)[_0xd46a('0x1d')](respondWithFilteredResult(_0x3200d2,_0x4f1672))[_0xd46a('0x29')](handleError(_0x3200d2,null));};exports[_0xd46a('0x2a')]=function(_0x25d362,_0x3e58e9){var _0x5bac49={'raw':![],'where':{'id':_0x25d362['params']['id']}},_0x3c895d={};_0x3c895d[_0xd46a('0x2b')]=_[_0xd46a('0x2c')](db['WhatsappInteraction']['rawAttributes']);_0x3c895d[_0xd46a('0x27')]=_[_0xd46a('0x2c')](_0x25d362['query']);_0x3c895d[_0xd46a('0x2d')]=_[_0xd46a('0x2e')](_0x3c895d[_0xd46a('0x2b')],_0x3c895d[_0xd46a('0x27')]);_0x5bac49['attributes']=_['intersection'](_0x3c895d[_0xd46a('0x2b')],qs[_0xd46a('0x2f')](_0x25d362[_0xd46a('0x27')]['fields']));_0x5bac49[_0xd46a('0x30')]=_0x5bac49[_0xd46a('0x30')][_0xd46a('0x31')]?_0x5bac49[_0xd46a('0x30')]:_0x3c895d[_0xd46a('0x2b')];if(_0x25d362[_0xd46a('0x27')]['includeAll']){_0x5bac49[_0xd46a('0x32')]=[{'all':!![]}];}_0x5bac49=_[_0xd46a('0x33')]({},_0x5bac49,_0x25d362[_0xd46a('0x34')]);return db[_0xd46a('0x35')]['find'](_0x5bac49)[_0xd46a('0x1d')](handleEntityNotFound(_0x3e58e9,null))[_0xd46a('0x1d')](respondWithResult(_0x3e58e9,null))[_0xd46a('0x29')](handleError(_0x3e58e9,null));};exports[_0xd46a('0x36')]=function(_0x5d776c,_0x30753a){return db['WhatsappInteraction'][_0xd46a('0x36')](_0x5d776c[_0xd46a('0x37')],{})['then'](respondWithResult(_0x30753a,0xc9))[_0xd46a('0x29')](handleError(_0x30753a,null));};exports[_0xd46a('0x1c')]=function(_0x407237,_0xb52186){if(_0x407237[_0xd46a('0x37')]['id']){delete _0x407237[_0xd46a('0x37')]['id'];}return db[_0xd46a('0x35')][_0xd46a('0x38')]({'where':{'id':_0x407237[_0xd46a('0x39')]['id']}})['then'](handleEntityNotFound(_0xb52186,null))[_0xd46a('0x1d')](saveUpdates(_0x407237['body'],null))['then'](respondWithResult(_0xb52186,null))['catch'](handleError(_0xb52186,null));};exports[_0xd46a('0x3a')]=function(_0x24c1ee,_0x388cae){return db[_0xd46a('0x35')][_0xd46a('0x38')]({'where':{'id':_0x24c1ee['params']['id']}})['then'](handleEntityNotFound(_0x388cae,null))[_0xd46a('0x1d')](removeEntity(_0x388cae,null))[_0xd46a('0x29')](handleError(_0x388cae,null));};exports[_0xd46a('0x3b')]=function(_0x4b6f45,_0x33756c){return db[_0xd46a('0x35')][_0xd46a('0x3b')]()[_0xd46a('0x1d')](respondWithResult(_0x33756c,null))[_0xd46a('0x29')](handleError(_0x33756c,null));};exports[_0xd46a('0x3c')]=function(_0xd7767d,_0x2123f5){return db[_0xd46a('0x3d')][_0xd46a('0x38')]({'where':{'id':_0xd7767d[_0xd46a('0x39')]['id']}})[_0xd46a('0x1d')](handleEntityNotFound(_0x2123f5,null))['then'](function(_0xee8ba5){if(_0xee8ba5){return _0xee8ba5[_0xd46a('0x3c')](_0xd7767d[_0xd46a('0x37')][_0xd46a('0x3e')],_['omit'](_0xd7767d[_0xd46a('0x37')],[_0xd46a('0x3e'),'id'])||{});}})[_0xd46a('0x1d')](respondWithResult(_0x2123f5,null))[_0xd46a('0x29')](handleError(_0x2123f5,null));};exports['getMessages']=function(_0x211da5,_0x5f05e0){var _0x4a50c8={'raw':![],'where':{}};var _0x10c03a={};var _0x21d164={'count':0x0,'rows':[]};return db[_0xd46a('0x35')][_0xd46a('0x3f')]({'where':{'id':_0x211da5[_0xd46a('0x39')]['id']}})['then'](handleEntityNotFound(_0x5f05e0,null))[_0xd46a('0x1d')](function(_0x1942b3){if(_0x1942b3){_0x10c03a[_0xd46a('0x2b')]=_[_0xd46a('0x2c')](db[_0xd46a('0x3d')]['rawAttributes']);_0x10c03a[_0xd46a('0x27')]=_[_0xd46a('0x2c')](_0x211da5[_0xd46a('0x27')]);_0x10c03a[_0xd46a('0x2d')]=_['intersection'](_0x10c03a[_0xd46a('0x2b')],_0x10c03a[_0xd46a('0x27')]);_0x4a50c8[_0xd46a('0x30')]=_['intersection'](_0x10c03a[_0xd46a('0x2b')],qs[_0xd46a('0x2f')](_0x211da5[_0xd46a('0x27')][_0xd46a('0x2f')]));_0x4a50c8[_0xd46a('0x30')]=_0x4a50c8[_0xd46a('0x30')][_0xd46a('0x31')]?_0x4a50c8[_0xd46a('0x30')]:_0x10c03a[_0xd46a('0x2b')];if(!_0x211da5[_0xd46a('0x27')][_0xd46a('0x40')](_0xd46a('0x41'))){_0x4a50c8[_0xd46a('0x19')]=qs[_0xd46a('0x19')](_0x211da5['query']['limit']);_0x4a50c8[_0xd46a('0x17')]=qs['offset'](_0x211da5['query']['offset']);}_0x4a50c8['order']=qs['sort'](_0x211da5[_0xd46a('0x27')][_0xd46a('0x42')]);_0x4a50c8[_0xd46a('0x43')]=qs[_0xd46a('0x2d')](_[_0xd46a('0x44')](_0x211da5['query'],_0x10c03a[_0xd46a('0x2d')]));_0x4a50c8['where']['WhatsappInteractionId']=_0x1942b3['id'];if(_0x211da5['query'][_0xd46a('0x45')]){_0x4a50c8[_0xd46a('0x43')]=_[_0xd46a('0x33')](_0x4a50c8[_0xd46a('0x43')],{'$or':_[_0xd46a('0x46')](_0x4a50c8[_0xd46a('0x30')],function(_0x190818){var _0x13bd91={};_0x13bd91[_0x190818]={'$like':'%'+_0x211da5[_0xd46a('0x27')][_0xd46a('0x45')]+'%'};return _0x13bd91;})});}if(_0x211da5[_0xd46a('0x27')][_0xd46a('0x47')]){var _0x4a90a2=_0x211da5[_0xd46a('0x27')]['$gte'][_0xd46a('0x48')](',');var _0x584bb8={};_0x584bb8[_0x4a90a2[0x0]]={'$gte':moment(_0x4a90a2[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x4a50c8['where']=_[_0xd46a('0x33')](_0x4a50c8['where'],_0x584bb8);}_0x4a50c8=_['merge']({},_0x4a50c8,_0x211da5[_0xd46a('0x34')]);return db['WhatsappMessage'][_0xd46a('0x1a')]({'where':_0x4a50c8['where']})[_0xd46a('0x1d')](function(_0xea4afe){_0x21d164[_0xd46a('0x1a')]=_0xea4afe;if(_0x211da5[_0xd46a('0x27')][_0xd46a('0x49')]){_0x4a50c8[_0xd46a('0x32')]=[{'all':!![]}];}return db[_0xd46a('0x3d')][_0xd46a('0x26')](_0x4a50c8);})[_0xd46a('0x1d')](function(_0xcfff88){_0x21d164['rows']=_0xcfff88;return _0x21d164;});}})[_0xd46a('0x1d')](respondWithFilteredResult(_0x5f05e0,_0x4a50c8))[_0xd46a('0x29')](handleError(_0x5f05e0,null));};exports['addTags']=function(_0x7a9a02,_0xe53769){return db[_0xd46a('0x35')][_0xd46a('0x38')]({'where':{'id':_0x7a9a02[_0xd46a('0x39')]['id']}})[_0xd46a('0x1d')](handleEntityNotFound(_0xe53769,null))[_0xd46a('0x1d')](function(_0x3edff6){if(_0x3edff6){return _0x3edff6[_0xd46a('0x4a')](_0x7a9a02['body'][_0xd46a('0x3e')],_[_0xd46a('0x4b')](_0x7a9a02[_0xd46a('0x37')],[_0xd46a('0x3e'),'id'])||{})['spread'](function(){return db[_0xd46a('0x4c')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x7a9a02[_0xd46a('0x37')][_0xd46a('0x3e')]}});})[_0xd46a('0x1d')](function(_0x285487){socket['emit'](_0xd46a('0x4d'),{'id':Number(_0x7a9a02[_0xd46a('0x39')]['id']),'tags':_0x285487||[]});return{'id':Number(_0x7a9a02[_0xd46a('0x39')]['id']),'tags':_0x285487||[]};});}})['then'](respondWithResult(_0xe53769,null))[_0xd46a('0x29')](handleError(_0xe53769,null));};exports[_0xd46a('0x4e')]=function(_0x5a3bb6,_0x1ccf36){return db[_0xd46a('0x35')]['find']({'where':{'id':_0x5a3bb6[_0xd46a('0x39')]['id']}})[_0xd46a('0x1d')](handleEntityNotFound(_0x1ccf36,null))[_0xd46a('0x1d')](function(_0x315b92){if(_0x315b92){return _0x315b92[_0xd46a('0x4e')](_0x5a3bb6[_0xd46a('0x27')][_0xd46a('0x3e')]);}})[_0xd46a('0x1d')](respondWithStatusCode(_0x1ccf36,null))[_0xd46a('0x29')](handleError(_0x1ccf36,null));};exports[_0xd46a('0x4f')]=function(_0x5ec4c0,_0x472832){var _0x2f10ea=moment()['unix']()['toString']();var _0x456371=path[_0xd46a('0x50')](config['root'],_0xd46a('0x51'),_0xd46a('0x52'),_0xd46a('0x53'));var _0x2c649e=path['join'](config['root'],_0xd46a('0x51'),'files',_0xd46a('0x54'));var _0x4fd334=path['join'](_0x456371,_0x2f10ea);var _0x4924f2=util[_0xd46a('0x55')](_0xd46a('0x56'),_0x5ec4c0[_0xd46a('0x39')]['id'],_0x2f10ea);var _0x111ba9=path[_0xd46a('0x50')](_0x456371,_0x4924f2);var _0x3ee557=[];_0x3ee557[_0xd46a('0x57')]({'model':db[_0xd46a('0x58')],'as':_0xd46a('0x58'),'attributes':['id','fullname'],'raw':!![]});_0x3ee557[_0xd46a('0x57')]({'model':db[_0xd46a('0x59')],'as':'Contact','attributes':['id',_0xd46a('0x5a'),_0xd46a('0x5b')],'raw':!![]});if(_0x5ec4c0['query'][_0xd46a('0x54')]){_0x3ee557['push']({'model':db[_0xd46a('0x5c')],'as':_0xd46a('0x5c'),'raw':!![]});}var _0x183d53=[{'model':db[_0xd46a('0x3d')],'as':_0xd46a('0x5d'),'attributes':['id',_0xd46a('0x37'),_0xd46a('0x5e'),'direction','secret','read'],'include':_0x3ee557}];_0x183d53[_0xd46a('0x57')]({'model':db['WhatsappAccount'],'as':_0xd46a('0x5f'),'attributes':['id',_0xd46a('0x1f')]});_0x183d53[_0xd46a('0x57')]({'model':db['User'],'as':_0xd46a('0x60'),'attributes':['id','fullname']});return db['WhatsappInteraction'][_0xd46a('0x38')]({'where':{'id':_0x5ec4c0[_0xd46a('0x39')]['id']},'include':_0x183d53})[_0xd46a('0x1d')](handleEntityNotFound(_0x472832,null))[_0xd46a('0x1d')](function(_0x253e7c){if(_0x253e7c){var _0x4baf9f=_0x253e7c[_0xd46a('0x61')]({'plain':!![]});fs[_0xd46a('0x62')](_0x4fd334);var _0x39d50a={'channel':_0xd46a('0x63'),'account':_0x4baf9f[_0xd46a('0x5f')]['name'],'agent':_0x4baf9f['Owner']?_0x4baf9f['Owner'][_0xd46a('0x64')]:'N.A.','createdAt':moment(_0x4baf9f[_0xd46a('0x5e')])[_0xd46a('0x55')]('YYYY-MM-DD\x20HH:mm:ss')[_0xd46a('0x65')](),'closedAt':_0x4baf9f[_0xd46a('0x66')]?moment(_0x4baf9f['closedAt'])[_0xd46a('0x55')]('YYYY-MM-DD\x20HH:mm:ss')[_0xd46a('0x65')]():'','disposition':_0x4baf9f[_0xd46a('0x67')],'messages':_(_0x4baf9f[_0xd46a('0x5d')])[_0xd46a('0x45')]({'secret':![]})[_0xd46a('0x46')](function(_0x329f18){if(_0x329f18[_0xd46a('0x5c')]){var _0xb22b26=path[_0xd46a('0x50')](_0x2c649e,_0x329f18[_0xd46a('0x5c')]['basename']);if(fs[_0xd46a('0x68')](_0xb22b26)){fs[_0xd46a('0x69')](_0xb22b26)[_0xd46a('0x6a')](fs[_0xd46a('0x6b')](path[_0xd46a('0x50')](_0x4fd334,_0x329f18[_0xd46a('0x5c')][_0xd46a('0x6c')])));}}return{'date':moment(_0x329f18['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xd46a('0x65')](),'sender':_0x329f18['direction']===_0xd46a('0x6d')?_0x329f18[_0xd46a('0x58')]?_0x329f18[_0xd46a('0x58')][_0xd46a('0x64')]:'System':_0x329f18[_0xd46a('0x6e')][_0xd46a('0x5a')]+(_0x329f18[_0xd46a('0x6e')][_0xd46a('0x5b')]?'\x20'+_0x329f18[_0xd46a('0x6e')][_0xd46a('0x5b')]:''),'body':_0x329f18[_0xd46a('0x5c')]?_0x329f18['Attachment']['basename']:_0x329f18[_0xd46a('0x37')],'direction':_0x329f18[_0xd46a('0x6f')]===_0xd46a('0x6d')?'A':'C','secret':_0x329f18[_0xd46a('0x70')],'read':_0x329f18[_0xd46a('0x71')],'attachment':_0x329f18[_0xd46a('0x5c')]};})[_0xd46a('0x72')]()};return ejs[_0xd46a('0x73')](path[_0xd46a('0x50')](config[_0xd46a('0x74')],_0xd46a('0x51'),_0xd46a('0x75'),_0xd46a('0x76')),{'interaction':_0x39d50a})[_0xd46a('0x1d')](function(_0x2c0fa9){var _0x4f06ba=path[_0xd46a('0x50')](_0x4fd334,_0xd46a('0x77')+_0x4baf9f['id']+'-'+_0x2f10ea+_0xd46a('0x78'));var _0x2360a5={'path':_0x4f06ba,'channel':_0xd46a('0x63'),'interactionId':_0x4baf9f['id']};return pdf[_0xd46a('0x79')](_0x2c0fa9,_0x2360a5);})[_0xd46a('0x1d')](function(){return new BPromise(function(_0x65396,_0x4ddd4f){zipdir(_0x4fd334,{'saveTo':_0x111ba9},function(_0x57eedb,_0x577dc7){if(_0x57eedb)return _0x4ddd4f(_0x57eedb);return _0x65396(_0x577dc7);});})[_0xd46a('0x1d')](function(){return new BPromise(function(_0x3cb6f9,_0xe2b6c7){rimraf(_0x4fd334,function(_0x1cde49){if(_0x1cde49)_0xe2b6c7(_0x1cde49);return _0x3cb6f9();});});})[_0xd46a('0x1d')](function(){return _0x472832['download'](_0x111ba9,_0x4924f2,function(_0xbf7df9){if(_0xbf7df9){console['log'](_0xd46a('0x7a'),_0xbf7df9);}else{fs['unlinkSync'](_0x111ba9);}});});});}else{return _0x472832[_0xd46a('0x13')](0xc8);}})[_0xd46a('0x29')](handleError(_0x472832,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 01be864..6750fd9 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 _0xc36d=['map','unreadMessages','length','emit','catch','hasOwnProperty','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users'];(function(_0x50e1a4,_0x520140){var _0x4f6940=function(_0x1bdad3){while(--_0x1bdad3){_0x50e1a4['push'](_0x50e1a4['shift']());}};_0x4f6940(++_0x520140);}(_0xc36d,0x7d));var _0xdc36=function(_0x1e6e4e,_0x2b1b09){_0x1e6e4e=_0x1e6e4e-0x0;var _0x3d746b=_0xc36d[_0x1e6e4e];return _0x3d746b;};'use strict';var EventEmitter=require(_0xdc36('0x0'));var WhatsappInteraction=require(_0xdc36('0x1'))['db'][_0xdc36('0x2')];var WhatsappMessage=require(_0xdc36('0x1'))['db'][_0xdc36('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xdc36('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdc36('0x5'),'afterDestroy':_0xdc36('0x6')};function emitEvent(_0x53ac17){return function(_0x18c8fe,_0xbc5223,_0x186c58){_0x18c8fe[_0xdc36('0x7')]({'attributes':['id'],'raw':!![]})[_0xdc36('0x8')](function(_0x571311){_0x18c8fe[_0xdc36('0x9')](_0xdc36('0xa'),_0x571311[_0xdc36('0xb')](function(_0xdca7f7){return{'id':_0xdca7f7['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x18c8fe['id'],'direction':'in','read':![]},'raw':!![]});})[_0xdc36('0x8')](function(_0x23956b){_0x18c8fe['setDataValue'](_0xdc36('0xc'),_0x23956b[_0xdc36('0xd')]);WhatsappInteractionEvents[_0xdc36('0xe')](_0x53ac17+':'+_0x18c8fe['id'],_0x18c8fe);WhatsappInteractionEvents['emit'](_0x53ac17,_0x18c8fe);_0x186c58(null);})[_0xdc36('0xf')](_0x186c58(null));};}for(var e in events){if(events[_0xdc36('0x10')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0x688a=['Users','map','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','save','update','getUsers','then'];(function(_0x105714,_0x56b088){var _0x4cff9b=function(_0x730f6a){while(--_0x730f6a){_0x105714['push'](_0x105714['shift']());}};_0x4cff9b(++_0x56b088);}(_0x688a,0x124));var _0xa688=function(_0x36412c,_0x561a08){_0x36412c=_0x36412c-0x0;var _0x260ece=_0x688a[_0x36412c];return _0x260ece;};'use strict';var EventEmitter=require(_0xa688('0x0'));var WhatsappInteraction=require(_0xa688('0x1'))['db'][_0xa688('0x2')];var WhatsappMessage=require('../../mysqldb')['db'][_0xa688('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa688('0x4'),'afterUpdate':_0xa688('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4a9122){return function(_0x415030,_0x27e6c4,_0x45b3ca){_0x415030[_0xa688('0x6')]({'attributes':['id'],'raw':!![]})[_0xa688('0x7')](function(_0x49e75d){_0x415030['setDataValue'](_0xa688('0x8'),_0x49e75d[_0xa688('0x9')](function(_0x1ab9f2){return{'id':_0x1ab9f2['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x415030['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x42b94e){_0x415030['setDataValue']('unreadMessages',_0x42b94e[_0xa688('0xa')]);WhatsappInteractionEvents[_0xa688('0xb')](_0x4a9122+':'+_0x415030['id'],_0x415030);WhatsappInteractionEvents[_0xa688('0xb')](_0x4a9122,_0x415030);_0x45b3ca(null);})[_0xa688('0xc')](_0x45b3ca(null));};}for(var e in events){if(events[_0xa688('0xd')](e)){var event=events[e];WhatsappInteraction[_0xa688('0xe')](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 0ad0e1d..39edfb9 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 _0x11e7=['changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','request-promise','../../config/environment','./whatsappInteraction.attributes','define','WhatsappInteraction'];(function(_0x1a1b6e,_0x3a07a9){var _0x571e2c=function(_0x6cea62){while(--_0x6cea62){_0x1a1b6e['push'](_0x1a1b6e['shift']());}};_0x571e2c(++_0x3a07a9);}(_0x11e7,0x1d8));var _0x711e=function(_0x18d5ba,_0x3fe75b){_0x18d5ba=_0x18d5ba-0x0;var _0x1f0a7e=_0x11e7[_0x18d5ba];return _0x1f0a7e;};'use strict';var _=require(_0x711e('0x0'));var util=require(_0x711e('0x1'));var logger=require(_0x711e('0x2'))(_0x711e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x711e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x711e('0x5'));var attributes=require(_0x711e('0x6'));module['exports']=function(_0x60f3f6,_0xc997ff){return _0x60f3f6[_0x711e('0x7')](_0x711e('0x8'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x51b812,_0x174a67,_0x330980){if(_0x51b812[_0x711e('0x9')](_0x711e('0xa'))){_0x51b812[_0x711e('0xb')]=moment()['format'](_0x711e('0xc'));}_0x330980(null,_0x51b812);}}});}; \ No newline at end of file +var _0x2a1b=['WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define'];(function(_0x12c557,_0x5ce124){var _0x23c89c=function(_0x3dfd13){while(--_0x3dfd13){_0x12c557['push'](_0x12c557['shift']());}};_0x23c89c(++_0x5ce124);}(_0x2a1b,0x18d));var _0xb2a1=function(_0x19ed60,_0x5525fa){_0x19ed60=_0x19ed60-0x0;var _0x4f5246=_0x2a1b[_0x19ed60];return _0x4f5246;};'use strict';var _=require(_0xb2a1('0x0'));var util=require(_0xb2a1('0x1'));var logger=require(_0xb2a1('0x2'))('api');var moment=require(_0xb2a1('0x3'));var BPromise=require('bluebird');var rp=require(_0xb2a1('0x4'));var fs=require('fs');var path=require(_0xb2a1('0x5'));var rimraf=require(_0xb2a1('0x6'));var config=require(_0xb2a1('0x7'));var attributes=require(_0xb2a1('0x8'));module[_0xb2a1('0x9')]=function(_0xc7df80,_0xde3318){return _0xc7df80[_0xb2a1('0xa')](_0xb2a1('0xb'),attributes,{'tableName':_0xb2a1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xaff406,_0x20910b,_0x5d5a17){if(_0xaff406[_0xb2a1('0xd')](_0xb2a1('0xe'))){_0xaff406[_0xb2a1('0xf')]=moment()[_0xb2a1('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5d5a17(null,_0xaff406);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 3c655a3..173511b 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 _0xe100=['./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options','where','attributes','limit','stringify','AddTagsToWhatsappInteraction','find','addTags','body','ids','omit','AddTags','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter'];(function(_0x378862,_0x5e87f9){var _0x1061f1=function(_0x266560){while(--_0x266560){_0x378862['push'](_0x378862['shift']());}};_0x1061f1(++_0x5e87f9);}(_0xe100,0x1e9));var _0x0e10=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe100[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x0e10('0x0'));var util=require(_0x0e10('0x1'));var moment=require(_0x0e10('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0e10('0x3'))['db'];var utils=require(_0x0e10('0x4'));var logger=require(_0x0e10('0x5'))(_0x0e10('0x6'));var config=require(_0x0e10('0x7'));var jayson=require(_0x0e10('0x8'));var client=jayson[_0x0e10('0x9')][_0x0e10('0xa')]({'port':0x232a});config['redis']=_[_0x0e10('0xb')](config[_0x0e10('0xc')],{'host':_0x0e10('0xd'),'port':0x18eb});var socket=require(_0x0e10('0xe'))(new Redis(config['redis']));require(_0x0e10('0xf'))[_0x0e10('0x10')](socket);function respondWithRpcPromise(_0x47ae6a,_0x56d245,_0x43a499){return new BPromise(function(_0x24d4d6,_0x5a5de1){return client[_0x0e10('0x11')](_0x47ae6a,_0x43a499)[_0x0e10('0x12')](function(_0x4551a1){logger[_0x0e10('0x13')](_0x0e10('0x14'),_0x56d245,_0x0e10('0x15'));logger[_0x0e10('0x16')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x56d245,_0x0e10('0x15'),JSON['stringify'](_0x4551a1));if(_0x4551a1[_0x0e10('0x17')]){if(_0x4551a1['error']['code']===0x1f4){logger[_0x0e10('0x17')](_0x0e10('0x14'),_0x56d245,_0x4551a1['error'][_0x0e10('0x18')]);return _0x5a5de1(_0x4551a1['error'][_0x0e10('0x18')]);}logger[_0x0e10('0x17')](_0x0e10('0x14'),_0x56d245,_0x4551a1[_0x0e10('0x17')][_0x0e10('0x18')]);return _0x24d4d6(_0x4551a1[_0x0e10('0x17')][_0x0e10('0x18')]);}else{logger[_0x0e10('0x13')]('WhatsappInteraction,\x20%s,\x20%s',_0x56d245,_0x0e10('0x15'));_0x24d4d6(_0x4551a1[_0x0e10('0x19')][_0x0e10('0x18')]);}})[_0x0e10('0x1a')](function(_0x481b4c){logger[_0x0e10('0x17')](_0x0e10('0x14'),_0x56d245,_0x481b4c);_0x5a5de1(_0x481b4c);});});}exports[_0x0e10('0x1b')]=function(_0x3fbf34){var _0x24de57=this;return new Promise(function(_0x7335a6,_0x2f95ca){return db[_0x0e10('0x1c')][_0x0e10('0x1d')](_0x3fbf34['body'],{'raw':_0x3fbf34[_0x0e10('0x1e')]?_0x3fbf34[_0x0e10('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fbf34[_0x0e10('0x1e')]?_0x3fbf34[_0x0e10('0x1e')][_0x0e10('0x1f')]||null:null,'attributes':_0x3fbf34[_0x0e10('0x1e')]?_0x3fbf34[_0x0e10('0x1e')][_0x0e10('0x20')]||null:null,'limit':_0x3fbf34['options']?_0x3fbf34[_0x0e10('0x1e')][_0x0e10('0x21')]||null:null})[_0x0e10('0x12')](function(_0x5d5831){logger[_0x0e10('0x13')](_0x0e10('0x1b'),_0x3fbf34);logger['debug'](_0x0e10('0x1b'),_0x3fbf34,JSON[_0x0e10('0x22')](_0x5d5831));_0x7335a6(_0x5d5831);})[_0x0e10('0x1a')](function(_0x5a1257){logger[_0x0e10('0x17')](_0x0e10('0x1b'),_0x5a1257[_0x0e10('0x18')],_0x3fbf34);_0x2f95ca(_0x24de57[_0x0e10('0x17')](0x1f4,_0x5a1257[_0x0e10('0x18')]));});});};exports[_0x0e10('0x23')]=function(_0x2855a6){return new Promise(function(_0x45c336,_0x24337f){return db['WhatsappInteraction'][_0x0e10('0x24')]({'where':_0x2855a6[_0x0e10('0x1e')]?_0x2855a6['options'][_0x0e10('0x1f')]||null:null})[_0x0e10('0x12')](function(_0x3694e5){if(_0x3694e5){return _0x3694e5[_0x0e10('0x25')](_0x2855a6[_0x0e10('0x26')][_0x0e10('0x27')],_[_0x0e10('0x28')](_0x2855a6[_0x0e10('0x26')],[_0x0e10('0x27'),'id'])||{});}})['spread'](function(_0x5872bd){logger[_0x0e10('0x13')](_0x0e10('0x29'),_0x2855a6);logger[_0x0e10('0x16')](_0x0e10('0x29'),_0x2855a6,JSON[_0x0e10('0x22')](_0x5872bd));_0x45c336(_0x5872bd);})[_0x0e10('0x1a')](function(_0x1267e6){logger[_0x0e10('0x17')](_0x0e10('0x29'),_0x1267e6[_0x0e10('0x18')],_0x2855a6);_0x24337f(_this[_0x0e10('0x17')](0x1f4,_0x1267e6[_0x0e10('0x18')]));});});}; \ No newline at end of file +var _0xbf5b=['limit','then','UpdateWhatsappInteraction','find','addTags','body','ids','omit','spread','AddTags','catch','lodash','util','moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','info','WhatsappInteraction,\x20%s,\x20%s','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','WhatsappInteraction','update','options','where','attributes'];(function(_0x467c10,_0x1ba4c9){var _0x4c49ed=function(_0x3b6347){while(--_0x3b6347){_0x467c10['push'](_0x467c10['shift']());}};_0x4c49ed(++_0x1ba4c9);}(_0xbf5b,0x83));var _0xbbf5=function(_0xa201ee,_0x37da32){_0xa201ee=_0xa201ee-0x0;var _0x3e104d=_0xbf5b[_0xa201ee];return _0x3e104d;};'use strict';var _=require(_0xbbf5('0x0'));var util=require(_0xbbf5('0x1'));var moment=require(_0xbbf5('0x2'));var BPromise=require('bluebird');var rs=require(_0xbbf5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbbf5('0x4'))(_0xbbf5('0x5'));var config=require(_0xbbf5('0x6'));var jayson=require(_0xbbf5('0x7'));var client=jayson[_0xbbf5('0x8')][_0xbbf5('0x9')]({'port':0x232a});config[_0xbbf5('0xa')]=_['defaults'](config[_0xbbf5('0xa')],{'host':_0xbbf5('0xb'),'port':0x18eb});var socket=require(_0xbbf5('0xc'))(new Redis(config[_0xbbf5('0xa')]));require('./whatsappInteraction.socket')[_0xbbf5('0xd')](socket);function respondWithRpcPromise(_0x210eed,_0x1529b0,_0x297eab){return new BPromise(function(_0x31ecbc,_0x3d61ee){return client[_0xbbf5('0xe')](_0x210eed,_0x297eab)['then'](function(_0x1f3573){logger[_0xbbf5('0xf')](_0xbbf5('0x10'),_0x1529b0,'request\x20sent');logger[_0xbbf5('0x11')](_0xbbf5('0x12'),_0x1529b0,_0xbbf5('0x13'),JSON[_0xbbf5('0x14')](_0x1f3573));if(_0x1f3573[_0xbbf5('0x15')]){if(_0x1f3573['error']['code']===0x1f4){logger['error'](_0xbbf5('0x10'),_0x1529b0,_0x1f3573[_0xbbf5('0x15')][_0xbbf5('0x16')]);return _0x3d61ee(_0x1f3573[_0xbbf5('0x15')]['message']);}logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x1529b0,_0x1f3573[_0xbbf5('0x15')][_0xbbf5('0x16')]);return _0x31ecbc(_0x1f3573[_0xbbf5('0x15')][_0xbbf5('0x16')]);}else{logger[_0xbbf5('0xf')](_0xbbf5('0x10'),_0x1529b0,'request\x20sent');_0x31ecbc(_0x1f3573[_0xbbf5('0x17')][_0xbbf5('0x16')]);}})['catch'](function(_0x26fea8){logger[_0xbbf5('0x15')](_0xbbf5('0x10'),_0x1529b0,_0x26fea8);_0x3d61ee(_0x26fea8);});});}exports['UpdateWhatsappInteraction']=function(_0x1eb97a){var _0x3277b6=this;return new Promise(function(_0x417c3c,_0x78914c){return db[_0xbbf5('0x18')][_0xbbf5('0x19')](_0x1eb97a['body'],{'raw':_0x1eb97a[_0xbbf5('0x1a')]?_0x1eb97a[_0xbbf5('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1eb97a[_0xbbf5('0x1a')]?_0x1eb97a[_0xbbf5('0x1a')][_0xbbf5('0x1b')]||null:null,'attributes':_0x1eb97a[_0xbbf5('0x1a')]?_0x1eb97a['options'][_0xbbf5('0x1c')]||null:null,'limit':_0x1eb97a[_0xbbf5('0x1a')]?_0x1eb97a[_0xbbf5('0x1a')][_0xbbf5('0x1d')]||null:null})[_0xbbf5('0x1e')](function(_0x195990){logger[_0xbbf5('0xf')](_0xbbf5('0x1f'),_0x1eb97a);logger[_0xbbf5('0x11')](_0xbbf5('0x1f'),_0x1eb97a,JSON[_0xbbf5('0x14')](_0x195990));_0x417c3c(_0x195990);})['catch'](function(_0x498563){logger['error'](_0xbbf5('0x1f'),_0x498563[_0xbbf5('0x16')],_0x1eb97a);_0x78914c(_0x3277b6['error'](0x1f4,_0x498563['message']));});});};exports['AddTagsToWhatsappInteraction']=function(_0x43c544){return new Promise(function(_0xb46645,_0x292583){return db[_0xbbf5('0x18')][_0xbbf5('0x20')]({'where':_0x43c544['options']?_0x43c544[_0xbbf5('0x1a')][_0xbbf5('0x1b')]||null:null})[_0xbbf5('0x1e')](function(_0x23afda){if(_0x23afda){return _0x23afda[_0xbbf5('0x21')](_0x43c544[_0xbbf5('0x22')][_0xbbf5('0x23')],_[_0xbbf5('0x24')](_0x43c544[_0xbbf5('0x22')],['ids','id'])||{});}})[_0xbbf5('0x25')](function(_0x466e61){logger[_0xbbf5('0xf')](_0xbbf5('0x26'),_0x43c544);logger[_0xbbf5('0x11')]('AddTags',_0x43c544,JSON[_0xbbf5('0x14')](_0x466e61));_0xb46645(_0x466e61);})[_0xbbf5('0x27')](function(_0x1b43bf){logger[_0xbbf5('0x15')]('AddTags',_0x1b43bf['message'],_0x43c544);_0x292583(_this['error'](0x1f4,_0x1b43bf['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index aaecbd9..745e649 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 _0x2b86=['save','remove','update','emit','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events'];(function(_0x218028,_0xcf816c){var _0x1c165e=function(_0x29e9ba){while(--_0x29e9ba){_0x218028['push'](_0x218028['shift']());}};_0x1c165e(++_0xcf816c);}(_0x2b86,0x1d3));var _0x62b8=function(_0x5f04ff,_0x497fbf){_0x5f04ff=_0x5f04ff-0x0;var _0x5b4d37=_0x2b86[_0x5f04ff];return _0x5b4d37;};'use strict';var WhatsappInteractionEvents=require(_0x62b8('0x0'));var events=[_0x62b8('0x1'),_0x62b8('0x2'),_0x62b8('0x3')];function createListener(_0x31e405,_0x1e5a8f){return function(_0x580a55){_0x1e5a8f[_0x62b8('0x4')](_0x31e405,_0x580a55);};}function removeListener(_0x460aca,_0x24243f){return function(){WhatsappInteractionEvents[_0x62b8('0x5')](_0x460aca,_0x24243f);};}exports[_0x62b8('0x6')]=function(_0x12535b){for(var _0x1e4a68=0x0,_0x11d420=events[_0x62b8('0x7')];_0x1e4a68<_0x11d420;_0x1e4a68++){var _0x3de67b=events[_0x1e4a68];var _0x1a438b=createListener(_0x62b8('0x8')+_0x3de67b,_0x12535b);WhatsappInteractionEvents['on'](_0x3de67b,_0x1a438b);}}; \ No newline at end of file +var _0x7107=['remove','update','emit','removeListener','register','length'];(function(_0xaf37e4,_0x2e89b0){var _0x58d020=function(_0x1cd68e){while(--_0x1cd68e){_0xaf37e4['push'](_0xaf37e4['shift']());}};_0x58d020(++_0x2e89b0);}(_0x7107,0xba));var _0x7710=function(_0x1bddc1,_0x36a9c6){_0x1bddc1=_0x1bddc1-0x0;var _0x25ddd0=_0x7107[_0x1bddc1];return _0x25ddd0;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=['save',_0x7710('0x0'),_0x7710('0x1')];function createListener(_0x327097,_0x39ba17){return function(_0x40fc43){_0x39ba17[_0x7710('0x2')](_0x327097,_0x40fc43);};}function removeListener(_0x45dd73,_0x2deb9d){return function(){WhatsappInteractionEvents[_0x7710('0x3')](_0x45dd73,_0x2deb9d);};}exports[_0x7710('0x4')]=function(_0x1d7cf9){for(var _0xba56c8=0x0,_0x304854=events[_0x7710('0x5')];_0xba56c8<_0x304854;_0xba56c8++){var _0x14f007=events[_0xba56c8];var _0x5484d6=createListener('whatsappInteraction:'+_0x14f007,_0x1d7cf9);WhatsappInteractionEvents['on'](_0x14f007,_0x5484d6);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index dfdb6df..0730bfd 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 _0x85a8=['express','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','whatsappmessage:create','create','status','put','update','accept','/:id/reject','destroy','exports','multer','util','path','connect-timeout'];(function(_0x19df8e,_0xc8482){var _0x378598=function(_0x24f1d0){while(--_0x24f1d0){_0x19df8e['push'](_0x19df8e['shift']());}};_0x378598(++_0xc8482);}(_0x85a8,0x173));var _0x885a=function(_0x210e01,_0x3a7cef){_0x210e01=_0x210e01-0x0;var _0x580ace=_0x85a8[_0x210e01];return _0x580ace;};'use strict';var multer=require(_0x885a('0x0'));var util=require(_0x885a('0x1'));var path=require(_0x885a('0x2'));var timeout=require(_0x885a('0x3'));var express=require(_0x885a('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x885a('0x5'));var config=require(_0x885a('0x6'));var controller=require(_0x885a('0x7'));router['get']('/',auth[_0x885a('0x8')](),controller[_0x885a('0x9')]);router[_0x885a('0xa')](_0x885a('0xb'),auth[_0x885a('0x8')](),controller[_0x885a('0xc')]);router[_0x885a('0xa')](_0x885a('0xd'),auth['isAuthenticated'](),controller[_0x885a('0xe')]);router[_0x885a('0xf')]('/',auth[_0x885a('0x8')](),interaction['tracked']('whatsapp',_0x885a('0x10')),controller[_0x885a('0x11')]);router['post']('/:id/status',controller[_0x885a('0x12')]);router[_0x885a('0x13')](_0x885a('0xd'),auth[_0x885a('0x8')](),controller[_0x885a('0x14')]);router[_0x885a('0x13')]('/:id/accept',auth[_0x885a('0x8')](),controller[_0x885a('0x15')]);router[_0x885a('0x13')](_0x885a('0x16'),auth['isAuthenticated'](),controller['reject']);router['delete']('/:id',auth[_0x885a('0x8')](),controller[_0x885a('0x17')]);module[_0x885a('0x18')]=router; \ No newline at end of file +var _0x408e=['../../config/environment','get','index','/describe','isAuthenticated','/:id','post','tracked','whatsappmessage:create','create','status','put','/:id/accept','reject','destroy','exports','util','path','express','fs-extra','../../components/interaction/service'];(function(_0x21022d,_0x2e1c5b){var _0x315306=function(_0x2a68c2){while(--_0x2a68c2){_0x21022d['push'](_0x21022d['shift']());}};_0x315306(++_0x2e1c5b);}(_0x408e,0xb8));var _0xe408=function(_0x1acc01,_0x5cb80c){_0x1acc01=_0x1acc01-0x0;var _0x5603f1=_0x408e[_0x1acc01];return _0x5603f1;};'use strict';var multer=require('multer');var util=require(_0xe408('0x0'));var path=require(_0xe408('0x1'));var timeout=require('connect-timeout');var express=require(_0xe408('0x2'));var router=express['Router']();var fs_extra=require(_0xe408('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xe408('0x4'));var config=require(_0xe408('0x5'));var controller=require('./whatsappMessage.controller');router[_0xe408('0x6')]('/',auth['isAuthenticated'](),controller[_0xe408('0x7')]);router[_0xe408('0x6')](_0xe408('0x8'),auth[_0xe408('0x9')](),controller['describe']);router[_0xe408('0x6')](_0xe408('0xa'),auth[_0xe408('0x9')](),controller['show']);router[_0xe408('0xb')]('/',auth[_0xe408('0x9')](),interaction[_0xe408('0xc')]('whatsapp',_0xe408('0xd')),controller[_0xe408('0xe')]);router[_0xe408('0xb')]('/:id/status',controller[_0xe408('0xf')]);router[_0xe408('0x10')](_0xe408('0xa'),auth[_0xe408('0x9')](),controller['update']);router[_0xe408('0x10')](_0xe408('0x11'),auth[_0xe408('0x9')](),controller['accept']);router[_0xe408('0x10')]('/:id/reject',auth[_0xe408('0x9')](),controller[_0xe408('0x12')]);router['delete']('/:id',auth[_0xe408('0x9')](),controller[_0xe408('0x13')]);module[_0xe408('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index ddf0350..32492de 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 _0x1641=['out','STRING','DATE','sequelize','exports','TEXT','BOOLEAN','ENUM'];(function(_0x1d6695,_0x51a81b){var _0x3b2805=function(_0x78bb54){while(--_0x78bb54){_0x1d6695['push'](_0x1d6695['shift']());}};_0x3b2805(++_0x51a81b);}(_0x1641,0x153));var _0x1164=function(_0x229188,_0x3507f0){_0x229188=_0x229188-0x0;var _0x4a07f6=_0x1641[_0x229188];return _0x4a07f6;};'use strict';var Sequelize=require(_0x1164('0x0'));module[_0x1164('0x1')]={'body':{'type':Sequelize[_0x1164('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x1164('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1164('0x4')]('in',_0x1164('0x5')),'defaultValue':_0x1164('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x1164('0x6')](0xbe)},'phone':{'type':Sequelize[_0x1164('0x6')]},'readAt':{'type':Sequelize[_0x1164('0x7')]},'secret':{'type':Sequelize[_0x1164('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x1164('0x6')]},'providerResponse':{'type':Sequelize[_0x1164('0x2')]}}; \ No newline at end of file +var _0x65c7=['out','STRING','DATE','exports','TEXT','medium','BOOLEAN'];(function(_0x384707,_0x3b81dc){var _0x2e32fb=function(_0xbfe1a8){while(--_0xbfe1a8){_0x384707['push'](_0x384707['shift']());}};_0x2e32fb(++_0x3b81dc);}(_0x65c7,0x137));var _0x765c=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x65c7[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require('sequelize');module[_0x765c('0x0')]={'body':{'type':Sequelize[_0x765c('0x1')](_0x765c('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x765c('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x765c('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x765c('0x5')](0xbe)},'phone':{'type':Sequelize[_0x765c('0x5')]},'readAt':{'type':Sequelize[_0x765c('0x6')]},'secret':{'type':Sequelize[_0x765c('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x765c('0x5')]},'providerResponse':{'type':Sequelize[_0x765c('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index b8c3db5..cd3170a 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 _0x2000=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','redis','./whatsappMessage.socket','jayson/promise','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','end','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','type','options','includeAll','include','rows','show','params','find','create','update','body','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','UserId','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','interaction','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','User','fullname','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','Sequelize','SELECT','contact','email','WhatsappAccount','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x31f1fe,_0x5f24){var _0x2d15f8=function(_0x2a5978){while(--_0x2a5978){_0x31f1fe['push'](_0x31f1fe['shift']());}};_0x2d15f8(++_0x5f24);}(_0x2000,0xfe));var _0x0200=function(_0x6c7b6d,_0x452210){_0x6c7b6d=_0x6c7b6d-0x0;var _0x5bebd3=_0x2000[_0x6c7b6d];return _0x5bebd3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0200('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0200('0x1'));var moment=require(_0x0200('0x2'));var BPromise=require(_0x0200('0x3'));var Mustache=require(_0x0200('0x4'));var util=require('util');var path=require(_0x0200('0x5'));var sox=require(_0x0200('0x6'));var csv=require(_0x0200('0x7'));var ejs=require(_0x0200('0x8'));var fs=require('fs');var fs_extra=require(_0x0200('0x9'));var _=require(_0x0200('0xa'));var squel=require(_0x0200('0xb'));var crypto=require(_0x0200('0xc'));var jsforce=require(_0x0200('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0200('0x7'));var querystring=require(_0x0200('0xe'));var Papa=require(_0x0200('0xf'));var Redis=require('ioredis');var authService=require(_0x0200('0x10'));var qs=require(_0x0200('0x11'));var as=require(_0x0200('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0200('0x13'))(_0x0200('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0200('0x15'));var db=require(_0x0200('0x16'))['db'];config['redis']=_[_0x0200('0x17')](config[_0x0200('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0200('0x19'))['register'](socket);var jayson=require(_0x0200('0x1a'));var client=jayson['client'][_0x0200('0x1b')]({'port':0x232c});var client9002=jayson['client'][_0x0200('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x5907d9,_0x24915e,_0x45f55a,_0x26f3de){return new BPromise(function(_0x4e2103,_0x56f0fe){var _0x1cb1fe=_0x26f3de||client;return _0x1cb1fe[_0x0200('0x1c')](_0x5907d9,_0x45f55a)[_0x0200('0x1d')](function(_0x1912ac){logger[_0x0200('0x1e')](_0x0200('0x1f'),_0x24915e,_0x0200('0x20'));logger['debug'](_0x0200('0x21'),_0x24915e,_0x0200('0x20'),JSON[_0x0200('0x22')](_0x1912ac));if(_0x1912ac[_0x0200('0x23')]){if(_0x1912ac[_0x0200('0x23')][_0x0200('0x24')]===0x1f4){logger[_0x0200('0x23')](_0x0200('0x1f'),_0x24915e,_0x1912ac[_0x0200('0x23')][_0x0200('0x25')]);return _0x56f0fe(_0x1912ac[_0x0200('0x23')][_0x0200('0x25')]);}logger[_0x0200('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x24915e,_0x1912ac[_0x0200('0x23')][_0x0200('0x25')]);return _0x4e2103(_0x1912ac['error'][_0x0200('0x25')]);}else{logger[_0x0200('0x1e')](_0x0200('0x1f'),_0x24915e,_0x0200('0x20'));_0x4e2103(_0x1912ac[_0x0200('0x26')][_0x0200('0x25')]);}})[_0x0200('0x27')](function(_0x3d84c0){logger[_0x0200('0x23')](_0x0200('0x1f'),_0x24915e,_0x3d84c0);_0x56f0fe(_0x3d84c0);});});}function respondWithStatusCode(_0x357427,_0x231ef5){_0x231ef5=_0x231ef5||0xcc;return function(_0x2f87fb){if(_0x2f87fb){return _0x357427[_0x0200('0x28')](_0x231ef5);}return _0x357427[_0x0200('0x29')](_0x231ef5)['end']();};}function respondWithResult(_0x51302d,_0x290b59){_0x290b59=_0x290b59||0xc8;return function(_0x4c7b3a){if(_0x4c7b3a){return _0x51302d[_0x0200('0x29')](_0x290b59)[_0x0200('0x2a')](_0x4c7b3a);}};}function respondWithFilteredResult(_0x1f4ae3,_0x270c41){return function(_0x35e176){if(_0x35e176){var _0x4dc80a=typeof _0x270c41[_0x0200('0x2b')]===_0x0200('0x2c')&&typeof _0x270c41[_0x0200('0x2d')]==='undefined';var _0x2f14d1=_0x35e176[_0x0200('0x2e')];var _0x13b3e4=_0x4dc80a?0x0:_0x270c41['offset'];var _0x5a0a96=_0x4dc80a?_0x35e176['count']:_0x270c41['offset']+_0x270c41[_0x0200('0x2d')];var _0x47149c;if(_0x5a0a96>=_0x2f14d1){_0x5a0a96=_0x2f14d1;_0x47149c=0xc8;}else{_0x47149c=0xce;}_0x1f4ae3[_0x0200('0x29')](_0x47149c);return _0x1f4ae3[_0x0200('0x2f')](_0x0200('0x30'),_0x13b3e4+'-'+_0x5a0a96+'/'+_0x2f14d1)[_0x0200('0x2a')](_0x35e176);}return null;};}function patchUpdates(_0x43acfc){return function(_0x3272ce){try{jsonpatch[_0x0200('0x31')](_0x3272ce,_0x43acfc,!![]);}catch(_0x5c9964){return BPromise[_0x0200('0x32')](_0x5c9964);}return _0x3272ce[_0x0200('0x33')]();};}function saveUpdates(_0xf4cb98,_0x6ce45a){return function(_0x494319){if(_0x494319){return _0x494319['update'](_0xf4cb98)[_0x0200('0x1d')](function(_0x71cf38){return _0x71cf38;});}return null;};}function removeEntity(_0x5873d1,_0x3399b1){return function(_0x4511ad){if(_0x4511ad){return _0x4511ad[_0x0200('0x34')]()['then'](function(){_0x5873d1[_0x0200('0x29')](0xcc)[_0x0200('0x35')]();});}};}function handleEntityNotFound(_0x20d68c,_0xd19850){return function(_0x4656b7){if(!_0x4656b7){_0x20d68c[_0x0200('0x28')](0x194);}return _0x4656b7;};}function handleError(_0x406521,_0x473d4a){_0x473d4a=_0x473d4a||0x1f4;return function(_0x424a77){logger['error'](_0x424a77['stack']);if(_0x424a77[_0x0200('0x36')]){delete _0x424a77[_0x0200('0x36')];}_0x406521[_0x0200('0x29')](_0x473d4a)[_0x0200('0x37')](_0x424a77);};}exports[_0x0200('0x38')]=function(_0x58606e,_0x39ea82){var _0x4ba20c={},_0x609178={},_0x4139ef={'count':0x0,'rows':[]};var _0xe70be0=_[_0x0200('0x39')](db[_0x0200('0x3a')][_0x0200('0x3b')],function(_0x42863f){return{'name':_0x42863f[_0x0200('0x3c')],'type':_0x42863f['type'][_0x0200('0x3d')]};});_0x609178[_0x0200('0x3e')]=_['map'](_0xe70be0,'name');_0x609178[_0x0200('0x3f')]=_[_0x0200('0x40')](_0x58606e[_0x0200('0x3f')]);_0x609178['filters']=_[_0x0200('0x41')](_0x609178[_0x0200('0x3e')],_0x609178[_0x0200('0x3f')]);_0x4ba20c[_0x0200('0x42')]=_[_0x0200('0x41')](_0x609178[_0x0200('0x3e')],qs[_0x0200('0x43')](_0x58606e[_0x0200('0x3f')][_0x0200('0x43')]));_0x4ba20c[_0x0200('0x42')]=_0x4ba20c[_0x0200('0x42')][_0x0200('0x44')]?_0x4ba20c['attributes']:_0x609178['model'];if(!_0x58606e[_0x0200('0x3f')][_0x0200('0x45')]('nolimit')){_0x4ba20c[_0x0200('0x2d')]=qs[_0x0200('0x2d')](_0x58606e[_0x0200('0x3f')][_0x0200('0x2d')]);_0x4ba20c[_0x0200('0x2b')]=qs[_0x0200('0x2b')](_0x58606e['query']['offset']);}_0x4ba20c['order']=qs[_0x0200('0x46')](_0x58606e[_0x0200('0x3f')][_0x0200('0x46')]);_0x4ba20c[_0x0200('0x47')]=qs[_0x0200('0x48')](_[_0x0200('0x49')](_0x58606e['query'],_0x609178[_0x0200('0x48')]),_0xe70be0);if(_0x58606e['query'][_0x0200('0x4a')]){_0x4ba20c[_0x0200('0x47')]=_[_0x0200('0x4b')](_0x4ba20c[_0x0200('0x47')],{'$or':_[_0x0200('0x39')](_0xe70be0,function(_0x5bb284){if(_0x5bb284[_0x0200('0x4c')]!=='VIRTUAL'){var _0x59046f={};_0x59046f[_0x5bb284[_0x0200('0x36')]]={'$like':'%'+_0x58606e[_0x0200('0x3f')]['filter']+'%'};return _0x59046f;}})});}_0x4ba20c=_[_0x0200('0x4b')]({},_0x4ba20c,_0x58606e[_0x0200('0x4d')]);var _0x46b835={'where':_0x4ba20c[_0x0200('0x47')]};return db[_0x0200('0x3a')][_0x0200('0x2e')](_0x46b835)[_0x0200('0x1d')](function(_0x4f4efe){_0x4139ef['count']=_0x4f4efe;if(_0x58606e['query'][_0x0200('0x4e')]){_0x4ba20c[_0x0200('0x4f')]=[{'all':!![]}];}return db[_0x0200('0x3a')]['findAll'](_0x4ba20c);})[_0x0200('0x1d')](function(_0x5f05a5){_0x4139ef[_0x0200('0x50')]=_0x5f05a5;return _0x4139ef;})['then'](respondWithFilteredResult(_0x39ea82,_0x4ba20c))[_0x0200('0x27')](handleError(_0x39ea82,null));};exports[_0x0200('0x51')]=function(_0x5287fa,_0x490349){var _0x3aec00={'raw':!![],'where':{'id':_0x5287fa[_0x0200('0x52')]['id']}},_0x4ac7ae={};_0x4ac7ae[_0x0200('0x3e')]=_[_0x0200('0x40')](db[_0x0200('0x3a')][_0x0200('0x3b')]);_0x4ac7ae[_0x0200('0x3f')]=_[_0x0200('0x40')](_0x5287fa[_0x0200('0x3f')]);_0x4ac7ae[_0x0200('0x48')]=_[_0x0200('0x41')](_0x4ac7ae[_0x0200('0x3e')],_0x4ac7ae[_0x0200('0x3f')]);_0x3aec00[_0x0200('0x42')]=_['intersection'](_0x4ac7ae['model'],qs[_0x0200('0x43')](_0x5287fa[_0x0200('0x3f')][_0x0200('0x43')]));_0x3aec00['attributes']=_0x3aec00['attributes'][_0x0200('0x44')]?_0x3aec00[_0x0200('0x42')]:_0x4ac7ae[_0x0200('0x3e')];if(_0x5287fa[_0x0200('0x3f')][_0x0200('0x4e')]){_0x3aec00[_0x0200('0x4f')]=[{'all':!![]}];}_0x3aec00=_[_0x0200('0x4b')]({},_0x3aec00,_0x5287fa['options']);return db['WhatsappMessage'][_0x0200('0x53')](_0x3aec00)[_0x0200('0x1d')](handleEntityNotFound(_0x490349,null))[_0x0200('0x1d')](respondWithResult(_0x490349,null))[_0x0200('0x27')](handleError(_0x490349,null));};exports[_0x0200('0x54')]=function(_0x40f2f3,_0x96feb3){return db[_0x0200('0x3a')][_0x0200('0x54')](_0x40f2f3['body'],{})[_0x0200('0x1d')](respondWithResult(_0x96feb3,0xc9))['catch'](handleError(_0x96feb3,null));};exports[_0x0200('0x55')]=function(_0xbfdb84,_0x457ef4){if(_0xbfdb84['body']['id']){delete _0xbfdb84['body']['id'];}return db[_0x0200('0x3a')][_0x0200('0x53')]({'where':{'id':_0xbfdb84[_0x0200('0x52')]['id']}})[_0x0200('0x1d')](handleEntityNotFound(_0x457ef4,null))[_0x0200('0x1d')](saveUpdates(_0xbfdb84[_0x0200('0x56')],null))[_0x0200('0x1d')](respondWithResult(_0x457ef4,null))['catch'](handleError(_0x457ef4,null));};exports[_0x0200('0x34')]=function(_0x3283c1,_0x419224){return db[_0x0200('0x3a')][_0x0200('0x53')]({'where':{'id':_0x3283c1[_0x0200('0x52')]['id']}})['then'](handleEntityNotFound(_0x419224,null))['then'](removeEntity(_0x419224,null))[_0x0200('0x27')](handleError(_0x419224,null));};exports[_0x0200('0x57')]=function(_0x471226,_0x2822c1){return db[_0x0200('0x3a')][_0x0200('0x57')]()['then'](respondWithResult(_0x2822c1,null))[_0x0200('0x27')](handleError(_0x2822c1,null));};var interaction_log=require(_0x0200('0x13'))(_0x0200('0x58'));exports[_0x0200('0x59')]=function(_0x27972,_0xdc6c7a,_0x2d4821){var _0x4a4066={'agent':{},'channel':_0x0200('0x5a')};if(_0x27972[_0x0200('0x56')]['id']){delete _0x27972[_0x0200('0x56')]['id'];}_0x27972['body'][_0x0200('0x5b')]=!![];_0x27972[_0x0200('0x56')][_0x0200('0x5c')]=moment()[_0x0200('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x27972[_0x0200('0x56')]['UserId']=_0x27972[_0x0200('0x56')][_0x0200('0x5e')]||_0x27972['user']['id'];_0x4a4066[_0x0200('0x5f')]['id']=_0x27972[_0x0200('0x56')]['UserId'];return db['WhatsappMessage'][_0x0200('0x53')]({'where':{'id':_0x27972[_0x0200('0x52')]['id'],'UserId':null}})[_0x0200('0x1d')](handleEntityNotFound(_0xdc6c7a,null))[_0x0200('0x1d')](saveUpdates(_0x27972['body'],null))[_0x0200('0x1d')](function(_0x2c68c2){if(_0x2c68c2){_0x4a4066[_0x0200('0x25')]=_0x2c68c2[_0x0200('0x60')]({'plain':!![]});return db[_0x0200('0x61')][_0x0200('0x53')]({'where':{'id':_0x2c68c2[_0x0200('0x62')]}});}return null;})[_0x0200('0x1d')](handleEntityNotFound(_0xdc6c7a,null))[_0x0200('0x1d')](function(_0x37fa99){if(_0x37fa99){return _0x37fa99['update']({'UserId':_0x27972[_0x0200('0x56')][_0x0200('0x5e')],'read1stAt':_[_0x0200('0x63')](_0x37fa99['read1stAt'])?moment()[_0x0200('0x5d')](_0x0200('0x64')):undefined});}return null;})['then'](function(_0x4e7e72){if(_0x4e7e72){_0x4a4066['interaction']=_0x4e7e72['get']({'plain':!![]});interaction_log[_0x0200('0x1e')](_0x0200('0x65'),_0x27972['user']['id'],_0x27972[_0x0200('0x66')]['name'],_0x27972['user']['role'],_0x4a4066[_0x0200('0x67')]['id'],_0x27972[_0x0200('0x56')]?JSON['stringify'](_0x27972[_0x0200('0x56')]):'null');return respondWithRpcPromise(_0x0200('0x68'),_0x0200('0x69'),_0x4a4066);}return null;})[_0x0200('0x1d')](function(_0x537c81){var _0x42e660=_0x0200('0x6a')+_0x537c81[_0x0200('0x25')][_0x0200('0x6b')];return db['sequelize'][_0x0200('0x3f')](_0x42e660,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x0200('0x1d')](function(_0x5a50f4){return _0x5a50f4;});})['then'](function(_0x8ff089){if(_0x8ff089){_0x4a4066[_0x0200('0x25')]['contact']=_0x8ff089[0x0];if(!_0x27972[_0x0200('0x56')][_0x0200('0x5e')])return;return db[_0x0200('0x6c')][_0x0200('0x53')]({'where':{'id':_0x27972[_0x0200('0x56')][_0x0200('0x5e')],'role':'agent'},'attributes':['id',_0x0200('0x36'),_0x0200('0x6d'),'email','internal'],'raw':!![]});}return null;})[_0x0200('0x1d')](function(_0x424b60){if(!_0x424b60)return null;_0x4a4066['message'][_0x0200('0x5f')]=_0x424b60;return _0x4a4066;})[_0x0200('0x1d')](function(_0x529d84){if(_0x529d84){if(_0x27972['body'][_0x0200('0x6e')]){_0x4a4066[_0x0200('0x25')][_0x0200('0x6f')]=util[_0x0200('0x5d')](_0x0200('0x70'),_0x27972['user']['name']);_0x4a4066[_0x0200('0x25')][_0x0200('0x71')]=_0x4a4066['channel'];_0x4a4066['message'][_0x0200('0x72')]=_0x4a4066['channel'];_0x4a4066[_0x0200('0x25')][_0x0200('0x73')]='accept';return respondWithRpcPromise(_0x0200('0x74'),_0x0200('0x74'),{'event':'acceptmessage','message':_0x4a4066['message']},client9002)[_0x0200('0x1d')](function(){return _0x4a4066;});}return _0x4a4066;}return null;})[_0x0200('0x1d')](respondWithResult(_0xdc6c7a,null))[_0x0200('0x27')](handleError(_0xdc6c7a,null));};var interaction_log=require(_0x0200('0x13'))('whatsapp-interactions');exports[_0x0200('0x32')]=function(_0x3ed87e,_0x31f670,_0x4bf9ec){var _0x4efdd0={'agent':{},'channel':'whatsapp'};if(_0x3ed87e[_0x0200('0x56')]['id']){delete _0x3ed87e['body']['id'];}_0x3ed87e[_0x0200('0x56')]['UserId']=_0x3ed87e[_0x0200('0x56')][_0x0200('0x5e')]||_0x3ed87e['user']['id'];_0x4efdd0[_0x0200('0x5f')]['id']=_0x3ed87e[_0x0200('0x56')][_0x0200('0x5e')];return db['WhatsappMessage'][_0x0200('0x53')]({'where':{'id':_0x3ed87e[_0x0200('0x52')]['id'],'UserId':null}})[_0x0200('0x1d')](handleEntityNotFound(_0x31f670,null))[_0x0200('0x1d')](function(_0xb16582){if(_0xb16582){_0x4efdd0[_0x0200('0x25')]=_0xb16582[_0x0200('0x60')]({'plain':!![]});return db[_0x0200('0x61')][_0x0200('0x53')]({'where':{'id':_0xb16582[_0x0200('0x62')]}});}return null;})[_0x0200('0x1d')](handleEntityNotFound(_0x31f670,null))[_0x0200('0x1d')](function(_0xaec02a){if(_0xaec02a){_0x4efdd0['interaction']=_0xaec02a['get']({'plain':!![]});interaction_log['info'](_0x0200('0x75'),_0x3ed87e[_0x0200('0x66')]['id'],_0x3ed87e[_0x0200('0x66')][_0x0200('0x36')],_0x3ed87e[_0x0200('0x66')][_0x0200('0x76')],_0x4efdd0[_0x0200('0x67')]['id'],_0x3ed87e[_0x0200('0x56')]?JSON[_0x0200('0x22')](_0x3ed87e[_0x0200('0x56')]):_0x0200('0x77'));return respondWithRpcPromise(_0x0200('0x78'),_0x0200('0x79'),_0x4efdd0);}return null;})['then'](function(_0x4429cf){var _0x255ec4=_0x0200('0x6a')+_0x4429cf[_0x0200('0x25')][_0x0200('0x6b')];return db['sequelize'][_0x0200('0x3f')](_0x255ec4,{'type':db[_0x0200('0x7a')]['QueryTypes'][_0x0200('0x7b')],'raw':!![]})[_0x0200('0x1d')](function(_0x206f12){return _0x206f12;});})['then'](function(_0x183ab8){if(_0x183ab8){_0x4efdd0['message'][_0x0200('0x7c')]=_0x183ab8[0x0];if(!_0x3ed87e[_0x0200('0x56')]['UserId'])return;return db[_0x0200('0x6c')][_0x0200('0x53')]({'where':{'id':_0x3ed87e['body'][_0x0200('0x5e')],'role':_0x0200('0x5f')},'attributes':['id',_0x0200('0x36'),_0x0200('0x6d'),_0x0200('0x7d'),'internal'],'raw':!![]});}return null;})[_0x0200('0x1d')](function(_0x443dec){if(!_0x443dec)return null;_0x4efdd0[_0x0200('0x25')][_0x0200('0x5f')]=_0x443dec;return _0x4efdd0;})[_0x0200('0x1d')](function(_0x5547fe){if(_0x5547fe){_0x5547fe['message'][_0x0200('0x6f')]=util[_0x0200('0x5d')](_0x0200('0x70'),_0x3ed87e['user'][_0x0200('0x36')]);_0x5547fe['message'][_0x0200('0x71')]=_0x4efdd0[_0x0200('0x71')];_0x5547fe[_0x0200('0x25')]['motionChannel']=_0x4efdd0[_0x0200('0x71')];_0x5547fe['message'][_0x0200('0x73')]='reject';respondWithRpcPromise(_0x0200('0x74'),_0x0200('0x74'),{'event':'rejectmessage','message':_0x5547fe[_0x0200('0x25')]},client9002);return _0x4efdd0;}return null;})[_0x0200('0x1d')](respondWithResult(_0x31f670,null))[_0x0200('0x27')](handleError(_0x31f670,null));};exports[_0x0200('0x29')]=function(_0x3db0cf,_0x14d18b,_0x58860f){if(_0x3db0cf[_0x0200('0x56')]['id']){delete _0x3db0cf[_0x0200('0x56')]['id'];}var _0x30aeed;return db[_0x0200('0x3a')][_0x0200('0x53')]({'where':{'id':_0x3db0cf[_0x0200('0x52')]['id']}})[_0x0200('0x1d')](handleEntityNotFound(_0x14d18b,null))[_0x0200('0x1d')](function(_0x5e7ca0){if(_0x5e7ca0){_0x30aeed=_0x5e7ca0;return db[_0x0200('0x7e')]['find']({'where':{'id':_0x5e7ca0['WhatsappAccountId']}});}})['then'](handleEntityNotFound(_0x14d18b,null))['then'](function(_0x42f4db){if(_0x42f4db){logger['debug']('WhatsppMessage,\x20%s,\x20%s,\x20%s','status',_0x0200('0x7f'),_0x42f4db[_0x0200('0x4c')],util[_0x0200('0x80')](_0x3db0cf[_0x0200('0x56')],{'showHidden':![],'depth':null}));switch(_0x42f4db[_0x0200('0x4c')]){case'twilio':if(_0x3db0cf[_0x0200('0x56')][_0x0200('0x81')]&&_0x3db0cf['body'][_0x0200('0x81')]===_0x30aeed[_0x0200('0x82')]&&_0x3db0cf[_0x0200('0x56')]['MessageStatus']&&_0x3db0cf['body'][_0x0200('0x83')]===_0x0200('0x5b')){return _0x30aeed[_0x0200('0x55')]({'read':!![]});}else{logger[_0x0200('0x23')](_0x0200('0x84'),'status',_0x0200('0x85'),util['inspect'](_0x3db0cf[_0x0200('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x30aeed;}})['then'](respondWithResult(_0x14d18b,null))[_0x0200('0x27')](handleError(_0x14d18b,null));}; \ No newline at end of file +var _0x2766=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','destroy','name','index','map','WhatsappMessage','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','type','filter','merge','include','findAll','rows','show','rawAttributes','includeAll','options','find','create','body','params','describe','whatsapp-interactions','accept','whatsapp','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','isNil','read1stAt','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','format','SIP/%s','channel','motionChannel','event','EventManager','interaction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','internal','rejectmessage','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','crypto','jsforce','querystring','../../components/auth/service'];(function(_0x5a3723,_0x35ead4){var _0x1852db=function(_0x27c477){while(--_0x27c477){_0x5a3723['push'](_0x5a3723['shift']());}};_0x1852db(++_0x35ead4);}(_0x2766,0x74));var _0x6276=function(_0x89100d,_0x59c43d){_0x89100d=_0x89100d-0x0;var _0x15974a=_0x2766[_0x89100d];return _0x15974a;};'use strict';var emlformat=require(_0x6276('0x0'));var rimraf=require(_0x6276('0x1'));var zipdir=require(_0x6276('0x2'));var jsonpatch=require(_0x6276('0x3'));var rp=require(_0x6276('0x4'));var moment=require(_0x6276('0x5'));var BPromise=require(_0x6276('0x6'));var Mustache=require(_0x6276('0x7'));var util=require(_0x6276('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x6276('0x9'));var ejs=require(_0x6276('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6276('0xb'));var jsforce=require(_0x6276('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6276('0x9'));var querystring=require(_0x6276('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6276('0xe'));var qs=require(_0x6276('0xf'));var as=require(_0x6276('0x10'));var hardwareService=require(_0x6276('0x11'));var logger=require(_0x6276('0x12'))('api');var utils=require(_0x6276('0x13'));var config=require(_0x6276('0x14'));var licenseUtil=require(_0x6276('0x15'));var db=require(_0x6276('0x16'))['db'];config['redis']=_[_0x6276('0x17')](config[_0x6276('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6276('0x19'))[_0x6276('0x1a')](socket);var jayson=require(_0x6276('0x1b'));var client=jayson[_0x6276('0x1c')][_0x6276('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0x6276('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x2a19b0,_0x1549dd,_0x1afb28,_0x46eb43){return new BPromise(function(_0x52decd,_0x5d7e00){var _0x344758=_0x46eb43||client;return _0x344758[_0x6276('0x1e')](_0x2a19b0,_0x1afb28)[_0x6276('0x1f')](function(_0x2d7f82){logger[_0x6276('0x20')](_0x6276('0x21'),_0x1549dd,'request\x20sent');logger[_0x6276('0x22')](_0x6276('0x23'),_0x1549dd,'request\x20sent',JSON[_0x6276('0x24')](_0x2d7f82));if(_0x2d7f82[_0x6276('0x25')]){if(_0x2d7f82[_0x6276('0x25')][_0x6276('0x26')]===0x1f4){logger[_0x6276('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x1549dd,_0x2d7f82[_0x6276('0x25')][_0x6276('0x27')]);return _0x5d7e00(_0x2d7f82[_0x6276('0x25')][_0x6276('0x27')]);}logger['error'](_0x6276('0x21'),_0x1549dd,_0x2d7f82['error'][_0x6276('0x27')]);return _0x52decd(_0x2d7f82[_0x6276('0x25')][_0x6276('0x27')]);}else{logger[_0x6276('0x20')](_0x6276('0x21'),_0x1549dd,'request\x20sent');_0x52decd(_0x2d7f82[_0x6276('0x28')][_0x6276('0x27')]);}})[_0x6276('0x29')](function(_0x1af858){logger[_0x6276('0x25')](_0x6276('0x21'),_0x1549dd,_0x1af858);_0x5d7e00(_0x1af858);});});}function respondWithStatusCode(_0x3912db,_0x1db86d){_0x1db86d=_0x1db86d||0xcc;return function(_0xed8e85){if(_0xed8e85){return _0x3912db[_0x6276('0x2a')](_0x1db86d);}return _0x3912db[_0x6276('0x2b')](_0x1db86d)[_0x6276('0x2c')]();};}function respondWithResult(_0x1f2381,_0x313283){_0x313283=_0x313283||0xc8;return function(_0x57b64c){if(_0x57b64c){return _0x1f2381['status'](_0x313283)[_0x6276('0x2d')](_0x57b64c);}};}function respondWithFilteredResult(_0x446c34,_0x583e52){return function(_0x585e8e){if(_0x585e8e){var _0x534e6b=typeof _0x583e52[_0x6276('0x2e')]===_0x6276('0x2f')&&typeof _0x583e52[_0x6276('0x30')]===_0x6276('0x2f');var _0x301839=_0x585e8e['count'];var _0x5e6dc0=_0x534e6b?0x0:_0x583e52[_0x6276('0x2e')];var _0x54e864=_0x534e6b?_0x585e8e[_0x6276('0x31')]:_0x583e52[_0x6276('0x2e')]+_0x583e52[_0x6276('0x30')];var _0x487cf4;if(_0x54e864>=_0x301839){_0x54e864=_0x301839;_0x487cf4=0xc8;}else{_0x487cf4=0xce;}_0x446c34[_0x6276('0x2b')](_0x487cf4);return _0x446c34['set'](_0x6276('0x32'),_0x5e6dc0+'-'+_0x54e864+'/'+_0x301839)[_0x6276('0x2d')](_0x585e8e);}return null;};}function patchUpdates(_0x93aa17){return function(_0x1f80d9){try{jsonpatch['apply'](_0x1f80d9,_0x93aa17,!![]);}catch(_0x4a0555){return BPromise[_0x6276('0x33')](_0x4a0555);}return _0x1f80d9['save']();};}function saveUpdates(_0x16a85c,_0x20b8de){return function(_0xd637c2){if(_0xd637c2){return _0xd637c2[_0x6276('0x34')](_0x16a85c)[_0x6276('0x1f')](function(_0xaf71dc){return _0xaf71dc;});}return null;};}function removeEntity(_0x3b59ac,_0x5eb5fe){return function(_0x4ea335){if(_0x4ea335){return _0x4ea335[_0x6276('0x35')]()[_0x6276('0x1f')](function(){_0x3b59ac[_0x6276('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x64872f,_0x38b0e9){return function(_0x5ae216){if(!_0x5ae216){_0x64872f[_0x6276('0x2a')](0x194);}return _0x5ae216;};}function handleError(_0x59175a,_0x4b865b){_0x4b865b=_0x4b865b||0x1f4;return function(_0x199c2b){logger[_0x6276('0x25')](_0x199c2b['stack']);if(_0x199c2b[_0x6276('0x36')]){delete _0x199c2b[_0x6276('0x36')];}_0x59175a[_0x6276('0x2b')](_0x4b865b)['send'](_0x199c2b);};}exports[_0x6276('0x37')]=function(_0x266962,_0x33b74c){var _0x3c0991={},_0x5f086d={},_0x508496={'count':0x0,'rows':[]};var _0x1446f0=_[_0x6276('0x38')](db[_0x6276('0x39')]['rawAttributes'],function(_0x4dedc){return{'name':_0x4dedc['fieldName'],'type':_0x4dedc['type']['key']};});_0x5f086d[_0x6276('0x3a')]=_[_0x6276('0x38')](_0x1446f0,_0x6276('0x36'));_0x5f086d[_0x6276('0x3b')]=_[_0x6276('0x3c')](_0x266962[_0x6276('0x3b')]);_0x5f086d[_0x6276('0x3d')]=_[_0x6276('0x3e')](_0x5f086d[_0x6276('0x3a')],_0x5f086d['query']);_0x3c0991[_0x6276('0x3f')]=_[_0x6276('0x3e')](_0x5f086d[_0x6276('0x3a')],qs[_0x6276('0x40')](_0x266962[_0x6276('0x3b')][_0x6276('0x40')]));_0x3c0991[_0x6276('0x3f')]=_0x3c0991[_0x6276('0x3f')]['length']?_0x3c0991[_0x6276('0x3f')]:_0x5f086d[_0x6276('0x3a')];if(!_0x266962[_0x6276('0x3b')][_0x6276('0x41')](_0x6276('0x42'))){_0x3c0991['limit']=qs[_0x6276('0x30')](_0x266962[_0x6276('0x3b')][_0x6276('0x30')]);_0x3c0991[_0x6276('0x2e')]=qs[_0x6276('0x2e')](_0x266962['query'][_0x6276('0x2e')]);}_0x3c0991[_0x6276('0x43')]=qs[_0x6276('0x44')](_0x266962[_0x6276('0x3b')][_0x6276('0x44')]);_0x3c0991[_0x6276('0x45')]=qs['filters'](_['pick'](_0x266962[_0x6276('0x3b')],_0x5f086d['filters']),_0x1446f0);if(_0x266962[_0x6276('0x3b')]['filter']){_0x3c0991[_0x6276('0x45')]=_['merge'](_0x3c0991[_0x6276('0x45')],{'$or':_['map'](_0x1446f0,function(_0x35f69f){if(_0x35f69f[_0x6276('0x46')]!=='VIRTUAL'){var _0x2d7eaa={};_0x2d7eaa[_0x35f69f[_0x6276('0x36')]]={'$like':'%'+_0x266962[_0x6276('0x3b')][_0x6276('0x47')]+'%'};return _0x2d7eaa;}})});}_0x3c0991=_[_0x6276('0x48')]({},_0x3c0991,_0x266962['options']);var _0x23403f={'where':_0x3c0991['where']};return db[_0x6276('0x39')]['count'](_0x23403f)['then'](function(_0x1db2bd){_0x508496['count']=_0x1db2bd;if(_0x266962[_0x6276('0x3b')]['includeAll']){_0x3c0991[_0x6276('0x49')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x6276('0x4a')](_0x3c0991);})[_0x6276('0x1f')](function(_0x5dd350){_0x508496[_0x6276('0x4b')]=_0x5dd350;return _0x508496;})[_0x6276('0x1f')](respondWithFilteredResult(_0x33b74c,_0x3c0991))[_0x6276('0x29')](handleError(_0x33b74c,null));};exports[_0x6276('0x4c')]=function(_0x244b74,_0x412e75){var _0x3a06df={'raw':!![],'where':{'id':_0x244b74['params']['id']}},_0xf1b725={};_0xf1b725[_0x6276('0x3a')]=_[_0x6276('0x3c')](db[_0x6276('0x39')][_0x6276('0x4d')]);_0xf1b725[_0x6276('0x3b')]=_[_0x6276('0x3c')](_0x244b74[_0x6276('0x3b')]);_0xf1b725['filters']=_[_0x6276('0x3e')](_0xf1b725[_0x6276('0x3a')],_0xf1b725[_0x6276('0x3b')]);_0x3a06df[_0x6276('0x3f')]=_[_0x6276('0x3e')](_0xf1b725[_0x6276('0x3a')],qs[_0x6276('0x40')](_0x244b74[_0x6276('0x3b')][_0x6276('0x40')]));_0x3a06df[_0x6276('0x3f')]=_0x3a06df[_0x6276('0x3f')]['length']?_0x3a06df[_0x6276('0x3f')]:_0xf1b725['model'];if(_0x244b74['query'][_0x6276('0x4e')]){_0x3a06df[_0x6276('0x49')]=[{'all':!![]}];}_0x3a06df=_[_0x6276('0x48')]({},_0x3a06df,_0x244b74[_0x6276('0x4f')]);return db['WhatsappMessage'][_0x6276('0x50')](_0x3a06df)[_0x6276('0x1f')](handleEntityNotFound(_0x412e75,null))['then'](respondWithResult(_0x412e75,null))[_0x6276('0x29')](handleError(_0x412e75,null));};exports[_0x6276('0x51')]=function(_0x149d64,_0x1d1939){return db['WhatsappMessage'][_0x6276('0x51')](_0x149d64['body'],{})['then'](respondWithResult(_0x1d1939,0xc9))[_0x6276('0x29')](handleError(_0x1d1939,null));};exports[_0x6276('0x34')]=function(_0x198fc3,_0xa3ef4d){if(_0x198fc3['body']['id']){delete _0x198fc3[_0x6276('0x52')]['id'];}return db[_0x6276('0x39')][_0x6276('0x50')]({'where':{'id':_0x198fc3['params']['id']}})[_0x6276('0x1f')](handleEntityNotFound(_0xa3ef4d,null))['then'](saveUpdates(_0x198fc3['body'],null))[_0x6276('0x1f')](respondWithResult(_0xa3ef4d,null))['catch'](handleError(_0xa3ef4d,null));};exports[_0x6276('0x35')]=function(_0x1d4101,_0x52d540){return db['WhatsappMessage']['find']({'where':{'id':_0x1d4101[_0x6276('0x53')]['id']}})[_0x6276('0x1f')](handleEntityNotFound(_0x52d540,null))[_0x6276('0x1f')](removeEntity(_0x52d540,null))[_0x6276('0x29')](handleError(_0x52d540,null));};exports['describe']=function(_0x4e2811,_0x2cb5d3){return db[_0x6276('0x39')][_0x6276('0x54')]()['then'](respondWithResult(_0x2cb5d3,null))[_0x6276('0x29')](handleError(_0x2cb5d3,null));};var interaction_log=require('../../config/logger')(_0x6276('0x55'));exports[_0x6276('0x56')]=function(_0x52d556,_0x5504bd,_0x3af6c8){var _0x2856fd={'agent':{},'channel':_0x6276('0x57')};if(_0x52d556['body']['id']){delete _0x52d556[_0x6276('0x52')]['id'];}_0x52d556[_0x6276('0x52')][_0x6276('0x58')]=!![];_0x52d556[_0x6276('0x52')][_0x6276('0x59')]=moment()['format'](_0x6276('0x5a'));_0x52d556[_0x6276('0x52')][_0x6276('0x5b')]=_0x52d556[_0x6276('0x52')]['UserId']||_0x52d556[_0x6276('0x5c')]['id'];_0x2856fd[_0x6276('0x5d')]['id']=_0x52d556[_0x6276('0x52')][_0x6276('0x5b')];return db['WhatsappMessage'][_0x6276('0x50')]({'where':{'id':_0x52d556[_0x6276('0x53')]['id'],'UserId':null}})[_0x6276('0x1f')](handleEntityNotFound(_0x5504bd,null))[_0x6276('0x1f')](saveUpdates(_0x52d556[_0x6276('0x52')],null))[_0x6276('0x1f')](function(_0x428dc2){if(_0x428dc2){_0x2856fd[_0x6276('0x27')]=_0x428dc2[_0x6276('0x5e')]({'plain':!![]});return db[_0x6276('0x5f')][_0x6276('0x50')]({'where':{'id':_0x428dc2['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x5504bd,null))[_0x6276('0x1f')](function(_0x52ee52){if(_0x52ee52){return _0x52ee52[_0x6276('0x34')]({'UserId':_0x52d556[_0x6276('0x52')]['UserId'],'read1stAt':_[_0x6276('0x60')](_0x52ee52[_0x6276('0x61')])?moment()['format'](_0x6276('0x5a')):undefined});}return null;})['then'](function(_0x4d0df0){if(_0x4d0df0){_0x2856fd['interaction']=_0x4d0df0['get']({'plain':!![]});interaction_log['info'](_0x6276('0x62'),_0x52d556[_0x6276('0x5c')]['id'],_0x52d556[_0x6276('0x5c')]['name'],_0x52d556['user'][_0x6276('0x63')],_0x2856fd['interaction']['id'],_0x52d556[_0x6276('0x52')]?JSON[_0x6276('0x24')](_0x52d556[_0x6276('0x52')]):_0x6276('0x64'));return respondWithRpcPromise(_0x6276('0x65'),_0x6276('0x66'),_0x2856fd);}return null;})[_0x6276('0x1f')](function(_0x3e5082){var _0x5746ca='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3e5082[_0x6276('0x27')]['ContactId'];return db[_0x6276('0x67')][_0x6276('0x3b')](_0x5746ca,{'type':db[_0x6276('0x68')][_0x6276('0x69')][_0x6276('0x6a')],'raw':!![]})[_0x6276('0x1f')](function(_0x413290){return _0x413290;});})[_0x6276('0x1f')](function(_0x776086){if(_0x776086){_0x2856fd['message'][_0x6276('0x6b')]=_0x776086[0x0];if(!_0x52d556[_0x6276('0x52')][_0x6276('0x5b')])return;return db[_0x6276('0x6c')][_0x6276('0x50')]({'where':{'id':_0x52d556[_0x6276('0x52')][_0x6276('0x5b')],'role':'agent'},'attributes':['id','name',_0x6276('0x6d'),_0x6276('0x6e'),'internal'],'raw':!![]});}return null;})['then'](function(_0x17d2fc){if(!_0x17d2fc)return null;_0x2856fd[_0x6276('0x27')][_0x6276('0x5d')]=_0x17d2fc;return _0x2856fd;})[_0x6276('0x1f')](function(_0x376868){if(_0x376868){if(_0x52d556[_0x6276('0x52')][_0x6276('0x6f')]){_0x2856fd[_0x6276('0x27')]['interface']=util[_0x6276('0x70')](_0x6276('0x71'),_0x52d556[_0x6276('0x5c')][_0x6276('0x36')]);_0x2856fd[_0x6276('0x27')][_0x6276('0x72')]=_0x2856fd[_0x6276('0x72')];_0x2856fd[_0x6276('0x27')][_0x6276('0x73')]=_0x2856fd[_0x6276('0x72')];_0x2856fd[_0x6276('0x27')][_0x6276('0x74')]=_0x6276('0x56');return respondWithRpcPromise('EventManager',_0x6276('0x75'),{'event':'acceptmessage','message':_0x2856fd[_0x6276('0x27')]},client9002)[_0x6276('0x1f')](function(){return _0x2856fd;});}return _0x2856fd;}return null;})['then'](respondWithResult(_0x5504bd,null))[_0x6276('0x29')](handleError(_0x5504bd,null));};var interaction_log=require(_0x6276('0x12'))(_0x6276('0x55'));exports[_0x6276('0x33')]=function(_0x644305,_0x4f800e,_0x3b9993){var _0x28d5c8={'agent':{},'channel':_0x6276('0x57')};if(_0x644305[_0x6276('0x52')]['id']){delete _0x644305[_0x6276('0x52')]['id'];}_0x644305[_0x6276('0x52')]['UserId']=_0x644305[_0x6276('0x52')]['UserId']||_0x644305['user']['id'];_0x28d5c8['agent']['id']=_0x644305[_0x6276('0x52')][_0x6276('0x5b')];return db[_0x6276('0x39')][_0x6276('0x50')]({'where':{'id':_0x644305[_0x6276('0x53')]['id'],'UserId':null}})[_0x6276('0x1f')](handleEntityNotFound(_0x4f800e,null))[_0x6276('0x1f')](function(_0x485f9b){if(_0x485f9b){_0x28d5c8[_0x6276('0x27')]=_0x485f9b[_0x6276('0x5e')]({'plain':!![]});return db['WhatsappInteraction'][_0x6276('0x50')]({'where':{'id':_0x485f9b['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4f800e,null))['then'](function(_0x201c9d){if(_0x201c9d){_0x28d5c8[_0x6276('0x76')]=_0x201c9d['get']({'plain':!![]});interaction_log[_0x6276('0x20')](_0x6276('0x77'),_0x644305[_0x6276('0x5c')]['id'],_0x644305[_0x6276('0x5c')][_0x6276('0x36')],_0x644305['user']['role'],_0x28d5c8['interaction']['id'],_0x644305[_0x6276('0x52')]?JSON[_0x6276('0x24')](_0x644305[_0x6276('0x52')]):_0x6276('0x64'));return respondWithRpcPromise(_0x6276('0x78'),_0x6276('0x79'),_0x28d5c8);}return null;})[_0x6276('0x1f')](function(_0x239799){var _0x3a3ef3=_0x6276('0x7a')+_0x239799[_0x6276('0x27')]['ContactId'];return db[_0x6276('0x67')][_0x6276('0x3b')](_0x3a3ef3,{'type':db[_0x6276('0x68')][_0x6276('0x69')]['SELECT'],'raw':!![]})[_0x6276('0x1f')](function(_0x3ca285){return _0x3ca285;});})[_0x6276('0x1f')](function(_0x14dc45){if(_0x14dc45){_0x28d5c8[_0x6276('0x27')][_0x6276('0x6b')]=_0x14dc45[0x0];if(!_0x644305['body']['UserId'])return;return db[_0x6276('0x6c')]['find']({'where':{'id':_0x644305[_0x6276('0x52')][_0x6276('0x5b')],'role':'agent'},'attributes':['id',_0x6276('0x36'),_0x6276('0x6d'),_0x6276('0x6e'),_0x6276('0x7b')],'raw':!![]});}return null;})[_0x6276('0x1f')](function(_0x3fe550){if(!_0x3fe550)return null;_0x28d5c8[_0x6276('0x27')]['agent']=_0x3fe550;return _0x28d5c8;})['then'](function(_0x460cf5){if(_0x460cf5){_0x460cf5[_0x6276('0x27')]['interface']=util[_0x6276('0x70')]('SIP/%s',_0x644305[_0x6276('0x5c')][_0x6276('0x36')]);_0x460cf5['message'][_0x6276('0x72')]=_0x28d5c8[_0x6276('0x72')];_0x460cf5[_0x6276('0x27')][_0x6276('0x73')]=_0x28d5c8['channel'];_0x460cf5[_0x6276('0x27')][_0x6276('0x74')]=_0x6276('0x33');respondWithRpcPromise('EventManager',_0x6276('0x75'),{'event':_0x6276('0x7c'),'message':_0x460cf5[_0x6276('0x27')]},client9002);return _0x28d5c8;}return null;})['then'](respondWithResult(_0x4f800e,null))[_0x6276('0x29')](handleError(_0x4f800e,null));};exports[_0x6276('0x2b')]=function(_0x39a098,_0x49ea49,_0x208eb0){if(_0x39a098[_0x6276('0x52')]['id']){delete _0x39a098[_0x6276('0x52')]['id'];}var _0x3d6b69;return db[_0x6276('0x39')][_0x6276('0x50')]({'where':{'id':_0x39a098[_0x6276('0x53')]['id']}})[_0x6276('0x1f')](handleEntityNotFound(_0x49ea49,null))[_0x6276('0x1f')](function(_0x1ad043){if(_0x1ad043){_0x3d6b69=_0x1ad043;return db['WhatsappAccount'][_0x6276('0x50')]({'where':{'id':_0x1ad043['WhatsappAccountId']}});}})['then'](handleEntityNotFound(_0x49ea49,null))[_0x6276('0x1f')](function(_0x44e910){if(_0x44e910){logger[_0x6276('0x22')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x6276('0x2b'),_0x6276('0x7d'),_0x44e910[_0x6276('0x46')],util[_0x6276('0x7e')](_0x39a098[_0x6276('0x52')],{'showHidden':![],'depth':null}));switch(_0x44e910[_0x6276('0x46')]){case _0x6276('0x7f'):if(_0x39a098['body']['MessageSid']&&_0x39a098[_0x6276('0x52')][_0x6276('0x80')]===_0x3d6b69['messageId']&&_0x39a098['body'][_0x6276('0x81')]&&_0x39a098[_0x6276('0x52')][_0x6276('0x81')]===_0x6276('0x58')){return _0x3d6b69['update']({'read':!![]});}else{logger[_0x6276('0x25')](_0x6276('0x82'),_0x6276('0x2b'),_0x6276('0x7f'),util[_0x6276('0x7e')](_0x39a098[_0x6276('0x52')],{'showHidden':![],'depth':null}));}break;}return _0x3d6b69;}})[_0x6276('0x1f')](respondWithResult(_0x49ea49,null))['catch'](handleError(_0x49ea49,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index ab250f2..e8c3ffe 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 _0x6c76=['update','emit','hook','events','../../mysqldb','WhatsappMessage','save'];(function(_0x5f37cf,_0x1e18e){var _0x3a7569=function(_0x16afb8){while(--_0x16afb8){_0x5f37cf['push'](_0x5f37cf['shift']());}};_0x3a7569(++_0x1e18e);}(_0x6c76,0x184));var _0x66c7=function(_0x3f9f17,_0x1339d9){_0x3f9f17=_0x3f9f17-0x0;var _0x420462=_0x6c76[_0x3f9f17];return _0x420462;};'use strict';var EventEmitter=require(_0x66c7('0x0'));var WhatsappMessage=require(_0x66c7('0x1'))['db'][_0x66c7('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x66c7('0x3'),'afterUpdate':_0x66c7('0x4'),'afterDestroy':'remove'};function emitEvent(_0x572a2b){return function(_0x2f6db7,_0x2b7cf3,_0x49d437){WhatsappMessageEvents[_0x66c7('0x5')](_0x572a2b+':'+_0x2f6db7['id'],_0x2f6db7);WhatsappMessageEvents[_0x66c7('0x5')](_0x572a2b,_0x2f6db7);_0x49d437(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0x66c7('0x6')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0xd914=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x4b5813,_0x5769de){var _0x423465=function(_0x18071f){while(--_0x18071f){_0x4b5813['push'](_0x4b5813['shift']());}};_0x423465(++_0x5769de);}(_0xd914,0x17f));var _0x4d91=function(_0x102f97,_0x5bda2f){_0x102f97=_0x102f97-0x0;var _0xd22058=_0xd914[_0x102f97];return _0xd22058;};'use strict';var EventEmitter=require(_0x4d91('0x0'));var WhatsappMessage=require(_0x4d91('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x4d91('0x2')](0x0);var events={'afterCreate':_0x4d91('0x3'),'afterUpdate':_0x4d91('0x4'),'afterDestroy':_0x4d91('0x5')};function emitEvent(_0xb829cf){return function(_0x2db8c5,_0x4875a2,_0x1b256e){WhatsappMessageEvents['emit'](_0xb829cf+':'+_0x2db8c5['id'],_0x2db8c5);WhatsappMessageEvents[_0x4d91('0x6')](_0xb829cf,_0x2db8c5);_0x1b256e(null);};}for(var e in events){if(events[_0x4d91('0x7')](e)){var event=events[e];WhatsappMessage[_0x4d91('0x8')](e,emitEvent(event));}}module[_0x4d91('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 7a22470..78c9aa6 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 _0xce77=['path','../../config/environment','exports','define','whatsapp_messages','messageId','fti_whatsapp_messages','models','get','direction','toLowerCase','isNil','UserId','WhatsappInteractionId','then','update','createdAt','error','out','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','messages','create','body','whatsapp:','phone','remote','/api/whatsapp/messages/','/status?token=','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','/whatsapp/v1/','/messages/','text','Bearer\x20','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','node-fetch'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xce77,0x18e));var _0x7ce7=function(_0x5b8abf,_0x5b198e){_0x5b8abf=_0x5b8abf-0x0;var _0x2b8ff6=_0xce77[_0x5b8abf];return _0x2b8ff6;};'use strict';var _=require(_0x7ce7('0x0'));var util=require(_0x7ce7('0x1'));var logger=require(_0x7ce7('0x2'))(_0x7ce7('0x3'));var moment=require(_0x7ce7('0x4'));var BPromise=require(_0x7ce7('0x5'));var rp=require(_0x7ce7('0x6'));var fetch=require(_0x7ce7('0x7'));var fs=require('fs');var path=require(_0x7ce7('0x8'));var rimraf=require('rimraf');var config=require(_0x7ce7('0x9'));var attributes=require('./whatsappMessage.attributes');module[_0x7ce7('0xa')]=function(_0x44fffd,_0x151451){return _0x44fffd[_0x7ce7('0xb')]('WhatsappMessage',attributes,{'tableName':_0x7ce7('0xc'),'paranoid':![],'indexes':[{'name':_0x7ce7('0xd'),'fields':[_0x7ce7('0xd')]},{'name':_0x7ce7('0xe'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5ed452,_0xaba8a0,_0x2bdff8){var _0x1a6511=_0x44fffd[_0x7ce7('0xf')];var _0x3103cb=_0x5ed452[_0x7ce7('0x10')]({'plain':!![]});if(_0x3103cb[_0x7ce7('0x11')][_0x7ce7('0x12')]()==='in'||_0x3103cb['direction'][_0x7ce7('0x12')]()==='out'&&!_0x3103cb['secret']&&!_[_0x7ce7('0x13')](_0x3103cb[_0x7ce7('0x14')])){_0x1a6511['WhatsappInteraction']['findOne']({'where':{'id':_0x3103cb[_0x7ce7('0x15')]}})[_0x7ce7('0x16')](function(_0x122d62){if(_0x122d62){_0x122d62[_0x7ce7('0x17')]({'lastMsgAt':_0x3103cb[_0x7ce7('0x18')],'lastMsgDirection':_0x3103cb['direction'][_0x7ce7('0x12')]()});}})['catch'](function(_0x3b9fe){console[_0x7ce7('0x19')](_0x3b9fe);});}if(_0x3103cb['direction']===_0x7ce7('0x1a')&&!_0x3103cb['secret']){var _0x76fb87;_0x1a6511[_0x7ce7('0x1b')][_0x7ce7('0x1c')]({'where':{'id':_0x3103cb[_0x7ce7('0x1d')]},'raw':!![]})[_0x7ce7('0x16')](function(_0x9ddb24){_0x76fb87=_0x9ddb24;if(_0x76fb87&&_0x76fb87['type']){switch(_0x76fb87[_0x7ce7('0x1e')]){case _0x7ce7('0x1f'):var _0x5b0a5d=require('twilio');if(_0x76fb87[_0x7ce7('0x20')]&&_0x76fb87[_0x7ce7('0x21')]&&_0x76fb87['phone']){var _0x15937f=new _0x5b0a5d(_0x76fb87[_0x7ce7('0x20')],_0x76fb87['authToken']);_0x15937f[_0x7ce7('0x22')][_0x7ce7('0x23')]({'body':_0x3103cb[_0x7ce7('0x24')],'to':_0x7ce7('0x25')+_0x3103cb[_0x7ce7('0x26')],'from':_0x7ce7('0x25')+_0x76fb87[_0x7ce7('0x26')],'statusCallback':_0x76fb87[_0x7ce7('0x27')]+_0x7ce7('0x28')+_0x3103cb['id']+_0x7ce7('0x29')+_0x76fb87['token']})[_0x7ce7('0x16')](function(_0x53b351){if(_0x53b351['sid']){return _0x5ed452[_0x7ce7('0x17')]({'messageId':_0x53b351[_0x7ce7('0x2a')]});}})[_0x7ce7('0x2b')](function(_0x4ac435){logger[_0x7ce7('0x19')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x7ce7('0x1f'),util['inspect'](_0x4ac435,{'showHidden':![],'depth':null}));});}else{logger[_0x7ce7('0x19')](_0x7ce7('0x2c'),'afterCreate',_0x7ce7('0x1f'),_0x7ce7('0x2d'));}break;case _0x7ce7('0x2e'):var _0x45e828=_0x76fb87[_0x7ce7('0x20')];var _0x163043=_0x76fb87['authToken'];var _0x5b662d=_0x76fb87['baseUrl']+_0x7ce7('0x2f')+_0x45e828+_0x7ce7('0x30');var _0x12136b={'to':[_0x3103cb[_0x7ce7('0x26')]],'message':{'type':_0x7ce7('0x31'),'text':_0x3103cb['body']}};var _0x4de7ea={'method':'POST','uri':_0x5b662d,'headers':{'Authorization':_0x7ce7('0x32')+_0x163043,'Content-Type':'application/json'},'body':_0x12136b,'json':!![]};rp(_0x4de7ea)['then'](function(_0x386e1f){if(_0x386e1f[_0x7ce7('0x33')][0x0][_0x7ce7('0x34')]){return _0x5ed452['update']({'messageId':_0x386e1f[_0x7ce7('0x33')][0x0][_0x7ce7('0x34')]});}})[_0x7ce7('0x2b')](function(_0x23a76){logger[_0x7ce7('0x35')](_0x7ce7('0x36'),_0x23a76);});break;}}})[_0x7ce7('0x37')](function(){_0x2bdff8();});}else{_0x2bdff8();}}},'charset':_0x7ce7('0x38'),'collate':_0x7ce7('0x39')});}; \ No newline at end of file +var _0x1989=['toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','WhatsappInteractionId','then','createdAt','catch','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','token','sid','update','inspect','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','text','Bearer\x20','application/json','statuses','message_id','WhatsappMessage,\x20%s','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappMessage.attributes','exports','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','direction'];(function(_0x541a67,_0x50728d){var _0x45da2a=function(_0x158929){while(--_0x158929){_0x541a67['push'](_0x541a67['shift']());}};_0x45da2a(++_0x50728d);}(_0x1989,0x119));var _0x9198=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1989[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9198('0x0'));var util=require(_0x9198('0x1'));var logger=require(_0x9198('0x2'))(_0x9198('0x3'));var moment=require(_0x9198('0x4'));var BPromise=require(_0x9198('0x5'));var rp=require(_0x9198('0x6'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0x9198('0x7'));var rimraf=require('rimraf');var config=require(_0x9198('0x8'));var attributes=require(_0x9198('0x9'));module[_0x9198('0xa')]=function(_0x80540a,_0x495070){return _0x80540a['define'](_0x9198('0xb'),attributes,{'tableName':_0x9198('0xc'),'paranoid':![],'indexes':[{'name':_0x9198('0xd'),'fields':[_0x9198('0xd')]},{'name':_0x9198('0xe'),'fields':[_0x9198('0xf')],'type':_0x9198('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xfa3e80,_0x194fe1,_0x15d5ef){var _0x42f556=_0x80540a[_0x9198('0x11')];var _0x3d023a=_0xfa3e80['get']({'plain':!![]});if(_0x3d023a[_0x9198('0x12')]['toLowerCase']()==='in'||_0x3d023a['direction'][_0x9198('0x13')]()===_0x9198('0x14')&&!_0x3d023a[_0x9198('0x15')]&&!_[_0x9198('0x16')](_0x3d023a[_0x9198('0x17')])){_0x42f556[_0x9198('0x18')]['findOne']({'where':{'id':_0x3d023a[_0x9198('0x19')]}})[_0x9198('0x1a')](function(_0x10f8d2){if(_0x10f8d2){_0x10f8d2['update']({'lastMsgAt':_0x3d023a[_0x9198('0x1b')],'lastMsgDirection':_0x3d023a['direction'][_0x9198('0x13')]()});}})[_0x9198('0x1c')](function(_0x575cbb){console['error'](_0x575cbb);});}if(_0x3d023a[_0x9198('0x12')]===_0x9198('0x14')&&!_0x3d023a[_0x9198('0x15')]){var _0x407be8;_0x42f556[_0x9198('0x1d')][_0x9198('0x1e')]({'where':{'id':_0x3d023a[_0x9198('0x1f')]},'raw':!![]})[_0x9198('0x1a')](function(_0x23acd2){_0x407be8=_0x23acd2;if(_0x407be8&&_0x407be8[_0x9198('0x20')]){switch(_0x407be8[_0x9198('0x20')]){case _0x9198('0x21'):var _0x829f1b=require(_0x9198('0x21'));if(_0x407be8[_0x9198('0x22')]&&_0x407be8['authToken']&&_0x407be8[_0x9198('0x23')]){var _0x4f5a6e=new _0x829f1b(_0x407be8['accountSid'],_0x407be8['authToken']);_0x4f5a6e[_0x9198('0x24')][_0x9198('0x25')]({'body':_0x3d023a[_0x9198('0xf')],'to':_0x9198('0x26')+_0x3d023a['phone'],'from':_0x9198('0x26')+_0x407be8[_0x9198('0x23')],'statusCallback':_0x407be8[_0x9198('0x27')]+_0x9198('0x28')+_0x3d023a['id']+'/status?token='+_0x407be8[_0x9198('0x29')]})[_0x9198('0x1a')](function(_0x4ceb2c){if(_0x4ceb2c[_0x9198('0x2a')]){return _0xfa3e80[_0x9198('0x2b')]({'messageId':_0x4ceb2c[_0x9198('0x2a')]});}})[_0x9198('0x1c')](function(_0x25633c){logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x9198('0x21'),util[_0x9198('0x2c')](_0x25633c,{'showHidden':![],'depth':null}));});}else{logger[_0x9198('0x2d')](_0x9198('0x2e'),_0x9198('0x2f'),_0x9198('0x21'),_0x9198('0x30'));}break;case _0x9198('0x31'):var _0x4c601e=_0x407be8[_0x9198('0x22')];var _0x59aeab=_0x407be8['authToken'];var _0x123b22=_0x407be8[_0x9198('0x32')]+_0x9198('0x33')+_0x4c601e+'/messages/';var _0x504405={'to':[_0x3d023a[_0x9198('0x23')]],'message':{'type':_0x9198('0x34'),'text':_0x3d023a[_0x9198('0xf')]}};var _0x462661={'method':'POST','uri':_0x123b22,'headers':{'Authorization':_0x9198('0x35')+_0x59aeab,'Content-Type':_0x9198('0x36')},'body':_0x504405,'json':!![]};rp(_0x462661)[_0x9198('0x1a')](function(_0x3ef6f8){if(_0x3ef6f8['statuses'][0x0]['message_id']){return _0xfa3e80[_0x9198('0x2b')]({'messageId':_0x3ef6f8[_0x9198('0x37')][0x0][_0x9198('0x38')]});}})[_0x9198('0x1c')](function(_0x4f79ce){logger['err'](_0x9198('0x39'),_0x4f79ce);});break;}}})[_0x9198('0x3a')](function(){_0x15d5ef();});}else{_0x15d5ef();}}},'charset':'utf8mb4','collate':_0x9198('0x3b')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 51c19dc..3afa711 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 _0x8a15=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./whatsappMessage.socket','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','CreateWhatsappMessage','WhatsappMessage','body','options','raw','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x8a15,0x1e6));var _0x58a1=function(_0x599da4,_0x2ec53d){_0x599da4=_0x599da4-0x0;var _0x380805=_0x8a15[_0x599da4];return _0x380805;};'use strict';var _=require(_0x58a1('0x0'));var util=require(_0x58a1('0x1'));var moment=require('moment');var BPromise=require(_0x58a1('0x2'));var rs=require(_0x58a1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x58a1('0x4'))['db'];var utils=require(_0x58a1('0x5'));var logger=require(_0x58a1('0x6'))('rpc');var config=require(_0x58a1('0x7'));var jayson=require(_0x58a1('0x8'));var client=jayson[_0x58a1('0x9')][_0x58a1('0xa')]({'port':0x232a});config[_0x58a1('0xb')]=_[_0x58a1('0xc')](config['redis'],{'host':_0x58a1('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x58a1('0xb')]));require(_0x58a1('0xe'))['register'](socket);function respondWithRpcPromise(_0xe95149,_0x41a617,_0x2f1ca8){return new BPromise(function(_0x36625d,_0x2d9e19){return client['request'](_0xe95149,_0x2f1ca8)[_0x58a1('0xf')](function(_0xdef45f){logger[_0x58a1('0x10')](_0x58a1('0x11'),_0x41a617,_0x58a1('0x12'));logger[_0x58a1('0x13')](_0x58a1('0x14'),_0x41a617,_0x58a1('0x12'),JSON[_0x58a1('0x15')](_0xdef45f));if(_0xdef45f[_0x58a1('0x16')]){if(_0xdef45f[_0x58a1('0x16')]['code']===0x1f4){logger[_0x58a1('0x16')](_0x58a1('0x11'),_0x41a617,_0xdef45f[_0x58a1('0x16')][_0x58a1('0x17')]);return _0x2d9e19(_0xdef45f['error']['message']);}logger['error'](_0x58a1('0x11'),_0x41a617,_0xdef45f[_0x58a1('0x16')]['message']);return _0x36625d(_0xdef45f[_0x58a1('0x16')][_0x58a1('0x17')]);}else{logger['info'](_0x58a1('0x11'),_0x41a617,_0x58a1('0x12'));_0x36625d(_0xdef45f['result'][_0x58a1('0x17')]);}})['catch'](function(_0x1e201e){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x41a617,_0x1e201e);_0x2d9e19(_0x1e201e);});});}exports[_0x58a1('0x18')]=function(_0xe1572b){var _0x3ce3d2=this;return new Promise(function(_0x2c3490,_0x5f3aae){return db[_0x58a1('0x19')]['create'](_0xe1572b[_0x58a1('0x1a')],{'raw':_0xe1572b['options']?_0xe1572b[_0x58a1('0x1b')][_0x58a1('0x1c')]===undefined?!![]:![]:!![]})[_0x58a1('0xf')](function(_0x686fd1){logger[_0x58a1('0x10')](_0x58a1('0x18'),_0xe1572b);logger[_0x58a1('0x13')]('CreateWhatsappMessage',_0xe1572b,JSON['stringify'](_0x686fd1));_0x2c3490(_0x686fd1);})['catch'](function(_0x4e3c83){logger[_0x58a1('0x16')](_0x58a1('0x18'),_0x4e3c83[_0x58a1('0x17')],_0xe1572b);_0x5f3aae(_0x3ce3d2[_0x58a1('0x16')](0x1f4,_0x4e3c83['message']));});});}; \ No newline at end of file +var _0xf873=['create','options','raw','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','defaults','redis','socket.io-emitter','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateWhatsappMessage','WhatsappMessage'];(function(_0xcf5cd1,_0x53bd6c){var _0x26c502=function(_0x200506){while(--_0x200506){_0xcf5cd1['push'](_0xcf5cd1['shift']());}};_0x26c502(++_0x53bd6c);}(_0xf873,0x7c));var _0x3f87=function(_0x39ec15,_0x305f36){_0x39ec15=_0x39ec15-0x0;var _0x23a65a=_0xf873[_0x39ec15];return _0x23a65a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3f87('0x0'));var BPromise=require(_0x3f87('0x1'));var rs=require(_0x3f87('0x2'));var fs=require('fs');var Redis=require(_0x3f87('0x3'));var db=require(_0x3f87('0x4'))['db'];var utils=require(_0x3f87('0x5'));var logger=require(_0x3f87('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3f87('0x7')][_0x3f87('0x8')]({'port':0x232a});config['redis']=_[_0x3f87('0x9')](config[_0x3f87('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x3f87('0xb'))(new Redis(config[_0x3f87('0xa')]));require('./whatsappMessage.socket')['register'](socket);function respondWithRpcPromise(_0x452b12,_0x4d1225,_0xc482de){return new BPromise(function(_0x5817be,_0x31dfa9){return client[_0x3f87('0xc')](_0x452b12,_0xc482de)[_0x3f87('0xd')](function(_0xe4d7df){logger[_0x3f87('0xe')](_0x3f87('0xf'),_0x4d1225,_0x3f87('0x10'));logger[_0x3f87('0x11')](_0x3f87('0x12'),_0x4d1225,'request\x20sent',JSON[_0x3f87('0x13')](_0xe4d7df));if(_0xe4d7df[_0x3f87('0x14')]){if(_0xe4d7df['error'][_0x3f87('0x15')]===0x1f4){logger[_0x3f87('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x4d1225,_0xe4d7df[_0x3f87('0x14')]['message']);return _0x31dfa9(_0xe4d7df[_0x3f87('0x14')][_0x3f87('0x16')]);}logger['error'](_0x3f87('0xf'),_0x4d1225,_0xe4d7df[_0x3f87('0x14')][_0x3f87('0x16')]);return _0x5817be(_0xe4d7df['error']['message']);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x4d1225,'request\x20sent');_0x5817be(_0xe4d7df[_0x3f87('0x17')][_0x3f87('0x16')]);}})['catch'](function(_0x599037){logger[_0x3f87('0x14')](_0x3f87('0xf'),_0x4d1225,_0x599037);_0x31dfa9(_0x599037);});});}exports[_0x3f87('0x18')]=function(_0x140fdd){var _0x597f1c=this;return new Promise(function(_0x9016d6,_0x22ba2d){return db[_0x3f87('0x19')][_0x3f87('0x1a')](_0x140fdd['body'],{'raw':_0x140fdd[_0x3f87('0x1b')]?_0x140fdd[_0x3f87('0x1b')][_0x3f87('0x1c')]===undefined?!![]:![]:!![]})[_0x3f87('0xd')](function(_0x168a11){logger[_0x3f87('0xe')]('CreateWhatsappMessage',_0x140fdd);logger[_0x3f87('0x11')](_0x3f87('0x18'),_0x140fdd,JSON['stringify'](_0x168a11));_0x9016d6(_0x168a11);})[_0x3f87('0x1d')](function(_0x24c7c3){logger[_0x3f87('0x14')]('CreateWhatsappMessage',_0x24c7c3[_0x3f87('0x16')],_0x140fdd);_0x22ba2d(_0x597f1c[_0x3f87('0x14')](0x1f4,_0x24c7c3[_0x3f87('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 766ccc4..0753756 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 _0x972c=['length','whatsappMessage:','./whatsappMessage.events','update','emit','removeListener','register'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x972c,0x1de));var _0xc972=function(_0x406ddc,_0xca0824){_0x406ddc=_0x406ddc-0x0;var _0x31f788=_0x972c[_0x406ddc];return _0x31f788;};'use strict';var WhatsappMessageEvents=require(_0xc972('0x0'));var events=['save','remove',_0xc972('0x1')];function createListener(_0x447dd0,_0x432a47){return function(_0x2d5260){_0x432a47[_0xc972('0x2')](_0x447dd0,_0x2d5260);};}function removeListener(_0x54f6c9,_0x51556f){return function(){WhatsappMessageEvents[_0xc972('0x3')](_0x54f6c9,_0x51556f);};}exports[_0xc972('0x4')]=function(_0x1b05d8){for(var _0x1ac84c=0x0,_0x570211=events[_0xc972('0x5')];_0x1ac84c<_0x570211;_0x1ac84c++){var _0x560181=events[_0x1ac84c];var _0xbe7c14=createListener(_0xc972('0x6')+_0x560181,_0x1b05d8);WhatsappMessageEvents['on'](_0x560181,_0xbe7c14);}}; \ No newline at end of file +var _0xa451=['save','remove','update','emit','removeListener','register','length','./whatsappMessage.events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa451,0xf7));var _0x1a45=function(_0x8a632a,_0x3fddf4){_0x8a632a=_0x8a632a-0x0;var _0x32aac9=_0xa451[_0x8a632a];return _0x32aac9;};'use strict';var WhatsappMessageEvents=require(_0x1a45('0x0'));var events=[_0x1a45('0x1'),_0x1a45('0x2'),_0x1a45('0x3')];function createListener(_0x433eec,_0x1d7f13){return function(_0xb6e6c8){_0x1d7f13[_0x1a45('0x4')](_0x433eec,_0xb6e6c8);};}function removeListener(_0x20459c,_0x283a53){return function(){WhatsappMessageEvents[_0x1a45('0x5')](_0x20459c,_0x283a53);};}exports[_0x1a45('0x6')]=function(_0x4d4b82){for(var _0x22c07f=0x0,_0x5e0b2b=events[_0x1a45('0x7')];_0x22c07f<_0x5e0b2b;_0x22c07f++){var _0x140bfd=events[_0x22c07f];var _0x31ed9a=createListener('whatsappMessage:'+_0x140bfd,_0x4d4b82);WhatsappMessageEvents['on'](_0x140bfd,_0x31ed9a);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 01dd527..cafeda9 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 _0x3125=['/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','destroy','delete','removeTeams','removeAgents','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members'];(function(_0x12a682,_0x3e1a55){var _0x396bff=function(_0x4065cb){while(--_0x4065cb){_0x12a682['push'](_0x12a682['shift']());}};_0x396bff(++_0x3e1a55);}(_0x3125,0x1e9));var _0x5312=function(_0x347c60,_0x3db92e){_0x347c60=_0x347c60-0x0;var _0x2d9300=_0x3125[_0x347c60];return _0x2d9300;};'use strict';var multer=require('multer');var util=require(_0x5312('0x0'));var path=require('path');var timeout=require(_0x5312('0x1'));var express=require(_0x5312('0x2'));var router=express[_0x5312('0x3')]();var fs_extra=require(_0x5312('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5312('0x5'));var config=require(_0x5312('0x6'));var controller=require(_0x5312('0x7'));router[_0x5312('0x8')]('/',auth[_0x5312('0x9')](),controller[_0x5312('0xa')]);router['get'](_0x5312('0xb'),auth[_0x5312('0x9')](),controller['describe']);router[_0x5312('0x8')](_0x5312('0xc'),auth[_0x5312('0x9')](),controller[_0x5312('0xd')]);router[_0x5312('0x8')](_0x5312('0xe'),auth[_0x5312('0x9')](),controller['getMembers']);router[_0x5312('0x8')](_0x5312('0xf'),auth[_0x5312('0x9')](),controller[_0x5312('0x10')]);router[_0x5312('0x8')]('/:id/users',auth[_0x5312('0x9')](),controller[_0x5312('0x11')]);router[_0x5312('0x12')]('/',auth[_0x5312('0x9')](),controller[_0x5312('0x13')]);router['post'](_0x5312('0xf'),auth['isAuthenticated'](),controller[_0x5312('0x14')]);router['post'](_0x5312('0x15'),auth[_0x5312('0x9')](),controller[_0x5312('0x16')]);router['put']('/:id',auth[_0x5312('0x9')](),controller['update']);router['delete'](_0x5312('0xc'),auth[_0x5312('0x9')](),controller[_0x5312('0x17')]);router[_0x5312('0x18')](_0x5312('0xf'),auth[_0x5312('0x9')](),controller[_0x5312('0x19')]);router[_0x5312('0x18')](_0x5312('0x15'),auth[_0x5312('0x9')](),controller[_0x5312('0x1a')]);module[_0x5312('0x1b')]=router; \ No newline at end of file +var _0x2f0f=['getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','/describe','/:id','show','/:id/members','/:id/teams'];(function(_0x1df2b7,_0x2d14c6){var _0x113082=function(_0x1a550f){while(--_0x1a550f){_0x1df2b7['push'](_0x1df2b7['shift']());}};_0x113082(++_0x2d14c6);}(_0x2f0f,0xc2));var _0xf2f0=function(_0x4aaaef,_0x4cd2d0){_0x4aaaef=_0x4aaaef-0x0;var _0xbe59a=_0x2f0f[_0x4aaaef];return _0xbe59a;};'use strict';var multer=require(_0xf2f0('0x0'));var util=require(_0xf2f0('0x1'));var path=require(_0xf2f0('0x2'));var timeout=require(_0xf2f0('0x3'));var express=require(_0xf2f0('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf2f0('0x5'));var interaction=require(_0xf2f0('0x6'));var config=require(_0xf2f0('0x7'));var controller=require(_0xf2f0('0x8'));router[_0xf2f0('0x9')]('/',auth[_0xf2f0('0xa')](),controller['index']);router[_0xf2f0('0x9')](_0xf2f0('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xf2f0('0x9')](_0xf2f0('0xc'),auth['isAuthenticated'](),controller[_0xf2f0('0xd')]);router[_0xf2f0('0x9')](_0xf2f0('0xe'),auth['isAuthenticated'](),controller['getMembers']);router[_0xf2f0('0x9')](_0xf2f0('0xf'),auth[_0xf2f0('0xa')](),controller[_0xf2f0('0x10')]);router[_0xf2f0('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0xf2f0('0x11')]);router[_0xf2f0('0x12')]('/',auth[_0xf2f0('0xa')](),controller[_0xf2f0('0x13')]);router['post'](_0xf2f0('0xf'),auth[_0xf2f0('0xa')](),controller[_0xf2f0('0x14')]);router[_0xf2f0('0x12')](_0xf2f0('0x15'),auth[_0xf2f0('0xa')](),controller[_0xf2f0('0x16')]);router[_0xf2f0('0x17')](_0xf2f0('0xc'),auth[_0xf2f0('0xa')](),controller[_0xf2f0('0x18')]);router[_0xf2f0('0x19')](_0xf2f0('0xc'),auth[_0xf2f0('0xa')](),controller[_0xf2f0('0x1a')]);router[_0xf2f0('0x19')](_0xf2f0('0xf'),auth['isAuthenticated'](),controller[_0xf2f0('0x1b')]);router[_0xf2f0('0x19')]('/:id/users',auth[_0xf2f0('0xa')](),controller[_0xf2f0('0x1c')]);module[_0xf2f0('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 67d5178..e15fe3d 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 _0x22a4=['ENUM','rrmemory','beepall','sequelize','exports','STRING','name','INTEGER'];(function(_0x310d10,_0x3fe887){var _0x1fb8af=function(_0x42965b){while(--_0x42965b){_0x310d10['push'](_0x310d10['shift']());}};_0x1fb8af(++_0x3fe887);}(_0x22a4,0x1cb));var _0x422a=function(_0x1de7e8,_0x355ee5){_0x1de7e8=_0x1de7e8-0x0;var _0x41b9ea=_0x22a4[_0x1de7e8];return _0x41b9ea;};'use strict';var Sequelize=require(_0x422a('0x0'));module[_0x422a('0x1')]={'name':{'type':Sequelize[_0x422a('0x2')],'unique':_0x422a('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x422a('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x422a('0x5')](_0x422a('0x6'),_0x422a('0x7'),'roundrobin')},'description':{'type':Sequelize[_0x422a('0x2')]}}; \ No newline at end of file +var _0xd49c=['rrmemory','roundrobin','exports','name','INTEGER'];(function(_0xc8e161,_0x1a6442){var _0xe18698=function(_0x3d081f){while(--_0x3d081f){_0xc8e161['push'](_0xc8e161['shift']());}};_0xe18698(++_0x1a6442);}(_0xd49c,0x1d8));var _0xcd49=function(_0x7189a7,_0x422df9){_0x7189a7=_0x7189a7-0x0;var _0x5bc1c0=_0xd49c[_0x7189a7];return _0x5bc1c0;};'use strict';var Sequelize=require('sequelize');module[_0xcd49('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xcd49('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xcd49('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xcd49('0x3'),'beepall',_0xcd49('0x4'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index f0423e3..5f301d3 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 _0xb233=['apply','reject','update','get','UserProfileResource','then','error','name','send','index','map','WhatsappQueue','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','WhatsappQueues','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','describe','getMembers','findOne','hasOwnProperty','UserWhatsappQueue','User','UserId','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','removeTeams','ids','select','field','tq.TeamId','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','userWhatsappQueue:remove','addAgents','omit','spread','userWhatsappQueue:save','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','redis','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','end','status','offset','limit','count','set','Content-Range'];(function(_0x4d05f8,_0x3efc70){var _0x220513=function(_0x3058aa){while(--_0x3058aa){_0x4d05f8['push'](_0x4d05f8['shift']());}};_0x220513(++_0x3efc70);}(_0xb233,0x68));var _0x3b23=function(_0x2a5fae,_0x2da03f){_0x2a5fae=_0x2a5fae-0x0;var _0x1325bf=_0xb233[_0x2a5fae];return _0x1325bf;};'use strict';var emlformat=require(_0x3b23('0x0'));var rimraf=require(_0x3b23('0x1'));var zipdir=require(_0x3b23('0x2'));var jsonpatch=require(_0x3b23('0x3'));var rp=require('request-promise');var moment=require(_0x3b23('0x4'));var BPromise=require(_0x3b23('0x5'));var Mustache=require(_0x3b23('0x6'));var util=require(_0x3b23('0x7'));var path=require(_0x3b23('0x8'));var sox=require(_0x3b23('0x9'));var csv=require(_0x3b23('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3b23('0xb'));var _=require(_0x3b23('0xc'));var squel=require(_0x3b23('0xd'));var crypto=require('crypto');var jsforce=require(_0x3b23('0xe'));var deskjs=require(_0x3b23('0xf'));var toCsv=require(_0x3b23('0xa'));var querystring=require(_0x3b23('0x10'));var Papa=require('papaparse');var Redis=require(_0x3b23('0x11'));var authService=require(_0x3b23('0x12'));var qs=require(_0x3b23('0x13'));var as=require(_0x3b23('0x14'));var hardwareService=require(_0x3b23('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x3b23('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x3b23('0x17'))['db'];config[_0x3b23('0x18')]=_['defaults'](config[_0x3b23('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x3b23('0x19'))(new Redis(config[_0x3b23('0x18')]));require(_0x3b23('0x1a'))[_0x3b23('0x1b')](socket);function respondWithStatusCode(_0x1330d0,_0x56e9e3){_0x56e9e3=_0x56e9e3||0xcc;return function(_0x461c24){if(_0x461c24){return _0x1330d0[_0x3b23('0x1c')](_0x56e9e3);}return _0x1330d0['status'](_0x56e9e3)[_0x3b23('0x1d')]();};}function respondWithResult(_0x3d1ac7,_0x1d60da){_0x1d60da=_0x1d60da||0xc8;return function(_0x512395){if(_0x512395){return _0x3d1ac7[_0x3b23('0x1e')](_0x1d60da)['json'](_0x512395);}};}function respondWithFilteredResult(_0x1b92cb,_0x2f86ca){return function(_0x1713e7){if(_0x1713e7){var _0x51481d=typeof _0x2f86ca[_0x3b23('0x1f')]==='undefined'&&typeof _0x2f86ca[_0x3b23('0x20')]==='undefined';var _0x43e169=_0x1713e7[_0x3b23('0x21')];var _0x459c6f=_0x51481d?0x0:_0x2f86ca[_0x3b23('0x1f')];var _0x51170f=_0x51481d?_0x1713e7[_0x3b23('0x21')]:_0x2f86ca[_0x3b23('0x1f')]+_0x2f86ca[_0x3b23('0x20')];var _0x127922;if(_0x51170f>=_0x43e169){_0x51170f=_0x43e169;_0x127922=0xc8;}else{_0x127922=0xce;}_0x1b92cb[_0x3b23('0x1e')](_0x127922);return _0x1b92cb[_0x3b23('0x22')](_0x3b23('0x23'),_0x459c6f+'-'+_0x51170f+'/'+_0x43e169)['json'](_0x1713e7);}return null;};}function patchUpdates(_0x4fd7c6){return function(_0x4b0baa){try{jsonpatch[_0x3b23('0x24')](_0x4b0baa,_0x4fd7c6,!![]);}catch(_0x1e7cd7){return BPromise[_0x3b23('0x25')](_0x1e7cd7);}return _0x4b0baa['save']();};}function saveUpdates(_0x295e7d,_0x53b22d){return function(_0x58a49b){if(_0x58a49b){return _0x58a49b[_0x3b23('0x26')](_0x295e7d)['then'](function(_0x261352){return _0x261352;});}return null;};}function removeEntity(_0x5131f9,_0x374aa1){return function(_0x3b3800){if(_0x3b3800){return _0x3b3800['destroy']()['then'](function(){var _0x1ecf0a=_0x3b3800[_0x3b23('0x27')]({'plain':!![]});var _0x10a998='WhatsappQueues';return db[_0x3b23('0x28')]['destroy']({'where':{'type':_0x10a998,'resourceId':_0x1ecf0a['id']}})[_0x3b23('0x29')](function(){return _0x3b3800;});})['then'](function(){_0x5131f9[_0x3b23('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13dbd7,_0x458d92){return function(_0x502597){if(!_0x502597){_0x13dbd7[_0x3b23('0x1c')](0x194);}return _0x502597;};}function handleError(_0x3b38ec,_0x512cd0){_0x512cd0=_0x512cd0||0x1f4;return function(_0x34be61){logger[_0x3b23('0x2a')](_0x34be61['stack']);if(_0x34be61[_0x3b23('0x2b')]){delete _0x34be61['name'];}_0x3b38ec[_0x3b23('0x1e')](_0x512cd0)[_0x3b23('0x2c')](_0x34be61);};}exports[_0x3b23('0x2d')]=function(_0x5c7803,_0x1618d1){var _0x41f068={},_0x2ebfab={},_0x2ddf4f={'count':0x0,'rows':[]};var _0x18d76b=_[_0x3b23('0x2e')](db[_0x3b23('0x2f')]['rawAttributes'],function(_0x5e62be){return{'name':_0x5e62be[_0x3b23('0x30')],'type':_0x5e62be['type'][_0x3b23('0x31')]};});_0x2ebfab[_0x3b23('0x32')]=_[_0x3b23('0x2e')](_0x18d76b,_0x3b23('0x2b'));_0x2ebfab[_0x3b23('0x33')]=_[_0x3b23('0x34')](_0x5c7803[_0x3b23('0x33')]);_0x2ebfab[_0x3b23('0x35')]=_[_0x3b23('0x36')](_0x2ebfab[_0x3b23('0x32')],_0x2ebfab[_0x3b23('0x33')]);_0x41f068[_0x3b23('0x37')]=_['intersection'](_0x2ebfab[_0x3b23('0x32')],qs['fields'](_0x5c7803[_0x3b23('0x33')][_0x3b23('0x38')]));_0x41f068[_0x3b23('0x37')]=_0x41f068[_0x3b23('0x37')][_0x3b23('0x39')]?_0x41f068['attributes']:_0x2ebfab[_0x3b23('0x32')];if(!_0x5c7803[_0x3b23('0x33')]['hasOwnProperty'](_0x3b23('0x3a'))){_0x41f068[_0x3b23('0x20')]=qs[_0x3b23('0x20')](_0x5c7803['query'][_0x3b23('0x20')]);_0x41f068[_0x3b23('0x1f')]=qs[_0x3b23('0x1f')](_0x5c7803['query'][_0x3b23('0x1f')]);}_0x41f068[_0x3b23('0x3b')]=qs[_0x3b23('0x3c')](_0x5c7803[_0x3b23('0x33')][_0x3b23('0x3c')]);_0x41f068['where']=qs['filters'](_[_0x3b23('0x3d')](_0x5c7803[_0x3b23('0x33')],_0x2ebfab['filters']),_0x18d76b);if(_0x5c7803[_0x3b23('0x33')][_0x3b23('0x3e')]){_0x41f068[_0x3b23('0x3f')]=_[_0x3b23('0x40')](_0x41f068[_0x3b23('0x3f')],{'$or':_[_0x3b23('0x2e')](_0x18d76b,function(_0x4bdb7e){if(_0x4bdb7e['type']!=='VIRTUAL'){var _0x4ddd1f={};_0x4ddd1f[_0x4bdb7e['name']]={'$like':'%'+_0x5c7803['query']['filter']+'%'};return _0x4ddd1f;}})});}_0x41f068=_['merge']({},_0x41f068,_0x5c7803[_0x3b23('0x41')]);var _0x5656d6={'where':_0x41f068[_0x3b23('0x3f')]};return db[_0x3b23('0x2f')]['count'](_0x5656d6)[_0x3b23('0x29')](function(_0x2b9e9f){_0x2ddf4f[_0x3b23('0x21')]=_0x2b9e9f;if(_0x5c7803[_0x3b23('0x33')][_0x3b23('0x42')]){_0x41f068[_0x3b23('0x43')]=[{'all':!![]}];}return db[_0x3b23('0x2f')][_0x3b23('0x44')](_0x41f068);})[_0x3b23('0x29')](function(_0x313ee6){_0x2ddf4f[_0x3b23('0x45')]=_0x313ee6;return _0x2ddf4f;})[_0x3b23('0x29')](respondWithFilteredResult(_0x1618d1,_0x41f068))[_0x3b23('0x46')](handleError(_0x1618d1,null));};exports[_0x3b23('0x47')]=function(_0x231288,_0x1c9fc2){var _0xe3f457={'raw':!![],'where':{'id':_0x231288[_0x3b23('0x48')]['id']}},_0x32dc19={};_0x32dc19['model']=_[_0x3b23('0x34')](db['WhatsappQueue'][_0x3b23('0x49')]);_0x32dc19['query']=_['keys'](_0x231288[_0x3b23('0x33')]);_0x32dc19['filters']=_[_0x3b23('0x36')](_0x32dc19[_0x3b23('0x32')],_0x32dc19[_0x3b23('0x33')]);_0xe3f457[_0x3b23('0x37')]=_['intersection'](_0x32dc19[_0x3b23('0x32')],qs[_0x3b23('0x38')](_0x231288[_0x3b23('0x33')][_0x3b23('0x38')]));_0xe3f457['attributes']=_0xe3f457[_0x3b23('0x37')]['length']?_0xe3f457[_0x3b23('0x37')]:_0x32dc19[_0x3b23('0x32')];if(_0x231288[_0x3b23('0x33')][_0x3b23('0x42')]){_0xe3f457[_0x3b23('0x43')]=[{'all':!![]}];}_0xe3f457=_[_0x3b23('0x40')]({},_0xe3f457,_0x231288[_0x3b23('0x41')]);return db['WhatsappQueue']['find'](_0xe3f457)[_0x3b23('0x29')](handleEntityNotFound(_0x1c9fc2,null))[_0x3b23('0x29')](respondWithResult(_0x1c9fc2,null))['catch'](handleError(_0x1c9fc2,null));};exports[_0x3b23('0x4a')]=function(_0x11eb9a,_0xc2dd35){return db[_0x3b23('0x2f')]['create'](_0x11eb9a['body'],{})['then'](function(_0x26b9a3){var _0x2b147c=_0x11eb9a['user'][_0x3b23('0x27')]({'plain':!![]});if(!_0x2b147c)throw new Error(_0x3b23('0x4b'));if(_0x2b147c['role']===_0x3b23('0x4c')){var _0x48332a=_0x26b9a3[_0x3b23('0x27')]({'plain':!![]});var _0xd1b0d3=_0x3b23('0x4d');return db[_0x3b23('0x4e')][_0x3b23('0x4f')]({'where':{'name':_0xd1b0d3,'userProfileId':_0x2b147c[_0x3b23('0x50')]},'raw':!![]})['then'](function(_0x5d690b){if(_0x5d690b&&_0x5d690b[_0x3b23('0x51')]===0x0){return db[_0x3b23('0x28')]['create']({'name':_0x48332a[_0x3b23('0x2b')],'resourceId':_0x48332a['id'],'type':_0x5d690b[_0x3b23('0x2b')],'sectionId':_0x5d690b['id']},{})[_0x3b23('0x29')](function(){return _0x26b9a3;});}else{return _0x26b9a3;}})[_0x3b23('0x46')](function(_0x30bd58){logger[_0x3b23('0x2a')](_0x3b23('0x52'),_0x30bd58);throw _0x30bd58;});}return _0x26b9a3;})[_0x3b23('0x29')](respondWithResult(_0xc2dd35,0xc9))[_0x3b23('0x46')](handleError(_0xc2dd35,null));};exports['update']=function(_0x3eb8ca,_0x2eafe6){if(_0x3eb8ca['body']['id']){delete _0x3eb8ca[_0x3b23('0x53')]['id'];}return db[_0x3b23('0x2f')][_0x3b23('0x4f')]({'where':{'id':_0x3eb8ca[_0x3b23('0x48')]['id']}})[_0x3b23('0x29')](handleEntityNotFound(_0x2eafe6,null))[_0x3b23('0x29')](saveUpdates(_0x3eb8ca[_0x3b23('0x53')],null))[_0x3b23('0x29')](respondWithResult(_0x2eafe6,null))[_0x3b23('0x46')](handleError(_0x2eafe6,null));};exports[_0x3b23('0x54')]=function(_0x10b379,_0x37881c){return db[_0x3b23('0x2f')][_0x3b23('0x4f')]({'where':{'id':_0x10b379[_0x3b23('0x48')]['id']}})[_0x3b23('0x29')](handleEntityNotFound(_0x37881c,null))[_0x3b23('0x29')](removeEntity(_0x37881c,null))[_0x3b23('0x46')](handleError(_0x37881c,null));};exports['describe']=function(_0x36ea10,_0x4e6d8d){return db['WhatsappQueue'][_0x3b23('0x55')]()[_0x3b23('0x29')](respondWithResult(_0x4e6d8d,null))[_0x3b23('0x46')](handleError(_0x4e6d8d,null));};exports[_0x3b23('0x56')]=function(_0x44a9dc,_0xfb6dc5,_0x1c44d1){var _0x1963df={'raw':!![],'where':{}},_0x3668fd={},_0x2dc73f;return db[_0x3b23('0x2f')][_0x3b23('0x57')]({'where':{'id':_0x44a9dc[_0x3b23('0x48')]['id']}})[_0x3b23('0x29')](handleEntityNotFound(_0xfb6dc5,null))[_0x3b23('0x29')](function(_0xeae4f3){if(_0xeae4f3){_0x2dc73f=_0xeae4f3[_0x3b23('0x27')]({'plain':!![]});_0x3668fd['model']=_[_0x3b23('0x34')](db['UserWhatsappQueue'][_0x3b23('0x49')]);_0x3668fd[_0x3b23('0x33')]=_[_0x3b23('0x34')](_0x44a9dc[_0x3b23('0x33')]);_0x3668fd[_0x3b23('0x35')]=_[_0x3b23('0x36')](_0x3668fd['model'],_0x3668fd[_0x3b23('0x33')]);_0x1963df['attributes']=_[_0x3b23('0x36')](_0x3668fd[_0x3b23('0x32')],qs[_0x3b23('0x38')](_0x44a9dc[_0x3b23('0x33')][_0x3b23('0x38')]));_0x1963df[_0x3b23('0x37')]=_0x1963df[_0x3b23('0x37')]['length']?_0x1963df[_0x3b23('0x37')]:_0x3668fd[_0x3b23('0x32')];if(!_0x44a9dc['query'][_0x3b23('0x58')](_0x3b23('0x3a'))){_0x1963df[_0x3b23('0x20')]=qs[_0x3b23('0x20')](_0x44a9dc[_0x3b23('0x33')][_0x3b23('0x20')]);_0x1963df[_0x3b23('0x1f')]=qs[_0x3b23('0x1f')](_0x44a9dc['query'][_0x3b23('0x1f')]);}_0x1963df['order']=qs['sort'](_0x44a9dc[_0x3b23('0x33')][_0x3b23('0x3c')]);_0x1963df[_0x3b23('0x3f')]=qs[_0x3b23('0x35')](_[_0x3b23('0x3d')](_0x44a9dc['query'],_0x3668fd[_0x3b23('0x35')]));_0x1963df['where']['WhatsappQueueId']=_0xeae4f3['id'];if(_0x44a9dc[_0x3b23('0x33')][_0x3b23('0x3e')]){_0x1963df[_0x3b23('0x3f')]=_[_0x3b23('0x40')](_0x1963df[_0x3b23('0x3f')],{'$or':_[_0x3b23('0x2e')](_0x1963df[_0x3b23('0x37')],function(_0x581bc7){var _0x5f2521={};_0x5f2521[_0x581bc7]={'$like':'%'+_0x44a9dc['query'][_0x3b23('0x3e')]+'%'};return _0x5f2521;})});}_0x1963df=_[_0x3b23('0x40')]({},_0x1963df,_0x44a9dc[_0x3b23('0x41')]);return db[_0x3b23('0x59')][_0x3b23('0x44')](_0x1963df);}})['then'](function(_0xd422bc){if(_0xd422bc){return db[_0x3b23('0x5a')]['findAndCountAll']({'where':{'id':_[_0x3b23('0x2e')](_0xd422bc,_0x3b23('0x5b')),'role':'agent'},'attributes':['id',_0x3b23('0x2b'),_0x3b23('0x5c'),_0x3b23('0x5d'),_0x3b23('0x5e')]});}})[_0x3b23('0x29')](function(_0x3bed43){if(_0x3bed43){return{'count':_0x3bed43[_0x3b23('0x21')],'rows':_[_0x3b23('0x2e')](_0x3bed43[_0x3b23('0x45')],function(_0xd97a08){return{'membername':_0xd97a08[_0x3b23('0x2b')],'UserId':_0xd97a08['id'],'queue_name':_0x2dc73f['name'],'WhatsappQueueId':_0x2dc73f['id'],'interface':util[_0x3b23('0x5f')](_0x3b23('0x60'),_0x3b23('0x61'),_0xd97a08[_0x3b23('0x2b')]),'penalty':0x0,'paused':_0xd97a08[_0x3b23('0x5c')],'createdAt':_0xd97a08[_0x3b23('0x5e')],'updatedAt':_0xd97a08[_0x3b23('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3b23('0x29')](respondWithFilteredResult(_0xfb6dc5,_0x1963df))[_0x3b23('0x46')](handleError(_0xfb6dc5,null));};exports[_0x3b23('0x62')]=function(_0x36acfd,_0x69aaa9,_0x49aab5){var _0x4fb145={};var _0x1472e1={};var _0x9c1d5e;var _0xcfae9f;return db['WhatsappQueue'][_0x3b23('0x57')]({'where':{'id':_0x36acfd['params']['id']}})[_0x3b23('0x29')](handleEntityNotFound(_0x69aaa9,null))[_0x3b23('0x29')](function(_0x3d1a9a){if(_0x3d1a9a){_0x9c1d5e=_0x3d1a9a;_0x1472e1[_0x3b23('0x32')]=_['keys'](db[_0x3b23('0x63')][_0x3b23('0x49')]);_0x1472e1[_0x3b23('0x33')]=_[_0x3b23('0x34')](_0x36acfd[_0x3b23('0x33')]);_0x1472e1[_0x3b23('0x35')]=_[_0x3b23('0x36')](_0x1472e1[_0x3b23('0x32')],_0x1472e1[_0x3b23('0x33')]);_0x4fb145[_0x3b23('0x37')]=_[_0x3b23('0x36')](_0x1472e1[_0x3b23('0x32')],qs[_0x3b23('0x38')](_0x36acfd[_0x3b23('0x33')][_0x3b23('0x38')]));_0x4fb145[_0x3b23('0x37')]=_0x4fb145[_0x3b23('0x37')]['length']?_0x4fb145[_0x3b23('0x37')]:_0x1472e1[_0x3b23('0x32')];_0x4fb145[_0x3b23('0x3b')]=qs[_0x3b23('0x3c')](_0x36acfd[_0x3b23('0x33')][_0x3b23('0x3c')]);_0x4fb145[_0x3b23('0x3f')]=qs['filters'](_[_0x3b23('0x3d')](_0x36acfd['query'],_0x1472e1[_0x3b23('0x35')]));if(_0x36acfd['query'][_0x3b23('0x3e')]){_0x4fb145[_0x3b23('0x3f')]=_[_0x3b23('0x40')](_0x4fb145[_0x3b23('0x3f')],{'$or':_[_0x3b23('0x2e')](_0x4fb145[_0x3b23('0x37')],function(_0x2a2999){var _0x535d56={};_0x535d56[_0x2a2999]={'$like':'%'+_0x36acfd['query'][_0x3b23('0x3e')]+'%'};return _0x535d56;})});}_0x4fb145=_['merge']({},_0x4fb145,_0x36acfd[_0x3b23('0x41')]);return _0x9c1d5e[_0x3b23('0x62')](_0x4fb145);}})[_0x3b23('0x29')](function(_0x2c5630){if(_0x2c5630){_0xcfae9f=_0x2c5630[_0x3b23('0x39')];if(!_0x36acfd[_0x3b23('0x33')]['hasOwnProperty']('nolimit')){_0x4fb145[_0x3b23('0x20')]=qs[_0x3b23('0x20')](_0x36acfd[_0x3b23('0x33')]['limit']);_0x4fb145[_0x3b23('0x1f')]=qs['offset'](_0x36acfd[_0x3b23('0x33')][_0x3b23('0x1f')]);}return _0x9c1d5e[_0x3b23('0x62')](_0x4fb145);}})['then'](function(_0x4b281c){if(_0x4b281c){return _0x4b281c?{'count':_0xcfae9f,'rows':_0x4b281c}:null;}})[_0x3b23('0x29')](respondWithResult(_0x69aaa9,null))['catch'](handleError(_0x69aaa9,null));};exports[_0x3b23('0x64')]=function(_0x53ae0d,_0x1eeeb4,_0x1c4e61){var _0xfb3b40=_0x53ae0d['body']['ids'];return db[_0x3b23('0x63')][_0x3b23('0x44')]({'where':{'id':_0xfb3b40},'attributes':['id'],'include':[{'model':db[_0x3b23('0x5a')],'as':_0x3b23('0x65'),'attributes':['id',_0x3b23('0x2b'),_0x3b23('0x66'),_0x3b23('0x67'),_0x3b23('0x68')],'raw':!![]}]})[_0x3b23('0x29')](function(_0x1cc754){if(_0x1cc754){var _0x3f4f58=_[_0x3b23('0x69')](_0x1cc754,function(_0x8b39a9){var _0x28545f=_0x8b39a9['get']({'plain':!![]});return _0x28545f[_0x3b23('0x65')];});return db['WhatsappQueue'][_0x3b23('0x4f')]({'where':{'id':_0x53ae0d[_0x3b23('0x48')]['id']}})[_0x3b23('0x29')](function(_0x2f9ed5){return db[_0x3b23('0x6a')][_0x3b23('0x6b')](function(_0xe63ae0){return _0x2f9ed5[_0x3b23('0x64')](_0xfb3b40,{'transaction':_0xe63ae0})[_0x3b23('0x29')](function(){return BPromise['each'](_0x3f4f58,function(_0x2dc631){return db[_0x3b23('0x59')][_0x3b23('0x6c')]({'where':{'UserId':_0x2dc631['id'],'WhatsappQueueId':_0x53ae0d[_0x3b23('0x48')]['id']},'transaction':_0xe63ae0});});})['then'](function(){_0x3f4f58[_0x3b23('0x6d')](function(_0x3beff2){socket[_0x3b23('0x6e')]('userWhatsappQueue:save',{'UserId':_0x3beff2['id'],'WhatsappQueueId':_0x2f9ed5['id']});});});});});}})['then'](respondWithStatusCode(_0x1eeeb4,null))[_0x3b23('0x46')](handleError(_0x1eeeb4,null));};exports[_0x3b23('0x6f')]=function(_0x4749ab,_0xc3577f,_0x502786){return db[_0x3b23('0x63')][_0x3b23('0x44')]({'where':{'id':_0x4749ab[_0x3b23('0x33')][_0x3b23('0x70')]},'attributes':['id'],'include':[{'model':db[_0x3b23('0x5a')],'as':_0x3b23('0x65'),'attributes':['id'],'raw':!![]}]})[_0x3b23('0x29')](handleEntityNotFound(_0xc3577f,null))[_0x3b23('0x29')](function(_0x2dc335){var _0xe7986=_[_0x3b23('0x2e')](_0x2dc335,'id');var _0x3c92d0=[];var _0x3e6665=[];var _0x3c682c=squel[_0x3b23('0x71')]();_0x3c682c[_0x3b23('0x72')](_0x3b23('0x73'))['from']('team_has_whatsapp_queues','tq')['join'](_0x3b23('0x74'),'ut',_0x3b23('0x75'))[_0x3b23('0x3f')](_0x3b23('0x76'),_0x4749ab[_0x3b23('0x48')]['id']);for(var _0x4f9079=0x0;_0x4f9079<_0x2dc335[_0x3b23('0x39')];_0x4f9079+=0x1){let _0x9457b4=_0x2dc335[_0x4f9079];for(var _0x1bdd9f=0x0;_0x1bdd9f<_0x9457b4[_0x3b23('0x65')][_0x3b23('0x39')];_0x1bdd9f+=0x1){let _0x1ff76e=_0x9457b4[_0x3b23('0x65')][_0x1bdd9f];var _0x7bd059=_0x3c682c[_0x3b23('0x77')]();_0x7bd059[_0x3b23('0x3f')](_0x3b23('0x78'),_0x1ff76e['id']);_0x3e6665[_0x3b23('0x79')](db[_0x3b23('0x6a')][_0x3b23('0x33')](_0x7bd059[_0x3b23('0x7a')](),{'type':db['sequelize'][_0x3b23('0x7b')][_0x3b23('0x7c')]})[_0x3b23('0x29')](function(_0x467a4a){if(_0x467a4a[_0x3b23('0x39')]===0x1){return _0x1ff76e['id'];}else{var _0x11b4ac=_[_0x3b23('0x7d')](_[_0x3b23('0x2e')](_0x467a4a,_0x3b23('0x7e')),function(_0x348fd9){return _['includes'](_0xe7986,_0x348fd9);});if(_0x11b4ac){return _0x1ff76e['id'];}}}));}}return BPromise[_0x3b23('0x7f')](_0x3e6665)['then'](function(_0x30b678){_0x3c92d0=_(_0x3c92d0)[_0x3b23('0x80')](_0x30b678)[_0x3b23('0x81')]()[_0x3b23('0x82')]();return db['WhatsappQueue'][_0x3b23('0x4f')]({'where':{'id':_0x4749ab[_0x3b23('0x48')]['id']}})[_0x3b23('0x29')](function(_0x16d826){return db[_0x3b23('0x6a')]['transaction'](function(_0x278fb8){return _0x16d826[_0x3b23('0x6f')](_0x4749ab[_0x3b23('0x33')][_0x3b23('0x70')],{'transaction':_0x278fb8})[_0x3b23('0x29')](function(){if(!_[_0x3b23('0x83')](_0x3c92d0)){return _0x16d826['removeAgents'](_0x3c92d0,{'transaction':_0x278fb8});}})[_0x3b23('0x29')](function(){_0x3c92d0['forEach'](function(_0x118240){socket[_0x3b23('0x6e')](_0x3b23('0x84'),{'UserId':_0x118240,'WhatsappQueueId':_0x16d826['id']});});});});});});})[_0x3b23('0x29')](respondWithStatusCode(_0xc3577f,null))['catch'](handleError(_0xc3577f,null));};exports[_0x3b23('0x85')]=function(_0x5d54f5,_0x2dd3d7,_0x4cf3e1){return db[_0x3b23('0x2f')][_0x3b23('0x4f')]({'where':{'id':_0x5d54f5[_0x3b23('0x48')]['id']}})[_0x3b23('0x29')](handleEntityNotFound(_0x2dd3d7,null))[_0x3b23('0x29')](function(_0x59c392){if(_0x59c392){return _0x59c392[_0x3b23('0x85')](_0x5d54f5[_0x3b23('0x53')][_0x3b23('0x70')],_[_0x3b23('0x86')](_0x5d54f5[_0x3b23('0x53')],[_0x3b23('0x70'),'id'])||{})[_0x3b23('0x87')](function(_0x58d83f){for(var _0x540aaa=0x0;_0x540aaa<_0x5d54f5[_0x3b23('0x53')][_0x3b23('0x70')][_0x3b23('0x39')];_0x540aaa+=0x1){socket[_0x3b23('0x6e')](_0x3b23('0x88'),{'UserId':Number(_0x5d54f5[_0x3b23('0x53')][_0x3b23('0x70')][_0x540aaa]),'WhatsappQueueId':Number(_0x5d54f5[_0x3b23('0x48')]['id'])});}return _0x58d83f;});}})[_0x3b23('0x29')](respondWithResult(_0x2dd3d7,null))[_0x3b23('0x46')](handleError(_0x2dd3d7,null));};exports[_0x3b23('0x89')]=function(_0x49092a,_0x13c720,_0x10a4ba){return db[_0x3b23('0x2f')][_0x3b23('0x4f')]({'where':{'id':_0x49092a[_0x3b23('0x48')]['id']}})[_0x3b23('0x29')](handleEntityNotFound(_0x13c720,null))[_0x3b23('0x29')](function(_0x37a800){if(_0x37a800){return _0x37a800[_0x3b23('0x89')](_0x49092a[_0x3b23('0x33')][_0x3b23('0x70')])[_0x3b23('0x29')](function(){if(_[_0x3b23('0x8a')](_0x49092a['query']['ids'])){for(var _0x32db5d=0x0;_0x32db5d<_0x49092a[_0x3b23('0x33')]['ids'][_0x3b23('0x39')];_0x32db5d+=0x1){socket[_0x3b23('0x6e')](_0x3b23('0x84'),{'UserId':Number(_0x49092a[_0x3b23('0x33')][_0x3b23('0x70')][_0x32db5d]),'WhatsappQueueId':Number(_0x49092a[_0x3b23('0x48')]['id'])});}}else{socket[_0x3b23('0x6e')](_0x3b23('0x84'),{'UserId':Number(_0x49092a[_0x3b23('0x33')][_0x3b23('0x70')]),'WhatsappQueueId':Number(_0x49092a[_0x3b23('0x48')]['id'])});}});}})[_0x3b23('0x29')](respondWithStatusCode(_0x13c720,null))[_0x3b23('0x46')](handleError(_0x13c720,null));};exports[_0x3b23('0x8b')]=function(_0x4392d3,_0x413da2,_0x172392){var _0x3a5faa={};var _0x2025da={};var _0x45648d;var _0x12d5f8;return db[_0x3b23('0x2f')]['findOne']({'where':{'id':_0x4392d3['params']['id']}})[_0x3b23('0x29')](handleEntityNotFound(_0x413da2,null))['then'](function(_0x2928c2){if(_0x2928c2){_0x45648d=_0x2928c2;_0x2025da[_0x3b23('0x32')]=_[_0x3b23('0x34')](db['User'][_0x3b23('0x49')]);_0x2025da[_0x3b23('0x33')]=_[_0x3b23('0x34')](_0x4392d3[_0x3b23('0x33')]);_0x2025da['filters']=_['intersection'](_0x2025da[_0x3b23('0x32')],_0x2025da['query']);_0x3a5faa[_0x3b23('0x37')]=_[_0x3b23('0x36')](_0x2025da[_0x3b23('0x32')],qs[_0x3b23('0x38')](_0x4392d3[_0x3b23('0x33')][_0x3b23('0x38')]));_0x3a5faa['attributes']=_0x3a5faa[_0x3b23('0x37')][_0x3b23('0x39')]?_0x3a5faa[_0x3b23('0x37')]:_0x2025da[_0x3b23('0x32')];_0x3a5faa[_0x3b23('0x3b')]=qs['sort'](_0x4392d3[_0x3b23('0x33')][_0x3b23('0x3c')]);_0x3a5faa['where']=qs['filters'](_[_0x3b23('0x3d')](_0x4392d3['query'],_0x2025da[_0x3b23('0x35')]));if(_0x4392d3['query']['filter']){_0x3a5faa[_0x3b23('0x3f')]=_[_0x3b23('0x40')](_0x3a5faa['where'],{'$or':_[_0x3b23('0x2e')](_0x3a5faa[_0x3b23('0x37')],function(_0x1f2362){var _0x13e0fa={};_0x13e0fa[_0x1f2362]={'$like':'%'+_0x4392d3[_0x3b23('0x33')][_0x3b23('0x3e')]+'%'};return _0x13e0fa;})});}_0x3a5faa=_[_0x3b23('0x40')]({},_0x3a5faa,_0x4392d3['options']);return _0x45648d[_0x3b23('0x8b')](_0x3a5faa);}})['then'](function(_0x3abb36){if(_0x3abb36){_0x12d5f8=_0x3abb36['length'];if(!_0x4392d3[_0x3b23('0x33')][_0x3b23('0x58')](_0x3b23('0x3a'))){_0x3a5faa[_0x3b23('0x20')]=qs['limit'](_0x4392d3['query'][_0x3b23('0x20')]);_0x3a5faa[_0x3b23('0x1f')]=qs[_0x3b23('0x1f')](_0x4392d3['query'][_0x3b23('0x1f')]);}return _0x45648d[_0x3b23('0x8b')](_0x3a5faa);}})[_0x3b23('0x29')](function(_0x5bdc2d){if(_0x5bdc2d){return _0x5bdc2d?{'count':_0x12d5f8,'rows':_0x5bdc2d}:null;}})[_0x3b23('0x29')](respondWithResult(_0x413da2,null))[_0x3b23('0x46')](handleError(_0x413da2,null));}; \ No newline at end of file +var _0x0a03=['rimraf','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./whatsappQueue.socket','sendStatus','status','end','json','limit','offset','count','set','Content-Range','apply','reject','update','destroy','then','WhatsappQueues','error','stack','name','send','map','WhatsappQueue','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','includeAll','include','show','params','rawAttributes','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','catch','describe','getMembers','findOne','filter','UserWhatsappQueue','findAll','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','Team','ids','Agents','interface','sequelize','addTeams','each','findOrCreate','forEach','emit','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','push','toString','TeamId','all','union','compact','value','removeTeams','isEmpty','removeAgents','omit','userWhatsappQueue:save','isArray','userWhatsappQueue:remove','getAgents'];(function(_0x399b2a,_0x48d268){var _0x1995f1=function(_0x54259f){while(--_0x54259f){_0x399b2a['push'](_0x399b2a['shift']());}};_0x1995f1(++_0x48d268);}(_0x0a03,0x189));var _0x30a0=function(_0x71c2c1,_0x162a9e){_0x71c2c1=_0x71c2c1-0x0;var _0x1d29b8=_0x0a03[_0x71c2c1];return _0x1d29b8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x30a0('0x0'));var zipdir=require(_0x30a0('0x1'));var jsonpatch=require(_0x30a0('0x2'));var rp=require('request-promise');var moment=require(_0x30a0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x30a0('0x4'));var util=require('util');var path=require('path');var sox=require(_0x30a0('0x5'));var csv=require(_0x30a0('0x6'));var ejs=require(_0x30a0('0x7'));var fs=require('fs');var fs_extra=require(_0x30a0('0x8'));var _=require(_0x30a0('0x9'));var squel=require(_0x30a0('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x30a0('0xb'));var toCsv=require('to-csv');var querystring=require(_0x30a0('0xc'));var Papa=require(_0x30a0('0xd'));var Redis=require('ioredis');var authService=require(_0x30a0('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x30a0('0xf'));var logger=require(_0x30a0('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x30a0('0x11'));var licenseUtil=require(_0x30a0('0x12'));var db=require(_0x30a0('0x13'))['db'];config[_0x30a0('0x14')]=_['defaults'](config[_0x30a0('0x14')],{'host':_0x30a0('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x30a0('0x14')]));require(_0x30a0('0x16'))['register'](socket);function respondWithStatusCode(_0x5f030a,_0x424c5f){_0x424c5f=_0x424c5f||0xcc;return function(_0x2980c5){if(_0x2980c5){return _0x5f030a[_0x30a0('0x17')](_0x424c5f);}return _0x5f030a[_0x30a0('0x18')](_0x424c5f)[_0x30a0('0x19')]();};}function respondWithResult(_0x4a97b3,_0x1ba79a){_0x1ba79a=_0x1ba79a||0xc8;return function(_0x406aec){if(_0x406aec){return _0x4a97b3['status'](_0x1ba79a)[_0x30a0('0x1a')](_0x406aec);}};}function respondWithFilteredResult(_0x3090c8,_0x5f0aa6){return function(_0x5a2a1f){if(_0x5a2a1f){var _0x2837d2=typeof _0x5f0aa6['offset']==='undefined'&&typeof _0x5f0aa6[_0x30a0('0x1b')]==='undefined';var _0x110b57=_0x5a2a1f['count'];var _0x5a4bbd=_0x2837d2?0x0:_0x5f0aa6[_0x30a0('0x1c')];var _0x3794a4=_0x2837d2?_0x5a2a1f[_0x30a0('0x1d')]:_0x5f0aa6[_0x30a0('0x1c')]+_0x5f0aa6[_0x30a0('0x1b')];var _0x3fe57d;if(_0x3794a4>=_0x110b57){_0x3794a4=_0x110b57;_0x3fe57d=0xc8;}else{_0x3fe57d=0xce;}_0x3090c8[_0x30a0('0x18')](_0x3fe57d);return _0x3090c8[_0x30a0('0x1e')](_0x30a0('0x1f'),_0x5a4bbd+'-'+_0x3794a4+'/'+_0x110b57)[_0x30a0('0x1a')](_0x5a2a1f);}return null;};}function patchUpdates(_0xe77084){return function(_0x3577ad){try{jsonpatch[_0x30a0('0x20')](_0x3577ad,_0xe77084,!![]);}catch(_0x15157a){return BPromise[_0x30a0('0x21')](_0x15157a);}return _0x3577ad['save']();};}function saveUpdates(_0xb73d02,_0x482c68){return function(_0x9891ba){if(_0x9891ba){return _0x9891ba[_0x30a0('0x22')](_0xb73d02)['then'](function(_0x2c9adf){return _0x2c9adf;});}return null;};}function removeEntity(_0x538b19,_0x2dabee){return function(_0x373b17){if(_0x373b17){return _0x373b17[_0x30a0('0x23')]()[_0x30a0('0x24')](function(){var _0x4c6acf=_0x373b17['get']({'plain':!![]});var _0x19bfbe=_0x30a0('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x19bfbe,'resourceId':_0x4c6acf['id']}})[_0x30a0('0x24')](function(){return _0x373b17;});})[_0x30a0('0x24')](function(){_0x538b19[_0x30a0('0x18')](0xcc)[_0x30a0('0x19')]();});}};}function handleEntityNotFound(_0x4b680a,_0x3c25c1){return function(_0x5d8cf2){if(!_0x5d8cf2){_0x4b680a[_0x30a0('0x17')](0x194);}return _0x5d8cf2;};}function handleError(_0x426807,_0xdae528){_0xdae528=_0xdae528||0x1f4;return function(_0x540d49){logger[_0x30a0('0x26')](_0x540d49[_0x30a0('0x27')]);if(_0x540d49[_0x30a0('0x28')]){delete _0x540d49[_0x30a0('0x28')];}_0x426807[_0x30a0('0x18')](_0xdae528)[_0x30a0('0x29')](_0x540d49);};}exports['index']=function(_0x483798,_0x18a647){var _0xcc943={},_0x2bc1cb={},_0x5ddb14={'count':0x0,'rows':[]};var _0x417f11=_[_0x30a0('0x2a')](db[_0x30a0('0x2b')]['rawAttributes'],function(_0x5c5a81){return{'name':_0x5c5a81[_0x30a0('0x2c')],'type':_0x5c5a81[_0x30a0('0x2d')][_0x30a0('0x2e')]};});_0x2bc1cb[_0x30a0('0x2f')]=_['map'](_0x417f11,_0x30a0('0x28'));_0x2bc1cb[_0x30a0('0x30')]=_[_0x30a0('0x31')](_0x483798[_0x30a0('0x30')]);_0x2bc1cb[_0x30a0('0x32')]=_[_0x30a0('0x33')](_0x2bc1cb['model'],_0x2bc1cb[_0x30a0('0x30')]);_0xcc943[_0x30a0('0x34')]=_[_0x30a0('0x33')](_0x2bc1cb['model'],qs['fields'](_0x483798[_0x30a0('0x30')][_0x30a0('0x35')]));_0xcc943[_0x30a0('0x34')]=_0xcc943[_0x30a0('0x34')][_0x30a0('0x36')]?_0xcc943[_0x30a0('0x34')]:_0x2bc1cb[_0x30a0('0x2f')];if(!_0x483798[_0x30a0('0x30')][_0x30a0('0x37')](_0x30a0('0x38'))){_0xcc943['limit']=qs[_0x30a0('0x1b')](_0x483798[_0x30a0('0x30')][_0x30a0('0x1b')]);_0xcc943[_0x30a0('0x1c')]=qs[_0x30a0('0x1c')](_0x483798[_0x30a0('0x30')][_0x30a0('0x1c')]);}_0xcc943[_0x30a0('0x39')]=qs[_0x30a0('0x3a')](_0x483798[_0x30a0('0x30')][_0x30a0('0x3a')]);_0xcc943[_0x30a0('0x3b')]=qs['filters'](_[_0x30a0('0x3c')](_0x483798[_0x30a0('0x30')],_0x2bc1cb[_0x30a0('0x32')]),_0x417f11);if(_0x483798['query']['filter']){_0xcc943[_0x30a0('0x3b')]=_['merge'](_0xcc943[_0x30a0('0x3b')],{'$or':_[_0x30a0('0x2a')](_0x417f11,function(_0x302f75){if(_0x302f75[_0x30a0('0x2d')]!==_0x30a0('0x3d')){var _0x536be2={};_0x536be2[_0x302f75[_0x30a0('0x28')]]={'$like':'%'+_0x483798[_0x30a0('0x30')]['filter']+'%'};return _0x536be2;}})});}_0xcc943=_[_0x30a0('0x3e')]({},_0xcc943,_0x483798['options']);var _0x24028e={'where':_0xcc943[_0x30a0('0x3b')]};return db[_0x30a0('0x2b')][_0x30a0('0x1d')](_0x24028e)[_0x30a0('0x24')](function(_0x23ff81){_0x5ddb14[_0x30a0('0x1d')]=_0x23ff81;if(_0x483798[_0x30a0('0x30')][_0x30a0('0x3f')]){_0xcc943[_0x30a0('0x40')]=[{'all':!![]}];}return db[_0x30a0('0x2b')]['findAll'](_0xcc943);})['then'](function(_0xbb92c8){_0x5ddb14['rows']=_0xbb92c8;return _0x5ddb14;})[_0x30a0('0x24')](respondWithFilteredResult(_0x18a647,_0xcc943))['catch'](handleError(_0x18a647,null));};exports[_0x30a0('0x41')]=function(_0xa63fcd,_0x39d803){var _0x1000bb={'raw':!![],'where':{'id':_0xa63fcd[_0x30a0('0x42')]['id']}},_0x5d23a8={};_0x5d23a8['model']=_[_0x30a0('0x31')](db['WhatsappQueue'][_0x30a0('0x43')]);_0x5d23a8[_0x30a0('0x30')]=_[_0x30a0('0x31')](_0xa63fcd[_0x30a0('0x30')]);_0x5d23a8[_0x30a0('0x32')]=_['intersection'](_0x5d23a8[_0x30a0('0x2f')],_0x5d23a8[_0x30a0('0x30')]);_0x1000bb[_0x30a0('0x34')]=_[_0x30a0('0x33')](_0x5d23a8[_0x30a0('0x2f')],qs[_0x30a0('0x35')](_0xa63fcd[_0x30a0('0x30')][_0x30a0('0x35')]));_0x1000bb['attributes']=_0x1000bb[_0x30a0('0x34')][_0x30a0('0x36')]?_0x1000bb[_0x30a0('0x34')]:_0x5d23a8[_0x30a0('0x2f')];if(_0xa63fcd[_0x30a0('0x30')][_0x30a0('0x3f')]){_0x1000bb[_0x30a0('0x40')]=[{'all':!![]}];}_0x1000bb=_[_0x30a0('0x3e')]({},_0x1000bb,_0xa63fcd[_0x30a0('0x44')]);return db['WhatsappQueue']['find'](_0x1000bb)[_0x30a0('0x24')](handleEntityNotFound(_0x39d803,null))[_0x30a0('0x24')](respondWithResult(_0x39d803,null))['catch'](handleError(_0x39d803,null));};exports[_0x30a0('0x45')]=function(_0x407f0a,_0x2ad5cb){return db['WhatsappQueue'][_0x30a0('0x45')](_0x407f0a[_0x30a0('0x46')],{})['then'](function(_0x25446b){var _0x26948a=_0x407f0a[_0x30a0('0x47')][_0x30a0('0x48')]({'plain':!![]});if(!_0x26948a)throw new Error(_0x30a0('0x49'));if(_0x26948a[_0x30a0('0x4a')]===_0x30a0('0x47')){var _0xc1ff88=_0x25446b[_0x30a0('0x48')]({'plain':!![]});var _0xd52345='WhatsappQueues';return db['UserProfileSection'][_0x30a0('0x4b')]({'where':{'name':_0xd52345,'userProfileId':_0x26948a['userProfileId']},'raw':!![]})[_0x30a0('0x24')](function(_0x516ed2){if(_0x516ed2&&_0x516ed2[_0x30a0('0x4c')]===0x0){return db['UserProfileResource'][_0x30a0('0x45')]({'name':_0xc1ff88[_0x30a0('0x28')],'resourceId':_0xc1ff88['id'],'type':_0x516ed2[_0x30a0('0x28')],'sectionId':_0x516ed2['id']},{})[_0x30a0('0x24')](function(){return _0x25446b;});}else{return _0x25446b;}})[_0x30a0('0x4d')](function(_0x29bcb6){logger[_0x30a0('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x29bcb6);throw _0x29bcb6;});}return _0x25446b;})['then'](respondWithResult(_0x2ad5cb,0xc9))[_0x30a0('0x4d')](handleError(_0x2ad5cb,null));};exports[_0x30a0('0x22')]=function(_0x1ecbe1,_0x131208){if(_0x1ecbe1[_0x30a0('0x46')]['id']){delete _0x1ecbe1[_0x30a0('0x46')]['id'];}return db['WhatsappQueue'][_0x30a0('0x4b')]({'where':{'id':_0x1ecbe1[_0x30a0('0x42')]['id']}})[_0x30a0('0x24')](handleEntityNotFound(_0x131208,null))[_0x30a0('0x24')](saveUpdates(_0x1ecbe1[_0x30a0('0x46')],null))[_0x30a0('0x24')](respondWithResult(_0x131208,null))[_0x30a0('0x4d')](handleError(_0x131208,null));};exports[_0x30a0('0x23')]=function(_0x19416e,_0x1506b3){return db['WhatsappQueue'][_0x30a0('0x4b')]({'where':{'id':_0x19416e[_0x30a0('0x42')]['id']}})[_0x30a0('0x24')](handleEntityNotFound(_0x1506b3,null))[_0x30a0('0x24')](removeEntity(_0x1506b3,null))['catch'](handleError(_0x1506b3,null));};exports[_0x30a0('0x4e')]=function(_0xfee38a,_0x5062ca){return db[_0x30a0('0x2b')][_0x30a0('0x4e')]()[_0x30a0('0x24')](respondWithResult(_0x5062ca,null))[_0x30a0('0x4d')](handleError(_0x5062ca,null));};exports[_0x30a0('0x4f')]=function(_0x2f578a,_0x2a5d20,_0x421783){var _0x56fae0={'raw':!![],'where':{}},_0x54b01a={},_0x112dc3;return db[_0x30a0('0x2b')][_0x30a0('0x50')]({'where':{'id':_0x2f578a[_0x30a0('0x42')]['id']}})[_0x30a0('0x24')](handleEntityNotFound(_0x2a5d20,null))[_0x30a0('0x24')](function(_0xc61a4){if(_0xc61a4){_0x112dc3=_0xc61a4['get']({'plain':!![]});_0x54b01a['model']=_['keys'](db['UserWhatsappQueue'][_0x30a0('0x43')]);_0x54b01a[_0x30a0('0x30')]=_['keys'](_0x2f578a[_0x30a0('0x30')]);_0x54b01a['filters']=_[_0x30a0('0x33')](_0x54b01a[_0x30a0('0x2f')],_0x54b01a[_0x30a0('0x30')]);_0x56fae0['attributes']=_[_0x30a0('0x33')](_0x54b01a[_0x30a0('0x2f')],qs[_0x30a0('0x35')](_0x2f578a[_0x30a0('0x30')][_0x30a0('0x35')]));_0x56fae0[_0x30a0('0x34')]=_0x56fae0['attributes'][_0x30a0('0x36')]?_0x56fae0[_0x30a0('0x34')]:_0x54b01a[_0x30a0('0x2f')];if(!_0x2f578a[_0x30a0('0x30')][_0x30a0('0x37')](_0x30a0('0x38'))){_0x56fae0['limit']=qs[_0x30a0('0x1b')](_0x2f578a['query']['limit']);_0x56fae0[_0x30a0('0x1c')]=qs[_0x30a0('0x1c')](_0x2f578a[_0x30a0('0x30')]['offset']);}_0x56fae0[_0x30a0('0x39')]=qs[_0x30a0('0x3a')](_0x2f578a[_0x30a0('0x30')][_0x30a0('0x3a')]);_0x56fae0[_0x30a0('0x3b')]=qs['filters'](_[_0x30a0('0x3c')](_0x2f578a['query'],_0x54b01a[_0x30a0('0x32')]));_0x56fae0['where']['WhatsappQueueId']=_0xc61a4['id'];if(_0x2f578a[_0x30a0('0x30')]['filter']){_0x56fae0['where']=_[_0x30a0('0x3e')](_0x56fae0[_0x30a0('0x3b')],{'$or':_['map'](_0x56fae0['attributes'],function(_0x49338b){var _0x394883={};_0x394883[_0x49338b]={'$like':'%'+_0x2f578a[_0x30a0('0x30')][_0x30a0('0x51')]+'%'};return _0x394883;})});}_0x56fae0=_[_0x30a0('0x3e')]({},_0x56fae0,_0x2f578a[_0x30a0('0x44')]);return db[_0x30a0('0x52')][_0x30a0('0x53')](_0x56fae0);}})[_0x30a0('0x24')](function(_0x46b435){if(_0x46b435){return db[_0x30a0('0x54')][_0x30a0('0x55')]({'where':{'id':_['map'](_0x46b435,_0x30a0('0x56')),'role':_0x30a0('0x57')},'attributes':['id',_0x30a0('0x28'),_0x30a0('0x58'),_0x30a0('0x59'),_0x30a0('0x5a')]});}})[_0x30a0('0x24')](function(_0x5da4dd){if(_0x5da4dd){return{'count':_0x5da4dd[_0x30a0('0x1d')],'rows':_['map'](_0x5da4dd[_0x30a0('0x5b')],function(_0x5bf0ce){return{'membername':_0x5bf0ce[_0x30a0('0x28')],'UserId':_0x5bf0ce['id'],'queue_name':_0x112dc3[_0x30a0('0x28')],'WhatsappQueueId':_0x112dc3['id'],'interface':util[_0x30a0('0x5c')](_0x30a0('0x5d'),_0x30a0('0x5e'),_0x5bf0ce['name']),'penalty':0x0,'paused':_0x5bf0ce['whatsappPause'],'createdAt':_0x5bf0ce['createdAt'],'updatedAt':_0x5bf0ce[_0x30a0('0x59')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x30a0('0x24')](respondWithFilteredResult(_0x2a5d20,_0x56fae0))['catch'](handleError(_0x2a5d20,null));};exports[_0x30a0('0x5f')]=function(_0x200baf,_0x2496e0,_0x160456){var _0x1a88fd={};var _0x3a7c87={};var _0x52486d;var _0x322331;return db[_0x30a0('0x2b')][_0x30a0('0x50')]({'where':{'id':_0x200baf[_0x30a0('0x42')]['id']}})[_0x30a0('0x24')](handleEntityNotFound(_0x2496e0,null))[_0x30a0('0x24')](function(_0x5ce772){if(_0x5ce772){_0x52486d=_0x5ce772;_0x3a7c87['model']=_[_0x30a0('0x31')](db[_0x30a0('0x60')][_0x30a0('0x43')]);_0x3a7c87['query']=_['keys'](_0x200baf['query']);_0x3a7c87[_0x30a0('0x32')]=_[_0x30a0('0x33')](_0x3a7c87[_0x30a0('0x2f')],_0x3a7c87[_0x30a0('0x30')]);_0x1a88fd['attributes']=_[_0x30a0('0x33')](_0x3a7c87[_0x30a0('0x2f')],qs['fields'](_0x200baf[_0x30a0('0x30')][_0x30a0('0x35')]));_0x1a88fd[_0x30a0('0x34')]=_0x1a88fd[_0x30a0('0x34')]['length']?_0x1a88fd[_0x30a0('0x34')]:_0x3a7c87[_0x30a0('0x2f')];_0x1a88fd[_0x30a0('0x39')]=qs['sort'](_0x200baf['query'][_0x30a0('0x3a')]);_0x1a88fd[_0x30a0('0x3b')]=qs['filters'](_[_0x30a0('0x3c')](_0x200baf[_0x30a0('0x30')],_0x3a7c87[_0x30a0('0x32')]));if(_0x200baf[_0x30a0('0x30')][_0x30a0('0x51')]){_0x1a88fd[_0x30a0('0x3b')]=_[_0x30a0('0x3e')](_0x1a88fd[_0x30a0('0x3b')],{'$or':_[_0x30a0('0x2a')](_0x1a88fd['attributes'],function(_0x2cd762){var _0x1e2037={};_0x1e2037[_0x2cd762]={'$like':'%'+_0x200baf[_0x30a0('0x30')][_0x30a0('0x51')]+'%'};return _0x1e2037;})});}_0x1a88fd=_[_0x30a0('0x3e')]({},_0x1a88fd,_0x200baf['options']);return _0x52486d[_0x30a0('0x5f')](_0x1a88fd);}})[_0x30a0('0x24')](function(_0x3c7be9){if(_0x3c7be9){_0x322331=_0x3c7be9[_0x30a0('0x36')];if(!_0x200baf[_0x30a0('0x30')]['hasOwnProperty']('nolimit')){_0x1a88fd[_0x30a0('0x1b')]=qs[_0x30a0('0x1b')](_0x200baf[_0x30a0('0x30')]['limit']);_0x1a88fd[_0x30a0('0x1c')]=qs[_0x30a0('0x1c')](_0x200baf[_0x30a0('0x30')][_0x30a0('0x1c')]);}return _0x52486d[_0x30a0('0x5f')](_0x1a88fd);}})[_0x30a0('0x24')](function(_0x58153d){if(_0x58153d){return _0x58153d?{'count':_0x322331,'rows':_0x58153d}:null;}})['then'](respondWithResult(_0x2496e0,null))[_0x30a0('0x4d')](handleError(_0x2496e0,null));};exports['addTeams']=function(_0x5e67d5,_0x4c2f60,_0x1aa21b){var _0x45482b=_0x5e67d5[_0x30a0('0x46')][_0x30a0('0x61')];return db[_0x30a0('0x60')][_0x30a0('0x53')]({'where':{'id':_0x45482b},'attributes':['id'],'include':[{'model':db[_0x30a0('0x54')],'as':_0x30a0('0x62'),'attributes':['id','name','online','voicePause',_0x30a0('0x63')],'raw':!![]}]})[_0x30a0('0x24')](function(_0x4bd55f){if(_0x4bd55f){var _0x51d346=_['flatMap'](_0x4bd55f,function(_0x3670e4){var _0x21a9e3=_0x3670e4[_0x30a0('0x48')]({'plain':!![]});return _0x21a9e3[_0x30a0('0x62')];});return db[_0x30a0('0x2b')][_0x30a0('0x4b')]({'where':{'id':_0x5e67d5['params']['id']}})[_0x30a0('0x24')](function(_0x4e2965){return db[_0x30a0('0x64')]['transaction'](function(_0x2de686){return _0x4e2965[_0x30a0('0x65')](_0x45482b,{'transaction':_0x2de686})[_0x30a0('0x24')](function(){return BPromise[_0x30a0('0x66')](_0x51d346,function(_0x56dcd4){return db[_0x30a0('0x52')][_0x30a0('0x67')]({'where':{'UserId':_0x56dcd4['id'],'WhatsappQueueId':_0x5e67d5['params']['id']},'transaction':_0x2de686});});})['then'](function(){_0x51d346[_0x30a0('0x68')](function(_0x4ca75f){socket[_0x30a0('0x69')]('userWhatsappQueue:save',{'UserId':_0x4ca75f['id'],'WhatsappQueueId':_0x4e2965['id']});});});});});}})[_0x30a0('0x24')](respondWithStatusCode(_0x4c2f60,null))[_0x30a0('0x4d')](handleError(_0x4c2f60,null));};exports['removeTeams']=function(_0x1dd262,_0x37fd95,_0xa9291f){return db['Team'][_0x30a0('0x53')]({'where':{'id':_0x1dd262[_0x30a0('0x30')]['ids']},'attributes':['id'],'include':[{'model':db[_0x30a0('0x54')],'as':_0x30a0('0x62'),'attributes':['id'],'raw':!![]}]})[_0x30a0('0x24')](handleEntityNotFound(_0x37fd95,null))[_0x30a0('0x24')](function(_0x1395f9){var _0x3672e0=_[_0x30a0('0x2a')](_0x1395f9,'id');var _0x29ecf5=[];var _0x6e0573=[];var _0x1bdac5=squel[_0x30a0('0x6a')]();_0x1bdac5[_0x30a0('0x6b')](_0x30a0('0x6c'))[_0x30a0('0x6d')](_0x30a0('0x6e'),'tq')[_0x30a0('0x6f')](_0x30a0('0x70'),'ut',_0x30a0('0x71'))[_0x30a0('0x3b')](_0x30a0('0x72'),_0x1dd262[_0x30a0('0x42')]['id']);for(var _0x56942c=0x0;_0x56942c<_0x1395f9[_0x30a0('0x36')];_0x56942c+=0x1){let _0x43f82f=_0x1395f9[_0x56942c];for(var _0x18f952=0x0;_0x18f952<_0x43f82f[_0x30a0('0x62')]['length'];_0x18f952+=0x1){let _0xd7c898=_0x43f82f[_0x30a0('0x62')][_0x18f952];var _0x3d9998=_0x1bdac5[_0x30a0('0x73')]();_0x3d9998['where']('ut.UserId\x20=\x20?',_0xd7c898['id']);_0x6e0573[_0x30a0('0x74')](db[_0x30a0('0x64')][_0x30a0('0x30')](_0x3d9998[_0x30a0('0x75')](),{'type':db[_0x30a0('0x64')]['QueryTypes']['SELECT']})[_0x30a0('0x24')](function(_0x548dc0){if(_0x548dc0[_0x30a0('0x36')]===0x1){return _0xd7c898['id'];}else{var _0x20ebbe=_['every'](_[_0x30a0('0x2a')](_0x548dc0,_0x30a0('0x76')),function(_0x2114e0){return _['includes'](_0x3672e0,_0x2114e0);});if(_0x20ebbe){return _0xd7c898['id'];}}}));}}return BPromise[_0x30a0('0x77')](_0x6e0573)[_0x30a0('0x24')](function(_0x348c45){_0x29ecf5=_(_0x29ecf5)[_0x30a0('0x78')](_0x348c45)[_0x30a0('0x79')]()[_0x30a0('0x7a')]();return db[_0x30a0('0x2b')][_0x30a0('0x4b')]({'where':{'id':_0x1dd262[_0x30a0('0x42')]['id']}})[_0x30a0('0x24')](function(_0x3d56ee){return db[_0x30a0('0x64')]['transaction'](function(_0x4fa320){return _0x3d56ee[_0x30a0('0x7b')](_0x1dd262[_0x30a0('0x30')][_0x30a0('0x61')],{'transaction':_0x4fa320})[_0x30a0('0x24')](function(){if(!_[_0x30a0('0x7c')](_0x29ecf5)){return _0x3d56ee[_0x30a0('0x7d')](_0x29ecf5,{'transaction':_0x4fa320});}})['then'](function(){_0x29ecf5[_0x30a0('0x68')](function(_0x37db77){socket[_0x30a0('0x69')]('userWhatsappQueue:remove',{'UserId':_0x37db77,'WhatsappQueueId':_0x3d56ee['id']});});});});});});})[_0x30a0('0x24')](respondWithStatusCode(_0x37fd95,null))['catch'](handleError(_0x37fd95,null));};exports['addAgents']=function(_0x2fa3d4,_0x47b552,_0x4c5022){return db[_0x30a0('0x2b')]['find']({'where':{'id':_0x2fa3d4[_0x30a0('0x42')]['id']}})[_0x30a0('0x24')](handleEntityNotFound(_0x47b552,null))[_0x30a0('0x24')](function(_0x4e026c){if(_0x4e026c){return _0x4e026c['addAgents'](_0x2fa3d4[_0x30a0('0x46')]['ids'],_[_0x30a0('0x7e')](_0x2fa3d4[_0x30a0('0x46')],['ids','id'])||{})['spread'](function(_0x58788d){for(var _0x3f2f7f=0x0;_0x3f2f7f<_0x2fa3d4[_0x30a0('0x46')][_0x30a0('0x61')][_0x30a0('0x36')];_0x3f2f7f+=0x1){socket[_0x30a0('0x69')](_0x30a0('0x7f'),{'UserId':Number(_0x2fa3d4[_0x30a0('0x46')]['ids'][_0x3f2f7f]),'WhatsappQueueId':Number(_0x2fa3d4['params']['id'])});}return _0x58788d;});}})[_0x30a0('0x24')](respondWithResult(_0x47b552,null))[_0x30a0('0x4d')](handleError(_0x47b552,null));};exports[_0x30a0('0x7d')]=function(_0x36698b,_0x1ca05a,_0x4dd908){return db[_0x30a0('0x2b')]['find']({'where':{'id':_0x36698b[_0x30a0('0x42')]['id']}})[_0x30a0('0x24')](handleEntityNotFound(_0x1ca05a,null))[_0x30a0('0x24')](function(_0x54d69a){if(_0x54d69a){return _0x54d69a[_0x30a0('0x7d')](_0x36698b['query'][_0x30a0('0x61')])[_0x30a0('0x24')](function(){if(_[_0x30a0('0x80')](_0x36698b[_0x30a0('0x30')][_0x30a0('0x61')])){for(var _0x78ec6c=0x0;_0x78ec6c<_0x36698b[_0x30a0('0x30')][_0x30a0('0x61')][_0x30a0('0x36')];_0x78ec6c+=0x1){socket[_0x30a0('0x69')](_0x30a0('0x81'),{'UserId':Number(_0x36698b[_0x30a0('0x30')][_0x30a0('0x61')][_0x78ec6c]),'WhatsappQueueId':Number(_0x36698b[_0x30a0('0x42')]['id'])});}}else{socket[_0x30a0('0x69')](_0x30a0('0x81'),{'UserId':Number(_0x36698b[_0x30a0('0x30')][_0x30a0('0x61')]),'WhatsappQueueId':Number(_0x36698b['params']['id'])});}});}})[_0x30a0('0x24')](respondWithStatusCode(_0x1ca05a,null))[_0x30a0('0x4d')](handleError(_0x1ca05a,null));};exports[_0x30a0('0x82')]=function(_0x361037,_0x2de1aa,_0x29d602){var _0x1e0c09={};var _0x2c6bc0={};var _0x2d48f3;var _0x2cdb63;return db['WhatsappQueue']['findOne']({'where':{'id':_0x361037['params']['id']}})[_0x30a0('0x24')](handleEntityNotFound(_0x2de1aa,null))[_0x30a0('0x24')](function(_0x160c74){if(_0x160c74){_0x2d48f3=_0x160c74;_0x2c6bc0[_0x30a0('0x2f')]=_[_0x30a0('0x31')](db[_0x30a0('0x54')][_0x30a0('0x43')]);_0x2c6bc0[_0x30a0('0x30')]=_[_0x30a0('0x31')](_0x361037[_0x30a0('0x30')]);_0x2c6bc0[_0x30a0('0x32')]=_[_0x30a0('0x33')](_0x2c6bc0[_0x30a0('0x2f')],_0x2c6bc0[_0x30a0('0x30')]);_0x1e0c09[_0x30a0('0x34')]=_[_0x30a0('0x33')](_0x2c6bc0[_0x30a0('0x2f')],qs['fields'](_0x361037[_0x30a0('0x30')][_0x30a0('0x35')]));_0x1e0c09[_0x30a0('0x34')]=_0x1e0c09[_0x30a0('0x34')][_0x30a0('0x36')]?_0x1e0c09[_0x30a0('0x34')]:_0x2c6bc0[_0x30a0('0x2f')];_0x1e0c09[_0x30a0('0x39')]=qs[_0x30a0('0x3a')](_0x361037['query']['sort']);_0x1e0c09[_0x30a0('0x3b')]=qs[_0x30a0('0x32')](_[_0x30a0('0x3c')](_0x361037[_0x30a0('0x30')],_0x2c6bc0[_0x30a0('0x32')]));if(_0x361037[_0x30a0('0x30')][_0x30a0('0x51')]){_0x1e0c09[_0x30a0('0x3b')]=_[_0x30a0('0x3e')](_0x1e0c09['where'],{'$or':_[_0x30a0('0x2a')](_0x1e0c09['attributes'],function(_0x52cd80){var _0x3d612d={};_0x3d612d[_0x52cd80]={'$like':'%'+_0x361037['query'][_0x30a0('0x51')]+'%'};return _0x3d612d;})});}_0x1e0c09=_[_0x30a0('0x3e')]({},_0x1e0c09,_0x361037[_0x30a0('0x44')]);return _0x2d48f3[_0x30a0('0x82')](_0x1e0c09);}})[_0x30a0('0x24')](function(_0x15e003){if(_0x15e003){_0x2cdb63=_0x15e003[_0x30a0('0x36')];if(!_0x361037[_0x30a0('0x30')][_0x30a0('0x37')](_0x30a0('0x38'))){_0x1e0c09['limit']=qs[_0x30a0('0x1b')](_0x361037[_0x30a0('0x30')]['limit']);_0x1e0c09[_0x30a0('0x1c')]=qs[_0x30a0('0x1c')](_0x361037[_0x30a0('0x30')]['offset']);}return _0x2d48f3[_0x30a0('0x82')](_0x1e0c09);}})['then'](function(_0x132d6b){if(_0x132d6b){return _0x132d6b?{'count':_0x2cdb63,'rows':_0x132d6b}:null;}})['then'](respondWithResult(_0x2de1aa,null))[_0x30a0('0x4d')](handleError(_0x2de1aa,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index e9f3991..b235614 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 _0x0edf=['save','update','remove','emit','hasOwnProperty','hook','events','WhatsappQueue','setMaxListeners'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0edf,0x126));var _0xf0ed=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x0edf[_0x543084];return _0x306a57;};'use strict';var EventEmitter=require(_0xf0ed('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0xf0ed('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xf0ed('0x2')](0x0);var events={'afterCreate':_0xf0ed('0x3'),'afterUpdate':_0xf0ed('0x4'),'afterDestroy':_0xf0ed('0x5')};function emitEvent(_0x16cafe){return function(_0x1cf143,_0x3215af,_0x569d3b){WhatsappQueueEvents[_0xf0ed('0x6')](_0x16cafe+':'+_0x1cf143['id'],_0x1cf143);WhatsappQueueEvents[_0xf0ed('0x6')](_0x16cafe,_0x1cf143);_0x569d3b(null);};}for(var e in events){if(events[_0xf0ed('0x7')](e)){var event=events[e];WhatsappQueue[_0xf0ed('0x8')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0x2449=['hasOwnProperty','hook','setMaxListeners','save','remove','emit'];(function(_0x498c48,_0x23fcc5){var _0x24c53a=function(_0x36df20){while(--_0x36df20){_0x498c48['push'](_0x498c48['shift']());}};_0x24c53a(++_0x23fcc5);}(_0x2449,0x188));var _0x9244=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2449[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require('../../mysqldb')['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x9244('0x0')](0x0);var events={'afterCreate':_0x9244('0x1'),'afterUpdate':'update','afterDestroy':_0x9244('0x2')};function emitEvent(_0x393fa7){return function(_0x5af4b8,_0x1b3378,_0x5580b2){WhatsappQueueEvents[_0x9244('0x3')](_0x393fa7+':'+_0x5af4b8['id'],_0x5af4b8);WhatsappQueueEvents[_0x9244('0x3')](_0x393fa7,_0x5af4b8);_0x5580b2(null);};}for(var e in events){if(events[_0x9244('0x4')](e)){var event=events[e];WhatsappQueue[_0x9244('0x5')](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 67dc1f0..b386bd4 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 _0x59f3=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash'];(function(_0x4327fe,_0x4f8040){var _0x138651=function(_0x418acc){while(--_0x418acc){_0x4327fe['push'](_0x4327fe['shift']());}};_0x138651(++_0x4f8040);}(_0x59f3,0xd1));var _0x359f=function(_0x383356,_0x33d2f5){_0x383356=_0x383356-0x0;var _0x32ee5a=_0x59f3[_0x383356];return _0x32ee5a;};'use strict';var _=require(_0x359f('0x0'));var util=require('util');var logger=require(_0x359f('0x1'))(_0x359f('0x2'));var moment=require(_0x359f('0x3'));var BPromise=require(_0x359f('0x4'));var rp=require(_0x359f('0x5'));var fs=require('fs');var path=require(_0x359f('0x6'));var rimraf=require(_0x359f('0x7'));var config=require(_0x359f('0x8'));var attributes=require(_0x359f('0x9'));module[_0x359f('0xa')]=function(_0x2a1cd5,_0x52ab32){return _0x2a1cd5[_0x359f('0xb')](_0x359f('0xc'),attributes,{'tableName':_0x359f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc732=['rimraf','../../config/environment','./whatsappQueue.attributes','exports','whatsapp_queues','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x5d9e39,_0x27003b){var _0x1f4229=function(_0x2d7fde){while(--_0x2d7fde){_0x5d9e39['push'](_0x5d9e39['shift']());}};_0x1f4229(++_0x27003b);}(_0xc732,0x89));var _0x2c73=function(_0x5f05b7,_0xe1ba0f){_0x5f05b7=_0x5f05b7-0x0;var _0x3deac2=_0xc732[_0x5f05b7];return _0x3deac2;};'use strict';var _=require(_0x2c73('0x0'));var util=require('util');var logger=require(_0x2c73('0x1'))(_0x2c73('0x2'));var moment=require(_0x2c73('0x3'));var BPromise=require(_0x2c73('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2c73('0x5'));var rimraf=require(_0x2c73('0x6'));var config=require(_0x2c73('0x7'));var attributes=require(_0x2c73('0x8'));module[_0x2c73('0x9')]=function(_0x2e3e83,_0x4eaa13){return _0x2e3e83['define']('WhatsappQueue',attributes,{'tableName':_0x2c73('0xa'),'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 11c57b1..f54fe8d 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 _0x4244=['../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetWhatsappQueue','find','ShowWhatsappQueue','debug','lodash','util','moment','randomstring','ioredis'];(function(_0xea35d1,_0x302471){var _0x1d7a7c=function(_0x1bc101){while(--_0x1bc101){_0xea35d1['push'](_0xea35d1['shift']());}};_0x1d7a7c(++_0x302471);}(_0x4244,0x76));var _0x4424=function(_0x34568d,_0x95f031){_0x34568d=_0x34568d-0x0;var _0x5b5e11=_0x4244[_0x34568d];return _0x5b5e11;};'use strict';var _=require(_0x4424('0x0'));var util=require(_0x4424('0x1'));var moment=require(_0x4424('0x2'));var BPromise=require('bluebird');var rs=require(_0x4424('0x3'));var fs=require('fs');var Redis=require(_0x4424('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4424('0x5'))(_0x4424('0x6'));var config=require('../../config/environment');var jayson=require(_0x4424('0x7'));var client=jayson[_0x4424('0x8')][_0x4424('0x9')]({'port':0x232a});config[_0x4424('0xa')]=_[_0x4424('0xb')](config[_0x4424('0xa')],{'host':_0x4424('0xc'),'port':0x18eb});var socket=require(_0x4424('0xd'))(new Redis(config[_0x4424('0xa')]));require('./whatsappQueue.socket')[_0x4424('0xe')](socket);function respondWithRpcPromise(_0x56b8f2,_0x3ec53f,_0x1decd2){return new BPromise(function(_0x5b5972,_0x315d21){return client[_0x4424('0xf')](_0x56b8f2,_0x1decd2)[_0x4424('0x10')](function(_0x40c16a){logger[_0x4424('0x11')](_0x4424('0x12'),_0x3ec53f,_0x4424('0x13'));logger['debug'](_0x4424('0x14'),_0x3ec53f,_0x4424('0x13'),JSON[_0x4424('0x15')](_0x40c16a));if(_0x40c16a[_0x4424('0x16')]){if(_0x40c16a[_0x4424('0x16')][_0x4424('0x17')]===0x1f4){logger[_0x4424('0x16')](_0x4424('0x12'),_0x3ec53f,_0x40c16a['error'][_0x4424('0x18')]);return _0x315d21(_0x40c16a[_0x4424('0x16')][_0x4424('0x18')]);}logger[_0x4424('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0x3ec53f,_0x40c16a[_0x4424('0x16')]['message']);return _0x5b5972(_0x40c16a['error'][_0x4424('0x18')]);}else{logger[_0x4424('0x11')](_0x4424('0x12'),_0x3ec53f,'request\x20sent');_0x5b5972(_0x40c16a[_0x4424('0x19')][_0x4424('0x18')]);}})[_0x4424('0x1a')](function(_0x16c56f){logger[_0x4424('0x16')](_0x4424('0x12'),_0x3ec53f,_0x16c56f);_0x315d21(_0x16c56f);});});}exports['GetWhatsappQueue']=function(_0x136ec7){var _0x6ef923=this;return new Promise(function(_0x462219,_0x2acb00){return db[_0x4424('0x1b')][_0x4424('0x1c')]({'raw':_0x136ec7[_0x4424('0x1d')]?_0x136ec7['options'][_0x4424('0x1e')]===undefined?!![]:![]:!![],'where':_0x136ec7[_0x4424('0x1d')]?_0x136ec7[_0x4424('0x1d')][_0x4424('0x1f')]||null:null,'attributes':_0x136ec7[_0x4424('0x1d')]?_0x136ec7['options'][_0x4424('0x20')]||null:null,'limit':_0x136ec7['options']?_0x136ec7[_0x4424('0x1d')][_0x4424('0x21')]||null:null,'include':_0x136ec7['options']?_0x136ec7[_0x4424('0x1d')][_0x4424('0x22')]?_[_0x4424('0x23')](_0x136ec7[_0x4424('0x1d')][_0x4424('0x22')],function(_0x4af798){return{'model':db[_0x4af798['model']],'as':_0x4af798['as'],'attributes':_0x4af798[_0x4424('0x20')],'include':_0x4af798[_0x4424('0x22')]?_['map'](_0x4af798[_0x4424('0x22')],function(_0x5a024c){return{'model':db[_0x5a024c[_0x4424('0x24')]],'as':_0x5a024c['as'],'attributes':_0x5a024c[_0x4424('0x20')],'include':_0x5a024c[_0x4424('0x22')]?_['map'](_0x5a024c['include'],function(_0x3e3394){return{'model':db[_0x3e3394[_0x4424('0x24')]],'as':_0x3e3394['as'],'attributes':_0x3e3394[_0x4424('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4424('0x10')](function(_0x31597a){logger[_0x4424('0x11')]('GetWhatsappQueue',_0x136ec7);logger['debug'](_0x4424('0x25'),_0x136ec7,JSON['stringify'](_0x31597a));_0x462219(_0x31597a);})[_0x4424('0x1a')](function(_0x3cd986){logger[_0x4424('0x16')](_0x4424('0x25'),_0x3cd986[_0x4424('0x18')],_0x136ec7);_0x2acb00(_0x6ef923[_0x4424('0x16')](0x1f4,_0x3cd986['message']));});});};exports['ShowWhatsappQueue']=function(_0x348c90){var _0x42a483=this;return new Promise(function(_0x147b10,_0x3461d7){return db['WhatsappQueue'][_0x4424('0x26')]({'raw':_0x348c90[_0x4424('0x1d')]?_0x348c90[_0x4424('0x1d')][_0x4424('0x1e')]===undefined?!![]:![]:!![],'where':_0x348c90[_0x4424('0x1d')]?_0x348c90['options'][_0x4424('0x1f')]||null:null,'attributes':_0x348c90[_0x4424('0x1d')]?_0x348c90[_0x4424('0x1d')][_0x4424('0x20')]||null:null,'include':_0x348c90[_0x4424('0x1d')]?_0x348c90['options']['include']?_['map'](_0x348c90[_0x4424('0x1d')][_0x4424('0x22')],function(_0x672f3d){return{'model':db[_0x672f3d[_0x4424('0x24')]],'as':_0x672f3d['as'],'attributes':_0x672f3d[_0x4424('0x20')],'include':_0x672f3d[_0x4424('0x22')]?_['map'](_0x672f3d[_0x4424('0x22')],function(_0x3c7623){return{'model':db[_0x3c7623[_0x4424('0x24')]],'as':_0x3c7623['as'],'attributes':_0x3c7623['attributes'],'include':_0x3c7623[_0x4424('0x22')]?_['map'](_0x3c7623[_0x4424('0x22')],function(_0x4159ca){return{'model':db[_0x4159ca[_0x4424('0x24')]],'as':_0x4159ca['as'],'attributes':_0x4159ca[_0x4424('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4424('0x10')](function(_0x32141b){logger['info'](_0x4424('0x27'),_0x348c90);logger[_0x4424('0x28')](_0x4424('0x27'),_0x348c90,JSON[_0x4424('0x15')](_0x32141b));_0x147b10(_0x32141b);})[_0x4424('0x1a')](function(_0x4f77bf){logger['error'](_0x4424('0x27'),_0x4f77bf[_0x4424('0x18')],_0x348c90);_0x3461d7(_0x42a483[_0x4424('0x16')](0x1f4,_0x4f77bf[_0x4424('0x18')]));});});}; \ No newline at end of file +var _0x7eeb=['request','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','findAll','options','raw','where','attributes','map','include','model','then','GetWhatsappQueue','ShowWhatsappQueue','WhatsappQueue','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register'];(function(_0x452756,_0x22dfbf){var _0x51a032=function(_0x318182){while(--_0x318182){_0x452756['push'](_0x452756['shift']());}};_0x51a032(++_0x22dfbf);}(_0x7eeb,0x67));var _0xb7ee=function(_0x41c38e,_0x3eb483){_0x41c38e=_0x41c38e-0x0;var _0x5ae0a4=_0x7eeb[_0x41c38e];return _0x5ae0a4;};'use strict';var _=require(_0xb7ee('0x0'));var util=require('util');var moment=require(_0xb7ee('0x1'));var BPromise=require(_0xb7ee('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb7ee('0x3'));var db=require(_0xb7ee('0x4'))['db'];var utils=require(_0xb7ee('0x5'));var logger=require(_0xb7ee('0x6'))(_0xb7ee('0x7'));var config=require(_0xb7ee('0x8'));var jayson=require(_0xb7ee('0x9'));var client=jayson[_0xb7ee('0xa')][_0xb7ee('0xb')]({'port':0x232a});config[_0xb7ee('0xc')]=_['defaults'](config[_0xb7ee('0xc')],{'host':_0xb7ee('0xd'),'port':0x18eb});var socket=require(_0xb7ee('0xe'))(new Redis(config[_0xb7ee('0xc')]));require(_0xb7ee('0xf'))[_0xb7ee('0x10')](socket);function respondWithRpcPromise(_0x4b4047,_0x57cfe3,_0x34b99f){return new BPromise(function(_0x4a4777,_0x4c1ce5){return client[_0xb7ee('0x11')](_0x4b4047,_0x34b99f)['then'](function(_0x11d9cb){logger['info'](_0xb7ee('0x12'),_0x57cfe3,_0xb7ee('0x13'));logger[_0xb7ee('0x14')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x57cfe3,_0xb7ee('0x13'),JSON[_0xb7ee('0x15')](_0x11d9cb));if(_0x11d9cb[_0xb7ee('0x16')]){if(_0x11d9cb[_0xb7ee('0x16')][_0xb7ee('0x17')]===0x1f4){logger[_0xb7ee('0x16')](_0xb7ee('0x12'),_0x57cfe3,_0x11d9cb[_0xb7ee('0x16')][_0xb7ee('0x18')]);return _0x4c1ce5(_0x11d9cb[_0xb7ee('0x16')]['message']);}logger[_0xb7ee('0x16')](_0xb7ee('0x12'),_0x57cfe3,_0x11d9cb[_0xb7ee('0x16')]['message']);return _0x4a4777(_0x11d9cb['error'][_0xb7ee('0x18')]);}else{logger[_0xb7ee('0x19')](_0xb7ee('0x12'),_0x57cfe3,_0xb7ee('0x13'));_0x4a4777(_0x11d9cb[_0xb7ee('0x1a')][_0xb7ee('0x18')]);}})[_0xb7ee('0x1b')](function(_0x582108){logger[_0xb7ee('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0x57cfe3,_0x582108);_0x4c1ce5(_0x582108);});});}exports['GetWhatsappQueue']=function(_0xabaa39){var _0xe0cb29=this;return new Promise(function(_0x3b0bc4,_0x6659c9){return db['WhatsappQueue'][_0xb7ee('0x1c')]({'raw':_0xabaa39['options']?_0xabaa39[_0xb7ee('0x1d')][_0xb7ee('0x1e')]===undefined?!![]:![]:!![],'where':_0xabaa39[_0xb7ee('0x1d')]?_0xabaa39[_0xb7ee('0x1d')][_0xb7ee('0x1f')]||null:null,'attributes':_0xabaa39[_0xb7ee('0x1d')]?_0xabaa39[_0xb7ee('0x1d')][_0xb7ee('0x20')]||null:null,'limit':_0xabaa39[_0xb7ee('0x1d')]?_0xabaa39['options']['limit']||null:null,'include':_0xabaa39[_0xb7ee('0x1d')]?_0xabaa39[_0xb7ee('0x1d')]['include']?_[_0xb7ee('0x21')](_0xabaa39[_0xb7ee('0x1d')][_0xb7ee('0x22')],function(_0x389c36){return{'model':db[_0x389c36[_0xb7ee('0x23')]],'as':_0x389c36['as'],'attributes':_0x389c36['attributes'],'include':_0x389c36[_0xb7ee('0x22')]?_[_0xb7ee('0x21')](_0x389c36['include'],function(_0x51315a){return{'model':db[_0x51315a[_0xb7ee('0x23')]],'as':_0x51315a['as'],'attributes':_0x51315a[_0xb7ee('0x20')],'include':_0x51315a[_0xb7ee('0x22')]?_[_0xb7ee('0x21')](_0x51315a['include'],function(_0x1cf330){return{'model':db[_0x1cf330[_0xb7ee('0x23')]],'as':_0x1cf330['as'],'attributes':_0x1cf330['attributes']};}):[]};}):[]};}):[]:[]})[_0xb7ee('0x24')](function(_0x41026e){logger[_0xb7ee('0x19')](_0xb7ee('0x25'),_0xabaa39);logger['debug'](_0xb7ee('0x25'),_0xabaa39,JSON[_0xb7ee('0x15')](_0x41026e));_0x3b0bc4(_0x41026e);})[_0xb7ee('0x1b')](function(_0x3580ec){logger[_0xb7ee('0x16')]('GetWhatsappQueue',_0x3580ec['message'],_0xabaa39);_0x6659c9(_0xe0cb29['error'](0x1f4,_0x3580ec[_0xb7ee('0x18')]));});});};exports[_0xb7ee('0x26')]=function(_0x249237){var _0x1b1fa6=this;return new Promise(function(_0x515aae,_0x10fbfe){return db[_0xb7ee('0x27')]['find']({'raw':_0x249237[_0xb7ee('0x1d')]?_0x249237[_0xb7ee('0x1d')][_0xb7ee('0x1e')]===undefined?!![]:![]:!![],'where':_0x249237[_0xb7ee('0x1d')]?_0x249237['options']['where']||null:null,'attributes':_0x249237[_0xb7ee('0x1d')]?_0x249237[_0xb7ee('0x1d')][_0xb7ee('0x20')]||null:null,'include':_0x249237['options']?_0x249237['options'][_0xb7ee('0x22')]?_[_0xb7ee('0x21')](_0x249237[_0xb7ee('0x1d')]['include'],function(_0x1dd92d){return{'model':db[_0x1dd92d['model']],'as':_0x1dd92d['as'],'attributes':_0x1dd92d[_0xb7ee('0x20')],'include':_0x1dd92d[_0xb7ee('0x22')]?_[_0xb7ee('0x21')](_0x1dd92d['include'],function(_0x126d17){return{'model':db[_0x126d17['model']],'as':_0x126d17['as'],'attributes':_0x126d17['attributes'],'include':_0x126d17['include']?_[_0xb7ee('0x21')](_0x126d17[_0xb7ee('0x22')],function(_0x4a142c){return{'model':db[_0x4a142c['model']],'as':_0x4a142c['as'],'attributes':_0x4a142c[_0xb7ee('0x20')]};}):[]};}):[]};}):[]:[]})[_0xb7ee('0x24')](function(_0x2bb4b3){logger['info']('ShowWhatsappQueue',_0x249237);logger[_0xb7ee('0x14')](_0xb7ee('0x26'),_0x249237,JSON[_0xb7ee('0x15')](_0x2bb4b3));_0x515aae(_0x2bb4b3);})[_0xb7ee('0x1b')](function(_0x46fab7){logger[_0xb7ee('0x16')](_0xb7ee('0x26'),_0x46fab7[_0xb7ee('0x18')],_0x249237);_0x10fbfe(_0x1b1fa6[_0xb7ee('0x16')](0x1f4,_0x46fab7[_0xb7ee('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 76b4a4c..b32f76c 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 _0x3160=['removeListener','register','length','whatsappQueue:','./whatsappQueue.events','save','remove'];(function(_0x2c0bfb,_0xcfe2b3){var _0x496beb=function(_0x32458c){while(--_0x32458c){_0x2c0bfb['push'](_0x2c0bfb['shift']());}};_0x496beb(++_0xcfe2b3);}(_0x3160,0x123));var _0x0316=function(_0x5f1857,_0x3500ed){_0x5f1857=_0x5f1857-0x0;var _0xbcf3e9=_0x3160[_0x5f1857];return _0xbcf3e9;};'use strict';var WhatsappQueueEvents=require(_0x0316('0x0'));var events=[_0x0316('0x1'),_0x0316('0x2'),'update'];function createListener(_0x22355d,_0x38b8ca){return function(_0x2f25c4){_0x38b8ca['emit'](_0x22355d,_0x2f25c4);};}function removeListener(_0x8f21ce,_0x4c25fd){return function(){WhatsappQueueEvents[_0x0316('0x3')](_0x8f21ce,_0x4c25fd);};}exports[_0x0316('0x4')]=function(_0x2bed8c){for(var _0x850081=0x0,_0x539320=events[_0x0316('0x5')];_0x850081<_0x539320;_0x850081++){var _0x55bc92=events[_0x850081];var _0xe7dc83=createListener(_0x0316('0x6')+_0x55bc92,_0x2bed8c);WhatsappQueueEvents['on'](_0x55bc92,_0xe7dc83);}}; \ No newline at end of file +var _0x8f27=['update','removeListener','register','length','whatsappQueue:','./whatsappQueue.events','save','remove'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x8f27,0x9d));var _0x78f2=function(_0xc831c6,_0x542b00){_0xc831c6=_0xc831c6-0x0;var _0x5063a7=_0x8f27[_0xc831c6];return _0x5063a7;};'use strict';var WhatsappQueueEvents=require(_0x78f2('0x0'));var events=[_0x78f2('0x1'),_0x78f2('0x2'),_0x78f2('0x3')];function createListener(_0x4306ba,_0x8c1127){return function(_0xc58066){_0x8c1127['emit'](_0x4306ba,_0xc58066);};}function removeListener(_0x452a5b,_0x2792f5){return function(){WhatsappQueueEvents[_0x78f2('0x4')](_0x452a5b,_0x2792f5);};}exports[_0x78f2('0x5')]=function(_0x9b971f){for(var _0x18b681=0x0,_0x473a3c=events[_0x78f2('0x6')];_0x18b681<_0x473a3c;_0x18b681++){var _0x1bce08=events[_0x18b681];var _0x3ec30b=createListener(_0x78f2('0x7')+_0x1bce08,_0x9b971f);WhatsappQueueEvents['on'](_0x1bce08,_0x3ec30b);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 0838fda..6cdcba4 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 _0xe444=['get','isAuthenticated','index','/describe','describe','/:id','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueueReport.controller'];(function(_0x4a489b,_0x42ffb7){var _0x3815fd=function(_0x12ebc6){while(--_0x12ebc6){_0x4a489b['push'](_0x4a489b['shift']());}};_0x3815fd(++_0x42ffb7);}(_0xe444,0x156));var _0x4e44=function(_0x30d20d,_0x3fffcf){_0x30d20d=_0x30d20d-0x0;var _0xc7ac87=_0xe444[_0x30d20d];return _0xc7ac87;};'use strict';var multer=require(_0x4e44('0x0'));var util=require(_0x4e44('0x1'));var path=require(_0x4e44('0x2'));var timeout=require(_0x4e44('0x3'));var express=require(_0x4e44('0x4'));var router=express[_0x4e44('0x5')]();var fs_extra=require(_0x4e44('0x6'));var auth=require(_0x4e44('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x4e44('0x8'));var controller=require(_0x4e44('0x9'));router[_0x4e44('0xa')]('/',auth[_0x4e44('0xb')](),controller[_0x4e44('0xc')]);router[_0x4e44('0xa')](_0x4e44('0xd'),auth[_0x4e44('0xb')](),controller[_0x4e44('0xe')]);router[_0x4e44('0xa')](_0x4e44('0xf'),auth['isAuthenticated'](),controller[_0x4e44('0x10')]);router[_0x4e44('0x11')]('/',auth[_0x4e44('0xb')](),controller[_0x4e44('0x12')]);router['put'](_0x4e44('0xf'),auth[_0x4e44('0xb')](),controller['update']);router[_0x4e44('0x13')](_0x4e44('0xf'),auth['isAuthenticated'](),controller[_0x4e44('0x14')]);module[_0x4e44('0x15')]=router; \ No newline at end of file +var _0x7800=['/:id','show','post','create','update','delete','destroy','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./whatsappQueueReport.controller','isAuthenticated','index','/describe','describe','get'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x7800,0x15e));var _0x0780=function(_0xac3603,_0xc92c8a){_0xac3603=_0xac3603-0x0;var _0x24a714=_0x7800[_0xac3603];return _0x24a714;};'use strict';var multer=require('multer');var util=require(_0x0780('0x0'));var path=require(_0x0780('0x1'));var timeout=require(_0x0780('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0780('0x3'));var interaction=require(_0x0780('0x4'));var config=require('../../config/environment');var controller=require(_0x0780('0x5'));router['get']('/',auth[_0x0780('0x6')](),controller[_0x0780('0x7')]);router['get'](_0x0780('0x8'),auth[_0x0780('0x6')](),controller[_0x0780('0x9')]);router[_0x0780('0xa')](_0x0780('0xb'),auth[_0x0780('0x6')](),controller[_0x0780('0xc')]);router[_0x0780('0xd')]('/',auth[_0x0780('0x6')](),controller[_0x0780('0xe')]);router['put'](_0x0780('0xb'),auth[_0x0780('0x6')](),controller[_0x0780('0xf')]);router[_0x0780('0x10')](_0x0780('0xb'),auth['isAuthenticated'](),controller[_0x0780('0x11')]);module[_0x0780('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 977f6e8..5b9cbe9 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(_0x3e1185,_0x492c86){var _0x50c584=function(_0x3a2c35){while(--_0x3a2c35){_0x3e1185['push'](_0x3e1185['shift']());}};_0x50c584(++_0x492c86);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'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(_0x543b42,_0x21177b){var _0x2910e=function(_0x7b0ea9){while(--_0x7b0ea9){_0x543b42['push'](_0x543b42['shift']());}};_0x2910e(++_0x21177b);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'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 b835f46..27a07df 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 _0x63a5=['filter','merge','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','WhatsappQueueReport','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x3bde46,_0x97f6ce){var _0x572d7f=function(_0x1e7337){while(--_0x1e7337){_0x3bde46['push'](_0x3bde46['shift']());}};_0x572d7f(++_0x97f6ce);}(_0x63a5,0x18e));var _0x563a=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x63a5[_0x465a0c];return _0x1e202e;};'use strict';var emlformat=require(_0x563a('0x0'));var rimraf=require(_0x563a('0x1'));var zipdir=require(_0x563a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x563a('0x3'));var moment=require('moment');var BPromise=require(_0x563a('0x4'));var Mustache=require(_0x563a('0x5'));var util=require(_0x563a('0x6'));var path=require(_0x563a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x563a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x563a('0x9'));var squel=require(_0x563a('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x563a('0xb'));var toCsv=require(_0x563a('0xc'));var querystring=require(_0x563a('0xd'));var Papa=require(_0x563a('0xe'));var Redis=require(_0x563a('0xf'));var authService=require(_0x563a('0x10'));var qs=require(_0x563a('0x11'));var as=require(_0x563a('0x12'));var hardwareService=require(_0x563a('0x13'));var logger=require(_0x563a('0x14'))(_0x563a('0x15'));var utils=require(_0x563a('0x16'));var config=require(_0x563a('0x17'));var licenseUtil=require(_0x563a('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x61d5b2,_0x214f42){_0x214f42=_0x214f42||0xcc;return function(_0x10de2e){if(_0x10de2e){return _0x61d5b2[_0x563a('0x19')](_0x214f42);}return _0x61d5b2[_0x563a('0x1a')](_0x214f42)[_0x563a('0x1b')]();};}function respondWithResult(_0x50396b,_0x2cf052){_0x2cf052=_0x2cf052||0xc8;return function(_0x3045ac){if(_0x3045ac){return _0x50396b[_0x563a('0x1a')](_0x2cf052)[_0x563a('0x1c')](_0x3045ac);}};}function respondWithFilteredResult(_0x5a2980,_0x504cb7){return function(_0x414535){if(_0x414535){var _0x2ad667=typeof _0x504cb7['offset']===_0x563a('0x1d')&&typeof _0x504cb7[_0x563a('0x1e')]===_0x563a('0x1d');var _0x9c2f77=_0x414535['count'];var _0x598693=_0x2ad667?0x0:_0x504cb7[_0x563a('0x1f')];var _0x422aaf=_0x2ad667?_0x414535[_0x563a('0x20')]:_0x504cb7['offset']+_0x504cb7['limit'];var _0x52b99a;if(_0x422aaf>=_0x9c2f77){_0x422aaf=_0x9c2f77;_0x52b99a=0xc8;}else{_0x52b99a=0xce;}_0x5a2980['status'](_0x52b99a);return _0x5a2980[_0x563a('0x21')](_0x563a('0x22'),_0x598693+'-'+_0x422aaf+'/'+_0x9c2f77)[_0x563a('0x1c')](_0x414535);}return null;};}function patchUpdates(_0x43b7a8){return function(_0x562fce){try{jsonpatch['apply'](_0x562fce,_0x43b7a8,!![]);}catch(_0x3930f0){return BPromise[_0x563a('0x23')](_0x3930f0);}return _0x562fce[_0x563a('0x24')]();};}function saveUpdates(_0x2beccb,_0x1bf502){return function(_0x2dc7e2){if(_0x2dc7e2){return _0x2dc7e2[_0x563a('0x25')](_0x2beccb)[_0x563a('0x26')](function(_0x506491){return _0x506491;});}return null;};}function removeEntity(_0xd59ba8,_0x5422f6){return function(_0x44e2c1){if(_0x44e2c1){return _0x44e2c1[_0x563a('0x27')]()[_0x563a('0x26')](function(){_0xd59ba8[_0x563a('0x1a')](0xcc)[_0x563a('0x1b')]();});}};}function handleEntityNotFound(_0x1682ee,_0x3642b3){return function(_0x173990){if(!_0x173990){_0x1682ee['sendStatus'](0x194);}return _0x173990;};}function handleError(_0x146ea0,_0x2b688e){_0x2b688e=_0x2b688e||0x1f4;return function(_0x2311f2){logger[_0x563a('0x28')](_0x2311f2[_0x563a('0x29')]);if(_0x2311f2[_0x563a('0x2a')]){delete _0x2311f2[_0x563a('0x2a')];}_0x146ea0[_0x563a('0x1a')](_0x2b688e)[_0x563a('0x2b')](_0x2311f2);};}exports[_0x563a('0x2c')]=function(_0x1a69d5,_0x24d1a8){var _0x1bdfb0={},_0x7696c2={},_0x579cb5={'count':0x0,'rows':[]};var _0x43379c=_[_0x563a('0x2d')](db[_0x563a('0x2e')]['rawAttributes'],function(_0x1e8d43){return{'name':_0x1e8d43[_0x563a('0x2f')],'type':_0x1e8d43[_0x563a('0x30')][_0x563a('0x31')]};});_0x7696c2[_0x563a('0x32')]=_[_0x563a('0x2d')](_0x43379c,_0x563a('0x2a'));_0x7696c2['query']=_[_0x563a('0x33')](_0x1a69d5[_0x563a('0x34')]);_0x7696c2[_0x563a('0x35')]=_[_0x563a('0x36')](_0x7696c2[_0x563a('0x32')],_0x7696c2['query']);_0x1bdfb0['attributes']=_['intersection'](_0x7696c2['model'],qs[_0x563a('0x37')](_0x1a69d5[_0x563a('0x34')][_0x563a('0x37')]));_0x1bdfb0[_0x563a('0x38')]=_0x1bdfb0[_0x563a('0x38')][_0x563a('0x39')]?_0x1bdfb0['attributes']:_0x7696c2['model'];if(!_0x1a69d5[_0x563a('0x34')][_0x563a('0x3a')](_0x563a('0x3b'))){_0x1bdfb0[_0x563a('0x1e')]=qs[_0x563a('0x1e')](_0x1a69d5[_0x563a('0x34')][_0x563a('0x1e')]);_0x1bdfb0[_0x563a('0x1f')]=qs[_0x563a('0x1f')](_0x1a69d5[_0x563a('0x34')][_0x563a('0x1f')]);}_0x1bdfb0[_0x563a('0x3c')]=qs[_0x563a('0x3d')](_0x1a69d5[_0x563a('0x34')][_0x563a('0x3d')]);_0x1bdfb0[_0x563a('0x3e')]=qs['filters'](_[_0x563a('0x3f')](_0x1a69d5[_0x563a('0x34')],_0x7696c2[_0x563a('0x35')]),_0x43379c);if(_0x1a69d5['query'][_0x563a('0x40')]){_0x1bdfb0['where']=_[_0x563a('0x41')](_0x1bdfb0[_0x563a('0x3e')],{'$or':_['map'](_0x43379c,function(_0x52e4a2){if(_0x52e4a2[_0x563a('0x30')]!=='VIRTUAL'){var _0x13b795={};_0x13b795[_0x52e4a2[_0x563a('0x2a')]]={'$like':'%'+_0x1a69d5[_0x563a('0x34')][_0x563a('0x40')]+'%'};return _0x13b795;}})});}_0x1bdfb0=_['merge']({},_0x1bdfb0,_0x1a69d5['options']);var _0x615d2e={'where':_0x1bdfb0['where']};return db[_0x563a('0x2e')][_0x563a('0x20')](_0x615d2e)[_0x563a('0x26')](function(_0x9c392c){_0x579cb5[_0x563a('0x20')]=_0x9c392c;if(_0x1a69d5[_0x563a('0x34')][_0x563a('0x42')]){_0x1bdfb0[_0x563a('0x43')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x563a('0x44')](_0x1bdfb0);})['then'](function(_0x20c142){_0x579cb5[_0x563a('0x45')]=_0x20c142;return _0x579cb5;})[_0x563a('0x26')](respondWithFilteredResult(_0x24d1a8,_0x1bdfb0))[_0x563a('0x46')](handleError(_0x24d1a8,null));};exports['show']=function(_0x4b3d38,_0x54ac1e){var _0x2221d4={'raw':!![],'where':{'id':_0x4b3d38[_0x563a('0x47')]['id']}},_0x1255da={};_0x1255da[_0x563a('0x32')]=_[_0x563a('0x33')](db[_0x563a('0x2e')][_0x563a('0x48')]);_0x1255da[_0x563a('0x34')]=_[_0x563a('0x33')](_0x4b3d38[_0x563a('0x34')]);_0x1255da[_0x563a('0x35')]=_[_0x563a('0x36')](_0x1255da[_0x563a('0x32')],_0x1255da[_0x563a('0x34')]);_0x2221d4[_0x563a('0x38')]=_[_0x563a('0x36')](_0x1255da[_0x563a('0x32')],qs[_0x563a('0x37')](_0x4b3d38[_0x563a('0x34')]['fields']));_0x2221d4['attributes']=_0x2221d4[_0x563a('0x38')][_0x563a('0x39')]?_0x2221d4[_0x563a('0x38')]:_0x1255da[_0x563a('0x32')];if(_0x4b3d38[_0x563a('0x34')][_0x563a('0x42')]){_0x2221d4[_0x563a('0x43')]=[{'all':!![]}];}_0x2221d4=_[_0x563a('0x41')]({},_0x2221d4,_0x4b3d38['options']);return db['WhatsappQueueReport'][_0x563a('0x49')](_0x2221d4)[_0x563a('0x26')](handleEntityNotFound(_0x54ac1e,null))[_0x563a('0x26')](respondWithResult(_0x54ac1e,null))[_0x563a('0x46')](handleError(_0x54ac1e,null));};exports[_0x563a('0x4a')]=function(_0x3f2c5d,_0x2689b5){return db[_0x563a('0x2e')]['create'](_0x3f2c5d[_0x563a('0x4b')],{})[_0x563a('0x26')](respondWithResult(_0x2689b5,0xc9))['catch'](handleError(_0x2689b5,null));};exports[_0x563a('0x25')]=function(_0x5a063a,_0x3ea787){if(_0x5a063a[_0x563a('0x4b')]['id']){delete _0x5a063a[_0x563a('0x4b')]['id'];}return db['WhatsappQueueReport'][_0x563a('0x49')]({'where':{'id':_0x5a063a[_0x563a('0x47')]['id']}})[_0x563a('0x26')](handleEntityNotFound(_0x3ea787,null))[_0x563a('0x26')](saveUpdates(_0x5a063a[_0x563a('0x4b')],null))[_0x563a('0x26')](respondWithResult(_0x3ea787,null))[_0x563a('0x46')](handleError(_0x3ea787,null));};exports[_0x563a('0x27')]=function(_0x277d54,_0x2008d4){return db[_0x563a('0x2e')][_0x563a('0x49')]({'where':{'id':_0x277d54[_0x563a('0x47')]['id']}})['then'](handleEntityNotFound(_0x2008d4,null))['then'](removeEntity(_0x2008d4,null))[_0x563a('0x46')](handleError(_0x2008d4,null));};exports[_0x563a('0x4c')]=function(_0x143daa,_0x4a807f){return db['WhatsappQueueReport'][_0x563a('0x4c')]()[_0x563a('0x26')](respondWithResult(_0x4a807f,null))['catch'](handleError(_0x4a807f,null));}; \ No newline at end of file +var _0xa571=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','save','update','then','destroy','end','error','name','index','map','WhatsappQueueReport','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','show','params','rawAttributes','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0x556a93,_0x2fde7c){var _0xe278b3=function(_0x33a817){while(--_0x33a817){_0x556a93['push'](_0x556a93['shift']());}};_0xe278b3(++_0x2fde7c);}(_0xa571,0x107));var _0x1a57=function(_0x26d22d,_0x3ee820){_0x26d22d=_0x26d22d-0x0;var _0x2a9571=_0xa571[_0x26d22d];return _0x2a9571;};'use strict';var emlformat=require(_0x1a57('0x0'));var rimraf=require(_0x1a57('0x1'));var zipdir=require(_0x1a57('0x2'));var jsonpatch=require(_0x1a57('0x3'));var rp=require('request-promise');var moment=require(_0x1a57('0x4'));var BPromise=require(_0x1a57('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1a57('0x6'));var sox=require('sox');var csv=require(_0x1a57('0x7'));var ejs=require(_0x1a57('0x8'));var fs=require('fs');var fs_extra=require(_0x1a57('0x9'));var _=require(_0x1a57('0xa'));var squel=require(_0x1a57('0xb'));var crypto=require(_0x1a57('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1a57('0xd'));var toCsv=require(_0x1a57('0x7'));var querystring=require(_0x1a57('0xe'));var Papa=require('papaparse');var Redis=require(_0x1a57('0xf'));var authService=require(_0x1a57('0x10'));var qs=require(_0x1a57('0x11'));var as=require(_0x1a57('0x12'));var hardwareService=require(_0x1a57('0x13'));var logger=require(_0x1a57('0x14'))(_0x1a57('0x15'));var utils=require(_0x1a57('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1a57('0x17'))['db'];function respondWithStatusCode(_0x1911b2,_0x202d9a){_0x202d9a=_0x202d9a||0xcc;return function(_0x5ae643){if(_0x5ae643){return _0x1911b2[_0x1a57('0x18')](_0x202d9a);}return _0x1911b2[_0x1a57('0x19')](_0x202d9a)['end']();};}function respondWithResult(_0x503278,_0x587422){_0x587422=_0x587422||0xc8;return function(_0xd08107){if(_0xd08107){return _0x503278[_0x1a57('0x19')](_0x587422)[_0x1a57('0x1a')](_0xd08107);}};}function respondWithFilteredResult(_0x153d01,_0x5802d6){return function(_0x20f7ad){if(_0x20f7ad){var _0x53c61f=typeof _0x5802d6['offset']===_0x1a57('0x1b')&&typeof _0x5802d6[_0x1a57('0x1c')]===_0x1a57('0x1b');var _0x51b4c2=_0x20f7ad[_0x1a57('0x1d')];var _0x1662a3=_0x53c61f?0x0:_0x5802d6[_0x1a57('0x1e')];var _0x53bb20=_0x53c61f?_0x20f7ad[_0x1a57('0x1d')]:_0x5802d6[_0x1a57('0x1e')]+_0x5802d6[_0x1a57('0x1c')];var _0xcba6b7;if(_0x53bb20>=_0x51b4c2){_0x53bb20=_0x51b4c2;_0xcba6b7=0xc8;}else{_0xcba6b7=0xce;}_0x153d01[_0x1a57('0x19')](_0xcba6b7);return _0x153d01['set']('Content-Range',_0x1662a3+'-'+_0x53bb20+'/'+_0x51b4c2)[_0x1a57('0x1a')](_0x20f7ad);}return null;};}function patchUpdates(_0x21e811){return function(_0x211c63){try{jsonpatch['apply'](_0x211c63,_0x21e811,!![]);}catch(_0x5c200e){return BPromise['reject'](_0x5c200e);}return _0x211c63[_0x1a57('0x1f')]();};}function saveUpdates(_0x113ad4,_0x3f52b9){return function(_0xee133b){if(_0xee133b){return _0xee133b[_0x1a57('0x20')](_0x113ad4)[_0x1a57('0x21')](function(_0x2efa49){return _0x2efa49;});}return null;};}function removeEntity(_0x2f8b00,_0x183ca3){return function(_0x35d5dc){if(_0x35d5dc){return _0x35d5dc[_0x1a57('0x22')]()[_0x1a57('0x21')](function(){_0x2f8b00[_0x1a57('0x19')](0xcc)[_0x1a57('0x23')]();});}};}function handleEntityNotFound(_0x2f9454,_0x182649){return function(_0x25c1e9){if(!_0x25c1e9){_0x2f9454[_0x1a57('0x18')](0x194);}return _0x25c1e9;};}function handleError(_0x27cfe1,_0xf6ffef){_0xf6ffef=_0xf6ffef||0x1f4;return function(_0x26584b){logger[_0x1a57('0x24')](_0x26584b['stack']);if(_0x26584b['name']){delete _0x26584b[_0x1a57('0x25')];}_0x27cfe1[_0x1a57('0x19')](_0xf6ffef)['send'](_0x26584b);};}exports[_0x1a57('0x26')]=function(_0x54f6a5,_0x2d8738){var _0x4a2901={},_0x53bf6e={},_0x8179a4={'count':0x0,'rows':[]};var _0x274fe6=_[_0x1a57('0x27')](db[_0x1a57('0x28')]['rawAttributes'],function(_0x366d5f){return{'name':_0x366d5f[_0x1a57('0x29')],'type':_0x366d5f[_0x1a57('0x2a')][_0x1a57('0x2b')]};});_0x53bf6e['model']=_[_0x1a57('0x27')](_0x274fe6,_0x1a57('0x25'));_0x53bf6e[_0x1a57('0x2c')]=_[_0x1a57('0x2d')](_0x54f6a5[_0x1a57('0x2c')]);_0x53bf6e[_0x1a57('0x2e')]=_[_0x1a57('0x2f')](_0x53bf6e[_0x1a57('0x30')],_0x53bf6e[_0x1a57('0x2c')]);_0x4a2901['attributes']=_[_0x1a57('0x2f')](_0x53bf6e[_0x1a57('0x30')],qs['fields'](_0x54f6a5['query'][_0x1a57('0x31')]));_0x4a2901[_0x1a57('0x32')]=_0x4a2901[_0x1a57('0x32')][_0x1a57('0x33')]?_0x4a2901[_0x1a57('0x32')]:_0x53bf6e[_0x1a57('0x30')];if(!_0x54f6a5[_0x1a57('0x2c')][_0x1a57('0x34')](_0x1a57('0x35'))){_0x4a2901[_0x1a57('0x1c')]=qs[_0x1a57('0x1c')](_0x54f6a5[_0x1a57('0x2c')][_0x1a57('0x1c')]);_0x4a2901[_0x1a57('0x1e')]=qs[_0x1a57('0x1e')](_0x54f6a5[_0x1a57('0x2c')][_0x1a57('0x1e')]);}_0x4a2901[_0x1a57('0x36')]=qs['sort'](_0x54f6a5[_0x1a57('0x2c')][_0x1a57('0x37')]);_0x4a2901[_0x1a57('0x38')]=qs[_0x1a57('0x2e')](_[_0x1a57('0x39')](_0x54f6a5[_0x1a57('0x2c')],_0x53bf6e[_0x1a57('0x2e')]),_0x274fe6);if(_0x54f6a5[_0x1a57('0x2c')][_0x1a57('0x3a')]){_0x4a2901['where']=_['merge'](_0x4a2901['where'],{'$or':_['map'](_0x274fe6,function(_0x333b32){if(_0x333b32[_0x1a57('0x2a')]!==_0x1a57('0x3b')){var _0x4d6e1e={};_0x4d6e1e[_0x333b32[_0x1a57('0x25')]]={'$like':'%'+_0x54f6a5[_0x1a57('0x2c')][_0x1a57('0x3a')]+'%'};return _0x4d6e1e;}})});}_0x4a2901=_[_0x1a57('0x3c')]({},_0x4a2901,_0x54f6a5['options']);var _0x1be254={'where':_0x4a2901['where']};return db[_0x1a57('0x28')][_0x1a57('0x1d')](_0x1be254)[_0x1a57('0x21')](function(_0x534a9a){_0x8179a4[_0x1a57('0x1d')]=_0x534a9a;if(_0x54f6a5[_0x1a57('0x2c')][_0x1a57('0x3d')]){_0x4a2901[_0x1a57('0x3e')]=[{'all':!![]}];}return db[_0x1a57('0x28')]['findAll'](_0x4a2901);})[_0x1a57('0x21')](function(_0x47e998){_0x8179a4['rows']=_0x47e998;return _0x8179a4;})[_0x1a57('0x21')](respondWithFilteredResult(_0x2d8738,_0x4a2901))['catch'](handleError(_0x2d8738,null));};exports[_0x1a57('0x3f')]=function(_0x398c59,_0x3fbae1){var _0x59abb1={'raw':!![],'where':{'id':_0x398c59[_0x1a57('0x40')]['id']}},_0x188a50={};_0x188a50[_0x1a57('0x30')]=_[_0x1a57('0x2d')](db['WhatsappQueueReport'][_0x1a57('0x41')]);_0x188a50[_0x1a57('0x2c')]=_['keys'](_0x398c59[_0x1a57('0x2c')]);_0x188a50['filters']=_['intersection'](_0x188a50[_0x1a57('0x30')],_0x188a50[_0x1a57('0x2c')]);_0x59abb1[_0x1a57('0x32')]=_[_0x1a57('0x2f')](_0x188a50['model'],qs[_0x1a57('0x31')](_0x398c59[_0x1a57('0x2c')][_0x1a57('0x31')]));_0x59abb1[_0x1a57('0x32')]=_0x59abb1[_0x1a57('0x32')]['length']?_0x59abb1[_0x1a57('0x32')]:_0x188a50[_0x1a57('0x30')];if(_0x398c59[_0x1a57('0x2c')][_0x1a57('0x3d')]){_0x59abb1['include']=[{'all':!![]}];}_0x59abb1=_[_0x1a57('0x3c')]({},_0x59abb1,_0x398c59['options']);return db[_0x1a57('0x28')][_0x1a57('0x42')](_0x59abb1)[_0x1a57('0x21')](handleEntityNotFound(_0x3fbae1,null))[_0x1a57('0x21')](respondWithResult(_0x3fbae1,null))[_0x1a57('0x43')](handleError(_0x3fbae1,null));};exports[_0x1a57('0x44')]=function(_0x28f629,_0x401285){return db[_0x1a57('0x28')][_0x1a57('0x44')](_0x28f629[_0x1a57('0x45')],{})[_0x1a57('0x21')](respondWithResult(_0x401285,0xc9))[_0x1a57('0x43')](handleError(_0x401285,null));};exports['update']=function(_0xf4d056,_0x480aff){if(_0xf4d056[_0x1a57('0x45')]['id']){delete _0xf4d056[_0x1a57('0x45')]['id'];}return db[_0x1a57('0x28')][_0x1a57('0x42')]({'where':{'id':_0xf4d056[_0x1a57('0x40')]['id']}})[_0x1a57('0x21')](handleEntityNotFound(_0x480aff,null))[_0x1a57('0x21')](saveUpdates(_0xf4d056[_0x1a57('0x45')],null))[_0x1a57('0x21')](respondWithResult(_0x480aff,null))['catch'](handleError(_0x480aff,null));};exports[_0x1a57('0x22')]=function(_0x439a42,_0x51651d){return db[_0x1a57('0x28')][_0x1a57('0x42')]({'where':{'id':_0x439a42['params']['id']}})[_0x1a57('0x21')](handleEntityNotFound(_0x51651d,null))[_0x1a57('0x21')](removeEntity(_0x51651d,null))['catch'](handleError(_0x51651d,null));};exports['describe']=function(_0x5b0563,_0x2c1bac){return db[_0x1a57('0x28')]['describe']()[_0x1a57('0x21')](respondWithResult(_0x2c1bac,null))[_0x1a57('0x43')](handleError(_0x2c1bac,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 76888ea..1d4a95c 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 _0x8b8c=['request-promise','path','rimraf','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','../../config/logger','api','moment','bluebird'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x8b8c,0xb0));var _0xc8b8=function(_0x4d8870,_0x1dedf6){_0x4d8870=_0x4d8870-0x0;var _0x53d359=_0x8b8c[_0x4d8870];return _0x53d359;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc8b8('0x0'))(_0xc8b8('0x1'));var moment=require(_0xc8b8('0x2'));var BPromise=require(_0xc8b8('0x3'));var rp=require(_0xc8b8('0x4'));var fs=require('fs');var path=require(_0xc8b8('0x5'));var rimraf=require(_0xc8b8('0x6'));var config=require('../../config/environment');var attributes=require(_0xc8b8('0x7'));module[_0xc8b8('0x8')]=function(_0x1a266a,_0x4f255b){return _0x1a266a[_0xc8b8('0x9')](_0xc8b8('0xa'),attributes,{'tableName':_0xc8b8('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x96f2=['../../config/environment','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x21b706,_0x1022f4){var _0x13b94a=function(_0x3116da){while(--_0x3116da){_0x21b706['push'](_0x21b706['shift']());}};_0x13b94a(++_0x1022f4);}(_0x96f2,0x11e));var _0x296f=function(_0x1dd39c,_0x4b37dc){_0x1dd39c=_0x1dd39c-0x0;var _0xcc758c=_0x96f2[_0x1dd39c];return _0xcc758c;};'use strict';var _=require(_0x296f('0x0'));var util=require(_0x296f('0x1'));var logger=require('../../config/logger')(_0x296f('0x2'));var moment=require(_0x296f('0x3'));var BPromise=require(_0x296f('0x4'));var rp=require(_0x296f('0x5'));var fs=require('fs');var path=require(_0x296f('0x6'));var rimraf=require(_0x296f('0x7'));var config=require(_0x296f('0x8'));var attributes=require('./whatsappQueueReport.attributes');module[_0x296f('0x9')]=function(_0x517e27,_0x48c7c8){return _0x517e27[_0x296f('0xa')](_0x296f('0xb'),attributes,{'tableName':_0x296f('0xc'),'paranoid':![],'indexes':[{'name':_0x296f('0xd'),'fields':[_0x296f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 6e30910..e263703 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 _0x7023=['debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','options','raw','UpdateWhatsappQueueReport','update','body','where','attributes','limit','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x12bd82,_0x2e09e3){var _0x2b29de=function(_0x2800d8){while(--_0x2800d8){_0x12bd82['push'](_0x12bd82['shift']());}};_0x2b29de(++_0x2e09e3);}(_0x7023,0x167));var _0x3702=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x7023[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x3702('0x0'));var util=require(_0x3702('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3702('0x2'));var fs=require('fs');var Redis=require(_0x3702('0x3'));var db=require(_0x3702('0x4'))['db'];var utils=require(_0x3702('0x5'));var logger=require(_0x3702('0x6'))(_0x3702('0x7'));var config=require(_0x3702('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xc671da,_0x5db0de,_0x18dac6){return new BPromise(function(_0x3edde7,_0xb08bd4){return client['request'](_0xc671da,_0x18dac6)[_0x3702('0x9')](function(_0x1d51f6){logger[_0x3702('0xa')](_0x3702('0xb'),_0x5db0de,_0x3702('0xc'));logger[_0x3702('0xd')](_0x3702('0xe'),_0x5db0de,_0x3702('0xc'),JSON[_0x3702('0xf')](_0x1d51f6));if(_0x1d51f6['error']){if(_0x1d51f6[_0x3702('0x10')][_0x3702('0x11')]===0x1f4){logger['error'](_0x3702('0xb'),_0x5db0de,_0x1d51f6['error'][_0x3702('0x12')]);return _0xb08bd4(_0x1d51f6[_0x3702('0x10')][_0x3702('0x12')]);}logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x5db0de,_0x1d51f6['error']['message']);return _0x3edde7(_0x1d51f6['error'][_0x3702('0x12')]);}else{logger[_0x3702('0xa')](_0x3702('0xb'),_0x5db0de,_0x3702('0xc'));_0x3edde7(_0x1d51f6[_0x3702('0x13')][_0x3702('0x12')]);}})[_0x3702('0x14')](function(_0x4ba60d){logger[_0x3702('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5db0de,_0x4ba60d);_0xb08bd4(_0x4ba60d);});});}exports[_0x3702('0x15')]=function(_0x51762b){var _0x271a40=this;return new Promise(function(_0x47e364,_0xe6253e){return db[_0x3702('0x16')]['create'](_0x51762b['body'],{'raw':_0x51762b['options']?_0x51762b[_0x3702('0x17')][_0x3702('0x18')]===undefined?!![]:![]:!![]})[_0x3702('0x9')](function(_0x4f143d){logger['info']('CreateWhatsappQueueReport',_0x51762b);logger[_0x3702('0xd')](_0x3702('0x15'),_0x51762b,JSON[_0x3702('0xf')](_0x4f143d));_0x47e364(_0x4f143d);})[_0x3702('0x14')](function(_0xbde3cb){logger[_0x3702('0x10')](_0x3702('0x15'),_0xbde3cb['message'],_0x51762b);_0xe6253e(_0x271a40[_0x3702('0x10')](0x1f4,_0xbde3cb[_0x3702('0x12')]));});});};exports[_0x3702('0x19')]=function(_0x57ade8){var _0x2f0a61=this;return new Promise(function(_0x38ffcc,_0x1d146c){return db[_0x3702('0x16')][_0x3702('0x1a')](_0x57ade8[_0x3702('0x1b')],{'raw':_0x57ade8[_0x3702('0x17')]?_0x57ade8[_0x3702('0x17')][_0x3702('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57ade8[_0x3702('0x17')]?_0x57ade8[_0x3702('0x17')][_0x3702('0x1c')]||null:null,'attributes':_0x57ade8[_0x3702('0x17')]?_0x57ade8[_0x3702('0x17')][_0x3702('0x1d')]||null:null,'limit':_0x57ade8['options']?_0x57ade8[_0x3702('0x17')][_0x3702('0x1e')]||null:null})[_0x3702('0x9')](function(_0x5adb81){logger[_0x3702('0xa')]('UpdateWhatsappQueueReport',_0x57ade8);logger[_0x3702('0xd')](_0x3702('0x19'),_0x57ade8,JSON[_0x3702('0xf')](_0x5adb81));_0x38ffcc(_0x5adb81);})['catch'](function(_0x395fb9){logger[_0x3702('0x10')](_0x3702('0x19'),_0x395fb9[_0x3702('0x12')],_0x57ade8);_0x1d146c(_0x2f0a61[_0x3702('0x10')](0x1f4,_0x395fb9[_0x3702('0x12')]));});});}; \ No newline at end of file +var _0x3aba=['stringify','code','WhatsappQueueReport,\x20%s,\x20%s','error','message','result','WhatsappQueueReport','create','body','options','CreateWhatsappQueueReport','catch','UpdateWhatsappQueueReport','raw','attributes','limit','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug'];(function(_0x39bec4,_0x8e04c1){var _0x5d236f=function(_0xfb3854){while(--_0xfb3854){_0x39bec4['push'](_0x39bec4['shift']());}};_0x5d236f(++_0x8e04c1);}(_0x3aba,0xc4));var _0xa3ab=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0x3aba[_0x4c440b];return _0x2d48cf;};'use strict';var _=require(_0xa3ab('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa3ab('0x1'));var rs=require(_0xa3ab('0x2'));var fs=require('fs');var Redis=require(_0xa3ab('0x3'));var db=require(_0xa3ab('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa3ab('0x5'))(_0xa3ab('0x6'));var config=require('../../config/environment');var jayson=require(_0xa3ab('0x7'));var client=jayson['client'][_0xa3ab('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x412bf3,_0x5dcf80,_0x46f62b){return new BPromise(function(_0xf0089f,_0x3ece09){return client[_0xa3ab('0x9')](_0x412bf3,_0x46f62b)[_0xa3ab('0xa')](function(_0x123699){logger[_0xa3ab('0xb')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5dcf80,_0xa3ab('0xc'));logger[_0xa3ab('0xd')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x5dcf80,_0xa3ab('0xc'),JSON[_0xa3ab('0xe')](_0x123699));if(_0x123699['error']){if(_0x123699['error'][_0xa3ab('0xf')]===0x1f4){logger['error'](_0xa3ab('0x10'),_0x5dcf80,_0x123699[_0xa3ab('0x11')][_0xa3ab('0x12')]);return _0x3ece09(_0x123699['error']['message']);}logger[_0xa3ab('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5dcf80,_0x123699[_0xa3ab('0x11')][_0xa3ab('0x12')]);return _0xf0089f(_0x123699[_0xa3ab('0x11')]['message']);}else{logger[_0xa3ab('0xb')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5dcf80,_0xa3ab('0xc'));_0xf0089f(_0x123699[_0xa3ab('0x13')][_0xa3ab('0x12')]);}})['catch'](function(_0x483be4){logger[_0xa3ab('0x11')](_0xa3ab('0x10'),_0x5dcf80,_0x483be4);_0x3ece09(_0x483be4);});});}exports['CreateWhatsappQueueReport']=function(_0x516590){var _0x3241ec=this;return new Promise(function(_0xd210eb,_0x46337f){return db[_0xa3ab('0x14')][_0xa3ab('0x15')](_0x516590[_0xa3ab('0x16')],{'raw':_0x516590[_0xa3ab('0x17')]?_0x516590[_0xa3ab('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5a1edf){logger[_0xa3ab('0xb')]('CreateWhatsappQueueReport',_0x516590);logger[_0xa3ab('0xd')](_0xa3ab('0x18'),_0x516590,JSON[_0xa3ab('0xe')](_0x5a1edf));_0xd210eb(_0x5a1edf);})[_0xa3ab('0x19')](function(_0x13dbbb){logger[_0xa3ab('0x11')](_0xa3ab('0x18'),_0x13dbbb[_0xa3ab('0x12')],_0x516590);_0x46337f(_0x3241ec[_0xa3ab('0x11')](0x1f4,_0x13dbbb[_0xa3ab('0x12')]));});});};exports[_0xa3ab('0x1a')]=function(_0x19d296){var _0x2f0113=this;return new Promise(function(_0x558061,_0x262dd0){return db[_0xa3ab('0x14')]['update'](_0x19d296['body'],{'raw':_0x19d296[_0xa3ab('0x17')]?_0x19d296[_0xa3ab('0x17')][_0xa3ab('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19d296[_0xa3ab('0x17')]?_0x19d296[_0xa3ab('0x17')]['where']||null:null,'attributes':_0x19d296[_0xa3ab('0x17')]?_0x19d296[_0xa3ab('0x17')][_0xa3ab('0x1c')]||null:null,'limit':_0x19d296['options']?_0x19d296['options'][_0xa3ab('0x1d')]||null:null})[_0xa3ab('0xa')](function(_0x5e10d3){logger[_0xa3ab('0xb')](_0xa3ab('0x1a'),_0x19d296);logger[_0xa3ab('0xd')](_0xa3ab('0x1a'),_0x19d296,JSON[_0xa3ab('0xe')](_0x5e10d3));_0x558061(_0x5e10d3);})[_0xa3ab('0x19')](function(_0x2162e0){logger[_0xa3ab('0x11')](_0xa3ab('0x1a'),_0x2162e0[_0xa3ab('0x12')],_0x19d296);_0x262dd0(_0x2f0113[_0xa3ab('0x11')](0x1f4,_0x2162e0['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index a092f44..b0876c2 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 _0x8771=['delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','put'];(function(_0x5d3d2f,_0x29afd1){var _0x30712e=function(_0x10546f){while(--_0x10546f){_0x5d3d2f['push'](_0x5d3d2f['shift']());}};_0x30712e(++_0x29afd1);}(_0x8771,0x193));var _0x1877=function(_0xb4b80e,_0x1f02e8){_0xb4b80e=_0xb4b80e-0x0;var _0x5e4846=_0x8771[_0xb4b80e];return _0x5e4846;};'use strict';var multer=require(_0x1877('0x0'));var util=require(_0x1877('0x1'));var path=require(_0x1877('0x2'));var timeout=require('connect-timeout');var express=require(_0x1877('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1877('0x4'));var interaction=require(_0x1877('0x5'));var config=require(_0x1877('0x6'));var controller=require('./whatsappTransferReport.controller');router[_0x1877('0x7')]('/',auth[_0x1877('0x8')](),controller['index']);router[_0x1877('0x7')](_0x1877('0x9'),auth[_0x1877('0x8')](),controller[_0x1877('0xa')]);router[_0x1877('0x7')](_0x1877('0xb'),auth[_0x1877('0x8')](),controller['show']);router['post']('/',auth[_0x1877('0x8')](),controller['create']);router[_0x1877('0xc')](_0x1877('0xb'),auth[_0x1877('0x8')](),controller['update']);router[_0x1877('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x1877('0xe')]);module[_0x1877('0xf')]=router; \ No newline at end of file +var _0x8cae=['/describe','isAuthenticated','/:id','show','create','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get'];(function(_0x12926a,_0xb3be90){var _0x2db765=function(_0x32e279){while(--_0x32e279){_0x12926a['push'](_0x12926a['shift']());}};_0x2db765(++_0xb3be90);}(_0x8cae,0x19a));var _0xe8ca=function(_0x4f6e00,_0x3cf6a6){_0x4f6e00=_0x4f6e00-0x0;var _0x17fa1b=_0x8cae[_0x4f6e00];return _0x17fa1b;};'use strict';var multer=require(_0xe8ca('0x0'));var util=require('util');var path=require(_0xe8ca('0x1'));var timeout=require('connect-timeout');var express=require(_0xe8ca('0x2'));var router=express[_0xe8ca('0x3')]();var fs_extra=require(_0xe8ca('0x4'));var auth=require(_0xe8ca('0x5'));var interaction=require(_0xe8ca('0x6'));var config=require(_0xe8ca('0x7'));var controller=require('./whatsappTransferReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xe8ca('0x8')]);router[_0xe8ca('0x9')](_0xe8ca('0xa'),auth[_0xe8ca('0xb')](),controller['describe']);router[_0xe8ca('0x9')](_0xe8ca('0xc'),auth[_0xe8ca('0xb')](),controller[_0xe8ca('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe8ca('0xe')]);router[_0xe8ca('0xf')](_0xe8ca('0xc'),auth[_0xe8ca('0xb')](),controller[_0xe8ca('0x10')]);router[_0xe8ca('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xe8ca('0x12')]);module[_0xe8ca('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 663af4f..ee24847 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 _0xc7da=['agent','DATE','sequelize','exports','STRING','account'];(function(_0x15b192,_0x437b07){var _0x362c9a=function(_0x405211){while(--_0x405211){_0x15b192['push'](_0x15b192['shift']());}};_0x362c9a(++_0x437b07);}(_0xc7da,0xf2));var _0xac7d=function(_0x39fba9,_0x5d2ad0){_0x39fba9=_0x39fba9-0x0;var _0x22ecc7=_0xc7da[_0x39fba9];return _0x22ecc7;};'use strict';var Sequelize=require(_0xac7d('0x0'));module[_0xac7d('0x1')]={'uniqueid':{'type':Sequelize[_0xac7d('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xac7d('0x3'),_0xac7d('0x4'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xac7d('0x5')]}}; \ No newline at end of file +var _0x9703=['ENUM','account','queue','STRING'];(function(_0x544cb8,_0x57729a){var _0x41cda5=function(_0x38fd8b){while(--_0x38fd8b){_0x544cb8['push'](_0x544cb8['shift']());}};_0x41cda5(++_0x57729a);}(_0x9703,0xdb));var _0x3970=function(_0x5e9d1f,_0x37c578){_0x5e9d1f=_0x5e9d1f-0x0;var _0x895bea=_0x9703[_0x5e9d1f];return _0x895bea;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x3970('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x3970('0x1')](_0x3970('0x2'),'agent',_0x3970('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 37b04f9..7734349 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 _0x3f06=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','include','findAll','rows','catch','show','merge','create','body','find','params','describe','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields'];(function(_0x117d79,_0x2da11e){var _0x27f14b=function(_0x58be7e){while(--_0x58be7e){_0x117d79['push'](_0x117d79['shift']());}};_0x27f14b(++_0x2da11e);}(_0x3f06,0x140));var _0x63f0=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x3f06[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x63f0('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x63f0('0x1'));var rp=require(_0x63f0('0x2'));var moment=require('moment');var BPromise=require(_0x63f0('0x3'));var Mustache=require(_0x63f0('0x4'));var util=require(_0x63f0('0x5'));var path=require(_0x63f0('0x6'));var sox=require(_0x63f0('0x7'));var csv=require(_0x63f0('0x8'));var ejs=require(_0x63f0('0x9'));var fs=require('fs');var fs_extra=require(_0x63f0('0xa'));var _=require('lodash');var squel=require(_0x63f0('0xb'));var crypto=require(_0x63f0('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x63f0('0x8'));var querystring=require('querystring');var Papa=require(_0x63f0('0xd'));var Redis=require('ioredis');var authService=require(_0x63f0('0xe'));var qs=require(_0x63f0('0xf'));var as=require(_0x63f0('0x10'));var hardwareService=require(_0x63f0('0x11'));var logger=require(_0x63f0('0x12'))(_0x63f0('0x13'));var utils=require(_0x63f0('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x63f0('0x15'));var db=require(_0x63f0('0x16'))['db'];function respondWithStatusCode(_0x53e0c8,_0x175981){_0x175981=_0x175981||0xcc;return function(_0x4ead87){if(_0x4ead87){return _0x53e0c8[_0x63f0('0x17')](_0x175981);}return _0x53e0c8[_0x63f0('0x18')](_0x175981)[_0x63f0('0x19')]();};}function respondWithResult(_0x452fbb,_0x2554ee){_0x2554ee=_0x2554ee||0xc8;return function(_0x1dff77){if(_0x1dff77){return _0x452fbb[_0x63f0('0x18')](_0x2554ee)['json'](_0x1dff77);}};}function respondWithFilteredResult(_0x1c9839,_0x3fc451){return function(_0x3d98ec){if(_0x3d98ec){var _0x9706f=typeof _0x3fc451[_0x63f0('0x1a')]===_0x63f0('0x1b')&&typeof _0x3fc451[_0x63f0('0x1c')]===_0x63f0('0x1b');var _0x1850ec=_0x3d98ec[_0x63f0('0x1d')];var _0x391647=_0x9706f?0x0:_0x3fc451['offset'];var _0x541fcd=_0x9706f?_0x3d98ec[_0x63f0('0x1d')]:_0x3fc451['offset']+_0x3fc451[_0x63f0('0x1c')];var _0x524598;if(_0x541fcd>=_0x1850ec){_0x541fcd=_0x1850ec;_0x524598=0xc8;}else{_0x524598=0xce;}_0x1c9839[_0x63f0('0x18')](_0x524598);return _0x1c9839[_0x63f0('0x1e')](_0x63f0('0x1f'),_0x391647+'-'+_0x541fcd+'/'+_0x1850ec)[_0x63f0('0x20')](_0x3d98ec);}return null;};}function patchUpdates(_0x378a0a){return function(_0x5f53c7){try{jsonpatch[_0x63f0('0x21')](_0x5f53c7,_0x378a0a,!![]);}catch(_0x1feeca){return BPromise[_0x63f0('0x22')](_0x1feeca);}return _0x5f53c7['save']();};}function saveUpdates(_0x8309d5,_0x5bbdc1){return function(_0x3a6d37){if(_0x3a6d37){return _0x3a6d37[_0x63f0('0x23')](_0x8309d5)[_0x63f0('0x24')](function(_0x5dae6e){return _0x5dae6e;});}return null;};}function removeEntity(_0x13cc66,_0x5bc916){return function(_0x305c38){if(_0x305c38){return _0x305c38[_0x63f0('0x25')]()[_0x63f0('0x24')](function(){_0x13cc66[_0x63f0('0x18')](0xcc)[_0x63f0('0x19')]();});}};}function handleEntityNotFound(_0x4b3276,_0x1b176d){return function(_0xe12214){if(!_0xe12214){_0x4b3276['sendStatus'](0x194);}return _0xe12214;};}function handleError(_0x3fd5af,_0x2d6381){_0x2d6381=_0x2d6381||0x1f4;return function(_0x28db7e){logger['error'](_0x28db7e[_0x63f0('0x26')]);if(_0x28db7e[_0x63f0('0x27')]){delete _0x28db7e[_0x63f0('0x27')];}_0x3fd5af[_0x63f0('0x18')](_0x2d6381)[_0x63f0('0x28')](_0x28db7e);};}exports[_0x63f0('0x29')]=function(_0x39f98b,_0x24ad1d){var _0x205d19={},_0x43160f={},_0x5d7efb={'count':0x0,'rows':[]};var _0x401c5e=_[_0x63f0('0x2a')](db[_0x63f0('0x2b')][_0x63f0('0x2c')],function(_0x20aab9){return{'name':_0x20aab9[_0x63f0('0x2d')],'type':_0x20aab9[_0x63f0('0x2e')][_0x63f0('0x2f')]};});_0x43160f[_0x63f0('0x30')]=_[_0x63f0('0x2a')](_0x401c5e,_0x63f0('0x27'));_0x43160f['query']=_[_0x63f0('0x31')](_0x39f98b['query']);_0x43160f[_0x63f0('0x32')]=_[_0x63f0('0x33')](_0x43160f[_0x63f0('0x30')],_0x43160f[_0x63f0('0x34')]);_0x205d19[_0x63f0('0x35')]=_[_0x63f0('0x33')](_0x43160f['model'],qs[_0x63f0('0x36')](_0x39f98b[_0x63f0('0x34')]['fields']));_0x205d19[_0x63f0('0x35')]=_0x205d19[_0x63f0('0x35')][_0x63f0('0x37')]?_0x205d19[_0x63f0('0x35')]:_0x43160f[_0x63f0('0x30')];if(!_0x39f98b[_0x63f0('0x34')][_0x63f0('0x38')](_0x63f0('0x39'))){_0x205d19[_0x63f0('0x1c')]=qs[_0x63f0('0x1c')](_0x39f98b[_0x63f0('0x34')][_0x63f0('0x1c')]);_0x205d19[_0x63f0('0x1a')]=qs[_0x63f0('0x1a')](_0x39f98b[_0x63f0('0x34')]['offset']);}_0x205d19[_0x63f0('0x3a')]=qs[_0x63f0('0x3b')](_0x39f98b[_0x63f0('0x34')][_0x63f0('0x3b')]);_0x205d19[_0x63f0('0x3c')]=qs['filters'](_[_0x63f0('0x3d')](_0x39f98b[_0x63f0('0x34')],_0x43160f['filters']),_0x401c5e);if(_0x39f98b[_0x63f0('0x34')][_0x63f0('0x3e')]){_0x205d19[_0x63f0('0x3c')]=_['merge'](_0x205d19[_0x63f0('0x3c')],{'$or':_[_0x63f0('0x2a')](_0x401c5e,function(_0x195636){if(_0x195636[_0x63f0('0x2e')]!=='VIRTUAL'){var _0x18bca9={};_0x18bca9[_0x195636[_0x63f0('0x27')]]={'$like':'%'+_0x39f98b[_0x63f0('0x34')][_0x63f0('0x3e')]+'%'};return _0x18bca9;}})});}_0x205d19=_['merge']({},_0x205d19,_0x39f98b[_0x63f0('0x3f')]);var _0x2aa6c4={'where':_0x205d19[_0x63f0('0x3c')]};return db[_0x63f0('0x2b')][_0x63f0('0x1d')](_0x2aa6c4)[_0x63f0('0x24')](function(_0x3ca375){_0x5d7efb['count']=_0x3ca375;if(_0x39f98b[_0x63f0('0x34')]['includeAll']){_0x205d19[_0x63f0('0x40')]=[{'all':!![]}];}return db[_0x63f0('0x2b')][_0x63f0('0x41')](_0x205d19);})[_0x63f0('0x24')](function(_0x59b8c4){_0x5d7efb[_0x63f0('0x42')]=_0x59b8c4;return _0x5d7efb;})['then'](respondWithFilteredResult(_0x24ad1d,_0x205d19))[_0x63f0('0x43')](handleError(_0x24ad1d,null));};exports[_0x63f0('0x44')]=function(_0x58cbcb,_0x59c2bf){var _0x294a66={'raw':!![],'where':{'id':_0x58cbcb['params']['id']}},_0x214c3c={};_0x214c3c['model']=_[_0x63f0('0x31')](db['WhatsappTransferReport'][_0x63f0('0x2c')]);_0x214c3c[_0x63f0('0x34')]=_[_0x63f0('0x31')](_0x58cbcb['query']);_0x214c3c[_0x63f0('0x32')]=_[_0x63f0('0x33')](_0x214c3c[_0x63f0('0x30')],_0x214c3c[_0x63f0('0x34')]);_0x294a66[_0x63f0('0x35')]=_['intersection'](_0x214c3c['model'],qs[_0x63f0('0x36')](_0x58cbcb[_0x63f0('0x34')][_0x63f0('0x36')]));_0x294a66[_0x63f0('0x35')]=_0x294a66['attributes']['length']?_0x294a66[_0x63f0('0x35')]:_0x214c3c['model'];if(_0x58cbcb[_0x63f0('0x34')]['includeAll']){_0x294a66[_0x63f0('0x40')]=[{'all':!![]}];}_0x294a66=_[_0x63f0('0x45')]({},_0x294a66,_0x58cbcb[_0x63f0('0x3f')]);return db[_0x63f0('0x2b')]['find'](_0x294a66)[_0x63f0('0x24')](handleEntityNotFound(_0x59c2bf,null))[_0x63f0('0x24')](respondWithResult(_0x59c2bf,null))[_0x63f0('0x43')](handleError(_0x59c2bf,null));};exports[_0x63f0('0x46')]=function(_0x525a9d,_0xb64370){return db[_0x63f0('0x2b')][_0x63f0('0x46')](_0x525a9d['body'],{})[_0x63f0('0x24')](respondWithResult(_0xb64370,0xc9))[_0x63f0('0x43')](handleError(_0xb64370,null));};exports[_0x63f0('0x23')]=function(_0x11f749,_0x42deb6){if(_0x11f749[_0x63f0('0x47')]['id']){delete _0x11f749[_0x63f0('0x47')]['id'];}return db[_0x63f0('0x2b')][_0x63f0('0x48')]({'where':{'id':_0x11f749[_0x63f0('0x49')]['id']}})['then'](handleEntityNotFound(_0x42deb6,null))[_0x63f0('0x24')](saveUpdates(_0x11f749['body'],null))[_0x63f0('0x24')](respondWithResult(_0x42deb6,null))['catch'](handleError(_0x42deb6,null));};exports[_0x63f0('0x25')]=function(_0x3c5b59,_0x4d7a15){return db[_0x63f0('0x2b')]['find']({'where':{'id':_0x3c5b59[_0x63f0('0x49')]['id']}})['then'](handleEntityNotFound(_0x4d7a15,null))[_0x63f0('0x24')](removeEntity(_0x4d7a15,null))[_0x63f0('0x43')](handleError(_0x4d7a15,null));};exports['describe']=function(_0x4f2211,_0x5d3d5e){return db[_0x63f0('0x2b')][_0x63f0('0x4a')]()[_0x63f0('0x24')](respondWithResult(_0x5d3d5e,null))[_0x63f0('0x43')](handleError(_0x5d3d5e,null));}; \ No newline at end of file +var _0x5edf=['query','hasOwnProperty','nolimit','order','sort','filter','where','merge','map','VIRTUAL','options','includeAll','include','rows','params','intersection','length','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','count','limit','status','set','Content-Range','update','then','destroy','error','stack','name','send','index','WhatsappTransferReport','rawAttributes','type','key','keys','filters','model','attributes','fields'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5edf,0x188));var _0xf5ed=function(_0x295a57,_0x344d88){_0x295a57=_0x295a57-0x0;var _0x1e7d00=_0x5edf[_0x295a57];return _0x1e7d00;};'use strict';var emlformat=require(_0xf5ed('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf5ed('0x1'));var jsonpatch=require(_0xf5ed('0x2'));var rp=require(_0xf5ed('0x3'));var moment=require(_0xf5ed('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf5ed('0x5'));var util=require('util');var path=require(_0xf5ed('0x6'));var sox=require('sox');var csv=require(_0xf5ed('0x7'));var ejs=require(_0xf5ed('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf5ed('0x9'));var squel=require(_0xf5ed('0xa'));var crypto=require(_0xf5ed('0xb'));var jsforce=require(_0xf5ed('0xc'));var deskjs=require(_0xf5ed('0xd'));var toCsv=require(_0xf5ed('0x7'));var querystring=require(_0xf5ed('0xe'));var Papa=require(_0xf5ed('0xf'));var Redis=require(_0xf5ed('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf5ed('0x11'));var as=require(_0xf5ed('0x12'));var hardwareService=require(_0xf5ed('0x13'));var logger=require(_0xf5ed('0x14'))(_0xf5ed('0x15'));var utils=require(_0xf5ed('0x16'));var config=require(_0xf5ed('0x17'));var licenseUtil=require(_0xf5ed('0x18'));var db=require(_0xf5ed('0x19'))['db'];function respondWithStatusCode(_0x59d998,_0x335dfa){_0x335dfa=_0x335dfa||0xcc;return function(_0x2d3c72){if(_0x2d3c72){return _0x59d998[_0xf5ed('0x1a')](_0x335dfa);}return _0x59d998['status'](_0x335dfa)[_0xf5ed('0x1b')]();};}function respondWithResult(_0xfe1226,_0x3feae3){_0x3feae3=_0x3feae3||0xc8;return function(_0x518437){if(_0x518437){return _0xfe1226['status'](_0x3feae3)['json'](_0x518437);}};}function respondWithFilteredResult(_0x30f1fd,_0x63ce6b){return function(_0x92f950){if(_0x92f950){var _0x432997=typeof _0x63ce6b[_0xf5ed('0x1c')]==='undefined'&&typeof _0x63ce6b['limit']===_0xf5ed('0x1d');var _0x206c54=_0x92f950[_0xf5ed('0x1e')];var _0x4343f6=_0x432997?0x0:_0x63ce6b[_0xf5ed('0x1c')];var _0x3b3cb1=_0x432997?_0x92f950[_0xf5ed('0x1e')]:_0x63ce6b[_0xf5ed('0x1c')]+_0x63ce6b[_0xf5ed('0x1f')];var _0x330b93;if(_0x3b3cb1>=_0x206c54){_0x3b3cb1=_0x206c54;_0x330b93=0xc8;}else{_0x330b93=0xce;}_0x30f1fd[_0xf5ed('0x20')](_0x330b93);return _0x30f1fd[_0xf5ed('0x21')](_0xf5ed('0x22'),_0x4343f6+'-'+_0x3b3cb1+'/'+_0x206c54)['json'](_0x92f950);}return null;};}function patchUpdates(_0x27ce9e){return function(_0x39fc54){try{jsonpatch['apply'](_0x39fc54,_0x27ce9e,!![]);}catch(_0x506ffb){return BPromise['reject'](_0x506ffb);}return _0x39fc54['save']();};}function saveUpdates(_0x7716e9,_0x2afa30){return function(_0x316f69){if(_0x316f69){return _0x316f69[_0xf5ed('0x23')](_0x7716e9)[_0xf5ed('0x24')](function(_0x5af19f){return _0x5af19f;});}return null;};}function removeEntity(_0x5c27c1,_0x2b499f){return function(_0x4e0262){if(_0x4e0262){return _0x4e0262[_0xf5ed('0x25')]()['then'](function(){_0x5c27c1[_0xf5ed('0x20')](0xcc)[_0xf5ed('0x1b')]();});}};}function handleEntityNotFound(_0xd062af,_0x54cae2){return function(_0x4e8c27){if(!_0x4e8c27){_0xd062af[_0xf5ed('0x1a')](0x194);}return _0x4e8c27;};}function handleError(_0x259f55,_0x51eda1){_0x51eda1=_0x51eda1||0x1f4;return function(_0x2554a0){logger[_0xf5ed('0x26')](_0x2554a0[_0xf5ed('0x27')]);if(_0x2554a0[_0xf5ed('0x28')]){delete _0x2554a0[_0xf5ed('0x28')];}_0x259f55[_0xf5ed('0x20')](_0x51eda1)[_0xf5ed('0x29')](_0x2554a0);};}exports[_0xf5ed('0x2a')]=function(_0x3bfd6c,_0x5a7efd){var _0x35db99={},_0x3fc3e0={},_0x438c1a={'count':0x0,'rows':[]};var _0x2b0e75=_['map'](db[_0xf5ed('0x2b')][_0xf5ed('0x2c')],function(_0x203bb1){return{'name':_0x203bb1['fieldName'],'type':_0x203bb1[_0xf5ed('0x2d')][_0xf5ed('0x2e')]};});_0x3fc3e0['model']=_['map'](_0x2b0e75,_0xf5ed('0x28'));_0x3fc3e0['query']=_[_0xf5ed('0x2f')](_0x3bfd6c['query']);_0x3fc3e0[_0xf5ed('0x30')]=_['intersection'](_0x3fc3e0[_0xf5ed('0x31')],_0x3fc3e0['query']);_0x35db99[_0xf5ed('0x32')]=_['intersection'](_0x3fc3e0[_0xf5ed('0x31')],qs[_0xf5ed('0x33')](_0x3bfd6c['query'][_0xf5ed('0x33')]));_0x35db99['attributes']=_0x35db99['attributes']['length']?_0x35db99[_0xf5ed('0x32')]:_0x3fc3e0[_0xf5ed('0x31')];if(!_0x3bfd6c[_0xf5ed('0x34')][_0xf5ed('0x35')](_0xf5ed('0x36'))){_0x35db99[_0xf5ed('0x1f')]=qs[_0xf5ed('0x1f')](_0x3bfd6c[_0xf5ed('0x34')][_0xf5ed('0x1f')]);_0x35db99[_0xf5ed('0x1c')]=qs[_0xf5ed('0x1c')](_0x3bfd6c['query']['offset']);}_0x35db99[_0xf5ed('0x37')]=qs[_0xf5ed('0x38')](_0x3bfd6c[_0xf5ed('0x34')][_0xf5ed('0x38')]);_0x35db99['where']=qs[_0xf5ed('0x30')](_['pick'](_0x3bfd6c[_0xf5ed('0x34')],_0x3fc3e0['filters']),_0x2b0e75);if(_0x3bfd6c[_0xf5ed('0x34')][_0xf5ed('0x39')]){_0x35db99[_0xf5ed('0x3a')]=_[_0xf5ed('0x3b')](_0x35db99[_0xf5ed('0x3a')],{'$or':_[_0xf5ed('0x3c')](_0x2b0e75,function(_0x10f5f6){if(_0x10f5f6[_0xf5ed('0x2d')]!==_0xf5ed('0x3d')){var _0x483cb4={};_0x483cb4[_0x10f5f6[_0xf5ed('0x28')]]={'$like':'%'+_0x3bfd6c['query'][_0xf5ed('0x39')]+'%'};return _0x483cb4;}})});}_0x35db99=_[_0xf5ed('0x3b')]({},_0x35db99,_0x3bfd6c[_0xf5ed('0x3e')]);var _0x3e05ee={'where':_0x35db99[_0xf5ed('0x3a')]};return db[_0xf5ed('0x2b')][_0xf5ed('0x1e')](_0x3e05ee)[_0xf5ed('0x24')](function(_0x591c17){_0x438c1a[_0xf5ed('0x1e')]=_0x591c17;if(_0x3bfd6c['query'][_0xf5ed('0x3f')]){_0x35db99[_0xf5ed('0x40')]=[{'all':!![]}];}return db[_0xf5ed('0x2b')]['findAll'](_0x35db99);})['then'](function(_0x29c0dc){_0x438c1a[_0xf5ed('0x41')]=_0x29c0dc;return _0x438c1a;})[_0xf5ed('0x24')](respondWithFilteredResult(_0x5a7efd,_0x35db99))['catch'](handleError(_0x5a7efd,null));};exports['show']=function(_0x3d51fd,_0x5b1a27){var _0x11d6c7={'raw':!![],'where':{'id':_0x3d51fd[_0xf5ed('0x42')]['id']}},_0x156b79={};_0x156b79[_0xf5ed('0x31')]=_[_0xf5ed('0x2f')](db[_0xf5ed('0x2b')][_0xf5ed('0x2c')]);_0x156b79[_0xf5ed('0x34')]=_['keys'](_0x3d51fd[_0xf5ed('0x34')]);_0x156b79[_0xf5ed('0x30')]=_[_0xf5ed('0x43')](_0x156b79[_0xf5ed('0x31')],_0x156b79['query']);_0x11d6c7[_0xf5ed('0x32')]=_[_0xf5ed('0x43')](_0x156b79[_0xf5ed('0x31')],qs[_0xf5ed('0x33')](_0x3d51fd['query']['fields']));_0x11d6c7['attributes']=_0x11d6c7[_0xf5ed('0x32')][_0xf5ed('0x44')]?_0x11d6c7[_0xf5ed('0x32')]:_0x156b79['model'];if(_0x3d51fd['query'][_0xf5ed('0x3f')]){_0x11d6c7[_0xf5ed('0x40')]=[{'all':!![]}];}_0x11d6c7=_[_0xf5ed('0x3b')]({},_0x11d6c7,_0x3d51fd[_0xf5ed('0x3e')]);return db[_0xf5ed('0x2b')][_0xf5ed('0x45')](_0x11d6c7)[_0xf5ed('0x24')](handleEntityNotFound(_0x5b1a27,null))['then'](respondWithResult(_0x5b1a27,null))[_0xf5ed('0x46')](handleError(_0x5b1a27,null));};exports[_0xf5ed('0x47')]=function(_0x109a21,_0x5b0a65){return db[_0xf5ed('0x2b')][_0xf5ed('0x47')](_0x109a21[_0xf5ed('0x48')],{})[_0xf5ed('0x24')](respondWithResult(_0x5b0a65,0xc9))['catch'](handleError(_0x5b0a65,null));};exports['update']=function(_0x10cb2c,_0x31c584){if(_0x10cb2c['body']['id']){delete _0x10cb2c[_0xf5ed('0x48')]['id'];}return db[_0xf5ed('0x2b')][_0xf5ed('0x45')]({'where':{'id':_0x10cb2c[_0xf5ed('0x42')]['id']}})[_0xf5ed('0x24')](handleEntityNotFound(_0x31c584,null))[_0xf5ed('0x24')](saveUpdates(_0x10cb2c[_0xf5ed('0x48')],null))[_0xf5ed('0x24')](respondWithResult(_0x31c584,null))[_0xf5ed('0x46')](handleError(_0x31c584,null));};exports[_0xf5ed('0x25')]=function(_0x3aae68,_0x440990){return db[_0xf5ed('0x2b')][_0xf5ed('0x45')]({'where':{'id':_0x3aae68[_0xf5ed('0x42')]['id']}})[_0xf5ed('0x24')](handleEntityNotFound(_0x440990,null))[_0xf5ed('0x24')](removeEntity(_0x440990,null))[_0xf5ed('0x46')](handleError(_0x440990,null));};exports[_0xf5ed('0x49')]=function(_0x38ea97,_0x5c6c5d){return db['WhatsappTransferReport'][_0xf5ed('0x49')]()[_0xf5ed('0x24')](respondWithResult(_0x5c6c5d,null))[_0xf5ed('0x46')](handleError(_0x5c6c5d,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 92e08e3..3e3b8e0 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 _0x58b0=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','../../config/logger'];(function(_0x4b2c51,_0x2d1934){var _0x2acb07=function(_0x103b9b){while(--_0x103b9b){_0x4b2c51['push'](_0x4b2c51['shift']());}};_0x2acb07(++_0x2d1934);}(_0x58b0,0xe8));var _0x058b=function(_0x3e4a61,_0x59a7c0){_0x3e4a61=_0x3e4a61-0x0;var _0x2361b5=_0x58b0[_0x3e4a61];return _0x2361b5;};'use strict';var _=require(_0x058b('0x0'));var util=require('util');var logger=require(_0x058b('0x1'))(_0x058b('0x2'));var moment=require(_0x058b('0x3'));var BPromise=require(_0x058b('0x4'));var rp=require(_0x058b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x058b('0x6'));var config=require(_0x058b('0x7'));var attributes=require(_0x058b('0x8'));module[_0x058b('0x9')]=function(_0x41f4ba,_0x12f883){return _0x41f4ba['define'](_0x058b('0xa'),attributes,{'tableName':_0x058b('0xb'),'paranoid':![],'indexes':[{'name':_0x058b('0xc'),'fields':[_0x058b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6682=['WhatsappTransferReport','report_whatsapp_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','rimraf','./whatsappTransferReport.attributes','exports','define'];(function(_0x4b6122,_0x26aaf6){var _0x204662=function(_0xa84a1b){while(--_0xa84a1b){_0x4b6122['push'](_0x4b6122['shift']());}};_0x204662(++_0x26aaf6);}(_0x6682,0x117));var _0x2668=function(_0x3ddb41,_0x23302f){_0x3ddb41=_0x3ddb41-0x0;var _0x2d57b5=_0x6682[_0x3ddb41];return _0x2d57b5;};'use strict';var _=require('lodash');var util=require(_0x2668('0x0'));var logger=require(_0x2668('0x1'))(_0x2668('0x2'));var moment=require(_0x2668('0x3'));var BPromise=require(_0x2668('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2668('0x5'));var config=require('../../config/environment');var attributes=require(_0x2668('0x6'));module[_0x2668('0x7')]=function(_0x9a5175,_0x10222b){return _0x9a5175[_0x2668('0x8')](_0x2668('0x9'),attributes,{'tableName':_0x2668('0xa'),'paranoid':![],'indexes':[{'name':_0x2668('0xb'),'fields':[_0x2668('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index c3afdec..f7c9065 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 _0xe99c=['client','http','request','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x2daa46,_0x3ff093){var _0x3f35f8=function(_0x3fa206){while(--_0x3fa206){_0x2daa46['push'](_0x2daa46['shift']());}};_0x3f35f8(++_0x3ff093);}(_0xe99c,0xd3));var _0xce99=function(_0x3d5fe4,_0x30439e){_0x3d5fe4=_0x3d5fe4-0x0;var _0x2eae70=_0xe99c[_0x3d5fe4];return _0x2eae70;};'use strict';var _=require(_0xce99('0x0'));var util=require(_0xce99('0x1'));var moment=require(_0xce99('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xce99('0x3'));var db=require(_0xce99('0x4'))['db'];var utils=require(_0xce99('0x5'));var logger=require(_0xce99('0x6'))('rpc');var config=require(_0xce99('0x7'));var jayson=require(_0xce99('0x8'));var client=jayson[_0xce99('0x9')][_0xce99('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1eec1d,_0xbc7a98,_0x286654){return new BPromise(function(_0x2091ca,_0x17ff19){return client[_0xce99('0xb')](_0x1eec1d,_0x286654)['then'](function(_0x472f2e){logger[_0xce99('0xc')](_0xce99('0xd'),_0xbc7a98,_0xce99('0xe'));logger[_0xce99('0xf')](_0xce99('0x10'),_0xbc7a98,'request\x20sent',JSON[_0xce99('0x11')](_0x472f2e));if(_0x472f2e[_0xce99('0x12')]){if(_0x472f2e[_0xce99('0x12')][_0xce99('0x13')]===0x1f4){logger[_0xce99('0x12')](_0xce99('0xd'),_0xbc7a98,_0x472f2e[_0xce99('0x12')][_0xce99('0x14')]);return _0x17ff19(_0x472f2e[_0xce99('0x12')][_0xce99('0x14')]);}logger[_0xce99('0x12')]('WhatsappTransferReport,\x20%s,\x20%s',_0xbc7a98,_0x472f2e['error'][_0xce99('0x14')]);return _0x2091ca(_0x472f2e[_0xce99('0x12')]['message']);}else{logger[_0xce99('0xc')](_0xce99('0xd'),_0xbc7a98,_0xce99('0xe'));_0x2091ca(_0x472f2e['result'][_0xce99('0x14')]);}})[_0xce99('0x15')](function(_0x62b3ca){logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0xbc7a98,_0x62b3ca);_0x17ff19(_0x62b3ca);});});} \ No newline at end of file +var _0x008b=['catch','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x008b,0x1ef));var _0xb008=function(_0x456b57,_0x58691a){_0x456b57=_0x456b57-0x0;var _0x18f49f=_0x008b[_0x456b57];return _0x18f49f;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb008('0x0'));var fs=require('fs');var Redis=require(_0xb008('0x1'));var db=require(_0xb008('0x2'))['db'];var utils=require(_0xb008('0x3'));var logger=require(_0xb008('0x4'))('rpc');var config=require(_0xb008('0x5'));var jayson=require(_0xb008('0x6'));var client=jayson[_0xb008('0x7')][_0xb008('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3954dc,_0x5360f0,_0x580eea){return new BPromise(function(_0x3c49fc,_0x4eb8a9){return client[_0xb008('0x9')](_0x3954dc,_0x580eea)[_0xb008('0xa')](function(_0x5e6ab0){logger[_0xb008('0xb')](_0xb008('0xc'),_0x5360f0,_0xb008('0xd'));logger['debug'](_0xb008('0xe'),_0x5360f0,_0xb008('0xd'),JSON['stringify'](_0x5e6ab0));if(_0x5e6ab0['error']){if(_0x5e6ab0[_0xb008('0xf')][_0xb008('0x10')]===0x1f4){logger[_0xb008('0xf')](_0xb008('0xc'),_0x5360f0,_0x5e6ab0[_0xb008('0xf')]['message']);return _0x4eb8a9(_0x5e6ab0['error'][_0xb008('0x11')]);}logger[_0xb008('0xf')](_0xb008('0xc'),_0x5360f0,_0x5e6ab0['error']['message']);return _0x3c49fc(_0x5e6ab0[_0xb008('0xf')][_0xb008('0x11')]);}else{logger[_0xb008('0xb')](_0xb008('0xc'),_0x5360f0,_0xb008('0xd'));_0x3c49fc(_0x5e6ab0['result'][_0xb008('0x11')]);}})[_0xb008('0x12')](function(_0x36acbf){logger['error'](_0xb008('0xc'),_0x5360f0,_0x36acbf);_0x4eb8a9(_0x36acbf);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index f53f113..136ccdc 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x88b0=['filter','number','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','join','Offline\x20apps:','status','online','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','lodash','./mysqldb','./rpc','./config/environment','./config/logger','app','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','info','start'];(function(_0x4702ee,_0xaf6a45){var _0x62ca7d=function(_0x5b3af7){while(--_0x5b3af7){_0x4702ee['push'](_0x4702ee['shift']());}};_0x62ca7d(++_0xaf6a45);}(_0x88b0,0x1cb));var _0x088b=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x88b0[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x088b('0x0'));var db=require(_0x088b('0x1'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require('./config/license');var rpc=require(_0x088b('0x2'));var config=require(_0x088b('0x3'));var logger=require(_0x088b('0x4'))(_0x088b('0x5'));var pm2=require('./config/pm2');var pm2Config=require(_0x088b('0x6'));var schedule=require(_0x088b('0x7'));var chat=require(_0x088b('0x8'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require('./config/schedule/transcribe');var provider=require(_0x088b('0x9'));function main(){return db[_0x088b('0xa')][_0x088b('0xb')]()[_0x088b('0xc')](function(){if(config[_0x088b('0xd')]){return seedDb[_0x088b('0xe')]();}})[_0x088b('0xc')](function(){return checkLicense['default']();})[_0x088b('0xc')](function(){return rpc['listen']();})[_0x088b('0xc')](function(_0x4c50a6){logger[_0x088b('0xf')](_0x4c50a6);return chat[_0x088b('0x10')]();})['then'](function(){return whatsapp['start']();})[_0x088b('0xc')](function(){return schedule[_0x088b('0x10')]();})[_0x088b('0xc')](function(){return transcribe['start']();})[_0x088b('0xc')](function(){return provider[_0x088b('0x10')]();})[_0x088b('0xc')](function(_0x4fa81a){logger[_0x088b('0xf')](_0x4fa81a);return pm2[_0x088b('0x10')](pm2Config);})[_0x088b('0xc')](function(_0xf6bd53){var _0x1ec5e5=_0xf6bd53[_0x088b('0x11')](function(_0x462392){return typeof _0x462392['exitCode']===_0x088b('0x12')&&_0x462392[_0x088b('0x13')]>=0x0;});if(_0x1ec5e5[_0x088b('0x14')]>0x0){throw new Error(_0x1ec5e5[_0x088b('0x14')]+_0x088b('0x15')+_[_0x088b('0x16')](_0x1ec5e5,function(_0x54a27e){return'\x22'+_0x54a27e[_0x088b('0x17')][_0x088b('0x18')]+'\x22';}));}logger[_0x088b('0xf')](_0x088b('0x19'),_[_0x088b('0x16')](_['filter'](_0xf6bd53,{'status':'online'}),_0x088b('0x18'))[_0x088b('0x1a')]());logger[_0x088b('0xf')](_0x088b('0x1b'),_[_0x088b('0x16')](_[_0x088b('0x11')](_0xf6bd53,function(_0x565220){return _0x565220[_0x088b('0x1c')]!==_0x088b('0x1d');}),_0x088b('0x18'))['join']()||'None');console[_0x088b('0x1e')](_0x088b('0x1f'));})[_0x088b('0x20')](function(_0x556006){console[_0x088b('0x1e')](_0x088b('0x21'),_0x556006);logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x556006);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x4148=['join','status','None','log','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule/chat','./config/schedule/transcribe','sync','then','seedDB','default','listen','info','start','filter','number','exitCode','length','map','pm2_env','name','online'];(function(_0x394e76,_0x18186d){var _0x2f3569=function(_0x280e34){while(--_0x280e34){_0x394e76['push'](_0x394e76['shift']());}};_0x2f3569(++_0x18186d);}(_0x4148,0xc6));var _0x8414=function(_0x166f43,_0x3bc8cb){_0x166f43=_0x166f43-0x0;var _0x43ae50=_0x4148[_0x166f43];return _0x43ae50;};'use strict';var _=require(_0x8414('0x0'));var db=require(_0x8414('0x1'))['db'];var seedDb=require(_0x8414('0x2'));var checkLicense=require(_0x8414('0x3'));var rpc=require(_0x8414('0x4'));var config=require('./config/environment');var logger=require(_0x8414('0x5'))(_0x8414('0x6'));var pm2=require(_0x8414('0x7'));var pm2Config=require(_0x8414('0x8'));var schedule=require('./config/schedule');var chat=require(_0x8414('0x9'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x8414('0xa'));var provider=require('./config/schedule/cloud-provider');function main(){return db['sequelize'][_0x8414('0xb')]()[_0x8414('0xc')](function(){if(config[_0x8414('0xd')]){return seedDb[_0x8414('0xe')]();}})[_0x8414('0xc')](function(){return checkLicense[_0x8414('0xe')]();})[_0x8414('0xc')](function(){return rpc[_0x8414('0xf')]();})[_0x8414('0xc')](function(_0x28d8b4){logger[_0x8414('0x10')](_0x28d8b4);return chat['start']();})[_0x8414('0xc')](function(){return whatsapp['start']();})[_0x8414('0xc')](function(){return schedule[_0x8414('0x11')]();})[_0x8414('0xc')](function(){return transcribe[_0x8414('0x11')]();})['then'](function(){return provider[_0x8414('0x11')]();})['then'](function(_0x414a7c){logger[_0x8414('0x10')](_0x414a7c);return pm2[_0x8414('0x11')](pm2Config);})['then'](function(_0x2875ef){var _0x158d6c=_0x2875ef[_0x8414('0x12')](function(_0x4a8b9b){return typeof _0x4a8b9b['exitCode']===_0x8414('0x13')&&_0x4a8b9b[_0x8414('0x14')]>=0x0;});if(_0x158d6c[_0x8414('0x15')]>0x0){throw new Error(_0x158d6c[_0x8414('0x15')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0x8414('0x16')](_0x158d6c,function(_0x350772){return'\x22'+_0x350772[_0x8414('0x17')][_0x8414('0x18')]+'\x22';}));}logger['info']('Online\x20apps:',_[_0x8414('0x16')](_['filter'](_0x2875ef,{'status':_0x8414('0x19')}),_0x8414('0x18'))[_0x8414('0x1a')]());logger[_0x8414('0x10')]('Offline\x20apps:',_[_0x8414('0x16')](_[_0x8414('0x12')](_0x2875ef,function(_0x155c34){return _0x155c34[_0x8414('0x1b')]!==_0x8414('0x19');}),_0x8414('0x18'))[_0x8414('0x1a')]()||_0x8414('0x1c'));console['log']('App\x20Ready!');})['catch'](function(_0x1d2b19){console[_0x8414('0x1d')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x1d2b19);logger[_0x8414('0x1e')](_0x8414('0x1f'),_0x1d2b19);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index fc86d6d..8e6be5a 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 _0x9c44=['showWebBar','lastLoginAt','crudPermissions','allowmessenger','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','settingsEnabled','wssPort','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','user','ChatInteraction','findOne','params','then','status','disposition','unmanaged','json','Unmanaged.','catch','isAuthenticated','headers','authorization','startsWith','Basic','authenticate','pass','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','User','find','sub','Setting','allowedLoginAttempts','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','add','minutes','use','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','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\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','unshift','encryptString','sign','options','promisify','toString','hex','floor','now','HS512','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','crypto','util','moment','secrets','session','role','name','internal','email','userpic','voicePause','chatPause','faxPause','smsPause'];(function(_0x5a187b,_0x1f64fe){var _0x14d601=function(_0x45fd29){while(--_0x45fd29){_0x5a187b['push'](_0x5a187b['shift']());}};_0x14d601(++_0x1f64fe);}(_0x9c44,0x178));var _0x49c4=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x9c44[_0x68c979];return _0x4f0001;};'use strict';var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var hardwareConf=require(_0x49c4('0x0'));var licenseUtil=require(_0x49c4('0x1'));var encryptor=require(_0x49c4('0x2'));var _=require(_0x49c4('0x3'));var jwt=require(_0x49c4('0x4'));var expressJwt=require(_0x49c4('0x5'));var compose=require('composable-middleware');var basicAuth=require('basic-auth');var crypto=require(_0x49c4('0x6'));var BPromise=require('bluebird');var util=require(_0x49c4('0x7'));var moment=require(_0x49c4('0x8'));var validateJwt=expressJwt({'secret':config[_0x49c4('0x9')][_0x49c4('0xa')]});var userAttributes=['id',_0x49c4('0xb'),'fullname',_0x49c4('0xc'),_0x49c4('0xd'),_0x49c4('0xe'),_0x49c4('0xf'),'permissions','md5secret',_0x49c4('0x10'),_0x49c4('0x11'),'mailPause',_0x49c4('0x12'),_0x49c4('0x13'),'openchannelPause','pauseType',_0x49c4('0x14'),_0x49c4('0x15'),'lastPauseAt',_0x49c4('0x16'),_0x49c4('0x17'),'passwordResetAt',_0x49c4('0x18'),_0x49c4('0x19'),_0x49c4('0x1a'),_0x49c4('0x1b'),_0x49c4('0x1c'),_0x49c4('0x1d'),_0x49c4('0x1e'),_0x49c4('0x1f'),'phoneBarPrefixRequired',_0x49c4('0x20'),_0x49c4('0x21'),_0x49c4('0x22'),_0x49c4('0x23'),_0x49c4('0x24'),'privacyEnabled',_0x49c4('0x25'),_0x49c4('0x26'),'downloadVoiceRecordings','downloadOmnichannelInteractions',_0x49c4('0x27'),_0x49c4('0x28'),_0x49c4('0x29'),'chatAutoanswer',_0x49c4('0x2a'),'emailAutoanswer',_0x49c4('0x2b'),_0x49c4('0x2c'),_0x49c4('0x2d'),_0x49c4('0x2e'),_0x49c4('0x2f'),_0x49c4('0x30'),_0x49c4('0x31'),_0x49c4('0x32'),_0x49c4('0x33')];exports['isChatInteractionAuthorized']=function(){return this['isAuthenticated'](!![])['use'](function(_0x1c99b1,_0x4f0b62,_0x592bb8){if(_0x1c99b1[_0x49c4('0x34')]){_0x592bb8();}else{return db[_0x49c4('0x35')][_0x49c4('0x36')]({'where':{'id':_0x1c99b1[_0x49c4('0x37')]['id']},'attributes':['id','closed','disposition'],'raw':!![]})[_0x49c4('0x38')](function(_0x9cb797){if(_0x9cb797&&_0x9cb797['closed']){return _0x4f0b62[_0x49c4('0x39')](_0x9cb797[_0x49c4('0x3a')]===_0x49c4('0x3b')?0x195:0x193)[_0x49c4('0x3c')]({'message':_0x9cb797['disposition']==='unmanaged'?_0x49c4('0x3d'):'Forbidden.'});}else{_0x592bb8();}})[_0x49c4('0x3e')](function(_0x3852b2){_0x592bb8(_0x3852b2);});}});};exports[_0x49c4('0x3f')]=function isAuthenticated(_0x372a47){return compose()['use'](function(_0x889909,_0x2b2793,_0x46e04d){var _0x4f28a2;if(_0x889909[_0x49c4('0x40')][_0x49c4('0x41')]){if(_[_0x49c4('0x42')](_0x889909[_0x49c4('0x40')][_0x49c4('0x41')],_0x49c4('0x43'))){var _0x46f7ea=basicAuth(_0x889909);db['User']['find']({'where':{'name':_0x46f7ea['name']}})[_0x49c4('0x38')](function(_0x7ee704){if(!_0x7ee704||!_0x7ee704[_0x49c4('0x44')](_0x46f7ea[_0x49c4('0x45')])){return _0x2b2793[_0x49c4('0x39')](0x191)['json']({'message':_0x49c4('0x46')});}_0x889909[_0x49c4('0x34')]={'id':_0x7ee704['id']};_0x46e04d();})[_0x49c4('0x3e')](function(_0x24bba9){_0x46e04d(_0x24bba9);});}else if(_['startsWith'](_0x889909['headers'][_0x49c4('0x41')],_0x49c4('0x47'))){validateJwt(_0x889909,_0x2b2793,_0x46e04d);}else{if(_0x372a47){_0x46e04d();}else{return _0x2b2793[_0x49c4('0x39')](0x193)[_0x49c4('0x3c')]({'message':_0x49c4('0x48')});}}}else if(_0x889909['query'][_0x49c4('0x49')]){try{var _0x84c621={'audience':hardwareConf[_0x49c4('0x4a')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x889909['query'][_0x49c4('0x49')],_0x84c621)[_0x49c4('0x38')](function(_0x3bec0a){return db[_0x49c4('0x4b')][_0x49c4('0x4c')]({'where':{'id':_0x3bec0a[_0x49c4('0x4d')]}})[_0x49c4('0x38')](function(_0x27ef5f){_0x4f28a2=_0x27ef5f;return db[_0x49c4('0x4e')]['findOne']({'where':{'id':0x1},'attributes':[_0x49c4('0x4f'),'blockDuration'],'raw':!![]});})[_0x49c4('0x38')](function(_0x349791){if(!_0x4f28a2||!_[_0x49c4('0x50')](_0x4f28a2[_0x49c4('0x51')],_0x3bec0a['nonce'])){return _0x2b2793[_0x49c4('0x39')](0x191)[_0x49c4('0x3c')]({'message':_0x49c4('0x52')});}if(_0x4f28a2['disabled']){return _0x2b2793[_0x49c4('0x39')](0x191)[_0x49c4('0x3c')]({'message':_0x49c4('0x53')});}if(_0x4f28a2[_0x49c4('0x54')]){if(_0x349791[_0x49c4('0x55')]>0x0){if(moment(_0x4f28a2[_0x49c4('0x56')])[_0x49c4('0x57')](_0x349791[_0x49c4('0x55')],_0x49c4('0x58'))>moment()){return _0x2b2793[_0x49c4('0x39')](0x191)[_0x49c4('0x3c')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x2b2793[_0x49c4('0x39')](0x191)[_0x49c4('0x3c')]({'message':_0x49c4('0x53')});}}_0x889909[_0x49c4('0x34')]={'id':_0x4f28a2['id']};_0x46e04d();});})[_0x49c4('0x3e')](function(){return _0x2b2793[_0x49c4('0x39')](0x191)[_0x49c4('0x3c')]({'message':_0x49c4('0x53')});});}catch(_0x248c0a){_0x46e04d(_0x248c0a);}}else if(_0x372a47){_0x46e04d();}else{return _0x2b2793[_0x49c4('0x39')](0x193)[_0x49c4('0x3c')]({'message':_0x49c4('0x48')});}})[_0x49c4('0x59')](function(_0x4e38bc,_0x212366,_0x49829e){if(_0x4e38bc[_0x49c4('0x34')]){db[_0x49c4('0x4b')][_0x49c4('0x4c')]({'where':{'id':_0x4e38bc[_0x49c4('0x34')]['id']},'attributes':userAttributes})[_0x49c4('0x38')](function(_0x281b83){if(!_0x281b83){return _0x212366['status'](0x194)['json']({'message':_0x49c4('0x5a')});}_0x4e38bc[_0x49c4('0x34')]=_0x281b83;_0x49829e();})[_0x49c4('0x3e')](function(_0x117151){_0x49829e(_0x117151);});}else if(_0x372a47){_0x49829e();}else{return _0x212366['status'](0x194)[_0x49c4('0x3c')]({'message':_0x49c4('0x5b')});}});};exports[_0x49c4('0x5c')]=function canUpdate(){return compose()[_0x49c4('0x59')](function(_0x81a674,_0x3bde49,_0x1a9593){return licenseUtil[_0x49c4('0x5d')]()[_0x49c4('0x38')](function(_0x5640d3){if(_0x5640d3[_0x49c4('0x5e')]){_0x1a9593();}else{return _0x3bde49['status'](0x193)[_0x49c4('0x3c')]({'message':_0x49c4('0x5f')});}})[_0x49c4('0x3e')](function(_0x258abe){_0x1a9593(_0x258abe);});});};exports[_0x49c4('0x60')]=function isWebrtcLicence(){return compose()['use'](function(_0x592e8e,_0x15b674,_0x384862){return licenseUtil[_0x49c4('0x5d')]()[_0x49c4('0x38')](function(_0x5d4790){if(_0x5d4790[_0x49c4('0x61')]){_0x384862();}else{return _0x15b674['status'](0x193)[_0x49c4('0x3c')]({'message':'Forbidden'});}})[_0x49c4('0x3e')](function(_0x906d3){_0x384862(_0x906d3);});});};exports[_0x49c4('0x62')]=function(_0x27adfe,_0x2d8087,_0x30bea5){_0x27adfe[_0x49c4('0x62')]=!![];return _0x30bea5();};exports['signToken']=function signToken(_0x3b731f){return signJwt(_0x3b731f);};exports[_0x49c4('0x63')]=function(_0x4a5c34,_0x1e1ac4){if(!_0x4a5c34[_0x49c4('0x34')]){return _0x1e1ac4[_0x49c4('0x39')](0x194)[_0x49c4('0x3c')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x5d8bf0={'payload':{'id':_0x4a5c34[_0x49c4('0x34')]['id'],'role':_0x4a5c34['user'][_0x49c4('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x5d8bf0)[_0x49c4('0x38')](function(_0x3811b2){_0x1e1ac4[_0x49c4('0x64')](_0x49c4('0x65'),_0x3811b2);_0x1e1ac4[_0x49c4('0x66')](_0x49c4('0x67'));})['catch'](function(_0x1f26c2){return _0x1e1ac4[_0x49c4('0x39')](0x1f4)[_0x49c4('0x68')](_0x1f26c2);});};exports[_0x49c4('0x69')]=function(_0x17ef75){if(_[_0x49c4('0x6a')](_0x17ef75[_0x49c4('0x51')])||_[_0x49c4('0x6a')](_0x17ef75[_0x49c4('0x6b')])){return null;}else{return createJwt(_0x17ef75);}};exports[_0x49c4('0x6c')]=function(_0x5b822f){_0x5b822f['apiKeyNonce']=generateNonce();_0x5b822f[_0x49c4('0x6b')]=generateIssuedAt();return createJwt(_0x5b822f);};exports[_0x49c4('0x6d')]=function(_0x527e74,_0x59a8bc){var _0x77163d=_0x527e74['query']['apikey'];if(_0x77163d){var _0x3208c2={'nonce':_0x59a8bc[_0x49c4('0x51')],'iat':_0x59a8bc[_0x49c4('0x6b')],'audience':hardwareConf[_0x49c4('0x4a')](),'issuer':hardwareConf[_0x49c4('0x4a')]()};return verifyJwt(_0x77163d,_0x3208c2)[_0x49c4('0x38')](function(){return generateApiKey(_0x59a8bc);});}else{throw{'message':_0x49c4('0x6e')};}};exports['validatePasswordPattern']=function(_0x859dde){var _0xcc6a2b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xcc6a2b[_0x49c4('0x6f')](_0x859dde))throw new db[(_0x49c4('0x70'))][(_0x49c4('0x71'))](_0x49c4('0x72'));return;};exports['validatePasswordHistory']=function(_0x5c7ddd,_0x1ef0c1,_0x155c43){var _0x2a6308=encryptor[_0x49c4('0x73')](_0x1ef0c1)[_0x49c4('0x74')](',');for(var _0x6b2592=0x0;_0x6b2592<_0x155c43;_0x6b2592++){if(!_0x2a6308[_0x6b2592])break;if(_0x5c7ddd[_0x49c4('0x75')]()===_0x2a6308[_0x6b2592]['toLowerCase']()){var _0x45d715=util[_0x49c4('0x76')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x155c43);if(_0x155c43===0x1){_0x45d715=_0x49c4('0x77');}throw new db['Sequelize'][(_0x49c4('0x71'))](_0x45d715);}}return;};exports[_0x49c4('0x78')]=function(_0x9eaa84,_0x2fe89a){var _0x845f7e=_0x2fe89a?encryptor[_0x49c4('0x73')](_0x2fe89a)[_0x49c4('0x74')](','):[];if(_0x845f7e[_0x49c4('0x79')]===0x5){_0x845f7e['splice'](-0x1,0x1);}_0x845f7e[_0x49c4('0x7a')](_0x9eaa84);return encryptor[_0x49c4('0x7b')](_0x845f7e['join'](','));};function signJwt(_0x10dec7){var _0x299e74=BPromise['promisify'](jwt[_0x49c4('0x7c')],{'context':jwt});var _0x42e0e6=_0x10dec7['secret']||config['secrets']['session'];return new BPromise(function(_0x513879,_0xc43386){_0x299e74(_0x10dec7['payload'],_0x42e0e6,_0x10dec7[_0x49c4('0x7d')])[_0x49c4('0x38')](function(_0x515240){_0x513879(_0x515240);})[_0x49c4('0x3e')](function(_0xdb2b33){_0xc43386(_0xdb2b33);});});}function verifyJwt(_0x5ac9f0,_0x34272f,_0x3dcf4c){var _0x167e84=BPromise[_0x49c4('0x7e')](jwt['verify'],{'context':jwt});var _0x431921=_0x3dcf4c||config[_0x49c4('0x9')][_0x49c4('0xa')];return new BPromise(function(_0x20e97d,_0x5d3375){_0x167e84(_0x5ac9f0,_0x431921,_0x34272f)[_0x49c4('0x38')](function(_0x4a93bc){_0x20e97d(_0x4a93bc);})['catch'](function(_0x58259d){_0x5d3375(_0x58259d);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x49c4('0x7f')](_0x49c4('0x80'));}function generateIssuedAt(){return Math[_0x49c4('0x81')](Date[_0x49c4('0x82')]()/0x3e8)['toString']();}function createJwt(_0x4daa6d){var _0x340523={'payload':{'iat':_0x4daa6d[_0x49c4('0x6b')],'nonce':_0x4daa6d[_0x49c4('0x51')]},'options':{'algorithm':_0x49c4('0x83'),'subject':_0x4daa6d['id'][_0x49c4('0x7f')](),'issuer':hardwareConf[_0x49c4('0x4a')](),'audience':hardwareConf[_0x49c4('0x4a')]()}};return signJwt(_0x340523)[_0x49c4('0x38')](function(_0x4d49e0){return{'iat':_0x4daa6d[_0x49c4('0x6b')],'nonce':_0x4daa6d['apiKeyNonce'],'token':_0x4d49e0};});} \ No newline at end of file +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(_0x2f222f,_0x3f6c61){_0x2f222f=_0x2f222f-0x0;var _0x431b7d=_0x9bde[_0x2f222f];return _0x431b7d;};'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 diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index eb44797..0f31f98 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 _0x4a1c=['keys','startsWith','cf_','findOne','slice','all','length','fieldType','type','map','lodash','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','fields','filter','user','clause','tags','skip','ids','tag','countFilteredContacts','count','buildContactsQuery','getFilteredContacts','rows','catch','describe','CmContact'];(function(_0x45dae7,_0x3834b0){var _0x210c29=function(_0x24a83e){while(--_0x24a83e){_0x45dae7['push'](_0x45dae7['shift']());}};_0x210c29(++_0x3834b0);}(_0x4a1c,0xe8));var _0xc4a1=function(_0x2f09f7,_0x461707){_0x2f09f7=_0x2f09f7-0x0;var _0x1b266c=_0x4a1c[_0x2f09f7];return _0x1b266c;};'use strict';var _=require(_0xc4a1('0x0'));var sqlUtils=require(_0xc4a1('0x1'));var db=require(_0xc4a1('0x2'))['db'];exports[_0xc4a1('0x3')]=function(_0x402d07,_0x593ae0,_0x6af86d,_0x12cd3e){var _0x1989aa={'count':0x0,'rows':[]};var _0x1acd3a=sqlUtils[_0xc4a1('0x4')](_0x593ae0,_0x402d07);if(_0x1acd3a){return Promise[_0xc4a1('0x5')](_0x1989aa);}var _0xacb2d4=sqlUtils['getContactsSubquery']();var _0x4f81b1={};var _0x123bf5=![];var _0x2a8867=![];return Promise[_0xc4a1('0x5')]()[_0xc4a1('0x6')](function(){if(_0x402d07[_0xc4a1('0x7')]){return sqlUtils[_0xc4a1('0x8')](_0x402d07['search'],_0x12cd3e);}else{return sqlUtils[_0xc4a1('0x9')](_0x402d07,_0x12cd3e);}})['then'](function(_0x48df60){_0xacb2d4['where'](_0x48df60['default']);_0xacb2d4[_0xc4a1('0xa')](_0x48df60[_0xc4a1('0xb')]);_0xacb2d4[_0xc4a1('0xa')](_0x48df60[_0xc4a1('0xc')]);_0xacb2d4[_0xc4a1('0xa')](_0x48df60[_0xc4a1('0xd')][_0xc4a1('0xe')]);_0x4f81b1=_0x48df60[_0xc4a1('0xf')];_0x2a8867=_0x48df60['user'][_0xc4a1('0x10')];return sqlUtils['checkListsRestrictions'](_0x593ae0,_0x402d07,_0x2a8867);})[_0xc4a1('0x6')](function(_0xa78ed1){_0xacb2d4[_0xc4a1('0xa')](_0xa78ed1);var _0x342afb=_0x402d07[_0xc4a1('0x7')]?_0x4f81b1[_0xc4a1('0x11')]:_0x402d07[_0xc4a1('0x12')];_0x123bf5=_0x342afb?!![]:![];return sqlUtils[_0xc4a1('0x13')](_0xacb2d4,_0x342afb);})[_0xc4a1('0x6')](function(_0xd1ff85){_0x1989aa[_0xc4a1('0x14')]=_0xd1ff85;if(_0x1989aa[_0xc4a1('0x14')]===0x0){return;}if(_0x402d07['User']){_0x2a8867=!![];}return sqlUtils[_0xc4a1('0x15')](_0xacb2d4,_0x402d07[_0xc4a1('0xb')],_0x6af86d,_0x123bf5,_0x4f81b1[_0xc4a1('0xe')],_0x2a8867);})['then'](function(_0x52a18c){if(!_0x52a18c){return[];}return sqlUtils[_0xc4a1('0x16')](_0x52a18c,_0x402d07,_0x6af86d);})['then'](function(_0x25ed69){_0x1989aa[_0xc4a1('0x17')]=_0x25ed69;return _0x1989aa;})[_0xc4a1('0x18')](function(_0x23bbc5){throw _0x23bbc5;});};exports[_0xc4a1('0x19')]=function(){var _0x6f0a30={};var _0x45c36c=[];return db[_0xc4a1('0x1a')]['describe']()[_0xc4a1('0x6')](function(_0x4a6317){_0x6f0a30=_0x4a6317;var _0x45e6d8=Object[_0xc4a1('0x1b')](_0x6f0a30)[_0xc4a1('0xc')](function(_0x5d6171){return _[_0xc4a1('0x1c')](_0x5d6171,_0xc4a1('0x1d'))?_0x5d6171:undefined;});var _0x52f8be=_0x45e6d8['map'](function(_0x8d5bd){return db['CmCustomField'][_0xc4a1('0x1e')]({'where':{'id':_0x8d5bd[_0xc4a1('0x1f')](0x3)},'raw':!![]});});return Promise[_0xc4a1('0x20')](_0x52f8be);})[_0xc4a1('0x6')](function(_0x5831a3){for(var _0x38038a=0x0;_0x38038a<_0x5831a3[_0xc4a1('0x21')];_0x38038a++){if(_0x5831a3[_0x38038a]){var _0x29d684=_0xc4a1('0x1d')+_0x5831a3[_0x38038a]['id'];_0x6f0a30[_0x29d684][_0xc4a1('0x22')]=_0x5831a3[_0x38038a][_0xc4a1('0x23')];}}_0x45c36c=_[_0xc4a1('0x24')](Object['keys'](_0x6f0a30),function(_0x1d4d87){return{'name':_0x1d4d87,'type':_0x6f0a30[_0x1d4d87][_0xc4a1('0x23')]};});return _0x45c36c;})[_0xc4a1('0x18')](function(_0xe0afd9){throw _0xe0afd9;});}; \ No newline at end of file +var _0xa1da=['checkListsRestrictions','count','User','buildContactsQuery','getFilteredContacts','catch','describe','CmContact','startsWith','cf_','map','CmCustomField','findOne','slice','all','length','fieldType','type','lodash','./sql-utils','../../mysqldb','resolve','getContactsSubquery','search','parseAdvancedSearchFilter','then','where','fields','filter','user','clause','tags','skip'];(function(_0x368467,_0x4f4c1e){var _0x1c8f4d=function(_0x2dcb6f){while(--_0x2dcb6f){_0x368467['push'](_0x368467['shift']());}};_0x1c8f4d(++_0x4f4c1e);}(_0xa1da,0x1bf));var _0xaa1d=function(_0x5210a2,_0x4f5288){_0x5210a2=_0x5210a2-0x0;var _0x597bd9=_0xa1da[_0x5210a2];return _0x597bd9;};'use strict';var _=require(_0xaa1d('0x0'));var sqlUtils=require(_0xaa1d('0x1'));var db=require(_0xaa1d('0x2'))['db'];exports['findAll']=function(_0x221edb,_0x2f299f,_0x565e38,_0x70fd8d){var _0xd2ab86={'count':0x0,'rows':[]};var _0x56401a=sqlUtils['skipContactsQuery'](_0x2f299f,_0x221edb);if(_0x56401a){return Promise[_0xaa1d('0x3')](_0xd2ab86);}var _0x287dac=sqlUtils[_0xaa1d('0x4')]();var _0x2c557a={};var _0x2f91e4=![];var _0xaf6c99=![];return Promise[_0xaa1d('0x3')]()['then'](function(){if(_0x221edb[_0xaa1d('0x5')]){return sqlUtils[_0xaa1d('0x6')](_0x221edb[_0xaa1d('0x5')],_0x70fd8d);}else{return sqlUtils['parseQueryParameters'](_0x221edb,_0x70fd8d);}})[_0xaa1d('0x7')](function(_0x18ad4a){_0x287dac[_0xaa1d('0x8')](_0x18ad4a['default']);_0x287dac[_0xaa1d('0x8')](_0x18ad4a[_0xaa1d('0x9')]);_0x287dac[_0xaa1d('0x8')](_0x18ad4a[_0xaa1d('0xa')]);_0x287dac[_0xaa1d('0x8')](_0x18ad4a[_0xaa1d('0xb')][_0xaa1d('0xc')]);_0x2c557a=_0x18ad4a[_0xaa1d('0xd')];_0xaf6c99=_0x18ad4a[_0xaa1d('0xb')][_0xaa1d('0xe')];return sqlUtils[_0xaa1d('0xf')](_0x2f299f,_0x221edb,_0xaf6c99);})[_0xaa1d('0x7')](function(_0x1a1613){_0x287dac['where'](_0x1a1613);var _0x3efbaa=_0x221edb[_0xaa1d('0x5')]?_0x2c557a['ids']:_0x221edb['tag'];_0x2f91e4=_0x3efbaa?!![]:![];return sqlUtils['countFilteredContacts'](_0x287dac,_0x3efbaa);})[_0xaa1d('0x7')](function(_0x32aea2){_0xd2ab86['count']=_0x32aea2;if(_0xd2ab86[_0xaa1d('0x10')]===0x0){return;}if(_0x221edb[_0xaa1d('0x11')]){_0xaf6c99=!![];}return sqlUtils[_0xaa1d('0x12')](_0x287dac,_0x221edb[_0xaa1d('0x9')],_0x565e38,_0x2f91e4,_0x2c557a[_0xaa1d('0xc')],_0xaf6c99);})[_0xaa1d('0x7')](function(_0x3a5041){if(!_0x3a5041){return[];}return sqlUtils[_0xaa1d('0x13')](_0x3a5041,_0x221edb,_0x565e38);})['then'](function(_0x37c2f4){_0xd2ab86['rows']=_0x37c2f4;return _0xd2ab86;})[_0xaa1d('0x14')](function(_0x40e241){throw _0x40e241;});};exports[_0xaa1d('0x15')]=function(){var _0x39b595={};var _0x288681=[];return db[_0xaa1d('0x16')][_0xaa1d('0x15')]()[_0xaa1d('0x7')](function(_0x4f3f74){_0x39b595=_0x4f3f74;var _0x1e0bd4=Object['keys'](_0x39b595)['filter'](function(_0xe5fd9b){return _[_0xaa1d('0x17')](_0xe5fd9b,_0xaa1d('0x18'))?_0xe5fd9b:undefined;});var _0x8dfa89=_0x1e0bd4[_0xaa1d('0x19')](function(_0x11cf64){return db[_0xaa1d('0x1a')][_0xaa1d('0x1b')]({'where':{'id':_0x11cf64[_0xaa1d('0x1c')](0x3)},'raw':!![]});});return Promise[_0xaa1d('0x1d')](_0x8dfa89);})[_0xaa1d('0x7')](function(_0x1b5d35){for(var _0x3b2b39=0x0;_0x3b2b39<_0x1b5d35[_0xaa1d('0x1e')];_0x3b2b39++){if(_0x1b5d35[_0x3b2b39]){var _0x13e986=_0xaa1d('0x18')+_0x1b5d35[_0x3b2b39]['id'];_0x39b595[_0x13e986][_0xaa1d('0x1f')]=_0x1b5d35[_0x3b2b39][_0xaa1d('0x20')];}}_0x288681=_[_0xaa1d('0x19')](Object['keys'](_0x39b595),function(_0x1087e0){return{'name':_0x1087e0,'type':_0x39b595[_0x1087e0][_0xaa1d('0x20')]};});return _0x288681;})[_0xaa1d('0x14')](function(_0x5bd0b0){throw _0x5bd0b0;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index b762210..7dcbec7 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 _0x2a10=['expr','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','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.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','sqlOperator','conditions','find','name','dateOfBirth','datetime','castTo','DATE','buildExpression','type','default','text','value','start','Tag','split','map','tags','clause','and','ids','User','user','uc.UserId\x20=\x20?','skip','keys','some','compact','Contact','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','tag','filter','role','c.ListId\x20IS\x20NULL','attributes','limit','offset','having','order','DESC','subqry.','findAll','color','keyBy','QueryTypes','sequelize','query','toString','Tags','COUNT(*)','group','c.id','isEmpty','Sequelize','SELECT','exports','lodash','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','agent','search','ListId','autocomplete','true','select','from','cm_contacts','where','subqry','left_join','cm_user_has_contacts','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','phone','mobile','fax','email','CompanyId','createdAt','deletedAt','TagIds','includes','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2a10,0x126));var _0x02a1=function(_0x582e35,_0x150320){_0x582e35=_0x582e35-0x0;var _0x23d905=_0x2a10[_0x582e35];return _0x23d905;};'use strict';var _=require(_0x02a1('0x0'));var squel=require('squel');var as=require(_0x02a1('0x1'));var qs=require(_0x02a1('0x2'));var utils=require(_0x02a1('0x3'));var db=require(_0x02a1('0x4'))['db'];function skipContactsQuery(_0x4c4cea,_0x5b90a1){var _0x56c078=![];if(_0x4c4cea['role']===_0x02a1('0x5')&&!_0x5b90a1[_0x02a1('0x6')]&&!_0x5b90a1[_0x02a1('0x7')]&&_0x5b90a1[_0x02a1('0x8')]!==_0x02a1('0x9')){_0x56c078=!![];}return _0x56c078;}function getContactsSubquery(){return squel[_0x02a1('0xa')]()[_0x02a1('0xb')](_0x02a1('0xc'),'c')[_0x02a1('0xd')]('c.deletedAt\x20IS\x20NULL');}function applyJoinClauses(_0x4f5eca,_0x21296a){var _0x108224=_0x21296a?'c':_0x02a1('0xe');_0x4f5eca[_0x02a1('0xf')](_0x02a1('0x10'),'uc','uc.CmContactId\x20=\x20'+_0x108224+_0x02a1('0x11'))[_0x02a1('0xf')](_0x02a1('0x12'),'ct',_0x02a1('0x13')+_0x108224+_0x02a1('0x11'))[_0x02a1('0xf')](_0x02a1('0x14'),'t',_0x02a1('0x15'));return _0x4f5eca;}function addFieldsToQuery(_0x2b19e6,_0x60fe0e,_0x1362ad,_0x306d10,_0x1ea241){var _0x44e941=_0x1ea241?'c':'subqry';if(!_0x60fe0e){_0x60fe0e=['id',_0x02a1('0x16'),'lastName',_0x02a1('0x17'),_0x02a1('0x18'),_0x02a1('0x19'),_0x02a1('0x1a'),_0x02a1('0x7'),_0x02a1('0x1b'),_0x02a1('0x1c'),'updatedAt',_0x02a1('0x1d'),_0x02a1('0x1e')];}else if(!_0x60fe0e[_0x02a1('0x1f')]('id')){_0x60fe0e[_0x02a1('0x20')]('id');}var _0xdd5b11=_0x1362ad&&_0x1ea241||!_0x1362ad&&!_0x1ea241;if(_0x306d10){_0xdd5b11=_0x306d10&&_0x1ea241||!_0x306d10&&!_0x1ea241;}_0x60fe0e[_0x02a1('0x21')](function(_0x5d9af2){if(_0x5d9af2==='TagIds'){if(_0xdd5b11){_0x2b19e6[_0x02a1('0x22')](_0x02a1('0x23'),_0x5d9af2);}else if(_0x1362ad||_0x306d10){_0x2b19e6[_0x02a1('0x22')](_0x44e941+'.'+_0x5d9af2);}}else{_0x2b19e6['field'](_0x44e941+'.'+_0x5d9af2);}});return _0x2b19e6;}function getSqlClauses(){var _0xd34060={'default':squel[_0x02a1('0x24')](),'fields':squel[_0x02a1('0x24')](),'filter':squel[_0x02a1('0x24')](),'tags':{'clause':squel[_0x02a1('0x24')](),'ids':null},'user':{'clause':squel[_0x02a1('0x24')](),'skip':![]}};return _0xd34060;}function parseTagParameter(_0x5c08da){var _0x1f143b=squel[_0x02a1('0x24')]();if(_0x5c08da){var _0x445485=utils['getSelectedTags'](_0x5c08da);_0x445485[_0x02a1('0x21')](function(_0x20902a){_0x1f143b['or'](_0x02a1('0x25'),'%,'+_0x20902a+',%');});}return _0x1f143b;}function parseSearchFilter(_0x3a211c){var _0x408615=squel[_0x02a1('0x24')]();if(_0x3a211c){var _0x25ec96=_0x3a211c[_0x02a1('0x26')]('\x5c','\x5c\x5c')[_0x02a1('0x26')](/'/g,'\x27\x27');if(_0x25ec96['split']('\x20')[_0x02a1('0x27')]>0x1){_0x408615['or'](_0x02a1('0x28'),qs[_0x02a1('0x29')](_0x25ec96,!![]),null);}else{if(qs[_0x02a1('0x2a')](_0x25ec96)){_0x408615['or'](_0x02a1('0x2b'),_0x25ec96+'%');_0x408615['or'](_0x02a1('0x2c'),_0x25ec96+'%');_0x408615['or']('c.mobile\x20LIKE\x20?',_0x25ec96+'%');_0x408615['or']('c.fax\x20LIKE\x20?',_0x25ec96+'%');}else if(qs['isEmail'](_0x25ec96)){_0x408615['or'](_0x02a1('0x2d'),_0x25ec96+'%');}else{_0x408615['or'](_0x02a1('0x2e'),'%'+_0x25ec96+'%');_0x408615['or'](_0x02a1('0x2f'),'%'+_0x25ec96+'%');_0x408615['or'](_0x02a1('0x2d'),'%'+_0x25ec96+'%');}}}return _0x408615;}function parseAdvancedSearchFilter(_0x24fb5f,_0x344916){var _0x521df6=getSqlClauses();var _0x2e318d=as['parseSearch'](_0x24fb5f);var _0x12a250=_0x2e318d[_0x02a1('0x30')];for(var _0xb06d2b=0x0;_0xb06d2b<_0x2e318d[_0x02a1('0x31')][_0x02a1('0x27')];_0xb06d2b++){var _0xb2966b=_0x2e318d['conditions'][_0xb06d2b];var _0x5f48d1='c';var _0x101661=_[_0x02a1('0x32')](_0x344916,[_0x02a1('0x33'),_0xb2966b[_0x02a1('0x22')]]);if(_0x101661){if(_0xb2966b[_0x02a1('0x22')]===_0x02a1('0x34')||_0x101661['fieldType']===_0x02a1('0x35')){_0xb2966b[_0x02a1('0x36')]=_0x02a1('0x37');}var _0x44dfca=as[_0x02a1('0x38')](_0x5f48d1,_0x101661[_0x02a1('0x39')],_0xb2966b);_0x521df6[_0x02a1('0x3a')][_0x12a250](_0x44dfca[_0x02a1('0x3b')],_0x44dfca[_0x02a1('0x3c')][_0x02a1('0x3d')],_0x44dfca[_0x02a1('0x3c')]['end']);}else{if(_0xb2966b[_0x02a1('0x22')]===_0x02a1('0x3e')){var _0x2fee7f=_0xb2966b[_0x02a1('0x3c')][_0x02a1('0x3f')](',')[_0x02a1('0x40')](function(_0x5e4c5d){return Number(_0x5e4c5d);});var _0x437062=parseTagParameter(_0x2fee7f);_0x521df6[_0x02a1('0x41')][_0x02a1('0x42')][_0x02a1('0x43')](_0x437062);_0x521df6['tags'][_0x02a1('0x44')]=_0x2fee7f;}else if(_0xb2966b[_0x02a1('0x22')]===_0x02a1('0x45')){_0x521df6[_0x02a1('0x46')][_0x02a1('0x42')]['and'](_0x02a1('0x47'),_0xb2966b[_0x02a1('0x3c')]);_0x521df6[_0x02a1('0x46')][_0x02a1('0x48')]=!![];}}}return _0x521df6;}function parseModelFields(_0x21d53b,_0x3f9411){var _0x4a85c4=squel[_0x02a1('0x24')]();var _0x1f8939=_(_0x21d53b)[_0x02a1('0x49')]()[_0x02a1('0x40')](function(_0x245596){return _[_0x02a1('0x4a')](_0x3f9411,['name',_0x245596])?_0x245596:undefined;})[_0x02a1('0x4b')]()[_0x02a1('0x3c')]();if(_0x21d53b[_0x02a1('0x4c')]){_0x1f8939[_0x02a1('0x20')](_0x02a1('0x4c'));}if(_0x21d53b['User']){_0x1f8939['push'](_0x02a1('0x45'));}if(_0x1f8939['length']>0x0){_0x1f8939[_0x02a1('0x21')](function(_0x4f7b1b){if(_0x4f7b1b===_0x02a1('0x7')){_0x4a85c4[_0x02a1('0x43')](_0x02a1('0x4d'),[][_0x02a1('0x4e')](_0x21d53b[_0x4f7b1b]));}else if(_0x4f7b1b===_0x02a1('0x4c')){var _0x3943f9='%'+_0x21d53b[_0x4f7b1b]+'%';_0x4a85c4[_0x02a1('0x43')](_0x02a1('0x4f'),_0x3943f9);}else if(_0x4f7b1b==='User'){_0x4a85c4[_0x02a1('0x43')]('uc.UserId\x20=\x20?',_0x21d53b[_0x4f7b1b]);}else{_0x4a85c4[_0x02a1('0x43')]('c.'+_0x4f7b1b+_0x02a1('0x50'),_0x21d53b[_0x4f7b1b]);}});}return _0x4a85c4;}function parseQueryParameters(_0x80f765,_0x45114e){var _0x4ca574=getSqlClauses();return Promise[_0x02a1('0x51')]()[_0x02a1('0x52')](function(){return parseModelFields(_0x80f765,_0x45114e);})[_0x02a1('0x52')](function(_0x1ade11){_0x4ca574[_0x02a1('0x53')][_0x02a1('0x43')](_0x1ade11);return parseTagParameter(_0x80f765[_0x02a1('0x54')]);})[_0x02a1('0x52')](function(_0x98e0fb){_0x4ca574[_0x02a1('0x41')][_0x02a1('0x42')][_0x02a1('0x43')](_0x98e0fb);return parseSearchFilter(_0x80f765[_0x02a1('0x55')]);})['then'](function(_0xe235a2){_0x4ca574[_0x02a1('0x55')]=_0xe235a2;return _0x4ca574;});}function checkListsRestrictions(_0xfb7ad6,_0x3d7732,_0x422fa2){var _0x41004a=squel[_0x02a1('0x24')]();return Promise[_0x02a1('0x51')]()['then'](function(){if(_0x3d7732[_0x02a1('0x6')]&&_0xfb7ad6[_0x02a1('0x56')]===_0x02a1('0x5')&&!_0x422fa2){return _0xfb7ad6['getLists']({'attributes':['id'],'raw':!![]});}})[_0x02a1('0x52')](function(_0x3804a6){if(_0x3804a6){if(_0x3804a6['length']===0x0){_0x41004a['and'](_0x02a1('0x57'));}else{_0x41004a[_0x02a1('0x43')](_0x02a1('0x4d'),_[_0x02a1('0x40')](_0x3804a6,'id'));}}})['then'](function(){return _0x41004a;});}function buildContactsQuery(_0x51cdc1,_0x4efb4d,_0x2779d0,_0x4fe7d9,_0x4fd994,_0x35f9d2){if(_0x4efb4d){_0x4efb4d=_0x2779d0[_0x02a1('0x58')];}_0x51cdc1=addFieldsToQuery(_0x51cdc1,_0x4efb4d,_0x4fe7d9,_0x35f9d2,!![]);var _0x3b2bfa=squel[_0x02a1('0xa')]();_0x3b2bfa=addFieldsToQuery(_0x3b2bfa,_0x4efb4d,_0x4fe7d9,_0x35f9d2,![]);if(_0x4fe7d9||_0x35f9d2){_0x51cdc1=applyJoinClauses(_0x51cdc1,!![]);_0x51cdc1['group']('c.id');if(_0x2779d0[_0x02a1('0x59')]){_0x3b2bfa[_0x02a1('0x59')](_0x2779d0[_0x02a1('0x59')]);}if(_0x2779d0[_0x02a1('0x5a')]){_0x3b2bfa[_0x02a1('0x5a')](_0x2779d0['offset']);}}else{_0x3b2bfa=applyJoinClauses(_0x3b2bfa,![]);_0x3b2bfa['group']('subqry.id');if(_0x2779d0[_0x02a1('0x59')]){_0x51cdc1[_0x02a1('0x59')](_0x2779d0[_0x02a1('0x59')]);}if(_0x2779d0[_0x02a1('0x5a')]){_0x51cdc1['offset'](_0x2779d0[_0x02a1('0x5a')]);}}_0x3b2bfa[_0x02a1('0x5b')](_0x4fd994);if(_0x2779d0[_0x02a1('0x5c')]){_0x2779d0[_0x02a1('0x5c')][_0x02a1('0x21')](function(_0x2a18d3){_0x51cdc1['order']('c.'+_0x2a18d3[0x0],_0x2a18d3[0x1]===_0x02a1('0x5d')?![]:!![]);_0x3b2bfa[_0x02a1('0x5c')](_0x02a1('0x5e')+_0x2a18d3[0x0],_0x2a18d3[0x1]==='DESC'?![]:!![]);});}_0x3b2bfa[_0x02a1('0xb')](_0x51cdc1,_0x02a1('0xe'));return _0x3b2bfa;}function getFilteredContacts(_0x2b3f04){var _0x3b7606=[];return db['Tag'][_0x02a1('0x5f')]({'attributes':['id',_0x02a1('0x33'),_0x02a1('0x60')],'raw':!![]})[_0x02a1('0x52')](function(_0x36c921){_0x3b7606=_[_0x02a1('0x61')](_0x36c921,'id');var _0x8d3bd3={'type':db['Sequelize'][_0x02a1('0x62')]['SELECT'],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x02a1('0x63')][_0x02a1('0x64')](_0x2b3f04[_0x02a1('0x65')](),_0x8d3bd3);})[_0x02a1('0x52')](function(_0x60317a){_0x60317a[_0x02a1('0x21')](function(_0x558fe4){if(_0x558fe4[_0x02a1('0x1e')]){_0x558fe4['Tags']=[];_0x558fe4[_0x02a1('0x1e')][_0x02a1('0x3f')](',')[_0x02a1('0x21')](function(_0x3347c9){_0x558fe4[_0x02a1('0x66')][_0x02a1('0x20')](_0x3b7606[_0x3347c9]);});}delete _0x558fe4[_0x02a1('0x1e')];});return _0x60317a;});}function countFilteredContacts(_0x362ace,_0x46e00e){var _0x3119cc=_0x362ace['clone']();_0x3119cc[_0x02a1('0x22')](_0x02a1('0x67'));_0x3119cc=applyJoinClauses(_0x3119cc,!![]);_0x362ace[_0x02a1('0x68')](_0x02a1('0x69'));var _0x54812c=utils['getSelectedTags'](_0x46e00e);if(!_[_0x02a1('0x6a')](_0x54812c)){_0x3119cc[_0x02a1('0xd')]('t.id\x20IN\x20?',_0x54812c);}var _0x2bfd47={'type':db[_0x02a1('0x6b')]['QueryTypes'][_0x02a1('0x6c')],'raw':!![]};return db['sequelize']['query'](_0x3119cc[_0x02a1('0x65')](),_0x2bfd47)[_0x02a1('0x52')](function(_0x3c700b){return _0x3c700b[0x0][_0x02a1('0x67')];});}module[_0x02a1('0x6d')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x353d=['user','uc.UserId\x20=\x20?','skip','keys','some','compact','Contact','User','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','filter','getLists','c.ListId\x20IN\x20?','attributes','group','c.id','limit','offset','subqry.id','having','order','DESC','subqry.','findAll','color','keyBy','QueryTypes','SELECT','CmContact','sequelize','query','toString','Tags','COUNT(*)','isEmpty','t.id\x20IN\x20?','Sequelize','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','search','ListId','autocomplete','select','from','cm_contacts','where','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','subqry','firstName','mobile','fax','email','CompanyId','createdAt','updatedAt','deletedAt','TagIds','includes','push','forEach','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','conditions','find','name','dateOfBirth','fieldType','datetime','DATE','buildExpression','default','start','value','end','Tag','map','tags','clause','and','ids'];(function(_0x29678a,_0xd09044){var _0xd762b6=function(_0x4c6944){while(--_0x4c6944){_0x29678a['push'](_0x29678a['shift']());}};_0xd762b6(++_0xd09044);}(_0x353d,0x17d));var _0xd353=function(_0x28479d,_0x1b8d89){_0x28479d=_0x28479d-0x0;var _0x45c08e=_0x353d[_0x28479d];return _0x45c08e;};'use strict';var _=require(_0xd353('0x0'));var squel=require(_0xd353('0x1'));var as=require(_0xd353('0x2'));var qs=require(_0xd353('0x3'));var utils=require(_0xd353('0x4'));var db=require(_0xd353('0x5'))['db'];function skipContactsQuery(_0x19e179,_0x18e751){var _0x36b0b1=![];if(_0x19e179[_0xd353('0x6')]===_0xd353('0x7')&&!_0x18e751[_0xd353('0x8')]&&!_0x18e751[_0xd353('0x9')]&&_0x18e751[_0xd353('0xa')]!=='true'){_0x36b0b1=!![];}return _0x36b0b1;}function getContactsSubquery(){return squel[_0xd353('0xb')]()[_0xd353('0xc')](_0xd353('0xd'),'c')[_0xd353('0xe')]('c.deletedAt\x20IS\x20NULL');}function applyJoinClauses(_0x3c4ec0,_0x516b14){var _0x5ac009=_0x516b14?'c':'subqry';_0x3c4ec0[_0xd353('0xf')](_0xd353('0x10'),'uc',_0xd353('0x11')+_0x5ac009+_0xd353('0x12'))['left_join'](_0xd353('0x13'),'ct',_0xd353('0x14')+_0x5ac009+_0xd353('0x12'))[_0xd353('0xf')](_0xd353('0x15'),'t',_0xd353('0x16'));return _0x3c4ec0;}function addFieldsToQuery(_0x3a2414,_0x12b08a,_0x399a33,_0x1bec85,_0x99f4a1){var _0x514be7=_0x99f4a1?'c':_0xd353('0x17');if(!_0x12b08a){_0x12b08a=['id',_0xd353('0x18'),'lastName','phone',_0xd353('0x19'),_0xd353('0x1a'),_0xd353('0x1b'),'ListId',_0xd353('0x1c'),_0xd353('0x1d'),_0xd353('0x1e'),_0xd353('0x1f'),_0xd353('0x20')];}else if(!_0x12b08a[_0xd353('0x21')]('id')){_0x12b08a[_0xd353('0x22')]('id');}var _0x53dc19=_0x399a33&&_0x99f4a1||!_0x399a33&&!_0x99f4a1;if(_0x1bec85){_0x53dc19=_0x1bec85&&_0x99f4a1||!_0x1bec85&&!_0x99f4a1;}_0x12b08a[_0xd353('0x23')](function(_0x5c022c){if(_0x5c022c===_0xd353('0x20')){if(_0x53dc19){_0x3a2414[_0xd353('0x24')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x5c022c);}else if(_0x399a33||_0x1bec85){_0x3a2414['field'](_0x514be7+'.'+_0x5c022c);}}else{_0x3a2414['field'](_0x514be7+'.'+_0x5c022c);}});return _0x3a2414;}function getSqlClauses(){var _0x13848f={'default':squel[_0xd353('0x25')](),'fields':squel[_0xd353('0x25')](),'filter':squel[_0xd353('0x25')](),'tags':{'clause':squel[_0xd353('0x25')](),'ids':null},'user':{'clause':squel[_0xd353('0x25')](),'skip':![]}};return _0x13848f;}function parseTagParameter(_0x440658){var _0x46a66f=squel['expr']();if(_0x440658){var _0x328b13=utils[_0xd353('0x26')](_0x440658);_0x328b13[_0xd353('0x23')](function(_0x24842e){_0x46a66f['or'](_0xd353('0x27'),'%,'+_0x24842e+',%');});}return _0x46a66f;}function parseSearchFilter(_0x4d8c83){var _0x1bcd81=squel[_0xd353('0x25')]();if(_0x4d8c83){var _0x56eae5=_0x4d8c83[_0xd353('0x28')]('\x5c','\x5c\x5c')[_0xd353('0x28')](/'/g,'\x27\x27');if(_0x56eae5[_0xd353('0x29')]('\x20')[_0xd353('0x2a')]>0x1){_0x1bcd81['or'](_0xd353('0x2b'),qs[_0xd353('0x2c')](_0x56eae5,!![]),null);}else{if(qs['isNumeric'](_0x56eae5)){_0x1bcd81['or'](_0xd353('0x2d'),_0x56eae5+'%');_0x1bcd81['or'](_0xd353('0x2e'),_0x56eae5+'%');_0x1bcd81['or'](_0xd353('0x2f'),_0x56eae5+'%');_0x1bcd81['or'](_0xd353('0x30'),_0x56eae5+'%');}else if(qs['isEmail'](_0x56eae5)){_0x1bcd81['or'](_0xd353('0x31'),_0x56eae5+'%');}else{_0x1bcd81['or'](_0xd353('0x32'),'%'+_0x56eae5+'%');_0x1bcd81['or'](_0xd353('0x33'),'%'+_0x56eae5+'%');_0x1bcd81['or']('c.email\x20LIKE\x20?','%'+_0x56eae5+'%');}}}return _0x1bcd81;}function parseAdvancedSearchFilter(_0x3fcde6,_0x5ed78b){var _0x80c313=getSqlClauses();var _0xaa82e2=as[_0xd353('0x34')](_0x3fcde6);var _0x457f65=_0xaa82e2['sqlOperator'];for(var _0x26a71e=0x0;_0x26a71e<_0xaa82e2[_0xd353('0x35')][_0xd353('0x2a')];_0x26a71e++){var _0x3af78b=_0xaa82e2[_0xd353('0x35')][_0x26a71e];var _0x1ba158='c';var _0x48e84f=_[_0xd353('0x36')](_0x5ed78b,[_0xd353('0x37'),_0x3af78b[_0xd353('0x24')]]);if(_0x48e84f){if(_0x3af78b[_0xd353('0x24')]===_0xd353('0x38')||_0x48e84f[_0xd353('0x39')]===_0xd353('0x3a')){_0x3af78b['castTo']=_0xd353('0x3b');}var _0x3e7aad=as[_0xd353('0x3c')](_0x1ba158,_0x48e84f['type'],_0x3af78b);_0x80c313[_0xd353('0x3d')][_0x457f65](_0x3e7aad['text'],_0x3e7aad['value'][_0xd353('0x3e')],_0x3e7aad[_0xd353('0x3f')][_0xd353('0x40')]);}else{if(_0x3af78b['field']===_0xd353('0x41')){var _0x46073f=_0x3af78b[_0xd353('0x3f')][_0xd353('0x29')](',')[_0xd353('0x42')](function(_0xcb3a67){return Number(_0xcb3a67);});var _0x2bdd96=parseTagParameter(_0x46073f);_0x80c313[_0xd353('0x43')][_0xd353('0x44')][_0xd353('0x45')](_0x2bdd96);_0x80c313[_0xd353('0x43')][_0xd353('0x46')]=_0x46073f;}else if(_0x3af78b[_0xd353('0x24')]==='User'){_0x80c313[_0xd353('0x47')]['clause']['and'](_0xd353('0x48'),_0x3af78b[_0xd353('0x3f')]);_0x80c313['user'][_0xd353('0x49')]=!![];}}}return _0x80c313;}function parseModelFields(_0x2456c9,_0x559273){var _0x48dc38=squel[_0xd353('0x25')]();var _0x44b8e1=_(_0x2456c9)[_0xd353('0x4a')]()[_0xd353('0x42')](function(_0x3757a9){return _[_0xd353('0x4b')](_0x559273,[_0xd353('0x37'),_0x3757a9])?_0x3757a9:undefined;})[_0xd353('0x4c')]()[_0xd353('0x3f')]();if(_0x2456c9[_0xd353('0x4d')]){_0x44b8e1['push'](_0xd353('0x4d'));}if(_0x2456c9[_0xd353('0x4e')]){_0x44b8e1[_0xd353('0x22')](_0xd353('0x4e'));}if(_0x44b8e1[_0xd353('0x2a')]>0x0){_0x44b8e1[_0xd353('0x23')](function(_0xcca0bb){if(_0xcca0bb===_0xd353('0x9')){_0x48dc38[_0xd353('0x45')]('c.ListId\x20IN\x20?',[][_0xd353('0x4f')](_0x2456c9[_0xcca0bb]));}else if(_0xcca0bb===_0xd353('0x4d')){var _0x5cc451='%'+_0x2456c9[_0xcca0bb]+'%';_0x48dc38[_0xd353('0x45')](_0xd353('0x50'),_0x5cc451);}else if(_0xcca0bb===_0xd353('0x4e')){_0x48dc38[_0xd353('0x45')]('uc.UserId\x20=\x20?',_0x2456c9[_0xcca0bb]);}else{_0x48dc38[_0xd353('0x45')]('c.'+_0xcca0bb+_0xd353('0x51'),_0x2456c9[_0xcca0bb]);}});}return _0x48dc38;}function parseQueryParameters(_0x4bc52e,_0x22efc6){var _0x3d7fc8=getSqlClauses();return Promise[_0xd353('0x52')]()[_0xd353('0x53')](function(){return parseModelFields(_0x4bc52e,_0x22efc6);})[_0xd353('0x53')](function(_0x52ee53){_0x3d7fc8[_0xd353('0x54')][_0xd353('0x45')](_0x52ee53);return parseTagParameter(_0x4bc52e['tag']);})[_0xd353('0x53')](function(_0x3fd48e){_0x3d7fc8['tags'][_0xd353('0x44')][_0xd353('0x45')](_0x3fd48e);return parseSearchFilter(_0x4bc52e['filter']);})[_0xd353('0x53')](function(_0x55cdbb){_0x3d7fc8[_0xd353('0x55')]=_0x55cdbb;return _0x3d7fc8;});}function checkListsRestrictions(_0x7b81a8,_0x3a78b0,_0x9483f2){var _0x311df7=squel[_0xd353('0x25')]();return Promise['resolve']()[_0xd353('0x53')](function(){if(_0x3a78b0[_0xd353('0x8')]&&_0x7b81a8[_0xd353('0x6')]===_0xd353('0x7')&&!_0x9483f2){return _0x7b81a8[_0xd353('0x56')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x25e4fb){if(_0x25e4fb){if(_0x25e4fb[_0xd353('0x2a')]===0x0){_0x311df7['and']('c.ListId\x20IS\x20NULL');}else{_0x311df7[_0xd353('0x45')](_0xd353('0x57'),_[_0xd353('0x42')](_0x25e4fb,'id'));}}})[_0xd353('0x53')](function(){return _0x311df7;});}function buildContactsQuery(_0x12e082,_0x17547d,_0x5f38ed,_0x5503b6,_0x2f9398,_0x5bc700){if(_0x17547d){_0x17547d=_0x5f38ed[_0xd353('0x58')];}_0x12e082=addFieldsToQuery(_0x12e082,_0x17547d,_0x5503b6,_0x5bc700,!![]);var _0x374b39=squel[_0xd353('0xb')]();_0x374b39=addFieldsToQuery(_0x374b39,_0x17547d,_0x5503b6,_0x5bc700,![]);if(_0x5503b6||_0x5bc700){_0x12e082=applyJoinClauses(_0x12e082,!![]);_0x12e082[_0xd353('0x59')](_0xd353('0x5a'));if(_0x5f38ed['limit']){_0x374b39[_0xd353('0x5b')](_0x5f38ed[_0xd353('0x5b')]);}if(_0x5f38ed[_0xd353('0x5c')]){_0x374b39['offset'](_0x5f38ed['offset']);}}else{_0x374b39=applyJoinClauses(_0x374b39,![]);_0x374b39[_0xd353('0x59')](_0xd353('0x5d'));if(_0x5f38ed[_0xd353('0x5b')]){_0x12e082[_0xd353('0x5b')](_0x5f38ed['limit']);}if(_0x5f38ed[_0xd353('0x5c')]){_0x12e082['offset'](_0x5f38ed[_0xd353('0x5c')]);}}_0x374b39[_0xd353('0x5e')](_0x2f9398);if(_0x5f38ed[_0xd353('0x5f')]){_0x5f38ed['order'][_0xd353('0x23')](function(_0x49034c){_0x12e082[_0xd353('0x5f')]('c.'+_0x49034c[0x0],_0x49034c[0x1]===_0xd353('0x60')?![]:!![]);_0x374b39[_0xd353('0x5f')](_0xd353('0x61')+_0x49034c[0x0],_0x49034c[0x1]==='DESC'?![]:!![]);});}_0x374b39['from'](_0x12e082,_0xd353('0x17'));return _0x374b39;}function getFilteredContacts(_0x2921bd){var _0x4ea47e=[];return db[_0xd353('0x41')][_0xd353('0x62')]({'attributes':['id',_0xd353('0x37'),_0xd353('0x63')],'raw':!![]})[_0xd353('0x53')](function(_0x288585){_0x4ea47e=_[_0xd353('0x64')](_0x288585,'id');var _0x396697={'type':db['Sequelize'][_0xd353('0x65')][_0xd353('0x66')],'model':db[_0xd353('0x67')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xd353('0x68')][_0xd353('0x69')](_0x2921bd[_0xd353('0x6a')](),_0x396697);})[_0xd353('0x53')](function(_0x53b2b6){_0x53b2b6[_0xd353('0x23')](function(_0x162460){if(_0x162460[_0xd353('0x20')]){_0x162460['Tags']=[];_0x162460[_0xd353('0x20')][_0xd353('0x29')](',')[_0xd353('0x23')](function(_0x2a0290){_0x162460[_0xd353('0x6b')][_0xd353('0x22')](_0x4ea47e[_0x2a0290]);});}delete _0x162460['TagIds'];});return _0x53b2b6;});}function countFilteredContacts(_0x183773,_0x268fa8){var _0x130eb6=_0x183773['clone']();_0x130eb6[_0xd353('0x24')](_0xd353('0x6c'));_0x130eb6=applyJoinClauses(_0x130eb6,!![]);_0x183773[_0xd353('0x59')](_0xd353('0x5a'));var _0x32dd63=utils['getSelectedTags'](_0x268fa8);if(!_[_0xd353('0x6d')](_0x32dd63)){_0x130eb6[_0xd353('0xe')](_0xd353('0x6e'),_0x32dd63);}var _0x27e675={'type':db[_0xd353('0x6f')][_0xd353('0x65')][_0xd353('0x66')],'raw':!![]};return db[_0xd353('0x68')][_0xd353('0x69')](_0x130eb6[_0xd353('0x6a')](),_0x27e675)[_0xd353('0x53')](function(_0x4209cc){return _0x4209cc[0x0][_0xd353('0x6c')];});}module[_0xd353('0x70')]={'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 bbdbd2f..dbed2e6 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 _0x6915=['createDecipher','write','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','../../config/logger','app','secrets','aes-256-ctr','aes192','encrypt','algorithm','error','filter','hasOwnProperty','encryptFile','createReadStream','createWriteStream','data','update','binary','end','final','close','unlink','decryptFile'];(function(_0x234e1a,_0x500d79){var _0x55aad2=function(_0x272396){while(--_0x272396){_0x234e1a['push'](_0x234e1a['shift']());}};_0x55aad2(++_0x500d79);}(_0x6915,0x9d));var _0x5691=function(_0x122dcc,_0x1244ed){_0x122dcc=_0x122dcc-0x0;var _0x42a15f=_0x6915[_0x122dcc];return _0x42a15f;};'use strict';var crypto=require(_0x5691('0x0'));var fs=require('fs');var BPromise=require(_0x5691('0x1'));var _=require('lodash');var config=require('../../config/environment');var logger=require(_0x5691('0x2'))(_0x5691('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x5691('0x4')]['session'],'algorithm':_0x5691('0x5')};const fileOptions={'algorithm':_0x5691('0x6')};if(config[_0x5691('0x7')]&&config[_0x5691('0x7')][_0x5691('0x8')]){var isSupported=isAlgorithmSupported(config[_0x5691('0x7')]['algorithm']);if(isSupported){fileOptions[_0x5691('0x8')]=config[_0x5691('0x7')][_0x5691('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0x5691('0x9')](config[_0x5691('0x7')][_0x5691('0x8')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x35c0f1){return AES_SUPPORTED_RX['test'](_0x35c0f1);}function getSupportedCiphers(){return crypto['getCiphers']()[_0x5691('0xa')](isASupportedCipher);}function isAlgorithmSupported(_0x296e7b){return getSupportedCiphers()['indexOf'](_0x296e7b)>-0x1;}function combineOptions(_0x5c9767){var _0x24aa4e={};for(var _0x2fd568 in fileOptions){if(fileOptions[_0x5691('0xb')](_0x2fd568)){_0x24aa4e[_0x2fd568]=fileOptions[_0x2fd568];}}if(_0x5c9767){for(var _0x5428f5 in _0x5c9767){if(_0x5c9767[_0x5691('0xb')](_0x5428f5)){_0x24aa4e[_0x5428f5]=_0x5c9767[_0x5428f5];}}}return _0x24aa4e;}exports[_0x5691('0xc')]=function(_0x9e995a,_0x1ca2c4,_0x15998f,_0x611745){return new BPromise(function(_0x5f25a6,_0x3a963d){_0x611745=combineOptions(_0x611745);var _0x5195a4=new Buffer(_0x15998f);var _0x8fff82=fs[_0x5691('0xd')](_0x9e995a);var _0x3081c7=fs[_0x5691('0xe')](_0x1ca2c4);var _0x2bc4e7=crypto['createCipher'](_0x611745[_0x5691('0x8')],_0x5195a4);_0x8fff82['on'](_0x5691('0xf'),function(_0x3c8deb){var _0x5aee03=new Buffer(_0x2bc4e7[_0x5691('0x10')](_0x3c8deb),_0x5691('0x11'));_0x3081c7['write'](_0x5aee03);});_0x8fff82['on'](_0x5691('0x12'),function(){try{var _0x5c61c9=new Buffer(_0x2bc4e7[_0x5691('0x13')](_0x5691('0x11')),_0x5691('0x11'));_0x3081c7['write'](_0x5c61c9);_0x3081c7[_0x5691('0x12')]();_0x3081c7['on'](_0x5691('0x14'),function(){return _0x5f25a6(_0x1ca2c4);});}catch(_0x1031f1){fs[_0x5691('0x15')](_0x1ca2c4);return _0x3a963d(_0x1031f1);}});});};exports[_0x5691('0x16')]=function(_0x2d1c7f,_0x15691f,_0xde7624,_0x1c7940){return new BPromise(function(_0x546ef6,_0x1c75c1){_0x1c7940=combineOptions(_0x1c7940);var _0x174a3e=new Buffer(_0xde7624);var _0x1792d8=fs[_0x5691('0xd')](_0x2d1c7f);var _0x2a1fae=fs[_0x5691('0xe')](_0x15691f);var _0x104969=crypto[_0x5691('0x17')](_0x1c7940['algorithm'],_0x174a3e);_0x1792d8['on']('data',function(_0x2e94a2){var _0x5b5ed5=new Buffer(_0x104969[_0x5691('0x10')](_0x2e94a2),_0x5691('0x11'));_0x2a1fae[_0x5691('0x18')](_0x5b5ed5);});_0x1792d8['on'](_0x5691('0x12'),function(){try{var _0x41284e=new Buffer(_0x104969[_0x5691('0x13')](_0x5691('0x11')),_0x5691('0x11'));_0x2a1fae[_0x5691('0x18')](_0x41284e);_0x2a1fae[_0x5691('0x12')]();_0x2a1fae['on'](_0x5691('0x14'),function(){return _0x546ef6(_0x15691f);});}catch(_0x56c319){fs[_0x5691('0x15')](_0x15691f);return _0x1c75c1(_0x56c319);}});});};exports[_0x5691('0x19')]=function(_0x5b7474,_0x378375,_0x5ada99){var _0x56ff65=_0x5ada99||stringOptions['algorithm'];var _0x538df9=_0x378375||stringOptions[_0x5691('0x1a')];var _0x432a7f=crypto['createCipher'](_0x56ff65,_0x538df9);var _0x22b4a9=_0x432a7f[_0x5691('0x10')](_0x5b7474,_0x5691('0x1b'),_0x5691('0x1c'));_0x22b4a9+=_0x432a7f[_0x5691('0x13')](_0x5691('0x1c'));return _0x22b4a9;};exports[_0x5691('0x1d')]=function(_0x23ee92,_0x439aac,_0x29f416){var _0xcacf85=_0x29f416||stringOptions['algorithm'];var _0x404c0a=_0x439aac||stringOptions[_0x5691('0x1a')];var _0x289968=crypto[_0x5691('0x17')](_0xcacf85,_0x404c0a);var _0x517c33=_0x289968[_0x5691('0x10')](_0x23ee92,_0x5691('0x1c'),_0x5691('0x1b'));_0x517c33+=_0x289968[_0x5691('0x13')]('utf8');return _0x517c33;}; \ No newline at end of file +var _0x6087=['getCiphers','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','binary','end','final','write','close','unlink','decryptFile','createDecipher','update','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','lodash','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test'];(function(_0x41788c,_0x453e96){var _0xbc4998=function(_0x23a413){while(--_0x23a413){_0x41788c['push'](_0x41788c['shift']());}};_0xbc4998(++_0x453e96);}(_0x6087,0x11e));var _0x7608=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x6087[_0x3ab51d];return _0x29a04e;};'use strict';var crypto=require(_0x7608('0x0'));var fs=require('fs');var BPromise=require(_0x7608('0x1'));var _=require(_0x7608('0x2'));var config=require('../../config/environment');var logger=require('../../config/logger')('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets']['session'],'algorithm':_0x7608('0x3')};const fileOptions={'algorithm':_0x7608('0x4')};if(config[_0x7608('0x5')]&&config[_0x7608('0x5')][_0x7608('0x6')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x7608('0x6')]);if(isSupported){fileOptions[_0x7608('0x6')]=config['encrypt']['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0x7608('0x7')](',\x20');logger[_0x7608('0x8')](config[_0x7608('0x5')][_0x7608('0x6')],_0x7608('0x9'),supportedAlgorithms);}}function isASupportedCipher(_0x37a52b){return AES_SUPPORTED_RX[_0x7608('0xa')](_0x37a52b);}function getSupportedCiphers(){return crypto[_0x7608('0xb')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x3b5b31){return getSupportedCiphers()[_0x7608('0xc')](_0x3b5b31)>-0x1;}function combineOptions(_0x547644){var _0x42a822={};for(var _0x5bd857 in fileOptions){if(fileOptions['hasOwnProperty'](_0x5bd857)){_0x42a822[_0x5bd857]=fileOptions[_0x5bd857];}}if(_0x547644){for(var _0x5c3cbf in _0x547644){if(_0x547644[_0x7608('0xd')](_0x5c3cbf)){_0x42a822[_0x5c3cbf]=_0x547644[_0x5c3cbf];}}}return _0x42a822;}exports[_0x7608('0xe')]=function(_0x5b70a1,_0x5c09a1,_0x1786fd,_0x8c3aa9){return new BPromise(function(_0x5687ec,_0xf6d86d){_0x8c3aa9=combineOptions(_0x8c3aa9);var _0x111554=new Buffer(_0x1786fd);var _0x17bb71=fs[_0x7608('0xf')](_0x5b70a1);var _0x2df018=fs[_0x7608('0x10')](_0x5c09a1);var _0x52ab3f=crypto[_0x7608('0x11')](_0x8c3aa9[_0x7608('0x6')],_0x111554);_0x17bb71['on'](_0x7608('0x12'),function(_0x28eee8){var _0x25a9d2=new Buffer(_0x52ab3f['update'](_0x28eee8),_0x7608('0x13'));_0x2df018['write'](_0x25a9d2);});_0x17bb71['on'](_0x7608('0x14'),function(){try{var _0x4f5faf=new Buffer(_0x52ab3f[_0x7608('0x15')](_0x7608('0x13')),'binary');_0x2df018[_0x7608('0x16')](_0x4f5faf);_0x2df018[_0x7608('0x14')]();_0x2df018['on'](_0x7608('0x17'),function(){return _0x5687ec(_0x5c09a1);});}catch(_0x275994){fs[_0x7608('0x18')](_0x5c09a1);return _0xf6d86d(_0x275994);}});});};exports[_0x7608('0x19')]=function(_0x24ea62,_0x579300,_0x57128b,_0x5e5813){return new BPromise(function(_0x26f7c3,_0xeafc50){_0x5e5813=combineOptions(_0x5e5813);var _0x216c65=new Buffer(_0x57128b);var _0x22741c=fs[_0x7608('0xf')](_0x24ea62);var _0xfb9e22=fs['createWriteStream'](_0x579300);var _0x5cb964=crypto[_0x7608('0x1a')](_0x5e5813[_0x7608('0x6')],_0x216c65);_0x22741c['on'](_0x7608('0x12'),function(_0x3e74a3){var _0x349913=new Buffer(_0x5cb964[_0x7608('0x1b')](_0x3e74a3),_0x7608('0x13'));_0xfb9e22[_0x7608('0x16')](_0x349913);});_0x22741c['on'](_0x7608('0x14'),function(){try{var _0xb6caad=new Buffer(_0x5cb964['final']('binary'),_0x7608('0x13'));_0xfb9e22['write'](_0xb6caad);_0xfb9e22['end']();_0xfb9e22['on']('close',function(){return _0x26f7c3(_0x579300);});}catch(_0x430b8f){fs[_0x7608('0x18')](_0x579300);return _0xeafc50(_0x430b8f);}});});};exports[_0x7608('0x1c')]=function(_0x335320,_0x14fd9c,_0x1f5c81){var _0x533d0f=_0x1f5c81||stringOptions[_0x7608('0x6')];var _0x6f328a=_0x14fd9c||stringOptions[_0x7608('0x1d')];var _0x2d5f1a=crypto['createCipher'](_0x533d0f,_0x6f328a);var _0x871b15=_0x2d5f1a['update'](_0x335320,_0x7608('0x1e'),_0x7608('0x1f'));_0x871b15+=_0x2d5f1a['final']('base64');return _0x871b15;};exports[_0x7608('0x20')]=function(_0x9913d,_0x2a13c6,_0x15d5a6){var _0x2a12ae=_0x15d5a6||stringOptions[_0x7608('0x6')];var _0x359ba0=_0x2a13c6||stringOptions['secret'];var _0x30d7b7=crypto[_0x7608('0x1a')](_0x2a12ae,_0x359ba0);var _0x5ac795=_0x30d7b7[_0x7608('0x1b')](_0x9913d,'base64','utf8');_0x5ac795+=_0x30d7b7[_0x7608('0x15')](_0x7608('0x1e'));return _0x5ac795;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 8103743..b53a220 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 _0xf8fe=['bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','split','then','splitSizeCsv','sequelize','query','QueryTypes','SELECT','num','Empty','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.csv','length','existsSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','util'];(function(_0x3c71c2,_0x3b9b20){var _0x15721f=function(_0x16c182){while(--_0x16c182){_0x3c71c2['push'](_0x3c71c2['shift']());}};_0x15721f(++_0x3b9b20);}(_0xf8fe,0x1af));var _0xef8f=function(_0x53172e,_0x3a976a){_0x53172e=_0x53172e-0x0;var _0x13976b=_0xf8fe[_0x53172e];return _0x13976b;};'use strict';var util=require(_0xef8f('0x0'));var path=require('path');var _=require('lodash');var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0xef8f('0x1'));var zipdir=require(_0xef8f('0x2'));var rimraf=require(_0xef8f('0x3'));var db=require(_0xef8f('0x4'))['db'];var dbH=require(_0xef8f('0x4'))[_0xef8f('0x5')];var logger=require(_0xef8f('0x6'))(_0xef8f('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xef8f('0x8')][0x2]);var QUERY=process[_0xef8f('0x8')][0x3];var PATH=process[_0xef8f('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5ee08f,_0x3a7425){var _0x32067d={'status':_0x5ee08f};var _0x3da2b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3a7425){_0x32067d[_0xef8f('0x9')]=_0x3a7425;}return db[_0xef8f('0xa')]['update'](_0x32067d,_0x3da2b);}function main(){var _0x583ade=0x1388;var _0x4cb478;logger['info'](util[_0xef8f('0xb')](_0xef8f('0xc'),EXTRACTED_REPORT_ID,_0xef8f('0xd')));return db[_0xef8f('0xe')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xef8f('0xf'),'splitSizeCsv']})[_0xef8f('0x10')](function(_0x142aeb){if(_0x142aeb){_0x4cb478=_0x142aeb;_0x583ade=_0x4cb478[_0xef8f('0x11')]||0x1388;}})[_0xef8f('0x10')](function(){return dbH[_0xef8f('0x12')][_0xef8f('0x13')](util[_0xef8f('0xb')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0xef8f('0x14')][_0xef8f('0x15')]});})[_0xef8f('0x10')](function(_0x3a6265){if(!_0x3a6265[0x0][_0xef8f('0x16')]){return analyticExtractedReport(_0xef8f('0x17'));}var _0x3ccafe=[];var _0x4b5bf7=0x0;if(_0x4cb478[_0xef8f('0xf')]){if(_0x3a6265&&_0x3a6265['length']){var _0x1ad491=_[_0xef8f('0x18')](_0x3a6265[0x0][_0xef8f('0x16')]/_0x583ade);var _0x13b955=Number[_0xef8f('0x19')](_0x3a6265[0x0][_0xef8f('0x16')]/_0x583ade)?_0x3a6265[0x0][_0xef8f('0x16')]%_0x583ade:0x0;_0x1ad491[_0xef8f('0x1a')](function(_0xc787c6){if(_0xc787c6>0x0){_0x4b5bf7+=_0x583ade;}_0x3ccafe[_0xef8f('0x1b')](dbH[_0xef8f('0x12')][_0xef8f('0x13')](util[_0xef8f('0xb')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x583ade,_0x4b5bf7),{'type':dbH[_0xef8f('0x12')][_0xef8f('0x14')][_0xef8f('0x15')]}));});if(_0x13b955>0x0){_0x4b5bf7+=_0x583ade;_0x3ccafe[_0xef8f('0x1b')](dbH[_0xef8f('0x12')][_0xef8f('0x13')](util[_0xef8f('0xb')](_0xef8f('0x1c'),QUERY,_0x13b955,_0x4b5bf7),{'type':dbH['sequelize'][_0xef8f('0x14')][_0xef8f('0x15')]}));}}}else{_0x3ccafe[_0xef8f('0x1b')](dbH[_0xef8f('0x12')][_0xef8f('0x13')](QUERY,{'type':dbH[_0xef8f('0x12')][_0xef8f('0x14')][_0xef8f('0x15')]}));}var _0x383ddc=path['dirname'](PATH);var _0x4a3c5e=path[_0xef8f('0x1d')](PATH,_0xef8f('0x1e'));var _0xcc351c=_0x4cb478[_0xef8f('0xf')]&&_0x3ccafe[_0xef8f('0x1f')]>0x1;var _0x5a97b8=[];if(!fs[_0xef8f('0x20')](path[_0xef8f('0x21')](_0x383ddc,_0x4a3c5e))&&_0xcc351c){fs['mkdirSync'](path[_0xef8f('0x21')](_0x383ddc,_0x4a3c5e));}return BPromise[_0xef8f('0x22')](_0x3ccafe,function(_0x4c03cb){_0x5a97b8['push'](_0x4c03cb);})[_0xef8f('0x10')](function(){for(var _0x4fc5b1=0x0;_0x4fc5b1<_0x5a97b8[_0xef8f('0x1f')];_0x4fc5b1+=0x1){var _0x2cd237;var _0xdba8f6=_0x5a97b8[_0x4fc5b1];if(_0xcc351c){_0x2cd237=path[_0xef8f('0x21')](_0x383ddc,_0x4a3c5e,util[_0xef8f('0xb')](_0xef8f('0x23'),_0x4a3c5e,_0x4fc5b1,_0xef8f('0x24')));}else{_0x2cd237=path[_0xef8f('0x21')](_0x383ddc,util['format'](_0xef8f('0x25'),_0x4a3c5e,_0xef8f('0x24')));}fs[_0xef8f('0x26')](_0x2cd237,csv(_0xdba8f6));}})[_0xef8f('0x10')](function(){if(_0xcc351c){return new Promise(function(_0x3affd0){zipdir(path[_0xef8f('0x21')](_0x383ddc,_0x4a3c5e),{'saveTo':path['join'](_0x383ddc,util[_0xef8f('0xb')](_0xef8f('0x25'),_0x4a3c5e,_0xef8f('0x27')))},function(_0x12a52d,_0x31e1db){rimraf(path[_0xef8f('0x21')](_0x383ddc,_0x4a3c5e),function(){});_0x3affd0(_0xef8f('0x28'));});});}})[_0xef8f('0x10')](function(){logger[_0xef8f('0x29')](util[_0xef8f('0xb')](_0xef8f('0x2a'),EXTRACTED_REPORT_ID,_0xef8f('0xd')));return analyticExtractedReport(_0xef8f('0x2b'),_0xcc351c?util[_0xef8f('0xb')](_0xef8f('0x25'),_0x4a3c5e,_0xcc351c?'zip':_0xef8f('0x24')):null);});})['catch'](function(_0x566859){logger[_0xef8f('0x29')](util['format'](_0xef8f('0x2c'),EXTRACTED_REPORT_ID,_0xef8f('0xd')),util[_0xef8f('0x2d')](_0x566859,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xef8f('0x2e'));})[_0xef8f('0x2f')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x4881=['lodash','to-csv','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','QueryTypes','SELECT','Empty','length','num','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','join','mkdirSync','each','%s%d.%s','csv','%s.%s','zip','zip\x20finished','info','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','util','path'];(function(_0x4cefc3,_0x23f291){var _0x1cc779=function(_0x7cb914){while(--_0x7cb914){_0x4cefc3['push'](_0x4cefc3['shift']());}};_0x1cc779(++_0x23f291);}(_0x4881,0xee));var _0x1488=function(_0x559b69,_0x5b98bd){_0x559b69=_0x559b69-0x0;var _0x2ff0eb=_0x4881[_0x559b69];return _0x2ff0eb;};'use strict';var util=require(_0x1488('0x0'));var path=require(_0x1488('0x1'));var _=require(_0x1488('0x2'));var csv=require(_0x1488('0x3'));var fs=require('fs');var BPromise=require(_0x1488('0x4'));var zipdir=require(_0x1488('0x5'));var rimraf=require('rimraf');var db=require(_0x1488('0x6'))['db'];var dbH=require('../../mysqldb')[_0x1488('0x7')];var logger=require(_0x1488('0x8'))(_0x1488('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x1488('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x39f1c3,_0x330e90){var _0x494bce={'status':_0x39f1c3};var _0x489e63={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x330e90){_0x494bce[_0x1488('0xb')]=_0x330e90;}return db[_0x1488('0xc')][_0x1488('0xd')](_0x494bce,_0x489e63);}function main(){var _0xb401c3=0x1388;var _0x241601;logger['info'](util[_0x1488('0xe')](_0x1488('0xf'),EXTRACTED_REPORT_ID,_0x1488('0x10')));return db[_0x1488('0x11')][_0x1488('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x1488('0x13'),_0x1488('0x14')]})[_0x1488('0x15')](function(_0x58ca8f){if(_0x58ca8f){_0x241601=_0x58ca8f;_0xb401c3=_0x241601[_0x1488('0x14')]||0x1388;}})[_0x1488('0x15')](function(){return dbH[_0x1488('0x16')][_0x1488('0x17')](util[_0x1488('0xe')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x1488('0x16')][_0x1488('0x18')][_0x1488('0x19')]});})[_0x1488('0x15')](function(_0xe16546){if(!_0xe16546[0x0]['num']){return analyticExtractedReport(_0x1488('0x1a'));}var _0x2cb0b4=[];var _0x78eb7=0x0;if(_0x241601[_0x1488('0x13')]){if(_0xe16546&&_0xe16546[_0x1488('0x1b')]){var _0x45efe8=_['range'](_0xe16546[0x0][_0x1488('0x1c')]/_0xb401c3);var _0xfa4815=Number[_0x1488('0x1d')](_0xe16546[0x0]['num']/_0xb401c3)?_0xe16546[0x0][_0x1488('0x1c')]%_0xb401c3:0x0;_0x45efe8['forEach'](function(_0x3da331){if(_0x3da331>0x0){_0x78eb7+=_0xb401c3;}_0x2cb0b4[_0x1488('0x1e')](dbH['sequelize'][_0x1488('0x17')](util[_0x1488('0xe')](_0x1488('0x1f'),QUERY,_0xb401c3,_0x78eb7),{'type':dbH[_0x1488('0x16')]['QueryTypes'][_0x1488('0x19')]}));});if(_0xfa4815>0x0){_0x78eb7+=_0xb401c3;_0x2cb0b4[_0x1488('0x1e')](dbH[_0x1488('0x16')][_0x1488('0x17')](util['format'](_0x1488('0x1f'),QUERY,_0xfa4815,_0x78eb7),{'type':dbH[_0x1488('0x16')][_0x1488('0x18')][_0x1488('0x19')]}));}}}else{_0x2cb0b4[_0x1488('0x1e')](dbH[_0x1488('0x16')][_0x1488('0x17')](QUERY,{'type':dbH[_0x1488('0x16')][_0x1488('0x18')][_0x1488('0x19')]}));}var _0x234bf4=path[_0x1488('0x20')](PATH);var _0x43478d=path[_0x1488('0x21')](PATH,'.csv');var _0x205cf1=_0x241601['split']&&_0x2cb0b4[_0x1488('0x1b')]>0x1;var _0xa3b1c3=[];if(!fs['existsSync'](path[_0x1488('0x22')](_0x234bf4,_0x43478d))&&_0x205cf1){fs[_0x1488('0x23')](path[_0x1488('0x22')](_0x234bf4,_0x43478d));}return BPromise[_0x1488('0x24')](_0x2cb0b4,function(_0x298a92){_0xa3b1c3['push'](_0x298a92);})[_0x1488('0x15')](function(){for(var _0x113fee=0x0;_0x113fee<_0xa3b1c3[_0x1488('0x1b')];_0x113fee+=0x1){var _0x1b2cf7;var _0x2fc995=_0xa3b1c3[_0x113fee];if(_0x205cf1){_0x1b2cf7=path['join'](_0x234bf4,_0x43478d,util[_0x1488('0xe')](_0x1488('0x25'),_0x43478d,_0x113fee,_0x1488('0x26')));}else{_0x1b2cf7=path[_0x1488('0x22')](_0x234bf4,util[_0x1488('0xe')](_0x1488('0x27'),_0x43478d,_0x1488('0x26')));}fs['writeFileSync'](_0x1b2cf7,csv(_0x2fc995));}})[_0x1488('0x15')](function(){if(_0x205cf1){return new Promise(function(_0x5a9a8d){zipdir(path['join'](_0x234bf4,_0x43478d),{'saveTo':path[_0x1488('0x22')](_0x234bf4,util[_0x1488('0xe')]('%s.%s',_0x43478d,_0x1488('0x28')))},function(_0x46806b,_0x472fe7){rimraf(path['join'](_0x234bf4,_0x43478d),function(){});_0x5a9a8d(_0x1488('0x29'));});});}})[_0x1488('0x15')](function(){logger[_0x1488('0x2a')](util[_0x1488('0xe')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x1488('0x10')));return analyticExtractedReport(_0x1488('0x2b'),_0x205cf1?util[_0x1488('0xe')](_0x1488('0x27'),_0x43478d,_0x205cf1?'zip':_0x1488('0x26')):null);});})['catch'](function(_0x12a2e1){logger[_0x1488('0x2a')](util[_0x1488('0xe')](_0x1488('0x2c'),EXTRACTED_REPORT_ID,'CSV'),util[_0x1488('0x2d')](_0x12a2e1,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1488('0x2e'));})[_0x1488('0x2f')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index e8628dd..8eeb660 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 _0x9473=['jsdom','JSDOM','window','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','map','pick','value','fill','auto','body','concat','keys','forEach','push','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','length','header','pageBreak','before','landscape','toString','footer','Arial','black','right','Empty','Setting','then','splitSizePdf','range','isInteger','num','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','sequelize','dirname','basename','split','join','mkdirSync','each','flatten','createPdfKitDocument','%s%d.%s','%s.%s','pdf','all','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','AnalyticExtractedReport','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','info','inspect','Failed','exit','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','end','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x9473,0x159));var _0x3947=function(_0xe05963,_0x26fc82){_0xe05963=_0xe05963-0x0;var _0x54c3a3=_0x9473[_0xe05963];return _0x54c3a3;};'use strict';var _=require(_0x3947('0x0'));var fs=require('fs');var util=require(_0x3947('0x1'));var path=require(_0x3947('0x2'));var moment=require(_0x3947('0x3'));var htmlToPdfmake=require(_0x3947('0x4'));var PdfPrinter=require(_0x3947('0x5'));var zipdir=require(_0x3947('0x6'));var rimraf=require('rimraf');var JSDOM=require(_0x3947('0x7'))[_0x3947('0x8')];var window=new JSDOM('')[_0x3947('0x9')];var BPromise=require('bluebird');var db=require(_0x3947('0xa'))['db'];var dbH=require(_0x3947('0xa'))[_0x3947('0xb')];var logger=require(_0x3947('0xc'))(_0x3947('0xd'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x3947('0xe')][0x3];var PATH=process[_0x3947('0xe')][0x4];var NAME=process[_0x3947('0xe')][0x5];var FORMAT=_0x3947('0xf');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x2e1bf5,_0x539464){var _0x382f11={'status':_0x2e1bf5};var _0x3b95f9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x539464){_0x382f11['savename']=_0x539464;}return db['AnalyticExtractedReport']['update'](_0x382f11,_0x3b95f9);}function getHeaders(_0x502f4f){return _[_0x3947('0x10')](_0x502f4f,function(_0x464566){return{'text':_0x464566,'style':'tableHeader'};});}function getRows(_0x13d712,_0x3ee221){return _[_0x3947('0x10')](_0x3ee221,function(_0xc658a4){return _(_0xc658a4)[_0x3947('0x11')](_0x13d712)[_0x3947('0x10')](function(_0x5cf09b){return _0x5cf09b?_['toString'](_0x5cf09b):'';})[_0x3947('0x12')]();});}function createTable(_0x51d1cb,_0x289a01){var _0x1c29c6={'widths':_[_0x3947('0x13')](Array(_0x51d1cb['length']),0x91),'heights':function(_0x2b33ef){return _0x2b33ef===0x0?_0x3947('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x25da56=getHeaders(_0x51d1cb);_0x1c29c6['body']['push'](_0x25da56);var _0x301bf3=getRows(_0x51d1cb,_0x289a01);_0x1c29c6['body']=_0x1c29c6[_0x3947('0x15')][_0x3947('0x16')](_0x301bf3);return _0x1c29c6;}function createTables(_0x273b54){var _0x3a96ea=[];var _0x43edb7=_['chunk'](Object[_0x3947('0x17')](_0x273b54[0x0]),0x5);_0x43edb7[_0x3947('0x18')](function(_0x327897){_0x3a96ea[_0x3947('0x19')](createTable(_0x327897,_0x273b54));});return _0x3a96ea;}function getPDFDocDefinition(_0x1c1629){var _0x19305d=util[_0x3947('0x1a')](_0x3947('0x1b'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x3947('0x1c')])['format'](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x3947('0x1a')](FORMAT));var _0x5c2d6c=[];for(var _0x580a3d=0x0;_0x580a3d<_0x1c1629[_0x3947('0x1d')];_0x580a3d++){var _0x3a9522=[];if(_0x580a3d===0x0){_0x3a9522[_0x3947('0x19')]({'text':_0x19305d,'style':_0x3947('0x1e')});}var _0xaf39c1={'table':_0x1c1629[_0x580a3d]};if(_0x580a3d>0x0){_0xaf39c1[_0x3947('0x1f')]=_0x3947('0x20');_0xaf39c1['margin']=[0x0,0x46,0x0,0x0];}_0x3a9522[_0x3947('0x19')](_0xaf39c1);_0x5c2d6c[_0x3947('0x19')](_0x3a9522);}return{'pageSize':'A4','pageOrientation':_0x3947('0x21'),'content':_0x5c2d6c,'footer':function(_0x445fe5,_0xfa7016){return{'text':_0x445fe5[_0x3947('0x22')]()+'\x20/\x20'+_0xfa7016,'style':_0x3947('0x23')};},'defaultStyle':{'font':_0x3947('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x3947('0x25')},'footer':{'alignment':_0x3947('0x26'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x9e6940){var _0x52ae26=0x1388;var _0x2eaae9;if(!_0x9e6940[0x0]['num']){return analyticExtractedReport(_0x3947('0x27'));}return db[_0x3947('0x28')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizePdf']})[_0x3947('0x29')](function(_0x13c114){if(_0x13c114){_0x2eaae9=_0x13c114;_0x52ae26=_0x2eaae9[_0x3947('0x2a')]||0x3e8;}})[_0x3947('0x29')](function(){var _0x2a4b29=[];var _0x1af9fd=0x0;if(_0x2eaae9['split']){if(_0x9e6940&&_0x9e6940[_0x3947('0x1d')]){var _0x4a2e58=_[_0x3947('0x2b')](_0x9e6940[0x0]['num']/_0x52ae26);var _0x4a7fba=Number[_0x3947('0x2c')](_0x9e6940[0x0]['num']/_0x52ae26)?_0x9e6940[0x0][_0x3947('0x2d')]%_0x52ae26:0x0;_0x4a2e58[_0x3947('0x18')](function(_0x1ead60){if(_0x1ead60>0x0){_0x1af9fd+=_0x52ae26;}_0x2a4b29[_0x3947('0x19')](dbH['sequelize'][_0x3947('0x2e')](util[_0x3947('0x1a')](_0x3947('0x2f'),QUERY,_0x52ae26,_0x1af9fd),{'type':dbH['sequelize'][_0x3947('0x30')][_0x3947('0x31')]}));});if(_0x4a7fba>0x0){_0x1af9fd+=_0x52ae26;_0x2a4b29['push'](dbH['sequelize'][_0x3947('0x2e')](util['format'](_0x3947('0x2f'),QUERY,_0x4a7fba,_0x1af9fd),{'type':dbH[_0x3947('0x32')]['QueryTypes'][_0x3947('0x31')]}));}}}else{_0x2a4b29['push'](dbH[_0x3947('0x32')][_0x3947('0x2e')](QUERY,{'type':dbH[_0x3947('0x32')][_0x3947('0x30')][_0x3947('0x31')]}));}var _0x1ea8a1=path[_0x3947('0x33')](PATH);var _0x59b399=path[_0x3947('0x34')](PATH,'.pdf');var _0x303f2d=_0x2eaae9[_0x3947('0x35')]&&_0x2a4b29['length']>0x1;var _0x19df4a=[];if(!fs['existsSync'](path[_0x3947('0x36')](_0x1ea8a1,_0x59b399))&&_0x303f2d){fs[_0x3947('0x37')](path['join'](_0x1ea8a1,_0x59b399));}return BPromise[_0x3947('0x38')](_0x2a4b29,function(_0x40d014){_0x19df4a[_0x3947('0x19')](_0x40d014);})[_0x3947('0x29')](function(){var _0x5a2e43=[];for(var _0x3fa147=0x0;_0x3fa147<_0x19df4a[_0x3947('0x1d')];_0x3fa147+=0x1){var _0x3bea96=_0x19df4a[_0x3fa147];var _0x303cd5=createTables(_[_0x3947('0x39')](_0x3bea96));var _0x112002;var _0x32cb59=getPDFDocDefinition(_0x303cd5);var _0x5e87b9=getPDFPrinter();var _0x33634c=_0x5e87b9[_0x3947('0x3a')](_0x32cb59);if(_0x303f2d){_0x112002=path[_0x3947('0x36')](_0x1ea8a1,_0x59b399,util['format'](_0x3947('0x3b'),_0x59b399,_0x3fa147,'pdf'));}else{_0x112002=path[_0x3947('0x36')](_0x1ea8a1,util[_0x3947('0x1a')](_0x3947('0x3c'),_0x59b399,_0x3947('0x3d')));}_0x5a2e43[_0x3947('0x19')](writePDFDocument(_0x33634c,_0x112002));}return Promise[_0x3947('0x3e')](_0x5a2e43);})['then'](function(){if(_0x303f2d){return new Promise(function(_0x62ee30){zipdir(path['join'](_0x1ea8a1,_0x59b399),{'saveTo':path[_0x3947('0x36')](_0x1ea8a1,util[_0x3947('0x1a')](_0x3947('0x3c'),_0x59b399,_0x3947('0x3f')))},function(){rimraf(path['join'](_0x1ea8a1,_0x59b399),function(){});_0x62ee30('zip\x20finished');});});}})[_0x3947('0x29')](function(){if(!_0x303f2d)return;rimraf(path['join'](_0x1ea8a1,_0x59b399),function(){});})[_0x3947('0x29')](function(){logger['info'](util['format'](_0x3947('0x40'),EXTRACTED_REPORT_ID,_0x3947('0x41')));return analyticExtractedReport(_0x3947('0x42'),_0x303f2d?util[_0x3947('0x1a')](_0x3947('0x3c'),_0x59b399,_0x303f2d?_0x3947('0x3f'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x3947('0x1a')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x3947('0x41')));return db[_0x3947('0x43')][_0x3947('0x44')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0xbcb317){EXTRACTED_REPORT=_0xbcb317;return dbH[_0x3947('0x32')]['query'](util[_0x3947('0x1a')](_0x3947('0x45'),QUERY),{'type':dbH[_0x3947('0x32')]['QueryTypes']['SELECT']});})[_0x3947('0x29')](extractReport)[_0x3947('0x46')](function(_0x34f3df){logger[_0x3947('0x47')](util[_0x3947('0x1a')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x3947('0x41')),util[_0x3947('0x48')](_0x34f3df,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x3947('0x49'));})['finally'](function(){process[_0x3947('0x4a')](EXIT_CODE);});}main();function getPDFPrinter(){var _0xf1ed78=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x3947('0x4b'),'italics':__dirname+_0x3947('0x4c'),'bolditalics':__dirname+_0x3947('0x4d')}});return _0xf1ed78;}function getPDFDocDefinitionFromHTML(_0x35a835,_0x5d100d){var _0x1fcb43=util[_0x3947('0x1a')](_0x3947('0x4e'),_0x5d100d[_0x3947('0x4f')],_0x5d100d[_0x3947('0x50')]);var _0x41bad7=moment()[_0x3947('0x1a')]('YYYY-MM-DD')[_0x3947('0x22')]();var _0x7c62f5=htmlToPdfmake(_0x35a835,{'window':window,'tableAutoSize':!![]});return{'content':[_0x7c62f5],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x3947('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':'center'}},'header':function(){return[{'text':_0x3947('0x52'),'style':_0x3947('0x1e')}];},'footer':function(_0x356b0e,_0x35eed4){return[{'text':util['format'](_0x3947('0x53'),_0x1fcb43,_0x356b0e,_0x35eed4,_0x41bad7),'style':_0x3947('0x23')}];}};}function writePDFDocument(_0x313d37,_0x1e826b){return new Promise(function(_0x27459d,_0x40161e){var _0x492e45=_0x313d37[_0x3947('0x54')](fs[_0x3947('0x55')](_0x1e826b));_0x492e45['on'](_0x3947('0x56'),function(){_0x27459d(_0x3947('0x56'));});_0x492e45['on']('error',function(_0x4286d9){_0x40161e(_0x4286d9);});_0x313d37[_0x3947('0x57')]();});}exports['createPdfFromHTML']=function(_0x577dd6,_0x43095a){var _0x277a72=getPDFPrinter();var _0x5b648d=getPDFDocDefinitionFromHTML(_0x577dd6,_0x43095a);var _0x4ec66c=_0x277a72[_0x3947('0x3a')](_0x5b648d);return writePDFDocument(_0x4ec66c,_0x43095a['path'])[_0x3947('0x46')](function(_0x33ea98){throw _0x33ea98;});}; \ No newline at end of file +var _0x1e67=['Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','margin','landscape','toString','black','num','Empty','Setting','find','split','splitSizePdf','then','range','isInteger','sequelize','QueryTypes','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','basename','.pdf','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','pdf','%s.%s','all','zip','zip\x20finished','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','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','channel','interactionId','YYYY-MM-DD','Arial','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','createPdfFromHTML','lodash','path','moment','html-to-pdfmake','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','map','tableHeader','pick','value','length','auto','body','push','concat','chunk','keys','forEach','format'];(function(_0x496738,_0x3f1a9f){var _0xee1381=function(_0x4dc50c){while(--_0x4dc50c){_0x496738['push'](_0x496738['shift']());}};_0xee1381(++_0x3f1a9f);}(_0x1e67,0x156));var _0x71e6=function(_0xc5b815,_0x3e5a1b){_0xc5b815=_0xc5b815-0x0;var _0x7b7751=_0x1e67[_0xc5b815];return _0x7b7751;};'use strict';var _=require(_0x71e6('0x0'));var fs=require('fs');var util=require('util');var path=require(_0x71e6('0x1'));var moment=require(_0x71e6('0x2'));var htmlToPdfmake=require(_0x71e6('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require('zip-dir');var rimraf=require(_0x71e6('0x4'));var JSDOM=require(_0x71e6('0x5'))[_0x71e6('0x6')];var window=new JSDOM('')[_0x71e6('0x7')];var BPromise=require(_0x71e6('0x8'));var db=require(_0x71e6('0x9'))['db'];var dbH=require(_0x71e6('0x9'))[_0x71e6('0xa')];var logger=require(_0x71e6('0xb'))(_0x71e6('0xc'));var EXTRACTED_REPORT_ID=Number(process[_0x71e6('0xd')][0x2]);var QUERY=process[_0x71e6('0xd')][0x3];var PATH=process[_0x71e6('0xd')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x71e6('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x5b45c0,_0x436ad9){var _0x4a8522={'status':_0x5b45c0};var _0x5438e9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x436ad9){_0x4a8522[_0x71e6('0xf')]=_0x436ad9;}return db[_0x71e6('0x10')]['update'](_0x4a8522,_0x5438e9);}function getHeaders(_0x15cd4b){return _[_0x71e6('0x11')](_0x15cd4b,function(_0x230093){return{'text':_0x230093,'style':_0x71e6('0x12')};});}function getRows(_0x59598b,_0x2790d5){return _[_0x71e6('0x11')](_0x2790d5,function(_0x33adb2){return _(_0x33adb2)[_0x71e6('0x13')](_0x59598b)[_0x71e6('0x11')](function(_0xd5ae4e){return _0xd5ae4e?_['toString'](_0xd5ae4e):'';})[_0x71e6('0x14')]();});}function createTable(_0x3dd0dc,_0x31ff27){var _0x1b8202={'widths':_['fill'](Array(_0x3dd0dc[_0x71e6('0x15')]),0x91),'heights':function(_0x1a0a74){return _0x1a0a74===0x0?_0x71e6('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x14442e=getHeaders(_0x3dd0dc);_0x1b8202[_0x71e6('0x17')][_0x71e6('0x18')](_0x14442e);var _0x29f359=getRows(_0x3dd0dc,_0x31ff27);_0x1b8202[_0x71e6('0x17')]=_0x1b8202['body'][_0x71e6('0x19')](_0x29f359);return _0x1b8202;}function createTables(_0x53cccb){var _0x3da0b9=[];var _0x373285=_[_0x71e6('0x1a')](Object[_0x71e6('0x1b')](_0x53cccb[0x0]),0x5);_0x373285[_0x71e6('0x1c')](function(_0x25bd27){_0x3da0b9[_0x71e6('0x18')](createTable(_0x25bd27,_0x53cccb));});return _0x3da0b9;}function getPDFDocDefinition(_0x38bb87){var _0x487d1e=util[_0x71e6('0x1d')](_0x71e6('0x1e'),NAME,EXTRACTED_REPORT[_0x71e6('0x1f')],moment(EXTRACTED_REPORT[_0x71e6('0x20')])['format'](FORMAT),moment(EXTRACTED_REPORT[_0x71e6('0x21')])[_0x71e6('0x1d')](FORMAT));var _0x3eb6ad=[];for(var _0x7fa9ac=0x0;_0x7fa9ac<_0x38bb87[_0x71e6('0x15')];_0x7fa9ac++){var _0x2237b1=[];if(_0x7fa9ac===0x0){_0x2237b1[_0x71e6('0x18')]({'text':_0x487d1e,'style':_0x71e6('0x22')});}var _0x1a1677={'table':_0x38bb87[_0x7fa9ac]};if(_0x7fa9ac>0x0){_0x1a1677['pageBreak']='before';_0x1a1677[_0x71e6('0x23')]=[0x0,0x46,0x0,0x0];}_0x2237b1[_0x71e6('0x18')](_0x1a1677);_0x3eb6ad[_0x71e6('0x18')](_0x2237b1);}return{'pageSize':'A4','pageOrientation':_0x71e6('0x24'),'content':_0x3eb6ad,'footer':function(_0x47f047,_0x58659b){return{'text':_0x47f047[_0x71e6('0x25')]()+'\x20/\x20'+_0x58659b,'style':'footer'};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x71e6('0x26')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x2c25c4){var _0x64d60b=0x1388;var _0x453486;if(!_0x2c25c4[0x0][_0x71e6('0x27')]){return analyticExtractedReport(_0x71e6('0x28'));}return db[_0x71e6('0x29')][_0x71e6('0x2a')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x71e6('0x2b'),_0x71e6('0x2c')]})[_0x71e6('0x2d')](function(_0x1bf424){if(_0x1bf424){_0x453486=_0x1bf424;_0x64d60b=_0x453486[_0x71e6('0x2c')]||0x3e8;}})[_0x71e6('0x2d')](function(){var _0x56ba1e=[];var _0x35a077=0x0;if(_0x453486[_0x71e6('0x2b')]){if(_0x2c25c4&&_0x2c25c4[_0x71e6('0x15')]){var _0x3ae191=_[_0x71e6('0x2e')](_0x2c25c4[0x0][_0x71e6('0x27')]/_0x64d60b);var _0xe4f727=Number[_0x71e6('0x2f')](_0x2c25c4[0x0]['num']/_0x64d60b)?_0x2c25c4[0x0][_0x71e6('0x27')]%_0x64d60b:0x0;_0x3ae191[_0x71e6('0x1c')](function(_0x476795){if(_0x476795>0x0){_0x35a077+=_0x64d60b;}_0x56ba1e['push'](dbH[_0x71e6('0x30')]['query'](util[_0x71e6('0x1d')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x64d60b,_0x35a077),{'type':dbH[_0x71e6('0x30')][_0x71e6('0x31')]['SELECT']}));});if(_0xe4f727>0x0){_0x35a077+=_0x64d60b;_0x56ba1e[_0x71e6('0x18')](dbH[_0x71e6('0x30')][_0x71e6('0x32')](util[_0x71e6('0x1d')](_0x71e6('0x33'),QUERY,_0xe4f727,_0x35a077),{'type':dbH['sequelize'][_0x71e6('0x31')][_0x71e6('0x34')]}));}}}else{_0x56ba1e[_0x71e6('0x18')](dbH['sequelize'][_0x71e6('0x32')](QUERY,{'type':dbH[_0x71e6('0x30')][_0x71e6('0x31')][_0x71e6('0x34')]}));}var _0x5c6cd8=path['dirname'](PATH);var _0x4af1c7=path[_0x71e6('0x35')](PATH,_0x71e6('0x36'));var _0x1426db=_0x453486['split']&&_0x56ba1e[_0x71e6('0x15')]>0x1;var _0x16fb1c=[];if(!fs[_0x71e6('0x37')](path[_0x71e6('0x38')](_0x5c6cd8,_0x4af1c7))&&_0x1426db){fs[_0x71e6('0x39')](path[_0x71e6('0x38')](_0x5c6cd8,_0x4af1c7));}return BPromise[_0x71e6('0x3a')](_0x56ba1e,function(_0x71eca){_0x16fb1c[_0x71e6('0x18')](_0x71eca);})[_0x71e6('0x2d')](function(){var _0x1f4bb3=[];for(var _0x43b800=0x0;_0x43b800<_0x16fb1c[_0x71e6('0x15')];_0x43b800+=0x1){var _0x11a49b=_0x16fb1c[_0x43b800];var _0x4b720d=createTables(_[_0x71e6('0x3b')](_0x11a49b));var _0x2baccc;var _0x5f2c9f=getPDFDocDefinition(_0x4b720d);var _0x243a76=getPDFPrinter();var _0x9d3e0c=_0x243a76[_0x71e6('0x3c')](_0x5f2c9f);if(_0x1426db){_0x2baccc=path[_0x71e6('0x38')](_0x5c6cd8,_0x4af1c7,util[_0x71e6('0x1d')]('%s%d.%s',_0x4af1c7,_0x43b800,_0x71e6('0x3d')));}else{_0x2baccc=path[_0x71e6('0x38')](_0x5c6cd8,util['format'](_0x71e6('0x3e'),_0x4af1c7,_0x71e6('0x3d')));}_0x1f4bb3['push'](writePDFDocument(_0x9d3e0c,_0x2baccc));}return Promise[_0x71e6('0x3f')](_0x1f4bb3);})[_0x71e6('0x2d')](function(){if(_0x1426db){return new Promise(function(_0x45de17){zipdir(path[_0x71e6('0x38')](_0x5c6cd8,_0x4af1c7),{'saveTo':path[_0x71e6('0x38')](_0x5c6cd8,util['format'](_0x71e6('0x3e'),_0x4af1c7,_0x71e6('0x40')))},function(){rimraf(path[_0x71e6('0x38')](_0x5c6cd8,_0x4af1c7),function(){});_0x45de17(_0x71e6('0x41'));});});}})['then'](function(){if(!_0x1426db)return;rimraf(path['join'](_0x5c6cd8,_0x4af1c7),function(){});})[_0x71e6('0x2d')](function(){logger[_0x71e6('0x42')](util[_0x71e6('0x1d')](_0x71e6('0x43'),EXTRACTED_REPORT_ID,_0x71e6('0x44')));return analyticExtractedReport(_0x71e6('0x45'),_0x1426db?util[_0x71e6('0x1d')](_0x71e6('0x3e'),_0x4af1c7,_0x1426db?_0x71e6('0x40'):_0x71e6('0x3d')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x71e6('0x42')](util[_0x71e6('0x1d')](_0x71e6('0x46'),EXTRACTED_REPORT_ID,'PDF'));return db[_0x71e6('0x10')][_0x71e6('0x47')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x71e6('0x2d')](function(_0x385520){EXTRACTED_REPORT=_0x385520;return dbH[_0x71e6('0x30')][_0x71e6('0x32')](util[_0x71e6('0x1d')](_0x71e6('0x48'),QUERY),{'type':dbH[_0x71e6('0x30')][_0x71e6('0x31')][_0x71e6('0x34')]});})[_0x71e6('0x2d')](extractReport)[_0x71e6('0x49')](function(_0x4f6b29){logger[_0x71e6('0x42')](util[_0x71e6('0x1d')](_0x71e6('0x4a'),EXTRACTED_REPORT_ID,'PDF'),util[_0x71e6('0x4b')](_0x4f6b29,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x71e6('0x4c'));})['finally'](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x5fd528=new PdfPrinter({'Arial':{'normal':__dirname+_0x71e6('0x4d'),'bold':__dirname+_0x71e6('0x4e'),'italics':__dirname+_0x71e6('0x4f'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x5fd528;}function getPDFDocDefinitionFromHTML(_0x33f57d,_0x519b61){var _0x94ccab=util['format']('%s\x20#%d',_0x519b61[_0x71e6('0x50')],_0x519b61[_0x71e6('0x51')]);var _0x27ff45=moment()['format'](_0x71e6('0x52'))[_0x71e6('0x25')]();var _0x5ed62c=htmlToPdfmake(_0x33f57d,{'window':window,'tableAutoSize':!![]});return{'content':[_0x5ed62c],'defaultStyle':{'font':_0x71e6('0x53')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x71e6('0x54'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x71e6('0x54'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0x71e6('0x55'),'style':_0x71e6('0x22')}];},'footer':function(_0x986e36,_0x2e0b98){return[{'text':util[_0x71e6('0x1d')](_0x71e6('0x56'),_0x94ccab,_0x986e36,_0x2e0b98,_0x27ff45),'style':_0x71e6('0x57')}];}};}function writePDFDocument(_0xb3592,_0x3f3d60){return new Promise(function(_0x4f58be,_0x8a120d){var _0x5650de=_0xb3592[_0x71e6('0x58')](fs[_0x71e6('0x59')](_0x3f3d60));_0x5650de['on'](_0x71e6('0x5a'),function(){_0x4f58be(_0x71e6('0x5a'));});_0x5650de['on'](_0x71e6('0x5b'),function(_0x24c241){_0x8a120d(_0x24c241);});_0xb3592['end']();});}exports[_0x71e6('0x5c')]=function(_0xe2662d,_0x3d2e37){var _0x4ff976=getPDFPrinter();var _0x5cbfd1=getPDFDocDefinitionFromHTML(_0xe2662d,_0x3d2e37);var _0x8e9700=_0x4ff976[_0x71e6('0x3c')](_0x5cbfd1);return writePDFDocument(_0x8e9700,_0x3d2e37[_0x71e6('0x1')])[_0x71e6('0x49')](function(_0x5ad286){throw _0x5ad286;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 4bb2fd0..2497924 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 _0x964a=['find','split','splitSizeXlsx','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','range','format','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','.xlsx','length','existsSync','join','mkdirSync','each','%s.%s','binary','zip','Completed','xlsx','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX'];(function(_0x89e812,_0x1e498a){var _0x5efbb4=function(_0x406e2a){while(--_0x406e2a){_0x89e812['push'](_0x89e812['shift']());}};_0x5efbb4(++_0x1e498a);}(_0x964a,0x13a));var _0xa964=function(_0x1d1e29,_0x2977a6){_0x1d1e29=_0x1d1e29-0x0;var _0x52cf9f=_0x964a[_0x1d1e29];return _0x52cf9f;};'use strict';var util=require(_0xa964('0x0'));var path=require(_0xa964('0x1'));var _=require(_0xa964('0x2'));var fs=require('fs');var json2xls=require(_0xa964('0x3'));var BPromise=require(_0xa964('0x4'));var zipdir=require(_0xa964('0x5'));var rimraf=require(_0xa964('0x6'));var db=require(_0xa964('0x7'))['db'];var dbH=require(_0xa964('0x7'))[_0xa964('0x8')];var logger=require(_0xa964('0x9'))(_0xa964('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0xa964('0xb')][0x2]);var QUERY=process[_0xa964('0xb')][0x3];var PATH=process[_0xa964('0xb')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x41dda6,_0x4bf9fd){var _0x37ce3e={'status':_0x41dda6};var _0x3eae36={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4bf9fd){_0x37ce3e[_0xa964('0xc')]=_0x4bf9fd;}return db['AnalyticExtractedReport']['update'](_0x37ce3e,_0x3eae36);}function main(){var _0x6073b6=0x1388;var _0x3e7e5d;logger['info'](util['format'](_0xa964('0xd'),EXTRACTED_REPORT_ID,_0xa964('0xe')));return db['Setting'][_0xa964('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa964('0x10'),_0xa964('0x11')]})[_0xa964('0x12')](function(_0x228e7a){if(_0x228e7a){_0x3e7e5d=_0x228e7a;_0x6073b6=_0x3e7e5d[_0xa964('0x11')]||0x1388;}})[_0xa964('0x12')](function(){return dbH['sequelize'][_0xa964('0x13')](util['format'](_0xa964('0x14'),QUERY),{'type':dbH[_0xa964('0x15')][_0xa964('0x16')][_0xa964('0x17')]});})[_0xa964('0x12')](function(_0x4163eb){if(!_0x4163eb[0x0][_0xa964('0x18')]){return analyticExtractedReport(_0xa964('0x19'));}var _0x89a48f=[];var _0x248edd=0x0;if(_0x3e7e5d[_0xa964('0x10')]){if(_0x4163eb&&_0x4163eb['length']){var _0x3b0c60=_[_0xa964('0x1a')](_0x4163eb[0x0][_0xa964('0x18')]/_0x6073b6);var _0x58b250=Number['isInteger'](_0x4163eb[0x0]['num']/_0x6073b6)?_0x4163eb[0x0][_0xa964('0x18')]%_0x6073b6:0x0;_0x3b0c60['forEach'](function(_0x4b1204){if(_0x4b1204>0x0){_0x248edd+=_0x6073b6;}_0x89a48f['push'](dbH[_0xa964('0x15')][_0xa964('0x13')](util[_0xa964('0x1b')](_0xa964('0x1c'),QUERY,_0x6073b6,_0x248edd),{'type':dbH[_0xa964('0x15')]['QueryTypes'][_0xa964('0x17')]}));});if(_0x58b250>0x0){_0x248edd+=_0x6073b6;_0x89a48f[_0xa964('0x1d')](dbH[_0xa964('0x15')]['query'](util[_0xa964('0x1b')](_0xa964('0x1c'),QUERY,_0x58b250,_0x248edd),{'type':dbH[_0xa964('0x15')][_0xa964('0x16')][_0xa964('0x17')]}));}}}else{_0x89a48f[_0xa964('0x1d')](dbH[_0xa964('0x15')][_0xa964('0x13')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0xa964('0x17')]}));}var _0x294bba=path[_0xa964('0x1e')](PATH);var _0x3e7ccc=path[_0xa964('0x1f')](PATH,_0xa964('0x20'));var _0x5c50dd=_0x3e7e5d['split']&&_0x89a48f[_0xa964('0x21')]>0x1;var _0x3fe27c=[];if(!fs[_0xa964('0x22')](path[_0xa964('0x23')](_0x294bba,_0x3e7ccc))&&_0x5c50dd){fs[_0xa964('0x24')](path[_0xa964('0x23')](_0x294bba,_0x3e7ccc));}return BPromise[_0xa964('0x25')](_0x89a48f,function(_0x159514){_0x3fe27c[_0xa964('0x1d')](_0x159514);})[_0xa964('0x12')](function(){for(var _0x50d23e=0x0;_0x50d23e<_0x3fe27c[_0xa964('0x21')];_0x50d23e+=0x1){var _0x5a2329;var _0x4d62c7=_0x3fe27c[_0x50d23e];if(_0x5c50dd){_0x5a2329=path[_0xa964('0x23')](_0x294bba,_0x3e7ccc,util[_0xa964('0x1b')]('%s%d.%s',_0x3e7ccc,_0x50d23e,'xlsx'));}else{_0x5a2329=path[_0xa964('0x23')](_0x294bba,util['format'](_0xa964('0x26'),_0x3e7ccc,'xlsx'));}fs['writeFileSync'](_0x5a2329,json2xls(_0x4d62c7),_0xa964('0x27'));}})['then'](function(){if(_0x5c50dd){return new Promise(function(_0x5e082a){zipdir(path['join'](_0x294bba,_0x3e7ccc),{'saveTo':path[_0xa964('0x23')](_0x294bba,util[_0xa964('0x1b')](_0xa964('0x26'),_0x3e7ccc,_0xa964('0x28')))},function(_0x1f0afd,_0x1efc31){rimraf(path[_0xa964('0x23')](_0x294bba,_0x3e7ccc),function(){});_0x5e082a('zip\x20finished');});});}})['then'](function(){logger['info'](util[_0xa964('0x1b')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0xa964('0x29'),_0x5c50dd?util[_0xa964('0x1b')]('%s.%s',_0x3e7ccc,_0x5c50dd?'zip':_0xa964('0x2a')):null);});})['catch'](function(_0x3737df){logger['info'](util[_0xa964('0x1b')](_0xa964('0x2b'),EXTRACTED_REPORT_ID,'XLSX'),util[_0xa964('0x2c')](_0x3737df,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xa964('0x2d'));})[_0xa964('0x2e')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x41f6=['info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','length','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','.xlsx','existsSync','mkdirSync','join','each','%s%d.%s','xlsx','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','%s.%s','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update'];(function(_0x51c866,_0x3f8edb){var _0x566fbb=function(_0x3d62cd){while(--_0x3d62cd){_0x51c866['push'](_0x51c866['shift']());}};_0x566fbb(++_0x3f8edb);}(_0x41f6,0x8e));var _0x641f=function(_0x597484,_0x199340){_0x597484=_0x597484-0x0;var _0x218e64=_0x41f6[_0x597484];return _0x218e64;};'use strict';var util=require(_0x641f('0x0'));var path=require('path');var _=require(_0x641f('0x1'));var fs=require('fs');var json2xls=require(_0x641f('0x2'));var BPromise=require(_0x641f('0x3'));var zipdir=require(_0x641f('0x4'));var rimraf=require(_0x641f('0x5'));var db=require(_0x641f('0x6'))['db'];var dbH=require(_0x641f('0x6'))[_0x641f('0x7')];var logger=require(_0x641f('0x8'))(_0x641f('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x641f('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x641f('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x48c950,_0x5448f0){var _0x3425ca={'status':_0x48c950};var _0x116a33={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5448f0){_0x3425ca[_0x641f('0xb')]=_0x5448f0;}return db[_0x641f('0xc')][_0x641f('0xd')](_0x3425ca,_0x116a33);}function main(){var _0xba086a=0x1388;var _0x58a75b;logger[_0x641f('0xe')](util[_0x641f('0xf')](_0x641f('0x10'),EXTRACTED_REPORT_ID,_0x641f('0x11')));return db[_0x641f('0x12')][_0x641f('0x13')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x641f('0x14'),'splitSizeXlsx']})['then'](function(_0x589ac5){if(_0x589ac5){_0x58a75b=_0x589ac5;_0xba086a=_0x58a75b[_0x641f('0x15')]||0x1388;}})[_0x641f('0x16')](function(){return dbH['sequelize'][_0x641f('0x17')](util[_0x641f('0xf')](_0x641f('0x18'),QUERY),{'type':dbH[_0x641f('0x19')][_0x641f('0x1a')][_0x641f('0x1b')]});})[_0x641f('0x16')](function(_0x5b0660){if(!_0x5b0660[0x0][_0x641f('0x1c')]){return analyticExtractedReport('Empty');}var _0x5a1b7f=[];var _0x4fa8d7=0x0;if(_0x58a75b[_0x641f('0x14')]){if(_0x5b0660&&_0x5b0660[_0x641f('0x1d')]){var _0x2c1312=_['range'](_0x5b0660[0x0]['num']/_0xba086a);var _0x33bd72=Number[_0x641f('0x1e')](_0x5b0660[0x0]['num']/_0xba086a)?_0x5b0660[0x0][_0x641f('0x1c')]%_0xba086a:0x0;_0x2c1312[_0x641f('0x1f')](function(_0x58f8df){if(_0x58f8df>0x0){_0x4fa8d7+=_0xba086a;}_0x5a1b7f[_0x641f('0x20')](dbH[_0x641f('0x19')][_0x641f('0x17')](util['format'](_0x641f('0x21'),QUERY,_0xba086a,_0x4fa8d7),{'type':dbH[_0x641f('0x19')][_0x641f('0x1a')][_0x641f('0x1b')]}));});if(_0x33bd72>0x0){_0x4fa8d7+=_0xba086a;_0x5a1b7f[_0x641f('0x20')](dbH[_0x641f('0x19')]['query'](util[_0x641f('0xf')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x33bd72,_0x4fa8d7),{'type':dbH['sequelize'][_0x641f('0x1a')]['SELECT']}));}}}else{_0x5a1b7f[_0x641f('0x20')](dbH[_0x641f('0x19')][_0x641f('0x17')](QUERY,{'type':dbH[_0x641f('0x19')][_0x641f('0x1a')][_0x641f('0x1b')]}));}var _0x4a3d2a=path['dirname'](PATH);var _0x2b2452=path['basename'](PATH,_0x641f('0x22'));var _0x85a549=_0x58a75b[_0x641f('0x14')]&&_0x5a1b7f[_0x641f('0x1d')]>0x1;var _0x2e69bd=[];if(!fs[_0x641f('0x23')](path['join'](_0x4a3d2a,_0x2b2452))&&_0x85a549){fs[_0x641f('0x24')](path[_0x641f('0x25')](_0x4a3d2a,_0x2b2452));}return BPromise[_0x641f('0x26')](_0x5a1b7f,function(_0x5d7774){_0x2e69bd[_0x641f('0x20')](_0x5d7774);})['then'](function(){for(var _0x346bda=0x0;_0x346bda<_0x2e69bd['length'];_0x346bda+=0x1){var _0x2ec67b;var _0x4a4b9f=_0x2e69bd[_0x346bda];if(_0x85a549){_0x2ec67b=path[_0x641f('0x25')](_0x4a3d2a,_0x2b2452,util[_0x641f('0xf')](_0x641f('0x27'),_0x2b2452,_0x346bda,_0x641f('0x28')));}else{_0x2ec67b=path['join'](_0x4a3d2a,util[_0x641f('0xf')]('%s.%s',_0x2b2452,_0x641f('0x28')));}fs[_0x641f('0x29')](_0x2ec67b,json2xls(_0x4a4b9f),_0x641f('0x2a'));}})[_0x641f('0x16')](function(){if(_0x85a549){return new Promise(function(_0x2967a4){zipdir(path['join'](_0x4a3d2a,_0x2b2452),{'saveTo':path[_0x641f('0x25')](_0x4a3d2a,util['format']('%s.%s',_0x2b2452,_0x641f('0x2b')))},function(_0x2a2070,_0x41088b){rimraf(path[_0x641f('0x25')](_0x4a3d2a,_0x2b2452),function(){});_0x2967a4('zip\x20finished');});});}})[_0x641f('0x16')](function(){logger['info'](util['format'](_0x641f('0x2c'),EXTRACTED_REPORT_ID,_0x641f('0x11')));return analyticExtractedReport(_0x641f('0x2d'),_0x85a549?util[_0x641f('0xf')](_0x641f('0x2e'),_0x2b2452,_0x85a549?_0x641f('0x2b'):_0x641f('0x28')):null);});})[_0x641f('0x2f')](function(_0x160ad8){logger[_0x641f('0xe')](util[_0x641f('0xf')](_0x641f('0x30'),EXTRACTED_REPORT_ID,_0x641f('0x11')),util[_0x641f('0x31')](_0x160ad8,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x641f('0x32')](function(){process[_0x641f('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 e593a1f..dc71fbf 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 _0x3ca3=['appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','findAll','then','VoiceExtension','IntervalId','map','filter','groupBy','exten','playback','extensions','find','push','type','format','CDR(type)=%s','context','priority','VoiceExtensionId','inbound','Set','outbound','extension','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','createdAt','updatedAt','interval','intervals','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','toLowerCase'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x3ca3,0x185));var _0x33ca=function(_0x4aa936,_0x5efbe7){_0x4aa936=_0x4aa936-0x0;var _0x131b34=_0x3ca3[_0x4aa936];return _0x131b34;};'use strict';var _=require(_0x33ca('0x0'));var util=require(_0x33ca('0x1'));function rewrite(_0x5daf08,_0x291efc){var _0x38128e=this;return _0x5daf08[_0x33ca('0x2')]['Interval'][_0x33ca('0x3')]({'raw':!![]})[_0x33ca('0x4')](function(_0x4cbd54){_0x38128e['intervals']=_0x4cbd54;return _0x5daf08[_0x33ca('0x2')][_0x33ca('0x5')]['findAll']({'where':{'IntervalId':_0x291efc[_0x33ca('0x6')]},'raw':!![]});})[_0x33ca('0x4')](function(_0x50312c){return _0x5daf08[_0x33ca('0x2')][_0x33ca('0x5')][_0x33ca('0x3')]({'where':{'exten':{'$in':_['uniq'](_[_0x33ca('0x7')](_0x50312c,'exten'))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x33ca('0x4')](function(_0x301450){var _0x5a47c6=_[_0x33ca('0x8')](_0x301450,{'priority':'1'});var _0x1f50af=_['filter'](_0x301450,{'isApp':0x1});var _0x55a522=_[_0x33ca('0x9')](_0x1f50af,_0x33ca('0xa'));var _0x3d4459=['queue',_0x33ca('0xb')];var _0x34d1a1=[];var _0x1a5f51=[];for(var _0xffa5c7 in _0x55a522){if(_0x55a522['hasOwnProperty'](_0xffa5c7)){_0x38128e['priority']=0x2;_0x38128e[_0x33ca('0xc')]=[];_0x38128e['extension']=_[_0x33ca('0xd')](_0x5a47c6,{'exten':_0x55a522[_0xffa5c7][0x0][_0x33ca('0xa')]});_0x38128e['extensions'][_0x33ca('0xe')]({'type':_0x55a522[_0xffa5c7][0x0][_0x33ca('0xf')],'app':'Set','appdata':util[_0x33ca('0x10')](_0x33ca('0x11'),_0x55a522[_0xffa5c7][0x0][_0x33ca('0xf')]),'context':_0x55a522[_0xffa5c7][0x0][_0x33ca('0x12')],'exten':_0x55a522[_0xffa5c7][0x0]['exten'],'priority':_0x38128e[_0x33ca('0x13')]++,'VoiceExtensionId':_0x55a522[_0xffa5c7][0x0][_0x33ca('0x14')]});if(_0x55a522[_0xffa5c7][0x0][_0x33ca('0xf')]===_0x33ca('0x15')){_0x38128e[_0x33ca('0xc')][_0x33ca('0xe')]({'type':_0x55a522[_0xffa5c7][0x0]['type'],'app':_0x33ca('0x16'),'appdata':'CDR(routeid)='+_0x55a522[_0xffa5c7][0x0][_0x33ca('0x14')],'context':_0x55a522[_0xffa5c7][0x0][_0x33ca('0x12')],'exten':_0x55a522[_0xffa5c7][0x0]['exten'],'priority':_0x38128e[_0x33ca('0x13')]++,'VoiceExtensionId':_0x55a522[_0xffa5c7][0x0]['VoiceExtensionId']});}else if(_0x55a522[_0xffa5c7][0x0]['type']===_0x33ca('0x17')){if(_0x38128e[_0x33ca('0x18')]){_0x38128e[_0x33ca('0xc')]['push']({'type':_0x55a522[_0xffa5c7][0x0][_0x33ca('0xf')],'app':_0x33ca('0x16'),'appdata':_0x33ca('0x19')+(_0x38128e['extension'][_0x33ca('0x1a')]?_0x33ca('0x1b')+_0x38128e[_0x33ca('0x18')][_0x33ca('0x1a')]+'}':_0x33ca('0x1c')),'context':_0x55a522[_0xffa5c7][0x0][_0x33ca('0x12')],'exten':_0x55a522[_0xffa5c7][0x0]['exten'],'priority':_0x38128e['priority']++,'VoiceExtensionId':_0x55a522[_0xffa5c7][0x0][_0x33ca('0x14')]});}_0x38128e['extensions'][_0x33ca('0xe')]({'type':_0x55a522[_0xffa5c7][0x0][_0x33ca('0xf')],'app':_0x33ca('0x16'),'appdata':'CDR(routeid)='+_0x55a522[_0xffa5c7][0x0][_0x33ca('0x14')],'context':_0x55a522[_0xffa5c7][0x0][_0x33ca('0x12')],'exten':_0x55a522[_0xffa5c7][0x0]['exten'],'priority':_0x38128e['priority']++,'VoiceExtensionId':_0x55a522[_0xffa5c7][0x0]['VoiceExtensionId']});var _0x4b48d5=_0x38128e[_0x33ca('0x13')]++;_0x38128e[_0x33ca('0xc')][_0x33ca('0xe')]({'type':_0x55a522[_0xffa5c7][0x0]['type'],'app':_0x33ca('0x1d'),'appdata':_0x33ca('0x1e')+(_0x4b48d5+0x2)+_0x33ca('0x1f')+(_0x4b48d5+0x1)+')','context':_0x55a522[_0xffa5c7][0x0][_0x33ca('0x12')],'exten':_0x55a522[_0xffa5c7][0x0]['exten'],'priority':_0x4b48d5,'VoiceExtensionId':_0x55a522[_0xffa5c7][0x0][_0x33ca('0x14')]});if(_0x38128e[_0x33ca('0x18')]){_0x38128e[_0x33ca('0xc')][_0x33ca('0xe')]({'type':_0x55a522[_0xffa5c7][0x0]['type'],'app':_0x33ca('0x16'),'appdata':_0x38128e[_0x33ca('0x18')][_0x33ca('0x1a')]?_0x33ca('0x20')+_0x38128e[_0x33ca('0x18')][_0x33ca('0x1a')]+'}':_0x33ca('0x21'),'context':_0x55a522[_0xffa5c7][0x0][_0x33ca('0x12')],'exten':_0x55a522[_0xffa5c7][0x0]['exten'],'priority':_0x38128e[_0x33ca('0x13')]++,'VoiceExtensionId':_0x55a522[_0xffa5c7][0x0][_0x33ca('0x14')]});}_0x38128e[_0x33ca('0xc')][_0x33ca('0xe')]({'type':_0x55a522[_0xffa5c7][0x0]['type'],'app':_0x33ca('0x16'),'appdata':_0x33ca('0x22')+_0x55a522[_0xffa5c7][0x0]['VoiceExtensionId'],'context':_0x55a522[_0xffa5c7][0x0][_0x33ca('0x12')],'exten':_0x55a522[_0xffa5c7][0x0]['exten'],'priority':_0x38128e[_0x33ca('0x13')]++,'VoiceExtensionId':_0x55a522[_0xffa5c7][0x0]['VoiceExtensionId']});if(_0x38128e[_0x33ca('0x18')]&&_0x38128e[_0x33ca('0x18')][_0x33ca('0x23')](_0x33ca('0x24'))&&_0x38128e[_0x33ca('0x18')]['recordingFormat']!==_0x33ca('0x25')){_0x38128e[_0x33ca('0xc')][_0x33ca('0xe')]({'type':_0x55a522[_0xffa5c7][0x0][_0x33ca('0xf')],'app':_0x33ca('0x16'),'appdata':_0x33ca('0x26'),'context':_0x55a522[_0xffa5c7][0x0][_0x33ca('0x12')],'exten':_0x55a522[_0xffa5c7][0x0][_0x33ca('0xa')],'priority':_0x38128e[_0x33ca('0x13')]++,'VoiceExtensionId':_0x55a522[_0xffa5c7][0x0][_0x33ca('0x14')]});_0x38128e[_0x33ca('0xc')][_0x33ca('0xe')]({'type':_0x55a522[_0xffa5c7][0x0][_0x33ca('0xf')],'app':_0x33ca('0x16'),'appdata':_0x33ca('0x27')+_0x38128e[_0x33ca('0x18')][_0x33ca('0x24')]||'wav','context':_0x55a522[_0xffa5c7][0x0][_0x33ca('0x12')],'exten':_0x55a522[_0xffa5c7][0x0][_0x33ca('0xa')],'priority':_0x38128e[_0x33ca('0x13')]++,'VoiceExtensionId':_0x55a522[_0xffa5c7][0x0][_0x33ca('0x14')]});}}_0x38128e[_0x33ca('0xc')]['push']({'type':_0x55a522[_0xffa5c7][0x0][_0x33ca('0xf')],'app':_0x33ca('0x16'),'appdata':_0x33ca('0x28'),'context':_0x55a522[_0xffa5c7][0x0][_0x33ca('0x12')],'exten':_0x55a522[_0xffa5c7][0x0]['exten'],'priority':_0x38128e[_0x33ca('0x13')]++,'VoiceExtensionId':_0x55a522[_0xffa5c7][0x0][_0x33ca('0x14')]});_0x38128e[_0x33ca('0xc')]['push']({'type':_0x55a522[_0xffa5c7][0x0][_0x33ca('0xf')],'app':_0x33ca('0x16'),'appdata':_0x33ca('0x29'),'context':_0x55a522[_0xffa5c7][0x0][_0x33ca('0x12')],'exten':_0x55a522[_0xffa5c7][0x0][_0x33ca('0xa')],'priority':_0x38128e[_0x33ca('0x13')]++,'VoiceExtensionId':_0x55a522[_0xffa5c7][0x0]['VoiceExtensionId']});_0x38128e['extensions'][_0x33ca('0xe')]({'type':_0x55a522[_0xffa5c7][0x0]['type'],'app':_0x33ca('0x16'),'appdata':'MONITOR_OPTIONS=ab','context':_0x55a522[_0xffa5c7][0x0]['context'],'exten':_0x55a522[_0xffa5c7][0x0]['exten'],'priority':_0x38128e[_0x33ca('0x13')]++,'VoiceExtensionId':_0x55a522[_0xffa5c7][0x0][_0x33ca('0x14')]});for(var _0x2efcd1=0x0,_0xfb56c6=0x0;_0x2efcd1<_0x55a522[_0xffa5c7][_0x33ca('0x2a')];_0x2efcd1+=0x1,_0xfb56c6=0x0){var _0x5dd6ae=_0x55a522[_0xffa5c7][_0x2efcd1];if(_0x5dd6ae[_0x33ca('0xf')]){_0x5dd6ae[_0x33ca('0xf')]=_0x5dd6ae[_0x33ca('0xf')]['toLowerCase']();}var _0x26570f=[];var _0x412e5f=[];delete _0x5dd6ae['id'];delete _0x5dd6ae[_0x33ca('0x2b')];delete _0x5dd6ae[_0x33ca('0x2c')];var _0x3e9af2=_0x5dd6ae[_0x33ca('0x2d')]!=='*,*,*,*'?[_0x5dd6ae[_0x33ca('0x2d')]]:_0x5dd6ae[_0x33ca('0x6')]?_[_0x33ca('0x7')](_[_0x33ca('0x8')](_0x38128e[_0x33ca('0x2e')],{'IntervalId':_0x5dd6ae['IntervalId']}),_0x33ca('0x2d')):[];if(_0x5dd6ae[_0x33ca('0x23')](_0x33ca('0x2f'))){if(_0x5dd6ae[_0x33ca('0x2f')]&&_0x5dd6ae['tag']!=='--'){_0x26570f[_0x33ca('0xe')]({'type':_0x5dd6ae[_0x33ca('0xf')],'app':_0x33ca('0x16'),'appdata':'CDR(tag)='+_0x5dd6ae['tag'],'context':_0x5dd6ae[_0x33ca('0x12')],'exten':_0x5dd6ae['exten'],'priority':_0x3e9af2[_0x33ca('0x2a')]+_0x38128e[_0x33ca('0x13')]+_0xfb56c6++,'VoiceExtensionId':_0x5dd6ae[_0x33ca('0x14')]});}}if(_0x5dd6ae[_0x33ca('0xf')]==='outbound'&&_0x5dd6ae[_0x33ca('0x23')](_0x33ca('0x30'))){if(_0x5dd6ae[_0x33ca('0x30')]){_0x26570f[_0x33ca('0xe')]({'type':_0x5dd6ae[_0x33ca('0xf')],'app':_0x33ca('0x1d'),'appdata':_0x33ca('0x31')+_0x5dd6ae['callerID']+')','context':_0x5dd6ae[_0x33ca('0x12')],'exten':_0x5dd6ae[_0x33ca('0xa')],'priority':_0x3e9af2[_0x33ca('0x2a')]+_0x38128e[_0x33ca('0x13')]+_0xfb56c6++,'VoiceExtensionId':_0x5dd6ae[_0x33ca('0x14')]});}else{_0x26570f[_0x33ca('0xe')]({'type':_0x5dd6ae['type'],'app':_0x33ca('0x1d'),'appdata':_0x33ca('0x32'),'context':_0x5dd6ae[_0x33ca('0x12')],'exten':_0x5dd6ae[_0x33ca('0xa')],'priority':_0x3e9af2[_0x33ca('0x2a')]+_0x38128e[_0x33ca('0x13')]+_0xfb56c6++,'VoiceExtensionId':_0x5dd6ae[_0x33ca('0x14')]});}}if(_0x5dd6ae['hasOwnProperty'](_0x33ca('0x33'))){if(_0x3d4459[_0x33ca('0x34')](_0x5dd6ae[_0x33ca('0x35')][_0x33ca('0x36')]())>=0x0&&_0x5dd6ae[_0x33ca('0x37')]!==_0x33ca('0x38')){if(_0x5dd6ae['answer']){_0x26570f[_0x33ca('0xe')]({'type':_0x5dd6ae[_0x33ca('0xf')],'app':_0x33ca('0x1d'),'appdata':_0x33ca('0x39'),'context':_0x5dd6ae['context'],'exten':_0x5dd6ae[_0x33ca('0xa')],'priority':_0x3e9af2['length']+_0x38128e['priority']+_0xfb56c6++,'VoiceExtensionId':_0x5dd6ae['VoiceExtensionId']});_0x26570f[_0x33ca('0xe')]({'type':_0x5dd6ae['type'],'app':_0x33ca('0x16'),'appdata':_0x33ca('0x3a'),'context':_0x5dd6ae['context'],'exten':_0x5dd6ae[_0x33ca('0xa')],'priority':_0x3e9af2[_0x33ca('0x2a')]+_0x38128e[_0x33ca('0x13')]+_0xfb56c6++,'VoiceExtensionId':_0x5dd6ae[_0x33ca('0x14')]});}else{_0x26570f['push']({'type':_0x5dd6ae[_0x33ca('0xf')],'app':'ExecIf','appdata':_0x33ca('0x3b'),'context':_0x5dd6ae[_0x33ca('0x12')],'exten':_0x5dd6ae['exten'],'priority':_0x3e9af2[_0x33ca('0x2a')]+_0x38128e[_0x33ca('0x13')]+_0xfb56c6++,'VoiceExtensionId':_0x5dd6ae[_0x33ca('0x14')]});_0x26570f['push']({'type':_0x5dd6ae[_0x33ca('0xf')],'app':_0x33ca('0x16'),'appdata':_0x33ca('0x3c'),'context':_0x5dd6ae['context'],'exten':_0x5dd6ae[_0x33ca('0xa')],'priority':_0x3e9af2[_0x33ca('0x2a')]+_0x38128e['priority']+_0xfb56c6++,'VoiceExtensionId':_0x5dd6ae[_0x33ca('0x14')]});}}}for(var _0x232ceb=0x0;_0x232ceb<_0x3e9af2[_0x33ca('0x2a')];_0x232ceb+=0x1){var _0x1cbebc=_0x38128e[_0x33ca('0x13')]+_0x3e9af2[_0x33ca('0x2a')];var _0x3707fb=_0x232ceb===_0x3e9af2[_0x33ca('0x2a')]-0x1?_0x38128e[_0x33ca('0x13')]+_0x26570f[_0x33ca('0x2a')]+_0x412e5f[_0x33ca('0x2a')]+0x2:_0x38128e[_0x33ca('0x13')]+_0x232ceb+0x1;_0x26570f[_0x33ca('0x3d')](_0x232ceb,0x0,{'type':_0x5dd6ae[_0x33ca('0xf')],'app':_0x33ca('0x3e'),'appdata':_0x3e9af2[_0x232ceb]+'?'+_0x5dd6ae['context']+_0x33ca('0x3f')+_0x1cbebc+':'+_0x5dd6ae[_0x33ca('0x12')]+_0x33ca('0x3f')+_0x3707fb,'exten':_0x5dd6ae[_0x33ca('0xa')],'context':_0x5dd6ae[_0x33ca('0x12')],'priority':_0x38128e[_0x33ca('0x13')]+_0x232ceb,'VoiceExtensionId':_0x55a522[_0xffa5c7][0x0][_0x33ca('0x14')]});}_0x5dd6ae[_0x33ca('0x13')]=_0x26570f['length']?_[_0x33ca('0x40')](_0x26570f)[_0x33ca('0x13')]+0x1:_0x38128e[_0x33ca('0x13')];_0x38128e['priority']=(_0x412e5f['length']?_[_0x33ca('0x40')](_0x412e5f)[_0x33ca('0x13')]:_0x5dd6ae['priority'])+0x1;_0x38128e[_0x33ca('0xc')]=_[_0x33ca('0x41')](_0x38128e[_0x33ca('0xc')],_0x26570f,[_0x5dd6ae],_0x412e5f);}_0x38128e['extensions'][_0x33ca('0xe')]({'type':_0x55a522[_0xffa5c7][0x0][_0x33ca('0xf')],'app':_0x33ca('0x42'),'exten':_0x55a522[_0xffa5c7][0x0]['exten'],'context':_0x55a522[_0xffa5c7][0x0][_0x33ca('0x12')],'priority':_0x38128e[_0x33ca('0x13')],'VoiceExtensionId':_0x55a522[_0xffa5c7][0x0]['VoiceExtensionId']});_0x34d1a1['push'](_0x55a522[_0xffa5c7][0x0][_0x33ca('0x14')]);_0x1a5f51=_[_0x33ca('0x41')](_0x1a5f51,_0x38128e['extensions']);}}return _0x5daf08[_0x33ca('0x43')](function(_0x154859){return _0x5daf08['models'][_0x33ca('0x5')][_0x33ca('0x44')]({'where':{'VoiceExtensionId':{'$in':_0x34d1a1}},'transaction':_0x154859})[_0x33ca('0x4')](function(_0x19ff3e){return _0x5daf08[_0x33ca('0x2')][_0x33ca('0x5')][_0x33ca('0x45')](_[_0x33ca('0x46')](_0x1a5f51,_0x33ca('0x13')),{'transaction':_0x154859});});});})[_0x33ca('0x47')](function(_0x3b2307){console[_0x33ca('0x48')](_0x3b2307);});}exports[_0x33ca('0x49')]=rewrite; \ No newline at end of file +var _0x497e=['push','type','Set','format','CDR(type)=%s','context','priority','VoiceExtensionId','inbound','extension','CDR(destination)=','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','cutdigits','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','app','toLowerCase','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress',',${EXTEN},','last','concat','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','Interval','findAll','then','intervals','models','IntervalId','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','find','extensions'];(function(_0x38d6d9,_0x1084cc){var _0x3fb2db=function(_0x4e9896){while(--_0x4e9896){_0x38d6d9['push'](_0x38d6d9['shift']());}};_0x3fb2db(++_0x1084cc);}(_0x497e,0x14a));var _0xe497=function(_0x2f214c,_0x2b62ac){_0x2f214c=_0x2f214c-0x0;var _0x21a510=_0x497e[_0x2f214c];return _0x21a510;};'use strict';var _=require(_0xe497('0x0'));var util=require(_0xe497('0x1'));function rewrite(_0x6b0690,_0x584fce){var _0x273de9=this;return _0x6b0690['models'][_0xe497('0x2')][_0xe497('0x3')]({'raw':!![]})[_0xe497('0x4')](function(_0xe62fee){_0x273de9[_0xe497('0x5')]=_0xe62fee;return _0x6b0690[_0xe497('0x6')]['VoiceExtension'][_0xe497('0x3')]({'where':{'IntervalId':_0x584fce[_0xe497('0x7')]},'raw':!![]});})[_0xe497('0x4')](function(_0x40f5dc){return _0x6b0690[_0xe497('0x6')][_0xe497('0x8')][_0xe497('0x3')]({'where':{'exten':{'$in':_[_0xe497('0x9')](_[_0xe497('0xa')](_0x40f5dc,_0xe497('0xb')))}},'order':[{'raw':_0xe497('0xc')}],'raw':!![]});})[_0xe497('0x4')](function(_0x1f991f){var _0x362423=_[_0xe497('0xd')](_0x1f991f,{'priority':'1'});var _0x48b3a8=_[_0xe497('0xd')](_0x1f991f,{'isApp':0x1});var _0x3a17a9=_[_0xe497('0xe')](_0x48b3a8,_0xe497('0xb'));var _0x69693f=[_0xe497('0xf'),_0xe497('0x10')];var _0x28bddf=[];var _0x4179a8=[];for(var _0x263c8f in _0x3a17a9){if(_0x3a17a9[_0xe497('0x11')](_0x263c8f)){_0x273de9['priority']=0x2;_0x273de9['extensions']=[];_0x273de9['extension']=_[_0xe497('0x12')](_0x362423,{'exten':_0x3a17a9[_0x263c8f][0x0][_0xe497('0xb')]});_0x273de9[_0xe497('0x13')][_0xe497('0x14')]({'type':_0x3a17a9[_0x263c8f][0x0][_0xe497('0x15')],'app':_0xe497('0x16'),'appdata':util[_0xe497('0x17')](_0xe497('0x18'),_0x3a17a9[_0x263c8f][0x0][_0xe497('0x15')]),'context':_0x3a17a9[_0x263c8f][0x0][_0xe497('0x19')],'exten':_0x3a17a9[_0x263c8f][0x0][_0xe497('0xb')],'priority':_0x273de9[_0xe497('0x1a')]++,'VoiceExtensionId':_0x3a17a9[_0x263c8f][0x0][_0xe497('0x1b')]});if(_0x3a17a9[_0x263c8f][0x0]['type']===_0xe497('0x1c')){_0x273de9[_0xe497('0x13')][_0xe497('0x14')]({'type':_0x3a17a9[_0x263c8f][0x0][_0xe497('0x15')],'app':'Set','appdata':'CDR(routeid)='+_0x3a17a9[_0x263c8f][0x0][_0xe497('0x1b')],'context':_0x3a17a9[_0x263c8f][0x0][_0xe497('0x19')],'exten':_0x3a17a9[_0x263c8f][0x0][_0xe497('0xb')],'priority':_0x273de9['priority']++,'VoiceExtensionId':_0x3a17a9[_0x263c8f][0x0][_0xe497('0x1b')]});}else if(_0x3a17a9[_0x263c8f][0x0][_0xe497('0x15')]==='outbound'){if(_0x273de9[_0xe497('0x1d')]){_0x273de9[_0xe497('0x13')][_0xe497('0x14')]({'type':_0x3a17a9[_0x263c8f][0x0]['type'],'app':_0xe497('0x16'),'appdata':_0xe497('0x1e')+(_0x273de9[_0xe497('0x1d')]['cutdigits']?'${EXTEN:'+_0x273de9[_0xe497('0x1d')]['cutdigits']+'}':_0xe497('0x1f')),'context':_0x3a17a9[_0x263c8f][0x0][_0xe497('0x19')],'exten':_0x3a17a9[_0x263c8f][0x0][_0xe497('0xb')],'priority':_0x273de9[_0xe497('0x1a')]++,'VoiceExtensionId':_0x3a17a9[_0x263c8f][0x0][_0xe497('0x1b')]});}_0x273de9[_0xe497('0x13')][_0xe497('0x14')]({'type':_0x3a17a9[_0x263c8f][0x0][_0xe497('0x15')],'app':_0xe497('0x16'),'appdata':_0xe497('0x20')+_0x3a17a9[_0x263c8f][0x0][_0xe497('0x1b')],'context':_0x3a17a9[_0x263c8f][0x0][_0xe497('0x19')],'exten':_0x3a17a9[_0x263c8f][0x0][_0xe497('0xb')],'priority':_0x273de9['priority']++,'VoiceExtensionId':_0x3a17a9[_0x263c8f][0x0]['VoiceExtensionId']});var _0x40fd0c=_0x273de9[_0xe497('0x1a')]++;_0x273de9['extensions']['push']({'type':_0x3a17a9[_0x263c8f][0x0][_0xe497('0x15')],'app':_0xe497('0x21'),'appdata':_0xe497('0x22')+(_0x40fd0c+0x2)+_0xe497('0x23')+(_0x40fd0c+0x1)+')','context':_0x3a17a9[_0x263c8f][0x0][_0xe497('0x19')],'exten':_0x3a17a9[_0x263c8f][0x0][_0xe497('0xb')],'priority':_0x40fd0c,'VoiceExtensionId':_0x3a17a9[_0x263c8f][0x0]['VoiceExtensionId']});if(_0x273de9[_0xe497('0x1d')]){_0x273de9['extensions'][_0xe497('0x14')]({'type':_0x3a17a9[_0x263c8f][0x0]['type'],'app':_0xe497('0x16'),'appdata':_0x273de9[_0xe497('0x1d')][_0xe497('0x24')]?_0xe497('0x25')+_0x273de9[_0xe497('0x1d')][_0xe497('0x24')]+'}':_0xe497('0x26'),'context':_0x3a17a9[_0x263c8f][0x0][_0xe497('0x19')],'exten':_0x3a17a9[_0x263c8f][0x0]['exten'],'priority':_0x273de9['priority']++,'VoiceExtensionId':_0x3a17a9[_0x263c8f][0x0][_0xe497('0x1b')]});}_0x273de9[_0xe497('0x13')]['push']({'type':_0x3a17a9[_0x263c8f][0x0][_0xe497('0x15')],'app':_0xe497('0x16'),'appdata':_0xe497('0x27')+_0x3a17a9[_0x263c8f][0x0][_0xe497('0x1b')],'context':_0x3a17a9[_0x263c8f][0x0]['context'],'exten':_0x3a17a9[_0x263c8f][0x0][_0xe497('0xb')],'priority':_0x273de9[_0xe497('0x1a')]++,'VoiceExtensionId':_0x3a17a9[_0x263c8f][0x0][_0xe497('0x1b')]});if(_0x273de9[_0xe497('0x1d')]&&_0x273de9[_0xe497('0x1d')][_0xe497('0x11')](_0xe497('0x28'))&&_0x273de9[_0xe497('0x1d')][_0xe497('0x28')]!==_0xe497('0x29')){_0x273de9[_0xe497('0x13')]['push']({'type':_0x3a17a9[_0x263c8f][0x0][_0xe497('0x15')],'app':_0xe497('0x16'),'appdata':_0xe497('0x2a'),'context':_0x3a17a9[_0x263c8f][0x0]['context'],'exten':_0x3a17a9[_0x263c8f][0x0]['exten'],'priority':_0x273de9[_0xe497('0x1a')]++,'VoiceExtensionId':_0x3a17a9[_0x263c8f][0x0][_0xe497('0x1b')]});_0x273de9[_0xe497('0x13')][_0xe497('0x14')]({'type':_0x3a17a9[_0x263c8f][0x0]['type'],'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x273de9['extension']['recordingFormat']||'wav','context':_0x3a17a9[_0x263c8f][0x0]['context'],'exten':_0x3a17a9[_0x263c8f][0x0][_0xe497('0xb')],'priority':_0x273de9[_0xe497('0x1a')]++,'VoiceExtensionId':_0x3a17a9[_0x263c8f][0x0][_0xe497('0x1b')]});}}_0x273de9[_0xe497('0x13')]['push']({'type':_0x3a17a9[_0x263c8f][0x0][_0xe497('0x15')],'app':_0xe497('0x16'),'appdata':_0xe497('0x2b'),'context':_0x3a17a9[_0x263c8f][0x0]['context'],'exten':_0x3a17a9[_0x263c8f][0x0][_0xe497('0xb')],'priority':_0x273de9[_0xe497('0x1a')]++,'VoiceExtensionId':_0x3a17a9[_0x263c8f][0x0][_0xe497('0x1b')]});_0x273de9[_0xe497('0x13')][_0xe497('0x14')]({'type':_0x3a17a9[_0x263c8f][0x0][_0xe497('0x15')],'app':_0xe497('0x16'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x3a17a9[_0x263c8f][0x0][_0xe497('0x19')],'exten':_0x3a17a9[_0x263c8f][0x0][_0xe497('0xb')],'priority':_0x273de9[_0xe497('0x1a')]++,'VoiceExtensionId':_0x3a17a9[_0x263c8f][0x0][_0xe497('0x1b')]});_0x273de9[_0xe497('0x13')][_0xe497('0x14')]({'type':_0x3a17a9[_0x263c8f][0x0]['type'],'app':_0xe497('0x16'),'appdata':_0xe497('0x2c'),'context':_0x3a17a9[_0x263c8f][0x0][_0xe497('0x19')],'exten':_0x3a17a9[_0x263c8f][0x0][_0xe497('0xb')],'priority':_0x273de9[_0xe497('0x1a')]++,'VoiceExtensionId':_0x3a17a9[_0x263c8f][0x0][_0xe497('0x1b')]});for(var _0x2d04b2=0x0,_0x388d10=0x0;_0x2d04b2<_0x3a17a9[_0x263c8f][_0xe497('0x2d')];_0x2d04b2+=0x1,_0x388d10=0x0){var _0x3c3ce5=_0x3a17a9[_0x263c8f][_0x2d04b2];if(_0x3c3ce5[_0xe497('0x15')]){_0x3c3ce5[_0xe497('0x15')]=_0x3c3ce5[_0xe497('0x15')]['toLowerCase']();}var _0x494658=[];var _0x4493f9=[];delete _0x3c3ce5['id'];delete _0x3c3ce5['createdAt'];delete _0x3c3ce5[_0xe497('0x2e')];var _0x414c99=_0x3c3ce5[_0xe497('0x2f')]!==_0xe497('0x30')?[_0x3c3ce5[_0xe497('0x2f')]]:_0x3c3ce5[_0xe497('0x7')]?_['map'](_['filter'](_0x273de9['intervals'],{'IntervalId':_0x3c3ce5[_0xe497('0x7')]}),_0xe497('0x2f')):[];if(_0x3c3ce5[_0xe497('0x11')](_0xe497('0x31'))){if(_0x3c3ce5[_0xe497('0x31')]&&_0x3c3ce5[_0xe497('0x31')]!=='--'){_0x494658[_0xe497('0x14')]({'type':_0x3c3ce5['type'],'app':_0xe497('0x16'),'appdata':_0xe497('0x32')+_0x3c3ce5[_0xe497('0x31')],'context':_0x3c3ce5['context'],'exten':_0x3c3ce5['exten'],'priority':_0x414c99['length']+_0x273de9[_0xe497('0x1a')]+_0x388d10++,'VoiceExtensionId':_0x3c3ce5[_0xe497('0x1b')]});}}if(_0x3c3ce5[_0xe497('0x15')]==='outbound'&&_0x3c3ce5['hasOwnProperty'](_0xe497('0x33'))){if(_0x3c3ce5['callerID']){_0x494658[_0xe497('0x14')]({'type':_0x3c3ce5['type'],'app':_0xe497('0x21'),'appdata':_0xe497('0x34')+_0x3c3ce5[_0xe497('0x33')]+')','context':_0x3c3ce5[_0xe497('0x19')],'exten':_0x3c3ce5[_0xe497('0xb')],'priority':_0x414c99[_0xe497('0x2d')]+_0x273de9[_0xe497('0x1a')]+_0x388d10++,'VoiceExtensionId':_0x3c3ce5[_0xe497('0x1b')]});}else{_0x494658[_0xe497('0x14')]({'type':_0x3c3ce5[_0xe497('0x15')],'app':_0xe497('0x21'),'appdata':_0xe497('0x35'),'context':_0x3c3ce5[_0xe497('0x19')],'exten':_0x3c3ce5[_0xe497('0xb')],'priority':_0x414c99['length']+_0x273de9[_0xe497('0x1a')]+_0x388d10++,'VoiceExtensionId':_0x3c3ce5[_0xe497('0x1b')]});}}if(_0x3c3ce5[_0xe497('0x11')](_0xe497('0x36'))){if(_0x69693f['indexOf'](_0x3c3ce5[_0xe497('0x37')][_0xe497('0x38')]())>=0x0&&_0x3c3ce5[_0xe497('0x39')]!==_0xe497('0x3a')){if(_0x3c3ce5[_0xe497('0x36')]){_0x494658['push']({'type':_0x3c3ce5[_0xe497('0x15')],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x3c3ce5[_0xe497('0x19')],'exten':_0x3c3ce5['exten'],'priority':_0x414c99[_0xe497('0x2d')]+_0x273de9['priority']+_0x388d10++,'VoiceExtensionId':_0x3c3ce5['VoiceExtensionId']});_0x494658[_0xe497('0x14')]({'type':_0x3c3ce5[_0xe497('0x15')],'app':_0xe497('0x16'),'appdata':_0xe497('0x3b'),'context':_0x3c3ce5['context'],'exten':_0x3c3ce5[_0xe497('0xb')],'priority':_0x414c99[_0xe497('0x2d')]+_0x273de9[_0xe497('0x1a')]+_0x388d10++,'VoiceExtensionId':_0x3c3ce5[_0xe497('0x1b')]});}else{_0x494658['push']({'type':_0x3c3ce5['type'],'app':_0xe497('0x21'),'appdata':_0xe497('0x3c'),'context':_0x3c3ce5[_0xe497('0x19')],'exten':_0x3c3ce5[_0xe497('0xb')],'priority':_0x414c99[_0xe497('0x2d')]+_0x273de9[_0xe497('0x1a')]+_0x388d10++,'VoiceExtensionId':_0x3c3ce5['VoiceExtensionId']});_0x494658['push']({'type':_0x3c3ce5['type'],'app':_0xe497('0x16'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x3c3ce5[_0xe497('0x19')],'exten':_0x3c3ce5[_0xe497('0xb')],'priority':_0x414c99[_0xe497('0x2d')]+_0x273de9[_0xe497('0x1a')]+_0x388d10++,'VoiceExtensionId':_0x3c3ce5[_0xe497('0x1b')]});}}}for(var _0x377367=0x0;_0x377367<_0x414c99[_0xe497('0x2d')];_0x377367+=0x1){var _0x807f1f=_0x273de9['priority']+_0x414c99[_0xe497('0x2d')];var _0x187d16=_0x377367===_0x414c99[_0xe497('0x2d')]-0x1?_0x273de9[_0xe497('0x1a')]+_0x494658['length']+_0x4493f9[_0xe497('0x2d')]+0x2:_0x273de9[_0xe497('0x1a')]+_0x377367+0x1;_0x494658['splice'](_0x377367,0x0,{'type':_0x3c3ce5[_0xe497('0x15')],'app':'GotoIfTime','appdata':_0x414c99[_0x377367]+'?'+_0x3c3ce5[_0xe497('0x19')]+',${EXTEN},'+_0x807f1f+':'+_0x3c3ce5[_0xe497('0x19')]+_0xe497('0x3d')+_0x187d16,'exten':_0x3c3ce5[_0xe497('0xb')],'context':_0x3c3ce5[_0xe497('0x19')],'priority':_0x273de9[_0xe497('0x1a')]+_0x377367,'VoiceExtensionId':_0x3a17a9[_0x263c8f][0x0][_0xe497('0x1b')]});}_0x3c3ce5[_0xe497('0x1a')]=_0x494658[_0xe497('0x2d')]?_['last'](_0x494658)['priority']+0x1:_0x273de9[_0xe497('0x1a')];_0x273de9[_0xe497('0x1a')]=(_0x4493f9[_0xe497('0x2d')]?_[_0xe497('0x3e')](_0x4493f9)[_0xe497('0x1a')]:_0x3c3ce5['priority'])+0x1;_0x273de9['extensions']=_[_0xe497('0x3f')](_0x273de9[_0xe497('0x13')],_0x494658,[_0x3c3ce5],_0x4493f9);}_0x273de9[_0xe497('0x13')]['push']({'type':_0x3a17a9[_0x263c8f][0x0][_0xe497('0x15')],'app':'Hangup','exten':_0x3a17a9[_0x263c8f][0x0]['exten'],'context':_0x3a17a9[_0x263c8f][0x0][_0xe497('0x19')],'priority':_0x273de9[_0xe497('0x1a')],'VoiceExtensionId':_0x3a17a9[_0x263c8f][0x0][_0xe497('0x1b')]});_0x28bddf[_0xe497('0x14')](_0x3a17a9[_0x263c8f][0x0][_0xe497('0x1b')]);_0x4179a8=_['concat'](_0x4179a8,_0x273de9[_0xe497('0x13')]);}}return _0x6b0690['transaction'](function(_0x3a8a9a){return _0x6b0690['models']['VoiceExtension'][_0xe497('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x28bddf}},'transaction':_0x3a8a9a})[_0xe497('0x4')](function(_0x22f6cd){return _0x6b0690[_0xe497('0x6')][_0xe497('0x8')][_0xe497('0x41')](_[_0xe497('0x42')](_0x4179a8,_0xe497('0x1a')),{'transaction':_0x3a8a9a});});});})[_0xe497('0x43')](function(_0x518269){console[_0xe497('0x44')](_0x518269);});}exports[_0xe497('0x45')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 97ae58f..dfa5841 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 _0xbd1d=['errors','message','join','hasOwnProperty','data','firstName','phone','error','phone\x20not\x20specified!','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','find','duplicate','Duplicate\x20Contact','CmContact','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','select','field','NOW()','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','insert','updatedAt','id\x20IN\x20?','calleridnum','str','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','query','VoiceQueueId','onlyIfOpen','sequelize','all','BlackLists','CampaignId','Campaign','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','stringify','finally','emit','contact:csv_','resume','resolve','Unable\x20to\x20delete\x20temp\x20file:','exit','info','CSV\x20import\x20process\x20stopped!','split','createReadStream','parse','pause','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','api','redis','defaults','localhost','socket.io-emitter','register','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','Missing\x20socket_timestamp\x20parameter!','contact','index','test','isNil','length','map'];(function(_0x6e33cf,_0xfd52e0){var _0x38fcb6=function(_0x4f1ef7){while(--_0x4f1ef7){_0x6e33cf['push'](_0x6e33cf['shift']());}};_0x38fcb6(++_0xfd52e0);}(_0xbd1d,0x1a5));var _0xdbd1=function(_0x3355c0,_0x4b530b){_0x3355c0=_0x3355c0-0x0;var _0x5a3288=_0xbd1d[_0x3355c0];return _0x5a3288;};'use strict';var BPromise=require(_0xdbd1('0x0'));var util=require(_0xdbd1('0x1'));var _=require(_0xdbd1('0x2'));var fs=require('fs');var squel=require(_0xdbd1('0x3'));var Papa=require(_0xdbd1('0x4'));var Redis=require(_0xdbd1('0x5'));var db=require(_0xdbd1('0x6'))['db'];var config=require(_0xdbd1('0x7'));var logger=require('../../../config/logger')(_0xdbd1('0x8'));config[_0xdbd1('0x9')]=_[_0xdbd1('0xa')](config[_0xdbd1('0x9')],{'host':_0xdbd1('0xb'),'port':0x18eb});var socket=require(_0xdbd1('0xc'))(new Redis(config[_0xdbd1('0x9')]));require('../../../api/cmContact/cmContact.socket')[_0xdbd1('0xd')](socket);try{if(!process['argv'][0x2]||process[_0xdbd1('0xe')][0x2]==='undefined'||process['argv'][0x2]===_0xdbd1('0xf')){throw new Error(_0xdbd1('0x10'));}var FILEPATH=process['argv'][0x2];if(!process[_0xdbd1('0xe')][0x3]||process[_0xdbd1('0xe')][0x3]===_0xdbd1('0x11')||process[_0xdbd1('0xe')][0x3]==='null'||!process['argv'][0x4]||process[_0xdbd1('0xe')][0x4]===_0xdbd1('0x11')||process['argv'][0x4]===_0xdbd1('0xf')){throw new Error(_0xdbd1('0x12'));}var FIELDS=_[_0xdbd1('0x13')](process[_0xdbd1('0xe')][0x3]['split'](','),process['argv'][0x4]['split'](','));if(!process[_0xdbd1('0xe')][0x5]||process['argv'][0x5]===_0xdbd1('0x11')||process[_0xdbd1('0xe')][0x5]===_0xdbd1('0xf')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0xdbd1('0xe')][0x5];var COMPANYID=process[_0xdbd1('0xe')][0x6]&&process['argv'][0x6]!==_0xdbd1('0x11')&&process[_0xdbd1('0xe')][0x6]!==_0xdbd1('0xf')?process[_0xdbd1('0xe')][0x6]:null;var DUPLICATES=process[_0xdbd1('0xe')][0x7]&&process[_0xdbd1('0xe')][0x7]!==_0xdbd1('0x11')&&process['argv'][0x7]!==_0xdbd1('0xf')?process[_0xdbd1('0xe')][0x7]:null;if(!process[_0xdbd1('0xe')][0x8]||process[_0xdbd1('0xe')][0x8]===_0xdbd1('0x11')||process['argv'][0x8]===_0xdbd1('0xf')){throw new Error(_0xdbd1('0x14'));}var SOCKET_TIMESTAMP=process[_0xdbd1('0xe')][0x8];}catch(_0x345ca0){logger['error'](_0x345ca0);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(_0x3f70a9,_0x5530c6,_0x1b1152,_0x2ed59c){var _0x3d4abe={'message':_0x5530c6};_0x3d4abe[_0x3f70a9]=!![];if(_0x1b1152){_0x3d4abe[_0xdbd1('0x15')]=_0x1b1152;}if(_0x2ed59c){_0x3d4abe[_0xdbd1('0x16')]=_0x2ed59c;}return _0x3d4abe;}function isEmail(_0x395509){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))*$/[_0xdbd1('0x17')](_0x395509);}function checkRow(_0x4a8a81,_0x5d335b,_0x2bf2ff){return new BPromise(function(_0x231d52,_0x3c6941){if(_[_0xdbd1('0x18')](_0x4a8a81)){return _0x3c6941(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x2bf2ff));}if(_0x4a8a81['errors']&&_0x4a8a81['errors'][_0xdbd1('0x19')]){var _0x2f985f=_[_0xdbd1('0x1a')](_0x4a8a81[_0xdbd1('0x1b')],_0xdbd1('0x1c'))[_0xdbd1('0x1d')](';');return _0x3c6941(handleCheckRowError('error',_0x2f985f,null,_0x2bf2ff));}var _0x5ba403={};for(var _0x2c6fc9 in FIELDS){if(FIELDS[_0xdbd1('0x1e')](_0x2c6fc9)&&FIELDS[_0x2c6fc9]){_0x5ba403[_0x2c6fc9]=_0x4a8a81[_0xdbd1('0x1f')][0x0][FIELDS[_0x2c6fc9]]||_0x4a8a81[_0xdbd1('0x1f')][0x0]['\ufeff'+FIELDS[_0x2c6fc9]];}}if(!_0x5ba403[_0xdbd1('0x20')]){return _0x3c6941(handleCheckRowError('error','firstName\x20not\x20specified!',null,_0x2bf2ff));}if(!_0x5ba403[_0xdbd1('0x21')]){return _0x3c6941(handleCheckRowError(_0xdbd1('0x22'),_0xdbd1('0x23'),null,_0x2bf2ff));}if(_0x5ba403['birthDate']){var _0x1211d4=moment(_0x5ba403['birthDate'],_0xdbd1('0x24'));if(!_0x1211d4[_0xdbd1('0x25')]()){return _0x3c6941(handleCheckRowError('error',_0xdbd1('0x26'),null,_0x2bf2ff));}}if(_0x5ba403[_0xdbd1('0x27')]){if(!isEmail(_0x5ba403['email'])){return _0x3c6941(handleCheckRowError(_0xdbd1('0x22'),_0xdbd1('0x28'),null,_0x2bf2ff));}}_0x5ba403[_0xdbd1('0x29')]=LISTID;_0x5ba403['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xdbd1('0x19')]&&_0x5d335b){var _0x117042={};for(var _0x16c2b1=0x0,_0x4e10b5=DUPLICATES[_0xdbd1('0x19')];_0x16c2b1<_0x4e10b5;_0x16c2b1+=0x1){_0x117042[DUPLICATES[_0x16c2b1]]=_0x5ba403[DUPLICATES[_0x16c2b1]];}var _0x42ec38=_[_0xdbd1('0x2a')](_0x5d335b,_0x117042);if(_0x42ec38){return _0x3c6941(handleCheckRowError(_0xdbd1('0x2b'),_0xdbd1('0x2c'),_0x42ec38,_0x2bf2ff));}}return db[_0xdbd1('0x2d')]['create'](_0x5ba403,{'raw':!![],'hooks':![],'fields':_[_0xdbd1('0x2e')](_0x5ba403)})[_0xdbd1('0x2f')](function(_0x15c451){if(DUPLICATES&&DUPLICATES['length']&&_0x5d335b){_0x5d335b[_0xdbd1('0x30')](_[_0xdbd1('0x31')](_0x5ba403,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x15c451['id'];return _0x231d52();})[_0xdbd1('0x32')](function(_0x4926ee){return _0x3c6941(handleCheckRowError(_0xdbd1('0x22'),_0xdbd1('0x33')+(_0x4926ee['message']||JSON['stringify'](_0x4926ee)),null,_0x2bf2ff));});});}function checkHopper(){function _0x33fee8(){return function(_0x582fe2){logger[_0xdbd1('0x22')](_0xdbd1('0x34'),_0xdbd1('0x35'),util[_0xdbd1('0x36')](_0x582fe2,{'showHidden':![],'depth':null}));};}var _0x5d62b6=function(_0x15c5e0,_0x1a5860){var _0x5f3bf2=squel['insert']()[_0xdbd1('0x37')](_0xdbd1('0x38'))[_0xdbd1('0x39')]([_0xdbd1('0x21'),_0xdbd1('0x3a'),_0xdbd1('0x3b'),_0xdbd1('0x29'),_0x1a5860,_0xdbd1('0x3c'),'updatedAt'],squel[_0xdbd1('0x3d')]()['field'](_0xdbd1('0x21'),_0xdbd1('0x21'))[_0xdbd1('0x3e')](_0xdbd1('0x3f'),_0xdbd1('0x3a'))[_0xdbd1('0x3e')]('id','ContactId')[_0xdbd1('0x3e')](LISTID[_0xdbd1('0x40')](),_0xdbd1('0x29'))[_0xdbd1('0x3e')](_0x15c5e0['id']['toString'](),_0x1a5860)[_0xdbd1('0x3e')]('NOW()',_0xdbd1('0x3c'))[_0xdbd1('0x3e')](_0xdbd1('0x3f'),'updatedAt')[_0xdbd1('0x41')](_0xdbd1('0x42'))[_0xdbd1('0x43')](_0xdbd1('0x44'))[_0xdbd1('0x43')](_0xdbd1('0x45'),LISTID['toString']())[_0xdbd1('0x43')](_0xdbd1('0x46'))[_0xdbd1('0x43')](_0xdbd1('0x47'),squel['select']()[_0xdbd1('0x3e')](_0xdbd1('0x21'))[_0xdbd1('0x41')](_0xdbd1('0x38'))[_0xdbd1('0x43')](_0x1a5860+_0xdbd1('0x48'),_0x15c5e0['id']['toString']())))['toString']();return _0x5f3bf2;};var _0x1918ef=function(_0x45960a,_0x3e1b91){var _0x7f4c6c=squel[_0xdbd1('0x49')]()[_0xdbd1('0x37')](_0xdbd1('0x38'))[_0xdbd1('0x39')]([_0xdbd1('0x21'),'scheduledAt',_0xdbd1('0x3b'),'ListId',_0x3e1b91,_0xdbd1('0x3c'),'updatedAt'],squel[_0xdbd1('0x3d')]()[_0xdbd1('0x3e')](_0xdbd1('0x21'),_0xdbd1('0x21'))[_0xdbd1('0x3e')](_0xdbd1('0x3f'),_0xdbd1('0x3a'))[_0xdbd1('0x3e')]('id',_0xdbd1('0x3b'))['field'](LISTID[_0xdbd1('0x40')](),_0xdbd1('0x29'))[_0xdbd1('0x3e')](_0x45960a['id'][_0xdbd1('0x40')](),_0x3e1b91)[_0xdbd1('0x3e')](_0xdbd1('0x3f'),'createdAt')[_0xdbd1('0x3e')](_0xdbd1('0x3f'),_0xdbd1('0x4a'))[_0xdbd1('0x41')](_0xdbd1('0x42'))[_0xdbd1('0x43')](_0xdbd1('0x44'))['where']('ListId\x20=\x20?',LISTID[_0xdbd1('0x40')]())[_0xdbd1('0x43')](_0xdbd1('0x4b'),squel['str'](hopperContacts))[_0xdbd1('0x43')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xdbd1('0x3d')]()['field'](_0xdbd1('0x4c'))['from']('cm_hopper_final')[_0xdbd1('0x43')](_0x3e1b91+_0xdbd1('0x48'),_0x45960a['id']['toString']()))['where'](_0xdbd1('0x47'),squel['select']()[_0xdbd1('0x3e')](_0xdbd1('0x21'))[_0xdbd1('0x41')]('cm_hopper')[_0xdbd1('0x43')](_0x3e1b91+_0xdbd1('0x48'),_0x45960a['id']['toString']())))[_0xdbd1('0x40')]();return _0x7f4c6c;};function _0x4d0a34(_0x59cb04,_0xb2b1a7){var _0x3fae81=squel[_0xdbd1('0x49')]()['into'](_0xdbd1('0x38'))[_0xdbd1('0x39')]([_0xdbd1('0x21'),_0xdbd1('0x3a'),'ContactId','ListId',_0xb2b1a7,_0xdbd1('0x3c'),'updatedAt'],squel[_0xdbd1('0x3d')]()[_0xdbd1('0x3e')]('phone','phone')[_0xdbd1('0x3e')](_0xdbd1('0x3f'),'scheduledAt')[_0xdbd1('0x3e')]('id','ContactId')[_0xdbd1('0x3e')](LISTID[_0xdbd1('0x40')](),_0xdbd1('0x29'))[_0xdbd1('0x3e')](_0x59cb04['id'][_0xdbd1('0x40')](),_0xb2b1a7)[_0xdbd1('0x3e')](_0xdbd1('0x3f'),'createdAt')[_0xdbd1('0x3e')]('NOW()',_0xdbd1('0x4a'))['from']('cm_contacts')[_0xdbd1('0x43')](_0xdbd1('0x44'))[_0xdbd1('0x43')]('ListId\x20=\x20?',LISTID['toString']())[_0xdbd1('0x43')]('id\x20IN\x20?',squel[_0xdbd1('0x4d')](hopperContacts))[_0xdbd1('0x43')]('phone\x20IS\x20NOT\x20NULL'))[_0xdbd1('0x40')]();return _0x3fae81;}function _0x3a51c5(_0x109c78,_0x5a5372){var _0x2e8d0a=squel[_0xdbd1('0x49')]()[_0xdbd1('0x37')](_0xdbd1('0x4e'))[_0xdbd1('0x39')]([_0xdbd1('0x21'),'ContactId',_0xdbd1('0x29'),_0x5a5372,_0xdbd1('0x3c'),_0xdbd1('0x4a')],squel[_0xdbd1('0x3d')]()[_0xdbd1('0x3e')](_0xdbd1('0x21'),_0xdbd1('0x21'))[_0xdbd1('0x3e')]('id','ContactId')[_0xdbd1('0x3e')](LISTID['toString'](),'ListId')[_0xdbd1('0x3e')](_0x109c78['id']['toString'](),_0x5a5372)[_0xdbd1('0x3e')](_0xdbd1('0x3f'),'createdAt')[_0xdbd1('0x3e')](_0xdbd1('0x3f'),'updatedAt')['from'](_0xdbd1('0x42'))[_0xdbd1('0x43')](_0xdbd1('0x44'))['where']('ListId\x20=\x20?',LISTID[_0xdbd1('0x40')]())[_0xdbd1('0x43')]('id\x20IN\x20?',squel[_0xdbd1('0x4d')](hopperContacts))[_0xdbd1('0x43')]('phone\x20IS\x20NOT\x20NULL'))[_0xdbd1('0x40')]();return _0x2e8d0a;}return db[_0xdbd1('0x4f')][_0xdbd1('0x50')]({'where':{'type':_0xdbd1('0x51')},'attributes':['id',_0xdbd1('0x52')],'include':[{'model':db[_0xdbd1('0x53')],'as':_0xdbd1('0x54'),'where':{'id':LISTID}}]})[_0xdbd1('0x2f')](function(_0x22c3a9){var _0x9a87bf=[];if(_0x22c3a9){var _0x25a755;for(var _0x253f42=0x0,_0x33579d;_0x253f42<_0x22c3a9['length'];_0x253f42+=0x1){_0x33579d=_0x22c3a9[_0x253f42][_0xdbd1('0x55')]({'plain':!![]});switch(_0x33579d[_0xdbd1('0x52')]){case _0xdbd1('0x56'):_0x9a87bf[_0xdbd1('0x30')](db['sequelize'][_0xdbd1('0x57')](_0x1918ef(_0x33579d,_0xdbd1('0x58')))['then'](function(){})[_0xdbd1('0x32')](_0x33fee8()));break;case _0xdbd1('0x59'):_0x9a87bf['push'](db[_0xdbd1('0x5a')][_0xdbd1('0x57')](_0x5d62b6(_0x33579d,_0xdbd1('0x58')))[_0xdbd1('0x2f')](function(){})[_0xdbd1('0x32')](_0x33fee8()));break;default:_0x9a87bf[_0xdbd1('0x30')](db['sequelize'][_0xdbd1('0x57')](_0x4d0a34(_0x33579d,_0xdbd1('0x58')))[_0xdbd1('0x2f')](function(){})[_0xdbd1('0x32')](_0x33fee8()));}}}return _0x9a87bf;})[_0xdbd1('0x5b')]()[_0xdbd1('0x2f')](function(){return db[_0xdbd1('0x4f')]['findAll']({'where':{'type':_0xdbd1('0x51')},'attributes':['id'],'include':[{'model':db[_0xdbd1('0x53')],'as':_0xdbd1('0x5c'),'where':{'id':LISTID}}]})[_0xdbd1('0x2f')](function(_0x59470b){var _0x2eaeb0=[];if(_0x59470b){var _0x5b329b;for(var _0x52c9f8=0x0,_0x2fcc24;_0x52c9f8<_0x59470b[_0xdbd1('0x19')];_0x52c9f8+=0x1){_0x2fcc24=_0x59470b[_0x52c9f8][_0xdbd1('0x55')]({'plain':!![]});_0x2eaeb0['push'](db['sequelize'][_0xdbd1('0x57')](_0x3a51c5(_0x2fcc24,_0xdbd1('0x58')))[_0xdbd1('0x2f')](function(){})[_0xdbd1('0x32')](_0x33fee8()));}}return _0x2eaeb0;})[_0xdbd1('0x5b')]();})[_0xdbd1('0x2f')](function(){return db['Campaign']['findAll']({'attributes':['id',_0xdbd1('0x52')],'include':[{'model':db[_0xdbd1('0x53')],'as':_0xdbd1('0x54'),'where':{'id':LISTID}}]})[_0xdbd1('0x2f')](function(_0x591bcd){var _0x294a21=[];if(_0x591bcd){for(var _0x1dc9cb=0x0,_0x173687;_0x1dc9cb<_0x591bcd[_0xdbd1('0x19')];_0x1dc9cb+=0x1){_0x173687=_0x591bcd[_0x1dc9cb][_0xdbd1('0x55')]({'plain':!![]});switch(_0x173687[_0xdbd1('0x52')]){case'always':_0x294a21['push'](db[_0xdbd1('0x5a')]['query'](_0x1918ef(_0x173687,_0xdbd1('0x5d')))['then'](function(){})[_0xdbd1('0x32')](_0x33fee8()));break;case'onlyIfOpen':_0x294a21[_0xdbd1('0x30')](db[_0xdbd1('0x5a')][_0xdbd1('0x57')](_0x5d62b6(_0x173687,_0xdbd1('0x5d')))[_0xdbd1('0x2f')](function(){})[_0xdbd1('0x32')](_0x33fee8()));break;default:_0x294a21[_0xdbd1('0x30')](db[_0xdbd1('0x5a')][_0xdbd1('0x57')](_0x4d0a34(_0x173687,_0xdbd1('0x5d')))[_0xdbd1('0x2f')](function(){})[_0xdbd1('0x32')](_0x33fee8()));}}}return _0x294a21;})['all']();})[_0xdbd1('0x2f')](function(){return db[_0xdbd1('0x5e')]['findAll']({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xdbd1('0x5c'),'where':{'id':LISTID}}]})[_0xdbd1('0x2f')](function(_0x1dd27f){var _0x391509=[];if(_0x1dd27f){for(var _0x13cdec=0x0,_0x5a1047;_0x13cdec<_0x1dd27f[_0xdbd1('0x19')];_0x13cdec+=0x1){_0x5a1047=_0x1dd27f[_0x13cdec]['get']({'plain':!![]});_0x391509[_0xdbd1('0x30')](db[_0xdbd1('0x5a')][_0xdbd1('0x57')](_0x3a51c5(_0x5a1047,'CampaignId'))[_0xdbd1('0x2f')](function(){})[_0xdbd1('0x32')](_0x33fee8()));}}return _0x391509;})[_0xdbd1('0x5b')]();})[_0xdbd1('0x32')](function(_0x156e33){logger[_0xdbd1('0x22')](_0xdbd1('0x5f'),'generalCheckHopper',_0x156e33[_0xdbd1('0x1c')]);});}var processPromises=function(_0x3a7892){return BPromise[_0xdbd1('0x5b')](promises)[_0xdbd1('0x2f')](function(_0x446cee){})[_0xdbd1('0x32')](function(_0x72bf53){logger[_0xdbd1('0x22')](_0xdbd1('0x60'),JSON[_0xdbd1('0x61')](_0x72bf53));})[_0xdbd1('0x62')](function(){socket[_0xdbd1('0x63')](_0xdbd1('0x64')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x3a7892){return _0x3a7892[_0xdbd1('0x65')]();}});};var endCsv=function(){return BPromise[_0xdbd1('0x66')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0xdbd1('0x2f')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x1e5232){logger['error'](_0xdbd1('0x67'),JSON[_0xdbd1('0x61')](_0x1e5232));}finally{process[_0xdbd1('0x68')](0x0);}});};process['on']('SIGINT',function(){logger[_0xdbd1('0x69')](_0xdbd1('0x6a'));endCsv();});function main(){return BPromise[_0xdbd1('0x66')]()[_0xdbd1('0x2f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xdbd1('0x6b')](',');return db[_0xdbd1('0x2d')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xdbd1('0x2f')](function(_0x4cbbe7){var _0x56b223=fs[_0xdbd1('0x6c')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xdbd1('0x6d')](_0x56b223,{'header':!![],'skipEmptyLines':!![],'step':function(_0x51883d,_0x260984){total+=0x1;var _0x54107e=total;promises[_0xdbd1('0x30')](checkRow(_0x51883d,_0x4cbbe7,_0x54107e)[_0xdbd1('0x2f')](function(){success+=0x1;})[_0xdbd1('0x32')](function(_0xf32127){if(_0xf32127[_0xdbd1('0x22')]){errors+=0x1;delete _0xf32127['error'];}else if(_0xf32127[_0xdbd1('0x2b')]){duplicates+=0x1;delete _0xf32127[_0xdbd1('0x2b')];}rows[_0xdbd1('0x30')](_0xf32127);}));if(total%0xc8===0x0){_0x260984[_0xdbd1('0x6e')]();return processPromises(_0x260984);}},'complete':function(){return processPromises()[_0xdbd1('0x2f')](function(){logger['info']('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x3254e6,_0x4e9cb0){logger[_0xdbd1('0x69')]('CSV\x20parse\x20error',JSON[_0xdbd1('0x61')](_0x3254e6));endCsv();}});})['catch'](function(_0x560475){logger[_0xdbd1('0x22')](_0xdbd1('0x6f'),JSON[_0xdbd1('0x61')](_0x560475));});}main(); \ No newline at end of file +var _0xcde3=['NOW()','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','id\x20IN\x20?','str','calleridnum','cm_hopper_final','VoiceQueue','dialCheckDuplicateType','get','always','sequelize','query','VoiceQueueId','onlyIfOpen','all','outbound','CmList','BlackLists','findAll','Lists','CampaignId','Campaign','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','stringify','finally','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','resolve','createReadStream','parse','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','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!','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','CompanyId','duplicate','Duplicate\x20Contact','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','toString'];(function(_0x42fe0b,_0x1a2c45){var _0x2050e2=function(_0x3cf175){while(--_0x3cf175){_0x42fe0b['push'](_0x42fe0b['shift']());}};_0x2050e2(++_0x1a2c45);}(_0xcde3,0x10a));var _0x3cde=function(_0x269c42,_0xeed101){_0x269c42=_0x269c42-0x0;var _0x4dad76=_0xcde3[_0x269c42];return _0x4dad76;};'use strict';var BPromise=require(_0x3cde('0x0'));var util=require('util');var _=require(_0x3cde('0x1'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x3cde('0x2'));var db=require(_0x3cde('0x3'))['db'];var config=require(_0x3cde('0x4'));var logger=require(_0x3cde('0x5'))(_0x3cde('0x6'));config[_0x3cde('0x7')]=_[_0x3cde('0x8')](config[_0x3cde('0x7')],{'host':_0x3cde('0x9'),'port':0x18eb});var socket=require(_0x3cde('0xa'))(new Redis(config[_0x3cde('0x7')]));require(_0x3cde('0xb'))[_0x3cde('0xc')](socket);try{if(!process[_0x3cde('0xd')][0x2]||process[_0x3cde('0xd')][0x2]===_0x3cde('0xe')||process[_0x3cde('0xd')][0x2]==='null'){throw new Error(_0x3cde('0xf'));}var FILEPATH=process[_0x3cde('0xd')][0x2];if(!process[_0x3cde('0xd')][0x3]||process[_0x3cde('0xd')][0x3]===_0x3cde('0xe')||process['argv'][0x3]===_0x3cde('0x10')||!process[_0x3cde('0xd')][0x4]||process[_0x3cde('0xd')][0x4]===_0x3cde('0xe')||process[_0x3cde('0xd')][0x4]===_0x3cde('0x10')){throw new Error(_0x3cde('0x11'));}var FIELDS=_[_0x3cde('0x12')](process[_0x3cde('0xd')][0x3][_0x3cde('0x13')](','),process[_0x3cde('0xd')][0x4][_0x3cde('0x13')](','));if(!process['argv'][0x5]||process[_0x3cde('0xd')][0x5]==='undefined'||process[_0x3cde('0xd')][0x5]===_0x3cde('0x10')){throw new Error(_0x3cde('0x14'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x3cde('0xd')][0x6]&&process['argv'][0x6]!==_0x3cde('0xe')&&process[_0x3cde('0xd')][0x6]!==_0x3cde('0x10')?process[_0x3cde('0xd')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x3cde('0xd')][0x7]!==_0x3cde('0xe')&&process[_0x3cde('0xd')][0x7]!==_0x3cde('0x10')?process[_0x3cde('0xd')][0x7]:null;if(!process[_0x3cde('0xd')][0x8]||process[_0x3cde('0xd')][0x8]==='undefined'||process['argv'][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x3cde('0xd')][0x8];}catch(_0x5e2e0e){logger[_0x3cde('0x15')](_0x5e2e0e);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(_0x21b298,_0x563939,_0x3b6cb1,_0x50e5b2){var _0x3642da={'message':_0x563939};_0x3642da[_0x21b298]=!![];if(_0x3b6cb1){_0x3642da[_0x3cde('0x16')]=_0x3b6cb1;}if(_0x50e5b2){_0x3642da[_0x3cde('0x17')]=_0x50e5b2;}return _0x3642da;}function isEmail(_0x4bf53f){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))*$/[_0x3cde('0x18')](_0x4bf53f);}function checkRow(_0x4ddb1b,_0x390324,_0x2367d7){return new BPromise(function(_0x697c8d,_0x5b3e6e){if(_['isNil'](_0x4ddb1b)){return _0x5b3e6e(handleCheckRowError('error',_0x3cde('0x19'),null,_0x2367d7));}if(_0x4ddb1b['errors']&&_0x4ddb1b['errors'][_0x3cde('0x1a')]){var _0x4848e3=_[_0x3cde('0x1b')](_0x4ddb1b['errors'],_0x3cde('0x1c'))[_0x3cde('0x1d')](';');return _0x5b3e6e(handleCheckRowError(_0x3cde('0x15'),_0x4848e3,null,_0x2367d7));}var _0x28c8bc={};for(var _0x1ecc18 in FIELDS){if(FIELDS[_0x3cde('0x1e')](_0x1ecc18)&&FIELDS[_0x1ecc18]){_0x28c8bc[_0x1ecc18]=_0x4ddb1b[_0x3cde('0x1f')][0x0][FIELDS[_0x1ecc18]]||_0x4ddb1b[_0x3cde('0x1f')][0x0]['\ufeff'+FIELDS[_0x1ecc18]];}}if(!_0x28c8bc[_0x3cde('0x20')]){return _0x5b3e6e(handleCheckRowError(_0x3cde('0x15'),_0x3cde('0x21'),null,_0x2367d7));}if(!_0x28c8bc[_0x3cde('0x22')]){return _0x5b3e6e(handleCheckRowError('error',_0x3cde('0x23'),null,_0x2367d7));}if(_0x28c8bc[_0x3cde('0x24')]){var _0x458865=moment(_0x28c8bc['birthDate'],_0x3cde('0x25'));if(!_0x458865[_0x3cde('0x26')]()){return _0x5b3e6e(handleCheckRowError(_0x3cde('0x15'),_0x3cde('0x27'),null,_0x2367d7));}}if(_0x28c8bc[_0x3cde('0x28')]){if(!isEmail(_0x28c8bc[_0x3cde('0x28')])){return _0x5b3e6e(handleCheckRowError('error',_0x3cde('0x29'),null,_0x2367d7));}}_0x28c8bc['ListId']=LISTID;_0x28c8bc[_0x3cde('0x2a')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x3cde('0x1a')]&&_0x390324){var _0x10eb2e={};for(var _0x33b006=0x0,_0x183951=DUPLICATES[_0x3cde('0x1a')];_0x33b006<_0x183951;_0x33b006+=0x1){_0x10eb2e[DUPLICATES[_0x33b006]]=_0x28c8bc[DUPLICATES[_0x33b006]];}var _0x1db72b=_['find'](_0x390324,_0x10eb2e);if(_0x1db72b){return _0x5b3e6e(handleCheckRowError(_0x3cde('0x2b'),_0x3cde('0x2c'),_0x1db72b,_0x2367d7));}}return db['CmContact']['create'](_0x28c8bc,{'raw':!![],'hooks':![],'fields':_[_0x3cde('0x2d')](_0x28c8bc)})[_0x3cde('0x2e')](function(_0x3c7a66){if(DUPLICATES&&DUPLICATES[_0x3cde('0x1a')]&&_0x390324){_0x390324[_0x3cde('0x2f')](_[_0x3cde('0x30')](_0x28c8bc,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x3c7a66['id'];return _0x697c8d();})[_0x3cde('0x31')](function(_0x269257){return _0x5b3e6e(handleCheckRowError(_0x3cde('0x15'),_0x3cde('0x32')+(_0x269257['message']||JSON['stringify'](_0x269257)),null,_0x2367d7));});});}function checkHopper(){function _0x2ebf03(){return function(_0x1acad6){logger['error']('cmContact','checkHopper',util[_0x3cde('0x33')](_0x1acad6,{'showHidden':![],'depth':null}));};}var _0x15e4cf=function(_0x58fa97,_0x3c0c7b){var _0x1163bd=squel[_0x3cde('0x34')]()[_0x3cde('0x35')](_0x3cde('0x36'))[_0x3cde('0x37')]([_0x3cde('0x22'),_0x3cde('0x38'),_0x3cde('0x39'),_0x3cde('0x3a'),_0x3c0c7b,_0x3cde('0x3b'),_0x3cde('0x3c')],squel[_0x3cde('0x3d')]()[_0x3cde('0x3e')](_0x3cde('0x22'),_0x3cde('0x22'))[_0x3cde('0x3e')]('NOW()',_0x3cde('0x38'))['field']('id','ContactId')[_0x3cde('0x3e')](LISTID[_0x3cde('0x3f')](),_0x3cde('0x3a'))['field'](_0x58fa97['id'][_0x3cde('0x3f')](),_0x3c0c7b)[_0x3cde('0x3e')]('NOW()',_0x3cde('0x3b'))[_0x3cde('0x3e')](_0x3cde('0x40'),_0x3cde('0x3c'))[_0x3cde('0x41')](_0x3cde('0x42'))[_0x3cde('0x43')](_0x3cde('0x44'))[_0x3cde('0x43')](_0x3cde('0x45'),LISTID[_0x3cde('0x3f')]())[_0x3cde('0x43')](_0x3cde('0x46'))[_0x3cde('0x43')](_0x3cde('0x47'),squel['select']()[_0x3cde('0x3e')](_0x3cde('0x22'))[_0x3cde('0x41')](_0x3cde('0x36'))[_0x3cde('0x43')](_0x3c0c7b+_0x3cde('0x48'),_0x58fa97['id'][_0x3cde('0x3f')]())))[_0x3cde('0x3f')]();return _0x1163bd;};var _0x2138bf=function(_0x14a694,_0x19285b){var _0x2a9b28=squel[_0x3cde('0x34')]()[_0x3cde('0x35')](_0x3cde('0x36'))[_0x3cde('0x37')]([_0x3cde('0x22'),_0x3cde('0x38'),_0x3cde('0x39'),_0x3cde('0x3a'),_0x19285b,'createdAt','updatedAt'],squel[_0x3cde('0x3d')]()[_0x3cde('0x3e')](_0x3cde('0x22'),_0x3cde('0x22'))[_0x3cde('0x3e')](_0x3cde('0x40'),_0x3cde('0x38'))[_0x3cde('0x3e')]('id',_0x3cde('0x39'))['field'](LISTID[_0x3cde('0x3f')](),'ListId')[_0x3cde('0x3e')](_0x14a694['id'][_0x3cde('0x3f')](),_0x19285b)['field'](_0x3cde('0x40'),_0x3cde('0x3b'))['field']('NOW()',_0x3cde('0x3c'))[_0x3cde('0x41')](_0x3cde('0x42'))['where']('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID[_0x3cde('0x3f')]())[_0x3cde('0x43')](_0x3cde('0x49'),squel[_0x3cde('0x4a')](hopperContacts))['where'](_0x3cde('0x46'))[_0x3cde('0x43')](_0x3cde('0x47'),squel[_0x3cde('0x3d')]()[_0x3cde('0x3e')](_0x3cde('0x4b'))[_0x3cde('0x41')](_0x3cde('0x4c'))[_0x3cde('0x43')](_0x19285b+'\x20=\x20?',_0x14a694['id'][_0x3cde('0x3f')]()))[_0x3cde('0x43')]('phone\x20NOT\x20IN\x20(?)',squel[_0x3cde('0x3d')]()[_0x3cde('0x3e')](_0x3cde('0x22'))[_0x3cde('0x41')]('cm_hopper')['where'](_0x19285b+_0x3cde('0x48'),_0x14a694['id'][_0x3cde('0x3f')]())))[_0x3cde('0x3f')]();return _0x2a9b28;};function _0x15e750(_0x477d13,_0x1c0f0b){var _0x16ccfe=squel['insert']()[_0x3cde('0x35')]('cm_hopper')[_0x3cde('0x37')]([_0x3cde('0x22'),_0x3cde('0x38'),_0x3cde('0x39'),_0x3cde('0x3a'),_0x1c0f0b,_0x3cde('0x3b'),_0x3cde('0x3c')],squel[_0x3cde('0x3d')]()[_0x3cde('0x3e')](_0x3cde('0x22'),_0x3cde('0x22'))['field'](_0x3cde('0x40'),_0x3cde('0x38'))['field']('id',_0x3cde('0x39'))[_0x3cde('0x3e')](LISTID[_0x3cde('0x3f')](),_0x3cde('0x3a'))['field'](_0x477d13['id'][_0x3cde('0x3f')](),_0x1c0f0b)[_0x3cde('0x3e')](_0x3cde('0x40'),_0x3cde('0x3b'))[_0x3cde('0x3e')](_0x3cde('0x40'),_0x3cde('0x3c'))[_0x3cde('0x41')](_0x3cde('0x42'))[_0x3cde('0x43')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID[_0x3cde('0x3f')]())['where'](_0x3cde('0x49'),squel[_0x3cde('0x4a')](hopperContacts))[_0x3cde('0x43')](_0x3cde('0x46')))[_0x3cde('0x3f')]();return _0x16ccfe;}function _0x1b2bc5(_0x3d72ac,_0xcdca01){var _0x5cd37b=squel[_0x3cde('0x34')]()[_0x3cde('0x35')]('cm_hopper_black')['fromQuery'](['phone','ContactId','ListId',_0xcdca01,'createdAt','updatedAt'],squel[_0x3cde('0x3d')]()[_0x3cde('0x3e')](_0x3cde('0x22'),_0x3cde('0x22'))[_0x3cde('0x3e')]('id','ContactId')[_0x3cde('0x3e')](LISTID[_0x3cde('0x3f')](),_0x3cde('0x3a'))['field'](_0x3d72ac['id'][_0x3cde('0x3f')](),_0xcdca01)[_0x3cde('0x3e')](_0x3cde('0x40'),_0x3cde('0x3b'))[_0x3cde('0x3e')]('NOW()','updatedAt')[_0x3cde('0x41')](_0x3cde('0x42'))[_0x3cde('0x43')]('deletedAt\x20IS\x20NULL')[_0x3cde('0x43')](_0x3cde('0x45'),LISTID[_0x3cde('0x3f')]())['where'](_0x3cde('0x49'),squel[_0x3cde('0x4a')](hopperContacts))['where'](_0x3cde('0x46')))[_0x3cde('0x3f')]();return _0x5cd37b;}return db[_0x3cde('0x4d')]['findAll']({'where':{'type':'outbound'},'attributes':['id',_0x3cde('0x4e')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0x3cde('0x2e')](function(_0x1361ae){var _0x59df8b=[];if(_0x1361ae){var _0x34cfcb;for(var _0x5e49f8=0x0,_0x2a66a5;_0x5e49f8<_0x1361ae['length'];_0x5e49f8+=0x1){_0x2a66a5=_0x1361ae[_0x5e49f8][_0x3cde('0x4f')]({'plain':!![]});switch(_0x2a66a5['dialCheckDuplicateType']){case _0x3cde('0x50'):_0x59df8b[_0x3cde('0x2f')](db[_0x3cde('0x51')][_0x3cde('0x52')](_0x2138bf(_0x2a66a5,_0x3cde('0x53')))[_0x3cde('0x2e')](function(){})['catch'](_0x2ebf03()));break;case _0x3cde('0x54'):_0x59df8b[_0x3cde('0x2f')](db['sequelize'][_0x3cde('0x52')](_0x15e4cf(_0x2a66a5,_0x3cde('0x53')))[_0x3cde('0x2e')](function(){})[_0x3cde('0x31')](_0x2ebf03()));break;default:_0x59df8b[_0x3cde('0x2f')](db[_0x3cde('0x51')][_0x3cde('0x52')](_0x15e750(_0x2a66a5,_0x3cde('0x53')))['then'](function(){})[_0x3cde('0x31')](_0x2ebf03()));}}}return _0x59df8b;})[_0x3cde('0x55')]()['then'](function(){return db[_0x3cde('0x4d')]['findAll']({'where':{'type':_0x3cde('0x56')},'attributes':['id'],'include':[{'model':db[_0x3cde('0x57')],'as':_0x3cde('0x58'),'where':{'id':LISTID}}]})[_0x3cde('0x2e')](function(_0x1ea1a6){var _0x3df4c6=[];if(_0x1ea1a6){var _0x17ec45;for(var _0xe0a582=0x0,_0xf8667d;_0xe0a582<_0x1ea1a6[_0x3cde('0x1a')];_0xe0a582+=0x1){_0xf8667d=_0x1ea1a6[_0xe0a582][_0x3cde('0x4f')]({'plain':!![]});_0x3df4c6[_0x3cde('0x2f')](db['sequelize'][_0x3cde('0x52')](_0x1b2bc5(_0xf8667d,_0x3cde('0x53')))[_0x3cde('0x2e')](function(){})[_0x3cde('0x31')](_0x2ebf03()));}}return _0x3df4c6;})[_0x3cde('0x55')]();})[_0x3cde('0x2e')](function(){return db['Campaign'][_0x3cde('0x59')]({'attributes':['id',_0x3cde('0x4e')],'include':[{'model':db['CmList'],'as':_0x3cde('0x5a'),'where':{'id':LISTID}}]})['then'](function(_0x107536){var _0x17cc55=[];if(_0x107536){for(var _0x58a31a=0x0,_0x3ab57;_0x58a31a<_0x107536[_0x3cde('0x1a')];_0x58a31a+=0x1){_0x3ab57=_0x107536[_0x58a31a][_0x3cde('0x4f')]({'plain':!![]});switch(_0x3ab57['dialCheckDuplicateType']){case'always':_0x17cc55[_0x3cde('0x2f')](db[_0x3cde('0x51')]['query'](_0x2138bf(_0x3ab57,_0x3cde('0x5b')))[_0x3cde('0x2e')](function(){})[_0x3cde('0x31')](_0x2ebf03()));break;case _0x3cde('0x54'):_0x17cc55['push'](db['sequelize'][_0x3cde('0x52')](_0x15e4cf(_0x3ab57,_0x3cde('0x5b')))[_0x3cde('0x2e')](function(){})['catch'](_0x2ebf03()));break;default:_0x17cc55[_0x3cde('0x2f')](db['sequelize'][_0x3cde('0x52')](_0x15e750(_0x3ab57,'CampaignId'))['then'](function(){})[_0x3cde('0x31')](_0x2ebf03()));}}}return _0x17cc55;})[_0x3cde('0x55')]();})[_0x3cde('0x2e')](function(){return db[_0x3cde('0x5c')][_0x3cde('0x59')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0x3cde('0x2e')](function(_0x2174cc){var _0x21e841=[];if(_0x2174cc){for(var _0x51ca46=0x0,_0x2ec6cf;_0x51ca46<_0x2174cc[_0x3cde('0x1a')];_0x51ca46+=0x1){_0x2ec6cf=_0x2174cc[_0x51ca46]['get']({'plain':!![]});_0x21e841[_0x3cde('0x2f')](db[_0x3cde('0x51')]['query'](_0x1b2bc5(_0x2ec6cf,_0x3cde('0x5b')))[_0x3cde('0x2e')](function(){})[_0x3cde('0x31')](_0x2ebf03()));}}return _0x21e841;})[_0x3cde('0x55')]();})['catch'](function(_0x444c1e){logger[_0x3cde('0x15')](_0x3cde('0x5d'),'generalCheckHopper',_0x444c1e[_0x3cde('0x1c')]);});}var processPromises=function(_0x15da9e){return BPromise['all'](promises)[_0x3cde('0x2e')](function(_0xa32638){})[_0x3cde('0x31')](function(_0x22bbf5){logger[_0x3cde('0x15')](_0x3cde('0x5e'),JSON[_0x3cde('0x5f')](_0x22bbf5));})[_0x3cde('0x60')](function(){socket['emit'](_0x3cde('0x61')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x15da9e){return _0x15da9e[_0x3cde('0x62')]();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x3cde('0x2e')](function(){socket['emit'](_0x3cde('0x61')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x3cde('0x63')](FILEPATH);}catch(_0x1602f8){logger[_0x3cde('0x15')](_0x3cde('0x64'),JSON[_0x3cde('0x5f')](_0x1602f8));}finally{process[_0x3cde('0x65')](0x0);}});};process['on'](_0x3cde('0x66'),function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x3cde('0x67')]()[_0x3cde('0x2e')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x3cde('0x13')](',');return db['CmContact']['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x3cde('0x2e')](function(_0x5a876c){var _0xa89c09=fs[_0x3cde('0x68')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x3cde('0x69')](_0xa89c09,{'header':!![],'skipEmptyLines':!![],'step':function(_0x3d4003,_0x21476f){total+=0x1;var _0xf79128=total;promises['push'](checkRow(_0x3d4003,_0x5a876c,_0xf79128)[_0x3cde('0x2e')](function(){success+=0x1;})[_0x3cde('0x31')](function(_0xbbb84b){if(_0xbbb84b['error']){errors+=0x1;delete _0xbbb84b[_0x3cde('0x15')];}else if(_0xbbb84b[_0x3cde('0x2b')]){duplicates+=0x1;delete _0xbbb84b[_0x3cde('0x2b')];}rows[_0x3cde('0x2f')](_0xbbb84b);}));if(total%0xc8===0x0){_0x21476f['pause']();return processPromises(_0x21476f);}},'complete':function(){return processPromises()['then'](function(){logger[_0x3cde('0x6a')](_0x3cde('0x6b'));endCsv();});},'error':function(_0x5ca2f9,_0x32264c){logger[_0x3cde('0x6a')](_0x3cde('0x6c'),JSON[_0x3cde('0x5f')](_0x5ca2f9));endCsv();}});})[_0x3cde('0x31')](function(_0x85d0b3){logger[_0x3cde('0x15')](_0x3cde('0x6d'),JSON[_0x3cde('0x5f')](_0x85d0b3));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 4ddbf38..428fb96 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 _0x52dd=['bluebird','squel','ioredis','../../../mysqldb','../../../config/environment','import','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','.id\x20=\x20','\x20=\x20','where','CmContact','findAll','then','push','all','AdditionalPhones','split','length','isNil','filter','CmContactHasItem','update','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','priority','UserId','recallme','fields','join','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_hopper_black','updatedAt','cm_contacts.ListId\x20=\x20','ListId\x20=\x20?','toString','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','\x22onlyIfOpen\x22','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_hopper.ListId\x20=\x20?','scheduledAt',')\x20NOT\x20IN\x20?','id\x20IN\x20?','group','Received\x20SIGINT','exit','errors','code','info','sequelize','query','spread','catch','error','message','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','set','main','stringify','send','start','binding','clone','.csv','keys','includes','header','ContactItemType','name','_description','parse','createReadStream','data','find','hasOwnProperty','isValid','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','utcOffset','firstName','trim','itemTypeId','description','emit','contact:import:','Abort\x20parser','abort','SystemError','step','cm_contacts_','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','replace','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','CompanyId','duplicates','DROP\x20TABLE\x20','each','contactId','contactTypeId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','affectedRows','unlink','argv','root','existsSync','file\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','uncaughtException','path','papaparse','util'];(function(_0x4cc9d5,_0x4fd790){var _0x287fcf=function(_0x18cc62){while(--_0x18cc62){_0x4cc9d5['push'](_0x4cc9d5['shift']());}};_0x287fcf(++_0x4fd790);}(_0x52dd,0x15f));var _0xd52d=function(_0x3cf078,_0x168566){_0x3cf078=_0x3cf078-0x0;var _0x274dba=_0x52dd[_0x3cf078];return _0x274dba;};'use strict';var fs=require('fs');var path=require(_0xd52d('0x0'));var _=require('lodash');var Papa=require(_0xd52d('0x1'));var util=require(_0xd52d('0x2'));var BPromise=require(_0xd52d('0x3'));var moment=require('moment');var squel=require(_0xd52d('0x4'));var Redis=require(_0xd52d('0x5'));var db=require(_0xd52d('0x6'))['db'];var config=require(_0xd52d('0x7'));var shared=require('../../../config/environment/shared');var logger=require('../../../config/logger')(_0xd52d('0x8'));config[_0xd52d('0x9')]=_[_0xd52d('0xa')](config['redis'],{'host':_0xd52d('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd52d('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xd52d('0xc')]('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()[_0xd52d('0xc')](_0xd52d('0xd'));function isEmail(_0x4ae1b4){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))*$/[_0xd52d('0xe')](_0x4ae1b4);}function selectNotIn(_0x2f6f66,_0x306a4c,_0x22db35,_0x1a1aa1,_0x5809db){return squel[_0xd52d('0xf')]()[_0xd52d('0x10')](_0xd52d('0x11'))[_0xd52d('0x12')](_0x1a1aa1)['join'](_0x306a4c,null,_0x306a4c+_0xd52d('0x13')+_0x1a1aa1+'.'+_0x22db35)['where'](_0x1a1aa1+'.'+_0x22db35+_0xd52d('0x14')+_0x2f6f66+'.'+_0x22db35)[_0xd52d('0x15')](_0x306a4c+'.dialCheckDuplicateType\x20IN\x20('+_0x5809db['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x56fd03,_0x2a2462){promisesAdditionalPhones=[];return db[_0xd52d('0x16')][_0xd52d('0x17')]({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xd52d('0x18')](function(_0x14ee8b){if(_0x14ee8b!==null){var _0x28b5d7=[];for(var _0x413e12=0x0;_0x413e12<_0x14ee8b['length'];_0x413e12++){var _0x293215=_0x14ee8b[_0x413e12];_0x28b5d7[_0xd52d('0x19')](insertAdditionalPhones(_0x293215));}}Promise[_0xd52d('0x1a')](_0x28b5d7)[_0xd52d('0x18')](function(){_0x56fd03({'val':0x1});});});});}function insertAdditionalPhones(_0x2c9e35){return new Promise(function(_0x242a99,_0x6d3225){var _0x2cec04=_0x2c9e35[_0xd52d('0x1b')];var _0x5f3c55=_0x2cec04[_0xd52d('0x1c')](';');var _0x2ea6e6=[];orderBy=0x0;for(var _0x580f4a=0x0;_0x580f4a<_0x5f3c55[_0xd52d('0x1d')];_0x580f4a++){_0x2ea6e6[_0xd52d('0x19')](splitAdditionalPhone(_0x2c9e35['id'],_0x5f3c55[_0x580f4a]));}Promise[_0xd52d('0x1a')](_0x2ea6e6)[_0xd52d('0x18')](function(){_0x242a99({'val':_0x5f3c55[_0xd52d('0x1d')]});});});}function splitAdditionalPhone(_0x1e301b,_0xf03b06){return new Promise(function(_0x30395a,_0x1df52c){var _0x535fdb=_0xf03b06[_0xd52d('0x1c')](':');var _0x3d3a90=_0x535fdb[0x0];var _0x39dcfe=_0x535fdb[0x1];if(!_[_0xd52d('0x1e')](_0x39dcfe)){var _0xcdcc84=_0x39dcfe[_0xd52d('0x1c')]('|');var _0xfadb3d=[];for(var _0x3965d6=0x0;_0x3965d6<_0xcdcc84[_0xd52d('0x1d')];_0x3965d6++){if(_0xcdcc84[_0x3965d6]!==''){var _0x48dc15=_[_0xd52d('0x1f')](promisesAdditionalPhones,{'contactId':_0x1e301b,'phone':_0xcdcc84[_0x3965d6]});if(_0x48dc15['length']==0x0){orderBy++;promisesAdditionalPhones[_0xd52d('0x19')]({'contactId':_0x1e301b,'contactTypeId':_0x3d3a90,'phone':_0xcdcc84[_0x3965d6],'orderBy':orderBy});}}}_0x30395a({'ok':0x1});}else _0x30395a({'res':0x0});});}function createAdditionalPhone(_0x1c9af2,_0x5baa3d,_0x12a722,_0x2a437b){var _0x453c9e='';var _0x5905ca='';var _0x26de16=_0x12a722[_0xd52d('0x1c')]('§');_0x453c9e=_0x26de16[0x0];if(_0x26de16['length']==0x2)_0x5905ca=_0x26de16[0x1];return new Promise(function(_0x4f91f3,_0x3c3bd8){return db[_0xd52d('0x20')]['findOne']({'where':{'CmContactId':_0x1c9af2,'item':_0x453c9e}})[_0xd52d('0x18')](function(_0x22ff6f){if(_0x22ff6f){return db[_0xd52d('0x20')][_0xd52d('0x21')]({'ItemTypeId':_0x5baa3d,'description':_0x5905ca,'OrderBy':_0x2a437b},{'where':{'CmContactId':_0x1c9af2,'item':_0x453c9e}})[_0xd52d('0x18')](function(_0x35ade1){_0x4f91f3({'res':_0xd52d('0x22')});});}else{return db['CmContactHasItem'][_0xd52d('0x23')]({'CmContactId':_0x1c9af2,'item':_0x453c9e,'description':_0x5905ca,'ItemTypeId':_0x5baa3d,'OrderBy':_0x2a437b,'ItemClass':_0xd52d('0x24')})[_0xd52d('0x18')](function(_0x353101){_0x4f91f3({'res':_0xd52d('0x25')});});}});});}function insertCmHopper(_0x2082a0,_0x162e95,_0x10d65b,_0x26a9c,_0x56e94c){var _0x132119=[_0xd52d('0x26'),_0xd52d('0x27'),'cm_contacts.id',_0xd52d('0x28'),_0x162e95+'.'+_0x26a9c,'cm_contacts.createdAt','cm_contacts.updatedAt',_0xd52d('0x29'),_0xd52d('0x2a'),'\x22'+_0x56e94c+'\x22'];return squel[_0xd52d('0x2b')]()[_0xd52d('0x2c')](_0xd52d('0x2d'))[_0xd52d('0x2e')](['phone',_0xd52d('0x2f'),_0xd52d('0x30'),_0xd52d('0x31'),_0x26a9c,_0xd52d('0x32'),'updatedAt',_0xd52d('0x33'),_0xd52d('0x34'),_0xd52d('0x35')],squel[_0xd52d('0xf')]()[_0xd52d('0x36')](_0x132119)[_0xd52d('0x12')](_0x162e95)[_0xd52d('0x37')](_0xd52d('0x38'),null,'cm_contacts.ListId\x20=\x20'+_0x162e95+_0xd52d('0x39'))[_0xd52d('0x37')](_0x10d65b,null,_0x10d65b+_0xd52d('0x13')+_0x162e95+'.'+_0x26a9c)['where'](_0x162e95+_0xd52d('0x3a'),_0x2082a0)[_0xd52d('0x15')](_0xd52d('0x3b'),NOW)[_0xd52d('0x15')](_0xd52d('0x3c'),selectNotIn(_0x162e95,_0x10d65b,_0x26a9c,_0xd52d('0x2d'),['\x22always\x22','\x22onlyIfOpen\x22']))[_0xd52d('0x15')](_0xd52d('0x3c'),selectNotIn(_0x162e95,_0x10d65b,_0x26a9c,_0xd52d('0x2d'),['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0x1252e8,_0x444ee5,_0x5ea15b,_0x184916){var _0x4f4a7c=[_0xd52d('0x26'),_0xd52d('0x3d'),_0xd52d('0x28'),_0x444ee5+'.'+_0x184916,_0xd52d('0x3e'),_0xd52d('0x3f')];return squel['insert']()['into'](_0xd52d('0x40'))[_0xd52d('0x2e')](['phone',_0xd52d('0x30'),'ListId',_0x184916,'createdAt',_0xd52d('0x41')],squel['select']()['fields'](_0x4f4a7c)[_0xd52d('0x12')](_0x444ee5)[_0xd52d('0x37')](_0xd52d('0x38'),null,_0xd52d('0x42')+_0x444ee5+_0xd52d('0x39'))[_0xd52d('0x37')](_0x5ea15b,null,_0x5ea15b+_0xd52d('0x13')+_0x444ee5+'.'+_0x184916)['where'](_0x444ee5+_0xd52d('0x3a'),_0x1252e8)[_0xd52d('0x15')](_0xd52d('0x3b'),NOW)[_0xd52d('0x15')](_0xd52d('0x3c'),squel['select']()[_0xd52d('0x10')]('phone')[_0xd52d('0x12')](_0xd52d('0x40'))['where'](_0xd52d('0x43'),_0x1252e8)[_0xd52d('0x15')](_0x184916+_0xd52d('0x14')+_0x444ee5+'.'+_0x184916)))[_0xd52d('0x44')]();}function insertTzCmHopper(_0x390785,_0x5a6586,_0x2b7059,_0x5ae397,_0x53f475,_0x162564){var _0x4c7f17=['cm_contacts.phone',_0xd52d('0x45')+_0x162564+_0xd52d('0x46'),_0xd52d('0x3d'),'cm_contacts.ListId',_0x5a6586+'.'+_0x5ae397,_0xd52d('0x3e'),_0xd52d('0x3f'),'cm_contacts.priority',_0xd52d('0x2a'),'\x22'+_0x53f475+'\x22'];var _0x3392d=squel['insert']()[_0xd52d('0x2c')](_0xd52d('0x2d'))[_0xd52d('0x2e')]([_0xd52d('0x11'),'scheduledat','ContactId',_0xd52d('0x31'),_0x5ae397,_0xd52d('0x32'),_0xd52d('0x41'),'priority',_0xd52d('0x34'),_0xd52d('0x35')],squel[_0xd52d('0xf')]()[_0xd52d('0x36')](_0x4c7f17)[_0xd52d('0x12')](_0x5a6586)[_0xd52d('0x37')](_0xd52d('0x38'),null,_0xd52d('0x42')+_0x5a6586+_0xd52d('0x39'))[_0xd52d('0x37')](_0x2b7059,null,_0x2b7059+_0xd52d('0x13')+_0x5a6586+'.'+_0x5ae397)[_0xd52d('0x37')](_0x162564,null,_0x162564+'.id\x20=\x20'+_0x5a6586+'.'+_0x5ae397)[_0xd52d('0x15')](_0x5a6586+_0xd52d('0x3a'),_0x390785)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0xd52d('0x15')](_0xd52d('0x3c'),selectNotIn(_0x5a6586,_0x2b7059,_0x5ae397,_0xd52d('0x2d'),['\x22always\x22',_0xd52d('0x47')]))[_0xd52d('0x15')](_0xd52d('0x3c'),selectNotIn(_0x5a6586,_0x2b7059,_0x5ae397,'cm_hopper',['\x22always\x22'])))['toString']();return _0x3392d;}function insertTzCmHopperBlack(_0x4304d0,_0x4a081c,_0x3ab44a,_0x3a16ef){var _0x4cb72a=[_0xd52d('0x26'),_0xd52d('0x3d'),_0xd52d('0x28'),_0x4a081c+'.'+_0x3a16ef,_0xd52d('0x3e'),_0xd52d('0x3f')];return squel[_0xd52d('0x2b')]()['into'](_0xd52d('0x40'))[_0xd52d('0x2e')](['phone',_0xd52d('0x30'),_0xd52d('0x31'),_0x3a16ef,'createdAt',_0xd52d('0x41')],squel[_0xd52d('0xf')]()[_0xd52d('0x36')](_0x4cb72a)[_0xd52d('0x12')](_0x4a081c)[_0xd52d('0x37')](_0xd52d('0x38'),null,_0xd52d('0x42')+_0x4a081c+_0xd52d('0x39'))[_0xd52d('0x37')](_0x3ab44a,null,_0x3ab44a+_0xd52d('0x13')+_0x4a081c+'.'+_0x3a16ef)[_0xd52d('0x15')](_0x4a081c+'.CmListId\x20=\x20?',_0x4304d0)[_0xd52d('0x15')](_0xd52d('0x3b'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xd52d('0x10')](_0xd52d('0x11'))[_0xd52d('0x12')](_0xd52d('0x40'))['where'](_0xd52d('0x43'),_0x4304d0)[_0xd52d('0x15')](_0x3a16ef+_0xd52d('0x14')+_0x4a081c+'.'+_0x3a16ef)))[_0xd52d('0x44')]();}function insertCmHopperAdditionalPhones(_0x1dc231){var _0x8131ec=['cm_hopper.id',_0xd52d('0x48'),'cm_contact_has_items.OrderBy',_0xd52d('0x49'),_0xd52d('0x4a')];return squel[_0xd52d('0x2b')]()[_0xd52d('0x2c')](_0xd52d('0x4b'))['fromQuery']([_0xd52d('0x4c'),'phone',_0xd52d('0x4d'),_0xd52d('0x32'),'updatedAt'],squel[_0xd52d('0xf')]()[_0xd52d('0x36')](_0x8131ec)[_0xd52d('0x12')](_0xd52d('0x2d'))[_0xd52d('0x37')](_0xd52d('0x38'),null,_0xd52d('0x4e'))[_0xd52d('0x37')](_0xd52d('0x4f'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')['where'](_0xd52d('0x50'),_0x1dc231)['where'](_0xd52d('0x3b'),NOW))[_0xd52d('0x44')]();}function insertCmContact(_0x4c39f2,_0x5662c6,_0x5c3d53,_0x90aa8f){var _0x158b5b=_['concat'](_['keys'](_0x90aa8f),['ListId','CompanyId','createdAt',_0xd52d('0x41'),_0xd52d('0x51')]);return squel[_0xd52d('0x2b')]()[_0xd52d('0x2c')](_0xd52d('0x38'))[_0xd52d('0x2e')](_0x158b5b,squel[_0xd52d('0xf')]()[_0xd52d('0x36')](_0x158b5b)[_0xd52d('0x12')](_0x5662c6)[_0xd52d('0x15')]('('+_0x5c3d53[_0xd52d('0x37')](',')+_0xd52d('0x52'),squel[_0xd52d('0xf')]()[_0xd52d('0x36')](_0x5c3d53)[_0xd52d('0x12')]('cm_contacts')['where'](_0xd52d('0x43'),_0x4c39f2)[_0xd52d('0x15')]('deletedAt\x20IS\x20NULL'))[_0xd52d('0x15')](_0xd52d('0x53'),squel[_0xd52d('0xf')]()[_0xd52d('0x10')]('MIN(id)','min_id')[_0xd52d('0x12')](_0x5662c6)[_0xd52d('0x54')](_0x5c3d53[_0xd52d('0x37')](','))))[_0xd52d('0x44')]();}function handleStop(){logger['info'](_0xd52d('0x55'));stopped=!![];}function handleUncaughtException(_0xc85b6f){logger['error'](_0xc85b6f['message']);process[_0xd52d('0x56')](0x1);}function handleError(_0x5b6314,_0x159d36){stats[_0xd52d('0x57')][_0xd52d('0x19')]({'name':_0x159d36[_0xd52d('0x58')],'message':_0x159d36['message'],'row':_0x5b6314});}function handleQuery(_0x2cb23d){logger[_0xd52d('0x59')](_0x2cb23d);return db[_0xd52d('0x5a')][_0xd52d('0x5b')](_0x2cb23d)[_0xd52d('0x5c')](function(_0x3ff659){results[_0xd52d('0x19')](_0x3ff659);})[_0xd52d('0x5d')](function(_0x13f587){logger[_0xd52d('0x5e')](_0x13f587[_0xd52d('0x5f')]);});}function updateTzCampaigns(_0xdebfa){return new Promise(function(_0x32a1ce,_0x4d2cff){var _0x736e10=squel[_0xd52d('0xf')]()['fields']([_0xd52d('0x60'),_0xd52d('0x61')])[_0xd52d('0x12')](_0xd52d('0x62'))[_0xd52d('0x37')](_0xd52d('0x63'),null,_0xd52d('0x64'))[_0xd52d('0x15')](_0xd52d('0x65')+_0xdebfa);db[_0xd52d('0x5a')][_0xd52d('0x5b')](_0x736e10[_0xd52d('0x44')]())[_0xd52d('0x5c')](function(_0x1498f5){var _0x501539=[];for(var _0x45c64a=0x0;_0x45c64a<_0x1498f5['length'];_0x45c64a++){_0x501539[_0xd52d('0x19')](getTimezoneData(_0x1498f5[_0x45c64a],tmp_campaigns));}BPromise[_0xd52d('0x1a')](_0x501539)[_0xd52d('0x18')](function(){_0x32a1ce({'val':0x1});});})[_0xd52d('0x5d')](function(_0x281ba3){logger[_0xd52d('0x5e')](_0x281ba3[_0xd52d('0x5f')]);_0x32a1ce({'val':0x0});});});}function updateTzVoiceQueues(_0x123545){return new Promise(function(_0x10f9fd,_0x2608b9){var _0x58bdb5=squel[_0xd52d('0xf')]()[_0xd52d('0x36')](['voice_queues.id',_0xd52d('0x66')])[_0xd52d('0x12')](_0xd52d('0x67'))['join'](_0xd52d('0x68'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0xd52d('0x15')](_0xd52d('0x69')+_0x123545);db[_0xd52d('0x5a')][_0xd52d('0x5b')](_0x58bdb5[_0xd52d('0x44')]())[_0xd52d('0x5c')](function(_0x55fbb5){var _0x27c15a=[];for(var _0x47d14f=0x0;_0x47d14f<_0x55fbb5[_0xd52d('0x1d')];_0x47d14f++){_0x27c15a[_0xd52d('0x19')](getTimezoneData(_0x55fbb5[_0x47d14f],tmp_voice_queues));}BPromise[_0xd52d('0x1a')](_0x27c15a)['then'](function(){_0x10f9fd({'val':0x1});});})['catch'](function(_0x43f7ec){logger[_0xd52d('0x5e')](_0x43f7ec['message']);_0x10f9fd({'val':0x0});});});}function getTimezoneData(_0x1b1dbe,_0xfbb4ba){return new Promise(function(_0x18f682,_0x55a068){var _0x2833ac=shared[_0xd52d('0x6a')];var _0x4fb8ed=_0x2833ac[_0x1b1dbe[_0xd52d('0x6b')]];if(_[_0xd52d('0x1e')](_0x4fb8ed)){_0x18f682({'ret':0x1});}else{var _0x280549=_0x4fb8ed['utcOffset'];var _0x84845a=squel[_0xd52d('0x2b')]()[_0xd52d('0x2c')](_0xfbb4ba)['set']('id',_0x1b1dbe['id'])[_0xd52d('0x6c')]('offset',_0x280549)[_0xd52d('0x6c')](_0xd52d('0x6b'),_0x1b1dbe[_0xd52d('0x6b')])['toString']();return db[_0xd52d('0x5a')]['query'](_0x84845a)[_0xd52d('0x5c')](function(_0x10844c){_0x18f682({'ret':0x1});})[_0xd52d('0x5d')](function(_0x49cdd4){logger[_0xd52d('0x5e')](_0x49cdd4[_0xd52d('0x5f')]);_0x55a068({'ret':0x1});});}});}function handleTZQuery(_0x30324b){logger[_0xd52d('0x59')](_0x30324b);return db[_0xd52d('0x5a')][_0xd52d('0x5b')](_0x30324b)['spread'](function(_0x491c8f){})['catch'](function(_0x248780){logger[_0xd52d('0x5e')](_0x248780[_0xd52d('0x5f')]);});}function main(_0x8ea2dd,_0x4e17c1,_0x2aa06d,_0x395b7b){logger[_0xd52d('0x59')](_0xd52d('0x6d'),_0x8ea2dd,JSON[_0xd52d('0x6e')](_0x4e17c1));process[_0xd52d('0x6f')](_0xd52d('0x70'));var _0x1015fa=_0x4e17c1[_0xd52d('0x71')];var _0x1af99d=_[_0xd52d('0x72')](_0x1015fa);var _0x5e49b6=_0x4e17c1['socket_timestamp'];var _0x3fc97f=path[_0xd52d('0x37')](config['root'],'server/files/tmp',_0x5e49b6+_0xd52d('0x73'));hasTZ=_[_0xd52d('0x74')](_0x1015fa)[_0xd52d('0x75')](_0xd52d('0x6b'));var _0x4a3d05=_['keys'](_0x1015fa)[_0xd52d('0x37')]();logger[_0xd52d('0x59')](_0xd52d('0x76'),_0x4a3d05);db[_0xd52d('0x77')][_0xd52d('0x17')]({'raw':!![],'attributes':['id',_0xd52d('0x78')]})['then'](function(_0x441213){for(var _0x397de9=0x0;_0x397de9<_0x441213['length'];_0x397de9++){if(_0x441213[_0x397de9]['name']in _0x1015fa){contactItemTypes[_0xd52d('0x19')](_0x441213[_0x397de9]);delete _0x1af99d[_0x441213[_0x397de9]['name']];hasAdditionalPhones=!![];}for(var _0x58e728 in _0x1015fa){if(_0x441213[_0x397de9][_0xd52d('0x78')]+_0xd52d('0x79')===_0x58e728){phoneDescriptions[_0xd52d('0x19')]({'itemTypeId':_0x441213[_0x397de9]['id'],'description':_0x58e728});delete _0x1af99d[_0x58e728];}}}if(hasAdditionalPhones)_0x1af99d[_0xd52d('0x1b')]='';var _0x56d1c1=_[_0xd52d('0x74')](_0x1af99d)['join']();logger[_0xd52d('0x59')](_0xd52d('0x76'),_0x56d1c1);fs['writeFileSync'](_0x3fc97f,_0x56d1c1+'\x0a');Papa[_0xd52d('0x7a')](fs[_0xd52d('0x7b')](_0x8ea2dd),{'header':!![],'skipEmptyLines':!![],'step':function(_0x494b8b,_0x357cc6){try{for(var _0x603edc=0x0,_0x4b940c=[];_0x603edc<_0x494b8b[_0xd52d('0x7c')]['length'];_0x603edc++){stats['rows']+=0x1;if(_0x494b8b['errors'][_0x603edc]){handleError(_0x494b8b[_0xd52d('0x7c')][_0x603edc],_0x494b8b[_0xd52d('0x57')][_0x603edc]);}else{var _0x5dc124=[];var _0x38becb=[];var _0x28671e={};for(var _0x43b722 in _0x1015fa){let _0x1aad56=contactItemTypes[_0xd52d('0x7d')](_0x46f55f=>_0x46f55f['name']===_0x43b722);let _0x386818=contactItemTypes[_0xd52d('0x7d')](_0x2a31d1=>_0x2a31d1[_0xd52d('0x78')]+_0xd52d('0x79')===_0x43b722);if(_['isNil'](_0x1aad56)&&_['isNil'](_0x386818)){if(_0x1015fa[_0xd52d('0x7e')](_0x43b722)){if(_0x494b8b[_0xd52d('0x7c')][_0x603edc][_0x1015fa[_0x43b722]]){var _0x7173b1=_['trim'](_0x494b8b[_0xd52d('0x7c')][_0x603edc][_0x1015fa[_0x43b722]]['replace'](/"/g,'\x27'));switch(_0x43b722){case'scheduledat':var _0x3987e2=moment(_0x7173b1,_0xd52d('0xd'),!![]);if(_0x3987e2[_0xd52d('0x7f')]()){_0x4b940c[_0xd52d('0x19')]('\x22'+_0x7173b1+'\x22');}else{_0x5dc124[_0xd52d('0x19')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xd52d('0x33'):var _0x24bf6d=parseInt(_0x7173b1);_0x7173b1=_[_0xd52d('0x80')](_0x24bf6d)||_0x24bf6d<0x0||_0x24bf6d>0x4?_0x395b7b?0x3:0x2:_0x24bf6d;_0x4b940c[_0xd52d('0x19')]('\x22'+_0x7173b1+'\x22');break;case _0xd52d('0x34'):var _0x4140bd=parseInt(_0x7173b1);if(_[_0xd52d('0x81')](_0x4140bd)&&_[_0xd52d('0x75')](_0x2aa06d,_0x4140bd)){_0x4b940c[_0xd52d('0x19')]('\x22'+_0x4140bd+'\x22');}else{_0x5dc124['push'](_0xd52d('0x82'));}break;case _0xd52d('0x83'):if(isEmail(_0x7173b1)){_0x4b940c[_0xd52d('0x19')]('\x22'+_0x7173b1+'\x22');}else{_0x5dc124['push'](_0xd52d('0x84'));}break;case _0xd52d('0x85'):var _0x4ccc14=moment(_0x7173b1,_0xd52d('0x86'),!![]);if(_0x4ccc14[_0xd52d('0x7f')]()){_0x4b940c['push']('\x22'+_0x7173b1+'\x22');}else{_0x5dc124[_0xd52d('0x19')](_0xd52d('0x87'));}break;case _0xd52d('0x6b'):var _0xb5d741=shared[_0xd52d('0x6a')];var _0x163acc=_0xb5d741[_0x7173b1];if(!_[_0xd52d('0x1e')](_0x163acc)){var _0x9a9235=_0x163acc[_0xd52d('0x88')];_0x4b940c[_0xd52d('0x19')]('\x22'+_0x7173b1+'\x22');_0x4b940c[_0xd52d('0x19')]('\x22'+_0x9a9235+'\x22');}break;default:_0x4b940c[_0xd52d('0x19')]('\x22'+_0x7173b1+'\x22');}}else{switch(_0x43b722){case _0xd52d('0x89'):case _0xd52d('0x11'):_0x5dc124[_0xd52d('0x19')](_0x43b722+'\x20not\x20specified');break;default:_0x4b940c[_0xd52d('0x19')]('\x22\x22');}}}}else{var _0x94748a='';if(!_['isNil'](_0x1aad56)){if(!_0x28671e['hasOwnProperty'](_0x1aad56['id'])){if(!_[_0xd52d('0x1e')](_0x494b8b[_0xd52d('0x7c')][_0x603edc][_0x1015fa[_0x43b722]])){var _0x7173b1=_[_0xd52d('0x8a')](_0x494b8b[_0xd52d('0x7c')][_0x603edc][_0x1015fa[_0x43b722]]['replace'](/"/g,'\x27'));var _0xed2f8a=phoneDescriptions[_0xd52d('0x7d')](_0x132cf5=>_0x132cf5[_0xd52d('0x8b')]===_0x1aad56['id']);if(!_[_0xd52d('0x1e')](_0xed2f8a)){var _0x4c1b5b=_[_0xd52d('0x8a')](_0x494b8b['data'][_0x603edc][_0x1015fa[_0xed2f8a[_0xd52d('0x8c')]]]['replace'](/"/g,'\x27'));if(!_['isNil'](_0x4c1b5b))_0x7173b1=_0x7173b1+'§'+_0x4c1b5b;}if(_0x94748a=='')_0x94748a=_0x7173b1;else _0x94748a+='|'+_0x7173b1;}_0x38becb[_0xd52d('0x19')](_0x1aad56['id']+':'+_0x94748a);_0x28671e[_0x1aad56['id']]=0x1;}}}}if(hasAdditionalPhones){_0x4b940c[_0xd52d('0x19')]('\x22'+_0x38becb[_0xd52d('0x37')](';')+'\x22');}if(_0x5dc124[_0xd52d('0x1d')]){handleError(_0x494b8b[_0xd52d('0x7c')][_0x603edc],{'code':'SystemRow','message':_0x5dc124[_0xd52d('0x37')]()});}else{fs['appendFileSync'](_0x3fc97f,_0x4b940c[_0xd52d('0x37')]()+'\x0a');}_0x4b940c=[];}if(!(stats['rows']%0xc8)){socket[_0xd52d('0x8d')](_0xd52d('0x8e')+_0x5e49b6,stats);stats[_0xd52d('0x57')]=[];}}if(stopped){logger['info'](_0xd52d('0x8f'));_0x357cc6[_0xd52d('0x90')]();}}catch(_0x519097){handleError(_0x494b8b[_0xd52d('0x7c')][_0x603edc],{'code':_0xd52d('0x91'),'message':_0x519097['message']});logger['error'](_0xd52d('0x92'),_0x519097[_0xd52d('0x5f')]);}},'complete':function(){try{var _0x34f43b=[];var _0x576719=[];var _0x496151=_0xd52d('0x38');if(_0x4e17c1['duplicates']&&_0x4e17c1['duplicates'][_0xd52d('0x1d')]){_0x496151=_0xd52d('0x93')+_0x5e49b6;_0x34f43b[_0xd52d('0x19')]('CREATE\x20TABLE\x20'+_0x496151+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0xd52d('0x94')+_0x5e49b6;tmp_voice_queues=_0xd52d('0x95')+_0x5e49b6;_0x576719[_0xd52d('0x19')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0xd52d('0x96'));_0x576719['push']('CREATE\x20TABLE\x20'+tmp_voice_queues+_0xd52d('0x96'));BPromise['each'](_0x576719,handleTZQuery)[_0xd52d('0x18')](function(_0x547472){updateTzCampaigns(_0x4e17c1[_0xd52d('0x31')])['then'](function(_0x25c6d8){updateTzVoiceQueues(_0x4e17c1['ListId'])['then'](function(_0x739031){if(hasTZ)_0x56d1c1=_0x56d1c1[_0xd52d('0x97')](_0xd52d('0x6b'),_0xd52d('0x98'));var _0x1745f8=util['format'](_0xd52d('0x99'),_0x3fc97f,_0x496151,_0x56d1c1,_0x4e17c1[_0xd52d('0x31')],_0x4e17c1[_0xd52d('0x9a')]||null,NOW,NOW);if(_[_0xd52d('0x1e')](_0x1015fa[_0xd52d('0x2f')])){_0x1745f8+=',\x20scheduledAt\x20=\x20NOW()';}_0x34f43b[_0xd52d('0x19')](_0x1745f8);if(_0x4e17c1[_0xd52d('0x9b')]&&_0x4e17c1[_0xd52d('0x9b')][_0xd52d('0x1d')]){_0x34f43b[_0xd52d('0x19')](insertCmContact(_0x4e17c1[_0xd52d('0x31')],_0x496151,_0x4e17c1[_0xd52d('0x9b')],_0x1015fa));_0x34f43b[_0xd52d('0x19')](_0xd52d('0x9c')+_0x496151+';');}BPromise[_0xd52d('0x9d')](_0x34f43b,handleQuery)[_0xd52d('0x18')](function(_0x4fff6e){BPromise[_0xd52d('0x1a')]([handleAdditionalPhones()])[_0xd52d('0x18')](function(){_0x34f43b=[];for(var _0x383ae2=0x0;_0x383ae2\x20\x20');}var _0x327786=path[_0xd52d('0x37')](config[_0xd52d('0xa8')],'server/files/tmp',process['argv'][0x2]);if(!fs[_0xd52d('0xa9')](_0x327786)){throw new Error(_0xd52d('0xaa'));}var _0x4de442={};try{_0x4de442=JSON[_0xd52d('0x7a')](process[_0xd52d('0xa7')][0x3]);if(!_0x4de442[_0xd52d('0x71')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x4de442[_0xd52d('0x71')][_0xd52d('0x11')]){throw new Error(_0xd52d('0xab'));}if(!_0x4de442['binding'][_0xd52d('0x89')]){throw new Error(_0xd52d('0xac'));}var _0x14b760=0x0;if(_0x4de442[_0xd52d('0x71')][_0xd52d('0x34')]){_0x14b760=0x1;}if(!_0x4de442[_0xd52d('0x31')]){throw new Error(_0xd52d('0xad'));}}catch(_0x2c5d0f){throw new Error(_0xd52d('0xae'));}var _0x2dc8f3=[];try{_0x2dc8f3=_['map'](JSON['parse'](process[_0xd52d('0xa7')][0x4]),'id');}catch(_0x4c63b7){logger[_0xd52d('0x59')](_0xd52d('0xaf'));}main(_0x327786,_0x4de442,_0x2dc8f3,_0x14b760);}validate();process['on']('SIGINT',handleStop);process['on'](_0xd52d('0xb0'),handleUncaughtException); \ No newline at end of file +var _0x27b2=['cm_contacts.createdAt','cm_hopper_black','cm_contacts','ListId\x20=\x20?','toString','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.UserId','cm_contacts.ListId\x20=\x20','ListId','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_hopper.ListId\x20=\x20?','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','field','MIN(id)','group','info','Received\x20SIGINT','exit','errors','code','message','sequelize','query','spread','catch','error','campaigns.id','campaigns.dialTimezone','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','utcOffset','set','offset','dialTimezone','main','stringify','send','start','binding','clone','socket_timestamp','root','server/files/tmp','.csv','keys','header','name','_description','writeFileSync','parse','createReadStream','data','rows','find','trim','replace','isValid','isNaN','isNumber','includes','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','hasOwnProperty','itemTypeId','description','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','voice_queues_','CREATE\x20TABLE\x20','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','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','each','contactId','contactTypeId','orderBy','voice_queues_has_cm_lists','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns','campaigns_has_cm_blacklists','CampaignId','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','phone','from','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','then','length','push','AdditionalPhones','split','all','isNil','filter','CmContactHasItem','update','updated','create','PHONE','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','createdAt','updatedAt','priority','UserId','fields','join','.CmListId','.id\x20=\x20','where','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x27b2,0x84));var _0x227b=function(_0x65669c,_0x104cb0){_0x65669c=_0x65669c-0x0;var _0x4b9428=_0x27b2[_0x65669c];return _0x4b9428;};'use strict';var fs=require('fs');var path=require(_0x227b('0x0'));var _=require(_0x227b('0x1'));var Papa=require(_0x227b('0x2'));var util=require(_0x227b('0x3'));var BPromise=require(_0x227b('0x4'));var moment=require(_0x227b('0x5'));var squel=require(_0x227b('0x6'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0x227b('0x7'));var shared=require(_0x227b('0x8'));var logger=require(_0x227b('0x9'))(_0x227b('0xa'));config[_0x227b('0xb')]=_['defaults'](config['redis'],{'host':_0x227b('0xc'),'port':0x18eb});var socket=require(_0x227b('0xd'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x227b('0xe')](_0x227b('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0x227b('0xf'));function isEmail(_0x581864){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))*$/[_0x227b('0x10')](_0x581864);}function selectNotIn(_0x7053d0,_0xc57653,_0x2165c2,_0x16fc1e,_0x622b04){return squel[_0x227b('0x11')]()['field'](_0x227b('0x12'))[_0x227b('0x13')](_0x16fc1e)['join'](_0xc57653,null,_0xc57653+'.id\x20=\x20'+_0x16fc1e+'.'+_0x2165c2)['where'](_0x16fc1e+'.'+_0x2165c2+_0x227b('0x14')+_0x7053d0+'.'+_0x2165c2)['where'](_0xc57653+_0x227b('0x15')+_0x622b04['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4052f3,_0x289d98){promisesAdditionalPhones=[];return db[_0x227b('0x16')][_0x227b('0x17')]({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x227b('0x18')](function(_0x4795ae){if(_0x4795ae!==null){var _0x4abc90=[];for(var _0x896ab1=0x0;_0x896ab1<_0x4795ae[_0x227b('0x19')];_0x896ab1++){var _0x1e4e11=_0x4795ae[_0x896ab1];_0x4abc90[_0x227b('0x1a')](insertAdditionalPhones(_0x1e4e11));}}Promise['all'](_0x4abc90)[_0x227b('0x18')](function(){_0x4052f3({'val':0x1});});});});}function insertAdditionalPhones(_0x11de16){return new Promise(function(_0x5296b8,_0x3af965){var _0x4d823d=_0x11de16[_0x227b('0x1b')];var _0x171da8=_0x4d823d[_0x227b('0x1c')](';');var _0x10745f=[];orderBy=0x0;for(var _0x380980=0x0;_0x380980<_0x171da8['length'];_0x380980++){_0x10745f[_0x227b('0x1a')](splitAdditionalPhone(_0x11de16['id'],_0x171da8[_0x380980]));}Promise[_0x227b('0x1d')](_0x10745f)[_0x227b('0x18')](function(){_0x5296b8({'val':_0x171da8[_0x227b('0x19')]});});});}function splitAdditionalPhone(_0x120b05,_0x9de4d1){return new Promise(function(_0x5a3c61,_0x6092b6){var _0x2b571e=_0x9de4d1[_0x227b('0x1c')](':');var _0xad31db=_0x2b571e[0x0];var _0x300034=_0x2b571e[0x1];if(!_[_0x227b('0x1e')](_0x300034)){var _0x5ac2ae=_0x300034['split']('|');var _0x487447=[];for(var _0x1faa21=0x0;_0x1faa21<_0x5ac2ae[_0x227b('0x19')];_0x1faa21++){if(_0x5ac2ae[_0x1faa21]!==''){var _0x46b7e4=_[_0x227b('0x1f')](promisesAdditionalPhones,{'contactId':_0x120b05,'phone':_0x5ac2ae[_0x1faa21]});if(_0x46b7e4[_0x227b('0x19')]==0x0){orderBy++;promisesAdditionalPhones[_0x227b('0x1a')]({'contactId':_0x120b05,'contactTypeId':_0xad31db,'phone':_0x5ac2ae[_0x1faa21],'orderBy':orderBy});}}}_0x5a3c61({'ok':0x1});}else _0x5a3c61({'res':0x0});});}function createAdditionalPhone(_0x24d69b,_0x1229c7,_0x1741e7,_0x30701d){var _0x48b753='';var _0x1659b6='';var _0x1b327f=_0x1741e7[_0x227b('0x1c')]('§');_0x48b753=_0x1b327f[0x0];if(_0x1b327f[_0x227b('0x19')]==0x2)_0x1659b6=_0x1b327f[0x1];return new Promise(function(_0x58cb26,_0x45db3b){return db[_0x227b('0x20')]['findOne']({'where':{'CmContactId':_0x24d69b,'item':_0x48b753}})[_0x227b('0x18')](function(_0x4eed6e){if(_0x4eed6e){return db[_0x227b('0x20')][_0x227b('0x21')]({'ItemTypeId':_0x1229c7,'description':_0x1659b6,'OrderBy':_0x30701d},{'where':{'CmContactId':_0x24d69b,'item':_0x48b753}})[_0x227b('0x18')](function(_0x50cc7f){_0x58cb26({'res':_0x227b('0x22')});});}else{return db['CmContactHasItem'][_0x227b('0x23')]({'CmContactId':_0x24d69b,'item':_0x48b753,'description':_0x1659b6,'ItemTypeId':_0x1229c7,'OrderBy':_0x30701d,'ItemClass':_0x227b('0x24')})[_0x227b('0x18')](function(_0x34b667){_0x58cb26({'res':'inserted'});});}});});}function insertCmHopper(_0x47e4ec,_0x28e85f,_0x5ced6a,_0x59b585,_0x1688d3){var _0x47b820=['cm_contacts.phone','cm_contacts.scheduledat',_0x227b('0x25'),_0x227b('0x26'),_0x28e85f+'.'+_0x59b585,'cm_contacts.createdAt',_0x227b('0x27'),_0x227b('0x28'),'cm_contacts.UserId','\x22'+_0x1688d3+'\x22'];return squel[_0x227b('0x29')]()[_0x227b('0x2a')](_0x227b('0x2b'))[_0x227b('0x2c')](['phone',_0x227b('0x2d'),_0x227b('0x2e'),'ListId',_0x59b585,_0x227b('0x2f'),_0x227b('0x30'),_0x227b('0x31'),_0x227b('0x32'),'recallme'],squel[_0x227b('0x11')]()[_0x227b('0x33')](_0x47b820)['from'](_0x28e85f)[_0x227b('0x34')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x28e85f+_0x227b('0x35'))[_0x227b('0x34')](_0x5ced6a,null,_0x5ced6a+_0x227b('0x36')+_0x28e85f+'.'+_0x59b585)[_0x227b('0x37')](_0x28e85f+_0x227b('0x38'),_0x47e4ec)[_0x227b('0x37')](_0x227b('0x39'),NOW)[_0x227b('0x37')](_0x227b('0x3a'),selectNotIn(_0x28e85f,_0x5ced6a,_0x59b585,'cm_hopper',[_0x227b('0x3b'),_0x227b('0x3c')]))['where'](_0x227b('0x3a'),selectNotIn(_0x28e85f,_0x5ced6a,_0x59b585,_0x227b('0x2b'),[_0x227b('0x3b')])))['toString']();}function insertCmHopperBlack(_0x3c14d8,_0x5b9809,_0x3d6ba7,_0x11059c){var _0x12cbc1=[_0x227b('0x3d'),_0x227b('0x25'),_0x227b('0x26'),_0x5b9809+'.'+_0x11059c,_0x227b('0x3e'),'cm_contacts.updatedAt'];return squel[_0x227b('0x29')]()[_0x227b('0x2a')](_0x227b('0x3f'))[_0x227b('0x2c')]([_0x227b('0x12'),'ContactId','ListId',_0x11059c,'createdAt',_0x227b('0x30')],squel[_0x227b('0x11')]()[_0x227b('0x33')](_0x12cbc1)[_0x227b('0x13')](_0x5b9809)[_0x227b('0x34')](_0x227b('0x40'),null,'cm_contacts.ListId\x20=\x20'+_0x5b9809+_0x227b('0x35'))[_0x227b('0x34')](_0x3d6ba7,null,_0x3d6ba7+'.id\x20=\x20'+_0x5b9809+'.'+_0x11059c)['where'](_0x5b9809+_0x227b('0x38'),_0x3c14d8)['where'](_0x227b('0x39'),NOW)[_0x227b('0x37')](_0x227b('0x3a'),squel[_0x227b('0x11')]()['field'](_0x227b('0x12'))[_0x227b('0x13')](_0x227b('0x3f'))[_0x227b('0x37')](_0x227b('0x41'),_0x3c14d8)[_0x227b('0x37')](_0x11059c+'\x20=\x20'+_0x5b9809+'.'+_0x11059c)))[_0x227b('0x42')]();}function insertTzCmHopper(_0x238121,_0xb36f8f,_0x24f694,_0x164999,_0x4d2da7,_0x12ac5a){var _0x41afcf=[_0x227b('0x3d'),_0x227b('0x43')+_0x12ac5a+_0x227b('0x44'),'cm_contacts.id',_0x227b('0x26'),_0xb36f8f+'.'+_0x164999,_0x227b('0x3e'),'cm_contacts.updatedAt',_0x227b('0x28'),_0x227b('0x45'),'\x22'+_0x4d2da7+'\x22'];var _0x16486e=squel[_0x227b('0x29')]()[_0x227b('0x2a')](_0x227b('0x2b'))[_0x227b('0x2c')](['phone',_0x227b('0x2d'),_0x227b('0x2e'),'ListId',_0x164999,'createdAt','updatedAt','priority','UserId','recallme'],squel[_0x227b('0x11')]()[_0x227b('0x33')](_0x41afcf)[_0x227b('0x13')](_0xb36f8f)[_0x227b('0x34')](_0x227b('0x40'),null,_0x227b('0x46')+_0xb36f8f+_0x227b('0x35'))['join'](_0x24f694,null,_0x24f694+'.id\x20=\x20'+_0xb36f8f+'.'+_0x164999)[_0x227b('0x34')](_0x12ac5a,null,_0x12ac5a+_0x227b('0x36')+_0xb36f8f+'.'+_0x164999)['where'](_0xb36f8f+_0x227b('0x38'),_0x238121)[_0x227b('0x37')](_0x227b('0x39'),NOW)['where'](_0x227b('0x3a'),selectNotIn(_0xb36f8f,_0x24f694,_0x164999,'cm_hopper',[_0x227b('0x3b'),'\x22onlyIfOpen\x22']))[_0x227b('0x37')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0xb36f8f,_0x24f694,_0x164999,_0x227b('0x2b'),[_0x227b('0x3b')])))[_0x227b('0x42')]();return _0x16486e;}function insertTzCmHopperBlack(_0x1a78c1,_0x56031c,_0x5716ab,_0x4e71e1){var _0x1bca96=[_0x227b('0x3d'),_0x227b('0x25'),_0x227b('0x26'),_0x56031c+'.'+_0x4e71e1,_0x227b('0x3e'),_0x227b('0x27')];return squel[_0x227b('0x29')]()['into'](_0x227b('0x3f'))['fromQuery']([_0x227b('0x12'),_0x227b('0x2e'),_0x227b('0x47'),_0x4e71e1,'createdAt',_0x227b('0x30')],squel[_0x227b('0x11')]()['fields'](_0x1bca96)[_0x227b('0x13')](_0x56031c)['join']('cm_contacts',null,_0x227b('0x46')+_0x56031c+_0x227b('0x35'))[_0x227b('0x34')](_0x5716ab,null,_0x5716ab+_0x227b('0x36')+_0x56031c+'.'+_0x4e71e1)['where'](_0x56031c+_0x227b('0x38'),_0x1a78c1)[_0x227b('0x37')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x227b('0x37')](_0x227b('0x3a'),squel[_0x227b('0x11')]()['field'](_0x227b('0x12'))[_0x227b('0x13')]('cm_hopper_black')[_0x227b('0x37')](_0x227b('0x41'),_0x1a78c1)[_0x227b('0x37')](_0x4e71e1+_0x227b('0x14')+_0x56031c+'.'+_0x4e71e1)))['toString']();}function insertCmHopperAdditionalPhones(_0x537cf6){var _0x5aa148=['cm_hopper.id',_0x227b('0x48'),_0x227b('0x49'),_0x227b('0x4a'),_0x227b('0x4b')];return squel[_0x227b('0x29')]()[_0x227b('0x2a')](_0x227b('0x4c'))[_0x227b('0x2c')](['CmHopperId',_0x227b('0x12'),_0x227b('0x4d'),'createdAt',_0x227b('0x30')],squel['select']()[_0x227b('0x33')](_0x5aa148)['from'](_0x227b('0x2b'))[_0x227b('0x34')](_0x227b('0x40'),null,_0x227b('0x4e'))[_0x227b('0x34')](_0x227b('0x4f'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x227b('0x37')](_0x227b('0x50'),_0x537cf6)[_0x227b('0x37')](_0x227b('0x39'),NOW))[_0x227b('0x42')]();}function insertCmContact(_0x1bfde6,_0x381e13,_0x3ab9c8,_0x11200a){var _0x1c1c70=_['concat'](_['keys'](_0x11200a),[_0x227b('0x47'),_0x227b('0x51'),_0x227b('0x2f'),_0x227b('0x30'),_0x227b('0x52')]);return squel[_0x227b('0x29')]()[_0x227b('0x2a')]('cm_contacts')[_0x227b('0x2c')](_0x1c1c70,squel[_0x227b('0x11')]()[_0x227b('0x33')](_0x1c1c70)[_0x227b('0x13')](_0x381e13)[_0x227b('0x37')]('('+_0x3ab9c8['join'](',')+_0x227b('0x53'),squel[_0x227b('0x11')]()[_0x227b('0x33')](_0x3ab9c8)[_0x227b('0x13')]('cm_contacts')[_0x227b('0x37')](_0x227b('0x41'),_0x1bfde6)[_0x227b('0x37')](_0x227b('0x54')))['where'](_0x227b('0x55'),squel['select']()[_0x227b('0x56')](_0x227b('0x57'),'min_id')['from'](_0x381e13)[_0x227b('0x58')](_0x3ab9c8[_0x227b('0x34')](','))))['toString']();}function handleStop(){logger[_0x227b('0x59')](_0x227b('0x5a'));stopped=!![];}function handleUncaughtException(_0x4226c5){logger['error'](_0x4226c5['message']);process[_0x227b('0x5b')](0x1);}function handleError(_0x1ece21,_0x4b916e){stats[_0x227b('0x5c')][_0x227b('0x1a')]({'name':_0x4b916e[_0x227b('0x5d')],'message':_0x4b916e[_0x227b('0x5e')],'row':_0x1ece21});}function handleQuery(_0x4fb62c){logger[_0x227b('0x59')](_0x4fb62c);return db[_0x227b('0x5f')][_0x227b('0x60')](_0x4fb62c)[_0x227b('0x61')](function(_0x2d48b7){results[_0x227b('0x1a')](_0x2d48b7);})[_0x227b('0x62')](function(_0x57bc35){logger[_0x227b('0x63')](_0x57bc35['message']);});}function updateTzCampaigns(_0xf158b){return new Promise(function(_0x5f0d1d,_0x159aab){var _0x313619=squel[_0x227b('0x11')]()['fields']([_0x227b('0x64'),_0x227b('0x65')])[_0x227b('0x13')]('campaigns')[_0x227b('0x34')](_0x227b('0x66'),null,_0x227b('0x67'))[_0x227b('0x37')]('campaigns_has_cm_lists.CmListId='+_0xf158b);db[_0x227b('0x5f')][_0x227b('0x60')](_0x313619[_0x227b('0x42')]())['spread'](function(_0x490612){var _0x454ca9=[];for(var _0x50efbf=0x0;_0x50efbf<_0x490612[_0x227b('0x19')];_0x50efbf++){_0x454ca9[_0x227b('0x1a')](getTimezoneData(_0x490612[_0x50efbf],tmp_campaigns));}BPromise['all'](_0x454ca9)['then'](function(){_0x5f0d1d({'val':0x1});});})['catch'](function(_0x494db7){logger[_0x227b('0x63')](_0x494db7[_0x227b('0x5e')]);_0x5f0d1d({'val':0x0});});});}function updateTzVoiceQueues(_0x39a334){return new Promise(function(_0x5e5c74,_0x23eb6b){var _0x54edec=squel[_0x227b('0x11')]()[_0x227b('0x33')]([_0x227b('0x68'),_0x227b('0x69')])[_0x227b('0x13')](_0x227b('0x6a'))[_0x227b('0x34')]('voice_queues_has_cm_lists',null,_0x227b('0x6b'))[_0x227b('0x37')](_0x227b('0x6c')+_0x39a334);db[_0x227b('0x5f')][_0x227b('0x60')](_0x54edec['toString']())[_0x227b('0x61')](function(_0x205af7){var _0x4eea19=[];for(var _0x304e2b=0x0;_0x304e2b<_0x205af7[_0x227b('0x19')];_0x304e2b++){_0x4eea19[_0x227b('0x1a')](getTimezoneData(_0x205af7[_0x304e2b],tmp_voice_queues));}BPromise[_0x227b('0x1d')](_0x4eea19)[_0x227b('0x18')](function(){_0x5e5c74({'val':0x1});});})[_0x227b('0x62')](function(_0xe152f5){logger[_0x227b('0x63')](_0xe152f5[_0x227b('0x5e')]);_0x5e5c74({'val':0x0});});});}function getTimezoneData(_0x14f7e5,_0x4e12f5){return new Promise(function(_0x42d815,_0x1e178a){var _0x3ff2d2=shared[_0x227b('0x6d')];var _0x222536=_0x3ff2d2[_0x14f7e5['dialTimezone']];if(_[_0x227b('0x1e')](_0x222536)){_0x42d815({'ret':0x1});}else{var _0x24e23a=_0x222536[_0x227b('0x6e')];var _0x504868=squel[_0x227b('0x29')]()[_0x227b('0x2a')](_0x4e12f5)[_0x227b('0x6f')]('id',_0x14f7e5['id'])['set'](_0x227b('0x70'),_0x24e23a)[_0x227b('0x6f')](_0x227b('0x71'),_0x14f7e5[_0x227b('0x71')])['toString']();return db[_0x227b('0x5f')][_0x227b('0x60')](_0x504868)[_0x227b('0x61')](function(_0x4bc653){_0x42d815({'ret':0x1});})[_0x227b('0x62')](function(_0x3ab01e){logger[_0x227b('0x63')](_0x3ab01e[_0x227b('0x5e')]);_0x1e178a({'ret':0x1});});}});}function handleTZQuery(_0x2b4d00){logger[_0x227b('0x59')](_0x2b4d00);return db['sequelize'][_0x227b('0x60')](_0x2b4d00)[_0x227b('0x61')](function(_0x2788b9){})['catch'](function(_0x57d815){logger[_0x227b('0x63')](_0x57d815['message']);});}function main(_0x326726,_0x3ac1c8,_0x4e75b3,_0x9e872b){logger['info'](_0x227b('0x72'),_0x326726,JSON[_0x227b('0x73')](_0x3ac1c8));process[_0x227b('0x74')](_0x227b('0x75'));var _0x3927e7=_0x3ac1c8[_0x227b('0x76')];var _0x58b959=_[_0x227b('0x77')](_0x3927e7);var _0x28eb8b=_0x3ac1c8[_0x227b('0x78')];var _0x3bccbc=path[_0x227b('0x34')](config[_0x227b('0x79')],_0x227b('0x7a'),_0x28eb8b+_0x227b('0x7b'));hasTZ=_[_0x227b('0x7c')](_0x3927e7)['includes']('dialTimezone');var _0x116b11=_[_0x227b('0x7c')](_0x3927e7)['join']();logger['info'](_0x227b('0x7d'),_0x116b11);db['ContactItemType'][_0x227b('0x17')]({'raw':!![],'attributes':['id',_0x227b('0x7e')]})[_0x227b('0x18')](function(_0x113572){for(var _0x2d83ee=0x0;_0x2d83ee<_0x113572[_0x227b('0x19')];_0x2d83ee++){if(_0x113572[_0x2d83ee][_0x227b('0x7e')]in _0x3927e7){contactItemTypes['push'](_0x113572[_0x2d83ee]);delete _0x58b959[_0x113572[_0x2d83ee][_0x227b('0x7e')]];hasAdditionalPhones=!![];}for(var _0x33b150 in _0x3927e7){if(_0x113572[_0x2d83ee][_0x227b('0x7e')]+_0x227b('0x7f')===_0x33b150){phoneDescriptions[_0x227b('0x1a')]({'itemTypeId':_0x113572[_0x2d83ee]['id'],'description':_0x33b150});delete _0x58b959[_0x33b150];}}}if(hasAdditionalPhones)_0x58b959[_0x227b('0x1b')]='';var _0x258322=_[_0x227b('0x7c')](_0x58b959)[_0x227b('0x34')]();logger[_0x227b('0x59')](_0x227b('0x7d'),_0x258322);fs[_0x227b('0x80')](_0x3bccbc,_0x258322+'\x0a');Papa[_0x227b('0x81')](fs[_0x227b('0x82')](_0x326726),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5b2694,_0x47c7c4){try{for(var _0x517484=0x0,_0xefbef5=[];_0x517484<_0x5b2694[_0x227b('0x83')][_0x227b('0x19')];_0x517484++){stats[_0x227b('0x84')]+=0x1;if(_0x5b2694[_0x227b('0x5c')][_0x517484]){handleError(_0x5b2694['data'][_0x517484],_0x5b2694['errors'][_0x517484]);}else{var _0x2895ae=[];var _0x3673bb=[];var _0x58c946={};for(var _0x337584 in _0x3927e7){let _0x14ac55=contactItemTypes[_0x227b('0x85')](_0x2bfd9f=>_0x2bfd9f[_0x227b('0x7e')]===_0x337584);let _0x32eab5=contactItemTypes[_0x227b('0x85')](_0x109f8b=>_0x109f8b[_0x227b('0x7e')]+_0x227b('0x7f')===_0x337584);if(_['isNil'](_0x14ac55)&&_[_0x227b('0x1e')](_0x32eab5)){if(_0x3927e7['hasOwnProperty'](_0x337584)){if(_0x5b2694['data'][_0x517484][_0x3927e7[_0x337584]]){var _0x669cfd=_[_0x227b('0x86')](_0x5b2694[_0x227b('0x83')][_0x517484][_0x3927e7[_0x337584]][_0x227b('0x87')](/"/g,'\x27'));switch(_0x337584){case _0x227b('0x2d'):var _0x3cbe0c=moment(_0x669cfd,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x3cbe0c[_0x227b('0x88')]()){_0xefbef5[_0x227b('0x1a')]('\x22'+_0x669cfd+'\x22');}else{_0x2895ae[_0x227b('0x1a')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x40254a=parseInt(_0x669cfd);_0x669cfd=_[_0x227b('0x89')](_0x40254a)||_0x40254a<0x0||_0x40254a>0x4?_0x9e872b?0x3:0x2:_0x40254a;_0xefbef5[_0x227b('0x1a')]('\x22'+_0x669cfd+'\x22');break;case'UserId':var _0x264a3d=parseInt(_0x669cfd);if(_[_0x227b('0x8a')](_0x264a3d)&&_[_0x227b('0x8b')](_0x4e75b3,_0x264a3d)){_0xefbef5['push']('\x22'+_0x264a3d+'\x22');}else{_0x2895ae[_0x227b('0x1a')]('agent\x20not\x20exists');}break;case _0x227b('0x8c'):if(isEmail(_0x669cfd)){_0xefbef5[_0x227b('0x1a')]('\x22'+_0x669cfd+'\x22');}else{_0x2895ae[_0x227b('0x1a')](_0x227b('0x8d'));}break;case _0x227b('0x8e'):var _0x4ab1bf=moment(_0x669cfd,_0x227b('0x8f'),!![]);if(_0x4ab1bf[_0x227b('0x88')]()){_0xefbef5[_0x227b('0x1a')]('\x22'+_0x669cfd+'\x22');}else{_0x2895ae[_0x227b('0x1a')](_0x227b('0x90'));}break;case _0x227b('0x71'):var _0x55bfb4=shared[_0x227b('0x6d')];var _0x5b5d9a=_0x55bfb4[_0x669cfd];if(!_[_0x227b('0x1e')](_0x5b5d9a)){var _0x2f8c3d=_0x5b5d9a['utcOffset'];_0xefbef5['push']('\x22'+_0x669cfd+'\x22');_0xefbef5[_0x227b('0x1a')]('\x22'+_0x2f8c3d+'\x22');}break;default:_0xefbef5[_0x227b('0x1a')]('\x22'+_0x669cfd+'\x22');}}else{switch(_0x337584){case _0x227b('0x91'):case'phone':_0x2895ae['push'](_0x337584+_0x227b('0x92'));break;default:_0xefbef5['push']('\x22\x22');}}}}else{var _0x4be3fa='';if(!_['isNil'](_0x14ac55)){if(!_0x58c946[_0x227b('0x93')](_0x14ac55['id'])){if(!_[_0x227b('0x1e')](_0x5b2694[_0x227b('0x83')][_0x517484][_0x3927e7[_0x337584]])){var _0x669cfd=_[_0x227b('0x86')](_0x5b2694[_0x227b('0x83')][_0x517484][_0x3927e7[_0x337584]][_0x227b('0x87')](/"/g,'\x27'));var _0x27c5bf=phoneDescriptions[_0x227b('0x85')](_0xb3e32f=>_0xb3e32f[_0x227b('0x94')]===_0x14ac55['id']);if(!_['isNil'](_0x27c5bf)){var _0x440dc1=_['trim'](_0x5b2694[_0x227b('0x83')][_0x517484][_0x3927e7[_0x27c5bf[_0x227b('0x95')]]]['replace'](/"/g,'\x27'));if(!_[_0x227b('0x1e')](_0x440dc1))_0x669cfd=_0x669cfd+'§'+_0x440dc1;}if(_0x4be3fa=='')_0x4be3fa=_0x669cfd;else _0x4be3fa+='|'+_0x669cfd;}_0x3673bb[_0x227b('0x1a')](_0x14ac55['id']+':'+_0x4be3fa);_0x58c946[_0x14ac55['id']]=0x1;}}}}if(hasAdditionalPhones){_0xefbef5[_0x227b('0x1a')]('\x22'+_0x3673bb[_0x227b('0x34')](';')+'\x22');}if(_0x2895ae[_0x227b('0x19')]){handleError(_0x5b2694[_0x227b('0x83')][_0x517484],{'code':_0x227b('0x96'),'message':_0x2895ae[_0x227b('0x34')]()});}else{fs[_0x227b('0x97')](_0x3bccbc,_0xefbef5[_0x227b('0x34')]()+'\x0a');}_0xefbef5=[];}if(!(stats['rows']%0xc8)){socket[_0x227b('0x98')](_0x227b('0x99')+_0x28eb8b,stats);stats[_0x227b('0x5c')]=[];}}if(stopped){logger[_0x227b('0x59')](_0x227b('0x9a'));_0x47c7c4[_0x227b('0x9b')]();}}catch(_0x1bdea8){handleError(_0x5b2694[_0x227b('0x83')][_0x517484],{'code':_0x227b('0x9c'),'message':_0x1bdea8[_0x227b('0x5e')]});logger[_0x227b('0x63')](_0x227b('0x9d'),_0x1bdea8[_0x227b('0x5e')]);}},'complete':function(){try{var _0xda1b2c=[];var _0x584740=[];var _0x4f65c4=_0x227b('0x40');if(_0x3ac1c8[_0x227b('0x9e')]&&_0x3ac1c8[_0x227b('0x9e')]['length']){_0x4f65c4=_0x227b('0x9f')+_0x28eb8b;_0xda1b2c[_0x227b('0x1a')]('CREATE\x20TABLE\x20'+_0x4f65c4+_0x227b('0xa0'));}tmp_campaigns='campaigns_'+_0x28eb8b;tmp_voice_queues=_0x227b('0xa1')+_0x28eb8b;_0x584740[_0x227b('0x1a')](_0x227b('0xa2')+tmp_campaigns+_0x227b('0xa3'));_0x584740[_0x227b('0x1a')]('CREATE\x20TABLE\x20'+tmp_voice_queues+_0x227b('0xa3'));BPromise['each'](_0x584740,handleTZQuery)[_0x227b('0x18')](function(_0x35113c){updateTzCampaigns(_0x3ac1c8[_0x227b('0x47')])[_0x227b('0x18')](function(_0x4e68a2){updateTzVoiceQueues(_0x3ac1c8['ListId'])[_0x227b('0x18')](function(_0x398359){if(hasTZ)_0x258322=_0x258322['replace']('dialTimezone',_0x227b('0xa4'));var _0x3900e4=util['format'](_0x227b('0xa5'),_0x3bccbc,_0x4f65c4,_0x258322,_0x3ac1c8[_0x227b('0x47')],_0x3ac1c8[_0x227b('0x51')]||null,NOW,NOW);if(_[_0x227b('0x1e')](_0x3927e7[_0x227b('0x2d')])){_0x3900e4+=_0x227b('0xa6');}_0xda1b2c[_0x227b('0x1a')](_0x3900e4);if(_0x3ac1c8[_0x227b('0x9e')]&&_0x3ac1c8[_0x227b('0x9e')]['length']){_0xda1b2c[_0x227b('0x1a')](insertCmContact(_0x3ac1c8['ListId'],_0x4f65c4,_0x3ac1c8[_0x227b('0x9e')],_0x3927e7));_0xda1b2c[_0x227b('0x1a')](_0x227b('0xa7')+_0x4f65c4+';');}BPromise[_0x227b('0xa8')](_0xda1b2c,handleQuery)[_0x227b('0x18')](function(_0x1c20c5){BPromise[_0x227b('0x1d')]([handleAdditionalPhones()])[_0x227b('0x18')](function(){_0xda1b2c=[];for(var _0x5bde20=0x0;_0x5bde20_0x43eef1[_0x6806('0x67')]===_0x2513bb);let _0x1b77f5=contactItemTypes[_0x6806('0x6e')](_0x5d0427=>_0x5d0427[_0x6806('0x67')]+_0x6806('0x68')===_0x2513bb);if(_[_0x6806('0x17')](_0xa6cc26)&&_[_0x6806('0x17')](_0x1b77f5)){if(_0x8a7165[_0x6806('0x6f')](_0x2513bb)){if(_0x5ed277[_0x6806('0x6c')][_0x27f88a][_0x8a7165[_0x2513bb]]){var _0x2813fe=_['trim'](_0x5ed277[_0x6806('0x6c')][_0x27f88a][_0x8a7165[_0x2513bb]][_0x6806('0x70')](/"/g,'\x27'));switch(_0x2513bb){case _0x6806('0x2e'):var _0x49e2c0=moment(_0x2813fe,_0x6806('0x71'),!![]);if(_0x49e2c0[_0x6806('0x72')]()){_0x346cf0['push']('\x22'+_0x2813fe+'\x22');}else{_0x40ae81[_0x6806('0x19')](_0x6806('0x73'));}break;case _0x6806('0x32'):var _0x33b4fe=parseInt(_0x2813fe);_0x2813fe=_[_0x6806('0x74')](_0x33b4fe)||_0x33b4fe<0x0||_0x33b4fe>0x4?_0x233ccb?0x3:0x2:_0x33b4fe;_0x346cf0[_0x6806('0x19')]('\x22'+_0x2813fe+'\x22');break;case _0x6806('0x75'):var _0x4c4503=parseInt(_0x2813fe);if(_[_0x6806('0x76')](_0x4c4503)&&_[_0x6806('0x77')](_0x57aea8,_0x4c4503)){_0x346cf0[_0x6806('0x19')]('\x22'+_0x4c4503+'\x22');}else{_0x40ae81['push'](_0x6806('0x78'));}break;case _0x6806('0x79'):if(isEmail(_0x2813fe)){_0x346cf0['push']('\x22'+_0x2813fe+'\x22');}else{_0x40ae81[_0x6806('0x19')]('email\x20wrong\x20format');}break;case _0x6806('0x7a'):var _0x3ce32d=moment(_0x2813fe,_0x6806('0x7b'),!![]);if(_0x3ce32d[_0x6806('0x72')]()){_0x346cf0['push']('\x22'+_0x2813fe+'\x22');}else{_0x40ae81['push'](_0x6806('0x7c'));}break;default:_0x346cf0[_0x6806('0x19')]('\x22'+_0x2813fe+'\x22');}}else{switch(_0x2513bb){case _0x6806('0x7d'):case _0x6806('0x27'):_0x40ae81['push'](_0x2513bb+'\x20not\x20specified');break;default:_0x346cf0['push']('\x22\x22');}}}}else{var _0x5a127c='';if(!_[_0x6806('0x17')](_0xa6cc26)){if(!_0x3a988d[_0x6806('0x6f')](_0xa6cc26['id'])){for(var _0x26f227=0x0;_0x26f227<_0x8a7165[_0x2513bb][_0x6806('0x16')];_0x26f227++){var _0x2813fe=_['trim'](_0x5ed277[_0x6806('0x6c')][_0x27f88a][_0x8a7165[_0x2513bb][_0x26f227]][_0x6806('0x70')](/"/g,'\x27'));var _0x5538d6=phoneDescriptions[_0x6806('0x6e')](_0x26269d=>_0x26269d['itemTypeId']===_0xa6cc26['id']);if(!_['isNil'](_0x5538d6)){var _0x4a4348=_[_0x6806('0x7e')](_0x5ed277[_0x6806('0x6c')][_0x27f88a][_0x8a7165[_0x5538d6[_0x6806('0x7f')]][0x0]][_0x6806('0x70')](/"/g,'\x27'));if(!_[_0x6806('0x17')](_0x4a4348))_0x2813fe=_0x2813fe+'§'+_0x4a4348;}if(_0x5a127c=='')_0x5a127c=_0x2813fe;else _0x5a127c+='|'+_0x2813fe;}_0x44e1c7['push'](_0xa6cc26['id']+':'+_0x5a127c);_0x3a988d[_0xa6cc26['id']]=0x1;}}}}if(hasAdditionalPhones){_0x346cf0['push']('\x22'+_0x44e1c7[_0x6806('0x36')](';')+'\x22');}if(_0x40ae81[_0x6806('0x16')]){handleError(_0x5ed277[_0x6806('0x6c')][_0x27f88a],{'code':'SystemRow','message':_0x40ae81['join']()});}else{fs[_0x6806('0x80')](_0xc64de2,_0x346cf0[_0x6806('0x36')]()+'\x0a');}_0x346cf0=[];}if(!(stats[_0x6806('0x6d')]%0xc8)){socket[_0x6806('0x81')](_0x6806('0x82')+_0x383542,stats);stats[_0x6806('0x5c')]=[];}}if(stopped){logger['info'](_0x6806('0x83'));_0x10a86a[_0x6806('0x84')]();}}catch(_0x452b49){handleError(_0x5ed277[_0x6806('0x6c')][_0x27f88a],{'code':_0x6806('0x85'),'message':_0x452b49[_0x6806('0x1d')]});logger[_0x6806('0x5a')](_0x6806('0x86'),_0x452b49[_0x6806('0x1d')]);}},'complete':function(){try{var _0x10ea6c=[];var _0x34ea23=tempTableName;_0x10ea6c[_0x6806('0x19')](_0x6806('0x87')+_0x34ea23+_0x6806('0x88'));logger[_0x6806('0x59')](_0x6806('0x89'),contactItemTypes[_0x6806('0x16')]);var _0x345014=util[_0x6806('0xb')](_0x6806('0x8a'),_0xc64de2,_0x34ea23,_0x21cbec,_0x464885['ListId'],_0x464885[_0x6806('0x8b')]||null,NOW,NOW);if(_['isNil'](_0x8a7165[_0x6806('0x2e')])){_0x345014+=_0x6806('0x8c');}_0x10ea6c['push'](_0x345014);BPromise[_0x6806('0x8d')](_0x10ea6c,handleQuery)['then'](function(_0x40d623){BPromise[_0x6806('0x1a')]([handleAdditionalPhones()])[_0x6806('0x1b')](function(){_0x10ea6c=[];for(var _0x330218=0x0;_0x330218\x20\x20');}var _0x1327c6=path['join'](config[_0x6806('0x63')],_0x6806('0x64'),process[_0x6806('0x95')][0x2]);if(!fs[_0x6806('0x96')](_0x1327c6)){throw new Error(_0x6806('0x97'));}var _0x5d3d0b={};try{_0x5d3d0b=JSON[_0x6806('0x6a')](process[_0x6806('0x95')][0x3]);if(!_0x5d3d0b[_0x6806('0x61')]){throw new Error(_0x6806('0x98'));}var _0x491040=0x0;if(_0x5d3d0b[_0x6806('0x61')][_0x6806('0x75')]){_0x491040=0x1;}if(!_0x5d3d0b[_0x6806('0x43')]){throw new Error(_0x6806('0x99'));}}catch(_0x11854a){throw new Error(_0x6806('0x9a'));}var _0xacdf8=[];try{_0xacdf8=_[_0x6806('0x9b')](JSON[_0x6806('0x6a')](process[_0x6806('0x95')][0x4]),'id');}catch(_0x30750b){logger[_0x6806('0x59')](_0x6806('0x9c'));}main(_0x1327c6,_0x5d3d0b,_0xacdf8,_0x491040);}validate();process['on']('SIGINT',handleStop);process['on'](_0x6806('0x9d'),handleUncaughtException); \ No newline at end of file +var _0x13ea=['CIS\x20len','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','CompanyId','each','contact','contactId','contactTypeId','orderBy','DROP\x20TABLE\x20','finish','affectedRows','unlink','argv','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','map','uncaughtException','papaparse','util','bluebird','squel','../../../mysqldb','../../../config/logger','import','socket.io-emitter','redis','format','cm_contacts_temp_','YYYYMMDDHHmmss','test','field','phone','from','join','.id\x20=\x20','\x20=\x20','where','sequelize','select\x20*\x20from\x20','spread','isNil','AdditionalPhones','push','all','then','catch','message','split','length','filter','CmContactHasItem','findOne','update','updated','create','PHONE','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','cm_hopper','fromQuery','scheduledat','ListId','createdAt','priority','UserId','recallme','select','fields','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.ListId','into','updatedAt','cm_contacts.createdAt\x20=\x20?','cm_hopper_black','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','cm_contacts.id\x20=\x20cm_hopper.ContactId','keys',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','exit','query','main','stringify','send','start','clone','socket_timestamp','root','server/files/tmp','.csv','body','ContactItemType','name','_description','header','writeFileSync','parse','createReadStream','errors','data','find','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','\x20not\x20specified','description','SystemRow','rows','contact:import:','Abort\x20parser','abort','SystemError','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;'];(function(_0x3afd8a,_0x3361a2){var _0x5505fa=function(_0x2f9c9b){while(--_0x2f9c9b){_0x3afd8a['push'](_0x3afd8a['shift']());}};_0x5505fa(++_0x3361a2);}(_0x13ea,0xa9));var _0xa13e=function(_0x1ebc6c,_0x58a00b){_0x1ebc6c=_0x1ebc6c-0x0;var _0x3a826d=_0x13ea[_0x1ebc6c];return _0x3a826d;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require(_0xa13e('0x0'));var util=require(_0xa13e('0x1'));var BPromise=require(_0xa13e('0x2'));var moment=require('moment');var squel=require(_0xa13e('0x3'));var Redis=require('ioredis');var db=require(_0xa13e('0x4'))['db'];var config=require('../../../config/environment');var logger=require(_0xa13e('0x5'))(_0xa13e('0x6'));config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa13e('0x7'))(new Redis(config[_0xa13e('0x8')]));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()[_0xa13e('0x9')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0xa13e('0xa')+moment()[_0xa13e('0x9')](_0xa13e('0xb'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x2aa20a){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))*$/[_0xa13e('0xc')](_0x2aa20a);}function selectNotIn(_0x50f192,_0x176eee,_0x9bcb5c,_0x3eb655,_0x109176){return squel['select']()[_0xa13e('0xd')](_0xa13e('0xe'))[_0xa13e('0xf')](_0x3eb655)[_0xa13e('0x10')](_0x176eee,null,_0x176eee+_0xa13e('0x11')+_0x3eb655+'.'+_0x9bcb5c)['where'](_0x3eb655+'.'+_0x9bcb5c+_0xa13e('0x12')+_0x50f192+'.'+_0x9bcb5c)[_0xa13e('0x13')](_0x176eee+'.dialCheckDuplicateType\x20IN\x20('+_0x109176['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0xd9c8a8,_0x5e7574){promisesAdditionalPhones=[];promisesContact=[];return db[_0xa13e('0x14')]['query'](_0xa13e('0x15')+tempTableName)[_0xa13e('0x16')](function(_0x1c5b14){if(_0x1c5b14!==null){var _0x35b021=[];for(var _0x23d47c=0x0;_0x23d47c<_0x1c5b14['length'];_0x23d47c++){var _0x74f9e0=_0x1c5b14[_0x23d47c];if(!_[_0xa13e('0x17')](_0x74f9e0[_0xa13e('0xe')])){if(!_['isNil'](_0x74f9e0[_0xa13e('0x18')]))_0x35b021[_0xa13e('0x19')](insertAdditionalPhones(_0x74f9e0));promisesContact['push']({'contact':_0x74f9e0});}}}Promise[_0xa13e('0x1a')](_0x35b021)[_0xa13e('0x1b')](function(){_0xd9c8a8({'val':0x1});});})[_0xa13e('0x1c')](function(_0x187c3d){logger['error'](_0x187c3d[_0xa13e('0x1d')]);});});}function insertAdditionalPhones(_0x1b1ff1){return new Promise(function(_0x24b13a,_0x321cd3){var _0x23fb6a=_0x1b1ff1[_0xa13e('0x18')];if(_['isNil'](_0x23fb6a))_0x321cd3({'val':0x0});else{var _0x25d013=_0x23fb6a[_0xa13e('0x1e')](';');var _0x498081=[];orderBy=0x0;for(var _0x5136be=0x0;_0x5136be<_0x25d013[_0xa13e('0x1f')];_0x5136be++){_0x498081[_0xa13e('0x19')](splitAdditionalPhone(_0x1b1ff1['id'],_0x25d013[_0x5136be]));}Promise[_0xa13e('0x1a')](_0x498081)[_0xa13e('0x1b')](function(){_0x24b13a({'val':_0x25d013[_0xa13e('0x1f')]});});}});}function splitAdditionalPhone(_0x2dc21b,_0x574f6b){return new Promise(function(_0x34553a,_0x364e70){var _0x5d4164=_0x574f6b[_0xa13e('0x1e')](':');var _0x32527f=_0x5d4164[0x0];var _0x2b0cba=_0x5d4164[0x1];if(_0x2b0cba!==''){var _0x27810c=_0x2b0cba[_0xa13e('0x1e')]('|');var _0x25be60=[];for(var _0x348b7e=0x0;_0x348b7e<_0x27810c['length'];_0x348b7e++){if(_0x27810c[_0x348b7e]!==''){var _0x21c2b6=_[_0xa13e('0x20')](promisesAdditionalPhones,{'contactId':_0x2dc21b,'phone':_0x27810c[_0x348b7e]});if(_0x21c2b6[_0xa13e('0x1f')]==0x0){orderBy++;promisesAdditionalPhones[_0xa13e('0x19')]({'contactId':_0x2dc21b,'contactTypeId':_0x32527f,'phone':_0x27810c[_0x348b7e],'orderBy':orderBy});}}}_0x34553a({'ok':0x1});}else _0x34553a({'res':0x0});});}function createAdditionalPhone(_0x4e8405,_0x643ce7,_0x30814a,_0x1194eb){var _0x5ba138='';var _0x4bfc3f='';var _0x4e89f5=_0x30814a[_0xa13e('0x1e')]('§');_0x5ba138=_0x4e89f5[0x0];if(_0x4e89f5[_0xa13e('0x1f')]==0x2)_0x4bfc3f=_0x4e89f5[0x1];return new Promise(function(_0x356b5e,_0x5af83d){return db[_0xa13e('0x21')][_0xa13e('0x22')]({'where':{'CmContactId':_0x4e8405,'item':_0x5ba138}})['then'](function(_0x1a61a8){if(_0x1a61a8){return db[_0xa13e('0x21')][_0xa13e('0x23')]({'ItemTypeId':_0x643ce7,'description':_0x4bfc3f,'OrderBy':_0x1194eb},{'where':{'CmContactId':_0x4e8405,'item':_0x5ba138}})[_0xa13e('0x1b')](function(_0x2dcb20){_0x356b5e({'res':_0xa13e('0x24')});});}else{return db['CmContactHasItem'][_0xa13e('0x25')]({'CmContactId':_0x4e8405,'item':_0x5ba138,'ItemTypeId':_0x643ce7,'description':_0x4bfc3f,'OrderBy':_0x1194eb,'ItemClass':_0xa13e('0x26')})[_0xa13e('0x1b')](function(_0x48cb94){_0x356b5e({'res':'inserted'});});}});});}function updateContact(_0x28560d){return new Promise(function(_0x5e691d,_0x5da05b){var _0x3fd860=_0x28560d['id'];delete _0x28560d['id'];return db[_0xa13e('0x27')]['update'](_0x28560d,{'where':{'id':_0x3fd860}})['then'](function(_0x3cbfc6){updatedRows+=0x1;return db[_0xa13e('0x28')][_0xa13e('0x23')]({'phone':_0x28560d[_0xa13e('0xe')]},{'where':{'ContactId':_0x3fd860}})['then'](function(_0x4a74e0){_0x5e691d({'ret':'OK'});});});});}function insertCmHopper(_0x1bd2a9,_0x4e09e1,_0x512b16,_0x4475cc,_0x355df4){var _0x40e63c=[_0xa13e('0x29'),_0xa13e('0x2a'),_0xa13e('0x2b'),'cm_contacts.ListId',_0x4e09e1+'.'+_0x4475cc,_0xa13e('0x2c'),_0xa13e('0x2d'),'cm_contacts.priority',_0xa13e('0x2e'),'\x22'+_0x355df4+'\x22'];return squel[_0xa13e('0x2f')]()['into'](_0xa13e('0x30'))[_0xa13e('0x31')]([_0xa13e('0xe'),_0xa13e('0x32'),'ContactId',_0xa13e('0x33'),_0x4475cc,_0xa13e('0x34'),'updatedAt',_0xa13e('0x35'),_0xa13e('0x36'),_0xa13e('0x37')],squel[_0xa13e('0x38')]()[_0xa13e('0x39')](_0x40e63c)['from'](_0x4e09e1)[_0xa13e('0x10')](_0xa13e('0x3a'),null,'cm_contacts.ListId\x20=\x20'+_0x4e09e1+_0xa13e('0x3b'))[_0xa13e('0x10')](_0x512b16,null,_0x512b16+_0xa13e('0x11')+_0x4e09e1+'.'+_0x4475cc)['where'](_0x4e09e1+_0xa13e('0x3c'),_0x1bd2a9)[_0xa13e('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xa13e('0x13')](_0xa13e('0x3d'),selectNotIn(_0x4e09e1,_0x512b16,_0x4475cc,_0xa13e('0x30'),[_0xa13e('0x3e'),_0xa13e('0x3f')]))[_0xa13e('0x13')](_0xa13e('0x3d'),selectNotIn(_0x4e09e1,_0x512b16,_0x4475cc,_0xa13e('0x30'),['\x22always\x22'])))[_0xa13e('0x40')]();}function insertCmHopperBlack(_0x5490f3,_0x1f29f0,_0x5aa1e9,_0x4e23fc){var _0x445a01=[_0xa13e('0x29'),_0xa13e('0x2b'),_0xa13e('0x41'),_0x1f29f0+'.'+_0x4e23fc,_0xa13e('0x2c'),'cm_contacts.updatedAt'];return squel[_0xa13e('0x2f')]()[_0xa13e('0x42')]('cm_hopper_black')[_0xa13e('0x31')]([_0xa13e('0xe'),'ContactId',_0xa13e('0x33'),_0x4e23fc,_0xa13e('0x34'),_0xa13e('0x43')],squel[_0xa13e('0x38')]()['fields'](_0x445a01)[_0xa13e('0xf')](_0x1f29f0)[_0xa13e('0x10')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x1f29f0+_0xa13e('0x3b'))[_0xa13e('0x10')](_0x5aa1e9,null,_0x5aa1e9+_0xa13e('0x11')+_0x1f29f0+'.'+_0x4e23fc)[_0xa13e('0x13')](_0x1f29f0+_0xa13e('0x3c'),_0x5490f3)[_0xa13e('0x13')](_0xa13e('0x44'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xa13e('0x38')]()[_0xa13e('0xd')](_0xa13e('0xe'))[_0xa13e('0xf')](_0xa13e('0x45'))['where']('ListId\x20=\x20?',_0x5490f3)['where'](_0x4e23fc+'\x20=\x20?',_0x1f29f0+'.'+_0x4e23fc)))[_0xa13e('0x40')]();}function insertCmHopperAdditionalPhones(_0x34a58f){var _0x280cc1=[_0xa13e('0x46'),_0xa13e('0x47'),_0xa13e('0x48'),_0xa13e('0x49'),_0xa13e('0x4a')];return squel['insert']()['into'](_0xa13e('0x4b'))[_0xa13e('0x31')](['CmHopperId',_0xa13e('0xe'),'OrderBy',_0xa13e('0x34'),_0xa13e('0x43')],squel['select']()['fields'](_0x280cc1)[_0xa13e('0xf')](_0xa13e('0x30'))['join'](_0xa13e('0x3a'),null,_0xa13e('0x4c'))[_0xa13e('0x10')]('cm_contact_has_items',null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0xa13e('0x13')]('cm_hopper.ListId\x20=\x20?',_0x34a58f)[_0xa13e('0x13')](_0xa13e('0x44'),NOW))[_0xa13e('0x40')]();}function insertCmContact(_0x1c2726,_0x1447ad,_0x5c6c22,_0x181f3e){var _0x3254ac=_['concat'](_[_0xa13e('0x4d')](_0x181f3e),[_0xa13e('0x33'),'CompanyId',_0xa13e('0x34'),_0xa13e('0x43')]);return squel[_0xa13e('0x2f')]()[_0xa13e('0x42')](_0xa13e('0x3a'))[_0xa13e('0x31')](_0x3254ac,squel['select']()[_0xa13e('0x39')](_0x3254ac)[_0xa13e('0xf')](_0x1447ad)[_0xa13e('0x13')]('('+_0x5c6c22[_0xa13e('0x10')](',')+_0xa13e('0x4e'),squel[_0xa13e('0x38')]()[_0xa13e('0x39')](_0x5c6c22)[_0xa13e('0xf')](_0xa13e('0x3a'))[_0xa13e('0x13')](_0xa13e('0x4f'),_0x1c2726))[_0xa13e('0x13')]('id\x20IN\x20?',squel[_0xa13e('0x38')]()['field'](_0xa13e('0x50'),_0xa13e('0x51'))[_0xa13e('0xf')](_0x1447ad)[_0xa13e('0x52')](_0x5c6c22[_0xa13e('0x10')](','))))[_0xa13e('0x40')]();}function handleStop(){logger[_0xa13e('0x53')](_0xa13e('0x54'));stopped=!![];}function handleUncaughtException(_0x56c62d){logger[_0xa13e('0x55')](_0x56c62d[_0xa13e('0x1d')]);process[_0xa13e('0x56')](0x1);}function handleError(_0x3c0ba6,_0x3feb1e){stats['errors'][_0xa13e('0x19')]({'name':_0x3feb1e['code'],'message':_0x3feb1e['message'],'row':_0x3c0ba6});}function handleQuery(_0x1f95c9){logger[_0xa13e('0x53')](_0x1f95c9);return db[_0xa13e('0x14')][_0xa13e('0x57')](_0x1f95c9)[_0xa13e('0x16')](function(_0x598a6a){results[_0xa13e('0x19')](_0x598a6a);})[_0xa13e('0x1c')](function(_0xe78363){logger[_0xa13e('0x55')](_0xe78363[_0xa13e('0x1d')]);});}function main(_0x4cef03,_0x592790,_0x2a291a,_0x1ce3ef){logger['info'](_0xa13e('0x58'),_0x4cef03,JSON[_0xa13e('0x59')](_0x592790));process[_0xa13e('0x5a')](_0xa13e('0x5b'));var _0x2fa8c5=_0x592790['binding'];var _0x28a162=_[_0xa13e('0x5c')](_0x2fa8c5);var _0x2343cd=_0x592790[_0xa13e('0x5d')];var _0x598ee1=path[_0xa13e('0x10')](config[_0xa13e('0x5e')],_0xa13e('0x5f'),_0x2343cd+_0xa13e('0x60'));logger[_0xa13e('0x53')](_0xa13e('0x61'),_0x592790);db[_0xa13e('0x62')]['findAll']({'raw':!![],'attributes':['id','name']})[_0xa13e('0x1b')](function(_0x5a63e8){for(var _0x788ae0=0x0;_0x788ae0<_0x5a63e8[_0xa13e('0x1f')];_0x788ae0++){if(_0x5a63e8[_0x788ae0]['name']in _0x2fa8c5){contactItemTypes[_0xa13e('0x19')](_0x5a63e8[_0x788ae0]);delete _0x28a162[_0x5a63e8[_0x788ae0][_0xa13e('0x63')]];hasAdditionalPhones=!![];}for(var _0x1f9ba9 in _0x2fa8c5){if(_0x5a63e8[_0x788ae0][_0xa13e('0x63')]+_0xa13e('0x64')===_0x1f9ba9){phoneDescriptions[_0xa13e('0x19')]({'itemTypeId':_0x5a63e8[_0x788ae0]['id'],'description':_0x1f9ba9});delete _0x28a162[_0x1f9ba9];}}}if(hasAdditionalPhones)_0x28a162[_0xa13e('0x18')]='';var _0x440079=_[_0xa13e('0x4d')](_0x28a162)['join']();logger[_0xa13e('0x53')](_0xa13e('0x65'),_0x440079);fs[_0xa13e('0x66')](_0x598ee1,_0x440079+'\x0a');Papa[_0xa13e('0x67')](fs[_0xa13e('0x68')](_0x4cef03),{'header':!![],'skipEmptyLines':!![],'step':function(_0xab3a3c,_0x134fad){try{for(var _0x194a4c=0x0,_0x16dee2=[];_0x194a4c<_0xab3a3c['data']['length'];_0x194a4c++){stats['rows']+=0x1;if(_0xab3a3c[_0xa13e('0x69')][_0x194a4c]){handleError(_0xab3a3c[_0xa13e('0x6a')][_0x194a4c],_0xab3a3c[_0xa13e('0x69')][_0x194a4c]);}else{var _0x2f513e=[];var _0x38fb9a=[];var _0x2513f2={};for(var _0x4c105c in _0x2fa8c5){let _0x34ab58=contactItemTypes['find'](_0x3eaa28=>_0x3eaa28[_0xa13e('0x63')]===_0x4c105c);let _0x1b0b11=contactItemTypes[_0xa13e('0x6b')](_0x3f0746=>_0x3f0746[_0xa13e('0x63')]+'_description'===_0x4c105c);if(_[_0xa13e('0x17')](_0x34ab58)&&_[_0xa13e('0x17')](_0x1b0b11)){if(_0x2fa8c5[_0xa13e('0x6c')](_0x4c105c)){if(_0xab3a3c[_0xa13e('0x6a')][_0x194a4c][_0x2fa8c5[_0x4c105c]]){var _0xc37720=_[_0xa13e('0x6d')](_0xab3a3c['data'][_0x194a4c][_0x2fa8c5[_0x4c105c]][_0xa13e('0x6e')](/"/g,'\x27'));switch(_0x4c105c){case _0xa13e('0x32'):var _0x493ee1=moment(_0xc37720,_0xa13e('0x6f'),!![]);if(_0x493ee1[_0xa13e('0x70')]()){_0x16dee2[_0xa13e('0x19')]('\x22'+_0xc37720+'\x22');}else{_0x2f513e['push'](_0xa13e('0x71'));}break;case'priority':var _0x5d9262=parseInt(_0xc37720);_0xc37720=_[_0xa13e('0x72')](_0x5d9262)||_0x5d9262<0x0||_0x5d9262>0x4?_0x1ce3ef?0x3:0x2:_0x5d9262;_0x16dee2[_0xa13e('0x19')]('\x22'+_0xc37720+'\x22');break;case _0xa13e('0x36'):var _0x2cc357=parseInt(_0xc37720);if(_[_0xa13e('0x73')](_0x2cc357)&&_[_0xa13e('0x74')](_0x2a291a,_0x2cc357)){_0x16dee2['push']('\x22'+_0x2cc357+'\x22');}else{_0x2f513e[_0xa13e('0x19')](_0xa13e('0x75'));}break;case _0xa13e('0x76'):if(isEmail(_0xc37720)){_0x16dee2[_0xa13e('0x19')]('\x22'+_0xc37720+'\x22');}else{_0x2f513e['push'](_0xa13e('0x77'));}break;case _0xa13e('0x78'):var _0x119f34=moment(_0xc37720,'YYYY-MM-DD',!![]);if(_0x119f34['isValid']()){_0x16dee2['push']('\x22'+_0xc37720+'\x22');}else{_0x2f513e['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x16dee2[_0xa13e('0x19')]('\x22'+_0xc37720+'\x22');}}else{switch(_0x4c105c){case'firstName':case _0xa13e('0xe'):_0x2f513e[_0xa13e('0x19')](_0x4c105c+_0xa13e('0x79'));break;default:_0x16dee2[_0xa13e('0x19')]('\x22\x22');}}}}else{var _0xf951='';if(!_[_0xa13e('0x17')](_0x34ab58)){if(!_0x2513f2['hasOwnProperty'](_0x34ab58['id'])){for(var _0x577c0d=0x0;_0x577c0d<_0x2fa8c5[_0x4c105c]['length'];_0x577c0d++){var _0xc37720=_[_0xa13e('0x6d')](_0xab3a3c[_0xa13e('0x6a')][_0x194a4c][_0x2fa8c5[_0x4c105c][_0x577c0d]][_0xa13e('0x6e')](/"/g,'\x27'));var _0xc33604=phoneDescriptions['find'](_0x3d2655=>_0x3d2655['itemTypeId']===_0x34ab58['id']);if(!_[_0xa13e('0x17')](_0xc33604)){var _0x212892=_[_0xa13e('0x6d')](_0xab3a3c[_0xa13e('0x6a')][_0x194a4c][_0x2fa8c5[_0xc33604[_0xa13e('0x7a')]][0x0]][_0xa13e('0x6e')](/"/g,'\x27'));if(!_[_0xa13e('0x17')](_0x212892))_0xc37720=_0xc37720+'§'+_0x212892;}if(_0xf951=='')_0xf951=_0xc37720;else _0xf951+='|'+_0xc37720;}_0x38fb9a[_0xa13e('0x19')](_0x34ab58['id']+':'+_0xf951);_0x2513f2[_0x34ab58['id']]=0x1;}}}}if(hasAdditionalPhones){_0x16dee2[_0xa13e('0x19')]('\x22'+_0x38fb9a[_0xa13e('0x10')](';')+'\x22');}if(_0x2f513e[_0xa13e('0x1f')]){handleError(_0xab3a3c['data'][_0x194a4c],{'code':_0xa13e('0x7b'),'message':_0x2f513e['join']()});}else{fs['appendFileSync'](_0x598ee1,_0x16dee2['join']()+'\x0a');}_0x16dee2=[];}if(!(stats[_0xa13e('0x7c')]%0xc8)){socket['emit'](_0xa13e('0x7d')+_0x2343cd,stats);stats['errors']=[];}}if(stopped){logger[_0xa13e('0x53')](_0xa13e('0x7e'));_0x134fad[_0xa13e('0x7f')]();}}catch(_0x5ab896){handleError(_0xab3a3c['data'][_0x194a4c],{'code':_0xa13e('0x80'),'message':_0x5ab896[_0xa13e('0x1d')]});logger[_0xa13e('0x55')]('step',_0x5ab896[_0xa13e('0x1d')]);}},'complete':function(){try{var _0x34abcd=[];var _0x4a9784=tempTableName;_0x34abcd[_0xa13e('0x19')](_0xa13e('0x81')+_0x4a9784+_0xa13e('0x82'));logger[_0xa13e('0x53')](_0xa13e('0x83'),contactItemTypes[_0xa13e('0x1f')]);var _0x5b7ae4=util[_0xa13e('0x9')](_0xa13e('0x84'),_0x598ee1,_0x4a9784,_0x440079,_0x592790[_0xa13e('0x33')],_0x592790[_0xa13e('0x85')]||null,NOW,NOW);if(_[_0xa13e('0x17')](_0x2fa8c5[_0xa13e('0x32')])){_0x5b7ae4+=',\x20scheduledAt\x20=\x20NOW()';}_0x34abcd[_0xa13e('0x19')](_0x5b7ae4);BPromise[_0xa13e('0x86')](_0x34abcd,handleQuery)[_0xa13e('0x1b')](function(_0x397a91){BPromise[_0xa13e('0x1a')]([handleAdditionalPhones()])['then'](function(){_0x34abcd=[];for(var _0x308848=0x0;_0x308848\x20\x20');}var _0x509a45=path[_0xa13e('0x10')](config['root'],_0xa13e('0x5f'),process[_0xa13e('0x8f')][0x2]);if(!fs['existsSync'](_0x509a45)){throw new Error(_0xa13e('0x90'));}var _0x47a029={};try{_0x47a029=JSON['parse'](process['argv'][0x3]);if(!_0x47a029[_0xa13e('0x91')]){throw new Error(_0xa13e('0x92'));}var _0x4b4537=0x0;if(_0x47a029[_0xa13e('0x91')][_0xa13e('0x36')]){_0x4b4537=0x1;}if(!_0x47a029[_0xa13e('0x33')]){throw new Error(_0xa13e('0x93'));}}catch(_0x541199){throw new Error('body\x20id\x20mandatory');}var _0x4d3c84=[];try{_0x4d3c84=_[_0xa13e('0x94')](JSON[_0xa13e('0x67')](process['argv'][0x4]),'id');}catch(_0x52b308){logger[_0xa13e('0x53')]('No\x20agent\x20available');}main(_0x509a45,_0x47a029,_0x4d3c84,_0x4b4537);}validate();process['on']('SIGINT',handleStop);process['on'](_0xa13e('0x95'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 8065b63..aaf1d1a 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 _0xcc6c=['Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','inbound','push','variable','queue','calleridnum','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','voice','Caller\x20Number','keyValue','Caller\x20Name','Call\x20To','destexten','uniqueid','***\x20Agent\x20Info\x20***','destcalleridname','Agent\x20Number','Agent\x20Ring','agentcalledAt','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','***\x20Call\x20Info\x20***','Called\x20Number','Member\x20Name','membername','UniqueId','Date','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration'];(function(_0x834261,_0x443ad1){var _0x1aaa59=function(_0x3f406b){while(--_0x3f406b){_0x834261['push'](_0x834261['shift']());}};_0x1aaa59(++_0x443ad1);}(_0xcc6c,0x14b));var _0xccc6=function(_0x5cb486,_0x531a87){_0x5cb486=_0x5cb486-0x0;var _0x2dd328=_0xcc6c[_0x5cb486];return _0x2dd328;};'use strict';exports[_0xccc6('0x0')]=function(_0xb79d37,_0x5e304b){var _0x2d1464=[{'type':_0xccc6('0x1'),'content':_0xccc6('0x2'),'variableName':null}];switch(_0xb79d37['toLowerCase']()){case'voice':switch(_0x5e304b[_0xccc6('0x3')]()){case _0xccc6('0x4'):_0x2d1464[_0xccc6('0x5')]({'type':_0xccc6('0x6'),'content':'','variableName':_0xccc6('0x7')});_0x2d1464[_0xccc6('0x5')]({'type':_0xccc6('0x6'),'content':'','variableName':_0xccc6('0x8')});break;case _0xccc6('0x9'):_0x2d1464[_0xccc6('0x5')]({'type':_0xccc6('0x1'),'content':_0xccc6('0xa'),'variableName':null});_0x2d1464[_0xccc6('0x5')]({'type':_0xccc6('0x6'),'content':'','variableName':_0xccc6('0xb')});break;}}return _0x2d1464;};exports[_0xccc6('0xc')]=function(_0x295cd3,_0x2e8c2e){var _0x35ed8d=[];switch(_0x295cd3[_0xccc6('0x3')]()){case _0xccc6('0xd'):switch(_0x2e8c2e['toLowerCase']()){case _0xccc6('0x4'):_0x35ed8d=[{'type':'string','content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xccc6('0xe'),'keyType':'variable','variableName':'calleridnum'},{'type':_0xccc6('0xf'),'content':'','key':_0xccc6('0x10'),'keyType':_0xccc6('0x6'),'variableName':'calleridname'},{'type':_0xccc6('0xf'),'content':'','key':_0xccc6('0x11'),'keyType':_0xccc6('0x6'),'variableName':_0xccc6('0x12')},{'type':_0xccc6('0xf'),'content':'','key':'Queue','keyType':_0xccc6('0x6'),'variableName':'queue'},{'type':'keyValue','content':'','key':'UniqueId','keyType':_0xccc6('0x6'),'variableName':_0xccc6('0x13')},{'type':_0xccc6('0xf'),'content':'','key':'Date','keyType':_0xccc6('0x6'),'variableName':'agentcalledAt'},{'type':'string','content':_0xccc6('0x14'),'key':null,'keyType':null,'variableName':null},{'type':_0xccc6('0xf'),'content':'','key':'Agent\x20Name','keyType':_0xccc6('0x6'),'variableName':_0xccc6('0x15')},{'type':'keyValue','content':'','key':_0xccc6('0x16'),'keyType':'variable','variableName':'destcalleridnum'},{'type':_0xccc6('0x1'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xccc6('0xf'),'content':'','key':_0xccc6('0x17'),'keyType':'variable','variableName':_0xccc6('0x18')},{'type':_0xccc6('0xf'),'content':'','key':_0xccc6('0x19'),'keyType':_0xccc6('0x6'),'variableName':_0xccc6('0x1a')},{'type':_0xccc6('0xf'),'content':'','key':_0xccc6('0x1b'),'keyType':'variable','variableName':_0xccc6('0x1c')},{'type':_0xccc6('0xf'),'content':'','key':_0xccc6('0x1d'),'keyType':_0xccc6('0x6'),'variableName':_0xccc6('0x1e')},{'type':_0xccc6('0xf'),'content':'','key':_0xccc6('0x1f'),'keyType':_0xccc6('0x6'),'variableName':_0xccc6('0x20')}];break;case'outbound':_0x35ed8d=[{'type':'string','content':_0xccc6('0x21'),'variableName':null},{'type':_0xccc6('0xf'),'content':'','key':_0xccc6('0x22'),'keyType':_0xccc6('0x6'),'keyContent':'','variableName':'destcalleridnum'},{'type':_0xccc6('0xf'),'content':'','key':_0xccc6('0x23'),'keyType':_0xccc6('0x6'),'keyContent':'','variableName':_0xccc6('0x24')},{'type':_0xccc6('0xf'),'content':'','key':_0xccc6('0x25'),'keyType':_0xccc6('0x6'),'keyContent':'','variableName':_0xccc6('0x13')},{'type':_0xccc6('0xf'),'content':'','key':_0xccc6('0x26'),'keyType':_0xccc6('0x6'),'keyContent':'','variableName':'starttime'},{'type':'string','content':'***\x20Time\x20Info\x20***'},{'type':_0xccc6('0xf'),'content':'','key':_0xccc6('0x27'),'keyType':'variable','keyContent':'','variableName':_0xccc6('0x28')},{'type':_0xccc6('0xf'),'content':'','key':_0xccc6('0x29'),'keyType':_0xccc6('0x6'),'keyContent':'','variableName':_0xccc6('0x2a')},{'type':_0xccc6('0xf'),'content':'','key':_0xccc6('0x2b'),'keyType':_0xccc6('0x6'),'keyContent':'','variableName':_0xccc6('0x2c')},{'type':_0xccc6('0xf'),'content':'','key':_0xccc6('0x2d'),'keyType':'variable','keyContent':'','variableName':_0xccc6('0x2e')}];break;}}return _0x35ed8d;}; \ No newline at end of file +var _0x04db=['***\x20Agent\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Member\x20Name','membername','starttime','answertime','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','voice','toLowerCase','inbound','push','variable','calleridnum','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','Caller\x20Number','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','queue','keyValue','UniqueId','uniqueid','Date','agentcalledAt'];(function(_0x3d49b2,_0xd0f0e8){var _0x36d488=function(_0x39a0f3){while(--_0x39a0f3){_0x3d49b2['push'](_0x3d49b2['shift']());}};_0x36d488(++_0xd0f0e8);}(_0x04db,0x6b));var _0xb04d=function(_0x9728f7,_0x1480b1){_0x9728f7=_0x9728f7-0x0;var _0x322a8c=_0x04db[_0x9728f7];return _0x322a8c;};'use strict';exports[_0xb04d('0x0')]=function(_0x331d72,_0x31ade2){var _0x2137ba=[{'type':_0xb04d('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x331d72['toLowerCase']()){case _0xb04d('0x2'):switch(_0x31ade2[_0xb04d('0x3')]()){case _0xb04d('0x4'):_0x2137ba[_0xb04d('0x5')]({'type':_0xb04d('0x6'),'content':'','variableName':'queue'});_0x2137ba['push']({'type':_0xb04d('0x6'),'content':'','variableName':_0xb04d('0x7')});break;case _0xb04d('0x8'):_0x2137ba[_0xb04d('0x5')]({'type':_0xb04d('0x1'),'content':_0xb04d('0x9'),'variableName':null});_0x2137ba['push']({'type':_0xb04d('0x6'),'content':'','variableName':_0xb04d('0xa')});break;}}return _0x2137ba;};exports[_0xb04d('0xb')]=function(_0x476b6d,_0x2e061d){var _0x2cc420=[];switch(_0x476b6d[_0xb04d('0x3')]()){case'voice':switch(_0x2e061d[_0xb04d('0x3')]()){case _0xb04d('0x4'):_0x2cc420=[{'type':_0xb04d('0x1'),'content':_0xb04d('0xc'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xb04d('0xd'),'keyType':_0xb04d('0x6'),'variableName':_0xb04d('0x7')},{'type':'keyValue','content':'','key':_0xb04d('0xe'),'keyType':'variable','variableName':_0xb04d('0xf')},{'type':'keyValue','content':'','key':_0xb04d('0x10'),'keyType':_0xb04d('0x6'),'variableName':_0xb04d('0x11')},{'type':'keyValue','content':'','key':_0xb04d('0x12'),'keyType':_0xb04d('0x6'),'variableName':_0xb04d('0x13')},{'type':_0xb04d('0x14'),'content':'','key':_0xb04d('0x15'),'keyType':_0xb04d('0x6'),'variableName':_0xb04d('0x16')},{'type':'keyValue','content':'','key':_0xb04d('0x17'),'keyType':'variable','variableName':_0xb04d('0x18')},{'type':_0xb04d('0x1'),'content':_0xb04d('0x19'),'key':null,'keyType':null,'variableName':null},{'type':_0xb04d('0x14'),'content':'','key':'Agent\x20Name','keyType':_0xb04d('0x6'),'variableName':'destcalleridname'},{'type':_0xb04d('0x14'),'content':'','key':'Agent\x20Number','keyType':'variable','variableName':_0xb04d('0xa')},{'type':_0xb04d('0x1'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xb04d('0x14'),'content':'','key':_0xb04d('0x1a'),'keyType':'variable','variableName':_0xb04d('0x18')},{'type':_0xb04d('0x14'),'content':'','key':_0xb04d('0x1b'),'keyType':_0xb04d('0x6'),'variableName':_0xb04d('0x1c')},{'type':'keyValue','content':'','key':_0xb04d('0x1d'),'keyType':'variable','variableName':_0xb04d('0x1e')},{'type':_0xb04d('0x14'),'content':'','key':_0xb04d('0x1f'),'keyType':_0xb04d('0x6'),'variableName':_0xb04d('0x20')},{'type':_0xb04d('0x14'),'content':'','key':_0xb04d('0x21'),'keyType':'variable','variableName':_0xb04d('0x22')}];break;case'outbound':_0x2cc420=[{'type':_0xb04d('0x1'),'content':_0xb04d('0xc'),'variableName':null},{'type':_0xb04d('0x14'),'content':'','key':'Called\x20Number','keyType':_0xb04d('0x6'),'keyContent':'','variableName':_0xb04d('0xa')},{'type':'keyValue','content':'','key':_0xb04d('0x23'),'keyType':_0xb04d('0x6'),'keyContent':'','variableName':_0xb04d('0x24')},{'type':_0xb04d('0x14'),'content':'','key':'UniqueId','keyType':'variable','keyContent':'','variableName':_0xb04d('0x16')},{'type':_0xb04d('0x14'),'content':'','key':'Date','keyType':_0xb04d('0x6'),'keyContent':'','variableName':_0xb04d('0x25')},{'type':_0xb04d('0x1'),'content':'***\x20Time\x20Info\x20***'},{'type':_0xb04d('0x14'),'content':'','key':'Answer\x20Time','keyType':_0xb04d('0x6'),'keyContent':'','variableName':_0xb04d('0x26')},{'type':_0xb04d('0x14'),'content':'','key':'Complete\x20Time','keyType':_0xb04d('0x6'),'keyContent':'','variableName':_0xb04d('0x27')},{'type':_0xb04d('0x14'),'content':'','key':_0xb04d('0x28'),'keyType':'variable','keyContent':'','variableName':_0xb04d('0x29')},{'type':_0xb04d('0x14'),'content':'','key':_0xb04d('0x2a'),'keyType':_0xb04d('0x6'),'keyContent':'','variableName':_0xb04d('0x2b')}];break;}}return _0x2cc420;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 8a5c8f2..8fbe253 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 _0x6d8a=['length','having','clause','order','forEach','contactName','DESC','closed','getClosedOrderClause','getFilteredInteractions','tracked','query','clone','body','omit','html','phone','fax','updateUser','lodash','./utils','resolve','search','parseAdvancedSearchFilter','parseQueryParameters','then','where','contact','fields','filter','read','tags','checkAccountsRestrictions','group','i.id','ids','tag','countFilteredInteractions','count'];(function(_0x41f5ba,_0xd0ffa8){var _0x535e03=function(_0x7b8c37){while(--_0x7b8c37){_0x41f5ba['push'](_0x41f5ba['shift']());}};_0x535e03(++_0xd0ffa8);}(_0x6d8a,0xfd));var _0xa6d8=function(_0x4bd950,_0x184ed5){_0x4bd950=_0x4bd950-0x0;var _0x5dc59a=_0x6d8a[_0x4bd950];return _0x5dc59a;};'use strict';var _=require(_0xa6d8('0x0'));var sqlUtils=require('./sql-utils');var utils=require(_0xa6d8('0x1'));exports['findAll']=function(_0x3a874e,_0x5a4e0e,_0x2d01d9,_0x2df8bf,_0x184c3b){var _0x3df198={'count':0x0,'rows':[]};var _0x1e83e0=sqlUtils['skipInteractionsQuery'](_0x3a874e,_0x2d01d9,_0x5a4e0e);if(_0x1e83e0){return Promise[_0xa6d8('0x2')](_0x3df198);}var _0x18b0f2=sqlUtils['getInteractionsQuery'](_0x3a874e);var _0x59ad1b={};return Promise['resolve']()['then'](function(){if(_0x5a4e0e[_0xa6d8('0x3')]){return sqlUtils[_0xa6d8('0x4')](_0x5a4e0e[_0xa6d8('0x3')],_0x184c3b);}else{return sqlUtils[_0xa6d8('0x5')](_0x3a874e,_0x5a4e0e,_0x184c3b);}})[_0xa6d8('0x6')](function(_0x2c88e2){_0x18b0f2[_0xa6d8('0x7')](_0x2c88e2['body']);_0x18b0f2['where'](_0x2c88e2[_0xa6d8('0x8')]);_0x18b0f2[_0xa6d8('0x7')](_0x2c88e2['default']);_0x18b0f2['where'](_0x2c88e2[_0xa6d8('0x9')]);_0x18b0f2[_0xa6d8('0x7')](_0x2c88e2[_0xa6d8('0xa')]);_0x18b0f2[_0xa6d8('0x7')](_0x2c88e2['user']);_0x18b0f2['having'](_0x2c88e2[_0xa6d8('0xb')]);_0x59ad1b=_0x2c88e2[_0xa6d8('0xc')];return sqlUtils[_0xa6d8('0xd')](_0x3a874e,_0x2d01d9,_0x5a4e0e);})[_0xa6d8('0x6')](function(_0x185cba){_0x18b0f2['where'](_0x185cba);_0x18b0f2[_0xa6d8('0xe')](_0xa6d8('0xf'));var _0x1c0a38=_0x5a4e0e[_0xa6d8('0x3')]?_0x59ad1b[_0xa6d8('0x10')]:_0x5a4e0e[_0xa6d8('0x11')];return sqlUtils[_0xa6d8('0x12')](_0x18b0f2,_0x1c0a38);})[_0xa6d8('0x6')](function(_0x29a392){_0x3df198[_0xa6d8('0x13')]=_0x29a392[_0xa6d8('0x14')];if(_0x3df198[_0xa6d8('0x13')]===0x0){return[];}_0x18b0f2[_0xa6d8('0x15')](_0x59ad1b[_0xa6d8('0x16')]);if(_0x2df8bf[_0xa6d8('0x17')]){_0x2df8bf['order'][_0xa6d8('0x18')](function(_0x5e019d){var _0x53fdbe=_0x5e019d[0x0]===_0xa6d8('0x19')?_0x5e019d[0x0]:'i.'+_0x5e019d[0x0];_0x18b0f2[_0xa6d8('0x17')](_0x53fdbe,_0x5e019d[0x1]===_0xa6d8('0x1a')?![]:!![]);if(_0x5e019d[0x0]===_0xa6d8('0x1b')){var _0x3a85a3=sqlUtils[_0xa6d8('0x1c')](_0x3a874e,_0x5a4e0e);_0x18b0f2['order'](_0x3a85a3,_0x5e019d[0x1]===_0xa6d8('0x1a')?![]:!![]);}});}return sqlUtils[_0xa6d8('0x1d')](_0x3a874e,_0x18b0f2,_0x5a4e0e,_0x2df8bf);})[_0xa6d8('0x6')](function(_0x3a9ffd){_0x3df198['rows']=_0x3a9ffd;return _0x3df198;})['catch'](function(_0x2a3f2b){throw _0x2a3f2b;});};exports[_0xa6d8('0x1e')]=function(_0x484844,_0x507f14){return function(_0x3f2b96,_0x57d138,_0x3bccdd){var _0x5e6228=_0x3f2b96['user'];var _0x3f63d4={};var _0x3f5db1=_0x3f2b96[_0xa6d8('0x1f')];if(_0x3f63d4){_0x3f63d4=_[_0xa6d8('0x20')](_0x3f2b96[_0xa6d8('0x21')]);_0x3f63d4=_[_0xa6d8('0x22')](_0x3f63d4,[_0xa6d8('0x21'),_0xa6d8('0x23'),_0xa6d8('0x24'),_0xa6d8('0x25'),'mobile']);}utils[_0xa6d8('0x26')](_0x5e6228,_0x3f63d4,_0x3f5db1,_0x484844,_0x507f14);_0x3bccdd(null);};}; \ No newline at end of file +var _0x31f3=['order','forEach','getClosedOrderClause','DESC','catch','query','clone','omit','html','phone','fax','mobile','updateUser','./sql-utils','./utils','findAll','skipInteractionsQuery','resolve','getInteractionsQuery','search','parseAdvancedSearchFilter','parseQueryParameters','body','where','contact','default','fields','filter','user','having','read','tags','checkAccountsRestrictions','then','group','ids','tag','countFilteredInteractions','count','length','clause'];(function(_0x1347d5,_0x1b1c50){var _0x3ec2e6=function(_0x5cba70){while(--_0x5cba70){_0x1347d5['push'](_0x1347d5['shift']());}};_0x3ec2e6(++_0x1b1c50);}(_0x31f3,0x155));var _0x331f=function(_0x1b8524,_0x1bb669){_0x1b8524=_0x1b8524-0x0;var _0x81418d=_0x31f3[_0x1b8524];return _0x81418d;};'use strict';var _=require('lodash');var sqlUtils=require(_0x331f('0x0'));var utils=require(_0x331f('0x1'));exports[_0x331f('0x2')]=function(_0x10d845,_0x1a6d29,_0x4c1518,_0x1297fe,_0x18fc89){var _0x1b05de={'count':0x0,'rows':[]};var _0x8890d=sqlUtils[_0x331f('0x3')](_0x10d845,_0x4c1518,_0x1a6d29);if(_0x8890d){return Promise[_0x331f('0x4')](_0x1b05de);}var _0x5cba65=sqlUtils[_0x331f('0x5')](_0x10d845);var _0x29575a={};return Promise[_0x331f('0x4')]()['then'](function(){if(_0x1a6d29[_0x331f('0x6')]){return sqlUtils[_0x331f('0x7')](_0x1a6d29[_0x331f('0x6')],_0x18fc89);}else{return sqlUtils[_0x331f('0x8')](_0x10d845,_0x1a6d29,_0x18fc89);}})['then'](function(_0xb0ea4b){_0x5cba65['where'](_0xb0ea4b[_0x331f('0x9')]);_0x5cba65[_0x331f('0xa')](_0xb0ea4b[_0x331f('0xb')]);_0x5cba65[_0x331f('0xa')](_0xb0ea4b[_0x331f('0xc')]);_0x5cba65['where'](_0xb0ea4b[_0x331f('0xd')]);_0x5cba65[_0x331f('0xa')](_0xb0ea4b[_0x331f('0xe')]);_0x5cba65[_0x331f('0xa')](_0xb0ea4b[_0x331f('0xf')]);_0x5cba65[_0x331f('0x10')](_0xb0ea4b[_0x331f('0x11')]);_0x29575a=_0xb0ea4b[_0x331f('0x12')];return sqlUtils[_0x331f('0x13')](_0x10d845,_0x4c1518,_0x1a6d29);})[_0x331f('0x14')](function(_0x12eccd){_0x5cba65[_0x331f('0xa')](_0x12eccd);_0x5cba65[_0x331f('0x15')]('i.id');var _0xaacc7d=_0x1a6d29[_0x331f('0x6')]?_0x29575a[_0x331f('0x16')]:_0x1a6d29[_0x331f('0x17')];return sqlUtils[_0x331f('0x18')](_0x5cba65,_0xaacc7d);})[_0x331f('0x14')](function(_0x67ad3a){_0x1b05de[_0x331f('0x19')]=_0x67ad3a[_0x331f('0x1a')];if(_0x1b05de[_0x331f('0x19')]===0x0){return[];}_0x5cba65['having'](_0x29575a[_0x331f('0x1b')]);if(_0x1297fe[_0x331f('0x1c')]){_0x1297fe['order'][_0x331f('0x1d')](function(_0x36607b){var _0x33ef7f=_0x36607b[0x0]==='contactName'?_0x36607b[0x0]:'i.'+_0x36607b[0x0];_0x5cba65[_0x331f('0x1c')](_0x33ef7f,_0x36607b[0x1]==='DESC'?![]:!![]);if(_0x36607b[0x0]==='closed'){var _0x4ef6ac=sqlUtils[_0x331f('0x1e')](_0x10d845,_0x1a6d29);_0x5cba65[_0x331f('0x1c')](_0x4ef6ac,_0x36607b[0x1]===_0x331f('0x1f')?![]:!![]);}});}return sqlUtils['getFilteredInteractions'](_0x10d845,_0x5cba65,_0x1a6d29,_0x1297fe);})['then'](function(_0x33b6e9){_0x1b05de['rows']=_0x33b6e9;return _0x1b05de;})[_0x331f('0x20')](function(_0x55f320){throw _0x55f320;});};exports['tracked']=function(_0x3b4c13,_0x58c25f){return function(_0x31b30f,_0x37f385,_0x4457b8){var _0x33e95f=_0x31b30f[_0x331f('0xf')];var _0x33c7ad={};var _0x47d13a=_0x31b30f[_0x331f('0x21')];if(_0x33c7ad){_0x33c7ad=_[_0x331f('0x22')](_0x31b30f[_0x331f('0x9')]);_0x33c7ad=_[_0x331f('0x23')](_0x33c7ad,['body',_0x331f('0x24'),_0x331f('0x25'),_0x331f('0x26'),_0x331f('0x27')]);}utils[_0x331f('0x28')](_0x33e95f,_0x33c7ad,_0x47d13a,_0x3b4c13,_0x58c25f);_0x4457b8(null);};}; \ No newline at end of file diff --git a/server/components/interaction/sql-utils.js b/server/components/interaction/sql-utils.js index 7a4c108..ef7c2d9 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 _0xabae=['../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','role','agent','select','field','color','from','tools_tags','_interactions','u.id','ui.','left_join','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','getInteractionsTables','getInteractionFK','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','a.id\x20=\x20i.','messages','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','includes','i.phone\x20LIKE\x20?','fax','openchannel','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','find','name','buildExpression','type','default','text','start','value','read','and','Contact','operator','$substring','contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','end','Tag','split','tags','clause','ids','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','plainBody','keys','some','compact','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','tag','filter','get','capitalize','chat','Accounts','search','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.disposition','closed','shift','CONCAT_WS(\x27\x27,\x20','Interaction','Sequelize','QueryTypes','SELECT','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.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','i.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.secondDisposition','i.to','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','contactName','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','query','groupBy','Setting','enableEmailPreview','clone','COUNT(*)','unreadMessages','isEmpty','t.id\x20IN\x20?','lodash','squel','../parsers/advancedSearch'];(function(_0x39141f,_0x418eca){var _0x24334f=function(_0x5c47e1){while(--_0x5c47e1){_0x39141f['push'](_0x39141f['shift']());}};_0x24334f(++_0x418eca);}(_0xabae,0x14f));var _0xeaba=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xabae[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xeaba('0x0'));var squel=require(_0xeaba('0x1'));var as=require(_0xeaba('0x2'));var qs=require(_0xeaba('0x3'));var updateInteraction=require(_0xeaba('0x4'))[_0xeaba('0x5')];var utils=require(_0xeaba('0x6'));var db=require(_0xeaba('0x7'))['db'];function skipInteractionsQuery(_0x239921,_0x2f747b,_0x494517){var _0x5afdc4=![];var _0x1555c0=utils[_0xeaba('0x8')](_0x239921);if(_0x2f747b[_0xeaba('0x9')]===_0xeaba('0xa')&&!_0x494517['search']&&!_0x494517[_0x1555c0]){_0x5afdc4=!![];}return _0x5afdc4;}function getTagsQuery(){return squel[_0xeaba('0xb')]()[_0xeaba('0xc')]('id')['field']('name')[_0xeaba('0xc')](_0xeaba('0xd'))[_0xeaba('0xe')](_0xeaba('0xf'));}function getUsersQuery(_0x328164,_0x5bc59a){var _0xcb23c0=utils['getInteractionFK'](_0x328164);var _0x859d6f='user_has_'+_0x328164+_0xeaba('0x10');var _0x1755e4=squel['select']()['field'](_0xeaba('0x11'))['field']('u.fullname')[_0xeaba('0xc')](_0xeaba('0x12')+_0xcb23c0)[_0xeaba('0xe')](_0x859d6f,'ui')[_0xeaba('0x13')]('users','u',_0xeaba('0x14'));if(_0x5bc59a[_0xeaba('0x15')]>0x0){_0x1755e4[_0xeaba('0x16')](_0xeaba('0x12')+_0xcb23c0+_0xeaba('0x17'),_[_0xeaba('0x18')](_0x5bc59a,'id'));}return _0x1755e4;}function getInteractionsQuery(_0xb66d1d){var _0x122dd3=utils[_0xeaba('0x19')](_0xb66d1d);var _0x1db387=utils[_0xeaba('0x8')](_0xb66d1d);var _0x2c1326=utils[_0xeaba('0x1a')](_0xb66d1d);return squel[_0xeaba('0xb')]()[_0xeaba('0xe')](_0x122dd3['interactions'],'i')[_0xeaba('0x13')](_0xeaba('0x1b'),'c',_0xeaba('0x1c'))[_0xeaba('0x13')](_0xeaba('0x1d'),'o',_0xeaba('0x1e'))[_0xeaba('0x13')](_0x122dd3['accounts'],'a',_0xeaba('0x1f')+_0x1db387)[_0xeaba('0x13')](_0x122dd3[_0xeaba('0x20')],'me','me.'+_0x2c1326+_0xeaba('0x21'))[_0xeaba('0x13')](_0x122dd3[_0xeaba('0x22')],'it',_0xeaba('0x23')+_0x2c1326+_0xeaba('0x21'))[_0xeaba('0x13')](_0xeaba('0xf'),'t',_0xeaba('0x24'));}function getSqlClauses(){var _0x40e4b5={'body':squel['expr'](),'contact':squel[_0xeaba('0x25')](),'default':squel[_0xeaba('0x25')](),'fields':squel[_0xeaba('0x25')](),'filter':squel['expr'](),'read':squel[_0xeaba('0x25')](),'tags':{'clause':squel[_0xeaba('0x25')](),'ids':null},'user':squel[_0xeaba('0x25')]()};return _0x40e4b5;}function parseTagParameter(_0x280466){var _0x59f2fb=squel[_0xeaba('0x25')]();if(_0x280466){var _0x98d894=utils[_0xeaba('0x26')](_0x280466);_0x98d894[_0xeaba('0x27')](function(_0x6df02c){_0x59f2fb['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x6df02c+',%');});}return _0x59f2fb;}function parseReadParameter(_0x3f627e){var _0x88cec9='';if(_0x3f627e){_0x88cec9='unreadMessages\x20{OPERATOR}\x200';if(_0x3f627e==='1'){_0x88cec9=_0x88cec9[_0xeaba('0x28')](_0xeaba('0x29'),'=');}else{_0x88cec9=_0x88cec9['replace'](_0xeaba('0x29'),'>');}}return _0x88cec9;}function parseSearchFilter(_0x52b263,_0x34cc55){var _0x5a3920=squel[_0xeaba('0x25')]();if(_0x34cc55){var _0x4238f5=_0x34cc55[_0xeaba('0x28')]('\x5c','\x5c\x5c')[_0xeaba('0x28')](/'/g,'\x27\x27');if(qs[_0xeaba('0x2a')](_0x4238f5)){_0x5a3920['or'](_0xeaba('0x2b'),_0x4238f5+'%');if([_0xeaba('0x2c'),'whatsapp'][_0xeaba('0x2d')](_0x52b263)){_0x5a3920['or'](_0xeaba('0x2e'),_0x4238f5+'%');}else if(_0x52b263===_0xeaba('0x2f')){_0x5a3920['or']('i.fax\x20LIKE\x20?',_0x4238f5+'%');}else if(_0x52b263===_0xeaba('0x30')){_0x5a3920['or']('i.from\x20LIKE\x20?',_0x4238f5+'%');}}else if(_0x52b263===_0xeaba('0x31')&&qs[_0xeaba('0x32')](_0x4238f5)){_0x5a3920['or'](_0xeaba('0x33'),_0x4238f5+'%');}else{if(_0x52b263===_0xeaba('0x31')){_0x5a3920['or'](_0xeaba('0x34'),qs[_0xeaba('0x35')](_0x4238f5,!![]))['or'](_0xeaba('0x36'),qs[_0xeaba('0x35')](_0x4238f5));}else if(_0x52b263!==_0xeaba('0x2f')){_0x5a3920['or'](_0xeaba('0x37'),qs[_0xeaba('0x35')](_0x4238f5));}_0x5a3920['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x4238f5,!![]),null);}}return _0x5a3920;}function parseAdvancedSearchFilter(_0x4ff630,_0x136e2d){var _0x50db59=getSqlClauses();var _0x455310=as[_0xeaba('0x38')](_0x4ff630);var _0x2bbc28=_0x455310[_0xeaba('0x39')];for(var _0x3791a9=0x0;_0x3791a9<_0x455310['conditions'][_0xeaba('0x15')];_0x3791a9++){var _0x5b3126=_0x455310[_0xeaba('0x3a')][_0x3791a9];var _0x583025='i';var _0xf22b2=_[_0xeaba('0x3b')](_0x136e2d,[_0xeaba('0x3c'),_0x5b3126[_0xeaba('0xc')]]);if(_0xf22b2){var _0x14b101=as[_0xeaba('0x3d')](_0x583025,_0xf22b2[_0xeaba('0x3e')],_0x5b3126);_0x50db59[_0xeaba('0x3f')][_0x2bbc28](_0x14b101[_0xeaba('0x40')],_0x14b101['value'][_0xeaba('0x41')],_0x14b101['value']['end']);}else{switch(_0x5b3126[_0xeaba('0xc')]){case'unreadMessages':var _0x406748=parseReadParameter(_0x5b3126[_0xeaba('0x42')]);_0x50db59[_0xeaba('0x43')][_0xeaba('0x44')](_0x406748);break;case _0xeaba('0x45'):if(_0x5b3126[_0xeaba('0x46')]===_0xeaba('0x47')){if(_0x5b3126[_0xeaba('0x42')]['split']('\x20')['length']>0x1){_0x50db59[_0xeaba('0x48')][_0x2bbc28](_0xeaba('0x49'),qs[_0xeaba('0x35')](_0x5b3126[_0xeaba('0x42')],!![]),null);}else{var _0x5d1166='%'+_0x5b3126[_0xeaba('0x42')]+'%';_0x50db59[_0xeaba('0x48')][_0x2bbc28](_0xeaba('0x4a'),_0x5d1166,_0x5d1166,_0x5d1166);}}else{_0xf22b2=_['find'](_0x136e2d,[_0xeaba('0x3c'),_0xeaba('0x4b')]);_0x5b3126[_0xeaba('0xc')]=_0xeaba('0x4b');_0x14b101=as[_0xeaba('0x3d')](_0x583025,_0xf22b2[_0xeaba('0x3e')],_0x5b3126);_0x50db59[_0xeaba('0x48')][_0x2bbc28](_0x14b101[_0xeaba('0x40')],_0x14b101[_0xeaba('0x42')][_0xeaba('0x41')],_0x14b101[_0xeaba('0x42')][_0xeaba('0x4c')]);}break;case _0xeaba('0x4d'):var _0x337d8d=_0x5b3126[_0xeaba('0x42')][_0xeaba('0x4e')](',')['map'](function(_0x596d4b){return Number(_0x596d4b);});var _0x351ec7=parseTagParameter(_0x337d8d);_0x50db59[_0xeaba('0x4f')][_0xeaba('0x50')][_0xeaba('0x44')](_0x351ec7);_0x50db59[_0xeaba('0x4f')][_0xeaba('0x51')]=_0x337d8d;break;case _0xeaba('0x52'):if(_0x5b3126[_0xeaba('0x46')]==='$substring'){_0x50db59[_0xeaba('0x53')][_0x2bbc28](_0xeaba('0x54'),'%'+_0x5b3126['value']+'%',null);}else{_0xf22b2=_['find'](_0x136e2d,['name',_0xeaba('0x55')]);_0x5b3126['field']=_0xeaba('0x55');_0x14b101=as[_0xeaba('0x3d')](_0x583025,_0xf22b2[_0xeaba('0x3e')],_0x5b3126);_0x50db59[_0xeaba('0x53')][_0x2bbc28](_0x14b101[_0xeaba('0x40')],_0x14b101['value'][_0xeaba('0x41')],_0x14b101[_0xeaba('0x42')][_0xeaba('0x4c')]);}break;case _0xeaba('0x56'):case _0xeaba('0x57'):_0x14b101=as[_0xeaba('0x3d')]('me',null,_0x5b3126);_0x50db59['body'][_0x2bbc28](_0x14b101[_0xeaba('0x40')],_0x14b101['value'][_0xeaba('0x41')],_0x14b101[_0xeaba('0x42')][_0xeaba('0x4c')]);break;}}}return _0x50db59;}function parseModelFields(_0x41b915,_0xeecf48,_0x5df8c9){var _0x378da4=utils[_0xeaba('0x8')](_0x41b915);var _0x546616=squel[_0xeaba('0x25')]();var _0x24b406=_(_0xeecf48)[_0xeaba('0x58')]()[_0xeaba('0x18')](function(_0x4a959e){return _[_0xeaba('0x59')](_0x5df8c9,[_0xeaba('0x3c'),_0x4a959e])?_0x4a959e:undefined;})[_0xeaba('0x5a')]()[_0xeaba('0x42')]();if(_0x24b406['length']>0x0){_0x24b406[_0xeaba('0x27')](function(_0x1417f5){if(_0x1417f5===_0x378da4){_0x546616[_0xeaba('0x44')]('i.'+_0x378da4+_0xeaba('0x17'),[]['concat'](_0xeecf48[_0x1417f5]));}else if(_0x1417f5==='createdAt'){var _0x505e52=JSON[_0xeaba('0x5b')](_0xeecf48[_0x1417f5])[_0xeaba('0x5c')];var _0x3b9abe=JSON[_0xeaba('0x5b')](_0xeecf48[_0x1417f5])[_0xeaba('0x5d')];_0x546616[_0xeaba('0x44')](_0xeaba('0x5e'),_0x505e52,_0x3b9abe);}else{if(_0xeecf48[_0x1417f5]==='null'){_0x546616[_0xeaba('0x44')]('i.'+_0x1417f5+_0xeaba('0x5f'));}else{_0x546616[_0xeaba('0x44')]('i.'+_0x1417f5+_0xeaba('0x60'),_0xeecf48[_0x1417f5]);}}});}return _0x546616;}function parseQueryParameters(_0x2fb1d0,_0x4128e1,_0x4c60c9){var _0x3b34f7=getSqlClauses();return Promise[_0xeaba('0x61')]()[_0xeaba('0x62')](function(){return parseModelFields(_0x2fb1d0,_0x4128e1,_0x4c60c9);})['then'](function(_0x434fd1){_0x3b34f7[_0xeaba('0x63')][_0xeaba('0x44')](_0x434fd1);return parseReadParameter(_0x4128e1[_0xeaba('0x43')]);})[_0xeaba('0x62')](function(_0x161004){_0x3b34f7[_0xeaba('0x43')]['and'](_0x161004);return parseTagParameter(_0x4128e1[_0xeaba('0x64')]);})[_0xeaba('0x62')](function(_0xea1b8d){_0x3b34f7[_0xeaba('0x4f')][_0xeaba('0x50')][_0xeaba('0x44')](_0xea1b8d);return parseSearchFilter(_0x2fb1d0,_0x4128e1[_0xeaba('0x65')]);})[_0xeaba('0x62')](function(_0x59fa9d){_0x3b34f7['filter']=_0x59fa9d;return _0x3b34f7;});}function checkAccountsRestrictions(_0xe459e6,_0x5b964f,_0x35241c){var _0x3cf43e=utils[_0xeaba('0x8')](_0xe459e6);var _0x38afcf=_0xeaba('0x66')+_[_0xeaba('0x67')](_0xe459e6)+(_0xe459e6===_0xeaba('0x68')?'Websites':_0xeaba('0x69'));var _0x4b1801=squel[_0xeaba('0x25')]();return Promise[_0xeaba('0x61')]()[_0xeaba('0x62')](function(){if(_0x35241c[_0xeaba('0x6a')]&&_0x5b964f[_0xeaba('0x9')]===_0xeaba('0xa')){return _0x5b964f[_0x38afcf]({'attributes':['id'],'raw':!![]});}})[_0xeaba('0x62')](function(_0xcb1a4a){if(_0xcb1a4a){if(_0xcb1a4a[_0xeaba('0x15')]===0x0){_0x4b1801[_0xeaba('0x44')]('i.'+_0x3cf43e+_0xeaba('0x5f'));}else{_0x4b1801[_0xeaba('0x44')]('i.'+_0x3cf43e+_0xeaba('0x17'),_[_0xeaba('0x18')](_0xcb1a4a,'id'));}}else if(!_0x35241c[_0x3cf43e]){_0x4b1801['and']('i.'+_0x3cf43e+_0xeaba('0x6b'));}})[_0xeaba('0x62')](function(){return _0x4b1801;});}function getClosedOrderClause(_0x23bde6,_0x421e9f){var _0x402ca2='';var _0x14a506=[_0xeaba('0x6c'),'i.secondDisposition',_0xeaba('0x6d')];if(_0x23bde6===_0xeaba('0x31')){_0x14a506['unshift']('i.substatus');}if(_0x421e9f[_0xeaba('0x6e')]==='0'&&_0x23bde6===_0xeaba('0x31')){_0x402ca2='i.substatus';}else{if(_0x421e9f[_0xeaba('0x6e')]==='1'){_0x14a506[_0xeaba('0x6f')]();}_0x402ca2=_0xeaba('0x70')+_0x14a506['join'](',\x20')+')';}return _0x402ca2;}function getFilteredInteractions(_0x1fe892,_0x455c97,_0x326f1c,_0xd9d603){var _0x23a6c5=utils[_0xeaba('0x1a')](_0x1fe892);var _0x188571=_[_0xeaba('0x67')](_0x1fe892)+_0xeaba('0x71');var _0x4d5cc1=[];var _0x2c57ac=getTagsQuery();var _0x44a38a={'type':db[_0xeaba('0x72')][_0xeaba('0x73')][_0xeaba('0x74')],'raw':!![]};var _0x27a0e7=[];var _0x12adbe=[];return db[_0xeaba('0x75')]['query'](_0x2c57ac[_0xeaba('0x76')](),_0x44a38a)[_0xeaba('0x62')](function(_0x2f3bf3){_0x4d5cc1=_[_0xeaba('0x77')](_0x2f3bf3,'id');_0x44a38a=_[_0xeaba('0x78')](_0x44a38a,{'model':db[_0x188571],'mapToModel':!![],'nest':!![]});if(_0x326f1c[_0xeaba('0x63')]){_0xd9d603['attributes']['forEach'](function(_0x277d12){_0x455c97['field']('i.'+_0x277d12);});}else{_0x455c97[_0xeaba('0xc')](_0xeaba('0x79'),'unreadMessages');_0x455c97['field'](_0xeaba('0x7a'),_0xeaba('0x7b'));_0x455c97[_0xeaba('0xc')](_0xeaba('0x7c'),_0xeaba('0x7d'));if(_0x1fe892===_0xeaba('0x31')){_0x455c97['field'](_0xeaba('0x7e'),'Account.email');_0x455c97[_0xeaba('0xc')](_0xeaba('0x7f'),'contactName');_0x455c97[_0xeaba('0xc')]('i.id');_0x455c97[_0xeaba('0xc')](_0xeaba('0x80'));_0x455c97[_0xeaba('0xc')](_0xeaba('0x81'));_0x455c97[_0xeaba('0xc')](_0xeaba('0x82'));_0x455c97['field']('i.closedAt');_0x455c97['field'](_0xeaba('0x83'));_0x455c97['field'](_0xeaba('0x84'));_0x455c97['field'](_0xeaba('0x85'));_0x455c97['field'](_0xeaba('0x86'));_0x455c97[_0xeaba('0xc')](_0xeaba('0x6d'));_0x455c97['field'](_0xeaba('0x87'));_0x455c97[_0xeaba('0xc')](_0xeaba('0x6c'));_0x455c97[_0xeaba('0xc')]('i.substatus');_0x455c97[_0xeaba('0xc')](_0xeaba('0x88'));_0x455c97[_0xeaba('0xc')]('i.ContactId');_0x455c97[_0xeaba('0xc')](_0xeaba('0x89'));_0x455c97['field'](_0xeaba('0x8a'));}else if(_0x1fe892==='openchannel'){_0x455c97[_0xeaba('0xc')](_0xeaba('0x8b'),'contactName');}else{_0x455c97[_0xeaba('0xc')](_0xeaba('0x8c'),_0xeaba('0x8d'));}if(_0x1fe892!==_0xeaba('0x31')){_0x455c97['field'](_0xeaba('0x8e'));}_0x455c97[_0xeaba('0xc')](_0xeaba('0x8f'),_0xeaba('0x90'));_0x455c97[_0xeaba('0xc')]('c.lastName',_0xeaba('0x91'));_0x455c97[_0xeaba('0xc')](_0xeaba('0x92'),_0xeaba('0x93'));_0x455c97[_0xeaba('0xc')](_0xeaba('0x94'),_0xeaba('0x95'));_0x455c97[_0xeaba('0xc')](_0xeaba('0x96'),_0xeaba('0x97'));_0x455c97[_0xeaba('0xc')](_0xeaba('0x98'),_0xeaba('0x99'));_0x455c97[_0xeaba('0xc')](_0xeaba('0x9a'),_0xeaba('0x9b'));_0x455c97[_0xeaba('0xc')]('o.internal','Owner.internal');_0x455c97[_0xeaba('0xc')](_0xeaba('0x9c'),_0xeaba('0x9d'));}if(_0xd9d603['limit']){_0x455c97['limit'](_0xd9d603[_0xeaba('0x9e')]);}if(_0xd9d603['offset']){_0x455c97[_0xeaba('0x9f')](_0xd9d603[_0xeaba('0x9f')]);}return db[_0xeaba('0x75')][_0xeaba('0xa0')](_0x455c97[_0xeaba('0x76')](),_0x44a38a);})[_0xeaba('0x62')](function(_0x570b2b){_0x27a0e7=_0x570b2b;var _0x381731=getUsersQuery(_0x1fe892,_0x27a0e7);return db['sequelize'][_0xeaba('0xa0')](_0x381731[_0xeaba('0x76')](),_0x44a38a);})[_0xeaba('0x62')](function(_0x26816d){_0x12adbe=_[_0xeaba('0xa1')](_0x26816d,_0x23a6c5);if(_0x1fe892==='mail'){return db[_0xeaba('0xa2')]['findOne']({'attributes':[_0xeaba('0xa3')],'raw':!![]});}})[_0xeaba('0x62')](function(_0x4c4090){var _0x404502=_0x4c4090?_0x4c4090[_0xeaba('0xa3')]:undefined;var _0x41addc=_0x27a0e7[_0xeaba('0x18')](function(_0x4deedc){return updateInteraction(_0x4deedc,_0x4d5cc1,_0x12adbe,_0x404502);});return Promise['all'](_0x41addc);});}function countFilteredInteractions(_0x15f354,_0x295e8b){var _0x34015e=_0x15f354[_0xeaba('0xa4')]();_0x34015e[_0xeaba('0xc')](_0xeaba('0xa5'));_0x34015e[_0xeaba('0xc')](_0xeaba('0x79'),_0xeaba('0xa6'));var _0x5534a6=utils[_0xeaba('0x26')](_0x295e8b);if(!_[_0xeaba('0xa7')](_0x5534a6)){_0x34015e[_0xeaba('0x16')](_0xeaba('0xa8'),_0x5534a6);}var _0xe5550b={'type':db[_0xeaba('0x72')][_0xeaba('0x73')][_0xeaba('0x74')],'raw':!![]};return db['sequelize'][_0xeaba('0xa0')](_0x34015e['toString'](),_0xe5550b);}module['exports']={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x0d97=['a.id\x20=\x20i.','messages','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','i.phone\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','parseSearch','sqlOperator','conditions','find','buildExpression','text','start','end','unreadMessages','value','and','Contact','$substring','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','Tag','split','clause','tags','User','operator','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','plainBody','keys','some','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','then','fields','read','get','capitalize','chat','Websites','Accounts','resolve','role','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','QueryTypes','SELECT','sequelize','query','toString','keyBy','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','a.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.createdAt','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.to','i.MailAccountId','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','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','TagIds','limit','offset','Setting','findOne','enableEmailPreview','all','COUNT(*)','isEmpty','exports','lodash','squel','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','agent','search','select','name','tools_tags','getInteractionFK','_interactions','field','u.id','u.fullname','ui.','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','from','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId'];(function(_0x408a0a,_0x3d47c9){var _0x5d0ce2=function(_0x5ceb0c){while(--_0x5ceb0c){_0x408a0a['push'](_0x408a0a['shift']());}};_0x5d0ce2(++_0x3d47c9);}(_0x0d97,0x86));var _0x70d9=function(_0x370e86,_0x8a788c){_0x370e86=_0x370e86-0x0;var _0x2e3359=_0x0d97[_0x370e86];return _0x2e3359;};'use strict';var _=require(_0x70d9('0x0'));var squel=require(_0x70d9('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0x70d9('0x2'));var updateInteraction=require(_0x70d9('0x3'))[_0x70d9('0x4')];var utils=require(_0x70d9('0x5'));var db=require(_0x70d9('0x6'))['db'];function skipInteractionsQuery(_0x21fdca,_0x150b01,_0x2c8fb3){var _0x53f1c9=![];var _0xdd535c=utils[_0x70d9('0x7')](_0x21fdca);if(_0x150b01['role']===_0x70d9('0x8')&&!_0x2c8fb3[_0x70d9('0x9')]&&!_0x2c8fb3[_0xdd535c]){_0x53f1c9=!![];}return _0x53f1c9;}function getTagsQuery(){return squel[_0x70d9('0xa')]()['field']('id')['field'](_0x70d9('0xb'))['field']('color')['from'](_0x70d9('0xc'));}function getUsersQuery(_0x38fdab,_0x14415a){var _0x5d7c06=utils[_0x70d9('0xd')](_0x38fdab);var _0xe4ab2f='user_has_'+_0x38fdab+_0x70d9('0xe');var _0x381dda=squel[_0x70d9('0xa')]()[_0x70d9('0xf')](_0x70d9('0x10'))['field'](_0x70d9('0x11'))[_0x70d9('0xf')](_0x70d9('0x12')+_0x5d7c06)['from'](_0xe4ab2f,'ui')['left_join'](_0x70d9('0x13'),'u',_0x70d9('0x14'));if(_0x14415a[_0x70d9('0x15')]>0x0){_0x381dda[_0x70d9('0x16')](_0x70d9('0x12')+_0x5d7c06+_0x70d9('0x17'),_[_0x70d9('0x18')](_0x14415a,'id'));}return _0x381dda;}function getInteractionsQuery(_0x48e2d4){var _0x2270a8=utils['getInteractionsTables'](_0x48e2d4);var _0x4efa14=utils['getAccountFK'](_0x48e2d4);var _0x14ea25=utils['getInteractionFK'](_0x48e2d4);return squel['select']()[_0x70d9('0x19')](_0x2270a8['interactions'],'i')[_0x70d9('0x1a')](_0x70d9('0x1b'),'c',_0x70d9('0x1c'))[_0x70d9('0x1a')]('users','o',_0x70d9('0x1d'))[_0x70d9('0x1a')](_0x2270a8['accounts'],'a',_0x70d9('0x1e')+_0x4efa14)[_0x70d9('0x1a')](_0x2270a8[_0x70d9('0x1f')],'me','me.'+_0x14ea25+_0x70d9('0x20'))[_0x70d9('0x1a')](_0x2270a8[_0x70d9('0x21')],'it',_0x70d9('0x22')+_0x14ea25+_0x70d9('0x20'))[_0x70d9('0x1a')](_0x70d9('0xc'),'t',_0x70d9('0x23'));}function getSqlClauses(){var _0x372171={'body':squel['expr'](),'contact':squel[_0x70d9('0x24')](),'default':squel[_0x70d9('0x24')](),'fields':squel[_0x70d9('0x24')](),'filter':squel[_0x70d9('0x24')](),'read':squel[_0x70d9('0x24')](),'tags':{'clause':squel[_0x70d9('0x24')](),'ids':null},'user':squel[_0x70d9('0x24')]()};return _0x372171;}function parseTagParameter(_0x3cf394){var _0x13a3da=squel[_0x70d9('0x24')]();if(_0x3cf394){var _0x432878=utils[_0x70d9('0x25')](_0x3cf394);_0x432878[_0x70d9('0x26')](function(_0x14e80c){_0x13a3da['or'](_0x70d9('0x27'),'%,'+_0x14e80c+',%');});}return _0x13a3da;}function parseReadParameter(_0x234f9e){var _0x5858b1='';if(_0x234f9e){_0x5858b1=_0x70d9('0x28');if(_0x234f9e==='1'){_0x5858b1=_0x5858b1[_0x70d9('0x29')](_0x70d9('0x2a'),'=');}else{_0x5858b1=_0x5858b1[_0x70d9('0x29')](_0x70d9('0x2a'),'>');}}return _0x5858b1;}function parseSearchFilter(_0xe4c901,_0xf941db){var _0x58cff8=squel['expr']();if(_0xf941db){var _0x3d0fc5=_0xf941db['replace']('\x5c','\x5c\x5c')[_0x70d9('0x29')](/'/g,'\x27\x27');if(qs[_0x70d9('0x2b')](_0x3d0fc5)){_0x58cff8['or'](_0x70d9('0x2c'),_0x3d0fc5+'%');if([_0x70d9('0x2d'),_0x70d9('0x2e')]['includes'](_0xe4c901)){_0x58cff8['or'](_0x70d9('0x2f'),_0x3d0fc5+'%');}else if(_0xe4c901==='fax'){_0x58cff8['or']('i.fax\x20LIKE\x20?',_0x3d0fc5+'%');}else if(_0xe4c901===_0x70d9('0x30')){_0x58cff8['or'](_0x70d9('0x31'),_0x3d0fc5+'%');}}else if(_0xe4c901===_0x70d9('0x32')&&qs[_0x70d9('0x33')](_0x3d0fc5)){_0x58cff8['or']('c.email\x20LIKE\x20?',_0x3d0fc5+'%');}else{if(_0xe4c901===_0x70d9('0x32')){_0x58cff8['or'](_0x70d9('0x34'),qs['getFullTextValue'](_0x3d0fc5,!![]))['or'](_0x70d9('0x35'),qs['getFullTextValue'](_0x3d0fc5));}else if(_0xe4c901!=='fax'){_0x58cff8['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x70d9('0x36')](_0x3d0fc5));}_0x58cff8['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x70d9('0x36')](_0x3d0fc5,!![]),null);}}return _0x58cff8;}function parseAdvancedSearchFilter(_0x198b3a,_0x4aba45){var _0x4846c5=getSqlClauses();var _0x5d9618=as[_0x70d9('0x37')](_0x198b3a);var _0x30e7ab=_0x5d9618[_0x70d9('0x38')];for(var _0xfebd9f=0x0;_0xfebd9f<_0x5d9618['conditions'][_0x70d9('0x15')];_0xfebd9f++){var _0x4729e9=_0x5d9618[_0x70d9('0x39')][_0xfebd9f];var _0x519635='i';var _0x477aef=_[_0x70d9('0x3a')](_0x4aba45,[_0x70d9('0xb'),_0x4729e9[_0x70d9('0xf')]]);if(_0x477aef){var _0x5b57af=as[_0x70d9('0x3b')](_0x519635,_0x477aef['type'],_0x4729e9);_0x4846c5['default'][_0x30e7ab](_0x5b57af[_0x70d9('0x3c')],_0x5b57af['value'][_0x70d9('0x3d')],_0x5b57af['value'][_0x70d9('0x3e')]);}else{switch(_0x4729e9['field']){case _0x70d9('0x3f'):var _0x3943ba=parseReadParameter(_0x4729e9[_0x70d9('0x40')]);_0x4846c5['read'][_0x70d9('0x41')](_0x3943ba);break;case _0x70d9('0x42'):if(_0x4729e9['operator']===_0x70d9('0x43')){if(_0x4729e9['value']['split']('\x20')['length']>0x1){_0x4846c5[_0x70d9('0x44')][_0x30e7ab]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x70d9('0x36')](_0x4729e9['value'],!![]),null);}else{var _0x5f02d2='%'+_0x4729e9[_0x70d9('0x40')]+'%';_0x4846c5[_0x70d9('0x44')][_0x30e7ab](_0x70d9('0x45'),_0x5f02d2,_0x5f02d2,_0x5f02d2);}}else{_0x477aef=_['find'](_0x4aba45,['name',_0x70d9('0x46')]);_0x4729e9[_0x70d9('0xf')]=_0x70d9('0x46');_0x5b57af=as['buildExpression'](_0x519635,_0x477aef[_0x70d9('0x47')],_0x4729e9);_0x4846c5[_0x70d9('0x44')][_0x30e7ab](_0x5b57af[_0x70d9('0x3c')],_0x5b57af[_0x70d9('0x40')][_0x70d9('0x3d')],_0x5b57af['value'][_0x70d9('0x3e')]);}break;case _0x70d9('0x48'):var _0x3d9228=_0x4729e9[_0x70d9('0x40')][_0x70d9('0x49')](',')[_0x70d9('0x18')](function(_0x33d2ff){return Number(_0x33d2ff);});var _0x1a285a=parseTagParameter(_0x3d9228);_0x4846c5['tags'][_0x70d9('0x4a')][_0x70d9('0x41')](_0x1a285a);_0x4846c5[_0x70d9('0x4b')]['ids']=_0x3d9228;break;case _0x70d9('0x4c'):if(_0x4729e9[_0x70d9('0x4d')]==='$substring'){_0x4846c5[_0x70d9('0x4e')][_0x30e7ab](_0x70d9('0x4f'),'%'+_0x4729e9['value']+'%',null);}else{_0x477aef=_[_0x70d9('0x3a')](_0x4aba45,['name',_0x70d9('0x50')]);_0x4729e9['field']='UserId';_0x5b57af=as['buildExpression'](_0x519635,_0x477aef['type'],_0x4729e9);_0x4846c5[_0x70d9('0x4e')][_0x30e7ab](_0x5b57af[_0x70d9('0x3c')],_0x5b57af['value'][_0x70d9('0x3d')],_0x5b57af[_0x70d9('0x40')][_0x70d9('0x3e')]);}break;case'body':case _0x70d9('0x51'):_0x5b57af=as[_0x70d9('0x3b')]('me',null,_0x4729e9);_0x4846c5['body'][_0x30e7ab](_0x5b57af[_0x70d9('0x3c')],_0x5b57af[_0x70d9('0x40')][_0x70d9('0x3d')],_0x5b57af['value'][_0x70d9('0x3e')]);break;}}}return _0x4846c5;}function parseModelFields(_0x121ad5,_0x4b17ad,_0x5d7922){var _0x2948ef=utils[_0x70d9('0x7')](_0x121ad5);var _0x38eb8b=squel[_0x70d9('0x24')]();var _0x24c3d0=_(_0x4b17ad)[_0x70d9('0x52')]()[_0x70d9('0x18')](function(_0x18dd4e){return _[_0x70d9('0x53')](_0x5d7922,[_0x70d9('0xb'),_0x18dd4e])?_0x18dd4e:undefined;})['compact']()[_0x70d9('0x40')]();if(_0x24c3d0[_0x70d9('0x15')]>0x0){_0x24c3d0[_0x70d9('0x26')](function(_0x1be35b){if(_0x1be35b===_0x2948ef){_0x38eb8b[_0x70d9('0x41')]('i.'+_0x2948ef+'\x20IN\x20?',[][_0x70d9('0x54')](_0x4b17ad[_0x1be35b]));}else if(_0x1be35b===_0x70d9('0x55')){var _0x499c22=JSON['parse'](_0x4b17ad[_0x1be35b])['$gte'];var _0x536b55=JSON[_0x70d9('0x56')](_0x4b17ad[_0x1be35b])[_0x70d9('0x57')];_0x38eb8b[_0x70d9('0x41')](_0x70d9('0x58'),_0x499c22,_0x536b55);}else{if(_0x4b17ad[_0x1be35b]===_0x70d9('0x59')){_0x38eb8b[_0x70d9('0x41')]('i.'+_0x1be35b+_0x70d9('0x5a'));}else{_0x38eb8b[_0x70d9('0x41')]('i.'+_0x1be35b+_0x70d9('0x5b'),_0x4b17ad[_0x1be35b]);}}});}return _0x38eb8b;}function parseQueryParameters(_0x37360d,_0x5e775d,_0x28aefc){var _0x207a47=getSqlClauses();return Promise['resolve']()[_0x70d9('0x5c')](function(){return parseModelFields(_0x37360d,_0x5e775d,_0x28aefc);})[_0x70d9('0x5c')](function(_0x249eba){_0x207a47[_0x70d9('0x5d')][_0x70d9('0x41')](_0x249eba);return parseReadParameter(_0x5e775d[_0x70d9('0x5e')]);})[_0x70d9('0x5c')](function(_0xb6500){_0x207a47[_0x70d9('0x5e')][_0x70d9('0x41')](_0xb6500);return parseTagParameter(_0x5e775d['tag']);})['then'](function(_0x576e00){_0x207a47[_0x70d9('0x4b')]['clause'][_0x70d9('0x41')](_0x576e00);return parseSearchFilter(_0x37360d,_0x5e775d['filter']);})[_0x70d9('0x5c')](function(_0x284464){_0x207a47['filter']=_0x284464;return _0x207a47;});}function checkAccountsRestrictions(_0x59a5c4,_0x1af4a6,_0x46e9af){var _0x53d12b=utils['getAccountFK'](_0x59a5c4);var _0x152027=_0x70d9('0x5f')+_[_0x70d9('0x60')](_0x59a5c4)+(_0x59a5c4===_0x70d9('0x61')?_0x70d9('0x62'):_0x70d9('0x63'));var _0x21999c=squel['expr']();return Promise[_0x70d9('0x64')]()[_0x70d9('0x5c')](function(){if(_0x46e9af[_0x70d9('0x9')]&&_0x1af4a6[_0x70d9('0x65')]==='agent'){return _0x1af4a6[_0x152027]({'attributes':['id'],'raw':!![]});}})[_0x70d9('0x5c')](function(_0x1246bf){if(_0x1246bf){if(_0x1246bf[_0x70d9('0x15')]===0x0){_0x21999c['and']('i.'+_0x53d12b+_0x70d9('0x5a'));}else{_0x21999c[_0x70d9('0x41')]('i.'+_0x53d12b+'\x20IN\x20?',_[_0x70d9('0x18')](_0x1246bf,'id'));}}else if(!_0x46e9af[_0x53d12b]){_0x21999c['and']('i.'+_0x53d12b+_0x70d9('0x66'));}})[_0x70d9('0x5c')](function(){return _0x21999c;});}function getClosedOrderClause(_0x2e8100,_0x15bf6b){var _0x5f24b3='';var _0x793512=[_0x70d9('0x67'),_0x70d9('0x68'),'i.disposition'];if(_0x2e8100===_0x70d9('0x32')){_0x793512['unshift'](_0x70d9('0x69'));}if(_0x15bf6b[_0x70d9('0x6a')]==='0'&&_0x2e8100===_0x70d9('0x32')){_0x5f24b3='i.substatus';}else{if(_0x15bf6b[_0x70d9('0x6a')]==='1'){_0x793512[_0x70d9('0x6b')]();}_0x5f24b3=_0x70d9('0x6c')+_0x793512[_0x70d9('0x6d')](',\x20')+')';}return _0x5f24b3;}function getFilteredInteractions(_0xc164da,_0x25bd8a,_0x178cb8,_0x31efd8){var _0x1d8c54=utils['getInteractionFK'](_0xc164da);var _0x50a94a=_[_0x70d9('0x60')](_0xc164da)+_0x70d9('0x6e');var _0x8e451d=[];var _0xa13dba=getTagsQuery();var _0x3d8036={'type':db[_0x70d9('0x6f')][_0x70d9('0x70')][_0x70d9('0x71')],'raw':!![]};var _0x4740bf=[];var _0x50439c=[];return db[_0x70d9('0x72')][_0x70d9('0x73')](_0xa13dba[_0x70d9('0x74')](),_0x3d8036)['then'](function(_0x133852){_0x8e451d=_[_0x70d9('0x75')](_0x133852,'id');_0x3d8036=_[_0x70d9('0x76')](_0x3d8036,{'model':db[_0x50a94a],'mapToModel':!![],'nest':!![]});if(_0x178cb8['fields']){_0x31efd8[_0x70d9('0x77')][_0x70d9('0x26')](function(_0x5cc258){_0x25bd8a[_0x70d9('0xf')]('i.'+_0x5cc258);});}else{_0x25bd8a[_0x70d9('0xf')](_0x70d9('0x78'),_0x70d9('0x3f'));_0x25bd8a[_0x70d9('0xf')]('a.key',_0x70d9('0x79'));_0x25bd8a[_0x70d9('0xf')](_0x70d9('0x7a'),'Account.mandatoryDisposition');if(_0xc164da===_0x70d9('0x32')){_0x25bd8a['field'](_0x70d9('0x7b'),'Account.email');_0x25bd8a[_0x70d9('0xf')](_0x70d9('0x7c'),_0x70d9('0x7d'));_0x25bd8a['field'](_0x70d9('0x7e'));_0x25bd8a[_0x70d9('0xf')](_0x70d9('0x7f'));_0x25bd8a[_0x70d9('0xf')]('i.updatedAt');_0x25bd8a[_0x70d9('0xf')]('i.closed');_0x25bd8a[_0x70d9('0xf')](_0x70d9('0x80'));_0x25bd8a[_0x70d9('0xf')](_0x70d9('0x81'));_0x25bd8a['field'](_0x70d9('0x82'));_0x25bd8a[_0x70d9('0xf')](_0x70d9('0x83'));_0x25bd8a[_0x70d9('0xf')](_0x70d9('0x84'));_0x25bd8a[_0x70d9('0xf')](_0x70d9('0x85'));_0x25bd8a[_0x70d9('0xf')](_0x70d9('0x68'));_0x25bd8a['field'](_0x70d9('0x67'));_0x25bd8a[_0x70d9('0xf')]('i.substatus');_0x25bd8a[_0x70d9('0xf')](_0x70d9('0x86'));_0x25bd8a[_0x70d9('0xf')]('i.ContactId');_0x25bd8a[_0x70d9('0xf')](_0x70d9('0x87'));_0x25bd8a['field']('i.UserId');}else if(_0xc164da===_0x70d9('0x30')){_0x25bd8a[_0x70d9('0xf')](_0x70d9('0x88'),_0x70d9('0x7d'));}else{_0x25bd8a[_0x70d9('0xf')](_0x70d9('0x89'),_0x70d9('0x7d'));}if(_0xc164da!==_0x70d9('0x32')){_0x25bd8a[_0x70d9('0xf')](_0x70d9('0x8a'));}_0x25bd8a[_0x70d9('0xf')](_0x70d9('0x8b'),_0x70d9('0x8c'));_0x25bd8a['field']('c.lastName',_0x70d9('0x8d'));_0x25bd8a[_0x70d9('0xf')](_0x70d9('0x8e'),_0x70d9('0x8f'));_0x25bd8a[_0x70d9('0xf')](_0x70d9('0x90'),_0x70d9('0x91'));_0x25bd8a[_0x70d9('0xf')](_0x70d9('0x92'),_0x70d9('0x93'));_0x25bd8a[_0x70d9('0xf')](_0x70d9('0x94'),_0x70d9('0x95'));_0x25bd8a[_0x70d9('0xf')](_0x70d9('0x96'),_0x70d9('0x97'));_0x25bd8a[_0x70d9('0xf')](_0x70d9('0x98'),_0x70d9('0x99'));_0x25bd8a['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x70d9('0x9a'));}if(_0x31efd8['limit']){_0x25bd8a[_0x70d9('0x9b')](_0x31efd8[_0x70d9('0x9b')]);}if(_0x31efd8['offset']){_0x25bd8a[_0x70d9('0x9c')](_0x31efd8['offset']);}return db[_0x70d9('0x72')][_0x70d9('0x73')](_0x25bd8a[_0x70d9('0x74')](),_0x3d8036);})['then'](function(_0x64d7da){_0x4740bf=_0x64d7da;var _0x3080c7=getUsersQuery(_0xc164da,_0x4740bf);return db[_0x70d9('0x72')][_0x70d9('0x73')](_0x3080c7['toString'](),_0x3d8036);})[_0x70d9('0x5c')](function(_0x29ab5b){_0x50439c=_['groupBy'](_0x29ab5b,_0x1d8c54);if(_0xc164da==='mail'){return db[_0x70d9('0x9d')][_0x70d9('0x9e')]({'attributes':['enableEmailPreview'],'raw':!![]});}})[_0x70d9('0x5c')](function(_0xf0a82d){var _0x4ddd77=_0xf0a82d?_0xf0a82d[_0x70d9('0x9f')]:undefined;var _0x1ec708=_0x4740bf[_0x70d9('0x18')](function(_0x589d90){return updateInteraction(_0x589d90,_0x8e451d,_0x50439c,_0x4ddd77);});return Promise[_0x70d9('0xa0')](_0x1ec708);});}function countFilteredInteractions(_0xdc2f8d,_0x417a80){var _0x40d6dc=_0xdc2f8d['clone']();_0x40d6dc[_0x70d9('0xf')](_0x70d9('0xa1'));_0x40d6dc['field'](_0x70d9('0x78'),_0x70d9('0x3f'));var _0x159484=utils['getSelectedTags'](_0x417a80);if(!_[_0x70d9('0xa2')](_0x159484)){_0x40d6dc['where']('t.id\x20IN\x20?',_0x159484);}var _0x3aa915={'type':db['Sequelize'][_0x70d9('0x70')][_0x70d9('0x71')],'raw':!![]};return db[_0x70d9('0x72')][_0x70d9('0x73')](_0x40d6dc[_0x70d9('0x74')](),_0x3aa915);}module[_0x70d9('0xa3')]={'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 8b7a44a..c62cf2b 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 _0x9836=['abandoned','closed','disposition','UserId','talking','total','-id','then','trimStart','plainBody','catch','updateInteraction','Users','TagIds','Tags','lodash','map','fullname','split','push','waiting','answered'];(function(_0x13b3b5,_0x52d8d8){var _0x337cd0=function(_0x31fbdf){while(--_0x31fbdf){_0x13b3b5['push'](_0x13b3b5['shift']());}};_0x337cd0(++_0x52d8d8);}(_0x9836,0x159));var _0x6983=function(_0x46306c,_0x1cb39c){_0x46306c=_0x46306c-0x0;var _0x423037=_0x9836[_0x46306c];return _0x423037;};'use strict';var _=require(_0x6983('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x330716,_0x2096ed){return new Promise(function(_0x3c2273,_0x396574){try{var _0x14205d=[];if(_0x2096ed[_0x330716]){_0x14205d=_0x2096ed[_0x330716][_0x6983('0x1')](function(_0x296302){return{'id':_0x296302['id'],'fullname':_0x296302[_0x6983('0x2')]};});}return _0x3c2273(_0x14205d);}catch(_0x48b3f5){_0x396574(_0x48b3f5);}});}function getInteractionTags(_0x59e364,_0x5888f8){var _0x1ee0df=[];if(_0x59e364){_0x59e364[_0x6983('0x3')](',')['forEach'](function(_0x5bf8b5){_0x1ee0df[_0x6983('0x4')](_0x5888f8[_0x5bf8b5]);});}return _0x1ee0df;}function updateWaitingCounter(_0x5da9f3){if(_0x5da9f3[_0x6983('0x5')]){_0x5da9f3[_0x6983('0x5')]-=0x1;}}function updateInteractionCounters(_0x2f4957){_0x2f4957['waiting']=0x0;_0x2f4957['talking']=0x0;_0x2f4957[_0x6983('0x6')]=0x0;_0x2f4957['unmanaged']=0x0;_0x2f4957[_0x6983('0x7')]=0x0;_0x2f4957['total']=0x0;if(_0x2f4957[_0x6983('0x8')]){if(_0x2f4957[_0x6983('0x9')]===_0x6983('0x7')){_0x2f4957['abandoned']+=0x1;updateWaitingCounter(_0x2f4957);}if(_0x2f4957[_0x6983('0xa')]){_0x2f4957[_0x6983('0x6')]+=0x1;if(_0x2f4957[_0x6983('0xb')]){_0x2f4957[_0x6983('0xb')]-=0x1;}}else{if(_0x2f4957[_0x6983('0x9')]){_0x2f4957['unmanaged']+=0x1;updateWaitingCounter(_0x2f4957);}}}else{if(!_0x2f4957['UserId']){_0x2f4957[_0x6983('0x5')]+=0x1;}if(_0x2f4957[_0x6983('0xa')]){_0x2f4957[_0x6983('0xb')]+=0x1;updateWaitingCounter(_0x2f4957);}}_0x2f4957[_0x6983('0xc')]+=0x1;return _0x2f4957;}function getLastMessageText(_0x4f6390){return db['MailMessage']['findOne']({'where':{'$and':[{'MailInteractionId':_0x4f6390['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x6983('0xd'),'raw':!![]})[_0x6983('0xe')](function(_0x2a12d4){if(_0x2a12d4&&_0x2a12d4['plainBody']){_0x4f6390['lastMsgText']=_[_0x6983('0xf')](_0x2a12d4[_0x6983('0x10')]);}return _0x4f6390;})[_0x6983('0x11')](function(_0x299e67){throw _0x299e67;});}exports[_0x6983('0x12')]=function(_0x3a861b,_0x1ce406,_0x190444,_0x1b0778){return new Promise(function(_0x184ae1,_0x25c9a3){return getInteractionUsers(_0x3a861b['id'],_0x190444)['then'](function(_0x310d56){_0x3a861b[_0x6983('0x13')]=_0x310d56;return getInteractionTags(_0x3a861b[_0x6983('0x14')],_0x1ce406);})['then'](function(_0x3a4e55){_0x3a861b[_0x6983('0x15')]=_0x3a4e55;delete _0x3a861b[_0x6983('0x14')];return updateInteractionCounters(_0x3a861b);})[_0x6983('0xe')](function(_0x20d6c9){if(_0x1b0778){return getLastMessageText(_0x20d6c9);}else{return _0x20d6c9;}})[_0x6983('0xe')](function(_0x2e471b){_0x184ae1(_0x2e471b);})[_0x6983('0x11')](function(_0x2da846){_0x25c9a3(_0x2da846);});});}; \ No newline at end of file +var _0x01cf=['disposition','UserId','total','MailMessage','out','then','lastMsgText','plainBody','catch','TagIds','Tags','lodash','../../mysqldb','map','fullname','forEach','push','waiting','talking','abandoned','closed'];(function(_0x236dfe,_0x49c777){var _0x847c2d=function(_0x62e4d){while(--_0x62e4d){_0x236dfe['push'](_0x236dfe['shift']());}};_0x847c2d(++_0x49c777);}(_0x01cf,0x1c4));var _0xf01c=function(_0x146ccb,_0x11d3b5){_0x146ccb=_0x146ccb-0x0;var _0x2c552d=_0x01cf[_0x146ccb];return _0x2c552d;};'use strict';var _=require(_0xf01c('0x0'));var db=require(_0xf01c('0x1'))['db'];function getInteractionUsers(_0x383d86,_0x5453f9){return new Promise(function(_0x269c29,_0xbd8a00){try{var _0x56aaf0=[];if(_0x5453f9[_0x383d86]){_0x56aaf0=_0x5453f9[_0x383d86][_0xf01c('0x2')](function(_0x381d46){return{'id':_0x381d46['id'],'fullname':_0x381d46[_0xf01c('0x3')]};});}return _0x269c29(_0x56aaf0);}catch(_0x4e03dc){_0xbd8a00(_0x4e03dc);}});}function getInteractionTags(_0x23c0ab,_0x5de486){var _0x31dd85=[];if(_0x23c0ab){_0x23c0ab['split'](',')[_0xf01c('0x4')](function(_0x4d7192){_0x31dd85[_0xf01c('0x5')](_0x5de486[_0x4d7192]);});}return _0x31dd85;}function updateWaitingCounter(_0x46c18e){if(_0x46c18e[_0xf01c('0x6')]){_0x46c18e['waiting']-=0x1;}}function updateInteractionCounters(_0x310845){_0x310845[_0xf01c('0x6')]=0x0;_0x310845[_0xf01c('0x7')]=0x0;_0x310845['answered']=0x0;_0x310845['unmanaged']=0x0;_0x310845[_0xf01c('0x8')]=0x0;_0x310845['total']=0x0;if(_0x310845[_0xf01c('0x9')]){if(_0x310845[_0xf01c('0xa')]===_0xf01c('0x8')){_0x310845[_0xf01c('0x8')]+=0x1;updateWaitingCounter(_0x310845);}if(_0x310845[_0xf01c('0xb')]){_0x310845['answered']+=0x1;if(_0x310845[_0xf01c('0x7')]){_0x310845[_0xf01c('0x7')]-=0x1;}}else{if(_0x310845['disposition']){_0x310845['unmanaged']+=0x1;updateWaitingCounter(_0x310845);}}}else{if(!_0x310845[_0xf01c('0xb')]){_0x310845[_0xf01c('0x6')]+=0x1;}if(_0x310845['UserId']){_0x310845[_0xf01c('0x7')]+=0x1;updateWaitingCounter(_0x310845);}}_0x310845[_0xf01c('0xc')]+=0x1;return _0x310845;}function getLastMessageText(_0x1e94ab){return db[_0xf01c('0xd')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x1e94ab['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xf01c('0xe')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':'-id','raw':!![]})[_0xf01c('0xf')](function(_0x34ae83){if(_0x34ae83&&_0x34ae83['plainBody']){_0x1e94ab[_0xf01c('0x10')]=_['trimStart'](_0x34ae83[_0xf01c('0x11')]);}return _0x1e94ab;})[_0xf01c('0x12')](function(_0x1f1ccc){throw _0x1f1ccc;});}exports['updateInteraction']=function(_0x572516,_0x1f83ad,_0x225dc1,_0x56b092){return new Promise(function(_0x20755b,_0x35a69b){return getInteractionUsers(_0x572516['id'],_0x225dc1)[_0xf01c('0xf')](function(_0x3b7f55){_0x572516['Users']=_0x3b7f55;return getInteractionTags(_0x572516[_0xf01c('0x13')],_0x1f83ad);})[_0xf01c('0xf')](function(_0xd11979){_0x572516[_0xf01c('0x14')]=_0xd11979;delete _0x572516['TagIds'];return updateInteractionCounters(_0x572516);})[_0xf01c('0xf')](function(_0x110579){if(_0x56b092){return getLastMessageText(_0x110579);}else{return _0x110579;}})[_0xf01c('0xf')](function(_0x544be2){_0x20755b(_0x544be2);})[_0xf01c('0x12')](function(_0x38e24a){_0x35a69b(_0x38e24a);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 4195e07..0a9a2d9 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 _0x8e09=['unknown','websites','accounts','_interaction_has_tags','_messages','user_has_','_interactions','isArray','toLowerCase','toUpperCase','stringify','null','Interaction','then','error','exports','lodash','../../mysqldb','../../config/logger','mail-interactions','fax-interactions','sms-interactions','chat-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst'];(function(_0x215d5d,_0x2c6cb0){var _0x1e8480=function(_0x5c8639){while(--_0x5c8639){_0x215d5d['push'](_0x215d5d['shift']());}};_0x1e8480(++_0x2c6cb0);}(_0x8e09,0x84));var _0x98e0=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0x8e09[_0x373dee];return _0x46798f;};'use strict';var _=require(_0x98e0('0x0'));var db=require(_0x98e0('0x1'))['db'];var loggers={'openchannel':require(_0x98e0('0x2'))('openchannel-interactions'),'mail':require(_0x98e0('0x2'))(_0x98e0('0x3')),'fax':require(_0x98e0('0x2'))(_0x98e0('0x4')),'sms':require(_0x98e0('0x2'))(_0x98e0('0x5')),'chat':require(_0x98e0('0x2'))(_0x98e0('0x6')),'whatsapp':require('../../config/logger')('whatsapp-interactions')};function getAccountFK(_0x3da7ee){return _[_0x98e0('0x7')](_0x3da7ee)+(_0x3da7ee===_0x98e0('0x8')?_0x98e0('0x9'):_0x98e0('0xa'))+'Id';}function getInteractionFK(_0x2c48df){return _['capitalize'](_0x2c48df)+_0x98e0('0xb');}function getInteractionId(_0x173c98,_0x154490,_0x5869ee){if(_0x173c98&&_0x173c98[_['upperFirst'](_0x5869ee)+_0x98e0('0xb')]){return _0x173c98[_[_0x98e0('0xc')](_0x5869ee)+'InteractionId'];}else if(_0x173c98&&_0x173c98['id']){return _0x173c98['id'];}else if(_0x154490&&_0x154490['id']){return _0x154490['id'];}else{return _0x98e0('0xd');}}function getInteractionsTables(_0x3c4462){return{'accounts':_0x3c4462+'_'+(_0x3c4462===_0x98e0('0x8')?_0x98e0('0xe'):_0x98e0('0xf')),'interactions':_0x3c4462+'_interactions','interactionsTags':_0x3c4462+_0x98e0('0x10'),'messages':_0x3c4462+_0x98e0('0x11'),'userInteractions':_0x98e0('0x12')+_0x3c4462+_0x98e0('0x13')};}function getSelectedTags(_0x398d67){var _0x4f488a=[];if(_0x398d67){_0x4f488a=Array[_0x98e0('0x14')](_0x398d67)?_0x398d67:[_0x398d67];}return _0x4f488a;}function log(_0x2b1de2,_0x4e1e34,_0x13ea50,_0x42ab6c,_0x4f0a98,_0x75ed53){loggers[_0x4f0a98[_0x98e0('0x15')]()][_0x2b1de2]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x75ed53[_0x98e0('0x16')](),_0x4e1e34?_0x4e1e34['id']:null,_0x4e1e34?_0x4e1e34['name']:null,_0x4e1e34?_0x4e1e34['role']:null,getInteractionId(_0x13ea50,_0x42ab6c,_0x4f0a98),_0x13ea50?JSON[_0x98e0('0x17')](_0x13ea50):_0x98e0('0x18'));}function updateUser(_0x5d31ce,_0x16745b,_0x17d4e0,_0x34ffe5,_0x1a8fa5){db[_['upperFirst'](_0x34ffe5)+_0x98e0('0x19')]['findOne']({'where':{'id':getInteractionId(_0x16745b,_0x17d4e0,_0x34ffe5)}})[_0x98e0('0x1a')](function(_0x596e01){if(_0x596e01){return _0x596e01['update']({'UserId':_0x5d31ce?_0x5d31ce['id']:null});}})[_0x98e0('0x1a')](function(_0x5936fd){if(_0x5936fd){log('info',_0x5d31ce,_0x16745b,_0x17d4e0,_0x34ffe5,_0x1a8fa5);}})['catch'](function(){log(_0x98e0('0x1b'),_0x5d31ce,_0x16745b,_0x17d4e0,_0x34ffe5,_0x1a8fa5);});}module[_0x98e0('0x1c')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x5f18=['isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role','stringify','null','Interaction','findOne','then','info','catch','error','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','chat','Website','Account','capitalize','InteractionId','upperFirst','unknown','_interactions','_interaction_has_tags','_messages','user_has_'];(function(_0x1dcfad,_0x249b15){var _0x146b17=function(_0x27f425){while(--_0x27f425){_0x1dcfad['push'](_0x1dcfad['shift']());}};_0x146b17(++_0x249b15);}(_0x5f18,0x96));var _0x85f1=function(_0xfa193c,_0x5ad4c9){_0xfa193c=_0xfa193c-0x0;var _0x581d16=_0x5f18[_0xfa193c];return _0x581d16;};'use strict';var _=require(_0x85f1('0x0'));var db=require(_0x85f1('0x1'))['db'];var loggers={'openchannel':require(_0x85f1('0x2'))(_0x85f1('0x3')),'mail':require(_0x85f1('0x2'))(_0x85f1('0x4')),'fax':require(_0x85f1('0x2'))(_0x85f1('0x5')),'sms':require(_0x85f1('0x2'))(_0x85f1('0x6')),'chat':require(_0x85f1('0x2'))(_0x85f1('0x7')),'whatsapp':require(_0x85f1('0x2'))(_0x85f1('0x8'))};function getAccountFK(_0x150f8a){return _['capitalize'](_0x150f8a)+(_0x150f8a===_0x85f1('0x9')?_0x85f1('0xa'):_0x85f1('0xb'))+'Id';}function getInteractionFK(_0x57d043){return _[_0x85f1('0xc')](_0x57d043)+_0x85f1('0xd');}function getInteractionId(_0x1b772f,_0x48a5b3,_0x2c0c4e){if(_0x1b772f&&_0x1b772f[_[_0x85f1('0xe')](_0x2c0c4e)+_0x85f1('0xd')]){return _0x1b772f[_['upperFirst'](_0x2c0c4e)+_0x85f1('0xd')];}else if(_0x1b772f&&_0x1b772f['id']){return _0x1b772f['id'];}else if(_0x48a5b3&&_0x48a5b3['id']){return _0x48a5b3['id'];}else{return _0x85f1('0xf');}}function getInteractionsTables(_0x375777){return{'accounts':_0x375777+'_'+(_0x375777===_0x85f1('0x9')?'websites':'accounts'),'interactions':_0x375777+_0x85f1('0x10'),'interactionsTags':_0x375777+_0x85f1('0x11'),'messages':_0x375777+_0x85f1('0x12'),'userInteractions':_0x85f1('0x13')+_0x375777+'_interactions'};}function getSelectedTags(_0x25ab2c){var _0x3b7c8a=[];if(_0x25ab2c){_0x3b7c8a=Array[_0x85f1('0x14')](_0x25ab2c)?_0x25ab2c:[_0x25ab2c];}return _0x3b7c8a;}function log(_0x46221b,_0x9203dd,_0x30b3c3,_0xb2dd86,_0x58331c,_0x5b9cd8){loggers[_0x58331c[_0x85f1('0x15')]()][_0x46221b](_0x85f1('0x16'),_0x5b9cd8[_0x85f1('0x17')](),_0x9203dd?_0x9203dd['id']:null,_0x9203dd?_0x9203dd['name']:null,_0x9203dd?_0x9203dd[_0x85f1('0x18')]:null,getInteractionId(_0x30b3c3,_0xb2dd86,_0x58331c),_0x30b3c3?JSON[_0x85f1('0x19')](_0x30b3c3):_0x85f1('0x1a'));}function updateUser(_0x10ff15,_0x9a724f,_0x1266b0,_0xcc4a3f,_0x2a85b2){db[_[_0x85f1('0xe')](_0xcc4a3f)+_0x85f1('0x1b')][_0x85f1('0x1c')]({'where':{'id':getInteractionId(_0x9a724f,_0x1266b0,_0xcc4a3f)}})[_0x85f1('0x1d')](function(_0xcc0438){if(_0xcc0438){return _0xcc0438['update']({'UserId':_0x10ff15?_0x10ff15['id']:null});}})[_0x85f1('0x1d')](function(_0x2dc524){if(_0x2dc524){log(_0x85f1('0x1e'),_0x10ff15,_0x9a724f,_0x1266b0,_0xcc4a3f,_0x2a85b2);}})[_0x85f1('0x1f')](function(){log(_0x85f1('0x20'),_0x10ff15,_0x9a724f,_0x1266b0,_0xcc4a3f,_0x2a85b2);});}module[_0x85f1('0x21')]={'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 aaf0a9a..c69b15b 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 _0x9dc3=['then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','admin','isUserLimit','crypto','composable-middleware','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','utf8','final','parse','hasOwnProperty','use','License'];(function(_0x37a7f5,_0x34a4b4){var _0x8c2073=function(_0x1f468e){while(--_0x1f468e){_0x37a7f5['push'](_0x37a7f5['shift']());}};_0x8c2073(++_0x34a4b4);}(_0x9dc3,0x1dd));var _0x39dc=function(_0x3e5108,_0xa475ee){_0x3e5108=_0x3e5108-0x0;var _0x242125=_0x9dc3[_0x3e5108];return _0x242125;};'use strict';var crypto=require(_0x39dc('0x0'));var util=require('util');var compose=require(_0x39dc('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x39dc('0x2'));function getValueFromLicense(_0x466303,_0x3c75f2){if(_0x466303&&_0x3c75f2){if(_0x3c75f2[_0x39dc('0x3')]&&_0x3c75f2[_0x39dc('0x4')]){var _0x3b015d=_0x3c75f2['data1'];var _0x46da55=_0x3c75f2[_0x39dc('0x4')];var _0x89a7ef=_0x3b015d[_0x39dc('0x5')]('-')[0x4];var _0x16e2e1=_0x3b015d[_0x39dc('0x5')]('-')[0x0];var _0x105f5a=crypto[_0x39dc('0x6')](_0x39dc('0x7'),util[_0x39dc('0x8')](_0x39dc('0x9'),_0x89a7ef,_0x3b015d,_0x16e2e1));var _0x59aed0=_0x105f5a[_0x39dc('0xa')](_0x46da55,'base64',_0x39dc('0xb'));_0x59aed0+=_0x105f5a[_0x39dc('0xc')](_0x39dc('0xb'));var _0x3455af=JSON[_0x39dc('0xd')](_0x59aed0);return _0x3455af[_0x39dc('0xe')](_0x466303)?_0x3455af[_0x466303]:null;}}return null;}function isLimit(_0x40abe2,_0x2b6ab2,_0xf2b083,_0x104433){var _0x23ee0b=_0x2b6ab2;return compose()[_0x39dc('0xf')](function(_0xf5ab99,_0x586c07,_0x5ada9e){return db[_0x39dc('0x10')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x39dc('0x11')](function(_0x237b31){var _0xe0d93d=getValueFromLicense(_0x40abe2,_0x237b31);return _0xe0d93d?_0xe0d93d:_0x23ee0b;})[_0x39dc('0x11')](function(_0x1376d1){_0x23ee0b=_0x1376d1;return _0xf2b083[_0x39dc('0x12')](_0x104433);})[_0x39dc('0x11')](function(_0x93d8f5){if(_0x93d8f5>=_0x23ee0b){return _0x586c07[_0x39dc('0x13')](0x193)[_0x39dc('0x14')]({'message':util[_0x39dc('0x8')](_0x39dc('0x15'),_0x40abe2)});}_0x5ada9e();})[_0x39dc('0x16')](function(_0x19e624){_0x5ada9e(_0x19e624);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x39dc('0x17')],{'where':{'$or':[{'role':_0x39dc('0x18')},{'role':'user'}]}});}exports[_0x39dc('0x19')]=isUserLimit; \ No newline at end of file +var _0xf255=['base64','final','hasOwnProperty','use','License','findOne','then','count','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','user','crypto','composable-middleware','../../mysqldb','../../config/environment','license','data1','split','createDecipher','aes-256-ctr','update'];(function(_0x431ff8,_0x4085dd){var _0x84ccd4=function(_0x1fd1b5){while(--_0x1fd1b5){_0x431ff8['push'](_0x431ff8['shift']());}};_0x84ccd4(++_0x4085dd);}(_0xf255,0xce));var _0x5f25=function(_0x78a2ff,_0x628fae){_0x78a2ff=_0x78a2ff-0x0;var _0x45d11f=_0xf255[_0x78a2ff];return _0x45d11f;};'use strict';var crypto=require(_0x5f25('0x0'));var util=require('util');var compose=require(_0x5f25('0x1'));var db=require(_0x5f25('0x2'))['db'];var config=require(_0x5f25('0x3'));function getValueFromLicense(_0x4c5c6c,_0x2b11f5){if(_0x4c5c6c&&_0x2b11f5){if(_0x2b11f5['data1']&&_0x2b11f5[_0x5f25('0x4')]){var _0x3c3694=_0x2b11f5[_0x5f25('0x5')];var _0x1835c7=_0x2b11f5[_0x5f25('0x4')];var _0x1d8195=_0x3c3694[_0x5f25('0x6')]('-')[0x4];var _0x35e1a2=_0x3c3694[_0x5f25('0x6')]('-')[0x0];var _0x52ed21=crypto[_0x5f25('0x7')](_0x5f25('0x8'),util['format']('%s:%s:%s',_0x1d8195,_0x3c3694,_0x35e1a2));var _0x5ad135=_0x52ed21[_0x5f25('0x9')](_0x1835c7,_0x5f25('0xa'),'utf8');_0x5ad135+=_0x52ed21[_0x5f25('0xb')]('utf8');var _0x3268c6=JSON['parse'](_0x5ad135);return _0x3268c6[_0x5f25('0xc')](_0x4c5c6c)?_0x3268c6[_0x4c5c6c]:null;}}return null;}function isLimit(_0x70c4fa,_0x241542,_0x1c8246,_0x4bcadc){var _0xa8311b=_0x241542;return compose()[_0x5f25('0xd')](function(_0x369a50,_0x66f3c5,_0x22225f){return db[_0x5f25('0xe')][_0x5f25('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x5f25('0x10')](function(_0x3e5666){var _0xf352a2=getValueFromLicense(_0x70c4fa,_0x3e5666);return _0xf352a2?_0xf352a2:_0xa8311b;})[_0x5f25('0x10')](function(_0x148578){_0xa8311b=_0x148578;return _0x1c8246[_0x5f25('0x11')](_0x4bcadc);})[_0x5f25('0x10')](function(_0x54f4dc){if(_0x54f4dc>=_0xa8311b){return _0x66f3c5[_0x5f25('0x12')](0x193)['json']({'message':util['format'](_0x5f25('0x13'),_0x70c4fa)});}_0x22225f();})[_0x5f25('0x14')](function(_0x26b023){_0x22225f(_0x26b023);});});}function isUserLimit(){return isLimit(_0x5f25('0x15'),0x1,db[_0x5f25('0x16')],{'where':{'$or':[{'role':'admin'},{'role':_0x5f25('0x17')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 00fd031..6cce492 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 _0xade5=['push','buildExpression','$eq','operator','$between','value','includes','$gt','days','YYYY-MM-DD','castTo','text','\x20AS\x20','field','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','$in','start','pop','DATE','format','utcOffset','add','minutes','seconds','lodash','parseSearch','startsWith','[$or]','[$and]','split','length','slice','forEach','shift','match','filter','map','conditions'];(function(_0x447680,_0x374678){var _0x1e502d=function(_0x392119){while(--_0x392119){_0x447680['push'](_0x447680['shift']());}};_0x1e502d(++_0x374678);}(_0xade5,0x1a2));var _0x5ade=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xade5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5ade('0x0'));var moment=require('moment');exports[_0x5ade('0x1')]=function(_0x2f15e1){var _0x52938d={'conditions':[]};_0x52938d['sqlOperator']=_[_0x5ade('0x2')](_0x2f15e1,_0x5ade('0x3'))?'or':'and';var _0x2596d1=_0x2f15e1['replace'](_0x5ade('0x4'),'')['replace'](_0x5ade('0x3'),'')[_0x5ade('0x5')]('||');for(var _0x2ae487=0x0;_0x2ae487<_0x2596d1[_0x5ade('0x6')];_0x2ae487++){var _0x1429ce=_0x2596d1[_0x2ae487][_0x5ade('0x5')](':=');var _0x41c4ae=_0x1429ce[0x0];var _0x17edf5=_0x1429ce[_0x5ade('0x7')](0x1);_0x17edf5[_0x5ade('0x8')](function(_0x4ab064){var _0x58f271=_0x4ab064[_0x5ade('0x5')]('[')[_0x5ade('0x9')]();var _0x4e49d2=_0x4ab064[_0x5ade('0xa')](/\[(.*?)\]/g);_0x4e49d2[_0x5ade('0x8')](function(_0x123b53){var _0x4d7986=_0x123b53[_0x5ade('0x5')]('[')[_0x5ade('0xb')](function(_0x4aaa00){return _0x4aaa00['indexOf'](']')>-0x1;})[_0x5ade('0xc')](function(_0x452ebd){return _0x452ebd[_0x5ade('0x5')](']')[0x0];})[0x0];_0x52938d[_0x5ade('0xd')][_0x5ade('0xe')]({'field':_0x41c4ae,'operator':_0x58f271,'value':_0x4d7986});});});}return _0x52938d;};exports[_0x5ade('0xf')]=function(_0x4428c4,_0x5ae5be,_0x137cde){var _0x312ab5={};if(_0x5ae5be==='DATE'){if(_0x137cde['operator']===_0x5ade('0x10')){_0x137cde[_0x5ade('0x11')]=_0x5ade('0x12');_0x137cde['value']+=','+_0x137cde[_0x5ade('0x13')];}else if(_[_0x5ade('0x14')]([_0x5ade('0x15'),'$lte'],_0x137cde[_0x5ade('0x11')])){_0x137cde['value']=moment(_0x137cde[_0x5ade('0x13')])['add'](0x1,_0x5ade('0x16'))['format'](_0x5ade('0x17'));}}if(_0x137cde[_0x5ade('0x18')]){_0x5ae5be=_0x137cde[_0x5ade('0x18')];_0x312ab5[_0x5ade('0x19')]='CAST('+_0x4428c4+'.'+_0x137cde['field']+_0x5ade('0x1a')+_0x137cde[_0x5ade('0x18')]+')\x20'+parseOperator(_0x137cde[_0x5ade('0x11')]);}else{_0x312ab5[_0x5ade('0x19')]=_0x4428c4+'.'+_0x137cde[_0x5ade('0x1b')]+'\x20'+parseOperator(_0x137cde[_0x5ade('0x11')]);}if(_[_0x5ade('0x14')]([_0x5ade('0x1c'),_0x5ade('0x1d')],_0x137cde[_0x5ade('0x11')]))_0x312ab5[_0x5ade('0x19')]='('+_0x312ab5[_0x5ade('0x19')]+_0x5ade('0x1e')+_0x4428c4+'.'+_0x137cde[_0x5ade('0x1b')]+_0x5ade('0x1f');_0x312ab5[_0x5ade('0x13')]=parseValue(_0x5ae5be,_0x137cde[_0x5ade('0x11')],_0x137cde[_0x5ade('0x13')]);return _0x312ab5;};function parseOperator(_0x5d02ec){var _0x5eaeb4;switch(_0x5d02ec){case'$in':_0x5eaeb4='IN\x20?';break;case _0x5ade('0x1d'):_0x5eaeb4=_0x5ade('0x20');break;case _0x5ade('0x10'):_0x5eaeb4=_0x5ade('0x21');break;case _0x5ade('0x1c'):_0x5eaeb4=_0x5ade('0x22');break;case _0x5ade('0x23'):case _0x5ade('0x24'):case _0x5ade('0x25'):_0x5eaeb4=_0x5ade('0x26');break;case _0x5ade('0x27'):_0x5eaeb4=_0x5ade('0x28');break;case'$gt':_0x5eaeb4='>\x20?';break;case'$lte':_0x5eaeb4=_0x5ade('0x29');break;case _0x5ade('0x2a'):_0x5eaeb4=_0x5ade('0x2b');break;case'$between':_0x5eaeb4=_0x5ade('0x2c');break;}return _0x5eaeb4;}function parseValue(_0x21c307,_0x466ec3,_0x1f87e0){var _0x3589c5={'start':undefined,'end':undefined};switch(_0x466ec3){case _0x5ade('0x2d'):case _0x5ade('0x1d'):_0x3589c5[_0x5ade('0x2e')]=_0x1f87e0[_0x5ade('0x5')](',');break;case _0x5ade('0x23'):_0x3589c5[_0x5ade('0x2e')]='%'+_0x1f87e0+'%';break;case _0x5ade('0x24'):_0x3589c5[_0x5ade('0x2e')]=_0x1f87e0+'%';break;case _0x5ade('0x25'):_0x3589c5['start']='%'+_0x1f87e0;break;case _0x5ade('0x12'):var _0xe69ccd=_0x1f87e0[_0x5ade('0x5')](',');var _0x1f87e0=_0xe69ccd['shift']();var _0x5c7ca9=_0xe69ccd[_0x5ade('0x2f')]();if(_0x21c307===_0x5ade('0x30')){_0x1f87e0=moment(_0x1f87e0)['utcOffset'](0x0,!![])[_0x5ade('0x31')]();_0x5c7ca9=moment(_0x5c7ca9)[_0x5ade('0x32')](0x0,!![])['add'](0x17,'hours')[_0x5ade('0x33')](0x3b,_0x5ade('0x34'))[_0x5ade('0x33')](0x3b,_0x5ade('0x35'))[_0x5ade('0x31')]();}_0x3589c5={'start':_0x1f87e0,'end':_0x5c7ca9};break;default:_0x3589c5[_0x5ade('0x2e')]=_0x1f87e0;break;}return _0x3589c5;} \ No newline at end of file +var _0xdccd=['operator','$between','value','$gt','days','format','YYYY-MM-DD','castTo','CAST(','field','\x20AS\x20','text','includes','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','$eq','<>\x20?','$substring','$startsWith','$endsWith','>\x20?','$lte','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','add','hours','minutes','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','forEach','shift','match','indexOf','map','conditions','push','buildExpression','DATE'];(function(_0x355a3c,_0x2d7545){var _0x124116=function(_0x801960){while(--_0x801960){_0x355a3c['push'](_0x355a3c['shift']());}};_0x124116(++_0x2d7545);}(_0xdccd,0x109));var _0xddcc=function(_0x4685ec,_0x1d5bd7){_0x4685ec=_0x4685ec-0x0;var _0x517440=_0xdccd[_0x4685ec];return _0x517440;};'use strict';var _=require(_0xddcc('0x0'));var moment=require(_0xddcc('0x1'));exports[_0xddcc('0x2')]=function(_0xc2149){var _0x5611e8={'conditions':[]};_0x5611e8[_0xddcc('0x3')]=_[_0xddcc('0x4')](_0xc2149,_0xddcc('0x5'))?'or':_0xddcc('0x6');var _0x11718d=_0xc2149[_0xddcc('0x7')](_0xddcc('0x8'),'')[_0xddcc('0x7')](_0xddcc('0x5'),'')[_0xddcc('0x9')]('||');for(var _0x4d0b36=0x0;_0x4d0b36<_0x11718d[_0xddcc('0xa')];_0x4d0b36++){var _0x102d55=_0x11718d[_0x4d0b36]['split'](':=');var _0x363942=_0x102d55[0x0];var _0x3f6f71=_0x102d55['slice'](0x1);_0x3f6f71[_0xddcc('0xb')](function(_0x31af80){var _0xe1afb5=_0x31af80['split']('[')[_0xddcc('0xc')]();var _0x2a34ae=_0x31af80[_0xddcc('0xd')](/\[(.*?)\]/g);_0x2a34ae[_0xddcc('0xb')](function(_0xd52ac1){var _0x1bca62=_0xd52ac1[_0xddcc('0x9')]('[')['filter'](function(_0x4ff38d){return _0x4ff38d[_0xddcc('0xe')](']')>-0x1;})[_0xddcc('0xf')](function(_0xacd62d){return _0xacd62d['split'](']')[0x0];})[0x0];_0x5611e8[_0xddcc('0x10')][_0xddcc('0x11')]({'field':_0x363942,'operator':_0xe1afb5,'value':_0x1bca62});});});}return _0x5611e8;};exports[_0xddcc('0x12')]=function(_0x562483,_0x2e30cb,_0x1de3e8){var _0x3cc1be={};if(_0x2e30cb===_0xddcc('0x13')){if(_0x1de3e8[_0xddcc('0x14')]==='$eq'){_0x1de3e8[_0xddcc('0x14')]=_0xddcc('0x15');_0x1de3e8[_0xddcc('0x16')]+=','+_0x1de3e8[_0xddcc('0x16')];}else if(_['includes']([_0xddcc('0x17'),'$lte'],_0x1de3e8['operator'])){_0x1de3e8[_0xddcc('0x16')]=moment(_0x1de3e8[_0xddcc('0x16')])['add'](0x1,_0xddcc('0x18'))[_0xddcc('0x19')](_0xddcc('0x1a'));}}if(_0x1de3e8[_0xddcc('0x1b')]){_0x2e30cb=_0x1de3e8[_0xddcc('0x1b')];_0x3cc1be['text']=_0xddcc('0x1c')+_0x562483+'.'+_0x1de3e8[_0xddcc('0x1d')]+_0xddcc('0x1e')+_0x1de3e8[_0xddcc('0x1b')]+')\x20'+parseOperator(_0x1de3e8[_0xddcc('0x14')]);}else{_0x3cc1be[_0xddcc('0x1f')]=_0x562483+'.'+_0x1de3e8[_0xddcc('0x1d')]+'\x20'+parseOperator(_0x1de3e8['operator']);}if(_[_0xddcc('0x20')]([_0xddcc('0x21'),_0xddcc('0x22')],_0x1de3e8[_0xddcc('0x14')]))_0x3cc1be[_0xddcc('0x1f')]='('+_0x3cc1be[_0xddcc('0x1f')]+_0xddcc('0x23')+_0x562483+'.'+_0x1de3e8[_0xddcc('0x1d')]+_0xddcc('0x24');_0x3cc1be['value']=parseValue(_0x2e30cb,_0x1de3e8[_0xddcc('0x14')],_0x1de3e8['value']);return _0x3cc1be;};function parseOperator(_0x6286c7){var _0x439241;switch(_0x6286c7){case _0xddcc('0x25'):_0x439241=_0xddcc('0x26');break;case _0xddcc('0x22'):_0x439241=_0xddcc('0x27');break;case _0xddcc('0x28'):_0x439241='=\x20?';break;case'$ne':_0x439241=_0xddcc('0x29');break;case _0xddcc('0x2a'):case _0xddcc('0x2b'):case _0xddcc('0x2c'):_0x439241='LIKE\x20?';break;case'$lt':_0x439241='<\x20?';break;case _0xddcc('0x17'):_0x439241=_0xddcc('0x2d');break;case _0xddcc('0x2e'):_0x439241=_0xddcc('0x2f');break;case _0xddcc('0x30'):_0x439241=_0xddcc('0x31');break;case _0xddcc('0x15'):_0x439241=_0xddcc('0x32');break;}return _0x439241;}function parseValue(_0x4e52e0,_0x32d52c,_0x4590f4){var _0x45f2a3={'start':undefined,'end':undefined};switch(_0x32d52c){case _0xddcc('0x25'):case _0xddcc('0x22'):_0x45f2a3[_0xddcc('0x33')]=_0x4590f4['split'](',');break;case _0xddcc('0x2a'):_0x45f2a3['start']='%'+_0x4590f4+'%';break;case'$startsWith':_0x45f2a3[_0xddcc('0x33')]=_0x4590f4+'%';break;case _0xddcc('0x2c'):_0x45f2a3[_0xddcc('0x33')]='%'+_0x4590f4;break;case _0xddcc('0x15'):var _0x6cdd74=_0x4590f4[_0xddcc('0x9')](',');var _0x4590f4=_0x6cdd74['shift']();var _0x28e71c=_0x6cdd74[_0xddcc('0x34')]();if(_0x4e52e0===_0xddcc('0x13')){_0x4590f4=moment(_0x4590f4)[_0xddcc('0x35')](0x0,!![])['format']();_0x28e71c=moment(_0x28e71c)[_0xddcc('0x35')](0x0,!![])[_0xddcc('0x36')](0x17,_0xddcc('0x37'))[_0xddcc('0x36')](0x3b,_0xddcc('0x38'))[_0xddcc('0x36')](0x3b,'seconds')['format']();}_0x45f2a3={'start':_0x4590f4,'end':_0x28e71c};break;default:_0x45f2a3[_0xddcc('0x33')]=_0x4590f4;break;}return _0x45f2a3;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 4f24515..2471909 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 _0x6fb0=['format','YYYY-MM-DD','utc','subtract','name','uniqueid','isArray','limit','offset','sort','map','priority','cast','col','unsigned','omit','isEmpty','length','isObject','isString','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','getFullTextValue','\x22{EXPR}\x22','{EXPR}','forEach','join','query','$id','model','filters','intersection','attributes','nolimit','order','where','pick','filter','object','columns','value','merge','VIRTUAL','lower','lodash','sequelize','moment','includes','parse','keys','fields','split','forOwn','find','type','DATE','isPlainObject','$gte'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6fb0,0x6a));var _0x06fb=function(_0x20c46b,_0x1c7796){_0x20c46b=_0x20c46b-0x0;var _0x48acce=_0x6fb0[_0x20c46b];return _0x48acce;};'use strict';var _=require(_0x06fb('0x0'));var sequelize=require(_0x06fb('0x1'));var moment=require(_0x06fb('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x220a73){var _0x461293=['ne'];try{var _0x2724e4=JSON['parse'](_0x220a73);var _0x50ab05=Object['keys'](_0x2724e4)[0x0];return _0x461293[_0x06fb('0x3')](_0x50ab05);}catch(_0x3d76f3){return![];}}function getOperatorValue(_0x37d1d0){var _0x50dd60=JSON[_0x06fb('0x4')](_0x37d1d0);var _0x5c0bad=Object[_0x06fb('0x5')](_0x50dd60)[0x0];var _0x5858f5=_0x50dd60[_0x5c0bad];return{['$'+_0x5c0bad]:_0x5858f5};}exports[_0x06fb('0x6')]=function(_0x17e886){var _0x5de8d7=null;if(_0x17e886){_0x5de8d7=_0x17e886[_0x06fb('0x7')](',');}return _0x5de8d7;};exports['filters']=function(_0xd961b7,_0x39c5cd){var _0x1266d5={};if(!_['isEmpty'](_0xd961b7)){_[_0x06fb('0x8')](_0xd961b7,function(_0x1ba7e1,_0x35c473){try{if(_0x39c5cd){var _0x565792=_[_0x06fb('0x9')](_0x39c5cd,{'name':_0x35c473})||{};if(hasSequelizeOperator(_0x1ba7e1)){_0x1266d5[_0x35c473]=getOperatorValue(_0x1ba7e1);}else if(_0x565792[_0x06fb('0xa')]===_0x06fb('0xb')&&_[_0x06fb('0xc')](_0x1ba7e1)){var _0x5a2a32=JSON[_0x06fb('0x4')](_0x1ba7e1);var _0x4ab26c={'$gte':moment(moment(_0x5a2a32[_0x06fb('0xd')])[_0x06fb('0xe')](_0x06fb('0xf')))[_0x06fb('0x10')]()[_0x06fb('0xe')](),'$lte':moment(moment(_0x5a2a32['$lte'])[_0x06fb('0xe')](_0x06fb('0xf')))[_0x06fb('0x10')]()[_0x06fb('0x11')](0x1,'s')[_0x06fb('0xe')]()};_0x1266d5[_0x35c473]=_0x4ab26c;}else if(_0x565792[_0x06fb('0x12')]===_0x06fb('0x13')){_0x1266d5[_0x35c473]=_0x1ba7e1;}else{_0x1266d5[_0x35c473]=_[_0x06fb('0x14')](_0x1ba7e1)?_0x1ba7e1:JSON['parse'](_0x1ba7e1);}}else{_0x1266d5[_0x35c473]=_[_0x06fb('0x14')](_0x1ba7e1)?_0x1ba7e1:JSON['parse'](_0x1ba7e1);}}catch(_0x1f5f0d){_0x1266d5[_0x35c473]=_0x1ba7e1[_0x06fb('0x7')](',');}});}return _0x1266d5;};exports[_0x06fb('0x15')]=function(_0xc3d8d5){_0xc3d8d5=parseInt(_0xc3d8d5,0xa);if(!_0xc3d8d5||_0xc3d8d5<0x0){_0xc3d8d5=LIMIT_VALUE;}return _0xc3d8d5;};exports[_0x06fb('0x16')]=function(_0x4a634b){_0x4a634b=parseInt(_0x4a634b,0xa);if(!_0x4a634b||_0x4a634b<0x0){_0x4a634b=0x0;}return _0x4a634b;};exports[_0x06fb('0x17')]=function(_0x5337f7){var _0x472680,_0x4a10ae=null;if(_0x5337f7){_0x472680=_0x5337f7[_0x06fb('0x7')](',');_0x4a10ae=_[_0x06fb('0x18')](_0x472680,function(_0xcdd89b){if(_0xcdd89b['indexOf']('-')===0x0){return[_0xcdd89b===_0x06fb('0x19')?sequelize[_0x06fb('0x1a')](sequelize[_0x06fb('0x1b')](_0x06fb('0x19')),_0x06fb('0x1c')):_0xcdd89b['substr'](0x1),'DESC'];}else{return[_0xcdd89b===_0x06fb('0x19')?sequelize[_0x06fb('0x1a')](sequelize[_0x06fb('0x1b')](_0x06fb('0x19')),_0x06fb('0x1c')):_0xcdd89b,'ASC'];}});}return _0x4a10ae;};exports[_0x06fb('0x1d')]=function(_0x25d1da,_0x1c128d){if(_[_0x06fb('0x1e')](_0x25d1da)){return _0x25d1da;}if(_[_0x06fb('0x14')](_0x25d1da)){for(var _0x330457=0x0;_0x330457<_0x25d1da[_0x06fb('0x1f')];_0x330457+=0x1){_0x25d1da[_0x330457]=this[_0x06fb('0x1d')](_0x25d1da[_0x330457],_0x1c128d);}return _0x25d1da;}if(!_[_0x06fb('0x20')](_0x25d1da)){return _0x25d1da;}if(_[_0x06fb('0x21')](_0x1c128d)){_0x1c128d=[_0x1c128d];}if(!_[_0x06fb('0x14')](_0x1c128d)){return _0x25d1da;}for(var _0x542aa0=0x0;_0x542aa0<_0x1c128d[_0x06fb('0x1f')];_0x542aa0+=0x1){_['unset'](_0x25d1da,_0x1c128d[_0x542aa0]);}for(var _0x3ac2d8 in _0x25d1da){if(_0x25d1da[_0x06fb('0x22')](_0x3ac2d8)){_0x25d1da[_0x3ac2d8]=this[_0x06fb('0x1d')](_0x25d1da[_0x3ac2d8],_0x1c128d);}}return _0x25d1da;};exports[_0x06fb('0x23')]=function(_0x5d3ec3){return _0x5d3ec3[_0x06fb('0x24')](RegExp(_0x06fb('0x25')))?!![]:![];};exports['isEmail']=function(_0x43e151){return _0x43e151[_0x06fb('0x24')](/^\S+@\S+$/)?!![]:![];};exports[_0x06fb('0x26')]=function(_0x1fe6f4,_0x4dd531){var _0x5343ee=[];var _0x1c47b4=/[ `!@#$%^&*()_\-?~]/;var _0x2f51e4=_0x4dd531?_0x06fb('0x27'):_0x06fb('0x28');_0x1fe6f4[_0x06fb('0x7')](/[ ,]+/)[_0x06fb('0x29')](function(_0x3ed2b8){_0x3ed2b8=_0x3ed2b8['replace'](/([^:]")"+/g,'$1');_0x3ed2b8='+'+_0x3ed2b8+'*';var _0x2b2a60=_0x3ed2b8['match'](_0x1c47b4);if(_0x2b2a60){_0x3ed2b8='\x22'+_0x3ed2b8+'\x22';}_0x5343ee['push'](_0x3ed2b8);});_0x2f51e4=_0x2f51e4['replace'](_0x06fb('0x28'),_0x5343ee[_0x06fb('0x2a')]('\x20'));return _0x2f51e4;};exports['getOptions']=function(_0x1d3371,_0x111794,_0x5b12dc){var _0x5c15dc={},_0x17b506={};if(_0x111794[_0x06fb('0x2b')][_0x06fb('0x2c')]){_0x111794[_0x06fb('0x2b')]['id']=_0x111794['query']['$id'];delete _0x111794[_0x06fb('0x2b')][_0x06fb('0x2c')];}_0x5c15dc[_0x06fb('0x2d')]=_[_0x06fb('0x18')](_0x1d3371,_0x06fb('0x12'));_0x5c15dc[_0x06fb('0x2b')]=_[_0x06fb('0x5')](_0x111794[_0x06fb('0x2b')]);_0x5c15dc[_0x06fb('0x2e')]=_[_0x06fb('0x2f')](_0x5c15dc[_0x06fb('0x2d')],_0x5c15dc[_0x06fb('0x2b')]);_0x17b506['attributes']=_[_0x06fb('0x2f')](_0x5c15dc[_0x06fb('0x2d')],this[_0x06fb('0x6')](_0x111794[_0x06fb('0x2b')][_0x06fb('0x6')]));_0x17b506[_0x06fb('0x30')]=_0x17b506[_0x06fb('0x30')]['length']?_0x17b506['attributes']:_0x5c15dc[_0x06fb('0x2d')];if(!_0x111794['query'][_0x06fb('0x22')](_0x06fb('0x31'))){_0x17b506[_0x06fb('0x15')]=this[_0x06fb('0x15')](_0x111794[_0x06fb('0x2b')][_0x06fb('0x15')]);_0x17b506[_0x06fb('0x16')]=this['offset'](_0x111794['query']['offset']);}_0x17b506[_0x06fb('0x32')]=this['sort'](_0x111794['query'][_0x06fb('0x17')]);_0x17b506[_0x06fb('0x33')]=this[_0x06fb('0x2e')](_[_0x06fb('0x34')](_0x111794[_0x06fb('0x2b')],_0x5c15dc['filters']),_0x1d3371);if(_0x111794[_0x06fb('0x2b')][_0x06fb('0x35')]){var _0x4f4887=_0x1d3371;var _0x3c5550=_0x111794[_0x06fb('0x2b')][_0x06fb('0x35')];if(typeof _0x3c5550===_0x06fb('0x36')){_0x4f4887=_[_0x06fb('0x35')](_0x1d3371,function(_0x564774){return _[_0x06fb('0x3')](_0x3c5550[_0x06fb('0x37')],_0x564774['name']);});_0x3c5550=_0x3c5550[_0x06fb('0x38')];}_0x17b506[_0x06fb('0x33')]=_[_0x06fb('0x39')](_0x17b506[_0x06fb('0x33')],{'$or':_[_0x06fb('0x18')](_0x4f4887,function(_0x5797ff){if(_0x5797ff[_0x06fb('0xa')]!==_0x06fb('0x3a')){if(_0x5b12dc){return sequelize[_0x06fb('0x33')](sequelize['fn']('lower',sequelize['col'](_0x5797ff[_0x06fb('0x12')])),{'$like':sequelize['fn'](_0x06fb('0x3b'),'%'+_0x111794['query'][_0x06fb('0x35')]+'%')});}else{var _0x4cd27f={};_0x4cd27f[_0x5797ff[_0x06fb('0x12')]]={'$like':'%'+_0x111794[_0x06fb('0x2b')][_0x06fb('0x35')]+'%'};return _0x4cd27f;}}})});}_0x17b506=_['merge']({},_0x17b506,_0x111794['options']);return _0x17b506;}; \ No newline at end of file +var _0xdf00=['value','lower','merge','sequelize','moment','includes','fields','split','filters','isEmpty','forOwn','find','type','DATE','parse','$gte','YYYY-MM-DD','utc','format','subtract','name','uniqueid','limit','sort','map','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','omit','isArray','isObject','isString','length','hasOwnProperty','isNumeric','^[+]?[0-9]*$','isEmail','match','getFullTextValue','{EXPR}','forEach','push','replace','join','getOptions','$id','query','model','intersection','attributes','nolimit','offset','order','where','pick','filter','object','columns'];(function(_0x4ded65,_0xc8d7c1){var _0x5864fb=function(_0x40df9d){while(--_0x40df9d){_0x4ded65['push'](_0x4ded65['shift']());}};_0x5864fb(++_0xc8d7c1);}(_0xdf00,0x1bc));var _0x0df0=function(_0x333c99,_0x5b4997){_0x333c99=_0x333c99-0x0;var _0x43e52a=_0xdf00[_0x333c99];return _0x43e52a;};'use strict';var _=require('lodash');var sequelize=require(_0x0df0('0x0'));var moment=require(_0x0df0('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x48db6b){var _0x297ce=['ne'];try{var _0x30b964=JSON['parse'](_0x48db6b);var _0x10cdd8=Object['keys'](_0x30b964)[0x0];return _0x297ce[_0x0df0('0x2')](_0x10cdd8);}catch(_0x4144a2){return![];}}function getOperatorValue(_0x85c4){var _0x337ab8=JSON['parse'](_0x85c4);var _0x5438b9=Object['keys'](_0x337ab8)[0x0];var _0xb13617=_0x337ab8[_0x5438b9];return{['$'+_0x5438b9]:_0xb13617};}exports[_0x0df0('0x3')]=function(_0x276047){var _0x18ebf5=null;if(_0x276047){_0x18ebf5=_0x276047[_0x0df0('0x4')](',');}return _0x18ebf5;};exports[_0x0df0('0x5')]=function(_0x1bedc0,_0xa01b9d){var _0x474c61={};if(!_[_0x0df0('0x6')](_0x1bedc0)){_[_0x0df0('0x7')](_0x1bedc0,function(_0x5a90d6,_0x3719d1){try{if(_0xa01b9d){var _0x1bb439=_[_0x0df0('0x8')](_0xa01b9d,{'name':_0x3719d1})||{};if(hasSequelizeOperator(_0x5a90d6)){_0x474c61[_0x3719d1]=getOperatorValue(_0x5a90d6);}else if(_0x1bb439[_0x0df0('0x9')]===_0x0df0('0xa')&&_['isPlainObject'](_0x5a90d6)){var _0x2006b4=JSON[_0x0df0('0xb')](_0x5a90d6);var _0x1681e9={'$gte':moment(moment(_0x2006b4[_0x0df0('0xc')])['format'](_0x0df0('0xd')))[_0x0df0('0xe')]()[_0x0df0('0xf')](),'$lte':moment(moment(_0x2006b4['$lte'])[_0x0df0('0xf')]('YYYY-MM-DD'))[_0x0df0('0xe')]()[_0x0df0('0x10')](0x1,'s')[_0x0df0('0xf')]()};_0x474c61[_0x3719d1]=_0x1681e9;}else if(_0x1bb439[_0x0df0('0x11')]===_0x0df0('0x12')){_0x474c61[_0x3719d1]=_0x5a90d6;}else{_0x474c61[_0x3719d1]=_['isArray'](_0x5a90d6)?_0x5a90d6:JSON['parse'](_0x5a90d6);}}else{_0x474c61[_0x3719d1]=_['isArray'](_0x5a90d6)?_0x5a90d6:JSON[_0x0df0('0xb')](_0x5a90d6);}}catch(_0x427823){_0x474c61[_0x3719d1]=_0x5a90d6[_0x0df0('0x4')](',');}});}return _0x474c61;};exports[_0x0df0('0x13')]=function(_0x2c7dd6){_0x2c7dd6=parseInt(_0x2c7dd6,0xa);if(!_0x2c7dd6||_0x2c7dd6<0x0){_0x2c7dd6=LIMIT_VALUE;}return _0x2c7dd6;};exports['offset']=function(_0x447b6f){_0x447b6f=parseInt(_0x447b6f,0xa);if(!_0x447b6f||_0x447b6f<0x0){_0x447b6f=0x0;}return _0x447b6f;};exports[_0x0df0('0x14')]=function(_0x1ae401){var _0x464e1e,_0x551170=null;if(_0x1ae401){_0x464e1e=_0x1ae401[_0x0df0('0x4')](',');_0x551170=_[_0x0df0('0x15')](_0x464e1e,function(_0x5b40d5){if(_0x5b40d5[_0x0df0('0x16')]('-')===0x0){return[_0x5b40d5===_0x0df0('0x17')?sequelize[_0x0df0('0x18')](sequelize[_0x0df0('0x19')]('priority'),_0x0df0('0x1a')):_0x5b40d5[_0x0df0('0x1b')](0x1),_0x0df0('0x1c')];}else{return[_0x5b40d5===_0x0df0('0x17')?sequelize[_0x0df0('0x18')](sequelize[_0x0df0('0x19')]('priority'),_0x0df0('0x1a')):_0x5b40d5,_0x0df0('0x1d')];}});}return _0x551170;};exports[_0x0df0('0x1e')]=function(_0x808f26,_0x61d4d5){if(_[_0x0df0('0x6')](_0x808f26)){return _0x808f26;}if(_[_0x0df0('0x1f')](_0x808f26)){for(var _0x3607b5=0x0;_0x3607b5<_0x808f26['length'];_0x3607b5+=0x1){_0x808f26[_0x3607b5]=this[_0x0df0('0x1e')](_0x808f26[_0x3607b5],_0x61d4d5);}return _0x808f26;}if(!_[_0x0df0('0x20')](_0x808f26)){return _0x808f26;}if(_[_0x0df0('0x21')](_0x61d4d5)){_0x61d4d5=[_0x61d4d5];}if(!_[_0x0df0('0x1f')](_0x61d4d5)){return _0x808f26;}for(var _0x17e2da=0x0;_0x17e2da<_0x61d4d5[_0x0df0('0x22')];_0x17e2da+=0x1){_['unset'](_0x808f26,_0x61d4d5[_0x17e2da]);}for(var _0x3ba898 in _0x808f26){if(_0x808f26[_0x0df0('0x23')](_0x3ba898)){_0x808f26[_0x3ba898]=this[_0x0df0('0x1e')](_0x808f26[_0x3ba898],_0x61d4d5);}}return _0x808f26;};exports[_0x0df0('0x24')]=function(_0x4d5ef0){return _0x4d5ef0['match'](RegExp(_0x0df0('0x25')))?!![]:![];};exports[_0x0df0('0x26')]=function(_0x4e1512){return _0x4e1512[_0x0df0('0x27')](/^\S+@\S+$/)?!![]:![];};exports[_0x0df0('0x28')]=function(_0xca6889,_0x3b797d){var _0x821b9d=[];var _0x37fa33=/[ `!@#$%^&*()_\-?~]/;var _0x40998e=_0x3b797d?'\x22{EXPR}\x22':_0x0df0('0x29');_0xca6889[_0x0df0('0x4')](/[ ,]+/)[_0x0df0('0x2a')](function(_0x2b8e8d){_0x2b8e8d=_0x2b8e8d['replace'](/([^:]")"+/g,'$1');_0x2b8e8d='+'+_0x2b8e8d+'*';var _0x46ae91=_0x2b8e8d[_0x0df0('0x27')](_0x37fa33);if(_0x46ae91){_0x2b8e8d='\x22'+_0x2b8e8d+'\x22';}_0x821b9d[_0x0df0('0x2b')](_0x2b8e8d);});_0x40998e=_0x40998e[_0x0df0('0x2c')](_0x0df0('0x29'),_0x821b9d[_0x0df0('0x2d')]('\x20'));return _0x40998e;};exports[_0x0df0('0x2e')]=function(_0x1c5415,_0xf0a5f5,_0x5b5b8e){var _0xf6ea4f={},_0x42ed72={};if(_0xf0a5f5['query'][_0x0df0('0x2f')]){_0xf0a5f5['query']['id']=_0xf0a5f5[_0x0df0('0x30')]['$id'];delete _0xf0a5f5['query'][_0x0df0('0x2f')];}_0xf6ea4f[_0x0df0('0x31')]=_['map'](_0x1c5415,_0x0df0('0x11'));_0xf6ea4f['query']=_['keys'](_0xf0a5f5['query']);_0xf6ea4f['filters']=_[_0x0df0('0x32')](_0xf6ea4f[_0x0df0('0x31')],_0xf6ea4f[_0x0df0('0x30')]);_0x42ed72[_0x0df0('0x33')]=_[_0x0df0('0x32')](_0xf6ea4f['model'],this['fields'](_0xf0a5f5['query'][_0x0df0('0x3')]));_0x42ed72[_0x0df0('0x33')]=_0x42ed72[_0x0df0('0x33')][_0x0df0('0x22')]?_0x42ed72[_0x0df0('0x33')]:_0xf6ea4f['model'];if(!_0xf0a5f5['query'][_0x0df0('0x23')](_0x0df0('0x34'))){_0x42ed72['limit']=this[_0x0df0('0x13')](_0xf0a5f5[_0x0df0('0x30')]['limit']);_0x42ed72[_0x0df0('0x35')]=this[_0x0df0('0x35')](_0xf0a5f5['query'][_0x0df0('0x35')]);}_0x42ed72[_0x0df0('0x36')]=this[_0x0df0('0x14')](_0xf0a5f5[_0x0df0('0x30')][_0x0df0('0x14')]);_0x42ed72[_0x0df0('0x37')]=this['filters'](_[_0x0df0('0x38')](_0xf0a5f5[_0x0df0('0x30')],_0xf6ea4f['filters']),_0x1c5415);if(_0xf0a5f5['query']['filter']){var _0x5e9907=_0x1c5415;var _0x204984=_0xf0a5f5[_0x0df0('0x30')][_0x0df0('0x39')];if(typeof _0x204984===_0x0df0('0x3a')){_0x5e9907=_[_0x0df0('0x39')](_0x1c5415,function(_0x292e9e){return _[_0x0df0('0x2')](_0x204984[_0x0df0('0x3b')],_0x292e9e[_0x0df0('0x11')]);});_0x204984=_0x204984[_0x0df0('0x3c')];}_0x42ed72[_0x0df0('0x37')]=_['merge'](_0x42ed72[_0x0df0('0x37')],{'$or':_[_0x0df0('0x15')](_0x5e9907,function(_0x9a7dc1){if(_0x9a7dc1[_0x0df0('0x9')]!=='VIRTUAL'){if(_0x5b5b8e){return sequelize[_0x0df0('0x37')](sequelize['fn'](_0x0df0('0x3d'),sequelize[_0x0df0('0x19')](_0x9a7dc1[_0x0df0('0x11')])),{'$like':sequelize['fn'](_0x0df0('0x3d'),'%'+_0xf0a5f5[_0x0df0('0x30')][_0x0df0('0x39')]+'%')});}else{var _0x894163={};_0x894163[_0x9a7dc1[_0x0df0('0x11')]]={'$like':'%'+_0xf0a5f5['query'][_0x0df0('0x39')]+'%'};return _0x894163;}}})});}_0x42ed72=_[_0x0df0('0x3e')]({},_0x42ed72,_0xf0a5f5['options']);return _0x42ed72;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index d50b7ae..dd1a051 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 _0xa8ed=['filter','includes','getAgentIdsByStatus','User','findAll','fullname','smsPause','pauseType','find','merge','globalStatus','getSortedAgentsIdsByStatus','split','order','startsWith','DESC','ASC','getUpdatedSortOptions','internal','substring','indexOf','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','chatPause','openchannelPause','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','openchannelStatus','whatsappStatus','faxStatus','chatStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','omit','pick','value','lodash','jayson/promise','client','http','faxPause','mailPause','whatsappPause','every','length','idle','unknown','ringing','isNil','voiceStatus','voicePause','pause','chatStatus','mailStatus','smsStatus','request','Agents','then','error','result','catch','getRealtimeAgents','*pause','busy','getAgentStatus','isArray','startCase','Queue','map','findOne','getAgents','all','flatten','uniq','getAgentIdsByQueues'];(function(_0x5518c2,_0x1d2870){var _0x40609f=function(_0x566cf0){while(--_0x566cf0){_0x5518c2['push'](_0x5518c2['shift']());}};_0x40609f(++_0x1d2870);}(_0xa8ed,0x1b4));var _0xda8e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa8ed[_0x24237f];return _0x48298e;};'use strict';var _=require(_0xda8e('0x0'));var jayson=require(_0xda8e('0x1'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0xda8e('0x2')][_0xda8e('0x3')]({'port':0x232a});var routingClient=jayson['client'][_0xda8e('0x3')]({'port':0x232c});function isAgentPaused(_0x5a2ace,_0x301d78){var _0x4a29d4=[_0x5a2ace['chatPause'],_0x5a2ace[_0xda8e('0x4')],_0x5a2ace[_0xda8e('0x5')],_0x5a2ace['openchannelPause'],_0x5a2ace['smsPause'],_0x5a2ace['voicePause'],_0x5a2ace[_0xda8e('0x6')]];if(!_0x301d78)return _[_0xda8e('0x7')](_0x4a29d4);var _0x16c695=_['filter'](_0x4a29d4);return _0x16c695['length']>0x0&&_0x16c695[_0xda8e('0x8')]<_0x4a29d4[_0xda8e('0x8')]?!![]:![];}function isIdle(_0x2b17b6){return _0x2b17b6===_0xda8e('0x9')||_0x2b17b6===_0xda8e('0xa')||_0x2b17b6==='unavailable'||_0x2b17b6===_0xda8e('0xb')||_[_0xda8e('0xc')](_0x2b17b6);}function isAgentIdle(_0x456bb4){if(_0x456bb4[_0xda8e('0xd')]!==_0xda8e('0x9')&&_0x456bb4[_0xda8e('0xe')]){_0x456bb4[_0xda8e('0xd')]=_0xda8e('0xf');return![];}return _[_0xda8e('0x7')]([_0x456bb4[_0xda8e('0x10')],_0x456bb4['faxStatus'],_0x456bb4[_0xda8e('0x11')],_0x456bb4['openchannelStatus'],_0x456bb4[_0xda8e('0x12')],_0x456bb4[_0xda8e('0xd')],_0x456bb4['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0xda8e('0x13')](_0xda8e('0x14'),{})[_0xda8e('0x15')](function(_0x2a1371){if(_0x2a1371[_0xda8e('0x16')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0xaea194=_0x2a1371['result'];return routingClient[_0xda8e('0x13')](_0xda8e('0x14'),{})['then'](function(_0x5db753){if(_0x5db753[_0xda8e('0x16')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x75ef45=_0x5db753[_0xda8e('0x17')];return _['merge']({},_0xaea194,_0x75ef45);});})[_0xda8e('0x18')](function(_0x39a99f){throw _0x39a99f;});}exports[_0xda8e('0x19')]=getRealtimeAgents;function getAgentStatus(_0x1ace9c){var _0xa4f9cd=_0xda8e('0xa');if(isAgentPaused(_0x1ace9c))_0xa4f9cd='pause';else if(isAgentPaused(_0x1ace9c,!![]))_0xa4f9cd=_0xda8e('0x1a');else if(isAgentIdle(_0x1ace9c))_0xa4f9cd=_0xda8e('0x9');else _0xa4f9cd=_0xda8e('0x1b');return _0xa4f9cd;}exports[_0xda8e('0x1c')]=getAgentStatus;function getAgentIdsByQueues(_0x15ccab,_0x22fdf5){var _0x14f4d6=_[_0xda8e('0x1d')](_0x15ccab)?_0x15ccab:[_0x15ccab];var _0x1e3c41=_[_0xda8e('0x1e')](_0x22fdf5)+_0xda8e('0x1f');var _0x580ad3=_[_0xda8e('0x20')](_0x14f4d6,function(_0x8f5a09){return db[_0x1e3c41][_0xda8e('0x21')]({'where':{'id':_0x8f5a09}})[_0xda8e('0x15')](function(_0x201e6d){if(!_0x201e6d)return[];return _0x201e6d[_0xda8e('0x22')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xda8e('0x23')](_0x580ad3)[_0xda8e('0x15')](function(_0x1e06ec){var _0x1f309d=_(_0x1e06ec)[_0xda8e('0x24')]()['map']('id')[_0xda8e('0x25')]()['value']();return _0x1f309d;});}exports[_0xda8e('0x26')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x19506b,_0x3d1cc9,_0x1845c5){try{if(_0x3d1cc9[_0xda8e('0x8')]>0x0){_0x19506b=_0x19506b[_0xda8e('0x27')](function(_0x5d6b74){return _0x3d1cc9[_0xda8e('0x28')](_0x5d6b74['id']);});}var _0x13f2b0=_0x19506b['filter'](function(_0x20ec08){var _0x4ec129=_0xda8e('0x1b');if(isAgentIdle(_0x20ec08)){_0x4ec129=_0xda8e('0x9');}return _0x4ec129===_0x1845c5;});return _[_0xda8e('0x20')](_0x13f2b0,'id');}catch(_0x2a0355){throw _0x2a0355;}}exports[_0xda8e('0x29')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x5b3697,_0x4a2939,_0x1f4d43){return Promise['resolve']()['then'](function(){if(_0x4a2939[_0xda8e('0x8')]>0x0){_0x5b3697=_0x5b3697['filter'](function(_0x3b92c3){return _0x4a2939[_0xda8e('0x28')](_0x3b92c3['id']);});}return _0x5b3697;})['then'](function(){return db[_0xda8e('0x2a')][_0xda8e('0x2b')]({'attributes':['id','name',_0xda8e('0x2c'),'chatPause','faxPause',_0xda8e('0x5'),'openchannelPause',_0xda8e('0x2d'),_0xda8e('0xe'),_0xda8e('0x6'),_0xda8e('0x2e')],'where':{'id':{'$in':_[_0xda8e('0x20')](_0x5b3697,'id')}},'raw':!![]});})[_0xda8e('0x15')](function(_0x35eb89){return _0x35eb89[_0xda8e('0x20')](function(_0x3ba978){var _0x4d9006=_[_0xda8e('0x2f')](_0x5b3697,['id',_0x3ba978['id']]);var _0xbccb9c=filterAgentAttributes(_0x4d9006);_[_0xda8e('0x30')](_0x3ba978,_0xbccb9c);_0x3ba978[_0xda8e('0x31')]=getAgentStatus(_0x3ba978);return _0x3ba978;});})[_0xda8e('0x15')](function(_0x539a66){var _0x1800a0=sortAgentsByStatus(_0x539a66,_0x1f4d43);return _[_0xda8e('0x20')](_0x1800a0,'id');})['catch'](function(_0x1a7500){throw _0x1a7500;});}exports[_0xda8e('0x32')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x40f945){var _0x1398a4={'fields':[],'order':null};var _0x446459=_0x40f945[_0xda8e('0x33')](',');_0x1398a4['fields']=_['filter'](_0x446459,function(_0x447774){if(!_0x447774[_0xda8e('0x28')](_0xda8e('0x31'))){return!![];}_0x1398a4[_0xda8e('0x34')]=_[_0xda8e('0x35')](_0x447774,'-')?_0xda8e('0x36'):_0xda8e('0x37');return![];});return _0x1398a4;}exports[_0xda8e('0x38')]=getUpdatedSortOptions;function validateSortParameter(_0x2dd4fa){if(_0x2dd4fa[_0xda8e('0x28')]('fullname')&&!_0x2dd4fa['includes'](_0xda8e('0x39'))){var _0x20d8f0=_0x2dd4fa[_0xda8e('0x3a')](0x0,_0x2dd4fa[_0xda8e('0x3b')](_0xda8e('0x2c')));_0x2dd4fa+=','+_0x20d8f0+_0xda8e('0x39');}return _0x2dd4fa;}exports[_0xda8e('0x3c')]=validateSortParameter;function sortAgentsByStatus(_0x14d140,_0x6e75ca){var _0x2284c3=_0x14d140[_0xda8e('0x3d')](function(_0x11ca98,_0x116498){if(_0x11ca98[_0xda8e('0x31')]===_0x116498[_0xda8e('0x31')]){if(_0x11ca98['globalStatus']===_0xda8e('0xf')){if(_0x6e75ca===_0xda8e('0x36')){return(_0x11ca98[_0xda8e('0x2e')]||'')<(_0x116498[_0xda8e('0x2e')]||'')||_0x11ca98[_0xda8e('0x2c')]['toLowerCase']()>_0x116498[_0xda8e('0x2c')][_0xda8e('0x3e')]()?0x1:-0x1;}else{return(_0x11ca98[_0xda8e('0x2e')]||'')<(_0x116498[_0xda8e('0x2e')]||'')||_0x11ca98[_0xda8e('0x2c')]['toLowerCase']()>_0x116498[_0xda8e('0x2c')][_0xda8e('0x3e')]()?-0x1:0x1;}}else{if(_0x6e75ca===_0xda8e('0x36')){return _0x11ca98[_0xda8e('0x2c')]['toLowerCase']()<_0x116498[_0xda8e('0x2c')][_0xda8e('0x3e')]()?0x1:-0x1;}else{return _0x11ca98[_0xda8e('0x2c')][_0xda8e('0x3e')]()<_0x116498['fullname'][_0xda8e('0x3e')]()?-0x1:0x1;}}}else{if(_0x6e75ca===_0xda8e('0x36')){return _0x11ca98[_0xda8e('0x31')]<_0x116498[_0xda8e('0x31')]?0x1:-0x1;}else{return _0x11ca98[_0xda8e('0x31')]<_0x116498['globalStatus']?-0x1:0x1;}}});return _0x2284c3;}exports[_0xda8e('0x3f')]=sortAgentsByStatus;function filterAgentAttributes(_0x1bdbd3){var _0x5f280f=[_0xda8e('0x40'),_0xda8e('0x41'),_0xda8e('0x42'),'lastPauseAt',_0xda8e('0x2e'),'lastPauseAt','internal','address',_0xda8e('0x43'),_0xda8e('0x44'),_0xda8e('0x5'),_0xda8e('0x2d'),_0xda8e('0x6'),_0xda8e('0x4'),_0xda8e('0xe'),'chatCapacity',_0xda8e('0x45'),_0xda8e('0x46'),_0xda8e('0x47'),_0xda8e('0x48'),_0xda8e('0x49'),'chatCurrentCapacity',_0xda8e('0x4a'),_0xda8e('0x4b'),_0xda8e('0x4c'),_0xda8e('0x4d'),_0xda8e('0x4e'),_0xda8e('0x10'),_0xda8e('0x4f'),_0xda8e('0x11'),'smsStatus',_0xda8e('0x50'),_0xda8e('0x51'),_0xda8e('0xd'),_0xda8e('0x52'),'openchannelStatusTime',_0xda8e('0x53'),_0xda8e('0x54'),_0xda8e('0x55'),'faxStatusTime',_0xda8e('0x56'),_0xda8e('0x57'),_0xda8e('0x58'),_0xda8e('0x59'),_0xda8e('0x5a'),_0xda8e('0x5b'),'routealias'];var _0x42a36d=[_0xda8e('0x43'),_0xda8e('0x44'),_0xda8e('0x5'),_0xda8e('0x2d'),_0xda8e('0x6'),_0xda8e('0x4'),_0xda8e('0xe'),_0xda8e('0x41')];var _0x2889bb=_(_0x1bdbd3)[_0xda8e('0x5c')](_0x42a36d)[_0xda8e('0x5d')](_0x5f280f)[_0xda8e('0x5e')]();return _0x2889bb;}exports['filterAgentAttributes']=filterAgentAttributes; \ No newline at end of file +var _0x0526=['internal','substring','indexOf','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','userpic','lastPauseAt','address','chatPause','mailPause','chatCapacity','openchannelCapacity','whatsappCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','mailStatus','chatStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','online','omit','pick','filterAgentAttributes','jayson/promise','../../mysqldb','http','faxPause','openchannelPause','whatsappPause','every','filter','length','idle','unknown','unavailable','ringing','isNil','voiceStatus','voicePause','pause','chatStatus','faxStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','merge','getRealtimeAgents','busy','isArray','startCase','Queue','map','getAgents','all','flatten','value','getAgentIdsByQueues','getAgentIdsByStatus','resolve','includes','User','name','fullname','smsPause','pauseType','find','globalStatus','catch','getSortedAgentsIdsByStatus','split','fields','order','DESC','ASC','getUpdatedSortOptions'];(function(_0x510f65,_0x508bf9){var _0xb92a11=function(_0x10feef){while(--_0x10feef){_0x510f65['push'](_0x510f65['shift']());}};_0xb92a11(++_0x508bf9);}(_0x0526,0x191));var _0x6052=function(_0x40939d,_0x509ee0){_0x40939d=_0x40939d-0x0;var _0x55edaa=_0x0526[_0x40939d];return _0x55edaa;};'use strict';var _=require('lodash');var jayson=require(_0x6052('0x0'));var db=require(_0x6052('0x1'))['db'];var amiClient=jayson['client'][_0x6052('0x2')]({'port':0x232a});var routingClient=jayson['client'][_0x6052('0x2')]({'port':0x232c});function isAgentPaused(_0x5c7e68,_0x535586){var _0x1917ef=[_0x5c7e68['chatPause'],_0x5c7e68[_0x6052('0x3')],_0x5c7e68['mailPause'],_0x5c7e68[_0x6052('0x4')],_0x5c7e68['smsPause'],_0x5c7e68['voicePause'],_0x5c7e68[_0x6052('0x5')]];if(!_0x535586)return _[_0x6052('0x6')](_0x1917ef);var _0x14d549=_[_0x6052('0x7')](_0x1917ef);return _0x14d549['length']>0x0&&_0x14d549[_0x6052('0x8')]<_0x1917ef[_0x6052('0x8')]?!![]:![];}function isIdle(_0x336d65){return _0x336d65===_0x6052('0x9')||_0x336d65===_0x6052('0xa')||_0x336d65===_0x6052('0xb')||_0x336d65===_0x6052('0xc')||_[_0x6052('0xd')](_0x336d65);}function isAgentIdle(_0x1d75b7){if(_0x1d75b7[_0x6052('0xe')]!=='idle'&&_0x1d75b7[_0x6052('0xf')]){_0x1d75b7[_0x6052('0xe')]=_0x6052('0x10');return![];}return _[_0x6052('0x6')]([_0x1d75b7[_0x6052('0x11')],_0x1d75b7[_0x6052('0x12')],_0x1d75b7['mailStatus'],_0x1d75b7[_0x6052('0x13')],_0x1d75b7[_0x6052('0x14')],_0x1d75b7[_0x6052('0xe')],_0x1d75b7[_0x6052('0x15')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x6052('0x16')](_0x6052('0x17'),{})['then'](function(_0xba7515){if(_0xba7515[_0x6052('0x18')]){throw new Error(_0x6052('0x19'));}var _0x572f6e=_0xba7515['result'];return routingClient[_0x6052('0x16')](_0x6052('0x17'),{})[_0x6052('0x1a')](function(_0x5e6bed){if(_0x5e6bed[_0x6052('0x18')]){throw new Error(_0x6052('0x1b'));}var _0x143322=_0x5e6bed[_0x6052('0x1c')];return _[_0x6052('0x1d')]({},_0x572f6e,_0x143322);});})['catch'](function(_0x410577){throw _0x410577;});}exports[_0x6052('0x1e')]=getRealtimeAgents;function getAgentStatus(_0x7b797){var _0x4a67fa=_0x6052('0xa');if(isAgentPaused(_0x7b797))_0x4a67fa='pause';else if(isAgentPaused(_0x7b797,!![]))_0x4a67fa='*pause';else if(isAgentIdle(_0x7b797))_0x4a67fa=_0x6052('0x9');else _0x4a67fa=_0x6052('0x1f');return _0x4a67fa;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x57c63e,_0x42fe8a){var _0x2c4c37=_[_0x6052('0x20')](_0x57c63e)?_0x57c63e:[_0x57c63e];var _0x2bcf42=_[_0x6052('0x21')](_0x42fe8a)+_0x6052('0x22');var _0x5501d6=_[_0x6052('0x23')](_0x2c4c37,function(_0x44ac3f){return db[_0x2bcf42]['findOne']({'where':{'id':_0x44ac3f}})[_0x6052('0x1a')](function(_0x5d3c32){if(!_0x5d3c32)return[];return _0x5d3c32[_0x6052('0x24')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x6052('0x25')](_0x5501d6)['then'](function(_0x51ca96){var _0x236f9a=_(_0x51ca96)[_0x6052('0x26')]()['map']('id')['uniq']()[_0x6052('0x27')]();return _0x236f9a;});}exports[_0x6052('0x28')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x531041,_0x1394e8,_0x43aa98){try{if(_0x1394e8[_0x6052('0x8')]>0x0){_0x531041=_0x531041[_0x6052('0x7')](function(_0x38d290){return _0x1394e8['includes'](_0x38d290['id']);});}var _0x54bfd6=_0x531041[_0x6052('0x7')](function(_0x512b74){var _0x190eb4=_0x6052('0x1f');if(isAgentIdle(_0x512b74)){_0x190eb4=_0x6052('0x9');}return _0x190eb4===_0x43aa98;});return _[_0x6052('0x23')](_0x54bfd6,'id');}catch(_0x3fab1e){throw _0x3fab1e;}}exports[_0x6052('0x29')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x458a4e,_0x39ba72,_0x135862){return Promise[_0x6052('0x2a')]()['then'](function(){if(_0x39ba72[_0x6052('0x8')]>0x0){_0x458a4e=_0x458a4e['filter'](function(_0x4a5a34){return _0x39ba72[_0x6052('0x2b')](_0x4a5a34['id']);});}return _0x458a4e;})[_0x6052('0x1a')](function(){return db[_0x6052('0x2c')]['findAll']({'attributes':['id',_0x6052('0x2d'),_0x6052('0x2e'),'chatPause','faxPause','mailPause',_0x6052('0x4'),_0x6052('0x2f'),_0x6052('0xf'),'whatsappPause',_0x6052('0x30')],'where':{'id':{'$in':_[_0x6052('0x23')](_0x458a4e,'id')}},'raw':!![]});})[_0x6052('0x1a')](function(_0x5710af){return _0x5710af['map'](function(_0x51cf78){var _0x717e1e=_[_0x6052('0x31')](_0x458a4e,['id',_0x51cf78['id']]);var _0x19e983=filterAgentAttributes(_0x717e1e);_[_0x6052('0x1d')](_0x51cf78,_0x19e983);_0x51cf78[_0x6052('0x32')]=getAgentStatus(_0x51cf78);return _0x51cf78;});})[_0x6052('0x1a')](function(_0x5b75c0){var _0x575f8d=sortAgentsByStatus(_0x5b75c0,_0x135862);return _[_0x6052('0x23')](_0x575f8d,'id');})[_0x6052('0x33')](function(_0x376539){throw _0x376539;});}exports[_0x6052('0x34')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x19e110){var _0x3f9092={'fields':[],'order':null};var _0x39e15=_0x19e110[_0x6052('0x35')](',');_0x3f9092[_0x6052('0x36')]=_[_0x6052('0x7')](_0x39e15,function(_0x26f466){if(!_0x26f466[_0x6052('0x2b')]('globalStatus')){return!![];}_0x3f9092[_0x6052('0x37')]=_['startsWith'](_0x26f466,'-')?_0x6052('0x38'):_0x6052('0x39');return![];});return _0x3f9092;}exports[_0x6052('0x3a')]=getUpdatedSortOptions;function validateSortParameter(_0x35116d){if(_0x35116d[_0x6052('0x2b')](_0x6052('0x2e'))&&!_0x35116d[_0x6052('0x2b')](_0x6052('0x3b'))){var _0x13935a=_0x35116d[_0x6052('0x3c')](0x0,_0x35116d[_0x6052('0x3d')](_0x6052('0x2e')));_0x35116d+=','+_0x13935a+_0x6052('0x3b');}return _0x35116d;}exports[_0x6052('0x3e')]=validateSortParameter;function sortAgentsByStatus(_0x2bc1a4,_0x2880dd){var _0x3fa303=_0x2bc1a4[_0x6052('0x3f')](function(_0x376fcb,_0x1eb782){if(_0x376fcb[_0x6052('0x32')]===_0x1eb782[_0x6052('0x32')]){if(_0x376fcb['globalStatus']===_0x6052('0x10')){if(_0x2880dd===_0x6052('0x38')){return(_0x376fcb[_0x6052('0x30')]||'')<(_0x1eb782[_0x6052('0x30')]||'')||_0x376fcb[_0x6052('0x2e')]['toLowerCase']()>_0x1eb782[_0x6052('0x2e')][_0x6052('0x40')]()?0x1:-0x1;}else{return(_0x376fcb[_0x6052('0x30')]||'')<(_0x1eb782['pauseType']||'')||_0x376fcb[_0x6052('0x2e')]['toLowerCase']()>_0x1eb782[_0x6052('0x2e')][_0x6052('0x40')]()?-0x1:0x1;}}else{if(_0x2880dd===_0x6052('0x38')){return _0x376fcb[_0x6052('0x2e')]['toLowerCase']()<_0x1eb782[_0x6052('0x2e')][_0x6052('0x40')]()?0x1:-0x1;}else{return _0x376fcb[_0x6052('0x2e')]['toLowerCase']()<_0x1eb782[_0x6052('0x2e')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x2880dd==='DESC'){return _0x376fcb[_0x6052('0x32')]<_0x1eb782[_0x6052('0x32')]?0x1:-0x1;}else{return _0x376fcb[_0x6052('0x32')]<_0x1eb782[_0x6052('0x32')]?-0x1:0x1;}}});return _0x3fa303;}exports[_0x6052('0x41')]=sortAgentsByStatus;function filterAgentAttributes(_0x67cc4b){var _0x5b0f9a=[_0x6052('0x42'),'online','lastLoginAt',_0x6052('0x43'),'pauseType','lastPauseAt',_0x6052('0x3b'),_0x6052('0x44'),_0x6052('0x45'),_0x6052('0x4'),_0x6052('0x46'),_0x6052('0x2f'),_0x6052('0x5'),_0x6052('0x3'),_0x6052('0xf'),_0x6052('0x47'),_0x6052('0x48'),'mailCapacity','smsCapacity',_0x6052('0x49'),'faxCapacity','chatCurrentCapacity',_0x6052('0x4a'),_0x6052('0x4b'),_0x6052('0x4c'),_0x6052('0x4d'),_0x6052('0x4e'),_0x6052('0x11'),_0x6052('0x13'),_0x6052('0x4f'),_0x6052('0x14'),'whatsappStatus','faxStatus',_0x6052('0xe'),_0x6052('0x50'),'openchannelStatusTime','mailStatusTime','smsStatusTime',_0x6052('0x51'),_0x6052('0x52'),_0x6052('0x53'),_0x6052('0x54'),_0x6052('0x55'),_0x6052('0x56'),'phoneBarEnableScreenRecordingByAgent',_0x6052('0x57'),'routealias'];var _0x10d472=[_0x6052('0x45'),_0x6052('0x4'),_0x6052('0x46'),'smsPause',_0x6052('0x5'),_0x6052('0x3'),_0x6052('0xf'),_0x6052('0x58')];var _0x222d35=_(_0x67cc4b)[_0x6052('0x59')](_0x10d472)[_0x6052('0x5a')](_0x5b0f9a)['value']();return _0x222d35;}exports[_0x6052('0x5b')]=filterAgentAttributes; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 9b201f3..134ebb9 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 _0xf76d=['voice','request','startCase','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','getRealtimeQueues','concat','outbound','map','get','paused','pTalking','originated','find','pick','initializeQueues','lodash','jayson/promise','client','http','available','loggedIn','waiting','busy','loggedInDb','notInUse','onHold','ringInUse','talking','unknown','statusMessage','dialActive','dialMethod','Trunk','startPredictive','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime'];(function(_0xd13a88,_0x3c5269){var _0x1c993c=function(_0x245af5){while(--_0x245af5){_0xd13a88['push'](_0xd13a88['shift']());}};_0x1c993c(++_0x3c5269);}(_0xf76d,0x132));var _0xdf76=function(_0x2c73fa,_0x41b660){_0x2c73fa=_0x2c73fa-0x0;var _0x201374=_0xf76d[_0x2c73fa];return _0x201374;};'use strict';var _=require(_0xdf76('0x0'));var jayson=require(_0xdf76('0x1'));var util=require('util');var amiClient=jayson[_0xdf76('0x2')][_0xdf76('0x3')]({'port':0x232a});var routingClient=jayson[_0xdf76('0x2')]['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xdf76('0x4'),_0xdf76('0x5'),'paused',_0xdf76('0x6')];var VOICE_QUEUE_ATTRIBUTES=[_0xdf76('0x7'),'inUse','invalid',_0xdf76('0x8'),_0xdf76('0x9'),_0xdf76('0xa'),'ringing',_0xdf76('0xb'),_0xdf76('0xc'),'unavailable',_0xdf76('0xd')];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking','originated','message',_0xdf76('0xe'),_0xdf76('0xf'),_0xdf76('0x10'),_0xdf76('0x11'),_0xdf76('0x12'),'startProgressive','erlangCalls',_0xdf76('0x13'),_0xdf76('0x14'),'erlangBusyFactor',_0xdf76('0x15'),_0xdf76('0x16'),_0xdf76('0x17'),_0xdf76('0x18'),_0xdf76('0x19'),_0xdf76('0x1a'),_0xdf76('0x1b'),_0xdf76('0x1c'),'predictiveIntervalAvgHoldtime',_0xdf76('0x1d')];function getRealtimeQueues(_0x29a901,_0xd26c2){var _0x4e118e=_0xd26c2===_0xdf76('0x1e')?amiClient:routingClient;return _0x4e118e[_0xdf76('0x1f')](_[_0xdf76('0x20')](_0xd26c2)+'Queues',_0x29a901)[_0xdf76('0x21')](function(_0xe75c4c){if(_0xe75c4c[_0xdf76('0x22')])throw new Error(util[_0xdf76('0x23')](_0xdf76('0x24'),_0xd26c2));return _0xe75c4c['result'];})['catch'](function(_0x392e21){throw _0x392e21;});}exports[_0xdf76('0x25')]=getRealtimeQueues;function initializeQueues(_0xca4322,_0x378807,_0x325743,_0xc092eb){var _0x331cac=DEFAULT_QUEUE_ATTRIBUTES;if(_0x325743===_0xdf76('0x1e')){if(_0xc092eb==='inbound'){_0x331cac=_0x331cac[_0xdf76('0x26')](VOICE_QUEUE_ATTRIBUTES);}else if(_0xc092eb===_0xdf76('0x27')){_0x331cac=_0x331cac[_0xdf76('0x26')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0xca4322[_0xdf76('0x28')](function(_0x6018de){var _0x5c0529=_0x6018de[_0xdf76('0x29')]({'plain':!![]});_0x5c0529[_0xdf76('0x2a')]=0x0;_0x5c0529[_0xdf76('0x8')]=0x0;_0x5c0529[_0xdf76('0x5')]=0x0;_0x5c0529[_0xdf76('0x4')]=0x0;_0x5c0529['waiting']=0x0;if(_0x325743===_0xdf76('0x1e')){_0x5c0529[_0xdf76('0xc')]=0x0;_0x5c0529['busy']=0x0;if(_0xc092eb===_0xdf76('0x27')){_0x5c0529[_0xdf76('0x2b')]=0x0;_0x5c0529[_0xdf76('0x2c')]=0x0;}}var _0xe6f7cb=_[_0xdf76('0x2d')](_0x378807,['id',_0x5c0529['id']]);if(_0xe6f7cb){_['merge'](_0x5c0529,_[_0xdf76('0x2e')](_0xe6f7cb,_0x331cac));}return _0x5c0529;});}exports[_0xdf76('0x2f')]=initializeQueues; \ No newline at end of file +var _0x665e=['Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','concat','outbound','map','get','paused','initializeQueues','lodash','jayson/promise','util','client','available','waiting','busy','inUse','invalid','loggedInDb','notInUse','onHold','ringing','ringInUse','unavailable','unknown','pTalking','originated','message','dialMethod','Trunk','startPredictive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','then','error','format'];(function(_0x39b099,_0x50c5bf){var _0x50bc8a=function(_0x224eaf){while(--_0x224eaf){_0x39b099['push'](_0x39b099['shift']());}};_0x50bc8a(++_0x50c5bf);}(_0x665e,0x1ea));var _0xe665=function(_0x46a38b,_0x16ffb5){_0x46a38b=_0x46a38b-0x0;var _0x346e75=_0x665e[_0x46a38b];return _0x346e75;};'use strict';var _=require(_0xe665('0x0'));var jayson=require(_0xe665('0x1'));var util=require(_0xe665('0x2'));var amiClient=jayson[_0xe665('0x3')]['http']({'port':0x232a});var routingClient=jayson[_0xe665('0x3')]['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xe665('0x4'),'loggedIn','paused',_0xe665('0x5')];var VOICE_QUEUE_ATTRIBUTES=[_0xe665('0x6'),_0xe665('0x7'),_0xe665('0x8'),_0xe665('0x9'),_0xe665('0xa'),_0xe665('0xb'),_0xe665('0xc'),_0xe665('0xd'),'talking',_0xe665('0xe'),_0xe665('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xe665('0x10'),_0xe665('0x11'),_0xe665('0x12'),'statusMessage','dialActive',_0xe665('0x13'),_0xe665('0x14'),_0xe665('0x15'),'startProgressive',_0xe665('0x16'),_0xe665('0x17'),_0xe665('0x18'),'erlangBusyFactor',_0xe665('0x19'),'dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold',_0xe665('0x1a'),_0xe665('0x1b'),_0xe665('0x1c'),'predictiveIntervalDroppedCallsTimeout',_0xe665('0x1d'),_0xe665('0x1e'),_0xe665('0x1f')];function getRealtimeQueues(_0x2d6e41,_0x38a4c3){var _0x509ab3=_0x38a4c3===_0xe665('0x20')?amiClient:routingClient;return _0x509ab3[_0xe665('0x21')](_[_0xe665('0x22')](_0x38a4c3)+'Queues',_0x2d6e41)[_0xe665('0x23')](function(_0x39bba2){if(_0x39bba2[_0xe665('0x24')])throw new Error(util[_0xe665('0x25')](_0xe665('0x26'),_0x38a4c3));return _0x39bba2[_0xe665('0x27')];})[_0xe665('0x28')](function(_0x29af05){throw _0x29af05;});}exports[_0xe665('0x29')]=getRealtimeQueues;function initializeQueues(_0x5750c8,_0x146433,_0x50d94a,_0x534bcc){var _0xe8b6bf=DEFAULT_QUEUE_ATTRIBUTES;if(_0x50d94a===_0xe665('0x20')){if(_0x534bcc==='inbound'){_0xe8b6bf=_0xe8b6bf[_0xe665('0x2a')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x534bcc===_0xe665('0x2b')){_0xe8b6bf=_0xe8b6bf[_0xe665('0x2a')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x5750c8[_0xe665('0x2c')](function(_0x43333b){var _0x4bc215=_0x43333b[_0xe665('0x2d')]({'plain':!![]});_0x4bc215[_0xe665('0x2e')]=0x0;_0x4bc215[_0xe665('0x9')]=0x0;_0x4bc215['loggedIn']=0x0;_0x4bc215[_0xe665('0x4')]=0x0;_0x4bc215[_0xe665('0x5')]=0x0;if(_0x50d94a===_0xe665('0x20')){_0x4bc215['talking']=0x0;_0x4bc215[_0xe665('0x6')]=0x0;if(_0x534bcc==='outbound'){_0x4bc215[_0xe665('0x10')]=0x0;_0x4bc215[_0xe665('0x11')]=0x0;}}var _0x1c6694=_['find'](_0x146433,['id',_0x4bc215['id']]);if(_0x1c6694){_['merge'](_0x4bc215,_['pick'](_0x1c6694,_0xe8b6bf));}return _0x4bc215;});}exports[_0xe665('0x2f')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 1f9b4ae..89c42d9 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(_0x12553d,_0x160725){var _0x166267=function(_0x49f7ae){while(--_0x49f7ae){_0x12553d['push'](_0x12553d['shift']());}};_0x166267(++_0x160725);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'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 _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(_0x585234,_0x3ae470){var _0x28b8a7=function(_0x9081e1){while(--_0x9081e1){_0x585234['push'](_0x585234['shift']());}};_0x28b8a7(++_0x3ae470);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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 diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 2882b78..976e3d5 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 _0xa310=['replace','hostname','macAddress','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','execSync','../environment','networkInterfaces','orderBy','filter','family','IPv4','internal','concat','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','join','createHash','update','digest','hex','getUuid','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8'];(function(_0x3aca0c,_0x3fc3d4){var _0x4ca123=function(_0x551d2b){while(--_0x551d2b){_0x3aca0c['push'](_0x3aca0c['shift']());}};_0x4ca123(++_0x3fc3d4);}(_0xa310,0x1e1));var _0x0a31=function(_0x5d892c,_0x55d05f){_0x5d892c=_0x5d892c-0x0;var _0x34dcf7=_0xa310[_0x5d892c];return _0x34dcf7;};'use strict';var _=require(_0x0a31('0x0'));var os=require('os');var crypto=require(_0x0a31('0x1'));var machine=require(_0x0a31('0x2'));var exec=require('child_process')[_0x0a31('0x3')];var config=require(_0x0a31('0x4'));function getInterfaces(){var _0x52deb7=[];var _0x4c583a=os[_0x0a31('0x5')]();var _0xf008a3=_[_0x0a31('0x6')](_['keys'](_0x4c583a));for(var _0x3d6493=0x0;_0x3d6493<_0xf008a3['length'];_0x3d6493++){var _0x145ffa=_0x4c583a[_0xf008a3[_0x3d6493]][_0x0a31('0x7')](function(_0x3f4888){return _0x3f4888[_0x0a31('0x8')]===_0x0a31('0x9')&&_0x3f4888[_0x0a31('0xa')]===![];});_0x52deb7=_0x52deb7[_0x0a31('0xb')](_0x145ffa);}return _0x52deb7;}function getFirstInterface(){var _0x5381e8=_['head'](getInterfaces());return{'macAddress':_0x5381e8&&_0x5381e8[_0x0a31('0xc')]?_0x5381e8[_0x0a31('0xc')]:_0x0a31('0xd'),'ipAddress':_0x5381e8&&_0x5381e8['address']?_0x5381e8[_0x0a31('0xe')]:_0x0a31('0xf')};}exports[_0x0a31('0x10')]=getFirstInterface;function getCPUhash(){var _0x245f84=_[_0x0a31('0x6')](os[_0x0a31('0x11')]()[_0x0a31('0x12')](function(_0x380dce){return _0x380dce['model'];}))[_0x0a31('0x13')](':');return crypto[_0x0a31('0x14')]('md5')[_0x0a31('0x15')](_0x245f84)[_0x0a31('0x16')](_0x0a31('0x17'));}exports[_0x0a31('0x18')]=function(){var _0x2dca01=os['platform']();var _0x211ab3=/[0-9a-f-]{36}/;if(config[_0x0a31('0x19')]&&_0x211ab3['test'](config[_0x0a31('0x19')])){return config['licenseToken'];}else if(_0x2dca01===_0x0a31('0x1a')){return exec(_0x0a31('0x1b'),{'encoding':_0x0a31('0x1c')})[_0x0a31('0x1d')]('\x0d\x0a','');}else{var _0xd314e4=getFirstInterface();var _0x9f816c=getCPUhash();var _0x432f57=_0x9f816c+'|'+os[_0x0a31('0x1e')]()+'|'+_0xd314e4[_0x0a31('0x1f')]+'|'+_0xd314e4[_0x0a31('0x20')];var _0x42a146=crypto[_0x0a31('0x14')]('md5')[_0x0a31('0x15')](_0x432f57)[_0x0a31('0x16')](_0x0a31('0x17'));return _0x42a146[_0x0a31('0x21')](0x0,0x8)+'-'+_0x42a146[_0x0a31('0x21')](0x8,0xc)+'-'+_0x42a146['substring'](0xc,0x10)+'-'+_0x42a146[_0x0a31('0x21')](0x10,0x14)+'-'+_0x42a146[_0x0a31('0x21')](0x14);}}; \ No newline at end of file +var _0x7f29=['dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','substring','lodash','child_process','execSync','../environment','orderBy','keys','length','filter','family','IPv4','internal','concat','head','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','map','model','join','createHash','md5','update','digest','getUuid','platform','licenseToken','test','win32'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x7f29,0x1cd));var _0x97f2=function(_0xd8c166,_0x4c077a){_0xd8c166=_0xd8c166-0x0;var _0x494d0a=_0x7f29[_0xd8c166];return _0x494d0a;};'use strict';var _=require(_0x97f2('0x0'));var os=require('os');var crypto=require('crypto');var machine=require('bimedia-machine-uuid');var exec=require(_0x97f2('0x1'))[_0x97f2('0x2')];var config=require(_0x97f2('0x3'));function getInterfaces(){var _0x4345fe=[];var _0x20db5b=os['networkInterfaces']();var _0x5ba8a6=_[_0x97f2('0x4')](_[_0x97f2('0x5')](_0x20db5b));for(var _0x11053f=0x0;_0x11053f<_0x5ba8a6[_0x97f2('0x6')];_0x11053f++){var _0x1900a2=_0x20db5b[_0x5ba8a6[_0x11053f]][_0x97f2('0x7')](function(_0x1e86d5){return _0x1e86d5[_0x97f2('0x8')]===_0x97f2('0x9')&&_0x1e86d5[_0x97f2('0xa')]===![];});_0x4345fe=_0x4345fe[_0x97f2('0xb')](_0x1900a2);}return _0x4345fe;}function getFirstInterface(){var _0x514bba=_[_0x97f2('0xc')](getInterfaces());return{'macAddress':_0x514bba&&_0x514bba['mac']?_0x514bba['mac']:_0x97f2('0xd'),'ipAddress':_0x514bba&&_0x514bba[_0x97f2('0xe')]?_0x514bba[_0x97f2('0xe')]:_0x97f2('0xf')};}exports[_0x97f2('0x10')]=getFirstInterface;function getCPUhash(){var _0x41a9bb=_['orderBy'](os['cpus']()[_0x97f2('0x11')](function(_0x9b220f){return _0x9b220f[_0x97f2('0x12')];}))[_0x97f2('0x13')](':');return crypto[_0x97f2('0x14')](_0x97f2('0x15'))[_0x97f2('0x16')](_0x41a9bb)[_0x97f2('0x17')]('hex');}exports[_0x97f2('0x18')]=function(){var _0x32f503=os[_0x97f2('0x19')]();var _0x1c87fd=/[0-9a-f-]{36}/;if(config[_0x97f2('0x1a')]&&_0x1c87fd[_0x97f2('0x1b')](config[_0x97f2('0x1a')])){return config[_0x97f2('0x1a')];}else if(_0x32f503===_0x97f2('0x1c')){return exec(_0x97f2('0x1d'),{'encoding':_0x97f2('0x1e')})[_0x97f2('0x1f')]('\x0d\x0a','');}else{var _0x89cbd5=getFirstInterface();var _0x235896=getCPUhash();var _0x4b2171=_0x235896+'|'+os[_0x97f2('0x20')]()+'|'+_0x89cbd5[_0x97f2('0x21')]+'|'+_0x89cbd5['ipAddress'];var _0x3ca483=crypto[_0x97f2('0x14')](_0x97f2('0x15'))['update'](_0x4b2171)[_0x97f2('0x17')]('hex');return _0x3ca483[_0x97f2('0x22')](0x0,0x8)+'-'+_0x3ca483[_0x97f2('0x22')](0x8,0xc)+'-'+_0x3ca483[_0x97f2('0x22')](0xc,0x10)+'-'+_0x3ca483[_0x97f2('0x22')](0x10,0x14)+'-'+_0x3ca483[_0x97f2('0x22')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 8a3a549..f04087c 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 _0x85a6=['format','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','data1','active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data2','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','YYYY-MM-DD\x20HH:mm','update','encryptString','diff','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','message','finally','getUuid','License','findOrCreate','spread','catch','error','default','util','moment','request-promise','bluebird','pkginfo','version','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com'];(function(_0x4824b9,_0x38ce23){var _0x4a79fd=function(_0x198f67){while(--_0x198f67){_0x4824b9['push'](_0x4824b9['shift']());}};_0x4a79fd(++_0x38ce23);}(_0x85a6,0x15d));var _0x685a=function(_0x243ca9,_0x3178bc){_0x243ca9=_0x243ca9-0x0;var _0x51b2da=_0x85a6[_0x243ca9];return _0x51b2da;};'use strict';var util=require(_0x685a('0x0'));var moment=require(_0x685a('0x1'));var rp=require(_0x685a('0x2'));var BPromise=require(_0x685a('0x3'));var pkginfo=require(_0x685a('0x4'))(module,_0x685a('0x5'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x685a('0x6'));var hardware=require(_0x685a('0x7'));var logger=require(_0x685a('0x8'))(_0x685a('0x9'));var HOST=_0x685a('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x277788){return new BPromise(function(_0x59df5c,_0x21bf32){var _0x57f603=util[_0x685a('0xb')]('%s/api/servers/%s/check?version=%s',HOST,_0x277788,module[_0x685a('0xc')][_0x685a('0x5')]);if(oldToken){_0x57f603=util[_0x685a('0xb')](_0x685a('0xd'),HOST,_0x277788,module[_0x685a('0xc')][_0x685a('0x5')],oldToken);}var _0x35a1d1={'uri':_0x57f603,'method':_0x685a('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x35a1d1)[_0x685a('0xf')](function(_0x50f97b){_0x59df5c(_0x50f97b);})['catch'](function(_0x55ea60){_0x21bf32(_0x55ea60);});});}function manageLicense(_0x2f747c,_0x134594){var _0x1d1883=_0x134594['get']({'plain':!![]});if(!isOldTokenSent&&_0x1d1883[_0x685a('0x10')]!==_0x2f747c&&!_0x1d1883['data2']){oldToken=_0x1d1883['data1'];}httpRequest(_0x2f747c)[_0x685a('0xf')](function(_0x28aed8){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x28aed8[_0x685a('0x11')]){isOldTokenSent=![];if(!_0x1d1883[_0x685a('0x9')]&&_0x1d1883['license']!=_0x28aed8[_0x685a('0x9')]||_0x1d1883[_0x685a('0x9')]&&_0x1d1883['data2']){logger['info'](_0x685a('0x12'));}if(_0x1d1883[_0x685a('0x9')]&&!_0x1d1883['data2']&&_0x1d1883[_0x685a('0x9')]!=_0x28aed8[_0x685a('0x9')]){logger[_0x685a('0x13')](_0x685a('0x14'));}if(_0x1d1883['license']&&!_0x1d1883[_0x685a('0x15')]&&_0x1d1883[_0x685a('0x9')]==_0x28aed8[_0x685a('0x9')]){return _0x134594;}return _0x134594['update']({'data1':_0x2f747c,'data2':null,'license':_0x28aed8[_0x685a('0x9')]});}else{if(_0x28aed8[_0x685a('0x9')]||_0x1d1883[_0x685a('0x9')]){if(!_0x1d1883[_0x685a('0x15')]){if(_0x1d1883[_0x685a('0x10')]==_0x2f747c){GRAY_PERIOD_REASON=_0x685a('0x16');logger[_0x685a('0x13')](_0x685a('0x17'));}else{GRAY_PERIOD_REASON='Changed';logger[_0x685a('0x13')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x1d1883['data1'],_0x2f747c);}logger[_0x685a('0x13')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON['toUpperCase'](),moment()['format'](_0x685a('0x18')));return _0x134594[_0x685a('0x19')]({'data2':encryptor[_0x685a('0x1a')](moment()[_0x685a('0xb')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x685a('0x1b')](encryptor['decryptString'](_0x1d1883['data2']),_0x685a('0x1c'))>DAYS){logger[_0x685a('0x13')](_0x685a('0x1d'),moment()['format']('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x134594[_0x685a('0x19')]({'data1':_0x2f747c,'data2':null,'license':null});}}}else{if(_0x1d1883[_0x685a('0x10')]!=_0x2f747c){logger[_0x685a('0x13')](_0x685a('0x1e'),_0x1d1883['data1'],_0x2f747c);return _0x134594[_0x685a('0x19')]({'data1':_0x2f747c,'data2':null,'license':null});}}}return _0x134594;})[_0x685a('0xf')](function(_0x3d44fd){_0x134594=_0x3d44fd;})['catch'](function(_0x55629b){logger['error'](_0x55629b[_0x685a('0x1f')]);})[_0x685a('0x20')](function(){setTimeout(function(){manageLicense(hardware[_0x685a('0x21')](),_0x134594);},TIME);});}function defaultLicense(){var _0x3bb0dd=hardware[_0x685a('0x21')]();if(_0x3bb0dd){return db[_0x685a('0x22')][_0x685a('0x23')]({'where':{'id':0x1},'defaults':{'data1':_0x3bb0dd}})[_0x685a('0x24')](function(_0x489822,_0x2e25a6){logger[_0x685a('0x13')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x3bb0dd);manageLicense(_0x3bb0dd,_0x489822);})[_0x685a('0x25')](function(_0x9646d2){logger[_0x685a('0x26')](_0x9646d2[_0x685a('0x1f')]);});}}exports[_0x685a('0x27')]=defaultLicense; \ No newline at end of file +var _0x81c3=['Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','decryptString','DEMO\x20START\x20AT\x20%s','catch','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','moment','request-promise','bluebird','pkginfo','version','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','get','data2','data1','then','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED'];(function(_0x58b4f4,_0x205ed2){var _0x1bc562=function(_0xd2dd5f){while(--_0xd2dd5f){_0x58b4f4['push'](_0x58b4f4['shift']());}};_0x1bc562(++_0x205ed2);}(_0x81c3,0xb9));var _0x381c=function(_0x1e4045,_0x464732){_0x1e4045=_0x1e4045-0x0;var _0x13bff3=_0x81c3[_0x1e4045];return _0x13bff3;};'use strict';var util=require('util');var moment=require(_0x381c('0x0'));var rp=require(_0x381c('0x1'));var BPromise=require(_0x381c('0x2'));var pkginfo=require(_0x381c('0x3'))(module,_0x381c('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x381c('0x5'));var hardware=require(_0x381c('0x6'));var logger=require(_0x381c('0x7'))(_0x381c('0x8'));var HOST=_0x381c('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x39ef2f){return new BPromise(function(_0x4ef319,_0x1fe42c){var _0x535a59=util[_0x381c('0xa')](_0x381c('0xb'),HOST,_0x39ef2f,module[_0x381c('0xc')][_0x381c('0x4')]);if(oldToken){_0x535a59=util['format'](_0x381c('0xd'),HOST,_0x39ef2f,module[_0x381c('0xc')][_0x381c('0x4')],oldToken);}var _0x527208={'uri':_0x535a59,'method':_0x381c('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x527208)['then'](function(_0x4788f3){_0x4ef319(_0x4788f3);})['catch'](function(_0x5d737b){_0x1fe42c(_0x5d737b);});});}function manageLicense(_0x3828e9,_0x205855){var _0x4b1ef3=_0x205855[_0x381c('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x4b1ef3['data1']!==_0x3828e9&&!_0x4b1ef3[_0x381c('0x10')]){oldToken=_0x4b1ef3[_0x381c('0x11')];}httpRequest(_0x3828e9)[_0x381c('0x12')](function(_0x131fff){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x131fff['active']){isOldTokenSent=![];if(!_0x4b1ef3[_0x381c('0x8')]&&_0x4b1ef3[_0x381c('0x8')]!=_0x131fff[_0x381c('0x8')]||_0x4b1ef3[_0x381c('0x8')]&&_0x4b1ef3[_0x381c('0x10')]){logger[_0x381c('0x13')](_0x381c('0x14'));}if(_0x4b1ef3[_0x381c('0x8')]&&!_0x4b1ef3[_0x381c('0x10')]&&_0x4b1ef3[_0x381c('0x8')]!=_0x131fff[_0x381c('0x8')]){logger['info'](_0x381c('0x15'));}if(_0x4b1ef3['license']&&!_0x4b1ef3[_0x381c('0x10')]&&_0x4b1ef3[_0x381c('0x8')]==_0x131fff[_0x381c('0x8')]){return _0x205855;}return _0x205855[_0x381c('0x16')]({'data1':_0x3828e9,'data2':null,'license':_0x131fff[_0x381c('0x8')]});}else{if(_0x131fff[_0x381c('0x8')]||_0x4b1ef3[_0x381c('0x8')]){if(!_0x4b1ef3[_0x381c('0x10')]){if(_0x4b1ef3[_0x381c('0x11')]==_0x3828e9){GRAY_PERIOD_REASON=_0x381c('0x17');logger['info'](_0x381c('0x18'));}else{GRAY_PERIOD_REASON=_0x381c('0x19');logger[_0x381c('0x13')](_0x381c('0x1a'),_0x4b1ef3[_0x381c('0x11')],_0x3828e9);}logger['info']('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x381c('0x1b')](),moment()[_0x381c('0xa')](_0x381c('0x1c')));return _0x205855[_0x381c('0x16')]({'data2':encryptor['encryptString'](moment()[_0x381c('0xa')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x381c('0x1d')](encryptor[_0x381c('0x1e')](_0x4b1ef3[_0x381c('0x10')]),'days')>DAYS){logger[_0x381c('0x13')](_0x381c('0x1f'),moment()[_0x381c('0xa')](_0x381c('0x1c')));isOldTokenSent=![];return _0x205855['update']({'data1':_0x3828e9,'data2':null,'license':null});}}}else{if(_0x4b1ef3[_0x381c('0x11')]!=_0x3828e9){logger[_0x381c('0x13')](_0x381c('0x1a'),_0x4b1ef3[_0x381c('0x11')],_0x3828e9);return _0x205855[_0x381c('0x16')]({'data1':_0x3828e9,'data2':null,'license':null});}}}return _0x205855;})[_0x381c('0x12')](function(_0x5d1fbc){_0x205855=_0x5d1fbc;})[_0x381c('0x20')](function(_0x4bf3da){logger[_0x381c('0x21')](_0x4bf3da[_0x381c('0x22')]);})[_0x381c('0x23')](function(){setTimeout(function(){manageLicense(hardware[_0x381c('0x24')](),_0x205855);},TIME);});}function defaultLicense(){var _0x226c62=hardware[_0x381c('0x24')]();if(_0x226c62){return db[_0x381c('0x25')][_0x381c('0x26')]({'where':{'id':0x1},'defaults':{'data1':_0x226c62}})[_0x381c('0x27')](function(_0x315f88,_0x3c931a){logger[_0x381c('0x13')](_0x381c('0x28'),_0x226c62);manageLicense(_0x226c62,_0x315f88);})[_0x381c('0x20')](function(_0x113edf){logger[_0x381c('0x21')](_0x113edf[_0x381c('0x22')]);});}}exports[_0x381c('0x29')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index fcbd492..b0b6e4f 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 _0xe9c5=['count','pick','countBy','License\x20limit\x20reached\x20for\x20users','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','then','uuid','data1','split','decryptString','format','parse','demo','machineUuid','deadline','add','days','changed','disabled','message','User','role','sequelize','COUNT','col','admin','telephone','telephones','forEach','user'];(function(_0x23f183,_0x28cfad){var _0x58d71b=function(_0x4ef3ed){while(--_0x4ef3ed){_0x23f183['push'](_0x23f183['shift']());}};_0x58d71b(++_0x28cfad);}(_0xe9c5,0x1b3));var _0x5e9c=function(_0x33d170,_0xb3f85a){_0x33d170=_0x33d170-0x0;var _0x2ea9b4=_0xe9c5[_0x33d170];return _0x2ea9b4;};'use strict';var util=require(_0x5e9c('0x0'));var _=require(_0x5e9c('0x1'));var moment=require(_0x5e9c('0x2'));var BPromise=require(_0x5e9c('0x3'));var hardware=require(_0x5e9c('0x4'));var encryptor=require(_0x5e9c('0x5'));var db=require(_0x5e9c('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x5e9c('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x5e9c('0x8'),'machineUuid':hardware[_0x5e9c('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x5e9c('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x5e9c('0xa'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x6df65f){return new BPromise(function(_0x58f632,_0x568289){return db[_0x5e9c('0xb')][_0x5e9c('0xc')](_['defaults'](_0x6df65f,{'raw':!![],'where':{'id':0x1}}))[_0x5e9c('0xd')](function(_0x4c9112){return checkLicense(_0x4c9112,null);})[_0x5e9c('0xd')](function(_0x2fff38){_0x58f632(_0x2fff38);return;})['catch'](function(_0x3d5965){_0x568289(_0x3d5965);});});}function checkLicense(_0x156c36,_0x761e26){if(!_0x156c36){demoLicense[_0x5e9c('0xe')]=_0x156c36[_0x5e9c('0xf')];return demoLicense;}try{var _0x3c8641=_0x761e26||_0x156c36['license'];if(_['isEmpty'](_0x3c8641)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x56c416=_0x156c36[_0x5e9c('0xf')];var _0xe618aa=_0x156c36['data2'];var _0x453a47=_0x56c416[_0x5e9c('0x10')]('-')[0x4];var _0x133a91=_0x56c416['split']('-')[0x0];var _0x544c18=encryptor[_0x5e9c('0x11')](_0x3c8641,util[_0x5e9c('0x12')]('%s:%s:%s',_0x453a47,_0x56c416,_0x133a91));var _0x37c8c2=JSON[_0x5e9c('0x13')](_0x544c18);_0x37c8c2[_0x5e9c('0x14')]=![];_0x37c8c2[_0x5e9c('0xe')]=_0x56c416;_0x37c8c2[_0x5e9c('0x15')]=hardware[_0x5e9c('0x9')]();if(_0xe618aa){var _0x550a39=encryptor['decryptString'](_0xe618aa);_0x37c8c2['gray']=_0x550a39;_0x37c8c2[_0x5e9c('0x16')]=moment(_0x550a39)[_0x5e9c('0x17')](0x7,_0x5e9c('0x18'))['format']();_0x37c8c2['grayReason']=_0x37c8c2[_0x5e9c('0xe')]!=_0x37c8c2['machineUuid']?_0x5e9c('0x19'):_0x5e9c('0x1a');}return _0x37c8c2;}catch(_0x5a9f55){breakingLicense['uuid']=_0x156c36['data1'];breakingLicense[_0x5e9c('0x1b')]=_0x5a9f55[_0x5e9c('0x1b')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2ae465,_0x283a9d){getLicense()[_0x5e9c('0xd')](function(_0x4fe69c){return db[_0x5e9c('0x1c')]['findAll']({'attributes':[_0x5e9c('0x1d'),[db[_0x5e9c('0x1e')]['fn'](_0x5e9c('0x1f'),db[_0x5e9c('0x1e')][_0x5e9c('0x20')](_0x5e9c('0x1d'))),'count']],'group':_0x5e9c('0x1d'),'where':{'role':{'$or':[_0x5e9c('0x21'),'user',_0x5e9c('0x22')]}},'raw':!![]})[_0x5e9c('0xd')](function(_0x18000a){var _0x450957={'user':_0x4fe69c['users']||0x0,'telephone':_0x4fe69c[_0x5e9c('0x23')]||0x0};_0x18000a[_0x5e9c('0x24')](function(_0x8a6a21){var _0x39e7bf=_0x8a6a21[_0x5e9c('0x1d')]===_0x5e9c('0x21')?_0x5e9c('0x25'):_0x8a6a21[_0x5e9c('0x1d')];_0x450957[_0x39e7bf]-=_0x8a6a21[_0x5e9c('0x26')];if(_0x450957[_0x39e7bf]<0x0)_0x450957[_0x39e7bf]=0x0;});_0x2ae465(_0x450957);return;});})['catch'](function(_0x427c15){_0x283a9d(_0x427c15);});});}function checkUserLimits(_0x5905fc){return new BPromise(function(_0x45bfb6,_0x31cf53){getLimits()[_0x5e9c('0xd')](function(_0xb3a456){var _0x31d655=_[_0x5e9c('0x27')](_[_0x5e9c('0x28')](_0x5905fc,'role'),[_0x5e9c('0x21'),'user',_0x5e9c('0x22')]);var _0x471870=(_0x31d655['admin']||0x0)+(_0x31d655[_0x5e9c('0x25')]||0x0);var _0x5045ce=_0x31d655[_0x5e9c('0x22')]||0x0;if(_0x471870>_0xb3a456[_0x5e9c('0x25')])return _0x31cf53(_0x5e9c('0x29'));if(_0x5045ce>_0xb3a456['telephone'])return _0x31cf53('License\x20limit\x20reached\x20for\x20telephones');return _0x45bfb6();})['catch'](function(_0x17a4a5){_0x31cf53(_0x17a4a5);});});}module[_0x5e9c('0x2a')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xacc9=['getUuid','Breaking\x20license','License','find','defaults','then','uuid','data1','license','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','parse','demo','deadline','grayReason','changed','disabled','message','findAll','role','sequelize','COUNT','col','admin','user','users','telephones','forEach','count','pick','countBy','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','catch','exports','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license'];(function(_0x4024a8,_0x24792b){var _0x4d7178=function(_0xdb2f5d){while(--_0xdb2f5d){_0x4024a8['push'](_0x4024a8['shift']());}};_0x4d7178(++_0x24792b);}(_0xacc9,0xe3));var _0x9acc=function(_0x36b363,_0x43b7f8){_0x36b363=_0x36b363-0x0;var _0x1929fc=_0xacc9[_0x36b363];return _0x1929fc;};'use strict';var util=require('util');var _=require(_0x9acc('0x0'));var moment=require(_0x9acc('0x1'));var BPromise=require(_0x9acc('0x2'));var hardware=require(_0x9acc('0x3'));var encryptor=require(_0x9acc('0x4'));var db=require(_0x9acc('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x9acc('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x9acc('0x7'),'machineUuid':hardware[_0x9acc('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x9acc('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x9acc('0x9'),'machineUuid':hardware[_0x9acc('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x530707){return new BPromise(function(_0x108858,_0x2a05d2){return db[_0x9acc('0xa')][_0x9acc('0xb')](_[_0x9acc('0xc')](_0x530707,{'raw':!![],'where':{'id':0x1}}))[_0x9acc('0xd')](function(_0x26c34e){return checkLicense(_0x26c34e,null);})[_0x9acc('0xd')](function(_0x161daa){_0x108858(_0x161daa);return;})['catch'](function(_0x49b6a1){_0x2a05d2(_0x49b6a1);});});}function checkLicense(_0x1c6ec0,_0x2256aa){if(!_0x1c6ec0){demoLicense[_0x9acc('0xe')]=_0x1c6ec0[_0x9acc('0xf')];return demoLicense;}try{var _0x5ae81f=_0x2256aa||_0x1c6ec0[_0x9acc('0x10')];if(_['isEmpty'](_0x5ae81f)){throw new Error(_0x9acc('0x11'));}var _0x2d3804=_0x1c6ec0[_0x9acc('0xf')];var _0x3ae22e=_0x1c6ec0[_0x9acc('0x12')];var _0x3cdd3e=_0x2d3804[_0x9acc('0x13')]('-')[0x4];var _0xb8add9=_0x2d3804[_0x9acc('0x13')]('-')[0x0];var _0x141d1d=encryptor[_0x9acc('0x14')](_0x5ae81f,util[_0x9acc('0x15')]('%s:%s:%s',_0x3cdd3e,_0x2d3804,_0xb8add9));var _0x181b2d=JSON[_0x9acc('0x16')](_0x141d1d);_0x181b2d[_0x9acc('0x17')]=![];_0x181b2d[_0x9acc('0xe')]=_0x2d3804;_0x181b2d['machineUuid']=hardware[_0x9acc('0x8')]();if(_0x3ae22e){var _0x5a8924=encryptor[_0x9acc('0x14')](_0x3ae22e);_0x181b2d['gray']=_0x5a8924;_0x181b2d[_0x9acc('0x18')]=moment(_0x5a8924)['add'](0x7,'days')[_0x9acc('0x15')]();_0x181b2d[_0x9acc('0x19')]=_0x181b2d[_0x9acc('0xe')]!=_0x181b2d['machineUuid']?_0x9acc('0x1a'):_0x9acc('0x1b');}return _0x181b2d;}catch(_0x144f5a){breakingLicense[_0x9acc('0xe')]=_0x1c6ec0['data1'];breakingLicense[_0x9acc('0x1c')]=_0x144f5a[_0x9acc('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x457be8,_0xebdf4a){getLicense()['then'](function(_0x292b9b){return db['User'][_0x9acc('0x1d')]({'attributes':[_0x9acc('0x1e'),[db[_0x9acc('0x1f')]['fn'](_0x9acc('0x20'),db[_0x9acc('0x1f')][_0x9acc('0x21')](_0x9acc('0x1e'))),'count']],'group':_0x9acc('0x1e'),'where':{'role':{'$or':[_0x9acc('0x22'),_0x9acc('0x23'),'telephone']}},'raw':!![]})[_0x9acc('0xd')](function(_0xcfc254){var _0xd86d9e={'user':_0x292b9b[_0x9acc('0x24')]||0x0,'telephone':_0x292b9b[_0x9acc('0x25')]||0x0};_0xcfc254[_0x9acc('0x26')](function(_0x541e05){var _0x373dc9=_0x541e05[_0x9acc('0x1e')]===_0x9acc('0x22')?_0x9acc('0x23'):_0x541e05['role'];_0xd86d9e[_0x373dc9]-=_0x541e05[_0x9acc('0x27')];if(_0xd86d9e[_0x373dc9]<0x0)_0xd86d9e[_0x373dc9]=0x0;});_0x457be8(_0xd86d9e);return;});})['catch'](function(_0x4ebb71){_0xebdf4a(_0x4ebb71);});});}function checkUserLimits(_0x2038c0){return new BPromise(function(_0x332364,_0x43989d){getLimits()[_0x9acc('0xd')](function(_0x5e0236){var _0x371599=_[_0x9acc('0x28')](_[_0x9acc('0x29')](_0x2038c0,_0x9acc('0x1e')),[_0x9acc('0x22'),_0x9acc('0x23'),_0x9acc('0x2a')]);var _0x2f74e9=(_0x371599[_0x9acc('0x22')]||0x0)+(_0x371599['user']||0x0);var _0x3d5f81=_0x371599[_0x9acc('0x2a')]||0x0;if(_0x2f74e9>_0x5e0236['user'])return _0x43989d(_0x9acc('0x2b'));if(_0x3d5f81>_0x5e0236['telephone'])return _0x43989d(_0x9acc('0x2c'));return _0x332364();})[_0x9acc('0x2d')](function(_0x58ed26){_0x43989d(_0x58ed26);});});}module[_0x9acc('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 52d1873..8f28a8a 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 _0xd914=['http://localhost:9000','app-id','secret','exports'];(function(_0x3f1ee0,_0x30762f){var _0x41f93c=function(_0x7c397d){while(--_0x7c397d){_0x3f1ee0['push'](_0x3f1ee0['shift']());}};_0x41f93c(++_0x30762f);}(_0xd914,0x17f));var _0x4d91=function(_0x5aef17,_0x592cd4){_0x5aef17=_0x5aef17-0x0;var _0x43f9d0=_0xd914[_0x5aef17];return _0x43f9d0;};'use strict';module[_0x4d91('0x0')]={'DOMAIN':_0x4d91('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x4d91('0x2'),'GOOGLE_SECRET':_0x4d91('0x3'),'DEBUG':''}; \ No newline at end of file +var _0x3de3=['exports','myappanuglar-secret','app-id'];(function(_0x176d60,_0x53378d){var _0xaead80=function(_0x2c0a22){while(--_0x2c0a22){_0x176d60['push'](_0x176d60['shift']());}};_0xaead80(++_0x53378d);}(_0x3de3,0x1ce));var _0x33de=function(_0x1d5686,_0x4e4c07){_0x1d5686=_0x1d5686-0x0;var _0x4abbaa=_0x3de3[_0x1d5686];return _0x4abbaa;};'use strict';module[_0x33de('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x33de('0x1'),'GOOGLE_ID':_0x33de('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index f2672bd..1fbdc5e 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3677=['exports','fileLogger'];(function(_0xbf97fa,_0x43c41d){var _0x1a3db4=function(_0x33cdc0){while(--_0x33cdc0){_0xbf97fa['push'](_0xbf97fa['shift']());}};_0x1a3db4(++_0x43c41d);}(_0x3677,0xaf));var _0x7367=function(_0x302ba7,_0x5b9659){_0x302ba7=_0x302ba7-0x0;var _0x5eabcc=_0x3677[_0x302ba7];return _0x5eabcc;};'use strict';var fileLogger=require('../utils/loggers')[_0x7367('0x0')];module[_0x7367('0x1')]=fileLogger; \ No newline at end of file +var _0x5f06=['exports','fileLogger'];(function(_0x23579f,_0x23fb96){var _0x1d41aa=function(_0x238037){while(--_0x238037){_0x23579f['push'](_0x23579f['shift']());}};_0x1d41aa(++_0x23fb96);}(_0x5f06,0x11b));var _0x65f0=function(_0x321a2b,_0x5abaa5){_0x321a2b=_0x321a2b-0x0;var _0x3e497b=_0x5f06[_0x321a2b];return _0x3e497b;};'use strict';var fileLogger=require('../utils/loggers')[_0x65f0('0x0')];module[_0x65f0('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 22cebab..4da0e3c 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 _0x8918=['resolve','join','root','legacy-libs','express','../../services/express/index.js','ami','../../services/ami/index.js','agi','email','../../services/email/index.js','../../services/routing/index.js','xdr','../../config/environment'];(function(_0x53b16d,_0x4955f4){var _0xc680ba=function(_0x3601ad){while(--_0x3601ad){_0x53b16d['push'](_0x53b16d['shift']());}};_0xc680ba(++_0x4955f4);}(_0x8918,0x117));var _0x8891=function(_0x363a2b,_0x2c51a2){_0x363a2b=_0x363a2b-0x0;var _0x2c720e=_0x8918[_0x363a2b];return _0x2c720e;};'use strict';var path=require('path');var cfg=require(_0x8891('0x0'));var env={'NODE_PATH':path[_0x8891('0x1')](path[_0x8891('0x2')](cfg[_0x8891('0x3')],_0x8891('0x4')))};var pm2config={'apps':[{'name':_0x8891('0x5'),'script':path[_0x8891('0x2')](__dirname,_0x8891('0x6')),'env':env},{'name':_0x8891('0x7'),'script':path['join'](__dirname,_0x8891('0x8')),'env':env},{'name':_0x8891('0x9'),'script':path[_0x8891('0x2')](__dirname,'../../services/agi/index.js'),'env':env},{'name':_0x8891('0xa'),'script':path[_0x8891('0x2')](__dirname,_0x8891('0xb')),'env':env},{'name':'routing','script':path[_0x8891('0x2')](__dirname,_0x8891('0xc')),'env':env},{'name':_0x8891('0xd'),'script':path[_0x8891('0x2')](__dirname,'../../services/xdr/index.js'),'env':env}]};module['exports']=pm2config; \ No newline at end of file +var _0xc14b=['root','legacy-libs','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','../../config/environment','join'];(function(_0x4ed5d3,_0x1f395d){var _0x516392=function(_0x35f531){while(--_0x35f531){_0x4ed5d3['push'](_0x4ed5d3['shift']());}};_0x516392(++_0x1f395d);}(_0xc14b,0x1dd));var _0xbc14=function(_0x533843,_0x3d5ec0){_0x533843=_0x533843-0x0;var _0x55a5f4=_0xc14b[_0x533843];return _0x55a5f4;};'use strict';var path=require(_0xbc14('0x0'));var cfg=require(_0xbc14('0x1'));var env={'NODE_PATH':path['resolve'](path[_0xbc14('0x2')](cfg[_0xbc14('0x3')],_0xbc14('0x4')))};var pm2config={'apps':[{'name':'express','script':path[_0xbc14('0x2')](__dirname,_0xbc14('0x5')),'env':env},{'name':_0xbc14('0x6'),'script':path[_0xbc14('0x2')](__dirname,_0xbc14('0x7')),'env':env},{'name':_0xbc14('0x8'),'script':path[_0xbc14('0x2')](__dirname,_0xbc14('0x9')),'env':env},{'name':_0xbc14('0xa'),'script':path[_0xbc14('0x2')](__dirname,'../../services/email/index.js'),'env':env},{'name':_0xbc14('0xb'),'script':path[_0xbc14('0x2')](__dirname,_0xbc14('0xc')),'env':env},{'name':_0xbc14('0xd'),'script':path['join'](__dirname,_0xbc14('0xe')),'env':env}]};module[_0xbc14('0xf')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index c9bcc08..9005747 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 _0x623d=['disconnect','list','describe','delete','dump','saved','bluebird','./config','connected','start','stop','then','restart'];(function(_0x4cf3f0,_0x5f23ab){var _0x51deb5=function(_0x13e4c2){while(--_0x13e4c2){_0x4cf3f0['push'](_0x4cf3f0['shift']());}};_0x51deb5(++_0x5f23ab);}(_0x623d,0xf0));var _0xd623=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x623d[_0xf71120];return _0xbe2fd3;};'use strict';var pm2=require('pm2');var BPromise=require(_0xd623('0x0'));var config=require(_0xd623('0x1'));function connect(){return new BPromise(function(_0x36a028,_0x3703b4){return pm2['connect'](function(_0x250320){if(_0x250320){return _0x3703b4(_0x250320);}return _0x36a028(_0xd623('0x2'));});});};exports[_0xd623('0x3')]=function(_0x22ce0d){return connect()['then'](function(){return new BPromise(function(_0x2f03e3,_0x249e61){return pm2[_0xd623('0x3')](_0x22ce0d,function(_0x57ffa2,_0x1b4a4f){if(_0x57ffa2){return _0x249e61(_0x57ffa2);}pm2['disconnect']();return _0x2f03e3(_0x1b4a4f);});});});};exports[_0xd623('0x4')]=function(_0x29bf0d){return connect()[_0xd623('0x5')](function(){return new BPromise(function(_0x19ba72,_0x29dc47){return pm2[_0xd623('0x4')](_0x29bf0d,function(_0x3f9ba8,_0xca627){if(_0x3f9ba8){return _0x29dc47(_0x3f9ba8);}pm2['disconnect']();return _0x19ba72(_0xca627);});});});};exports[_0xd623('0x6')]=function(_0x27a8cd){return connect()[_0xd623('0x5')](function(){return new BPromise(function(_0x4e69ea,_0x489754){return pm2[_0xd623('0x6')](_0x27a8cd,function(_0x63cbc1,_0x5de1b3){if(_0x63cbc1){return _0x489754(_0x63cbc1);}pm2[_0xd623('0x7')]();return _0x4e69ea(_0x5de1b3);});});});};exports[_0xd623('0x8')]=function(){return connect()[_0xd623('0x5')](function(){return new BPromise(function(_0x584602,_0x57e345){return pm2[_0xd623('0x8')](function(_0x5a2e87,_0x24246f){if(_0x5a2e87){return _0x57e345(_0x5a2e87);}pm2[_0xd623('0x7')]();return _0x584602(_0x24246f);});});});};exports[_0xd623('0x9')]=function(_0x11badb){return connect()['then'](function(){return new BPromise(function(_0x84bf51,_0x5bbb9e){return pm2[_0xd623('0x9')](_0x11badb,function(_0x362b33,_0x25ca87){if(_0x362b33){return _0x5bbb9e(_0x362b33);}pm2[_0xd623('0x7')]();return _0x84bf51(_0x25ca87);});});});};exports[_0xd623('0xa')]=function(_0x1eff18){return connect()[_0xd623('0x5')](function(){return new BPromise(function(_0x5915b4,_0x43ebf3){return pm2[_0xd623('0xa')](_0x1eff18,function(_0xcfb1b5,_0x851b34){if(_0xcfb1b5){return _0x43ebf3(_0xcfb1b5);}pm2[_0xd623('0x7')]();return _0x5915b4(_0x851b34);});});});};exports[_0xd623('0xb')]=function(){return connect()['then'](function(){return new BPromise(function(_0x57a31e,_0x4a4a33){return pm2[_0xd623('0xb')](function(_0x330df1){if(_0x330df1){return _0x4a4a33(_0x330df1);}return _0x57a31e(_0xd623('0xc'));});});});}; \ No newline at end of file +var _0x28d6=['connect','connected','start','then','disconnect','stop','restart','describe','delete','dump','pm2','bluebird','./config'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x28d6,0x8c));var _0x628d=function(_0x2542d1,_0xdb7645){_0x2542d1=_0x2542d1-0x0;var _0xec2ce7=_0x28d6[_0x2542d1];return _0xec2ce7;};'use strict';var pm2=require(_0x628d('0x0'));var BPromise=require(_0x628d('0x1'));var config=require(_0x628d('0x2'));function connect(){return new BPromise(function(_0x10d9ee,_0x5db2b7){return pm2[_0x628d('0x3')](function(_0x50f59a){if(_0x50f59a){return _0x5db2b7(_0x50f59a);}return _0x10d9ee(_0x628d('0x4'));});});};exports[_0x628d('0x5')]=function(_0x52f2d8){return connect()[_0x628d('0x6')](function(){return new BPromise(function(_0x23d2ea,_0x2f50cc){return pm2[_0x628d('0x5')](_0x52f2d8,function(_0x33e57a,_0x3d4149){if(_0x33e57a){return _0x2f50cc(_0x33e57a);}pm2[_0x628d('0x7')]();return _0x23d2ea(_0x3d4149);});});});};exports[_0x628d('0x8')]=function(_0x53e79d){return connect()[_0x628d('0x6')](function(){return new BPromise(function(_0xedd02c,_0x51427a){return pm2[_0x628d('0x8')](_0x53e79d,function(_0x2a6d0e,_0x12ff18){if(_0x2a6d0e){return _0x51427a(_0x2a6d0e);}pm2[_0x628d('0x7')]();return _0xedd02c(_0x12ff18);});});});};exports[_0x628d('0x9')]=function(_0x2bf4d3){return connect()['then'](function(){return new BPromise(function(_0x577cd7,_0x37a9a7){return pm2[_0x628d('0x9')](_0x2bf4d3,function(_0xf47a7c,_0x4845d5){if(_0xf47a7c){return _0x37a9a7(_0xf47a7c);}pm2[_0x628d('0x7')]();return _0x577cd7(_0x4845d5);});});});};exports['list']=function(){return connect()[_0x628d('0x6')](function(){return new BPromise(function(_0x9d9afa,_0xef95f5){return pm2['list'](function(_0x27ea0b,_0x5449b2){if(_0x27ea0b){return _0xef95f5(_0x27ea0b);}pm2[_0x628d('0x7')]();return _0x9d9afa(_0x5449b2);});});});};exports[_0x628d('0xa')]=function(_0x3063bc){return connect()[_0x628d('0x6')](function(){return new BPromise(function(_0x15635f,_0x5dfe38){return pm2[_0x628d('0xa')](_0x3063bc,function(_0x47797f,_0x2c431e){if(_0x47797f){return _0x5dfe38(_0x47797f);}pm2[_0x628d('0x7')]();return _0x15635f(_0x2c431e);});});});};exports[_0x628d('0xb')]=function(_0x1bbeae){return connect()[_0x628d('0x6')](function(){return new BPromise(function(_0x1547ac,_0x46132c){return pm2[_0x628d('0xb')](_0x1bbeae,function(_0x15eaee,_0x5d19d5){if(_0x15eaee){return _0x46132c(_0x15eaee);}pm2['disconnect']();return _0x1547ac(_0x5d19d5);});});});};exports[_0x628d('0xc')]=function(){return connect()[_0x628d('0x6')](function(){return new BPromise(function(_0x5c1d9b,_0x409c64){return pm2[_0x628d('0xc')](function(_0x56cc13){if(_0x56cc13){return _0x409c64(_0x56cc13);}return _0x5c1d9b('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 177e0e0..9eea39f 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 _0xa712=['Setting','chatTimeout','then','lastMsgAt','subtract','minutes','length','info','[CHAT]\x20Interactions\x20to\x20close:','ChatInteraction','YYYY-MM-DD\x20HH:mm:ss','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','ioredis','util','../../config/environment','../logger','schedule','redis'];(function(_0x3c53bf,_0x43f522){var _0x55ebb6=function(_0x5a73ec){while(--_0x5a73ec){_0x3c53bf['push'](_0x3c53bf['shift']());}};_0x55ebb6(++_0x43f522);}(_0xa712,0x13c));var _0x2a71=function(_0x11a962,_0x3cc338){_0x11a962=_0x11a962-0x0;var _0x55d423=_0xa712[_0x11a962];return _0x55d423;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require(_0x2a71('0x0'));var util=require(_0x2a71('0x1'));var config=require(_0x2a71('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x2a71('0x3'))(_0x2a71('0x4'));config[_0x2a71('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2a71('0x5')]));function closeInteractions(){var _0x277882=0x0;var _0x276674=[];return db[_0x2a71('0x6')]['find']({'raw':!![],'attributes':['id',_0x2a71('0x7')],'where':{'id':0x1}})[_0x2a71('0x8')](function(_0x379a6b){_0x277882=_0x379a6b[_0x2a71('0x7')];if(_0x277882){return db['ChatInteraction']['findAll']({'raw':!![],'attributes':['id',_0x2a71('0x9')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x2a71('0xa')](_0x379a6b['chatTimeout'],_0x2a71('0xb'))}}});}else{return[];}})[_0x2a71('0x8')](function(_0x73ba21){if(_0x73ba21&&_0x73ba21[_0x2a71('0xc')]){_0x276674=_['map'](_0x73ba21||[],'id');logger[_0x2a71('0xd')](_0x2a71('0xe'),_0x276674['join']());return db[_0x2a71('0xf')]['update']({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0x2a71('0x10'))},{'where':{'id':_0x276674}});}})[_0x2a71('0x8')](function(){if(_0x276674&&_0x276674[_0x2a71('0xc')]){logger[_0x2a71('0xd')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x276674['join']());for(var _0x5819cc=0x0;_0x5819cc<_0x276674[_0x2a71('0xc')];_0x5819cc++){io['emit'](_0x2a71('0x11'),{'id':_0x276674[_0x5819cc],'closed':!![]});}}})[_0x2a71('0x12')](function(_0x487d6d){logger[_0x2a71('0x13')](_0x2a71('0x14'),_0x487d6d?util[_0x2a71('0x15')](_0x487d6d,{'showHidden':![],'depth':null}):'');});}exports[_0x2a71('0x16')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xd3ef=['length','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','../../config/environment','../../mysqldb','../logger','defaults','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','subtract','minutes'];(function(_0x1c34e7,_0x33f9a8){var _0x378cb1=function(_0x10b5e3){while(--_0x10b5e3){_0x1c34e7['push'](_0x1c34e7['shift']());}};_0x378cb1(++_0x33f9a8);}(_0xd3ef,0x138));var _0xfd3e=function(_0x1fdded,_0x231a90){_0x1fdded=_0x1fdded-0x0;var _0x22f6b5=_0xd3ef[_0x1fdded];return _0x22f6b5;};'use strict';var _=require(_0xfd3e('0x0'));var moment=require(_0xfd3e('0x1'));var Redis=require(_0xfd3e('0x2'));var util=require('util');var config=require(_0xfd3e('0x3'));var db=require(_0xfd3e('0x4'))['db'];var logger=require(_0xfd3e('0x5'))('schedule');config['redis']=_[_0xfd3e('0x6')](config[_0xfd3e('0x7')],{'host':_0xfd3e('0x8'),'port':0x18eb});var io=require(_0xfd3e('0x9'))(new Redis(config[_0xfd3e('0x7')]));function closeInteractions(){var _0x1f25d4=0x0;var _0x2b2329=[];return db[_0xfd3e('0xa')][_0xfd3e('0xb')]({'raw':!![],'attributes':['id',_0xfd3e('0xc')],'where':{'id':0x1}})[_0xfd3e('0xd')](function(_0x42e534){_0x1f25d4=_0x42e534['chatTimeout'];if(_0x1f25d4){return db[_0xfd3e('0xe')][_0xfd3e('0xf')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xfd3e('0x10')](_0x42e534[_0xfd3e('0xc')],_0xfd3e('0x11'))}}});}else{return[];}})[_0xfd3e('0xd')](function(_0x4ab30e){if(_0x4ab30e&&_0x4ab30e[_0xfd3e('0x12')]){_0x2b2329=_['map'](_0x4ab30e||[],'id');logger[_0xfd3e('0x13')](_0xfd3e('0x14'),_0x2b2329[_0xfd3e('0x15')]());return db['ChatInteraction'][_0xfd3e('0x16')]({'closeReason':_0xfd3e('0x17'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xfd3e('0x18')](_0xfd3e('0x19'))},{'where':{'id':_0x2b2329}});}})[_0xfd3e('0xd')](function(){if(_0x2b2329&&_0x2b2329[_0xfd3e('0x12')]){logger[_0xfd3e('0x13')](_0xfd3e('0x1a'),_0x2b2329[_0xfd3e('0x15')]());for(var _0x391022=0x0;_0x391022<_0x2b2329[_0xfd3e('0x12')];_0x391022++){io['emit'](_0xfd3e('0x1b'),{'id':_0x2b2329[_0x391022],'closed':!![]});}}})[_0xfd3e('0x1c')](function(_0x1e6a5d){logger[_0xfd3e('0x1d')](_0xfd3e('0x1e'),_0x1e6a5d?util[_0xfd3e('0x1f')](_0x1e6a5d,{'showHidden':![],'depth':null}):'');});}exports[_0xfd3e('0x20')]=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 74778cc..d79f69b 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 _0x6968=['exports','../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x2d4535,_0x5cb24a){var _0x47ec48=function(_0x403e28){while(--_0x403e28){_0x2d4535['push'](_0x2d4535['shift']());}};_0x47ec48(++_0x5cb24a);}(_0x6968,0x13f));var _0x8696=function(_0xab58e1,_0x5d47ce){_0xab58e1=_0xab58e1-0x0;var _0x295351=_0x6968[_0xab58e1];return _0x295351;};'use strict';function start(){var _0x41562d=require(_0x8696('0x0'));return _0x41562d[_0x8696('0x1')]();}module[_0x8696('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x8185=['startAllRefreshIntervals'];(function(_0x3208c7,_0x579ce1){var _0x371f49=function(_0x51be19){while(--_0x51be19){_0x3208c7['push'](_0x3208c7['shift']());}};_0x371f49(++_0x579ce1);}(_0x8185,0x67));var _0x5818=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x8185[_0x50a0c2];return _0x5ebadd;};'use strict';function start(){var _0x3f495f=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x3f495f[_0x5818('0x0')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 5318184..fcb4f99 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 _0xddb3=['intersection','exists','stop','delete\x20cron','toRun','length','index','my\x20id','resolve','active','endAt','add','cron','start','add\x20cron','deleteJob','isBetween','startAt','update\x20cron','stop\x20cron','run','lodash','moment','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','getSmtpOptions','MailAccount','name','email','Smtp','user','bcc','format','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','zip','existsSync','status','Sent','message','attachments','text','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','SendMail','error','error\x20mail','email\x20sent','catch','data','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','isNil','DefaultReportId','runReport','then','CustomReportId','exec\x20custom\x20report\x20id:%s','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','map','toString','keyBy','difference'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xddb3,0x11a));var _0x3ddb=function(_0x146495,_0x1e4876){_0x146495=_0x146495-0x0;var _0x3e4adb=_0xddb3[_0x146495];return _0x3e4adb;};'use strict';var fs=require('fs');var util=require('util');var path=require('path');var _=require(_0x3ddb('0x0'));var moment=require(_0x3ddb('0x1'));var CronJobManager=require('cron-job-manager');var jayson=require(_0x3ddb('0x2'));var BPromise=require(_0x3ddb('0x3'));var logger=require(_0x3ddb('0x4'))(_0x3ddb('0x5'));var db=require(_0x3ddb('0x6'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x3ddb('0x7'));var client=jayson[_0x3ddb('0x8')][_0x3ddb('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x489c11,_0xd4557d){return function(){logger[_0x3ddb('0xa')](_0x3ddb('0xb'),_0x489c11['email']);var _0x166bf9=!![];var _0x4cca73=_0x489c11['MailAccount'][_0x3ddb('0xc')]();var _0x1d795f={'account':_0x4cca73,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x489c11[_0x3ddb('0xd')][_0x3ddb('0xe')],_0x489c11[_0x3ddb('0xd')][_0x3ddb('0xf')]||_0x489c11['MailAccount'][_0x3ddb('0x10')][_0x3ddb('0x11')]),'to':_0x489c11[_0x3ddb('0xf')],'cc':_0x489c11['cc'],'bcc':_0x489c11[_0x3ddb('0x12')],'subject':util[_0x3ddb('0x13')](_0x3ddb('0x14'),_0xd4557d['name'],_0x489c11[_0x3ddb('0x15')],_0x489c11[_0x3ddb('0x16')])}};var _0xb2b440=path[_0x3ddb('0x17')](__dirname,_0x3ddb('0x18'));var _0x48bd76=_0xd4557d[_0x3ddb('0x19')];var _0x4ab814=util['format'](_0x3ddb('0x1a'),path[_0x3ddb('0x1b')](_0xd4557d[_0x3ddb('0x19')],path['extname'](_0xd4557d[_0x3ddb('0x19')])),_0x3ddb('0x1c'));var _0x38b1b0=path[_0x3ddb('0x17')](_0xb2b440,_0x48bd76);var _0x1517e4=path[_0x3ddb('0x17')](_0xb2b440,_0x4ab814);if(fs[_0x3ddb('0x1d')](_0x38b1b0)){_0xd4557d[_0x3ddb('0x1e')]=_0x3ddb('0x1f');_0x1d795f[_0x3ddb('0x20')][_0x3ddb('0x21')]=[{'filename':_0x48bd76,'path':_0x38b1b0}];_0x1d795f[_0x3ddb('0x20')][_0x3ddb('0x22')]=util['format']('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x3ddb('0x23')](_0xd4557d,null,0x2));}else if(fs[_0x3ddb('0x1d')](_0x1517e4)){_0xd4557d[_0x3ddb('0x1e')]=_0x3ddb('0x1f');_0x1d795f[_0x3ddb('0x20')][_0x3ddb('0x21')]=[{'filename':_0x4ab814,'path':_0x1517e4}];}else{_0x1d795f[_0x3ddb('0x20')][_0x3ddb('0x22')]=_0x3ddb('0x24');if(!_0x489c11['sendIfEmpty']){_0x166bf9=![];logger[_0x3ddb('0xa')](_0x3ddb('0x25'));}}if(_0x166bf9){return client[_0x3ddb('0x26')](_0x3ddb('0x27'),_0x1d795f)['then'](function(_0x10f267){if(_0x10f267['error']){return logger[_0x3ddb('0x28')](_0x3ddb('0x29'),JSON[_0x3ddb('0x23')](_0x10f267));}return logger[_0x3ddb('0xa')](_0x3ddb('0x2a'));})[_0x3ddb('0x2b')](function(_0x38d127){return logger[_0x3ddb('0x28')](_0x3ddb('0x29'),JSON[_0x3ddb('0x23')](_0x38d127));});}};}function handleError(){return function(_0x2fdea9){return logger[_0x3ddb('0x28')](JSON['stringify'](_0x2fdea9));};}function handleResult(_0x229449){return function(_0x133e0b){logger[_0x3ddb('0xa')](_0x3ddb('0x2c'),JSON['stringify'](_0x133e0b));if(_0x229449[_0x3ddb('0xd')]&&_0x229449[_0x3ddb('0xd')]['Smtp']&&!_['isNil'](_0x229449['email'])){setTimeout(handleSendEmail(_0x229449,_0x133e0b),0x3c*0x3e8);}};}function handleJob(_0x3b12a3){return function(){try{if(_['isNil'](_0x3b12a3[_0x3ddb('0x15')])){return logger['info'](_0x3ddb('0x2d'));}if(_['isNil'](_0x3b12a3[_0x3ddb('0x16')])){return logger[_0x3ddb('0xa')](_0x3ddb('0x2e'));}var _0x5c9f6a={'startDate':moment()[_0x3ddb('0x2f')](_0x3b12a3[_0x3ddb('0x15')],_0x3b12a3[_0x3ddb('0x16')])[_0x3ddb('0x13')](_0x3ddb('0x30')),'endDate':moment()[_0x3ddb('0x13')](_0x3ddb('0x30')),'type':'scheduled','output':_0x3b12a3[_0x3ddb('0x31')],'name':_0x3b12a3['name']};if(!_[_0x3ddb('0x32')](_0x3b12a3[_0x3ddb('0x33')])){logger[_0x3ddb('0xa')]('exec\x20defaul\x20report\x20id:%s',_0x3b12a3[_0x3ddb('0x33')]);return analyticDefaultReportController[_0x3ddb('0x34')]({'id':_0x3b12a3[_0x3ddb('0x33')]},_0x5c9f6a)[_0x3ddb('0x35')](handleResult(_0x3b12a3))[_0x3ddb('0x2b')](handleError());}if(!_['isNil'](_0x3b12a3[_0x3ddb('0x36')])){logger[_0x3ddb('0xa')](_0x3ddb('0x37'),_0x3b12a3[_0x3ddb('0x36')]);return analyticCustomReportController[_0x3ddb('0x34')]({'id':_0x3b12a3[_0x3ddb('0x36')]},_0x5c9f6a)[_0x3ddb('0x35')](handleResult(_0x3b12a3))['catch'](handleError());}}catch(_0x45da65){logger['error'](JSON[_0x3ddb('0x23')](_0x45da65));}return logger[_0x3ddb('0xa')]('no\x20report\x20id');};}function getJobs(_0x38ad4e){var _0x352c6b={};if(_0x38ad4e){_0x352c6b['id']=_0x38ad4e;}return db[_0x3ddb('0x38')][_0x3ddb('0x39')]({'where':_0x352c6b,'include':[{'model':db[_0x3ddb('0xd')],'attributes':['id',_0x3ddb('0xe'),_0x3ddb('0xf')],'include':[{'model':db[_0x3ddb('0x3a')],'as':_0x3ddb('0x10'),'include':[{'model':db[_0x3ddb('0x3b')],'as':_0x3ddb('0x3b')}]}]}]})[_0x3ddb('0x35')](function(_0x2f4a53){var _0x3c66f4=_[_0x3ddb('0x3c')](manager[_0x3ddb('0x3d')]);var _0xad71c8=_[_0x3ddb('0x3e')](_0x2f4a53,function(_0x5ede6a){return _0x5ede6a['id'][_0x3ddb('0x3f')]();});var _0x571024=_[_0x3ddb('0x40')](_0x2f4a53,function(_0x287afd){return _0x287afd['id'][_0x3ddb('0x3f')]();});var _0x18cad5=_0x38ad4e?_0xad71c8:_[_0x3ddb('0x41')](_0xad71c8,_0x3c66f4);var _0x3b41f2=_[_0x3ddb('0x42')](_0xad71c8,_0x3c66f4);var _0x19fedd=_[_0x3ddb('0x41')](_0x3c66f4,_0xad71c8);var _0x49f3ca;var _0x349955;for(_0x49f3ca=0x0;_0x49f3ca<_0x19fedd['length']&&!_0x38ad4e;_0x49f3ca+=0x1){_0x349955=_0x19fedd[_0x49f3ca][_0x3ddb('0x3f')]();if(manager[_0x3ddb('0x43')](_0x349955)){manager[_0x3ddb('0x44')](_0x349955);manager['deleteJob'](_0x349955);logger['info'](_0x3ddb('0x45'),_0x349955);}}logger[_0x3ddb('0xa')](_0x3ddb('0x46'),JSON[_0x3ddb('0x23')](_0x18cad5));for(_0x49f3ca=0x0;_0x49f3ca<_0x18cad5[_0x3ddb('0x47')];_0x49f3ca+=0x1){_0x349955=_0x18cad5[_0x49f3ca][_0x3ddb('0x3f')]();logger[_0x3ddb('0xa')](_0x3ddb('0x48'),_0x349955);if(_0x38ad4e){logger['info'](_0x3ddb('0x49'),_0x38ad4e);logger['info'](JSON['stringify'](_0x571024[_0x349955]));BPromise[_0x3ddb('0x4a')]()[_0x3ddb('0x35')](handleJob(_0x571024[_0x349955]));logger['info']('run\x20job',_0x571024[_0x349955]['name'],_0x571024[_0x349955]['cron']);}else if(_0x571024[_0x349955]['cron']&&_0x571024[_0x349955][_0x3ddb('0x4b')]&&moment()['isBetween'](_0x571024[_0x349955]['startAt'],_0x571024[_0x349955][_0x3ddb('0x4c')])){manager[_0x3ddb('0x4d')](_0x349955,_0x571024[_0x349955][_0x3ddb('0x4e')],handleJob(_0x571024[_0x349955]));manager[_0x3ddb('0x4f')](_0x349955);logger[_0x3ddb('0xa')](_0x3ddb('0x50'),_0x571024[_0x349955][_0x3ddb('0xe')],_0x571024[_0x349955]['cron']);}else if(manager[_0x3ddb('0x43')](_0x349955)){manager[_0x3ddb('0x44')](_0x349955);manager[_0x3ddb('0x51')](_0x349955);logger[_0x3ddb('0xa')]('stop\x20cron',_0x571024[_0x349955][_0x3ddb('0xe')],_0x571024[_0x349955][_0x3ddb('0x4e')]);}}for(_0x49f3ca=0x0,_0x349955;_0x49f3ca<_0x3b41f2[_0x3ddb('0x47')]&&!_0x38ad4e;_0x49f3ca+=0x1){_0x349955=_0x3b41f2[_0x49f3ca][_0x3ddb('0x3f')]();if(manager[_0x3ddb('0x43')](_0x349955)){if(_0x571024[_0x349955][_0x3ddb('0x4e')]&&_0x571024[_0x349955][_0x3ddb('0x4b')]&&moment()[_0x3ddb('0x52')](_0x571024[_0x349955][_0x3ddb('0x53')],_0x571024[_0x349955][_0x3ddb('0x4c')])){manager['update'](_0x349955,_0x571024[_0x349955][_0x3ddb('0x4e')],handleJob(_0x571024[_0x349955]));logger[_0x3ddb('0xa')](_0x3ddb('0x54'),_0x571024[_0x349955][_0x3ddb('0xe')],_0x571024[_0x349955]['cron']);}else{manager[_0x3ddb('0x44')](_0x349955);manager[_0x3ddb('0x51')](_0x349955);logger[_0x3ddb('0xa')](_0x3ddb('0x55'),_0x571024[_0x349955][_0x3ddb('0xe')],_0x571024[_0x349955][_0x3ddb('0x4e')]);}}}})[_0x3ddb('0x2b')](function(_0x3d2684){logger['error'](JSON['stringify'](_0x3d2684));});}exports[_0x3ddb('0x56')]=function(_0x22706a){return getJobs(_0x22706a);};exports[_0x3ddb('0x4f')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x5823=['jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','format','\x22%s\x22\x20<%s>','name','Smtp','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','extname','existsSync','status','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','attachments','info','empty\x20file,\x20email\x20not\x20sent','request','then','error','error\x20mail','data','isNil','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','catch','CustomReportId','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','map','toString','keyBy','difference','intersection','exists','stop','delete\x20cron','length','index','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','deleteJob','update\x20cron','util','path','moment','cron-job-manager'];(function(_0x7aee79,_0x124af2){var _0xcbf9d1=function(_0x3f9f5f){while(--_0x3f9f5f){_0x7aee79['push'](_0x7aee79['shift']());}};_0xcbf9d1(++_0x124af2);}(_0x5823,0x9a));var _0x3582=function(_0x4e65a6,_0x4ab4d6){_0x4e65a6=_0x4e65a6-0x0;var _0x4fdb88=_0x5823[_0x4e65a6];return _0x4fdb88;};'use strict';var fs=require('fs');var util=require(_0x3582('0x0'));var path=require(_0x3582('0x1'));var _=require('lodash');var moment=require(_0x3582('0x2'));var CronJobManager=require(_0x3582('0x3'));var jayson=require(_0x3582('0x4'));var BPromise=require(_0x3582('0x5'));var logger=require(_0x3582('0x6'))(_0x3582('0x7'));var db=require(_0x3582('0x8'))['db'];var analyticCustomReportController=require(_0x3582('0x9'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x3582('0xa')][_0x3582('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x5e148c,_0xfe1e3e){return function(){logger['info'](_0x3582('0xc'),_0x5e148c[_0x3582('0xd')]);var _0x3a3ddd=!![];var _0x3cffa2=_0x5e148c[_0x3582('0xe')]['getSmtpOptions']();var _0x44debf={'account':_0x3cffa2,'message':{'from':util[_0x3582('0xf')](_0x3582('0x10'),_0x5e148c[_0x3582('0xe')][_0x3582('0x11')],_0x5e148c[_0x3582('0xe')][_0x3582('0xd')]||_0x5e148c[_0x3582('0xe')][_0x3582('0x12')]['user']),'to':_0x5e148c[_0x3582('0xd')],'cc':_0x5e148c['cc'],'bcc':_0x5e148c['bcc'],'subject':util[_0x3582('0xf')](_0x3582('0x13'),_0xfe1e3e['name'],_0x5e148c[_0x3582('0x14')],_0x5e148c[_0x3582('0x15')])}};var _0x5d0dbf=path[_0x3582('0x16')](__dirname,_0x3582('0x17'));var _0x3f18cf=_0xfe1e3e[_0x3582('0x18')];var _0x1cfde6=util[_0x3582('0xf')]('%s.%s',path['basename'](_0xfe1e3e['savename'],path[_0x3582('0x19')](_0xfe1e3e[_0x3582('0x18')])),'zip');var _0x49e492=path[_0x3582('0x16')](_0x5d0dbf,_0x3f18cf);var _0x16be58=path[_0x3582('0x16')](_0x5d0dbf,_0x1cfde6);if(fs[_0x3582('0x1a')](_0x49e492)){_0xfe1e3e[_0x3582('0x1b')]=_0x3582('0x1c');_0x44debf[_0x3582('0x1d')]['attachments']=[{'filename':_0x3f18cf,'path':_0x49e492}];_0x44debf[_0x3582('0x1d')][_0x3582('0x1e')]=util[_0x3582('0xf')](_0x3582('0x1f'),JSON[_0x3582('0x20')](_0xfe1e3e,null,0x2));}else if(fs[_0x3582('0x1a')](_0x16be58)){_0xfe1e3e['status']=_0x3582('0x1c');_0x44debf[_0x3582('0x1d')][_0x3582('0x21')]=[{'filename':_0x1cfde6,'path':_0x16be58}];}else{_0x44debf[_0x3582('0x1d')][_0x3582('0x1e')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x5e148c['sendIfEmpty']){_0x3a3ddd=![];logger[_0x3582('0x22')](_0x3582('0x23'));}}if(_0x3a3ddd){return client[_0x3582('0x24')]('SendMail',_0x44debf)[_0x3582('0x25')](function(_0x6b548c){if(_0x6b548c[_0x3582('0x26')]){return logger[_0x3582('0x26')]('error\x20mail',JSON[_0x3582('0x20')](_0x6b548c));}return logger['info']('email\x20sent');})['catch'](function(_0x509d3f){return logger['error'](_0x3582('0x27'),JSON[_0x3582('0x20')](_0x509d3f));});}};}function handleError(){return function(_0x158e09){return logger['error'](JSON[_0x3582('0x20')](_0x158e09));};}function handleResult(_0x34e1e6){return function(_0x479303){logger[_0x3582('0x22')](_0x3582('0x28'),JSON[_0x3582('0x20')](_0x479303));if(_0x34e1e6[_0x3582('0xe')]&&_0x34e1e6[_0x3582('0xe')][_0x3582('0x12')]&&!_[_0x3582('0x29')](_0x34e1e6[_0x3582('0xd')])){setTimeout(handleSendEmail(_0x34e1e6,_0x479303),0x3c*0x3e8);}};}function handleJob(_0x3a969a){return function(){try{if(_['isNil'](_0x3a969a[_0x3582('0x14')])){return logger[_0x3582('0x22')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x3582('0x29')](_0x3a969a['subtractUnit'])){return logger[_0x3582('0x22')]('subtractUnit\x20null\x20or\x20undefined');}var _0x53d2af={'startDate':moment()[_0x3582('0x2a')](_0x3a969a[_0x3582('0x14')],_0x3a969a[_0x3582('0x15')])[_0x3582('0xf')](_0x3582('0x2b')),'endDate':moment()['format'](_0x3582('0x2b')),'type':_0x3582('0x2c'),'output':_0x3a969a[_0x3582('0x2d')],'name':_0x3a969a['name']};if(!_[_0x3582('0x29')](_0x3a969a[_0x3582('0x2e')])){logger['info'](_0x3582('0x2f'),_0x3a969a[_0x3582('0x2e')]);return analyticDefaultReportController[_0x3582('0x30')]({'id':_0x3a969a[_0x3582('0x2e')]},_0x53d2af)[_0x3582('0x25')](handleResult(_0x3a969a))[_0x3582('0x31')](handleError());}if(!_['isNil'](_0x3a969a[_0x3582('0x32')])){logger['info']('exec\x20custom\x20report\x20id:%s',_0x3a969a[_0x3582('0x32')]);return analyticCustomReportController[_0x3582('0x30')]({'id':_0x3a969a[_0x3582('0x32')]},_0x53d2af)['then'](handleResult(_0x3a969a))['catch'](handleError());}}catch(_0x4e563f){logger[_0x3582('0x26')](JSON[_0x3582('0x20')](_0x4e563f));}return logger[_0x3582('0x22')]('no\x20report\x20id');};}function getJobs(_0x21f792){var _0x4bcfde={};if(_0x21f792){_0x4bcfde['id']=_0x21f792;}return db[_0x3582('0x33')][_0x3582('0x34')]({'where':_0x4bcfde,'include':[{'model':db['MailAccount'],'attributes':['id',_0x3582('0x11'),'email'],'include':[{'model':db[_0x3582('0x35')],'as':_0x3582('0x12'),'include':[{'model':db[_0x3582('0x36')],'as':_0x3582('0x36')}]}]}]})['then'](function(_0x210c46){var _0x4739d4=_[_0x3582('0x37')](manager[_0x3582('0x38')]);var _0x3ea561=_[_0x3582('0x39')](_0x210c46,function(_0x26ea60){return _0x26ea60['id'][_0x3582('0x3a')]();});var _0x124d93=_[_0x3582('0x3b')](_0x210c46,function(_0x390a73){return _0x390a73['id'][_0x3582('0x3a')]();});var _0xaa596b=_0x21f792?_0x3ea561:_[_0x3582('0x3c')](_0x3ea561,_0x4739d4);var _0x5af0c3=_[_0x3582('0x3d')](_0x3ea561,_0x4739d4);var _0x316ad5=_[_0x3582('0x3c')](_0x4739d4,_0x3ea561);var _0x50144b;var _0x21e053;for(_0x50144b=0x0;_0x50144b<_0x316ad5['length']&&!_0x21f792;_0x50144b+=0x1){_0x21e053=_0x316ad5[_0x50144b][_0x3582('0x3a')]();if(manager[_0x3582('0x3e')](_0x21e053)){manager[_0x3582('0x3f')](_0x21e053);manager['deleteJob'](_0x21e053);logger[_0x3582('0x22')](_0x3582('0x40'),_0x21e053);}}logger[_0x3582('0x22')]('toRun',JSON[_0x3582('0x20')](_0xaa596b));for(_0x50144b=0x0;_0x50144b<_0xaa596b[_0x3582('0x41')];_0x50144b+=0x1){_0x21e053=_0xaa596b[_0x50144b][_0x3582('0x3a')]();logger[_0x3582('0x22')](_0x3582('0x42'),_0x21e053);if(_0x21f792){logger[_0x3582('0x22')]('my\x20id',_0x21f792);logger[_0x3582('0x22')](JSON['stringify'](_0x124d93[_0x21e053]));BPromise[_0x3582('0x43')]()[_0x3582('0x25')](handleJob(_0x124d93[_0x21e053]));logger[_0x3582('0x22')](_0x3582('0x44'),_0x124d93[_0x21e053][_0x3582('0x11')],_0x124d93[_0x21e053]['cron']);}else if(_0x124d93[_0x21e053][_0x3582('0x45')]&&_0x124d93[_0x21e053][_0x3582('0x46')]&&moment()[_0x3582('0x47')](_0x124d93[_0x21e053][_0x3582('0x48')],_0x124d93[_0x21e053][_0x3582('0x49')])){manager[_0x3582('0x4a')](_0x21e053,_0x124d93[_0x21e053][_0x3582('0x45')],handleJob(_0x124d93[_0x21e053]));manager[_0x3582('0x4b')](_0x21e053);logger[_0x3582('0x22')](_0x3582('0x4c'),_0x124d93[_0x21e053][_0x3582('0x11')],_0x124d93[_0x21e053][_0x3582('0x45')]);}else if(manager[_0x3582('0x3e')](_0x21e053)){manager['stop'](_0x21e053);manager[_0x3582('0x4d')](_0x21e053);logger[_0x3582('0x22')]('stop\x20cron',_0x124d93[_0x21e053][_0x3582('0x11')],_0x124d93[_0x21e053]['cron']);}}for(_0x50144b=0x0,_0x21e053;_0x50144b<_0x5af0c3['length']&&!_0x21f792;_0x50144b+=0x1){_0x21e053=_0x5af0c3[_0x50144b][_0x3582('0x3a')]();if(manager[_0x3582('0x3e')](_0x21e053)){if(_0x124d93[_0x21e053][_0x3582('0x45')]&&_0x124d93[_0x21e053][_0x3582('0x46')]&&moment()[_0x3582('0x47')](_0x124d93[_0x21e053][_0x3582('0x48')],_0x124d93[_0x21e053]['endAt'])){manager['update'](_0x21e053,_0x124d93[_0x21e053]['cron'],handleJob(_0x124d93[_0x21e053]));logger['info'](_0x3582('0x4e'),_0x124d93[_0x21e053][_0x3582('0x11')],_0x124d93[_0x21e053][_0x3582('0x45')]);}else{manager[_0x3582('0x3f')](_0x21e053);manager[_0x3582('0x4d')](_0x21e053);logger[_0x3582('0x22')]('stop\x20cron',_0x124d93[_0x21e053]['name'],_0x124d93[_0x21e053][_0x3582('0x45')]);}}}})['catch'](function(_0x195609){logger[_0x3582('0x26')](JSON[_0x3582('0x20')](_0x195609));});}exports['run']=function(_0xb53559){return getJobs(_0xb53559);};exports[_0x3582('0x4b')]=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 55f4915..01e9abd 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 _0x4f7b=['Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','Cloud\x20Provider\x20not\x20configured','COMPLETED','name','SequelizeValidationError','error','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','transcribeAccountId','Transcribe\x20not\x20configured','push','all','catch','start','lodash','aws-sdk','request-promise','util','../../mysqldb','../../config/logger','transcribe','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','transcribeRegion','transcribeName','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','TranscriptionJobStatus','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','bucket','sentimentAccountId','CloudProvider','Cloud\x20Provider\x20not\x20available','data2','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore'];(function(_0x50bc20,_0x333419){var _0x5eb8f7=function(_0x1a3f43){while(--_0x1a3f43){_0x50bc20['push'](_0x50bc20['shift']());}};_0x5eb8f7(++_0x333419);}(_0x4f7b,0x13e));var _0xb4f7=function(_0x26a76a,_0x2ae544){_0x26a76a=_0x26a76a-0x0;var _0x4f2616=_0x4f7b[_0x26a76a];return _0x4f2616;};var _=require(_0xb4f7('0x0'));var AWS=require(_0xb4f7('0x1'));var rp=require(_0xb4f7('0x2'));var util=require(_0xb4f7('0x3'));var BPromise=require('bluebird');var db=require(_0xb4f7('0x4'))['db'];var logger=require(_0xb4f7('0x5'))(_0xb4f7('0x6'));function getTranscriptionJob(_0x297970,_0x1d34b7,_0x37ef5a,_0x2dd6fd){return new Promise(function(_0x15443c,_0x4d2d83){var _0x27872e=new AWS['TranscribeService']({'accessKeyId':_0x1d34b7,'secretAccessKey':_0x297970,'region':_0x37ef5a});_0x27872e[_0xb4f7('0x7')]({'TranscriptionJobName':_0x2dd6fd},function(_0xf56d08,_0x2849ed){if(_0xf56d08){return _0x4d2d83(_0xf56d08);}else{return _0x15443c(_0x2849ed);}});});}function sentiment(_0x481cd3,_0x341f95,_0x5af41f,_0x3b3dc6,_0xa74c93){return new Promise(function(_0x1b0cb7,_0x5b372a){var _0x38e537=new AWS[(_0xb4f7('0x8'))]({'accessKeyId':_0x341f95,'secretAccessKey':_0x481cd3,'region':_0x5af41f});_0x38e537[_0xb4f7('0x9')]({'Text':_0x3b3dc6,'LanguageCode':_0xa74c93[_0xb4f7('0xa')](0x0,0x2)},function(_0x42af4e,_0x33c6f3){if(_0x42af4e){return _0x5b372a(_0x42af4e);}else{return _0x1b0cb7(_0x33c6f3);}});});}function checkTranscribeJob(_0x3195c5,_0x3025f5,_0x571e0e){var _0x28f487;return new BPromise(function(_0x226994,_0x43e112){logger[_0xb4f7('0xb')](util[_0xb4f7('0xc')](_0xb4f7('0xd'),_0x3195c5['id'],_0x3195c5['transcribeName']));return getTranscriptionJob(_0x571e0e[_0xb4f7('0xe')],_0x571e0e['data2'],_0x3025f5[_0xb4f7('0xf')],_0x3195c5[_0xb4f7('0x10')])[_0xb4f7('0x11')](function(_0x2c304b){logger[_0xb4f7('0xb')](util[_0xb4f7('0xc')](_0xb4f7('0x12'),_0x3195c5['id'],_0x3195c5[_0xb4f7('0x10')],_0x2c304b[_0xb4f7('0x13')]['TranscriptionJobStatus']));if(!_0x3195c5[_0xb4f7('0x14')]){switch(_0x2c304b[_0xb4f7('0x13')][_0xb4f7('0x15')]){case'COMPLETED':var _0x186748={'transcribeStatus':_0x2c304b[_0xb4f7('0x13')][_0xb4f7('0x15')],'fileUri':_0x2c304b['TranscriptionJob']['Transcript'][_0xb4f7('0x16')]};logger[_0xb4f7('0xb')](util['format'](_0xb4f7('0x17'),_0x3195c5['id']));return rp({'uri':_0x2c304b[_0xb4f7('0x13')][_0xb4f7('0x18')][_0xb4f7('0x16')],'json':!![]})['then'](function(_0x25fca1){logger['info'](util[_0xb4f7('0xc')](_0xb4f7('0x19'),_0x3195c5['id']));if(_0x25fca1&&_0x25fca1[_0xb4f7('0x1a')]&&_0x25fca1[_0xb4f7('0x1a')][_0xb4f7('0x1b')]&&_0x25fca1[_0xb4f7('0x1a')]['transcripts'][_0xb4f7('0x1c')]){_0x186748[_0xb4f7('0x14')]='';for(var _0x19e549=0x0;_0x19e549<_0x25fca1[_0xb4f7('0x1a')][_0xb4f7('0x1b')][_0xb4f7('0x1c')];_0x19e549++){_0x186748['fileText']+=_0x25fca1[_0xb4f7('0x1a')][_0xb4f7('0x1b')][_0x19e549][_0xb4f7('0x1d')]+'';}}return _0x3195c5[_0xb4f7('0x1e')](_0x186748);})[_0xb4f7('0x11')](function(){logger['info'](util[_0xb4f7('0xc')](_0xb4f7('0x1f'),_0x3195c5['id']));if(!_0x3195c5['tempSentiment']){throw new db[(_0xb4f7('0x20'))][(_0xb4f7('0x21'))](_0xb4f7('0x22'));}if(!_0x3025f5[_0xb4f7('0x23')]||!_0x3025f5['sentimentAccountId']||!_0x3025f5[_0xb4f7('0x24')]||!_0x3025f5[_0xb4f7('0x25')]||!_0x3025f5[_0xb4f7('0x26')]){throw new db[(_0xb4f7('0x20'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x186748[_0xb4f7('0x14')]){throw new Error('Transcript\x20not\x20available');}if(_0x3025f5[_0xb4f7('0x27')]===_0x571e0e['id']){return _0x571e0e;}else{return db[_0xb4f7('0x28')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})[_0xb4f7('0x11')](function(_0x5bf429){if(!_0x5bf429){throw new db[(_0xb4f7('0x20'))][(_0xb4f7('0x21'))](_0xb4f7('0x29'));}if(!_0x5bf429[_0xb4f7('0xe')]||!_0x5bf429[_0xb4f7('0x2a')]){throw new db[(_0xb4f7('0x20'))][(_0xb4f7('0x21'))]('Cloud\x20Provider\x20not\x20configured');}_0x28f487=_0x5bf429;logger['info'](util[_0xb4f7('0xc')](_0xb4f7('0x2b'),_0x3195c5['id']));return sentiment(_0x28f487['data1'],_0x28f487[_0xb4f7('0x2a')],_0x3025f5['sentimentRegion'],_0x186748[_0xb4f7('0x14')],_0x3025f5[_0xb4f7('0x25')]);})[_0xb4f7('0x11')](function(_0x3f4d14){logger[_0xb4f7('0xb')](util[_0xb4f7('0xc')](_0xb4f7('0x2c'),_0x3195c5['id']));return _0x3195c5[_0xb4f7('0x1e')]({'sentiment':_0x3f4d14[_0xb4f7('0x2d')],'sPositive':_0x3f4d14[_0xb4f7('0x2e')]['Positive'],'sNegative':_0x3f4d14[_0xb4f7('0x2e')][_0xb4f7('0x2f')],'sMixed':_0x3f4d14[_0xb4f7('0x2e')][_0xb4f7('0x30')],'sNeutral':_0x3f4d14[_0xb4f7('0x2e')][_0xb4f7('0x31')]});})[_0xb4f7('0x11')](function(){logger[_0xb4f7('0xb')](util[_0xb4f7('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x3195c5['id']));_0x226994();});case _0xb4f7('0x32'):return _0x3195c5[_0xb4f7('0x1e')]({'transcribeStatus':_0xb4f7('0x32'),'failureReason':_0x2c304b[_0xb4f7('0x13')][_0xb4f7('0x33')]})['then'](function(){logger['info'](util['format'](_0xb4f7('0x1f'),_0x3195c5['id']));_0x226994();});default:logger[_0xb4f7('0xb')](util['format'](_0xb4f7('0x34'),_0x3195c5['id']));break;}}else{return BPromise[_0xb4f7('0x35')]()[_0xb4f7('0x11')](function(){if(!_0x3195c5[_0xb4f7('0x36')]){throw new db['Sequelize'][(_0xb4f7('0x21'))](_0xb4f7('0x22'));}if(!_0x3025f5[_0xb4f7('0x23')]||!_0x3025f5[_0xb4f7('0x27')]||!_0x3025f5['sentimentRegion']||!_0x3025f5[_0xb4f7('0x25')]||!_0x3025f5[_0xb4f7('0x26')]){throw new db[(_0xb4f7('0x20'))][(_0xb4f7('0x21'))](_0xb4f7('0x37'));}if(!_0x3195c5[_0xb4f7('0x14')]){throw new Error(_0xb4f7('0x38'));}if(_0x3025f5[_0xb4f7('0x27')]===_0x571e0e['id']){return _0x571e0e;}else{return db[_0xb4f7('0x28')][_0xb4f7('0x39')]({'where':{'id':_settings[_0xb4f7('0x27')]}});}})[_0xb4f7('0x11')](function(_0x7c3cfa){if(!_0x7c3cfa){throw new db[(_0xb4f7('0x20'))][(_0xb4f7('0x21'))](_0xb4f7('0x29'));}if(!_0x7c3cfa[_0xb4f7('0xe')]||!_0x7c3cfa[_0xb4f7('0x2a')]){throw new db[(_0xb4f7('0x20'))][(_0xb4f7('0x21'))](_0xb4f7('0x3a'));}_0x28f487=_0x7c3cfa;logger[_0xb4f7('0xb')](util[_0xb4f7('0xc')](_0xb4f7('0x2b'),_0x3195c5['id']));return sentiment(_0x28f487['data1'],_0x28f487[_0xb4f7('0x2a')],_0x3025f5['sentimentRegion'],_0x3195c5[_0xb4f7('0x14')],_0x3025f5[_0xb4f7('0x25')]);})[_0xb4f7('0x11')](function(_0x98be96){logger[_0xb4f7('0xb')](util[_0xb4f7('0xc')](_0xb4f7('0x2c'),_0x3195c5['id']));return _0x3195c5[_0xb4f7('0x1e')]({'sentiment':_0x98be96[_0xb4f7('0x2d')],'sPositive':_0x98be96[_0xb4f7('0x2e')]['Positive'],'sNegative':_0x98be96[_0xb4f7('0x2e')]['Negative'],'sMixed':_0x98be96[_0xb4f7('0x2e')][_0xb4f7('0x30')],'sNeutral':_0x98be96['SentimentScore'][_0xb4f7('0x31')],'transcribeStatus':_0xb4f7('0x3b')});})[_0xb4f7('0x11')](function(){logger[_0xb4f7('0xb')](util[_0xb4f7('0xc')](_0xb4f7('0x1f'),_0x3195c5['id']));_0x226994();});}})['catch'](function(_0x366b38){if(_0x366b38){if(!_0x366b38[_0xb4f7('0x3c')]||_0x366b38[_0xb4f7('0x3c')]!==_0xb4f7('0x3d')){logger[_0xb4f7('0x3e')](util[_0xb4f7('0xc')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x3195c5['id']),util['inspect'](_0x366b38,{'showHidden':![],'depth':null}));}}_0x226994();});});}function checkTranscribe(){var _0x18a324;var _0x2731d5;var _0x5241fb;return db[_0xb4f7('0x3f')][_0xb4f7('0x40')]({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0x16e951){if(!_0x16e951||!_0x16e951[_0xb4f7('0x1c')]){throw new db['Sequelize'][(_0xb4f7('0x21'))](_0xb4f7('0x41'));}_0x18a324=_0x16e951;return db[_0xb4f7('0x42')][_0xb4f7('0x39')]({'where':{'id':0x1}});})[_0xb4f7('0x11')](function(_0x5e96f0){if(!_0x5e96f0){throw new db[(_0xb4f7('0x20'))]['ValidationError']('Settings\x20not\x20available');}_0x2731d5=_0x5e96f0;if(!_0x2731d5[_0xb4f7('0x6')]||!_0x2731d5[_0xb4f7('0x43')]||!_0x2731d5[_0xb4f7('0xf')]||!_0x2731d5['language']||!_0x2731d5[_0xb4f7('0x26')]){throw new db[(_0xb4f7('0x20'))]['ValidationError'](_0xb4f7('0x44'));}return db[_0xb4f7('0x28')][_0xb4f7('0x39')]({'where':{'id':_0x2731d5[_0xb4f7('0x43')]}});})[_0xb4f7('0x11')](function(_0x35d06e){if(!_0x35d06e){throw new db[(_0xb4f7('0x20'))][(_0xb4f7('0x21'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x35d06e[_0xb4f7('0xe')]||!_0x35d06e[_0xb4f7('0x2a')]){throw new db['Sequelize'][(_0xb4f7('0x21'))](_0xb4f7('0x3a'));}_0x5241fb=_0x35d06e;var _0x48ea5f=[];_0x18a324['forEach'](function(_0xf43f34){_0x48ea5f[_0xb4f7('0x45')](checkTranscribeJob(_0xf43f34,_0x2731d5,_0x5241fb));});return BPromise[_0xb4f7('0x46')](_0x48ea5f);})[_0xb4f7('0x47')](function(_0x35133e){if(_0x35133e){if(!_0x35133e[_0xb4f7('0x3c')]||_0x35133e[_0xb4f7('0x3c')]!==_0xb4f7('0x3d')){logger[_0xb4f7('0x3e')](util['inspect'](_0x35133e,{'showHidden':![],'depth':null}));}}});}exports[_0xb4f7('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x7292=['TranscriptionJobStatus','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update','sentiment','sentimentAccountId','language','bucket','Sequelize','ValidationError','Transcript\x20not\x20available','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','tempSentiment','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Positive','Mixed','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','IN_PROGRESS','Setting','Settings\x20not\x20available','transcribe','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','forEach','all','catch','error','inspect','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','then','TranscriptionJob','fileText'];(function(_0x52743a,_0x490b01){var _0x13fb02=function(_0x5c2f64){while(--_0x5c2f64){_0x52743a['push'](_0x52743a['shift']());}};_0x13fb02(++_0x490b01);}(_0x7292,0x107));var _0x2729=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x7292[_0x278e3c];return _0x3e2d9b;};var _=require(_0x2729('0x0'));var AWS=require(_0x2729('0x1'));var rp=require(_0x2729('0x2'));var util=require(_0x2729('0x3'));var BPromise=require(_0x2729('0x4'));var db=require(_0x2729('0x5'))['db'];var logger=require(_0x2729('0x6'))('transcribe');function getTranscriptionJob(_0x400b66,_0x45977a,_0x1ca35f,_0x27cfe5){return new Promise(function(_0x26a3dc,_0x176a7c){var _0x3562b9=new AWS[(_0x2729('0x7'))]({'accessKeyId':_0x45977a,'secretAccessKey':_0x400b66,'region':_0x1ca35f});_0x3562b9[_0x2729('0x8')]({'TranscriptionJobName':_0x27cfe5},function(_0x4c0952,_0x5f4f01){if(_0x4c0952){return _0x176a7c(_0x4c0952);}else{return _0x26a3dc(_0x5f4f01);}});});}function sentiment(_0x1ea70b,_0x20d46b,_0x47be81,_0x39fcbf,_0x2562a5){return new Promise(function(_0x412ade,_0x1d3cd9){var _0x13de9a=new AWS[(_0x2729('0x9'))]({'accessKeyId':_0x20d46b,'secretAccessKey':_0x1ea70b,'region':_0x47be81});_0x13de9a[_0x2729('0xa')]({'Text':_0x39fcbf,'LanguageCode':_0x2562a5[_0x2729('0xb')](0x0,0x2)},function(_0x4376e7,_0x4cb389){if(_0x4376e7){return _0x1d3cd9(_0x4376e7);}else{return _0x412ade(_0x4cb389);}});});}function checkTranscribeJob(_0xaa930a,_0x37815a,_0x1449f9){var _0x5ae728;return new BPromise(function(_0x7c59b0,_0x15f590){logger[_0x2729('0xc')](util[_0x2729('0xd')](_0x2729('0xe'),_0xaa930a['id'],_0xaa930a[_0x2729('0xf')]));return getTranscriptionJob(_0x1449f9[_0x2729('0x10')],_0x1449f9[_0x2729('0x11')],_0x37815a['transcribeRegion'],_0xaa930a[_0x2729('0xf')])[_0x2729('0x12')](function(_0x235e71){logger['info'](util[_0x2729('0xd')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0xaa930a['id'],_0xaa930a['transcribeName'],_0x235e71[_0x2729('0x13')]['TranscriptionJobStatus']));if(!_0xaa930a[_0x2729('0x14')]){switch(_0x235e71['TranscriptionJob'][_0x2729('0x15')]){case'COMPLETED':var _0x58f312={'transcribeStatus':_0x235e71[_0x2729('0x13')][_0x2729('0x15')],'fileUri':_0x235e71[_0x2729('0x13')][_0x2729('0x16')][_0x2729('0x17')]};logger[_0x2729('0xc')](util[_0x2729('0xd')](_0x2729('0x18'),_0xaa930a['id']));return rp({'uri':_0x235e71['TranscriptionJob'][_0x2729('0x16')][_0x2729('0x17')],'json':!![]})[_0x2729('0x12')](function(_0x135186){logger['info'](util[_0x2729('0xd')](_0x2729('0x19'),_0xaa930a['id']));if(_0x135186&&_0x135186[_0x2729('0x1a')]&&_0x135186['results']['transcripts']&&_0x135186[_0x2729('0x1a')][_0x2729('0x1b')]['length']){_0x58f312[_0x2729('0x14')]='';for(var _0x72bdd2=0x0;_0x72bdd2<_0x135186[_0x2729('0x1a')][_0x2729('0x1b')][_0x2729('0x1c')];_0x72bdd2++){_0x58f312[_0x2729('0x14')]+=_0x135186[_0x2729('0x1a')][_0x2729('0x1b')][_0x72bdd2]['transcript']+'';}}return _0xaa930a[_0x2729('0x1d')](_0x58f312);})[_0x2729('0x12')](function(){logger['info'](util[_0x2729('0xd')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0xaa930a['id']));if(!_0xaa930a['tempSentiment']){throw new db['Sequelize']['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x37815a[_0x2729('0x1e')]||!_0x37815a[_0x2729('0x1f')]||!_0x37815a['sentimentRegion']||!_0x37815a[_0x2729('0x20')]||!_0x37815a[_0x2729('0x21')]){throw new db[(_0x2729('0x22'))][(_0x2729('0x23'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x58f312[_0x2729('0x14')]){throw new Error(_0x2729('0x24'));}if(_0x37815a[_0x2729('0x1f')]===_0x1449f9['id']){return _0x1449f9;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0x2729('0x1f')]}});}})[_0x2729('0x12')](function(_0x390145){if(!_0x390145){throw new db[(_0x2729('0x22'))]['ValidationError'](_0x2729('0x25'));}if(!_0x390145[_0x2729('0x10')]||!_0x390145['data2']){throw new db[(_0x2729('0x22'))][(_0x2729('0x23'))](_0x2729('0x26'));}_0x5ae728=_0x390145;logger[_0x2729('0xc')](util[_0x2729('0xd')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0xaa930a['id']));return sentiment(_0x5ae728[_0x2729('0x10')],_0x5ae728[_0x2729('0x11')],_0x37815a[_0x2729('0x27')],_0x58f312[_0x2729('0x14')],_0x37815a[_0x2729('0x20')]);})[_0x2729('0x12')](function(_0x4524ac){logger['info'](util[_0x2729('0xd')](_0x2729('0x28'),_0xaa930a['id']));return _0xaa930a['update']({'sentiment':_0x4524ac[_0x2729('0x29')],'sPositive':_0x4524ac['SentimentScore']['Positive'],'sNegative':_0x4524ac[_0x2729('0x2a')][_0x2729('0x2b')],'sMixed':_0x4524ac[_0x2729('0x2a')]['Mixed'],'sNeutral':_0x4524ac[_0x2729('0x2a')][_0x2729('0x2c')]});})['then'](function(){logger[_0x2729('0xc')](util[_0x2729('0xd')](_0x2729('0x2d'),_0xaa930a['id']));_0x7c59b0();});case _0x2729('0x2e'):return _0xaa930a[_0x2729('0x1d')]({'transcribeStatus':_0x2729('0x2e'),'failureReason':_0x235e71['TranscriptionJob']['FailureReason']})[_0x2729('0x12')](function(){logger['info'](util[_0x2729('0xd')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0xaa930a['id']));_0x7c59b0();});default:logger[_0x2729('0xc')](util['format'](_0x2729('0x2f'),_0xaa930a['id']));break;}}else{return BPromise['resolve']()[_0x2729('0x12')](function(){if(!_0xaa930a[_0x2729('0x30')]){throw new db[(_0x2729('0x22'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x37815a[_0x2729('0x1e')]||!_0x37815a['sentimentAccountId']||!_0x37815a[_0x2729('0x27')]||!_0x37815a['language']||!_0x37815a['bucket']){throw new db[(_0x2729('0x22'))]['ValidationError'](_0x2729('0x31'));}if(!_0xaa930a['fileText']){throw new Error(_0x2729('0x24'));}if(_0x37815a[_0x2729('0x1f')]===_0x1449f9['id']){return _0x1449f9;}else{return db[_0x2729('0x32')][_0x2729('0x33')]({'where':{'id':_settings[_0x2729('0x1f')]}});}})['then'](function(_0x43e0fb){if(!_0x43e0fb){throw new db[(_0x2729('0x22'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x43e0fb[_0x2729('0x10')]||!_0x43e0fb[_0x2729('0x11')]){throw new db[(_0x2729('0x22'))][(_0x2729('0x23'))](_0x2729('0x26'));}_0x5ae728=_0x43e0fb;logger[_0x2729('0xc')](util[_0x2729('0xd')](_0x2729('0x34'),_0xaa930a['id']));return sentiment(_0x5ae728[_0x2729('0x10')],_0x5ae728[_0x2729('0x11')],_0x37815a[_0x2729('0x27')],_0xaa930a[_0x2729('0x14')],_0x37815a[_0x2729('0x20')]);})[_0x2729('0x12')](function(_0x5ceb88){logger[_0x2729('0xc')](util[_0x2729('0xd')](_0x2729('0x28'),_0xaa930a['id']));return _0xaa930a[_0x2729('0x1d')]({'sentiment':_0x5ceb88['Sentiment'],'sPositive':_0x5ceb88[_0x2729('0x2a')][_0x2729('0x35')],'sNegative':_0x5ceb88[_0x2729('0x2a')]['Negative'],'sMixed':_0x5ceb88['SentimentScore'][_0x2729('0x36')],'sNeutral':_0x5ceb88[_0x2729('0x2a')]['Neutral'],'transcribeStatus':'COMPLETED'});})[_0x2729('0x12')](function(){logger[_0x2729('0xc')](util[_0x2729('0xd')](_0x2729('0x2d'),_0xaa930a['id']));_0x7c59b0();});}})['catch'](function(_0x2d78d2){if(_0x2d78d2){if(!_0x2d78d2[_0x2729('0x37')]||_0x2d78d2['name']!==_0x2729('0x38')){logger['error'](util[_0x2729('0xd')](_0x2729('0x39'),_0xaa930a['id']),util['inspect'](_0x2d78d2,{'showHidden':![],'depth':null}));}}_0x7c59b0();});});}function checkTranscribe(){var _0xced9f6;var _0x4aa8cf;var _0x5d5c9d;return db[_0x2729('0x3a')]['findAll']({'where':{'transcribeStatus':_0x2729('0x3b')}})[_0x2729('0x12')](function(_0x3059fe){if(!_0x3059fe||!_0x3059fe[_0x2729('0x1c')]){throw new db[(_0x2729('0x22'))][(_0x2729('0x23'))]('No\x20transcribe\x20job\x20to\x20check');}_0xced9f6=_0x3059fe;return db[_0x2729('0x3c')]['findOne']({'where':{'id':0x1}});})[_0x2729('0x12')](function(_0x215494){if(!_0x215494){throw new db[(_0x2729('0x22'))]['ValidationError'](_0x2729('0x3d'));}_0x4aa8cf=_0x215494;if(!_0x4aa8cf[_0x2729('0x3e')]||!_0x4aa8cf[_0x2729('0x3f')]||!_0x4aa8cf[_0x2729('0x40')]||!_0x4aa8cf[_0x2729('0x20')]||!_0x4aa8cf[_0x2729('0x21')]){throw new db[(_0x2729('0x22'))]['ValidationError'](_0x2729('0x41'));}return db['CloudProvider'][_0x2729('0x33')]({'where':{'id':_0x4aa8cf['transcribeAccountId']}});})['then'](function(_0x4f7b04){if(!_0x4f7b04){throw new db[(_0x2729('0x22'))][(_0x2729('0x23'))](_0x2729('0x25'));}if(!_0x4f7b04[_0x2729('0x10')]||!_0x4f7b04[_0x2729('0x11')]){throw new db[(_0x2729('0x22'))][(_0x2729('0x23'))](_0x2729('0x26'));}_0x5d5c9d=_0x4f7b04;var _0x598d68=[];_0xced9f6[_0x2729('0x42')](function(_0x2ae039){_0x598d68['push'](checkTranscribeJob(_0x2ae039,_0x4aa8cf,_0x5d5c9d));});return BPromise[_0x2729('0x43')](_0x598d68);})[_0x2729('0x44')](function(_0x327291){if(_0x327291){if(!_0x327291[_0x2729('0x37')]||_0x327291[_0x2729('0x37')]!=='SequelizeValidationError'){logger[_0x2729('0x45')](util[_0x2729('0x46')](_0x327291,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 03c8f1a..63997ef 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 _0xe0bf=['error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','util','schedule','redis','defaults','localhost','socket.io-emitter','findAll','subtract','hours','then','length','info','[WHATSAPP]\x20Interactions\x20to\x20close:','timeout','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:'];(function(_0x48449e,_0x50d0e8){var _0x98c011=function(_0x1fb097){while(--_0x1fb097){_0x48449e['push'](_0x48449e['shift']());}};_0x98c011(++_0x50d0e8);}(_0xe0bf,0x168));var _0xfe0b=function(_0x46ea1e,_0xb316d6){_0x46ea1e=_0x46ea1e-0x0;var _0x77e8b7=_0xe0bf[_0x46ea1e];return _0x77e8b7;};'use strict';var _=require(_0xfe0b('0x0'));var moment=require(_0xfe0b('0x1'));var Redis=require(_0xfe0b('0x2'));var util=require(_0xfe0b('0x3'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require('../logger')(_0xfe0b('0x4'));config[_0xfe0b('0x5')]=_[_0xfe0b('0x6')](config['redis'],{'host':_0xfe0b('0x7'),'port':0x18eb});var io=require(_0xfe0b('0x8'))(new Redis(config['redis']));function closeInteractions(){var _0x45280e=[];return db['WhatsappInteraction'][_0xfe0b('0x9')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xfe0b('0xa')](0x18,_0xfe0b('0xb'))}}})[_0xfe0b('0xc')](function(_0x12005c){if(_0x12005c&&_0x12005c[_0xfe0b('0xd')]){_0x45280e=_['map'](_0x12005c||[],'id');logger[_0xfe0b('0xe')](_0xfe0b('0xf'),_0x45280e['join']());return db['WhatsappInteraction']['update']({'closeReason':'system','disposition':_0xfe0b('0x10'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x45280e}});}})[_0xfe0b('0xc')](function(){if(_0x45280e&&_0x45280e[_0xfe0b('0xd')]){logger[_0xfe0b('0xe')](_0xfe0b('0x11'),_0x45280e['join']());for(var _0x4d0a06=0x0;_0x4d0a06<_0x45280e[_0xfe0b('0xd')];_0x4d0a06++){io['emit']('whatsappInteraction:update',{'id':_0x45280e[_0x4d0a06],'closed':!![]});}}})['catch'](function(_0x4ce80d){logger[_0xfe0b('0x12')](_0xfe0b('0x13'),_0x4ce80d?util[_0xfe0b('0x14')](_0x4ce80d,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xd9f7=['subtract','hours','then','map','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','length','error','[WHATSAPP]\x20Error\x20closing\x20interactions','lodash','moment','ioredis','../../config/environment','../../mysqldb','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','lastMsgAt'];(function(_0x5aa51f,_0x599f12){var _0x322f89=function(_0x5862c4){while(--_0x5862c4){_0x5aa51f['push'](_0x5aa51f['shift']());}};_0x322f89(++_0x599f12);}(_0xd9f7,0xb8));var _0x7d9f=function(_0x579354,_0x361834){_0x579354=_0x579354-0x0;var _0x2a36a8=_0xd9f7[_0x579354];return _0x2a36a8;};'use strict';var _=require(_0x7d9f('0x0'));var moment=require(_0x7d9f('0x1'));var Redis=require(_0x7d9f('0x2'));var util=require('util');var config=require(_0x7d9f('0x3'));var db=require(_0x7d9f('0x4'))['db'];var logger=require('../logger')(_0x7d9f('0x5'));config[_0x7d9f('0x6')]=_[_0x7d9f('0x7')](config['redis'],{'host':_0x7d9f('0x8'),'port':0x18eb});var io=require(_0x7d9f('0x9'))(new Redis(config[_0x7d9f('0x6')]));function closeInteractions(){var _0x5d7e5c=[];return db[_0x7d9f('0xa')]['findAll']({'raw':!![],'attributes':['id',_0x7d9f('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x7d9f('0xc')](0x18,_0x7d9f('0xd'))}}})[_0x7d9f('0xe')](function(_0x15fd2a){if(_0x15fd2a&&_0x15fd2a['length']){_0x5d7e5c=_[_0x7d9f('0xf')](_0x15fd2a||[],'id');logger['info'](_0x7d9f('0x10'),_0x5d7e5c[_0x7d9f('0x11')]());return db[_0x7d9f('0xa')][_0x7d9f('0x12')]({'closeReason':_0x7d9f('0x13'),'disposition':_0x7d9f('0x14'),'closed':!![],'closedAt':moment()[_0x7d9f('0x15')](_0x7d9f('0x16'))},{'where':{'id':_0x5d7e5c}});}})[_0x7d9f('0xe')](function(){if(_0x5d7e5c&&_0x5d7e5c['length']){logger[_0x7d9f('0x17')](_0x7d9f('0x18'),_0x5d7e5c[_0x7d9f('0x11')]());for(var _0x1bd4ed=0x0;_0x1bd4ed<_0x5d7e5c[_0x7d9f('0x19')];_0x1bd4ed++){io['emit']('whatsappInteraction:update',{'id':_0x5d7e5c[_0x1bd4ed],'closed':!![]});}}})['catch'](function(_0x154e29){logger[_0x7d9f('0x1a')](_0x7d9f('0x1b'),_0x154e29?util['inspect'](_0x154e29,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 98044bc..40fb41d 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed7c=['contacts1','CmHopper','contacts2','hopper2','util','../mysqldb','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','push','now','CmContact','destroy','bulkCreate','then','log','finished\x20populating'];(function(_0x51cea2,_0x3ae57c){var _0x485abc=function(_0x4f190f){while(--_0x4f190f){_0x51cea2['push'](_0x51cea2['shift']());}};_0x485abc(++_0x3ae57c);}(_0xed7c,0x17e));var _0xced7=function(_0x3ade57,_0x50febd){_0x3ade57=_0x3ade57-0x0;var _0x40049b=_0xed7c[_0x3ade57];return _0x40049b;};'use strict';var util=require(_0xced7('0x0'));var db=require(_0xced7('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0xced7('0x2')+i,'lastName':_0xced7('0x3')+i,'phone':0xf879fb460+i,'email':_0xced7('0x4')+i+_0xced7('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xced7('0x6')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xced7('0x7')](),'updatedAt':Date[_0xced7('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xced7('0x2')+i,'lastName':_0xced7('0x3')+i,'phone':0xf879fb460+i,'email':_0xced7('0x4')+i+_0xced7('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xced7('0x6')]({'id':i,'active':![],'scheduledat':Date[_0xced7('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xced7('0x7')](),'updatedAt':Date['now']()});}db[_0xced7('0x8')][_0xced7('0x9')]({'where':{}})['then'](function(){return db[_0xced7('0x8')][_0xced7('0xa')](contacts);})[_0xced7('0xb')](function(){console[_0xced7('0xc')](_0xced7('0xd'),_0xced7('0xe'));return db[_0xced7('0xf')]['destroy']({'where':{}});})[_0xced7('0xb')](function(){return db[_0xced7('0xf')][_0xced7('0xa')](hopper);})[_0xced7('0xb')](function(){console[_0xced7('0xc')](_0xced7('0xd'),'hopper1');return db[_0xced7('0x8')][_0xced7('0xa')](contacts2);})['then'](function(){console[_0xced7('0xc')](_0xced7('0xd'),_0xced7('0x10'));return db['CmHopper'][_0xced7('0xa')](hopper2);})['then'](function(){console[_0xced7('0xc')](_0xced7('0xd'),_0xced7('0x11'));})['catch'](function(_0x519f40){console[_0xced7('0xc')](_0x519f40);}); \ No newline at end of file +var _0x701d=['CmContact','bulkCreate','log','finished\x20populating','CmHopper','destroy','then','hopper1','catch','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now'];(function(_0x418a21,_0xd06751){var _0xeffcdc=function(_0xbdef35){while(--_0xbdef35){_0x418a21['push'](_0x418a21['shift']());}};_0xeffcdc(++_0xd06751);}(_0x701d,0x15d));var _0xd701=function(_0x112ba7,_0x482126){_0x112ba7=_0x112ba7-0x0;var _0x182680=_0x701d[_0x112ba7];return _0x182680;};'use strict';var util=require(_0xd701('0x0'));var db=require(_0xd701('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xd701('0x2')]({'id':i,'firstName':_0xd701('0x3')+i,'lastName':_0xd701('0x4')+i,'phone':0xf879fb460+i,'email':_0xd701('0x5')+i+_0xd701('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xd701('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xd701('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xd701('0x7')](),'updatedAt':Date[_0xd701('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xd701('0x3')+i,'lastName':_0xd701('0x4')+i,'phone':0xf879fb460+i,'email':_0xd701('0x5')+i+_0xd701('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xd701('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xd701('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xd701('0x7')](),'updatedAt':Date['now']()});}db['CmContact']['destroy']({'where':{}})['then'](function(){return db[_0xd701('0x8')][_0xd701('0x9')](contacts);})['then'](function(){console[_0xd701('0xa')](_0xd701('0xb'),'contacts1');return db[_0xd701('0xc')][_0xd701('0xd')]({'where':{}});})[_0xd701('0xe')](function(){return db[_0xd701('0xc')][_0xd701('0x9')](hopper);})[_0xd701('0xe')](function(){console['log']('finished\x20populating',_0xd701('0xf'));return db['CmContact']['bulkCreate'](contacts2);})['then'](function(){console[_0xd701('0xa')](_0xd701('0xb'),'contacts2');return db[_0xd701('0xc')][_0xd701('0x9')](hopper2);})[_0xd701('0xe')](function(){console[_0xd701('0xa')](_0xd701('0xb'),'hopper2');})[_0xd701('0x10')](function(_0x2b25dc){console[_0xd701('0xa')](_0x2b25dc);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index af95466..ceb47ea 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1811=['yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','then','log','add\x20user','catch','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','all','ulaw'];(function(_0x4174c5,_0xe0885f){var _0x4110c0=function(_0x55e52b){while(--_0x55e52b){_0x4174c5['push'](_0x4174c5['shift']());}};_0x4110c0(++_0xe0885f);}(_0x1811,0x128));var _0x1181=function(_0x585221,_0xb7e318){_0x585221=_0x585221-0x0;var _0x17111b=_0x1811[_0x585221];return _0x17111b;};'use strict';var util=require('util');var db=require(_0x1181('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x1181('0x1')]({'name':util[_0x1181('0x2')](_0x1181('0x3'),'agent',i),'fullname':util[_0x1181('0x2')](_0x1181('0x3'),_0x1181('0x4'),i),'email':util['format'](_0x1181('0x5'),_0x1181('0x4'),i),'role':_0x1181('0x4'),'password':_0x1181('0x6'),'internal':0xfa0+i,'type':_0x1181('0x7'),'transport':[_0x1181('0x8'),'ws',_0x1181('0x9')],'disallow':[_0x1181('0xa')],'allow':[_0x1181('0xb')],'defaultuser':util[_0x1181('0x2')](_0x1181('0x3'),_0x1181('0x4'),i),'encryption':_0x1181('0xc'),'avpf':'yes','force_avp':_0x1181('0xc'),'icesupport':'yes','dtlsenable':_0x1181('0xc'),'dtlsverify':'no','dtlscertfile':_0x1181('0xd'),'dtlsprivatekey':_0x1181('0xe'),'dtlssetup':_0x1181('0xf'),'callerid':util[_0x1181('0x2')](_0x1181('0x10'),util[_0x1181('0x2')](_0x1181('0x3'),_0x1181('0x4'),i),0xfa0+i)});}db[_0x1181('0x11')]['bulkCreate'](users)[_0x1181('0x12')](function(){console[_0x1181('0x13')](_0x1181('0x14'));})[_0x1181('0x15')](function(_0x14d28e){console[_0x1181('0x13')](_0x14d28e);}); \ No newline at end of file +var _0xaaca=['/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt'];(function(_0x5a9f16,_0x1da2ed){var _0x227109=function(_0x4c6beb){while(--_0x4c6beb){_0x5a9f16['push'](_0x5a9f16['shift']());}};_0x227109(++_0x1da2ed);}(_0xaaca,0xfb));var _0xaaac=function(_0x547456,_0x1de17e){_0x547456=_0x547456-0x0;var _0xc1fd7b=_0xaaca[_0x547456];return _0xc1fd7b;};'use strict';var util=require('util');var db=require(_0xaaac('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xaaac('0x1')]({'name':util[_0xaaac('0x2')](_0xaaac('0x3'),_0xaaac('0x4'),i),'fullname':util[_0xaaac('0x2')](_0xaaac('0x3'),_0xaaac('0x4'),i),'email':util[_0xaaac('0x2')](_0xaaac('0x5'),_0xaaac('0x4'),i),'role':_0xaaac('0x4'),'password':_0xaaac('0x6'),'internal':0xfa0+i,'type':_0xaaac('0x7'),'transport':[_0xaaac('0x8'),'ws',_0xaaac('0x9')],'disallow':['all'],'allow':[_0xaaac('0xa')],'defaultuser':util[_0xaaac('0x2')](_0xaaac('0x3'),'agent',i),'encryption':'yes','avpf':_0xaaac('0xb'),'force_avp':'yes','icesupport':_0xaaac('0xb'),'dtlsenable':_0xaaac('0xb'),'dtlsverify':'no','dtlscertfile':_0xaaac('0xc'),'dtlsprivatekey':_0xaaac('0xd'),'dtlssetup':_0xaaac('0xe'),'callerid':util[_0xaaac('0x2')](_0xaaac('0xf'),util[_0xaaac('0x2')](_0xaaac('0x3'),_0xaaac('0x4'),i),0xfa0+i)});}db[_0xaaac('0x10')][_0xaaac('0x11')](users)[_0xaaac('0x12')](function(){console[_0xaaac('0x13')](_0xaaac('0x14'));})[_0xaaac('0x15')](function(_0x51c534){console[_0xaaac('0x13')](_0x51c534);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index f3aa9bf..2bf5c13 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1691=['user_has_whatsapp_interactions:remove','log','join','default','connection','setMaxListeners','address','request','remotePort','connectedAt','SocketIO\x20','disconnect','CONNECTED','lodash','util','../mysqldb','./environment','name','Agents','User','role','agent','telephone','type','UserProfileSection','findOne','autoAssociation','ChatQueues','SmsQueues','MailQueues','Telephones','Trunks','findAll','UserProfileResource','resourceId','map','where','Campaign','%s:queue:%s','length','format','user:%s','query','ChatInteraction','ChatInteractions','MailInteractions','FaxInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','then','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','VoiceQueues','VoiceQueue','FaxQueues','userProfileId','OpenchannelQueues','WhatsappQueues','IvrCampaigns','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','all','voice','chat','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions'];(function(_0x3a0711,_0x189a8d){var _0x569ad5=function(_0x42932d){while(--_0x42932d){_0x3a0711['push'](_0x3a0711['shift']());}};_0x569ad5(++_0x189a8d);}(_0x1691,0x1ed));var _0x1169=function(_0x527afe,_0xcb09c){_0x527afe=_0x527afe-0x0;var _0x1c6cb3=_0x1691[_0x527afe];return _0x1c6cb3;};'use strict';var _=require(_0x1169('0x0'));var util=require(_0x1169('0x1'));var BPromise=require('bluebird');var db=require(_0x1169('0x2'))['db'];var config=require(_0x1169('0x3'));var queryQueues={'attributes':['id',_0x1169('0x4')],'include':[{'as':_0x1169('0x5'),'model':db[_0x1169('0x6')],'attributes':['id',_0x1169('0x4'),_0x1169('0x7')],'raw':!![],'where':{'role':_0x1169('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x1169('0x9')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x1169('0x4')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x1169('0x4'),_0x1169('0xa')],'where':{'type':'ivr'}};function getAssociatedResources(_0x216548,_0x20440a,_0xe3a0bc){return db[_0x1169('0xb')][_0x1169('0xc')]({'where':{'name':_0x216548,'userProfileId':_0x20440a},'raw':!![]})['then'](function(_0x1a4400){if(_0x1a4400){if(_0x1a4400[_0x1169('0xd')]){switch(_0x216548){case'VoiceQueues':case _0x1169('0xe'):case'FaxQueues':case _0x1169('0xf'):case _0x1169('0x10'):case'OpenchannelQueues':case'WhatsappQueues':return db[_0xe3a0bc]['findAll'](queryQueues);case _0x1169('0x11'):return db[_0xe3a0bc]['findAll'](queryTelephones);case _0x1169('0x12'):return db[_0xe3a0bc][_0x1169('0x13')](queryTrunks);case'IvrCampaigns':return db[_0xe3a0bc][_0x1169('0x13')](queryCampaigns);}}else{return db[_0x1169('0x14')][_0x1169('0x13')]({'attributes':[_0x1169('0x15')],'where':{'sectionId':_0x1a4400['id']},'raw':!![]})['then'](function(_0x4c4b90){if(_0x4c4b90){var _0x34462b={'where':{'id':_[_0x1169('0x16')](_0x4c4b90,_0x1169('0x15'))},'raw':!![]};switch(_0xe3a0bc){case _0x1169('0x6'):_0x34462b[_0x1169('0x17')][_0x1169('0x7')]=_0x1169('0x9');break;case _0x1169('0x18'):_0x34462b['where'][_0x1169('0xa')]='ivr';break;}return db[_0xe3a0bc][_0x1169('0x13')](_0x34462b);}else{return[];}});}}else{return[];}})['then'](function(_0x4d608a){return _0x4d608a;});}function joinOrLeaveQueues(_0x9c68cb,_0x54f260,_0x539535,_0x35f0be){_0x9c68cb[_0x54f260](util['format'](_0x1169('0x19'),_0x539535,_0x35f0be[_0x1169('0x4')]));if(_0x35f0be[_0x1169('0x5')]){for(var _0x1b6af6=0x0;_0x1b6af6<_0x35f0be[_0x1169('0x5')][_0x1169('0x1a')];_0x1b6af6+=0x1){_0x9c68cb[_0x54f260](util[_0x1169('0x1b')](_0x1169('0x1c'),_0x35f0be['Agents'][_0x1b6af6][_0x1169('0x4')]));}}}function joinOrLeave(_0x157691,_0x301646,_0x277f69){var _0x21e826;if(_0x157691['handshake']['query']['id']){db[_0x1169('0x6')]['find']({'attributes':['id',_0x1169('0x4'),_0x1169('0x7'),'userProfileId'],'where':{'id':_0x157691['handshake'][_0x1169('0x1d')]['id']},'include':[{'model':db[_0x1169('0x1e')],'as':_0x1169('0x1f'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x1169('0x20'),'attributes':['id'],'raw':!![]},{'model':db[_0x1169('0x21')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x1169('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x1169('0x23')],'as':_0x1169('0x24'),'attributes':['id'],'raw':!![]}]})[_0x1169('0x25')](function(_0x40ad8b){if(_0x40ad8b){_0x21e826=_0x40ad8b;_0x157691[_0x301646](util[_0x1169('0x1b')](_0x1169('0x1c'),_0x40ad8b['name']));var _0x4dc1b2=[];switch(_0x40ad8b[_0x1169('0x7')]){case _0x1169('0x26'):_0x157691[_0x301646](_0x1169('0x27'));_0x157691[_0x301646](_0x1169('0x28'));if(queryQueues[_0x1169('0x29')](_0x1169('0x2a'))){delete queryQueues[_0x1169('0x2a')];}_0x4dc1b2['push'](db['VoiceQueue']['findAll'](queryQueues));_0x4dc1b2['push'](db['ChatQueue'][_0x1169('0x13')](queryQueues));_0x4dc1b2[_0x1169('0x2b')](db[_0x1169('0x2c')]['findAll'](queryQueues));_0x4dc1b2[_0x1169('0x2b')](db[_0x1169('0x2d')][_0x1169('0x13')](queryQueues));_0x4dc1b2[_0x1169('0x2b')](db[_0x1169('0x2e')][_0x1169('0x13')](queryQueues));_0x4dc1b2[_0x1169('0x2b')](db[_0x1169('0x2f')][_0x1169('0x13')](queryQueues));_0x4dc1b2[_0x1169('0x2b')](db[_0x1169('0x30')]['findAll'](queryQueues));_0x4dc1b2['push'](db[_0x1169('0x6')]['findAll'](queryTelephones));_0x4dc1b2[_0x1169('0x2b')](db[_0x1169('0x31')][_0x1169('0x13')](queryTrunks));_0x4dc1b2[_0x1169('0x2b')](db[_0x1169('0x18')]['findAll'](queryCampaigns));_0x4dc1b2[_0x1169('0x2b')](db['User'][_0x1169('0x13')](queryAgents));break;case'user':_0x157691[_0x301646](_0x1169('0x27'));_0x157691[_0x301646](_0x1169('0x28'));_0x4dc1b2[_0x1169('0x2b')](getAssociatedResources(_0x1169('0x32'),_0x40ad8b['userProfileId'],_0x1169('0x33')));_0x4dc1b2[_0x1169('0x2b')](getAssociatedResources(_0x1169('0xe'),_0x40ad8b['userProfileId'],'ChatQueue'));_0x4dc1b2[_0x1169('0x2b')](getAssociatedResources(_0x1169('0x34'),_0x40ad8b[_0x1169('0x35')],_0x1169('0x2c')));_0x4dc1b2[_0x1169('0x2b')](getAssociatedResources(_0x1169('0xf'),_0x40ad8b['userProfileId'],_0x1169('0x2d')));_0x4dc1b2['push'](getAssociatedResources(_0x1169('0x10'),_0x40ad8b[_0x1169('0x35')],'MailQueue'));_0x4dc1b2[_0x1169('0x2b')](getAssociatedResources(_0x1169('0x36'),_0x40ad8b[_0x1169('0x35')],_0x1169('0x2f')));_0x4dc1b2['push'](getAssociatedResources(_0x1169('0x37'),_0x40ad8b[_0x1169('0x35')],'WhatsappQueue'));_0x4dc1b2['push'](getAssociatedResources(_0x1169('0x11'),_0x40ad8b[_0x1169('0x35')],'User'));_0x4dc1b2['push'](getAssociatedResources('Trunks',_0x40ad8b['userProfileId'],_0x1169('0x31')));_0x4dc1b2[_0x1169('0x2b')](getAssociatedResources(_0x1169('0x38'),_0x40ad8b[_0x1169('0x35')],_0x1169('0x18')));_0x4dc1b2[_0x1169('0x2b')](db[_0x1169('0x6')][_0x1169('0x13')](queryAgents));break;case _0x1169('0x8'):_0x157691[_0x301646](_0x1169('0x27'));_0x157691[_0x301646](_0x1169('0x28'));_0x4dc1b2[_0x1169('0x2b')](_0x40ad8b[_0x1169('0x39')]({'attributes':['id','name']}));_0x4dc1b2[_0x1169('0x2b')](_0x40ad8b[_0x1169('0x3a')]({'attributes':['id',_0x1169('0x4')]}));_0x4dc1b2[_0x1169('0x2b')](_0x40ad8b[_0x1169('0x3b')]({'attributes':['id','name']}));_0x4dc1b2['push'](_0x40ad8b[_0x1169('0x3c')]({'attributes':['id',_0x1169('0x4')]}));_0x4dc1b2[_0x1169('0x2b')](_0x40ad8b[_0x1169('0x3d')]({'attributes':['id',_0x1169('0x4')]}));_0x4dc1b2['push'](_0x40ad8b['getOpenchannelQueues']({'attributes':['id',_0x1169('0x4')]}));_0x4dc1b2['push'](_0x40ad8b['getWhatsappQueues']({'attributes':['id',_0x1169('0x4')]}));break;}return BPromise[_0x1169('0x3e')](_0x4dc1b2);}})['then'](function(_0x35fa61){if(_0x35fa61&&_0x35fa61['length']){for(var _0x154993=0x0;_0x154993<_0x35fa61[_0x1169('0x1a')];_0x154993+=0x1){for(var _0x572430=0x0;_0x572430<_0x35fa61[_0x154993][_0x1169('0x1a')];_0x572430+=0x1){switch(_0x154993){case 0x0:joinOrLeaveQueues(_0x157691,_0x301646,_0x1169('0x3f'),_0x35fa61[_0x154993][_0x572430]);break;case 0x1:joinOrLeaveQueues(_0x157691,_0x301646,_0x1169('0x40'),_0x35fa61[_0x154993][_0x572430]);break;case 0x2:joinOrLeaveQueues(_0x157691,_0x301646,'fax',_0x35fa61[_0x154993][_0x572430]);break;case 0x3:joinOrLeaveQueues(_0x157691,_0x301646,_0x1169('0x41'),_0x35fa61[_0x154993][_0x572430]);break;case 0x4:joinOrLeaveQueues(_0x157691,_0x301646,_0x1169('0x42'),_0x35fa61[_0x154993][_0x572430]);break;case 0x5:joinOrLeaveQueues(_0x157691,_0x301646,_0x1169('0x43'),_0x35fa61[_0x154993][_0x572430]);break;case 0x6:joinOrLeaveQueues(_0x157691,_0x301646,_0x1169('0x44'),_0x35fa61[_0x154993][_0x572430]);break;case 0x7:if(_0x21e826['role']!==_0x1169('0x8'))_0x157691[_0x301646](util[_0x1169('0x1b')](_0x1169('0x45'),_0x35fa61[_0x154993][_0x572430][_0x1169('0x4')]));break;case 0x8:if(_0x21e826[_0x1169('0x7')]!==_0x1169('0x8'))_0x157691[_0x301646](util[_0x1169('0x1b')](_0x1169('0x46'),_0x35fa61[_0x154993][_0x572430][_0x1169('0x4')]));break;case 0x9:if(_0x21e826[_0x1169('0x7')]!==_0x1169('0x8'))_0x157691[_0x301646](util['format'](_0x1169('0x47'),_0x35fa61[_0x154993][_0x572430][_0x1169('0xa')],_0x35fa61[_0x154993][_0x572430]['name']));break;case 0xa:_0x157691[_0x301646](util[_0x1169('0x1b')](_0x1169('0x1c'),_0x35fa61[_0x154993][_0x572430][_0x1169('0x4')]));break;}}}}})[_0x1169('0x25')](function(){if(_0x301646===_0x1169('0x48')){var _0x54164d=_[_0x1169('0x16')](_0x21e826[_0x1169('0x1f')],'id');return _0x21e826[_0x1169('0x49')](_0x54164d)[_0x1169('0x25')](function(){for(var _0x32ab01=0x0;_0x32ab01<_0x54164d['length'];_0x32ab01+=0x1){_0x277f69[_0x1169('0x4a')](_0x1169('0x4b'),{'ChatInteractionId':Number(_0x54164d[_0x32ab01]),'UserId':Number(_0x21e826['id'])});}});}})[_0x1169('0x25')](function(){if(_0x301646===_0x1169('0x48')){var _0x20ff11=_[_0x1169('0x16')](_0x21e826[_0x1169('0x20')],'id');return _0x21e826[_0x1169('0x4c')](_0x20ff11)[_0x1169('0x25')](function(){for(var _0xe6897a=0x0;_0xe6897a<_0x20ff11['length'];_0xe6897a+=0x1){_0x277f69['emit'](_0x1169('0x4d'),{'MailInteractionId':Number(_0x20ff11[_0xe6897a]),'UserId':Number(_0x21e826['id'])});}});}})[_0x1169('0x25')](function(){if(_0x301646===_0x1169('0x48')){var _0x2ddc26=_[_0x1169('0x16')](_0x21e826['FaxInteractions'],'id');return _0x21e826[_0x1169('0x4e')](_0x2ddc26)[_0x1169('0x25')](function(){for(var _0xa2b703=0x0;_0xa2b703<_0x2ddc26[_0x1169('0x1a')];_0xa2b703+=0x1){_0x277f69[_0x1169('0x4a')](_0x1169('0x4f'),{'FaxInteractionId':Number(_0x2ddc26[_0xa2b703]),'UserId':Number(_0x21e826['id'])});}});}})[_0x1169('0x25')](function(){if(_0x301646===_0x1169('0x48')){var _0x5d9da2=_[_0x1169('0x16')](_0x21e826[_0x1169('0x50')],'id');return _0x21e826['removeSmsInteractions'](_0x5d9da2)['then'](function(){for(var _0x881854=0x0;_0x881854<_0x5d9da2[_0x1169('0x1a')];_0x881854+=0x1){_0x277f69[_0x1169('0x4a')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x5d9da2[_0x881854]),'UserId':Number(_0x21e826['id'])});}});}})[_0x1169('0x25')](function(){if(_0x301646===_0x1169('0x48')){var _0x4f6932=_[_0x1169('0x16')](_0x21e826[_0x1169('0x22')],'id');return _0x21e826[_0x1169('0x51')](_0x4f6932)[_0x1169('0x25')](function(){for(var _0x220ab9=0x0;_0x220ab9<_0x4f6932[_0x1169('0x1a')];_0x220ab9+=0x1){_0x277f69[_0x1169('0x4a')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x4f6932[_0x220ab9]),'UserId':Number(_0x21e826['id'])});}});}})['then'](function(){if(_0x301646===_0x1169('0x48')){var _0x2ebe38=_[_0x1169('0x16')](_0x21e826[_0x1169('0x24')],'id');return _0x21e826[_0x1169('0x52')](_0x2ebe38)[_0x1169('0x25')](function(){for(var _0x2e2c14=0x0;_0x2e2c14<_0x2ebe38[_0x1169('0x1a')];_0x2e2c14+=0x1){_0x277f69['emit'](_0x1169('0x53'),{'WhatsappInteractionId':Number(_0x2ebe38[_0x2e2c14]),'UserId':Number(_0x21e826['id'])});}});}})['catch'](function(_0x224cac){_0x157691[_0x1169('0x54')](_0x224cac);});}}function onDisconnect(_0x429b80,_0x5da8ef){joinOrLeave(_0x429b80,'leave',_0x5da8ef);}function onConnect(_0x2cf9b7){joinOrLeave(_0x2cf9b7,_0x1169('0x55'));}exports[_0x1169('0x56')]=function(_0x44b33f){_0x44b33f['on'](_0x1169('0x57'),function(_0x9912e6){_0x9912e6[_0x1169('0x58')](0x0);_0x9912e6[_0x1169('0x59')]=_0x9912e6[_0x1169('0x5a')][_0x1169('0x57')]['remoteAddress']+':'+_0x9912e6[_0x1169('0x5a')][_0x1169('0x57')][_0x1169('0x5b')];_0x9912e6[_0x1169('0x5c')]=new Date();_0x9912e6['log']=function(_0x5726da){console[_0x1169('0x54')](_0x1169('0x5d')+_0x9912e6['nsp'][_0x1169('0x4')]+'['+_0x9912e6[_0x1169('0x59')]+']',_0x5726da);};_0x9912e6['on'](_0x1169('0x5e'),function(){onDisconnect(_0x9912e6,_0x44b33f);_0x9912e6['log']('DISCONNECTED');});onConnect(_0x9912e6);_0x9912e6[_0x1169('0x54')](_0x1169('0x5f'));});}; \ No newline at end of file +var _0xdfb1=['userProfileId','MailQueue','Trunks','Trunk','getVoiceQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','voice','chat','sms','mail','whatsapp','agent','trunk:%s','campaign:%s:%s','leave','ChatInteractions','removeChatInteractions','user_has_chat_interactions:remove','MailInteractions','removeMailInteractions','emit','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','WhatsappInteractions','removeWhatsappInteractions','catch','log','default','connection','setMaxListeners','address','request','remotePort','connectedAt','SocketIO\x20','nsp','CONNECTED','lodash','util','bluebird','../mysqldb','name','Agents','User','telephone','type','ivr','UserProfileSection','findOne','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','findAll','IvrCampaigns','resourceId','then','map','where','role','format','length','user:%s','handshake','query','find','ChatInteraction','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','admin','voice:inbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','Campaign','user','voice:outbound'];(function(_0x129ec4,_0x4bfb30){var _0x3d29c7=function(_0x2ae2d6){while(--_0x2ae2d6){_0x129ec4['push'](_0x129ec4['shift']());}};_0x3d29c7(++_0x4bfb30);}(_0xdfb1,0x8c));var _0x1dfb=function(_0x302299,_0x2d1b44){_0x302299=_0x302299-0x0;var _0x3eb3b0=_0xdfb1[_0x302299];return _0x3eb3b0;};'use strict';var _=require(_0x1dfb('0x0'));var util=require(_0x1dfb('0x1'));var BPromise=require(_0x1dfb('0x2'));var db=require(_0x1dfb('0x3'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x1dfb('0x4')],'include':[{'as':_0x1dfb('0x5'),'model':db[_0x1dfb('0x6')],'attributes':['id',_0x1dfb('0x4'),'role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x1dfb('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0x1dfb('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x1dfb('0x4')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x1dfb('0x4'),_0x1dfb('0x8')],'where':{'type':_0x1dfb('0x9')}};function getAssociatedResources(_0x190198,_0x5a14dd,_0x24d8b9){return db[_0x1dfb('0xa')][_0x1dfb('0xb')]({'where':{'name':_0x190198,'userProfileId':_0x5a14dd},'raw':!![]})['then'](function(_0xd747ac){if(_0xd747ac){if(_0xd747ac[_0x1dfb('0xc')]){switch(_0x190198){case _0x1dfb('0xd'):case _0x1dfb('0xe'):case _0x1dfb('0xf'):case _0x1dfb('0x10'):case _0x1dfb('0x11'):case _0x1dfb('0x12'):case _0x1dfb('0x13'):return db[_0x24d8b9]['findAll'](queryQueues);case _0x1dfb('0x14'):return db[_0x24d8b9][_0x1dfb('0x15')](queryTelephones);case'Trunks':return db[_0x24d8b9][_0x1dfb('0x15')](queryTrunks);case _0x1dfb('0x16'):return db[_0x24d8b9][_0x1dfb('0x15')](queryCampaigns);}}else{return db['UserProfileResource'][_0x1dfb('0x15')]({'attributes':[_0x1dfb('0x17')],'where':{'sectionId':_0xd747ac['id']},'raw':!![]})[_0x1dfb('0x18')](function(_0x5ccfcc){if(_0x5ccfcc){var _0xdaf261={'where':{'id':_[_0x1dfb('0x19')](_0x5ccfcc,_0x1dfb('0x17'))},'raw':!![]};switch(_0x24d8b9){case'User':_0xdaf261[_0x1dfb('0x1a')][_0x1dfb('0x1b')]=_0x1dfb('0x7');break;case'Campaign':_0xdaf261['where'][_0x1dfb('0x8')]=_0x1dfb('0x9');break;}return db[_0x24d8b9][_0x1dfb('0x15')](_0xdaf261);}else{return[];}});}}else{return[];}})[_0x1dfb('0x18')](function(_0x50f2ec){return _0x50f2ec;});}function joinOrLeaveQueues(_0x2305e2,_0x33f6e5,_0x2842e7,_0x358465){_0x2305e2[_0x33f6e5](util[_0x1dfb('0x1c')]('%s:queue:%s',_0x2842e7,_0x358465[_0x1dfb('0x4')]));if(_0x358465['Agents']){for(var _0x54cd15=0x0;_0x54cd15<_0x358465['Agents'][_0x1dfb('0x1d')];_0x54cd15+=0x1){_0x2305e2[_0x33f6e5](util[_0x1dfb('0x1c')](_0x1dfb('0x1e'),_0x358465['Agents'][_0x54cd15]['name']));}}}function joinOrLeave(_0x5de3c9,_0x2c9a0c,_0x1ceaab){var _0x1cf4cd;if(_0x5de3c9[_0x1dfb('0x1f')][_0x1dfb('0x20')]['id']){db[_0x1dfb('0x6')][_0x1dfb('0x21')]({'attributes':['id',_0x1dfb('0x4'),_0x1dfb('0x1b'),'userProfileId'],'where':{'id':_0x5de3c9['handshake'][_0x1dfb('0x20')]['id']},'include':[{'model':db[_0x1dfb('0x22')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x1dfb('0x23')],'as':_0x1dfb('0x24'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x1dfb('0x25'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x1dfb('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x1dfb('0x27')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x1dfb('0x18')](function(_0x417f71){if(_0x417f71){_0x1cf4cd=_0x417f71;_0x5de3c9[_0x2c9a0c](util[_0x1dfb('0x1c')]('user:%s',_0x417f71[_0x1dfb('0x4')]));var _0x82339a=[];switch(_0x417f71[_0x1dfb('0x1b')]){case _0x1dfb('0x28'):_0x5de3c9[_0x2c9a0c](_0x1dfb('0x29'));_0x5de3c9[_0x2c9a0c]('voice:outbound');if(queryQueues[_0x1dfb('0x2a')](_0x1dfb('0x2b'))){delete queryQueues['include'];}_0x82339a[_0x1dfb('0x2c')](db[_0x1dfb('0x2d')]['findAll'](queryQueues));_0x82339a[_0x1dfb('0x2c')](db[_0x1dfb('0x2e')][_0x1dfb('0x15')](queryQueues));_0x82339a[_0x1dfb('0x2c')](db[_0x1dfb('0x2f')][_0x1dfb('0x15')](queryQueues));_0x82339a[_0x1dfb('0x2c')](db[_0x1dfb('0x30')][_0x1dfb('0x15')](queryQueues));_0x82339a[_0x1dfb('0x2c')](db['MailQueue'][_0x1dfb('0x15')](queryQueues));_0x82339a[_0x1dfb('0x2c')](db[_0x1dfb('0x31')]['findAll'](queryQueues));_0x82339a[_0x1dfb('0x2c')](db[_0x1dfb('0x32')][_0x1dfb('0x15')](queryQueues));_0x82339a['push'](db['User'][_0x1dfb('0x15')](queryTelephones));_0x82339a[_0x1dfb('0x2c')](db['Trunk'][_0x1dfb('0x15')](queryTrunks));_0x82339a[_0x1dfb('0x2c')](db[_0x1dfb('0x33')]['findAll'](queryCampaigns));_0x82339a[_0x1dfb('0x2c')](db[_0x1dfb('0x6')][_0x1dfb('0x15')](queryAgents));break;case _0x1dfb('0x34'):_0x5de3c9[_0x2c9a0c]('voice:inbound');_0x5de3c9[_0x2c9a0c](_0x1dfb('0x35'));_0x82339a[_0x1dfb('0x2c')](getAssociatedResources('VoiceQueues',_0x417f71['userProfileId'],_0x1dfb('0x2d')));_0x82339a['push'](getAssociatedResources(_0x1dfb('0xe'),_0x417f71['userProfileId'],'ChatQueue'));_0x82339a[_0x1dfb('0x2c')](getAssociatedResources(_0x1dfb('0xf'),_0x417f71[_0x1dfb('0x36')],_0x1dfb('0x2f')));_0x82339a[_0x1dfb('0x2c')](getAssociatedResources('SmsQueues',_0x417f71[_0x1dfb('0x36')],_0x1dfb('0x30')));_0x82339a[_0x1dfb('0x2c')](getAssociatedResources(_0x1dfb('0x11'),_0x417f71[_0x1dfb('0x36')],_0x1dfb('0x37')));_0x82339a['push'](getAssociatedResources('OpenchannelQueues',_0x417f71[_0x1dfb('0x36')],_0x1dfb('0x31')));_0x82339a[_0x1dfb('0x2c')](getAssociatedResources('WhatsappQueues',_0x417f71['userProfileId'],_0x1dfb('0x32')));_0x82339a[_0x1dfb('0x2c')](getAssociatedResources('Telephones',_0x417f71[_0x1dfb('0x36')],_0x1dfb('0x6')));_0x82339a[_0x1dfb('0x2c')](getAssociatedResources(_0x1dfb('0x38'),_0x417f71[_0x1dfb('0x36')],_0x1dfb('0x39')));_0x82339a[_0x1dfb('0x2c')](getAssociatedResources(_0x1dfb('0x16'),_0x417f71[_0x1dfb('0x36')],_0x1dfb('0x33')));_0x82339a[_0x1dfb('0x2c')](db[_0x1dfb('0x6')]['findAll'](queryAgents));break;case'agent':_0x5de3c9[_0x2c9a0c](_0x1dfb('0x29'));_0x5de3c9[_0x2c9a0c]('voice:outbound');_0x82339a[_0x1dfb('0x2c')](_0x417f71[_0x1dfb('0x3a')]({'attributes':['id','name']}));_0x82339a[_0x1dfb('0x2c')](_0x417f71['getChatQueues']({'attributes':['id','name']}));_0x82339a['push'](_0x417f71[_0x1dfb('0x3b')]({'attributes':['id',_0x1dfb('0x4')]}));_0x82339a[_0x1dfb('0x2c')](_0x417f71['getSmsQueues']({'attributes':['id','name']}));_0x82339a['push'](_0x417f71[_0x1dfb('0x3c')]({'attributes':['id',_0x1dfb('0x4')]}));_0x82339a[_0x1dfb('0x2c')](_0x417f71[_0x1dfb('0x3d')]({'attributes':['id',_0x1dfb('0x4')]}));_0x82339a[_0x1dfb('0x2c')](_0x417f71[_0x1dfb('0x3e')]({'attributes':['id','name']}));break;}return BPromise['all'](_0x82339a);}})[_0x1dfb('0x18')](function(_0x26710a){if(_0x26710a&&_0x26710a[_0x1dfb('0x1d')]){for(var _0x56de99=0x0;_0x56de99<_0x26710a[_0x1dfb('0x1d')];_0x56de99+=0x1){for(var _0x2ff784=0x0;_0x2ff784<_0x26710a[_0x56de99][_0x1dfb('0x1d')];_0x2ff784+=0x1){switch(_0x56de99){case 0x0:joinOrLeaveQueues(_0x5de3c9,_0x2c9a0c,_0x1dfb('0x3f'),_0x26710a[_0x56de99][_0x2ff784]);break;case 0x1:joinOrLeaveQueues(_0x5de3c9,_0x2c9a0c,_0x1dfb('0x40'),_0x26710a[_0x56de99][_0x2ff784]);break;case 0x2:joinOrLeaveQueues(_0x5de3c9,_0x2c9a0c,'fax',_0x26710a[_0x56de99][_0x2ff784]);break;case 0x3:joinOrLeaveQueues(_0x5de3c9,_0x2c9a0c,_0x1dfb('0x41'),_0x26710a[_0x56de99][_0x2ff784]);break;case 0x4:joinOrLeaveQueues(_0x5de3c9,_0x2c9a0c,_0x1dfb('0x42'),_0x26710a[_0x56de99][_0x2ff784]);break;case 0x5:joinOrLeaveQueues(_0x5de3c9,_0x2c9a0c,'openchannel',_0x26710a[_0x56de99][_0x2ff784]);break;case 0x6:joinOrLeaveQueues(_0x5de3c9,_0x2c9a0c,_0x1dfb('0x43'),_0x26710a[_0x56de99][_0x2ff784]);break;case 0x7:if(_0x1cf4cd[_0x1dfb('0x1b')]!=='agent')_0x5de3c9[_0x2c9a0c](util['format']('telephone:%s',_0x26710a[_0x56de99][_0x2ff784][_0x1dfb('0x4')]));break;case 0x8:if(_0x1cf4cd[_0x1dfb('0x1b')]!==_0x1dfb('0x44'))_0x5de3c9[_0x2c9a0c](util[_0x1dfb('0x1c')](_0x1dfb('0x45'),_0x26710a[_0x56de99][_0x2ff784][_0x1dfb('0x4')]));break;case 0x9:if(_0x1cf4cd[_0x1dfb('0x1b')]!=='agent')_0x5de3c9[_0x2c9a0c](util[_0x1dfb('0x1c')](_0x1dfb('0x46'),_0x26710a[_0x56de99][_0x2ff784][_0x1dfb('0x8')],_0x26710a[_0x56de99][_0x2ff784]['name']));break;case 0xa:_0x5de3c9[_0x2c9a0c](util[_0x1dfb('0x1c')](_0x1dfb('0x1e'),_0x26710a[_0x56de99][_0x2ff784]['name']));break;}}}}})[_0x1dfb('0x18')](function(){if(_0x2c9a0c===_0x1dfb('0x47')){var _0x3de05f=_[_0x1dfb('0x19')](_0x1cf4cd[_0x1dfb('0x48')],'id');return _0x1cf4cd[_0x1dfb('0x49')](_0x3de05f)[_0x1dfb('0x18')](function(){for(var _0x325ef8=0x0;_0x325ef8<_0x3de05f[_0x1dfb('0x1d')];_0x325ef8+=0x1){_0x1ceaab['emit'](_0x1dfb('0x4a'),{'ChatInteractionId':Number(_0x3de05f[_0x325ef8]),'UserId':Number(_0x1cf4cd['id'])});}});}})[_0x1dfb('0x18')](function(){if(_0x2c9a0c===_0x1dfb('0x47')){var _0x556de4=_[_0x1dfb('0x19')](_0x1cf4cd[_0x1dfb('0x4b')],'id');return _0x1cf4cd[_0x1dfb('0x4c')](_0x556de4)[_0x1dfb('0x18')](function(){for(var _0x25e455=0x0;_0x25e455<_0x556de4['length'];_0x25e455+=0x1){_0x1ceaab[_0x1dfb('0x4d')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x556de4[_0x25e455]),'UserId':Number(_0x1cf4cd['id'])});}});}})['then'](function(){if(_0x2c9a0c==='leave'){var _0x51ee9c=_[_0x1dfb('0x19')](_0x1cf4cd[_0x1dfb('0x24')],'id');return _0x1cf4cd[_0x1dfb('0x4e')](_0x51ee9c)[_0x1dfb('0x18')](function(){for(var _0x1ee0cf=0x0;_0x1ee0cf<_0x51ee9c[_0x1dfb('0x1d')];_0x1ee0cf+=0x1){_0x1ceaab[_0x1dfb('0x4d')](_0x1dfb('0x4f'),{'FaxInteractionId':Number(_0x51ee9c[_0x1ee0cf]),'UserId':Number(_0x1cf4cd['id'])});}});}})[_0x1dfb('0x18')](function(){if(_0x2c9a0c===_0x1dfb('0x47')){var _0x41cb03=_['map'](_0x1cf4cd[_0x1dfb('0x25')],'id');return _0x1cf4cd[_0x1dfb('0x50')](_0x41cb03)['then'](function(){for(var _0x3c7e8d=0x0;_0x3c7e8d<_0x41cb03[_0x1dfb('0x1d')];_0x3c7e8d+=0x1){_0x1ceaab[_0x1dfb('0x4d')](_0x1dfb('0x51'),{'SmsInteractionId':Number(_0x41cb03[_0x3c7e8d]),'UserId':Number(_0x1cf4cd['id'])});}});}})[_0x1dfb('0x18')](function(){if(_0x2c9a0c===_0x1dfb('0x47')){var _0x54d8fe=_['map'](_0x1cf4cd[_0x1dfb('0x26')],'id');return _0x1cf4cd[_0x1dfb('0x52')](_0x54d8fe)['then'](function(){for(var _0x530ba9=0x0;_0x530ba9<_0x54d8fe['length'];_0x530ba9+=0x1){_0x1ceaab[_0x1dfb('0x4d')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x54d8fe[_0x530ba9]),'UserId':Number(_0x1cf4cd['id'])});}});}})[_0x1dfb('0x18')](function(){if(_0x2c9a0c===_0x1dfb('0x47')){var _0xef7a1=_[_0x1dfb('0x19')](_0x1cf4cd[_0x1dfb('0x53')],'id');return _0x1cf4cd[_0x1dfb('0x54')](_0xef7a1)[_0x1dfb('0x18')](function(){for(var _0xfdf97c=0x0;_0xfdf97c<_0xef7a1['length'];_0xfdf97c+=0x1){_0x1ceaab[_0x1dfb('0x4d')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0xef7a1[_0xfdf97c]),'UserId':Number(_0x1cf4cd['id'])});}});}})[_0x1dfb('0x55')](function(_0x123e5e){_0x5de3c9[_0x1dfb('0x56')](_0x123e5e);});}}function onDisconnect(_0x47c899,_0x545f5b){joinOrLeave(_0x47c899,_0x1dfb('0x47'),_0x545f5b);}function onConnect(_0xabb993){joinOrLeave(_0xabb993,'join');}exports[_0x1dfb('0x57')]=function(_0x19795d){_0x19795d['on'](_0x1dfb('0x58'),function(_0x8eaf81){_0x8eaf81[_0x1dfb('0x59')](0x0);_0x8eaf81[_0x1dfb('0x5a')]=_0x8eaf81[_0x1dfb('0x5b')][_0x1dfb('0x58')]['remoteAddress']+':'+_0x8eaf81[_0x1dfb('0x5b')][_0x1dfb('0x58')][_0x1dfb('0x5c')];_0x8eaf81[_0x1dfb('0x5d')]=new Date();_0x8eaf81['log']=function(_0x17c15a){console[_0x1dfb('0x56')](_0x1dfb('0x5e')+_0x8eaf81[_0x1dfb('0x5f')][_0x1dfb('0x4')]+'['+_0x8eaf81[_0x1dfb('0x5a')]+']',_0x17c15a);};_0x8eaf81['on']('disconnect',function(){onDisconnect(_0x8eaf81,_0x19795d);_0x8eaf81[_0x1dfb('0x56')]('DISCONNECTED');});onConnect(_0x8eaf81);_0x8eaf81[_0x1dfb('0x56')](_0x1dfb('0x60'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index eea04cd..b8cbfde 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 _0x86f6=['format','SIP/%s','name','agent','incomingmessage','outgoingmessage','AfterCreateMessage','offlineMessage','motionChannel','opened','resolve','AfterCreate','closed','changed','substatus','SELECT','AfterUpdate','fullname','internal','default','length','model','hook','callback','toLowerCase','../../mysqldb','jayson/promise','../logger','http','ChatInteraction','afterCreate','afterUpdate','Chat','ChatMessage','newmessage','Sms','SmsInteraction','newinteraction','closedinteraction','Whatsapp','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','request','EventManager','then','info','Trigger,\x20%s','error','catch','get','channel','event','direction','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','QueryTypes','contact','UserId','interface'];(function(_0x20afe4,_0x4b6778){var _0x4d4950=function(_0x1c0730){while(--_0x1c0730){_0x20afe4['push'](_0x20afe4['shift']());}};_0x4d4950(++_0x4b6778);}(_0x86f6,0xa5));var _0x686f=function(_0x1cfb9d,_0x4552ff){_0x1cfb9d=_0x1cfb9d-0x0;var _0x377a65=_0x86f6[_0x1cfb9d];return _0x377a65;};'use strict';var util=require('util');var db=require(_0x686f('0x0'))['db'];var jayson=require(_0x686f('0x1'));var logger=require(_0x686f('0x2'))('triggers');var client=jayson['client'][_0x686f('0x3')]({'port':0x232a});var triggers=[{'channel':'Chat','model':_0x686f('0x4'),'event':_0x686f('0x5'),'condition':'newinteraction','callback':afterCreate},{'channel':'Chat','model':'ChatInteraction','event':_0x686f('0x6'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x686f('0x7'),'model':_0x686f('0x8'),'event':_0x686f('0x5'),'condition':_0x686f('0x9'),'callback':afterCreateMessage},{'channel':_0x686f('0x7'),'model':'ChatOfflineMessage','event':_0x686f('0x5'),'condition':_0x686f('0x9'),'callback':afterCreateOfflineMessage},{'channel':_0x686f('0xa'),'model':_0x686f('0xb'),'event':_0x686f('0x5'),'condition':_0x686f('0xc'),'callback':afterCreate},{'channel':'Sms','model':_0x686f('0xb'),'event':_0x686f('0x6'),'condition':_0x686f('0xd'),'callback':afterUpdate},{'channel':_0x686f('0xa'),'model':'SmsMessage','event':'afterCreate','condition':_0x686f('0x9'),'callback':afterCreateMessage},{'channel':_0x686f('0xe'),'model':'WhatsappInteraction','event':'afterCreate','condition':_0x686f('0xc'),'callback':afterCreate},{'channel':_0x686f('0xe'),'model':'WhatsappInteraction','event':'afterUpdate','condition':_0x686f('0xd'),'callback':afterUpdate},{'channel':_0x686f('0xe'),'model':_0x686f('0xf'),'event':_0x686f('0x5'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x686f('0x10'),'model':_0x686f('0x11'),'event':_0x686f('0x5'),'condition':_0x686f('0xc'),'callback':afterCreate},{'channel':_0x686f('0x10'),'model':'FaxInteraction','event':_0x686f('0x6'),'condition':_0x686f('0xd'),'callback':afterUpdate},{'channel':'Fax','model':_0x686f('0x12'),'event':_0x686f('0x5'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x686f('0x13'),'model':_0x686f('0x14'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x686f('0x13'),'model':_0x686f('0x14'),'event':_0x686f('0x6'),'condition':_0x686f('0xd'),'callback':afterUpdate},{'channel':'Mail','model':_0x686f('0x15'),'event':_0x686f('0x5'),'condition':_0x686f('0x9'),'callback':afterCreateMessage},{'channel':_0x686f('0x16'),'model':_0x686f('0x17'),'event':_0x686f('0x5'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x686f('0x16'),'model':_0x686f('0x17'),'event':_0x686f('0x6'),'condition':_0x686f('0xd'),'callback':afterUpdate},{'channel':'Openchannel','model':'OpenchannelMessage','event':_0x686f('0x5'),'condition':_0x686f('0x9'),'callback':afterCreateMessage}];function request(_0x367501){return client[_0x686f('0x18')](_0x686f('0x19'),_0x367501)[_0x686f('0x1a')](function(_0x514420){logger[_0x686f('0x1b')](_0x686f('0x1c'),'EventManager',_0x514420);if(_0x514420[_0x686f('0x1d')]){if(_0x514420['error']['code']===0x1f4){logger[_0x686f('0x1d')](_0x686f('0x1c'),'EventManager',_0x514420[_0x686f('0x1d')]);}}})[_0x686f('0x1e')](function(_0x182732){logger[_0x686f('0x1d')]('Trigger,\x20%s',_0x686f('0x19'),_0x182732);});}function afterCreateMessage(_0x233bee){return function(_0x5680d1){_0x5680d1=_0x5680d1[_0x686f('0x1f')]({'plain':!![]});_0x5680d1[_0x686f('0x20')]=_0x233bee;_0x5680d1['motionChannel']=_0x233bee;_0x5680d1[_0x686f('0x21')]=_0x5680d1[_0x686f('0x22')];Promise['resolve']()[_0x686f('0x1a')](function(){if(typeof _0x5680d1[_0x686f('0x23')]===_0x686f('0x24'))return null;var _0x36a9b2=_0x686f('0x25')+_0x5680d1[_0x686f('0x23')];return db[_0x686f('0x26')][_0x686f('0x27')](_0x36a9b2,{'type':db[_0x686f('0x28')][_0x686f('0x29')]['SELECT'],'raw':!![]});})[_0x686f('0x1a')](function(_0x1c763f){if(_0x1c763f){_0x5680d1[_0x686f('0x2a')]=_0x1c763f[0x0];}if(typeof _0x5680d1[_0x686f('0x2b')]==='undefined')return;return getAgent(_0x5680d1['UserId']);})[_0x686f('0x1a')](function(_0x4f7b60){if(_0x4f7b60){_0x5680d1[_0x686f('0x2c')]=util[_0x686f('0x2d')](_0x686f('0x2e'),_0x4f7b60[_0x686f('0x2f')]);_0x5680d1[_0x686f('0x30')]=_0x4f7b60;_0x5680d1[_0x686f('0x20')]=_0x233bee;return request({'event':_0x686f('0x31'),'message':_0x5680d1});}else{return request({'event':_0x686f('0x32'),'message':_0x5680d1});}})['catch'](function(_0x1bc166){logger[_0x686f('0x1d')]('Trigger,\x20%s',_0x686f('0x33'),_0x1bc166);});};}function afterCreateOfflineMessage(_0xe446c0){return function(_0x414aec){_0x414aec=_0x414aec[_0x686f('0x1f')]({'plain':!![]});_0x414aec[_0x686f('0x20')]=_0xe446c0;_0x414aec['motionChannel']=_0xe446c0;_0x414aec[_0x686f('0x21')]=_0x686f('0x34');return request({'event':_0x414aec[_0x686f('0x21')],'message':_0x414aec});};}function afterCreate(_0x4e1a68,_0x43148d){return function(_0x5b5ca9){_0x5b5ca9=_0x5b5ca9[_0x686f('0x1f')]({'plain':!![]});_0x5b5ca9['channel']=_0x4e1a68;_0x5b5ca9[_0x686f('0x35')]=_0x4e1a68;_0x5b5ca9[_0x686f('0x21')]=_0x686f('0x36');Promise[_0x686f('0x37')]()[_0x686f('0x1a')](function(){var _0x14b11d=_0x686f('0x25')+_0x5b5ca9[_0x686f('0x23')];return db[_0x686f('0x26')][_0x686f('0x27')](_0x14b11d,{'type':db['Sequelize'][_0x686f('0x29')]['SELECT'],'raw':!![]});})[_0x686f('0x1a')](function(_0x333431){if(_0x333431){_0x5b5ca9[_0x686f('0x2a')]=_0x333431[0x0];}if(typeof _0x5b5ca9[_0x686f('0x2b')]===_0x686f('0x24'))return;return getAgent(_0x5b5ca9[_0x686f('0x2b')]);})['then'](function(_0x202fc7){if(_0x202fc7){_0x5b5ca9[_0x686f('0x2c')]=util[_0x686f('0x2d')]('SIP/%s',_0x202fc7[_0x686f('0x2f')]);_0x5b5ca9[_0x686f('0x30')]=_0x202fc7;}return request({'event':_0x43148d,'message':_0x5b5ca9});})[_0x686f('0x1e')](function(_0x230887){logger['error'](_0x686f('0x1c'),_0x686f('0x38'),_0x230887);});};}function afterUpdate(_0x1fa811){return function(_0x1c269e){var _0xb1d505=_0x1c269e['changed'](_0x686f('0x39'))&&_0x1c269e[_0x686f('0x39')];var _0x50a664=_0x1c269e[_0x686f('0x3a')](_0x686f('0x3b'));if(_0xb1d505||_0x50a664){var _0x4ea940=_0xb1d505?_0x686f('0xd'):'substatus';var _0x1770a9=_0x1c269e[_0x686f('0x1f')]({'plain':!![]});_0x1770a9[_0x686f('0x20')]=_0x1fa811;_0x1770a9['motionChannel']=_0x1fa811;_0x1770a9[_0x686f('0x21')]=_0xb1d505?'closed':_0x686f('0x3b');var _0x19846b=_0x686f('0x25')+_0x1770a9[_0x686f('0x23')];return db[_0x686f('0x26')]['query'](_0x19846b,{'type':db[_0x686f('0x28')][_0x686f('0x29')][_0x686f('0x3c')],'raw':!![]})[_0x686f('0x1a')](function(_0x23684d){if(_0x23684d){_0x1770a9[_0x686f('0x2a')]=_0x23684d[0x0];}if(typeof _0x1770a9[_0x686f('0x2b')]===_0x686f('0x24'))return;return getAgent(_0x1770a9[_0x686f('0x2b')]);})['then'](function(_0x39f152){if(_0x39f152){_0x1770a9['interface']=util[_0x686f('0x2d')]('SIP/%s',_0x39f152[_0x686f('0x2f')]);_0x1770a9['agent']=_0x39f152;}return request({'event':_0x4ea940,'message':_0x1770a9});})[_0x686f('0x1e')](function(_0x2c0870){logger[_0x686f('0x1d')](_0x686f('0x1c'),_0x686f('0x3d'),_0x2c0870);});}};}function getAgent(_0x50b827){return db['User']['find']({'where':{'id':_0x50b827},'attributes':['id',_0x686f('0x2f'),_0x686f('0x3e'),'email',_0x686f('0x3f')],'raw':!![]})['then'](function(_0xa954f){return _0xa954f;});}exports[_0x686f('0x40')]=function(){for(var _0x581b6e=0x0;_0x581b6e=_0x1323d2[_0xfdf0('0x15')]){throw Error(_0xfdf0('0x16'));}_0x368678(_0xc2bca7);})[_0xfdf0('0x17')](function(_0x18b001){_0x47d490(_0x18b001);});});}; \ No newline at end of file +var _0x134b=['isUndefined','blockedAt','updateAttributes','getLicense','role','User','count','agent','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','./license/util','voice','mail','chat','sms','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','clearBlockUser'];(function(_0x3c4e48,_0x43a5eb){var _0x37fd7e=function(_0x27aa2b){while(--_0x27aa2b){_0x3c4e48['push'](_0x3c4e48['shift']());}};_0x37fd7e(++_0x43a5eb);}(_0x134b,0x1c6));var _0xb134=function(_0x1ebce2,_0x10e903){_0x1ebce2=_0x1ebce2-0x0;var _0x4a330c=_0x134b[_0x1ebce2];return _0x4a330c;};'use strict';var _=require(_0xb134('0x0'));var BPromise=require(_0xb134('0x1'));var db=require(_0xb134('0x2'))['db'];var util=require(_0xb134('0x3'));var channels=[_0xb134('0x4'),_0xb134('0x5'),_0xb134('0x6'),'fax',_0xb134('0x7'),_0xb134('0x8'),_0xb134('0x9')];exports[_0xb134('0xa')]=function(){return channels;};exports[_0xb134('0xb')]=function(_0x2fc372){_0x2fc372=_0x2fc372[_0xb134('0xc')]();return _['includes'](channels,_0x2fc372);};exports[_0xb134('0xd')]=function(_0x154fd4,_0x4deba0,_0x14e8b7,_0x8b41dc){var _0x2f88c5={'loginAttempts':_0x4deba0,'blocked':_0x14e8b7};if(!_[_0xb134('0xe')](_0x8b41dc)){_0x2f88c5[_0xb134('0xf')]=_0x8b41dc;}return _0x154fd4[_0xb134('0x10')](_0x2f88c5);};exports[_0xb134('0x11')]=function(_0x577467){return new BPromise(function(_0x5a159d,_0x4aadb7){var _0x495fe3=0x0;if(_0x577467[_0xb134('0x12')]!=='agent'){_0x5a159d(_0x577467);}db[_0xb134('0x13')][_0xb134('0x14')]({'where':{'role':_0xb134('0x15'),'online':!![],'id':{'$ne':_0x577467['id']}}})[_0xb134('0x16')](function(_0x20483f){_0x495fe3=_0x20483f;return util['getLicense']();})[_0xb134('0x16')](function(_0x3ae5bb){if(_0x3ae5bb&&_0x3ae5bb['agents']&&_0x495fe3>=_0x3ae5bb[_0xb134('0x17')]){throw Error(_0xb134('0x18'));}_0x5a159d(_0x577467);})[_0xb134('0x19')](function(_0x53e201){_0x4aadb7(_0x53e201);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index f6cc323..74b605e 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4eb=['Bad\x20Request','name','Not\x20Found','Forbidden','OutOfInterval','stack','send','exports','util','message','Error','inherits'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xf4eb,0xec));var _0xbf4e=function(_0x3e8dc1,_0x1a879a){_0x3e8dc1=_0x3e8dc1-0x0;var _0x4a835d=_0xf4eb[_0x3e8dc1];return _0x4a835d;};'use strict';var util=require(_0xbf4e('0x0'));var logger=require('../config/logger')('api');var APIError=function(_0x479210,_0x5ed5b9){this[_0xbf4e('0x1')]=_0x479210||'Internal\x20Server\x20Error';this['name']=_0x5ed5b9||_0xbf4e('0x2');util[_0xbf4e('0x3')](APIError,Error);};var APIBadRequestError=function(_0x32d1d7){this[_0xbf4e('0x1')]=_0x32d1d7||_0xbf4e('0x4');this[_0xbf4e('0x5')]=_0xbf4e('0x4');util['inherits'](APIBadRequestError,APIError);};var APINotFoundError=function(_0x449d55){this['message']=_0x449d55||'Entity\x20not\x20found';this[_0xbf4e('0x5')]=_0xbf4e('0x6');util[_0xbf4e('0x3')](APINotFoundError,APIError);};function getStatusCode(_0xc86f04){switch(_0xc86f04){case _0xbf4e('0x4'):return 0x190;case _0xbf4e('0x7'),_0xbf4e('0x8'):return 0x193;case'Not\x20Found':return 0x194;default:return 0x1f4;}}function handleError(_0x4d9a07){return function(_0x7dfb74){logger['error'](_0x7dfb74[_0xbf4e('0x9')]);var _0xcf6ba8=getStatusCode(_0x7dfb74['name']);if(_0x7dfb74[_0xbf4e('0x5')])delete _0x7dfb74['name'];return _0x4d9a07['status'](_0xcf6ba8)[_0xbf4e('0xa')](_0x7dfb74);};}module[_0xbf4e('0xb')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0x70e0=['OutOfInterval','error','stack','status','util','../config/logger','api','message','Internal\x20Server\x20Error','name','Error','Bad\x20Request','Entity\x20not\x20found','Not\x20Found','inherits'];(function(_0x2eab1d,_0x54edd4){var _0x37cfed=function(_0xda2e04){while(--_0xda2e04){_0x2eab1d['push'](_0x2eab1d['shift']());}};_0x37cfed(++_0x54edd4);}(_0x70e0,0x17b));var _0x070e=function(_0x37c745,_0x318c6e){_0x37c745=_0x37c745-0x0;var _0x7cfd7b=_0x70e0[_0x37c745];return _0x7cfd7b;};'use strict';var util=require(_0x070e('0x0'));var logger=require(_0x070e('0x1'))(_0x070e('0x2'));var APIError=function(_0x4d95bb,_0x579b83){this[_0x070e('0x3')]=_0x4d95bb||_0x070e('0x4');this[_0x070e('0x5')]=_0x579b83||_0x070e('0x6');util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x7bce9b){this['message']=_0x7bce9b||_0x070e('0x7');this['name']='Bad\x20Request';util['inherits'](APIBadRequestError,APIError);};var APINotFoundError=function(_0x35ab0c){this[_0x070e('0x3')]=_0x35ab0c||_0x070e('0x8');this[_0x070e('0x5')]=_0x070e('0x9');util[_0x070e('0xa')](APINotFoundError,APIError);};function getStatusCode(_0x11ffa8){switch(_0x11ffa8){case'Bad\x20Request':return 0x190;case'Forbidden',_0x070e('0xb'):return 0x193;case _0x070e('0x9'):return 0x194;default:return 0x1f4;}}function handleError(_0x12bb37){return function(_0xb8d819){logger[_0x070e('0xc')](_0xb8d819[_0x070e('0xd')]);var _0x25cfe1=getStatusCode(_0xb8d819[_0x070e('0x5')]);if(_0xb8d819[_0x070e('0x5')])delete _0xb8d819[_0x070e('0x5')];return _0x12bb37[_0x070e('0xe')](_0x25cfe1)['send'](_0xb8d819);};}module['exports']={'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 1d86926..50adb6c 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0729=['json','send','404','status','render'];(function(_0x15a0b0,_0x211684){var _0x579e78=function(_0xdf5e62){while(--_0xdf5e62){_0x15a0b0['push'](_0x15a0b0['shift']());}};_0x579e78(++_0x211684);}(_0x0729,0x98));var _0x9072=function(_0x55ecc5,_0x5a65b1){_0x55ecc5=_0x55ecc5-0x0;var _0x11346d=_0x0729[_0x55ecc5];return _0x11346d;};'use strict';module['exports'][0x194]=function pageNotFound(_0x3b0fec,_0x2aa9dc){var _0x4142e1=_0x9072('0x0');var _0x4c0a1b=0x194;var _0x3ed9cf={'status':_0x4c0a1b};_0x2aa9dc[_0x9072('0x1')](_0x3ed9cf[_0x9072('0x1')]);_0x2aa9dc[_0x9072('0x2')](_0x4142e1,{},function(_0x27f61b,_0x3c9504){if(_0x27f61b){return _0x2aa9dc[_0x9072('0x1')](_0x3ed9cf['status'])[_0x9072('0x3')](_0x3ed9cf);}_0x2aa9dc[_0x9072('0x4')](_0x3c9504);});}; \ No newline at end of file +var _0xaef4=['404','status','render','json','send','exports'];(function(_0x34b87f,_0x28aef2){var _0x449805=function(_0x3735b7){while(--_0x3735b7){_0x34b87f['push'](_0x34b87f['shift']());}};_0x449805(++_0x28aef2);}(_0xaef4,0xfb));var _0x4aef=function(_0x2ca7e7,_0xb6f1a7){_0x2ca7e7=_0x2ca7e7-0x0;var _0x589560=_0xaef4[_0x2ca7e7];return _0x589560;};'use strict';module[_0x4aef('0x0')][0x194]=function pageNotFound(_0x487ab7,_0x284041){var _0x5bc46f=_0x4aef('0x1');var _0x6d2797=0x194;var _0x1995f8={'status':_0x6d2797};_0x284041[_0x4aef('0x2')](_0x1995f8['status']);_0x284041[_0x4aef('0x3')](_0x5bc46f,{},function(_0x43d329,_0x52b77a){if(_0x43d329){return _0x284041[_0x4aef('0x2')](_0x1995f8['status'])[_0x4aef('0x4')](_0x1995f8);}_0x284041[_0x4aef('0x5')](_0x52b77a);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 396dd7b..bfebfcd 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(_0xd8a8af,_0x1e93f0){var _0x5b7278=function(_0x458800){while(--_0x458800){_0xd8a8af['push'](_0xd8a8af['shift']());}};_0x5b7278(++_0x1e93f0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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(_0x3861f7,_0x995b22){var _0x50879f=function(_0x3003f1){while(--_0x3003f1){_0x3861f7['push'](_0x3861f7['shift']());}};_0x50879f(++_0x995b22);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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 89b3e22..51d89f9 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53bf=['./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesConfiguration','/api/networks','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/mail/reports/transfer','./api/mailTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','./api/realtime','/api/user-settings','./api/user-setting','./api/authLocal','/api/auth/google','./api/authGoogle','./api/authActiveDirectory','/api/jira','/api/rpc','./api/rpc','./api/version','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','snippet','3.1.0','route','/:url(api|auth|components|app|bower_components|assets)/*','get','appPath','/index.html','express','./utils/client-side-logger','./api/client-side-logs','default','/api/users','use','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperFinal','./api/cmHopperHistory','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','./api/variable','./api/integration','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations'];(function(_0x559a80,_0x3d193d){var _0x42f555=function(_0x24e596){while(--_0x24e596){_0x559a80['push'](_0x559a80['shift']());}};_0x42f555(++_0x3d193d);}(_0x53bf,0x19b));var _0xf53b=function(_0xbf06fc,_0x4e56d8){_0xbf06fc=_0xbf06fc-0x0;var _0x4e5c31=_0x53bf[_0xbf06fc];return _0x4e5c31;};'use strict';var path=require('path');var express=require(_0xf53b('0x0'));var errors=require('./errors');var config=require('./config/environment');var setupLoggers=require(_0xf53b('0x1'))['setupLoggers'];var clientSideLogs=require(_0xf53b('0x2'));exports[_0xf53b('0x3')]=function(_0x1b7902){return setupLoggers(_0x1b7902)['then'](function(){_0x1b7902['use'](_0xf53b('0x4'),require('./api/user'));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x6'),require(_0xf53b('0x7')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x8'),require(_0xf53b('0x9')));_0x1b7902['use'](_0xf53b('0xa'),require(_0xf53b('0xb')));_0x1b7902[_0xf53b('0x5')]('/api/voice/mohs',require(_0xf53b('0xc')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0xd'),require(_0xf53b('0xe')));_0x1b7902['use'](_0xf53b('0xf'),require(_0xf53b('0x10')));_0x1b7902['use'](_0xf53b('0x11'),require(_0xf53b('0x12')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x13'),require('./api/voiceMail'));_0x1b7902[_0xf53b('0x5')]('/api/voice/mails/messages',require(_0xf53b('0x14')));_0x1b7902['use'](_0xf53b('0x15'),require(_0xf53b('0x16')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x17'),require(_0xf53b('0x18')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x19'),require(_0xf53b('0x1a')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x1b'),require(_0xf53b('0x1c')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x1d'),require(_0xf53b('0x1e')));_0x1b7902[_0xf53b('0x5')]('/api/trunks',require(_0xf53b('0x1f')));_0x1b7902['use'](_0xf53b('0x20'),require(_0xf53b('0x21')));_0x1b7902['use'](_0xf53b('0x22'),require(_0xf53b('0x23')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x24'),require(_0xf53b('0x25')));_0x1b7902['use'](_0xf53b('0x26'),require(_0xf53b('0x27')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x28'),require(_0xf53b('0x29')));_0x1b7902['use']('/api/mail/interactions',require('./api/mailInteraction'));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x2a'),require(_0xf53b('0x2b')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x2c'),require(_0xf53b('0x2d')));_0x1b7902['use']('/api/mail/reports/queue',require(_0xf53b('0x2e')));_0x1b7902['use']('/api/dashboards',require(_0xf53b('0x2f')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x30'),require(_0xf53b('0x31')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x32'),require(_0xf53b('0x33')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x34'),require('./api/faxApplication'));_0x1b7902[_0xf53b('0x5')]('/api/fax/interactions',require('./api/faxInteraction'));_0x1b7902[_0xf53b('0x5')]('/api/fax/messages',require('./api/faxMessage'));_0x1b7902['use'](_0xf53b('0x35'),require(_0xf53b('0x36')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x37'),require(_0xf53b('0x38')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x39'),require('./api/smsAccount'));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x3a'),require(_0xf53b('0x3b')));_0x1b7902['use']('/api/sms/interactions',require(_0xf53b('0x3c')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x3d'),require(_0xf53b('0x3e')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x3f'),require('./api/smsQueue'));_0x1b7902['use']('/api/openchannel/accounts',require(_0xf53b('0x40')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x41'),require(_0xf53b('0x42')));_0x1b7902['use'](_0xf53b('0x43'),require('./api/openchannelInteraction'));_0x1b7902['use'](_0xf53b('0x44'),require(_0xf53b('0x45')));_0x1b7902['use'](_0xf53b('0x46'),require(_0xf53b('0x47')));_0x1b7902[_0xf53b('0x5')]('/api/chat/websites',require('./api/chatWebsite'));_0x1b7902['use']('/api/openchannel/reports/queue',require(_0xf53b('0x48')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x49'),require(_0xf53b('0x4a')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x4b'),require(_0xf53b('0x4c')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x4d'),require(_0xf53b('0x4e')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x4f'),require('./api/chatOfflineMessage'));_0x1b7902['use'](_0xf53b('0x50'),require(_0xf53b('0x51')));_0x1b7902['use']('/api/chat/groups',require('./api/chatGroup'));_0x1b7902['use'](_0xf53b('0x52'),require(_0xf53b('0x53')));_0x1b7902[_0xf53b('0x5')]('/api/cm/companies',require(_0xf53b('0x54')));_0x1b7902['use'](_0xf53b('0x55'),require(_0xf53b('0x56')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x57'),require(_0xf53b('0x58')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x59'),require('./api/cmHopperBlack'));_0x1b7902[_0xf53b('0x5')]('/api/cm/hopper_final',require(_0xf53b('0x5a')));_0x1b7902[_0xf53b('0x5')]('/api/cm/hopper_history',require(_0xf53b('0x5b')));_0x1b7902[_0xf53b('0x5')]('/api/cm/custom_fields',require(_0xf53b('0x5c')));_0x1b7902['use'](_0xf53b('0x5d'),require(_0xf53b('0x5e')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x5f'),require(_0xf53b('0x60')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x61'),require(_0xf53b('0x62')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x63'),require(_0xf53b('0x64')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x65'),require('./api/condition'));_0x1b7902[_0xf53b('0x5')]('/api/intervals',require(_0xf53b('0x66')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x67'),require(_0xf53b('0x68')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x69'),require(_0xf53b('0x6a')));_0x1b7902[_0xf53b('0x5')]('/api/voiceQueuesLog',require('./api/voiceQueuesLog'));_0x1b7902[_0xf53b('0x5')]('/api/schedules',require(_0xf53b('0x6b')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x6c'),require(_0xf53b('0x6d')));_0x1b7902['use'](_0xf53b('0x6e'),require(_0xf53b('0x6f')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x70'),require('./api/contactItemType'));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x71'),require(_0xf53b('0x72')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x73'),require(_0xf53b('0x74')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x75'),require(_0xf53b('0x76')));_0x1b7902['use'](_0xf53b('0x77'),require(_0xf53b('0x78')));_0x1b7902[_0xf53b('0x5')]('/api/variables',require(_0xf53b('0x79')));_0x1b7902['use']('/api/integrations',require(_0xf53b('0x7a')));_0x1b7902[_0xf53b('0x5')]('/api/integrations/reports',require(_0xf53b('0x7b')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x7c'),require(_0xf53b('0x7d')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x7e'),require('./api/analyticDefaultReport'));_0x1b7902['use'](_0xf53b('0x7f'),require(_0xf53b('0x80')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x81'),require(_0xf53b('0x82')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x83'),require(_0xf53b('0x84')));_0x1b7902[_0xf53b('0x5')]('/api/analytics/tree_reports',require(_0xf53b('0x85')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x86'),require('./api/intSalesforceAccount'));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x87'),require(_0xf53b('0x88')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x89'),require(_0xf53b('0x8a')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x8b'),require('./api/intSugarcrmAccount'));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x8c'),require(_0xf53b('0x8d')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x8e'),require(_0xf53b('0x8f')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x90'),require(_0xf53b('0x91')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x92'),require('./api/intDeskConfiguration'));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x93'),require('./api/intDeskField'));_0x1b7902['use'](_0xf53b('0x94'),require(_0xf53b('0x95')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x96'),require(_0xf53b('0x97')));_0x1b7902['use'](_0xf53b('0x98'),require(_0xf53b('0x99')));_0x1b7902['use']('/api/integrations/zendesk/accounts',require(_0xf53b('0x9a')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x9b'),require(_0xf53b('0x9c')));_0x1b7902['use'](_0xf53b('0x9d'),require(_0xf53b('0x9e')));_0x1b7902[_0xf53b('0x5')]('/api/integrations/freshdesk/accounts',require(_0xf53b('0x9f')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0xa0'),require(_0xf53b('0xa1')));_0x1b7902['use'](_0xf53b('0xa2'),require(_0xf53b('0xa3')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0xa4'),require(_0xf53b('0xa5')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0xa6'),require(_0xf53b('0xa7')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0xa8'),require(_0xf53b('0xa9')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0xaa'),require(_0xf53b('0xab')));_0x1b7902['use'](_0xf53b('0xac'),require(_0xf53b('0xad')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0xae'),require(_0xf53b('0xaf')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0xb0'),require('./api/intDynamics365Account'));_0x1b7902[_0xf53b('0x5')]('/api/integrations/dynamics365/configurations',require('./api/intDynamics365Configuration'));_0x1b7902[_0xf53b('0x5')](_0xf53b('0xb1'),require(_0xf53b('0xb2')));_0x1b7902[_0xf53b('0x5')]('/api/integrations/freshsales/accounts',require('./api/intFreshsalesAccount'));_0x1b7902[_0xf53b('0x5')]('/api/integrations/freshsales/configurations',require(_0xf53b('0xb3')));_0x1b7902[_0xf53b('0x5')]('/api/integrations/freshsales/fields',require('./api/intFreshsalesField'));_0x1b7902[_0xf53b('0x5')](_0xf53b('0xb4'),require('./api/network'));_0x1b7902[_0xf53b('0x5')](_0xf53b('0xb5'),require(_0xf53b('0xb6')));_0x1b7902[_0xf53b('0x5')]('/api/chat/internal/messages',require(_0xf53b('0xb7')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0xb8'),require(_0xf53b('0xb9')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0xba'),require('./api/jscriptyQuestionReport'));_0x1b7902[_0xf53b('0x5')](_0xf53b('0xbb'),require('./api/jscriptySessionReport'));_0x1b7902[_0xf53b('0x5')](_0xf53b('0xbc'),require(_0xf53b('0xbd')));_0x1b7902['use']('/api/square/reports',require(_0xf53b('0xbe')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0xbf'),require(_0xf53b('0xc0')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0xc1'),require(_0xf53b('0xc2')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0xc3'),require(_0xf53b('0xc4')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0xc5'),require(_0xf53b('0xc6')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0xc7'),require(_0xf53b('0xc8')));_0x1b7902['use'](_0xf53b('0xc9'),require(_0xf53b('0xca')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0xcb'),require(_0xf53b('0xcc')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0xcd'),require(_0xf53b('0xce')));_0x1b7902[_0xf53b('0x5')]('/api/license',require(_0xf53b('0xcf')));_0x1b7902['use'](_0xf53b('0xd0'),require(_0xf53b('0xd1')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0xd2'),require(_0xf53b('0xd3')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0xd4'),require(_0xf53b('0xd5')));_0x1b7902[_0xf53b('0x5')]('/api/plugins',require('./api/plugin'));_0x1b7902[_0xf53b('0x5')](_0xf53b('0xd6'),require(_0xf53b('0xd7')));_0x1b7902['use']('/api/chat/reports/transfer',require('./api/chatTransferReport'));_0x1b7902[_0xf53b('0x5')](_0xf53b('0xd8'),require(_0xf53b('0xd9')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0xda'),require(_0xf53b('0xdb')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0xdc'),require(_0xf53b('0xdd')));_0x1b7902['use'](_0xf53b('0xde'),require(_0xf53b('0xdf')));_0x1b7902['use'](_0xf53b('0xe0'),require(_0xf53b('0xe1')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0xe2'),require(_0xf53b('0xe3')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0xe4'),require(_0xf53b('0xe5')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0xe6'),require('./api/userProfileResource'));_0x1b7902[_0xf53b('0x5')](_0xf53b('0xe7'),require(_0xf53b('0xe8')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0xe9'),require(_0xf53b('0xea')));_0x1b7902[_0xf53b('0x5')]('/api/whatsapp/applications',require(_0xf53b('0xeb')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0xec'),require(_0xf53b('0xed')));_0x1b7902['use']('/api/whatsapp/messages',require('./api/whatsappMessage'));_0x1b7902[_0xf53b('0x5')](_0xf53b('0xee'),require(_0xf53b('0xef')));_0x1b7902[_0xf53b('0x5')]('/api/whatsapp/reports/transfer',require(_0xf53b('0xf0')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0xf1'),require(_0xf53b('0xf2')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0xf3'),require(_0xf53b('0xf4')));_0x1b7902[_0xf53b('0x5')]('/api/realtime',require(_0xf53b('0xf5')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0xf6'),require(_0xf53b('0xf7')));_0x1b7902['use']('/api/auth/local',require(_0xf53b('0xf8')));_0x1b7902['use'](_0xf53b('0xf9'),require(_0xf53b('0xfa')));_0x1b7902[_0xf53b('0x5')]('/api/auth/activedirectory',require(_0xf53b('0xfb')));_0x1b7902['use'](_0xf53b('0xfc'),require('./api/jira'));_0x1b7902[_0xf53b('0x5')](_0xf53b('0xfd'),require(_0xf53b('0xfe')));_0x1b7902[_0xf53b('0x5')]('/api/version',require(_0xf53b('0xff')));_0x1b7902[_0xf53b('0x5')]('/api/system',require(_0xf53b('0x100')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x101'),require(_0xf53b('0x102')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x103'),require(_0xf53b('0x104')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x105'),clientSideLogs);_0x1b7902[_0xf53b('0x5')](_0xf53b('0x106'),express[_0xf53b('0x107')](path[_0xf53b('0x108')](config[_0xf53b('0x109')],'/apidoc')));_0x1b7902[_0xf53b('0x5')]('/www',express[_0xf53b('0x107')](path[_0xf53b('0x108')](config[_0xf53b('0x109')],_0xf53b('0x10a'))));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x10b'),express[_0xf53b('0x107')](path[_0xf53b('0x108')](config['root'],'/demo')));_0x1b7902[_0xf53b('0x5')](_0xf53b('0x10c'),express[_0xf53b('0x107')](path[_0xf53b('0x108')](config['root'],_0xf53b('0x10d'),_0xf53b('0x10e'))));_0x1b7902[_0xf53b('0x5')]('/plugins',express[_0xf53b('0x107')](path[_0xf53b('0x108')](config['root'],'/server/files/plugins')));_0x1b7902[_0xf53b('0x10f')](_0xf53b('0x110'))[_0xf53b('0x111')](errors[0x194]);_0x1b7902[_0xf53b('0x10f')]('/*')[_0xf53b('0x111')](function(_0x53fdcf,_0x202643){_0x202643['sendFile'](path['resolve'](_0x1b7902[_0xf53b('0x111')](_0xf53b('0x112'))+_0xf53b('0x113')));});return _0x1b7902;});}; \ No newline at end of file +var _0x7502=['/api/chat/queues','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/automations','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','./api/condition','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','/api/tags','./api/tag','/api/contact_item_types','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/template','/api/triggers','./api/trigger','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','./api/license','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/realtime','./api/realtime','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','/apidoc','join','root','/www','/demo','static','/snippet','snippet','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','./config/environment','./utils/client-side-logger','setupLoggers','default','/api/users','./api/user','use','./api/voiceChanSpy','/api/voice/contexts','/api/voice/mohs','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','/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/openchannelQueue','/api/chat/websites','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages'];(function(_0x5d8617,_0x1ca5aa){var _0x34928b=function(_0x58fc20){while(--_0x58fc20){_0x5d8617['push'](_0x5d8617['shift']());}};_0x34928b(++_0x1ca5aa);}(_0x7502,0xba));var _0x2750=function(_0x5787ee,_0x1396a8){_0x5787ee=_0x5787ee-0x0;var _0x529a2d=_0x7502[_0x5787ee];return _0x529a2d;};'use strict';var path=require(_0x2750('0x0'));var express=require('express');var errors=require('./errors');var config=require(_0x2750('0x1'));var setupLoggers=require(_0x2750('0x2'))[_0x2750('0x3')];var clientSideLogs=require('./api/client-side-logs');exports[_0x2750('0x4')]=function(_0x19d86a){return setupLoggers(_0x19d86a)['then'](function(){_0x19d86a['use'](_0x2750('0x5'),require(_0x2750('0x6')));_0x19d86a[_0x2750('0x7')]('/api/voice/chanspy',require(_0x2750('0x8')));_0x19d86a[_0x2750('0x7')](_0x2750('0x9'),require('./api/voiceContext'));_0x19d86a['use']('/api/voice/extensions',require('./api/voiceExtension'));_0x19d86a[_0x2750('0x7')](_0x2750('0xa'),require('./api/voiceMusicOnHold'));_0x19d86a[_0x2750('0x7')](_0x2750('0xb'),require(_0x2750('0xc')));_0x19d86a['use'](_0x2750('0xd'),require(_0x2750('0xe')));_0x19d86a[_0x2750('0x7')]('/api/screen/recordings',require(_0x2750('0xf')));_0x19d86a[_0x2750('0x7')](_0x2750('0x10'),require(_0x2750('0x11')));_0x19d86a[_0x2750('0x7')](_0x2750('0x12'),require('./api/voiceMailMessage'));_0x19d86a[_0x2750('0x7')](_0x2750('0x13'),require('./api/voiceCallReport'));_0x19d86a['use'](_0x2750('0x14'),require(_0x2750('0x15')));_0x19d86a[_0x2750('0x7')]('/api/voice/agents/reports',require(_0x2750('0x16')));_0x19d86a['use'](_0x2750('0x17'),require(_0x2750('0x18')));_0x19d86a['use'](_0x2750('0x19'),require(_0x2750('0x1a')));_0x19d86a[_0x2750('0x7')](_0x2750('0x1b'),require(_0x2750('0x1c')));_0x19d86a[_0x2750('0x7')](_0x2750('0x1d'),require(_0x2750('0x1e')));_0x19d86a[_0x2750('0x7')](_0x2750('0x1f'),require(_0x2750('0x20')));_0x19d86a[_0x2750('0x7')](_0x2750('0x21'),require(_0x2750('0x22')));_0x19d86a['use'](_0x2750('0x23'),require(_0x2750('0x24')));_0x19d86a['use'](_0x2750('0x25'),require(_0x2750('0x26')));_0x19d86a['use'](_0x2750('0x27'),require(_0x2750('0x28')));_0x19d86a[_0x2750('0x7')](_0x2750('0x29'),require(_0x2750('0x2a')));_0x19d86a[_0x2750('0x7')](_0x2750('0x2b'),require('./api/mailApplication'));_0x19d86a['use'](_0x2750('0x2c'),require(_0x2750('0x2d')));_0x19d86a[_0x2750('0x7')]('/api/dashboards',require(_0x2750('0x2e')));_0x19d86a[_0x2750('0x7')](_0x2750('0x2f'),require(_0x2750('0x30')));_0x19d86a[_0x2750('0x7')](_0x2750('0x31'),require('./api/faxAccount'));_0x19d86a[_0x2750('0x7')]('/api/fax/applications',require('./api/faxApplication'));_0x19d86a[_0x2750('0x7')](_0x2750('0x32'),require(_0x2750('0x33')));_0x19d86a[_0x2750('0x7')](_0x2750('0x34'),require(_0x2750('0x35')));_0x19d86a[_0x2750('0x7')](_0x2750('0x36'),require('./api/faxQueue'));_0x19d86a[_0x2750('0x7')](_0x2750('0x37'),require(_0x2750('0x38')));_0x19d86a[_0x2750('0x7')](_0x2750('0x39'),require(_0x2750('0x3a')));_0x19d86a['use']('/api/sms/applications',require(_0x2750('0x3b')));_0x19d86a[_0x2750('0x7')](_0x2750('0x3c'),require(_0x2750('0x3d')));_0x19d86a['use']('/api/sms/messages',require(_0x2750('0x3e')));_0x19d86a[_0x2750('0x7')](_0x2750('0x3f'),require(_0x2750('0x40')));_0x19d86a[_0x2750('0x7')](_0x2750('0x41'),require(_0x2750('0x42')));_0x19d86a[_0x2750('0x7')](_0x2750('0x43'),require(_0x2750('0x44')));_0x19d86a[_0x2750('0x7')](_0x2750('0x45'),require(_0x2750('0x46')));_0x19d86a[_0x2750('0x7')](_0x2750('0x47'),require(_0x2750('0x48')));_0x19d86a['use'](_0x2750('0x49'),require(_0x2750('0x4a')));_0x19d86a[_0x2750('0x7')](_0x2750('0x4b'),require('./api/chatWebsite'));_0x19d86a[_0x2750('0x7')]('/api/openchannel/reports/queue',require('./api/openchannelQueueReport'));_0x19d86a[_0x2750('0x7')]('/api/chat/applications',require('./api/chatApplication'));_0x19d86a[_0x2750('0x7')](_0x2750('0x4c'),require(_0x2750('0x4d')));_0x19d86a['use'](_0x2750('0x4e'),require(_0x2750('0x4f')));_0x19d86a[_0x2750('0x7')](_0x2750('0x50'),require('./api/chatOfflineMessage'));_0x19d86a[_0x2750('0x7')](_0x2750('0x51'),require(_0x2750('0x52')));_0x19d86a[_0x2750('0x7')](_0x2750('0x53'),require('./api/chatGroup'));_0x19d86a[_0x2750('0x7')](_0x2750('0x54'),require('./api/chatProactiveAction'));_0x19d86a[_0x2750('0x7')](_0x2750('0x55'),require(_0x2750('0x56')));_0x19d86a[_0x2750('0x7')](_0x2750('0x57'),require(_0x2750('0x58')));_0x19d86a[_0x2750('0x7')](_0x2750('0x59'),require(_0x2750('0x5a')));_0x19d86a['use'](_0x2750('0x5b'),require(_0x2750('0x5c')));_0x19d86a[_0x2750('0x7')]('/api/cm/hopper_final',require('./api/cmHopperFinal'));_0x19d86a[_0x2750('0x7')](_0x2750('0x5d'),require(_0x2750('0x5e')));_0x19d86a[_0x2750('0x7')](_0x2750('0x5f'),require(_0x2750('0x60')));_0x19d86a[_0x2750('0x7')]('/api/actions',require('./api/action'));_0x19d86a[_0x2750('0x7')](_0x2750('0x61'),require('./api/automation'));_0x19d86a[_0x2750('0x7')](_0x2750('0x62'),require('./api/cannedAnswer'));_0x19d86a[_0x2750('0x7')](_0x2750('0x63'),require(_0x2750('0x64')));_0x19d86a[_0x2750('0x7')](_0x2750('0x65'),require(_0x2750('0x66')));_0x19d86a['use']('/api/intervals',require(_0x2750('0x67')));_0x19d86a[_0x2750('0x7')](_0x2750('0x68'),require(_0x2750('0x69')));_0x19d86a[_0x2750('0x7')](_0x2750('0x6a'),require(_0x2750('0x6b')));_0x19d86a[_0x2750('0x7')]('/api/voiceQueuesLog',require(_0x2750('0x6c')));_0x19d86a[_0x2750('0x7')](_0x2750('0x6d'),require(_0x2750('0x6e')));_0x19d86a[_0x2750('0x7')]('/api/sounds',require(_0x2750('0x6f')));_0x19d86a[_0x2750('0x7')](_0x2750('0x70'),require(_0x2750('0x71')));_0x19d86a['use'](_0x2750('0x72'),require('./api/contactItemType'));_0x19d86a[_0x2750('0x7')](_0x2750('0x73'),require(_0x2750('0x74')));_0x19d86a['use'](_0x2750('0x75'),require('./api/cmHopperAdditionalPhone'));_0x19d86a[_0x2750('0x7')]('/api/templates',require(_0x2750('0x76')));_0x19d86a[_0x2750('0x7')](_0x2750('0x77'),require(_0x2750('0x78')));_0x19d86a['use']('/api/variables',require(_0x2750('0x79')));_0x19d86a['use'](_0x2750('0x7a'),require(_0x2750('0x7b')));_0x19d86a[_0x2750('0x7')](_0x2750('0x7c'),require(_0x2750('0x7d')));_0x19d86a['use'](_0x2750('0x7e'),require(_0x2750('0x7f')));_0x19d86a['use'](_0x2750('0x80'),require('./api/analyticDefaultReport'));_0x19d86a['use'](_0x2750('0x81'),require(_0x2750('0x82')));_0x19d86a[_0x2750('0x7')](_0x2750('0x83'),require(_0x2750('0x84')));_0x19d86a[_0x2750('0x7')](_0x2750('0x85'),require('./api/analyticFieldReport'));_0x19d86a[_0x2750('0x7')](_0x2750('0x86'),require(_0x2750('0x87')));_0x19d86a[_0x2750('0x7')]('/api/integrations/salesforce/accounts',require(_0x2750('0x88')));_0x19d86a[_0x2750('0x7')](_0x2750('0x89'),require(_0x2750('0x8a')));_0x19d86a[_0x2750('0x7')](_0x2750('0x8b'),require(_0x2750('0x8c')));_0x19d86a[_0x2750('0x7')]('/api/integrations/sugarcrm/accounts',require(_0x2750('0x8d')));_0x19d86a['use'](_0x2750('0x8e'),require('./api/intSugarcrmConfiguration'));_0x19d86a[_0x2750('0x7')](_0x2750('0x8f'),require(_0x2750('0x90')));_0x19d86a[_0x2750('0x7')](_0x2750('0x91'),require(_0x2750('0x92')));_0x19d86a['use'](_0x2750('0x93'),require('./api/intDeskConfiguration'));_0x19d86a[_0x2750('0x7')]('/api/integrations/desk/fields',require('./api/intDeskField'));_0x19d86a[_0x2750('0x7')](_0x2750('0x94'),require('./api/intZohoAccount'));_0x19d86a[_0x2750('0x7')](_0x2750('0x95'),require(_0x2750('0x96')));_0x19d86a[_0x2750('0x7')]('/api/integrations/zoho/fields',require(_0x2750('0x97')));_0x19d86a[_0x2750('0x7')](_0x2750('0x98'),require('./api/intZendeskAccount'));_0x19d86a[_0x2750('0x7')](_0x2750('0x99'),require('./api/intZendeskConfiguration'));_0x19d86a[_0x2750('0x7')](_0x2750('0x9a'),require('./api/intZendeskField'));_0x19d86a[_0x2750('0x7')](_0x2750('0x9b'),require(_0x2750('0x9c')));_0x19d86a['use'](_0x2750('0x9d'),require('./api/intFreshdeskConfiguration'));_0x19d86a['use'](_0x2750('0x9e'),require(_0x2750('0x9f')));_0x19d86a[_0x2750('0x7')]('/api/integrations/vtiger/accounts',require('./api/intVtigerAccount'));_0x19d86a[_0x2750('0x7')](_0x2750('0xa0'),require(_0x2750('0xa1')));_0x19d86a[_0x2750('0x7')](_0x2750('0xa2'),require(_0x2750('0xa3')));_0x19d86a['use']('/api/integrations/servicenow/accounts',require(_0x2750('0xa4')));_0x19d86a[_0x2750('0x7')]('/api/integrations/servicenow/configurations',require('./api/intServicenowConfiguration'));_0x19d86a[_0x2750('0x7')](_0x2750('0xa5'),require(_0x2750('0xa6')));_0x19d86a[_0x2750('0x7')]('/api/integrations/dynamics365/accounts',require(_0x2750('0xa7')));_0x19d86a[_0x2750('0x7')]('/api/integrations/dynamics365/configurations',require(_0x2750('0xa8')));_0x19d86a[_0x2750('0x7')]('/api/integrations/dynamics365/fields',require(_0x2750('0xa9')));_0x19d86a[_0x2750('0x7')](_0x2750('0xaa'),require(_0x2750('0xab')));_0x19d86a['use']('/api/integrations/freshsales/configurations',require(_0x2750('0xac')));_0x19d86a[_0x2750('0x7')](_0x2750('0xad'),require(_0x2750('0xae')));_0x19d86a[_0x2750('0x7')](_0x2750('0xaf'),require(_0x2750('0xb0')));_0x19d86a[_0x2750('0x7')](_0x2750('0xb1'),require(_0x2750('0xb2')));_0x19d86a[_0x2750('0x7')](_0x2750('0xb3'),require('./api/chatInternalMessage'));_0x19d86a[_0x2750('0x7')](_0x2750('0xb4'),require(_0x2750('0xb5')));_0x19d86a[_0x2750('0x7')](_0x2750('0xb6'),require(_0x2750('0xb7')));_0x19d86a[_0x2750('0x7')](_0x2750('0xb8'),require(_0x2750('0xb9')));_0x19d86a[_0x2750('0x7')]('/api/sms/reports/queue',require('./api/smsQueueReport'));_0x19d86a['use'](_0x2750('0xba'),require('./api/squareReport'));_0x19d86a[_0x2750('0x7')](_0x2750('0xbb'),require(_0x2750('0xbc')));_0x19d86a['use'](_0x2750('0xbd'),require(_0x2750('0xbe')));_0x19d86a[_0x2750('0x7')](_0x2750('0xbf'),require(_0x2750('0xc0')));_0x19d86a['use'](_0x2750('0xc1'),require(_0x2750('0xc2')));_0x19d86a[_0x2750('0x7')](_0x2750('0xc3'),require('./api/squareProject'));_0x19d86a[_0x2750('0x7')](_0x2750('0xc4'),require(_0x2750('0xc5')));_0x19d86a[_0x2750('0x7')](_0x2750('0xc6'),require(_0x2750('0xc7')));_0x19d86a[_0x2750('0x7')](_0x2750('0xc8'),require(_0x2750('0xc9')));_0x19d86a['use']('/api/license',require(_0x2750('0xca')));_0x19d86a[_0x2750('0x7')]('/api/campaigns',require('./api/campaign'));_0x19d86a['use']('/api/migrations',require('./api/migration'));_0x19d86a[_0x2750('0x7')]('/api/attachments',require('./api/attachment'));_0x19d86a['use']('/api/plugins',require(_0x2750('0xcb')));_0x19d86a[_0x2750('0x7')](_0x2750('0xcc'),require(_0x2750('0xcd')));_0x19d86a[_0x2750('0x7')](_0x2750('0xce'),require('./api/chatTransferReport'));_0x19d86a['use'](_0x2750('0xcf'),require(_0x2750('0xd0')));_0x19d86a[_0x2750('0x7')](_0x2750('0xd1'),require(_0x2750('0xd2')));_0x19d86a['use']('/api/sms/reports/transfer',require(_0x2750('0xd3')));_0x19d86a[_0x2750('0x7')](_0x2750('0xd4'),require(_0x2750('0xd5')));_0x19d86a[_0x2750('0x7')](_0x2750('0xd6'),require(_0x2750('0xd7')));_0x19d86a[_0x2750('0x7')](_0x2750('0xd8'),require('./api/userProfile'));_0x19d86a['use'](_0x2750('0xd9'),require('./api/userProfileSection'));_0x19d86a[_0x2750('0x7')](_0x2750('0xda'),require(_0x2750('0xdb')));_0x19d86a[_0x2750('0x7')](_0x2750('0xdc'),require(_0x2750('0xdd')));_0x19d86a[_0x2750('0x7')](_0x2750('0xde'),require(_0x2750('0xdf')));_0x19d86a[_0x2750('0x7')](_0x2750('0xe0'),require(_0x2750('0xe1')));_0x19d86a[_0x2750('0x7')](_0x2750('0xe2'),require(_0x2750('0xe3')));_0x19d86a[_0x2750('0x7')]('/api/whatsapp/messages',require('./api/whatsappMessage'));_0x19d86a['use'](_0x2750('0xe4'),require('./api/whatsappQueueReport'));_0x19d86a[_0x2750('0x7')](_0x2750('0xe5'),require(_0x2750('0xe6')));_0x19d86a[_0x2750('0x7')](_0x2750('0xe7'),require(_0x2750('0xe8')));_0x19d86a['use']('/api/cloudProviders',require('./api/cloudProvider'));_0x19d86a[_0x2750('0x7')](_0x2750('0xe9'),require(_0x2750('0xea')));_0x19d86a[_0x2750('0x7')]('/api/user-settings',require(_0x2750('0xeb')));_0x19d86a[_0x2750('0x7')](_0x2750('0xec'),require(_0x2750('0xed')));_0x19d86a[_0x2750('0x7')](_0x2750('0xee'),require(_0x2750('0xef')));_0x19d86a['use'](_0x2750('0xf0'),require(_0x2750('0xf1')));_0x19d86a[_0x2750('0x7')](_0x2750('0xf2'),require(_0x2750('0xf3')));_0x19d86a['use'](_0x2750('0xf4'),require('./api/rpc'));_0x19d86a[_0x2750('0x7')](_0x2750('0xf5'),require(_0x2750('0xf6')));_0x19d86a[_0x2750('0x7')](_0x2750('0xf7'),require(_0x2750('0xf8')));_0x19d86a['use'](_0x2750('0xf9'),require(_0x2750('0xfa')));_0x19d86a[_0x2750('0x7')](_0x2750('0xfb'),require('./api/webbar'));_0x19d86a[_0x2750('0x7')]('/api/logs',clientSideLogs);_0x19d86a[_0x2750('0x7')](_0x2750('0xfc'),express['static'](path[_0x2750('0xfd')](config[_0x2750('0xfe')],_0x2750('0xfc'))));_0x19d86a[_0x2750('0x7')](_0x2750('0xff'),express['static'](path[_0x2750('0xfd')](config[_0x2750('0xfe')],_0x2750('0xff'))));_0x19d86a['use'](_0x2750('0x100'),express[_0x2750('0x101')](path[_0x2750('0xfd')](config['root'],_0x2750('0x100'))));_0x19d86a['use'](_0x2750('0x102'),express[_0x2750('0x101')](path[_0x2750('0xfd')](config['root'],_0x2750('0x103'),'3.1.0')));_0x19d86a[_0x2750('0x7')]('/plugins',express[_0x2750('0x101')](path[_0x2750('0xfd')](config['root'],'/server/files/plugins')));_0x19d86a[_0x2750('0x104')](_0x2750('0x105'))[_0x2750('0x106')](errors[0x194]);_0x19d86a['route']('/*')[_0x2750('0x106')](function(_0x140334,_0x53dfed){_0x53dfed[_0x2750('0x107')](path[_0x2750('0x108')](_0x19d86a[_0x2750('0x106')](_0x2750('0x109'))+_0x2750('0x10a')));});return _0x19d86a;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index fb542cf..f4da2a5 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55de=['../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','server','http','rpc','port','error','log','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc'];(function(_0x36cca6,_0x5c68ad){var _0x343805=function(_0x8f9715){while(--_0x8f9715){_0x36cca6['push'](_0x36cca6['shift']());}};_0x343805(++_0x5c68ad);}(_0x55de,0x1ef));var _0xe55d=function(_0x405d5b,_0x367d49){_0x405d5b=_0x405d5b-0x0;var _0x26b41c=_0x55de[_0x405d5b];return _0x26b41c;};'use strict';var jayson=require(_0xe55d('0x0'));var _=require(_0xe55d('0x1'));var config=require(_0xe55d('0x2'));exports[_0xe55d('0x3')]=function(){return new Promise(function(_0x3e973a,_0x1e28ba){var _0x2c7c31={};_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require(_0xe55d('0x5')));_0x2c7c31=_['merge'](_0x2c7c31,require('../api/voiceExtension/voiceExtension.rpc'));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require(_0xe55d('0x6')));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require(_0xe55d('0x7')));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require(_0xe55d('0x8')));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require(_0xe55d('0x9')));_0x2c7c31=_['merge'](_0x2c7c31,require(_0xe55d('0xa')));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require('../api/memberReport/memberReport.rpc'));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require('../api/trunk/trunk.rpc'));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require(_0xe55d('0xb')));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require('../api/mailServerIn/mailServerIn.rpc'));_0x2c7c31=_['merge'](_0x2c7c31,require(_0xe55d('0xc')));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require(_0xe55d('0xd')));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require(_0xe55d('0xe')));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require('../api/mailMessage/mailMessage.rpc'));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require(_0xe55d('0xf')));_0x2c7c31=_['merge'](_0x2c7c31,require(_0xe55d('0x10')));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require(_0xe55d('0x11')));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require(_0xe55d('0x12')));_0x2c7c31=_['merge'](_0x2c7c31,require(_0xe55d('0x13')));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require('../api/faxMessage/faxMessage.rpc'));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require('../api/faxQueue/faxQueue.rpc'));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require(_0xe55d('0x14')));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require(_0xe55d('0x15')));_0x2c7c31=_['merge'](_0x2c7c31,require(_0xe55d('0x16')));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require(_0xe55d('0x17')));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require('../api/smsQueue/smsQueue.rpc'));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require(_0xe55d('0x18')));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require(_0xe55d('0x19')));_0x2c7c31=_['merge'](_0x2c7c31,require(_0xe55d('0x1a')));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require(_0xe55d('0x1b')));_0x2c7c31=_['merge'](_0x2c7c31,require(_0xe55d('0x1c')));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require(_0xe55d('0x1d')));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require(_0xe55d('0x1e')));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require(_0xe55d('0x1f')));_0x2c7c31=_['merge'](_0x2c7c31,require(_0xe55d('0x20')));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require(_0xe55d('0x21')));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require(_0xe55d('0x22')));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require(_0xe55d('0x23')));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require(_0xe55d('0x24')));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require(_0xe55d('0x25')));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require(_0xe55d('0x26')));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require('../api/trigger/trigger.rpc'));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require(_0xe55d('0x27')));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require(_0xe55d('0x28')));_0x2c7c31=_['merge'](_0x2c7c31,require(_0xe55d('0x29')));_0x2c7c31=_['merge'](_0x2c7c31,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x2c7c31=_['merge'](_0x2c7c31,require(_0xe55d('0x2a')));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require(_0xe55d('0x2b')));_0x2c7c31=_['merge'](_0x2c7c31,require(_0xe55d('0x2c')));_0x2c7c31=_['merge'](_0x2c7c31,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require(_0xe55d('0x2d')));_0x2c7c31=_['merge'](_0x2c7c31,require(_0xe55d('0x2e')));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require(_0xe55d('0x2f')));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require(_0xe55d('0x30')));_0x2c7c31=_['merge'](_0x2c7c31,require(_0xe55d('0x31')));_0x2c7c31=_['merge'](_0x2c7c31,require(_0xe55d('0x32')));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require(_0xe55d('0x33')));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require(_0xe55d('0x34')));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require(_0xe55d('0x35')));_0x2c7c31=_['merge'](_0x2c7c31,require(_0xe55d('0x36')));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require('../api/attachment/attachment.rpc'));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require(_0xe55d('0x37')));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require(_0xe55d('0x38')));_0x2c7c31=_['merge'](_0x2c7c31,require(_0xe55d('0x39')));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require(_0xe55d('0x3a')));_0x2c7c31=_[_0xe55d('0x4')](_0x2c7c31,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x2c7c31=_['merge'](_0x2c7c31,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x16b81e=jayson[_0xe55d('0x3b')](_0x2c7c31)[_0xe55d('0x3c')]();var _0x3b9399=config[_0xe55d('0x3d')]['port']||config[_0xe55d('0x3e')]+0x1;var _0xbfc7d5=config[_0xe55d('0x3d')]['ip']||'localhost';_0x16b81e['on'](_0xe55d('0x3f'),function(_0x5473a8){return _0x1e28ba(_0x5473a8);});_0x16b81e[_0xe55d('0x3')](_0x3b9399,_0xbfc7d5,function(){console[_0xe55d('0x40')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0xbfc7d5,_0x3b9399);require(_0xe55d('0x41'))[_0xe55d('0x42')]();return _0x3e973a(_0xe55d('0x43')+_0xbfc7d5+':'+_0x3b9399);});});}; \ No newline at end of file +var _0xc6aa=['../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/campaign/campaign.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','rpc','port','localhost','error','log','../config/triggers','default','RPC\x20listening\x20on\x20','../config/environment','listen','merge','../api/voiceQueue/voiceQueue.rpc'];(function(_0x3fe5cf,_0x2e8875){var _0x34f616=function(_0x3eee29){while(--_0x3eee29){_0x3fe5cf['push'](_0x3fe5cf['shift']());}};_0x34f616(++_0x2e8875);}(_0xc6aa,0x1f4));var _0xac6a=function(_0x2270b4,_0x1b5264){_0x2270b4=_0x2270b4-0x0;var _0x30153b=_0xc6aa[_0x2270b4];return _0x30153b;};'use strict';var jayson=require('jayson/promise');var _=require('lodash');var config=require(_0xac6a('0x0'));exports[_0xac6a('0x1')]=function(){return new Promise(function(_0x10d284,_0x3c369c){var _0x3316e8={};_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require('../api/user/user.rpc'));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require('../api/voiceExtension/voiceExtension.rpc'));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require(_0xac6a('0x3')));_0x3316e8=_['merge'](_0x3316e8,require('../api/voiceRecording/voiceRecording.rpc'));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require(_0xac6a('0x4')));_0x3316e8=_['merge'](_0x3316e8,require(_0xac6a('0x5')));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require(_0xac6a('0x6')));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require(_0xac6a('0x7')));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require('../api/memberReport/memberReport.rpc'));_0x3316e8=_['merge'](_0x3316e8,require('../api/trunk/trunk.rpc'));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require(_0xac6a('0x8')));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x3316e8=_['merge'](_0x3316e8,require(_0xac6a('0x9')));_0x3316e8=_['merge'](_0x3316e8,require(_0xac6a('0xa')));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require(_0xac6a('0xb')));_0x3316e8=_['merge'](_0x3316e8,require(_0xac6a('0xc')));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require(_0xac6a('0xd')));_0x3316e8=_['merge'](_0x3316e8,require(_0xac6a('0xe')));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require(_0xac6a('0xf')));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require('../api/faxAccount/faxAccount.rpc'));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require(_0xac6a('0x10')));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require('../api/faxInteraction/faxInteraction.rpc'));_0x3316e8=_['merge'](_0x3316e8,require(_0xac6a('0x11')));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require(_0xac6a('0x12')));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require(_0xac6a('0x13')));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require(_0xac6a('0x14')));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require(_0xac6a('0x15')));_0x3316e8=_['merge'](_0x3316e8,require(_0xac6a('0x16')));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require('../api/smsQueue/smsQueue.rpc'));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require(_0xac6a('0x17')));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require(_0xac6a('0x18')));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require(_0xac6a('0x19')));_0x3316e8=_['merge'](_0x3316e8,require(_0xac6a('0x1a')));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require(_0xac6a('0x1b')));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require(_0xac6a('0x1c')));_0x3316e8=_['merge'](_0x3316e8,require(_0xac6a('0x1d')));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require(_0xac6a('0x1e')));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require('../api/cmHopper/cmHopper.rpc'));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x3316e8=_['merge'](_0x3316e8,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require(_0xac6a('0x1f')));_0x3316e8=_['merge'](_0x3316e8,require(_0xac6a('0x20')));_0x3316e8=_['merge'](_0x3316e8,require(_0xac6a('0x21')));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require(_0xac6a('0x22')));_0x3316e8=_['merge'](_0x3316e8,require(_0xac6a('0x23')));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require(_0xac6a('0x24')));_0x3316e8=_['merge'](_0x3316e8,require('../api/variable/variable.rpc'));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require(_0xac6a('0x25')));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require(_0xac6a('0x26')));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require(_0xac6a('0x27')));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require(_0xac6a('0x28')));_0x3316e8=_['merge'](_0x3316e8,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x3316e8=_['merge'](_0x3316e8,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x3316e8=_['merge'](_0x3316e8,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x3316e8=_['merge'](_0x3316e8,require(_0xac6a('0x29')));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require(_0xac6a('0x2a')));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require(_0xac6a('0x2b')));_0x3316e8=_['merge'](_0x3316e8,require(_0xac6a('0x2c')));_0x3316e8=_['merge'](_0x3316e8,require(_0xac6a('0x2d')));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require(_0xac6a('0x2e')));_0x3316e8=_['merge'](_0x3316e8,require('../api/squareOdbc/squareOdbc.rpc'));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require(_0xac6a('0x2f')));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require('../api/squareRecording/squareRecording.rpc'));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require('../api/squareMessage/squareMessage.rpc'));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require(_0xac6a('0x30')));_0x3316e8=_['merge'](_0x3316e8,require(_0xac6a('0x31')));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require(_0xac6a('0x32')));_0x3316e8=_['merge'](_0x3316e8,require(_0xac6a('0x33')));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require(_0xac6a('0x34')));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x3316e8=_[_0xac6a('0x2')](_0x3316e8,require(_0xac6a('0x35')));_0x3316e8=_['merge'](_0x3316e8,require(_0xac6a('0x36')));var _0x2b1fa5=jayson['server'](_0x3316e8)['http']();var _0x21c3cd=config[_0xac6a('0x37')][_0xac6a('0x38')]||config['port']+0x1;var _0x433e97=config[_0xac6a('0x37')]['ip']||_0xac6a('0x39');_0x2b1fa5['on'](_0xac6a('0x3a'),function(_0xc4812b){return _0x3c369c(_0xc4812b);});_0x2b1fa5['listen'](_0x21c3cd,_0x433e97,function(){console[_0xac6a('0x3b')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x433e97,_0x21c3cd);require(_0xac6a('0x3c'))[_0xac6a('0x3d')]();return _0x10d284(_0xac6a('0x3e')+_0x433e97+':'+_0x21c3cd);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index cf795ba..2b2ad62 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 _0x3766=['inherits','prototype','sync','answer','sendRequest','ANSWER','getData','beep','noop','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22','isArray','EXEC\x20%s\x20%s','join','setContext','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayDigits','SAY\x20DIGITS\x20%s\x20%s','continueAt','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','exec','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','lodash','events','EventEmitter','./reply','call','setEncoding','utf8','setTimeout','headers','emit','ready','toLowerCase','hangup','520-Invalid','520\x20End\x20of\x20proper','function','substring','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_TIMEOUT','pipe','command','destroy'];(function(_0x3fbdcd,_0x4bca35){var _0x31f37e=function(_0xec39ce){while(--_0xec39ce){_0x3fbdcd['push'](_0x3fbdcd['shift']());}};_0x31f37e(++_0x4bca35);}(_0x3766,0xc0));var _0x6376=function(_0x45071a,_0x406695){_0x45071a=_0x45071a-0x0;var _0x4502ca=_0x3766[_0x45071a];return _0x4502ca;};'use strict';var util=require('util');var _=require(_0x6376('0x0'));var EventEmitter=require(_0x6376('0x1'))[_0x6376('0x2')];var AGIReply=require(_0x6376('0x3'));var AGIError=require('./error');function AGIChannel(_0x28ecbd){var _0x1057b6=this,_0x37a0a9=new AGIReply(),_0x3f0e5b=![],_0x241ba3={};EventEmitter[_0x6376('0x4')](_0x1057b6);_0x28ecbd[_0x6376('0x5')](_0x6376('0x6'));_0x28ecbd[_0x6376('0x7')](0x8*0x3c*0x3c*0x3e8);_0x37a0a9['setEncoding'](_0x6376('0x6'));_0x37a0a9['on'](_0x6376('0x8'),function(_0x59d699){for(var _0x11de79 in _0x59d699){_0x1057b6[_0x11de79]=_0x59d699[_0x11de79];}_0x1057b6[_0x6376('0x9')](_0x6376('0xa'));});_0x37a0a9['on']('line',function(_0x1259fa){if(_0x1259fa[_0x6376('0xb')]()==_0x6376('0xc')){_0x1057b6[_0x6376('0x9')]('hangup');return;}if(_0x1259fa['substring'](0x0,0xb)==_0x6376('0xd')){_0x3f0e5b=!![];}if(_0x3f0e5b){_0x241ba3['rx']+=_0x1259fa+'\x0a';if(_0x1259fa['search'](_0x6376('0xe'))!=-0x1){_0x3f0e5b=![];}}else{_0x241ba3['rx']=_0x1259fa;}if(_0x3f0e5b){return;}if(typeof _0x241ba3['cb']==_0x6376('0xf')){var _0x1d6f6c=_0x241ba3['rx'][_0x6376('0x10')](0x0,0x3),_0x3fc857=null,_0x12a36b=null;_0x1d6f6c=parseInt(_0x1d6f6c);if(isNaN(_0x1d6f6c)){_0x241ba3['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x6376('0x11')});return;}if(_0x1d6f6c!=0xc8){_0x241ba3['cb'](null,{'code':_0x1d6f6c,'result':-0x1,'extra':'KO'});return;}_0x3fc857=_0x241ba3['rx'][_0x6376('0x10')](0x4)[_0x6376('0x12')](_0x6376('0x13'),'');if(_0x3fc857[_0x6376('0x14')]('\x20')!=-0x1){_0x3fc857=_0x3fc857[_0x6376('0x15')](0x0,_0x3fc857[_0x6376('0x14')]('\x20'));}if(_[_0x6376('0x16')](_0x3fc857,'-1')){_0x3fc857=parseInt(_0x3fc857);}_0x12a36b=_0x241ba3['rx'][_0x6376('0x17')]('\x20');if(_0x12a36b[_0x6376('0x18')]==0x3){_0x12a36b=_0x12a36b[0x2][_0x6376('0x10')](0x1,_0x12a36b[0x2][_0x6376('0x18')]-0x1);}else if(_0x12a36b['length']>0x3){var _0x1bdfee=/\((.+)\)/;var _0x5e10f9=_0x241ba3['rx'][_0x6376('0x19')](_0x1bdfee);if(_0x5e10f9){_0x12a36b=_0x5e10f9[0x1];}else{_0x12a36b=null;}}else{_0x12a36b=null;}_0x241ba3['cb'](null,{'code':_0x1d6f6c,'result':_0x3fc857,'extra':_0x12a36b});}});_0x28ecbd['on']('error',function(_0x307847){_0x1057b6[_0x6376('0x9')](_0x6376('0x1a'),new AGIError(_0x6376('0x1b'),_0x307847['code']));});_0x28ecbd['on']('close',function(){_0x1057b6[_0x6376('0x9')](_0x6376('0x1c'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x28ecbd['on']('timeout',function(){_0x1057b6[_0x6376('0x9')]('timeout',new AGIError(_0x6376('0x1d')));_0x28ecbd['destroy']();});_0x28ecbd[_0x6376('0x1e')](_0x37a0a9);this[_0x6376('0x1f')]=function(_0x4ba8d4,_0x80306f){var _0x4ba8d4=_0x4ba8d4||'',_0x80306f=typeof _0x80306f==_0x6376('0xf')?_0x80306f:new Function();_0x241ba3={'tx':_0x4ba8d4,'rx':'','cb':_0x80306f};_0x28ecbd['write'](_0x4ba8d4+'\x0a');},this['close']=function(){_0x28ecbd[_0x6376('0x20')]();};}util[_0x6376('0x21')](AGIChannel,EventEmitter);AGIChannel[_0x6376('0x22')]['sendRequest']=function(_0x25569e){return this[_0x6376('0x1f')][_0x6376('0x23')](this,_0x25569e);};AGIChannel['prototype'][_0x6376('0x24')]=function(){return this[_0x6376('0x25')](_0x6376('0x26'));};AGIChannel[_0x6376('0x22')][_0x6376('0x27')]=function(_0x1397e8,_0x191d07,_0x5081de){_0x1397e8=_0x1397e8===undefined?_0x6376('0x28'):_0x1397e8;_0x191d07=_0x191d07===undefined?'5':_0x191d07;_0x5081de=_0x5081de===undefined?'1':_0x5081de;return this[_0x6376('0x25')](util['format']('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x1397e8,_0x191d07*0x3e8,_0x5081de));};AGIChannel['prototype'][_0x6376('0x29')]=function(_0x3a3025){_0x3a3025=_0x3a3025||_0x6376('0x2a');return this[_0x6376('0x25')](util[_0x6376('0x2b')](_0x6376('0x2c'),_0x3a3025));};AGIChannel[_0x6376('0x22')]['exec']=function(_0x4b7286,_0x12c066){if(_[_0x6376('0x2d')](_0x12c066)){return this[_0x6376('0x25')](util[_0x6376('0x2b')](_0x6376('0x2e'),_0x4b7286,_0x12c066[_0x6376('0x2f')](',')));}return this[_0x6376('0x25')](util[_0x6376('0x2b')](_0x6376('0x2e'),_0x4b7286,_0x12c066));};AGIChannel[_0x6376('0x22')][_0x6376('0x30')]=function(_0x4e5a1e){return this[_0x6376('0x25')](util[_0x6376('0x2b')]('SET\x20CONTEXT\x20%s',_0x4e5a1e));};AGIChannel['prototype'][_0x6376('0x31')]=function(_0x2abff7){return this[_0x6376('0x25')](util[_0x6376('0x2b')](_0x6376('0x32'),_0x2abff7));};AGIChannel[_0x6376('0x22')][_0x6376('0x33')]=function(_0x3c58d9){return this[_0x6376('0x25')](util[_0x6376('0x2b')](_0x6376('0x34'),_0x3c58d9));};AGIChannel[_0x6376('0x22')][_0x6376('0xc')]=function(){return this['sendRequest'](_0x6376('0x35'));};AGIChannel[_0x6376('0x22')][_0x6376('0x36')]=function(_0x106ca8,_0x3a904e){var _0x4e68f7=_[_0x6376('0x37')](_0x3a904e)||_[_0x6376('0x38')](_0x3a904e)?_0x3a904e[_0x6376('0x39')]():_0x3a904e;return this[_0x6376('0x25')](util[_0x6376('0x2b')](_0x6376('0x3a'),_0x106ca8,_0x4e68f7?_0x4e68f7[_0x6376('0x39')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x6376('0x22')]['sayNumber']=function(_0x2e30d4,_0x3d366d){return this[_0x6376('0x25')](util[_0x6376('0x2b')]('SAY\x20NUMBER\x20%s\x20%s',_0x2e30d4,_0x3d366d));};AGIChannel['prototype'][_0x6376('0x3b')]=function(_0xf01fa,_0x437b14){return this[_0x6376('0x25')](util['format'](_0x6376('0x3c'),_0xf01fa,_0x437b14));};AGIChannel[_0x6376('0x22')]['sayPhonetic']=function(_0x77e5f8,_0x188519){return this[_0x6376('0x25')](util[_0x6376('0x2b')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x77e5f8,_0x188519));};AGIChannel[_0x6376('0x22')][_0x6376('0x3d')]=function(_0x5d46bf,_0x425b79,_0x303d84){_0x425b79=_0x425b79||this['extension'];_0x303d84=_0x303d84||0x1;this[_0x6376('0x30')](_0x5d46bf);this['setExtension'](_0x425b79);this[_0x6376('0x33')](_0x303d84);return this[_0x6376('0x29')](util[_0x6376('0x2b')]('GOTO\x20%s\x20%s\x20%s',_0x5d46bf,_0x425b79,_0x303d84));};AGIChannel['prototype'][_0x6376('0x3e')]=function(_0x4ce6ac){return this[_0x6376('0x25')](util[_0x6376('0x2b')](_0x6376('0x3f'),_0x4ce6ac));};AGIChannel[_0x6376('0x22')]['recordFile']=function(_0x1df685,_0x27aebc,_0x54ed9a,_0x12460c,_0x53decf,_0x29b005){_0x27aebc=_0x27aebc||_0x6376('0x40');_0x54ed9a=_0x54ed9a||'';_0x12460c=_0x12460c===undefined?-0x1:_0x12460c==='-1'?-0x1:_0x12460c*0x3e8;_0x53decf=_0x53decf===undefined?'':'s='+_0x53decf;_0x29b005=_0x29b005?_0x6376('0x41'):'';return this[_0x6376('0x25')](util[_0x6376('0x2b')](_0x6376('0x42'),_0x1df685,_0x27aebc,_0x54ed9a,_0x12460c,_0x29b005,_0x53decf));};AGIChannel[_0x6376('0x22')][_0x6376('0x43')]=function(_0xae51c,_0x330721){_0x330721=_0x330721||'';return this[_0x6376('0x25')](util[_0x6376('0x2b')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0xae51c,_0x330721));};AGIChannel[_0x6376('0x22')][_0x6376('0x44')]=function(_0x216660){return this[_0x6376('0x45')](_0x6376('0x46'),_0x216660);};AGIChannel[_0x6376('0x22')][_0x6376('0x47')]=function(_0x4d4281){return this['exec'](_0x6376('0x48'),_0x4d4281);};AGIChannel[_0x6376('0x22')][_0x6376('0x1a')]=function(_0x1d5fb6,_0x5aedfd){this[_0x6376('0x29')](util[_0x6376('0x2b')](_0x6376('0x49'),_0x1d5fb6['id'],_0x1d5fb6['label'],_0x5aedfd));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x6376('0x4a')]=AGIChannel; \ No newline at end of file +var _0x7e47=['utf8','headers','emit','ready','toLowerCase','hangup','substring','search','520\x20End\x20of\x20proper','function','no\x20code','result=','indexOf','substr','startsWith','length','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','prototype','sendRequest','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','setPriority','SET\x20PRIORITY\x20%s','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','replace','sayNumber','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setContext','setExtension','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','error','label','lodash','events','EventEmitter','./reply','./error','call','setEncoding'];(function(_0x549c88,_0x42229a){var _0x151ae6=function(_0x1b774a){while(--_0x1b774a){_0x549c88['push'](_0x549c88['shift']());}};_0x151ae6(++_0x42229a);}(_0x7e47,0x19d));var _0x77e4=function(_0x35d945,_0x21ab2d){_0x35d945=_0x35d945-0x0;var _0x58b662=_0x7e47[_0x35d945];return _0x58b662;};'use strict';var util=require('util');var _=require(_0x77e4('0x0'));var EventEmitter=require(_0x77e4('0x1'))[_0x77e4('0x2')];var AGIReply=require(_0x77e4('0x3'));var AGIError=require(_0x77e4('0x4'));function AGIChannel(_0x5efc5b){var _0x51e561=this,_0x4aa69c=new AGIReply(),_0x3d61bd=![],_0x5a83a5={};EventEmitter[_0x77e4('0x5')](_0x51e561);_0x5efc5b[_0x77e4('0x6')]('utf8');_0x5efc5b['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x4aa69c[_0x77e4('0x6')](_0x77e4('0x7'));_0x4aa69c['on'](_0x77e4('0x8'),function(_0x12e13e){for(var _0x536fe5 in _0x12e13e){_0x51e561[_0x536fe5]=_0x12e13e[_0x536fe5];}_0x51e561[_0x77e4('0x9')](_0x77e4('0xa'));});_0x4aa69c['on']('line',function(_0x11366b){if(_0x11366b[_0x77e4('0xb')]()==_0x77e4('0xc')){_0x51e561['emit']('hangup');return;}if(_0x11366b[_0x77e4('0xd')](0x0,0xb)=='520-Invalid'){_0x3d61bd=!![];}if(_0x3d61bd){_0x5a83a5['rx']+=_0x11366b+'\x0a';if(_0x11366b[_0x77e4('0xe')](_0x77e4('0xf'))!=-0x1){_0x3d61bd=![];}}else{_0x5a83a5['rx']=_0x11366b;}if(_0x3d61bd){return;}if(typeof _0x5a83a5['cb']==_0x77e4('0x10')){var _0x8184a=_0x5a83a5['rx']['substring'](0x0,0x3),_0x207d08=null,_0x7afcc5=null;_0x8184a=parseInt(_0x8184a);if(isNaN(_0x8184a)){_0x5a83a5['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x77e4('0x11')});return;}if(_0x8184a!=0xc8){_0x5a83a5['cb'](null,{'code':_0x8184a,'result':-0x1,'extra':'KO'});return;}_0x207d08=_0x5a83a5['rx'][_0x77e4('0xd')](0x4)['replace'](_0x77e4('0x12'),'');if(_0x207d08[_0x77e4('0x13')]('\x20')!=-0x1){_0x207d08=_0x207d08[_0x77e4('0x14')](0x0,_0x207d08[_0x77e4('0x13')]('\x20'));}if(_[_0x77e4('0x15')](_0x207d08,'-1')){_0x207d08=parseInt(_0x207d08);}_0x7afcc5=_0x5a83a5['rx']['split']('\x20');if(_0x7afcc5[_0x77e4('0x16')]==0x3){_0x7afcc5=_0x7afcc5[0x2]['substring'](0x1,_0x7afcc5[0x2]['length']-0x1);}else if(_0x7afcc5[_0x77e4('0x16')]>0x3){var _0x2ec7de=/\((.+)\)/;var _0x402030=_0x5a83a5['rx']['match'](_0x2ec7de);if(_0x402030){_0x7afcc5=_0x402030[0x1];}else{_0x7afcc5=null;}}else{_0x7afcc5=null;}_0x5a83a5['cb'](null,{'code':_0x8184a,'result':_0x207d08,'extra':_0x7afcc5});}});_0x5efc5b['on']('error',function(_0x4332c0){_0x51e561[_0x77e4('0x9')]('error',new AGIError('E_AGI_SOCKET_ERROR',_0x4332c0[_0x77e4('0x17')]));});_0x5efc5b['on'](_0x77e4('0x18'),function(){_0x51e561[_0x77e4('0x9')]('close',new AGIError(_0x77e4('0x19')));});_0x5efc5b['on'](_0x77e4('0x1a'),function(){_0x51e561[_0x77e4('0x9')](_0x77e4('0x1a'),new AGIError(_0x77e4('0x1b')));_0x5efc5b[_0x77e4('0x1c')]();});_0x5efc5b[_0x77e4('0x1d')](_0x4aa69c);this[_0x77e4('0x1e')]=function(_0x587eb1,_0x5507d8){var _0x587eb1=_0x587eb1||'',_0x5507d8=typeof _0x5507d8==_0x77e4('0x10')?_0x5507d8:new Function();_0x5a83a5={'tx':_0x587eb1,'rx':'','cb':_0x5507d8};_0x5efc5b[_0x77e4('0x1f')](_0x587eb1+'\x0a');},this['close']=function(){_0x5efc5b['destroy']();};}util[_0x77e4('0x20')](AGIChannel,EventEmitter);AGIChannel[_0x77e4('0x21')][_0x77e4('0x22')]=function(_0x360a9a){return this[_0x77e4('0x1e')]['sync'](this,_0x360a9a);};AGIChannel[_0x77e4('0x21')]['answer']=function(){return this[_0x77e4('0x22')](_0x77e4('0x23'));};AGIChannel[_0x77e4('0x21')][_0x77e4('0x24')]=function(_0x1b3cb3,_0x1fa766,_0x36f1de){_0x1b3cb3=_0x1b3cb3===undefined?_0x77e4('0x25'):_0x1b3cb3;_0x1fa766=_0x1fa766===undefined?'5':_0x1fa766;_0x36f1de=_0x36f1de===undefined?'1':_0x36f1de;return this['sendRequest'](util[_0x77e4('0x26')](_0x77e4('0x27'),_0x1b3cb3,_0x1fa766*0x3e8,_0x36f1de));};AGIChannel['prototype'][_0x77e4('0x28')]=function(_0x79ef32){_0x79ef32=_0x79ef32||'NO\x20MESSAGE';return this[_0x77e4('0x22')](util[_0x77e4('0x26')](_0x77e4('0x29'),_0x79ef32));};AGIChannel[_0x77e4('0x21')][_0x77e4('0x2a')]=function(_0x4b8c54,_0x2ca574){if(_[_0x77e4('0x2b')](_0x2ca574)){return this[_0x77e4('0x22')](util[_0x77e4('0x26')](_0x77e4('0x2c'),_0x4b8c54,_0x2ca574[_0x77e4('0x2d')](',')));}return this[_0x77e4('0x22')](util[_0x77e4('0x26')](_0x77e4('0x2c'),_0x4b8c54,_0x2ca574));};AGIChannel[_0x77e4('0x21')]['setContext']=function(_0x18e86c){return this[_0x77e4('0x22')](util[_0x77e4('0x26')]('SET\x20CONTEXT\x20%s',_0x18e86c));};AGIChannel[_0x77e4('0x21')]['setExtension']=function(_0x4d4a6d){return this[_0x77e4('0x22')](util[_0x77e4('0x26')]('SET\x20EXTENSION\x20%s',_0x4d4a6d));};AGIChannel[_0x77e4('0x21')][_0x77e4('0x2e')]=function(_0xc5ce74){return this['sendRequest'](util[_0x77e4('0x26')](_0x77e4('0x2f'),_0xc5ce74));};AGIChannel[_0x77e4('0x21')][_0x77e4('0xc')]=function(){return this[_0x77e4('0x22')]('HANGUP');};AGIChannel[_0x77e4('0x21')]['setVariable']=function(_0x452377,_0x1fe1cc){var _0xb6fe7c=_['isBoolean'](_0x1fe1cc)||_[_0x77e4('0x30')](_0x1fe1cc)?_0x1fe1cc['toString']():_0x1fe1cc;return this[_0x77e4('0x22')](util['format'](_0x77e4('0x31'),_0x452377,_0xb6fe7c?_0xb6fe7c['toString']()[_0x77e4('0x32')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x77e4('0x21')][_0x77e4('0x33')]=function(_0x5b7dad,_0x40a614){return this[_0x77e4('0x22')](util[_0x77e4('0x26')](_0x77e4('0x34'),_0x5b7dad,_0x40a614));};AGIChannel[_0x77e4('0x21')]['sayDigits']=function(_0x46b721,_0x29f61f){return this[_0x77e4('0x22')](util[_0x77e4('0x26')](_0x77e4('0x35'),_0x46b721,_0x29f61f));};AGIChannel[_0x77e4('0x21')][_0x77e4('0x36')]=function(_0x35707b,_0x4426e1){return this[_0x77e4('0x22')](util[_0x77e4('0x26')](_0x77e4('0x37'),_0x35707b,_0x4426e1));};AGIChannel['prototype'][_0x77e4('0x38')]=function(_0xdabe10,_0x3d29b0,_0x41327c){_0x3d29b0=_0x3d29b0||this[_0x77e4('0x39')];_0x41327c=_0x41327c||0x1;this[_0x77e4('0x3a')](_0xdabe10);this[_0x77e4('0x3b')](_0x3d29b0);this[_0x77e4('0x2e')](_0x41327c);return this['noop'](util['format'](_0x77e4('0x3c'),_0xdabe10,_0x3d29b0,_0x41327c));};AGIChannel['prototype']['getVariable']=function(_0x3c8eda){return this[_0x77e4('0x22')](util[_0x77e4('0x26')](_0x77e4('0x3d'),_0x3c8eda));};AGIChannel[_0x77e4('0x21')][_0x77e4('0x3e')]=function(_0x2dcc13,_0x38c85c,_0x25b18f,_0x57be01,_0x3989d1,_0x26f0c4){_0x38c85c=_0x38c85c||_0x77e4('0x3f');_0x25b18f=_0x25b18f||'';_0x57be01=_0x57be01===undefined?-0x1:_0x57be01==='-1'?-0x1:_0x57be01*0x3e8;_0x3989d1=_0x3989d1===undefined?'':'s='+_0x3989d1;_0x26f0c4=_0x26f0c4?_0x77e4('0x40'):'';return this['sendRequest'](util[_0x77e4('0x26')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x2dcc13,_0x38c85c,_0x25b18f,_0x57be01,_0x26f0c4,_0x3989d1));};AGIChannel['prototype'][_0x77e4('0x41')]=function(_0x5912c9,_0x1a1169){_0x1a1169=_0x1a1169||'';return this['sendRequest'](util[_0x77e4('0x26')](_0x77e4('0x42'),_0x5912c9,_0x1a1169));};AGIChannel[_0x77e4('0x21')]['agi']=function(_0x5a7164){return this['exec'](_0x77e4('0x43'),_0x5a7164);};AGIChannel[_0x77e4('0x21')]['wait']=function(_0x5e6fa){return this[_0x77e4('0x2a')]('WAIT',_0x5e6fa);};AGIChannel[_0x77e4('0x21')][_0x77e4('0x44')]=function(_0x1395f8,_0x44ac21){this[_0x77e4('0x28')](util['format']('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x1395f8['id'],_0x1395f8[_0x77e4('0x45')],_0x44ac21));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 4aad918..5617f30 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 _0x3e05=['Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','exports','util'];(function(_0x21c80a,_0x275d41){var _0x4a7719=function(_0xffe07b){while(--_0xffe07b){_0x21c80a['push'](_0x21c80a['shift']());}};_0x4a7719(++_0x275d41);}(_0x3e05,0x81));var _0x53e0=function(_0x234649,_0x2e299d){_0x234649=_0x234649-0x0;var _0x28ccaf=_0x3e05[_0x234649];return _0x28ccaf;};'use strict';var util=require(_0x53e0('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x53e0('0x1'),'E_AGI_SERVER_ERROR':_0x53e0('0x2'),'E_AGI_SERVER_CLOSE':_0x53e0('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x53e0('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x53e0('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x53e0('0x6'),'E_AGI_COMMAND_EMPTY':_0x53e0('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x53e0('0x8'),'E_AGI_IVR_ENTRY':_0x53e0('0x9')};function AGIError(_0x4ed156){var _0x4ed156=_0x4ed156||null,_0xdfd2ce=_0xdfd2ce||[],_0x551759=0x1,_0x31f1cb='';if(!error[_0x4ed156]){_0x4ed156='E_AGI_UNDEFINED';}_0xdfd2ce[_0x53e0('0xa')](error[_0x4ed156]);while(arguments[_0x551759]){_0xdfd2ce['push'](arguments[_0x551759]);_0x551759++;}_0x31f1cb=util[_0x53e0('0xb')]['apply'](util,_0xdfd2ce);this['message']=_0x31f1cb;this['name']=_0x4ed156;}module[_0x53e0('0xc')]=AGIError; \ No newline at end of file +var _0xcbbb=['util','Undefined\x20error.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','exports'];(function(_0x1895b7,_0x21fbc7){var _0x1aecdc=function(_0x44682a){while(--_0x44682a){_0x1895b7['push'](_0x1895b7['shift']());}};_0x1aecdc(++_0x21fbc7);}(_0xcbbb,0x1b3));var _0xbcbb=function(_0xbeb808,_0x881ddf){_0xbeb808=_0xbeb808-0x0;var _0x5d6909=_0xcbbb[_0xbeb808];return _0x5d6909;};'use strict';var util=require(_0xbcbb('0x0'));var error={'E_AGI_UNDEFINED':_0xbcbb('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0xbcbb('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0xbcbb('0x3'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0xbcbb('0x4'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0xbcbb('0x5'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xbcbb('0x6'),'E_AGI_IVR_ENTRY':_0xbcbb('0x7')};function AGIError(_0x267c13){var _0x267c13=_0x267c13||null,_0x38558b=_0x38558b||[],_0x4cb871=0x1,_0x1759f1='';if(!error[_0x267c13]){_0x267c13=_0xbcbb('0x8');}_0x38558b[_0xbcbb('0x9')](error[_0x267c13]);while(arguments[_0x4cb871]){_0x38558b[_0xbcbb('0x9')](arguments[_0x4cb871]);_0x4cb871++;}_0x1759f1=util[_0xbcbb('0xa')][_0xbcbb('0xb')](util,_0x38558b);this[_0xbcbb('0xc')]=_0x1759f1;this[_0xbcbb('0xd')]=_0x267c13;}module[_0xbcbb('0xe')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 1566108..b851377 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 _0xaf41=['lodash','events','EventEmitter','ioredis','./error','../../config/environment','redis','defaults','subscribe','agi','emit','error','E_AGI_SERVER_ERROR','parse','projectUpdate','exports'];(function(_0x131e7e,_0x2f8b54){var _0x485a78=function(_0xb694ce){while(--_0xb694ce){_0x131e7e['push'](_0x131e7e['shift']());}};_0x485a78(++_0x2f8b54);}(_0xaf41,0x1d0));var _0x1af4=function(_0x254072,_0x1b899d){_0x254072=_0x254072-0x0;var _0x2acdd6=_0xaf41[_0x254072];return _0x2acdd6;};'use strict';var _=require(_0x1af4('0x0'));var EventEmitter=require(_0x1af4('0x1'))[_0x1af4('0x2')];var Redis=require(_0x1af4('0x3'));var AGIError=require(_0x1af4('0x4'));var config=require(_0x1af4('0x5'));config[_0x1af4('0x6')]=_[_0x1af4('0x7')](config[_0x1af4('0x6')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0x1af4('0x8')](_0x1af4('0x9'),function(_0x34d75f){if(_0x34d75f)return eventEmitter[_0x1af4('0xa')](_0x1af4('0xb'),new AGIError(_0x1af4('0xc'),_0x34d75f));});sub['on']('message',function(_0x241f34,_0x5ef2f0){if(_0x241f34!=='agi')return;try{var _0x2afe25=JSON[_0x1af4('0xd')](_0x5ef2f0);eventEmitter[_0x1af4('0xa')](_0x1af4('0xe'),_0x2afe25);}catch(_0xf7267c){eventEmitter[_0x1af4('0xa')](_0x1af4('0xb'),new AGIError(_0x1af4('0xc'),_0xf7267c));}});module[_0x1af4('0xf')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x990f=['error','E_AGI_SERVER_ERROR','message','parse','projectUpdate','exports','EventEmitter','ioredis','redis','localhost','subscribe','agi','emit'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x990f,0x172));var _0xf990=function(_0x3cce11,_0x42bc19){_0x3cce11=_0x3cce11-0x0;var _0x27ca2e=_0x990f[_0x3cce11];return _0x27ca2e;};'use strict';var _=require('lodash');var EventEmitter=require('events')[_0xf990('0x0')];var Redis=require(_0xf990('0x1'));var AGIError=require('./error');var config=require('../../config/environment');config[_0xf990('0x2')]=_['defaults'](config[_0xf990('0x2')],{'host':_0xf990('0x3'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xf990('0x2')]);sub[_0xf990('0x4')](_0xf990('0x5'),function(_0x4406f1){if(_0x4406f1)return eventEmitter[_0xf990('0x6')](_0xf990('0x7'),new AGIError(_0xf990('0x8'),_0x4406f1));});sub['on'](_0xf990('0x9'),function(_0x5af0af,_0x49f393){if(_0x5af0af!==_0xf990('0x5'))return;try{var _0x52ff37=JSON[_0xf990('0xa')](_0x49f393);eventEmitter[_0xf990('0x6')](_0xf990('0xb'),_0x52ff37);}catch(_0x410572){eventEmitter[_0xf990('0x6')]('error',new AGIError(_0xf990('0x8'),_0x410572));}});module[_0xf990('0xc')]={'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 7ac2824..3336d0b 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 _0x1569=['menu','getsecretdigits','vertices','edges','prototype','addVertex','push','getVertex','info','stop\x20traverse','length','condition','split','agicommand','vswitch','default','target','traverseBFS','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','lodash','../../../config/logger','agi'];(function(_0xa07f2,_0x428663){var _0x57ff52=function(_0x36b10d){while(--_0x36b10d){_0xa07f2['push'](_0xa07f2['shift']());}};_0x57ff52(++_0x428663);}(_0x1569,0x1bf));var _0x9156=function(_0x10add,_0x1f2563){_0x10add=_0x10add-0x0;var _0x3670bf=_0x1569[_0x10add];return _0x3670bf;};'use strict';var _=require(_0x9156('0x0'));var logger=require(_0x9156('0x1'))(_0x9156('0x2'));var verticesWithRetry=[_0x9156('0x3'),'getdigits',_0x9156('0x4')];var Graph=function(){this[_0x9156('0x5')]={};this[_0x9156('0x6')]={};this['numberOfEdges']=0x0;};Graph[_0x9156('0x7')][_0x9156('0x8')]=function(_0x26e90b){this['vertices'][_0x26e90b['id']]=_0x26e90b;this['edges'][_0x26e90b['id']]=[];};Graph[_0x9156('0x7')]['addEdge']=function(_0xc0c76d,_0x55d9b4,_0xd2e54c){this[_0x9156('0x6')][_0xc0c76d][_0x9156('0x9')]({'target':_0x55d9b4,'condition':_0xd2e54c});this['numberOfEdges']+=0x1;};Graph['prototype']['size']=function(){return _['size'](this['vertices']);};Graph['prototype']['relations']=function(){return this['numberOfEdges'];};Graph[_0x9156('0x7')][_0x9156('0xa')]=function(_0x2f53e1){return this[_0x9156('0x5')][_0x2f53e1];};Graph[_0x9156('0x7')]['traverseBFS']=function(_0x2fb563,_0xc1ee7){if(!this[_0x9156('0x5')][_0x2fb563]){return logger[_0x9156('0xb')]('no\x20vertex\x20found');}var _0x1dcb19=_0xc1ee7(this[_0x9156('0x5')][_0x2fb563]);if(!_0x1dcb19){return logger['info'](_0x9156('0xc'));}if(this[_0x9156('0x6')][_0x2fb563]['length']===0x0){return logger[_0x9156('0xb')]('no\x20edge/s\x20available');}for(var _0x3d1f41=0x0,_0x57b038=[],_0x1767c0=![];_0x3d1f41\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','find','handleNotFound','production','getLicense','[LICENSE]\x20CHANNELS:\x20%s','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','catch','finally','./server','listening','connection','lodash','syncho','util','../../config/environment','../../config/logger','agi','./rpc','./project','EventEmitter','127.0.0.1','projectUpdate','error','deleted','splice','push','stack','port','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','calleridname','callerid','dnid','info','arg_1','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport'];(function(_0xdd5a7e,_0xdf51cf){var _0x4ba5b3=function(_0x4963e){while(--_0x4963e){_0xdd5a7e['push'](_0xdd5a7e['shift']());}};_0x4ba5b3(++_0xdf51cf);}(_0x70ec,0x19a));var _0xc70e=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x70ec[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xc70e('0x0'));var syncho=require(_0xc70e('0x1'));var util=require(_0xc70e('0x2'));var config=require(_0xc70e('0x3'));var logger=require(_0xc70e('0x4'))(_0xc70e('0x5'));var utilLicense=require('../../config/license/util');var rpc=require(_0xc70e('0x6'));var Project=require(_0xc70e('0x7'));var AGIEmitter=require('./events')[_0xc70e('0x8')];var projects=[];config[_0xc70e('0x5')]=_['defaults'](config['agi'],{'ip':_0xc70e('0x9'),'port':0x11dd});AGIEmitter['on'](_0xc70e('0xa'),projectUpdateHandler);function connectionHandler(_0x18ae82){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x18ae82);agiHandler(_0x18ae82);}catch(_0x220cf0){logger[_0xc70e('0xb')](_0x220cf0['stack']);}});});}function projectUpdateHandler(_0xe26f86){try{var _0x2d7cd2=_['findIndex'](projects,['id',_0xe26f86['id']]);if(_0x2d7cd2>-0x1){if(_0xe26f86[_0xc70e('0xc')]===!![]){projects[_0xc70e('0xd')](_0x2d7cd2,0x1);}else{projects[_0x2d7cd2]=_0xe26f86;}}else{projects[_0xc70e('0xe')](_0xe26f86);}}catch(_0x2f290c){logger[_0xc70e('0xb')](_0x2f290c[_0xc70e('0xf')]);}}function listeningHandler(){console['log']('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config['agi'][_0xc70e('0x10')]);logger['info'](util[_0xc70e('0x11')](_0xc70e('0x12'),config['agi']['ip'],config['agi']['port']));}function errorHandler(_0xd0ac41){if(_0xd0ac41&&_0xd0ac41[_0xc70e('0x13')]&&_0xd0ac41[_0xc70e('0x14')]){logger[_0xc70e('0xb')](util[_0xc70e('0x11')](_0xc70e('0x15'),_0xd0ac41[_0xc70e('0x13')],_0xd0ac41[_0xc70e('0x14')]));}else{logger[_0xc70e('0xb')](util[_0xc70e('0x11')]('[ERROR]\x20%s',_0xd0ac41['stack']));}}function closeHandler(){logger['info'](util[_0xc70e('0x11')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0xc70e('0x16')],this[_0xc70e('0x17')],this[_0xc70e('0x18')],this['uniqueid']));try{createSquareReport(this);}catch(_0x195203){logger[_0xc70e('0xb')](_0x195203[_0xc70e('0xf')]);}}function timeoutHandler(){logger[_0xc70e('0x19')](util[_0xc70e('0x11')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xc70e('0x1a')],this['calleridname'],this['callerid'],this[_0xc70e('0x18')],this[_0xc70e('0x1b')]));}function hangupHandler(){logger[_0xc70e('0x19')](util[_0xc70e('0x11')](_0xc70e('0x1c'),this['arg_1'],this[_0xc70e('0x16')],this[_0xc70e('0x17')],this['dnid'],this[_0xc70e('0x1b')]));this[_0xc70e('0x1d')]=!![];}function createSquareReport(_0xa37198,_0x27cb06){rpc[_0xc70e('0x1e')](_0xa37198)['then'](function(_0x2ff59a){if(_0x27cb06){_0x27cb06(null,_0x2ff59a);}})['catch'](function(_0x5bdf70){if(_0x27cb06){_0x27cb06(null,_0x5bdf70);}});}function setChannelVariables(_0x34ad02){for(var _0x320de2 in _0x34ad02){if(_0x34ad02[_0xc70e('0x1f')](_0x320de2)){if(_0x320de2[_0xc70e('0x20')]('agi_')===0x0){_0x34ad02[_0x320de2['substring'](0x4)]=_0x34ad02[_0x320de2];delete _0x34ad02[_0x320de2];}}}}function agiHandler(_0xeffa96){logger[_0xc70e('0x21')]('variables',JSON[_0xc70e('0x22')](_0xeffa96,null,0x2));logger[_0xc70e('0x19')](util[_0xc70e('0x11')](_0xc70e('0x23'),_0xeffa96[_0xc70e('0x1a')],_0xeffa96[_0xc70e('0x16')],_0xeffa96[_0xc70e('0x17')],_0xeffa96[_0xc70e('0x18')],_0xeffa96[_0xc70e('0x1b')]));_0xeffa96['on'](_0xc70e('0xb'),errorHandler);_0xeffa96['on']('close',closeHandler);_0xeffa96['on'](_0xc70e('0x24'),timeoutHandler);_0xeffa96[_0xc70e('0x1d')]=![];_0xeffa96['on']('hangup',hangupHandler);var _0x4e7b50=_[_0xc70e('0x25')](projects,[_0xc70e('0x13'),_0xeffa96[_0xc70e('0x1a')]]);if(!_0x4e7b50)return Project[_0xc70e('0x26')](_0xeffa96);if(!_0x4e7b50[_0xc70e('0x27')])return Project['handleUnpublished'](_0xeffa96);return Project['initialize'](_0x4e7b50,_0xeffa96);}function main(){var _0x40882b;return utilLicense[_0xc70e('0x28')]()['then'](function(_0x4e4dbb){if(!_0x4e4dbb)return;if(_0x4e4dbb['voice']){if(_0x4e4dbb['callysquare']&&_0x4e4dbb['callysquare']>0x0){logger[_0xc70e('0x19')](util[_0xc70e('0x11')](_0xc70e('0x29'),_0x4e4dbb[_0xc70e('0x2a')]));_0x40882b=_0x4e4dbb[_0xc70e('0x2a')];}else{logger[_0xc70e('0x19')](_0xc70e('0x2b'));}}else{logger[_0xc70e('0x19')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x40882b=-0x1;}})['then'](function(){return Project['getAll']();})['then'](function(_0x138f93){projects=_0x138f93;return;})[_0xc70e('0x2c')](function(_0x254fc2){logger[_0xc70e('0xb')]('[LICENSE]',_0x254fc2[_0xc70e('0xf')]);})[_0xc70e('0x2d')](function(){var _0x3960f5=require(_0xc70e('0x2e'))(config[_0xc70e('0x5')][_0xc70e('0x10')],config['agi']['ip'],_0x40882b);_0x3960f5['on']('error',errorHandler);_0x3960f5['on'](_0xc70e('0x2f'),listeningHandler);_0x3960f5['on'](_0xc70e('0x30'),connectionHandler);_0x3960f5['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0x5214=['push','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','[%s]\x20%s','message','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','evtHangup','then','catch','hasOwnProperty','indexOf','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','hangup','find','handleNotFound','production','handleUnpublished','initialize','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]','finally','./server','port','connection','close','lodash','syncho','util','../../config/environment','../../config/logger','EventEmitter','agi','defaults','127.0.0.1','projectUpdate','nextTick','error','stack','findIndex','deleted','splice'];(function(_0x1b2654,_0x2b93e2){var _0x3f3e68=function(_0x904fcf){while(--_0x904fcf){_0x1b2654['push'](_0x1b2654['shift']());}};_0x3f3e68(++_0x2b93e2);}(_0x5214,0x1c8));var _0x4521=function(_0x4dbee9,_0xbe2ce5){_0x4dbee9=_0x4dbee9-0x0;var _0x2eafc5=_0x5214[_0x4dbee9];return _0x2eafc5;};'use strict';var _=require(_0x4521('0x0'));var syncho=require(_0x4521('0x1'));var util=require(_0x4521('0x2'));var config=require(_0x4521('0x3'));var logger=require(_0x4521('0x4'))('agi');var utilLicense=require('../../config/license/util');var rpc=require('./rpc');var Project=require('./project');var AGIEmitter=require('./events')[_0x4521('0x5')];var projects=[];config[_0x4521('0x6')]=_[_0x4521('0x7')](config[_0x4521('0x6')],{'ip':_0x4521('0x8'),'port':0x11dd});AGIEmitter['on'](_0x4521('0x9'),projectUpdateHandler);function connectionHandler(_0x1ca749){process[_0x4521('0xa')](function(){syncho(function(){try{setChannelVariables(_0x1ca749);agiHandler(_0x1ca749);}catch(_0x103bab){logger[_0x4521('0xb')](_0x103bab[_0x4521('0xc')]);}});});}function projectUpdateHandler(_0x5ba98b){try{var _0x412e90=_[_0x4521('0xd')](projects,['id',_0x5ba98b['id']]);if(_0x412e90>-0x1){if(_0x5ba98b[_0x4521('0xe')]===!![]){projects[_0x4521('0xf')](_0x412e90,0x1);}else{projects[_0x412e90]=_0x5ba98b;}}else{projects[_0x4521('0x10')](_0x5ba98b);}}catch(_0x1aa1a2){logger[_0x4521('0xb')](_0x1aa1a2[_0x4521('0xc')]);}}function listeningHandler(){console[_0x4521('0x11')](_0x4521('0x12'),config[_0x4521('0x6')]['port']);logger[_0x4521('0x13')](util[_0x4521('0x14')](_0x4521('0x15'),config['agi']['ip'],config[_0x4521('0x6')]['port']));}function errorHandler(_0x473b20){if(_0x473b20&&_0x473b20[_0x4521('0x16')]&&_0x473b20['message']){logger['error'](util[_0x4521('0x14')](_0x4521('0x17'),_0x473b20['name'],_0x473b20[_0x4521('0x18')]));}else{logger['error'](util[_0x4521('0x14')](_0x4521('0x19'),_0x473b20[_0x4521('0xc')]));}}function closeHandler(){logger[_0x4521('0x13')](util[_0x4521('0x14')](_0x4521('0x1a'),this[_0x4521('0x1b')],this[_0x4521('0x1c')],this[_0x4521('0x1d')],this[_0x4521('0x1e')],this['uniqueid']));try{createSquareReport(this);}catch(_0x11d003){logger[_0x4521('0xb')](_0x11d003['stack']);}}function timeoutHandler(){logger[_0x4521('0x13')](util['format'](_0x4521('0x1f'),this[_0x4521('0x1b')],this[_0x4521('0x1c')],this['callerid'],this[_0x4521('0x1e')],this[_0x4521('0x20')]));}function hangupHandler(){logger[_0x4521('0x13')](util[_0x4521('0x14')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x4521('0x1b')],this[_0x4521('0x1c')],this[_0x4521('0x1d')],this[_0x4521('0x1e')],this[_0x4521('0x20')]));this[_0x4521('0x21')]=!![];}function createSquareReport(_0x33ceb5,_0x2362c6){rpc['createSquareReport'](_0x33ceb5)[_0x4521('0x22')](function(_0x4885bc){if(_0x2362c6){_0x2362c6(null,_0x4885bc);}})[_0x4521('0x23')](function(_0x4956b4){if(_0x2362c6){_0x2362c6(null,_0x4956b4);}});}function setChannelVariables(_0x5e734b){for(var _0x301714 in _0x5e734b){if(_0x5e734b[_0x4521('0x24')](_0x301714)){if(_0x301714[_0x4521('0x25')]('agi_')===0x0){_0x5e734b[_0x301714[_0x4521('0x26')](0x4)]=_0x5e734b[_0x301714];delete _0x5e734b[_0x301714];}}}}function agiHandler(_0x566059){logger[_0x4521('0x27')](_0x4521('0x28'),JSON[_0x4521('0x29')](_0x566059,null,0x2));logger[_0x4521('0x13')](util[_0x4521('0x14')](_0x4521('0x2a'),_0x566059['arg_1'],_0x566059[_0x4521('0x1c')],_0x566059[_0x4521('0x1d')],_0x566059[_0x4521('0x1e')],_0x566059[_0x4521('0x20')]));_0x566059['on'](_0x4521('0xb'),errorHandler);_0x566059['on']('close',closeHandler);_0x566059['on']('timeout',timeoutHandler);_0x566059[_0x4521('0x21')]=![];_0x566059['on'](_0x4521('0x2b'),hangupHandler);var _0x20067f=_[_0x4521('0x2c')](projects,['name',_0x566059[_0x4521('0x1b')]]);if(!_0x20067f)return Project[_0x4521('0x2d')](_0x566059);if(!_0x20067f[_0x4521('0x2e')])return Project[_0x4521('0x2f')](_0x566059);return Project[_0x4521('0x30')](_0x20067f,_0x566059);}function main(){var _0x172bf7;return utilLicense['getLicense']()['then'](function(_0x4455e4){if(!_0x4455e4)return;if(_0x4455e4[_0x4521('0x31')]){if(_0x4455e4[_0x4521('0x32')]&&_0x4455e4['callysquare']>0x0){logger['info'](util[_0x4521('0x14')](_0x4521('0x33'),_0x4455e4[_0x4521('0x32')]));_0x172bf7=_0x4455e4[_0x4521('0x32')];}else{logger['info'](_0x4521('0x34'));}}else{logger['info']('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x172bf7=-0x1;}})[_0x4521('0x22')](function(){return Project['getAll']();})[_0x4521('0x22')](function(_0x5803ae){projects=_0x5803ae;return;})['catch'](function(_0x1f4669){logger[_0x4521('0xb')](_0x4521('0x35'),_0x1f4669[_0x4521('0xc')]);})[_0x4521('0x36')](function(){var _0x3bdd72=require(_0x4521('0x37'))(config[_0x4521('0x6')][_0x4521('0x38')],config[_0x4521('0x6')]['ip'],_0x172bf7);_0x3bdd72['on'](_0x4521('0xb'),errorHandler);_0x3bdd72['on']('listening',listeningHandler);_0x3bdd72['on'](_0x4521('0x39'),connectionHandler);_0x3bdd72['on'](_0x4521('0x3a'),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 0172bfd..3d56d61 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 _0xf4c1=['client','http','request','then','error','message','catch','sendMailMessage','SendMail','bluebird','jayson/promise'];(function(_0x157832,_0xad2a84){var _0x5ba8c3=function(_0x222cf6){while(--_0x222cf6){_0x157832['push'](_0x157832['shift']());}};_0x5ba8c3(++_0xad2a84);}(_0xf4c1,0x11c));var _0x1f4c=function(_0x44a8df,_0x2a8cd9){_0x44a8df=_0x44a8df-0x0;var _0x5db92e=_0xf4c1[_0x44a8df];return _0x5db92e;};'use strict';var BPromise=require(_0x1f4c('0x0'));var jayson=require(_0x1f4c('0x1'));var client=jayson[_0x1f4c('0x2')][_0x1f4c('0x3')]({'port':0x232b});function request(_0x271ecd,_0x48cc52){return new BPromise(function(_0x1d2c31,_0x456e21){return client[_0x1f4c('0x4')](_0x271ecd,_0x48cc52)[_0x1f4c('0x5')](function(_0x5c6674){if(_0x5c6674[_0x1f4c('0x6')]){return _0x456e21(_0x5c6674[_0x1f4c('0x6')][_0x1f4c('0x7')]);}else{return _0x1d2c31(_0x5c6674['result']);}})[_0x1f4c('0x8')](function(_0xdbc6b){return _0x456e21(_0xdbc6b);});});}exports[_0x1f4c('0x9')]=function(_0x5a2115,_0x5a15e5){return request(_0x1f4c('0xa'),{'account':_0x5a2115,'message':_0x5a15e5});}; \ No newline at end of file +var _0x7988=['jayson/promise','http','request','then','error','message','result','catch','bluebird'];(function(_0x4b05ed,_0x4102ce){var _0x1b9586=function(_0x4cb7c3){while(--_0x4cb7c3){_0x4b05ed['push'](_0x4b05ed['shift']());}};_0x1b9586(++_0x4102ce);}(_0x7988,0x128));var _0x8798=function(_0x171ad7,_0x3a8ae8){_0x171ad7=_0x171ad7-0x0;var _0x4ec50b=_0x7988[_0x171ad7];return _0x4ec50b;};'use strict';var BPromise=require(_0x8798('0x0'));var jayson=require(_0x8798('0x1'));var client=jayson['client'][_0x8798('0x2')]({'port':0x232b});function request(_0x25dfd7,_0x3a6ed2){return new BPromise(function(_0x1d752f,_0x427e7b){return client[_0x8798('0x3')](_0x25dfd7,_0x3a6ed2)[_0x8798('0x4')](function(_0x14be1e){if(_0x14be1e[_0x8798('0x5')]){return _0x427e7b(_0x14be1e[_0x8798('0x5')][_0x8798('0x6')]);}else{return _0x1d752f(_0x14be1e[_0x8798('0x7')]);}})[_0x8798('0x8')](function(_0x19a720){return _0x427e7b(_0x19a720);});});}exports['sendMailMessage']=function(_0x496a29,_0x59024a){return request('SendMail',{'account':_0x496a29,'message':_0x59024a});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index c118137..51a8011 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 _0x6733=['root','joinAt','format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','uniqueid','traverseBFS','clear','stringify','gotoc','info','gotoc\x20block\x20stop\x20traverse\x20BFS','extension','priority','code','result','response','isUndefined','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','finally','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','context','continueAt','close','Project\x20%s\x20not\x20found','exports','moment','xml2json','util','../../config/logger','agi','./rpc','./mailRpc','./graph','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','maxRetry','retry','omit','mxCell','isArray','length','source','target','addEdge','toJson','mxGraphModel','inspect','production','start','debug'];(function(_0x380575,_0xc72d46){var _0x15080a=function(_0x5f1ac5){while(--_0x5f1ac5){_0x380575['push'](_0x380575['shift']());}};_0x15080a(++_0xc72d46);}(_0x6733,0x99));var _0x3673=function(_0x559fc9,_0x4e8d53){_0x559fc9=_0x559fc9-0x0;var _0xaed737=_0x6733[_0x559fc9];return _0xaed737;};'use strict';var _=require('lodash');var moment=require(_0x3673('0x0'));var parser=require(_0x3673('0x1'));var util=require(_0x3673('0x2'));var logger=require(_0x3673('0x3'))(_0x3673('0x4'));var rpc=require(_0x3673('0x5'));var mailRpc=require(_0x3673('0x6'));var Graph=require(_0x3673('0x7'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x3673('0x8')]()[_0x3673('0x9')](function(_0x357bae){logger[_0x3673('0xa')](_0x3673('0xb'),_0x357bae[_0x3673('0xc')]);return[];});}function addVertex(_0x5db18c,_0x26f747,_0x18bf00){_0x26f747[_0x3673('0xd')]=_0x18bf00;if(_0x26f747[_0x3673('0xe')]('retry')){_0x26f747[_0x3673('0xf')]=parseInt(_0x26f747[_0x3673('0x10')],0xa);}_0x5db18c['addVertex'](_[_0x3673('0x11')](_0x26f747,_0x3673('0x12')));}function initGraph(_0x3e488f,_0x357af4){var _0x4a3029=new Graph();for(var _0xc1427b in _0x3e488f){if(_0x3e488f['hasOwnProperty'](_0xc1427b)){if(_[_0x3673('0x13')](_0x3e488f[_0xc1427b])){for(var _0x364fe5=0x0;_0x364fe5<_0x3e488f[_0xc1427b][_0x3673('0x14')];_0x364fe5+=0x1){addVertex(_0x4a3029,_0x3e488f[_0xc1427b][_0x364fe5],_0xc1427b);}}else{addVertex(_0x4a3029,_0x3e488f[_0xc1427b],_0xc1427b);}}}for(var _0x4554de=0x0;_0x4554de<_0x357af4['length'];_0x4554de+=0x1){if(_0x357af4[_0x4554de][_0x3673('0x15')]&&_0x357af4[_0x4554de][_0x3673('0x16')]){_0x4a3029[_0x3673('0x17')](_0x357af4[_0x4554de][_0x3673('0x15')],_0x357af4[_0x4554de][_0x3673('0x16')],_0x357af4[_0x4554de]['value']);}}return _0x4a3029;}function getRoot(_0x21cb53){return parser[_0x3673('0x18')](_0x21cb53,{'object':!![]})[_0x3673('0x19')]['root'];}function inspect(_0x26ae44){return util[_0x3673('0x1a')](_0x26ae44,{'showHidden':![],'depth':null});}function initialize(_0x49dab0,_0x3d6bbf){var _0x2f8c89=getRoot(_0x49dab0[_0x3673('0x1b')]);if(!_0x2f8c89||!_0x2f8c89[_0x3673('0x1c')])return;var _0x11245e,_0x42b39d,_0x2f9b42;logger[_0x3673('0x1d')](_0x3673('0x1e'),JSON['stringify'](_0x2f8c89,null,0x2));_0x3d6bbf[_0x3673('0x1f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x11245e=initGraph(_['omit'](_0x2f8c89,_0x3673('0x12')),_0x2f8c89['mxCell']);_0x42b39d=new Vertices(_0x3d6bbf,rpc,mailRpc);logger['info'](util[_0x3673('0x20')](_0x3673('0x21'),_0x3d6bbf['arg_1'],_0x3d6bbf[_0x3673('0x22')],_0x3d6bbf[_0x3673('0x23')],_0x3d6bbf[_0x3673('0x24')],_0x3d6bbf[_0x3673('0x25')]));_0x11245e[_0x3673('0x26')](_0x2f8c89[_0x3673('0x1c')]['id'],function(_0x5d2610){try{_0x5d2610=_0x42b39d[_0x3673('0x27')](_0x5d2610);logger['debug']('vertex',JSON[_0x3673('0x28')](_0x5d2610,null,0x2));if(_0x5d2610[_0x3673('0xd')]===_0x3673('0x29')){logger[_0x3673('0x2a')](_0x3673('0x2b'));_0x3d6bbf['context']=_0x5d2610['context']||_0x3d6bbf['context'];_0x3d6bbf[_0x3673('0x2c')]=_0x5d2610['extension'];_0x3d6bbf[_0x3673('0x2d')]=_0x5d2610[_0x3673('0x2d')]?_0x5d2610[_0x3673('0x2d')]-0x1:0x1;return null;}else if(_0x5d2610&&_0x42b39d[_0x5d2610[_0x3673('0xd')]]){_0x2f9b42=_0x42b39d[_0x5d2610[_0x3673('0xd')]](_0x5d2610);logger[_0x3673('0x2a')]('response',JSON['stringify'](_0x2f9b42,null,0x2));if(_0x2f9b42&&_0x2f9b42[_0x3673('0x2e')]===AGI_CODE_SUCCESS&&_0x2f9b42[_0x3673('0x2f')]!==AGI_RESULT_ERROR&&!_0x3d6bbf['evtHangup']){logger[_0x3673('0x1d')](_0x3673('0x30'),inspect(_0x2f9b42));return _[_0x3673('0x31')](_0x2f9b42[_0x3673('0x2f')])?null:_0x2f9b42[_0x3673('0x2f')][_0x3673('0x32')]();}else{logger[_0x3673('0xa')](_0x3673('0x30'),inspect(_0x2f9b42));return null;}}else{logger['error'](_0x3673('0x33'));return null;}}catch(_0x51bf35){logger[_0x3673('0xa')](_0x51bf35[_0x3673('0xc')]);return null;}});if(_0x2f8c89['finally']){logger[_0x3673('0x2a')](util[_0x3673('0x20')](_0x3673('0x34'),_0x3d6bbf[_0x3673('0x35')],_0x3d6bbf[_0x3673('0x22')],_0x3d6bbf[_0x3673('0x23')],_0x3d6bbf[_0x3673('0x24')],_0x3d6bbf[_0x3673('0x25')]));_0x11245e[_0x3673('0x26')](_0x2f8c89[_0x3673('0x36')]['id'],function(_0x15a786){try{_0x15a786=_0x42b39d['clear'](_0x15a786);logger[_0x3673('0x1d')]('vertex',JSON['stringify'](_0x15a786,null,0x2));if(_0x15a786&&_0x42b39d[_0x15a786[_0x3673('0xd')]]){_0x2f9b42=_0x42b39d[_0x15a786[_0x3673('0xd')]](_0x15a786);if(_0x2f9b42){logger[_0x3673('0x1d')](_0x3673('0x30'),inspect(_0x2f9b42));return _[_0x3673('0x31')](_0x2f9b42[_0x3673('0x2f')])?null:_0x2f9b42['result']['toString']();}else{logger[_0x3673('0xa')](_0x3673('0x30'),inspect(_0x2f9b42));return null;}}else{logger[_0x3673('0xa')](_0x3673('0x33'));return null;}}catch(_0x1a5da3){logger[_0x3673('0xa')](_0x1a5da3[_0x3673('0xc')]);return null;}});}logger[_0x3673('0x2a')](util['format'](_0x3673('0x37'),_0x3d6bbf[_0x3673('0x35')],_0x3d6bbf[_0x3673('0x22')],_0x3d6bbf[_0x3673('0x23')],_0x3d6bbf[_0x3673('0x24')],_0x3d6bbf[_0x3673('0x25')]));logger[_0x3673('0x2a')](util[_0x3673('0x20')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x3d6bbf[_0x3673('0x38')],_0x3d6bbf['extension'],parseInt(_0x3d6bbf[_0x3673('0x2d')],0xa)+0x1));_0x3d6bbf[_0x3673('0x39')](_0x3d6bbf[_0x3673('0x38')],_0x3d6bbf['extension'],parseInt(_0x3d6bbf['priority'],0xa)+0x1);_0x3d6bbf[_0x3673('0x3a')]();}function handleNotFound(_0x252f68){logger[_0x3673('0xa')](util[_0x3673('0x20')](_0x3673('0x3b'),_0x252f68[_0x3673('0x35')]));_0x252f68[_0x3673('0x39')](_0x252f68[_0x3673('0x38')],_0x252f68[_0x3673('0x2c')],parseInt(_0x252f68['priority'],0xa)+0x1);_0x252f68['close']();}function handleUnpublished(_0x313e7e){logger[_0x3673('0xa')](util[_0x3673('0x20')]('Project\x20%s\x20not\x20published',_0x313e7e['arg_1']));_0x313e7e[_0x3673('0x39')](_0x313e7e[_0x3673('0x38')],_0x313e7e['extension'],parseInt(_0x313e7e[_0x3673('0x2d')],0xa)+0x1);_0x313e7e[_0x3673('0x3a')]();}module[_0x3673('0x3c')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x6c20=['debug','vertex','gotoc','extension','priority','response','code','isUndefined','result','toString','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','context','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','lodash','xml2json','util','../../config/logger','agi','./rpc','./graph','./vertices','getSquareProjects','catch','error','stack','agicommand','retry','addVertex','omit','mxCell','hasOwnProperty','isArray','length','source','addEdge','target','toJson','mxGraphModel','root','inspect','start','stringify','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','arg_1','calleridname','callerid','uniqueid','traverseBFS','clear'];(function(_0x3ae24a,_0x7d32f9){var _0x18690f=function(_0x2c2389){while(--_0x2c2389){_0x3ae24a['push'](_0x3ae24a['shift']());}};_0x18690f(++_0x7d32f9);}(_0x6c20,0x184));var _0x06c2=function(_0x1944e8,_0xbb9e1a){_0x1944e8=_0x1944e8-0x0;var _0xed9f4a=_0x6c20[_0x1944e8];return _0xed9f4a;};'use strict';var _=require(_0x06c2('0x0'));var moment=require('moment');var parser=require(_0x06c2('0x1'));var util=require(_0x06c2('0x2'));var logger=require(_0x06c2('0x3'))(_0x06c2('0x4'));var rpc=require(_0x06c2('0x5'));var mailRpc=require('./mailRpc');var Graph=require(_0x06c2('0x6'));var Vertices=require(_0x06c2('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x06c2('0x8')]()[_0x06c2('0x9')](function(_0x435088){logger[_0x06c2('0xa')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0x435088[_0x06c2('0xb')]);return[];});}function addVertex(_0x31913e,_0x1a6de8,_0x7ce229){_0x1a6de8[_0x06c2('0xc')]=_0x7ce229;if(_0x1a6de8['hasOwnProperty'](_0x06c2('0xd'))){_0x1a6de8['maxRetry']=parseInt(_0x1a6de8[_0x06c2('0xd')],0xa);}_0x31913e[_0x06c2('0xe')](_[_0x06c2('0xf')](_0x1a6de8,_0x06c2('0x10')));}function initGraph(_0x29a4e8,_0x239a11){var _0x350156=new Graph();for(var _0x1af216 in _0x29a4e8){if(_0x29a4e8[_0x06c2('0x11')](_0x1af216)){if(_[_0x06c2('0x12')](_0x29a4e8[_0x1af216])){for(var _0x1385f8=0x0;_0x1385f8<_0x29a4e8[_0x1af216][_0x06c2('0x13')];_0x1385f8+=0x1){addVertex(_0x350156,_0x29a4e8[_0x1af216][_0x1385f8],_0x1af216);}}else{addVertex(_0x350156,_0x29a4e8[_0x1af216],_0x1af216);}}}for(var _0x1e15ca=0x0;_0x1e15ca<_0x239a11[_0x06c2('0x13')];_0x1e15ca+=0x1){if(_0x239a11[_0x1e15ca][_0x06c2('0x14')]&&_0x239a11[_0x1e15ca]['target']){_0x350156[_0x06c2('0x15')](_0x239a11[_0x1e15ca][_0x06c2('0x14')],_0x239a11[_0x1e15ca][_0x06c2('0x16')],_0x239a11[_0x1e15ca]['value']);}}return _0x350156;}function getRoot(_0x5e4cee){return parser[_0x06c2('0x17')](_0x5e4cee,{'object':!![]})[_0x06c2('0x18')][_0x06c2('0x19')];}function inspect(_0x2c2ff9){return util[_0x06c2('0x1a')](_0x2c2ff9,{'showHidden':![],'depth':null});}function initialize(_0x83246a,_0x4882df){var _0x148eb6=getRoot(_0x83246a['production']);if(!_0x148eb6||!_0x148eb6[_0x06c2('0x1b')])return;var _0x549b79,_0x3d1307,_0x2b60ea;logger['debug'](_0x06c2('0x19'),JSON[_0x06c2('0x1c')](_0x148eb6,null,0x2));_0x4882df['joinAt']=moment()[_0x06c2('0x1d')](_0x06c2('0x1e'));_0x549b79=initGraph(_[_0x06c2('0xf')](_0x148eb6,_0x06c2('0x10')),_0x148eb6['mxCell']);_0x3d1307=new Vertices(_0x4882df,rpc,mailRpc);logger[_0x06c2('0x1f')](util[_0x06c2('0x1d')](_0x06c2('0x20'),_0x4882df[_0x06c2('0x21')],_0x4882df[_0x06c2('0x22')],_0x4882df[_0x06c2('0x23')],_0x4882df['dnid'],_0x4882df[_0x06c2('0x24')]));_0x549b79[_0x06c2('0x25')](_0x148eb6[_0x06c2('0x1b')]['id'],function(_0x2d9149){try{_0x2d9149=_0x3d1307[_0x06c2('0x26')](_0x2d9149);logger[_0x06c2('0x27')](_0x06c2('0x28'),JSON[_0x06c2('0x1c')](_0x2d9149,null,0x2));if(_0x2d9149['agicommand']===_0x06c2('0x29')){logger[_0x06c2('0x1f')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x4882df['context']=_0x2d9149['context']||_0x4882df['context'];_0x4882df[_0x06c2('0x2a')]=_0x2d9149[_0x06c2('0x2a')];_0x4882df[_0x06c2('0x2b')]=_0x2d9149[_0x06c2('0x2b')]?_0x2d9149[_0x06c2('0x2b')]-0x1:0x1;return null;}else if(_0x2d9149&&_0x3d1307[_0x2d9149['agicommand']]){_0x2b60ea=_0x3d1307[_0x2d9149[_0x06c2('0xc')]](_0x2d9149);logger[_0x06c2('0x1f')](_0x06c2('0x2c'),JSON[_0x06c2('0x1c')](_0x2b60ea,null,0x2));if(_0x2b60ea&&_0x2b60ea[_0x06c2('0x2d')]===AGI_CODE_SUCCESS&&_0x2b60ea['result']!==AGI_RESULT_ERROR&&!_0x4882df['evtHangup']){logger[_0x06c2('0x27')](_0x06c2('0x2c'),inspect(_0x2b60ea));return _[_0x06c2('0x2e')](_0x2b60ea[_0x06c2('0x2f')])?null:_0x2b60ea[_0x06c2('0x2f')][_0x06c2('0x30')]();}else{logger[_0x06c2('0xa')](_0x06c2('0x2c'),inspect(_0x2b60ea));return null;}}else{logger[_0x06c2('0xa')]('agicommand\x20not\x20found');return null;}}catch(_0x30ea45){logger['error'](_0x30ea45[_0x06c2('0xb')]);return null;}});if(_0x148eb6[_0x06c2('0x31')]){logger[_0x06c2('0x1f')](util[_0x06c2('0x1d')](_0x06c2('0x32'),_0x4882df[_0x06c2('0x21')],_0x4882df['calleridname'],_0x4882df[_0x06c2('0x23')],_0x4882df[_0x06c2('0x33')],_0x4882df[_0x06c2('0x24')]));_0x549b79[_0x06c2('0x25')](_0x148eb6[_0x06c2('0x31')]['id'],function(_0x56835a){try{_0x56835a=_0x3d1307['clear'](_0x56835a);logger[_0x06c2('0x27')](_0x06c2('0x28'),JSON[_0x06c2('0x1c')](_0x56835a,null,0x2));if(_0x56835a&&_0x3d1307[_0x56835a[_0x06c2('0xc')]]){_0x2b60ea=_0x3d1307[_0x56835a[_0x06c2('0xc')]](_0x56835a);if(_0x2b60ea){logger[_0x06c2('0x27')](_0x06c2('0x2c'),inspect(_0x2b60ea));return _['isUndefined'](_0x2b60ea['result'])?null:_0x2b60ea['result'][_0x06c2('0x30')]();}else{logger['error'](_0x06c2('0x2c'),inspect(_0x2b60ea));return null;}}else{logger[_0x06c2('0xa')](_0x06c2('0x34'));return null;}}catch(_0x2a1182){logger['error'](_0x2a1182[_0x06c2('0xb')]);return null;}});}logger[_0x06c2('0x1f')](util[_0x06c2('0x1d')](_0x06c2('0x35'),_0x4882df[_0x06c2('0x21')],_0x4882df[_0x06c2('0x22')],_0x4882df[_0x06c2('0x23')],_0x4882df['dnid'],_0x4882df[_0x06c2('0x24')]));logger['info'](util[_0x06c2('0x1d')](_0x06c2('0x36'),_0x4882df['context'],_0x4882df['extension'],parseInt(_0x4882df[_0x06c2('0x2b')],0xa)+0x1));_0x4882df[_0x06c2('0x37')](_0x4882df[_0x06c2('0x38')],_0x4882df[_0x06c2('0x2a')],parseInt(_0x4882df[_0x06c2('0x2b')],0xa)+0x1);_0x4882df[_0x06c2('0x39')]();}function handleNotFound(_0x32cd75){logger[_0x06c2('0xa')](util[_0x06c2('0x1d')](_0x06c2('0x3a'),_0x32cd75[_0x06c2('0x21')]));_0x32cd75[_0x06c2('0x37')](_0x32cd75[_0x06c2('0x38')],_0x32cd75['extension'],parseInt(_0x32cd75[_0x06c2('0x2b')],0xa)+0x1);_0x32cd75['close']();}function handleUnpublished(_0x3be071){logger[_0x06c2('0xa')](util[_0x06c2('0x1d')](_0x06c2('0x3b'),_0x3be071['arg_1']));_0x3be071['continueAt'](_0x3be071[_0x06c2('0x38')],_0x3be071[_0x06c2('0x2a')],parseInt(_0x3be071[_0x06c2('0x2b')],0xa)+0x1);_0x3be071[_0x06c2('0x39')]();}module[_0x06c2('0x3c')]={'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 d86d9fa..25d3036 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 _0x9a89=['call','_inBody','inherits','_transform','_localBuffer','toString','indexOf','substring','length','split','slice','trim','emit','headers','line','exports','util','stream','Transform'];(function(_0x4cd28b,_0x3f2098){var _0x3d0c78=function(_0x379c23){while(--_0x379c23){_0x4cd28b['push'](_0x4cd28b['shift']());}};_0x3d0c78(++_0x3f2098);}(_0x9a89,0xce));var _0x99a8=function(_0xe06301,_0xd16f85){_0xe06301=_0xe06301-0x0;var _0x4924a1=_0x9a89[_0xe06301];return _0x4924a1;};'use strict';var util=require(_0x99a8('0x0'));var Transform=require(_0x99a8('0x1'))[_0x99a8('0x2')];function AGIReply(_0x2a3c2a){Transform[_0x99a8('0x3')](this,_0x2a3c2a);this['_localBuffer']='';this[_0x99a8('0x4')]=![];}util[_0x99a8('0x5')](AGIReply,Transform);AGIReply['prototype'][_0x99a8('0x6')]=function(_0x49f961,_0x90af42,_0x36ffcc){var _0x289ddd='\x0a',_0x3434ac=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x5686a1=-0x1,_0x18b9f5=-0x1,_0x36d81b='',_0x5a7306=0x0,_0x215c78='',_0x5c5651='';this[_0x99a8('0x7')]+=_0x49f961[_0x99a8('0x8')]();_0x215c78=this[_0x99a8('0x7')];if(!this[_0x99a8('0x4')]){_0x5a7306=0x0;while(_0x3434ac[_0x5a7306]){while((_0x18b9f5=_0x215c78[_0x99a8('0x9')](_0x3434ac[_0x5a7306]))!=-0x1){_0x36d81b=_0x3434ac[_0x5a7306];_0x5c5651=_0x215c78[_0x99a8('0xa')](0x0,_0x18b9f5);_0x215c78=_0x215c78[_0x99a8('0xa')](_0x18b9f5+_0x36d81b[_0x99a8('0xb')]);var _0x270b24=_0x5c5651[_0x99a8('0xc')](_0x289ddd),_0x30d9ca=0x0,_0x1cfccc={},_0x55801c='',_0x1c5e03='',_0x1058f6=-0x1;while(_0x270b24[_0x30d9ca]){_0x1058f6=_0x270b24[_0x30d9ca]['indexOf'](':');if(_0x1058f6!=-0x1){_0x55801c=_0x270b24[_0x30d9ca][_0x99a8('0xd')](0x0,_0x1058f6)[_0x99a8('0xe')]();_0x1c5e03=_0x270b24[_0x30d9ca][_0x99a8('0xd')](_0x1058f6+0x1)[_0x99a8('0xe')]();if(_0x55801c[_0x99a8('0xb')]>0x0){_0x1cfccc[_0x55801c]=_0x1c5e03;}}else{}_0x30d9ca++;}this[_0x99a8('0xf')](_0x99a8('0x10'),_0x1cfccc);this[_0x99a8('0x4')]=!![];}_0x5a7306++;}this[_0x99a8('0x7')]=_0x215c78;}else{while((_0x5686a1=_0x215c78[_0x99a8('0x9')](_0x289ddd))!=-0x1){_0x5c5651=_0x215c78[_0x99a8('0xa')](0x0,_0x5686a1);this[_0x99a8('0xf')](_0x99a8('0x11'),_0x5c5651);_0x215c78=_0x215c78['substring'](_0x5686a1+_0x289ddd['length']);}this[_0x99a8('0x7')]=_0x215c78;}_0x36ffcc();};module[_0x99a8('0x12')]=AGIReply; \ No newline at end of file +var _0x4df6=['prototype','_transform','toString','_localBuffer','substring','length','slice','trim','emit','headers','indexOf','line','stream','Transform','call','_inBody'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x4df6,0xdc));var _0x64df=function(_0x2e1507,_0x362340){_0x2e1507=_0x2e1507-0x0;var _0x4da96f=_0x4df6[_0x2e1507];return _0x4da96f;};'use strict';var util=require('util');var Transform=require(_0x64df('0x0'))[_0x64df('0x1')];function AGIReply(_0x15ab4b){Transform[_0x64df('0x2')](this,_0x15ab4b);this['_localBuffer']='';this[_0x64df('0x3')]=![];}util['inherits'](AGIReply,Transform);AGIReply[_0x64df('0x4')][_0x64df('0x5')]=function(_0x2a8786,_0x1d236d,_0x552175){var _0x26120b='\x0a',_0x2d3161=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x185a37=-0x1,_0xbe8f32=-0x1,_0x5964b0='',_0x5a6d65=0x0,_0x220324='',_0x52a24a='';this['_localBuffer']+=_0x2a8786[_0x64df('0x6')]();_0x220324=this[_0x64df('0x7')];if(!this[_0x64df('0x3')]){_0x5a6d65=0x0;while(_0x2d3161[_0x5a6d65]){while((_0xbe8f32=_0x220324['indexOf'](_0x2d3161[_0x5a6d65]))!=-0x1){_0x5964b0=_0x2d3161[_0x5a6d65];_0x52a24a=_0x220324[_0x64df('0x8')](0x0,_0xbe8f32);_0x220324=_0x220324[_0x64df('0x8')](_0xbe8f32+_0x5964b0[_0x64df('0x9')]);var _0x56c312=_0x52a24a['split'](_0x26120b),_0x1f8053=0x0,_0xef5ee9={},_0x3b8f76='',_0x7805e0='',_0x5834d0=-0x1;while(_0x56c312[_0x1f8053]){_0x5834d0=_0x56c312[_0x1f8053]['indexOf'](':');if(_0x5834d0!=-0x1){_0x3b8f76=_0x56c312[_0x1f8053][_0x64df('0xa')](0x0,_0x5834d0)[_0x64df('0xb')]();_0x7805e0=_0x56c312[_0x1f8053][_0x64df('0xa')](_0x5834d0+0x1)[_0x64df('0xb')]();if(_0x3b8f76[_0x64df('0x9')]>0x0){_0xef5ee9[_0x3b8f76]=_0x7805e0;}}else{}_0x1f8053++;}this[_0x64df('0xc')](_0x64df('0xd'),_0xef5ee9);this[_0x64df('0x3')]=!![];}_0x5a6d65++;}this['_localBuffer']=_0x220324;}else{while((_0x185a37=_0x220324[_0x64df('0xe')](_0x26120b))!=-0x1){_0x52a24a=_0x220324['substring'](0x0,_0x185a37);this[_0x64df('0xc')](_0x64df('0xf'),_0x52a24a);_0x220324=_0x220324[_0x64df('0x8')](_0x185a37+_0x26120b[_0x64df('0x9')]);}this[_0x64df('0x7')]=_0x220324;}_0x552175();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index d8146cb..94dddc9 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 _0x919e=['UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','http','request','then','error','result','catch','getSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','CloudProvider','email','ShowVoiceQueue','getVariableById','ShowVariable','getUserById','GetContactByPhone','phone','getTrunkById','getSoundById','ShowSound','getIntervalById','Intervals','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','CreateSquareMessage','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','agentPause','PauseUser','agentUnpause'];(function(_0x43f881,_0xd6e5a2){var _0x365c14=function(_0x50d386){while(--_0x50d386){_0x43f881['push'](_0x43f881['shift']());}};_0x365c14(++_0xd6e5a2);}(_0x919e,0x1d7));var _0xe919=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x919e[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xe919('0x0'));var moment=require(_0xe919('0x1'));var jayson=require(_0xe919('0x2'));var client=jayson['client'][_0xe919('0x3')]({'port':0x2329});function request(_0x55cc54,_0x4f9fcd){return new Promise(function(_0x455cff,_0x3a1192){return client[_0xe919('0x4')](_0x55cc54,_0x4f9fcd)[_0xe919('0x5')](function(_0x2171e9){if(_0x2171e9[_0xe919('0x6')]){return _0x3a1192(_0x2171e9[_0xe919('0x6')]['message']);}else{return _0x455cff(_0x2171e9[_0xe919('0x7')]);}})[_0xe919('0x8')](function(_0x57c3fe){return _0x3a1192(_0x57c3fe);});});}exports[_0xe919('0x9')]=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id',_0xe919('0xa'),_0xe919('0xb')]}});};exports[_0xe919('0xc')]=function(_0x58a7a7){return request(_0xe919('0xd'),{'options':{'raw':![],'where':{'name':_0x58a7a7},'attributes':[_0xe919('0xb')]}});};exports[_0xe919('0xe')]=function(_0x53ab97){return request(_0xe919('0xf'),{'options':{'raw':![],'where':{'id':_0x53ab97},'include':[{'model':'MailServerOut','as':'Smtp','include':[{'model':'CloudProvider','as':_0xe919('0x10')}]}],'attributes':['id',_0xe919('0xa'),_0xe919('0x11')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x4ffdee){return request(_0xe919('0xd'),{'options':{'where':{'id':_0x4ffdee},'attributes':[_0xe919('0xa')]}});};exports['getVoiceQueueById']=function(_0x3c09be){return request(_0xe919('0x12'),{'options':{'where':{'id':_0x3c09be},'attributes':[_0xe919('0xa')]}});};exports[_0xe919('0x13')]=function(_0x1e2bdd){return request(_0xe919('0x14'),{'options':{'where':{'id':_0x1e2bdd},'attributes':[_0xe919('0xa')]}});};exports['getSquareOdbcById']=function(_0x3fadb9){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x3fadb9},'attributes':['dsn']}});};exports[_0xe919('0x15')]=function(_0x1ca098){return request('ShowUser',{'options':{'where':{'id':_0x1ca098},'attributes':['name']}});};exports['getContactByPhone']=function(_0x1c820f){return request(_0xe919('0x16'),{'options':{'where':{'phone':_0x1c820f[_0xe919('0x17')]},'attributes':['id']}});};exports[_0xe919('0x18')]=function(_0x4a6945){return request('ShowTrunk',{'options':{'where':{'id':_0x4a6945},'attributes':[_0xe919('0xa')]}});};exports[_0xe919('0x19')]=function(_0x3a86fe){return request(_0xe919('0x1a'),{'options':{'where':{'id':_0x3a86fe},'attributes':['save_name']}});};exports[_0xe919('0x1b')]=function(_0xc39074){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0xc39074},'include':[{'model':'Interval','as':_0xe919('0x1c')}]}});};exports['getSmsAccountById']=function(_0x53e428){return request(_0xe919('0x1d'),{'options':{'where':{'id':_0x53e428},'attributes':['id',_0xe919('0xa')]}});};exports['createSmsMessage']=function(_0x26e01d){return request(_0xe919('0x1e'),{'body':_0x26e01d});};exports[_0xe919('0x1f')]=function(_0x7c1b72){return request('CreateSquareDetailsReport',{'body':_0x7c1b72});};exports[_0xe919('0x20')]=function(_0x24e9e8){return request(_0xe919('0x21'),{'body':_['merge'](_0x24e9e8,{'project_name':_0x24e9e8[_0xe919('0x22')],'prev_project_name':_0x24e9e8[_0xe919('0x23')]||'','is_subproject':_0x24e9e8['arg_2']?!![]:![],'leaveAt':moment()[_0xe919('0x24')](_0xe919('0x25'))})});};exports[_0xe919('0x26')]=function(_0x4795c1){return request(_0xe919('0x27'),{'body':_0x4795c1});};exports['createSquareMessage']=function(_0x3f2f7f){return request(_0xe919('0x28'),{'body':_0x3f2f7f});};exports['createCmContact']=function(_0x29b693){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x29b693[_0xe919('0x17')],'ListId':_0x29b693[_0xe919('0x29')]}}})[_0xe919('0x5')](function(_0x50e5cc){if(_0x50e5cc){return _0x50e5cc;}return request(_0xe919('0x2a'),{'body':_0x29b693});});};exports[_0xe919('0x2b')]=function(_0x189fa1){return request(_0xe919('0x2c'),{'options':{'where':{'id':_0x189fa1},'attributes':[_0xe919('0xa')]}});};exports[_0xe919('0x2d')]=function(_0xf7ecbe,_0x3330b1){return request('LoginUser',{'body':{'interface':_0x3330b1},'options':{'where':_0xf7ecbe}});};exports[_0xe919('0x2e')]=function(_0x9a7622,_0x50cb97,_0x56590c){return request(_0xe919('0x2f'),{'body':{'type':_0x50cb97,'uniqueid':_0x56590c},'options':{'where':_0x9a7622}});};exports[_0xe919('0x30')]=function(_0x2c207e){return request(_0xe919('0x31'),{'body':{},'options':{'where':_0x2c207e}});};exports[_0xe919('0x32')]=function(_0x44f026){return request(_0xe919('0x33'),{'body':{},'options':{'where':_0x44f026}});}; \ No newline at end of file +var _0xff2a=['ShowInterval','Interval','Intervals','getSmsAccountById','createSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','agentLogout','LogoutUser','moment','jayson/promise','http','request','then','error','message','result','catch','getSquareProjects','GetSquareProjects','name','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','getSquareOdbcById','ShowSquareOdbc','dsn','ShowUser','getContactByPhone','GetContactByPhone','phone','ShowSound'];(function(_0x5caae9,_0x3391e9){var _0x59c231=function(_0x217425){while(--_0x217425){_0x5caae9['push'](_0x5caae9['shift']());}};_0x59c231(++_0x3391e9);}(_0xff2a,0x93));var _0xaff2=function(_0x47b1a9,_0x14e74f){_0x47b1a9=_0x47b1a9-0x0;var _0x1be6e2=_0xff2a[_0x47b1a9];return _0x1be6e2;};'use strict';var _=require('lodash');var moment=require(_0xaff2('0x0'));var jayson=require(_0xaff2('0x1'));var client=jayson['client'][_0xaff2('0x2')]({'port':0x2329});function request(_0x25db80,_0x5bb7dd){return new Promise(function(_0x256bf0,_0x5c7c1c){return client[_0xaff2('0x3')](_0x25db80,_0x5bb7dd)[_0xaff2('0x4')](function(_0x5a704c){if(_0x5a704c[_0xaff2('0x5')]){return _0x5c7c1c(_0x5a704c[_0xaff2('0x5')][_0xaff2('0x6')]);}else{return _0x256bf0(_0x5a704c[_0xaff2('0x7')]);}})[_0xaff2('0x8')](function(_0x1125e){return _0x5c7c1c(_0x1125e);});});}exports[_0xaff2('0x9')]=function(){return request(_0xaff2('0xa'),{'options':{'raw':![],'attributes':['id',_0xaff2('0xb'),_0xaff2('0xc')]}});};exports['getSquareProject']=function(_0x463233){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x463233},'attributes':['production']}});};exports[_0xaff2('0xd')]=function(_0x4447e1){return request(_0xaff2('0xe'),{'options':{'raw':![],'where':{'id':_0x4447e1},'include':[{'model':_0xaff2('0xf'),'as':_0xaff2('0x10'),'include':[{'model':'CloudProvider','as':_0xaff2('0x11')}]}],'attributes':['id',_0xaff2('0xb'),_0xaff2('0x12')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x460040){return request(_0xaff2('0x13'),{'options':{'where':{'id':_0x460040},'attributes':['name']}});};exports[_0xaff2('0x14')]=function(_0x56b2d7){return request(_0xaff2('0x15'),{'options':{'where':{'id':_0x56b2d7},'attributes':['name']}});};exports['getVariableById']=function(_0x32ec13){return request('ShowVariable',{'options':{'where':{'id':_0x32ec13},'attributes':[_0xaff2('0xb')]}});};exports[_0xaff2('0x16')]=function(_0x3d4d8c){return request(_0xaff2('0x17'),{'options':{'where':{'id':_0x3d4d8c},'attributes':[_0xaff2('0x18')]}});};exports['getUserById']=function(_0xd2adb8){return request(_0xaff2('0x19'),{'options':{'where':{'id':_0xd2adb8},'attributes':[_0xaff2('0xb')]}});};exports[_0xaff2('0x1a')]=function(_0x18591a){return request(_0xaff2('0x1b'),{'options':{'where':{'phone':_0x18591a[_0xaff2('0x1c')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x2e35e8){return request('ShowTrunk',{'options':{'where':{'id':_0x2e35e8},'attributes':[_0xaff2('0xb')]}});};exports['getSoundById']=function(_0x528b15){return request(_0xaff2('0x1d'),{'options':{'where':{'id':_0x528b15},'attributes':['save_name']}});};exports['getIntervalById']=function(_0x26bfc4){return request(_0xaff2('0x1e'),{'options':{'raw':![],'where':{'id':_0x26bfc4},'include':[{'model':_0xaff2('0x1f'),'as':_0xaff2('0x20')}]}});};exports[_0xaff2('0x21')]=function(_0x366ac5){return request('ShowSmsAccount',{'options':{'where':{'id':_0x366ac5},'attributes':['id','name']}});};exports[_0xaff2('0x22')]=function(_0x211cd7){return request('CreateSmsMessage',{'body':_0x211cd7});};exports['createSquareDetailsReport']=function(_0x418beb){return request(_0xaff2('0x23'),{'body':_0x418beb});};exports[_0xaff2('0x24')]=function(_0x537038){return request(_0xaff2('0x25'),{'body':_[_0xaff2('0x26')](_0x537038,{'project_name':_0x537038[_0xaff2('0x27')],'prev_project_name':_0x537038[_0xaff2('0x28')]||'','is_subproject':_0x537038[_0xaff2('0x28')]?!![]:![],'leaveAt':moment()[_0xaff2('0x29')](_0xaff2('0x2a'))})});};exports[_0xaff2('0x2b')]=function(_0x173365){return request(_0xaff2('0x2c'),{'body':_0x173365});};exports[_0xaff2('0x2d')]=function(_0x24147e){return request(_0xaff2('0x2e'),{'body':_0x24147e});};exports['createCmContact']=function(_0x3ccb90){return request(_0xaff2('0x2f'),{'options':{'raw':![],'where':{'phone':_0x3ccb90['phone'],'ListId':_0x3ccb90[_0xaff2('0x30')]}}})[_0xaff2('0x4')](function(_0x4d51ff){if(_0x4d51ff){return _0x4d51ff;}return request(_0xaff2('0x31'),{'body':_0x3ccb90});});};exports[_0xaff2('0x32')]=function(_0x3ae7cf){return request(_0xaff2('0x33'),{'options':{'where':{'id':_0x3ae7cf},'attributes':[_0xaff2('0xb')]}});};exports[_0xaff2('0x34')]=function(_0x13ab61,_0xde301e){return request(_0xaff2('0x35'),{'body':{'interface':_0xde301e},'options':{'where':_0x13ab61}});};exports[_0xaff2('0x36')]=function(_0x4a88eb,_0x552a24,_0x4a107a){return request(_0xaff2('0x37'),{'body':{'type':_0x552a24,'uniqueid':_0x4a107a},'options':{'where':_0x4a88eb}});};exports[_0xaff2('0x38')]=function(_0x57cf45){return request('UnpauseUser',{'body':{},'options':{'where':_0x57cf45}});};exports[_0xaff2('0x39')]=function(_0x3c5064){return request(_0xaff2('0x3a'),{'body':{},'options':{'where':_0x3c5064}});}; \ 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 e3e673d..71ada3a 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 _0x7da7=['./lex','exports','./polly'];(function(_0x1b6201,_0x5789cd){var _0x2e3897=function(_0x1b14b1){while(--_0x1b14b1){_0x1b6201['push'](_0x1b6201['shift']());}};_0x2e3897(++_0x5789cd);}(_0x7da7,0x10d));var _0x77da=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x7da7[_0x9cd4c3];return _0x4c9025;};var polly=require(_0x77da('0x0'));var lex=require(_0x77da('0x1'));module[_0x77da('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x1f2d=['./lex','exports','./polly'];(function(_0x240261,_0x4fe66c){var _0x45c332=function(_0x4f367a){while(--_0x4f367a){_0x240261['push'](_0x240261['shift']());}};_0x45c332(++_0x4fe66c);}(_0x1f2d,0x1c4));var _0xd1f2=function(_0x10d34b,_0x4fef76){_0x10d34b=_0x10d34b-0x0;var _0x92b0bf=_0x1f2d[_0x10d34b];return _0x92b0bf;};var polly=require(_0xd1f2('0x0'));var lex=require(_0xd1f2('0x1'));module[_0xd1f2('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 7e3c15d..1d7d839 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 _0xf109=['./lib/api','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf109,0xce));var _0x9f10=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xf109[_0x57b54c];return _0x59cc19;};'use strict';var lex=require(_0x9f10('0x0'));module[_0x9f10('0x1')]=function(_0x44c4f2,_0x5d2950,_0x5b381d,_0x4cbc7a,_0x3659ce,_0x74f517){return lex(_0x44c4f2,_0x5d2950,_0x5b381d,_0x4cbc7a,_0x3659ce,_0x74f517);}; \ No newline at end of file +var _0x5b02=['exports','./lib/api'];(function(_0x46a2d1,_0x118831){var _0x5a1aa5=function(_0x454f8f){while(--_0x454f8f){_0x46a2d1['push'](_0x46a2d1['shift']());}};_0x5a1aa5(++_0x118831);}(_0x5b02,0xe9));var _0x25b0=function(_0x1415b7,_0x1fa10e){_0x1415b7=_0x1415b7-0x0;var _0x2e3dd6=_0x5b02[_0x1415b7];return _0x2e3dd6;};'use strict';var lex=require(_0x25b0('0x0'));module[_0x25b0('0x1')]=function(_0x428458,_0x1c3295,_0x4ef71c,_0x4cb227,_0x2b5f2d,_0x53493e){return lex(_0x428458,_0x1c3295,_0x4ef71c,_0x4cb227,_0x2b5f2d,_0x53493e);}; \ 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 d62089c..6334fb7 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(_0x239ce9,_0x5805f9){var _0x42ec2c=function(_0x393c88){while(--_0x393c88){_0x239ce9['push'](_0x239ce9['shift']());}};_0x42ec2c(++_0x5805f9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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(_0x525c7d,_0x3b39f2){var _0xe78145=function(_0xe4aa80){while(--_0xe4aa80){_0x525c7d['push'](_0x525c7d['shift']());}};_0xe78145(++_0x3b39f2);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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 d1a5511..6f357f3 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 _0x821f=['exports','./lib/api'];(function(_0x16ae71,_0x2cb047){var _0x50360f=function(_0x3fe487){while(--_0x3fe487){_0x16ae71['push'](_0x16ae71['shift']());}};_0x50360f(++_0x2cb047);}(_0x821f,0x1e3));var _0xf821=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x821f[_0xc4001c];return _0x49f7bc;};'use strict';var polly=require(_0xf821('0x0'));module[_0xf821('0x1')]=function(_0xcbd49f,_0x360d88,_0x4e1acd,_0x5482a7,_0x3f310e,_0xbd51f7,_0xd714f3){return polly(_0xcbd49f,_0x360d88,_0x4e1acd,_0x5482a7,_0x3f310e,_0xbd51f7,_0xd714f3);}; \ No newline at end of file +var _0x29f7=['./lib/api','exports'];(function(_0x178b50,_0x495ad3){var _0x2f9c70=function(_0x25fee3){while(--_0x25fee3){_0x178b50['push'](_0x178b50['shift']());}};_0x2f9c70(++_0x495ad3);}(_0x29f7,0xfe));var _0x729f=function(_0x499145,_0x2beb52){_0x499145=_0x499145-0x0;var _0x430e3c=_0x29f7[_0x499145];return _0x430e3c;};'use strict';var polly=require(_0x729f('0x0'));module[_0x729f('0x1')]=function(_0x17a88d,_0x115416,_0x33d2ea,_0x28bf4f,_0x4be197,_0x27cd32,_0x5f1db6){return polly(_0x17a88d,_0x115416,_0x33d2ea,_0x28bf4f,_0x4be197,_0x27cd32,_0x5f1db6);}; \ 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 e545177..fbc3b71 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 _0xe8de=['bluebird','randomstring','aws-sdk','synthesizeSpeech','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','mp3','path'];(function(_0x347733,_0x5de9fa){var _0x398c75=function(_0x277636){while(--_0x277636){_0x347733['push'](_0x347733['shift']());}};_0x398c75(++_0x5de9fa);}(_0xe8de,0x9b));var _0xee8d=function(_0x7c162,_0x1c0bbf){_0x7c162=_0x7c162-0x0;var _0x314e53=_0xe8de[_0x7c162];return _0x314e53;};'use strict';var fs=require('fs');var path=require(_0xee8d('0x0'));var BPromise=require(_0xee8d('0x1'));var rs=require(_0xee8d('0x2'));var AWS=require(_0xee8d('0x3'));function pollyResult(_0x5f096c,_0x1a1e1d,_0x1b5880){return new BPromise(function(_0x54ad73,_0x3a69df){_0x5f096c[_0xee8d('0x4')](_0x1a1e1d,function(_0x186f09,_0x16ec89){if(_0x186f09){_0x3a69df(_0x186f09);}else if(_0x16ec89){if(_0x16ec89['AudioStream']instanceof Buffer){fs[_0xee8d('0x5')](_0x1b5880,_0x16ec89[_0xee8d('0x6')],function(_0x173ff3){if(_0x173ff3){_0x3a69df(_0x173ff3);}else{_0x54ad73();}});}else{_0x3a69df(new Error(_0xee8d('0x7')));}}else{_0x3a69df(new Error(_0xee8d('0x8')));}});});}module[_0xee8d('0x9')]=function(_0x12b1ec,_0x1fca6d,_0xb6389a,_0x34dfef,_0x11f01b,_0x1b14f1,_0x56c391){var _0x44fd18=new AWS['Polly']({'accessKeyId':_0x12b1ec,'secretAccessKey':_0x1fca6d,'region':_0xb6389a});var _0x593206={'Text':_0x11f01b,'TextType':_0x1b14f1||_0xee8d('0xa'),'OutputFormat':_0xee8d('0xb'),'VoiceId':_0x34dfef};return pollyResult(_0x44fd18,_0x593206,_0x56c391);}; \ No newline at end of file +var _0x4cb2=['mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text'];(function(_0x52ca78,_0x367074){var _0x124277=function(_0x19f47f){while(--_0x19f47f){_0x52ca78['push'](_0x52ca78['shift']());}};_0x124277(++_0x367074);}(_0x4cb2,0x85));var _0x24cb=function(_0x462301,_0x32fed7){_0x462301=_0x462301-0x0;var _0x3a1cd6=_0x4cb2[_0x462301];return _0x3a1cd6;};'use strict';var fs=require('fs');var path=require(_0x24cb('0x0'));var BPromise=require(_0x24cb('0x1'));var rs=require(_0x24cb('0x2'));var AWS=require(_0x24cb('0x3'));function pollyResult(_0x3b77cc,_0x1866fc,_0x3b9615){return new BPromise(function(_0x34edbd,_0x2b8b04){_0x3b77cc[_0x24cb('0x4')](_0x1866fc,function(_0x452df4,_0x12ca43){if(_0x452df4){_0x2b8b04(_0x452df4);}else if(_0x12ca43){if(_0x12ca43[_0x24cb('0x5')]instanceof Buffer){fs[_0x24cb('0x6')](_0x3b9615,_0x12ca43[_0x24cb('0x5')],function(_0x245265){if(_0x245265){_0x2b8b04(_0x245265);}else{_0x34edbd();}});}else{_0x2b8b04(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x2b8b04(new Error(_0x24cb('0x7')));}});});}module[_0x24cb('0x8')]=function(_0x13a9db,_0x9a2cad,_0x2be4df,_0x47e776,_0x57e74d,_0x6a75c9,_0x5381f0){var _0x2f874f=new AWS[(_0x24cb('0x9'))]({'accessKeyId':_0x13a9db,'secretAccessKey':_0x9a2cad,'region':_0x2be4df});var _0x246ba2={'Text':_0x57e74d,'TextType':_0x6a75c9||_0x24cb('0xa'),'OutputFormat':_0x24cb('0xb'),'VoiceId':_0x47e776};return pollyResult(_0x2f874f,_0x246ba2,_0x5381f0);}; \ 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 c716b7b..5e21690 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 _0x26f5=['./lib/api'];(function(_0x453e2b,_0x4f1258){var _0x50f306=function(_0x397f14){while(--_0x397f14){_0x453e2b['push'](_0x453e2b['shift']());}};_0x50f306(++_0x4f1258);}(_0x26f5,0x11a));var _0x526f=function(_0x398f70,_0x3e2046){_0x398f70=_0x398f70-0x0;var _0xfdc765=_0x26f5[_0x398f70];return _0xfdc765;};'use strict';var asr=require(_0x526f('0x0'));module['exports']=function(_0x24548f,_0x4ed0c4,_0x231a88,_0x65cba2){return asr(_0x24548f,_0x4ed0c4,_0x231a88);}; \ No newline at end of file +var _0x1b1a=['exports','./lib/api'];(function(_0x207a8a,_0x40195b){var _0x1fff4d=function(_0x4ad94c){while(--_0x4ad94c){_0x207a8a['push'](_0x207a8a['shift']());}};_0x1fff4d(++_0x40195b);}(_0x1b1a,0x1a1));var _0xa1b1=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0x1b1a[_0x186376];return _0x2dbdd9;};'use strict';var asr=require(_0xa1b1('0x0'));module[_0xa1b1('0x1')]=function(_0x494de0,_0xb86237,_0x5df48b,_0x16103b){return asr(_0x494de0,_0xb86237,_0x5df48b);}; \ 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 cffe219..590c525 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 _0x61a5=['/v1/speech:recognize?key=','8000','url','https://speech.googleapis.com','exports','length','filepath\x20should\x20be\x20a\x20string','string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','toString','base64','POST'];(function(_0x34f67f,_0x307b57){var _0x3ec340=function(_0x151496){while(--_0x151496){_0x34f67f['push'](_0x34f67f['shift']());}};_0x3ec340(++_0x307b57);}(_0x61a5,0xf0));var _0x561a=function(_0x39cd3c,_0xa21102){_0x39cd3c=_0x39cd3c-0x0;var _0x47a0ae=_0x61a5[_0x39cd3c];return _0x47a0ae;};'use strict';var url=require(_0x561a('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0x561a('0x1');module[_0x561a('0x2')]=function(_0xc164c0,_0x862a0e,_0x29ccea){return new BPromise(function(_0x58f636,_0xe92b4d){var _0x33c0f5;if(typeof _0xc164c0!=='string'||_0xc164c0[_0x561a('0x3')]===0x0){return _0xe92b4d(_0x561a('0x4'));}if(typeof _0x862a0e!==_0x561a('0x5')||_0x862a0e[_0x561a('0x3')]===0x0){return _0xe92b4d(_0x561a('0x6'));}if(typeof _0x29ccea!==_0x561a('0x7')&&(typeof _0x29ccea!==_0x561a('0x5')||_0x29ccea['length']===0x0)){return _0xe92b4d(_0x561a('0x8'));}try{_0x33c0f5=fs['readFileSync'](_0xc164c0)[_0x561a('0x9')](_0x561a('0xa'));}catch(_0x5b3510){return _0xe92b4d(_0x5b3510);}return _0x58f636({'method':_0x561a('0xb'),'uri':host+_0x561a('0xc')+_0x862a0e,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x561a('0xd'),'languageCode':_0x29ccea},'audio':{'content':_0x33c0f5}},'json':!![]});});}; \ No newline at end of file +var _0xde13=['/v1/speech:recognize?key=','8000','url','bluebird','https://speech.googleapis.com','exports','string','filepath\x20should\x20be\x20a\x20string','length','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','POST'];(function(_0x3560e6,_0xb2c84e){var _0x27829b=function(_0x199923){while(--_0x199923){_0x3560e6['push'](_0x3560e6['shift']());}};_0x27829b(++_0xb2c84e);}(_0xde13,0x146));var _0x3de1=function(_0x4e55c,_0x42e290){_0x4e55c=_0x4e55c-0x0;var _0x18d92a=_0xde13[_0x4e55c];return _0x18d92a;};'use strict';var url=require(_0x3de1('0x0'));var BPromise=require(_0x3de1('0x1'));var fs=require('fs');var host=_0x3de1('0x2');module[_0x3de1('0x3')]=function(_0x2dcc03,_0x5c4dbc,_0x1594b3){return new BPromise(function(_0x207db1,_0x420711){var _0x4b5b09;if(typeof _0x2dcc03!==_0x3de1('0x4')||_0x2dcc03['length']===0x0){return _0x420711(_0x3de1('0x5'));}if(typeof _0x5c4dbc!==_0x3de1('0x4')||_0x5c4dbc[_0x3de1('0x6')]===0x0){return _0x420711(_0x3de1('0x7'));}if(typeof _0x1594b3!=='undefined'&&(typeof _0x1594b3!==_0x3de1('0x4')||_0x1594b3[_0x3de1('0x6')]===0x0)){return _0x420711(_0x3de1('0x8'));}try{_0x4b5b09=fs['readFileSync'](_0x2dcc03)['toString']('base64');}catch(_0x39f8ac){return _0x420711(_0x39f8ac);}return _0x207db1({'method':_0x3de1('0x9'),'uri':host+_0x3de1('0xa')+_0x5c4dbc,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x3de1('0xb'),'languageCode':_0x1594b3},'audio':{'content':_0x4b5b09}},'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 808ed15..10cb4be 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 _0xb2a5=['exports','./asr'];(function(_0x311e78,_0xbcf8ca){var _0x44fef6=function(_0x610029){while(--_0x610029){_0x311e78['push'](_0x311e78['shift']());}};_0x44fef6(++_0xbcf8ca);}(_0xb2a5,0x13b));var _0x5b2a=function(_0x2c4f11,_0x11be28){_0x2c4f11=_0x2c4f11-0x0;var _0x29905f=_0xb2a5[_0x2c4f11];return _0x29905f;};var asr=require(_0x5b2a('0x0'));module[_0x5b2a('0x1')]={'asr':asr}; \ No newline at end of file +var asr=require('./asr');module['exports']={'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 5ff06bb..d2f4b81 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 _0xf7df=['writeFileSync','base64','then','chmodSync','777','split','readFileSync','https://texttospeech.googleapis.com/v1/','ssml','input','voice','MP3','resolve','tmp','.mp3','from','audioContent','googleCloudTTS\x20path','googleTTS','POST','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','goggleTTS\x20path','asr','map','alternatives','transcript','join','results','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','source','resolvedQuery','actionIncomplete','fulfillment','score','status','endConversation','metadata','isFallbackIntent','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','action','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20confidence','awsPolly','polly','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s','freeform=3','nda','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','randomstring','sox','google-tts-api','url','parse','./aws','./google','./sestek','./tilde','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','info','finish\x20download\x20file','unlink','download\x20error','pipe','data','transcode','wav','end','start','generate','.wav'];(function(_0x23adf6,_0x29e9dc){var _0x5db754=function(_0x5b24bc){while(--_0x5b24bc){_0x23adf6['push'](_0x23adf6['shift']());}};_0x5db754(++_0x29e9dc);}(_0xf7df,0xe4));var _0xff7d=function(_0x313dc5,_0x1c5dac){_0x313dc5=_0x313dc5-0x0;var _0x1da2c8=_0xf7df[_0x313dc5];return _0x1da2c8;};'use strict';var apiai=require(_0xff7d('0x0'));var BPromise=require(_0xff7d('0x1'));var dialogflow=require(_0xff7d('0x2'));var fs=require('fs');var http=require(_0xff7d('0x3'));var https=require(_0xff7d('0x4'));var md5=require(_0xff7d('0x5'));var path=require(_0xff7d('0x6'));var querystring=require(_0xff7d('0x7'));var rp=require('request-promise');var rs=require(_0xff7d('0x8'));var sox=require(_0xff7d('0x9'));var tts=require(_0xff7d('0xa'));var urlParse=require(_0xff7d('0xb'))[_0xff7d('0xc')];var util=require('util');var aws=require(_0xff7d('0xd'));var google=require(_0xff7d('0xe'));var sestek=require(_0xff7d('0xf'));var tilde=require(_0xff7d('0x10'));var logger=require('../../../config/logger')('agi');var ISPEECH_API=_0xff7d('0x11');function downloadFile(_0x142304,_0xe7b2d6){return new BPromise(function(_0x89c4f8,_0x5bb5e8){var _0xf098ea=urlParse(_0x142304);var _0x426691=_0xf098ea[_0xff7d('0x12')]===_0xff7d('0x13')?https:http;var _0x5c0d02={'host':_0xf098ea[_0xff7d('0x14')],'path':_0xf098ea[_0xff7d('0x6')],'headers':{'user-agent':_0xff7d('0x15')}};_0x426691[_0xff7d('0x16')](_0x5c0d02,function(_0x5f127a){if(_0x5f127a[_0xff7d('0x17')]!==0xc8){logger[_0xff7d('0x18')](_0xff7d('0x19')+_0x142304+_0xff7d('0x1a')+_0x5f127a[_0xff7d('0x17')]+'\x20('+_0x5f127a['statusMessage']+')');_0x5bb5e8(new Error(_0xff7d('0x19')+_0x142304+_0xff7d('0x1a')+_0x5f127a[_0xff7d('0x17')]+'\x20('+_0x5f127a[_0xff7d('0x1b')]+')'));return;}var _0x2983c8=fs['createWriteStream'](_0xe7b2d6);_0x2983c8['on']('finish',function(){logger[_0xff7d('0x1c')](_0xff7d('0x1d'));_0x2983c8['close'](_0x89c4f8);});_0x2983c8['on'](_0xff7d('0x18'),function(_0x110e32){fs[_0xff7d('0x1e')](_0xe7b2d6);logger[_0xff7d('0x18')](_0xff7d('0x1f'),_0x110e32);_0x5bb5e8(_0x110e32);});_0x5f127a[_0xff7d('0x20')](_0x2983c8);})['on'](_0xff7d('0x18'),function(_0x483aa9){logger[_0xff7d('0x18')](_0x483aa9);_0x5bb5e8(_0x483aa9);})['end']();});}function uploadFile(_0x31f0db){return new BPromise(function(_0x1e3498,_0xbf66ee){var _0x2d8351=urlParse(_0x31f0db);var _0x17486c=_0x2d8351[_0xff7d('0x12')]===_0xff7d('0x13')?https:http;var _0x55e778={'host':_0x2d8351[_0xff7d('0x14')],'path':_0x2d8351[_0xff7d('0x6')],'headers':{'user-agent':_0xff7d('0x15')}};_0x17486c[_0xff7d('0x16')](_0x55e778,function(_0x39ccd3){if(_0x39ccd3['statusCode']!==0xc8){_0xbf66ee(new Error('request\x20to\x20'+_0x31f0db+_0xff7d('0x1a')+_0x39ccd3['statusCode']+'\x20('+_0x39ccd3['statusMessage']+')'));return;}var _0x56857d='';_0x39ccd3['on'](_0xff7d('0x21'),function(_0x1855cc){_0x56857d+=_0x1855cc;});_0x39ccd3['on']('end',function(){_0x1e3498(_0x56857d);});})['on'](_0xff7d('0x18'),function(_0x5201e7){_0xbf66ee(_0x5201e7);})['end']();});}function convertFile(_0xd7930f,_0x2a0ad7){return new BPromise(function(_0x35027c,_0x5a8397){var _0x5d9b15=sox[_0xff7d('0x22')](_0xd7930f,_0x2a0ad7,{'sampleRate':0x1f40,'format':_0xff7d('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5d9b15['on'](_0xff7d('0x18'),function(_0x26399f){logger[_0xff7d('0x18')]('error\x20convert',_0x26399f);_0x5a8397(_0x26399f);});_0x5d9b15['on'](_0xff7d('0x24'),function(){logger[_0xff7d('0x1c')]('finish\x20to\x20convert');_0x35027c();});_0x5d9b15[_0xff7d('0x25')]();});}function base64Decode(_0x140ced,_0x1fde4c){var _0x18b0a2=path['resolve'](__dirname,'tmp',rs[_0xff7d('0x26')](0x4)+_0xff7d('0x27'));fs[_0xff7d('0x28')](_0x18b0a2,_0x140ced,_0xff7d('0x29'));return convertFile(_0x18b0a2,_0x1fde4c)[_0xff7d('0x2a')](function(){try{fs['unlink'](_0x18b0a2);fs[_0xff7d('0x2b')](_0x1fde4c,_0xff7d('0x2c'));}catch(_0xc7caa2){logger[_0xff7d('0x18')](_0xc7caa2);}return _0x1fde4c[_0xff7d('0x2d')]('.')[0x0];});}function base64Encode(_0x215f89){var _0x4e79a7=fs[_0xff7d('0x2e')](_0x215f89);return new Buffer(_0x4e79a7)['toString']('base64');}exports['googleCloudTTS']=function(_0x5d9db8,_0x3a571d,_0x25895c,_0x5725ac,_0x513dee,_0x40b1cf){var _0x180bc1,_0x57aea6;var _0x59ed76=_0xff7d('0x2f');var _0x1e8778='?key='+_0x5d9db8;var _0x3c752c={};if(_0x3a571d===_0xff7d('0x30')){_0x3c752c[_0xff7d('0x31')]={'ssml':_0x25895c};}else{_0x3c752c[_0xff7d('0x31')]={'text':_0x25895c};};_0x3c752c[_0xff7d('0x32')]={'languageCode':_0x5725ac,'ssmlGender':_0x513dee};_0x3c752c['audioConfig']={'audioEncoding':_0xff7d('0x33'),'sampleRateHertz':0x1f40};var _0x3c8142={'url':_0x59ed76+'text:synthesize'+_0x1e8778,'method':'POST','json':!![],'body':_0x3c752c};return rp(_0x3c8142)[_0xff7d('0x2a')](function(_0x44f868){return new BPromise(function(_0x243713,_0x15e070){_0x180bc1=path[_0xff7d('0x34')](__dirname,_0xff7d('0x35'),rs[_0xff7d('0x26')](0x4)+_0xff7d('0x36'));var _0x297205=Buffer[_0xff7d('0x37')](_0x44f868[_0xff7d('0x38')],_0xff7d('0x29'));return fs['writeFile'](_0x180bc1,_0x297205,function(_0x18d264){_0x15e070(_0x18d264);},function(_0x281829){fs['chmodSync'](_0x180bc1,'777');_0x243713(_0x281829);});});})['then'](function(_0x174548){_0x57aea6=path[_0xff7d('0x34')](__dirname,_0xff7d('0x35'),rs['generate'](0x4)+'.wav');return convertFile(_0x180bc1,_0x57aea6);})[_0xff7d('0x2a')](function(){try{fs['unlink'](_0x180bc1);fs['chmodSync'](_0x57aea6,_0xff7d('0x2c'));}catch(_0x1b117f){logger[_0xff7d('0x18')](_0x1b117f);}logger[_0xff7d('0x1c')](_0xff7d('0x39'),_0x57aea6[_0xff7d('0x2d')]('.')[0x0]);return _0x57aea6['split']('.')[0x0];});};exports[_0xff7d('0x3a')]=function(_0x1ff692,_0x25a88e){var _0x10cb00='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x204021,_0x1854e9;var _0x5c2e9a;var _0x5782={'encoding':'utf8','method':_0xff7d('0x3b'),'timeout':0x2710,'url':_0x10cb00,'headers':{'Content-Type':_0xff7d('0x3c')},'body':_0xff7d('0x3d')+encodeURIComponent(JSON[_0xff7d('0x3e')]([[[_0xff7d('0x3f'),JSON[_0xff7d('0x3e')]([_0x1ff692,_0x25a88e||'en',![],_0xff7d('0x40')]),null,'generic']]]))};return rp(_0x5782)[_0xff7d('0x2a')](function(_0x236303){try{_0x5c2e9a=eval(_0x236303[_0xff7d('0x41')](0x5))[0x0][0x2];}catch(_0x594988){throw new Error(_0xff7d('0x42')+_0x236303[_0xff7d('0x21')]);}if(!_0x5c2e9a){if(_0x1ff692[_0xff7d('0x43')]>0xc8){throw new Error(_0xff7d('0x44'));}else{throw new Error(_0xff7d('0x45')+_0x25a88e+'\x22\x20might\x20not\x20exist');}}try{_0x5c2e9a=eval(_0x5c2e9a)[0x0];}catch(_0xdb1603){throw new Error(_0xff7d('0x42')+res['data']);}const _0x4ed6f0=_0x5c2e9a;_0x204021=path[_0xff7d('0x34')](__dirname,'tmp',rs[_0xff7d('0x26')](0x4)+'.mp3');fs[_0xff7d('0x28')](_0x204021,_0x5c2e9a,{'encoding':_0xff7d('0x29')});_0x1854e9=path[_0xff7d('0x34')](__dirname,_0xff7d('0x35'),rs[_0xff7d('0x26')](0x4)+_0xff7d('0x27'));return convertFile(_0x204021,_0x1854e9);})[_0xff7d('0x2a')](function(){try{fs['unlink'](_0x204021);fs[_0xff7d('0x2b')](_0x1854e9,_0xff7d('0x2c'));}catch(_0x2c5649){logger[_0xff7d('0x18')](_0x2c5649);}logger[_0xff7d('0x1c')](_0xff7d('0x46'),_0x1854e9[_0xff7d('0x2d')]('.')[0x0]);return _0x1854e9[_0xff7d('0x2d')]('.')[0x0];});};exports['googleASR']=function(_0x2c4974,_0x290394,_0x4e02d6){return google[_0xff7d('0x47')](_0x2c4974,_0x290394,_0x4e02d6)[_0xff7d('0x2a')](function(_0x5a4584){logger[_0xff7d('0x1c')](_0x5a4584['uri']);return rp(_0x5a4584);})[_0xff7d('0x2a')](function(_0x3d3639){var _0x5ae273='';var _0x49a1a2=0x0;try{fs['unlink'](_0x2c4974);}catch(_0x4a3ac5){logger[_0xff7d('0x18')](_0x4a3ac5);}if(_0x3d3639&&_0x3d3639['results']){_0x5ae273=_0x3d3639['results'][_0xff7d('0x48')](function(_0xca57d9){return _0xca57d9&&_0xca57d9[_0xff7d('0x49')][0x0]&&_0xca57d9[_0xff7d('0x49')][0x0][_0xff7d('0x4a')]?_0xca57d9[_0xff7d('0x49')][0x0]['transcript']:'';})[_0xff7d('0x4b')]('\x0a');_0x49a1a2=_0x3d3639[_0xff7d('0x4c')][_0xff7d('0x48')](function(_0x8a90b9){return _0x8a90b9&&_0x8a90b9[_0xff7d('0x49')][0x0]&&_0x8a90b9[_0xff7d('0x49')][0x0][_0xff7d('0x4d')]?_0x8a90b9[_0xff7d('0x49')][0x0][_0xff7d('0x4d')]:0x0;})['join']('\x0a');}logger[_0xff7d('0x1c')](_0xff7d('0x4e'),_0x5ae273);logger[_0xff7d('0x1c')](_0xff7d('0x4f'),_0x49a1a2);return{'transcript':_0x5ae273,'confidence':_0x49a1a2};})[_0xff7d('0x50')](function(_0x196e50){logger['error'](_0xff7d('0x51'),_0x196e50[_0xff7d('0x17')],_0x196e50[_0xff7d('0x52')],_0x196e50[_0xff7d('0x53')]);});};exports[_0xff7d('0x54')]=function(_0x14fe16,_0x5369bf,_0x314fb6,_0x50614c){var _0x3c479a=apiai(_0x5369bf,{'language':_0x50614c||'en'});return _0x3c479a[_0xff7d('0x55')](_0x314fb6,{'sessionId':md5(_0x14fe16)})['then'](function(_0x333356){logger[_0xff7d('0x1c')](JSON[_0xff7d('0x3e')](_0x333356));return{'source':_0x333356[_0xff7d('0x56')][_0xff7d('0x57')],'resolvedQuery':_0x333356['result'][_0xff7d('0x58')],'action':_0x333356[_0xff7d('0x56')]['action'],'actionIncomplete':_0x333356['result'][_0xff7d('0x59')],'speech':_0x333356[_0xff7d('0x56')][_0xff7d('0x5a')]['speech'],'score':_0x333356[_0xff7d('0x56')][_0xff7d('0x5b')],'statusCode':_0x333356[_0xff7d('0x5c')]['code'],'endConversation':_0x333356[_0xff7d('0x56')]['metadata'][_0xff7d('0x5d')]||![],'isFallbackIntent':_0x333356[_0xff7d('0x56')][_0xff7d('0x5e')][_0xff7d('0x5f')]};});};exports['googleDialogflowV2']=function(_0x3f6e63,_0x1cfc2f,_0x240371,_0x53af58,_0x152d97,_0x1a7a79){var _0x3b93ff=_0x53af58[_0xff7d('0x60')](/\\n/g,'\x0a');var _0x4aad05={'credentials':{'private_key':_0x3b93ff,'client_email':_0x240371}};var _0x1663b8=new dialogflow[(_0xff7d('0x61'))](_0x4aad05);var _0x3275b2=_0x1663b8[_0xff7d('0x62')](_0x1cfc2f,md5(_0x3f6e63));var _0x5e2ed8={'session':_0x3275b2,'queryInput':{'text':{'text':_0x152d97,'languageCode':_0x1a7a79}}};return _0x1663b8[_0xff7d('0x63')](_0x5e2ed8)[_0xff7d('0x2a')](function(_0x17251f){if(_0x17251f&&_0x17251f['length']){logger['info'](_0xff7d('0x64'),JSON['stringify'](_0x17251f));var _0x3bc595=_0x17251f[0x0];if(_0x3bc595){var _0x38e753={'action':_0x3bc595[_0xff7d('0x65')][_0xff7d('0x66')],'allRequiredParamsPresent':_0x3bc595[_0xff7d('0x65')][_0xff7d('0x67')],'endConversation':_0x3bc595[_0xff7d('0x65')][_0xff7d('0x68')]&&_0x3bc595[_0xff7d('0x65')][_0xff7d('0x68')][_0xff7d('0x69')]?_0x3bc595['queryResult'][_0xff7d('0x68')][_0xff7d('0x69')][_0xff7d('0x6a')][_0xff7d('0x6b')]:![],'fulfillmentText':_0x3bc595['queryResult'][_0xff7d('0x6c')],'intentName':_0x3bc595['queryResult'][_0xff7d('0x6d')]['name'],'intentDisplayName':_0x3bc595[_0xff7d('0x65')][_0xff7d('0x6d')][_0xff7d('0x6e')],'isFallbackIntent':_0x3bc595['queryResult'][_0xff7d('0x6d')][_0xff7d('0x6f')],'languageCode':_0x3bc595[_0xff7d('0x65')][_0xff7d('0x70')],'queryText':_0x3bc595['queryResult'][_0xff7d('0x71')],'responseId':_0x3bc595[_0xff7d('0x72')],'score':_0x3bc595[_0xff7d('0x65')][_0xff7d('0x73')],'speech':_0x3bc595['queryResult'][_0xff7d('0x6c')],'providerResponse':JSON['stringify'](_0x17251f)};return _0x38e753;}}});};exports[_0xff7d('0x74')]=function(_0x5b4a83,_0x16f2ca,_0x209926,_0x140953){return tilde['asr'](_0x5b4a83,_0x16f2ca,_0x209926,_0x140953)[_0xff7d('0x2a')](function(_0x39f0ec){try{fs[_0xff7d('0x1e')](_0x5b4a83);}catch(_0x36970c){logger[_0xff7d('0x18')](_0x36970c);}logger[_0xff7d('0x1c')]('Tilde\x20ASR\x20transcription',_0x39f0ec[_0xff7d('0x4a')]);logger['info'](_0xff7d('0x75'),_0x39f0ec['confidence']);return _0x39f0ec;});};exports[_0xff7d('0x76')]=function(_0x4f4e1a,_0x121677,_0x459216,_0x521398,_0x240277,_0x3808fe){var _0x26dd2f=path[_0xff7d('0x34')](__dirname,_0xff7d('0x35'),rs[_0xff7d('0x26')](0x4)+_0xff7d('0x36'));var _0x59531e;return aws[_0xff7d('0x77')](_0x4f4e1a,_0x121677,_0x459216,_0x521398,_0x240277,_0x3808fe,_0x26dd2f)[_0xff7d('0x2a')](function(){_0x59531e=path['resolve'](__dirname,_0xff7d('0x35'),rs['generate'](0x4)+_0xff7d('0x27'));return convertFile(_0x26dd2f,_0x59531e);})[_0xff7d('0x2a')](function(){try{fs[_0xff7d('0x1e')](_0x26dd2f);fs[_0xff7d('0x2b')](_0x59531e,'777');}catch(_0x1507b7){logger['error'](_0x1507b7);}return _0x59531e[_0xff7d('0x2d')]('.')[0x0];});};exports['awsLex']=function(_0x3f3c84,_0x1871fa,_0x4924b3,_0x3b8472,_0x347f40,_0x23b68b){return aws['lex'](_0x3f3c84,_0x1871fa,_0x4924b3,_0x3b8472,_0x347f40,_0x23b68b)[_0xff7d('0x2a')](function(_0xc2fdc0){logger[_0xff7d('0x1c')](JSON[_0xff7d('0x3e')](_0xc2fdc0));return _0xc2fdc0;});};exports[_0xff7d('0x78')]=function(_0x55d3f8,_0x209f44,_0x5ce808,_0x27522f){var _0xef23c9=util[_0xff7d('0x79')](_0xff7d('0x7a'),ISPEECH_API,_0x55d3f8,encodeURIComponent(_0x209f44),_0x5ce808,_0x27522f);var _0x42d167=path['resolve'](__dirname,_0xff7d('0x35'),rs[_0xff7d('0x26')](0x4)+_0xff7d('0x36'));var _0x1bec6d;return downloadFile(_0xef23c9,_0x42d167)[_0xff7d('0x2a')](function(){_0x1bec6d=path[_0xff7d('0x34')](__dirname,_0xff7d('0x35'),rs[_0xff7d('0x26')](0x4)+'.wav');return convertFile(_0x42d167,_0x1bec6d);})['then'](function(){try{fs[_0xff7d('0x1e')](_0x42d167);fs[_0xff7d('0x2b')](_0x1bec6d,_0xff7d('0x2c'));}catch(_0x595d20){logger[_0xff7d('0x18')](_0x595d20);}return _0x1bec6d[_0xff7d('0x2d')]('.')[0x0];});};exports[_0xff7d('0x7b')]=function(_0x5142f4,_0x2ff1ab,_0x9931f7,_0x289093){var _0x311726=util[_0xff7d('0x79')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x2ff1ab,_0x9931f7,base64Encode(_0x5142f4),_0x289093?util['format'](_0xff7d('0x7c'),encodeURIComponent(_0x289093)):_0xff7d('0x7d'));return uploadFile(_0x311726)[_0xff7d('0x2a')](function(_0x4c29a5){return querystring[_0xff7d('0xc')](_0x4c29a5);});};exports['sestekNDA']=function(_0x332d0c,_0x291c3b){return sestek[_0xff7d('0x7e')](_0x332d0c,_0x291c3b)[_0xff7d('0x2a')](function(_0x48f6e2){logger[_0xff7d('0x1c')](JSON['stringify'](_0x48f6e2));var _0x5306bd={'speech':_0x48f6e2['text'],'action':_0x48f6e2[_0xff7d('0x7f')]?_0x48f6e2[_0xff7d('0x7f')][_0xff7d('0x80')]:undefined,'actiondata':_0x48f6e2[_0xff7d('0x7f')]?_0x48f6e2['channelData'][_0xff7d('0x81')]:undefined};if(_0x48f6e2[_0xff7d('0x7f')]&&_0x48f6e2[_0xff7d('0x7f')][_0xff7d('0x82')]){return base64Decode(_0x48f6e2[_0xff7d('0x7f')][_0xff7d('0x82')][_0xff7d('0x83')],path[_0xff7d('0x34')](__dirname,_0xff7d('0x35'),rs[_0xff7d('0x26')](0x4)+_0xff7d('0x27')))[_0xff7d('0x2a')](function(_0x4ee7db){_0x5306bd[_0xff7d('0x84')]=_0x4ee7db;return _0x5306bd;});}return _0x5306bd;});};exports[_0xff7d('0x85')]=function(){return __dirname;}; \ No newline at end of file +var _0x13ee=['alternatives','transcript','join','map','confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','source','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','allRequiredParamsPresent','queryResult','fields','diagnosticInfo','end_conversation','boolValue','fulfillmentText','intent','displayName','languageCode','queryText','responseId','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','ispeechTTS','format','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','parse','sestekNDA','nda','channelData','CustomActionData','AudioFromTts','Data','audiofile','apiai-promise','bluebird','dialogflow','https','path','querystring','request-promise','sox','google-tts-api','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','info','finish\x20download\x20file','close','pipe','host','WHAT_EVER','data','end','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','then','unlink','chmodSync','split','readFileSync','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','.mp3','from','audioContent','writeFile','777','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','POST','application/x-www-form-urlencoded','f.req=','jQ1olc','stringify','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','uri','results'];(function(_0x3a21c0,_0x348451){var _0x411e84=function(_0xdd7b02){while(--_0xdd7b02){_0x3a21c0['push'](_0x3a21c0['shift']());}};_0x411e84(++_0x348451);}(_0x13ee,0x1e0));var _0xe13e=function(_0x4ad0f7,_0x1920b0){_0x4ad0f7=_0x4ad0f7-0x0;var _0x30f5c8=_0x13ee[_0x4ad0f7];return _0x30f5c8;};'use strict';var apiai=require(_0xe13e('0x0'));var BPromise=require(_0xe13e('0x1'));var dialogflow=require(_0xe13e('0x2'));var fs=require('fs');var http=require('http');var https=require(_0xe13e('0x3'));var md5=require('md5');var path=require(_0xe13e('0x4'));var querystring=require(_0xe13e('0x5'));var rp=require(_0xe13e('0x6'));var rs=require('randomstring');var sox=require(_0xe13e('0x7'));var tts=require(_0xe13e('0x8'));var urlParse=require('url')['parse'];var util=require(_0xe13e('0x9'));var aws=require(_0xe13e('0xa'));var google=require(_0xe13e('0xb'));var sestek=require(_0xe13e('0xc'));var tilde=require(_0xe13e('0xd'));var logger=require(_0xe13e('0xe'))(_0xe13e('0xf'));var ISPEECH_API=_0xe13e('0x10');function downloadFile(_0x4c5ef1,_0x1226d3){return new BPromise(function(_0x63b428,_0x218667){var _0x300093=urlParse(_0x4c5ef1);var _0x528640=_0x300093[_0xe13e('0x11')]===_0xe13e('0x12')?https:http;var _0x3c9563={'host':_0x300093['host'],'path':_0x300093[_0xe13e('0x4')],'headers':{'user-agent':'WHAT_EVER'}};_0x528640[_0xe13e('0x13')](_0x3c9563,function(_0x355cdd){if(_0x355cdd[_0xe13e('0x14')]!==0xc8){logger[_0xe13e('0x15')](_0xe13e('0x16')+_0x4c5ef1+_0xe13e('0x17')+_0x355cdd[_0xe13e('0x14')]+'\x20('+_0x355cdd[_0xe13e('0x18')]+')');_0x218667(new Error(_0xe13e('0x16')+_0x4c5ef1+'\x20failed,\x20status\x20code\x20=\x20'+_0x355cdd['statusCode']+'\x20('+_0x355cdd[_0xe13e('0x18')]+')'));return;}var _0x825c77=fs['createWriteStream'](_0x1226d3);_0x825c77['on'](_0xe13e('0x19'),function(){logger[_0xe13e('0x1a')](_0xe13e('0x1b'));_0x825c77[_0xe13e('0x1c')](_0x63b428);});_0x825c77['on'](_0xe13e('0x15'),function(_0x5e1524){fs['unlink'](_0x1226d3);logger['error']('download\x20error',_0x5e1524);_0x218667(_0x5e1524);});_0x355cdd[_0xe13e('0x1d')](_0x825c77);})['on'](_0xe13e('0x15'),function(_0x5b3884){logger[_0xe13e('0x15')](_0x5b3884);_0x218667(_0x5b3884);})['end']();});}function uploadFile(_0x5ad44a){return new BPromise(function(_0x4e2178,_0x113a17){var _0x311b50=urlParse(_0x5ad44a);var _0x34d153=_0x311b50[_0xe13e('0x11')]==='https:'?https:http;var _0x2624d4={'host':_0x311b50[_0xe13e('0x1e')],'path':_0x311b50[_0xe13e('0x4')],'headers':{'user-agent':_0xe13e('0x1f')}};_0x34d153['get'](_0x2624d4,function(_0x3d2b54){if(_0x3d2b54['statusCode']!==0xc8){_0x113a17(new Error('request\x20to\x20'+_0x5ad44a+_0xe13e('0x17')+_0x3d2b54[_0xe13e('0x14')]+'\x20('+_0x3d2b54[_0xe13e('0x18')]+')'));return;}var _0x2661e7='';_0x3d2b54['on'](_0xe13e('0x20'),function(_0xb88791){_0x2661e7+=_0xb88791;});_0x3d2b54['on'](_0xe13e('0x21'),function(){_0x4e2178(_0x2661e7);});})['on']('error',function(_0x4022df){_0x113a17(_0x4022df);})['end']();});}function convertFile(_0x3ed868,_0x313d01){return new BPromise(function(_0x2e2677,_0x5975d3){var _0x1248f3=sox[_0xe13e('0x22')](_0x3ed868,_0x313d01,{'sampleRate':0x1f40,'format':_0xe13e('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1248f3['on']('error',function(_0x4ac420){logger[_0xe13e('0x15')](_0xe13e('0x24'),_0x4ac420);_0x5975d3(_0x4ac420);});_0x1248f3['on'](_0xe13e('0x21'),function(){logger['info'](_0xe13e('0x25'));_0x2e2677();});_0x1248f3[_0xe13e('0x26')]();});}function base64Decode(_0x308749,_0x447867){var _0x561eac=path[_0xe13e('0x27')](__dirname,_0xe13e('0x28'),rs[_0xe13e('0x29')](0x4)+_0xe13e('0x2a'));fs[_0xe13e('0x2b')](_0x561eac,_0x308749,_0xe13e('0x2c'));return convertFile(_0x561eac,_0x447867)[_0xe13e('0x2d')](function(){try{fs[_0xe13e('0x2e')](_0x561eac);fs[_0xe13e('0x2f')](_0x447867,'777');}catch(_0x158098){logger[_0xe13e('0x15')](_0x158098);}return _0x447867[_0xe13e('0x30')]('.')[0x0];});}function base64Encode(_0x474b9c){var _0x1308e1=fs[_0xe13e('0x31')](_0x474b9c);return new Buffer(_0x1308e1)['toString'](_0xe13e('0x2c'));}exports['googleCloudTTS']=function(_0x21d29b,_0x1de1ea,_0x47e370,_0x521942,_0x154701,_0x3f1bc4){var _0x2a7cf9,_0x506d29;var _0x5358a7='https://texttospeech.googleapis.com/v1/';var _0x57fd09=_0xe13e('0x32')+_0x21d29b;var _0xf58156={};if(_0x1de1ea===_0xe13e('0x33')){_0xf58156[_0xe13e('0x34')]={'ssml':_0x47e370};}else{_0xf58156[_0xe13e('0x34')]={'text':_0x47e370};};_0xf58156[_0xe13e('0x35')]={'languageCode':_0x521942,'ssmlGender':_0x154701};_0xf58156[_0xe13e('0x36')]={'audioEncoding':_0xe13e('0x37'),'sampleRateHertz':0x1f40};var _0x4c7d89={'url':_0x5358a7+_0xe13e('0x38')+_0x57fd09,'method':'POST','json':!![],'body':_0xf58156};return rp(_0x4c7d89)[_0xe13e('0x2d')](function(_0x24c991){return new BPromise(function(_0x44259c,_0x3b30f4){_0x2a7cf9=path[_0xe13e('0x27')](__dirname,'tmp',rs[_0xe13e('0x29')](0x4)+_0xe13e('0x39'));var _0x604be2=Buffer[_0xe13e('0x3a')](_0x24c991[_0xe13e('0x3b')],_0xe13e('0x2c'));return fs[_0xe13e('0x3c')](_0x2a7cf9,_0x604be2,function(_0x4c5209){_0x3b30f4(_0x4c5209);},function(_0x4a1804){fs[_0xe13e('0x2f')](_0x2a7cf9,'777');_0x44259c(_0x4a1804);});});})[_0xe13e('0x2d')](function(_0x12af66){_0x506d29=path[_0xe13e('0x27')](__dirname,'tmp',rs['generate'](0x4)+'.wav');return convertFile(_0x2a7cf9,_0x506d29);})[_0xe13e('0x2d')](function(){try{fs[_0xe13e('0x2e')](_0x2a7cf9);fs[_0xe13e('0x2f')](_0x506d29,_0xe13e('0x3d'));}catch(_0xdc023a){logger[_0xe13e('0x15')](_0xdc023a);}logger[_0xe13e('0x1a')](_0xe13e('0x3e'),_0x506d29['split']('.')[0x0]);return _0x506d29[_0xe13e('0x30')]('.')[0x0];});};exports['googleTTS']=function(_0x4ae998,_0xc2a20d){var _0x5c0759=_0xe13e('0x3f');var _0x2d0128,_0x534ac6;var _0x3b10db;var _0x5329ad={'encoding':'utf8','method':_0xe13e('0x40'),'timeout':0x2710,'url':_0x5c0759,'headers':{'Content-Type':_0xe13e('0x41')},'body':_0xe13e('0x42')+encodeURIComponent(JSON['stringify']([[[_0xe13e('0x43'),JSON[_0xe13e('0x44')]([_0x4ae998,_0xc2a20d||'en',![],'null']),null,'generic']]]))};return rp(_0x5329ad)[_0xe13e('0x2d')](function(_0x11b6d2){try{_0x3b10db=eval(_0x11b6d2[_0xe13e('0x45')](0x5))[0x0][0x2];}catch(_0x1d4c32){throw new Error(_0xe13e('0x46')+_0x11b6d2[_0xe13e('0x20')]);}if(!_0x3b10db){if(_0x4ae998[_0xe13e('0x47')]>0xc8){throw new Error(_0xe13e('0x48'));}else{throw new Error(_0xe13e('0x49')+_0xc2a20d+_0xe13e('0x4a'));}}try{_0x3b10db=eval(_0x3b10db)[0x0];}catch(_0x23d86b){throw new Error(_0xe13e('0x46')+res[_0xe13e('0x20')]);}const _0x43ef26=_0x3b10db;_0x2d0128=path[_0xe13e('0x27')](__dirname,'tmp',rs[_0xe13e('0x29')](0x4)+'.mp3');fs[_0xe13e('0x2b')](_0x2d0128,_0x3b10db,{'encoding':_0xe13e('0x2c')});_0x534ac6=path[_0xe13e('0x27')](__dirname,_0xe13e('0x28'),rs[_0xe13e('0x29')](0x4)+_0xe13e('0x2a'));return convertFile(_0x2d0128,_0x534ac6);})[_0xe13e('0x2d')](function(){try{fs[_0xe13e('0x2e')](_0x2d0128);fs[_0xe13e('0x2f')](_0x534ac6,_0xe13e('0x3d'));}catch(_0x31fe3c){logger[_0xe13e('0x15')](_0x31fe3c);}logger[_0xe13e('0x1a')](_0xe13e('0x4b'),_0x534ac6[_0xe13e('0x30')]('.')[0x0]);return _0x534ac6[_0xe13e('0x30')]('.')[0x0];});};exports[_0xe13e('0x4c')]=function(_0x330fef,_0x3e4b0e,_0x49beba){return google[_0xe13e('0x4d')](_0x330fef,_0x3e4b0e,_0x49beba)[_0xe13e('0x2d')](function(_0x469cb1){logger[_0xe13e('0x1a')](_0x469cb1[_0xe13e('0x4e')]);return rp(_0x469cb1);})[_0xe13e('0x2d')](function(_0xeb9287){var _0x5a0b86='';var _0x1c0145=0x0;try{fs['unlink'](_0x330fef);}catch(_0x16cf2d){logger[_0xe13e('0x15')](_0x16cf2d);}if(_0xeb9287&&_0xeb9287[_0xe13e('0x4f')]){_0x5a0b86=_0xeb9287[_0xe13e('0x4f')]['map'](function(_0x19de2f){return _0x19de2f&&_0x19de2f[_0xe13e('0x50')][0x0]&&_0x19de2f['alternatives'][0x0][_0xe13e('0x51')]?_0x19de2f[_0xe13e('0x50')][0x0][_0xe13e('0x51')]:'';})[_0xe13e('0x52')]('\x0a');_0x1c0145=_0xeb9287[_0xe13e('0x4f')][_0xe13e('0x53')](function(_0x3ea984){return _0x3ea984&&_0x3ea984[_0xe13e('0x50')][0x0]&&_0x3ea984[_0xe13e('0x50')][0x0][_0xe13e('0x54')]?_0x3ea984[_0xe13e('0x50')][0x0][_0xe13e('0x54')]:0x0;})[_0xe13e('0x52')]('\x0a');}logger[_0xe13e('0x1a')]('googleASR\x20transcription',_0x5a0b86);logger[_0xe13e('0x1a')]('googleASR\x20confidence',_0x1c0145);return{'transcript':_0x5a0b86,'confidence':_0x1c0145};})[_0xe13e('0x55')](function(_0x1547e5){logger[_0xe13e('0x15')](_0xe13e('0x56'),_0x1547e5[_0xe13e('0x14')],_0x1547e5[_0xe13e('0x57')],_0x1547e5[_0xe13e('0x58')]);});};exports[_0xe13e('0x59')]=function(_0x238cb7,_0xc595c1,_0x2fa9ec,_0x385bcc){var _0x6eb7c8=apiai(_0xc595c1,{'language':_0x385bcc||'en'});return _0x6eb7c8[_0xe13e('0x5a')](_0x2fa9ec,{'sessionId':md5(_0x238cb7)})[_0xe13e('0x2d')](function(_0x148086){logger[_0xe13e('0x1a')](JSON[_0xe13e('0x44')](_0x148086));return{'source':_0x148086[_0xe13e('0x5b')][_0xe13e('0x5c')],'resolvedQuery':_0x148086[_0xe13e('0x5b')]['resolvedQuery'],'action':_0x148086[_0xe13e('0x5b')][_0xe13e('0x5d')],'actionIncomplete':_0x148086['result'][_0xe13e('0x5e')],'speech':_0x148086[_0xe13e('0x5b')][_0xe13e('0x5f')][_0xe13e('0x60')],'score':_0x148086[_0xe13e('0x5b')][_0xe13e('0x61')],'statusCode':_0x148086[_0xe13e('0x62')][_0xe13e('0x63')],'endConversation':_0x148086[_0xe13e('0x5b')][_0xe13e('0x64')][_0xe13e('0x65')]||![],'isFallbackIntent':_0x148086[_0xe13e('0x5b')]['metadata']['isFallbackIntent']};});};exports[_0xe13e('0x66')]=function(_0x1944a1,_0x2565de,_0x17fb01,_0x2b1e22,_0x3111bf,_0x4ea671){var _0x2cbe2c=_0x2b1e22[_0xe13e('0x67')](/\\n/g,'\x0a');var _0x23f167={'credentials':{'private_key':_0x2cbe2c,'client_email':_0x17fb01}};var _0x17944c=new dialogflow[(_0xe13e('0x68'))](_0x23f167);var _0x2d3aa3=_0x17944c[_0xe13e('0x69')](_0x2565de,md5(_0x1944a1));var _0x286f5e={'session':_0x2d3aa3,'queryInput':{'text':{'text':_0x3111bf,'languageCode':_0x4ea671}}};return _0x17944c[_0xe13e('0x6a')](_0x286f5e)[_0xe13e('0x2d')](function(_0x333b2b){if(_0x333b2b&&_0x333b2b[_0xe13e('0x47')]){logger[_0xe13e('0x1a')](_0xe13e('0x6b'),JSON[_0xe13e('0x44')](_0x333b2b));var _0x471baa=_0x333b2b[0x0];if(_0x471baa){var _0xcf43a4={'action':_0x471baa['queryResult'][_0xe13e('0x5d')],'allRequiredParamsPresent':_0x471baa['queryResult'][_0xe13e('0x6c')],'endConversation':_0x471baa[_0xe13e('0x6d')]['diagnosticInfo']&&_0x471baa['queryResult']['diagnosticInfo'][_0xe13e('0x6e')]?_0x471baa[_0xe13e('0x6d')][_0xe13e('0x6f')][_0xe13e('0x6e')][_0xe13e('0x70')][_0xe13e('0x71')]:![],'fulfillmentText':_0x471baa[_0xe13e('0x6d')][_0xe13e('0x72')],'intentName':_0x471baa['queryResult'][_0xe13e('0x73')][_0xe13e('0x57')],'intentDisplayName':_0x471baa[_0xe13e('0x6d')][_0xe13e('0x73')][_0xe13e('0x74')],'isFallbackIntent':_0x471baa[_0xe13e('0x6d')][_0xe13e('0x73')]['isFallback'],'languageCode':_0x471baa['queryResult'][_0xe13e('0x75')],'queryText':_0x471baa[_0xe13e('0x6d')][_0xe13e('0x76')],'responseId':_0x471baa[_0xe13e('0x77')],'score':_0x471baa['queryResult']['intentDetectionConfidence'],'speech':_0x471baa[_0xe13e('0x6d')][_0xe13e('0x72')],'providerResponse':JSON[_0xe13e('0x44')](_0x333b2b)};return _0xcf43a4;}}});};exports[_0xe13e('0x78')]=function(_0x3a57b1,_0x32fbc2,_0xba425c,_0x53932c){return tilde[_0xe13e('0x4d')](_0x3a57b1,_0x32fbc2,_0xba425c,_0x53932c)[_0xe13e('0x2d')](function(_0x4411f9){try{fs[_0xe13e('0x2e')](_0x3a57b1);}catch(_0x23a44c){logger[_0xe13e('0x15')](_0x23a44c);}logger[_0xe13e('0x1a')](_0xe13e('0x79'),_0x4411f9['transcript']);logger[_0xe13e('0x1a')](_0xe13e('0x7a'),_0x4411f9[_0xe13e('0x54')]);return _0x4411f9;});};exports[_0xe13e('0x7b')]=function(_0x4646f0,_0x2a1560,_0x851cc9,_0x406def,_0x2417c4,_0x17f575){var _0x25dbf7=path['resolve'](__dirname,_0xe13e('0x28'),rs[_0xe13e('0x29')](0x4)+_0xe13e('0x39'));var _0x8b6f62;return aws[_0xe13e('0x7c')](_0x4646f0,_0x2a1560,_0x851cc9,_0x406def,_0x2417c4,_0x17f575,_0x25dbf7)[_0xe13e('0x2d')](function(){_0x8b6f62=path[_0xe13e('0x27')](__dirname,_0xe13e('0x28'),rs['generate'](0x4)+_0xe13e('0x2a'));return convertFile(_0x25dbf7,_0x8b6f62);})[_0xe13e('0x2d')](function(){try{fs[_0xe13e('0x2e')](_0x25dbf7);fs[_0xe13e('0x2f')](_0x8b6f62,'777');}catch(_0x46585f){logger[_0xe13e('0x15')](_0x46585f);}return _0x8b6f62[_0xe13e('0x30')]('.')[0x0];});};exports[_0xe13e('0x7d')]=function(_0x2cc6cc,_0x5cefb5,_0x408106,_0x4285a8,_0x3d8a88,_0xcab302){return aws['lex'](_0x2cc6cc,_0x5cefb5,_0x408106,_0x4285a8,_0x3d8a88,_0xcab302)[_0xe13e('0x2d')](function(_0x2f0d6a){logger[_0xe13e('0x1a')](JSON[_0xe13e('0x44')](_0x2f0d6a));return _0x2f0d6a;});};exports[_0xe13e('0x7e')]=function(_0x34bf9c,_0x291646,_0x54d55a,_0x1d9c19){var _0x574fe4=util[_0xe13e('0x7f')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x34bf9c,encodeURIComponent(_0x291646),_0x54d55a,_0x1d9c19);var _0x207b94=path['resolve'](__dirname,'tmp',rs[_0xe13e('0x29')](0x4)+_0xe13e('0x39'));var _0x4273e1;return downloadFile(_0x574fe4,_0x207b94)[_0xe13e('0x2d')](function(){_0x4273e1=path[_0xe13e('0x27')](__dirname,_0xe13e('0x28'),rs[_0xe13e('0x29')](0x4)+_0xe13e('0x2a'));return convertFile(_0x207b94,_0x4273e1);})[_0xe13e('0x2d')](function(){try{fs[_0xe13e('0x2e')](_0x207b94);fs[_0xe13e('0x2f')](_0x4273e1,_0xe13e('0x3d'));}catch(_0x469a49){logger[_0xe13e('0x15')](_0x469a49);}return _0x4273e1[_0xe13e('0x30')]('.')[0x0];});};exports[_0xe13e('0x80')]=function(_0x1e76a7,_0x3d9a7d,_0x242f84,_0x30682b){var _0x319220=util[_0xe13e('0x7f')](_0xe13e('0x81'),ISPEECH_API,_0x3d9a7d,_0x242f84,base64Encode(_0x1e76a7),_0x30682b?util[_0xe13e('0x7f')](_0xe13e('0x82'),encodeURIComponent(_0x30682b)):_0xe13e('0x83'));return uploadFile(_0x319220)[_0xe13e('0x2d')](function(_0x2df3a0){return querystring[_0xe13e('0x84')](_0x2df3a0);});};exports[_0xe13e('0x85')]=function(_0x263d3b,_0x33a5e1){return sestek[_0xe13e('0x86')](_0x263d3b,_0x33a5e1)[_0xe13e('0x2d')](function(_0x2139f7){logger[_0xe13e('0x1a')](JSON[_0xe13e('0x44')](_0x2139f7));var _0x4025e0={'speech':_0x2139f7['text'],'action':_0x2139f7['channelData']?_0x2139f7['channelData']['CustomAction']:undefined,'actiondata':_0x2139f7[_0xe13e('0x87')]?_0x2139f7[_0xe13e('0x87')][_0xe13e('0x88')]:undefined};if(_0x2139f7[_0xe13e('0x87')]&&_0x2139f7['channelData'][_0xe13e('0x89')]){return base64Decode(_0x2139f7[_0xe13e('0x87')]['AudioFromTts'][_0xe13e('0x8a')],path[_0xe13e('0x27')](__dirname,_0xe13e('0x28'),rs[_0xe13e('0x29')](0x4)+_0xe13e('0x2a')))[_0xe13e('0x2d')](function(_0x354368){_0x4025e0[_0xe13e('0x8b')]=_0x354368;return _0x4025e0;});}return _0x4025e0;});};exports['dirName']=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 ac8b2bc..2425a9b 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 _0x2e23=['./nda','exports'];(function(_0x35254c,_0x5a27d7){var _0xef3533=function(_0x41fec7){while(--_0x41fec7){_0x35254c['push'](_0x35254c['shift']());}};_0xef3533(++_0x5a27d7);}(_0x2e23,0x80));var _0x32e2=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2e23[_0x2dafbe];return _0x58a45a;};var nda=require(_0x32e2('0x0'));module[_0x32e2('0x1')]={'nda':nda}; \ No newline at end of file +var _0x27cf=['exports','./nda'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x27cf,0xbd));var _0xf27c=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x27cf[_0xb24a3e];return _0x4038d7;};var nda=require(_0xf27c('0x0'));module[_0xf27c('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 20daaf4..e65d422 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 _0x1ee2=['body','channelData','ProjectName','project','ndagenerate_audio','audio/wav','custom_action','CustomAction','CustomActionData','custom_action_data','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','ndauth_url','/token','password','username','then','POST','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','extension','text','Bearer\x20','access_token'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x1ee2,0x11c));var _0x21ee=function(_0x1fc830,_0x4e0383){_0x1fc830=_0x1fc830-0x0;var _0x322814=_0x1ee2[_0x1fc830];return _0x322814;};'use strict';var rp=require(_0x21ee('0x0'));var url=require(_0x21ee('0x1'));var logger=require(_0x21ee('0x2'))(_0x21ee('0x3'));module[_0x21ee('0x4')]=function(_0x48c7ff,_0x176aba){var _0x44530a={'method':'POST','uri':url['resolve'](_0x176aba[_0x21ee('0x5')],_0x21ee('0x6')),'form':{'grant_type':_0x21ee('0x7'),'username':_0x176aba[_0x21ee('0x8')],'password':_0x176aba['password']},'json':!![]};return rp(_0x44530a)[_0x21ee('0x9')](function(_0x207f5b){var _0x38588c={'method':_0x21ee('0xa'),'uri':url[_0x21ee('0xb')](_0x176aba[_0x21ee('0xc')],_0x21ee('0xd')),'body':{'type':_0x176aba[_0x21ee('0xe')]||_0x21ee('0xf'),'channelId':_0x21ee('0x10'),'conversation':{'id':_0x48c7ff[_0x21ee('0x11')]},'from':{'id':_0x48c7ff['callerid'],'name':_0x48c7ff['calleridname']},'recipient':{'id':_0x48c7ff['dnid'],'name':_0x48c7ff[_0x21ee('0x12')]},'text':_0x176aba[_0x21ee('0x13')],'channelData':{}},'headers':{'Authorization':_0x21ee('0x14')+_0x207f5b[_0x21ee('0x15')]},'json':!![]};if(_0x176aba['project']){_0x38588c[_0x21ee('0x16')][_0x21ee('0x17')][_0x21ee('0x18')]=_0x176aba[_0x21ee('0x19')];}if(_0x176aba[_0x21ee('0x1a')]=='1'){_0x38588c[_0x21ee('0x16')][_0x21ee('0x17')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x21ee('0x1b')};}if(_0x176aba[_0x21ee('0x1c')]){_0x38588c[_0x21ee('0x16')][_0x21ee('0x17')][_0x21ee('0x1d')]=_0x176aba[_0x21ee('0x1c')];if(_0x176aba['custom_action_data']){_0x38588c[_0x21ee('0x16')][_0x21ee('0x17')][_0x21ee('0x1e')]=_0x176aba[_0x21ee('0x1f')];}}logger[_0x21ee('0x20')](JSON[_0x21ee('0x21')](_0x38588c));return rp(_0x38588c);});}; \ No newline at end of file +var _0x9147=['CustomActionData','info','stringify','request-promise','url','agi','POST','resolve','ndauth_url','password','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','access_token','project','body','channelData','ProjectName','ndagenerate_audio','audio/wav','custom_action','custom_action_data'];(function(_0x4c9640,_0x2e709f){var _0x1f0e86=function(_0x20b7ab){while(--_0x20b7ab){_0x4c9640['push'](_0x4c9640['shift']());}};_0x1f0e86(++_0x2e709f);}(_0x9147,0x7b));var _0x7914=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x9147[_0x4154a6];return _0x3b2786;};'use strict';var rp=require(_0x7914('0x0'));var url=require(_0x7914('0x1'));var logger=require('../../../../../config/logger')(_0x7914('0x2'));module['exports']=function(_0x2e1273,_0x2b3ab2){var _0x4ffca2={'method':_0x7914('0x3'),'uri':url[_0x7914('0x4')](_0x2b3ab2[_0x7914('0x5')],'/token'),'form':{'grant_type':_0x7914('0x6'),'username':_0x2b3ab2['username'],'password':_0x2b3ab2[_0x7914('0x6')]},'json':!![]};return rp(_0x4ffca2)['then'](function(_0xdac92f){var _0x462c85={'method':_0x7914('0x3'),'uri':url[_0x7914('0x4')](_0x2b3ab2[_0x7914('0x7')],_0x7914('0x8')),'body':{'type':_0x2b3ab2[_0x7914('0x9')]||_0x7914('0xa'),'channelId':_0x7914('0xb'),'conversation':{'id':_0x2e1273[_0x7914('0xc')]},'from':{'id':_0x2e1273[_0x7914('0xd')],'name':_0x2e1273[_0x7914('0xe')]},'recipient':{'id':_0x2e1273[_0x7914('0xf')],'name':_0x2e1273[_0x7914('0x10')]},'text':_0x2b3ab2[_0x7914('0x11')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0xdac92f[_0x7914('0x12')]},'json':!![]};if(_0x2b3ab2[_0x7914('0x13')]){_0x462c85[_0x7914('0x14')][_0x7914('0x15')][_0x7914('0x16')]=_0x2b3ab2['project'];}if(_0x2b3ab2[_0x7914('0x17')]=='1'){_0x462c85[_0x7914('0x14')][_0x7914('0x15')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x7914('0x18')};}if(_0x2b3ab2['custom_action']){_0x462c85[_0x7914('0x14')][_0x7914('0x15')]['CustomAction']=_0x2b3ab2[_0x7914('0x19')];if(_0x2b3ab2[_0x7914('0x1a')]){_0x462c85[_0x7914('0x14')][_0x7914('0x15')][_0x7914('0x1b')]=_0x2b3ab2['custom_action_data'];}}logger[_0x7914('0x1c')](JSON[_0x7914('0x1d')](_0x462c85));return rp(_0x462c85);});}; \ 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 251ed91..080a810 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 _0xe49c=['exports','./lib/api'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0xe49c,0x189));var _0xce49=function(_0x4ffdc4,_0x34a28a){_0x4ffdc4=_0x4ffdc4-0x0;var _0x3b010c=_0xe49c[_0x4ffdc4];return _0x3b010c;};'use strict';var asr=require(_0xce49('0x0'));module[_0xce49('0x1')]=function(_0x2ef646,_0x3e9e3d,_0x49eeb0,_0x101aa0){return asr(_0x2ef646,_0x3e9e3d,_0x49eeb0,_0x101aa0);}; \ No newline at end of file +var _0xe1e9=['./lib/api'];(function(_0x358388,_0xc7618f){var _0x5a90c2=function(_0x22bb11){while(--_0x22bb11){_0x358388['push'](_0x358388['shift']());}};_0x5a90c2(++_0xc7618f);}(_0xe1e9,0x1e2));var _0x9e1e=function(_0x852bb0,_0x44aa28){_0x852bb0=_0x852bb0-0x0;var _0x40ce71=_0xe1e9[_0x852bb0];return _0x40ce71;};'use strict';var asr=require(_0x9e1e('0x0'));module['exports']=function(_0x251af2,_0x28c402,_0x12597f,_0x2eddf2){return asr(_0x251af2,_0x28c402,_0x12597f,_0x2eddf2);}; \ 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 82cbc61..2ccefce 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 _0x3f72=['sha1','update','digest','hex','unix','stringify','data','send','close','error','Tilde\x20ASR\x20send\x20error','parse','status','result','final','hypotheses','transcript','likelihood','Success.','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','moment','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash'];(function(_0x43f1a0,_0x5e0b0a){var _0x5740c3=function(_0x208cb8){while(--_0x208cb8){_0x43f1a0['push'](_0x43f1a0['shift']());}};_0x5740c3(++_0x5e0b0a);}(_0x3f72,0x13e));var _0x23f7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3f72[_0x2dafbe];return _0x58a45a;};'use strict';var BPromise=require(_0x23f7('0x0'));var _=require(_0x23f7('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x23f7('0x2'));var crypto=require('crypto');var logger=require('../../../../../../config/logger')(_0x23f7('0x3'));module[_0x23f7('0x4')]=function(_0x1076fb,_0x1184f3,_0x139260,_0x27beba){return new BPromise(function(_0x584020,_0x3869c4){logger[_0x23f7('0x5')](_0x23f7('0x6'),_0x27beba||_0x23f7('0x7'));var _0x554f2e=new WebSocket(_0x27beba||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x517f30='';var _0x265b7b='0';var _0x251d05='1';var _0x3b1acb=_0x23f7('0x8');function _0x3aa029(_0x39ea6b){var _0x53d6d6=crypto[_0x23f7('0x9')](_0x23f7('0xa'));_0x53d6d6[_0x23f7('0xb')](_0x39ea6b);return _0x53d6d6[_0x23f7('0xc')](_0x23f7('0xd'));}function _0xd2b3e2(){try{logger['info']('Open\x20Tilde\x20ASR\x20socket');var _0xbd44d2=moment()[_0x23f7('0xe')]();var _0x51eb68=_0x3aa029(_0xbd44d2+_0x1184f3+_0x139260);_0x554f2e['send'](JSON[_0x23f7('0xf')]({'appID':_0x1184f3,'timestamp':_0xbd44d2,'appKey':_0x51eb68}));var _0x1b3262=fs['createReadStream'](_0x1076fb);_0x1b3262['on'](_0x23f7('0x10'),function(_0x2cdeb0){_0x554f2e[_0x23f7('0x11')](_0x2cdeb0);});_0x1b3262['on'](_0x23f7('0x12'),function(){_0x554f2e['send']('EOS');});}catch(_0x23443d){logger[_0x23f7('0x13')](_0x23f7('0x14'),JSON[_0x23f7('0xf')](_0x23443d));_0x554f2e['terminate']();}}function _0x329931(_0x49cc02){try{if(_0x49cc02){var _0x30592d=JSON[_0x23f7('0x15')](_0x49cc02);switch(_0x30592d[_0x23f7('0x16')]){case 0x0:if(_0x30592d[_0x23f7('0x17')]){if(_0x30592d[_0x23f7('0x17')][_0x23f7('0x18')]){logger[_0x23f7('0x5')]('Tilde\x20ASR\x20hypoteses',JSON['stringify'](_0x30592d[_0x23f7('0x17')][_0x23f7('0x19')]));_0x517f30=_0x30592d[_0x23f7('0x17')][_0x23f7('0x19')][0x0][_0x23f7('0x1a')];_0x265b7b=_0x30592d['result'][_0x23f7('0x19')][0x0][_0x23f7('0x1b')];_0x251d05='0';_0x3b1acb=_0x23f7('0x1c');_0x554f2e[_0x23f7('0x1d')]();}}break;case 0x1:logger['info']('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x251d05='1';_0x3b1acb=_0x23f7('0x8');break;case 0x2:logger[_0x23f7('0x5')](_0x23f7('0x1e'));_0x251d05='2';_0x3b1acb=_0x23f7('0x1e');break;case 0x9:logger['info'](_0x23f7('0x1f'));_0x251d05='9';_0x3b1acb=_0x23f7('0x1f');break;case 0xa:logger['info'](_0x23f7('0x20'));_0x251d05='10';_0x3b1acb=_0x23f7('0x20');break;case 0xb:logger[_0x23f7('0x5')](_0x23f7('0x21'));_0x251d05='11';_0x3b1acb='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x762564){logger['error'](_0x23f7('0x22'),JSON[_0x23f7('0xf')](_0x762564));_0x554f2e[_0x23f7('0x1d')]();}}function _0x5e60b7(){logger['info'](_0x23f7('0x23'));_0x584020({'transcript':_0x517f30,'confidence':_0x265b7b,'status':_0x251d05,'status_message':_0x3b1acb});}function _0x42c4f6(_0x382142){logger[_0x23f7('0x13')](_0x23f7('0x24'));if(!_[_0x23f7('0x25')](_0x382142)){logger[_0x23f7('0x13')](_[_0x23f7('0x26')](_0x382142)?JSON['stringify'](_0x382142):_0x382142);}}_0x554f2e['on'](_0x23f7('0x27'),_0xd2b3e2);_0x554f2e['on'](_0x23f7('0x28'),_0x329931);_0x554f2e['on']('close',_0x5e60b7);_0x554f2e['on'](_0x23f7('0x13'),_0x42c4f6);});}; \ No newline at end of file +var _0xa008=['close','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','final','Tilde\x20ASR\x20hypoteses','hypotheses','result','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','isObject','open','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data'];(function(_0x2d640d,_0xdb759){var _0x4fffd6=function(_0x550c05){while(--_0x550c05){_0x2d640d['push'](_0x2d640d['shift']());}};_0x4fffd6(++_0xdb759);}(_0xa008,0x1ef));var _0x8a00=function(_0x838851,_0x444fe1){_0x838851=_0x838851-0x0;var _0x54df66=_0xa008[_0x838851];return _0x54df66;};'use strict';var BPromise=require(_0x8a00('0x0'));var _=require(_0x8a00('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x8a00('0x2'));var crypto=require(_0x8a00('0x3'));var logger=require(_0x8a00('0x4'))(_0x8a00('0x5'));module[_0x8a00('0x6')]=function(_0x1b946c,_0x3c49c8,_0x427ea1,_0x50b7bf){return new BPromise(function(_0x59e4d9,_0x333715){logger[_0x8a00('0x7')](_0x8a00('0x8'),_0x50b7bf||_0x8a00('0x9'));var _0x40baae=new WebSocket(_0x50b7bf||_0x8a00('0x9'),{'perMessageDeflate':![]});var _0x486728='';var _0x29cd29='0';var _0x3923d9='1';var _0xc3cd0e=_0x8a00('0xa');function _0x15b4a9(_0x481ab6){var _0x5cb8b0=crypto[_0x8a00('0xb')](_0x8a00('0xc'));_0x5cb8b0['update'](_0x481ab6);return _0x5cb8b0[_0x8a00('0xd')](_0x8a00('0xe'));}function _0x2956b4(){try{logger[_0x8a00('0x7')](_0x8a00('0xf'));var _0x183505=moment()[_0x8a00('0x10')]();var _0x26490f=_0x15b4a9(_0x183505+_0x3c49c8+_0x427ea1);_0x40baae[_0x8a00('0x11')](JSON[_0x8a00('0x12')]({'appID':_0x3c49c8,'timestamp':_0x183505,'appKey':_0x26490f}));var _0x645327=fs[_0x8a00('0x13')](_0x1b946c);_0x645327['on'](_0x8a00('0x14'),function(_0x4524c4){_0x40baae[_0x8a00('0x11')](_0x4524c4);});_0x645327['on'](_0x8a00('0x15'),function(){_0x40baae[_0x8a00('0x11')]('EOS');});}catch(_0x460679){logger[_0x8a00('0x16')](_0x8a00('0x17'),JSON[_0x8a00('0x12')](_0x460679));_0x40baae[_0x8a00('0x18')]();}}function _0x5c6960(_0x212d33){try{if(_0x212d33){var _0x2d3b26=JSON[_0x8a00('0x19')](_0x212d33);switch(_0x2d3b26[_0x8a00('0x1a')]){case 0x0:if(_0x2d3b26['result']){if(_0x2d3b26['result'][_0x8a00('0x1b')]){logger[_0x8a00('0x7')](_0x8a00('0x1c'),JSON['stringify'](_0x2d3b26['result'][_0x8a00('0x1d')]));_0x486728=_0x2d3b26[_0x8a00('0x1e')]['hypotheses'][0x0][_0x8a00('0x1f')];_0x29cd29=_0x2d3b26[_0x8a00('0x1e')]['hypotheses'][0x0][_0x8a00('0x20')];_0x3923d9='0';_0xc3cd0e=_0x8a00('0x21');_0x40baae[_0x8a00('0x18')]();}}break;case 0x1:logger[_0x8a00('0x7')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x3923d9='1';_0xc3cd0e=_0x8a00('0xa');break;case 0x2:logger[_0x8a00('0x7')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x3923d9='2';_0xc3cd0e=_0x8a00('0x22');break;case 0x9:logger[_0x8a00('0x7')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x3923d9='9';_0xc3cd0e=_0x8a00('0x23');break;case 0xa:logger['info'](_0x8a00('0x24'));_0x3923d9='10';_0xc3cd0e='Authentication\x20failed.';break;case 0xb:logger[_0x8a00('0x7')](_0x8a00('0x25'));_0x3923d9='11';_0xc3cd0e='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x4cf82d){logger[_0x8a00('0x16')](_0x8a00('0x26'),JSON['stringify'](_0x4cf82d));_0x40baae[_0x8a00('0x18')]();}}function _0x512e70(){logger['info'](_0x8a00('0x27'));_0x59e4d9({'transcript':_0x486728,'confidence':_0x29cd29,'status':_0x3923d9,'status_message':_0xc3cd0e});}function _0x75d8da(_0x3353ff){logger[_0x8a00('0x16')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x8a00('0x28')](_0x3353ff)){logger[_0x8a00('0x16')](_[_0x8a00('0x29')](_0x3353ff)?JSON[_0x8a00('0x12')](_0x3353ff):_0x3353ff);}}_0x40baae['on'](_0x8a00('0x2a'),_0x2956b4);_0x40baae['on']('message',_0x5c6960);_0x40baae['on']('close',_0x512e70);_0x40baae['on'](_0x8a00('0x16'),_0x75d8da);});}; \ 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 f690bc4..de06174 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 _0xf71f=['./asr','exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xf71f,0x17c));var _0xff71=function(_0x42bda0,_0x59c921){_0x42bda0=_0x42bda0-0x0;var _0x1a5dbf=_0xf71f[_0x42bda0];return _0x1a5dbf;};var asr=require(_0xff71('0x0'));module[_0xff71('0x1')]={'asr':asr}; \ No newline at end of file +var _0x97a7=['./asr','exports'];(function(_0x42fc80,_0xe3b224){var _0x1ae17c=function(_0x1321ce){while(--_0x1321ce){_0x42fc80['push'](_0x42fc80['shift']());}};_0x1ae17c(++_0xe3b224);}(_0x97a7,0xd2));var _0x797a=function(_0x24b9df,_0x2a4ff8){_0x24b9df=_0x24b9df-0x0;var _0x43cb60=_0x97a7[_0x24b9df];return _0x43cb60;};var asr=require(_0x797a('0x0'));module[_0x797a('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index f8f425b..fc8fd65 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 _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x9c44[_0x3d42d8];return _0x27fc41;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file +var _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9c44[_0x16b9ed];return _0x66b1f8;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 5a0b4fb..394903b 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 _0xad13=['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','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','getVoiceQueue','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','createSquareRecording','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','variable\x20%s\x20set','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','\x22%s\x22\x20<%s>','email','user','bcc','subject','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','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','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','host','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','exports','util','shelljs','odbc','randomstring','moment','request-promise','../../config/logger','agi','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getsecretdigits','channel','rpc','prototype','getVariable','getVariableById','name','catch','getVoiceQueueById','then','getSquareProject','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccountById','mailRpc','sendMailMessage','IntervalId','interval','map','Intervals','format','open','error','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','callerid','calleridname','context','extension','priority','accountcode','arg_1','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','lastName','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPauseById','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','text','languageCode','en-US','ssmlGender','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','method','timeout','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','url','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','includes','agicommand','clone','isString','replaceObjectAllVariables','replaceAllVariables','hasOwnProperty','isArray','length','saveRestApiResult','isPlainObject','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','no\x20grammar\x20configured','grammar','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','callback','no\x20list\x20selected','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','query:\x20%s','getQueryOdbc','no\x20variable\x20found','%s[%s][%s]','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','sip_id','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','DIAL','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','dialogflow','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','dialogflowV2_language','no\x20anguage\x20configured','bot','Trying\x20DialogflowV2:\x20%s','providerResponse','dialogflowV2','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','finally','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','GOAL\x20%s','awspolly','aws_secret_access_key','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','aws\x20Polly\x20is\x20unreachable','awslex','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','beep','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','wav','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s'];(function(_0x2d460c,_0x4f08c0){var _0xf6fc4c=function(_0x4fb81c){while(--_0x4fb81c){_0x2d460c['push'](_0x2d460c['shift']());}};_0xf6fc4c(++_0x4f08c0);}(_0xad13,0x79));var _0x3ad1=function(_0x5b8e0f,_0x2df323){_0x5b8e0f=_0x5b8e0f-0x0;var _0x49d394=_0xad13[_0x5b8e0f];return _0x49d394;};'use strict';var fs=require('fs');var util=require(_0x3ad1('0x0'));var _=require('lodash');var sh=require(_0x3ad1('0x1'));var odbc=require(_0x3ad1('0x2'))();var rs=require(_0x3ad1('0x3'));var moment=require(_0x3ad1('0x4'));var Mustache=require('mustache');var rp=require(_0x3ad1('0x5'));var logger=require(_0x3ad1('0x6'))(_0x3ad1('0x7'));var config=require(_0x3ad1('0x8'));var shared=require(_0x3ad1('0x9'));var scripts=require(_0x3ad1('0xa'));var FILES_PATH=_0x3ad1('0xb');var recursiveMapAttributes=[_0x3ad1('0xc'),_0x3ad1('0xd')];var verticesWithRetry=[_0x3ad1('0xe'),'getdigits',_0x3ad1('0xf')];var AGIVertices=function(_0x241492,_0x4611bb,_0x4e93df){this[_0x3ad1('0x10')]=_0x241492;this[_0x3ad1('0x11')]=_0x4611bb;this['mailRpc']=_0x4e93df;};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0x13')]=function(_0x17d0a7,_0x2ae2a3){this[_0x3ad1('0x11')][_0x3ad1('0x14')](_0x17d0a7)['then'](function(_0x5a431a){_0x2ae2a3(null,_0x5a431a?_0x5a431a[_0x3ad1('0x15')]:![]);})[_0x3ad1('0x16')](function(_0x4544c0){_0x2ae2a3(_0x4544c0);});};AGIVertices[_0x3ad1('0x12')]['getVoiceQueue']=function(_0x516ffb,_0x4bf44f){this[_0x3ad1('0x11')][_0x3ad1('0x17')](_0x516ffb)[_0x3ad1('0x18')](function(_0x223bfa){_0x4bf44f(null,_0x223bfa?_0x223bfa[_0x3ad1('0x15')]:![]);})[_0x3ad1('0x16')](function(_0xce229){_0x4bf44f(_0xce229);});};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0x19')]=function(_0x1e40d0,_0x1d924e){this[_0x3ad1('0x11')]['getSquareProjectById'](_0x1e40d0)[_0x3ad1('0x18')](function(_0x30e53f){_0x1d924e(null,_0x30e53f?_0x30e53f[_0x3ad1('0x15')]:![]);})[_0x3ad1('0x16')](function(_0x11e3ed){_0x1d924e(_0x11e3ed);});};AGIVertices['prototype'][_0x3ad1('0x1a')]=function(_0x3de9a2,_0x57c4d1){this[_0x3ad1('0x11')][_0x3ad1('0x1b')](_0x3de9a2)[_0x3ad1('0x18')](function(_0x46649d){_0x57c4d1(null,_0x46649d?_0x46649d[_0x3ad1('0x1c')]:![]);})[_0x3ad1('0x16')](function(_0x5aa568){_0x57c4d1(_0x5aa568);});};AGIVertices[_0x3ad1('0x12')]['getUser']=function(_0xc78309,_0x5f1031){this[_0x3ad1('0x11')][_0x3ad1('0x1d')](_0xc78309)[_0x3ad1('0x18')](function(_0x3e9c1f){_0x5f1031(null,_0x3e9c1f?_0x3e9c1f[_0x3ad1('0x15')]:![]);})[_0x3ad1('0x16')](function(_0x2fd5e6){_0x5f1031(_0x2fd5e6);});};AGIVertices['prototype'][_0x3ad1('0x1e')]=function(_0x466d91,_0x30c178){this[_0x3ad1('0x11')][_0x3ad1('0x1f')](_0x466d91)[_0x3ad1('0x18')](function(_0x58fdcf){_0x30c178(null,_0x58fdcf?_0x58fdcf['name']:![]);})[_0x3ad1('0x16')](function(_0x5e1c03){_0x30c178(_0x5e1c03);});};AGIVertices['prototype'][_0x3ad1('0x20')]=function(_0x2408d5,_0xf5d14c){var _0x477191=this;this['rpc'][_0x3ad1('0x21')](_0x2408d5)[_0x3ad1('0x18')](function(_0x402df6){_0xf5d14c(null,_0x402df6?_0x477191[_0x3ad1('0x22')](_0x402df6[_0x3ad1('0x23')]):![]);})['catch'](function(_0x50f934){_0xf5d14c(_0x50f934);});};AGIVertices[_0x3ad1('0x12')]['getMailAccount']=function(_0x7def7b,_0x1d28d6){this[_0x3ad1('0x11')][_0x3ad1('0x24')](_0x7def7b)[_0x3ad1('0x18')](function(_0x7c001){_0x1d28d6(null,_0x7c001?_0x7c001:![]);})[_0x3ad1('0x16')](function(_0x1b2640){_0x1d28d6(_0x1b2640);});};AGIVertices[_0x3ad1('0x12')]['sendMailMessage']=function(_0x2b6a4d,_0x48c12f,_0x2a5f2f){this[_0x3ad1('0x25')][_0x3ad1('0x26')](_0x2b6a4d,_0x48c12f)[_0x3ad1('0x18')](function(){_0x2a5f2f(null);})[_0x3ad1('0x16')](function(_0x100e44){_0x2a5f2f(_0x100e44);});};AGIVertices[_0x3ad1('0x12')]['getIntervals']=function(_0x3d7a3a,_0x5841c6){this['rpc']['getIntervalById'](_0x3d7a3a)[_0x3ad1('0x18')](function(_0x1e8da4){if(_0x1e8da4){if(_0x1e8da4[_0x3ad1('0x27')]){_0x5841c6(null,[_0x1e8da4[_0x3ad1('0x28')]]);}else{_0x5841c6(null,_[_0x3ad1('0x29')](_0x1e8da4[_0x3ad1('0x2a')],'interval'));}}else{_0x5841c6(null,![]);}})['catch'](function(_0x18a9c0){_0x5841c6(_0x18a9c0);});};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0x22')]=function(_0x204141){return util[_0x3ad1('0x2b')]('%s/sounds/converted/%s',FILES_PATH,_0x204141);};AGIVertices['prototype']['getQueryOdbc']=function(_0x5d9365,_0x528168,_0x5e878d){odbc[_0x3ad1('0x2c')](_0x5d9365,function(_0x78b554){if(_0x78b554){logger[_0x3ad1('0x2d')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x78b554);_0x5e878d(_0x78b554);}else{logger[_0x3ad1('0x2e')](_0x3ad1('0x2f'));odbc['query'](_0x528168,function(_0x90d65,_0x4f64c3){if(_0x90d65){logger[_0x3ad1('0x2e')](_0x3ad1('0x30'),_0x528168);_0x5e878d(_0x90d65);}else{logger[_0x3ad1('0x2e')](_0x3ad1('0x31'),_0x528168);odbc['close'](function(_0x5e869b){if(_0x5e869b){logger[_0x3ad1('0x2d')](_0x3ad1('0x32'),_0x5e869b);}_0x5e878d(null,_0x4f64c3);});}});}});};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0x33')]=function(_0x5598c3,_0x10f027){this[_0x3ad1('0x11')][_0x3ad1('0x34')](_0x5598c3)[_0x3ad1('0x18')](function(_0x48a66e){_0x10f027(null,_0x48a66e?_0x48a66e:![]);})[_0x3ad1('0x16')](function(_0x4fd158){_0x10f027(_0x4fd158);});};AGIVertices['prototype'][_0x3ad1('0x35')]=function(_0x509b1c,_0x52298e){this['rpc'][_0x3ad1('0x35')](_0x509b1c)[_0x3ad1('0x18')](function(_0x17faa0){_0x52298e(null,_0x17faa0);})[_0x3ad1('0x16')](function(_0x2d5801){_0x52298e(_0x2d5801);});};AGIVertices['prototype']['createSquareDetailsReport']=function(_0xf267d0,_0x44bdfd,_0x4c1216){this[_0x3ad1('0x11')][_0x3ad1('0x36')]({'uniqueid':this['channel'][_0x3ad1('0x37')],'node':_0xf267d0[_0x3ad1('0x38')],'application':_0xf267d0['agicommand'],'data':_0x44bdfd||null,'project_name':this[_0x3ad1('0x10')]['arg_1'],'callerid':this[_0x3ad1('0x10')][_0x3ad1('0x39')]})[_0x3ad1('0x18')](function(_0x68deb9){if(_0x4c1216){_0x4c1216(null,_0x68deb9);}})[_0x3ad1('0x16')](function(_0x1be5f0){if(_0x4c1216){_0x4c1216(_0x1be5f0);}});};AGIVertices[_0x3ad1('0x12')]['createSquareRecording']=function(_0x522b24,_0x44a0a1,_0xa1becf,_0x95cf1a){this[_0x3ad1('0x11')]['createSquareRecording']({'uniqueid':this['channel'][_0x3ad1('0x37')],'callerid':this['channel'][_0x3ad1('0x39')],'calleridname':this['channel'][_0x3ad1('0x3a')],'context':this['channel'][_0x3ad1('0x3b')],'extension':this[_0x3ad1('0x10')][_0x3ad1('0x3c')],'priority':this['channel'][_0x3ad1('0x3d')],'accountcode':this[_0x3ad1('0x10')][_0x3ad1('0x3e')],'dnid':this[_0x3ad1('0x10')]['dnid'],'projectName':this[_0x3ad1('0x10')][_0x3ad1('0x3f')],'saveName':_0x44a0a1,'filename':_0x522b24[_0x3ad1('0x40')]||_0x44a0a1,'savePath':_0xa1becf})[_0x3ad1('0x18')](function(_0xe37dc5){_0x95cf1a(null,_0xe37dc5);})[_0x3ad1('0x16')](function(_0x4ba525){_0x95cf1a(_0x4ba525);});};AGIVertices['prototype']['createSquareMessage']=function(_0x994136,_0xe7d674,_0x5a860d,_0x4f20aa,_0x42dc8c){this[_0x3ad1('0x11')][_0x3ad1('0x41')]({'uniqueid':this[_0x3ad1('0x10')]['uniqueid'],'body':_0x994136,'direction':_0xe7d674,'providerName':_0x5a860d,'providerResponse':_0x4f20aa})[_0x3ad1('0x18')](function(_0x5ad208){if(_0x42dc8c){_0x42dc8c(null,_0x5ad208);}})['catch'](function(_0x537f89){if(_0x42dc8c){_0x42dc8c(_0x537f89);}});};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0x42')]=function(_0x144267,_0x2ffd72){this[_0x3ad1('0x11')]['createCmContact']({'firstName':_[_0x3ad1('0x43')](_0x144267[_0x3ad1('0x15')])||_[_0x3ad1('0x44')](_0x144267[_0x3ad1('0x15')])?_0x3ad1('0x45')+Math['random']():_0x144267[_0x3ad1('0x15')],'lastName':_[_0x3ad1('0x43')](_0x144267[_0x3ad1('0x46')])||_[_0x3ad1('0x44')](_0x144267[_0x3ad1('0x46')])?null:_0x144267[_0x3ad1('0x46')],'phone':_0x144267[_0x3ad1('0x47')],'ListId':_0x144267[_0x3ad1('0x48')],'scheduledat':_0x144267[_0x3ad1('0x49')],'callbackUniqueid':this[_0x3ad1('0x10')]['uniqueid'],'tags':'callback','description':_0x3ad1('0x4a')+_0x144267['scheduledAt'][_0x3ad1('0x4b')](),'priority':_0x144267[_0x3ad1('0x4c')]})[_0x3ad1('0x18')](function(_0x590b70){_0x2ffd72(null,_0x590b70);})[_0x3ad1('0x16')](function(_0x57c8a4){_0x2ffd72(_0x57c8a4);});};AGIVertices[_0x3ad1('0x12')]['getPause']=function(_0x3adc3f,_0x36fef3){this['rpc'][_0x3ad1('0x4d')](_0x3adc3f)[_0x3ad1('0x18')](function(_0x2c3444){_0x36fef3(null,_0x2c3444?_0x2c3444[_0x3ad1('0x15')]:![]);})[_0x3ad1('0x16')](function(_0x4a5b81){_0x36fef3(_0x4a5b81);});};AGIVertices[_0x3ad1('0x12')]['agentPause']=function(_0xd2d0b,_0x172243,_0x3b6b6f){var _0x185f34={'role':_0x3ad1('0x4e')};_0x185f34[_0xd2d0b]=this[_0x3ad1('0x10')][_0x3ad1('0x39')];this[_0x3ad1('0x11')]['agentPause'](_0x185f34,_0x172243,this[_0x3ad1('0x10')][_0x3ad1('0x37')])[_0x3ad1('0x18')](function(_0x1e1496){_0x3b6b6f(null,_[_0x3ad1('0x44')](_0x1e1496)?![]:!![]);})[_0x3ad1('0x16')](function(_0x4d42f0){logger[_0x3ad1('0x2d')](_0x4d42f0);_0x3b6b6f(null,![]);});};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0x4f')]=function(_0x448161,_0x4094e6){var _0x2389f7={'role':_0x3ad1('0x4e')};_0x2389f7[_0x448161]=this['channel']['callerid'];this[_0x3ad1('0x11')][_0x3ad1('0x4f')](_0x2389f7)[_0x3ad1('0x18')](function(_0x3971de){_0x4094e6(null,_[_0x3ad1('0x44')](_0x3971de)?![]:!![]);})[_0x3ad1('0x16')](function(_0x277979){logger['error'](_0x277979);_0x4094e6(null,![]);});};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0x50')]=function(_0xccdc37,_0x2e2904){var _0x569d9a={'role':'agent'};_0x569d9a[_0xccdc37]=this[_0x3ad1('0x10')]['callerid'];this[_0x3ad1('0x11')][_0x3ad1('0x50')](_0x569d9a)['then'](function(_0x105467){_0x2e2904(null,_[_0x3ad1('0x44')](_0x105467)?![]:!![]);})[_0x3ad1('0x16')](function(_0x1cd1ef){logger[_0x3ad1('0x2d')](_0x1cd1ef);_0x2e2904(null,![]);});};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0x51')]=function(_0x3ffe57,_0x1812ad){var _0x2ebebe={'role':_0x3ad1('0x4e')};_0x2ebebe[_0x3ffe57]=this[_0x3ad1('0x10')]['callerid'];var _0x5766fa=_0x3ffe57!=_0x3ad1('0x52')?util[_0x3ad1('0x2b')](_0x3ad1('0x53'),'LOCAL',this[_0x3ad1('0x10')]['callerid']):undefined;this[_0x3ad1('0x11')][_0x3ad1('0x51')](_0x2ebebe,_0x5766fa)['then'](function(_0x399063){_0x1812ad(null,_[_0x3ad1('0x44')](_0x399063)?![]:!![]);})[_0x3ad1('0x16')](function(_0x14fa07){logger['error'](_0x14fa07);_0x1812ad(null,![]);});};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0x54')]=function(_0xedbe1c,_0x211e1e){sh[_0x3ad1('0x55')](_[_0x3ad1('0x56')](_0xedbe1c),function(_0x1524a9,_0x516861){var _0x20aff6=_0x516861[_0x3ad1('0x57')](/(\r\n|\n|\r)/gm,'');_0x211e1e(null,_0x20aff6);});};AGIVertices[_0x3ad1('0x12')]['googleCloudTTS']=function(_0x2c15b4,_0x10a439){scripts[_0x3ad1('0x58')](_0x2c15b4[_0x3ad1('0x59')],_0x2c15b4['google_cloud_tts_text_type']||_0x3ad1('0x5a'),_0x2c15b4[_0x3ad1('0x5a')],_0x2c15b4[_0x3ad1('0x5b')]||_0x3ad1('0x5c'),_0x2c15b4[_0x3ad1('0x5d')]||'MALE',_0x2c15b4[_0x3ad1('0x5e')]||_0x3ad1('0x5f'))['then'](function(_0x317612){_0x10a439(null,_0x317612);})[_0x3ad1('0x16')](function(_0x24daf8){_0x10a439(_0x24daf8);});};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0x60')]=function(_0x2ff3a7,_0x258351){scripts['googleTTS'](_0x2ff3a7[_0x3ad1('0x5a')],_0x2ff3a7[_0x3ad1('0x61')]||'en',0x1)[_0x3ad1('0x18')](function(_0x12f23a){_0x258351(null,_0x12f23a);})[_0x3ad1('0x16')](function(_0x2a9f3b){_0x258351(_0x2a9f3b);});};AGIVertices['prototype'][_0x3ad1('0x62')]=function(_0x598137,_0x1a0178){var _0x4e4f32={'uri':_0x598137['url'],'method':_0x598137[_0x3ad1('0x63')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x598137['timeout'])==='number'&&parseInt(_0x598137[_0x3ad1('0x64')])>=0x1?parseInt(_0x598137[_0x3ad1('0x64')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x3ad1('0x65'),_0x3ad1('0x66')],_0x4e4f32[_0x3ad1('0x63')][_0x3ad1('0x67')]())){try{_0x4e4f32[_0x3ad1('0x68')]=_0x598137[_0x3ad1('0xd')]?JSON[_0x3ad1('0x69')](_0x598137[_0x3ad1('0xd')]):{};}catch(_0x287f38){logger[_0x3ad1('0x2d')](_0x3ad1('0x6a'),_0x287f38);}}try{_0x4e4f32[_0x3ad1('0x6b')]=_0x598137[_0x3ad1('0xc')]?JSON[_0x3ad1('0x69')](_0x598137[_0x3ad1('0xc')]):{};}catch(_0x738965){logger[_0x3ad1('0x2d')](_0x3ad1('0x6c'),_0x738965);}if(_0x598137[_0x3ad1('0x6d')]){try{var _0x20b340=require(_0x598137[_0x3ad1('0x6d')])[_0x3ad1('0x6e')](this,_0x4e4f32);_0x4e4f32[_0x3ad1('0x6f')]=Mustache[_0x3ad1('0x70')](_0x598137[_0x3ad1('0x71')],_0x20b340,{},['$$','$$']);if(_0x4e4f32[_0x3ad1('0x6b')]){_0x4e4f32[_0x3ad1('0x6b')]=JSON[_0x3ad1('0x69')](Mustache['render'](JSON[_0x3ad1('0x72')](_0x4e4f32['headers']),_0x20b340,{},['$$','$$']));}if(_0x4e4f32[_0x3ad1('0x68')]){_0x4e4f32[_0x3ad1('0x68')]=JSON[_0x3ad1('0x69')](Mustache[_0x3ad1('0x70')](JSON[_0x3ad1('0x72')](_0x4e4f32[_0x3ad1('0x68')]),_0x20b340,{},['$$','$$']));}}catch(_0x51f959){logger[_0x3ad1('0x2d')](_0x3ad1('0x73'),_0x51f959);}}rp(_0x4e4f32)[_0x3ad1('0x18')](function(_0x4f623d){var _0x6768e6={'statusCode':_0x4f623d[_0x3ad1('0x74')]||0xc8,'statusMessage':_0x4f623d[_0x3ad1('0x75')]||'OK','headers':_0x4f623d[_0x3ad1('0x6b')]||{},'body':_0x4f623d['body']||{}};_0x1a0178(null,_0x6768e6);})['catch'](function(_0x1f64b3){var _0x2124d7={'statusCode':_0x1f64b3[_0x3ad1('0x74')]||0x1f4,'statusMessage':_0x1f64b3[_0x3ad1('0x76')]||_0x3ad1('0x77'),'headers':_0x1f64b3[_0x3ad1('0x78')][_0x3ad1('0x6b')]||{},'body':_0x1f64b3[_0x3ad1('0x78')]['body']||{}};_0x1a0178(null,_0x2124d7);});};AGIVertices[_0x3ad1('0x12')]['googleDialogflow']=function(_0xed3be0,_0x3c5d5f){scripts[_0x3ad1('0x79')](this['channel'][_0x3ad1('0x37')],_0xed3be0[_0x3ad1('0x7a')],_0xed3be0[_0x3ad1('0x5a')],_0xed3be0['dialogflow_language']||'en')[_0x3ad1('0x18')](function(_0x25c35d){_0x3c5d5f(null,_0x25c35d);})[_0x3ad1('0x16')](function(_0x57be32){_0x3c5d5f(_0x57be32);});};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0x7b')]=function(_0x153e6b,_0x2b9124){scripts['googleDialogflowV2'](this[_0x3ad1('0x10')]['uniqueid'],_0x153e6b[_0x3ad1('0x7c')],_0x153e6b[_0x3ad1('0x7d')],_0x153e6b[_0x3ad1('0x7e')],_0x153e6b['text'],_0x153e6b['dialogflowV2_language']||'en')['then'](function(_0x438830){_0x2b9124(null,_0x438830);})[_0x3ad1('0x16')](function(_0x89d1b5){_0x2b9124(_0x89d1b5);});};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0x7f')]=function(_0x19f704,_0x1a633d){scripts['sestekNDA'](this[_0x3ad1('0x10')],_0x19f704)['then'](function(_0x298c09){_0x1a633d(null,_0x298c09);})['catch'](function(_0x36a368){_0x1a633d(_0x36a368);});};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0x80')]=function(_0x384ae2,_0x5a5c3d){scripts[_0x3ad1('0x80')](_0x384ae2[_0x3ad1('0x7a')],_0x384ae2[_0x3ad1('0x5a')],_0x384ae2[_0x3ad1('0x81')]||'en-US',_0x384ae2[_0x3ad1('0x82')])[_0x3ad1('0x18')](function(_0xa64436){_0x5a5c3d(null,_0xa64436);})['catch'](function(_0x4f8f64){_0x5a5c3d(_0x4f8f64);});};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0x83')]=function(_0x10b614,_0x29dd18,_0x225a02){scripts[_0x3ad1('0x83')](_0x29dd18,_0x10b614[_0x3ad1('0x7a')],_0x10b614[_0x3ad1('0x84')]||_0x3ad1('0x5c'),this[_0x3ad1('0x85')](_0x10b614[_0x3ad1('0x86')])?_0x10b614[_0x3ad1('0x86')]:undefined)[_0x3ad1('0x18')](function(_0x44d161){_0x225a02(null,_0x44d161);})['catch'](function(_0x18f4e0){_0x225a02(_0x18f4e0);});};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0x87')]=function(_0x1226a3,_0x5f2481){scripts[_0x3ad1('0x87')](_0x1226a3[_0x3ad1('0x88')],_0x1226a3['aws_secret_access_key'],_0x1226a3[_0x3ad1('0x89')],_0x1226a3[_0x3ad1('0x8a')]||_0x3ad1('0x8b'),_0x1226a3[_0x3ad1('0x5a')],_0x1226a3[_0x3ad1('0x8c')]||_0x3ad1('0x5a'))['then'](function(_0x546402){_0x5f2481(null,_0x546402);})[_0x3ad1('0x16')](function(_0x1a1af0){_0x5f2481(_0x1a1af0);});};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0x8d')]=function(_0x558948,_0x17cddc){scripts['awsLex'](this['channel'][_0x3ad1('0x37')],_0x558948['aws_access_key_id'],_0x558948['aws_secret_access_key'],_0x558948[_0x3ad1('0x8e')],_0x558948[_0x3ad1('0x5a')],_0x558948[_0x3ad1('0x8f')])[_0x3ad1('0x18')](function(_0x29c5a6){_0x17cddc(null,_0x29c5a6);})[_0x3ad1('0x16')](function(_0xc90242){_0x17cddc(_0xc90242);});};AGIVertices[_0x3ad1('0x12')]['googleASR']=function(_0x28e910,_0x479c54,_0x1aacd3){scripts[_0x3ad1('0x90')](_0x479c54,_0x28e910[_0x3ad1('0x7a')],_0x28e910[_0x3ad1('0x91')]||_0x3ad1('0x5c'))[_0x3ad1('0x18')](function(_0x7420cf){_0x1aacd3(null,_0x7420cf);})[_0x3ad1('0x16')](function(_0x5a55bf){_0x1aacd3(_0x5a55bf);});};AGIVertices['prototype'][_0x3ad1('0x92')]=function(_0x2467a1,_0x3b7a26,_0x20c035){scripts['tildeASR'](_0x3b7a26,_0x2467a1[_0x3ad1('0x93')],_0x2467a1[_0x3ad1('0x94')],_0x2467a1[_0x3ad1('0x6f')])[_0x3ad1('0x18')](function(_0x4332c6){_0x20c035(null,_0x4332c6);})[_0x3ad1('0x16')](function(_0x229027){_0x20c035(_0x229027);});};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0x95')]=function(_0x5a1dbc){var _0xf251be=_[_0x3ad1('0x96')](verticesWithRetry,_0x5a1dbc[_0x3ad1('0x97')])?_0x5a1dbc:_[_0x3ad1('0x98')](_0x5a1dbc);for(var _0x45fae5 in _0xf251be){if(_0xf251be['hasOwnProperty'](_0x45fae5)){if(_0xf251be[_0x45fae5]&&_[_0x3ad1('0x99')](_0xf251be[_0x45fae5])){if(_[_0x3ad1('0x96')](recursiveMapAttributes,_0x45fae5)){_0xf251be[_0x45fae5]=this[_0x3ad1('0x9a')](_0xf251be[_0x45fae5]);}else{_0xf251be[_0x45fae5]=this[_0x3ad1('0x9b')](_0xf251be[_0x45fae5]);}}}}return _0xf251be;};AGIVertices['prototype']['recursiveNodeIndex']=function(_0xe76bdd){for(var _0x3f41f9 in _0xe76bdd){if(_0xe76bdd[_0x3ad1('0x9c')](_0x3f41f9)){if(_['isPlainObject'](_0xe76bdd[_0x3f41f9])){this['recursiveNodeIndex'](_0xe76bdd[_0x3f41f9]);}else if(_[_0x3ad1('0x9d')](_0xe76bdd[_0x3f41f9])){for(var _0x286097=0x0;_0x286097<_0xe76bdd[_0x3f41f9][_0x3ad1('0x9e')];_0x286097++){this['recursiveNodeIndex'](_0xe76bdd[_0x3f41f9][_0x286097]);}}else if(_[_0x3ad1('0x99')](_0xe76bdd[_0x3f41f9])){_0xe76bdd[_0x3f41f9]=this['replaceAllVariables'](_0xe76bdd[_0x3f41f9]);}}}};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0x9f')]=function(_0x49620e,_0x2b0b51){for(var _0x5a877a in _0x49620e){if(_0x49620e[_0x3ad1('0x9c')](_0x5a877a)){if(_[_0x3ad1('0xa0')](_0x49620e[_0x5a877a])){if(!_[_0x3ad1('0x43')](_0x49620e[_0x5a877a])){this[_0x3ad1('0x9f')](_0x49620e[_0x5a877a],util[_0x3ad1('0x2b')](_0x3ad1('0xa1'),_0x2b0b51,_0x5a877a));}}else if(_['isArray'](_0x49620e[_0x5a877a])){for(var _0x100f8e=0x0;_0x100f8e<_0x49620e[_0x5a877a][_0x3ad1('0x9e')];_0x100f8e++){this[_0x3ad1('0x9f')](_0x49620e[_0x5a877a][_0x100f8e],util[_0x3ad1('0x2b')](_0x3ad1('0xa1'),_0x2b0b51,_0x5a877a+'['+_0x100f8e+']'));}}else{if(!_['isNil'](_0x49620e[_0x5a877a])){this['channel'][_0x3ad1('0xa2')](util[_0x3ad1('0x2b')](_0x3ad1('0xa1'),_0x2b0b51,_0x5a877a),_0x49620e[_0x5a877a]);}}}}};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0x9a')]=function(_0xc0e05a){try{var _0x20494f=JSON[_0x3ad1('0x69')](_0xc0e05a);this['recursiveNodeIndex'](_0x20494f);return JSON[_0x3ad1('0x72')](_0x20494f);}catch(_0x1776f2){return this[_0x3ad1('0x9b')](_0xc0e05a);}};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0x9b')]=function(_0x1715c2){var _0x2e3f04=_0x1715c2[_0x3ad1('0xa3')]('{');for(var _0xef5c3d=0x1;_0xef5c3d<_0x2e3f04[_0x3ad1('0x9e')];_0xef5c3d+=0x1){var _0x2f2acc=_0x2e3f04[_0xef5c3d][_0x3ad1('0xa3')]('}');if(_0x2f2acc[_0x3ad1('0x9e')]>0x1){_0x1715c2=_0x1715c2[_0x3ad1('0xa4')]('{'+_0x2f2acc[0x0]+'}',this['channel'][_0x3ad1('0x13')](_0x2f2acc[0x0])[_0x3ad1('0xa5')]||_0x2f2acc[0x0]);}}if(_0x2e3f04[_0x3ad1('0x9e')]===0x1){return _0x1715c2[_0x3ad1('0x4b')]();}return this[_0x3ad1('0x9b')](_0x1715c2);};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0xa6')]=function(_0x5100c8,_0x53be58){var _0x38490d=this['channel'][_0x3ad1('0x13')](_0x5100c8);if(_0x38490d[_0x3ad1('0xa7')]===-0x1){return _0x38490d;}logger['info'](util['format'](_0x3ad1('0xa8'),_0x53be58,_0x38490d[_0x3ad1('0xa5')]));return this['channel']['setVariable'](_0x53be58,_0x38490d[_0x3ad1('0xa5')]);};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0x85')]=function(_0x46656f){return _0x46656f&&_0x46656f!=='0'&&_0x46656f!=='-1'&&_0x46656f!=='';};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0xa9')]=function(_0x39c619){this[_0x3ad1('0x36')][_0x3ad1('0x6e')](this,_0x39c619,'-');_0x39c619['retry']=_0x39c619['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x3ad1('0x12')]['mrcpsynth']=function(_0x69eefc){logger[_0x3ad1('0x2e')](util[_0x3ad1('0x2b')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x69eefc[_0x3ad1('0x38')]));if(!this[_0x3ad1('0x85')](_0x69eefc[_0x3ad1('0x5a')])){return this[_0x3ad1('0x10')][_0x3ad1('0xaa')](_0x3ad1('0xab'));}var _0x674b1='\x22'+_0x69eefc[_0x3ad1('0x5a')]+'\x22';if(this[_0x3ad1('0x85')](_0x69eefc[_0x3ad1('0x78')])){_0x674b1+=','+_0x69eefc[_0x3ad1('0x78')];}var _0xd74b22=this[_0x3ad1('0x10')]['exec'](_0x3ad1('0xac'),_0x674b1);if(_0xd74b22['result']===-0x1){return _0xd74b22;}return this[_0x3ad1('0x10')][_0x3ad1('0xaa')](util[_0x3ad1('0x2b')](_0x3ad1('0xad'),_0x674b1));};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0xae')]=function(_0x3309fe){logger['info'](util[_0x3ad1('0x2b')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x3309fe[_0x3ad1('0x38')]));if(!this[_0x3ad1('0x85')](_0x3309fe['grammar'])){return this[_0x3ad1('0x10')][_0x3ad1('0xaa')](_0x3ad1('0xaf'));}var _0x561369=_0x3309fe[_0x3ad1('0xb0')];if(this[_0x3ad1('0x85')](_0x3309fe[_0x3ad1('0x78')])){_0x561369+=','+_0x3309fe[_0x3ad1('0x78')];}var _0x198ca1=this[_0x3ad1('0x10')][_0x3ad1('0x55')](_0x3ad1('0xb1'),_0x561369);if(_0x198ca1['result']===-0x1){return _0x198ca1;}var _0x17c20c=this[_0x3ad1('0xa6')](_0x3ad1('0xb2'),'MRCP_RECOG_CONFIDENCE');if(_0x17c20c[_0x3ad1('0xa7')]===-0x1){return _0x17c20c;}var _0x3166fe=this[_0x3ad1('0xa6')](_0x3ad1('0xb3'),_0x3ad1('0xb4'));if(_0x3166fe['result']===-0x1){return _0x3166fe;}var _0x41d4cd=this[_0x3ad1('0xa6')](_0x3ad1('0xb5'),_0x3ad1('0xb6'));if(_0x41d4cd[_0x3ad1('0xa7')]===-0x1){return _0x41d4cd;}return this[_0x3ad1('0x10')]['noop'](util[_0x3ad1('0x2b')](_0x3ad1('0xb7'),_0x561369));};AGIVertices['prototype']['agi']=function(_0x536270){logger[_0x3ad1('0x2e')](util[_0x3ad1('0x2b')](_0x3ad1('0xb8'),_0x536270[_0x3ad1('0x38')]));return this['channel']['agi']([_0x536270[_0x3ad1('0xb9')],_0x536270[_0x3ad1('0xba')]]);};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0xbb')]=function(_0x5e2c45){logger[_0x3ad1('0x2e')](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x5e2c45[_0x3ad1('0x38')]));if(this[_0x3ad1('0x85')](_0x5e2c45[_0x3ad1('0x64')])){logger[_0x3ad1('0x2e')](util[_0x3ad1('0x2b')](_0x3ad1('0xbc'),_0x5e2c45['timeout']));var _0x44559d=this[_0x3ad1('0x10')]['wait'](_0x5e2c45['timeout']);if(_0x44559d[_0x3ad1('0xa7')]===-0x1){return _0x44559d;}}return this[_0x3ad1('0x10')][_0x3ad1('0xbb')]();};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0xbd')]=function(_0x926203){logger[_0x3ad1('0x2e')](util[_0x3ad1('0x2b')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x926203[_0x3ad1('0x38')]));if(!this['isConfigured'](_0x926203[_0x3ad1('0x48')])){return this[_0x3ad1('0x10')][_0x3ad1('0x2d')](_0x926203,_0x3ad1('0xbe'));}_0x926203[_0x3ad1('0x49')]=moment();if(this[_0x3ad1('0x85')](_0x926203[_0x3ad1('0xbf')])){_0x926203[_0x3ad1('0x49')]=moment()['add'](_0x926203['delay'],_0x3ad1('0xc0'));}if(!this[_0x3ad1('0x85')](_0x926203[_0x3ad1('0x4c')])){_0x926203[_0x3ad1('0x4c')]=0x2;}this[_0x3ad1('0x42')]['sync'](this,_0x926203);return this[_0x3ad1('0x10')][_0x3ad1('0xaa')](util[_0x3ad1('0x2b')](_0x3ad1('0xc1'),_0x926203[_0x3ad1('0x47')],_0x926203[_0x3ad1('0x48')],_0x926203[_0x3ad1('0x49')]));};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0xc2')]=function(_0x58bd36){logger['info'](util[_0x3ad1('0x2b')](_0x3ad1('0xc3'),_0x58bd36[_0x3ad1('0x38')]));var _0x2f88b1=this[_0x3ad1('0x10')][_0x3ad1('0x55')](_0x58bd36[_0x3ad1('0xc4')],_0x58bd36[_0x3ad1('0x78')]);if(_0x2f88b1['result']===-0x1){return _0x2f88b1;}return this[_0x3ad1('0x10')][_0x3ad1('0xaa')](util[_0x3ad1('0x2b')](_0x3ad1('0xc5'),_0x58bd36[_0x3ad1('0xc4')],_0x58bd36['options']));};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0xc6')]=function(_0x2ff69c){logger[_0x3ad1('0x2e')](util[_0x3ad1('0x2b')](_0x3ad1('0xc7'),_0x2ff69c[_0x3ad1('0x38')]));if(!this[_0x3ad1('0x85')](_0x2ff69c[_0x3ad1('0x5a')])){return this[_0x3ad1('0x10')][_0x3ad1('0xaa')]('no\x20text\x20configured');}var _0x46ab69='\x22'+_0x2ff69c[_0x3ad1('0x5a')]+'\x22';if(this[_0x3ad1('0x85')](_0x2ff69c[_0x3ad1('0x78')])){_0x46ab69+=','+_0x2ff69c[_0x3ad1('0x78')];}var _0x71cebf=this[_0x3ad1('0x10')][_0x3ad1('0x55')](_0x3ad1('0xac'),_0x46ab69);if(_0x71cebf[_0x3ad1('0xa7')]===-0x1){return _0x71cebf;}return this[_0x3ad1('0x10')][_0x3ad1('0xaa')](util[_0x3ad1('0x2b')](_0x3ad1('0xad'),_0x46ab69));};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0xc8')]=function(_0x57bd39){logger[_0x3ad1('0x2e')](util[_0x3ad1('0x2b')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x57bd39[_0x3ad1('0x38')]));if(!this[_0x3ad1('0x85')](_0x57bd39[_0x3ad1('0x5a')])){return this[_0x3ad1('0x10')][_0x3ad1('0xaa')](_0x3ad1('0xab'));}var _0x90de06='\x22'+_0x57bd39[_0x3ad1('0x5a')]+'\x22';if(this['isConfigured'](_0x57bd39[_0x3ad1('0x78')])){_0x90de06+=','+_0x57bd39['options'];}var _0x2993b6=this[_0x3ad1('0x10')]['exec'](_0x3ad1('0xac'),_0x90de06);if(_0x2993b6[_0x3ad1('0xa7')]===-0x1){return _0x2993b6;}return this[_0x3ad1('0x10')][_0x3ad1('0xaa')](util['format'](_0x3ad1('0xad'),_0x90de06));};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0xc9')]=function(_0x22f561){logger[_0x3ad1('0x2e')](util[_0x3ad1('0x2b')](_0x3ad1('0xca'),_0x22f561[_0x3ad1('0x38')]));if(!this[_0x3ad1('0x85')](_0x22f561[_0x3ad1('0xb0')])){return this[_0x3ad1('0x10')][_0x3ad1('0xaa')](_0x3ad1('0xaf'));}var _0x243710=_0x22f561[_0x3ad1('0xb0')];if(this['isConfigured'](_0x22f561[_0x3ad1('0x78')])){_0x243710+=','+_0x22f561[_0x3ad1('0x78')];}var _0x13be87=this['channel'][_0x3ad1('0x55')]('MRCPRecog',_0x243710);if(_0x13be87[_0x3ad1('0xa7')]===-0x1){return _0x13be87;}var _0x15ab41=this[_0x3ad1('0xa6')](_0x3ad1('0xb2'),_0x3ad1('0xcb'));if(_0x15ab41[_0x3ad1('0xa7')]===-0x1){return _0x15ab41;}var _0x18f33c=this[_0x3ad1('0xa6')](_0x3ad1('0xb3'),_0x3ad1('0xcc'));if(_0x18f33c['result']===-0x1){return _0x18f33c;}var _0x566c0f=this[_0x3ad1('0xa6')](_0x3ad1('0xb5'),_0x3ad1('0xcd'));if(_0x566c0f['result']===-0x1){return _0x566c0f;}return this[_0x3ad1('0x10')][_0x3ad1('0xaa')](util[_0x3ad1('0x2b')](_0x3ad1('0xb7'),_0x243710));};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0xce')]=function(_0x594959){logger[_0x3ad1('0x2e')](util[_0x3ad1('0x2b')](_0x3ad1('0xcf'),_0x594959[_0x3ad1('0x38')]));if(!this[_0x3ad1('0x85')](_0x594959['grammar'])){return this[_0x3ad1('0x10')]['noop'](_0x3ad1('0xaf'));}var _0x272b77=_0x594959[_0x3ad1('0xb0')];if(this[_0x3ad1('0x85')](_0x594959['options'])){_0x272b77+=','+_0x594959[_0x3ad1('0x78')];}var _0x58003a=this[_0x3ad1('0x10')][_0x3ad1('0x55')](_0x3ad1('0xb1'),_0x272b77);if(_0x58003a[_0x3ad1('0xa7')]===-0x1){return _0x58003a;}var _0x43a107=this['getAndSetVariable'](_0x3ad1('0xb2'),_0x3ad1('0xd0'));if(_0x43a107[_0x3ad1('0xa7')]===-0x1){return _0x43a107;}var _0x489553=this['getAndSetVariable']('RECOG_INPUT()',_0x3ad1('0xd1'));if(_0x489553[_0x3ad1('0xa7')]===-0x1){return _0x489553;}var _0x35f5cd=this['getAndSetVariable'](_0x3ad1('0xb5'),'SESTEK_ASR_INSTANCE');if(_0x35f5cd[_0x3ad1('0xa7')]===-0x1){return _0x35f5cd;}return this[_0x3ad1('0x10')]['noop'](util[_0x3ad1('0x2b')](_0x3ad1('0xb7'),_0x272b77));};AGIVertices[_0x3ad1('0x12')]['database']=function(_0x25fffc){logger[_0x3ad1('0x2e')](util[_0x3ad1('0x2b')](_0x3ad1('0xd2'),_0x25fffc['label']));if(!this['isConfigured'](_0x25fffc[_0x3ad1('0xd3')])){return this[_0x3ad1('0x10')]['error'](_0x25fffc,_0x3ad1('0xd4'));}var _0x4dcc1f=this[_0x3ad1('0x1a')][_0x3ad1('0x6e')](this,_0x25fffc[_0x3ad1('0xd3')]);if(!_0x4dcc1f){return this[_0x3ad1('0x10')][_0x3ad1('0x2d')](_0x25fffc,_0x3ad1('0xd5'));}if(!this[_0x3ad1('0x85')](_0x25fffc[_0x3ad1('0xd6')])){return this[_0x3ad1('0x10')][_0x3ad1('0x2d')](_0x25fffc,_0x3ad1('0xd7'));}var _0x207f38=_0x25fffc[_0x3ad1('0xd6')][_0x3ad1('0x57')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x3ad1('0xaa')](util[_0x3ad1('0x2b')](_0x3ad1('0xd8'),_0x207f38));var _0x5a35fa=this[_0x3ad1('0xd9')][_0x3ad1('0x6e')](this,_0x4dcc1f,_0x207f38);this['createSquareDetailsReport'][_0x3ad1('0x6e')](this,_0x25fffc,_0x207f38);if(!this['isConfigured'](_0x25fffc['variable_id'])){return this[_0x3ad1('0x10')][_0x3ad1('0xaa')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x329517=this[_0x3ad1('0x13')][_0x3ad1('0x6e')](this,_0x25fffc['variable_id']);if(!_0x329517){return this[_0x3ad1('0x10')][_0x3ad1('0x2d')](_0x25fffc,_0x3ad1('0xda'));}var _0x1aa304=this;_0x5a35fa['forEach'](function(_0x309b14,_0x20fbde){Object['keys'](_0x309b14)['forEach'](function(_0x1485f5){_0x1aa304['channel'][_0x3ad1('0xa2')](util[_0x3ad1('0x2b')](_0x3ad1('0xdb'),_0x329517,_0x20fbde,_0x1485f5),_0x309b14[_0x1485f5]);});});this['channel']['setVariable'](util[_0x3ad1('0x2b')](_0x3ad1('0xdc'),_0x329517),_0x5a35fa[_0x3ad1('0x9e')]);return this[_0x3ad1('0x10')][_0x3ad1('0xaa')](util[_0x3ad1('0x2b')]('variable\x20%s\x20set',_0x329517));};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0xdd')]=function(_0x445a80){logger[_0x3ad1('0xde')](util[_0x3ad1('0x2b')](_0x3ad1('0xdf'),_0x445a80['label']));if(!this[_0x3ad1('0x85')](_0x445a80['sip_id'])){return this[_0x3ad1('0x10')][_0x3ad1('0x2d')](_0x445a80,_0x3ad1('0xe0'));}var _0x34fa26=this['getUser'][_0x3ad1('0x6e')](this,_0x445a80[_0x3ad1('0xe1')]);if(!_0x34fa26){return this['channel']['error'](_0x445a80,_0x3ad1('0xe2'));}var _0x171b9a=this[_0x3ad1('0x10')]['exec']('DIAL',[util[_0x3ad1('0x2b')](_0x3ad1('0xe3'),_0x34fa26),_0x445a80[_0x3ad1('0x64')],_0x445a80[_0x3ad1('0xe4')],_0x445a80['url']]);if(_0x171b9a[_0x3ad1('0xa7')]===-0x1){return _0x171b9a;}return this[_0x3ad1('0x10')][_0x3ad1('0xaa')](util[_0x3ad1('0x2b')](_0x3ad1('0xe5'),_0x3ad1('0xe6')));};AGIVertices['prototype']['dialogflow']=function(_0x2c6fd7){logger[_0x3ad1('0x2e')](util['format']('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x2c6fd7['label']));if(!this[_0x3ad1('0x85')](_0x2c6fd7[_0x3ad1('0x7a')])){return this[_0x3ad1('0x10')][_0x3ad1('0xaa')](_0x3ad1('0xe7'));}if(!this['isConfigured'](_0x2c6fd7[_0x3ad1('0x5a')])){return this[_0x3ad1('0x10')][_0x3ad1('0xaa')](_0x3ad1('0xab'));}this[_0x3ad1('0x10')]['bot']=!![];this[_0x3ad1('0x36')](_0x2c6fd7);this[_0x3ad1('0x41')](_0x2c6fd7[_0x3ad1('0x5a')],'in','','');this[_0x3ad1('0x10')]['noop'](util['format'](_0x3ad1('0xe8'),_0x2c6fd7[_0x3ad1('0x5a')]));var _0x5406a9=this[_0x3ad1('0x79')][_0x3ad1('0x6e')](this,_0x2c6fd7);if(_0x5406a9){for(var _0x5cabf8 in _0x5406a9){if(_0x5406a9[_0x3ad1('0x9c')](_0x5cabf8)){this['channel'][_0x3ad1('0xa2')](util[_0x3ad1('0x2b')](_0x3ad1('0xe9'),_0x5cabf8['toUpperCase']()),_0x5406a9[_0x5cabf8]);}}this['createSquareMessage'](_0x5406a9[_0x3ad1('0xea')],_0x3ad1('0xeb'),_0x3ad1('0xec'),'');return this[_0x3ad1('0x10')][_0x3ad1('0xaa')](util[_0x3ad1('0x2b')](_0x3ad1('0xed'),_0x5406a9[_0x3ad1('0xea')]));}return this[_0x3ad1('0x10')][_0x3ad1('0x2d')](_0x2c6fd7,_0x3ad1('0xee'));};AGIVertices[_0x3ad1('0x12')]['dialogflowV2']=function(_0x43718b){logger['info'](util[_0x3ad1('0x2b')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x43718b['label']));if(!this[_0x3ad1('0x85')](_0x43718b[_0x3ad1('0x7c')])){return this[_0x3ad1('0x10')][_0x3ad1('0xaa')](_0x3ad1('0xef'));}if(!this[_0x3ad1('0x85')](_0x43718b[_0x3ad1('0x7d')])){return this[_0x3ad1('0x10')]['noop'](_0x3ad1('0xf0'));}if(!this[_0x3ad1('0x85')](_0x43718b['private_key'])){return this['channel'][_0x3ad1('0xaa')](_0x3ad1('0xf1'));}if(!this[_0x3ad1('0x85')](_0x43718b[_0x3ad1('0xf2')])){return this[_0x3ad1('0x10')][_0x3ad1('0xaa')](_0x3ad1('0xf3'));}if(!this[_0x3ad1('0x85')](_0x43718b['text'])){return this[_0x3ad1('0x10')]['noop'](_0x3ad1('0xab'));}this[_0x3ad1('0x10')][_0x3ad1('0xf4')]=!![];this[_0x3ad1('0x36')](_0x43718b);this[_0x3ad1('0x41')](_0x43718b[_0x3ad1('0x5a')],'in','','');this[_0x3ad1('0x10')]['noop'](util[_0x3ad1('0x2b')](_0x3ad1('0xf5'),_0x43718b[_0x3ad1('0x5a')]));var _0xd4fecc=this[_0x3ad1('0x7b')][_0x3ad1('0x6e')](this,_0x43718b);if(_0xd4fecc){for(var _0x522f3c in _0xd4fecc){if(_0xd4fecc[_0x3ad1('0x9c')](_0x522f3c)){if(_0x522f3c!==_0x3ad1('0xf6')){this[_0x3ad1('0x10')][_0x3ad1('0xa2')](util[_0x3ad1('0x2b')](_0x3ad1('0xe9'),_0x522f3c[_0x3ad1('0x67')]()),_0xd4fecc[_0x522f3c]);}}}this[_0x3ad1('0x41')](_0xd4fecc['speech'],_0x3ad1('0xeb'),_0x3ad1('0xf7'),_0xd4fecc[_0x3ad1('0xf6')]);return this['channel'][_0x3ad1('0xaa')](util[_0x3ad1('0x2b')](_0x3ad1('0xf8'),_0xd4fecc[_0x3ad1('0xea')]));}return this[_0x3ad1('0x10')]['error'](_0x43718b,_0x3ad1('0xf9'));};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0xfa')]=function(_0x117b61){logger[_0x3ad1('0x2e')](util[_0x3ad1('0x2b')](_0x3ad1('0xfb'),_0x117b61[_0x3ad1('0x38')]));if(!this[_0x3ad1('0x85')](_0x117b61[_0x3ad1('0xfc')])){return this[_0x3ad1('0x10')][_0x3ad1('0xaa')](_0x3ad1('0xfd'));}if(!this[_0x3ad1('0x85')](_0x117b61[_0x3ad1('0xfe')])){return this['channel'][_0x3ad1('0xaa')]('no\x20username\x20configured');}if(!this[_0x3ad1('0x85')](_0x117b61[_0x3ad1('0xff')])){return this[_0x3ad1('0x10')]['noop'](_0x3ad1('0x100'));}if(!this[_0x3ad1('0x85')](_0x117b61[_0x3ad1('0x101')])){return this[_0x3ad1('0x10')][_0x3ad1('0xaa')](_0x3ad1('0xab'));}this[_0x3ad1('0x10')]['bot']=!![];this['createSquareDetailsReport'](_0x117b61);this[_0x3ad1('0x41')](_0x117b61['text'],'in','','');this[_0x3ad1('0x10')][_0x3ad1('0xaa')](util[_0x3ad1('0x2b')](_0x3ad1('0x102'),_0x117b61['text']));var _0x3e0aec=this[_0x3ad1('0x7f')][_0x3ad1('0x6e')](this,_0x117b61);if(_0x3e0aec){for(var _0xa82c41 in _0x3e0aec){if(_0x3e0aec[_0x3ad1('0x9c')](_0xa82c41)){this[_0x3ad1('0x10')][_0x3ad1('0xa2')](util[_0x3ad1('0x2b')](_0x3ad1('0x103'),_0xa82c41[_0x3ad1('0x67')]()),_0x3e0aec[_0xa82c41]);}}this['createSquareMessage'](_0x3e0aec['speech'],_0x3ad1('0xeb'),_0x3ad1('0xfa'),'');if(_0x3e0aec[_0x3ad1('0x104')]){this[_0x3ad1('0x10')][_0x3ad1('0xaa')](util[_0x3ad1('0x2b')](_0x3ad1('0x105'),_0x3e0aec['audiofile']));var _0x47ee23=this[_0x3ad1('0x10')]['streamFile'](_0x3e0aec['audiofile']);try{fs[_0x3ad1('0x106')](_0x3e0aec['audiofile']+_0x3ad1('0x107'));}catch(_0x568757){logger[_0x3ad1('0x2d')](_0x568757);}return _0x47ee23;}else{return this[_0x3ad1('0x10')][_0x3ad1('0xaa')](util['format'](_0x3ad1('0x108'),_0x3e0aec[_0x3ad1('0xea')]));}}return this[_0x3ad1('0x10')][_0x3ad1('0x2d')](_0x117b61,_0x3ad1('0x109'));};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0x10a')]=function(_0x286da7){logger['info'](util[_0x3ad1('0x2b')](_0x3ad1('0x10b'),_0x286da7['label']));return this[_0x3ad1('0x10')][_0x3ad1('0xaa')]('end');};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0x10c')]=function(_0x44f1ae){logger[_0x3ad1('0x2e')](util[_0x3ad1('0x2b')](_0x3ad1('0x10d'),_0x44f1ae[_0x3ad1('0x38')]));var _0x3d0cdf='';if(_0x44f1ae[_0x3ad1('0x10e')]){if(!this[_0x3ad1('0x85')](_0x44f1ae[_0x3ad1('0x10e')])){return this[_0x3ad1('0x10')]['error'](_0x44f1ae,_0x3ad1('0x10f'));}else{var _0x39c865=parseInt(_0x44f1ae[_0x3ad1('0x10e')],0xa);if(isNaN(_0x39c865)){_0x3d0cdf=_0x44f1ae[_0x3ad1('0x10e')];}else{_0x3d0cdf=this['getTrunk'][_0x3ad1('0x6e')](this,_0x44f1ae['trunk_id']);if(!_0x3d0cdf){return this[_0x3ad1('0x10')][_0x3ad1('0x2d')](_0x44f1ae,'no\x20trunk\x20found');}}}}else if(_0x44f1ae[_0x3ad1('0x110')]){_0x3d0cdf=_0x44f1ae[_0x3ad1('0x110')];}else{return this[_0x3ad1('0x10')][_0x3ad1('0x2d')](_0x44f1ae,_0x3ad1('0x10f'));}var _0x5884b6=this[_0x3ad1('0x10')][_0x3ad1('0x55')]('DIAL',[util[_0x3ad1('0x2b')]('SIP/%s/%s',_0x3d0cdf,_0x44f1ae['phone']),_0x44f1ae[_0x3ad1('0x64')],_0x44f1ae['opts'],_0x44f1ae[_0x3ad1('0x71')]]);if(_0x5884b6[_0x3ad1('0xa7')]===-0x1){return _0x5884b6;}return this['channel'][_0x3ad1('0xaa')](util[_0x3ad1('0x2b')](_0x3ad1('0xe5'),_0x3ad1('0xe6')));};AGIVertices[_0x3ad1('0x12')]['finally']=function(_0x43039e){logger[_0x3ad1('0x2e')](util[_0x3ad1('0x2b')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x43039e[_0x3ad1('0x38')]));return this[_0x3ad1('0x10')][_0x3ad1('0xaa')](_0x3ad1('0x111'));};AGIVertices['prototype'][_0x3ad1('0x112')]=function(_0x5c9e03){logger['info'](util['format'](_0x3ad1('0x113'),_0x5c9e03[_0x3ad1('0x38')]));if(_0x5c9e03['retry']===0x0){return this['maxRetry'](_0x5c9e03);}_0x5c9e03[_0x3ad1('0x114')]-=0x1;if(!this[_0x3ad1('0x85')](_0x5c9e03[_0x3ad1('0x115')])){return this[_0x3ad1('0x10')][_0x3ad1('0x2d')](_0x5c9e03,_0x3ad1('0x116'));}var _0xd76b07=this[_0x3ad1('0x20')][_0x3ad1('0x6e')](this,_0x5c9e03[_0x3ad1('0x115')]);if(!_0xd76b07){return this[_0x3ad1('0x10')][_0x3ad1('0x2d')](_0x5c9e03,_0x3ad1('0x117'));}if(!this[_0x3ad1('0x85')](_0x5c9e03[_0x3ad1('0x118')])){return this[_0x3ad1('0x10')][_0x3ad1('0x2d')](_0x3ad1('0x119'));}var _0x4f252a=this['channel'][_0x3ad1('0x11a')](_0xd76b07,_0x5c9e03[_0x3ad1('0x11b')],_0x5c9e03[_0x3ad1('0x11c')]);var _0x244076=_0x4f252a[_0x3ad1('0xa7')]?_0x4f252a[_0x3ad1('0xa7')][_0x3ad1('0x4b')]():'';logger[_0x3ad1('0x2e')](_0x3ad1('0x11d'),JSON[_0x3ad1('0x72')](_0x4f252a));if(_0x4f252a[_0x3ad1('0xa7')]===-0x1){this[_0x3ad1('0x36')][_0x3ad1('0x6e')](this,_0x5c9e03,_0x244076);return _0x4f252a;}else if(_0x4f252a[_0x3ad1('0xa5')]===_0x3ad1('0x64')){_0x4f252a[_0x3ad1('0xa7')]=_0x244076['length']>=parseInt(_0x5c9e03[_0x3ad1('0x11e')])?'x':'i';}else{_0x4f252a[_0x3ad1('0xa7')]=_0x244076[_0x3ad1('0x9e')]>=parseInt(_0x5c9e03['mindigit'])&&_0x244076[_0x3ad1('0x9e')]<=parseInt(_0x5c9e03[_0x3ad1('0x11c')])?'x':'i';}var _0x408dd9=this[_0x3ad1('0x13')][_0x3ad1('0x6e')](this,_0x5c9e03['variable_id']);if(!_0x408dd9){return this['channel'][_0x3ad1('0x2d')](_0x5c9e03,_0x3ad1('0xda'));}this[_0x3ad1('0x10')][_0x3ad1('0xa2')](_0x408dd9,_0x244076);if(this['isConfigured'](_0x5c9e03[_0x3ad1('0x11f')])){var _0x49f4d3=parseInt(_0x5c9e03['hiddendigitsnum'],0xa);var _0x1f9955=rs[_0x3ad1('0x120')]({'charset':'*','length':_0x49f4d3});var _0xaffe89=_0x244076[_0x3ad1('0x9e')];if(_0xaffe89>0x0){if(_0xaffe89>_0x49f4d3){this['createSquareDetailsReport'][_0x3ad1('0x6e')](this,_0x5c9e03,_0x5c9e03[_0x3ad1('0x121')]==='first'?_0x1f9955+_0x244076[_0x3ad1('0x122')](_0x49f4d3):_0x244076[_0x3ad1('0x122')](0x0,_0xaffe89-_0x49f4d3)+_0x1f9955);}else{this['createSquareDetailsReport'][_0x3ad1('0x6e')](this,_0x5c9e03,rs['generate']({'charset':'*','length':_0xaffe89}));}}else{this[_0x3ad1('0x36')]['sync'](this,_0x5c9e03,'');}}else{this['createSquareDetailsReport'][_0x3ad1('0x6e')](this,_0x5c9e03,_0x244076);}return _0x4f252a;};AGIVertices['prototype'][_0x3ad1('0xf')]=function(_0x436a65){logger['info'](util['format'](_0x3ad1('0x123'),_0x436a65[_0x3ad1('0x38')]));return this[_0x3ad1('0x112')](_0x436a65);};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0x124')]=function(_0x167ca7){logger[_0x3ad1('0x2e')](util[_0x3ad1('0x2b')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x167ca7[_0x3ad1('0x38')]));this[_0x3ad1('0x36')][_0x3ad1('0x6e')](this,_0x167ca7,_0x167ca7[_0x3ad1('0x125')]);return this[_0x3ad1('0x10')]['noop'](util['format'](_0x3ad1('0x126'),_0x167ca7[_0x3ad1('0x125')]));};AGIVertices['prototype'][_0x3ad1('0x127')]=function(_0x36a9e2){logger[_0x3ad1('0x2e')](util['format']('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x36a9e2['label']));if(!this[_0x3ad1('0x85')](_0x36a9e2[_0x3ad1('0x88')])||!this[_0x3ad1('0x85')](_0x36a9e2[_0x3ad1('0x128')])){return this['channel'][_0x3ad1('0xaa')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x3ad1('0x85')](_0x36a9e2[_0x3ad1('0x5a')])){return this[_0x3ad1('0x10')][_0x3ad1('0xaa')](_0x3ad1('0xab'));}this[_0x3ad1('0x10')]['noop'](util[_0x3ad1('0x2b')](_0x3ad1('0x129'),_0x36a9e2[_0x3ad1('0x5a')]));var _0x26e693=this[_0x3ad1('0x87')][_0x3ad1('0x6e')](this,_0x36a9e2);if(_0x26e693){this[_0x3ad1('0x10')]['noop'](util[_0x3ad1('0x2b')](_0x3ad1('0x12a'),_0x26e693));var _0x11a39c=this[_0x3ad1('0x10')][_0x3ad1('0x12b')](_0x26e693);try{fs[_0x3ad1('0x106')](_0x26e693+'.wav');}catch(_0x57e67f){logger[_0x3ad1('0x2d')](_0x57e67f);}return _0x11a39c;}return this[_0x3ad1('0x10')][_0x3ad1('0x2d')](_0x36a9e2,_0x3ad1('0x12c'));};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0x12d')]=function(_0xfb21e1){logger[_0x3ad1('0x2e')](util[_0x3ad1('0x2b')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0xfb21e1[_0x3ad1('0x38')]));if(!this['isConfigured'](_0xfb21e1[_0x3ad1('0x88')])||!this[_0x3ad1('0x85')](_0xfb21e1['aws_secret_access_key'])){return this[_0x3ad1('0x10')][_0x3ad1('0xaa')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0xfb21e1[_0x3ad1('0x8f')])){return this[_0x3ad1('0x10')][_0x3ad1('0xaa')](_0x3ad1('0x12e'));}if(!this['isConfigured'](_0xfb21e1[_0x3ad1('0x5a')])){return this[_0x3ad1('0x10')][_0x3ad1('0xaa')](_0x3ad1('0xab'));}this[_0x3ad1('0x10')][_0x3ad1('0xf4')]=!![];this[_0x3ad1('0x36')](_0xfb21e1);this[_0x3ad1('0x41')](_0xfb21e1[_0x3ad1('0x5a')],'in','','');this['channel'][_0x3ad1('0xaa')](util[_0x3ad1('0x2b')]('Trying\x20Amazon\x20Lex:\x20%s',_0xfb21e1['text']));var _0x343afe=this[_0x3ad1('0x8d')][_0x3ad1('0x6e')](this,_0xfb21e1);if(_0x343afe){for(var _0x35ab89 in _0x343afe){if(_0x343afe[_0x3ad1('0x9c')](_0x35ab89)&&_[_0x3ad1('0x99')](_0x343afe[_0x35ab89])){this[_0x3ad1('0x10')][_0x3ad1('0xa2')](util[_0x3ad1('0x2b')](_0x3ad1('0x12f'),_0x35ab89[_0x3ad1('0x67')]()),_0x343afe[_0x35ab89]);}}if(_[_0x3ad1('0x44')](_0x343afe[_0x3ad1('0x76')])){return this[_0x3ad1('0x10')][_0x3ad1('0xaa')](_0x3ad1('0x130'));}else{this[_0x3ad1('0x41')](_0x343afe['message'],_0x3ad1('0xeb'),_0x3ad1('0x131'),'');return this[_0x3ad1('0x10')][_0x3ad1('0xaa')](util['format'](_0x3ad1('0x132'),_0x343afe[_0x3ad1('0x76')]));}}return this[_0x3ad1('0x10')]['error'](_0xfb21e1,_0x3ad1('0x133'));};AGIVertices[_0x3ad1('0x12')]['googleasr']=function(_0x4594ac){logger[_0x3ad1('0x2e')](util[_0x3ad1('0x2b')](_0x3ad1('0x134'),_0x4594ac[_0x3ad1('0x38')],_0x4594ac['timeout']));if(!this[_0x3ad1('0x85')](_0x4594ac[_0x3ad1('0x7a')])){return this[_0x3ad1('0x10')][_0x3ad1('0xaa')](_0x3ad1('0xe7'));}var _0x5341e8='wav';var _0x29afe0=util[_0x3ad1('0x2b')](_0x3ad1('0x135'),FILES_PATH,rs['generate'](0x4));var _0x5f38f8=util[_0x3ad1('0x2b')]('%s.%s',_0x29afe0,_0x5341e8);var _0x53aaf7=!![];if(_0x4594ac[_0x3ad1('0x136')]===_0x3ad1('0x137')){_0x53aaf7=![];}var _0x404176=this['channel'][_0x3ad1('0x138')](_0x29afe0,_0x5341e8,_0x4594ac[_0x3ad1('0x139')],_0x4594ac[_0x3ad1('0x64')],undefined,_0x53aaf7);if(_0x404176[_0x3ad1('0xa7')]!==-0x1){this[_0x3ad1('0x10')]['noop'](util[_0x3ad1('0x2b')](_0x3ad1('0x13a'),_0x5f38f8));var _0x227533=this['googleASR'][_0x3ad1('0x6e')](this,_0x4594ac,_0x5f38f8);if(_0x227533){for(var _0x387a93 in _0x227533){if(_0x227533[_0x3ad1('0x9c')](_0x387a93)){this[_0x3ad1('0x10')][_0x3ad1('0xa2')](util['format']('GOOGLE_ASR_%s',_0x387a93[_0x3ad1('0x67')]()),_0x227533[_0x387a93]);}}return this[_0x3ad1('0x10')][_0x3ad1('0xaa')](util[_0x3ad1('0x2b')](_0x3ad1('0x13b'),JSON['stringify'](_0x227533)));}}return _0x404176;};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0x13c')]=function(_0x4cc9ca){logger[_0x3ad1('0x2e')](util['format'](_0x3ad1('0x13d'),_0x4cc9ca[_0x3ad1('0x38')]));if(!this[_0x3ad1('0x85')](_0x4cc9ca[_0x3ad1('0x93')])){return this[_0x3ad1('0x10')]['noop'](_0x3ad1('0x13e'));}if(!this[_0x3ad1('0x85')](_0x4cc9ca['appsecret'])){return this[_0x3ad1('0x10')]['noop'](_0x3ad1('0x13f'));}var _0x58c318=_0x3ad1('0x140');var _0x313d29=util[_0x3ad1('0x2b')]('%s/recordings/%s',FILES_PATH,rs[_0x3ad1('0x120')](0x4));var _0xa82da2=util[_0x3ad1('0x2b')]('%s.%s',_0x313d29,_0x58c318);var _0x1d0e38=!![];if(_0x4cc9ca[_0x3ad1('0x136')]===_0x3ad1('0x137')){_0x1d0e38=![];}var _0x244c99=this[_0x3ad1('0x10')]['recordFile'](_0x313d29,_0x58c318,_0x4cc9ca[_0x3ad1('0x139')],_0x4cc9ca[_0x3ad1('0x64')],undefined,_0x1d0e38);if(_0x244c99[_0x3ad1('0xa7')]!==-0x1){this['channel'][_0x3ad1('0xaa')](util['format']('tilde\x20%s\x20file\x20created',_0xa82da2));var _0x2fd869=this['tildeASR']['sync'](this,_0x4cc9ca,_0xa82da2);if(_0x2fd869){for(var _0x3c9c8d in _0x2fd869){if(_0x2fd869[_0x3ad1('0x9c')](_0x3c9c8d)){this[_0x3ad1('0x10')][_0x3ad1('0xa2')](util['format'](_0x3ad1('0x141'),_0x3c9c8d[_0x3ad1('0x67')]()),_0x2fd869[_0x3c9c8d]);}}return this['channel'][_0x3ad1('0xaa')](util[_0x3ad1('0x2b')](_0x3ad1('0x142'),JSON[_0x3ad1('0x72')](_0x2fd869)));}}return _0x244c99;};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0x143')]=function(_0x2c703e){logger[_0x3ad1('0x2e')](util[_0x3ad1('0x2b')](_0x3ad1('0x144'),_0x2c703e[_0x3ad1('0x38')]));return this[_0x3ad1('0x10')][_0x3ad1('0x145')](_0x2c703e[_0x3ad1('0x3b')],_0x2c703e[_0x3ad1('0x3c')],_0x2c703e[_0x3ad1('0x3d')]);};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0x146')]=function(_0x1f8ce0){logger['info'](util[_0x3ad1('0x2b')](_0x3ad1('0x147'),_0x1f8ce0[_0x3ad1('0x38')]));if(!this[_0x3ad1('0x85')](_0x1f8ce0['condition'])){return this[_0x3ad1('0x10')][_0x3ad1('0x2d')](_0x1f8ce0,'no\x20condition\x20configured');}try{var _0x20c1d8=eval(_0x1f8ce0[_0x3ad1('0x148')])?_0x3ad1('0x149'):_0x3ad1('0x14a');this[_0x3ad1('0x10')]['noop'](util[_0x3ad1('0x2b')](_0x3ad1('0x14b'),_0x1f8ce0[_0x3ad1('0x148')],_0x20c1d8));return{'code':0xc8,'result':_0x20c1d8};}catch(_0x51853a){return{'code':0xc8,'result':_0x3ad1('0x14a')};}};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0x14c')]=function(_0x5c961e){logger[_0x3ad1('0x2e')](util['format'](_0x3ad1('0x14d'),_0x5c961e[_0x3ad1('0x38')]));if(!this[_0x3ad1('0x85')](_0x5c961e[_0x3ad1('0x14e')])){return this['channel'][_0x3ad1('0x2d')](_0x5c961e,_0x3ad1('0x14f'));}var _0x4c6fe4=this[_0x3ad1('0x150')][_0x3ad1('0x6e')](this,_0x5c961e['interval_id']);if(!_0x4c6fe4){return this['channel']['error'](_0x5c961e,_0x3ad1('0x151'));}for(var _0x1b23d1=0x0;_0x1b23d1<_0x4c6fe4[_0x3ad1('0x9e')];_0x1b23d1+=0x1){var _0x4b8de1=this['channel'][_0x3ad1('0x13')](util[_0x3ad1('0x2b')](_0x3ad1('0x152'),_0x4c6fe4[_0x1b23d1]));if(_0x4b8de1[_0x3ad1('0xa7')]===-0x1){return _0x4b8de1;}logger['info'](util[_0x3ad1('0x2b')]('IFTIME\x20%s\x20%s',_0x4c6fe4[_0x1b23d1],_0x4b8de1['extra']));if(_0x4b8de1[_0x3ad1('0xa5')]===_0x3ad1('0x149')){logger[_0x3ad1('0x2e')](util[_0x3ad1('0x2b')](_0x3ad1('0x153'),_0x4c6fe4[_0x1b23d1],_0x3ad1('0x149')));this[_0x3ad1('0x10')][_0x3ad1('0xaa')](util[_0x3ad1('0x2b')]('IFTIME\x20%s\x20%s',_0x4c6fe4[_0x1b23d1],'true'));return{'code':0xc8,'result':'true'};}else{logger[_0x3ad1('0x2e')](util[_0x3ad1('0x2b')]('IFTIME\x20%s\x20%s',_0x4c6fe4[_0x1b23d1],_0x3ad1('0x14a')));this[_0x3ad1('0x10')]['noop'](util['format']('IFTIME\x20%s\x20%s',_0x4c6fe4[_0x1b23d1],_0x3ad1('0x14a')));}}return{'code':0xc8,'result':_0x3ad1('0x14a')};};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0x154')]=function(_0x5055da){logger[_0x3ad1('0x2e')](util['format'](_0x3ad1('0x155'),_0x5055da[_0x3ad1('0x38')]));return this[_0x3ad1('0x10')][_0x3ad1('0x154')]();};AGIVertices['prototype'][_0x3ad1('0x156')]=function(_0x3adc5e){logger[_0x3ad1('0x2e')](util['format'](_0x3ad1('0x157'),_0x3adc5e[_0x3ad1('0x38')]));if(!this[_0x3ad1('0x85')](_0x3adc5e[_0x3ad1('0x7a')])){return this['channel'][_0x3ad1('0xaa')](_0x3ad1('0xe7'));}var _0x27e712=_0x3ad1('0x140');var _0x2b3f50=util['format'](_0x3ad1('0x135'),FILES_PATH,rs[_0x3ad1('0x120')](0x4));var _0x4a4f0b=util[_0x3ad1('0x2b')](_0x3ad1('0xa1'),_0x2b3f50,_0x27e712);var _0x5dac64=!![];if(_0x3adc5e[_0x3ad1('0x136')]===_0x3ad1('0x137')){_0x5dac64=![];}var _0x5d48ea=this[_0x3ad1('0x10')][_0x3ad1('0x138')](_0x2b3f50,_0x27e712,_0x3adc5e[_0x3ad1('0x139')],_0x3adc5e[_0x3ad1('0x64')],undefined,_0x5dac64);if(_0x5d48ea[_0x3ad1('0xa7')]!==-0x1){this[_0x3ad1('0x10')]['noop'](util[_0x3ad1('0x2b')](_0x3ad1('0x158'),_0x4a4f0b));var _0x410b85=this[_0x3ad1('0x83')][_0x3ad1('0x6e')](this,_0x3adc5e,_0x4a4f0b);if(_0x410b85){for(var _0x2a371e in _0x410b85){if(_0x410b85[_0x3ad1('0x9c')](_0x2a371e)){this[_0x3ad1('0x10')][_0x3ad1('0xa2')](util[_0x3ad1('0x2b')](_0x3ad1('0x159'),_0x2a371e['toUpperCase']()),_0x410b85[_0x2a371e]);}}return this['channel'][_0x3ad1('0xaa')](util[_0x3ad1('0x2b')](_0x3ad1('0x15a'),JSON[_0x3ad1('0x72')](_0x410b85)));}}return _0x5d48ea;};AGIVertices['prototype'][_0x3ad1('0x15b')]=function(_0x59ce59){logger['info'](util['format'](_0x3ad1('0x15c'),_0x59ce59[_0x3ad1('0x38')]));if(!this[_0x3ad1('0x85')](_0x59ce59[_0x3ad1('0x7a')])){return this[_0x3ad1('0x10')]['noop'](_0x3ad1('0xe7'));}if(!this[_0x3ad1('0x85')](_0x59ce59['text'])){return this[_0x3ad1('0x10')][_0x3ad1('0xaa')]('no\x20text\x20configured');}this[_0x3ad1('0x10')]['noop'](util[_0x3ad1('0x2b')](_0x3ad1('0x15d'),_0x59ce59[_0x3ad1('0x5a')]));var _0x5996da=this['ispeechTTS'][_0x3ad1('0x6e')](this,_0x59ce59);if(_0x5996da){this[_0x3ad1('0x10')][_0x3ad1('0xaa')](util[_0x3ad1('0x2b')](_0x3ad1('0x158'),_0x5996da));var _0xfd9b8f=this['channel'][_0x3ad1('0x12b')](_0x5996da,_0x59ce59[_0x3ad1('0x139')]);try{fs['unlink'](_0x5996da+_0x3ad1('0x107'));}catch(_0x4d329f){logger[_0x3ad1('0x2d')](_0x4d329f);}return _0xfd9b8f;}return this['channel'][_0x3ad1('0x2d')](_0x59ce59,_0x3ad1('0x15e'));};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0x15f')]=function(_0x3c7ca2){logger[_0x3ad1('0x2e')](util[_0x3ad1('0x2b')](_0x3ad1('0x160'),_0x3c7ca2[_0x3ad1('0x38')]));if(!this[_0x3ad1('0x85')](_0x3c7ca2[_0x3ad1('0x161')])){return this[_0x3ad1('0x10')][_0x3ad1('0x2d')](_0x3c7ca2,_0x3ad1('0x162'));}logger['info'](util[_0x3ad1('0x2b')](_0x3ad1('0x163'),this[_0x3ad1('0x10')][_0x3ad1('0x39')],_0x3c7ca2[_0x3ad1('0x161')]));var _0x4ea483=this[_0x3ad1('0x51')][_0x3ad1('0x6e')](this,_0x3c7ca2['findBy']);if(_0x4ea483){logger[_0x3ad1('0x2e')](util[_0x3ad1('0x2b')](_0x3ad1('0x164'),this[_0x3ad1('0x10')][_0x3ad1('0x39')],_0x3c7ca2[_0x3ad1('0x161')]));this[_0x3ad1('0x10')][_0x3ad1('0xaa')](util['format'](_0x3ad1('0x164'),this[_0x3ad1('0x10')][_0x3ad1('0x39')],_0x3c7ca2['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x3ad1('0x2e')](util[_0x3ad1('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x3ad1('0x39')],_0x3c7ca2[_0x3ad1('0x161')]));this[_0x3ad1('0x10')][_0x3ad1('0xaa')](util[_0x3ad1('0x2b')](_0x3ad1('0x165'),this[_0x3ad1('0x10')][_0x3ad1('0x39')],_0x3c7ca2[_0x3ad1('0x161')]));return{'code':0xc8,'result':_0x3ad1('0x166')};}};AGIVertices[_0x3ad1('0x12')]['logout']=function(_0x5e2ab9){logger[_0x3ad1('0x2e')](util[_0x3ad1('0x2b')](_0x3ad1('0x167'),_0x5e2ab9[_0x3ad1('0x38')]));if(!this[_0x3ad1('0x85')](_0x5e2ab9[_0x3ad1('0x161')])){return this[_0x3ad1('0x10')]['error'](_0x5e2ab9,_0x3ad1('0x162'));}logger[_0x3ad1('0x2e')](util[_0x3ad1('0x2b')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x3ad1('0x10')][_0x3ad1('0x39')],_0x5e2ab9[_0x3ad1('0x161')]));var _0x1fdfb9=this[_0x3ad1('0x50')][_0x3ad1('0x6e')](this,_0x5e2ab9[_0x3ad1('0x161')]);if(_0x1fdfb9){logger[_0x3ad1('0x2e')](util[_0x3ad1('0x2b')](_0x3ad1('0x164'),this[_0x3ad1('0x10')][_0x3ad1('0x39')],_0x5e2ab9['findBy']));this[_0x3ad1('0x10')][_0x3ad1('0xaa')](util[_0x3ad1('0x2b')](_0x3ad1('0x164'),this[_0x3ad1('0x10')][_0x3ad1('0x39')],_0x5e2ab9[_0x3ad1('0x161')]));return{'code':0xc8,'result':_0x3ad1('0x168')};}else{logger[_0x3ad1('0x2e')](util[_0x3ad1('0x2b')](_0x3ad1('0x165'),this[_0x3ad1('0x10')][_0x3ad1('0x39')],_0x5e2ab9[_0x3ad1('0x161')]));this[_0x3ad1('0x10')]['noop'](util['format'](_0x3ad1('0x165'),this['channel'][_0x3ad1('0x39')],_0x5e2ab9['findBy']));return{'code':0xc8,'result':_0x3ad1('0x166')};}};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0x169')]=function(_0x305814){logger[_0x3ad1('0x2e')](util[_0x3ad1('0x2b')](_0x3ad1('0x16a'),_0x305814[_0x3ad1('0x38')]));if(!this['isConfigured'](_0x305814[_0x3ad1('0x16b')])){return this[_0x3ad1('0x10')]['error'](_0x305814,_0x3ad1('0x16c'));}this[_0x3ad1('0x10')]['noop'](util[_0x3ad1('0x2b')](_0x3ad1('0x16d'),_0x305814[_0x3ad1('0x16b')]));var _0x517343=eval(_0x305814[_0x3ad1('0x16b')]);if(!this['isConfigured'](_0x305814[_0x3ad1('0x118')])){return this[_0x3ad1('0x10')][_0x3ad1('0xaa')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x19292a=this[_0x3ad1('0x13')][_0x3ad1('0x6e')](this,_0x305814[_0x3ad1('0x118')]);if(!_0x19292a){return this['channel'][_0x3ad1('0x2d')](_0x305814,'no\x20variable\x20found');}if(_[_0x3ad1('0x9d')](_0x517343)){var _0x345afb=this;_0x517343['forEach'](function(_0x1657fa,_0x2373e0){_0x345afb[_0x3ad1('0x10')][_0x3ad1('0xa2')](util[_0x3ad1('0x2b')]('%s[%s]',_0x19292a,_0x2373e0),_0x1657fa);});return this[_0x3ad1('0x10')]['noop'](util[_0x3ad1('0x2b')]('variable\x20%s[key]\x20set',_0x19292a));}else{return this[_0x3ad1('0x10')][_0x3ad1('0xa2')](_0x19292a,_0x517343);}};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0xe')]=function(_0x421d7a){logger[_0x3ad1('0x2e')](util[_0x3ad1('0x2b')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x421d7a[_0x3ad1('0x38')]));if(_0x421d7a[_0x3ad1('0x114')]===0x0){return this['maxRetry'](_0x421d7a);}_0x421d7a[_0x3ad1('0x114')]-=0x1;if(!this[_0x3ad1('0x85')](_0x421d7a[_0x3ad1('0x115')])){return this[_0x3ad1('0x10')]['error'](_0x421d7a,_0x3ad1('0x116'));}var _0x3047e2=this[_0x3ad1('0x20')]['sync'](this,_0x421d7a[_0x3ad1('0x115')]);if(!_0x3047e2){return this[_0x3ad1('0x10')]['error'](_0x421d7a,'no\x20file\x20audio\x20found');}var _0x356283=this['channel'][_0x3ad1('0x11a')](_0x3047e2,_0x421d7a[_0x3ad1('0x11b')],_0x421d7a[_0x3ad1('0x16e')]);var _0x3cb017=_0x356283[_0x3ad1('0xa7')];if(_0x356283[_0x3ad1('0xa7')]===-0x1){this[_0x3ad1('0x36')][_0x3ad1('0x6e')](this,_0x421d7a,'-1');return _0x356283;}else if(_0x356283[_0x3ad1('0xa5')]==='timeout'){_0x356283[_0x3ad1('0xa7')]=_0x356283[_0x3ad1('0xa7')][_0x3ad1('0x9e')]>0x0?_0x356283['result']:'t';}else if(_['isEmpty'](_0x356283[_0x3ad1('0xa7')])){_0x356283['result']='#';_0x3cb017='#';}if(!this[_0x3ad1('0x85')](_0x421d7a[_0x3ad1('0x118')])){this[_0x3ad1('0x10')][_0x3ad1('0xaa')](_0x3ad1('0x119'));}else{var _0x4e7623=this[_0x3ad1('0x13')][_0x3ad1('0x6e')](this,_0x421d7a[_0x3ad1('0x118')]);if(!_0x4e7623){return this[_0x3ad1('0x10')][_0x3ad1('0x2d')](_0x421d7a,_0x3ad1('0xda'));}this[_0x3ad1('0x10')][_0x3ad1('0xa2')](_0x4e7623,_0x3cb017);}this[_0x3ad1('0x36')][_0x3ad1('0x6e')](this,_0x421d7a,_0x3cb017);return _0x356283;};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0xaa')]=function(_0x3c3235){logger[_0x3ad1('0x2e')](util['format'](_0x3ad1('0x16f'),_0x3c3235[_0x3ad1('0x38')]));return this[_0x3ad1('0x10')][_0x3ad1('0xaa')](_0x3c3235['output']||_0x3c3235['label']);};AGIVertices[_0x3ad1('0x12')]['pause']=function(_0x411450){logger['info'](util[_0x3ad1('0x2b')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x411450['label']));if(!this[_0x3ad1('0x85')](_0x411450[_0x3ad1('0x161')])){return this[_0x3ad1('0x10')][_0x3ad1('0x2d')](_0x411450,_0x3ad1('0x162'));}logger[_0x3ad1('0x2e')](util[_0x3ad1('0x2b')](_0x3ad1('0x163'),this[_0x3ad1('0x10')][_0x3ad1('0x39')],_0x411450[_0x3ad1('0x161')]));var _0x3ab673=this['getPause'][_0x3ad1('0x6e')](this,_0x411450['pause_id']);var _0x24eb5a=this['agentPause'][_0x3ad1('0x6e')](this,_0x411450[_0x3ad1('0x161')],_0x3ab673);if(_0x24eb5a){logger[_0x3ad1('0x2e')](util[_0x3ad1('0x2b')](_0x3ad1('0x164'),this[_0x3ad1('0x10')][_0x3ad1('0x39')],_0x411450[_0x3ad1('0x161')]));this[_0x3ad1('0x10')][_0x3ad1('0xaa')](util[_0x3ad1('0x2b')](_0x3ad1('0x164'),this[_0x3ad1('0x10')][_0x3ad1('0x39')],_0x411450['findBy']));return{'code':0xc8,'result':_0x3ad1('0x168')};}else{logger[_0x3ad1('0x2e')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x3ad1('0x10')][_0x3ad1('0x39')],_0x411450[_0x3ad1('0x161')]));this[_0x3ad1('0x10')]['noop'](util[_0x3ad1('0x2b')](_0x3ad1('0x164'),this[_0x3ad1('0x10')][_0x3ad1('0x39')],_0x411450[_0x3ad1('0x161')]));return{'code':0xc8,'result':_0x3ad1('0x166')};}};AGIVertices['prototype'][_0x3ad1('0x170')]=function(_0x9c28d){logger['info'](util[_0x3ad1('0x2b')](_0x3ad1('0x171'),_0x9c28d[_0x3ad1('0x38')]));if(!this[_0x3ad1('0x85')](_0x9c28d[_0x3ad1('0x115')])){return this[_0x3ad1('0x10')][_0x3ad1('0x2d')](_0x9c28d,_0x3ad1('0x116'));}var _0x3449cb=this[_0x3ad1('0x20')]['sync'](this,_0x9c28d[_0x3ad1('0x115')]);if(!_0x3449cb){return this[_0x3ad1('0x10')][_0x3ad1('0x2d')](_0x9c28d,_0x3ad1('0x117'));}var _0x263f7e=this[_0x3ad1('0x10')][_0x3ad1('0x55')](_0x3ad1('0x172'),[_0x3449cb,_0x9c28d[_0x3ad1('0xe4')]]);if(_0x263f7e[_0x3ad1('0xa7')]===-0x1){return _0x263f7e;}return this[_0x3ad1('0x10')][_0x3ad1('0xaa')](util[_0x3ad1('0x2b')](_0x3ad1('0xc5'),_0x3ad1('0x172'),_0x3449cb));};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0x173')]=function(_0x312177){logger[_0x3ad1('0x2e')](util['format'](_0x3ad1('0x174'),_0x312177[_0x3ad1('0x38')]));if(!this['isConfigured'](_0x312177['queue_id'])){return this['channel'][_0x3ad1('0x2d')](_0x312177,'no\x20queue\x20selected');}var _0x50c366='';var _0x5bb485=parseInt(_0x312177[_0x3ad1('0x175')],0xa);if(isNaN(_0x5bb485)){_0x50c366=_0x312177['queue_id'];}else{_0x50c366=this[_0x3ad1('0x176')]['sync'](this,_0x312177['queue_id']);if(!_0x50c366){return this['channel']['error'](_0x312177,_0x3ad1('0x177'));}}var _0x5ace73='';if(this['isConfigured'](_0x312177['file_id'])){var _0x1abdd9=this[_0x3ad1('0x20')]['sync'](this,_0x312177[_0x3ad1('0x115')]);if(_0x1abdd9){_0x5ace73=_0x1abdd9;}}this[_0x3ad1('0x36')][_0x3ad1('0x6e')](this,_0x312177,_0x50c366);if(_0x312177['opts'][_0x3ad1('0x178')]('x')<0x0){_0x312177[_0x3ad1('0xe4')]+='x';}if(_0x312177[_0x3ad1('0xe4')][_0x3ad1('0x178')]('X')<0x0){_0x312177['opts']+='X';}this['channel'][_0x3ad1('0xa2')](_0x3ad1('0x179'),_0x50c366?_0x50c366[_0x3ad1('0x17a')]():'');var _0x1b6c47=this['channel'][_0x3ad1('0x55')](_0x3ad1('0x17b'),[_0x50c366,_0x312177[_0x3ad1('0xe4')],_0x312177[_0x3ad1('0x71')],_0x5ace73,_0x312177['timeout'],_0x312177[_0x3ad1('0x7')],_0x312177[_0x3ad1('0x17c')],_0x312177[_0x3ad1('0x17d')],'',_0x312177[_0x3ad1('0x17e')]]);if(_0x1b6c47[_0x3ad1('0xa7')]===-0x1){return _0x1b6c47;}return this[_0x3ad1('0x10')]['noop'](util[_0x3ad1('0x2b')](_0x3ad1('0xc5'),_0x3ad1('0x17b'),_0x50c366));};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0x17f')]=function(_0xbfaa27){logger['info'](util[_0x3ad1('0x2b')](_0x3ad1('0x180'),_0xbfaa27[_0x3ad1('0x38')]));var _0x816e7b=_0xbfaa27[_0x3ad1('0x181')]||_0x3ad1('0x140');var _0x13a790=util[_0x3ad1('0x2b')](_0x3ad1('0x182'),this[_0x3ad1('0x10')]['uniqueid'],rs[_0x3ad1('0x120')](0x5));var _0xd49aa7=util[_0x3ad1('0x2b')](_0x3ad1('0x183'),FILES_PATH,_0x13a790,_0x816e7b);var _0x571936=util[_0x3ad1('0x2b')]('%s/recordings/%s',FILES_PATH,_0x13a790);this[_0x3ad1('0x184')][_0x3ad1('0x6e')](this,_0xbfaa27,_0x13a790,_0xd49aa7);this['channel'][_0x3ad1('0xa2')](_0x3ad1('0x185'),_0x13a790);logger[_0x3ad1('0x2e')](_0x3ad1('0x186'),_0x571936,_0x816e7b,_0xbfaa27['escape_digits'],_0xbfaa27[_0x3ad1('0x64')]);return this[_0x3ad1('0x10')][_0x3ad1('0x138')](_0x571936,_0x816e7b,_0xbfaa27[_0x3ad1('0x187')],_0xbfaa27[_0x3ad1('0x64')],undefined,!![]);};AGIVertices['prototype'][_0x3ad1('0x188')]=function(_0x4ed06f){logger['info'](util['format'](_0x3ad1('0x189'),_0x4ed06f[_0x3ad1('0x38')]));if(!this[_0x3ad1('0x85')](_0x4ed06f['url'])){return this[_0x3ad1('0x10')][_0x3ad1('0xaa')](_0x3ad1('0x18a'));}var _0x3c20e5=this['restAPI']['sync'](this,_0x4ed06f);logger[_0x3ad1('0x2e')](util[_0x3ad1('0x2b')](_0x3ad1('0x18b'),util['inspect'](_0x3c20e5,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x4ed06f[_0x3ad1('0x118')])){return this['channel']['noop'](_0x3ad1('0x18c'));}var _0x4ba3fa=this[_0x3ad1('0x13')]['sync'](this,_0x4ed06f['variable_id']);if(!_0x4ba3fa){return this['channel'][_0x3ad1('0x2d')](_0x4ed06f,_0x3ad1('0xda'));}this[_0x3ad1('0x10')]['setVariable'](util[_0x3ad1('0x2b')](_0x3ad1('0x18d'),_0x4ba3fa),_0x3c20e5[_0x3ad1('0x74')]?_0x3c20e5['statusCode']:_0x3ad1('0x18e'));this[_0x3ad1('0x10')][_0x3ad1('0xa2')](util[_0x3ad1('0x2b')](_0x3ad1('0x18f'),_0x4ba3fa),_0x3c20e5['statusMessage']?_0x3c20e5['statusMessage']:'OK');if(_0x3c20e5['body']){try{this[_0x3ad1('0x9f')](_0x3c20e5[_0x3ad1('0x68')],_0x4ba3fa);}catch(_0x171adb){logger['error'](util[_0x3ad1('0x2b')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x4ba3fa));}}return this['channel']['noop'](util['format'](_0x3ad1('0x190'),_0x4ba3fa));};AGIVertices[_0x3ad1('0x12')]['saydigits']=function(_0x3702ef){logger[_0x3ad1('0x2e')](util[_0x3ad1('0x2b')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x3702ef['label']));return this[_0x3ad1('0x10')][_0x3ad1('0x191')](_0x3702ef[_0x3ad1('0x192')]['replace'](/\s+/g,''),_0x3702ef[_0x3ad1('0x187')]);};AGIVertices[_0x3ad1('0x12')]['saynumber']=function(_0x2ba613){logger['info'](util[_0x3ad1('0x2b')](_0x3ad1('0x193'),_0x2ba613[_0x3ad1('0x38')]));return this['channel'][_0x3ad1('0x194')](_0x2ba613['number'][_0x3ad1('0x57')](/\s+/g,''),_0x2ba613[_0x3ad1('0x187')]);};AGIVertices['prototype']['sayphonetic']=function(_0x3d718a){logger[_0x3ad1('0x2e')](util['format']('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x3d718a['label']));return this[_0x3ad1('0x10')][_0x3ad1('0x195')](_0x3d718a['text'],_0x3d718a['escape_digits']);};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0x196')]=function(_0x2b0cb8){logger[_0x3ad1('0x2e')](util['format'](_0x3ad1('0x197'),_0x2b0cb8[_0x3ad1('0x38')]));if(!this['isConfigured'](_0x2b0cb8[_0x3ad1('0x198')])){return this['channel'][_0x3ad1('0xaa')](_0x3ad1('0x199'));}var _0x258f39=this[_0x3ad1('0x19a')][_0x3ad1('0x6e')](this,_0x2b0cb8['account_id']);if(!_0x258f39||!_0x258f39[_0x3ad1('0x19b')]){return this['channel'][_0x3ad1('0x2d')](_0x2b0cb8,'no\x20mail\x20account\x20found');}var _0xce3a={'from':util[_0x3ad1('0x2b')](_0x3ad1('0x19c'),_0x258f39[_0x3ad1('0x15')],_0x258f39[_0x3ad1('0x19d')]||_0x258f39[_0x3ad1('0x19b')][_0x3ad1('0x19e')]),'to':_0x2b0cb8['to']||'','cc':_0x2b0cb8['cc']||'','bcc':_0x2b0cb8[_0x3ad1('0x19f')]||'','subject':_0x2b0cb8[_0x3ad1('0x1a0')],'html':_0x2b0cb8['text'],'text':_0x2b0cb8[_0x3ad1('0x5a')]};if(this[_0x3ad1('0x85')](_0x2b0cb8['template_id'])){}logger[_0x3ad1('0xde')](_0x3ad1('0x1a1'),JSON[_0x3ad1('0x72')](_0xce3a));this[_0x3ad1('0x36')][_0x3ad1('0x6e')](this,_0x2b0cb8,_0x2b0cb8['account_id']);this[_0x3ad1('0x10')]['noop'](util['format'](_0x3ad1('0x1a2'),_0x258f39[_0x3ad1('0x15')]));this[_0x3ad1('0x26')][_0x3ad1('0x6e')](this,_0x258f39['smtpOptions'],_0xce3a);return this['channel'][_0x3ad1('0xaa')](_0x3ad1('0x1a3'));};AGIVertices['prototype'][_0x3ad1('0x1a4')]=function(_0x38dd9e){logger[_0x3ad1('0x2e')](util[_0x3ad1('0x2b')](_0x3ad1('0x1a5'),_0x38dd9e[_0x3ad1('0x38')]));return this[_0x3ad1('0x10')]['noop'](_0x3ad1('0x1a6'));};AGIVertices['prototype'][_0x3ad1('0x1a7')]=function(_0x188356){logger[_0x3ad1('0x2e')](util[_0x3ad1('0x2b')](_0x3ad1('0x1a8'),_0x188356[_0x3ad1('0x38')]));if(!this[_0x3ad1('0x85')](_0x188356[_0x3ad1('0x1a9')])){return this[_0x3ad1('0x10')][_0x3ad1('0xaa')]('no\x20sms\x20account\x20configured');}var _0x295907=this[_0x3ad1('0x33')][_0x3ad1('0x6e')](this,_0x188356['sms_account_id']);if(!_0x295907){return this[_0x3ad1('0x10')][_0x3ad1('0x2d')](_0x188356,_0x3ad1('0x1aa'));}var _0x48ebe3={'body':_0x188356[_0x3ad1('0x1ab')],'phone':_0x188356['to']||'','SmsAccountId':_0x295907['id']};logger[_0x3ad1('0xde')](_0x3ad1('0x1ac'),JSON['stringify'](_0x48ebe3));this[_0x3ad1('0x36')][_0x3ad1('0x6e')](this,_0x188356,_0x188356[_0x3ad1('0x1a9')]);this[_0x3ad1('0x10')][_0x3ad1('0xaa')](util[_0x3ad1('0x2b')](_0x3ad1('0x1ad'),_0x295907[_0x3ad1('0x15')]));this[_0x3ad1('0x35')][_0x3ad1('0x6e')](this,_0x48ebe3);return this[_0x3ad1('0x10')]['noop'](_0x3ad1('0x1ae'));};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0x1af')]=function(_0x2cab90){logger[_0x3ad1('0x2e')](util[_0x3ad1('0x2b')](_0x3ad1('0x1b0'),_0x2cab90[_0x3ad1('0x38')]));if(!this[_0x3ad1('0x85')](_0x2cab90[_0x3ad1('0x118')])){return this[_0x3ad1('0x10')][_0x3ad1('0x2d')](_0x2cab90,_0x3ad1('0x1b1'));}var _0x4ae038=this[_0x3ad1('0x13')][_0x3ad1('0x6e')](this,_0x2cab90[_0x3ad1('0x118')]);if(!_0x4ae038){return this[_0x3ad1('0x10')][_0x3ad1('0x2d')](_0x2cab90,'no\x20variable\x20found');}return this['channel'][_0x3ad1('0xa2')](_0x4ae038,_0x2cab90['variable_value']);};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0x1b2')]=function(_0x4bf9f8){logger[_0x3ad1('0x2e')](util['format'](_0x3ad1('0x1b3'),_0x4bf9f8[_0x3ad1('0x38')]));this[_0x3ad1('0x10')][_0x3ad1('0xaa')](_0x3ad1('0x1b4'));if(_0x4bf9f8[_0x3ad1('0xbb')]===_0x3ad1('0x1b5')){this[_0x3ad1('0x10')][_0x3ad1('0xaa')](_0x3ad1('0x1b6'));return this[_0x3ad1('0x10')]['answer']();}return this[_0x3ad1('0x10')]['noop'](_0x3ad1('0x1b7'));};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0x1b8')]=function(_0x1c1368){logger[_0x3ad1('0x2e')](util[_0x3ad1('0x2b')](_0x3ad1('0x1b9'),_0x1c1368['label']));if(!this['isConfigured'](_0x1c1368[_0x3ad1('0x1ba')])){return this[_0x3ad1('0x10')][_0x3ad1('0x2d')](_0x1c1368,_0x3ad1('0x1bb'));}var _0x5c282e=this[_0x3ad1('0x19')][_0x3ad1('0x6e')](this,_0x1c1368[_0x3ad1('0x1ba')]);if(!this[_0x3ad1('0x85')](_0x5c282e)){return this[_0x3ad1('0x10')][_0x3ad1('0x2d')](_0x1c1368,util[_0x3ad1('0x2b')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x1c1368[_0x3ad1('0x1ba')]));}if(_0x5c282e===this[_0x3ad1('0x10')][_0x3ad1('0x3f')]){return this[_0x3ad1('0x10')][_0x3ad1('0x2d')](_0x1c1368,_0x3ad1('0x1bc'));}this[_0x3ad1('0x36')]['sync'](this,_0x1c1368,_0x5c282e);var _0x352421=this[_0x3ad1('0x10')][_0x3ad1('0x55')]('AGI',util[_0x3ad1('0x2b')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config['agi'][_0x3ad1('0x1bd')]||'127.0.0.1',_0x5c282e,this[_0x3ad1('0x10')][_0x3ad1('0x3f')]));if(_0x352421[_0x3ad1('0xa7')]===-0x1){return _0x352421;}return this[_0x3ad1('0x10')][_0x3ad1('0xaa')](util['format'](_0x3ad1('0xc5'),_0x3ad1('0x1be'),_0x5c282e));};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0x1bf')]=function(_0x3e3186){logger[_0x3ad1('0x2e')](util[_0x3ad1('0x2b')](_0x3ad1('0x1c0'),_0x3e3186['label']));var _0x6b715e=this[_0x3ad1('0x54')][_0x3ad1('0x6e')](this,_0x3e3186[_0x3ad1('0xb9')]);this[_0x3ad1('0x36')][_0x3ad1('0x6e')](this,_0x3e3186,_0x3e3186['command']);if(this[_0x3ad1('0x85')](_0x3e3186['variable_id'])){var _0x43575a=this['getVariable']['sync'](this,_0x3e3186[_0x3ad1('0x118')]);if(_0x43575a){this['channel'][_0x3ad1('0xa2')](_0x43575a,_0x6b715e);return this['channel']['noop'](util[_0x3ad1('0x2b')](_0x3ad1('0x1c1'),_0x3e3186[_0x3ad1('0xb9')],_0x43575a));}}return this[_0x3ad1('0x10')][_0x3ad1('0xaa')](util[_0x3ad1('0x2b')](_0x3ad1('0x1c2'),_0x3e3186[_0x3ad1('0xb9')]));};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0x1c3')]=function(_0x41e961){logger[_0x3ad1('0x2e')](util[_0x3ad1('0x2b')](_0x3ad1('0x1c4'),_0x41e961[_0x3ad1('0x38')]));_0x41e961[_0x3ad1('0x5a')]=_0x41e961['text'][_0x3ad1('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x3ad1('0x85')](_0x41e961[_0x3ad1('0x59')])){return this['channel'][_0x3ad1('0xaa')](_0x3ad1('0x1c5'));}if(!this[_0x3ad1('0x85')](_0x41e961[_0x3ad1('0x5a')])){return this[_0x3ad1('0x10')]['noop'](_0x3ad1('0xab'));}this[_0x3ad1('0x10')][_0x3ad1('0xaa')](util[_0x3ad1('0x2b')](_0x3ad1('0x1c6'),_0x41e961[_0x3ad1('0x5a')]));var _0x399644=this['googleCloudTTS'][_0x3ad1('0x6e')](this,_0x41e961);if(_0x399644){this[_0x3ad1('0x10')][_0x3ad1('0xaa')](util[_0x3ad1('0x2b')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x399644));var _0x11a539=this['channel']['streamFile'](_0x399644);try{fs['unlink'](_0x399644+_0x3ad1('0x107'));}catch(_0x4dc3ad){logger['error'](_0x4dc3ad);}return _0x11a539;}return this[_0x3ad1('0x10')][_0x3ad1('0x2d')](_0x41e961,_0x3ad1('0x1c7'));};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0x1c8')]=function(_0x363149){logger[_0x3ad1('0x2e')](util[_0x3ad1('0x2b')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x363149[_0x3ad1('0x38')]));_0x363149['text']=_0x363149['text'][_0x3ad1('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x3ad1('0x85')](_0x363149[_0x3ad1('0x5a')])){return this[_0x3ad1('0x10')][_0x3ad1('0xaa')]('no\x20text\x20configured');}this[_0x3ad1('0x10')]['noop'](util['format'](_0x3ad1('0x1c9'),_0x363149[_0x3ad1('0x5a')]));var _0xd3ef5a=this[_0x3ad1('0x60')]['sync'](this,_0x363149);if(_0xd3ef5a){this[_0x3ad1('0x10')][_0x3ad1('0xaa')](util[_0x3ad1('0x2b')](_0x3ad1('0x1ca'),_0xd3ef5a));var _0x384f44=this[_0x3ad1('0x10')][_0x3ad1('0x12b')](_0xd3ef5a);try{fs[_0x3ad1('0x106')](_0xd3ef5a+_0x3ad1('0x107'));}catch(_0x290021){logger['error'](_0x290021);}return _0x384f44;}return this[_0x3ad1('0x10')][_0x3ad1('0x2d')](_0x363149,_0x3ad1('0x1cb'));};AGIVertices[_0x3ad1('0x12')]['unpause']=function(_0x5045f7){logger[_0x3ad1('0x2e')](util[_0x3ad1('0x2b')](_0x3ad1('0x1cc'),_0x5045f7[_0x3ad1('0x38')]));if(!this[_0x3ad1('0x85')](_0x5045f7[_0x3ad1('0x161')])){return this[_0x3ad1('0x10')][_0x3ad1('0x2d')](_0x5045f7,'no\x20find\x20by\x20configured');}logger[_0x3ad1('0x2e')](util[_0x3ad1('0x2b')](_0x3ad1('0x163'),this[_0x3ad1('0x10')][_0x3ad1('0x39')],_0x5045f7['findBy']));var _0x2e41f4=this[_0x3ad1('0x4f')][_0x3ad1('0x6e')](this,_0x5045f7[_0x3ad1('0x161')]);if(_0x2e41f4){logger[_0x3ad1('0x2e')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x3ad1('0x10')][_0x3ad1('0x39')],_0x5045f7[_0x3ad1('0x161')]));this[_0x3ad1('0x10')][_0x3ad1('0xaa')](util[_0x3ad1('0x2b')](_0x3ad1('0x164'),this[_0x3ad1('0x10')][_0x3ad1('0x39')],_0x5045f7[_0x3ad1('0x161')]));return{'code':0xc8,'result':'success'};}else{logger[_0x3ad1('0x2e')](util['format'](_0x3ad1('0x165'),this[_0x3ad1('0x10')][_0x3ad1('0x39')],_0x5045f7[_0x3ad1('0x161')]));this[_0x3ad1('0x10')][_0x3ad1('0xaa')](util['format'](_0x3ad1('0x165'),this[_0x3ad1('0x10')][_0x3ad1('0x39')],_0x5045f7['findBy']));return{'code':0xc8,'result':_0x3ad1('0x166')};}};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0x1cd')]=function(_0x596dae){logger[_0x3ad1('0x2e')](util['format'](_0x3ad1('0x1ce'),_0x596dae[_0x3ad1('0x38')]));var _0x17b43f=this['channel'][_0x3ad1('0x55')](_0x3ad1('0x1cf'),[_0x596dae[_0x3ad1('0x1d0')],_0x596dae[_0x3ad1('0x78')]]);if(_0x17b43f['result']===-0x1){return _0x17b43f;}return this[_0x3ad1('0x10')][_0x3ad1('0xaa')](util[_0x3ad1('0x2b')](_0x3ad1('0xc5'),_0x3ad1('0x1cf'),_0x596dae['mailbox']));};AGIVertices[_0x3ad1('0x12')][_0x3ad1('0x1d1')]=function(_0x557c47){logger[_0x3ad1('0x2e')](util[_0x3ad1('0x2b')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x557c47[_0x3ad1('0x38')]));if(!this['isConfigured'](_0x557c47[_0x3ad1('0x118')])){return this[_0x3ad1('0x10')][_0x3ad1('0x2d')](_0x557c47,_0x3ad1('0x1b1'));}var _0x7eea57=this[_0x3ad1('0x13')][_0x3ad1('0x6e')](this,_0x557c47[_0x3ad1('0x118')]);if(!_0x7eea57){return this[_0x3ad1('0x10')][_0x3ad1('0x2d')](_0x557c47,_0x3ad1('0xda'));}var _0x464fa3=this[_0x3ad1('0x10')][_0x3ad1('0x13')](_0x7eea57);return{'code':0xc8,'result':_0x464fa3['extra']?_0x464fa3[_0x3ad1('0xa5')]:'-'};};String[_0x3ad1('0x12')][_0x3ad1('0xa4')]=function(_0x1ae4dd,_0xd7fb34){return this[_0x3ad1('0xa3')](_0x1ae4dd)['join'](_0xd7fb34);};module[_0x3ad1('0x1d2')]=AGIVertices; \ No newline at end of file +var _0xea28=['model','awsPolly','aws_access_key_id','aws_polly_region','aws_text_type','awsLex','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','clear','replaceObjectAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','isArray','length','isString','replaceAllVariables','saveRestApiResult','%s.%s','setVariable','replaceAll','extra','getVariable','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','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','getAndSetVariable','RECOG_CONFIDENCE()','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','Enter\x20in\x20ANSWER\x20(%s)\x20block','answer','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','add','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_TRANSCRIPT','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','keys','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','getUser','no\x20user\x20found','opts','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','dialogflowV2','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','ndassistant_url','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','message','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','beep','NOBEEP','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','appsecret','wav','recordFile','TildeASR\x20Result\x20%s','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','streamFile','ispeech\x20TTS\x20is\x20unreachable','login','findBy','no\x20find\x20by\x20configured','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','math','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','statusMessage','variable\x20%s\x20set','sayDigits','digits','escape_digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','no\x20mail\x20account\x20configured','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','user','bcc','subject','template_id','Trying\x20SendMail\x20with\x20account\x20%s','sendMailMessage','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','agi','../../config/environment','../../config/environment/shared','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','then','name','catch','getVoiceQueue','getVoiceQueueById','prototype','getSquareProject','getSquareProjectById','getSquareOdbc','dsn','getUserById','getTrunk','getTrunkById','getSound','getSoundPath','save_name','getMailAccount','getMailAccountById','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','dnid','file','createSquareMessage','createCmContact','isEmpty','lastName','phone','list_id','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','getPause','getPauseById','agentPause','isNil','error','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','en-US','ssmlGender','MALE','audioEncoding','googleTTS','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','headers','parse','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','dialogflowV2_project_id','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured'];(function(_0x2347c4,_0x2b1125){var _0x8da771=function(_0x4c2749){while(--_0x4c2749){_0x2347c4['push'](_0x2347c4['shift']());}};_0x8da771(++_0x2b1125);}(_0xea28,0x13a));var _0x8ea2=function(_0x328bac,_0x454d32){_0x328bac=_0x328bac-0x0;var _0x265493=_0xea28[_0x328bac];return _0x265493;};'use strict';var fs=require('fs');var util=require(_0x8ea2('0x0'));var _=require(_0x8ea2('0x1'));var sh=require(_0x8ea2('0x2'));var odbc=require(_0x8ea2('0x3'))();var rs=require(_0x8ea2('0x4'));var moment=require(_0x8ea2('0x5'));var Mustache=require(_0x8ea2('0x6'));var rp=require(_0x8ea2('0x7'));var logger=require('../../config/logger')(_0x8ea2('0x8'));var config=require(_0x8ea2('0x9'));var shared=require(_0x8ea2('0xa'));var scripts=require('./scripts');var FILES_PATH=_0x8ea2('0xb');var recursiveMapAttributes=[_0x8ea2('0xc'),_0x8ea2('0xd')];var verticesWithRetry=[_0x8ea2('0xe'),_0x8ea2('0xf'),_0x8ea2('0x10')];var AGIVertices=function(_0x19bd6c,_0x320750,_0x3de4a1){this[_0x8ea2('0x11')]=_0x19bd6c;this[_0x8ea2('0x12')]=_0x320750;this[_0x8ea2('0x13')]=_0x3de4a1;};AGIVertices['prototype']['getVariable']=function(_0x4722f3,_0x2ac9be){this[_0x8ea2('0x12')]['getVariableById'](_0x4722f3)[_0x8ea2('0x14')](function(_0x101a15){_0x2ac9be(null,_0x101a15?_0x101a15[_0x8ea2('0x15')]:![]);})[_0x8ea2('0x16')](function(_0xe47c0e){_0x2ac9be(_0xe47c0e);});};AGIVertices['prototype'][_0x8ea2('0x17')]=function(_0x553154,_0x4b2192){this[_0x8ea2('0x12')][_0x8ea2('0x18')](_0x553154)[_0x8ea2('0x14')](function(_0x78669a){_0x4b2192(null,_0x78669a?_0x78669a[_0x8ea2('0x15')]:![]);})[_0x8ea2('0x16')](function(_0x3cff96){_0x4b2192(_0x3cff96);});};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x1a')]=function(_0x396aab,_0x2dfa7c){this[_0x8ea2('0x12')][_0x8ea2('0x1b')](_0x396aab)[_0x8ea2('0x14')](function(_0x1b64cf){_0x2dfa7c(null,_0x1b64cf?_0x1b64cf[_0x8ea2('0x15')]:![]);})[_0x8ea2('0x16')](function(_0x2a0329){_0x2dfa7c(_0x2a0329);});};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x1c')]=function(_0x134cbe,_0x287597){this['rpc']['getSquareOdbcById'](_0x134cbe)[_0x8ea2('0x14')](function(_0x248c18){_0x287597(null,_0x248c18?_0x248c18[_0x8ea2('0x1d')]:![]);})['catch'](function(_0x46f4fe){_0x287597(_0x46f4fe);});};AGIVertices[_0x8ea2('0x19')]['getUser']=function(_0x3d593b,_0x283f00){this[_0x8ea2('0x12')][_0x8ea2('0x1e')](_0x3d593b)[_0x8ea2('0x14')](function(_0xe5c943){_0x283f00(null,_0xe5c943?_0xe5c943[_0x8ea2('0x15')]:![]);})[_0x8ea2('0x16')](function(_0x18ec34){_0x283f00(_0x18ec34);});};AGIVertices['prototype'][_0x8ea2('0x1f')]=function(_0x4f48bd,_0x2660cc){this[_0x8ea2('0x12')][_0x8ea2('0x20')](_0x4f48bd)['then'](function(_0x53ed43){_0x2660cc(null,_0x53ed43?_0x53ed43[_0x8ea2('0x15')]:![]);})['catch'](function(_0x200a49){_0x2660cc(_0x200a49);});};AGIVertices['prototype'][_0x8ea2('0x21')]=function(_0x12fa37,_0x21c526){var _0x266db8=this;this['rpc']['getSoundById'](_0x12fa37)[_0x8ea2('0x14')](function(_0x4da5b3){_0x21c526(null,_0x4da5b3?_0x266db8[_0x8ea2('0x22')](_0x4da5b3[_0x8ea2('0x23')]):![]);})[_0x8ea2('0x16')](function(_0x41f482){_0x21c526(_0x41f482);});};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x24')]=function(_0x32e225,_0x316707){this[_0x8ea2('0x12')][_0x8ea2('0x25')](_0x32e225)['then'](function(_0x5b7ff9){_0x316707(null,_0x5b7ff9?_0x5b7ff9:![]);})[_0x8ea2('0x16')](function(_0x188553){_0x316707(_0x188553);});};AGIVertices['prototype']['sendMailMessage']=function(_0x1ee7b2,_0x4e273e,_0x64475b){this[_0x8ea2('0x13')]['sendMailMessage'](_0x1ee7b2,_0x4e273e)[_0x8ea2('0x14')](function(){_0x64475b(null);})[_0x8ea2('0x16')](function(_0x33abc8){_0x64475b(_0x33abc8);});};AGIVertices['prototype']['getIntervals']=function(_0x49a252,_0x3880c3){this[_0x8ea2('0x12')][_0x8ea2('0x26')](_0x49a252)['then'](function(_0x456487){if(_0x456487){if(_0x456487[_0x8ea2('0x27')]){_0x3880c3(null,[_0x456487[_0x8ea2('0x28')]]);}else{_0x3880c3(null,_[_0x8ea2('0x29')](_0x456487[_0x8ea2('0x2a')],_0x8ea2('0x28')));}}else{_0x3880c3(null,![]);}})[_0x8ea2('0x16')](function(_0x1fc76a){_0x3880c3(_0x1fc76a);});};AGIVertices['prototype'][_0x8ea2('0x22')]=function(_0x29e3f5){return util[_0x8ea2('0x2b')](_0x8ea2('0x2c'),FILES_PATH,_0x29e3f5);};AGIVertices['prototype'][_0x8ea2('0x2d')]=function(_0x5355aa,_0x1e03f2,_0x103d5a){odbc[_0x8ea2('0x2e')](_0x5355aa,function(_0x1496ae){if(_0x1496ae){logger['error'](_0x8ea2('0x2f'),_0x1496ae);_0x103d5a(_0x1496ae);}else{logger['info']('ODBC\x20connection\x20successfully');odbc[_0x8ea2('0x30')](_0x1e03f2,function(_0x5f23a3,_0x61fb42){if(_0x5f23a3){logger[_0x8ea2('0x31')](_0x8ea2('0x32'),_0x1e03f2);_0x103d5a(_0x5f23a3);}else{logger[_0x8ea2('0x31')](_0x8ea2('0x33'),_0x1e03f2);odbc['close'](function(_0x84685d){if(_0x84685d){logger['error'](_0x8ea2('0x34'),_0x84685d);}_0x103d5a(null,_0x61fb42);});}});}});};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x35')]=function(_0x3995ff,_0x4f9a8c){this[_0x8ea2('0x12')]['getSmsAccountById'](_0x3995ff)[_0x8ea2('0x14')](function(_0x5ba351){_0x4f9a8c(null,_0x5ba351?_0x5ba351:![]);})[_0x8ea2('0x16')](function(_0x450e8f){_0x4f9a8c(_0x450e8f);});};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x36')]=function(_0x373a70,_0x251a10){this[_0x8ea2('0x12')]['createSmsMessage'](_0x373a70)['then'](function(_0x1d7496){_0x251a10(null,_0x1d7496);})['catch'](function(_0x4b03fa){_0x251a10(_0x4b03fa);});};AGIVertices['prototype'][_0x8ea2('0x37')]=function(_0x5d9ba0,_0x40a532,_0x1b8028){this[_0x8ea2('0x12')][_0x8ea2('0x37')]({'uniqueid':this[_0x8ea2('0x11')][_0x8ea2('0x38')],'node':_0x5d9ba0[_0x8ea2('0x39')],'application':_0x5d9ba0[_0x8ea2('0x3a')],'data':_0x40a532||null,'project_name':this['channel'][_0x8ea2('0x3b')],'callerid':this[_0x8ea2('0x11')][_0x8ea2('0x3c')]})['then'](function(_0x2d6bbb){if(_0x1b8028){_0x1b8028(null,_0x2d6bbb);}})[_0x8ea2('0x16')](function(_0x8005f9){if(_0x1b8028){_0x1b8028(_0x8005f9);}});};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x3d')]=function(_0x56efc5,_0x3e6541,_0x42ef0b,_0x23e527){this['rpc'][_0x8ea2('0x3d')]({'uniqueid':this[_0x8ea2('0x11')][_0x8ea2('0x38')],'callerid':this[_0x8ea2('0x11')][_0x8ea2('0x3c')],'calleridname':this[_0x8ea2('0x11')][_0x8ea2('0x3e')],'context':this[_0x8ea2('0x11')][_0x8ea2('0x3f')],'extension':this[_0x8ea2('0x11')][_0x8ea2('0x40')],'priority':this[_0x8ea2('0x11')][_0x8ea2('0x41')],'accountcode':this[_0x8ea2('0x11')]['accountcode'],'dnid':this[_0x8ea2('0x11')][_0x8ea2('0x42')],'projectName':this[_0x8ea2('0x11')][_0x8ea2('0x3b')],'saveName':_0x3e6541,'filename':_0x56efc5[_0x8ea2('0x43')]||_0x3e6541,'savePath':_0x42ef0b})[_0x8ea2('0x14')](function(_0x11b3ef){_0x23e527(null,_0x11b3ef);})[_0x8ea2('0x16')](function(_0x52df67){_0x23e527(_0x52df67);});};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x44')]=function(_0x24dddb,_0x5380fa,_0x4fcc19,_0x7cd361,_0x2d9d2a){this[_0x8ea2('0x12')]['createSquareMessage']({'uniqueid':this[_0x8ea2('0x11')][_0x8ea2('0x38')],'body':_0x24dddb,'direction':_0x5380fa,'providerName':_0x4fcc19,'providerResponse':_0x7cd361})[_0x8ea2('0x14')](function(_0x11d7ea){if(_0x2d9d2a){_0x2d9d2a(null,_0x11d7ea);}})[_0x8ea2('0x16')](function(_0x51b33e){if(_0x2d9d2a){_0x2d9d2a(_0x51b33e);}});};AGIVertices['prototype'][_0x8ea2('0x45')]=function(_0x4148c1,_0x1b8c4b){this['rpc'][_0x8ea2('0x45')]({'firstName':_[_0x8ea2('0x46')](_0x4148c1[_0x8ea2('0x15')])||_['isNil'](_0x4148c1['name'])?'callback_'+Math['random']():_0x4148c1['name'],'lastName':_[_0x8ea2('0x46')](_0x4148c1[_0x8ea2('0x47')])||_['isNil'](_0x4148c1['lastName'])?null:_0x4148c1[_0x8ea2('0x47')],'phone':_0x4148c1[_0x8ea2('0x48')],'ListId':_0x4148c1[_0x8ea2('0x49')],'scheduledat':_0x4148c1['scheduledAt'],'callbackUniqueid':this[_0x8ea2('0x11')][_0x8ea2('0x38')],'tags':'callback','description':_0x8ea2('0x4a')+_0x4148c1[_0x8ea2('0x4b')][_0x8ea2('0x4c')](),'priority':_0x4148c1[_0x8ea2('0x4d')]})[_0x8ea2('0x14')](function(_0x58674d){_0x1b8c4b(null,_0x58674d);})['catch'](function(_0x577049){_0x1b8c4b(_0x577049);});};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x4e')]=function(_0x2b95b0,_0x74520e){this[_0x8ea2('0x12')][_0x8ea2('0x4f')](_0x2b95b0)[_0x8ea2('0x14')](function(_0x5265e7){_0x74520e(null,_0x5265e7?_0x5265e7['name']:![]);})['catch'](function(_0x3d6fd6){_0x74520e(_0x3d6fd6);});};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x50')]=function(_0x2bbec0,_0x57720d,_0x11824e){var _0x2b8662={'role':'agent'};_0x2b8662[_0x2bbec0]=this[_0x8ea2('0x11')][_0x8ea2('0x3c')];this[_0x8ea2('0x12')][_0x8ea2('0x50')](_0x2b8662,_0x57720d,this[_0x8ea2('0x11')]['uniqueid'])['then'](function(_0x4e87fe){_0x11824e(null,_[_0x8ea2('0x51')](_0x4e87fe)?![]:!![]);})[_0x8ea2('0x16')](function(_0x2fd365){logger[_0x8ea2('0x52')](_0x2fd365);_0x11824e(null,![]);});};AGIVertices[_0x8ea2('0x19')]['agentUnpause']=function(_0x461d32,_0x3b3eab){var _0x1d9d22={'role':_0x8ea2('0x53')};_0x1d9d22[_0x461d32]=this['channel'][_0x8ea2('0x3c')];this['rpc'][_0x8ea2('0x54')](_0x1d9d22)['then'](function(_0x361bb3){_0x3b3eab(null,_[_0x8ea2('0x51')](_0x361bb3)?![]:!![]);})['catch'](function(_0x549c71){logger[_0x8ea2('0x52')](_0x549c71);_0x3b3eab(null,![]);});};AGIVertices['prototype'][_0x8ea2('0x55')]=function(_0x31a56f,_0x1c5489){var _0x23185e={'role':'agent'};_0x23185e[_0x31a56f]=this[_0x8ea2('0x11')][_0x8ea2('0x3c')];this[_0x8ea2('0x12')][_0x8ea2('0x55')](_0x23185e)[_0x8ea2('0x14')](function(_0x212c16){_0x1c5489(null,_[_0x8ea2('0x51')](_0x212c16)?![]:!![]);})[_0x8ea2('0x16')](function(_0x253a6e){logger[_0x8ea2('0x52')](_0x253a6e);_0x1c5489(null,![]);});};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x56')]=function(_0x533cea,_0x23fce4){var _0x2d130a={'role':_0x8ea2('0x53')};_0x2d130a[_0x533cea]=this[_0x8ea2('0x11')][_0x8ea2('0x3c')];var _0x219f78=_0x533cea!=_0x8ea2('0x57')?util[_0x8ea2('0x2b')](_0x8ea2('0x58'),_0x8ea2('0x59'),this[_0x8ea2('0x11')][_0x8ea2('0x3c')]):undefined;this['rpc'][_0x8ea2('0x56')](_0x2d130a,_0x219f78)[_0x8ea2('0x14')](function(_0xb55bc6){_0x23fce4(null,_[_0x8ea2('0x51')](_0xb55bc6)?![]:!![]);})[_0x8ea2('0x16')](function(_0x4c04a0){logger['error'](_0x4c04a0);_0x23fce4(null,![]);});};AGIVertices['prototype'][_0x8ea2('0x5a')]=function(_0xe8b3ed,_0x380066){sh[_0x8ea2('0x5b')](_[_0x8ea2('0x5c')](_0xe8b3ed),function(_0x8b694f,_0x57db65){var _0x428106=_0x57db65[_0x8ea2('0x5d')](/(\r\n|\n|\r)/gm,'');_0x380066(null,_0x428106);});};AGIVertices['prototype']['googleCloudTTS']=function(_0x2a7ccc,_0x145a88){scripts[_0x8ea2('0x5e')](_0x2a7ccc[_0x8ea2('0x5f')],_0x2a7ccc[_0x8ea2('0x60')]||_0x8ea2('0x61'),_0x2a7ccc[_0x8ea2('0x61')],_0x2a7ccc['languageCode']||_0x8ea2('0x62'),_0x2a7ccc[_0x8ea2('0x63')]||_0x8ea2('0x64'),_0x2a7ccc[_0x8ea2('0x65')]||'MP3')[_0x8ea2('0x14')](function(_0x356099){_0x145a88(null,_0x356099);})[_0x8ea2('0x16')](function(_0x5ae776){_0x145a88(_0x5ae776);});};AGIVertices[_0x8ea2('0x19')]['googleTTS']=function(_0x505c80,_0x188809){scripts[_0x8ea2('0x66')](_0x505c80['text'],_0x505c80['google_tts_language']||'en',0x1)['then'](function(_0x167f15){_0x188809(null,_0x167f15);})['catch'](function(_0x555608){_0x188809(_0x555608);});};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x67')]=function(_0xa08c2,_0x2dfd8f){var _0x1681d8={'uri':_0xa08c2[_0x8ea2('0x68')],'method':_0xa08c2[_0x8ea2('0x69')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0xa08c2[_0x8ea2('0x6a')])===_0x8ea2('0x6b')&&parseInt(_0xa08c2[_0x8ea2('0x6a')])>=0x1?parseInt(_0xa08c2[_0x8ea2('0x6a')])*0x3e8:0x5*0x3e8};if(_[_0x8ea2('0x6c')]([_0x8ea2('0x6d'),_0x8ea2('0x6e')],_0x1681d8['method'][_0x8ea2('0x6f')]())){try{_0x1681d8[_0x8ea2('0x70')]=_0xa08c2[_0x8ea2('0xd')]?JSON['parse'](_0xa08c2[_0x8ea2('0xd')]):{};}catch(_0x486ae8){logger[_0x8ea2('0x52')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x486ae8);}}try{_0x1681d8[_0x8ea2('0x71')]=_0xa08c2['rawHeaders']?JSON[_0x8ea2('0x72')](_0xa08c2[_0x8ea2('0xc')]):{};}catch(_0x4cdc8d){logger[_0x8ea2('0x52')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x4cdc8d);}if(_0xa08c2[_0x8ea2('0x73')]){try{var _0x2c3a18=require(_0xa08c2[_0x8ea2('0x73')])[_0x8ea2('0x74')](this,_0x1681d8);_0x1681d8[_0x8ea2('0x75')]=Mustache['render'](_0xa08c2['url'],_0x2c3a18,{},['$$','$$']);if(_0x1681d8[_0x8ea2('0x71')]){_0x1681d8['headers']=JSON[_0x8ea2('0x72')](Mustache[_0x8ea2('0x76')](JSON[_0x8ea2('0x77')](_0x1681d8[_0x8ea2('0x71')]),_0x2c3a18,{},['$$','$$']));}if(_0x1681d8[_0x8ea2('0x70')]){_0x1681d8[_0x8ea2('0x70')]=JSON['parse'](Mustache['render'](JSON['stringify'](_0x1681d8[_0x8ea2('0x70')]),_0x2c3a18,{},['$$','$$']));}}catch(_0x576075){logger[_0x8ea2('0x52')](_0x8ea2('0x78'),_0x576075);}}rp(_0x1681d8)[_0x8ea2('0x14')](function(_0x30a59a){var _0x244c30={'statusCode':_0x30a59a[_0x8ea2('0x79')]||0xc8,'statusMessage':_0x30a59a['statusMessage']||'OK','headers':_0x30a59a[_0x8ea2('0x71')]||{},'body':_0x30a59a[_0x8ea2('0x70')]||{}};_0x2dfd8f(null,_0x244c30);})[_0x8ea2('0x16')](function(_0x335a96){var _0x2329fa={'statusCode':_0x335a96['statusCode']||0x1f4,'statusMessage':_0x335a96['message']||_0x8ea2('0x7a'),'headers':_0x335a96[_0x8ea2('0x7b')][_0x8ea2('0x71')]||{},'body':_0x335a96[_0x8ea2('0x7b')][_0x8ea2('0x70')]||{}};_0x2dfd8f(null,_0x2329fa);});};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x7c')]=function(_0x9c4960,_0x27edbd){scripts[_0x8ea2('0x7c')](this[_0x8ea2('0x11')][_0x8ea2('0x38')],_0x9c4960[_0x8ea2('0x7d')],_0x9c4960[_0x8ea2('0x61')],_0x9c4960[_0x8ea2('0x7e')]||'en')[_0x8ea2('0x14')](function(_0x2121d5){_0x27edbd(null,_0x2121d5);})['catch'](function(_0x549b70){_0x27edbd(_0x549b70);});};AGIVertices[_0x8ea2('0x19')]['googleDialogflowV2']=function(_0x1cd355,_0x321416){scripts['googleDialogflowV2'](this[_0x8ea2('0x11')]['uniqueid'],_0x1cd355[_0x8ea2('0x7f')],_0x1cd355[_0x8ea2('0x80')],_0x1cd355['private_key'],_0x1cd355[_0x8ea2('0x61')],_0x1cd355[_0x8ea2('0x81')]||'en')[_0x8ea2('0x14')](function(_0x3b5eab){_0x321416(null,_0x3b5eab);})[_0x8ea2('0x16')](function(_0x28e80a){_0x321416(_0x28e80a);});};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x82')]=function(_0x46a49c,_0x371d0){scripts['sestekNDA'](this[_0x8ea2('0x11')],_0x46a49c)[_0x8ea2('0x14')](function(_0x57d246){_0x371d0(null,_0x57d246);})[_0x8ea2('0x16')](function(_0x5a69e6){_0x371d0(_0x5a69e6);});};AGIVertices['prototype']['ispeechTTS']=function(_0xffbdc7,_0x47d4ca){scripts[_0x8ea2('0x83')](_0xffbdc7[_0x8ea2('0x7d')],_0xffbdc7[_0x8ea2('0x61')],_0xffbdc7[_0x8ea2('0x84')]||_0x8ea2('0x62'),_0xffbdc7[_0x8ea2('0x85')])['then'](function(_0x2f4f45){_0x47d4ca(null,_0x2f4f45);})['catch'](function(_0x1e6c5e){_0x47d4ca(_0x1e6c5e);});};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x86')]=function(_0x3fb18e,_0x44178d,_0x4d940b){scripts[_0x8ea2('0x86')](_0x44178d,_0x3fb18e[_0x8ea2('0x7d')],_0x3fb18e[_0x8ea2('0x87')]||_0x8ea2('0x62'),this[_0x8ea2('0x88')](_0x3fb18e[_0x8ea2('0x89')])?_0x3fb18e[_0x8ea2('0x89')]:undefined)[_0x8ea2('0x14')](function(_0x2e3551){_0x4d940b(null,_0x2e3551);})[_0x8ea2('0x16')](function(_0x16fefb){_0x4d940b(_0x16fefb);});};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x8a')]=function(_0xf2f97f,_0x17649b){scripts[_0x8ea2('0x8a')](_0xf2f97f[_0x8ea2('0x8b')],_0xf2f97f['aws_secret_access_key'],_0xf2f97f[_0x8ea2('0x8c')],_0xf2f97f['aws_polly_voice']||'Amy',_0xf2f97f[_0x8ea2('0x61')],_0xf2f97f[_0x8ea2('0x8d')]||'text')[_0x8ea2('0x14')](function(_0x5cb85b){_0x17649b(null,_0x5cb85b);})['catch'](function(_0x3bc0ae){_0x17649b(_0x3bc0ae);});};AGIVertices[_0x8ea2('0x19')]['awsLex']=function(_0x40e96a,_0x156a23){scripts[_0x8ea2('0x8e')](this[_0x8ea2('0x11')][_0x8ea2('0x38')],_0x40e96a['aws_access_key_id'],_0x40e96a[_0x8ea2('0x8f')],_0x40e96a[_0x8ea2('0x90')],_0x40e96a[_0x8ea2('0x61')],_0x40e96a[_0x8ea2('0x91')])[_0x8ea2('0x14')](function(_0x44d521){_0x156a23(null,_0x44d521);})[_0x8ea2('0x16')](function(_0x36116d){_0x156a23(_0x36116d);});};AGIVertices[_0x8ea2('0x19')]['googleASR']=function(_0x4183cb,_0x51276b,_0x10cd1e){scripts[_0x8ea2('0x92')](_0x51276b,_0x4183cb[_0x8ea2('0x7d')],_0x4183cb[_0x8ea2('0x93')]||_0x8ea2('0x62'))['then'](function(_0x315652){_0x10cd1e(null,_0x315652);})[_0x8ea2('0x16')](function(_0x4fdd16){_0x10cd1e(_0x4fdd16);});};AGIVertices['prototype'][_0x8ea2('0x94')]=function(_0x1fa813,_0x5f4cbd,_0x47a70d){scripts[_0x8ea2('0x94')](_0x5f4cbd,_0x1fa813[_0x8ea2('0x95')],_0x1fa813['appsecret'],_0x1fa813[_0x8ea2('0x75')])[_0x8ea2('0x14')](function(_0x306247){_0x47a70d(null,_0x306247);})[_0x8ea2('0x16')](function(_0xdf4de9){_0x47a70d(_0xdf4de9);});};AGIVertices['prototype'][_0x8ea2('0x96')]=function(_0x1ab0b1){var _0x3f8c1c=_[_0x8ea2('0x6c')](verticesWithRetry,_0x1ab0b1[_0x8ea2('0x3a')])?_0x1ab0b1:_['clone'](_0x1ab0b1);for(var _0x1da1e7 in _0x3f8c1c){if(_0x3f8c1c['hasOwnProperty'](_0x1da1e7)){if(_0x3f8c1c[_0x1da1e7]&&_['isString'](_0x3f8c1c[_0x1da1e7])){if(_[_0x8ea2('0x6c')](recursiveMapAttributes,_0x1da1e7)){_0x3f8c1c[_0x1da1e7]=this[_0x8ea2('0x97')](_0x3f8c1c[_0x1da1e7]);}else{_0x3f8c1c[_0x1da1e7]=this['replaceAllVariables'](_0x3f8c1c[_0x1da1e7]);}}}}return _0x3f8c1c;};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x98')]=function(_0x27e1a9){for(var _0x888634 in _0x27e1a9){if(_0x27e1a9[_0x8ea2('0x99')](_0x888634)){if(_[_0x8ea2('0x9a')](_0x27e1a9[_0x888634])){this['recursiveNodeIndex'](_0x27e1a9[_0x888634]);}else if(_[_0x8ea2('0x9b')](_0x27e1a9[_0x888634])){for(var _0x4c3838=0x0;_0x4c3838<_0x27e1a9[_0x888634][_0x8ea2('0x9c')];_0x4c3838++){this['recursiveNodeIndex'](_0x27e1a9[_0x888634][_0x4c3838]);}}else if(_[_0x8ea2('0x9d')](_0x27e1a9[_0x888634])){_0x27e1a9[_0x888634]=this[_0x8ea2('0x9e')](_0x27e1a9[_0x888634]);}}}};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x9f')]=function(_0x470099,_0x49d292){for(var _0x16e3fb in _0x470099){if(_0x470099[_0x8ea2('0x99')](_0x16e3fb)){if(_[_0x8ea2('0x9a')](_0x470099[_0x16e3fb])){if(!_[_0x8ea2('0x46')](_0x470099[_0x16e3fb])){this['saveRestApiResult'](_0x470099[_0x16e3fb],util['format'](_0x8ea2('0xa0'),_0x49d292,_0x16e3fb));}}else if(_['isArray'](_0x470099[_0x16e3fb])){for(var _0x177c54=0x0;_0x177c54<_0x470099[_0x16e3fb]['length'];_0x177c54++){this[_0x8ea2('0x9f')](_0x470099[_0x16e3fb][_0x177c54],util[_0x8ea2('0x2b')](_0x8ea2('0xa0'),_0x49d292,_0x16e3fb+'['+_0x177c54+']'));}}else{if(!_[_0x8ea2('0x51')](_0x470099[_0x16e3fb])){this[_0x8ea2('0x11')][_0x8ea2('0xa1')](util[_0x8ea2('0x2b')]('%s.%s',_0x49d292,_0x16e3fb),_0x470099[_0x16e3fb]);}}}}};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x97')]=function(_0x5eda07){try{var _0x87e93f=JSON[_0x8ea2('0x72')](_0x5eda07);this[_0x8ea2('0x98')](_0x87e93f);return JSON['stringify'](_0x87e93f);}catch(_0xc33ccd){return this[_0x8ea2('0x9e')](_0x5eda07);}};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x9e')]=function(_0x54eed1){var _0x4971dc=_0x54eed1['split']('{');for(var _0x437461=0x1;_0x437461<_0x4971dc[_0x8ea2('0x9c')];_0x437461+=0x1){var _0x175305=_0x4971dc[_0x437461]['split']('}');if(_0x175305[_0x8ea2('0x9c')]>0x1){_0x54eed1=_0x54eed1[_0x8ea2('0xa2')]('{'+_0x175305[0x0]+'}',this[_0x8ea2('0x11')]['getVariable'](_0x175305[0x0])[_0x8ea2('0xa3')]||_0x175305[0x0]);}}if(_0x4971dc[_0x8ea2('0x9c')]===0x1){return _0x54eed1['toString']();}return this[_0x8ea2('0x9e')](_0x54eed1);};AGIVertices['prototype']['getAndSetVariable']=function(_0x2294c3,_0xfff26b){var _0x405020=this['channel'][_0x8ea2('0xa4')](_0x2294c3);if(_0x405020[_0x8ea2('0xa5')]===-0x1){return _0x405020;}logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0xa6'),_0xfff26b,_0x405020[_0x8ea2('0xa3')]));return this[_0x8ea2('0x11')]['setVariable'](_0xfff26b,_0x405020[_0x8ea2('0xa3')]);};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x88')]=function(_0x384500){return _0x384500&&_0x384500!=='0'&&_0x384500!=='-1'&&_0x384500!=='';};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0xa7')]=function(_0x85158c){this['createSquareDetailsReport'][_0x8ea2('0x74')](this,_0x85158c,'-');_0x85158c[_0x8ea2('0xa8')]=_0x85158c[_0x8ea2('0xa7')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0xa9')]=function(_0x55971a){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0xaa'),_0x55971a[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x55971a[_0x8ea2('0x61')])){return this[_0x8ea2('0x11')][_0x8ea2('0xab')](_0x8ea2('0xac'));}var _0x4d3706='\x22'+_0x55971a['text']+'\x22';if(this['isConfigured'](_0x55971a[_0x8ea2('0x7b')])){_0x4d3706+=','+_0x55971a['options'];}var _0x458c7f=this[_0x8ea2('0x11')][_0x8ea2('0x5b')](_0x8ea2('0xad'),_0x4d3706);if(_0x458c7f[_0x8ea2('0xa5')]===-0x1){return _0x458c7f;}return this[_0x8ea2('0x11')][_0x8ea2('0xab')](util[_0x8ea2('0x2b')](_0x8ea2('0xae'),_0x4d3706));};AGIVertices[_0x8ea2('0x19')]['mrcprecog']=function(_0x410199){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0xaf'),_0x410199[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x410199[_0x8ea2('0xb0')])){return this[_0x8ea2('0x11')][_0x8ea2('0xab')](_0x8ea2('0xb1'));}var _0x1a64d1=_0x410199[_0x8ea2('0xb0')];if(this[_0x8ea2('0x88')](_0x410199[_0x8ea2('0x7b')])){_0x1a64d1+=','+_0x410199[_0x8ea2('0x7b')];}var _0x1dd4f2=this[_0x8ea2('0x11')]['exec']('MRCPRecog',_0x1a64d1);if(_0x1dd4f2['result']===-0x1){return _0x1dd4f2;}var _0x4b2c0f=this[_0x8ea2('0xb2')](_0x8ea2('0xb3'),'MRCP_RECOG_CONFIDENCE');if(_0x4b2c0f[_0x8ea2('0xa5')]===-0x1){return _0x4b2c0f;}var _0xbd1141=this[_0x8ea2('0xb2')](_0x8ea2('0xb4'),'MRCP_RECOG_TRANSCRIPT');if(_0xbd1141[_0x8ea2('0xa5')]===-0x1){return _0xbd1141;}var _0x564180=this[_0x8ea2('0xb2')](_0x8ea2('0xb5'),_0x8ea2('0xb6'));if(_0x564180[_0x8ea2('0xa5')]===-0x1){return _0x564180;}return this[_0x8ea2('0x11')][_0x8ea2('0xab')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x1a64d1));};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x8')]=function(_0x53ff43){logger[_0x8ea2('0x31')](util['format'](_0x8ea2('0xb7'),_0x53ff43[_0x8ea2('0x39')]));return this[_0x8ea2('0x11')][_0x8ea2('0x8')]([_0x53ff43[_0x8ea2('0xb8')],_0x53ff43[_0x8ea2('0xb9')]]);};AGIVertices[_0x8ea2('0x19')]['answer']=function(_0x3f3822){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0xba'),_0x3f3822[_0x8ea2('0x39')]));if(this[_0x8ea2('0x88')](_0x3f3822[_0x8ea2('0x6a')])){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x3f3822[_0x8ea2('0x6a')]));var _0x2bbf85=this[_0x8ea2('0x11')]['wait'](_0x3f3822[_0x8ea2('0x6a')]);if(_0x2bbf85[_0x8ea2('0xa5')]===-0x1){return _0x2bbf85;}}return this[_0x8ea2('0x11')][_0x8ea2('0xbb')]();};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0xbc')]=function(_0x590e53){logger['info'](util[_0x8ea2('0x2b')](_0x8ea2('0xbd'),_0x590e53[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x590e53[_0x8ea2('0x49')])){return this['channel'][_0x8ea2('0x52')](_0x590e53,'no\x20list\x20selected');}_0x590e53[_0x8ea2('0x4b')]=moment();if(this[_0x8ea2('0x88')](_0x590e53['delay'])){_0x590e53[_0x8ea2('0x4b')]=moment()[_0x8ea2('0xbe')](_0x590e53[_0x8ea2('0xbf')],_0x8ea2('0xc0'));}if(!this[_0x8ea2('0x88')](_0x590e53[_0x8ea2('0x4d')])){_0x590e53[_0x8ea2('0x4d')]=0x2;}this[_0x8ea2('0x45')][_0x8ea2('0x74')](this,_0x590e53);return this[_0x8ea2('0x11')]['noop'](util[_0x8ea2('0x2b')](_0x8ea2('0xc1'),_0x590e53[_0x8ea2('0x48')],_0x590e53['list_id'],_0x590e53[_0x8ea2('0x4b')]));};AGIVertices['prototype'][_0x8ea2('0xc2')]=function(_0x34e6dd){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0xc3'),_0x34e6dd[_0x8ea2('0x39')]));var _0x7a45a8=this[_0x8ea2('0x11')][_0x8ea2('0x5b')](_0x34e6dd['application'],_0x34e6dd[_0x8ea2('0x7b')]);if(_0x7a45a8[_0x8ea2('0xa5')]===-0x1){return _0x7a45a8;}return this[_0x8ea2('0x11')][_0x8ea2('0xab')](util[_0x8ea2('0x2b')](_0x8ea2('0xc4'),_0x34e6dd[_0x8ea2('0xc5')],_0x34e6dd[_0x8ea2('0x7b')]));};AGIVertices[_0x8ea2('0x19')]['lumenvoxtts']=function(_0xf2a59a){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0xc6'),_0xf2a59a[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0xf2a59a[_0x8ea2('0x61')])){return this[_0x8ea2('0x11')][_0x8ea2('0xab')](_0x8ea2('0xac'));}var _0x4478c2='\x22'+_0xf2a59a['text']+'\x22';if(this[_0x8ea2('0x88')](_0xf2a59a['options'])){_0x4478c2+=','+_0xf2a59a[_0x8ea2('0x7b')];}var _0x21b282=this[_0x8ea2('0x11')]['exec'](_0x8ea2('0xad'),_0x4478c2);if(_0x21b282['result']===-0x1){return _0x21b282;}return this['channel']['noop'](util[_0x8ea2('0x2b')]('Executed\x20command\x20MRCPSynth\x20%s',_0x4478c2));};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0xc7')]=function(_0x46e467){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0xc8'),_0x46e467[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x46e467['text'])){return this['channel'][_0x8ea2('0xab')](_0x8ea2('0xac'));}var _0x1572f2='\x22'+_0x46e467['text']+'\x22';if(this['isConfigured'](_0x46e467['options'])){_0x1572f2+=','+_0x46e467[_0x8ea2('0x7b')];}var _0x4d0495=this['channel'][_0x8ea2('0x5b')](_0x8ea2('0xad'),_0x1572f2);if(_0x4d0495['result']===-0x1){return _0x4d0495;}return this['channel'][_0x8ea2('0xab')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x1572f2));};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0xc9')]=function(_0x384cef){logger['info'](util[_0x8ea2('0x2b')](_0x8ea2('0xca'),_0x384cef[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x384cef[_0x8ea2('0xb0')])){return this['channel'][_0x8ea2('0xab')]('no\x20grammar\x20configured');}var _0x481fd0=_0x384cef['grammar'];if(this[_0x8ea2('0x88')](_0x384cef['options'])){_0x481fd0+=','+_0x384cef['options'];}var _0x2f8154=this[_0x8ea2('0x11')][_0x8ea2('0x5b')](_0x8ea2('0xcb'),_0x481fd0);if(_0x2f8154[_0x8ea2('0xa5')]===-0x1){return _0x2f8154;}var _0x168f0e=this[_0x8ea2('0xb2')](_0x8ea2('0xb3'),'LUMENVOX_ASR_CONFIDENCE');if(_0x168f0e[_0x8ea2('0xa5')]===-0x1){return _0x168f0e;}var _0x1e216b=this[_0x8ea2('0xb2')](_0x8ea2('0xb4'),_0x8ea2('0xcc'));if(_0x1e216b['result']===-0x1){return _0x1e216b;}var _0x261e47=this['getAndSetVariable'](_0x8ea2('0xb5'),'LUMENVOX_ASR_INSTANCE');if(_0x261e47[_0x8ea2('0xa5')]===-0x1){return _0x261e47;}return this[_0x8ea2('0x11')][_0x8ea2('0xab')](util[_0x8ea2('0x2b')]('Executed\x20command\x20MRCPRecog\x20%s',_0x481fd0));};AGIVertices['prototype']['sestekasr']=function(_0x37347a){logger[_0x8ea2('0x31')](util['format'](_0x8ea2('0xcd'),_0x37347a[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x37347a[_0x8ea2('0xb0')])){return this[_0x8ea2('0x11')][_0x8ea2('0xab')](_0x8ea2('0xb1'));}var _0x17b2c0=_0x37347a[_0x8ea2('0xb0')];if(this[_0x8ea2('0x88')](_0x37347a[_0x8ea2('0x7b')])){_0x17b2c0+=','+_0x37347a[_0x8ea2('0x7b')];}var _0x70b34f=this['channel'][_0x8ea2('0x5b')]('MRCPRecog',_0x17b2c0);if(_0x70b34f['result']===-0x1){return _0x70b34f;}var _0x41ee31=this['getAndSetVariable'](_0x8ea2('0xb3'),_0x8ea2('0xce'));if(_0x41ee31[_0x8ea2('0xa5')]===-0x1){return _0x41ee31;}var _0x1a441c=this[_0x8ea2('0xb2')]('RECOG_INPUT()',_0x8ea2('0xcf'));if(_0x1a441c[_0x8ea2('0xa5')]===-0x1){return _0x1a441c;}var _0x39add3=this['getAndSetVariable']('RECOG_INSTANCE()',_0x8ea2('0xd0'));if(_0x39add3[_0x8ea2('0xa5')]===-0x1){return _0x39add3;}return this['channel'][_0x8ea2('0xab')](util['format'](_0x8ea2('0xd1'),_0x17b2c0));};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0xd2')]=function(_0x280ed0){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0xd3'),_0x280ed0[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x280ed0['odbc_id'])){return this['channel'][_0x8ea2('0x52')](_0x280ed0,'no\x20database\x20selected');}var _0xc218e0=this[_0x8ea2('0x1c')][_0x8ea2('0x74')](this,_0x280ed0[_0x8ea2('0xd4')]);if(!_0xc218e0){return this['channel'][_0x8ea2('0x52')](_0x280ed0,_0x8ea2('0xd5'));}if(!this['isConfigured'](_0x280ed0[_0x8ea2('0x30')])){return this[_0x8ea2('0x11')][_0x8ea2('0x52')](_0x280ed0,'no\x20query\x20configured');}var _0x58d7a0=_0x280ed0['query'][_0x8ea2('0x5d')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x8ea2('0xab')](util['format'](_0x8ea2('0xd6'),_0x58d7a0));var _0x2bd2e6=this[_0x8ea2('0x2d')][_0x8ea2('0x74')](this,_0xc218e0,_0x58d7a0);this['createSquareDetailsReport'][_0x8ea2('0x74')](this,_0x280ed0,_0x58d7a0);if(!this['isConfigured'](_0x280ed0['variable_id'])){return this['channel'][_0x8ea2('0xab')](_0x8ea2('0xd7'));}var _0x40d91f=this['getVariable'][_0x8ea2('0x74')](this,_0x280ed0[_0x8ea2('0xd8')]);if(!_0x40d91f){return this[_0x8ea2('0x11')][_0x8ea2('0x52')](_0x280ed0,_0x8ea2('0xd9'));}var _0x18e3ca=this;_0x2bd2e6[_0x8ea2('0xda')](function(_0x3ffb58,_0x28fe8c){Object[_0x8ea2('0xdb')](_0x3ffb58)[_0x8ea2('0xda')](function(_0xc35654){_0x18e3ca[_0x8ea2('0x11')][_0x8ea2('0xa1')](util['format']('%s[%s][%s]',_0x40d91f,_0x28fe8c,_0xc35654),_0x3ffb58[_0xc35654]);});});this[_0x8ea2('0x11')]['setVariable'](util[_0x8ea2('0x2b')](_0x8ea2('0xdc'),_0x40d91f),_0x2bd2e6[_0x8ea2('0x9c')]);return this['channel'][_0x8ea2('0xab')](util['format']('variable\x20%s\x20set',_0x40d91f));};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0xdd')]=function(_0x6f4bf9){logger[_0x8ea2('0xde')](util[_0x8ea2('0x2b')](_0x8ea2('0xdf'),_0x6f4bf9[_0x8ea2('0x39')]));if(!this['isConfigured'](_0x6f4bf9[_0x8ea2('0xe0')])){return this[_0x8ea2('0x11')][_0x8ea2('0x52')](_0x6f4bf9,'no\x20user\x20selected');}var _0x5c0d83=this[_0x8ea2('0xe1')][_0x8ea2('0x74')](this,_0x6f4bf9['sip_id']);if(!_0x5c0d83){return this[_0x8ea2('0x11')][_0x8ea2('0x52')](_0x6f4bf9,_0x8ea2('0xe2'));}var _0x588c74=this['channel'][_0x8ea2('0x5b')]('DIAL',[util[_0x8ea2('0x2b')]('SIP/%s',_0x5c0d83),_0x6f4bf9[_0x8ea2('0x6a')],_0x6f4bf9[_0x8ea2('0xe3')],_0x6f4bf9[_0x8ea2('0x68')]]);if(_0x588c74[_0x8ea2('0xa5')]===-0x1){return _0x588c74;}return this[_0x8ea2('0x11')]['noop'](util[_0x8ea2('0x2b')](_0x8ea2('0xe4'),_0x8ea2('0xe5')));};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0xe6')]=function(_0x1949b1){logger['info'](util['format'](_0x8ea2('0xe7'),_0x1949b1[_0x8ea2('0x39')]));if(!this['isConfigured'](_0x1949b1[_0x8ea2('0x7d')])){return this[_0x8ea2('0x11')][_0x8ea2('0xab')](_0x8ea2('0xe8'));}if(!this['isConfigured'](_0x1949b1[_0x8ea2('0x61')])){return this[_0x8ea2('0x11')]['noop'](_0x8ea2('0xac'));}this['channel'][_0x8ea2('0xe9')]=!![];this['createSquareDetailsReport'](_0x1949b1);this['createSquareMessage'](_0x1949b1[_0x8ea2('0x61')],'in','','');this[_0x8ea2('0x11')][_0x8ea2('0xab')](util[_0x8ea2('0x2b')]('Trying\x20Dialogflow:\x20%s',_0x1949b1[_0x8ea2('0x61')]));var _0x262b2c=this[_0x8ea2('0x7c')]['sync'](this,_0x1949b1);if(_0x262b2c){for(var _0x1dd401 in _0x262b2c){if(_0x262b2c[_0x8ea2('0x99')](_0x1dd401)){this[_0x8ea2('0x11')][_0x8ea2('0xa1')](util[_0x8ea2('0x2b')](_0x8ea2('0xea'),_0x1dd401[_0x8ea2('0x6f')]()),_0x262b2c[_0x1dd401]);}}this['createSquareMessage'](_0x262b2c[_0x8ea2('0xeb')],_0x8ea2('0xec'),_0x8ea2('0xe6'),'');return this[_0x8ea2('0x11')][_0x8ea2('0xab')](util[_0x8ea2('0x2b')](_0x8ea2('0xed'),_0x262b2c[_0x8ea2('0xeb')]));}return this[_0x8ea2('0x11')][_0x8ea2('0x52')](_0x1949b1,_0x8ea2('0xee'));};AGIVertices[_0x8ea2('0x19')]['dialogflowV2']=function(_0x58a0e5){logger[_0x8ea2('0x31')](util['format'](_0x8ea2('0xef'),_0x58a0e5[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x58a0e5[_0x8ea2('0x7f')])){return this[_0x8ea2('0x11')]['noop'](_0x8ea2('0xf0'));}if(!this[_0x8ea2('0x88')](_0x58a0e5['client_email'])){return this[_0x8ea2('0x11')][_0x8ea2('0xab')](_0x8ea2('0xf1'));}if(!this[_0x8ea2('0x88')](_0x58a0e5['private_key'])){return this[_0x8ea2('0x11')][_0x8ea2('0xab')](_0x8ea2('0xf2'));}if(!this[_0x8ea2('0x88')](_0x58a0e5['dialogflowV2_language'])){return this[_0x8ea2('0x11')][_0x8ea2('0xab')](_0x8ea2('0xf3'));}if(!this['isConfigured'](_0x58a0e5[_0x8ea2('0x61')])){return this[_0x8ea2('0x11')][_0x8ea2('0xab')]('no\x20text\x20configured');}this['channel'][_0x8ea2('0xe9')]=!![];this['createSquareDetailsReport'](_0x58a0e5);this[_0x8ea2('0x44')](_0x58a0e5[_0x8ea2('0x61')],'in','','');this[_0x8ea2('0x11')][_0x8ea2('0xab')](util['format'](_0x8ea2('0xf4'),_0x58a0e5['text']));var _0x55dcf0=this['googleDialogflowV2']['sync'](this,_0x58a0e5);if(_0x55dcf0){for(var _0x1f8044 in _0x55dcf0){if(_0x55dcf0[_0x8ea2('0x99')](_0x1f8044)){if(_0x1f8044!==_0x8ea2('0xf5')){this[_0x8ea2('0x11')][_0x8ea2('0xa1')](util['format']('DIALOGFLOW_%s',_0x1f8044[_0x8ea2('0x6f')]()),_0x55dcf0[_0x1f8044]);}}}this['createSquareMessage'](_0x55dcf0['speech'],_0x8ea2('0xec'),_0x8ea2('0xf6'),_0x55dcf0[_0x8ea2('0xf5')]);return this['channel'][_0x8ea2('0xab')](util['format'](_0x8ea2('0xf7'),_0x55dcf0[_0x8ea2('0xeb')]));}return this['channel'][_0x8ea2('0x52')](_0x58a0e5,_0x8ea2('0xf8'));};AGIVertices['prototype'][_0x8ea2('0xf9')]=function(_0x186b44){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0xfa'),_0x186b44[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x186b44[_0x8ea2('0xfb')])){return this[_0x8ea2('0x11')]['noop'](_0x8ea2('0xfc'));}if(!this['isConfigured'](_0x186b44[_0x8ea2('0xfd')])){return this[_0x8ea2('0x11')][_0x8ea2('0xab')](_0x8ea2('0xfe'));}if(!this[_0x8ea2('0x88')](_0x186b44[_0x8ea2('0xff')])){return this[_0x8ea2('0x11')][_0x8ea2('0xab')]('no\x20password\x20configured');}if(!this['isConfigured'](_0x186b44[_0x8ea2('0x100')])){return this[_0x8ea2('0x11')][_0x8ea2('0xab')](_0x8ea2('0xac'));}this[_0x8ea2('0x11')]['bot']=!![];this[_0x8ea2('0x37')](_0x186b44);this[_0x8ea2('0x44')](_0x186b44['text'],'in','','');this[_0x8ea2('0x11')][_0x8ea2('0xab')](util[_0x8ea2('0x2b')]('Trying\x20SestekNDA:\x20%s',_0x186b44['text']));var _0x166a8e=this['sestekNDA'][_0x8ea2('0x74')](this,_0x186b44);if(_0x166a8e){for(var _0x38a6ff in _0x166a8e){if(_0x166a8e[_0x8ea2('0x99')](_0x38a6ff)){this[_0x8ea2('0x11')][_0x8ea2('0xa1')](util[_0x8ea2('0x2b')](_0x8ea2('0x101'),_0x38a6ff[_0x8ea2('0x6f')]()),_0x166a8e[_0x38a6ff]);}}this[_0x8ea2('0x44')](_0x166a8e[_0x8ea2('0xeb')],_0x8ea2('0xec'),_0x8ea2('0xf9'),'');if(_0x166a8e[_0x8ea2('0x102')]){this[_0x8ea2('0x11')][_0x8ea2('0xab')](util[_0x8ea2('0x2b')](_0x8ea2('0x103'),_0x166a8e[_0x8ea2('0x102')]));var _0x416bc5=this['channel']['streamFile'](_0x166a8e['audiofile']);try{fs[_0x8ea2('0x104')](_0x166a8e[_0x8ea2('0x102')]+_0x8ea2('0x105'));}catch(_0x9410dd){logger['error'](_0x9410dd);}return _0x416bc5;}else{return this['channel'][_0x8ea2('0xab')](util['format'](_0x8ea2('0x106'),_0x166a8e[_0x8ea2('0xeb')]));}}return this[_0x8ea2('0x11')][_0x8ea2('0x52')](_0x186b44,_0x8ea2('0x107'));};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x108')]=function(_0x57a7ac){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x109'),_0x57a7ac[_0x8ea2('0x39')]));return this['channel']['noop'](_0x8ea2('0x108'));};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x10a')]=function(_0x571f23){logger['info'](util[_0x8ea2('0x2b')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x571f23[_0x8ea2('0x39')]));var _0x38e038='';if(_0x571f23[_0x8ea2('0x10b')]){if(!this['isConfigured'](_0x571f23[_0x8ea2('0x10b')])){return this[_0x8ea2('0x11')][_0x8ea2('0x52')](_0x571f23,_0x8ea2('0x10c'));}else{var _0x515049=parseInt(_0x571f23['trunk_id'],0xa);if(isNaN(_0x515049)){_0x38e038=_0x571f23[_0x8ea2('0x10b')];}else{_0x38e038=this[_0x8ea2('0x1f')][_0x8ea2('0x74')](this,_0x571f23['trunk_id']);if(!_0x38e038){return this[_0x8ea2('0x11')]['error'](_0x571f23,_0x8ea2('0x10d'));}}}}else if(_0x571f23['trunk_name']){_0x38e038=_0x571f23[_0x8ea2('0x10e')];}else{return this['channel'][_0x8ea2('0x52')](_0x571f23,_0x8ea2('0x10c'));}var _0x3cc3af=this[_0x8ea2('0x11')]['exec'](_0x8ea2('0xe5'),[util[_0x8ea2('0x2b')](_0x8ea2('0x10f'),_0x38e038,_0x571f23[_0x8ea2('0x48')]),_0x571f23['timeout'],_0x571f23[_0x8ea2('0xe3')],_0x571f23[_0x8ea2('0x68')]]);if(_0x3cc3af[_0x8ea2('0xa5')]===-0x1){return _0x3cc3af;}return this[_0x8ea2('0x11')][_0x8ea2('0xab')](util['format'](_0x8ea2('0xe4'),_0x8ea2('0xe5')));};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x110')]=function(_0x5478f4){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x5478f4['label']));return this['channel'][_0x8ea2('0xab')](_0x8ea2('0x110'));};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0xf')]=function(_0x3c9013){logger[_0x8ea2('0x31')](util['format']('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x3c9013[_0x8ea2('0x39')]));if(_0x3c9013[_0x8ea2('0xa8')]===0x0){return this[_0x8ea2('0xa7')](_0x3c9013);}_0x3c9013['retry']-=0x1;if(!this['isConfigured'](_0x3c9013[_0x8ea2('0x111')])){return this[_0x8ea2('0x11')]['error'](_0x3c9013,_0x8ea2('0x112'));}var _0x4e4120=this[_0x8ea2('0x21')][_0x8ea2('0x74')](this,_0x3c9013[_0x8ea2('0x111')]);if(!_0x4e4120){return this['channel'][_0x8ea2('0x52')](_0x3c9013,_0x8ea2('0x113'));}if(!this['isConfigured'](_0x3c9013[_0x8ea2('0xd8')])){return this[_0x8ea2('0x11')]['error']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x17e2ea=this[_0x8ea2('0x11')][_0x8ea2('0x114')](_0x4e4120,_0x3c9013['response'],_0x3c9013[_0x8ea2('0x115')]);var _0x116fc6=_0x17e2ea[_0x8ea2('0xa5')]?_0x17e2ea[_0x8ea2('0xa5')][_0x8ea2('0x4c')]():'';logger['info'](_0x8ea2('0x116'),JSON['stringify'](_0x17e2ea));if(_0x17e2ea[_0x8ea2('0xa5')]===-0x1){this['createSquareDetailsReport'][_0x8ea2('0x74')](this,_0x3c9013,_0x116fc6);return _0x17e2ea;}else if(_0x17e2ea[_0x8ea2('0xa3')]===_0x8ea2('0x6a')){_0x17e2ea[_0x8ea2('0xa5')]=_0x116fc6['length']>=parseInt(_0x3c9013[_0x8ea2('0x117')])?'x':'i';}else{_0x17e2ea[_0x8ea2('0xa5')]=_0x116fc6[_0x8ea2('0x9c')]>=parseInt(_0x3c9013[_0x8ea2('0x117')])&&_0x116fc6[_0x8ea2('0x9c')]<=parseInt(_0x3c9013[_0x8ea2('0x115')])?'x':'i';}var _0xbae953=this[_0x8ea2('0xa4')][_0x8ea2('0x74')](this,_0x3c9013[_0x8ea2('0xd8')]);if(!_0xbae953){return this[_0x8ea2('0x11')]['error'](_0x3c9013,_0x8ea2('0xd9'));}this[_0x8ea2('0x11')][_0x8ea2('0xa1')](_0xbae953,_0x116fc6);if(this['isConfigured'](_0x3c9013[_0x8ea2('0x118')])){var _0x2f7b18=parseInt(_0x3c9013[_0x8ea2('0x118')],0xa);var _0x14dd7b=rs[_0x8ea2('0x119')]({'charset':'*','length':_0x2f7b18});var _0x423a23=_0x116fc6[_0x8ea2('0x9c')];if(_0x423a23>0x0){if(_0x423a23>_0x2f7b18){this[_0x8ea2('0x37')][_0x8ea2('0x74')](this,_0x3c9013,_0x3c9013[_0x8ea2('0x11a')]==='first'?_0x14dd7b+_0x116fc6[_0x8ea2('0x11b')](_0x2f7b18):_0x116fc6[_0x8ea2('0x11b')](0x0,_0x423a23-_0x2f7b18)+_0x14dd7b);}else{this[_0x8ea2('0x37')][_0x8ea2('0x74')](this,_0x3c9013,rs['generate']({'charset':'*','length':_0x423a23}));}}else{this[_0x8ea2('0x37')][_0x8ea2('0x74')](this,_0x3c9013,'');}}else{this[_0x8ea2('0x37')][_0x8ea2('0x74')](this,_0x3c9013,_0x116fc6);}return _0x17e2ea;};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x10')]=function(_0x109785){logger['info'](util[_0x8ea2('0x2b')](_0x8ea2('0x11c'),_0x109785['label']));return this[_0x8ea2('0xf')](_0x109785);};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x11d')]=function(_0x50ebcd){logger['info'](util[_0x8ea2('0x2b')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x50ebcd['label']));this[_0x8ea2('0x37')][_0x8ea2('0x74')](this,_0x50ebcd,_0x50ebcd['goalname']);return this[_0x8ea2('0x11')][_0x8ea2('0xab')](util['format'](_0x8ea2('0x11e'),_0x50ebcd['goalname']));};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x11f')]=function(_0x45a633){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x120'),_0x45a633[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x45a633[_0x8ea2('0x8b')])||!this[_0x8ea2('0x88')](_0x45a633[_0x8ea2('0x8f')])){return this[_0x8ea2('0x11')][_0x8ea2('0xab')](_0x8ea2('0x121'));}if(!this[_0x8ea2('0x88')](_0x45a633[_0x8ea2('0x61')])){return this['channel'][_0x8ea2('0xab')](_0x8ea2('0xac'));}this['channel']['noop'](util[_0x8ea2('0x2b')]('Trying\x20aws\x20Polly\x20%s',_0x45a633['text']));var _0x1e1761=this[_0x8ea2('0x8a')][_0x8ea2('0x74')](this,_0x45a633);if(_0x1e1761){this['channel'][_0x8ea2('0xab')](util[_0x8ea2('0x2b')](_0x8ea2('0x122'),_0x1e1761));var _0x4e2fd7=this[_0x8ea2('0x11')]['streamFile'](_0x1e1761);try{fs[_0x8ea2('0x104')](_0x1e1761+'.wav');}catch(_0x5f13ed){logger[_0x8ea2('0x52')](_0x5f13ed);}return _0x4e2fd7;}return this[_0x8ea2('0x11')][_0x8ea2('0x52')](_0x45a633,_0x8ea2('0x123'));};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x124')]=function(_0x1d7bbe){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x125'),_0x1d7bbe[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x1d7bbe['aws_access_key_id'])||!this['isConfigured'](_0x1d7bbe['aws_secret_access_key'])){return this[_0x8ea2('0x11')][_0x8ea2('0xab')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x1d7bbe[_0x8ea2('0x91')])){return this[_0x8ea2('0x11')][_0x8ea2('0xab')](_0x8ea2('0x126'));}if(!this[_0x8ea2('0x88')](_0x1d7bbe['text'])){return this[_0x8ea2('0x11')]['noop'](_0x8ea2('0xac'));}this['channel'][_0x8ea2('0xe9')]=!![];this['createSquareDetailsReport'](_0x1d7bbe);this[_0x8ea2('0x44')](_0x1d7bbe[_0x8ea2('0x61')],'in','','');this['channel']['noop'](util[_0x8ea2('0x2b')](_0x8ea2('0x127'),_0x1d7bbe[_0x8ea2('0x61')]));var _0x26b05c=this[_0x8ea2('0x8e')][_0x8ea2('0x74')](this,_0x1d7bbe);if(_0x26b05c){for(var _0x1a3537 in _0x26b05c){if(_0x26b05c[_0x8ea2('0x99')](_0x1a3537)&&_[_0x8ea2('0x9d')](_0x26b05c[_0x1a3537])){this['channel'][_0x8ea2('0xa1')](util[_0x8ea2('0x2b')](_0x8ea2('0x128'),_0x1a3537[_0x8ea2('0x6f')]()),_0x26b05c[_0x1a3537]);}}if(_[_0x8ea2('0x51')](_0x26b05c['message'])){return this['channel'][_0x8ea2('0xab')](_0x8ea2('0x129'));}else{this[_0x8ea2('0x44')](_0x26b05c[_0x8ea2('0x12a')],_0x8ea2('0xec'),_0x8ea2('0x12b'),'');return this[_0x8ea2('0x11')][_0x8ea2('0xab')](util[_0x8ea2('0x2b')]('Amazon\x20Lex\x20Result\x20%s',_0x26b05c[_0x8ea2('0x12a')]));}}return this['channel']['error'](_0x1d7bbe,_0x8ea2('0x12c'));};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x12d')]=function(_0x1cbf58){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x12e'),_0x1cbf58[_0x8ea2('0x39')],_0x1cbf58['timeout']));if(!this[_0x8ea2('0x88')](_0x1cbf58[_0x8ea2('0x7d')])){return this[_0x8ea2('0x11')][_0x8ea2('0xab')](_0x8ea2('0xe8'));}var _0x5bf555='wav';var _0x1323c7=util[_0x8ea2('0x2b')](_0x8ea2('0x12f'),FILES_PATH,rs[_0x8ea2('0x119')](0x4));var _0xfc671c=util[_0x8ea2('0x2b')](_0x8ea2('0xa0'),_0x1323c7,_0x5bf555);var _0x5a8d46=!![];if(_0x1cbf58[_0x8ea2('0x130')]===_0x8ea2('0x131')){_0x5a8d46=![];}var _0x4c19af=this[_0x8ea2('0x11')]['recordFile'](_0x1323c7,_0x5bf555,_0x1cbf58[_0x8ea2('0x132')],_0x1cbf58[_0x8ea2('0x6a')],undefined,_0x5a8d46);if(_0x4c19af[_0x8ea2('0xa5')]!==-0x1){this[_0x8ea2('0x11')][_0x8ea2('0xab')](util['format'](_0x8ea2('0x133'),_0xfc671c));var _0x5dee71=this[_0x8ea2('0x92')][_0x8ea2('0x74')](this,_0x1cbf58,_0xfc671c);if(_0x5dee71){for(var _0x172838 in _0x5dee71){if(_0x5dee71['hasOwnProperty'](_0x172838)){this['channel'][_0x8ea2('0xa1')](util[_0x8ea2('0x2b')](_0x8ea2('0x134'),_0x172838[_0x8ea2('0x6f')]()),_0x5dee71[_0x172838]);}}return this[_0x8ea2('0x11')][_0x8ea2('0xab')](util[_0x8ea2('0x2b')]('GoogleASR\x20Result\x20%s',JSON[_0x8ea2('0x77')](_0x5dee71)));}}return _0x4c19af;};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x135')]=function(_0x5ffc77){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x136'),_0x5ffc77[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x5ffc77[_0x8ea2('0x95')])){return this[_0x8ea2('0x11')][_0x8ea2('0xab')](_0x8ea2('0x137'));}if(!this[_0x8ea2('0x88')](_0x5ffc77[_0x8ea2('0x138')])){return this[_0x8ea2('0x11')][_0x8ea2('0xab')]('no\x20appsecret\x20configured');}var _0x5cb797=_0x8ea2('0x139');var _0x1d6974=util[_0x8ea2('0x2b')](_0x8ea2('0x12f'),FILES_PATH,rs[_0x8ea2('0x119')](0x4));var _0x1110cd=util['format'](_0x8ea2('0xa0'),_0x1d6974,_0x5cb797);var _0x5371a6=!![];if(_0x5ffc77[_0x8ea2('0x130')]===_0x8ea2('0x131')){_0x5371a6=![];}var _0x4f731e=this[_0x8ea2('0x11')][_0x8ea2('0x13a')](_0x1d6974,_0x5cb797,_0x5ffc77['intKey'],_0x5ffc77[_0x8ea2('0x6a')],undefined,_0x5371a6);if(_0x4f731e[_0x8ea2('0xa5')]!==-0x1){this[_0x8ea2('0x11')][_0x8ea2('0xab')](util[_0x8ea2('0x2b')]('tilde\x20%s\x20file\x20created',_0x1110cd));var _0x56003d=this['tildeASR'][_0x8ea2('0x74')](this,_0x5ffc77,_0x1110cd);if(_0x56003d){for(var _0x199d37 in _0x56003d){if(_0x56003d[_0x8ea2('0x99')](_0x199d37)){this[_0x8ea2('0x11')][_0x8ea2('0xa1')](util[_0x8ea2('0x2b')]('TILDE_ASR_%s',_0x199d37[_0x8ea2('0x6f')]()),_0x56003d[_0x199d37]);}}return this[_0x8ea2('0x11')][_0x8ea2('0xab')](util['format'](_0x8ea2('0x13b'),JSON[_0x8ea2('0x77')](_0x56003d)));}}return _0x4f731e;};AGIVertices[_0x8ea2('0x19')]['gotoc']=function(_0x55bee4){logger['info'](util['format']('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x55bee4[_0x8ea2('0x39')]));return this[_0x8ea2('0x11')]['continueAt'](_0x55bee4[_0x8ea2('0x3f')],_0x55bee4['extension'],_0x55bee4[_0x8ea2('0x41')]);};AGIVertices[_0x8ea2('0x19')]['gotoif']=function(_0x2a27bd){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x2a27bd[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x2a27bd[_0x8ea2('0x13c')])){return this[_0x8ea2('0x11')][_0x8ea2('0x52')](_0x2a27bd,_0x8ea2('0x13d'));}try{var _0x3cb557=eval(_0x2a27bd['condition'])?_0x8ea2('0x13e'):_0x8ea2('0x13f');this[_0x8ea2('0x11')]['noop'](util[_0x8ea2('0x2b')](_0x8ea2('0x140'),_0x2a27bd['condition'],_0x3cb557));return{'code':0xc8,'result':_0x3cb557};}catch(_0x3c9353){return{'code':0xc8,'result':_0x8ea2('0x13f')};}};AGIVertices['prototype'][_0x8ea2('0x141')]=function(_0x41543a){logger['info'](util['format'](_0x8ea2('0x142'),_0x41543a[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x41543a[_0x8ea2('0x143')])){return this['channel'][_0x8ea2('0x52')](_0x41543a,_0x8ea2('0x144'));}var _0x134d2b=this[_0x8ea2('0x145')][_0x8ea2('0x74')](this,_0x41543a[_0x8ea2('0x143')]);if(!_0x134d2b){return this[_0x8ea2('0x11')]['error'](_0x41543a,_0x8ea2('0x146'));}for(var _0xe52391=0x0;_0xe52391<_0x134d2b[_0x8ea2('0x9c')];_0xe52391+=0x1){var _0x374f30=this[_0x8ea2('0x11')][_0x8ea2('0xa4')](util['format']('IFTIME(%s?true:false)',_0x134d2b[_0xe52391]));if(_0x374f30[_0x8ea2('0xa5')]===-0x1){return _0x374f30;}logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')]('IFTIME\x20%s\x20%s',_0x134d2b[_0xe52391],_0x374f30[_0x8ea2('0xa3')]));if(_0x374f30[_0x8ea2('0xa3')]==='true'){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x147'),_0x134d2b[_0xe52391],_0x8ea2('0x13e')));this['channel'][_0x8ea2('0xab')](util['format'](_0x8ea2('0x147'),_0x134d2b[_0xe52391],'true'));return{'code':0xc8,'result':_0x8ea2('0x13e')};}else{logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')]('IFTIME\x20%s\x20%s',_0x134d2b[_0xe52391],_0x8ea2('0x13f')));this[_0x8ea2('0x11')]['noop'](util['format']('IFTIME\x20%s\x20%s',_0x134d2b[_0xe52391],_0x8ea2('0x13f')));}}return{'code':0xc8,'result':_0x8ea2('0x13f')};};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x148')]=function(_0x53fea5){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x149'),_0x53fea5['label']));return this['channel']['hangup']();};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x14a')]=function(_0x3bbd66){logger[_0x8ea2('0x31')](util['format'](_0x8ea2('0x14b'),_0x3bbd66[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x3bbd66[_0x8ea2('0x7d')])){return this['channel'][_0x8ea2('0xab')](_0x8ea2('0xe8'));}var _0x3c8192='wav';var _0x5821de=util[_0x8ea2('0x2b')](_0x8ea2('0x12f'),FILES_PATH,rs[_0x8ea2('0x119')](0x4));var _0x403f79=util[_0x8ea2('0x2b')]('%s.%s',_0x5821de,_0x3c8192);var _0x319705=!![];if(_0x3bbd66['beep']==='NOBEEP'){_0x319705=![];}var _0x45c06f=this[_0x8ea2('0x11')][_0x8ea2('0x13a')](_0x5821de,_0x3c8192,_0x3bbd66['intKey'],_0x3bbd66['timeout'],undefined,_0x319705);if(_0x45c06f[_0x8ea2('0xa5')]!==-0x1){this[_0x8ea2('0x11')][_0x8ea2('0xab')](util[_0x8ea2('0x2b')](_0x8ea2('0x14c'),_0x403f79));var _0x1daf8a=this[_0x8ea2('0x86')][_0x8ea2('0x74')](this,_0x3bbd66,_0x403f79);if(_0x1daf8a){for(var _0xbc07de in _0x1daf8a){if(_0x1daf8a['hasOwnProperty'](_0xbc07de)){this['channel'][_0x8ea2('0xa1')](util[_0x8ea2('0x2b')]('ISPEECH_ASR_%s',_0xbc07de[_0x8ea2('0x6f')]()),_0x1daf8a[_0xbc07de]);}}return this[_0x8ea2('0x11')][_0x8ea2('0xab')](util['format'](_0x8ea2('0x14d'),JSON[_0x8ea2('0x77')](_0x1daf8a)));}}return _0x45c06f;};AGIVertices[_0x8ea2('0x19')]['ispeechtts']=function(_0x403729){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x14e'),_0x403729[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x403729[_0x8ea2('0x7d')])){return this[_0x8ea2('0x11')][_0x8ea2('0xab')](_0x8ea2('0xe8'));}if(!this[_0x8ea2('0x88')](_0x403729[_0x8ea2('0x61')])){return this['channel'][_0x8ea2('0xab')](_0x8ea2('0xac'));}this[_0x8ea2('0x11')][_0x8ea2('0xab')](util[_0x8ea2('0x2b')](_0x8ea2('0x14f'),_0x403729['text']));var _0x56c7d5=this[_0x8ea2('0x83')][_0x8ea2('0x74')](this,_0x403729);if(_0x56c7d5){this[_0x8ea2('0x11')][_0x8ea2('0xab')](util[_0x8ea2('0x2b')](_0x8ea2('0x14c'),_0x56c7d5));var _0x4a277d=this[_0x8ea2('0x11')][_0x8ea2('0x150')](_0x56c7d5,_0x403729[_0x8ea2('0x132')]);try{fs['unlink'](_0x56c7d5+_0x8ea2('0x105'));}catch(_0x2a4e5b){logger[_0x8ea2('0x52')](_0x2a4e5b);}return _0x4a277d;}return this[_0x8ea2('0x11')][_0x8ea2('0x52')](_0x403729,_0x8ea2('0x151'));};AGIVertices['prototype'][_0x8ea2('0x152')]=function(_0x365f33){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x365f33[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x365f33[_0x8ea2('0x153')])){return this['channel']['error'](_0x365f33,_0x8ea2('0x154'));}logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x8ea2('0x3c')],_0x365f33[_0x8ea2('0x153')]));var _0x15ec0d=this[_0x8ea2('0x56')]['sync'](this,_0x365f33['findBy']);if(_0x15ec0d){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x8ea2('0x11')][_0x8ea2('0x3c')],_0x365f33['findBy']));this['channel'][_0x8ea2('0xab')](util[_0x8ea2('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x8ea2('0x11')][_0x8ea2('0x3c')],_0x365f33[_0x8ea2('0x153')]));return{'code':0xc8,'result':_0x8ea2('0x155')};}else{logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x156'),this[_0x8ea2('0x11')][_0x8ea2('0x3c')],_0x365f33[_0x8ea2('0x153')]));this[_0x8ea2('0x11')]['noop'](util['format'](_0x8ea2('0x156'),this['channel'][_0x8ea2('0x3c')],_0x365f33[_0x8ea2('0x153')]));return{'code':0xc8,'result':_0x8ea2('0x157')};}};AGIVertices['prototype'][_0x8ea2('0x158')]=function(_0x44cb49){logger[_0x8ea2('0x31')](util['format']('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x44cb49['label']));if(!this['isConfigured'](_0x44cb49[_0x8ea2('0x153')])){return this['channel']['error'](_0x44cb49,_0x8ea2('0x154'));}logger[_0x8ea2('0x31')](util['format'](_0x8ea2('0x159'),this[_0x8ea2('0x11')][_0x8ea2('0x3c')],_0x44cb49[_0x8ea2('0x153')]));var _0x12a2c5=this['agentLogout'][_0x8ea2('0x74')](this,_0x44cb49['findBy']);if(_0x12a2c5){logger[_0x8ea2('0x31')](util['format'](_0x8ea2('0x15a'),this[_0x8ea2('0x11')][_0x8ea2('0x3c')],_0x44cb49[_0x8ea2('0x153')]));this[_0x8ea2('0x11')]['noop'](util[_0x8ea2('0x2b')](_0x8ea2('0x15a'),this[_0x8ea2('0x11')][_0x8ea2('0x3c')],_0x44cb49['findBy']));return{'code':0xc8,'result':_0x8ea2('0x155')};}else{logger['info'](util[_0x8ea2('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x8ea2('0x11')][_0x8ea2('0x3c')],_0x44cb49[_0x8ea2('0x153')]));this[_0x8ea2('0x11')]['noop'](util[_0x8ea2('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x8ea2('0x11')][_0x8ea2('0x3c')],_0x44cb49['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x15b')]=function(_0x2b882e){logger['info'](util[_0x8ea2('0x2b')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x2b882e[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x2b882e[_0x8ea2('0x15c')])){return this[_0x8ea2('0x11')][_0x8ea2('0x52')](_0x2b882e,_0x8ea2('0x15d'));}this[_0x8ea2('0x11')][_0x8ea2('0xab')](util[_0x8ea2('0x2b')](_0x8ea2('0x15e'),_0x2b882e[_0x8ea2('0x15c')]));var _0x449156=eval(_0x2b882e[_0x8ea2('0x15c')]);if(!this[_0x8ea2('0x88')](_0x2b882e[_0x8ea2('0xd8')])){return this['channel'][_0x8ea2('0xab')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x357316=this[_0x8ea2('0xa4')]['sync'](this,_0x2b882e['variable_id']);if(!_0x357316){return this[_0x8ea2('0x11')][_0x8ea2('0x52')](_0x2b882e,_0x8ea2('0xd9'));}if(_['isArray'](_0x449156)){var _0x322f93=this;_0x449156[_0x8ea2('0xda')](function(_0x3d81f2,_0x387eed){_0x322f93[_0x8ea2('0x11')][_0x8ea2('0xa1')](util[_0x8ea2('0x2b')](_0x8ea2('0x15f'),_0x357316,_0x387eed),_0x3d81f2);});return this[_0x8ea2('0x11')][_0x8ea2('0xab')](util['format'](_0x8ea2('0x160'),_0x357316));}else{return this[_0x8ea2('0x11')][_0x8ea2('0xa1')](_0x357316,_0x449156);}};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0xe')]=function(_0x3ca197){logger['info'](util[_0x8ea2('0x2b')](_0x8ea2('0x161'),_0x3ca197[_0x8ea2('0x39')]));if(_0x3ca197[_0x8ea2('0xa8')]===0x0){return this[_0x8ea2('0xa7')](_0x3ca197);}_0x3ca197[_0x8ea2('0xa8')]-=0x1;if(!this[_0x8ea2('0x88')](_0x3ca197['file_id'])){return this[_0x8ea2('0x11')][_0x8ea2('0x52')](_0x3ca197,_0x8ea2('0x112'));}var _0x390385=this[_0x8ea2('0x21')]['sync'](this,_0x3ca197['file_id']);if(!_0x390385){return this[_0x8ea2('0x11')]['error'](_0x3ca197,_0x8ea2('0x113'));}var _0x5dde8a=this['channel'][_0x8ea2('0x114')](_0x390385,_0x3ca197['response'],_0x3ca197[_0x8ea2('0x162')]);var _0x49e76d=_0x5dde8a[_0x8ea2('0xa5')];if(_0x5dde8a[_0x8ea2('0xa5')]===-0x1){this[_0x8ea2('0x37')]['sync'](this,_0x3ca197,'-1');return _0x5dde8a;}else if(_0x5dde8a[_0x8ea2('0xa3')]===_0x8ea2('0x6a')){_0x5dde8a[_0x8ea2('0xa5')]=_0x5dde8a[_0x8ea2('0xa5')][_0x8ea2('0x9c')]>0x0?_0x5dde8a[_0x8ea2('0xa5')]:'t';}else if(_['isEmpty'](_0x5dde8a[_0x8ea2('0xa5')])){_0x5dde8a[_0x8ea2('0xa5')]='#';_0x49e76d='#';}if(!this[_0x8ea2('0x88')](_0x3ca197[_0x8ea2('0xd8')])){this[_0x8ea2('0x11')][_0x8ea2('0xab')](_0x8ea2('0xd7'));}else{var _0x5ddadc=this[_0x8ea2('0xa4')][_0x8ea2('0x74')](this,_0x3ca197[_0x8ea2('0xd8')]);if(!_0x5ddadc){return this[_0x8ea2('0x11')][_0x8ea2('0x52')](_0x3ca197,'no\x20variable\x20found');}this[_0x8ea2('0x11')][_0x8ea2('0xa1')](_0x5ddadc,_0x49e76d);}this[_0x8ea2('0x37')]['sync'](this,_0x3ca197,_0x49e76d);return _0x5dde8a;};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0xab')]=function(_0x35b4ee){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x163'),_0x35b4ee[_0x8ea2('0x39')]));return this[_0x8ea2('0x11')][_0x8ea2('0xab')](_0x35b4ee[_0x8ea2('0x164')]||_0x35b4ee['label']);};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x165')]=function(_0x2c5cc7){logger[_0x8ea2('0x31')](util['format'](_0x8ea2('0x166'),_0x2c5cc7[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x2c5cc7['findBy'])){return this[_0x8ea2('0x11')]['error'](_0x2c5cc7,_0x8ea2('0x154'));}logger['info'](util[_0x8ea2('0x2b')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x8ea2('0x11')][_0x8ea2('0x3c')],_0x2c5cc7['findBy']));var _0x51eba4=this[_0x8ea2('0x4e')]['sync'](this,_0x2c5cc7[_0x8ea2('0x167')]);var _0x1b674e=this[_0x8ea2('0x50')][_0x8ea2('0x74')](this,_0x2c5cc7[_0x8ea2('0x153')],_0x51eba4);if(_0x1b674e){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x15a'),this[_0x8ea2('0x11')][_0x8ea2('0x3c')],_0x2c5cc7[_0x8ea2('0x153')]));this[_0x8ea2('0x11')][_0x8ea2('0xab')](util[_0x8ea2('0x2b')](_0x8ea2('0x15a'),this['channel'][_0x8ea2('0x3c')],_0x2c5cc7[_0x8ea2('0x153')]));return{'code':0xc8,'result':_0x8ea2('0x155')};}else{logger[_0x8ea2('0x31')](util['format'](_0x8ea2('0x156'),this[_0x8ea2('0x11')]['callerid'],_0x2c5cc7[_0x8ea2('0x153')]));this[_0x8ea2('0x11')]['noop'](util['format'](_0x8ea2('0x15a'),this[_0x8ea2('0x11')][_0x8ea2('0x3c')],_0x2c5cc7['findBy']));return{'code':0xc8,'result':_0x8ea2('0x157')};}};AGIVertices['prototype'][_0x8ea2('0x168')]=function(_0x5e7f9f){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x5e7f9f[_0x8ea2('0x39')]));if(!this['isConfigured'](_0x5e7f9f[_0x8ea2('0x111')])){return this[_0x8ea2('0x11')][_0x8ea2('0x52')](_0x5e7f9f,_0x8ea2('0x112'));}var _0x41a9cd=this['getSound'][_0x8ea2('0x74')](this,_0x5e7f9f[_0x8ea2('0x111')]);if(!_0x41a9cd){return this[_0x8ea2('0x11')][_0x8ea2('0x52')](_0x5e7f9f,_0x8ea2('0x113'));}var _0x28c0e8=this['channel'][_0x8ea2('0x5b')]('PLAYBACK',[_0x41a9cd,_0x5e7f9f['opts']]);if(_0x28c0e8[_0x8ea2('0xa5')]===-0x1){return _0x28c0e8;}return this[_0x8ea2('0x11')][_0x8ea2('0xab')](util['format'](_0x8ea2('0xc4'),_0x8ea2('0x169'),_0x41a9cd));};AGIVertices['prototype']['queue']=function(_0x54d67b){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x16a'),_0x54d67b[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x54d67b[_0x8ea2('0x16b')])){return this[_0x8ea2('0x11')][_0x8ea2('0x52')](_0x54d67b,_0x8ea2('0x16c'));}var _0x23bc05='';var _0x49bc7b=parseInt(_0x54d67b['queue_id'],0xa);if(isNaN(_0x49bc7b)){_0x23bc05=_0x54d67b[_0x8ea2('0x16b')];}else{_0x23bc05=this['getVoiceQueue'][_0x8ea2('0x74')](this,_0x54d67b[_0x8ea2('0x16b')]);if(!_0x23bc05){return this[_0x8ea2('0x11')][_0x8ea2('0x52')](_0x54d67b,_0x8ea2('0x16d'));}}var _0x1237d8='';if(this[_0x8ea2('0x88')](_0x54d67b[_0x8ea2('0x111')])){var _0x5c670a=this[_0x8ea2('0x21')]['sync'](this,_0x54d67b[_0x8ea2('0x111')]);if(_0x5c670a){_0x1237d8=_0x5c670a;}}this[_0x8ea2('0x37')]['sync'](this,_0x54d67b,_0x23bc05);if(_0x54d67b[_0x8ea2('0xe3')][_0x8ea2('0x16e')]('x')<0x0){_0x54d67b[_0x8ea2('0xe3')]+='x';}if(_0x54d67b['opts'][_0x8ea2('0x16e')]('X')<0x0){_0x54d67b[_0x8ea2('0xe3')]+='X';}this[_0x8ea2('0x11')][_0x8ea2('0xa1')](_0x8ea2('0x16f'),_0x23bc05?_0x23bc05[_0x8ea2('0x170')]():'');var _0x1638a9=this[_0x8ea2('0x11')]['exec'](_0x8ea2('0x171'),[_0x23bc05,_0x54d67b[_0x8ea2('0xe3')],_0x54d67b[_0x8ea2('0x68')],_0x1237d8,_0x54d67b[_0x8ea2('0x6a')],_0x54d67b[_0x8ea2('0x8')],_0x54d67b[_0x8ea2('0x172')],_0x54d67b[_0x8ea2('0x173')],'',_0x54d67b['position']]);if(_0x1638a9[_0x8ea2('0xa5')]===-0x1){return _0x1638a9;}return this[_0x8ea2('0x11')]['noop'](util[_0x8ea2('0x2b')](_0x8ea2('0xc4'),_0x8ea2('0x171'),_0x23bc05));};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x174')]=function(_0x5eb353){logger['info'](util[_0x8ea2('0x2b')](_0x8ea2('0x175'),_0x5eb353[_0x8ea2('0x39')]));var _0x54ad36=_0x5eb353['recordingFormat']||_0x8ea2('0x139');var _0x33bdea=util[_0x8ea2('0x2b')](_0x8ea2('0x176'),this[_0x8ea2('0x11')]['uniqueid'],rs[_0x8ea2('0x119')](0x5));var _0x38116f=util[_0x8ea2('0x2b')](_0x8ea2('0x177'),FILES_PATH,_0x33bdea,_0x54ad36);var _0x3c8abc=util[_0x8ea2('0x2b')](_0x8ea2('0x12f'),FILES_PATH,_0x33bdea);this[_0x8ea2('0x3d')]['sync'](this,_0x5eb353,_0x33bdea,_0x38116f);this[_0x8ea2('0x11')][_0x8ea2('0xa1')](_0x8ea2('0x178'),_0x33bdea);logger[_0x8ea2('0x31')](_0x8ea2('0x179'),_0x3c8abc,_0x54ad36,_0x5eb353['escape_digits'],_0x5eb353['timeout']);return this[_0x8ea2('0x11')][_0x8ea2('0x13a')](_0x3c8abc,_0x54ad36,_0x5eb353['escape_digits'],_0x5eb353['timeout'],undefined,!![]);};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x17a')]=function(_0x146882){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x17b'),_0x146882[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x146882[_0x8ea2('0x68')])){return this['channel'][_0x8ea2('0xab')]('no\x20url\x20configured');}var _0xbf18da=this['restAPI'][_0x8ea2('0x74')](this,_0x146882);logger['info'](util[_0x8ea2('0x2b')](_0x8ea2('0x17c'),util['inspect'](_0xbf18da,{'showHidden':![],'depth':null})));if(!this[_0x8ea2('0x88')](_0x146882[_0x8ea2('0xd8')])){return this[_0x8ea2('0x11')]['noop'](_0x8ea2('0x17d'));}var _0x4fc16e=this[_0x8ea2('0xa4')]['sync'](this,_0x146882[_0x8ea2('0xd8')]);if(!_0x4fc16e){return this[_0x8ea2('0x11')][_0x8ea2('0x52')](_0x146882,_0x8ea2('0xd9'));}this['channel'][_0x8ea2('0xa1')](util[_0x8ea2('0x2b')](_0x8ea2('0x17e'),_0x4fc16e),_0xbf18da['statusCode']?_0xbf18da[_0x8ea2('0x79')]:'200');this[_0x8ea2('0x11')]['setVariable'](util['format'](_0x8ea2('0x17f'),_0x4fc16e),_0xbf18da[_0x8ea2('0x180')]?_0xbf18da[_0x8ea2('0x180')]:'OK');if(_0xbf18da[_0x8ea2('0x70')]){try{this[_0x8ea2('0x9f')](_0xbf18da[_0x8ea2('0x70')],_0x4fc16e);}catch(_0x2d6ce8){logger[_0x8ea2('0x52')](util['format']('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x4fc16e));}}return this[_0x8ea2('0x11')]['noop'](util['format'](_0x8ea2('0x181'),_0x4fc16e));};AGIVertices[_0x8ea2('0x19')]['saydigits']=function(_0x39d012){logger['info'](util['format']('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x39d012[_0x8ea2('0x39')]));return this['channel'][_0x8ea2('0x182')](_0x39d012[_0x8ea2('0x183')][_0x8ea2('0x5d')](/\s+/g,''),_0x39d012[_0x8ea2('0x184')]);};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x185')]=function(_0x1c8baf){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x186'),_0x1c8baf[_0x8ea2('0x39')]));return this[_0x8ea2('0x11')][_0x8ea2('0x187')](_0x1c8baf[_0x8ea2('0x6b')][_0x8ea2('0x5d')](/\s+/g,''),_0x1c8baf[_0x8ea2('0x184')]);};AGIVertices['prototype'][_0x8ea2('0x188')]=function(_0xa8fa4a){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x189'),_0xa8fa4a[_0x8ea2('0x39')]));return this['channel'][_0x8ea2('0x18a')](_0xa8fa4a[_0x8ea2('0x61')],_0xa8fa4a[_0x8ea2('0x184')]);};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x18b')]=function(_0x2cd193){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x2cd193[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x2cd193['account_id'])){return this[_0x8ea2('0x11')]['noop'](_0x8ea2('0x18c'));}var _0x1db332=this[_0x8ea2('0x24')][_0x8ea2('0x74')](this,_0x2cd193[_0x8ea2('0x18d')]);if(!_0x1db332||!_0x1db332[_0x8ea2('0x18e')]){return this[_0x8ea2('0x11')]['error'](_0x2cd193,_0x8ea2('0x18f'));}var _0x599814={'from':util[_0x8ea2('0x2b')](_0x8ea2('0x190'),_0x1db332['name'],_0x1db332['email']||_0x1db332[_0x8ea2('0x18e')][_0x8ea2('0x191')]),'to':_0x2cd193['to']||'','cc':_0x2cd193['cc']||'','bcc':_0x2cd193[_0x8ea2('0x192')]||'','subject':_0x2cd193[_0x8ea2('0x193')],'html':_0x2cd193[_0x8ea2('0x61')],'text':_0x2cd193[_0x8ea2('0x61')]};if(this[_0x8ea2('0x88')](_0x2cd193[_0x8ea2('0x194')])){}logger['debug']('sendMail\x20message',JSON[_0x8ea2('0x77')](_0x599814));this['createSquareDetailsReport'][_0x8ea2('0x74')](this,_0x2cd193,_0x2cd193[_0x8ea2('0x18d')]);this[_0x8ea2('0x11')][_0x8ea2('0xab')](util[_0x8ea2('0x2b')](_0x8ea2('0x195'),_0x1db332[_0x8ea2('0x15')]));this[_0x8ea2('0x196')][_0x8ea2('0x74')](this,_0x1db332[_0x8ea2('0x197')],_0x599814);return this[_0x8ea2('0x11')]['noop'](_0x8ea2('0x198'));};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x199')]=function(_0x47caa6){logger['info'](util[_0x8ea2('0x2b')](_0x8ea2('0x19a'),_0x47caa6[_0x8ea2('0x39')]));return this['channel']['noop'](_0x8ea2('0x19b'));};AGIVertices['prototype'][_0x8ea2('0x19c')]=function(_0x3d822e){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x19d'),_0x3d822e[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x3d822e[_0x8ea2('0x19e')])){return this[_0x8ea2('0x11')][_0x8ea2('0xab')]('no\x20sms\x20account\x20configured');}var _0xdcdfd1=this[_0x8ea2('0x35')][_0x8ea2('0x74')](this,_0x3d822e[_0x8ea2('0x19e')]);if(!_0xdcdfd1){return this[_0x8ea2('0x11')]['error'](_0x3d822e,_0x8ea2('0x19f'));}var _0x51b98a={'body':_0x3d822e['sms_text'],'phone':_0x3d822e['to']||'','SmsAccountId':_0xdcdfd1['id']};logger[_0x8ea2('0xde')](_0x8ea2('0x1a0'),JSON[_0x8ea2('0x77')](_0x51b98a));this[_0x8ea2('0x37')][_0x8ea2('0x74')](this,_0x3d822e,_0x3d822e[_0x8ea2('0x19e')]);this[_0x8ea2('0x11')][_0x8ea2('0xab')](util['format'](_0x8ea2('0x1a1'),_0xdcdfd1[_0x8ea2('0x15')]));this[_0x8ea2('0x36')][_0x8ea2('0x74')](this,_0x51b98a);return this['channel'][_0x8ea2('0xab')](_0x8ea2('0x1a2'));};AGIVertices[_0x8ea2('0x19')]['set']=function(_0x482d78){logger['info'](util[_0x8ea2('0x2b')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x482d78[_0x8ea2('0x39')]));if(!this['isConfigured'](_0x482d78[_0x8ea2('0xd8')])){return this['channel'][_0x8ea2('0x52')](_0x482d78,_0x8ea2('0x1a3'));}var _0x15665a=this[_0x8ea2('0xa4')]['sync'](this,_0x482d78[_0x8ea2('0xd8')]);if(!_0x15665a){return this[_0x8ea2('0x11')]['error'](_0x482d78,'no\x20variable\x20found');}return this['channel'][_0x8ea2('0xa1')](_0x15665a,_0x482d78[_0x8ea2('0x1a4')]);};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x1a5')]=function(_0x22cd95){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x1a6'),_0x22cd95[_0x8ea2('0x39')]));this[_0x8ea2('0x11')]['noop'](_0x8ea2('0x1a7'));if(_0x22cd95[_0x8ea2('0xbb')]==='yes'){this[_0x8ea2('0x11')][_0x8ea2('0xab')](_0x8ea2('0x1a8'));return this[_0x8ea2('0x11')]['answer']();}return this[_0x8ea2('0x11')]['noop'](_0x8ea2('0x1a9'));};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x1aa')]=function(_0x41b48e){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x1ab'),_0x41b48e[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x41b48e[_0x8ea2('0x1ac')])){return this[_0x8ea2('0x11')][_0x8ea2('0x52')](_0x41b48e,'no\x20subproject\x20selected');}var _0x1c5924=this[_0x8ea2('0x1a')]['sync'](this,_0x41b48e[_0x8ea2('0x1ac')]);if(!this[_0x8ea2('0x88')](_0x1c5924)){return this[_0x8ea2('0x11')][_0x8ea2('0x52')](_0x41b48e,util[_0x8ea2('0x2b')](_0x8ea2('0x1ad'),_0x41b48e[_0x8ea2('0x1ac')]));}if(_0x1c5924===this['channel'][_0x8ea2('0x3b')]){return this[_0x8ea2('0x11')]['error'](_0x41b48e,_0x8ea2('0x1ae'));}this[_0x8ea2('0x37')]['sync'](this,_0x41b48e,_0x1c5924);var _0x1aea3b=this[_0x8ea2('0x11')][_0x8ea2('0x5b')]('AGI',util['format'](_0x8ea2('0x1af'),config['agi'][_0x8ea2('0x1b0')]||_0x8ea2('0x1b1'),_0x1c5924,this[_0x8ea2('0x11')]['arg_1']));if(_0x1aea3b[_0x8ea2('0xa5')]===-0x1){return _0x1aea3b;}return this[_0x8ea2('0x11')][_0x8ea2('0xab')](util[_0x8ea2('0x2b')](_0x8ea2('0xc4'),'AGI',_0x1c5924));};AGIVertices[_0x8ea2('0x19')]['system']=function(_0x32620e){logger['info'](util[_0x8ea2('0x2b')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x32620e['label']));var _0x464f00=this['shellCommand']['sync'](this,_0x32620e['command']);this[_0x8ea2('0x37')]['sync'](this,_0x32620e,_0x32620e['command']);if(this[_0x8ea2('0x88')](_0x32620e[_0x8ea2('0xd8')])){var _0x3bc8f6=this[_0x8ea2('0xa4')]['sync'](this,_0x32620e[_0x8ea2('0xd8')]);if(_0x3bc8f6){this[_0x8ea2('0x11')][_0x8ea2('0xa1')](_0x3bc8f6,_0x464f00);return this[_0x8ea2('0x11')][_0x8ea2('0xab')](util[_0x8ea2('0x2b')](_0x8ea2('0x1b2'),_0x32620e['command'],_0x3bc8f6));}}return this[_0x8ea2('0x11')][_0x8ea2('0xab')](util[_0x8ea2('0x2b')](_0x8ea2('0x1b3'),_0x32620e[_0x8ea2('0xb8')]));};AGIVertices['prototype'][_0x8ea2('0x1b4')]=function(_0xf438d1){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x1b5'),_0xf438d1[_0x8ea2('0x39')]));_0xf438d1[_0x8ea2('0x61')]=_0xf438d1[_0x8ea2('0x61')][_0x8ea2('0x5d')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x8ea2('0x88')](_0xf438d1[_0x8ea2('0x5f')])){return this[_0x8ea2('0x11')][_0x8ea2('0xab')](_0x8ea2('0x1b6'));}if(!this[_0x8ea2('0x88')](_0xf438d1['text'])){return this[_0x8ea2('0x11')][_0x8ea2('0xab')](_0x8ea2('0xac'));}this[_0x8ea2('0x11')][_0x8ea2('0xab')](util['format'](_0x8ea2('0x1b7'),_0xf438d1[_0x8ea2('0x61')]));var _0x39042b=this[_0x8ea2('0x5e')][_0x8ea2('0x74')](this,_0xf438d1);if(_0x39042b){this[_0x8ea2('0x11')][_0x8ea2('0xab')](util[_0x8ea2('0x2b')](_0x8ea2('0x1b8'),_0x39042b));var _0x1bb046=this[_0x8ea2('0x11')][_0x8ea2('0x150')](_0x39042b);try{fs[_0x8ea2('0x104')](_0x39042b+'.wav');}catch(_0x3e45fa){logger['error'](_0x3e45fa);}return _0x1bb046;}return this[_0x8ea2('0x11')][_0x8ea2('0x52')](_0xf438d1,_0x8ea2('0x1b9'));};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x1ba')]=function(_0x4cb46a){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x1bb'),_0x4cb46a[_0x8ea2('0x39')]));_0x4cb46a[_0x8ea2('0x61')]=_0x4cb46a[_0x8ea2('0x61')][_0x8ea2('0x5d')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x8ea2('0x88')](_0x4cb46a['text'])){return this[_0x8ea2('0x11')][_0x8ea2('0xab')](_0x8ea2('0xac'));}this['channel'][_0x8ea2('0xab')](util[_0x8ea2('0x2b')](_0x8ea2('0x1bc'),_0x4cb46a[_0x8ea2('0x61')]));var _0x5710d9=this['googleTTS']['sync'](this,_0x4cb46a);if(_0x5710d9){this[_0x8ea2('0x11')][_0x8ea2('0xab')](util[_0x8ea2('0x2b')](_0x8ea2('0x1bd'),_0x5710d9));var _0x36449d=this[_0x8ea2('0x11')][_0x8ea2('0x150')](_0x5710d9);try{fs[_0x8ea2('0x104')](_0x5710d9+_0x8ea2('0x105'));}catch(_0x25471b){logger[_0x8ea2('0x52')](_0x25471b);}return _0x36449d;}return this[_0x8ea2('0x11')][_0x8ea2('0x52')](_0x4cb46a,_0x8ea2('0x1be'));};AGIVertices[_0x8ea2('0x19')]['unpause']=function(_0xfd4554){logger[_0x8ea2('0x31')](util['format'](_0x8ea2('0x1bf'),_0xfd4554['label']));if(!this[_0x8ea2('0x88')](_0xfd4554['findBy'])){return this[_0x8ea2('0x11')]['error'](_0xfd4554,_0x8ea2('0x154'));}logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x159'),this[_0x8ea2('0x11')]['callerid'],_0xfd4554['findBy']));var _0x5cff37=this[_0x8ea2('0x54')][_0x8ea2('0x74')](this,_0xfd4554[_0x8ea2('0x153')]);if(_0x5cff37){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x15a'),this[_0x8ea2('0x11')][_0x8ea2('0x3c')],_0xfd4554['findBy']));this[_0x8ea2('0x11')][_0x8ea2('0xab')](util[_0x8ea2('0x2b')](_0x8ea2('0x15a'),this[_0x8ea2('0x11')][_0x8ea2('0x3c')],_0xfd4554[_0x8ea2('0x153')]));return{'code':0xc8,'result':_0x8ea2('0x155')};}else{logger['info'](util[_0x8ea2('0x2b')](_0x8ea2('0x156'),this[_0x8ea2('0x11')][_0x8ea2('0x3c')],_0xfd4554[_0x8ea2('0x153')]));this['channel'][_0x8ea2('0xab')](util[_0x8ea2('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x8ea2('0x11')][_0x8ea2('0x3c')],_0xfd4554[_0x8ea2('0x153')]));return{'code':0xc8,'result':_0x8ea2('0x157')};}};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x1c0')]=function(_0x86d1f3){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x1c1'),_0x86d1f3['label']));var _0x4b2cd6=this['channel'][_0x8ea2('0x5b')]('VOICEMAIL',[_0x86d1f3[_0x8ea2('0x1c2')],_0x86d1f3['options']]);if(_0x4b2cd6['result']===-0x1){return _0x4b2cd6;}return this[_0x8ea2('0x11')][_0x8ea2('0xab')](util['format']('Executed\x20command\x20%s\x20%s','VOICEMAIL',_0x86d1f3[_0x8ea2('0x1c2')]));};AGIVertices[_0x8ea2('0x19')]['vswitch']=function(_0xbdb906){logger['info'](util[_0x8ea2('0x2b')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0xbdb906[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0xbdb906['variable_id'])){return this['channel'][_0x8ea2('0x52')](_0xbdb906,_0x8ea2('0x1a3'));}var _0x573f4=this['getVariable'][_0x8ea2('0x74')](this,_0xbdb906['variable_id']);if(!_0x573f4){return this[_0x8ea2('0x11')]['error'](_0xbdb906,_0x8ea2('0xd9'));}var _0x2c7714=this['channel']['getVariable'](_0x573f4);return{'code':0xc8,'result':_0x2c7714[_0x8ea2('0xa3')]?_0x2c7714[_0x8ea2('0xa3')]:'-'};};String[_0x8ea2('0x19')][_0x8ea2('0xa2')]=function(_0x254cbb,_0x18f1e9){return this['split'](_0x254cbb)['join'](_0x18f1e9);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 24e5315..0900810 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 _0x6455=['syncHangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','prototype','updateAcw','lastPauseAt','timer','update','uniqueid','catch','error','finally','interface','queue','ACW','mandatoryDisposition','then','voicePause','info','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','stopAcw','acwTimeout','format','YYYY-MM-DD\x20HH:mm:ss','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','linkedid','isUndefined','startAcw','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','stringify','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','syncHangupRequest','bind','hangup'];(function(_0xb02766,_0xa37d90){var _0x560e6c=function(_0x1ea675){while(--_0x1ea675){_0xb02766['push'](_0xb02766['shift']());}};_0x560e6c(++_0xa37d90);}(_0x6455,0x97));var _0x5645=function(_0x468550,_0x5711f8){_0x468550=_0x468550-0x0;var _0x630c99=_0x6455[_0x468550];return _0x630c99;};'use strict';var _=require(_0x5645('0x0'));var moment=require('moment');var ami=require(_0x5645('0x1'));var logger=require(_0x5645('0x2'))(_0x5645('0x3'));var RpcUser=require(_0x5645('0x4'));var RpcVoiceAgentReport=require(_0x5645('0x5'));function Acw(_0x35c21e){this['voiceQueues']=_0x35c21e[_0x5645('0x6')];this[_0x5645('0x7')]=_0x35c21e[_0x5645('0x7')];this[_0x5645('0x8')]=_0x35c21e[_0x5645('0x8')];this[_0x5645('0x9')]={};ami['on'](_0x5645('0xa'),this[_0x5645('0xb')]['bind'](this));ami['on']('hanguprequest',this[_0x5645('0xc')][_0x5645('0xd')](this));ami['on'](_0x5645('0xe'),this[_0x5645('0xf')][_0x5645('0xd')](this));ami['on'](_0x5645('0x10'),this['syncAgentRingNoAnswer'][_0x5645('0xd')](this));ami['on'](_0x5645('0x11'),this[_0x5645('0x12')][_0x5645('0xd')](this));ami['on']('blindtransfer',this[_0x5645('0x13')]['bind'](this));ami['on'](_0x5645('0x14'),this[_0x5645('0x15')][_0x5645('0xd')](this));}function getDiff(_0x21b018){var _0x2d982f=moment()[_0x5645('0x16')](0x0);var _0x45cbe8=moment(_0x21b018)[_0x5645('0x16')](0x0);return _0x2d982f['diff'](_0x45cbe8,_0x5645('0x17'));}Acw[_0x5645('0x18')][_0x5645('0x19')]=function(_0x4cbd46,_0x4b3be6){var _0x439b55=this;var _0x361cfd=getDiff(_0x439b55['timers'][_0x4cbd46][_0x5645('0x1a')]);clearTimeout(_0x439b55[_0x5645('0x8')][_0x4cbd46][_0x5645('0x1b')]);_0x439b55['timers'][_0x4cbd46][_0x5645('0x1b')]=![];return RpcVoiceAgentReport[_0x5645('0x1c')]({'acwtime':_0x361cfd},_0x439b55[_0x5645('0x8')][_0x4cbd46][_0x5645('0x1d')],_0x4cbd46)['then'](function(_0x1853a7){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x4b3be6,_0x361cfd,_0x1853a7);})[_0x5645('0x1e')](function(_0x1e2cba){logger[_0x5645('0x1f')]('[%s][UPDATE][ERRORS:%s]',_0x4b3be6,_0x1e2cba);})[_0x5645('0x20')](function(){delete _0x439b55['timers'][_0x4cbd46];});};Acw[_0x5645('0x18')]['startAcw']=function(_0x4f82d0){try{var _0x1ee2fb=this;var _0x53d763=this[_0x5645('0x9')][_0x4f82d0][_0x5645('0x21')];var _0x502c2e=this[_0x5645('0x9')][_0x4f82d0][_0x5645('0x22')];var _0xe83ed7=this['voiceQueues'][_0x502c2e];var _0x1e70ad=![];var _0xc38038=_0x5645('0x23');if(_0xe83ed7[_0x5645('0x24')]&&_0xe83ed7['mandatoryDispositionPause']['name']){_0x1e70ad=!![];_0xc38038=_0xe83ed7['mandatoryDispositionPause']['name'];}if(!_0x1ee2fb[_0x5645('0x7')][_0x53d763]){return Promise['resolve']();}return RpcUser['getAgent'](_0x1ee2fb[_0x5645('0x7')][_0x53d763]['id'])[_0x5645('0x25')](function(_0x357388){if(!_0x357388||_0x357388[_0x5645('0x26')]){logger[_0x5645('0x27')](_0x5645('0x28'),_0x4f82d0,_0x53d763,_0x502c2e);return;}logger[_0x5645('0x27')](_0x5645('0x29'),_0x4f82d0,_0x53d763,_0x502c2e);var _0x4493e6=_0x1ee2fb[_0x5645('0x9')][_0x4f82d0][_0x5645('0x2a')]&&_0x1ee2fb[_0x5645('0x9')][_0x4f82d0][_0x5645('0x2b')]?_0x1ee2fb[_0x5645('0x9')][_0x4f82d0]['destlinkedid']:_0x4f82d0;return RpcUser[_0x5645('0x2c')](_0x1ee2fb['agents'][_0x53d763],_0xc38038,_0x4493e6);})[_0x5645('0x25')](function(_0x31c31b){if(_0x1e70ad||!_0x31c31b){return;}_0x1ee2fb[_0x5645('0x8')][_0x53d763]={};logger[_0x5645('0x27')](_0x5645('0x2d'),_0x4f82d0,_0x1ee2fb[_0x5645('0x6')][_0x502c2e]['acwTimeout'],_0x53d763,_0x502c2e);_0x1ee2fb['timers'][_0x53d763][_0x5645('0x1b')]=setTimeout(_0x1ee2fb[_0x5645('0x2e')][_0x5645('0xd')](_0x1ee2fb,_0x53d763),_0x1ee2fb[_0x5645('0x6')][_0x502c2e][_0x5645('0x2f')]*0x3e8);_0x1ee2fb[_0x5645('0x8')][_0x53d763][_0x5645('0x1a')]=moment()[_0x5645('0x30')](_0x5645('0x31'));_0x1ee2fb[_0x5645('0x8')][_0x53d763][_0x5645('0x1d')]=_0x4f82d0;_0x1ee2fb['timers'][_0x53d763]['queue']=_0x502c2e;_0x1ee2fb[_0x5645('0x8')][_0x53d763]['updateAcw']=_0x1ee2fb[_0x5645('0x19')]['bind'](_0x1ee2fb,_0x53d763,_0x4f82d0);})[_0x5645('0x1e')](function(){logger['error'](_0x5645('0x2d'),_0x4f82d0,_0x1ee2fb[_0x5645('0x6')][_0x502c2e][_0x5645('0x2f')],_0x53d763,_0x502c2e);})[_0x5645('0x20')](function(){delete _0x1ee2fb[_0x5645('0x9')][_0x4f82d0];});}catch(_0x3f42f5){logger['error'](_0x5645('0x32'),_0x3f42f5[_0x5645('0x33')]);}};Acw[_0x5645('0x18')][_0x5645('0x2e')]=function(_0x23857e){try{var _0x2b1761=this;if(_0x2b1761[_0x5645('0x8')][_0x23857e]){_0x2b1761[_0x5645('0x8')][_0x23857e]['timer']=![];var _0x178f6b=_0x2b1761['timers'][_0x23857e][_0x5645('0x1d')];var _0x2aaf8f=_0x2b1761[_0x5645('0x8')][_0x23857e][_0x5645('0x22')];var _0x1a17fe=_0x2b1761['voiceQueues'][_0x2aaf8f][_0x5645('0x2f')];logger[_0x5645('0x27')](_0x5645('0x34'),_0x178f6b,_0x23857e);RpcUser[_0x5645('0x35')](this[_0x5645('0x7')][_0x23857e]);RpcVoiceAgentReport[_0x5645('0x1c')]({'acwtime':_0x1a17fe,'agentacw':!![]},_0x178f6b,_0x23857e)[_0x5645('0x25')](function(_0xa72d9){logger[_0x5645('0x27')](_0x5645('0x36'),_0x178f6b,_0x1a17fe,_0xa72d9);})[_0x5645('0x1e')](function(_0x19bbdb){logger[_0x5645('0x1f')](_0x5645('0x37'),_0x178f6b,_0x19bbdb);});}else{logger[_0x5645('0x1f')](_0x5645('0x38'),_0x23857e);if(_0x2b1761['timers']){logger[_0x5645('0x27')](_0x5645('0x39'),JSON['stringify'](_0x2b1761[_0x5645('0x8')]));}}}catch(_0x3b835f){logger['error'](_0x5645('0x3a'),_0x3b835f[_0x5645('0x33')]);}};Acw[_0x5645('0x18')][_0x5645('0xb')]=function(_0x2a2707){try{if(this[_0x5645('0x6')][_0x2a2707[_0x5645('0x22')]]&&(this['voiceQueues'][_0x2a2707['queue']][_0x5645('0x3')]||this[_0x5645('0x6')][_0x2a2707[_0x5645('0x22')]][_0x5645('0x24')])){if(this[_0x5645('0x7')][_0x2a2707[_0x5645('0x21')]]){this[_0x5645('0x9')][_0x2a2707[_0x5645('0x1d')]]={'queue':_0x2a2707[_0x5645('0x22')],'interface':_0x2a2707[_0x5645('0x21')],'destlinkedid':_0x2a2707[_0x5645('0x2b')]};}}}catch(_0x2317c5){logger[_0x5645('0x1f')](_0x5645('0x3b'),_0x2317c5[_0x5645('0x33')]);}};Acw[_0x5645('0x18')][_0x5645('0x15')]=function(_0x56d7e9){try{if(this['voiceQueues'][_0x56d7e9['queue']]&&(this['voiceQueues'][_0x56d7e9[_0x5645('0x22')]][_0x5645('0x3')]||this[_0x5645('0x6')][_0x56d7e9[_0x5645('0x22')]][_0x5645('0x24')])){if(this['agents'][_0x56d7e9[_0x5645('0x21')]]){this[_0x5645('0x9')][_0x56d7e9[_0x5645('0x1d')]]={'queue':_0x56d7e9[_0x5645('0x22')],'interface':_0x56d7e9[_0x5645('0x21')]};}}}catch(_0x5718a1){logger[_0x5645('0x1f')](_0x5645('0x3c'),_0x5718a1[_0x5645('0x33')]);}};Acw[_0x5645('0x18')][_0x5645('0xc')]=function(_0x3c491c){try{if(this[_0x5645('0x9')][_0x3c491c[_0x5645('0x1d')]]&&_['isUndefined'](this['channels'][_0x3c491c[_0x5645('0x1d')]][_0x5645('0x2a')])){logger['info']('[%s][HANGUP:UNIQUEID]',_0x3c491c[_0x5645('0x1d')]);this['startAcw'](_0x3c491c[_0x5645('0x1d')]);}else if(this[_0x5645('0x9')][_0x3c491c[_0x5645('0x3d')]]&&_[_0x5645('0x3e')](this[_0x5645('0x9')][_0x3c491c['linkedid']][_0x5645('0x2a')])){logger['info']('[%s][HANGUP:LINKEDID]',_0x3c491c[_0x5645('0x3d')]);this[_0x5645('0x3f')](_0x3c491c[_0x5645('0x3d')]);}}catch(_0x46637f){logger[_0x5645('0x1f')](_0x5645('0x40'),_0x46637f[_0x5645('0x33')]);}};Acw[_0x5645('0x18')][_0x5645('0xf')]=function(_0x181b88){try{if(this[_0x5645('0x9')][_0x181b88[_0x5645('0x1d')]]&&this['channels'][_0x181b88['uniqueid']][_0x5645('0x2a')]){logger[_0x5645('0x27')](_0x5645('0x41'),_0x181b88[_0x5645('0x1d')]);this[_0x5645('0x3f')](_0x181b88['uniqueid']);}else if(this[_0x5645('0x9')][_0x181b88[_0x5645('0x3d')]]&&this['channels'][_0x181b88[_0x5645('0x3d')]][_0x5645('0x2a')]){logger[_0x5645('0x27')](_0x5645('0x42'),_0x181b88[_0x5645('0x3d')]);this['startAcw'](_0x181b88[_0x5645('0x3d')]);}}catch(_0xd1f0b){logger[_0x5645('0x1f')](_0x5645('0x43'),_0xd1f0b['message']);}};Acw[_0x5645('0x18')][_0x5645('0x12')]=function(_0xd971f5){try{if(!_[_0x5645('0x44')](this[_0x5645('0x9')][_0xd971f5[_0x5645('0x45')]])){this[_0x5645('0x3f')](_0xd971f5[_0x5645('0x45')]);if(this[_0x5645('0x9')][_0xd971f5['secondtransfereruniqueid']]){this[_0x5645('0x9')][_0xd971f5[_0x5645('0x46')]]['attended']=!![];this['channels'][_0xd971f5[_0x5645('0x47')]]=this['channels'][_0xd971f5[_0x5645('0x46')]];delete this[_0x5645('0x9')][_0xd971f5[_0x5645('0x46')]];}}else if(!_[_0x5645('0x44')](this[_0x5645('0x9')][_0xd971f5[_0x5645('0x47')]])){this[_0x5645('0x3f')](_0xd971f5['transfertargetuniqueid']);if(this[_0x5645('0x9')][_0xd971f5[_0x5645('0x48')]]){this[_0x5645('0x9')][_0xd971f5[_0x5645('0x48')]][_0x5645('0x2a')]=!![];this[_0x5645('0x9')][_0xd971f5[_0x5645('0x45')]]=this[_0x5645('0x9')][_0xd971f5['origtransfereruniqueid']];delete this[_0x5645('0x9')][_0xd971f5[_0x5645('0x48')]];}}}catch(_0x8a9ab1){logger[_0x5645('0x1f')]('[ACW][syncAttendedTransfer]\x20%s',_0x8a9ab1[_0x5645('0x33')]);}};Acw[_0x5645('0x18')][_0x5645('0x13')]=function(_0x16abd2){try{if(this[_0x5645('0x9')][_0x16abd2[_0x5645('0x49')]]){logger[_0x5645('0x27')](_0x5645('0x4a'),JSON['stringify'](_0x16abd2[_0x5645('0x49')]));this[_0x5645('0x3f')](_0x16abd2[_0x5645('0x49')]);}else if(this[_0x5645('0x9')][_0x16abd2[_0x5645('0x4b')]]){logger[_0x5645('0x27')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x5645('0x4c')](_0x16abd2[_0x5645('0x4b')]));this[_0x5645('0x3f')](_0x16abd2[_0x5645('0x4b')]);}}catch(_0x584739){logger['error'](_0x5645('0x4d'),_0x584739[_0x5645('0x33')]);}};Acw[_0x5645('0x18')]['syncAgentRingNoAnswer']=function(_0xa322de){try{if(this[_0x5645('0x6')][_0xa322de[_0x5645('0x22')]]&&this[_0x5645('0x6')][_0xa322de[_0x5645('0x22')]][_0x5645('0x4e')]===_0x5645('0x4f')){if(this[_0x5645('0x7')][_0xa322de['interface']]){logger[_0x5645('0x27')](_0x5645('0x50'),_0xa322de[_0x5645('0x1d')],_0xa322de[_0x5645('0x21')],_0xa322de[_0x5645('0x22')]);return RpcUser['savePause'](this['agents'][_0xa322de[_0x5645('0x21')]],'Auto-Pause',_0xa322de['uniqueid']);}}}catch(_0x5cf90c){logger[_0x5645('0x1f')](_0x5645('0x51'),_0x5cf90c[_0x5645('0x33')]);}};module[_0x5645('0x52')]=Acw; \ No newline at end of file +var _0x236d=['acwTimeout','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','syncAgentConnect','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','startAcw','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','bind','hanguprequest','hangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','lastPauseAt','timer','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','finally','interface','queue','ACW','mandatoryDisposition','name','mandatoryDispositionPause','resolve','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4ece94,_0x446e1b){var _0x37d818=function(_0x11a1e2){while(--_0x11a1e2){_0x4ece94['push'](_0x4ece94['shift']());}};_0x37d818(++_0x446e1b);}(_0x236d,0x7e));var _0xd236=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x236d[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xd236('0x0'));var moment=require(_0xd236('0x1'));var ami=require('../ami');var logger=require(_0xd236('0x2'))('acw');var RpcUser=require(_0xd236('0x3'));var RpcVoiceAgentReport=require(_0xd236('0x4'));function Acw(_0x22533a){this[_0xd236('0x5')]=_0x22533a['voiceQueues'];this['agents']=_0x22533a[_0xd236('0x6')];this[_0xd236('0x7')]=_0x22533a[_0xd236('0x7')];this[_0xd236('0x8')]={};ami['on']('agentconnect',this['syncAgentConnect'][_0xd236('0x9')](this));ami['on'](_0xd236('0xa'),this['syncHangupRequest'][_0xd236('0x9')](this));ami['on'](_0xd236('0xb'),this['syncHangup'][_0xd236('0x9')](this));ami['on'](_0xd236('0xc'),this[_0xd236('0xd')]['bind'](this));ami['on'](_0xd236('0xe'),this[_0xd236('0xf')][_0xd236('0x9')](this));ami['on']('blindtransfer',this[_0xd236('0x10')][_0xd236('0x9')](this));ami['on'](_0xd236('0x11'),this[_0xd236('0x12')][_0xd236('0x9')](this));}function getDiff(_0x224469){var _0x206b35=moment()[_0xd236('0x13')](0x0);var _0x22435c=moment(_0x224469)[_0xd236('0x13')](0x0);return _0x206b35[_0xd236('0x14')](_0x22435c,_0xd236('0x15'));}Acw[_0xd236('0x16')][_0xd236('0x17')]=function(_0xd851b5,_0x3b2535){var _0x2a076d=this;var _0x33d0be=getDiff(_0x2a076d[_0xd236('0x7')][_0xd851b5][_0xd236('0x18')]);clearTimeout(_0x2a076d['timers'][_0xd851b5]['timer']);_0x2a076d[_0xd236('0x7')][_0xd851b5][_0xd236('0x19')]=![];return RpcVoiceAgentReport['update']({'acwtime':_0x33d0be},_0x2a076d[_0xd236('0x7')][_0xd851b5][_0xd236('0x1a')],_0xd851b5)[_0xd236('0x1b')](function(_0x595fd4){logger[_0xd236('0x1c')](_0xd236('0x1d'),_0x3b2535,_0x33d0be,_0x595fd4);})[_0xd236('0x1e')](function(_0x551b53){logger[_0xd236('0x1f')](_0xd236('0x20'),_0x3b2535,_0x551b53);})[_0xd236('0x21')](function(){delete _0x2a076d[_0xd236('0x7')][_0xd851b5];});};Acw[_0xd236('0x16')]['startAcw']=function(_0x2a1255){try{var _0x30e7aa=this;var _0x1e4ddb=this[_0xd236('0x8')][_0x2a1255][_0xd236('0x22')];var _0x5470a0=this['channels'][_0x2a1255][_0xd236('0x23')];var _0x4be5ac=this[_0xd236('0x5')][_0x5470a0];var _0x4c27ef=![];var _0x2be060=_0xd236('0x24');if(_0x4be5ac[_0xd236('0x25')]&&_0x4be5ac['mandatoryDispositionPause'][_0xd236('0x26')]){_0x4c27ef=!![];_0x2be060=_0x4be5ac[_0xd236('0x27')][_0xd236('0x26')];}if(!_0x30e7aa[_0xd236('0x6')][_0x1e4ddb]){return Promise[_0xd236('0x28')]();}return RpcUser[_0xd236('0x29')](_0x30e7aa[_0xd236('0x6')][_0x1e4ddb]['id'])[_0xd236('0x1b')](function(_0x2cbb03){if(!_0x2cbb03||_0x2cbb03[_0xd236('0x2a')]){logger[_0xd236('0x1c')](_0xd236('0x2b'),_0x2a1255,_0x1e4ddb,_0x5470a0);return;}logger[_0xd236('0x1c')](_0xd236('0x2c'),_0x2a1255,_0x1e4ddb,_0x5470a0);var _0x3108f4=_0x30e7aa[_0xd236('0x8')][_0x2a1255][_0xd236('0x2d')]&&_0x30e7aa[_0xd236('0x8')][_0x2a1255][_0xd236('0x2e')]?_0x30e7aa[_0xd236('0x8')][_0x2a1255][_0xd236('0x2e')]:_0x2a1255;return RpcUser[_0xd236('0x2f')](_0x30e7aa[_0xd236('0x6')][_0x1e4ddb],_0x2be060,_0x3108f4);})[_0xd236('0x1b')](function(_0xdd34a4){if(_0x4c27ef||!_0xdd34a4){return;}_0x30e7aa[_0xd236('0x7')][_0x1e4ddb]={};logger[_0xd236('0x1c')](_0xd236('0x30'),_0x2a1255,_0x30e7aa[_0xd236('0x5')][_0x5470a0]['acwTimeout'],_0x1e4ddb,_0x5470a0);_0x30e7aa[_0xd236('0x7')][_0x1e4ddb]['timer']=setTimeout(_0x30e7aa[_0xd236('0x31')][_0xd236('0x9')](_0x30e7aa,_0x1e4ddb),_0x30e7aa[_0xd236('0x5')][_0x5470a0]['acwTimeout']*0x3e8);_0x30e7aa[_0xd236('0x7')][_0x1e4ddb][_0xd236('0x18')]=moment()[_0xd236('0x32')](_0xd236('0x33'));_0x30e7aa[_0xd236('0x7')][_0x1e4ddb][_0xd236('0x1a')]=_0x2a1255;_0x30e7aa[_0xd236('0x7')][_0x1e4ddb]['queue']=_0x5470a0;_0x30e7aa[_0xd236('0x7')][_0x1e4ddb]['updateAcw']=_0x30e7aa[_0xd236('0x17')]['bind'](_0x30e7aa,_0x1e4ddb,_0x2a1255);})[_0xd236('0x1e')](function(){logger[_0xd236('0x1f')](_0xd236('0x30'),_0x2a1255,_0x30e7aa[_0xd236('0x5')][_0x5470a0][_0xd236('0x34')],_0x1e4ddb,_0x5470a0);})[_0xd236('0x21')](function(){delete _0x30e7aa[_0xd236('0x8')][_0x2a1255];});}catch(_0x94c21b){logger[_0xd236('0x1f')](_0xd236('0x35'),_0x94c21b[_0xd236('0x36')]);}};Acw[_0xd236('0x16')][_0xd236('0x31')]=function(_0x5f2c75){try{var _0x414f55=this;if(_0x414f55[_0xd236('0x7')][_0x5f2c75]){_0x414f55[_0xd236('0x7')][_0x5f2c75]['timer']=![];var _0x2cb19a=_0x414f55[_0xd236('0x7')][_0x5f2c75][_0xd236('0x1a')];var _0x1848a4=_0x414f55[_0xd236('0x7')][_0x5f2c75][_0xd236('0x23')];var _0x4ed922=_0x414f55[_0xd236('0x5')][_0x1848a4][_0xd236('0x34')];logger[_0xd236('0x1c')](_0xd236('0x37'),_0x2cb19a,_0x5f2c75);RpcUser[_0xd236('0x38')](this[_0xd236('0x6')][_0x5f2c75]);RpcVoiceAgentReport['update']({'acwtime':_0x4ed922,'agentacw':!![]},_0x2cb19a,_0x5f2c75)[_0xd236('0x1b')](function(_0x2cd22e){logger[_0xd236('0x1c')]('[%s][UPDATE][ACWTIME:%s]',_0x2cb19a,_0x4ed922,_0x2cd22e);})[_0xd236('0x1e')](function(_0x5a8b18){logger[_0xd236('0x1f')]('[%s][UPDATE][ERRORS:%s]',_0x2cb19a,_0x5a8b18);});}else{logger['error'](_0xd236('0x39'),_0x5f2c75);if(_0x414f55[_0xd236('0x7')]){logger[_0xd236('0x1c')](_0xd236('0x3a'),JSON[_0xd236('0x3b')](_0x414f55['timers']));}}}catch(_0x4d0d65){logger[_0xd236('0x1f')](_0xd236('0x3c'),_0x4d0d65['message']);}};Acw[_0xd236('0x16')][_0xd236('0x3d')]=function(_0x2d815b){try{if(this['voiceQueues'][_0x2d815b['queue']]&&(this['voiceQueues'][_0x2d815b[_0xd236('0x23')]]['acw']||this['voiceQueues'][_0x2d815b[_0xd236('0x23')]][_0xd236('0x25')])){if(this[_0xd236('0x6')][_0x2d815b[_0xd236('0x22')]]){this[_0xd236('0x8')][_0x2d815b['uniqueid']]={'queue':_0x2d815b['queue'],'interface':_0x2d815b[_0xd236('0x22')],'destlinkedid':_0x2d815b[_0xd236('0x2e')]};}}}catch(_0x2e233f){logger[_0xd236('0x1f')](_0xd236('0x3e'),_0x2e233f[_0xd236('0x36')]);}};Acw['prototype'][_0xd236('0x12')]=function(_0x48ce89){try{if(this[_0xd236('0x5')][_0x48ce89[_0xd236('0x23')]]&&(this['voiceQueues'][_0x48ce89['queue']]['acw']||this['voiceQueues'][_0x48ce89[_0xd236('0x23')]][_0xd236('0x25')])){if(this[_0xd236('0x6')][_0x48ce89[_0xd236('0x22')]]){this[_0xd236('0x8')][_0x48ce89['uniqueid']]={'queue':_0x48ce89['queue'],'interface':_0x48ce89[_0xd236('0x22')]};}}}catch(_0x7c0650){logger[_0xd236('0x1f')](_0xd236('0x3f'),_0x7c0650[_0xd236('0x36')]);}};Acw[_0xd236('0x16')]['syncHangupRequest']=function(_0x2be871){try{if(this['channels'][_0x2be871[_0xd236('0x1a')]]&&_[_0xd236('0x40')](this['channels'][_0x2be871[_0xd236('0x1a')]][_0xd236('0x2d')])){logger['info']('[%s][HANGUP:UNIQUEID]',_0x2be871[_0xd236('0x1a')]);this[_0xd236('0x41')](_0x2be871[_0xd236('0x1a')]);}else if(this[_0xd236('0x8')][_0x2be871['linkedid']]&&_[_0xd236('0x40')](this[_0xd236('0x8')][_0x2be871[_0xd236('0x42')]][_0xd236('0x2d')])){logger[_0xd236('0x1c')](_0xd236('0x43'),_0x2be871['linkedid']);this['startAcw'](_0x2be871[_0xd236('0x42')]);}}catch(_0x5ea7ec){logger[_0xd236('0x1f')](_0xd236('0x44'),_0x5ea7ec['message']);}};Acw[_0xd236('0x16')][_0xd236('0x45')]=function(_0x4d2375){try{if(this[_0xd236('0x8')][_0x4d2375[_0xd236('0x1a')]]&&this[_0xd236('0x8')][_0x4d2375[_0xd236('0x1a')]]['attended']){logger['info'](_0xd236('0x46'),_0x4d2375[_0xd236('0x1a')]);this['startAcw'](_0x4d2375[_0xd236('0x1a')]);}else if(this[_0xd236('0x8')][_0x4d2375[_0xd236('0x42')]]&&this[_0xd236('0x8')][_0x4d2375[_0xd236('0x42')]]['attended']){logger[_0xd236('0x1c')](_0xd236('0x47'),_0x4d2375[_0xd236('0x42')]);this['startAcw'](_0x4d2375[_0xd236('0x42')]);}}catch(_0x524d53){logger['error'](_0xd236('0x48'),_0x524d53[_0xd236('0x36')]);}};Acw[_0xd236('0x16')][_0xd236('0xf')]=function(_0x180aae){try{if(!_[_0xd236('0x49')](this[_0xd236('0x8')][_0x180aae['transfereeuniqueid']])){this[_0xd236('0x41')](_0x180aae[_0xd236('0x4a')]);if(this[_0xd236('0x8')][_0x180aae[_0xd236('0x4b')]]){this[_0xd236('0x8')][_0x180aae[_0xd236('0x4b')]]['attended']=!![];this[_0xd236('0x8')][_0x180aae[_0xd236('0x4c')]]=this[_0xd236('0x8')][_0x180aae['secondtransfereruniqueid']];delete this[_0xd236('0x8')][_0x180aae[_0xd236('0x4b')]];}}else if(!_[_0xd236('0x49')](this['channels'][_0x180aae[_0xd236('0x4c')]])){this[_0xd236('0x41')](_0x180aae[_0xd236('0x4c')]);if(this[_0xd236('0x8')][_0x180aae['origtransfereruniqueid']]){this[_0xd236('0x8')][_0x180aae['origtransfereruniqueid']][_0xd236('0x2d')]=!![];this['channels'][_0x180aae[_0xd236('0x4a')]]=this['channels'][_0x180aae[_0xd236('0x4d')]];delete this[_0xd236('0x8')][_0x180aae['origtransfereruniqueid']];}}}catch(_0x3c4dab){logger['error'](_0xd236('0x4e'),_0x3c4dab[_0xd236('0x36')]);}};Acw['prototype'][_0xd236('0x10')]=function(_0x44dec8){try{if(this['channels'][_0x44dec8['transfereruniqueid']]){logger[_0xd236('0x1c')](_0xd236('0x4f'),JSON['stringify'](_0x44dec8[_0xd236('0x50')]));this['startAcw'](_0x44dec8[_0xd236('0x50')]);}else if(this[_0xd236('0x8')][_0x44dec8['transfererlinkedid']]){logger[_0xd236('0x1c')](_0xd236('0x51'),JSON[_0xd236('0x3b')](_0x44dec8[_0xd236('0x52')]));this['startAcw'](_0x44dec8[_0xd236('0x52')]);}}catch(_0x447f12){logger[_0xd236('0x1f')]('[ACW][syncBlindTransfer]\x20%s',_0x447f12[_0xd236('0x36')]);}};Acw['prototype'][_0xd236('0xd')]=function(_0x119c9f){try{if(this[_0xd236('0x5')][_0x119c9f['queue']]&&this[_0xd236('0x5')][_0x119c9f[_0xd236('0x23')]][_0xd236('0x53')]===_0xd236('0x54')){if(this['agents'][_0x119c9f[_0xd236('0x22')]]){logger[_0xd236('0x1c')](_0xd236('0x55'),_0x119c9f[_0xd236('0x1a')],_0x119c9f['interface'],_0x119c9f[_0xd236('0x23')]);return RpcUser[_0xd236('0x2f')](this['agents'][_0x119c9f['interface']],_0xd236('0x56'),_0x119c9f[_0xd236('0x1a')]);}}}catch(_0x44fefc){logger[_0xd236('0x1f')](_0xd236('0x57'),_0x44fefc[_0xd236('0x36')]);}};module[_0xd236('0x58')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 5486952..e1783da 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 _0x48a3=['sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','info','format','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','actionQueueSummary','catch','exports','bluebird','util','../../config/logger','../../config/environment','asterisk','port','username','password','keepConnected','Action','promisify','action','inspect','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry'];(function(_0x4c7ab1,_0x8d8322){var _0x32d062=function(_0x153b04){while(--_0x153b04){_0x4c7ab1['push'](_0x4c7ab1['shift']());}};_0x32d062(++_0x8d8322);}(_0x48a3,0x13d));var _0x348a=function(_0x32959e,_0x95c759){_0x32959e=_0x32959e-0x0;var _0x379025=_0x48a3[_0x32959e];return _0x379025;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x348a('0x0'));var util=require(_0x348a('0x1'));var logger=require(_0x348a('0x2'))('ami');var config=require(_0x348a('0x3'));var ami=new Manager(config[_0x348a('0x4')][_0x348a('0x5')],config[_0x348a('0x4')]['ip'],config[_0x348a('0x4')][_0x348a('0x6')],config[_0x348a('0x4')][_0x348a('0x7')],!![]);ami[_0x348a('0x8')]();ami[_0x348a('0x9')]=BPromise[_0x348a('0xa')](ami[_0x348a('0xb')]);function error(_0x39a864){logger['error'](util['format']('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x348a('0x4')][_0x348a('0x6')],config[_0x348a('0x4')]['ip'],config[_0x348a('0x4')][_0x348a('0x5')],util[_0x348a('0xc')](_0x39a864,![],null)));}function close(){logger[_0x348a('0xd')](util['format'](_0x348a('0xe'),config['asterisk']['username'],config[_0x348a('0x4')]['ip'],config[_0x348a('0x4')]['port']));}ami[_0x348a('0xf')]=function(){return function(){return ami[_0x348a('0x9')]({'action':_0x348a('0x10')});};};ami[_0x348a('0x11')]=function(){return function(){return ami[_0x348a('0x9')]({'action':_0x348a('0x12')});};};ami[_0x348a('0x13')]=function(){return function(){return ami[_0x348a('0x9')]({'action':_0x348a('0x14')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0x348a('0x15')});};};ami[_0x348a('0x16')]=function(){return function(){return ami[_0x348a('0x9')]({'action':'coreshowchannels'});};};function connect(){logger[_0x348a('0x17')](util[_0x348a('0x18')](_0x348a('0x19'),config[_0x348a('0x4')][_0x348a('0x6')],config[_0x348a('0x4')]['ip'],config[_0x348a('0x4')][_0x348a('0x5')]));ami[_0x348a('0x1a')]('error',error);ami[_0x348a('0x1a')](_0x348a('0x1b'),close);}ami['on'](_0x348a('0x1c'),connect);ami['on'](_0x348a('0x1d'),function(_0x53cab4){logger['info'](util[_0x348a('0x18')](_0x348a('0x1e'),config[_0x348a('0x4')][_0x348a('0x6')],config[_0x348a('0x4')]['ip'],config['asterisk'][_0x348a('0x5')],util[_0x348a('0xc')](_0x53cab4,![],null)));});ami['on'](_0x348a('0x1f'),function(){logger[_0x348a('0x17')](util[_0x348a('0x18')](_0x348a('0x20'),config['asterisk'][_0x348a('0x6')],config[_0x348a('0x4')]['ip'],config[_0x348a('0x4')]['port']));return Promise['resolve']()[_0x348a('0x21')](ami[_0x348a('0xf')]())[_0x348a('0x21')](ami[_0x348a('0x11')]())['then'](ami['actionSipPeerStatus']())[_0x348a('0x21')](ami[_0x348a('0x22')]())[_0x348a('0x21')](ami[_0x348a('0x16')]())[_0x348a('0x23')](function(_0x4a5965){logger[_0x348a('0xd')]('[ami.js][fullybooted]',util['inspect'](_0x4a5965,{'showHidden':![],'depth':null}));});});ami[_0x348a('0x1a')]('error',error);ami['once'](_0x348a('0x1b'),close);module[_0x348a('0x24')]=ami; \ No newline at end of file +var _0xc8fc=['Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionDeviceStateList','actionSipPeerStatus','once','close','asterisk-manager','bluebird','../../config/logger','../../config/environment','port','asterisk','password','keepConnected','Action','promisify','action','error','format','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','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','connect','shutdown'];(function(_0x5678b5,_0x1c4aa8){var _0x4c09a5=function(_0x2aa89a){while(--_0x2aa89a){_0x5678b5['push'](_0x5678b5['shift']());}};_0x4c09a5(++_0x1c4aa8);}(_0xc8fc,0x189));var _0xcc8f=function(_0x160dcb,_0x3451b5){_0x160dcb=_0x160dcb-0x0;var _0x2ce20a=_0xc8fc[_0x160dcb];return _0x2ce20a;};'use strict';var Manager=require(_0xcc8f('0x0'));var BPromise=require(_0xcc8f('0x1'));var util=require('util');var logger=require(_0xcc8f('0x2'))('ami');var config=require(_0xcc8f('0x3'));var ami=new Manager(config['asterisk'][_0xcc8f('0x4')],config[_0xcc8f('0x5')]['ip'],config[_0xcc8f('0x5')]['username'],config[_0xcc8f('0x5')][_0xcc8f('0x6')],!![]);ami[_0xcc8f('0x7')]();ami[_0xcc8f('0x8')]=BPromise[_0xcc8f('0x9')](ami[_0xcc8f('0xa')]);function error(_0x105910){logger[_0xcc8f('0xb')](util[_0xcc8f('0xc')](_0xcc8f('0xd'),config['asterisk'][_0xcc8f('0xe')],config[_0xcc8f('0x5')]['ip'],config['asterisk'][_0xcc8f('0x4')],util[_0xcc8f('0xf')](_0x105910,![],null)));}function close(){logger[_0xcc8f('0xb')](util[_0xcc8f('0xc')](_0xcc8f('0x10'),config[_0xcc8f('0x5')][_0xcc8f('0xe')],config[_0xcc8f('0x5')]['ip'],config[_0xcc8f('0x5')][_0xcc8f('0x4')]));}ami[_0xcc8f('0x11')]=function(){return function(){return ami['Action']({'action':_0xcc8f('0x12')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0xcc8f('0x8')]({'action':'devicestatelist'});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0xcc8f('0x8')]({'action':_0xcc8f('0x13')});};};ami[_0xcc8f('0x14')]=function(){return function(){return ami[_0xcc8f('0x8')]({'action':_0xcc8f('0x15')});};};ami[_0xcc8f('0x16')]=function(){return function(){return ami[_0xcc8f('0x8')]({'action':'coreshowchannels'});};};function connect(){logger[_0xcc8f('0x17')](util[_0xcc8f('0xc')](_0xcc8f('0x18'),config['asterisk'][_0xcc8f('0xe')],config[_0xcc8f('0x5')]['ip'],config['asterisk'][_0xcc8f('0x4')]));ami['once']('error',error);ami['once']('close',close);}ami['on'](_0xcc8f('0x19'),connect);ami['on'](_0xcc8f('0x1a'),function(_0x53db02){logger[_0xcc8f('0x17')](util[_0xcc8f('0xc')](_0xcc8f('0x1b'),config['asterisk'][_0xcc8f('0xe')],config['asterisk']['ip'],config[_0xcc8f('0x5')][_0xcc8f('0x4')],util[_0xcc8f('0xf')](_0x53db02,![],null)));});ami['on']('fullybooted',function(){logger[_0xcc8f('0x17')](util['format'](_0xcc8f('0x1c'),config[_0xcc8f('0x5')]['username'],config[_0xcc8f('0x5')]['ip'],config[_0xcc8f('0x5')][_0xcc8f('0x4')]));return Promise[_0xcc8f('0x1d')]()[_0xcc8f('0x1e')](ami[_0xcc8f('0x11')]())[_0xcc8f('0x1e')](ami[_0xcc8f('0x1f')]())[_0xcc8f('0x1e')](ami[_0xcc8f('0x20')]())[_0xcc8f('0x1e')](ami['actionQueueSummary']())['then'](ami['actionCoreShowChannels']())['catch'](function(_0x58a8d7){logger[_0xcc8f('0xb')]('[ami.js][fullybooted]',util['inspect'](_0x58a8d7,{'showHidden':![],'depth':null}));});});ami[_0xcc8f('0x21')](_0xcc8f('0xb'),error);ami[_0xcc8f('0x21')](_0xcc8f('0x22'),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 a5d403e..d0ce6e9 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['rpc','memberReport','error','message','result','catch','exports','../../config/logger','ami','client','http','Request','request','then','debug'];(function(_0x4589e7,_0x3892c8){var _0x1f8a74=function(_0x1c3746){while(--_0x1c3746){_0x4589e7['push'](_0x4589e7['shift']());}};_0x1f8a74(++_0x3892c8);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var client=jayson[_0x3071('0x2')][_0x3071('0x3')]({'port':0x2329});client[_0x3071('0x4')]=function(_0x52b5fb,_0x2c547f){return new BPromise(function(_0x7b18a4,_0x33a70c){return client[_0x3071('0x5')](_0x52b5fb,_0x2c547f)[_0x3071('0x6')](function(_0x41cf76){logger[_0x3071('0x7')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x2c547f,_0x41cf76);if(_0x41cf76[_0x3071('0xa')]){logger[_0x3071('0xa')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x41cf76['error'][_0x3071('0xb')],_0x2c547f);return _0x33a70c(_0x41cf76[_0x3071('0xa')][_0x3071('0xb')]);}else{return _0x7b18a4(_0x41cf76[_0x3071('0xc')]);}})[_0x3071('0xd')](function(_0x4a470a){logger[_0x3071('0xa')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x4a470a,_0x2c547f);return _0x33a70c(_0x4a470a);});});};module[_0x3071('0xe')]=client; \ No newline at end of file +var _0xa9e0=['result','catch','exports','jayson/promise','bluebird','../../config/logger','http','request','debug','rpc','error','message'];(function(_0x3de873,_0x174b5f){var _0x380b8c=function(_0x313dea){while(--_0x313dea){_0x3de873['push'](_0x3de873['shift']());}};_0x380b8c(++_0x174b5f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('ami');var client=jayson['client'][_0x0a9e('0x3')]({'port':0x2329});client['Request']=function(_0x333808,_0x432180){return new BPromise(function(_0x2ab90b,_0x991246){return client[_0x0a9e('0x4')](_0x333808,_0x432180)['then'](function(_0x219af0){logger[_0x0a9e('0x5')](_0x0a9e('0x6'),'memberReport',_0x333808,_0x432180,_0x219af0);if(_0x219af0['error']){logger[_0x0a9e('0x7')]('rpc','memberReport',_0x333808,_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')],_0x432180);return _0x991246(_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')]);}else{return _0x2ab90b(_0x219af0[_0x0a9e('0x9')]);}})[_0x0a9e('0xa')](function(_0x4a4c56){logger['error']('rpc','memberReport',_0x333808,_0x4a4c56,_0x432180);return _0x991246(_0x4a4c56);});});};module[_0x0a9e('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index b421ac1..f7ea8e0 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 _0x95de=['countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','minutes','ContactId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','starttime','calleridname','calleridnum','createHistory','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','add','ListId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','syncNewExten','channel','actionid','strategy','rrmemory','isNil','locked','paused','stateinterface','roundrobin','preview','run','idHopper','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','responsetime','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','exten','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','emit','custom:amd','buildObj','saveInDb','[syncHangupInAMD][createHistory]','dialAMDActive','Machine','amd','countbusyretry','countnoanswerretry','countmachineretry','countagentrejectretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','[syncAgentComplete][createHistory][0]','countcongestionretry','dialGlobalMaxRetry','ivrAnswerCallsDay','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','cause-txt','[syncHangupIvr]','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','inUse','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','filter','dialPreviewRecallmeReminder','online','resolve','handlePreviewRecallNotifications','map','Agent','user:%s','checkPreviewRecallReminder','[uniqueid]','clearZombieChannels','[actions]','Action','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','notFound','merge','UserId','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','user:dialPreviewRecallReminder','handleIvr','actionOriginate','object','originate','phone','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','dialQueueTimeout','getCaller','xcally-motion-dialer','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDMaximumWordLength','XMD-CAMPAIGNID','Trunk','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','callerid','originatecalleridname','XMD-ORIGINATECALLERIDNUM','variables','dialPrefix','trim','dialCutDigit','substring','SIP/%s/%s%s','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','countnosuchnumberretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','outboundUnknownCallsDay','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','outboundDropCallsDayTimeout','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','talking','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dropRate','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','floor','one\x20call\x20every:','milliseconds','checkContactBlack','dialMethod','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','voicePause','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','limitCalls','temp','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','Contact','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','getContactDialer','countReScheduled','emptyContact','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','[countReScheduled]\x20','checkIsBlackList','loggerHandler','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\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','m\x20=\x20','Ts\x20=\x20','[abandonmentRate]','p\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','interval\x20=\x20','Umin\x20=\x20','util','lodash','uuid','./utils','./utils/hopper','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/queueCallerAbandon','./models/hangup','env','127.0.0.1','prototype','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','optionPredictive','startPredictive','startProgressive','queueBooked','queuesSummary','agentconnect','syncQueueCallerAbandon','bind','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummaryComplete','hangup','newexten','varset','syncVarSet','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','voice:queue:%s','name','voice_queue:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','isUndefined','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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','erlangBusyFactor','erlangAbandonmentRate','getSeconds','startProgressive\x20value\x20cleared','handlePredictive','error','inspect','checkContactLowerLimitOriginate','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','statedesc','endtime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','Interval','\x20INTERVAL_IS_NULL','NULL_INTERVAL','isEmpty','Intervals','isIVRCampaignActive','format','campaign:save','sendMessageOneNotActive','originated','INACTIVE','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','[ifTime][Action]','Error','isTrunkReachable','active','SIP/%s','reachable','status','unmonitored','checkIsTrunkReachable','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','ifTimeIvr','checkIfTimeIntervals','ifTime','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','Failure','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','isArray','length','push','command','iftime\x20%s,%s','interval','indexOf','content','true','catch','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','loopCampaigns','resetActiveCalls','syncCampaigns','undefined','checkIfTime','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','dialGlobalInterval','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','Global:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','syncAgentConnect','uniqueId','uniqueid','type','ivr','updateOriginated','queue','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','predictiveIntervalErlangCallsDroppedCalls','state','Drop','dropreason','TIMEOUT'];(function(_0x1aab68,_0x39ae45){var _0x272803=function(_0x9e4ba){while(--_0x9e4ba){_0x1aab68['push'](_0x1aab68['shift']());}};_0x272803(++_0x39ae45);}(_0x95de,0x150));var _0xe95d=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x95de[_0x13d07a];return _0x5ee0ee;};'use strict';var util=require(_0xe95d('0x0'));var _=require(_0xe95d('0x1'));var uuid=require(_0xe95d('0x2'));var moment=require('moment');var rr=require('rr');var Redis=require('ioredis');var utils=require(_0xe95d('0x3'));var hopperUtils=require(_0xe95d('0x4'));var ut=require('../preview/util/util');var config=require(_0xe95d('0x5'));var logger=require(_0xe95d('0x6'))(_0xe95d('0x7'));var loggerBooked=require(_0xe95d('0x6'))(_0xe95d('0x8'));var loggerPredictive=require(_0xe95d('0x6'))(_0xe95d('0x9'));var loggerPredictiveCalls=require(_0xe95d('0x6'))(_0xe95d('0xa'));var loggerSyncQueueSummary=require(_0xe95d('0x6'))(_0xe95d('0xb'));var ami=require(_0xe95d('0xc'));config[_0xe95d('0xd')]=_['defaults'](config[_0xe95d('0xd')],{'host':_0xe95d('0xe'),'port':0x18eb});var io=require(_0xe95d('0xf'))(new Redis(config[_0xe95d('0xd')]));var cmHopper=require(_0xe95d('0x10'));var voiceQueueRt=require(_0xe95d('0x11'));var RpcSetting=require(_0xe95d('0x12'));var Interval=require(_0xe95d('0x13'));var Action=require(_0xe95d('0x14'));var History=require(_0xe95d('0x15'));var Final=require(_0xe95d('0x16'));var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require(_0xe95d('0x17'));var Hangup=require(_0xe95d('0x18'));var ipAgi=process[_0xe95d('0x19')]['XCALLY_IP_AGI']||_0xe95d('0x1a');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xe95d('0x1b')][_0xe95d('0x1c')]=function(_0x59d419){this[_0xe95d('0x1d')]=this[_0xe95d('0x1d')]?this['tail'][_0xe95d('0x1e')](_0x59d419):_0x59d419();};function Dialer(_0x2d1a29,_0xeae26c){this[_0xe95d('0x1f')]=new Sequence();this['preview']=_0xeae26c;this[_0xe95d('0x20')]=_0x2d1a29['voiceQueues'];this['campaigns']=_0x2d1a29[_0xe95d('0x21')];this[_0xe95d('0x22')]=_0x2d1a29[_0xe95d('0x22')];this[_0xe95d('0x23')]=_0x2d1a29['trunks'];this[_0xe95d('0x24')]=config['maxNumberOriginate']||0x2;this[_0xe95d('0x25')]={};this[_0xe95d('0x26')]={};this[_0xe95d('0x27')]={};this['uniqueId']={};this[_0xe95d('0x28')]={};this[_0xe95d('0x29')]={};this[_0xe95d('0x2a')]={};this['ivrOriginated']={};this[_0xe95d('0x2b')]={};this['queueBookedRR']={};this[_0xe95d('0x2c')]={};ami['on'](_0xe95d('0x2d'),this['syncAgentConnect']['bind'](this));ami['on']('queuecallerabandon',this[_0xe95d('0x2e')][_0xe95d('0x2f')](this));ami['on']('originateresponse',this[_0xe95d('0x30')][_0xe95d('0x2f')](this));ami['on'](_0xe95d('0x31'),this[_0xe95d('0x32')][_0xe95d('0x2f')](this));ami['on'](_0xe95d('0x33'),this[_0xe95d('0xb')][_0xe95d('0x2f')](this));ami['on']('custom:queuesummarycomplete',this[_0xe95d('0x34')][_0xe95d('0x2f')](this));ami['on'](_0xe95d('0x35'),this['syncHangup'][_0xe95d('0x2f')](this));ami['on'](_0xe95d('0x36'),this['syncNewExten'][_0xe95d('0x2f')](this));ami['on'](_0xe95d('0x37'),this[_0xe95d('0x38')]['bind'](this));ami['on']('queuemember',this[_0xe95d('0x39')]['bind'](this));ami['on'](_0xe95d('0x3a'),this[_0xe95d('0x3b')][_0xe95d('0x2f')](this));this['loopCampaigns']();this[_0xe95d('0x3c')]();RpcSetting[_0xe95d('0x3d')]()[_0xe95d('0x3e')](function(_0x4146fa){previewRecallmeReminderInterval=_0x4146fa[_0xe95d('0x3f')];});}function isNotNull(_0x2e2af1){return _0x2e2af1!==null&&!_['isUndefined'](_0x2e2af1);}function msgResponse(_0x2b2641,_0x9fe405,_0x26305a){return{'action':_0x2b2641,'response':_0x9fe405,'message':_0x26305a,'stack':_0x26305a};}function emit(_0xcd40df,_0x4ba878,_0xf6978b){io['to'](_0xcd40df)['emit'](_0x4ba878,_0xf6978b);}function emitOutboundVoiceQueueSummary(_0x4ddd6a){if(_0x4ddd6a['type']==='outbound'){logger[_0xe95d('0x40')](_0xe95d('0x41'),util['inspect'](_0x4ddd6a,{'showHidden':![],'depth':null}));emit(util['format'](_0xe95d('0x42'),_0x4ddd6a[_0xe95d('0x43')]),_0xe95d('0x44'),_0x4ddd6a);}}function checkGetDataPredictive(_0x1e3c1e){if(isNotNull(_0x1e3c1e)&&!_['isEmpty'](_0x1e3c1e)){loggerPredictive[_0xe95d('0x45')](_0xe95d('0x46'));loggerPredictive[_0xe95d('0x45')](_0xe95d('0x47'),_0x1e3c1e[_0xe95d('0x48')]);loggerPredictive[_0xe95d('0x45')](_0xe95d('0x49'),_0x1e3c1e[_0xe95d('0x4a')]);loggerPredictive['info'](_0xe95d('0x4b'),_0x1e3c1e[_0xe95d('0x4c')]);loggerPredictive['info'](_0xe95d('0x4d'),_0x1e3c1e[_0xe95d('0x4e')]);loggerPredictive['info'](_0xe95d('0x4f'),_0x1e3c1e['predictiveIntervalAvgHoldtime']);loggerPredictive[_0xe95d('0x45')](_0xe95d('0x50'),_0x1e3c1e[_0xe95d('0x51')]);loggerPredictive[_0xe95d('0x45')](_0xe95d('0x52'));if(_0x1e3c1e['predictiveIntervalTotalCalls']>0x0){if(!_[_0xe95d('0x53')](_0x1e3c1e['predictiveIntervalAvgTalktime'])&&_0x1e3c1e['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0xe95d('0x45')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_['isUndefined'](_0x1e3c1e['predictiveIntervalAvgHoldtime'])&&_0x1e3c1e[_0xe95d('0x54')]>0x0){return!![];}loggerPredictive[_0xe95d('0x45')](_0xe95d('0x55'));}else{loggerPredictive[_0xe95d('0x45')](_0xe95d('0x56'));}}else{loggerPredictive[_0xe95d('0x45')](_0xe95d('0x57'));}return![];}function mergeDataErlangB(_0xda3180){return function(_0x23e4e0){loggerPredictive[_0xe95d('0x45')](_0xe95d('0x58'));loggerPredictive['info'](_0xe95d('0x59'),_0x23e4e0[_0xe95d('0x5a')]);loggerPredictive[_0xe95d('0x45')](_0xe95d('0x5b'),_0x23e4e0[_0xe95d('0x5c')]);loggerPredictive[_0xe95d('0x45')](_0xe95d('0x5d'),_0x23e4e0['erlangAbandonmentRate']);loggerPredictive[_0xe95d('0x45')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x23e4e0[_0xe95d('0x5e')]);loggerPredictive[_0xe95d('0x45')](_0xe95d('0x5d'),_0x23e4e0[_0xe95d('0x5f')]);loggerPredictive[_0xe95d('0x45')](_0xe95d('0x52'));_['merge'](_0xda3180,_0x23e4e0);};}function ifInterval(_0x58c606,_0x39de39){if(_[_0xe95d('0x53')](_0x39de39)){return![];}return utils[_0xe95d('0x60')](undefined,_0x39de39)<_0x58c606*0x3c;}function clearPredictiveAttributes(_0x482135){if(_0x482135[_0xe95d('0x2a')]){_0x482135[_0xe95d('0x2a')]=undefined;loggerPredictive['debug'](_0x482135[_0xe95d('0x43')],_0xe95d('0x61'));}if(_0x482135['startPredictive']){_0x482135['startPredictive']=undefined;loggerPredictive[_0xe95d('0x40')](_0x482135[_0xe95d('0x43')],'startPredictive\x20value\x20cleared');}if(_0x482135[_0xe95d('0x62')]){clearInterval(_0x482135[_0xe95d('0x62')]);_0x482135['handlePredictive']=undefined;loggerPredictive[_0xe95d('0x40')](_0x482135['name'],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x1bcc5c,_0x22d353){return function(_0xba3c77){loggerPredictive[_0xe95d('0x63')](_0x22d353[_0xe95d('0x43')],_0x1bcc5c);loggerPredictive['error'](_0xba3c77['stack']);clearPredictiveAttributes(_0x22d353);};}function loggerCatch(_0x339b7b){return function(_0x5292e7){logger[_0xe95d('0x63')](_0x339b7b,util[_0xe95d('0x64')](_0x5292e7,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x27552e,_0x3ca466,_0xea95b9){return function(_0x2f02a8){utils[_0xe95d('0x65')](_0x3ca466,_0xea95b9,0x0);logger[_0xe95d('0x63')](_0x27552e,util[_0xe95d('0x64')](_0x2f02a8,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2e062a){return function(_0xa6cebe){if(isNotNull(_0xa6cebe)&&isNotNull(_0xa6cebe[0x0])){if(_0xa6cebe[0x0]['contactsRescheduled']>0x0){_0x2e062a[_0xe95d('0x66')]=utils[_0xe95d('0x67')][_0xe95d('0x68')];logger[_0xe95d('0x45')](_0xe95d('0x69')+_0x2e062a[_0xe95d('0x43')],_0xa6cebe[0x0][_0xe95d('0x6a')],_0xe95d('0x6b'));}else{_0x2e062a['message']=utils['CAMPAIGN_STATUS'][_0xe95d('0x6c')];logger[_0xe95d('0x45')](_0xe95d('0x6d')+_0x2e062a[_0xe95d('0x43')]);}}};}function createObjHistory(_0x38db4f,_0x451e67,_0x6a0c89,_0x3718f7,_0x8b5dd3){_0x38db4f['message']=_0x6a0c89;var _0x1fd7b9=new Action(_0x38db4f,_0x451e67);var _0x1cc2bf=new History(_0x1fd7b9);_0x1cc2bf['state']=_0x3718f7;_0x1cc2bf[_0xe95d('0x6e')]=_0x8b5dd3;_0x1cc2bf[_0xe95d('0x6f')]=_0x1fd7b9['starttime'];return _0x1cc2bf;}function unlockQueueStatus(_0xd35e09,_0x1d6fef){setTimeout(function(){if(_['isUndefined'](_0xd35e09[_0xe95d('0x70')])){loggerBooked[_0xe95d('0x63')](_0xe95d('0x71'),_0x1d6fef);}_0xd35e09[_0xe95d('0x70')]=!![];loggerBooked['info'](_0xe95d('0x72'),_0x1d6fef,JSON[_0xe95d('0x73')](_[_0xe95d('0x74')](_0xd35e09,[_0xe95d('0x43'),_0xe95d('0x70')])));},0x1f3);}function checkInterval(_0xf360df){return function(){if(!isNotNull(_0xf360df[_0xe95d('0x75')])){_0xf360df[_0xe95d('0x66')]=utils[_0xe95d('0x67')]['NULL_INTERVAL'];throw _0xf360df[_0xe95d('0x43')]+_0xe95d('0x76');}if(!isNotNull(_0xf360df[_0xe95d('0x75')]['Intervals'])){_0xf360df[_0xe95d('0x66')]=utils['CAMPAIGN_STATUS'][_0xe95d('0x77')];throw _0xf360df['name']+_0xe95d('0x76');}if(!isNotNull(_[_0xe95d('0x78')](_0xf360df['Interval'][_0xe95d('0x79')]))){_0xf360df['message']=utils[_0xe95d('0x67')][_0xe95d('0x77')];throw _0xf360df[_0xe95d('0x43')]+_0xe95d('0x76');}};}function checkIsIVRCampaignActive(_0x37521e){return function(){if(!utils[_0xe95d('0x7a')](_0x37521e)){_0x37521e[_0xe95d('0x66')]=utils[_0xe95d('0x67')]['INACTIVE'];throw _0x37521e[_0xe95d('0x43')]+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x33e2bd){if(utils['isIVRCampaign'](_0x33e2bd)){emit(util[_0xe95d('0x7b')]('campaign:ivr:%s',_0x33e2bd[_0xe95d('0x43')]),_0xe95d('0x7c'),_0x33e2bd);}}function loggerCatchQueueSummary(_0x12443d,_0x4d0483){return function(_0x2ba3f0){clearPredictiveAttributes(_0x4d0483);emitCampaignSummary(_0x4d0483);loggerSyncQueueSummary[_0xe95d('0x40')](_0x12443d,util[_0xe95d('0x64')](_0x2ba3f0,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x228250){if(_0x228250[_0xe95d('0x7d')]){if(_0x228250[_0xe95d('0x7e')]===0x0){_0x228250[_0xe95d('0x7d')]=![];_0x228250['message']=utils[_0xe95d('0x67')][_0xe95d('0x7f')];loggerSyncQueueSummary[_0xe95d('0x40')](_0xe95d('0x80'),_0x228250[_0xe95d('0x43')],_0xe95d('0x81'));}else{_0x228250[_0xe95d('0x66')]=utils[_0xe95d('0x67')]['DISACTIVED'];loggerSyncQueueSummary[_0xe95d('0x40')](_0xe95d('0x80'),_0x228250[_0xe95d('0x43')],'is\x20disactive');}emitCampaignSummary(_0x228250);}}function myreject(_0x21dc15){return function(_0x68db34){return _0x21dc15(msgResponse(_0xe95d('0x82'),_0xe95d('0x83'),JSON[_0xe95d('0x73')](_0x68db34)));};}Dialer[_0xe95d('0x1b')][_0xe95d('0x84')]=function(_0x402ac9){return!_['isUndefined'](_0x402ac9)&&_0x402ac9&&!_[_0xe95d('0x53')](_0x402ac9[_0xe95d('0x43')])&&!_[_0xe95d('0x53')](_0x402ac9[_0xe95d('0x85')])&&_0x402ac9['active']&&(this[_0xe95d('0x23')][util[_0xe95d('0x7b')](_0xe95d('0x86'),_0x402ac9['name'])]['status']===_0xe95d('0x87')||this[_0xe95d('0x23')][util[_0xe95d('0x7b')](_0xe95d('0x86'),_0x402ac9[_0xe95d('0x43')])][_0xe95d('0x88')]===_0xe95d('0x89'));};Dialer[_0xe95d('0x1b')][_0xe95d('0x8a')]=function(_0x5951db){var _0x425a69=this;return function(){if(!_0x425a69[_0xe95d('0x84')](_0x5951db['Trunk'])){if(!_0x425a69['isTrunkReachable'](_0x5951db[_0xe95d('0x8b')])){_0x5951db[_0xe95d('0x66')]=utils[_0xe95d('0x67')][_0xe95d('0x8c')];throw _0x5951db['name']+_0xe95d('0x8d');}}};};Dialer['prototype']['checkIfTime']=function(_0x435dbb,_0x2e03fe,_0x1a5287,_0x56fa64){var _0x53e859=this;return function(){var _0x221436=!![];return _0x53e859[_0xe95d('0x8e')](_0x435dbb,_0x2e03fe,_0x1a5287,_0x56fa64,_0x221436);};};Dialer[_0xe95d('0x1b')][_0xe95d('0x8f')]=function(_0x20f18b,_0x524a8c,_0x220dba,_0x5f596c){var _0x26e6d4=this;return function(){var _0x38ca51=![];return _0x26e6d4['ifTimeIvr'](_0x20f18b[_0xe95d('0x79')],_0x524a8c,_0x220dba,_0x5f596c,_0x38ca51);};};Dialer[_0xe95d('0x1b')][_0xe95d('0x8e')]=function(_0x21719b,_0x1dc8e3,_0x25bea6,_0xe29514,_0xbbfa61){var _0x2d211a=[];return new Promise(function(_0x4d800d,_0x3b0322){if(!isNotNull(_0x21719b)){_0xe29514[_0xe95d('0x66')]=utils[_0xe95d('0x67')][_0xe95d('0x77')];return _0x3b0322(msgResponse(_0xe95d('0x90'),'Failure',_0x25bea6+_0xe95d('0x91')));}if(_[_0xe95d('0x78')](_0x21719b)){_0xe29514[_0xe95d('0x66')]=utils['CAMPAIGN_STATUS'][_0xe95d('0x92')];return _0x3b0322(msgResponse(_0xe95d('0x90'),_0xe95d('0x93'),_0x25bea6+_0xe95d('0x94')));}if(_0x1dc8e3&&_[_0xe95d('0x53')](config[_0xe95d('0x95')][_0x1dc8e3])){_0xe29514[_0xe95d('0x66')]=utils[_0xe95d('0x67')][_0xe95d('0x96')];return _0x3b0322(msgResponse(_0xe95d('0x90'),'Failure',_0x25bea6+'\x20Timezone\x20unknow\x20'+_0x1dc8e3));}if(_[_0xe95d('0x97')](_0x21719b)){for(var _0x1a466e=0x0;_0x1a466e<_0x21719b[_0xe95d('0x98')];_0x1a466e+=0x1){_0x2d211a[_0xe95d('0x99')](ami['Action']({'action':_0xe95d('0x9a'),'command':util[_0xe95d('0x7b')](_0xe95d('0x9b'),_0x21719b[_0x1a466e][_0xe95d('0x9c')],!_[_0xe95d('0x53')](config[_0xe95d('0x95')][_0x1dc8e3])?_0x1dc8e3:'')})['then'](function(_0x4c4649){return _0x4c4649['content'][_0xe95d('0x9d')]('true')>=0x0;})['catch'](myreject(_0x3b0322)));}}else{_0x2d211a[_0xe95d('0x99')](ami['Action']({'action':_0xe95d('0x9a'),'command':util[_0xe95d('0x7b')](_0xe95d('0x9b'),_0x21719b,!_[_0xe95d('0x53')](config['timezones'][_0x1dc8e3])?_0x1dc8e3:'')})[_0xe95d('0x3e')](function(_0x5c08f4){return _0x5c08f4[_0xe95d('0x9e')][_0xe95d('0x9d')](_0xe95d('0x9f'))>=0x0;})[_0xe95d('0xa0')](myreject(_0x3b0322)));}Promise[_0xe95d('0xa1')](_0x2d211a)[_0xe95d('0x3e')](function(_0x43ffaa){var _0x5395b4=_[_0xe95d('0xa2')](_0x43ffaa);if(_0x5395b4){return _0x4d800d(_0x5395b4);}else{_0xe29514['message']=_0xbbfa61?utils['CAMPAIGN_STATUS'][_0xe95d('0xa3')]:utils['CAMPAIGN_STATUS'][_0xe95d('0xa4')];return _0x3b0322(msgResponse('[ifTime][promiseAll]','Failure','Global:\x20'+_0xbbfa61+'\x20'+_0x25bea6+_0xe95d('0xa5')+util[_0xe95d('0x64')](_0x21719b,{'showHidden':![],'depth':null})+_0xe95d('0xa6')+_0x1dc8e3));}})['catch'](function(_0x394607){return _0x3b0322(msgResponse('ifTime','Failure',JSON[_0xe95d('0x73')](_0x394607)));});});};Dialer['prototype'][_0xe95d('0xa7')]=function(){var _0x34bdce=this;return cmHopper[_0xe95d('0xa8')]({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x34bdce[_0xe95d('0xa9')]();},0x3e8);});};Dialer[_0xe95d('0x1b')][_0xe95d('0xa9')]=function(){var _0x21fac8=this;var _0x1b8470;for(var _0x44648 in this[_0xe95d('0x21')]){if(typeof this['campaigns'][_0x44648]!==_0xe95d('0xaa')){_0x1b8470=this[_0xe95d('0x21')][_0x44648];if(utils['isIVRCampaign'](_0x1b8470)&&utils['isIVRCampaignActive'](_0x1b8470)){_0x1b8470[_0xe95d('0x7d')]=!![];Promise['resolve']()[_0xe95d('0x3e')](checkIsIVRCampaignActive(_0x1b8470))['then'](checkInterval(_0x1b8470))[_0xe95d('0x3e')](_0x21fac8[_0xe95d('0x8a')](_0x1b8470))[_0xe95d('0x3e')](_0x21fac8[_0xe95d('0xab')](_0x1b8470['dialGlobalInterval'],_0x1b8470[_0xe95d('0xac')],_0x1b8470[_0xe95d('0x43')],_0x1b8470))[_0xe95d('0x3e')](_0x21fac8['checkIfTimeIntervals'](_0x1b8470[_0xe95d('0x75')],_0x1b8470[_0xe95d('0xac')],_0x1b8470[_0xe95d('0x43')],_0x1b8470))['then'](_0x21fac8[_0xe95d('0xad')](_0x1b8470))[_0xe95d('0xa0')](loggerCatchQueueSummary(_0xe95d('0xae'),_0x1b8470));}else{notSendMessagesCampaign(_0x1b8470);}}}};Dialer['prototype'][_0xe95d('0xaf')]=function(_0x18b9df){if(_0x18b9df['dialMethod']!==_0xe95d('0x9')){clearPredictiveAttributes(_0x18b9df);}switch(_0x18b9df['dialMethod']){case _0xe95d('0xb0'):this[_0xe95d('0xb1')](_0x18b9df,0x1);break;case _0xe95d('0xb2'):this[_0xe95d('0xb1')](_0x18b9df,_0x18b9df[_0xe95d('0xb3')]);break;case _0xe95d('0x9'):this[_0xe95d('0x9')](_0x18b9df);break;case _0xe95d('0x8'):this[_0xe95d('0xb1')](_0x18b9df,0x1);break;default:logger[_0xe95d('0x63')](_0xe95d('0xb4'),_0x18b9df[_0xe95d('0x43')],_0xe95d('0xb5'));}};Dialer['prototype'][_0xe95d('0x90')]=function(_0x222763,_0x23abf3){var _0x1e79c9=_0x222763[_0xe95d('0xac')];var _0xd75af5=_0x23abf3?_0x222763[_0xe95d('0xb6')]:_0x222763['Interval'][_0xe95d('0x79')];logger[_0xe95d('0xb7')](_0xe95d('0xb8'),_0xd75af5,_0x1e79c9,_0x222763['name'],util[_0xe95d('0x7b')](_0xe95d('0xb9'),_0x222763[_0xe95d('0x43')],_0x222763['id']));var _0x29dfc6=null;return Interval[_0xe95d('0xba')](_0xd75af5,_0x1e79c9)[_0xe95d('0x3e')](function(_0x96e5f9){if(_0x96e5f9===!![]){return _0x96e5f9;}else{_0x222763[_0xe95d('0x66')]=_0x23abf3?utils[_0xe95d('0x67')][_0xe95d('0xa3')]:utils['CAMPAIGN_STATUS'][_0xe95d('0xa4')];_0x29dfc6=msgResponse('[ifTime][promiseAll]',_0xe95d('0x93'),_0xe95d('0xbb')+_0x23abf3+'\x20'+_0x222763[_0xe95d('0x43')]+_0xe95d('0xa5')+util[_0xe95d('0x64')](_0xd75af5,{'showHidden':![],'depth':null})+_0xe95d('0xa6')+_0x1e79c9);}if(_0x29dfc6!==null){logger[_0xe95d('0xb7')](_0xe95d('0xbc'),_0x29dfc6);_0x29dfc6[_0xe95d('0xbd')]=_0x23abf3;throw _0x29dfc6;}})['catch'](function(_0x4fc270){logger['error']('AMI\x20IfTime',_0x4fc270);throw msgResponse('[ifTime][Action]',_0xe95d('0x83'),util['inspect'](_0x4fc270,{'showHidden':![],'depth':null}));});};Dialer[_0xe95d('0x1b')][_0xe95d('0xbe')]=function(_0x287300){if(this[_0xe95d('0x20')][_0x287300['queue']]){if(this[_0xe95d('0xbf')][_0x287300[_0xe95d('0xc0')]]&&this['uniqueId'][_0x287300['uniqueid']][_0xe95d('0xc1')]!==_0xe95d('0xc2')){this[_0xe95d('0xc3')](this[_0xe95d('0x20')][_0x287300[_0xe95d('0xc4')]]);this[_0xe95d('0xbf')][_0x287300[_0xe95d('0xc0')]]['answertime']=moment()['format'](_0xe95d('0xc5'));}}};Dialer['prototype'][_0xe95d('0x32')]=function(_0x8569ba){var _0x2a521c=this[_0xe95d('0xbf')][_0x8569ba[_0xe95d('0xc0')]];if(this['voiceQueues'][_0x8569ba[_0xe95d('0xc4')]]){if(_0x2a521c&&_0x2a521c[_0xe95d('0xc1')]!==_0xe95d('0xc2')){delete this['uniqueId'][_0x8569ba[_0xe95d('0xc0')]];this[_0xe95d('0x20')][_0x8569ba[_0xe95d('0xc4')]][_0xe95d('0xc6')]+=0x1;var _0x1e3cdc=new AgentComplete(_0x2a521c,_0x8569ba);if(_0x8569ba[_0xe95d('0xc7')]==='agent'){_0x1e3cdc[_0xe95d('0xc8')]=this[_0xe95d('0x20')][_0x8569ba[_0xe95d('0xc4')]][_0xe95d('0xc9')]&&this['voiceQueues'][_0x8569ba[_0xe95d('0xc4')]]['dialAgiAfterHangupAgent']?moment()[_0xe95d('0x7b')](_0xe95d('0xc5')):undefined;}hopperUtils['createHistory'](_0x1e3cdc)[_0xe95d('0xa0')](loggerCatch(_0xe95d('0xca')));hopperUtils[_0xe95d('0xcb')](_0x1e3cdc)[_0xe95d('0xa0')](loggerCatch(_0xe95d('0xcc')));}}};Dialer['prototype'][_0xe95d('0x2e')]=function(_0x1b26dc){var _0xbc1889=this['uniqueId'][_0x1b26dc['uniqueid']];var _0x191da7=this;var _0x4bb6cb=![];var _0x2ebd4f;var _0x4018ae;if(this[_0xe95d('0x20')][_0x1b26dc[_0xe95d('0xc4')]]){if(_0xbc1889&&_0xbc1889['type']!==_0xe95d('0xc2')){delete this[_0xe95d('0xbf')][_0x1b26dc[_0xe95d('0xc0')]];this['updateOriginated'](this['voiceQueues'][_0x1b26dc[_0xe95d('0xc4')]]);_0xbc1889[_0xe95d('0xcd')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x211115=new QueueCallerAbandon(_0xbc1889,_0x1b26dc);if(utils['getSeconds'](_0xbc1889[_0xe95d('0xcd')],_0xbc1889['responsetime'])>=_0xbc1889['dialQueueTimeout']){this[_0xe95d('0x20')][_0x1b26dc[_0xe95d('0xc4')]][_0xe95d('0x4c')]+=0x1;this['voiceQueues'][_0x1b26dc[_0xe95d('0xc4')]]['outboundDropCallsDayTimeout']+=0x1;this['voiceQueues'][_0x1b26dc[_0xe95d('0xc4')]][_0xe95d('0xce')]+=0x1;_0x211115[_0xe95d('0xcf')]=0xa;_0x211115['statedesc']=_0xe95d('0xd0');_0x211115[_0xe95d('0xd1')]=_0xe95d('0xd2');_0x211115['agiafterat']=this[_0xe95d('0x20')][_0x1b26dc['queue']][_0xe95d('0xc9')]?moment()[_0xe95d('0x7b')](_0xe95d('0xc5')):undefined;_0x211115[_0xe95d('0xd3')]+=0x1;_0x211115[_0xe95d('0xd4')]+=0x1;_0x2ebd4f=this['voiceQueues'][_0x1b26dc[_0xe95d('0xc4')]][_0xe95d('0xd5')];_0x4018ae=this[_0xe95d('0x20')][_0x1b26dc[_0xe95d('0xc4')]][_0xe95d('0xd6')];hopperUtils[_0xe95d('0xd7')](_0x211115,_0x211115[_0xe95d('0xcf')],_0xbc1889[_0xe95d('0xd8')])['then'](function(_0x2f3449){_0x4bb6cb=_0x2f3449[_0xe95d('0xd9')]==0x1;if(_0x211115['countdropretry']>=_0x191da7['voiceQueues'][_0x1b26dc[_0xe95d('0xc4')]][_0xe95d('0xda')]){_0x191da7[_0xe95d('0xdb')](_0x211115,_0x2f3449[_0xe95d('0xd9')]);}else{hopperUtils[_0xe95d('0xdc')]({'active':![],'countdropretry':_0x211115['countdropretry'],'scheduledat':moment()['add'](_0x191da7[_0xe95d('0x20')][_0x1b26dc[_0xe95d('0xc4')]][_0xe95d('0xd5')],_0xe95d('0xdd'))['format'](_0xe95d('0xc5')),'ContactId':_0xbc1889[_0xe95d('0xde')],'ListId':_0xbc1889['ListId'],'VoiceQueueId':_0xbc1889[_0xe95d('0xdf')]||undefined,'CampaignId':_0xbc1889[_0xe95d('0xe0')]||undefined})[_0xe95d('0xa0')](loggerCatch(_0xe95d('0xe1')));var _0x2e051e=new History(_0x211115);_0x2e051e[_0xe95d('0xcf')]=0xa;_0x2e051e[_0xe95d('0x6e')]='Drop';_0x2e051e['starttime']=moment()[_0xe95d('0x7b')](_0xe95d('0xc5'));_0x2e051e[_0xe95d('0x6f')]=_0x2e051e[_0xe95d('0xe2')];_0x2e051e[_0xe95d('0xe3')]=_0x211115['calleridname'];_0x2e051e[_0xe95d('0xe4')]=_0x211115['calleridnum'];hopperUtils[_0xe95d('0xe5')](_0x2e051e)[_0xe95d('0xa0')](loggerCatch(_0xe95d('0xe6')));}})[_0xe95d('0x3e')](function(){if(_0x4bb6cb)hopperUtils[_0xe95d('0xe7')](_0x211115,_0x2ebd4f,_0x4018ae)[_0xe95d('0x3e')](function(){return 0x1;});});}else{this[_0xe95d('0x20')][_0x1b26dc[_0xe95d('0xc4')]][_0xe95d('0x4e')]+=0x1;this[_0xe95d('0x20')][_0x1b26dc[_0xe95d('0xc4')]]['outboundDropCallsDayCallersExit']+=0x1;_0x211115[_0xe95d('0xcf')]=0xb;_0x211115[_0xe95d('0x6e')]=_0xe95d('0xe8');_0x211115['dropreason']=_0xe95d('0xe9');_0x211115[_0xe95d('0xea')]+=0x1;_0x211115[_0xe95d('0xd4')]+=0x1;_0x2ebd4f=this[_0xe95d('0x20')][_0x1b26dc[_0xe95d('0xc4')]][_0xe95d('0xeb')];_0x4018ae=this['voiceQueues'][_0x1b26dc[_0xe95d('0xc4')]]['callAdditionalPhoneAfterMin'];hopperUtils['verifyAdditionalPhones'](_0x211115,_0x211115[_0xe95d('0xcf')],_0xbc1889['voiceQueue'])[_0xe95d('0x3e')](function(_0x21834b){if(_0x211115[_0xe95d('0xea')]>=_0x191da7[_0xe95d('0x20')][_0x1b26dc[_0xe95d('0xc4')]][_0xe95d('0xec')]){_0x191da7[_0xe95d('0xdb')](_0x211115,_0x21834b[_0xe95d('0xd9')]);}else{hopperUtils[_0xe95d('0xdc')]({'active':![],'countabandonedretry':_0x211115[_0xe95d('0xea')],'scheduledat':moment()[_0xe95d('0xed')](_0x191da7[_0xe95d('0x20')][_0x1b26dc['queue']]['dialAbandonedRetryFrequency'],_0xe95d('0xdd'))['format'](_0xe95d('0xc5')),'ContactId':_0xbc1889[_0xe95d('0xde')],'ListId':_0xbc1889[_0xe95d('0xee')],'VoiceQueueId':_0xbc1889['VoiceQueueId']||undefined,'CampaignId':_0xbc1889[_0xe95d('0xe0')]||undefined})['catch'](loggerCatch(_0xe95d('0xef')));var _0x322629=new History(_0x211115);_0x322629[_0xe95d('0xcf')]=0xb;_0x322629['statedesc']=_0xe95d('0xe8');_0x322629[_0xe95d('0xe2')]=moment()[_0xe95d('0x7b')](_0xe95d('0xc5'));_0x322629[_0xe95d('0x6f')]=_0x322629[_0xe95d('0xe2')];_0x322629[_0xe95d('0xe3')]=_0x211115['calleridname'];_0x322629[_0xe95d('0xe4')]=_0x211115[_0xe95d('0xe4')];hopperUtils[_0xe95d('0xe5')](_0x322629)[_0xe95d('0xa0')](loggerCatch(_0xe95d('0xf0')));}})[_0xe95d('0x3e')](function(){if(_0x4bb6cb)hopperUtils['swapAdditionalPhones'](_0x211115,_0x2ebd4f,_0x4018ae)['then'](function(){return 0x1;});});}}}};Dialer[_0xe95d('0x1b')][_0xe95d('0xf1')]=function(_0x3a7902){if(this[_0xe95d('0x26')][_0x3a7902[_0xe95d('0xc0')]]){this[_0xe95d('0x26')][_0x3a7902[_0xe95d('0xc0')]][_0xe95d('0xf2')]=_0x3a7902[_0xe95d('0xf2')];}if(this[_0xe95d('0xbf')][_0x3a7902['uniqueid']]){this[_0xe95d('0xbf')][_0x3a7902['uniqueid']][_0xe95d('0xf2')]=_0x3a7902[_0xe95d('0xf2')];}};Dialer['prototype'][_0xe95d('0x39')]=function(_0x78804a){if(!this[_0xe95d('0x26')][_0x78804a[_0xe95d('0xf3')]]){return;}var _0x15d5cd=this[_0xe95d('0x20')][this['actions'][_0x78804a[_0xe95d('0xf3')]][_0xe95d('0xc4')]][_0xe95d('0xf4')]||_0xe95d('0xf5');if(_0x15d5cd==='roundrobin'){if(this[_0xe95d('0x26')][_0x78804a['actionid']]&&_[_0xe95d('0xf6')](this['actions'][_0x78804a[_0xe95d('0xf3')]][_0xe95d('0xf7')])&&_0x78804a[_0xe95d('0x88')]==='1'&&_0x78804a[_0xe95d('0xf8')]==='0'){if(this[_0xe95d('0x22')][_0x78804a['stateinterface']]){if(!this[_0xe95d('0x22')][_0x78804a[_0xe95d('0xf9')]][_0xe95d('0xf7')]){this[_0xe95d('0x22')][_0x78804a['stateinterface']][_0xe95d('0xf7')]=!![];this[_0xe95d('0x26')][_0x78804a[_0xe95d('0xf3')]]['locked']=!![];this[_0xe95d('0x26')][_0x78804a[_0xe95d('0xf3')]][_0xe95d('0xf9')]=_0x78804a['stateinterface'];}}}}else if(_0x15d5cd==='rrmemory'){if(this['actions'][_0x78804a[_0xe95d('0xf3')]]){if(this['agents'][_0x78804a[_0xe95d('0xf9')]]){this['actions'][_0x78804a[_0xe95d('0xf3')]][_0xe95d('0xf9')]=_0x78804a['stateinterface'];if(_[_0xe95d('0xf6')](this[_0xe95d('0x2b')][this['actions'][_0x78804a[_0xe95d('0xf3')]]['queue']])){this[_0xe95d('0x2b')][this[_0xe95d('0x26')][_0x78804a['actionid']][_0xe95d('0xc4')]]=[];}this['queueBooked'][this[_0xe95d('0x26')][_0x78804a[_0xe95d('0xf3')]]['queue']][_0xe95d('0x99')](_['merge'](_[_0xe95d('0x74')](this[_0xe95d('0x26')][_0x78804a['actionid']],['idHopper',_0xe95d('0xf9')]),{'status':_0x78804a['status'],'paused':_0x78804a[_0xe95d('0xf8')]}));}}}};Dialer['prototype'][_0xe95d('0x3b')]=function(_0x1a95ef){if(!this[_0xe95d('0x26')][_0x1a95ef[_0xe95d('0xf3')]]){return;}var _0x4fa344=this;var _0x4b7acf=this[_0xe95d('0x20')][this[_0xe95d('0x26')][_0x1a95ef[_0xe95d('0xf3')]][_0xe95d('0xc4')]];var _0x204166=_0x4b7acf[_0xe95d('0xf4')]||'rrmemory';if(_0x204166===_0xe95d('0xfa')){if(this[_0xe95d('0x26')][_0x1a95ef[_0xe95d('0xf3')]]&&this['actions'][_0x1a95ef[_0xe95d('0xf3')]][_0xe95d('0xf9')]){this[_0xe95d('0xfb')][_0xe95d('0xfc')](this[_0xe95d('0x26')][_0x1a95ef[_0xe95d('0xf3')]][_0xe95d('0xfd')],this['actions'][_0x1a95ef[_0xe95d('0xf3')]][_0xe95d('0xf9')])[_0xe95d('0xa0')](function(_0x21473d){logger[_0xe95d('0x63')]('[Catch][Preview][syncQueueStatusComplete]',util[_0xe95d('0x64')](_0x21473d,{'showHidden':![],'depth':null}));})[_0xe95d('0x1e')](function(){_0x4fa344['updateOriginated'](_0x4fa344[_0xe95d('0x20')][_0x4fa344['actions'][_0x1a95ef[_0xe95d('0xf3')]][_0xe95d('0xc4')]]);_0x4fa344['agents'][_0x4fa344[_0xe95d('0x26')][_0x1a95ef['actionid']][_0xe95d('0xf9')]][_0xe95d('0xf7')]=![];delete _0x4fa344[_0xe95d('0x26')][_0x1a95ef['actionid']];unlockQueueStatus(_0x4b7acf);});}else{this[_0xe95d('0xc3')](this[_0xe95d('0x20')][this[_0xe95d('0x26')][_0x1a95ef[_0xe95d('0xf3')]][_0xe95d('0xc4')]]);hopperUtils[_0xe95d('0xdc')]({'active':![],'ContactId':this[_0xe95d('0x26')][_0x1a95ef[_0xe95d('0xf3')]]['ContactId'],'ListId':this[_0xe95d('0x26')][_0x1a95ef[_0xe95d('0xf3')]][_0xe95d('0xee')],'VoiceQueueId':this[_0xe95d('0x26')][_0x1a95ef[_0xe95d('0xf3')]][_0xe95d('0xdf')]||undefined,'CampaignId':this['actions'][_0x1a95ef['actionid']]['CampaignId']||undefined})[_0xe95d('0xa0')](loggerCatch(_0xe95d('0xfe')));delete this[_0xe95d('0x26')][_0x1a95ef['actionid']];unlockQueueStatus(_0x4b7acf);}}else if(_0x204166===_0xe95d('0xf5')){var _0x3624e5;if(this[_0xe95d('0x26')][_0x1a95ef[_0xe95d('0xf3')]]&&!_[_0xe95d('0x78')](this['queueBooked'][this[_0xe95d('0x26')][_0x1a95ef['actionid']][_0xe95d('0xc4')]])){if(this[_0xe95d('0xff')][_0x4fa344[_0xe95d('0x26')][_0x1a95ef['actionid']][_0xe95d('0xc4')]]){this['queueBookedRR'][_0x4fa344[_0xe95d('0x26')][_0x1a95ef['actionid']]['queue']]=this[_0xe95d('0xff')][this[_0xe95d('0x26')][_0x1a95ef[_0xe95d('0xf3')]][_0xe95d('0xc4')]]?this[_0xe95d('0xff')][this[_0xe95d('0x26')][_0x1a95ef[_0xe95d('0xf3')]][_0xe95d('0xc4')]]:this[_0xe95d('0x2b')][this[_0xe95d('0x26')][_0x1a95ef['actionid']][_0xe95d('0xc4')]]?this[_0xe95d('0x2b')][this[_0xe95d('0x26')][_0x1a95ef['actionid']][_0xe95d('0xc4')]][_0xe95d('0x100')]||0x0:0x0;}this[_0xe95d('0x2b')][this[_0xe95d('0x26')][_0x1a95ef[_0xe95d('0xf3')]][_0xe95d('0xc4')]][_0xe95d('0x100')]=this['queueBookedRR'][this['actions'][_0x1a95ef[_0xe95d('0xf3')]][_0xe95d('0xc4')]];for(var _0x3374ba=0x0;_0x3374ba=_0x421312['dialGlobalMaxRetry']){_0x59d273[_0xe95d('0x123')](_0x45834e,_0x1c1fa2,_0x209a61,_0xe95d('0x124'));}else{if(_0x45834e[_0xe95d('0x121')]>=_0x421312[_0xe95d('0x125')]){_0x59d273[_0xe95d('0x126')](_0x45834e,_0x1c1fa2,_0x209a61,_0xe95d('0x127'));}else{hopperUtils[_0xe95d('0xdc')]({'active':![],'countmachineretry':_0x45834e['countmachineretry'],'scheduledat':moment()[_0xe95d('0xed')](_0x421312['dialMachineRetryFrequency'],'minutes')[_0xe95d('0x7b')](_0xe95d('0xc5')),'ContactId':_0x45834e['ContactId'],'ListId':_0x45834e['ListId'],'VoiceQueueId':_0x45834e[_0xe95d('0xdf')]||undefined,'CampaignId':_0x45834e[_0xe95d('0xe0')]||undefined})[_0xe95d('0xa0')](loggerCatch(_0xe95d('0x128')));_0x1c1fa2({'reschedule':0x1});}}});}if(_0x433af7[_0xe95d('0xc1')]===_0xe95d('0xc2')&&this[_0xe95d('0x21')][_0x433af7[_0xe95d('0xc4')]]['dialAMDActive']&&_0x1a3f4e[_0xe95d('0x111')]===_0xe95d('0x112')){delete this['uniqueId'][_0x1a3f4e[_0xe95d('0xc0')]];this[_0xe95d('0xc3')](this[_0xe95d('0x21')][_0x433af7[_0xe95d('0xc4')]]);_0x39ff99=new Hangup(_0x433af7,_0x1a3f4e);_0x39ff99[_0xe95d('0xcf')]=0x12;_0x39ff99[_0xe95d('0x6e')]=_0xe95d('0x114');_0x39ff99[_0xe95d('0x115')]=_0xe95d('0x116');ami[_0xe95d('0x117')]('custom:amd',ut['buildObj'](_0x39ff99,'amd'));this[_0xe95d('0x11a')](_0x39ff99,_0xe95d('0x129'),_0xe95d('0x12a'));}if(_0x433af7['type']===_0xe95d('0xc2')&&this['campaigns'][_0x433af7[_0xe95d('0xc4')]][_0xe95d('0x11c')]&&_0x1a3f4e[_0xe95d('0x111')]===_0xe95d('0x12b')){return new Promise(function(_0x50c05d,_0x38de27){delete _0x59d273[_0xe95d('0xbf')][_0x1a3f4e[_0xe95d('0xc0')]];_0x59d273[_0xe95d('0xc3')](_0x59d273[_0xe95d('0x21')][_0x433af7[_0xe95d('0xc4')]]);_0x59d273[_0xe95d('0x21')][_0x433af7[_0xe95d('0xc4')]]['outboundAnswerCallsDay']+=0x1;_0x59d273[_0xe95d('0x21')][_0x433af7['queue']][_0xe95d('0x113')]+=0x1;var _0x5ba7e9=_0x59d273[_0xe95d('0x21')][_0x433af7[_0xe95d('0xc4')]];var _0x137f3e=new Hangup(_0x433af7,_0x1a3f4e);_0x137f3e[_0xe95d('0xcf')]=0x13;_0x137f3e[_0xe95d('0x6e')]=_0xe95d('0x11d');_0x137f3e[_0xe95d('0x115')]=_0xe95d('0x116');_0x137f3e['countmachineretry']+=0x1;_0x137f3e[_0xe95d('0xd4')]+=0x1;_0x137f3e['amd']=!![];ami[_0xe95d('0x117')](_0xe95d('0x118'),ut[_0xe95d('0x119')](_0x137f3e,'amd'));hopperUtils[_0xe95d('0xe5')](_0x137f3e)['catch'](loggerCatch(_0xe95d('0x12c')));if(_0x137f3e[_0xe95d('0x11f')]+_0x137f3e[_0xe95d('0x12d')]+_0x137f3e[_0xe95d('0x120')]+_0x137f3e['countnosuchnumberretry']+_0x137f3e[_0xe95d('0xd3')]+_0x137f3e[_0xe95d('0xea')]+_0x137f3e['countmachineretry']+_0x137f3e[_0xe95d('0x122')]>=_0x5ba7e9[_0xe95d('0x12e')]){_0x59d273[_0xe95d('0x123')](_0x137f3e,_0x50c05d,_0x38de27,'reason19\x20machine....');}else{if(_0x137f3e[_0xe95d('0x121')]>=_0x5ba7e9[_0xe95d('0x125')]){_0x59d273[_0xe95d('0x126')](_0x137f3e,_0x50c05d,_0x38de27,_0xe95d('0x127'));}else{hopperUtils[_0xe95d('0xdc')]({'active':![],'countmachineretry':_0x137f3e[_0xe95d('0x121')],'scheduledat':moment()[_0xe95d('0xed')](_0x5ba7e9['dialMachineRetryFrequency'],_0xe95d('0xdd'))[_0xe95d('0x7b')](_0xe95d('0xc5')),'ContactId':_0x137f3e[_0xe95d('0xde')],'ListId':_0x137f3e[_0xe95d('0xee')],'VoiceQueueId':_0x137f3e[_0xe95d('0xdf')]||undefined,'CampaignId':_0x137f3e[_0xe95d('0xe0')]||undefined})[_0xe95d('0xa0')](loggerCatch(_0xe95d('0x128')));_0x50c05d({'reschedule':0x1});}}});}}};Dialer[_0xe95d('0x1b')]['syncHangup']=function(_0x4a087d){var _0x3cf468=this[_0xe95d('0xbf')][_0x4a087d[_0xe95d('0xc0')]];var _0x3991ab;if(_0x3cf468&&_0x3cf468[_0xe95d('0xc1')]===_0xe95d('0xc2')){delete this['uniqueId'][_0x4a087d[_0xe95d('0xc0')]];this['updateOriginated'](this[_0xe95d('0x21')][_0x3cf468[_0xe95d('0xc4')]]);this[_0xe95d('0x21')][_0x3cf468[_0xe95d('0xc4')]][_0xe95d('0x12f')]+=0x1;_0x3991ab=new Hangup(_0x3cf468,_0x4a087d);hopperUtils[_0xe95d('0xe5')](_0x3991ab)[_0xe95d('0xa0')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0xe95d('0xcb')](_0x3991ab)[_0xe95d('0xa0')](loggerCatch('[syncHangupIvr]'));}if(_0x3cf468&&_0x3cf468[_0xe95d('0xc1')]!==_0xe95d('0xc2')&&isNotNull(this[_0xe95d('0x20')][_0x3cf468['queue']][_0xe95d('0x130')])){delete this['uniqueId'][_0x4a087d[_0xe95d('0xc0')]];this[_0xe95d('0xc3')](this[_0xe95d('0x20')][_0x3cf468[_0xe95d('0xc4')]]);this[_0xe95d('0x20')][_0x3cf468[_0xe95d('0xc4')]]['outboundAnswerCallsDay']+=0x1;this[_0xe95d('0x20')][_0x3cf468[_0xe95d('0xc4')]][_0xe95d('0x113')]+=0x1;_0x3991ab=new Hangup(_0x3cf468,_0x4a087d);_0x3991ab[_0xe95d('0xcf')]=0x10;_0x3991ab[_0xe95d('0x6e')]=_0xe95d('0x131');_0x3991ab[_0xe95d('0x115')]=_0xe95d('0x132');hopperUtils[_0xe95d('0xe5')](_0x3991ab)['catch'](loggerCatch(_0xe95d('0x133')));hopperUtils['moveContactManagedDialer'](_0x3991ab)[_0xe95d('0xa0')](loggerCatch('[syncHangupIvr]'));}if(_0x3cf468&&_0x3cf468[_0xe95d('0xc1')]!==_0xe95d('0xc2')&&!isNotNull(this[_0xe95d('0x20')][_0x3cf468[_0xe95d('0xc4')]][_0xe95d('0x130')])){delete this[_0xe95d('0xbf')][_0x4a087d[_0xe95d('0xc0')]];this[_0xe95d('0xc3')](this[_0xe95d('0x20')][_0x3cf468[_0xe95d('0xc4')]]);this['voiceQueues'][_0x3cf468['queue']]['outboundUnknownCallsDay']+=0x1;_0x3991ab=new Hangup(_0x3cf468,_0x4a087d);_0x3991ab[_0xe95d('0xcf')]=0xc;_0x3991ab[_0xe95d('0x6e')]=_0x4a087d[_0xe95d('0x134')];_0x3991ab[_0xe95d('0x115')]='Unknow';hopperUtils[_0xe95d('0xe5')](_0x3991ab)[_0xe95d('0xa0')](loggerCatch(_0xe95d('0x133')));hopperUtils['moveContactManagedDialer'](_0x3991ab)['catch'](loggerCatch(_0xe95d('0x135')));}};Dialer[_0xe95d('0x1b')][_0xe95d('0xb')]=function(_0x18bb2a){var _0x10b63f=this;if(!_0x10b63f[_0xe95d('0x2c')][_0x18bb2a['name']]){_0x10b63f[_0xe95d('0x2c')][_0x18bb2a[_0xe95d('0x43')]]={'running':![]};}else if(_0x10b63f[_0xe95d('0x2c')][_0x18bb2a['name']][_0xe95d('0x136')]===!![]){return;}else if(_0x10b63f['queuesSummary'][_0x18bb2a['name']][_0xe95d('0x136')]===![]){_0x10b63f[_0xe95d('0x2c')][_0x18bb2a[_0xe95d('0x43')]]['running']=!![];}var _0x248e77=_0x10b63f[_0xe95d('0x20')][_0x18bb2a[_0xe95d('0x43')]];var _0x3462d9=_0x248e77[_0xe95d('0x66')]!==utils[_0xe95d('0x67')][_0xe95d('0x7f')];var _0x3b9df7=utils[_0xe95d('0x137')](_0x248e77);_0x248e77[_0xe95d('0x138')]=utils[_0xe95d('0x139')](_0x248e77,_0x10b63f['trunks']);Promise['resolve']()[_0xe95d('0x3e')](function(){if(_0x248e77[_0xe95d('0x138')]===utils[_0xe95d('0x67')][_0xe95d('0x7f')]){if(_0x3462d9){clearPredictiveAttributes(_0x248e77);_0x18bb2a[_0xe95d('0x29')]=undefined;_0x18bb2a['startProgressive']=undefined;}if(_0x248e77[_0xe95d('0x138')]===utils['CAMPAIGN_STATUS'][_0xe95d('0x7f')]){_0x18bb2a[_0xe95d('0x13a')]=0x0;_0x18bb2a['paused']=0x0;_0x18bb2a[_0xe95d('0x13b')]=0x0;_0x18bb2a['talking']=0x0;_0x18bb2a[_0xe95d('0x13c')]=0x0;}}else if(_0x248e77[_0xe95d('0x138')]===utils[_0xe95d('0x67')][_0xe95d('0x13d')]&&!_0x3b9df7){return _0x10b63f[_0xe95d('0x90')](_0x248e77,!![])[_0xe95d('0x3e')](function(){return _0x10b63f['ifTime'](_0x248e77,![]);})[_0xe95d('0x3e')](function(){return _0x10b63f['checkDialMethod'](_0x248e77);})[_0xe95d('0xa0')](function(_0x568ae2){loggerSyncQueueSummary[_0xe95d('0x40')](_0xe95d('0x13e'),util[_0xe95d('0x64')](_0x568ae2,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x248e77);});}else{clearPredictiveAttributes(_0x248e77);}})['then'](function(){var _0x5b2f3e=_0x18bb2a[_0xe95d('0x13f')](_0x248e77);if(_0x5b2f3e||_0x248e77[_0xe95d('0x140')]){_0x248e77[_0xe95d('0x140')]=![];_0x18bb2a[_0xe95d('0x141')](_0x248e77);Object[_0xe95d('0x142')](_0x248e77,_0x18bb2a);emitOutboundVoiceQueueSummary(_0x18bb2a);}_0x10b63f[_0xe95d('0x2c')][_0x248e77[_0xe95d('0x43')]][_0xe95d('0x136')]=![];})['catch'](function(_0x37fc21){logger[_0xe95d('0x63')](_0xe95d('0x13e'),util[_0xe95d('0x64')](_0x37fc21,{'showHidden':![],'depth':null}));_0x10b63f['queuesSummary'][_0x248e77[_0xe95d('0x43')]][_0xe95d('0x136')]=![];});};Dialer['prototype'][_0xe95d('0x34')]=_['throttle'](function(){var _0x14d538=_[_0xe95d('0x143')](this['voiceQueues'],function(_0x3d6942){return _0x3d6942[_0xe95d('0x144')];});var _0x581c7e=_[_0xe95d('0x143')](this[_0xe95d('0x22')],function(_0x60a62d){return _0x60a62d[_0xe95d('0x145')]&&_0x60a62d[_0xe95d('0x88')]===_0xe95d('0x87');});if(_0x14d538[_0xe95d('0x98')]>0x0&&_0x581c7e[_0xe95d('0x98')]>0x0){return Promise[_0xe95d('0x146')]()[_0xe95d('0x3e')](cmHopper[_0xe95d('0x147')](_[_0xe95d('0x148')](_0x14d538,'id'),previewRecallmeReminderInterval,_[_0xe95d('0x148')](_0x581c7e,'id')))[_0xe95d('0x3e')](function(_0x1e667b){for(var _0x2ce710=0x0;_0x2ce710<_0x1e667b[_0xe95d('0x98')];_0x2ce710++){var _0x1d007f=_0x1e667b[_0x2ce710][_0xe95d('0x149')]['name'];if(_0x1d007f)io['to'](util[_0xe95d('0x7b')](_0xe95d('0x14a'),_0x1d007f))[_0xe95d('0x117')]('user:dialPreviewRecallReminder',{'hopper':_0x1e667b[_0x2ce710]});}})['catch'](function(_0x182f56){logger[_0xe95d('0x63')](_0xe95d('0x14b'),_0x182f56);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xe95d('0x1b')][_0xe95d('0x3c')]=function(){var _0x31002a=this;setInterval(function(){_0x31002a['clearZombieChannels'](_0x31002a[_0xe95d('0xbf')],_0xe95d('0x14c'));_0x31002a[_0xe95d('0x14d')](_0x31002a['actions'],_0xe95d('0x14e'));},0x32c8);};Dialer[_0xe95d('0x1b')][_0xe95d('0x14d')]=function(_0x32336e,_0x13b7fe){var _0x2655c3=this;for(var _0xacc90d in _0x32336e){if(typeof _0x32336e[_0xacc90d]!==_0xe95d('0xaa')){this[_0xe95d('0x1f')][_0xe95d('0x1c')](function(){if(!_[_0xe95d('0xf6')](_0x32336e[_0xacc90d])){return ami[_0xe95d('0x14f')]({'action':_0xe95d('0x88'),'channel':_0x32336e[_0xacc90d][_0xe95d('0xf2')]})[_0xe95d('0xa0')](function(_0x5832b2){if(_0x5832b2[_0xe95d('0x66')]===_0xe95d('0x150')){setTimeout(function(){if(_0x32336e[_0xacc90d]&&_0x32336e[_0xacc90d][_0xe95d('0xc1')]!==_0xe95d('0xc2')){_0x2655c3[_0xe95d('0xc3')](_0x2655c3[_0xe95d('0x20')][_0x32336e[_0xacc90d][_0xe95d('0xc4')]]);logger['error'](_0xe95d('0x151'),_0x13b7fe,_0xacc90d,_0x32336e[_0xacc90d][_0xe95d('0xc4')]);delete _0x32336e[_0xacc90d];}if(_0x32336e[_0xacc90d]&&_0x32336e[_0xacc90d][_0xe95d('0xc1')]===_0xe95d('0xc2')){_0x2655c3['updateOriginated'](_0x2655c3[_0xe95d('0x21')][_0x32336e[_0xacc90d]['queue']]);logger[_0xe95d('0x63')](_0xe95d('0x152'),_0x13b7fe,_0xacc90d,_0x32336e[_0xacc90d][_0xe95d('0xc4')]);delete _0x32336e[_0xacc90d];}},0x2328);}});}});}}};Dialer['prototype'][_0xe95d('0x153')]=function(_0x49faae){return Promise[_0xe95d('0x146')]()[_0xe95d('0x3e')](voiceQueueRt[_0xe95d('0x153')](_0x49faae))[_0xe95d('0xa0')](loggerCatch(_0xe95d('0x154')));};Dialer[_0xe95d('0x1b')]['updateOriginated']=function(_0x2c8145){if(!_[_0xe95d('0x53')](_0x2c8145)&&_0x2c8145!==null){if(typeof _0x2c8145[_0xe95d('0x7e')]!=='undefined'){if(_0x2c8145['originated']>0x0){_0x2c8145[_0xe95d('0x7e')]-=0x1;}else{logger[_0xe95d('0x63')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xe95d('0x63')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer['prototype']['loggerHandler']=function(_0x34d6ba,_0x3c6c8a){var _0x4be722=this;return function(_0x134298){_0x4be722[_0xe95d('0xc3')](_0x3c6c8a);logger[_0xe95d('0x63')](_0x34d6ba,util[_0xe95d('0x64')](_0x134298,{'showHidden':![],'depth':null}));};};Dialer['prototype']['emptyContact']=function(_0x41e382,_0x2e5a7e,_0x2c66e1){var _0xdc8d7={'state':0x19,'statedesc':_0xe95d('0x155')};this[_0xe95d('0xc3')](_0x2e5a7e);this[_0xe95d('0x11a')](_[_0xe95d('0x156')](_0xdc8d7,_[_0xe95d('0x74')](_0x2c66e1,['ContactId','ListId',_0xe95d('0x157'),_0xe95d('0xdf'),_0xe95d('0xe0')])),_0xe95d('0x158'),_0xe95d('0x159'));logger[_0xe95d('0x63')](_0x41e382);};Dialer[_0xe95d('0x1b')]['saveInDb']=function(_0x477082,_0x4fd110,_0x28551c){hopperUtils[_0xe95d('0xe5')](_0x477082)[_0xe95d('0xa0')](loggerCatch(_0x4fd110));hopperUtils['moveContactManagedDialer'](_0x477082)[_0xe95d('0xa0')](loggerCatch(_0x28551c));};Dialer[_0xe95d('0x1b')][_0xe95d('0xdb')]=function(_0x4fc68d,_0x585f9a){hopperUtils[_0xe95d('0xe5')](_0x4fc68d)[_0xe95d('0xa0')](loggerCatch(_0xe95d('0xca')));if(_0x585f9a==0x0){hopperUtils[_0xe95d('0xcb')](_0x4fc68d)['catch'](loggerCatch(_0xe95d('0x15a')));}};Dialer[_0xe95d('0x1b')][_0xe95d('0x14b')]=function(_0x8d0501){return Promise[_0xe95d('0x146')]()[_0xe95d('0x3e')](cmHopper['handlePreviewRecallNotifications'](_0x8d0501['id'],previewRecallmeReminderInterval))[_0xe95d('0x3e')](function(_0x595189){for(var _0x58eb18=0x0;_0x58eb18<_0x595189[_0xe95d('0x98')];_0x58eb18++){var _0x476164=_0x595189[_0x58eb18][_0xe95d('0x149')][_0xe95d('0x43')];if(_0x476164)io['to'](util[_0xe95d('0x7b')](_0xe95d('0x14a'),_0x476164))[_0xe95d('0x117')](_0xe95d('0x15b'),{'hopper':_0x595189[_0x58eb18]});}})[_0xe95d('0xa0')](function(){});};Dialer[_0xe95d('0x1b')][_0xe95d('0xad')]=function(_0x437eab){var _0x2ed035=this;return function(){_0x2ed035[_0xe95d('0x15c')](_0x437eab);};};Dialer[_0xe95d('0x1b')][_0xe95d('0x15d')]=function(_0x2e2a6b,_0x1e57a2){var _0x48b5cf=this;var _0x180fab=uuid['v4']();this[_0xe95d('0x26')][_0x180fab]=new Action(_0x2e2a6b,_0x1e57a2,_0x180fab);return new Promise(function(_0x218cee,_0x832140){if(_[_0xe95d('0x53')](_0x2e2a6b)&&typeof _0x2e2a6b!==_0xe95d('0x15e')){return _0x832140(msgResponse(_0xe95d('0x15f'),'Failure','voiceQueue\x20is\x20undefine'));}if(_[_0xe95d('0x53')](_0x1e57a2['phone'])||_0x1e57a2[_0xe95d('0x160')]===null){return _0x832140(msgResponse(_0xe95d('0x15f'),_0xe95d('0x93'),'contact\x20is\x20undefine'));}var _0x3da7a4={'XMD-CALLERID':_0x48b5cf[_0xe95d('0x26')][_0x180fab]['getCaller'](),'XMD-AGI':_0x2e2a6b['dialQueueProject']?util[_0xe95d('0x7b')](_0xe95d('0x161'),ipAgi,_0x2e2a6b[_0xe95d('0x130')]):_0xe95d('0x162'),'XMD-AGIAFTER':_0x2e2a6b[_0xe95d('0xc9')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x2e2a6b['dialQueueProject2']):_0xe95d('0x162'),'XMD-QUEUE':utils[_0xe95d('0x163')](_0x2e2a6b)?util[_0xe95d('0x7b')](_0xe95d('0x164'),_0x2e2a6b[_0xe95d('0x43')],_0x2e2a6b[_0xe95d('0x165')]||'',_0x2e2a6b[_0xe95d('0x166')]?'c':'',_0x2e2a6b[_0xe95d('0x167')]||0x3):_0xe95d('0x162'),'XMD-CONTACTID':_0x1e57a2[_0xe95d('0xde')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x48b5cf[_0xe95d('0x26')][_0x180fab][_0xe95d('0x168')](),'XMD-AMD':_0x2e2a6b[_0xe95d('0x11c')]?'ACTIVE':_0xe95d('0x162'),'XMD-DESTINATION':_0xe95d('0x169')};if(_0x2e2a6b[_0xe95d('0x11c')]){_0x3da7a4[_0xe95d('0x16a')]=_0x2e2a6b['dialAMDInitialSilence']||0x9c4;_0x3da7a4[_0xe95d('0x16b')]=_0x2e2a6b[_0xe95d('0x16c')]||0x5dc;_0x3da7a4[_0xe95d('0x16d')]=_0x2e2a6b['dialAMDAfterGreetingSilence']||0x320;_0x3da7a4[_0xe95d('0x16e')]=_0x2e2a6b[_0xe95d('0x16f')]||0x1388;_0x3da7a4[_0xe95d('0x170')]=_0x2e2a6b[_0xe95d('0x171')]||0x64;_0x3da7a4[_0xe95d('0x172')]=_0x2e2a6b[_0xe95d('0x173')]||0x32;_0x3da7a4['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x2e2a6b[_0xe95d('0x174')]||0x3;_0x3da7a4[_0xe95d('0x175')]=_0x2e2a6b['dialAMDSilenceThreshold']||0x100;_0x3da7a4['XMD-AMDMAXIMUMWORDLENGTH']=_0x2e2a6b[_0xe95d('0x176')]||0x1388;}if(utils[_0xe95d('0x163')](_0x2e2a6b)){_0x3da7a4['XMD-VOICEQUEUEID']=_0x1e57a2[_0xe95d('0xdf')];}else{_0x3da7a4[_0xe95d('0x177')]=_0x1e57a2[_0xe95d('0xe0')];}var _0x30e7a1=utils['setXMDContactVariables'](_0x1e57a2['Contact']);Object[_0xe95d('0x142')](_0x3da7a4,_0x30e7a1);var _0x1dd994=_0x48b5cf[_0xe95d('0x84')](_0x2e2a6b[_0xe95d('0x178')])?utils[_0xe95d('0x179')](_0x2e2a6b[_0xe95d('0x178')]['callerid'],_0x2e2a6b[_0xe95d('0x17a')],_0x2e2a6b[_0xe95d('0x17b')]>0x0?utils[_0xe95d('0x17c')](_0x2e2a6b[_0xe95d('0x17d')],_0x2e2a6b['dialRandomLastDigitCallerIdNumber']):_0x2e2a6b[_0xe95d('0x17d')]):utils[_0xe95d('0x179')](_[_0xe95d('0xf6')](_0x2e2a6b[_0xe95d('0x8b')])?_0x2e2a6b[_0xe95d('0x178')][_0xe95d('0x17e')]:_0x2e2a6b['TrunkBackup']['callerid'],_0x2e2a6b[_0xe95d('0x17a')],_0x2e2a6b['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0xe95d('0x17c')](_0x2e2a6b[_0xe95d('0x17d')],_0x2e2a6b[_0xe95d('0x17b')]):_0x2e2a6b['dialOriginateCallerIdNumber']);if(_0x1dd994){_0x3da7a4['XMD-ORIGINATECALLERIDNAME']=_0x48b5cf['actions'][_0x180fab][_0xe95d('0x17f')]=utils['extractCalleridName'](_0x1dd994);_0x3da7a4[_0xe95d('0x180')]=_0x1e57a2[_0xe95d('0x160')];}_0x2e2a6b[_0xe95d('0x181')]=_0x3da7a4;return ami['Action']({'actionid':_0x180fab,'action':_0xe95d('0x15f'),'channel':_0x48b5cf[_0xe95d('0x84')](_0x2e2a6b[_0xe95d('0x178')])?util['format']('SIP/%s/%s%s',_0x2e2a6b['Trunk'][_0xe95d('0x43')],isNotNull(_0x2e2a6b[_0xe95d('0x182')])?_0x2e2a6b['dialPrefix'][_0xe95d('0x183')]()||'':'',_0x2e2a6b[_0xe95d('0x184')]>0x0?_0x1e57a2[_0xe95d('0x160')][_0xe95d('0x185')](_0x2e2a6b[_0xe95d('0x184')]):_0x1e57a2[_0xe95d('0x160')]):util[_0xe95d('0x7b')](_0xe95d('0x186'),_[_0xe95d('0xf6')](_0x2e2a6b['TrunkBackup'])?_0x2e2a6b['Trunk'][_0xe95d('0x43')]:_0x2e2a6b[_0xe95d('0x8b')]['name'],isNotNull(_0x2e2a6b[_0xe95d('0x182')])?_0x2e2a6b['dialPrefix'][_0xe95d('0x183')]()||'':'',_0x2e2a6b[_0xe95d('0x184')]>0x0?_0x1e57a2[_0xe95d('0x160')][_0xe95d('0x185')](_0x2e2a6b['dialCutDigit']):_0x1e57a2[_0xe95d('0x160')]),'callerid':_0x1dd994,'Exten':'xcally-motion-dialer','Context':'from-sip','Priority':'1','variable':_0x3da7a4,'timeout':(_0x2e2a6b['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x180fab})['then'](function(_0x1c978b){return _0x218cee(_0x1c978b);})['catch'](function(_0x3614dc){_0x2e2a6b[_0xe95d('0x187')]+=0x1;var _0x5e173c=new History(_0x48b5cf[_0xe95d('0x26')][_0x180fab]);logger[_0xe95d('0x63')](util[_0xe95d('0x7b')](_0xe95d('0x188'),JSON[_0xe95d('0x73')](_0x3614dc)));_0x5e173c[_0xe95d('0xcf')]=0xe;_0x5e173c[_0xe95d('0x6e')]=_0xe95d('0x189');_0x5e173c[_0xe95d('0xe2')]=moment()['format'](_0xe95d('0xc5'));_0x5e173c[_0xe95d('0x6f')]=_0x5e173c[_0xe95d('0xe2')];hopperUtils[_0xe95d('0xe5')](_0x5e173c)['catch'](loggerCatch(_0xe95d('0x18a')));_0x48b5cf[_0xe95d('0xcb')](_0x5e173c)['catch'](loggerCatch('[originate][error]'))[_0xe95d('0x1e')](function(){delete _0x48b5cf[_0xe95d('0x26')][_0x180fab];return _0x832140(msgResponse('originate',_0xe95d('0x83'),_0xe95d('0x18b')));});});});};Dialer[_0xe95d('0x1b')][_0xe95d('0x18c')]=function(_0x51ab67,_0x36083c,_0x278475){var _0x3f2ee6=new History(_0x36083c);if(_0x3f2ee6[_0xe95d('0x11f')]+_0x3f2ee6[_0xe95d('0x12d')]+_0x3f2ee6['countnoanswerretry']+_0x3f2ee6[_0xe95d('0x18d')]+_0x3f2ee6[_0xe95d('0xd3')]+_0x3f2ee6['countabandonedretry']+_0x3f2ee6[_0xe95d('0x121')]+_0x3f2ee6[_0xe95d('0x122')]>=_0x278475['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x51ab67){case 0x3:if(_0x3f2ee6['countnoanswerretry']>=_0x278475[_0xe95d('0x18e')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x3f2ee6['countnoanswerretry']+=0x1,'scheduledat':moment()[_0xe95d('0xed')](_0x278475[_0xe95d('0x18f')],_0xe95d('0xdd'))[_0xe95d('0x7b')](_0xe95d('0xc5')),'ContactId':_0x3f2ee6[_0xe95d('0xde')],'ListId':_0x3f2ee6[_0xe95d('0xee')],'VoiceQueueId':_0x3f2ee6[_0xe95d('0xdf')]||undefined,'CampaignId':_0x3f2ee6[_0xe95d('0xe0')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x3f2ee6['countbusyretry']>=_0x278475[_0xe95d('0x190')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x3f2ee6[_0xe95d('0x11f')]+=0x1,'scheduledat':moment()[_0xe95d('0xed')](_0x278475[_0xe95d('0x191')],_0xe95d('0xdd'))[_0xe95d('0x7b')](_0xe95d('0xc5')),'ContactId':_0x3f2ee6[_0xe95d('0xde')],'ListId':_0x3f2ee6[_0xe95d('0xee')],'VoiceQueueId':_0x3f2ee6[_0xe95d('0xdf')]||undefined,'CampaignId':_0x3f2ee6['CampaignId']||undefined})[_0xe95d('0xa0')](loggerCatch(_0xe95d('0x192')));break;case 0x8:if(_0x3f2ee6[_0xe95d('0x12d')]>=_0x278475[_0xe95d('0x193')]-0x1){return!![];}hopperUtils[_0xe95d('0xdc')]({'active':![],'countcongestionretry':_0x3f2ee6[_0xe95d('0x12d')]+=0x1,'scheduledat':moment()[_0xe95d('0xed')](_0x278475[_0xe95d('0x194')],_0xe95d('0xdd'))['format'](_0xe95d('0xc5')),'ContactId':_0x3f2ee6['ContactId'],'ListId':_0x3f2ee6[_0xe95d('0xee')],'VoiceQueueId':_0x3f2ee6['VoiceQueueId']||undefined,'CampaignId':_0x3f2ee6[_0xe95d('0xe0')]||undefined})['catch'](loggerCatch(_0xe95d('0x195')));break;case 0x0:if(_0x3f2ee6['countnosuchnumberretry']>=_0x278475[_0xe95d('0x196')]-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x3f2ee6[_0xe95d('0x18d')]+=0x1,'scheduledat':moment()['add'](_0x278475[_0xe95d('0x197')],'minutes')[_0xe95d('0x7b')](_0xe95d('0xc5')),'ContactId':_0x3f2ee6[_0xe95d('0xde')],'ListId':_0x3f2ee6[_0xe95d('0xee')],'VoiceQueueId':_0x3f2ee6[_0xe95d('0xdf')]||undefined,'CampaignId':_0x3f2ee6['CampaignId']||undefined})[_0xe95d('0xa0')](loggerCatch(_0xe95d('0x198')));}break;case 0xa:if(_0x3f2ee6[_0xe95d('0xd3')]>=_0x278475['dialDropMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x3f2ee6[_0xe95d('0xd3')]+=0x1,'scheduledat':moment()['add'](_0x278475['dialDropRetryFrequency'],_0xe95d('0xdd'))[_0xe95d('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3f2ee6[_0xe95d('0xde')],'ListId':_0x3f2ee6[_0xe95d('0xee')],'VoiceQueueId':_0x3f2ee6[_0xe95d('0xdf')]||undefined,'CampaignId':_0x3f2ee6[_0xe95d('0xe0')]||undefined})[_0xe95d('0xa0')](loggerCatch(_0xe95d('0xe1')));break;case 0xb:if(_0x3f2ee6[_0xe95d('0xea')]>=_0x278475[_0xe95d('0xec')]-0x1){return!![];}hopperUtils[_0xe95d('0xdc')]({'active':![],'countabandonedretry':_0x3f2ee6['countabandonedretry']+=0x1,'scheduledat':moment()[_0xe95d('0xed')](_0x278475['dialAbandonedRetryFrequency'],'minutes')['format'](_0xe95d('0xc5')),'ContactId':_0x3f2ee6[_0xe95d('0xde')],'ListId':_0x3f2ee6[_0xe95d('0xee')],'VoiceQueueId':_0x3f2ee6[_0xe95d('0xdf')]||undefined,'CampaignId':_0x3f2ee6['CampaignId']||undefined})['catch'](loggerCatch(_0xe95d('0xef')));break;case 0x13:if(_0x3f2ee6[_0xe95d('0x121')]>=_0x278475[_0xe95d('0x125')]-0x1){return!![];}hopperUtils[_0xe95d('0xdc')]({'active':![],'countmachineretry':_0x3f2ee6[_0xe95d('0x121')]+=0x1,'scheduledat':moment()[_0xe95d('0xed')](_0x278475[_0xe95d('0x199')],_0xe95d('0xdd'))[_0xe95d('0x7b')](_0xe95d('0xc5')),'ContactId':_0x3f2ee6['ContactId'],'ListId':_0x3f2ee6[_0xe95d('0xee')],'VoiceQueueId':_0x3f2ee6[_0xe95d('0xdf')]||undefined,'CampaignId':_0x3f2ee6['CampaignId']||undefined})[_0xe95d('0xa0')](loggerCatch(_0xe95d('0x128')));break;case 0x14:if(_0x3f2ee6[_0xe95d('0x122')]>=_0x278475['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0x3f2ee6['countagentrejectretry']+=0x1,'scheduledat':moment()[_0xe95d('0xed')](_0x278475[_0xe95d('0x19a')],_0xe95d('0xdd'))[_0xe95d('0x7b')](_0xe95d('0xc5')),'ContactId':_0x3f2ee6[_0xe95d('0xde')],'ListId':_0x3f2ee6[_0xe95d('0xee')],'VoiceQueueId':_0x3f2ee6['VoiceQueueId']||undefined,'CampaignId':_0x3f2ee6['CampaignId']||undefined})['catch'](loggerCatch(_0xe95d('0x19b')));break;default:return!![];}};Dialer['prototype'][_0xe95d('0x10d')]=function(_0x3dd3b2,_0x3e369a,_0x18caa5){var _0x2c1cb5=this;var _0x4d1c83=new History(_0x3dd3b2);var _0xdfbe39=![];var _0x404bbd;var _0x1d559a;return new Promise(function(_0x1cc2b3,_0x321d64){if(_['isUndefined'](_0x3e369a)&&typeof _0x3e369a!=='object'){return _0x321d64(msgResponse(_0xe95d('0x19c'),_0xe95d('0x93'),_0xe95d('0x19d')));}if(_[_0xe95d('0x53')](_0x18caa5)&&typeof _0x18caa5!==_0xe95d('0x15e')){return _0x321d64(msgResponse(_0xe95d('0x19c'),'Failure',_0xe95d('0x19e')));}hopperUtils[_0xe95d('0xd7')](_0x4d1c83,_0x18caa5['reason'],_0x3e369a)[_0xe95d('0x3e')](function(_0x1ddbef){if(_0x1ddbef[_0xe95d('0xd9')]==0x1)_0xdfbe39=!![];switch(_0x18caa5['reason']){case'0':_0x3e369a[_0xe95d('0x19f')]+=0x1;_0x4d1c83[_0xe95d('0xcf')]=0x0;_0x4d1c83[_0xe95d('0x6e')]=_0xe95d('0x1a0');_0x4d1c83[_0xe95d('0x18d')]+=0x1;_0x4d1c83[_0xe95d('0xd4')]+=0x1;ami['emit'](_0xe95d('0x1a1'),ut[_0xe95d('0x119')](_0x3dd3b2,_0xe95d('0x1a2')));_0x404bbd=_0x3e369a[_0xe95d('0x197')];_0x1d559a=_0x3e369a[_0xe95d('0xd6')];hopperUtils[_0xe95d('0xe5')](_0x4d1c83)[_0xe95d('0xa0')](loggerCatch(_0xe95d('0x12c')));if(_0x2c1cb5[_0xe95d('0x18c')](0x0,_0x3dd3b2,_0x3e369a)&&!_0xdfbe39){if(_0x4d1c83[_0xe95d('0x18d')]>=_0x3e369a[_0xe95d('0x196')]){_0x2c1cb5[_0xe95d('0x126')](_0x4d1c83,_0x1cc2b3,_0x321d64,_0xe95d('0x1a3'));}else{_0x2c1cb5[_0xe95d('0x123')](_0x4d1c83,_0x1cc2b3,_0x321d64,_0xe95d('0x1a3'));}}break;case'3':_0x3e369a['outboundNoAnswerCallsDay']+=0x1;_0x4d1c83['state']=0x3;_0x4d1c83[_0xe95d('0x6e')]=_0xe95d('0x1a4');_0x4d1c83['countnoanswerretry']+=0x1;_0x4d1c83[_0xe95d('0xd4')]+=0x1;var _0x2555e1=ut[_0xe95d('0x1a5')](_0x3dd3b2,_0x3e369a);ami[_0xe95d('0x117')](_0xe95d('0x1a6'),_0x2555e1);_0x404bbd=_0x3e369a[_0xe95d('0x18f')];_0x1d559a=_0x3e369a[_0xe95d('0xd6')];hopperUtils['createHistory'](_0x4d1c83)[_0xe95d('0xa0')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x2c1cb5[_0xe95d('0x18c')](0x3,_0x3dd3b2,_0x3e369a)&&!_0xdfbe39){if(_0x4d1c83[_0xe95d('0x120')]>=_0x3e369a['dialNoAnswerMaxRetry']){_0x2c1cb5[_0xe95d('0x126')](_0x4d1c83,_0x1cc2b3,_0x321d64,_0xe95d('0x1a7'));}else{_0x2c1cb5[_0xe95d('0x123')](_0x4d1c83,_0x1cc2b3,_0x321d64,_0xe95d('0x1a7'));}}break;case'5':_0x3e369a[_0xe95d('0x1a8')]+=0x1;_0x4d1c83[_0xe95d('0xcf')]=0x5;_0x4d1c83[_0xe95d('0x6e')]=_0xe95d('0x1a9');_0x4d1c83['countbusyretry']+=0x1;_0x4d1c83[_0xe95d('0xd4')]+=0x1;ami[_0xe95d('0x117')](_0xe95d('0x1aa'),ut[_0xe95d('0x119')](_0x3dd3b2,'busy'));_0x404bbd=_0x3e369a['dialBusyRetryFrequency'];_0x1d559a=_0x3e369a['callAdditionalPhoneAfterMin'];hopperUtils[_0xe95d('0xe5')](_0x4d1c83)['catch'](loggerCatch(_0xe95d('0x1ab')));if(_0x2c1cb5[_0xe95d('0x18c')](0x5,_0x3dd3b2,_0x3e369a)&&!_0xdfbe39){if(_0x4d1c83[_0xe95d('0x11f')]>=_0x3e369a[_0xe95d('0x190')]){_0x2c1cb5['createStateFinal'](_0x4d1c83,_0x1cc2b3,_0x321d64,_0xe95d('0x1ac'));}else{_0x2c1cb5[_0xe95d('0x123')](_0x4d1c83,_0x1cc2b3,_0x321d64,'reason\x205\x20busy');}}break;case'8':_0x3e369a[_0xe95d('0x1ad')]+=0x1;_0x4d1c83['state']=0x8;_0x4d1c83[_0xe95d('0x6e')]=_0xe95d('0x1ae');_0x4d1c83[_0xe95d('0x12d')]+=0x1;_0x4d1c83[_0xe95d('0xd4')]+=0x1;_0x404bbd=_0x3e369a[_0xe95d('0x194')];_0x1d559a=_0x3e369a[_0xe95d('0xd6')];ami[_0xe95d('0x117')](_0xe95d('0x1af'),ut[_0xe95d('0x119')](_0x3dd3b2,_0xe95d('0x1b0')));hopperUtils[_0xe95d('0xe5')](_0x4d1c83)[_0xe95d('0xa0')](loggerCatch(_0xe95d('0x1b1')));if(_0x2c1cb5[_0xe95d('0x18c')](0x8,_0x3dd3b2,_0x3e369a)&&!_0xdfbe39){if(_0x4d1c83[_0xe95d('0x12d')]>=_0x3e369a[_0xe95d('0x193')]){_0x2c1cb5['createStateFinal'](_0x4d1c83,_0x1cc2b3,_0x321d64,'reason\x208\x20congestion');}else{_0x2c1cb5[_0xe95d('0x123')](_0x4d1c83,_0x1cc2b3,_0x321d64,_0xe95d('0x1b2'));}}break;case'11':_0x3e369a[_0xe95d('0x1b3')]+=0x1;_0x4d1c83[_0xe95d('0xcf')]=0xb;_0x4d1c83[_0xe95d('0x6e')]=_0xe95d('0xe8');_0x4d1c83[_0xe95d('0xea')]+=0x1;_0x4d1c83[_0xe95d('0xd4')]+=0x1;_0x404bbd=_0x3e369a['dialAbandonedRetryFrequency'];_0x1d559a=_0x3e369a[_0xe95d('0xd6')];hopperUtils[_0xe95d('0xe5')](_0x4d1c83)[_0xe95d('0xa0')](loggerCatch(_0xe95d('0xf0')));if(_0x2c1cb5[_0xe95d('0x18c')](0xb,_0x3dd3b2,_0x3e369a)&&!_0xdfbe39){if(_0x4d1c83[_0xe95d('0xea')]>=_0x3e369a[_0xe95d('0xec')]){_0x2c1cb5['createStateFinal'](_0x4d1c83,_0x1cc2b3,_0x321d64,_0xe95d('0x1b4'));}else{_0x2c1cb5[_0xe95d('0x123')](_0x4d1c83,_0x1cc2b3,_0x321d64,_0xe95d('0x1b4'));}}break;case'20':_0x3e369a['outboundRejectCallsDay']+=0x1;_0x4d1c83['state']=0x14;_0x4d1c83[_0xe95d('0x6e')]=_0xe95d('0x1b5');_0x4d1c83['countagentrejectretry']+=0x1;_0x4d1c83[_0xe95d('0xd4')]+=0x1;_0x404bbd=_0x3e369a['dialAgentRejectRetryFrequency'];_0x1d559a=_0x3e369a[_0xe95d('0xd6')];ami['emit']('custom:agentreject',ut[_0xe95d('0x119')](_0x3dd3b2,_0xe95d('0x1b6')));hopperUtils[_0xe95d('0xe5')](_0x4d1c83)[_0xe95d('0xa0')](loggerCatch(_0xe95d('0x1b7')));if(_0x2c1cb5[_0xe95d('0x18c')](0x14,_0x3dd3b2,_0x3e369a)&&!_0xdfbe39){if(_0x4d1c83[_0xe95d('0x122')]>=_0x3e369a[_0xe95d('0x1b8')]){_0x2c1cb5[_0xe95d('0x126')](_0x4d1c83,_0x1cc2b3,_0x321d64,'reason\x2020\x20agentreject');}else{_0x2c1cb5[_0xe95d('0x123')](_0x4d1c83,_0x1cc2b3,_0x321d64,_0xe95d('0x1b9'));}}break;default:_0x3e369a[_0xe95d('0x1ba')]+=0x1;_0x4d1c83[_0xe95d('0xcf')]=0xc;_0x4d1c83[_0xe95d('0x6e')]=_0x18caa5[_0xe95d('0xc7')];_0x404bbd=_0x3e369a[_0xe95d('0x19a')];_0x1d559a=_0x3e369a[_0xe95d('0xd6')];hopperUtils[_0xe95d('0xe5')](_0x4d1c83)[_0xe95d('0xa0')](loggerCatch(_0xe95d('0x1bb')));if(_0x2c1cb5['checkRetriveMax'](_0x18caa5[_0xe95d('0xc7')],_0x3dd3b2,_0x3e369a)&&!_0xdfbe39){if(_0x4d1c83[_0xe95d('0x11f')]+_0x4d1c83['countcongestionretry']+_0x4d1c83[_0xe95d('0x120')]+_0x4d1c83[_0xe95d('0x18d')]+_0x4d1c83[_0xe95d('0xd3')]+_0x4d1c83[_0xe95d('0xea')]+_0x4d1c83[_0xe95d('0x121')]+_0x4d1c83[_0xe95d('0x122')]>=_0x3e369a['dialGlobalMaxRetry']){_0x2c1cb5['stateGlobal'](_0x4d1c83,_0x1cc2b3,_0x321d64,_0x18caa5[_0xe95d('0xc7')]);}else{_0x2c1cb5[_0xe95d('0x126')](_0x4d1c83,_0x1cc2b3,_0x321d64,_0x18caa5['reason']);}}}})[_0xe95d('0x3e')](function(){if(_0xdfbe39){hopperUtils['swapAdditionalPhones'](_0x4d1c83,_0x404bbd,_0x1d559a)['then'](function(){return _0x1cc2b3(0x1);});}});});};Dialer[_0xe95d('0x1b')][_0xe95d('0x123')]=function(_0x4a253c,_0x45e856,_0x327dd5,_0xa6527b){var _0x221c2b=new Final(_0x4a253c);_0x221c2b[_0xe95d('0xcf')]=0xf;_0x221c2b[_0xe95d('0x6e')]=_0xe95d('0x1bc');this[_0xe95d('0x126')](_0x221c2b,_0x45e856,_0x327dd5,_0xa6527b);};Dialer[_0xe95d('0x1b')][_0xe95d('0x126')]=function(_0x25720c,_0x9291f2,_0x4fda52,_0x30b4ed){hopperUtils['moveContactManagedDialer'](_0x25720c)[_0xe95d('0x3e')](function(){return _0x9291f2(msgResponse(_0xe95d('0x19c'),_0xe95d('0x10c'),_0x30b4ed));})[_0xe95d('0xa0')](function(){return _0x4fda52(msgResponse(_0xe95d('0x1bd'),_0xe95d('0x93'),_0xe95d('0x1be')));});};Dialer[_0xe95d('0x1b')][_0xe95d('0x9')]=function(_0x116b49){var _0x5742bb=_0x116b49['dialPredictiveOptimizationPercentage']/0x64;var _0x4fcc50=_0x116b49[_0xe95d('0x1bf')]/(_0x116b49[_0xe95d('0x1bf')]+_0x116b49[_0xe95d('0xc6')]);var _0x2ab8b=Math[_0xe95d('0x1c0')](_0x116b49[_0xe95d('0x1c1')]*(_0x116b49[_0xe95d('0x1c2')]/0x64));var _0x2803b0=Math['round'](_0x116b49[_0xe95d('0x1c1')]*(_0x116b49[_0xe95d('0x1c3')]/0x64));var _0x5ac305=_0x116b49[_0xe95d('0x13a')]+_0x116b49[_0xe95d('0x1c4')];var _0x138a0b=Math['floor'](_0x116b49['erlangCalls']*_0x116b49[_0xe95d('0x5f')]*_0x116b49[_0xe95d('0x1c5')]*_0x116b49[_0xe95d('0x1c6')]);if(_[_0xe95d('0x53')](_0x116b49[_0xe95d('0x2a')])){if(!_[_0xe95d('0x53')](_0x116b49[_0xe95d('0x29')])){_0x116b49[_0xe95d('0x29')]=undefined;loggerPredictive[_0xe95d('0x63')]('[startMethodPredictive][StartProgressive]',_0xe95d('0x1c7'));}if(!_[_0xe95d('0x53')](_0x116b49[_0xe95d('0x62')])){loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0xe95d('0x1c8'));clearInterval(_0x116b49['handlePredictive']);_0x116b49[_0xe95d('0x62')]=undefined;}_0x116b49[_0xe95d('0x2a')]=moment()[_0xe95d('0x7b')](_0xe95d('0xc5'));loggerPredictive[_0xe95d('0x45')](_0x116b49[_0xe95d('0x43')],_0xe95d('0x1c9'),_0x116b49[_0xe95d('0x2a')]);this[_0xe95d('0xb1')](_0x116b49,0x1);}else if(ifInterval(_0x116b49[_0xe95d('0x1ca')],_0x116b49['startProgressive'])){this[_0xe95d('0xb1')](_0x116b49,0x1);loggerPredictiveCalls[_0xe95d('0x45')](_0xe95d('0x1cb'),_0x116b49['startProgressive'],_0x116b49[_0xe95d('0x43')]);_0x116b49[_0xe95d('0x5a')]=0x0;_0x116b49['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x5742bb<_0x4fcc50&&_0x116b49[_0xe95d('0x1cc')]==='dropRate'){clearPredictiveAttributes(_0x116b49);loggerPredictive['info'](_0xe95d('0x1cd'),_0xe95d('0x1ce'),_0x4fcc50,_0xe95d('0x2a'),_0x116b49[_0xe95d('0x43')]);}else if(_0x138a0b<_0x116b49[_0xe95d('0xce')]&&_0x116b49[_0xe95d('0x1cc')]===_0xe95d('0x1cf')){clearPredictiveAttributes(_0x116b49);loggerPredictive[_0xe95d('0x45')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0xe95d('0x1d0'),_0x138a0b,_0xe95d('0x1d1'),_0x116b49[_0xe95d('0xce')],_0xe95d('0x2a'),_0x116b49[_0xe95d('0x43')]);}else if(!ifInterval(_0x116b49[_0xe95d('0x1ca')],_0x116b49[_0xe95d('0x2a')])&&_[_0xe95d('0x53')](_0x116b49[_0xe95d('0x29')])&&!_[_0xe95d('0x53')](_0x116b49['startProgressive'])){_0x116b49[_0xe95d('0x29')]=moment()[_0xe95d('0x7b')](_0xe95d('0xc5'));loggerPredictive['info'](_0x116b49[_0xe95d('0x43')],_0xe95d('0x1d2'),_0x116b49['startPredictive']);hopperUtils[_0xe95d('0x1d3')](_0x116b49[_0xe95d('0x1ca')])[_0xe95d('0x3e')](this[_0xe95d('0x1d4')](_0x116b49))['then'](mergeDataErlangB(_0x116b49))['then'](this[_0xe95d('0x1d5')](_0x116b49))[_0xe95d('0xa0')](loggerCatchPredictive(_0xe95d('0x1d6'),_0x116b49));}else if(!ifInterval(_0x116b49[_0xe95d('0x1ca')],_0x116b49['startPredictive'])){_0x116b49[_0xe95d('0xce')]=0x0;_0x116b49[_0xe95d('0x29')]=moment()[_0xe95d('0x7b')](_0xe95d('0xc5'));loggerPredictive[_0xe95d('0x45')](_0x116b49['name'],_0xe95d('0x1d7'),_0x116b49['startPredictive']);clearInterval(_0x116b49[_0xe95d('0x62')]);_0x116b49[_0xe95d('0x62')]=undefined;hopperUtils[_0xe95d('0x1d3')](_0x116b49[_0xe95d('0x1ca')])[_0xe95d('0x3e')](this[_0xe95d('0x1d4')](_0x116b49))['then'](mergeDataErlangB(_0x116b49))[_0xe95d('0x3e')](this[_0xe95d('0x1d5')](_0x116b49))[_0xe95d('0xa0')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x116b49));}else if(_0x116b49['predictiveIntervalAvailable']&&_0x5ac305<_0x116b49[_0xe95d('0x1c1')]-_0x2803b0){clearPredictiveAttributes(_0x116b49);loggerPredictive[_0xe95d('0x45')](_0x116b49[_0xe95d('0x43')],_0xe95d('0x1d8'),_0x5ac305,')\x20are\x20less\x20than\x20threshold\x20(',_0x116b49[_0xe95d('0x1c1')],'-',_0x2803b0,'=',_0x116b49[_0xe95d('0x1c1')]-_0x2803b0,')');}else if(_0x116b49['predictiveIntervalAvailable']&&_0x5ac305>_0x116b49[_0xe95d('0x1c1')]+_0x2ab8b){clearPredictiveAttributes(_0x116b49);loggerPredictive[_0xe95d('0x45')](_0x116b49[_0xe95d('0x43')],_0xe95d('0x1d8'),_0x5ac305,_0xe95d('0x1d9'),_0x116b49[_0xe95d('0x1c1')],'+',_0x2ab8b,'=',_0x116b49[_0xe95d('0x1c1')]+_0x2ab8b,')');}};Dialer[_0xe95d('0x1b')][_0xe95d('0x1d4')]=function(_0x175441){var _0x9c7bee=this;return function(_0xdd414d){return new Promise(function(_0x530c92,_0xb0c82e){_[_0xe95d('0x156')](_0x175441,_0xdd414d[0x0]);if(checkGetDataPredictive(_0xdd414d[0x0])){var _0x50c49b=_0x175441[_0xe95d('0x1c1')]=_0x175441[_0xe95d('0x1c4')]+_0x175441[_0xe95d('0x13a')];var _0x565ffd=_0x175441[_0xe95d('0x1ca')]*0x3c;var _0x56de44=_0xdd414d[0x0]['predictiveIntervalAvgTalktime']+_0xdd414d[0x0]['predictiveIntervalAvgHoldtime'];var _0x4269ba=(_0xdd414d[0x0][_0xe95d('0x4a')]+_0xdd414d[0x0]['predictiveIntervalDroppedCallsTimeout']+_0xdd414d[0x0][_0xe95d('0x4e')])/_0xdd414d[0x0][_0xe95d('0x48')];_0x175441['predictiveIntervalHitRate']=_0x4269ba>0x0?_0x4269ba:0x1;switch(_0x175441[_0xe95d('0x1cc')]){case'dropRate':var _0x53dcbd=_0x175441[_0xe95d('0x1da')]/0x64;return _0x9c7bee[_0xe95d('0x1db')](_0x50c49b,_0x565ffd,_0x56de44,_0x4269ba,_0x53dcbd)[_0xe95d('0x3e')](function(_0x90d4ef){return _0x530c92(_0x90d4ef);});case _0xe95d('0x1dc'):var _0x39b990=_0x175441[_0xe95d('0x1da')]/0x64;return _0x9c7bee[_0xe95d('0x1dd')](_0x50c49b,_0x565ffd,_0x56de44,_0x4269ba,_0x39b990)[_0xe95d('0x3e')](function(_0x53568c){return _0x530c92(_0x53568c);});default:return _0xb0c82e(msgResponse('[getDataPredictive]',_0xe95d('0x93'),'Unknown\x20Predictive'));}}else{return _0xb0c82e(msgResponse(_0xe95d('0x1de'),_0xe95d('0x93'),_0xe95d('0x1df')));}});};};Dialer['prototype'][_0xe95d('0x1e0')]=function(_0x5bdaa3){var _0x3d2c4b=this;return function(_0x3ad389){return new Promise(function(_0x29ce01,_0x12a09f){_[_0xe95d('0x156')](_0x5bdaa3,_0x3ad389[0x0]);if(checkGetDataPredictive(_0x3ad389[0x0])){loggerPredictive[_0xe95d('0x45')](JSON['stringify'](_0x3ad389[0x0]));if(_0x5bdaa3['dialPredictiveOptimization']==='dropRate'){return _0x3d2c4b['getVoiceQueueRtPauses'](_0x5bdaa3['id'])[_0xe95d('0x3e')](function(_0x2ed855){var _0x5eb2cd=_0x5bdaa3[_0xe95d('0x1e1')]-_0x2ed855[0x0][_0xe95d('0x1e2')];var _0x1cb73d=_0x5bdaa3['dialPredictiveInterval']*0x3c;var _0xe3be0f=_0x3ad389[0x0][_0xe95d('0x51')]+_0x3ad389[0x0][_0xe95d('0x54')];var _0x279745=(_0x3ad389[0x0]['predictiveIntervalAnsweredCalls']+_0x3ad389[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x3ad389[0x0][_0xe95d('0x4e')])/_0x3ad389[0x0]['predictiveIntervalTotalCalls'];var _0x1ba812=_0x5bdaa3[_0xe95d('0x1da')]/0x64;_0x5bdaa3['predictiveIntervalPauses']=_0x2ed855[0x0][_0xe95d('0x1e2')]||0x0;_0x5bdaa3[_0xe95d('0x1c5')]=_0x279745>0x0?_0x279745:0x1;return _0x3d2c4b[_0xe95d('0x1db')](_0x5eb2cd,_0x1cb73d,_0xe3be0f,_0x279745,_0x1ba812);})[_0xe95d('0x3e')](function(_0x44e1db){return _0x29ce01(_0x44e1db);})['catch'](function(_0x22e931){return _0x12a09f(msgResponse('[CatchErlangB]',_0xe95d('0x93'),JSON[_0xe95d('0x73')](_0x22e931)));});}if(_0x5bdaa3[_0xe95d('0x1cc')]==='agentBusyFactor'){return _0x3d2c4b[_0xe95d('0x153')](_0x5bdaa3['id'])[_0xe95d('0x3e')](function(_0x3684bd){var _0x2ec82d=_0x5bdaa3[_0xe95d('0x1e1')]-_0x3684bd[0x0][_0xe95d('0x1e2')];var _0xe3ee4=_0x5bdaa3[_0xe95d('0x1ca')]*0x3c;var _0x405ac1=_0x3ad389[0x0][_0xe95d('0x51')]+_0x3ad389[0x0][_0xe95d('0x54')];var _0x2118b0=(_0x3ad389[0x0]['predictiveIntervalAnsweredCalls']+_0x3ad389[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x3ad389[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x3ad389[0x0][_0xe95d('0x48')];var _0x5123a0=_0x5bdaa3[_0xe95d('0x1da')]/0x64;_0x5bdaa3[_0xe95d('0x1e3')]=_0x3684bd[0x0]['outboundQueuePauses']||0x0;_0x5bdaa3[_0xe95d('0x1c5')]=_0x2118b0>0x0?_0x2118b0:0x1;return _0x3d2c4b[_0xe95d('0x1dd')](_0x2ec82d,_0xe3ee4,_0x405ac1,_0x2118b0,_0x5123a0);})[_0xe95d('0x3e')](function(_0xa18309){return _0x29ce01(_0xa18309);})[_0xe95d('0xa0')](function(_0x323732){return _0x12a09f(msgResponse(_0xe95d('0x1e4'),_0xe95d('0x93'),JSON[_0xe95d('0x73')](_0x323732)));});}}else{return _0x12a09f(msgResponse(_0xe95d('0x1de'),_0xe95d('0x93'),'check\x20failure'));}});};};Dialer[_0xe95d('0x1b')][_0xe95d('0x1d5')]=function(_0x59d0b2){var _0x5c6f5d=this;return function(){var _0x1e3637=0x0;var _0x4ed9d1=Math[_0xe95d('0x1e5')](_0x59d0b2['erlangCallToSecond']*0x3e8);if(_0x4ed9d1>0x0){_0x4ed9d1=_0x4ed9d1<0x64?0x64:_0x4ed9d1;loggerPredictive[_0xe95d('0x45')](_0x59d0b2[_0xe95d('0x43')],_0xe95d('0x1e6'),_0x4ed9d1,_0xe95d('0x1e7'));_0x59d0b2[_0xe95d('0x62')]=setInterval(function(){_0x5c6f5d['handlePredictive'](_0x59d0b2);loggerPredictiveCalls[_0xe95d('0x45')]('[handlePredictive]',_0x1e3637+=0x1);},_0x4ed9d1);}else{loggerPredictive['info'](_0x59d0b2['name'],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0xe95d('0x1b')][_0xe95d('0x1e8')]=function(_0x1eb8ca,_0x35ba18){var _0x361e00=this;return function(_0x1dbd6f){if(_['isEmpty'](_0x1dbd6f)){if(_['isNil'](_0x35ba18[_0xe95d('0x157')])||!_0x35ba18['recallme']){if(_0x1eb8ca[_0xe95d('0x1e9')]===_0xe95d('0x8')){_0x1eb8ca['queueStatusComplete']=_['isUndefined'](_0x1eb8ca[_0xe95d('0x70')])?!![]:_0x1eb8ca[_0xe95d('0x70')];var _0x5585b0=uuid['v4']();_0x361e00[_0xe95d('0x26')][_0x5585b0]=new Action(_0x1eb8ca,_0x35ba18,_0x5585b0);loggerBooked[_0xe95d('0x45')](_0xe95d('0x1ea'),_0x5585b0,_0xe95d('0x1eb'),JSON[_0xe95d('0x73')](_0x1eb8ca[_0xe95d('0x70')]),_0xe95d('0x1ec'),_0x1eb8ca[_0xe95d('0x43')]);if(_0x1eb8ca[_0xe95d('0x70')]){_0x1eb8ca[_0xe95d('0x70')]=![];_0x361e00['queueBooked'][_0x361e00['actions'][_0x5585b0]['queue']]=[];ami[_0xe95d('0x14f')]({'actionid':_0x5585b0,'action':_0xe95d('0x1ed'),'queue':_0x1eb8ca[_0xe95d('0x43')]})[_0xe95d('0xa0')](function(){_0x361e00[_0xe95d('0xc3')](_0x1eb8ca);hopperUtils[_0xe95d('0xdc')]({'active':![],'ContactId':_0x361e00[_0xe95d('0x26')][_0x5585b0]['ContactId'],'ListId':_0x361e00[_0xe95d('0x26')][_0x5585b0][_0xe95d('0xee')],'VoiceQueueId':_0x361e00['actions'][_0x5585b0][_0xe95d('0xdf')]||undefined,'CampaignId':_0x361e00['actions'][_0x5585b0][_0xe95d('0xe0')]||undefined})[_0xe95d('0xa0')](loggerCatch(_0xe95d('0x1ee')));delete _0x361e00['actions'][_0x5585b0];});}else{loggerBooked['info'](_0xe95d('0x1ef'),JSON[_0xe95d('0x73')](_0x1eb8ca[_0xe95d('0x70')]),_0xe95d('0x1ec'),_0x1eb8ca[_0xe95d('0x43')]);_0x361e00[_0xe95d('0xc3')](_0x1eb8ca);hopperUtils[_0xe95d('0xdc')]({'active':![],'ContactId':_0x361e00['actions'][_0x5585b0][_0xe95d('0xde')],'ListId':_0x361e00['actions'][_0x5585b0][_0xe95d('0xee')],'VoiceQueueId':_0x361e00[_0xe95d('0x26')][_0x5585b0][_0xe95d('0xdf')]||undefined,'CampaignId':_0x361e00[_0xe95d('0x26')][_0x5585b0]['CampaignId']||undefined})[_0xe95d('0xa0')](loggerCatch(_0xe95d('0x1ee')));delete _0x361e00[_0xe95d('0x26')][_0x5585b0];}}else{return _0x361e00[_0xe95d('0x15d')](_0x1eb8ca,_0x35ba18);}}else{if(utils[_0xe95d('0x60')](undefined,_0x35ba18[_0xe95d('0x1f0')])<_0x1eb8ca[_0xe95d('0x1f1')]*0x3c){if(_0x35ba18[_0xe95d('0x149')]&&!_0x35ba18[_0xe95d('0x149')][_0xe95d('0x1f2')]){_0x361e00['preview']['run'](_0x35ba18['id'])[_0xe95d('0x1e')](function(){_0x361e00[_0xe95d('0xc3')](_0x1eb8ca);});}else{hopperUtils['unlockContact']({'active':![]},_0x35ba18['id'],0x1)[_0xe95d('0x1e')](function(){_0x361e00[_0xe95d('0xc3')](_0x1eb8ca);});}}else{_0x1eb8ca[_0xe95d('0x1f3')]+=0x1;_0x361e00[_0xe95d('0xc3')](_0x1eb8ca);if(_0x1eb8ca['dialRecallInQueue']){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x35ba18['ContactId'],'ListId':_0x35ba18[_0xe95d('0xee')],'VoiceQueueId':_0x35ba18[_0xe95d('0xdf')]||undefined,'CampaignId':_0x35ba18[_0xe95d('0xe0')]||undefined})[_0xe95d('0xa0')](loggerCatch(_0xe95d('0x1f4')));hopperUtils[_0xe95d('0xe5')](createObjHistory(_0x1eb8ca,_0x35ba18,utils[_0xe95d('0x67')]['QUEUE_RECALL'],0x17,_0xe95d('0x1f5')))[_0xe95d('0xa0')](loggerCatch(_0xe95d('0x1f6')));}else{_0x361e00[_0xe95d('0x11a')](createObjHistory(_0x1eb8ca,_0x35ba18,utils[_0xe95d('0x67')][_0xe95d('0x1f7')],0x16,_0xe95d('0x1f8')),'[Originate][HistoryRecallClose][historyCatch]',_0xe95d('0x1f9'));}}}}else{_0x1eb8ca['outboundBlacklistCallsDay']+=0x1;_0x361e00[_0xe95d('0x11a')](createObjHistory(_0x1eb8ca,_0x35ba18,utils[_0xe95d('0x67')][_0xe95d('0x1fa')],0xd,_0xe95d('0x1fb')),'[Originate][historyBlacklist]',_0xe95d('0x1fc'));throw'inBlackList';}};};Dialer['prototype'][_0xe95d('0x15c')]=function(_0xb6c181){var _0x371421=this;var _0x283397=_0xb6c181[_0xe95d('0x1fd')]-_0xb6c181['originated'];emitCampaignSummary(_0xb6c181);if(_0x283397>0x0&&_0xb6c181[_0xe95d('0x1fe')]==0x0){if(_0x283397>this[_0xe95d('0x24')]){_0x283397=this['maxNumberOriginate'];}_0xb6c181[_0xe95d('0x1fe')]=0x1;hopperUtils[_0xe95d('0x1ff')](_0xb6c181,_0x283397)[_0xe95d('0x3e')](function(_0x2dd377){_0xb6c181['temp']=0x0;if(_0x2dd377){if(!utils[_0xe95d('0x200')](_0x2dd377)){_0xb6c181[_0xe95d('0x66')]=utils[_0xe95d('0x67')]['NO_AVAILABLE_CONTACTS'];logger['info'](_0xe95d('0x201')+_0xb6c181[_0xe95d('0x43')]);}else{_0xb6c181[_0xe95d('0x7e')]+=_0x2dd377[_0xe95d('0x98')];_0xb6c181[_0xe95d('0x66')]=utils['CAMPAIGN_STATUS'][_0xe95d('0x202')];for(var _0x941c1f=0x0;_0x941c1f<_0x2dd377[_0xe95d('0x98')];_0x941c1f+=0x1){_0xb6c181['ivrTotalCallsDays']+=0x1;if(_[_0xe95d('0xf6')](_0x2dd377[_0x941c1f])||_['isNil'](_0x2dd377[_0x941c1f][_0xe95d('0x203')])||_[_0xe95d('0xf6')](_0x2dd377[_0x941c1f]['phone'])){_0x371421['emptyContact'](_0xe95d('0x204'),_0xb6c181,_0x2dd377[_0x941c1f]);}else{hopperUtils[_0xe95d('0x205')](_[_0xe95d('0x74')](_0x2dd377[_0x941c1f],[_0xe95d('0xe0'),_0xe95d('0x160')]))[_0xe95d('0x3e')](_0x371421[_0xe95d('0x1e8')](_0xb6c181,_0x2dd377[_0x941c1f]))[_0xe95d('0xa0')](_0x371421['loggerHandler'](_0xe95d('0x206'),_0xb6c181));}}}}})[_0xe95d('0xa0')](loggerGetContactDialer(_0xe95d('0x207'),_0xb6c181,_0x283397));}};Dialer[_0xe95d('0x1b')]['handlePower']=function(_0xcc683a,_0xdb3e23){var _0x4a51fa=this;var _0x53478c=[];if(_0xdb3e23<0x1||_0xcc683a['dialMethod']===_0xe95d('0x8')){_0xdb3e23=0x1;}var _0x597c0a=Math[_0xe95d('0x1e5')](_0xcc683a[_0xe95d('0x13a')]*_0xdb3e23)-_0xcc683a['originated'];if(_0xcc683a['dialLimitQueue']>0x0){var _0x59da5e=_0xcc683a[_0xe95d('0x208')]-_0xcc683a['originated']-_0xcc683a[_0xe95d('0x1c4')]-_0xcc683a[_0xe95d('0x13c')];if(_0x597c0a>_0x59da5e){_0x597c0a=_0x59da5e;}}if(_0x597c0a>0x0&&_0xcc683a[_0xe95d('0x1fe')]==0x0){if(_0xcc683a[_0xe95d('0x1e9')]===_0xe95d('0x8')){_0x597c0a=0x1;}if(_0x597c0a>this[_0xe95d('0x24')]){_0x597c0a=this[_0xe95d('0x24')];}for(var _0x9dd3fd in this[_0xe95d('0x22')]){if(typeof this[_0xe95d('0x22')][_0x9dd3fd]!==_0xe95d('0xaa')){if(this[_0xe95d('0x22')][_0x9dd3fd][_0xe95d('0xcf')]===_0xe95d('0x209')&&this[_0xe95d('0x22')][_0x9dd3fd][_0xe95d('0x88')]===_0xe95d('0x87')){_0x53478c[_0xe95d('0x99')](this[_0xe95d('0x22')][_0x9dd3fd]['id']);}}}_0xcc683a[_0xe95d('0x1fe')]=0x1;hopperUtils[_0xe95d('0x20a')](_0xcc683a,_0x53478c,_0x597c0a)[_0xe95d('0x3e')](function(_0x5a17cf){_0xcc683a['temp']=0x0;if(_0x5a17cf){if(!utils[_0xe95d('0x200')](_0x5a17cf)){hopperUtils[_0xe95d('0x20b')](_0xcc683a)['then'](sendMessageReschedule(_0xcc683a))[_0xe95d('0xa0')](loggerCatch('[countReScheduled]\x20'));}else{_0xcc683a[_0xe95d('0x7e')]+=_0x5a17cf['length'];_0xcc683a[_0xe95d('0x66')]=_0xcc683a[_0xe95d('0x1e9')]===_0xe95d('0x8')?utils[_0xe95d('0x67')][_0xe95d('0x13d')]:utils[_0xe95d('0x67')][_0xe95d('0x202')];for(var _0x4da78d=0x0;_0x4da78d<_0x5a17cf[_0xe95d('0x98')];_0x4da78d+=0x1){if(_['isNil'](_0x5a17cf[_0x4da78d])||_['isNil'](_0x5a17cf[_0x4da78d][_0xe95d('0x203')])||_[_0xe95d('0xf6')](_0x5a17cf[_0x4da78d][_0xe95d('0x160')])){_0x4a51fa[_0xe95d('0x20c')](_0xe95d('0x204'),_0xcc683a,_0x5a17cf[_0x4da78d]);}else{hopperUtils['checkIsBlackList'](_[_0xe95d('0x74')](_0x5a17cf[_0x4da78d],[_0xe95d('0xdf'),_0xe95d('0x160')]))[_0xe95d('0x3e')](_0x4a51fa['checkContactBlack'](_0xcc683a,_0x5a17cf[_0x4da78d]))['catch'](_0x4a51fa['loggerHandler']('[actionOriginate]\x20',_0xcc683a));}}}}})[_0xe95d('0xa0')](loggerGetContactDialer('[getContactDialer2]',_0xcc683a,_0x597c0a));}};Dialer[_0xe95d('0x1b')][_0xe95d('0x62')]=function(_0x389d2a){if(_0x389d2a['dialLimitQueue']>0x0){var _0x36c0ac=_0x389d2a[_0xe95d('0x208')]-_0x389d2a[_0xe95d('0x7e')]-_0x389d2a[_0xe95d('0x1c4')];if(_0x36c0ac>0x0&&_0x389d2a[_0xe95d('0x1fe')]==0x0){this[_0xe95d('0x20d')](_0x389d2a);}else{loggerPredictiveCalls[_0xe95d('0x45')](_0xe95d('0x20e'));}}else{this[_0xe95d('0x20d')](_0x389d2a);}};Dialer[_0xe95d('0x1b')][_0xe95d('0x20d')]=function(_0x45be7a){var _0x5c2b08=this;var _0x4c6b49=[];_0x45be7a['originated']+=0x1;for(var _0x5267e9 in this[_0xe95d('0x22')]){if(typeof this[_0xe95d('0x22')][_0x5267e9]!=='undefined'){if(this[_0xe95d('0x22')][_0x5267e9][_0xe95d('0xcf')]===_0xe95d('0x209')&&this[_0xe95d('0x22')][_0x5267e9][_0xe95d('0x88')]===_0xe95d('0x87')){_0x4c6b49[_0xe95d('0x99')](this[_0xe95d('0x22')][_0x5267e9]['id']);}}}_0x45be7a[_0xe95d('0x1fe')]=0x1;return this[_0xe95d('0x20a')](_0x45be7a['id'],_0x4c6b49,0x1,_0x45be7a[_0xe95d('0x20f')],_0x45be7a)[_0xe95d('0x3e')](function(_0x2b783e){_0x45be7a['temp']=0x1;if(_0x2b783e){if(!utils['checkContactEmpty'](_0x2b783e)){utils['checkContactLowerLimitOriginate'](_0x45be7a,0x1,0x0);return hopperUtils[_0xe95d('0x20b')](_0x45be7a)[_0xe95d('0x3e')](sendMessageReschedule(_0x45be7a))['catch'](loggerCatch(_0xe95d('0x210')));}else{_0x45be7a[_0xe95d('0x66')]=utils[_0xe95d('0x67')][_0xe95d('0x202')];if(_[_0xe95d('0xf6')](_0x2b783e[0x0])||_[_0xe95d('0xf6')](_0x2b783e[0x0][_0xe95d('0x203')])||_['isNil'](_0x2b783e[0x0]['phone'])){_0x5c2b08[_0xe95d('0x20c')]('[actionOriginate]\x20',_0x45be7a,_0x2b783e[0x0]);}else{return hopperUtils[_0xe95d('0x211')](_[_0xe95d('0x74')](_0x2b783e[0x0],[_0xe95d('0xdf'),_0xe95d('0x160')]))[_0xe95d('0x3e')](_0x5c2b08[_0xe95d('0x1e8')](_0x45be7a,_0x2b783e[0x0]))[_0xe95d('0xa0')](_0x5c2b08[_0xe95d('0x212')](_0xe95d('0x213'),_0x45be7a));}}}})[_0xe95d('0xa0')](loggerGetContactDialer(_0xe95d('0x214'),_0x45be7a,0x1));};Dialer[_0xe95d('0x1b')][_0xe95d('0x1db')]=function(_0x348ba9,_0x4032c3,_0x1c33f5,_0x2f9a35,_0x4d19b1,_0x5cf965){loggerPredictive[_0xe95d('0x45')](_0xe95d('0x215'));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',_0x348ba9);loggerPredictive[_0xe95d('0x45')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4032c3);loggerPredictive[_0xe95d('0x45')](_0xe95d('0x216'),_0x1c33f5);loggerPredictive[_0xe95d('0x45')]('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',_0x2f9a35);loggerPredictive[_0xe95d('0x45')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4d19b1);loggerPredictive[_0xe95d('0x45')](_0xe95d('0x52'));return new Promise(function(_0x1a7b26,_0xabc8b7){if(_0x348ba9<=0x0||isNaN(_0x348ba9)){return _0xabc8b7(msgResponse('[abandonmentRate]',_0xe95d('0x83'),_0xe95d('0x217')+_0x348ba9));}if(_0x1c33f5<=0x0||isNaN(_0x1c33f5)){return _0xabc8b7(msgResponse('[abandonmentRate]',_0xe95d('0x83'),_0xe95d('0x218')+_0x1c33f5));}if(_0x2f9a35<=0x0||isNaN(_0x2f9a35)){return _0xabc8b7(msgResponse(_0xe95d('0x219'),_0xe95d('0x83'),_0xe95d('0x21a')+_0x2f9a35));}if(_0x4032c3<=0x0||isNaN(_0x4032c3)){return _0xabc8b7(msgResponse(_0xe95d('0x219'),_0xe95d('0x83'),'interval\x20=\x20'+_0x4032c3));}if(_0x4d19b1<=0x0||isNaN(_0x4d19b1)){return _0xabc8b7(msgResponse(_0xe95d('0x219'),'Error',_0xe95d('0x21b')+_0x4d19b1));}_0x5cf965=_0x5cf965||0x0;var _0x4be439=0x1/_0x1c33f5;var _0x470077=0x0;var _0x17b655=0x0;var _0x48ffb6=0x0;var _0x48be28=0x0;for(var _0xbc2a0=0x0;_0x48ffb6<_0x4d19b1;_0xbc2a0+=0x1){_0x17b655=_0xbc2a0/_0x4032c3;_0x470077=(_0x2f9a35*_0x17b655+_0x5cf965)/_0x4be439;_0x48ffb6=utils['erlangb'](_0x470077,_0x348ba9);_0x48be28=_0x470077/_0x348ba9*(0x1-utils[_0xe95d('0x21c')](_0x470077,_0x348ba9));}return _0x1a7b26({'erlangCalls':_0xbc2a0,'erlangCallToSecond':_0x4032c3/_0xbc2a0,'erlangAbandonmentRate':_0x48ffb6,'erlangBusyFactor':_0x48be28});});};Dialer[_0xe95d('0x1b')][_0xe95d('0x1dd')]=function(_0x5a91b2,_0x6957ab,_0x47ba59,_0x341786,_0xa5755c,_0x5b96f8){loggerPredictive[_0xe95d('0x45')](_0xe95d('0x21d'));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',_0x5a91b2);loggerPredictive[_0xe95d('0x45')](_0xe95d('0x21e'),_0x6957ab);loggerPredictive[_0xe95d('0x45')](_0xe95d('0x216'),_0x47ba59);loggerPredictive['info']('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x341786);loggerPredictive[_0xe95d('0x45')](_0xe95d('0x21f'),_0xa5755c);loggerPredictive[_0xe95d('0x45')](_0xe95d('0x52'));return new Promise(function(_0x4da5a6,_0x27da8f){if(_0x5a91b2<=0x0||isNaN(_0x5a91b2)){return _0x27da8f(msgResponse(_0xe95d('0x220'),_0xe95d('0x83'),_0xe95d('0x217')+_0x5a91b2));}if(_0x47ba59<=0x0||isNaN(_0x47ba59)){return _0x27da8f(msgResponse(_0xe95d('0x220'),'Error',_0xe95d('0x218')+_0x47ba59));}if(_0x341786<=0x0||isNaN(_0x341786)){return _0x27da8f(msgResponse(_0xe95d('0x220'),_0xe95d('0x83'),'p\x20=\x20'+_0x341786));}if(_0x6957ab<=0x0||isNaN(_0x6957ab)){return _0x27da8f(msgResponse(_0xe95d('0x220'),_0xe95d('0x83'),_0xe95d('0x221')+_0x6957ab));}if(_0xa5755c<=0x0||isNaN(_0xa5755c)){return _0x27da8f(msgResponse(_0xe95d('0x220'),_0xe95d('0x83'),_0xe95d('0x222')+_0xa5755c));}_0x5b96f8=_0x5b96f8||0x0;var _0xc137fc=0x1/_0x47ba59;var _0x2e7613=0x0;var _0x3a1936=0x0;var _0x1781d9=0x0;var _0xbbd635=0x0;for(var _0x5a658e=0x0;_0xbbd635<_0xa5755c;_0x5a658e+=0x1){_0x3a1936=_0x5a658e/_0x6957ab;_0x2e7613=(_0x341786*_0x3a1936+_0x5b96f8)/_0xc137fc;_0x1781d9=utils['erlangb'](_0x2e7613,_0x5a91b2);_0xbbd635=_0x2e7613/_0x5a91b2*(0x1-utils['erlangb'](_0x2e7613,_0x5a91b2));}return _0x4da5a6({'erlangCalls':_0x5a658e,'erlangCallToSecond':_0x6957ab/_0x5a658e,'erlangAbandonmentRate':_0x1781d9,'erlangBusyFactor':_0xbbd635});});};module['exports']=Dialer; \ No newline at end of file +var _0x9c81=['\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','isIVRCampaignActive','resolve','dialGlobalInterval','dialTimezone','launchHandleIvr','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','OVERTIME_INTERVAL','AMI\x20IfTime','queue','uniqueid','type','ivr','updateOriginated','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','Drop','dropreason','TIMEOUT','agiafterat','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','countdropretry','dialDropMaxRetry','rescheduleContact','add','minutes','ContactId','ListId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','predictiveIntervalDroppedCallsCallersExit','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','queueCallerAbandonCreateState','VoiceQueueId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','roundrobin','isNil','locked','paused','stateinterface','rrmemory','idHopper','run','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','callProgressDetecting','[callProgressDetecting]\x20','amdstatus','exten','xcally-motion-dialer','dialAMDActive','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','custom:amd','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','value','MACHINE','Machine','AMD','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','stateGlobal','countmachineretry','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','buildObj','dialGlobalMaxRetry','reason19\x20machine....','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','cause-txt','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','inUse','talking','pTalking','ACTIVE','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','[syncQueueSummary]','throttle','dialPreviewRecallmeReminder','filter','online','reachable','handlePreviewRecallNotifications','map','Agent','user:%s','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','UserId','[emptyContact][createHistory]','[syncAgentComplete][createHistory]','user:dialPreviewRecallReminder','handleIvr','object','originate','voiceQueue\x20is\x20undefine','phone','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','dialQueueOptions','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','assign','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','TrunkBackup','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','[originateError]:\x20%s','OriginateError','endtime','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','verifyAdditionalPhones','reason','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','dialBusyRetryFrequency','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[callProgressDetecting]','Success','contact\x20not\x20moved','outboundDropCallsDayTimeout','round','predictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','predictiveIntervalErlangCallsDroppedCalls','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','dialPredictiveOptimizationPercentage','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','loggedIn','busyFactor','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','limitCalls','temp','getContactDialerIvr','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','checkContactEmpty','countReScheduled','[countReScheduled]\x20','RUNNING','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','getContactDialer','dialOrderByScheduledAt','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','Umin\x20=\x20','erlangb','exports','util','lodash','uuid','moment','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','env','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBooked','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','then','previewRecallmeReminderInterval','isUndefined','emit','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','voice_queue:save','isEmpty','-----\x20Stats\x20Predictive\x20---','info','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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','erlangAbandonmentRate','merge','getSeconds','name','startProgressive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','\x20NOT\x20Active','isIVRCampaign','originated','sendMessageOneNotActive','INACTIVE','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','[ifTime][Action]','Error','isTrunkReachable','active','status','SIP/%s','unmonitored','checkIsTrunkReachable','Trunk','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','EMPTY_INTERVAL','timezones','\x20Timezone\x20unknow\x20','length','push','command','iftime\x20%s,%s','interval','content','true','catch','Action','indexOf','all','some','OVERTIME_GLOBAL_INTERVAL','[ifTime][promiseAll]','Global:\x20'];(function(_0x30ba41,_0x20d3a3){var _0x2a4b53=function(_0x3490e0){while(--_0x3490e0){_0x30ba41['push'](_0x30ba41['shift']());}};_0x2a4b53(++_0x20d3a3);}(_0x9c81,0x17d));var _0x19c8=function(_0x412827,_0x1980c2){_0x412827=_0x412827-0x0;var _0x2ae949=_0x9c81[_0x412827];return _0x2ae949;};'use strict';var util=require(_0x19c8('0x0'));var _=require(_0x19c8('0x1'));var uuid=require(_0x19c8('0x2'));var moment=require(_0x19c8('0x3'));var rr=require('rr');var Redis=require(_0x19c8('0x4'));var utils=require(_0x19c8('0x5'));var hopperUtils=require(_0x19c8('0x6'));var ut=require(_0x19c8('0x7'));var config=require(_0x19c8('0x8'));var logger=require(_0x19c8('0x9'))(_0x19c8('0xa'));var loggerBooked=require(_0x19c8('0x9'))(_0x19c8('0xb'));var loggerPredictive=require(_0x19c8('0x9'))(_0x19c8('0xc'));var loggerPredictiveCalls=require('../../../config/logger')(_0x19c8('0xd'));var loggerSyncQueueSummary=require(_0x19c8('0x9'))(_0x19c8('0xe'));var ami=require(_0x19c8('0xf'));config['redis']=_['defaults'](config[_0x19c8('0x10')],{'host':'localhost','port':0x18eb});var io=require(_0x19c8('0x11'))(new Redis(config[_0x19c8('0x10')]));var cmHopper=require(_0x19c8('0x12'));var voiceQueueRt=require(_0x19c8('0x13'));var RpcSetting=require(_0x19c8('0x14'));var Interval=require(_0x19c8('0x15'));var Action=require(_0x19c8('0x16'));var History=require(_0x19c8('0x17'));var Final=require(_0x19c8('0x18'));var AgentComplete=require(_0x19c8('0x19'));var QueueCallerAbandon=require(_0x19c8('0x1a'));var Hangup=require('./models/hangup');var ipAgi=process[_0x19c8('0x1b')][_0x19c8('0x1c')]||_0x19c8('0x1d');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x19c8('0x1e')][_0x19c8('0x1f')]=function(_0x44dea6){this[_0x19c8('0x20')]=this[_0x19c8('0x20')]?this[_0x19c8('0x20')][_0x19c8('0x21')](_0x44dea6):_0x44dea6();};function Dialer(_0x11634a,_0x1c5c09){this[_0x19c8('0x22')]=new Sequence();this[_0x19c8('0x23')]=_0x1c5c09;this[_0x19c8('0x24')]=_0x11634a[_0x19c8('0x24')];this[_0x19c8('0x25')]=_0x11634a['campaigns'];this[_0x19c8('0x26')]=_0x11634a[_0x19c8('0x26')];this[_0x19c8('0x27')]=_0x11634a[_0x19c8('0x27')];this['maxNumberOriginate']=config[_0x19c8('0x28')]||0x2;this[_0x19c8('0x29')]={};this[_0x19c8('0x2a')]={};this[_0x19c8('0x2b')]={};this[_0x19c8('0x2c')]={};this['optionPredictive']={};this[_0x19c8('0x2d')]={};this[_0x19c8('0x2e')]={};this[_0x19c8('0x2f')]={};this[_0x19c8('0x30')]={};this['queueBookedRR']={};this[_0x19c8('0x31')]={};ami['on'](_0x19c8('0x32'),this[_0x19c8('0x33')][_0x19c8('0x34')](this));ami['on'](_0x19c8('0x35'),this[_0x19c8('0x36')]['bind'](this));ami['on'](_0x19c8('0x37'),this[_0x19c8('0x38')]['bind'](this));ami['on'](_0x19c8('0x39'),this[_0x19c8('0x3a')]['bind'](this));ami['on'](_0x19c8('0x3b'),this[_0x19c8('0xe')][_0x19c8('0x34')](this));ami['on'](_0x19c8('0x3c'),this[_0x19c8('0x3d')][_0x19c8('0x34')](this));ami['on']('hangup',this[_0x19c8('0x3e')][_0x19c8('0x34')](this));ami['on'](_0x19c8('0x3f'),this[_0x19c8('0x40')][_0x19c8('0x34')](this));ami['on'](_0x19c8('0x41'),this[_0x19c8('0x42')][_0x19c8('0x34')](this));ami['on'](_0x19c8('0x43'),this[_0x19c8('0x44')][_0x19c8('0x34')](this));ami['on'](_0x19c8('0x45'),this[_0x19c8('0x46')][_0x19c8('0x34')](this));this['loopCampaigns']();this[_0x19c8('0x47')]();RpcSetting['getSettings']()[_0x19c8('0x48')](function(_0x3de895){previewRecallmeReminderInterval=_0x3de895[_0x19c8('0x49')];});}function isNotNull(_0x325937){return _0x325937!==null&&!_[_0x19c8('0x4a')](_0x325937);}function msgResponse(_0x3c8ad0,_0x61a8f8,_0x558472){return{'action':_0x3c8ad0,'response':_0x61a8f8,'message':_0x558472,'stack':_0x558472};}function emit(_0x2e300c,_0x300c01,_0x333ce6){io['to'](_0x2e300c)[_0x19c8('0x4b')](_0x300c01,_0x333ce6);}function emitOutboundVoiceQueueSummary(_0x3f86b5){if(_0x3f86b5['type']===_0x19c8('0x4c')){logger[_0x19c8('0x4d')](_0x19c8('0x4e'),util[_0x19c8('0x4f')](_0x3f86b5,{'showHidden':![],'depth':null}));emit(util[_0x19c8('0x50')](_0x19c8('0x51'),_0x3f86b5['name']),_0x19c8('0x52'),_0x3f86b5);}}function checkGetDataPredictive(_0x9f7c7f){if(isNotNull(_0x9f7c7f)&&!_[_0x19c8('0x53')](_0x9f7c7f)){loggerPredictive['info'](_0x19c8('0x54'));loggerPredictive[_0x19c8('0x55')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x9f7c7f[_0x19c8('0x56')]);loggerPredictive[_0x19c8('0x55')](_0x19c8('0x57'),_0x9f7c7f[_0x19c8('0x58')]);loggerPredictive[_0x19c8('0x55')](_0x19c8('0x59'),_0x9f7c7f['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x19c8('0x55')](_0x19c8('0x5a'),_0x9f7c7f['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive['info'](_0x19c8('0x5b'),_0x9f7c7f[_0x19c8('0x5c')]);loggerPredictive['info'](_0x19c8('0x5d'),_0x9f7c7f[_0x19c8('0x5e')]);loggerPredictive[_0x19c8('0x55')](_0x19c8('0x5f'));if(_0x9f7c7f['predictiveIntervalTotalCalls']>0x0){if(!_[_0x19c8('0x4a')](_0x9f7c7f[_0x19c8('0x5e')])&&_0x9f7c7f[_0x19c8('0x5e')]>0x0){return!![];}loggerPredictive['info'](_0x19c8('0x60'));if(!_[_0x19c8('0x4a')](_0x9f7c7f['predictiveIntervalAvgHoldtime'])&&_0x9f7c7f['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x19c8('0x55')](_0x19c8('0x61'));}else{loggerPredictive['info']('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x19c8('0x55')](_0x19c8('0x62'));}return![];}function mergeDataErlangB(_0x1ff1d0){return function(_0x58b22a){loggerPredictive[_0x19c8('0x55')]('---------\x20ErlangB\x20---------');loggerPredictive[_0x19c8('0x55')](_0x19c8('0x63'),_0x58b22a[_0x19c8('0x64')]);loggerPredictive[_0x19c8('0x55')](_0x19c8('0x65'),_0x58b22a[_0x19c8('0x66')]);loggerPredictive[_0x19c8('0x55')](_0x19c8('0x67'),_0x58b22a['erlangAbandonmentRate']);loggerPredictive[_0x19c8('0x55')](_0x19c8('0x68'),_0x58b22a['erlangBusyFactor']);loggerPredictive[_0x19c8('0x55')](_0x19c8('0x67'),_0x58b22a[_0x19c8('0x69')]);loggerPredictive[_0x19c8('0x55')](_0x19c8('0x5f'));_[_0x19c8('0x6a')](_0x1ff1d0,_0x58b22a);};}function ifInterval(_0x48c45d,_0x4992ee){if(_[_0x19c8('0x4a')](_0x4992ee)){return![];}return utils[_0x19c8('0x6b')](undefined,_0x4992ee)<_0x48c45d*0x3c;}function clearPredictiveAttributes(_0x5d23b9){if(_0x5d23b9['startProgressive']){_0x5d23b9[_0x19c8('0x2e')]=undefined;loggerPredictive[_0x19c8('0x4d')](_0x5d23b9[_0x19c8('0x6c')],_0x19c8('0x6d'));}if(_0x5d23b9[_0x19c8('0x2d')]){_0x5d23b9[_0x19c8('0x2d')]=undefined;loggerPredictive[_0x19c8('0x4d')](_0x5d23b9[_0x19c8('0x6c')],'startPredictive\x20value\x20cleared');}if(_0x5d23b9[_0x19c8('0x6e')]){clearInterval(_0x5d23b9[_0x19c8('0x6e')]);_0x5d23b9[_0x19c8('0x6e')]=undefined;loggerPredictive[_0x19c8('0x4d')](_0x5d23b9[_0x19c8('0x6c')],_0x19c8('0x6f'));}}function loggerCatchPredictive(_0x35e9e9,_0x471c39){return function(_0x265e8d){loggerPredictive[_0x19c8('0x70')](_0x471c39[_0x19c8('0x6c')],_0x35e9e9);loggerPredictive[_0x19c8('0x70')](_0x265e8d['stack']);clearPredictiveAttributes(_0x471c39);};}function loggerCatch(_0x82d04e){return function(_0x1f7c0c){logger['error'](_0x82d04e,util[_0x19c8('0x4f')](_0x1f7c0c,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x3da87a,_0x10f3a7,_0x5d21b3){return function(_0x397bc7){utils['checkContactLowerLimitOriginate'](_0x10f3a7,_0x5d21b3,0x0);logger['error'](_0x3da87a,util['inspect'](_0x397bc7,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x7f26d4){return function(_0x5624cf){if(isNotNull(_0x5624cf)&&isNotNull(_0x5624cf[0x0])){if(_0x5624cf[0x0][_0x19c8('0x71')]>0x0){_0x7f26d4[_0x19c8('0x72')]=utils[_0x19c8('0x73')][_0x19c8('0x74')];logger[_0x19c8('0x55')]('[getContactDialer2][ReScheduled]'+_0x7f26d4[_0x19c8('0x6c')],_0x5624cf[0x0][_0x19c8('0x71')],'contacts');}else{_0x7f26d4[_0x19c8('0x72')]=utils['CAMPAIGN_STATUS'][_0x19c8('0x75')];logger['info'](_0x19c8('0x76')+_0x7f26d4[_0x19c8('0x6c')]);}}};}function createObjHistory(_0x55cbcc,_0x1ca3d0,_0x12b39b,_0x440d40,_0x5646eb){_0x55cbcc[_0x19c8('0x72')]=_0x12b39b;var _0x189540=new Action(_0x55cbcc,_0x1ca3d0);var _0x48d5bc=new History(_0x189540);_0x48d5bc[_0x19c8('0x77')]=_0x440d40;_0x48d5bc[_0x19c8('0x78')]=_0x5646eb;_0x48d5bc['endtime']=_0x189540[_0x19c8('0x79')];return _0x48d5bc;}function unlockQueueStatus(_0x2a17a2,_0xce5403){setTimeout(function(){if(_[_0x19c8('0x4a')](_0x2a17a2[_0x19c8('0x7a')])){loggerBooked[_0x19c8('0x70')](_0x19c8('0x7b'),_0xce5403);}_0x2a17a2[_0x19c8('0x7a')]=!![];loggerBooked[_0x19c8('0x55')](_0x19c8('0x7c'),_0xce5403,JSON[_0x19c8('0x7d')](_[_0x19c8('0x7e')](_0x2a17a2,[_0x19c8('0x6c'),_0x19c8('0x7a')])));},0x1f3);}function checkInterval(_0x52a263){return function(){if(!isNotNull(_0x52a263[_0x19c8('0x7f')])){_0x52a263['message']=utils['CAMPAIGN_STATUS'][_0x19c8('0x80')];throw _0x52a263[_0x19c8('0x6c')]+_0x19c8('0x81');}if(!isNotNull(_0x52a263[_0x19c8('0x7f')][_0x19c8('0x82')])){_0x52a263['message']=utils[_0x19c8('0x73')][_0x19c8('0x80')];throw _0x52a263['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x19c8('0x53')](_0x52a263[_0x19c8('0x7f')]['Intervals']))){_0x52a263['message']=utils[_0x19c8('0x73')][_0x19c8('0x80')];throw _0x52a263['name']+_0x19c8('0x81');}};}function checkIsIVRCampaignActive(_0x45e334){return function(){if(!utils['isIVRCampaignActive'](_0x45e334)){_0x45e334[_0x19c8('0x72')]=utils[_0x19c8('0x73')]['INACTIVE'];throw _0x45e334['name']+_0x19c8('0x83');}};}function emitCampaignSummary(_0x135ef8){if(utils[_0x19c8('0x84')](_0x135ef8)){emit(util['format']('campaign:ivr:%s',_0x135ef8[_0x19c8('0x6c')]),'campaign:save',_0x135ef8);}}function loggerCatchQueueSummary(_0x511f51,_0xa07c7e){return function(_0x48eabb){clearPredictiveAttributes(_0xa07c7e);emitCampaignSummary(_0xa07c7e);loggerSyncQueueSummary[_0x19c8('0x4d')](_0x511f51,util[_0x19c8('0x4f')](_0x48eabb,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x278123){if(_0x278123['sendMessageOneNotActive']){if(_0x278123[_0x19c8('0x85')]===0x0){_0x278123[_0x19c8('0x86')]=![];_0x278123[_0x19c8('0x72')]=utils[_0x19c8('0x73')][_0x19c8('0x87')];loggerSyncQueueSummary['debug'](_0x19c8('0x88'),_0x278123['name'],_0x19c8('0x89'));}else{_0x278123[_0x19c8('0x72')]=utils[_0x19c8('0x73')][_0x19c8('0x8a')];loggerSyncQueueSummary[_0x19c8('0x4d')](_0x19c8('0x88'),_0x278123['name'],_0x19c8('0x8b'));}emitCampaignSummary(_0x278123);}}function myreject(_0x290365){return function(_0x35b464){return _0x290365(msgResponse(_0x19c8('0x8c'),_0x19c8('0x8d'),JSON['stringify'](_0x35b464)));};}Dialer[_0x19c8('0x1e')][_0x19c8('0x8e')]=function(_0x66ceb8){return!_[_0x19c8('0x4a')](_0x66ceb8)&&_0x66ceb8&&!_['isUndefined'](_0x66ceb8[_0x19c8('0x6c')])&&!_[_0x19c8('0x4a')](_0x66ceb8[_0x19c8('0x8f')])&&_0x66ceb8[_0x19c8('0x8f')]&&(this['trunks'][util[_0x19c8('0x50')]('SIP/%s',_0x66ceb8['name'])][_0x19c8('0x90')]==='reachable'||this[_0x19c8('0x27')][util['format'](_0x19c8('0x91'),_0x66ceb8['name'])][_0x19c8('0x90')]===_0x19c8('0x92'));};Dialer[_0x19c8('0x1e')][_0x19c8('0x93')]=function(_0x500cba){var _0x5c3a37=this;return function(){if(!_0x5c3a37[_0x19c8('0x8e')](_0x500cba[_0x19c8('0x94')])){if(!_0x5c3a37[_0x19c8('0x8e')](_0x500cba['TrunkBackup'])){_0x500cba[_0x19c8('0x72')]=utils[_0x19c8('0x73')][_0x19c8('0x95')];throw _0x500cba[_0x19c8('0x6c')]+_0x19c8('0x96');}}};};Dialer[_0x19c8('0x1e')][_0x19c8('0x97')]=function(_0x5aa8e5,_0x3ca240,_0x4e92ac,_0x4269c3){var _0x1fe29b=this;return function(){var _0x51d969=!![];return _0x1fe29b[_0x19c8('0x98')](_0x5aa8e5,_0x3ca240,_0x4e92ac,_0x4269c3,_0x51d969);};};Dialer[_0x19c8('0x1e')][_0x19c8('0x99')]=function(_0x157735,_0x4becf1,_0x38e782,_0x39aa92){var _0x43f48b=this;return function(){var _0x490e3f=![];return _0x43f48b['ifTimeIvr'](_0x157735[_0x19c8('0x82')],_0x4becf1,_0x38e782,_0x39aa92,_0x490e3f);};};Dialer[_0x19c8('0x1e')][_0x19c8('0x98')]=function(_0x22d338,_0x216969,_0x90ce98,_0x130e1d,_0x3bf7fd){var _0xeef578=[];return new Promise(function(_0x3faa3a,_0x31ec0c){if(!isNotNull(_0x22d338)){_0x130e1d['message']=utils[_0x19c8('0x73')][_0x19c8('0x80')];return _0x31ec0c(msgResponse(_0x19c8('0x9a'),_0x19c8('0x9b'),_0x90ce98+'\x20Intervals\x20is\x20null\x20'));}if(_[_0x19c8('0x53')](_0x22d338)){_0x130e1d['message']=utils['CAMPAIGN_STATUS'][_0x19c8('0x9c')];return _0x31ec0c(msgResponse(_0x19c8('0x9a'),'Failure',_0x90ce98+'\x20Intervals\x20is\x20empty\x20'));}if(_0x216969&&_[_0x19c8('0x4a')](config[_0x19c8('0x9d')][_0x216969])){_0x130e1d['message']=utils[_0x19c8('0x73')]['UNKNOWN_TIMEZONE'];return _0x31ec0c(msgResponse(_0x19c8('0x9a'),_0x19c8('0x9b'),_0x90ce98+_0x19c8('0x9e')+_0x216969));}if(_['isArray'](_0x22d338)){for(var _0x1dd7a7=0x0;_0x1dd7a7<_0x22d338[_0x19c8('0x9f')];_0x1dd7a7+=0x1){_0xeef578[_0x19c8('0xa0')](ami['Action']({'action':_0x19c8('0xa1'),'command':util[_0x19c8('0x50')](_0x19c8('0xa2'),_0x22d338[_0x1dd7a7][_0x19c8('0xa3')],!_['isUndefined'](config['timezones'][_0x216969])?_0x216969:'')})[_0x19c8('0x48')](function(_0x67acf){return _0x67acf[_0x19c8('0xa4')]['indexOf'](_0x19c8('0xa5'))>=0x0;})[_0x19c8('0xa6')](myreject(_0x31ec0c)));}}else{_0xeef578[_0x19c8('0xa0')](ami[_0x19c8('0xa7')]({'action':'command','command':util[_0x19c8('0x50')](_0x19c8('0xa2'),_0x22d338,!_[_0x19c8('0x4a')](config[_0x19c8('0x9d')][_0x216969])?_0x216969:'')})[_0x19c8('0x48')](function(_0x1f5aed){return _0x1f5aed[_0x19c8('0xa4')][_0x19c8('0xa8')](_0x19c8('0xa5'))>=0x0;})[_0x19c8('0xa6')](myreject(_0x31ec0c)));}Promise[_0x19c8('0xa9')](_0xeef578)[_0x19c8('0x48')](function(_0x4ad508){var _0x4d4879=_[_0x19c8('0xaa')](_0x4ad508);if(_0x4d4879){return _0x3faa3a(_0x4d4879);}else{_0x130e1d[_0x19c8('0x72')]=_0x3bf7fd?utils['CAMPAIGN_STATUS'][_0x19c8('0xab')]:utils[_0x19c8('0x73')]['OVERTIME_INTERVAL'];return _0x31ec0c(msgResponse(_0x19c8('0xac'),_0x19c8('0x9b'),_0x19c8('0xad')+_0x3bf7fd+'\x20'+_0x90ce98+_0x19c8('0xae')+util['inspect'](_0x22d338,{'showHidden':![],'depth':null})+_0x19c8('0xaf')+_0x216969));}})['catch'](function(_0x10e2f8){return _0x31ec0c(msgResponse(_0x19c8('0x9a'),_0x19c8('0x9b'),JSON[_0x19c8('0x7d')](_0x10e2f8)));});});};Dialer['prototype']['loopCampaigns']=function(){var _0x3667b3=this;return cmHopper[_0x19c8('0xb0')]({'active':![]},{'where':{'active':!![]}})[_0x19c8('0x48')](function(){setInterval(function(){_0x3667b3[_0x19c8('0xb1')]();},0x3e8);});};Dialer[_0x19c8('0x1e')][_0x19c8('0xb1')]=function(){var _0x4f40fb=this;var _0x3e62a4;for(var _0x1b264f in this[_0x19c8('0x25')]){if(typeof this[_0x19c8('0x25')][_0x1b264f]!==_0x19c8('0xb2')){_0x3e62a4=this[_0x19c8('0x25')][_0x1b264f];if(utils['isIVRCampaign'](_0x3e62a4)&&utils[_0x19c8('0xb3')](_0x3e62a4)){_0x3e62a4['sendMessageOneNotActive']=!![];Promise[_0x19c8('0xb4')]()[_0x19c8('0x48')](checkIsIVRCampaignActive(_0x3e62a4))[_0x19c8('0x48')](checkInterval(_0x3e62a4))[_0x19c8('0x48')](_0x4f40fb['checkIsTrunkReachable'](_0x3e62a4))['then'](_0x4f40fb[_0x19c8('0x97')](_0x3e62a4[_0x19c8('0xb5')],_0x3e62a4[_0x19c8('0xb6')],_0x3e62a4[_0x19c8('0x6c')],_0x3e62a4))[_0x19c8('0x48')](_0x4f40fb['checkIfTimeIntervals'](_0x3e62a4[_0x19c8('0x7f')],_0x3e62a4[_0x19c8('0xb6')],_0x3e62a4[_0x19c8('0x6c')],_0x3e62a4))[_0x19c8('0x48')](_0x4f40fb[_0x19c8('0xb7')](_0x3e62a4))['catch'](loggerCatchQueueSummary('[syncCampaigns]',_0x3e62a4));}else{notSendMessagesCampaign(_0x3e62a4);}}}};Dialer[_0x19c8('0x1e')][_0x19c8('0xb8')]=function(_0x1c21d2){if(_0x1c21d2[_0x19c8('0xb9')]!==_0x19c8('0xc')){clearPredictiveAttributes(_0x1c21d2);}switch(_0x1c21d2[_0x19c8('0xb9')]){case _0x19c8('0xba'):this[_0x19c8('0xbb')](_0x1c21d2,0x1);break;case _0x19c8('0xbc'):this[_0x19c8('0xbb')](_0x1c21d2,_0x1c21d2[_0x19c8('0xbd')]);break;case'predictive':this[_0x19c8('0xc')](_0x1c21d2);break;case _0x19c8('0xb'):this[_0x19c8('0xbb')](_0x1c21d2,0x1);break;default:logger[_0x19c8('0x70')](_0x19c8('0xbe'),_0x1c21d2[_0x19c8('0x6c')],_0x19c8('0xbf'));}};Dialer[_0x19c8('0x1e')][_0x19c8('0x9a')]=function(_0x3ca9d8,_0x7cbe9e){var _0x468f29=_0x3ca9d8[_0x19c8('0xb6')];var _0x1db943=_0x7cbe9e?_0x3ca9d8['dialGlobalInterval']:_0x3ca9d8[_0x19c8('0x7f')][_0x19c8('0x82')];logger['silly'](_0x19c8('0xc0'),_0x1db943,_0x468f29,_0x3ca9d8[_0x19c8('0x6c')],util[_0x19c8('0x50')](_0x19c8('0xc1'),_0x3ca9d8[_0x19c8('0x6c')],_0x3ca9d8['id']));var _0x24091d=null;return Interval[_0x19c8('0xc2')](_0x1db943,_0x468f29)[_0x19c8('0x48')](function(_0x58f3cd){if(_0x58f3cd===!![]){return _0x58f3cd;}else{_0x3ca9d8[_0x19c8('0x72')]=_0x7cbe9e?utils['CAMPAIGN_STATUS'][_0x19c8('0xab')]:utils[_0x19c8('0x73')][_0x19c8('0xc3')];_0x24091d=msgResponse('[ifTime][promiseAll]',_0x19c8('0x9b'),_0x19c8('0xad')+_0x7cbe9e+'\x20'+_0x3ca9d8[_0x19c8('0x6c')]+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x1db943,{'showHidden':![],'depth':null})+_0x19c8('0xaf')+_0x468f29);}if(_0x24091d!==null){logger['silly']('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x24091d);_0x24091d['isGlobal']=_0x7cbe9e;throw _0x24091d;}})['catch'](function(_0xd53554){logger[_0x19c8('0x70')](_0x19c8('0xc4'),_0xd53554);throw msgResponse(_0x19c8('0x8c'),_0x19c8('0x8d'),util[_0x19c8('0x4f')](_0xd53554,{'showHidden':![],'depth':null}));});};Dialer[_0x19c8('0x1e')][_0x19c8('0x33')]=function(_0x49abe6){if(this[_0x19c8('0x24')][_0x49abe6[_0x19c8('0xc5')]]){if(this[_0x19c8('0x2c')][_0x49abe6[_0x19c8('0xc6')]]&&this[_0x19c8('0x2c')][_0x49abe6['uniqueid']][_0x19c8('0xc7')]!==_0x19c8('0xc8')){this[_0x19c8('0xc9')](this[_0x19c8('0x24')][_0x49abe6[_0x19c8('0xc5')]]);this['uniqueId'][_0x49abe6[_0x19c8('0xc6')]][_0x19c8('0xca')]=moment()['format'](_0x19c8('0xcb'));}}};Dialer['prototype'][_0x19c8('0x3a')]=function(_0x9611f0){var _0x3ad89e=this[_0x19c8('0x2c')][_0x9611f0['uniqueid']];if(this[_0x19c8('0x24')][_0x9611f0['queue']]){if(_0x3ad89e&&_0x3ad89e[_0x19c8('0xc7')]!==_0x19c8('0xc8')){delete this[_0x19c8('0x2c')][_0x9611f0['uniqueid']];this[_0x19c8('0x24')][_0x9611f0[_0x19c8('0xc5')]][_0x19c8('0xcc')]+=0x1;var _0xf6c7da=new AgentComplete(_0x3ad89e,_0x9611f0);if(_0x9611f0['reason']==='agent'){_0xf6c7da['agiafterat']=this[_0x19c8('0x24')][_0x9611f0[_0x19c8('0xc5')]][_0x19c8('0xcd')]&&this[_0x19c8('0x24')][_0x9611f0['queue']][_0x19c8('0xce')]?moment()[_0x19c8('0x50')](_0x19c8('0xcb')):undefined;}hopperUtils[_0x19c8('0xcf')](_0xf6c7da)[_0x19c8('0xa6')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0x19c8('0xd0')](_0xf6c7da)[_0x19c8('0xa6')](loggerCatch(_0x19c8('0xd1')));}}};Dialer[_0x19c8('0x1e')][_0x19c8('0x36')]=function(_0x54864b){var _0x5e8261=this[_0x19c8('0x2c')][_0x54864b[_0x19c8('0xc6')]];var _0x243ec1=this;var _0x7e8ed0=![];var _0x1247aa;var _0x23bd44;if(this[_0x19c8('0x24')][_0x54864b[_0x19c8('0xc5')]]){if(_0x5e8261&&_0x5e8261['type']!==_0x19c8('0xc8')){delete this['uniqueId'][_0x54864b['uniqueid']];this[_0x19c8('0xc9')](this['voiceQueues'][_0x54864b[_0x19c8('0xc5')]]);_0x5e8261['droptime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x47a237=new QueueCallerAbandon(_0x5e8261,_0x54864b);if(utils[_0x19c8('0x6b')](_0x5e8261[_0x19c8('0xd2')],_0x5e8261[_0x19c8('0xd3')])>=_0x5e8261[_0x19c8('0xd4')]){this[_0x19c8('0x24')][_0x54864b['queue']][_0x19c8('0xd5')]+=0x1;this[_0x19c8('0x24')][_0x54864b['queue']]['outboundDropCallsDayTimeout']+=0x1;this['voiceQueues'][_0x54864b[_0x19c8('0xc5')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x47a237[_0x19c8('0x77')]=0xa;_0x47a237[_0x19c8('0x78')]=_0x19c8('0xd6');_0x47a237[_0x19c8('0xd7')]=_0x19c8('0xd8');_0x47a237[_0x19c8('0xd9')]=this[_0x19c8('0x24')][_0x54864b[_0x19c8('0xc5')]][_0x19c8('0xcd')]?moment()[_0x19c8('0x50')](_0x19c8('0xcb')):undefined;_0x47a237['countdropretry']+=0x1;_0x47a237[_0x19c8('0xda')]+=0x1;_0x1247aa=this[_0x19c8('0x24')][_0x54864b['queue']][_0x19c8('0xdb')];_0x23bd44=this[_0x19c8('0x24')][_0x54864b[_0x19c8('0xc5')]][_0x19c8('0xdc')];hopperUtils['verifyAdditionalPhones'](_0x47a237,_0x47a237['state'],_0x5e8261[_0x19c8('0xdd')])['then'](function(_0x150607){_0x7e8ed0=_0x150607[_0x19c8('0xde')]==0x1;if(_0x47a237[_0x19c8('0xdf')]>=_0x243ec1[_0x19c8('0x24')][_0x54864b[_0x19c8('0xc5')]][_0x19c8('0xe0')]){_0x243ec1['queueCallerAbandonCreateState'](_0x47a237,_0x150607[_0x19c8('0xde')]);}else{hopperUtils[_0x19c8('0xe1')]({'active':![],'countdropretry':_0x47a237[_0x19c8('0xdf')],'scheduledat':moment()[_0x19c8('0xe2')](_0x243ec1[_0x19c8('0x24')][_0x54864b['queue']][_0x19c8('0xdb')],_0x19c8('0xe3'))['format'](_0x19c8('0xcb')),'ContactId':_0x5e8261[_0x19c8('0xe4')],'ListId':_0x5e8261[_0x19c8('0xe5')],'VoiceQueueId':_0x5e8261['VoiceQueueId']||undefined,'CampaignId':_0x5e8261[_0x19c8('0xe6')]||undefined})[_0x19c8('0xa6')](loggerCatch(_0x19c8('0xe7')));var _0x118a1d=new History(_0x47a237);_0x118a1d[_0x19c8('0x77')]=0xa;_0x118a1d[_0x19c8('0x78')]='Drop';_0x118a1d['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x118a1d['endtime']=_0x118a1d['starttime'];_0x118a1d[_0x19c8('0xe8')]=_0x47a237[_0x19c8('0xe8')];_0x118a1d['calleridnum']=_0x47a237[_0x19c8('0xe9')];hopperUtils[_0x19c8('0xcf')](_0x118a1d)[_0x19c8('0xa6')](loggerCatch(_0x19c8('0xea')));}})['then'](function(){if(_0x7e8ed0)hopperUtils[_0x19c8('0xeb')](_0x47a237,_0x1247aa,_0x23bd44)[_0x19c8('0x48')](function(){return 0x1;});});}else{this[_0x19c8('0x24')][_0x54864b[_0x19c8('0xc5')]][_0x19c8('0xec')]+=0x1;this['voiceQueues'][_0x54864b['queue']][_0x19c8('0xed')]+=0x1;_0x47a237[_0x19c8('0x77')]=0xb;_0x47a237[_0x19c8('0x78')]=_0x19c8('0xee');_0x47a237[_0x19c8('0xd7')]=_0x19c8('0xef');_0x47a237[_0x19c8('0xf0')]+=0x1;_0x47a237[_0x19c8('0xda')]+=0x1;_0x1247aa=this['voiceQueues'][_0x54864b[_0x19c8('0xc5')]][_0x19c8('0xf1')];_0x23bd44=this[_0x19c8('0x24')][_0x54864b[_0x19c8('0xc5')]][_0x19c8('0xdc')];hopperUtils['verifyAdditionalPhones'](_0x47a237,_0x47a237[_0x19c8('0x77')],_0x5e8261['voiceQueue'])[_0x19c8('0x48')](function(_0x302eab){if(_0x47a237[_0x19c8('0xf0')]>=_0x243ec1[_0x19c8('0x24')][_0x54864b[_0x19c8('0xc5')]][_0x19c8('0xf2')]){_0x243ec1[_0x19c8('0xf3')](_0x47a237,_0x302eab[_0x19c8('0xde')]);}else{hopperUtils[_0x19c8('0xe1')]({'active':![],'countabandonedretry':_0x47a237[_0x19c8('0xf0')],'scheduledat':moment()[_0x19c8('0xe2')](_0x243ec1[_0x19c8('0x24')][_0x54864b[_0x19c8('0xc5')]][_0x19c8('0xf1')],'minutes')[_0x19c8('0x50')](_0x19c8('0xcb')),'ContactId':_0x5e8261[_0x19c8('0xe4')],'ListId':_0x5e8261['ListId'],'VoiceQueueId':_0x5e8261[_0x19c8('0xf4')]||undefined,'CampaignId':_0x5e8261[_0x19c8('0xe6')]||undefined})[_0x19c8('0xa6')](loggerCatch(_0x19c8('0xf5')));var _0x484131=new History(_0x47a237);_0x484131[_0x19c8('0x77')]=0xb;_0x484131[_0x19c8('0x78')]='Abandoned';_0x484131[_0x19c8('0x79')]=moment()['format'](_0x19c8('0xcb'));_0x484131['endtime']=_0x484131[_0x19c8('0x79')];_0x484131[_0x19c8('0xe8')]=_0x47a237[_0x19c8('0xe8')];_0x484131[_0x19c8('0xe9')]=_0x47a237[_0x19c8('0xe9')];hopperUtils[_0x19c8('0xcf')](_0x484131)['catch'](loggerCatch(_0x19c8('0xf6')));}})[_0x19c8('0x48')](function(){if(_0x7e8ed0)hopperUtils[_0x19c8('0xeb')](_0x47a237,_0x1247aa,_0x23bd44)[_0x19c8('0x48')](function(){return 0x1;});});}}}};Dialer['prototype']['syncNewExten']=function(_0x44070e){if(this[_0x19c8('0x2a')][_0x44070e[_0x19c8('0xc6')]]){this[_0x19c8('0x2a')][_0x44070e[_0x19c8('0xc6')]]['channel']=_0x44070e['channel'];}if(this[_0x19c8('0x2c')][_0x44070e[_0x19c8('0xc6')]]){this[_0x19c8('0x2c')][_0x44070e[_0x19c8('0xc6')]][_0x19c8('0xf7')]=_0x44070e['channel'];}};Dialer[_0x19c8('0x1e')][_0x19c8('0x44')]=function(_0x4be3b5){if(!this['actions'][_0x4be3b5[_0x19c8('0xf8')]]){return;}var _0x462422=this['voiceQueues'][this['actions'][_0x4be3b5[_0x19c8('0xf8')]]['queue']][_0x19c8('0xf9')]||'rrmemory';if(_0x462422===_0x19c8('0xfa')){if(this[_0x19c8('0x2a')][_0x4be3b5['actionid']]&&_[_0x19c8('0xfb')](this['actions'][_0x4be3b5[_0x19c8('0xf8')]][_0x19c8('0xfc')])&&_0x4be3b5[_0x19c8('0x90')]==='1'&&_0x4be3b5[_0x19c8('0xfd')]==='0'){if(this[_0x19c8('0x26')][_0x4be3b5[_0x19c8('0xfe')]]){if(!this[_0x19c8('0x26')][_0x4be3b5[_0x19c8('0xfe')]]['locked']){this['agents'][_0x4be3b5[_0x19c8('0xfe')]][_0x19c8('0xfc')]=!![];this[_0x19c8('0x2a')][_0x4be3b5[_0x19c8('0xf8')]][_0x19c8('0xfc')]=!![];this[_0x19c8('0x2a')][_0x4be3b5[_0x19c8('0xf8')]][_0x19c8('0xfe')]=_0x4be3b5[_0x19c8('0xfe')];}}}}else if(_0x462422===_0x19c8('0xff')){if(this[_0x19c8('0x2a')][_0x4be3b5['actionid']]){if(this[_0x19c8('0x26')][_0x4be3b5[_0x19c8('0xfe')]]){this[_0x19c8('0x2a')][_0x4be3b5[_0x19c8('0xf8')]][_0x19c8('0xfe')]=_0x4be3b5[_0x19c8('0xfe')];if(_[_0x19c8('0xfb')](this[_0x19c8('0x30')][this['actions'][_0x4be3b5[_0x19c8('0xf8')]][_0x19c8('0xc5')]])){this[_0x19c8('0x30')][this[_0x19c8('0x2a')][_0x4be3b5[_0x19c8('0xf8')]]['queue']]=[];}this[_0x19c8('0x30')][this[_0x19c8('0x2a')][_0x4be3b5[_0x19c8('0xf8')]][_0x19c8('0xc5')]]['push'](_[_0x19c8('0x6a')](_[_0x19c8('0x7e')](this['actions'][_0x4be3b5[_0x19c8('0xf8')]],[_0x19c8('0x100'),_0x19c8('0xfe')]),{'status':_0x4be3b5[_0x19c8('0x90')],'paused':_0x4be3b5[_0x19c8('0xfd')]}));}}}};Dialer[_0x19c8('0x1e')]['syncQueueStatusComplete']=function(_0x207084){if(!this[_0x19c8('0x2a')][_0x207084['actionid']]){return;}var _0x373c78=this;var _0x2dc359=this[_0x19c8('0x24')][this[_0x19c8('0x2a')][_0x207084['actionid']][_0x19c8('0xc5')]];var _0x40b738=_0x2dc359[_0x19c8('0xf9')]||_0x19c8('0xff');if(_0x40b738==='roundrobin'){if(this[_0x19c8('0x2a')][_0x207084[_0x19c8('0xf8')]]&&this[_0x19c8('0x2a')][_0x207084[_0x19c8('0xf8')]][_0x19c8('0xfe')]){this['preview'][_0x19c8('0x101')](this[_0x19c8('0x2a')][_0x207084[_0x19c8('0xf8')]][_0x19c8('0x100')],this[_0x19c8('0x2a')][_0x207084[_0x19c8('0xf8')]][_0x19c8('0xfe')])['catch'](function(_0x3cd424){logger[_0x19c8('0x70')]('[Catch][Preview][syncQueueStatusComplete]',util['inspect'](_0x3cd424,{'showHidden':![],'depth':null}));})[_0x19c8('0x21')](function(){_0x373c78[_0x19c8('0xc9')](_0x373c78['voiceQueues'][_0x373c78['actions'][_0x207084['actionid']]['queue']]);_0x373c78[_0x19c8('0x26')][_0x373c78[_0x19c8('0x2a')][_0x207084[_0x19c8('0xf8')]][_0x19c8('0xfe')]]['locked']=![];delete _0x373c78[_0x19c8('0x2a')][_0x207084['actionid']];unlockQueueStatus(_0x2dc359);});}else{this[_0x19c8('0xc9')](this[_0x19c8('0x24')][this[_0x19c8('0x2a')][_0x207084[_0x19c8('0xf8')]][_0x19c8('0xc5')]]);hopperUtils['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x207084[_0x19c8('0xf8')]][_0x19c8('0xe4')],'ListId':this['actions'][_0x207084[_0x19c8('0xf8')]]['ListId'],'VoiceQueueId':this[_0x19c8('0x2a')][_0x207084[_0x19c8('0xf8')]]['VoiceQueueId']||undefined,'CampaignId':this['actions'][_0x207084[_0x19c8('0xf8')]][_0x19c8('0xe6')]||undefined})[_0x19c8('0xa6')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x19c8('0x2a')][_0x207084['actionid']];unlockQueueStatus(_0x2dc359);}}else if(_0x40b738===_0x19c8('0xff')){var _0x21ae6a;if(this[_0x19c8('0x2a')][_0x207084[_0x19c8('0xf8')]]&&!_['isEmpty'](this[_0x19c8('0x30')][this['actions'][_0x207084[_0x19c8('0xf8')]][_0x19c8('0xc5')]])){if(this[_0x19c8('0x102')][_0x373c78['actions'][_0x207084[_0x19c8('0xf8')]][_0x19c8('0xc5')]]){this[_0x19c8('0x102')][_0x373c78[_0x19c8('0x2a')][_0x207084[_0x19c8('0xf8')]][_0x19c8('0xc5')]]=this['queueBookedRR'][this['actions'][_0x207084[_0x19c8('0xf8')]]['queue']]?this['queueBookedRR'][this[_0x19c8('0x2a')][_0x207084[_0x19c8('0xf8')]][_0x19c8('0xc5')]]:this[_0x19c8('0x30')][this['actions'][_0x207084[_0x19c8('0xf8')]][_0x19c8('0xc5')]]?this['queueBooked'][this[_0x19c8('0x2a')][_0x207084[_0x19c8('0xf8')]][_0x19c8('0xc5')]][_0x19c8('0x103')]||0x0:0x0;}this[_0x19c8('0x30')][this[_0x19c8('0x2a')][_0x207084['actionid']][_0x19c8('0xc5')]][_0x19c8('0x103')]=this['queueBookedRR'][this[_0x19c8('0x2a')][_0x207084[_0x19c8('0xf8')]][_0x19c8('0xc5')]];for(var _0x14ebe5=0x0;_0x14ebe5=_0x1ef1fa['dialGlobalMaxRetry']){_0x1d741e[_0x19c8('0x12a')](_0x1a1d21,_0x54c10,_0x26199f,'reason19\x20machine....');}else{if(_0x1a1d21[_0x19c8('0x12b')]>=_0x1ef1fa[_0x19c8('0x12c')]){_0x1d741e[_0x19c8('0x12d')](_0x1a1d21,_0x54c10,_0x26199f,_0x19c8('0x12e'));}else{hopperUtils[_0x19c8('0xe1')]({'active':![],'countmachineretry':_0x1a1d21['countmachineretry'],'scheduledat':moment()[_0x19c8('0xe2')](_0x1ef1fa[_0x19c8('0x12f')],_0x19c8('0xe3'))['format'](_0x19c8('0xcb')),'ContactId':_0x1a1d21[_0x19c8('0xe4')],'ListId':_0x1a1d21[_0x19c8('0xe5')],'VoiceQueueId':_0x1a1d21[_0x19c8('0xf4')]||undefined,'CampaignId':_0x1a1d21[_0x19c8('0xe6')]||undefined})[_0x19c8('0xa6')](loggerCatch(_0x19c8('0x130')));_0x54c10({'reschedule':0x1});}}});}if(_0x1fc530[_0x19c8('0xc7')]==='ivr'&&this[_0x19c8('0x25')][_0x1fc530[_0x19c8('0xc5')]][_0x19c8('0x116')]&&_0x282348[_0x19c8('0x120')]===_0x19c8('0x117')){delete this['uniqueId'][_0x282348[_0x19c8('0xc6')]];this[_0x19c8('0xc9')](this[_0x19c8('0x25')][_0x1fc530[_0x19c8('0xc5')]]);_0xf7ca35=new Hangup(_0x1fc530,_0x282348);_0xf7ca35[_0x19c8('0x77')]=0x12;_0xf7ca35['statedesc']=_0x19c8('0x119');_0xf7ca35['membername']=_0x19c8('0x123');ami[_0x19c8('0x4b')]('custom:amd',ut['buildObj'](_0xf7ca35,_0x19c8('0x11c')));this[_0x19c8('0x11d')](_0xf7ca35,_0x19c8('0x131'),'[syncHangupInAMDIvr]');}if(_0x1fc530[_0x19c8('0xc7')]===_0x19c8('0xc8')&&this[_0x19c8('0x25')][_0x1fc530[_0x19c8('0xc5')]][_0x19c8('0x116')]&&_0x282348[_0x19c8('0x120')]===_0x19c8('0x121')){return new Promise(function(_0x28e193,_0x334dde){delete _0x1d741e[_0x19c8('0x2c')][_0x282348[_0x19c8('0xc6')]];_0x1d741e[_0x19c8('0xc9')](_0x1d741e[_0x19c8('0x25')][_0x1fc530[_0x19c8('0xc5')]]);_0x1d741e[_0x19c8('0x25')][_0x1fc530[_0x19c8('0xc5')]][_0x19c8('0xcc')]+=0x1;_0x1d741e['campaigns'][_0x1fc530[_0x19c8('0xc5')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x4950a3=_0x1d741e[_0x19c8('0x25')][_0x1fc530[_0x19c8('0xc5')]];var _0x6e46bc=new Hangup(_0x1fc530,_0x282348);_0x6e46bc['state']=0x13;_0x6e46bc['statedesc']=_0x19c8('0x122');_0x6e46bc[_0x19c8('0x11a')]=_0x19c8('0x123');_0x6e46bc[_0x19c8('0x12b')]+=0x1;_0x6e46bc['countglobal']+=0x1;_0x6e46bc[_0x19c8('0x11c')]=!![];ami[_0x19c8('0x4b')](_0x19c8('0x11b'),ut[_0x19c8('0x132')](_0x6e46bc,_0x19c8('0x11c')));hopperUtils['createHistory'](_0x6e46bc)[_0x19c8('0xa6')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x6e46bc[_0x19c8('0x125')]+_0x6e46bc[_0x19c8('0x126')]+_0x6e46bc[_0x19c8('0x127')]+_0x6e46bc['countnosuchnumberretry']+_0x6e46bc['countdropretry']+_0x6e46bc[_0x19c8('0xf0')]+_0x6e46bc[_0x19c8('0x12b')]+_0x6e46bc[_0x19c8('0x129')]>=_0x4950a3[_0x19c8('0x133')]){_0x1d741e[_0x19c8('0x12a')](_0x6e46bc,_0x28e193,_0x334dde,_0x19c8('0x134'));}else{if(_0x6e46bc[_0x19c8('0x12b')]>=_0x4950a3['dialMachineMaxRetry']){_0x1d741e[_0x19c8('0x12d')](_0x6e46bc,_0x28e193,_0x334dde,'reason\x2019\x20machine....');}else{hopperUtils[_0x19c8('0xe1')]({'active':![],'countmachineretry':_0x6e46bc[_0x19c8('0x12b')],'scheduledat':moment()[_0x19c8('0xe2')](_0x4950a3[_0x19c8('0x12f')],_0x19c8('0xe3'))[_0x19c8('0x50')](_0x19c8('0xcb')),'ContactId':_0x6e46bc['ContactId'],'ListId':_0x6e46bc[_0x19c8('0xe5')],'VoiceQueueId':_0x6e46bc[_0x19c8('0xf4')]||undefined,'CampaignId':_0x6e46bc[_0x19c8('0xe6')]||undefined})[_0x19c8('0xa6')](loggerCatch(_0x19c8('0x130')));_0x28e193({'reschedule':0x1});}}});}}};Dialer[_0x19c8('0x1e')][_0x19c8('0x3e')]=function(_0x3d0506){var _0xeb94a9=this['uniqueId'][_0x3d0506['uniqueid']];var _0x4d2660;if(_0xeb94a9&&_0xeb94a9[_0x19c8('0xc7')]===_0x19c8('0xc8')){delete this[_0x19c8('0x2c')][_0x3d0506[_0x19c8('0xc6')]];this[_0x19c8('0xc9')](this[_0x19c8('0x25')][_0xeb94a9[_0x19c8('0xc5')]]);this[_0x19c8('0x25')][_0xeb94a9['queue']][_0x19c8('0x135')]+=0x1;_0x4d2660=new Hangup(_0xeb94a9,_0x3d0506);hopperUtils[_0x19c8('0xcf')](_0x4d2660)[_0x19c8('0xa6')](loggerCatch(_0x19c8('0x136')));hopperUtils[_0x19c8('0xd0')](_0x4d2660)[_0x19c8('0xa6')](loggerCatch(_0x19c8('0x137')));}if(_0xeb94a9&&_0xeb94a9[_0x19c8('0xc7')]!==_0x19c8('0xc8')&&isNotNull(this[_0x19c8('0x24')][_0xeb94a9['queue']][_0x19c8('0x138')])){delete this[_0x19c8('0x2c')][_0x3d0506[_0x19c8('0xc6')]];this[_0x19c8('0xc9')](this['voiceQueues'][_0xeb94a9[_0x19c8('0xc5')]]);this[_0x19c8('0x24')][_0xeb94a9[_0x19c8('0xc5')]][_0x19c8('0xcc')]+=0x1;this['voiceQueues'][_0xeb94a9[_0x19c8('0xc5')]][_0x19c8('0x118')]+=0x1;_0x4d2660=new Hangup(_0xeb94a9,_0x3d0506);_0x4d2660[_0x19c8('0x77')]=0x10;_0x4d2660['statedesc']=_0x19c8('0x139');_0x4d2660[_0x19c8('0x11a')]=_0x19c8('0x13a');hopperUtils[_0x19c8('0xcf')](_0x4d2660)[_0x19c8('0xa6')](loggerCatch(_0x19c8('0x136')));hopperUtils[_0x19c8('0xd0')](_0x4d2660)[_0x19c8('0xa6')](loggerCatch(_0x19c8('0x137')));}if(_0xeb94a9&&_0xeb94a9['type']!==_0x19c8('0xc8')&&!isNotNull(this[_0x19c8('0x24')][_0xeb94a9[_0x19c8('0xc5')]][_0x19c8('0x138')])){delete this[_0x19c8('0x2c')][_0x3d0506['uniqueid']];this['updateOriginated'](this['voiceQueues'][_0xeb94a9[_0x19c8('0xc5')]]);this['voiceQueues'][_0xeb94a9[_0x19c8('0xc5')]][_0x19c8('0x13b')]+=0x1;_0x4d2660=new Hangup(_0xeb94a9,_0x3d0506);_0x4d2660[_0x19c8('0x77')]=0xc;_0x4d2660[_0x19c8('0x78')]=_0x3d0506[_0x19c8('0x13c')];_0x4d2660[_0x19c8('0x11a')]='Unknow';hopperUtils[_0x19c8('0xcf')](_0x4d2660)[_0x19c8('0xa6')](loggerCatch(_0x19c8('0x136')));hopperUtils[_0x19c8('0xd0')](_0x4d2660)[_0x19c8('0xa6')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x19c8('0x1e')][_0x19c8('0xe')]=function(_0x2f7e97){var _0x481ba8=this;if(!_0x481ba8[_0x19c8('0x31')][_0x2f7e97[_0x19c8('0x6c')]]){_0x481ba8[_0x19c8('0x31')][_0x2f7e97['name']]={'running':![]};}else if(_0x481ba8[_0x19c8('0x31')][_0x2f7e97[_0x19c8('0x6c')]][_0x19c8('0x13d')]===!![]){return;}else if(_0x481ba8[_0x19c8('0x31')][_0x2f7e97[_0x19c8('0x6c')]][_0x19c8('0x13d')]===![]){_0x481ba8['queuesSummary'][_0x2f7e97['name']][_0x19c8('0x13d')]=!![];}var _0x2025c7=_0x481ba8[_0x19c8('0x24')][_0x2f7e97[_0x19c8('0x6c')]];var _0x48c9db=_0x2025c7[_0x19c8('0x72')]!==utils[_0x19c8('0x73')][_0x19c8('0x87')];var _0x532973=utils[_0x19c8('0x13e')](_0x2025c7);_0x2025c7[_0x19c8('0x13f')]=utils[_0x19c8('0x140')](_0x2025c7,_0x481ba8[_0x19c8('0x27')]);Promise[_0x19c8('0xb4')]()[_0x19c8('0x48')](function(){if(_0x2025c7[_0x19c8('0x13f')]===utils[_0x19c8('0x73')][_0x19c8('0x87')]){if(_0x48c9db){clearPredictiveAttributes(_0x2025c7);_0x2f7e97[_0x19c8('0x2d')]=undefined;_0x2f7e97[_0x19c8('0x2e')]=undefined;}if(_0x2025c7[_0x19c8('0x13f')]===utils[_0x19c8('0x73')][_0x19c8('0x87')]){_0x2f7e97[_0x19c8('0x141')]=0x0;_0x2f7e97[_0x19c8('0xfd')]=0x0;_0x2f7e97[_0x19c8('0x142')]=0x0;_0x2f7e97[_0x19c8('0x143')]=0x0;_0x2f7e97[_0x19c8('0x144')]=0x0;}}else if(_0x2025c7['statusMessage']===utils['CAMPAIGN_STATUS'][_0x19c8('0x145')]&&!_0x532973){return _0x481ba8[_0x19c8('0x9a')](_0x2025c7,!![])['then'](function(){return _0x481ba8[_0x19c8('0x9a')](_0x2025c7,![]);})['then'](function(){return _0x481ba8[_0x19c8('0xb8')](_0x2025c7);})[_0x19c8('0xa6')](function(_0x2450db){loggerSyncQueueSummary[_0x19c8('0x4d')]('[syncQueueSummary]',util[_0x19c8('0x4f')](_0x2450db,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x2025c7);});}else{clearPredictiveAttributes(_0x2025c7);}})['then'](function(){var _0x250a89=_0x2f7e97[_0x19c8('0x146')](_0x2025c7);if(_0x250a89||_0x2025c7[_0x19c8('0x147')]){_0x2025c7[_0x19c8('0x147')]=![];_0x2f7e97[_0x19c8('0x148')](_0x2025c7);Object['assign'](_0x2025c7,_0x2f7e97);emitOutboundVoiceQueueSummary(_0x2f7e97);}_0x481ba8[_0x19c8('0x31')][_0x2025c7[_0x19c8('0x6c')]][_0x19c8('0x13d')]=![];})[_0x19c8('0xa6')](function(_0xf0b13e){logger[_0x19c8('0x70')](_0x19c8('0x149'),util[_0x19c8('0x4f')](_0xf0b13e,{'showHidden':![],'depth':null}));_0x481ba8[_0x19c8('0x31')][_0x2025c7['name']]['running']=![];});};Dialer[_0x19c8('0x1e')][_0x19c8('0x3d')]=_[_0x19c8('0x14a')](function(){var _0x23234a=_['filter'](this[_0x19c8('0x24')],function(_0xc63021){return _0xc63021[_0x19c8('0x14b')];});var _0x40df40=_[_0x19c8('0x14c')](this['agents'],function(_0x4cc9b0){return _0x4cc9b0[_0x19c8('0x14d')]&&_0x4cc9b0[_0x19c8('0x90')]===_0x19c8('0x14e');});if(_0x23234a[_0x19c8('0x9f')]>0x0&&_0x40df40['length']>0x0){return Promise[_0x19c8('0xb4')]()[_0x19c8('0x48')](cmHopper[_0x19c8('0x14f')](_[_0x19c8('0x150')](_0x23234a,'id'),previewRecallmeReminderInterval,_[_0x19c8('0x150')](_0x40df40,'id')))[_0x19c8('0x48')](function(_0x218de7){for(var _0x519755=0x0;_0x519755<_0x218de7[_0x19c8('0x9f')];_0x519755++){var _0x1838f1=_0x218de7[_0x519755][_0x19c8('0x151')][_0x19c8('0x6c')];if(_0x1838f1)io['to'](util[_0x19c8('0x50')](_0x19c8('0x152'),_0x1838f1))[_0x19c8('0x4b')]('user:dialPreviewRecallReminder',{'hopper':_0x218de7[_0x519755]});}})[_0x19c8('0xa6')](function(_0x192290){logger['error'](_0x19c8('0x153'),_0x192290);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x19c8('0x1e')][_0x19c8('0x47')]=function(){var _0x3cbc7d=this;setInterval(function(){_0x3cbc7d[_0x19c8('0x154')](_0x3cbc7d[_0x19c8('0x2c')],_0x19c8('0x155'));_0x3cbc7d[_0x19c8('0x154')](_0x3cbc7d[_0x19c8('0x2a')],_0x19c8('0x156'));},0x32c8);};Dialer[_0x19c8('0x1e')][_0x19c8('0x154')]=function(_0x58f8bc,_0x279781){var _0x1241d7=this;for(var _0x50a03c in _0x58f8bc){if(typeof _0x58f8bc[_0x50a03c]!==_0x19c8('0xb2')){this['sequence']['enqueue'](function(){if(!_[_0x19c8('0xfb')](_0x58f8bc[_0x50a03c])){return ami[_0x19c8('0xa7')]({'action':_0x19c8('0x90'),'channel':_0x58f8bc[_0x50a03c][_0x19c8('0xf7')]})['catch'](function(_0x364919){if(_0x364919[_0x19c8('0x72')]===_0x19c8('0x157')){setTimeout(function(){if(_0x58f8bc[_0x50a03c]&&_0x58f8bc[_0x50a03c][_0x19c8('0xc7')]!==_0x19c8('0xc8')){_0x1241d7[_0x19c8('0xc9')](_0x1241d7['voiceQueues'][_0x58f8bc[_0x50a03c]['queue']]);logger[_0x19c8('0x70')](_0x19c8('0x158'),_0x279781,_0x50a03c,_0x58f8bc[_0x50a03c]['queue']);delete _0x58f8bc[_0x50a03c];}if(_0x58f8bc[_0x50a03c]&&_0x58f8bc[_0x50a03c][_0x19c8('0xc7')]==='ivr'){_0x1241d7[_0x19c8('0xc9')](_0x1241d7[_0x19c8('0x25')][_0x58f8bc[_0x50a03c][_0x19c8('0xc5')]]);logger['error'](_0x19c8('0x159'),_0x279781,_0x50a03c,_0x58f8bc[_0x50a03c][_0x19c8('0xc5')]);delete _0x58f8bc[_0x50a03c];}},0x2328);}});}});}}};Dialer[_0x19c8('0x1e')][_0x19c8('0x15a')]=function(_0x3b75d9){return Promise[_0x19c8('0xb4')]()[_0x19c8('0x48')](voiceQueueRt['getVoiceQueueRtPauses'](_0x3b75d9))['catch'](loggerCatch(_0x19c8('0x15b')));};Dialer['prototype'][_0x19c8('0xc9')]=function(_0x1ea199){if(!_[_0x19c8('0x4a')](_0x1ea199)&&_0x1ea199!==null){if(typeof _0x1ea199[_0x19c8('0x85')]!=='undefined'){if(_0x1ea199['originated']>0x0){_0x1ea199['originated']-=0x1;}else{logger['error'](_0x19c8('0x15c'));}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x19c8('0x1e')][_0x19c8('0x15d')]=function(_0x4b9c83,_0x9d8adc){var _0x1f27fe=this;return function(_0x254ee1){_0x1f27fe[_0x19c8('0xc9')](_0x9d8adc);logger[_0x19c8('0x70')](_0x4b9c83,util['inspect'](_0x254ee1,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x19c8('0x15e')]=function(_0x5bee31,_0x3e031d,_0x2aed48){var _0x247f23={'state':0x19,'statedesc':'notFound'};this[_0x19c8('0xc9')](_0x3e031d);this['saveInDb'](_[_0x19c8('0x6a')](_0x247f23,_[_0x19c8('0x7e')](_0x2aed48,[_0x19c8('0xe4'),_0x19c8('0xe5'),_0x19c8('0x15f'),_0x19c8('0xf4'),_0x19c8('0xe6')])),_0x19c8('0x160'),'[emptyContact]');logger['error'](_0x5bee31);};Dialer['prototype'][_0x19c8('0x11d')]=function(_0xd95d47,_0x5ea07f,_0x283a8a){hopperUtils[_0x19c8('0xcf')](_0xd95d47)[_0x19c8('0xa6')](loggerCatch(_0x5ea07f));hopperUtils[_0x19c8('0xd0')](_0xd95d47)[_0x19c8('0xa6')](loggerCatch(_0x283a8a));};Dialer['prototype']['queueCallerAbandonCreateState']=function(_0x4a9801,_0x14c84e){hopperUtils[_0x19c8('0xcf')](_0x4a9801)[_0x19c8('0xa6')](loggerCatch(_0x19c8('0x161')));if(_0x14c84e==0x0){hopperUtils[_0x19c8('0xd0')](_0x4a9801)['catch'](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0x19c8('0x1e')][_0x19c8('0x153')]=function(_0x451ace){return Promise[_0x19c8('0xb4')]()[_0x19c8('0x48')](cmHopper['handlePreviewRecallNotifications'](_0x451ace['id'],previewRecallmeReminderInterval))[_0x19c8('0x48')](function(_0x15e9fc){for(var _0x58b739=0x0;_0x58b739<_0x15e9fc[_0x19c8('0x9f')];_0x58b739++){var _0x5db540=_0x15e9fc[_0x58b739]['Agent'][_0x19c8('0x6c')];if(_0x5db540)io['to'](util[_0x19c8('0x50')]('user:%s',_0x5db540))[_0x19c8('0x4b')](_0x19c8('0x162'),{'hopper':_0x15e9fc[_0x58b739]});}})[_0x19c8('0xa6')](function(){});};Dialer[_0x19c8('0x1e')][_0x19c8('0xb7')]=function(_0xf5ab9c){var _0x1a888d=this;return function(){_0x1a888d[_0x19c8('0x163')](_0xf5ab9c);};};Dialer[_0x19c8('0x1e')]['actionOriginate']=function(_0x3be67b,_0xc174c2){var _0x2f1773=this;var _0x1497a6=uuid['v4']();this[_0x19c8('0x2a')][_0x1497a6]=new Action(_0x3be67b,_0xc174c2,_0x1497a6);return new Promise(function(_0x12743a,_0x3f5ca6){if(_[_0x19c8('0x4a')](_0x3be67b)&&typeof _0x3be67b!==_0x19c8('0x164')){return _0x3f5ca6(msgResponse(_0x19c8('0x165'),'Failure',_0x19c8('0x166')));}if(_['isUndefined'](_0xc174c2[_0x19c8('0x167')])||_0xc174c2[_0x19c8('0x167')]===null){return _0x3f5ca6(msgResponse(_0x19c8('0x165'),_0x19c8('0x9b'),'contact\x20is\x20undefine'));}var _0x355d40={'XMD-CALLERID':_0x2f1773['actions'][_0x1497a6][_0x19c8('0x168')](),'XMD-AGI':_0x3be67b['dialQueueProject']?util['format'](_0x19c8('0x169'),ipAgi,_0x3be67b['dialQueueProject']):_0x19c8('0x16a'),'XMD-AGIAFTER':_0x3be67b['dialQueueProject2']?util[_0x19c8('0x50')](_0x19c8('0x169'),ipAgi,_0x3be67b['dialQueueProject2']):_0x19c8('0x16a'),'XMD-QUEUE':utils[_0x19c8('0x16b')](_0x3be67b)?util[_0x19c8('0x50')]('\x22%s,%s%s,,,%s\x22',_0x3be67b[_0x19c8('0x6c')],_0x3be67b[_0x19c8('0x16c')]||'',_0x3be67b[_0x19c8('0xce')]?'c':'',_0x3be67b['dialQueueTimeout']||0x3):_0x19c8('0x16a'),'XMD-CONTACTID':_0xc174c2['ContactId'],'XMD-CDRTYPE':_0x19c8('0xa'),'CALLERID(all)':_0x2f1773['actions'][_0x1497a6][_0x19c8('0x168')](),'XMD-AMD':_0x3be67b[_0x19c8('0x116')]?_0x19c8('0x145'):'NONE','XMD-DESTINATION':'xcally-motion-dialer'};if(_0x3be67b['dialAMDActive']){_0x355d40[_0x19c8('0x16d')]=_0x3be67b['dialAMDInitialSilence']||0x9c4;_0x355d40[_0x19c8('0x16e')]=_0x3be67b[_0x19c8('0x16f')]||0x5dc;_0x355d40[_0x19c8('0x170')]=_0x3be67b[_0x19c8('0x171')]||0x320;_0x355d40[_0x19c8('0x172')]=_0x3be67b['dialAMDTotalAnalysisTime']||0x1388;_0x355d40[_0x19c8('0x173')]=_0x3be67b['dialAMDMinWordLength']||0x64;_0x355d40[_0x19c8('0x174')]=_0x3be67b[_0x19c8('0x175')]||0x32;_0x355d40[_0x19c8('0x176')]=_0x3be67b[_0x19c8('0x177')]||0x3;_0x355d40[_0x19c8('0x178')]=_0x3be67b['dialAMDSilenceThreshold']||0x100;_0x355d40[_0x19c8('0x179')]=_0x3be67b[_0x19c8('0x17a')]||0x1388;}if(utils[_0x19c8('0x16b')](_0x3be67b)){_0x355d40[_0x19c8('0x17b')]=_0xc174c2[_0x19c8('0xf4')];}else{_0x355d40[_0x19c8('0x17c')]=_0xc174c2[_0x19c8('0xe6')];}var _0x5e5786=utils[_0x19c8('0x17d')](_0xc174c2[_0x19c8('0x17e')]);Object[_0x19c8('0x17f')](_0x355d40,_0x5e5786);var _0x5d1685=_0x2f1773['isTrunkReachable'](_0x3be67b[_0x19c8('0x94')])?utils[_0x19c8('0x180')](_0x3be67b[_0x19c8('0x94')][_0x19c8('0x181')],_0x3be67b[_0x19c8('0x182')],_0x3be67b[_0x19c8('0x183')]>0x0?utils[_0x19c8('0x184')](_0x3be67b['dialOriginateCallerIdNumber'],_0x3be67b[_0x19c8('0x183')]):_0x3be67b[_0x19c8('0x185')]):utils[_0x19c8('0x180')](_[_0x19c8('0xfb')](_0x3be67b['TrunkBackup'])?_0x3be67b[_0x19c8('0x94')][_0x19c8('0x181')]:_0x3be67b[_0x19c8('0x186')][_0x19c8('0x181')],_0x3be67b['dialOriginateCallerIdName'],_0x3be67b['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x19c8('0x184')](_0x3be67b[_0x19c8('0x185')],_0x3be67b[_0x19c8('0x183')]):_0x3be67b[_0x19c8('0x185')]);if(_0x5d1685){_0x355d40['XMD-ORIGINATECALLERIDNAME']=_0x2f1773['actions'][_0x1497a6][_0x19c8('0x187')]=utils[_0x19c8('0x188')](_0x5d1685);_0x355d40[_0x19c8('0x189')]=_0xc174c2['phone'];}_0x3be67b[_0x19c8('0x18a')]=_0x355d40;return ami[_0x19c8('0xa7')]({'actionid':_0x1497a6,'action':_0x19c8('0x165'),'channel':_0x2f1773['isTrunkReachable'](_0x3be67b[_0x19c8('0x94')])?util[_0x19c8('0x50')](_0x19c8('0x18b'),_0x3be67b[_0x19c8('0x94')][_0x19c8('0x6c')],isNotNull(_0x3be67b[_0x19c8('0x18c')])?_0x3be67b[_0x19c8('0x18c')][_0x19c8('0x18d')]()||'':'',_0x3be67b[_0x19c8('0x18e')]>0x0?_0xc174c2[_0x19c8('0x167')]['substring'](_0x3be67b[_0x19c8('0x18e')]):_0xc174c2[_0x19c8('0x167')]):util[_0x19c8('0x50')](_0x19c8('0x18b'),_[_0x19c8('0xfb')](_0x3be67b[_0x19c8('0x186')])?_0x3be67b[_0x19c8('0x94')][_0x19c8('0x6c')]:_0x3be67b['TrunkBackup'][_0x19c8('0x6c')],isNotNull(_0x3be67b[_0x19c8('0x18c')])?_0x3be67b[_0x19c8('0x18c')][_0x19c8('0x18d')]()||'':'',_0x3be67b[_0x19c8('0x18e')]>0x0?_0xc174c2[_0x19c8('0x167')][_0x19c8('0x18f')](_0x3be67b[_0x19c8('0x18e')]):_0xc174c2[_0x19c8('0x167')]),'callerid':_0x5d1685,'Exten':_0x19c8('0x115'),'Context':_0x19c8('0x190'),'Priority':'1','variable':_0x355d40,'timeout':(_0x3be67b[_0x19c8('0x191')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1497a6})['then'](function(_0x201199){return _0x12743a(_0x201199);})[_0x19c8('0xa6')](function(_0x5c782c){_0x3be67b['outboundOriginateFailureCallsDay']+=0x1;var _0x467776=new History(_0x2f1773[_0x19c8('0x2a')][_0x1497a6]);logger['error'](util[_0x19c8('0x50')](_0x19c8('0x192'),JSON[_0x19c8('0x7d')](_0x5c782c)));_0x467776['state']=0xe;_0x467776['statedesc']=_0x19c8('0x193');_0x467776[_0x19c8('0x79')]=moment()[_0x19c8('0x50')](_0x19c8('0xcb'));_0x467776[_0x19c8('0x194')]=_0x467776[_0x19c8('0x79')];hopperUtils[_0x19c8('0xcf')](_0x467776)[_0x19c8('0xa6')](loggerCatch(_0x19c8('0x195')));_0x2f1773[_0x19c8('0xd0')](_0x467776)[_0x19c8('0xa6')](loggerCatch('[originate][error]'))[_0x19c8('0x21')](function(){delete _0x2f1773[_0x19c8('0x2a')][_0x1497a6];return _0x3f5ca6(msgResponse('originate',_0x19c8('0x8d'),_0x19c8('0x196')));});});});};Dialer['prototype'][_0x19c8('0x197')]=function(_0x597766,_0x43b891,_0x1685cb){var _0x1095f2=new History(_0x43b891);if(_0x1095f2['countbusyretry']+_0x1095f2[_0x19c8('0x126')]+_0x1095f2[_0x19c8('0x127')]+_0x1095f2['countnosuchnumberretry']+_0x1095f2['countdropretry']+_0x1095f2[_0x19c8('0xf0')]+_0x1095f2[_0x19c8('0x12b')]+_0x1095f2['countagentrejectretry']>=_0x1685cb[_0x19c8('0x133')]-0x1){return!![];}switch(_0x597766){case 0x3:if(_0x1095f2[_0x19c8('0x127')]>=_0x1685cb[_0x19c8('0x198')]-0x1){return!![];}hopperUtils[_0x19c8('0xe1')]({'active':![],'countnoanswerretry':_0x1095f2[_0x19c8('0x127')]+=0x1,'scheduledat':moment()[_0x19c8('0xe2')](_0x1685cb['dialNoAnswerRetryFrequency'],'minutes')[_0x19c8('0x50')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1095f2[_0x19c8('0xe4')],'ListId':_0x1095f2[_0x19c8('0xe5')],'VoiceQueueId':_0x1095f2[_0x19c8('0xf4')]||undefined,'CampaignId':_0x1095f2[_0x19c8('0xe6')]||undefined})[_0x19c8('0xa6')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x1095f2[_0x19c8('0x125')]>=_0x1685cb[_0x19c8('0x199')]-0x1){return!![];}hopperUtils[_0x19c8('0xe1')]({'active':![],'countbusyretry':_0x1095f2['countbusyretry']+=0x1,'scheduledat':moment()[_0x19c8('0xe2')](_0x1685cb['dialBusyRetryFrequency'],'minutes')[_0x19c8('0x50')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1095f2[_0x19c8('0xe4')],'ListId':_0x1095f2[_0x19c8('0xe5')],'VoiceQueueId':_0x1095f2['VoiceQueueId']||undefined,'CampaignId':_0x1095f2[_0x19c8('0xe6')]||undefined})[_0x19c8('0xa6')](loggerCatch(_0x19c8('0x19a')));break;case 0x8:if(_0x1095f2[_0x19c8('0x126')]>=_0x1685cb['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0x1095f2[_0x19c8('0x126')]+=0x1,'scheduledat':moment()['add'](_0x1685cb[_0x19c8('0x19b')],_0x19c8('0xe3'))['format'](_0x19c8('0xcb')),'ContactId':_0x1095f2[_0x19c8('0xe4')],'ListId':_0x1095f2[_0x19c8('0xe5')],'VoiceQueueId':_0x1095f2[_0x19c8('0xf4')]||undefined,'CampaignId':_0x1095f2['CampaignId']||undefined})[_0x19c8('0xa6')](loggerCatch(_0x19c8('0x19c')));break;case 0x0:if(_0x1095f2[_0x19c8('0x128')]>=_0x1685cb['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{hopperUtils[_0x19c8('0xe1')]({'active':![],'countnosuchnumberretry':_0x1095f2[_0x19c8('0x128')]+=0x1,'scheduledat':moment()[_0x19c8('0xe2')](_0x1685cb[_0x19c8('0x19d')],_0x19c8('0xe3'))[_0x19c8('0x50')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1095f2[_0x19c8('0xe4')],'ListId':_0x1095f2[_0x19c8('0xe5')],'VoiceQueueId':_0x1095f2[_0x19c8('0xf4')]||undefined,'CampaignId':_0x1095f2[_0x19c8('0xe6')]||undefined})[_0x19c8('0xa6')](loggerCatch(_0x19c8('0x19e')));}break;case 0xa:if(_0x1095f2['countdropretry']>=_0x1685cb[_0x19c8('0xe0')]-0x1){return!![];}hopperUtils[_0x19c8('0xe1')]({'active':![],'countdropretry':_0x1095f2[_0x19c8('0xdf')]+=0x1,'scheduledat':moment()[_0x19c8('0xe2')](_0x1685cb[_0x19c8('0xdb')],_0x19c8('0xe3'))[_0x19c8('0x50')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1095f2[_0x19c8('0xe4')],'ListId':_0x1095f2['ListId'],'VoiceQueueId':_0x1095f2[_0x19c8('0xf4')]||undefined,'CampaignId':_0x1095f2[_0x19c8('0xe6')]||undefined})['catch'](loggerCatch(_0x19c8('0xe7')));break;case 0xb:if(_0x1095f2[_0x19c8('0xf0')]>=_0x1685cb[_0x19c8('0xf2')]-0x1){return!![];}hopperUtils[_0x19c8('0xe1')]({'active':![],'countabandonedretry':_0x1095f2['countabandonedretry']+=0x1,'scheduledat':moment()[_0x19c8('0xe2')](_0x1685cb[_0x19c8('0xf1')],_0x19c8('0xe3'))['format'](_0x19c8('0xcb')),'ContactId':_0x1095f2[_0x19c8('0xe4')],'ListId':_0x1095f2[_0x19c8('0xe5')],'VoiceQueueId':_0x1095f2[_0x19c8('0xf4')]||undefined,'CampaignId':_0x1095f2[_0x19c8('0xe6')]||undefined})['catch'](loggerCatch(_0x19c8('0xf5')));break;case 0x13:if(_0x1095f2[_0x19c8('0x12b')]>=_0x1685cb[_0x19c8('0x12c')]-0x1){return!![];}hopperUtils[_0x19c8('0xe1')]({'active':![],'countmachineretry':_0x1095f2[_0x19c8('0x12b')]+=0x1,'scheduledat':moment()[_0x19c8('0xe2')](_0x1685cb[_0x19c8('0x12f')],_0x19c8('0xe3'))[_0x19c8('0x50')](_0x19c8('0xcb')),'ContactId':_0x1095f2[_0x19c8('0xe4')],'ListId':_0x1095f2[_0x19c8('0xe5')],'VoiceQueueId':_0x1095f2['VoiceQueueId']||undefined,'CampaignId':_0x1095f2[_0x19c8('0xe6')]||undefined})[_0x19c8('0xa6')](loggerCatch(_0x19c8('0x130')));break;case 0x14:if(_0x1095f2[_0x19c8('0x129')]>=_0x1685cb[_0x19c8('0x19f')]-0x1){return!![];}hopperUtils[_0x19c8('0xe1')]({'active':![],'countagentrejectretry':_0x1095f2[_0x19c8('0x129')]+=0x1,'scheduledat':moment()['add'](_0x1685cb[_0x19c8('0x1a0')],_0x19c8('0xe3'))[_0x19c8('0x50')](_0x19c8('0xcb')),'ContactId':_0x1095f2['ContactId'],'ListId':_0x1095f2[_0x19c8('0xe5')],'VoiceQueueId':_0x1095f2[_0x19c8('0xf4')]||undefined,'CampaignId':_0x1095f2['CampaignId']||undefined})['catch'](loggerCatch(_0x19c8('0x1a1')));break;default:return!![];}};Dialer['prototype'][_0x19c8('0x111')]=function(_0x38ea86,_0x203c9f,_0x23f5c1){var _0x2f2fa0=this;var _0x5b3c8b=new History(_0x38ea86);var _0xc41d8c=![];var _0x7c6534;var _0x310022;return new Promise(function(_0x116536,_0x5eca69){if(_['isUndefined'](_0x203c9f)&&typeof _0x203c9f!=='object'){return _0x5eca69(msgResponse('[callProgressDetecting]',_0x19c8('0x9b'),'entity\x20is\x20undefine'));}if(_['isUndefined'](_0x23f5c1)&&typeof _0x23f5c1!==_0x19c8('0x164')){return _0x5eca69(msgResponse('[callProgressDetecting]','Failure','evt\x20is\x20undefine'));}hopperUtils[_0x19c8('0x1a2')](_0x5b3c8b,_0x23f5c1[_0x19c8('0x1a3')],_0x203c9f)[_0x19c8('0x48')](function(_0x54f77e){if(_0x54f77e[_0x19c8('0xde')]==0x1)_0xc41d8c=!![];switch(_0x23f5c1[_0x19c8('0x1a3')]){case'0':_0x203c9f['outboundNoSuchCallsDay']+=0x1;_0x5b3c8b[_0x19c8('0x77')]=0x0;_0x5b3c8b['statedesc']=_0x19c8('0x1a4');_0x5b3c8b[_0x19c8('0x128')]+=0x1;_0x5b3c8b['countglobal']+=0x1;ami[_0x19c8('0x4b')](_0x19c8('0x1a5'),ut[_0x19c8('0x132')](_0x38ea86,_0x19c8('0x1a6')));_0x7c6534=_0x203c9f[_0x19c8('0x19d')];_0x310022=_0x203c9f[_0x19c8('0xdc')];hopperUtils['createHistory'](_0x5b3c8b)[_0x19c8('0xa6')](loggerCatch(_0x19c8('0x124')));if(_0x2f2fa0[_0x19c8('0x197')](0x0,_0x38ea86,_0x203c9f)&&!_0xc41d8c){if(_0x5b3c8b[_0x19c8('0x128')]>=_0x203c9f[_0x19c8('0x1a7')]){_0x2f2fa0[_0x19c8('0x12d')](_0x5b3c8b,_0x116536,_0x5eca69,_0x19c8('0x1a8'));}else{_0x2f2fa0[_0x19c8('0x12a')](_0x5b3c8b,_0x116536,_0x5eca69,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x203c9f['outboundNoAnswerCallsDay']+=0x1;_0x5b3c8b['state']=0x3;_0x5b3c8b[_0x19c8('0x78')]=_0x19c8('0x1a9');_0x5b3c8b[_0x19c8('0x127')]+=0x1;_0x5b3c8b[_0x19c8('0xda')]+=0x1;var _0x406292=ut['buildNoAnswerEventPayload'](_0x38ea86,_0x203c9f);ami['emit'](_0x19c8('0x1aa'),_0x406292);_0x7c6534=_0x203c9f['dialNoAnswerRetryFrequency'];_0x310022=_0x203c9f[_0x19c8('0xdc')];hopperUtils[_0x19c8('0xcf')](_0x5b3c8b)['catch'](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x2f2fa0[_0x19c8('0x197')](0x3,_0x38ea86,_0x203c9f)&&!_0xc41d8c){if(_0x5b3c8b[_0x19c8('0x127')]>=_0x203c9f[_0x19c8('0x198')]){_0x2f2fa0['createStateFinal'](_0x5b3c8b,_0x116536,_0x5eca69,_0x19c8('0x1ab'));}else{_0x2f2fa0['stateGlobal'](_0x5b3c8b,_0x116536,_0x5eca69,_0x19c8('0x1ab'));}}break;case'5':_0x203c9f[_0x19c8('0x1ac')]+=0x1;_0x5b3c8b[_0x19c8('0x77')]=0x5;_0x5b3c8b[_0x19c8('0x78')]=_0x19c8('0x1ad');_0x5b3c8b[_0x19c8('0x125')]+=0x1;_0x5b3c8b[_0x19c8('0xda')]+=0x1;ami[_0x19c8('0x4b')](_0x19c8('0x1ae'),ut['buildObj'](_0x38ea86,'busy'));_0x7c6534=_0x203c9f[_0x19c8('0x1af')];_0x310022=_0x203c9f['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x5b3c8b)[_0x19c8('0xa6')](loggerCatch(_0x19c8('0x1b0')));if(_0x2f2fa0[_0x19c8('0x197')](0x5,_0x38ea86,_0x203c9f)&&!_0xc41d8c){if(_0x5b3c8b[_0x19c8('0x125')]>=_0x203c9f[_0x19c8('0x199')]){_0x2f2fa0[_0x19c8('0x12d')](_0x5b3c8b,_0x116536,_0x5eca69,_0x19c8('0x1b1'));}else{_0x2f2fa0[_0x19c8('0x12a')](_0x5b3c8b,_0x116536,_0x5eca69,'reason\x205\x20busy');}}break;case'8':_0x203c9f[_0x19c8('0x1b2')]+=0x1;_0x5b3c8b[_0x19c8('0x77')]=0x8;_0x5b3c8b['statedesc']=_0x19c8('0x1b3');_0x5b3c8b[_0x19c8('0x126')]+=0x1;_0x5b3c8b[_0x19c8('0xda')]+=0x1;_0x7c6534=_0x203c9f[_0x19c8('0x19b')];_0x310022=_0x203c9f['callAdditionalPhoneAfterMin'];ami[_0x19c8('0x4b')](_0x19c8('0x1b4'),ut[_0x19c8('0x132')](_0x38ea86,_0x19c8('0x1b5')));hopperUtils[_0x19c8('0xcf')](_0x5b3c8b)['catch'](loggerCatch(_0x19c8('0x1b6')));if(_0x2f2fa0[_0x19c8('0x197')](0x8,_0x38ea86,_0x203c9f)&&!_0xc41d8c){if(_0x5b3c8b['countcongestionretry']>=_0x203c9f[_0x19c8('0x1b7')]){_0x2f2fa0[_0x19c8('0x12d')](_0x5b3c8b,_0x116536,_0x5eca69,_0x19c8('0x1b8'));}else{_0x2f2fa0[_0x19c8('0x12a')](_0x5b3c8b,_0x116536,_0x5eca69,_0x19c8('0x1b8'));}}break;case'11':_0x203c9f[_0x19c8('0x1b9')]+=0x1;_0x5b3c8b[_0x19c8('0x77')]=0xb;_0x5b3c8b[_0x19c8('0x78')]='Abandoned';_0x5b3c8b[_0x19c8('0xf0')]+=0x1;_0x5b3c8b[_0x19c8('0xda')]+=0x1;_0x7c6534=_0x203c9f[_0x19c8('0xf1')];_0x310022=_0x203c9f[_0x19c8('0xdc')];hopperUtils[_0x19c8('0xcf')](_0x5b3c8b)[_0x19c8('0xa6')](loggerCatch(_0x19c8('0xf6')));if(_0x2f2fa0[_0x19c8('0x197')](0xb,_0x38ea86,_0x203c9f)&&!_0xc41d8c){if(_0x5b3c8b[_0x19c8('0xf0')]>=_0x203c9f[_0x19c8('0xf2')]){_0x2f2fa0[_0x19c8('0x12d')](_0x5b3c8b,_0x116536,_0x5eca69,_0x19c8('0x1ba'));}else{_0x2f2fa0['stateGlobal'](_0x5b3c8b,_0x116536,_0x5eca69,_0x19c8('0x1ba'));}}break;case'20':_0x203c9f['outboundRejectCallsDay']+=0x1;_0x5b3c8b[_0x19c8('0x77')]=0x14;_0x5b3c8b[_0x19c8('0x78')]=_0x19c8('0x1bb');_0x5b3c8b[_0x19c8('0x129')]+=0x1;_0x5b3c8b[_0x19c8('0xda')]+=0x1;_0x7c6534=_0x203c9f[_0x19c8('0x1a0')];_0x310022=_0x203c9f['callAdditionalPhoneAfterMin'];ami[_0x19c8('0x4b')](_0x19c8('0x1bc'),ut[_0x19c8('0x132')](_0x38ea86,_0x19c8('0x1bd')));hopperUtils[_0x19c8('0xcf')](_0x5b3c8b)['catch'](loggerCatch(_0x19c8('0x1be')));if(_0x2f2fa0[_0x19c8('0x197')](0x14,_0x38ea86,_0x203c9f)&&!_0xc41d8c){if(_0x5b3c8b[_0x19c8('0x129')]>=_0x203c9f[_0x19c8('0x19f')]){_0x2f2fa0[_0x19c8('0x12d')](_0x5b3c8b,_0x116536,_0x5eca69,_0x19c8('0x1bf'));}else{_0x2f2fa0[_0x19c8('0x12a')](_0x5b3c8b,_0x116536,_0x5eca69,_0x19c8('0x1bf'));}}break;default:_0x203c9f[_0x19c8('0x13b')]+=0x1;_0x5b3c8b['state']=0xc;_0x5b3c8b[_0x19c8('0x78')]=_0x23f5c1[_0x19c8('0x1a3')];_0x7c6534=_0x203c9f['dialAgentRejectRetryFrequency'];_0x310022=_0x203c9f['callAdditionalPhoneAfterMin'];hopperUtils[_0x19c8('0xcf')](_0x5b3c8b)[_0x19c8('0xa6')](loggerCatch(_0x19c8('0x1c0')));if(_0x2f2fa0[_0x19c8('0x197')](_0x23f5c1[_0x19c8('0x1a3')],_0x38ea86,_0x203c9f)&&!_0xc41d8c){if(_0x5b3c8b[_0x19c8('0x125')]+_0x5b3c8b[_0x19c8('0x126')]+_0x5b3c8b[_0x19c8('0x127')]+_0x5b3c8b[_0x19c8('0x128')]+_0x5b3c8b['countdropretry']+_0x5b3c8b[_0x19c8('0xf0')]+_0x5b3c8b[_0x19c8('0x12b')]+_0x5b3c8b[_0x19c8('0x129')]>=_0x203c9f['dialGlobalMaxRetry']){_0x2f2fa0[_0x19c8('0x12a')](_0x5b3c8b,_0x116536,_0x5eca69,_0x23f5c1[_0x19c8('0x1a3')]);}else{_0x2f2fa0[_0x19c8('0x12d')](_0x5b3c8b,_0x116536,_0x5eca69,_0x23f5c1[_0x19c8('0x1a3')]);}}}})['then'](function(){if(_0xc41d8c){hopperUtils['swapAdditionalPhones'](_0x5b3c8b,_0x7c6534,_0x310022)[_0x19c8('0x48')](function(){return _0x116536(0x1);});}});});};Dialer['prototype'][_0x19c8('0x12a')]=function(_0x2b8269,_0x22b201,_0x4e870a,_0x2ee96c){var _0x34de2f=new Final(_0x2b8269);_0x34de2f[_0x19c8('0x77')]=0xf;_0x34de2f[_0x19c8('0x78')]=_0x19c8('0x1c1');this[_0x19c8('0x12d')](_0x34de2f,_0x22b201,_0x4e870a,_0x2ee96c);};Dialer[_0x19c8('0x1e')][_0x19c8('0x12d')]=function(_0x1fdccc,_0x1862cb,_0x2073c1,_0x1d39dc){hopperUtils[_0x19c8('0xd0')](_0x1fdccc)[_0x19c8('0x48')](function(){return _0x1862cb(msgResponse(_0x19c8('0x1c2'),_0x19c8('0x1c3'),_0x1d39dc));})[_0x19c8('0xa6')](function(){return _0x2073c1(msgResponse('[moveContactManagedDialer][0]',_0x19c8('0x9b'),_0x19c8('0x1c4')));});};Dialer['prototype'][_0x19c8('0xc')]=function(_0x2c0f5e){var _0x304a78=_0x2c0f5e['dialPredictiveOptimizationPercentage']/0x64;var _0x3a9801=_0x2c0f5e[_0x19c8('0x1c5')]/(_0x2c0f5e['outboundDropCallsDayTimeout']+_0x2c0f5e['outboundAnswerCallsDay']);var _0x367ed0=Math[_0x19c8('0x1c6')](_0x2c0f5e['predictiveIntervalAvailable']*(_0x2c0f5e[_0x19c8('0x1c7')]/0x64));var _0x317b7b=Math[_0x19c8('0x1c6')](_0x2c0f5e[_0x19c8('0x1c8')]*(_0x2c0f5e[_0x19c8('0x1c9')]/0x64));var _0x1eec4e=_0x2c0f5e[_0x19c8('0x141')]+_0x2c0f5e['talking'];var _0x2447a5=Math[_0x19c8('0x1ca')](_0x2c0f5e[_0x19c8('0x64')]*_0x2c0f5e[_0x19c8('0x69')]*_0x2c0f5e[_0x19c8('0x1cb')]*_0x2c0f5e[_0x19c8('0x1cc')]);if(_[_0x19c8('0x4a')](_0x2c0f5e[_0x19c8('0x2e')])){if(!_[_0x19c8('0x4a')](_0x2c0f5e['startPredictive'])){_0x2c0f5e['startPredictive']=undefined;loggerPredictive[_0x19c8('0x70')]('[startMethodPredictive][StartProgressive]',_0x19c8('0x1cd'));}if(!_['isUndefined'](_0x2c0f5e['handlePredictive'])){loggerPredictive[_0x19c8('0x70')]('[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x2c0f5e['handlePredictive']);_0x2c0f5e[_0x19c8('0x6e')]=undefined;}_0x2c0f5e[_0x19c8('0x2e')]=moment()[_0x19c8('0x50')](_0x19c8('0xcb'));loggerPredictive[_0x19c8('0x55')](_0x2c0f5e['name'],_0x19c8('0x1ce'),_0x2c0f5e[_0x19c8('0x2e')]);this[_0x19c8('0xbb')](_0x2c0f5e,0x1);}else if(ifInterval(_0x2c0f5e[_0x19c8('0x1cf')],_0x2c0f5e[_0x19c8('0x2e')])){this[_0x19c8('0xbb')](_0x2c0f5e,0x1);loggerPredictiveCalls[_0x19c8('0x55')]('[startMethodPredictive][StartProgressive][Loop]',_0x2c0f5e[_0x19c8('0x2e')],_0x2c0f5e[_0x19c8('0x6c')]);_0x2c0f5e[_0x19c8('0x64')]=0x0;_0x2c0f5e['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x304a78<_0x3a9801&&_0x2c0f5e[_0x19c8('0x1d0')]===_0x19c8('0x1d1')){clearPredictiveAttributes(_0x2c0f5e);loggerPredictive[_0x19c8('0x55')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x19c8('0x1d2'),_0x3a9801,_0x19c8('0x2e'),_0x2c0f5e['name']);}else if(_0x2447a5<_0x2c0f5e['predictiveIntervalErlangCallsDroppedCalls']&&_0x2c0f5e['dialPredictiveOptimization']===_0x19c8('0x1d1')){clearPredictiveAttributes(_0x2c0f5e);loggerPredictive[_0x19c8('0x55')](_0x19c8('0x1d3'),_0x19c8('0x1d4'),_0x2447a5,_0x19c8('0x1d5'),_0x2c0f5e[_0x19c8('0x1d6')],_0x19c8('0x2e'),_0x2c0f5e[_0x19c8('0x6c')]);}else if(!ifInterval(_0x2c0f5e[_0x19c8('0x1cf')],_0x2c0f5e[_0x19c8('0x2e')])&&_[_0x19c8('0x4a')](_0x2c0f5e[_0x19c8('0x2d')])&&!_[_0x19c8('0x4a')](_0x2c0f5e[_0x19c8('0x2e')])){_0x2c0f5e[_0x19c8('0x2d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x19c8('0x55')](_0x2c0f5e['name'],_0x19c8('0x1d7'),_0x2c0f5e[_0x19c8('0x2d')]);hopperUtils[_0x19c8('0x1d8')](_0x2c0f5e[_0x19c8('0x1cf')])[_0x19c8('0x48')](this[_0x19c8('0x1d9')](_0x2c0f5e))['then'](mergeDataErlangB(_0x2c0f5e))[_0x19c8('0x48')](this['startMethodPredictive'](_0x2c0f5e))['catch'](loggerCatchPredictive(_0x19c8('0x1da'),_0x2c0f5e));}else if(!ifInterval(_0x2c0f5e[_0x19c8('0x1cf')],_0x2c0f5e[_0x19c8('0x2d')])){_0x2c0f5e['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x2c0f5e[_0x19c8('0x2d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x2c0f5e[_0x19c8('0x6c')],_0x19c8('0x1db'),_0x2c0f5e[_0x19c8('0x2d')]);clearInterval(_0x2c0f5e[_0x19c8('0x6e')]);_0x2c0f5e[_0x19c8('0x6e')]=undefined;hopperUtils['avgHandleTime'](_0x2c0f5e[_0x19c8('0x1cf')])['then'](this[_0x19c8('0x1d9')](_0x2c0f5e))['then'](mergeDataErlangB(_0x2c0f5e))[_0x19c8('0x48')](this[_0x19c8('0x1dc')](_0x2c0f5e))[_0x19c8('0xa6')](loggerCatchPredictive(_0x19c8('0x1dd'),_0x2c0f5e));}else if(_0x2c0f5e[_0x19c8('0x1c8')]&&_0x1eec4e<_0x2c0f5e[_0x19c8('0x1c8')]-_0x317b7b){clearPredictiveAttributes(_0x2c0f5e);loggerPredictive['info'](_0x2c0f5e[_0x19c8('0x6c')],_0x19c8('0x1de'),_0x1eec4e,_0x19c8('0x1df'),_0x2c0f5e['predictiveIntervalAvailable'],'-',_0x317b7b,'=',_0x2c0f5e[_0x19c8('0x1c8')]-_0x317b7b,')');}else if(_0x2c0f5e[_0x19c8('0x1c8')]&&_0x1eec4e>_0x2c0f5e['predictiveIntervalAvailable']+_0x367ed0){clearPredictiveAttributes(_0x2c0f5e);loggerPredictive[_0x19c8('0x55')](_0x2c0f5e['name'],_0x19c8('0x1de'),_0x1eec4e,')\x20are\x20more\x20than\x20threshold\x20(',_0x2c0f5e['predictiveIntervalAvailable'],'+',_0x367ed0,'=',_0x2c0f5e['predictiveIntervalAvailable']+_0x367ed0,')');}};Dialer[_0x19c8('0x1e')][_0x19c8('0x1d9')]=function(_0x5bcb6f){var _0x516a84=this;return function(_0x4ea2e4){return new Promise(function(_0x28cb01,_0x56b034){_[_0x19c8('0x6a')](_0x5bcb6f,_0x4ea2e4[0x0]);if(checkGetDataPredictive(_0x4ea2e4[0x0])){var _0x152f2a=_0x5bcb6f[_0x19c8('0x1c8')]=_0x5bcb6f['talking']+_0x5bcb6f[_0x19c8('0x141')];var _0x259fde=_0x5bcb6f[_0x19c8('0x1cf')]*0x3c;var _0x35a5b3=_0x4ea2e4[0x0][_0x19c8('0x5e')]+_0x4ea2e4[0x0][_0x19c8('0x5c')];var _0x51d1da=(_0x4ea2e4[0x0][_0x19c8('0x58')]+_0x4ea2e4[0x0][_0x19c8('0xd5')]+_0x4ea2e4[0x0][_0x19c8('0xec')])/_0x4ea2e4[0x0][_0x19c8('0x56')];_0x5bcb6f[_0x19c8('0x1cb')]=_0x51d1da>0x0?_0x51d1da:0x1;switch(_0x5bcb6f['dialPredictiveOptimization']){case'dropRate':var _0x292c4b=_0x5bcb6f['dialPredictiveOptimizationPercentage']/0x64;return _0x516a84[_0x19c8('0x1e0')](_0x152f2a,_0x259fde,_0x35a5b3,_0x51d1da,_0x292c4b)['then'](function(_0x23b038){return _0x28cb01(_0x23b038);});case _0x19c8('0x1e1'):var _0xc90c7a=_0x5bcb6f[_0x19c8('0x1e2')]/0x64;return _0x516a84['busyFactor'](_0x152f2a,_0x259fde,_0x35a5b3,_0x51d1da,_0xc90c7a)[_0x19c8('0x48')](function(_0x558f7a){return _0x28cb01(_0x558f7a);});default:return _0x56b034(msgResponse(_0x19c8('0x1e3'),_0x19c8('0x9b'),_0x19c8('0x1e4')));}}else{return _0x56b034(msgResponse(_0x19c8('0x1e3'),_0x19c8('0x9b'),'check\x20failure'));}});};};Dialer[_0x19c8('0x1e')][_0x19c8('0x1e5')]=function(_0x1eaf2f){var _0x71cb12=this;return function(_0x21af5e){return new Promise(function(_0x22ec70,_0x59b272){_[_0x19c8('0x6a')](_0x1eaf2f,_0x21af5e[0x0]);if(checkGetDataPredictive(_0x21af5e[0x0])){loggerPredictive[_0x19c8('0x55')](JSON[_0x19c8('0x7d')](_0x21af5e[0x0]));if(_0x1eaf2f[_0x19c8('0x1d0')]===_0x19c8('0x1d1')){return _0x71cb12[_0x19c8('0x15a')](_0x1eaf2f['id'])['then'](function(_0x4e01c7){var _0x25c9a5=_0x1eaf2f['loggedIn']-_0x4e01c7[0x0][_0x19c8('0x1e6')];var _0x4ce8ae=_0x1eaf2f[_0x19c8('0x1cf')]*0x3c;var _0x53c111=_0x21af5e[0x0][_0x19c8('0x5e')]+_0x21af5e[0x0][_0x19c8('0x5c')];var _0x1d4a0c=(_0x21af5e[0x0][_0x19c8('0x58')]+_0x21af5e[0x0][_0x19c8('0xd5')]+_0x21af5e[0x0][_0x19c8('0xec')])/_0x21af5e[0x0][_0x19c8('0x56')];var _0x3d1924=_0x1eaf2f[_0x19c8('0x1e2')]/0x64;_0x1eaf2f[_0x19c8('0x1e7')]=_0x4e01c7[0x0][_0x19c8('0x1e6')]||0x0;_0x1eaf2f[_0x19c8('0x1cb')]=_0x1d4a0c>0x0?_0x1d4a0c:0x1;return _0x71cb12['abandonmentRate'](_0x25c9a5,_0x4ce8ae,_0x53c111,_0x1d4a0c,_0x3d1924);})[_0x19c8('0x48')](function(_0x507d53){return _0x22ec70(_0x507d53);})[_0x19c8('0xa6')](function(_0x54adff){return _0x59b272(msgResponse(_0x19c8('0x1e8'),_0x19c8('0x9b'),JSON[_0x19c8('0x7d')](_0x54adff)));});}if(_0x1eaf2f[_0x19c8('0x1d0')]==='agentBusyFactor'){return _0x71cb12[_0x19c8('0x15a')](_0x1eaf2f['id'])[_0x19c8('0x48')](function(_0x5e9d05){var _0x297a9a=_0x1eaf2f[_0x19c8('0x1e9')]-_0x5e9d05[0x0][_0x19c8('0x1e6')];var _0x59e404=_0x1eaf2f[_0x19c8('0x1cf')]*0x3c;var _0x2d77fb=_0x21af5e[0x0][_0x19c8('0x5e')]+_0x21af5e[0x0][_0x19c8('0x5c')];var _0x1c0be8=(_0x21af5e[0x0]['predictiveIntervalAnsweredCalls']+_0x21af5e[0x0][_0x19c8('0xd5')]+_0x21af5e[0x0][_0x19c8('0xec')])/_0x21af5e[0x0]['predictiveIntervalTotalCalls'];var _0x25d7ba=_0x1eaf2f[_0x19c8('0x1e2')]/0x64;_0x1eaf2f[_0x19c8('0x1e7')]=_0x5e9d05[0x0][_0x19c8('0x1e6')]||0x0;_0x1eaf2f[_0x19c8('0x1cb')]=_0x1c0be8>0x0?_0x1c0be8:0x1;return _0x71cb12[_0x19c8('0x1ea')](_0x297a9a,_0x59e404,_0x2d77fb,_0x1c0be8,_0x25d7ba);})[_0x19c8('0x48')](function(_0x2354a0){return _0x22ec70(_0x2354a0);})[_0x19c8('0xa6')](function(_0x46d0f3){return _0x59b272(msgResponse('[CatchErlangB]',_0x19c8('0x9b'),JSON[_0x19c8('0x7d')](_0x46d0f3)));});}}else{return _0x59b272(msgResponse('[getDataPredictive]','Failure','check\x20failure'));}});};};Dialer['prototype'][_0x19c8('0x1dc')]=function(_0x2e0d1d){var _0xc89ab0=this;return function(){var _0x506e76=0x0;var _0x20e028=Math['floor'](_0x2e0d1d[_0x19c8('0x66')]*0x3e8);if(_0x20e028>0x0){_0x20e028=_0x20e028<0x64?0x64:_0x20e028;loggerPredictive[_0x19c8('0x55')](_0x2e0d1d[_0x19c8('0x6c')],'one\x20call\x20every:',_0x20e028,_0x19c8('0x1eb'));_0x2e0d1d[_0x19c8('0x6e')]=setInterval(function(){_0xc89ab0['handlePredictive'](_0x2e0d1d);loggerPredictiveCalls['info'](_0x19c8('0x1ec'),_0x506e76+=0x1);},_0x20e028);}else{loggerPredictive[_0x19c8('0x55')](_0x2e0d1d[_0x19c8('0x6c')],_0x19c8('0x1ed'));}};};Dialer[_0x19c8('0x1e')][_0x19c8('0x1ee')]=function(_0x4f49a4,_0x27f296){var _0x20db0c=this;return function(_0x32faa5){if(_[_0x19c8('0x53')](_0x32faa5)){if(_['isNil'](_0x27f296[_0x19c8('0x15f')])||!_0x27f296['recallme']){if(_0x4f49a4['dialMethod']===_0x19c8('0xb')){_0x4f49a4[_0x19c8('0x7a')]=_[_0x19c8('0x4a')](_0x4f49a4['queueStatusComplete'])?!![]:_0x4f49a4[_0x19c8('0x7a')];var _0x136311=uuid['v4']();_0x20db0c[_0x19c8('0x2a')][_0x136311]=new Action(_0x4f49a4,_0x27f296,_0x136311);loggerBooked[_0x19c8('0x55')]('[booked][checkContactBlack]',_0x136311,_0x19c8('0x1ef'),JSON[_0x19c8('0x7d')](_0x4f49a4[_0x19c8('0x7a')]),_0x19c8('0x1f0'),_0x4f49a4[_0x19c8('0x6c')]);if(_0x4f49a4['queueStatusComplete']){_0x4f49a4['queueStatusComplete']=![];_0x20db0c['queueBooked'][_0x20db0c[_0x19c8('0x2a')][_0x136311][_0x19c8('0xc5')]]=[];ami[_0x19c8('0xa7')]({'actionid':_0x136311,'action':_0x19c8('0x1f1'),'queue':_0x4f49a4['name']})[_0x19c8('0xa6')](function(){_0x20db0c[_0x19c8('0xc9')](_0x4f49a4);hopperUtils[_0x19c8('0xe1')]({'active':![],'ContactId':_0x20db0c[_0x19c8('0x2a')][_0x136311][_0x19c8('0xe4')],'ListId':_0x20db0c[_0x19c8('0x2a')][_0x136311]['ListId'],'VoiceQueueId':_0x20db0c[_0x19c8('0x2a')][_0x136311][_0x19c8('0xf4')]||undefined,'CampaignId':_0x20db0c[_0x19c8('0x2a')][_0x136311]['CampaignId']||undefined})[_0x19c8('0xa6')](loggerCatch(_0x19c8('0x1f2')));delete _0x20db0c[_0x19c8('0x2a')][_0x136311];});}else{loggerBooked[_0x19c8('0x55')](_0x19c8('0x1f3'),JSON[_0x19c8('0x7d')](_0x4f49a4['queueStatusComplete']),_0x19c8('0x1f0'),_0x4f49a4[_0x19c8('0x6c')]);_0x20db0c['updateOriginated'](_0x4f49a4);hopperUtils[_0x19c8('0xe1')]({'active':![],'ContactId':_0x20db0c[_0x19c8('0x2a')][_0x136311]['ContactId'],'ListId':_0x20db0c[_0x19c8('0x2a')][_0x136311][_0x19c8('0xe5')],'VoiceQueueId':_0x20db0c[_0x19c8('0x2a')][_0x136311][_0x19c8('0xf4')]||undefined,'CampaignId':_0x20db0c[_0x19c8('0x2a')][_0x136311][_0x19c8('0xe6')]||undefined})[_0x19c8('0xa6')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x20db0c['actions'][_0x136311];}}else{return _0x20db0c['actionOriginate'](_0x4f49a4,_0x27f296);}}else{if(utils['getSeconds'](undefined,_0x27f296[_0x19c8('0x1f4')])<_0x4f49a4['dialRecallMeTimeout']*0x3c){if(_0x27f296['Agent']&&!_0x27f296[_0x19c8('0x151')][_0x19c8('0x1f5')]){_0x20db0c[_0x19c8('0x23')][_0x19c8('0x101')](_0x27f296['id'])[_0x19c8('0x21')](function(){_0x20db0c['updateOriginated'](_0x4f49a4);});}else{hopperUtils[_0x19c8('0x1f6')]({'active':![]},_0x27f296['id'],0x1)[_0x19c8('0x21')](function(){_0x20db0c[_0x19c8('0xc9')](_0x4f49a4);});}}else{_0x4f49a4[_0x19c8('0x1f7')]+=0x1;_0x20db0c[_0x19c8('0xc9')](_0x4f49a4);if(_0x4f49a4[_0x19c8('0x1f8')]){hopperUtils[_0x19c8('0xe1')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x27f296[_0x19c8('0xe4')],'ListId':_0x27f296[_0x19c8('0xe5')],'VoiceQueueId':_0x27f296[_0x19c8('0xf4')]||undefined,'CampaignId':_0x27f296[_0x19c8('0xe6')]||undefined})[_0x19c8('0xa6')](loggerCatch(_0x19c8('0x1f9')));hopperUtils[_0x19c8('0xcf')](createObjHistory(_0x4f49a4,_0x27f296,utils[_0x19c8('0x73')][_0x19c8('0x1fa')],0x17,_0x19c8('0x1fb')))['catch'](loggerCatch(_0x19c8('0x1fc')));}else{_0x20db0c[_0x19c8('0x11d')](createObjHistory(_0x4f49a4,_0x27f296,utils[_0x19c8('0x73')][_0x19c8('0x1fd')],0x16,_0x19c8('0x1fe')),_0x19c8('0x1ff'),'[Originate][HistoryRecallClose]');}}}}else{_0x4f49a4[_0x19c8('0x200')]+=0x1;_0x20db0c[_0x19c8('0x11d')](createObjHistory(_0x4f49a4,_0x27f296,utils['CAMPAIGN_STATUS'][_0x19c8('0x201')],0xd,_0x19c8('0x202')),_0x19c8('0x203'),_0x19c8('0x204'));throw'inBlackList';}};};Dialer[_0x19c8('0x1e')]['handleIvr']=function(_0x39ffd7){var _0x1d3267=this;var _0x405f16=_0x39ffd7[_0x19c8('0x205')]-_0x39ffd7['originated'];emitCampaignSummary(_0x39ffd7);if(_0x405f16>0x0&&_0x39ffd7[_0x19c8('0x206')]==0x0){if(_0x405f16>this[_0x19c8('0x28')]){_0x405f16=this[_0x19c8('0x28')];}_0x39ffd7[_0x19c8('0x206')]=0x1;hopperUtils[_0x19c8('0x207')](_0x39ffd7,_0x405f16)[_0x19c8('0x48')](function(_0x57ca1b){_0x39ffd7[_0x19c8('0x206')]=0x0;if(_0x57ca1b){if(!utils['checkContactEmpty'](_0x57ca1b)){_0x39ffd7['message']=utils['CAMPAIGN_STATUS'][_0x19c8('0x75')];logger[_0x19c8('0x55')](_0x19c8('0x208')+_0x39ffd7[_0x19c8('0x6c')]);}else{_0x39ffd7[_0x19c8('0x85')]+=_0x57ca1b['length'];_0x39ffd7[_0x19c8('0x72')]=utils[_0x19c8('0x73')]['RUNNING'];for(var _0x49bbb3=0x0;_0x49bbb3<_0x57ca1b[_0x19c8('0x9f')];_0x49bbb3+=0x1){_0x39ffd7[_0x19c8('0x209')]+=0x1;if(_[_0x19c8('0xfb')](_0x57ca1b[_0x49bbb3])||_[_0x19c8('0xfb')](_0x57ca1b[_0x49bbb3][_0x19c8('0x17e')])||_[_0x19c8('0xfb')](_0x57ca1b[_0x49bbb3][_0x19c8('0x167')])){_0x1d3267[_0x19c8('0x15e')](_0x19c8('0x20a'),_0x39ffd7,_0x57ca1b[_0x49bbb3]);}else{hopperUtils[_0x19c8('0x20b')](_[_0x19c8('0x7e')](_0x57ca1b[_0x49bbb3],[_0x19c8('0xe6'),_0x19c8('0x167')]))[_0x19c8('0x48')](_0x1d3267[_0x19c8('0x1ee')](_0x39ffd7,_0x57ca1b[_0x49bbb3]))[_0x19c8('0xa6')](_0x1d3267[_0x19c8('0x15d')](_0x19c8('0x20c'),_0x39ffd7));}}}}})[_0x19c8('0xa6')](loggerGetContactDialer(_0x19c8('0x20d'),_0x39ffd7,_0x405f16));}};Dialer[_0x19c8('0x1e')][_0x19c8('0xbb')]=function(_0x4c6f9f,_0x28a701){var _0x39fc4c=this;var _0x173e0d=[];if(_0x28a701<0x1||_0x4c6f9f[_0x19c8('0xb9')]===_0x19c8('0xb')){_0x28a701=0x1;}var _0x12e672=Math[_0x19c8('0x1ca')](_0x4c6f9f[_0x19c8('0x141')]*_0x28a701)-_0x4c6f9f[_0x19c8('0x85')];if(_0x4c6f9f[_0x19c8('0x20e')]>0x0){var _0x5350c5=_0x4c6f9f[_0x19c8('0x20e')]-_0x4c6f9f[_0x19c8('0x85')]-_0x4c6f9f[_0x19c8('0x143')]-_0x4c6f9f['pTalking'];if(_0x12e672>_0x5350c5){_0x12e672=_0x5350c5;}}if(_0x12e672>0x0&&_0x4c6f9f[_0x19c8('0x206')]==0x0){if(_0x4c6f9f[_0x19c8('0xb9')]===_0x19c8('0xb')){_0x12e672=0x1;}if(_0x12e672>this[_0x19c8('0x28')]){_0x12e672=this[_0x19c8('0x28')];}for(var _0x5be60f in this['agents']){if(typeof this['agents'][_0x5be60f]!=='undefined'){if(this['agents'][_0x5be60f]['state']==='not_inuse'&&this[_0x19c8('0x26')][_0x5be60f]['status']==='reachable'){_0x173e0d[_0x19c8('0xa0')](this[_0x19c8('0x26')][_0x5be60f]['id']);}}}_0x4c6f9f[_0x19c8('0x206')]=0x1;hopperUtils['getContactDialer'](_0x4c6f9f,_0x173e0d,_0x12e672)[_0x19c8('0x48')](function(_0x5e8675){_0x4c6f9f[_0x19c8('0x206')]=0x0;if(_0x5e8675){if(!utils[_0x19c8('0x20f')](_0x5e8675)){hopperUtils[_0x19c8('0x210')](_0x4c6f9f)[_0x19c8('0x48')](sendMessageReschedule(_0x4c6f9f))[_0x19c8('0xa6')](loggerCatch(_0x19c8('0x211')));}else{_0x4c6f9f[_0x19c8('0x85')]+=_0x5e8675[_0x19c8('0x9f')];_0x4c6f9f[_0x19c8('0x72')]=_0x4c6f9f[_0x19c8('0xb9')]==='booked'?utils['CAMPAIGN_STATUS'][_0x19c8('0x145')]:utils[_0x19c8('0x73')][_0x19c8('0x212')];for(var _0x40c2dc=0x0;_0x40c2dc<_0x5e8675[_0x19c8('0x9f')];_0x40c2dc+=0x1){if(_[_0x19c8('0xfb')](_0x5e8675[_0x40c2dc])||_[_0x19c8('0xfb')](_0x5e8675[_0x40c2dc][_0x19c8('0x17e')])||_['isNil'](_0x5e8675[_0x40c2dc]['phone'])){_0x39fc4c[_0x19c8('0x15e')]('[actionOriginate]\x20',_0x4c6f9f,_0x5e8675[_0x40c2dc]);}else{hopperUtils[_0x19c8('0x213')](_['pick'](_0x5e8675[_0x40c2dc],[_0x19c8('0xf4'),_0x19c8('0x167')]))[_0x19c8('0x48')](_0x39fc4c[_0x19c8('0x1ee')](_0x4c6f9f,_0x5e8675[_0x40c2dc]))['catch'](_0x39fc4c[_0x19c8('0x15d')]('[actionOriginate]\x20',_0x4c6f9f));}}}}})[_0x19c8('0xa6')](loggerGetContactDialer(_0x19c8('0x214'),_0x4c6f9f,_0x12e672));}};Dialer[_0x19c8('0x1e')][_0x19c8('0x6e')]=function(_0x483b0f){if(_0x483b0f[_0x19c8('0x20e')]>0x0){var _0x381e39=_0x483b0f[_0x19c8('0x20e')]-_0x483b0f[_0x19c8('0x85')]-_0x483b0f[_0x19c8('0x143')];if(_0x381e39>0x0&&_0x483b0f[_0x19c8('0x206')]==0x0){this[_0x19c8('0x215')](_0x483b0f);}else{loggerPredictiveCalls[_0x19c8('0x55')](_0x19c8('0x216'));}}else{this[_0x19c8('0x215')](_0x483b0f);}};Dialer[_0x19c8('0x1e')][_0x19c8('0x215')]=function(_0x352e8a){var _0x55035f=this;var _0x2310ad=[];_0x352e8a['originated']+=0x1;for(var _0xeb1f3e in this[_0x19c8('0x26')]){if(typeof this['agents'][_0xeb1f3e]!==_0x19c8('0xb2')){if(this[_0x19c8('0x26')][_0xeb1f3e]['state']===_0x19c8('0x217')&&this[_0x19c8('0x26')][_0xeb1f3e][_0x19c8('0x90')]===_0x19c8('0x14e')){_0x2310ad[_0x19c8('0xa0')](this[_0x19c8('0x26')][_0xeb1f3e]['id']);}}}_0x352e8a['temp']=0x1;return this[_0x19c8('0x218')](_0x352e8a['id'],_0x2310ad,0x1,_0x352e8a[_0x19c8('0x219')],_0x352e8a)[_0x19c8('0x48')](function(_0x54dcfa){_0x352e8a['temp']=0x1;if(_0x54dcfa){if(!utils[_0x19c8('0x20f')](_0x54dcfa)){utils['checkContactLowerLimitOriginate'](_0x352e8a,0x1,0x0);return hopperUtils[_0x19c8('0x210')](_0x352e8a)[_0x19c8('0x48')](sendMessageReschedule(_0x352e8a))[_0x19c8('0xa6')](loggerCatch('[countReScheduled]\x20'));}else{_0x352e8a[_0x19c8('0x72')]=utils[_0x19c8('0x73')]['RUNNING'];if(_[_0x19c8('0xfb')](_0x54dcfa[0x0])||_[_0x19c8('0xfb')](_0x54dcfa[0x0][_0x19c8('0x17e')])||_[_0x19c8('0xfb')](_0x54dcfa[0x0][_0x19c8('0x167')])){_0x55035f['emptyContact']('[actionOriginate]\x20',_0x352e8a,_0x54dcfa[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0x19c8('0x7e')](_0x54dcfa[0x0],['VoiceQueueId',_0x19c8('0x167')]))[_0x19c8('0x48')](_0x55035f['checkContactBlack'](_0x352e8a,_0x54dcfa[0x0]))[_0x19c8('0xa6')](_0x55035f[_0x19c8('0x15d')](_0x19c8('0x21a'),_0x352e8a));}}}})[_0x19c8('0xa6')](loggerGetContactDialer(_0x19c8('0x21b'),_0x352e8a,0x1));};Dialer[_0x19c8('0x1e')]['abandonmentRate']=function(_0x10ad93,_0x30f0c2,_0x684995,_0x331423,_0x3acd27,_0x5aaaec){loggerPredictive[_0x19c8('0x55')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive['info'](_0x19c8('0x21c'),_0x10ad93);loggerPredictive[_0x19c8('0x55')](_0x19c8('0x21d'),_0x30f0c2);loggerPredictive[_0x19c8('0x55')]('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',_0x684995);loggerPredictive[_0x19c8('0x55')]('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',_0x331423);loggerPredictive[_0x19c8('0x55')](_0x19c8('0x21e'),_0x3acd27);loggerPredictive[_0x19c8('0x55')]('---------------------------');return new Promise(function(_0x24e640,_0xc98d7){if(_0x10ad93<=0x0||isNaN(_0x10ad93)){return _0xc98d7(msgResponse(_0x19c8('0x21f'),'Error',_0x19c8('0x220')+_0x10ad93));}if(_0x684995<=0x0||isNaN(_0x684995)){return _0xc98d7(msgResponse(_0x19c8('0x21f'),'Error','Ts\x20=\x20'+_0x684995));}if(_0x331423<=0x0||isNaN(_0x331423)){return _0xc98d7(msgResponse('[abandonmentRate]',_0x19c8('0x8d'),_0x19c8('0x221')+_0x331423));}if(_0x30f0c2<=0x0||isNaN(_0x30f0c2)){return _0xc98d7(msgResponse(_0x19c8('0x21f'),'Error',_0x19c8('0x222')+_0x30f0c2));}if(_0x3acd27<=0x0||isNaN(_0x3acd27)){return _0xc98d7(msgResponse('[abandonmentRate]',_0x19c8('0x8d'),_0x19c8('0x223')+_0x3acd27));}_0x5aaaec=_0x5aaaec||0x0;var _0x2bc8c3=0x1/_0x684995;var _0x23c05d=0x0;var _0xcfa826=0x0;var _0x27ca65=0x0;var _0x3759f0=0x0;for(var _0x491164=0x0;_0x27ca65<_0x3acd27;_0x491164+=0x1){_0xcfa826=_0x491164/_0x30f0c2;_0x23c05d=(_0x331423*_0xcfa826+_0x5aaaec)/_0x2bc8c3;_0x27ca65=utils['erlangb'](_0x23c05d,_0x10ad93);_0x3759f0=_0x23c05d/_0x10ad93*(0x1-utils['erlangb'](_0x23c05d,_0x10ad93));}return _0x24e640({'erlangCalls':_0x491164,'erlangCallToSecond':_0x30f0c2/_0x491164,'erlangAbandonmentRate':_0x27ca65,'erlangBusyFactor':_0x3759f0});});};Dialer[_0x19c8('0x1e')][_0x19c8('0x1ea')]=function(_0x49f3d4,_0x57acfd,_0x4036c7,_0x53199d,_0x5cc76c,_0x5af42c){loggerPredictive['info'](_0x19c8('0x224'));loggerPredictive[_0x19c8('0x55')](_0x19c8('0x21c'),_0x49f3d4);loggerPredictive[_0x19c8('0x55')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x57acfd);loggerPredictive[_0x19c8('0x55')]('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',_0x4036c7);loggerPredictive[_0x19c8('0x55')]('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',_0x53199d);loggerPredictive['info'](_0x19c8('0x225'),_0x5cc76c);loggerPredictive[_0x19c8('0x55')](_0x19c8('0x5f'));return new Promise(function(_0x358a30,_0x434fdf){if(_0x49f3d4<=0x0||isNaN(_0x49f3d4)){return _0x434fdf(msgResponse('[busyFactor]','Error',_0x19c8('0x220')+_0x49f3d4));}if(_0x4036c7<=0x0||isNaN(_0x4036c7)){return _0x434fdf(msgResponse(_0x19c8('0x226'),_0x19c8('0x8d'),_0x19c8('0x227')+_0x4036c7));}if(_0x53199d<=0x0||isNaN(_0x53199d)){return _0x434fdf(msgResponse(_0x19c8('0x226'),'Error',_0x19c8('0x221')+_0x53199d));}if(_0x57acfd<=0x0||isNaN(_0x57acfd)){return _0x434fdf(msgResponse('[busyFactor]',_0x19c8('0x8d'),_0x19c8('0x222')+_0x57acfd));}if(_0x5cc76c<=0x0||isNaN(_0x5cc76c)){return _0x434fdf(msgResponse(_0x19c8('0x226'),_0x19c8('0x8d'),_0x19c8('0x228')+_0x5cc76c));}_0x5af42c=_0x5af42c||0x0;var _0x3ba1d0=0x1/_0x4036c7;var _0x12e572=0x0;var _0x46c23a=0x0;var _0x57db2e=0x0;var _0x240195=0x0;for(var _0x5bb886=0x0;_0x240195<_0x5cc76c;_0x5bb886+=0x1){_0x46c23a=_0x5bb886/_0x57acfd;_0x12e572=(_0x53199d*_0x46c23a+_0x5af42c)/_0x3ba1d0;_0x57db2e=utils[_0x19c8('0x229')](_0x12e572,_0x49f3d4);_0x240195=_0x12e572/_0x49f3d4*(0x1-utils[_0x19c8('0x229')](_0x12e572,_0x49f3d4));}return _0x358a30({'erlangCalls':_0x5bb886,'erlangCallToSecond':_0x57acfd/_0x5bb886,'erlangAbandonmentRate':_0x57db2e,'erlangBusyFactor':_0x240195});});};module[_0x19c8('0x22a')]=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 fae76f7..1e60288 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 _0x8d3b=['moment','isNil','string','phone','firstName','Contact','lastName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','name','dialCutDigit','substring','queue','exports','util','lodash'];(function(_0x89a7ea,_0x15aa82){var _0x4cdbf0=function(_0x27162d){while(--_0x27162d){_0x89a7ea['push'](_0x89a7ea['shift']());}};_0x4cdbf0(++_0x15aa82);}(_0x8d3b,0xb2));var _0xb8d3=function(_0x2c4d2c,_0x433527){_0x2c4d2c=_0x2c4d2c-0x0;var _0x769dcf=_0x8d3b[_0x2c4d2c];return _0x769dcf;};'use strict';var util=require(_0xb8d3('0x0'));var _=require(_0xb8d3('0x1'));var moment=require(_0xb8d3('0x2'));function checkNameSurname(_0x59bb05,_0x3fda2c,_0x22ac9e){var _0x566f18='';if(!_[_0xb8d3('0x3')](_0x3fda2c)&&'string'===typeof _0x3fda2c){_0x566f18+=_0x3fda2c;}if(!_[_0xb8d3('0x3')](_0x22ac9e)&&_0xb8d3('0x4')===typeof _0x22ac9e){_0x566f18+='\x20'+_0x22ac9e;}if(_0x566f18!==''){return _0x566f18;}return _0x59bb05;}function Action(_0x52eefc,_0x1fa061,_0x4dd980){this['voiceQueue']=_0x52eefc;this['uniqueid']=_0x4dd980||undefined;this['name']=checkNameSurname(_0x1fa061['Contact'][_0xb8d3('0x5')],_0x1fa061['Contact'][_0xb8d3('0x6')],_0x1fa061[_0xb8d3('0x7')][_0xb8d3('0x8')]);this[_0xb8d3('0x9')]=_0x1fa061[_0xb8d3('0x5')];this['queue']=_0x52eefc['name'];this[_0xb8d3('0xa')]=_0x1fa061[_0xb8d3('0xa')]||![];this[_0xb8d3('0xb')]=_0x52eefc[_0xb8d3('0xb')];this[_0xb8d3('0xc')]=_0x52eefc[_0xb8d3('0xc')]||0x3;this[_0xb8d3('0xd')]=_0x1fa061[_0xb8d3('0xd')];this[_0xb8d3('0xe')]=_0x1fa061[_0xb8d3('0xe')];this['countcongestionretry']=_0x1fa061[_0xb8d3('0xf')];this[_0xb8d3('0x10')]=_0x1fa061[_0xb8d3('0x10')];this['countnosuchnumberretry']=_0x1fa061['countnosuchnumberretry'];this['countdropretry']=_0x1fa061[_0xb8d3('0x11')];this[_0xb8d3('0x12')]=_0x1fa061[_0xb8d3('0x12')];this['countmachineretry']=_0x1fa061[_0xb8d3('0x13')];this[_0xb8d3('0x14')]=_0x1fa061['countagentrejectretry'];this['ContactId']=_0x1fa061[_0xb8d3('0x15')];this[_0xb8d3('0x16')]=_0x1fa061[_0xb8d3('0x16')];this[_0xb8d3('0x17')]=_0x1fa061[_0xb8d3('0x17')];this[_0xb8d3('0x18')]=_0x1fa061[_0xb8d3('0x18')];this[_0xb8d3('0x19')]=_0x1fa061[_0xb8d3('0x19')];this[_0xb8d3('0x1a')]=_0x1fa061['id'];this[_0xb8d3('0x1b')]=_0x1fa061[_0xb8d3('0x7')]['firstName']||'';this[_0xb8d3('0x1c')]=moment()[_0xb8d3('0x1d')](_0xb8d3('0x1e'));this[_0xb8d3('0x1f')]=_0x1fa061[_0xb8d3('0x1f')];this[_0xb8d3('0x20')]=_0x1fa061['callbackuniqueid'];this[_0xb8d3('0x21')]=_0x1fa061['callbackat'];this[_0xb8d3('0x22')]=_0x1fa061['recallme'];this[_0xb8d3('0x23')]='';this[_0xb8d3('0x24')]='';}Action[_0xb8d3('0x25')][_0xb8d3('0x26')]=function(){return util[_0xb8d3('0x1d')](_0xb8d3('0x27'),this[_0xb8d3('0x28')],this['voiceQueue'][_0xb8d3('0x29')]>0x0?this[_0xb8d3('0x9')][_0xb8d3('0x2a')](this['voiceQueue'][_0xb8d3('0x29')]):this[_0xb8d3('0x9')]);};Action[_0xb8d3('0x25')]['getQueue']=function(){return this[_0xb8d3('0x2b')];};module[_0xb8d3('0x2c')]=Action; \ No newline at end of file +var _0x62ab=['prototype','queue','exports','lodash','moment','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','dialCutDigit'];(function(_0x70ede7,_0x550075){var _0x114323=function(_0x4f87bc){while(--_0x4f87bc){_0x70ede7['push'](_0x70ede7['shift']());}};_0x114323(++_0x550075);}(_0x62ab,0xdf));var _0xb62a=function(_0x198b06,_0x2b12a6){_0x198b06=_0x198b06-0x0;var _0x386dbf=_0x62ab[_0x198b06];return _0x386dbf;};'use strict';var util=require('util');var _=require(_0xb62a('0x0'));var moment=require(_0xb62a('0x1'));function checkNameSurname(_0x19d405,_0x4e836e,_0x5f0576){var _0xc1ded='';if(!_['isNil'](_0x4e836e)&&_0xb62a('0x2')===typeof _0x4e836e){_0xc1ded+=_0x4e836e;}if(!_['isNil'](_0x5f0576)&&_0xb62a('0x2')===typeof _0x5f0576){_0xc1ded+='\x20'+_0x5f0576;}if(_0xc1ded!==''){return _0xc1ded;}return _0x19d405;}function Action(_0xadf011,_0x45b7b8,_0xd1d333){this[_0xb62a('0x3')]=_0xadf011;this[_0xb62a('0x4')]=_0xd1d333||undefined;this[_0xb62a('0x5')]=checkNameSurname(_0x45b7b8[_0xb62a('0x6')][_0xb62a('0x7')],_0x45b7b8[_0xb62a('0x6')][_0xb62a('0x8')],_0x45b7b8[_0xb62a('0x6')][_0xb62a('0x9')]);this[_0xb62a('0xa')]=_0x45b7b8[_0xb62a('0x7')];this['queue']=_0xadf011[_0xb62a('0x5')];this['active']=_0x45b7b8[_0xb62a('0xb')]||![];this[_0xb62a('0xc')]=_0xadf011[_0xb62a('0xc')];this[_0xb62a('0xd')]=_0xadf011['dialQueueTimeout']||0x3;this['scheduledat']=_0x45b7b8[_0xb62a('0xe')];this[_0xb62a('0xf')]=_0x45b7b8[_0xb62a('0xf')];this[_0xb62a('0x10')]=_0x45b7b8[_0xb62a('0x10')];this['countnoanswerretry']=_0x45b7b8[_0xb62a('0x11')];this[_0xb62a('0x12')]=_0x45b7b8['countnosuchnumberretry'];this[_0xb62a('0x13')]=_0x45b7b8['countdropretry'];this['countabandonedretry']=_0x45b7b8[_0xb62a('0x14')];this[_0xb62a('0x15')]=_0x45b7b8[_0xb62a('0x15')];this[_0xb62a('0x16')]=_0x45b7b8[_0xb62a('0x16')];this[_0xb62a('0x17')]=_0x45b7b8['ContactId'];this['ListId']=_0x45b7b8[_0xb62a('0x18')];this[_0xb62a('0x19')]=_0x45b7b8['UserId'];this[_0xb62a('0x1a')]=_0x45b7b8['VoiceQueueId'];this[_0xb62a('0x1b')]=_0x45b7b8['CampaignId'];this[_0xb62a('0x1c')]=_0x45b7b8['id'];this[_0xb62a('0x1d')]=_0x45b7b8[_0xb62a('0x6')][_0xb62a('0x8')]||'';this[_0xb62a('0x1e')]=moment()[_0xb62a('0x1f')](_0xb62a('0x20'));this[_0xb62a('0x21')]=_0x45b7b8[_0xb62a('0x21')];this['callbackuniqueid']=_0x45b7b8['callbackuniqueid'];this[_0xb62a('0x22')]=_0x45b7b8[_0xb62a('0x22')];this[_0xb62a('0x23')]=_0x45b7b8['recallme'];this[_0xb62a('0x24')]='';this[_0xb62a('0x25')]='';}Action['prototype'][_0xb62a('0x26')]=function(){return util[_0xb62a('0x1f')](_0xb62a('0x27'),this['name'],this[_0xb62a('0x3')][_0xb62a('0x28')]>0x0?this[_0xb62a('0xa')]['substring'](this[_0xb62a('0x3')][_0xb62a('0x28')]):this[_0xb62a('0xa')]);};Action[_0xb62a('0x29')]['getQueue']=function(){return this[_0xb62a('0x2a')];};module[_0xb62a('0x2b')]=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 01c2585..aea7fae 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 _0x11a6=['countabandonedretry','uniqueid','calleridnum','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry'];(function(_0x2dcbf3,_0xb261d3){var _0x2632af=function(_0x2f5d8a){while(--_0x2f5d8a){_0x2dcbf3['push'](_0x2dcbf3['shift']());}};_0x2632af(++_0xb261d3);}(_0x11a6,0x1de));var _0x611a=function(_0x1bc9a8,_0x19b847){_0x1bc9a8=_0x1bc9a8-0x0;var _0x205191=_0x11a6[_0x1bc9a8];return _0x205191;};'use strict';var moment=require(_0x611a('0x0'));var utils=require(_0x611a('0x1'));function AgentComplete(_0x136ae7,_0x3cbd36){this[_0x611a('0x2')]=0x4;this[_0x611a('0x3')]=_0x611a('0x4');this[_0x611a('0x5')]=_0x136ae7[_0x611a('0x5')];this[_0x611a('0x6')]=_0x136ae7[_0x611a('0x6')];this['campaigntype']=_0x136ae7[_0x611a('0x6')]===_0x611a('0x7')?_0x611a('0x8'):_0x136ae7[_0x611a('0x6')];this[_0x611a('0x9')]=_0x136ae7[_0x611a('0x9')];this['countcongestionretry']=_0x136ae7[_0x611a('0xa')];this[_0x611a('0xb')]=_0x136ae7[_0x611a('0xb')];this[_0x611a('0xc')]=_0x136ae7[_0x611a('0x9')]+_0x136ae7[_0x611a('0xa')]+_0x136ae7[_0x611a('0xb')]+_0x136ae7[_0x611a('0xd')]+_0x136ae7[_0x611a('0xe')]+_0x136ae7['countabandonedretry']+_0x136ae7[_0x611a('0xf')]+_0x136ae7[_0x611a('0x10')];this[_0x611a('0xd')]=_0x136ae7[_0x611a('0xd')];this[_0x611a('0xe')]=_0x136ae7['countdropretry'];this[_0x611a('0x11')]=_0x136ae7['countabandonedretry'];this[_0x611a('0xf')]=_0x136ae7[_0x611a('0xf')];this[_0x611a('0x10')]=_0x136ae7[_0x611a('0x10')];this[_0x611a('0x12')]=_0x3cbd36['uniqueid'];this['calleridname']=_0x136ae7['name'];this[_0x611a('0x13')]=_0x136ae7['number'];this[_0x611a('0x14')]=_0x136ae7[_0x611a('0x14')];this[_0x611a('0x15')]=_0x136ae7[_0x611a('0x15')];this[_0x611a('0x16')]=_0x136ae7[_0x611a('0x16')];this[_0x611a('0x17')]=moment()[_0x611a('0x18')](_0x611a('0x19'));this[_0x611a('0x1a')]=utils[_0x611a('0x1b')](_0x136ae7[_0x611a('0x15')],_0x136ae7[_0x611a('0x14')]);this[_0x611a('0x1c')]=utils['getSeconds'](_0x136ae7[_0x611a('0x16')],_0x136ae7[_0x611a('0x15')]);this[_0x611a('0x1d')]=utils[_0x611a('0x1b')](this[_0x611a('0x17')],_0x136ae7[_0x611a('0x16')]);this['queue']=_0x3cbd36[_0x611a('0x8')];this['membername']=_0x3cbd36[_0x611a('0x1e')];this[_0x611a('0x1f')]=_0x3cbd36[_0x611a('0x1f')];this[_0x611a('0x20')]=_0x136ae7[_0x611a('0x20')];this[_0x611a('0x21')]=_0x136ae7[_0x611a('0x21')];this[_0x611a('0x22')]=_0x136ae7['callbackat'];this[_0x611a('0x23')]=_0x136ae7[_0x611a('0x23')];this['ContactId']=_0x136ae7[_0x611a('0x24')];this['ListId']=_0x136ae7[_0x611a('0x25')];this['UserId']=_0x136ae7[_0x611a('0x26')];this['VoiceQueueId']=_0x136ae7[_0x611a('0x27')];this[_0x611a('0x28')]=_0x136ae7['CampaignId'];this['originatecalleridnum']=_0x136ae7[_0x611a('0x29')]||'';this[_0x611a('0x2a')]=_0x136ae7['originatecalleridname']||'';this[_0x611a('0x2b')]=_0x136ae7[_0x611a('0x2b')];}module[_0x611a('0x2c')]=AgentComplete; \ No newline at end of file +var _0x4975=['uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','getSeconds','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','agiafterat','moment','../utils','state','Answer','scheduledat','type','outbound','queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4975,0x6d));var _0x5497=function(_0xe3f89a,_0x52c7c9){_0xe3f89a=_0xe3f89a-0x0;var _0x470f81=_0x4975[_0xe3f89a];return _0x470f81;};'use strict';var moment=require(_0x5497('0x0'));var utils=require(_0x5497('0x1'));function AgentComplete(_0x26d83f,_0x3e4c39){this[_0x5497('0x2')]=0x4;this['statedesc']=_0x5497('0x3');this[_0x5497('0x4')]=_0x26d83f['scheduledat'];this[_0x5497('0x5')]=_0x26d83f['type'];this['campaigntype']=_0x26d83f[_0x5497('0x5')]===_0x5497('0x6')?_0x5497('0x7'):_0x26d83f[_0x5497('0x5')];this[_0x5497('0x8')]=_0x26d83f['countbusyretry'];this['countcongestionretry']=_0x26d83f['countcongestionretry'];this[_0x5497('0x9')]=_0x26d83f['countnoanswerretry'];this[_0x5497('0xa')]=_0x26d83f['countbusyretry']+_0x26d83f[_0x5497('0xb')]+_0x26d83f[_0x5497('0x9')]+_0x26d83f[_0x5497('0xc')]+_0x26d83f[_0x5497('0xd')]+_0x26d83f['countabandonedretry']+_0x26d83f['countmachineretry']+_0x26d83f[_0x5497('0xe')];this[_0x5497('0xc')]=_0x26d83f[_0x5497('0xc')];this[_0x5497('0xd')]=_0x26d83f['countdropretry'];this[_0x5497('0xf')]=_0x26d83f['countabandonedretry'];this[_0x5497('0x10')]=_0x26d83f[_0x5497('0x10')];this[_0x5497('0xe')]=_0x26d83f[_0x5497('0xe')];this[_0x5497('0x11')]=_0x3e4c39[_0x5497('0x11')];this[_0x5497('0x12')]=_0x26d83f[_0x5497('0x13')];this[_0x5497('0x14')]=_0x26d83f[_0x5497('0x15')];this[_0x5497('0x16')]=_0x26d83f['starttime'];this[_0x5497('0x17')]=_0x26d83f['responsetime'];this[_0x5497('0x18')]=_0x26d83f[_0x5497('0x18')];this['endtime']=moment()[_0x5497('0x19')](_0x5497('0x1a'));this['ringtime']=utils['getSeconds'](_0x26d83f[_0x5497('0x17')],_0x26d83f[_0x5497('0x16')]);this[_0x5497('0x1b')]=utils['getSeconds'](_0x26d83f[_0x5497('0x18')],_0x26d83f[_0x5497('0x17')]);this[_0x5497('0x1c')]=utils[_0x5497('0x1d')](this['endtime'],_0x26d83f[_0x5497('0x18')]);this['queue']=_0x3e4c39[_0x5497('0x7')];this['membername']=_0x3e4c39[_0x5497('0x1e')];this[_0x5497('0x1f')]=_0x3e4c39[_0x5497('0x1f')];this[_0x5497('0x20')]=_0x26d83f['callback'];this['callbackuniqueid']=_0x26d83f[_0x5497('0x21')];this[_0x5497('0x22')]=_0x26d83f[_0x5497('0x22')];this[_0x5497('0x23')]=_0x26d83f[_0x5497('0x23')];this[_0x5497('0x24')]=_0x26d83f[_0x5497('0x24')];this['ListId']=_0x26d83f['ListId'];this['UserId']=_0x26d83f[_0x5497('0x25')];this['VoiceQueueId']=_0x26d83f[_0x5497('0x26')];this['CampaignId']=_0x26d83f['CampaignId'];this['originatecalleridnum']=_0x26d83f[_0x5497('0x27')]||'';this['originatecalleridname']=_0x26d83f[_0x5497('0x28')]||'';this[_0x5497('0x29')]=_0x26d83f[_0x5497('0x29')];}module['exports']=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 026fbb1..1c09401 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 _0x4215=['scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','state','exports','uniqueid'];(function(_0x3e3b81,_0xbab39d){var _0x21e92f=function(_0x2a4fc9){while(--_0x2a4fc9){_0x3e3b81['push'](_0x3e3b81['shift']());}};_0x21e92f(++_0xbab39d);}(_0x4215,0x18b));var _0x5421=function(_0x3dab9b,_0x57bd33){_0x3dab9b=_0x3dab9b-0x0;var _0x4e5474=_0x4215[_0x3dab9b];return _0x4e5474;};'use strict';function Final(_0x8fa2f5){this[_0x5421('0x0')]=_0x8fa2f5['uniqueid'];this[_0x5421('0x1')]=_0x8fa2f5['scheduledat'];this[_0x5421('0x2')]=_0x8fa2f5[_0x5421('0x2')];this[_0x5421('0x3')]=_0x8fa2f5['type']==='outbound'?_0x5421('0x4'):_0x8fa2f5[_0x5421('0x2')];this['countbusyretry']=_0x8fa2f5[_0x5421('0x5')];this['countcongestionretry']=_0x8fa2f5[_0x5421('0x6')];this[_0x5421('0x7')]=_0x8fa2f5[_0x5421('0x7')];this[_0x5421('0x8')]=_0x8fa2f5[_0x5421('0x5')]+_0x8fa2f5[_0x5421('0x6')]+_0x8fa2f5[_0x5421('0x7')]+_0x8fa2f5[_0x5421('0x9')]+_0x8fa2f5[_0x5421('0xa')]+_0x8fa2f5[_0x5421('0xb')]+_0x8fa2f5[_0x5421('0xc')]+_0x8fa2f5[_0x5421('0xd')];this[_0x5421('0x9')]=_0x8fa2f5[_0x5421('0x9')];this['countdropretry']=_0x8fa2f5[_0x5421('0xa')];this['countabandonedretry']=_0x8fa2f5[_0x5421('0xb')];this['countmachineretry']=_0x8fa2f5[_0x5421('0xc')];this[_0x5421('0xd')]=_0x8fa2f5[_0x5421('0xd')];this['queue']=_0x8fa2f5['queue'];this['calleridname']=_0x8fa2f5['calleridname'];this['calleridnum']=_0x8fa2f5[_0x5421('0xe')];this[_0x5421('0xf')]=_0x8fa2f5['starttime'];this['responsetime']=_0x8fa2f5[_0x5421('0x10')];this[_0x5421('0x11')]=_0x8fa2f5['responsetime'];this['ringtime']=_0x8fa2f5[_0x5421('0x12')]||0x0;this['holdtime']=_0x8fa2f5[_0x5421('0x13')]||0x0;this[_0x5421('0x14')]=_0x8fa2f5['talktime']||0x0;this[_0x5421('0x15')]=_0x8fa2f5['callback'];this[_0x5421('0x16')]=_0x8fa2f5[_0x5421('0x16')];this[_0x5421('0x17')]=_0x8fa2f5['callbackat'];this['recallme']=_0x8fa2f5[_0x5421('0x18')];this[_0x5421('0x19')]=_0x8fa2f5[_0x5421('0x19')];this[_0x5421('0x1a')]=_0x8fa2f5['ListId'];this[_0x5421('0x1b')]=_0x8fa2f5['UserId'];this[_0x5421('0x1c')]=_0x8fa2f5[_0x5421('0x1c')];this['CampaignId']=_0x8fa2f5['CampaignId'];this[_0x5421('0x1d')]=_0x8fa2f5['originatecalleridnum']||'';this[_0x5421('0x1e')]=_0x8fa2f5[_0x5421('0x1e')]||'';this[_0x5421('0x1f')]=_0x8fa2f5[_0x5421('0x1f')];this['statedesc']=_0x8fa2f5['statedesc'];}module[_0x5421('0x20')]=Final; \ No newline at end of file +var _0xbd77=['originatecalleridname','state','statedesc','exports','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xbd77,0x1d2));var _0x7bd7=function(_0x554252,_0xce97ae){_0x554252=_0x554252-0x0;var _0x106d06=_0xbd77[_0x554252];return _0x106d06;};'use strict';function Final(_0x3b0a77){this['uniqueid']=_0x3b0a77['uniqueid'];this[_0x7bd7('0x0')]=_0x3b0a77[_0x7bd7('0x0')];this[_0x7bd7('0x1')]=_0x3b0a77[_0x7bd7('0x1')];this['campaigntype']=_0x3b0a77[_0x7bd7('0x1')]===_0x7bd7('0x2')?_0x7bd7('0x3'):_0x3b0a77[_0x7bd7('0x1')];this[_0x7bd7('0x4')]=_0x3b0a77[_0x7bd7('0x4')];this[_0x7bd7('0x5')]=_0x3b0a77[_0x7bd7('0x5')];this['countnoanswerretry']=_0x3b0a77[_0x7bd7('0x6')];this['countglobal']=_0x3b0a77[_0x7bd7('0x4')]+_0x3b0a77['countcongestionretry']+_0x3b0a77['countnoanswerretry']+_0x3b0a77[_0x7bd7('0x7')]+_0x3b0a77['countdropretry']+_0x3b0a77[_0x7bd7('0x8')]+_0x3b0a77[_0x7bd7('0x9')]+_0x3b0a77[_0x7bd7('0xa')];this['countnosuchnumberretry']=_0x3b0a77[_0x7bd7('0x7')];this[_0x7bd7('0xb')]=_0x3b0a77[_0x7bd7('0xb')];this[_0x7bd7('0x8')]=_0x3b0a77['countabandonedretry'];this[_0x7bd7('0x9')]=_0x3b0a77[_0x7bd7('0x9')];this[_0x7bd7('0xa')]=_0x3b0a77[_0x7bd7('0xa')];this[_0x7bd7('0x3')]=_0x3b0a77['queue'];this['calleridname']=_0x3b0a77[_0x7bd7('0xc')];this[_0x7bd7('0xd')]=_0x3b0a77['calleridnum'];this[_0x7bd7('0xe')]=_0x3b0a77['starttime'];this['responsetime']=_0x3b0a77['responsetime'];this['endtime']=_0x3b0a77[_0x7bd7('0xf')];this[_0x7bd7('0x10')]=_0x3b0a77[_0x7bd7('0x10')]||0x0;this[_0x7bd7('0x11')]=_0x3b0a77['holdtime']||0x0;this[_0x7bd7('0x12')]=_0x3b0a77[_0x7bd7('0x12')]||0x0;this[_0x7bd7('0x13')]=_0x3b0a77['callback'];this[_0x7bd7('0x14')]=_0x3b0a77[_0x7bd7('0x14')];this['callbackat']=_0x3b0a77[_0x7bd7('0x15')];this[_0x7bd7('0x16')]=_0x3b0a77['recallme'];this[_0x7bd7('0x17')]=_0x3b0a77[_0x7bd7('0x17')];this[_0x7bd7('0x18')]=_0x3b0a77[_0x7bd7('0x18')];this[_0x7bd7('0x19')]=_0x3b0a77[_0x7bd7('0x19')];this[_0x7bd7('0x1a')]=_0x3b0a77[_0x7bd7('0x1a')];this[_0x7bd7('0x1b')]=_0x3b0a77[_0x7bd7('0x1b')];this[_0x7bd7('0x1c')]=_0x3b0a77[_0x7bd7('0x1c')]||'';this[_0x7bd7('0x1d')]=_0x3b0a77[_0x7bd7('0x1d')]||'';this[_0x7bd7('0x1e')]=_0x3b0a77[_0x7bd7('0x1e')];this[_0x7bd7('0x1f')]=_0x3b0a77[_0x7bd7('0x1f')];}module[_0x7bd7('0x20')]=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 ec3909b..521abad 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 _0xe098=['campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','ringtime','getSeconds','holdtime','talktime','IVR','reason','cause-txt','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','state','statedesc','Answer','scheduledat','type'];(function(_0x186d17,_0x9fa8ef){var _0x5d4b89=function(_0x57bd70){while(--_0x57bd70){_0x186d17['push'](_0x186d17['shift']());}};_0x5d4b89(++_0x9fa8ef);}(_0xe098,0x186));var _0x8e09=function(_0x10b7cd,_0x49a73a){_0x10b7cd=_0x10b7cd-0x0;var _0x59a61f=_0xe098[_0x10b7cd];return _0x59a61f;};'use strict';var moment=require(_0x8e09('0x0'));var utils=require('../utils');function Hangup(_0x1d9463,_0x2c61af){this[_0x8e09('0x1')]=0x4;this[_0x8e09('0x2')]=_0x8e09('0x3');this[_0x8e09('0x4')]=_0x1d9463[_0x8e09('0x4')];this[_0x8e09('0x5')]=_0x1d9463[_0x8e09('0x5')];this[_0x8e09('0x6')]=_0x1d9463[_0x8e09('0x5')]===_0x8e09('0x7')?_0x8e09('0x8'):_0x1d9463[_0x8e09('0x5')];this[_0x8e09('0x9')]=_0x1d9463[_0x8e09('0x9')]||![];this['countbusyretry']=_0x1d9463[_0x8e09('0xa')];this[_0x8e09('0xb')]=_0x1d9463[_0x8e09('0xb')];this[_0x8e09('0xc')]=_0x1d9463['countnoanswerretry'];this[_0x8e09('0xd')]=_0x1d9463[_0x8e09('0xa')]+_0x1d9463['countcongestionretry']+_0x1d9463[_0x8e09('0xc')]+_0x1d9463['countnosuchnumberretry']+_0x1d9463[_0x8e09('0xe')]+_0x1d9463[_0x8e09('0xf')]+_0x1d9463[_0x8e09('0x10')]+_0x1d9463[_0x8e09('0x11')];this[_0x8e09('0x12')]=_0x1d9463['countnosuchnumberretry'];this['countdropretry']=_0x1d9463[_0x8e09('0xe')];this[_0x8e09('0xf')]=_0x1d9463['countabandonedretry'];this[_0x8e09('0x10')]=_0x1d9463[_0x8e09('0x10')];this['countagentrejectretry']=_0x1d9463[_0x8e09('0x11')];this[_0x8e09('0x13')]=_0x2c61af['uniqueid'];this[_0x8e09('0x14')]=_0x1d9463[_0x8e09('0x15')];this[_0x8e09('0x16')]=_0x1d9463[_0x8e09('0x17')];this['starttime']=_0x1d9463[_0x8e09('0x18')];this[_0x8e09('0x19')]=_0x1d9463[_0x8e09('0x19')];this[_0x8e09('0x1a')]=moment()[_0x8e09('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x8e09('0x1c')]=utils[_0x8e09('0x1d')](_0x1d9463[_0x8e09('0x19')],_0x1d9463[_0x8e09('0x18')]);this[_0x8e09('0x1e')]=0x0;this[_0x8e09('0x1f')]=utils[_0x8e09('0x1d')](this[_0x8e09('0x1a')],_0x1d9463[_0x8e09('0x19')]);this[_0x8e09('0x8')]=_0x1d9463['queue'];this['membername']=_0x8e09('0x20');this[_0x8e09('0x21')]=_0x2c61af[_0x8e09('0x22')];this[_0x8e09('0x23')]=_0x1d9463[_0x8e09('0x23')];this['callbackuniqueid']=_0x1d9463['callbackuniqueid'];this['callbackat']=_0x1d9463[_0x8e09('0x24')];this['recallme']=_0x1d9463[_0x8e09('0x25')];this[_0x8e09('0x26')]=_0x1d9463['ContactId'];this['ListId']=_0x1d9463[_0x8e09('0x27')];this[_0x8e09('0x28')]=_0x1d9463[_0x8e09('0x28')];this[_0x8e09('0x29')]=_0x1d9463[_0x8e09('0x29')];this['CampaignId']=_0x1d9463[_0x8e09('0x2a')];}module[_0x8e09('0x2b')]=Hangup; \ No newline at end of file +var _0x6ad1=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','exports','moment','../utils','state','type','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','IVR','reason','cause-txt'];(function(_0x609988,_0x507944){var _0x159984=function(_0x39d9ce){while(--_0x39d9ce){_0x609988['push'](_0x609988['shift']());}};_0x159984(++_0x507944);}(_0x6ad1,0x7b));var _0x16ad=function(_0x228398,_0x3d47ef){_0x228398=_0x228398-0x0;var _0x23520c=_0x6ad1[_0x228398];return _0x23520c;};'use strict';var moment=require(_0x16ad('0x0'));var utils=require(_0x16ad('0x1'));function Hangup(_0x1ee0f5,_0x3d9165){this[_0x16ad('0x2')]=0x4;this['statedesc']='Answer';this['scheduledat']=_0x1ee0f5['scheduledat'];this[_0x16ad('0x3')]=_0x1ee0f5[_0x16ad('0x3')];this['campaigntype']=_0x1ee0f5[_0x16ad('0x3')]===_0x16ad('0x4')?_0x16ad('0x5'):_0x1ee0f5[_0x16ad('0x3')];this['amd']=_0x1ee0f5[_0x16ad('0x6')]||![];this[_0x16ad('0x7')]=_0x1ee0f5['countbusyretry'];this['countcongestionretry']=_0x1ee0f5[_0x16ad('0x8')];this['countnoanswerretry']=_0x1ee0f5[_0x16ad('0x9')];this[_0x16ad('0xa')]=_0x1ee0f5[_0x16ad('0x7')]+_0x1ee0f5['countcongestionretry']+_0x1ee0f5[_0x16ad('0x9')]+_0x1ee0f5[_0x16ad('0xb')]+_0x1ee0f5[_0x16ad('0xc')]+_0x1ee0f5['countabandonedretry']+_0x1ee0f5[_0x16ad('0xd')]+_0x1ee0f5[_0x16ad('0xe')];this['countnosuchnumberretry']=_0x1ee0f5[_0x16ad('0xb')];this['countdropretry']=_0x1ee0f5[_0x16ad('0xc')];this[_0x16ad('0xf')]=_0x1ee0f5[_0x16ad('0xf')];this[_0x16ad('0xd')]=_0x1ee0f5[_0x16ad('0xd')];this[_0x16ad('0xe')]=_0x1ee0f5[_0x16ad('0xe')];this[_0x16ad('0x10')]=_0x3d9165[_0x16ad('0x10')];this[_0x16ad('0x11')]=_0x1ee0f5['name'];this['calleridnum']=_0x1ee0f5['number'];this[_0x16ad('0x12')]=_0x1ee0f5['starttime'];this['responsetime']=_0x1ee0f5[_0x16ad('0x13')];this[_0x16ad('0x14')]=moment()[_0x16ad('0x15')](_0x16ad('0x16'));this[_0x16ad('0x17')]=utils['getSeconds'](_0x1ee0f5[_0x16ad('0x13')],_0x1ee0f5[_0x16ad('0x12')]);this[_0x16ad('0x18')]=0x0;this[_0x16ad('0x19')]=utils['getSeconds'](this['endtime'],_0x1ee0f5[_0x16ad('0x13')]);this[_0x16ad('0x5')]=_0x1ee0f5[_0x16ad('0x5')];this['membername']=_0x16ad('0x1a');this[_0x16ad('0x1b')]=_0x3d9165[_0x16ad('0x1c')];this[_0x16ad('0x1d')]=_0x1ee0f5[_0x16ad('0x1d')];this[_0x16ad('0x1e')]=_0x1ee0f5['callbackuniqueid'];this[_0x16ad('0x1f')]=_0x1ee0f5[_0x16ad('0x1f')];this[_0x16ad('0x20')]=_0x1ee0f5[_0x16ad('0x20')];this[_0x16ad('0x21')]=_0x1ee0f5[_0x16ad('0x21')];this[_0x16ad('0x22')]=_0x1ee0f5[_0x16ad('0x22')];this[_0x16ad('0x23')]=_0x1ee0f5['UserId'];this['VoiceQueueId']=_0x1ee0f5['VoiceQueueId'];this[_0x16ad('0x24')]=_0x1ee0f5[_0x16ad('0x24')];}module[_0x16ad('0x25')]=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 966cfec..1ab85dd 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 _0xe5b0=['calleridname','name','calleridnum','number','starttime','responsetime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0xe5b0,0x111));var _0x0e5b=function(_0x167ae5,_0x38c513){_0x167ae5=_0x167ae5-0x0;var _0x1d8e6f=_0xe5b0[_0x167ae5];return _0x1d8e6f;};'use strict';var utils=require(_0x0e5b('0x0'));function History(_0x3801f8){this['uniqueid']=_0x3801f8[_0x0e5b('0x1')];this['scheduledat']=_0x3801f8[_0x0e5b('0x2')]||undefined;this[_0x0e5b('0x3')]=_0x3801f8[_0x0e5b('0x3')];this[_0x0e5b('0x4')]=_0x3801f8['type']===_0x0e5b('0x5')?'queue':_0x3801f8[_0x0e5b('0x3')];this[_0x0e5b('0x6')]=_0x3801f8['countbusyretry'];this[_0x0e5b('0x7')]=_0x3801f8['countcongestionretry'];this['countnoanswerretry']=_0x3801f8[_0x0e5b('0x8')];this['countglobal']=_0x3801f8['countbusyretry']+_0x3801f8[_0x0e5b('0x7')]+_0x3801f8[_0x0e5b('0x8')]+_0x3801f8[_0x0e5b('0x9')]+_0x3801f8[_0x0e5b('0xa')]+_0x3801f8[_0x0e5b('0xb')]+_0x3801f8[_0x0e5b('0xc')]+_0x3801f8[_0x0e5b('0xd')];this['countnosuchnumberretry']=_0x3801f8['countnosuchnumberretry'];this['countdropretry']=_0x3801f8[_0x0e5b('0xa')];this[_0x0e5b('0xb')]=_0x3801f8[_0x0e5b('0xb')];this[_0x0e5b('0xc')]=_0x3801f8[_0x0e5b('0xc')];this[_0x0e5b('0xd')]=_0x3801f8[_0x0e5b('0xd')];this[_0x0e5b('0xe')]=_0x3801f8[_0x0e5b('0xe')];this[_0x0e5b('0xf')]=_0x3801f8[_0x0e5b('0x10')];this[_0x0e5b('0x11')]=_0x3801f8[_0x0e5b('0x12')];this[_0x0e5b('0x13')]=_0x3801f8['starttime'];this['responsetime']=_0x3801f8[_0x0e5b('0x14')];this['endtime']=_0x3801f8[_0x0e5b('0x14')];this[_0x0e5b('0x15')]=utils['getSeconds'](_0x3801f8[_0x0e5b('0x14')],_0x3801f8[_0x0e5b('0x13')]);this[_0x0e5b('0x16')]=0x0;this['talktime']=0x0;this[_0x0e5b('0x17')]=_0x3801f8[_0x0e5b('0x17')];this['callbackuniqueid']=_0x3801f8[_0x0e5b('0x18')];this[_0x0e5b('0x19')]=_0x3801f8['callbackat'];this['recallme']=_0x3801f8[_0x0e5b('0x1a')];this[_0x0e5b('0x1b')]=_0x3801f8[_0x0e5b('0x1b')];this['ListId']=_0x3801f8['ListId'];this[_0x0e5b('0x1c')]=_0x3801f8[_0x0e5b('0x1c')];this[_0x0e5b('0x1d')]=_0x3801f8[_0x0e5b('0x1d')];this[_0x0e5b('0x1e')]=_0x3801f8['CampaignId'];this['originatecalleridnum']=_0x3801f8[_0x0e5b('0x1f')]||'';this[_0x0e5b('0x20')]=_0x3801f8['originatecalleridname']||'';this[_0x0e5b('0x21')]=_0x3801f8[_0x0e5b('0x21')];this[_0x0e5b('0x22')]=_0x3801f8[_0x0e5b('0x22')];}module[_0x0e5b('0x23')]=History; \ No newline at end of file +var _0x74ec=['countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','name','calleridnum','number','starttime','endtime','responsetime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x13651c,_0x1b81c5){var _0xc6ea66=function(_0x47c20d){while(--_0x47c20d){_0x13651c['push'](_0x13651c['shift']());}};_0xc6ea66(++_0x1b81c5);}(_0x74ec,0x1ae));var _0xc74e=function(_0x26383d,_0x47b827){_0x26383d=_0x26383d-0x0;var _0x205f90=_0x74ec[_0x26383d];return _0x205f90;};'use strict';var utils=require(_0xc74e('0x0'));function History(_0x519c48){this[_0xc74e('0x1')]=_0x519c48[_0xc74e('0x1')];this[_0xc74e('0x2')]=_0x519c48[_0xc74e('0x2')]||undefined;this[_0xc74e('0x3')]=_0x519c48[_0xc74e('0x3')];this[_0xc74e('0x4')]=_0x519c48[_0xc74e('0x3')]===_0xc74e('0x5')?_0xc74e('0x6'):_0x519c48[_0xc74e('0x3')];this[_0xc74e('0x7')]=_0x519c48[_0xc74e('0x7')];this[_0xc74e('0x8')]=_0x519c48[_0xc74e('0x8')];this[_0xc74e('0x9')]=_0x519c48[_0xc74e('0x9')];this[_0xc74e('0xa')]=_0x519c48['countbusyretry']+_0x519c48[_0xc74e('0x8')]+_0x519c48[_0xc74e('0x9')]+_0x519c48['countnosuchnumberretry']+_0x519c48[_0xc74e('0xb')]+_0x519c48[_0xc74e('0xc')]+_0x519c48[_0xc74e('0xd')]+_0x519c48[_0xc74e('0xe')];this[_0xc74e('0xf')]=_0x519c48[_0xc74e('0xf')];this[_0xc74e('0xb')]=_0x519c48[_0xc74e('0xb')];this[_0xc74e('0xc')]=_0x519c48['countabandonedretry'];this['countmachineretry']=_0x519c48[_0xc74e('0xd')];this[_0xc74e('0xe')]=_0x519c48[_0xc74e('0xe')];this[_0xc74e('0x6')]=_0x519c48[_0xc74e('0x6')];this[_0xc74e('0x10')]=_0x519c48[_0xc74e('0x11')];this[_0xc74e('0x12')]=_0x519c48[_0xc74e('0x13')];this[_0xc74e('0x14')]=_0x519c48[_0xc74e('0x14')];this['responsetime']=_0x519c48['responsetime'];this[_0xc74e('0x15')]=_0x519c48[_0xc74e('0x16')];this['ringtime']=utils[_0xc74e('0x17')](_0x519c48[_0xc74e('0x16')],_0x519c48[_0xc74e('0x14')]);this[_0xc74e('0x18')]=0x0;this[_0xc74e('0x19')]=0x0;this['callback']=_0x519c48[_0xc74e('0x1a')];this[_0xc74e('0x1b')]=_0x519c48[_0xc74e('0x1b')];this[_0xc74e('0x1c')]=_0x519c48[_0xc74e('0x1c')];this[_0xc74e('0x1d')]=_0x519c48[_0xc74e('0x1d')];this['ContactId']=_0x519c48[_0xc74e('0x1e')];this[_0xc74e('0x1f')]=_0x519c48['ListId'];this[_0xc74e('0x20')]=_0x519c48[_0xc74e('0x20')];this[_0xc74e('0x21')]=_0x519c48[_0xc74e('0x21')];this[_0xc74e('0x22')]=_0x519c48[_0xc74e('0x22')];this[_0xc74e('0x23')]=_0x519c48[_0xc74e('0x23')]||'';this[_0xc74e('0x24')]=_0x519c48[_0xc74e('0x24')]||'';this[_0xc74e('0x25')]=_0x519c48[_0xc74e('0x25')];this['statedesc']=_0x519c48[_0xc74e('0x26')];}module[_0xc74e('0x27')]=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 1765495..15d6903 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 _0x960f=['reason','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countdropretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime','talktime','membername','connectedlinename'];(function(_0x5b1389,_0x3f0664){var _0x559a88=function(_0x12ad09){while(--_0x12ad09){_0x5b1389['push'](_0x5b1389['shift']());}};_0x559a88(++_0x3f0664);}(_0x960f,0x1b3));var _0xf960=function(_0x1d0499,_0x23e22f){_0x1d0499=_0x1d0499-0x0;var _0x153fb3=_0x960f[_0x1d0499];return _0x153fb3;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0x2695d3,_0x189c4a){this['scheduledat']=_0x2695d3['scheduledat'];this[_0xf960('0x0')]=_0x2695d3[_0xf960('0x0')];this['campaigntype']=_0x2695d3[_0xf960('0x0')]===_0xf960('0x1')?_0xf960('0x2'):_0x2695d3[_0xf960('0x0')];this[_0xf960('0x3')]=_0x2695d3[_0xf960('0x3')];this[_0xf960('0x4')]=_0x2695d3['countcongestionretry'];this[_0xf960('0x5')]=_0x2695d3['countnoanswerretry'];this[_0xf960('0x6')]=_0x2695d3[_0xf960('0x3')]+_0x2695d3[_0xf960('0x4')]+_0x2695d3[_0xf960('0x5')]+_0x2695d3[_0xf960('0x7')]+_0x2695d3['countdropretry']+_0x2695d3['countabandonedretry']+_0x2695d3[_0xf960('0x8')]+_0x2695d3['countagentrejectretry'];this[_0xf960('0x7')]=_0x2695d3[_0xf960('0x7')];this[_0xf960('0x9')]=_0x2695d3[_0xf960('0x9')];this['countabandonedretry']=_0x2695d3['countabandonedretry'];this[_0xf960('0x8')]=_0x2695d3['countmachineretry'];this[_0xf960('0xa')]=_0x2695d3[_0xf960('0xa')];this['uniqueid']=_0x189c4a[_0xf960('0xb')];this[_0xf960('0xc')]=_0x2695d3[_0xf960('0xd')];this[_0xf960('0xe')]=_0x2695d3[_0xf960('0xf')];this[_0xf960('0x10')]=_0x2695d3[_0xf960('0x10')];this['responsetime']=_0x2695d3[_0xf960('0x11')];this[_0xf960('0x12')]=_0x2695d3['droptime'];this[_0xf960('0x13')]=_0x2695d3[_0xf960('0x13')];this[_0xf960('0x14')]=this[_0xf960('0x12')];this[_0xf960('0x15')]=utils[_0xf960('0x16')](_0x2695d3[_0xf960('0x11')],_0x2695d3[_0xf960('0x10')]);this[_0xf960('0x17')]=utils[_0xf960('0x16')](this[_0xf960('0x12')],_0x2695d3[_0xf960('0x11')]);this[_0xf960('0x18')]=0x0;this[_0xf960('0x2')]=_0x189c4a[_0xf960('0x2')];this[_0xf960('0x19')]=_0x189c4a[_0xf960('0x1a')];this['reason']=_0x189c4a[_0xf960('0x1b')];this[_0xf960('0x1c')]=_0x2695d3[_0xf960('0x1c')];this[_0xf960('0x1d')]=_0x2695d3[_0xf960('0x1d')];this['callbackat']=_0x2695d3['callbackat'];this[_0xf960('0x1e')]=_0x2695d3[_0xf960('0x1e')];this[_0xf960('0x1f')]=_0x2695d3[_0xf960('0x1f')];this['ListId']=_0x2695d3[_0xf960('0x20')];this[_0xf960('0x21')]=_0x2695d3[_0xf960('0x21')];this[_0xf960('0x22')]=_0x2695d3[_0xf960('0x22')];this['CampaignId']=_0x2695d3[_0xf960('0x23')];this[_0xf960('0x24')]=_0x2695d3[_0xf960('0x24')]||'';this[_0xf960('0x25')]=_0x2695d3[_0xf960('0x25')]||'';this[_0xf960('0x26')]=_0x2695d3[_0xf960('0x26')];this[_0xf960('0x27')]=_0x2695d3['state'];this[_0xf960('0x28')]=_0x2695d3[_0xf960('0x28')];}module[_0xf960('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0xf812=['reason','callback','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','droptime','dropreason','ringtime','getSeconds','holdtime','talktime','queue','membername','connectedlinename'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0xf812,0x1b2));var _0x2f81=function(_0x335bb1,_0x5aa97e){_0x335bb1=_0x335bb1-0x0;var _0x4c2fc7=_0xf812[_0x335bb1];return _0x4c2fc7;};'use strict';var utils=require(_0x2f81('0x0'));function QueueCallerAbandon(_0xc673d,_0x13f0ac){this[_0x2f81('0x1')]=_0xc673d[_0x2f81('0x1')];this['type']=_0xc673d[_0x2f81('0x2')];this[_0x2f81('0x3')]=_0xc673d['type']==='outbound'?'queue':_0xc673d[_0x2f81('0x2')];this[_0x2f81('0x4')]=_0xc673d[_0x2f81('0x4')];this[_0x2f81('0x5')]=_0xc673d[_0x2f81('0x5')];this['countnoanswerretry']=_0xc673d['countnoanswerretry'];this[_0x2f81('0x6')]=_0xc673d[_0x2f81('0x4')]+_0xc673d[_0x2f81('0x5')]+_0xc673d[_0x2f81('0x7')]+_0xc673d[_0x2f81('0x8')]+_0xc673d[_0x2f81('0x9')]+_0xc673d[_0x2f81('0xa')]+_0xc673d['countmachineretry']+_0xc673d['countagentrejectretry'];this['countnosuchnumberretry']=_0xc673d[_0x2f81('0x8')];this['countdropretry']=_0xc673d[_0x2f81('0x9')];this[_0x2f81('0xa')]=_0xc673d['countabandonedretry'];this[_0x2f81('0xb')]=_0xc673d[_0x2f81('0xb')];this[_0x2f81('0xc')]=_0xc673d[_0x2f81('0xc')];this[_0x2f81('0xd')]=_0x13f0ac['uniqueid'];this[_0x2f81('0xe')]=_0xc673d[_0x2f81('0xf')];this['calleridnum']=_0xc673d[_0x2f81('0x10')];this['starttime']=_0xc673d[_0x2f81('0x11')];this[_0x2f81('0x12')]=_0xc673d[_0x2f81('0x12')];this[_0x2f81('0x13')]=_0xc673d['droptime'];this[_0x2f81('0x14')]=_0xc673d['dropreason'];this['endtime']=this[_0x2f81('0x13')];this[_0x2f81('0x15')]=utils[_0x2f81('0x16')](_0xc673d[_0x2f81('0x12')],_0xc673d[_0x2f81('0x11')]);this[_0x2f81('0x17')]=utils[_0x2f81('0x16')](this[_0x2f81('0x13')],_0xc673d[_0x2f81('0x12')]);this[_0x2f81('0x18')]=0x0;this[_0x2f81('0x19')]=_0x13f0ac[_0x2f81('0x19')];this[_0x2f81('0x1a')]=_0x13f0ac[_0x2f81('0x1b')];this[_0x2f81('0x1c')]=_0x13f0ac['reason'];this[_0x2f81('0x1d')]=_0xc673d[_0x2f81('0x1d')];this['callbackuniqueid']=_0xc673d['callbackuniqueid'];this['callbackat']=_0xc673d['callbackat'];this[_0x2f81('0x1e')]=_0xc673d[_0x2f81('0x1e')];this[_0x2f81('0x1f')]=_0xc673d[_0x2f81('0x1f')];this['ListId']=_0xc673d[_0x2f81('0x20')];this[_0x2f81('0x21')]=_0xc673d['UserId'];this[_0x2f81('0x22')]=_0xc673d[_0x2f81('0x22')];this[_0x2f81('0x23')]=_0xc673d[_0x2f81('0x23')];this[_0x2f81('0x24')]=_0xc673d[_0x2f81('0x24')]||'';this[_0x2f81('0x25')]=_0xc673d[_0x2f81('0x25')]||'';this['agiafterat']=_0xc673d[_0x2f81('0x26')];this[_0x2f81('0x27')]=_0xc673d[_0x2f81('0x27')];this[_0x2f81('0x28')]=_0xc673d[_0x2f81('0x28')];}module[_0x2f81('0x29')]=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 2645feb..2fb76fd 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 _0xacf4=['[checkIsBlackListIvr]','verifyAdditionalPhones','swapAdditionalPhones','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','dialOrderByScheduledAt','catch','temp','error','getContactDialerIvr','[countReScheduled]','countReScheduled','rescheduleContact','[rescheduleContact]','unlockContact','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr'];(function(_0x5d52ba,_0x2e1c8e){var _0x48b43e=function(_0x10d714){while(--_0x10d714){_0x5d52ba['push'](_0x5d52ba['shift']());}};_0x48b43e(++_0x2e1c8e);}(_0xacf4,0xe7));var _0x4acf=function(_0x389971,_0x3c6bf8){_0x389971=_0x389971-0x0;var _0x347a60=_0xacf4[_0x389971];return _0x347a60;};'use strict';var util=require('util');var logger=require('../../../../config/logger')(_0x4acf('0x0'));var cmHopper=require(_0x4acf('0x1'));var cmHopperAdditionalPhone=require(_0x4acf('0x2'));var cmHopperBlack=require(_0x4acf('0x3'));var cmHopperHistory=require(_0x4acf('0x4'));function inspectError(_0x4138f0){return util[_0x4acf('0x5')](_0x4138f0,{'showHidden':![],'depth':null});}function getContactDialer(_0x5cf22d,_0x380435,_0x2124c8){return cmHopper['getContactDialer'](_0x5cf22d['id'],_0x380435,_0x2124c8,_0x5cf22d[_0x4acf('0x6')])[_0x4acf('0x7')](function(_0x649ad2){_0x5cf22d[_0x4acf('0x8')]=0x0;logger[_0x4acf('0x9')]('[getContactDialer]',inspectError(_0x649ad2));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x41970b,_0x59f559){return cmHopper[_0x4acf('0xa')](_0x41970b['id'],_0x59f559,_0x41970b[_0x4acf('0x6')])[_0x4acf('0x7')](function(_0x4ff233){_0x41970b[_0x4acf('0x8')]=0x0;logger[_0x4acf('0x9')]('[getContactDialerIvr]',inspectError(_0x4ff233));});}exports['getContactDialerIvr']=getContactDialerIvr;function countReScheduled(_0x1fe474){return cmHopper['countReScheduled'](_0x1fe474)['catch'](function(_0x1783d2){logger[_0x4acf('0x9')](_0x4acf('0xb'),inspectError(_0x1783d2));});}exports[_0x4acf('0xc')]=countReScheduled;function rescheduleContact(_0x18629e){return cmHopper[_0x4acf('0xd')](_0x18629e)[_0x4acf('0x7')](function(_0x15386a){logger[_0x4acf('0x9')](_0x4acf('0xe'),inspectError(_0x15386a));});}exports[_0x4acf('0xd')]=rescheduleContact;function unlockContact(_0x5f0260,_0x1b584a,_0x57d8e0){return cmHopper[_0x4acf('0xf')](_0x5f0260,_0x1b584a,_0x57d8e0)[_0x4acf('0x7')](function(_0xccf970){logger['error']('[unlockContact]',inspectError(_0xccf970));});}exports[_0x4acf('0xf')]=unlockContact;function moveContactManagedDialer(_0x40cb8d){return cmHopper[_0x4acf('0x10')](_0x40cb8d)['catch'](function(_0x2a678b){logger[_0x4acf('0x9')](_0x4acf('0x11'),inspectError(_0x2a678b));});}exports[_0x4acf('0x10')]=moveContactManagedDialer;function checkIsBlackList(_0x2f0cec){return cmHopperBlack[_0x4acf('0x12')](_0x2f0cec)[_0x4acf('0x7')](function(_0x16ae40){logger[_0x4acf('0x9')](_0x4acf('0x13'),inspectError(_0x16ae40));});}exports[_0x4acf('0x12')]=checkIsBlackList;function checkIsBlackListIvr(_0x5f0284){return cmHopperBlack[_0x4acf('0x14')](_0x5f0284)[_0x4acf('0x7')](function(_0x57ea46){logger[_0x4acf('0x9')](_0x4acf('0x15'),inspectError(_0x57ea46));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x3b26ac,_0x34d154,_0x433b7a){return cmHopperAdditionalPhone[_0x4acf('0x16')](_0x3b26ac,_0x34d154,_0x433b7a)['catch'](function(_0x1a2286){logger[_0x4acf('0x9')]('[verifyAdditionalPhone]',inspectError(_0x1a2286));});}exports[_0x4acf('0x16')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x1af4e9,_0x52a84a,_0x126522){return cmHopperAdditionalPhone[_0x4acf('0x17')](_0x1af4e9,_0x52a84a,_0x126522)[_0x4acf('0x7')](function(_0x16458f){logger['error']('[swapAdditionalPhone]',inspectError(_0x16458f));});}exports[_0x4acf('0x17')]=swapAdditionalPhones;function avgHandleTime(_0x3f548a){return cmHopperHistory[_0x4acf('0x18')](_0x3f548a)[_0x4acf('0x7')](function(_0x14086c){logger[_0x4acf('0x9')](_0x4acf('0x19'),inspectError(_0x14086c));});}exports[_0x4acf('0x18')]=avgHandleTime;function createHistory(_0x382c41){return cmHopperHistory[_0x4acf('0x1a')](_0x382c41)['catch'](function(_0x3521c2){logger[_0x4acf('0x9')](_0x4acf('0x1b'),inspectError(_0x3521c2));});}exports[_0x4acf('0x1a')]=createHistory; \ No newline at end of file +var _0x32f4=['catch','[getContactDialerIvr]','countReScheduled','error','[rescheduleContact]','rescheduleContact','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[verifyAdditionalPhone]','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','createHistory','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','temp','[getContactDialer]','getContactDialerIvr','dialOrderByScheduledAt'];(function(_0x14eba3,_0x3c5ca4){var _0xff9002=function(_0x2543a3){while(--_0x2543a3){_0x14eba3['push'](_0x14eba3['shift']());}};_0xff9002(++_0x3c5ca4);}(_0x32f4,0x154));var _0x432f=function(_0x1e0ac9,_0x4cda20){_0x1e0ac9=_0x1e0ac9-0x0;var _0x3da94a=_0x32f4[_0x1e0ac9];return _0x3da94a;};'use strict';var util=require(_0x432f('0x0'));var logger=require(_0x432f('0x1'))(_0x432f('0x2'));var cmHopper=require(_0x432f('0x3'));var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x432f('0x4'));var cmHopperHistory=require(_0x432f('0x5'));function inspectError(_0x51a71a){return util[_0x432f('0x6')](_0x51a71a,{'showHidden':![],'depth':null});}function getContactDialer(_0x1eabac,_0x344a29,_0x355b02){return cmHopper[_0x432f('0x7')](_0x1eabac['id'],_0x344a29,_0x355b02,_0x1eabac['dialOrderByScheduledAt'])['catch'](function(_0x2f66fd){_0x1eabac[_0x432f('0x8')]=0x0;logger['error'](_0x432f('0x9'),inspectError(_0x2f66fd));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x1cdcfd,_0x340fe9){return cmHopper[_0x432f('0xa')](_0x1cdcfd['id'],_0x340fe9,_0x1cdcfd[_0x432f('0xb')])[_0x432f('0xc')](function(_0x5d0155){_0x1cdcfd[_0x432f('0x8')]=0x0;logger['error'](_0x432f('0xd'),inspectError(_0x5d0155));});}exports['getContactDialerIvr']=getContactDialerIvr;function countReScheduled(_0x138967){return cmHopper[_0x432f('0xe')](_0x138967)['catch'](function(_0x457389){logger[_0x432f('0xf')]('[countReScheduled]',inspectError(_0x457389));});}exports[_0x432f('0xe')]=countReScheduled;function rescheduleContact(_0x26aa9a){return cmHopper['rescheduleContact'](_0x26aa9a)['catch'](function(_0x28d9e9){logger[_0x432f('0xf')](_0x432f('0x10'),inspectError(_0x28d9e9));});}exports[_0x432f('0x11')]=rescheduleContact;function unlockContact(_0x419bfe,_0x4f91c5,_0x175ba7){return cmHopper[_0x432f('0x12')](_0x419bfe,_0x4f91c5,_0x175ba7)[_0x432f('0xc')](function(_0x1504db){logger['error'](_0x432f('0x13'),inspectError(_0x1504db));});}exports[_0x432f('0x12')]=unlockContact;function moveContactManagedDialer(_0x42c2d2){return cmHopper[_0x432f('0x14')](_0x42c2d2)[_0x432f('0xc')](function(_0x129582){logger['error'](_0x432f('0x15'),inspectError(_0x129582));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x3d545d){return cmHopperBlack[_0x432f('0x16')](_0x3d545d)[_0x432f('0xc')](function(_0x391fd8){logger[_0x432f('0xf')](_0x432f('0x17'),inspectError(_0x391fd8));});}exports[_0x432f('0x16')]=checkIsBlackList;function checkIsBlackListIvr(_0x1899e6){return cmHopperBlack[_0x432f('0x18')](_0x1899e6)[_0x432f('0xc')](function(_0x40176d){logger[_0x432f('0xf')]('[checkIsBlackListIvr]',inspectError(_0x40176d));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x343d13,_0x5c4deb,_0x28968e){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x343d13,_0x5c4deb,_0x28968e)[_0x432f('0xc')](function(_0x175d1b){logger[_0x432f('0xf')](_0x432f('0x19'),inspectError(_0x175d1b));});}exports[_0x432f('0x1a')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x1e347a,_0x59f352,_0x252b3b){return cmHopperAdditionalPhone[_0x432f('0x1b')](_0x1e347a,_0x59f352,_0x252b3b)['catch'](function(_0x2cbde9){logger[_0x432f('0xf')](_0x432f('0x1c'),inspectError(_0x2cbde9));});}exports[_0x432f('0x1b')]=swapAdditionalPhones;function avgHandleTime(_0x44839){return cmHopperHistory[_0x432f('0x1d')](_0x44839)[_0x432f('0xc')](function(_0x5a3d18){logger[_0x432f('0xf')]('[avgHandleTime]',inspectError(_0x5a3d18));});}exports[_0x432f('0x1d')]=avgHandleTime;function createHistory(_0x573cc5){return cmHopperHistory[_0x432f('0x1e')](_0x573cc5)['catch'](function(_0x3f768b){logger['error'](_0x432f('0x1f'),inspectError(_0x3f768b));});}exports[_0x432f('0x1e')]=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 a75a2b2..9975dbf 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 _0xc982=['BLACKLIST','IS_DISACTIVED','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','dialMethod','preview','isPreviewCampaign','ivr','isIVRCampaign','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','message','loggedIn','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','dialTimezone','isNil','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','unmonitored','includes','TrunkBackup','status','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','string','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','\x5cw{0,','pow','replace','random','toString','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','tags','updatedAt','undefined','%s%s','toUpperCase','setXMDContactVariables','lodash','moment','../../../../config/logger','../../../../config/environment/shared','timezones','ACTIVE'];(function(_0x3e84d2,_0x17c86d){var _0x594e8e=function(_0x41d00f){while(--_0x41d00f){_0x3e84d2['push'](_0x3e84d2['shift']());}};_0x594e8e(++_0x17c86d);}(_0xc982,0x1a3));var _0x2c98=function(_0x43a84a,_0x6c500e){_0x43a84a=_0x43a84a-0x0;var _0x2ed43a=_0xc982[_0x43a84a];return _0x2ed43a;};'use strict';var _=require(_0x2c98('0x0'));var moment=require(_0x2c98('0x1'));var util=require('util');var logger=require(_0x2c98('0x2'))('dialer');var timezones=require(_0x2c98('0x3'))[_0x2c98('0x4')];var CAMPAIGN_STATUS={'ACTIVE':_0x2c98('0x5'),'BLACKLIST':_0x2c98('0x6'),'CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':'DEACTIVATED','DISACTIVED':_0x2c98('0x7'),'EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':_0x2c98('0x8'),'NO_AGENTS_LOGGED':_0x2c98('0x9'),'NO_AVAILABLE_CONTACTS':_0x2c98('0xa'),'NULL_INTERVAL':_0x2c98('0xb'),'OVERTIME_INTERVAL':_0x2c98('0xc'),'OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':_0x2c98('0xd'),'RECALL_TIMEOUT':_0x2c98('0xe'),'RUNNING':_0x2c98('0xf'),'UNKNOWN_TIMEZONE':_0x2c98('0x10'),'UNREACHABLE_TRUNK':_0x2c98('0x11')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x5ecb68){return _0x5ecb68[_0x2c98('0x12')]===_0x2c98('0x13');}exports[_0x2c98('0x14')]=isPreviewCampaign;function isIVRCampaign(_0x2dcc2c){return _0x2dcc2c['type']===_0x2c98('0x15');}exports[_0x2c98('0x16')]=isIVRCampaign;function isOutboundQueue(_0x35f107){return _0x35f107['type']===_0x2c98('0x17');}exports[_0x2c98('0x18')]=isOutboundQueue;function isQueueCampaignActive(_0x4ba6f2){return _0x4ba6f2[_0x2c98('0x19')];}exports[_0x2c98('0x1a')]=isQueueCampaignActive;function isIVRCampaignActive(_0x3d34e6){return _0x3d34e6[_0x2c98('0x1b')];}exports[_0x2c98('0x1c')]=isIVRCampaignActive;function getSeconds(_0x849033,_0x5e5b6c){var _0x408b86=moment(_0x849033)[_0x2c98('0x1d')](0x0);var _0x2cf4ef=moment(_0x5e5b6c)[_0x2c98('0x1d')](0x0);return _0x408b86[_0x2c98('0x1e')](_0x2cf4ef,_0x2c98('0x1f'));}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x4cf690,_0x5c209c){var _0x15f342=![];var _0x4df310=_0x4cf690['dialMethod']!==_0x5c209c[_0x2c98('0x12')]||_0x4cf690[_0x2c98('0x19')]!==_0x5c209c['dialActive']||_0x4cf690[_0x2c98('0x20')]!==_0x5c209c['message'];var _0xc9d3e6=_0x4cf690['available']!==_0x5c209c['available']||_0x4cf690[_0x2c98('0x21')]!==_0x5c209c['loggedIn']||_0x4cf690['loggedInDb']!==_0x5c209c['loggedInDb']||_0x4cf690[_0x2c98('0x22')]!==_0x5c209c[_0x2c98('0x22')]||_0x4cf690[_0x2c98('0x23')]!==_0x5c209c['talking']||_0x4cf690[_0x2c98('0x24')]!==_0x5c209c[_0x2c98('0x24')]||_0x4cf690[_0x2c98('0x25')]!==_0x5c209c[_0x2c98('0x25')]||_0x4cf690[_0x2c98('0x26')]!==_0x5c209c[_0x2c98('0x26')]||_0x4cf690[_0x2c98('0x27')]!==_0x5c209c[_0x2c98('0x27')];if(_0x4cf690[_0x2c98('0x28')]&&_0x5c209c[_0x2c98('0x28')]){_0x15f342=_0x4cf690[_0x2c98('0x28')][_0x2c98('0x29')]!==_0x5c209c[_0x2c98('0x28')]['name']||_0x4cf690[_0x2c98('0x28')][_0x2c98('0x1b')]!==_0x5c209c['Trunk']['active'];}return _0x4df310||_0xc9d3e6||_0x15f342;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x15a716){var _0x36aeb0=null;var _0x2512b8=_0x15a716[_0x2c98('0x2a')];if(_[_0x2c98('0x2b')](_0x15a716['dialGlobalInterval'])||_[_0x2c98('0x2b')](_0x15a716['Interval'])||_[_0x2c98('0x2b')](_0x15a716[_0x2c98('0x2c')][_0x2c98('0x2d')])){_0x36aeb0=CAMPAIGN_STATUS[_0x2c98('0x2e')];}else if(_[_0x2c98('0x2f')](_0x15a716['dialGlobalInterval'])||_[_0x2c98('0x2f')](_0x15a716['Interval'][_0x2c98('0x2d')])){_0x36aeb0=CAMPAIGN_STATUS[_0x2c98('0x30')];}else if(_0x2512b8&&!timezones[_0x2512b8]){_0x36aeb0=CAMPAIGN_STATUS[_0x2c98('0x31')];}return _0x36aeb0;}function checkAnyValidTrunk(_0x22c75d,_0x20c489){var _0x67f125=null;var _0x534782=_0x2c98('0x32');var _0x5e2c7b=['reachable',_0x2c98('0x33')];var _0x130983=!![];if(_0x22c75d['Trunk']&&_0x22c75d[_0x2c98('0x28')][_0x2c98('0x1b')]){_0x534782+=_0x22c75d[_0x2c98('0x28')][_0x2c98('0x29')];_0x67f125=_0x20c489[_0x534782];_0x130983=_0x5e2c7b[_0x2c98('0x34')](_0x67f125['status']);}else if(_0x22c75d[_0x2c98('0x35')]&&_0x22c75d['TrunkBackup'][_0x2c98('0x1b')]){_0x534782+=_0x22c75d[_0x2c98('0x35')]['name'];_0x67f125=_0x20c489[_0x534782];_0x130983=_0x5e2c7b['includes'](_0x67f125[_0x2c98('0x36')]);}return _0x130983;}function getQueueCampaignStatusMessage(_0x26b15f,_0x4c0988){var _0x31a303=CAMPAIGN_STATUS[_0x2c98('0x5')];var _0x43419b=isPreviewCampaign(_0x26b15f);if(!isQueueCampaignActive(_0x26b15f)){if(_0x43419b){_0x31a303=CAMPAIGN_STATUS[_0x2c98('0x37')];}else{if(_0x26b15f[_0x2c98('0x27')]===0x0&&_0x26b15f['talking']===0x0&&_0x26b15f[_0x2c98('0x25')]===0x0&&(_0x26b15f[_0x2c98('0x24')]||0x0)===0x0){_0x31a303=CAMPAIGN_STATUS['INACTIVE'];}else{_0x31a303=CAMPAIGN_STATUS[_0x2c98('0x38')];}}}else if(_0x26b15f[_0x2c98('0x21')]===0x0){_0x31a303=CAMPAIGN_STATUS[_0x2c98('0x39')];}else if(!checkAnyValidTrunk(_0x26b15f,_0x4c0988)){_0x31a303=CAMPAIGN_STATUS[_0x2c98('0x3a')];}else if(!isPreviewCampaign(_0x26b15f)){var _0x1921a7=checkAnyValidQueueCampaignInterval(_0x26b15f);if(_0x1921a7){_0x31a303=_0x1921a7;}}return _0x31a303;}exports[_0x2c98('0x3b')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x537434){var _0x3f999c=CAMPAIGN_STATUS['DISACTIVED'];if(_0x537434['originated']===0x0&&_0x537434[_0x2c98('0x23')]===0x0&&_0x537434[_0x2c98('0x25')]===0x0&&(_0x537434[_0x2c98('0x24')]||0x0)===0x0){_0x3f999c=CAMPAIGN_STATUS['INACTIVE'];}return _0x3f999c;}exports[_0x2c98('0x3c')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x32ba0e){var _0x571499=_0x32ba0e['match'](/"(.*?)"/);return _0x571499?_0x571499[0x1]:_0x32ba0e;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x562156,_0x253e5a,_0x5c7c2b){if(!_['isUndefined'](_0x5c7c2b)&&typeof _0x5c7c2b===_0x2c98('0x3d')&&!_[_0x2c98('0x2f')](_0x5c7c2b)){if(!_[_0x2c98('0x3e')](_0x253e5a)&&typeof _0x253e5a===_0x2c98('0x3d')&&!_[_0x2c98('0x2f')](_0x253e5a)){return util[_0x2c98('0x3f')]('\x22%s\x22\x20<%s>',_0x253e5a,_0x5c7c2b);}return util[_0x2c98('0x3f')](_0x2c98('0x40'),_0x5c7c2b,_0x5c7c2b);}if(!_['isUndefined'](_0x562156)&&typeof _0x562156===_0x2c98('0x3d')&&!_[_0x2c98('0x2f')](_0x562156)){return _0x562156;}return _0x2c98('0x41');}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0x124878,_0x5a1f12){var _0x4d23f9;var _0x303c81;var _0x7a23af;if(_0x5a1f12<=0x0){_0x5a1f12=0x1;}_0x4d23f9=new RegExp(_0x2c98('0x42')+_0x5a1f12+'}$');_0x303c81=Math['pow'](0xa,_0x5a1f12-0x1);_0x7a23af=Math[_0x2c98('0x43')](0xa,_0x5a1f12)-0x1;return util[_0x2c98('0x3f')]('%s',_[_0x2c98('0x44')](_0x124878,_0x4d23f9,_[_0x2c98('0x45')](_0x303c81,_0x7a23af)[_0x2c98('0x46')]()));}exports['getCallerIdRandom']=getCallerIdRandom;function decrementOriginate(_0x92f465){if(_0x92f465[_0x2c98('0x27')]&&_0x92f465[_0x2c98('0x27')]>0x0){_0x92f465[_0x2c98('0x27')]-=0x1;}else{logger[_0x2c98('0x47')](_0x2c98('0x48'));}}exports[_0x2c98('0x49')]=decrementOriginate;function checkContactEmpty(_0x23fe10){return _0x23fe10&&_0x23fe10[_0x2c98('0x4a')]>0x0;}exports[_0x2c98('0x4b')]=checkContactEmpty;function erlangb(_0x1859fa,_0x35a21e){if(_0x35a21e===0x0){return 0x0;}var _0x13c9f5=0x1;for(var _0x3f262a=0x1;_0x3f262a<=_0x35a21e;_0x3f262a+=0x1){_0x13c9f5=0x1+_0x13c9f5*_0x3f262a/_0x1859fa;}return 0x1/_0x13c9f5;}exports[_0x2c98('0x4c')]=erlangb;function checkContactLowerLimitOriginate(_0x53aa37,_0x345d7a,_0x55159f){if(_0x345d7a>_0x55159f){for(var _0x5c6069=0x0;_0x5c6069<_0x345d7a-_0x55159f;_0x5c6069+=0x1){decrementOriginate(_0x53aa37);}}}exports[_0x2c98('0x4d')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x37455b){var _0x937707={};var _0x946285=['id',_0x2c98('0x4e'),'description',_0x2c98('0x4f'),_0x2c98('0x50')];if(_0x37455b){for(var _0x8eb2b8 in _0x37455b){if(typeof _0x37455b[_0x8eb2b8]!==_0x2c98('0x51')){if(!_[_0x2c98('0x2b')](_0x37455b[_0x8eb2b8])&&!_0x946285[_0x2c98('0x34')](_0x8eb2b8)){_0x937707[util[_0x2c98('0x3f')](_0x2c98('0x52'),'XMD-',_0x8eb2b8[_0x2c98('0x53')]())]=_0x37455b[_0x8eb2b8];}}}}return _0x937707;}exports[_0x2c98('0x54')]=setXMDContactVariables; \ No newline at end of file +var _0x0812=['RESCHEDULED_CONTACTS','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','dialMethod','preview','isPreviewCampaign','type','ivr','outbound','dialActive','isQueueCampaignActive','active','milliseconds','diff','seconds','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','Interval','Intervals','NULL_INTERVAL','isEmpty','dialGlobalInterval','EMPTY_INTERVAL','SIP/','reachable','unmonitored','includes','TrunkBackup','status','INACTIVE','NO_AGENTS_LOGGED','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','pow','replace','random','toString','getCallerIdRandom','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','description','tags','updatedAt','undefined','XMD-','setXMDContactVariables','lodash','moment','util','../../../../config/logger','dialer','timezones','ACTIVE'];(function(_0xc58aac,_0x583aec){var _0x3d36bb=function(_0x105af5){while(--_0x105af5){_0xc58aac['push'](_0xc58aac['shift']());}};_0x3d36bb(++_0x583aec);}(_0x0812,0x101));var _0x2081=function(_0x4a0189,_0x5c5954){_0x4a0189=_0x4a0189-0x0;var _0x333d4b=_0x0812[_0x4a0189];return _0x333d4b;};'use strict';var _=require(_0x2081('0x0'));var moment=require(_0x2081('0x1'));var util=require(_0x2081('0x2'));var logger=require(_0x2081('0x3'))(_0x2081('0x4'));var timezones=require('../../../../config/environment/shared')[_0x2081('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0x2081('0x6'),'BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':_0x2081('0x7'),'DEACTIVATED':'DEACTIVATED','DISACTIVED':'IS_DISACTIVED','EMPTY_INTERVAL':_0x2081('0x8'),'INACTIVE':_0x2081('0x9'),'NO_AGENTS_LOGGED':_0x2081('0xa'),'NO_AVAILABLE_CONTACTS':_0x2081('0xb'),'NULL_INTERVAL':_0x2081('0xc'),'OVERTIME_INTERVAL':_0x2081('0xd'),'OVERTIME_GLOBAL_INTERVAL':_0x2081('0xe'),'QUEUE_RECALL':_0x2081('0xf'),'RECALL_TIMEOUT':_0x2081('0x10'),'RUNNING':_0x2081('0x11'),'UNKNOWN_TIMEZONE':_0x2081('0x12'),'UNREACHABLE_TRUNK':_0x2081('0x13')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x191a33){return _0x191a33[_0x2081('0x14')]===_0x2081('0x15');}exports[_0x2081('0x16')]=isPreviewCampaign;function isIVRCampaign(_0x5c48fe){return _0x5c48fe[_0x2081('0x17')]===_0x2081('0x18');}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x8470de){return _0x8470de[_0x2081('0x17')]===_0x2081('0x19');}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x913994){return _0x913994[_0x2081('0x1a')];}exports[_0x2081('0x1b')]=isQueueCampaignActive;function isIVRCampaignActive(_0x38562c){return _0x38562c[_0x2081('0x1c')];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x3f71ef,_0x12cc3c){var _0x12e495=moment(_0x3f71ef)[_0x2081('0x1d')](0x0);var _0x32459f=moment(_0x12cc3c)['milliseconds'](0x0);return _0x12e495[_0x2081('0x1e')](_0x32459f,_0x2081('0x1f'));}exports[_0x2081('0x20')]=getSeconds;function hasQueueCampaignDataChanged(_0x59f909,_0x3a1864){var _0x28200f=![];var _0x1c017e=_0x59f909[_0x2081('0x14')]!==_0x3a1864[_0x2081('0x14')]||_0x59f909[_0x2081('0x1a')]!==_0x3a1864[_0x2081('0x1a')]||_0x59f909[_0x2081('0x21')]!==_0x3a1864[_0x2081('0x21')];var _0x54c5db=_0x59f909[_0x2081('0x22')]!==_0x3a1864[_0x2081('0x22')]||_0x59f909[_0x2081('0x23')]!==_0x3a1864[_0x2081('0x23')]||_0x59f909[_0x2081('0x24')]!==_0x3a1864[_0x2081('0x24')]||_0x59f909[_0x2081('0x25')]!==_0x3a1864[_0x2081('0x25')]||_0x59f909[_0x2081('0x26')]!==_0x3a1864[_0x2081('0x26')]||_0x59f909['pTalking']!==_0x3a1864[_0x2081('0x27')]||_0x59f909[_0x2081('0x28')]!==_0x3a1864[_0x2081('0x28')]||_0x59f909['inUse']!==_0x3a1864[_0x2081('0x29')]||_0x59f909['originated']!==_0x3a1864[_0x2081('0x2a')];if(_0x59f909['Trunk']&&_0x3a1864[_0x2081('0x2b')]){_0x28200f=_0x59f909[_0x2081('0x2b')][_0x2081('0x2c')]!==_0x3a1864[_0x2081('0x2b')][_0x2081('0x2c')]||_0x59f909[_0x2081('0x2b')]['active']!==_0x3a1864[_0x2081('0x2b')][_0x2081('0x1c')];}return _0x1c017e||_0x54c5db||_0x28200f;}exports[_0x2081('0x2d')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x1f9ef6){var _0x426b5a=null;var _0x58f792=_0x1f9ef6[_0x2081('0x2e')];if(_['isNil'](_0x1f9ef6['dialGlobalInterval'])||_[_0x2081('0x2f')](_0x1f9ef6[_0x2081('0x30')])||_[_0x2081('0x2f')](_0x1f9ef6[_0x2081('0x30')][_0x2081('0x31')])){_0x426b5a=CAMPAIGN_STATUS[_0x2081('0x32')];}else if(_[_0x2081('0x33')](_0x1f9ef6[_0x2081('0x34')])||_[_0x2081('0x33')](_0x1f9ef6['Interval'][_0x2081('0x31')])){_0x426b5a=CAMPAIGN_STATUS[_0x2081('0x35')];}else if(_0x58f792&&!timezones[_0x58f792]){_0x426b5a=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0x426b5a;}function checkAnyValidTrunk(_0x26ec25,_0x462bff){var _0x10d9d4=null;var _0x5f587b=_0x2081('0x36');var _0x613208=[_0x2081('0x37'),_0x2081('0x38')];var _0x26ff2f=!![];if(_0x26ec25[_0x2081('0x2b')]&&_0x26ec25[_0x2081('0x2b')][_0x2081('0x1c')]){_0x5f587b+=_0x26ec25[_0x2081('0x2b')]['name'];_0x10d9d4=_0x462bff[_0x5f587b];_0x26ff2f=_0x613208[_0x2081('0x39')](_0x10d9d4['status']);}else if(_0x26ec25['TrunkBackup']&&_0x26ec25[_0x2081('0x3a')][_0x2081('0x1c')]){_0x5f587b+=_0x26ec25[_0x2081('0x3a')][_0x2081('0x2c')];_0x10d9d4=_0x462bff[_0x5f587b];_0x26ff2f=_0x613208[_0x2081('0x39')](_0x10d9d4[_0x2081('0x3b')]);}return _0x26ff2f;}function getQueueCampaignStatusMessage(_0x447b26,_0x4b1229){var _0x6eb387=CAMPAIGN_STATUS[_0x2081('0x6')];var _0x39782e=isPreviewCampaign(_0x447b26);if(!isQueueCampaignActive(_0x447b26)){if(_0x39782e){_0x6eb387=CAMPAIGN_STATUS[_0x2081('0x3c')];}else{if(_0x447b26[_0x2081('0x2a')]===0x0&&_0x447b26[_0x2081('0x26')]===0x0&&_0x447b26[_0x2081('0x28')]===0x0&&(_0x447b26['pTalking']||0x0)===0x0){_0x6eb387=CAMPAIGN_STATUS['INACTIVE'];}else{_0x6eb387=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x447b26[_0x2081('0x23')]===0x0){_0x6eb387=CAMPAIGN_STATUS[_0x2081('0x3d')];}else if(!checkAnyValidTrunk(_0x447b26,_0x4b1229)){_0x6eb387=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0x447b26)){var _0x474c26=checkAnyValidQueueCampaignInterval(_0x447b26);if(_0x474c26){_0x6eb387=_0x474c26;}}return _0x6eb387;}exports[_0x2081('0x3e')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x44694e){var _0x2bee06=CAMPAIGN_STATUS['DISACTIVED'];if(_0x44694e[_0x2081('0x2a')]===0x0&&_0x44694e[_0x2081('0x26')]===0x0&&_0x44694e[_0x2081('0x28')]===0x0&&(_0x44694e[_0x2081('0x27')]||0x0)===0x0){_0x2bee06=CAMPAIGN_STATUS[_0x2081('0x3c')];}return _0x2bee06;}exports[_0x2081('0x3f')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x4c74cb){var _0x42a8f1=_0x4c74cb[_0x2081('0x40')](/"(.*?)"/);return _0x42a8f1?_0x42a8f1[0x1]:_0x4c74cb;}exports[_0x2081('0x41')]=extractCalleridName;function getCallerId(_0x37bc88,_0x231c12,_0x46e6a3){if(!_['isUndefined'](_0x46e6a3)&&typeof _0x46e6a3==='string'&&!_[_0x2081('0x33')](_0x46e6a3)){if(!_[_0x2081('0x42')](_0x231c12)&&typeof _0x231c12===_0x2081('0x43')&&!_[_0x2081('0x33')](_0x231c12)){return util[_0x2081('0x44')]('\x22%s\x22\x20<%s>',_0x231c12,_0x46e6a3);}return util[_0x2081('0x44')](_0x2081('0x45'),_0x46e6a3,_0x46e6a3);}if(!_['isUndefined'](_0x37bc88)&&typeof _0x37bc88===_0x2081('0x43')&&!_[_0x2081('0x33')](_0x37bc88)){return _0x37bc88;}return _0x2081('0x46');}exports[_0x2081('0x47')]=getCallerId;function getCallerIdRandom(_0x4ae016,_0x172004){var _0xd29907;var _0x1f54a8;var _0x15e1ce;if(_0x172004<=0x0){_0x172004=0x1;}_0xd29907=new RegExp('\x5cw{0,'+_0x172004+'}$');_0x1f54a8=Math[_0x2081('0x48')](0xa,_0x172004-0x1);_0x15e1ce=Math[_0x2081('0x48')](0xa,_0x172004)-0x1;return util['format']('%s',_[_0x2081('0x49')](_0x4ae016,_0xd29907,_[_0x2081('0x4a')](_0x1f54a8,_0x15e1ce)[_0x2081('0x4b')]()));}exports[_0x2081('0x4c')]=getCallerIdRandom;function decrementOriginate(_0x22ab12){if(_0x22ab12['originated']&&_0x22ab12[_0x2081('0x2a')]>0x0){_0x22ab12[_0x2081('0x2a')]-=0x1;}else{logger['error']('[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative');}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x481475){return _0x481475&&_0x481475[_0x2081('0x4d')]>0x0;}exports[_0x2081('0x4e')]=checkContactEmpty;function erlangb(_0x3d8d6c,_0x2a26dd){if(_0x2a26dd===0x0){return 0x0;}var _0x3fde3f=0x1;for(var _0x59153c=0x1;_0x59153c<=_0x2a26dd;_0x59153c+=0x1){_0x3fde3f=0x1+_0x3fde3f*_0x59153c/_0x3d8d6c;}return 0x1/_0x3fde3f;}exports[_0x2081('0x4f')]=erlangb;function checkContactLowerLimitOriginate(_0x69d599,_0x5f5963,_0x1f0f79){if(_0x5f5963>_0x1f0f79){for(var _0xb47e6c=0x0;_0xb47e6c<_0x5f5963-_0x1f0f79;_0xb47e6c+=0x1){decrementOriginate(_0x69d599);}}}exports[_0x2081('0x50')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x273737){var _0x478077={};var _0x34c70f=['id',_0x2081('0x51'),_0x2081('0x52'),_0x2081('0x53'),_0x2081('0x54')];if(_0x273737){for(var _0xfbe821 in _0x273737){if(typeof _0x273737[_0xfbe821]!==_0x2081('0x55')){if(!_[_0x2081('0x2f')](_0x273737[_0xfbe821])&&!_0x34c70f[_0x2081('0x39')](_0xfbe821)){_0x478077[util[_0x2081('0x44')]('%s%s',_0x2081('0x56'),_0xfbe821['toUpperCase']())]=_0x273737[_0xfbe821];}}}}return _0x478077;}exports[_0x2081('0x57')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 480300a..43e93d0 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(_0x3a072c,_0x18fdb8){var _0x352b43=function(_0x334827){while(--_0x334827){_0x3a072c['push'](_0x3a072c['shift']());}};_0x352b43(++_0x18fdb8);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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(_0x20af37,_0x426de4){var _0x567361=function(_0x23978c){while(--_0x23978c){_0x20af37['push'](_0x20af37['shift']());}};_0x567361(++_0x426de4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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 454eb98..196fa73 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 _0x9086=['[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','checkAfterSend','checkTrunk','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','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','ext','isNil','active','format','SIP/%s','unmonitored','isTrunkReachable','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','fax','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','Is\x20Valid','exports','util','lodash','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','../ami','./util/util','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncReceiveFax','syncHangup','originateresponse','syncOriginateResponse','context','from-voip-provider','hasOwnProperty','exten','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','prototype','channelstate','channelstatedesc','syncFaxStatus','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','.pdf','application/pdf','then','notify','catch','error','stringify','\x20receiveFax\x20','merge','reason','AttachmentId','update','logger'];(function(_0x1041ff,_0x5d9910){var _0x5b1179=function(_0x2a86db){while(--_0x2a86db){_0x1041ff['push'](_0x1041ff['shift']());}};_0x5b1179(++_0x5d9910);}(_0x9086,0x10b));var _0x6908=function(_0x2f7bec,_0x27b9f6){_0x2f7bec=_0x2f7bec-0x0;var _0x5d1c2e=_0x9086[_0x2f7bec];return _0x5d1c2e;};'use strict';var util=require(_0x6908('0x0'));var _=require(_0x6908('0x1'));var BPromise=require('bluebird');var uuid=require(_0x6908('0x2'));var moment=require(_0x6908('0x3'));var path=require(_0x6908('0x4'));var tiff2pdf=require(_0x6908('0x5'));var gs=require(_0x6908('0x6'));var logger=require(_0x6908('0x7'))('fax');var ami=require(_0x6908('0x8'));var rpcDb=require('./rpcDb');var Channel=require('./channel');var ut=require(_0x6908('0x9'));var Action=require('./action');var faxAccount=require(_0x6908('0xa'));var attachment=require(_0x6908('0xb'));var faxMessage=require(_0x6908('0xc'));function Fax(_0x56df93){this[_0x6908('0xd')]={};this['faxAccounts']=_0x56df93[_0x6908('0xe')];this['trunks']=_0x56df93[_0x6908('0xf')];this[_0x6908('0x10')]={};ami['on'](_0x6908('0x11'),this[_0x6908('0x12')][_0x6908('0x13')](this));ami['on']('varset',this[_0x6908('0x14')][_0x6908('0x13')](this));ami['on'](_0x6908('0x15'),this[_0x6908('0x16')][_0x6908('0x13')](this));ami['on'](_0x6908('0x17'),this[_0x6908('0x18')][_0x6908('0x13')](this));ami['on'](_0x6908('0x19'),this['syncFaxStatus'][_0x6908('0x13')](this));ami['on']('receivefax',this[_0x6908('0x1a')][_0x6908('0x13')](this));ami['on']('hangup',this[_0x6908('0x1b')][_0x6908('0x13')](this));ami['on'](_0x6908('0x1c'),this[_0x6908('0x1d')][_0x6908('0x13')](this));}Fax['prototype']['syncNewchannel']=function(_0x370df2){if(_0x370df2[_0x6908('0x1e')]===_0x6908('0x1f')){for(var _0x4e8ea3 in this[_0x6908('0xe')]){if(this['faxAccounts'][_0x6908('0x20')](_0x4e8ea3)){if(_0x370df2[_0x6908('0x21')]===this[_0x6908('0xe')][_0x4e8ea3]['localstationid']){this[_0x6908('0xd')][_0x370df2[_0x6908('0x22')]]={};this['channels'][_0x370df2[_0x6908('0x22')]][_0x6908('0x23')]=_0x370df2[_0x6908('0x23')];this[_0x6908('0xd')][_0x370df2[_0x6908('0x22')]]['id']=this[_0x6908('0xe')][_0x4e8ea3]['id'];this[_0x6908('0xd')][_0x370df2[_0x6908('0x22')]][_0x6908('0x24')]=this[_0x6908('0xe')][_0x4e8ea3][_0x6908('0x24')];logger[_0x6908('0x25')](_0x370df2[_0x6908('0x22')],_0x6908('0x26'));}}}}if(this[_0x6908('0x10')][_0x370df2[_0x6908('0x22')]]){this[_0x6908('0xd')][_0x370df2[_0x6908('0x22')]]={};this[_0x6908('0xd')][_0x370df2['uniqueid']][_0x6908('0x23')]=_0x370df2[_0x6908('0x23')];logger['info'](_0x370df2[_0x6908('0x22')],'\x20syncNewchannel\x20');}};Fax['prototype'][_0x6908('0x14')]=function(_0x36d61b){if(this[_0x6908('0xd')][_0x36d61b[_0x6908('0x22')]]){for(var _0x362ce7 in _0x36d61b[_0x6908('0x27')]){if(_0x36d61b[_0x6908('0x27')][_0x6908('0x20')](_0x362ce7)){this[_0x6908('0xd')][_0x36d61b['uniqueid']][_0x362ce7]=_0x36d61b[_0x6908('0x28')];}}}};Fax[_0x6908('0x29')][_0x6908('0x16')]=function(_0x44be5d){if(this['channels'][_0x44be5d['uniqueid']]){this[_0x6908('0xd')][_0x44be5d[_0x6908('0x22')]][_0x6908('0x2a')]=_0x44be5d[_0x6908('0x2a')];this[_0x6908('0xd')][_0x44be5d[_0x6908('0x22')]][_0x6908('0x2b')]=_0x44be5d[_0x6908('0x2b')];}};Fax[_0x6908('0x29')][_0x6908('0x18')]=function(_0x171037){if(this[_0x6908('0xd')][_0x171037['uniqueid']]){for(var _0x5b4cd4 in _0x171037[_0x6908('0x27')]){if(_0x171037[_0x6908('0x27')][_0x6908('0x20')](_0x5b4cd4)){this[_0x6908('0xd')][_0x171037[_0x6908('0x22')]][_0x5b4cd4]=_0x171037['value'];}}}};Fax[_0x6908('0x29')][_0x6908('0x2c')]=function(_0x34a75c){if(this['channels'][_0x34a75c[_0x6908('0x22')]]){this[_0x6908('0xd')][_0x34a75c['uniqueid']][_0x6908('0x2d')]=_0x34a75c['operation'];this[_0x6908('0xd')][_0x34a75c['uniqueid']][_0x6908('0x2e')]=_0x34a75c['status'];this[_0x6908('0xd')][_0x34a75c[_0x6908('0x22')]][_0x6908('0x2f')]=_0x34a75c[_0x6908('0x2f')];this[_0x6908('0xd')][_0x34a75c[_0x6908('0x22')]][_0x6908('0x30')]=_0x34a75c[_0x6908('0x30')];logger[_0x6908('0x25')](_0x34a75c[_0x6908('0x22')],_0x6908('0x31'));}};Fax[_0x6908('0x29')][_0x6908('0x1a')]=function(_0x13c03c){var _0x404e87=this;if(this['channels'][_0x13c03c['uniqueid']]){var _0x3f5870=this[_0x6908('0xd')][_0x13c03c[_0x6908('0x22')]]['id'];this[_0x6908('0xd')][_0x13c03c['uniqueid']][_0x6908('0x32')]=_0x13c03c['remotestationid'];this[_0x6908('0xd')][_0x13c03c[_0x6908('0x22')]][_0x6908('0x33')]=_0x13c03c[_0x6908('0x33')];this[_0x6908('0xd')][_0x13c03c['uniqueid']][_0x6908('0x2f')]=_0x13c03c[_0x6908('0x2f')];this[_0x6908('0xd')][_0x13c03c[_0x6908('0x22')]][_0x6908('0x34')]=_0x13c03c[_0x6908('0x34')];this['channels'][_0x13c03c[_0x6908('0x22')]]['transferrate']=_0x13c03c[_0x6908('0x35')];this[_0x6908('0xd')][_0x13c03c[_0x6908('0x22')]][_0x6908('0x30')]=_0x13c03c[_0x6908('0x30')];this[_0x6908('0xd')][_0x13c03c[_0x6908('0x22')]][_0x6908('0x36')]=_0x13c03c[_0x6908('0x36')];if(this[_0x6908('0xd')][_0x13c03c[_0x6908('0x22')]][_0x6908('0x33')]>0x0){tiff2pdf(_0x13c03c['filename'],_0x6908('0x37'),function(_0x120d7f){logger['info'](_0x13c03c['uniqueid'],'\x20result\x20conversion\x20file\x20',_0x120d7f[_0x6908('0x38')]);attachment[_0x6908('0x39')]({'name':path[_0x6908('0x3a')](_0x13c03c[_0x6908('0x30')])[_0x6908('0x24')],'basename':path[_0x6908('0x3a')](_0x13c03c[_0x6908('0x30')])[_0x6908('0x24')]+_0x6908('0x3b'),'type':_0x6908('0x3c')})[_0x6908('0x3d')](function(_0x5ecc9c){faxAccount[_0x6908('0x3e')](_0x3f5870,{'from':_0x13c03c[_0x6908('0x36')],'mapKey':'fax','body':path[_0x6908('0x3a')](_0x13c03c[_0x6908('0x30')])[_0x6908('0x24')]+_0x6908('0x3b'),'AttachmentId':_0x5ecc9c['id']})[_0x6908('0x3f')](function(_0x27db6a){logger[_0x6908('0x40')](_0x13c03c[_0x6908('0x22')],'\x20notify\x20',JSON[_0x6908('0x41')](_0x27db6a));});})[_0x6908('0x3f')](function(_0x99301c){logger['error'](_0x13c03c[_0x6908('0x22')],'\x20receiveFax\x20',JSON['stringify'](_0x99301c));});});}logger['info'](_0x13c03c[_0x6908('0x22')],_0x6908('0x42'));}};Fax[_0x6908('0x29')]['syncOriginateResponse']=function(_0x1fbc6b){if(this[_0x6908('0x10')][_0x1fbc6b[_0x6908('0x22')]]){_[_0x6908('0x43')](this[_0x6908('0xd')][_0x1fbc6b[_0x6908('0x22')]],_['pick'](_0x1fbc6b,['response',_0x6908('0x44')]));}};function updateStatus(_0x3c1fcb){if(_0x3c1fcb[_0x6908('0x45')]){faxMessage[_0x6908('0x46')](_0x3c1fcb[_0x6908('0x45')],{'failMessage':'SENDING\x20FAILED\x20'})['then'](function(_0x2f67a9){ut[_0x6908('0x47')]('[Fax][Message][Error][Updated]',_0x2f67a9);})[_0x6908('0x3f')](function(_0x49c14c){ut[_0x6908('0x47')](_0x6908('0x48'),_0x49c14c);});}else{ut[_0x6908('0x47')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x6908('0x29')][_0x6908('0x49')]=function(_0x2b1139,_0x35b831,_0x32debc){var _0x541b69=this;var _0x45538d={};if(_0x35b831){_0x45538d={'read':_0x35b831};}else{_0x45538d={'failMessage':_0x32debc};}if(this[_0x6908('0x10')][_0x2b1139][_0x6908('0x45')]){faxMessage[_0x6908('0x46')](this[_0x6908('0x10')][_0x2b1139][_0x6908('0x45')],_0x45538d)['then'](function(_0x3e4435){ut[_0x6908('0x47')](_0x6908('0x4a'),_0x3e4435);})[_0x6908('0x3f')](function(_0x123ee6){ut[_0x6908('0x47')](_0x6908('0x4b'),_0x123ee6);})['finally'](function(){delete _0x541b69['channels'][_0x2b1139];delete _0x541b69[_0x6908('0x10')][_0x2b1139];});}else{ut['logger'](_0x6908('0x4c'));delete this['channels'][_0x2b1139];delete this[_0x6908('0x10')][_0x2b1139];}};Fax['prototype'][_0x6908('0x1b')]=function(_0x4a3d6d){var _0x2ef441=this;if(this['channels'][_0x4a3d6d[_0x6908('0x22')]]){if(this['actions'][_0x4a3d6d['uniqueid']]){this[_0x6908('0xd')][_0x4a3d6d[_0x6908('0x22')]]['id']=this[_0x6908('0x10')][_0x4a3d6d[_0x6908('0x22')]]['id'];this[_0x6908('0xd')][_0x4a3d6d[_0x6908('0x22')]][_0x6908('0x24')]=this[_0x6908('0x10')][_0x4a3d6d[_0x6908('0x22')]][_0x6908('0x24')];}logger[_0x6908('0x25')](_0x4a3d6d['uniqueid'],this[_0x6908('0x10')][_0x4a3d6d[_0x6908('0x22')]]?_0x6908('0x4d'):'\x20hangup\x20faxRiceive\x20',JSON[_0x6908('0x41')](this[_0x6908('0xd')][_0x4a3d6d[_0x6908('0x22')]]));if(this[_0x6908('0x10')][_0x4a3d6d[_0x6908('0x22')]]){if(this[_0x6908('0xd')][_0x4a3d6d[_0x6908('0x22')]][_0x6908('0x4e')]>0x0&&this['channels'][_0x4a3d6d['uniqueid']][_0x6908('0x19')]===_0x6908('0x4f')){this[_0x6908('0x49')](_0x4a3d6d[_0x6908('0x22')],!![]);}else{this[_0x6908('0x49')](_0x4a3d6d[_0x6908('0x22')],![],this[_0x6908('0xd')][_0x4a3d6d['uniqueid']][_0x6908('0x50')]?_0x6908('0x51')+this[_0x6908('0xd')][_0x4a3d6d[_0x6908('0x22')]][_0x6908('0x50')]:_0x6908('0x52'));}}}};Fax[_0x6908('0x29')][_0x6908('0x53')]=function(_0x9ad6d6){var _0x514f9d=this;return new BPromise(function(_0x48fff9,_0x106574){_0x514f9d['execOriginate'](_0x9ad6d6,_0x514f9d[_0x6908('0xe')][_0x9ad6d6[_0x6908('0x54')]])[_0x6908('0x3d')](function(_0x397817){ut['logger'](_0x6908('0x55'),_0x397817);_0x48fff9(ut[_0x6908('0x38')](_0x6908('0x56')));})[_0x6908('0x3f')](function(_0x400f55){ut['logger'](_0x6908('0x57'),_0x400f55);updateStatus(_0x9ad6d6);_0x106574(ut[_0x6908('0x38')]('Fax\x20failed'));});});};Fax[_0x6908('0x29')][_0x6908('0x58')]=function(_0x4a6263){var _0x553a7e=this;return new BPromise(function(_0x5d8b5c,_0x44e826){var _0x361bc8=_0x553a7e[_0x6908('0x59')](_0x553a7e['faxAccounts'][_0x4a6263[_0x6908('0x54')]]['Trunk'],_0x4a6263);if(_0x361bc8['isValid']){_0x5d8b5c(ut[_0x6908('0x38')](_0x6908('0x5a')));}else{_0x44e826(ut[_0x6908('0x38')](_0x361bc8[_0x6908('0x38')]));}});};function originate(_0x3ec924,_0x4169f9,_0x4715d5){return new BPromise(function(_0x3ccb92,_0x569fc8){if(_0x4715d5){var _0x41f4c2=util['format'](_0x6908('0x5b'),path[_0x6908('0x3a')](_0x3ec924[_0x6908('0x4')])[_0x6908('0x24')],_0x3ec924[_0x6908('0x4')]);gs['execute'](_0x41f4c2)[_0x6908('0x3d')](function(){_0x3ec924[_0x6908('0x4')]=util['format']('%s/%s.tif',path[_0x6908('0x3a')](_0x3ec924[_0x6908('0x4')])[_0x6908('0x5c')],path[_0x6908('0x3a')](_0x3ec924['path'])['name']);_0x4169f9['XMF-PATH']=_0x3ec924['path'];ut['logger'](_0x6908('0x5d'),'');ami[_0x6908('0x5e')](ut['variablesAction'](_0x3ec924,_0x4169f9))[_0x6908('0x3d')](function(_0x474d1f){_0x3ccb92(_0x474d1f);})['catch'](function(_0x8038ed){_0x569fc8(_0x8038ed);});})['catch'](function(_0x324eef){_0x569fc8(_0x324eef);});}else{ami['Action'](ut[_0x6908('0x5f')](_0x3ec924,_0x4169f9))['then'](function(_0x3249f5){_0x3ccb92(_0x3249f5);})[_0x6908('0x3f')](function(_0x52f7cb){_0x569fc8(_0x52f7cb);});}});}Fax[_0x6908('0x29')][_0x6908('0x60')]=function(_0x69e61d,_0x23dbc5){var _0x17f5d0=this;return new BPromise(function(_0x272675,_0x1dfdf3){var _0x434000=uuid['v4']();var _0x53e086=ut[_0x6908('0x61')](_0x69e61d,_0x23dbc5);_0x17f5d0[_0x6908('0x10')][_0x434000]=new Action(_0x434000,_0x23dbc5,_0x69e61d);var _0x1afc9=_0x17f5d0[_0x6908('0x10')][_0x434000];if(path[_0x6908('0x3a')](_0x69e61d['path'])[_0x6908('0x62')]===_0x6908('0x3b')){originate(_0x1afc9,_0x53e086,!![])[_0x6908('0x3d')](function(_0x44e945){_0x272675(_0x44e945);})[_0x6908('0x3f')](function(_0x48773c){_0x1dfdf3(_0x48773c);});}else{originate(_0x1afc9,_0x53e086,![])['then'](function(_0x1d6e27){_0x272675(_0x1d6e27);})[_0x6908('0x3f')](function(_0x1f032c){_0x1dfdf3(_0x1f032c);});}});};Fax['prototype']['isTrunkReachable']=function(_0x4e1d45){return!_[_0x6908('0x63')](_0x4e1d45)&&!_[_0x6908('0x63')](_0x4e1d45['name'])&&!_['isNil'](_0x4e1d45[_0x6908('0x64')])&&_0x4e1d45[_0x6908('0x64')]&&!_[_0x6908('0x63')](this[_0x6908('0xf')][util['format']('SIP/%s',_0x4e1d45[_0x6908('0x24')])])&&!_[_0x6908('0x63')](this['trunks'][util[_0x6908('0x65')](_0x6908('0x66'),_0x4e1d45['name'])][_0x6908('0x2e')])&&(this[_0x6908('0xf')][util[_0x6908('0x65')]('SIP/%s',_0x4e1d45[_0x6908('0x24')])]['status']==='reachable'||this[_0x6908('0xf')][util[_0x6908('0x65')](_0x6908('0x66'),_0x4e1d45[_0x6908('0x24')])][_0x6908('0x2e')]===_0x6908('0x67'));};Fax[_0x6908('0x29')][_0x6908('0x59')]=function(_0x1baca8,_0x507d3a){if(!this[_0x6908('0x68')](_0x1baca8)){ut[_0x6908('0x47')]('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_[_0x6908('0x63')](_0x1baca8)?'':_0x1baca8[_0x6908('0x24')]+_0x6908('0x69'));return{'isValid':![],'message':_0x6908('0x6a')};}if(_[_0x6908('0x63')](_0x507d3a[_0x6908('0x6b')])){ut[_0x6908('0x47')](_0x6908('0x6c'),JSON[_0x6908('0x41')](_0x507d3a));return{'isValid':![],'message':_0x6908('0x6d')};}if(_[_0x6908('0x63')](_0x507d3a[_0x6908('0x4')])){ut[_0x6908('0x47')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x6908('0x41')](_0x507d3a));return{'isValid':![],'message':_0x6908('0x6e')};}return{'isValid':!![],'message':_0x6908('0x6f')};};module[_0x6908('0x70')]=Fax; \ No newline at end of file +var _0xbf8e=['catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','response','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','updateStatus','SENDING\x20FAILED:\x20','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20failed','checkAfterSend','Trunk','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20path','Is\x20Valid','exports','lodash','bluebird','tiff2pdf','../../../config/logger','fax','./channel','./util/util','./action','../rpc/faxAccount','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','syncHangup','originateresponse','syncOriginateResponse','from-voip-provider','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','\x20syncNewchannel\x20','prototype','variable','value','syncNewState','channelstate','channelstatedesc','operation','status','info','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','filename','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbf8e,0x9e));var _0xebf8=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xbf8e[_0x19950b];return _0x3c6b41;};'use strict';var util=require('util');var _=require(_0xebf8('0x0'));var BPromise=require(_0xebf8('0x1'));var uuid=require('uuid');var moment=require('moment');var path=require('path');var tiff2pdf=require(_0xebf8('0x2'));var gs=require('./util/gs');var logger=require(_0xebf8('0x3'))(_0xebf8('0x4'));var ami=require('../ami');var rpcDb=require('./rpcDb');var Channel=require(_0xebf8('0x5'));var ut=require(_0xebf8('0x6'));var Action=require(_0xebf8('0x7'));var faxAccount=require(_0xebf8('0x8'));var attachment=require('../rpc/attachment');var faxMessage=require(_0xebf8('0x9'));function Fax(_0x26376c){this['channels']={};this['faxAccounts']=_0x26376c[_0xebf8('0xa')];this[_0xebf8('0xb')]=_0x26376c[_0xebf8('0xb')];this[_0xebf8('0xc')]={};ami['on'](_0xebf8('0xd'),this[_0xebf8('0xe')][_0xebf8('0xf')](this));ami['on'](_0xebf8('0x10'),this[_0xebf8('0x11')][_0xebf8('0xf')](this));ami['on'](_0xebf8('0x12'),this['syncNewState'][_0xebf8('0xf')](this));ami['on'](_0xebf8('0x13'),this[_0xebf8('0x14')][_0xebf8('0xf')](this));ami['on'](_0xebf8('0x15'),this[_0xebf8('0x16')]['bind'](this));ami['on'](_0xebf8('0x17'),this[_0xebf8('0x18')]['bind'](this));ami['on']('hangup',this[_0xebf8('0x19')]['bind'](this));ami['on'](_0xebf8('0x1a'),this[_0xebf8('0x1b')]['bind'](this));}Fax['prototype'][_0xebf8('0xe')]=function(_0x59d2d1){if(_0x59d2d1['context']===_0xebf8('0x1c')){for(var _0x4b4718 in this['faxAccounts']){if(this[_0xebf8('0xa')][_0xebf8('0x1d')](_0x4b4718)){if(_0x59d2d1[_0xebf8('0x1e')]===this[_0xebf8('0xa')][_0x4b4718][_0xebf8('0x1f')]){this[_0xebf8('0x20')][_0x59d2d1[_0xebf8('0x21')]]={};this[_0xebf8('0x20')][_0x59d2d1['uniqueid']]['channel']=_0x59d2d1[_0xebf8('0x22')];this[_0xebf8('0x20')][_0x59d2d1[_0xebf8('0x21')]]['id']=this[_0xebf8('0xa')][_0x4b4718]['id'];this[_0xebf8('0x20')][_0x59d2d1['uniqueid']][_0xebf8('0x23')]=this[_0xebf8('0xa')][_0x4b4718]['name'];logger['info'](_0x59d2d1[_0xebf8('0x21')],_0xebf8('0x24'));}}}}if(this[_0xebf8('0xc')][_0x59d2d1[_0xebf8('0x21')]]){this[_0xebf8('0x20')][_0x59d2d1[_0xebf8('0x21')]]={};this[_0xebf8('0x20')][_0x59d2d1[_0xebf8('0x21')]][_0xebf8('0x22')]=_0x59d2d1[_0xebf8('0x22')];logger['info'](_0x59d2d1[_0xebf8('0x21')],'\x20syncNewchannel\x20');}};Fax[_0xebf8('0x25')]['syncVarSet']=function(_0x3409f3){if(this[_0xebf8('0x20')][_0x3409f3[_0xebf8('0x21')]]){for(var _0x3b7011 in _0x3409f3[_0xebf8('0x26')]){if(_0x3409f3[_0xebf8('0x26')][_0xebf8('0x1d')](_0x3b7011)){this[_0xebf8('0x20')][_0x3409f3[_0xebf8('0x21')]][_0x3b7011]=_0x3409f3[_0xebf8('0x27')];}}}};Fax['prototype'][_0xebf8('0x28')]=function(_0x586ab7){if(this['channels'][_0x586ab7[_0xebf8('0x21')]]){this[_0xebf8('0x20')][_0x586ab7[_0xebf8('0x21')]]['channelstate']=_0x586ab7[_0xebf8('0x29')];this[_0xebf8('0x20')][_0x586ab7[_0xebf8('0x21')]][_0xebf8('0x2a')]=_0x586ab7['channelstatedesc'];}};Fax[_0xebf8('0x25')][_0xebf8('0x14')]=function(_0xb1cdf5){if(this['channels'][_0xb1cdf5['uniqueid']]){for(var _0x3efd67 in _0xb1cdf5[_0xebf8('0x26')]){if(_0xb1cdf5[_0xebf8('0x26')][_0xebf8('0x1d')](_0x3efd67)){this['channels'][_0xb1cdf5['uniqueid']][_0x3efd67]=_0xb1cdf5['value'];}}}};Fax[_0xebf8('0x25')][_0xebf8('0x16')]=function(_0x3222ff){if(this[_0xebf8('0x20')][_0x3222ff[_0xebf8('0x21')]]){this[_0xebf8('0x20')][_0x3222ff[_0xebf8('0x21')]][_0xebf8('0x2b')]=_0x3222ff['operation'];this[_0xebf8('0x20')][_0x3222ff[_0xebf8('0x21')]][_0xebf8('0x2c')]=_0x3222ff[_0xebf8('0x2c')];this['channels'][_0x3222ff[_0xebf8('0x21')]][_0xebf8('0x1f')]=_0x3222ff[_0xebf8('0x1f')];this[_0xebf8('0x20')][_0x3222ff[_0xebf8('0x21')]]['filename']=_0x3222ff['filename'];logger[_0xebf8('0x2d')](_0x3222ff[_0xebf8('0x21')],_0xebf8('0x2e'));}};Fax[_0xebf8('0x25')]['syncReceiveFax']=function(_0xd36de1){var _0x3e7d1f=this;if(this['channels'][_0xd36de1[_0xebf8('0x21')]]){var _0x5b2172=this[_0xebf8('0x20')][_0xd36de1['uniqueid']]['id'];this[_0xebf8('0x20')][_0xd36de1[_0xebf8('0x21')]][_0xebf8('0x2f')]=_0xd36de1['remotestationid'];this['channels'][_0xd36de1[_0xebf8('0x21')]][_0xebf8('0x30')]=_0xd36de1[_0xebf8('0x30')];this[_0xebf8('0x20')][_0xd36de1[_0xebf8('0x21')]][_0xebf8('0x1f')]=_0xd36de1[_0xebf8('0x1f')];this[_0xebf8('0x20')][_0xd36de1['uniqueid']]['resolution']=_0xd36de1[_0xebf8('0x31')];this[_0xebf8('0x20')][_0xd36de1['uniqueid']][_0xebf8('0x32')]=_0xd36de1[_0xebf8('0x32')];this['channels'][_0xd36de1[_0xebf8('0x21')]][_0xebf8('0x33')]=_0xd36de1['filename'];this[_0xebf8('0x20')][_0xd36de1[_0xebf8('0x21')]]['calleridnum']=_0xd36de1[_0xebf8('0x34')];if(this['channels'][_0xd36de1[_0xebf8('0x21')]][_0xebf8('0x30')]>0x0){tiff2pdf(_0xd36de1[_0xebf8('0x33')],_0xebf8('0x35'),function(_0x33ef8d){logger[_0xebf8('0x2d')](_0xd36de1[_0xebf8('0x21')],_0xebf8('0x36'),_0x33ef8d[_0xebf8('0x37')]);attachment[_0xebf8('0x38')]({'name':path[_0xebf8('0x39')](_0xd36de1[_0xebf8('0x33')])[_0xebf8('0x23')],'basename':path[_0xebf8('0x39')](_0xd36de1['filename'])['name']+_0xebf8('0x3a'),'type':_0xebf8('0x3b')})[_0xebf8('0x3c')](function(_0x42cdc3){faxAccount[_0xebf8('0x3d')](_0x5b2172,{'from':_0xd36de1['calleridnum'],'mapKey':_0xebf8('0x4'),'body':path[_0xebf8('0x39')](_0xd36de1[_0xebf8('0x33')])['name']+_0xebf8('0x3a'),'AttachmentId':_0x42cdc3['id']})[_0xebf8('0x3e')](function(_0x4ce0ed){logger[_0xebf8('0x3f')](_0xd36de1[_0xebf8('0x21')],_0xebf8('0x40'),JSON[_0xebf8('0x41')](_0x4ce0ed));});})[_0xebf8('0x3e')](function(_0x148aed){logger[_0xebf8('0x3f')](_0xd36de1[_0xebf8('0x21')],_0xebf8('0x42'),JSON[_0xebf8('0x41')](_0x148aed));});});}logger[_0xebf8('0x2d')](_0xd36de1[_0xebf8('0x21')],_0xebf8('0x42'));}};Fax[_0xebf8('0x25')][_0xebf8('0x1b')]=function(_0x2d01c4){if(this[_0xebf8('0xc')][_0x2d01c4[_0xebf8('0x21')]]){_[_0xebf8('0x43')](this[_0xebf8('0x20')][_0x2d01c4['uniqueid']],_['pick'](_0x2d01c4,[_0xebf8('0x44'),'reason']));}};function updateStatus(_0xa51753){if(_0xa51753[_0xebf8('0x45')]){faxMessage[_0xebf8('0x46')](_0xa51753['AttachmentId'],{'failMessage':_0xebf8('0x47')})[_0xebf8('0x3c')](function(_0x18c322){ut[_0xebf8('0x48')](_0xebf8('0x49'),_0x18c322);})[_0xebf8('0x3e')](function(_0x78bee6){ut[_0xebf8('0x48')](_0xebf8('0x4a'),_0x78bee6);});}else{ut[_0xebf8('0x48')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0xebf8('0x25')]['updateStatus']=function(_0x47a2d5,_0x23af21,_0xe66fd4){var _0x4bc392=this;var _0x458fd6={};if(_0x23af21){_0x458fd6={'read':_0x23af21};}else{_0x458fd6={'failMessage':_0xe66fd4};}if(this['actions'][_0x47a2d5][_0xebf8('0x45')]){faxMessage[_0xebf8('0x46')](this['actions'][_0x47a2d5]['AttachmentId'],_0x458fd6)['then'](function(_0x47f604){ut[_0xebf8('0x48')](_0xebf8('0x4b'),_0x47f604);})[_0xebf8('0x3e')](function(_0x1135ea){ut[_0xebf8('0x48')](_0xebf8('0x4c'),_0x1135ea);})['finally'](function(){delete _0x4bc392[_0xebf8('0x20')][_0x47a2d5];delete _0x4bc392[_0xebf8('0xc')][_0x47a2d5];});}else{ut[_0xebf8('0x48')]('[Fax][Message][NoUpdate2]');delete this[_0xebf8('0x20')][_0x47a2d5];delete this['actions'][_0x47a2d5];}};Fax[_0xebf8('0x25')][_0xebf8('0x19')]=function(_0x526a03){var _0x18984d=this;if(this[_0xebf8('0x20')][_0x526a03[_0xebf8('0x21')]]){if(this[_0xebf8('0xc')][_0x526a03[_0xebf8('0x21')]]){this[_0xebf8('0x20')][_0x526a03[_0xebf8('0x21')]]['id']=this[_0xebf8('0xc')][_0x526a03[_0xebf8('0x21')]]['id'];this['channels'][_0x526a03['uniqueid']]['name']=this[_0xebf8('0xc')][_0x526a03[_0xebf8('0x21')]][_0xebf8('0x23')];}logger[_0xebf8('0x2d')](_0x526a03['uniqueid'],this[_0xebf8('0xc')][_0x526a03['uniqueid']]?'\x20hangup\x20sendFile\x20':_0xebf8('0x4d'),JSON['stringify'](this[_0xebf8('0x20')][_0x526a03[_0xebf8('0x21')]]));if(this[_0xebf8('0xc')][_0x526a03['uniqueid']]){if(this['channels'][_0x526a03[_0xebf8('0x21')]][_0xebf8('0x4e')]>0x0&&this['channels'][_0x526a03['uniqueid']][_0xebf8('0x15')]===_0xebf8('0x4f')){this[_0xebf8('0x50')](_0x526a03[_0xebf8('0x21')],!![]);}else{this['updateStatus'](_0x526a03['uniqueid'],![],this[_0xebf8('0x20')][_0x526a03[_0xebf8('0x21')]]['faxstatusstring']?_0xebf8('0x51')+this[_0xebf8('0x20')][_0x526a03[_0xebf8('0x21')]]['faxstatusstring']:'SENDING\x20FAILED');}}}};Fax[_0xebf8('0x25')]['send']=function(_0x1d6650){var _0x1a5358=this;return new BPromise(function(_0x2642ee,_0x34ede3){_0x1a5358[_0xebf8('0x52')](_0x1d6650,_0x1a5358[_0xebf8('0xa')][_0x1d6650[_0xebf8('0x53')]])['then'](function(_0x3eeea0){ut[_0xebf8('0x48')](_0xebf8('0x54'),_0x3eeea0);_0x2642ee(ut[_0xebf8('0x37')]('Fax\x20received'));})['catch'](function(_0x59ac02){ut[_0xebf8('0x48')]('[Fax][execOriginate][failure]',_0x59ac02);updateStatus(_0x1d6650);_0x34ede3(ut[_0xebf8('0x37')](_0xebf8('0x55')));});});};Fax[_0xebf8('0x25')][_0xebf8('0x56')]=function(_0x465fd5){var _0x32f4db=this;return new BPromise(function(_0x5862f2,_0xaf4b2c){var _0x5e33c8=_0x32f4db['checkTrunk'](_0x32f4db['faxAccounts'][_0x465fd5[_0xebf8('0x53')]][_0xebf8('0x57')],_0x465fd5);if(_0x5e33c8['isValid']){_0x5862f2(ut[_0xebf8('0x37')]('Trunk\x20Reachable'));}else{_0xaf4b2c(ut[_0xebf8('0x37')](_0x5e33c8[_0xebf8('0x37')]));}});};function originate(_0x17cd16,_0x4b7042,_0x3d7bee){return new BPromise(function(_0x548cee,_0x410fde){if(_0x3d7bee){var _0x5dba07=util[_0xebf8('0x58')](_0xebf8('0x59'),path[_0xebf8('0x39')](_0x17cd16['path'])[_0xebf8('0x23')],_0x17cd16[_0xebf8('0x5a')]);gs[_0xebf8('0x5b')](_0x5dba07)[_0xebf8('0x3c')](function(){_0x17cd16[_0xebf8('0x5a')]=util[_0xebf8('0x58')]('%s/%s.tif',path[_0xebf8('0x39')](_0x17cd16['path'])[_0xebf8('0x5c')],path[_0xebf8('0x39')](_0x17cd16[_0xebf8('0x5a')])[_0xebf8('0x23')]);_0x4b7042['XMF-PATH']=_0x17cd16[_0xebf8('0x5a')];ut[_0xebf8('0x48')](_0xebf8('0x5d'),'');ami[_0xebf8('0x5e')](ut['variablesAction'](_0x17cd16,_0x4b7042))[_0xebf8('0x3c')](function(_0x21eb83){_0x548cee(_0x21eb83);})[_0xebf8('0x3e')](function(_0x4842f7){_0x410fde(_0x4842f7);});})[_0xebf8('0x3e')](function(_0x188b1a){_0x410fde(_0x188b1a);});}else{ami[_0xebf8('0x5e')](ut[_0xebf8('0x5f')](_0x17cd16,_0x4b7042))[_0xebf8('0x3c')](function(_0x43cdcb){_0x548cee(_0x43cdcb);})[_0xebf8('0x3e')](function(_0x5d7661){_0x410fde(_0x5d7661);});}});}Fax['prototype']['execOriginate']=function(_0x36aef3,_0x221e95){var _0x320974=this;return new BPromise(function(_0x1b2053,_0x325a9c){var _0x279775=uuid['v4']();var _0xf7fc6b=ut['addVariables'](_0x36aef3,_0x221e95);_0x320974[_0xebf8('0xc')][_0x279775]=new Action(_0x279775,_0x221e95,_0x36aef3);var _0x391279=_0x320974['actions'][_0x279775];if(path[_0xebf8('0x39')](_0x36aef3[_0xebf8('0x5a')])['ext']===_0xebf8('0x3a')){originate(_0x391279,_0xf7fc6b,!![])[_0xebf8('0x3c')](function(_0x3b4a67){_0x1b2053(_0x3b4a67);})['catch'](function(_0x182e51){_0x325a9c(_0x182e51);});}else{originate(_0x391279,_0xf7fc6b,![])[_0xebf8('0x3c')](function(_0x1a6fb6){_0x1b2053(_0x1a6fb6);})[_0xebf8('0x3e')](function(_0x35f62f){_0x325a9c(_0x35f62f);});}});};Fax[_0xebf8('0x25')][_0xebf8('0x60')]=function(_0x2dd810){return!_[_0xebf8('0x61')](_0x2dd810)&&!_[_0xebf8('0x61')](_0x2dd810['name'])&&!_[_0xebf8('0x61')](_0x2dd810[_0xebf8('0x62')])&&_0x2dd810[_0xebf8('0x62')]&&!_[_0xebf8('0x61')](this[_0xebf8('0xb')][util[_0xebf8('0x58')](_0xebf8('0x63'),_0x2dd810[_0xebf8('0x23')])])&&!_['isNil'](this['trunks'][util[_0xebf8('0x58')](_0xebf8('0x63'),_0x2dd810[_0xebf8('0x23')])]['status'])&&(this[_0xebf8('0xb')][util[_0xebf8('0x58')](_0xebf8('0x63'),_0x2dd810[_0xebf8('0x23')])][_0xebf8('0x2c')]===_0xebf8('0x64')||this[_0xebf8('0xb')][util[_0xebf8('0x58')](_0xebf8('0x63'),_0x2dd810[_0xebf8('0x23')])]['status']===_0xebf8('0x65'));};Fax[_0xebf8('0x25')][_0xebf8('0x66')]=function(_0xc84931,_0x1a0d97){if(!this[_0xebf8('0x60')](_0xc84931)){ut[_0xebf8('0x48')](_0xebf8('0x67'),_[_0xebf8('0x61')](_0xc84931)?'':_0xc84931[_0xebf8('0x23')]+_0xebf8('0x68'));return{'isValid':![],'message':_0xebf8('0x69')};}if(_[_0xebf8('0x61')](_0x1a0d97[_0xebf8('0x4')])){ut[_0xebf8('0x48')](_0xebf8('0x6a'),JSON['stringify'](_0x1a0d97));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0xebf8('0x61')](_0x1a0d97[_0xebf8('0x5a')])){ut[_0xebf8('0x48')]('[Fax][checkTrunk][Empty\x20path]',JSON['stringify'](_0x1a0d97));return{'isValid':![],'message':_0xebf8('0x6b')};}return{'isValid':!![],'message':_0xebf8('0x6c')};};module[_0xebf8('0x6d')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index fa90b8b..b8f48f4 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 _0xd324=['resolve','then','util','bluebird','preview','lodash','error','notify'];(function(_0x2874ca,_0x1f6061){var _0x1e3e26=function(_0x50ffb6){while(--_0x50ffb6){_0x2874ca['push'](_0x2874ca['shift']());}};_0x1e3e26(++_0x1f6061);}(_0xd324,0x1ca));var _0x4d32=function(_0x577519,_0x346daf){_0x577519=_0x577519-0x0;var _0x5b12f7=_0xd324[_0x577519];return _0x5b12f7;};'use strict';var util=require(_0x4d32('0x0'));var BPromise=require(_0x4d32('0x1'));var logger=require('../../../config/logger')(_0x4d32('0x2'));var _=require(_0x4d32('0x3'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x20eb02){return function(_0x54911d){logger[_0x4d32('0x4')](_0x20eb02,util['inspect'](_0x54911d,{'showHidden':![],'depth':null}));};}exports[_0x4d32('0x5')]=function(_0x5ca173,_0xe6bd63){return BPromise[_0x4d32('0x6')]()[_0x4d32('0x7')](faxAccount['notify'](_0x5ca173,_0xe6bd63))['catch'](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0x9e92=['error','inspect','notify','resolve','then','catch','[Notify]\x20','util','../../../config/logger','preview','lodash'];(function(_0x390e92,_0x27fd6e){var _0x54b88f=function(_0x241291){while(--_0x241291){_0x390e92['push'](_0x390e92['shift']());}};_0x54b88f(++_0x27fd6e);}(_0x9e92,0x130));var _0x29e9=function(_0x4ba653,_0x57cb57){_0x4ba653=_0x4ba653-0x0;var _0x1d2570=_0x9e92[_0x4ba653];return _0x1d2570;};'use strict';var util=require(_0x29e9('0x0'));var BPromise=require('bluebird');var logger=require(_0x29e9('0x1'))(_0x29e9('0x2'));var _=require(_0x29e9('0x3'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x3e272b){return function(_0x3870ed){logger[_0x29e9('0x4')](_0x3e272b,util[_0x29e9('0x5')](_0x3870ed,{'showHidden':![],'depth':null}));};}exports[_0x29e9('0x6')]=function(_0x14129d,_0xe509cb){return BPromise[_0x29e9('0x7')]()[_0x29e9('0x8')](faxAccount['notify'](_0x14129d,_0xe509cb))[_0x29e9('0x9')](loggerCatch(_0x29e9('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 25cca7d..b99469a 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 _0x99bb=['exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','bluebird'];(function(_0x55b025,_0x477de2){var _0x141fd5=function(_0x3fcc26){while(--_0x3fcc26){_0x55b025['push'](_0x55b025['shift']());}};_0x141fd5(++_0x477de2);}(_0x99bb,0x14e));var _0xb99b=function(_0x406475,_0x1cf879){_0x406475=_0x406475-0x0;var _0x3eaac3=_0x99bb[_0x406475];return _0x3eaac3;};'use strict';var util=require(_0xb99b('0x0'));var logger=require('../../../../config/logger')('fax');var BPromise=require(_0xb99b('0x1'));var exec=require('child_process')[_0xb99b('0x2')];exports[_0xb99b('0x3')]=function(_0x5796a6){return new BPromise(function(_0x27f080,_0x4cdf76){exec(_0x5796a6,function(_0x34dcf0,_0x2ef050,_0x38fb4d){logger[_0xb99b('0x4')](_0xb99b('0x5'),_0x2ef050);if(_0x34dcf0){logger[_0xb99b('0x4')](_0xb99b('0x5'),_0xb99b('0x6'),util[_0xb99b('0x7')](_0x34dcf0,{'showHidden':![],'depth':null}),_0x2ef050,_0x38fb4d);_0x4cdf76(_0x34dcf0);}_0x27f080(_0x2ef050);});});}; \ No newline at end of file +var _0x5708=['bluebird','child_process','execute','info','\x20Error\x20:','inspect','../../../../config/logger'];(function(_0x8f00cc,_0x24f5d6){var _0x57ba92=function(_0x2476ce){while(--_0x2476ce){_0x8f00cc['push'](_0x8f00cc['shift']());}};_0x57ba92(++_0x24f5d6);}(_0x5708,0x68));var _0x8570=function(_0x3e9671,_0x27f292){_0x3e9671=_0x3e9671-0x0;var _0x213ebb=_0x5708[_0x3e9671];return _0x213ebb;};'use strict';var util=require('util');var logger=require(_0x8570('0x0'))('fax');var BPromise=require(_0x8570('0x1'));var exec=require(_0x8570('0x2'))['exec'];exports[_0x8570('0x3')]=function(_0x8fa709){return new BPromise(function(_0x2bb7bc,_0x361bf7){exec(_0x8fa709,function(_0x175184,_0x516c7b,_0xea9755){logger[_0x8570('0x4')]('Exec\x20gs',_0x516c7b);if(_0x175184){logger[_0x8570('0x4')]('Exec\x20gs',_0x8570('0x5'),util[_0x8570('0x6')](_0x175184,{'showHidden':![],'depth':null}),_0x516c7b,_0xea9755);_0x361bf7(_0x175184);}_0x2bb7bc(_0x516c7b);});});}; \ 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 8e41086..6dfcae1 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 _0x0a0d=['logger','info','inspect','addVariables','ecm','headerinfo','maxrate','format','modem','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','\x22%s\x22\x20<%s>','util','lodash','moment','fax','message'];(function(_0x9c0852,_0x54a062){var _0x707adb=function(_0x11dda9){while(--_0x11dda9){_0x9c0852['push'](_0x9c0852['shift']());}};_0x707adb(++_0x54a062);}(_0x0a0d,0x85));var _0xd0a0=function(_0xcba4b6,_0x1ecf6a){_0xcba4b6=_0xcba4b6-0x0;var _0x2bd8bf=_0x0a0d[_0xcba4b6];return _0x2bd8bf;};'use strict';var util=require(_0xd0a0('0x0'));var _=require(_0xd0a0('0x1'));var moment=require(_0xd0a0('0x2'));var logger=require('../../../../config/logger')(_0xd0a0('0x3'));exports[_0xd0a0('0x4')]=function(_0x5bf83d){return{'message':_0x5bf83d};};exports[_0xd0a0('0x5')]=function(_0x1ed62f,_0x440f7d){logger[_0xd0a0('0x6')](_0x1ed62f,util[_0xd0a0('0x7')](_0x440f7d,{'showHidden':![],'depth':null}));};exports[_0xd0a0('0x8')]=function(_0xeee5f8,_0x2e6af1){var _0x2b25ca={'XMF-ECM':_0x2e6af1[_0xd0a0('0x9')],'XMF-HEADERINFO':_0x2e6af1[_0xd0a0('0xa')],'XMF-MINRATE':_0x2e6af1['minrate'],'XMF-MAXRATE':_0x2e6af1[_0xd0a0('0xb')],'XMF-MODEM':util[_0xd0a0('0xc')]('\x22%s\x22',_0x2e6af1[_0xd0a0('0xd')]),'XMF-GATEWAY':_0x2e6af1['gateway'],'XMF-FAXDETECT':_0x2e6af1['faxdetect'],'XMF-T38TIMEOUT':_0x2e6af1[_0xd0a0('0xe')],'XMF-LOCALSTATIONID':_0x2e6af1[_0xd0a0('0xf')],'XMF-PATH':_0xeee5f8[_0xd0a0('0x10')]};return _0x2b25ca;};exports[_0xd0a0('0x11')]=function(_0x386c60,_0x71a69e){return{'actionid':_0x386c60[_0xd0a0('0x12')],'action':_0xd0a0('0x13'),'channel':_0x386c60[_0xd0a0('0x14')],'Exten':_0xd0a0('0x15'),'Context':'from-sip','Priority':'1','callerid':util['format'](_0xd0a0('0x16'),_0x386c60['headerinfo']?_0x386c60[_0xd0a0('0xa')]:'',_0x386c60[_0xd0a0('0xf')]),'variable':_0x71a69e,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x386c60[_0xd0a0('0x12')]};}; \ No newline at end of file +var _0x0be1=['util','lodash','moment','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','headerinfo','minrate','format','\x22%s\x22','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0x0be1,0x1b0));var _0x10be=function(_0xbc1a4b,_0x4dfbe4){_0xbc1a4b=_0xbc1a4b-0x0;var _0x108b87=_0x0be1[_0xbc1a4b];return _0x108b87;};'use strict';var util=require(_0x10be('0x0'));var _=require(_0x10be('0x1'));var moment=require(_0x10be('0x2'));var logger=require(_0x10be('0x3'))(_0x10be('0x4'));exports[_0x10be('0x5')]=function(_0x414e89){return{'message':_0x414e89};};exports[_0x10be('0x6')]=function(_0x31aca3,_0x3076d5){logger[_0x10be('0x7')](_0x31aca3,util[_0x10be('0x8')](_0x3076d5,{'showHidden':![],'depth':null}));};exports[_0x10be('0x9')]=function(_0x8379da,_0x359366){var _0xb93875={'XMF-ECM':_0x359366[_0x10be('0xa')],'XMF-HEADERINFO':_0x359366[_0x10be('0xb')],'XMF-MINRATE':_0x359366[_0x10be('0xc')],'XMF-MAXRATE':_0x359366['maxrate'],'XMF-MODEM':util[_0x10be('0xd')](_0x10be('0xe'),_0x359366['modem']),'XMF-GATEWAY':_0x359366[_0x10be('0xf')],'XMF-FAXDETECT':_0x359366[_0x10be('0x10')],'XMF-T38TIMEOUT':_0x359366[_0x10be('0x11')],'XMF-LOCALSTATIONID':_0x359366[_0x10be('0x12')],'XMF-PATH':_0x8379da[_0x10be('0x13')]};return _0xb93875;};exports[_0x10be('0x14')]=function(_0x587bec,_0x1a9fc1){return{'actionid':_0x587bec[_0x10be('0x15')],'action':_0x10be('0x16'),'channel':_0x587bec[_0x10be('0x17')],'Exten':_0x10be('0x18'),'Context':_0x10be('0x19'),'Priority':'1','callerid':util[_0x10be('0xd')](_0x10be('0x1a'),_0x587bec[_0x10be('0xb')]?_0x587bec[_0x10be('0xb')]:'',_0x587bec['localstationid']),'variable':_0x1a9fc1,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x587bec[_0x10be('0x15')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 031af2d..b2da38b 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 _0x22c8=['getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','util','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','../../config/logger','get','hour','resolve','getAgents','then','initAgents','getTelephones','getTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x22c8,0x129));var _0x822c=function(_0xf363f0,_0x3b5eeb){_0xf363f0=_0xf363f0-0x0;var _0x55a386=_0x22c8[_0xf363f0];return _0x55a386;};'use strict';var util=require(_0x822c('0x0'));var moment=require('moment');var server=require(_0x822c('0x1'));var Realtime=require(_0x822c('0x2'));var Report=require(_0x822c('0x3'));var Acw=require(_0x822c('0x4'));var Trigger=require(_0x822c('0x5'));var Dialer=require(_0x822c('0x6'));var Preview=require(_0x822c('0x7'));var Fax=require(_0x822c('0x8'));var user=require('./rpc/user');var voiceQueue=require(_0x822c('0x9'));var voiceQueueReport=require(_0x822c('0xa'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x822c('0xb'));var trigger=require(_0x822c('0xc'));var template=require(_0x822c('0xd'));var cmHopperHistory=require(_0x822c('0xe'));var campaign=require(_0x822c('0xf'));var voiceExtension=require(_0x822c('0x10'));var faxAccount=require(_0x822c('0x11'));var zendesk=require(_0x822c('0x12'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x822c('0x13'));var zoho=require(_0x822c('0x14'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x822c('0x15'));var servicenow=require(_0x822c('0x16'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x822c('0x17'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x822c('0x18')](_0x822c('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x822c('0x18')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x822c('0x1a')]()['then'](user[_0x822c('0x1b')]())[_0x822c('0x1c')](realtime[_0x822c('0x1d')]())[_0x822c('0x1c')](user[_0x822c('0x1e')]())[_0x822c('0x1c')](realtime['initTelephones']())[_0x822c('0x1c')](trunk[_0x822c('0x1f')]())[_0x822c('0x1c')](realtime['initTrunks']())[_0x822c('0x1c')](voiceQueue[_0x822c('0x20')]())[_0x822c('0x1c')](realtime['initVoiceQueues']())[_0x822c('0x1c')](trigger[_0x822c('0x21')]())[_0x822c('0x1c')](realtime[_0x822c('0x22')]())[_0x822c('0x1c')](template[_0x822c('0x23')]())[_0x822c('0x1c')](realtime[_0x822c('0x24')]())[_0x822c('0x1c')](zendesk[_0x822c('0x25')]())[_0x822c('0x1c')](realtime['initZendeskAccounts']())['then'](salesforce[_0x822c('0x26')]())[_0x822c('0x1c')](realtime['initSalesforceAccounts']())[_0x822c('0x1c')](sugarcrm[_0x822c('0x27')]())[_0x822c('0x1c')](realtime[_0x822c('0x28')]())[_0x822c('0x1c')](freshdesk[_0x822c('0x29')]())['then'](realtime[_0x822c('0x2a')]())[_0x822c('0x1c')](desk[_0x822c('0x2b')]())[_0x822c('0x1c')](realtime[_0x822c('0x2c')]())[_0x822c('0x1c')](zoho[_0x822c('0x2d')]())[_0x822c('0x1c')](realtime[_0x822c('0x2e')]())['then'](vtiger['getVtigerAccounts']())[_0x822c('0x1c')](realtime[_0x822c('0x2f')]())[_0x822c('0x1c')](freshsales[_0x822c('0x30')]())['then'](realtime[_0x822c('0x31')]())[_0x822c('0x1c')](servicenow[_0x822c('0x32')]())[_0x822c('0x1c')](realtime[_0x822c('0x33')]())[_0x822c('0x1c')](dynamics365[_0x822c('0x34')]())[_0x822c('0x1c')](realtime[_0x822c('0x35')]())[_0x822c('0x1c')](campaign[_0x822c('0x36')]())[_0x822c('0x1c')](realtime[_0x822c('0x37')]())['then'](voiceExtension['getVoiceExtensions']())[_0x822c('0x1c')](realtime[_0x822c('0x38')]())[_0x822c('0x1c')](faxAccount['getFaxAccounts']())[_0x822c('0x1c')](realtime[_0x822c('0x39')]())[_0x822c('0x1c')](function(){return realtime;});}function initParams(){return Promise[_0x822c('0x1a')]()[_0x822c('0x1c')](voiceQueueReport[_0x822c('0x3a')]())[_0x822c('0x1c')](realtime[_0x822c('0x3b')]())[_0x822c('0x1c')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x822c('0x1c')](realtime[_0x822c('0x3c')]())[_0x822c('0x1c')](cmHopperHistory[_0x822c('0x3d')]())[_0x822c('0x1c')](realtime[_0x822c('0x3e')]())[_0x822c('0x1c')](voiceCallReport[_0x822c('0x3f')]())[_0x822c('0x1c')](realtime[_0x822c('0x40')]())[_0x822c('0x41')](function(_0x5c8d85){logger[_0x822c('0x42')](_0x822c('0x43'),util[_0x822c('0x44')](_0x5c8d85,{'showHidden':![],'depth':null}));});}function main(){return server[_0x822c('0x45')](realtime,preview,fax)['then'](function(){return initRealtime();})[_0x822c('0x1c')](function(){return initParams();})[_0x822c('0x1c')](function(){report[_0x822c('0x46')]();setInterval(initRealtime,0x1388);})[_0x822c('0x41')](function(_0xa03d6e){logger['error'](_0x822c('0x47'),util[_0x822c('0x44')](_0xa03d6e,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x4cbf=['initServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','[index.js][initParams]','listen','sync','error','[index.js][main]','inspect','util','moment','./server','./realtime','./report','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','../../config/logger','ami','hour','get','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts'];(function(_0x4efd68,_0x2e4130){var _0x51f6ec=function(_0x3d415a){while(--_0x3d415a){_0x4efd68['push'](_0x4efd68['shift']());}};_0x51f6ec(++_0x2e4130);}(_0x4cbf,0xa3));var _0xf4cb=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x4cbf[_0x484e36];return _0xafc85d;};'use strict';var util=require(_0xf4cb('0x0'));var moment=require(_0xf4cb('0x1'));var server=require(_0xf4cb('0x2'));var Realtime=require(_0xf4cb('0x3'));var Report=require(_0xf4cb('0x4'));var Acw=require('./acw');var Trigger=require(_0xf4cb('0x5'));var Dialer=require(_0xf4cb('0x6'));var Preview=require(_0xf4cb('0x7'));var Fax=require(_0xf4cb('0x8'));var user=require(_0xf4cb('0x9'));var voiceQueue=require(_0xf4cb('0xa'));var voiceQueueReport=require(_0xf4cb('0xb'));var voiceCallReport=require(_0xf4cb('0xc'));var trunk=require('./rpc/trunk');var trigger=require(_0xf4cb('0xd'));var template=require('./rpc/template');var cmHopperHistory=require(_0xf4cb('0xe'));var campaign=require(_0xf4cb('0xf'));var voiceExtension=require(_0xf4cb('0x10'));var faxAccount=require(_0xf4cb('0x11'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xf4cb('0x12'));var freshdesk=require(_0xf4cb('0x13'));var desk=require(_0xf4cb('0x14'));var zoho=require(_0xf4cb('0x15'));var vtiger=require(_0xf4cb('0x16'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0xf4cb('0x17'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0xf4cb('0x18'))(_0xf4cb('0x19'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0xf4cb('0x1a'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xf4cb('0x1b')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xf4cb('0x1c')]()[_0xf4cb('0x1d')](user[_0xf4cb('0x1e')]())[_0xf4cb('0x1d')](realtime[_0xf4cb('0x1f')]())[_0xf4cb('0x1d')](user[_0xf4cb('0x20')]())['then'](realtime[_0xf4cb('0x21')]())[_0xf4cb('0x1d')](trunk[_0xf4cb('0x22')]())[_0xf4cb('0x1d')](realtime['initTrunks']())[_0xf4cb('0x1d')](voiceQueue['getVoiceQueues']())['then'](realtime[_0xf4cb('0x23')]())['then'](trigger[_0xf4cb('0x24')]())['then'](realtime[_0xf4cb('0x25')]())['then'](template[_0xf4cb('0x26')]())[_0xf4cb('0x1d')](realtime[_0xf4cb('0x27')]())['then'](zendesk[_0xf4cb('0x28')]())[_0xf4cb('0x1d')](realtime[_0xf4cb('0x29')]())[_0xf4cb('0x1d')](salesforce[_0xf4cb('0x2a')]())[_0xf4cb('0x1d')](realtime['initSalesforceAccounts']())[_0xf4cb('0x1d')](sugarcrm['getSugarcrmAccounts']())[_0xf4cb('0x1d')](realtime[_0xf4cb('0x2b')]())[_0xf4cb('0x1d')](freshdesk[_0xf4cb('0x2c')]())[_0xf4cb('0x1d')](realtime['initFreshdeskAccounts']())[_0xf4cb('0x1d')](desk['getDeskAccounts']())[_0xf4cb('0x1d')](realtime['initDeskAccounts']())[_0xf4cb('0x1d')](zoho[_0xf4cb('0x2d')]())[_0xf4cb('0x1d')](realtime[_0xf4cb('0x2e')]())[_0xf4cb('0x1d')](vtiger[_0xf4cb('0x2f')]())[_0xf4cb('0x1d')](realtime[_0xf4cb('0x30')]())[_0xf4cb('0x1d')](freshsales['getFreshsalesAccounts']())[_0xf4cb('0x1d')](realtime[_0xf4cb('0x31')]())[_0xf4cb('0x1d')](servicenow['getServicenowAccounts']())[_0xf4cb('0x1d')](realtime[_0xf4cb('0x32')]())[_0xf4cb('0x1d')](dynamics365[_0xf4cb('0x33')]())['then'](realtime['initDynamics365Accounts']())[_0xf4cb('0x1d')](campaign[_0xf4cb('0x34')]())[_0xf4cb('0x1d')](realtime[_0xf4cb('0x35')]())[_0xf4cb('0x1d')](voiceExtension[_0xf4cb('0x36')]())[_0xf4cb('0x1d')](realtime[_0xf4cb('0x37')]())['then'](faxAccount[_0xf4cb('0x38')]())['then'](realtime[_0xf4cb('0x39')]())[_0xf4cb('0x1d')](function(){return realtime;});}function initParams(){return Promise[_0xf4cb('0x1c')]()[_0xf4cb('0x1d')](voiceQueueReport[_0xf4cb('0x3a')]())[_0xf4cb('0x1d')](realtime[_0xf4cb('0x3b')]())[_0xf4cb('0x1d')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0xf4cb('0x1d')](realtime[_0xf4cb('0x3c')]())[_0xf4cb('0x1d')](cmHopperHistory[_0xf4cb('0x3d')]())['then'](realtime[_0xf4cb('0x3e')]())[_0xf4cb('0x1d')](voiceCallReport['getVoiceCallReports']())[_0xf4cb('0x1d')](realtime[_0xf4cb('0x3f')]())[_0xf4cb('0x40')](function(_0x3cba77){logger['error'](_0xf4cb('0x41'),util['inspect'](_0x3cba77,{'showHidden':![],'depth':null}));});}function main(){return server[_0xf4cb('0x42')](realtime,preview,fax)[_0xf4cb('0x1d')](function(){return initRealtime();})['then'](function(){return initParams();})[_0xf4cb('0x1d')](function(){report[_0xf4cb('0x43')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x169106){logger[_0xf4cb('0x44')](_0xf4cb('0x45'),util[_0xf4cb('0x46')](_0x169106,{'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 92ceb03..941e784 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 _0xde5c=['interface','stringify','user:%s','emit','user:save','user:presence','exports','lodash','util','moment','md5','../../../config/environment','redis','socket.io-emitter','name','accountcode','fullname','state','unknown','stateTime','status','phone','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','updateStatusRealtime','toLowerCase','inuse','talking','statePause','format','email','address'];(function(_0x21d5b3,_0x2ff359){var _0x4f82c9=function(_0x1b80b4){while(--_0x1b80b4){_0x21d5b3['push'](_0x21d5b3['shift']());}};_0x4f82c9(++_0x2ff359);}(_0xde5c,0x76));var _0xcde5=function(_0x59efbb,_0x1b77e1){_0x59efbb=_0x59efbb-0x0;var _0x1e143c=_0xde5c[_0x59efbb];return _0x1e143c;};'use strict';var _=require(_0xcde5('0x0'));var util=require(_0xcde5('0x1'));var moment=require(_0xcde5('0x2'));var md5=require(_0xcde5('0x3'));var Redis=require('ioredis');var config=require(_0xcde5('0x4'));config[_0xcde5('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xcde5('0x6'))(new Redis(config[_0xcde5('0x5')]));function Agent(_0x5f0ade){this['id']=_0x5f0ade['id']||0x0;this[_0xcde5('0x7')]=_0x5f0ade['name']||'';this['email']=_0x5f0ade['email']||'';this['accountcode']=_0x5f0ade[_0xcde5('0x8')]||'';this[_0xcde5('0x9')]=_0x5f0ade[_0xcde5('0x9')]||'';this[_0xcde5('0xa')]=_0xcde5('0xb');this[_0xcde5('0xc')]=0x0;this[_0xcde5('0xd')]=_0xcde5('0xb');this['address']='';this[_0xcde5('0xe')]='';this['mobile']='';this['interface']='';this[_0xcde5('0xf')]=_0x5f0ade['online']||![];this[_0xcde5('0x10')]=_0xcde5('0xb');this[_0xcde5('0x11')]=0x0;this[_0xcde5('0x12')]='';this[_0xcde5('0x13')]='';this[_0xcde5('0x14')]=![];this[_0xcde5('0x15')]=![];this[_0xcde5('0x3')]='';}Agent['prototype'][_0xcde5('0x16')]=function(_0x2d245b){var _0x5cd392;if(_0x2d245b&&_0x2d245b[_0xcde5('0xa')]){_0x5cd392=_0x2d245b[_0xcde5('0xa')][_0xcde5('0x17')]();switch(_0x5cd392){case'not_inuse':_0x5cd392='idle';break;case _0xcde5('0x18'):_0x5cd392=_0xcde5('0x19');break;}}if(_0x5cd392&&this[_0xcde5('0x10')]!==_0x5cd392||_0x2d245b[_0xcde5('0x1a')]){this[_0xcde5('0x11')]=_['toNumber'](moment()[_0xcde5('0x1b')]('x'));}if(_0x5cd392){this['voiceStatus']=_0x5cd392;}var _0x258bac={'id':this['id'],'name':this[_0xcde5('0x7')],'email':this[_0xcde5('0x1c')],'accountcode':this[_0xcde5('0x8')],'fullname':this['fullname'],'state':this['state'],'stateTime':this[_0xcde5('0xc')],'status':this[_0xcde5('0xd')],'address':this[_0xcde5('0x1d')],'online':this[_0xcde5('0xf')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0xcde5('0x11')],'voiceStatusCallerIdNumber':this[_0xcde5('0x12')],'voiceStatusQueue':this[_0xcde5('0x13')],'interface':this[_0xcde5('0x1e')],'onhold':this['onhold']};var _0x8dc33c=md5(JSON[_0xcde5('0x1f')](_0x258bac));if(this['md5']!==_0x8dc33c){this[_0xcde5('0x3')]=_0x8dc33c;io['to'](util[_0xcde5('0x1b')](_0xcde5('0x20'),_0x258bac[_0xcde5('0x7')]))[_0xcde5('0x21')](_0xcde5('0x22'),_0x258bac);io[_0xcde5('0x21')](_0xcde5('0x23'),_0x258bac);}};module[_0xcde5('0x24')]=Agent; \ No newline at end of file +var _0xb954=['user:%s','emit','user:presence','exports','lodash','util','moment','md5','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','address','phone','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','prototype','updateStatusRealtime','state','toLowerCase','not_inuse','idle','inuse','talking','statePause','toNumber','format','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb954,0x115));var _0x4b95=function(_0x20237d,_0x506c3d){_0x20237d=_0x20237d-0x0;var _0x5a5b92=_0xb954[_0x20237d];return _0x5a5b92;};'use strict';var _=require(_0x4b95('0x0'));var util=require(_0x4b95('0x1'));var moment=require(_0x4b95('0x2'));var md5=require(_0x4b95('0x3'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x4b95('0x4')]=_['defaults'](config[_0x4b95('0x4')],{'host':_0x4b95('0x5'),'port':0x18eb});var io=require(_0x4b95('0x6'))(new Redis(config[_0x4b95('0x4')]));function Agent(_0x4df3b9){this['id']=_0x4df3b9['id']||0x0;this[_0x4b95('0x7')]=_0x4df3b9[_0x4b95('0x7')]||'';this[_0x4b95('0x8')]=_0x4df3b9[_0x4b95('0x8')]||'';this[_0x4b95('0x9')]=_0x4df3b9[_0x4b95('0x9')]||'';this[_0x4b95('0xa')]=_0x4df3b9[_0x4b95('0xa')]||'';this['state']=_0x4b95('0xb');this[_0x4b95('0xc')]=0x0;this[_0x4b95('0xd')]='unknown';this[_0x4b95('0xe')]='';this[_0x4b95('0xf')]='';this['mobile']='';this[_0x4b95('0x10')]='';this[_0x4b95('0x11')]=_0x4df3b9[_0x4b95('0x11')]||![];this[_0x4b95('0x12')]='unknown';this[_0x4b95('0x13')]=0x0;this[_0x4b95('0x14')]='';this[_0x4b95('0x15')]='';this[_0x4b95('0x16')]=![];this['local']=![];this['md5']='';}Agent[_0x4b95('0x17')][_0x4b95('0x18')]=function(_0x22dfbe){var _0x2ec7af;if(_0x22dfbe&&_0x22dfbe[_0x4b95('0x19')]){_0x2ec7af=_0x22dfbe['state'][_0x4b95('0x1a')]();switch(_0x2ec7af){case _0x4b95('0x1b'):_0x2ec7af=_0x4b95('0x1c');break;case _0x4b95('0x1d'):_0x2ec7af=_0x4b95('0x1e');break;}}if(_0x2ec7af&&this[_0x4b95('0x12')]!==_0x2ec7af||_0x22dfbe[_0x4b95('0x1f')]){this['voiceStatusTime']=_[_0x4b95('0x20')](moment()[_0x4b95('0x21')]('x'));}if(_0x2ec7af){this[_0x4b95('0x12')]=_0x2ec7af;}var _0x6d4313={'id':this['id'],'name':this['name'],'email':this['email'],'accountcode':this[_0x4b95('0x9')],'fullname':this[_0x4b95('0xa')],'state':this[_0x4b95('0x19')],'stateTime':this[_0x4b95('0xc')],'status':this[_0x4b95('0xd')],'address':this[_0x4b95('0xe')],'online':this['online'],'voiceStatus':this[_0x4b95('0x12')],'voiceStatusTime':this[_0x4b95('0x13')],'voiceStatusCallerIdNumber':this[_0x4b95('0x14')],'voiceStatusQueue':this[_0x4b95('0x15')],'interface':this[_0x4b95('0x10')],'onhold':this[_0x4b95('0x16')]};var _0x37a0f1=md5(JSON[_0x4b95('0x22')](_0x6d4313));if(this[_0x4b95('0x3')]!==_0x37a0f1){this[_0x4b95('0x3')]=_0x37a0f1;io['to'](util['format'](_0x4b95('0x23'),_0x6d4313[_0x4b95('0x7')]))[_0x4b95('0x24')]('user:save',_0x6d4313);io[_0x4b95('0x24')](_0x4b95('0x25'),_0x6d4313);}};module[_0x4b95('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 606c7e5..c496f96 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 _0x5c8a=['TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','temp','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber'];(function(_0xdc1dff,_0x3f6eec){var _0x372ca9=function(_0x37c51f){while(--_0x37c51f){_0xdc1dff['push'](_0xdc1dff['shift']());}};_0x372ca9(++_0x3f6eec);}(_0x5c8a,0x69));var _0xa5c8=function(_0x398f66,_0x3acddb){_0x398f66=_0x398f66-0x0;var _0xcde72d=_0x5c8a[_0x398f66];return _0xcde72d;};'use strict';function Campaign(_0x42525d){this['id']=_0x42525d['id']||0x0;this[_0xa5c8('0x0')]=_0x42525d[_0xa5c8('0x0')]||'';this[_0xa5c8('0x1')]=_0x42525d[_0xa5c8('0x1')]||_0xa5c8('0x2');this['originated']=0x0;this[_0xa5c8('0x3')]=0x0;this[_0xa5c8('0x4')]=0x0;this[_0xa5c8('0x5')]=0x0;this['message']='';this[_0xa5c8('0x6')]=!![];this[_0xa5c8('0x7')]=_0x42525d[_0xa5c8('0x7')];this[_0xa5c8('0x8')]=_0x42525d[_0xa5c8('0x8')];this['dialTimezone']=_0x42525d['dialTimezone']||null;this[_0xa5c8('0x9')]=_0x42525d[_0xa5c8('0x9')]?_0x42525d['dialGlobalInterval']:null;this[_0xa5c8('0xa')]=_0x42525d[_0xa5c8('0xa')];this[_0xa5c8('0xb')]=_0x42525d[_0xa5c8('0xb')];this['dialOriginateTimeout']=_0x42525d['dialOriginateTimeout']||0x1e;this[_0xa5c8('0xc')]=_0x42525d[_0xa5c8('0xc')];this[_0xa5c8('0xd')]=_0x42525d[_0xa5c8('0xd')];this['dialBusyMaxRetry']=_0x42525d[_0xa5c8('0xe')];this[_0xa5c8('0xf')]=_0x42525d[_0xa5c8('0xf')];this['dialNoAnswerMaxRetry']=_0x42525d['dialNoAnswerMaxRetry'];this[_0xa5c8('0x10')]=_0x42525d[_0xa5c8('0x10')];this[_0xa5c8('0x11')]=_0x42525d['dialGlobalMaxRetry'];this[_0xa5c8('0x12')]=_0x42525d[_0xa5c8('0x12')]||0x3;this[_0xa5c8('0x13')]=_0x42525d[_0xa5c8('0x13')]||0x96;this['dialDropMaxRetry']=_0x42525d['dialDropMaxRetry']||0x3;this[_0xa5c8('0x14')]=_0x42525d[_0xa5c8('0x14')]||0x96;this[_0xa5c8('0x15')]=_0x42525d[_0xa5c8('0x15')]||0x3;this['dialAbandonedRetryFrequency']=_0x42525d['dialAbandonedRetryFrequency']||0x96;this[_0xa5c8('0x16')]=_0x42525d[_0xa5c8('0x16')]||0x3;this[_0xa5c8('0x17')]=_0x42525d[_0xa5c8('0x17')]||0x96;this[_0xa5c8('0x18')]=_0x42525d[_0xa5c8('0x18')]||0x3;this[_0xa5c8('0x19')]=_0x42525d[_0xa5c8('0x19')]||0x96;this[_0xa5c8('0x1a')]=_0x42525d[_0xa5c8('0x1a')]||_0xa5c8('0x1b');this[_0xa5c8('0x1c')]=_0x42525d[_0xa5c8('0x1c')]||undefined;this[_0xa5c8('0x1d')]=_0x42525d[_0xa5c8('0x1d')]||undefined;this['dialCutDigit']=_0x42525d['dialCutDigit']||undefined;this['TrunkBackup']=_0x42525d[_0xa5c8('0x1e')]?_0x42525d['TrunkBackup']:undefined;this['Trunk']=_0x42525d[_0xa5c8('0x1f')]?_0x42525d[_0xa5c8('0x1f')]:undefined;this[_0xa5c8('0x20')]=_0x42525d['Interval']?_0x42525d['Interval']:undefined;this[_0xa5c8('0x21')]=_0x42525d[_0xa5c8('0x21')]?_0x42525d[_0xa5c8('0x21')]:undefined;this[_0xa5c8('0x22')]=_0x42525d[_0xa5c8('0x21')]?_0x42525d[_0xa5c8('0x21')]['name']:undefined;this[_0xa5c8('0x23')]=_0x42525d[_0xa5c8('0x23')]||![];this[_0xa5c8('0x24')]=_0x42525d['dialAMDInitialSilence'];this[_0xa5c8('0x25')]=_0x42525d[_0xa5c8('0x25')];this[_0xa5c8('0x26')]=_0x42525d[_0xa5c8('0x26')];this['dialAMDTotalAnalysisTime']=_0x42525d[_0xa5c8('0x27')];this['dialAMDMinWordLength']=_0x42525d[_0xa5c8('0x28')];this['dialAMDBetweenWordsSilence']=_0x42525d[_0xa5c8('0x29')];this['dialAMDMaximumNumberOfWords']=_0x42525d['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x42525d[_0xa5c8('0x2a')];this['dialAMDMaximumWordLength']=_0x42525d[_0xa5c8('0x2b')];}module[_0xa5c8('0x2c')]=Campaign; \ No newline at end of file +var _0x88a3=['dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords'];(function(_0x3303a5,_0x362dd6){var _0x343f07=function(_0x4c346e){while(--_0x4c346e){_0x3303a5['push'](_0x3303a5['shift']());}};_0x343f07(++_0x362dd6);}(_0x88a3,0x1b3));var _0x388a=function(_0x2deed4,_0x2793e8){_0x2deed4=_0x2deed4-0x0;var _0xfb91f4=_0x88a3[_0x2deed4];return _0xfb91f4;};'use strict';function Campaign(_0x41eb92){this['id']=_0x41eb92['id']||0x0;this[_0x388a('0x0')]=_0x41eb92[_0x388a('0x0')]||'';this['type']=_0x41eb92[_0x388a('0x1')]||_0x388a('0x2');this[_0x388a('0x3')]=0x0;this[_0x388a('0x4')]=0x0;this['ivrAnswerCallsDay']=0x0;this['ivrTotalCallsDays']=0x0;this['message']='';this['sendMessageOneNotActive']=!![];this[_0x388a('0x5')]=_0x41eb92['active'];this[_0x388a('0x6')]=_0x41eb92[_0x388a('0x6')];this['dialTimezone']=_0x41eb92[_0x388a('0x7')]||null;this['dialGlobalInterval']=_0x41eb92[_0x388a('0x8')]?_0x41eb92[_0x388a('0x8')]:null;this['dialOriginateCallerIdName']=_0x41eb92[_0x388a('0x9')];this[_0x388a('0xa')]=_0x41eb92[_0x388a('0xa')];this[_0x388a('0xb')]=_0x41eb92[_0x388a('0xb')]||0x1e;this[_0x388a('0xc')]=_0x41eb92[_0x388a('0xc')];this[_0x388a('0xd')]=_0x41eb92[_0x388a('0xd')];this[_0x388a('0xe')]=_0x41eb92[_0x388a('0xe')];this[_0x388a('0xf')]=_0x41eb92['dialBusyRetryFrequency'];this[_0x388a('0x10')]=_0x41eb92[_0x388a('0x10')];this['dialNoAnswerRetryFrequency']=_0x41eb92['dialNoAnswerRetryFrequency'];this[_0x388a('0x11')]=_0x41eb92[_0x388a('0x11')];this['dialNoSuchNumberMaxRetry']=_0x41eb92[_0x388a('0x12')]||0x3;this[_0x388a('0x13')]=_0x41eb92[_0x388a('0x13')]||0x96;this[_0x388a('0x14')]=_0x41eb92[_0x388a('0x14')]||0x3;this[_0x388a('0x15')]=_0x41eb92[_0x388a('0x15')]||0x96;this[_0x388a('0x16')]=_0x41eb92[_0x388a('0x16')]||0x3;this[_0x388a('0x17')]=_0x41eb92[_0x388a('0x17')]||0x96;this[_0x388a('0x18')]=_0x41eb92['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x41eb92[_0x388a('0x19')]||0x96;this[_0x388a('0x1a')]=_0x41eb92['dialAgentRejectMaxRetry']||0x3;this[_0x388a('0x1b')]=_0x41eb92[_0x388a('0x1b')]||0x96;this[_0x388a('0x1c')]=_0x41eb92['dialOrderByScheduledAt']||_0x388a('0x1d');this[_0x388a('0x1e')]=_0x41eb92[_0x388a('0x1e')]||undefined;this[_0x388a('0x1f')]=_0x41eb92[_0x388a('0x1f')]||undefined;this[_0x388a('0x20')]=_0x41eb92[_0x388a('0x20')]||undefined;this[_0x388a('0x21')]=_0x41eb92[_0x388a('0x21')]?_0x41eb92[_0x388a('0x21')]:undefined;this[_0x388a('0x22')]=_0x41eb92['Trunk']?_0x41eb92[_0x388a('0x22')]:undefined;this[_0x388a('0x23')]=_0x41eb92[_0x388a('0x23')]?_0x41eb92[_0x388a('0x23')]:undefined;this[_0x388a('0x24')]=_0x41eb92[_0x388a('0x24')]?_0x41eb92['SquareProject']:undefined;this[_0x388a('0x25')]=_0x41eb92['SquareProject']?_0x41eb92[_0x388a('0x24')][_0x388a('0x0')]:undefined;this['dialAMDActive']=_0x41eb92['dialAMDActive']||![];this[_0x388a('0x26')]=_0x41eb92[_0x388a('0x26')];this[_0x388a('0x27')]=_0x41eb92[_0x388a('0x27')];this[_0x388a('0x28')]=_0x41eb92[_0x388a('0x28')];this[_0x388a('0x29')]=_0x41eb92[_0x388a('0x29')];this[_0x388a('0x2a')]=_0x41eb92[_0x388a('0x2a')];this[_0x388a('0x2b')]=_0x41eb92['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x41eb92[_0x388a('0x2c')];this[_0x388a('0x2d')]=_0x41eb92['dialAMDSilenceThreshold'];this[_0x388a('0x2e')]=_0x41eb92['dialAMDMaximumWordLength'];}module[_0x388a('0x2f')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 4647dba..8a3fd6c 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 _0xd8a2=['channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','context','uniqueid','exten','answertime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitor','queue','transferconnectedlinenum','transferType','mohtime','exports','starttime'];(function(_0x8d07bb,_0x1e10c7){var _0x3efb3f=function(_0x446182){while(--_0x446182){_0x8d07bb['push'](_0x8d07bb['shift']());}};_0x3efb3f(++_0x1e10c7);}(_0xd8a2,0x128));var _0x2d8a=function(_0x417df4,_0x5052bc){_0x417df4=_0x417df4-0x0;var _0x32aa85=_0xd8a2[_0x417df4];return _0x32aa85;};'use strict';function Channel(){this[_0x2d8a('0x0')]=null;this[_0x2d8a('0x1')]='';this[_0x2d8a('0x2')]='';this[_0x2d8a('0x3')]=0x0;this[_0x2d8a('0x4')]='';this[_0x2d8a('0x5')]=undefined;this[_0x2d8a('0x6')]=undefined;this['accountcode']=0x0;this[_0x2d8a('0x7')]='';this[_0x2d8a('0x8')]=0x0;this['linkedid']=0x0;this[_0x2d8a('0x9')]=0x0;this['answered']=![];this[_0x2d8a('0xa')]=null;this['endtime']=null;this[_0x2d8a('0xb')]=![];this[_0x2d8a('0xc')]=![];this[_0x2d8a('0xd')]='';this[_0x2d8a('0xe')]='';this[_0x2d8a('0xf')]=0x0;this[_0x2d8a('0x10')]=0x0;this[_0x2d8a('0x11')]=0x0;this[_0x2d8a('0x12')]=null;this[_0x2d8a('0x13')]=null;this[_0x2d8a('0x14')]=null;this[_0x2d8a('0x15')]=![];this['monitorFilename']=null;this[_0x2d8a('0x16')]=null;this['monitors']=[];this['transfercalleridnum']=undefined;this[_0x2d8a('0x17')]=undefined;this[_0x2d8a('0x18')]=undefined;this[_0x2d8a('0x19')]=0x0;}module[_0x2d8a('0x1a')]=Channel; \ No newline at end of file +var _0xa868=['destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','answered','answertime','endtime','lastdata','duration','holdtime','tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferType','mohtime','exports','starttime','channel'];(function(_0x58ce07,_0x3d0e37){var _0x438f7=function(_0x2bed44){while(--_0x2bed44){_0x58ce07['push'](_0x58ce07['shift']());}};_0x438f7(++_0x3d0e37);}(_0xa868,0x1b8));var _0x8a86=function(_0x37f89c,_0x49a16c){_0x37f89c=_0x37f89c-0x0;var _0x4ebeac=_0xa868[_0x37f89c];return _0x4ebeac;};'use strict';function Channel(){this[_0x8a86('0x0')]=null;this[_0x8a86('0x1')]='';this[_0x8a86('0x2')]='';this[_0x8a86('0x3')]=0x0;this[_0x8a86('0x4')]='';this[_0x8a86('0x5')]=undefined;this[_0x8a86('0x6')]=undefined;this[_0x8a86('0x7')]=0x0;this[_0x8a86('0x8')]='';this[_0x8a86('0x9')]=0x0;this['linkedid']=0x0;this['exten']=0x0;this[_0x8a86('0xa')]=![];this[_0x8a86('0xb')]=null;this[_0x8a86('0xc')]=null;this['unmanaged']=![];this['abandoned']=![];this['lastapplication']='';this[_0x8a86('0xd')]='';this[_0x8a86('0xe')]=0x0;this['billableseconds']=0x0;this[_0x8a86('0xf')]=0x0;this['type']=null;this[_0x8a86('0x10')]=null;this[_0x8a86('0x11')]=null;this[_0x8a86('0x12')]=![];this[_0x8a86('0x13')]=null;this[_0x8a86('0x14')]=null;this[_0x8a86('0x15')]=[];this[_0x8a86('0x16')]=undefined;this['transferconnectedlinenum']=undefined;this[_0x8a86('0x17')]=undefined;this[_0x8a86('0x18')]=0x0;}module[_0x8a86('0x19')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index ac5e8b4..06fe282 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 _0xdb44=['username','remoteUri','authType','password','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name'];(function(_0xb3a0d7,_0x5d7559){var _0x8c03d0=function(_0x50f8ee){while(--_0x50f8ee){_0xb3a0d7['push'](_0xb3a0d7['shift']());}};_0x8c03d0(++_0x5d7559);}(_0xdb44,0x1a3));var _0x4db4=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xdb44[_0x42bdad];return _0x122626;};'use strict';function DeskAccount(_0x5a027c){this['id']=_0x5a027c['id']||0x0;this[_0x4db4('0x0')]=_0x5a027c[_0x4db4('0x0')]||'';this[_0x4db4('0x1')]=_0x5a027c[_0x4db4('0x1')]||'';this[_0x4db4('0x2')]=_0x5a027c[_0x4db4('0x2')]||'';this[_0x4db4('0x3')]=_0x5a027c['authType']||'';this['password']=_0x5a027c[_0x4db4('0x4')]||'';this['consumerKey']=_0x5a027c['consumerKey']||'';this[_0x4db4('0x5')]=_0x5a027c['consumerSecret']||'';this[_0x4db4('0x6')]=_0x5a027c[_0x4db4('0x6')]||'';this[_0x4db4('0x7')]=_0x5a027c[_0x4db4('0x7')]||'';this[_0x4db4('0x8')]=_0x5a027c[_0x4db4('0x8')]||'';this[_0x4db4('0x9')]=_0x5a027c[_0x4db4('0x9')]||'';this[_0x4db4('0xa')]=_0x5a027c[_0x4db4('0xa')]||{};}module[_0x4db4('0xb')]=DeskAccount; \ No newline at end of file +var _0x0a3a=['serverUrl','Configurations','exports','name','remoteUri','authType','consumerKey','consumerSecret','token','tokenSecret','type'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0a3a,0x18f));var _0xa0a3=function(_0x5e8ff8,_0x3e8081){_0x5e8ff8=_0x5e8ff8-0x0;var _0x258962=_0x0a3a[_0x5e8ff8];return _0x258962;};'use strict';function DeskAccount(_0x5a76ec){this['id']=_0x5a76ec['id']||0x0;this['name']=_0x5a76ec[_0xa0a3('0x0')]||'';this['username']=_0x5a76ec['username']||'';this[_0xa0a3('0x1')]=_0x5a76ec['remoteUri']||'';this['authType']=_0x5a76ec[_0xa0a3('0x2')]||'';this['password']=_0x5a76ec['password']||'';this[_0xa0a3('0x3')]=_0x5a76ec[_0xa0a3('0x3')]||'';this[_0xa0a3('0x4')]=_0x5a76ec[_0xa0a3('0x4')]||'';this[_0xa0a3('0x5')]=_0x5a76ec[_0xa0a3('0x5')]||'';this[_0xa0a3('0x6')]=_0x5a76ec[_0xa0a3('0x6')]||'';this[_0xa0a3('0x7')]=_0x5a76ec['type']||'';this[_0xa0a3('0x8')]=_0x5a76ec[_0xa0a3('0x8')]||'';this['Configurations']=_0x5a76ec[_0xa0a3('0x9')]||{};}module[_0xa0a3('0xa')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 4576f85..1b36f23 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 _0x434e=['username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name'];(function(_0xc1a764,_0xc53542){var _0x3677c7=function(_0x306fe3){while(--_0x306fe3){_0xc1a764['push'](_0xc1a764['shift']());}};_0x3677c7(++_0xc53542);}(_0x434e,0x8f));var _0xe434=function(_0x4521e3,_0x10a8a4){_0x4521e3=_0x4521e3-0x0;var _0x46a272=_0x434e[_0x4521e3];return _0x46a272;};'use strict';function Dynamics365Account(_0x10c0b6){this['id']=_0x10c0b6['id']||0x0;this[_0xe434('0x0')]=_0x10c0b6[_0xe434('0x0')]||'';this['username']=_0x10c0b6[_0xe434('0x1')]||'';this[_0xe434('0x2')]=_0x10c0b6[_0xe434('0x2')]||'';this[_0xe434('0x3')]=_0x10c0b6[_0xe434('0x3')]||'';this[_0xe434('0x4')]=_0x10c0b6[_0xe434('0x4')]||'';this[_0xe434('0x5')]=_0x10c0b6[_0xe434('0x5')]||'';this['clientSecret']=_0x10c0b6[_0xe434('0x6')]||{};this[_0xe434('0x7')]=_0x10c0b6[_0xe434('0x7')]||'';this[_0xe434('0x8')]=_0x10c0b6[_0xe434('0x8')]||![];this[_0xe434('0x9')]=_0x10c0b6[_0xe434('0x9')]||{};this[_0xe434('0xa')]=_0x10c0b6[_0xe434('0xa')]||{};}module[_0xe434('0xb')]=Dynamics365Account; \ No newline at end of file +var _0xbf4b=['serverUrl','modernAuthentication','Configurations','CloudProvider','name','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xbf4b,0x12d));var _0xbbf4=function(_0x491c1e,_0x32710a){_0x491c1e=_0x491c1e-0x0;var _0x30d20b=_0xbf4b[_0x491c1e];return _0x30d20b;};'use strict';function Dynamics365Account(_0xee0bb4){this['id']=_0xee0bb4['id']||0x0;this[_0xbbf4('0x0')]=_0xee0bb4[_0xbbf4('0x0')]||'';this['username']=_0xee0bb4[_0xbbf4('0x1')]||'';this[_0xbbf4('0x2')]=_0xee0bb4['password']||'';this['remoteUri']=_0xee0bb4[_0xbbf4('0x3')]||'';this[_0xbbf4('0x4')]=_0xee0bb4[_0xbbf4('0x4')]||'';this['clientId']=_0xee0bb4[_0xbbf4('0x5')]||'';this[_0xbbf4('0x6')]=_0xee0bb4[_0xbbf4('0x6')]||{};this['serverUrl']=_0xee0bb4[_0xbbf4('0x7')]||'';this[_0xbbf4('0x8')]=_0xee0bb4['modernAuthentication']||![];this[_0xbbf4('0x9')]=_0xee0bb4[_0xbbf4('0x9')]||{};this[_0xbbf4('0xa')]=_0xee0bb4['CloudProvider']||{};}module['exports']=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index bd2a97f..e91bf3b 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 _0x2716=['modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','name','description','ecm','headerinfo','localstationid','minrate','maxrate'];(function(_0x7a4660,_0x5eb15f){var _0x5d876f=function(_0x1b8c45){while(--_0x1b8c45){_0x7a4660['push'](_0x7a4660['shift']());}};_0x5d876f(++_0x5eb15f);}(_0x2716,0x189));var _0x6271=function(_0x5758c9,_0x3e7929){_0x5758c9=_0x5758c9-0x0;var _0x46892f=_0x2716[_0x5758c9];return _0x46892f;};'use strict';function FaxAccount(_0x3c5135){this['id']=_0x3c5135['id']||0x0;this[_0x6271('0x0')]=_0x3c5135['name']||'';this[_0x6271('0x1')]=_0x3c5135[_0x6271('0x1')];this[_0x6271('0x2')]=_0x3c5135[_0x6271('0x2')];this['headerinfo']=_0x3c5135[_0x6271('0x3')];this[_0x6271('0x4')]=_0x3c5135['localstationid'];this['minrate']=_0x3c5135[_0x6271('0x5')]||0x960;this[_0x6271('0x6')]=_0x3c5135[_0x6271('0x6')]||0x3840;this[_0x6271('0x7')]=_0x3c5135[_0x6271('0x7')]||_0x6271('0x8');this[_0x6271('0x9')]=_0x3c5135['gateway']||'no';this[_0x6271('0xa')]=_0x3c5135[_0x6271('0xa')]||'no';this['t38timeout']=_0x3c5135[_0x6271('0xb')]||0x1388;this[_0x6271('0xc')]=_0x3c5135[_0x6271('0xc')]||'SIP';this[_0x6271('0xd')]=_0x3c5135['Trunk']?_0x3c5135[_0x6271('0xd')]:undefined;this[_0x6271('0xe')]=_0x3c5135[_0x6271('0xe')];this[_0x6271('0xf')]=_0x3c5135[_0x6271('0xf')];}module['exports']=FaxAccount; \ No newline at end of file +var _0x2eb0=['faxdetect','t38timeout','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway'];(function(_0x2632be,_0x1546f5){var _0x27c6f7=function(_0x383f3b){while(--_0x383f3b){_0x2632be['push'](_0x2632be['shift']());}};_0x27c6f7(++_0x1546f5);}(_0x2eb0,0xb1));var _0x02eb=function(_0x5ea2d3,_0xfe8fac){_0x5ea2d3=_0x5ea2d3-0x0;var _0x24f40c=_0x2eb0[_0x5ea2d3];return _0x24f40c;};'use strict';function FaxAccount(_0x14d6e2){this['id']=_0x14d6e2['id']||0x0;this[_0x02eb('0x0')]=_0x14d6e2['name']||'';this['description']=_0x14d6e2[_0x02eb('0x1')];this['ecm']=_0x14d6e2[_0x02eb('0x2')];this['headerinfo']=_0x14d6e2[_0x02eb('0x3')];this['localstationid']=_0x14d6e2[_0x02eb('0x4')];this[_0x02eb('0x5')]=_0x14d6e2['minrate']||0x960;this[_0x02eb('0x6')]=_0x14d6e2[_0x02eb('0x6')]||0x3840;this[_0x02eb('0x7')]=_0x14d6e2[_0x02eb('0x7')]||_0x02eb('0x8');this[_0x02eb('0x9')]=_0x14d6e2[_0x02eb('0x9')]||'no';this[_0x02eb('0xa')]=_0x14d6e2['faxdetect']||'no';this[_0x02eb('0xb')]=_0x14d6e2[_0x02eb('0xb')]||0x1388;this['tech']=_0x14d6e2['tech']||_0x02eb('0xc');this[_0x02eb('0xd')]=_0x14d6e2[_0x02eb('0xd')]?_0x14d6e2[_0x02eb('0xd')]:undefined;this[_0x02eb('0xe')]=_0x14d6e2[_0x02eb('0xe')];this[_0x02eb('0xf')]=_0x14d6e2[_0x02eb('0xf')];}module[_0x02eb('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 8da608c..0761038 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 _0x9765=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey','token'];(function(_0x382c73,_0x199cab){var _0x1dd0bf=function(_0x358747){while(--_0x358747){_0x382c73['push'](_0x382c73['shift']());}};_0x1dd0bf(++_0x199cab);}(_0x9765,0x1a4));var _0x5976=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x9765[_0x36ed48];return _0x51c63a;};'use strict';function FreshdeskAccount(_0x54f702){this['id']=_0x54f702['id']||0x0;this['name']=_0x54f702[_0x5976('0x0')]||'';this[_0x5976('0x1')]=_0x54f702[_0x5976('0x1')]||'';this[_0x5976('0x2')]=_0x54f702[_0x5976('0x3')]||'';this[_0x5976('0x4')]=_0x54f702[_0x5976('0x4')]||'';this['serverUrl']=_0x54f702[_0x5976('0x5')]||'';this[_0x5976('0x6')]=_0x54f702[_0x5976('0x6')]||{};}module[_0x5976('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0xef91=['serverUrl','Configurations','name','username','token','remoteUri'];(function(_0x378f5f,_0x5ee3c9){var _0x34f98c=function(_0x1fa334){while(--_0x1fa334){_0x378f5f['push'](_0x378f5f['shift']());}};_0x34f98c(++_0x5ee3c9);}(_0xef91,0x98));var _0x1ef9=function(_0x5aa0cd,_0xf84f8a){_0x5aa0cd=_0x5aa0cd-0x0;var _0x5b5104=_0xef91[_0x5aa0cd];return _0x5b5104;};'use strict';function FreshdeskAccount(_0x2a79c7){this['id']=_0x2a79c7['id']||0x0;this[_0x1ef9('0x0')]=_0x2a79c7['name']||'';this[_0x1ef9('0x1')]=_0x2a79c7[_0x1ef9('0x1')]||'';this['apiKey']=_0x2a79c7[_0x1ef9('0x2')]||'';this[_0x1ef9('0x3')]=_0x2a79c7[_0x1ef9('0x3')]||'';this[_0x1ef9('0x4')]=_0x2a79c7[_0x1ef9('0x4')]||'';this['Configurations']=_0x2a79c7[_0x1ef9('0x5')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index a328c67..c32c086 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 _0x432b=['serverUrl','Configurations','exports','name','username','apiKey','remoteUri'];(function(_0xda6a0d,_0x4e8fd1){var _0x4eed0a=function(_0x316d2c){while(--_0x316d2c){_0xda6a0d['push'](_0xda6a0d['shift']());}};_0x4eed0a(++_0x4e8fd1);}(_0x432b,0x161));var _0xb432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x432b[_0x3dd15e];return _0x231fd0;};'use strict';function FreshsalesAccount(_0x582e8e){this['id']=_0x582e8e['id']||0x0;this['name']=_0x582e8e[_0xb432('0x0')]||'';this[_0xb432('0x1')]=_0x582e8e[_0xb432('0x1')]||'';this[_0xb432('0x2')]=_0x582e8e['token']||'';this['remoteUri']=_0x582e8e[_0xb432('0x3')]||'';this['serverUrl']=_0x582e8e[_0xb432('0x4')]||'';this['Configurations']=_0x582e8e[_0xb432('0x5')]||{};}module[_0xb432('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0x5549=['serverUrl','Configurations','name','username','token','remoteUri'];(function(_0x2f5666,_0x3f0442){var _0x18a845=function(_0xad8697){while(--_0xad8697){_0x2f5666['push'](_0x2f5666['shift']());}};_0x18a845(++_0x3f0442);}(_0x5549,0x1f4));var _0x9554=function(_0xac8470,_0x94c376){_0xac8470=_0xac8470-0x0;var _0x590f7b=_0x5549[_0xac8470];return _0x590f7b;};'use strict';function FreshsalesAccount(_0x41924e){this['id']=_0x41924e['id']||0x0;this[_0x9554('0x0')]=_0x41924e[_0x9554('0x0')]||'';this[_0x9554('0x1')]=_0x41924e[_0x9554('0x1')]||'';this['apiKey']=_0x41924e[_0x9554('0x2')]||'';this[_0x9554('0x3')]=_0x41924e[_0x9554('0x3')]||'';this[_0x9554('0x4')]=_0x41924e[_0x9554('0x4')]||'';this['Configurations']=_0x41924e[_0x9554('0x5')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 3616dea..6a50f13 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 _0x330c=['queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','holdtime','assigned','lastAssignedTo','motionChannel','voice','routealias','mohtime','variables','type','uniqueid','calleridnum','queue','position','count'];(function(_0x47e549,_0x2e53d6){var _0x251374=function(_0x400458){while(--_0x400458){_0x47e549['push'](_0x47e549['shift']());}};_0x251374(++_0x2e53d6);}(_0x330c,0x158));var _0xc330=function(_0x323ff3,_0x3c6cd6){_0x323ff3=_0x323ff3-0x0;var _0xafc2c1=_0x330c[_0x323ff3];return _0xafc2c1;};'use strict';function QueueReport(){this[_0xc330('0x0')]='inbound';this[_0xc330('0x1')]='';this[_0xc330('0x2')]='';this['calleridname']='';this[_0xc330('0x3')]='';this['queuecallerjoinAt']=null;this['queuecallerleaveAt']=null;this[_0xc330('0x4')]=0x1;this[_0xc330('0x5')]=0x1;this[_0xc330('0x6')]=![];this[_0xc330('0x7')]=null;this[_0xc330('0x8')]=![];this[_0xc330('0x9')]=null;this['queuecallerexit']=![];this['queuecallerexitAt']=null;this[_0xc330('0xa')]=0x1;this[_0xc330('0xb')]='';this[_0xc330('0xc')]='';this[_0xc330('0xd')]='';this[_0xc330('0xe')]='';this[_0xc330('0xf')]='';this[_0xc330('0x10')]='';this['priority']='';this[_0xc330('0x11')]=0x0;this[_0xc330('0x12')]=![];this[_0xc330('0x13')]='';this[_0xc330('0x14')]=_0xc330('0x15');this[_0xc330('0x16')]=null;this[_0xc330('0x17')]=0x0;this[_0xc330('0x18')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0x8bb2=['queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','holdtime','assigned','lastAssignedTo','mohtime','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','position','count'];(function(_0xcba6fd,_0x1182bb){var _0xe4636d=function(_0x1ade4e){while(--_0x1ade4e){_0xcba6fd['push'](_0xcba6fd['shift']());}};_0xe4636d(++_0x1182bb);}(_0x8bb2,0x1eb));var _0x28bb=function(_0x15d18f,_0x126b0e){_0x15d18f=_0x15d18f-0x0;var _0xd12bf7=_0x8bb2[_0x15d18f];return _0xd12bf7;};'use strict';function QueueReport(){this[_0x28bb('0x0')]=_0x28bb('0x1');this[_0x28bb('0x2')]='';this[_0x28bb('0x3')]='';this[_0x28bb('0x4')]='';this[_0x28bb('0x5')]='';this[_0x28bb('0x6')]=null;this['queuecallerleaveAt']=null;this[_0x28bb('0x7')]=0x1;this[_0x28bb('0x8')]=0x1;this[_0x28bb('0x9')]=![];this['queuecallerabandonAt']=null;this[_0x28bb('0xa')]=![];this[_0x28bb('0xb')]=null;this[_0x28bb('0xc')]=![];this[_0x28bb('0xd')]=null;this[_0x28bb('0xe')]=0x1;this[_0x28bb('0xf')]='';this[_0x28bb('0x10')]='';this[_0x28bb('0x11')]='';this[_0x28bb('0x12')]='';this[_0x28bb('0x13')]='';this['exten']='';this['priority']='';this[_0x28bb('0x14')]=0x0;this[_0x28bb('0x15')]=![];this[_0x28bb('0x16')]='';this['motionChannel']='voice';this['routealias']=null;this[_0x28bb('0x17')]=0x0;this['variables']={};}module[_0x28bb('0x18')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 877983a..a1991e7 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 _0xda20=['integrationTab','serverUrl','Configurations','name','remoteUri','password','clientId','clientSecret','securityToken','type'];(function(_0x2dfdf0,_0x35d8f5){var _0x59f817=function(_0x255ece){while(--_0x255ece){_0x2dfdf0['push'](_0x2dfdf0['shift']());}};_0x59f817(++_0x35d8f5);}(_0xda20,0x1d9));var _0x0da2=function(_0x946632,_0x155556){_0x946632=_0x946632-0x0;var _0x115582=_0xda20[_0x946632];return _0x115582;};'use strict';function SalesforceAccount(_0xf3cc69){this['id']=_0xf3cc69['id']||0x0;this['name']=_0xf3cc69[_0x0da2('0x0')]||'';this['username']=_0xf3cc69['username']||'';this[_0x0da2('0x1')]=_0xf3cc69['remoteUri']||'';this[_0x0da2('0x2')]=_0xf3cc69[_0x0da2('0x2')]||'';this['clientId']=_0xf3cc69[_0x0da2('0x3')]||'';this[_0x0da2('0x4')]=_0xf3cc69['clientSecret']||'';this[_0x0da2('0x5')]=_0xf3cc69[_0x0da2('0x5')]||'';this[_0x0da2('0x6')]=_0xf3cc69[_0x0da2('0x6')]||_0x0da2('0x7');this[_0x0da2('0x8')]=_0xf3cc69[_0x0da2('0x8')]||'';this[_0x0da2('0x9')]=_0xf3cc69[_0x0da2('0x9')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0x9ad7=['name','username','remoteUri','password','clientId','clientSecret','securityToken','type','serverUrl','Configurations','exports'];(function(_0x4cfd4e,_0x54a832){var _0x47df9c=function(_0x20d03b){while(--_0x20d03b){_0x4cfd4e['push'](_0x4cfd4e['shift']());}};_0x47df9c(++_0x54a832);}(_0x9ad7,0x84));var _0x79ad=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0x9ad7[_0x2faddb];return _0x273c05;};'use strict';function SalesforceAccount(_0x2c80b4){this['id']=_0x2c80b4['id']||0x0;this[_0x79ad('0x0')]=_0x2c80b4[_0x79ad('0x0')]||'';this['username']=_0x2c80b4[_0x79ad('0x1')]||'';this[_0x79ad('0x2')]=_0x2c80b4[_0x79ad('0x2')]||'';this[_0x79ad('0x3')]=_0x2c80b4[_0x79ad('0x3')]||'';this[_0x79ad('0x4')]=_0x2c80b4[_0x79ad('0x4')]||'';this[_0x79ad('0x5')]=_0x2c80b4['clientSecret']||'';this[_0x79ad('0x6')]=_0x2c80b4[_0x79ad('0x6')]||'';this[_0x79ad('0x7')]=_0x2c80b4[_0x79ad('0x7')]||'integrationTab';this[_0x79ad('0x8')]=_0x2c80b4['serverUrl']||'';this['Configurations']=_0x2c80b4[_0x79ad('0x9')]||{};}module[_0x79ad('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index a58f2f7..5389a99 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 _0xfb97=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x28258a,_0x22f398){var _0x4e968e=function(_0xda8c73){while(--_0xda8c73){_0x28258a['push'](_0x28258a['shift']());}};_0x4e968e(++_0x22f398);}(_0xfb97,0x80));var _0x7fb9=function(_0x263999,_0x477176){_0x263999=_0x263999-0x0;var _0x336996=_0xfb97[_0x263999];return _0x336996;};'use strict';function ServicenowAccount(_0x2b7360){this['id']=_0x2b7360['id']||0x0;this[_0x7fb9('0x0')]=_0x2b7360['name']||'';this[_0x7fb9('0x1')]=_0x2b7360[_0x7fb9('0x1')]||'';this[_0x7fb9('0x2')]=_0x2b7360[_0x7fb9('0x2')]||'';this[_0x7fb9('0x3')]=_0x2b7360[_0x7fb9('0x3')]||'';this['serverUrl']=_0x2b7360[_0x7fb9('0x4')]||'';this[_0x7fb9('0x5')]=_0x2b7360[_0x7fb9('0x5')]||{};}module[_0x7fb9('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x7934=['serverUrl','Configurations','name','remoteUri'];(function(_0x30ff7c,_0x4d51b5){var _0x5583c2=function(_0x19f954){while(--_0x19f954){_0x30ff7c['push'](_0x30ff7c['shift']());}};_0x5583c2(++_0x4d51b5);}(_0x7934,0x136));var _0x4793=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7934[_0x3dd15e];return _0x231fd0;};'use strict';function ServicenowAccount(_0x23929e){this['id']=_0x23929e['id']||0x0;this[_0x4793('0x0')]=_0x23929e[_0x4793('0x0')]||'';this['username']=_0x23929e['username']||'';this['password']=_0x23929e['password']||'';this[_0x4793('0x1')]=_0x23929e['remoteUri']||'';this[_0x4793('0x2')]=_0x23929e[_0x4793('0x2')]||'';this[_0x4793('0x3')]=_0x23929e['Configurations']||{};}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 7fcdd7c..afcbe0c 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 _0x7692=['name','username','remoteUri','serverUrl','Configurations','exports'];(function(_0x2749fa,_0x53489d){var _0x5293c9=function(_0x3e640e){while(--_0x3e640e){_0x2749fa['push'](_0x2749fa['shift']());}};_0x5293c9(++_0x53489d);}(_0x7692,0x84));var _0x2769=function(_0x329664,_0x130748){_0x329664=_0x329664-0x0;var _0x4e346e=_0x7692[_0x329664];return _0x4e346e;};'use strict';function SugarcrmAccount(_0x420a60){this['id']=_0x420a60['id']||0x0;this[_0x2769('0x0')]=_0x420a60[_0x2769('0x0')]||'';this[_0x2769('0x1')]=_0x420a60[_0x2769('0x1')]||'';this['password']=_0x420a60['password']||'';this[_0x2769('0x2')]=_0x420a60['remoteUri']||'';this['serverUrl']=_0x420a60[_0x2769('0x3')]||'';this['Configurations']=_0x420a60[_0x2769('0x4')]||{};}module[_0x2769('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0x8c31=['serverUrl','Configurations','name','username','password','remoteUri'];(function(_0x15b857,_0x585007){var _0x22539c=function(_0x47f394){while(--_0x47f394){_0x15b857['push'](_0x15b857['shift']());}};_0x22539c(++_0x585007);}(_0x8c31,0x98));var _0x18c3=function(_0x582a0b,_0x1e18eb){_0x582a0b=_0x582a0b-0x0;var _0x4722b1=_0x8c31[_0x582a0b];return _0x4722b1;};'use strict';function SugarcrmAccount(_0x57abc5){this['id']=_0x57abc5['id']||0x0;this[_0x18c3('0x0')]=_0x57abc5['name']||'';this[_0x18c3('0x1')]=_0x57abc5[_0x18c3('0x1')]||'';this[_0x18c3('0x2')]=_0x57abc5[_0x18c3('0x2')]||'';this[_0x18c3('0x3')]=_0x57abc5['remoteUri']||'';this[_0x18c3('0x4')]=_0x57abc5['serverUrl']||'';this[_0x18c3('0x5')]=_0x57abc5[_0x18c3('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 63618d7..a1fb513 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 _0x16a3=['name','accountcode','state','unknown','stateTime','status','address','exports'];(function(_0xe68d05,_0x136197){var _0x246a24=function(_0x4c131f){while(--_0x4c131f){_0xe68d05['push'](_0xe68d05['shift']());}};_0x246a24(++_0x136197);}(_0x16a3,0x1e0));var _0x316a=function(_0x213933,_0x5f2ae8){_0x213933=_0x213933-0x0;var _0x39a46c=_0x16a3[_0x213933];return _0x39a46c;};'use strict';function Telephone(_0x2d574f){this['id']=_0x2d574f['id']||0x0;this['name']=_0x2d574f[_0x316a('0x0')]||'';this[_0x316a('0x1')]=_0x2d574f[_0x316a('0x1')]||'';this[_0x316a('0x2')]=_0x316a('0x3');this[_0x316a('0x4')]=0x0;this[_0x316a('0x5')]=_0x316a('0x3');this[_0x316a('0x6')]='';}module[_0x316a('0x7')]=Telephone; \ No newline at end of file +var _0xaf5c=['unknown','stateTime','exports','name','accountcode'];(function(_0x5389f7,_0x3df777){var _0x5df410=function(_0x2cb63a){while(--_0x2cb63a){_0x5389f7['push'](_0x5389f7['shift']());}};_0x5df410(++_0x3df777);}(_0xaf5c,0x161));var _0xcaf5=function(_0x44e831,_0x57b327){_0x44e831=_0x44e831-0x0;var _0x4115f5=_0xaf5c[_0x44e831];return _0x4115f5;};'use strict';function Telephone(_0x19b32a){this['id']=_0x19b32a['id']||0x0;this[_0xcaf5('0x0')]=_0x19b32a[_0xcaf5('0x0')]||'';this[_0xcaf5('0x1')]=_0x19b32a[_0xcaf5('0x1')]||'';this['state']=_0xcaf5('0x2');this[_0xcaf5('0x3')]=0x0;this['status']=_0xcaf5('0x2');this['address']='';}module[_0xcaf5('0x4')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 951ec0a..8669e11 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','html'];(function(_0x5070ce,_0x5b8e90){var _0x5ce119=function(_0x5d36bd){while(--_0x5d36bd){_0x5070ce['push'](_0x5070ce['shift']());}};_0x5ce119(++_0x5b8e90);}(_0xb10b,0x12a));var _0xbb10=function(_0x3cdfdb,_0x40545d){_0x3cdfdb=_0x3cdfdb-0x0;var _0x57d4d8=_0xb10b[_0x3cdfdb];return _0x57d4d8;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x1adc73,_0x2f28c1){var _0x371a7f=function(_0x771bb1){while(--_0x771bb1){_0x1adc73['push'](_0x1adc73['shift']());}};_0x371a7f(++_0x2f28c1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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 40b6526..d902b1b 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 _0xbaf0=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x59eefb,_0x2151ce){var _0x1a49e8=function(_0x5a758c){while(--_0x5a758c){_0x59eefb['push'](_0x59eefb['shift']());}};_0x1a49e8(++_0x2151ce);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';function Trigger(_0x61caa9){this['id']=_0x61caa9['id']||0x0;this[_0x0baf('0x0')]=_0x61caa9[_0x0baf('0x0')]||'';this[_0x0baf('0x1')]=_0x61caa9[_0x0baf('0x1')]||_0x0baf('0x2');this[_0x0baf('0x3')]=_0x61caa9['status']||![];this[_0x0baf('0x4')]=_0x61caa9[_0x0baf('0x4')]||[];this[_0x0baf('0x5')]=_0x61caa9[_0x0baf('0x5')]||[];this[_0x0baf('0x6')]=_0x61caa9[_0x0baf('0x6')]||[];}module[_0x0baf('0x7')]=Trigger; \ No newline at end of file +var _0x757a=['name','status','AllConditions','AnyConditions','Actions','exports'];(function(_0x152680,_0xb14bfb){var _0x5df32d=function(_0x4232f7){while(--_0x4232f7){_0x152680['push'](_0x152680['shift']());}};_0x5df32d(++_0xb14bfb);}(_0x757a,0xde));var _0xa757=function(_0xd601d4,_0x527684){_0xd601d4=_0xd601d4-0x0;var _0xdccdd0=_0x757a[_0xd601d4];return _0xdccdd0;};'use strict';function Trigger(_0x1acf7d){this['id']=_0x1acf7d['id']||0x0;this[_0xa757('0x0')]=_0x1acf7d[_0xa757('0x0')]||'';this['channel']=_0x1acf7d['channel']||'voice';this[_0xa757('0x1')]=_0x1acf7d[_0xa757('0x1')]||![];this[_0xa757('0x2')]=_0x1acf7d[_0xa757('0x2')]||[];this[_0xa757('0x3')]=_0x1acf7d[_0xa757('0x3')]||[];this['Actions']=_0x1acf7d[_0xa757('0x4')]||[];}module[_0xa757('0x5')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index d96967b..6aa18b8 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 _0xb76d=['state','unknown','stateTime','status','registry','indexOf','split','port','domain','domainport','refresh','registrationtime','address','defaultuser','exports','active','name'];(function(_0x4c0c9d,_0x186718){var _0x14c770=function(_0x55631d){while(--_0x55631d){_0x4c0c9d['push'](_0x4c0c9d['shift']());}};_0x14c770(++_0x186718);}(_0xb76d,0x1a7));var _0xdb76=function(_0x1a7408,_0xe4e2c){_0x1a7408=_0x1a7408-0x0;var _0x9fa7db=_0xb76d[_0x1a7408];return _0x9fa7db;};'use strict';function Trunk(_0x1e8a9e){this['id']=_0x1e8a9e['id']||0x0;this['active']=_0x1e8a9e[_0xdb76('0x0')]||![];this[_0xdb76('0x1')]=_0x1e8a9e[_0xdb76('0x1')]||'';this[_0xdb76('0x2')]=_0xdb76('0x3');this[_0xdb76('0x4')]=0x0;this[_0xdb76('0x5')]=_0xdb76('0x3');this[_0xdb76('0x6')]=_0x1e8a9e[_0xdb76('0x6')]&&_0x1e8a9e['registry'][_0xdb76('0x7')](':')?_0x1e8a9e[_0xdb76('0x6')][_0xdb76('0x8')](':')[0x0]:'';this['host']='';this[_0xdb76('0x9')]='';this[_0xdb76('0xa')]='';this[_0xdb76('0xb')]='';this[_0xdb76('0xc')]='';this['stateRegistry']='unknown';this[_0xdb76('0xd')]='';this[_0xdb76('0xe')]='';this[_0xdb76('0xf')]=_0x1e8a9e['defaultuser']||'';}module[_0xdb76('0x10')]=Trunk; \ No newline at end of file +var _0xe4a2=['registrationtime','address','defaultuser','exports','active','name','unknown','registry','indexOf','split','port','domainport','refresh','stateRegistry'];(function(_0x1e3c54,_0x2914a3){var _0x4abb45=function(_0x218bba){while(--_0x218bba){_0x1e3c54['push'](_0x1e3c54['shift']());}};_0x4abb45(++_0x2914a3);}(_0xe4a2,0x17e));var _0x2e4a=function(_0x3ecb38,_0x251320){_0x3ecb38=_0x3ecb38-0x0;var _0x256efc=_0xe4a2[_0x3ecb38];return _0x256efc;};'use strict';function Trunk(_0x1ff75b){this['id']=_0x1ff75b['id']||0x0;this[_0x2e4a('0x0')]=_0x1ff75b['active']||![];this['name']=_0x1ff75b[_0x2e4a('0x1')]||'';this['state']=_0x2e4a('0x2');this['stateTime']=0x0;this['status']=_0x2e4a('0x2');this[_0x2e4a('0x3')]=_0x1ff75b[_0x2e4a('0x3')]&&_0x1ff75b['registry'][_0x2e4a('0x4')](':')?_0x1ff75b[_0x2e4a('0x3')][_0x2e4a('0x5')](':')[0x0]:'';this['host']='';this[_0x2e4a('0x6')]='';this['domain']='';this[_0x2e4a('0x7')]='';this[_0x2e4a('0x8')]='';this[_0x2e4a('0x9')]='unknown';this[_0x2e4a('0xa')]='';this[_0x2e4a('0xb')]='';this[_0x2e4a('0xc')]=_0x1ff75b[_0x2e4a('0xc')]||'';}module[_0x2e4a('0xd')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index d70409a..b8243fd 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 _0x1d3f=['exten','recordingFormat','none','mandatoryDisposition'];(function(_0x179e11,_0xf65436){var _0x549f04=function(_0x610545){while(--_0x610545){_0x179e11['push'](_0x179e11['shift']());}};_0x549f04(++_0xf65436);}(_0x1d3f,0xa8));var _0xf1d3=function(_0x55f95a,_0x28c042){_0x55f95a=_0x55f95a-0x0;var _0x13e20f=_0x1d3f[_0x55f95a];return _0x13e20f;};'use strict';function voiceExtension(_0x7f0cf1){this['id']=_0x7f0cf1['id']||0x0;this['exten']=_0x7f0cf1[_0xf1d3('0x0')]||'';this[_0xf1d3('0x1')]=_0x7f0cf1[_0xf1d3('0x1')]||_0xf1d3('0x2');this[_0xf1d3('0x3')]=_0x7f0cf1[_0xf1d3('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0xcf70=['exten','recordingFormat','none','mandatoryDisposition','exports'];(function(_0x29ec93,_0x925ab2){var _0x938db3=function(_0x345d3a){while(--_0x345d3a){_0x29ec93['push'](_0x29ec93['shift']());}};_0x938db3(++_0x925ab2);}(_0xcf70,0x1cc));var _0x0cf7=function(_0x131f2f,_0x5158e1){_0x131f2f=_0x131f2f-0x0;var _0x8b2a79=_0xcf70[_0x131f2f];return _0x8b2a79;};'use strict';function voiceExtension(_0xab270d){this['id']=_0xab270d['id']||0x0;this['exten']=_0xab270d[_0x0cf7('0x0')]||'';this[_0x0cf7('0x1')]=_0xab270d[_0x0cf7('0x1')]||_0x0cf7('0x2');this[_0x0cf7('0x3')]=_0xab270d[_0x0cf7('0x3')]||![];}module[_0x0cf7('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 37c3c0c..2adbc17 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 _0x21ec=['notInUse','paused','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','statusMessage','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','monitor_format','mandatoryDispositionPause','queueSummaryCountersUpdated','gsm','fewestcalls','random','ringall','rrmemory','wrandom','name','inbound','waiting','total','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','available','busy','invalid','loggedIn'];(function(_0x2ea231,_0x373a5d){var _0x28a7d2=function(_0x2207e3){while(--_0x2207e3){_0x2ea231['push'](_0x2ea231['shift']());}};_0x28a7d2(++_0x373a5d);}(_0x21ec,0xf1));var _0xc21e=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0x21ec[_0x39c734];return _0xb2a2f9;};'use strict';var monitorFormat={'wav':'wav','wav49':'wav49','gsm':_0xc21e('0x0')};var strategy={'fewestcalls':_0xc21e('0x1'),'leastrecent':'leastrecent','linear':'linear','random':_0xc21e('0x2'),'ringall':_0xc21e('0x3'),'rr':'roundrobin','rrmemory':_0xc21e('0x4'),'rrordered':'rrordered','wrandom':_0xc21e('0x5')};function VoiceQueue(_0x4b0e4c){this['id']=_0x4b0e4c['id']||0x0;this[_0xc21e('0x6')]=_0x4b0e4c[_0xc21e('0x6')]||'';this['monitor_format']=_0x4b0e4c['monitor_format']||'';this['type']=_0x4b0e4c['type']||_0xc21e('0x7');this[_0xc21e('0x8')]=0x0;this[_0xc21e('0x9')]=0x0;this['answered']=0x0;this[_0xc21e('0xa')]=0x0;this[_0xc21e('0xb')]=0x0;this[_0xc21e('0xc')]=0x0;this[_0xc21e('0xd')]=0x0;this[_0xc21e('0xe')]=0x0;this[_0xc21e('0xf')]=0x0;this[_0xc21e('0x10')]=0x0;this['inUse']=0x0;this[_0xc21e('0x11')]=0x0;this[_0xc21e('0x12')]=0x0;this[_0xc21e('0x13')]=0x0;this['onHold']=0x0;this[_0xc21e('0x14')]=0x0;this['ringing']=0x0;this[_0xc21e('0x15')]=0x0;this[_0xc21e('0x16')]=0x0;this[_0xc21e('0x17')]=0x0;this[_0xc21e('0x18')]=0x0;this['acw']=_0x4b0e4c[_0xc21e('0x19')]||![];this[_0xc21e('0x1a')]=_0x4b0e4c[_0xc21e('0x1a')]||0xa;this[_0xc21e('0x1b')]=_0x4b0e4c[_0xc21e('0x1b')]||'no';this[_0xc21e('0x1c')]=!![];this['message']='';this[_0xc21e('0x1d')]='';this['originated']=0x0;this[_0xc21e('0x1e')]=0x0;this[_0xc21e('0x1f')]=_0x4b0e4c[_0xc21e('0x1f')]||null;this[_0xc21e('0x20')]=_0x4b0e4c[_0xc21e('0x20')]?_0x4b0e4c[_0xc21e('0x20')]:null;this[_0xc21e('0x21')]=_0x4b0e4c[_0xc21e('0x21')];this[_0xc21e('0x22')]=_0x4b0e4c[_0xc21e('0x22')]||_0xc21e('0x23');this[_0xc21e('0x24')]=_0x4b0e4c['dialLimitChannel']||0x0;this[_0xc21e('0x25')]=_0x4b0e4c['dialLimitQueue']||0x0;this[_0xc21e('0x26')]=_0x4b0e4c[_0xc21e('0x26')]||0x1;this[_0xc21e('0x27')]=_0x4b0e4c['dialPredictiveOptimization']||_0xc21e('0x28');this[_0xc21e('0x29')]=_0x4b0e4c[_0xc21e('0x29')]||0.03;this[_0xc21e('0x2a')]=_0x4b0e4c[_0xc21e('0x2a')]||0x258;this[_0xc21e('0x2b')]=_0x4b0e4c[_0xc21e('0x2b')]||'anonymous';this[_0xc21e('0x2c')]=_0x4b0e4c[_0xc21e('0x2c')]||_0xc21e('0x2d');this[_0xc21e('0x2e')]=_0x4b0e4c[_0xc21e('0x2e')]||0x1e;this[_0xc21e('0x2f')]=_0x4b0e4c[_0xc21e('0x2f')]||_0xc21e('0x30');this[_0xc21e('0x31')]=_0x4b0e4c[_0xc21e('0x31')]||0x3;this[_0xc21e('0x32')]=_0x4b0e4c[_0xc21e('0x32')]||undefined;this['dialCongestionMaxRetry']=_0x4b0e4c[_0xc21e('0x33')]||0x3;this[_0xc21e('0x34')]=_0x4b0e4c[_0xc21e('0x34')]||0x96;this[_0xc21e('0x35')]=_0x4b0e4c[_0xc21e('0x35')]||0x3;this[_0xc21e('0x36')]=_0x4b0e4c[_0xc21e('0x36')]||0x96;this['dialNoAnswerMaxRetry']=_0x4b0e4c[_0xc21e('0x37')]||0x3;this[_0xc21e('0x38')]=_0x4b0e4c['dialNoAnswerRetryFrequency']||0x96;this[_0xc21e('0x39')]=_0x4b0e4c[_0xc21e('0x39')]||0x3;this[_0xc21e('0x3a')]=_0x4b0e4c[_0xc21e('0x3a')]||0x96;this[_0xc21e('0x3b')]=_0x4b0e4c[_0xc21e('0x3b')]||0x3;this[_0xc21e('0x3c')]=_0x4b0e4c[_0xc21e('0x3c')]||0x96;this[_0xc21e('0x3d')]=_0x4b0e4c[_0xc21e('0x3d')]||0x3;this[_0xc21e('0x3e')]=_0x4b0e4c[_0xc21e('0x3e')]||0x96;this[_0xc21e('0x3f')]=_0x4b0e4c['dialMachineMaxRetry']||0x3;this[_0xc21e('0x40')]=_0x4b0e4c[_0xc21e('0x40')]||0x96;this[_0xc21e('0x41')]=_0x4b0e4c[_0xc21e('0x41')]||0x3;this['dialAgentRejectRetryFrequency']=_0x4b0e4c[_0xc21e('0x42')]||0x96;this[_0xc21e('0x43')]=_0x4b0e4c[_0xc21e('0x43')]||0x3;this[_0xc21e('0x44')]=_0x4b0e4c[_0xc21e('0x44')]||0x4;this['Trunk']=_0x4b0e4c['Trunk']?_0x4b0e4c['Trunk']:undefined;this[_0xc21e('0x45')]=_0x4b0e4c['TrunkBackup']?_0x4b0e4c['TrunkBackup']:undefined;this[_0xc21e('0x46')]=_0x4b0e4c[_0xc21e('0x46')]||undefined;this[_0xc21e('0x47')]=_0x4b0e4c[_0xc21e('0x47')]?_0x4b0e4c[_0xc21e('0x47')]:undefined;this[_0xc21e('0x48')]=_0x4b0e4c[_0xc21e('0x48')]||_0xc21e('0x49');this['dialRandomLastDigitCallerIdNumber']=_0x4b0e4c[_0xc21e('0x4a')]||undefined;this[_0xc21e('0x4b')]=_0x4b0e4c['dialCutDigit']||undefined;this[_0xc21e('0x4c')]=strategy[_0x4b0e4c['strategy']];this['queueStatusComplete']=!![];this[_0xc21e('0x4d')]=_0x4b0e4c[_0xc21e('0x4d')]||![];this[_0xc21e('0x4e')]=_0x4b0e4c[_0xc21e('0x4e')];this[_0xc21e('0x4f')]=_0x4b0e4c[_0xc21e('0x4f')];this[_0xc21e('0x50')]=_0x4b0e4c['dialAMDAfterGreetingSilence'];this[_0xc21e('0x51')]=_0x4b0e4c[_0xc21e('0x51')];this[_0xc21e('0x52')]=_0x4b0e4c['dialAMDMinWordLength'];this[_0xc21e('0x53')]=_0x4b0e4c[_0xc21e('0x53')];this[_0xc21e('0x54')]=_0x4b0e4c[_0xc21e('0x54')];this[_0xc21e('0x55')]=_0x4b0e4c['dialAMDSilenceThreshold'];this[_0xc21e('0x56')]=_0x4b0e4c[_0xc21e('0x56')];this[_0xc21e('0x57')]=0x0;this[_0xc21e('0x58')]=0x0;this[_0xc21e('0x59')]=_0x4b0e4c[_0xc21e('0x59')];this[_0xc21e('0x5a')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0xc21e('0x5b')]=0x0;this[_0xc21e('0x5c')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0xc21e('0x5d')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0xc21e('0x5e')]=0x0;this[_0xc21e('0x5f')]=0x0;this[_0xc21e('0x60')]=0x0;this[_0xc21e('0x61')]=0x0;this[_0xc21e('0x62')]=0x0;this[_0xc21e('0x63')]=0x0;this[_0xc21e('0x64')]=0x0;this[_0xc21e('0x65')]=undefined;this[_0xc21e('0x66')]=undefined;this[_0xc21e('0x67')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0xc21e('0x68')]=0x0;this[_0xc21e('0x69')]=0x0;this[_0xc21e('0x6a')]=0x0;this[_0xc21e('0x6b')]=0x0;this[_0xc21e('0x6c')]=0x0;this[_0xc21e('0x6d')]=0x0;this[_0xc21e('0x6e')]=0x0;this[_0xc21e('0x6f')]=0x0;this[_0xc21e('0x70')]=_0x4b0e4c[_0xc21e('0x71')]||0x14;this['predictiveIntervalMinThreshold']=_0x4b0e4c[_0xc21e('0x71')]||0xa;this[_0xc21e('0x72')]=0x0;this[_0xc21e('0x73')]=0x0;this[_0xc21e('0x74')]=0x1;this[_0xc21e('0x75')]=0x0;this[_0xc21e('0x76')]=0x0;this[_0xc21e('0x77')]=0x0;this['erlangBusyFactor']=0x0;this['dialRecallMeTimeout']=_0x4b0e4c[_0xc21e('0x78')]||0x1e;this[_0xc21e('0x79')]=_0x4b0e4c[_0xc21e('0x79')]||![];this[_0xc21e('0x7a')]=!!_0x4b0e4c[_0xc21e('0x7a')]||![];this[_0xc21e('0x7b')]=!!_0x4b0e4c['dialPreviewRecallmeReminder']||![];this['dialQueueProject2']=_0x4b0e4c[_0xc21e('0x7c')]||undefined;this[_0xc21e('0x7d')]=_0x4b0e4c[_0xc21e('0x7d')]||![];this[_0xc21e('0x7e')]=_0x4b0e4c['dialAgiAfterHangupAgent']||![];this[_0xc21e('0x7f')]=monitorFormat[_0x4b0e4c[_0xc21e('0x7f')]]?monitorFormat[_0x4b0e4c['monitor_format']]:undefined;this['mandatoryDisposition']=_0x4b0e4c['mandatoryDisposition']||![];this['mandatoryDispositionPause']=_0x4b0e4c[_0xc21e('0x80')]?_0x4b0e4c[_0xc21e('0x80')]:undefined;this[_0xc21e('0x81')]=![];}module['exports']=VoiceQueue; \ No newline at end of file +var _0xe57d=['dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','monitor_format','mandatoryDisposition','mandatoryDispositionPause','exports','wav','gsm','fewestcalls','random','ringall','roundrobin','rrordered','name','type','inbound','waiting','total','sumDuration','sumBillable','unmanaged','abandoned','available','onHold','paused','ringing','ringInUse','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone'];(function(_0x4c1917,_0xea7b6c){var _0x220fa5=function(_0x3087ff){while(--_0x3087ff){_0x4c1917['push'](_0x4c1917['shift']());}};_0x220fa5(++_0xea7b6c);}(_0xe57d,0xd7));var _0xde57=function(_0x309d93,_0x157662){_0x309d93=_0x309d93-0x0;var _0x2dd61d=_0xe57d[_0x309d93];return _0x2dd61d;};'use strict';var monitorFormat={'wav':_0xde57('0x0'),'wav49':'wav49','gsm':_0xde57('0x1')};var strategy={'fewestcalls':_0xde57('0x2'),'leastrecent':'leastrecent','linear':'linear','random':_0xde57('0x3'),'ringall':_0xde57('0x4'),'rr':_0xde57('0x5'),'rrmemory':'rrmemory','rrordered':_0xde57('0x6'),'wrandom':'wrandom'};function VoiceQueue(_0x3aae1b){this['id']=_0x3aae1b['id']||0x0;this[_0xde57('0x7')]=_0x3aae1b[_0xde57('0x7')]||'';this['monitor_format']=_0x3aae1b['monitor_format']||'';this[_0xde57('0x8')]=_0x3aae1b['type']||_0xde57('0x9');this[_0xde57('0xa')]=0x0;this[_0xde57('0xb')]=0x0;this['answered']=0x0;this[_0xde57('0xc')]=0x0;this['sumHoldTime']=0x0;this[_0xde57('0xd')]=0x0;this[_0xde57('0xe')]=0x0;this[_0xde57('0xf')]=0x0;this[_0xde57('0x10')]=0x0;this['busy']=0x0;this['inUse']=0x0;this['invalid']=0x0;this['loggedIn']=0x0;this['notInUse']=0x0;this[_0xde57('0x11')]=0x0;this[_0xde57('0x12')]=0x0;this[_0xde57('0x13')]=0x0;this[_0xde57('0x14')]=0x0;this['talking']=0x0;this[_0xde57('0x15')]=0x0;this[_0xde57('0x16')]=0x0;this[_0xde57('0x17')]=_0x3aae1b[_0xde57('0x17')]||![];this[_0xde57('0x18')]=_0x3aae1b['acwTimeout']||0xa;this[_0xde57('0x19')]=_0x3aae1b[_0xde57('0x19')]||'no';this[_0xde57('0x1a')]=!![];this[_0xde57('0x1b')]='';this['statusMessage']='';this[_0xde57('0x1c')]=0x0;this[_0xde57('0x1d')]=0x0;this[_0xde57('0x1e')]=_0x3aae1b['dialTimezone']||null;this['dialGlobalInterval']=_0x3aae1b[_0xde57('0x1f')]?_0x3aae1b['dialGlobalInterval']:null;this[_0xde57('0x20')]=_0x3aae1b[_0xde57('0x20')];this[_0xde57('0x21')]=_0x3aae1b[_0xde57('0x21')]||_0xde57('0x22');this[_0xde57('0x23')]=_0x3aae1b['dialLimitChannel']||0x0;this[_0xde57('0x24')]=_0x3aae1b[_0xde57('0x24')]||0x0;this[_0xde57('0x25')]=_0x3aae1b['dialPowerLevel']||0x1;this[_0xde57('0x26')]=_0x3aae1b['dialPredictiveOptimization']||_0xde57('0x27');this[_0xde57('0x28')]=_0x3aae1b[_0xde57('0x28')]||0.03;this[_0xde57('0x29')]=_0x3aae1b[_0xde57('0x29')]||0x258;this[_0xde57('0x2a')]=_0x3aae1b['dialOriginateCallerIdName']||_0xde57('0x2b');this['dialOriginateCallerIdNumber']=_0x3aae1b['dialOriginateCallerIdNumber']||'anonymous';this[_0xde57('0x2c')]=_0x3aae1b[_0xde57('0x2c')]||0x1e;this[_0xde57('0x2d')]=_0x3aae1b[_0xde57('0x2d')]||'tTxX';this[_0xde57('0x2e')]=_0x3aae1b[_0xde57('0x2e')]||0x3;this[_0xde57('0x2f')]=_0x3aae1b['dialQueueProject']||undefined;this[_0xde57('0x30')]=_0x3aae1b['dialCongestionMaxRetry']||0x3;this[_0xde57('0x31')]=_0x3aae1b[_0xde57('0x31')]||0x96;this[_0xde57('0x32')]=_0x3aae1b[_0xde57('0x32')]||0x3;this[_0xde57('0x33')]=_0x3aae1b[_0xde57('0x33')]||0x96;this[_0xde57('0x34')]=_0x3aae1b[_0xde57('0x34')]||0x3;this[_0xde57('0x35')]=_0x3aae1b[_0xde57('0x35')]||0x96;this[_0xde57('0x36')]=_0x3aae1b['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x3aae1b[_0xde57('0x37')]||0x96;this[_0xde57('0x38')]=_0x3aae1b[_0xde57('0x38')]||0x3;this[_0xde57('0x39')]=_0x3aae1b['dialDropRetryFrequency']||0x96;this[_0xde57('0x3a')]=_0x3aae1b[_0xde57('0x3a')]||0x3;this[_0xde57('0x3b')]=_0x3aae1b[_0xde57('0x3b')]||0x96;this['dialMachineMaxRetry']=_0x3aae1b['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x3aae1b[_0xde57('0x3c')]||0x96;this[_0xde57('0x3d')]=_0x3aae1b[_0xde57('0x3d')]||0x3;this[_0xde57('0x3e')]=_0x3aae1b[_0xde57('0x3e')]||0x96;this[_0xde57('0x3f')]=_0x3aae1b[_0xde57('0x3f')]||0x3;this[_0xde57('0x40')]=_0x3aae1b['dialGlobalMaxRetry']||0x4;this[_0xde57('0x41')]=_0x3aae1b['Trunk']?_0x3aae1b[_0xde57('0x41')]:undefined;this[_0xde57('0x42')]=_0x3aae1b[_0xde57('0x42')]?_0x3aae1b[_0xde57('0x42')]:undefined;this[_0xde57('0x43')]=_0x3aae1b[_0xde57('0x43')]||undefined;this[_0xde57('0x44')]=_0x3aae1b[_0xde57('0x44')]?_0x3aae1b[_0xde57('0x44')]:undefined;this[_0xde57('0x45')]=_0x3aae1b[_0xde57('0x45')]||'DESC';this[_0xde57('0x46')]=_0x3aae1b[_0xde57('0x46')]||undefined;this[_0xde57('0x47')]=_0x3aae1b['dialCutDigit']||undefined;this[_0xde57('0x48')]=strategy[_0x3aae1b[_0xde57('0x48')]];this[_0xde57('0x49')]=!![];this[_0xde57('0x4a')]=_0x3aae1b[_0xde57('0x4a')]||![];this[_0xde57('0x4b')]=_0x3aae1b['dialAMDInitialSilence'];this[_0xde57('0x4c')]=_0x3aae1b[_0xde57('0x4c')];this[_0xde57('0x4d')]=_0x3aae1b[_0xde57('0x4d')];this['dialAMDTotalAnalysisTime']=_0x3aae1b['dialAMDTotalAnalysisTime'];this[_0xde57('0x4e')]=_0x3aae1b[_0xde57('0x4e')];this[_0xde57('0x4f')]=_0x3aae1b[_0xde57('0x4f')];this['dialAMDMaximumNumberOfWords']=_0x3aae1b[_0xde57('0x50')];this[_0xde57('0x51')]=_0x3aae1b[_0xde57('0x51')];this[_0xde57('0x52')]=_0x3aae1b[_0xde57('0x52')];this['outboundRejectCallsDay']=0x0;this[_0xde57('0x53')]=0x0;this[_0xde57('0x54')]=_0x3aae1b[_0xde57('0x54')];this[_0xde57('0x55')]=0x0;this[_0xde57('0x56')]=0x0;this[_0xde57('0x57')]=0x0;this[_0xde57('0x58')]=0x0;this[_0xde57('0x59')]=0x0;this[_0xde57('0x5a')]=0x0;this[_0xde57('0x5b')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xde57('0x5c')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0xde57('0x5d')]=0x0;this[_0xde57('0x5e')]=0x0;this[_0xde57('0x5f')]=0x0;this['startProgressive']=undefined;this[_0xde57('0x60')]=undefined;this[_0xde57('0x61')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0xde57('0x62')]=0x0;this[_0xde57('0x63')]=0x0;this[_0xde57('0x64')]=0x0;this[_0xde57('0x65')]=0x0;this[_0xde57('0x66')]=0x0;this[_0xde57('0x67')]=0x0;this[_0xde57('0x68')]=0x0;this['predictiveIntervalAvailable']=0x0;this['predictiveIntervalMaxThreshold']=_0x3aae1b[_0xde57('0x69')]||0x14;this[_0xde57('0x6a')]=_0x3aae1b[_0xde57('0x69')]||0xa;this[_0xde57('0x6b')]=0x0;this[_0xde57('0x6c')]=0x0;this[_0xde57('0x6d')]=0x1;this[_0xde57('0x6e')]=0x0;this[_0xde57('0x6f')]=0x0;this['erlangAbandonmentRate']=0x0;this['erlangBusyFactor']=0x0;this[_0xde57('0x70')]=_0x3aae1b[_0xde57('0x70')]||0x1e;this[_0xde57('0x71')]=_0x3aae1b[_0xde57('0x71')]||![];this[_0xde57('0x72')]=!!_0x3aae1b[_0xde57('0x72')]||![];this[_0xde57('0x73')]=!!_0x3aae1b['dialPreviewRecallmeReminder']||![];this[_0xde57('0x74')]=_0x3aae1b[_0xde57('0x74')]||undefined;this['dialAgiAfterHangupClient']=_0x3aae1b[_0xde57('0x75')]||![];this[_0xde57('0x76')]=_0x3aae1b[_0xde57('0x76')]||![];this[_0xde57('0x77')]=monitorFormat[_0x3aae1b['monitor_format']]?monitorFormat[_0x3aae1b[_0xde57('0x77')]]:undefined;this[_0xde57('0x78')]=_0x3aae1b['mandatoryDisposition']||![];this['mandatoryDispositionPause']=_0x3aae1b[_0xde57('0x79')]?_0x3aae1b[_0xde57('0x79')]:undefined;this['queueSummaryCountersUpdated']=![];}module[_0xde57('0x7a')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index fff3e73..50ad733 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 _0xe799=['callers','length','SIP/','online','incall','status','booked','keys','queue','xcally-motion-preview','compareToInboundQueue','some','compareToOutboundQueue','updateReportFromOutboundQueue','outboundBusyCallsDay','preview','available','loggedInDb','ringing','talking','answered','inUse','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','paused','pTalking','sumBillable','total','waiting','name','strategy','abandoned','busy','invalid','loggedIn','onHold','notInUse','ringInUse','sumDuration','sumHoldTime','type','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','unavailable','loggedin'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xe799,0x170));var _0x9e79=function(_0x55c6f7,_0x263642){_0x55c6f7=_0x55c6f7-0x0;var _0x5c513d=_0xe799[_0x55c6f7];return _0x5c513d;};'use strict';var INBOUND_COUNTERS=[_0x9e79('0x0'),'loggedIn',_0x9e79('0x1'),'paused',_0x9e79('0x2'),_0x9e79('0x3'),'waiting'];var OUTBOUND_COUNTERS=[_0x9e79('0x0'),_0x9e79('0x4'),_0x9e79('0x5'),'loggedIn',_0x9e79('0x1'),'originated',_0x9e79('0x6'),_0x9e79('0x7'),_0x9e79('0x8'),'outboundBusyCallsDay',_0x9e79('0x9'),_0x9e79('0xa'),'outboundNoSuchCallsDay',_0x9e79('0xb'),_0x9e79('0xc'),_0x9e79('0xd'),_0x9e79('0xe'),_0x9e79('0xf'),_0x9e79('0x3'),_0x9e79('0x10'),'sumDuration',_0x9e79('0x11'),_0x9e79('0x12')];function VoiceQueueSummary(_0x1e6413){this['id']=_0x1e6413['id'];this[_0x9e79('0x13')]=_0x1e6413[_0x9e79('0x13')];this['strategy']=_0x1e6413[_0x9e79('0x14')];this[_0x9e79('0x15')]=_0x1e6413[_0x9e79('0x15')]||0x0;this[_0x9e79('0x4')]=_0x1e6413[_0x9e79('0x4')]||0x0;this[_0x9e79('0x0')]=_0x1e6413[_0x9e79('0x0')]||0x0;this[_0x9e79('0x16')]=_0x1e6413[_0x9e79('0x16')]||0x0;this[_0x9e79('0x5')]=_0x1e6413[_0x9e79('0x5')]||0x0;this[_0x9e79('0x17')]=_0x1e6413['invalid']||0x0;this[_0x9e79('0x18')]=_0x1e6413['loggedIn']||0x0;this[_0x9e79('0x1')]=_0x1e6413[_0x9e79('0x1')]||0x0;this['onHold']=_0x1e6413[_0x9e79('0x19')]||0x0;this[_0x9e79('0x1a')]=_0x1e6413['notInUse']||0x0;this['paused']=_0x1e6413[_0x9e79('0xe')]||0x0;this[_0x9e79('0x2')]=_0x1e6413[_0x9e79('0x2')]||0x0;this[_0x9e79('0x1b')]=_0x1e6413[_0x9e79('0x1b')];this['sumBillable']=_0x1e6413[_0x9e79('0x10')];this[_0x9e79('0x1c')]=_0x1e6413[_0x9e79('0x1c')];this[_0x9e79('0x1d')]=_0x1e6413['sumHoldTime']||0x0;this[_0x9e79('0x3')]=_0x1e6413[_0x9e79('0x3')]||0x0;this['total']=_0x1e6413[_0x9e79('0x11')]||0x0;this[_0x9e79('0x1e')]=_0x1e6413['type'];this['unavailable']=_0x1e6413['unavailable']||0x0;this['unknown']=_0x1e6413[_0x9e79('0x1f')]||0x0;this[_0x9e79('0x20')]=_0x1e6413['unmanaged']||0x0;this[_0x9e79('0x12')]=_0x1e6413[_0x9e79('0x12')]||0x0;if(_0x1e6413[_0x9e79('0x1e')]===_0x9e79('0x21')){this['pTalking']=_0x1e6413[_0x9e79('0xf')]||0x0;this[_0x9e79('0x22')]=_0x1e6413['dialActive'];this[_0x9e79('0x23')]=_0x1e6413[_0x9e79('0x23')];this['dialOriginateCallerIdName']=_0x1e6413[_0x9e79('0x24')];this[_0x9e79('0x25')]=_0x1e6413[_0x9e79('0x25')];this[_0x9e79('0x26')]=_0x1e6413[_0x9e79('0x26')];this[_0x9e79('0x27')]=_0x1e6413['dialPrefix'];this['temp']=_0x1e6413['temp'];this[_0x9e79('0x28')]=_0x1e6413[_0x9e79('0x28')];this[_0x9e79('0x7')]=_0x1e6413[_0x9e79('0x7')];this[_0x9e79('0x8')]=_0x1e6413[_0x9e79('0x8')];this['outboundBusyCallsDay']=_0x1e6413['outboundBusyCallsDay'];this[_0x9e79('0x9')]=_0x1e6413[_0x9e79('0x9')];this['outboundDropCallsDayACS']=_0x1e6413[_0x9e79('0x29')];this[_0x9e79('0x2a')]=_0x1e6413['outboundDropCallsDayCallersExit'];this[_0x9e79('0x2b')]=_0x1e6413[_0x9e79('0x2b')];this['outboundNoAnswerCallsDay']=_0x1e6413['outboundNoAnswerCallsDay'];this[_0x9e79('0x2c')]=_0x1e6413[_0x9e79('0x2c')];this['outboundOriginateFailureCallsDay']=_0x1e6413[_0x9e79('0x2d')];this[_0x9e79('0xb')]=_0x1e6413[_0x9e79('0xb')];this[_0x9e79('0xc')]=_0x1e6413['outboundRejectCallsDay'];this[_0x9e79('0xd')]=_0x1e6413[_0x9e79('0xd')];this['predictiveIntervalAnsweredCalls']=_0x1e6413[_0x9e79('0x2e')];this[_0x9e79('0x2f')]=_0x1e6413[_0x9e79('0x2f')];this[_0x9e79('0x30')]=_0x1e6413[_0x9e79('0x30')];this[_0x9e79('0x31')]=_0x1e6413[_0x9e79('0x31')];this[_0x9e79('0x32')]=_0x1e6413['predictiveIntervalDroppedCallsTimeout'];this[_0x9e79('0x33')]=_0x1e6413['predictiveIntervalErlangCalls'];this[_0x9e79('0x34')]=_0x1e6413[_0x9e79('0x34')];this[_0x9e79('0x35')]=_0x1e6413[_0x9e79('0x35')];this['predictiveIntervalMultiplicativeFactor']=_0x1e6413[_0x9e79('0x36')];this[_0x9e79('0x37')]=_0x1e6413['predictiveIntervalPauses'];this[_0x9e79('0x38')]=_0x1e6413[_0x9e79('0x38')];this[_0x9e79('0x39')]=_0x1e6413[_0x9e79('0x39')];this[_0x9e79('0x3a')]=_0x1e6413[_0x9e79('0x3a')];this[_0x9e79('0x3b')]=_0x1e6413[_0x9e79('0x3b')];this[_0x9e79('0x3c')]=_0x1e6413[_0x9e79('0x3c')];this[_0x9e79('0x3d')]=_0x1e6413[_0x9e79('0x3d')];this[_0x9e79('0x3e')]=_0x1e6413['erlangBusyFactor'];this['startPredictive']=_0x1e6413['startPredictive'];this[_0x9e79('0x3f')]=_0x1e6413[_0x9e79('0x3f')];this['message']=_0x1e6413[_0x9e79('0x40')];this[_0x9e79('0x41')]=_0x1e6413[_0x9e79('0x41')];}if(_0x1e6413[_0x9e79('0x42')]){this[_0x9e79('0x42')]={'id':_0x1e6413['Trunk']['id'],'name':_0x1e6413['Trunk'][_0x9e79('0x13')],'active':_0x1e6413['Trunk'][_0x9e79('0x43')],'callerid':_0x1e6413[_0x9e79('0x42')][_0x9e79('0x44')]};}}VoiceQueueSummary[_0x9e79('0x45')]['createReport']=function(_0x588f0e,_0x3d8bcc,_0x29691a,_0x4cbdad){this[_0x9e79('0x1')]=0x0;this[_0x9e79('0x3')]=0x0;this[_0x9e79('0xe')]=0x0;this['unknown']=0x0;this[_0x9e79('0x1a')]=0x0;this[_0x9e79('0x5')]=0x0;this[_0x9e79('0x16')]=0x0;this[_0x9e79('0x17')]=0x0;this[_0x9e79('0x46')]=0x0;this['ringing']=0x0;this['ringInUse']=0x0;this['onHold']=0x0;if(_0x29691a){if(_0x29691a['available']){this[_0x9e79('0x0')]=Number(_0x29691a[_0x9e79('0x0')]);}if(_0x29691a[_0x9e79('0x47')]){this[_0x9e79('0x18')]=Number(_0x29691a[_0x9e79('0x47')]);}if(_0x29691a[_0x9e79('0x48')]){this[_0x9e79('0x12')]=Number(_0x29691a[_0x9e79('0x48')]);}}for(var _0x367942=0x0;_0x367942<_0x588f0e[_0x9e79('0x49')];_0x367942++){var _0x38800d=_0x3d8bcc[_0x9e79('0x4a')+_0x588f0e[_0x367942][_0x9e79('0x13')]];if(_0x38800d&&_0x38800d[_0x9e79('0x4b')]){this[_0x9e79('0x1')]+=0x1;}if(_0x588f0e[_0x367942][_0x9e79('0x4c')]==='1'){this[_0x9e79('0x3')]+=0x1;}if(_0x588f0e[_0x367942][_0x9e79('0xe')]==='1'&&!['2','7','8']['includes'](_0x588f0e[_0x367942]['status'])){this[_0x9e79('0xe')]+=0x1;}switch(_0x588f0e[_0x367942][_0x9e79('0x4d')]){case'0':this[_0x9e79('0x1f')]+=0x1;break;case'1':this[_0x9e79('0x1a')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this['busy']+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0x9e79('0x46')]+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this[_0x9e79('0x1b')]+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this['dialMethod']===_0x9e79('0x4e')){var _0x42c73d=Object[_0x9e79('0x4f')](_0x4cbdad);for(var _0x40520e=0x0;_0x40520e<_0x42c73d['length'];_0x40520e++){var _0x41808b=_0x42c73d[_0x40520e];var _0x31142f=_0x4cbdad[_0x41808b];if(_0x31142f[_0x9e79('0x50')]===this[_0x9e79('0x13')]&&_0x31142f[_0x9e79('0x1e')]==='dialer'&&_0x31142f['exten']===_0x9e79('0x51')){this[_0x9e79('0x3')]+=0x1;}}if(this['talking']>this[_0x9e79('0x5')]){this[_0x9e79('0x3')]=this[_0x9e79('0x5')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0x9e79('0x45')][_0x9e79('0x52')]=function(_0x17ec5b){var _0xa00ffe=![];if(_0x17ec5b){_0xa00ffe=INBOUND_COUNTERS[_0x9e79('0x53')](function(_0x1697af){return this[_0x1697af]!==_0x17ec5b[_0x1697af];},this);}return _0xa00ffe;};VoiceQueueSummary[_0x9e79('0x45')][_0x9e79('0x54')]=function(_0x148168){var _0x32360d=![];var _0x2617f0=![];var _0x44ed19=![];if(_0x148168){_0x32360d=this[_0x9e79('0x23')]!==_0x148168[_0x9e79('0x23')]||this[_0x9e79('0x22')]!==_0x148168[_0x9e79('0x22')]||this[_0x9e79('0x40')]!==_0x148168['message']||this[_0x9e79('0x41')]!==_0x148168[_0x9e79('0x41')];_0x2617f0=OUTBOUND_COUNTERS[_0x9e79('0x53')](function(_0x41b62c){return this[_0x41b62c]!==_0x148168[_0x41b62c];},this);if(this[_0x9e79('0x42')]&&_0x148168[_0x9e79('0x42')]){_0x44ed19=this[_0x9e79('0x42')][_0x9e79('0x13')]!==_0x148168[_0x9e79('0x42')][_0x9e79('0x13')]||this[_0x9e79('0x42')][_0x9e79('0x43')]!==_0x148168[_0x9e79('0x42')][_0x9e79('0x43')];}}return _0x32360d||_0x2617f0||_0x44ed19;};VoiceQueueSummary['prototype'][_0x9e79('0x55')]=function(_0x29d4bc){this['answered']=_0x29d4bc[_0x9e79('0x4')];this[_0x9e79('0x40')]=_0x29d4bc[_0x9e79('0x40')];this[_0x9e79('0x41')]=_0x29d4bc[_0x9e79('0x41')];this[_0x9e79('0x3a')]=_0x29d4bc[_0x9e79('0x3a')];this[_0x9e79('0x6')]=_0x29d4bc[_0x9e79('0x6')];this[_0x9e79('0x7')]=_0x29d4bc[_0x9e79('0x7')];this[_0x9e79('0x8')]=_0x29d4bc[_0x9e79('0x8')];this['outboundBusyCallsDay']=_0x29d4bc[_0x9e79('0x56')];this[_0x9e79('0x9')]=_0x29d4bc[_0x9e79('0x9')];this[_0x9e79('0xa')]=_0x29d4bc[_0x9e79('0xa')];this[_0x9e79('0x2c')]=_0x29d4bc[_0x9e79('0x2c')];this['outboundReCallsDay']=_0x29d4bc[_0x9e79('0xb')];this['outboundRejectCallsDay']=_0x29d4bc[_0x9e79('0xc')];this[_0x9e79('0xd')]=_0x29d4bc['outboundUnknownCallsDay'];this[_0x9e79('0x10')]=_0x29d4bc[_0x9e79('0x10')];this[_0x9e79('0x1c')]=_0x29d4bc[_0x9e79('0x1c')];this['total']=_0x29d4bc[_0x9e79('0x11')];if(this[_0x9e79('0x23')]===_0x9e79('0x57')){this[_0x9e79('0xf')]=_0x29d4bc['pTalking'];}};module['exports']=VoiceQueueSummary; \ No newline at end of file +var _0x4a80=['active','callerid','prototype','createReport','loggedin','callers','length','incall','includes','status','booked','keys','queue','dialer','exten','compareToInboundQueue','updateReportFromOutboundQueue','preview','available','loggedInDb','paused','talking','waiting','answered','inUse','loggedIn','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumDuration','total','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumBillable','sumHoldTime','type','unavailable','unknown','unmanaged','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','message','statusMessage','Trunk'];(function(_0x22c027,_0x9267ad){var _0x1f2c71=function(_0x26fdb2){while(--_0x26fdb2){_0x22c027['push'](_0x22c027['shift']());}};_0x1f2c71(++_0x9267ad);}(_0x4a80,0xbe));var _0x04a8=function(_0x2185d7,_0x2b9aeb){_0x2185d7=_0x2185d7-0x0;var _0x2f65f1=_0x4a80[_0x2185d7];return _0x2f65f1;};'use strict';var INBOUND_COUNTERS=[_0x04a8('0x0'),'loggedIn',_0x04a8('0x1'),_0x04a8('0x2'),'ringing',_0x04a8('0x3'),_0x04a8('0x4')];var OUTBOUND_COUNTERS=[_0x04a8('0x0'),_0x04a8('0x5'),_0x04a8('0x6'),_0x04a8('0x7'),_0x04a8('0x1'),_0x04a8('0x8'),_0x04a8('0x9'),_0x04a8('0xa'),'outboundBlacklistCallsDay',_0x04a8('0xb'),_0x04a8('0xc'),_0x04a8('0xd'),_0x04a8('0xe'),_0x04a8('0xf'),_0x04a8('0x10'),_0x04a8('0x11'),_0x04a8('0x2'),_0x04a8('0x12'),_0x04a8('0x3'),'sumBillable',_0x04a8('0x13'),_0x04a8('0x14'),_0x04a8('0x4')];function VoiceQueueSummary(_0x4f6c74){this['id']=_0x4f6c74['id'];this[_0x04a8('0x15')]=_0x4f6c74[_0x04a8('0x15')];this[_0x04a8('0x16')]=_0x4f6c74[_0x04a8('0x16')];this[_0x04a8('0x17')]=_0x4f6c74[_0x04a8('0x17')]||0x0;this[_0x04a8('0x5')]=_0x4f6c74['answered']||0x0;this[_0x04a8('0x0')]=_0x4f6c74[_0x04a8('0x0')]||0x0;this[_0x04a8('0x18')]=_0x4f6c74['busy']||0x0;this['inUse']=_0x4f6c74[_0x04a8('0x6')]||0x0;this[_0x04a8('0x19')]=_0x4f6c74['invalid']||0x0;this[_0x04a8('0x7')]=_0x4f6c74['loggedIn']||0x0;this[_0x04a8('0x1')]=_0x4f6c74['loggedInDb']||0x0;this[_0x04a8('0x1a')]=_0x4f6c74[_0x04a8('0x1a')]||0x0;this['notInUse']=_0x4f6c74[_0x04a8('0x1b')]||0x0;this[_0x04a8('0x2')]=_0x4f6c74['paused']||0x0;this['ringing']=_0x4f6c74['ringing']||0x0;this[_0x04a8('0x1c')]=_0x4f6c74[_0x04a8('0x1c')];this[_0x04a8('0x1d')]=_0x4f6c74[_0x04a8('0x1d')];this[_0x04a8('0x13')]=_0x4f6c74[_0x04a8('0x13')];this['sumHoldTime']=_0x4f6c74[_0x04a8('0x1e')]||0x0;this[_0x04a8('0x3')]=_0x4f6c74[_0x04a8('0x3')]||0x0;this[_0x04a8('0x14')]=_0x4f6c74[_0x04a8('0x14')]||0x0;this[_0x04a8('0x1f')]=_0x4f6c74[_0x04a8('0x1f')];this[_0x04a8('0x20')]=_0x4f6c74['unavailable']||0x0;this[_0x04a8('0x21')]=_0x4f6c74[_0x04a8('0x21')]||0x0;this[_0x04a8('0x22')]=_0x4f6c74['unmanaged']||0x0;this['waiting']=_0x4f6c74[_0x04a8('0x4')]||0x0;if(_0x4f6c74['type']==='outbound'){this[_0x04a8('0x12')]=_0x4f6c74[_0x04a8('0x12')]||0x0;this[_0x04a8('0x23')]=_0x4f6c74[_0x04a8('0x23')];this[_0x04a8('0x24')]=_0x4f6c74[_0x04a8('0x24')];this[_0x04a8('0x25')]=_0x4f6c74['dialOriginateCallerIdName'];this[_0x04a8('0x26')]=_0x4f6c74[_0x04a8('0x26')];this['dialOriginateTimeout']=_0x4f6c74[_0x04a8('0x27')];this[_0x04a8('0x28')]=_0x4f6c74[_0x04a8('0x28')];this[_0x04a8('0x29')]=_0x4f6c74[_0x04a8('0x29')];this[_0x04a8('0x2a')]=_0x4f6c74[_0x04a8('0x2a')];this[_0x04a8('0xa')]=_0x4f6c74[_0x04a8('0xa')];this[_0x04a8('0x2b')]=_0x4f6c74[_0x04a8('0x2b')];this[_0x04a8('0xb')]=_0x4f6c74['outboundBusyCallsDay'];this['outboundCongestionCallsDay']=_0x4f6c74[_0x04a8('0xc')];this[_0x04a8('0x2c')]=_0x4f6c74['outboundDropCallsDayACS'];this['outboundDropCallsDayCallersExit']=_0x4f6c74[_0x04a8('0x2d')];this[_0x04a8('0x2e')]=_0x4f6c74[_0x04a8('0x2e')];this[_0x04a8('0xd')]=_0x4f6c74['outboundNoAnswerCallsDay'];this[_0x04a8('0xe')]=_0x4f6c74['outboundNoSuchCallsDay'];this[_0x04a8('0x2f')]=_0x4f6c74[_0x04a8('0x2f')];this[_0x04a8('0xf')]=_0x4f6c74[_0x04a8('0xf')];this[_0x04a8('0x10')]=_0x4f6c74[_0x04a8('0x10')];this[_0x04a8('0x11')]=_0x4f6c74[_0x04a8('0x11')];this['predictiveIntervalAnsweredCalls']=_0x4f6c74[_0x04a8('0x30')];this[_0x04a8('0x31')]=_0x4f6c74['predictiveIntervalAvgHoldtime'];this[_0x04a8('0x32')]=_0x4f6c74[_0x04a8('0x32')];this['predictiveIntervalDroppedCallsCallersExit']=_0x4f6c74[_0x04a8('0x33')];this[_0x04a8('0x34')]=_0x4f6c74['predictiveIntervalDroppedCallsTimeout'];this[_0x04a8('0x35')]=_0x4f6c74[_0x04a8('0x35')];this[_0x04a8('0x36')]=_0x4f6c74['predictiveIntervalErlangCallsDroppedCalls'];this[_0x04a8('0x37')]=_0x4f6c74[_0x04a8('0x37')];this['predictiveIntervalMultiplicativeFactor']=_0x4f6c74[_0x04a8('0x38')];this[_0x04a8('0x39')]=_0x4f6c74[_0x04a8('0x39')];this['predictiveIntervalAvailable']=_0x4f6c74[_0x04a8('0x3a')];this[_0x04a8('0x3b')]=_0x4f6c74[_0x04a8('0x3b')];this['originated']=_0x4f6c74['originated'];this[_0x04a8('0x3c')]=_0x4f6c74['erlangCalls'];this['erlangCallToSecond']=_0x4f6c74[_0x04a8('0x3d')];this[_0x04a8('0x3e')]=_0x4f6c74[_0x04a8('0x3e')];this[_0x04a8('0x3f')]=_0x4f6c74[_0x04a8('0x3f')];this['startPredictive']=_0x4f6c74['startPredictive'];this[_0x04a8('0x40')]=_0x4f6c74[_0x04a8('0x40')];this[_0x04a8('0x41')]=_0x4f6c74[_0x04a8('0x41')];this[_0x04a8('0x42')]=_0x4f6c74['statusMessage'];}if(_0x4f6c74[_0x04a8('0x43')]){this['Trunk']={'id':_0x4f6c74[_0x04a8('0x43')]['id'],'name':_0x4f6c74[_0x04a8('0x43')]['name'],'active':_0x4f6c74[_0x04a8('0x43')][_0x04a8('0x44')],'callerid':_0x4f6c74['Trunk'][_0x04a8('0x45')]};}}VoiceQueueSummary[_0x04a8('0x46')][_0x04a8('0x47')]=function(_0x2e8a75,_0x3245a2,_0x5df577,_0x52c458){this[_0x04a8('0x1')]=0x0;this[_0x04a8('0x3')]=0x0;this[_0x04a8('0x2')]=0x0;this['unknown']=0x0;this[_0x04a8('0x1b')]=0x0;this[_0x04a8('0x6')]=0x0;this[_0x04a8('0x18')]=0x0;this[_0x04a8('0x19')]=0x0;this[_0x04a8('0x20')]=0x0;this['ringing']=0x0;this[_0x04a8('0x1c')]=0x0;this[_0x04a8('0x1a')]=0x0;if(_0x5df577){if(_0x5df577[_0x04a8('0x0')]){this['available']=Number(_0x5df577['available']);}if(_0x5df577[_0x04a8('0x48')]){this['loggedIn']=Number(_0x5df577[_0x04a8('0x48')]);}if(_0x5df577['callers']){this[_0x04a8('0x4')]=Number(_0x5df577[_0x04a8('0x49')]);}}for(var _0x4ee013=0x0;_0x4ee013<_0x2e8a75[_0x04a8('0x4a')];_0x4ee013++){var _0x3d320e=_0x3245a2['SIP/'+_0x2e8a75[_0x4ee013]['name']];if(_0x3d320e&&_0x3d320e['online']){this[_0x04a8('0x1')]+=0x1;}if(_0x2e8a75[_0x4ee013][_0x04a8('0x4b')]==='1'){this['talking']+=0x1;}if(_0x2e8a75[_0x4ee013][_0x04a8('0x2')]==='1'&&!['2','7','8'][_0x04a8('0x4c')](_0x2e8a75[_0x4ee013][_0x04a8('0x4d')])){this[_0x04a8('0x2')]+=0x1;}switch(_0x2e8a75[_0x4ee013]['status']){case'0':this[_0x04a8('0x21')]+=0x1;break;case'1':this[_0x04a8('0x1b')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0x04a8('0x18')]+=0x1;break;case'4':this[_0x04a8('0x19')]+=0x1;break;case'5':this[_0x04a8('0x20')]+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this[_0x04a8('0x1c')]+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this['dialMethod']===_0x04a8('0x4e')){var _0x200bab=Object[_0x04a8('0x4f')](_0x52c458);for(var _0x2a36de=0x0;_0x2a36de<_0x200bab[_0x04a8('0x4a')];_0x2a36de++){var _0x4b1fb1=_0x200bab[_0x2a36de];var _0x5821a0=_0x52c458[_0x4b1fb1];if(_0x5821a0[_0x04a8('0x50')]===this[_0x04a8('0x15')]&&_0x5821a0[_0x04a8('0x1f')]===_0x04a8('0x51')&&_0x5821a0[_0x04a8('0x52')]==='xcally-motion-preview'){this[_0x04a8('0x3')]+=0x1;}}if(this[_0x04a8('0x3')]>this['inUse']){this['talking']=this[_0x04a8('0x6')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0x04a8('0x46')][_0x04a8('0x53')]=function(_0x1e5c48){var _0x874bf2=![];if(_0x1e5c48){_0x874bf2=INBOUND_COUNTERS['some'](function(_0xce1670){return this[_0xce1670]!==_0x1e5c48[_0xce1670];},this);}return _0x874bf2;};VoiceQueueSummary['prototype']['compareToOutboundQueue']=function(_0x37b029){var _0x226366=![];var _0x5cd628=![];var _0x46213d=![];if(_0x37b029){_0x226366=this['dialMethod']!==_0x37b029[_0x04a8('0x24')]||this[_0x04a8('0x23')]!==_0x37b029[_0x04a8('0x23')]||this[_0x04a8('0x41')]!==_0x37b029[_0x04a8('0x41')]||this[_0x04a8('0x42')]!==_0x37b029[_0x04a8('0x42')];_0x5cd628=OUTBOUND_COUNTERS['some'](function(_0x1fee17){return this[_0x1fee17]!==_0x37b029[_0x1fee17];},this);if(this[_0x04a8('0x43')]&&_0x37b029[_0x04a8('0x43')]){_0x46213d=this[_0x04a8('0x43')][_0x04a8('0x15')]!==_0x37b029[_0x04a8('0x43')][_0x04a8('0x15')]||this[_0x04a8('0x43')][_0x04a8('0x44')]!==_0x37b029['Trunk'][_0x04a8('0x44')];}}return _0x226366||_0x5cd628||_0x46213d;};VoiceQueueSummary['prototype'][_0x04a8('0x54')]=function(_0xec126b){this[_0x04a8('0x5')]=_0xec126b[_0x04a8('0x5')];this[_0x04a8('0x41')]=_0xec126b['message'];this[_0x04a8('0x42')]=_0xec126b['statusMessage'];this[_0x04a8('0x8')]=_0xec126b['originated'];this[_0x04a8('0x9')]=_0xec126b['outboundAbandonedCallsDay'];this[_0x04a8('0xa')]=_0xec126b[_0x04a8('0xa')];this['outboundBlacklistCallsDay']=_0xec126b[_0x04a8('0x2b')];this['outboundBusyCallsDay']=_0xec126b[_0x04a8('0xb')];this[_0x04a8('0xc')]=_0xec126b[_0x04a8('0xc')];this[_0x04a8('0xd')]=_0xec126b[_0x04a8('0xd')];this[_0x04a8('0xe')]=_0xec126b[_0x04a8('0xe')];this['outboundReCallsDay']=_0xec126b[_0x04a8('0xf')];this[_0x04a8('0x10')]=_0xec126b['outboundRejectCallsDay'];this['outboundUnknownCallsDay']=_0xec126b[_0x04a8('0x11')];this['sumBillable']=_0xec126b['sumBillable'];this['sumDuration']=_0xec126b[_0x04a8('0x13')];this[_0x04a8('0x14')]=_0xec126b['total'];if(this[_0x04a8('0x24')]===_0x04a8('0x55')){this['pTalking']=_0xec126b[_0x04a8('0x12')];}};module['exports']=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 7f3753d..df1a5c1 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 _0xb900=['Configurations','exports','name','accessKey','remoteUri','serverUrl'];(function(_0xb74c89,_0x246040){var _0xe4ccef=function(_0x12b652){while(--_0x12b652){_0xb74c89['push'](_0xb74c89['shift']());}};_0xe4ccef(++_0x246040);}(_0xb900,0xce));var _0x0b90=function(_0x5cf817,_0x40eff){_0x5cf817=_0x5cf817-0x0;var _0x51f495=_0xb900[_0x5cf817];return _0x51f495;};'use strict';function VtigerAccount(_0x299ace){this['id']=_0x299ace['id']||0x0;this['name']=_0x299ace[_0x0b90('0x0')]||'';this['username']=_0x299ace['username']||'';this['accessKey']=_0x299ace[_0x0b90('0x1')]||'';this[_0x0b90('0x2')]=_0x299ace[_0x0b90('0x2')]||'';this['serverUrl']=_0x299ace[_0x0b90('0x3')]||'';this[_0x0b90('0x4')]=_0x299ace[_0x0b90('0x4')]||{};}module[_0x0b90('0x5')]=VtigerAccount; \ No newline at end of file +var _0xdeac=['serverUrl','Configurations','name','username','accessKey','remoteUri'];(function(_0x1e0767,_0xa43f6c){var _0x3b4a66=function(_0x1374f3){while(--_0x1374f3){_0x1e0767['push'](_0x1e0767['shift']());}};_0x3b4a66(++_0xa43f6c);}(_0xdeac,0x158));var _0xcdea=function(_0x187049,_0x549e9c){_0x187049=_0x187049-0x0;var _0x49ecd1=_0xdeac[_0x187049];return _0x49ecd1;};'use strict';function VtigerAccount(_0x3d4956){this['id']=_0x3d4956['id']||0x0;this[_0xcdea('0x0')]=_0x3d4956[_0xcdea('0x0')]||'';this[_0xcdea('0x1')]=_0x3d4956['username']||'';this[_0xcdea('0x2')]=_0x3d4956['accessKey']||'';this['remoteUri']=_0x3d4956[_0xcdea('0x3')]||'';this[_0xcdea('0x4')]=_0x3d4956[_0xcdea('0x4')]||'';this[_0xcdea('0x5')]=_0x3d4956[_0xcdea('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index d3c2ce1..a5f3d67 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 _0xca37=['serverUrl','Configurations','exports','username','token','remoteUri','authType','type','integrationTab'];(function(_0x4d521e,_0x58ba39){var _0x3beb42=function(_0x1a7bd2){while(--_0x1a7bd2){_0x4d521e['push'](_0x4d521e['shift']());}};_0x3beb42(++_0x58ba39);}(_0xca37,0x1e0));var _0x7ca3=function(_0x4d54db,_0x29b178){_0x4d54db=_0x4d54db-0x0;var _0x2f5df9=_0xca37[_0x4d54db];return _0x2f5df9;};'use strict';function ZendeskAccount(_0x41bf9f){this['id']=_0x41bf9f['id']||0x0;this['name']=_0x41bf9f['name']||'';this[_0x7ca3('0x0')]=_0x41bf9f[_0x7ca3('0x0')]||'';this['password']=_0x41bf9f['password']||'';this[_0x7ca3('0x1')]=_0x41bf9f[_0x7ca3('0x1')]||'';this[_0x7ca3('0x2')]=_0x41bf9f[_0x7ca3('0x2')]||'';this[_0x7ca3('0x3')]=_0x41bf9f[_0x7ca3('0x3')]||'';this[_0x7ca3('0x4')]=_0x41bf9f['type']||_0x7ca3('0x5');this[_0x7ca3('0x6')]=_0x41bf9f[_0x7ca3('0x6')]||'';this[_0x7ca3('0x7')]=_0x41bf9f[_0x7ca3('0x7')]||{};}module[_0x7ca3('0x8')]=ZendeskAccount; \ No newline at end of file +var _0x058c=['authType','type','integrationTab','Configurations','name','username','password','token','remoteUri'];(function(_0x444704,_0x5c3b2f){var _0x4e38ab=function(_0x3b8fb6){while(--_0x3b8fb6){_0x444704['push'](_0x444704['shift']());}};_0x4e38ab(++_0x5c3b2f);}(_0x058c,0xe5));var _0xc058=function(_0x51f012,_0x629f0d){_0x51f012=_0x51f012-0x0;var _0x1e3e8f=_0x058c[_0x51f012];return _0x1e3e8f;};'use strict';function ZendeskAccount(_0x45603c){this['id']=_0x45603c['id']||0x0;this[_0xc058('0x0')]=_0x45603c[_0xc058('0x0')]||'';this[_0xc058('0x1')]=_0x45603c[_0xc058('0x1')]||'';this['password']=_0x45603c[_0xc058('0x2')]||'';this['token']=_0x45603c[_0xc058('0x3')]||'';this[_0xc058('0x4')]=_0x45603c[_0xc058('0x4')]||'';this['authType']=_0x45603c[_0xc058('0x5')]||'';this[_0xc058('0x6')]=_0x45603c[_0xc058('0x6')]||_0xc058('0x7');this['serverUrl']=_0x45603c['serverUrl']||'';this[_0xc058('0x8')]=_0x45603c[_0xc058('0x8')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 33b23af..9a98fe8 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 _0xa44f=['clientId','serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xa44f,0x74));var _0xfa44=function(_0x5f1d0d,_0x47e31f){_0x5f1d0d=_0x5f1d0d-0x0;var _0x893d86=_0xa44f[_0x5f1d0d];return _0x893d86;};'use strict';function ZohoAccount(_0xe5c605){this['id']=_0xe5c605['id']||0x0;this[_0xfa44('0x0')]=_0xe5c605[_0xfa44('0x0')]||'';this[_0xfa44('0x1')]=_0xe5c605[_0xfa44('0x1')]||'';this['host']=_0xe5c605[_0xfa44('0x2')]||'';this[_0xfa44('0x3')]=_0xe5c605[_0xfa44('0x3')]||'';this[_0xfa44('0x4')]=_0xe5c605[_0xfa44('0x4')]||'';this['clientSecret']=_0xe5c605['clientSecret']||'';this['serverUrl']=_0xe5c605[_0xfa44('0x5')]||'';this[_0xfa44('0x6')]=_0xe5c605[_0xfa44('0x6')]||'';this['refreshToken']=_0xe5c605[_0xfa44('0x7')]||'';this[_0xfa44('0x8')]=_0xe5c605['Configurations']||{};}module[_0xfa44('0x9')]=ZohoAccount; \ No newline at end of file +var _0x7136=['refreshToken','Configurations','name','description','host','zone','clientId','clientSecret','serverUrl','code'];(function(_0x33ca91,_0x1e602d){var _0x232d4b=function(_0x129963){while(--_0x129963){_0x33ca91['push'](_0x33ca91['shift']());}};_0x232d4b(++_0x1e602d);}(_0x7136,0x12e));var _0x6713=function(_0x1a4c27,_0x5a4b45){_0x1a4c27=_0x1a4c27-0x0;var _0x578d9=_0x7136[_0x1a4c27];return _0x578d9;};'use strict';function ZohoAccount(_0x11c068){this['id']=_0x11c068['id']||0x0;this[_0x6713('0x0')]=_0x11c068[_0x6713('0x0')]||'';this[_0x6713('0x1')]=_0x11c068[_0x6713('0x1')]||'';this['host']=_0x11c068[_0x6713('0x2')]||'';this[_0x6713('0x3')]=_0x11c068['zone']||'';this[_0x6713('0x4')]=_0x11c068[_0x6713('0x4')]||'';this['clientSecret']=_0x11c068[_0x6713('0x5')]||'';this[_0x6713('0x6')]=_0x11c068[_0x6713('0x6')]||'';this[_0x6713('0x7')]=_0x11c068[_0x6713('0x7')]||'';this['refreshToken']=_0x11c068[_0x6713('0x8')]||'';this['Configurations']=_0x11c068[_0x6713('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 0658b79..6dfb63a 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 _0xcf66=['membername','calleridname','Contact','phone','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','number','exports','util','lodash','moment','string','isNil','uniqueid','idContact','queue','name','type','dialAnswer','Agent','SIP/%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcf66,0x71));var _0x6cf6=function(_0x3f8c98,_0x3f1d28){_0x3f8c98=_0x3f8c98-0x0;var _0x21eb19=_0xcf66[_0x3f8c98];return _0x21eb19;};'use strict';var util=require(_0x6cf6('0x0'));var _=require(_0x6cf6('0x1'));var moment=require(_0x6cf6('0x2'));function checkNameSurname(_0x56f1fd,_0x7ed4c0,_0x1af283){var _0x49ce88='';if(!_['isNil'](_0x7ed4c0)&&_0x6cf6('0x3')===typeof _0x7ed4c0){_0x49ce88+=_0x7ed4c0;}if(!_[_0x6cf6('0x4')](_0x1af283)&&'string'===typeof _0x1af283){_0x49ce88+='\x20'+_0x1af283;}if(_0x49ce88!==''){return _0x49ce88;}return _0x56f1fd;}function Action(_0x39f1d6,_0x1fbedd,_0x2a573e,_0x5eb082,_0x94c6a9){this[_0x6cf6('0x5')]=_0x2a573e||undefined;this[_0x6cf6('0x6')]=_0x39f1d6['id'];this[_0x6cf6('0x7')]=_0x1fbedd[_0x6cf6('0x8')];this[_0x6cf6('0x9')]=_0x1fbedd['type'];this['campaigntype']='queue';this[_0x6cf6('0xa')]=![];this['membername']=_[_0x6cf6('0x4')](_0x39f1d6[_0x6cf6('0xb')])?undefined:_0x39f1d6[_0x6cf6('0xb')][_0x6cf6('0x8')];this['channelAgent']=this['membername']?util['format'](_0x6cf6('0xc'),this[_0x6cf6('0xd')]):_0x5eb082||undefined;this[_0x6cf6('0xe')]=checkNameSurname(_0x39f1d6[_0x6cf6('0xf')][_0x6cf6('0x10')],_0x39f1d6[_0x6cf6('0xf')]['firstName'],_0x39f1d6[_0x6cf6('0xf')]['lastName']);this[_0x6cf6('0x11')]=_0x39f1d6[_0x6cf6('0x11')]||![];this['calleridnum']=_0x39f1d6[_0x6cf6('0x10')];this[_0x6cf6('0x12')]=_0x39f1d6[_0x6cf6('0x12')];this[_0x6cf6('0x13')]=_0x39f1d6[_0x6cf6('0x13')]||0x0;this[_0x6cf6('0x14')]=_0x39f1d6[_0x6cf6('0x14')]||0x0;this[_0x6cf6('0x15')]=_0x39f1d6[_0x6cf6('0x15')]||0x0;this[_0x6cf6('0x16')]=(_0x39f1d6['countbusyretry']||0x0)+(_0x39f1d6[_0x6cf6('0x14')]||0x0)+(_0x39f1d6[_0x6cf6('0x15')]||0x0)+(_0x39f1d6[_0x6cf6('0x17')]||0x0)+(_0x39f1d6['countdropretry']||0x0)+(_0x39f1d6[_0x6cf6('0x18')]||0x0)+(_0x39f1d6[_0x6cf6('0x19')]||0x0)+(_0x39f1d6[_0x6cf6('0x1a')]||0x0);this[_0x6cf6('0x17')]=_0x39f1d6[_0x6cf6('0x17')]||0x0;this[_0x6cf6('0x1b')]=_0x39f1d6[_0x6cf6('0x1b')]||0x0;this['countabandonedretry']=_0x39f1d6[_0x6cf6('0x18')]||0x0;this[_0x6cf6('0x19')]=_0x39f1d6[_0x6cf6('0x19')]||0x0;this[_0x6cf6('0x1a')]=_0x39f1d6[_0x6cf6('0x1a')]||0x0;this[_0x6cf6('0x1c')]=_0x39f1d6[_0x6cf6('0x1c')];this[_0x6cf6('0x1d')]=_0x39f1d6['callbackuniqueid'];this['callbackat']=_0x39f1d6[_0x6cf6('0x1e')];this['recallme']=_0x39f1d6[_0x6cf6('0x1f')];this[_0x6cf6('0x20')]=_0x39f1d6[_0x6cf6('0x20')];this[_0x6cf6('0x21')]=_0x39f1d6[_0x6cf6('0x21')];this[_0x6cf6('0x22')]=_[_0x6cf6('0x4')](_0x39f1d6['Agent'])?_0x39f1d6[_0x6cf6('0x22')]:_0x39f1d6[_0x6cf6('0xb')]['id'];this[_0x6cf6('0x23')]=_0x39f1d6['VoiceQueueId'];this[_0x6cf6('0x24')]='';this[_0x6cf6('0x25')]='';}Action[_0x6cf6('0x26')][_0x6cf6('0x27')]=function(){return util['format']('\x22%s\x22\x20<%s>',this[_0x6cf6('0xe')],this[_0x6cf6('0x28')]);};module[_0x6cf6('0x29')]=Action; \ No newline at end of file +var _0xd7d1=['uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','Agent','channelAgent','membername','SIP/%s','Contact','phone','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','format','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string'];(function(_0x485a11,_0x2a4a63){var _0x2aa2bf=function(_0x57c13e){while(--_0x57c13e){_0x485a11['push'](_0x485a11['shift']());}};_0x2aa2bf(++_0x2a4a63);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x46ac9e,_0x423c24){_0x46ac9e=_0x46ac9e-0x0;var _0x4c8b5b=_0xd7d1[_0x46ac9e];return _0x4c8b5b;};'use strict';var util=require(_0x1d7d('0x0'));var _=require(_0x1d7d('0x1'));var moment=require(_0x1d7d('0x2'));function checkNameSurname(_0x447083,_0x1d1926,_0x3c3a27){var _0x222e84='';if(!_[_0x1d7d('0x3')](_0x1d1926)&&_0x1d7d('0x4')===typeof _0x1d1926){_0x222e84+=_0x1d1926;}if(!_[_0x1d7d('0x3')](_0x3c3a27)&&_0x1d7d('0x4')===typeof _0x3c3a27){_0x222e84+='\x20'+_0x3c3a27;}if(_0x222e84!==''){return _0x222e84;}return _0x447083;}function Action(_0x1a2564,_0x14b2b9,_0x5a8cf3,_0x462ef8,_0x1aa456){this[_0x1d7d('0x5')]=_0x5a8cf3||undefined;this[_0x1d7d('0x6')]=_0x1a2564['id'];this[_0x1d7d('0x7')]=_0x14b2b9[_0x1d7d('0x8')];this[_0x1d7d('0x9')]=_0x14b2b9[_0x1d7d('0x9')];this[_0x1d7d('0xa')]=_0x1d7d('0x7');this[_0x1d7d('0xb')]=![];this['membername']=_[_0x1d7d('0x3')](_0x1a2564['Agent'])?undefined:_0x1a2564[_0x1d7d('0xc')][_0x1d7d('0x8')];this[_0x1d7d('0xd')]=this[_0x1d7d('0xe')]?util['format'](_0x1d7d('0xf'),this['membername']):_0x462ef8||undefined;this['calleridname']=checkNameSurname(_0x1a2564[_0x1d7d('0x10')][_0x1d7d('0x11')],_0x1a2564['Contact']['firstName'],_0x1a2564[_0x1d7d('0x10')][_0x1d7d('0x12')]);this[_0x1d7d('0x13')]=_0x1a2564[_0x1d7d('0x13')]||![];this[_0x1d7d('0x14')]=_0x1a2564['phone'];this[_0x1d7d('0x15')]=_0x1a2564[_0x1d7d('0x15')];this['countbusyretry']=_0x1a2564[_0x1d7d('0x16')]||0x0;this[_0x1d7d('0x17')]=_0x1a2564[_0x1d7d('0x17')]||0x0;this[_0x1d7d('0x18')]=_0x1a2564[_0x1d7d('0x18')]||0x0;this['countglobal']=(_0x1a2564[_0x1d7d('0x16')]||0x0)+(_0x1a2564[_0x1d7d('0x17')]||0x0)+(_0x1a2564['countnoanswerretry']||0x0)+(_0x1a2564['countnosuchnumberretry']||0x0)+(_0x1a2564[_0x1d7d('0x19')]||0x0)+(_0x1a2564[_0x1d7d('0x1a')]||0x0)+(_0x1a2564[_0x1d7d('0x1b')]||0x0)+(_0x1a2564[_0x1d7d('0x1c')]||0x0);this[_0x1d7d('0x1d')]=_0x1a2564[_0x1d7d('0x1d')]||0x0;this['countdropretry']=_0x1a2564[_0x1d7d('0x19')]||0x0;this[_0x1d7d('0x1a')]=_0x1a2564[_0x1d7d('0x1a')]||0x0;this['countmachineretry']=_0x1a2564[_0x1d7d('0x1b')]||0x0;this[_0x1d7d('0x1c')]=_0x1a2564['countagentrejectretry']||0x0;this['callback']=_0x1a2564[_0x1d7d('0x1e')];this[_0x1d7d('0x1f')]=_0x1a2564[_0x1d7d('0x1f')];this['callbackat']=_0x1a2564[_0x1d7d('0x20')];this[_0x1d7d('0x21')]=_0x1a2564[_0x1d7d('0x21')];this[_0x1d7d('0x22')]=_0x1a2564['ContactId'];this[_0x1d7d('0x23')]=_0x1a2564[_0x1d7d('0x23')];this['UserId']=_['isNil'](_0x1a2564[_0x1d7d('0xc')])?_0x1a2564['UserId']:_0x1a2564[_0x1d7d('0xc')]['id'];this[_0x1d7d('0x24')]=_0x1a2564[_0x1d7d('0x24')];this[_0x1d7d('0x25')]='';this[_0x1d7d('0x26')]='';}Action['prototype'][_0x1d7d('0x27')]=function(){return util[_0x1d7d('0x28')](_0x1d7d('0x29'),this['calleridname'],this[_0x1d7d('0x2a')]);};module[_0x1d7d('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 9a070ca..3299c7e 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 _0x194e=['[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[originated][decrement][callProgressDetectingAgent]','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','VoiceQueueId','Contact\x20is\x20undefined','Queue','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','execRun','unlock','unlockContact','recallme','validateContact','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','isActive','[Preview][validateContact][Campaign\x20Active]','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','extractCalleridName','originatecalleridnum','extractCalleridNumber','setXMDContactVariables','assign','merge','toLowerVariables','starttime','variables','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','cause','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','destuniqueid','addVariable','filterKey','variable','value','error','[syncVarSet][Preview]','inspect','transfererlinkedid','exports','util','lodash','uuid','moment','../../../config/environment','../../../config/logger','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','../dialer/utils','redis','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','syncOriginateResponse','bind','syncHangup','hanguprequest','syncHangupRequest','dialend','newexten','syncNewExten','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','name','voice_queue_channel:remove','voice_queue_presence:remove','originated','sendMessageOneNotActive','available','paused','CAMPAIGN_STATUS','INACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','message','DEACTIVATED','logger','\x20is\x20deactivated','syncCampaigns','dialMethod','preview','booked','outbound','clearZombieChannels','hasOwnProperty','type','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','actions','[clearZombieChannels][talking]','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','ListId','Action','status','channel','catch','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','[action]','getContactRecallMe','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','logCustomer','RecallFailedTimeout','[HistoryRecallClose]','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','Trunk','isTrunkReachable','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','totalGlobal','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','unlockAgent','activeContact','linkedid','incrementPreviewCounters','responsetime','[syncHangup][talking][increment]','uniqueid','custom:agentconnect','connect','custom:agentConnectPreview','buildAcw','complete','outboundAnswerCallsDay','answered','[16]','countglobal','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','\x20Queue','pTalking','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','[callProgressDetectingCustomer][logBusy]','additional','dialGlobalMaxRetry','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','scheduledAt','idContact','swapAdditionalPhones','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','outboundCongestionCallsDay','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','countcongestionretry','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','outboundAbandonedCallsDay','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][machine]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','ANSWER','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','object','isUndefined','reason','logAgent','NoSuchNumber','createAgentHistory'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x194e,0x1a2));var _0xe194=function(_0x3b9593,_0x58718a){_0x3b9593=_0x3b9593-0x0;var _0x1bc3fa=_0x194e[_0x3b9593];return _0x1bc3fa;};'use strict';var util=require(_0xe194('0x0'));var _=require(_0xe194('0x1'));var uuid=require(_0xe194('0x2'));var moment=require(_0xe194('0x3'));var Redis=require('ioredis');var config=require(_0xe194('0x4'));var logger=require('../../../config/logger')('preview');var loggerAction=require(_0xe194('0x5'))(_0xe194('0x6'));var ami=require(_0xe194('0x7'));var rpcDb=require(_0xe194('0x8'));var cmHopperAdditionalPhone=require(_0xe194('0x9'));var Action=require(_0xe194('0xa'));var ut=require(_0xe194('0xb'));var utils=require(_0xe194('0xc'));config[_0xe194('0xd')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xe194('0xe'))(new Redis(config[_0xe194('0xd')]));var Sequence=function(){};Sequence[_0xe194('0xf')][_0xe194('0x10')]=function(_0x17408b){this[_0xe194('0x11')]=this['tail']?this[_0xe194('0x11')][_0xe194('0x12')](_0x17408b):_0x17408b();};function Preview(_0x4b2c78){this[_0xe194('0x13')]=new Sequence();this[_0xe194('0x14')]=_0x4b2c78[_0xe194('0x15')];this[_0xe194('0x16')]=_0x4b2c78['trunks'];this['actions']={};this['agents']=_0x4b2c78[_0xe194('0x17')];this[_0xe194('0x18')]=0x0;ami['on']('originateresponse',this[_0xe194('0x19')][_0xe194('0x1a')](this));ami['on']('hangup',this[_0xe194('0x1b')][_0xe194('0x1a')](this));ami['on'](_0xe194('0x1c'),this[_0xe194('0x1d')][_0xe194('0x1a')](this));ami['on'](_0xe194('0x1e'),this['syncDialEnd'][_0xe194('0x1a')](this));ami['on'](_0xe194('0x1f'),this[_0xe194('0x20')]['bind'](this));ami['on']('varset',this[_0xe194('0x21')][_0xe194('0x1a')](this));ami['on'](_0xe194('0x22'),this[_0xe194('0x23')][_0xe194('0x1a')](this));ami['on'](_0xe194('0x24'),this[_0xe194('0x25')][_0xe194('0x1a')](this));this[_0xe194('0x26')](this[_0xe194('0x14')]);}function emit(_0x38646c,_0x59928a,_0x370677){io['to'](_0x38646c)[_0xe194('0x27')](_0x59928a,_0x370677);}function emitVoiceQueueChannelRemove(_0x55f63e){logger[_0xe194('0x28')](_0xe194('0x29'),JSON[_0xe194('0x2a')](_0x55f63e));emit(util[_0xe194('0x2b')]('voice:queue:%s',_0x55f63e[_0xe194('0x2c')]),_0xe194('0x2d'),_0x55f63e);io[_0xe194('0x27')](_0xe194('0x2e'),_0x55f63e);}function notSendMessagesQueue(_0x4449be){if(_0x4449be['sendMessageOneNotActive']){if(_0x4449be[_0xe194('0x2f')]===0x0&&_0x4449be['pTalking']===0x0){_0x4449be[_0xe194('0x30')]=![];_0x4449be[_0xe194('0x31')]=0x0;_0x4449be[_0xe194('0x32')]=0x0;_0x4449be['message']=utils[_0xe194('0x33')][_0xe194('0x34')];ut['logger'](_0xe194('0x35'),_0x4449be[_0xe194('0x2c')]+'\x20is\x20not\x20active');}else{_0x4449be[_0xe194('0x36')]=utils['CAMPAIGN_STATUS'][_0xe194('0x37')];ut[_0xe194('0x38')](_0xe194('0x35'),_0x4449be[_0xe194('0x2c')]+_0xe194('0x39'));}}}Preview[_0xe194('0xf')][_0xe194('0x26')]=function(){var _0x45edd1=this;setInterval(function(){_0x45edd1[_0xe194('0x3a')]();},0x7cf);};Preview[_0xe194('0xf')]['syncCampaigns']=function(){var _0x1f4d97=this['campaignsPreview'];this[_0xe194('0x18')]+=0x1;for(var _0x802b41 in _0x1f4d97){if(_0x1f4d97['hasOwnProperty'](_0x802b41)&&(_0x1f4d97[_0x802b41][_0xe194('0x3b')]===_0xe194('0x3c')||_0x1f4d97[_0x802b41]['dialMethod']===_0xe194('0x3d'))&&_0x1f4d97[_0x802b41]['type']===_0xe194('0x3e')){if(this[_0xe194('0x18')]>0x7){this[_0xe194('0x18')]=0x0;this[_0xe194('0x3f')]();}}if(_0x1f4d97[_0xe194('0x40')](_0x802b41)&&_0x1f4d97[_0x802b41][_0xe194('0x3b')]==='preview'&&_0x1f4d97[_0x802b41][_0xe194('0x41')]===_0xe194('0x3e')){if(_0x1f4d97[_0x802b41][_0xe194('0x42')]){this[_0xe194('0x43')](_0x1f4d97[_0x802b41]);if(_0x1f4d97[_0x802b41][_0xe194('0x44')])this[_0xe194('0x45')](_0x1f4d97[_0x802b41]);}else{notSendMessagesQueue(_0x1f4d97[_0x802b41]);}}}};Preview[_0xe194('0xf')][_0xe194('0x46')]=function(_0x35506d){var _0x247f36=this;this[_0xe194('0x13')][_0xe194('0x10')](function(){if(!_[_0xe194('0x47')](_0x247f36[_0xe194('0x48')][_0x35506d])){loggerAction[_0xe194('0x28')](_0xe194('0x49'),_0x35506d,'Queue',_0x247f36[_0xe194('0x48')][_0x35506d][_0xe194('0x4a')],_0xe194('0x4b'),JSON[_0xe194('0x2a')](_0x247f36[_0xe194('0x14')][_0x247f36['actions'][_0x35506d][_0xe194('0x4a')]][_0xe194('0x2f')]),_0xe194('0x4c'),JSON[_0xe194('0x2a')](_0x247f36[_0xe194('0x14')][_0x247f36[_0xe194('0x48')][_0x35506d]['queue']]['pTalking']),JSON['stringify'](_0x247f36[_0xe194('0x48')][_0x35506d][_0xe194('0x4d')]),JSON[_0xe194('0x2a')](_[_0xe194('0x4e')](_0x247f36[_0xe194('0x48')][_0x35506d],[_0xe194('0x4f'),_0xe194('0x50'),'VoiceQueueId',_0xe194('0x51')])));return ami[_0xe194('0x52')]({'action':_0xe194('0x53'),'channel':_0x247f36['actions'][_0x35506d][_0xe194('0x54')]})[_0xe194('0x55')](function(_0x14db5e){if(_0x14db5e['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x247f36[_0xe194('0x48')][_0x35506d]){ut[_0xe194('0x56')](_0x247f36[_0xe194('0x14')][_0x247f36[_0xe194('0x48')][_0x35506d][_0xe194('0x4a')]],_0xe194('0x57'));if(_0x247f36[_0xe194('0x48')][_0x35506d]['dialAnswer']===!![]){ut[_0xe194('0x58')](_0x247f36['campaignsPreview'][_0x247f36[_0xe194('0x48')][_0x35506d][_0xe194('0x4a')]],_0xe194('0x57'));ut['loggerError']('[Dialer][checkChannel][pTalking][Preview]'+_0x35506d,_0x247f36['actions'][_0x35506d][_0xe194('0x4a')]);}ut[_0xe194('0x59')](_0xe194('0x5a')+_0x35506d,_0x247f36['actions'][_0x35506d][_0xe194('0x4a')]);delete _0x247f36[_0xe194('0x48')][_0x35506d];}},0x2328);}});}});};Preview[_0xe194('0xf')][_0xe194('0x3f')]=function(){var _0x4755f9=this;loggerAction[_0xe194('0x28')](_0xe194('0x5b'),_['size'](this[_0xe194('0x48')]));for(var _0x2f44c3 in this[_0xe194('0x48')]){if(_0x4755f9[_0xe194('0x48')][_0xe194('0x40')](_0x2f44c3)){_0x4755f9[_0xe194('0x46')](_0x2f44c3);}}};Preview[_0xe194('0xf')][_0xe194('0x45')]=function(_0x11345e){var _0x49e07e=this;rpcDb[_0xe194('0x5c')](_0x11345e['id'],ut['agentReadyId'](this[_0xe194('0x17')]))[_0xe194('0x5d')](function(_0x47d249){if(!_['isNil'](_0x47d249)){for(var _0x36fbbe=0x0;_0x36fbbe<_0x47d249[_0xe194('0x5e')];_0x36fbbe+=0x1){if(ut[_0xe194('0x5f')](_0x47d249[_0x36fbbe][_0xe194('0x60')])<_0x11345e[_0xe194('0x61')]*0x3c){if(_0x47d249[_0x36fbbe]['Agent']&&!_0x47d249[_0x36fbbe][_0xe194('0x62')][_0xe194('0x63')]){_0x49e07e[_0xe194('0x64')](_0x47d249[_0x36fbbe]['id'])[_0xe194('0x5d')](ut[_0xe194('0x65')](_0xe194('0x66')))[_0xe194('0x55')](ut[_0xe194('0x65')]('[RecallMe]'));}else{rpcDb[_0xe194('0x67')](_0x47d249[_0x36fbbe]['id']);}}else{var _0x48908d=new Action(_0x47d249[_0x36fbbe],_0x11345e);_0x48908d['starttime']=moment()[_0xe194('0x2b')](_0xe194('0x68'));_0x11345e[_0xe194('0x69')]+=0x1;ut['logCustomer'](_0x48908d,0x17,'RecallInQueue');if(_0x11345e['dialRecallInQueue']){rpcDb[_0xe194('0x6a')](ut[_0xe194('0x6b')](_0x47d249[_0x36fbbe]));rpcDb[_0xe194('0x6c')](_0x48908d,_0xe194('0x6d'));}else{ut[_0xe194('0x6e')](_0x48908d,0x16,_0xe194('0x6f'));rpcDb[_0xe194('0x6c')](_0x48908d,_0xe194('0x70'));rpcDb['createCustomerFinal'](_0x48908d,_0xe194('0x70'));}}}}})[_0xe194('0x55')](ut[_0xe194('0x65')]('[getContactRecallMe]'));};Preview['prototype'][_0xe194('0x43')]=function(_0x4f1b73){_0x4f1b73[_0xe194('0x30')]=!![];if(ut[_0xe194('0x71')](_0x4f1b73[_0xe194('0x72')])){_0x4f1b73[_0xe194('0x36')]=utils[_0xe194('0x33')][_0xe194('0x73')];}else if(!ut['isActive'](_0x4f1b73[_0xe194('0x42')])){_0x4f1b73['message']=utils[_0xe194('0x33')][_0xe194('0x34')];}else if(!this['isTrunkReachable'](_0x4f1b73[_0xe194('0x74')])){if(!this[_0xe194('0x75')](_0x4f1b73[_0xe194('0x76')])){_0x4f1b73[_0xe194('0x36')]=utils[_0xe194('0x33')][_0xe194('0x77')];}else{_0x4f1b73[_0xe194('0x36')]=utils[_0xe194('0x33')][_0xe194('0x78')];}}else{_0x4f1b73[_0xe194('0x36')]=utils['CAMPAIGN_STATUS'][_0xe194('0x78')];}};Preview['prototype'][_0xe194('0x79')]=function(_0x1f8b9e,_0x4da114,_0x16a6bf){var _0x134eac=this;var _0x543255=this['actions'][_0x4da114];var _0x2c4aa7=this[_0xe194('0x14')][_0x543255[_0xe194('0x4a')]];var _0x45f065;var _0x180fdf=![];var _0x561ac0=0x2;var _0x1359c9=0x3;if(_0x2c4aa7){switch(_0x16a6bf){case'1':_0x2c4aa7[_0xe194('0x7a')]+=0x1;_0x543255[_0xe194('0x7b')]+=0x1;_0x543255['countglobal']=ut['totalGlobal'](_0x543255);ut['logCustomer'](_0x543255,0x0,'NoSuchNumber');ami[_0xe194('0x27')](_0xe194('0x7c'),ut[_0xe194('0x7d')](_0x543255,_0xe194('0x7e')));rpcDb[_0xe194('0x6c')](_0x543255,_0xe194('0x7f'));_0x134eac[_0xe194('0x80')](_0x543255,'0',_0x2c4aa7)[_0xe194('0x5d')](function(_0x2738c8){_0x180fdf=_0x2738c8['additional']==0x1;_0x561ac0=_0x2c4aa7[_0xe194('0x81')];_0x1359c9=_0x2c4aa7[_0xe194('0x82')];if(!_0x180fdf){if(ut[_0xe194('0x83')](_0x543255)>=_0x2c4aa7['dialGlobalMaxRetry']){_0x45f065=ut[_0xe194('0x84')](_0x543255,0xf,_0xe194('0x85'));rpcDb[_0xe194('0x86')](_0x45f065,_0xe194('0x87'));}else{if(_0x543255[_0xe194('0x7b')]>=_0x2c4aa7[_0xe194('0x88')]){rpcDb['createCustomerFinal'](_0x543255,_0xe194('0x87'));}else{rpcDb[_0xe194('0x89')](ut['scheduledAt'](_0x543255,_0xe194('0x7b'),_0x2c4aa7[_0xe194('0x81')]),_0x543255[_0xe194('0x8a')],_0x543255[_0xe194('0x8b')]);}}delete this['actions'][_0x1f8b9e[_0xe194('0x8c')]];}else{_0x543255[_0xe194('0x7b')]++;logger[_0xe194('0x28')]('actioncountonusuch',_0x543255['countnosuchnumberretry']);logger['info']('id',_0x543255['idContact']);_0x134eac[_0xe194('0x8d')]({'id':_0x543255['idContact'],'field':{'countnosuchnumberretry':_0x543255[_0xe194('0x7b')]}})[_0xe194('0x5d')](function(){_0x134eac['swapAdditionalPhones'](_0x543255,_0x561ac0,_0x1359c9)[_0xe194('0x5d')](function(){});});}});break;case'ANSWER':var _0xb04953=moment()[_0xe194('0x2b')]('YYYY-MM-DD\x20HH:mm:ss');_0x543255[_0xe194('0x8e')]=_0xb04953;_0x543255['answertime']=_0xb04953;_0x543255[_0xe194('0x4d')]=!![];_0x2c4aa7['pTalking']+=0x1;logger['info'](_0xe194('0x8f'),_0x543255[_0xe194('0x90')],'\x20Queue',_0x2c4aa7[_0xe194('0x2c')],'pTalking:\x20',_0x2c4aa7['pTalking']);ami['emit'](_0xe194('0x91'),ut[_0xe194('0x7d')](_0x543255,_0xe194('0x92'),this[_0xe194('0x14')][_0x543255[_0xe194('0x4a')]]));if(_0x2c4aa7['acw']){ami[_0xe194('0x27')](_0xe194('0x93'),ut[_0xe194('0x94')](_0x543255));}break;case'16':ami[_0xe194('0x27')]('custom:agentcomplete',ut[_0xe194('0x7d')](_0x543255,_0xe194('0x95'),this[_0xe194('0x14')][_0x543255[_0xe194('0x4a')]]));emitVoiceQueueChannelRemove(ut[_0xe194('0x7d')](_0x543255,_0xe194('0x95')));_0x2c4aa7[_0xe194('0x96')]+=0x1;_0x2c4aa7['total']+=0x1;_0x2c4aa7[_0xe194('0x97')]+=0x1;ut['decrementTalkink'](_0x2c4aa7,_0xe194('0x98'));_0x543255[_0xe194('0x99')]=ut[_0xe194('0x83')](_0x543255);ut[_0xe194('0x6e')](_0x543255,0x4,'Answer');rpcDb[_0xe194('0x6c')](_0x543255,_0xe194('0x9a'));rpcDb[_0xe194('0x86')](_0x543255,_0xe194('0x9b'));rpcDb[_0xe194('0x9c')](_0x543255);_0x2c4aa7[_0xe194('0x9d')]+=_0x543255[_0xe194('0x9e')];_0x2c4aa7[_0xe194('0x9f')]+=_0x543255[_0xe194('0x9e')];logger[_0xe194('0x28')]('[syncHangup][talking][decrement]',_0x543255[_0xe194('0x90')],_0xe194('0xa0'),_0x2c4aa7[_0xe194('0x2c')],'pTalking:\x20',_0x2c4aa7[_0xe194('0xa1')]);delete this[_0xe194('0x48')][_0x1f8b9e[_0xe194('0x8c')]];break;case'BUSY':_0x2c4aa7[_0xe194('0xa2')]+=0x1;_0x543255[_0xe194('0xa3')]+=0x1;_0x543255[_0xe194('0x99')]=ut[_0xe194('0x83')](_0x543255);ut['logCustomer'](_0x543255,0x5,_0xe194('0xa4'));_0x561ac0=_0x2c4aa7[_0xe194('0xa5')];_0x1359c9=_0x2c4aa7[_0xe194('0x82')];ami[_0xe194('0x27')]('custom:agentbusy',ut['buildObj'](_0x543255,'busy'));rpcDb[_0xe194('0x6c')](_0x543255,_0xe194('0xa6'));_0x134eac[_0xe194('0x80')](_0x543255,'5',_0x2c4aa7)[_0xe194('0x5d')](function(_0x557a11){_0x180fdf=_0x557a11[_0xe194('0xa7')]==0x1;if(!_0x180fdf){if(ut[_0xe194('0x83')](_0x543255)>=_0x2c4aa7[_0xe194('0xa8')]){_0x45f065=ut[_0xe194('0x84')](_0x543255,0xf,_0xe194('0x85'));rpcDb[_0xe194('0x86')](_0x45f065,_0xe194('0xa9'));}else{if(_0x543255[_0xe194('0xa3')]>=_0x2c4aa7[_0xe194('0xaa')]){rpcDb[_0xe194('0x86')](_0x543255,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xe194('0x89')](ut[_0xe194('0xab')](_0x543255,_0xe194('0xa3'),_0x2c4aa7[_0xe194('0xa5')]),_0x543255[_0xe194('0x8a')],_0x543255[_0xe194('0x8b')]);}}}else{_0x543255['countbusyretry']++;_0x134eac[_0xe194('0x8d')]({'id':_0x543255[_0xe194('0xac')],'field':{'countbusyretry':_0x543255[_0xe194('0xa3')]}})[_0xe194('0x5d')](function(){_0x134eac[_0xe194('0xad')](_0x543255,_0x561ac0,_0x1359c9)['then'](function(){});});}});break;case _0xe194('0xae'):_0x2c4aa7[_0xe194('0xaf')]+=0x1;_0x543255[_0xe194('0xb0')]+=0x1;_0x543255['countglobal']=ut['totalGlobal'](_0x543255);ut[_0xe194('0x6e')](_0x543255,0x3,_0xe194('0xb1'));_0x561ac0=_0x2c4aa7[_0xe194('0xb2')];_0x1359c9=_0x2c4aa7[_0xe194('0x82')];var _0x3d8faa=ut[_0xe194('0xb3')](_0x543255,_0x2c4aa7);ami['emit']('custom:agentnoanswer',_0x3d8faa);rpcDb[_0xe194('0x6c')](_0x543255,_0xe194('0xb4'));_0x134eac[_0xe194('0x80')](_0x543255,'3',_0x2c4aa7)[_0xe194('0x5d')](function(_0x3783e6){_0x180fdf=_0x3783e6['additional']==0x1;if(!_0x180fdf){if(ut[_0xe194('0x83')](_0x543255)>=_0x2c4aa7['dialGlobalMaxRetry']){_0x45f065=ut[_0xe194('0x84')](_0x543255,0xf,_0xe194('0x85'));rpcDb[_0xe194('0x86')](_0x45f065,_0xe194('0xb5'));}else{if(_0x543255['countnoanswerretry']>=_0x2c4aa7[_0xe194('0xb6')]){rpcDb[_0xe194('0x86')](_0x543255,_0xe194('0xb4'));}else{rpcDb[_0xe194('0x89')](ut[_0xe194('0xab')](_0x543255,_0xe194('0xb0'),_0x2c4aa7[_0xe194('0xb2')]),_0x543255['unlockAgent'],_0x543255['activeContact']);}}}else{_0x543255[_0xe194('0xb0')]++;_0x134eac['incrementPreviewCounters']({'id':_0x543255[_0xe194('0xac')],'field':{'countnoanswerretry':_0x543255[_0xe194('0xb0')]}})[_0xe194('0x5d')](function(){_0x134eac[_0xe194('0xad')](_0x543255,_0x561ac0,_0x1359c9)[_0xe194('0x5d')](function(){});});}});break;case _0xe194('0xb7'):_0x2c4aa7[_0xe194('0xb8')]+=0x1;_0x543255['countcongestionretry']+=0x1;_0x543255['countglobal']=ut[_0xe194('0x83')](_0x543255);ut[_0xe194('0x6e')](_0x543255,0x8,_0xe194('0xb9'));_0x561ac0=_0x2c4aa7[_0xe194('0xba')];_0x1359c9=_0x2c4aa7[_0xe194('0x82')];ami['emit'](_0xe194('0xbb'),ut[_0xe194('0x7d')](_0x543255,_0xe194('0xbc')));rpcDb[_0xe194('0x6c')](_0x543255,_0xe194('0xbd'));_0x134eac[_0xe194('0x80')](_0x543255,'8',_0x2c4aa7)[_0xe194('0x5d')](function(_0x2b5f37){_0x180fdf=_0x2b5f37[_0xe194('0xa7')]==0x1;if(!_0x180fdf){if(ut[_0xe194('0x83')](_0x543255)>=_0x2c4aa7['dialGlobalMaxRetry']){_0x45f065=ut['cloneAction'](_0x543255,0xf,_0xe194('0x85'));rpcDb[_0xe194('0x86')](_0x45f065,_0xe194('0xbe'));}else{if(_0x543255['countcongestionretry']>=_0x2c4aa7[_0xe194('0xbf')]){rpcDb[_0xe194('0x86')](_0x543255,_0xe194('0xbd'));}else{rpcDb[_0xe194('0x89')](ut['scheduledAt'](_0x543255,'countcongestionretry',_0x2c4aa7[_0xe194('0xa5')]),_0x543255[_0xe194('0x8a')],_0x543255[_0xe194('0x8b')]);}}}else{_0x543255[_0xe194('0xc0')]++;_0x134eac['incrementPreviewCounters']({'id':_0x543255[_0xe194('0xac')],'field':{'countcongestionretry':_0x543255[_0xe194('0xc0')]}})[_0xe194('0x5d')](function(){_0x134eac[_0xe194('0xad')](_0x543255,_0x561ac0,_0x1359c9)[_0xe194('0x5d')](function(){});});}});break;case _0xe194('0xc1'):_0x2c4aa7[_0xe194('0xc2')]+=0x1;_0x543255[_0xe194('0xc3')]+=0x1;_0x543255[_0xe194('0x99')]=ut[_0xe194('0x83')](_0x543255);ut[_0xe194('0x6e')](_0x543255,0x14,_0xe194('0xc4'));_0x561ac0=_0x2c4aa7[_0xe194('0xc5')];_0x1359c9=_0x2c4aa7['callAdditionalPhoneAfterMin'];ami[_0xe194('0x27')]('custom:agentreject',ut[_0xe194('0x7d')](_0x543255,'agentreject'));rpcDb[_0xe194('0x6c')](_0x543255,_0xe194('0xc6'));_0x134eac[_0xe194('0x80')](_0x543255,'20',_0x2c4aa7)[_0xe194('0x5d')](function(_0x570495){_0x180fdf=_0x570495[_0xe194('0xa7')]==0x1;if(!_0x180fdf){if(ut[_0xe194('0x83')](_0x543255)>=_0x2c4aa7[_0xe194('0xa8')]){_0x45f065=ut[_0xe194('0x84')](_0x543255,0x14,_0xe194('0xc4'));rpcDb[_0xe194('0x86')](_0x45f065,_0xe194('0xc7'));}else{if(_0x543255['countagentrejectretry']>=_0x2c4aa7[_0xe194('0xc8')]){rpcDb[_0xe194('0x86')](_0x543255,_0xe194('0xc7'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x543255,_0xe194('0xc3'),_0x2c4aa7[_0xe194('0xc5')]),_0x543255['unlockAgent'],_0x543255[_0xe194('0x8b')]);}}}else{_0x543255[_0xe194('0xb0')]++;_0x134eac[_0xe194('0x8d')]({'id':_0x543255[_0xe194('0xac')],'field':{'countnoanswerretry':_0x543255[_0xe194('0xb0')]}})[_0xe194('0x5d')](function(){_0x134eac[_0xe194('0xad')](_0x543255,_0x561ac0,_0x1359c9)['then'](function(){});});}});break;case'ABANDONED':_0x2c4aa7[_0xe194('0xc9')]+=0x1;_0x543255[_0xe194('0xca')]+=0x1;_0x543255[_0xe194('0x99')]=ut[_0xe194('0x83')](_0x543255);ut[_0xe194('0x6e')](_0x543255,0xb,'Abandoned');rpcDb[_0xe194('0x6c')](_0x543255,_0xe194('0xcb'));_0x134eac['verifyAdditionalPhones'](_0x543255,'11',_0x2c4aa7)[_0xe194('0x5d')](function(_0x2d1da9){_0x180fdf=_0x2d1da9[_0xe194('0xa7')]==0x1;if(!_0x180fdf){if(ut[_0xe194('0x83')](_0x543255)>=_0x2c4aa7[_0xe194('0xa8')]){_0x45f065=ut[_0xe194('0x84')](_0x543255,0xf,_0xe194('0x85'));rpcDb[_0xe194('0x86')](_0x45f065,_0xe194('0xcb'));}else{if(_0x543255['countabandonedetry']>=_0x2c4aa7[_0xe194('0xcc')]){rpcDb['createCustomerFinal'](_0x543255,_0xe194('0xcb'));}else{rpcDb['rescheduleContact'](ut[_0xe194('0xab')](_0x543255,_0xe194('0xca'),_0x2c4aa7['dialAbandonedRetryFrequency']),_0x543255['unlockAgent'],_0x543255['activeContact']);}}}else{_0x543255[_0xe194('0xb0')]++;_0x134eac['incrementPreviewCounters']({'id':_0x543255['idContact'],'field':{'countnoanswerretry':_0x543255[_0xe194('0xb0')]}})['then'](function(){_0x134eac[_0xe194('0xad')](_0x543255,_0x561ac0,_0x1359c9)['then'](function(){});});}});break;case'18':_0x2c4aa7['outboundUnknownCallsDay']+=0x1;_0x543255[_0xe194('0xcd')]+=0x1;_0x543255['countglobal']=ut['totalGlobal'](_0x543255);ut[_0xe194('0x6e')](_0x543255,0x12,_0x1f8b9e[_0xe194('0xce')]||_0x1f8b9e['dialstatus']);ami[_0xe194('0x27')]('custom:amd',ut[_0xe194('0x7d')](_0x543255,'amd'));rpcDb[_0xe194('0x6c')](_0x543255,_0xe194('0xcf'));_0x134eac['verifyAdditionalPhones'](_0x543255,'18',_0x2c4aa7)[_0xe194('0x5d')](function(_0x1d6335){_0x180fdf=_0x1d6335['additional']==0x1;if(!_0x180fdf){if(ut['totalGlobal'](_0x543255)>=_0x2c4aa7[_0xe194('0xa8')]){_0x45f065=ut[_0xe194('0x84')](_0x543255,0x12,'Global');rpcDb[_0xe194('0x86')](_0x45f065,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0xe194('0x86')](_0x543255,_0xe194('0xcf'));}}else{_0x543255[_0xe194('0xb0')]++;_0x134eac[_0xe194('0x8d')]({'id':_0x543255[_0xe194('0xac')],'field':{'countnoanswerretry':_0x543255[_0xe194('0xb0')]}})[_0xe194('0x5d')](function(){_0x134eac[_0xe194('0xad')](_0x543255,_0x561ac0,_0x1359c9)['then'](function(){});});}});delete this[_0xe194('0x48')][_0x1f8b9e[_0xe194('0x8c')]];break;case'19':_0x2c4aa7[_0xe194('0xd0')]+=0x1;_0x543255[_0xe194('0x99')]=ut['totalGlobal'](_0x543255);ut['logCustomer'](_0x543255,0x13,_0x1f8b9e['cause-txt']||_0x1f8b9e[_0xe194('0xd1')]);ami[_0xe194('0x27')](_0xe194('0xd2'),ut[_0xe194('0x7d')](_0x543255,_0xe194('0xd3')));rpcDb[_0xe194('0x6c')](_0x543255,_0xe194('0xd4'));_0x134eac[_0xe194('0x80')](_0x543255,'18',_0x2c4aa7)['then'](function(_0x2fa443){_0x180fdf=_0x2fa443[_0xe194('0xa7')]==0x1;if(!_0x180fdf){if(ut[_0xe194('0x83')](_0x543255)>=_0x2c4aa7[_0xe194('0xa8')]){_0x45f065=ut[_0xe194('0x84')](_0x543255,0xf,_0xe194('0x85'));rpcDb[_0xe194('0x86')](_0x45f065,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0xe194('0x86')](_0x543255,_0xe194('0xd4'));}}else{_0x543255['countnoanswerretry']++;_0x134eac['incrementPreviewCounters']({'id':_0x543255['idContact'],'field':{'countnoanswerretry':_0x543255[_0xe194('0xb0')]}})[_0xe194('0x5d')](function(){_0x134eac[_0xe194('0xad')](_0x543255,_0x561ac0,_0x1359c9)[_0xe194('0x5d')](function(){});});}});delete this[_0xe194('0x48')][_0x1f8b9e[_0xe194('0x8c')]];break;default:if(_0x543255['dialAnswer']){ut[_0xe194('0x58')](_0x2c4aa7,'[default]');ut['loggerError']('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x2c4aa7[_0xe194('0x2c')],_0x1f8b9e);}_0x2c4aa7[_0xe194('0xd0')]+=0x1;_0x543255[_0xe194('0x99')]=ut[_0xe194('0x83')](_0x543255);ut[_0xe194('0x6e')](_0x543255,0xc,_0x1f8b9e[_0xe194('0xce')]||_0x1f8b9e[_0xe194('0xd1')]);_0x561ac0=_0x2c4aa7['dialAgentRejectRetryFrequency'];_0x1359c9=_0x2c4aa7[_0xe194('0x82')];rpcDb[_0xe194('0x6c')](_0x543255,_0xe194('0xd5'));_0x134eac['verifyAdditionalPhones'](_0x543255,'20',_0x2c4aa7)[_0xe194('0x5d')](function(_0x407b73){_0x180fdf=_0x407b73[_0xe194('0xa7')]==0x1;if(!_0x180fdf){if(ut[_0xe194('0x83')](_0x543255)>=_0x2c4aa7[_0xe194('0xa8')]){_0x45f065=ut[_0xe194('0x84')](_0x543255,0xf,_0xe194('0x85'));rpcDb['createCustomerFinal'](_0x45f065,_0xe194('0xd6'));}else{rpcDb[_0xe194('0x86')](_0x543255,_0xe194('0xd6'));}delete this['actions'][_0x1f8b9e[_0xe194('0x8c')]];}else{_0x134eac['swapAdditionalPhones'](_0x543255,_0x561ac0,_0x1359c9)[_0xe194('0x5d')](function(){});}});}if(!(_0x543255['dialAnswer']&&_0x16a6bf==='16')){ut[_0xe194('0x56')](_0x2c4aa7,_0xe194('0xd7'));logger[_0xe194('0x28')]('[originated][decrement][callProgressDetectingCustomer]',_0x543255['uniqueid'],_0xe194('0xa0'),_0x2c4aa7['name'],_0xe194('0x4b'),_0x2c4aa7[_0xe194('0x2f')]);}if(_0x16a6bf!==_0xe194('0xd8')){delete this[_0xe194('0x48')][_0x1f8b9e[_0xe194('0x8c')]];delete this['actions'][_0x1f8b9e[_0xe194('0xd9')]];}_0x2c4aa7[_0xe194('0xda')]=!![];}};Preview['prototype'][_0xe194('0xdb')]=function(_0x42f065,_0x8cd795,_0x76754e){if(_['isUndefined'](_0x8cd795)&&_0xe194('0xdc')!==typeof _0x8cd795){return;}if(_[_0xe194('0xdd')](_0x76754e)&&_0xe194('0xdc')!==typeof _0x76754e){return;}switch(_0x76754e[_0xe194('0xde')]){case'0':ut[_0xe194('0xdf')](_0x42f065,0x0,_0xe194('0xe0'));rpcDb[_0xe194('0xe1')](_0x42f065,_0xe194('0xe2'));break;case'3':ut[_0xe194('0xdf')](_0x42f065,0x3,_0xe194('0xb1'));rpcDb['createAgentHistory'](_0x42f065,_0xe194('0xe3'));break;case'5':ut[_0xe194('0xdf')](_0x42f065,0x5,_0xe194('0xa4'));rpcDb[_0xe194('0xe1')](_0x42f065,_0xe194('0xe4'));break;case'8':ut[_0xe194('0xdf')](_0x42f065,0x8,_0xe194('0xb9'));rpcDb[_0xe194('0xe1')](_0x42f065,_0xe194('0xe5'));break;case'22':ut[_0xe194('0xdf')](_0x42f065,0x16,_0xe194('0xe6'));rpcDb[_0xe194('0xe1')](_0x42f065,_0xe194('0xe7'));break;default:ut[_0xe194('0xdf')](_0x42f065,0xc,_0x76754e[_0xe194('0xde')]);rpcDb[_0xe194('0xe1')](_0x42f065,'[callProgressDetectingAgent][logCongestion]');}ut[_0xe194('0x56')](_0x8cd795,'[callProgressDetectingAgent]');logger[_0xe194('0x28')](_0xe194('0xe8'),_0x42f065['uniqueid'],_0xe194('0xa0'),_0x8cd795[_0xe194('0x2c')],_0xe194('0x4b'),_0x8cd795['originated']);delete this['actions'][_0x42f065['uniqueid']];};Preview['prototype'][_0xe194('0x80')]=function(_0x4abda5,_0xeff3a0,_0x15abbf){return cmHopperAdditionalPhone[_0xe194('0x80')](_0x4abda5,_0xeff3a0,_0x15abbf)[_0xe194('0x55')](logger[_0xe194('0x28')]('[verifyAdditionalPhone]\x20'));};Preview[_0xe194('0xf')][_0xe194('0xad')]=function(_0x124052,_0x418de0,_0xf18ef8){return cmHopperAdditionalPhone[_0xe194('0xad')](_0x124052,_0x418de0,_0xf18ef8)['catch'](logger[_0xe194('0x28')](_0xe194('0xe9')));};Preview['prototype'][_0xe194('0x8d')]=function(_0x38f839){return Promise[_0xe194('0xea')]()[_0xe194('0x5d')](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x38f839))[_0xe194('0x55')](logger['info']('[incrementPreviewCounters]\x20'));};Preview[_0xe194('0xf')][_0xe194('0xeb')]=function(_0xbcc8b0,_0x1c13a7,_0x191cdb,_0x52e67e,_0x2543b3){var _0x4816bd=this;return new Promise(function(_0x5e83f4,_0x5e7f0c){if(_[_0xe194('0x47')](_0x1c13a7)||_['isNil'](_0x1c13a7[_0xe194('0xec')])||_[_0xe194('0x47')](_0x1c13a7[_0xe194('0xed')])||_[_0xe194('0x47')](_0x1c13a7[_0xe194('0xee')])){_0x5e7f0c(ut[_0xe194('0x36')](_0xe194('0xef'),_0x52e67e,_0x2543b3));return;}var _0x377fce=uuid['v4']();var _0x3b1784=_0x4816bd[_0xe194('0x14')][_0x1c13a7[_0xe194('0xf0')][_0xe194('0x2c')]];var _0x1c6301=_0x191cdb?_0x4816bd[_0xe194('0x17')][_0x191cdb]['id']:undefined;_0x4816bd['actions'][_0x377fce]=new Action(_0x1c13a7,_0x3b1784,_0x377fce,_0x191cdb,_0x1c6301);var _0x299810=_0x4816bd['actions'][_0x377fce];_0x299810[_0xe194('0x8a')]=_0x52e67e;_0x299810['activeContact']=_0x2543b3;_0x299810[_0xe194('0xf1')]=_0x191cdb;if(_[_0xe194('0xf2')](_0xbcc8b0)){_0x4816bd[_0xe194('0xf3')](_0x299810,_0x3b1784,_0x1c13a7,_0x191cdb)[_0xe194('0x5d')](function(_0x57091e){logger[_0xe194('0x28')](_0xe194('0xf4'),_0xe194('0xf5')+_0x299810[_0xe194('0x4a')]+_0xe194('0xf6')+_0x299810[_0xe194('0xac')],JSON['stringify'](_0x57091e));ami[_0xe194('0x27')](_0xe194('0xf7'),ut[_0xe194('0x7d')](_0x299810,_0xe194('0xf8'),_0x4816bd['campaignsPreview'][_0x299810['queue']]));_0x5e83f4(ut['message'](_0xe194('0xf9')));})[_0xe194('0x55')](function(_0x2da10e){ut[_0xe194('0x38')](_0xe194('0xfa'),_0x2da10e);_0x5e7f0c(ut['message'](_0xe194('0xfb'),_0x52e67e,_0x2543b3));});}else{_0x3b1784[_0xe194('0xfc')]+=0x1;ut[_0xe194('0xfd')](_0x299810);rpcDb['createHistory'](_0x299810,_0xe194('0xfe'));delete _0x4816bd[_0xe194('0x48')][_0x377fce];_0x5e7f0c(ut[_0xe194('0x36')](_0xe194('0xff'),_0x52e67e,_0x2543b3));}});};Preview[_0xe194('0xf')][_0xe194('0x75')]=function(_0x43b7aa){return!_[_0xe194('0x47')](_0x43b7aa)&&!_[_0xe194('0x47')](_0x43b7aa[_0xe194('0x2c')])&&!_[_0xe194('0x47')](_0x43b7aa[_0xe194('0x100')])&&_0x43b7aa[_0xe194('0x100')]&&!_[_0xe194('0x47')](this[_0xe194('0x16')][util[_0xe194('0x2b')](_0xe194('0x101'),_0x43b7aa[_0xe194('0x2c')])])&&!_[_0xe194('0x47')](this[_0xe194('0x16')][util['format']('SIP/%s',_0x43b7aa[_0xe194('0x2c')])][_0xe194('0x53')])&&(this[_0xe194('0x16')][util[_0xe194('0x2b')]('SIP/%s',_0x43b7aa['name'])][_0xe194('0x53')]==='reachable'||this[_0xe194('0x16')][util[_0xe194('0x2b')](_0xe194('0x101'),_0x43b7aa[_0xe194('0x2c')])][_0xe194('0x53')]==='unmonitored');};Preview[_0xe194('0xf')][_0xe194('0x64')]=function(_0xf3f291,_0x297385){return this[_0xe194('0x102')](_0xf3f291,_0x297385)[_0xe194('0x5d')](function(_0x20ba1e){return _[_0xe194('0x4e')](_0x20ba1e,[_0xe194('0x36')]);})[_0xe194('0x55')](function(_0x576813){if(_0x576813[_0xe194('0x103')]){rpcDb[_0xe194('0x104')](_0xf3f291);}if(_0x576813['active']){rpcDb[_0xe194('0x67')](_0xf3f291);}throw _[_0xe194('0x4e')](_0x576813,['message']);});};Preview[_0xe194('0xf')][_0xe194('0x102')]=function(_0x489ca7,_0x5d8f31){var _0x4b02f6=this;var _0x13b817,_0x568016;return rpcDb['getContactPreview'](_0x489ca7)[_0xe194('0x5d')](function(_0x59cfb6){if(!_[_0xe194('0x47')](_0x59cfb6[0x0])){_0x568016=_0x59cfb6[0x0][_0xe194('0x105')]?![]:!![];_0x13b817=_0x59cfb6[0x0][_0xe194('0x105')]?!![]:![];_0x13b817=_0x5d8f31?!![]:_0x13b817;}var _0x2ee485=_0x4b02f6[_0xe194('0x106')](_0x59cfb6);if(_0x2ee485['isValid']){rpcDb['checkIsBlackList'](_['pick'](_0x59cfb6[0x0],['VoiceQueueId',_0xe194('0xed')]))[_0xe194('0x5d')](function(_0x354ce2){_0x4b02f6[_0xe194('0xeb')](_0x354ce2,_0x59cfb6[0x0],_0x5d8f31,_0x568016,_0x13b817)[_0xe194('0x5d')](function(_0x539bbd){return _0x539bbd;})[_0xe194('0x55')](function(_0x2cdc0b){throw _0x2cdc0b;});})['catch'](function(_0x44f9d1){ut[_0xe194('0x38')](_0xe194('0x107'),_0x44f9d1);throw ut[_0xe194('0x36')](_0xe194('0x108'),_0x568016,_0x13b817);});}else{throw ut['message'](_0x2ee485['message'],_0x568016,_0x13b817);}})[_0xe194('0x55')](function(_0xfcf284){ut[_0xe194('0x38')](_0xe194('0x109'),_0xfcf284);throw ut[_0xe194('0x36')]('Call\x20unsuccessful',![],!![]);});};Preview[_0xe194('0xf')][_0xe194('0x106')]=function(_0x33b4c5){if(_[_0xe194('0x47')](_0x33b4c5)||_[_0xe194('0xf2')](_0x33b4c5)||!_['isNil'](_0x33b4c5[0x0]['Agent'])&&_[_0xe194('0x47')](_0x33b4c5[0x0][_0xe194('0x62')][_0xe194('0x2c')])){ut[_0xe194('0x38')]('[Preview][validateContact][Empty\x20Contact]',_0x33b4c5);return{'isValid':![],'message':_0xe194('0x10a')};}var _0x5f0ed4=this[_0xe194('0x14')][_0x33b4c5[0x0]['Queue'][_0xe194('0x2c')]];_0x5f0ed4['message']=utils[_0xe194('0x33')][_0xe194('0x78')];if(_['isNil'](_0x5f0ed4)){ut[_0xe194('0x38')](_0xe194('0x10b'),_0x5f0ed4);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0xe194('0x75')](_0x5f0ed4[_0xe194('0x74')])){ut[_0xe194('0x38')](_0xe194('0x10c'),_0xe194('0x10d')+_0x5f0ed4[_0xe194('0x2c')]+_0xe194('0x10e'));if(!this[_0xe194('0x75')](_0x5f0ed4['TrunkBackup'])){ut[_0xe194('0x38')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x5f0ed4['name']+_0xe194('0x10f'));return{'isValid':![],'message':_0xe194('0x110')};}}if(!ut[_0xe194('0x111')](_0x5f0ed4['dialActive'])){ut[_0xe194('0x38')](_0xe194('0x112'),_0x5f0ed4[_0xe194('0x2c')]+'\x20Not\x20Active');return{'isValid':![],'message':_0xe194('0x10d')+_0x5f0ed4['name']+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0xe194('0xf')][_0xe194('0xf3')]=function(_0x5e561c,_0x5d1c04,_0xc7fe11,_0x425239){var _0xce40=this;return new Promise(function(_0x278e8e,_0x17e820){var _0x5d887e=_0x5e561c['uniqueid'];var _0x125509=_0xce40[_0xe194('0x75')](_0x5d1c04['Trunk'])?util[_0xe194('0x2b')](_0xe194('0x113'),_0x5d1c04[_0xe194('0x74')][_0xe194('0x2c')],_[_0xe194('0x47')](_0x5d1c04[_0xe194('0x114')])?'':_0x5d1c04['dialPrefix'][_0xe194('0x115')]()||'',_0x5d1c04['dialCutDigit']>0x0?_0xc7fe11[_0xe194('0xed')][_0xe194('0x116')](_0x5d1c04['dialCutDigit']):_0xc7fe11['phone']):util[_0xe194('0x2b')]('SIP/%s/%s%s',_['isNil'](_0x5d1c04[_0xe194('0x76')])?_0x5d1c04[_0xe194('0x74')]['name']:_0x5d1c04['TrunkBackup']['name'],_[_0xe194('0x47')](_0x5d1c04[_0xe194('0x114')])?'':_0x5d1c04[_0xe194('0x114')]['trim']()||'',_0x5d1c04[_0xe194('0x117')]>0x0?_0xc7fe11['phone'][_0xe194('0x116')](_0x5d1c04['dialCutDigit']):_0xc7fe11[_0xe194('0xed')]);var _0x275804=_0xce40[_0xe194('0x75')](_0x5d1c04[_0xe194('0x74')])?ut[_0xe194('0x118')](_0x5d1c04[_0xe194('0x74')][_0xe194('0x119')],_0x5d1c04[_0xe194('0x11a')],_0x5d1c04[_0xe194('0x11b')]>0x0?ut[_0xe194('0x11c')](_0x5d1c04[_0xe194('0x11d')],_0x5d1c04[_0xe194('0x11b')]):_0x5d1c04[_0xe194('0x11d')]):ut[_0xe194('0x118')](_['isNil'](_0x5d1c04[_0xe194('0x76')])?_0x5d1c04['Trunk'][_0xe194('0x119')]:_0x5d1c04[_0xe194('0x76')][_0xe194('0x119')],_0x5d1c04[_0xe194('0x11a')],_0x5d1c04['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xe194('0x11c')](_0x5d1c04[_0xe194('0x11d')],_0x5d1c04[_0xe194('0x11b')]):_0x5d1c04[_0xe194('0x11d')]);if(_0x275804){_0x5e561c['originatecalleridname']=ut[_0xe194('0x11e')](_0x275804);_0x5e561c[_0xe194('0x11f')]=ut[_0xe194('0x120')](_0x275804);}var _0xfafaa6=ut['addVariables'](_0x5d1c04,_0xc7fe11,_0x125509,_0x275804,_0x5d887e,_0x5e561c);var _0x30f58a=utils[_0xe194('0x121')](_0xc7fe11[_0xe194('0xec')]);Object[_0xe194('0x122')](_0xfafaa6,_0x30f58a);_[_0xe194('0x123')](_0x5e561c,ut[_0xe194('0x124')](_0xfafaa6));_0x5e561c[_0xe194('0x125')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5d1c04[_0xe194('0x126')]=_0xfafaa6;var _0x47a2ce=ut['variablesAction'](_0x5e561c,_0x5d1c04,_0xfafaa6,_0x5e561c[_0xe194('0x8b')],_0x425239);return ami['Action'](_0x47a2ce)['then'](function(_0x4fd862){_0x5d1c04['originated']+=0x1;logger[_0xe194('0x28')](_0xe194('0x127'),_0x5d887e,'\x20Queue',_0x5d1c04[_0xe194('0x2c')],_0xe194('0x4b'),_0x5d1c04[_0xe194('0x2f')]);_0x278e8e(_0x4fd862);})[_0xe194('0x55')](function(_0x4453a0){ut[_0xe194('0xdf')](_0x5e561c,0xe,_0xe194('0x128'));rpcDb[_0xe194('0xe1')](_0x5e561c,_0xe194('0x129'));_0x17e820(_0x4453a0);});});};Preview[_0xe194('0xf')][_0xe194('0x20')]=function(_0x3e1f2f){if(this['actions'][_0x3e1f2f[_0xe194('0x8c')]]){this[_0xe194('0x48')][_0x3e1f2f['linkedid']]['channel']=_0x3e1f2f[_0xe194('0x54')];}};Preview['prototype'][_0xe194('0x19')]=function(_0x49107b){var _0x1f534c=this;var _0x989baa=this[_0xe194('0x48')][_0x49107b[_0xe194('0x12a')]];if(_0x989baa){if(_0x989baa['lookAgent']&&this['agents'][_0x989baa[_0xe194('0xf1')]]){ut[_0xe194('0x12b')](_0x989baa,this['agents'][_0x989baa['lookAgent']][_0xe194('0x2c')],this[_0xe194('0x17')][_0x989baa[_0xe194('0xf1')]]['id']);}var _0x1ac381=_[_0xe194('0x12c')](_0x989baa);_0x1ac381[_0xe194('0x8e')]=moment()['format'](_0xe194('0x68'));var _0x1a244f=_0x1f534c['campaignsPreview'][_0x989baa[_0xe194('0x4a')]];if(ut[_0xe194('0x12d')](_0x49107b[_0xe194('0x12e')])){if(_0x989baa[_0xe194('0x8a')]){rpcDb[_0xe194('0x104')](_0x989baa[_0xe194('0xac')]);}if(_0x989baa[_0xe194('0x8b')]){rpcDb[_0xe194('0x67')](_0x989baa[_0xe194('0xac')]);}ami[_0xe194('0x27')](_0xe194('0x12f'),ut[_0xe194('0x7d')](_0x989baa,_0xe194('0x130'),this[_0xe194('0x14')][_0x989baa[_0xe194('0x4a')]]));this[_0xe194('0xdb')](_0x1ac381,_0x1a244f,_0x49107b);}else{_0x989baa[_0xe194('0x125')]=moment()[_0xe194('0x2b')](_0xe194('0x68'));ut[_0xe194('0xdf')](_0x1ac381,0x4,'Answer');rpcDb[_0xe194('0xe1')](_0x1ac381,_0xe194('0x131'));}}};Preview[_0xe194('0xf')][_0xe194('0x1b')]=function(_0x26f13c){var _0x1352cd=this[_0xe194('0x48')][_0x26f13c[_0xe194('0x8c')]];var _0x140f89;if(_0x1352cd){_0x140f89=this['campaignsPreview'][_0x1352cd['queue']];logger[_0xe194('0x28')]('[syncHangup][talking]',_0x26f13c['linkedid'],_0xe194('0xa0'),_0x140f89['name'],'pTalking:\x20',_0x140f89[_0xe194('0xa1')]);}if(this['actions'][_0x26f13c['linkedid']]&&_0x26f13c[_0xe194('0x8c')]!==_0x26f13c['uniqueid']){if(_0x26f13c[_0xe194('0x132')]==='16'&&this[_0xe194('0x48')][_0x26f13c[_0xe194('0x8c')]][_0xe194('0x4d')]){this[_0xe194('0x79')](_0x26f13c,_0x26f13c[_0xe194('0x8c')],_0x26f13c[_0xe194('0x132')]);}else if(this[_0xe194('0x48')][_0x26f13c[_0xe194('0x8c')]][_0xe194('0x4d')]){logger[_0xe194('0x28')]('[syncHangup][talking][cause]',_0x26f13c[_0xe194('0x8c')],_0x26f13c[_0xe194('0x132')],_0xe194('0xa0'),_0x140f89['name'],_0xe194('0x4c'),_0x140f89[_0xe194('0xa1')]);this[_0xe194('0x79')](_0x26f13c,_0x26f13c[_0xe194('0x8c')],_0x26f13c[_0xe194('0x132')]);}}else if(_0x1352cd&&_['isNil'](_0x1352cd[_0xe194('0x133')])&&_0x140f89[_0xe194('0x134')]&&_0x26f13c['linkedid']===_0x26f13c[_0xe194('0x90')]&&_[_0xe194('0x47')](_0x26f13c[_0xe194('0xde')])&&_0x26f13c[_0xe194('0x132')]==='16'&&_0x26f13c['channelstate']==='6'&&_['isUndefined'](_0x1352cd['transfer'])){if(_0x1352cd['unlockAgent']){rpcDb['unlockContact'](_0x1352cd[_0xe194('0xac')]);}if(_0x1352cd[_0xe194('0x8b')]){rpcDb[_0xe194('0x67')](_0x1352cd[_0xe194('0xac')]);}_0x26f13c[_0xe194('0xde')]='22';this[_0xe194('0xdb')](_0x1352cd,_0x140f89,_0x26f13c);}else if(_0x1352cd&&_0x1352cd[_0xe194('0x135')]){if(_0x26f13c['cause']==='16'&&this[_0xe194('0x48')][_0x26f13c[_0xe194('0x8c')]][_0xe194('0x4d')]){logger[_0xe194('0x28')](_0xe194('0x136'),_0x26f13c[_0xe194('0x8c')],_0x26f13c[_0xe194('0x132')],_0xe194('0xa0'),_0x140f89[_0xe194('0x2c')],_0xe194('0x4c'),_0x140f89[_0xe194('0xa1')]);this[_0xe194('0x79')](_0x26f13c,_0x26f13c['linkedid'],_0x26f13c[_0xe194('0x132')]);}else if(this[_0xe194('0x48')][_0x26f13c[_0xe194('0x8c')]][_0xe194('0x4d')]){logger[_0xe194('0x28')](_0xe194('0x137'),_0x26f13c[_0xe194('0x8c')],_0x26f13c[_0xe194('0x132')],_0xe194('0xa0'),_0x140f89[_0xe194('0x2c')],_0xe194('0x4c'),_0x140f89[_0xe194('0xa1')]);this[_0xe194('0x79')](_0x26f13c,_0x26f13c[_0xe194('0x8c')],_0x26f13c[_0xe194('0x132')]);}}};Preview[_0xe194('0xf')]['syncDialEnd']=function(_0xc2e551){if(this[_0xe194('0x48')][_0xc2e551[_0xe194('0xd9')]]&&_0xc2e551[_0xe194('0xd9')]!==_0xc2e551[_0xe194('0x138')]){this['callProgressDetectingCustomer'](_0xc2e551,_0xc2e551[_0xe194('0xd9')],_0xc2e551[_0xe194('0xd1')]);}};Preview['prototype'][_0xe194('0x1d')]=function(_0x2ceaaa){if(this[_0xe194('0x48')][_0x2ceaaa[_0xe194('0x8c')]]&&_0x2ceaaa[_0xe194('0x8c')]!==_0x2ceaaa[_0xe194('0x90')]&&!this['actions'][_0x2ceaaa[_0xe194('0x8c')]][_0xe194('0x4d')]){if(_0x2ceaaa[_0xe194('0x132')]==='1'){this[_0xe194('0x79')](_0x2ceaaa,_0x2ceaaa[_0xe194('0x8c')],_0x2ceaaa['cause']);}}};Preview['prototype'][_0xe194('0x139')]=function(_0x17047c,_0x360d6a,_0x1e10f1){if(this[_0xe194('0x48')][_0x17047c]){if(_['isNil'](this[_0xe194('0x48')][_0x17047c]['variables'])){this[_0xe194('0x48')][_0x17047c][_0xe194('0x126')]={};}this['actions'][_0x17047c]['variables'][_0x360d6a]=_0x1e10f1;}};Preview[_0xe194('0xf')][_0xe194('0x21')]=function(_0x3cc3d2){try{if(!_[_0xe194('0x47')](_0x3cc3d2)){if(ut[_0xe194('0x13a')](_['keys'](_0x3cc3d2[_0xe194('0x13b')])[0x0])){this[_0xe194('0x139')](_0x3cc3d2[_0xe194('0x90')],_['keys'](_0x3cc3d2[_0xe194('0x13b')])[0x0],_0x3cc3d2[_0xe194('0x13c')]);}}}catch(_0x26a2ad){logger[_0xe194('0x13d')](_0xe194('0x13e'),util[_0xe194('0x13f')](_0x26a2ad,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0x359190){if(_0x359190){if(this[_0xe194('0x48')][_0x359190['transfertargetlinkedid']]){this[_0xe194('0x48')][_0x359190['transfertargetlinkedid']][_0xe194('0x135')]=!![];}}};Preview[_0xe194('0xf')][_0xe194('0x25')]=function(_0x19bf18){if(_0x19bf18){if(this[_0xe194('0x48')][_0x19bf18['transfererlinkedid']]){this[_0xe194('0x48')][_0x19bf18[_0xe194('0x140')]][_0xe194('0x135')]=!![];}}};module[_0xe194('0x141')]=Preview; \ No newline at end of file +var _0xd44c=['trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','syncHangup','hanguprequest','dialend','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','available','paused','message','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','loopCampaigns','syncCampaigns','hasOwnProperty','dialMethod','type','outbound','clearZombieChannels','setMessage','clearZombieChannel','sequence','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','stringify','pTalking:\x20','pTalking','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','catch','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','size','recallMe','agentReadyId','then','length','getDiff','dialRecallMeTimeout','Agent','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','dialActive','isTrunkReachable','Trunk','TrunkBackup','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','custom:agentnosuchnumber','nosuchnumber','verifyAdditionalPhones','additional','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','activeContact','linkedid','actioncountonusuch','incrementPreviewCounters','idContact','swapAdditionalPhones','format','\x20Queue','buildObj','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','uniqueid','BUSY','outboundBusyCallsDay','Busy','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','[callProgressDetectingCustomer][logBusy]','scheduledAt','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','rescheduleContact','dialNoAnswerRetryFrequency','unlockAgent','CONGESTION','outboundCongestionCallsDay','countcongestionretry','dialCongestionRetryFrequency','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','dialstatus','amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','custom:amd','[callProgressDetectingCustomer][machine]','[default]','outboundUnknownCallsDay','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','ANSWER','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','reason','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','Congestion','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','updateOriginated','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','Contact\x20in\x20black\x20List','active','SIP/%s','unmonitored','execRun','unlockContact','getContactPreview','recallme','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','validateContact','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','Trunk\x20not\x20working\x20correctly','isActive','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','getCallerId','callerid','dialOriginateCallerIdName','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','setXMDContactVariables','assign','merge','toLowerVariables','variables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','logLookAgent','clone','responsetime','isFailure','response','custom:agentringnoanswer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','transfer','[syncHangup][talking][transfer]','syncDialEnd','destuniqueid','syncHangupRequest','addVariable','keys','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','uuid','ioredis','../../../config/environment','../../../config/logger','preview','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','../dialer/utils','redis','defaults','prototype','enqueue','tail','campaignsPreview','voiceQueues'];(function(_0x15a634,_0x4feb86){var _0xf4f7a0=function(_0x31d9fe){while(--_0x31d9fe){_0x15a634['push'](_0x15a634['shift']());}};_0xf4f7a0(++_0x4feb86);}(_0xd44c,0x12b));var _0xcd44=function(_0x2a7b8e,_0x50ffce){_0x2a7b8e=_0x2a7b8e-0x0;var _0x29b5c8=_0xd44c[_0x2a7b8e];return _0x29b5c8;};'use strict';var util=require(_0xcd44('0x0'));var _=require('lodash');var uuid=require(_0xcd44('0x1'));var moment=require('moment');var Redis=require(_0xcd44('0x2'));var config=require(_0xcd44('0x3'));var logger=require(_0xcd44('0x4'))(_0xcd44('0x5'));var loggerAction=require('../../../config/logger')('actionPreview');var ami=require('../ami');var rpcDb=require(_0xcd44('0x6'));var cmHopperAdditionalPhone=require(_0xcd44('0x7'));var Action=require(_0xcd44('0x8'));var ut=require(_0xcd44('0x9'));var utils=require(_0xcd44('0xa'));config[_0xcd44('0xb')]=_[_0xcd44('0xc')](config[_0xcd44('0xb')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xcd44('0xd')][_0xcd44('0xe')]=function(_0x3af1cb){this[_0xcd44('0xf')]=this[_0xcd44('0xf')]?this[_0xcd44('0xf')]['finally'](_0x3af1cb):_0x3af1cb();};function Preview(_0x10b56a){this['sequence']=new Sequence();this[_0xcd44('0x10')]=_0x10b56a[_0xcd44('0x11')];this['trunks']=_0x10b56a[_0xcd44('0x12')];this[_0xcd44('0x13')]={};this[_0xcd44('0x14')]=_0x10b56a[_0xcd44('0x14')];this[_0xcd44('0x15')]=0x0;ami['on'](_0xcd44('0x16'),this[_0xcd44('0x17')][_0xcd44('0x18')](this));ami['on']('hangup',this[_0xcd44('0x19')][_0xcd44('0x18')](this));ami['on'](_0xcd44('0x1a'),this['syncHangupRequest']['bind'](this));ami['on'](_0xcd44('0x1b'),this['syncDialEnd']['bind'](this));ami['on'](_0xcd44('0x1c'),this[_0xcd44('0x1d')][_0xcd44('0x18')](this));ami['on'](_0xcd44('0x1e'),this[_0xcd44('0x1f')][_0xcd44('0x18')](this));ami['on'](_0xcd44('0x20'),this[_0xcd44('0x21')][_0xcd44('0x18')](this));ami['on'](_0xcd44('0x22'),this[_0xcd44('0x23')][_0xcd44('0x18')](this));this['loopCampaigns'](this['campaignsPreview']);}function emit(_0x378be2,_0x7d22a8,_0x25ada9){io['to'](_0x378be2)[_0xcd44('0x24')](_0x7d22a8,_0x25ada9);}function emitVoiceQueueChannelRemove(_0x477fe9){logger[_0xcd44('0x25')](_0xcd44('0x26'),JSON['stringify'](_0x477fe9));emit(util['format'](_0xcd44('0x27'),_0x477fe9[_0xcd44('0x28')]),_0xcd44('0x29'),_0x477fe9);io['emit'](_0xcd44('0x2a'),_0x477fe9);}function notSendMessagesQueue(_0x4dc870){if(_0x4dc870[_0xcd44('0x2b')]){if(_0x4dc870[_0xcd44('0x2c')]===0x0&&_0x4dc870['pTalking']===0x0){_0x4dc870[_0xcd44('0x2b')]=![];_0x4dc870[_0xcd44('0x2d')]=0x0;_0x4dc870[_0xcd44('0x2e')]=0x0;_0x4dc870[_0xcd44('0x2f')]=utils[_0xcd44('0x30')][_0xcd44('0x31')];ut[_0xcd44('0x32')](_0xcd44('0x33'),_0x4dc870[_0xcd44('0x28')]+_0xcd44('0x34'));}else{_0x4dc870[_0xcd44('0x2f')]=utils[_0xcd44('0x30')]['DEACTIVATED'];ut[_0xcd44('0x32')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x4dc870[_0xcd44('0x28')]+'\x20is\x20deactivated');}}}Preview['prototype'][_0xcd44('0x35')]=function(){var _0x22de0a=this;setInterval(function(){_0x22de0a[_0xcd44('0x36')]();},0x7cf);};Preview[_0xcd44('0xd')]['syncCampaigns']=function(){var _0xd8eaef=this[_0xcd44('0x10')];this['clockClearZombieChannels']+=0x1;for(var _0x4c18ec in _0xd8eaef){if(_0xd8eaef[_0xcd44('0x37')](_0x4c18ec)&&(_0xd8eaef[_0x4c18ec][_0xcd44('0x38')]==='preview'||_0xd8eaef[_0x4c18ec]['dialMethod']==='booked')&&_0xd8eaef[_0x4c18ec][_0xcd44('0x39')]===_0xcd44('0x3a')){if(this[_0xcd44('0x15')]>0x7){this[_0xcd44('0x15')]=0x0;this[_0xcd44('0x3b')]();}}if(_0xd8eaef[_0xcd44('0x37')](_0x4c18ec)&&_0xd8eaef[_0x4c18ec][_0xcd44('0x38')]==='preview'&&_0xd8eaef[_0x4c18ec][_0xcd44('0x39')]===_0xcd44('0x3a')){if(_0xd8eaef[_0x4c18ec]['dialActive']){this[_0xcd44('0x3c')](_0xd8eaef[_0x4c18ec]);if(_0xd8eaef[_0x4c18ec]['dialPreviewAutoRecallMe'])this['recallMe'](_0xd8eaef[_0x4c18ec]);}else{notSendMessagesQueue(_0xd8eaef[_0x4c18ec]);}}}};Preview[_0xcd44('0xd')][_0xcd44('0x3d')]=function(_0x4349e1){var _0x22b71c=this;this[_0xcd44('0x3e')][_0xcd44('0xe')](function(){if(!_[_0xcd44('0x3f')](_0x22b71c[_0xcd44('0x13')][_0x4349e1])){loggerAction['info'](_0xcd44('0x40'),_0x4349e1,_0xcd44('0x41'),_0x22b71c[_0xcd44('0x13')][_0x4349e1][_0xcd44('0x42')],_0xcd44('0x43'),JSON[_0xcd44('0x44')](_0x22b71c[_0xcd44('0x10')][_0x22b71c[_0xcd44('0x13')][_0x4349e1][_0xcd44('0x42')]][_0xcd44('0x2c')]),_0xcd44('0x45'),JSON[_0xcd44('0x44')](_0x22b71c[_0xcd44('0x10')][_0x22b71c[_0xcd44('0x13')][_0x4349e1][_0xcd44('0x42')]][_0xcd44('0x46')]),JSON[_0xcd44('0x44')](_0x22b71c[_0xcd44('0x13')][_0x4349e1][_0xcd44('0x47')]),JSON['stringify'](_[_0xcd44('0x48')](_0x22b71c[_0xcd44('0x13')][_0x4349e1],[_0xcd44('0x49'),_0xcd44('0x4a'),_0xcd44('0x4b'),_0xcd44('0x4c')])));return ami[_0xcd44('0x4d')]({'action':_0xcd44('0x4e'),'channel':_0x22b71c[_0xcd44('0x13')][_0x4349e1][_0xcd44('0x4f')]})[_0xcd44('0x50')](function(_0x309144){if(_0x309144[_0xcd44('0x2f')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x22b71c[_0xcd44('0x13')][_0x4349e1]){ut['updateOriginated'](_0x22b71c['campaignsPreview'][_0x22b71c[_0xcd44('0x13')][_0x4349e1][_0xcd44('0x42')]],_0xcd44('0x51'));if(_0x22b71c[_0xcd44('0x13')][_0x4349e1][_0xcd44('0x47')]===!![]){ut[_0xcd44('0x52')](_0x22b71c[_0xcd44('0x10')][_0x22b71c['actions'][_0x4349e1][_0xcd44('0x42')]],'[clearZombieChannel]');ut[_0xcd44('0x53')](_0xcd44('0x54')+_0x4349e1,_0x22b71c[_0xcd44('0x13')][_0x4349e1][_0xcd44('0x42')]);}ut['loggerError'](_0xcd44('0x55')+_0x4349e1,_0x22b71c['actions'][_0x4349e1][_0xcd44('0x42')]);delete _0x22b71c['actions'][_0x4349e1];}},0x2328);}});}});};Preview[_0xcd44('0xd')][_0xcd44('0x3b')]=function(){var _0x33221d=this;loggerAction[_0xcd44('0x25')]('[action]',_[_0xcd44('0x56')](this[_0xcd44('0x13')]));for(var _0x33c24f in this['actions']){if(_0x33221d['actions'][_0xcd44('0x37')](_0x33c24f)){_0x33221d[_0xcd44('0x3d')](_0x33c24f);}}};Preview[_0xcd44('0xd')][_0xcd44('0x57')]=function(_0x522027){var _0x390131=this;rpcDb['getContactRecallMe'](_0x522027['id'],ut[_0xcd44('0x58')](this[_0xcd44('0x14')]))[_0xcd44('0x59')](function(_0x488146){if(!_[_0xcd44('0x3f')](_0x488146)){for(var _0x22d67b=0x0;_0x22d67b<_0x488146[_0xcd44('0x5a')];_0x22d67b+=0x1){if(ut[_0xcd44('0x5b')](_0x488146[_0x22d67b]['scheduledat'])<_0x522027[_0xcd44('0x5c')]*0x3c){if(_0x488146[_0x22d67b]['Agent']&&!_0x488146[_0x22d67b][_0xcd44('0x5d')]['voicePause']){_0x390131[_0xcd44('0x5e')](_0x488146[_0x22d67b]['id'])[_0xcd44('0x59')](ut[_0xcd44('0x5f')](_0xcd44('0x60')))['catch'](ut[_0xcd44('0x5f')](_0xcd44('0x60')));}else{rpcDb[_0xcd44('0x61')](_0x488146[_0x22d67b]['id']);}}else{var _0x5cbfbb=new Action(_0x488146[_0x22d67b],_0x522027);_0x5cbfbb[_0xcd44('0x62')]=moment()['format'](_0xcd44('0x63'));_0x522027[_0xcd44('0x64')]+=0x1;ut[_0xcd44('0x65')](_0x5cbfbb,0x17,'RecallInQueue');if(_0x522027[_0xcd44('0x66')]){rpcDb[_0xcd44('0x67')](ut[_0xcd44('0x68')](_0x488146[_0x22d67b]));rpcDb[_0xcd44('0x69')](_0x5cbfbb,_0xcd44('0x6a'));}else{ut[_0xcd44('0x65')](_0x5cbfbb,0x16,_0xcd44('0x6b'));rpcDb[_0xcd44('0x69')](_0x5cbfbb,_0xcd44('0x6c'));rpcDb[_0xcd44('0x6d')](_0x5cbfbb,_0xcd44('0x6c'));}}}}})['catch'](ut[_0xcd44('0x5f')](_0xcd44('0x6e')));};Preview[_0xcd44('0xd')][_0xcd44('0x3c')]=function(_0x4959ec){_0x4959ec[_0xcd44('0x2b')]=!![];if(ut[_0xcd44('0x6f')](_0x4959ec['loggedIn'])){_0x4959ec['message']=utils[_0xcd44('0x30')][_0xcd44('0x70')];}else if(!ut['isActive'](_0x4959ec[_0xcd44('0x71')])){_0x4959ec[_0xcd44('0x2f')]=utils['CAMPAIGN_STATUS']['INACTIVE'];}else if(!this[_0xcd44('0x72')](_0x4959ec[_0xcd44('0x73')])){if(!this['isTrunkReachable'](_0x4959ec[_0xcd44('0x74')])){_0x4959ec[_0xcd44('0x2f')]=utils[_0xcd44('0x30')]['UNREACHABLE_TRUNK'];}else{_0x4959ec[_0xcd44('0x2f')]=utils['CAMPAIGN_STATUS']['ACTIVE'];}}else{_0x4959ec[_0xcd44('0x2f')]=utils[_0xcd44('0x30')][_0xcd44('0x75')];}};Preview['prototype'][_0xcd44('0x76')]=function(_0x52fcd5,_0x51d28d,_0x5321bd){var _0x5319f9=this;var _0x31ac06=this[_0xcd44('0x13')][_0x51d28d];var _0x484c76=this['campaignsPreview'][_0x31ac06[_0xcd44('0x42')]];var _0x61464;var _0xa10585=![];var _0x3ba394=0x2;var _0x37d861=0x3;if(_0x484c76){switch(_0x5321bd){case'1':_0x484c76[_0xcd44('0x77')]+=0x1;_0x31ac06[_0xcd44('0x78')]+=0x1;_0x31ac06[_0xcd44('0x79')]=ut[_0xcd44('0x7a')](_0x31ac06);ut['logCustomer'](_0x31ac06,0x0,'NoSuchNumber');ami[_0xcd44('0x24')](_0xcd44('0x7b'),ut['buildObj'](_0x31ac06,_0xcd44('0x7c')));rpcDb[_0xcd44('0x69')](_0x31ac06,'[callProgressDetectingCustomer][logNoSuch]');_0x5319f9[_0xcd44('0x7d')](_0x31ac06,'0',_0x484c76)[_0xcd44('0x59')](function(_0x232a7e){_0xa10585=_0x232a7e[_0xcd44('0x7e')]==0x1;_0x3ba394=_0x484c76['dialNoSuchNumberRetryFrequency'];_0x37d861=_0x484c76[_0xcd44('0x7f')];if(!_0xa10585){if(ut[_0xcd44('0x7a')](_0x31ac06)>=_0x484c76[_0xcd44('0x80')]){_0x61464=ut[_0xcd44('0x81')](_0x31ac06,0xf,_0xcd44('0x82'));rpcDb[_0xcd44('0x6d')](_0x61464,_0xcd44('0x83'));}else{if(_0x31ac06[_0xcd44('0x78')]>=_0x484c76['dialNoSuchNumberMaxRetry']){rpcDb['createCustomerFinal'](_0x31ac06,_0xcd44('0x83'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x31ac06,'countnosuchnumberretry',_0x484c76['dialNoSuchNumberRetryFrequency']),_0x31ac06['unlockAgent'],_0x31ac06[_0xcd44('0x84')]);}}delete this[_0xcd44('0x13')][_0x52fcd5[_0xcd44('0x85')]];}else{_0x31ac06[_0xcd44('0x78')]++;logger[_0xcd44('0x25')](_0xcd44('0x86'),_0x31ac06['countnosuchnumberretry']);logger[_0xcd44('0x25')]('id',_0x31ac06['idContact']);_0x5319f9[_0xcd44('0x87')]({'id':_0x31ac06[_0xcd44('0x88')],'field':{'countnosuchnumberretry':_0x31ac06[_0xcd44('0x78')]}})[_0xcd44('0x59')](function(){_0x5319f9[_0xcd44('0x89')](_0x31ac06,_0x3ba394,_0x37d861)[_0xcd44('0x59')](function(){});});}});break;case'ANSWER':var _0x25054b=moment()[_0xcd44('0x8a')]('YYYY-MM-DD\x20HH:mm:ss');_0x31ac06['responsetime']=_0x25054b;_0x31ac06['answertime']=_0x25054b;_0x31ac06['dialAnswer']=!![];_0x484c76['pTalking']+=0x1;logger[_0xcd44('0x25')]('[syncHangup][talking][increment]',_0x31ac06['uniqueid'],_0xcd44('0x8b'),_0x484c76[_0xcd44('0x28')],_0xcd44('0x45'),_0x484c76['pTalking']);ami[_0xcd44('0x24')]('custom:agentconnect',ut[_0xcd44('0x8c')](_0x31ac06,'connect',this[_0xcd44('0x10')][_0x31ac06[_0xcd44('0x42')]]));if(_0x484c76[_0xcd44('0x8d')]){ami[_0xcd44('0x24')](_0xcd44('0x8e'),ut[_0xcd44('0x8f')](_0x31ac06));}break;case'16':ami[_0xcd44('0x24')](_0xcd44('0x90'),ut[_0xcd44('0x8c')](_0x31ac06,_0xcd44('0x91'),this[_0xcd44('0x10')][_0x31ac06['queue']]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x31ac06,_0xcd44('0x91')));_0x484c76[_0xcd44('0x92')]+=0x1;_0x484c76['total']+=0x1;_0x484c76[_0xcd44('0x93')]+=0x1;ut[_0xcd44('0x52')](_0x484c76,_0xcd44('0x94'));_0x31ac06['countglobal']=ut[_0xcd44('0x7a')](_0x31ac06);ut[_0xcd44('0x65')](_0x31ac06,0x4,_0xcd44('0x95'));rpcDb[_0xcd44('0x69')](_0x31ac06,_0xcd44('0x96'));rpcDb['createCustomerFinal'](_0x31ac06,_0xcd44('0x97'));rpcDb[_0xcd44('0x98')](_0x31ac06);_0x484c76[_0xcd44('0x99')]+=_0x31ac06[_0xcd44('0x9a')];_0x484c76[_0xcd44('0x9b')]+=_0x31ac06[_0xcd44('0x9a')];logger[_0xcd44('0x25')](_0xcd44('0x9c'),_0x31ac06[_0xcd44('0x9d')],'\x20Queue',_0x484c76[_0xcd44('0x28')],_0xcd44('0x45'),_0x484c76['pTalking']);delete this[_0xcd44('0x13')][_0x52fcd5[_0xcd44('0x85')]];break;case _0xcd44('0x9e'):_0x484c76[_0xcd44('0x9f')]+=0x1;_0x31ac06['countbusyretry']+=0x1;_0x31ac06[_0xcd44('0x79')]=ut[_0xcd44('0x7a')](_0x31ac06);ut[_0xcd44('0x65')](_0x31ac06,0x5,_0xcd44('0xa0'));_0x3ba394=_0x484c76[_0xcd44('0xa1')];_0x37d861=_0x484c76[_0xcd44('0x7f')];ami[_0xcd44('0x24')](_0xcd44('0xa2'),ut[_0xcd44('0x8c')](_0x31ac06,_0xcd44('0xa3')));rpcDb[_0xcd44('0x69')](_0x31ac06,'[callProgressDetectingCustomer][logBusy]');_0x5319f9[_0xcd44('0x7d')](_0x31ac06,'5',_0x484c76)[_0xcd44('0x59')](function(_0x52aa8b){_0xa10585=_0x52aa8b['additional']==0x1;if(!_0xa10585){if(ut[_0xcd44('0x7a')](_0x31ac06)>=_0x484c76[_0xcd44('0x80')]){_0x61464=ut[_0xcd44('0x81')](_0x31ac06,0xf,_0xcd44('0x82'));rpcDb['createCustomerFinal'](_0x61464,_0xcd44('0xa4'));}else{if(_0x31ac06[_0xcd44('0xa5')]>=_0x484c76['dialBusyMaxRetry']){rpcDb[_0xcd44('0x6d')](_0x31ac06,_0xcd44('0xa6'));}else{rpcDb['rescheduleContact'](ut[_0xcd44('0xa7')](_0x31ac06,'countbusyretry',_0x484c76[_0xcd44('0xa1')]),_0x31ac06['unlockAgent'],_0x31ac06[_0xcd44('0x84')]);}}}else{_0x31ac06[_0xcd44('0xa5')]++;_0x5319f9[_0xcd44('0x87')]({'id':_0x31ac06[_0xcd44('0x88')],'field':{'countbusyretry':_0x31ac06[_0xcd44('0xa5')]}})[_0xcd44('0x59')](function(){_0x5319f9[_0xcd44('0x89')](_0x31ac06,_0x3ba394,_0x37d861)[_0xcd44('0x59')](function(){});});}});break;case _0xcd44('0xa8'):_0x484c76[_0xcd44('0xa9')]+=0x1;_0x31ac06[_0xcd44('0xaa')]+=0x1;_0x31ac06[_0xcd44('0x79')]=ut[_0xcd44('0x7a')](_0x31ac06);ut[_0xcd44('0x65')](_0x31ac06,0x3,_0xcd44('0xab'));_0x3ba394=_0x484c76['dialNoAnswerRetryFrequency'];_0x37d861=_0x484c76[_0xcd44('0x7f')];var _0x954a21=ut[_0xcd44('0xac')](_0x31ac06,_0x484c76);ami[_0xcd44('0x24')](_0xcd44('0xad'),_0x954a21);rpcDb[_0xcd44('0x69')](_0x31ac06,'[callProgressDetectingCustomer][logNoAnswer]');_0x5319f9[_0xcd44('0x7d')](_0x31ac06,'3',_0x484c76)[_0xcd44('0x59')](function(_0x4fbfa5){_0xa10585=_0x4fbfa5['additional']==0x1;if(!_0xa10585){if(ut[_0xcd44('0x7a')](_0x31ac06)>=_0x484c76[_0xcd44('0x80')]){_0x61464=ut[_0xcd44('0x81')](_0x31ac06,0xf,_0xcd44('0x82'));rpcDb[_0xcd44('0x6d')](_0x61464,_0xcd44('0xae'));}else{if(_0x31ac06['countnoanswerretry']>=_0x484c76[_0xcd44('0xaf')]){rpcDb[_0xcd44('0x6d')](_0x31ac06,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0xcd44('0xb0')](ut[_0xcd44('0xa7')](_0x31ac06,'countnoanswerretry',_0x484c76[_0xcd44('0xb1')]),_0x31ac06[_0xcd44('0xb2')],_0x31ac06[_0xcd44('0x84')]);}}}else{_0x31ac06['countnoanswerretry']++;_0x5319f9[_0xcd44('0x87')]({'id':_0x31ac06[_0xcd44('0x88')],'field':{'countnoanswerretry':_0x31ac06[_0xcd44('0xaa')]}})['then'](function(){_0x5319f9['swapAdditionalPhones'](_0x31ac06,_0x3ba394,_0x37d861)[_0xcd44('0x59')](function(){});});}});break;case _0xcd44('0xb3'):_0x484c76[_0xcd44('0xb4')]+=0x1;_0x31ac06[_0xcd44('0xb5')]+=0x1;_0x31ac06['countglobal']=ut[_0xcd44('0x7a')](_0x31ac06);ut[_0xcd44('0x65')](_0x31ac06,0x8,'Congestion');_0x3ba394=_0x484c76[_0xcd44('0xb6')];_0x37d861=_0x484c76[_0xcd44('0x7f')];ami[_0xcd44('0x24')]('custom:agentcongestion',ut['buildObj'](_0x31ac06,_0xcd44('0xb7')));rpcDb[_0xcd44('0x69')](_0x31ac06,'[callProgressDetectingCustomer][logCongestion]');_0x5319f9[_0xcd44('0x7d')](_0x31ac06,'8',_0x484c76)[_0xcd44('0x59')](function(_0x2498a8){_0xa10585=_0x2498a8[_0xcd44('0x7e')]==0x1;if(!_0xa10585){if(ut[_0xcd44('0x7a')](_0x31ac06)>=_0x484c76[_0xcd44('0x80')]){_0x61464=ut[_0xcd44('0x81')](_0x31ac06,0xf,_0xcd44('0x82'));rpcDb['createCustomerFinal'](_0x61464,_0xcd44('0xb8'));}else{if(_0x31ac06[_0xcd44('0xb5')]>=_0x484c76[_0xcd44('0xb9')]){rpcDb[_0xcd44('0x6d')](_0x31ac06,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0xcd44('0xb0')](ut['scheduledAt'](_0x31ac06,_0xcd44('0xb5'),_0x484c76[_0xcd44('0xa1')]),_0x31ac06[_0xcd44('0xb2')],_0x31ac06[_0xcd44('0x84')]);}}}else{_0x31ac06[_0xcd44('0xb5')]++;_0x5319f9['incrementPreviewCounters']({'id':_0x31ac06[_0xcd44('0x88')],'field':{'countcongestionretry':_0x31ac06[_0xcd44('0xb5')]}})[_0xcd44('0x59')](function(){_0x5319f9[_0xcd44('0x89')](_0x31ac06,_0x3ba394,_0x37d861)['then'](function(){});});}});break;case'CANCEL':_0x484c76['outboundRejectCallsDay']+=0x1;_0x31ac06[_0xcd44('0xba')]+=0x1;_0x31ac06[_0xcd44('0x79')]=ut[_0xcd44('0x7a')](_0x31ac06);ut['logCustomer'](_0x31ac06,0x14,_0xcd44('0xbb'));_0x3ba394=_0x484c76['dialAgentRejectRetryFrequency'];_0x37d861=_0x484c76['callAdditionalPhoneAfterMin'];ami['emit'](_0xcd44('0xbc'),ut['buildObj'](_0x31ac06,_0xcd44('0xbd')));rpcDb[_0xcd44('0x69')](_0x31ac06,_0xcd44('0xbe'));_0x5319f9['verifyAdditionalPhones'](_0x31ac06,'20',_0x484c76)[_0xcd44('0x59')](function(_0x460d43){_0xa10585=_0x460d43[_0xcd44('0x7e')]==0x1;if(!_0xa10585){if(ut['totalGlobal'](_0x31ac06)>=_0x484c76[_0xcd44('0x80')]){_0x61464=ut[_0xcd44('0x81')](_0x31ac06,0x14,_0xcd44('0xbb'));rpcDb[_0xcd44('0x6d')](_0x61464,_0xcd44('0xbf'));}else{if(_0x31ac06[_0xcd44('0xba')]>=_0x484c76['dialAgentRejectMaxRetry']){rpcDb[_0xcd44('0x6d')](_0x31ac06,_0xcd44('0xbf'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x31ac06,_0xcd44('0xba'),_0x484c76['dialAgentRejectRetryFrequency']),_0x31ac06[_0xcd44('0xb2')],_0x31ac06['activeContact']);}}}else{_0x31ac06[_0xcd44('0xaa')]++;_0x5319f9[_0xcd44('0x87')]({'id':_0x31ac06[_0xcd44('0x88')],'field':{'countnoanswerretry':_0x31ac06[_0xcd44('0xaa')]}})['then'](function(){_0x5319f9['swapAdditionalPhones'](_0x31ac06,_0x3ba394,_0x37d861)['then'](function(){});});}});break;case _0xcd44('0xc0'):_0x484c76['outboundAbandonedCallsDay']+=0x1;_0x31ac06[_0xcd44('0xc1')]+=0x1;_0x31ac06[_0xcd44('0x79')]=ut['totalGlobal'](_0x31ac06);ut[_0xcd44('0x65')](_0x31ac06,0xb,_0xcd44('0xc2'));rpcDb[_0xcd44('0x69')](_0x31ac06,'[callProgressDetectingCustomer][logAbandoned]');_0x5319f9[_0xcd44('0x7d')](_0x31ac06,'11',_0x484c76)[_0xcd44('0x59')](function(_0x166248){_0xa10585=_0x166248[_0xcd44('0x7e')]==0x1;if(!_0xa10585){if(ut[_0xcd44('0x7a')](_0x31ac06)>=_0x484c76[_0xcd44('0x80')]){_0x61464=ut['cloneAction'](_0x31ac06,0xf,_0xcd44('0x82'));rpcDb[_0xcd44('0x6d')](_0x61464,_0xcd44('0xc3'));}else{if(_0x31ac06[_0xcd44('0xc4')]>=_0x484c76[_0xcd44('0xc5')]){rpcDb['createCustomerFinal'](_0x31ac06,_0xcd44('0xc3'));}else{rpcDb[_0xcd44('0xb0')](ut[_0xcd44('0xa7')](_0x31ac06,_0xcd44('0xc1'),_0x484c76[_0xcd44('0xc6')]),_0x31ac06['unlockAgent'],_0x31ac06[_0xcd44('0x84')]);}}}else{_0x31ac06[_0xcd44('0xaa')]++;_0x5319f9[_0xcd44('0x87')]({'id':_0x31ac06[_0xcd44('0x88')],'field':{'countnoanswerretry':_0x31ac06[_0xcd44('0xaa')]}})['then'](function(){_0x5319f9[_0xcd44('0x89')](_0x31ac06,_0x3ba394,_0x37d861)[_0xcd44('0x59')](function(){});});}});break;case'18':_0x484c76['outboundUnknownCallsDay']+=0x1;_0x31ac06[_0xcd44('0xc7')]+=0x1;_0x31ac06[_0xcd44('0x79')]=ut['totalGlobal'](_0x31ac06);ut[_0xcd44('0x65')](_0x31ac06,0x12,_0x52fcd5['cause-txt']||_0x52fcd5[_0xcd44('0xc8')]);ami[_0xcd44('0x24')]('custom:amd',ut[_0xcd44('0x8c')](_0x31ac06,_0xcd44('0xc9')));rpcDb[_0xcd44('0x69')](_0x31ac06,'[callProgressDetectingCustomer][hangupInAMD]');_0x5319f9['verifyAdditionalPhones'](_0x31ac06,'18',_0x484c76)[_0xcd44('0x59')](function(_0x1cf6a3){_0xa10585=_0x1cf6a3[_0xcd44('0x7e')]==0x1;if(!_0xa10585){if(ut[_0xcd44('0x7a')](_0x31ac06)>=_0x484c76[_0xcd44('0x80')]){_0x61464=ut[_0xcd44('0x81')](_0x31ac06,0x12,'Global');rpcDb['createCustomerFinal'](_0x61464,_0xcd44('0xca'));}else{rpcDb[_0xcd44('0x6d')](_0x31ac06,_0xcd44('0xca'));}}else{_0x31ac06[_0xcd44('0xaa')]++;_0x5319f9[_0xcd44('0x87')]({'id':_0x31ac06[_0xcd44('0x88')],'field':{'countnoanswerretry':_0x31ac06[_0xcd44('0xaa')]}})['then'](function(){_0x5319f9[_0xcd44('0x89')](_0x31ac06,_0x3ba394,_0x37d861)['then'](function(){});});}});delete this[_0xcd44('0x13')][_0x52fcd5[_0xcd44('0x85')]];break;case'19':_0x484c76['outboundUnknownCallsDay']+=0x1;_0x31ac06['countglobal']=ut['totalGlobal'](_0x31ac06);ut[_0xcd44('0x65')](_0x31ac06,0x13,_0x52fcd5[_0xcd44('0xcb')]||_0x52fcd5[_0xcd44('0xc8')]);ami[_0xcd44('0x24')](_0xcd44('0xcc'),ut['buildObj'](_0x31ac06,_0xcd44('0xc9')));rpcDb[_0xcd44('0x69')](_0x31ac06,_0xcd44('0xcd'));_0x5319f9['verifyAdditionalPhones'](_0x31ac06,'18',_0x484c76)[_0xcd44('0x59')](function(_0x4bc283){_0xa10585=_0x4bc283[_0xcd44('0x7e')]==0x1;if(!_0xa10585){if(ut[_0xcd44('0x7a')](_0x31ac06)>=_0x484c76[_0xcd44('0x80')]){_0x61464=ut['cloneAction'](_0x31ac06,0xf,_0xcd44('0x82'));rpcDb[_0xcd44('0x6d')](_0x61464,_0xcd44('0xcd'));}else{rpcDb['createCustomerFinal'](_0x31ac06,_0xcd44('0xcd'));}}else{_0x31ac06['countnoanswerretry']++;_0x5319f9[_0xcd44('0x87')]({'id':_0x31ac06['idContact'],'field':{'countnoanswerretry':_0x31ac06['countnoanswerretry']}})['then'](function(){_0x5319f9[_0xcd44('0x89')](_0x31ac06,_0x3ba394,_0x37d861)[_0xcd44('0x59')](function(){});});}});delete this['actions'][_0x52fcd5[_0xcd44('0x85')]];break;default:if(_0x31ac06[_0xcd44('0x47')]){ut[_0xcd44('0x52')](_0x484c76,_0xcd44('0xce'));ut['loggerError']('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x484c76[_0xcd44('0x28')],_0x52fcd5);}_0x484c76[_0xcd44('0xcf')]+=0x1;_0x31ac06[_0xcd44('0x79')]=ut['totalGlobal'](_0x31ac06);ut[_0xcd44('0x65')](_0x31ac06,0xc,_0x52fcd5[_0xcd44('0xcb')]||_0x52fcd5[_0xcd44('0xc8')]);_0x3ba394=_0x484c76['dialAgentRejectRetryFrequency'];_0x37d861=_0x484c76['callAdditionalPhoneAfterMin'];rpcDb['createCustomerHistory'](_0x31ac06,'[callProgressDetectingCustomer][logUnknown]');_0x5319f9['verifyAdditionalPhones'](_0x31ac06,'20',_0x484c76)['then'](function(_0x5b60b3){_0xa10585=_0x5b60b3[_0xcd44('0x7e')]==0x1;if(!_0xa10585){if(ut[_0xcd44('0x7a')](_0x31ac06)>=_0x484c76[_0xcd44('0x80')]){_0x61464=ut[_0xcd44('0x81')](_0x31ac06,0xf,_0xcd44('0x82'));rpcDb['createCustomerFinal'](_0x61464,_0xcd44('0xd0'));}else{rpcDb[_0xcd44('0x6d')](_0x31ac06,_0xcd44('0xd0'));}delete this['actions'][_0x52fcd5[_0xcd44('0x85')]];}else{_0x5319f9[_0xcd44('0x89')](_0x31ac06,_0x3ba394,_0x37d861)[_0xcd44('0x59')](function(){});}});}if(!(_0x31ac06[_0xcd44('0x47')]&&_0x5321bd==='16')){ut['updateOriginated'](_0x484c76,_0xcd44('0xd1'));logger['info']('[originated][decrement][callProgressDetectingCustomer]',_0x31ac06[_0xcd44('0x9d')],_0xcd44('0x8b'),_0x484c76['name'],_0xcd44('0x43'),_0x484c76[_0xcd44('0x2c')]);}if(_0x5321bd!==_0xcd44('0xd2')){delete this['actions'][_0x52fcd5[_0xcd44('0x85')]];delete this[_0xcd44('0x13')][_0x52fcd5[_0xcd44('0xd3')]];}_0x484c76[_0xcd44('0xd4')]=!![];}};Preview[_0xcd44('0xd')][_0xcd44('0xd5')]=function(_0x13622f,_0x1df894,_0x574108){if(_[_0xcd44('0xd6')](_0x1df894)&&_0xcd44('0xd7')!==typeof _0x1df894){return;}if(_['isUndefined'](_0x574108)&&_0xcd44('0xd7')!==typeof _0x574108){return;}switch(_0x574108[_0xcd44('0xd8')]){case'0':ut['logAgent'](_0x13622f,0x0,_0xcd44('0xd9'));rpcDb[_0xcd44('0xda')](_0x13622f,_0xcd44('0xdb'));break;case'3':ut[_0xcd44('0xdc')](_0x13622f,0x3,_0xcd44('0xab'));rpcDb[_0xcd44('0xda')](_0x13622f,_0xcd44('0xdd'));break;case'5':ut['logAgent'](_0x13622f,0x5,_0xcd44('0xa0'));rpcDb['createAgentHistory'](_0x13622f,_0xcd44('0xde'));break;case'8':ut[_0xcd44('0xdc')](_0x13622f,0x8,_0xcd44('0xdf'));rpcDb[_0xcd44('0xda')](_0x13622f,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0xcd44('0xdc')](_0x13622f,0x16,_0xcd44('0xe0'));rpcDb['createAgentHistory'](_0x13622f,_0xcd44('0xe1'));break;default:ut[_0xcd44('0xdc')](_0x13622f,0xc,_0x574108[_0xcd44('0xd8')]);rpcDb[_0xcd44('0xda')](_0x13622f,_0xcd44('0xe2'));}ut[_0xcd44('0xe3')](_0x1df894,'[callProgressDetectingAgent]');logger[_0xcd44('0x25')](_0xcd44('0xe4'),_0x13622f['uniqueid'],_0xcd44('0x8b'),_0x1df894['name'],'originated:\x20',_0x1df894[_0xcd44('0x2c')]);delete this[_0xcd44('0x13')][_0x13622f['uniqueid']];};Preview[_0xcd44('0xd')]['verifyAdditionalPhones']=function(_0x56f68f,_0x336482,_0x49e72e){return cmHopperAdditionalPhone[_0xcd44('0x7d')](_0x56f68f,_0x336482,_0x49e72e)['catch'](logger[_0xcd44('0x25')](_0xcd44('0xe5')));};Preview[_0xcd44('0xd')][_0xcd44('0x89')]=function(_0x58224b,_0x4809e1,_0x45a3f1){return cmHopperAdditionalPhone[_0xcd44('0x89')](_0x58224b,_0x4809e1,_0x45a3f1)[_0xcd44('0x50')](logger['info'](_0xcd44('0xe6')));};Preview[_0xcd44('0xd')][_0xcd44('0x87')]=function(_0x2303eb){return Promise[_0xcd44('0xe7')]()[_0xcd44('0x59')](cmHopperAdditionalPhone[_0xcd44('0x87')](_0x2303eb))[_0xcd44('0x50')](logger[_0xcd44('0x25')]('[incrementPreviewCounters]\x20'));};Preview[_0xcd44('0xd')][_0xcd44('0xe8')]=function(_0x37f75c,_0x4c8ad0,_0x5ce81b,_0x4d3b1e,_0x27998c){var _0x408a03=this;return new Promise(function(_0x1c4f53,_0x46c81b){if(_[_0xcd44('0x3f')](_0x4c8ad0)||_['isNil'](_0x4c8ad0[_0xcd44('0xe9')])||_[_0xcd44('0x3f')](_0x4c8ad0[_0xcd44('0xea')])||_[_0xcd44('0x3f')](_0x4c8ad0[_0xcd44('0x4b')])){_0x46c81b(ut[_0xcd44('0x2f')](_0xcd44('0xeb'),_0x4d3b1e,_0x27998c));return;}var _0x511825=uuid['v4']();var _0x4d55f8=_0x408a03['campaignsPreview'][_0x4c8ad0[_0xcd44('0x41')][_0xcd44('0x28')]];var _0xe316ff=_0x5ce81b?_0x408a03['agents'][_0x5ce81b]['id']:undefined;_0x408a03[_0xcd44('0x13')][_0x511825]=new Action(_0x4c8ad0,_0x4d55f8,_0x511825,_0x5ce81b,_0xe316ff);var _0x22fc4c=_0x408a03[_0xcd44('0x13')][_0x511825];_0x22fc4c['unlockAgent']=_0x4d3b1e;_0x22fc4c[_0xcd44('0x84')]=_0x27998c;_0x22fc4c[_0xcd44('0xec')]=_0x5ce81b;if(_[_0xcd44('0xed')](_0x37f75c)){_0x408a03[_0xcd44('0xee')](_0x22fc4c,_0x4d55f8,_0x4c8ad0,_0x5ce81b)[_0xcd44('0x59')](function(_0xf54bbb){logger[_0xcd44('0x25')]('[Preview][execCall][success]',_0xcd44('0xef')+_0x22fc4c['queue']+_0xcd44('0xf0')+_0x22fc4c[_0xcd44('0x88')],JSON['stringify'](_0xf54bbb));ami['emit'](_0xcd44('0xf1'),ut[_0xcd44('0x8c')](_0x22fc4c,'called',_0x408a03[_0xcd44('0x10')][_0x22fc4c[_0xcd44('0x42')]]));_0x1c4f53(ut['message'](_0xcd44('0xf2')));})[_0xcd44('0x50')](function(_0x5121cf){ut[_0xcd44('0x32')](_0xcd44('0xf3'),_0x5121cf);_0x46c81b(ut[_0xcd44('0x2f')](_0xcd44('0xf4'),_0x4d3b1e,_0x27998c));});}else{_0x4d55f8[_0xcd44('0xf5')]+=0x1;ut[_0xcd44('0xf6')](_0x22fc4c);rpcDb['createHistory'](_0x22fc4c,'[Blacklist][error]');delete _0x408a03[_0xcd44('0x13')][_0x511825];_0x46c81b(ut[_0xcd44('0x2f')](_0xcd44('0xf7'),_0x4d3b1e,_0x27998c));}});};Preview[_0xcd44('0xd')][_0xcd44('0x72')]=function(_0x591bb6){return!_[_0xcd44('0x3f')](_0x591bb6)&&!_['isNil'](_0x591bb6[_0xcd44('0x28')])&&!_[_0xcd44('0x3f')](_0x591bb6[_0xcd44('0xf8')])&&_0x591bb6[_0xcd44('0xf8')]&&!_[_0xcd44('0x3f')](this[_0xcd44('0x12')][util[_0xcd44('0x8a')](_0xcd44('0xf9'),_0x591bb6[_0xcd44('0x28')])])&&!_['isNil'](this[_0xcd44('0x12')][util[_0xcd44('0x8a')](_0xcd44('0xf9'),_0x591bb6[_0xcd44('0x28')])][_0xcd44('0x4e')])&&(this[_0xcd44('0x12')][util[_0xcd44('0x8a')](_0xcd44('0xf9'),_0x591bb6[_0xcd44('0x28')])][_0xcd44('0x4e')]==='reachable'||this[_0xcd44('0x12')][util[_0xcd44('0x8a')](_0xcd44('0xf9'),_0x591bb6[_0xcd44('0x28')])]['status']===_0xcd44('0xfa'));};Preview[_0xcd44('0xd')]['run']=function(_0x582811,_0x21a85d){return this[_0xcd44('0xfb')](_0x582811,_0x21a85d)[_0xcd44('0x59')](function(_0x5c0525){return _['pick'](_0x5c0525,['message']);})[_0xcd44('0x50')](function(_0x19caf7){if(_0x19caf7['unlock']){rpcDb[_0xcd44('0xfc')](_0x582811);}if(_0x19caf7[_0xcd44('0xf8')]){rpcDb[_0xcd44('0x61')](_0x582811);}throw _[_0xcd44('0x48')](_0x19caf7,[_0xcd44('0x2f')]);});};Preview[_0xcd44('0xd')][_0xcd44('0xfb')]=function(_0x58b8b5,_0x349d94){var _0x263d07=this;var _0x1fd317,_0x3524b1;return rpcDb[_0xcd44('0xfd')](_0x58b8b5)[_0xcd44('0x59')](function(_0x30353e){if(!_[_0xcd44('0x3f')](_0x30353e[0x0])){_0x3524b1=_0x30353e[0x0][_0xcd44('0xfe')]?![]:!![];_0x1fd317=_0x30353e[0x0][_0xcd44('0xfe')]?!![]:![];_0x1fd317=_0x349d94?!![]:_0x1fd317;}var _0x13d1fe=_0x263d07['validateContact'](_0x30353e);if(_0x13d1fe['isValid']){rpcDb[_0xcd44('0xff')](_[_0xcd44('0x48')](_0x30353e[0x0],['VoiceQueueId',_0xcd44('0xea')]))[_0xcd44('0x59')](function(_0x38c7a8){_0x263d07[_0xcd44('0xe8')](_0x38c7a8,_0x30353e[0x0],_0x349d94,_0x3524b1,_0x1fd317)[_0xcd44('0x59')](function(_0x4d1029){return _0x4d1029;})['catch'](function(_0x15b703){throw _0x15b703;});})[_0xcd44('0x50')](function(_0x13f4ab){ut[_0xcd44('0x32')](_0xcd44('0x100'),_0x13f4ab);throw ut[_0xcd44('0x2f')](_0xcd44('0x101'),_0x3524b1,_0x1fd317);});}else{throw ut[_0xcd44('0x2f')](_0x13d1fe[_0xcd44('0x2f')],_0x3524b1,_0x1fd317);}})['catch'](function(_0x378166){ut[_0xcd44('0x32')]('[Preview][getContactPreview]',_0x378166);throw ut[_0xcd44('0x2f')]('Call\x20unsuccessful',![],!![]);});};Preview[_0xcd44('0xd')][_0xcd44('0x102')]=function(_0x5a125e){if(_[_0xcd44('0x3f')](_0x5a125e)||_[_0xcd44('0xed')](_0x5a125e)||!_['isNil'](_0x5a125e[0x0][_0xcd44('0x5d')])&&_['isNil'](_0x5a125e[0x0][_0xcd44('0x5d')][_0xcd44('0x28')])){ut['logger'](_0xcd44('0x103'),_0x5a125e);return{'isValid':![],'message':_0xcd44('0x104')};}var _0x576a48=this['campaignsPreview'][_0x5a125e[0x0][_0xcd44('0x41')][_0xcd44('0x28')]];_0x576a48[_0xcd44('0x2f')]=utils[_0xcd44('0x30')][_0xcd44('0x75')];if(_[_0xcd44('0x3f')](_0x576a48)){ut[_0xcd44('0x32')](_0xcd44('0x105'),_0x576a48);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0xcd44('0x72')](_0x576a48['Trunk'])){ut[_0xcd44('0x32')](_0xcd44('0x106'),_0xcd44('0x107')+_0x576a48[_0xcd44('0x28')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0xcd44('0x72')](_0x576a48[_0xcd44('0x74')])){ut['logger'](_0xcd44('0x106'),_0x576a48[_0xcd44('0x28')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0xcd44('0x108')};}}if(!ut[_0xcd44('0x109')](_0x576a48[_0xcd44('0x71')])){ut[_0xcd44('0x32')]('[Preview][validateContact][Campaign\x20Active]',_0x576a48[_0xcd44('0x28')]+_0xcd44('0x10a'));return{'isValid':![],'message':_0xcd44('0x107')+_0x576a48[_0xcd44('0x28')]+_0xcd44('0x10a')};}return{'isValid':!![],'message':_0xcd44('0x10b')};};Preview[_0xcd44('0xd')]['execCall']=function(_0x485d88,_0x5d0a69,_0x4fd772,_0x3cf985){var _0x27e960=this;return new Promise(function(_0x5d7456,_0x20ec5c){var _0x33b9c4=_0x485d88[_0xcd44('0x9d')];var _0x19efd6=_0x27e960[_0xcd44('0x72')](_0x5d0a69[_0xcd44('0x73')])?util[_0xcd44('0x8a')](_0xcd44('0x10c'),_0x5d0a69[_0xcd44('0x73')][_0xcd44('0x28')],_[_0xcd44('0x3f')](_0x5d0a69[_0xcd44('0x10d')])?'':_0x5d0a69['dialPrefix'][_0xcd44('0x10e')]()||'',_0x5d0a69['dialCutDigit']>0x0?_0x4fd772[_0xcd44('0xea')][_0xcd44('0x10f')](_0x5d0a69['dialCutDigit']):_0x4fd772[_0xcd44('0xea')]):util[_0xcd44('0x8a')](_0xcd44('0x10c'),_['isNil'](_0x5d0a69[_0xcd44('0x74')])?_0x5d0a69[_0xcd44('0x73')]['name']:_0x5d0a69[_0xcd44('0x74')][_0xcd44('0x28')],_[_0xcd44('0x3f')](_0x5d0a69['dialPrefix'])?'':_0x5d0a69[_0xcd44('0x10d')][_0xcd44('0x10e')]()||'',_0x5d0a69['dialCutDigit']>0x0?_0x4fd772[_0xcd44('0xea')]['substring'](_0x5d0a69[_0xcd44('0x110')]):_0x4fd772[_0xcd44('0xea')]);var _0xb79e2=_0x27e960[_0xcd44('0x72')](_0x5d0a69[_0xcd44('0x73')])?ut['getCallerId'](_0x5d0a69['Trunk']['callerid'],_0x5d0a69['dialOriginateCallerIdName'],_0x5d0a69['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xcd44('0x111')](_0x5d0a69[_0xcd44('0x112')],_0x5d0a69[_0xcd44('0x113')]):_0x5d0a69['dialOriginateCallerIdNumber']):ut[_0xcd44('0x114')](_[_0xcd44('0x3f')](_0x5d0a69['TrunkBackup'])?_0x5d0a69[_0xcd44('0x73')][_0xcd44('0x115')]:_0x5d0a69[_0xcd44('0x74')][_0xcd44('0x115')],_0x5d0a69[_0xcd44('0x116')],_0x5d0a69['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xcd44('0x111')](_0x5d0a69[_0xcd44('0x112')],_0x5d0a69['dialRandomLastDigitCallerIdNumber']):_0x5d0a69[_0xcd44('0x112')]);if(_0xb79e2){_0x485d88[_0xcd44('0x117')]=ut[_0xcd44('0x118')](_0xb79e2);_0x485d88[_0xcd44('0x119')]=ut[_0xcd44('0x11a')](_0xb79e2);}var _0x50b0e4=ut[_0xcd44('0x11b')](_0x5d0a69,_0x4fd772,_0x19efd6,_0xb79e2,_0x33b9c4,_0x485d88);var _0x745a58=utils[_0xcd44('0x11c')](_0x4fd772[_0xcd44('0xe9')]);Object[_0xcd44('0x11d')](_0x50b0e4,_0x745a58);_[_0xcd44('0x11e')](_0x485d88,ut[_0xcd44('0x11f')](_0x50b0e4));_0x485d88[_0xcd44('0x62')]=moment()[_0xcd44('0x8a')]('YYYY-MM-DD\x20HH:mm:ss');_0x5d0a69[_0xcd44('0x120')]=_0x50b0e4;var _0x6e59cb=ut[_0xcd44('0x121')](_0x485d88,_0x5d0a69,_0x50b0e4,_0x485d88[_0xcd44('0x84')],_0x3cf985);return ami['Action'](_0x6e59cb)[_0xcd44('0x59')](function(_0x55148f){_0x5d0a69['originated']+=0x1;logger[_0xcd44('0x25')](_0xcd44('0x122'),_0x33b9c4,'\x20Queue',_0x5d0a69[_0xcd44('0x28')],_0xcd44('0x43'),_0x5d0a69[_0xcd44('0x2c')]);_0x5d7456(_0x55148f);})[_0xcd44('0x50')](function(_0x392e93){ut['logAgent'](_0x485d88,0xe,_0xcd44('0x123'));rpcDb['createAgentHistory'](_0x485d88,_0xcd44('0x124'));_0x20ec5c(_0x392e93);});});};Preview[_0xcd44('0xd')][_0xcd44('0x1d')]=function(_0x103cff){if(this[_0xcd44('0x13')][_0x103cff[_0xcd44('0x85')]]){this[_0xcd44('0x13')][_0x103cff['linkedid']][_0xcd44('0x4f')]=_0x103cff[_0xcd44('0x4f')];}};Preview[_0xcd44('0xd')][_0xcd44('0x17')]=function(_0x18530d){var _0x557cc2=this;var _0x4c6f9d=this[_0xcd44('0x13')][_0x18530d['actionid']];if(_0x4c6f9d){if(_0x4c6f9d[_0xcd44('0xec')]&&this[_0xcd44('0x14')][_0x4c6f9d['lookAgent']]){ut[_0xcd44('0x125')](_0x4c6f9d,this[_0xcd44('0x14')][_0x4c6f9d[_0xcd44('0xec')]]['name'],this['agents'][_0x4c6f9d[_0xcd44('0xec')]]['id']);}var _0x537aeb=_[_0xcd44('0x126')](_0x4c6f9d);_0x537aeb[_0xcd44('0x127')]=moment()[_0xcd44('0x8a')](_0xcd44('0x63'));var _0x33aa52=_0x557cc2[_0xcd44('0x10')][_0x4c6f9d['queue']];if(ut[_0xcd44('0x128')](_0x18530d[_0xcd44('0x129')])){if(_0x4c6f9d[_0xcd44('0xb2')]){rpcDb[_0xcd44('0xfc')](_0x4c6f9d[_0xcd44('0x88')]);}if(_0x4c6f9d[_0xcd44('0x84')]){rpcDb['disableContact'](_0x4c6f9d[_0xcd44('0x88')]);}ami[_0xcd44('0x24')](_0xcd44('0x12a'),ut[_0xcd44('0x8c')](_0x4c6f9d,'rejected',this[_0xcd44('0x10')][_0x4c6f9d[_0xcd44('0x42')]]));this['callProgressDetectingAgent'](_0x537aeb,_0x33aa52,_0x18530d);}else{_0x4c6f9d[_0xcd44('0x62')]=moment()[_0xcd44('0x8a')](_0xcd44('0x63'));ut[_0xcd44('0xdc')](_0x537aeb,0x4,'Answer');rpcDb[_0xcd44('0xda')](_0x537aeb,_0xcd44('0x12b'));}}};Preview['prototype'][_0xcd44('0x19')]=function(_0x184827){var _0x5cc802=this[_0xcd44('0x13')][_0x184827[_0xcd44('0x85')]];var _0x36d739;if(_0x5cc802){_0x36d739=this[_0xcd44('0x10')][_0x5cc802[_0xcd44('0x42')]];logger['info'](_0xcd44('0x12c'),_0x184827[_0xcd44('0x85')],_0xcd44('0x8b'),_0x36d739[_0xcd44('0x28')],_0xcd44('0x45'),_0x36d739[_0xcd44('0x46')]);}if(this[_0xcd44('0x13')][_0x184827[_0xcd44('0x85')]]&&_0x184827[_0xcd44('0x85')]!==_0x184827[_0xcd44('0x9d')]){if(_0x184827[_0xcd44('0x12d')]==='16'&&this[_0xcd44('0x13')][_0x184827[_0xcd44('0x85')]]['dialAnswer']){this[_0xcd44('0x76')](_0x184827,_0x184827[_0xcd44('0x85')],_0x184827[_0xcd44('0x12d')]);}else if(this['actions'][_0x184827[_0xcd44('0x85')]][_0xcd44('0x47')]){logger[_0xcd44('0x25')](_0xcd44('0x12e'),_0x184827[_0xcd44('0x85')],_0x184827['cause'],'\x20Queue',_0x36d739[_0xcd44('0x28')],_0xcd44('0x45'),_0x36d739[_0xcd44('0x46')]);this[_0xcd44('0x76')](_0x184827,_0x184827[_0xcd44('0x85')],_0x184827['cause']);}}else if(_0x5cc802&&_['isNil'](_0x5cc802['statedesc'])&&_0x36d739['dialQueueProject']&&_0x184827['linkedid']===_0x184827[_0xcd44('0x9d')]&&_[_0xcd44('0x3f')](_0x184827['reason'])&&_0x184827[_0xcd44('0x12d')]==='16'&&_0x184827['channelstate']==='6'&&_['isUndefined'](_0x5cc802[_0xcd44('0x12f')])){if(_0x5cc802['unlockAgent']){rpcDb[_0xcd44('0xfc')](_0x5cc802['idContact']);}if(_0x5cc802[_0xcd44('0x84')]){rpcDb[_0xcd44('0x61')](_0x5cc802[_0xcd44('0x88')]);}_0x184827[_0xcd44('0xd8')]='22';this['callProgressDetectingAgent'](_0x5cc802,_0x36d739,_0x184827);}else if(_0x5cc802&&_0x5cc802[_0xcd44('0x12f')]){if(_0x184827[_0xcd44('0x12d')]==='16'&&this['actions'][_0x184827['linkedid']][_0xcd44('0x47')]){logger[_0xcd44('0x25')](_0xcd44('0x130'),_0x184827['linkedid'],_0x184827[_0xcd44('0x12d')],_0xcd44('0x8b'),_0x36d739[_0xcd44('0x28')],_0xcd44('0x45'),_0x36d739[_0xcd44('0x46')]);this[_0xcd44('0x76')](_0x184827,_0x184827[_0xcd44('0x85')],_0x184827['cause']);}else if(this['actions'][_0x184827[_0xcd44('0x85')]][_0xcd44('0x47')]){logger[_0xcd44('0x25')]('[syncHangup][talking][cause]',_0x184827[_0xcd44('0x85')],_0x184827['cause'],_0xcd44('0x8b'),_0x36d739[_0xcd44('0x28')],_0xcd44('0x45'),_0x36d739['pTalking']);this[_0xcd44('0x76')](_0x184827,_0x184827[_0xcd44('0x85')],_0x184827[_0xcd44('0x12d')]);}}};Preview[_0xcd44('0xd')][_0xcd44('0x131')]=function(_0x5ced02){if(this[_0xcd44('0x13')][_0x5ced02[_0xcd44('0xd3')]]&&_0x5ced02[_0xcd44('0xd3')]!==_0x5ced02[_0xcd44('0x132')]){this[_0xcd44('0x76')](_0x5ced02,_0x5ced02[_0xcd44('0xd3')],_0x5ced02[_0xcd44('0xc8')]);}};Preview[_0xcd44('0xd')][_0xcd44('0x133')]=function(_0xed5819){if(this[_0xcd44('0x13')][_0xed5819[_0xcd44('0x85')]]&&_0xed5819['linkedid']!==_0xed5819[_0xcd44('0x9d')]&&!this[_0xcd44('0x13')][_0xed5819[_0xcd44('0x85')]][_0xcd44('0x47')]){if(_0xed5819[_0xcd44('0x12d')]==='1'){this[_0xcd44('0x76')](_0xed5819,_0xed5819[_0xcd44('0x85')],_0xed5819[_0xcd44('0x12d')]);}}};Preview[_0xcd44('0xd')][_0xcd44('0x134')]=function(_0x181533,_0x750ab9,_0x2339b1){if(this['actions'][_0x181533]){if(_[_0xcd44('0x3f')](this[_0xcd44('0x13')][_0x181533][_0xcd44('0x120')])){this[_0xcd44('0x13')][_0x181533]['variables']={};}this[_0xcd44('0x13')][_0x181533]['variables'][_0x750ab9]=_0x2339b1;}};Preview['prototype'][_0xcd44('0x1f')]=function(_0xded7ef){try{if(!_[_0xcd44('0x3f')](_0xded7ef)){if(ut['filterKey'](_[_0xcd44('0x135')](_0xded7ef['variable'])[0x0])){this['addVariable'](_0xded7ef[_0xcd44('0x9d')],_[_0xcd44('0x135')](_0xded7ef['variable'])[0x0],_0xded7ef[_0xcd44('0x136')]);}}}catch(_0x468621){logger[_0xcd44('0x137')](_0xcd44('0x138'),util[_0xcd44('0x139')](_0x468621,{'showHidden':![],'depth':null}));}};Preview[_0xcd44('0xd')]['syncAttendedTransfer']=function(_0x202f65){if(_0x202f65){if(this['actions'][_0x202f65[_0xcd44('0x13a')]]){this[_0xcd44('0x13')][_0x202f65[_0xcd44('0x13a')]][_0xcd44('0x12f')]=!![];}}};Preview[_0xcd44('0xd')][_0xcd44('0x23')]=function(_0x23e1f4){if(_0x23e1f4){if(this[_0xcd44('0x13')][_0x23e1f4[_0xcd44('0x13b')]]){this[_0xcd44('0x13')][_0x23e1f4['transfererlinkedid']][_0xcd44('0x12f')]=!![];}}};module[_0xcd44('0x13c')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 2c33935..d059733 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 _0x58a0=['lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','rescheduleContact','[rescheduleContactInQueue]\x20','util','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','error','createHistory','catch','[createHistory]\x20','resolve','then','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','UserId','active','countReScheduled','[countReScheduled]\x20','unlockContact','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','calleridname','queue','answertime','queuecallerleaveAt','endtime','connectedlinename','membername','context','from-sip','xcally-motion-preview','holdtime'];(function(_0x5e8e5b,_0x115812){var _0x5d988a=function(_0x5030e0){while(--_0x5030e0){_0x5e8e5b['push'](_0x5e8e5b['shift']());}};_0x5d988a(++_0x115812);}(_0x58a0,0x130));var _0x058a=function(_0x2a1a31,_0x1b8b1a){_0x2a1a31=_0x2a1a31-0x0;var _0xe175e8=_0x58a0[_0x2a1a31];return _0xe175e8;};'use strict';var util=require(_0x058a('0x0'));var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0x058a('0x1'));var cmHopper=require(_0x058a('0x2'));var cmHopperHistory=require(_0x058a('0x3'));var cmHopperBlack=require(_0x058a('0x4'));var agentReportPreview=require(_0x058a('0x5'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x45a751){return function(_0x1b305e){logger[_0x058a('0x6')](_0x45a751,util['inspect'](_0x1b305e,{'showHidden':![],'depth':null}));};}function create(_0x1b05b0){return cmHopperHistory[_0x058a('0x7')](_0x1b05b0)[_0x058a('0x8')](loggerCatch(_0x058a('0x9')));}function createAgent(_0x101511){return BPromise[_0x058a('0xa')]()[_0x058a('0xb')](agentReportPreview['createHistory'](_0x101511))[_0x058a('0x8')](loggerCatch(_0x058a('0x9')));}function moveContact(_0x147b61){return cmHopper['moveContactManagedDialer'](_0x147b61,!![])[_0x058a('0x8')](loggerCatch('[moveContactManagedDialer]\x20'));}exports['checkIsBlackList']=function(_0x35375c){return cmHopperBlack[_0x058a('0xc')](_0x35375c)[_0x058a('0x8')](loggerCatch(_0x058a('0xd')));};exports[_0x058a('0xe')]=function(_0x563e2d){return BPromise['resolve']()[_0x058a('0xb')](cmHopper[_0x058a('0xe')](_0x563e2d))[_0x058a('0x8')](loggerCatch(_0x058a('0xf')));};exports['createHistory']=function(_0x27a2c7,_0x3219f1){create(_0x27a2c7)[_0x058a('0x8')](loggerCatch(_0x3219f1));moveContact(_0x27a2c7)[_0x058a('0x8')](loggerCatch(_0x3219f1));};exports[_0x058a('0x10')]=function(_0x443c57,_0x5009a8){createAgent(_0x443c57)['catch'](loggerCatch(_0x5009a8));};exports[_0x058a('0x11')]=function(_0x3a7af4,_0x56e5e9){create(_0x3a7af4)['catch'](loggerCatch(_0x56e5e9));};exports[_0x058a('0x12')]=function(_0x36a1d1,_0x50babe){moveContact(_0x36a1d1)[_0x058a('0x8')](loggerCatch(_0x50babe));};exports['rescheduleContact']=function(_0x23cf81,_0x1f9af5,_0x2c8644){if(_0x1f9af5){_0x23cf81[_0x058a('0x13')]=null;}if(_0x2c8644){_0x23cf81[_0x058a('0x14')]=![];}return cmHopper['rescheduleContact'](_0x23cf81)[_0x058a('0x8')](loggerCatch('[rescheduleContact]\x20'));};exports[_0x058a('0x15')]=function(_0xc558a5){return cmHopper[_0x058a('0x15')](_0xc558a5)[_0x058a('0x8')](loggerCatch(_0x058a('0x16')));};exports[_0x058a('0x17')]=function(_0x2edc5a){return cmHopper[_0x058a('0x17')]({'UserId':null},_0x2edc5a,0x1)['catch'](loggerCatch('[unlockContact]\x20'));};exports[_0x058a('0x18')]=function(_0x334197){return cmHopper[_0x058a('0x17')]({'active':![]},_0x334197,0x1)[_0x058a('0x8')](loggerCatch(_0x058a('0x19')));};exports[_0x058a('0x1a')]=function(_0x1aa7a4){var _0x3624ea={};_0x3624ea[_0x058a('0x1b')]=_0x1aa7a4[_0x058a('0x1b')];_0x3624ea['uniqueid']=_0x1aa7a4['uniqueid'];_0x3624ea['calleridnum']=_0x1aa7a4['calleridnum'];_0x3624ea['calleridname']=_0x1aa7a4[_0x058a('0x1c')];_0x3624ea[_0x058a('0x1d')]=_0x1aa7a4[_0x058a('0x1d')];_0x3624ea['queuecallerjoinAt']=_0x1aa7a4[_0x058a('0x1e')];_0x3624ea[_0x058a('0x1f')]=_0x1aa7a4[_0x058a('0x1e')];_0x3624ea['queuecallercomplete']=0x1;_0x3624ea['queuecallercompleteAt']=_0x1aa7a4[_0x058a('0x20')];_0x3624ea[_0x058a('0x21')]=_0x1aa7a4[_0x058a('0x22')];_0x3624ea[_0x058a('0x23')]=_0x058a('0x24');_0x3624ea['exten']=_0x058a('0x25');_0x3624ea[_0x058a('0x26')]=0x0;_0x3624ea['assigned']=0x1;_0x3624ea[_0x058a('0x27')]=_0x1aa7a4['membername'];_0x3624ea[_0x058a('0x28')]=_0x058a('0x29');return BPromise[_0x058a('0xa')]()[_0x058a('0xb')](voiceQueueReport[_0x058a('0x2a')](_0x3624ea))[_0x058a('0x8')](loggerCatch(_0x058a('0x2b')));};exports[_0x058a('0x2c')]=function(_0x1194ab,_0x51256f){return BPromise[_0x058a('0xa')]()['then'](cmHopper[_0x058a('0x2c')](_0x1194ab,_0x51256f))['catch'](loggerCatch(_0x058a('0x2d')));};exports[_0x058a('0x2e')]=function(_0x4f9cd1){return cmHopper[_0x058a('0x2f')](_0x4f9cd1,!![],!![])['catch'](loggerCatch(_0x058a('0x30')));}; \ No newline at end of file +var _0x2c3b=['answertime','queuecallercomplete','queuecallercompleteAt','context','exten','xcally-motion-preview','holdtime','membername','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','util','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/agentReportPreview','../rpc/voiceQueueReport','createHistory','[createHistory]\x20','resolve','then','catch','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerFinal','UserId','active','rescheduleContact','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','type','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt'];(function(_0x5c16e1,_0x12ea72){var _0x4f59d0=function(_0x48ed32){while(--_0x48ed32){_0x5c16e1['push'](_0x5c16e1['shift']());}};_0x4f59d0(++_0x12ea72);}(_0x2c3b,0xee));var _0xb2c3=function(_0x170eb7,_0x1ac59b){_0x170eb7=_0x170eb7-0x0;var _0x4dfeac=_0x2c3b[_0x170eb7];return _0x4dfeac;};'use strict';var util=require(_0xb2c3('0x0'));var BPromise=require('bluebird');var logger=require(_0xb2c3('0x1'))(_0xb2c3('0x2'));var cmHopper=require(_0xb2c3('0x3'));var cmHopperHistory=require(_0xb2c3('0x4'));var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require(_0xb2c3('0x5'));var voiceQueueReport=require(_0xb2c3('0x6'));function loggerCatch(_0x2b441b){return function(_0x4fbbbe){logger['error'](_0x2b441b,util['inspect'](_0x4fbbbe,{'showHidden':![],'depth':null}));};}function create(_0x18a7c1){return cmHopperHistory[_0xb2c3('0x7')](_0x18a7c1)['catch'](loggerCatch(_0xb2c3('0x8')));}function createAgent(_0xdc8be9){return BPromise[_0xb2c3('0x9')]()[_0xb2c3('0xa')](agentReportPreview[_0xb2c3('0x7')](_0xdc8be9))[_0xb2c3('0xb')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x5a3e1d){return cmHopper['moveContactManagedDialer'](_0x5a3e1d,!![])[_0xb2c3('0xb')](loggerCatch(_0xb2c3('0xc')));}exports[_0xb2c3('0xd')]=function(_0x1d799a){return cmHopperBlack['checkIsBlackList'](_0x1d799a)[_0xb2c3('0xb')](loggerCatch(_0xb2c3('0xe')));};exports[_0xb2c3('0xf')]=function(_0x356d5f){return BPromise[_0xb2c3('0x9')]()[_0xb2c3('0xa')](cmHopper['getContactPreview'](_0x356d5f))['catch'](loggerCatch(_0xb2c3('0x10')));};exports[_0xb2c3('0x7')]=function(_0x59d2d5,_0x4b2c1d){create(_0x59d2d5)[_0xb2c3('0xb')](loggerCatch(_0x4b2c1d));moveContact(_0x59d2d5)['catch'](loggerCatch(_0x4b2c1d));};exports['createAgentHistory']=function(_0x2d0076,_0x4863c0){createAgent(_0x2d0076)['catch'](loggerCatch(_0x4863c0));};exports['createCustomerHistory']=function(_0x416ec7,_0x5b006a){create(_0x416ec7)[_0xb2c3('0xb')](loggerCatch(_0x5b006a));};exports[_0xb2c3('0x11')]=function(_0x627904,_0x33853b){moveContact(_0x627904)[_0xb2c3('0xb')](loggerCatch(_0x33853b));};exports['rescheduleContact']=function(_0x45e76e,_0xa7d83b,_0x58d272){if(_0xa7d83b){_0x45e76e[_0xb2c3('0x12')]=null;}if(_0x58d272){_0x45e76e[_0xb2c3('0x13')]=![];}return cmHopper[_0xb2c3('0x14')](_0x45e76e)[_0xb2c3('0xb')](loggerCatch('[rescheduleContact]\x20'));};exports['countReScheduled']=function(_0x1d4386){return cmHopper[_0xb2c3('0x15')](_0x1d4386)[_0xb2c3('0xb')](loggerCatch(_0xb2c3('0x16')));};exports[_0xb2c3('0x17')]=function(_0x56f9b4){return cmHopper['unlockContact']({'UserId':null},_0x56f9b4,0x1)[_0xb2c3('0xb')](loggerCatch(_0xb2c3('0x18')));};exports[_0xb2c3('0x19')]=function(_0x3a2b1c){return cmHopper[_0xb2c3('0x17')]({'active':![]},_0x3a2b1c,0x1)[_0xb2c3('0xb')](loggerCatch('[activeContact]\x20'));};exports['crateCustomerReportQueue']=function(_0x2efd3e){var _0x5ae7d5={};_0x5ae7d5[_0xb2c3('0x1a')]=_0x2efd3e[_0xb2c3('0x1a')];_0x5ae7d5[_0xb2c3('0x1b')]=_0x2efd3e[_0xb2c3('0x1b')];_0x5ae7d5[_0xb2c3('0x1c')]=_0x2efd3e[_0xb2c3('0x1c')];_0x5ae7d5['calleridname']=_0x2efd3e[_0xb2c3('0x1d')];_0x5ae7d5[_0xb2c3('0x1e')]=_0x2efd3e[_0xb2c3('0x1e')];_0x5ae7d5['queuecallerjoinAt']=_0x2efd3e['answertime'];_0x5ae7d5[_0xb2c3('0x1f')]=_0x2efd3e[_0xb2c3('0x20')];_0x5ae7d5[_0xb2c3('0x21')]=0x1;_0x5ae7d5[_0xb2c3('0x22')]=_0x2efd3e['endtime'];_0x5ae7d5['connectedlinename']=_0x2efd3e['membername'];_0x5ae7d5[_0xb2c3('0x23')]='from-sip';_0x5ae7d5[_0xb2c3('0x24')]=_0xb2c3('0x25');_0x5ae7d5[_0xb2c3('0x26')]=0x0;_0x5ae7d5['assigned']=0x1;_0x5ae7d5['lastAssignedTo']=_0x2efd3e[_0xb2c3('0x27')];_0x5ae7d5[_0xb2c3('0x28')]='COMPLETED';return BPromise[_0xb2c3('0x9')]()[_0xb2c3('0xa')](voiceQueueReport[_0xb2c3('0x29')](_0x5ae7d5))[_0xb2c3('0xb')](loggerCatch(_0xb2c3('0x2a')));};exports[_0xb2c3('0x2b')]=function(_0x1a64cb,_0x56cb71){return BPromise[_0xb2c3('0x9')]()['then'](cmHopper[_0xb2c3('0x2b')](_0x1a64cb,_0x56cb71))[_0xb2c3('0xb')](loggerCatch(_0xb2c3('0x2c')));};exports['rescheduleContactInQueue']=function(_0xdaed08){return cmHopper[_0xb2c3('0x14')](_0xdaed08,!![],!![])['catch'](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ 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 f23e8e8..1983ab6 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 _0xa215=['countbusyretry','countglobal','callback','callbackuniqueid','callbackat','sipcallid','xmd-voicequeueid','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitter','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','match','extractCalleridNumber','noanswer','variables','keys','forEach','toLowerCase','util','moment','../../../../config/logger','preview','env','127.0.0.1','../../dialer/utils','error','inspect','logger','info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22\x22\x20<>','isNil','addVariables','Queue','name','\x22%s\x22\x20<%s>','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','starttime','responsetime','endtime','logAgent','statedesc','ringtime','getSeconds','membername','UserId','talktime','answertime','isFailure','variablesAction','calleridname','originate','from-sip','uniqueid','totalGlobal','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','minutes','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','channelAgent','motionChannel','voice','mandatoryDisposition','buildObj','buildAcw','agentReadyId','not_inuse','status','reachable','getDiff','milliseconds','seconds','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa215,0xb9));var _0x5a21=function(_0x121886,_0x8cd8e5){_0x121886=_0x121886-0x0;var _0x20ca01=_0xa215[_0x121886];return _0x20ca01;};'use strict';var util=require(_0x5a21('0x0'));var _=require('lodash');var moment=require(_0x5a21('0x1'));var logger=require(_0x5a21('0x2'))(_0x5a21('0x3'));var ipAgi=process[_0x5a21('0x4')]['XCALLY_IP_AGI']||_0x5a21('0x5');var utils=require(_0x5a21('0x6'));exports['loggerCatch']=function(_0x495d7b){return function(_0x163cd2){logger[_0x5a21('0x7')](_0x495d7b,util[_0x5a21('0x8')](_0x163cd2,{'showHidden':![],'depth':null}));};};exports[_0x5a21('0x9')]=function(_0x44ecf5,_0x2cb3b3){logger[_0x5a21('0xa')](_0x44ecf5,util['inspect'](_0x2cb3b3,{'showHidden':![],'depth':null}));};exports[_0x5a21('0xb')]=function(_0x341098,_0x29195d){logger[_0x5a21('0x7')](_0x341098,util[_0x5a21('0x8')](_0x29195d,{'showHidden':![],'depth':null}));};exports[_0x5a21('0xc')]=function(_0x4e6ff7){return function(_0x34c4c5){logger['info'](_0x4e6ff7,util[_0x5a21('0x8')](_0x34c4c5,{'showHidden':![],'depth':null}));};};exports[_0x5a21('0xd')]=function(_0x59cd94,_0x433636,_0x1d2c95){return{'message':_0x59cd94,'unlock':_0x433636,'active':_0x1d2c95};};exports[_0x5a21('0xe')]=function(_0x48a2da,_0x36d702,_0x503660){if(!_[_0x5a21('0xf')](_0x503660)&&_0x5a21('0x10')===typeof _0x503660&&!_['isEmpty'](_0x503660)){if(!_[_0x5a21('0xf')](_0x36d702)&&_0x5a21('0x10')===typeof _0x36d702&&!_[_0x5a21('0x11')](_0x36d702)){return util[_0x5a21('0x12')]('\x22%s\x22\x20<%s>',_0x36d702,_0x503660);}return util[_0x5a21('0x12')]('\x22%s\x22\x20<%s>',_0x503660,_0x503660);}if(!_[_0x5a21('0xf')](_0x48a2da)&&_0x5a21('0x10')===typeof _0x48a2da&&!_['isEmpty'](_0x48a2da)){return _0x48a2da;}return _0x5a21('0x13');};exports['isActive']=function(_0x21b7f6){if(_[_0x5a21('0x14')](_0x21b7f6)){return![];}return _0x21b7f6;};exports[_0x5a21('0x15')]=function(_0x1e7376,_0x45e80d,_0x4fceea,_0x593cbc,_0x2c9331,_0x12131b){var _0x1c8d70={'XMD-QUEUE':_0x45e80d[_0x5a21('0x16')]?_0x45e80d[_0x5a21('0x16')][_0x5a21('0x17')]:'','XMD-CALLERID':_0x593cbc,'XMD-CALLERID-PREVIEW':_0x12131b?util[_0x5a21('0x12')](_0x5a21('0x18'),_0x12131b['calleridname'],_0x12131b[_0x5a21('0x19')]):_0x593cbc,'XMD-DIALID':_0x2c9331,'XMD-CONTACTID':_0x45e80d[_0x5a21('0x1a')],'XMD-CDRTYPE':_0x5a21('0x1b'),'CALLERID(all)':_0x593cbc,'XMD-VOICEQUEUEID':_0x45e80d[_0x5a21('0x1c')],'XMD-DIALCHANNEL':_0x4fceea,'XMD-DIALTIMEOUT':_0x1e7376[_0x5a21('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0x5a21('0x12')]('\x22rtTxX%s%s\x22',_0x1e7376[_0x5a21('0x1e')]?'g':'',_[_0x5a21('0x11')](_0x1e7376['monitor_format'])?'':_0x5a21('0x1f')),'XMD-DIALURL':_0x1e7376[_0x5a21('0x20')]||'','XMD-AGI':_0x1e7376[_0x5a21('0x21')]?util[_0x5a21('0x12')](_0x5a21('0x22'),ipAgi,_0x1e7376[_0x5a21('0x21')]):_0x5a21('0x23'),'XMD-AGIAFTER':_0x1e7376[_0x5a21('0x1e')]?util[_0x5a21('0x12')](_0x5a21('0x22'),ipAgi,_0x1e7376[_0x5a21('0x1e')]):_0x5a21('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x12131b?_0x12131b[_0x5a21('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x12131b?_0x12131b[_0x5a21('0x25')]:'','XMD-DESTINATION':_0x5a21('0x26'),'SIPADDHEADER':_0x5a21('0x27')};if(!_[_0x5a21('0x11')](_0x1e7376[_0x5a21('0x28')])){_0x1c8d70[util['format']('%s',_0x5a21('0x29'))]=_0x1e7376[_0x5a21('0x28')];_0x1c8d70[util[_0x5a21('0x12')]('%s',_0x5a21('0x2a'))]=_0x2c9331;}return _0x1c8d70;};exports['toLowerVariables']=function(_0x45b29e){var _0x66aeea={};for(var _0x3db702 in _0x45b29e){if(_0x45b29e[_0x5a21('0x2b')](_0x3db702)){_0x66aeea[util['format']('%s',_[_0x5a21('0x2c')](_0x3db702))]=_0x45b29e[_0x3db702];}}return{'variables':_0x66aeea};};exports[_0x5a21('0x2d')]=function(_0x3e915d,_0x3fd364){if(!_[_0x5a21('0x14')](_0x3e915d)){if(_0x3e915d['hasOwnProperty'](_0x5a21('0x2e'))){if(_0x3e915d[_0x5a21('0x2e')]>0x0){_0x3e915d[_0x5a21('0x2e')]-=0x1;}else{logger[_0x5a21('0x7')](_0x5a21('0x2f'),_0x3fd364);}}}else{logger[_0x5a21('0x7')](_0x5a21('0x30'),_0x3fd364);}};exports['logBlacklist']=function(_0x57f463){var _0x2fa7fc=moment()[_0x5a21('0x12')](_0x5a21('0x31'));_0x57f463[_0x5a21('0x32')]=0xd;_0x57f463['statedesc']=_0x5a21('0x33');_0x57f463[_0x5a21('0x34')]=_0x2fa7fc;_0x57f463[_0x5a21('0x35')]=_0x2fa7fc;_0x57f463[_0x5a21('0x36')]=_0x2fa7fc;};exports[_0x5a21('0x37')]=function(_0x12b432,_0x3f6c6e,_0x4c7465){var _0xeb1c0d=moment()[_0x5a21('0x12')](_0x5a21('0x31'));_0x12b432[_0x5a21('0x32')]=_0x3f6c6e;_0x12b432[_0x5a21('0x38')]=_0x4c7465;_0x12b432[_0x5a21('0x35')]=_0xeb1c0d;_0x12b432[_0x5a21('0x39')]=utils[_0x5a21('0x3a')](_0x12b432['responsetime'],_0x12b432[_0x5a21('0x34')]);};exports['logLookAgent']=function(_0x1e2489,_0xa62d98,_0x188beb){_0x1e2489[_0x5a21('0x3b')]=_0xa62d98;_0x1e2489[_0x5a21('0x3c')]=_0x188beb;};exports['logCustomer']=function(_0x2c0a56,_0x37cf20,_0x40debc){var _0x4db3e6=moment()[_0x5a21('0x12')](_0x5a21('0x31'));_0x2c0a56[_0x5a21('0x32')]=_0x37cf20;_0x2c0a56['statedesc']=_0x40debc;_0x2c0a56['responsetime']=_0x2c0a56[_0x5a21('0x35')]?_0x2c0a56[_0x5a21('0x35')]:_0x4db3e6;_0x2c0a56[_0x5a21('0x36')]=_0x2c0a56[_0x5a21('0x36')]?_0x2c0a56[_0x5a21('0x36')]:_0x4db3e6;_0x2c0a56['ringtime']=utils[_0x5a21('0x3a')](_0x2c0a56[_0x5a21('0x35')]||0x0,_0x2c0a56['starttime']||0x0);_0x2c0a56[_0x5a21('0x3d')]=_0x2c0a56['answertime']?utils['getSeconds'](_0x2c0a56[_0x5a21('0x36')],_0x2c0a56[_0x5a21('0x3e')]):0x0;};exports[_0x5a21('0x3f')]=function(_0x3ed0ae){return _0x3ed0ae==='Failure';};exports[_0x5a21('0x40')]=function(_0x1ba4ef,_0x2c446e,_0x29c4cb,_0x2049d3,_0xbbf5a){var _0x3f1a4b=_0x2049d3?'RECALL':_0x1ba4ef[_0x5a21('0x41')];_0x3f1a4b=_0xbbf5a?'BOOKED':_0x3f1a4b;return{'actionid':_0x1ba4ef['uniqueid'],'action':_0x5a21('0x42'),'channel':_0x1ba4ef['channelAgent'],'callerid':util[_0x5a21('0x12')](_0x5a21('0x18'),_0x3f1a4b,_0x1ba4ef[_0x5a21('0x19')]),'Exten':'xcally-motion-preview','Context':_0x5a21('0x43'),'Priority':'1','variable':_0x29c4cb,'timeout':(_0x2c446e['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x1ba4ef[_0x5a21('0x44')]};};exports[_0x5a21('0x45')]=function(_0x1e5e21){return _0x1e5e21['countbusyretry']+_0x1e5e21[_0x5a21('0x46')]+_0x1e5e21[_0x5a21('0x47')]+_0x1e5e21[_0x5a21('0x48')]+_0x1e5e21[_0x5a21('0x49')];};exports[_0x5a21('0x4a')]=function(_0x309f6c){var _0x38e20b=_[_0x5a21('0x4b')](_0x309f6c);_0x38e20b[_0x5a21('0x32')]=0xf;_0x38e20b[_0x5a21('0x38')]=_0x5a21('0x4c');return _0x38e20b;};exports[_0x5a21('0x4d')]=function(_0x3b2ee4,_0x51d8a4,_0x576166){var _0x1cf260={};_0x1cf260[_0x51d8a4]=_0x3b2ee4[_0x51d8a4];_0x1cf260[_0x5a21('0x4e')]=![];_0x1cf260[_0x5a21('0x4f')]=moment()['add'](_0x576166,_0x5a21('0x50'))['format'](_0x5a21('0x31'));_0x1cf260[_0x5a21('0x1a')]=_0x3b2ee4[_0x5a21('0x1a')];_0x1cf260[_0x5a21('0x51')]=_0x3b2ee4[_0x5a21('0x51')];_0x1cf260['VoiceQueueId']=_0x3b2ee4[_0x5a21('0x1c')]||undefined;return _0x1cf260;};exports['decrementTalkink']=function(_0x592416,_0x5ba4aa){if(!_[_0x5a21('0x14')](_0x592416)){if(_0x592416[_0x5a21('0x52')]>0x0){_0x592416[_0x5a21('0x52')]-=0x1;}else{logger[_0x5a21('0x7')](_0x5ba4aa,_0x5a21('0x53'));}}else{logger[_0x5a21('0x7')](_0x5ba4aa,_0x5a21('0x54'));}};exports[_0x5a21('0x55')]=function(_0x34a82e){if(_0x34a82e<=0x0){return!![];}return![];};function buildObj(_0x4e0cbd,_0x2b5e46,_0x8acf47){_0x4e0cbd[_0x5a21('0x56')]=_0x2b5e46;_0x4e0cbd[_0x5a21('0x17')]=_0x4e0cbd[_0x5a21('0x57')];_0x4e0cbd[_0x5a21('0x58')]=_0x4e0cbd[_0x5a21('0x59')];_0x4e0cbd[_0x5a21('0x5a')]=_0x5a21('0x5b');if(_0x8acf47){_0x4e0cbd[_0x5a21('0x5c')]=_0x8acf47[_0x5a21('0x5c')];}return _0x4e0cbd;}exports[_0x5a21('0x5d')]=buildObj;exports[_0x5a21('0x5e')]=function(_0xb6fd65){var _0x89e55f={};_0x89e55f[_0x5a21('0x57')]=_0xb6fd65[_0x5a21('0x57')];_0x89e55f[_0x5a21('0x58')]=_0xb6fd65[_0x5a21('0x59')];_0x89e55f[_0x5a21('0x44')]=_0xb6fd65[_0x5a21('0x44')];return _0x89e55f;};exports[_0x5a21('0x5f')]=function(_0x2e3770){var _0x1bcb7b=[];for(var _0x82c634 in _0x2e3770){if(_0x2e3770[_0x5a21('0x2b')](_0x82c634)){if(!_[_0x5a21('0x14')](_0x2e3770[_0x82c634])&&_0x2e3770[_0x82c634][_0x5a21('0x32')]===_0x5a21('0x60')&&_0x2e3770[_0x82c634][_0x5a21('0x61')]===_0x5a21('0x62')){_0x1bcb7b['push'](_0x2e3770[_0x82c634]['id']);}}}return _0x1bcb7b;};exports[_0x5a21('0x63')]=function(_0x1545a5){var _0x175638=moment()['milliseconds'](0x0);var _0x525420=moment(_0x1545a5)[_0x5a21('0x64')](0x0);return _0x175638['diff'](_0x525420,_0x5a21('0x65'));};exports[_0x5a21('0x66')]=function(_0x4bc01c){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4bc01c[_0x5a21('0x1a')],'ListId':_0x4bc01c[_0x5a21('0x51')],'VoiceQueueId':_0x4bc01c[_0x5a21('0x1c')]||undefined,'CampaignId':_0x4bc01c[_0x5a21('0x67')]||undefined};};exports[_0x5a21('0x68')]=function(_0x4da7c5){if(_0x4da7c5===_0x5a21('0x44')||_0x4da7c5===_0x5a21('0x69')||_0x4da7c5==='queue'||_0x4da7c5===_0x5a21('0x6a')||_0x4da7c5===_0x5a21('0x6b')||_0x4da7c5===_0x5a21('0x6c')||_0x4da7c5===_0x5a21('0x3b')||_0x4da7c5===_0x5a21('0x59')||_0x4da7c5==='calleridname'||_0x4da7c5===_0x5a21('0x4e')||_0x4da7c5===_0x5a21('0x19')||_0x4da7c5==='scheduledat'||_0x4da7c5===_0x5a21('0x6d')||_0x4da7c5===_0x5a21('0x46')||_0x4da7c5==='countnoanswerretry'||_0x4da7c5===_0x5a21('0x6e')||_0x4da7c5===_0x5a21('0x6f')||_0x4da7c5===_0x5a21('0x70')||_0x4da7c5===_0x5a21('0x71')||_0x4da7c5==='recallme'||_0x4da7c5===_0x5a21('0x1a')||_0x4da7c5===_0x5a21('0x51')||_0x4da7c5==='UserId'||_0x4da7c5===_0x5a21('0x1c')||_0x4da7c5===_0x5a21('0x72')||_0x4da7c5===_0x5a21('0x73')||_0x4da7c5==='xmd-queue'||_0x4da7c5==='xmd-phone'||_0x4da7c5===_0x5a21('0x74')||_0x4da7c5===_0x5a21('0x75')||_0x4da7c5===_0x5a21('0x76')||_0x4da7c5===_0x5a21('0x77')||_0x4da7c5===_0x5a21('0x78')||_0x4da7c5===_0x5a21('0x79')||_0x4da7c5===_0x5a21('0x7a')||_0x4da7c5===_0x5a21('0x7b')||_0x4da7c5===_0x5a21('0x7c')||_0x4da7c5===_0x5a21('0x7d')||_0x4da7c5===_0x5a21('0x7e')||_0x4da7c5===_0x5a21('0x7f')||_0x4da7c5==='rtpaudioqosbridged'||_0x4da7c5==='rtpaudioqosjitter'||_0x4da7c5===_0x5a21('0x80')||_0x4da7c5==='rtpaudioqosloss'||_0x4da7c5==='rtpaudioqoslossbridged'||_0x4da7c5===_0x5a21('0x81')||_0x4da7c5===_0x5a21('0x82')||_0x4da7c5==='rtpaudioqos'||_0x4da7c5==='rtpaudioqosbridged'||_0x4da7c5===_0x5a21('0x83')||_0x4da7c5===_0x5a21('0x80')||_0x4da7c5==='rtpaudioqosloss'||_0x4da7c5===_0x5a21('0x84')||_0x4da7c5===_0x5a21('0x81')||_0x4da7c5==='rtpaudioqosrttbridged'||_0x4da7c5===_0x5a21('0x85')||_0x4da7c5===_0x5a21('0x86')||_0x4da7c5==='state'||_0x4da7c5===_0x5a21('0x38')){return![];}return!![];};exports[_0x5a21('0x87')]=function(_0x53aaae,_0x2b314c){var _0x1a8bf8,_0x25b15b,_0x270d0e;if(_0x2b314c<=0x0){_0x2b314c=0x1;}_0x1a8bf8=new RegExp(_0x5a21('0x88')+_0x2b314c+'}$');_0x25b15b=Math[_0x5a21('0x89')](0xa,_0x2b314c-0x1);_0x270d0e=Math[_0x5a21('0x89')](0xa,_0x2b314c)-0x1;return util[_0x5a21('0x12')]('%s',_[_0x5a21('0x8a')](_0x53aaae,_0x1a8bf8,_[_0x5a21('0x8b')](_0x25b15b,_0x270d0e)));};exports['extractCalleridName']=function(_0x8f5a6b){var _0x3992d7=_0x8f5a6b[_0x5a21('0x8c')](/"(.*?)"/);return _0x3992d7?_0x3992d7[0x1]:_0x8f5a6b;};exports[_0x5a21('0x8d')]=function(_0x5e86fb){var _0x2a6c6c=_0x5e86fb[_0x5a21('0x8c')](/<(.*?)>/);return _0x2a6c6c?_0x2a6c6c[0x1]:_0x5e86fb;};function buildNoAnswerEventPayload(_0x514292,_0x3da040){var _0x125678=buildObj(_0x514292,_0x5a21('0x8e'));if(!_[_0x5a21('0x11')](_0x3da040[_0x5a21('0x8f')])){Object[_0x5a21('0x90')](_0x3da040[_0x5a21('0x8f')])[_0x5a21('0x91')](function(_0x5476c9){_0x125678[_0x5476c9[_0x5a21('0x92')]()]=_0x3da040['variables'][_0x5476c9];});}return _0x125678;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file +var _0x2f3c=['string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','xcally-motion-preview','monitor_format','_XCALLY_MIXMONITOR_FORMAT','toLowerVariables','toLower','hasOwnProperty','originated','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','starttime','responsetime','logAgent','ringtime','getSeconds','membername','logCustomer','talktime','answertime','endtime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','scheduledat','add','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','queue','interface','mandatoryDisposition','buildObj','buildAcw','not_inuse','getDiff','milliseconds','diff','seconds','createBody','filterKey','idContact','campaigntype','callback','callbackuniqueid','callbackat','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosjitter','rtpaudioqosrttbridged','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','keys','forEach','toLowerCase','variables','env','127.0.0.1','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','getCallerId','isUndefined'];(function(_0x2a98e3,_0x488997){var _0x370a71=function(_0x3b71cb){while(--_0x3b71cb){_0x2a98e3['push'](_0x2a98e3['shift']());}};_0x370a71(++_0x488997);}(_0x2f3c,0xfe));var _0xc2f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2f3c[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');var logger=require('../../../../config/logger')('preview');var ipAgi=process[_0xc2f3('0x0')]['XCALLY_IP_AGI']||_0xc2f3('0x1');var utils=require('../../dialer/utils');exports[_0xc2f3('0x2')]=function(_0x2a70e7){return function(_0x386265){logger[_0xc2f3('0x3')](_0x2a70e7,util[_0xc2f3('0x4')](_0x386265,{'showHidden':![],'depth':null}));};};exports[_0xc2f3('0x5')]=function(_0x370899,_0x332ce0){logger[_0xc2f3('0x6')](_0x370899,util[_0xc2f3('0x4')](_0x332ce0,{'showHidden':![],'depth':null}));};exports[_0xc2f3('0x7')]=function(_0x897670,_0x1eddbf){logger['error'](_0x897670,util[_0xc2f3('0x4')](_0x1eddbf,{'showHidden':![],'depth':null}));};exports[_0xc2f3('0x8')]=function(_0x4bc8b4){return function(_0x3e3893){logger[_0xc2f3('0x6')](_0x4bc8b4,util[_0xc2f3('0x4')](_0x3e3893,{'showHidden':![],'depth':null}));};};exports[_0xc2f3('0x9')]=function(_0x1e0e51,_0x5b8ec8,_0xdc27a0){return{'message':_0x1e0e51,'unlock':_0x5b8ec8,'active':_0xdc27a0};};exports[_0xc2f3('0xa')]=function(_0x1c8aae,_0x309289,_0x435dfd){if(!_[_0xc2f3('0xb')](_0x435dfd)&&_0xc2f3('0xc')===typeof _0x435dfd&&!_[_0xc2f3('0xd')](_0x435dfd)){if(!_[_0xc2f3('0xb')](_0x309289)&&_0xc2f3('0xc')===typeof _0x309289&&!_['isEmpty'](_0x309289)){return util[_0xc2f3('0xe')]('\x22%s\x22\x20<%s>',_0x309289,_0x435dfd);}return util[_0xc2f3('0xe')](_0xc2f3('0xf'),_0x435dfd,_0x435dfd);}if(!_[_0xc2f3('0xb')](_0x1c8aae)&&_0xc2f3('0xc')===typeof _0x1c8aae&&!_[_0xc2f3('0xd')](_0x1c8aae)){return _0x1c8aae;}return _0xc2f3('0x10');};exports[_0xc2f3('0x11')]=function(_0x237195){if(_[_0xc2f3('0x12')](_0x237195)){return![];}return _0x237195;};exports[_0xc2f3('0x13')]=function(_0x5e97c9,_0x5dcc40,_0x705f60,_0x59bed2,_0x393c03,_0x4f4bf8){var _0x45c9b7={'XMD-QUEUE':_0x5dcc40[_0xc2f3('0x14')]?_0x5dcc40['Queue'][_0xc2f3('0x15')]:'','XMD-CALLERID':_0x59bed2,'XMD-CALLERID-PREVIEW':_0x4f4bf8?util[_0xc2f3('0xe')](_0xc2f3('0xf'),_0x4f4bf8[_0xc2f3('0x16')],_0x4f4bf8[_0xc2f3('0x17')]):_0x59bed2,'XMD-DIALID':_0x393c03,'XMD-CONTACTID':_0x5dcc40[_0xc2f3('0x18')],'XMD-CDRTYPE':_0xc2f3('0x19'),'CALLERID(all)':_0x59bed2,'XMD-VOICEQUEUEID':_0x5dcc40[_0xc2f3('0x1a')],'XMD-DIALCHANNEL':_0x705f60,'XMD-DIALTIMEOUT':_0x5e97c9[_0xc2f3('0x1b')]||0x1e,'XMD-DIALOPTIONS':util['format']('\x22rtTxX%s%s\x22',_0x5e97c9[_0xc2f3('0x1c')]?'g':'',_[_0xc2f3('0xd')](_0x5e97c9['monitor_format'])?'':_0xc2f3('0x1d')),'XMD-DIALURL':_0x5e97c9[_0xc2f3('0x1e')]||'','XMD-AGI':_0x5e97c9['dialQueueProject']?util['format'](_0xc2f3('0x1f'),ipAgi,_0x5e97c9['dialQueueProject']):_0xc2f3('0x20'),'XMD-AGIAFTER':_0x5e97c9[_0xc2f3('0x1c')]?util[_0xc2f3('0xe')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5e97c9['dialQueueProject2']):'NONE','XMD-ORIGINATECALLERIDNUM':_0x4f4bf8?_0x4f4bf8[_0xc2f3('0x21')]:'','XMD-ORIGINATECALLERIDNAME':_0x4f4bf8?_0x4f4bf8['originatecalleridname']:'','XMD-DESTINATION':_0xc2f3('0x22'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0xc2f3('0xd')](_0x5e97c9[_0xc2f3('0x23')])){_0x45c9b7[util[_0xc2f3('0xe')]('%s',_0xc2f3('0x24'))]=_0x5e97c9[_0xc2f3('0x23')];_0x45c9b7[util[_0xc2f3('0xe')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x393c03;}return _0x45c9b7;};exports[_0xc2f3('0x25')]=function(_0x37a983){var _0x49557f={};for(var _0x530464 in _0x37a983){if(_0x37a983['hasOwnProperty'](_0x530464)){_0x49557f[util[_0xc2f3('0xe')]('%s',_[_0xc2f3('0x26')](_0x530464))]=_0x37a983[_0x530464];}}return{'variables':_0x49557f};};exports['updateOriginated']=function(_0x5d36e0,_0x60a90c){if(!_[_0xc2f3('0x12')](_0x5d36e0)){if(_0x5d36e0[_0xc2f3('0x27')](_0xc2f3('0x28'))){if(_0x5d36e0[_0xc2f3('0x28')]>0x0){_0x5d36e0[_0xc2f3('0x28')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x60a90c);}}}else{logger[_0xc2f3('0x3')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x60a90c);}};exports[_0xc2f3('0x29')]=function(_0x457ab8){var _0x340352=moment()['format'](_0xc2f3('0x2a'));_0x457ab8[_0xc2f3('0x2b')]=0xd;_0x457ab8[_0xc2f3('0x2c')]='Blacklist';_0x457ab8[_0xc2f3('0x2d')]=_0x340352;_0x457ab8[_0xc2f3('0x2e')]=_0x340352;_0x457ab8['endtime']=_0x340352;};exports[_0xc2f3('0x2f')]=function(_0x36edb0,_0x13130d,_0x35526a){var _0x557f52=moment()[_0xc2f3('0xe')](_0xc2f3('0x2a'));_0x36edb0[_0xc2f3('0x2b')]=_0x13130d;_0x36edb0[_0xc2f3('0x2c')]=_0x35526a;_0x36edb0['responsetime']=_0x557f52;_0x36edb0[_0xc2f3('0x30')]=utils[_0xc2f3('0x31')](_0x36edb0[_0xc2f3('0x2e')],_0x36edb0[_0xc2f3('0x2d')]);};exports['logLookAgent']=function(_0x21d1a7,_0x4b353b,_0x29d9d4){_0x21d1a7[_0xc2f3('0x32')]=_0x4b353b;_0x21d1a7['UserId']=_0x29d9d4;};exports[_0xc2f3('0x33')]=function(_0x3d8ce2,_0x2b5284,_0x9c40f){var _0xbbd188=moment()['format'](_0xc2f3('0x2a'));_0x3d8ce2[_0xc2f3('0x2b')]=_0x2b5284;_0x3d8ce2[_0xc2f3('0x2c')]=_0x9c40f;_0x3d8ce2[_0xc2f3('0x2e')]=_0x3d8ce2[_0xc2f3('0x2e')]?_0x3d8ce2[_0xc2f3('0x2e')]:_0xbbd188;_0x3d8ce2['endtime']=_0x3d8ce2['endtime']?_0x3d8ce2['endtime']:_0xbbd188;_0x3d8ce2['ringtime']=utils['getSeconds'](_0x3d8ce2[_0xc2f3('0x2e')]||0x0,_0x3d8ce2[_0xc2f3('0x2d')]||0x0);_0x3d8ce2[_0xc2f3('0x34')]=_0x3d8ce2[_0xc2f3('0x35')]?utils[_0xc2f3('0x31')](_0x3d8ce2[_0xc2f3('0x36')],_0x3d8ce2[_0xc2f3('0x35')]):0x0;};exports[_0xc2f3('0x37')]=function(_0x5e23de){return _0x5e23de===_0xc2f3('0x38');};exports[_0xc2f3('0x39')]=function(_0x17ec39,_0x3d6558,_0xfdfb6b,_0x52e35c,_0x28ef1a){var _0x22c9fc=_0x52e35c?_0xc2f3('0x3a'):_0x17ec39[_0xc2f3('0x16')];_0x22c9fc=_0x28ef1a?_0xc2f3('0x3b'):_0x22c9fc;return{'actionid':_0x17ec39[_0xc2f3('0x3c')],'action':_0xc2f3('0x3d'),'channel':_0x17ec39[_0xc2f3('0x3e')],'callerid':util[_0xc2f3('0xe')](_0xc2f3('0xf'),_0x22c9fc,_0x17ec39[_0xc2f3('0x17')]),'Exten':_0xc2f3('0x22'),'Context':_0xc2f3('0x3f'),'Priority':'1','variable':_0xfdfb6b,'timeout':(_0x3d6558[_0xc2f3('0x40')]||0x1e)*0x3e8,'async':!![],'channelid':_0x17ec39[_0xc2f3('0x3c')]};};exports[_0xc2f3('0x41')]=function(_0x358162){return _0x358162[_0xc2f3('0x42')]+_0x358162['countcongestionretry']+_0x358162[_0xc2f3('0x43')]+_0x358162[_0xc2f3('0x44')]+_0x358162[_0xc2f3('0x45')];};exports[_0xc2f3('0x46')]=function(_0x360b1d){var _0x2fa7a3=_[_0xc2f3('0x47')](_0x360b1d);_0x2fa7a3['state']=0xf;_0x2fa7a3['statedesc']=_0xc2f3('0x48');return _0x2fa7a3;};exports[_0xc2f3('0x49')]=function(_0xf3d5a1,_0x3bf130,_0x5e0684){var _0x5e9781={};_0x5e9781[_0x3bf130]=_0xf3d5a1[_0x3bf130];_0x5e9781['active']=![];_0x5e9781[_0xc2f3('0x4a')]=moment()[_0xc2f3('0x4b')](_0x5e0684,'minutes')[_0xc2f3('0xe')](_0xc2f3('0x2a'));_0x5e9781[_0xc2f3('0x18')]=_0xf3d5a1[_0xc2f3('0x18')];_0x5e9781[_0xc2f3('0x4c')]=_0xf3d5a1['ListId'];_0x5e9781[_0xc2f3('0x1a')]=_0xf3d5a1[_0xc2f3('0x1a')]||undefined;return _0x5e9781;};exports[_0xc2f3('0x4d')]=function(_0x17f663,_0x15c2bd){if(!_['isNil'](_0x17f663)){if(_0x17f663[_0xc2f3('0x4e')]>0x0){_0x17f663[_0xc2f3('0x4e')]-=0x1;}else{logger[_0xc2f3('0x3')](_0x15c2bd,_0xc2f3('0x4f'));}}else{logger[_0xc2f3('0x3')](_0x15c2bd,_0xc2f3('0x50'));}};exports[_0xc2f3('0x51')]=function(_0xac7d2c){if(_0xac7d2c<=0x0){return!![];}return![];};function buildObj(_0x2df8eb,_0x192527,_0x319fd8){_0x2df8eb['lastevent']=_0x192527;_0x2df8eb[_0xc2f3('0x15')]=_0x2df8eb[_0xc2f3('0x52')];_0x2df8eb[_0xc2f3('0x53')]=_0x2df8eb['channelAgent'];_0x2df8eb['motionChannel']='voice';if(_0x319fd8){_0x2df8eb[_0xc2f3('0x54')]=_0x319fd8[_0xc2f3('0x54')];}return _0x2df8eb;}exports[_0xc2f3('0x55')]=buildObj;exports[_0xc2f3('0x56')]=function(_0x592599){var _0x4a3274={};_0x4a3274[_0xc2f3('0x52')]=_0x592599[_0xc2f3('0x52')];_0x4a3274[_0xc2f3('0x53')]=_0x592599[_0xc2f3('0x3e')];_0x4a3274[_0xc2f3('0x3c')]=_0x592599[_0xc2f3('0x3c')];return _0x4a3274;};exports['agentReadyId']=function(_0x3fb28f){var _0x3b4e39=[];for(var _0x2a0824 in _0x3fb28f){if(_0x3fb28f[_0xc2f3('0x27')](_0x2a0824)){if(!_[_0xc2f3('0x12')](_0x3fb28f[_0x2a0824])&&_0x3fb28f[_0x2a0824][_0xc2f3('0x2b')]===_0xc2f3('0x57')&&_0x3fb28f[_0x2a0824]['status']==='reachable'){_0x3b4e39['push'](_0x3fb28f[_0x2a0824]['id']);}}}return _0x3b4e39;};exports[_0xc2f3('0x58')]=function(_0x23e0be){var _0x2f6a4d=moment()[_0xc2f3('0x59')](0x0);var _0x3b9551=moment(_0x23e0be)[_0xc2f3('0x59')](0x0);return _0x2f6a4d[_0xc2f3('0x5a')](_0x3b9551,_0xc2f3('0x5b'));};exports[_0xc2f3('0x5c')]=function(_0x13243d){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x13243d[_0xc2f3('0x18')],'ListId':_0x13243d[_0xc2f3('0x4c')],'VoiceQueueId':_0x13243d[_0xc2f3('0x1a')]||undefined,'CampaignId':_0x13243d['CampaignId']||undefined};};exports[_0xc2f3('0x5d')]=function(_0x2ebe8){if(_0x2ebe8===_0xc2f3('0x3c')||_0x2ebe8===_0xc2f3('0x5e')||_0x2ebe8===_0xc2f3('0x52')||_0x2ebe8==='type'||_0x2ebe8===_0xc2f3('0x5f')||_0x2ebe8==='dialAnswer'||_0x2ebe8===_0xc2f3('0x32')||_0x2ebe8===_0xc2f3('0x3e')||_0x2ebe8===_0xc2f3('0x16')||_0x2ebe8==='active'||_0x2ebe8===_0xc2f3('0x17')||_0x2ebe8===_0xc2f3('0x4a')||_0x2ebe8===_0xc2f3('0x42')||_0x2ebe8==='countcongestionretry'||_0x2ebe8===_0xc2f3('0x43')||_0x2ebe8==='countglobal'||_0x2ebe8===_0xc2f3('0x60')||_0x2ebe8===_0xc2f3('0x61')||_0x2ebe8===_0xc2f3('0x62')||_0x2ebe8==='recallme'||_0x2ebe8===_0xc2f3('0x18')||_0x2ebe8===_0xc2f3('0x4c')||_0x2ebe8==='UserId'||_0x2ebe8===_0xc2f3('0x1a')||_0x2ebe8===_0xc2f3('0x63')||_0x2ebe8===_0xc2f3('0x64')||_0x2ebe8===_0xc2f3('0x65')||_0x2ebe8===_0xc2f3('0x66')||_0x2ebe8===_0xc2f3('0x67')||_0x2ebe8===_0xc2f3('0x68')||_0x2ebe8===_0xc2f3('0x69')||_0x2ebe8===_0xc2f3('0x6a')||_0x2ebe8===_0xc2f3('0x6b')||_0x2ebe8===_0xc2f3('0x6c')||_0x2ebe8===_0xc2f3('0x6d')||_0x2ebe8==='xmd-cdrtype'||_0x2ebe8===_0xc2f3('0x6e')||_0x2ebe8===_0xc2f3('0x6f')||_0x2ebe8===_0xc2f3('0x70')||_0x2ebe8===_0xc2f3('0x71')||_0x2ebe8===_0xc2f3('0x72')||_0x2ebe8==='rtpaudioqosjitter'||_0x2ebe8===_0xc2f3('0x73')||_0x2ebe8==='rtpaudioqosloss'||_0x2ebe8===_0xc2f3('0x74')||_0x2ebe8===_0xc2f3('0x75')||_0x2ebe8==='rtpaudioqosrttbridged'||_0x2ebe8===_0xc2f3('0x71')||_0x2ebe8===_0xc2f3('0x72')||_0x2ebe8===_0xc2f3('0x76')||_0x2ebe8===_0xc2f3('0x73')||_0x2ebe8==='rtpaudioqosloss'||_0x2ebe8===_0xc2f3('0x74')||_0x2ebe8===_0xc2f3('0x75')||_0x2ebe8===_0xc2f3('0x77')||_0x2ebe8==='bridgepeer'||_0x2ebe8==='bridgepvtcallid'||_0x2ebe8===_0xc2f3('0x2b')||_0x2ebe8===_0xc2f3('0x2c')){return![];}return!![];};exports[_0xc2f3('0x78')]=function(_0x3cc8a3,_0x1d80fc){var _0x3cbea5,_0x448048,_0x1cd153;if(_0x1d80fc<=0x0){_0x1d80fc=0x1;}_0x3cbea5=new RegExp(_0xc2f3('0x79')+_0x1d80fc+'}$');_0x448048=Math['pow'](0xa,_0x1d80fc-0x1);_0x1cd153=Math[_0xc2f3('0x7a')](0xa,_0x1d80fc)-0x1;return util[_0xc2f3('0xe')]('%s',_[_0xc2f3('0x7b')](_0x3cc8a3,_0x3cbea5,_[_0xc2f3('0x7c')](_0x448048,_0x1cd153)));};exports[_0xc2f3('0x7d')]=function(_0x3c086c){var _0x2c428b=_0x3c086c[_0xc2f3('0x7e')](/"(.*?)"/);return _0x2c428b?_0x2c428b[0x1]:_0x3c086c;};exports[_0xc2f3('0x7f')]=function(_0x4eb6f2){var _0x5dd48f=_0x4eb6f2[_0xc2f3('0x7e')](/<(.*?)>/);return _0x5dd48f?_0x5dd48f[0x1]:_0x4eb6f2;};function buildNoAnswerEventPayload(_0x2df978,_0x5780f8){var _0xd163e7=buildObj(_0x2df978,_0xc2f3('0x80'));if(!_[_0xc2f3('0xd')](_0x5780f8['variables'])){Object[_0xc2f3('0x81')](_0x5780f8['variables'])[_0xc2f3('0x82')](function(_0x1303a4){_0xd163e7[_0x1303a4[_0xc2f3('0x83')]()]=_0x5780f8[_0xc2f3('0x84')][_0x1303a4];});}return _0xd163e7;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index c226957..1098d51 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 _0xeb24=['string','number','queueremove','boolean','reload','voicequeuechannelhangup','queueadd'];(function(_0x27ce3b,_0x2eac83){var _0x655f40=function(_0x4d8eec){while(--_0x4d8eec){_0x27ce3b['push'](_0x27ce3b['shift']());}};_0x655f40(++_0x2eac83);}(_0xeb24,0xd8));var _0x4eb2=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xeb24[_0x465a0c];return _0x1e202e;};'use strict';exports[_0x4eb2('0x0')]={'queue':{'type':_0x4eb2('0x1'),'required':!![]},'interface':{'type':_0x4eb2('0x1'),'required':!![]},'membername':{'type':_0x4eb2('0x1'),'required':!![]},'penalty':{'type':_0x4eb2('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0x4eb2('0x3')]={'queue':{'type':_0x4eb2('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0x4eb2('0x1'),'required':!![]},'paused':{'type':_0x4eb2('0x4')},'reason':{'type':_0x4eb2('0x1'),'required':![]}};exports[_0x4eb2('0x5')]={'module':{'type':_0x4eb2('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x4eb2('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x4eb2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0x4eb2('0x1')}};exports[_0x4eb2('0x6')]={'uniqueid':{'type':_0x4eb2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x4eb2('0x1'),'required':!![]},'context':{'type':_0x4eb2('0x1')}}; \ No newline at end of file +var _0x9042=['reload','voicequeuechannel','voicequeuechannelhangup','string','number'];(function(_0x470e67,_0x4a596d){var _0x28bbde=function(_0x1bbf56){while(--_0x1bbf56){_0x470e67['push'](_0x470e67['shift']());}};_0x28bbde(++_0x4a596d);}(_0x9042,0x8f));var _0x2904=function(_0x484cac,_0x30ad3a){_0x484cac=_0x484cac-0x0;var _0x1d6e77=_0x9042[_0x484cac];return _0x1d6e77;};'use strict';exports['queueadd']={'queue':{'type':_0x2904('0x0'),'required':!![]},'interface':{'type':_0x2904('0x0'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x2904('0x1'),'required':![]},'paused':{'type':'boolean','required':![]}};exports['queueremove']={'queue':{'type':_0x2904('0x0'),'required':!![]},'interface':{'type':_0x2904('0x0'),'required':!![]}};exports['queuepause']={'interface':{'type':_0x2904('0x0'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x2904('0x0'),'required':![]}};exports[_0x2904('0x2')]={'module':{'type':_0x2904('0x0'),'required':![]}};exports[_0x2904('0x3')]={'uniqueid':{'type':'string','required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x2904('0x0'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0x2904('0x0')},'mixmonitorid':{'type':_0x2904('0x0')}};exports[_0x2904('0x4')]={'uniqueid':{'type':_0x2904('0x0'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x2904('0x0'),'required':!![]},'context':{'type':_0x2904('0x0')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index c8c3f26..6ef7d2c 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 _0x0b0e=['total','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','initAgents','length','isNil','SIP/%s','isUndefined','prototype','initTelephones','initTrunks','trunks','initTriggers','initTemplates','salesforceAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queue','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','diff','queuecallercomplete','answered','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','lodash','util','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','voiceQueues','triggers','templates','outbound','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','faxAccounts','mapKeys','name','hasOwnProperty','format','interface'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x0b0e,0x187));var _0xe0b0=function(_0x438685,_0x4ec0c0){_0x438685=_0x438685-0x0;var _0x41cca2=_0x0b0e[_0x438685];return _0x41cca2;};'use strict';var _=require(_0xe0b0('0x0'));var moment=require('moment');var util=require(_0xe0b0('0x1'));var Agent=require('../model/agent');var Telephone=require(_0xe0b0('0x2'));var Trunk=require(_0xe0b0('0x3'));var VoiceQueue=require(_0xe0b0('0x4'));var Trigger=require(_0xe0b0('0x5'));var Template=require(_0xe0b0('0x6'));var Campaign=require(_0xe0b0('0x7'));var VoiceExtension=require(_0xe0b0('0x8'));var ZendeskAccount=require(_0xe0b0('0x9'));var SalesforceAccount=require(_0xe0b0('0xa'));var FreshdeskAccount=require(_0xe0b0('0xb'));var SugarcrmAccount=require(_0xe0b0('0xc'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xe0b0('0xd'));var ServicenowAccount=require(_0xe0b0('0xe'));var Dynamics365Account=require(_0xe0b0('0xf'));var FreshsalesAccount=require(_0xe0b0('0x10'));var FaxAccount=require('../model/faxAccount');function Realtime(){this[_0xe0b0('0x11')]={};this[_0xe0b0('0x12')]={};this['trunks']={};this[_0xe0b0('0x13')]={};this[_0xe0b0('0x14')]={};this['campaigns']={};this[_0xe0b0('0x15')]={};this[_0xe0b0('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xe0b0('0x17')]={};this['channels']={};this[_0xe0b0('0x18')]={};this[_0xe0b0('0x19')]={};this[_0xe0b0('0x1a')]={};this[_0xe0b0('0x1b')]={};this[_0xe0b0('0x1c')]={};this['salesforceAccounts']={};this[_0xe0b0('0x1d')]={};this[_0xe0b0('0x1e')]={};this[_0xe0b0('0x1f')]={};this[_0xe0b0('0x20')]={};this[_0xe0b0('0x21')]={};this['servicenowAccounts']={};this[_0xe0b0('0x22')]={};this['freshsalesAccounts']={};this[_0xe0b0('0x23')]={};}function freeIsNotKey(_0xadee6e,_0x519ae8,_0x11fdca){var _0x4a4cc0=_[_0xe0b0('0x24')](_0xadee6e,function(_0x100204){return _0x100204[_0x11fdca];});for(var _0x56bcc7 in _0x519ae8){if(_0x519ae8['hasOwnProperty'](_0x56bcc7)){if(!_0x4a4cc0[_0x56bcc7]){delete _0x519ae8[_0x56bcc7];}}}}function freeIsNotKeySip(_0x46bb44,_0x50a441){var _0x4df8da=_['mapKeys'](_0x46bb44,function(_0x1920ee){return util['format']('SIP/%s',_0x1920ee[_0xe0b0('0x25')]);});for(var _0x59dff5 in _0x50a441){if(_0x50a441[_0xe0b0('0x26')](_0x59dff5)){if(!_0x4df8da[_0x59dff5]){delete _0x50a441[_0x59dff5];}}}}function freeIsNotKeyAgent(_0x5dba2f,_0x2c84cc){var _0x1cd7c4=_[_0xe0b0('0x24')](_0x5dba2f,function(_0x310a6d){var _0x2cf6a1=_['isNil'](_0x310a6d['interface'])?util[_0xe0b0('0x27')]('SIP/%s',_0x310a6d[_0xe0b0('0x25')]):_0x310a6d[_0xe0b0('0x28')];return _0x2cf6a1;});for(var _0x513e63 in _0x2c84cc){if(_0x2c84cc[_0xe0b0('0x26')](_0x513e63)){if(!_0x1cd7c4[_0x513e63]){delete _0x2c84cc[_0x513e63];}}}}function clearVoiceCallReports(_0x503883){_0x503883[_0xe0b0('0x29')]=0x0;_0x503883['answered']=0x0;_0x503883[_0xe0b0('0x2a')]=0x0;_0x503883['sumDuration']=0x0;_0x503883[_0xe0b0('0x2b')]=0x0;}function clearCampaigns(_0x4de537){if(!_[_0xe0b0('0x2c')](_0x4de537)){for(var _0x4aafbe in _0x4de537){if(_0x4de537[_0xe0b0('0x26')](_0x4aafbe)){_0x4de537[_0x4aafbe]['ivrTotalCallsDays']=0x0;_0x4de537[_0x4aafbe][_0xe0b0('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x3c3bc2){if(!_[_0xe0b0('0x2c')](_0x3c3bc2)){for(var _0x1d91ad in _0x3c3bc2){if(_0x3c3bc2[_0xe0b0('0x26')](_0x1d91ad)){_0x3c3bc2[_0x1d91ad][_0xe0b0('0x29')]=0x0;_0x3c3bc2[_0x1d91ad]['answered']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2e')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2f')]=0x0;_0x3c3bc2[_0x1d91ad]['sumHoldTime']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x30')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2b')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x32')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x33')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x34')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x35')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundUnknownCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x36')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x37')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundBlacklistCallsDay']=0x0;_0x3c3bc2[_0x1d91ad]['outboundOriginateFailureCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x38')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x39')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3a')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3b')]=!![];}}}}Realtime['prototype'][_0xe0b0('0x3c')]=function(_0x3231fc,_0x7867c4){for(var _0x29d725 in _0x7867c4){if(_0x3231fc[_0xe0b0('0x26')](_0x29d725)){_0x3231fc[_0x29d725]=_0x7867c4[_0x29d725];}}};Realtime['prototype'][_0xe0b0('0x3d')]=function(){var _0x208945=this;return function(_0xfc51d3){if(_0xfc51d3){freeIsNotKeyAgent(_0xfc51d3,_0x208945[_0xe0b0('0x11')]);for(var _0x3575bc=0x0,_0x12eeb8={};_0x3575bc<_0xfc51d3[_0xe0b0('0x3e')];_0x3575bc+=0x1){_0x12eeb8=_0xfc51d3[_0x3575bc];var _0x20908f=_[_0xe0b0('0x3f')](_0x12eeb8[_0xe0b0('0x28')])?util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x12eeb8[_0xe0b0('0x25')]):_0x12eeb8[_0xe0b0('0x28')];if(_[_0xe0b0('0x41')](_0x208945['agents'][_0x20908f])){_0x208945[_0xe0b0('0x11')][_0x20908f]=new Agent(_0x12eeb8);}else{_0x208945[_0xe0b0('0x3c')](_0x208945[_0xe0b0('0x11')][_0x20908f],_0x12eeb8);}}}return _0x208945[_0xe0b0('0x11')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x43')]=function(){var _0x12024d=this;return function(_0x533fc7){if(_0x533fc7){freeIsNotKeySip(_0x533fc7,_0x12024d['telephones']);for(var _0x549d9a=0x0,_0x5317df={};_0x549d9a<_0x533fc7[_0xe0b0('0x3e')];_0x549d9a+=0x1){_0x5317df=_0x533fc7[_0x549d9a];if(_[_0xe0b0('0x41')](_0x12024d[_0xe0b0('0x12')][util['format'](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])])){_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')]('SIP/%s',_0x5317df[_0xe0b0('0x25')])]=new Telephone(_0x5317df);}else{_0x12024d[_0xe0b0('0x3c')](_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])],_0x5317df);}}}return _0x12024d[_0xe0b0('0x12')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x44')]=function(){var _0x54f251=this;return function(_0x3e349b){if(_0x3e349b){freeIsNotKeySip(_0x3e349b,_0x54f251['trunks']);for(var _0x34178d=0x0,_0x2d5f47={};_0x34178d<_0x3e349b[_0xe0b0('0x3e')];_0x34178d+=0x1){_0x2d5f47=_0x3e349b[_0x34178d];if(_[_0xe0b0('0x41')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])])){_0x54f251[_0xe0b0('0x45')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])]=new Trunk(_0x2d5f47);}else{_0x54f251[_0xe0b0('0x3c')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47['name'])],_0x2d5f47);}}}return _0x54f251['trunks'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x46')]=function(){var _0x56e7df=this;return function(_0x18a59d){if(_0x18a59d){freeIsNotKey(_0x18a59d,_0x56e7df[_0xe0b0('0x14')],'id');for(var _0x6bca5c=0x0,_0x1c869d={};_0x6bca5c<_0x18a59d[_0xe0b0('0x3e')];_0x6bca5c+=0x1){_0x1c869d=_0x18a59d[_0x6bca5c];if(_['isUndefined'](_0x56e7df['triggers'][_0x1c869d['id']])){_0x56e7df['triggers'][_0x1c869d['id']]=new Trigger(_0x1c869d);}else{_0x56e7df[_0xe0b0('0x3c')](_0x56e7df[_0xe0b0('0x14')][_0x1c869d['id']],_0x1c869d);}}}return _0x56e7df['triggers'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x47')]=function(){var _0x14197b=this;return function(_0x5f037d){if(_0x5f037d){freeIsNotKey(_0x5f037d,_0x14197b[_0xe0b0('0x15')],'id');for(var _0x5c6f94=0x0,_0x57d4b0={};_0x5c6f94<_0x5f037d[_0xe0b0('0x3e')];_0x5c6f94+=0x1){_0x57d4b0=_0x5f037d[_0x5c6f94];if(_[_0xe0b0('0x41')](_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']])){_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']]=new Template(_0x57d4b0);}else{_0x14197b[_0xe0b0('0x3c')](_0x14197b['templates'][_0x57d4b0['id']],_0x57d4b0);}}}return _0x14197b[_0xe0b0('0x15')];};};Realtime[_0xe0b0('0x42')]['initZendeskAccounts']=function(){var _0x50c805=this;return function(_0x5ddad1){if(_0x5ddad1){freeIsNotKey(_0x5ddad1,_0x50c805[_0xe0b0('0x1c')],'id');for(var _0x2184d3=0x0,_0x2419ce={};_0x2184d3<_0x5ddad1[_0xe0b0('0x3e')];_0x2184d3+=0x1){_0x2419ce=_0x5ddad1[_0x2184d3];if(_['isUndefined'](_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']])){_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']]=new ZendeskAccount(_0x2419ce);}else{_0x50c805['mergeFromDatabase'](_0x50c805['zendeskAccounts'][_0x2419ce['id']],_0x2419ce);}}}return _0x50c805[_0xe0b0('0x1c')];};};Realtime[_0xe0b0('0x42')]['initSalesforceAccounts']=function(){var _0x2b1917=this;return function(_0x27fd31){if(_0x27fd31){freeIsNotKey(_0x27fd31,_0x2b1917['salesforceAccounts'],'id');for(var _0x5cb2b6=0x0,_0x123ad2={};_0x5cb2b6<_0x27fd31['length'];_0x5cb2b6+=0x1){_0x123ad2=_0x27fd31[_0x5cb2b6];if(_[_0xe0b0('0x41')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']])){_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']]=new SalesforceAccount(_0x123ad2);}else{_0x2b1917[_0xe0b0('0x3c')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']],_0x123ad2);}}}return _0x2b1917[_0xe0b0('0x48')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x2ef908=this;return function(_0x5d380a){if(_0x5d380a){freeIsNotKey(_0x5d380a,_0x2ef908['freshdeskAccounts'],'id');for(var _0x249d9a=0x0,_0x222174={};_0x249d9a<_0x5d380a['length'];_0x249d9a+=0x1){_0x222174=_0x5d380a[_0x249d9a];if(_['isUndefined'](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']])){_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']]=new FreshdeskAccount(_0x222174);}else{_0x2ef908[_0xe0b0('0x3c')](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']],_0x222174);}}}return _0x2ef908[_0xe0b0('0x1e')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x49')]=function(){var _0x4ebb0f=this;return function(_0x22c7bc){if(_0x22c7bc){freeIsNotKey(_0x22c7bc,_0x4ebb0f['zohoAccounts'],'id');for(var _0x17b3d4=0x0,_0x54106c={};_0x17b3d4<_0x22c7bc['length'];_0x17b3d4+=0x1){_0x54106c=_0x22c7bc[_0x17b3d4];if(_[_0xe0b0('0x41')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']])){_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']]=new ZohoAccount(_0x54106c);}else{_0x4ebb0f[_0xe0b0('0x3c')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']],_0x54106c);}}}return _0x4ebb0f[_0xe0b0('0x1f')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4a')]=function(){var _0x2e1c9b=this;return function(_0x4e0d87){if(_0x4e0d87){freeIsNotKey(_0x4e0d87,_0x2e1c9b[_0xe0b0('0x20')],'id');for(var _0x57ccc9=0x0,_0x2b5553={};_0x57ccc9<_0x4e0d87[_0xe0b0('0x3e')];_0x57ccc9+=0x1){_0x2b5553=_0x4e0d87[_0x57ccc9];if(_[_0xe0b0('0x41')](_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']])){_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']]=new DeskAccount(_0x2b5553);}else{_0x2e1c9b[_0xe0b0('0x3c')](_0x2e1c9b['deskAccounts'][_0x2b5553['id']],_0x2b5553);}}}return _0x2e1c9b[_0xe0b0('0x20')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4b')]=function(){var _0x271445=this;return function(_0x3bb6d6){if(_0x3bb6d6){freeIsNotKey(_0x3bb6d6,_0x271445[_0xe0b0('0x1d')],'id');for(var _0x234cb7=0x0,_0x1a60d2={};_0x234cb7<_0x3bb6d6[_0xe0b0('0x3e')];_0x234cb7+=0x1){_0x1a60d2=_0x3bb6d6[_0x234cb7];if(_[_0xe0b0('0x41')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']])){_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']]=new SugarcrmAccount(_0x1a60d2);}else{_0x271445[_0xe0b0('0x3c')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']],_0x1a60d2);}}}return _0x271445[_0xe0b0('0x1d')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4c')]=function(){var _0x155738=this;return function(_0x5aa79b){if(_0x5aa79b){freeIsNotKey(_0x5aa79b,_0x155738[_0xe0b0('0x21')],'id');for(var _0xe7fbac=0x0,_0x1182dc={};_0xe7fbac<_0x5aa79b[_0xe0b0('0x3e')];_0xe7fbac+=0x1){_0x1182dc=_0x5aa79b[_0xe7fbac];if(_[_0xe0b0('0x41')](_0x155738[_0xe0b0('0x21')][_0x1182dc['id']])){_0x155738[_0xe0b0('0x21')][_0x1182dc['id']]=new VtigerAccount(_0x1182dc);}else{_0x155738['mergeFromDatabase'](_0x155738['vtigerAccounts'][_0x1182dc['id']],_0x1182dc);}}}return _0x155738[_0xe0b0('0x21')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4d')]=function(){var _0x47ecc1=this;return function(_0x117d20){if(_0x117d20){freeIsNotKey(_0x117d20,_0x47ecc1[_0xe0b0('0x4e')],'id');for(var _0x309efb=0x0,_0x3d820c={};_0x309efb<_0x117d20[_0xe0b0('0x3e')];_0x309efb+=0x1){_0x3d820c=_0x117d20[_0x309efb];if(_['isUndefined'](_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']])){_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']]=new ServicenowAccount(_0x3d820c);}else{_0x47ecc1[_0xe0b0('0x3c')](_0x47ecc1['servicenowAccounts'][_0x3d820c['id']],_0x3d820c);}}}return _0x47ecc1[_0xe0b0('0x4e')];};};Realtime[_0xe0b0('0x42')]['initDynamics365Accounts']=function(){var _0x1bd249=this;return function(_0x4c5478){if(_0x4c5478){freeIsNotKey(_0x4c5478,_0x1bd249['dynamics365Accounts'],'id');for(var _0x4474ac=0x0,_0x57b51e={};_0x4474ac<_0x4c5478['length'];_0x4474ac+=0x1){_0x57b51e=_0x4c5478[_0x4474ac];if(_[_0xe0b0('0x41')](_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']])){_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']]=new Dynamics365Account(_0x57b51e);}else{_0x1bd249[_0xe0b0('0x3c')](_0x1bd249['dynamics365Accounts'][_0x57b51e['id']],_0x57b51e);}}}return _0x1bd249[_0xe0b0('0x22')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4f')]=function(){var _0x41ec8e=this;return function(_0x1b29c){if(_0x1b29c){freeIsNotKey(_0x1b29c,_0x41ec8e[_0xe0b0('0x50')],'id');for(var _0xc5e88c=0x0,_0x224f1e={};_0xc5e88c<_0x1b29c['length'];_0xc5e88c+=0x1){_0x224f1e=_0x1b29c[_0xc5e88c];if(_['isUndefined'](_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']])){_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']]=new FreshsalesAccount(_0x224f1e);}else{_0x41ec8e[_0xe0b0('0x3c')](_0x41ec8e['freshsalesAccounts'][_0x224f1e['id']],_0x224f1e);}}}return _0x41ec8e['freshsalesAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x51')]=function(){var _0x5d7cf4=this;return function(_0x5eca3d){for(var _0x691136=0x0;_0x691136<_0x5eca3d[_0xe0b0('0x3e')];_0x691136+=0x1){_[_0xe0b0('0x52')](_0x5d7cf4[_0xe0b0('0x13')][_0x5eca3d[_0x691136][_0xe0b0('0x25')]],_0x5eca3d[_0x691136]);}return _0x5d7cf4[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x53')]=function(){var _0x51f209=this;return function(_0x1daff7){clearVoiceQueues(_0x51f209[_0xe0b0('0x13')]);if(_0x1daff7){_0x1daff7=_[_0xe0b0('0x54')](_0x1daff7,'uniqueid');for(var _0x4fbf44 in _0x1daff7){if(_0x1daff7['hasOwnProperty'](_0x4fbf44)){for(var _0x56ee83=0x0;_0x56ee83<_0x1daff7[_0x4fbf44]['length'];_0x56ee83+=0x1){var _0x567c06=_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x55')];if(_0x51f209['voiceQueues'][_0x567c06]){if(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexit']){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2e')]+=0x1;}if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x56')]){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2f')]+=0x1;}_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')])['diff'](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x58')]),_0xe0b0('0x59'))||0x0;if(_0x56ee83===_0x1daff7[_0x4fbf44][_0xe0b0('0x3e')]-0x1){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5a')]||_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5b')]||_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexitAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerjoinAt']),_0xe0b0('0x59'))||0x0;_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x29')]+=0x1;if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5d')]){_0x51f209['voiceQueues'][_0x567c06][_0xe0b0('0x5e')]+=0x1;_0x51f209[_0xe0b0('0x13')][_0x567c06]['sumBillable']+=moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallercompleteAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')]),_0xe0b0('0x59'))||0x0;}}else{_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]||0x0;}}}}}}return _0x51f209[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x5f')]=function(){var _0x5a63e6=this;return function(_0x4c512b){clearVoiceCallReports(_0x5a63e6[_0xe0b0('0x16')]);if(_0x4c512b){for(var _0x4880d5=0x0;_0x4880d5<_0x4c512b['length'];_0x4880d5+=0x1){_0x5a63e6['outbound']['total']+=0x1;_0x5a63e6[_0xe0b0('0x16')]['sumDuration']+=_0x4c512b[_0x4880d5][_0xe0b0('0x60')];if(_0x4c512b[_0x4880d5][_0xe0b0('0x61')]===_0xe0b0('0x62')){_0x5a63e6[_0xe0b0('0x16')]['answered']+=0x1;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2a')]+=_0x4c512b[_0x4880d5]['duration']-_0x4c512b[_0x4880d5][_0xe0b0('0x63')]||0x0;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2b')]+=_0x4c512b[_0x4880d5][_0xe0b0('0x63')];}}}return _0x5a63e6[_0xe0b0('0x16')];};};Realtime['prototype']['initCampaigns']=function(){var _0x55aef7=this;return function(_0x545694){if(_0x545694){freeIsNotKey(_0x545694,_0x55aef7['campaigns'],_0xe0b0('0x25'));for(var _0x567e1a=0x0,_0x3c09af={};_0x567e1a<_0x545694['length'];_0x567e1a+=0x1){_0x3c09af=_0x545694[_0x567e1a];if(_[_0xe0b0('0x41')](_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]])){_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]]=new Campaign(_0x3c09af);}else{_0x55aef7[_0xe0b0('0x3c')](_0x55aef7['campaigns'][_0x3c09af['name']],_0x3c09af);_0x55aef7['campaigns'][_0x3c09af['name']][_0xe0b0('0x65')]=_0x3c09af[_0xe0b0('0x66')]?_0x3c09af[_0xe0b0('0x66')][_0xe0b0('0x25')]:undefined;}}}return _0x55aef7[_0xe0b0('0x64')];};};Realtime['prototype'][_0xe0b0('0x67')]=function(){var _0x39a07b=this;return function(_0xf77616){if(_0xf77616){freeIsNotKey(_0xf77616,_0x39a07b[_0xe0b0('0x17')],'id');for(var _0x154e6d=0x0,_0x2a5082={};_0x154e6d<_0xf77616[_0xe0b0('0x3e')];_0x154e6d+=0x1){_0x2a5082=_0xf77616[_0x154e6d];if(_[_0xe0b0('0x41')](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']])){_0x39a07b['voiceExtensions'][_0x2a5082['id']]=new VoiceExtension(_0x2a5082);}else{_0x39a07b['mergeFromDatabase'](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']],_0x2a5082);}}}return _0x39a07b[_0xe0b0('0x17')];};};Realtime['prototype'][_0xe0b0('0x68')]=function(){var _0x4593f1=this;return function(_0x44c475){clearCampaigns(_0x4593f1[_0xe0b0('0x64')]);for(var _0x7358ce=0x0;_0x7358ce<_0x44c475[_0xe0b0('0x3e')];_0x7358ce+=0x1){_[_0xe0b0('0x52')](_0x4593f1[_0xe0b0('0x64')][_0x44c475[_0x7358ce]['name']],_0x44c475[_0x7358ce]);}return _0x4593f1['campaigns'];};};Realtime['prototype'][_0xe0b0('0x69')]=function(){var _0x90d471=this;return function(_0x5d2365){if(_0x5d2365){freeIsNotKey(_0x5d2365,_0x90d471[_0xe0b0('0x23')],'id');for(var _0x448694=0x0,_0x396eec={};_0x448694<_0x5d2365[_0xe0b0('0x3e')];_0x448694+=0x1){_0x396eec=_0x5d2365[_0x448694];if(_['isUndefined'](_0x90d471['faxAccounts'][_0x396eec['id']])){_0x90d471['faxAccounts'][_0x396eec['id']]=new FaxAccount(_0x396eec);}else{_0x90d471[_0xe0b0('0x3c')](_0x90d471[_0xe0b0('0x23')][_0x396eec['id']],_0x396eec);}}}return _0x90d471['faxAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x6a')]=function(){var _0x5547ee=this;return function(_0x576482){if(_0x576482){freeIsNotKey(_0x576482,_0x5547ee[_0xe0b0('0x13')],'name');for(var _0x251195=0x0,_0x5f06c0={};_0x251195<_0x576482[_0xe0b0('0x3e')];_0x251195+=0x1){_0x5f06c0=_0x576482[_0x251195];if(_[_0xe0b0('0x41')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]])){_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]]=new VoiceQueue(_0x5f06c0);}else{_0x5547ee[_0xe0b0('0x3c')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]],_0x5f06c0);}}}return _0x5547ee['voiceQueues'];};};module[_0xe0b0('0x6b')]=Realtime; \ No newline at end of file +var _0xdb28=['initTriggers','triggers','initTemplates','initZendeskAccounts','zendeskAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queuecallerexit','queuecallerabandon','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','diff','queuecallercomplete','queuecallerleaveAt','initVoiceCallReports','outbound','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','telephones','trunks','voiceQueues','campaigns','templates','voiceExtensions','channels','queueChannels','outboundChannels','timers','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','total','answered','unmanaged','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','agents','length','isUndefined','mergeFromDatabase','initTelephones','initTrunks'];(function(_0xc51340,_0x46ab64){var _0x1c5043=function(_0x4fa87a){while(--_0x4fa87a){_0xc51340['push'](_0xc51340['shift']());}};_0x1c5043(++_0x46ab64);}(_0xdb28,0x106));var _0x8db2=function(_0x49cbdb,_0x34555f){_0x49cbdb=_0x49cbdb-0x0;var _0x45cb4b=_0xdb28[_0x49cbdb];return _0x45cb4b;};'use strict';var _=require(_0x8db2('0x0'));var moment=require(_0x8db2('0x1'));var util=require(_0x8db2('0x2'));var Agent=require(_0x8db2('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0x8db2('0x4'));var VoiceQueue=require(_0x8db2('0x5'));var Trigger=require(_0x8db2('0x6'));var Template=require(_0x8db2('0x7'));var Campaign=require(_0x8db2('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x8db2('0x9'));var SalesforceAccount=require(_0x8db2('0xa'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x8db2('0xb'));var DeskAccount=require(_0x8db2('0xc'));var VtigerAccount=require(_0x8db2('0xd'));var ServicenowAccount=require(_0x8db2('0xe'));var Dynamics365Account=require(_0x8db2('0xf'));var FreshsalesAccount=require(_0x8db2('0x10'));var FaxAccount=require(_0x8db2('0x11'));function Realtime(){this['agents']={};this[_0x8db2('0x12')]={};this[_0x8db2('0x13')]={};this[_0x8db2('0x14')]={};this['triggers']={};this[_0x8db2('0x15')]={};this[_0x8db2('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x8db2('0x17')]={};this[_0x8db2('0x18')]={};this[_0x8db2('0x19')]={};this[_0x8db2('0x1a')]={};this[_0x8db2('0x1b')]={};this['settings']={};this['zendeskAccounts']={};this[_0x8db2('0x1c')]={};this[_0x8db2('0x1d')]={};this[_0x8db2('0x1e')]={};this[_0x8db2('0x1f')]={};this[_0x8db2('0x20')]={};this[_0x8db2('0x21')]={};this[_0x8db2('0x22')]={};this[_0x8db2('0x23')]={};this[_0x8db2('0x24')]={};this[_0x8db2('0x25')]={};}function freeIsNotKey(_0x5489a9,_0x13b0f5,_0x24da1b){var _0x48101e=_[_0x8db2('0x26')](_0x5489a9,function(_0x44957d){return _0x44957d[_0x24da1b];});for(var _0x21db8c in _0x13b0f5){if(_0x13b0f5[_0x8db2('0x27')](_0x21db8c)){if(!_0x48101e[_0x21db8c]){delete _0x13b0f5[_0x21db8c];}}}}function freeIsNotKeySip(_0x2efd06,_0x46ce14){var _0x51d60d=_['mapKeys'](_0x2efd06,function(_0x77789){return util[_0x8db2('0x28')](_0x8db2('0x29'),_0x77789[_0x8db2('0x2a')]);});for(var _0x58562e in _0x46ce14){if(_0x46ce14[_0x8db2('0x27')](_0x58562e)){if(!_0x51d60d[_0x58562e]){delete _0x46ce14[_0x58562e];}}}}function freeIsNotKeyAgent(_0x36a9ff,_0x260940){var _0x297ba3=_[_0x8db2('0x26')](_0x36a9ff,function(_0x597260){var _0x124467=_[_0x8db2('0x2b')](_0x597260[_0x8db2('0x2c')])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x597260[_0x8db2('0x2a')]):_0x597260[_0x8db2('0x2c')];return _0x124467;});for(var _0x5c6614 in _0x260940){if(_0x260940[_0x8db2('0x27')](_0x5c6614)){if(!_0x297ba3[_0x5c6614]){delete _0x260940[_0x5c6614];}}}}function clearVoiceCallReports(_0x4f6516){_0x4f6516['total']=0x0;_0x4f6516['answered']=0x0;_0x4f6516['sumHoldTime']=0x0;_0x4f6516[_0x8db2('0x2d')]=0x0;_0x4f6516[_0x8db2('0x2e')]=0x0;}function clearCampaigns(_0x3be281){if(!_[_0x8db2('0x2f')](_0x3be281)){for(var _0x145328 in _0x3be281){if(_0x3be281[_0x8db2('0x27')](_0x145328)){_0x3be281[_0x145328]['ivrTotalCallsDays']=0x0;_0x3be281[_0x145328][_0x8db2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x372311){if(!_[_0x8db2('0x2f')](_0x372311)){for(var _0x8b7cec in _0x372311){if(_0x372311['hasOwnProperty'](_0x8b7cec)){_0x372311[_0x8b7cec][_0x8db2('0x31')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x32')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x33')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x34')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x35')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2e')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x37')]=0x0;_0x372311[_0x8b7cec]['outboundBusyCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x38')]=0x0;_0x372311[_0x8b7cec]['outboundNoSuchCallsDay']=0x0;_0x372311[_0x8b7cec]['outboundUnknownCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x39')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3a')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3b')]=0x0;_0x372311[_0x8b7cec]['outboundOriginateFailureCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3c')]=0x0;_0x372311[_0x8b7cec]['outboundReCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3e')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x35d337,_0x1a460b){for(var _0x4df530 in _0x1a460b){if(_0x35d337['hasOwnProperty'](_0x4df530)){_0x35d337[_0x4df530]=_0x1a460b[_0x4df530];}}};Realtime[_0x8db2('0x3f')][_0x8db2('0x40')]=function(){var _0xc884a=this;return function(_0x2a2d65){if(_0x2a2d65){freeIsNotKeyAgent(_0x2a2d65,_0xc884a[_0x8db2('0x41')]);for(var _0xd39848=0x0,_0x101711={};_0xd39848<_0x2a2d65[_0x8db2('0x42')];_0xd39848+=0x1){_0x101711=_0x2a2d65[_0xd39848];var _0x46e0c8=_[_0x8db2('0x2b')](_0x101711['interface'])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x101711['name']):_0x101711[_0x8db2('0x2c')];if(_[_0x8db2('0x43')](_0xc884a['agents'][_0x46e0c8])){_0xc884a['agents'][_0x46e0c8]=new Agent(_0x101711);}else{_0xc884a[_0x8db2('0x44')](_0xc884a['agents'][_0x46e0c8],_0x101711);}}}return _0xc884a[_0x8db2('0x41')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x45')]=function(){var _0x22c896=this;return function(_0x5cc419){if(_0x5cc419){freeIsNotKeySip(_0x5cc419,_0x22c896[_0x8db2('0x12')]);for(var _0x5e34e0=0x0,_0x227a08={};_0x5e34e0<_0x5cc419[_0x8db2('0x42')];_0x5e34e0+=0x1){_0x227a08=_0x5cc419[_0x5e34e0];if(_[_0x8db2('0x43')](_0x22c896[_0x8db2('0x12')][util['format']('SIP/%s',_0x227a08[_0x8db2('0x2a')])])){_0x22c896[_0x8db2('0x12')][util['format'](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])]=new Telephone(_0x227a08);}else{_0x22c896[_0x8db2('0x44')](_0x22c896['telephones'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])],_0x227a08);}}}return _0x22c896[_0x8db2('0x12')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x46')]=function(){var _0x380046=this;return function(_0x1575ea){if(_0x1575ea){freeIsNotKeySip(_0x1575ea,_0x380046[_0x8db2('0x13')]);for(var _0x63c561=0x0,_0x21cf7c={};_0x63c561<_0x1575ea[_0x8db2('0x42')];_0x63c561+=0x1){_0x21cf7c=_0x1575ea[_0x63c561];if(_[_0x8db2('0x43')](_0x380046['trunks'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c['name'])])){_0x380046['trunks'][util[_0x8db2('0x28')]('SIP/%s',_0x21cf7c[_0x8db2('0x2a')])]=new Trunk(_0x21cf7c);}else{_0x380046[_0x8db2('0x44')](_0x380046[_0x8db2('0x13')][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c[_0x8db2('0x2a')])],_0x21cf7c);}}}return _0x380046[_0x8db2('0x13')];};};Realtime['prototype'][_0x8db2('0x47')]=function(){var _0x3d44de=this;return function(_0x40c69e){if(_0x40c69e){freeIsNotKey(_0x40c69e,_0x3d44de[_0x8db2('0x48')],'id');for(var _0x482b26=0x0,_0x424c27={};_0x482b26<_0x40c69e[_0x8db2('0x42')];_0x482b26+=0x1){_0x424c27=_0x40c69e[_0x482b26];if(_[_0x8db2('0x43')](_0x3d44de[_0x8db2('0x48')][_0x424c27['id']])){_0x3d44de['triggers'][_0x424c27['id']]=new Trigger(_0x424c27);}else{_0x3d44de[_0x8db2('0x44')](_0x3d44de['triggers'][_0x424c27['id']],_0x424c27);}}}return _0x3d44de[_0x8db2('0x48')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x49')]=function(){var _0x4d2164=this;return function(_0x4b0e72){if(_0x4b0e72){freeIsNotKey(_0x4b0e72,_0x4d2164[_0x8db2('0x16')],'id');for(var _0x47c556=0x0,_0x173cc7={};_0x47c556<_0x4b0e72[_0x8db2('0x42')];_0x47c556+=0x1){_0x173cc7=_0x4b0e72[_0x47c556];if(_[_0x8db2('0x43')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']])){_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']]=new Template(_0x173cc7);}else{_0x4d2164[_0x8db2('0x44')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']],_0x173cc7);}}}return _0x4d2164[_0x8db2('0x16')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4a')]=function(){var _0x1362ed=this;return function(_0x36f9d6){if(_0x36f9d6){freeIsNotKey(_0x36f9d6,_0x1362ed['zendeskAccounts'],'id');for(var _0x449109=0x0,_0x2ada52={};_0x449109<_0x36f9d6[_0x8db2('0x42')];_0x449109+=0x1){_0x2ada52=_0x36f9d6[_0x449109];if(_[_0x8db2('0x43')](_0x1362ed['zendeskAccounts'][_0x2ada52['id']])){_0x1362ed['zendeskAccounts'][_0x2ada52['id']]=new ZendeskAccount(_0x2ada52);}else{_0x1362ed[_0x8db2('0x44')](_0x1362ed[_0x8db2('0x4b')][_0x2ada52['id']],_0x2ada52);}}}return _0x1362ed[_0x8db2('0x4b')];};};Realtime['prototype']['initSalesforceAccounts']=function(){var _0x494d6e=this;return function(_0x44ac56){if(_0x44ac56){freeIsNotKey(_0x44ac56,_0x494d6e[_0x8db2('0x1c')],'id');for(var _0x55c7dd=0x0,_0x383fa1={};_0x55c7dd<_0x44ac56[_0x8db2('0x42')];_0x55c7dd+=0x1){_0x383fa1=_0x44ac56[_0x55c7dd];if(_[_0x8db2('0x43')](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']])){_0x494d6e['salesforceAccounts'][_0x383fa1['id']]=new SalesforceAccount(_0x383fa1);}else{_0x494d6e['mergeFromDatabase'](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']],_0x383fa1);}}}return _0x494d6e[_0x8db2('0x1c')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4c')]=function(){var _0x3daed6=this;return function(_0x2bf408){if(_0x2bf408){freeIsNotKey(_0x2bf408,_0x3daed6[_0x8db2('0x1e')],'id');for(var _0x3ca2a7=0x0,_0x4187d6={};_0x3ca2a7<_0x2bf408[_0x8db2('0x42')];_0x3ca2a7+=0x1){_0x4187d6=_0x2bf408[_0x3ca2a7];if(_[_0x8db2('0x43')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']])){_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']]=new FreshdeskAccount(_0x4187d6);}else{_0x3daed6[_0x8db2('0x44')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']],_0x4187d6);}}}return _0x3daed6['freshdeskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4d')]=function(){var _0x579317=this;return function(_0x27b644){if(_0x27b644){freeIsNotKey(_0x27b644,_0x579317[_0x8db2('0x1f')],'id');for(var _0x3af298=0x0,_0x547215={};_0x3af298<_0x27b644[_0x8db2('0x42')];_0x3af298+=0x1){_0x547215=_0x27b644[_0x3af298];if(_[_0x8db2('0x43')](_0x579317[_0x8db2('0x1f')][_0x547215['id']])){_0x579317[_0x8db2('0x1f')][_0x547215['id']]=new ZohoAccount(_0x547215);}else{_0x579317[_0x8db2('0x44')](_0x579317['zohoAccounts'][_0x547215['id']],_0x547215);}}}return _0x579317[_0x8db2('0x1f')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4e')]=function(){var _0x58bb60=this;return function(_0x1e7d1a){if(_0x1e7d1a){freeIsNotKey(_0x1e7d1a,_0x58bb60[_0x8db2('0x20')],'id');for(var _0x33dddd=0x0,_0x7b0de8={};_0x33dddd<_0x1e7d1a[_0x8db2('0x42')];_0x33dddd+=0x1){_0x7b0de8=_0x1e7d1a[_0x33dddd];if(_[_0x8db2('0x43')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']])){_0x58bb60['deskAccounts'][_0x7b0de8['id']]=new DeskAccount(_0x7b0de8);}else{_0x58bb60[_0x8db2('0x44')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']],_0x7b0de8);}}}return _0x58bb60['deskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4f')]=function(){var _0x533e41=this;return function(_0x107bbe){if(_0x107bbe){freeIsNotKey(_0x107bbe,_0x533e41[_0x8db2('0x1d')],'id');for(var _0x63e8f7=0x0,_0x30f4f3={};_0x63e8f7<_0x107bbe[_0x8db2('0x42')];_0x63e8f7+=0x1){_0x30f4f3=_0x107bbe[_0x63e8f7];if(_[_0x8db2('0x43')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']])){_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']]=new SugarcrmAccount(_0x30f4f3);}else{_0x533e41[_0x8db2('0x44')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']],_0x30f4f3);}}}return _0x533e41[_0x8db2('0x1d')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x50')]=function(){var _0x1ce89f=this;return function(_0x64ec90){if(_0x64ec90){freeIsNotKey(_0x64ec90,_0x1ce89f[_0x8db2('0x21')],'id');for(var _0x4a20a7=0x0,_0xe0c3e={};_0x4a20a7<_0x64ec90[_0x8db2('0x42')];_0x4a20a7+=0x1){_0xe0c3e=_0x64ec90[_0x4a20a7];if(_[_0x8db2('0x43')](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']])){_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']]=new VtigerAccount(_0xe0c3e);}else{_0x1ce89f['mergeFromDatabase'](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']],_0xe0c3e);}}}return _0x1ce89f[_0x8db2('0x21')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x51')]=function(){var _0x2ad70f=this;return function(_0x348da8){if(_0x348da8){freeIsNotKey(_0x348da8,_0x2ad70f[_0x8db2('0x22')],'id');for(var _0x2c7b04=0x0,_0x24cfe9={};_0x2c7b04<_0x348da8[_0x8db2('0x42')];_0x2c7b04+=0x1){_0x24cfe9=_0x348da8[_0x2c7b04];if(_[_0x8db2('0x43')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']])){_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']]=new ServicenowAccount(_0x24cfe9);}else{_0x2ad70f[_0x8db2('0x44')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']],_0x24cfe9);}}}return _0x2ad70f[_0x8db2('0x22')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x52')]=function(){var _0x5a719f=this;return function(_0x3273dd){if(_0x3273dd){freeIsNotKey(_0x3273dd,_0x5a719f['dynamics365Accounts'],'id');for(var _0x364176=0x0,_0x570c53={};_0x364176<_0x3273dd[_0x8db2('0x42')];_0x364176+=0x1){_0x570c53=_0x3273dd[_0x364176];if(_[_0x8db2('0x43')](_0x5a719f[_0x8db2('0x23')][_0x570c53['id']])){_0x5a719f[_0x8db2('0x23')][_0x570c53['id']]=new Dynamics365Account(_0x570c53);}else{_0x5a719f[_0x8db2('0x44')](_0x5a719f['dynamics365Accounts'][_0x570c53['id']],_0x570c53);}}}return _0x5a719f['dynamics365Accounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x53')]=function(){var _0x21ec87=this;return function(_0x3ba1d2){if(_0x3ba1d2){freeIsNotKey(_0x3ba1d2,_0x21ec87[_0x8db2('0x24')],'id');for(var _0x1f28d2=0x0,_0x3e3de3={};_0x1f28d2<_0x3ba1d2[_0x8db2('0x42')];_0x1f28d2+=0x1){_0x3e3de3=_0x3ba1d2[_0x1f28d2];if(_['isUndefined'](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']])){_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']]=new FreshsalesAccount(_0x3e3de3);}else{_0x21ec87[_0x8db2('0x44')](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']],_0x3e3de3);}}}return _0x21ec87[_0x8db2('0x24')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x54')]=function(){var _0x20caf0=this;return function(_0x4938bb){for(var _0x54318c=0x0;_0x54318c<_0x4938bb[_0x8db2('0x42')];_0x54318c+=0x1){_[_0x8db2('0x55')](_0x20caf0[_0x8db2('0x14')][_0x4938bb[_0x54318c][_0x8db2('0x2a')]],_0x4938bb[_0x54318c]);}return _0x20caf0[_0x8db2('0x14')];};};Realtime['prototype']['initVoiceQueueReports']=function(){var _0x3611da=this;return function(_0x364807){clearVoiceQueues(_0x3611da['voiceQueues']);if(_0x364807){_0x364807=_[_0x8db2('0x56')](_0x364807,_0x8db2('0x57'));for(var _0x1ab84c in _0x364807){if(_0x364807['hasOwnProperty'](_0x1ab84c)){for(var _0x26523b=0x0;_0x26523b<_0x364807[_0x1ab84c][_0x8db2('0x42')];_0x26523b+=0x1){var _0x2cf731=_0x364807[_0x1ab84c][_0x26523b]['queue'];if(_0x3611da[_0x8db2('0x14')][_0x2cf731]){if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x58')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x33')]+=0x1;}if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x59')]){_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x34')]+=0x1;}_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x35')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallerleaveAt'])['diff'](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;if(_0x26523b===_0x364807[_0x1ab84c]['length']-0x1){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5c')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5d')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5e')])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x31')]+=0x1;if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x60')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x32')]+=0x1;_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x2e')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallercompleteAt'])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x61')]),'seconds')||0x0;}}else{_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x35')]||0x0;}}}}}}return _0x3611da[_0x8db2('0x14')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x62')]=function(){var _0x242379=this;return function(_0x31a095){clearVoiceCallReports(_0x242379[_0x8db2('0x63')]);if(_0x31a095){for(var _0x3ac0fa=0x0;_0x3ac0fa<_0x31a095[_0x8db2('0x42')];_0x3ac0fa+=0x1){_0x242379['outbound']['total']+=0x1;_0x242379[_0x8db2('0x63')]['sumDuration']+=_0x31a095[_0x3ac0fa][_0x8db2('0x64')];if(_0x31a095[_0x3ac0fa][_0x8db2('0x65')]===_0x8db2('0x66')){_0x242379['outbound'][_0x8db2('0x32')]+=0x1;_0x242379[_0x8db2('0x63')][_0x8db2('0x35')]+=_0x31a095[_0x3ac0fa]['duration']-_0x31a095[_0x3ac0fa][_0x8db2('0x67')]||0x0;_0x242379[_0x8db2('0x63')][_0x8db2('0x2e')]+=_0x31a095[_0x3ac0fa][_0x8db2('0x67')];}}}return _0x242379['outbound'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x68')]=function(){var _0x299640=this;return function(_0x1edb1a){if(_0x1edb1a){freeIsNotKey(_0x1edb1a,_0x299640[_0x8db2('0x15')],_0x8db2('0x2a'));for(var _0x1aadfb=0x0,_0x3682bf={};_0x1aadfb<_0x1edb1a[_0x8db2('0x42')];_0x1aadfb+=0x1){_0x3682bf=_0x1edb1a[_0x1aadfb];if(_[_0x8db2('0x43')](_0x299640[_0x8db2('0x15')][_0x3682bf['name']])){_0x299640[_0x8db2('0x15')][_0x3682bf[_0x8db2('0x2a')]]=new Campaign(_0x3682bf);}else{_0x299640[_0x8db2('0x44')](_0x299640['campaigns'][_0x3682bf['name']],_0x3682bf);_0x299640['campaigns'][_0x3682bf[_0x8db2('0x2a')]][_0x8db2('0x69')]=_0x3682bf[_0x8db2('0x6a')]?_0x3682bf[_0x8db2('0x6a')][_0x8db2('0x2a')]:undefined;}}}return _0x299640[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6b')]=function(){var _0x3b1929=this;return function(_0x37cf6d){if(_0x37cf6d){freeIsNotKey(_0x37cf6d,_0x3b1929[_0x8db2('0x17')],'id');for(var _0x4d0ff6=0x0,_0x360a06={};_0x4d0ff6<_0x37cf6d[_0x8db2('0x42')];_0x4d0ff6+=0x1){_0x360a06=_0x37cf6d[_0x4d0ff6];if(_[_0x8db2('0x43')](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']])){_0x3b1929['voiceExtensions'][_0x360a06['id']]=new VoiceExtension(_0x360a06);}else{_0x3b1929['mergeFromDatabase'](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']],_0x360a06);}}}return _0x3b1929[_0x8db2('0x17')];};};Realtime['prototype'][_0x8db2('0x6c')]=function(){var _0x121f31=this;return function(_0x9132b4){clearCampaigns(_0x121f31['campaigns']);for(var _0x5dc46c=0x0;_0x5dc46c<_0x9132b4['length'];_0x5dc46c+=0x1){_[_0x8db2('0x55')](_0x121f31[_0x8db2('0x15')][_0x9132b4[_0x5dc46c][_0x8db2('0x2a')]],_0x9132b4[_0x5dc46c]);}return _0x121f31[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')]['initFaxAccounts']=function(){var _0x30930a=this;return function(_0x5e349c){if(_0x5e349c){freeIsNotKey(_0x5e349c,_0x30930a[_0x8db2('0x25')],'id');for(var _0x353101=0x0,_0xa083b1={};_0x353101<_0x5e349c[_0x8db2('0x42')];_0x353101+=0x1){_0xa083b1=_0x5e349c[_0x353101];if(_[_0x8db2('0x43')](_0x30930a['faxAccounts'][_0xa083b1['id']])){_0x30930a['faxAccounts'][_0xa083b1['id']]=new FaxAccount(_0xa083b1);}else{_0x30930a[_0x8db2('0x44')](_0x30930a['faxAccounts'][_0xa083b1['id']],_0xa083b1);}}}return _0x30930a[_0x8db2('0x25')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6d')]=function(){var _0x1e7bc2=this;return function(_0x2b7224){if(_0x2b7224){freeIsNotKey(_0x2b7224,_0x1e7bc2[_0x8db2('0x14')],'name');for(var _0x19f9a0=0x0,_0x222ea2={};_0x19f9a0<_0x2b7224[_0x8db2('0x42')];_0x19f9a0+=0x1){_0x222ea2=_0x2b7224[_0x19f9a0];if(_['isUndefined'](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]])){_0x1e7bc2['voiceQueues'][_0x222ea2[_0x8db2('0x2a')]]=new VoiceQueue(_0x222ea2);}else{_0x1e7bc2[_0x8db2('0x44')](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]],_0x222ea2);}}}return _0x1e7bc2[_0x8db2('0x14')];};};module[_0x8db2('0x6e')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 0a60568..5f4ff5a 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 _0xf022=['hasOwnProperty','mergeDBDataToRealtime','assign'];(function(_0x487c1d,_0x5cea20){var _0x5a643b=function(_0x66e5d1){while(--_0x66e5d1){_0x487c1d['push'](_0x487c1d['shift']());}};_0x5a643b(++_0x5cea20);}(_0xf022,0x92));var _0x2f02=function(_0x414584,_0x1a1da6){_0x414584=_0x414584-0x0;var _0x50b255=_0xf022[_0x414584];return _0x50b255;};'use strict';function mergeDBDataToRealtime(_0x5dfbe9,_0x279ef3){var _0x593955=Object[_0x2f02('0x0')]({},_0x5dfbe9);for(var _0x55793a in _0x279ef3){if(_0x593955[_0x2f02('0x1')](_0x55793a)){_0x593955[_0x55793a]=_0x279ef3[_0x55793a];}}return _0x593955;}exports[_0x2f02('0x2')]=mergeDBDataToRealtime; \ No newline at end of file +var _0xb71c=['mergeDBDataToRealtime','hasOwnProperty'];(function(_0x1ceeb9,_0x2d9e16){var _0x5ce27f=function(_0x51eeb2){while(--_0x51eeb2){_0x1ceeb9['push'](_0x1ceeb9['shift']());}};_0x5ce27f(++_0x2d9e16);}(_0xb71c,0x1e3));var _0xcb71=function(_0x4fc424,_0x2a2198){_0x4fc424=_0x4fc424-0x0;var _0xb3e70d=_0xb71c[_0x4fc424];return _0xb3e70d;};'use strict';function mergeDBDataToRealtime(_0x5595dc,_0xdce8d4){var _0x5c09f4=Object['assign']({},_0x5595dc);for(var _0x2bcbc1 in _0xdce8d4){if(_0x5c09f4[_0xcb71('0x0')](_0x2bcbc1)){_0x5c09f4[_0x2bcbc1]=_0xdce8d4[_0x2bcbc1];}}return _0x5c09f4;}exports[_0xcb71('0x1')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 6d8d727..df44775 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 _0xc968=['linkedid','uniqueid','transfers','UserId','membername','monitor','monitors','length','monitorFilename','filename','createdAt','exten','connectedlinename','isArray','forEach','startsWith','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','attendedTransfer','lodash','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','xdr','disabled','custom:voiceCallReport','voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindTransfer','attendedtransfer','findAgent','accountcode','name','isNil','find','interface','SIP/%s','connectedlinenum','assigned','lastAssignedTo','format','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','create','match','getAgentByInternal','keys','getCallType','split','calleridnum','outbound','internal','destination','type','lastapplication','lastdata','queue','context','from-voip-provider','callerid','xcally-motion-preview','destinationchannel','channel','calleridpreview','originatecalleridnum','disposition','\x22%s\x22\x20<%s>'];(function(_0x3cf5c6,_0x43e6ec){var _0x3991b7=function(_0x2e3cb4){while(--_0x2e3cb4){_0x3cf5c6['push'](_0x3cf5c6['shift']());}};_0x3991b7(++_0x43e6ec);}(_0xc968,0x17f));var _0x8c96=function(_0x187718,_0x427383){_0x187718=_0x187718-0x0;var _0x29ddf4=_0xc968[_0x187718];return _0x29ddf4;};'use strict';var _=require(_0x8c96('0x0'));var moment=require('moment');var util=require(_0x8c96('0x1'));var config=require(_0x8c96('0x2'));var ami=require(_0x8c96('0x3'));var RpcVoiceAgentReport=require(_0x8c96('0x4'));var RpcVoiceCallReport=require(_0x8c96('0x5'));var RpcVoiceDialReport=require(_0x8c96('0x6'));var RpcMemberReport=require(_0x8c96('0x7'));var RpcVoiceQueueReport=require(_0x8c96('0x8'));var RpcVoiceRecording=require(_0x8c96('0x9'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x8c96('0xa'));var VoiceCallReport=require(_0x8c96('0xb'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x8c96('0xc'));var UserReport=require(_0x8c96('0xd'));function Report(_0x36b01d){this[_0x8c96('0xe')]=_0x36b01d;this[_0x8c96('0xf')]=_0x36b01d[_0x8c96('0xf')];this[_0x8c96('0x10')]=_0x36b01d[_0x8c96('0x10')];}Report[_0x8c96('0x11')]['sync']=function(_0x350995){var _0x2b353e=new VoiceQueueReport(this[_0x8c96('0xe')]);var _0x2ae27b=new VoiceAgentReport(this[_0x8c96('0xe')]);var _0x19c525=new VoiceDialReport(this['realtime']);var _0x51c86d=new VoiceCallReport(this[_0x8c96('0xe')]);var _0x322b82=new UserReport(this[_0x8c96('0xe')]);if(config[_0x8c96('0x12')]&&config[_0x8c96('0x12')][_0x8c96('0x13')]){ami['on']('custom:voiceQueueReport',this['voiceQueueReport']['bind'](this));ami['on'](_0x8c96('0x14'),this[_0x8c96('0x15')][_0x8c96('0x16')](this));ami['on'](_0x8c96('0x17'),this[_0x8c96('0x18')][_0x8c96('0x16')](this));ami['on']('custom:voiceDialReport',this[_0x8c96('0x19')][_0x8c96('0x16')](this));ami['on']('blindtransfer',this[_0x8c96('0x1a')][_0x8c96('0x16')](this));ami['on'](_0x8c96('0x1b'),this['attendedTransfer'][_0x8c96('0x16')](this));}};Report[_0x8c96('0x11')][_0x8c96('0x1c')]=function(_0x5dc4a6){var _0x5b68d7;_0x5b68d7=_['find'](this[_0x8c96('0xf')],function(_0xdf2163){return _0xdf2163[_0x8c96('0x1d')]==_0x5dc4a6||_0xdf2163[_0x8c96('0x1e')]==_0x5dc4a6;});if(_[_0x8c96('0x1f')](_0x5b68d7)){var _0x34b24f=_[_0x8c96('0x20')](this[_0x8c96('0x10')],function(_0x5dc125){return _0x5dc125[_0x8c96('0x1d')]==_0x5dc4a6||_0x5dc125[_0x8c96('0x1e')]==_0x5dc4a6;});if(_0x34b24f){_0x5b68d7=_[_0x8c96('0x20')](this[_0x8c96('0xf')],function(_0x524e69){return _0x524e69[_0x8c96('0x21')]==util['format'](_0x8c96('0x22'),_0x34b24f[_0x8c96('0x1e')]);});}}return _0x5b68d7;};Report[_0x8c96('0x11')]['voiceQueueReport']=function(_0x274d74){for(var _0x149816=0x0;_0x149816<_0x274d74['length'];_0x149816+=0x1){var _0x1b8ce8=this[_0x8c96('0x1c')](_0x274d74[_0x149816][_0x8c96('0x23')]);if(_0x1b8ce8){_0x274d74[_0x149816][_0x8c96('0x1d')]=_0x1b8ce8[_0x8c96('0x1d')];_0x274d74[_0x149816][_0x8c96('0x24')]=!![];_0x274d74[_0x149816][_0x8c96('0x25')]=_0x1b8ce8[_0x8c96('0x1e')];_0x274d74[_0x149816][_0x8c96('0x21')]=_[_0x8c96('0x1f')](_0x1b8ce8[_0x8c96('0x21')])?util[_0x8c96('0x26')](_0x8c96('0x22'),_0x1b8ce8[_0x8c96('0x1e')]):_0x1b8ce8[_0x8c96('0x21')];if(_0x274d74[_0x149816][_0x8c96('0x27')]){_0x274d74[_0x149816][_0x8c96('0x28')]=moment()[_0x8c96('0x26')](_0x8c96('0x29'));}if(_0x274d74[_0x149816][_0x8c96('0x2a')]){_0x274d74[_0x149816]['queuecallerexitAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport['voiceQueueReport'](_0x274d74[_0x149816]);}RpcVoiceQueueReport[_0x8c96('0x2b')](_0x274d74[_0x149816]);}};function extractCalleridNumber(_0x25fb6a){var _0xff6fc1=_0x25fb6a[_0x8c96('0x2c')](/<(.*?)>/);return _0xff6fc1?_0xff6fc1[0x1]:_0x25fb6a;}Report[_0x8c96('0x11')][_0x8c96('0x2d')]=function(_0x810651){for(var _0x4d9828=0x0;_0x4d9828','calleridname','linkedid','transfers','transfereelinkedid','uniqueid','UserId','split','membername','monitor','monitors','monitorFilename','createdAt','connectedlinename','exten','xcally-motion-dialer','isArray','forEach','indexOf','phone','substring','lastIndexOf','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceDialReport','./userReport','realtime','agents','telephones','sync','xdr','custom:voiceQueueReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','bind','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','prototype','findAgent','find','accountcode','isNil','name','interface','format','SIP/%s','voiceQueueReport','length','connectedlinenum','assigned','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','getAgentByInternal','keys','getCallType','channel','calleridnum','outbound','destination','type','dialer','lastapplication','lastdata','context','from-voip-provider'];(function(_0x18a3d5,_0x93a51e){var _0x100474=function(_0x24f9af){while(--_0x24f9af){_0x18a3d5['push'](_0x18a3d5['shift']());}};_0x100474(++_0x93a51e);}(_0x5d14,0x188));var _0x45d1=function(_0x35fabd,_0x825452){_0x35fabd=_0x35fabd-0x0;var _0x61a8ee=_0x5d14[_0x35fabd];return _0x61a8ee;};'use strict';var _=require(_0x45d1('0x0'));var moment=require(_0x45d1('0x1'));var util=require(_0x45d1('0x2'));var config=require(_0x45d1('0x3'));var ami=require(_0x45d1('0x4'));var RpcVoiceAgentReport=require(_0x45d1('0x5'));var RpcVoiceCallReport=require(_0x45d1('0x6'));var RpcVoiceDialReport=require(_0x45d1('0x7'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x45d1('0x8'));var RpcVoiceRecording=require(_0x45d1('0x9'));var RpcVoiceTransferReport=require(_0x45d1('0xa'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x45d1('0xb'));var UserReport=require(_0x45d1('0xc'));function Report(_0x390b4f){this[_0x45d1('0xd')]=_0x390b4f;this[_0x45d1('0xe')]=_0x390b4f[_0x45d1('0xe')];this['telephones']=_0x390b4f[_0x45d1('0xf')];}Report['prototype'][_0x45d1('0x10')]=function(_0x5880e6){var _0xd6ba41=new VoiceQueueReport(this[_0x45d1('0xd')]);var _0x15101d=new VoiceAgentReport(this['realtime']);var _0xb5a772=new VoiceDialReport(this[_0x45d1('0xd')]);var _0x3b36e2=new VoiceCallReport(this[_0x45d1('0xd')]);var _0x524b6f=new UserReport(this[_0x45d1('0xd')]);if(config[_0x45d1('0x11')]&&config['xdr']['disabled']){ami['on'](_0x45d1('0x12'),this['voiceQueueReport']['bind'](this));ami['on']('custom:voiceCallReport',this[_0x45d1('0x13')]['bind'](this));ami['on'](_0x45d1('0x14'),this[_0x45d1('0x15')][_0x45d1('0x16')](this));ami['on'](_0x45d1('0x17'),this[_0x45d1('0x18')]['bind'](this));ami['on'](_0x45d1('0x19'),this[_0x45d1('0x1a')][_0x45d1('0x16')](this));ami['on'](_0x45d1('0x1b'),this[_0x45d1('0x1c')][_0x45d1('0x16')](this));}};Report[_0x45d1('0x1d')][_0x45d1('0x1e')]=function(_0x485cc6){var _0x1b5d07;_0x1b5d07=_[_0x45d1('0x1f')](this[_0x45d1('0xe')],function(_0x19cd82){return _0x19cd82[_0x45d1('0x20')]==_0x485cc6||_0x19cd82['name']==_0x485cc6;});if(_[_0x45d1('0x21')](_0x1b5d07)){var _0x4b67d0=_[_0x45d1('0x1f')](this[_0x45d1('0xf')],function(_0xcbeea8){return _0xcbeea8['accountcode']==_0x485cc6||_0xcbeea8[_0x45d1('0x22')]==_0x485cc6;});if(_0x4b67d0){_0x1b5d07=_[_0x45d1('0x1f')](this['agents'],function(_0xb9b06e){return _0xb9b06e[_0x45d1('0x23')]==util[_0x45d1('0x24')](_0x45d1('0x25'),_0x4b67d0[_0x45d1('0x22')]);});}}return _0x1b5d07;};Report['prototype'][_0x45d1('0x26')]=function(_0x44b349){for(var _0x49bbf3=0x0;_0x49bbf3<_0x44b349[_0x45d1('0x27')];_0x49bbf3+=0x1){var _0x1b3f1d=this['findAgent'](_0x44b349[_0x49bbf3][_0x45d1('0x28')]);if(_0x1b3f1d){_0x44b349[_0x49bbf3][_0x45d1('0x20')]=_0x1b3f1d[_0x45d1('0x20')];_0x44b349[_0x49bbf3][_0x45d1('0x29')]=!![];_0x44b349[_0x49bbf3][_0x45d1('0x2a')]=_0x1b3f1d['name'];_0x44b349[_0x49bbf3][_0x45d1('0x23')]=_[_0x45d1('0x21')](_0x1b3f1d['interface'])?util[_0x45d1('0x24')](_0x45d1('0x25'),_0x1b3f1d[_0x45d1('0x22')]):_0x1b3f1d[_0x45d1('0x23')];if(_0x44b349[_0x49bbf3][_0x45d1('0x2b')]){_0x44b349[_0x49bbf3][_0x45d1('0x2c')]=moment()['format'](_0x45d1('0x2d'));}if(_0x44b349[_0x49bbf3][_0x45d1('0x2e')]){_0x44b349[_0x49bbf3][_0x45d1('0x2f')]=moment()[_0x45d1('0x24')](_0x45d1('0x2d'));}RpcMemberReport['voiceQueueReport'](_0x44b349[_0x49bbf3]);}RpcVoiceQueueReport[_0x45d1('0x30')](_0x44b349[_0x49bbf3]);}};function extractCalleridNumber(_0x304f6a){var _0x1212ec=_0x304f6a[_0x45d1('0x31')](/<(.*?)>/);return _0x1212ec?_0x1212ec[0x1]:_0x304f6a;}Report['prototype'][_0x45d1('0x32')]=function(_0x43a053){for(var _0x58b106=0x0;_0x58b1060x0?!![]:![];if(!_0x557771){return this['syncQueueSummaryComplete'](this[_0x1347('0x17')][_0x1347('0x6e')]);}};VoiceQueueReport[_0x1347('0x3c')][_0x1347('0x1c')]=function(_0x31547f){var _0x3fdd81=this[_0x1347('0x17')]['id'];if(this[_0x1347('0x17')][_0x1347('0x66')][_0x3fdd81]&&this['summary'][_0x1347('0x66')][_0x3fdd81][_0x31547f[_0x1347('0x67')]]){this[_0x1347('0x17')][_0x1347('0x66')][_0x3fdd81][_0x31547f['actionid']][_0x1347('0x12')][_0x1347('0x6f')](_0x31547f);}};VoiceQueueReport[_0x1347('0x3c')][_0x1347('0x70')]=function(_0x2a1134){var _0x31bb3d=this;try{if(this[_0x1347('0x71')](_0x2a1134)&&this['isNotNull'](_0x2a1134['queue'])){logger[_0x1347('0x54')](_0x1347('0x72'),util['inspect'](_0x2a1134,{'showHidden':![],'depth':null}));var _0x3eacb7=this[_0x1347('0x15')][_0x2a1134[_0x1347('0x52')]];if(_0x3eacb7){logger[_0x1347('0x54')](_0x1347('0x73'),_0x3eacb7[_0x1347('0x5f')]);this['summary']['queues'][_0x3eacb7[_0x1347('0x5f')]]={'summaryEvent':_0x2a1134};this[_0x1347('0x17')]['statusRequests']+=0x1;return ami[_0x1347('0x64')]({'action':_0x1347('0x66'),'queue':_0x3eacb7['name']})[_0x1347('0x74')](function(_0x41a6ac){if(!_0x31bb3d['summary'][_0x1347('0x66')][_0x2a1134[_0x1347('0x67')]]){_0x31bb3d[_0x1347('0x17')][_0x1347('0x66')][_0x2a1134[_0x1347('0x67')]]={};}_0x31bb3d[_0x1347('0x17')]['queuestatus'][_0x2a1134[_0x1347('0x67')]][_0x41a6ac[_0x1347('0x67')]]={'queue':_0x3eacb7[_0x1347('0x5f')],'agents':[]};})[_0x1347('0x68')](function(_0x471993){throw _0x471993;});}}}catch(_0x2b0439){logger[_0x1347('0x45')](_0x1347('0x75'),util['inspect'](_0x2b0439,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1347('0x3c')][_0x1347('0x1a')]=function(_0x20d4f0){if(this[_0x1347('0x17')]['statusRequests']>0x0){this[_0x1347('0x17')][_0x1347('0x6e')]=_0x20d4f0;return;}logger['debug'](_0x1347('0x76'),util[_0x1347('0x47')](_0x20d4f0,{'showHidden':![],'depth':null}));this[_0x1347('0x17')]=initializeSummary();ami[_0x1347('0x4d')](_0x1347('0x77'),{});};VoiceQueueReport['prototype'][_0x1347('0x78')]=function(_0x33cfb1){try{if(this['isNotNull'](_0x33cfb1)){logger[_0x1347('0x54')](_0x1347('0x79'),_0x33cfb1[_0x1347('0x50')],util[_0x1347('0x47')](_0x33cfb1,{'showHidden':![],'depth':null}));if(_[_0x1347('0x60')](this['queueReports'][_0x33cfb1[_0x1347('0x50')]])){this[_0x1347('0x48')][_0x33cfb1['uniqueid']]=[];}if(_['isUndefined'](this['channels'][_0x33cfb1[_0x1347('0x50')]])){this[_0x1347('0x13')][_0x33cfb1['uniqueid']]={};}var _0x3eaca0=new QueueReport();_0x3eaca0[_0x1347('0x52')]=_0x33cfb1['queue'];_0x3eaca0[_0x1347('0x5c')]=this[_0x1347('0x15')][_0x3eaca0[_0x1347('0x52')]]&&this['voiceQueues'][_0x3eaca0['queue']][_0x1347('0x5c')]?this[_0x1347('0x15')][_0x3eaca0[_0x1347('0x52')]][_0x1347('0x5c')]||_0x1347('0x5d'):_0x1347('0x5d');_0x3eaca0[_0x1347('0x7a')]=moment()['format'](_0x1347('0x7b'));_0x3eaca0[_0x1347('0x7c')]=_0x33cfb1['position'];_0x3eaca0[_0x1347('0x7d')]=_0x33cfb1['count'];_0x3eaca0[_0x1347('0x50')]=_0x33cfb1[_0x1347('0x50')];_0x3eaca0[_0x1347('0x7e')]=this['channels'][_0x33cfb1[_0x1347('0x50')]][_0x1347('0x7e')];logger[_0x1347('0x7f')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x3eaca0[_0x1347('0x52')],_0x3eaca0['type']);Object['assign'](_0x3eaca0,_['pick'](_0x33cfb1,_['keys'](_0x3eaca0)));this[_0x1347('0x48')][_0x33cfb1['uniqueid']]['push'](_0x3eaca0);this[_0x1347('0x13')][_0x33cfb1[_0x1347('0x50')]]=_0x3eaca0;this[_0x1347('0x4e')](_0x3eaca0,_0x1347('0x1e'));}}catch(_0xb4f3ab){logger[_0x1347('0x45')]('[%s][voiceQueueReport][queuecallerjoin]',_0x33cfb1[_0x1347('0x50')],util[_0x1347('0x47')](_0xb4f3ab,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1347('0x3c')][_0x1347('0x20')]=function(_0x10ef6d){try{if(this['isNotNull'](_0x10ef6d)){logger['debug'](_0x1347('0x80'),_0x10ef6d[_0x1347('0x50')],util[_0x1347('0x47')](_0x10ef6d,{'showHidden':![],'depth':null}));if(this[_0x1347('0x48')][_0x10ef6d[_0x1347('0x50')]]){var _0x382b9b=_['last'](this[_0x1347('0x48')][_0x10ef6d[_0x1347('0x50')]]);_0x382b9b[_0x1347('0x81')]=![];_0x382b9b[_0x1347('0x82')]=null;_0x382b9b[_0x1347('0x83')]=_0x10ef6d[_0x1347('0x83')];_0x382b9b[_0x1347('0x84')]=_0x10ef6d[_0x1347('0x84')];_0x382b9b[_0x1347('0x1f')]=!![];_0x382b9b[_0x1347('0x85')]=moment()[_0x1347('0x51')](_0x1347('0x7b'));_0x382b9b[_0x1347('0x57')]=_0x1347('0x86');_0x382b9b['lastAssignedTo']=null;logger[_0x1347('0x7f')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x382b9b[_0x1347('0x52')],_0x382b9b[_0x1347('0x5c')]);this[_0x1347('0x13')][_0x10ef6d[_0x1347('0x50')]]=_0x382b9b;this[_0x1347('0x53')](_0x382b9b,_0x1347('0x1f'));}}}catch(_0x2fc4e0){logger[_0x1347('0x45')](_0x1347('0x80'),_0x10ef6d['uniqueid'],util[_0x1347('0x47')](_0x2fc4e0,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerLeave']=function(_0x2f2768){try{if(this[_0x1347('0x71')](_0x2f2768)){logger[_0x1347('0x54')](_0x1347('0x87'),_0x2f2768['uniqueid'],util[_0x1347('0x47')](_0x2f2768,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x2f2768['uniqueid']]){var _0x5c8503=_[_0x1347('0x88')](this[_0x1347('0x48')][_0x2f2768['uniqueid']]);_0x5c8503[_0x1347('0x89')]=moment()[_0x1347('0x51')](_0x1347('0x7b'));_0x5c8503[_0x1347('0x8a')]=_0x2f2768[_0x1347('0x8a')];_0x5c8503['connectedlinename']=_0x2f2768[_0x1347('0x8b')];logger[_0x1347('0x7f')](_0x1347('0x8c'),_0x5c8503[_0x1347('0x52')],_0x5c8503[_0x1347('0x5c')],_0x2f2768[_0x1347('0x8a')],_0x2f2768[_0x1347('0x8b')]);this['channels'][_0x2f2768[_0x1347('0x50')]]=_0x5c8503;this[_0x1347('0x4e')](_0x5c8503,_0x1347('0x21'));}}}catch(_0x36f70a){logger[_0x1347('0x45')](_0x1347('0x87'),_0x2f2768[_0x1347('0x50')],util['inspect'](_0x36f70a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1347('0x3c')][_0x1347('0x25')]=function(_0x55033f){try{if(this[_0x1347('0x71')](_0x55033f)){logger[_0x1347('0x54')](_0x1347('0x8d'),_0x55033f[_0x1347('0x50')],util[_0x1347('0x47')](_0x55033f,{'showHidden':![],'depth':null}));if(this[_0x1347('0x48')][_0x55033f[_0x1347('0x50')]]){var _0xe9cbef=_[_0x1347('0x88')](this[_0x1347('0x48')][_0x55033f[_0x1347('0x50')]]);_0xe9cbef[_0x1347('0x81')]=!![];_0xe9cbef[_0x1347('0x57')]='COMPLETEDBYAGENT';logger[_0x1347('0x7f')](_0x1347('0x8e'),_0xe9cbef[_0x1347('0x52')],_0xe9cbef[_0x1347('0x5c')]);}}}catch(_0x34e547){logger[_0x1347('0x45')]('[%s][voiceQueueReport][agentconnect]',_0x55033f[_0x1347('0x50')],util[_0x1347('0x47')](_0x34e547,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1347('0x3c')]['syncAgentComplete']=function(_0x801d87){try{if(this[_0x1347('0x71')](_0x801d87)){logger[_0x1347('0x54')](_0x1347('0x8f'),_0x801d87['uniqueid'],util[_0x1347('0x47')](_0x801d87,{'showHidden':![],'depth':null}));if(this[_0x1347('0x48')][_0x801d87[_0x1347('0x50')]]){var _0x2c5e3e=_[_0x1347('0x88')](this[_0x1347('0x48')][_0x801d87[_0x1347('0x50')]]);_0x2c5e3e[_0x1347('0x1f')]=![];_0x2c5e3e[_0x1347('0x85')]=null;_0x2c5e3e[_0x1347('0x90')]=!![];_0x2c5e3e['lastAssignedTo']=_0x801d87[_0x1347('0x91')];_0x2c5e3e[_0x1347('0x83')]=_0x801d87[_0x1347('0x83')];_0x2c5e3e[_0x1347('0x81')]=!![];_0x2c5e3e[_0x1347('0x3b')]=![];_0x2c5e3e['queuecallerexitAt']=null;if(!_0x2c5e3e[_0x1347('0x92')]){if(_0x801d87[_0x1347('0x93')]==_0x1347('0x92')){_0x2c5e3e['queuecallerexitreason']=_0x1347('0x94');logger[_0x1347('0x7f')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x2c5e3e['queue'],_0x2c5e3e[_0x1347('0x5c')]);}else{if(_[_0x1347('0x95')](_0x801d87['channel'][_0x1347('0x96')](),'local/')){if(this['queueReports'][_0x801d87[_0x1347('0x97')]]){var _0x5a696f=_[_0x1347('0x88')](this[_0x1347('0x48')][_0x801d87[_0x1347('0x97')]]);_0x5a696f[_0x1347('0x81')]=![];_0x5a696f[_0x1347('0x3b')]=!![];_0x5a696f[_0x1347('0x98')]=moment(_0x2c5e3e['queuecallerjoinAt'])[_0x1347('0x99')](_0x801d87['holdtime'],_0x1347('0x9a'))[_0x1347('0x51')](_0x1347('0x7b'));_0x5a696f[_0x1347('0x57')]=_0x1347('0x9b');_0x5a696f[_0x1347('0x92')]=!![];_0x5a696f[_0x1347('0x9c')]=_0x1347('0x9d');_0x5a696f[_0x1347('0x9e')]=_0x801d87[_0x1347('0x9f')];_0x5a696f[_0x1347('0xa0')]=_0x801d87['uniqueid'];logger[_0x1347('0x7f')](_0x1347('0xa1'),_0x5a696f[_0x1347('0x52')],_0x5a696f[_0x1347('0x5c')]);var _0x5e0e7f=this[_0x1347('0x48')][_0x801d87[_0x1347('0x97')]];this[_0x1347('0x48')][_0x801d87[_0x1347('0x97')]]=this[_0x1347('0x48')][_0x801d87['uniqueid']];this['queueReports'][_0x801d87[_0x1347('0x50')]]=_0x5e0e7f;}}else{_0x2c5e3e[_0x1347('0x57')]='COMPLETEDBY'+_0x801d87[_0x1347('0x93')][_0x1347('0xa2')]();logger[_0x1347('0x7f')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x2c5e3e[_0x1347('0x52')],_0x2c5e3e[_0x1347('0x5c')],_0x2c5e3e[_0x1347('0x57')]);}}}this[_0x1347('0x13')][_0x801d87[_0x1347('0x50')]]=_0x2c5e3e;}}}catch(_0x4cf228){logger[_0x1347('0x45')](_0x1347('0x8f'),_0x801d87[_0x1347('0x50')],util[_0x1347('0x47')](_0x4cf228,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1347('0x3c')][_0x1347('0x26')]=function(_0x1b7796){try{if(this[_0x1347('0x71')](_0x1b7796)){logger[_0x1347('0x54')](_0x1347('0xa3'),_0x1b7796[_0x1347('0x50')],util['inspect'](_0x1b7796,{'showHidden':![],'depth':null}));this[_0x1347('0xa4')](_0x1b7796[_0x1347('0x50')],_[_0x1347('0xa5')](_0x1b7796['variable'])[0x0],_0x1b7796[_0x1347('0xa6')]);if(this[_0x1347('0x48')][_0x1b7796[_0x1347('0x50')]]){var _0x35030d=_['last'](this[_0x1347('0x48')][_0x1b7796[_0x1347('0x50')]]);if(_0x35030d){if(this[_0x1347('0x71')](_0x1b7796[_0x1347('0xa7')])&&this['isNotNull'](_0x1b7796[_0x1347('0xa7')][_0x1347('0x66')])){switch(_0x1b7796[_0x1347('0xa6')]){case _0x1347('0xa8'):_0x35030d[_0x1347('0x3b')]=![];_0x35030d[_0x1347('0x98')]=null;break;case'TIMEOUT':_0x35030d[_0x1347('0xa9')]='timeout';_0x35030d['queuecallerexit']=!![];_0x35030d[_0x1347('0x98')]=moment()[_0x1347('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x35030d['queuecallerleaveAt']=moment()[_0x1347('0x51')](_0x1347('0x7b'));logger[_0x1347('0x54')](_0x1347('0xaa'),_0x1b7796['uniqueid'],util['inspect'](_0x35030d,{'showHidden':![],'depth':null}));ami[_0x1347('0x4d')](_0x1347('0xab'),_0x35030d);break;default:_0x35030d[_0x1347('0x3b')]=!![];_0x35030d[_0x1347('0x98')]=moment()[_0x1347('0x51')](_0x1347('0x7b'));_0x35030d[_0x1347('0x89')]=moment()[_0x1347('0x51')](_0x1347('0x7b'));}_0x35030d[_0x1347('0x1f')]=![];_0x35030d[_0x1347('0x85')]=null;_0x35030d[_0x1347('0x57')]=_0x1b7796[_0x1347('0xa6')];this['channels'][_0x1b7796[_0x1347('0x50')]]=_0x35030d;this[_0x1347('0x53')](_0x35030d,_0x1347('0xac'));}else if(this[_0x1347('0x71')](_0x1b7796[_0x1347('0xa7')])&&this[_0x1347('0x71')](_0x1b7796[_0x1347('0xa7')][_0x1347('0xad')])){if(!_0x35030d[_0x1347('0x1f')]){_0x35030d[_0x1347('0x3b')]=!![];_0x35030d['queuecallerexitAt']=moment()[_0x1347('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x35030d[_0x1347('0x57')]=_0x1347('0xae');_0x35030d['queuecallerleaveAt']=moment()['format'](_0x1347('0x7b'));this[_0x1347('0x13')][_0x1b7796[_0x1347('0x50')]]=_0x35030d;}}logger[_0x1347('0x7f')](_0x1347('0xaf'),_0x1b7796[_0x1347('0x50')],_0x35030d[_0x1347('0x52')],_0x35030d['type'],_[_0x1347('0xa5')](_0x1b7796[_0x1347('0xa7')])[0x0],_0x1b7796[_0x1347('0xa6')]);_0x35030d[_0x1347('0x18')]=this[_0x1347('0x18')][_0x1b7796[_0x1347('0x50')]];}}}}catch(_0x44c32b){logger[_0x1347('0x45')](_0x1347('0xa3'),_0x1b7796[_0x1347('0x50')],util[_0x1347('0x47')](_0x44c32b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1347('0x3c')][_0x1347('0xa4')]=function(_0x4786ff,_0x27d25d,_0x538233){var _0x14c7d9=[_0x1347('0xb0'),_0x1347('0xb1'),'rtpaudioqosjitter',_0x1347('0xb2'),_0x1347('0xb3'),_0x1347('0xb4'),'rtpaudioqosrtt',_0x1347('0xb5'),_0x1347('0xb6'),_0x1347('0xb7'),_0x1347('0xb8'),_0x1347('0xb9'),_0x1347('0xba'),_0x1347('0xbb'),_0x1347('0xbc'),'memberlastcall','membername',_0x1347('0xbd'),_0x1347('0xbe')];if(!_[_0x1347('0x40')](_0x27d25d)&&!_[_0x1347('0xbf')](_0x14c7d9,_0x27d25d)){if(_['isUndefined'](this['variables'][_0x4786ff])){this[_0x1347('0x18')][_0x4786ff]={};}this['variables'][_0x4786ff][_0x27d25d]=_0x538233;}};VoiceQueueReport['prototype']['handleHangup']=function(_0x46eb05,_0xb427dc,_0x4a5309){var _0x565f84={};for(var _0x3ef950=0x0;_0x3ef9500x0?!![]:![];if(!_0x3bf364){return this[_0x124f('0x6b')](this['summary'][_0x124f('0x6c')]);}};VoiceQueueReport[_0x124f('0x43')][_0x124f('0x1a')]=function(_0x5ce1bb){var _0xec0107=this[_0x124f('0x47')]['id'];if(this[_0x124f('0x47')]['queuestatus'][_0xec0107]&&this[_0x124f('0x47')][_0x124f('0x67')][_0xec0107][_0x5ce1bb[_0x124f('0x62')]]){this['summary'][_0x124f('0x67')][_0xec0107][_0x5ce1bb[_0x124f('0x62')]]['agents'][_0x124f('0x6d')](_0x5ce1bb);}};VoiceQueueReport[_0x124f('0x43')][_0x124f('0x16')]=function(_0x4578be){var _0x2bc228=this;try{if(this['isNotNull'](_0x4578be)&&this[_0x124f('0x6e')](_0x4578be[_0x124f('0x4f')])){logger[_0x124f('0x52')](_0x124f('0x6f'),util[_0x124f('0x41')](_0x4578be,{'showHidden':![],'depth':null}));var _0x6cd539=this[_0x124f('0x12')][_0x4578be[_0x124f('0x4f')]];if(_0x6cd539){logger[_0x124f('0x52')]('[voiceQueueReport][queuesummary]\x20name:%s',_0x6cd539[_0x124f('0x64')]);this['summary'][_0x124f('0x5e')][_0x6cd539[_0x124f('0x64')]]={'summaryEvent':_0x4578be};this[_0x124f('0x47')]['statusRequests']+=0x1;return ami[_0x124f('0x3d')]({'action':_0x124f('0x67'),'queue':_0x6cd539['name']})[_0x124f('0x70')](function(_0x103551){if(!_0x2bc228[_0x124f('0x47')][_0x124f('0x67')][_0x4578be[_0x124f('0x62')]]){_0x2bc228[_0x124f('0x47')][_0x124f('0x67')][_0x4578be[_0x124f('0x62')]]={};}_0x2bc228['summary'][_0x124f('0x67')][_0x4578be[_0x124f('0x62')]][_0x103551['actionid']]={'queue':_0x6cd539['name'],'agents':[]};})[_0x124f('0x5f')](function(_0x6e90a4){throw _0x6e90a4;});}}}catch(_0x8c23be){logger[_0x124f('0x40')](_0x124f('0x71'),util[_0x124f('0x41')](_0x8c23be,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueSummaryComplete']=function(_0x502104){if(this[_0x124f('0x47')][_0x124f('0x6a')]>0x0){this[_0x124f('0x47')][_0x124f('0x6c')]=_0x502104;return;}logger[_0x124f('0x52')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util['inspect'](_0x502104,{'showHidden':![],'depth':null}));this[_0x124f('0x47')]=initializeSummary();ami[_0x124f('0x4a')](_0x124f('0x72'),{});};VoiceQueueReport[_0x124f('0x43')][_0x124f('0x1d')]=function(_0x2224b0){try{if(this[_0x124f('0x6e')](_0x2224b0)){logger['debug'](_0x124f('0x73'),_0x2224b0[_0x124f('0x4c')],util[_0x124f('0x41')](_0x2224b0,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x124f('0xe')][_0x2224b0[_0x124f('0x4c')]])){this[_0x124f('0xe')][_0x2224b0[_0x124f('0x4c')]]=[];}if(_[_0x124f('0x5d')](this[_0x124f('0x3a')][_0x2224b0['uniqueid']])){this[_0x124f('0x3a')][_0x2224b0['uniqueid']]={};}var _0x2235cf=new QueueReport();_0x2235cf[_0x124f('0x4f')]=_0x2224b0[_0x124f('0x4f')];_0x2235cf[_0x124f('0x59')]=this['voiceQueues'][_0x2235cf[_0x124f('0x4f')]]&&this[_0x124f('0x12')][_0x2235cf[_0x124f('0x4f')]][_0x124f('0x59')]?this[_0x124f('0x12')][_0x2235cf[_0x124f('0x4f')]][_0x124f('0x59')]||'inbound':_0x124f('0x5a');_0x2235cf[_0x124f('0x74')]=moment()[_0x124f('0x4d')](_0x124f('0x75'));_0x2235cf[_0x124f('0x76')]=_0x2224b0[_0x124f('0x76')];_0x2235cf['count']=_0x2224b0[_0x124f('0x77')];_0x2235cf[_0x124f('0x4c')]=_0x2224b0[_0x124f('0x4c')];_0x2235cf[_0x124f('0x78')]=this[_0x124f('0x3a')][_0x2224b0['uniqueid']][_0x124f('0x78')];logger[_0x124f('0x79')](_0x124f('0x7a'),_0x2235cf['queue'],_0x2235cf[_0x124f('0x59')]);Object['assign'](_0x2235cf,_['pick'](_0x2224b0,_['keys'](_0x2235cf)));this[_0x124f('0xe')][_0x2224b0[_0x124f('0x4c')]][_0x124f('0x6d')](_0x2235cf);this['channels'][_0x2224b0[_0x124f('0x4c')]]=_0x2235cf;this['emitVoiceQueueChannelSave'](_0x2235cf,_0x124f('0x7b'));}}catch(_0x578948){logger[_0x124f('0x40')](_0x124f('0x73'),_0x2224b0[_0x124f('0x4c')],util[_0x124f('0x41')](_0x578948,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x124f('0x43')]['syncQueueCallerAbandon']=function(_0xf35382){try{if(this[_0x124f('0x6e')](_0xf35382)){logger[_0x124f('0x52')](_0x124f('0x7c'),_0xf35382[_0x124f('0x4c')],util[_0x124f('0x41')](_0xf35382,{'showHidden':![],'depth':null}));if(this[_0x124f('0xe')][_0xf35382[_0x124f('0x4c')]]){var _0x25581a=_['last'](this['queueReports'][_0xf35382[_0x124f('0x4c')]]);_0x25581a[_0x124f('0x38')]=![];_0x25581a[_0x124f('0x7d')]=null;_0x25581a[_0x124f('0x7e')]=_0xf35382['holdtime'];_0x25581a[_0x124f('0x7f')]=_0xf35382['originalposition'];_0x25581a[_0x124f('0x1e')]=!![];_0x25581a[_0x124f('0x80')]=moment()['format'](_0x124f('0x75'));_0x25581a[_0x124f('0x55')]=_0x124f('0x81');_0x25581a[_0x124f('0x82')]=null;logger[_0x124f('0x79')](_0x124f('0x83'),_0x25581a[_0x124f('0x4f')],_0x25581a[_0x124f('0x59')]);this[_0x124f('0x3a')][_0xf35382['uniqueid']]=_0x25581a;this[_0x124f('0x48')](_0x25581a,_0x124f('0x1e'));}}}catch(_0x36b3dc){logger['error']('[%s][voiceQueueReport][queuecallerabandon]',_0xf35382[_0x124f('0x4c')],util[_0x124f('0x41')](_0x36b3dc,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x124f('0x43')][_0x124f('0x21')]=function(_0x2cb5ff){try{if(this[_0x124f('0x6e')](_0x2cb5ff)){logger[_0x124f('0x52')]('[%s][voiceQueueReport][queuecallerleave]',_0x2cb5ff[_0x124f('0x4c')],util[_0x124f('0x41')](_0x2cb5ff,{'showHidden':![],'depth':null}));if(this[_0x124f('0xe')][_0x2cb5ff['uniqueid']]){var _0x41bd5a=_[_0x124f('0x84')](this[_0x124f('0xe')][_0x2cb5ff[_0x124f('0x4c')]]);_0x41bd5a[_0x124f('0x85')]=moment()[_0x124f('0x4d')](_0x124f('0x75'));_0x41bd5a[_0x124f('0x86')]=_0x2cb5ff[_0x124f('0x86')];_0x41bd5a[_0x124f('0x87')]=_0x2cb5ff[_0x124f('0x87')];logger[_0x124f('0x79')](_0x124f('0x88'),_0x41bd5a[_0x124f('0x4f')],_0x41bd5a['type'],_0x2cb5ff[_0x124f('0x86')],_0x2cb5ff['connectedlinename']);this[_0x124f('0x3a')][_0x2cb5ff[_0x124f('0x4c')]]=_0x41bd5a;this['emitVoiceQueueChannelSave'](_0x41bd5a,_0x124f('0x20'));}}}catch(_0x142c1b){logger['error'](_0x124f('0x89'),_0x2cb5ff[_0x124f('0x4c')],util[_0x124f('0x41')](_0x142c1b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x124f('0x43')]['syncAgentConnect']=function(_0x2a0e53){try{if(this[_0x124f('0x6e')](_0x2a0e53)){logger[_0x124f('0x52')](_0x124f('0x8a'),_0x2a0e53[_0x124f('0x4c')],util['inspect'](_0x2a0e53,{'showHidden':![],'depth':null}));if(this[_0x124f('0xe')][_0x2a0e53['uniqueid']]){var _0x3fcb03=_[_0x124f('0x84')](this[_0x124f('0xe')][_0x2a0e53[_0x124f('0x4c')]]);_0x3fcb03['queuecallercomplete']=!![];_0x3fcb03['queuecallerexitreason']=_0x124f('0x8b');logger['info']('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x3fcb03[_0x124f('0x4f')],_0x3fcb03[_0x124f('0x59')]);}}}catch(_0x4352f4){logger[_0x124f('0x40')](_0x124f('0x8a'),_0x2a0e53[_0x124f('0x4c')],util['inspect'](_0x4352f4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x124f('0x43')]['syncAgentComplete']=function(_0x4d650d){try{if(this[_0x124f('0x6e')](_0x4d650d)){logger['debug']('[%s][voiceQueueReport][agentcomplete]',_0x4d650d['uniqueid'],util[_0x124f('0x41')](_0x4d650d,{'showHidden':![],'depth':null}));if(this[_0x124f('0xe')][_0x4d650d[_0x124f('0x4c')]]){var _0x3d10cf=_[_0x124f('0x84')](this['queueReports'][_0x4d650d[_0x124f('0x4c')]]);_0x3d10cf[_0x124f('0x1e')]=![];_0x3d10cf[_0x124f('0x80')]=null;_0x3d10cf['assigned']=!![];_0x3d10cf['lastAssignedTo']=_0x4d650d[_0x124f('0x8c')];_0x3d10cf[_0x124f('0x7e')]=_0x4d650d[_0x124f('0x7e')];_0x3d10cf[_0x124f('0x38')]=!![];_0x3d10cf[_0x124f('0x8d')]=![];_0x3d10cf[_0x124f('0x8e')]=null;if(!_0x3d10cf[_0x124f('0x8f')]){if(_0x4d650d[_0x124f('0x90')]=='transfer'){_0x3d10cf[_0x124f('0x55')]=_0x124f('0x91');logger[_0x124f('0x79')](_0x124f('0x92'),_0x3d10cf[_0x124f('0x4f')],_0x3d10cf[_0x124f('0x59')]);}else{if(_['startsWith'](_0x4d650d[_0x124f('0x93')][_0x124f('0x94')](),_0x124f('0x95'))){if(this[_0x124f('0xe')][_0x4d650d['linkedid']]){var _0x362bb7=_[_0x124f('0x84')](this[_0x124f('0xe')][_0x4d650d[_0x124f('0x96')]]);_0x362bb7[_0x124f('0x38')]=![];_0x362bb7[_0x124f('0x8d')]=!![];_0x362bb7[_0x124f('0x8e')]=moment(_0x3d10cf[_0x124f('0x74')])[_0x124f('0x97')](_0x4d650d[_0x124f('0x7e')],'seconds')['format'](_0x124f('0x75'));_0x362bb7[_0x124f('0x55')]=_0x124f('0x98');_0x362bb7[_0x124f('0x8f')]=!![];_0x362bb7[_0x124f('0x99')]=_0x124f('0x9a');_0x362bb7[_0x124f('0x9b')]=_0x4d650d[_0x124f('0x9c')];_0x362bb7[_0x124f('0x9d')]=_0x4d650d[_0x124f('0x4c')];logger[_0x124f('0x79')](_0x124f('0x9e'),_0x362bb7[_0x124f('0x4f')],_0x362bb7[_0x124f('0x59')]);var _0x6e0de5=this[_0x124f('0xe')][_0x4d650d[_0x124f('0x96')]];this['queueReports'][_0x4d650d[_0x124f('0x96')]]=this[_0x124f('0xe')][_0x4d650d['uniqueid']];this['queueReports'][_0x4d650d[_0x124f('0x4c')]]=_0x6e0de5;}}else{_0x3d10cf[_0x124f('0x55')]='COMPLETEDBY'+_0x4d650d[_0x124f('0x90')][_0x124f('0x9f')]();logger[_0x124f('0x79')](_0x124f('0xa0'),_0x3d10cf['queue'],_0x3d10cf[_0x124f('0x59')],_0x3d10cf[_0x124f('0x55')]);}}}this[_0x124f('0x3a')][_0x4d650d[_0x124f('0x4c')]]=_0x3d10cf;}}}catch(_0x97199b){logger['error'](_0x124f('0xa1'),_0x4d650d['uniqueid'],util[_0x124f('0x41')](_0x97199b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x124f('0x43')]['syncVarSet']=function(_0x193e98){try{if(this[_0x124f('0x6e')](_0x193e98)){logger[_0x124f('0x52')](_0x124f('0xa2'),_0x193e98[_0x124f('0x4c')],util[_0x124f('0x41')](_0x193e98,{'showHidden':![],'depth':null}));this[_0x124f('0xa3')](_0x193e98[_0x124f('0x4c')],_[_0x124f('0xa4')](_0x193e98[_0x124f('0xa5')])[0x0],_0x193e98['value']);if(this['queueReports'][_0x193e98[_0x124f('0x4c')]]){var _0x29078f=_['last'](this[_0x124f('0xe')][_0x193e98[_0x124f('0x4c')]]);if(_0x29078f){if(this[_0x124f('0x6e')](_0x193e98['variable'])&&this[_0x124f('0x6e')](_0x193e98[_0x124f('0xa5')]['queuestatus'])){switch(_0x193e98['value']){case _0x124f('0xa6'):_0x29078f[_0x124f('0x8d')]=![];_0x29078f[_0x124f('0x8e')]=null;break;case _0x124f('0xa7'):_0x29078f[_0x124f('0xa8')]='timeout';_0x29078f['queuecallerexit']=!![];_0x29078f[_0x124f('0x8e')]=moment()['format'](_0x124f('0x75'));_0x29078f[_0x124f('0x85')]=moment()[_0x124f('0x4d')](_0x124f('0x75'));logger[_0x124f('0x52')](_0x124f('0xa9'),_0x193e98[_0x124f('0x4c')],util['inspect'](_0x29078f,{'showHidden':![],'depth':null}));ami[_0x124f('0x4a')](_0x124f('0xaa'),_0x29078f);break;default:_0x29078f[_0x124f('0x8d')]=!![];_0x29078f[_0x124f('0x8e')]=moment()[_0x124f('0x4d')](_0x124f('0x75'));_0x29078f[_0x124f('0x85')]=moment()['format'](_0x124f('0x75'));}_0x29078f[_0x124f('0x1e')]=![];_0x29078f[_0x124f('0x80')]=null;_0x29078f[_0x124f('0x55')]=_0x193e98[_0x124f('0xab')];this[_0x124f('0x3a')][_0x193e98[_0x124f('0x4c')]]=_0x29078f;this[_0x124f('0x48')](_0x29078f,'varset');}else if(this['isNotNull'](_0x193e98[_0x124f('0xa5')])&&this[_0x124f('0x6e')](_0x193e98[_0x124f('0xa5')][_0x124f('0xac')])){if(!_0x29078f[_0x124f('0x1e')]){_0x29078f[_0x124f('0x8d')]=!![];_0x29078f[_0x124f('0x8e')]=moment()[_0x124f('0x4d')](_0x124f('0x75'));_0x29078f[_0x124f('0x55')]='EXITWITHKEY';_0x29078f['queuecallerleaveAt']=moment()['format'](_0x124f('0x75'));this['channels'][_0x193e98['uniqueid']]=_0x29078f;}}logger[_0x124f('0x79')](_0x124f('0xad'),_0x193e98[_0x124f('0x4c')],_0x29078f[_0x124f('0x4f')],_0x29078f[_0x124f('0x59')],_[_0x124f('0xa4')](_0x193e98[_0x124f('0xa5')])[0x0],_0x193e98['value']);_0x29078f['variables']=this[_0x124f('0x14')][_0x193e98['uniqueid']];}}}}catch(_0x5d8b6d){logger['error'](_0x124f('0xa2'),_0x193e98[_0x124f('0x4c')],util[_0x124f('0x41')](_0x5d8b6d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x124f('0x43')][_0x124f('0xa3')]=function(_0x4789eb,_0x422347,_0x4f6033){var _0x4647d3=['rtpaudioqos','rtpaudioqosbridged',_0x124f('0xae'),'rtpaudioqosjitterbridged',_0x124f('0xaf'),_0x124f('0xb0'),_0x124f('0xb1'),_0x124f('0xb2'),_0x124f('0xb3'),'sipuri',_0x124f('0xb4'),_0x124f('0xb5'),'membercalls',_0x124f('0xb6'),'memberinterface',_0x124f('0xb7'),'membername','memberpenalty',_0x124f('0xb8')];if(!_[_0x124f('0x3c')](_0x422347)&&!_[_0x124f('0xb9')](_0x4647d3,_0x422347)){if(_[_0x124f('0x5d')](this[_0x124f('0x14')][_0x4789eb])){this[_0x124f('0x14')][_0x4789eb]={};}this[_0x124f('0x14')][_0x4789eb][_0x422347]=_0x4f6033;}};VoiceQueueReport[_0x124f('0x43')]['handleHangup']=function(_0x3368d2,_0x326e3e,_0xa2d9e8){var _0x157b07={};for(var _0x59ee04=0x0;_0x59ee04=0x0?moment(_0x57bb10[_0x90d8('0x1b')])[_0x90d8('0xf')](_0x57bb10[_0x90d8('0x1c')],_0x90d8('0x10')):null,'data1':'outbound','data2':_0x57bb10[_0x90d8('0x15')],'data3':_0x57bb10[_0x90d8('0x1d')],'data4':_0x57bb10[_0x90d8('0x1e')]||null,'role':_0x90d8('0x14'),'internal':_0x57bb10[_0x90d8('0x15')]?_[_0x90d8('0x16')](_0x57bb10[_0x90d8('0x15')]):undefined,'uniqueid':_0x57bb10[_0x90d8('0x17')]},'log':_0x90d8('0x18')});}; \ No newline at end of file +var _0x3c96=['lastAssignedTo','isNil','interface','SIP/%s','TALKING','queuecallerleaveAt','diff','seconds','exten','agent','accountcode','uniqueid','voiceDialReport','Request','membername','endtime','starttime','outbound','dialstring','lodash','util','../client','queuecallercompleteAt','CreateMemberReport','voice'];(function(_0x3e707d,_0x56c47c){var _0x3d62d6=function(_0x1e7e5b){while(--_0x1e7e5b){_0x3e707d['push'](_0x3e707d['shift']());}};_0x3d62d6(++_0x56c47c);}(_0x3c96,0x158));var _0x63c9=function(_0x5a6622,_0x43e3d5){_0x5a6622=_0x5a6622-0x0;var _0x1ea0bb=_0x3c96[_0x5a6622];return _0x1ea0bb;};'use strict';var moment=require('moment');var _=require(_0x63c9('0x0'));var util=require(_0x63c9('0x1'));var client=require(_0x63c9('0x2'));exports['voiceQueueReport']=function(_0x5e36e3){var _0x5f4bfe=_0x5e36e3[_0x63c9('0x3')]||_0x5e36e3['queuecallerexitAt'];return client['Request'](_0x63c9('0x4'),{'body':{'channel':_0x63c9('0x5'),'membername':_0x5e36e3[_0x63c9('0x6')],'interface':_[_0x63c9('0x7')](_0x5e36e3[_0x63c9('0x8')])?util['format'](_0x63c9('0x9'),_0x5e36e3[_0x63c9('0x6')]):_0x5e36e3[_0x63c9('0x8')],'type':_0x63c9('0xa'),'enterAt':_0x5e36e3[_0x63c9('0xb')],'exitAt':_0x5f4bfe,'duration':moment(_0x5f4bfe)[_0x63c9('0xc')](_0x5e36e3['queuecallerleaveAt'],_0x63c9('0xd')),'data1':'inbound','data2':_0x5e36e3['calleridnum'],'data3':_0x5e36e3[_0x63c9('0xe')],'data4':null,'data5':_0x5e36e3['queue'],'role':_0x63c9('0xf'),'internal':_0x5e36e3['accountcode']?_['toNumber'](_0x5e36e3[_0x63c9('0x10')]):undefined,'uniqueid':_0x5e36e3[_0x63c9('0x11')]},'log':'CreateMemberReport'});};exports[_0x63c9('0x12')]=function(_0x2e72aa){return client[_0x63c9('0x13')](_0x63c9('0x4'),{'body':{'channel':_0x63c9('0x5'),'membername':_0x2e72aa[_0x63c9('0x14')],'interface':_0x2e72aa[_0x63c9('0x8')],'type':_0x63c9('0xa'),'enterAt':_0x2e72aa['starttime'],'exitAt':_0x2e72aa[_0x63c9('0x15')],'duration':moment(_0x2e72aa[_0x63c9('0x15')])[_0x63c9('0xc')](_0x2e72aa[_0x63c9('0x16')],_0x63c9('0xd'))>=0x0?moment(_0x2e72aa[_0x63c9('0x15')])[_0x63c9('0xc')](_0x2e72aa[_0x63c9('0x16')],_0x63c9('0xd')):null,'data1':_0x63c9('0x17'),'data2':_0x2e72aa[_0x63c9('0x10')],'data3':_0x2e72aa['exten'],'data4':_0x2e72aa[_0x63c9('0x18')]||null,'role':'agent','internal':_0x2e72aa[_0x63c9('0x10')]?_['toNumber'](_0x2e72aa['accountcode']):undefined,'uniqueid':_0x2e72aa[_0x63c9('0x11')]},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index dc49ad3..4ecd97c 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 _0x0993=['ShowSetting','previewRecallmeReminderInterval','GetSettings','../client','getSettings','Request'];(function(_0xbf8e9d,_0x5655c4){var _0x5242d2=function(_0x37f62b){while(--_0x37f62b){_0xbf8e9d['push'](_0xbf8e9d['shift']());}};_0x5242d2(++_0x5655c4);}(_0x0993,0x81));var _0x3099=function(_0x200b1e,_0x8eb183){_0x200b1e=_0x200b1e-0x0;var _0x30908a=_0x0993[_0x200b1e];return _0x30908a;};'use strict';var client=require(_0x3099('0x0'));exports[_0x3099('0x1')]=function(){return client[_0x3099('0x2')](_0x3099('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x3099('0x4')]},'log':_0x3099('0x5')});}; \ No newline at end of file +var _0x2080=['ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','Request'];(function(_0x3710d4,_0x4f7702){var _0x3abd13=function(_0x1b43ec){while(--_0x1b43ec){_0x3710d4['push'](_0x3710d4['shift']());}};_0x3abd13(++_0x4f7702);}(_0x2080,0x19f));var _0x0208=function(_0x2edd08,_0x19eb8d){_0x2edd08=_0x2edd08-0x0;var _0x4c5c56=_0x2080[_0x2edd08];return _0x4c5c56;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0x0208('0x0')](_0x0208('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x0208('0x2'),_0x0208('0x3')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 8dcde1e..83b9b57 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 _0xe235=['name','html','GetTemplate','../client','getTemplates'];(function(_0x2e0db6,_0x496c82){var _0x235884=function(_0x1a7a0b){while(--_0x1a7a0b){_0x2e0db6['push'](_0x2e0db6['shift']());}};_0x235884(++_0x496c82);}(_0xe235,0xe4));var _0x5e23=function(_0x118f0b,_0x43aeff){_0x118f0b=_0x118f0b-0x0;var _0x549502=_0xe235[_0x118f0b];return _0x549502;};'use strict';var client=require(_0x5e23('0x0'));exports[_0x5e23('0x1')]=function(_0x1b37be){return function(_0x90bed3){return client['Request']('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x5e23('0x2'),_0x5e23('0x3')]},'log':_0x5e23('0x4')});};}; \ No newline at end of file +var _0xe9f1=['GetTemplate','../client','getTemplates','Request'];(function(_0x8a8ac0,_0x5076c6){var _0x56db6c=function(_0x209184){while(--_0x209184){_0x8a8ac0['push'](_0x8a8ac0['shift']());}};_0x56db6c(++_0x5076c6);}(_0xe9f1,0x125));var _0x1e9f=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xe9f1[_0x13e741];return _0x3f8bb3;};'use strict';var client=require(_0x1e9f('0x0'));exports[_0x1e9f('0x1')]=function(_0x16c038){return function(_0x1ee5da){return client[_0x1e9f('0x2')](_0x1e9f('0x3'),{'options':{'raw':!![],'attributes':['id','name','html']},'log':_0x1e9f('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index de3655b..d3ced90 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 _0x729f=['name','channel','status','Condition','AllConditions','value','AnyConditions','field','Action','Actions','data1','data3','data4','data7','../client','Request','GetTrigger'];(function(_0x404d11,_0x51db06){var _0x5ef5fc=function(_0x5e2623){while(--_0x5e2623){_0x404d11['push'](_0x404d11['shift']());}};_0x5ef5fc(++_0x51db06);}(_0x729f,0x11e));var _0xf729=function(_0x2b825a,_0x2f007e){_0x2b825a=_0x2b825a-0x0;var _0x9bd7b1=_0x729f[_0x2b825a];return _0x9bd7b1;};'use strict';var client=require(_0xf729('0x0'));exports['getTriggers']=function(_0x52fd81){return function(_0x187a7a){return client[_0xf729('0x1')](_0xf729('0x2'),{'options':{'raw':![],'attributes':['id',_0xf729('0x3'),_0xf729('0x4'),_0xf729('0x5')],'include':[{'model':_0xf729('0x6'),'as':_0xf729('0x7'),'attributes':['id','field','operator',_0xf729('0x8')]},{'model':_0xf729('0x6'),'as':_0xf729('0x9'),'attributes':['id',_0xf729('0xa'),'operator','value']},{'model':_0xf729('0xb'),'as':_0xf729('0xc'),'attributes':['id','action',_0xf729('0xd'),'data2',_0xf729('0xe'),_0xf729('0xf'),'data5','data6',_0xf729('0x10')]}]},'log':_0xf729('0x2')});};}; \ No newline at end of file +var _0xb297=['Request','GetTrigger','channel','operator','value','Condition','AnyConditions','field','Action','Actions','action','data1','data3','data4','data6','data7','getTriggers'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb297,0x76));var _0x7b29=function(_0x2132a3,_0x4639e9){_0x2132a3=_0x2132a3-0x0;var _0x21890c=_0xb297[_0x2132a3];return _0x21890c;};'use strict';var client=require('../client');exports[_0x7b29('0x0')]=function(_0x31cc50){return function(_0x50aa18){return client[_0x7b29('0x1')](_0x7b29('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x7b29('0x3'),'status'],'include':[{'model':'Condition','as':'AllConditions','attributes':['id','field',_0x7b29('0x4'),_0x7b29('0x5')]},{'model':_0x7b29('0x6'),'as':_0x7b29('0x7'),'attributes':['id',_0x7b29('0x8'),'operator',_0x7b29('0x5')]},{'model':_0x7b29('0x9'),'as':_0x7b29('0xa'),'attributes':['id',_0x7b29('0xb'),_0x7b29('0xc'),'data2',_0x7b29('0xd'),_0x7b29('0xe'),'data5',_0x7b29('0xf'),_0x7b29('0x10')]}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 309a020..6a0097f 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 _0x11a6=['Request','GetTrunk','name','registry','defaultuser','../client'];(function(_0x84bf02,_0x595a38){var _0x32f96c=function(_0x18e79d){while(--_0x18e79d){_0x84bf02['push'](_0x84bf02['shift']());}};_0x32f96c(++_0x595a38);}(_0x11a6,0x1c7));var _0x611a=function(_0xe88bda,_0x13d18b){_0xe88bda=_0xe88bda-0x0;var _0x5d3803=_0x11a6[_0xe88bda];return _0x5d3803;};'use strict';var client=require(_0x611a('0x0'));exports['getTrunks']=function(_0x56c5ee){return function(_0x133198){return client[_0x611a('0x1')](_0x611a('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x611a('0x3'),_0x611a('0x4'),_0x611a('0x5')]},'log':_0x611a('0x2')});};}; \ No newline at end of file +var _0x8f1f=['name','registry','defaultuser','../client','Request','GetTrunk'];(function(_0x2678c6,_0x4c26a7){var _0x59bc60=function(_0x2f4a20){while(--_0x2f4a20){_0x2678c6['push'](_0x2678c6['shift']());}};_0x59bc60(++_0x4c26a7);}(_0x8f1f,0xe1));var _0xf8f1=function(_0x5acbef,_0x36b414){_0x5acbef=_0x5acbef-0x0;var _0x5e9742=_0x8f1f[_0x5acbef];return _0x5e9742;};'use strict';var client=require(_0xf8f1('0x0'));exports['getTrunks']=function(_0x5e7760){return function(_0x283cd7){return client[_0xf8f1('0x1')](_0xf8f1('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xf8f1('0x3'),_0xf8f1('0x4'),_0xf8f1('0x5')]},'log':_0xf8f1('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 6356343..6a50afb 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 _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x3ab5c5,_0x4a8907){var _0x2dde78=function(_0x15ab35){while(--_0x15ab35){_0x3ab5c5['push'](_0x3ab5c5['shift']());}};_0x2dde78(++_0x4a8907);}(_0x70e0,0x17b));var _0x070e=function(_0x51e7db,_0x4e241e){_0x51e7db=_0x51e7db-0x0;var _0x42c0fa=_0x70e0[_0x51e7db];return _0x42c0fa;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});}; \ No newline at end of file +var _0xcb91=['UnpauseUser','getAgent','ShowUser','email','lastPauseAt','Request','GetUser','agent','name','accountcode','fullname','lastLoginAt','pauseType','voicePause','phone','interface','getAgents','internal','getTelephones','savePause','PauseUser'];(function(_0xcdedbf,_0x27c872){var _0x427315=function(_0x3c6d13){while(--_0x3c6d13){_0xcdedbf['push'](_0xcdedbf['shift']());}};_0x427315(++_0x27c872);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x31a938,_0x4daec6){_0x31a938=_0x31a938-0x0;var _0x1bf341=_0xcb91[_0x31a938];return _0x1bf341;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2')},'attributes':['id',_0x1cb9('0x3'),'email',_0x1cb9('0x4'),_0x1cb9('0x5'),'online',_0x1cb9('0x6'),_0x1cb9('0x7'),'lastPauseAt',_0x1cb9('0x8'),_0x1cb9('0x9'),'mobile',_0x1cb9('0xa')]},'log':_0x1cb9('0xb')});};};exports['getTelephones']=function(){return function(){return client[_0x1cb9('0x0')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x4'),_0x1cb9('0xc')]},'log':_0x1cb9('0xd')});};};exports[_0x1cb9('0xe')]=function(_0x50ce71,_0x9b58f1,_0x44a6b4){return client[_0x1cb9('0x0')](_0x1cb9('0xf'),{'body':{'type':_0x9b58f1,'uniqueid':_0x44a6b4},'options':{'where':{'id':_0x50ce71['id']}},'log':_0x1cb9('0xe')});};exports['saveUnpause']=function(_0x5e3c19){return client['Request'](_0x1cb9('0x10'),{'body':{},'options':{'where':{'id':_0x5e3c19['id']}},'log':_0x1cb9('0xe')});};exports[_0x1cb9('0x11')]=function(_0x1c714f){return client['Request'](_0x1cb9('0x12'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2'),'id':_0x1c714f},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x13'),_0x1cb9('0x4'),'fullname','online',_0x1cb9('0x6'),_0x1cb9('0x7'),_0x1cb9('0x14'),_0x1cb9('0x8'),_0x1cb9('0xa')]},'log':_0x1cb9('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 04525ef..486c6e2 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 _0x1400=['Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create'];(function(_0x4314d7,_0x355218){var _0x5c599b=function(_0x556354){while(--_0x556354){_0x4314d7['push'](_0x4314d7['shift']());}};_0x5c599b(++_0x355218);}(_0x1400,0x1d8));var _0x0140=function(_0x44fbf0,_0x29af3e){_0x44fbf0=_0x44fbf0-0x0;var _0x2de626=_0x1400[_0x44fbf0];return _0x2de626;};'use strict';var client=require(_0x0140('0x0'));exports[_0x0140('0x1')]=function(_0x5a0aba){return client[_0x0140('0x2')]('CreateVoiceAgentReport',{'body':_0x5a0aba,'log':_0x0140('0x3')});};exports[_0x0140('0x4')]=function(_0x3d452c,_0x5b794a,_0x5c85c1){return client[_0x0140('0x2')](_0x0140('0x5'),{'body':_0x3d452c,'options':{'where':{'uniqueid':_0x5b794a,'interface':_0x5c85c1,'agentcomplete':!![]}},'log':_0x0140('0x5')});}; \ No newline at end of file +var _0x5de4=['UpdateVoiceAgentReport','Request','CreateVoiceAgentReport'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x5de4,0x145));var _0x45de=function(_0x182273,_0x1c88ff){_0x182273=_0x182273-0x0;var _0x3cf552=_0x5de4[_0x182273];return _0x3cf552;};'use strict';var client=require('../client');exports['create']=function(_0x3a7a56){return client[_0x45de('0x0')](_0x45de('0x1'),{'body':_0x3a7a56,'log':_0x45de('0x1')});};exports['update']=function(_0x1a4a3e,_0x396a2a,_0x3fdb6d){return client[_0x45de('0x0')](_0x45de('0x2'),{'body':_0x1a4a3e,'options':{'where':{'uniqueid':_0x396a2a,'interface':_0x3fdb6d,'agentcomplete':!![]}},'log':_0x45de('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index d70fef6..fc86e91 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 _0x39ca=['Request','CreateVoiceCallReport','merge','calleridnum','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','format','YYYY-MM-DD\x20HH:mm:ss','day','disposition','duration','billableseconds','moment','util','lodash','../client','create'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x39ca,0x6d));var _0xa39c=function(_0x53a6c0,_0x53df9a){_0x53a6c0=_0x53a6c0-0x0;var _0x30c452=_0x39ca[_0x53a6c0];return _0x30c452;};'use strict';var moment=require(_0xa39c('0x0'));var util=require(_0xa39c('0x1'));var _=require(_0xa39c('0x2'));var client=require(_0xa39c('0x3'));exports[_0xa39c('0x4')]=function(_0x146acd){return client[_0xa39c('0x5')](_0xa39c('0x6'),{'body':_[_0xa39c('0x7')](_0x146acd,{'source':_0x146acd[_0xa39c('0x8')],'destinationcontext':_0x146acd['context'],'callerid':_0x146acd[_0xa39c('0x9')],'amaflags':_0xa39c('0xa')}),'log':_0xa39c('0x6')});};exports[_0xa39c('0xb')]=function(){return function(){return client['Request'](_0xa39c('0xc'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()['startOf']('day')[_0xa39c('0xd')](_0xa39c('0xe')),moment()['endOf'](_0xa39c('0xf'))[_0xa39c('0xd')](_0xa39c('0xe'))]}},'attributes':['type',_0xa39c('0x10'),_0xa39c('0x11'),_0xa39c('0x12')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0x19b1=['calleridnum','context','callerid','getVoiceCallReports','GetVoiceCallReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','GetVoiceCallReports','moment','util','lodash','../client','create','Request','CreateVoiceCallReport','merge'];(function(_0x51dc42,_0x5921c2){var _0xd3cce5=function(_0x4074ad){while(--_0x4074ad){_0x51dc42['push'](_0x51dc42['shift']());}};_0xd3cce5(++_0x5921c2);}(_0x19b1,0xf4));var _0x119b=function(_0x1bc762,_0x523eb3){_0x1bc762=_0x1bc762-0x0;var _0x40f70c=_0x19b1[_0x1bc762];return _0x40f70c;};'use strict';var moment=require(_0x119b('0x0'));var util=require(_0x119b('0x1'));var _=require(_0x119b('0x2'));var client=require(_0x119b('0x3'));exports[_0x119b('0x4')]=function(_0x4975be){return client[_0x119b('0x5')](_0x119b('0x6'),{'body':_[_0x119b('0x7')](_0x4975be,{'source':_0x4975be[_0x119b('0x8')],'destinationcontext':_0x4975be[_0x119b('0x9')],'callerid':_0x4975be[_0x119b('0xa')],'amaflags':'DOCUMENTATION'}),'log':'CreateVoiceCallReport'});};exports[_0x119b('0xb')]=function(){return function(){return client['Request'](_0x119b('0xc'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x119b('0xd')]('day')['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0x119b('0xe'))[_0x119b('0xf')](_0x119b('0x10'))]}},'attributes':[_0x119b('0x11'),_0x119b('0x12'),_0x119b('0x13'),'billableseconds']},'log':_0x119b('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index c1b863e..2ae6760 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 _0x6bea=['../client','create','CreateVoiceDialReport'];(function(_0x609988,_0x507944){var _0x159984=function(_0x39d9ce){while(--_0x39d9ce){_0x609988['push'](_0x609988['shift']());}};_0x159984(++_0x507944);}(_0x6bea,0x1d7));var _0xa6be=function(_0x1d7bea,_0x372aed){_0x1d7bea=_0x1d7bea-0x0;var _0x179bf2=_0x6bea[_0x1d7bea];return _0x179bf2;};'use strict';var client=require(_0xa6be('0x0'));exports[_0xa6be('0x1')]=function(_0x51894c){return client['Request'](_0xa6be('0x2'),{'body':_0x51894c,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0x3abb=['../client','create','Request','CreateVoiceDialReport'];(function(_0x2dc4ca,_0x22aaa7){var _0x58135e=function(_0x41ae47){while(--_0x41ae47){_0x2dc4ca['push'](_0x2dc4ca['shift']());}};_0x58135e(++_0x22aaa7);}(_0x3abb,0x6c));var _0xb3ab=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x3abb[_0x5f3f88];return _0xd08119;};'use strict';var client=require(_0xb3ab('0x0'));exports[_0xb3ab('0x1')]=function(_0xac5b47){return client[_0xb3ab('0x2')](_0xb3ab('0x3'),{'body':_0xac5b47,'log':_0xb3ab('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 8c3f829..1b39bb1 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 _0xd4b6=['getVoiceExtensions','GetVoiceExtension','exten','../client'];(function(_0x61d269,_0x26c192){var _0x156fc6=function(_0x59b208){while(--_0x59b208){_0x61d269['push'](_0x61d269['shift']());}};_0x156fc6(++_0x26c192);}(_0xd4b6,0x13f));var _0x6d4b=function(_0xc69cd0,_0x5dc0cd){_0xc69cd0=_0xc69cd0-0x0;var _0x155532=_0xd4b6[_0xc69cd0];return _0x155532;};'use strict';var client=require(_0x6d4b('0x0'));exports[_0x6d4b('0x1')]=function(){return function(){return client['Request'](_0x6d4b('0x2'),{'options':{'raw':!![],'attributes':['id',_0x6d4b('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x6d4b('0x1')});};}; \ No newline at end of file +var _0x74f4=['GetVoiceExtension','exten','../client','getVoiceExtensions'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x74f4,0xaa));var _0x474f=function(_0x32e8ed,_0x5d669c){_0x32e8ed=_0x32e8ed-0x0;var _0x10c84b=_0x74f4[_0x32e8ed];return _0x10c84b;};'use strict';var client=require(_0x474f('0x0'));exports[_0x474f('0x1')]=function(){return function(){return client['Request'](_0x474f('0x2'),{'options':{'raw':!![],'attributes':['id',_0x474f('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x474f('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 5a9e6f1..e0d1d3b 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 _0x5dcf=['Intervals','../client','getVoiceQueues','GetVoiceQueue','name','acw','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialAgiAfterHangupClient','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval'];(function(_0x5de2f5,_0x503767){var _0x2aff2d=function(_0x1ee0fc){while(--_0x1ee0fc){_0x5de2f5['push'](_0x5de2f5['shift']());}};_0x2aff2d(++_0x503767);}(_0x5dcf,0x7f));var _0xf5dc=function(_0x41adfd,_0x264cdd){_0x41adfd=_0x41adfd-0x0;var _0x59d00f=_0x5dcf[_0x41adfd];return _0x59d00f;};'use strict';var client=require(_0xf5dc('0x0'));exports[_0xf5dc('0x1')]=function(){return function(){return client['Request'](_0xf5dc('0x2'),{'options':{'raw':![],'attributes':['id',_0xf5dc('0x3'),_0xf5dc('0x4'),'acwTimeout',_0xf5dc('0x5'),_0xf5dc('0x6'),_0xf5dc('0x7'),_0xf5dc('0x8'),_0xf5dc('0x9'),_0xf5dc('0xa'),_0xf5dc('0xb'),_0xf5dc('0xc'),_0xf5dc('0xd'),_0xf5dc('0xe'),_0xf5dc('0xf'),_0xf5dc('0x10'),_0xf5dc('0x11'),_0xf5dc('0x12'),_0xf5dc('0x13'),'dialQueueTimeout',_0xf5dc('0x14'),_0xf5dc('0x15'),'dialCongestionRetryFrequency',_0xf5dc('0x16'),'dialBusyRetryFrequency',_0xf5dc('0x17'),_0xf5dc('0x18'),'dialGlobalMaxRetry',_0xf5dc('0x19'),_0xf5dc('0x1a'),_0xf5dc('0x1b'),_0xf5dc('0x1c'),'dialAMDActive','dialAMDInitialSilence',_0xf5dc('0x1d'),_0xf5dc('0x1e'),_0xf5dc('0x1f'),'dialAMDMinWordLength',_0xf5dc('0x20'),_0xf5dc('0x21'),_0xf5dc('0x22'),_0xf5dc('0x23'),'timeout',_0xf5dc('0x24'),'dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent',_0xf5dc('0x25'),'dialQueueProject2',_0xf5dc('0x6'),_0xf5dc('0x26'),_0xf5dc('0x27'),_0xf5dc('0x28'),_0xf5dc('0x29'),_0xf5dc('0x2a'),_0xf5dc('0x2b'),_0xf5dc('0x2c'),'dialAbandonedMaxRetry',_0xf5dc('0x2d'),_0xf5dc('0x2e'),_0xf5dc('0x2f'),_0xf5dc('0x30'),_0xf5dc('0x31'),_0xf5dc('0x32'),_0xf5dc('0x33'),_0xf5dc('0x34'),_0xf5dc('0x35'),_0xf5dc('0x36')],'include':[{'model':_0xf5dc('0x37'),'as':_0xf5dc('0x37'),'attributes':['id','name',_0xf5dc('0x38'),_0xf5dc('0x39')]},{'model':_0xf5dc('0x3a'),'as':_0xf5dc('0x3b'),'attributes':['id',_0xf5dc('0x3')]},{'model':'Trunk','as':_0xf5dc('0x3c'),'attributes':['id',_0xf5dc('0x3'),_0xf5dc('0x38'),_0xf5dc('0x39')]},{'model':_0xf5dc('0x3d'),'as':'Interval','attributes':['id',_0xf5dc('0x3')],'include':[{'model':_0xf5dc('0x3d'),'as':_0xf5dc('0x3e'),'attributes':['id',_0xf5dc('0x3'),'interval']}]}]},'log':_0xf5dc('0x1')});};}; \ No newline at end of file +var _0xdfd0=['dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','autopause','type','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence'];(function(_0x27ddf5,_0x5a3e18){var _0x26e74a=function(_0x5f24ac){while(--_0x5f24ac){_0x27ddf5['push'](_0x27ddf5['shift']());}};_0x26e74a(++_0x5a3e18);}(_0xdfd0,0x13d));var _0x0dfd=function(_0xd73125,_0x29878f){_0xd73125=_0xd73125-0x0;var _0x309e93=_0xdfd0[_0xd73125];return _0x309e93;};'use strict';var client=require(_0x0dfd('0x0'));exports[_0x0dfd('0x1')]=function(){return function(){return client[_0x0dfd('0x2')](_0x0dfd('0x3'),{'options':{'raw':![],'attributes':['id',_0x0dfd('0x4'),_0x0dfd('0x5'),'acwTimeout',_0x0dfd('0x6'),'monitor_format',_0x0dfd('0x7'),_0x0dfd('0x8'),'dialMethod',_0x0dfd('0x9'),_0x0dfd('0xa'),_0x0dfd('0xb'),_0x0dfd('0xc'),'dialPredictiveOptimizationPercentage',_0x0dfd('0xd'),_0x0dfd('0xe'),_0x0dfd('0xf'),'dialOriginateTimeout',_0x0dfd('0x10'),_0x0dfd('0x11'),_0x0dfd('0x12'),'dialCongestionMaxRetry','dialCongestionRetryFrequency',_0x0dfd('0x13'),'dialBusyRetryFrequency',_0x0dfd('0x14'),_0x0dfd('0x15'),_0x0dfd('0x16'),'dialTimezone',_0x0dfd('0x17'),_0x0dfd('0x18'),_0x0dfd('0x19'),_0x0dfd('0x1a'),'dialAMDInitialSilence',_0x0dfd('0x1b'),_0x0dfd('0x1c'),_0x0dfd('0x1d'),'dialAMDMinWordLength',_0x0dfd('0x1e'),'dialAMDMaximumNumberOfWords',_0x0dfd('0x1f'),_0x0dfd('0x20'),'timeout',_0x0dfd('0x21'),_0x0dfd('0x22'),'dialOrderByScheduledAt',_0x0dfd('0x23'),_0x0dfd('0x24'),_0x0dfd('0x25'),_0x0dfd('0x26'),_0x0dfd('0x27'),_0x0dfd('0x28'),_0x0dfd('0x29'),'dialNoSuchNumberMaxRetry',_0x0dfd('0x2a'),_0x0dfd('0x2b'),'dialDropRetryFrequency',_0x0dfd('0x2c'),_0x0dfd('0x2d'),_0x0dfd('0x2e'),_0x0dfd('0x2f'),'dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency',_0x0dfd('0x30'),'dialPredictiveIntervalMaxThreshold',_0x0dfd('0x31'),'dialPreviewAutoRecallMe','dialPreviewRecallmeReminder'],'include':[{'model':_0x0dfd('0x32'),'as':'Trunk','attributes':['id',_0x0dfd('0x4'),_0x0dfd('0x33'),_0x0dfd('0x34')]},{'model':_0x0dfd('0x35'),'as':_0x0dfd('0x36'),'attributes':['id','name']},{'model':_0x0dfd('0x32'),'as':_0x0dfd('0x37'),'attributes':['id',_0x0dfd('0x4'),'callerid',_0x0dfd('0x34')]},{'model':'Interval','as':_0x0dfd('0x38'),'attributes':['id',_0x0dfd('0x4')],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0x0dfd('0x4'),_0x0dfd('0x39')]}]}]},'log':_0x0dfd('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index da21d78..82cf66e 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(_0x467b6b,_0x2dd887){var _0x3ae317=function(_0x250c33){while(--_0x250c33){_0x467b6b['push'](_0x467b6b['shift']());}};_0x3ae317(++_0x2dd887);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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(_0x4d4728,_0x500725){var _0x6bc4d9=function(_0x4681d9){while(--_0x4681d9){_0x4d4728['push'](_0x4d4728['shift']());}};_0x6bc4d9(++_0x500725);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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 b80de96..2f1cd63 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 _0x10bf=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x1263d9,_0x1ff0b2){var _0x711253=function(_0xddae47){while(--_0xddae47){_0x1263d9['push'](_0x1263d9['shift']());}};_0x711253(++_0x1ff0b2);}(_0x10bf,0xf4));var _0xf10b=function(_0x581960,_0x1232ff){_0x581960=_0x581960-0x0;var _0x4ee892=_0x10bf[_0x581960];return _0x4ee892;};'use strict';var client=require(_0xf10b('0x0'));exports[_0xf10b('0x1')]=function(_0x40123a){return function(){return client[_0xf10b('0x2')](_0xf10b('0x3'),{'options':{'where':{'VoiceQueueId':_0x40123a,'paused':!![]},'raw':!![]},'log':_0xf10b('0x1')});};}; \ No newline at end of file +var _0xad46=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x31198c,_0x5ece11){var _0xfecbc1=function(_0x23afcf){while(--_0x23afcf){_0x31198c['push'](_0x31198c['shift']());}};_0xfecbc1(++_0x5ece11);}(_0xad46,0x12b));var _0x6ad4=function(_0xfafe54,_0x23c9a6){_0xfafe54=_0xfafe54-0x0;var _0x4ab8e6=_0xad46[_0xfafe54];return _0x4ab8e6;};'use strict';var client=require(_0x6ad4('0x0'));exports[_0x6ad4('0x1')]=function(_0x4b94b8){return function(){return client[_0x6ad4('0x2')](_0x6ad4('0x3'),{'options':{'where':{'VoiceQueueId':_0x4b94b8,'paused':!![]},'raw':!![]},'log':_0x6ad4('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 5e2087a..97e5c6b 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(_0x43298f,_0x3c4663){var _0x59065c=function(_0x5c5856){while(--_0x5c5856){_0x43298f['push'](_0x43298f['shift']());}};_0x59065c(++_0x3c4663);}(_0x7a54,0x106));var _0x47a5=function(_0x225768,_0x203946){_0x225768=_0x225768-0x0;var _0x7d5559=_0x7a54[_0x225768];return _0x7d5559;};'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(_0x547951,_0x18add1){var _0x19d1aa=function(_0x4ebb7f){while(--_0x4ebb7f){_0x547951['push'](_0x547951['shift']());}};_0x19d1aa(++_0x18add1);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'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 3aeaf2a..cbbe91f 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 _0xa5c8=['transfertargetlinkedid','isexternal','origtransferercontext','attended','../client','transfers','blindTransfer','result','transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','context','blind','CreateVoiceTransferReport','attendedTransfer','Request','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten'];(function(_0x4161b1,_0x4a67ff){var _0x56227b=function(_0x5f44f2){while(--_0x5f44f2){_0x4161b1['push'](_0x4161b1['shift']());}};_0x56227b(++_0x4a67ff);}(_0xa5c8,0x73));var _0x8a5c=function(_0x5a0c54,_0x1518a2){_0x5a0c54=_0x5a0c54-0x0;var _0x56d09d=_0xa5c8[_0x5a0c54];return _0x56d09d;};'use strict';var client=require(_0x8a5c('0x0'));exports[_0x8a5c('0x1')]={};exports[_0x8a5c('0x2')]=function(_0x54d690){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x54d690[_0x8a5c('0x3')],'transfererchannel':_0x54d690['transfererchannel'],'transferercalleridnum':_0x54d690['transferercalleridnum'],'transferercalleridname':_0x54d690[_0x8a5c('0x4')],'transfererconnectedlinenum':_0x54d690[_0x8a5c('0x5')],'transfererconnectedlinename':_0x54d690['transfererconnectedlinename'],'transfereraccountcode':_0x54d690[_0x8a5c('0x6')],'transferercontext':_0x54d690[_0x8a5c('0x7')],'transfererexten':_0x54d690[_0x8a5c('0x8')],'transfererlinkedid':_0x54d690[_0x8a5c('0x9')],'transfereechannel':_0x54d690[_0x8a5c('0xa')],'transfereecalleridnum':_0x54d690['transfereecalleridnum'],'transfereecalleridname':_0x54d690['transfereecalleridname'],'transfereeconnectedlinenum':_0x54d690['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x54d690[_0x8a5c('0xb')],'transfereeaccountcode':_0x54d690[_0x8a5c('0xc')],'transfereecontext':_0x54d690[_0x8a5c('0xd')],'transfereeexten':_0x54d690['transfereeexten'],'transfereelinkedid':_0x54d690['transfereelinkedid'],'isexternal':_0x54d690['isexternal'],'context':_0x54d690[_0x8a5c('0xe')],'extension':_0x54d690['extension'],'type':_0x8a5c('0xf')},'log':_0x8a5c('0x10')});};exports[_0x8a5c('0x11')]=function(_0x4cb554){return client[_0x8a5c('0x12')]('CreateVoiceTransferReport',{'body':{'result':_0x4cb554[_0x8a5c('0x3')],'transfererchannel':_0x4cb554['origtransfererchannel'],'transferercalleridnum':_0x4cb554[_0x8a5c('0x13')],'transferercalleridname':_0x4cb554['origtransferercalleridname'],'transfererconnectedlinenum':_0x4cb554[_0x8a5c('0x14')],'transfererconnectedlinename':_0x4cb554[_0x8a5c('0x15')],'transfereraccountcode':_0x4cb554[_0x8a5c('0x16')],'transferercontext':_0x4cb554[_0x8a5c('0x17')],'transfererexten':_0x4cb554[_0x8a5c('0x18')],'transfererlinkedid':_0x4cb554[_0x8a5c('0x19')],'transfereechannel':_0x4cb554[_0x8a5c('0x1a')],'transfereecalleridnum':_0x4cb554[_0x8a5c('0x1b')],'transfereecalleridname':_0x4cb554[_0x8a5c('0x1c')],'transfereeconnectedlinenum':_0x4cb554['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x4cb554[_0x8a5c('0x1d')],'transfereeaccountcode':_0x4cb554[_0x8a5c('0x1e')],'transfereecontext':_0x4cb554[_0x8a5c('0x1f')],'transfereeexten':_0x4cb554[_0x8a5c('0x20')],'transfereelinkedid':_0x4cb554[_0x8a5c('0x21')],'isexternal':_0x4cb554[_0x8a5c('0x22')],'context':_0x4cb554[_0x8a5c('0x23')],'extension':_0x4cb554['origtransfererexten'],'type':_0x8a5c('0x24')},'log':_0x8a5c('0x10')});}; \ No newline at end of file +var _0x832d=['secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','transfereeexten','transfereelinkedid','context','attendedTransfer','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext'];(function(_0x395fe5,_0x24a7d1){var _0x499071=function(_0xa49247){while(--_0xa49247){_0x395fe5['push'](_0x395fe5['shift']());}};_0x499071(++_0x24a7d1);}(_0x832d,0x1ed));var _0xd832=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x832d[_0x6131cd];return _0x47e916;};'use strict';var client=require('../client');exports['transfers']={};exports['blindTransfer']=function(_0x1cadb3){return client[_0xd832('0x0')](_0xd832('0x1'),{'body':{'result':_0x1cadb3[_0xd832('0x2')],'transfererchannel':_0x1cadb3[_0xd832('0x3')],'transferercalleridnum':_0x1cadb3[_0xd832('0x4')],'transferercalleridname':_0x1cadb3[_0xd832('0x5')],'transfererconnectedlinenum':_0x1cadb3[_0xd832('0x6')],'transfererconnectedlinename':_0x1cadb3[_0xd832('0x7')],'transfereraccountcode':_0x1cadb3['transfereraccountcode'],'transferercontext':_0x1cadb3[_0xd832('0x8')],'transfererexten':_0x1cadb3[_0xd832('0x9')],'transfererlinkedid':_0x1cadb3[_0xd832('0xa')],'transfereechannel':_0x1cadb3[_0xd832('0xb')],'transfereecalleridnum':_0x1cadb3[_0xd832('0xc')],'transfereecalleridname':_0x1cadb3[_0xd832('0xd')],'transfereeconnectedlinenum':_0x1cadb3[_0xd832('0xe')],'transfereeconnectedlinename':_0x1cadb3[_0xd832('0xf')],'transfereeaccountcode':_0x1cadb3['transfereeaccountcode'],'transfereecontext':_0x1cadb3[_0xd832('0x10')],'transfereeexten':_0x1cadb3[_0xd832('0x11')],'transfereelinkedid':_0x1cadb3[_0xd832('0x12')],'isexternal':_0x1cadb3['isexternal'],'context':_0x1cadb3[_0xd832('0x13')],'extension':_0x1cadb3['extension'],'type':'blind'},'log':_0xd832('0x1')});};exports[_0xd832('0x14')]=function(_0x1c357d){return client[_0xd832('0x0')](_0xd832('0x1'),{'body':{'result':_0x1c357d[_0xd832('0x2')],'transfererchannel':_0x1c357d[_0xd832('0x15')],'transferercalleridnum':_0x1c357d['origtransferercalleridnum'],'transferercalleridname':_0x1c357d[_0xd832('0x16')],'transfererconnectedlinenum':_0x1c357d[_0xd832('0x17')],'transfererconnectedlinename':_0x1c357d[_0xd832('0x18')],'transfereraccountcode':_0x1c357d[_0xd832('0x19')],'transferercontext':_0x1c357d[_0xd832('0x1a')],'transfererexten':_0x1c357d[_0xd832('0x1b')],'transfererlinkedid':_0x1c357d[_0xd832('0x1c')],'transfereechannel':_0x1c357d[_0xd832('0x1d')],'transfereecalleridnum':_0x1c357d[_0xd832('0x1e')],'transfereecalleridname':_0x1c357d[_0xd832('0x1f')],'transfereeconnectedlinenum':_0x1c357d[_0xd832('0x20')],'transfereeconnectedlinename':_0x1c357d[_0xd832('0x21')],'transfereeaccountcode':_0x1c357d[_0xd832('0x22')],'transfereecontext':_0x1c357d['transfertargetcontext'],'transfereeexten':_0x1c357d[_0xd832('0x23')],'transfereelinkedid':_0x1c357d[_0xd832('0x24')],'isexternal':_0x1c357d['isexternal'],'context':_0x1c357d[_0xd832('0x25')],'extension':_0x1c357d[_0xd832('0x26')],'type':_0xd832('0x27')},'log':_0xd832('0x1')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 4210b0a..80cae8a 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 _0x7da7=['AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','../../../config/environment','../properties','../model/voiceQueueSummary','listen','format','%s/%s','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','error','asterisk','username','join','keys','reload','module','action','message','catch','ami\x20disconnected','Action','then','content','voiceQueues','push','length','find','undefined','channels','voicechannel','map','uniqueid','channel','%s.%s','wav','MixMonitor','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','isNil','monitors','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','isConnected','validate','resolve','StopMixMonitor','destinationchannel','status','stop','filename','StopMixMonitor\x20Success','queueChannels','type','inbound','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','voicequeuechannelhangup','Hangup','exten','context','values','telephones','outboundChannels','campaigns','run','Event\x20name\x20mandatory','emit','faxAccounts','send','server','http','127.0.0.1','log'];(function(_0x1a31e8,_0x5387bc){var _0x3adc72=function(_0x1997a3){while(--_0x1997a3){_0x1a31e8['push'](_0x1a31e8['shift']());}};_0x3adc72(++_0x5387bc);}(_0x7da7,0x10d));var _0x77da=function(_0x3b1b23,_0x21bccd){_0x3b1b23=_0x3b1b23-0x0;var _0x1efc85=_0x7da7[_0x3b1b23];return _0x1efc85;};'use strict';var _=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var jayson=require(_0x77da('0x2'));var schema=require('validate');var moment=require('moment');var config=require(_0x77da('0x3'));var properties=require(_0x77da('0x4'));var ami=require('../ami');var VoiceQueueSummary=require(_0x77da('0x5'));exports[_0x77da('0x6')]=function(_0x56458c,_0x19331c,_0xc54a12){return new Promise(function(_0x47da81,_0x30afe0){var _0x47cf1d={'QueuePause':function(_0x1191de){return new Promise(function(_0x13992e){var _0x37c5ab=util[_0x77da('0x7')](_0x77da('0x8'),'SIP',_0x1191de[_0x77da('0x9')]);if(_0x56458c[_0x77da('0xa')]&&_0x56458c[_0x77da('0xa')][_0x37c5ab]&&_0x56458c['timers'][_0x37c5ab][_0x77da('0xb')]){_0x56458c[_0x77da('0xa')][_0x37c5ab][_0x77da('0xc')]();}if(_0x56458c[_0x77da('0xd')][_0x37c5ab]){_0x56458c['agents'][_0x37c5ab][_0x77da('0xe')]({'statePause':_0x1191de[_0x77da('0xf')]?!![]:![]});}_0x13992e({'code':0xc8,'message':_0x77da('0x10')});});},'Reload':function(_0x5d6e2f){var _0x4a7748=this;return new Promise(function(_0x26e3ff,_0x4263d9){if(ami['isConnected']()==![]){return _0x4263d9(_0x4a7748[_0x77da('0x11')](0x1f4,[config[_0x77da('0x12')]['ip'],config[_0x77da('0x12')][_0x77da('0x13')],'ami\x20disconnected'][_0x77da('0x14')]('\x20')));}_0x5d6e2f=_['pick'](_0x5d6e2f,_[_0x77da('0x15')](properties[_0x77da('0x16')][_0x77da('0x17')]));_0x5d6e2f[_0x77da('0x18')]='Reload';return ami['Action'](_0x5d6e2f)['then'](function(_0x482b87){_0x26e3ff({'code':0xc8,'message':_0x482b87[_0x77da('0x19')]});})[_0x77da('0x1a')](function(_0x289887){_0x4263d9(_0x4a7748[_0x77da('0x11')](0x1f5,_0x289887[_0x77da('0x19')]));});});},'Command':function(_0x12d2b1){var _0x1d325c=this;return new Promise(function(_0x3b6dde,_0x544104){if(ami['isConnected']()==![]){return _0x544104(_0x1d325c[_0x77da('0x11')](0x1f4,[config[_0x77da('0x12')]['ip'],config['asterisk'][_0x77da('0x13')],_0x77da('0x1b')][_0x77da('0x14')]('\x20')));}_0x12d2b1=_['pick'](_0x12d2b1,'command');_0x12d2b1[_0x77da('0x18')]='Command';return ami[_0x77da('0x1c')](_0x12d2b1)[_0x77da('0x1d')](function(_0xc52f0e){_0x3b6dde({'code':0xc8,'message':_0xc52f0e[_0x77da('0x1e')]});})[_0x77da('0x1a')](function(_0x270318){_0x544104(_0x1d325c[_0x77da('0x11')](0x1f5,_0x270318['message']));});});},'VoiceQueues':function(){return new Promise(function(_0x4885ec){var _0xfd160=[];for(var _0x2d009f in _0x56458c[_0x77da('0x1f')]){if(_0x56458c[_0x77da('0x1f')]['hasOwnProperty'](_0x2d009f)){var _0x42240b=_0x56458c[_0x77da('0x1f')][_0x2d009f];var _0x470c9f=new VoiceQueueSummary(_0x42240b);_0xfd160[_0x77da('0x20')](_0x470c9f);}}_0x4885ec({'count':_0xfd160[_0x77da('0x21')],'rows':_0xfd160});});},'UpdateVoiceQueue':function(_0x5997b6){return new Promise(function(_0xce24b8,_0x3e090d){var _0x1f2279=_[_0x77da('0x22')](_0x56458c['voiceQueues'],{'id':parseInt(_0x5997b6['id'])});var _0x5b4638=_['omit'](_0x5997b6,['id']);if(_0x1f2279){for(var _0x2258e9 in _0x5b4638){if(typeof _0x5b4638[_0x2258e9]!==_0x77da('0x23')&&typeof _0x1f2279[_0x2258e9]!==_0x77da('0x23')){_0x1f2279[_0x2258e9]=_0x5b4638[_0x2258e9];}}_0xce24b8(_0x1f2279);}else{_0x3e090d();}});},'VoiceChannels':function(){return new Promise(function(_0x3394d6){var _0x34228f=_['values'](_0x56458c[_0x77da('0x24')]);_0x3394d6({'count':_0x34228f[_0x77da('0x21')],'rows':_0x34228f});});},'VoiceChannelMixMonitor':function(_0x356bfb){var _0x1d381b=this;return new Promise(function(_0x1e7853,_0x46e6b4){if(ami['isConnected']()==![]){return _0x46e6b4(_0x1d381b[_0x77da('0x11')](0x1f4,[config[_0x77da('0x12')]['ip'],config[_0x77da('0x12')][_0x77da('0x13')],_0x77da('0x1b')][_0x77da('0x14')]('\x20')));}var _0x3343b4=schema(properties[_0x77da('0x25')])['validate'](_0x356bfb);if(_0x3343b4['length']>0x0){return _0x46e6b4(_0x1d381b[_0x77da('0x11')](0x1f4,_[_0x77da('0x26')](_0x3343b4,'message')[_0x77da('0x14')](',\x20')));}var _0x390399=_[_0x77da('0x22')](_0x56458c[_0x77da('0x24')],{'uniqueid':_0x356bfb[_0x77da('0x27')]});if(_0x390399&&_0x390399[_0x77da('0x28')]){var _0x20d1cc=util['format'](_0x77da('0x29'),_0x356bfb['filename']||_0x356bfb['uniqueid'],_0x356bfb['format']||_0x77da('0x2a'));return ami['Action']({'action':_0x77da('0x2b'),'channel':_0x390399[_0x77da('0x28')],'file':_0x20d1cc,'options':_0x77da('0x2c')})[_0x77da('0x1d')](function(_0x3c46d2){var _0x3f0593=_[_0x77da('0x22')](_0x390399['monitors'],{'filename':_0x77da('0x2d')+_0x20d1cc[_0x77da('0x2e')]()});if(_[_0x77da('0x2f')](_0x3f0593)){_0x390399[_0x77da('0x30')][_0x77da('0x20')]({'filename':_0x77da('0x2d')+_0x20d1cc['toLowerCase'](),'createdAt':moment()[_0x77da('0x7')](_0x77da('0x31')),'mixmonitorid':_0x3c46d2[_0x77da('0x32')],'status':'rec'});}else{_0x3f0593[_0x77da('0x32')]=_0x3c46d2['mixmonitorid'];_0x3f0593['status']='rec';}_0x1e7853({'code':0xc8,'message':[_0x356bfb['uniqueid'],_0x77da('0x33'),_0x3c46d2[_0x77da('0x32')]][_0x77da('0x14')]('\x20'),'mixmonitorid':_0x3c46d2['mixmonitorid']});})[_0x77da('0x1a')](function(_0x5b7e63){_0x46e6b4(_0x1d381b[_0x77da('0x11')](0x1f5,[_0x356bfb['uniqueid'],_0x5b7e63[_0x77da('0x19')][_0x77da('0x2e')]()][_0x77da('0x14')]('\x20')));});}else{return _0x46e6b4(_0x1d381b[_0x77da('0x11')](0x1f5,_0x77da('0x34')));}});},'VoiceChannelStopMixMonitor':function(_0x5ecf12){var _0x759b86=this;return new Promise(function(_0x1f48bd,_0x44717a){if(ami[_0x77da('0x35')]()==![]){return _0x44717a(_0x759b86[_0x77da('0x11')](0x1f4,[config[_0x77da('0x12')]['ip'],config['asterisk'][_0x77da('0x13')],_0x77da('0x1b')][_0x77da('0x14')]('\x20')));}var _0x2dfeca=schema(properties[_0x77da('0x25')])[_0x77da('0x36')](_0x5ecf12);if(_0x2dfeca['length']>0x0){return _0x44717a(_0x759b86[_0x77da('0x11')](0x1f4,_['map'](_0x2dfeca,_0x77da('0x19'))[_0x77da('0x14')](',\x20')));}var _0x40a492=_['find'](_0x56458c[_0x77da('0x24')],{'uniqueid':_0x5ecf12[_0x77da('0x27')]});if(_0x40a492){return Promise[_0x77da('0x37')]()[_0x77da('0x1d')](function(){if(_0x40a492[_0x77da('0x28')]){return ami[_0x77da('0x1c')]({'action':_0x77da('0x38'),'channel':_0x40a492[_0x77da('0x28')],'mixmonitorid':_0x5ecf12[_0x77da('0x32')]})['catch'](function(){});}})[_0x77da('0x1d')](function(){if(_0x40a492[_0x77da('0x39')]){return ami[_0x77da('0x1c')]({'action':_0x77da('0x38'),'channel':_0x40a492[_0x77da('0x39')],'mixmonitorid':_0x5ecf12[_0x77da('0x32')]})['catch'](function(){});}})['then'](function(){var _0x240d7b=_[_0x77da('0x22')](_0x40a492[_0x77da('0x30')],{'mixmonitorid':_0x5ecf12[_0x77da('0x32')]});if(_0x240d7b){_0x240d7b[_0x77da('0x3a')]=_0x77da('0x3b');}})['then'](function(){var _0x6ccb8f=util[_0x77da('0x7')](_0x77da('0x29'),_0x5ecf12[_0x77da('0x3c')]||_0x5ecf12['uniqueid'],_0x5ecf12[_0x77da('0x7')]||'wav');var _0x518fd5=_[_0x77da('0x22')](_0x40a492[_0x77da('0x30')],{'filename':_0x77da('0x2d')+_0x6ccb8f[_0x77da('0x2e')]()});if(_0x518fd5){_0x518fd5['status']=_0x77da('0x3b');}})[_0x77da('0x1d')](function(){_0x1f48bd({'code':0xc8,'message':[_0x5ecf12['uniqueid'],_0x77da('0x3d')][_0x77da('0x14')]('\x20')});})['catch'](function(_0x6c0b00){_0x44717a(_0x759b86[_0x77da('0x11')](0x1f5,[_0x5ecf12[_0x77da('0x27')],_0x6c0b00[_0x77da('0x19')][_0x77da('0x2e')]()][_0x77da('0x14')]('\x20')));});}else{return _0x44717a(_0x759b86[_0x77da('0x11')](0x1f5,_0x77da('0x34')));}});},'VoiceQueuesChannels':function(_0x128ce3){var _0x3a34a8=this;return new Promise(function(_0x52aa0a){var _0x3d04a3=_['values'](_0x56458c[_0x77da('0x3e')]);var _0x14cd3c={'count':_0x3d04a3[_0x77da('0x21')],'rows':_0x3d04a3};if(_0x128ce3&&_0x128ce3[_0x77da('0x3f')]){if(![_0x77da('0x40'),_0x77da('0x41')][_0x77da('0x42')](_0x128ce3['type'])){return _0x30afe0(_0x3a34a8[_0x77da('0x11')](0x190,_0x77da('0x43')));}var _0x1a7115=_[_0x77da('0x44')](_0x3d04a3,function(_0x4f30a1){return _0x4f30a1[_0x77da('0x3f')]===_0x128ce3[_0x77da('0x3f')];});_0x14cd3c[_0x77da('0x45')]=_0x1a7115['length'];_0x14cd3c['rows']=_0x1a7115;}_0x52aa0a(_0x14cd3c);});},'VoiceQueuesChannel':function(_0x332763){var _0x3a0396=this;return new Promise(function(_0x42ea9e,_0x1d1ea2){var _0x451897=schema(properties['voicequeuechannel'])['validate'](_0x332763);if(_0x451897[_0x77da('0x21')]>0x0){return _0x1d1ea2(_0x3a0396[_0x77da('0x11')](0x1f4,_['map'](_0x451897,_0x77da('0x19'))[_0x77da('0x14')](',\x20')));}var _0x1e0146=_['find'](_0x56458c[_0x77da('0x3e')],{'uniqueid':_0x332763[_0x77da('0x27')]});if(_0x1e0146){_0x42ea9e(_0x1e0146);}else{return _0x1d1ea2(_0x3a0396['error'](0x1f5,_0x77da('0x34')));}});},'VoiceQueuesChannelHangup':function(_0x27aa8c){var _0xfb06b5=this;return new Promise(function(_0x1a4bab,_0x20cce1){if(ami[_0x77da('0x35')]()==![]){return _0x20cce1(_0xfb06b5[_0x77da('0x11')](0x1f4,[config[_0x77da('0x12')]['ip'],config[_0x77da('0x12')]['username'],_0x77da('0x1b')][_0x77da('0x14')]('\x20')));}var _0x1f6141=schema(properties[_0x77da('0x46')])[_0x77da('0x36')](_0x27aa8c);if(_0x1f6141[_0x77da('0x21')]>0x0){return _0x20cce1(_0xfb06b5['error'](0x1f4,_[_0x77da('0x26')](_0x1f6141,_0x77da('0x19'))[_0x77da('0x14')](',\x20')));}var _0x5b9cf2=_[_0x77da('0x22')](_0x56458c[_0x77da('0x3e')],{'uniqueid':_0x27aa8c[_0x77da('0x27')]});if(_0x5b9cf2&&_0x5b9cf2[_0x77da('0x28')]){return ami[_0x77da('0x1c')]({'action':_0x77da('0x47'),'channel':_0x5b9cf2[_0x77da('0x28')]})['then'](function(_0x100094){_0x1a4bab({'code':0xc8,'message':[_0x27aa8c['uniqueid'],_0x100094[_0x77da('0x19')][_0x77da('0x2e')]()][_0x77da('0x14')]('\x20')});})['catch'](function(_0x30c746){_0x20cce1(_0xfb06b5[_0x77da('0x11')](0x1f5,[_0x27aa8c[_0x77da('0x27')],_0x30c746[_0x77da('0x19')]['toLowerCase']()]['join']('\x20')));});}else{return _0x20cce1(_0xfb06b5['error'](0x1f5,_0x77da('0x34')));}});},'VoiceQueuesChannelRedirect':function(_0x1bca78){var _0x2c4d7c=this;return new Promise(function(_0x2c7c8e,_0x458da6){if(ami[_0x77da('0x35')]()==![]){return _0x458da6(_0x2c4d7c[_0x77da('0x11')](0x1f4,[config[_0x77da('0x12')]['ip'],config[_0x77da('0x12')][_0x77da('0x13')],'ami\x20disconnected'][_0x77da('0x14')]('\x20')));}var _0x6dd79f=schema(properties['voicequeuechannelredirect'])['validate'](_0x1bca78);if(_0x6dd79f[_0x77da('0x21')]>0x0){return _0x458da6(_0x2c4d7c['error'](0x1f4,_[_0x77da('0x26')](_0x6dd79f,_0x77da('0x19'))[_0x77da('0x14')](',\x20')));}var _0x4b9115=_[_0x77da('0x22')](_0x56458c[_0x77da('0x3e')],{'uniqueid':_0x1bca78[_0x77da('0x27')]});if(_0x4b9115&&_0x4b9115[_0x77da('0x28')]){return ami[_0x77da('0x1c')]({'action':'Redirect','channel':_0x4b9115[_0x77da('0x28')],'exten':_0x1bca78[_0x77da('0x48')],'context':_0x1bca78['context']||_0x4b9115[_0x77da('0x49')],'priority':0x1})[_0x77da('0x1d')](function(_0xd14296){_0x2c7c8e({'code':0xc8,'message':[_0x1bca78[_0x77da('0x27')],_0xd14296[_0x77da('0x19')][_0x77da('0x2e')]()][_0x77da('0x14')]('\x20')});})['catch'](function(_0x3f5766){_0x458da6(_0x2c4d7c['error'](0x1f5,[_0x1bca78[_0x77da('0x27')],_0x3f5766[_0x77da('0x19')][_0x77da('0x2e')]()][_0x77da('0x14')]('\x20')));});}else{return _0x458da6(_0x2c4d7c[_0x77da('0x11')](0x1f5,_0x77da('0x34')));}});},'Agents':function(_0xf75c3c){return new Promise(function(_0x103e1b){var _0x195a34=_[_0x77da('0x4a')](_0x56458c[_0x77da('0xd')]);if(_0xf75c3c&&_0xf75c3c['id']){var _0x19065e=_['find'](_0x195a34,function(_0x39d569){return _0x39d569['id']===_0xf75c3c['id'];});_0x103e1b(_0x19065e);}else{_0x103e1b({'count':_0x195a34[_0x77da('0x21')],'rows':_0x195a34});}});},'Telephones':function(){return new Promise(function(_0xeb5121){var _0x16d8cd=_['values'](_0x56458c[_0x77da('0x4b')]);_0xeb5121({'count':_0x16d8cd[_0x77da('0x21')],'rows':_0x16d8cd});});},'Trunks':function(){return new Promise(function(_0x16c7b7){var _0x4f3479=_[_0x77da('0x4a')](_0x56458c['trunks']);_0x16c7b7({'count':_0x4f3479['length'],'rows':_0x4f3479});});},'OutboundChannels':function(){return new Promise(function(_0x2a4f85){var _0x4015f0=_[_0x77da('0x4a')](_0x56458c[_0x77da('0x4c')]);_0x2a4f85({'count':_0x4015f0[_0x77da('0x21')],'rows':_0x4015f0});});},'Outbound':function(){return new Promise(function(_0x337621){_0x337621(_0x56458c[_0x77da('0x41')]);});},'Campaigns':function(){return new Promise(function(_0xf95d48){var _0x470840=_['values'](_0x56458c[_0x77da('0x4d')]);_0xf95d48({'count':_0x470840[_0x77da('0x21')],'rows':_0x470840});});},'VoiceQueuesPreview':function(_0x2d3ab4){var _0x1206c7=this;return new Promise(function(_0x17175,_0x502249){_0x19331c[_0x77da('0x4e')](_0x2d3ab4['id'])[_0x77da('0x1d')](function(_0x27c0a2){_0x17175({'code':0xc8,'message':_0x27c0a2[_0x77da('0x19')]});})[_0x77da('0x1a')](function(_0x94f1e1){_0x502249(_0x1206c7[_0x77da('0x11')](0x1f4,_0x94f1e1[_0x77da('0x19')]));});});},'EventManager':function(_0x352a4e){var _0x37d94a=this;return new Promise(function(_0x4df868,_0x519e38){if(!_0x352a4e['event']){return _0x519e38(_0x37d94a[_0x77da('0x11')](0x1f4,_0x77da('0x4f')));}ami[_0x77da('0x50')]('custom:'+_0x352a4e['event'],_0x352a4e[_0x77da('0x19')]);_0x4df868({'code':0xc8,'message':_0x352a4e});});},'FaxAccounts':function(){return new Promise(function(_0xdbd9d5){var _0x17a2e6=_[_0x77da('0x4a')](_0x56458c[_0x77da('0x51')]);_0xdbd9d5({'count':_0x17a2e6[_0x77da('0x21')],'rows':_0x17a2e6});});},'SendFax':function(_0x3fca4b){var _0x276805=this;return new Promise(function(_0x1523a8,_0x11152b){_0xc54a12[_0x77da('0x52')](_0x3fca4b)[_0x77da('0x1d')](function(_0x1d2944){_0x1523a8({'code':0xc8,'message':_0x1d2944['message']});})['catch'](function(_0x1cdd40){_0x11152b(_0x276805['error'](0x1f4,_0x1cdd40['message']));});});},'CheckAfterSend':function(_0x22de60){var _0x1e37da=this;return new Promise(function(_0x2ae66f,_0x583a7a){_0xc54a12['checkAfterSend'](_0x22de60)[_0x77da('0x1d')](function(_0x4f1ae0){_0x2ae66f({'code':0xc8,'message':_0x4f1ae0[_0x77da('0x19')]});})[_0x77da('0x1a')](function(_0x554c44){_0x583a7a(_0x1e37da[_0x77da('0x11')](0x1f4,_0x554c44['message']));});});}};var _0x15cec0=jayson[_0x77da('0x53')](_0x47cf1d)[_0x77da('0x54')]();_0x15cec0['on'](_0x77da('0x11'),function(_0x4e3014){return _0x30afe0(_0x4e3014);});_0x15cec0[_0x77da('0x6')](0x232a,_0x77da('0x55'),function(){console[_0x77da('0x56')](_0x77da('0x57'),0x232a);return _0x47da81(_0x77da('0x58')+0x232a);});});}; \ No newline at end of file +var _0xc949=['destinationchannel','status','stop','queueChannels','type','inbound','outbound','filter','count','voicequeuechannel','voicequeuechannelredirect','Redirect','exten','context','values','telephones','trunks','outboundChannels','campaigns','run','event','custom:','faxAccounts','send','checkAfterSend','server','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../../../config/environment','../ami','../model/voiceQueueSummary','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','ami\x20disconnected','join','keys','action','Action','then','message','catch','username','pick','command','Command','content','voiceQueues','hasOwnProperty','length','find','omit','undefined','channels','voicechannel','uniqueid','channel','%s.%s','filename','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','map','StopMixMonitor'];(function(_0x15d26f,_0x1f9893){var _0x54521f=function(_0x47cb67){while(--_0x47cb67){_0x15d26f['push'](_0x15d26f['shift']());}};_0x54521f(++_0x1f9893);}(_0xc949,0x181));var _0x9c94=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xc949[_0x2160a9];return _0xa88cf7;};'use strict';var _=require(_0x9c94('0x0'));var util=require('util');var jayson=require(_0x9c94('0x1'));var schema=require(_0x9c94('0x2'));var moment=require(_0x9c94('0x3'));var config=require(_0x9c94('0x4'));var properties=require('../properties');var ami=require(_0x9c94('0x5'));var VoiceQueueSummary=require(_0x9c94('0x6'));exports['listen']=function(_0x405fe2,_0x1b60a1,_0x46d560){return new Promise(function(_0x1357ac,_0x57fcd7){var _0xf373e={'QueuePause':function(_0x360e7b){return new Promise(function(_0x25ecd0){var _0x43aa51=util[_0x9c94('0x7')](_0x9c94('0x8'),_0x9c94('0x9'),_0x360e7b[_0x9c94('0xa')]);if(_0x405fe2[_0x9c94('0xb')]&&_0x405fe2[_0x9c94('0xb')][_0x43aa51]&&_0x405fe2['timers'][_0x43aa51][_0x9c94('0xc')]){_0x405fe2[_0x9c94('0xb')][_0x43aa51][_0x9c94('0xd')]();}if(_0x405fe2[_0x9c94('0xe')][_0x43aa51]){_0x405fe2[_0x9c94('0xe')][_0x43aa51][_0x9c94('0xf')]({'statePause':_0x360e7b[_0x9c94('0x10')]?!![]:![]});}_0x25ecd0({'code':0xc8,'message':_0x9c94('0x11')});});},'Reload':function(_0x30f64e){var _0x1e326f=this;return new Promise(function(_0x4440b2,_0x25c444){if(ami[_0x9c94('0x12')]()==![]){return _0x25c444(_0x1e326f[_0x9c94('0x13')](0x1f4,[config['asterisk']['ip'],config[_0x9c94('0x14')]['username'],_0x9c94('0x15')][_0x9c94('0x16')]('\x20')));}_0x30f64e=_['pick'](_0x30f64e,_[_0x9c94('0x17')](properties['reload']['module']));_0x30f64e[_0x9c94('0x18')]='Reload';return ami[_0x9c94('0x19')](_0x30f64e)[_0x9c94('0x1a')](function(_0x4d9266){_0x4440b2({'code':0xc8,'message':_0x4d9266[_0x9c94('0x1b')]});})[_0x9c94('0x1c')](function(_0x412804){_0x25c444(_0x1e326f[_0x9c94('0x13')](0x1f5,_0x412804[_0x9c94('0x1b')]));});});},'Command':function(_0xfbcc7c){var _0x3e361c=this;return new Promise(function(_0x5cb39c,_0x2c9736){if(ami[_0x9c94('0x12')]()==![]){return _0x2c9736(_0x3e361c['error'](0x1f4,[config[_0x9c94('0x14')]['ip'],config[_0x9c94('0x14')][_0x9c94('0x1d')],_0x9c94('0x15')][_0x9c94('0x16')]('\x20')));}_0xfbcc7c=_[_0x9c94('0x1e')](_0xfbcc7c,_0x9c94('0x1f'));_0xfbcc7c[_0x9c94('0x18')]=_0x9c94('0x20');return ami[_0x9c94('0x19')](_0xfbcc7c)[_0x9c94('0x1a')](function(_0xe9280a){_0x5cb39c({'code':0xc8,'message':_0xe9280a[_0x9c94('0x21')]});})[_0x9c94('0x1c')](function(_0x5b1020){_0x2c9736(_0x3e361c[_0x9c94('0x13')](0x1f5,_0x5b1020[_0x9c94('0x1b')]));});});},'VoiceQueues':function(){return new Promise(function(_0x5c2647){var _0x102130=[];for(var _0x2c3d25 in _0x405fe2[_0x9c94('0x22')]){if(_0x405fe2[_0x9c94('0x22')][_0x9c94('0x23')](_0x2c3d25)){var _0x4dd38e=_0x405fe2[_0x9c94('0x22')][_0x2c3d25];var _0x45cf4d=new VoiceQueueSummary(_0x4dd38e);_0x102130['push'](_0x45cf4d);}}_0x5c2647({'count':_0x102130[_0x9c94('0x24')],'rows':_0x102130});});},'UpdateVoiceQueue':function(_0x4cfb9c){return new Promise(function(_0xa5df6f,_0x14d41b){var _0x330bd4=_[_0x9c94('0x25')](_0x405fe2[_0x9c94('0x22')],{'id':parseInt(_0x4cfb9c['id'])});var _0x3f2622=_[_0x9c94('0x26')](_0x4cfb9c,['id']);if(_0x330bd4){for(var _0x561fdc in _0x3f2622){if(typeof _0x3f2622[_0x561fdc]!=='undefined'&&typeof _0x330bd4[_0x561fdc]!==_0x9c94('0x27')){_0x330bd4[_0x561fdc]=_0x3f2622[_0x561fdc];}}_0xa5df6f(_0x330bd4);}else{_0x14d41b();}});},'VoiceChannels':function(){return new Promise(function(_0x1878b5){var _0x1f732b=_['values'](_0x405fe2[_0x9c94('0x28')]);_0x1878b5({'count':_0x1f732b['length'],'rows':_0x1f732b});});},'VoiceChannelMixMonitor':function(_0x356ee8){var _0x4592e5=this;return new Promise(function(_0x1fd8ab,_0x57e7a6){if(ami['isConnected']()==![]){return _0x57e7a6(_0x4592e5[_0x9c94('0x13')](0x1f4,[config[_0x9c94('0x14')]['ip'],config[_0x9c94('0x14')]['username'],'ami\x20disconnected']['join']('\x20')));}var _0x4aa5a9=schema(properties[_0x9c94('0x29')])['validate'](_0x356ee8);if(_0x4aa5a9[_0x9c94('0x24')]>0x0){return _0x57e7a6(_0x4592e5[_0x9c94('0x13')](0x1f4,_['map'](_0x4aa5a9,'message')[_0x9c94('0x16')](',\x20')));}var _0x6b1b1a=_[_0x9c94('0x25')](_0x405fe2[_0x9c94('0x28')],{'uniqueid':_0x356ee8[_0x9c94('0x2a')]});if(_0x6b1b1a&&_0x6b1b1a[_0x9c94('0x2b')]){var _0x265668=util[_0x9c94('0x7')](_0x9c94('0x2c'),_0x356ee8[_0x9c94('0x2d')]||_0x356ee8[_0x9c94('0x2a')],_0x356ee8[_0x9c94('0x7')]||_0x9c94('0x2e'));return ami[_0x9c94('0x19')]({'action':_0x9c94('0x2f'),'channel':_0x6b1b1a[_0x9c94('0x2b')],'file':_0x265668,'options':_0x9c94('0x30')})[_0x9c94('0x1a')](function(_0x4eeeb1){var _0x2d9648=_[_0x9c94('0x25')](_0x6b1b1a[_0x9c94('0x31')],{'filename':_0x9c94('0x32')+_0x265668[_0x9c94('0x33')]()});if(_[_0x9c94('0x34')](_0x2d9648)){_0x6b1b1a[_0x9c94('0x31')]['push']({'filename':_0x9c94('0x32')+_0x265668['toLowerCase'](),'createdAt':moment()[_0x9c94('0x7')](_0x9c94('0x35')),'mixmonitorid':_0x4eeeb1[_0x9c94('0x36')],'status':_0x9c94('0x37')});}else{_0x2d9648['mixmonitorid']=_0x4eeeb1[_0x9c94('0x36')];_0x2d9648['status']=_0x9c94('0x37');}_0x1fd8ab({'code':0xc8,'message':[_0x356ee8[_0x9c94('0x2a')],_0x9c94('0x38'),_0x4eeeb1['mixmonitorid']][_0x9c94('0x16')]('\x20'),'mixmonitorid':_0x4eeeb1['mixmonitorid']});})[_0x9c94('0x1c')](function(_0x4e8bf0){_0x57e7a6(_0x4592e5['error'](0x1f5,[_0x356ee8[_0x9c94('0x2a')],_0x4e8bf0[_0x9c94('0x1b')][_0x9c94('0x33')]()][_0x9c94('0x16')]('\x20')));});}else{return _0x57e7a6(_0x4592e5['error'](0x1f5,_0x9c94('0x39')));}});},'VoiceChannelStopMixMonitor':function(_0x693ede){var _0x425778=this;return new Promise(function(_0x360960,_0x57ab57){if(ami[_0x9c94('0x12')]()==![]){return _0x57ab57(_0x425778[_0x9c94('0x13')](0x1f4,[config['asterisk']['ip'],config[_0x9c94('0x14')][_0x9c94('0x1d')],_0x9c94('0x15')]['join']('\x20')));}var _0x4c42af=schema(properties[_0x9c94('0x29')])[_0x9c94('0x2')](_0x693ede);if(_0x4c42af[_0x9c94('0x24')]>0x0){return _0x57ab57(_0x425778[_0x9c94('0x13')](0x1f4,_[_0x9c94('0x3a')](_0x4c42af,_0x9c94('0x1b'))[_0x9c94('0x16')](',\x20')));}var _0x31edae=_[_0x9c94('0x25')](_0x405fe2[_0x9c94('0x28')],{'uniqueid':_0x693ede[_0x9c94('0x2a')]});if(_0x31edae){return Promise['resolve']()[_0x9c94('0x1a')](function(){if(_0x31edae['channel']){return ami[_0x9c94('0x19')]({'action':_0x9c94('0x3b'),'channel':_0x31edae[_0x9c94('0x2b')],'mixmonitorid':_0x693ede[_0x9c94('0x36')]})[_0x9c94('0x1c')](function(){});}})[_0x9c94('0x1a')](function(){if(_0x31edae[_0x9c94('0x3c')]){return ami['Action']({'action':'StopMixMonitor','channel':_0x31edae[_0x9c94('0x3c')],'mixmonitorid':_0x693ede[_0x9c94('0x36')]})[_0x9c94('0x1c')](function(){});}})['then'](function(){var _0x3c507f=_[_0x9c94('0x25')](_0x31edae['monitors'],{'mixmonitorid':_0x693ede['mixmonitorid']});if(_0x3c507f){_0x3c507f['status']='stop';}})[_0x9c94('0x1a')](function(){var _0x5362f4=util['format'](_0x9c94('0x2c'),_0x693ede['filename']||_0x693ede[_0x9c94('0x2a')],_0x693ede[_0x9c94('0x7')]||_0x9c94('0x2e'));var _0x205f51=_[_0x9c94('0x25')](_0x31edae['monitors'],{'filename':_0x9c94('0x32')+_0x5362f4[_0x9c94('0x33')]()});if(_0x205f51){_0x205f51[_0x9c94('0x3d')]=_0x9c94('0x3e');}})[_0x9c94('0x1a')](function(){_0x360960({'code':0xc8,'message':[_0x693ede[_0x9c94('0x2a')],'StopMixMonitor\x20Success'][_0x9c94('0x16')]('\x20')});})['catch'](function(_0x129e6e){_0x57ab57(_0x425778[_0x9c94('0x13')](0x1f5,[_0x693ede[_0x9c94('0x2a')],_0x129e6e['message'][_0x9c94('0x33')]()][_0x9c94('0x16')]('\x20')));});}else{return _0x57ab57(_0x425778['error'](0x1f5,_0x9c94('0x39')));}});},'VoiceQueuesChannels':function(_0x58a683){var _0xad2adb=this;return new Promise(function(_0x3aa1dd){var _0x537c78=_['values'](_0x405fe2[_0x9c94('0x3f')]);var _0x4c5cdc={'count':_0x537c78[_0x9c94('0x24')],'rows':_0x537c78};if(_0x58a683&&_0x58a683[_0x9c94('0x40')]){if(![_0x9c94('0x41'),_0x9c94('0x42')]['includes'](_0x58a683[_0x9c94('0x40')])){return _0x57fcd7(_0xad2adb[_0x9c94('0x13')](0x190,'Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound'));}var _0x533f24=_[_0x9c94('0x43')](_0x537c78,function(_0xf35376){return _0xf35376[_0x9c94('0x40')]===_0x58a683[_0x9c94('0x40')];});_0x4c5cdc[_0x9c94('0x44')]=_0x533f24[_0x9c94('0x24')];_0x4c5cdc['rows']=_0x533f24;}_0x3aa1dd(_0x4c5cdc);});},'VoiceQueuesChannel':function(_0x197b70){var _0x135239=this;return new Promise(function(_0x1e60d4,_0x3424b1){var _0x3f34f2=schema(properties[_0x9c94('0x45')])['validate'](_0x197b70);if(_0x3f34f2[_0x9c94('0x24')]>0x0){return _0x3424b1(_0x135239['error'](0x1f4,_[_0x9c94('0x3a')](_0x3f34f2,_0x9c94('0x1b'))[_0x9c94('0x16')](',\x20')));}var _0x5a3189=_[_0x9c94('0x25')](_0x405fe2['queueChannels'],{'uniqueid':_0x197b70['uniqueid']});if(_0x5a3189){_0x1e60d4(_0x5a3189);}else{return _0x3424b1(_0x135239[_0x9c94('0x13')](0x1f5,_0x9c94('0x39')));}});},'VoiceQueuesChannelHangup':function(_0x4c54aa){var _0x11573c=this;return new Promise(function(_0x23937d,_0x1f0beb){if(ami[_0x9c94('0x12')]()==![]){return _0x1f0beb(_0x11573c[_0x9c94('0x13')](0x1f4,[config[_0x9c94('0x14')]['ip'],config[_0x9c94('0x14')][_0x9c94('0x1d')],_0x9c94('0x15')][_0x9c94('0x16')]('\x20')));}var _0x2e61b4=schema(properties['voicequeuechannelhangup'])['validate'](_0x4c54aa);if(_0x2e61b4[_0x9c94('0x24')]>0x0){return _0x1f0beb(_0x11573c[_0x9c94('0x13')](0x1f4,_['map'](_0x2e61b4,_0x9c94('0x1b'))[_0x9c94('0x16')](',\x20')));}var _0xd3e67e=_[_0x9c94('0x25')](_0x405fe2[_0x9c94('0x3f')],{'uniqueid':_0x4c54aa[_0x9c94('0x2a')]});if(_0xd3e67e&&_0xd3e67e['channel']){return ami['Action']({'action':'Hangup','channel':_0xd3e67e[_0x9c94('0x2b')]})['then'](function(_0x54253b){_0x23937d({'code':0xc8,'message':[_0x4c54aa[_0x9c94('0x2a')],_0x54253b[_0x9c94('0x1b')][_0x9c94('0x33')]()][_0x9c94('0x16')]('\x20')});})[_0x9c94('0x1c')](function(_0x91a083){_0x1f0beb(_0x11573c['error'](0x1f5,[_0x4c54aa[_0x9c94('0x2a')],_0x91a083['message'][_0x9c94('0x33')]()][_0x9c94('0x16')]('\x20')));});}else{return _0x1f0beb(_0x11573c['error'](0x1f5,_0x9c94('0x39')));}});},'VoiceQueuesChannelRedirect':function(_0x2fee4d){var _0x59d70b=this;return new Promise(function(_0x3deac6,_0x23c324){if(ami[_0x9c94('0x12')]()==![]){return _0x23c324(_0x59d70b[_0x9c94('0x13')](0x1f4,[config['asterisk']['ip'],config[_0x9c94('0x14')][_0x9c94('0x1d')],'ami\x20disconnected']['join']('\x20')));}var _0xf8b2ec=schema(properties[_0x9c94('0x46')])[_0x9c94('0x2')](_0x2fee4d);if(_0xf8b2ec['length']>0x0){return _0x23c324(_0x59d70b['error'](0x1f4,_[_0x9c94('0x3a')](_0xf8b2ec,_0x9c94('0x1b'))[_0x9c94('0x16')](',\x20')));}var _0x5346c1=_[_0x9c94('0x25')](_0x405fe2[_0x9c94('0x3f')],{'uniqueid':_0x2fee4d[_0x9c94('0x2a')]});if(_0x5346c1&&_0x5346c1[_0x9c94('0x2b')]){return ami[_0x9c94('0x19')]({'action':_0x9c94('0x47'),'channel':_0x5346c1['channel'],'exten':_0x2fee4d[_0x9c94('0x48')],'context':_0x2fee4d[_0x9c94('0x49')]||_0x5346c1[_0x9c94('0x49')],'priority':0x1})[_0x9c94('0x1a')](function(_0x3fa267){_0x3deac6({'code':0xc8,'message':[_0x2fee4d[_0x9c94('0x2a')],_0x3fa267[_0x9c94('0x1b')][_0x9c94('0x33')]()][_0x9c94('0x16')]('\x20')});})[_0x9c94('0x1c')](function(_0x3f9ef0){_0x23c324(_0x59d70b['error'](0x1f5,[_0x2fee4d['uniqueid'],_0x3f9ef0[_0x9c94('0x1b')]['toLowerCase']()]['join']('\x20')));});}else{return _0x23c324(_0x59d70b['error'](0x1f5,_0x9c94('0x39')));}});},'Agents':function(_0x239978){return new Promise(function(_0x5f4c34){var _0x26d115=_[_0x9c94('0x4a')](_0x405fe2[_0x9c94('0xe')]);if(_0x239978&&_0x239978['id']){var _0x31e0bf=_[_0x9c94('0x25')](_0x26d115,function(_0x5bb733){return _0x5bb733['id']===_0x239978['id'];});_0x5f4c34(_0x31e0bf);}else{_0x5f4c34({'count':_0x26d115[_0x9c94('0x24')],'rows':_0x26d115});}});},'Telephones':function(){return new Promise(function(_0x4925b4){var _0x341538=_[_0x9c94('0x4a')](_0x405fe2[_0x9c94('0x4b')]);_0x4925b4({'count':_0x341538[_0x9c94('0x24')],'rows':_0x341538});});},'Trunks':function(){return new Promise(function(_0xffc18){var _0x476b45=_[_0x9c94('0x4a')](_0x405fe2[_0x9c94('0x4c')]);_0xffc18({'count':_0x476b45[_0x9c94('0x24')],'rows':_0x476b45});});},'OutboundChannels':function(){return new Promise(function(_0x183527){var _0x1bcdf5=_['values'](_0x405fe2[_0x9c94('0x4d')]);_0x183527({'count':_0x1bcdf5[_0x9c94('0x24')],'rows':_0x1bcdf5});});},'Outbound':function(){return new Promise(function(_0x16d000){_0x16d000(_0x405fe2['outbound']);});},'Campaigns':function(){return new Promise(function(_0x309b59){var _0x2ff513=_[_0x9c94('0x4a')](_0x405fe2[_0x9c94('0x4e')]);_0x309b59({'count':_0x2ff513[_0x9c94('0x24')],'rows':_0x2ff513});});},'VoiceQueuesPreview':function(_0x66483b){var _0x13988a=this;return new Promise(function(_0x5c02f2,_0x1dcfaa){_0x1b60a1[_0x9c94('0x4f')](_0x66483b['id'])[_0x9c94('0x1a')](function(_0x58cfb5){_0x5c02f2({'code':0xc8,'message':_0x58cfb5[_0x9c94('0x1b')]});})[_0x9c94('0x1c')](function(_0x204a96){_0x1dcfaa(_0x13988a[_0x9c94('0x13')](0x1f4,_0x204a96['message']));});});},'EventManager':function(_0x3fa6be){var _0x1b0eac=this;return new Promise(function(_0x1f5019,_0x7760b5){if(!_0x3fa6be[_0x9c94('0x50')]){return _0x7760b5(_0x1b0eac[_0x9c94('0x13')](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x9c94('0x51')+_0x3fa6be[_0x9c94('0x50')],_0x3fa6be[_0x9c94('0x1b')]);_0x1f5019({'code':0xc8,'message':_0x3fa6be});});},'FaxAccounts':function(){return new Promise(function(_0x4ffe4a){var _0x461098=_[_0x9c94('0x4a')](_0x405fe2[_0x9c94('0x52')]);_0x4ffe4a({'count':_0x461098['length'],'rows':_0x461098});});},'SendFax':function(_0x44dbb1){var _0x5ca9e5=this;return new Promise(function(_0x4881bd,_0x3738e6){_0x46d560[_0x9c94('0x53')](_0x44dbb1)['then'](function(_0x6ca08){_0x4881bd({'code':0xc8,'message':_0x6ca08[_0x9c94('0x1b')]});})['catch'](function(_0xab3bf1){_0x3738e6(_0x5ca9e5[_0x9c94('0x13')](0x1f4,_0xab3bf1[_0x9c94('0x1b')]));});});},'CheckAfterSend':function(_0x1bacd9){var _0x3fc56a=this;return new Promise(function(_0x3efe17,_0x1d68e8){_0x46d560[_0x9c94('0x54')](_0x1bacd9)[_0x9c94('0x1a')](function(_0x540373){_0x3efe17({'code':0xc8,'message':_0x540373[_0x9c94('0x1b')]});})[_0x9c94('0x1c')](function(_0x19f93d){_0x1d68e8(_0x3fc56a[_0x9c94('0x13')](0x1f4,_0x19f93d[_0x9c94('0x1b')]));});});}};var _0x567b56=jayson[_0x9c94('0x55')](_0xf373e)['http']();_0x567b56['on'](_0x9c94('0x13'),function(_0x1278dc){return _0x57fcd7(_0x1278dc);});_0x567b56['listen'](0x232a,'127.0.0.1',function(){console[_0x9c94('0x56')](_0x9c94('0x57'),0x232a);return _0x1357ac(_0x9c94('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 98c345b..95f8208 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 _0x9afd=['util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','$or','map','routeId','calleridnum','destcalleridnum','firstName','lastName','phone','scheduledAt','updatedAt','resolve','then','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','calleridname','Unknown','format','user:%s','name','trigger:%s','action','toLowerCase','merge','bluebird'];(function(_0x50beb7,_0x3d4506){var _0x310058=function(_0x345851){while(--_0x345851){_0x50beb7['push'](_0x50beb7['shift']());}};_0x310058(++_0x3d4506);}(_0x9afd,0x11c));var _0xd9af=function(_0x18f64a,_0x1c8248){_0x18f64a=_0x18f64a-0x0;var _0x44687f=_0x9afd[_0x18f64a];return _0x44687f;};'use strict';var _=require('lodash');var BPromise=require(_0xd9af('0x0'));var Redis=require('ioredis');var util=require(_0xd9af('0x1'));var config=require(_0xd9af('0x2'));var logger=require(_0xd9af('0x3'))(_0xd9af('0x4'));var cmContactRpc=require(_0xd9af('0x5'));config[_0xd9af('0x6')]=_[_0xd9af('0x7')](config[_0xd9af('0x6')],{'host':_0xd9af('0x8'),'port':0x18eb});var io=require(_0xd9af('0x9'))(new Redis(config[_0xd9af('0x6')]));function emit(_0x221699,_0x250b37,_0x5e7fae,_0x5038cd,_0x39a9c6){logger[_0xd9af('0xa')](_0xd9af('0xb'),_0x221699,_0x250b37['id'],_0x5e7fae,_0x5038cd,JSON[_0xd9af('0xc')](_0x39a9c6));io['to'](_0x5e7fae)['emit'](_0x5038cd,_0x39a9c6);}exports[_0xd9af('0xd')]=function(_0x129d0b,_0x54d0c3,_0x5e6dae,_0x48db07){var _0x37f978,_0x32c219;var _0x7b15a={};var _0x21702d;var _0x21746e=Number(_0x5e6dae[_0xd9af('0xe')]);var _0xf8ff1b=_0x5e6dae[_0xd9af('0xf')]?Boolean(Number(_0x5e6dae['data2'])):![];var _0x50a63b;var _0x2ab4f2=![];if(!_[_0xd9af('0x10')](_0x5e6dae[_0xd9af('0x11')])){if(_0x5e6dae[_0xd9af('0x11')]=='1')_0x2ab4f2=!![];}if(!_0x2ab4f2){if(_0x48db07[_0xd9af('0x12')]){_0x7b15a['id']=_0x48db07[_0xd9af('0x12')];}}if(!_0x7b15a['id']){_0x7b15a[_0xd9af('0x13')]=_0x21746e;_0x50a63b=_0x5e6dae[_0xd9af('0x14')]&&_0x5e6dae[_0xd9af('0x14')]!=='0'?_0x5e6dae['data3'][_0xd9af('0x15')](','):['phone'];_0x7b15a[_0xd9af('0x16')]=_[_0xd9af('0x17')](_0x50a63b,function(_0x22a7be){var _0x534c31={};_0x534c31[_0x22a7be]=_0x48db07[_0xd9af('0x18')]?_0x48db07['destcalleridnum']:_0x48db07[_0xd9af('0x19')];return _0x534c31;});_0x21702d=_0x48db07['routeId']?_0x48db07[_0xd9af('0x1a')]:_0x48db07[_0xd9af('0x19')];}var _0x49eeb7=['id',_0xd9af('0x1b'),_0xd9af('0x1c'),_0xd9af('0x1d'),'mobile','fax',_0xd9af('0x13'),'createdAt',_0xd9af('0x1e'),_0xd9af('0x1f')];var _0x3a134d=_['union'](_0x49eeb7,_0x50a63b);BPromise[_0xd9af('0x20')]()[_0xd9af('0x21')](cmContactRpc['getContacts']({'attributes':_0x3a134d,'where':_0x7b15a,'phone':_0x21702d}))[_0xd9af('0x21')](function(_0x35dbae){_0x32c219=_0x35dbae;if(!_['isEmpty'](_0x32c219)){if(_0x32c219[_0xd9af('0x22')]===0x1){_0x37f978=_0x32c219[0x0];logger[_0xd9af('0xa')](_0xd9af('0x23'),_0x48db07[_0xd9af('0x24')],_0x54d0c3['id'],_0x37f978['id']);}else{logger[_0xd9af('0xa')](_0xd9af('0x25'),_0x48db07['uniqueid'],_0x54d0c3['id'],_['map'](_0x32c219,'id')[_0xd9af('0x26')](','));}return;}else{logger[_0xd9af('0xa')](_0xd9af('0x27'),_0x48db07[_0xd9af('0x24')],_0x54d0c3['id']);var _0x503392={'ListId':_0x21746e};var _0x3ab5e9=_0x5e6dae[_0xd9af('0x28')]&&_0x5e6dae[_0xd9af('0x28')]!=='0'?_0x5e6dae[_0xd9af('0x28')]:'phone';if(_0xf8ff1b){logger[_0xd9af('0xa')](_0xd9af('0x29'),_0x48db07[_0xd9af('0x24')],_0x54d0c3['id']);_0x503392[_0x3ab5e9]=_[_0xd9af('0x10')](_0x48db07[_0xd9af('0x18')])?_0x48db07[_0xd9af('0x19')]:_0x48db07[_0xd9af('0x1a')];if(_['isNil'](_0x48db07[_0xd9af('0x18')])){_0x503392[_0xd9af('0x1b')]=_0x48db07['calleridname']&&_0x48db07['calleridname']!==_0xd9af('0x2a')?_0x48db07['calleridname']:'Unknown';}else{_0x503392[_0xd9af('0x1b')]=_0x48db07[_0xd9af('0x2b')]&&_0x48db07[_0xd9af('0x2b')]!==_0xd9af('0x2a')?_0x48db07['destcalleridname']:'Unknown';}return BPromise['resolve']()[_0xd9af('0x21')](cmContactRpc[_0xd9af('0x2c')](_0x503392))[_0xd9af('0x21')](function(_0x452852){_0x37f978=_0x452852;_0x32c219[_0xd9af('0x2d')](_0x452852);if(_0x37f978){logger['info'](_0xd9af('0x2e'),_0x48db07[_0xd9af('0x24')],_0x54d0c3['id'],_0x37f978['id']);}return;});}else{logger[_0xd9af('0xa')](_0xd9af('0x2f'),_0x48db07['uniqueid'],_0x54d0c3['id']);_0x503392[_0x3ab5e9]=_[_0xd9af('0x10')](_0x48db07[_0xd9af('0x18')])?_0x48db07[_0xd9af('0x19')]:_0x48db07['destcalleridnum'];if(_[_0xd9af('0x10')](_0x48db07['routeId'])){_0x503392[_0xd9af('0x1b')]=_0x48db07[_0xd9af('0x30')]&&_0x48db07[_0xd9af('0x30')]!==''?_0x48db07[_0xd9af('0x30')]:_0xd9af('0x31');}else{_0x503392[_0xd9af('0x1b')]=_0x48db07['destcalleridname']&&_0x48db07[_0xd9af('0x2b')]!==_0xd9af('0x2a')?_0x48db07[_0xd9af('0x2b')]:_0xd9af('0x31');}_0x37f978=_0x503392;_0x32c219['push'](_0x503392);return;}}})[_0xd9af('0x21')](function(){if(_0x129d0b){emit(_0x48db07[_0xd9af('0x24')],_0x54d0c3,util[_0xd9af('0x32')](_0xd9af('0x33'),_0x129d0b[_0xd9af('0x34')]),util[_0xd9af('0x32')](_0xd9af('0x35'),_0x5e6dae[_0xd9af('0x36')][_0xd9af('0x37')]()),{'evt':_[_0xd9af('0x38')](_0x48db07,{'autoCreate':_0xf8ff1b}),'contact':_0x37f978===undefined?{}:_0x37f978,'contacts':_0x32c219[_0xd9af('0x22')]===0x0?undefined:_0x32c219});}});}; \ No newline at end of file +var _0x90af=['trigger','../../rpc/cmContact','defaults','socket.io-emitter','redis','info','[CM][%s][%s]','emit','exec','data1','data2','data5','xmd-contactid','data3','split','phone','$or','map','destcalleridnum','routeId','calleridnum','firstName','mobile','fax','ListId','createdAt','updatedAt','union','resolve','getContacts','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','name','format','trigger:%s','merge','lodash','bluebird','ioredis','util','../../../../config/environment'];(function(_0x318840,_0x561b1e){var _0x223da4=function(_0x510071){while(--_0x510071){_0x318840['push'](_0x318840['shift']());}};_0x223da4(++_0x561b1e);}(_0x90af,0x157));var _0xf90a=function(_0x21c092,_0x39e508){_0x21c092=_0x21c092-0x0;var _0x87594f=_0x90af[_0x21c092];return _0x87594f;};'use strict';var _=require(_0xf90a('0x0'));var BPromise=require(_0xf90a('0x1'));var Redis=require(_0xf90a('0x2'));var util=require(_0xf90a('0x3'));var config=require(_0xf90a('0x4'));var logger=require('../../../../config/logger')(_0xf90a('0x5'));var cmContactRpc=require(_0xf90a('0x6'));config['redis']=_[_0xf90a('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xf90a('0x8'))(new Redis(config[_0xf90a('0x9')]));function emit(_0x2ba4a4,_0x58a14c,_0x5f2b02,_0x222a3f,_0x414795){logger[_0xf90a('0xa')](_0xf90a('0xb'),_0x2ba4a4,_0x58a14c['id'],_0x5f2b02,_0x222a3f,JSON['stringify'](_0x414795));io['to'](_0x5f2b02)[_0xf90a('0xc')](_0x222a3f,_0x414795);}exports[_0xf90a('0xd')]=function(_0xdb08d2,_0x4b59ef,_0x4182f3,_0x2eb4fb){var _0x584162,_0xae4d94;var _0x1f4718={};var _0x7b02b7;var _0x3b4ab1=Number(_0x4182f3[_0xf90a('0xe')]);var _0x433432=_0x4182f3[_0xf90a('0xf')]?Boolean(Number(_0x4182f3[_0xf90a('0xf')])):![];var _0x4f0d8b;var _0x4baa6d=![];if(!_['isNil'](_0x4182f3[_0xf90a('0x10')])){if(_0x4182f3[_0xf90a('0x10')]=='1')_0x4baa6d=!![];}if(!_0x4baa6d){if(_0x2eb4fb[_0xf90a('0x11')]){_0x1f4718['id']=_0x2eb4fb['xmd-contactid'];}}if(!_0x1f4718['id']){_0x1f4718['ListId']=_0x3b4ab1;_0x4f0d8b=_0x4182f3['data3']&&_0x4182f3[_0xf90a('0x12')]!=='0'?_0x4182f3[_0xf90a('0x12')][_0xf90a('0x13')](','):[_0xf90a('0x14')];_0x1f4718[_0xf90a('0x15')]=_[_0xf90a('0x16')](_0x4f0d8b,function(_0x553109){var _0x7b70b0={};_0x7b70b0[_0x553109]=_0x2eb4fb['routeId']?_0x2eb4fb[_0xf90a('0x17')]:_0x2eb4fb['calleridnum'];return _0x7b70b0;});_0x7b02b7=_0x2eb4fb[_0xf90a('0x18')]?_0x2eb4fb[_0xf90a('0x17')]:_0x2eb4fb[_0xf90a('0x19')];}var _0x23d811=['id',_0xf90a('0x1a'),'lastName',_0xf90a('0x14'),_0xf90a('0x1b'),_0xf90a('0x1c'),_0xf90a('0x1d'),_0xf90a('0x1e'),'scheduledAt',_0xf90a('0x1f')];var _0x4d6540=_[_0xf90a('0x20')](_0x23d811,_0x4f0d8b);BPromise[_0xf90a('0x21')]()['then'](cmContactRpc[_0xf90a('0x22')]({'attributes':_0x4d6540,'where':_0x1f4718,'phone':_0x7b02b7}))[_0xf90a('0x23')](function(_0x3d1d83){_0xae4d94=_0x3d1d83;if(!_[_0xf90a('0x24')](_0xae4d94)){if(_0xae4d94[_0xf90a('0x25')]===0x1){_0x584162=_0xae4d94[0x0];logger['info'](_0xf90a('0x26'),_0x2eb4fb[_0xf90a('0x27')],_0x4b59ef['id'],_0x584162['id']);}else{logger[_0xf90a('0xa')](_0xf90a('0x28'),_0x2eb4fb[_0xf90a('0x27')],_0x4b59ef['id'],_['map'](_0xae4d94,'id')[_0xf90a('0x29')](','));}return;}else{logger[_0xf90a('0xa')](_0xf90a('0x2a'),_0x2eb4fb['uniqueid'],_0x4b59ef['id']);var _0x55b1de={'ListId':_0x3b4ab1};var _0x25da58=_0x4182f3['data4']&&_0x4182f3[_0xf90a('0x2b')]!=='0'?_0x4182f3[_0xf90a('0x2b')]:'phone';if(_0x433432){logger['info'](_0xf90a('0x2c'),_0x2eb4fb[_0xf90a('0x27')],_0x4b59ef['id']);_0x55b1de[_0x25da58]=_[_0xf90a('0x2d')](_0x2eb4fb['routeId'])?_0x2eb4fb[_0xf90a('0x19')]:_0x2eb4fb[_0xf90a('0x17')];if(_[_0xf90a('0x2d')](_0x2eb4fb[_0xf90a('0x18')])){_0x55b1de['firstName']=_0x2eb4fb[_0xf90a('0x2e')]&&_0x2eb4fb['calleridname']!==_0xf90a('0x2f')?_0x2eb4fb[_0xf90a('0x2e')]:_0xf90a('0x30');}else{_0x55b1de[_0xf90a('0x1a')]=_0x2eb4fb[_0xf90a('0x31')]&&_0x2eb4fb[_0xf90a('0x31')]!==_0xf90a('0x2f')?_0x2eb4fb['destcalleridname']:_0xf90a('0x30');}return BPromise['resolve']()[_0xf90a('0x23')](cmContactRpc[_0xf90a('0x32')](_0x55b1de))[_0xf90a('0x23')](function(_0x1cb462){_0x584162=_0x1cb462;_0xae4d94[_0xf90a('0x33')](_0x1cb462);if(_0x584162){logger[_0xf90a('0xa')](_0xf90a('0x34'),_0x2eb4fb[_0xf90a('0x27')],_0x4b59ef['id'],_0x584162['id']);}return;});}else{logger['info'](_0xf90a('0x35'),_0x2eb4fb[_0xf90a('0x27')],_0x4b59ef['id']);_0x55b1de[_0x25da58]=_[_0xf90a('0x2d')](_0x2eb4fb[_0xf90a('0x18')])?_0x2eb4fb[_0xf90a('0x19')]:_0x2eb4fb[_0xf90a('0x17')];if(_[_0xf90a('0x2d')](_0x2eb4fb[_0xf90a('0x18')])){_0x55b1de[_0xf90a('0x1a')]=_0x2eb4fb[_0xf90a('0x2e')]&&_0x2eb4fb[_0xf90a('0x2e')]!==_0xf90a('0x2f')?_0x2eb4fb[_0xf90a('0x2e')]:_0xf90a('0x30');}else{_0x55b1de[_0xf90a('0x1a')]=_0x2eb4fb[_0xf90a('0x31')]&&_0x2eb4fb[_0xf90a('0x31')]!==_0xf90a('0x2f')?_0x2eb4fb[_0xf90a('0x31')]:_0xf90a('0x30');}_0x584162=_0x55b1de;_0xae4d94['push'](_0x55b1de);return;}}})[_0xf90a('0x23')](function(){if(_0xdb08d2){emit(_0x2eb4fb[_0xf90a('0x27')],_0x4b59ef,util['format']('user:%s',_0xdb08d2[_0xf90a('0x36')]),util[_0xf90a('0x37')](_0xf90a('0x38'),_0x4182f3['action']['toLowerCase']()),{'evt':_[_0xf90a('0x39')](_0x2eb4fb,{'autoCreate':_0x433432}),'contact':_0x584162===undefined?{}:_0x584162,'contacts':_0xae4d94[_0xf90a('0x25')]===0x0?undefined:_0xae4d94});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index eed0f7d..7f3d619 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 _0x4ccc=['templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','custom:agentringnoanswer','bind','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialend','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','emit','stringify','prototype','clone','motionChannel','undefined','voice','debug','inspect','checkTriggers','interface','triggers','hasOwnProperty','status','checkTrigger','merge','variables','Actions','length','action','toLowerCase','motionbar','browser','TemplateId','data2','render','html','buildUri','isNil','data3','data4','uriLocation','windowWidth','data5','800','windowHeight','data6','winApplication','winArguments','user:%s','name','format','data1','jscripty','trigger:%s','contactmanager','integration','exec','queue','routeId','urlforward','script','query','search','AllConditions','checkConditions','channel','some','AnyConditions','evt','account','chat','ChatWebsiteId','upperFirst','AccountId','value','message','operator','event','membername','lastevent','mailSubstatus','substatus','offlineMessage','created','equals','exports','lodash','url','mustache','ioredis','./urlforward','./integration','./script','../../../config/environment','trigger','redis','defaults','localhost','socket.io-emitter','popup','winapp','agents','voiceQueues'];(function(_0x4f9227,_0x2d090b){var _0x131f84=function(_0x1bc372){while(--_0x1bc372){_0x4f9227['push'](_0x4f9227['shift']());}};_0x131f84(++_0x2d090b);}(_0x4ccc,0x70));var _0xc4cc=function(_0x42b89a,_0x5842f4){_0x42b89a=_0x42b89a-0x0;var _0x33e70d=_0x4ccc[_0x42b89a];return _0x33e70d;};'use strict';var util=require('util');var _=require(_0xc4cc('0x0'));var url=require(_0xc4cc('0x1'));var Mustache=require(_0xc4cc('0x2'));var Redis=require(_0xc4cc('0x3'));var urlforward=require(_0xc4cc('0x4'));var integration=require(_0xc4cc('0x5'));var cmContact=require('./cmContact');var script=require(_0xc4cc('0x6'));var config=require(_0xc4cc('0x7'));var logger=require('../../../config/logger')(_0xc4cc('0x8'));var ami=require('../ami');config[_0xc4cc('0x9')]=_[_0xc4cc('0xa')](config[_0xc4cc('0x9')],{'host':_0xc4cc('0xb'),'port':0x18eb});var io=require(_0xc4cc('0xc'))(new Redis(config[_0xc4cc('0x9')]));var operators={'equals':function(_0x59a31f,_0x272692){return _0x59a31f==_0x272692;},'not_equals':function(_0x45b77f,_0xf6bd07){return _0x45b77f!=_0xf6bd07;}};var barAndWebActions=[_0xc4cc('0xd'),_0xc4cc('0x1'),_0xc4cc('0xe')];function Trigger(_0x27c4d8){this['triggers']=_0x27c4d8['triggers'];this[_0xc4cc('0xf')]=_0x27c4d8[_0xc4cc('0xf')];this[_0xc4cc('0x10')]=_0x27c4d8[_0xc4cc('0x10')];this[_0xc4cc('0x11')]=_0x27c4d8[_0xc4cc('0x11')];this[_0xc4cc('0x12')]=_0x27c4d8[_0xc4cc('0x12')];this[_0xc4cc('0x13')]=_0x27c4d8[_0xc4cc('0x13')];this[_0xc4cc('0x14')]=_0x27c4d8[_0xc4cc('0x14')];this[_0xc4cc('0x15')]=_0x27c4d8['salesforceAccounts'];this[_0xc4cc('0x16')]=_0x27c4d8[_0xc4cc('0x16')];this[_0xc4cc('0x17')]=_0x27c4d8[_0xc4cc('0x17')];this[_0xc4cc('0x18')]=_0x27c4d8[_0xc4cc('0x18')];this['vtigerAccounts']=_0x27c4d8[_0xc4cc('0x19')];this[_0xc4cc('0x1a')]=_0x27c4d8[_0xc4cc('0x1a')];this[_0xc4cc('0x1b')]=_0x27c4d8[_0xc4cc('0x1b')];this[_0xc4cc('0x1c')]=_0x27c4d8[_0xc4cc('0x1c')];this[_0xc4cc('0x1d')]={'zendesk':this[_0xc4cc('0x13')],'salesforce':this[_0xc4cc('0x15')],'freshdesk':this[_0xc4cc('0x14')],'sugarcrm':this[_0xc4cc('0x16')],'zoho':this[_0xc4cc('0x17')],'desk':this[_0xc4cc('0x18')],'vtiger':this[_0xc4cc('0x19')],'dynamics365':this[_0xc4cc('0x1b')],'freshsales':this[_0xc4cc('0x1c')],'servicenow':this[_0xc4cc('0x1a')]};ami['on'](_0xc4cc('0x1e'),this['syncCustomEvent']['bind'](this));ami['on']('custom:agentconnect',this[_0xc4cc('0x1f')]['bind'](this));ami['on'](_0xc4cc('0x20'),this[_0xc4cc('0x1f')][_0xc4cc('0x21')](this));ami['on'](_0xc4cc('0x22'),this['syncCustomEvent']['bind'](this));ami['on'](_0xc4cc('0x23'),this[_0xc4cc('0x1f')][_0xc4cc('0x21')](this));ami['on'](_0xc4cc('0x24'),this[_0xc4cc('0x1f')][_0xc4cc('0x21')](this));ami['on'](_0xc4cc('0x25'),this[_0xc4cc('0x1f')]['bind'](this));ami['on'](_0xc4cc('0x26'),this[_0xc4cc('0x1f')]['bind'](this));ami['on'](_0xc4cc('0x27'),this[_0xc4cc('0x1f')]['bind'](this));ami['on'](_0xc4cc('0x28'),this[_0xc4cc('0x1f')][_0xc4cc('0x21')](this));ami['on'](_0xc4cc('0x29'),this['syncCustomEvent'][_0xc4cc('0x21')](this));ami['on'](_0xc4cc('0x2a'),this['syncCustomEvent'][_0xc4cc('0x21')](this));ami['on'](_0xc4cc('0x2b'),this['syncAgentDial'][_0xc4cc('0x21')](this));ami['on']('custom:dialconnect',this[_0xc4cc('0x2c')]['bind'](this));ami['on'](_0xc4cc('0x2d'),this[_0xc4cc('0x2c')][_0xc4cc('0x21')](this));ami['on']('custom:newinteraction',this[_0xc4cc('0x1f')][_0xc4cc('0x21')](this));ami['on'](_0xc4cc('0x2e'),this[_0xc4cc('0x1f')][_0xc4cc('0x21')](this));ami['on']('custom:substatus',this[_0xc4cc('0x1f')][_0xc4cc('0x21')](this));ami['on'](_0xc4cc('0x2f'),this[_0xc4cc('0x1f')][_0xc4cc('0x21')](this));ami['on'](_0xc4cc('0x30'),this[_0xc4cc('0x1f')][_0xc4cc('0x21')](this));ami['on'](_0xc4cc('0x31'),this[_0xc4cc('0x1f')][_0xc4cc('0x21')](this));ami['on'](_0xc4cc('0x32'),this[_0xc4cc('0x1f')][_0xc4cc('0x21')](this));ami['on'](_0xc4cc('0x33'),this[_0xc4cc('0x1f')][_0xc4cc('0x21')](this));}Trigger['prototype'][_0xc4cc('0x34')]=function(_0x19a46d,_0x5a20fc,_0x37e14d){logger['info'](_0x19a46d,_0x5a20fc,JSON[_0xc4cc('0x35')](_0x37e14d));io['to'](_0x19a46d)[_0xc4cc('0x34')](_0x5a20fc,_0x37e14d);};Trigger[_0xc4cc('0x36')][_0xc4cc('0x1f')]=function(_0x17493c){var _0x527eac=_[_0xc4cc('0x37')](_0x17493c);if(typeof _0x527eac[_0xc4cc('0x38')]===_0xc4cc('0x39')){_0x527eac[_0xc4cc('0x38')]=_0xc4cc('0x3a');}logger[_0xc4cc('0x3b')](_0xc4cc('0x1f'),util[_0xc4cc('0x3c')](_0x527eac,{'showHidden':!![],'depth':null}));this[_0xc4cc('0x3d')](_0x527eac);};Trigger['prototype'][_0xc4cc('0x2c')]=function(_0xd76076){if(this[_0xc4cc('0xf')][_0xd76076[_0xc4cc('0x3e')]]){this[_0xc4cc('0x1f')](_0xd76076);}};Trigger[_0xc4cc('0x36')][_0xc4cc('0x3d')]=function(_0x54463e){var _0x493275;for(var _0x2f85c2 in this[_0xc4cc('0x3f')]){if(this[_0xc4cc('0x3f')][_0xc4cc('0x40')](_0x2f85c2)){if(this[_0xc4cc('0x3f')][_0x2f85c2][_0xc4cc('0x41')]){_0x493275=this[_0xc4cc('0x42')](this[_0xc4cc('0x3f')][_0x2f85c2],_0x54463e);if(_0x493275){_[_0xc4cc('0x43')](_0x54463e,_0x54463e[_0xc4cc('0x44')]);for(var _0x7415be=0x0,_0x2a151b,_0x2b3d1a,_0x2d543a;_0x7415be0x0){_0x57001c=_[_0x35fc('0x26')](_0x274208,_0x1a5d92);}return _0x57001c;}function getCustomFields(_0x383837,_0x9f3c8a){var _0x3735da=[];var _0x134dfa={'custom_fields':{}};if(_0x383837[_0x35fc('0x25')]>0x0){_[_0x35fc('0x27')](_0x383837,function(_0x54aedc){if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc['type'])&&_0x54aedc[_0x35fc('0x2b')]&&!_0x54aedc[_0x35fc('0x2c')]){_0x134dfa[_0x54aedc[_0x35fc('0x2b')][_0x35fc('0x2d')]()]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc[_0x35fc('0x2f')])&&_0x54aedc['idField']&&_0x54aedc['customField']){_0x134dfa[_0x35fc('0x30')][_0x54aedc['idField']]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_0x54aedc[_0x35fc('0x2f')]===_0x35fc('0x31')&&_0x54aedc[_0x35fc('0x32')]&&_0x54aedc[_0x35fc('0x33')]&&_0x54aedc['customField']){_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]][_0x35fc('0x1e')]());}else if(_0x54aedc[_0x35fc('0x2f')]==='customVariable'&&_0x54aedc[_0x35fc('0x34')]&&_0x54aedc[_0x35fc('0x34')][_0x35fc('0x35')]&&_0x54aedc['idField']&&_0x54aedc[_0x35fc('0x2c')]){_0x9f3c8a[_0x54aedc['Variable'][_0x35fc('0x35')][_0x35fc('0x2d')]()]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc['Variable']['name']['toLowerCase']()][_0x35fc('0x1e')]());}});}if(_0x134dfa['priority']){_0x134dfa[_0x35fc('0x36')]=Number(_0x134dfa['priority']);}return _0x134dfa;}function getTicket(_0x9c6b65,_0x1f2d66,_0x2ca9ac,_0x22b724,_0x1c10e0){logger[_0x35fc('0xb')](_0x35fc('0x37'));var _0x4ec0dc=_[_0x35fc('0x38')]({'subject':intUtil[_0x35fc('0x39')](_0x22b724['Subjects'],_0x1c10e0,'\x20'),'type':_0x35fc('0x3a'),'status':_0x35fc('0x3b'),'labels':[_0x35fc('0x3c'),_0x35fc('0x3d'),_0x35fc('0x3e')][_0x35fc('0x3f')](getTags(_0x22b724['Tags'],_0x35fc('0x35'))),'description':intUtil[_0x35fc('0x39')](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0x35fc('0x41'),_0x1f2d66['id']),'class':_0x35fc('0x42')}},'message':{'direction':'in','body':intUtil['getString'](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a')}},getCustomFields(_0x22b724[_0x35fc('0x43')],_0x1c10e0));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x44'),_0x9c6b65[_0x35fc('0xe')],_0x2ca9ac['id']),'method':_0x35fc('0x24'),'body':_0x4ec0dc});}exports[_0x35fc('0x45')]=function(_0x3ec51f,_0x5a7e9e,_0x596e83,_0x210d5d,_0x36fcf9,_0x4fdc6d){var _0x5c2e5c,_0x4ff202;_0x4fdc6d[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x4fdc6d['remoteUri']);_0x4fdc6d[_0x35fc('0x47')]=intUtil[_0x35fc('0x46')](_0x4fdc6d[_0x35fc('0x47')]);if(_0x36fcf9&&_0x36fcf9[_0x35fc('0x48')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5a7e9e['recordingURL']=util['format'](_0x35fc('0x49'),_0x4fdc6d[_0x35fc('0x47')],_0x5a7e9e['uniqueid'],md5(_0x5a7e9e[_0x35fc('0x4a')]));}else{_0x5a7e9e['recordingURL']='';}headers[_0x35fc('0x4b')]=getAuth(_0x4fdc6d);return getUser(_0x4fdc6d,_0x210d5d[_0x35fc('0x4c')])[_0x35fc('0x21')](function(_0x2de5d1){_0x5c2e5c=_0x2de5d1;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x5c2e5c['id']);return getEndUser(_0x4fdc6d,_0x5a7e9e[_0x35fc('0x4d')],_0x5a7e9e[_0x35fc('0x4e')]);})['then'](function(_0x18181b){_0x4ff202=_0x18181b;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x4ff202['id']);return getTicket(_0x4fdc6d,_0x5c2e5c,_0x4ff202,_0x596e83,_0x5a7e9e);})[_0x35fc('0x21')](function(_0x5bc8c3){if(_0x5bc8c3){logger[_0x35fc('0xb')]('Ticket\x20created!');logger['info'](_0x35fc('0x50'),_0x5bc8c3['id']);switch(_0x4fdc6d[_0x35fc('0x2f')]){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x53'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d['name']),_0x35fc('0x55'),{'recordId':_0x5bc8c3['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d[_0x35fc('0x35')]),_0x35fc('0x58'),{'uri':util[_0x35fc('0x14')](_0x35fc('0x59'),_0x5bc8c3['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x52'),_0x35fc('0x5b'));}}})['catch'](function(_0x553ed6){console[_0x35fc('0x5a')](_0x553ed6);logger[_0x35fc('0x5a')](_0x35fc('0x52'),JSON[_0x35fc('0x17')](_0x553ed6));});};exports[_0x35fc('0x5c')]=function(_0x3e6494,_0x4a4798,_0x4f024c,_0x388521,_0x19b2ce,_0x395d63,_0x38bc78){var _0x5b2595,_0x467980;_0x395d63[_0x35fc('0xe')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0xe')]);_0x395d63[_0x35fc('0x47')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0x47')]);if(_0x38bc78&&_0x38bc78[_0x35fc('0x5d')]&&_0x38bc78[_0x35fc('0x5d')]!==_0x35fc('0x5e')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4a4798[_0x35fc('0x5f')]=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x395d63[_0x35fc('0x47')],_0x4a4798[_0x35fc('0x4a')],md5(_0x4a4798[_0x35fc('0x4a')]));}headers[_0x35fc('0x4b')]=getAuth(_0x395d63);return getUser(_0x395d63,_0x388521[_0x35fc('0x4c')])['then'](function(_0x2d9d45){_0x5b2595=_0x2d9d45;logger[_0x35fc('0xb')](_0x35fc('0x60'),_0x5b2595['id']);return getEndUser(_0x395d63,_0x4a4798['destcalleridname'],_0x4a4798[_0x35fc('0x61')]);})[_0x35fc('0x21')](function(_0x47fb1a){_0x467980=_0x47fb1a;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x467980['id']);return getTicket(_0x395d63,_0x5b2595,_0x467980,_0x4f024c,_0x4a4798);})[_0x35fc('0x21')](function(_0x1c4c33){if(_0x1c4c33){logger[_0x35fc('0xb')](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x1c4c33['id']);switch(_0x395d63['type']){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:desk:display',{'recordId':_0x1c4c33['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x395d63[_0x35fc('0xe')],_0x1c4c33['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x63'),_0x35fc('0x5b'));}}})['catch'](function(_0x458eb8){logger[_0x35fc('0x5a')](_0x35fc('0x63'),JSON[_0x35fc('0x17')](_0x458eb8));});};exports[_0x35fc('0x64')]=function(_0x1d0e53,_0x27071b,_0x2127e0,_0x462ceb,_0x4c3ace,_0x35d7c8){var _0x47c75f,_0xfbd737;_0x35d7c8[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x35d7c8[_0x35fc('0xe')]);_0x35d7c8['serverUrl']=intUtil[_0x35fc('0x46')](_0x35d7c8['serverUrl']);if(_0x4c3ace&&_0x4c3ace['monitor_format']){logger['info']('['+_0x27071b[_0x35fc('0x65')]['toUpperCase']()+']',_0x35fc('0x66'));_0x27071b['recordingURL']=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35d7c8[_0x35fc('0x47')],_0x27071b[_0x35fc('0x4a')],md5(_0x27071b[_0x35fc('0x4a')]));}else{_0x27071b[_0x35fc('0x5f')]='';}headers['Authorization']=getAuth(_0x35d7c8);return getUser(_0x35d7c8)[_0x35fc('0x21')](function(_0x1e2214){_0x47c75f=_0x1e2214;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x47c75f['id']);return getEndUser(_0x35d7c8,_0x27071b[_0x35fc('0x4d')],_0x27071b[_0x35fc('0x4e')]);})[_0x35fc('0x21')](function(_0x3c1b56){_0xfbd737=_0x3c1b56;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0xfbd737['id']);return getTicket(_0x35d7c8,_0x47c75f,_0xfbd737,_0x2127e0,_0x27071b);})[_0x35fc('0x21')](function(_0x4464d5){if(_0x4464d5){logger['info'](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x4464d5['id']);}})['catch'](function(_0x1c88d8){logger[_0x35fc('0x5a')]('['+_0x27071b['lastevent']['toUpperCase']()+']',JSON[_0x35fc('0x17')](_0x1c88d8));});}; \ No newline at end of file +var _0x9957=['Motion','CTI','concat','Tags','/api/v2/users/%d','Descriptions','%s/customers/%d/cases','serverUrl','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','Desk\x20account\x20type\x20not\x20recognized','error','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','integrationTab','newTab','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','The\x20Ticket\x20ID\x20is:','toUpperCase','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','desk','defaults','redis','localhost','socket.io-emitter','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','remoteUri','then','total_entries','find','_embedded','entries','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','[HTTP]','stringify','GET','password','authType','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','map','includes','string','picklist','type','nameField','customField','content','idField','custom_fields','variable','variableName','customVariable','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','xCALLY'];(function(_0x1d7d82,_0x1009ad){var _0x33c236=function(_0x144f89){while(--_0x144f89){_0x1d7d82['push'](_0x1d7d82['shift']());}};_0x33c236(++_0x1009ad);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var rp=require(_0x7995('0x1'));var md5=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var Redis=require('ioredis');var intUtil=require(_0x7995('0x4'));var config=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));config['redis']=_[_0x7995('0x8')](config[_0x7995('0x9')],{'host':_0x7995('0xa'),'port':0x18eb});var io=require(_0x7995('0xb'))(new Redis(config[_0x7995('0x9')]));function emit(_0x326741,_0x4996ca,_0x465276){io['to'](_0x326741)[_0x7995('0xc')](_0x4996ca,_0x465276);}var headers={'Content-Type':'application/json','Accept':_0x7995('0xd')};function getUser(_0x3116fb,_0x18c8a3){if(intUtil[_0x7995('0xe')](_0x18c8a3)===!![]){logger[_0x7995('0xf')](_0x7995('0x10'),_0x18c8a3);return request({'uri':util[_0x7995('0x11')]('%s/users',_0x3116fb[_0x7995('0x12')])})[_0x7995('0x13')](function(_0x581f22){if(_0x581f22[_0x7995('0x14')]){return _[_0x7995('0x15')](_0x581f22[_0x7995('0x16')][_0x7995('0x17')],{'email':_0x18c8a3});}})[_0x7995('0x13')](function(_0x23999f){if(_0x23999f){logger[_0x7995('0xf')]('Agent\x20found!');return _0x23999f;}else{logger['info'](_0x7995('0x18'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb[_0x7995('0x12')])});}});}else{logger[_0x7995('0xf')](_0x7995('0x1a'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb['remoteUri'])});}}function request(_0x2eeacc){logger['debug'](_0x7995('0x1b'),JSON[_0x7995('0x1c')](_0x2eeacc));return rp(_[_0x7995('0x8')](_0x2eeacc,{'method':_0x7995('0x1d'),'headers':headers,'json':!![]}));}function getAuth(_0x1e1415){var _0x37a7d4;if(_0x1e1415['authType']==='basic'){_0x37a7d4=util[_0x7995('0x11')]('%s:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x1e')]);}else if(_0x1e1415[_0x7995('0x1f')]==='token'){_0x37a7d4=util[_0x7995('0x11')]('%s/token:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x20')]);}return util[_0x7995('0x11')](_0x7995('0x21'),new Buffer(_0x37a7d4)[_0x7995('0x22')](_0x7995('0x23')));}function getEndUser(_0x1c278a,_0x5d40ae,_0x32a09a){logger[_0x7995('0xf')](_0x7995('0x24'),_0x32a09a);return request({'uri':util[_0x7995('0x11')](_0x7995('0x25'),_0x1c278a[_0x7995('0x12')]),'qs':{'phone':_0x32a09a}})[_0x7995('0x13')](function(_0x472195){if(_0x472195['total_entries']){logger[_0x7995('0xf')](_0x7995('0x26'));return _0x472195[_0x7995('0x16')][_0x7995('0x17')][0x0];}else{logger[_0x7995('0xf')](_0x7995('0x27'));return request({'uri':util['format'](_0x7995('0x28'),_0x1c278a['remoteUri']),'method':_0x7995('0x29'),'body':{'first_name':_0x5d40ae,'title':_0x5d40ae,'phone_numbers':[{'type':_0x7995('0x2a'),'value':_0x32a09a}]}});}});}function getTags(_0xf16cc2,_0x132a42){var _0x11c1eb=[];if(_0xf16cc2&&_0xf16cc2['length']>0x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ 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 5b74f71..a63aaae 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 _0x0618=['password','clientSecret','catch',']\x20Wrong\x20credentials!','then','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','email','userEmail','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','userId','systemuserid','toUpperCase',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','message','toLowerCase','outbound','destcalleridnum','calleridnum','POST','contacts','/systemusers(','headers','odata-entityid','lastIndexOf','telephone1','GET','contacts?$select=','&$filter=','\x20eq\x20\x27','%2b','length','contactid','nothing',']\x20Enduser\x20created!','includes','string','type','nameField','customField','idField','substring','indexOf','content','ticketType','incident','incidents','getString','Subjects','Descriptions','enduserId','/contacts(','Fields','phonecall','queue','callDirection','phonecalls','assign','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','error','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','resolve'];(function(_0x10165c,_0x4e8760){var _0xed735=function(_0x170bd1){while(--_0x170bd1){_0x10165c['push'](_0x10165c['shift']());}};_0xed735(++_0x4e8760);}(_0x0618,0x13e));var _0x8061=function(_0x368202,_0x230c56){_0x368202=_0x368202-0x0;var _0x194e29=_0x0618[_0x368202];return _0x194e29;};'use strict';var _=require(_0x8061('0x0'));var rp=require(_0x8061('0x1'));var util=require('util');var intUtil=require(_0x8061('0x2'));var md5=require(_0x8061('0x3'));var Redis=require(_0x8061('0x4'));var logger=require(_0x8061('0x5'))(_0x8061('0x6'));var config=require(_0x8061('0x7'));config[_0x8061('0x8')]=_['defaults'](config[_0x8061('0x8')],{'host':_0x8061('0x9'),'port':0x18eb});var io=require(_0x8061('0xa'))(new Redis(config[_0x8061('0x8')]));function getAuthToken(_0x3f76a1,_0x313349,_0x332cef){if(_0x3f76a1[_0x8061('0xb')]){_0x3f76a1[_0x8061('0xc')]=_0x3f76a1[_0x8061('0xd')][_0x8061('0xe')];_0x3f76a1[_0x8061('0xf')]=_0x3f76a1[_0x8061('0xd')][_0x8061('0x10')];return Promise[_0x8061('0x11')](_0x3f76a1['CloudProvider']['data5']);}var _0x1f50e6={'method':'POST','uri':_0x313349,'form':{'client_id':_0x3f76a1['clientId'],'resource':_0x3f76a1[_0x8061('0xc')],'username':_0x3f76a1['username'],'password':_0x3f76a1[_0x8061('0x12')],'grant_type':_0x8061('0x12'),'client_secret':_0x3f76a1[_0x8061('0x13')]},'json':!![]};return rp(_0x1f50e6)['then'](function(_0x5ce460){return _0x5ce460['access_token'];})[_0x8061('0x14')](function(_0x45d27c){logger['error']('['+[_0x332cef['toUpperCase']()]+_0x8061('0x15'));return _0x45d27c['message'];});}function getUser(_0x2c184d,_0x567a22,_0x54dd93,_0x22e42f,_0x3d720a,_0x106102){return new Promise(function(_0xaae5d5,_0x26e191){return getAuthToken(_0x567a22,_0x22e42f,_0x106102)[_0x8061('0x16')](function(_0x2f5b6b){var _0x449d33={'method':'GET','uri':_0x3d720a+_0x8061('0x17'),'headers':{'Authorization':_0x8061('0x18')+_0x2f5b6b,'OData-Version':_0x8061('0x19')},'json':!![]};return rp(_0x449d33);})[_0x8061('0x16')](function(_0x5d4b70){var _0x53c6f3=_0x5d4b70['value'];var _0xd53b25=![];var _0x3e3127=null;if(!_['isNil'](_0x54dd93)){if(intUtil['validateEmail'](_0x54dd93[_0x8061('0x1a')])){_0x2c184d[_0x8061('0x1b')]=_0x54dd93[_0x8061('0x1a')];for(_0x3e3127=0x0;_0x3e3127<_0x53c6f3['length'];_0x3e3127++){if(_0x53c6f3[_0x3e3127][_0x8061('0x1c')]===_0x54dd93['email']&&!_0x53c6f3[_0x3e3127][_0x8061('0x1d')]){_0xd53b25=!![];logger[_0x8061('0x1e')]('['+[_0x106102['toUpperCase']()]+_0x8061('0x1f')+_0x53c6f3[_0x3e3127]['systemuserid']+'!');_0x2c184d[_0x8061('0x20')]=_0x53c6f3[_0x3e3127][_0x8061('0x21')];}}}}if(!_0xd53b25){logger['info']('['+[_0x106102[_0x8061('0x22')]()]+_0x8061('0x23'));_0x2c184d[_0x8061('0x1b')]=_0x567a22[_0x8061('0x24')];for(_0x3e3127=0x0;_0x3e3127<_0x53c6f3['length'];_0x3e3127++){if(_0x53c6f3[_0x3e3127][_0x8061('0x1c')]===_0x567a22[_0x8061('0x24')]){_0x2c184d[_0x8061('0x20')]=_0x53c6f3[_0x3e3127][_0x8061('0x21')];}}}_0xaae5d5(_0x2c184d);})[_0x8061('0x14')](function(_0x1d8190){_0x26e191(_0x1d8190[_0x8061('0x25')]);});});}function createEndUser(_0x3e102c,_0x1a1d67,_0x16359e,_0x391551,_0xf87f39,_0x457de6,_0x4255b5){return new Promise(function(_0x432cc1,_0x264e54){return getAuthToken(_0x1a1d67,_0x16359e,_0x457de6)[_0x8061('0x16')](function(_0xfb4e71){var _0x128ba1=_0x457de6[_0x8061('0x26')]()===_0x8061('0x27')?_0xf87f39[_0x8061('0x28')]:_0xf87f39[_0x8061('0x29')];var _0x2a5f08={'method':_0x8061('0x2a'),'uri':_0x391551+_0x8061('0x2b'),'body':{'fullname':_0x128ba1,'firstname':_0x128ba1,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x8061('0x2c')+_0x3e102c[_0x8061('0x20')]+')'},'headers':{'Authorization':_0x8061('0x18')+_0xfb4e71,'OData-Version':_0x8061('0x19')},'json':!![],'resolveWithFullResponse':!![]};_0x2a5f08['body'][_0x4255b5]=_0x128ba1;return rp(_0x2a5f08);})['then'](function(_0x3c78cc){var _0x28df4b=_0x3c78cc[_0x8061('0x2d')][_0x8061('0x2e')];var _0x1b6b58=_0x28df4b['substring'](_0x28df4b[_0x8061('0x2f')]('(')+0x1,_0x28df4b[_0x8061('0x2f')](')'));_0x3e102c['enduserId']=_0x1b6b58;_0x432cc1(_0x3e102c);})[_0x8061('0x14')](function(_0x1e45d8){_0x264e54(_0x1e45d8[_0x8061('0x25')]);});});}function getEndUser(_0x4c5277,_0xf4d5d2,_0x2941de,_0x3fb416,_0x4152fd,_0x541840,_0x1b79ad,_0x3b0b17){var _0xb088b4=_0x541840[_0x8061('0x26')]()===_0x8061('0x27')?_0x4152fd[_0x8061('0x28')]:_0x4152fd[_0x8061('0x29')];return getAuthToken(_0xf4d5d2,_0x2941de,_0x541840)[_0x8061('0x16')](function(_0x870cc1){_0x3b0b17=_0x3b0b17?_0x3b0b17:_0x8061('0x30');var _0x1ba747={'method':_0x8061('0x31'),'uri':_0x3fb416+_0x8061('0x32')+_0x3b0b17+_0x8061('0x33')+_0x3b0b17+_0x8061('0x34')+_0xb088b4['replace']('+',_0x8061('0x35'))+'\x27','headers':{'Authorization':_0x8061('0x18')+_0x870cc1,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1ba747);})[_0x8061('0x16')](function(_0x55c1dc){var _0x917d97=![];if(!_0x55c1dc)return _0x917d97;var _0x5e4a38=_0x55c1dc['value'];for(var _0x50846c=0x0;_0x50846c<_0x5e4a38[_0x8061('0x36')];_0x50846c++){if(_0x5e4a38[_0x50846c][_0x3b0b17]===_0xb088b4){_0x917d97=!![];_0x4c5277['enduserId']=_0x5e4a38[_0x50846c][_0x8061('0x37')];}}return _0x917d97;})['then'](function(_0x24ec2a){if(_0x24ec2a)return _0x4c5277;if(_0x1b79ad===_0x8061('0x38')){logger[_0x8061('0x1e')]('['+[_0x541840[_0x8061('0x22')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x4c5277;}return createEndUser(_0x4c5277,_0xf4d5d2,_0x2941de,_0x3fb416,_0x4152fd,_0x541840,_0x3b0b17)[_0x8061('0x16')](function(_0x5edac3){logger[_0x8061('0x1e')]('['+[_0x541840[_0x8061('0x22')]()]+_0x8061('0x39'),_0x5edac3['enduserId']);return _0x5edac3;});});}function getCustomFields(_0x39707e,_0x43b0e4,_0x373819){var _0x377907={};if(_0x39707e[_0x8061('0x36')]>0x0){_['forEach'](_0x39707e,function(_0x55ef23){if(_[_0x8061('0x3a')]([_0x8061('0x3b'),'picklist'],_0x55ef23[_0x8061('0x3c')])&&_0x55ef23[_0x8061('0x3d')]&&!_0x55ef23[_0x8061('0x3e')]){var _0x525fae=_0x55ef23[_0x8061('0x3f')][_0x8061('0x26')]();var _0x2f2afd=_0x525fae[_0x8061('0x40')](0x0,_0x525fae[_0x8061('0x41')]('_'));var _0x9e523d=_0x525fae[_0x8061('0x40')](_0x525fae['indexOf']('_')+0x1);if(_0x2f2afd===_0x373819){_0x377907[_0x9e523d]=_0x55ef23[_0x8061('0x42')];}}});}return _0x377907;}function getTicket(_0x4ab30a,_0x9b4741,_0x4856da,_0x44da8f,_0x4cf167,_0x386f4d,_0x4869dc){return new Promise(function(_0x309e60,_0x2936fe){var _0x8f7da2;return getAuthToken(_0x9b4741,_0x4856da,_0x4869dc)[_0x8061('0x16')](function(_0x2bbf6c){if(_0x386f4d[_0x8061('0x43')]===_0x8061('0x44')){_0x8f7da2={'method':_0x8061('0x2a'),'uri':_0x44da8f+_0x8061('0x45'),'body':Object['assign']({},{'title':intUtil[_0x8061('0x46')](_0x386f4d[_0x8061('0x47')],_0x4cf167,'\x20'),'description':intUtil[_0x8061('0x46')](_0x386f4d[_0x8061('0x48')],_0x4cf167,'\x0a'),'customerid_contact@odata.bind':_0x4ab30a[_0x8061('0x49')]?_0x8061('0x4a')+_0x4ab30a['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x4ab30a[_0x8061('0x20')]+')','caseorigincode':'1'},getCustomFields(_0x386f4d[_0x8061('0x4b')],_0x4cf167,_0x386f4d['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x2bbf6c,'OData-Version':_0x8061('0x19')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x386f4d[_0x8061('0x43')]===_0x8061('0x4c')){var _0x1285e9=_0x4ab30a[_0x8061('0x49')]?[{'partyid_systemuser@odata.bind':_0x8061('0x2c')+_0x4ab30a[_0x8061('0x20')]+')','participationtypemask':_0x4ab30a['callDirection']===_0x8061('0x4d')?0x2:0x1},{'partyid_contact@odata.bind':_0x8061('0x4a')+_0x4ab30a[_0x8061('0x49')]+')','participationtypemask':_0x4ab30a[_0x8061('0x4e')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x4ab30a['userId']+')','participationtypemask':_0x4ab30a[_0x8061('0x4e')]===_0x8061('0x4d')?0x2:0x1}];_0x8f7da2={'method':'POST','uri':_0x44da8f+_0x8061('0x4f'),'body':Object[_0x8061('0x50')]({},{'subject':intUtil[_0x8061('0x46')](_0x386f4d[_0x8061('0x47')],_0x4cf167,'\x20'),'phonenumber':String(_0x4cf167[_0x8061('0x29')]),'description':intUtil[_0x8061('0x46')](_0x386f4d[_0x8061('0x48')],_0x4cf167,'\x0a'),'regardingobjectid_contact@odata.bind':_0x4ab30a[_0x8061('0x49')]?'/contacts('+_0x4ab30a[_0x8061('0x49')]+')':undefined,'ownerid@odata.bind':_0x8061('0x2c')+_0x4ab30a[_0x8061('0x20')]+')','directioncode':_0x4ab30a['callDirection']===_0x8061('0x4d')?![]:!![],'phonecall_activity_parties':_0x1285e9},getCustomFields(_0x386f4d[_0x8061('0x4b')],_0x4cf167,_0x386f4d[_0x8061('0x43')])),'headers':{'Authorization':'Bearer\x20'+_0x2bbf6c,'OData-Version':_0x8061('0x19')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x8f7da2);})[_0x8061('0x16')](function(_0xcbfdad){var _0x4387f5=_0xcbfdad['headers'][_0x8061('0x2e')];var _0x2cbc3d=_0x4387f5[_0x8061('0x40')](_0x4387f5[_0x8061('0x2f')]('(')+0x1,_0x4387f5[_0x8061('0x2f')](')'));_0x4ab30a['ticketId']=_0x2cbc3d;_0x309e60(_0x4ab30a);})[_0x8061('0x14')](function(_0x859c4b){_0x2936fe(_0x859c4b[_0x8061('0x25')]);});});}function emit(_0x50839b,_0x58b322,_0x5b41e6,_0x522560){var _0x4f53d1={'uri':util[_0x8061('0x51')](_0x8061('0x52'),_0x50839b,_0x5b41e6,_0x522560)};io['to'](util[_0x8061('0x51')](_0x8061('0x53'),_0x58b322))[_0x8061('0x54')](_0x8061('0x55'),_0x4f53d1);}exports['cs']=function(_0x37cf0a,_0x1ce8b4,_0x5015a4,_0x3da70b,_0x53cfc0,_0x3dc937,_0x935d85,_0x2475ac){var _0x1f94a6={};_0x3dc937[_0x8061('0xc')]=_0x3dc937[_0x8061('0xb')]?intUtil[_0x8061('0x56')](_0x3dc937['CloudProvider']['data7']):intUtil[_0x8061('0x56')](_0x3dc937[_0x8061('0xc')]);_0x3dc937['serverUrl']=intUtil[_0x8061('0x56')](_0x3dc937[_0x8061('0x57')]);_0x1f94a6[_0x8061('0x4e')]=_0x2475ac===_0x8061('0x4d')||_0x2475ac===_0x8061('0x58')?_0x8061('0x4d'):_0x8061('0x27');var _0x901b0f=_0x3dc937['modernAuthentication']?util['format']('%s/api/data/v9.0/',_0x3dc937[_0x8061('0xd')][_0x8061('0xe')]):util[_0x8061('0x51')](_0x8061('0x59'),_0x3dc937['remoteUri']);var _0x2bd84c=util[_0x8061('0x51')](_0x8061('0x5a'),_0x3dc937[_0x8061('0xf')]);var _0x49ad70=util[_0x8061('0x51')](_0x8061('0x5b'),_0x3dc937[_0x8061('0x57')],_0x1ce8b4[_0x8061('0x5c')],md5(_0x1ce8b4[_0x8061('0x5c')]));if(_0x53cfc0&&_0x53cfc0[_0x8061('0x5d')]){logger[_0x8061('0x1e')](_0x8061('0x5e'),_0x8061('0x5f'));_0x1ce8b4[_0x8061('0x60')]=_0x49ad70;}else if(_0x935d85&&_0x935d85[_0x8061('0x61')]&&_0x935d85['recordingFormat']!==_0x8061('0x62')){logger[_0x8061('0x1e')](_0x8061('0x63'),_0x8061('0x5f'));_0x1ce8b4[_0x8061('0x60')]=_0x49ad70;}else{_0x1ce8b4[_0x8061('0x60')]='';}return getUser(_0x1f94a6,_0x3dc937,_0x3da70b,_0x2bd84c,_0x901b0f,_0x2475ac)[_0x8061('0x16')](function(_0x35b08b){logger[_0x8061('0x1e')]('['+_0x2475ac[_0x8061('0x22')]()+_0x8061('0x64'),_0x35b08b[_0x8061('0x20')]);logger[_0x8061('0x1e')]('['+_0x2475ac[_0x8061('0x22')]()+']\x20The\x20User\x20email\x20is:',_0x35b08b[_0x8061('0x1b')]);return getEndUser(_0x35b08b,_0x3dc937,_0x2bd84c,_0x901b0f,_0x1ce8b4,_0x2475ac,_0x5015a4[_0x8061('0x65')],_0x5015a4[_0x8061('0x66')]);})[_0x8061('0x16')](function(_0x450da1){logger['info']('['+_0x2475ac[_0x8061('0x22')]()+_0x8061('0x67'),_0x450da1[_0x8061('0x49')]);logger[_0x8061('0x1e')]('['+_0x2475ac[_0x8061('0x22')]()+_0x8061('0x68'),_0x1ce8b4[_0x8061('0x29')]);return getTicket(_0x450da1,_0x3dc937,_0x2bd84c,_0x901b0f,_0x1ce8b4,_0x5015a4,_0x2475ac);})[_0x8061('0x16')](function(_0x526ff3){logger[_0x8061('0x1e')](util[_0x8061('0x51')]('['+_0x2475ac['toUpperCase']()+_0x8061('0x69'),_0x5015a4[_0x8061('0x43')],_0x526ff3[_0x8061('0x6a')]));logger[_0x8061('0x1e')](util[_0x8061('0x51')]('['+_0x2475ac[_0x8061('0x22')]()+']\x20Call\x20direction:\x20%s',_0x2475ac));if(_0x2475ac!=='unmanaged'&&_0x5015a4[_0x8061('0x6b')]){logger['info']('['+_0x2475ac['toUpperCase']()+']',_0x8061('0x6c'));emit(_0x3dc937['remoteUri'],_0x3da70b[_0x8061('0x6d')],_0x5015a4['ticketType'],_0x526ff3['ticketId']);}})['catch'](function(_0x2772b0){logger[_0x8061('0x6e')]('['+_0x2475ac[_0x8061('0x22')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x2772b0['message']);console[_0x8061('0x6e')](_0x8061('0x6f'),_0x2772b0);});}; \ No newline at end of file +var _0xdf10=['name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','ioredis','../../../../config/logger','dynamics365','redis','defaults','localhost','socket.io-emitter','modernAuthentication','CloudProvider','tenantId','data2','POST','clientId','username','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','isNil','validateEmail','email','userEmail','length','internalemailaddress',']\x20Agent\x20found\x20','systemuserid','userId','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','4.0','body','headers','odata-entityid','substring','lastIndexOf','enduserId','telephone1','\x20eq\x20\x27','replace','%2b','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','picklist','type','nameField','idField','indexOf','content','ticketType','incident','incidents','assign','getString','Descriptions','/contacts(','Fields','phonecall','queue','phonecalls','Subjects','callDirection','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','stripTrailingSlash','data7','remoteUri','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','none','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:','moduleCreate',']\x20The\x20Enduser\x20phone\x20is:'];(function(_0x503699,_0x152145){var _0xd66c82=function(_0x48c6e7){while(--_0x48c6e7){_0x503699['push'](_0x503699['shift']());}};_0xd66c82(++_0x152145);}(_0xdf10,0x6f));var _0x0df1=function(_0x4a6c1a,_0x5d46bb){_0x4a6c1a=_0x4a6c1a-0x0;var _0x4f1141=_0xdf10[_0x4a6c1a];return _0x4f1141;};'use strict';var _=require(_0x0df1('0x0'));var rp=require(_0x0df1('0x1'));var util=require(_0x0df1('0x2'));var intUtil=require(_0x0df1('0x3'));var md5=require('md5');var Redis=require(_0x0df1('0x4'));var logger=require(_0x0df1('0x5'))(_0x0df1('0x6'));var config=require('../../../../config/environment');config[_0x0df1('0x7')]=_[_0x0df1('0x8')](config[_0x0df1('0x7')],{'host':_0x0df1('0x9'),'port':0x18eb});var io=require(_0x0df1('0xa'))(new Redis(config[_0x0df1('0x7')]));function getAuthToken(_0x2e07c0,_0x20bbcf,_0xe17975){if(_0x2e07c0[_0x0df1('0xb')]){_0x2e07c0['remoteUri']=_0x2e07c0[_0x0df1('0xc')]['data7'];_0x2e07c0[_0x0df1('0xd')]=_0x2e07c0[_0x0df1('0xc')][_0x0df1('0xe')];return Promise['resolve'](_0x2e07c0['CloudProvider']['data5']);}var _0x2b08bb={'method':_0x0df1('0xf'),'uri':_0x20bbcf,'form':{'client_id':_0x2e07c0[_0x0df1('0x10')],'resource':_0x2e07c0['remoteUri'],'username':_0x2e07c0[_0x0df1('0x11')],'password':_0x2e07c0[_0x0df1('0x12')],'grant_type':'password','client_secret':_0x2e07c0[_0x0df1('0x13')]},'json':!![]};return rp(_0x2b08bb)[_0x0df1('0x14')](function(_0xaf9773){return _0xaf9773[_0x0df1('0x15')];})[_0x0df1('0x16')](function(_0x1fb7fa){logger[_0x0df1('0x17')]('['+[_0xe17975[_0x0df1('0x18')]()]+_0x0df1('0x19'));return _0x1fb7fa[_0x0df1('0x1a')];});}function getUser(_0x3143b8,_0x128385,_0x273376,_0x3d48d2,_0x137650,_0x80afbc){return new Promise(function(_0x3a1dfc,_0x2dd2a4){return getAuthToken(_0x128385,_0x3d48d2,_0x80afbc)[_0x0df1('0x14')](function(_0x4a2123){var _0x52f654={'method':_0x0df1('0x1b'),'uri':_0x137650+_0x0df1('0x1c'),'headers':{'Authorization':_0x0df1('0x1d')+_0x4a2123,'OData-Version':'4.0'},'json':!![]};return rp(_0x52f654);})['then'](function(_0x23a798){var _0x4cc6b5=_0x23a798[_0x0df1('0x1e')];var _0x1a5678=![];var _0x3a3152=null;if(!_[_0x0df1('0x1f')](_0x273376)){if(intUtil[_0x0df1('0x20')](_0x273376[_0x0df1('0x21')])){_0x3143b8[_0x0df1('0x22')]=_0x273376[_0x0df1('0x21')];for(_0x3a3152=0x0;_0x3a3152<_0x4cc6b5[_0x0df1('0x23')];_0x3a3152++){if(_0x4cc6b5[_0x3a3152][_0x0df1('0x24')]===_0x273376['email']&&!_0x4cc6b5[_0x3a3152]['isdisabled']){_0x1a5678=!![];logger['info']('['+[_0x80afbc['toUpperCase']()]+_0x0df1('0x25')+_0x4cc6b5[_0x3a3152][_0x0df1('0x26')]+'!');_0x3143b8[_0x0df1('0x27')]=_0x4cc6b5[_0x3a3152][_0x0df1('0x26')];}}}}if(!_0x1a5678){logger[_0x0df1('0x28')]('['+[_0x80afbc[_0x0df1('0x18')]()]+_0x0df1('0x29'));_0x3143b8['userEmail']=_0x128385[_0x0df1('0x11')];for(_0x3a3152=0x0;_0x3a3152<_0x4cc6b5[_0x0df1('0x23')];_0x3a3152++){if(_0x4cc6b5[_0x3a3152][_0x0df1('0x24')]===_0x128385['username']){_0x3143b8[_0x0df1('0x27')]=_0x4cc6b5[_0x3a3152][_0x0df1('0x26')];}}}_0x3a1dfc(_0x3143b8);})[_0x0df1('0x16')](function(_0x1bd867){_0x2dd2a4(_0x1bd867[_0x0df1('0x1a')]);});});}function createEndUser(_0x14ebe4,_0x10ced0,_0x47e589,_0x2a5d2c,_0x34c2d8,_0x45666c,_0x2d4bda){return new Promise(function(_0x4768a1,_0x429cc8){return getAuthToken(_0x10ced0,_0x47e589,_0x45666c)['then'](function(_0x344ecb){var _0x3b01f6=_0x45666c[_0x0df1('0x2a')]()===_0x0df1('0x2b')?_0x34c2d8[_0x0df1('0x2c')]:_0x34c2d8[_0x0df1('0x2d')];var _0x524416={'method':'POST','uri':_0x2a5d2c+_0x0df1('0x2e'),'body':{'fullname':_0x3b01f6,'firstname':_0x3b01f6,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x0df1('0x2f')+_0x14ebe4[_0x0df1('0x27')]+')'},'headers':{'Authorization':_0x0df1('0x1d')+_0x344ecb,'OData-Version':_0x0df1('0x30')},'json':!![],'resolveWithFullResponse':!![]};_0x524416[_0x0df1('0x31')][_0x2d4bda]=_0x3b01f6;return rp(_0x524416);})['then'](function(_0x328dc2){var _0x5a554a=_0x328dc2[_0x0df1('0x32')][_0x0df1('0x33')];var _0x22f58c=_0x5a554a[_0x0df1('0x34')](_0x5a554a[_0x0df1('0x35')]('(')+0x1,_0x5a554a['lastIndexOf'](')'));_0x14ebe4[_0x0df1('0x36')]=_0x22f58c;_0x4768a1(_0x14ebe4);})['catch'](function(_0x4eadb8){_0x429cc8(_0x4eadb8['message']);});});}function getEndUser(_0x35bfc7,_0x2fb611,_0x2dceff,_0x62255a,_0x2b1fec,_0x354892,_0x281d20,_0x31ed1e){var _0x3c9521=_0x354892[_0x0df1('0x2a')]()===_0x0df1('0x2b')?_0x2b1fec[_0x0df1('0x2c')]:_0x2b1fec['calleridnum'];return getAuthToken(_0x2fb611,_0x2dceff,_0x354892)[_0x0df1('0x14')](function(_0x32ae66){_0x31ed1e=_0x31ed1e?_0x31ed1e:_0x0df1('0x37');var _0x4d1442={'method':_0x0df1('0x1b'),'uri':_0x62255a+'contacts?$select='+_0x31ed1e+'&$filter='+_0x31ed1e+_0x0df1('0x38')+_0x3c9521[_0x0df1('0x39')]('+',_0x0df1('0x3a'))+'\x27','headers':{'Authorization':_0x0df1('0x1d')+_0x32ae66,'If-None-Match':null,'OData-Version':_0x0df1('0x30')},'json':!![]};return rp(_0x4d1442);})['then'](function(_0x3c55f0){var _0x3d257c=![];if(!_0x3c55f0)return _0x3d257c;var _0x2732f0=_0x3c55f0[_0x0df1('0x1e')];for(var _0x3c0fd4=0x0;_0x3c0fd4<_0x2732f0[_0x0df1('0x23')];_0x3c0fd4++){if(_0x2732f0[_0x3c0fd4][_0x31ed1e]===_0x3c9521){_0x3d257c=!![];_0x35bfc7[_0x0df1('0x36')]=_0x2732f0[_0x3c0fd4]['contactid'];}}return _0x3d257c;})[_0x0df1('0x14')](function(_0x55d48a){if(_0x55d48a)return _0x35bfc7;if(_0x281d20===_0x0df1('0x3b')){logger[_0x0df1('0x28')]('['+[_0x354892[_0x0df1('0x18')]()]+_0x0df1('0x3c'));return _0x35bfc7;}return createEndUser(_0x35bfc7,_0x2fb611,_0x2dceff,_0x62255a,_0x2b1fec,_0x354892,_0x31ed1e)['then'](function(_0xe0c414){logger[_0x0df1('0x28')]('['+[_0x354892[_0x0df1('0x18')]()]+_0x0df1('0x3d'),_0xe0c414[_0x0df1('0x36')]);return _0xe0c414;});});}function getCustomFields(_0x42117f,_0x527a25,_0x777c0d){var _0x30b45b={};if(_0x42117f[_0x0df1('0x23')]>0x0){_[_0x0df1('0x3e')](_0x42117f,function(_0x37d966){if(_[_0x0df1('0x3f')]([_0x0df1('0x40'),_0x0df1('0x41')],_0x37d966[_0x0df1('0x42')])&&_0x37d966[_0x0df1('0x43')]&&!_0x37d966['customField']){var _0x350ed0=_0x37d966[_0x0df1('0x44')][_0x0df1('0x2a')]();var _0x122753=_0x350ed0[_0x0df1('0x34')](0x0,_0x350ed0[_0x0df1('0x45')]('_'));var _0x546ff4=_0x350ed0[_0x0df1('0x34')](_0x350ed0[_0x0df1('0x45')]('_')+0x1);if(_0x122753===_0x777c0d){_0x30b45b[_0x546ff4]=_0x37d966[_0x0df1('0x46')];}}});}return _0x30b45b;}function getTicket(_0x2f4f35,_0x279625,_0x1bcbdc,_0x4d6df1,_0x55000b,_0x1230e3,_0x1d4d39){return new Promise(function(_0x460a5a,_0x135706){var _0x1e42e4;return getAuthToken(_0x279625,_0x1bcbdc,_0x1d4d39)[_0x0df1('0x14')](function(_0x1f05a6){if(_0x1230e3[_0x0df1('0x47')]===_0x0df1('0x48')){_0x1e42e4={'method':_0x0df1('0xf'),'uri':_0x4d6df1+_0x0df1('0x49'),'body':Object[_0x0df1('0x4a')]({},{'title':intUtil['getString'](_0x1230e3['Subjects'],_0x55000b,'\x20'),'description':intUtil[_0x0df1('0x4b')](_0x1230e3[_0x0df1('0x4c')],_0x55000b,'\x0a'),'customerid_contact@odata.bind':_0x2f4f35[_0x0df1('0x36')]?_0x0df1('0x4d')+_0x2f4f35[_0x0df1('0x36')]+')':undefined,'ownerid@odata.bind':_0x0df1('0x2f')+_0x2f4f35[_0x0df1('0x27')]+')','caseorigincode':'1'},getCustomFields(_0x1230e3[_0x0df1('0x4e')],_0x55000b,_0x1230e3[_0x0df1('0x47')])),'headers':{'Authorization':_0x0df1('0x1d')+_0x1f05a6,'OData-Version':_0x0df1('0x30')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1230e3[_0x0df1('0x47')]===_0x0df1('0x4f')){var _0x2a3f96=_0x2f4f35[_0x0df1('0x36')]?[{'partyid_systemuser@odata.bind':_0x0df1('0x2f')+_0x2f4f35['userId']+')','participationtypemask':_0x2f4f35['callDirection']===_0x0df1('0x50')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x2f4f35[_0x0df1('0x36')]+')','participationtypemask':_0x2f4f35['callDirection']===_0x0df1('0x50')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x0df1('0x2f')+_0x2f4f35[_0x0df1('0x27')]+')','participationtypemask':_0x2f4f35['callDirection']===_0x0df1('0x50')?0x2:0x1}];_0x1e42e4={'method':_0x0df1('0xf'),'uri':_0x4d6df1+_0x0df1('0x51'),'body':Object[_0x0df1('0x4a')]({},{'subject':intUtil[_0x0df1('0x4b')](_0x1230e3[_0x0df1('0x52')],_0x55000b,'\x20'),'phonenumber':String(_0x55000b[_0x0df1('0x2d')]),'description':intUtil['getString'](_0x1230e3[_0x0df1('0x4c')],_0x55000b,'\x0a'),'regardingobjectid_contact@odata.bind':_0x2f4f35[_0x0df1('0x36')]?_0x0df1('0x4d')+_0x2f4f35[_0x0df1('0x36')]+')':undefined,'ownerid@odata.bind':_0x0df1('0x2f')+_0x2f4f35[_0x0df1('0x27')]+')','directioncode':_0x2f4f35[_0x0df1('0x53')]===_0x0df1('0x50')?![]:!![],'phonecall_activity_parties':_0x2a3f96},getCustomFields(_0x1230e3[_0x0df1('0x4e')],_0x55000b,_0x1230e3[_0x0df1('0x47')])),'headers':{'Authorization':'Bearer\x20'+_0x1f05a6,'OData-Version':_0x0df1('0x30')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1e42e4);})[_0x0df1('0x14')](function(_0x5ae8d5){var _0x47b9d6=_0x5ae8d5[_0x0df1('0x32')]['odata-entityid'];var _0xcf6a15=_0x47b9d6[_0x0df1('0x34')](_0x47b9d6[_0x0df1('0x35')]('(')+0x1,_0x47b9d6[_0x0df1('0x35')](')'));_0x2f4f35[_0x0df1('0x54')]=_0xcf6a15;_0x460a5a(_0x2f4f35);})['catch'](function(_0x35d56a){_0x135706(_0x35d56a[_0x0df1('0x1a')]);});});}function emit(_0x305ba3,_0x1f451f,_0x3e271e,_0x5031fd){var _0x5d4a06={'uri':util[_0x0df1('0x55')](_0x0df1('0x56'),_0x305ba3,_0x3e271e,_0x5031fd)};io['to'](util[_0x0df1('0x55')]('user:%s',_0x1f451f))['emit']('trigger:browser:url',_0x5d4a06);}exports['cs']=function(_0x5eff21,_0x245f1e,_0x376296,_0x43e3b5,_0x3df936,_0x9e177b,_0x1f8f7c,_0x1108b9){var _0x549cb4={};_0x9e177b['remoteUri']=_0x9e177b[_0x0df1('0xb')]?intUtil[_0x0df1('0x57')](_0x9e177b[_0x0df1('0xc')][_0x0df1('0x58')]):intUtil[_0x0df1('0x57')](_0x9e177b[_0x0df1('0x59')]);_0x9e177b[_0x0df1('0x5a')]=intUtil[_0x0df1('0x57')](_0x9e177b[_0x0df1('0x5a')]);_0x549cb4['callDirection']=_0x1108b9==='queue'||_0x1108b9===_0x0df1('0x5b')?_0x0df1('0x50'):'outbound';var _0x5e69c2=_0x9e177b['modernAuthentication']?util['format'](_0x0df1('0x5c'),_0x9e177b[_0x0df1('0xc')][_0x0df1('0x58')]):util['format'](_0x0df1('0x5c'),_0x9e177b[_0x0df1('0x59')]);var _0x598def=util[_0x0df1('0x55')](_0x0df1('0x5d'),_0x9e177b[_0x0df1('0xd')]);var _0x48ec41=util[_0x0df1('0x55')](_0x0df1('0x5e'),_0x9e177b[_0x0df1('0x5a')],_0x245f1e[_0x0df1('0x5f')],md5(_0x245f1e[_0x0df1('0x5f')]));if(_0x3df936&&_0x3df936[_0x0df1('0x60')]){logger[_0x0df1('0x28')](_0x0df1('0x61'),'Recording\x20is\x20enabled!');_0x245f1e[_0x0df1('0x62')]=_0x48ec41;}else if(_0x1f8f7c&&_0x1f8f7c['recordingFormat']&&_0x1f8f7c['recordingFormat']!==_0x0df1('0x63')){logger[_0x0df1('0x28')](_0x0df1('0x64'),_0x0df1('0x65'));_0x245f1e[_0x0df1('0x62')]=_0x48ec41;}else{_0x245f1e[_0x0df1('0x62')]='';}return getUser(_0x549cb4,_0x9e177b,_0x43e3b5,_0x598def,_0x5e69c2,_0x1108b9)[_0x0df1('0x14')](function(_0x1a25ee){logger[_0x0df1('0x28')]('['+_0x1108b9['toUpperCase']()+_0x0df1('0x66'),_0x1a25ee['userId']);logger['info']('['+_0x1108b9[_0x0df1('0x18')]()+']\x20The\x20User\x20email\x20is:',_0x1a25ee[_0x0df1('0x22')]);return getEndUser(_0x1a25ee,_0x9e177b,_0x598def,_0x5e69c2,_0x245f1e,_0x1108b9,_0x376296[_0x0df1('0x67')],_0x376296['additionalSearchContact']);})[_0x0df1('0x14')](function(_0x5df828){logger[_0x0df1('0x28')]('['+_0x1108b9[_0x0df1('0x18')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x5df828[_0x0df1('0x36')]);logger[_0x0df1('0x28')]('['+_0x1108b9[_0x0df1('0x18')]()+_0x0df1('0x68'),_0x245f1e[_0x0df1('0x2d')]);return getTicket(_0x5df828,_0x9e177b,_0x598def,_0x5e69c2,_0x245f1e,_0x376296,_0x1108b9);})[_0x0df1('0x14')](function(_0x42ab33){logger['info'](util[_0x0df1('0x55')]('['+_0x1108b9[_0x0df1('0x18')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x376296[_0x0df1('0x47')],_0x42ab33[_0x0df1('0x54')]));logger[_0x0df1('0x28')](util[_0x0df1('0x55')]('['+_0x1108b9['toUpperCase']()+']\x20Call\x20direction:\x20%s',_0x1108b9));if(_0x1108b9!==_0x0df1('0x5b')&&_0x376296['openNewTab']){logger[_0x0df1('0x28')]('['+_0x1108b9[_0x0df1('0x18')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x9e177b[_0x0df1('0x59')],_0x43e3b5[_0x0df1('0x69')],_0x376296[_0x0df1('0x47')],_0x42ab33[_0x0df1('0x54')]);}})[_0x0df1('0x16')](function(_0x473556){logger[_0x0df1('0x17')]('['+_0x1108b9[_0x0df1('0x18')]()+_0x0df1('0x6a'),_0x473556[_0x0df1('0x1a')]);console[_0x0df1('0x17')](_0x0df1('0x6b'),_0x473556);});}; \ 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 f0def98..1ad513e 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 _0xdce6=['[OUTBOUND]','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','lastevent','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','Caller\x20-\x20%s','calleridname','calleridnum','getString','
','Tags','mapValues','keyBy','custom_fields','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','format','%s/api/v2/agents','length','Agent\x20found!','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','find','Enduser\x20created.','Basic\x20%s','base64','[HTTP]','GET','map','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','push','variable','variableName','idField','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','stringify','outbound','recordingFormat','none','destcalleridname','destcalleridnum','catch','error'];(function(_0x51b795,_0x36cb3d){var _0x28fd43=function(_0x86f8e){while(--_0x86f8e){_0x51b795['push'](_0x51b795['shift']());}};_0x28fd43(++_0x36cb3d);}(_0xdce6,0xbc));var _0x6dce=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xdce6[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var rp=require(_0x6dce('0x0'));var md5=require(_0x6dce('0x1'));var util=require('util');var Redis=require(_0x6dce('0x2'));var intUtil=require(_0x6dce('0x3'));var config=require(_0x6dce('0x4'));var logger=require(_0x6dce('0x5'))('freshdesk');config[_0x6dce('0x6')]=_[_0x6dce('0x7')](config[_0x6dce('0x6')],{'host':_0x6dce('0x8'),'port':0x18eb});var io=require(_0x6dce('0x9'))(new Redis(config[_0x6dce('0x6')]));var headers={'Content-Type':_0x6dce('0xa'),'Accept':_0x6dce('0xa')};function emit(_0x3e5b90,_0x2ea742,_0x3c055a){io['to'](_0x3e5b90)[_0x6dce('0xb')](_0x2ea742,_0x3c055a);}function getTicket(_0x57da0b,_0x35ae7a,_0x337ae7,_0x41c41f,_0x2a17b7){logger[_0x6dce('0xc')](_0x6dce('0xd'));var _0x158ce7=_['merge']({'responder_id':_0x35ae7a['id'],'requester_id':_0x337ae7['id'],'name':util['format'](_0x6dce('0xe'),_0x2a17b7[_0x6dce('0xf')]),'phone':_0x2a17b7[_0x6dce('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x6dce('0x11')](_0x41c41f['Subjects'],_0x2a17b7,'\x20'),'description':intUtil[_0x6dce('0x11')](_0x41c41f['Descriptions'],_0x2a17b7,_0x6dce('0x12')),'tags':getTags(_0x41c41f[_0x6dce('0x13')],'name')},getCustomFields(_0x41c41f['Fields'],_0x2a17b7));_0x158ce7['custom_fields']=_[_0x6dce('0x14')](_[_0x6dce('0x15')](_0x158ce7[_0x6dce('0x16')],'id'),'value');return request({'uri':util['format'](_0x6dce('0x17'),_0x57da0b[_0x6dce('0x18')]),'method':_0x6dce('0x19'),'body':_0x158ce7})[_0x6dce('0x1a')](function(_0xcf74a){logger['info'](_0x6dce('0x1b'));return _0xcf74a;});}function getUser(_0x4d9f00,_0x1cc5ce){if(intUtil[_0x6dce('0x1c')](_0x1cc5ce)){return request({'uri':util[_0x6dce('0x1d')](_0x6dce('0x1e'),_0x4d9f00[_0x6dce('0x18')]),'qs':{'email':_0x1cc5ce}})[_0x6dce('0x1a')](function(_0x15c3af){if(_0x15c3af[_0x6dce('0x1f')]){logger['info'](_0x6dce('0x20'));return _['find'](_0x15c3af,function(_0xb7ffcb){return _0xb7ffcb[_0x6dce('0x21')][_0x6dce('0x22')]===_0x1cc5ce;});}else{logger[_0x6dce('0xc')](_0x6dce('0x23'));return request({'uri':util[_0x6dce('0x1d')]('%s/api/v2/agents/me',_0x4d9f00[_0x6dce('0x18')])})['then'](function(_0xa0aa98){logger[_0x6dce('0xc')](_0x6dce('0x24'));return _0xa0aa98;});}});}else{logger[_0x6dce('0xc')](_0x6dce('0x25'));return request({'uri':util['format'](_0x6dce('0x26'),_0x4d9f00[_0x6dce('0x18')])})[_0x6dce('0x1a')](function(_0x3b3068){logger['info']('Admin\x20account\x20selected.');return _0x3b3068;});}}function getEndUser(_0x4bdbcf,_0x4a1505,_0x25aafd){logger[_0x6dce('0xc')](_0x6dce('0x27'),_0x25aafd);return request({'uri':util[_0x6dce('0x1d')](_0x6dce('0x28'),_0x4bdbcf[_0x6dce('0x18')]),'qs':{'phone':_0x25aafd}})[_0x6dce('0x1a')](function(_0x2d9d9f){if(_0x2d9d9f[_0x6dce('0x1f')]){logger[_0x6dce('0xc')](_0x6dce('0x29'));return _[_0x6dce('0x2a')](_0x2d9d9f,{'phone':_0x25aafd});}else{logger[_0x6dce('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x6dce('0x1d')](_0x6dce('0x28'),_0x4bdbcf['remoteUri']),'method':_0x6dce('0x19'),'body':{'name':_0x4a1505,'phone':_0x25aafd}})[_0x6dce('0x1a')](function(_0x3a41d9){logger[_0x6dce('0xc')](_0x6dce('0x2b'));return _0x3a41d9;});}});}function getAuth(_0x59a456){return util[_0x6dce('0x1d')](_0x6dce('0x2c'),new Buffer(_0x59a456['apiKey']+':X')['toString'](_0x6dce('0x2d')));}function request(_0x5ccdb4){logger['debug'](_0x6dce('0x2e'),JSON['stringify'](_0x5ccdb4));return rp(_[_0x6dce('0x7')](_0x5ccdb4,{'method':_0x6dce('0x2f'),'headers':headers,'json':!![]}));}function getTags(_0x27073c,_0xb487e9){var _0x48e271=[];if(_0x27073c&&_0x27073c[_0x6dce('0x1f')]>0x0){_0x48e271=_[_0x6dce('0x30')](_0x27073c,_0xb487e9);}return _0x48e271;}function getCustomFields(_0xb9bcb6,_0x17f32){var _0xb7abc7=[];var _0x454622={'custom_fields':[]};if(_0xb9bcb6[_0x6dce('0x1f')]>0x0){_['forEach'](_0xb9bcb6,function(_0x282830){if(_[_0x6dce('0x31')]([_0x6dce('0x32'),_0x6dce('0x33')],_0x282830[_0x6dce('0x34')])&&_0x282830[_0x6dce('0x35')]&&!_0x282830[_0x6dce('0x36')]){_0x454622[_0x282830[_0x6dce('0x35')][_0x6dce('0x37')]()]=_0x282830[_0x6dce('0x38')][_0x6dce('0x39')]();}else if(_[_0x6dce('0x31')]([_0x6dce('0x32'),_0x6dce('0x33')],_0x282830[_0x6dce('0x34')])&&_0x282830['idField']&&_0x282830[_0x6dce('0x36')]){_0x454622[_0x6dce('0x16')][_0x6dce('0x3a')]({'id':_0x282830['idField'],'value':_0x282830[_0x6dce('0x38')][_0x6dce('0x39')]()});}else if(_0x282830[_0x6dce('0x34')]===_0x6dce('0x3b')&&_0x282830[_0x6dce('0x3c')]&&_0x282830[_0x6dce('0x3d')]&&_0x282830[_0x6dce('0x36')]){_0x17f32[_0x282830[_0x6dce('0x3c')]]&&_0x454622[_0x6dce('0x16')]['push']({'id':_0x282830[_0x6dce('0x3d')],'value':_0x17f32[_0x282830['variableName']]['toString']()});}else if(_0x282830[_0x6dce('0x34')]===_0x6dce('0x3e')&&_0x282830['Variable']&&_0x282830[_0x6dce('0x3f')]['name']&&_0x282830[_0x6dce('0x3d')]&&_0x282830[_0x6dce('0x36')]){_0x17f32[_0x282830[_0x6dce('0x3f')]['name']['toLowerCase']()]&&_0x454622[_0x6dce('0x16')][_0x6dce('0x3a')]({'id':_0x282830['idField'],'value':_0x17f32[_0x282830[_0x6dce('0x3f')][_0x6dce('0x40')]['toLowerCase']()][_0x6dce('0x39')]()});}});}return _0x454622;}exports[_0x6dce('0x41')]=function(_0x49d8c4,_0x3080b6,_0x5410ac,_0x319991,_0x4ce896,_0x24f0a8){var _0x1d992a,_0x1ea044;_0x24f0a8[_0x6dce('0x18')]=intUtil[_0x6dce('0x42')](_0x24f0a8['remoteUri']);_0x24f0a8[_0x6dce('0x43')]=intUtil[_0x6dce('0x42')](_0x24f0a8[_0x6dce('0x43')]);if(_0x4ce896&&_0x4ce896[_0x6dce('0x44')]){logger[_0x6dce('0xc')](_0x6dce('0x45'),_0x6dce('0x46'));_0x3080b6[_0x6dce('0x47')]=util[_0x6dce('0x1d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x24f0a8[_0x6dce('0x43')],_0x3080b6[_0x6dce('0x48')],md5(_0x3080b6[_0x6dce('0x48')]));}else{_0x3080b6['recordingURL']='';}headers[_0x6dce('0x49')]=getAuth(_0x24f0a8);return getUser(_0x24f0a8,_0x319991['email'])[_0x6dce('0x1a')](function(_0x2e5040){_0x1d992a=_0x2e5040;logger[_0x6dce('0xc')](_0x6dce('0x4a'),_0x1d992a['id']);return getEndUser(_0x24f0a8,_0x3080b6[_0x6dce('0xf')],_0x3080b6[_0x6dce('0x10')]);})[_0x6dce('0x1a')](function(_0x35435e){_0x1ea044=_0x35435e;logger['info'](_0x6dce('0x4b'),_0x1ea044['id']);return getTicket(_0x24f0a8,_0x1d992a,_0x1ea044,_0x5410ac,_0x3080b6);})[_0x6dce('0x1a')](function(_0x41d8df){if(_0x41d8df&&_0x41d8df['id']){logger[_0x6dce('0xc')](_0x6dce('0x1b'));logger[_0x6dce('0xc')]('The\x20Ticket\x20ID\x20is:',_0x41d8df['id']);logger[_0x6dce('0xc')](_0x6dce('0x45'),_0x6dce('0x4c'));emit(util['format'](_0x6dce('0x4d'),_0x319991['name']),_0x6dce('0x4e'),{'uri':util[_0x6dce('0x1d')](_0x6dce('0x4f'),_0x24f0a8[_0x6dce('0x18')],_0x41d8df['id'])});}})['catch'](function(_0x388ca5){logger['error'](_0x6dce('0x45'),JSON[_0x6dce('0x50')](_0x388ca5));});};exports[_0x6dce('0x51')]=function(_0x2dbce0,_0xf3e3d1,_0x4546eb,_0x52cb32,_0x1e795a,_0x4db853,_0x471d6c){var _0x651015,_0x4939a8;_0x4db853[_0x6dce('0x18')]=intUtil[_0x6dce('0x42')](_0x4db853[_0x6dce('0x18')]);_0x4db853[_0x6dce('0x43')]=intUtil[_0x6dce('0x42')](_0x4db853['serverUrl']);if(_0x471d6c&&_0x471d6c[_0x6dce('0x52')]&&_0x471d6c[_0x6dce('0x52')]!==_0x6dce('0x53')){logger['info']('[OUTBOUND]',_0x6dce('0x46'));_0xf3e3d1[_0x6dce('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4db853[_0x6dce('0x43')],_0xf3e3d1[_0x6dce('0x48')],md5(_0xf3e3d1[_0x6dce('0x48')]));}headers['Authorization']=getAuth(_0x4db853);return getUser(_0x4db853,_0x52cb32[_0x6dce('0x22')])[_0x6dce('0x1a')](function(_0x3c7737){_0x651015=_0x3c7737;logger['info'](_0x6dce('0x4a'),_0x651015['id']);return getEndUser(_0x4db853,_0xf3e3d1[_0x6dce('0x54')],_0xf3e3d1[_0x6dce('0x55')]);})['then'](function(_0x22cda1){_0x4939a8=_0x22cda1;logger[_0x6dce('0xc')](_0x6dce('0x4b'),_0x4939a8['id']);return getTicket(_0x4db853,_0x651015,_0x4939a8,_0x4546eb,_0xf3e3d1);})[_0x6dce('0x1a')](function(_0x1d0731){if(_0x1d0731&&_0x1d0731['id']){logger[_0x6dce('0xc')](_0x6dce('0x1b'));logger[_0x6dce('0xc')]('The\x20Ticket\x20ID\x20is:',_0x1d0731['id']);logger[_0x6dce('0xc')]('[OUTBOUND]',_0x6dce('0x4c'));emit(util['format']('user:%s',_0x52cb32['name']),_0x6dce('0x4e'),{'uri':util[_0x6dce('0x1d')](_0x6dce('0x4f'),_0x4db853[_0x6dce('0x18')],_0x1d0731['id'])});}})[_0x6dce('0x56')](function(_0x1b0908){logger[_0x6dce('0x57')](_0x6dce('0x58'),JSON['stringify'](_0x1b0908));});};exports['unmanaged']=function(_0x53d508,_0x1a0606,_0xacb0f7,_0x310774,_0x28acb6,_0x5797cd){var _0x3d8fa5,_0x65f522;_0x5797cd[_0x6dce('0x18')]=intUtil[_0x6dce('0x42')](_0x5797cd[_0x6dce('0x18')]);_0x5797cd['serverUrl']=intUtil[_0x6dce('0x42')](_0x5797cd['serverUrl']);if(_0x28acb6&&_0x28acb6['monitor_format']){logger[_0x6dce('0xc')]('['+_0x1a0606['lastevent'][_0x6dce('0x59')]()+']',_0x6dce('0x46'));_0x1a0606[_0x6dce('0x47')]=util[_0x6dce('0x1d')](_0x6dce('0x5a'),_0x5797cd['serverUrl'],_0x1a0606[_0x6dce('0x48')],md5(_0x1a0606[_0x6dce('0x48')]));}else{_0x1a0606[_0x6dce('0x47')]='';}headers[_0x6dce('0x49')]=getAuth(_0x5797cd);return getUser(_0x5797cd,'')[_0x6dce('0x1a')](function(_0x5f340d){_0x3d8fa5=_0x5f340d;logger[_0x6dce('0xc')]('The\x20User\x20ID\x20is:',_0x3d8fa5['id']);return getEndUser(_0x5797cd,_0x1a0606[_0x6dce('0xf')],_0x1a0606[_0x6dce('0x10')]);})[_0x6dce('0x1a')](function(_0x4cf2c1){_0x65f522=_0x4cf2c1;logger[_0x6dce('0xc')](_0x6dce('0x4b'),_0x65f522['id']);return getTicket(_0x5797cd,_0x3d8fa5,_0x65f522,_0xacb0f7,_0x1a0606);})['then'](function(_0xd7980b){if(_0xd7980b){logger['info'](_0x6dce('0x1b'));logger[_0x6dce('0xc')]('The\x20Ticket\x20ID\x20is:',_0xd7980b['id']);}})[_0x6dce('0x56')](function(_0x6dbfa2){logger[_0x6dce('0x57')]('['+_0x1a0606[_0x6dce('0x5b')]['toUpperCase']()+']',JSON[_0x6dce('0x50')](_0x6dbfa2));});}; \ No newline at end of file +var _0x8225=['Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','POST','then','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','base64','debug','[HTTP]','stringify','defaults','GET','forEach','string','picklist','nameField','toString','includes','type','idField','push','content','variableName','customField','customVariable','Variable','toLowerCase','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','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]','The\x20User\x20ID\x20is:','destcalleridname','user:%s','lastevent','toUpperCase','request-promise','md5','util','./util','../../../../config/environment','freshdesk','redis','localhost','application/json','emit','Creating\x20new\x20ticket...','merge','format','calleridname','calleridnum','getString','Subjects'];(function(_0x4ce885,_0x4a64c6){var _0x189899=function(_0x12ebb2){while(--_0x12ebb2){_0x4ce885['push'](_0x4ce885['shift']());}};_0x189899(++_0x4a64c6);}(_0x8225,0x167));var _0x5822=function(_0x3c815e,_0x3d8105){_0x3c815e=_0x3c815e-0x0;var _0xf66654=_0x8225[_0x3c815e];return _0xf66654;};'use strict';var _=require('lodash');var rp=require(_0x5822('0x0'));var md5=require(_0x5822('0x1'));var util=require(_0x5822('0x2'));var Redis=require('ioredis');var intUtil=require(_0x5822('0x3'));var config=require(_0x5822('0x4'));var logger=require('../../../../config/logger')(_0x5822('0x5'));config[_0x5822('0x6')]=_['defaults'](config[_0x5822('0x6')],{'host':_0x5822('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5822('0x6')]));var headers={'Content-Type':_0x5822('0x8'),'Accept':'application/json'};function emit(_0x3d6145,_0x335ce7,_0x5af510){io['to'](_0x3d6145)[_0x5822('0x9')](_0x335ce7,_0x5af510);}function getTicket(_0x5a8734,_0x903b7f,_0x4c06b8,_0x3c98c3,_0x7faa52){logger['info'](_0x5822('0xa'));var _0x5ee76c=_[_0x5822('0xb')]({'responder_id':_0x903b7f['id'],'requester_id':_0x4c06b8['id'],'name':util[_0x5822('0xc')]('Caller\x20-\x20%s',_0x7faa52[_0x5822('0xd')]),'phone':_0x7faa52[_0x5822('0xe')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x5822('0xf')](_0x3c98c3[_0x5822('0x10')],_0x7faa52,'\x20'),'description':intUtil[_0x5822('0xf')](_0x3c98c3[_0x5822('0x11')],_0x7faa52,_0x5822('0x12')),'tags':getTags(_0x3c98c3[_0x5822('0x13')],_0x5822('0x14'))},getCustomFields(_0x3c98c3[_0x5822('0x15')],_0x7faa52));_0x5ee76c[_0x5822('0x16')]=_[_0x5822('0x17')](_[_0x5822('0x18')](_0x5ee76c['custom_fields'],'id'),_0x5822('0x19'));return request({'uri':util[_0x5822('0xc')](_0x5822('0x1a'),_0x5a8734['remoteUri']),'method':_0x5822('0x1b'),'body':_0x5ee76c})[_0x5822('0x1c')](function(_0x2b314b){logger[_0x5822('0x1d')](_0x5822('0x1e'));return _0x2b314b;});}function getUser(_0x4fb76f,_0x1619e1){if(intUtil[_0x5822('0x1f')](_0x1619e1)){return request({'uri':util[_0x5822('0xc')](_0x5822('0x20'),_0x4fb76f[_0x5822('0x21')]),'qs':{'email':_0x1619e1}})[_0x5822('0x1c')](function(_0x5d5619){if(_0x5d5619['length']){logger[_0x5822('0x1d')]('Agent\x20found!');return _[_0x5822('0x22')](_0x5d5619,function(_0x284ecf){return _0x284ecf[_0x5822('0x23')][_0x5822('0x24')]===_0x1619e1;});}else{logger[_0x5822('0x1d')](_0x5822('0x25'));return request({'uri':util[_0x5822('0xc')](_0x5822('0x26'),_0x4fb76f[_0x5822('0x21')])})[_0x5822('0x1c')](function(_0x1e0f23){logger['info'](_0x5822('0x27'));return _0x1e0f23;});}});}else{logger['info'](_0x5822('0x28'));return request({'uri':util[_0x5822('0xc')](_0x5822('0x26'),_0x4fb76f[_0x5822('0x21')])})[_0x5822('0x1c')](function(_0x488ec1){logger[_0x5822('0x1d')](_0x5822('0x27'));return _0x488ec1;});}}function getEndUser(_0x5ce016,_0x2bd480,_0x417a84){logger[_0x5822('0x1d')](_0x5822('0x29'),_0x417a84);return request({'uri':util['format'](_0x5822('0x2a'),_0x5ce016['remoteUri']),'qs':{'phone':_0x417a84}})[_0x5822('0x1c')](function(_0x2f9922){if(_0x2f9922[_0x5822('0x2b')]){logger[_0x5822('0x1d')](_0x5822('0x2c'));return _[_0x5822('0x22')](_0x2f9922,{'phone':_0x417a84});}else{logger[_0x5822('0x1d')](_0x5822('0x2d'));return request({'uri':util[_0x5822('0xc')](_0x5822('0x2a'),_0x5ce016['remoteUri']),'method':'POST','body':{'name':_0x2bd480,'phone':_0x417a84}})[_0x5822('0x1c')](function(_0x4d2011){logger[_0x5822('0x1d')](_0x5822('0x2e'));return _0x4d2011;});}});}function getAuth(_0x480eca){return util[_0x5822('0xc')](_0x5822('0x2f'),new Buffer(_0x480eca[_0x5822('0x30')]+':X')['toString'](_0x5822('0x31')));}function request(_0x1dada7){logger[_0x5822('0x32')](_0x5822('0x33'),JSON[_0x5822('0x34')](_0x1dada7));return rp(_[_0x5822('0x35')](_0x1dada7,{'method':_0x5822('0x36'),'headers':headers,'json':!![]}));}function getTags(_0xf00e15,_0x4bf790){var _0x27c01f=[];if(_0xf00e15&&_0xf00e15[_0x5822('0x2b')]>0x0){_0x27c01f=_['map'](_0xf00e15,_0x4bf790);}return _0x27c01f;}function getCustomFields(_0x1e4d0b,_0x3b86d4){var _0x270302=[];var _0x2b84af={'custom_fields':[]};if(_0x1e4d0b['length']>0x0){_[_0x5822('0x37')](_0x1e4d0b,function(_0x51b705){if(_['includes']([_0x5822('0x38'),_0x5822('0x39')],_0x51b705['type'])&&_0x51b705[_0x5822('0x3a')]&&!_0x51b705['customField']){_0x2b84af[_0x51b705[_0x5822('0x3a')]['toLowerCase']()]=_0x51b705['content'][_0x5822('0x3b')]();}else if(_[_0x5822('0x3c')](['string',_0x5822('0x39')],_0x51b705[_0x5822('0x3d')])&&_0x51b705[_0x5822('0x3e')]&&_0x51b705['customField']){_0x2b84af['custom_fields'][_0x5822('0x3f')]({'id':_0x51b705['idField'],'value':_0x51b705[_0x5822('0x40')][_0x5822('0x3b')]()});}else if(_0x51b705[_0x5822('0x3d')]==='variable'&&_0x51b705[_0x5822('0x41')]&&_0x51b705[_0x5822('0x3e')]&&_0x51b705[_0x5822('0x42')]){_0x3b86d4[_0x51b705[_0x5822('0x41')]]&&_0x2b84af[_0x5822('0x16')][_0x5822('0x3f')]({'id':_0x51b705[_0x5822('0x3e')],'value':_0x3b86d4[_0x51b705[_0x5822('0x41')]][_0x5822('0x3b')]()});}else if(_0x51b705[_0x5822('0x3d')]===_0x5822('0x43')&&_0x51b705[_0x5822('0x44')]&&_0x51b705[_0x5822('0x44')][_0x5822('0x14')]&&_0x51b705['idField']&&_0x51b705[_0x5822('0x42')]){_0x3b86d4[_0x51b705['Variable'][_0x5822('0x14')][_0x5822('0x45')]()]&&_0x2b84af[_0x5822('0x16')][_0x5822('0x3f')]({'id':_0x51b705[_0x5822('0x3e')],'value':_0x3b86d4[_0x51b705[_0x5822('0x44')][_0x5822('0x14')]['toLowerCase']()][_0x5822('0x3b')]()});}});}return _0x2b84af;}exports['queue']=function(_0x5c9676,_0x5ec4ca,_0x4a60f9,_0x37e74c,_0x18b448,_0x1663c6){var _0x1136da,_0x5ebe14;_0x1663c6[_0x5822('0x21')]=intUtil[_0x5822('0x46')](_0x1663c6['remoteUri']);_0x1663c6[_0x5822('0x47')]=intUtil[_0x5822('0x46')](_0x1663c6['serverUrl']);if(_0x18b448&&_0x18b448[_0x5822('0x48')]){logger[_0x5822('0x1d')](_0x5822('0x49'),_0x5822('0x4a'));_0x5ec4ca[_0x5822('0x4b')]=util[_0x5822('0xc')](_0x5822('0x4c'),_0x1663c6[_0x5822('0x47')],_0x5ec4ca[_0x5822('0x4d')],md5(_0x5ec4ca[_0x5822('0x4d')]));}else{_0x5ec4ca['recordingURL']='';}headers[_0x5822('0x4e')]=getAuth(_0x1663c6);return getUser(_0x1663c6,_0x37e74c[_0x5822('0x24')])[_0x5822('0x1c')](function(_0x51552d){_0x1136da=_0x51552d;logger['info']('The\x20User\x20ID\x20is:',_0x1136da['id']);return getEndUser(_0x1663c6,_0x5ec4ca[_0x5822('0xd')],_0x5ec4ca[_0x5822('0xe')]);})[_0x5822('0x1c')](function(_0x52301a){_0x5ebe14=_0x52301a;logger[_0x5822('0x1d')](_0x5822('0x4f'),_0x5ebe14['id']);return getTicket(_0x1663c6,_0x1136da,_0x5ebe14,_0x4a60f9,_0x5ec4ca);})[_0x5822('0x1c')](function(_0x40435e){if(_0x40435e&&_0x40435e['id']){logger[_0x5822('0x1d')](_0x5822('0x1e'));logger['info'](_0x5822('0x50'),_0x40435e['id']);logger['info'](_0x5822('0x49'),_0x5822('0x51'));emit(util[_0x5822('0xc')]('user:%s',_0x37e74c[_0x5822('0x14')]),_0x5822('0x52'),{'uri':util['format'](_0x5822('0x53'),_0x1663c6[_0x5822('0x21')],_0x40435e['id'])});}})[_0x5822('0x54')](function(_0x3f03f2){logger[_0x5822('0x55')](_0x5822('0x49'),JSON[_0x5822('0x34')](_0x3f03f2));});};exports[_0x5822('0x56')]=function(_0x27d581,_0x5babf4,_0x7d1de,_0x3e32c4,_0x101cba,_0x41ce02,_0x4bc198){var _0x93ef3e,_0x116185;_0x41ce02[_0x5822('0x21')]=intUtil['stripTrailingSlash'](_0x41ce02[_0x5822('0x21')]);_0x41ce02[_0x5822('0x47')]=intUtil['stripTrailingSlash'](_0x41ce02[_0x5822('0x47')]);if(_0x4bc198&&_0x4bc198[_0x5822('0x57')]&&_0x4bc198[_0x5822('0x57')]!=='none'){logger[_0x5822('0x1d')](_0x5822('0x58'),'Recording\x20is\x20enabled!');_0x5babf4[_0x5822('0x4b')]=util[_0x5822('0xc')](_0x5822('0x4c'),_0x41ce02['serverUrl'],_0x5babf4['uniqueid'],md5(_0x5babf4['uniqueid']));}headers[_0x5822('0x4e')]=getAuth(_0x41ce02);return getUser(_0x41ce02,_0x3e32c4[_0x5822('0x24')])['then'](function(_0x35b00e){_0x93ef3e=_0x35b00e;logger[_0x5822('0x1d')](_0x5822('0x59'),_0x93ef3e['id']);return getEndUser(_0x41ce02,_0x5babf4[_0x5822('0x5a')],_0x5babf4['destcalleridnum']);})['then'](function(_0x2ec2bc){_0x116185=_0x2ec2bc;logger[_0x5822('0x1d')](_0x5822('0x4f'),_0x116185['id']);return getTicket(_0x41ce02,_0x93ef3e,_0x116185,_0x7d1de,_0x5babf4);})[_0x5822('0x1c')](function(_0x379986){if(_0x379986&&_0x379986['id']){logger[_0x5822('0x1d')](_0x5822('0x1e'));logger[_0x5822('0x1d')](_0x5822('0x50'),_0x379986['id']);logger[_0x5822('0x1d')](_0x5822('0x58'),_0x5822('0x51'));emit(util[_0x5822('0xc')](_0x5822('0x5b'),_0x3e32c4[_0x5822('0x14')]),_0x5822('0x52'),{'uri':util[_0x5822('0xc')]('%s/helpdesk/tickets/%d',_0x41ce02[_0x5822('0x21')],_0x379986['id'])});}})[_0x5822('0x54')](function(_0x43ba61){logger['error']('[OUTBOUND]',JSON['stringify'](_0x43ba61));});};exports['unmanaged']=function(_0x3a96c5,_0x71ecd5,_0x370c0b,_0x329a5c,_0x352e89,_0x172ac6){var _0x23fd46,_0xd9b7ef;_0x172ac6[_0x5822('0x21')]=intUtil[_0x5822('0x46')](_0x172ac6[_0x5822('0x21')]);_0x172ac6[_0x5822('0x47')]=intUtil[_0x5822('0x46')](_0x172ac6[_0x5822('0x47')]);if(_0x352e89&&_0x352e89[_0x5822('0x48')]){logger[_0x5822('0x1d')]('['+_0x71ecd5[_0x5822('0x5c')][_0x5822('0x5d')]()+']',_0x5822('0x4a'));_0x71ecd5[_0x5822('0x4b')]=util[_0x5822('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x172ac6[_0x5822('0x47')],_0x71ecd5[_0x5822('0x4d')],md5(_0x71ecd5['uniqueid']));}else{_0x71ecd5['recordingURL']='';}headers[_0x5822('0x4e')]=getAuth(_0x172ac6);return getUser(_0x172ac6,'')[_0x5822('0x1c')](function(_0x1cd322){_0x23fd46=_0x1cd322;logger[_0x5822('0x1d')]('The\x20User\x20ID\x20is:',_0x23fd46['id']);return getEndUser(_0x172ac6,_0x71ecd5[_0x5822('0xd')],_0x71ecd5[_0x5822('0xe')]);})[_0x5822('0x1c')](function(_0x489930){_0xd9b7ef=_0x489930;logger[_0x5822('0x1d')](_0x5822('0x4f'),_0xd9b7ef['id']);return getTicket(_0x172ac6,_0x23fd46,_0xd9b7ef,_0x370c0b,_0x71ecd5);})[_0x5822('0x1c')](function(_0x518041){if(_0x518041){logger[_0x5822('0x1d')](_0x5822('0x1e'));logger['info'](_0x5822('0x50'),_0x518041['id']);}})[_0x5822('0x54')](function(_0x115c75){logger[_0x5822('0x55')]('['+_0x71ecd5[_0x5822('0x5c')]['toUpperCase']()+']',JSON[_0x5822('0x34')](_0x115c75));});}; \ 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 fb95e34..27af48b 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 _0xd732=['agentEmail','Getting\x20user\x20with\x20email','userEmail','length','userId','Admin\x20selected','adminEmail','&f=','contacts','format','contactNumber','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','Contact\x20created:','POST','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','/api/tasks','getString','Descriptions','Contact','add','ticketId','task','Task\x20created:','/contacts/','emit','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','../../../../config/environment','freshsales','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','email','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list'];(function(_0x2484ea,_0x5f1177){var _0x204fd9=function(_0x4fa3ee){while(--_0x4fa3ee){_0x2484ea['push'](_0x2484ea['shift']());}};_0x204fd9(++_0x5f1177);}(_0xd732,0xce));var _0x2d73=function(_0x115190,_0x3459ec){_0x115190=_0x115190-0x0;var _0x564fc6=_0xd732[_0x115190];return _0x564fc6;};'use strict';var _=require(_0x2d73('0x0'));var rp=require(_0x2d73('0x1'));var md5=require(_0x2d73('0x2'));var util=require(_0x2d73('0x3'));var moment=require('moment');var Promise=require('bluebird');var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x2d73('0x4'));var logger=require('../../../../config/logger')(_0x2d73('0x5'));config[_0x2d73('0x6')]=_['defaults'](config[_0x2d73('0x6')],{'host':_0x2d73('0x7'),'port':0x18eb});var io=require(_0x2d73('0x8'))(new Redis(config[_0x2d73('0x6')]));function getAdminId(_0x58a0e8,_0x1eb66b,_0x4c39fa,_0x48f263){return new Promise(function(_0x2673ec,_0x1d218a){var _0x4dacb9=![];var _0x197938={'method':_0x2d73('0x9'),'uri':_0x48f263+_0x2d73('0xa'),'json':!![]};_0x197938[_0x2d73('0xb')]=_0x4c39fa;logger[_0x2d73('0xc')](_0x2d73('0xd'));return rp(_0x197938)[_0x2d73('0xe')](function(_0x43b7d0){if(_0x43b7d0){var _0xe05c9b=_0x43b7d0[_0x2d73('0xf')];var _0xe62f48=null;for(_0xe62f48=0x0;_0xe62f48<_0xe05c9b['length'];_0xe62f48++){if(_0xe05c9b[_0xe62f48][_0x2d73('0x10')]===_0x58a0e8['adminEmail']){_0x58a0e8['adminId']=_0xe05c9b[_0xe62f48]['id'];_0x4dacb9=!![];}}if(_0x4dacb9){logger[_0x2d73('0xc')](_0x2d73('0x11'),_0x58a0e8[_0x2d73('0x12')]);_0x2673ec(_0x58a0e8);}else{_0x1d218a({'statusCode':0x194,'message':_0x2d73('0x13')});}}else{_0x1d218a({'statusCode':0x194,'message':_0x2d73('0x13')});}})[_0x2d73('0x14')](function(_0x172533){logger[_0x2d73('0x15')]('['+[_0x1eb66b[_0x2d73('0x16')]()]+']',_0x172533[_0x2d73('0x17')]);_0x1d218a(_0x172533);});});}function getUser(_0x361dfa,_0x160d51,_0x44a507){return function(_0x55d68c){return new Promise(function(_0x3464c8,_0x2ea86b){var _0x50d1fb={'method':_0x2d73('0x9'),'uri':_0x44a507+'/api/selector/owners','json':!![]};_0x50d1fb[_0x2d73('0xb')]=_0x160d51;logger[_0x2d73('0xc')](_0x2d73('0x18'));return rp(_0x50d1fb)[_0x2d73('0xe')](function(_0x1ad7f7){if(_0x1ad7f7){var _0x118e6e=_0x1ad7f7[_0x2d73('0xf')];var _0x9b0c73=![];var _0xab0ba4=null;if(_0x55d68c[_0x2d73('0x19')]!==null){logger[_0x2d73('0xc')](_0x2d73('0x1a'),_0x55d68c[_0x2d73('0x19')]);_0x55d68c[_0x2d73('0x1b')]=_0x55d68c[_0x2d73('0x19')];for(_0xab0ba4=0x0;_0xab0ba4<_0x118e6e[_0x2d73('0x1c')];_0xab0ba4++){if(_0x118e6e[_0xab0ba4]['email']===_0x55d68c[_0x2d73('0x19')]){_0x9b0c73=!![];_0x55d68c[_0x2d73('0x1d')]=_0x118e6e[_0xab0ba4]['id'];logger[_0x2d73('0xc')]('User\x20found:',_0x55d68c[_0x2d73('0x1d')]);}}}if(!_0x9b0c73){logger[_0x2d73('0xc')](_0x2d73('0x1e'));_0x55d68c[_0x2d73('0x1b')]=_0x55d68c[_0x2d73('0x1f')];_0x55d68c[_0x2d73('0x1d')]=_0x55d68c[_0x2d73('0x12')];_0x9b0c73=!![];}if(_0x9b0c73){_0x3464c8(_0x55d68c);}else{_0x2ea86b({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x2ea86b({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x2d73('0x14')](function(_0x343cd4){logger['error']('['+[_0x361dfa[_0x2d73('0x16')]()]+']',_0x343cd4[_0x2d73('0x17')]);_0x2ea86b(_0x343cd4);});});};}function searchContact(_0x1f702b,_0x45ed3e,_0x244aca,_0x356e6e){return new Promise(function(_0x5006aa,_0x267f55){var _0x1b04e5={'method':_0x2d73('0x9'),'headers':_0x45ed3e,'uri':_0x1f702b+'/api/lookup?q='+_0x356e6e+_0x2d73('0x20')+_0x244aca+'&entities=contact','json':!![]};rp(_0x1b04e5)[_0x2d73('0xe')](function(_0x727619){var _0x3619d6=_['find'](_0x727619[_0x2d73('0x21')][_0x2d73('0x21')],[_0x244aca,_0x356e6e]);_0x5006aa(_0x3619d6);})['catch'](function(_0x146a30){_0x267f55(_0x146a30);});});}function getEndUser(_0x4e0c4c,_0xad8c26,_0x1cb43d){return function(_0x2fbdd6){return new Promise(function(_0x37461d,_0x33c8c4){logger[_0x2d73('0xc')](util[_0x2d73('0x22')]('Searching\x20contact\x20with\x20phone\x20%s',_0x2fbdd6[_0x2d73('0x23')]));searchContact(_0x1cb43d,_0xad8c26,'mobile_number',_0x2fbdd6[_0x2d73('0x23')])['then'](function(_0x2acd3a){if(_0x2acd3a){_0x2fbdd6[_0x2d73('0x24')]=_0x2acd3a['id'];logger[_0x2d73('0xc')](_0x2d73('0x25'),_0x2fbdd6[_0x2d73('0x24')]);return _0x37461d(_0x2fbdd6);}searchContact(_0x1cb43d,_0xad8c26,'work_number',_0x2fbdd6[_0x2d73('0x23')])[_0x2d73('0xe')](function(_0x23b582){if(_0x23b582){_0x2fbdd6[_0x2d73('0x24')]=_0x23b582['id'];logger[_0x2d73('0xc')](_0x2d73('0x26'),_0x2fbdd6['endUserId']);return _0x37461d(_0x2fbdd6);}createEndUser(_0x2fbdd6,_0x4e0c4c,_0xad8c26,_0x1cb43d)[_0x2d73('0xe')](function(_0x44e0ff){logger[_0x2d73('0xc')](_0x2d73('0x27'),_0x44e0ff[_0x2d73('0x24')]);return _0x37461d(_0x44e0ff);});});})[_0x2d73('0x14')](function(_0xc6c74c){_0x33c8c4(_0xc6c74c);});});};}function createEndUser(_0x25ddd0,_0x3c13ac,_0x3a5c7c,_0x32fdc8){return new Promise(function(_0x2abe22,_0x1c5eca){var _0x4f99ed=moment();var _0x1ad1ed={'method':_0x2d73('0x28'),'uri':_0x32fdc8+'/api/contacts','body':{'contact':{'last_name':_0x25ddd0[_0x2d73('0x23')],'work_number':_0x25ddd0[_0x2d73('0x23')],'mobile_number':_0x25ddd0[_0x2d73('0x23')],'owner_id':_0x25ddd0['userId'],'created_at':_0x4f99ed[_0x2d73('0x22')](_0x2d73('0x29'))}},'json':!![]};_0x1ad1ed[_0x2d73('0xb')]=_0x3a5c7c;logger[_0x2d73('0xc')](_0x2d73('0x2a'));return rp(_0x1ad1ed)[_0x2d73('0xe')](function(_0x423b7f){_0x25ddd0['endUserId']=_0x423b7f['contact']['id'];_0x2abe22(_0x25ddd0);})[_0x2d73('0x14')](function(_0x27ae0e){logger[_0x2d73('0x15')]('['+[_0x3c13ac[_0x2d73('0x16')]()]+']',_0x27ae0e[_0x2d73('0x17')]);_0x1c5eca(_0x27ae0e[_0x2d73('0x17')]);});});}function getTicket(_0x47b084,_0x1c96fe,_0x5eb9fb,_0x2b103c,_0x2b16ef){return function(_0x9c2ae6){logger[_0x2d73('0xc')]('Creating\x20new\x20task');return new Promise(function(_0x4d387f,_0x457abe){var _0x1abeff=moment();var _0x38c4fa={'method':_0x2d73('0x28'),'uri':_0x5eb9fb+_0x2d73('0x2b'),'body':{'title':intUtil[_0x2d73('0x2c')](_0x2b103c['Subjects'],_0x2b16ef,'\x20'),'description':intUtil['getString'](_0x2b103c[_0x2d73('0x2d')],_0x2b16ef,'\x0a'),'owner_id':_0x9c2ae6[_0x2d73('0x1d')],'creater_id':_0x9c2ae6[_0x2d73('0x12')],'targetable_id':_0x9c2ae6[_0x2d73('0x24')],'targetable_type':_0x2d73('0x2e'),'created_at':_0x1abeff['format']('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x1abeff[_0x2d73('0x2f')](0x1e,'m')[_0x2d73('0x22')](_0x2d73('0x29'))},'json':!![]};_0x38c4fa[_0x2d73('0xb')]=_0x1c96fe;return rp(_0x38c4fa)['then'](function(_0x4711fd){_0x9c2ae6[_0x2d73('0x30')]=_0x4711fd[_0x2d73('0x31')]['id'];logger[_0x2d73('0xc')](_0x2d73('0x32'),_0x9c2ae6[_0x2d73('0x30')]);_0x4d387f(_0x9c2ae6);})[_0x2d73('0x14')](function(_0x3911ac){logger['error']('['+[_0x47b084[_0x2d73('0x16')]()]+']',_0x3911ac[_0x2d73('0x17')]);_0x457abe(_0x3911ac[_0x2d73('0x17')]);});});};}function emit(_0x19dcf2,_0x389b79,_0x1793a2){var _0x533076={'uri':_0x19dcf2+_0x2d73('0x33')+_0x1793a2};io['to'](util['format']('user:%s',_0x389b79))[_0x2d73('0x34')](_0x2d73('0x35'),_0x533076);}exports['cs']=function(_0x567ffc,_0x1d7753,_0x17ed22,_0x54cb17,_0x5e222d,_0x1ba8db,_0x5999f4,_0x73787d){var _0x4738b5={};var _0x25d0c7={'Authorization':_0x2d73('0x36')+_0x1ba8db['apiKey']};_0x1ba8db[_0x2d73('0x37')]=intUtil[_0x2d73('0x38')](_0x1ba8db[_0x2d73('0x37')]);_0x1ba8db[_0x2d73('0x39')]=intUtil[_0x2d73('0x38')](_0x1ba8db[_0x2d73('0x39')]);var _0x35fb6d=_0x1ba8db[_0x2d73('0x37')];_0x4738b5[_0x2d73('0x1f')]=_0x1ba8db[_0x2d73('0x3a')];_0x4738b5[_0x2d73('0x23')]=_0x73787d[_0x2d73('0x3b')]()===_0x2d73('0x3c')?_0x1d7753[_0x2d73('0x3d')]:_0x1d7753[_0x2d73('0x3e')];_0x4738b5[_0x2d73('0x3f')]=_0x73787d===_0x2d73('0x40')||_0x73787d===_0x2d73('0x41')?_0x2d73('0x40'):_0x2d73('0x3c');if(_0x54cb17){_0x4738b5[_0x2d73('0x19')]=_0x54cb17['email'];}var _0x52b36d=util['format'](_0x2d73('0x42'),_0x1ba8db[_0x2d73('0x39')],_0x1d7753[_0x2d73('0x43')],md5(_0x1d7753['uniqueid']));if(_0x5e222d&&_0x5e222d['monitor_format']){logger[_0x2d73('0xc')](_0x2d73('0x44'),'Recording\x20is\x20enabled!');_0x1d7753[_0x2d73('0x45')]=_0x52b36d;}else if(_0x5999f4&&_0x5999f4['recordingFormat']&&_0x5999f4[_0x2d73('0x46')]!==_0x2d73('0x47')){logger[_0x2d73('0xc')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x1d7753[_0x2d73('0x45')]=_0x52b36d;}else{_0x1d7753[_0x2d73('0x45')]='';}return getAdminId(_0x4738b5,_0x73787d,_0x25d0c7,_0x35fb6d)[_0x2d73('0xe')](getUser(_0x73787d,_0x25d0c7,_0x35fb6d))['then'](getEndUser(_0x73787d,_0x25d0c7,_0x35fb6d))['then'](getTicket(_0x73787d,_0x25d0c7,_0x35fb6d,_0x17ed22,_0x1d7753))[_0x2d73('0xe')](function(_0x5257ac){logger[_0x2d73('0xc')](util['format'](_0x2d73('0x48'),_0x5257ac[_0x2d73('0x30')]));if(_0x73787d!=='unmanaged'){logger[_0x2d73('0xc')]('['+[_0x73787d[_0x2d73('0x16')]()]+']',_0x2d73('0x49'));emit(_0x35fb6d,_0x54cb17[_0x2d73('0x4a')],_0x5257ac[_0x2d73('0x24')]);}})[_0x2d73('0x14')](function(_0x1c671f){logger[_0x2d73('0x15')]('['+[_0x73787d['toUpperCase']()]+_0x2d73('0x4b'),util[_0x2d73('0x4c')](_0x1c671f,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xe737=['serverUrl','username','toLowerCase','outbound','destcalleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','defaults','socket.io-emitter','redis','GET','/api/selector/owners','Getting\x20admin\x20information','then','users','email','adminEmail','adminId','info','Requested\x20Resource\x20not\x20Found','catch','error','message','headers','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','length','userId','User\x20found:','Admin\x20selected','userEmail','toUpperCase','&f=','&entities=contact','find','format','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','getString','Subjects','Descriptions','Contact','add','ticketId','Task\x20created:','emit','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','remoteUri'];(function(_0x318840,_0x561b1e){var _0x223da4=function(_0x510071){while(--_0x510071){_0x318840['push'](_0x318840['shift']());}};_0x223da4(++_0x561b1e);}(_0xe737,0x10c));var _0x7e73=function(_0x3284e1,_0x1708b7){_0x3284e1=_0x3284e1-0x0;var _0x25fb94=_0xe737[_0x3284e1];return _0x25fb94;};'use strict';var _=require(_0x7e73('0x0'));var rp=require('request-promise');var md5=require(_0x7e73('0x1'));var util=require(_0x7e73('0x2'));var moment=require(_0x7e73('0x3'));var Promise=require(_0x7e73('0x4'));var Redis=require(_0x7e73('0x5'));var intUtil=require(_0x7e73('0x6'));var config=require(_0x7e73('0x7'));var logger=require(_0x7e73('0x8'))(_0x7e73('0x9'));config['redis']=_[_0x7e73('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x7e73('0xb'))(new Redis(config[_0x7e73('0xc')]));function getAdminId(_0xd2f899,_0x9016b1,_0x3d0fc2,_0x598ec7){return new Promise(function(_0x102823,_0x4d1fc){var _0x371ee4=![];var _0x14e189={'method':_0x7e73('0xd'),'uri':_0x598ec7+_0x7e73('0xe'),'json':!![]};_0x14e189['headers']=_0x3d0fc2;logger['info'](_0x7e73('0xf'));return rp(_0x14e189)[_0x7e73('0x10')](function(_0x11d81a){if(_0x11d81a){var _0x140c25=_0x11d81a[_0x7e73('0x11')];var _0x285b7f=null;for(_0x285b7f=0x0;_0x285b7f<_0x140c25['length'];_0x285b7f++){if(_0x140c25[_0x285b7f][_0x7e73('0x12')]===_0xd2f899[_0x7e73('0x13')]){_0xd2f899[_0x7e73('0x14')]=_0x140c25[_0x285b7f]['id'];_0x371ee4=!![];}}if(_0x371ee4){logger[_0x7e73('0x15')]('Admin\x20found:',_0xd2f899[_0x7e73('0x14')]);_0x102823(_0xd2f899);}else{_0x4d1fc({'statusCode':0x194,'message':_0x7e73('0x16')});}}else{_0x4d1fc({'statusCode':0x194,'message':_0x7e73('0x16')});}})[_0x7e73('0x17')](function(_0x38f935){logger[_0x7e73('0x18')]('['+[_0x9016b1['toUpperCase']()]+']',_0x38f935[_0x7e73('0x19')]);_0x4d1fc(_0x38f935);});});}function getUser(_0x3c731c,_0x4fea1b,_0x3795cf){return function(_0x479fe8){return new Promise(function(_0x56896b,_0x2d244c){var _0x3fd13d={'method':_0x7e73('0xd'),'uri':_0x3795cf+_0x7e73('0xe'),'json':!![]};_0x3fd13d[_0x7e73('0x1a')]=_0x4fea1b;logger[_0x7e73('0x15')](_0x7e73('0x1b'));return rp(_0x3fd13d)[_0x7e73('0x10')](function(_0x26616c){if(_0x26616c){var _0x3f5227=_0x26616c[_0x7e73('0x11')];var _0x3751fb=![];var _0x33f8ec=null;if(_0x479fe8[_0x7e73('0x1c')]!==null){logger[_0x7e73('0x15')](_0x7e73('0x1d'),_0x479fe8[_0x7e73('0x1c')]);_0x479fe8['userEmail']=_0x479fe8[_0x7e73('0x1c')];for(_0x33f8ec=0x0;_0x33f8ec<_0x3f5227[_0x7e73('0x1e')];_0x33f8ec++){if(_0x3f5227[_0x33f8ec]['email']===_0x479fe8[_0x7e73('0x1c')]){_0x3751fb=!![];_0x479fe8[_0x7e73('0x1f')]=_0x3f5227[_0x33f8ec]['id'];logger['info'](_0x7e73('0x20'),_0x479fe8['userId']);}}}if(!_0x3751fb){logger['info'](_0x7e73('0x21'));_0x479fe8[_0x7e73('0x22')]=_0x479fe8[_0x7e73('0x13')];_0x479fe8[_0x7e73('0x1f')]=_0x479fe8['adminId'];_0x3751fb=!![];}if(_0x3751fb){_0x56896b(_0x479fe8);}else{_0x2d244c({'statusCode':0x194,'message':_0x7e73('0x16')});}}else{_0x2d244c({'statusCode':0x194,'message':_0x7e73('0x16')});}})['catch'](function(_0xb872a2){logger[_0x7e73('0x18')]('['+[_0x3c731c[_0x7e73('0x23')]()]+']',_0xb872a2[_0x7e73('0x19')]);_0x2d244c(_0xb872a2);});});};}function searchContact(_0x3aef87,_0x1d1b6c,_0x25ddc4,_0x1a7f26){return new Promise(function(_0x272350,_0x1f132f){var _0x10fb0e={'method':'GET','headers':_0x1d1b6c,'uri':_0x3aef87+'/api/lookup?q='+_0x1a7f26+_0x7e73('0x24')+_0x25ddc4+_0x7e73('0x25'),'json':!![]};rp(_0x10fb0e)[_0x7e73('0x10')](function(_0x4ceff5){var _0x78a160=_[_0x7e73('0x26')](_0x4ceff5['contacts']['contacts'],[_0x25ddc4,_0x1a7f26]);_0x272350(_0x78a160);})[_0x7e73('0x17')](function(_0x147de3){_0x1f132f(_0x147de3);});});}function getEndUser(_0x2c1ad9,_0xe15953,_0x21ffdd){return function(_0x2de93f){return new Promise(function(_0x211f83,_0x1da724){logger[_0x7e73('0x15')](util[_0x7e73('0x27')]('Searching\x20contact\x20with\x20phone\x20%s',_0x2de93f[_0x7e73('0x28')]));searchContact(_0x21ffdd,_0xe15953,_0x7e73('0x29'),_0x2de93f[_0x7e73('0x28')])['then'](function(_0x3d46cf){if(_0x3d46cf){_0x2de93f[_0x7e73('0x2a')]=_0x3d46cf['id'];logger[_0x7e73('0x15')](_0x7e73('0x2b'),_0x2de93f[_0x7e73('0x2a')]);return _0x211f83(_0x2de93f);}searchContact(_0x21ffdd,_0xe15953,_0x7e73('0x2c'),_0x2de93f['contactNumber'])['then'](function(_0x3b99f8){if(_0x3b99f8){_0x2de93f['endUserId']=_0x3b99f8['id'];logger['info']('Contact\x20found\x20work_number:',_0x2de93f[_0x7e73('0x2a')]);return _0x211f83(_0x2de93f);}createEndUser(_0x2de93f,_0x2c1ad9,_0xe15953,_0x21ffdd)[_0x7e73('0x10')](function(_0x1e349b){logger[_0x7e73('0x15')](_0x7e73('0x2d'),_0x1e349b[_0x7e73('0x2a')]);return _0x211f83(_0x1e349b);});});})['catch'](function(_0x4534a0){_0x1da724(_0x4534a0);});});};}function createEndUser(_0x8a24a4,_0x5442ec,_0x2264a0,_0x335e26){return new Promise(function(_0x2fe451,_0x1e0757){var _0x4a00b4=moment();var _0x803ecd={'method':_0x7e73('0x2e'),'uri':_0x335e26+_0x7e73('0x2f'),'body':{'contact':{'last_name':_0x8a24a4[_0x7e73('0x28')],'work_number':_0x8a24a4[_0x7e73('0x28')],'mobile_number':_0x8a24a4[_0x7e73('0x28')],'owner_id':_0x8a24a4[_0x7e73('0x1f')],'created_at':_0x4a00b4[_0x7e73('0x27')](_0x7e73('0x30'))}},'json':!![]};_0x803ecd[_0x7e73('0x1a')]=_0x2264a0;logger[_0x7e73('0x15')](_0x7e73('0x31'));return rp(_0x803ecd)[_0x7e73('0x10')](function(_0x1f82e1){_0x8a24a4[_0x7e73('0x2a')]=_0x1f82e1[_0x7e73('0x32')]['id'];_0x2fe451(_0x8a24a4);})[_0x7e73('0x17')](function(_0xf0925){logger[_0x7e73('0x18')]('['+[_0x5442ec[_0x7e73('0x23')]()]+']',_0xf0925[_0x7e73('0x19')]);_0x1e0757(_0xf0925['message']);});});}function getTicket(_0x20fb49,_0x3f1e85,_0x467d27,_0x132064,_0xb21b2e){return function(_0x2a5549){logger[_0x7e73('0x15')]('Creating\x20new\x20task');return new Promise(function(_0x26c5cc,_0x4c1dbf){var _0x571423=moment();var _0x5e167b={'method':_0x7e73('0x2e'),'uri':_0x467d27+'/api/tasks','body':{'title':intUtil[_0x7e73('0x33')](_0x132064[_0x7e73('0x34')],_0xb21b2e,'\x20'),'description':intUtil[_0x7e73('0x33')](_0x132064[_0x7e73('0x35')],_0xb21b2e,'\x0a'),'owner_id':_0x2a5549[_0x7e73('0x1f')],'creater_id':_0x2a5549[_0x7e73('0x14')],'targetable_id':_0x2a5549[_0x7e73('0x2a')],'targetable_type':_0x7e73('0x36'),'created_at':_0x571423['format'](_0x7e73('0x30')),'due_date':_0x571423[_0x7e73('0x37')](0x1e,'m')[_0x7e73('0x27')](_0x7e73('0x30'))},'json':!![]};_0x5e167b[_0x7e73('0x1a')]=_0x3f1e85;return rp(_0x5e167b)[_0x7e73('0x10')](function(_0x6175f9){_0x2a5549[_0x7e73('0x38')]=_0x6175f9['task']['id'];logger[_0x7e73('0x15')](_0x7e73('0x39'),_0x2a5549[_0x7e73('0x38')]);_0x26c5cc(_0x2a5549);})[_0x7e73('0x17')](function(_0x2a60fd){logger[_0x7e73('0x18')]('['+[_0x20fb49['toUpperCase']()]+']',_0x2a60fd[_0x7e73('0x19')]);_0x4c1dbf(_0x2a60fd[_0x7e73('0x19')]);});});};}function emit(_0x58711c,_0x5224bc,_0x5aee6e){var _0x1b01b6={'uri':_0x58711c+'/contacts/'+_0x5aee6e};io['to'](util[_0x7e73('0x27')]('user:%s',_0x5224bc))[_0x7e73('0x3a')](_0x7e73('0x3b'),_0x1b01b6);}exports['cs']=function(_0xc1b646,_0x3668fc,_0x3307b4,_0x553b83,_0x2d80af,_0x1db7c6,_0x1ad984,_0x1b7a94){var _0xd95b5f={};var _0x30c2a6={'Authorization':_0x7e73('0x3c')+_0x1db7c6[_0x7e73('0x3d')]};_0x1db7c6['remoteUri']=intUtil[_0x7e73('0x3e')](_0x1db7c6[_0x7e73('0x3f')]);_0x1db7c6[_0x7e73('0x40')]=intUtil[_0x7e73('0x3e')](_0x1db7c6[_0x7e73('0x40')]);var _0x177cf7=_0x1db7c6[_0x7e73('0x3f')];_0xd95b5f['adminEmail']=_0x1db7c6[_0x7e73('0x41')];_0xd95b5f[_0x7e73('0x28')]=_0x1b7a94[_0x7e73('0x42')]()===_0x7e73('0x43')?_0x3668fc[_0x7e73('0x44')]:_0x3668fc['calleridnum'];_0xd95b5f[_0x7e73('0x45')]=_0x1b7a94===_0x7e73('0x46')||_0x1b7a94===_0x7e73('0x47')?_0x7e73('0x46'):_0x7e73('0x43');if(_0x553b83){_0xd95b5f[_0x7e73('0x1c')]=_0x553b83[_0x7e73('0x12')];}var _0x4064db=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1db7c6[_0x7e73('0x40')],_0x3668fc['uniqueid'],md5(_0x3668fc[_0x7e73('0x48')]));if(_0x2d80af&&_0x2d80af[_0x7e73('0x49')]){logger['info'](_0x7e73('0x4a'),_0x7e73('0x4b'));_0x3668fc['recordingURL']=_0x4064db;}else if(_0x1ad984&&_0x1ad984['recordingFormat']&&_0x1ad984[_0x7e73('0x4c')]!==_0x7e73('0x4d')){logger[_0x7e73('0x15')]('[OUTBOUND]',_0x7e73('0x4b'));_0x3668fc[_0x7e73('0x4e')]=_0x4064db;}else{_0x3668fc['recordingURL']='';}return getAdminId(_0xd95b5f,_0x1b7a94,_0x30c2a6,_0x177cf7)['then'](getUser(_0x1b7a94,_0x30c2a6,_0x177cf7))[_0x7e73('0x10')](getEndUser(_0x1b7a94,_0x30c2a6,_0x177cf7))[_0x7e73('0x10')](getTicket(_0x1b7a94,_0x30c2a6,_0x177cf7,_0x3307b4,_0x3668fc))[_0x7e73('0x10')](function(_0x23bcdf){logger[_0x7e73('0x15')](util[_0x7e73('0x27')]('The\x20ticket\x20ID\x20is:\x20%s',_0x23bcdf[_0x7e73('0x38')]));if(_0x1b7a94!=='unmanaged'){logger[_0x7e73('0x15')]('['+[_0x1b7a94[_0x7e73('0x23')]()]+']',_0x7e73('0x4f'));emit(_0x177cf7,_0x553b83[_0x7e73('0x50')],_0x23bcdf['endUserId']);}})[_0x7e73('0x17')](function(_0x3a82a7){logger[_0x7e73('0x18')]('['+[_0x1b7a94[_0x7e73('0x23')]()]+_0x7e73('0x51'),util[_0x7e73('0x52')](_0x3a82a7,{'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 d68d4e8..7a5c410 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 _0x9d9b=['freshsales','servicenow','exec','includes','toLowerCase','data2','find','Configurations','data3','queue','log','unmanaged','salesforce','unknown\x20integration','../../../../config/logger','data1','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','util','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./servicenow','./dynamics365','zendesk','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365'];(function(_0x19847b,_0x409d17){var _0x5bb80b=function(_0x1fa324){while(--_0x1fa324){_0x19847b['push'](_0x19847b['shift']());}};_0x5bb80b(++_0x409d17);}(_0x9d9b,0x123));var _0xb9d9=function(_0x143c85,_0x49c973){_0x143c85=_0x143c85-0x0;var _0x48357f=_0x9d9b[_0x143c85];return _0x48357f;};'use strict';var _=require('lodash');var util=require(_0xb9d9('0x0'));var zendesk=require('./zendesk');var salesforce=require(_0xb9d9('0x1'));var sugarcrm=require(_0xb9d9('0x2'));var freshdesk=require(_0xb9d9('0x3'));var zoho=require(_0xb9d9('0x4'));var desk=require(_0xb9d9('0x5'));var vtiger=require('./vtiger');var servicenow=require(_0xb9d9('0x6'));var dynamics365=require(_0xb9d9('0x7'));var freshsales=require('./freshsales');var integrations=[_0xb9d9('0x8'),'salesforce',_0xb9d9('0x9'),_0xb9d9('0xa'),_0xb9d9('0xb'),_0xb9d9('0xc'),_0xb9d9('0xd'),_0xb9d9('0xe'),_0xb9d9('0xf'),_0xb9d9('0x10')];exports[_0xb9d9('0x11')]=function(_0x48e196,_0x2d960b,_0x2a0a44,_0x4f7763,_0x2f9c2e,_0x2996a4){if(_0x2a0a44){if(_[_0xb9d9('0x12')](integrations,_0x48e196['data1']['toLowerCase']())){try{var _0x4f9a16=null;var _0x12e5b6='';var _0x3c2ab6=_0x2a0a44[_0x48e196['data1'][_0xb9d9('0x13')]()];if(_0x3c2ab6){var _0x33f9c5=_0x3c2ab6[_0x48e196[_0xb9d9('0x14')]];if(_0x33f9c5){var _0x4c8166=_[_0xb9d9('0x15')](_0x33f9c5[_0xb9d9('0x16')],{'id':parseInt(_0x48e196[_0xb9d9('0x17')],0xa)});if(_0x4c8166){if(_0x4f7763){if(_0x2f9c2e&&_0x2d960b[_0xb9d9('0x18')]){_0x12e5b6=_0xb9d9('0x18');}else if(_0x2d960b['routeId']){_0x12e5b6='outbound';}else{console[_0xb9d9('0x19')]('EVENT\x20UNKNOWN',_0x2d960b);}}else{_0x12e5b6=_0xb9d9('0x1a');}switch(_0x48e196['data1'][_0xb9d9('0x13')]()){case _0xb9d9('0x8'):zendesk[_0x12e5b6](_0x48e196,_0x2d960b,_0x4c8166,_0x4f7763,_0x2f9c2e,_0x33f9c5,_0x2996a4);break;case _0xb9d9('0x1b'):salesforce[_0x12e5b6](_0x48e196,_0x2d960b,_0x4c8166,_0x4f7763,_0x2f9c2e,_0x33f9c5,_0x2996a4);break;case _0xb9d9('0x9'):sugarcrm[_0x12e5b6](_0x48e196,_0x2d960b,_0x4c8166,_0x4f7763,_0x2f9c2e,_0x33f9c5,_0x2996a4);break;case _0xb9d9('0xa'):freshdesk[_0x12e5b6](_0x48e196,_0x2d960b,_0x4c8166,_0x4f7763,_0x2f9c2e,_0x33f9c5,_0x2996a4);break;case _0xb9d9('0xb'):zoho[_0x12e5b6](_0x48e196,_0x2d960b,_0x4c8166,_0x4f7763,_0x2f9c2e,_0x33f9c5,_0x2996a4);break;case'desk':desk[_0x12e5b6](_0x48e196,_0x2d960b,_0x4c8166,_0x4f7763,_0x2f9c2e,_0x33f9c5,_0x2996a4);break;case _0xb9d9('0xd'):vtiger[_0x12e5b6](_0x48e196,_0x2d960b,_0x4c8166,_0x4f7763,_0x2f9c2e,_0x33f9c5,_0x2996a4);break;case _0xb9d9('0xf'):freshsales['cs'](_0x48e196,_0x2d960b,_0x4c8166,_0x4f7763,_0x2f9c2e,_0x33f9c5,_0x2996a4,_0x12e5b6);break;case _0xb9d9('0x10'):servicenow['cs'](_0x48e196,_0x2d960b,_0x4c8166,_0x4f7763,_0x2f9c2e,_0x33f9c5,_0x2996a4,_0x12e5b6);break;case _0xb9d9('0xe'):dynamics365['cs'](_0x48e196,_0x2d960b,_0x4c8166,_0x4f7763,_0x2f9c2e,_0x33f9c5,_0x2996a4,_0x12e5b6);break;default:console[_0xb9d9('0x19')](_0xb9d9('0x1c'));}}else{_0x4f9a16=require(_0xb9d9('0x1d'))(_0x48e196[_0xb9d9('0x1e')][_0xb9d9('0x13')]());_0x4f9a16[_0xb9d9('0x1f')](_0xb9d9('0x20'),util['format'](_0xb9d9('0x21'),_0x48e196[_0xb9d9('0x1e')][_0xb9d9('0x13')](),_0x48e196['data3']));}}else{_0x4f9a16=require('../../../../config/logger')(_0x48e196[_0xb9d9('0x1e')][_0xb9d9('0x13')]());_0x4f9a16[_0xb9d9('0x1f')]('[EXEC]',util['format']('%s\x20account\x20#%s\x20not\x20found',_0x48e196['data1'][_0xb9d9('0x13')](),_0x48e196[_0xb9d9('0x14')]));}}else{}}catch(_0xd715d5){console[_0xb9d9('0x1f')](_0xd715d5);}}}}; \ No newline at end of file +var _0x78ae=['./desk','./vtiger','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','servicenow','exec','includes','data1','toLowerCase','data2','find','queue','routeId','outbound','unmanaged','freshsales','dynamics365','log','unknown\x20integration','error','[EXEC]','../../../../config/logger','format','util','./zendesk','./salesforce','./sugarcrm','./freshdesk'];(function(_0x32f91c,_0xd7b30b){var _0x196e4e=function(_0x7c8125){while(--_0x7c8125){_0x32f91c['push'](_0x32f91c['shift']());}};_0x196e4e(++_0xd7b30b);}(_0x78ae,0x145));var _0xe78a=function(_0x349b5c,_0x55e5fa){_0x349b5c=_0x349b5c-0x0;var _0x3efcac=_0x78ae[_0x349b5c];return _0x3efcac;};'use strict';var _=require('lodash');var util=require(_0xe78a('0x0'));var zendesk=require(_0xe78a('0x1'));var salesforce=require(_0xe78a('0x2'));var sugarcrm=require(_0xe78a('0x3'));var freshdesk=require(_0xe78a('0x4'));var zoho=require('./zoho');var desk=require(_0xe78a('0x5'));var vtiger=require(_0xe78a('0x6'));var servicenow=require('./servicenow');var dynamics365=require('./dynamics365');var freshsales=require('./freshsales');var integrations=[_0xe78a('0x7'),_0xe78a('0x8'),_0xe78a('0x9'),_0xe78a('0xa'),_0xe78a('0xb'),_0xe78a('0xc'),_0xe78a('0xd'),'dynamics365','freshsales',_0xe78a('0xe')];exports[_0xe78a('0xf')]=function(_0x2b1d5b,_0x363c56,_0x5287bd,_0x71e76d,_0x135b78,_0x56e57d){if(_0x5287bd){if(_[_0xe78a('0x10')](integrations,_0x2b1d5b[_0xe78a('0x11')][_0xe78a('0x12')]())){try{var _0x4f2943=null;var _0x2cf3cf='';var _0x12ad2c=_0x5287bd[_0x2b1d5b[_0xe78a('0x11')]['toLowerCase']()];if(_0x12ad2c){var _0x55a8f8=_0x12ad2c[_0x2b1d5b[_0xe78a('0x13')]];if(_0x55a8f8){var _0x2bfb2c=_[_0xe78a('0x14')](_0x55a8f8['Configurations'],{'id':parseInt(_0x2b1d5b['data3'],0xa)});if(_0x2bfb2c){if(_0x71e76d){if(_0x135b78&&_0x363c56['queue']){_0x2cf3cf=_0xe78a('0x15');}else if(_0x363c56[_0xe78a('0x16')]){_0x2cf3cf=_0xe78a('0x17');}else{console['log']('EVENT\x20UNKNOWN',_0x363c56);}}else{_0x2cf3cf=_0xe78a('0x18');}switch(_0x2b1d5b[_0xe78a('0x11')][_0xe78a('0x12')]()){case _0xe78a('0x7'):zendesk[_0x2cf3cf](_0x2b1d5b,_0x363c56,_0x2bfb2c,_0x71e76d,_0x135b78,_0x55a8f8,_0x56e57d);break;case _0xe78a('0x8'):salesforce[_0x2cf3cf](_0x2b1d5b,_0x363c56,_0x2bfb2c,_0x71e76d,_0x135b78,_0x55a8f8,_0x56e57d);break;case'sugarcrm':sugarcrm[_0x2cf3cf](_0x2b1d5b,_0x363c56,_0x2bfb2c,_0x71e76d,_0x135b78,_0x55a8f8,_0x56e57d);break;case _0xe78a('0xa'):freshdesk[_0x2cf3cf](_0x2b1d5b,_0x363c56,_0x2bfb2c,_0x71e76d,_0x135b78,_0x55a8f8,_0x56e57d);break;case'zoho':zoho[_0x2cf3cf](_0x2b1d5b,_0x363c56,_0x2bfb2c,_0x71e76d,_0x135b78,_0x55a8f8,_0x56e57d);break;case _0xe78a('0xc'):desk[_0x2cf3cf](_0x2b1d5b,_0x363c56,_0x2bfb2c,_0x71e76d,_0x135b78,_0x55a8f8,_0x56e57d);break;case'vtiger':vtiger[_0x2cf3cf](_0x2b1d5b,_0x363c56,_0x2bfb2c,_0x71e76d,_0x135b78,_0x55a8f8,_0x56e57d);break;case _0xe78a('0x19'):freshsales['cs'](_0x2b1d5b,_0x363c56,_0x2bfb2c,_0x71e76d,_0x135b78,_0x55a8f8,_0x56e57d,_0x2cf3cf);break;case _0xe78a('0xe'):servicenow['cs'](_0x2b1d5b,_0x363c56,_0x2bfb2c,_0x71e76d,_0x135b78,_0x55a8f8,_0x56e57d,_0x2cf3cf);break;case _0xe78a('0x1a'):dynamics365['cs'](_0x2b1d5b,_0x363c56,_0x2bfb2c,_0x71e76d,_0x135b78,_0x55a8f8,_0x56e57d,_0x2cf3cf);break;default:console[_0xe78a('0x1b')](_0xe78a('0x1c'));}}else{_0x4f2943=require('../../../../config/logger')(_0x2b1d5b[_0xe78a('0x11')][_0xe78a('0x12')]());_0x4f2943[_0xe78a('0x1d')](_0xe78a('0x1e'),util['format']('%s\x20configuration\x20#%s\x20not\x20found',_0x2b1d5b[_0xe78a('0x11')][_0xe78a('0x12')](),_0x2b1d5b['data3']));}}else{_0x4f2943=require(_0xe78a('0x1f'))(_0x2b1d5b['data1'][_0xe78a('0x12')]());_0x4f2943[_0xe78a('0x1d')](_0xe78a('0x1e'),util[_0xe78a('0x20')]('%s\x20account\x20#%s\x20not\x20found',_0x2b1d5b[_0xe78a('0x11')]['toLowerCase'](),_0x2b1d5b[_0xe78a('0x13')]));}}else{}}catch(_0x2e6153){console[_0xe78a('0x1d')](_0x2e6153);}}}}; \ 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 435a663..d8e263a 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 _0xe3bc=['find','info','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','then','user_id','identity','display_name','moduleSearch','additionalSearchContact','merge','Contact','execute','length','cloneDeep','additionalSearchLead','$or','Lead','account_contact_lead','additionalSearchAccount','Account','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','forEach','includes','string','idField','content','variable','variableName','customVariable','Variable','name','toString','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','trigger:salesforce:display','user:%s','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','unmanaged','monitor_format','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','request-promise','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','localhost','emit','assign','Subjects','getString','ticketType','Task','utc','IsReminderSet','IsRecurrence','endUserType','lead','WhoId','account','WhatId','Case','contact','ContactId','AccountId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','isNil','validateEmail','sobject','User'];(function(_0x4d40dd,_0x39592b){var _0x1c51f2=function(_0x53e502){while(--_0x53e502){_0x4d40dd['push'](_0x4d40dd['shift']());}};_0x1c51f2(++_0x39592b);}(_0xe3bc,0xe2));var _0xce3b=function(_0x36f6be,_0x55ef9f){_0x36f6be=_0x36f6be-0x0;var _0x4f127=_0xe3bc[_0x36f6be];return _0x4f127;};'use strict';var _=require('lodash');var rp=require(_0xce3b('0x0'));var moment=require(_0xce3b('0x1'));var BPromise=require(_0xce3b('0x2'));var md5=require(_0xce3b('0x3'));var jsforce=require(_0xce3b('0x4'));var util=require(_0xce3b('0x5'));var Redis=require(_0xce3b('0x6'));var intUtil=require(_0xce3b('0x7'));var config=require(_0xce3b('0x8'));var logger=require(_0xce3b('0x9'))(_0xce3b('0xa'));config[_0xce3b('0xb')]=_['defaults'](config[_0xce3b('0xb')],{'host':_0xce3b('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xce3b('0xb')]));function emit(_0x9df1b5,_0x45bcfa,_0x12aa25){io['to'](_0x9df1b5)[_0xce3b('0xd')](_0x45bcfa,_0x12aa25);}function getTicket(_0x29b002,_0x32d7f6,_0x309f6d,_0x2086ba,_0x2a2bbc,_0x365d07,_0x55b8f1,_0x27468d){var _0x1bf376=Object[_0xce3b('0xe')]({},{'OwnerId':_0x32d7f6['id'],'Subject':intUtil['getString'](_0x2086ba[_0xce3b('0xf')],_0x2a2bbc,'\x20'),'Description':intUtil[_0xce3b('0x10')](_0x2086ba['Descriptions'],_0x2a2bbc,'\x0a')},getCustomFields(_0x365d07,_0x2a2bbc));if(_0x309f6d){if(_0x2086ba[_0xce3b('0x11')]===_0xce3b('0x12')){_0x1bf376['ActivityDate']=moment[_0xce3b('0x13')]();_0x1bf376[_0xce3b('0x14')]=![];_0x1bf376[_0xce3b('0x15')]=![];if(_0x309f6d[_0xce3b('0x16')]==='contact'||_0x309f6d[_0xce3b('0x16')]===_0xce3b('0x17')){_0x1bf376[_0xce3b('0x18')]=_0x309f6d['id'];}else if(_0x309f6d[_0xce3b('0x16')]===_0xce3b('0x19')){_0x1bf376[_0xce3b('0x1a')]=_0x309f6d['id'];}}else if(_0x2086ba[_0xce3b('0x11')]===_0xce3b('0x1b')){if(_0x309f6d[_0xce3b('0x16')]===_0xce3b('0x1c')){_0x1bf376[_0xce3b('0x1d')]=_0x309f6d['id'];}else if(_0x309f6d[_0xce3b('0x16')]==='account'){_0x1bf376[_0xce3b('0x1e')]=_0x309f6d['id'];}else if(_0x309f6d[_0xce3b('0x16')]==='lead'&&_0x2086ba[_0xce3b('0x1f')]){_0x1bf376[_0x2086ba['leadId']]=_0x309f6d['id'];}else{logger['info'](_0xce3b('0x20'));}}}return _0x55b8f1['sobject'](_0x2086ba[_0xce3b('0x11')])[_0xce3b('0x21')](_0x1bf376);}function getUser(_0x1dff04,_0x434fc7,_0x415ff1){if(!_[_0xce3b('0x22')](_0x434fc7)&&intUtil[_0xce3b('0x23')](_0x434fc7)){var _0x1d763c={'Email':_0x434fc7};var _0x55aec7={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x415ff1[_0xce3b('0x24')](_0xce3b('0x25'))['find'](_0x1d763c,_0x55aec7)['execute']()['then'](function(_0x11cfc9){if(_0x11cfc9['length']){var _0x2bd96e=_[_0xce3b('0x26')](_0x11cfc9,function(_0x24498e){return _0x24498e['Email']===_0x434fc7;});if(_0x2bd96e){logger[_0xce3b('0x27')](_0xce3b('0x28'),_0x434fc7);return BPromise[_0xce3b('0x29')]({'id':_0x2bd96e['Id'],'name':_0x2bd96e[_0xce3b('0x2a')]});}}else{logger[_0xce3b('0x27')](_0xce3b('0x2b'),_0x434fc7);return _0x415ff1['identity']()[_0xce3b('0x2c')](function(_0x41380c){return BPromise[_0xce3b('0x29')]({'id':_0x41380c[_0xce3b('0x2d')],'name':_0x41380c['display_name']});});}});}else{logger[_0xce3b('0x27')](_0xce3b('0x2b'),_0x434fc7);return _0x415ff1[_0xce3b('0x2e')]()[_0xce3b('0x2c')](function(_0x1d40c4){return BPromise[_0xce3b('0x29')]({'id':_0x1d40c4[_0xce3b('0x2d')],'name':_0x1d40c4[_0xce3b('0x2f')]});});}}function getEndUser(_0x43229b,_0x595c7e,_0x35ad44,_0x2609da,_0x38ac1f){var _0x24188c={'$or':{'Phone':_0x2609da}};var _0x58e960={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xce3b('0x29')]()[_0xce3b('0x2c')](function(){logger[_0xce3b('0x27')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x2609da,_0x595c7e[_0xce3b('0x30')]);switch(_0x595c7e['moduleSearch']){case'contact_lead':var _0x3b151a=_['cloneDeep'](_0x24188c);if(_0x595c7e[_0xce3b('0x31')]){var _0x105cb2={};_0x105cb2[_0x595c7e['additionalSearchContact']]=_0x2609da;_[_0xce3b('0x32')](_0x3b151a['$or'],_0x105cb2);}return _0x38ac1f[_0xce3b('0x24')](_0xce3b('0x33'))[_0xce3b('0x26')](_0x3b151a,_0x58e960)[_0xce3b('0x34')]()[_0xce3b('0x2c')](function(_0x141125){if(_0x141125&&_0x141125[_0xce3b('0x35')]){return _0x141125;}else{var _0x138c33=_[_0xce3b('0x36')](_0x24188c);if(_0x595c7e[_0xce3b('0x37')]){var _0x1dfd39={};_0x1dfd39[_0x595c7e[_0xce3b('0x37')]]=_0x2609da;_[_0xce3b('0x32')](_0x138c33[_0xce3b('0x38')],_0x1dfd39);}return _0x38ac1f[_0xce3b('0x24')](_0xce3b('0x39'))[_0xce3b('0x26')](_0x138c33,_0x58e960);}});case _0xce3b('0x3a'):var _0xa8d6f0=_[_0xce3b('0x36')](_0x24188c);if(_0x595c7e['additionalSearchAccount']){var _0x105cb2={};_0x105cb2[_0x595c7e[_0xce3b('0x3b')]]=_0x2609da;_[_0xce3b('0x32')](_0xa8d6f0[_0xce3b('0x38')],_0x105cb2);}return _0x38ac1f[_0xce3b('0x24')](_0xce3b('0x3c'))['find'](_0xa8d6f0,_0x58e960)['execute']()[_0xce3b('0x2c')](function(_0x5bad30){if(_0x5bad30&&_0x5bad30['length']){return _0x5bad30;}else{var _0x51c1f1=_[_0xce3b('0x36')](_0x24188c);if(_0x595c7e[_0xce3b('0x31')]){var _0x6a5514={};_0x6a5514[_0x595c7e[_0xce3b('0x31')]]=_0x2609da;_[_0xce3b('0x32')](_0x51c1f1['$or'],_0x6a5514);}return _0x38ac1f['sobject'](_0xce3b('0x33'))[_0xce3b('0x26')](_0x51c1f1,_0x58e960)['then'](function(_0x3d4529){if(_0x3d4529&&_0x3d4529['length']){return _0x3d4529;}else{var _0x1f6772=_[_0xce3b('0x36')](_0x24188c);if(_0x595c7e['additionalSearchLead']){var _0x2bae26={};_0x2bae26[_0x595c7e['additionalSearchLead']]=_0x2609da;_[_0xce3b('0x32')](_0x1f6772[_0xce3b('0x38')],_0x2bae26);}return _0x38ac1f[_0xce3b('0x24')](_0xce3b('0x39'))[_0xce3b('0x26')](_0x1f6772,_0x58e960);}});}});case _0xce3b('0x1c'):var _0x3b151a=_[_0xce3b('0x36')](_0x24188c);if(_0x595c7e['additionalSearchContact']){var _0x105cb2={};_0x105cb2[_0x595c7e[_0xce3b('0x31')]]=_0x2609da;_[_0xce3b('0x32')](_0x3b151a[_0xce3b('0x38')],_0x105cb2);}return _0x38ac1f[_0xce3b('0x24')](_0xce3b('0x33'))[_0xce3b('0x26')](_0x3b151a,_0x58e960)[_0xce3b('0x34')]();case'lead':var _0x5658d1=_[_0xce3b('0x36')](_0x24188c);if(_0x595c7e['additionalSearchLead']){var _0x105cb2={};_0x105cb2[_0x595c7e['additionalSearchLead']]=_0x2609da;_[_0xce3b('0x32')](_0x5658d1[_0xce3b('0x38')],_0x105cb2);}return _0x38ac1f[_0xce3b('0x24')](_0xce3b('0x39'))[_0xce3b('0x26')](_0x5658d1,_0x58e960);case _0xce3b('0x19'):var _0xa8d6f0=_[_0xce3b('0x36')](_0x24188c);if(_0x595c7e[_0xce3b('0x3b')]){var _0x105cb2={};_0x105cb2[_0x595c7e['additionalSearchAccount']]=_0x2609da;_[_0xce3b('0x32')](_0xa8d6f0[_0xce3b('0x38')],_0x105cb2);}return _0x38ac1f[_0xce3b('0x24')](_0xce3b('0x3c'))[_0xce3b('0x26')](_0xa8d6f0,_0x58e960);default:return null;}})[_0xce3b('0x2c')](function(_0x42673e){if(_0x42673e&&_0x42673e['length']){var _0x2d1260=_[_0xce3b('0x3d')](_0x42673e);if(_0x2d1260){return BPromise['resolve']({'id':_0x2d1260['Id'],'name':_0x2d1260[_0xce3b('0x2a')],'phone':_0x2d1260[_0xce3b('0x3e')],'endUserType':_0x2d1260[_0xce3b('0x3f')][_0xce3b('0x40')][_0xce3b('0x41')]()});}}})[_0xce3b('0x2c')](function(_0x296a56){if(_0x296a56){logger[_0xce3b('0x27')](_0xce3b('0x42'),_0x296a56[_0xce3b('0x16')],_0x2609da);return BPromise[_0xce3b('0x29')](_0x296a56);}else{logger[_0xce3b('0x27')](_0xce3b('0x43'),_0x2609da);var _0xb596db={'Phone':_0x2609da};if(_0x595c7e[_0xce3b('0x44')]){if(_0x595c7e['moduleCreate']===_0xce3b('0x1c')){logger[_0xce3b('0x27')](_0xce3b('0x45'),_0x2609da,_0x595c7e[_0xce3b('0x44')]);_0xb596db[_0xce3b('0x46')]=_0x35ad44!==_0xce3b('0x47')?_0x35ad44:util[_0xce3b('0x48')](_0xce3b('0x49'),_0x2609da);}else if(_0x595c7e[_0xce3b('0x44')]==='lead'){logger[_0xce3b('0x27')](_0xce3b('0x45'),_0x2609da,_0x595c7e['moduleCreate']);_0xb596db[_0xce3b('0x46')]=_0x35ad44!==_0xce3b('0x47')?_0x35ad44:util[_0xce3b('0x48')](_0xce3b('0x49'),_0x2609da);_0xb596db[_0xce3b('0x4a')]=_0xce3b('0x4b');}else if(_0x595c7e[_0xce3b('0x44')]===_0xce3b('0x19')){logger[_0xce3b('0x27')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x2609da,_0x595c7e[_0xce3b('0x44')]);_0xb596db[_0xce3b('0x2a')]=_0x35ad44!==_0xce3b('0x47')?_0x35ad44:util[_0xce3b('0x48')](_0xce3b('0x49'),_0x2609da);}else{return null;}}return _0x38ac1f['sobject'](_[_0xce3b('0x4c')](_0x595c7e['moduleCreate']))[_0xce3b('0x21')](_0xb596db)[_0xce3b('0x2c')](function(_0x4e37a5){return BPromise['resolve']({'id':_0x4e37a5['id'],'endUserType':_0x595c7e['moduleCreate']});});}});}function getCustomFields(_0x45e9f2,_0x49b9e8){var _0x4dca2f={};if(_0x45e9f2[_0xce3b('0x35')]>0x0){_[_0xce3b('0x4d')](_0x45e9f2,function(_0x1d5842){if(_[_0xce3b('0x4e')]([_0xce3b('0x4f'),'picklist'],_0x1d5842[_0xce3b('0x40')])&&_0x1d5842['idField']){_0x4dca2f[_0x1d5842[_0xce3b('0x50')]]=_0x1d5842[_0xce3b('0x51')]['toString']();}else if(_0x1d5842[_0xce3b('0x40')]===_0xce3b('0x52')&&_0x1d5842[_0xce3b('0x53')]&&_0x1d5842['idField']){_0x49b9e8[_0x1d5842[_0xce3b('0x53')]]&&(_0x4dca2f[_0x1d5842[_0xce3b('0x50')]]=_0x49b9e8[_0x1d5842[_0xce3b('0x53')]]['toString']());}else if(_0x1d5842[_0xce3b('0x40')]===_0xce3b('0x54')&&_0x1d5842[_0xce3b('0x55')]&&_0x1d5842[_0xce3b('0x55')][_0xce3b('0x56')]&&_0x1d5842['idField']){_0x49b9e8[_0x1d5842['Variable'][_0xce3b('0x56')][_0xce3b('0x41')]()]&&(_0x4dca2f[_0x1d5842['idField']]=_0x49b9e8[_0x1d5842[_0xce3b('0x55')]['name']['toLowerCase']()][_0xce3b('0x57')]());}});}return _0x4dca2f;}function getConnection(_0x558f18){var _0x444501=_0x558f18[_0xce3b('0x58')][_0xce3b('0x59')](_0x558f18[_0xce3b('0x5a')]);var _0x2aebe2=new jsforce[(_0xce3b('0x5b'))]({'oauth2':{'loginUrl':_0x558f18[_0xce3b('0x5c')]||_0xce3b('0x5d'),'clientId':_0x558f18[_0xce3b('0x5e')],'clientSecret':_0x558f18[_0xce3b('0x5f')]}});return _0x2aebe2['login'](_0x558f18[_0xce3b('0x60')],_0x444501)[_0xce3b('0x2c')](function(){logger[_0xce3b('0x27')](_0xce3b('0x61'));return _0x2aebe2;});}exports[_0xce3b('0x62')]=function(_0x3b0b7c,_0x32b157,_0x4fab84,_0x544fbb,_0x38534c,_0x554973){var _0x311628,_0x6bfcb,_0xe31bc,_0x56e3a6;_0x554973[_0xce3b('0x63')]=intUtil[_0xce3b('0x64')](_0x554973[_0xce3b('0x63')]);_0x554973[_0xce3b('0x5c')]=intUtil[_0xce3b('0x64')](_0x554973[_0xce3b('0x5c')]);if(_0x38534c&&_0x38534c['monitor_format']){logger[_0xce3b('0x27')]('[QUEUE]',_0xce3b('0x65'));_0x32b157[_0xce3b('0x66')]=util['format'](_0xce3b('0x67'),_0x554973[_0xce3b('0x63')],_0x32b157[_0xce3b('0x68')],md5(_0x32b157[_0xce3b('0x68')]));}else{_0x32b157[_0xce3b('0x66')]='';}return getConnection(_0x554973)['then'](function(_0x813c40){_0x56e3a6=_0x813c40;return getUser(_0x554973,_0x544fbb[_0xce3b('0x69')],_0x56e3a6);})[_0xce3b('0x2c')](function(_0x2cb4cc){_0x311628=_0x2cb4cc;return getEndUser(_0x554973,_0x4fab84,_0x32b157[_0xce3b('0x6a')],_0x32b157[_0xce3b('0x6b')],_0x56e3a6);})[_0xce3b('0x2c')](function(_0x1ab485){_0x6bfcb=_0x1ab485;return getTicket(_0x554973,_0x311628,_0x6bfcb,_0x4fab84,_0x32b157,_0x4fab84[_0xce3b('0x6c')],_0x56e3a6,'queue');})[_0xce3b('0x2c')](function(_0x7cc784){_0xe31bc=_0x7cc784;logger[_0xce3b('0x27')](_0xce3b('0x6d'),_0xe31bc['id']);logger['info']('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0xe31bc['id'],_0x544fbb[_0xce3b('0x56')],_0x554973[_0xce3b('0x40')]);switch(_0x554973[_0xce3b('0x40')]){case _0xce3b('0x6e'):emit(util['format']('user:%s',_0x544fbb[_0xce3b('0x56')]),_0xce3b('0x6f'),{'recordId':_0xe31bc['id']});break;case'newTab':emit(util[_0xce3b('0x48')](_0xce3b('0x70'),_0x544fbb['name']),'trigger:browser:url',{'uri':util[_0xce3b('0x48')](_0xce3b('0x71'),_0x56e3a6[_0xce3b('0x72')],_0xe31bc['id'])});break;default:logger[_0xce3b('0x73')](_0xce3b('0x74'));}})[_0xce3b('0x75')](function(_0x11266b){logger['error']('[QUEUE]',_0x11266b);});};exports[_0xce3b('0x76')]=function(_0x1d082f,_0x23d1ae,_0x1f6d39,_0x48a2ff,_0x2c087a,_0x317fb2,_0x2d5475){var _0x4e1672,_0x2f87bc,_0x4c44db,_0x4e2cbb;_0x317fb2[_0xce3b('0x63')]=intUtil[_0xce3b('0x64')](_0x317fb2['serverUrl']);_0x317fb2['remoteUri']=intUtil['stripTrailingSlash'](_0x317fb2[_0xce3b('0x5c')]);if(_0x2d5475&&_0x2d5475[_0xce3b('0x77')]&&_0x2d5475[_0xce3b('0x77')]!==_0xce3b('0x78')){logger[_0xce3b('0x27')](_0xce3b('0x79'),_0xce3b('0x65'));_0x23d1ae[_0xce3b('0x66')]=util[_0xce3b('0x48')](_0xce3b('0x67'),_0x317fb2['serverUrl'],_0x23d1ae[_0xce3b('0x68')],md5(_0x23d1ae[_0xce3b('0x68')]));}return getConnection(_0x317fb2)[_0xce3b('0x2c')](function(_0x4a3df3){_0x4e2cbb=_0x4a3df3;return getUser(_0x317fb2,_0x48a2ff[_0xce3b('0x69')],_0x4e2cbb);})[_0xce3b('0x2c')](function(_0x3499ab){_0x4e1672=_0x3499ab;return getEndUser(_0x317fb2,_0x1f6d39,_0x23d1ae[_0xce3b('0x7a')],_0x23d1ae['destcalleridnum'],_0x4e2cbb);})[_0xce3b('0x2c')](function(_0x4e572f){_0x2f87bc=_0x4e572f;return getTicket(_0x317fb2,_0x4e1672,_0x2f87bc,_0x1f6d39,_0x23d1ae,_0x1f6d39[_0xce3b('0x6c')],_0x4e2cbb,_0xce3b('0x76'));})[_0xce3b('0x2c')](function(_0x583e1d){_0x4c44db=_0x583e1d;logger[_0xce3b('0x27')](_0xce3b('0x7b'),_0x4c44db['id']);logger['info'](_0xce3b('0x7c'),_0x4c44db['id'],_0x48a2ff[_0xce3b('0x56')],_0x317fb2['type']);switch(_0x317fb2[_0xce3b('0x40')]){case _0xce3b('0x6e'):emit(util[_0xce3b('0x48')](_0xce3b('0x70'),_0x48a2ff[_0xce3b('0x56')]),_0xce3b('0x6f'),{'recordId':_0x4c44db['id']});break;case _0xce3b('0x7d'):emit(util[_0xce3b('0x48')](_0xce3b('0x70'),_0x48a2ff[_0xce3b('0x56')]),'trigger:browser:url',{'uri':util[_0xce3b('0x48')](_0xce3b('0x71'),_0x4e2cbb[_0xce3b('0x72')],_0x4c44db['id'])});break;default:logger[_0xce3b('0x73')](_0xce3b('0x79'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0xce3b('0x75')](function(_0x1ca6fe){logger[_0xce3b('0x73')](_0xce3b('0x79'),_0x1ca6fe);});};exports[_0xce3b('0x7e')]=function(_0x244f27,_0x44c857,_0x3ad8a5,_0x4a645a,_0x1aa82e,_0x14bdfa){var _0x4511d5,_0x3f8289,_0x342af4,_0xe1c3cb;_0x14bdfa[_0xce3b('0x63')]=intUtil[_0xce3b('0x64')](_0x14bdfa['serverUrl']);_0x14bdfa[_0xce3b('0x5c')]=intUtil[_0xce3b('0x64')](_0x14bdfa[_0xce3b('0x5c')]);if(_0x1aa82e&&_0x1aa82e[_0xce3b('0x7f')]){logger['info']('['+_0x44c857[_0xce3b('0x80')]['toUpperCase']()+']',_0xce3b('0x65'));_0x44c857[_0xce3b('0x66')]=util[_0xce3b('0x48')](_0xce3b('0x67'),_0x14bdfa[_0xce3b('0x63')],_0x44c857[_0xce3b('0x68')],md5(_0x44c857[_0xce3b('0x68')]));}else{_0x44c857[_0xce3b('0x66')]='';}return getConnection(_0x14bdfa)[_0xce3b('0x2c')](function(_0x53b6c1){_0xe1c3cb=_0x53b6c1;if(!_[_0xce3b('0x22')](_0x4a645a)){return getUser(_0x14bdfa,_0x4a645a[_0xce3b('0x56')],_0xe1c3cb);}else{return getUser(_0x14bdfa,null,_0xe1c3cb);}})['then'](function(_0x19fe43){_0x4511d5=_0x19fe43;return getEndUser(_0x14bdfa,_0x3ad8a5,_0x44c857[_0xce3b('0x6a')],_0x44c857[_0xce3b('0x6b')],_0xe1c3cb);})[_0xce3b('0x2c')](function(_0x2bc0f6){_0x3f8289=_0x2bc0f6;return getTicket(_0x14bdfa,_0x4511d5,_0x3f8289,_0x3ad8a5,_0x44c857,_0x3ad8a5[_0xce3b('0x6c')],_0xe1c3cb);})[_0xce3b('0x2c')](function(_0x51d3e7){_0x342af4=_0x51d3e7;logger[_0xce3b('0x27')]('['+_0x44c857[_0xce3b('0x80')][_0xce3b('0x81')]()+_0xce3b('0x82'),_0x342af4['id']);logger[_0xce3b('0x27')]('['+_0x44c857[_0xce3b('0x80')][_0xce3b('0x81')]()+_0xce3b('0x83'),_0x14bdfa[_0xce3b('0x40')]);})[_0xce3b('0x75')](function(_0x2bb356){logger[_0xce3b('0x73')]('['+_0x44c857[_0xce3b('0x80')][_0xce3b('0x81')]()+']',_0x2bb356);});}; \ No newline at end of file +var _0xf904=['IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','ticketType','isNil','sobject','User','find','execute','then','Email','Agent\x20%s\x20found.','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','additionalSearchAccount','Account','length','Name','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','format','','Caller\x20-\x20%s','Company','upperFirst','create','forEach','includes','string','idField','content','toString','variable','variableName','Variable','name','password','concat','securityToken','Connection','https://login.salesforce.com','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','trigger:browser:url','instanceUrl','error','outbound','recordingFormat','none','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','Salesforce\x20account\x20type\x20not\x20recognized','catch','[OUTBOUND]','unmanaged','lastevent','toUpperCase','calleridname',']\x20Ticket\x20%s\x20created.','lodash','request-promise','moment','bluebird','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','emit','assign','getString','Subjects','Descriptions','Task','ActivityDate','IsReminderSet'];(function(_0x2da198,_0x8610e6){var _0x7ce9cd=function(_0x1ea470){while(--_0x1ea470){_0x2da198['push'](_0x2da198['shift']());}};_0x7ce9cd(++_0x8610e6);}(_0xf904,0x6d));var _0x4f90=function(_0x15da77,_0x10872e){_0x15da77=_0x15da77-0x0;var _0x49642c=_0xf904[_0x15da77];return _0x49642c;};'use strict';var _=require(_0x4f90('0x0'));var rp=require(_0x4f90('0x1'));var moment=require(_0x4f90('0x2'));var BPromise=require(_0x4f90('0x3'));var md5=require('md5');var jsforce=require(_0x4f90('0x4'));var util=require(_0x4f90('0x5'));var Redis=require(_0x4f90('0x6'));var intUtil=require(_0x4f90('0x7'));var config=require(_0x4f90('0x8'));var logger=require(_0x4f90('0x9'))(_0x4f90('0xa'));config[_0x4f90('0xb')]=_[_0x4f90('0xc')](config['redis'],{'host':_0x4f90('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4f90('0xb')]));function emit(_0x5c71d6,_0x319a91,_0xfb18dc){io['to'](_0x5c71d6)[_0x4f90('0xe')](_0x319a91,_0xfb18dc);}function getTicket(_0x1b011d,_0x24eee0,_0x23d8ca,_0x258c50,_0x44daf5,_0x1a6590,_0x6da39f,_0x3e11d7){var _0x87e1e3=Object[_0x4f90('0xf')]({},{'OwnerId':_0x24eee0['id'],'Subject':intUtil[_0x4f90('0x10')](_0x258c50[_0x4f90('0x11')],_0x44daf5,'\x20'),'Description':intUtil[_0x4f90('0x10')](_0x258c50[_0x4f90('0x12')],_0x44daf5,'\x0a')},getCustomFields(_0x1a6590,_0x44daf5));if(_0x23d8ca){if(_0x258c50['ticketType']===_0x4f90('0x13')){_0x87e1e3[_0x4f90('0x14')]=moment['utc']();_0x87e1e3[_0x4f90('0x15')]=![];_0x87e1e3[_0x4f90('0x16')]=![];if(_0x23d8ca[_0x4f90('0x17')]===_0x4f90('0x18')||_0x23d8ca[_0x4f90('0x17')]===_0x4f90('0x19')){_0x87e1e3[_0x4f90('0x1a')]=_0x23d8ca['id'];}else if(_0x23d8ca[_0x4f90('0x17')]===_0x4f90('0x1b')){_0x87e1e3[_0x4f90('0x1c')]=_0x23d8ca['id'];}}else if(_0x258c50['ticketType']===_0x4f90('0x1d')){if(_0x23d8ca[_0x4f90('0x17')]===_0x4f90('0x18')){_0x87e1e3[_0x4f90('0x1e')]=_0x23d8ca['id'];}else if(_0x23d8ca[_0x4f90('0x17')]===_0x4f90('0x1b')){_0x87e1e3[_0x4f90('0x1f')]=_0x23d8ca['id'];}else if(_0x23d8ca[_0x4f90('0x17')]===_0x4f90('0x19')&&_0x258c50[_0x4f90('0x20')]){_0x87e1e3[_0x258c50[_0x4f90('0x20')]]=_0x23d8ca['id'];}else{logger[_0x4f90('0x21')](_0x4f90('0x22'));}}}return _0x6da39f['sobject'](_0x258c50[_0x4f90('0x23')])['create'](_0x87e1e3);}function getUser(_0x451d36,_0x3d2d8d,_0x21b25b){if(!_[_0x4f90('0x24')](_0x3d2d8d)&&intUtil['validateEmail'](_0x3d2d8d)){var _0x3903a7={'Email':_0x3d2d8d};var _0xde99fc={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x21b25b[_0x4f90('0x25')](_0x4f90('0x26'))[_0x4f90('0x27')](_0x3903a7,_0xde99fc)[_0x4f90('0x28')]()[_0x4f90('0x29')](function(_0x48cd6b){if(_0x48cd6b['length']){var _0x67e39=_[_0x4f90('0x27')](_0x48cd6b,function(_0x134d89){return _0x134d89[_0x4f90('0x2a')]===_0x3d2d8d;});if(_0x67e39){logger[_0x4f90('0x21')](_0x4f90('0x2b'),_0x3d2d8d);return BPromise[_0x4f90('0x2c')]({'id':_0x67e39['Id'],'name':_0x67e39['Name']});}}else{logger[_0x4f90('0x21')](_0x4f90('0x2d'),_0x3d2d8d);return _0x21b25b[_0x4f90('0x2e')]()[_0x4f90('0x29')](function(_0x5c83bd){return BPromise[_0x4f90('0x2c')]({'id':_0x5c83bd[_0x4f90('0x2f')],'name':_0x5c83bd['display_name']});});}});}else{logger[_0x4f90('0x21')](_0x4f90('0x2d'),_0x3d2d8d);return _0x21b25b[_0x4f90('0x2e')]()[_0x4f90('0x29')](function(_0x53115f){return BPromise[_0x4f90('0x2c')]({'id':_0x53115f[_0x4f90('0x2f')],'name':_0x53115f[_0x4f90('0x30')]});});}}function getEndUser(_0x2ebdd8,_0x7801a,_0x40f488,_0x2e2477,_0x3e45f2){var _0xaf6b8b={'$or':{'Phone':_0x2e2477}};var _0x2990b8={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()['then'](function(){logger[_0x4f90('0x21')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x2e2477,_0x7801a[_0x4f90('0x31')]);switch(_0x7801a[_0x4f90('0x31')]){case _0x4f90('0x32'):var _0x21fb18=_[_0x4f90('0x33')](_0xaf6b8b);if(_0x7801a[_0x4f90('0x34')]){var _0x47b449={};_0x47b449[_0x7801a[_0x4f90('0x34')]]=_0x2e2477;_[_0x4f90('0x35')](_0x21fb18[_0x4f90('0x36')],_0x47b449);}return _0x3e45f2['sobject'](_0x4f90('0x37'))['find'](_0x21fb18,_0x2990b8)['execute']()['then'](function(_0x9671b2){if(_0x9671b2&&_0x9671b2['length']){return _0x9671b2;}else{var _0x4f3edf=_[_0x4f90('0x33')](_0xaf6b8b);if(_0x7801a[_0x4f90('0x38')]){var _0x1581be={};_0x1581be[_0x7801a[_0x4f90('0x38')]]=_0x2e2477;_[_0x4f90('0x35')](_0x4f3edf['$or'],_0x1581be);}return _0x3e45f2[_0x4f90('0x25')](_0x4f90('0x39'))[_0x4f90('0x27')](_0x4f3edf,_0x2990b8);}});case'account_contact_lead':var _0x15bb86=_[_0x4f90('0x33')](_0xaf6b8b);if(_0x7801a['additionalSearchAccount']){var _0x47b449={};_0x47b449[_0x7801a[_0x4f90('0x3a')]]=_0x2e2477;_[_0x4f90('0x35')](_0x15bb86['$or'],_0x47b449);}return _0x3e45f2[_0x4f90('0x25')](_0x4f90('0x3b'))[_0x4f90('0x27')](_0x15bb86,_0x2990b8)[_0x4f90('0x28')]()['then'](function(_0x217231){if(_0x217231&&_0x217231['length']){return _0x217231;}else{var _0x39505b=_['cloneDeep'](_0xaf6b8b);if(_0x7801a['additionalSearchContact']){var _0x53a6a9={};_0x53a6a9[_0x7801a[_0x4f90('0x34')]]=_0x2e2477;_[_0x4f90('0x35')](_0x39505b['$or'],_0x53a6a9);}return _0x3e45f2['sobject']('Contact')[_0x4f90('0x27')](_0x39505b,_0x2990b8)['then'](function(_0x512b5c){if(_0x512b5c&&_0x512b5c[_0x4f90('0x3c')]){return _0x512b5c;}else{var _0x1c3fd1=_[_0x4f90('0x33')](_0xaf6b8b);if(_0x7801a['additionalSearchLead']){var _0xeca6c8={};_0xeca6c8[_0x7801a[_0x4f90('0x38')]]=_0x2e2477;_[_0x4f90('0x35')](_0x1c3fd1[_0x4f90('0x36')],_0xeca6c8);}return _0x3e45f2['sobject']('Lead')[_0x4f90('0x27')](_0x1c3fd1,_0x2990b8);}});}});case _0x4f90('0x18'):var _0x21fb18=_[_0x4f90('0x33')](_0xaf6b8b);if(_0x7801a[_0x4f90('0x34')]){var _0x47b449={};_0x47b449[_0x7801a[_0x4f90('0x34')]]=_0x2e2477;_['merge'](_0x21fb18[_0x4f90('0x36')],_0x47b449);}return _0x3e45f2[_0x4f90('0x25')](_0x4f90('0x37'))[_0x4f90('0x27')](_0x21fb18,_0x2990b8)['execute']();case _0x4f90('0x19'):var _0x350399=_['cloneDeep'](_0xaf6b8b);if(_0x7801a[_0x4f90('0x38')]){var _0x47b449={};_0x47b449[_0x7801a['additionalSearchLead']]=_0x2e2477;_[_0x4f90('0x35')](_0x350399[_0x4f90('0x36')],_0x47b449);}return _0x3e45f2[_0x4f90('0x25')]('Lead')[_0x4f90('0x27')](_0x350399,_0x2990b8);case _0x4f90('0x1b'):var _0x15bb86=_[_0x4f90('0x33')](_0xaf6b8b);if(_0x7801a[_0x4f90('0x3a')]){var _0x47b449={};_0x47b449[_0x7801a[_0x4f90('0x3a')]]=_0x2e2477;_[_0x4f90('0x35')](_0x15bb86[_0x4f90('0x36')],_0x47b449);}return _0x3e45f2['sobject'](_0x4f90('0x3b'))[_0x4f90('0x27')](_0x15bb86,_0x2990b8);default:return null;}})[_0x4f90('0x29')](function(_0x5c0ae0){if(_0x5c0ae0&&_0x5c0ae0[_0x4f90('0x3c')]){var _0x1058f2=_['first'](_0x5c0ae0);if(_0x1058f2){return BPromise[_0x4f90('0x2c')]({'id':_0x1058f2['Id'],'name':_0x1058f2[_0x4f90('0x3d')],'phone':_0x1058f2[_0x4f90('0x3e')],'endUserType':_0x1058f2[_0x4f90('0x3f')][_0x4f90('0x40')][_0x4f90('0x41')]()});}}})[_0x4f90('0x29')](function(_0xeb0be2){if(_0xeb0be2){logger[_0x4f90('0x21')](_0x4f90('0x42'),_0xeb0be2['endUserType'],_0x2e2477);return BPromise[_0x4f90('0x2c')](_0xeb0be2);}else{logger[_0x4f90('0x21')](_0x4f90('0x43'),_0x2e2477);var _0x4dd860={'Phone':_0x2e2477};if(_0x7801a['moduleCreate']){if(_0x7801a[_0x4f90('0x44')]===_0x4f90('0x18')){logger[_0x4f90('0x21')](_0x4f90('0x45'),_0x2e2477,_0x7801a[_0x4f90('0x44')]);_0x4dd860[_0x4f90('0x46')]=_0x40f488!==''?_0x40f488:util[_0x4f90('0x47')]('Caller\x20-\x20%s',_0x2e2477);}else if(_0x7801a[_0x4f90('0x44')]===_0x4f90('0x19')){logger['info'](_0x4f90('0x45'),_0x2e2477,_0x7801a[_0x4f90('0x44')]);_0x4dd860['LastName']=_0x40f488!==_0x4f90('0x48')?_0x40f488:util[_0x4f90('0x47')](_0x4f90('0x49'),_0x2e2477);_0x4dd860[_0x4f90('0x4a')]='No\x20Company';}else if(_0x7801a['moduleCreate']===_0x4f90('0x1b')){logger[_0x4f90('0x21')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x2e2477,_0x7801a[_0x4f90('0x44')]);_0x4dd860[_0x4f90('0x3d')]=_0x40f488!==''?_0x40f488:util['format'](_0x4f90('0x49'),_0x2e2477);}else{return null;}}return _0x3e45f2[_0x4f90('0x25')](_[_0x4f90('0x4b')](_0x7801a[_0x4f90('0x44')]))[_0x4f90('0x4c')](_0x4dd860)[_0x4f90('0x29')](function(_0x3c249c){return BPromise[_0x4f90('0x2c')]({'id':_0x3c249c['id'],'endUserType':_0x7801a[_0x4f90('0x44')]});});}});}function getCustomFields(_0x56cc62,_0x1b1e67){var _0x165529={};if(_0x56cc62[_0x4f90('0x3c')]>0x0){_[_0x4f90('0x4d')](_0x56cc62,function(_0x51452b){if(_[_0x4f90('0x4e')]([_0x4f90('0x4f'),'picklist'],_0x51452b[_0x4f90('0x40')])&&_0x51452b['idField']){_0x165529[_0x51452b[_0x4f90('0x50')]]=_0x51452b[_0x4f90('0x51')][_0x4f90('0x52')]();}else if(_0x51452b[_0x4f90('0x40')]===_0x4f90('0x53')&&_0x51452b[_0x4f90('0x54')]&&_0x51452b['idField']){_0x1b1e67[_0x51452b[_0x4f90('0x54')]]&&(_0x165529[_0x51452b[_0x4f90('0x50')]]=_0x1b1e67[_0x51452b['variableName']][_0x4f90('0x52')]());}else if(_0x51452b[_0x4f90('0x40')]==='customVariable'&&_0x51452b[_0x4f90('0x55')]&&_0x51452b['Variable'][_0x4f90('0x56')]&&_0x51452b[_0x4f90('0x50')]){_0x1b1e67[_0x51452b[_0x4f90('0x55')][_0x4f90('0x56')]['toLowerCase']()]&&(_0x165529[_0x51452b[_0x4f90('0x50')]]=_0x1b1e67[_0x51452b[_0x4f90('0x55')]['name'][_0x4f90('0x41')]()][_0x4f90('0x52')]());}});}return _0x165529;}function getConnection(_0x3ee26f){var _0x2e65fd=_0x3ee26f[_0x4f90('0x57')][_0x4f90('0x58')](_0x3ee26f[_0x4f90('0x59')]);var _0x3835a0=new jsforce[(_0x4f90('0x5a'))]({'oauth2':{'loginUrl':_0x3ee26f['remoteUri']||_0x4f90('0x5b'),'clientId':_0x3ee26f['clientId'],'clientSecret':_0x3ee26f[_0x4f90('0x5c')]}});return _0x3835a0[_0x4f90('0x5d')](_0x3ee26f[_0x4f90('0x5e')],_0x2e65fd)[_0x4f90('0x29')](function(){logger[_0x4f90('0x21')](_0x4f90('0x5f'));return _0x3835a0;});}exports[_0x4f90('0x60')]=function(_0x1b03f3,_0x4858db,_0x26c15b,_0x428a7a,_0x5147be,_0x10d446){var _0x48b790,_0x31eee2,_0x452caa,_0x2aa613;_0x10d446[_0x4f90('0x61')]=intUtil[_0x4f90('0x62')](_0x10d446[_0x4f90('0x61')]);_0x10d446[_0x4f90('0x63')]=intUtil[_0x4f90('0x62')](_0x10d446['remoteUri']);if(_0x5147be&&_0x5147be[_0x4f90('0x64')]){logger[_0x4f90('0x21')](_0x4f90('0x65'),_0x4f90('0x66'));_0x4858db[_0x4f90('0x67')]=util['format'](_0x4f90('0x68'),_0x10d446[_0x4f90('0x61')],_0x4858db[_0x4f90('0x69')],md5(_0x4858db[_0x4f90('0x69')]));}else{_0x4858db['recordingURL']='';}return getConnection(_0x10d446)[_0x4f90('0x29')](function(_0x207ac1){_0x2aa613=_0x207ac1;return getUser(_0x10d446,_0x428a7a['email'],_0x2aa613);})['then'](function(_0x228a90){_0x48b790=_0x228a90;return getEndUser(_0x10d446,_0x26c15b,_0x4858db['calleridname'],_0x4858db[_0x4f90('0x6a')],_0x2aa613);})['then'](function(_0xf9c53a){_0x31eee2=_0xf9c53a;return getTicket(_0x10d446,_0x48b790,_0x31eee2,_0x26c15b,_0x4858db,_0x26c15b[_0x4f90('0x6b')],_0x2aa613,_0x4f90('0x60'));})[_0x4f90('0x29')](function(_0x25b767){_0x452caa=_0x25b767;logger[_0x4f90('0x21')](_0x4f90('0x6c'),_0x452caa['id']);logger[_0x4f90('0x21')](_0x4f90('0x6d'),_0x452caa['id'],_0x428a7a[_0x4f90('0x56')],_0x10d446['type']);switch(_0x10d446[_0x4f90('0x40')]){case _0x4f90('0x6e'):emit(util[_0x4f90('0x47')](_0x4f90('0x6f'),_0x428a7a[_0x4f90('0x56')]),_0x4f90('0x70'),{'recordId':_0x452caa['id']});break;case'newTab':emit(util[_0x4f90('0x47')]('user:%s',_0x428a7a[_0x4f90('0x56')]),_0x4f90('0x71'),{'uri':util[_0x4f90('0x47')]('%s/%s/e',_0x2aa613[_0x4f90('0x72')],_0x452caa['id'])});break;default:logger['error']('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})['catch'](function(_0x2a9382){logger[_0x4f90('0x73')]('[QUEUE]',_0x2a9382);});};exports[_0x4f90('0x74')]=function(_0x35abd3,_0x1e4cb8,_0x20f976,_0x59843e,_0x3f0daa,_0x3808ca,_0x5d2940){var _0x4ff462,_0x3920d7,_0x49f314,_0xd4f354;_0x3808ca['serverUrl']=intUtil['stripTrailingSlash'](_0x3808ca[_0x4f90('0x61')]);_0x3808ca['remoteUri']=intUtil[_0x4f90('0x62')](_0x3808ca['remoteUri']);if(_0x5d2940&&_0x5d2940[_0x4f90('0x75')]&&_0x5d2940[_0x4f90('0x75')]!==_0x4f90('0x76')){logger[_0x4f90('0x21')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x1e4cb8[_0x4f90('0x67')]=util[_0x4f90('0x47')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3808ca['serverUrl'],_0x1e4cb8[_0x4f90('0x69')],md5(_0x1e4cb8[_0x4f90('0x69')]));}return getConnection(_0x3808ca)[_0x4f90('0x29')](function(_0xa6d1b6){_0xd4f354=_0xa6d1b6;return getUser(_0x3808ca,_0x59843e['email'],_0xd4f354);})[_0x4f90('0x29')](function(_0x6559a9){_0x4ff462=_0x6559a9;return getEndUser(_0x3808ca,_0x20f976,_0x1e4cb8['destcalleridname'],_0x1e4cb8[_0x4f90('0x77')],_0xd4f354);})[_0x4f90('0x29')](function(_0x190c6e){_0x3920d7=_0x190c6e;return getTicket(_0x3808ca,_0x4ff462,_0x3920d7,_0x20f976,_0x1e4cb8,_0x20f976[_0x4f90('0x6b')],_0xd4f354,_0x4f90('0x74'));})['then'](function(_0x3cdad9){_0x49f314=_0x3cdad9;logger[_0x4f90('0x21')](_0x4f90('0x78'),_0x49f314['id']);logger[_0x4f90('0x21')](_0x4f90('0x79'),_0x49f314['id'],_0x59843e[_0x4f90('0x56')],_0x3808ca[_0x4f90('0x40')]);switch(_0x3808ca[_0x4f90('0x40')]){case _0x4f90('0x6e'):emit(util[_0x4f90('0x47')](_0x4f90('0x6f'),_0x59843e['name']),_0x4f90('0x70'),{'recordId':_0x49f314['id']});break;case _0x4f90('0x7a'):emit(util[_0x4f90('0x47')](_0x4f90('0x6f'),_0x59843e[_0x4f90('0x56')]),_0x4f90('0x71'),{'uri':util[_0x4f90('0x47')]('%s/%s/e',_0xd4f354[_0x4f90('0x72')],_0x49f314['id'])});break;default:logger[_0x4f90('0x73')]('[OUTBOUND]',_0x4f90('0x7b'));}})[_0x4f90('0x7c')](function(_0x4dc3de){logger[_0x4f90('0x73')](_0x4f90('0x7d'),_0x4dc3de);});};exports[_0x4f90('0x7e')]=function(_0xcffe5c,_0x5734eb,_0x5a1c06,_0x31c7d3,_0xb471b5,_0x5e7fe2){var _0x131b5e,_0x4fcc10,_0x1699d1,_0x3bebe1;_0x5e7fe2[_0x4f90('0x61')]=intUtil[_0x4f90('0x62')](_0x5e7fe2[_0x4f90('0x61')]);_0x5e7fe2[_0x4f90('0x63')]=intUtil[_0x4f90('0x62')](_0x5e7fe2[_0x4f90('0x63')]);if(_0xb471b5&&_0xb471b5[_0x4f90('0x64')]){logger[_0x4f90('0x21')]('['+_0x5734eb[_0x4f90('0x7f')][_0x4f90('0x80')]()+']',_0x4f90('0x66'));_0x5734eb[_0x4f90('0x67')]=util[_0x4f90('0x47')](_0x4f90('0x68'),_0x5e7fe2[_0x4f90('0x61')],_0x5734eb[_0x4f90('0x69')],md5(_0x5734eb[_0x4f90('0x69')]));}else{_0x5734eb['recordingURL']='';}return getConnection(_0x5e7fe2)[_0x4f90('0x29')](function(_0x484bb1){_0x3bebe1=_0x484bb1;if(!_[_0x4f90('0x24')](_0x31c7d3)){return getUser(_0x5e7fe2,_0x31c7d3[_0x4f90('0x56')],_0x3bebe1);}else{return getUser(_0x5e7fe2,null,_0x3bebe1);}})[_0x4f90('0x29')](function(_0x1f53d2){_0x131b5e=_0x1f53d2;return getEndUser(_0x5e7fe2,_0x5a1c06,_0x5734eb[_0x4f90('0x81')],_0x5734eb[_0x4f90('0x6a')],_0x3bebe1);})[_0x4f90('0x29')](function(_0x382983){_0x4fcc10=_0x382983;return getTicket(_0x5e7fe2,_0x131b5e,_0x4fcc10,_0x5a1c06,_0x5734eb,_0x5a1c06[_0x4f90('0x6b')],_0x3bebe1);})['then'](function(_0x5a50c3){_0x1699d1=_0x5a50c3;logger[_0x4f90('0x21')]('['+_0x5734eb[_0x4f90('0x7f')]['toUpperCase']()+_0x4f90('0x82'),_0x1699d1['id']);logger[_0x4f90('0x21')]('['+_0x5734eb[_0x4f90('0x7f')]['toUpperCase']()+']\x20Integration\x20account\x20type\x20%s.',_0x5e7fe2[_0x4f90('0x40')]);})[_0x4f90('0x7c')](function(_0x106b49){logger['error']('['+_0x5734eb[_0x4f90('0x7f')][_0x4f90('0x80')]()+']',_0x106b49);});}; \ 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 14bd21f..de1c359 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 _0xaee0=['length','adminId','result','sys_id','info','],\x20getAdminUser\x20crm','catch','message','toUpperCase','],\x20getUser\x20input\x20crm','validateEmail','userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20entity','active','true','userId','adminEmail','],\x20getUser\x20crm','error','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','System','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','customField','toLowerCase','content','toString','idField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','Subjects','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','label','label_entry','Incident','Incident\x20-\x20','ticketNumber','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','%26sysparm_record_target%3Dincident','%255EORDERBYDESCnumber','format','user:%s','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','request-promise','util','md5','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then'];(function(_0x3de0a4,_0x2c5cbf){var _0x40fbc2=function(_0x26f2f5){while(--_0x26f2f5){_0x3de0a4['push'](_0x3de0a4['shift']());}};_0x40fbc2(++_0x2c5cbf);}(_0xaee0,0xc7));var _0x0aee=function(_0x292bab,_0x4eb300){_0x292bab=_0x292bab-0x0;var _0x18b22a=_0xaee0[_0x292bab];return _0x18b22a;};'use strict';var _=require('lodash');var Promise=require('bluebird');var rp=require(_0x0aee('0x0'));var util=require(_0x0aee('0x1'));var md5=require(_0x0aee('0x2'));var Redis=require('ioredis');var intUtil=require(_0x0aee('0x3'));var config=require(_0x0aee('0x4'));var logger=require(_0x0aee('0x5'))(_0x0aee('0x6'));config[_0x0aee('0x7')]=_[_0x0aee('0x8')](config[_0x0aee('0x7')],{'host':_0x0aee('0x9'),'port':0x18eb});var io=require(_0x0aee('0xa'))(new Redis(config[_0x0aee('0x7')]));function getAdminUser(_0x484a36,_0x18c9c0,_0x4534a3,_0x5591e2,_0x510134,_0x4ecdc3){return new Promise(function(_0x25e344,_0x47233f){var _0x1c95b8={'method':'GET','uri':_0x5591e2+_0x0aee('0xb')+'&'+_0x510134+'&'+_0x4ecdc3,'auth':_0x18c9c0,'json':!![]};return rp(_0x1c95b8)[_0x0aee('0xc')](function(_0x24fffd){if(_0x24fffd['result'][_0x0aee('0xd')]>0x0){_0x4534a3[_0x0aee('0xe')]=_0x24fffd[_0x0aee('0xf')][0x0][_0x0aee('0x10')];}logger[_0x0aee('0x11')]('['+[_0x484a36['toUpperCase']()]+_0x0aee('0x12'),_0x4534a3);_0x25e344(_0x4534a3);})[_0x0aee('0x13')](function(_0xcaa91){logger['error']('['+[_0x484a36['toUpperCase']()]+']',_0xcaa91['message']);_0x47233f(_0xcaa91[_0x0aee('0x14')]);});});}function getUser(_0x382930,_0x1770f9,_0x4d8090,_0x1f7e71,_0x29f63b){return function(_0x5e1a26){logger[_0x0aee('0x11')]('['+[_0x382930[_0x0aee('0x15')]()]+_0x0aee('0x16'),_0x5e1a26);return new Promise(function(_0x3b9e75,_0x2c4a88){if(intUtil[_0x0aee('0x17')](_0x5e1a26[_0x0aee('0x18')])){var _0x4aa904={'method':_0x0aee('0x19'),'uri':_0x4d8090+_0x0aee('0x1a')+_0x5e1a26['userEmail']+'&'+_0x1f7e71+'&'+_0x29f63b,'auth':_0x1770f9,'json':!![]};logger[_0x0aee('0x11')]('['+[_0x382930[_0x0aee('0x15')]()]+'],\x20getUser\x20rp\x20obj',_0x4aa904);return rp(_0x4aa904)[_0x0aee('0xc')](function(_0x262d56){logger[_0x0aee('0x11')]('['+[_0x382930[_0x0aee('0x15')]()]+_0x0aee('0x1b'),_0x262d56);if(_0x262d56[_0x0aee('0xf')][_0x0aee('0xd')]>0x0&&String(_0x262d56['result'][0x0][_0x0aee('0x1c')])===_0x0aee('0x1d')){_0x5e1a26['userId']=_0x262d56[_0x0aee('0xf')][0x0]['sys_id'];}else{_0x5e1a26[_0x0aee('0x1e')]=_0x5e1a26[_0x0aee('0xe')];_0x5e1a26[_0x0aee('0x18')]=_0x5e1a26[_0x0aee('0x1f')];}logger[_0x0aee('0x11')]('['+[_0x382930[_0x0aee('0x15')]()]+_0x0aee('0x20'),_0x5e1a26);_0x3b9e75(_0x5e1a26);})[_0x0aee('0x13')](function(_0x3f0305){logger[_0x0aee('0x21')]('['+[_0x382930[_0x0aee('0x15')]()]+']',_0x3f0305[_0x0aee('0x14')]);_0x2c4a88(_0x3f0305[_0x0aee('0x14')]);});}else{logger[_0x0aee('0x11')]('['+[_0x382930[_0x0aee('0x15')]()]+']\x20using\x20admin\x20profile');_0x5e1a26[_0x0aee('0x1e')]=_0x5e1a26[_0x0aee('0xe')];_0x5e1a26[_0x0aee('0x18')]=_0x5e1a26[_0x0aee('0x1f')];_0x3b9e75(_0x5e1a26);}});};}function createEndUser(_0x219e06,_0x32872b,_0x1af5d4,_0x48817e,_0x97252f){logger[_0x0aee('0x11')]('['+[_0x219e06['toUpperCase']()]+_0x0aee('0x22'),_0x1af5d4);return new Promise(function(_0x57b7c8,_0x448fa8){var _0x3837bd={'method':_0x0aee('0x23'),'uri':_0x48817e+'sys_user?'+_0x97252f,'body':{'user_name':_0x1af5d4[_0x0aee('0x24')],'roles':'user','first_name':_0x1af5d4[_0x0aee('0x24')],'active':_0x0aee('0x1d'),'date_format':_0x0aee('0x25'),'phone':_0x1af5d4[_0x0aee('0x24')]},'auth':_0x32872b,'json':!![]};return rp(_0x3837bd)[_0x0aee('0xc')](function(_0x3ec223){logger[_0x0aee('0x11')]('['+[_0x219e06[_0x0aee('0x15')]()]+_0x0aee('0x26'),_0x3ec223[_0x0aee('0xf')]);_0x1af5d4['endUserId']=_0x3ec223['result']['sys_id'];_0x57b7c8(_0x1af5d4);})[_0x0aee('0x13')](function(_0x63701b){logger[_0x0aee('0x21')]('['+[_0x219e06[_0x0aee('0x15')]()]+']',_0x63701b[_0x0aee('0x14')]);_0x448fa8(_0x63701b[_0x0aee('0x14')]);});});}function getEndUser(_0x371c7d,_0x2967fa,_0x33b79b,_0x4688fa,_0x225489){return function(_0x408e10){logger['info']('['+[_0x371c7d['toUpperCase']()]+_0x0aee('0x27'),_0x408e10);return new Promise(function(_0x3418e7,_0x27084f){var _0x3fd0a4={'method':'GET','uri':_0x33b79b+_0x0aee('0x28')+_0x408e10[_0x0aee('0x24')]+'&'+_0x4688fa+'&'+_0x225489,'auth':_0x2967fa,'json':!![]};return rp(_0x3fd0a4)[_0x0aee('0xc')](function(_0x539fd8){if(_0x539fd8[_0x0aee('0xf')]['length']>0x0){_0x408e10[_0x0aee('0x29')]=_0x539fd8[_0x0aee('0xf')][0x0][_0x0aee('0x10')];logger[_0x0aee('0x11')]('['+[_0x371c7d[_0x0aee('0x15')]()]+_0x0aee('0x2a'),_0x408e10);_0x3418e7(_0x408e10);}else{return createEndUser(_0x371c7d,_0x2967fa,_0x408e10,_0x33b79b,_0x4688fa)[_0x0aee('0xc')](function(_0x3fae57){logger[_0x0aee('0x11')]('['+[_0x371c7d['toUpperCase']()]+_0x0aee('0x2b'),_0x3fae57);_0x3418e7(_0x3fae57);});}})[_0x0aee('0x13')](function(_0x2768bb){logger[_0x0aee('0x21')]('['+[_0x371c7d['toUpperCase']()]+']',_0x2768bb[_0x0aee('0x14')]);_0x27084f(_0x2768bb[_0x0aee('0x14')]);});});};}function getCustomFields(_0x3eae44,_0x336a0d){var _0x4fe1a4={};if(_0x3eae44[_0x0aee('0xd')]>0x0){_[_0x0aee('0x2c')](_0x3eae44,function(_0x23d5b1){if(_[_0x0aee('0x2d')]([_0x0aee('0x2e'),_0x0aee('0x2f')],_0x23d5b1[_0x0aee('0x30')])&&_0x23d5b1['nameField']&&!_0x23d5b1[_0x0aee('0x31')]){_0x4fe1a4[_0x23d5b1['nameField'][_0x0aee('0x32')]()]=_0x23d5b1[_0x0aee('0x33')][_0x0aee('0x34')]();}else if(_[_0x0aee('0x2d')]([_0x0aee('0x2e'),_0x0aee('0x2f')],_0x23d5b1['type'])&&_0x23d5b1[_0x0aee('0x35')]&&_0x23d5b1[_0x0aee('0x31')]){_0x4fe1a4[_0x23d5b1[_0x0aee('0x35')][_0x0aee('0x32')]()]=_0x23d5b1[_0x0aee('0x33')][_0x0aee('0x34')]();}else if(_0x23d5b1['type']===_0x0aee('0x36')&&_0x23d5b1[_0x0aee('0x37')]&&_0x23d5b1[_0x0aee('0x35')]&&_0x23d5b1[_0x0aee('0x31')]){_0x4fe1a4[_0x23d5b1[_0x0aee('0x35')][_0x0aee('0x32')]()]=_0x336a0d[_0x23d5b1[_0x0aee('0x37')]]['toString']();}else if(_0x23d5b1[_0x0aee('0x30')]===_0x0aee('0x38')&&_0x23d5b1[_0x0aee('0x39')]&&_0x23d5b1[_0x0aee('0x39')][_0x0aee('0x3a')]&&_0x23d5b1[_0x0aee('0x35')]&&_0x23d5b1[_0x0aee('0x31')]){_0x4fe1a4[_0x23d5b1[_0x0aee('0x35')][_0x0aee('0x32')]()]=_0x336a0d[_0x23d5b1['Variable'][_0x0aee('0x3a')]['toLowerCase']()][_0x0aee('0x34')]();}});}return _0x4fe1a4;}function getTicket(_0x42939b,_0x4c4e28,_0x556f36,_0x40ab99,_0x94800b,_0x350710){return function(_0x26388b){logger[_0x0aee('0x11')]('['+[_0x42939b[_0x0aee('0x15')]()]+_0x0aee('0x3b'),_0x26388b);return new Promise(function(_0x1a38fa,_0x327566){var _0x3109eb=_0x42939b[_0x0aee('0x32')]()===_0x0aee('0x3c')?_0x26388b[_0x0aee('0x1e')]:_0x26388b[_0x0aee('0x29')];var _0x519021={'method':_0x0aee('0x23'),'uri':_0x556f36+_0x0aee('0x3d')+'?'+_0x350710,'body':Object['assign']({},{'active':_0x0aee('0x1d'),'caller_id':_0x3109eb,'assigned_to':_0x26388b['userId'],'short_description':intUtil['getString'](_0x40ab99[_0x0aee('0x3e')],_0x94800b,'\x20'),'description':intUtil['getString'](_0x40ab99['Descriptions'],_0x94800b,'\x0a')},getCustomFields(_0x40ab99[_0x0aee('0x3f')],_0x94800b)),'auth':_0x4c4e28,'json':!![]};return rp(_0x519021)[_0x0aee('0xc')](function(_0x2f2063){logger[_0x0aee('0x11')]('['+[_0x42939b[_0x0aee('0x15')]()]+_0x0aee('0x40'),_0x2f2063[_0x0aee('0xf')]);_0x26388b[_0x0aee('0x41')]=_0x2f2063[_0x0aee('0xf')]['sys_id'];_0x26388b['ticketNumber']=_0x2f2063[_0x0aee('0xf')][_0x0aee('0x42')];logger[_0x0aee('0x11')]('['+[_0x42939b[_0x0aee('0x15')]()]+_0x0aee('0x43'),_0x26388b);_0x1a38fa(_0x26388b);})['catch'](function(_0x5377c8){logger['error']('['+[_0x42939b[_0x0aee('0x15')]()]+']',_0x5377c8[_0x0aee('0x14')]);_0x327566(_0x5377c8['message']);});});};}function createRemoteTag(_0x23bb4e,_0x32102a,_0x4ec3a8,_0x3f7013){return new Promise(function(_0x4b25f7,_0x54c4f4){var _0x5635a7={'method':_0x0aee('0x23'),'uri':_0x4ec3a8+_0x0aee('0x44')+'?'+_0x3f7013,'body':{'short_description':_0x23bb4e,'global':!![],'active':!![],'name':_0x23bb4e},'auth':_0x32102a,'json':!![]};return rp(_0x5635a7)[_0x0aee('0xc')](function(_0x3d0be6){var _0xd846a9=_0x3d0be6[_0x0aee('0xf')]['sys_id'];_0x4b25f7(_0xd846a9);});});}function getRemoteTag(_0x3a3d5e,_0x440bfe,_0x1f44be,_0x4f5566,_0x4250e3){return new Promise(function(_0x4a6ffa,_0x4116db){var _0x346655={'method':_0x0aee('0x19'),'uri':_0x1f44be+_0x0aee('0x44')+'?sysparm_query=name%3D'+_0x3a3d5e+'&'+_0x4f5566,'auth':_0x440bfe,'json':!![]};return rp(_0x346655)[_0x0aee('0xc')](function(_0x404d3a){if(_0x404d3a['result'][_0x0aee('0xd')]>0x0){var _0x17ee1a=_0x404d3a[_0x0aee('0xf')][0x0][_0x0aee('0x10')];_0x4a6ffa(_0x17ee1a);}else{return createRemoteTag(_0x3a3d5e,_0x440bfe,_0x1f44be,_0x4f5566)[_0x0aee('0xc')](function(_0x481e86){_0x4a6ffa(_0x481e86);});}});});}function assignTagToIncident(_0x2026ea,_0x49129c,_0x254fb3,_0x318256,_0x39908b){return new Promise(function(_0x1c69db,_0x4edf17){var _0x225ac6={'method':_0x0aee('0x23'),'uri':_0x254fb3+_0x0aee('0x45')+'?'+_0x39908b,'body':{'label':_0x2026ea,'table':_0x0aee('0x3d'),'id_type':_0x0aee('0x46'),'table_key':_0x318256[_0x0aee('0x41')],'title':_0x0aee('0x47')+_0x318256[_0x0aee('0x48')],'id_display':_0x318256[_0x0aee('0x48')]},'auth':_0x49129c,'json':!![]};return rp(_0x225ac6)[_0x0aee('0xc')](function(_0x1aaecd){_0x1c69db();})[_0x0aee('0x13')](function(){_0x1c69db();});});}function manageTags(_0x417a1f,_0x19a8d5,_0x5b798a,_0x1c3a84,_0x22865d,_0x3aa038,_0x1a6b3a){return new Promise(function(_0x259110,_0x5eb155){var _0xdf9365=[];_0x19a8d5['forEach'](function(_0x33e7fc){_0xdf9365[_0x0aee('0x49')](getRemoteTag(_0x33e7fc,_0x5b798a,_0x1c3a84,_0x3aa038,_0x1a6b3a));});return Promise[_0x0aee('0x4a')](_0xdf9365)[_0x0aee('0xc')](function(_0x424e9a){if(_0x424e9a[_0x0aee('0xd')]){logger[_0x0aee('0x11')]('['+[_0x417a1f['toUpperCase']()]+_0x0aee('0x4b'),_0x424e9a);var _0x2662f5=[];_0x424e9a[_0x0aee('0x2c')](function(_0x5ffc59){_0x2662f5[_0x0aee('0x49')](assignTagToIncident(_0x5ffc59,_0x5b798a,_0x1c3a84,_0x22865d,_0x3aa038));});return Promise[_0x0aee('0x4a')](_0x2662f5)[_0x0aee('0xc')](function(){_0x259110();})[_0x0aee('0x13')](function(){_0x259110();});}else{_0x259110();}});});}function getTags(_0x55a935,_0x144ec9,_0x5227b5,_0x17960b,_0x457480,_0x250231){return function(_0x2f58d2){return new Promise(function(_0x3e05ba,_0x5258a8){var _0x19ec1a=[];var _0x23c259=_0x17960b[_0x0aee('0x4c')];if(_0x23c259&&_0x23c259[_0x0aee('0xd')]>0x0){_0x19ec1a=_['map'](_0x23c259,_0x0aee('0x3a'));}if(_0x19ec1a['length']>0x0){return manageTags(_0x55a935,_0x19ec1a,_0x144ec9,_0x5227b5,_0x2f58d2,_0x457480,_0x250231)[_0x0aee('0xc')](function(){_0x3e05ba(_0x2f58d2);});}else{_0x3e05ba(_0x2f58d2);}});};}function emit(_0x3c02ff,_0x1f2222,_0x5a8119){var _0x1d07c7=_0x0aee('0x4d')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x0aee('0x4e');var _0x42d4f7={'uri':_0x3c02ff+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x5a8119+_0x1d07c7};io['to'](util[_0x0aee('0x4f')](_0x0aee('0x50'),_0x1f2222))['emit'](_0x0aee('0x51'),_0x42d4f7);}exports['cs']=function(_0x3fa38d,_0x2307bf,_0xb7c89b,_0x555ff2,_0x845a82,_0x4061a9,_0x29efbb,_0x127946){var _0x6ebbad={};var _0xd46691={'user':_0x4061a9[_0x0aee('0x52')],'pass':_0x4061a9[_0x0aee('0x53')]};var _0x1e1669=_0x0aee('0x54');var _0x13cdcd=_0x0aee('0x55');_0x4061a9[_0x0aee('0x56')]=intUtil[_0x0aee('0x57')](_0x4061a9['remoteUri']);_0x4061a9['serverUrl']=intUtil[_0x0aee('0x57')](_0x4061a9['serverUrl']);var _0x3de0a2=util['format'](_0x0aee('0x58'),_0x4061a9[_0x0aee('0x56')]);_0x6ebbad[_0x0aee('0x18')]=!_[_0x0aee('0x59')](_0x555ff2)?_0x555ff2[_0x0aee('0x5a')]:null;_0x6ebbad[_0x0aee('0x1f')]=_0x4061a9[_0x0aee('0x5a')];_0x6ebbad[_0x0aee('0x24')]=_0x127946['toLowerCase']()==='outbound'?_0x2307bf[_0x0aee('0x5b')]:_0x2307bf[_0x0aee('0x5c')];_0x6ebbad[_0x0aee('0x5d')]=_0x127946===_0x0aee('0x5e')||_0x127946===_0x0aee('0x5f')?'queue':_0x0aee('0x3c');var _0x237387=util[_0x0aee('0x4f')](_0x0aee('0x60'),_0x4061a9['serverUrl'],_0x2307bf[_0x0aee('0x61')],md5(_0x2307bf[_0x0aee('0x61')]));if(_0x845a82&&_0x845a82[_0x0aee('0x62')]){logger[_0x0aee('0x11')]('[QUEUE]',_0x0aee('0x63'));_0x2307bf[_0x0aee('0x64')]=_0x237387;}else if(_0x29efbb&&_0x29efbb[_0x0aee('0x65')]&&_0x29efbb[_0x0aee('0x65')]!==_0x0aee('0x66')){logger['info']('[OUTBOUND]',_0x0aee('0x63'));_0x2307bf['recordingURL']=_0x237387;}else{_0x2307bf[_0x0aee('0x64')]='';}return getAdminUser(_0x127946,_0xd46691,_0x6ebbad,_0x3de0a2,_0x13cdcd,_0x1e1669)[_0x0aee('0xc')](getUser(_0x127946,_0xd46691,_0x3de0a2,_0x13cdcd,_0x1e1669))[_0x0aee('0xc')](getEndUser(_0x127946,_0xd46691,_0x3de0a2,_0x13cdcd,_0x1e1669))[_0x0aee('0xc')](getTicket(_0x127946,_0xd46691,_0x3de0a2,_0xb7c89b,_0x2307bf,_0x13cdcd))['then'](function(_0x3461c4){logger[_0x0aee('0x11')](util[_0x0aee('0x4f')](_0x0aee('0x67'),_0x3461c4['ticketId']));logger[_0x0aee('0x11')](util[_0x0aee('0x4f')](_0x0aee('0x68'),_0x127946));if(_0x127946!=='unmanaged'){logger['info']('['+[_0x127946[_0x0aee('0x15')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x4061a9['remoteUri'],_0x555ff2['name'],_0x3461c4[_0x0aee('0x41')]);}})[_0x0aee('0x13')](function(_0x2c1b97){logger['error']('['+[_0x127946['toUpperCase']()]+_0x0aee('0x69'),util['inspect'](_0x2c1b97,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x650a=['getString','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','label_entry','Incident','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','user:%s','username','password','sysparm_display_value=true','remoteUri','stripTrailingSlash','%s/api/now/table/','isNil','destcalleridnum','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','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...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','md5','ioredis','./util','../../../../config/environment','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','sys_id','info','toUpperCase','error','message','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20entity','length','active','true','userId','adminEmail','],\x20getUser\x20crm','catch',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','user','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','type','customField','nameField','toLowerCase','content','toString','picklist','idField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x650a,0x101));var _0xa650=function(_0x13a5de,_0x18d40e){_0x13a5de=_0x13a5de-0x0;var _0x2e8f89=_0x650a[_0x13a5de];return _0x2e8f89;};'use strict';var _=require(_0xa650('0x0'));var Promise=require(_0xa650('0x1'));var rp=require(_0xa650('0x2'));var util=require('util');var md5=require(_0xa650('0x3'));var Redis=require(_0xa650('0x4'));var intUtil=require(_0xa650('0x5'));var config=require(_0xa650('0x6'));var logger=require('../../../../config/logger')(_0xa650('0x7'));config[_0xa650('0x8')]=_[_0xa650('0x9')](config[_0xa650('0x8')],{'host':_0xa650('0xa'),'port':0x18eb});var io=require(_0xa650('0xb'))(new Redis(config[_0xa650('0x8')]));function getAdminUser(_0x3c9615,_0x4bebb8,_0x591bd5,_0x4c2e2b,_0x3d22f6,_0x1e60ff){return new Promise(function(_0x3d6b03,_0x5db596){var _0x40dbf7={'method':_0xa650('0xc'),'uri':_0x4c2e2b+_0xa650('0xd')+'&'+_0x3d22f6+'&'+_0x1e60ff,'auth':_0x4bebb8,'json':!![]};return rp(_0x40dbf7)[_0xa650('0xe')](function(_0x41dbe7){if(_0x41dbe7[_0xa650('0xf')]['length']>0x0){_0x591bd5[_0xa650('0x10')]=_0x41dbe7[_0xa650('0xf')][0x0][_0xa650('0x11')];}logger[_0xa650('0x12')]('['+[_0x3c9615[_0xa650('0x13')]()]+'],\x20getAdminUser\x20crm',_0x591bd5);_0x3d6b03(_0x591bd5);})['catch'](function(_0x41a553){logger[_0xa650('0x14')]('['+[_0x3c9615['toUpperCase']()]+']',_0x41a553[_0xa650('0x15')]);_0x5db596(_0x41a553['message']);});});}function getUser(_0x28632c,_0x47dd8c,_0x4b86ca,_0x270324,_0x467b33){return function(_0x183878){logger[_0xa650('0x12')]('['+[_0x28632c['toUpperCase']()]+'],\x20getUser\x20input\x20crm',_0x183878);return new Promise(function(_0x275b86,_0x4d57d1){if(intUtil[_0xa650('0x16')](_0x183878[_0xa650('0x17')])){var _0x5aa69d={'method':_0xa650('0xc'),'uri':_0x4b86ca+_0xa650('0x18')+_0x183878['userEmail']+'&'+_0x270324+'&'+_0x467b33,'auth':_0x47dd8c,'json':!![]};logger[_0xa650('0x12')]('['+[_0x28632c['toUpperCase']()]+'],\x20getUser\x20rp\x20obj',_0x5aa69d);return rp(_0x5aa69d)[_0xa650('0xe')](function(_0x5d6ce5){logger[_0xa650('0x12')]('['+[_0x28632c[_0xa650('0x13')]()]+_0xa650('0x19'),_0x5d6ce5);if(_0x5d6ce5[_0xa650('0xf')][_0xa650('0x1a')]>0x0&&String(_0x5d6ce5[_0xa650('0xf')][0x0][_0xa650('0x1b')])===_0xa650('0x1c')){_0x183878[_0xa650('0x1d')]=_0x5d6ce5[_0xa650('0xf')][0x0]['sys_id'];}else{_0x183878[_0xa650('0x1d')]=_0x183878['adminId'];_0x183878['userEmail']=_0x183878[_0xa650('0x1e')];}logger[_0xa650('0x12')]('['+[_0x28632c[_0xa650('0x13')]()]+_0xa650('0x1f'),_0x183878);_0x275b86(_0x183878);})[_0xa650('0x20')](function(_0x1fa895){logger[_0xa650('0x14')]('['+[_0x28632c[_0xa650('0x13')]()]+']',_0x1fa895[_0xa650('0x15')]);_0x4d57d1(_0x1fa895[_0xa650('0x15')]);});}else{logger[_0xa650('0x12')]('['+[_0x28632c['toUpperCase']()]+_0xa650('0x21'));_0x183878[_0xa650('0x1d')]=_0x183878[_0xa650('0x10')];_0x183878['userEmail']=_0x183878['adminEmail'];_0x275b86(_0x183878);}});};}function createEndUser(_0x3e8e78,_0xc96cfe,_0x4777c0,_0x53c624,_0x3e6d6b){logger['info']('['+[_0x3e8e78[_0xa650('0x13')]()]+_0xa650('0x22'),_0x4777c0);return new Promise(function(_0x2acc0c,_0xc4da54){var _0x1b7dc2={'method':_0xa650('0x23'),'uri':_0x53c624+'sys_user?'+_0x3e6d6b,'body':{'user_name':_0x4777c0[_0xa650('0x24')],'roles':_0xa650('0x25'),'first_name':_0x4777c0[_0xa650('0x24')],'active':_0xa650('0x1c'),'date_format':'System','phone':_0x4777c0[_0xa650('0x24')]},'auth':_0xc96cfe,'json':!![]};return rp(_0x1b7dc2)['then'](function(_0x1276dc){logger[_0xa650('0x12')]('['+[_0x3e8e78[_0xa650('0x13')]()]+_0xa650('0x26'),_0x1276dc[_0xa650('0xf')]);_0x4777c0[_0xa650('0x27')]=_0x1276dc[_0xa650('0xf')][_0xa650('0x11')];_0x2acc0c(_0x4777c0);})['catch'](function(_0x1bca2c){logger['error']('['+[_0x3e8e78[_0xa650('0x13')]()]+']',_0x1bca2c[_0xa650('0x15')]);_0xc4da54(_0x1bca2c[_0xa650('0x15')]);});});}function getEndUser(_0xf9cbba,_0x55ba5e,_0x39f66d,_0x5b513e,_0x1395c6){return function(_0x2842ce){logger[_0xa650('0x12')]('['+[_0xf9cbba[_0xa650('0x13')]()]+_0xa650('0x28'),_0x2842ce);return new Promise(function(_0x3034ed,_0x30dcd7){var _0x4e2461={'method':'GET','uri':_0x39f66d+_0xa650('0x29')+_0x2842ce[_0xa650('0x24')]+'&'+_0x5b513e+'&'+_0x1395c6,'auth':_0x55ba5e,'json':!![]};return rp(_0x4e2461)[_0xa650('0xe')](function(_0x13ef6f){if(_0x13ef6f[_0xa650('0xf')][_0xa650('0x1a')]>0x0){_0x2842ce[_0xa650('0x27')]=_0x13ef6f[_0xa650('0xf')][0x0]['sys_id'];logger[_0xa650('0x12')]('['+[_0xf9cbba['toUpperCase']()]+_0xa650('0x2a'),_0x2842ce);_0x3034ed(_0x2842ce);}else{return createEndUser(_0xf9cbba,_0x55ba5e,_0x2842ce,_0x39f66d,_0x5b513e)[_0xa650('0xe')](function(_0x3175cd){logger[_0xa650('0x12')]('['+[_0xf9cbba[_0xa650('0x13')]()]+_0xa650('0x2b'),_0x3175cd);_0x3034ed(_0x3175cd);});}})[_0xa650('0x20')](function(_0x54da47){logger[_0xa650('0x14')]('['+[_0xf9cbba[_0xa650('0x13')]()]+']',_0x54da47[_0xa650('0x15')]);_0x30dcd7(_0x54da47['message']);});});};}function getCustomFields(_0x5ce08e,_0x15d426){var _0x2155f1={};if(_0x5ce08e['length']>0x0){_[_0xa650('0x2c')](_0x5ce08e,function(_0xe657a0){if(_[_0xa650('0x2d')]([_0xa650('0x2e'),'picklist'],_0xe657a0[_0xa650('0x2f')])&&_0xe657a0['nameField']&&!_0xe657a0[_0xa650('0x30')]){_0x2155f1[_0xe657a0[_0xa650('0x31')][_0xa650('0x32')]()]=_0xe657a0[_0xa650('0x33')][_0xa650('0x34')]();}else if(_[_0xa650('0x2d')]([_0xa650('0x2e'),_0xa650('0x35')],_0xe657a0[_0xa650('0x2f')])&&_0xe657a0['idField']&&_0xe657a0[_0xa650('0x30')]){_0x2155f1[_0xe657a0[_0xa650('0x36')][_0xa650('0x32')]()]=_0xe657a0['content']['toString']();}else if(_0xe657a0[_0xa650('0x2f')]===_0xa650('0x37')&&_0xe657a0[_0xa650('0x38')]&&_0xe657a0['idField']&&_0xe657a0[_0xa650('0x30')]){_0x2155f1[_0xe657a0['idField'][_0xa650('0x32')]()]=_0x15d426[_0xe657a0[_0xa650('0x38')]]['toString']();}else if(_0xe657a0[_0xa650('0x2f')]===_0xa650('0x39')&&_0xe657a0[_0xa650('0x3a')]&&_0xe657a0['Variable'][_0xa650('0x3b')]&&_0xe657a0[_0xa650('0x36')]&&_0xe657a0['customField']){_0x2155f1[_0xe657a0[_0xa650('0x36')]['toLowerCase']()]=_0x15d426[_0xe657a0[_0xa650('0x3a')][_0xa650('0x3b')][_0xa650('0x32')]()][_0xa650('0x34')]();}});}return _0x2155f1;}function getTicket(_0x2e2f05,_0x26c661,_0x2d4c9a,_0x1282da,_0x14ec81,_0x41c2b3){return function(_0x25f51a){logger[_0xa650('0x12')]('['+[_0x2e2f05[_0xa650('0x13')]()]+_0xa650('0x3c'),_0x25f51a);return new Promise(function(_0x24e5a4,_0xaefa3e){var _0x426a42=_0x2e2f05[_0xa650('0x32')]()===_0xa650('0x3d')?_0x25f51a[_0xa650('0x1d')]:_0x25f51a[_0xa650('0x27')];var _0x4f7418={'method':'POST','uri':_0x2d4c9a+_0xa650('0x3e')+'?'+_0x41c2b3,'body':Object[_0xa650('0x3f')]({},{'active':_0xa650('0x1c'),'caller_id':_0x426a42,'assigned_to':_0x25f51a[_0xa650('0x1d')],'short_description':intUtil[_0xa650('0x40')](_0x1282da['Subjects'],_0x14ec81,'\x20'),'description':intUtil[_0xa650('0x40')](_0x1282da['Descriptions'],_0x14ec81,'\x0a')},getCustomFields(_0x1282da['Fields'],_0x14ec81)),'auth':_0x26c661,'json':!![]};return rp(_0x4f7418)[_0xa650('0xe')](function(_0x5ada06){logger[_0xa650('0x12')]('['+[_0x2e2f05['toUpperCase']()]+']\x20POST\x20incident\x20entity\x20schema',_0x5ada06[_0xa650('0xf')]);_0x25f51a[_0xa650('0x41')]=_0x5ada06['result'][_0xa650('0x11')];_0x25f51a[_0xa650('0x42')]=_0x5ada06[_0xa650('0xf')][_0xa650('0x43')];logger[_0xa650('0x12')]('['+[_0x2e2f05['toUpperCase']()]+_0xa650('0x44'),_0x25f51a);_0x24e5a4(_0x25f51a);})[_0xa650('0x20')](function(_0x1a4fa7){logger[_0xa650('0x14')]('['+[_0x2e2f05[_0xa650('0x13')]()]+']',_0x1a4fa7[_0xa650('0x15')]);_0xaefa3e(_0x1a4fa7[_0xa650('0x15')]);});});};}function createRemoteTag(_0x4e88b4,_0x43c414,_0x2d3631,_0x4e72c4){return new Promise(function(_0x1003f6,_0x350520){var _0x1546a6={'method':_0xa650('0x23'),'uri':_0x2d3631+_0xa650('0x45')+'?'+_0x4e72c4,'body':{'short_description':_0x4e88b4,'global':!![],'active':!![],'name':_0x4e88b4},'auth':_0x43c414,'json':!![]};return rp(_0x1546a6)['then'](function(_0x4306d4){var _0x4af8c8=_0x4306d4[_0xa650('0xf')][_0xa650('0x11')];_0x1003f6(_0x4af8c8);});});}function getRemoteTag(_0x21d3a5,_0x47a14c,_0x40ab68,_0x296236,_0x477a7c){return new Promise(function(_0x3ae582,_0x272cc2){var _0x48cb27={'method':_0xa650('0xc'),'uri':_0x40ab68+'label'+'?sysparm_query=name%3D'+_0x21d3a5+'&'+_0x296236,'auth':_0x47a14c,'json':!![]};return rp(_0x48cb27)[_0xa650('0xe')](function(_0x33acf3){if(_0x33acf3[_0xa650('0xf')][_0xa650('0x1a')]>0x0){var _0x228598=_0x33acf3['result'][0x0][_0xa650('0x11')];_0x3ae582(_0x228598);}else{return createRemoteTag(_0x21d3a5,_0x47a14c,_0x40ab68,_0x296236)[_0xa650('0xe')](function(_0x3b15ba){_0x3ae582(_0x3b15ba);});}});});}function assignTagToIncident(_0x35734d,_0x2d4d21,_0x3a22e1,_0x351cee,_0x523821){return new Promise(function(_0x4c7ad9,_0x3bbba1){var _0x85e580={'method':_0xa650('0x23'),'uri':_0x3a22e1+_0xa650('0x46')+'?'+_0x523821,'body':{'label':_0x35734d,'table':_0xa650('0x3e'),'id_type':_0xa650('0x47'),'table_key':_0x351cee[_0xa650('0x41')],'title':'Incident\x20-\x20'+_0x351cee[_0xa650('0x42')],'id_display':_0x351cee[_0xa650('0x42')]},'auth':_0x2d4d21,'json':!![]};return rp(_0x85e580)[_0xa650('0xe')](function(_0x295fc3){_0x4c7ad9();})[_0xa650('0x20')](function(){_0x4c7ad9();});});}function manageTags(_0x36c95f,_0x2a17e3,_0x2789c9,_0x2381fe,_0x3e3b41,_0x4d644a,_0x1f216d){return new Promise(function(_0x3face6,_0x4a79a7){var _0x578890=[];_0x2a17e3[_0xa650('0x2c')](function(_0x2f0b1c){_0x578890[_0xa650('0x48')](getRemoteTag(_0x2f0b1c,_0x2789c9,_0x2381fe,_0x4d644a,_0x1f216d));});return Promise[_0xa650('0x49')](_0x578890)[_0xa650('0xe')](function(_0x35ff63){if(_0x35ff63['length']){logger[_0xa650('0x12')]('['+[_0x36c95f[_0xa650('0x13')]()]+_0xa650('0x4a'),_0x35ff63);var _0x334381=[];_0x35ff63[_0xa650('0x2c')](function(_0x4ad712){_0x334381[_0xa650('0x48')](assignTagToIncident(_0x4ad712,_0x2789c9,_0x2381fe,_0x3e3b41,_0x4d644a));});return Promise[_0xa650('0x49')](_0x334381)['then'](function(){_0x3face6();})[_0xa650('0x20')](function(){_0x3face6();});}else{_0x3face6();}});});}function getTags(_0x10fc1e,_0x32b0c1,_0x745c10,_0x15631a,_0x298ee3,_0x3f0591){return function(_0x215780){return new Promise(function(_0x26547b,_0xb4fe57){var _0x5d3c71=[];var _0x3b56e5=_0x15631a['Tags'];if(_0x3b56e5&&_0x3b56e5[_0xa650('0x1a')]>0x0){_0x5d3c71=_[_0xa650('0x4b')](_0x3b56e5,_0xa650('0x3b'));}if(_0x5d3c71[_0xa650('0x1a')]>0x0){return manageTags(_0x10fc1e,_0x5d3c71,_0x32b0c1,_0x745c10,_0x215780,_0x298ee3,_0x3f0591)[_0xa650('0xe')](function(){_0x26547b(_0x215780);});}else{_0x26547b(_0x215780);}});};}function emit(_0x2720ba,_0x4f1970,_0x2c55b2){var _0x5e7235=_0xa650('0x4c')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xa650('0x4d')+_0xa650('0x4e');var _0x2e9180={'uri':_0x2720ba+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x2c55b2+_0x5e7235};io['to'](util['format'](_0xa650('0x4f'),_0x4f1970))['emit']('trigger:browser:url',_0x2e9180);}exports['cs']=function(_0x574936,_0x39296a,_0x146fbc,_0x2a571c,_0x32b68e,_0x5cf88f,_0x115df9,_0x1233d0){var _0xfdfd54={};var _0x374d42={'user':_0x5cf88f[_0xa650('0x50')],'pass':_0x5cf88f[_0xa650('0x51')]};var _0x5a9859='sysparm_limit=1';var _0x8393ea=_0xa650('0x52');_0x5cf88f[_0xa650('0x53')]=intUtil[_0xa650('0x54')](_0x5cf88f[_0xa650('0x53')]);_0x5cf88f['serverUrl']=intUtil['stripTrailingSlash'](_0x5cf88f['serverUrl']);var _0x336bfc=util['format'](_0xa650('0x55'),_0x5cf88f[_0xa650('0x53')]);_0xfdfd54[_0xa650('0x17')]=!_[_0xa650('0x56')](_0x2a571c)?_0x2a571c['email']:null;_0xfdfd54[_0xa650('0x1e')]=_0x5cf88f['email'];_0xfdfd54['endUserNumber']=_0x1233d0['toLowerCase']()==='outbound'?_0x39296a[_0xa650('0x57')]:_0x39296a[_0xa650('0x58')];_0xfdfd54['callDirection']=_0x1233d0===_0xa650('0x59')||_0x1233d0===_0xa650('0x5a')?_0xa650('0x59'):_0xa650('0x3d');var _0x282bff=util['format'](_0xa650('0x5b'),_0x5cf88f[_0xa650('0x5c')],_0x39296a[_0xa650('0x5d')],md5(_0x39296a[_0xa650('0x5d')]));if(_0x32b68e&&_0x32b68e[_0xa650('0x5e')]){logger[_0xa650('0x12')](_0xa650('0x5f'),_0xa650('0x60'));_0x39296a[_0xa650('0x61')]=_0x282bff;}else if(_0x115df9&&_0x115df9[_0xa650('0x62')]&&_0x115df9['recordingFormat']!==_0xa650('0x63')){logger[_0xa650('0x12')](_0xa650('0x64'),_0xa650('0x60'));_0x39296a[_0xa650('0x61')]=_0x282bff;}else{_0x39296a[_0xa650('0x61')]='';}return getAdminUser(_0x1233d0,_0x374d42,_0xfdfd54,_0x336bfc,_0x8393ea,_0x5a9859)[_0xa650('0xe')](getUser(_0x1233d0,_0x374d42,_0x336bfc,_0x8393ea,_0x5a9859))[_0xa650('0xe')](getEndUser(_0x1233d0,_0x374d42,_0x336bfc,_0x8393ea,_0x5a9859))[_0xa650('0xe')](getTicket(_0x1233d0,_0x374d42,_0x336bfc,_0x146fbc,_0x39296a,_0x8393ea))['then'](function(_0x50341d){logger[_0xa650('0x12')](util[_0xa650('0x65')](_0xa650('0x66'),_0x50341d[_0xa650('0x41')]));logger['info'](util['format'](_0xa650('0x67'),_0x1233d0));if(_0x1233d0!==_0xa650('0x5a')){logger[_0xa650('0x12')]('['+[_0x1233d0[_0xa650('0x13')]()]+']',_0xa650('0x68'));emit(_0x5cf88f[_0xa650('0x53')],_0x2a571c[_0xa650('0x3b')],_0x50341d[_0xa650('0x41')]);}})[_0xa650('0x20')](function(_0x355f35){logger[_0xa650('0x14')]('['+[_0x1233d0['toUpperCase']()]+_0xa650('0x69'),util[_0xa650('0x6a')](_0x355f35,{'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 f8b37fa..2ea7f76 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 _0x5ece=['nameField','toLowerCase','toString','custom_fields','push','variable','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','remoteUri','serverUrl','stripTrailingSlash','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','outbound','uri','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','trigger:browser:url','error','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','md5','./util','../../../../config/environment','redis','defaults','localhost','POST','Creating\x20new\x20ticket...','getString','Subjects','assigned_user_id','created_by','description','toISOString','slice','replace','parent_id','parent_type','Contacts','parent_name','name','direction','forEach','variableName','idField','set_entry','JSON','stringify','format','Basic\x20%s','apiKey','base64','isNil','info','Getting\x20agent\x20with\x20name','user_name','then','length','find','entry_list','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','get_entry_list','phone_home','Enduser\x20found!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','[HTTP]','merge','map','type','string','customField'];(function(_0x4608e2,_0x57e1eb){var _0x3e3164=function(_0xacdb92){while(--_0xacdb92){_0x4608e2['push'](_0x4608e2['shift']());}};_0x3e3164(++_0x57e1eb);}(_0x5ece,0x123));var _0xe5ec=function(_0x2028e0,_0x4a8eb6){_0x2028e0=_0x2028e0-0x0;var _0x5ea314=_0x5ece[_0x2028e0];return _0x5ea314;};'use strict';var _=require(_0xe5ec('0x0'));var rp=require(_0xe5ec('0x1'));var BPromise=require(_0xe5ec('0x2'));var md5=require(_0xe5ec('0x3'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xe5ec('0x4'));var config=require(_0xe5ec('0x5'));var logger=require('../../../../config/logger')('sugarcrm');config[_0xe5ec('0x6')]=_[_0xe5ec('0x7')](config['redis'],{'host':_0xe5ec('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe5ec('0x6')]));var def={'method':_0xe5ec('0x9'),'json':!![]};function emit(_0x1b8cc8,_0x4e526b,_0x21f5fb){io['to'](_0x1b8cc8)['emit'](_0x4e526b,_0x21f5fb);}function getTicket(_0x76205e,_0x31d675,_0x5a03a9,_0x1dd20d,_0x32d6e1,_0xb591b7,_0x2dfbbd,_0x69cc02){logger['info'](_0xe5ec('0xa'));var _0x3b186d=new Date();var _0x555546=[{'name':'name','value':intUtil[_0xe5ec('0xb')](_0x1dd20d[_0xe5ec('0xc')],_0x32d6e1,'\x20')},{'name':_0xe5ec('0xd'),'value':_0x31d675['id']},{'name':_0xe5ec('0xe'),'value':_0x31d675['id']},{'name':_0xe5ec('0xf'),'value':intUtil['getString'](_0x1dd20d['Descriptions'],_0x32d6e1,'\x0a')},{'name':'date_start','value':_0x3b186d[_0xe5ec('0x10')]()[_0xe5ec('0x11')](0x0,0x13)[_0xe5ec('0x12')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0xe5ec('0x13'),'value':_0x5a03a9['id']},{'name':_0xe5ec('0x14'),'value':_0xe5ec('0x15')},{'name':_0xe5ec('0x16'),'value':_0x5a03a9[_0xe5ec('0x17')]},{'name':_0xe5ec('0x18'),'value':_0x69cc02}];if(_0xb591b7['length']){_[_0xe5ec('0x19')](_0xb591b7,function(_0x9d9677){if(_0x32d6e1[_0x9d9677[_0xe5ec('0x1a')]]){_0x555546['push']({'name':_0x9d9677[_0xe5ec('0x1b')],'value':_0x32d6e1[_0x9d9677[_0xe5ec('0x1a')]]});}});}return request({'form':{'method':_0xe5ec('0x1c'),'input_type':_0xe5ec('0x1d'),'response_type':_0xe5ec('0x1d'),'rest_data':JSON[_0xe5ec('0x1e')]({'session':_0x2dfbbd['id'],'module_name':'Calls','name_value_list':_0x555546})}});}function getAuth(_0x38215c){return util[_0xe5ec('0x1f')](_0xe5ec('0x20'),new Buffer(_0x38215c[_0xe5ec('0x21')]+':X')['toString'](_0xe5ec('0x22')));}function getServerInfo(_0x25f196){return request({'form':{'method':'get_server_info','input_type':_0xe5ec('0x1d'),'response_type':_0xe5ec('0x1d'),'rest_data':JSON[_0xe5ec('0x1e')]({'session':_0x25f196['id']})}});}function getUser(_0x5d076b,_0x40c20e,_0x327b85){if(!_[_0xe5ec('0x23')](_0x40c20e)){logger[_0xe5ec('0x24')](_0xe5ec('0x25'),_0x40c20e);return request({'form':{'method':'get_entry_list','input_type':_0xe5ec('0x1d'),'response_type':_0xe5ec('0x1d'),'rest_data':JSON[_0xe5ec('0x1e')]({'session':_0x327b85['id'],'module_name':'Employees','query':util[_0xe5ec('0x1f')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x40c20e),'order_by':'','offset':'0','select_fields':['id',_0xe5ec('0x17'),_0xe5ec('0x26')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xe5ec('0x27')](function(_0x53ab73){if(_0x53ab73['entry_list'][_0xe5ec('0x28')]){var _0x2bb164=_[_0xe5ec('0x29')](_0x53ab73[_0xe5ec('0x2a')],function(_0x58e5f4){return _0x58e5f4[_0xe5ec('0x2b')][_0xe5ec('0x26')][_0xe5ec('0x2c')]===_0x40c20e;});if(_0x2bb164){logger['info'](_0xe5ec('0x2d'));return BPromise[_0xe5ec('0x2e')]({'id':_0x2bb164[_0xe5ec('0x2b')]['id']['value'],'name':_0x2bb164[_0xe5ec('0x2b')][_0xe5ec('0x17')][_0xe5ec('0x2c')]});}}logger['info'](_0xe5ec('0x2f'));return BPromise['resolve']({'id':_0x327b85[_0xe5ec('0x2b')]['user_id']['value'],'name':_0x327b85[_0xe5ec('0x2b')]['user_name'][_0xe5ec('0x2c')]});});}else{logger[_0xe5ec('0x24')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0xe5ec('0x2e')]({'id':_0x327b85[_0xe5ec('0x2b')][_0xe5ec('0x30')][_0xe5ec('0x2c')],'name':_0x327b85[_0xe5ec('0x2b')][_0xe5ec('0x26')][_0xe5ec('0x2c')]});}}function getEndUser(_0x254a8c,_0x509ee0,_0x658a30,_0x3ae8cb){logger['info'](_0xe5ec('0x31'),_0x658a30);return request({'form':{'method':_0xe5ec('0x32'),'input_type':_0xe5ec('0x1d'),'response_type':_0xe5ec('0x1d'),'rest_data':JSON[_0xe5ec('0x1e')]({'session':_0x3ae8cb['id'],'module_name':'Contacts','query':util['format']('contacts.phone_home\x20=\x20\x22%s\x22',_0x658a30),'order_by':'','offset':'0','select_fields':['id',_0xe5ec('0x17'),_0xe5ec('0x33')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xe5ec('0x27')](function(_0x57600e){if(_0x57600e[_0xe5ec('0x2a')][_0xe5ec('0x28')]){var _0x7a6f51=_[_0xe5ec('0x29')](_0x57600e[_0xe5ec('0x2a')],function(_0x1bacde){return _0x1bacde[_0xe5ec('0x2b')][_0xe5ec('0x33')][_0xe5ec('0x2c')]===_0x658a30;});if(_0x7a6f51){logger[_0xe5ec('0x24')](_0xe5ec('0x34'));return BPromise[_0xe5ec('0x2e')]({'id':_0x7a6f51['name_value_list']['id'][_0xe5ec('0x2c')],'name':_0x7a6f51['name_value_list'][_0xe5ec('0x17')][_0xe5ec('0x2c')],'phone':_0x7a6f51[_0xe5ec('0x2b')][_0xe5ec('0x33')]['value']});}}else{logger[_0xe5ec('0x24')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xe5ec('0x1c'),'input_type':_0xe5ec('0x1d'),'response_type':'JSON','rest_data':JSON[_0xe5ec('0x1e')]({'session':_0x3ae8cb['id'],'module_name':'Contacts','name_value_list':[{'name':_0xe5ec('0x35'),'value':_0x509ee0!==_0xe5ec('0x36')?_0x509ee0:util['format'](_0xe5ec('0x37'),_0x658a30)},{'name':_0xe5ec('0x33'),'value':_0x658a30}]})}})[_0xe5ec('0x27')](function(_0x4ad182){logger['info'](_0xe5ec('0x38'));return BPromise['resolve']({'id':_0x4ad182['id'],'name':_0x4ad182[_0xe5ec('0x2a')][_0xe5ec('0x35')][_0xe5ec('0x2c')],'phone':_0x4ad182[_0xe5ec('0x2a')][_0xe5ec('0x33')][_0xe5ec('0x2c')]});});}});}function request(_0x349be2){logger['debug'](_0xe5ec('0x39'),JSON[_0xe5ec('0x1e')](_0x349be2));return rp(_[_0xe5ec('0x3a')](def,_0x349be2));}function getTags(_0x18e384,_0xc03f78){var _0x3267f5=[];if(_0x18e384&&_0x18e384['length']>0x0){_0x3267f5=_[_0xe5ec('0x3b')](_0x18e384,_0xc03f78);}return _0x3267f5;}function getCustomFields(_0x210697,_0x21e79a){var _0x5a8851=[];var _0x2e786c={'custom_fields':[]};if(_0x210697[_0xe5ec('0x28')]>0x0){_[_0xe5ec('0x19')](_0x210697,function(_0x1e04bb){if(_0x1e04bb[_0xe5ec('0x3c')]===_0xe5ec('0x3d')&&_0x1e04bb['nameField']&&!_0x1e04bb[_0xe5ec('0x3e')]){_0x2e786c[_0x1e04bb[_0xe5ec('0x3f')][_0xe5ec('0x40')]()]=_0x1e04bb['content'][_0xe5ec('0x41')]();}else if(_0x1e04bb[_0xe5ec('0x3c')]==='string'&&_0x1e04bb['idField']&&_0x1e04bb[_0xe5ec('0x3e')]){_0x2e786c[_0xe5ec('0x42')][_0xe5ec('0x43')]({'id':_0x1e04bb[_0xe5ec('0x1b')],'value':_0x1e04bb['content'][_0xe5ec('0x41')]()});}else if(_0x1e04bb['type']===_0xe5ec('0x44')&&_0x1e04bb['variableName']&&_0x1e04bb[_0xe5ec('0x1b')]&&_0x1e04bb[_0xe5ec('0x3e')]){_0x21e79a[_0x1e04bb[_0xe5ec('0x1a')]]&&_0x2e786c[_0xe5ec('0x42')][_0xe5ec('0x43')]({'id':_0x1e04bb[_0xe5ec('0x1b')],'value':_0x21e79a[_0x1e04bb[_0xe5ec('0x1a')]]['toString']()});}else if(_0x1e04bb[_0xe5ec('0x3c')]===_0xe5ec('0x45')&&_0x1e04bb[_0xe5ec('0x46')]&&_0x1e04bb[_0xe5ec('0x46')][_0xe5ec('0x17')]&&_0x1e04bb[_0xe5ec('0x1b')]&&_0x1e04bb[_0xe5ec('0x3e')]){_0x21e79a[_0x1e04bb[_0xe5ec('0x46')][_0xe5ec('0x17')][_0xe5ec('0x40')]()]&&_0x2e786c[_0xe5ec('0x42')][_0xe5ec('0x43')]({'id':_0x1e04bb[_0xe5ec('0x1b')],'value':_0x21e79a[_0x1e04bb['Variable'][_0xe5ec('0x17')][_0xe5ec('0x40')]()][_0xe5ec('0x41')]()});}});}return _0x2e786c;}function getConnection(_0x33e97a){return request({'method':_0xe5ec('0x9'),'form':{'method':_0xe5ec('0x47'),'input_type':'JSON','response_type':_0xe5ec('0x1d'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x33e97a[_0xe5ec('0x48')],'password':_0x33e97a[_0xe5ec('0x49')],'encryption':_0xe5ec('0x4a')},'application':_0xe5ec('0x4b')})}})['then'](function(_0x53d8f4){var _0x4f9976=_0x53d8f4;if(_0x4f9976['id']){def['sessionID']=_0x4f9976['id'];return BPromise[_0xe5ec('0x2e')](_0x4f9976);}else{throw new Error(util['format'](_0xe5ec('0x4c'),_0x33e97a['id']));}});}function setRelationship(_0x5cf861,_0x41ba46,_0x3b07e8,_0x1c9638){return request({'form':{'method':_0xe5ec('0x4d'),'input_type':_0xe5ec('0x1d'),'response_type':_0xe5ec('0x1d'),'rest_data':JSON[_0xe5ec('0x1e')]({'session':_0x5cf861['id'],'module_name':_0xe5ec('0x4e'),'module_id':_0x3b07e8['id'],'link_field_name':_0x1c9638,'related_ids':[_0x41ba46['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0xad2a6d,_0x1ae074,_0x34e59a,_0x21ec43,_0x59c71b,_0x222503){var _0x2f0fb2,_0x5018a6,_0x57db39,_0x11a2ca;_0x222503[_0xe5ec('0x4f')]=intUtil['stripTrailingSlash'](_0x222503[_0xe5ec('0x4f')]);_0x222503[_0xe5ec('0x50')]=intUtil[_0xe5ec('0x51')](_0x222503[_0xe5ec('0x50')]);def['uri']=util[_0xe5ec('0x1f')](_0xe5ec('0x52'),_0x222503['remoteUri']);if(_0x59c71b&&_0x59c71b[_0xe5ec('0x53')]){logger[_0xe5ec('0x24')](_0xe5ec('0x54'),_0xe5ec('0x55'));_0x1ae074[_0xe5ec('0x56')]=util[_0xe5ec('0x1f')](_0xe5ec('0x57'),_0x222503[_0xe5ec('0x50')],_0x1ae074[_0xe5ec('0x58')],md5(_0x1ae074[_0xe5ec('0x58')]));}else{_0x1ae074[_0xe5ec('0x56')]='';}return getConnection(_0x222503)[_0xe5ec('0x27')](function(_0x47e85e){_0x11a2ca=_0x47e85e;return getUser(_0x222503,_0x21ec43[_0xe5ec('0x17')],_0x11a2ca);})['then'](function(_0x4727ff){_0x2f0fb2=_0x4727ff;logger[_0xe5ec('0x24')](_0xe5ec('0x59'),_0x2f0fb2['id']);return getEndUser(_0x222503,_0x1ae074[_0xe5ec('0x5a')],_0x1ae074[_0xe5ec('0x5b')],_0x11a2ca);})[_0xe5ec('0x27')](function(_0x420139){_0x5018a6=_0x420139;logger[_0xe5ec('0x24')](_0xe5ec('0x5c'),_0x5018a6['id']);return getTicket(_0x222503,_0x2f0fb2,_0x5018a6,_0x34e59a,_0x1ae074,_0x34e59a[_0xe5ec('0x5d')],_0x11a2ca,_0xe5ec('0x5e'));})[_0xe5ec('0x27')](function(_0x9aa5b6){_0x57db39=_0x9aa5b6;logger[_0xe5ec('0x24')](_0xe5ec('0x5f'));logger['info'](_0xe5ec('0x60'),_0x57db39['id']);return setRelationship(_0x11a2ca,_0x2f0fb2,_0x57db39,_0xe5ec('0x61'));})['then'](function(){return setRelationship(_0x11a2ca,_0x5018a6,_0x57db39,_0xe5ec('0x62'));})['then'](function(){return getServerInfo(_0x11a2ca);})[_0xe5ec('0x27')](function(_0x3dd224){var _0x15b79c=parseInt(_0x3dd224[_0xe5ec('0x63')]['charAt'](0x0));var _0x596c83=util[_0xe5ec('0x1f')](_0xe5ec('0x64'),_0x222503[_0xe5ec('0x4f')],_0x57db39['id']);if(_0x15b79c>0x6){_0x596c83=util[_0xe5ec('0x1f')](_0xe5ec('0x65'),_0x222503[_0xe5ec('0x4f')],_0x57db39['id']);}logger[_0xe5ec('0x24')]('[QUEUE]',_0xe5ec('0x66'));emit(util[_0xe5ec('0x1f')](_0xe5ec('0x67'),_0x21ec43[_0xe5ec('0x17')]),'trigger:browser:url',{'uri':_0x596c83});})[_0xe5ec('0x68')](function(_0x3e5e20){logger['error']('[QUEUE]',JSON[_0xe5ec('0x1e')](_0x3e5e20));});};exports[_0xe5ec('0x69')]=function(_0x321db9,_0x17dc8f,_0x48176d,_0x24452e,_0x481a9c,_0x4d72e9,_0x547c11){var _0x21a31b,_0x5bd396,_0x2d700d,_0x243ee6;_0x4d72e9[_0xe5ec('0x4f')]=intUtil[_0xe5ec('0x51')](_0x4d72e9[_0xe5ec('0x4f')]);_0x4d72e9[_0xe5ec('0x50')]=intUtil[_0xe5ec('0x51')](_0x4d72e9['serverUrl']);def[_0xe5ec('0x6a')]=util[_0xe5ec('0x1f')](_0xe5ec('0x52'),_0x4d72e9[_0xe5ec('0x4f')]);if(_0x547c11&&_0x547c11['recordingFormat']&&_0x547c11[_0xe5ec('0x6b')]!==_0xe5ec('0x6c')){logger[_0xe5ec('0x24')](_0xe5ec('0x6d'),_0xe5ec('0x55'));_0x17dc8f[_0xe5ec('0x56')]=util[_0xe5ec('0x1f')](_0xe5ec('0x57'),_0x4d72e9[_0xe5ec('0x50')],_0x17dc8f['uniqueid'],md5(_0x17dc8f[_0xe5ec('0x58')]));}return getConnection(_0x4d72e9)['then'](function(_0x350cd0){_0x243ee6=_0x350cd0;return getUser(_0x4d72e9,_0x24452e[_0xe5ec('0x17')],_0x243ee6);})[_0xe5ec('0x27')](function(_0x4137e2){_0x21a31b=_0x4137e2;logger[_0xe5ec('0x24')](_0xe5ec('0x59'),_0x21a31b['id']);return getEndUser(_0x4d72e9,_0x17dc8f[_0xe5ec('0x6e')],_0x17dc8f[_0xe5ec('0x6f')],_0x243ee6);})[_0xe5ec('0x27')](function(_0x3ee678){_0x5bd396=_0x3ee678;logger[_0xe5ec('0x24')](_0xe5ec('0x5c'),_0x5bd396['id']);return getTicket(_0x4d72e9,_0x21a31b,_0x5bd396,_0x48176d,_0x17dc8f,_0x48176d[_0xe5ec('0x5d')],_0x243ee6,_0xe5ec('0x70'));})[_0xe5ec('0x27')](function(_0x3d2295){_0x2d700d=_0x3d2295;logger['info'](_0xe5ec('0x5f'));logger[_0xe5ec('0x24')](_0xe5ec('0x60'),_0x2d700d['id']);return setRelationship(_0x243ee6,_0x21a31b,_0x2d700d,'users');})[_0xe5ec('0x27')](function(){return setRelationship(_0x243ee6,_0x5bd396,_0x2d700d,_0xe5ec('0x62'));})[_0xe5ec('0x27')](function(){return getServerInfo(_0x243ee6);})[_0xe5ec('0x27')](function(_0x1db0dc){var _0x569f5e=parseInt(_0x1db0dc[_0xe5ec('0x63')]['charAt'](0x0));var _0x20e45f=util[_0xe5ec('0x1f')](_0xe5ec('0x64'),_0x4d72e9[_0xe5ec('0x4f')],_0x2d700d['id']);if(_0x569f5e>0x6){_0x20e45f=util[_0xe5ec('0x1f')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x4d72e9['remoteUri'],_0x2d700d['id']);}logger[_0xe5ec('0x24')](_0xe5ec('0x6d'),_0xe5ec('0x66'));emit(util[_0xe5ec('0x1f')]('user:%s',_0x24452e[_0xe5ec('0x17')]),_0xe5ec('0x71'),{'uri':_0x20e45f});})[_0xe5ec('0x68')](function(_0x2fd23e){logger[_0xe5ec('0x72')](_0xe5ec('0x6d'),JSON[_0xe5ec('0x1e')](_0x2fd23e));});};exports[_0xe5ec('0x73')]=function(_0x473112,_0x3c6e69,_0x491ff7,_0x57d292,_0x74843b,_0xc292de){var _0x3d2b63,_0x2d008e,_0x13fd7a,_0x4c8943;_0xc292de[_0xe5ec('0x4f')]=intUtil[_0xe5ec('0x51')](_0xc292de[_0xe5ec('0x4f')]);_0xc292de[_0xe5ec('0x50')]=intUtil[_0xe5ec('0x51')](_0xc292de[_0xe5ec('0x50')]);def[_0xe5ec('0x6a')]=util[_0xe5ec('0x1f')](_0xe5ec('0x52'),_0xc292de[_0xe5ec('0x4f')]);if(_0x74843b&&_0x74843b[_0xe5ec('0x53')]){logger['info']('['+_0x3c6e69[_0xe5ec('0x74')][_0xe5ec('0x75')]()+']',_0xe5ec('0x55'));_0x3c6e69[_0xe5ec('0x56')]=util[_0xe5ec('0x1f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xc292de[_0xe5ec('0x50')],_0x3c6e69['uniqueid'],md5(_0x3c6e69[_0xe5ec('0x58')]));}else{_0x3c6e69[_0xe5ec('0x56')]='';}return getConnection(_0xc292de)['then'](function(_0x4a8c59){_0x4c8943=_0x4a8c59;if(!_[_0xe5ec('0x23')](_0x57d292)){return getUser(_0xc292de,_0x57d292[_0xe5ec('0x17')],_0x4c8943);}else{return getUser(_0xc292de,null,_0x4c8943);}})[_0xe5ec('0x27')](function(_0x441021){_0x3d2b63=_0x441021;logger[_0xe5ec('0x24')]('The\x20User\x20ID\x20is:',_0x3d2b63['id']);return getEndUser(_0xc292de,_0x3c6e69[_0xe5ec('0x5a')],_0x3c6e69[_0xe5ec('0x5b')],_0x4c8943);})[_0xe5ec('0x27')](function(_0x162001){_0x2d008e=_0x162001;logger[_0xe5ec('0x24')](_0xe5ec('0x5c'),_0x2d008e['id']);return getTicket(_0xc292de,_0x3d2b63,_0x2d008e,_0x491ff7,_0x3c6e69,_0x491ff7[_0xe5ec('0x5d')],_0x4c8943,'Inbound');})[_0xe5ec('0x27')](function(_0x2c47f4){_0x13fd7a=_0x2c47f4;logger[_0xe5ec('0x24')](_0xe5ec('0x5f'));logger[_0xe5ec('0x24')](_0xe5ec('0x60'),_0x13fd7a['id']);return setRelationship(_0x4c8943,_0x3d2b63,_0x13fd7a,_0xe5ec('0x61'));})[_0xe5ec('0x27')](function(){return setRelationship(_0x4c8943,_0x2d008e,_0x13fd7a,'contacts');})[_0xe5ec('0x27')](function(){return getServerInfo(_0x4c8943);})[_0xe5ec('0x68')](function(_0x48f1fe){logger[_0xe5ec('0x72')]('['+_0x3c6e69['lastevent'][_0xe5ec('0x75')]()+']',JSON['stringify'](_0x48f1fe));});}; \ No newline at end of file +var _0x26be=['parent_id','parent_type','Contacts','parent_name','length','forEach','push','idField','variableName','set_entry','JSON','stringify','Calls','toString','base64','get_server_info','isNil','get_entry_list','Employees','format','user_name','then','find','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','entry_list','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','map','type','string','nameField','toLowerCase','content','customField','custom_fields','variable','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','The\x20Ticket\x20ID\x20is:','users','contacts','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','uri','%s/service/v4_1/rest.php','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridnum','Outbound','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','trigger:browser:url','unmanaged','monitor_format','lastevent','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Fields','toUpperCase','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','Subjects','created_by','getString','toISOString','slice','replace','duration_minutes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x26be,0xda));var _0xe26b=function(_0x33848e,_0x20da56){_0x33848e=_0x33848e-0x0;var _0x5dec0c=_0x26be[_0x33848e];return _0x5dec0c;};'use strict';var _=require(_0xe26b('0x0'));var rp=require(_0xe26b('0x1'));var BPromise=require(_0xe26b('0x2'));var md5=require(_0xe26b('0x3'));var util=require(_0xe26b('0x4'));var Redis=require(_0xe26b('0x5'));var intUtil=require(_0xe26b('0x6'));var config=require('../../../../config/environment');var logger=require(_0xe26b('0x7'))('sugarcrm');config[_0xe26b('0x8')]=_[_0xe26b('0x9')](config[_0xe26b('0x8')],{'host':_0xe26b('0xa'),'port':0x18eb});var io=require(_0xe26b('0xb'))(new Redis(config[_0xe26b('0x8')]));var def={'method':_0xe26b('0xc'),'json':!![]};function emit(_0x1a7877,_0x5784c8,_0x563586){io['to'](_0x1a7877)[_0xe26b('0xd')](_0x5784c8,_0x563586);}function getTicket(_0x5d773d,_0x5613e5,_0x80ae85,_0x5f38c5,_0x481607,_0x12d44c,_0x2b8ed5,_0x129012){logger[_0xe26b('0xe')](_0xe26b('0xf'));var _0x5d8826=new Date();var _0x5066b1=[{'name':_0xe26b('0x10'),'value':intUtil['getString'](_0x5f38c5[_0xe26b('0x11')],_0x481607,'\x20')},{'name':'assigned_user_id','value':_0x5613e5['id']},{'name':_0xe26b('0x12'),'value':_0x5613e5['id']},{'name':'description','value':intUtil[_0xe26b('0x13')](_0x5f38c5['Descriptions'],_0x481607,'\x0a')},{'name':'date_start','value':_0x5d8826[_0xe26b('0x14')]()[_0xe26b('0x15')](0x0,0x13)[_0xe26b('0x16')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0xe26b('0x17'),'value':'15'},{'name':_0xe26b('0x18'),'value':_0x80ae85['id']},{'name':_0xe26b('0x19'),'value':_0xe26b('0x1a')},{'name':_0xe26b('0x1b'),'value':_0x80ae85[_0xe26b('0x10')]},{'name':'direction','value':_0x129012}];if(_0x12d44c[_0xe26b('0x1c')]){_[_0xe26b('0x1d')](_0x12d44c,function(_0x36e142){if(_0x481607[_0x36e142['variableName']]){_0x5066b1[_0xe26b('0x1e')]({'name':_0x36e142[_0xe26b('0x1f')],'value':_0x481607[_0x36e142[_0xe26b('0x20')]]});}});}return request({'form':{'method':_0xe26b('0x21'),'input_type':_0xe26b('0x22'),'response_type':'JSON','rest_data':JSON[_0xe26b('0x23')]({'session':_0x2b8ed5['id'],'module_name':_0xe26b('0x24'),'name_value_list':_0x5066b1})}});}function getAuth(_0x3fd1fb){return util['format']('Basic\x20%s',new Buffer(_0x3fd1fb['apiKey']+':X')[_0xe26b('0x25')](_0xe26b('0x26')));}function getServerInfo(_0x89552a){return request({'form':{'method':_0xe26b('0x27'),'input_type':_0xe26b('0x22'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x89552a['id']})}});}function getUser(_0x15aca3,_0x978194,_0x19d828){if(!_[_0xe26b('0x28')](_0x978194)){logger[_0xe26b('0xe')]('Getting\x20agent\x20with\x20name',_0x978194);return request({'form':{'method':_0xe26b('0x29'),'input_type':'JSON','response_type':_0xe26b('0x22'),'rest_data':JSON['stringify']({'session':_0x19d828['id'],'module_name':_0xe26b('0x2a'),'query':util[_0xe26b('0x2b')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x978194),'order_by':'','offset':'0','select_fields':['id',_0xe26b('0x10'),_0xe26b('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xe26b('0x2d')](function(_0x1c8fbe){if(_0x1c8fbe['entry_list'][_0xe26b('0x1c')]){var _0x582ec6=_[_0xe26b('0x2e')](_0x1c8fbe['entry_list'],function(_0x571eca){return _0x571eca[_0xe26b('0x2f')][_0xe26b('0x2c')][_0xe26b('0x30')]===_0x978194;});if(_0x582ec6){logger['info'](_0xe26b('0x31'));return BPromise[_0xe26b('0x32')]({'id':_0x582ec6[_0xe26b('0x2f')]['id']['value'],'name':_0x582ec6[_0xe26b('0x2f')][_0xe26b('0x10')][_0xe26b('0x30')]});}}logger[_0xe26b('0xe')](_0xe26b('0x33'));return BPromise['resolve']({'id':_0x19d828[_0xe26b('0x2f')][_0xe26b('0x34')]['value'],'name':_0x19d828[_0xe26b('0x2f')][_0xe26b('0x2c')]['value']});});}else{logger[_0xe26b('0xe')](_0xe26b('0x35'));return BPromise[_0xe26b('0x32')]({'id':_0x19d828[_0xe26b('0x2f')]['user_id'][_0xe26b('0x30')],'name':_0x19d828[_0xe26b('0x2f')]['user_name'][_0xe26b('0x30')]});}}function getEndUser(_0x2059c,_0x5b95f2,_0x1a3d74,_0xe06c14){logger[_0xe26b('0xe')](_0xe26b('0x36'),_0x1a3d74);return request({'form':{'method':_0xe26b('0x29'),'input_type':_0xe26b('0x22'),'response_type':_0xe26b('0x22'),'rest_data':JSON[_0xe26b('0x23')]({'session':_0xe06c14['id'],'module_name':'Contacts','query':util[_0xe26b('0x2b')](_0xe26b('0x37'),_0x1a3d74),'order_by':'','offset':'0','select_fields':['id',_0xe26b('0x10'),_0xe26b('0x38')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xe26b('0x2d')](function(_0x18bd00){if(_0x18bd00[_0xe26b('0x39')][_0xe26b('0x1c')]){var _0x4ef2bc=_[_0xe26b('0x2e')](_0x18bd00[_0xe26b('0x39')],function(_0x1f49e1){return _0x1f49e1['name_value_list'][_0xe26b('0x38')][_0xe26b('0x30')]===_0x1a3d74;});if(_0x4ef2bc){logger[_0xe26b('0xe')](_0xe26b('0x3a'));return BPromise[_0xe26b('0x32')]({'id':_0x4ef2bc[_0xe26b('0x2f')]['id']['value'],'name':_0x4ef2bc['name_value_list'][_0xe26b('0x10')]['value'],'phone':_0x4ef2bc[_0xe26b('0x2f')][_0xe26b('0x38')][_0xe26b('0x30')]});}}else{logger['info'](_0xe26b('0x3b'));return request({'form':{'method':'set_entry','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xe26b('0x23')]({'session':_0xe06c14['id'],'module_name':_0xe26b('0x1a'),'name_value_list':[{'name':_0xe26b('0x3c'),'value':_0x5b95f2!==_0xe26b('0x3d')?_0x5b95f2:util['format'](_0xe26b('0x3e'),_0x1a3d74)},{'name':'phone_home','value':_0x1a3d74}]})}})[_0xe26b('0x2d')](function(_0x31d019){logger[_0xe26b('0xe')](_0xe26b('0x3f'));return BPromise['resolve']({'id':_0x31d019['id'],'name':_0x31d019['entry_list'][_0xe26b('0x3c')][_0xe26b('0x30')],'phone':_0x31d019['entry_list']['phone_home']['value']});});}});}function request(_0xd46fcc){logger[_0xe26b('0x40')](_0xe26b('0x41'),JSON[_0xe26b('0x23')](_0xd46fcc));return rp(_['merge'](def,_0xd46fcc));}function getTags(_0x3aa7c0,_0x5d01df){var _0x484628=[];if(_0x3aa7c0&&_0x3aa7c0[_0xe26b('0x1c')]>0x0){_0x484628=_[_0xe26b('0x42')](_0x3aa7c0,_0x5d01df);}return _0x484628;}function getCustomFields(_0x19dde2,_0x416f46){var _0x10330a=[];var _0x980afe={'custom_fields':[]};if(_0x19dde2[_0xe26b('0x1c')]>0x0){_['forEach'](_0x19dde2,function(_0x53df26){if(_0x53df26[_0xe26b('0x43')]===_0xe26b('0x44')&&_0x53df26[_0xe26b('0x45')]&&!_0x53df26['customField']){_0x980afe[_0x53df26[_0xe26b('0x45')][_0xe26b('0x46')]()]=_0x53df26[_0xe26b('0x47')]['toString']();}else if(_0x53df26['type']===_0xe26b('0x44')&&_0x53df26[_0xe26b('0x1f')]&&_0x53df26[_0xe26b('0x48')]){_0x980afe[_0xe26b('0x49')][_0xe26b('0x1e')]({'id':_0x53df26[_0xe26b('0x1f')],'value':_0x53df26['content'][_0xe26b('0x25')]()});}else if(_0x53df26[_0xe26b('0x43')]===_0xe26b('0x4a')&&_0x53df26[_0xe26b('0x20')]&&_0x53df26['idField']&&_0x53df26[_0xe26b('0x48')]){_0x416f46[_0x53df26[_0xe26b('0x20')]]&&_0x980afe[_0xe26b('0x49')][_0xe26b('0x1e')]({'id':_0x53df26['idField'],'value':_0x416f46[_0x53df26[_0xe26b('0x20')]][_0xe26b('0x25')]()});}else if(_0x53df26[_0xe26b('0x43')]===_0xe26b('0x4b')&&_0x53df26[_0xe26b('0x4c')]&&_0x53df26[_0xe26b('0x4c')]['name']&&_0x53df26[_0xe26b('0x1f')]&&_0x53df26['customField']){_0x416f46[_0x53df26[_0xe26b('0x4c')][_0xe26b('0x10')][_0xe26b('0x46')]()]&&_0x980afe['custom_fields'][_0xe26b('0x1e')]({'id':_0x53df26[_0xe26b('0x1f')],'value':_0x416f46[_0x53df26['Variable'][_0xe26b('0x10')][_0xe26b('0x46')]()][_0xe26b('0x25')]()});}});}return _0x980afe;}function getConnection(_0x42296){return request({'method':_0xe26b('0xc'),'form':{'method':_0xe26b('0x4d'),'input_type':_0xe26b('0x22'),'response_type':_0xe26b('0x22'),'rest_data':JSON[_0xe26b('0x23')]({'user_auth':{'user_name':_0x42296[_0xe26b('0x4e')],'password':_0x42296[_0xe26b('0x4f')],'encryption':_0xe26b('0x50')},'application':_0xe26b('0x51')})}})[_0xe26b('0x2d')](function(_0x25d58f){var _0x5726d1=_0x25d58f;if(_0x5726d1['id']){def['sessionID']=_0x5726d1['id'];return BPromise['resolve'](_0x5726d1);}else{throw new Error(util[_0xe26b('0x2b')](_0xe26b('0x52'),_0x42296['id']));}});}function setRelationship(_0x32d48a,_0x1c0afd,_0x574722,_0x407c1f){return request({'form':{'method':_0xe26b('0x53'),'input_type':_0xe26b('0x22'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x32d48a['id'],'module_name':_0xe26b('0x24'),'module_id':_0x574722['id'],'link_field_name':_0x407c1f,'related_ids':[_0x1c0afd['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xe26b('0x54')]=function(_0x335209,_0x24192a,_0x8d0cd4,_0x19ab6c,_0x45c953,_0x3ae54a){var _0x497e57,_0x3c600a,_0x5aabb9,_0x3f87d4;_0x3ae54a[_0xe26b('0x55')]=intUtil[_0xe26b('0x56')](_0x3ae54a[_0xe26b('0x55')]);_0x3ae54a[_0xe26b('0x57')]=intUtil[_0xe26b('0x56')](_0x3ae54a['serverUrl']);def['uri']=util['format']('%s/service/v4_1/rest.php',_0x3ae54a[_0xe26b('0x55')]);if(_0x45c953&&_0x45c953['monitor_format']){logger['info'](_0xe26b('0x58'),_0xe26b('0x59'));_0x24192a['recordingURL']=util[_0xe26b('0x2b')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ae54a[_0xe26b('0x57')],_0x24192a[_0xe26b('0x5a')],md5(_0x24192a['uniqueid']));}else{_0x24192a[_0xe26b('0x5b')]='';}return getConnection(_0x3ae54a)[_0xe26b('0x2d')](function(_0x31f4ab){_0x3f87d4=_0x31f4ab;return getUser(_0x3ae54a,_0x19ab6c[_0xe26b('0x10')],_0x3f87d4);})[_0xe26b('0x2d')](function(_0x25e15a){_0x497e57=_0x25e15a;logger[_0xe26b('0xe')]('The\x20User\x20ID\x20is:',_0x497e57['id']);return getEndUser(_0x3ae54a,_0x24192a[_0xe26b('0x5c')],_0x24192a[_0xe26b('0x5d')],_0x3f87d4);})[_0xe26b('0x2d')](function(_0x2b58fd){_0x3c600a=_0x2b58fd;logger[_0xe26b('0xe')](_0xe26b('0x5e'),_0x3c600a['id']);return getTicket(_0x3ae54a,_0x497e57,_0x3c600a,_0x8d0cd4,_0x24192a,_0x8d0cd4['Fields'],_0x3f87d4,_0xe26b('0x5f'));})[_0xe26b('0x2d')](function(_0x4fa5fa){_0x5aabb9=_0x4fa5fa;logger[_0xe26b('0xe')]('Ticket\x20created!');logger['info'](_0xe26b('0x60'),_0x5aabb9['id']);return setRelationship(_0x3f87d4,_0x497e57,_0x5aabb9,_0xe26b('0x61'));})[_0xe26b('0x2d')](function(){return setRelationship(_0x3f87d4,_0x3c600a,_0x5aabb9,_0xe26b('0x62'));})[_0xe26b('0x2d')](function(){return getServerInfo(_0x3f87d4);})[_0xe26b('0x2d')](function(_0x1c3720){var _0x134fc7=parseInt(_0x1c3720['version']['charAt'](0x0));var _0x55d933=util[_0xe26b('0x2b')](_0xe26b('0x63'),_0x3ae54a[_0xe26b('0x55')],_0x5aabb9['id']);if(_0x134fc7>0x6){_0x55d933=util[_0xe26b('0x2b')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x3ae54a[_0xe26b('0x55')],_0x5aabb9['id']);}logger[_0xe26b('0xe')](_0xe26b('0x58'),_0xe26b('0x64'));emit(util[_0xe26b('0x2b')](_0xe26b('0x65'),_0x19ab6c[_0xe26b('0x10')]),'trigger:browser:url',{'uri':_0x55d933});})[_0xe26b('0x66')](function(_0x304fc2){logger[_0xe26b('0x67')](_0xe26b('0x58'),JSON['stringify'](_0x304fc2));});};exports['outbound']=function(_0x569f02,_0x4db90f,_0x4d929b,_0xb1e5ae,_0x40a910,_0x47b26e,_0x194630){var _0x521d83,_0x5ed78d,_0x671432,_0x4e6d79;_0x47b26e['remoteUri']=intUtil['stripTrailingSlash'](_0x47b26e[_0xe26b('0x55')]);_0x47b26e[_0xe26b('0x57')]=intUtil[_0xe26b('0x56')](_0x47b26e[_0xe26b('0x57')]);def[_0xe26b('0x68')]=util[_0xe26b('0x2b')](_0xe26b('0x69'),_0x47b26e[_0xe26b('0x55')]);if(_0x194630&&_0x194630[_0xe26b('0x6a')]&&_0x194630['recordingFormat']!==_0xe26b('0x6b')){logger[_0xe26b('0xe')](_0xe26b('0x6c'),_0xe26b('0x59'));_0x4db90f['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x47b26e['serverUrl'],_0x4db90f[_0xe26b('0x5a')],md5(_0x4db90f[_0xe26b('0x5a')]));}return getConnection(_0x47b26e)[_0xe26b('0x2d')](function(_0x28c5b9){_0x4e6d79=_0x28c5b9;return getUser(_0x47b26e,_0xb1e5ae[_0xe26b('0x10')],_0x4e6d79);})[_0xe26b('0x2d')](function(_0x1a095e){_0x521d83=_0x1a095e;logger[_0xe26b('0xe')](_0xe26b('0x6d'),_0x521d83['id']);return getEndUser(_0x47b26e,_0x4db90f['destcalleridname'],_0x4db90f[_0xe26b('0x6e')],_0x4e6d79);})[_0xe26b('0x2d')](function(_0x460d02){_0x5ed78d=_0x460d02;logger[_0xe26b('0xe')]('The\x20Enduser\x20ID\x20is:',_0x5ed78d['id']);return getTicket(_0x47b26e,_0x521d83,_0x5ed78d,_0x4d929b,_0x4db90f,_0x4d929b['Fields'],_0x4e6d79,_0xe26b('0x6f'));})[_0xe26b('0x2d')](function(_0x584114){_0x671432=_0x584114;logger[_0xe26b('0xe')]('Ticket\x20created!');logger[_0xe26b('0xe')](_0xe26b('0x60'),_0x671432['id']);return setRelationship(_0x4e6d79,_0x521d83,_0x671432,_0xe26b('0x61'));})['then'](function(){return setRelationship(_0x4e6d79,_0x5ed78d,_0x671432,'contacts');})[_0xe26b('0x2d')](function(){return getServerInfo(_0x4e6d79);})['then'](function(_0x5d97a1){var _0x529708=parseInt(_0x5d97a1['version'][_0xe26b('0x70')](0x0));var _0x5db0a6=util[_0xe26b('0x2b')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x47b26e[_0xe26b('0x55')],_0x671432['id']);if(_0x529708>0x6){_0x5db0a6=util[_0xe26b('0x2b')](_0xe26b('0x71'),_0x47b26e[_0xe26b('0x55')],_0x671432['id']);}logger['info'](_0xe26b('0x6c'),_0xe26b('0x64'));emit(util[_0xe26b('0x2b')]('user:%s',_0xb1e5ae[_0xe26b('0x10')]),_0xe26b('0x72'),{'uri':_0x5db0a6});})[_0xe26b('0x66')](function(_0x52726c){logger['error'](_0xe26b('0x6c'),JSON['stringify'](_0x52726c));});};exports[_0xe26b('0x73')]=function(_0x1e3b23,_0x5e7821,_0x1225be,_0x22ab64,_0x3e9763,_0x1771dd){var _0x2cfcb7,_0x5aacd7,_0x44de94,_0xba6322;_0x1771dd[_0xe26b('0x55')]=intUtil[_0xe26b('0x56')](_0x1771dd[_0xe26b('0x55')]);_0x1771dd[_0xe26b('0x57')]=intUtil['stripTrailingSlash'](_0x1771dd['serverUrl']);def[_0xe26b('0x68')]=util[_0xe26b('0x2b')]('%s/service/v4_1/rest.php',_0x1771dd['remoteUri']);if(_0x3e9763&&_0x3e9763[_0xe26b('0x74')]){logger[_0xe26b('0xe')]('['+_0x5e7821[_0xe26b('0x75')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x5e7821['recordingURL']=util['format'](_0xe26b('0x76'),_0x1771dd[_0xe26b('0x57')],_0x5e7821[_0xe26b('0x5a')],md5(_0x5e7821[_0xe26b('0x5a')]));}else{_0x5e7821['recordingURL']='';}return getConnection(_0x1771dd)['then'](function(_0x7adc11){_0xba6322=_0x7adc11;if(!_[_0xe26b('0x28')](_0x22ab64)){return getUser(_0x1771dd,_0x22ab64[_0xe26b('0x10')],_0xba6322);}else{return getUser(_0x1771dd,null,_0xba6322);}})[_0xe26b('0x2d')](function(_0x55195b){_0x2cfcb7=_0x55195b;logger[_0xe26b('0xe')](_0xe26b('0x6d'),_0x2cfcb7['id']);return getEndUser(_0x1771dd,_0x5e7821[_0xe26b('0x5c')],_0x5e7821['calleridnum'],_0xba6322);})[_0xe26b('0x2d')](function(_0x48f83b){_0x5aacd7=_0x48f83b;logger[_0xe26b('0xe')](_0xe26b('0x5e'),_0x5aacd7['id']);return getTicket(_0x1771dd,_0x2cfcb7,_0x5aacd7,_0x1225be,_0x5e7821,_0x1225be[_0xe26b('0x77')],_0xba6322,_0xe26b('0x5f'));})[_0xe26b('0x2d')](function(_0x25adb3){_0x44de94=_0x25adb3;logger[_0xe26b('0xe')]('Ticket\x20created!');logger[_0xe26b('0xe')]('The\x20Ticket\x20ID\x20is:',_0x44de94['id']);return setRelationship(_0xba6322,_0x2cfcb7,_0x44de94,'users');})[_0xe26b('0x2d')](function(){return setRelationship(_0xba6322,_0x5aacd7,_0x44de94,_0xe26b('0x62'));})[_0xe26b('0x2d')](function(){return getServerInfo(_0xba6322);})['catch'](function(_0xf762f0){logger['error']('['+_0x5e7821[_0xe26b('0x75')][_0xe26b('0x78')]()+']',JSON['stringify'](_0xf762f0));});}; \ 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 e7c0fc9..313b171 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 _0x076c=['keyValue','keyType','key','format','%s:\x20%s','join','stripTrailingSlash','substring','lastIndexOf','validateEmail','isNil','lodash','util','getString','length','sortBy','type','string','push','content','variable','variableName','customVariable','Variable','name','toLowerCase','toString'];(function(_0x5a0b6c,_0x175969){var _0x539441=function(_0x36eeb1){while(--_0x36eeb1){_0x5a0b6c['push'](_0x5a0b6c['shift']());}};_0x539441(++_0x175969);}(_0x076c,0x119));var _0xc076=function(_0x500785,_0x15e5ff){_0x500785=_0x500785-0x0;var _0x1f8bcc=_0x076c[_0x500785];return _0x1f8bcc;};'use strict';var _=require(_0xc076('0x0'));var util=require(_0xc076('0x1'));exports[_0xc076('0x2')]=function(_0x9d77df,_0x577be6,_0x268110){var _0x2e8993=[];if(_0x9d77df[_0xc076('0x3')]>0x0){var _0x4e295e=_[_0xc076('0x4')](_0x9d77df,['id']);for(var _0xbd8f2e=0x0;_0xbd8f2e<_0x4e295e[_0xc076('0x3')];_0xbd8f2e++){var _0x25a81c=_0x4e295e[_0xbd8f2e];if(_0x25a81c[_0xc076('0x5')]===_0xc076('0x6')){_0x2e8993[_0xc076('0x7')](_0x25a81c[_0xc076('0x8')]);}else if(_0x25a81c[_0xc076('0x5')]===_0xc076('0x9')&&_0x25a81c[_0xc076('0xa')]){_0x577be6[_0x25a81c[_0xc076('0xa')]]&&_0x2e8993[_0xc076('0x7')](_0x577be6[_0x25a81c['variableName']]['toString']());}else if(_0x25a81c[_0xc076('0x5')]===_0xc076('0xb')&&_0x25a81c['Variable']&&_0x25a81c[_0xc076('0xc')][_0xc076('0xd')]){_0x577be6[_0x25a81c['Variable'][_0xc076('0xd')][_0xc076('0xe')]()]&&_0x2e8993[_0xc076('0x7')](_0x577be6[_0x25a81c['Variable'][_0xc076('0xd')][_0xc076('0xe')]()][_0xc076('0xf')]());}else if(_0x25a81c[_0xc076('0x5')]===_0xc076('0x10')){if(_0x25a81c[_0xc076('0x11')]===_0xc076('0x6')&&_0x25a81c[_0xc076('0x12')]){_0x2e8993[_0xc076('0x7')](util[_0xc076('0x13')](_0xc076('0x14'),_0x25a81c[_0xc076('0x12')],_0x25a81c['keyContent']));}else if(_0x25a81c[_0xc076('0x11')]==='variable'&&_0x25a81c[_0xc076('0xa')]&&_0x25a81c['key']){_0x577be6[_0x25a81c[_0xc076('0xa')]]&&_0x2e8993['push'](util[_0xc076('0x13')](_0xc076('0x14'),_0x25a81c[_0xc076('0x12')],_0x577be6[_0x25a81c[_0xc076('0xa')]]));}else if(_0x25a81c[_0xc076('0x11')]===_0xc076('0xb')&&_0x25a81c['Variable']&&_0x25a81c[_0xc076('0xc')][_0xc076('0xd')]&&_0x25a81c[_0xc076('0x12')]){_0x577be6[_0x25a81c[_0xc076('0xc')][_0xc076('0xd')][_0xc076('0xe')]()]&&_0x2e8993['push'](util[_0xc076('0x13')](_0xc076('0x14'),_0x25a81c['key'],_0x577be6[_0x25a81c['Variable']['name']['toLowerCase']()]));}}}}return _0x2e8993[_0xc076('0x15')](_0x268110);};exports[_0xc076('0x16')]=function(_0x433296){var _0x574b86=_0x433296['slice'](-0x1);if(_0x574b86==='/'){_0x433296=_0x433296[_0xc076('0x17')](0x0,_0x433296[_0xc076('0x18')](_0x574b86));}return _0x433296;};exports[_0xc076('0x19')]=function(_0x5801f3){if(!_[_0xc076('0x1a')](_0x5801f3)&&_0x5801f3!==''){var _0x2ed204=/^(([^<>()\[\]\\.,;:\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 _0x2ed204['test'](String(_0x5801f3)[_0xc076('0xe')]());}else{return![];}}; \ No newline at end of file +var _0x3566=['slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','getString','length','type','string','push','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','join'];(function(_0x184cfe,_0x1b1785){var _0x24b8e4=function(_0x5f2c3c){while(--_0x5f2c3c){_0x184cfe['push'](_0x184cfe['shift']());}};_0x24b8e4(++_0x1b1785);}(_0x3566,0x126));var _0x6356=function(_0x139225,_0x1a7ba7){_0x139225=_0x139225-0x0;var _0x1ef921=_0x3566[_0x139225];return _0x1ef921;};'use strict';var _=require(_0x6356('0x0'));var util=require('util');exports[_0x6356('0x1')]=function(_0x2eb420,_0x393a49,_0x86bee2){var _0xd8dc4f=[];if(_0x2eb420[_0x6356('0x2')]>0x0){var _0x422182=_['sortBy'](_0x2eb420,['id']);for(var _0x53f9fd=0x0;_0x53f9fd<_0x422182[_0x6356('0x2')];_0x53f9fd++){var _0x480fe9=_0x422182[_0x53f9fd];if(_0x480fe9[_0x6356('0x3')]===_0x6356('0x4')){_0xd8dc4f[_0x6356('0x5')](_0x480fe9['content']);}else if(_0x480fe9[_0x6356('0x3')]==='variable'&&_0x480fe9['variableName']){_0x393a49[_0x480fe9[_0x6356('0x6')]]&&_0xd8dc4f['push'](_0x393a49[_0x480fe9[_0x6356('0x6')]][_0x6356('0x7')]());}else if(_0x480fe9[_0x6356('0x3')]===_0x6356('0x8')&&_0x480fe9[_0x6356('0x9')]&&_0x480fe9[_0x6356('0x9')][_0x6356('0xa')]){_0x393a49[_0x480fe9['Variable']['name'][_0x6356('0xb')]()]&&_0xd8dc4f[_0x6356('0x5')](_0x393a49[_0x480fe9[_0x6356('0x9')][_0x6356('0xa')][_0x6356('0xb')]()][_0x6356('0x7')]());}else if(_0x480fe9['type']===_0x6356('0xc')){if(_0x480fe9[_0x6356('0xd')]===_0x6356('0x4')&&_0x480fe9[_0x6356('0xe')]){_0xd8dc4f[_0x6356('0x5')](util[_0x6356('0xf')]('%s:\x20%s',_0x480fe9[_0x6356('0xe')],_0x480fe9['keyContent']));}else if(_0x480fe9[_0x6356('0xd')]==='variable'&&_0x480fe9[_0x6356('0x6')]&&_0x480fe9[_0x6356('0xe')]){_0x393a49[_0x480fe9[_0x6356('0x6')]]&&_0xd8dc4f[_0x6356('0x5')](util['format'](_0x6356('0x10'),_0x480fe9['key'],_0x393a49[_0x480fe9['variableName']]));}else if(_0x480fe9[_0x6356('0xd')]==='customVariable'&&_0x480fe9[_0x6356('0x9')]&&_0x480fe9[_0x6356('0x9')][_0x6356('0xa')]&&_0x480fe9[_0x6356('0xe')]){_0x393a49[_0x480fe9[_0x6356('0x9')][_0x6356('0xa')][_0x6356('0xb')]()]&&_0xd8dc4f[_0x6356('0x5')](util[_0x6356('0xf')]('%s:\x20%s',_0x480fe9[_0x6356('0xe')],_0x393a49[_0x480fe9[_0x6356('0x9')][_0x6356('0xa')]['toLowerCase']()]));}}}}return _0xd8dc4f[_0x6356('0x11')](_0x86bee2);};exports['stripTrailingSlash']=function(_0x2b9040){var _0x57498e=_0x2b9040[_0x6356('0x12')](-0x1);if(_0x57498e==='/'){_0x2b9040=_0x2b9040[_0x6356('0x13')](0x0,_0x2b9040[_0x6356('0x14')](_0x57498e));}return _0x2b9040;};exports[_0x6356('0x15')]=function(_0x10af95){if(!_[_0x6356('0x16')](_0x10af95)&&_0x10af95!==''){var _0x11b9ce=/^(([^<>()\[\]\\.,;:\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 _0x11b9ce[_0x6356('0x17')](String(_0x10af95)[_0x6356('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 8cf249a..7d97b4c 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 _0xd8b0=['info','Creating\x20new\x20ticket...','merge','Normal','Subjects','POST','format','%s/webservice.php','remoteUri','create','username','sessionName','HelpDesk','stringify','success','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','then','Agent\x20found!','resolve','email1','first_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','admin','catch','userId','getUser','Searching\x20end\x20user\x20with\x20phone','GET','query','Enduser\x20found!','firstname','Enduser\x20created.','lastname','phone','accessKey','getchallenge','login','token','getConnection','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','lastevent','toUpperCase','lodash','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','localhost','socket.io-emitter','emit','length','forEach','includes','picklist','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase'];(function(_0xf35bc1,_0x510803){var _0xa6b162=function(_0x1e5cc8){while(--_0x1e5cc8){_0xf35bc1['push'](_0xf35bc1['shift']());}};_0xa6b162(++_0x510803);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var rp=require(_0x0d8b('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require('util');var Redis=require(_0x0d8b('0x2'));var intUtil=require(_0x0d8b('0x3'));var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var io=require(_0x0d8b('0x9'))(new Redis(config['redis']));function emit(_0x413284,_0x284169,_0x58e4e2){io['to'](_0x413284)[_0x0d8b('0xa')](_0x284169,_0x58e4e2);}function getCustomFields(_0x348e65,_0x3b027f){var _0x1f4800={};if(_0x348e65[_0x0d8b('0xb')]>0x0){_[_0x0d8b('0xc')](_0x348e65,function(_0x2c5e9e){if(_[_0x0d8b('0xd')](['string',_0x0d8b('0xe')],_0x2c5e9e['type'])&&_0x2c5e9e[_0x0d8b('0xf')]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x2c5e9e[_0x0d8b('0x10')][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x13')&&_0x2c5e9e[_0x0d8b('0x14')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x15')&&_0x2c5e9e['Variable']&&_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]['toLowerCase']()]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')][_0x0d8b('0x18')]()][_0x0d8b('0x11')]();}});}return _0x1f4800;}function createTicket(_0x18dd2d,_0x264b39,_0xa3612a,_0x4a15bf,_0x27512e,_0x23d58f,_0x196c0a){logger[_0x0d8b('0x19')](_0x0d8b('0x1a'));var _0x5b709c=_[_0x0d8b('0x1b')]({'parent_id':'','assigned_user_id':_0x264b39['id'],'ticketpriorities':_0x0d8b('0x1c'),'ticketstatus':'Open','ticket_title':intUtil['getString'](_0x4a15bf[_0x0d8b('0x1d')],_0x27512e,'\x20'),'description':intUtil['getString'](_0x4a15bf['Descriptions'],_0x27512e,'\x0a'),'contact_id':_0xa3612a['id']},getCustomFields(_0x23d58f,_0x27512e));var _0x5527d8={'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x18dd2d[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'username':_0x18dd2d[_0x0d8b('0x23')],'sessionName':_0x196c0a[_0x0d8b('0x24')],'elementType':_0x0d8b('0x25'),'element':JSON[_0x0d8b('0x26')](_0x5b709c)},'json':!![]};return request(_0x5527d8)['then'](function(_0xe8bbee){if(_0xe8bbee[_0x0d8b('0x27')]){return BPromise['resolve']({'id':_0xe8bbee[_0x0d8b('0x28')]['id']});}else{throw new Error(util['format'](_0x0d8b('0x29'),JSON[_0x0d8b('0x26')](_0xe8bbee[_0x0d8b('0x2a')])));}})['catch'](function(_0x59a905){var _0x28f639=_0x59a905[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),'createTicket',_0x28f639,JSON[_0x0d8b('0x26')](_0x59a905));});}function getUser(_0x4b59e5,_0x97050a,_0x48f24f){if(intUtil[_0x0d8b('0x2d')](_0x97050a)){logger['info'](_0x0d8b('0x2e'),_0x97050a);return request({'method':'GET','uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x4b59e5[_0x0d8b('0x21')]),'qs':{'operation':'query','username':_0x4b59e5['username'],'sessionName':_0x48f24f['sessionName'],'query':util[_0x0d8b('0x1f')]('SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;',_0x97050a)},'json':!![]})[_0x0d8b('0x2f')](function(_0x54f6f3){if(_0x54f6f3['success']&&_0x54f6f3[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x30'));return BPromise[_0x0d8b('0x31')]({'id':_0x54f6f3[_0x0d8b('0x28')][0x0]['id'],'email':_0x54f6f3[_0x0d8b('0x28')][0x0][_0x0d8b('0x32')],'name':_0x54f6f3['result'][0x0][_0x0d8b('0x33')]+'\x20'+_0x54f6f3[_0x0d8b('0x28')]['last_name']});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f['userId'],'email':_0x4b59e5[_0x0d8b('0x23')],'name':_0x0d8b('0x35')});}})[_0x0d8b('0x36')](function(_0x31ceba){var _0x933e01=_0x31ceba['statusCode']||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),'getUser',_0x933e01,JSON[_0x0d8b('0x26')](_0x31ceba));});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f[_0x0d8b('0x37')],'email':_0x4b59e5['username'],'name':'admin'})[_0x0d8b('0x36')](function(_0x5c2c04){var _0x531c55=_0x5c2c04[_0x0d8b('0x2b')]||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),_0x0d8b('0x38'),_0x531c55,JSON[_0x0d8b('0x26')](_0x5c2c04));});}}function getEndUser(_0x24c789,_0x579324,_0x6e5bab,_0x6a02ad){logger[_0x0d8b('0x19')](_0x0d8b('0x39'),_0x6e5bab);return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x24c789['remoteUri']),'qs':{'operation':_0x0d8b('0x3b'),'username':_0x24c789[_0x0d8b('0x23')],'sessionName':_0x6a02ad[_0x0d8b('0x24')],'query':util[_0x0d8b('0x1f')]('SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;',_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab)},'json':!![]})[_0x0d8b('0x2f')](function(_0x4b4bde){if(_0x4b4bde[_0x0d8b('0x27')]&&_0x4b4bde[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x3c'));return BPromise[_0x0d8b('0x31')]({'id':_0x4b4bde[_0x0d8b('0x28')][0x0]['id'],'name':_0x4b4bde[_0x0d8b('0x28')][0x0][_0x0d8b('0x3d')]+'\x20'+_0x4b4bde[_0x0d8b('0x28')][0x0]['lastname'],'phone':_0x6e5bab});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':'POST','uri':util['format'](_0x0d8b('0x20'),_0x24c789[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'sessionName':_0x6a02ad['sessionName'],'elementType':'Contacts','element':JSON[_0x0d8b('0x26')]({'lastname':_0x579324,'phone':_0x6e5bab,'assigned_user_id':'\x20'})},'json':!![]})[_0x0d8b('0x2f')](function(_0x344278){logger['info'](_0x0d8b('0x3e'));return BPromise[_0x0d8b('0x31')]({'id':_0x344278['result']['id'],'name':_0x344278['result'][_0x0d8b('0x3f')],'phone':_0x344278['result'][_0x0d8b('0x40')]});})['catch'](function(_0x53f643){var _0x30ccee=_0x53f643[_0x0d8b('0x2b')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','getEndUser',_0x30ccee,JSON['stringify'](_0x53f643));});}});}function getConnection(_0x374d40){var _0x1e0498=_0x374d40[_0x0d8b('0x23')];var _0x490eda=_0x374d40[_0x0d8b('0x41')];return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'qs':{'operation':_0x0d8b('0x42'),'username':_0x1e0498},'json':!![]})[_0x0d8b('0x2f')](function(_0x1d5067){if(_0x1d5067[_0x0d8b('0x27')]){return request({'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x43'),'username':_0x1e0498,'accessKey':md5(_0x1d5067[_0x0d8b('0x28')][_0x0d8b('0x44')]+_0x490eda)},'json':!![]});}})[_0x0d8b('0x2f')](function(_0x1e162c){if(_0x1e162c[_0x0d8b('0x27')]){return BPromise['resolve'](_0x1e162c[_0x0d8b('0x28')]);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x374d40['id']));}})[_0x0d8b('0x36')](function(_0x113fb7){var _0x3f943a=_0x113fb7[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),_0x0d8b('0x45'),_0x3f943a,JSON[_0x0d8b('0x26')](_0x113fb7));});}function request(_0x241587){logger[_0x0d8b('0x19')]('[HTTP]',JSON['stringify'](_0x241587));return rp(_0x241587);}exports['queue']=function(_0x573f4f,_0x368ede,_0xf22c3c,_0x5e3bb4,_0x4950a8,_0x44c5c1){var _0x3d3cb6,_0x5c5bd7,_0x5ef6c3,_0x900906;_0x44c5c1[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x44c5c1[_0x0d8b('0x21')]);if(_0x4950a8&&_0x4950a8[_0x0d8b('0x47')]){logger['info'](_0x0d8b('0x48'),_0x0d8b('0x49'));_0x368ede['recordingURL']=util['format'](_0x0d8b('0x4a'),_0x44c5c1[_0x0d8b('0x4b')],_0x368ede['uniqueid'],md5(_0x368ede['uniqueid']));}else{_0x368ede[_0x0d8b('0x4c')]='';}return getConnection(_0x44c5c1)[_0x0d8b('0x2f')](function(_0x377027){_0x900906=_0x377027;return getUser(_0x44c5c1,_0x5e3bb4[_0x0d8b('0x4d')],_0x900906);})['then'](function(_0x356b3d){_0x3d3cb6=_0x356b3d;logger['info']('The\x20User\x20ID\x20is:',_0x3d3cb6['id']);return getEndUser(_0x44c5c1,_0x368ede[_0x0d8b('0x4e')],_0x368ede[_0x0d8b('0x4f')],_0x900906);})['then'](function(_0x4a8f33){_0x5c5bd7=_0x4a8f33;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x5c5bd7['id']);return createTicket(_0x44c5c1,_0x3d3cb6,_0x5c5bd7,_0xf22c3c,_0x368ede,_0xf22c3c[_0x0d8b('0x51')],_0x900906);})[_0x0d8b('0x2f')](function(_0x3afc3a){_0x5ef6c3=_0x3afc3a;logger[_0x0d8b('0x19')](_0x0d8b('0x52'));logger[_0x0d8b('0x19')]('The\x20Ticket\x20ID\x20is:',_0x5ef6c3['id']);var _0x24a859=util[_0x0d8b('0x1f')](_0x0d8b('0x53'),_0x44c5c1[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5ef6c3['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x48'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')]('user:%s',_0x5e3bb4[_0x0d8b('0x17')]),_0x0d8b('0x56'),{'uri':_0x24a859});})[_0x0d8b('0x36')](function(_0x23de9e){logger[_0x0d8b('0x2a')]('[QUEUE]',JSON[_0x0d8b('0x26')](_0x23de9e));});};exports[_0x0d8b('0x57')]=function(_0x181d49,_0x17a87f,_0x1d6cd4,_0x59ada2,_0x4d0e7c,_0x3b1166,_0x291b83){var _0x3e4a41,_0xbbb520,_0x5a70bd,_0x199122;_0x3b1166[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x3b1166['remoteUri']);_0x3b1166[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x3b1166[_0x0d8b('0x4b')]);if(_0x291b83&&_0x291b83[_0x0d8b('0x58')]&&_0x291b83[_0x0d8b('0x58')]!==_0x0d8b('0x59')){logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),'Recording\x20is\x20enabled!');_0x17a87f[_0x0d8b('0x4c')]=util['format'](_0x0d8b('0x4a'),_0x3b1166[_0x0d8b('0x4b')],_0x17a87f[_0x0d8b('0x5b')],md5(_0x17a87f[_0x0d8b('0x5b')]));}return getConnection(_0x3b1166)['then'](function(_0x19e097){_0x199122=_0x19e097;return getUser(_0x3b1166,_0x59ada2[_0x0d8b('0x4d')],_0x199122);})[_0x0d8b('0x2f')](function(_0x2332fc){_0x3e4a41=_0x2332fc;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0x3e4a41['id']);return getEndUser(_0x3b1166,_0x17a87f[_0x0d8b('0x5d')],_0x17a87f[_0x0d8b('0x5e')],_0x199122);})[_0x0d8b('0x2f')](function(_0x34affb){_0xbbb520=_0x34affb;logger['info']('The\x20Enduser\x20ID\x20is:',_0xbbb520['id']);return createTicket(_0x3b1166,_0x3e4a41,_0xbbb520,_0x1d6cd4,_0x17a87f,_0x1d6cd4[_0x0d8b('0x51')],_0x199122);})[_0x0d8b('0x2f')](function(_0x53e399){_0x5a70bd=_0x53e399;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger['info'](_0x0d8b('0x5f'),_0x5a70bd['id']);var _0x1c4e96=util['format']('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x3b1166[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5a70bd['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')](_0x0d8b('0x60'),_0x59ada2['name']),_0x0d8b('0x56'),{'uri':_0x1c4e96});})['catch'](function(_0x1a203e){logger[_0x0d8b('0x2a')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x26')](_0x1a203e));});};exports['unmanaged']=function(_0x3fe47d,_0x4a1c4a,_0x3a356b,_0x2c6c5f,_0x1c5fe2,_0x2ebea3){var _0xc5c35f,_0x2b44e5,_0x3e927c,_0x91aa89;_0x2ebea3[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x2ebea3['remoteUri']);_0x2ebea3[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x2ebea3[_0x0d8b('0x4b')]);if(_0x1c5fe2&&_0x1c5fe2[_0x0d8b('0x47')]){logger['info']('['+_0x4a1c4a[_0x0d8b('0x61')]['toUpperCase']()+']',_0x0d8b('0x49'));_0x4a1c4a[_0x0d8b('0x4c')]=util[_0x0d8b('0x1f')](_0x0d8b('0x4a'),_0x2ebea3[_0x0d8b('0x4b')],_0x4a1c4a[_0x0d8b('0x5b')],md5(_0x4a1c4a[_0x0d8b('0x5b')]));}else{_0x4a1c4a[_0x0d8b('0x4c')]='';}return getConnection(_0x2ebea3)['then'](function(_0x10eca6){_0x91aa89=_0x10eca6;return getUser(_0x2ebea3,'',_0x91aa89);})[_0x0d8b('0x2f')](function(_0x5b2916){_0xc5c35f=_0x5b2916;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0xc5c35f['id']);return getEndUser(_0x2ebea3,_0x4a1c4a[_0x0d8b('0x4e')],_0x4a1c4a[_0x0d8b('0x4f')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0x9e44b4){_0x2b44e5=_0x9e44b4;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x2b44e5['id']);return createTicket(_0x2ebea3,_0xc5c35f,_0x2b44e5,_0x3a356b,_0x4a1c4a,_0x3a356b[_0x0d8b('0x51')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0xe35028){_0x3e927c=_0xe35028;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger[_0x0d8b('0x19')](_0x0d8b('0x5f'),_0x3e927c['id']);})[_0x0d8b('0x36')](function(_0x58525c){logger['error']('['+_0x4a1c4a[_0x0d8b('0x61')][_0x0d8b('0x62')]()+']',JSON[_0x0d8b('0x26')](_0x58525c));});}; \ No newline at end of file +var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x42bc95,_0x2bb038){var _0x2abd53=function(_0x43bda7){while(--_0x43bda7){_0x42bc95['push'](_0x42bc95['shift']());}};_0x2abd53(++_0x2bb038);}(_0x9c44,0x178));var _0x49c4=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9c44[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ 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 d9f4221..ccbd863 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 _0xe60e=['Admin\x20account\x20selected.','user','%s/users/me.json','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','toString','base64','debug','[HTTP]','stringify','GET','map','length','forEach','includes','string','picklist','type','customField','nameField','content','idField','custom_fields','push','variable','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','/api/v2','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','calleridname','catch','lodash','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','emit','application/json','Creating\x20new\x20ticket...','format','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','info','Getting\x20agent\x20with\x20email','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!'];(function(_0x551697,_0x4fd0b8){var _0x3d934e=function(_0x23a2aa){while(--_0x23a2aa){_0x551697['push'](_0x551697['shift']());}};_0x3d934e(++_0x4fd0b8);}(_0xe60e,0x130));var _0xee60=function(_0x289426,_0x508cdb){_0x289426=_0x289426-0x0;var _0x5e2e26=_0xe60e[_0x289426];return _0x5e2e26;};'use strict';var _=require(_0xee60('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xee60('0x1'));var Redis=require(_0xee60('0x2'));var intUtil=require(_0xee60('0x3'));var config=require(_0xee60('0x4'));var logger=require(_0xee60('0x5'))('zendesk');config[_0xee60('0x6')]=_[_0xee60('0x7')](config[_0xee60('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x4c8a3d,_0x2747d3,_0x2cc9a8){io['to'](_0x4c8a3d)[_0xee60('0x8')](_0x2747d3,_0x2cc9a8);}var headers={'Content-Type':_0xee60('0x9'),'Accept':_0xee60('0x9')};function getTicket(_0x5e83af,_0xfd5cbf,_0x541688,_0x2668ab,_0x5a3876){logger['info'](_0xee60('0xa'));return request({'uri':util[_0xee60('0xb')]('%s/tickets.json',_0x5e83af[_0xee60('0xc')]),'method':_0xee60('0xd'),'body':{'ticket':_[_0xee60('0xe')]({'requester_id':_0x541688['id'],'submitter_id':_0xfd5cbf?_0xfd5cbf['id']:undefined,'assignee_id':_0xfd5cbf?_0xfd5cbf['id']:undefined,'tags':getTags(_0x2668ab[_0xee60('0xf')],_0xee60('0x10')),'subject':intUtil[_0xee60('0x11')](_0x2668ab[_0xee60('0x12')],_0x5a3876,'\x20'),'description':intUtil[_0xee60('0x11')](_0x2668ab[_0xee60('0x13')],_0x5a3876,'\x0a'),'comment':{'public':![],'body':intUtil[_0xee60('0x11')](_0x2668ab[_0xee60('0x13')],_0x5a3876,'\x0a')}},getCustomFields(_0x2668ab[_0xee60('0x14')],_0x5a3876))}})[_0xee60('0x15')](function(_0x509215){logger['info'](_0xee60('0x16'));return _0x509215[_0xee60('0x17')];});}function getUser(_0x11f142,_0x2ef6fc){if(intUtil[_0xee60('0x18')](_0x2ef6fc)){logger[_0xee60('0x19')](_0xee60('0x1a'),_0x2ef6fc);return request({'uri':util[_0xee60('0xb')]('%s/search.json',_0x11f142[_0xee60('0xc')]),'qs':{'query':util[_0xee60('0xb')]('type:user\x20role:agent\x20email:%s',_0x2ef6fc)}})[_0xee60('0x15')](function(_0xce27a){if(_0xce27a['count']){logger['info'](_0xee60('0x1b'));return _[_0xee60('0x1c')](_0xce27a[_0xee60('0x1d')],{'email':_0x2ef6fc,'role':_0xee60('0x1e')});}else{logger[_0xee60('0x19')](_0xee60('0x1f'));return request({'uri':util[_0xee60('0xb')]('%s/users/me.json',_0x11f142['remoteUri'])})[_0xee60('0x15')](function(_0x565fb6){logger['info'](_0xee60('0x20'));return _0x565fb6[_0xee60('0x21')];});}});}else{logger[_0xee60('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xee60('0xb')](_0xee60('0x22'),_0x11f142[_0xee60('0xc')])})[_0xee60('0x15')](function(_0x258596){logger['info'](_0xee60('0x20'));return _0x258596[_0xee60('0x21')];});}}function getEndUser(_0x7ac3f2,_0x592642,_0x29de5b){logger[_0xee60('0x19')](_0xee60('0x23'),_0x29de5b);return request({'uri':util['format']('%s/search.json',_0x7ac3f2[_0xee60('0xc')]),'qs':{'query':util[_0xee60('0xb')](_0xee60('0x24'),_0x29de5b)}})[_0xee60('0x15')](function(_0x2db3d8){var _0x84c0a1;if(_0x2db3d8['results']['length']){_0x2db3d8[_0xee60('0x1d')]=_['filter'](_0x2db3d8['results'],{'suspended':![],'role':_0xee60('0x25')});if(_0x2db3d8['results']['length']){_0x84c0a1=_[_0xee60('0x26')](_0x2db3d8[_0xee60('0x1d')]);}}if(_0x84c0a1){logger['info'](_0xee60('0x27'));return _0x84c0a1;}else{logger[_0xee60('0x19')](_0xee60('0x28'));return request({'uri':util[_0xee60('0xb')](_0xee60('0x29'),_0x7ac3f2[_0xee60('0xc')]),'method':'POST','body':{'user':{'role':_0xee60('0x25'),'name':util[_0xee60('0xb')](_0xee60('0x2a'),_0x592642||_0x29de5b),'phone':_0x29de5b}}})[_0xee60('0x15')](function(_0x1c8187){logger[_0xee60('0x19')](_0xee60('0x2b'));return _0x1c8187[_0xee60('0x21')];});}});}function getAuth(_0x1f155b){var _0x3ffc44;if(_0x1f155b[_0xee60('0x2c')]===_0xee60('0x2d')){_0x3ffc44=util['format'](_0xee60('0x2e'),_0x1f155b[_0xee60('0x2f')],_0x1f155b['password']);}else if(_0x1f155b['authType']===_0xee60('0x30')){_0x3ffc44=util['format'](_0xee60('0x31'),_0x1f155b[_0xee60('0x2f')],_0x1f155b[_0xee60('0x30')]);}return util[_0xee60('0xb')]('Basic\x20%s',new Buffer(_0x3ffc44)[_0xee60('0x32')](_0xee60('0x33')));}function request(_0x1bdf6a){logger[_0xee60('0x34')](_0xee60('0x35'),JSON[_0xee60('0x36')](_0x1bdf6a));return rp(_[_0xee60('0x7')](_0x1bdf6a,{'method':_0xee60('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x15c8f7,_0x1d9708){var _0x2aa063=[];if(_0x15c8f7&&_0x15c8f7['length']>0x0){_0x2aa063=_[_0xee60('0x38')](_0x15c8f7,_0x1d9708);}return _0x2aa063;}function getCustomFields(_0x583174,_0x298d1a){var _0x327b3d=[];var _0x3637e6={'custom_fields':[]};if(_0x583174[_0xee60('0x39')]>0x0){_[_0xee60('0x3a')](_0x583174,function(_0xade5c4){if(_[_0xee60('0x3b')]([_0xee60('0x3c'),_0xee60('0x3d')],_0xade5c4[_0xee60('0x3e')])&&_0xade5c4['nameField']&&!_0xade5c4[_0xee60('0x3f')]){_0x3637e6[_0xade5c4[_0xee60('0x40')]['toLowerCase']()]=_0xade5c4[_0xee60('0x41')][_0xee60('0x32')]();}else if(_[_0xee60('0x3b')]([_0xee60('0x3c'),_0xee60('0x3d')],_0xade5c4['type'])&&_0xade5c4[_0xee60('0x42')]&&_0xade5c4['customField']){_0x3637e6[_0xee60('0x43')][_0xee60('0x44')]({'id':_0xade5c4['idField'],'value':_0xade5c4['content'][_0xee60('0x32')]()});}else if(_0xade5c4[_0xee60('0x3e')]===_0xee60('0x45')&&_0xade5c4['variableName']&&_0xade5c4['idField']&&_0xade5c4[_0xee60('0x3f')]){_0x298d1a[_0xade5c4['variableName']]&&_0x3637e6[_0xee60('0x43')][_0xee60('0x44')]({'id':_0xade5c4[_0xee60('0x42')],'value':_0x298d1a[_0xade5c4['variableName']][_0xee60('0x32')]()});}else if(_0xade5c4[_0xee60('0x3e')]===_0xee60('0x46')&&_0xade5c4[_0xee60('0x47')]&&_0xade5c4[_0xee60('0x47')][_0xee60('0x10')]&&_0xade5c4['idField']&&_0xade5c4[_0xee60('0x3f')]){_0x298d1a[_0xade5c4[_0xee60('0x47')]['name'][_0xee60('0x48')]()]&&_0x3637e6['custom_fields']['push']({'id':_0xade5c4['idField'],'value':_0x298d1a[_0xade5c4[_0xee60('0x47')][_0xee60('0x10')][_0xee60('0x48')]()][_0xee60('0x32')]()});}});}return _0x3637e6;}exports[_0xee60('0x49')]=function(_0xd65866,_0x27d9f8,_0x2cb1a7,_0x1055a4,_0x2ae7a3,_0x524ef2){var _0x770b62,_0x1a62f1;_0x524ef2[_0xee60('0xc')]=intUtil['stripTrailingSlash'](_0x524ef2[_0xee60('0xc')]);_0x524ef2['serverUrl']=intUtil[_0xee60('0x4a')](_0x524ef2[_0xee60('0x4b')]);if(_0x2ae7a3&&_0x2ae7a3[_0xee60('0x4c')]){logger[_0xee60('0x19')](_0xee60('0x4d'),_0xee60('0x4e'));_0x27d9f8[_0xee60('0x4f')]=util[_0xee60('0xb')](_0xee60('0x50'),_0x524ef2['serverUrl'],_0x27d9f8[_0xee60('0x51')],md5(_0x27d9f8[_0xee60('0x51')]));}else{_0x27d9f8[_0xee60('0x4f')]='';}headers[_0xee60('0x52')]=getAuth(_0x524ef2);return getUser(_0x524ef2,_0x1055a4[_0xee60('0x53')])[_0xee60('0x15')](function(_0x1200d0){_0x770b62=_0x1200d0;logger[_0xee60('0x19')]('The\x20User\x20ID\x20is:',_0x770b62['id']);return getEndUser(_0x524ef2,_0x27d9f8['calleridname'],_0x27d9f8[_0xee60('0x54')]);})[_0xee60('0x15')](function(_0x3f3121){_0x1a62f1=_0x3f3121;logger['info'](_0xee60('0x55'),_0x1a62f1['id']);return getTicket(_0x524ef2,_0x770b62,_0x1a62f1,_0x2cb1a7,_0x27d9f8);})['then'](function(_0x272e39){if(_0x272e39){logger['info'](_0xee60('0x56'),_0x272e39['id']);switch(_0x524ef2['type']){case _0xee60('0x57'):logger[_0xee60('0x19')](_0xee60('0x4d'),_0xee60('0x58'));return request({'uri':util[_0xee60('0xb')](_0xee60('0x59'),_0x524ef2[_0xee60('0xc')],_0x770b62['id'],_0x272e39['id']),'method':_0xee60('0xd')});case _0xee60('0x5a'):logger[_0xee60('0x19')]('[QUEUE]',_0xee60('0x5b'));emit(util[_0xee60('0xb')]('user:%s',_0x1055a4[_0xee60('0x10')]),_0xee60('0x5c'),{'uri':util[_0xee60('0xb')](_0xee60('0x5d'),_0x524ef2[_0xee60('0xc')][_0xee60('0x5e')]('/api/v2',''),_0x272e39['id'])});break;default:logger[_0xee60('0x5f')](_0xee60('0x4d'),_0xee60('0x60'));}}})['catch'](function(_0xe790d5){logger[_0xee60('0x5f')](_0xee60('0x61'),util[_0xee60('0x62')](_0xe790d5,{'showHidden':!![],'depth':null}));});};exports[_0xee60('0x63')]=function(_0x138263,_0x109112,_0x3580a0,_0x596e3e,_0x207590,_0x366e66,_0x4b1089){var _0x4ebc3a,_0x57c41d;_0x366e66['remoteUri']=intUtil[_0xee60('0x4a')](_0x366e66[_0xee60('0xc')]);_0x366e66[_0xee60('0x4b')]=intUtil[_0xee60('0x4a')](_0x366e66[_0xee60('0x4b')]);if(_0x4b1089&&_0x4b1089['recordingFormat']&&_0x4b1089[_0xee60('0x64')]!==_0xee60('0x65')){logger['info'](_0xee60('0x66'),_0xee60('0x4e'));_0x109112[_0xee60('0x4f')]=util[_0xee60('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x366e66[_0xee60('0x4b')],_0x109112[_0xee60('0x51')],md5(_0x109112[_0xee60('0x51')]));}headers[_0xee60('0x52')]=getAuth(_0x366e66);return getUser(_0x366e66,_0x596e3e[_0xee60('0x53')])[_0xee60('0x15')](function(_0x2239e1){_0x4ebc3a=_0x2239e1;logger['info'](_0xee60('0x67'),_0x4ebc3a['id']);return getEndUser(_0x366e66,_0x109112[_0xee60('0x68')],_0x109112[_0xee60('0x69')]);})[_0xee60('0x15')](function(_0x36028d){_0x57c41d=_0x36028d;logger[_0xee60('0x19')]('The\x20Enduser\x20ID\x20is:',_0x57c41d['id']);return getTicket(_0x366e66,_0x4ebc3a,_0x57c41d,_0x3580a0,_0x109112);})[_0xee60('0x15')](function(_0x3d7b5a){if(_0x3d7b5a){logger['info'](_0xee60('0x56'),_0x3d7b5a['id']);switch(_0x366e66[_0xee60('0x3e')]){case _0xee60('0x57'):logger[_0xee60('0x19')](_0xee60('0x66'),_0xee60('0x58'));return request({'uri':util[_0xee60('0xb')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x366e66[_0xee60('0xc')],_0x4ebc3a['id'],_0x3d7b5a['id']),'method':'POST'});case _0xee60('0x5a'):logger[_0xee60('0x19')](_0xee60('0x66'),_0xee60('0x5b'));emit(util[_0xee60('0xb')]('user:%s',_0x596e3e[_0xee60('0x10')]),_0xee60('0x5c'),{'uri':util[_0xee60('0xb')]('%s/agent/tickets/%s',_0x366e66[_0xee60('0xc')][_0xee60('0x5e')](_0xee60('0x6a'),''),_0x3d7b5a['id'])});break;default:logger[_0xee60('0x5f')](_0xee60('0x66'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x43558d){logger[_0xee60('0x5f')](_0xee60('0x6b'),util[_0xee60('0x62')](_0x43558d,{'showHidden':!![],'depth':null}));});};exports[_0xee60('0x6c')]=function(_0x4e4d12,_0x36b171,_0x464411,_0x5484b4,_0x25fabb,_0x512719){var _0x5beb2b,_0x19a984;_0x512719[_0xee60('0xc')]=intUtil[_0xee60('0x4a')](_0x512719[_0xee60('0xc')]);_0x512719[_0xee60('0x4b')]=intUtil[_0xee60('0x4a')](_0x512719[_0xee60('0x4b')]);if(_0x25fabb&&_0x25fabb[_0xee60('0x4c')]){logger[_0xee60('0x19')]('['+_0x36b171[_0xee60('0x6d')]['toUpperCase']()+']',_0xee60('0x4e'));_0x36b171[_0xee60('0x4f')]=util[_0xee60('0xb')](_0xee60('0x50'),_0x512719[_0xee60('0x4b')],_0x36b171[_0xee60('0x51')],md5(_0x36b171[_0xee60('0x51')]));}else{_0x36b171[_0xee60('0x4f')]='';}headers[_0xee60('0x52')]=getAuth(_0x512719);return getUser(_0x512719)[_0xee60('0x15')](function(_0x4af70a){_0x5beb2b=_0x4af70a;logger[_0xee60('0x19')](_0xee60('0x67'),_0x5beb2b['id']);return getEndUser(_0x512719,_0x36b171[_0xee60('0x6e')],_0x36b171[_0xee60('0x54')]);})[_0xee60('0x15')](function(_0x44b8ba){_0x19a984=_0x44b8ba;logger[_0xee60('0x19')](_0xee60('0x55'),_0x19a984['id']);return getTicket(_0x512719,_0x5beb2b,_0x19a984,_0x464411,_0x36b171);})[_0xee60('0x15')](function(_0x38251c){if(_0x38251c){logger[_0xee60('0x19')]('The\x20Ticket\x20ID\x20is:',_0x38251c['id']);}})[_0xee60('0x6f')](function(_0x2d3316){logger[_0xee60('0x5f')]('['+_0x36b171[_0xee60('0x6d')]['toUpperCase']()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0xee60('0x62')](_0x2d3316,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xfe6c=['type','nameField','toLowerCase','content','idField','custom_fields','variableName','customField','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','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','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','%s/agent/tickets/%s','replace','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','count','find','results','agent','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','username','password','token','toString','debug','[HTTP]','stringify','defaults','GET','map','forEach','includes','string','picklist'];(function(_0x299941,_0x55512d){var _0xa805c=function(_0x2c0d6c){while(--_0x2c0d6c){_0x299941['push'](_0x299941['shift']());}};_0xa805c(++_0x55512d);}(_0xfe6c,0xa1));var _0xcfe6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfe6c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcfe6('0x0'));var rp=require(_0xcfe6('0x1'));var md5=require(_0xcfe6('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xcfe6('0x3'));var config=require(_0xcfe6('0x4'));var logger=require(_0xcfe6('0x5'))(_0xcfe6('0x6'));config[_0xcfe6('0x7')]=_['defaults'](config[_0xcfe6('0x7')],{'host':_0xcfe6('0x8'),'port':0x18eb});var io=require(_0xcfe6('0x9'))(new Redis(config[_0xcfe6('0x7')]));function emit(_0x4ee75d,_0x19167a,_0x3c005e){io['to'](_0x4ee75d)[_0xcfe6('0xa')](_0x19167a,_0x3c005e);}var headers={'Content-Type':_0xcfe6('0xb'),'Accept':_0xcfe6('0xb')};function getTicket(_0x2dca40,_0x258429,_0x411cf5,_0x10859b,_0xe88753){logger[_0xcfe6('0xc')](_0xcfe6('0xd'));return request({'uri':util[_0xcfe6('0xe')](_0xcfe6('0xf'),_0x2dca40[_0xcfe6('0x10')]),'method':_0xcfe6('0x11'),'body':{'ticket':_[_0xcfe6('0x12')]({'requester_id':_0x411cf5['id'],'submitter_id':_0x258429?_0x258429['id']:undefined,'assignee_id':_0x258429?_0x258429['id']:undefined,'tags':getTags(_0x10859b[_0xcfe6('0x13')],_0xcfe6('0x14')),'subject':intUtil[_0xcfe6('0x15')](_0x10859b[_0xcfe6('0x16')],_0xe88753,'\x20'),'description':intUtil['getString'](_0x10859b['Descriptions'],_0xe88753,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x10859b[_0xcfe6('0x17')],_0xe88753,'\x0a')}},getCustomFields(_0x10859b[_0xcfe6('0x18')],_0xe88753))}})[_0xcfe6('0x19')](function(_0x3d9e0e){logger[_0xcfe6('0xc')]('Ticket\x20created!');return _0x3d9e0e['ticket'];});}function getUser(_0x4595f5,_0x24cace){if(intUtil[_0xcfe6('0x1a')](_0x24cace)){logger[_0xcfe6('0xc')](_0xcfe6('0x1b'),_0x24cace);return request({'uri':util[_0xcfe6('0xe')](_0xcfe6('0x1c'),_0x4595f5[_0xcfe6('0x10')]),'qs':{'query':util[_0xcfe6('0xe')]('type:user\x20role:agent\x20email:%s',_0x24cace)}})[_0xcfe6('0x19')](function(_0x194bca){if(_0x194bca[_0xcfe6('0x1d')]){logger[_0xcfe6('0xc')]('Agent\x20found!');return _[_0xcfe6('0x1e')](_0x194bca[_0xcfe6('0x1f')],{'email':_0x24cace,'role':_0xcfe6('0x20')});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0xcfe6('0x21'),_0x4595f5[_0xcfe6('0x10')])})[_0xcfe6('0x19')](function(_0x39f64b){logger['info'](_0xcfe6('0x22'));return _0x39f64b[_0xcfe6('0x23')];});}});}else{logger[_0xcfe6('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xcfe6('0xe')](_0xcfe6('0x21'),_0x4595f5[_0xcfe6('0x10')])})['then'](function(_0x1976ca){logger[_0xcfe6('0xc')](_0xcfe6('0x22'));return _0x1976ca['user'];});}}function getEndUser(_0x2e7fee,_0x536b2c,_0x43ced2){logger[_0xcfe6('0xc')](_0xcfe6('0x24'),_0x43ced2);return request({'uri':util[_0xcfe6('0xe')](_0xcfe6('0x1c'),_0x2e7fee[_0xcfe6('0x10')]),'qs':{'query':util['format'](_0xcfe6('0x25'),_0x43ced2)}})[_0xcfe6('0x19')](function(_0x264985){var _0x8b9cbf;if(_0x264985[_0xcfe6('0x1f')][_0xcfe6('0x26')]){_0x264985[_0xcfe6('0x1f')]=_[_0xcfe6('0x27')](_0x264985[_0xcfe6('0x1f')],{'suspended':![],'role':_0xcfe6('0x28')});if(_0x264985[_0xcfe6('0x1f')][_0xcfe6('0x26')]){_0x8b9cbf=_['first'](_0x264985[_0xcfe6('0x1f')]);}}if(_0x8b9cbf){logger[_0xcfe6('0xc')](_0xcfe6('0x29'));return _0x8b9cbf;}else{logger[_0xcfe6('0xc')](_0xcfe6('0x2a'));return request({'uri':util[_0xcfe6('0xe')](_0xcfe6('0x2b'),_0x2e7fee[_0xcfe6('0x10')]),'method':_0xcfe6('0x11'),'body':{'user':{'role':'end-user','name':util[_0xcfe6('0xe')](_0xcfe6('0x2c'),_0x536b2c||_0x43ced2),'phone':_0x43ced2}}})[_0xcfe6('0x19')](function(_0x235eba){logger[_0xcfe6('0xc')](_0xcfe6('0x2d'));return _0x235eba[_0xcfe6('0x23')];});}});}function getAuth(_0x35ca7b){var _0x1ab269;if(_0x35ca7b[_0xcfe6('0x2e')]==='password'){_0x1ab269=util[_0xcfe6('0xe')]('%s:%s',_0x35ca7b[_0xcfe6('0x2f')],_0x35ca7b[_0xcfe6('0x30')]);}else if(_0x35ca7b['authType']===_0xcfe6('0x31')){_0x1ab269=util['format']('%s/token:%s',_0x35ca7b[_0xcfe6('0x2f')],_0x35ca7b[_0xcfe6('0x31')]);}return util[_0xcfe6('0xe')]('Basic\x20%s',new Buffer(_0x1ab269)[_0xcfe6('0x32')]('base64'));}function request(_0x509c9c){logger[_0xcfe6('0x33')](_0xcfe6('0x34'),JSON[_0xcfe6('0x35')](_0x509c9c));return rp(_[_0xcfe6('0x36')](_0x509c9c,{'method':_0xcfe6('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x29667d,_0x393fa7){var _0x22ca05=[];if(_0x29667d&&_0x29667d[_0xcfe6('0x26')]>0x0){_0x22ca05=_[_0xcfe6('0x38')](_0x29667d,_0x393fa7);}return _0x22ca05;}function getCustomFields(_0x355072,_0x28f63b){var _0x27ef21=[];var _0x251d59={'custom_fields':[]};if(_0x355072['length']>0x0){_[_0xcfe6('0x39')](_0x355072,function(_0x58b64f){if(_[_0xcfe6('0x3a')]([_0xcfe6('0x3b'),_0xcfe6('0x3c')],_0x58b64f[_0xcfe6('0x3d')])&&_0x58b64f[_0xcfe6('0x3e')]&&!_0x58b64f['customField']){_0x251d59[_0x58b64f[_0xcfe6('0x3e')][_0xcfe6('0x3f')]()]=_0x58b64f[_0xcfe6('0x40')][_0xcfe6('0x32')]();}else if(_[_0xcfe6('0x3a')]([_0xcfe6('0x3b'),_0xcfe6('0x3c')],_0x58b64f[_0xcfe6('0x3d')])&&_0x58b64f[_0xcfe6('0x41')]&&_0x58b64f['customField']){_0x251d59[_0xcfe6('0x42')]['push']({'id':_0x58b64f[_0xcfe6('0x41')],'value':_0x58b64f[_0xcfe6('0x40')][_0xcfe6('0x32')]()});}else if(_0x58b64f[_0xcfe6('0x3d')]==='variable'&&_0x58b64f[_0xcfe6('0x43')]&&_0x58b64f[_0xcfe6('0x41')]&&_0x58b64f[_0xcfe6('0x44')]){_0x28f63b[_0x58b64f[_0xcfe6('0x43')]]&&_0x251d59[_0xcfe6('0x42')]['push']({'id':_0x58b64f[_0xcfe6('0x41')],'value':_0x28f63b[_0x58b64f[_0xcfe6('0x43')]][_0xcfe6('0x32')]()});}else if(_0x58b64f[_0xcfe6('0x3d')]===_0xcfe6('0x45')&&_0x58b64f[_0xcfe6('0x46')]&&_0x58b64f[_0xcfe6('0x46')][_0xcfe6('0x14')]&&_0x58b64f[_0xcfe6('0x41')]&&_0x58b64f[_0xcfe6('0x44')]){_0x28f63b[_0x58b64f[_0xcfe6('0x46')][_0xcfe6('0x14')][_0xcfe6('0x3f')]()]&&_0x251d59[_0xcfe6('0x42')]['push']({'id':_0x58b64f['idField'],'value':_0x28f63b[_0x58b64f[_0xcfe6('0x46')][_0xcfe6('0x14')]['toLowerCase']()]['toString']()});}});}return _0x251d59;}exports['queue']=function(_0x5ddeac,_0x2ed2ce,_0x1ab67f,_0x25144c,_0xa5fe84,_0x14f5d6){var _0xf5beb1,_0xd12333;_0x14f5d6[_0xcfe6('0x10')]=intUtil[_0xcfe6('0x47')](_0x14f5d6[_0xcfe6('0x10')]);_0x14f5d6[_0xcfe6('0x48')]=intUtil[_0xcfe6('0x47')](_0x14f5d6['serverUrl']);if(_0xa5fe84&&_0xa5fe84[_0xcfe6('0x49')]){logger[_0xcfe6('0xc')](_0xcfe6('0x4a'),_0xcfe6('0x4b'));_0x2ed2ce[_0xcfe6('0x4c')]=util[_0xcfe6('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x14f5d6['serverUrl'],_0x2ed2ce['uniqueid'],md5(_0x2ed2ce['uniqueid']));}else{_0x2ed2ce[_0xcfe6('0x4c')]='';}headers[_0xcfe6('0x4d')]=getAuth(_0x14f5d6);return getUser(_0x14f5d6,_0x25144c[_0xcfe6('0x4e')])[_0xcfe6('0x19')](function(_0x4ac5e6){_0xf5beb1=_0x4ac5e6;logger[_0xcfe6('0xc')](_0xcfe6('0x4f'),_0xf5beb1['id']);return getEndUser(_0x14f5d6,_0x2ed2ce[_0xcfe6('0x50')],_0x2ed2ce[_0xcfe6('0x51')]);})[_0xcfe6('0x19')](function(_0x45bf12){_0xd12333=_0x45bf12;logger[_0xcfe6('0xc')]('The\x20Enduser\x20ID\x20is:',_0xd12333['id']);return getTicket(_0x14f5d6,_0xf5beb1,_0xd12333,_0x1ab67f,_0x2ed2ce);})['then'](function(_0x4dbde0){if(_0x4dbde0){logger[_0xcfe6('0xc')]('The\x20Ticket\x20ID\x20is:',_0x4dbde0['id']);switch(_0x14f5d6[_0xcfe6('0x3d')]){case _0xcfe6('0x52'):logger[_0xcfe6('0xc')](_0xcfe6('0x4a'),_0xcfe6('0x53'));return request({'uri':util[_0xcfe6('0xe')](_0xcfe6('0x54'),_0x14f5d6[_0xcfe6('0x10')],_0xf5beb1['id'],_0x4dbde0['id']),'method':'POST'});case _0xcfe6('0x55'):logger[_0xcfe6('0xc')]('[QUEUE]',_0xcfe6('0x56'));emit(util[_0xcfe6('0xe')](_0xcfe6('0x57'),_0x25144c[_0xcfe6('0x14')]),_0xcfe6('0x58'),{'uri':util[_0xcfe6('0xe')]('%s/agent/tickets/%s',_0x14f5d6[_0xcfe6('0x10')]['replace'](_0xcfe6('0x59'),''),_0x4dbde0['id'])});break;default:logger[_0xcfe6('0x5a')](_0xcfe6('0x4a'),_0xcfe6('0x5b'));}}})[_0xcfe6('0x5c')](function(_0x4b6399){logger['error'](_0xcfe6('0x5d'),util[_0xcfe6('0x5e')](_0x4b6399,{'showHidden':!![],'depth':null}));});};exports[_0xcfe6('0x5f')]=function(_0x4e0b5d,_0x1b5715,_0x1ce357,_0x1ebaa6,_0x2f5db9,_0x46988a,_0x5eec06){var _0x4a4b6b,_0x424a3c;_0x46988a['remoteUri']=intUtil[_0xcfe6('0x47')](_0x46988a[_0xcfe6('0x10')]);_0x46988a[_0xcfe6('0x48')]=intUtil['stripTrailingSlash'](_0x46988a[_0xcfe6('0x48')]);if(_0x5eec06&&_0x5eec06[_0xcfe6('0x60')]&&_0x5eec06['recordingFormat']!==_0xcfe6('0x61')){logger[_0xcfe6('0xc')](_0xcfe6('0x62'),_0xcfe6('0x4b'));_0x1b5715[_0xcfe6('0x4c')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x46988a[_0xcfe6('0x48')],_0x1b5715[_0xcfe6('0x63')],md5(_0x1b5715[_0xcfe6('0x63')]));}headers[_0xcfe6('0x4d')]=getAuth(_0x46988a);return getUser(_0x46988a,_0x1ebaa6[_0xcfe6('0x4e')])[_0xcfe6('0x19')](function(_0x283037){_0x4a4b6b=_0x283037;logger[_0xcfe6('0xc')](_0xcfe6('0x4f'),_0x4a4b6b['id']);return getEndUser(_0x46988a,_0x1b5715['destcalleridname'],_0x1b5715[_0xcfe6('0x64')]);})[_0xcfe6('0x19')](function(_0xbf1738){_0x424a3c=_0xbf1738;logger[_0xcfe6('0xc')](_0xcfe6('0x65'),_0x424a3c['id']);return getTicket(_0x46988a,_0x4a4b6b,_0x424a3c,_0x1ce357,_0x1b5715);})['then'](function(_0x330d3c){if(_0x330d3c){logger[_0xcfe6('0xc')](_0xcfe6('0x66'),_0x330d3c['id']);switch(_0x46988a['type']){case _0xcfe6('0x52'):logger[_0xcfe6('0xc')](_0xcfe6('0x62'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0xcfe6('0x54'),_0x46988a['remoteUri'],_0x4a4b6b['id'],_0x330d3c['id']),'method':'POST'});case _0xcfe6('0x55'):logger[_0xcfe6('0xc')](_0xcfe6('0x62'),_0xcfe6('0x56'));emit(util[_0xcfe6('0xe')](_0xcfe6('0x57'),_0x1ebaa6[_0xcfe6('0x14')]),_0xcfe6('0x58'),{'uri':util['format'](_0xcfe6('0x67'),_0x46988a[_0xcfe6('0x10')][_0xcfe6('0x68')]('/api/v2',''),_0x330d3c['id'])});break;default:logger[_0xcfe6('0x5a')]('[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xcfe6('0x5c')](function(_0x1772fe){logger[_0xcfe6('0x5a')](_0xcfe6('0x69'),util[_0xcfe6('0x5e')](_0x1772fe,{'showHidden':!![],'depth':null}));});};exports[_0xcfe6('0x6a')]=function(_0x133c6d,_0x1692b9,_0x402a45,_0x5a5f91,_0x11377c,_0x371ea7){var _0x47e49a,_0x258837;_0x371ea7['remoteUri']=intUtil['stripTrailingSlash'](_0x371ea7['remoteUri']);_0x371ea7[_0xcfe6('0x48')]=intUtil['stripTrailingSlash'](_0x371ea7[_0xcfe6('0x48')]);if(_0x11377c&&_0x11377c[_0xcfe6('0x49')]){logger[_0xcfe6('0xc')]('['+_0x1692b9['lastevent'][_0xcfe6('0x6b')]()+']',_0xcfe6('0x4b'));_0x1692b9[_0xcfe6('0x4c')]=util[_0xcfe6('0xe')](_0xcfe6('0x6c'),_0x371ea7[_0xcfe6('0x48')],_0x1692b9[_0xcfe6('0x63')],md5(_0x1692b9[_0xcfe6('0x63')]));}else{_0x1692b9[_0xcfe6('0x4c')]='';}headers[_0xcfe6('0x4d')]=getAuth(_0x371ea7);return getUser(_0x371ea7)[_0xcfe6('0x19')](function(_0x5a6cf2){_0x47e49a=_0x5a6cf2;logger['info'](_0xcfe6('0x4f'),_0x47e49a['id']);return getEndUser(_0x371ea7,_0x1692b9[_0xcfe6('0x50')],_0x1692b9[_0xcfe6('0x51')]);})[_0xcfe6('0x19')](function(_0x585b0b){_0x258837=_0x585b0b;logger['info']('The\x20Enduser\x20ID\x20is:',_0x258837['id']);return getTicket(_0x371ea7,_0x47e49a,_0x258837,_0x402a45,_0x1692b9);})[_0xcfe6('0x19')](function(_0x204370){if(_0x204370){logger['info'](_0xcfe6('0x66'),_0x204370['id']);}})[_0xcfe6('0x5c')](function(_0x4439c5){logger[_0xcfe6('0x5a')]('['+_0x1692b9[_0xcfe6('0x6d')][_0xcfe6('0x6b')]()+']'+_0xcfe6('0x6e'),util[_0xcfe6('0x5e')](_0x4439c5,{'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 c0ffe96..7467b20 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 _0xb945=['bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','localhost','socket.io-emitter','debug','[HTTP]','stringify','forEach','includes','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','isBefore','expires_in','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','then','add','catch','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','isArrayLikeObject','findIndex','users','Agent\x20found!','profile','error','The\x20failing\x20result\x20is','https://www.zohoapis.','/crm/v2/','startCase','role','last_name','data','SUCCESS','details','enduserType','Error:\x20','CREATE\x20ERROR','moduleSearch','contact_lead','uri','moduleCreate','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','first_name','Subject','getString','Subjects','Description','Descriptions','Full_Name','Last_Name','Leads','What_Id','First_Name','$se_module','talktime','Call_Duration','mm:ss','endtime','utc','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','complete','connect','Answered','abandoned','Abandoned','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','Call\x20created!','err','queue','host','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','calleridname','calleridnum','The\x20Call\x20ID\x20is:','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','none','[OUTBOUND]','com','email','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lodash','md5','./util'];(function(_0x247fa1,_0x4ec37c){var _0x244f35=function(_0xfb98be){while(--_0xfb98be){_0x247fa1['push'](_0x247fa1['shift']());}};_0x244f35(++_0x4ec37c);}(_0xb945,0x97));var _0x5b94=function(_0x109b8d,_0x13784f){_0x109b8d=_0x109b8d-0x0;var _0x19b81e=_0xb945[_0x109b8d];return _0x19b81e;};'use strict';var _=require(_0x5b94('0x0'));var rp=require('request-promise');var md5=require(_0x5b94('0x1'));var util=require('util');var intUtil=require(_0x5b94('0x2'));var moment=require('moment');var Redis=require('ioredis');var BPromise=require(_0x5b94('0x3'));var config=require(_0x5b94('0x4'));var logger=require(_0x5b94('0x5'))(_0x5b94('0x6'));config[_0x5b94('0x7')]=_['defaults'](config['redis'],{'host':_0x5b94('0x8'),'port':0x18eb});var io=require(_0x5b94('0x9'))(new Redis(config[_0x5b94('0x7')]));function emit(_0x186d22,_0x5d2448,_0x428211){io['to'](_0x186d22)['emit'](_0x5d2448,_0x428211);}function request(_0x3e7695){logger[_0x5b94('0xa')](_0x5b94('0xb'),JSON[_0x5b94('0xc')](_0x3e7695));return rp(_0x3e7695);}function getCustomFields(_0x2bcba0,_0x1dba61){var _0x1ef820={};if(_0x2bcba0['length']>0x0){_[_0x5b94('0xd')](_0x2bcba0,function(_0x54be80){if(_[_0x5b94('0xe')]([_0x5b94('0xf'),_0x5b94('0x10')],_0x54be80[_0x5b94('0x11')])&&_0x54be80[_0x5b94('0x12')]){_0x1ef820[_0x54be80['idField']]=_0x54be80[_0x5b94('0x13')][_0x5b94('0x14')]();}else if(_0x54be80[_0x5b94('0x11')]===_0x5b94('0x15')&&_0x54be80['variableName']&&_0x54be80[_0x5b94('0x12')]&&_0x1dba61[_0x54be80['variableName']]){_0x1ef820[_0x54be80[_0x5b94('0x12')]]=_0x1dba61[_0x54be80[_0x5b94('0x16')]]['toString']();}else if(_0x54be80[_0x5b94('0x11')]===_0x5b94('0x17')&&_0x54be80[_0x5b94('0x18')]&&_0x54be80['Variable'][_0x5b94('0x19')]&&_0x54be80[_0x5b94('0x12')]&&_0x1dba61[_0x54be80['Variable'][_0x5b94('0x19')][_0x5b94('0x1a')]()]){_0x1ef820[_0x54be80[_0x5b94('0x12')]]=_0x1dba61[_0x54be80['Variable'][_0x5b94('0x19')][_0x5b94('0x1a')]()]['toString']();}});}return _0x1ef820;}function getName(_0xba8499){if(_0xba8499[_0x5b94('0x1b')]('\x20')>0x0){var _0x265d5d=_0xba8499[_0x5b94('0x1c')](/ (.+)/);if(_0x265d5d[0x1]){return _0x265d5d;}}return[_0xba8499,_0xba8499];}var accountsTokens={};function getAccessToken(_0x1f2293){return new Promise(function(_0x5d1a5a,_0x2f6c7b){if(!_[_0x5b94('0x1d')](accountsTokens[_0x1f2293['id']])&&!_['isNil'](accountsTokens[_0x1f2293['id']]['access_token'])){if(moment()[_0x5b94('0x1e')](accountsTokens[_0x1f2293['id']][_0x5b94('0x1f')])){_0x5d1a5a(accountsTokens[_0x1f2293['id']][_0x5b94('0x20')]);}}var _0xe8a5d0;switch(_0x1f2293[_0x5b94('0x21')]){case'US':_0xe8a5d0=_0x5b94('0x22');break;case'AU':_0xe8a5d0=_0x5b94('0x23');break;case'EU':_0xe8a5d0=_0x5b94('0x24');break;case'IN':_0xe8a5d0=_0x5b94('0x25');break;case'CN':_0xe8a5d0=_0x5b94('0x26');break;default:_0xe8a5d0=_0x5b94('0x24');break;}var _0x29ad17={'method':_0x5b94('0x27'),'uri':_0xe8a5d0+_0x5b94('0x28'),'qs':{'refresh_token':_0x1f2293[_0x5b94('0x29')],'client_id':_0x1f2293[_0x5b94('0x2a')],'client_secret':_0x1f2293['clientSecret'],'grant_type':_0x5b94('0x2b')},'json':!![]};return rp(_0x29ad17)[_0x5b94('0x2c')](function(_0x344373){accountsTokens[_0x1f2293['id']]={'access_token':_0x344373[_0x5b94('0x20')],'expires_in':moment()[_0x5b94('0x2d')](_0x344373['expires_in'],'seconds')};_0x5d1a5a(_0x344373[_0x5b94('0x20')]);})[_0x5b94('0x2e')](function(_0x2fbb32){logger['error'](_0x5b94('0x2f'),_0x2fbb32[_0x5b94('0x30')]);_0x2f6c7b(_0x2fbb32);});});}function getUser(_0x594aca,_0x5dc969,_0x151c6c,_0xc2a8bd){logger[_0x5b94('0x31')](_0x5b94('0x32'));return request({'method':_0x5b94('0x33'),'uri':util[_0x5b94('0x34')](_0x5b94('0x35'),_0x5dc969),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x5b94('0x36')+_0x594aca},'json':!![]})['then'](function(_0x5ba892){if(_0x5ba892['users']){var _0xc151f5=-0x1;if(_[_0x5b94('0x37')](_0x5ba892['users'])){if(!_[_0x5b94('0x1d')](_0xc2a8bd)){_0xc151f5=_[_0x5b94('0x38')](_0x5ba892[_0x5b94('0x39')],function(_0x31982d){return _0x31982d['email']===_0xc2a8bd;});}if(_0xc151f5>=0x0){logger['info'](_0x5b94('0x3a'));}else{logger[_0x5b94('0x31')]('Using\x20the\x20admin\x20account!');_0xc151f5=_[_0x5b94('0x38')](_0x5ba892[_0x5b94('0x39')],function(_0xde4f5){return _0xde4f5[_0x5b94('0x3b')][_0x5b94('0x19')]==='Administrator';});}return _0x5ba892['users'][_0xc151f5];}else{if(_0x5ba892['user'][_0x5b94('0x3b')][_0x5b94('0x19')]==='Administrator'){logger[_0x5b94('0x31')]('Using\x20the\x20admin\x20account!');user=_0x5ba892['user'];return user;}else{logger[_0x5b94('0x3c')](_0x5b94('0x3d'),JSON[_0x5b94('0xc')](_0x5ba892));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x5ba892));}}}else{logger[_0x5b94('0x3c')](_0x5b94('0x3d'),JSON['stringify'](_0x5ba892));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x5b94('0xc')](_0x5ba892));}})[_0x5b94('0x2e')](function(_0x1d387a){console[_0x5b94('0x3c')](_0x1d387a);});}function getZohoUser(_0x49b71d,_0x4aebb8){return new BPromise(function(_0x2693bb,_0x14cb0a){request(_0x49b71d)[_0x5b94('0x2c')](function(_0x1083d6){var _0x3e92c1=null;if(_0x1083d6){_0x3e92c1=_0x1083d6['data'][0x0];_0x3e92c1['enduserType']=_0x4aebb8;}_0x2693bb(_0x3e92c1);})['catch'](function(_0x46f8d4){_0x14cb0a(_0x46f8d4);});});}function createEndUser(_0x3ae0ed,_0x18acdf,_0x10f126,_0x10d1e0,_0x11b23b,_0x11c291){var _0x10f126=getName(_0x10f126);return request({'method':_0x5b94('0x27'),'uri':_0x5b94('0x3e')+_0x18acdf+_0x5b94('0x3f')+_[_0x5b94('0x40')](_0x11c291['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x10f126[0x1],'First_Name':_0x10f126[0x0],'Phone':_0x10d1e0,'Owner':{'name':!_[_0x5b94('0x1d')](_0x11b23b[_0x5b94('0x41')][_0x5b94('0x19')])?_0x11b23b[_0x5b94('0x41')][_0x5b94('0x19')]:!_[_0x5b94('0x1d')](_0x11b23b['first_name'])?_0x11b23b['first_name']+'\x20'+_0x11b23b[_0x5b94('0x42')]:_0x11b23b[_0x5b94('0x42')],'id':_0x11b23b['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3ae0ed},'json':!![]})[_0x5b94('0x2c')](function(_0x22b8a8){if(_0x22b8a8&&_0x22b8a8[_0x5b94('0x43')][0x0]['code']===_0x5b94('0x44')){var _0x236278=_0x22b8a8['data'][0x0][_0x5b94('0x45')];_0x236278[_0x5b94('0x46')]=_[_0x5b94('0x40')](_0x11c291['moduleCreate'])+'s';return _0x236278;}logger[_0x5b94('0x3c')]('The\x20failing\x20result\x20is',JSON['stringify'](data));throw new Error(_0x5b94('0x47')+JSON[_0x5b94('0xc')](data));})[_0x5b94('0x2e')](function(_0x6ab7e2){console['log'](_0x5b94('0x48'),_0x6ab7e2);});}function getEndUser(_0x68b842,_0x51c278,_0x3f1fed,_0x21dfc4,_0x32bb12,_0x42ab9d,_0x4571bd){var _0xa0843e={'method':_0x5b94('0x33'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x68b842},'json':!![]};switch(_0x4571bd[_0x5b94('0x49')]){case _0x5b94('0x4a'):_0xa0843e[_0x5b94('0x4b')]='https://www.zohoapis.'+_0x51c278+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x32bb12+'))';return getZohoUser(_0xa0843e,'Contacts')[_0x5b94('0x2c')](function(_0x5c7c76){if(_0x5c7c76)return _0x5c7c76;_0xa0843e[_0x5b94('0x4b')]=_0x5b94('0x3e')+_0x51c278+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x32bb12+'))';return getZohoUser(_0xa0843e,'Leads')[_0x5b94('0x2c')](function(_0x389134){if(_0x389134)return _0x389134;if(_0x4571bd[_0x5b94('0x4c')]!=_0x5b94('0x4d')){return createEndUser(_0x68b842,_0x51c278,_0x21dfc4,_0x32bb12,_0x42ab9d,_0x4571bd);}else{return{};}});});break;case _0x5b94('0x4e'):_0xa0843e[_0x5b94('0x4b')]=_0x5b94('0x3e')+_0x51c278+_0x5b94('0x4f')+_0x32bb12+'))';return getZohoUser(_0xa0843e,_0x5b94('0x50'))['then'](function(_0x131323){if(_0x131323)return _0x131323;if(_0x4571bd[_0x5b94('0x4c')]!=_0x5b94('0x4d')){return createEndUser(_0x68b842,_0x51c278,_0x21dfc4,_0x32bb12,_0x42ab9d,_0x4571bd);}else{return{};}});break;case _0x5b94('0x51'):_0xa0843e[_0x5b94('0x4b')]='https://www.zohoapis.'+_0x51c278+_0x5b94('0x52')+_0x32bb12+'))';return getZohoUser(_0xa0843e,'Leads')[_0x5b94('0x2c')](function(_0x4d8c34){if(_0x4d8c34)return _0x4d8c34;if(_0x4571bd[_0x5b94('0x4c')]!=_0x5b94('0x4d')){return createEndUser(_0x68b842,_0x51c278,_0x21dfc4,_0x32bb12,_0x42ab9d,_0x4571bd);}else{return{};}});break;}}function getCall(_0x37d12a,_0x34a160,_0x54e838,_0x1e11d1,_0x2cef6e,_0x467f9f,_0x105cd2,_0x1539da){logger['info'](_0x5b94('0x53'));var _0x4aa64c={};_0x4aa64c[_0x5b94('0x54')]={'name':!_['isNil'](_0x1e11d1[_0x5b94('0x41')][_0x5b94('0x19')])&&!_[_0x5b94('0x1d')](_0x1e11d1['profile'][_0x5b94('0x19')])&&_0x1e11d1[_0x5b94('0x3b')][_0x5b94('0x19')]===_0x5b94('0x55')?_0x1e11d1[_0x5b94('0x41')][_0x5b94('0x19')]:!_[_0x5b94('0x1d')](_0x1e11d1[_0x5b94('0x56')])?_0x1e11d1[_0x5b94('0x56')]+'\x20'+_0x1e11d1[_0x5b94('0x42')]:_0x1e11d1[_0x5b94('0x42')],'id':_0x1e11d1['id']};_0x4aa64c[_0x5b94('0x57')]=intUtil[_0x5b94('0x58')](_0x467f9f[_0x5b94('0x59')],_0x105cd2,'\x20');_0x4aa64c[_0x5b94('0x5a')]=intUtil[_0x5b94('0x58')](_0x467f9f[_0x5b94('0x5b')],_0x105cd2,'\x0a');if(_0x2cef6e[_0x5b94('0x46')]===_0x5b94('0x50')){_0x4aa64c['Who_Id']={'name':!_['isNil'](_0x2cef6e[_0x5b94('0x5c')])?_0x2cef6e[_0x5b94('0x5c')]:!_[_0x5b94('0x1d')](_0x2cef6e['First_Name'])?_0x2cef6e['First_Name']+'\x20'+_0x2cef6e['Last_Name']:_0x2cef6e[_0x5b94('0x5d')],'id':_0x2cef6e['id']};}if(_0x2cef6e['enduserType']===_0x5b94('0x5e')){_0x4aa64c[_0x5b94('0x5f')]={'name':!_[_0x5b94('0x1d')](_0x2cef6e[_0x5b94('0x5c')])?_0x2cef6e[_0x5b94('0x5c')]:!_[_0x5b94('0x1d')](_0x2cef6e[_0x5b94('0x60')])?_0x2cef6e[_0x5b94('0x60')]+'\x20'+_0x2cef6e[_0x5b94('0x5d')]:_0x2cef6e['Last_Name'],'id':_0x2cef6e['id']};_0x4aa64c[_0x5b94('0x61')]=_[_0x5b94('0x40')](_0x2cef6e[_0x5b94('0x46')]);}if(_0x105cd2[_0x5b94('0x62')]){_0x4aa64c[_0x5b94('0x63')]=moment['utc'](parseInt(_0x105cd2[_0x5b94('0x62')])*0x3e8)['format'](_0x5b94('0x64'));}else if(_0x105cd2['answertime']&&_0x105cd2[_0x5b94('0x65')]){_0x4aa64c[_0x5b94('0x63')]=moment[_0x5b94('0x66')](moment(_0x105cd2[_0x5b94('0x65')],_0x5b94('0x67'))[_0x5b94('0x68')](moment(_0x105cd2[_0x5b94('0x69')],_0x5b94('0x67'))))[_0x5b94('0x34')](_0x5b94('0x64'));}switch(_0x105cd2[_0x5b94('0x6a')]){case _0x5b94('0x6b'):_0x4aa64c[_0x5b94('0x6c')]=_0x5b94('0x6d');break;case _0x5b94('0x6e'):case _0x5b94('0x6f'):_0x4aa64c[_0x5b94('0x6c')]=_0x5b94('0x70');break;case'rejected':_0x4aa64c[_0x5b94('0x6c')]='Rejected';break;case _0x5b94('0x71'):_0x4aa64c[_0x5b94('0x6c')]=_0x5b94('0x72');break;case'timeout':_0x4aa64c['Call_Result']=_0x5b94('0x73');default:}_0x4aa64c[_0x5b94('0x74')]=(_0x1539da===_0x5b94('0x75')?moment(_0x105cd2['starttime'])[_0x5b94('0x34')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x105cd2[_0x5b94('0x76')])[_0x5b94('0x34')](_0x5b94('0x67')))||moment()['format'](_0x5b94('0x67'));_0x4aa64c[_0x5b94('0x77')]=_0x1539da||_0x5b94('0x78');_0x4aa64c=_[_0x5b94('0x79')](_0x4aa64c,getCustomFields(_0x467f9f[_0x5b94('0x7a')],_0x105cd2));return request({'method':_0x5b94('0x27'),'uri':_0x5b94('0x3e')+_0x34a160+'/crm/v2/Calls','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x37d12a},'body':{'data':[_0x4aa64c]},'json':!![]})['then'](function(_0x187128){if(_0x187128&&_0x187128[_0x5b94('0x43')][0x0]['code']===_0x5b94('0x44')){logger[_0x5b94('0x31')](_0x5b94('0x7b'));return{'id':_0x187128[_0x5b94('0x43')][0x0][_0x5b94('0x45')]['id']};}})[_0x5b94('0x2e')](function(_0x105fd8){logger['info'](_0x5b94('0x7c'),_0x105fd8[_0x5b94('0x30')]);console['log'](_0x5b94('0x7c'),_0x105fd8);});}exports[_0x5b94('0x7d')]=function(_0x2cc4ac,_0x29e38c,_0x56fb61,_0x494bc4,_0x3534d1,_0x2b056e){var _0x5685b8,_0xbaf890,_0x5402e7;_0x2b056e['host']=intUtil['stripTrailingSlash'](_0x2b056e[_0x5b94('0x7e')]);_0x2b056e[_0x5b94('0x7f')]=intUtil[_0x5b94('0x80')](_0x2b056e[_0x5b94('0x7f')]);if(_0x3534d1&&_0x3534d1[_0x5b94('0x81')]){logger['info'](_0x5b94('0x82'),_0x5b94('0x83'));_0x29e38c[_0x5b94('0x84')]=_0x2b056e[_0x5b94('0x7f')]+_0x5b94('0x85')+_0x29e38c[_0x5b94('0x86')]+_0x5b94('0x87')+md5(_0x29e38c[_0x5b94('0x86')]);}else{_0x29e38c['recordingURL']='';}var _0x34553a=_0x2b056e[_0x5b94('0x7e')]===_0x5b94('0x88')?'eu':'com';return getAccessToken(_0x2b056e)[_0x5b94('0x2c')](function(_0x179cd0){_0x5402e7=_0x179cd0;return getUser(_0x5402e7,_0x34553a,_0x2b056e,_0x494bc4['email']);})[_0x5b94('0x2c')](function(_0x5de4b1){_0x5685b8=_0x5de4b1;logger[_0x5b94('0x31')]('The\x20User\x20ID\x20is:',_0x5685b8['id']);return getEndUser(_0x5402e7,_0x34553a,_0x2b056e,_0x29e38c[_0x5b94('0x89')],_0x29e38c[_0x5b94('0x8a')],_0x5685b8,_0x56fb61);})[_0x5b94('0x2c')](function(_0x31839c){_0xbaf890=_0x31839c;return getCall(_0x5402e7,_0x34553a,_0x2b056e,_0x5685b8,_0xbaf890,_0x56fb61,_0x29e38c,_0x5b94('0x78'));})[_0x5b94('0x2c')](function(_0x13a449){if(_0x13a449){logger[_0x5b94('0x31')](_0x5b94('0x8b'),_0x13a449['id']);logger[_0x5b94('0x31')](_0x5b94('0x82'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x5b94('0x34')](_0x5b94('0x8c'),_0x494bc4[_0x5b94('0x19')]),_0x5b94('0x8d'),{'uri':_0x5b94('0x8e')+_0x2b056e[_0x5b94('0x7e')]+_0x5b94('0x8f')+_0x13a449['id']});}})[_0x5b94('0x2e')](function(_0x339e81){logger[_0x5b94('0x3c')](_0x5b94('0x82'),JSON[_0x5b94('0xc')](_0x339e81));});};exports[_0x5b94('0x75')]=function(_0x4474a8,_0x2480ce,_0x5bb93a,_0x37871b,_0x20251e,_0x320382,_0xebee98){var _0x47da33,_0x31b257,_0x893055;_0x320382[_0x5b94('0x7e')]=intUtil['stripTrailingSlash'](_0x320382['host']);_0x320382[_0x5b94('0x7f')]=intUtil['stripTrailingSlash'](_0x320382[_0x5b94('0x7f')]);if(_0xebee98&&_0xebee98['recordingFormat']&&_0xebee98['recordingFormat']!==_0x5b94('0x90')){logger['info'](_0x5b94('0x91'),_0x5b94('0x83'));_0x2480ce[_0x5b94('0x84')]=_0x320382['serverUrl']+'/api/voice/recordings/'+_0x2480ce['uniqueid']+_0x5b94('0x87')+md5(_0x2480ce[_0x5b94('0x86')]);}var _0x15520b=_0x320382[_0x5b94('0x7e')]===_0x5b94('0x88')?'eu':_0x5b94('0x92');return getAccessToken(_0x320382)[_0x5b94('0x2c')](function(_0x2ff051){_0x893055=_0x2ff051;return getUser(_0x893055,_0x15520b,_0x320382,_0x37871b[_0x5b94('0x93')]);})['then'](function(_0x5a423b){_0x47da33=_0x5a423b;logger[_0x5b94('0x31')](_0x5b94('0x94'),_0x47da33['id']);return getEndUser(_0x893055,_0x15520b,_0x320382,_0x2480ce[_0x5b94('0x95')],_0x2480ce[_0x5b94('0x96')],_0x47da33,_0x5bb93a);})[_0x5b94('0x2c')](function(_0x214e7b){_0x31b257=_0x214e7b;return getCall(_0x893055,_0x15520b,_0x320382,_0x47da33,_0x31b257,_0x5bb93a,_0x2480ce,_0x5b94('0x97'));})[_0x5b94('0x2c')](function(_0x23f55c){if(_0x23f55c){logger['info'](_0x5b94('0x8b'),_0x23f55c['id']);logger[_0x5b94('0x31')](_0x5b94('0x91'),_0x5b94('0x98'));emit(util['format'](_0x5b94('0x8c'),_0x37871b['name']),_0x5b94('0x8d'),{'uri':_0x5b94('0x8e')+_0x320382[_0x5b94('0x7e')]+_0x5b94('0x8f')+_0x23f55c['id']});}})[_0x5b94('0x2e')](function(_0x12a490){logger['error']('[OUTBOUND]',JSON[_0x5b94('0xc')](_0x12a490));});};exports[_0x5b94('0x99')]=function(_0x47ffbf,_0x1a1c1c,_0x147f51,_0x3f9202,_0x3a2852,_0x172b86){var _0xd56c8c,_0x401ebf,_0x57b241;_0x172b86[_0x5b94('0x7e')]=intUtil[_0x5b94('0x80')](_0x172b86[_0x5b94('0x7e')]);_0x172b86[_0x5b94('0x7f')]=intUtil['stripTrailingSlash'](_0x172b86[_0x5b94('0x7f')]);if(_0x3a2852&&_0x3a2852[_0x5b94('0x81')]){logger[_0x5b94('0x31')]('['+_0x1a1c1c['lastevent']['toUpperCase']()+']',_0x5b94('0x83'));_0x1a1c1c[_0x5b94('0x84')]=_0x172b86['serverUrl']+_0x5b94('0x85')+_0x1a1c1c[_0x5b94('0x86')]+_0x5b94('0x87')+md5(_0x1a1c1c['uniqueid']);}else{_0x1a1c1c['recordingURL']='';}var _0x58b1f7=_0x172b86[_0x5b94('0x7e')]===_0x5b94('0x88')?'eu':_0x5b94('0x92');return getAccessToken(_0x172b86)[_0x5b94('0x2c')](function(_0x397391){_0x57b241=_0x397391;return getUser(_0x57b241,_0x58b1f7,_0x172b86);})[_0x5b94('0x2c')](function(_0x356299){_0xd56c8c=_0x356299;logger[_0x5b94('0x31')](_0x5b94('0x94'),_0xd56c8c['id']);return getEndUser(_0x57b241,_0x58b1f7,_0x172b86,_0x1a1c1c[_0x5b94('0x89')],_0x1a1c1c[_0x5b94('0x8a')],_0xd56c8c,_0x147f51);})['then'](function(_0x36fcfd){_0x401ebf=_0x36fcfd;return getCall(_0x57b241,_0x58b1f7,_0x172b86,_0xd56c8c,_0x401ebf,_0x147f51,_0x1a1c1c,_0x5b94('0x78'));})[_0x5b94('0x2c')](function(_0xa603cd){if(_0xa603cd){logger[_0x5b94('0x31')](_0x5b94('0x8b'),_0xa603cd['id']);}})['catch'](function(_0x19de2e){logger['error']('['+_0x1a1c1c['lastevent']['toUpperCase']()+']',JSON[_0x5b94('0xc')](_0x19de2e));});}; \ No newline at end of file +var _0xada2=['Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','code','SUCCESS','details','enduserType','The\x20failing\x20result\x20is','Error:\x20','log','moduleSearch','contact_lead','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','lead','Creating\x20new\x20call...','last_name','Subject','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','utc','mm:ss','answertime','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','complete','connect','Rejected','abandoned','Abandoned','timeout','Timeout','outbound','agentcalledAt','Call_Type','merge','Fields','/crm/v2/Calls','Call\x20created!','queue','host','serverUrl','monitor_format','Recording\x20is\x20enabled!','/api/voice/recordings/','uniqueid','recordingURL','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','/downloads?type=uniqueid&token=','destcalleridname','destcalleridnum','Outbound','/crm/EntityInfo.do?module=Calls&id=','unmanaged','Inbound','lodash','request-promise','md5','util','moment','ioredis','bluebird','zoho','redis','defaults','localhost','socket.io-emitter','debug','[HTTP]','stringify','forEach','includes','string','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','catch','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','ActiveUsers','isArrayLikeObject','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','profile','user','error'];(function(_0x288742,_0x655a1b){var _0x243f16=function(_0x132e58){while(--_0x132e58){_0x288742['push'](_0x288742['shift']());}};_0x243f16(++_0x655a1b);}(_0xada2,0xfd));var _0x2ada=function(_0x1ed08f,_0x3d499a){_0x1ed08f=_0x1ed08f-0x0;var _0x9df16c=_0xada2[_0x1ed08f];return _0x9df16c;};'use strict';var _=require(_0x2ada('0x0'));var rp=require(_0x2ada('0x1'));var md5=require(_0x2ada('0x2'));var util=require(_0x2ada('0x3'));var intUtil=require('./util');var moment=require(_0x2ada('0x4'));var Redis=require(_0x2ada('0x5'));var BPromise=require(_0x2ada('0x6'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x2ada('0x7'));config[_0x2ada('0x8')]=_[_0x2ada('0x9')](config[_0x2ada('0x8')],{'host':_0x2ada('0xa'),'port':0x18eb});var io=require(_0x2ada('0xb'))(new Redis(config[_0x2ada('0x8')]));function emit(_0x1deb4a,_0x1d204f,_0x5c1c3f){io['to'](_0x1deb4a)['emit'](_0x1d204f,_0x5c1c3f);}function request(_0x508398){logger[_0x2ada('0xc')](_0x2ada('0xd'),JSON[_0x2ada('0xe')](_0x508398));return rp(_0x508398);}function getCustomFields(_0x3045b9,_0x1b6bb4){var _0x304751={};if(_0x3045b9['length']>0x0){_[_0x2ada('0xf')](_0x3045b9,function(_0x283d18){if(_[_0x2ada('0x10')]([_0x2ada('0x11'),'picklist'],_0x283d18[_0x2ada('0x12')])&&_0x283d18['idField']){_0x304751[_0x283d18[_0x2ada('0x13')]]=_0x283d18[_0x2ada('0x14')][_0x2ada('0x15')]();}else if(_0x283d18[_0x2ada('0x12')]===_0x2ada('0x16')&&_0x283d18[_0x2ada('0x17')]&&_0x283d18[_0x2ada('0x13')]&&_0x1b6bb4[_0x283d18[_0x2ada('0x17')]]){_0x304751[_0x283d18[_0x2ada('0x13')]]=_0x1b6bb4[_0x283d18['variableName']][_0x2ada('0x15')]();}else if(_0x283d18['type']===_0x2ada('0x18')&&_0x283d18['Variable']&&_0x283d18[_0x2ada('0x19')][_0x2ada('0x1a')]&&_0x283d18[_0x2ada('0x13')]&&_0x1b6bb4[_0x283d18[_0x2ada('0x19')][_0x2ada('0x1a')][_0x2ada('0x1b')]()]){_0x304751[_0x283d18[_0x2ada('0x13')]]=_0x1b6bb4[_0x283d18[_0x2ada('0x19')][_0x2ada('0x1a')]['toLowerCase']()][_0x2ada('0x15')]();}});}return _0x304751;}function getName(_0x533528){if(_0x533528[_0x2ada('0x1c')]('\x20')>0x0){var _0x37fa99=_0x533528[_0x2ada('0x1d')](/ (.+)/);if(_0x37fa99[0x1]){return _0x37fa99;}}return[_0x533528,_0x533528];}var accountsTokens={};function getAccessToken(_0x20bd1a){return new Promise(function(_0x32b406,_0x1bba3d){if(!_[_0x2ada('0x1e')](accountsTokens[_0x20bd1a['id']])&&!_[_0x2ada('0x1e')](accountsTokens[_0x20bd1a['id']][_0x2ada('0x1f')])){if(moment()[_0x2ada('0x20')](accountsTokens[_0x20bd1a['id']][_0x2ada('0x21')])){_0x32b406(accountsTokens[_0x20bd1a['id']][_0x2ada('0x1f')]);}}var _0x1317c2;switch(_0x20bd1a[_0x2ada('0x22')]){case'US':_0x1317c2=_0x2ada('0x23');break;case'AU':_0x1317c2=_0x2ada('0x24');break;case'EU':_0x1317c2=_0x2ada('0x25');break;case'IN':_0x1317c2=_0x2ada('0x26');break;case'CN':_0x1317c2=_0x2ada('0x27');break;default:_0x1317c2=_0x2ada('0x25');break;}var _0x577e1d={'method':_0x2ada('0x28'),'uri':_0x1317c2+_0x2ada('0x29'),'qs':{'refresh_token':_0x20bd1a[_0x2ada('0x2a')],'client_id':_0x20bd1a[_0x2ada('0x2b')],'client_secret':_0x20bd1a[_0x2ada('0x2c')],'grant_type':_0x2ada('0x2d')},'json':!![]};return rp(_0x577e1d)[_0x2ada('0x2e')](function(_0x4c9f85){accountsTokens[_0x20bd1a['id']]={'access_token':_0x4c9f85[_0x2ada('0x1f')],'expires_in':moment()[_0x2ada('0x2f')](_0x4c9f85[_0x2ada('0x21')],_0x2ada('0x30'))};_0x32b406(_0x4c9f85[_0x2ada('0x1f')]);})[_0x2ada('0x31')](function(_0x42b578){logger['error'](_0x2ada('0x32'),_0x42b578[_0x2ada('0x33')]);_0x1bba3d(_0x42b578);});});}function getUser(_0x25ce7c,_0x345b10,_0x71e77b,_0x3144aa){logger[_0x2ada('0x34')](_0x2ada('0x35'));return request({'method':_0x2ada('0x36'),'uri':util[_0x2ada('0x37')]('https://www.zohoapis.%s/crm/v2/users',_0x345b10),'qs':{'type':_0x2ada('0x38')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x25ce7c},'json':!![]})[_0x2ada('0x2e')](function(_0x2edc0b){if(_0x2edc0b['users']){var _0x373556=-0x1;if(_[_0x2ada('0x39')](_0x2edc0b[_0x2ada('0x3a')])){if(!_[_0x2ada('0x1e')](_0x3144aa)){_0x373556=_[_0x2ada('0x3b')](_0x2edc0b['users'],function(_0x51c263){return _0x51c263[_0x2ada('0x3c')]===_0x3144aa;});}if(_0x373556>=0x0){logger['info'](_0x2ada('0x3d'));}else{logger['info'](_0x2ada('0x3e'));_0x373556=_['findIndex'](_0x2edc0b['users'],function(_0x3c56c4){return _0x3c56c4['profile'][_0x2ada('0x1a')]===_0x2ada('0x3f');});}return _0x2edc0b[_0x2ada('0x3a')][_0x373556];}else{if(_0x2edc0b['user'][_0x2ada('0x40')][_0x2ada('0x1a')]===_0x2ada('0x3f')){logger[_0x2ada('0x34')](_0x2ada('0x3e'));user=_0x2edc0b[_0x2ada('0x41')];return user;}else{logger[_0x2ada('0x42')]('The\x20failing\x20result\x20is',JSON[_0x2ada('0xe')](_0x2edc0b));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x2edc0b));}}}else{logger[_0x2ada('0x42')]('The\x20failing\x20result\x20is',JSON[_0x2ada('0xe')](_0x2edc0b));throw new Error(_0x2ada('0x43')+JSON['stringify'](_0x2edc0b));}})[_0x2ada('0x31')](function(_0x6734db){console['error'](_0x6734db);});}function getZohoUser(_0x233fcf,_0x150e00){return new BPromise(function(_0x3a52c2,_0x2d67c8){request(_0x233fcf)['then'](function(_0x47581b){var _0x1358be=null;if(_0x47581b){_0x1358be=_0x47581b[_0x2ada('0x44')][0x0];_0x1358be['enduserType']=_0x150e00;}_0x3a52c2(_0x1358be);})[_0x2ada('0x31')](function(_0x4903cc){_0x2d67c8(_0x4903cc);});});}function createEndUser(_0x178801,_0x18d0bd,_0x273747,_0x3b8260,_0x16c611,_0x120f31){var _0x273747=getName(_0x273747);return request({'method':_0x2ada('0x28'),'uri':_0x2ada('0x45')+_0x18d0bd+_0x2ada('0x46')+_[_0x2ada('0x47')](_0x120f31[_0x2ada('0x48')])+'s','body':{'data':[{'Last_Name':_0x273747[0x1],'First_Name':_0x273747[0x0],'Phone':_0x3b8260,'Owner':{'name':!_[_0x2ada('0x1e')](_0x16c611['role'][_0x2ada('0x1a')])?_0x16c611[_0x2ada('0x49')]['name']:!_[_0x2ada('0x1e')](_0x16c611[_0x2ada('0x4a')])?_0x16c611['first_name']+'\x20'+_0x16c611['last_name']:_0x16c611['last_name'],'id':_0x16c611['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x178801},'json':!![]})[_0x2ada('0x2e')](function(_0x162538){if(_0x162538&&_0x162538['data'][0x0][_0x2ada('0x4b')]===_0x2ada('0x4c')){var _0x622446=_0x162538[_0x2ada('0x44')][0x0][_0x2ada('0x4d')];_0x622446[_0x2ada('0x4e')]=_['startCase'](_0x120f31[_0x2ada('0x48')])+'s';return _0x622446;}logger[_0x2ada('0x42')](_0x2ada('0x4f'),JSON[_0x2ada('0xe')](data));throw new Error(_0x2ada('0x50')+JSON[_0x2ada('0xe')](data));})[_0x2ada('0x31')](function(_0x593af1){console[_0x2ada('0x51')]('CREATE\x20ERROR',_0x593af1);});}function getEndUser(_0x53b010,_0x999a9,_0xd2a28a,_0xcf56db,_0x3de363,_0x179675,_0x1c51ec){var _0x1d42aa={'method':'GET','uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x53b010},'json':!![]};switch(_0x1c51ec[_0x2ada('0x52')]){case _0x2ada('0x53'):_0x1d42aa['uri']=_0x2ada('0x45')+_0x999a9+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x3de363+'))';return getZohoUser(_0x1d42aa,'Contacts')['then'](function(_0x519356){if(_0x519356)return _0x519356;_0x1d42aa[_0x2ada('0x54')]='https://www.zohoapis.'+_0x999a9+_0x2ada('0x55')+_0x3de363+'))';return getZohoUser(_0x1d42aa,_0x2ada('0x56'))[_0x2ada('0x2e')](function(_0x2882cb){if(_0x2882cb)return _0x2882cb;if(_0x1c51ec[_0x2ada('0x48')]!=_0x2ada('0x57')){return createEndUser(_0x53b010,_0x999a9,_0xcf56db,_0x3de363,_0x179675,_0x1c51ec);}else{return{};}});});break;case _0x2ada('0x58'):_0x1d42aa[_0x2ada('0x54')]=_0x2ada('0x45')+_0x999a9+_0x2ada('0x59')+_0x3de363+'))';return getZohoUser(_0x1d42aa,_0x2ada('0x5a'))['then'](function(_0x5bf16a){if(_0x5bf16a)return _0x5bf16a;if(_0x1c51ec[_0x2ada('0x48')]!=_0x2ada('0x57')){return createEndUser(_0x53b010,_0x999a9,_0xcf56db,_0x3de363,_0x179675,_0x1c51ec);}else{return{};}});break;case _0x2ada('0x5b'):_0x1d42aa[_0x2ada('0x54')]=_0x2ada('0x45')+_0x999a9+_0x2ada('0x55')+_0x3de363+'))';return getZohoUser(_0x1d42aa,'Leads')[_0x2ada('0x2e')](function(_0x1920f7){if(_0x1920f7)return _0x1920f7;if(_0x1c51ec[_0x2ada('0x48')]!=_0x2ada('0x57')){return createEndUser(_0x53b010,_0x999a9,_0xcf56db,_0x3de363,_0x179675,_0x1c51ec);}else{return{};}});break;}}function getCall(_0x5defbb,_0x56d1f7,_0x5c6af2,_0xd03600,_0x4b4bd1,_0x5499a4,_0x43663c,_0x1a5529){logger['info'](_0x2ada('0x5c'));var _0x27c61c={};_0x27c61c['Owner']={'name':!_[_0x2ada('0x1e')](_0xd03600['role'][_0x2ada('0x1a')])&&!_['isNil'](_0xd03600[_0x2ada('0x40')]['name'])&&_0xd03600[_0x2ada('0x40')][_0x2ada('0x1a')]==='administrator'?_0xd03600[_0x2ada('0x49')]['name']:!_[_0x2ada('0x1e')](_0xd03600[_0x2ada('0x4a')])?_0xd03600[_0x2ada('0x4a')]+'\x20'+_0xd03600['last_name']:_0xd03600[_0x2ada('0x5d')],'id':_0xd03600['id']};_0x27c61c[_0x2ada('0x5e')]=intUtil['getString'](_0x5499a4[_0x2ada('0x5f')],_0x43663c,'\x20');_0x27c61c[_0x2ada('0x60')]=intUtil['getString'](_0x5499a4[_0x2ada('0x61')],_0x43663c,'\x0a');if(_0x4b4bd1[_0x2ada('0x4e')]===_0x2ada('0x5a')){_0x27c61c[_0x2ada('0x62')]={'name':!_['isNil'](_0x4b4bd1[_0x2ada('0x63')])?_0x4b4bd1[_0x2ada('0x63')]:!_['isNil'](_0x4b4bd1[_0x2ada('0x64')])?_0x4b4bd1[_0x2ada('0x64')]+'\x20'+_0x4b4bd1[_0x2ada('0x65')]:_0x4b4bd1[_0x2ada('0x65')],'id':_0x4b4bd1['id']};}if(_0x4b4bd1[_0x2ada('0x4e')]===_0x2ada('0x56')){_0x27c61c[_0x2ada('0x66')]={'name':!_[_0x2ada('0x1e')](_0x4b4bd1[_0x2ada('0x63')])?_0x4b4bd1[_0x2ada('0x63')]:!_['isNil'](_0x4b4bd1[_0x2ada('0x64')])?_0x4b4bd1[_0x2ada('0x64')]+'\x20'+_0x4b4bd1[_0x2ada('0x65')]:_0x4b4bd1[_0x2ada('0x65')],'id':_0x4b4bd1['id']};_0x27c61c[_0x2ada('0x67')]=_['startCase'](_0x4b4bd1[_0x2ada('0x4e')]);}if(_0x43663c[_0x2ada('0x68')]){_0x27c61c['Call_Duration']=moment[_0x2ada('0x69')](parseInt(_0x43663c[_0x2ada('0x68')])*0x3e8)['format'](_0x2ada('0x6a'));}else if(_0x43663c[_0x2ada('0x6b')]&&_0x43663c[_0x2ada('0x6c')]){_0x27c61c[_0x2ada('0x6d')]=moment[_0x2ada('0x69')](moment(_0x43663c[_0x2ada('0x6c')],_0x2ada('0x6e'))[_0x2ada('0x6f')](moment(_0x43663c[_0x2ada('0x70')],_0x2ada('0x6e'))))[_0x2ada('0x37')](_0x2ada('0x6a'));}switch(_0x43663c[_0x2ada('0x71')]){case _0x2ada('0x72'):_0x27c61c[_0x2ada('0x73')]=_0x2ada('0x74');break;case _0x2ada('0x75'):case _0x2ada('0x76'):_0x27c61c[_0x2ada('0x73')]='Answered';break;case'rejected':_0x27c61c['Call_Result']=_0x2ada('0x77');break;case _0x2ada('0x78'):_0x27c61c[_0x2ada('0x73')]=_0x2ada('0x79');break;case _0x2ada('0x7a'):_0x27c61c[_0x2ada('0x73')]=_0x2ada('0x7b');default:}_0x27c61c['Call_Start_Time']=(_0x1a5529===_0x2ada('0x7c')?moment(_0x43663c[_0x2ada('0x70')])[_0x2ada('0x37')](_0x2ada('0x6e')):moment(_0x43663c[_0x2ada('0x7d')])[_0x2ada('0x37')](_0x2ada('0x6e')))||moment()[_0x2ada('0x37')](_0x2ada('0x6e'));_0x27c61c[_0x2ada('0x7e')]=_0x1a5529||'Inbound';_0x27c61c=_[_0x2ada('0x7f')](_0x27c61c,getCustomFields(_0x5499a4[_0x2ada('0x80')],_0x43663c));return request({'method':_0x2ada('0x28'),'uri':_0x2ada('0x45')+_0x56d1f7+_0x2ada('0x81'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x5defbb},'body':{'data':[_0x27c61c]},'json':!![]})[_0x2ada('0x2e')](function(_0x38a4bb){if(_0x38a4bb&&_0x38a4bb[_0x2ada('0x44')][0x0][_0x2ada('0x4b')]===_0x2ada('0x4c')){logger['info'](_0x2ada('0x82'));return{'id':_0x38a4bb['data'][0x0][_0x2ada('0x4d')]['id']};}})['catch'](function(_0x576986){logger[_0x2ada('0x34')]('err',_0x576986[_0x2ada('0x33')]);console[_0x2ada('0x51')]('err',_0x576986);});}exports[_0x2ada('0x83')]=function(_0x41d96b,_0x1f66b6,_0xf39ceb,_0x4cc618,_0x2501e4,_0x3b0bc2){var _0x4477d0,_0x13ccaa,_0x3605b0;_0x3b0bc2[_0x2ada('0x84')]=intUtil['stripTrailingSlash'](_0x3b0bc2['host']);_0x3b0bc2[_0x2ada('0x85')]=intUtil['stripTrailingSlash'](_0x3b0bc2[_0x2ada('0x85')]);if(_0x2501e4&&_0x2501e4[_0x2ada('0x86')]){logger[_0x2ada('0x34')]('[QUEUE]',_0x2ada('0x87'));_0x1f66b6['recordingURL']=_0x3b0bc2[_0x2ada('0x85')]+_0x2ada('0x88')+_0x1f66b6[_0x2ada('0x89')]+'/downloads?type=uniqueid&token='+md5(_0x1f66b6[_0x2ada('0x89')]);}else{_0x1f66b6[_0x2ada('0x8a')]='';}var _0x1ff628=_0x3b0bc2[_0x2ada('0x84')]===_0x2ada('0x8b')?'eu':_0x2ada('0x8c');return getAccessToken(_0x3b0bc2)[_0x2ada('0x2e')](function(_0x41b8d7){_0x3605b0=_0x41b8d7;return getUser(_0x3605b0,_0x1ff628,_0x3b0bc2,_0x4cc618[_0x2ada('0x3c')]);})[_0x2ada('0x2e')](function(_0x3985db){_0x4477d0=_0x3985db;logger['info'](_0x2ada('0x8d'),_0x4477d0['id']);return getEndUser(_0x3605b0,_0x1ff628,_0x3b0bc2,_0x1f66b6[_0x2ada('0x8e')],_0x1f66b6[_0x2ada('0x8f')],_0x4477d0,_0xf39ceb);})[_0x2ada('0x2e')](function(_0x5adeca){_0x13ccaa=_0x5adeca;return getCall(_0x3605b0,_0x1ff628,_0x3b0bc2,_0x4477d0,_0x13ccaa,_0xf39ceb,_0x1f66b6,'Inbound');})[_0x2ada('0x2e')](function(_0x1996e8){if(_0x1996e8){logger[_0x2ada('0x34')](_0x2ada('0x90'),_0x1996e8['id']);logger[_0x2ada('0x34')](_0x2ada('0x91'),_0x2ada('0x92'));emit(util[_0x2ada('0x37')](_0x2ada('0x93'),_0x4cc618['name']),_0x2ada('0x94'),{'uri':'https://crm.'+_0x3b0bc2[_0x2ada('0x84')]+'/crm/EntityInfo.do?module=Calls&id='+_0x1996e8['id']});}})[_0x2ada('0x31')](function(_0x18eed7){logger[_0x2ada('0x42')](_0x2ada('0x91'),JSON[_0x2ada('0xe')](_0x18eed7));});};exports[_0x2ada('0x7c')]=function(_0x144374,_0x43cc70,_0x5782c2,_0x4a1fd9,_0x58c97c,_0xaf00e4,_0x5272ce){var _0x16f879,_0x9b7a10,_0x2b7634;_0xaf00e4[_0x2ada('0x84')]=intUtil[_0x2ada('0x95')](_0xaf00e4[_0x2ada('0x84')]);_0xaf00e4['serverUrl']=intUtil[_0x2ada('0x95')](_0xaf00e4['serverUrl']);if(_0x5272ce&&_0x5272ce[_0x2ada('0x96')]&&_0x5272ce[_0x2ada('0x96')]!==_0x2ada('0x97')){logger[_0x2ada('0x34')](_0x2ada('0x98'),'Recording\x20is\x20enabled!');_0x43cc70[_0x2ada('0x8a')]=_0xaf00e4[_0x2ada('0x85')]+_0x2ada('0x88')+_0x43cc70['uniqueid']+_0x2ada('0x99')+md5(_0x43cc70['uniqueid']);}var _0x50b4ab=_0xaf00e4['host']===_0x2ada('0x8b')?'eu':_0x2ada('0x8c');return getAccessToken(_0xaf00e4)['then'](function(_0x2a988f){_0x2b7634=_0x2a988f;return getUser(_0x2b7634,_0x50b4ab,_0xaf00e4,_0x4a1fd9[_0x2ada('0x3c')]);})[_0x2ada('0x2e')](function(_0xf0492a){_0x16f879=_0xf0492a;logger['info'](_0x2ada('0x8d'),_0x16f879['id']);return getEndUser(_0x2b7634,_0x50b4ab,_0xaf00e4,_0x43cc70[_0x2ada('0x9a')],_0x43cc70[_0x2ada('0x9b')],_0x16f879,_0x5782c2);})[_0x2ada('0x2e')](function(_0x6c6119){_0x9b7a10=_0x6c6119;return getCall(_0x2b7634,_0x50b4ab,_0xaf00e4,_0x16f879,_0x9b7a10,_0x5782c2,_0x43cc70,_0x2ada('0x9c'));})[_0x2ada('0x2e')](function(_0x53f506){if(_0x53f506){logger[_0x2ada('0x34')](_0x2ada('0x90'),_0x53f506['id']);logger[_0x2ada('0x34')]('[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x2ada('0x37')](_0x2ada('0x93'),_0x4a1fd9[_0x2ada('0x1a')]),_0x2ada('0x94'),{'uri':'https://crm.'+_0xaf00e4[_0x2ada('0x84')]+_0x2ada('0x9d')+_0x53f506['id']});}})[_0x2ada('0x31')](function(_0xe04fe2){logger[_0x2ada('0x42')](_0x2ada('0x98'),JSON[_0x2ada('0xe')](_0xe04fe2));});};exports[_0x2ada('0x9e')]=function(_0x3985f2,_0x5f5598,_0x5588a2,_0x23f3d3,_0xdac5b2,_0x33f246){var _0x185c61,_0x466854,_0x34b510;_0x33f246[_0x2ada('0x84')]=intUtil['stripTrailingSlash'](_0x33f246[_0x2ada('0x84')]);_0x33f246[_0x2ada('0x85')]=intUtil[_0x2ada('0x95')](_0x33f246[_0x2ada('0x85')]);if(_0xdac5b2&&_0xdac5b2[_0x2ada('0x86')]){logger[_0x2ada('0x34')]('['+_0x5f5598[_0x2ada('0x71')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x5f5598[_0x2ada('0x8a')]=_0x33f246[_0x2ada('0x85')]+_0x2ada('0x88')+_0x5f5598[_0x2ada('0x89')]+_0x2ada('0x99')+md5(_0x5f5598[_0x2ada('0x89')]);}else{_0x5f5598[_0x2ada('0x8a')]='';}var _0xea68b7=_0x33f246['host']===_0x2ada('0x8b')?'eu':'com';return getAccessToken(_0x33f246)[_0x2ada('0x2e')](function(_0xba5702){_0x34b510=_0xba5702;return getUser(_0x34b510,_0xea68b7,_0x33f246);})[_0x2ada('0x2e')](function(_0x509a71){_0x185c61=_0x509a71;logger[_0x2ada('0x34')](_0x2ada('0x8d'),_0x185c61['id']);return getEndUser(_0x34b510,_0xea68b7,_0x33f246,_0x5f5598[_0x2ada('0x8e')],_0x5f5598['calleridnum'],_0x185c61,_0x5588a2);})['then'](function(_0x2e9b10){_0x466854=_0x2e9b10;return getCall(_0x34b510,_0xea68b7,_0x33f246,_0x185c61,_0x466854,_0x5588a2,_0x5f5598,_0x2ada('0x9f'));})[_0x2ada('0x2e')](function(_0x1f6068){if(_0x1f6068){logger[_0x2ada('0x34')](_0x2ada('0x90'),_0x1f6068['id']);}})[_0x2ada('0x31')](function(_0x59f689){logger[_0x2ada('0x42')]('['+_0x5f5598['lastevent']['toUpperCase']()+']',JSON[_0x2ada('0xe')](_0x59f689));});}; \ 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 46cff7e..f024ef8 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 _0x02fe=['%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','trigger','exec','data2','Script','data3','render','error'];(function(_0x3d8e8e,_0x55db5c){var _0x4252fe=function(_0x1c28f1){while(--_0x1c28f1){_0x3d8e8e['push'](_0x3d8e8e['shift']());}};_0x4252fe(++_0x55db5c);}(_0x02fe,0x82));var _0xe02f=function(_0x5f55a8,_0x52404b){_0x5f55a8=_0x5f55a8-0x0;var _0xe9865b=_0x02fe[_0x5f55a8];return _0xe9865b;};'use strict';var util=require(_0xe02f('0x0'));var sh=require(_0xe02f('0x1'));var Mustache=require(_0xe02f('0x2'));var logger=require('../../../../config/logger')(_0xe02f('0x3'));exports[_0xe02f('0x4')]=function(_0x40fb5c,_0x426266){var _0x257788=_0x40fb5c[_0xe02f('0x5')]?_0x40fb5c[_0xe02f('0x5')]:_0xe02f('0x6');var _0x3889c2=_0x40fb5c[_0xe02f('0x7')]?Mustache[_0xe02f('0x8')](_0x40fb5c['data3'],_0x426266):_0x426266;sh[_0xe02f('0x4')](_0x3889c2,function(_0x5bd8f6,_0x619ef0,_0xaa660f){if(_0x5bd8f6!==0x0){logger[_0xe02f('0x9')](util['format'](_0xe02f('0xa'),_0x257788,_0x3889c2,_0x5bd8f6,_0xaa660f));}else{logger[_0xe02f('0xb')](util[_0xe02f('0xc')](_0xe02f('0xd'),_0x257788,_0x3889c2,_0x619ef0));}});}; \ No newline at end of file +var _0x0b4f=['info','format','shelljs','mustache','trigger','exec','data2','Script','data3','render','error'];(function(_0x3b76f7,_0x566c53){var _0x43984e=function(_0x164f77){while(--_0x164f77){_0x3b76f7['push'](_0x3b76f7['shift']());}};_0x43984e(++_0x566c53);}(_0x0b4f,0x157));var _0xf0b4=function(_0x5b4063,_0x592e8a){_0x5b4063=_0x5b4063-0x0;var _0x2795c0=_0x0b4f[_0x5b4063];return _0x2795c0;};'use strict';var util=require('util');var sh=require(_0xf0b4('0x0'));var Mustache=require(_0xf0b4('0x1'));var logger=require('../../../../config/logger')(_0xf0b4('0x2'));exports[_0xf0b4('0x3')]=function(_0x32917c,_0x213dc9){var _0x38ca1a=_0x32917c[_0xf0b4('0x4')]?_0x32917c['data2']:_0xf0b4('0x5');var _0x46d2f8=_0x32917c[_0xf0b4('0x6')]?Mustache[_0xf0b4('0x7')](_0x32917c[_0xf0b4('0x6')],_0x213dc9):_0x213dc9;sh[_0xf0b4('0x3')](_0x46d2f8,function(_0xa4bc26,_0x4e73c6,_0x1dac98){if(_0xa4bc26!==0x0){logger[_0xf0b4('0x8')](util['format']('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x38ca1a,_0x46d2f8,_0xa4bc26,_0x1dac98));}else{logger[_0xf0b4('0x9')](util[_0xf0b4('0xa')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x38ca1a,_0x46d2f8,_0x4e73c6));}});}; \ 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 0a78491..c803b8b 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 _0x4550=['data7','parse','body','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data1','data2','stringify','then','isNil',',\x20request\x20body:\x20','object','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','mustache','../../../../config/logger','trigger','exec','toUpperCase','render','data5','number','data6','error','stack','DELETE','POST','PUT'];(function(_0x4ef724,_0x2eaa8f){var _0x16b426=function(_0x2c336b){while(--_0x2c336b){_0x4ef724['push'](_0x4ef724['shift']());}};_0x16b426(++_0x2eaa8f);}(_0x4550,0x1a9));var _0x0455=function(_0x5820f4,_0x502a6c){_0x5820f4=_0x5820f4-0x0;var _0x7c2af6=_0x4550[_0x5820f4];return _0x7c2af6;};'use strict';var rp=require(_0x0455('0x0'));var util=require(_0x0455('0x1'));var _=require(_0x0455('0x2'));var Mustache=require(_0x0455('0x3'));var logger=require(_0x0455('0x4'))(_0x0455('0x5'));exports[_0x0455('0x6')]=function(_0x4bf0bf,_0x24e1b6){var _0x12ed90,_0xbe99a9;var _0x3b3a58={'method':_0x4bf0bf['data1'][_0x0455('0x7')](),'uri':Mustache[_0x0455('0x8')](_0x4bf0bf['data2'],_0x24e1b6),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x4bf0bf[_0x0455('0x9')])===_0x0455('0xa')&&parseInt(_0x4bf0bf['data5'])>=0x1&&parseInt(_0x4bf0bf['data5'])<=0xa?parseInt(_0x4bf0bf[_0x0455('0x9')])*0x3e8:0x5*0x3e8};try{_0x3b3a58['headers']=_0x4bf0bf[_0x0455('0xb')]?JSON['parse'](Mustache[_0x0455('0x8')](_0x4bf0bf['data6'],_0x24e1b6)):{};}catch(_0x2f3e2b){logger[_0x0455('0xc')](_0x2f3e2b[_0x0455('0xd')]);}switch(_0x4bf0bf['data1'][_0x0455('0x7')]()){case'GET':case _0x0455('0xe'):_0x12ed90=null;_0x3b3a58['qs']=_0x24e1b6;break;case _0x0455('0xf'):case _0x0455('0x10'):if(_0x4bf0bf[_0x0455('0x11')]){try{_0x12ed90=JSON[_0x0455('0x12')](Mustache['render'](_0x4bf0bf[_0x0455('0x11')],_0x24e1b6));_0x3b3a58[_0x0455('0x13')]=_0x12ed90;}catch(_0xca9987){logger[_0x0455('0xc')](_0xca9987['stack']);logger['error']('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x12ed90=_0x24e1b6;_0x3b3a58[_0x0455('0x13')]=_0x12ed90;}break;}logger[_0x0455('0x14')](util[_0x0455('0x15')](_0x0455('0x16'),_0x4bf0bf[_0x0455('0x17')],_0x4bf0bf[_0x0455('0x18')],JSON[_0x0455('0x19')](_0x3b3a58)));rp(_0x3b3a58)[_0x0455('0x1a')](function(_0x570c5c){_0x12ed90=!_[_0x0455('0x1b')](_0x12ed90)?_0x0455('0x1c')+_0x12ed90:'';_0xbe99a9=typeof _0x570c5c['body']===_0x0455('0x1d')?JSON[_0x0455('0x19')](_0x570c5c[_0x0455('0x13')]):_0x570c5c[_0x0455('0x13')];logger[_0x0455('0x14')](util[_0x0455('0x15')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x4bf0bf[_0x0455('0x17')],_0x4bf0bf[_0x0455('0x18')],_0x570c5c[_0x0455('0x1e')],_0xbe99a9));})['catch'](function(_0x49482a){logger[_0x0455('0xc')](util[_0x0455('0x15')](_0x0455('0x1f'),_0x4bf0bf[_0x0455('0x17')],_0x4bf0bf[_0x0455('0x18')],_0x49482a[_0x0455('0x1e')],_0x49482a[_0x0455('0x20')],_0x49482a[_0x0455('0x21')]));});}; \ No newline at end of file +var _0x7dc9=['render','data2','data5','number','headers','parse','data6','error','stack','GET','DELETE','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','stringify',',\x20request\x20body:\x20','object','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','message','request-promise','util','lodash','mustache','trigger','exec','data1','toUpperCase'];(function(_0x586fa8,_0x21ae01){var _0x3b2a0f=function(_0xcee18){while(--_0xcee18){_0x586fa8['push'](_0x586fa8['shift']());}};_0x3b2a0f(++_0x21ae01);}(_0x7dc9,0x7c));var _0x97dc=function(_0x10f9c1,_0x11007){_0x10f9c1=_0x10f9c1-0x0;var _0x21c274=_0x7dc9[_0x10f9c1];return _0x21c274;};'use strict';var rp=require(_0x97dc('0x0'));var util=require(_0x97dc('0x1'));var _=require(_0x97dc('0x2'));var Mustache=require(_0x97dc('0x3'));var logger=require('../../../../config/logger')(_0x97dc('0x4'));exports[_0x97dc('0x5')]=function(_0x3ddcb7,_0x540fc9){var _0x1c61c0,_0x34bfbf;var _0x429073={'method':_0x3ddcb7[_0x97dc('0x6')][_0x97dc('0x7')](),'uri':Mustache[_0x97dc('0x8')](_0x3ddcb7[_0x97dc('0x9')],_0x540fc9),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3ddcb7[_0x97dc('0xa')])===_0x97dc('0xb')&&parseInt(_0x3ddcb7['data5'])>=0x1&&parseInt(_0x3ddcb7[_0x97dc('0xa')])<=0xa?parseInt(_0x3ddcb7['data5'])*0x3e8:0x5*0x3e8};try{_0x429073[_0x97dc('0xc')]=_0x3ddcb7['data6']?JSON[_0x97dc('0xd')](Mustache[_0x97dc('0x8')](_0x3ddcb7[_0x97dc('0xe')],_0x540fc9)):{};}catch(_0x57d3f7){logger[_0x97dc('0xf')](_0x57d3f7[_0x97dc('0x10')]);}switch(_0x3ddcb7[_0x97dc('0x6')]['toUpperCase']()){case _0x97dc('0x11'):case _0x97dc('0x12'):_0x1c61c0=null;_0x429073['qs']=_0x540fc9;break;case'POST':case _0x97dc('0x13'):if(_0x3ddcb7[_0x97dc('0x14')]){try{_0x1c61c0=JSON['parse'](Mustache[_0x97dc('0x8')](_0x3ddcb7[_0x97dc('0x14')],_0x540fc9));_0x429073[_0x97dc('0x15')]=_0x1c61c0;}catch(_0x3064cc){logger[_0x97dc('0xf')](_0x3064cc[_0x97dc('0x10')]);logger[_0x97dc('0xf')](_0x97dc('0x16'));}}else{_0x1c61c0=_0x540fc9;_0x429073[_0x97dc('0x15')]=_0x1c61c0;}break;}logger[_0x97dc('0x17')](util[_0x97dc('0x18')](_0x97dc('0x19'),_0x3ddcb7[_0x97dc('0x6')],_0x3ddcb7[_0x97dc('0x9')],JSON[_0x97dc('0x1a')](_0x429073)));rp(_0x429073)['then'](function(_0x4e9b13){_0x1c61c0=!_['isNil'](_0x1c61c0)?_0x97dc('0x1b')+_0x1c61c0:'';_0x34bfbf=typeof _0x4e9b13[_0x97dc('0x15')]===_0x97dc('0x1c')?JSON['stringify'](_0x4e9b13[_0x97dc('0x15')]):_0x4e9b13[_0x97dc('0x15')];logger[_0x97dc('0x17')](util['format']('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x3ddcb7[_0x97dc('0x6')],_0x3ddcb7[_0x97dc('0x9')],_0x4e9b13[_0x97dc('0x1d')],_0x34bfbf));})[_0x97dc('0x1e')](function(_0xf60e3a){logger['error'](util['format'](_0x97dc('0x1f'),_0x3ddcb7[_0x97dc('0x6')],_0x3ddcb7[_0x97dc('0x9')],_0xf60e3a[_0x97dc('0x1d')],_0xf60e3a['name'],_0xf60e3a[_0x97dc('0x20')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 8e5d84a..75db6f7 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 _0xa099=['rpc','error','message','catch','jayson/promise','bluebird','../../config/logger','routing','http','request','debug'];(function(_0x4a6abc,_0x3e4be5){var _0x42ff0f=function(_0x4af9fe){while(--_0x4af9fe){_0x4a6abc['push'](_0x4a6abc['shift']());}};_0x42ff0f(++_0x3e4be5);}(_0xa099,0xb4));var _0x9a09=function(_0x3c0910,_0x2da17e){_0x3c0910=_0x3c0910-0x0;var _0x380286=_0xa099[_0x3c0910];return _0x380286;};'use strict';var jayson=require(_0x9a09('0x0'));var BPromise=require(_0x9a09('0x1'));var logger=require(_0x9a09('0x2'))(_0x9a09('0x3'));var client=jayson['client'][_0x9a09('0x4')]({'port':0x2329});client['Request']=function(_0x567da5,_0x4b8b4d){return new BPromise(function(_0x410180,_0x5f607b){return client[_0x9a09('0x5')](_0x567da5,_0x4b8b4d)['then'](function(_0x1253f5){logger[_0x9a09('0x6')](_0x9a09('0x7'),'routing',_0x567da5,_0x4b8b4d,_0x1253f5);if(_0x1253f5[_0x9a09('0x8')]){logger[_0x9a09('0x8')](_0x9a09('0x7'),_0x9a09('0x3'),_0x567da5,_0x1253f5[_0x9a09('0x8')][_0x9a09('0x9')],_0x4b8b4d);return _0x5f607b(_0x1253f5[_0x9a09('0x8')]['message']);}else{return _0x410180(_0x1253f5['result']);}})[_0x9a09('0xa')](function(_0x164365){logger[_0x9a09('0x8')](_0x9a09('0x7'),_0x9a09('0x3'),_0x567da5,_0x164365,_0x4b8b4d);return _0x5f607b(_0x164365);});});};module['exports']=client; \ No newline at end of file +var _0x4725=['http','Request','request','then','debug','rpc','error','message','catch','routing','exports','bluebird'];(function(_0x5931fd,_0x212fdb){var _0x26fd78=function(_0x4462cf){while(--_0x4462cf){_0x5931fd['push'](_0x5931fd['shift']());}};_0x26fd78(++_0x212fdb);}(_0x4725,0x18b));var _0x5472=function(_0x1417b8,_0x5772ce){_0x1417b8=_0x1417b8-0x0;var _0x5e38a3=_0x4725[_0x1417b8];return _0x5e38a3;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x5472('0x0'));var logger=require('../../config/logger')('routing');var client=jayson['client'][_0x5472('0x1')]({'port':0x2329});client[_0x5472('0x2')]=function(_0x3fb4db,_0x474d4a){return new BPromise(function(_0x26cd21,_0x40306a){return client[_0x5472('0x3')](_0x3fb4db,_0x474d4a)[_0x5472('0x4')](function(_0xab1886){logger[_0x5472('0x5')](_0x5472('0x6'),'routing',_0x3fb4db,_0x474d4a,_0xab1886);if(_0xab1886[_0x5472('0x7')]){logger['error'](_0x5472('0x6'),'routing',_0x3fb4db,_0xab1886[_0x5472('0x7')][_0x5472('0x8')],_0x474d4a);return _0x40306a(_0xab1886[_0x5472('0x7')][_0x5472('0x8')]);}else{return _0x26cd21(_0xab1886['result']);}})[_0x5472('0x9')](function(_0x24dfea){logger[_0x5472('0x7')](_0x5472('0x6'),_0x5472('0xa'),_0x3fb4db,_0x24dfea,_0x474d4a);return _0x40306a(_0x24dfea);});});};module[_0x5472('0xb')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 04d53d8..ef32ba9 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 _0x0478=['catch','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/setting','../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','getSettings'];(function(_0x209555,_0x145672){var _0x2f60e3=function(_0x2f73f5){while(--_0x2f73f5){_0x209555['push'](_0x209555['shift']());}};_0x2f60e3(++_0x145672);}(_0x0478,0x157));var _0x8047=function(_0x50b499,_0x507650){_0x50b499=_0x50b499-0x0;var _0x20e29a=_0x0478[_0x50b499];return _0x20e29a;};'use strict';var server=require(_0x8047('0x0'));var Realtime=require(_0x8047('0x1'));var EmailChannel=require(_0x8047('0x2'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0x8047('0x3'));var logger=require(_0x8047('0x4'))(_0x8047('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x8047('0x6')]()[_0x8047('0x7')](mailAccount[_0x8047('0x8')]())['then'](realtime[_0x8047('0x9')]())[_0x8047('0x7')](function(){email[_0x8047('0xa')](realtime[_0x8047('0xb')]);return realtime;});}function main(){return server[_0x8047('0xc')](realtime,email)[_0x8047('0x7')](function(){return initRealtime();})['then'](function(){return setting[_0x8047('0xd')]();})[_0x8047('0x7')](function(_0x17d5a8){return setInterval(initRealtime,_0x17d5a8['loginMailFrequency']*0x3e8);})[_0x8047('0xe')](function(_0x4fe033){logger[_0x8047('0xf')](_0x8047('0x10'),_0x4fe033);});}main(); \ No newline at end of file +var _0x199c=['mailAccounts','listen','loginMailFrequency','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','email','resolve','then','initMailAccounts','refresh'];(function(_0x11b699,_0x352c30){var _0x177ac4=function(_0x4b9741){while(--_0x4b9741){_0x11b699['push'](_0x11b699['shift']());}};_0x177ac4(++_0x352c30);}(_0x199c,0x1b3));var _0xc199=function(_0x57c22b,_0x54a1fa){_0x57c22b=_0x57c22b-0x0;var _0x5c982e=_0x199c[_0x57c22b];return _0x5c982e;};'use strict';var server=require('./server');var Realtime=require(_0xc199('0x0'));var EmailChannel=require(_0xc199('0x1'));var mailAccount=require(_0xc199('0x2'));var setting=require(_0xc199('0x3'));var logger=require('../../config/logger')(_0xc199('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xc199('0x5')]()[_0xc199('0x6')](mailAccount['getMailAccounts']())[_0xc199('0x6')](realtime[_0xc199('0x7')]())[_0xc199('0x6')](function(){email[_0xc199('0x8')](realtime[_0xc199('0x9')]);return realtime;});}function main(){return server[_0xc199('0xa')](realtime,email)[_0xc199('0x6')](function(){return initRealtime();})['then'](function(){return setting['getSettings']();})['then'](function(_0x5e8a6f){return setInterval(initRealtime,_0x5e8a6f[_0xc199('0xb')]*0x3e8);})['catch'](function(_0x1adf30){logger['error']('Email\x20service\x20initialization',_0x1adf30);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 6423655..e5a033a 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 _0xd127=['send','Smtp','verify','verified','moment','md5','ioredis','../../../config/environment','../../../config/logger','redis','defaults','socket.io-emitter','./imap','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status','stringify','mailAccount:update','hasOwnProperty','service','custom','provider','email','box','bind','end','error','handleImapError','isNil','disabled','messageStatus','handleImapBox','messages','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','lastSync','sendMail'];(function(_0x654b53,_0x1a0e28){var _0x223b1d=function(_0x56948c){while(--_0x56948c){_0x654b53['push'](_0x654b53['shift']());}};_0x223b1d(++_0x1a0e28);}(_0xd127,0x1d8));var _0x7d12=function(_0x551f89,_0x44dd9d){_0x551f89=_0x551f89-0x0;var _0x2b63c1=_0xd127[_0x551f89];return _0x2b63c1;};'use strict';var _=require('lodash');var moment=require(_0x7d12('0x0'));var BPromise=require('bluebird');var md5=require(_0x7d12('0x1'));var Redis=require(_0x7d12('0x2'));var config=require(_0x7d12('0x3'));var logger=require(_0x7d12('0x4'))('email');config[_0x7d12('0x5')]=_[_0x7d12('0x6')](config[_0x7d12('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x7d12('0x7'))(new Redis(config['redis']));var EmailImap=require(_0x7d12('0x8'));var EmailSmtp=require('./smtp');var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x10efc0){logger['info'](_0x7d12('0x9'));this[_0x7d12('0xa')]=_0x10efc0['mailAccounts'];this[_0x7d12('0xb')]={};this[_0x7d12('0xc')]=new EmailSmtp();}EmailChannel[_0x7d12('0xd')][_0x7d12('0xe')]=function(_0x14e070){var _0x16f45a=this['mailAccounts'][_0x14e070];var _0x5d5fc5={'id':_0x16f45a['id'],'name':_0x16f45a[_0x7d12('0xf')],'key':_0x16f45a[_0x7d12('0x10')],'active':_0x16f45a[_0x7d12('0x11')],'Imap':{'status':_0x16f45a[_0x7d12('0x12')][_0x7d12('0x13')],'messageStatus':_0x16f45a['Imap']['messageStatus'],'total':_0x16f45a[_0x7d12('0x12')]['total']}};if(_['isNil'](md5Accounts[_0x14e070])){md5Accounts[_0x14e070]={};}var _0x13c481=md5(JSON[_0x7d12('0x14')](_0x5d5fc5));if(md5Accounts[_0x14e070][_0x7d12('0x1')]!==_0x13c481){md5Accounts[_0x14e070][_0x7d12('0x1')]=_0x13c481;io[_0x7d12('0xe')](_0x7d12('0x15'),_0x5d5fc5);}};EmailChannel[_0x7d12('0xd')]['refresh']=function(_0x4b81f4){for(var _0x215478 in _0x4b81f4){if(_0x4b81f4[_0x7d12('0x16')](_0x215478)){if(_0x4b81f4[_0x215478][_0x7d12('0x12')]&&_0x4b81f4[_0x215478][_0x7d12('0x11')]){var _0x56739b=_0x4b81f4[_0x215478][_0x7d12('0x12')];if(!_0x56739b[_0x7d12('0x17')]&&_0x4b81f4[_0x215478]['provider']!==_0x7d12('0x18'))_0x56739b[_0x7d12('0x17')]=_0x4b81f4[_0x215478][_0x7d12('0x19')];if(!this[_0x7d12('0xb')][_0x7d12('0x16')](_0x56739b['id'])){this[_0x7d12('0xb')][_0x56739b['id']]=new EmailImap(_0x56739b,_0x4b81f4[_0x215478][_0x7d12('0x1a')]);this[_0x7d12('0xb')][_0x56739b['id']]['on'](_0x7d12('0x1b'),this['handleImapBox'][_0x7d12('0x1c')](this,_0x215478));this['imapAccounts'][_0x56739b['id']]['on'](_0x7d12('0x1a'),this['handleImapEmail'][_0x7d12('0x1c')](this,_0x215478));this[_0x7d12('0xb')][_0x56739b['id']]['on'](_0x7d12('0x1d'),this['handleImapEnd'][_0x7d12('0x1c')](this,_0x215478));this[_0x7d12('0xb')][_0x56739b['id']]['on'](_0x7d12('0x1e'),this[_0x7d12('0x1f')][_0x7d12('0x1c')](this,_0x215478));}}else{if(_[_0x7d12('0x20')](this[_0x7d12('0xa')][_0x215478]['Imap'])){this[_0x7d12('0xa')][_0x215478][_0x7d12('0x12')]={};}this[_0x7d12('0xa')][_0x215478][_0x7d12('0x12')]['status']=_0x7d12('0x21');this[_0x7d12('0xa')][_0x215478][_0x7d12('0x12')][_0x7d12('0x22')]='';this[_0x7d12('0xe')](_0x215478);}}}};EmailChannel[_0x7d12('0xd')][_0x7d12('0x23')]=function(_0xb8145c,_0x3e47d5){if(this['mailAccounts'][_0xb8145c]){this[_0x7d12('0xa')][_0xb8145c][_0x7d12('0x12')]['status']='connected';this['mailAccounts'][_0xb8145c][_0x7d12('0x12')][_0x7d12('0x22')]=_0x3e47d5[_0x7d12('0xf')];if(_0x3e47d5[_0x7d12('0x24')]){this['mailAccounts'][_0xb8145c][_0x7d12('0x12')]['total']=_0x3e47d5[_0x7d12('0x24')]['total'];}return this[_0x7d12('0xe')](_0xb8145c);}};EmailChannel['prototype']['handleImapEmail']=function(_0x2fa167,_0x502431){logger[_0x7d12('0x25')](_0x7d12('0x26'),_0x502431[_0x7d12('0x27')],_0x502431[_0x7d12('0x28')],_0x502431[_0x7d12('0x29')],_0x2fa167);if(this['mailAccounts'][_0x2fa167]){return mailAccount['notify'](_0x2fa167,_0x502431)[_0x7d12('0x2a')](function(_0x411ac3){if(_0x411ac3){logger[_0x7d12('0x25')]('Mail\x20accepted\x20from\x20routing');}})[_0x7d12('0x2b')](function(_0x5b55ca){logger[_0x7d12('0x1e')](_0x7d12('0x2c'),JSON[_0x7d12('0x14')](_0x5b55ca));});}};EmailChannel[_0x7d12('0xd')][_0x7d12('0x2d')]=function(_0x12010b){if(this[_0x7d12('0xa')][_0x12010b]&&this[_0x7d12('0xa')][_0x12010b][_0x7d12('0x12')]){if(this[_0x7d12('0xb')][this[_0x7d12('0xa')][_0x12010b][_0x7d12('0x12')]['id']]){delete this[_0x7d12('0xb')][this[_0x7d12('0xa')][_0x12010b][_0x7d12('0x12')]['id']];}this['mailAccounts'][_0x12010b]['Imap'][_0x7d12('0x2e')]=moment();this[_0x7d12('0xe')](_0x12010b);}};EmailChannel['prototype'][_0x7d12('0x1f')]=function(_0x5d7673,_0x46d6ba){if(this[_0x7d12('0xa')][_0x5d7673]){this[_0x7d12('0xa')][_0x5d7673][_0x7d12('0x12')]['status']=_0x7d12('0x1e');this[_0x7d12('0xa')][_0x5d7673][_0x7d12('0x12')]['messageStatus']=_0x46d6ba;return this[_0x7d12('0xe')](_0x5d7673);}};EmailChannel[_0x7d12('0xd')][_0x7d12('0x2f')]=function(_0x3cd0ee,_0x3d7c3a){return this['smtp'][_0x7d12('0x30')](_0x3cd0ee,_0x3d7c3a);};EmailChannel[_0x7d12('0xd')]['verifySmtp']=function(_0x359092){var _0x79c294=this;if(this['mailAccounts'][_0x359092['id']]){if(_[_0x7d12('0x20')](this[_0x7d12('0xa')][_0x359092['id']][_0x7d12('0x31')])){this['mailAccounts'][_0x359092['id']][_0x7d12('0x31')]={};}this[_0x7d12('0xa')][_0x359092['id']]['Smtp'][_0x7d12('0x2e')]=moment();return new BPromise(function(_0x47a1ec,_0x596712){return _0x79c294[_0x7d12('0xc')][_0x7d12('0x32')](_0x359092)[_0x7d12('0x2a')](function(_0x41662c){_0x79c294[_0x7d12('0xa')][_0x359092['id']][_0x7d12('0x31')][_0x7d12('0x13')]=_0x7d12('0x33');_0x79c294[_0x7d12('0xa')][_0x359092['id']][_0x7d12('0x31')][_0x7d12('0x22')]='';_0x79c294[_0x7d12('0xe')](_0x359092['id']);_0x47a1ec(_0x41662c);})['catch'](function(_0x574153){_0x79c294[_0x7d12('0xa')][_0x359092['id']][_0x7d12('0x31')][_0x7d12('0x13')]=_0x7d12('0x1e');_0x79c294['mailAccounts'][_0x359092['id']][_0x7d12('0x31')][_0x7d12('0x22')]=_0x574153;_0x79c294[_0x7d12('0xe')](_0x359092['id']);_0x596712(_0x574153);});});}return this['smtp']['verify'](_0x359092);};module['exports']=EmailChannel; \ No newline at end of file +var _0x4ace=['ioredis','../../../config/environment','defaults','redis','./imap','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','name','key','active','Imap','status','messageStatus','total','isNil','stringify','md5','mailAccount:update','refresh','hasOwnProperty','service','provider','custom','handleImapBox','email','handleImapEmail','bind','handleImapEnd','error','handleImapError','disabled','emit','prototype','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','Smtp','verify','verified','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4ace,0x1db));var _0xe4ac=function(_0x4fa5bf,_0x3f8fea){_0x4fa5bf=_0x4fa5bf-0x0;var _0x4efa77=_0x4ace[_0x4fa5bf];return _0x4efa77;};'use strict';var _=require('lodash');var moment=require(_0xe4ac('0x0'));var BPromise=require(_0xe4ac('0x1'));var md5=require('md5');var Redis=require(_0xe4ac('0x2'));var config=require(_0xe4ac('0x3'));var logger=require('../../../config/logger')('email');config['redis']=_[_0xe4ac('0x4')](config[_0xe4ac('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe4ac('0x5')]));var EmailImap=require(_0xe4ac('0x6'));var EmailSmtp=require(_0xe4ac('0x7'));var mailAccount=require(_0xe4ac('0x8'));var md5Accounts={};function EmailChannel(_0x4391c2){logger['info'](_0xe4ac('0x9'));this[_0xe4ac('0xa')]=_0x4391c2[_0xe4ac('0xa')];this[_0xe4ac('0xb')]={};this[_0xe4ac('0xc')]=new EmailSmtp();}EmailChannel['prototype']['emit']=function(_0x3f50ca){var _0x567226=this['mailAccounts'][_0x3f50ca];var _0x5d69a2={'id':_0x567226['id'],'name':_0x567226[_0xe4ac('0xd')],'key':_0x567226[_0xe4ac('0xe')],'active':_0x567226[_0xe4ac('0xf')],'Imap':{'status':_0x567226[_0xe4ac('0x10')][_0xe4ac('0x11')],'messageStatus':_0x567226['Imap'][_0xe4ac('0x12')],'total':_0x567226[_0xe4ac('0x10')][_0xe4ac('0x13')]}};if(_[_0xe4ac('0x14')](md5Accounts[_0x3f50ca])){md5Accounts[_0x3f50ca]={};}var _0x385288=md5(JSON[_0xe4ac('0x15')](_0x5d69a2));if(md5Accounts[_0x3f50ca][_0xe4ac('0x16')]!==_0x385288){md5Accounts[_0x3f50ca][_0xe4ac('0x16')]=_0x385288;io['emit'](_0xe4ac('0x17'),_0x5d69a2);}};EmailChannel['prototype'][_0xe4ac('0x18')]=function(_0x374977){for(var _0x5caf0d in _0x374977){if(_0x374977[_0xe4ac('0x19')](_0x5caf0d)){if(_0x374977[_0x5caf0d][_0xe4ac('0x10')]&&_0x374977[_0x5caf0d][_0xe4ac('0xf')]){var _0x3e5cce=_0x374977[_0x5caf0d][_0xe4ac('0x10')];if(!_0x3e5cce[_0xe4ac('0x1a')]&&_0x374977[_0x5caf0d][_0xe4ac('0x1b')]!==_0xe4ac('0x1c'))_0x3e5cce['service']=_0x374977[_0x5caf0d][_0xe4ac('0x1b')];if(!this[_0xe4ac('0xb')][_0xe4ac('0x19')](_0x3e5cce['id'])){this[_0xe4ac('0xb')][_0x3e5cce['id']]=new EmailImap(_0x3e5cce,_0x374977[_0x5caf0d]['email']);this[_0xe4ac('0xb')][_0x3e5cce['id']]['on']('box',this[_0xe4ac('0x1d')]['bind'](this,_0x5caf0d));this[_0xe4ac('0xb')][_0x3e5cce['id']]['on'](_0xe4ac('0x1e'),this[_0xe4ac('0x1f')][_0xe4ac('0x20')](this,_0x5caf0d));this[_0xe4ac('0xb')][_0x3e5cce['id']]['on']('end',this[_0xe4ac('0x21')][_0xe4ac('0x20')](this,_0x5caf0d));this['imapAccounts'][_0x3e5cce['id']]['on'](_0xe4ac('0x22'),this[_0xe4ac('0x23')][_0xe4ac('0x20')](this,_0x5caf0d));}}else{if(_[_0xe4ac('0x14')](this[_0xe4ac('0xa')][_0x5caf0d]['Imap'])){this[_0xe4ac('0xa')][_0x5caf0d][_0xe4ac('0x10')]={};}this[_0xe4ac('0xa')][_0x5caf0d][_0xe4ac('0x10')][_0xe4ac('0x11')]=_0xe4ac('0x24');this[_0xe4ac('0xa')][_0x5caf0d][_0xe4ac('0x10')][_0xe4ac('0x12')]='';this[_0xe4ac('0x25')](_0x5caf0d);}}}};EmailChannel['prototype'][_0xe4ac('0x1d')]=function(_0x40dd76,_0x257c86){if(this[_0xe4ac('0xa')][_0x40dd76]){this['mailAccounts'][_0x40dd76][_0xe4ac('0x10')][_0xe4ac('0x11')]='connected';this[_0xe4ac('0xa')][_0x40dd76][_0xe4ac('0x10')][_0xe4ac('0x12')]=_0x257c86[_0xe4ac('0xd')];if(_0x257c86['messages']){this[_0xe4ac('0xa')][_0x40dd76][_0xe4ac('0x10')][_0xe4ac('0x13')]=_0x257c86['messages'][_0xe4ac('0x13')];}return this[_0xe4ac('0x25')](_0x40dd76);}};EmailChannel[_0xe4ac('0x26')][_0xe4ac('0x1f')]=function(_0x10486b,_0x4ac06f){logger[_0xe4ac('0x27')](_0xe4ac('0x28'),_0x4ac06f[_0xe4ac('0x29')],_0x4ac06f['lastName'],_0x4ac06f[_0xe4ac('0x2a')],_0x10486b);if(this[_0xe4ac('0xa')][_0x10486b]){return mailAccount['notify'](_0x10486b,_0x4ac06f)[_0xe4ac('0x2b')](function(_0x33f8bb){if(_0x33f8bb){logger[_0xe4ac('0x27')](_0xe4ac('0x2c'));}})[_0xe4ac('0x2d')](function(_0x58c41f){logger[_0xe4ac('0x22')](_0xe4ac('0x2e'),JSON['stringify'](_0x58c41f));});}};EmailChannel[_0xe4ac('0x26')][_0xe4ac('0x21')]=function(_0x4a20a8){if(this[_0xe4ac('0xa')][_0x4a20a8]&&this[_0xe4ac('0xa')][_0x4a20a8][_0xe4ac('0x10')]){if(this[_0xe4ac('0xb')][this[_0xe4ac('0xa')][_0x4a20a8][_0xe4ac('0x10')]['id']]){delete this['imapAccounts'][this[_0xe4ac('0xa')][_0x4a20a8][_0xe4ac('0x10')]['id']];}this['mailAccounts'][_0x4a20a8][_0xe4ac('0x10')][_0xe4ac('0x2f')]=moment();this[_0xe4ac('0x25')](_0x4a20a8);}};EmailChannel[_0xe4ac('0x26')][_0xe4ac('0x23')]=function(_0x66b9b7,_0xc1bd80){if(this['mailAccounts'][_0x66b9b7]){this[_0xe4ac('0xa')][_0x66b9b7]['Imap'][_0xe4ac('0x11')]='error';this[_0xe4ac('0xa')][_0x66b9b7][_0xe4ac('0x10')][_0xe4ac('0x12')]=_0xc1bd80;return this['emit'](_0x66b9b7);}};EmailChannel[_0xe4ac('0x26')][_0xe4ac('0x30')]=function(_0x3214d9,_0x2ef03a){return this[_0xe4ac('0xc')][_0xe4ac('0x31')](_0x3214d9,_0x2ef03a);};EmailChannel[_0xe4ac('0x26')]['verifySmtp']=function(_0x20de7b){var _0x2f01bc=this;if(this['mailAccounts'][_0x20de7b['id']]){if(_[_0xe4ac('0x14')](this[_0xe4ac('0xa')][_0x20de7b['id']][_0xe4ac('0x32')])){this[_0xe4ac('0xa')][_0x20de7b['id']][_0xe4ac('0x32')]={};}this[_0xe4ac('0xa')][_0x20de7b['id']][_0xe4ac('0x32')]['lastSync']=moment();return new BPromise(function(_0x42fab7,_0x363fed){return _0x2f01bc['smtp'][_0xe4ac('0x33')](_0x20de7b)['then'](function(_0x387940){_0x2f01bc['mailAccounts'][_0x20de7b['id']][_0xe4ac('0x32')][_0xe4ac('0x11')]=_0xe4ac('0x34');_0x2f01bc[_0xe4ac('0xa')][_0x20de7b['id']][_0xe4ac('0x32')]['messageStatus']='';_0x2f01bc['emit'](_0x20de7b['id']);_0x42fab7(_0x387940);})[_0xe4ac('0x2d')](function(_0x1f4dd0){_0x2f01bc[_0xe4ac('0xa')][_0x20de7b['id']]['Smtp']['status']=_0xe4ac('0x22');_0x2f01bc[_0xe4ac('0xa')][_0x20de7b['id']][_0xe4ac('0x32')][_0xe4ac('0x12')]=_0x1f4dd0;_0x2f01bc[_0xe4ac('0x25')](_0x20de7b['id']);_0x363fed(_0x1f4dd0);});});}return this[_0xe4ac('0xc')][_0xe4ac('0x33')](_0x20de7b);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 2dc0b06..e3fbda8 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 _0x3a14=['fetch','handleFetchMessage','handleFetchError','closeBox','body','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','mailbox','account','getAccount','imap','ready','bind','once','end','handleEnd','error','connect','inherits','connTimeout','authTimeout','service','user','generateXOAuth2Token','data5','password','authentication','email','anonymous@xcally.com','host','port','tls','autotls','required','prototype','handleReady','handleOpenBox','handleError','emit','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length'];(function(_0x20a914,_0x552bc9){var _0x24418a=function(_0x28ea0d){while(--_0x28ea0d){_0x20a914['push'](_0x20a914['shift']());}};_0x24418a(++_0x552bc9);}(_0x3a14,0x8b));var _0x43a1=function(_0x5d2655,_0x36a00c){_0x5d2655=_0x5d2655-0x0;var _0x4ddb00=_0x3a14[_0x5d2655];return _0x4ddb00;};'use strict';var _=require(_0x43a1('0x0'));var util=require('util');var Imap=require('imap');var simpleParser=require(_0x43a1('0x1'))[_0x43a1('0x2')];var Iconv=require(_0x43a1('0x3'))[_0x43a1('0x4')];var EventEmitter=require(_0x43a1('0x5'))[_0x43a1('0x6')];var utils=require(_0x43a1('0x7'));var logger=require(_0x43a1('0x8'))('email');function EmailImap(_0x2550ea,_0x21e5e8){this[_0x43a1('0x9')]=_0x2550ea[_0x43a1('0x9')];this[_0x43a1('0xa')]=this[_0x43a1('0xb')](_0x2550ea,_0x21e5e8);this[_0x43a1('0xc')]=new Imap(this[_0x43a1('0xa')]);this[_0x43a1('0xc')]['once'](_0x43a1('0xd'),this['handleReady'][_0x43a1('0xe')](this));this[_0x43a1('0xc')][_0x43a1('0xf')](_0x43a1('0x10'),this[_0x43a1('0x11')][_0x43a1('0xe')](this));this[_0x43a1('0xc')]['on'](_0x43a1('0x12'),this['handleError'][_0x43a1('0xe')](this));this[_0x43a1('0xc')][_0x43a1('0x13')]();}util[_0x43a1('0x14')](EmailImap,EventEmitter);EmailImap['prototype']['getAccount']=function(_0x5e3f0f,_0x539267){var _0x309612={'connTimeout':_0x5e3f0f[_0x43a1('0x15')]?_0x5e3f0f['connTimeout']*0x3e8:0x2710,'authTimeout':_0x5e3f0f[_0x43a1('0x16')]?_0x5e3f0f[_0x43a1('0x16')]*0x3e8:0x1388};if(_0x5e3f0f[_0x43a1('0x17')]){_0x309612[_0x43a1('0x18')]=_0x5e3f0f[_0x43a1('0x18')];if(_0x5e3f0f['modernAuthentication']){_0x309612['xoauth2']=utils[_0x43a1('0x19')](_0x5e3f0f['CloudProvider'][_0x43a1('0x1a')],_0x5e3f0f['user']);}else{_0x309612[_0x43a1('0x1b')]=_0x5e3f0f[_0x43a1('0x1b')];}}else{if(_0x5e3f0f[_0x43a1('0x1c')]){_0x309612[_0x43a1('0x18')]=_0x5e3f0f[_0x43a1('0x18')];_0x309612[_0x43a1('0x1b')]=_0x5e3f0f[_0x43a1('0x1b')];}}_0x309612[_0x43a1('0x1d')]=_0x539267||_0x5e3f0f[_0x43a1('0x18')]||_0x43a1('0x1e');_0x309612[_0x43a1('0x1f')]=_0x5e3f0f[_0x43a1('0x1f')];_0x309612[_0x43a1('0x20')]=_0x5e3f0f[_0x43a1('0x20')]||0x3e1;if(_0x5e3f0f[_0x43a1('0x21')]){_0x309612[_0x43a1('0x21')]=!![];}else{_0x309612[_0x43a1('0x21')]=![];_0x309612[_0x43a1('0x22')]=_0x43a1('0x23');}return _0x309612;};EmailImap[_0x43a1('0x24')][_0x43a1('0x25')]=function(){this['imap']['openBox'](this[_0x43a1('0x9')],![],this[_0x43a1('0x26')]['bind'](this));};EmailImap['prototype'][_0x43a1('0x26')]=function(_0x3672a4,_0x4bd1dd){if(_0x3672a4){this[_0x43a1('0x27')](_0x3672a4,!![]);}else{this[_0x43a1('0x28')]('box',_0x4bd1dd);this[_0x43a1('0x29')]();}};EmailImap['prototype'][_0x43a1('0x2a')]=function(_0x1272b0){if(_0x1272b0){this[_0x43a1('0x27')](_0x1272b0,!![]);}else{this['imap']['end']();}};EmailImap[_0x43a1('0x24')]['readUnseen']=function(){this[_0x43a1('0xc')][_0x43a1('0x2b')]([_0x43a1('0x2c')],this[_0x43a1('0x2d')][_0x43a1('0xe')](this));};EmailImap[_0x43a1('0x24')][_0x43a1('0x2d')]=function(_0x179496,_0x33595e){if(_0x179496){this[_0x43a1('0x27')](_0x179496,!![]);}else{if(_0x33595e[_0x43a1('0x2e')]){try{var _0x25e876=this[_0x43a1('0xc')][_0x43a1('0x2f')](_0x33595e,{'bodies':'','markSeen':!![]});_0x25e876['on']('message',this[_0x43a1('0x30')][_0x43a1('0xe')](this));_0x25e876[_0x43a1('0xf')](_0x43a1('0x12'),this[_0x43a1('0x31')][_0x43a1('0xe')](this));_0x25e876['once'](_0x43a1('0x10'),this['handleFetchEnd'][_0x43a1('0xe')](this));}catch(_0x40f2e9){logger[_0x43a1('0x12')](_0x40f2e9);}}else{this[_0x43a1('0xc')][_0x43a1('0x32')](!![],this[_0x43a1('0x2a')][_0x43a1('0xe')](this));}}};EmailImap[_0x43a1('0x24')][_0x43a1('0x30')]=function(_0x1a875c){_0x1a875c['on'](_0x43a1('0x33'),this['handleMessageBody'][_0x43a1('0xe')](this));_0x1a875c['once'](_0x43a1('0x34'),this[_0x43a1('0x35')][_0x43a1('0xe')](this));_0x1a875c[_0x43a1('0xf')](_0x43a1('0x10'),this[_0x43a1('0x36')][_0x43a1('0xe')](this));};EmailImap['prototype']['handleMessageBody']=function(_0x3392ca){simpleParser(_0x3392ca,{'Iconv':Iconv},this['handleSimpleParser'][_0x43a1('0xe')](this));};EmailImap['prototype']['handleMessageAttributes']=function(){};EmailImap[_0x43a1('0x24')][_0x43a1('0x36')]=function(){};EmailImap['prototype'][_0x43a1('0x37')]=function(_0x2c1130,_0x5807cb){if(_0x2c1130){logger[_0x43a1('0x12')](_0x2c1130);}else{var _0x11e738=this;utils[_0x43a1('0x38')](this[_0x43a1('0xa')],_0x5807cb,function(_0x193901){_0x11e738[_0x43a1('0x28')]('email',_0x193901);});}};EmailImap[_0x43a1('0x24')]['handleFetchEnd']=function(){this[_0x43a1('0xc')][_0x43a1('0x32')](!![],this[_0x43a1('0x2a')]['bind'](this));};EmailImap[_0x43a1('0x24')][_0x43a1('0x31')]=function(_0x4abd0e){this['handleError'](_0x4abd0e);this[_0x43a1('0xc')][_0x43a1('0x32')](!![],this[_0x43a1('0x2a')]['bind'](this));};EmailImap[_0x43a1('0x24')][_0x43a1('0x11')]=function(){this[_0x43a1('0x28')](_0x43a1('0x10'));};EmailImap['prototype'][_0x43a1('0x27')]=function(_0x29c980,_0x37e811){logger[_0x43a1('0x12')](_0x43a1('0x27'),this[_0x43a1('0xa')][_0x43a1('0x1d')],JSON[_0x43a1('0x39')](_0x29c980));var _0x3664d6='';if(_0x29c980){if(_0x29c980['textCode']){_0x3664d6=_0x29c980[_0x43a1('0x3a')];}else{for(var _0x4967cc in _0x29c980){if(_0x29c980[_0x43a1('0x3b')](_0x4967cc)){_0x3664d6+=_[_0x43a1('0x3c')](_0x4967cc)+':\x20'+_0x29c980[_0x4967cc]+'\x0a';}}}}if(_0x37e811){this[_0x43a1('0xc')][_0x43a1('0x10')]();}else{this[_0x43a1('0x28')](_0x43a1('0x12'),_0x3664d6);this[_0x43a1('0x28')](_0x43a1('0x10'));}};module[_0x43a1('0x3d')]=EmailImap; \ No newline at end of file +var _0xfa61=['handleError','inherits','connTimeout','authTimeout','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','anonymous@xcally.com','host','port','tls','autotls','required','prototype','openBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','parser','handleFetchEnd','stringify','textCode','hasOwnProperty','upperFirst','lodash','imap','simpleParser','Iconv','events','EventEmitter','../../../config/logger','email','mailbox','account','getAccount','once','handleReady','bind','end','handleEnd','error'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0xfa61,0x1d7));var _0x1fa6=function(_0x44035a,_0xdd083b){_0x44035a=_0x44035a-0x0;var _0x4fb549=_0xfa61[_0x44035a];return _0x4fb549;};'use strict';var _=require(_0x1fa6('0x0'));var util=require('util');var Imap=require(_0x1fa6('0x1'));var simpleParser=require('mailparser')[_0x1fa6('0x2')];var Iconv=require('iconv')[_0x1fa6('0x3')];var EventEmitter=require(_0x1fa6('0x4'))[_0x1fa6('0x5')];var utils=require('./utils');var logger=require(_0x1fa6('0x6'))(_0x1fa6('0x7'));function EmailImap(_0x2dc460,_0x5ab8f3){this['mailbox']=_0x2dc460[_0x1fa6('0x8')];this[_0x1fa6('0x9')]=this[_0x1fa6('0xa')](_0x2dc460,_0x5ab8f3);this[_0x1fa6('0x1')]=new Imap(this[_0x1fa6('0x9')]);this[_0x1fa6('0x1')][_0x1fa6('0xb')]('ready',this[_0x1fa6('0xc')][_0x1fa6('0xd')](this));this['imap'][_0x1fa6('0xb')](_0x1fa6('0xe'),this[_0x1fa6('0xf')][_0x1fa6('0xd')](this));this[_0x1fa6('0x1')]['on'](_0x1fa6('0x10'),this[_0x1fa6('0x11')]['bind'](this));this[_0x1fa6('0x1')]['connect']();}util[_0x1fa6('0x12')](EmailImap,EventEmitter);EmailImap['prototype'][_0x1fa6('0xa')]=function(_0x30d71e,_0x2fdc6b){var _0x3ffa73={'connTimeout':_0x30d71e[_0x1fa6('0x13')]?_0x30d71e[_0x1fa6('0x13')]*0x3e8:0x2710,'authTimeout':_0x30d71e[_0x1fa6('0x14')]?_0x30d71e['authTimeout']*0x3e8:0x1388};if(_0x30d71e['service']){_0x3ffa73[_0x1fa6('0x15')]=_0x30d71e[_0x1fa6('0x15')];if(_0x30d71e[_0x1fa6('0x16')]){_0x3ffa73[_0x1fa6('0x17')]=utils[_0x1fa6('0x18')](_0x30d71e[_0x1fa6('0x19')][_0x1fa6('0x1a')],_0x30d71e[_0x1fa6('0x15')]);}else{_0x3ffa73[_0x1fa6('0x1b')]=_0x30d71e[_0x1fa6('0x1b')];}}else{if(_0x30d71e[_0x1fa6('0x1c')]){_0x3ffa73[_0x1fa6('0x15')]=_0x30d71e[_0x1fa6('0x15')];_0x3ffa73['password']=_0x30d71e[_0x1fa6('0x1b')];}}_0x3ffa73[_0x1fa6('0x7')]=_0x2fdc6b||_0x30d71e[_0x1fa6('0x15')]||_0x1fa6('0x1d');_0x3ffa73[_0x1fa6('0x1e')]=_0x30d71e[_0x1fa6('0x1e')];_0x3ffa73[_0x1fa6('0x1f')]=_0x30d71e[_0x1fa6('0x1f')]||0x3e1;if(_0x30d71e['tls']){_0x3ffa73[_0x1fa6('0x20')]=!![];}else{_0x3ffa73[_0x1fa6('0x20')]=![];_0x3ffa73[_0x1fa6('0x21')]=_0x1fa6('0x22');}return _0x3ffa73;};EmailImap[_0x1fa6('0x23')]['handleReady']=function(){this['imap'][_0x1fa6('0x24')](this[_0x1fa6('0x8')],![],this['handleOpenBox'][_0x1fa6('0xd')](this));};EmailImap[_0x1fa6('0x23')]['handleOpenBox']=function(_0x329d26,_0x302512){if(_0x329d26){this[_0x1fa6('0x11')](_0x329d26,!![]);}else{this[_0x1fa6('0x25')](_0x1fa6('0x26'),_0x302512);this[_0x1fa6('0x27')]();}};EmailImap[_0x1fa6('0x23')][_0x1fa6('0x28')]=function(_0x3e70d7){if(_0x3e70d7){this[_0x1fa6('0x11')](_0x3e70d7,!![]);}else{this['imap'][_0x1fa6('0xe')]();}};EmailImap[_0x1fa6('0x23')][_0x1fa6('0x27')]=function(){this[_0x1fa6('0x1')][_0x1fa6('0x29')]([_0x1fa6('0x2a')],this[_0x1fa6('0x2b')][_0x1fa6('0xd')](this));};EmailImap[_0x1fa6('0x23')]['handleReadUnseen']=function(_0x3cec40,_0x2823c9){if(_0x3cec40){this['handleError'](_0x3cec40,!![]);}else{if(_0x2823c9[_0x1fa6('0x2c')]){try{var _0x4768a9=this[_0x1fa6('0x1')][_0x1fa6('0x2d')](_0x2823c9,{'bodies':'','markSeen':!![]});_0x4768a9['on'](_0x1fa6('0x2e'),this[_0x1fa6('0x2f')]['bind'](this));_0x4768a9[_0x1fa6('0xb')]('error',this[_0x1fa6('0x30')][_0x1fa6('0xd')](this));_0x4768a9['once'](_0x1fa6('0xe'),this['handleFetchEnd'][_0x1fa6('0xd')](this));}catch(_0x8bcfed){logger[_0x1fa6('0x10')](_0x8bcfed);}}else{this[_0x1fa6('0x1')][_0x1fa6('0x31')](!![],this[_0x1fa6('0x28')][_0x1fa6('0xd')](this));}}};EmailImap[_0x1fa6('0x23')][_0x1fa6('0x2f')]=function(_0x134817){_0x134817['on'](_0x1fa6('0x32'),this[_0x1fa6('0x33')][_0x1fa6('0xd')](this));_0x134817[_0x1fa6('0xb')](_0x1fa6('0x34'),this[_0x1fa6('0x35')][_0x1fa6('0xd')](this));_0x134817[_0x1fa6('0xb')]('end',this[_0x1fa6('0x36')]['bind'](this));};EmailImap[_0x1fa6('0x23')][_0x1fa6('0x33')]=function(_0x4c94a8){simpleParser(_0x4c94a8,{'Iconv':Iconv},this['handleSimpleParser'][_0x1fa6('0xd')](this));};EmailImap[_0x1fa6('0x23')]['handleMessageAttributes']=function(){};EmailImap['prototype'][_0x1fa6('0x36')]=function(){};EmailImap[_0x1fa6('0x23')]['handleSimpleParser']=function(_0x5d459e,_0x4d56d0){if(_0x5d459e){logger[_0x1fa6('0x10')](_0x5d459e);}else{var _0x189e8c=this;utils[_0x1fa6('0x37')](this[_0x1fa6('0x9')],_0x4d56d0,function(_0x1f1c37){_0x189e8c[_0x1fa6('0x25')]('email',_0x1f1c37);});}};EmailImap['prototype'][_0x1fa6('0x38')]=function(){this[_0x1fa6('0x1')][_0x1fa6('0x31')](!![],this['handleCloseBox']['bind'](this));};EmailImap['prototype'][_0x1fa6('0x30')]=function(_0x35e3e2){this['handleError'](_0x35e3e2);this['imap'][_0x1fa6('0x31')](!![],this['handleCloseBox'][_0x1fa6('0xd')](this));};EmailImap[_0x1fa6('0x23')][_0x1fa6('0xf')]=function(){this[_0x1fa6('0x25')](_0x1fa6('0xe'));};EmailImap[_0x1fa6('0x23')]['handleError']=function(_0x5e230a,_0x5a43f4){logger[_0x1fa6('0x10')](_0x1fa6('0x11'),this[_0x1fa6('0x9')][_0x1fa6('0x7')],JSON[_0x1fa6('0x39')](_0x5e230a));var _0x235bc3='';if(_0x5e230a){if(_0x5e230a[_0x1fa6('0x3a')]){_0x235bc3=_0x5e230a[_0x1fa6('0x3a')];}else{for(var _0x199173 in _0x5e230a){if(_0x5e230a[_0x1fa6('0x3b')](_0x199173)){_0x235bc3+=_[_0x1fa6('0x3c')](_0x199173)+':\x20'+_0x5e230a[_0x199173]+'\x0a';}}}}if(_0x5a43f4){this[_0x1fa6('0x1')][_0x1fa6('0xe')]();}else{this[_0x1fa6('0x25')]('error',_0x235bc3);this[_0x1fa6('0x25')]('end');}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 08451e0..c33b205 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 _0xb2d9=['compile','sendMail','toString','prototype','verify','Not\x20verifired','nodemailer-plugin-inline-base64','send','createTransport','use'];(function(_0xf5b107,_0x263ed4){var _0x2b64a7=function(_0x2dac80){while(--_0x2dac80){_0xf5b107['push'](_0xf5b107['shift']());}};_0x2b64a7(++_0x263ed4);}(_0xb2d9,0x11e));var _0x9b2d=function(_0x1ed78f,_0x49a29e){_0x1ed78f=_0x1ed78f-0x0;var _0xeb802d=_0xb2d9[_0x1ed78f];return _0xeb802d;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0x9b2d('0x0'));function EmailSmtp(){}EmailSmtp['prototype'][_0x9b2d('0x1')]=function(_0x455ea9,_0x13051a){return new Promise(function(_0x2d8b08,_0x3b4184){var _0x2ebde0=nodemailer[_0x9b2d('0x2')](_0x455ea9);_0x2ebde0[_0x9b2d('0x3')](_0x9b2d('0x4'),inlineBase64());_0x2ebde0[_0x9b2d('0x5')](_0x13051a,function(_0xb7db9d,_0x516cb5){if(_0xb7db9d){_0x3b4184(_0xb7db9d[_0x9b2d('0x6')]());}else{_0x2d8b08(_0x516cb5);}});});};EmailSmtp[_0x9b2d('0x7')]['verify']=function(_0x3de96f){return new Promise(function(_0x19cc88,_0x2355fb){var _0x5c6a9a=nodemailer[_0x9b2d('0x2')](_0x3de96f);_0x5c6a9a[_0x9b2d('0x8')](function(_0x1c1338,_0x18ad12){if(_0x1c1338){_0x2355fb(_0x1c1338['toString']());}else{if(_0x18ad12){_0x19cc88(_0x18ad12);}else{_0x2355fb(_0x9b2d('0x9'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0xafd2=['nodemailer','nodemailer-plugin-inline-base64','send','createTransport','use','compile','sendMail','toString','verify','exports'];(function(_0x72b55c,_0x3a8755){var _0x200d60=function(_0x521983){while(--_0x521983){_0x72b55c['push'](_0x72b55c['shift']());}};_0x200d60(++_0x3a8755);}(_0xafd2,0xf0));var _0x2afd=function(_0x39dafe,_0x207a01){_0x39dafe=_0x39dafe-0x0;var _0x129492=_0xafd2[_0x39dafe];return _0x129492;};'use strict';var nodemailer=require(_0x2afd('0x0'));var inlineBase64=require(_0x2afd('0x1'));function EmailSmtp(){}EmailSmtp['prototype'][_0x2afd('0x2')]=function(_0x1e240d,_0xce09b2){return new Promise(function(_0x2f5df2,_0x558032){var _0x556daf=nodemailer[_0x2afd('0x3')](_0x1e240d);_0x556daf[_0x2afd('0x4')](_0x2afd('0x5'),inlineBase64());_0x556daf[_0x2afd('0x6')](_0xce09b2,function(_0x2027ce,_0x443678){if(_0x2027ce){_0x558032(_0x2027ce[_0x2afd('0x7')]());}else{_0x2f5df2(_0x443678);}});});};EmailSmtp['prototype'][_0x2afd('0x8')]=function(_0x5a1cd7){return new Promise(function(_0x342f43,_0x378181){var _0x43e1ec=nodemailer[_0x2afd('0x3')](_0x5a1cd7);_0x43e1ec[_0x2afd('0x8')](function(_0x39d0f3,_0x1340cb){if(_0x39d0f3){_0x378181(_0x39d0f3[_0x2afd('0x7')]());}else{if(_0x1340cb){_0x342f43(_0x1340cb);}else{_0x378181('Not\x20verifired');}}});});};module[_0x2afd('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index d24b6d9..bab2870 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 _0x7deb=['Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','lodash','randomstring','util','node-tnef','../../../config/logger','../../../config/environment','value','address','anonymous','generate','head','name','indexOf','split','length','slice','join','Anonymous','isEmpty','@xcally.com','html','test','replace','includes'];(function(_0x33554b,_0x48162b){var _0x256954=function(_0x185f66){while(--_0x185f66){_0x33554b['push'](_0x33554b['shift']());}};_0x256954(++_0x48162b);}(_0x7deb,0x104));var _0xb7de=function(_0x1d7300,_0x17f109){_0x1d7300=_0x1d7300-0x0;var _0x46ee98=_0x7deb[_0x1d7300];return _0x46ee98;};'use strict';var _=require(_0xb7de('0x0'));var moment=require('moment');var random=require(_0xb7de('0x1'));var fs=require('fs');var path=require('path');var util=require(_0xb7de('0x2'));var tnef=require(_0xb7de('0x3'));var logger=require(_0xb7de('0x4'))('email');var config=require(_0xb7de('0x5'));function getAddress(_0x3ff2b1){var _0x3de97b=_['head'](_0x3ff2b1[_0xb7de('0x6')]);return _0x3de97b&&_0x3de97b['address']?_0x3de97b[_0xb7de('0x7')]:_0xb7de('0x8')+random[_0xb7de('0x9')](0x6)+'@xcally.com';}function getFirstName(_0x54cd75){var _0x4a9149=_[_0xb7de('0xa')](_0x54cd75[_0xb7de('0x6')]);if(_0x4a9149&&_0x4a9149['name']){if(_0x4a9149[_0xb7de('0xb')]==_0x4a9149['address']){return _0x4a9149[_0xb7de('0xb')]['substring'](0x0,_0x4a9149[_0xb7de('0xb')][_0xb7de('0xc')]('@'));}var _0x40c394=_0x4a9149[_0xb7de('0xb')][_0xb7de('0xd')](/\s+/);return _0x40c394[_0xb7de('0xe')]>0x1?_0x40c394[_0xb7de('0xf')](0x0,-0x1)[_0xb7de('0x10')]('\x20'):_0x4a9149[_0xb7de('0xb')];}return _0xb7de('0x11');}function getLastName(_0x168fb0){var _0x102cdb=_['head'](_0x168fb0[_0xb7de('0x6')]);if(_0x102cdb&&_0x102cdb['name']){var _0x56e46f=_0x102cdb[_0xb7de('0xb')][_0xb7de('0xd')](/\s+/);return _0x56e46f[_0xb7de('0xe')]>0x1?_0x56e46f['pop']():'';}return'';}function getMails(_0x1bc9af,_0x257897){var _0x595109='';for(var _0x13ae95=0x0;_0x13ae95<_0x257897['value']['length'];_0x13ae95+=0x1){if(_0x257897[_0xb7de('0x6')][_0x13ae95][_0xb7de('0x7')]!==_0x1bc9af){if(!_[_0xb7de('0x12')](_0x595109)){_0x595109+=',';}_0x595109+=_0x257897[_0xb7de('0x6')][_0x13ae95][_0xb7de('0xb')]||_0x257897[_0xb7de('0x6')][_0x13ae95][_0xb7de('0x7')]||'';_0x595109+='\x20<';_0x595109+=_0x257897[_0xb7de('0x6')][_0x13ae95]['address']?_0x257897['value'][_0x13ae95]['address']:'anonymous'+random[_0xb7de('0x9')](0x6)+_0xb7de('0x13');_0x595109+='>';}}return _0x595109;}function parseEmail(_0x124bb4,_0x63b949,_0x2a64e4){if(_0x63b949[_0xb7de('0x14')]){var _0x2f4efa=/)<[^<]*)*<\/script>/gi;while(_0x2f4efa[_0xb7de('0x15')](_0x63b949[_0xb7de('0x14')])){_0x63b949[_0xb7de('0x14')]=_0x63b949[_0xb7de('0x14')][_0xb7de('0x16')](_0x2f4efa,'');}if(_0x63b949[_0xb7de('0x14')][_0xb7de('0x17')](_0xb7de('0x18'))){var _0x105ceb=[];_0x63b949['attachments'][_0xb7de('0x19')](_0x4dc14f=>{_0x105ceb['push'](_0x4dc14f[_0xb7de('0x1a')]);});var _0x462682=/]+>/g;var _0x19663f=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x46c753=_0x63b949['html']['replace'](_0x19663f,_0xb7de('0x1b'));var _0x2b83aa=_0x46c753[_0xb7de('0x16')](_0x462682,_0xb7de('0x1c'));for(let _0xc09941=0x0;_0xc09941<_0x105ceb[_0xb7de('0xe')];_0xc09941++){var _0x15cfeb=_0x2b83aa[_0xb7de('0x16')](_0xb7de('0x1c'),'\x20[Attachment:\x20'+_0x105ceb[_0xc09941]+'\x20]');_0x2b83aa=_0x15cfeb;}_0x63b949[_0xb7de('0x14')]=_0x2b83aa;}_0x2a64e4['body']=_0x63b949['html'];}else{_0x2a64e4[_0xb7de('0x1d')]=_0x63b949[_0xb7de('0x1e')];}if(_0x2a64e4[_0xb7de('0x1d')]){_0x2a64e4['body']=_0x2a64e4['body'][_0xb7de('0x16')](/0x0){var _0x301e04=[_0xb7de('0x2f'),'X-Auto-Response-Suppress:\x20All',_0xb7de('0x30')];for(var _0x25becc=0x0;_0x25becc<_0x63b949[_0xb7de('0x2e')][_0xb7de('0xe')];_0x25becc++){var _0x2cfdaf=_[_0xb7de('0xc')](_0x301e04,_0x63b949['headerLines'][_0x25becc]['line']);if(_0x2cfdaf>=0x0){_0x2a64e4[_0xb7de('0x31')]=!![];}}}return _0x2a64e4;}exports[_0xb7de('0x32')]=function(_0x633039,_0x3434dd,_0x462dfc){var _0x1ac5db={'from':getAddress(_0x3434dd[_0xb7de('0x33')]),'firstName':getFirstName(_0x3434dd['from']),'lastName':getLastName(_0x3434dd[_0xb7de('0x33')]),'mapKey':'email','message':{'from':getMails(_0x633039[_0xb7de('0x22')],_0x3434dd['from']),'to':_0x633039['email'],'cc':'','subject':_0x3434dd[_0xb7de('0x34')]||'','messageId':_0x3434dd[_0xb7de('0x35')],'inReplyTo':_0x3434dd[_0xb7de('0x36')],'sentAt':moment(_0x3434dd[_0xb7de('0x37')])[_0xb7de('0x27')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x3434dd[_0xb7de('0x14')]&&!_0x3434dd['textAsHtml']){var _0xc54724=_[_0xb7de('0x38')](_0x3434dd[_0xb7de('0x24')],{'contentType':_0xb7de('0x39')});if(_0xc54724[_0xb7de('0xe')]){logger[_0xb7de('0x3a')](util[_0xb7de('0x27')](_0xb7de('0x3b'),_0x3434dd[_0xb7de('0x35')]));tnef[_0xb7de('0x3c')](_['first'](_0xc54724)['content'],function(_0x518f5f,_0x15c9de){if(_0x15c9de){_0x3434dd[_0xb7de('0x14')]=_0x15c9de[_0xb7de('0x3d')]||_0xb7de('0x3e');if(_0x15c9de[_0xb7de('0x3f')]){for(var _0x5025fb=0x0;_0x5025fb<_0x15c9de[_0xb7de('0x3f')][_0xb7de('0xe')];_0x5025fb++){var _0x4eff57=_0x15c9de[_0xb7de('0x3f')][_0x5025fb];_0x1ac5db['message'][_0xb7de('0x24')]['push']({'filename':_0x4eff57[_0xb7de('0x40')],'content':Buffer[_0xb7de('0x33')](_0x4eff57[_0xb7de('0x41')])});}}}_0x462dfc(parseEmail(_0x633039,_0x3434dd,_0x1ac5db));});}else{_0x3434dd['html']=_0xb7de('0x3e');_0x462dfc(parseEmail(_0x633039,_0x3434dd,_0x1ac5db));}}else{_0x462dfc(parseEmail(_0x633039,_0x3434dd,_0x1ac5db));}};exports[_0xb7de('0x42')]=function(_0x50410e,_0x363fd8){var _0x141608=[_0xb7de('0x43')+(_0x363fd8||''),_0xb7de('0x44')+_0x50410e,'',''];return Buffer[_0xb7de('0x33')](_0x141608[_0xb7de('0x10')](''),_0xb7de('0x45'))[_0xb7de('0x46')]('base64');}; \ No newline at end of file +var _0x7691=['join','isEmpty','anonymous','html','test','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x493b71[_0x1769('0xf')](0x0,-0x1)[_0x1769('0x10')]('\x20'):_0x1bbde5[_0x1769('0xa')];}return'Anonymous';}function getLastName(_0x5e5cd9){var _0x1d8f1f=_[_0x1769('0x5')](_0x5e5cd9['value']);if(_0x1d8f1f&&_0x1d8f1f[_0x1769('0xa')]){var _0x3d2a67=_0x1d8f1f[_0x1769('0xa')][_0x1769('0xd')](/\s+/);return _0x3d2a67[_0x1769('0xe')]>0x1?_0x3d2a67['pop']():'';}return'';}function getMails(_0x8e70e8,_0x56199e){var _0x372d92='';for(var _0x57082e=0x0;_0x57082e<_0x56199e[_0x1769('0x6')][_0x1769('0xe')];_0x57082e+=0x1){if(_0x56199e[_0x1769('0x6')][_0x57082e]['address']!==_0x8e70e8){if(!_[_0x1769('0x11')](_0x372d92)){_0x372d92+=',';}_0x372d92+=_0x56199e['value'][_0x57082e][_0x1769('0xa')]||_0x56199e[_0x1769('0x6')][_0x57082e][_0x1769('0x7')]||'';_0x372d92+='\x20<';_0x372d92+=_0x56199e['value'][_0x57082e][_0x1769('0x7')]?_0x56199e['value'][_0x57082e][_0x1769('0x7')]:_0x1769('0x12')+random[_0x1769('0x8')](0x6)+_0x1769('0x9');_0x372d92+='>';}}return _0x372d92;}function parseEmail(_0x32aec4,_0x5e6366,_0x5b1115){if(_0x5e6366[_0x1769('0x13')]){var _0x11baba=/)<[^<]*)*<\/script>/gi;while(_0x11baba[_0x1769('0x14')](_0x5e6366[_0x1769('0x13')])){_0x5e6366['html']=_0x5e6366['html'][_0x1769('0x15')](_0x11baba,'');}if(_0x5e6366[_0x1769('0x13')][_0x1769('0x16')](_0x1769('0x17'))){var _0x135f1d=[];_0x5e6366[_0x1769('0x18')][_0x1769('0x19')](_0x101aac=>{_0x135f1d['push'](_0x101aac[_0x1769('0x1a')]);});var _0x165308=/]+>/g;var _0x4fcec4=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x1c3651=_0x5e6366[_0x1769('0x13')][_0x1769('0x15')](_0x4fcec4,_0x1769('0x1b'));var _0x2dfab6=_0x1c3651[_0x1769('0x15')](_0x165308,'_IMG');for(let _0x195514=0x0;_0x195514<_0x135f1d[_0x1769('0xe')];_0x195514++){var _0x3da2ca=_0x2dfab6['replace']('_IMG',_0x1769('0x1c')+_0x135f1d[_0x195514]+_0x1769('0x1d'));_0x2dfab6=_0x3da2ca;}_0x5e6366['html']=_0x2dfab6;}_0x5b1115[_0x1769('0x1e')]=_0x5e6366['html'];}else{_0x5b1115['body']=_0x5e6366[_0x1769('0x1f')];}if(_0x5b1115[_0x1769('0x1e')]){_0x5b1115['body']=_0x5b1115['body'][_0x1769('0x15')](/0x0){var _0x44d739=[_0x1769('0x32'),_0x1769('0x33'),_0x1769('0x34')];for(var _0x3dcb3d=0x0;_0x3dcb3d<_0x5e6366['headerLines'][_0x1769('0xe')];_0x3dcb3d++){var _0xdf6d91=_[_0x1769('0xc')](_0x44d739,_0x5e6366[_0x1769('0x31')][_0x3dcb3d]['line']);if(_0xdf6d91>=0x0){_0x5b1115[_0x1769('0x35')]=!![];}}}return _0x5b1115;}exports[_0x1769('0x36')]=function(_0x4f0f35,_0x583296,_0x4646dc){var _0x3cf770={'from':getAddress(_0x583296[_0x1769('0x37')]),'firstName':getFirstName(_0x583296['from']),'lastName':getLastName(_0x583296[_0x1769('0x37')]),'mapKey':_0x1769('0x3'),'message':{'from':getMails(_0x4f0f35[_0x1769('0x3')],_0x583296['from']),'to':_0x4f0f35[_0x1769('0x3')],'cc':'','subject':_0x583296['subject']||'','messageId':_0x583296[_0x1769('0x38')],'inReplyTo':_0x583296['inReplyTo'],'sentAt':moment(_0x583296['date'])[_0x1769('0x29')](_0x1769('0x39')),'attach':![],'attachments':[]}};if(!_0x583296['html']&&!_0x583296[_0x1769('0x1f')]){var _0x2beaa9=_['filter'](_0x583296[_0x1769('0x18')],{'contentType':_0x1769('0x3a')});if(_0x2beaa9[_0x1769('0xe')]){logger[_0x1769('0x3b')](util[_0x1769('0x29')](_0x1769('0x3c'),_0x583296['messageId']));tnef[_0x1769('0x3d')](_[_0x1769('0x3e')](_0x2beaa9)[_0x1769('0x2f')],function(_0x1de9ee,_0xdd41a3){if(_0xdd41a3){_0x583296[_0x1769('0x13')]=_0xdd41a3[_0x1769('0x3f')]||'

Empty\x20message

';if(_0xdd41a3['Attachments']){for(var _0x1abde8=0x0;_0x1abde8<_0xdd41a3[_0x1769('0x40')]['length'];_0x1abde8++){var _0x462e2f=_0xdd41a3['Attachments'][_0x1abde8];_0x3cf770[_0x1769('0x21')][_0x1769('0x18')][_0x1769('0x30')]({'filename':_0x462e2f[_0x1769('0x41')],'content':Buffer[_0x1769('0x37')](_0x462e2f[_0x1769('0x42')])});}}}_0x4646dc(parseEmail(_0x4f0f35,_0x583296,_0x3cf770));});}else{_0x583296[_0x1769('0x13')]='

Empty\x20message

';_0x4646dc(parseEmail(_0x4f0f35,_0x583296,_0x3cf770));}}else{_0x4646dc(parseEmail(_0x4f0f35,_0x583296,_0x3cf770));}};exports['generateXOAuth2Token']=function(_0x284ba0,_0x15abeb){var _0x501646=['user='+(_0x15abeb||''),_0x1769('0x43')+_0x284ba0,'',''];return Buffer[_0x1769('0x37')](_0x501646[_0x1769('0x10')](''),'utf-8')[_0x1769('0x44')](_0x1769('0x45'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index d77bc8f..77a3f58 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 _0x954c=['Imap','Smtp','exports','lodash','name','Service','key','SERV','active'];(function(_0x121180,_0x42aaac){var _0x2b8d70=function(_0x16afb0){while(--_0x16afb0){_0x121180['push'](_0x121180['shift']());}};_0x2b8d70(++_0x42aaac);}(_0x954c,0x111));var _0xc954=function(_0x27fe4f,_0x171538){_0x27fe4f=_0x27fe4f-0x0;var _0x2ee5c6=_0x954c[_0x27fe4f];return _0x2ee5c6;};'use strict';var _=require(_0xc954('0x0'));function MailAccount(_0x5d9a0d){this['id']=_0x5d9a0d['id']||0x0;this[_0xc954('0x1')]=_0x5d9a0d[_0xc954('0x1')]||_0xc954('0x2');this[_0xc954('0x3')]=_0x5d9a0d[_0xc954('0x3')]||_0xc954('0x4');this[_0xc954('0x5')]=_0x5d9a0d[_0xc954('0x5')]||![];this[_0xc954('0x6')]=_0x5d9a0d[_0xc954('0x6')]||[];this[_0xc954('0x7')]=_0x5d9a0d[_0xc954('0x7')]||[];}module[_0xc954('0x8')]=MailAccount; \ No newline at end of file +var _0x7dd9=['Smtp','exports','lodash','name','Service','key','SERV','active','Imap'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7dd9,0x185));var _0x97dd=function(_0x766bc8,_0x539c18){_0x766bc8=_0x766bc8-0x0;var _0x11cde5=_0x7dd9[_0x766bc8];return _0x11cde5;};'use strict';var _=require(_0x97dd('0x0'));function MailAccount(_0x336457){this['id']=_0x336457['id']||0x0;this[_0x97dd('0x1')]=_0x336457[_0x97dd('0x1')]||_0x97dd('0x2');this[_0x97dd('0x3')]=_0x336457[_0x97dd('0x3')]||_0x97dd('0x4');this[_0x97dd('0x5')]=_0x336457['active']||![];this[_0x97dd('0x6')]=_0x336457['Imap']||[];this[_0x97dd('0x7')]=_0x336457[_0x97dd('0x7')]||[];}module[_0x97dd('0x8')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index dc1ca92..8ad1480 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 _0x27b1=['../model/mailAccount','mailAccounts','hasOwnProperty','mergeFromDatabase','prototype','initMailAccounts','length','merge','exports','lodash'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x27b1,0x117));var _0x127b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x27b1[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x127b('0x0'));var MailAccount=require(_0x127b('0x1'));var Realtime=function(){this[_0x127b('0x2')]={};};function freeIsNotKey(_0x20a23b,_0x44ec87,_0x3cdbe8){var _0x3d5453=_['mapKeys'](_0x20a23b,function(_0x27dcf4,_0x3f5d7d){return _0x27dcf4[_0x3cdbe8];});for(var _0xbf759e in _0x44ec87){if(_0x44ec87[_0x127b('0x3')](_0xbf759e)){if(!_0x3d5453[_0xbf759e]){delete _0x44ec87[_0xbf759e];}}}}Realtime['prototype'][_0x127b('0x4')]=function(_0x1281ec,_0x28d47d){for(var _0x3ea4cc in _0x28d47d){if(_0x1281ec[_0x127b('0x3')](_0x3ea4cc)){_0x1281ec[_0x3ea4cc]=_0x28d47d[_0x3ea4cc];}}};Realtime[_0x127b('0x5')][_0x127b('0x6')]=function(){var _0x336d19=this;return function(_0x501e3f){if(_0x501e3f){freeIsNotKey(_0x501e3f,_0x336d19['mailAccounts'],'id');for(var _0x48f9a0=0x0,_0x1f286b={},_0x3a8bc1={};_0x48f9a0<_0x501e3f[_0x127b('0x7')];_0x48f9a0+=0x1){_0x1f286b=_0x501e3f[_0x48f9a0];if(_['isUndefined'](_0x336d19[_0x127b('0x2')][_0x1f286b['id']])){_0x336d19['mailAccounts'][_0x1f286b['id']]=new MailAccount(_0x1f286b);}else{_[_0x127b('0x8')](_0x336d19[_0x127b('0x2')][_0x1f286b['id']],_0x1f286b);}}}return _0x336d19[_0x127b('0x2')];};};module[_0x127b('0x9')]=Realtime; \ No newline at end of file +var _0xad6a=['prototype','mergeFromDatabase','initMailAccounts','length','isUndefined','merge','lodash','mailAccounts','hasOwnProperty'];(function(_0xe82b99,_0x5b8453){var _0xa8bd4a=function(_0x1d2d89){while(--_0x1d2d89){_0xe82b99['push'](_0xe82b99['shift']());}};_0xa8bd4a(++_0x5b8453);}(_0xad6a,0x1ad));var _0xaad6=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0xad6a[_0x25d386];return _0x857f4a;};'use strict';var _=require(_0xaad6('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0xaad6('0x1')]={};};function freeIsNotKey(_0x247175,_0x5d7fc7,_0xbaf6e7){var _0x5af1a1=_['mapKeys'](_0x247175,function(_0x3459f8,_0x4525b0){return _0x3459f8[_0xbaf6e7];});for(var _0x4f0cdb in _0x5d7fc7){if(_0x5d7fc7[_0xaad6('0x2')](_0x4f0cdb)){if(!_0x5af1a1[_0x4f0cdb]){delete _0x5d7fc7[_0x4f0cdb];}}}}Realtime[_0xaad6('0x3')][_0xaad6('0x4')]=function(_0xa2cbab,_0x264d13){for(var _0x5a1ecb in _0x264d13){if(_0xa2cbab['hasOwnProperty'](_0x5a1ecb)){_0xa2cbab[_0x5a1ecb]=_0x264d13[_0x5a1ecb];}}};Realtime[_0xaad6('0x3')][_0xaad6('0x5')]=function(){var _0x3016c3=this;return function(_0x26712d){if(_0x26712d){freeIsNotKey(_0x26712d,_0x3016c3[_0xaad6('0x1')],'id');for(var _0x4f45c0=0x0,_0x56fbfb={},_0x31e9b7={};_0x4f45c0<_0x26712d[_0xaad6('0x6')];_0x4f45c0+=0x1){_0x56fbfb=_0x26712d[_0x4f45c0];if(_[_0xaad6('0x7')](_0x3016c3[_0xaad6('0x1')][_0x56fbfb['id']])){_0x3016c3[_0xaad6('0x1')][_0x56fbfb['id']]=new MailAccount(_0x56fbfb);}else{_[_0xaad6('0x8')](_0x3016c3[_0xaad6('0x1')][_0x56fbfb['id']],_0x56fbfb);}}}return _0x3016c3[_0xaad6('0x1')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index cb27a71..e28378b 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 _0x7f05=['service','email','key','ListId','MailServerIn','Imap','type','MailServerOut','CloudProvider','getMailAccount','../client','getMailAccounts','Request','name'];(function(_0x368c85,_0x586b0a){var _0x3477c2=function(_0x3ef6d9){while(--_0x3ef6d9){_0x368c85['push'](_0x368c85['shift']());}};_0x3477c2(++_0x586b0a);}(_0x7f05,0xdc));var _0x57f0=function(_0x246adf,_0x311101){_0x246adf=_0x246adf-0x0;var _0x25bf3f=_0x7f05[_0x246adf];return _0x25bf3f;};'use strict';var client=require(_0x57f0('0x0'));exports[_0x57f0('0x1')]=function(){return function(){return client[_0x57f0('0x2')]('GetMailAccount',{'options':{'attributes':['id',_0x57f0('0x3'),'provider',_0x57f0('0x4'),_0x57f0('0x5'),'active',_0x57f0('0x6'),_0x57f0('0x7'),'TemplateId'],'raw':![],'include':[{'model':_0x57f0('0x8'),'as':_0x57f0('0x9'),'include':[{'model':'CloudProvider','attributes':['id',_0x57f0('0x3'),_0x57f0('0x4'),_0x57f0('0xa'),'data5'],'as':'CloudProvider'}]},{'model':_0x57f0('0xb'),'as':'Smtp','include':[{'model':_0x57f0('0xc'),'attributes':['id',_0x57f0('0x3'),_0x57f0('0x4'),_0x57f0('0xa'),'data5'],'as':'CloudProvider'}]}]},'log':_0x57f0('0xd')});};};exports['notify']=function(_0x4b6aef,_0x50afee){return client['Request']('NotifyMailAccount',{'account':{'id':_0x4b6aef},'body':_0x50afee,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0x196b=['email','active','key','ListId','MailServerIn','Imap','CloudProvider','type','MailServerOut','Smtp','data5','notify','NotifyMailAccount','Request','GetMailAccount','name','provider','service'];(function(_0x2870f7,_0x38f769){var _0x3d0fbd=function(_0x4aa816){while(--_0x4aa816){_0x2870f7['push'](_0x2870f7['shift']());}};_0x3d0fbd(++_0x38f769);}(_0x196b,0x9d));var _0xb196=function(_0x48b1b6,_0x737f4b){_0x48b1b6=_0x48b1b6-0x0;var _0x390534=_0x196b[_0x48b1b6];return _0x390534;};'use strict';var client=require('../client');exports['getMailAccounts']=function(){return function(){return client[_0xb196('0x0')](_0xb196('0x1'),{'options':{'attributes':['id',_0xb196('0x2'),_0xb196('0x3'),_0xb196('0x4'),_0xb196('0x5'),_0xb196('0x6'),_0xb196('0x7'),_0xb196('0x8'),'TemplateId'],'raw':![],'include':[{'model':_0xb196('0x9'),'as':_0xb196('0xa'),'include':[{'model':_0xb196('0xb'),'attributes':['id',_0xb196('0x2'),'service',_0xb196('0xc'),'data5'],'as':_0xb196('0xb')}]},{'model':_0xb196('0xd'),'as':_0xb196('0xe'),'include':[{'model':_0xb196('0xb'),'attributes':['id','name',_0xb196('0x4'),_0xb196('0xc'),_0xb196('0xf')],'as':_0xb196('0xb')}]}]},'log':'getMailAccount'});};};exports[_0xb196('0x10')]=function(_0x560ac8,_0x2b2aea){return client[_0xb196('0x0')](_0xb196('0x11'),{'account':{'id':_0x560ac8},'body':_0x2b2aea,'log':_0xb196('0x11')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 6e4b2b9..56770dd 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 _0xc396=['getSettings','Request','ShowSetting','loginMailFrequency','GetSettings'];(function(_0x40bad6,_0x1a5dc8){var _0xdfd3f2=function(_0x20f7ee){while(--_0x20f7ee){_0x40bad6['push'](_0x40bad6['shift']());}};_0xdfd3f2(++_0x1a5dc8);}(_0xc396,0x14f));var _0x6c39=function(_0x25be3d,_0x52f5b9){_0x25be3d=_0x25be3d-0x0;var _0x4cc533=_0xc396[_0x25be3d];return _0x4cc533;};'use strict';var client=require('../client');exports[_0x6c39('0x0')]=function(){return client[_0x6c39('0x1')](_0x6c39('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x6c39('0x3')]},'log':_0x6c39('0x4')});}; \ No newline at end of file +var _0x985c=['loginMailFrequency','GetSettings','Request','ShowSetting'];(function(_0x4a0e06,_0x455aad){var _0x47bdfe=function(_0x2cae9f){while(--_0x2cae9f){_0x4a0e06['push'](_0x4a0e06['shift']());}};_0x47bdfe(++_0x455aad);}(_0x985c,0x1c2));var _0xc985=function(_0x3d17ce,_0x224352){_0x3d17ce=_0x3d17ce-0x0;var _0x1f6161=_0x985c[_0x3d17ce];return _0x1f6161;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0xc985('0x0')](_0xc985('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xc985('0x2')]},'log':_0xc985('0x3')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index b96f5c2..94e2e44 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(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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 8bdf5ab..9147579 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 _0x1d16=['default','../../routes','log','Express\x20server\x20listening\x20on\x20port\x20%d!','lodash','http','express','ioredis','listen','port','socket.io','websocket','polling','defaults','redis','adapter','socket.io-redis','../../config/socketio'];(function(_0x54b245,_0x57cd3f){var _0x85e2f0=function(_0x1afc23){while(--_0x1afc23){_0x54b245['push'](_0x54b245['shift']());}};_0x85e2f0(++_0x57cd3f);}(_0x1d16,0x136));var _0x61d1=function(_0x18fe54,_0xff789){_0x18fe54=_0x18fe54-0x0;var _0xccb1ee=_0x1d16[_0x18fe54];return _0xccb1ee;};'use strict';var _=require(_0x61d1('0x0'));var http=require(_0x61d1('0x1'));var express=require(_0x61d1('0x2'));var sticky=require('sticky-session');var Redis=require(_0x61d1('0x3'));var config=require('../../config/environment');var app=express();var server=http['createServer'](app);server['timeout']=0xdbba0;if(sticky[_0x61d1('0x4')](server,config[_0x61d1('0x5')])){var socketio=require(_0x61d1('0x6'))(server,{'transports':[_0x61d1('0x7'),_0x61d1('0x8')]});config['redis']=_[_0x61d1('0x9')](config[_0x61d1('0xa')],{'host':'localhost','port':0x18eb});socketio[_0x61d1('0xb')](require(_0x61d1('0xc'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config['redis'])}));require('../../config/triggers')['default']();require(_0x61d1('0xd'))[_0x61d1('0xe')](socketio);require('../../config/express')[_0x61d1('0xe')](app);require(_0x61d1('0xf'))['default'](app);}else{server['once']('listening',function(){console[_0x61d1('0x10')](_0x61d1('0x11'),config[_0x61d1('0x5')]);});}exports=module['exports']=app; \ No newline at end of file +var _0x816c=['once','listening','Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','socket.io','polling','redis','defaults','localhost','socket.io-redis','../../config/triggers','../../config/socketio','default','../../config/express'];(function(_0x1bd3ab,_0x352c42){var _0x37e394=function(_0x2f581d){while(--_0x2f581d){_0x1bd3ab['push'](_0x1bd3ab['shift']());}};_0x37e394(++_0x352c42);}(_0x816c,0xc5));var _0xc816=function(_0x1258ac,_0x9f8430){_0x1258ac=_0x1258ac-0x0;var _0x5d71dc=_0x816c[_0x1258ac];return _0x5d71dc;};'use strict';var _=require(_0xc816('0x0'));var http=require(_0xc816('0x1'));var express=require(_0xc816('0x2'));var sticky=require(_0xc816('0x3'));var Redis=require(_0xc816('0x4'));var config=require(_0xc816('0x5'));var app=express();var server=http[_0xc816('0x6')](app);server[_0xc816('0x7')]=0xdbba0;if(sticky[_0xc816('0x8')](server,config['port'])){var socketio=require(_0xc816('0x9'))(server,{'transports':['websocket',_0xc816('0xa')]});config[_0xc816('0xb')]=_[_0xc816('0xc')](config[_0xc816('0xb')],{'host':_0xc816('0xd'),'port':0x18eb});socketio['adapter'](require(_0xc816('0xe'))({'pubClient':new Redis(config[_0xc816('0xb')]),'subClient':new Redis(config['redis'])}));require(_0xc816('0xf'))['default']();require(_0xc816('0x10'))[_0xc816('0x11')](socketio);require(_0xc816('0x12'))['default'](app);require('../../routes')[_0xc816('0x11')](app);}else{server[_0xc816('0x13')](_0xc816('0x14'),function(){console['log'](_0xc816('0x15'),config[_0xc816('0x16')]);});}exports=module[_0xc816('0x17')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index dbc873e..1a1623a 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 _0xf972=['then','error','rpc','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request'];(function(_0x519401,_0x3c39ab){var _0x11e911=function(_0x499072){while(--_0x499072){_0x519401['push'](_0x519401['shift']());}};_0x11e911(++_0x3c39ab);}(_0xf972,0x70));var _0x2f97=function(_0x5b83a8,_0x8555ce){_0x5b83a8=_0x5b83a8-0x0;var _0x539a25=_0xf972[_0x5b83a8];return _0x539a25;};'use strict';var jayson=require(_0x2f97('0x0'));var BPromise=require(_0x2f97('0x1'));var logger=require(_0x2f97('0x2'))(_0x2f97('0x3'));var client=jayson[_0x2f97('0x4')][_0x2f97('0x5')]({'port':0x2329});client[_0x2f97('0x6')]=function(_0x51682a,_0x3e8675){return new BPromise(function(_0x189ba0,_0x2d167e){return client[_0x2f97('0x7')](_0x51682a,_0x3e8675)[_0x2f97('0x8')](function(_0x4a8ea4){logger['debug']('rpc',_0x2f97('0x3'),_0x51682a,_0x3e8675,_0x4a8ea4);if(_0x4a8ea4[_0x2f97('0x9')]){logger[_0x2f97('0x9')](_0x2f97('0xa'),_0x2f97('0x3'),_0x51682a,_0x4a8ea4[_0x2f97('0x9')]['message'],_0x3e8675);return _0x2d167e(_0x4a8ea4[_0x2f97('0x9')][_0x2f97('0xb')]);}else{return _0x189ba0(_0x4a8ea4[_0x2f97('0xc')]);}})[_0x2f97('0xd')](function(_0x3fdd18){logger[_0x2f97('0x9')](_0x2f97('0xa'),_0x2f97('0x3'),_0x51682a,_0x3fdd18,_0x3e8675);return _0x2d167e(_0x3fdd18);});});};module[_0x2f97('0xe')]=client; \ No newline at end of file +var _0x791a=['jayson/promise','routing','client','http','request','debug','rpc','error','message','result','catch'];(function(_0x49201a,_0x11df17){var _0x3976b9=function(_0x9db230){while(--_0x9db230){_0x49201a['push'](_0x49201a['shift']());}};_0x3976b9(++_0x11df17);}(_0x791a,0x11e));var _0xa791=function(_0x46675e,_0x487052){_0x46675e=_0x46675e-0x0;var _0x30547f=_0x791a[_0x46675e];return _0x30547f;};'use strict';var jayson=require(_0xa791('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')(_0xa791('0x1'));var client=jayson[_0xa791('0x2')][_0xa791('0x3')]({'port':0x2329});client['Request']=function(_0x32a159,_0x4db8a2){return new BPromise(function(_0x21263f,_0x4eda83){return client[_0xa791('0x4')](_0x32a159,_0x4db8a2)['then'](function(_0x2ae928){logger[_0xa791('0x5')](_0xa791('0x6'),'routing',_0x32a159,_0x4db8a2,_0x2ae928);if(_0x2ae928[_0xa791('0x7')]){logger['error']('rpc',_0xa791('0x1'),_0x32a159,_0x2ae928['error'][_0xa791('0x8')],_0x4db8a2);return _0x4eda83(_0x2ae928[_0xa791('0x7')]['message']);}else{return _0x21263f(_0x2ae928[_0xa791('0x9')]);}})[_0xa791('0xa')](function(_0x5c8f4d){logger['error'](_0xa791('0x6'),_0xa791('0x1'),_0x32a159,_0x5c8f4d,_0x4db8a2);return _0x4eda83(_0x5c8f4d);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 8a0b1d8..aae82a8 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 _0x3bfd=['getChatQueues','initChatQueues','getSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','catch','log','bluebird','./server','./realtime','./rpc/interval','./rpc/chatQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','initAgents','getIntervals','initIntervals','getOpenchannelQueues'];(function(_0x374bbb,_0x1a2762){var _0x15a2a7=function(_0xf25592){while(--_0xf25592){_0x374bbb['push'](_0x374bbb['shift']());}};_0x15a2a7(++_0x1a2762);}(_0x3bfd,0x137));var _0xd3bf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3bfd[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0xd3bf('0x0'));var server=require(_0xd3bf('0x1'));var Realtime=require(_0xd3bf('0x2'));var user=require('./rpc/user');var interval=require(_0xd3bf('0x3'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0xd3bf('0x4'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0xd3bf('0x5'));var faxQueue=require(_0xd3bf('0x6'));var whatsappQueue=require(_0xd3bf('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xd3bf('0x8')]()['then'](user['getAgents']())[_0xd3bf('0x9')](realtime[_0xd3bf('0xa')]())[_0xd3bf('0x9')](interval[_0xd3bf('0xb')]())['then'](realtime[_0xd3bf('0xc')]())['then'](openchannelQueue[_0xd3bf('0xd')]())[_0xd3bf('0x9')](realtime['initOpenchannelQueues']())[_0xd3bf('0x9')](chatQueue[_0xd3bf('0xe')]())[_0xd3bf('0x9')](realtime[_0xd3bf('0xf')]())[_0xd3bf('0x9')](smsQueue[_0xd3bf('0x10')]())[_0xd3bf('0x9')](realtime['initSmsQueues']())[_0xd3bf('0x9')](mailQueue[_0xd3bf('0x11')]())[_0xd3bf('0x9')](realtime[_0xd3bf('0x12')]())[_0xd3bf('0x9')](faxQueue[_0xd3bf('0x13')]())['then'](realtime[_0xd3bf('0x14')]())[_0xd3bf('0x9')](whatsappQueue[_0xd3bf('0x15')]())[_0xd3bf('0x9')](realtime[_0xd3bf('0x16')]())[_0xd3bf('0x9')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0xd3bf('0x9')](function(_0x30a1bd){return initRealtime();})['then'](function(_0x5c0a37){return setInterval(initRealtime,0x1388);})[_0xd3bf('0x17')](function(_0x4d2301){console[_0xd3bf('0x18')](_0x4d2301);});}main(); \ No newline at end of file +var _0x9f25=['getAgents','getIntervals','initIntervals','initChatQueues','initSmsQueues','initMailQueues','getFaxQueues','getWhatsappQueues','initWhatsappQueues','catch','log','./server','./realtime','./rpc/user','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/mailQueue','./rpc/faxQueue','resolve','then'];(function(_0x360d4b,_0x59af98){var _0x3e546e=function(_0x571935){while(--_0x571935){_0x360d4b['push'](_0x360d4b['shift']());}};_0x3e546e(++_0x59af98);}(_0x9f25,0x1eb));var _0x59f2=function(_0x5b5199,_0x58a8e5){_0x5b5199=_0x5b5199-0x0;var _0x2f5736=_0x9f25[_0x5b5199];return _0x2f5736;};'use strict';var BPromise=require('bluebird');var server=require(_0x59f2('0x0'));var Realtime=require(_0x59f2('0x1'));var user=require(_0x59f2('0x2'));var interval=require('./rpc/interval');var openchannelQueue=require(_0x59f2('0x3'));var chatQueue=require(_0x59f2('0x4'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x59f2('0x5'));var faxQueue=require(_0x59f2('0x6'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x59f2('0x7')]()[_0x59f2('0x8')](user[_0x59f2('0x9')]())['then'](realtime['initAgents']())[_0x59f2('0x8')](interval[_0x59f2('0xa')]())[_0x59f2('0x8')](realtime[_0x59f2('0xb')]())['then'](openchannelQueue['getOpenchannelQueues']())['then'](realtime['initOpenchannelQueues']())[_0x59f2('0x8')](chatQueue['getChatQueues']())[_0x59f2('0x8')](realtime[_0x59f2('0xc')]())['then'](smsQueue['getSmsQueues']())[_0x59f2('0x8')](realtime[_0x59f2('0xd')]())['then'](mailQueue['getMailQueues']())['then'](realtime[_0x59f2('0xe')]())[_0x59f2('0x8')](faxQueue[_0x59f2('0xf')]())[_0x59f2('0x8')](realtime['initFaxQueues']())[_0x59f2('0x8')](whatsappQueue[_0x59f2('0x10')]())[_0x59f2('0x8')](realtime[_0x59f2('0x11')]())['then'](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x59f2('0x8')](function(_0x8071e7){return initRealtime();})['then'](function(_0x4d9425){return setInterval(initRealtime,0x1388);})[_0x59f2('0x12')](function(_0x5ce948){console[_0x59f2('0x13')](_0x5ce948);});}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 94911cf..1b9a3af 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['turn','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','exports','lodash','util','events','isNil','register','ignoreFactChanges','inherits','init','rules','activeRules','concat','prototype','sync','filter','orderBy','asc','execute','clone','consequence','ruleRef','name','index_','nextTick','push','call','isEqual','restart','length','condition','matchPath','noop','findRules'];(function(_0x4aa9e3,_0x3c72bc){var _0x37cb3b=function(_0x30dcf3){while(--_0x30dcf3){_0x4aa9e3['push'](_0x4aa9e3['shift']());}};_0x37cb3b(++_0x3c72bc);}(_0x7a54,0x106));var _0x47a5=function(_0x2dff12,_0x3ab171){_0x2dff12=_0x2dff12-0x0;var _0x321b2a=_0x7a54[_0x2dff12];return _0x321b2a;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var EventEmitter=require(_0x47a5('0x2'))['EventEmitter'];function RuleEngine(_0x1d33e,_0x4086cd){this['init']();if(!_[_0x47a5('0x3')](_0x1d33e)){this[_0x47a5('0x4')](_0x1d33e);}if(_0x4086cd){this[_0x47a5('0x5')]=_0x4086cd[_0x47a5('0x5')];}return this;}util[_0x47a5('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x47a5('0x7')]=function(_0x59199c){this[_0x47a5('0x8')]=[];this[_0x47a5('0x9')]=[];};RuleEngine['prototype'][_0x47a5('0x4')]=function(_0x5077f3){if(Array['isArray'](_0x5077f3)){this['rules']=this[_0x47a5('0x8')][_0x47a5('0xa')](_0x5077f3);}else if(_0x5077f3!==null&&_['isObject'](_0x5077f3)){this[_0x47a5('0x8')]['push'](_0x5077f3);}this['sync']();};RuleEngine[_0x47a5('0xb')][_0x47a5('0xc')]=function(){this[_0x47a5('0x9')]=this[_0x47a5('0x8')][_0x47a5('0xd')](function(_0xd308b8){if(_[_0x47a5('0x3')](_0xd308b8['on'])){_0xd308b8['on']=!![];}if(_0xd308b8['on']===!![]){return _0xd308b8;}});this['activeRules']=_[_0x47a5('0xe')](this[_0x47a5('0x9')],['p'],[_0x47a5('0xf')]);};RuleEngine[_0x47a5('0xb')][_0x47a5('0x10')]=function(_0x620ee9,_0x3c6c46){var _0x190faa=![];_0x620ee9['result']=!![];var _0x362359=_[_0x47a5('0x11')](_0x620ee9);var _0x3b001e=_[_0x47a5('0x11')](_0x620ee9);var _0x1ef44c=this['activeRules'];var _0x549de3=[];var _0x138bc0=this['ignoreFactChanges'];(function FnRuleLoop(_0x5247fd){var _0x423a81={'rules':function(){return _0x1ef44c;},'rule':function(){return _0x1ef44c[_0x5247fd];},'when':function(_0xaf70a6){if(_0xaf70a6){var _0x2ce454=_0x1ef44c[_0x5247fd][_0x47a5('0x12')];_0x2ce454[_0x47a5('0x13')]=_0x1ef44c[_0x5247fd]['id']||_0x1ef44c[_0x5247fd][_0x47a5('0x14')]||_0x47a5('0x15')+_0x5247fd;process[_0x47a5('0x16')](function(){_0x549de3[_0x47a5('0x17')](_0x2ce454['ruleRef']);_0x2ce454[_0x47a5('0x18')](_0x362359,_0x423a81);});}else{process[_0x47a5('0x16')](function(){_0x423a81['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190faa=!![];return FnRuleLoop(0x0);},'next':function(_0x2b0360){if(!_0x138bc0&&!_[_0x47a5('0x19')](_0x3b001e,_0x362359)){_0x3b001e=_[_0x47a5('0x11')](_0x362359);process['nextTick'](function(){_0x423a81[_0x47a5('0x1a')]();});}else{process[_0x47a5('0x16')](function(){if(_[_0x47a5('0x3')](_0x2b0360)){return FnRuleLoop(_0x5247fd+0x1);}else{return FnRuleLoop(_0x2b0360);}});}}};if(_0x5247fd<_0x1ef44c[_0x47a5('0x1b')]&&_0x190faa===![]){var _0x5ef1b1=_0x1ef44c[_0x5247fd][_0x47a5('0x1c')];_0x5ef1b1[_0x47a5('0x18')](_0x362359,_0x423a81);}else{process['nextTick'](function(){_0x362359[_0x47a5('0x1d')]=_0x549de3;return _0x3c6c46?_0x3c6c46(_0x362359):_[_0x47a5('0x1e')]();});}}(0x0));};RuleEngine[_0x47a5('0xb')][_0x47a5('0x1f')]=function(_0x3abd6a){if(_['isNil'](_0x3abd6a)){return this['rules'];}else{var _0x136745=_['matches'](_0x3abd6a);return _[_0x47a5('0xd')](this['rules'],_0x136745);}};RuleEngine[_0x47a5('0xb')][_0x47a5('0x20')]=function(_0x36ad34,_0x1dac65){var _0x21f296=_0x36ad34==='on'||_0x36ad34==='ON'?!![]:![];var _0x3ba0b7=this[_0x47a5('0x1f')](_0x1dac65);for(var _0x136b14=0x0,_0x16631f=_0x3ba0b7[_0x47a5('0x1b')];_0x136b14<_0x16631f;_0x136b14+=0x1){_0x3ba0b7[_0x136b14]['on']=_0x21f296;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x21')]=function(_0x528582,_0x243210){_0x528582=parseInt(_0x528582,0xa);var _0x51833b=this[_0x47a5('0x1f')](_0x243210);for(var _0x9ac908=0x0,_0x16901f=_0x51833b['length'];_0x9ac908<_0x16901f;_0x9ac908+=0x1){_0x51833b[_0x9ac908][_0x47a5('0x22')]=_0x528582;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x23')]=function(){var _0x51cc81=this['rules'];if(_0x51cc81 instanceof Array){_0x51cc81=_0x51cc81[_0x47a5('0x24')](function(_0xfb5ddb){_0xfb5ddb['condition']=_0xfb5ddb['condition'][_0x47a5('0x25')]();_0xfb5ddb[_0x47a5('0x12')]=_0xfb5ddb['consequence'][_0x47a5('0x25')]();return _0xfb5ddb;});}else if(!_['isNil'](_0x51cc81)){_0x51cc81[_0x47a5('0x1c')]=_0x51cc81[_0x47a5('0x1c')]['toString']();_0x51cc81['consequence']=_0x51cc81[_0x47a5('0x12')]['toString']();}return _0x51cc81;};RuleEngine[_0x47a5('0xb')][_0x47a5('0x26')]=function(_0xf269a8){this['init']();if(_[_0x47a5('0x27')](_0xf269a8)){_0xf269a8=JSON['parse'](_0xf269a8);}if(_0xf269a8 instanceof Array){_0xf269a8=_0xf269a8['map'](function(_0x65542e){_0x65542e['condition']=eval('('+_0x65542e[_0x47a5('0x1c')]+')');_0x65542e['consequence']=eval('('+_0x65542e[_0x47a5('0x12')]+')');return _0x65542e;});}else if(_0xf269a8!==null&&typeof _0xf269a8==_0x47a5('0x28')){_0xf269a8[_0x47a5('0x1c')]=eval('('+_0xf269a8[_0x47a5('0x1c')]+')');_0xf269a8[_0x47a5('0x12')]=eval('('+_0xf269a8[_0x47a5('0x12')]+')');}this[_0x47a5('0x4')](_0xf269a8);};module[_0x47a5('0x29')]=RuleEngine; \ No newline at end of file +var _0x7a54=['turn','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','exports','lodash','util','events','isNil','register','ignoreFactChanges','inherits','init','rules','activeRules','concat','prototype','sync','filter','orderBy','asc','execute','clone','consequence','ruleRef','name','index_','nextTick','push','call','isEqual','restart','length','condition','matchPath','noop','findRules'];(function(_0x5024b0,_0x3d9706){var _0x11e8f0=function(_0x54ad7d){while(--_0x54ad7d){_0x5024b0['push'](_0x5024b0['shift']());}};_0x11e8f0(++_0x3d9706);}(_0x7a54,0x106));var _0x47a5=function(_0x521786,_0x483784){_0x521786=_0x521786-0x0;var _0x250536=_0x7a54[_0x521786];return _0x250536;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var EventEmitter=require(_0x47a5('0x2'))['EventEmitter'];function RuleEngine(_0x1d33e,_0x4086cd){this['init']();if(!_[_0x47a5('0x3')](_0x1d33e)){this[_0x47a5('0x4')](_0x1d33e);}if(_0x4086cd){this[_0x47a5('0x5')]=_0x4086cd[_0x47a5('0x5')];}return this;}util[_0x47a5('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x47a5('0x7')]=function(_0x59199c){this[_0x47a5('0x8')]=[];this[_0x47a5('0x9')]=[];};RuleEngine['prototype'][_0x47a5('0x4')]=function(_0x5077f3){if(Array['isArray'](_0x5077f3)){this['rules']=this[_0x47a5('0x8')][_0x47a5('0xa')](_0x5077f3);}else if(_0x5077f3!==null&&_['isObject'](_0x5077f3)){this[_0x47a5('0x8')]['push'](_0x5077f3);}this['sync']();};RuleEngine[_0x47a5('0xb')][_0x47a5('0xc')]=function(){this[_0x47a5('0x9')]=this[_0x47a5('0x8')][_0x47a5('0xd')](function(_0xd308b8){if(_[_0x47a5('0x3')](_0xd308b8['on'])){_0xd308b8['on']=!![];}if(_0xd308b8['on']===!![]){return _0xd308b8;}});this['activeRules']=_[_0x47a5('0xe')](this[_0x47a5('0x9')],['p'],[_0x47a5('0xf')]);};RuleEngine[_0x47a5('0xb')][_0x47a5('0x10')]=function(_0x620ee9,_0x3c6c46){var _0x190faa=![];_0x620ee9['result']=!![];var _0x362359=_[_0x47a5('0x11')](_0x620ee9);var _0x3b001e=_[_0x47a5('0x11')](_0x620ee9);var _0x1ef44c=this['activeRules'];var _0x549de3=[];var _0x138bc0=this['ignoreFactChanges'];(function FnRuleLoop(_0x5247fd){var _0x423a81={'rules':function(){return _0x1ef44c;},'rule':function(){return _0x1ef44c[_0x5247fd];},'when':function(_0xaf70a6){if(_0xaf70a6){var _0x2ce454=_0x1ef44c[_0x5247fd][_0x47a5('0x12')];_0x2ce454[_0x47a5('0x13')]=_0x1ef44c[_0x5247fd]['id']||_0x1ef44c[_0x5247fd][_0x47a5('0x14')]||_0x47a5('0x15')+_0x5247fd;process[_0x47a5('0x16')](function(){_0x549de3[_0x47a5('0x17')](_0x2ce454['ruleRef']);_0x2ce454[_0x47a5('0x18')](_0x362359,_0x423a81);});}else{process[_0x47a5('0x16')](function(){_0x423a81['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190faa=!![];return FnRuleLoop(0x0);},'next':function(_0x2b0360){if(!_0x138bc0&&!_[_0x47a5('0x19')](_0x3b001e,_0x362359)){_0x3b001e=_[_0x47a5('0x11')](_0x362359);process['nextTick'](function(){_0x423a81[_0x47a5('0x1a')]();});}else{process[_0x47a5('0x16')](function(){if(_[_0x47a5('0x3')](_0x2b0360)){return FnRuleLoop(_0x5247fd+0x1);}else{return FnRuleLoop(_0x2b0360);}});}}};if(_0x5247fd<_0x1ef44c[_0x47a5('0x1b')]&&_0x190faa===![]){var _0x5ef1b1=_0x1ef44c[_0x5247fd][_0x47a5('0x1c')];_0x5ef1b1[_0x47a5('0x18')](_0x362359,_0x423a81);}else{process['nextTick'](function(){_0x362359[_0x47a5('0x1d')]=_0x549de3;return _0x3c6c46?_0x3c6c46(_0x362359):_[_0x47a5('0x1e')]();});}}(0x0));};RuleEngine[_0x47a5('0xb')][_0x47a5('0x1f')]=function(_0x3abd6a){if(_['isNil'](_0x3abd6a)){return this['rules'];}else{var _0x136745=_['matches'](_0x3abd6a);return _[_0x47a5('0xd')](this['rules'],_0x136745);}};RuleEngine[_0x47a5('0xb')][_0x47a5('0x20')]=function(_0x36ad34,_0x1dac65){var _0x21f296=_0x36ad34==='on'||_0x36ad34==='ON'?!![]:![];var _0x3ba0b7=this[_0x47a5('0x1f')](_0x1dac65);for(var _0x136b14=0x0,_0x16631f=_0x3ba0b7[_0x47a5('0x1b')];_0x136b14<_0x16631f;_0x136b14+=0x1){_0x3ba0b7[_0x136b14]['on']=_0x21f296;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x21')]=function(_0x528582,_0x243210){_0x528582=parseInt(_0x528582,0xa);var _0x51833b=this[_0x47a5('0x1f')](_0x243210);for(var _0x9ac908=0x0,_0x16901f=_0x51833b['length'];_0x9ac908<_0x16901f;_0x9ac908+=0x1){_0x51833b[_0x9ac908][_0x47a5('0x22')]=_0x528582;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x23')]=function(){var _0x51cc81=this['rules'];if(_0x51cc81 instanceof Array){_0x51cc81=_0x51cc81[_0x47a5('0x24')](function(_0xfb5ddb){_0xfb5ddb['condition']=_0xfb5ddb['condition'][_0x47a5('0x25')]();_0xfb5ddb[_0x47a5('0x12')]=_0xfb5ddb['consequence'][_0x47a5('0x25')]();return _0xfb5ddb;});}else if(!_['isNil'](_0x51cc81)){_0x51cc81[_0x47a5('0x1c')]=_0x51cc81[_0x47a5('0x1c')]['toString']();_0x51cc81['consequence']=_0x51cc81[_0x47a5('0x12')]['toString']();}return _0x51cc81;};RuleEngine[_0x47a5('0xb')][_0x47a5('0x26')]=function(_0xf269a8){this['init']();if(_[_0x47a5('0x27')](_0xf269a8)){_0xf269a8=JSON['parse'](_0xf269a8);}if(_0xf269a8 instanceof Array){_0xf269a8=_0xf269a8['map'](function(_0x65542e){_0x65542e['condition']=eval('('+_0x65542e[_0x47a5('0x1c')]+')');_0x65542e['consequence']=eval('('+_0x65542e[_0x47a5('0x12')]+')');return _0x65542e;});}else if(_0xf269a8!==null&&typeof _0xf269a8==_0x47a5('0x28')){_0xf269a8[_0x47a5('0x1c')]=eval('('+_0xf269a8[_0x47a5('0x1c')]+')');_0xf269a8[_0x47a5('0x12')]=eval('('+_0xf269a8[_0x47a5('0x12')]+')');}this[_0x47a5('0x4')](_0xf269a8);};module[_0x47a5('0x29')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 8250849..1106c6a 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 _0x8fd9=['http','request','then','error','message','catch','jayson/promise','client'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8fd9,0x1a6));var _0x98fd=function(_0x9e05d1,_0x3cef4a){_0x9e05d1=_0x9e05d1-0x0;var _0x4f7e97=_0x8fd9[_0x9e05d1];return _0x4f7e97;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x98fd('0x0'));var client=jayson[_0x98fd('0x1')][_0x98fd('0x2')]({'port':0x232b});function request(_0x37671b,_0x3f0fe6){return new BPromise(function(_0x436362,_0x2ae376){return client[_0x98fd('0x3')](_0x37671b,_0x3f0fe6)[_0x98fd('0x4')](function(_0x33598a){if(_0x33598a['error']){return _0x2ae376(_0x33598a[_0x98fd('0x5')][_0x98fd('0x6')]);}else{return _0x436362(_0x33598a['result']);}})[_0x98fd('0x7')](function(_0x4a1c7e){return _0x2ae376(_0x4a1c7e);});});}exports['sendMailMessage']=function(_0x2a16e3,_0x10565b){return request('SendMail',{'account':_0x2a16e3,'message':_0x10565b});}; \ No newline at end of file +var _0x01d1=['then','error','message','result','catch','SendMail','bluebird','http'];(function(_0x17820d,_0x4d3db0){var _0x28598c=function(_0x575aec){while(--_0x575aec){_0x17820d['push'](_0x17820d['shift']());}};_0x28598c(++_0x4d3db0);}(_0x01d1,0x13e));var _0x101d=function(_0x54a24b,_0x423b2b){_0x54a24b=_0x54a24b-0x0;var _0x3c8bec=_0x01d1[_0x54a24b];return _0x3c8bec;};'use strict';var BPromise=require(_0x101d('0x0'));var jayson=require('jayson/promise');var client=jayson['client'][_0x101d('0x1')]({'port':0x232b});function request(_0x380068,_0x4223dd){return new BPromise(function(_0x4da8ac,_0x57c21f){return client['request'](_0x380068,_0x4223dd)[_0x101d('0x2')](function(_0x4a7f68){if(_0x4a7f68[_0x101d('0x3')]){return _0x57c21f(_0x4a7f68[_0x101d('0x3')][_0x101d('0x4')]);}else{return _0x4da8ac(_0x4a7f68[_0x101d('0x5')]);}})[_0x101d('0x6')](function(_0x2d3c60){return _0x57c21f(_0x2d3c60);});});}exports['sendMailMessage']=function(_0x20f46e,_0x22e99a){return request(_0x101d('0x7'),{'account':_0x20f46e,'message':_0x22e99a});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 1cada03..1461ca2 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 _0x0e61=['smsCurrentCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCurrentCapacity','busy','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','prototype','mail','openchannel','fax','sms','whatsapp','Status','StatusTime','format','chatStatus','chatCapacity','whatsappStatusTime','openchannelCapacity','busyQueue','emit','user:save','exports','moment','md5','ioredis','defaults','redis','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatStatusTime','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x0e61,0xa6));var _0x10e6=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0x0e61[_0x102e37];return _0x35a07c;};'use strict';var _=require('lodash');var moment=require(_0x10e6('0x0'));var md5=require(_0x10e6('0x1'));var Redis=require(_0x10e6('0x2'));var config=require('../../../config/environment');config['redis']=_[_0x10e6('0x3')](config[_0x10e6('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x10e6('0x5'))(new Redis(config[_0x10e6('0x4')]));function Agent(_0x3a303e){this['id']=_0x3a303e['id']||0x0;this[_0x10e6('0x6')]=_0x3a303e[_0x10e6('0x6')]||'';this[_0x10e6('0x7')]=_0x3a303e[_0x10e6('0x7')]||!![];this[_0x10e6('0x8')]=_0x3a303e[_0x10e6('0x8')]||![];this[_0x10e6('0x9')]=_0x3a303e[_0x10e6('0x9')]||![];this[_0x10e6('0xa')]=_0x3a303e[_0x10e6('0xa')]||![];this[_0x10e6('0xb')]=_0x3a303e[_0x10e6('0xb')]||![];this['smsPause']=_0x3a303e[_0x10e6('0xc')]||![];this['openchannelPause']=_0x3a303e[_0x10e6('0xd')]||![];this['chatStatus']=_0x10e6('0xe');this[_0x10e6('0xf')]=0x0;this['chatCapacity']=_0x3a303e['chatCapacity']||0x0;this['chatCurrentCapacity']=0x0;this[_0x10e6('0x10')]=_0x10e6('0xe');this[_0x10e6('0x11')]=0x0;this[_0x10e6('0x12')]=_0x3a303e[_0x10e6('0x12')]||0x0;this[_0x10e6('0x13')]=0x0;this[_0x10e6('0x14')]=_0x10e6('0xe');this[_0x10e6('0x15')]=0x0;this[_0x10e6('0x16')]=_0x3a303e['faxCapacity']||0x0;this[_0x10e6('0x17')]=0x0;this['smsStatus']=_0x10e6('0xe');this[_0x10e6('0x18')]=0x0;this[_0x10e6('0x19')]=_0x3a303e[_0x10e6('0x19')]||0x0;this[_0x10e6('0x1a')]=0x0;this[_0x10e6('0x1b')]='unknown';this['whatsappStatusTime']=0x0;this[_0x10e6('0x1c')]=_0x3a303e[_0x10e6('0x1c')]||0x0;this[_0x10e6('0x1d')]=0x0;this[_0x10e6('0x1e')]=_0x10e6('0xe');this[_0x10e6('0x1f')]=0x0;this['openchannelCapacity']=_0x3a303e['openchannelCapacity']||0x0;this[_0x10e6('0x20')]=0x0;this[_0x10e6('0x21')]=![];this['busyQueue']=undefined;this[_0x10e6('0x1')]='';this[_0x10e6('0x22')]={};this[_0x10e6('0x23')]={};this[_0x10e6('0x24')]={};this[_0x10e6('0x25')]={};this[_0x10e6('0x26')]={};this[_0x10e6('0x27')]={};this[_0x10e6('0x28')]();}Agent['prototype'][_0x10e6('0x29')]=function(_0x5c0560){if(this[_0x5c0560+_0x10e6('0x2a')]>0x0){if(this[_0x5c0560+_0x10e6('0x2b')]>0x0&&this[_0x5c0560+_0x10e6('0x2a')]>=this[_0x5c0560+_0x10e6('0x2b')]){return _0x10e6('0x2c');}else{return _0x10e6('0x2d');}}else{return _0x10e6('0x2e');}};Agent[_0x10e6('0x2f')][_0x10e6('0x28')]=function(){var _0x4a4d7e=[_0x10e6('0x30'),'chat',_0x10e6('0x31'),_0x10e6('0x32'),_0x10e6('0x33'),_0x10e6('0x34')];for(var _0x3b5d80=0x0;_0x3b5d80<_0x4a4d7e['length'];_0x3b5d80+=0x1){var _0x1e1a73=this[_0x10e6('0x29')](_0x4a4d7e[_0x3b5d80]);if(this[_0x4a4d7e[_0x3b5d80]+_0x10e6('0x35')]!==_0x1e1a73){this[_0x4a4d7e[_0x3b5d80]+_0x10e6('0x36')]=_['toNumber'](moment()[_0x10e6('0x37')]('x'));}this[_0x4a4d7e[_0x3b5d80]+'Status']=_0x1e1a73;}var _0x1ffeae={'id':this['id'],'name':this[_0x10e6('0x6')],'online':this[_0x10e6('0x7')],'voicePause':this[_0x10e6('0x8')],'chatPause':this[_0x10e6('0x9')],'mailPause':this[_0x10e6('0xa')],'smsPause':this[_0x10e6('0xc')],'faxPause':this['faxPause'],'openchannelPause':this[_0x10e6('0xd')],'chatStatus':this[_0x10e6('0x38')],'chatStatusTime':this[_0x10e6('0xf')],'chatCapacity':this[_0x10e6('0x39')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x10e6('0x10')],'mailStatusTime':this[_0x10e6('0x11')],'mailCapacity':this[_0x10e6('0x12')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x10e6('0x14')],'faxStatusTime':this[_0x10e6('0x15')],'faxCapacity':this[_0x10e6('0x16')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this['smsStatus'],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x10e6('0x19')],'smsCurrentCapacity':this[_0x10e6('0x1a')],'whatsappStatus':this[_0x10e6('0x1b')],'whatsappStatusTime':this[_0x10e6('0x3a')],'whatsappCapacity':this[_0x10e6('0x1c')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x10e6('0x1e')],'openchannelStatusTime':this[_0x10e6('0x1f')],'openchannelCapacity':this[_0x10e6('0x3b')],'openchannelCurrentCapacity':this[_0x10e6('0x20')],'busy':this[_0x10e6('0x21')],'busyQueue':this[_0x10e6('0x3c')],'chatWaitingInteractions':this[_0x10e6('0x22')],'faxWaitingInteractions':this[_0x10e6('0x23')],'mailWaitingInteractions':this[_0x10e6('0x24')],'openchannelWaitingInteractions':this[_0x10e6('0x25')],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this[_0x10e6('0x27')]};var _0x494996=md5(JSON['stringify'](_0x1ffeae));if(this['md5']!==_0x494996){this[_0x10e6('0x1')]=_0x494996;io[_0x10e6('0x3d')](_0x10e6('0x3e'),_0x1ffeae);}};module[_0x10e6('0x3f')]=Agent; \ No newline at end of file +var _0xc8b3=['mail','chat','openchannel','sms','whatsapp','length','Status','StatusTime','toNumber','format','chatCapacity','busy','busyQueue','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','md5','emit','user:save','ioredis','../../../config/environment','redis','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','unknown','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','chatWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','idle','prototype','updateRealtime'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xc8b3,0x187));var _0x3c8b=function(_0x31c0e3,_0x3c5cd6){_0x31c0e3=_0x31c0e3-0x0;var _0xf34e31=_0xc8b3[_0x31c0e3];return _0xf34e31;};'use strict';var _=require('lodash');var moment=require('moment');var md5=require('md5');var Redis=require(_0x3c8b('0x0'));var config=require(_0x3c8b('0x1'));config[_0x3c8b('0x2')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3c8b('0x2')]));function Agent(_0x164011){this['id']=_0x164011['id']||0x0;this['name']=_0x164011[_0x3c8b('0x3')]||'';this['online']=_0x164011[_0x3c8b('0x4')]||!![];this[_0x3c8b('0x5')]=_0x164011[_0x3c8b('0x5')]||![];this[_0x3c8b('0x6')]=_0x164011[_0x3c8b('0x6')]||![];this['mailPause']=_0x164011[_0x3c8b('0x7')]||![];this[_0x3c8b('0x8')]=_0x164011[_0x3c8b('0x8')]||![];this[_0x3c8b('0x9')]=_0x164011[_0x3c8b('0x9')]||![];this[_0x3c8b('0xa')]=_0x164011[_0x3c8b('0xa')]||![];this[_0x3c8b('0xb')]='unknown';this[_0x3c8b('0xc')]=0x0;this['chatCapacity']=_0x164011['chatCapacity']||0x0;this[_0x3c8b('0xd')]=0x0;this[_0x3c8b('0xe')]='unknown';this[_0x3c8b('0xf')]=0x0;this[_0x3c8b('0x10')]=_0x164011[_0x3c8b('0x10')]||0x0;this[_0x3c8b('0x11')]=0x0;this[_0x3c8b('0x12')]=_0x3c8b('0x13');this[_0x3c8b('0x14')]=0x0;this[_0x3c8b('0x15')]=_0x164011[_0x3c8b('0x15')]||0x0;this[_0x3c8b('0x16')]=0x0;this[_0x3c8b('0x17')]=_0x3c8b('0x13');this['smsStatusTime']=0x0;this[_0x3c8b('0x18')]=_0x164011['smsCapacity']||0x0;this[_0x3c8b('0x19')]=0x0;this[_0x3c8b('0x1a')]=_0x3c8b('0x13');this[_0x3c8b('0x1b')]=0x0;this[_0x3c8b('0x1c')]=_0x164011[_0x3c8b('0x1c')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x3c8b('0x1d')]='unknown';this[_0x3c8b('0x1e')]=0x0;this[_0x3c8b('0x1f')]=_0x164011[_0x3c8b('0x1f')]||0x0;this[_0x3c8b('0x20')]=0x0;this['busy']=![];this['busyQueue']=undefined;this['md5']='';this[_0x3c8b('0x21')]={};this['faxWaitingInteractions']={};this['mailWaitingInteractions']={};this['openchannelWaitingInteractions']={};this[_0x3c8b('0x22')]={};this[_0x3c8b('0x23')]={};this['updateRealtime']();}Agent['prototype'][_0x3c8b('0x24')]=function(_0x37d640){if(this[_0x37d640+_0x3c8b('0x25')]>0x0){if(this[_0x37d640+_0x3c8b('0x26')]>0x0&&this[_0x37d640+_0x3c8b('0x25')]>=this[_0x37d640+_0x3c8b('0x26')]){return _0x3c8b('0x27');}else{return'working';}}else{return _0x3c8b('0x28');}};Agent[_0x3c8b('0x29')][_0x3c8b('0x2a')]=function(){var _0x173aa3=[_0x3c8b('0x2b'),_0x3c8b('0x2c'),_0x3c8b('0x2d'),'fax',_0x3c8b('0x2e'),_0x3c8b('0x2f')];for(var _0x220a86=0x0;_0x220a86<_0x173aa3[_0x3c8b('0x30')];_0x220a86+=0x1){var _0x6028b1=this[_0x3c8b('0x24')](_0x173aa3[_0x220a86]);if(this[_0x173aa3[_0x220a86]+_0x3c8b('0x31')]!==_0x6028b1){this[_0x173aa3[_0x220a86]+_0x3c8b('0x32')]=_[_0x3c8b('0x33')](moment()[_0x3c8b('0x34')]('x'));}this[_0x173aa3[_0x220a86]+_0x3c8b('0x31')]=_0x6028b1;}var _0x2dac29={'id':this['id'],'name':this[_0x3c8b('0x3')],'online':this[_0x3c8b('0x4')],'voicePause':this[_0x3c8b('0x5')],'chatPause':this['chatPause'],'mailPause':this[_0x3c8b('0x7')],'smsPause':this[_0x3c8b('0x9')],'faxPause':this[_0x3c8b('0x8')],'openchannelPause':this[_0x3c8b('0xa')],'chatStatus':this[_0x3c8b('0xb')],'chatStatusTime':this[_0x3c8b('0xc')],'chatCapacity':this[_0x3c8b('0x35')],'chatCurrentCapacity':this[_0x3c8b('0xd')],'mailStatus':this[_0x3c8b('0xe')],'mailStatusTime':this[_0x3c8b('0xf')],'mailCapacity':this[_0x3c8b('0x10')],'mailCurrentCapacity':this[_0x3c8b('0x11')],'faxStatus':this[_0x3c8b('0x12')],'faxStatusTime':this[_0x3c8b('0x14')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x3c8b('0x16')],'smsStatus':this[_0x3c8b('0x17')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x3c8b('0x18')],'smsCurrentCapacity':this[_0x3c8b('0x19')],'whatsappStatus':this[_0x3c8b('0x1a')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x3c8b('0x1c')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x3c8b('0x1d')],'openchannelStatusTime':this[_0x3c8b('0x1e')],'openchannelCapacity':this[_0x3c8b('0x1f')],'openchannelCurrentCapacity':this[_0x3c8b('0x20')],'busy':this[_0x3c8b('0x36')],'busyQueue':this[_0x3c8b('0x37')],'chatWaitingInteractions':this[_0x3c8b('0x21')],'faxWaitingInteractions':this[_0x3c8b('0x38')],'mailWaitingInteractions':this[_0x3c8b('0x39')],'openchannelWaitingInteractions':this[_0x3c8b('0x3a')],'smsWaitingInteractions':this[_0x3c8b('0x22')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x3cac33=md5(JSON['stringify'](_0x2dac29));if(this['md5']!==_0x3cac33){this[_0x3c8b('0x3b')]=_0x3cac33;io[_0x3c8b('0x3c')](_0x3c8b('0x3d'),_0x2dac29);}};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 a3a1aa3..7bc26d8 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 _0x7c9b=['defaults','localhost','socket.io-emitter','name','strategy','Agents','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','loggedIn','paused','length','online','available','waiting','stringify','format','chat:queue:%s','exports','lodash','md5','util','ioredis','../../../config/environment','redis'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x7c9b,0x18f));var _0xb7c9=function(_0x4fecb6,_0x45ed64){_0x4fecb6=_0x4fecb6-0x0;var _0xa9a47=_0x7c9b[_0x4fecb6];return _0xa9a47;};'use strict';var _=require(_0xb7c9('0x0'));var md5=require(_0xb7c9('0x1'));var util=require(_0xb7c9('0x2'));var Redis=require(_0xb7c9('0x3'));var config=require(_0xb7c9('0x4'));config[_0xb7c9('0x5')]=_[_0xb7c9('0x6')](config['redis'],{'host':_0xb7c9('0x7'),'port':0x18eb});var io=require(_0xb7c9('0x8'))(new Redis(config[_0xb7c9('0x5')]));function ChatQueue(_0x2a4be4){this['id']=_0x2a4be4['id']||0x0;this['name']=_0x2a4be4[_0xb7c9('0x9')]||'';this['timeout']=_0x2a4be4['timeout']||0xa;this['strategy']=_0x2a4be4[_0xb7c9('0xa')]||'beepall';this[_0xb7c9('0xb')]=_0x2a4be4[_0xb7c9('0xb')];this['mapAgentsId']={};this['waiting']=0x0;this[_0xb7c9('0x1')]='';this[_0xb7c9('0xc')]();this[_0xb7c9('0xd')]();}ChatQueue[_0xb7c9('0xe')][_0xb7c9('0xc')]=function(){var _0x590605=this[_0xb7c9('0xf')][_0xb7c9('0x10')];this[_0xb7c9('0xf')]=_['map'](this[_0xb7c9('0xb')],'id');this[_0xb7c9('0xf')]['_rr']=_0x590605;};ChatQueue['prototype'][_0xb7c9('0xd')]=function(){this[_0xb7c9('0x11')]=0x0;this[_0xb7c9('0x12')]=0x0;for(var _0x4049f3=0x0;_0x4049f3=0x0?this[_0xb7c9('0x15')]:0x0;var _0x59eeee={'id':this['id'],'available':this[_0xb7c9('0x15')],'loggedIn':this['loggedIn'],'name':this[_0xb7c9('0x9')],'paused':this[_0xb7c9('0x12')],'waiting':this[_0xb7c9('0x16')]};var _0x29da1b=md5(JSON[_0xb7c9('0x17')](_0x59eeee));if(this[_0xb7c9('0x1')]!==_0x29da1b){this['md5']=_0x29da1b;io['to'](util[_0xb7c9('0x18')](_0xb7c9('0x19'),_0x59eeee[_0xb7c9('0x9')]))['emit']('chat_queue:save',_0x59eeee);}};module[_0xb7c9('0x1a')]=ChatQueue; \ No newline at end of file +var _0x484e=['paused','available','waiting','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','length','online','loggedIn','chatPause'];(function(_0x1d9dda,_0x19725c){var _0x20dbf0=function(_0x19cacc){while(--_0x19cacc){_0x1d9dda['push'](_0x1d9dda['shift']());}};_0x20dbf0(++_0x19725c);}(_0x484e,0x11f));var _0xe484=function(_0x48c9e3,_0x36125d){_0x48c9e3=_0x48c9e3-0x0;var _0x17a0af=_0x484e[_0x48c9e3];return _0x17a0af;};'use strict';var _=require(_0xe484('0x0'));var md5=require(_0xe484('0x1'));var util=require(_0xe484('0x2'));var Redis=require(_0xe484('0x3'));var config=require(_0xe484('0x4'));config[_0xe484('0x5')]=_[_0xe484('0x6')](config[_0xe484('0x5')],{'host':_0xe484('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe484('0x5')]));function ChatQueue(_0x367f3a){this['id']=_0x367f3a['id']||0x0;this[_0xe484('0x8')]=_0x367f3a[_0xe484('0x8')]||'';this[_0xe484('0x9')]=_0x367f3a[_0xe484('0x9')]||0xa;this['strategy']=_0x367f3a[_0xe484('0xa')]||_0xe484('0xb');this['Agents']=_0x367f3a[_0xe484('0xc')];this[_0xe484('0xd')]={};this['waiting']=0x0;this[_0xe484('0x1')]='';this[_0xe484('0xe')]();this[_0xe484('0xf')]();}ChatQueue[_0xe484('0x10')][_0xe484('0xe')]=function(){var _0x8223c0=this[_0xe484('0xd')][_0xe484('0x11')];this['mapAgentsId']=_[_0xe484('0x12')](this[_0xe484('0xc')],'id');this[_0xe484('0xd')][_0xe484('0x11')]=_0x8223c0;};ChatQueue[_0xe484('0x10')][_0xe484('0xf')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x4065bc=0x0;_0x4065bc=0x0?this[_0xe484('0x18')]:0x0;var _0x492869={'id':this['id'],'available':this[_0xe484('0x18')],'loggedIn':this['loggedIn'],'name':this[_0xe484('0x8')],'paused':this[_0xe484('0x17')],'waiting':this[_0xe484('0x19')]};var _0x7b5061=md5(JSON['stringify'](_0x492869));if(this['md5']!==_0x7b5061){this[_0xe484('0x1')]=_0x7b5061;io['to'](util[_0xe484('0x1a')](_0xe484('0x1b'),_0x492869[_0xe484('0x8')]))[_0xe484('0x1c')](_0xe484('0x1d'),_0x492869);}};module[_0xe484('0x1e')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 4ad1140..9819c97 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 _0xd485=['paused','faxPause','available','name','waiting','stringify','format','emit','fax_queue:save','exports','lodash','md5','util','../../../config/environment','redis','localhost','timeout','strategy','Agents','mapAgentsId','updateRealtime','prototype','updateRouting','map','_rr','loggedIn'];(function(_0x3daa8c,_0x388a87){var _0x2b1bd7=function(_0xdb2963){while(--_0xdb2963){_0x3daa8c['push'](_0x3daa8c['shift']());}};_0x2b1bd7(++_0x388a87);}(_0xd485,0x72));var _0x5d48=function(_0x2edb10,_0x5c03d9){_0x2edb10=_0x2edb10-0x0;var _0x3a1b47=_0xd485[_0x2edb10];return _0x3a1b47;};'use strict';var _=require(_0x5d48('0x0'));var md5=require(_0x5d48('0x1'));var util=require(_0x5d48('0x2'));var Redis=require('ioredis');var config=require(_0x5d48('0x3'));config['redis']=_['defaults'](config[_0x5d48('0x4')],{'host':_0x5d48('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function FaxQueue(_0x585a0e){this['id']=_0x585a0e['id']||0x0;this['name']=_0x585a0e['name']||'';this['timeout']=_0x585a0e[_0x5d48('0x6')]||0xa;this[_0x5d48('0x7')]=_0x585a0e[_0x5d48('0x7')]||'beepall';this[_0x5d48('0x8')]=_0x585a0e['Agents'];this[_0x5d48('0x9')]={};this['waiting']=0x0;this['md5']='';this['updateRouting']();this[_0x5d48('0xa')]();}FaxQueue[_0x5d48('0xb')][_0x5d48('0xc')]=function(){var _0x163cb6=this[_0x5d48('0x9')]['_rr'];this['mapAgentsId']=_[_0x5d48('0xd')](this[_0x5d48('0x8')],'id');this[_0x5d48('0x9')][_0x5d48('0xe')]=_0x163cb6;};FaxQueue[_0x5d48('0xb')]['updateRealtime']=function(){this[_0x5d48('0xf')]=0x0;this[_0x5d48('0x10')]=0x0;for(var _0x2c10d8=0x0;_0x2c10d8=0x0?this[_0x5d48('0x12')]:0x0;var _0x1daa47={'id':this['id'],'available':this[_0x5d48('0x12')],'loggedIn':this['loggedIn'],'name':this[_0x5d48('0x13')],'paused':this[_0x5d48('0x10')],'waiting':this[_0x5d48('0x14')]};var _0xc051f9=md5(JSON[_0x5d48('0x15')](_0x1daa47));if(this['md5']!==_0xc051f9){this['md5']=_0xc051f9;io['to'](util[_0x5d48('0x16')]('fax:queue:%s',_0x1daa47[_0x5d48('0x13')]))[_0x5d48('0x17')](_0x5d48('0x18'),_0x1daa47);}};module[_0x5d48('0x19')]=FaxQueue; \ No newline at end of file +var _0x281e=['strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','map','prototype','loggedIn','paused','length','online','faxPause','available','stringify','md5','format','fax:queue:%s','emit','fax_queue:save','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout'];(function(_0x179e11,_0xf65436){var _0x549f04=function(_0x610545){while(--_0x610545){_0x179e11['push'](_0x179e11['shift']());}};_0x549f04(++_0xf65436);}(_0x281e,0xe7));var _0xe281=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x281e[_0x1e4360];return _0x31e6b4;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0xe281('0x0'));var Redis=require(_0xe281('0x1'));var config=require(_0xe281('0x2'));config[_0xe281('0x3')]=_[_0xe281('0x4')](config[_0xe281('0x3')],{'host':_0xe281('0x5'),'port':0x18eb});var io=require(_0xe281('0x6'))(new Redis(config['redis']));function FaxQueue(_0x4adfcf){this['id']=_0x4adfcf['id']||0x0;this[_0xe281('0x7')]=_0x4adfcf['name']||'';this[_0xe281('0x8')]=_0x4adfcf[_0xe281('0x8')]||0xa;this[_0xe281('0x9')]=_0x4adfcf[_0xe281('0x9')]||_0xe281('0xa');this[_0xe281('0xb')]=_0x4adfcf['Agents'];this[_0xe281('0xc')]={};this[_0xe281('0xd')]=0x0;this['md5']='';this[_0xe281('0xe')]();this['updateRealtime']();}FaxQueue['prototype'][_0xe281('0xe')]=function(){var _0x21c212=this[_0xe281('0xc')][_0xe281('0xf')];this[_0xe281('0xc')]=_[_0xe281('0x10')](this['Agents'],'id');this[_0xe281('0xc')][_0xe281('0xf')]=_0x21c212;};FaxQueue[_0xe281('0x11')]['updateRealtime']=function(){this[_0xe281('0x12')]=0x0;this[_0xe281('0x13')]=0x0;for(var _0x1d0adb=0x0;_0x1d0adb=0x0?this[_0xe281('0x17')]:0x0;var _0x4e1fb8={'id':this['id'],'available':this[_0xe281('0x17')],'loggedIn':this[_0xe281('0x12')],'name':this[_0xe281('0x7')],'paused':this['paused'],'waiting':this[_0xe281('0xd')]};var _0x31b6d8=md5(JSON[_0xe281('0x18')](_0x4e1fb8));if(this[_0xe281('0x19')]!==_0x31b6d8){this['md5']=_0x31b6d8;io['to'](util[_0xe281('0x1a')](_0xe281('0x1b'),_0x4e1fb8[_0xe281('0x7')]))[_0xe281('0x1c')](_0xe281('0x1d'),_0x4e1fb8);}};module['exports']=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index b072acd..a45146f 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 _0x5a02=['Intervals','exports','name'];(function(_0x17bab6,_0x423599){var _0x3b110d=function(_0x23842d){while(--_0x23842d){_0x17bab6['push'](_0x17bab6['shift']());}};_0x3b110d(++_0x423599);}(_0x5a02,0x8f));var _0x25a0=function(_0x348652,_0x1ab849){_0x348652=_0x348652-0x0;var _0x18a9ea=_0x5a02[_0x348652];return _0x18a9ea;};'use strict';function Interval(_0x523631){this['id']=_0x523631['id']||0x0;this[_0x25a0('0x0')]=_0x523631[_0x25a0('0x0')]||'';this[_0x25a0('0x1')]=_0x523631[_0x25a0('0x1')]||{};}module[_0x25a0('0x2')]=Interval; \ No newline at end of file +var _0x67a0=['exports','name','Intervals'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x67a0,0x175));var _0x067a=function(_0x540690,_0x2b098f){_0x540690=_0x540690-0x0;var _0x16eac6=_0x67a0[_0x540690];return _0x16eac6;};'use strict';function Interval(_0x287ef2){this['id']=_0x287ef2['id']||0x0;this[_0x067a('0x0')]=_0x287ef2['name']||'';this[_0x067a('0x1')]=_0x287ef2['Intervals']||{};}module[_0x067a('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index d0884e4..cb23479 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 _0xff21=['redis','localhost','socket.io-emitter','name','strategy','Agents','waiting','md5','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','online','mailPause','available','stringify','format','mail:queue:%s','emit','exports','lodash','util','../../../config/environment'];(function(_0x2407db,_0x1774f5){var _0x3df7c0=function(_0x399be2){while(--_0x399be2){_0x2407db['push'](_0x2407db['shift']());}};_0x3df7c0(++_0x1774f5);}(_0xff21,0x1ad));var _0x1ff2=function(_0xc25778,_0xf5d1f6){_0xc25778=_0xc25778-0x0;var _0x314223=_0xff21[_0xc25778];return _0x314223;};'use strict';var _=require(_0x1ff2('0x0'));var md5=require('md5');var util=require(_0x1ff2('0x1'));var Redis=require('ioredis');var config=require(_0x1ff2('0x2'));config[_0x1ff2('0x3')]=_['defaults'](config[_0x1ff2('0x3')],{'host':_0x1ff2('0x4'),'port':0x18eb});var io=require(_0x1ff2('0x5'))(new Redis(config['redis']));function MailQueue(_0x5eef41){this['id']=_0x5eef41['id']||0x0;this[_0x1ff2('0x6')]=_0x5eef41[_0x1ff2('0x6')]||'';this['timeout']=_0x5eef41['timeout']||0xa;this[_0x1ff2('0x7')]=_0x5eef41[_0x1ff2('0x7')]||'beepall';this['Agents']=_0x5eef41[_0x1ff2('0x8')];this['mapAgentsId']={};this[_0x1ff2('0x9')]=0x0;this[_0x1ff2('0xa')]='';this[_0x1ff2('0xb')]();this[_0x1ff2('0xc')]();}MailQueue[_0x1ff2('0xd')][_0x1ff2('0xb')]=function(){var _0x2cc32b=this[_0x1ff2('0xe')][_0x1ff2('0xf')];this[_0x1ff2('0xe')]=_[_0x1ff2('0x10')](this[_0x1ff2('0x8')],'id');this['mapAgentsId'][_0x1ff2('0xf')]=_0x2cc32b;};MailQueue['prototype'][_0x1ff2('0xc')]=function(){this[_0x1ff2('0x11')]=0x0;this[_0x1ff2('0x12')]=0x0;for(var _0x5a6563=0x0;_0x5a6563=0x0?this[_0x1ff2('0x15')]:0x0;var _0x4110c8={'id':this['id'],'available':this[_0x1ff2('0x15')],'loggedIn':this[_0x1ff2('0x11')],'name':this['name'],'paused':this[_0x1ff2('0x12')],'waiting':this[_0x1ff2('0x9')]};var _0x107133=md5(JSON[_0x1ff2('0x16')](_0x4110c8));if(this[_0x1ff2('0xa')]!==_0x107133){this[_0x1ff2('0xa')]=_0x107133;io['to'](util[_0x1ff2('0x17')](_0x1ff2('0x18'),_0x4110c8[_0x1ff2('0x6')]))[_0x1ff2('0x19')]('mail_queue:save',_0x4110c8);}};module[_0x1ff2('0x1a')]=MailQueue; \ No newline at end of file +var _0x27c0=['_rr','map','prototype','loggedIn','paused','Agents','length','available','waiting','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','ioredis','redis','socket.io-emitter','name','timeout','strategy','beepall','mapAgentsId','updateRouting','updateRealtime'];(function(_0x431f6f,_0x444a81){var _0xb32b82=function(_0x574114){while(--_0x574114){_0x431f6f['push'](_0x431f6f['shift']());}};_0xb32b82(++_0x444a81);}(_0x27c0,0x12b));var _0x027c=function(_0x5c783a,_0x11ce44){_0x5c783a=_0x5c783a-0x0;var _0x5094f1=_0x27c0[_0x5c783a];return _0x5094f1;};'use strict';var _=require(_0x027c('0x0'));var md5=require(_0x027c('0x1'));var util=require(_0x027c('0x2'));var Redis=require(_0x027c('0x3'));var config=require('../../../config/environment');config[_0x027c('0x4')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x027c('0x5'))(new Redis(config[_0x027c('0x4')]));function MailQueue(_0x3726fd){this['id']=_0x3726fd['id']||0x0;this[_0x027c('0x6')]=_0x3726fd['name']||'';this[_0x027c('0x7')]=_0x3726fd[_0x027c('0x7')]||0xa;this[_0x027c('0x8')]=_0x3726fd[_0x027c('0x8')]||_0x027c('0x9');this['Agents']=_0x3726fd['Agents'];this[_0x027c('0xa')]={};this['waiting']=0x0;this[_0x027c('0x1')]='';this[_0x027c('0xb')]();this[_0x027c('0xc')]();}MailQueue['prototype']['updateRouting']=function(){var _0x3977f6=this[_0x027c('0xa')][_0x027c('0xd')];this[_0x027c('0xa')]=_[_0x027c('0xe')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x3977f6;};MailQueue[_0x027c('0xf')][_0x027c('0xc')]=function(){this[_0x027c('0x10')]=0x0;this[_0x027c('0x11')]=0x0;for(var _0x4f1a35=0x0;_0x4f1a35=0x0?this[_0x027c('0x14')]:0x0;var _0x484640={'id':this['id'],'available':this[_0x027c('0x14')],'loggedIn':this['loggedIn'],'name':this[_0x027c('0x6')],'paused':this['paused'],'waiting':this[_0x027c('0x15')]};var _0x478ab0=md5(JSON['stringify'](_0x484640));if(this[_0x027c('0x1')]!==_0x478ab0){this['md5']=_0x478ab0;io['to'](util['format'](_0x027c('0x16'),_0x484640['name']))[_0x027c('0x17')](_0x027c('0x18'),_0x484640);}};module[_0x027c('0x19')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index c437e12..78cf3b1 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 _0x326f=['exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','md5','updateRouting','updateRealtime','Agents','prototype','loggedIn','paused','online','openchannelPause','available','stringify','openchannel:queue:%s','openchannel_queue:save'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x326f,0xd1));var _0xf326=function(_0x3ddbd7,_0x47b998){_0x3ddbd7=_0x3ddbd7-0x0;var _0x2d2fd9=_0x326f[_0x3ddbd7];return _0x2d2fd9;};'use strict';var _=require(_0xf326('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xf326('0x1'));var config=require(_0xf326('0x2'));config[_0xf326('0x3')]=_[_0xf326('0x4')](config[_0xf326('0x3')],{'host':_0xf326('0x5'),'port':0x18eb});var io=require(_0xf326('0x6'))(new Redis(config[_0xf326('0x3')]));function OpenchannelQueue(_0x1b5a56){this['id']=_0x1b5a56['id']||0x0;this[_0xf326('0x7')]=_0x1b5a56['name']||'';this[_0xf326('0x8')]=_0x1b5a56[_0xf326('0x8')]||0xa;this[_0xf326('0x9')]=_0x1b5a56[_0xf326('0x9')]||'beepall';this['Agents']=_0x1b5a56['Agents'];this[_0xf326('0xa')]={};this[_0xf326('0xb')]=0x0;this[_0xf326('0xc')]='';this[_0xf326('0xd')]();this[_0xf326('0xe')]();}OpenchannelQueue['prototype'][_0xf326('0xd')]=function(){var _0x53cbcd=this[_0xf326('0xa')]['_rr'];this[_0xf326('0xa')]=_['map'](this[_0xf326('0xf')],'id');this[_0xf326('0xa')]['_rr']=_0x53cbcd;};OpenchannelQueue[_0xf326('0x10')][_0xf326('0xe')]=function(){this[_0xf326('0x11')]=0x0;this[_0xf326('0x12')]=0x0;for(var _0x5c8483=0x0;_0x5c8483=0x0?this[_0xf326('0x15')]:0x0;var _0x18bee3={'id':this['id'],'available':this[_0xf326('0x15')],'loggedIn':this[_0xf326('0x11')],'name':this[_0xf326('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x56ad41=md5(JSON[_0xf326('0x16')](_0x18bee3));if(this[_0xf326('0xc')]!==_0x56ad41){this['md5']=_0x56ad41;io['to'](util['format'](_0xf326('0x17'),_0x18bee3['name']))['emit'](_0xf326('0x18'),_0x18bee3);}};module[_0xf326('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0x7a54=['exports','lodash','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','updateRealtime','mapAgentsId','_rr','map','Agents','prototype','loggedIn','paused','length','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x7a54,0x106));var _0x47a5=function(_0x128064,_0x11f5bc){_0x128064=_0x128064-0x0;var _0x254211=_0x7a54[_0x128064];return _0x254211;};'use strict';var _=require(_0x47a5('0x0'));var md5=require(_0x47a5('0x1'));var util=require(_0x47a5('0x2'));var Redis=require('ioredis');var config=require(_0x47a5('0x3'));config[_0x47a5('0x4')]=_['defaults'](config[_0x47a5('0x4')],{'host':_0x47a5('0x5'),'port':0x18eb});var io=require(_0x47a5('0x6'))(new Redis(config[_0x47a5('0x4')]));function OpenchannelQueue(_0xfdf934){this['id']=_0xfdf934['id']||0x0;this['name']=_0xfdf934[_0x47a5('0x7')]||'';this['timeout']=_0xfdf934[_0x47a5('0x8')]||0xa;this[_0x47a5('0x9')]=_0xfdf934['strategy']||_0x47a5('0xa');this['Agents']=_0xfdf934['Agents'];this['mapAgentsId']={};this[_0x47a5('0xb')]=0x0;this[_0x47a5('0x1')]='';this['updateRouting']();this[_0x47a5('0xc')]();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0x1f47f4=this[_0x47a5('0xd')][_0x47a5('0xe')];this[_0x47a5('0xd')]=_[_0x47a5('0xf')](this[_0x47a5('0x10')],'id');this[_0x47a5('0xd')]['_rr']=_0x1f47f4;};OpenchannelQueue[_0x47a5('0x11')][_0x47a5('0xc')]=function(){this[_0x47a5('0x12')]=0x0;this[_0x47a5('0x13')]=0x0;for(var _0x139f25=0x0;_0x139f25=0x0?this['available']:0x0;var _0x423a81={'id':this['id'],'available':this[_0x47a5('0x16')],'loggedIn':this[_0x47a5('0x12')],'name':this[_0x47a5('0x7')],'paused':this[_0x47a5('0x13')],'waiting':this[_0x47a5('0xb')]};var _0x2763d6=md5(JSON[_0x47a5('0x17')](_0x423a81));if(this[_0x47a5('0x1')]!==_0x2763d6){this['md5']=_0x2763d6;io['to'](util[_0x47a5('0x18')](_0x47a5('0x19'),_0x423a81['name']))[_0x47a5('0x1a')](_0x47a5('0x1b'),_0x423a81);}};module[_0x47a5('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 59b94c7..b4bf251 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 _0xaa7c=['md5','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','online','available','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting'];(function(_0x38f5ad,_0x493963){var _0x3eb3ca=function(_0x52a043){while(--_0x52a043){_0x38f5ad['push'](_0x38f5ad['shift']());}};_0x3eb3ca(++_0x493963);}(_0xaa7c,0x1ec));var _0xcaa7=function(_0x5d50e4,_0x17cf35){_0x5d50e4=_0x5d50e4-0x0;var _0xeb4ef3=_0xaa7c[_0x5d50e4];return _0xeb4ef3;};'use strict';var _=require(_0xcaa7('0x0'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xcaa7('0x1')]=_[_0xcaa7('0x2')](config['redis'],{'host':_0xcaa7('0x3'),'port':0x18eb});var io=require(_0xcaa7('0x4'))(new Redis(config[_0xcaa7('0x1')]));function SmsQueue(_0x17d8cf){this['id']=_0x17d8cf['id']||0x0;this[_0xcaa7('0x5')]=_0x17d8cf['name']||'';this[_0xcaa7('0x6')]=_0x17d8cf['timeout']||0xa;this['strategy']=_0x17d8cf[_0xcaa7('0x7')]||_0xcaa7('0x8');this[_0xcaa7('0x9')]=_0x17d8cf['Agents'];this[_0xcaa7('0xa')]={};this[_0xcaa7('0xb')]=0x0;this[_0xcaa7('0xc')]='';this[_0xcaa7('0xd')]();this[_0xcaa7('0xe')]();}SmsQueue['prototype'][_0xcaa7('0xd')]=function(){var _0x39d53a=this[_0xcaa7('0xa')][_0xcaa7('0xf')];this[_0xcaa7('0xa')]=_[_0xcaa7('0x10')](this['Agents'],'id');this[_0xcaa7('0xa')][_0xcaa7('0xf')]=_0x39d53a;};SmsQueue[_0xcaa7('0x11')][_0xcaa7('0xe')]=function(){this[_0xcaa7('0x12')]=0x0;this[_0xcaa7('0x13')]=0x0;for(var _0x299490=0x0;_0x299490=0x0?this[_0xcaa7('0x15')]:0x0;var _0x5c2a74={'id':this['id'],'available':this['available'],'loggedIn':this[_0xcaa7('0x12')],'name':this[_0xcaa7('0x5')],'paused':this[_0xcaa7('0x13')],'waiting':this[_0xcaa7('0xb')]};var _0x131e52=md5(JSON[_0xcaa7('0x16')](_0x5c2a74));if(this[_0xcaa7('0xc')]!==_0x131e52){this['md5']=_0x131e52;io['to'](util[_0xcaa7('0x17')](_0xcaa7('0x18'),_0x5c2a74[_0xcaa7('0x5')]))[_0xcaa7('0x19')](_0xcaa7('0x1a'),_0x5c2a74);}};module[_0xcaa7('0x1b')]=SmsQueue; \ No newline at end of file +var _0xe812=['stringify','sms:queue:%s','emit','sms_queue:save','exports','md5','util','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','smsPause','paused','available','waiting'];(function(_0x46a3e8,_0x2e1b35){var _0xf1442e=function(_0x37b5d4){while(--_0x37b5d4){_0x46a3e8['push'](_0x46a3e8['shift']());}};_0xf1442e(++_0x2e1b35);}(_0xe812,0x1f2));var _0x2e81=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xe812[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var md5=require(_0x2e81('0x0'));var util=require(_0x2e81('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x2e81('0x2')]=_[_0x2e81('0x3')](config['redis'],{'host':_0x2e81('0x4'),'port':0x18eb});var io=require(_0x2e81('0x5'))(new Redis(config['redis']));function SmsQueue(_0x1a0274){this['id']=_0x1a0274['id']||0x0;this[_0x2e81('0x6')]=_0x1a0274['name']||'';this[_0x2e81('0x7')]=_0x1a0274[_0x2e81('0x7')]||0xa;this[_0x2e81('0x8')]=_0x1a0274['strategy']||_0x2e81('0x9');this[_0x2e81('0xa')]=_0x1a0274[_0x2e81('0xa')];this[_0x2e81('0xb')]={};this['waiting']=0x0;this[_0x2e81('0x0')]='';this[_0x2e81('0xc')]();this[_0x2e81('0xd')]();}SmsQueue[_0x2e81('0xe')][_0x2e81('0xc')]=function(){var _0x3cbca8=this[_0x2e81('0xb')][_0x2e81('0xf')];this[_0x2e81('0xb')]=_[_0x2e81('0x10')](this[_0x2e81('0xa')],'id');this['mapAgentsId'][_0x2e81('0xf')]=_0x3cbca8;};SmsQueue[_0x2e81('0xe')]['updateRealtime']=function(){this[_0x2e81('0x11')]=0x0;this['paused']=0x0;for(var _0x2a4411=0x0;_0x2a4411=0x0?this['available']:0x0;var _0x402992={'id':this['id'],'available':this[_0x2e81('0x16')],'loggedIn':this[_0x2e81('0x11')],'name':this[_0x2e81('0x6')],'paused':this[_0x2e81('0x15')],'waiting':this[_0x2e81('0x17')]};var _0x1f5419=md5(JSON[_0x2e81('0x18')](_0x402992));if(this[_0x2e81('0x0')]!==_0x1f5419){this[_0x2e81('0x0')]=_0x1f5419;io['to'](util['format'](_0x2e81('0x19'),_0x402992[_0x2e81('0x6')]))[_0x2e81('0x1a')](_0x2e81('0x1b'),_0x402992);}};module[_0x2e81('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 64bda2e..3037671 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 _0x3d41=['map','_rr','loggedIn','paused','length','online','whatsappPause','available','waiting','stringify','format','whatsapp:queue:%s','whatsapp_queue:save','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype'];(function(_0x58396f,_0x3119e0){var _0x437ed5=function(_0x134c35){while(--_0x134c35){_0x58396f['push'](_0x58396f['shift']());}};_0x437ed5(++_0x3119e0);}(_0x3d41,0x125));var _0x13d4=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0x3d41[_0xc67528];return _0x38e26d;};'use strict';var _=require('lodash');var md5=require(_0x13d4('0x0'));var util=require(_0x13d4('0x1'));var Redis=require(_0x13d4('0x2'));var config=require(_0x13d4('0x3'));config[_0x13d4('0x4')]=_['defaults'](config['redis'],{'host':_0x13d4('0x5'),'port':0x18eb});var io=require(_0x13d4('0x6'))(new Redis(config[_0x13d4('0x4')]));function WhatsappQueue(_0x14c655){this['id']=_0x14c655['id']||0x0;this[_0x13d4('0x7')]=_0x14c655[_0x13d4('0x7')]||'';this[_0x13d4('0x8')]=_0x14c655['timeout']||0xa;this['strategy']=_0x14c655['strategy']||_0x13d4('0x9');this[_0x13d4('0xa')]=_0x14c655[_0x13d4('0xa')];this[_0x13d4('0xb')]={};this['waiting']=0x0;this[_0x13d4('0x0')]='';this[_0x13d4('0xc')]();this[_0x13d4('0xd')]();}WhatsappQueue[_0x13d4('0xe')][_0x13d4('0xc')]=function(){var _0x10a4d7=this[_0x13d4('0xb')]['_rr'];this['mapAgentsId']=_[_0x13d4('0xf')](this[_0x13d4('0xa')],'id');this[_0x13d4('0xb')][_0x13d4('0x10')]=_0x10a4d7;};WhatsappQueue[_0x13d4('0xe')]['updateRealtime']=function(){this[_0x13d4('0x11')]=0x0;this[_0x13d4('0x12')]=0x0;for(var _0x464b43=0x0;_0x464b43=0x0?this[_0x13d4('0x16')]:0x0;var _0x30b02d={'id':this['id'],'available':this[_0x13d4('0x16')],'loggedIn':this[_0x13d4('0x11')],'name':this['name'],'paused':this[_0x13d4('0x12')],'waiting':this[_0x13d4('0x17')]};var _0x531ec8=md5(JSON[_0x13d4('0x18')](_0x30b02d));if(this[_0x13d4('0x0')]!==_0x531ec8){this[_0x13d4('0x0')]=_0x531ec8;io['to'](util[_0x13d4('0x19')](_0x13d4('0x1a'),_0x30b02d[_0x13d4('0x7')]))['emit'](_0x13d4('0x1b'),_0x30b02d);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0x3433=['_rr','map','updateRealtime','paused','online','loggedIn','whatsappPause','available','whatsapp:queue:%s','emit','whatsapp_queue:save','lodash','md5','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype'];(function(_0x3b880f,_0x2519ad){var _0x279e0c=function(_0x31cf86){while(--_0x31cf86){_0x3b880f['push'](_0x3b880f['shift']());}};_0x279e0c(++_0x2519ad);}(_0x3433,0x1cd));var _0x3343=function(_0x95411e,_0x38b4c3){_0x95411e=_0x95411e-0x0;var _0x2c8718=_0x3433[_0x95411e];return _0x2c8718;};'use strict';var _=require(_0x3343('0x0'));var md5=require(_0x3343('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_['defaults'](config['redis'],{'host':_0x3343('0x2'),'port':0x18eb});var io=require(_0x3343('0x3'))(new Redis(config[_0x3343('0x4')]));function WhatsappQueue(_0x3ea95d){this['id']=_0x3ea95d['id']||0x0;this[_0x3343('0x5')]=_0x3ea95d[_0x3343('0x5')]||'';this[_0x3343('0x6')]=_0x3ea95d[_0x3343('0x6')]||0xa;this['strategy']=_0x3ea95d[_0x3343('0x7')]||_0x3343('0x8');this[_0x3343('0x9')]=_0x3ea95d['Agents'];this[_0x3343('0xa')]={};this[_0x3343('0xb')]=0x0;this[_0x3343('0x1')]='';this[_0x3343('0xc')]();this['updateRealtime']();}WhatsappQueue[_0x3343('0xd')]['updateRouting']=function(){var _0x3f4352=this[_0x3343('0xa')][_0x3343('0xe')];this[_0x3343('0xa')]=_[_0x3343('0xf')](this[_0x3343('0x9')],'id');this[_0x3343('0xa')][_0x3343('0xe')]=_0x3f4352;};WhatsappQueue['prototype'][_0x3343('0x10')]=function(){this['loggedIn']=0x0;this[_0x3343('0x11')]=0x0;for(var _0x5c3e2d=0x0;_0x5c3e2d=0x0?this[_0x3343('0x15')]:0x0;var _0x423b3f={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x3343('0x5')],'paused':this[_0x3343('0x11')],'waiting':this[_0x3343('0xb')]};var _0x2c3673=md5(JSON['stringify'](_0x423b3f));if(this['md5']!==_0x2c3673){this[_0x3343('0x1')]=_0x2c3673;io['to'](util['format'](_0x3343('0x16'),_0x423b3f[_0x3343('0x5')]))[_0x3343('0x17')](_0x3343('0x18'),_0x423b3f);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 39aad54..3b79011 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 _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(_0x110829,_0x145189){var _0x56d0cd=function(_0x7eebd5){while(--_0x7eebd5){_0x110829['push'](_0x110829['shift']());}};_0x56d0cd(++_0x145189);}(_0xb10b,0x12a));var _0xbb10=function(_0x5b3820,_0x51889c){_0x5b3820=_0x5b3820-0x0;var _0x442af8=_0xb10b[_0x5b3820];return _0x442af8;};'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 +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(_0x3ec8c1,_0x5c18ac){var _0x3ea6d6=function(_0xda5b59){while(--_0xda5b59){_0x3ec8c1['push'](_0x3ec8c1['shift']());}};_0x3ea6d6(++_0x5c18ac);}(_0xb10b,0x12a));var _0xbb10=function(_0x880aed,_0x16597b){_0x880aed=_0x880aed-0x0;var _0x40df37=_0xb10b[_0x880aed];return _0x40df37;};'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 8ced768..26b290a 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 _0xa29b=['update','UpdateChatInteraction','updateChatInteraction','addTagsToChatInteraction','../client'];(function(_0x2c8d85,_0x590fef){var _0x277ef4=function(_0x7c7a91){while(--_0x7c7a91){_0x2c8d85['push'](_0x2c8d85['shift']());}};_0x277ef4(++_0x590fef);}(_0xa29b,0x171));var _0xba29=function(_0x401554,_0x34b410){_0x401554=_0x401554-0x0;var _0x5b70e9=_0xa29b[_0x401554];return _0x5b70e9;};'use strict';var client=require(_0xba29('0x0'));exports[_0xba29('0x1')]=function(_0x1c1fb4,_0x15b5b1){return client['Request'](_0xba29('0x2'),{'body':_0x15b5b1,'options':{'where':{'id':_0x1c1fb4}},'log':_0xba29('0x3')});};exports['addTags']=function(_0x10d9a7,_0xf863d){return client['Request']('AddTagsToChatInteraction',{'body':_0xf863d,'options':{'where':{'id':_0x10d9a7}},'log':_0xba29('0x4')});}; \ No newline at end of file +var _0x149b=['../client','update','UpdateChatInteraction','updateChatInteraction','addTags','Request','AddTagsToChatInteraction'];(function(_0x3e9cc2,_0x671ecb){var _0x461190=function(_0x24549a){while(--_0x24549a){_0x3e9cc2['push'](_0x3e9cc2['shift']());}};_0x461190(++_0x671ecb);}(_0x149b,0x19d));var _0xb149=function(_0x4999a5,_0x56aa9d){_0x4999a5=_0x4999a5-0x0;var _0x1f1efe=_0x149b[_0x4999a5];return _0x1f1efe;};'use strict';var client=require(_0xb149('0x0'));exports[_0xb149('0x1')]=function(_0x2264a8,_0x55b1ed){return client['Request'](_0xb149('0x2'),{'body':_0x55b1ed,'options':{'where':{'id':_0x2264a8}},'log':_0xb149('0x3')});};exports[_0xb149('0x4')]=function(_0x53a584,_0x125f9c){return client[_0xb149('0x5')](_0xb149('0x6'),{'body':_0x125f9c,'options':{'where':{'id':_0x53a584}},'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 beb62b3..ddc6a72 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 _0xf204=['CreateChatMessage','createChatMessage','../client','create','Request'];(function(_0x2d4340,_0x14bd7f){var _0x5a2e9e=function(_0x2ea64f){while(--_0x2ea64f){_0x2d4340['push'](_0x2d4340['shift']());}};_0x5a2e9e(++_0x14bd7f);}(_0xf204,0x16f));var _0x4f20=function(_0x428470,_0x36136c){_0x428470=_0x428470-0x0;var _0x501c8a=_0xf204[_0x428470];return _0x501c8a;};'use strict';var client=require(_0x4f20('0x0'));exports[_0x4f20('0x1')]=function(_0x1264f0){return client[_0x4f20('0x2')](_0x4f20('0x3'),{'body':_0x1264f0,'log':_0x4f20('0x4')});}; \ No newline at end of file +var _0x9e99=['create','createChatMessage'];(function(_0x5460df,_0x33d87b){var _0x246990=function(_0x39d846){while(--_0x39d846){_0x5460df['push'](_0x5460df['shift']());}};_0x246990(++_0x33d87b);}(_0x9e99,0xf0));var _0x99e9=function(_0x4880ef,_0xaea8cb){_0x4880ef=_0x4880ef-0x0;var _0x1fb921=_0x9e99[_0x4880ef];return _0x1fb921;};'use strict';var client=require('../client');exports[_0x99e9('0x0')]=function(_0x399f3d){return client['Request']('CreateChatMessage',{'body':_0x399f3d,'log':_0x99e9('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 42bd621..835467e 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 _0x956a=['Agents','chatPause','getChatQueues','Request','GetChatQueue','name','timeout','strategy','User'];(function(_0x155534,_0x50d9ac){var _0x34aac3=function(_0x19d51f){while(--_0x19d51f){_0x155534['push'](_0x155534['shift']());}};_0x34aac3(++_0x50d9ac);}(_0x956a,0xb6));var _0xa956=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x956a[_0x17d9e3];return _0x14192d;};'use strict';var client=require('../client');exports[_0xa956('0x0')]=function(){return function(){return client[_0xa956('0x1')](_0xa956('0x2'),{'options':{'raw':![],'attributes':['id',_0xa956('0x3'),_0xa956('0x4'),_0xa956('0x5')],'include':[{'model':_0xa956('0x6'),'as':_0xa956('0x7'),'attributes':['id','name','online',_0xa956('0x8')]}]},'log':_0xa956('0x0')});};}; \ No newline at end of file +var _0x82f5=['Request','GetChatQueue','name','User','Agents','online','chatPause','../client','getChatQueues'];(function(_0x400653,_0x121468){var _0x4d32cb=function(_0x492189){while(--_0x492189){_0x400653['push'](_0x400653['shift']());}};_0x4d32cb(++_0x121468);}(_0x82f5,0x15d));var _0x582f=function(_0xb5901e,_0x32c30a){_0xb5901e=_0xb5901e-0x0;var _0x29d47f=_0x82f5[_0xb5901e];return _0x29d47f;};'use strict';var client=require(_0x582f('0x0'));exports[_0x582f('0x1')]=function(){return function(){return client[_0x582f('0x2')](_0x582f('0x3'),{'options':{'raw':![],'attributes':['id',_0x582f('0x4'),'timeout','strategy'],'include':[{'model':_0x582f('0x5'),'as':_0x582f('0x6'),'attributes':['id',_0x582f('0x4'),_0x582f('0x7'),_0x582f('0x8')]}]},'log':_0x582f('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index c8f624c..134247c 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 _0x4fef=['Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client','create'];(function(_0x46d68b,_0x154971){var _0x3a7893=function(_0x17e56a){while(--_0x17e56a){_0x46d68b['push'](_0x46d68b['shift']());}};_0x3a7893(++_0x154971);}(_0x4fef,0x10f));var _0xf4fe=function(_0x4cf36e,_0xbcf671){_0x4cf36e=_0x4cf36e-0x0;var _0x247a45=_0x4fef[_0x4cf36e];return _0x247a45;};'use strict';var client=require(_0xf4fe('0x0'));exports[_0xf4fe('0x1')]=function(_0x54ad56){return client[_0xf4fe('0x2')]('CreateChatQueueReport',{'body':_0x54ad56,'log':_0xf4fe('0x3')});};exports[_0xf4fe('0x4')]=function(_0x3c78db,_0x1e5ec2){return client[_0xf4fe('0x2')](_0xf4fe('0x5'),{'body':_0x1e5ec2,'options':{'where':{'uniqueid':_0x3c78db},'order':[['id',_0xf4fe('0x6')]],'limit':0x1},'log':_0xf4fe('0x5')});}; \ No newline at end of file +var _0xeb5d=['CreateChatQueueReport','UpdateChatQueueReport','DESC','create','Request'];(function(_0xa5d3ea,_0x197de5){var _0x136554=function(_0x20f4bc){while(--_0x20f4bc){_0xa5d3ea['push'](_0xa5d3ea['shift']());}};_0x136554(++_0x197de5);}(_0xeb5d,0x16b));var _0xdeb5=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xeb5d[_0x122ef9];return _0x42fba0;};'use strict';var client=require('../client');exports[_0xdeb5('0x0')]=function(_0x1ede03){return client[_0xdeb5('0x1')](_0xdeb5('0x2'),{'body':_0x1ede03,'log':'CreateChatQueueReport'});};exports['update']=function(_0x17d77f,_0x16c31b){return client['Request'](_0xdeb5('0x3'),{'body':_0x16c31b,'options':{'where':{'uniqueid':_0x17d77f},'order':[['id',_0xdeb5('0x4')]],'limit':0x1},'log':_0xdeb5('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index b2efebf..41faae4 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(_0x148879,_0x5b4c11){var _0x4f7027=function(_0xad056b){while(--_0xad056b){_0x148879['push'](_0x148879['shift']());}};_0x4f7027(++_0x5b4c11);}(_0x7a54,0x106));var _0x47a5=function(_0x5757a6,_0x4841da){_0x5757a6=_0x5757a6-0x0;var _0x18e149=_0x7a54[_0x5757a6];return _0x18e149;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x42c6f1,_0x338d7b){var _0x3c7398=function(_0x151494){while(--_0x151494){_0x42c6f1['push'](_0x42c6f1['shift']());}};_0x3c7398(++_0x338d7b);}(_0x7a54,0x106));var _0x47a5=function(_0x28dace,_0x192120){_0x28dace=_0x28dace-0x0;var _0x3b4c7f=_0x7a54[_0x28dace];return _0x3b4c7f;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index c8805f1..c538617 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 _0x7e47=['../client','CreateFaxMessage'];(function(_0x1eed78,_0x2b1b0a){var _0x3578bc=function(_0x308012){while(--_0x308012){_0x1eed78['push'](_0x1eed78['shift']());}};_0x3578bc(++_0x2b1b0a);}(_0x7e47,0x15e));var _0x77e4=function(_0x356cd6,_0x215e12){_0x356cd6=_0x356cd6-0x0;var _0x281e02=_0x7e47[_0x356cd6];return _0x281e02;};'use strict';var client=require(_0x77e4('0x0'));exports['create']=function(_0x9cafb4){return client['Request'](_0x77e4('0x1'),{'body':_0x9cafb4,'log':'createFaxMessage'});}; \ No newline at end of file +var _0x57a3=['create','Request','CreateFaxMessage','../client'];(function(_0x2dd610,_0x403802){var _0x14d8a5=function(_0x3af3fc){while(--_0x3af3fc){_0x2dd610['push'](_0x2dd610['shift']());}};_0x14d8a5(++_0x403802);}(_0x57a3,0x1db));var _0x357a=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0x57a3[_0x53cf8e];return _0x459197;};'use strict';var client=require(_0x357a('0x0'));exports[_0x357a('0x1')]=function(_0x32e72e){return client[_0x357a('0x2')](_0x357a('0x3'),{'body':_0x32e72e,'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 0ca1aac..6cf9b27 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 _0xbdc2=['online','faxPause','getFaxQueues','timeout','strategy','User','Agents','name'];(function(_0x25fa5c,_0x421141){var _0x1bade2=function(_0x3faf20){while(--_0x3faf20){_0x25fa5c['push'](_0x25fa5c['shift']());}};_0x1bade2(++_0x421141);}(_0xbdc2,0x122));var _0x2bdc=function(_0x47dcb1,_0x2e7067){_0x47dcb1=_0x47dcb1-0x0;var _0x532b9f=_0xbdc2[_0x47dcb1];return _0x532b9f;};'use strict';var client=require('../client');exports[_0x2bdc('0x0')]=function(){return function(){return client['Request']('GetFaxQueue',{'options':{'raw':![],'attributes':['id','name',_0x2bdc('0x1'),_0x2bdc('0x2')],'include':[{'model':_0x2bdc('0x3'),'as':_0x2bdc('0x4'),'attributes':['id',_0x2bdc('0x5'),_0x2bdc('0x6'),_0x2bdc('0x7')]}]},'log':_0x2bdc('0x0')});};}; \ No newline at end of file +var _0x7cb2=['strategy','User','Agents','online','../client','getFaxQueues','name','timeout'];(function(_0x39080f,_0x310807){var _0x1e3203=function(_0x242bc2){while(--_0x242bc2){_0x39080f['push'](_0x39080f['shift']());}};_0x1e3203(++_0x310807);}(_0x7cb2,0x134));var _0x27cb=function(_0x3a715d,_0x3ea103){_0x3a715d=_0x3a715d-0x0;var _0x215e80=_0x7cb2[_0x3a715d];return _0x215e80;};'use strict';var client=require(_0x27cb('0x0'));exports[_0x27cb('0x1')]=function(){return function(){return client['Request']('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x27cb('0x2'),_0x27cb('0x3'),_0x27cb('0x4')],'include':[{'model':_0x27cb('0x5'),'as':_0x27cb('0x6'),'attributes':['id','name',_0x27cb('0x7'),'faxPause']}]},'log':_0x27cb('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index af2205e..9a94a0b 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 _0xe4cd=['UpdateFaxQueueReport','../client','create','Request','CreateFaxQueueReport','update'];(function(_0x24cbc5,_0xe488f9){var _0xc6d8ef=function(_0x405ea6){while(--_0x405ea6){_0x24cbc5['push'](_0x24cbc5['shift']());}};_0xc6d8ef(++_0xe488f9);}(_0xe4cd,0x1ab));var _0xde4c=function(_0x64f678,_0x485eef){_0x64f678=_0x64f678-0x0;var _0xfd3c4d=_0xe4cd[_0x64f678];return _0xfd3c4d;};'use strict';var client=require(_0xde4c('0x0'));exports[_0xde4c('0x1')]=function(_0x5bba8e){return client[_0xde4c('0x2')]('CreateFaxQueueReport',{'body':_0x5bba8e,'log':_0xde4c('0x3')});};exports[_0xde4c('0x4')]=function(_0x42a72c,_0x3eb99f){return client[_0xde4c('0x2')](_0xde4c('0x5'),{'body':_0x3eb99f,'options':{'where':{'uniqueid':_0x42a72c},'order':[['id','DESC']],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x386c=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client'];(function(_0x34f4e1,_0x3f8744){var _0x343364=function(_0x4be074){while(--_0x4be074){_0x34f4e1['push'](_0x34f4e1['shift']());}};_0x343364(++_0x3f8744);}(_0x386c,0x1bb));var _0xc386=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x386c[_0x40a045];return _0x1a687c;};'use strict';var client=require(_0xc386('0x0'));exports['create']=function(_0x1232be){return client[_0xc386('0x1')](_0xc386('0x2'),{'body':_0x1232be,'log':_0xc386('0x2')});};exports[_0xc386('0x3')]=function(_0x38bf4f,_0x1047d2){return client['Request'](_0xc386('0x4'),{'body':_0x1047d2,'options':{'where':{'uniqueid':_0x38bf4f},'order':[['id',_0xc386('0x5')]],'limit':0x1},'log':_0xc386('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 368f9d6..bd59f57 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 _0xa23d=['Interval','../client','getIntervals','Request','GetInterval','name'];(function(_0x3cf4d3,_0x48065e){var _0x4e547b=function(_0x28f85a){while(--_0x28f85a){_0x3cf4d3['push'](_0x3cf4d3['shift']());}};_0x4e547b(++_0x48065e);}(_0xa23d,0xeb));var _0xda23=function(_0x39ddbb,_0x1a9d14){_0x39ddbb=_0x39ddbb-0x0;var _0x21d385=_0xa23d[_0x39ddbb];return _0x21d385;};'use strict';var client=require(_0xda23('0x0'));exports[_0xda23('0x1')]=function(){return function(){return client[_0xda23('0x2')](_0xda23('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xda23('0x4')],'include':[{'model':_0xda23('0x5'),'as':'Intervals','attributes':['id',_0xda23('0x4'),'interval']}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0x6da6=['Intervals','name','interval','getIntervals','GetInterval','Interval'];(function(_0x5101b2,_0x1d3749){var _0x5249db=function(_0x25431b){while(--_0x25431b){_0x5101b2['push'](_0x5101b2['shift']());}};_0x5249db(++_0x1d3749);}(_0x6da6,0xa5));var _0x66da=function(_0x4776b5,_0x57c89a){_0x4776b5=_0x4776b5-0x0;var _0x5cc4d5=_0x6da6[_0x4776b5];return _0x5cc4d5;};'use strict';var client=require('../client');exports[_0x66da('0x0')]=function(){return function(){return client['Request'](_0x66da('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x66da('0x2'),'as':_0x66da('0x3'),'attributes':['id',_0x66da('0x4'),_0x66da('0x5')]}]},'log':_0x66da('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index ad58c1c..23a6627 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 _0x6d38=['updateMailInteraction','Request','addTagsToChatInteraction','update'];(function(_0x364b32,_0x4dec35){var _0x3f3ea0=function(_0x1911a8){while(--_0x1911a8){_0x364b32['push'](_0x364b32['shift']());}};_0x3f3ea0(++_0x4dec35);}(_0x6d38,0x1ef));var _0x86d3=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6d38[_0xa464c9];return _0x3d73c4;};'use strict';var client=require('../client');exports[_0x86d3('0x0')]=function(_0x4c9c06,_0x3db243){return client['Request']('UpdateMailInteraction',{'body':_0x3db243,'options':{'where':{'id':_0x4c9c06}},'log':_0x86d3('0x1')});};exports['addTags']=function(_0xe9198a,_0x455b9d){return client[_0x86d3('0x2')]('AddTagsToMailInteraction',{'body':_0x455b9d,'options':{'where':{'id':_0xe9198a}},'log':_0x86d3('0x3')});}; \ No newline at end of file +var _0xfef3=['../client','Request','UpdateMailInteraction','addTags','AddTagsToMailInteraction'];(function(_0x19c3f8,_0x9de1a2){var _0x2f8f4e=function(_0x1047e2){while(--_0x1047e2){_0x19c3f8['push'](_0x19c3f8['shift']());}};_0x2f8f4e(++_0x9de1a2);}(_0xfef3,0x118));var _0x3fef=function(_0x104ada,_0xc16fff){_0x104ada=_0x104ada-0x0;var _0x70ab44=_0xfef3[_0x104ada];return _0x70ab44;};'use strict';var client=require(_0x3fef('0x0'));exports['update']=function(_0x3f2183,_0x494ae6){return client[_0x3fef('0x1')](_0x3fef('0x2'),{'body':_0x494ae6,'options':{'where':{'id':_0x3f2183}},'log':'updateMailInteraction'});};exports[_0x3fef('0x3')]=function(_0x3b71e5,_0x538f28){return client[_0x3fef('0x1')](_0x3fef('0x4'),{'body':_0x538f28,'options':{'where':{'id':_0x3b71e5}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index c73a962..01ccdb5 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 _0x8163=['create','Request','createMailMessage','../client'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x8163,0xeb));var _0x3816=function(_0x152f90,_0x4c70d){_0x152f90=_0x152f90-0x0;var _0x5843c5=_0x8163[_0x152f90];return _0x5843c5;};'use strict';var client=require(_0x3816('0x0'));exports[_0x3816('0x1')]=function(_0x551d1b){return client[_0x3816('0x2')]('CreateMailMessage',{'body':_0x551d1b,'log':_0x3816('0x3')});}; \ No newline at end of file +var _0xa562=['createMailMessage','../client','create','Request','CreateMailMessage'];(function(_0x16b832,_0x53a702){var _0x549b44=function(_0x5c5f3f){while(--_0x5c5f3f){_0x16b832['push'](_0x16b832['shift']());}};_0x549b44(++_0x53a702);}(_0xa562,0xab));var _0x2a56=function(_0x18cac4,_0x57a4d5){_0x18cac4=_0x18cac4-0x0;var _0x2227c6=_0xa562[_0x18cac4];return _0x2227c6;};'use strict';var client=require(_0x2a56('0x0'));exports[_0x2a56('0x1')]=function(_0x513f68){return client[_0x2a56('0x2')](_0x2a56('0x3'),{'body':_0x513f68,'log':_0x2a56('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index ebb55cf..a6925aa 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 _0xb375=['../client','getMailQueues','Request','GetMailQueue','name','timeout','strategy','User','Agents','online','mailPause'];(function(_0x196167,_0x50c123){var _0x54b543=function(_0x56d394){while(--_0x56d394){_0x196167['push'](_0x196167['shift']());}};_0x54b543(++_0x50c123);}(_0xb375,0x181));var _0x5b37=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb375[_0x2dafbe];return _0x58a45a;};'use strict';var client=require(_0x5b37('0x0'));exports[_0x5b37('0x1')]=function(){return function(){return client[_0x5b37('0x2')](_0x5b37('0x3'),{'options':{'raw':![],'attributes':['id',_0x5b37('0x4'),_0x5b37('0x5'),_0x5b37('0x6')],'include':[{'model':_0x5b37('0x7'),'as':_0x5b37('0x8'),'attributes':['id','name',_0x5b37('0x9'),_0x5b37('0xa')]}]},'log':_0x5b37('0x1')});};}; \ No newline at end of file +var _0xf2ee=['../client','getMailQueues','Request','GetMailQueue','User','name','online','mailPause'];(function(_0x2c919f,_0x296902){var _0xd4cc56=function(_0x441ea2){while(--_0x441ea2){_0x2c919f['push'](_0x2c919f['shift']());}};_0xd4cc56(++_0x296902);}(_0xf2ee,0x110));var _0xef2e=function(_0x1ec98b,_0x306c07){_0x1ec98b=_0x1ec98b-0x0;var _0x1619d4=_0xf2ee[_0x1ec98b];return _0x1619d4;};'use strict';var client=require(_0xef2e('0x0'));exports[_0xef2e('0x1')]=function(){return function(){return client[_0xef2e('0x2')](_0xef2e('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout','strategy'],'include':[{'model':_0xef2e('0x4'),'as':'Agents','attributes':['id',_0xef2e('0x5'),_0xef2e('0x6'),_0xef2e('0x7')]}]},'log':_0xef2e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index de9894f..2532e04 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 _0x7d92=['CreateMailQueueReport','update','UpdateMailQueueReport','../client','create','Request'];(function(_0x1eff83,_0x598a1c){var _0x20f2fa=function(_0x25a530){while(--_0x25a530){_0x1eff83['push'](_0x1eff83['shift']());}};_0x20f2fa(++_0x598a1c);}(_0x7d92,0x6f));var _0x27d9=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0x7d92[_0x409353];return _0x4f4b59;};'use strict';var client=require(_0x27d9('0x0'));exports[_0x27d9('0x1')]=function(_0x56dc38){return client[_0x27d9('0x2')](_0x27d9('0x3'),{'body':_0x56dc38,'log':'CreateMailQueueReport'});};exports[_0x27d9('0x4')]=function(_0x53ea19,_0x33131f){return client['Request'](_0x27d9('0x5'),{'body':_0x33131f,'options':{'where':{'uniqueid':_0x53ea19},'order':[['id','DESC']],'limit':0x1},'log':_0x27d9('0x5')});}; \ No newline at end of file +var _0x5c86=['CreateMailQueueReport','update','Request','DESC','UpdateMailQueueReport'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0x5c86,0x168));var _0x65c8=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x5c86[_0x397e5f];return _0x5302b8;};'use strict';var client=require('../client');exports['create']=function(_0x182363){return client['Request'](_0x65c8('0x0'),{'body':_0x182363,'log':'CreateMailQueueReport'});};exports[_0x65c8('0x1')]=function(_0x1417a6,_0x238bf5){return client[_0x65c8('0x2')]('UpdateMailQueueReport',{'body':_0x238bf5,'options':{'where':{'uniqueid':_0x1417a6},'order':[['id',_0x65c8('0x3')]],'limit':0x1},'log':_0x65c8('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index e03dda3..8711544 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 _0x4d31=['AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','updateOpenchannelInteraction','addTags','Request'];(function(_0x23e575,_0x8f98c4){var _0x487e24=function(_0x5ecc7f){while(--_0x5ecc7f){_0x23e575['push'](_0x23e575['shift']());}};_0x487e24(++_0x8f98c4);}(_0x4d31,0x121));var _0x14d3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4d31[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x14d3('0x0'));exports[_0x14d3('0x1')]=function(_0x5ecfeb,_0x2047e5){return client['Request']('UpdateOpenchannelInteraction',{'body':_0x2047e5,'options':{'where':{'id':_0x5ecfeb}},'log':_0x14d3('0x2')});};exports[_0x14d3('0x3')]=function(_0x1adedf,_0xb559ed){return client[_0x14d3('0x4')](_0x14d3('0x5'),{'body':_0xb559ed,'options':{'where':{'id':_0x1adedf}},'log':_0x14d3('0x6')});}; \ No newline at end of file +var _0x8778=['updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction'];(function(_0xf34045,_0x490676){var _0x26c5bd=function(_0x113014){while(--_0x113014){_0xf34045['push'](_0xf34045['shift']());}};_0x26c5bd(++_0x490676);}(_0x8778,0x8c));var _0x8877=function(_0x5c034b,_0x23af41){_0x5c034b=_0x5c034b-0x0;var _0x1bb982=_0x8778[_0x5c034b];return _0x1bb982;};'use strict';var client=require(_0x8877('0x0'));exports[_0x8877('0x1')]=function(_0x37728a,_0xbe146d){return client[_0x8877('0x2')](_0x8877('0x3'),{'body':_0xbe146d,'options':{'where':{'id':_0x37728a}},'log':_0x8877('0x4')});};exports[_0x8877('0x5')]=function(_0x5b0489,_0xdb883e){return client[_0x8877('0x2')](_0x8877('0x6'),{'body':_0xdb883e,'options':{'where':{'id':_0x5b0489}},'log':_0x8877('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 3857fac..52f55c8 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 _0xa87b=['../client','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa87b,0xba));var _0xba87=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa87b[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xba87('0x0'));exports['create']=function(_0x34cd97){return client['Request'](_0xba87('0x1'),{'body':_0x34cd97,'log':_0xba87('0x2')});}; \ No newline at end of file +var _0x5b6b=['CreateOpenchannelMessage','create','Request'];(function(_0x1fd2c9,_0x3727af){var _0xfc70d5=function(_0x42b94b){while(--_0x42b94b){_0x1fd2c9['push'](_0x1fd2c9['shift']());}};_0xfc70d5(++_0x3727af);}(_0x5b6b,0x16c));var _0xb5b6=function(_0x379c62,_0x536566){_0x379c62=_0x379c62-0x0;var _0x5ca155=_0x5b6b[_0x379c62];return _0x5ca155;};'use strict';var client=require('../client');exports[_0xb5b6('0x0')]=function(_0x3b61bd){return client[_0xb5b6('0x1')](_0xb5b6('0x2'),{'body':_0x3b61bd,'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 c62ceff..899fab0 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 _0x81a4=['timeout','strategy','User','Agents','online','getOpenchannelQueues','Request','GetOpenchannelQueue','name'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x81a4,0x125));var _0x481a=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0x81a4[_0x18a79d];return _0x4f8848;};'use strict';var client=require('../client');exports[_0x481a('0x0')]=function(){return function(){return client[_0x481a('0x1')](_0x481a('0x2'),{'options':{'raw':![],'attributes':['id',_0x481a('0x3'),_0x481a('0x4'),_0x481a('0x5')],'include':[{'model':_0x481a('0x6'),'as':_0x481a('0x7'),'attributes':['id',_0x481a('0x3'),_0x481a('0x8'),'openchannelPause']}]},'log':_0x481a('0x0')});};}; \ No newline at end of file +var _0x7aad=['../client','getOpenchannelQueues','Request','GetOpenchannelQueue','timeout','User','Agents','online'];(function(_0x1e6b29,_0x440ee3){var _0xd9a812=function(_0x90e234){while(--_0x90e234){_0x1e6b29['push'](_0x1e6b29['shift']());}};_0xd9a812(++_0x440ee3);}(_0x7aad,0x180));var _0xd7aa=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x7aad[_0x3a6efd];return _0x487b9a;};'use strict';var client=require(_0xd7aa('0x0'));exports[_0xd7aa('0x1')]=function(){return function(){return client[_0xd7aa('0x2')](_0xd7aa('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xd7aa('0x4'),'strategy'],'include':[{'model':_0xd7aa('0x5'),'as':_0xd7aa('0x6'),'attributes':['id','name',_0xd7aa('0x7'),'openchannelPause']}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 5e3bb1e..ac76df2 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 _0xf865=['../client','create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0xf865,0x11a));var _0x5f86=function(_0x599c94,_0x464f0e){_0x599c94=_0x599c94-0x0;var _0x34e215=_0xf865[_0x599c94];return _0x34e215;};'use strict';var client=require(_0x5f86('0x0'));exports[_0x5f86('0x1')]=function(_0xa46aa6){return client[_0x5f86('0x2')](_0x5f86('0x3'),{'body':_0xa46aa6,'log':_0x5f86('0x3')});};exports[_0x5f86('0x4')]=function(_0x3796f9,_0x2bac9d){return client[_0x5f86('0x2')](_0x5f86('0x5'),{'body':_0x2bac9d,'options':{'where':{'uniqueid':_0x3796f9},'order':[['id','DESC']],'limit':0x1},'log':_0x5f86('0x5')});}; \ No newline at end of file +var _0x82a4=['Request','UpdateOpenchannelQueueReport','DESC','create','CreateOpenchannelQueueReport','update'];(function(_0x35b07d,_0x3d0ae7){var _0x2868bc=function(_0xd8ef42){while(--_0xd8ef42){_0x35b07d['push'](_0x35b07d['shift']());}};_0x2868bc(++_0x3d0ae7);}(_0x82a4,0x195));var _0x482a=function(_0xf44ff2,_0x5e9e66){_0xf44ff2=_0xf44ff2-0x0;var _0x241096=_0x82a4[_0xf44ff2];return _0x241096;};'use strict';var client=require('../client');exports[_0x482a('0x0')]=function(_0x2c1bf5){return client['Request']('CreateOpenchannelQueueReport',{'body':_0x2c1bf5,'log':_0x482a('0x1')});};exports[_0x482a('0x2')]=function(_0x3d74ce,_0x4935f7){return client[_0x482a('0x3')](_0x482a('0x4'),{'body':_0x4935f7,'options':{'where':{'uniqueid':_0x3d74ce},'order':[['id',_0x482a('0x5')]],'limit':0x1},'log':_0x482a('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 7fcecdf..15e0762 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 _0xf3dc=['../client','update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags'];(function(_0x360f64,_0x4c37b7){var _0x530e02=function(_0x1d385c){while(--_0x1d385c){_0x360f64['push'](_0x360f64['shift']());}};_0x530e02(++_0x4c37b7);}(_0xf3dc,0x9c));var _0xcf3d=function(_0x3523ff,_0x4b8413){_0x3523ff=_0x3523ff-0x0;var _0xee01c1=_0xf3dc[_0x3523ff];return _0xee01c1;};'use strict';var client=require(_0xcf3d('0x0'));exports[_0xcf3d('0x1')]=function(_0x3a135c,_0x47f284){return client[_0xcf3d('0x2')](_0xcf3d('0x3'),{'body':_0x47f284,'options':{'where':{'id':_0x3a135c}},'log':_0xcf3d('0x4')});};exports[_0xcf3d('0x5')]=function(_0x17b83e,_0x44b3da){return client['Request']('AddTagsToSmsInteraction',{'body':_0x44b3da,'options':{'where':{'id':_0x17b83e}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0x5b7f=['updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction'];(function(_0x5bf2b3,_0xfcd364){var _0x5e8a9b=function(_0x43546b){while(--_0x43546b){_0x5bf2b3['push'](_0x5bf2b3['shift']());}};_0x5e8a9b(++_0xfcd364);}(_0x5b7f,0x8c));var _0xf5b7=function(_0xe569b1,_0x148316){_0xe569b1=_0xe569b1-0x0;var _0x295f68=_0x5b7f[_0xe569b1];return _0x295f68;};'use strict';var client=require(_0xf5b7('0x0'));exports[_0xf5b7('0x1')]=function(_0x15fa0f,_0x471ed4){return client[_0xf5b7('0x2')](_0xf5b7('0x3'),{'body':_0x471ed4,'options':{'where':{'id':_0x15fa0f}},'log':_0xf5b7('0x4')});};exports[_0xf5b7('0x5')]=function(_0x2c5439,_0x2dfb67){return client[_0xf5b7('0x2')](_0xf5b7('0x6'),{'body':_0x2dfb67,'options':{'where':{'id':_0x2c5439}},'log':_0xf5b7('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index e9e3a2b..b402bb2 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 _0xd289=['create','Request','CreateSmsMessage','createSmsMessage','../client'];(function(_0x369a98,_0x32250c){var _0x29565c=function(_0x1a6973){while(--_0x1a6973){_0x369a98['push'](_0x369a98['shift']());}};_0x29565c(++_0x32250c);}(_0xd289,0x135));var _0x9d28=function(_0x12a0a3,_0x2652d1){_0x12a0a3=_0x12a0a3-0x0;var _0x1c47c4=_0xd289[_0x12a0a3];return _0x1c47c4;};'use strict';var client=require(_0x9d28('0x0'));exports[_0x9d28('0x1')]=function(_0x4f79e1){return client[_0x9d28('0x2')](_0x9d28('0x3'),{'body':_0x4f79e1,'log':_0x9d28('0x4')});}; \ No newline at end of file +var _0x11c5=['CreateSmsMessage','../client','create','Request'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x11c5,0xc5));var _0x511c=function(_0x74015e,_0x25dd44){_0x74015e=_0x74015e-0x0;var _0x1f7648=_0x11c5[_0x74015e];return _0x1f7648;};'use strict';var client=require(_0x511c('0x0'));exports[_0x511c('0x1')]=function(_0x42d17d){return client[_0x511c('0x2')](_0x511c('0x3'),{'body':_0x42d17d,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 216dfee..9a3e1fd 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 _0x70e0=['User','Agents','online','../client','getSmsQueues','Request','timeout','strategy'];(function(_0x2a4bf4,_0x3ff0dc){var _0x408b1b=function(_0x1666bf){while(--_0x1666bf){_0x2a4bf4['push'](_0x2a4bf4['shift']());}};_0x408b1b(++_0x3ff0dc);}(_0x70e0,0x17b));var _0x070e=function(_0x5e3951,_0x511217){_0x5e3951=_0x5e3951-0x0;var _0x529179=_0x70e0[_0x5e3951];return _0x529179;};'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 +var _0xa9e0=['name','online','smsPause','../client','getSmsQueues','Request','timeout','User','Agents'];(function(_0x2e9eb4,_0x5968a5){var _0x43d44c=function(_0x265fae){while(--_0x265fae){_0x2e9eb4['push'](_0x2e9eb4['shift']());}};_0x43d44c(++_0x5968a5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),'strategy'],'include':[{'model':_0x0a9e('0x4'),'as':_0x0a9e('0x5'),'attributes':['id',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 9787748..39c3aa6 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 _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x3c28b3,_0x387d48){var _0x30c6a2=function(_0x61cb32){while(--_0x61cb32){_0x3c28b3['push'](_0x3c28b3['shift']());}};_0x30c6a2(++_0x387d48);}(_0x55ca,0x126));var _0xa55c=function(_0x132edb,_0x54e052){_0x132edb=_0x132edb-0x0;var _0x294aab=_0x55ca[_0x132edb];return _0x294aab;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file +var _0x3e74=['CreateSmsQueueReport','UpdateSmsQueueReport','DESC','../client','Request'];(function(_0x5d577c,_0x4e7cb8){var _0x2421fa=function(_0x305aad){while(--_0x305aad){_0x5d577c['push'](_0x5d577c['shift']());}};_0x2421fa(++_0x4e7cb8);}(_0x3e74,0x175));var _0x43e7=function(_0x210613,_0x53382c){_0x210613=_0x210613-0x0;var _0x5875b6=_0x3e74[_0x210613];return _0x5875b6;};'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 c9bfe00..dd6cdb7 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(_0x2d0e90,_0x50c80c){var _0xcae19d=function(_0x54e766){while(--_0x54e766){_0x2d0e90['push'](_0x2d0e90['shift']());}};_0xcae19d(++_0x50c80c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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(_0x5bfd0d,_0x2084cc){var _0x216a68=function(_0x2516f1){while(--_0x2516f1){_0x5bfd0d['push'](_0x5bfd0d['shift']());}};_0x216a68(++_0x2084cc);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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 42a1064..2013660 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 _0xb4d9=['addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction'];(function(_0x36ab09,_0x2f25b3){var _0x57e79c=function(_0x8aa89a){while(--_0x8aa89a){_0x36ab09['push'](_0x36ab09['shift']());}};_0x57e79c(++_0x2f25b3);}(_0xb4d9,0xce));var _0x9b4d=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xb4d9[_0x24f31b];return _0x488401;};'use strict';var client=require(_0x9b4d('0x0'));exports[_0x9b4d('0x1')]=function(_0x59a6ca,_0x21d695){return client[_0x9b4d('0x2')](_0x9b4d('0x3'),{'body':_0x21d695,'options':{'where':{'id':_0x59a6ca}},'log':'updateWhatsappInteraction'});};exports[_0x9b4d('0x4')]=function(_0x27adf9,_0x19b7aa){return client[_0x9b4d('0x2')](_0x9b4d('0x5'),{'body':_0x19b7aa,'options':{'where':{'id':_0x27adf9}},'log':_0x9b4d('0x6')});}; \ No newline at end of file +var _0xfc65=['UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','Request'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfc65,0x1e1));var _0x5fc6=function(_0x47b3af,_0x41160e){_0x47b3af=_0x47b3af-0x0;var _0x40e3d1=_0xfc65[_0x47b3af];return _0x40e3d1;};'use strict';var client=require(_0x5fc6('0x0'));exports['update']=function(_0x5807aa,_0x3dd3a9){return client[_0x5fc6('0x1')](_0x5fc6('0x2'),{'body':_0x3dd3a9,'options':{'where':{'id':_0x5807aa}},'log':_0x5fc6('0x3')});};exports[_0x5fc6('0x4')]=function(_0x34b758,_0x22a8ad){return client[_0x5fc6('0x1')](_0x5fc6('0x5'),{'body':_0x22a8ad,'options':{'where':{'id':_0x34b758}},'log':_0x5fc6('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index a1b00a5..b6d74de 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 _0x4a74=['../client','create','Request'];(function(_0x10efce,_0x1af89e){var _0x4cca46=function(_0x35f695){while(--_0x35f695){_0x10efce['push'](_0x10efce['shift']());}};_0x4cca46(++_0x1af89e);}(_0x4a74,0xe1));var _0x44a7=function(_0x552fe7,_0x4e2595){_0x552fe7=_0x552fe7-0x0;var _0x37c6e9=_0x4a74[_0x552fe7];return _0x37c6e9;};'use strict';var client=require(_0x44a7('0x0'));exports[_0x44a7('0x1')]=function(_0xd0004b){return client[_0x44a7('0x2')]('CreateWhatsappMessage',{'body':_0xd0004b,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0xd756=['../client','createWhatsappMessage'];(function(_0x471ec4,_0x42c871){var _0x43ab60=function(_0x178e9f){while(--_0x178e9f){_0x471ec4['push'](_0x471ec4['shift']());}};_0x43ab60(++_0x42c871);}(_0xd756,0x12a));var _0x6d75=function(_0xcd57e4,_0x5c3e9a){_0xcd57e4=_0xcd57e4-0x0;var _0x202bce=_0xd756[_0xcd57e4];return _0x202bce;};'use strict';var client=require(_0x6d75('0x0'));exports['create']=function(_0x53446b){return client['Request']('CreateWhatsappMessage',{'body':_0x53446b,'log':_0x6d75('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index e60787e..e445c84 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 _0xba57=['online','whatsappPause','../client','getWhatsappQueues','name','timeout','User'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xba57,0xf7));var _0x7ba5=function(_0x476c51,_0x895876){_0x476c51=_0x476c51-0x0;var _0x584ac6=_0xba57[_0x476c51];return _0x584ac6;};'use strict';var client=require(_0x7ba5('0x0'));exports[_0x7ba5('0x1')]=function(){return function(){return client['Request']('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x7ba5('0x2'),_0x7ba5('0x3'),'strategy'],'include':[{'model':_0x7ba5('0x4'),'as':'Agents','attributes':['id',_0x7ba5('0x2'),_0x7ba5('0x5'),_0x7ba5('0x6')]}]},'log':_0x7ba5('0x1')});};}; \ No newline at end of file +var _0x00dc=['strategy','User','Agents','online','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout'];(function(_0x5cd418,_0x4369b1){var _0x28cea0=function(_0x3473a0){while(--_0x3473a0){_0x5cd418['push'](_0x5cd418['shift']());}};_0x28cea0(++_0x4369b1);}(_0x00dc,0x94));var _0xc00d=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x00dc[_0x3947c9];return _0x2e7871;};'use strict';var client=require(_0xc00d('0x0'));exports[_0xc00d('0x1')]=function(){return function(){return client[_0xc00d('0x2')](_0xc00d('0x3'),{'options':{'raw':![],'attributes':['id',_0xc00d('0x4'),_0xc00d('0x5'),_0xc00d('0x6')],'include':[{'model':_0xc00d('0x7'),'as':_0xc00d('0x8'),'attributes':['id',_0xc00d('0x4'),_0xc00d('0x9'),_0xc00d('0xa')]}]},'log':_0xc00d('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 495b5fa..ec7514e 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 _0x566a=['Request','update','UpdateWhatsappQueueReport','DESC','../client','create'];(function(_0x3bf347,_0x5a5dc9){var _0x85b6e3=function(_0x4eb824){while(--_0x4eb824){_0x3bf347['push'](_0x3bf347['shift']());}};_0x85b6e3(++_0x5a5dc9);}(_0x566a,0x184));var _0xa566=function(_0x2f53b9,_0x4befc2){_0x2f53b9=_0x2f53b9-0x0;var _0x13b5eb=_0x566a[_0x2f53b9];return _0x13b5eb;};'use strict';var client=require(_0xa566('0x0'));exports[_0xa566('0x1')]=function(_0x4f04a6){return client[_0xa566('0x2')]('CreateWhatsappQueueReport',{'body':_0x4f04a6,'log':'CreateWhatsappQueueReport'});};exports[_0xa566('0x3')]=function(_0x516245,_0x142fa8){return client[_0xa566('0x2')](_0xa566('0x4'),{'body':_0x142fa8,'options':{'where':{'uniqueid':_0x516245},'order':[['id',_0xa566('0x5')]],'limit':0x1},'log':_0xa566('0x4')});}; \ No newline at end of file +var _0xc5ac=['DESC','../client','create','CreateWhatsappQueueReport','update','Request','UpdateWhatsappQueueReport'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xc5ac,0xd3));var _0xcc5a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc5ac[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xcc5a('0x0'));exports[_0xcc5a('0x1')]=function(_0x20bdd9){return client['Request']('CreateWhatsappQueueReport',{'body':_0x20bdd9,'log':_0xcc5a('0x2')});};exports[_0xcc5a('0x3')]=function(_0x323d04,_0x331d19){return client[_0xcc5a('0x4')](_0xcc5a('0x5'),{'body':_0x331d19,'options':{'where':{'uniqueid':_0x323d04},'order':[['id',_0xcc5a('0x6')]],'limit':0x1},'log':_0xcc5a('0x5')});}; \ 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 e663100..6087b24 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 _0x9503=['error','[%s][AGENT]\x20%s','map','join','find','agents','timeout','createQueue','atimeout','format','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','stop','complete','agent','log','stack','validate','util','seq-queue','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence'];(function(_0x497975,_0x5c0d45){var _0x337218=function(_0xa36ca8){while(--_0xa36ca8){_0x497975['push'](_0x497975['shift']());}};_0x337218(++_0x5c0d45);}(_0x9503,0x15e));var _0x3950=function(_0x2aabe2,_0x22a345){_0x2aabe2=_0x2aabe2-0x0;var _0x2224ee=_0x9503[_0x2aabe2];return _0x2224ee;};'use strict';var schema=require(_0x3950('0x0'));var _=require('lodash');var util=require(_0x3950('0x1'));var seqqueue=require(_0x3950('0x2'));var logger=require('../../../../config/logger')('routing');var strategy=require(_0x3950('0x3'));var queue=schema({'name':{'type':_0x3950('0x4'),'required':!![],'message':_0x3950('0x5')},'timeout':{'type':_0x3950('0x6'),'message':_0x3950('0x7')}});function writeLog(_0xbda054,_0x1d2446,_0x570530){return logger[_0x3950('0x8')](util['format'](_0x3950('0x9'),_0xbda054,_0x1d2446[_0x3950('0xa')],_0x570530));}function handleFindAgent(_0xa8817b){return function(_0x156a75){return _0x156a75[_0x3950('0xa')][_0x3950('0xb')]()===_0xa8817b[_0x3950('0xb')]();};}exports[_0x3950('0xc')]=function(_0x1deeb7,_0x10a5bd,_0xbdfd31,_0x4a694f){return function(_0xf6b92a){try{var _0x4f8cb4={'name':_0x10a5bd[0x0],'timeout':_0x10a5bd[0x1]};var _0x1a1cfc=queue[_0x3950('0x0')](_0x4f8cb4,{'typecast':!![]});if(_0x1a1cfc['length']){logger[_0x3950('0xd')](_0x3950('0xe'),_0x1deeb7,_[_0x3950('0xf')](_0x1a1cfc,'message')[_0x3950('0x10')](',\x20'));_0xf6b92a['stop']();}else{var _0x88234=_[_0x3950('0x11')](_0xbdfd31[_0x3950('0x12')],handleFindAgent(_0x4f8cb4['name']));if(_0x88234){var _0x2df38c=(_0x4f8cb4[_0x3950('0x13')]||0xa)*0x3e8;var _0x41cf0e,_0x4a4cd5;var _0x52e3ec=seqqueue[_0x3950('0x14')](_0x2df38c);_0x52e3ec['id']=_0x1deeb7;_0x52e3ec[_0x3950('0x15')]=_0x2df38c;_0x52e3ec['channel']=_0x4a694f['channel'];writeLog(_0x1deeb7,_0x88234,util[_0x3950('0x16')](_0x3950('0x17'),_0x2df38c));_0xbdfd31[_0x3950('0x18')][_0x1deeb7]['on'](_0x3950('0x19'),function(){logger[_0x3950('0x8')](_0x3950('0x1a'),_0x1deeb7);clearTimeout(_0x4a4cd5);_0x4a4cd5=undefined;_0x52e3ec[_0x3950('0x1b')]();if(_0xbdfd31[_0x3950('0x18')][_0x1deeb7]){delete _0xbdfd31[_0x3950('0x18')][_0x1deeb7];}_0xf6b92a[_0x3950('0x1c')]();});_0xbdfd31['rules'][_0x1deeb7]['on'](_0x3950('0x1d'),function(){if(_0xbdfd31[_0x3950('0x18')][_0x1deeb7]){delete _0xbdfd31[_0x3950('0x18')][_0x1deeb7];}});_0x4a4cd5=setTimeout(function(){logger['info']('[%s][AGENT]\x20ROUTING\x20END',_0x1deeb7);clearTimeout(_0x4a4cd5);_0x52e3ec['close']();_0xf6b92a['next']();},_0x2df38c);strategy[_0x3950('0x1e')](_0x52e3ec,_0x88234,_0xbdfd31,_0x4a694f);}else{logger[_0x3950('0xd')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x1deeb7,_0x4f8cb4[_0x3950('0xa')]);_0xf6b92a[_0x3950('0x1c')]();}}}catch(_0xf1fcd5){console[_0x3950('0x1f')](_0xf1fcd5);logger[_0x3950('0xd')]('[%s][QUEUE]\x20%s',_0x1deeb7,_0xf1fcd5[_0x3950('0x20')]);_0xf6b92a[_0x3950('0x1c')]();}};}; \ No newline at end of file +var _0xe56d=['timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','consequence','error','[%s][AGENT]\x20%s','map','join','stop','find','agents','timeout','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','[%s][AGENT]\x20ROUTING\x20END','close','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x2e6526,_0xb0680){var _0xb39896=function(_0x5ecdab){while(--_0x5ecdab){_0x2e6526['push'](_0x2e6526['shift']());}};_0xb39896(++_0xb0680);}(_0xe56d,0x1ea));var _0xde56=function(_0x572637,_0x216d95){_0x572637=_0x572637-0x0;var _0xb6748=_0xe56d[_0x572637];return _0xb6748;};'use strict';var schema=require(_0xde56('0x0'));var _=require('lodash');var util=require('util');var seqqueue=require('seq-queue');var logger=require('../../../../config/logger')(_0xde56('0x1'));var strategy=require(_0xde56('0x2'));var queue=schema({'name':{'type':_0xde56('0x3'),'required':!![],'message':_0xde56('0x4')},'timeout':{'type':'number','message':_0xde56('0x5')}});function writeLog(_0x1224e6,_0x2c6d08,_0x13bea9){return logger[_0xde56('0x6')](util[_0xde56('0x7')](_0xde56('0x8'),_0x1224e6,_0x2c6d08['name'],_0x13bea9));}function handleFindAgent(_0x57d3a0){return function(_0x43a20c){return _0x43a20c[_0xde56('0x9')]['toLowerCase']()===_0x57d3a0['toLowerCase']();};}exports[_0xde56('0xa')]=function(_0x377a8a,_0x3f7c8d,_0x2fdf94,_0x350a9e){return function(_0x305c7e){try{var _0x305d5a={'name':_0x3f7c8d[0x0],'timeout':_0x3f7c8d[0x1]};var _0x4f9e31=queue[_0xde56('0x0')](_0x305d5a,{'typecast':!![]});if(_0x4f9e31['length']){logger[_0xde56('0xb')](_0xde56('0xc'),_0x377a8a,_[_0xde56('0xd')](_0x4f9e31,'message')[_0xde56('0xe')](',\x20'));_0x305c7e[_0xde56('0xf')]();}else{var _0x467386=_[_0xde56('0x10')](_0x2fdf94[_0xde56('0x11')],handleFindAgent(_0x305d5a['name']));if(_0x467386){var _0x46577e=(_0x305d5a[_0xde56('0x12')]||0xa)*0x3e8;var _0x4dbe91,_0x285353;var _0x1e2ac9=seqqueue['createQueue'](_0x46577e);_0x1e2ac9['id']=_0x377a8a;_0x1e2ac9[_0xde56('0x13')]=_0x46577e;_0x1e2ac9[_0xde56('0x14')]=_0x350a9e['channel'];writeLog(_0x377a8a,_0x467386,util[_0xde56('0x7')](_0xde56('0x15'),_0x46577e));_0x2fdf94[_0xde56('0x16')][_0x377a8a]['on'](_0xde56('0x17'),function(){logger[_0xde56('0x6')](_0xde56('0x18'),_0x377a8a);clearTimeout(_0x285353);_0x285353=undefined;_0x1e2ac9['close']();if(_0x2fdf94[_0xde56('0x16')][_0x377a8a]){delete _0x2fdf94[_0xde56('0x16')][_0x377a8a];}_0x305c7e[_0xde56('0xf')]();});_0x2fdf94['rules'][_0x377a8a]['on']('complete',function(){if(_0x2fdf94[_0xde56('0x16')][_0x377a8a]){delete _0x2fdf94[_0xde56('0x16')][_0x377a8a];}});_0x285353=setTimeout(function(){logger[_0xde56('0x6')](_0xde56('0x19'),_0x377a8a);clearTimeout(_0x285353);_0x1e2ac9[_0xde56('0x1a')]();_0x305c7e[_0xde56('0x1b')]();},_0x46577e);strategy[_0xde56('0x1c')](_0x1e2ac9,_0x467386,_0x2fdf94,_0x350a9e);}else{logger[_0xde56('0xb')](_0xde56('0x1d'),_0x377a8a,_0x305d5a[_0xde56('0x9')]);_0x305c7e[_0xde56('0xf')]();}}}catch(_0x1eaa20){console[_0xde56('0x1e')](_0x1eaa20);logger['error'](_0xde56('0x1f'),_0x377a8a,_0x1eaa20[_0xde56('0x20')]);_0x305c7e[_0xde56('0xf')]();}};}; \ 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 c77ace0..b9e73dc 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 _0x72e1=['stringify','create','dialogState','Failed','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','[%s][AMAZONLEX]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','interaction','created','isEmpty','body','getMustacheRender','Message','then','info','catch','finally','stop','LexRuntime','$LATEST','toString','postText','error','message','providerName','providerResponse'];(function(_0x5505a5,_0x5693da){var _0x4e2c0c=function(_0x490613){while(--_0x490613){_0x5505a5['push'](_0x5505a5['shift']());}};_0x4e2c0c(++_0x5693da);}(_0x72e1,0x1e4));var _0x172e=function(_0x3a8d4f,_0x53e64f){_0x3a8d4f=_0x3a8d4f-0x0;var _0x3f6418=_0x72e1[_0x3a8d4f];return _0x3f6418;};'use strict';var _=require(_0x172e('0x0'));var moment=require(_0x172e('0x1'));var AWS=require('aws-sdk');var utils=require(_0x172e('0x2'));var logger=require(_0x172e('0x3'))(_0x172e('0x4'));var rpc={'chatMessage':require(_0x172e('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x172e('0x6')),'smsMessage':require(_0x172e('0x7')),'faxMessage':require(_0x172e('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x172e('0x9')]=function(_0x46e597,_0x318aab){return function(_0x2b1d52){try{if(!_['isNil'](this['interaction']['UserId'])){logger['info'](_0x172e('0xa'),_0x46e597,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x2b1d52[_0x172e('0xb')]();}var _0x40e898={'ContactId':this[_0x172e('0xc')]['id'],'sentAt':moment()[_0x172e('0xd')](_0x172e('0xe')),'direction':_0x172e('0xf')};if(this[_0x172e('0x10')]===_0x172e('0x11')||this[_0x172e('0x10')]===_0x172e('0x12')){_0x40e898['phone']=this['interaction'][_0x172e('0x13')];}var _0x3e99e7=this['channel'];if(_0x3e99e7==='chat'){_0x40e898[_0x172e('0x14')]=this['account']['id'];}else{_0x40e898[_[_0x172e('0x15')](_0x3e99e7)+_0x172e('0x16')]=this[_0x172e('0x17')]['id'];}_0x40e898[_[_0x172e('0x15')](_0x3e99e7)+_0x172e('0x18')]=this[_0x172e('0x19')]['id'];if(this['interaction'][_0x172e('0x1a')]){var _0x3693c1=_0x318aab[0x4];if(!_[_0x172e('0x1b')](_0x3693c1)){_0x40e898[_0x172e('0x1c')]=utils[_0x172e('0x1d')](_0x3693c1,this);return rpc[_0x3e99e7+_0x172e('0x1e')]['create'](_0x40e898)[_0x172e('0x1f')](function(_0x1a018a){logger[_0x172e('0x20')](_0x172e('0xa'),_0x46e597,_0x40e898[_0x172e('0x1c')]);})[_0x172e('0x21')](function(_0x352d4b){logger['error'](_0x172e('0xa'),_0x46e597,JSON['stringify'](_0x352d4b));})[_0x172e('0x22')](function(){logger[_0x172e('0x20')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x46e597);_0x2b1d52[_0x172e('0x23')]();});}else{logger[_0x172e('0x20')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x46e597);_0x2b1d52['stop']();}}else{var _0x49c602=this;var _0x46db1e=new AWS[(_0x172e('0x24'))]({'accessKeyId':_0x318aab[0x0],'secretAccessKey':_0x318aab[0x1],'region':_0x318aab[0x2]});var _0x17e8ca={'botAlias':_0x172e('0x25'),'botName':_0x318aab[0x3],'inputText':this['message'][_0x172e('0x1c')],'userId':this[_0x172e('0x10')]+':'+this['interaction']['id'][_0x172e('0x26')]()};_0x46db1e[_0x172e('0x27')](_0x17e8ca,function(_0x3af4b1,_0x8860e){if(_0x3af4b1){logger[_0x172e('0x28')](_0x172e('0xa'),_0x46e597,_0x3af4b1[_0x172e('0x29')]);_0x2b1d52[_0x172e('0xb')]();}else if(_0x8860e&&_0x8860e[_0x172e('0x29')]){_0x49c602[_0x172e('0x1c')]['amazonlex']=_0x8860e;_0x40e898[_0x172e('0x1c')]=_0x8860e[_0x172e('0x29')];_0x40e898[_0x172e('0x2a')]='amazonlex';_0x40e898[_0x172e('0x2b')]=JSON[_0x172e('0x2c')](_0x8860e);return rpc[_0x3e99e7+'Message'][_0x172e('0x2d')](_0x40e898)[_0x172e('0x1f')](function(_0x8b688e){logger[_0x172e('0x20')](_0x172e('0xa'),_0x46e597,_0x40e898[_0x172e('0x1c')]);if(_0x8860e[_0x172e('0x2e')]==_0x172e('0x2f')){_0x2b1d52[_0x172e('0xb')]();}else{_0x2b1d52['stop']();}})['catch'](function(_0x3ec4b4){logger[_0x172e('0x28')]('[%s][AMAZONLEX]\x20%s',_0x46e597,JSON[_0x172e('0x2c')](_0x3ec4b4));_0x2b1d52[_0x172e('0xb')]();});}else{_0x2b1d52['next']();}});}}catch(_0x3ba2f1){logger[_0x172e('0x28')]('[%s][AMAZONLEX]\x20%s',_0x46e597,JSON[_0x172e('0x2c')](_0x3ba2f1));_0x2b1d52[_0x172e('0x23')]();}};}; \ No newline at end of file +var _0x494a=['body','catch','error','[%s][AMAZONLEX]\x20%s','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerName','providerResponse','Message','then','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','created','isEmpty','create'];(function(_0x6f1a87,_0x5d5bcf){var _0x2495c7=function(_0x1c6733){while(--_0x1c6733){_0x6f1a87['push'](_0x6f1a87['shift']());}};_0x2495c7(++_0x5d5bcf);}(_0x494a,0x1a5));var _0xa494=function(_0x133757,_0x5038c2){_0x133757=_0x133757-0x0;var _0x13d944=_0x494a[_0x133757];return _0x13d944;};'use strict';var _=require(_0xa494('0x0'));var moment=require(_0xa494('0x1'));var AWS=require(_0xa494('0x2'));var utils=require(_0xa494('0x3'));var logger=require(_0xa494('0x4'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xa494('0x5')),'mailMessage':require(_0xa494('0x6')),'smsMessage':require(_0xa494('0x7')),'faxMessage':require(_0xa494('0x8')),'whatsappMessage':require(_0xa494('0x9'))};exports[_0xa494('0xa')]=function(_0x1d8221,_0x100c0e){return function(_0x253409){try{if(!_['isNil'](this[_0xa494('0xb')]['UserId'])){logger[_0xa494('0xc')]('[%s][AMAZONLEX]\x20%s',_0x1d8221,_0xa494('0xd'));return _0x253409[_0xa494('0xe')]();}var _0x547687={'ContactId':this[_0xa494('0xf')]['id'],'sentAt':moment()[_0xa494('0x10')](_0xa494('0x11')),'direction':'out'};if(this[_0xa494('0x12')]===_0xa494('0x13')||this[_0xa494('0x12')]===_0xa494('0x14')){_0x547687[_0xa494('0x15')]=this['interaction'][_0xa494('0x15')];}var _0x10f54c=this[_0xa494('0x12')];if(_0x10f54c===_0xa494('0x16')){_0x547687[_0xa494('0x17')]=this[_0xa494('0x18')]['id'];}else{_0x547687[_[_0xa494('0x19')](_0x10f54c)+'AccountId']=this[_0xa494('0x18')]['id'];}_0x547687[_[_0xa494('0x19')](_0x10f54c)+'InteractionId']=this[_0xa494('0xb')]['id'];if(this['interaction'][_0xa494('0x1a')]){var _0x51220b=_0x100c0e[0x4];if(!_[_0xa494('0x1b')](_0x51220b)){_0x547687['body']=utils['getMustacheRender'](_0x51220b,this);return rpc[_0x10f54c+'Message'][_0xa494('0x1c')](_0x547687)['then'](function(_0x314ed3){logger['info']('[%s][AMAZONLEX]\x20%s',_0x1d8221,_0x547687[_0xa494('0x1d')]);})[_0xa494('0x1e')](function(_0x502b2d){logger[_0xa494('0x1f')](_0xa494('0x20'),_0x1d8221,JSON[_0xa494('0x21')](_0x502b2d));})[_0xa494('0x22')](function(){logger[_0xa494('0xc')](_0xa494('0x23'),_0x1d8221);_0x253409[_0xa494('0x24')]();});}else{logger[_0xa494('0xc')](_0xa494('0x25'),_0x1d8221);_0x253409[_0xa494('0x24')]();}}else{var _0x5e7110=this;var _0x2c3c05=new AWS[(_0xa494('0x26'))]({'accessKeyId':_0x100c0e[0x0],'secretAccessKey':_0x100c0e[0x1],'region':_0x100c0e[0x2]});var _0x5993b2={'botAlias':_0xa494('0x27'),'botName':_0x100c0e[0x3],'inputText':this[_0xa494('0x28')][_0xa494('0x1d')],'userId':this[_0xa494('0x12')]+':'+this[_0xa494('0xb')]['id'][_0xa494('0x29')]()};_0x2c3c05[_0xa494('0x2a')](_0x5993b2,function(_0x2b43c9,_0x3f72e1){if(_0x2b43c9){logger[_0xa494('0x1f')](_0xa494('0x20'),_0x1d8221,_0x2b43c9[_0xa494('0x28')]);_0x253409['next']();}else if(_0x3f72e1&&_0x3f72e1[_0xa494('0x28')]){_0x5e7110[_0xa494('0x1d')][_0xa494('0x2b')]=_0x3f72e1;_0x547687[_0xa494('0x1d')]=_0x3f72e1['message'];_0x547687[_0xa494('0x2c')]=_0xa494('0x2b');_0x547687[_0xa494('0x2d')]=JSON['stringify'](_0x3f72e1);return rpc[_0x10f54c+_0xa494('0x2e')][_0xa494('0x1c')](_0x547687)[_0xa494('0x2f')](function(_0x2272b3){logger[_0xa494('0xc')]('[%s][AMAZONLEX]\x20%s',_0x1d8221,_0x547687[_0xa494('0x1d')]);if(_0x3f72e1[_0xa494('0x30')]==_0xa494('0x31')){_0x253409[_0xa494('0xe')]();}else{_0x253409[_0xa494('0x24')]();}})['catch'](function(_0x1a745f){logger['error'](_0xa494('0x20'),_0x1d8221,JSON[_0xa494('0x21')](_0x1a745f));_0x253409[_0xa494('0xe')]();});}else{_0x253409[_0xa494('0xe')]();}});}}catch(_0x598755){logger[_0xa494('0x1f')]('[%s][AMAZONLEX]\x20%s',_0x1d8221,JSON['stringify'](_0x598755));_0x253409['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 03db2b7..8d19f4f 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 _0x15ce=['../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','Autoreply\x20already\x20sent','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','account','AccountId','upperFirst','Message','inReplyTo','html','','replace','','headers','All','auto_reply','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','autoreplyExecuted','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','Interaction','stop','moment','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage'];(function(_0x3080c0,_0x2ba0d7){var _0x350a2c=function(_0x462989){while(--_0x462989){_0x3080c0['push'](_0x3080c0['shift']());}};_0x350a2c(++_0x2ba0d7);}(_0x15ce,0x15c));var _0xe15c=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x15ce[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var moment=require(_0xe15c('0x0'));var utils=require(_0xe15c('0x1'));var logger=require('../../../../config/logger')(_0xe15c('0x2'));var rpc={'chatMessage':require(_0xe15c('0x3')),'openchannelMessage':require(_0xe15c('0x4')),'mailMessage':require(_0xe15c('0x5')),'smsMessage':require(_0xe15c('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0xe15c('0x7')),'openchannelInteraction':require(_0xe15c('0x8')),'mailInteraction':require(_0xe15c('0x9')),'smsInteraction':require(_0xe15c('0xa')),'faxInteraction':require(_0xe15c('0xb')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0xe15c('0xc'));exports[_0xe15c('0xd')]=function(_0x4bb67d,_0xabdeb3,_0x1a812b,_0x1c4431){return function(_0x45963a){try{var _0x234015=this[_0xe15c('0xe')];if(_0x234015===_0xe15c('0xf')&&_0x1c4431[_0xe15c('0x10')][_0xe15c('0x11')]){logger[_0xe15c('0x12')](_0xe15c('0x13'),_0x4bb67d,_0xe15c('0x14'));return _0x45963a[_0xe15c('0x15')]();}if(_0xabdeb3[0x0]==='1'&&(_[_0xe15c('0x16')](this[_0xe15c('0x17')][_0xe15c('0x18')])||!this[_0xe15c('0x17')][_0xe15c('0x18')])){logger[_0xe15c('0x12')](_0xe15c('0x13'),_0x4bb67d,_0xe15c('0x19'));return _0x45963a['next']();}if(_0xabdeb3[0x0]==='2'&&this[_0xe15c('0x17')]['autoreplyExecuted']){logger[_0xe15c('0x12')](_0xe15c('0x1a'),_0x4bb67d,_0xe15c('0x1b'));return _0x45963a['next']();}var _0x44b34e={'ContactId':this[_0xe15c('0x1c')]['id'],'sentAt':moment()[_0xe15c('0x1d')](_0xe15c('0x1e')),'direction':_0xe15c('0x1f')};if(this['channel']==='mail'){_0x44b34e[_0xe15c('0x10')]=utils[_0xe15c('0x20')](_0xabdeb3[0x2],this);}else{_0x44b34e[_0xe15c('0x10')]=utils[_0xe15c('0x20')](_0xabdeb3[0x1],this);}if(this['message']){_0x44b34e['to']=this[_0xe15c('0x21')]['from']||'';if(this[_0xe15c('0xe')]===_0xe15c('0xf')&&_0xabdeb3[0x1]==='1'){_0x44b34e['cc']=this['message']['cc']||'';}_0x44b34e[_0xe15c('0x22')]=this[_0xe15c('0x21')]['to']||'';_0x44b34e['phone']=this[_0xe15c('0x21')][_0xe15c('0x23')]||'';_0x44b34e[_0xe15c('0x24')]=!![];if(this[_0xe15c('0x21')][_0xe15c('0x25')]){_0x44b34e[_0xe15c('0x25')]='';_0x44b34e[_0xe15c('0x25')]+=_[_0xe15c('0x26')](this[_0xe15c('0x21')]['subject'],_0xe15c('0x27'))?'':_0xe15c('0x28');_0x44b34e[_0xe15c('0x25')]+=this[_0xe15c('0x21')][_0xe15c('0x25')];}}if(this[_0xe15c('0xe')]==='chat'){_0x44b34e['ChatWebsiteId']=this[_0xe15c('0x29')]['id'];}else{_0x44b34e[_['upperFirst'](this[_0xe15c('0xe')])+_0xe15c('0x2a')]=this[_0xe15c('0x29')]['id'];}_0x44b34e[_[_0xe15c('0x2b')](this[_0xe15c('0xe')])+'InteractionId']=this[_0xe15c('0x17')]['id'];var _0x31cef6=this[_0xe15c('0x17')];if(rpc[this['channel']+_0xe15c('0x2c')]){if(this[_0xe15c('0xe')]===_0xe15c('0xf')){_0x44b34e[_0xe15c('0x2d')]=this[_0xe15c('0x21')]['messageId'];_0x44b34e[_0xe15c('0x2e')]=_0xe15c('0x2f')+_[_0xe15c('0x30')](_0x44b34e[_0xe15c('0x10')],_0xe15c('0x31'),_0xe15c('0x32'))+_0xe15c('0x33');_0x44b34e[_0xe15c('0x34')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0xe15c('0x35'),'Precedence':_0xe15c('0x36')};return mailRpc['sendMailMessage'](this[_0xe15c('0x29')][_0xe15c('0x37')],_0x44b34e)[_0xe15c('0x38')](function(_0x9b52ee){logger[_0xe15c('0x12')](_0xe15c('0x39'),_0x4bb67d);_0x44b34e[_0xe15c('0x3a')]=_0x9b52ee[_0xe15c('0x21')][_0xe15c('0x3a')];return rpc[_0x234015+_0xe15c('0x2c')][_0xe15c('0x3b')](_0x44b34e);})[_0xe15c('0x38')](function(_0x330892){logger[_0xe15c('0x12')](_0xe15c('0x13'),_0x4bb67d,JSON[_0xe15c('0x3c')](_0x330892));})[_0xe15c('0x3d')](function(_0xf7f19c){logger[_0xe15c('0x3e')](_0xe15c('0x3f'),_0x4bb67d,JSON[_0xe15c('0x3c')](_0xf7f19c));})[_0xe15c('0x40')](function(){Promise[_0xe15c('0x41')]()[_0xe15c('0x38')](function(){if(_0xabdeb3[0x0]!=='2'||_0x31cef6[_0xe15c('0x42')])return;return rpc[_0x234015+'Interaction'][_0xe15c('0x43')](_0x31cef6['id'],{'autoreplyExecuted':!![]})[_0xe15c('0x38')](function(_0x373397){logger[_0xe15c('0x12')](_0xe15c('0x1a'),_0x4bb67d,JSON[_0xe15c('0x3c')](_0x373397));})[_0xe15c('0x3d')](function(_0x453995){logger[_0xe15c('0x3e')](_0xe15c('0x44'),_0x4bb67d,JSON[_0xe15c('0x3c')](_0x453995));});})[_0xe15c('0x38')](function(){_0x45963a[_0xe15c('0x15')]();});});}else{return rpc[this[_0xe15c('0xe')]+_0xe15c('0x2c')][_0xe15c('0x3b')](_0x44b34e)[_0xe15c('0x38')](function(){logger[_0xe15c('0x12')]('[%s][AUTOREPLY]\x20%s',_0x4bb67d,_0x44b34e[_0xe15c('0x10')]);})[_0xe15c('0x3d')](function(_0x5d5a9c){logger[_0xe15c('0x3e')](_0xe15c('0x13'),_0x4bb67d,JSON[_0xe15c('0x3c')](_0x5d5a9c));})['finally'](function(){Promise[_0xe15c('0x41')]()[_0xe15c('0x38')](function(){if(_0xabdeb3[0x0]!=='2'||_0x31cef6[_0xe15c('0x42')])return;return rpc[_0x234015+_0xe15c('0x45')][_0xe15c('0x43')](_0x31cef6['id'],{'autoreplyExecuted':!![]})[_0xe15c('0x38')](function(_0x21c34b){logger['info'](_0xe15c('0x1a'),_0x4bb67d,JSON['stringify'](_0x21c34b));})[_0xe15c('0x3d')](function(_0xc7beac){logger[_0xe15c('0x3e')](_0xe15c('0x44'),_0x4bb67d,JSON[_0xe15c('0x3c')](_0xc7beac));});})[_0xe15c('0x38')](function(){_0x45963a[_0xe15c('0x15')]();});});}}}catch(_0x5ee9cc){logger[_0xe15c('0x3e')]('[%s][AUTOREPLY]\x20%s',_0x4bb67d,JSON[_0xe15c('0x3c')](_0x5ee9cc));_0x45963a[_0xe15c('0x46')]();}};}; \ No newline at end of file +var _0x13e2=['auto_reply','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','stringify','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','format','out','channel','getMustacheRender','message','from','phone','read','subject','Re:','Re:\x20','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','Message','inReplyTo','','headers'];(function(_0x223c46,_0x1447dd){var _0xe78e4c=function(_0x371ac4){while(--_0x371ac4){_0x223c46['push'](_0x223c46['shift']());}};_0xe78e4c(++_0x1447dd);}(_0x13e2,0x14a));var _0x213e=function(_0x577d01,_0x1ec928){_0x577d01=_0x577d01-0x0;var _0x58fcc2=_0x13e2[_0x577d01];return _0x58fcc2;};'use strict';var _=require(_0x213e('0x0'));var moment=require('moment');var utils=require(_0x213e('0x1'));var logger=require(_0x213e('0x2'))('routing');var rpc={'chatMessage':require(_0x213e('0x3')),'openchannelMessage':require(_0x213e('0x4')),'mailMessage':require(_0x213e('0x5')),'smsMessage':require(_0x213e('0x6')),'faxMessage':require(_0x213e('0x7')),'whatsappMessage':require(_0x213e('0x8')),'chatInteraction':require(_0x213e('0x9')),'openchannelInteraction':require(_0x213e('0xa')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x213e('0xb'))};var mailRpc=require(_0x213e('0xc'));exports[_0x213e('0xd')]=function(_0x4d9acf,_0x3ea0ef,_0x12e13e,_0x27f4ff){return function(_0x26d958){try{var _0x4012bc=this['channel'];if(_0x4012bc===_0x213e('0xe')&&_0x27f4ff[_0x213e('0xf')][_0x213e('0x10')]){logger[_0x213e('0x11')](_0x213e('0x12'),_0x4d9acf,_0x213e('0x13'));return _0x26d958[_0x213e('0x14')]();}if(_0x3ea0ef[0x0]==='1'&&(_[_0x213e('0x15')](this['interaction']['created'])||!this[_0x213e('0x16')][_0x213e('0x17')])){logger[_0x213e('0x11')](_0x213e('0x12'),_0x4d9acf,_0x213e('0x18'));return _0x26d958[_0x213e('0x14')]();}if(_0x3ea0ef[0x0]==='2'&&this[_0x213e('0x16')][_0x213e('0x19')]){logger[_0x213e('0x11')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x4d9acf,'One\x20Time\x20already\x20sent');return _0x26d958['next']();}var _0xf47389={'ContactId':this['contact']['id'],'sentAt':moment()[_0x213e('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x213e('0x1b')};if(this[_0x213e('0x1c')]===_0x213e('0xe')){_0xf47389[_0x213e('0xf')]=utils[_0x213e('0x1d')](_0x3ea0ef[0x2],this);}else{_0xf47389['body']=utils['getMustacheRender'](_0x3ea0ef[0x1],this);}if(this[_0x213e('0x1e')]){_0xf47389['to']=this[_0x213e('0x1e')][_0x213e('0x1f')]||'';if(this[_0x213e('0x1c')]===_0x213e('0xe')&&_0x3ea0ef[0x1]==='1'){_0xf47389['cc']=this['message']['cc']||'';}_0xf47389['from']=this[_0x213e('0x1e')]['to']||'';_0xf47389[_0x213e('0x20')]=this[_0x213e('0x1e')][_0x213e('0x20')]||'';_0xf47389[_0x213e('0x21')]=!![];if(this[_0x213e('0x1e')][_0x213e('0x22')]){_0xf47389[_0x213e('0x22')]='';_0xf47389['subject']+=_['startsWith'](this[_0x213e('0x1e')][_0x213e('0x22')],_0x213e('0x23'))?'':_0x213e('0x24');_0xf47389[_0x213e('0x22')]+=this[_0x213e('0x1e')]['subject'];}}if(this['channel']==='chat'){_0xf47389[_0x213e('0x25')]=this[_0x213e('0x26')]['id'];}else{_0xf47389[_['upperFirst'](this[_0x213e('0x1c')])+_0x213e('0x27')]=this[_0x213e('0x26')]['id'];}_0xf47389[_[_0x213e('0x28')](this[_0x213e('0x1c')])+_0x213e('0x29')]=this[_0x213e('0x16')]['id'];var _0x7afa0c=this[_0x213e('0x16')];if(rpc[this[_0x213e('0x1c')]+_0x213e('0x2a')]){if(this[_0x213e('0x1c')]===_0x213e('0xe')){_0xf47389[_0x213e('0x2b')]=this['message']['messageId'];_0xf47389['html']=''+_['replace'](_0xf47389[_0x213e('0xf')],_0x213e('0x2c'),_0x213e('0x2d'))+_0x213e('0x2e');_0xf47389[_0x213e('0x2f')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':'All','Precedence':_0x213e('0x30')};return mailRpc['sendMailMessage'](this[_0x213e('0x26')]['smtpOptions'],_0xf47389)[_0x213e('0x31')](function(_0x523e0c){logger[_0x213e('0x11')](_0x213e('0x32'),_0x4d9acf);_0xf47389[_0x213e('0x33')]=_0x523e0c['message']['messageId'];return rpc[_0x4012bc+'Message']['create'](_0xf47389);})[_0x213e('0x31')](function(_0x5883a3){logger[_0x213e('0x11')](_0x213e('0x12'),_0x4d9acf,JSON['stringify'](_0x5883a3));})[_0x213e('0x34')](function(_0x3f12cb){logger[_0x213e('0x35')](_0x213e('0x36'),_0x4d9acf,JSON['stringify'](_0x3f12cb));})[_0x213e('0x37')](function(){Promise[_0x213e('0x38')]()[_0x213e('0x31')](function(){if(_0x3ea0ef[0x0]!=='2'||_0x7afa0c[_0x213e('0x19')])return;return rpc[_0x4012bc+_0x213e('0x39')][_0x213e('0x3a')](_0x7afa0c['id'],{'autoreplyExecuted':!![]})[_0x213e('0x31')](function(_0x3e3cff){logger[_0x213e('0x11')](_0x213e('0x3b'),_0x4d9acf,JSON[_0x213e('0x3c')](_0x3e3cff));})[_0x213e('0x34')](function(_0x5b410a){logger[_0x213e('0x35')](_0x213e('0x3d'),_0x4d9acf,JSON[_0x213e('0x3c')](_0x5b410a));});})['then'](function(){_0x26d958[_0x213e('0x14')]();});});}else{return rpc[this[_0x213e('0x1c')]+_0x213e('0x2a')]['create'](_0xf47389)[_0x213e('0x31')](function(){logger['info'](_0x213e('0x12'),_0x4d9acf,_0xf47389[_0x213e('0xf')]);})['catch'](function(_0x57a911){logger[_0x213e('0x35')](_0x213e('0x12'),_0x4d9acf,JSON[_0x213e('0x3c')](_0x57a911));})[_0x213e('0x37')](function(){Promise['resolve']()['then'](function(){if(_0x3ea0ef[0x0]!=='2'||_0x7afa0c[_0x213e('0x19')])return;return rpc[_0x4012bc+'Interaction'][_0x213e('0x3a')](_0x7afa0c['id'],{'autoreplyExecuted':!![]})[_0x213e('0x31')](function(_0x5a49e1){logger[_0x213e('0x11')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x4d9acf,JSON[_0x213e('0x3c')](_0x5a49e1));})[_0x213e('0x34')](function(_0x385eeb){logger[_0x213e('0x35')](_0x213e('0x3d'),_0x4d9acf,JSON['stringify'](_0x385eeb));});})['then'](function(){_0x26d958[_0x213e('0x14')]();});});}}}catch(_0x5b6eac){logger[_0x213e('0x35')](_0x213e('0x12'),_0x4d9acf,JSON['stringify'](_0x5b6eac));_0x26d958[_0x213e('0x3e')]();}};}; \ 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 23369fe..0f8aa2d 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 _0x5464=['moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop'];(function(_0x4b3424,_0x2561ae){var _0x553f12=function(_0x117206){while(--_0x117206){_0x4b3424['push'](_0x4b3424['shift']());}};_0x553f12(++_0x2561ae);}(_0x5464,0x1d4));var _0x4546=function(_0x11ff06,_0x3f8701){_0x11ff06=_0x11ff06-0x0;var _0x585c55=_0x5464[_0x11ff06];return _0x585c55;};'use strict';var moment=require(_0x4546('0x0'));var logger=require(_0x4546('0x1'))(_0x4546('0x2'));var rpc={'chatInteraction':require(_0x4546('0x3')),'openchannelInteraction':require(_0x4546('0x4')),'smsInteraction':require(_0x4546('0x5')),'mailInteraction':require(_0x4546('0x6')),'faxInteraction':require(_0x4546('0x7')),'whatsappInteraction':require(_0x4546('0x8'))};exports[_0x4546('0x9')]=function(_0x2e2fb2,_0x47e54d,_0x1f4b79,_0x158092){return function(_0x324499){try{logger[_0x4546('0xa')](_0x4546('0xb'),_0x2e2fb2,_0x47e54d[0x0]);var _0x4b8c9b={'closed':0x1,'closedAt':moment()[_0x4546('0xc')](_0x4546('0xd')),'closeReason':_0x4546('0xe'),'disposition':_0x47e54d[0x0]};if(rpc[_0x158092[_0x4546('0xf')]+'Interaction']){rpc[_0x158092[_0x4546('0xf')]+_0x4546('0x10')][_0x4546('0x11')](_0x158092[_0x4546('0x12')]['id'],_0x4b8c9b)['then'](function(_0x2c05b3){logger[_0x4546('0xa')](_0x4546('0x13'),_0x2e2fb2,_0x158092[_0x4546('0x12')]['id']);})[_0x4546('0x14')](function(_0x5dbb4a){logger[_0x4546('0x15')](_0x4546('0x16'),_0x2e2fb2,JSON[_0x4546('0x17')](_0x5dbb4a));})[_0x4546('0x18')](function(){_0x324499[_0x4546('0x19')]();});}}catch(_0x3ad04f){logger[_0x4546('0x15')](_0x4546('0x16'),_0x2e2fb2,JSON[_0x4546('0x17')](_0x3ad04f));_0x324499[_0x4546('0x19')]();}};}; \ No newline at end of file +var _0x3e7a=['interaction','then','info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','stringify','stop','moment','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','system','Interaction','channel','update'];(function(_0xfa46ae,_0xf8e00e){var _0x24d4e8=function(_0x643bc9){while(--_0x643bc9){_0xfa46ae['push'](_0xfa46ae['shift']());}};_0x24d4e8(++_0xf8e00e);}(_0x3e7a,0x119));var _0xa3e7=function(_0x1db760,_0x545be1){_0x1db760=_0x1db760-0x0;var _0x16cf99=_0x3e7a[_0x1db760];return _0x16cf99;};'use strict';var moment=require(_0xa3e7('0x0'));var logger=require('../../../../config/logger')(_0xa3e7('0x1'));var rpc={'chatInteraction':require(_0xa3e7('0x2')),'openchannelInteraction':require(_0xa3e7('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xa3e7('0x4')),'faxInteraction':require(_0xa3e7('0x5')),'whatsappInteraction':require(_0xa3e7('0x6'))};exports[_0xa3e7('0x7')]=function(_0x8a7737,_0x20cd78,_0x483a19,_0x5b8e4b){return function(_0x522170){try{logger['info'](_0xa3e7('0x8'),_0x8a7737,_0x20cd78[0x0]);var _0x25fa0a={'closed':0x1,'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0xa3e7('0x9'),'disposition':_0x20cd78[0x0]};if(rpc[_0x5b8e4b['channel']+_0xa3e7('0xa')]){rpc[_0x5b8e4b[_0xa3e7('0xb')]+_0xa3e7('0xa')][_0xa3e7('0xc')](_0x5b8e4b[_0xa3e7('0xd')]['id'],_0x25fa0a)[_0xa3e7('0xe')](function(_0x38f9a9){logger[_0xa3e7('0xf')](_0xa3e7('0x10'),_0x8a7737,_0x5b8e4b[_0xa3e7('0xd')]['id']);})[_0xa3e7('0x11')](function(_0x2ee557){logger[_0xa3e7('0x12')]('[%s][CLOSE]\x20%s',_0x8a7737,JSON[_0xa3e7('0x13')](_0x2ee557));})['finally'](function(){_0x522170[_0xa3e7('0x14')]();});}}catch(_0x98b22){logger[_0xa3e7('0x12')]('[%s][CLOSE]\x20%s',_0x8a7737,JSON[_0xa3e7('0x13')](_0x98b22));_0x522170['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 ff1206d..ec58e5a 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 _0xa3eb=['speech','providerName','providerResponse','endConversation','next','stop','catch','lodash','moment','apiai-promise','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','AccountId','InteractionId','isEmpty','getMustacheRender','Message','create','then','body','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','fulfillment'];(function(_0x452dc5,_0x190e1a){var _0x4f3390=function(_0x27fc93){while(--_0x27fc93){_0x452dc5['push'](_0x452dc5['shift']());}};_0x4f3390(++_0x190e1a);}(_0xa3eb,0x1ed));var _0xba3e=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xa3eb[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require(_0xba3e('0x0'));var moment=require(_0xba3e('0x1'));var apiai=require(_0xba3e('0x2'));var md5=require('md5');var utils=require(_0xba3e('0x3'));var logger=require(_0xba3e('0x4'))(_0xba3e('0x5'));var rpc={'chatMessage':require(_0xba3e('0x6')),'openchannelMessage':require(_0xba3e('0x7')),'mailMessage':require(_0xba3e('0x8')),'smsMessage':require(_0xba3e('0x9')),'faxMessage':require(_0xba3e('0xa')),'whatsappMessage':require(_0xba3e('0xb'))};exports[_0xba3e('0xc')]=function(_0xf24b63,_0x426127){return function(_0x3d1403){try{if(!_[_0xba3e('0xd')](this[_0xba3e('0xe')][_0xba3e('0xf')])){logger[_0xba3e('0x10')](_0xba3e('0x11'),_0xf24b63,_0xba3e('0x12'));return _0x3d1403['next']();}var _0xbf982b={'ContactId':this[_0xba3e('0x13')]['id'],'sentAt':moment()[_0xba3e('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xba3e('0x15')};if(this[_0xba3e('0x16')]===_0xba3e('0x17')||this[_0xba3e('0x16')]===_0xba3e('0x18')){_0xbf982b[_0xba3e('0x19')]=this[_0xba3e('0xe')][_0xba3e('0x19')];}var _0x52f412=this['channel'];if(_0x52f412===_0xba3e('0x1a')){_0xbf982b[_0xba3e('0x1b')]=this[_0xba3e('0x1c')]['id'];}else{_0xbf982b[_['upperFirst'](_0x52f412)+_0xba3e('0x1d')]=this[_0xba3e('0x1c')]['id'];}_0xbf982b[_['upperFirst'](_0x52f412)+_0xba3e('0x1e')]=this[_0xba3e('0xe')]['id'];if(this[_0xba3e('0xe')]['created']){var _0x479c75=_0x426127[0x2];if(!_[_0xba3e('0x1f')](_0x479c75)){_0xbf982b['body']=utils[_0xba3e('0x20')](_0x479c75,this);return rpc[_0x52f412+_0xba3e('0x21')][_0xba3e('0x22')](_0xbf982b)[_0xba3e('0x23')](function(_0x241606){logger[_0xba3e('0x10')](_0xba3e('0x11'),_0xf24b63,_0xbf982b[_0xba3e('0x24')]);})['catch'](function(_0x5198b6){logger[_0xba3e('0x25')](_0xba3e('0x11'),_0xf24b63,JSON[_0xba3e('0x26')](_0x5198b6));})[_0xba3e('0x27')](function(){logger[_0xba3e('0x10')](_0xba3e('0x28'),_0xf24b63);_0x3d1403['stop']();});}else{logger[_0xba3e('0x10')](_0xba3e('0x29'),_0xf24b63);_0x3d1403['stop']();}}else{var _0x5ed12e=this;var _0x519c3e=apiai(_0x426127[0x0],{'language':_0x426127[0x1]||'en'});return _0x519c3e[_0xba3e('0x2a')](this[_0xba3e('0x2b')]['body'],{'sessionId':md5(this[_0xba3e('0xe')]['id'])})[_0xba3e('0x23')](function(_0x1c261f){_0x5ed12e[_0xba3e('0x24')][_0xba3e('0x2c')]=_0x1c261f;_0xbf982b[_0xba3e('0x24')]=_0x1c261f[_0xba3e('0x2d')][_0xba3e('0x2e')][_0xba3e('0x2f')];_0xbf982b[_0xba3e('0x30')]=_0xba3e('0x2c');_0xbf982b[_0xba3e('0x31')]=JSON[_0xba3e('0x26')](_0x1c261f);return rpc[_0x52f412+_0xba3e('0x21')]['create'](_0xbf982b)[_0xba3e('0x23')](function(_0x2df332){logger[_0xba3e('0x10')]('[%s][DIALOGFLOW]\x20%s',_0xf24b63,_0xbf982b[_0xba3e('0x24')]);if(_0x1c261f['result']['metadata'][_0xba3e('0x32')]){_0x3d1403[_0xba3e('0x33')]();}else{_0x3d1403[_0xba3e('0x34')]();}})['catch'](function(_0x25bad7){logger[_0xba3e('0x25')](_0xba3e('0x11'),_0xf24b63,JSON[_0xba3e('0x26')](_0x25bad7));_0x3d1403[_0xba3e('0x33')]();});})[_0xba3e('0x35')](function(_0x1cef69){logger[_0xba3e('0x25')](_0xba3e('0x11'),_0xf24b63,_0x1cef69[_0xba3e('0x2b')]);_0x3d1403[_0xba3e('0x33')]();});}}catch(_0x1134f2){logger[_0xba3e('0x25')]('[%s][DIALOGFLOW]\x20%s',_0xf24b63,JSON[_0xba3e('0x26')](_0x1134f2));_0x3d1403[_0xba3e('0x34')]();}};}; \ No newline at end of file +var _0xce22=['../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','next','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','chat','upperFirst','AccountId','account','InteractionId','body','getMustacheRender','Message','create','then','catch','error','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','providerName','providerResponse','metadata','endConversation','lodash','moment','apiai-promise','md5','./utils','routing'];(function(_0x4702ee,_0xaf6a45){var _0x62ca7d=function(_0x5b3af7){while(--_0x5b3af7){_0x4702ee['push'](_0x4702ee['shift']());}};_0x62ca7d(++_0xaf6a45);}(_0xce22,0xea));var _0x2ce2=function(_0x3f10fd,_0x1e6960){_0x3f10fd=_0x3f10fd-0x0;var _0x3e2060=_0xce22[_0x3f10fd];return _0x3e2060;};'use strict';var _=require(_0x2ce2('0x0'));var moment=require(_0x2ce2('0x1'));var apiai=require(_0x2ce2('0x2'));var md5=require(_0x2ce2('0x3'));var utils=require(_0x2ce2('0x4'));var logger=require('../../../../config/logger')(_0x2ce2('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x2ce2('0x6')),'mailMessage':require(_0x2ce2('0x7')),'smsMessage':require(_0x2ce2('0x8')),'faxMessage':require(_0x2ce2('0x9')),'whatsappMessage':require(_0x2ce2('0xa'))};exports[_0x2ce2('0xb')]=function(_0x6515b5,_0x4d0c17){return function(_0x225737){try{if(!_[_0x2ce2('0xc')](this[_0x2ce2('0xd')][_0x2ce2('0xe')])){logger[_0x2ce2('0xf')](_0x2ce2('0x10'),_0x6515b5,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x225737[_0x2ce2('0x11')]();}var _0x3c2e05={'ContactId':this['contact']['id'],'sentAt':moment()[_0x2ce2('0x12')](_0x2ce2('0x13')),'direction':'out'};if(this[_0x2ce2('0x14')]===_0x2ce2('0x15')||this[_0x2ce2('0x14')]===_0x2ce2('0x16')){_0x3c2e05['phone']=this[_0x2ce2('0xd')][_0x2ce2('0x17')];}var _0x2b7e86=this['channel'];if(_0x2b7e86===_0x2ce2('0x18')){_0x3c2e05['ChatWebsiteId']=this['account']['id'];}else{_0x3c2e05[_[_0x2ce2('0x19')](_0x2b7e86)+_0x2ce2('0x1a')]=this[_0x2ce2('0x1b')]['id'];}_0x3c2e05[_[_0x2ce2('0x19')](_0x2b7e86)+_0x2ce2('0x1c')]=this[_0x2ce2('0xd')]['id'];if(this[_0x2ce2('0xd')]['created']){var _0x4d0a0f=_0x4d0c17[0x2];if(!_['isEmpty'](_0x4d0a0f)){_0x3c2e05[_0x2ce2('0x1d')]=utils[_0x2ce2('0x1e')](_0x4d0a0f,this);return rpc[_0x2b7e86+_0x2ce2('0x1f')][_0x2ce2('0x20')](_0x3c2e05)[_0x2ce2('0x21')](function(_0x560a77){logger[_0x2ce2('0xf')]('[%s][DIALOGFLOW]\x20%s',_0x6515b5,_0x3c2e05[_0x2ce2('0x1d')]);})[_0x2ce2('0x22')](function(_0x1da7db){logger[_0x2ce2('0x23')](_0x2ce2('0x10'),_0x6515b5,JSON[_0x2ce2('0x24')](_0x1da7db));})['finally'](function(){logger['info'](_0x2ce2('0x25'),_0x6515b5);_0x225737[_0x2ce2('0x26')]();});}else{logger[_0x2ce2('0xf')](_0x2ce2('0x27'),_0x6515b5);_0x225737['stop']();}}else{var _0x5b2b79=this;var _0x5b0eb3=apiai(_0x4d0c17[0x0],{'language':_0x4d0c17[0x1]||'en'});return _0x5b0eb3[_0x2ce2('0x28')](this[_0x2ce2('0x29')]['body'],{'sessionId':md5(this[_0x2ce2('0xd')]['id'])})[_0x2ce2('0x21')](function(_0x51249f){_0x5b2b79[_0x2ce2('0x1d')][_0x2ce2('0x2a')]=_0x51249f;_0x3c2e05[_0x2ce2('0x1d')]=_0x51249f[_0x2ce2('0x2b')]['fulfillment']['speech'];_0x3c2e05[_0x2ce2('0x2c')]='dialogflow';_0x3c2e05[_0x2ce2('0x2d')]=JSON[_0x2ce2('0x24')](_0x51249f);return rpc[_0x2b7e86+_0x2ce2('0x1f')][_0x2ce2('0x20')](_0x3c2e05)[_0x2ce2('0x21')](function(_0x5a79da){logger['info'](_0x2ce2('0x10'),_0x6515b5,_0x3c2e05['body']);if(_0x51249f[_0x2ce2('0x2b')][_0x2ce2('0x2e')][_0x2ce2('0x2f')]){_0x225737[_0x2ce2('0x11')]();}else{_0x225737[_0x2ce2('0x26')]();}})[_0x2ce2('0x22')](function(_0x4b201e){logger[_0x2ce2('0x23')](_0x2ce2('0x10'),_0x6515b5,JSON[_0x2ce2('0x24')](_0x4b201e));_0x225737[_0x2ce2('0x11')]();});})[_0x2ce2('0x22')](function(_0x104a2e){logger[_0x2ce2('0x23')](_0x2ce2('0x10'),_0x6515b5,_0x104a2e['message']);_0x225737[_0x2ce2('0x11')]();});}}catch(_0x5906e7){logger['error'](_0x2ce2('0x10'),_0x6515b5,JSON[_0x2ce2('0x24')](_0x5906e7));_0x225737['stop']();}};}; \ 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 2248ed7..886c840 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 _0x73ec=['routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','error','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','catch','stringify','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','length','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTDISPLAYNAME','intent','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','dialogflowV2','providerResponse','fulfillmentText','all','message','stack','lodash','dialogflow','md5','moment','bluebird'];(function(_0x5a9965,_0x33a4b2){var _0x4a50b4=function(_0x51cc7a){while(--_0x51cc7a){_0x5a9965['push'](_0x5a9965['shift']());}};_0x4a50b4(++_0x33a4b2);}(_0x73ec,0x1bd));var _0xc73e=function(_0x1a11e7,_0x2d4203){_0x1a11e7=_0x1a11e7-0x0;var _0x50a87d=_0x73ec[_0x1a11e7];return _0x50a87d;};'use strict';var _=require(_0xc73e('0x0'));var dialogflow=require(_0xc73e('0x1'));var md5=require(_0xc73e('0x2'));var moment=require(_0xc73e('0x3'));var Promise=require(_0xc73e('0x4'));var logger=require('../../../../config/logger')(_0xc73e('0x5'));var utils=require('./utils');var rpc={'chatMessage':require(_0xc73e('0x6')),'openchannelMessage':require(_0xc73e('0x7')),'mailMessage':require(_0xc73e('0x8')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xc73e('0x9')),'whatsappMessage':require(_0xc73e('0xa'))};function createMessage(_0x2907c6,_0x32e189,_0x199ddf,_0xdde2b0){return new Promise(function(_0x1cc4a8,_0x3d2aca){var _0x512e2a=_[_0xc73e('0xb')](_0x199ddf);_0x512e2a[_0xc73e('0xc')]=_0xdde2b0;return rpc[_0x32e189+_0xc73e('0xd')][_0xc73e('0xe')](_0x512e2a)[_0xc73e('0xf')](function(){logger[_0xc73e('0x10')](_0xc73e('0x11'),_0x2907c6,_0x512e2a[_0xc73e('0xc')]);_0x1cc4a8();})['catch'](function(_0x11d4b1){logger[_0xc73e('0x12')]('[%s][DIALOGFLOWV2]\x20%s',_0x2907c6,JSON['stringify'](_0x11d4b1));_0x3d2aca(_0x11d4b1);});});}exports[_0xc73e('0x13')]=function(_0x1a2290,_0x19c19a){return function(_0x5ab854){try{if(!_[_0xc73e('0x14')](this[_0xc73e('0x15')][_0xc73e('0x16')])){logger[_0xc73e('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x1a2290,_0xc73e('0x17'));return _0x5ab854[_0xc73e('0x18')]();}var _0x3502a6={'ContactId':this[_0xc73e('0x19')]['id'],'sentAt':moment()[_0xc73e('0x1a')](_0xc73e('0x1b')),'direction':_0xc73e('0x1c')};if(this[_0xc73e('0x1d')]===_0xc73e('0x1e')||this[_0xc73e('0x1d')]===_0xc73e('0x1f')){_0x3502a6[_0xc73e('0x20')]=this[_0xc73e('0x15')]['phone'];}var _0x3151b4=this[_0xc73e('0x1d')];if(_0x3151b4===_0xc73e('0x21')){_0x3502a6['ChatWebsiteId']=this['account']['id'];}else{_0x3502a6[_[_0xc73e('0x22')](_0x3151b4)+_0xc73e('0x23')]=this['account']['id'];}_0x3502a6[_[_0xc73e('0x22')](_0x3151b4)+_0xc73e('0x24')]=this[_0xc73e('0x15')]['id'];if(this[_0xc73e('0x15')][_0xc73e('0x25')]){var _0x56d240=_0x19c19a[0x4];if(!_[_0xc73e('0x26')](_0x56d240)){_0x3502a6['body']=utils[_0xc73e('0x27')](_0x56d240,this);return rpc[_0x3151b4+_0xc73e('0xd')]['create'](_0x3502a6)['then'](function(_0x466326){logger[_0xc73e('0x10')](_0xc73e('0x11'),_0x1a2290,_0x3502a6['body']);})[_0xc73e('0x28')](function(_0x2c6ba6){logger[_0xc73e('0x12')](_0xc73e('0x11'),_0x1a2290,JSON[_0xc73e('0x29')](_0x2c6ba6));})[_0xc73e('0x2a')](function(){logger[_0xc73e('0x10')](_0xc73e('0x2b'),_0x1a2290);_0x5ab854['stop']();});}else{logger['info'](_0xc73e('0x2c'),_0x1a2290);_0x5ab854['stop']();}}else{var _0x39179b=this;var _0x51e811=_0x19c19a[0x2][_0xc73e('0x2d')](/\\n/g,'\x0a');var _0x4346dc={'credentials':{'private_key':_0x51e811,'client_email':_0x19c19a[0x1]}};var _0xc2fa7=new dialogflow[(_0xc73e('0x2e'))](_0x4346dc);var _0x4c2949=_0xc2fa7['sessionPath'](_0x19c19a[0x0],md5(_0x39179b['interaction']['id']));var _0x23634b={'session':_0x4c2949,'queryInput':{'text':{'text':_0x39179b['message'][_0xc73e('0xc')],'languageCode':_0x19c19a[0x3]||'en'}}};return _0xc2fa7['detectIntent'](_0x23634b)['then'](function(_0x47a058){if(_0x47a058&&_0x47a058[_0xc73e('0x2f')]){_0x39179b[_0xc73e('0xc')]['dialogflowV2']=_0x47a058;var _0x47f9c0=_0x47a058[0x0];var _0xcec888=_0x47f9c0[_0xc73e('0x30')][_0xc73e('0x31')]&&_0x47f9c0['queryResult'][_0xc73e('0x31')][_0xc73e('0x32')]?_0x47f9c0[_0xc73e('0x30')][_0xc73e('0x31')]['fields'][_0xc73e('0x33')][_0xc73e('0x34')]:![];_0x39179b[_0xc73e('0xc')][_0xc73e('0x35')]=_0x47f9c0['queryResult'][_0xc73e('0x36')];_0x39179b[_0xc73e('0xc')][_0xc73e('0x37')]=_0x47f9c0['queryResult'][_0xc73e('0x38')];_0x39179b['body'][_0xc73e('0x39')]=_0x47f9c0[_0xc73e('0x30')][_0xc73e('0x31')]&&_0x47f9c0['queryResult'][_0xc73e('0x31')]['fields']?_0x47f9c0['queryResult'][_0xc73e('0x31')][_0xc73e('0x32')][_0xc73e('0x33')][_0xc73e('0x34')]:![];_0x39179b[_0xc73e('0xc')]['DIALOGFLOWV2_INTENTNAME']=_0x47f9c0[_0xc73e('0x30')]['intent']['name'];_0x39179b[_0xc73e('0xc')][_0xc73e('0x3a')]=_0x47f9c0['queryResult'][_0xc73e('0x3b')][_0xc73e('0x3c')];_0x39179b[_0xc73e('0xc')][_0xc73e('0x3d')]=_0x47f9c0['queryResult']['intent'][_0xc73e('0x3e')];_0x39179b[_0xc73e('0xc')][_0xc73e('0x3f')]=_0x47f9c0[_0xc73e('0x30')]['languageCode'];_0x39179b[_0xc73e('0xc')][_0xc73e('0x40')]=_0x47f9c0[_0xc73e('0x30')][_0xc73e('0x41')];_0x39179b[_0xc73e('0xc')][_0xc73e('0x42')]=_0x47f9c0[_0xc73e('0x30')][_0xc73e('0x43')];_0x3502a6[_0xc73e('0x44')]=_0xc73e('0x45');_0x3502a6[_0xc73e('0x46')]=JSON[_0xc73e('0x29')](_0x47a058);var _0x21bbeb=[];for(var _0x21b62f=0x0;_0x21b62f<_0x47a058[_0xc73e('0x2f')];_0x21b62f++){var _0x561005=_0x47a058[_0x21b62f];if(_0x561005&&_0x561005[_0xc73e('0x30')]&&_0x561005[_0xc73e('0x30')][_0xc73e('0x47')]){_0x21bbeb['push'](createMessage(_0x1a2290,_0x3151b4,_0x3502a6,_0x561005[_0xc73e('0x30')][_0xc73e('0x47')]));}}return Promise[_0xc73e('0x48')](_0x21bbeb)[_0xc73e('0xf')](function(){if(_0xcec888){_0x5ab854[_0xc73e('0x18')]();}else{_0x5ab854['stop']();}})[_0xc73e('0x28')](function(_0x2363c8){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x1a2290,JSON[_0xc73e('0x29')](_0x2363c8));_0x5ab854[_0xc73e('0x18')]();});}})[_0xc73e('0x28')](function(_0x40f9e0){logger[_0xc73e('0x12')](_0xc73e('0x11'),_0x1a2290,_0x40f9e0[_0xc73e('0x49')],_0x40f9e0[_0xc73e('0x4a')]);_0x5ab854['next']();});}}catch(_0x57374b){logger[_0xc73e('0x12')]('[%s][DIALOGFLOWV2]\x20%s',_0x1a2290,JSON['stringify'](_0x57374b));_0x5ab854['stop']();}};}; \ No newline at end of file +var _0x0ef6=['sessionPath','message','detectIntent','dialogflowV2','queryResult','diagnosticInfo','fields','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_INTENTNAME','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','push','stack','lodash','dialogflow','bluebird','routing','./utils','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','body','Message','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','stringify','consequence','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','interaction','phone','upperFirst','AccountId','account','InteractionId','created','isEmpty','getMustacheRender','create','error','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','replace','SessionsClient'];(function(_0x4a2536,_0x217bba){var _0x42f914=function(_0x298657){while(--_0x298657){_0x4a2536['push'](_0x4a2536['shift']());}};_0x42f914(++_0x217bba);}(_0x0ef6,0x168));var _0x60ef=function(_0x4bb50a,_0x2fc227){_0x4bb50a=_0x4bb50a-0x0;var _0xccd35d=_0x0ef6[_0x4bb50a];return _0xccd35d;};'use strict';var _=require(_0x60ef('0x0'));var dialogflow=require(_0x60ef('0x1'));var md5=require('md5');var moment=require('moment');var Promise=require(_0x60ef('0x2'));var logger=require('../../../../config/logger')(_0x60ef('0x3'));var utils=require(_0x60ef('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x60ef('0x5')),'mailMessage':require(_0x60ef('0x6')),'smsMessage':require(_0x60ef('0x7')),'faxMessage':require(_0x60ef('0x8')),'whatsappMessage':require(_0x60ef('0x9'))};function createMessage(_0x56a99f,_0x3be5cd,_0x4d4ee5,_0x4050a5){return new Promise(function(_0x25679c,_0x1a94e1){var _0x128d84=_['clone'](_0x4d4ee5);_0x128d84[_0x60ef('0xa')]=_0x4050a5;return rpc[_0x3be5cd+_0x60ef('0xb')]['create'](_0x128d84)[_0x60ef('0xc')](function(){logger[_0x60ef('0xd')](_0x60ef('0xe'),_0x56a99f,_0x128d84[_0x60ef('0xa')]);_0x25679c();})[_0x60ef('0xf')](function(_0xba4e84){logger['error'](_0x60ef('0xe'),_0x56a99f,JSON[_0x60ef('0x10')](_0xba4e84));_0x1a94e1(_0xba4e84);});});}exports[_0x60ef('0x11')]=function(_0x2acc3b,_0x2b08e8){return function(_0x1bd9e4){try{if(!_['isNil'](this['interaction'][_0x60ef('0x12')])){logger[_0x60ef('0xd')]('[%s][DIALOGFLOWV2]\x20%s',_0x2acc3b,_0x60ef('0x13'));return _0x1bd9e4[_0x60ef('0x14')]();}var _0x47f2ef={'ContactId':this[_0x60ef('0x15')]['id'],'sentAt':moment()[_0x60ef('0x16')](_0x60ef('0x17')),'direction':_0x60ef('0x18')};if(this[_0x60ef('0x19')]===_0x60ef('0x1a')||this['channel']==='whatsapp'){_0x47f2ef['phone']=this[_0x60ef('0x1b')][_0x60ef('0x1c')];}var _0xa20e6=this[_0x60ef('0x19')];if(_0xa20e6==='chat'){_0x47f2ef['ChatWebsiteId']=this['account']['id'];}else{_0x47f2ef[_[_0x60ef('0x1d')](_0xa20e6)+_0x60ef('0x1e')]=this[_0x60ef('0x1f')]['id'];}_0x47f2ef[_[_0x60ef('0x1d')](_0xa20e6)+_0x60ef('0x20')]=this[_0x60ef('0x1b')]['id'];if(this['interaction'][_0x60ef('0x21')]){var _0x48486f=_0x2b08e8[0x4];if(!_[_0x60ef('0x22')](_0x48486f)){_0x47f2ef[_0x60ef('0xa')]=utils[_0x60ef('0x23')](_0x48486f,this);return rpc[_0xa20e6+'Message'][_0x60ef('0x24')](_0x47f2ef)['then'](function(_0x39e2cb){logger[_0x60ef('0xd')](_0x60ef('0xe'),_0x2acc3b,_0x47f2ef[_0x60ef('0xa')]);})['catch'](function(_0x3a2ae1){logger[_0x60ef('0x25')](_0x60ef('0xe'),_0x2acc3b,JSON[_0x60ef('0x10')](_0x3a2ae1));})['finally'](function(){logger['info']('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x2acc3b);_0x1bd9e4['stop']();});}else{logger[_0x60ef('0xd')](_0x60ef('0x26'),_0x2acc3b);_0x1bd9e4[_0x60ef('0x27')]();}}else{var _0x5b6c1a=this;var _0x327c50=_0x2b08e8[0x2][_0x60ef('0x28')](/\\n/g,'\x0a');var _0x46cda8={'credentials':{'private_key':_0x327c50,'client_email':_0x2b08e8[0x1]}};var _0x21f439=new dialogflow[(_0x60ef('0x29'))](_0x46cda8);var _0x4d9cbb=_0x21f439[_0x60ef('0x2a')](_0x2b08e8[0x0],md5(_0x5b6c1a[_0x60ef('0x1b')]['id']));var _0x446244={'session':_0x4d9cbb,'queryInput':{'text':{'text':_0x5b6c1a[_0x60ef('0x2b')]['body'],'languageCode':_0x2b08e8[0x3]||'en'}}};return _0x21f439[_0x60ef('0x2c')](_0x446244)['then'](function(_0x2c65da){if(_0x2c65da&&_0x2c65da['length']){_0x5b6c1a[_0x60ef('0xa')][_0x60ef('0x2d')]=_0x2c65da;var _0x4fe1b1=_0x2c65da[0x0];var _0x533c5b=_0x4fe1b1[_0x60ef('0x2e')][_0x60ef('0x2f')]&&_0x4fe1b1['queryResult'][_0x60ef('0x2f')][_0x60ef('0x30')]?_0x4fe1b1[_0x60ef('0x2e')][_0x60ef('0x2f')][_0x60ef('0x30')]['end_conversation'][_0x60ef('0x31')]:![];_0x5b6c1a[_0x60ef('0xa')][_0x60ef('0x32')]=_0x4fe1b1[_0x60ef('0x2e')][_0x60ef('0x33')];_0x5b6c1a[_0x60ef('0xa')][_0x60ef('0x34')]=_0x4fe1b1[_0x60ef('0x2e')]['allRequiredParamsPresent'];_0x5b6c1a[_0x60ef('0xa')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x4fe1b1[_0x60ef('0x2e')][_0x60ef('0x2f')]&&_0x4fe1b1[_0x60ef('0x2e')]['diagnosticInfo']['fields']?_0x4fe1b1['queryResult'][_0x60ef('0x2f')][_0x60ef('0x30')]['end_conversation'][_0x60ef('0x31')]:![];_0x5b6c1a[_0x60ef('0xa')][_0x60ef('0x35')]=_0x4fe1b1[_0x60ef('0x2e')][_0x60ef('0x36')]['name'];_0x5b6c1a[_0x60ef('0xa')][_0x60ef('0x37')]=_0x4fe1b1['queryResult'][_0x60ef('0x36')][_0x60ef('0x38')];_0x5b6c1a[_0x60ef('0xa')][_0x60ef('0x39')]=_0x4fe1b1[_0x60ef('0x2e')]['intent'][_0x60ef('0x3a')];_0x5b6c1a[_0x60ef('0xa')][_0x60ef('0x3b')]=_0x4fe1b1[_0x60ef('0x2e')][_0x60ef('0x3c')];_0x5b6c1a[_0x60ef('0xa')]['DIALOGFLOWV2_QUERYTEXT']=_0x4fe1b1['queryResult']['queryText'];_0x5b6c1a[_0x60ef('0xa')]['DIALOGFLOWV2_SCORE']=_0x4fe1b1[_0x60ef('0x2e')][_0x60ef('0x3d')];_0x47f2ef[_0x60ef('0x3e')]=_0x60ef('0x2d');_0x47f2ef[_0x60ef('0x3f')]=JSON[_0x60ef('0x10')](_0x2c65da);var _0x10efb0=[];for(var _0x3fc531=0x0;_0x3fc531<_0x2c65da['length'];_0x3fc531++){var _0x110fb6=_0x2c65da[_0x3fc531];if(_0x110fb6&&_0x110fb6[_0x60ef('0x2e')]&&_0x110fb6[_0x60ef('0x2e')][_0x60ef('0x40')]){_0x10efb0[_0x60ef('0x41')](createMessage(_0x2acc3b,_0xa20e6,_0x47f2ef,_0x110fb6[_0x60ef('0x2e')][_0x60ef('0x40')]));}}return Promise['all'](_0x10efb0)['then'](function(){if(_0x533c5b){_0x1bd9e4['next']();}else{_0x1bd9e4[_0x60ef('0x27')]();}})[_0x60ef('0xf')](function(_0x465458){logger[_0x60ef('0x25')](_0x60ef('0xe'),_0x2acc3b,JSON['stringify'](_0x465458));_0x1bd9e4['next']();});}})['catch'](function(_0x431250){logger[_0x60ef('0x25')](_0x60ef('0xe'),_0x2acc3b,_0x431250['message'],_0x431250[_0x60ef('0x42')]);_0x1bd9e4[_0x60ef('0x14')]();});}}catch(_0x132de8){logger[_0x60ef('0x25')](_0x60ef('0xe'),_0x2acc3b,JSON[_0x60ef('0x10')](_0x132de8));_0x1bd9e4[_0x60ef('0x27')]();}};}; \ 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 5d802ff..a3f0e32 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 _0xe4d5=['lodash','html-to-text','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','[%s][GOTOIF]\x20%s','map','message','join','stop','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','stringify','validate'];(function(_0x2728ce,_0x244fab){var _0x4b3dae=function(_0x9815ca){while(--_0x9815ca){_0x2728ce['push'](_0x2728ce['shift']());}};_0x4b3dae(++_0x244fab);}(_0xe4d5,0x13f));var _0x5e4d=function(_0x1ec836,_0x1ce2d6){_0x1ec836=_0x1ec836-0x0;var _0x4baf71=_0xe4d5[_0x1ec836];return _0x4baf71;};'use strict';var schema=require(_0x5e4d('0x0'));var _=require(_0x5e4d('0x1'));var htmlToText=require(_0x5e4d('0x2'));var utils=require('./utils');var logger=require(_0x5e4d('0x3'))(_0x5e4d('0x4'));var gotoif=schema({'condition':{'type':_0x5e4d('0x5'),'required':!![],'message':_0x5e4d('0x6')},'priorityTrue':{'type':_0x5e4d('0x7'),'message':_0x5e4d('0x8')},'priorityFalse':{'type':'number','message':_0x5e4d('0x9')}});exports[_0x5e4d('0xa')]=function(_0xa4c6d9,_0x1748cc){return function(_0xe3d65){try{var _0x3e6529={'condition':htmlToText[_0x5e4d('0xb')](utils[_0x5e4d('0xc')](_0x1748cc[0x0],this),{'wordwrap':![]})[_0x5e4d('0xd')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x1748cc[0x1],'priorityFalse':_0x1748cc[0x2]};var _0xef635d=gotoif['validate'](_0x3e6529,{'typecast':!![]});if(_0xef635d[_0x5e4d('0xe')]){logger['error'](_0x5e4d('0xf'),_0xa4c6d9,_[_0x5e4d('0x10')](_0xef635d,_0x5e4d('0x11'))[_0x5e4d('0x12')](',\x20'));_0xe3d65[_0x5e4d('0x13')]();}else{try{var _0x292ca9=eval('('+_0x3e6529['condition']+')');var _0x528a4a=_0x292ca9?_0x3e6529[_0x5e4d('0x14')]:_0x3e6529[_0x5e4d('0x15')];logger[_0x5e4d('0x16')](_0x5e4d('0x17'),_0xa4c6d9,_0x3e6529[_0x5e4d('0x18')],_0x292ca9,_0x528a4a||_0x5e4d('0x19'));if(_0x528a4a){var _0x2e8c3b=_[_0x5e4d('0x1a')](_0xe3d65[_0x5e4d('0x1b')](),{'p':_0x528a4a});if(_0x2e8c3b>=0x0){logger[_0x5e4d('0x16')](_0x5e4d('0x1c'),_0xa4c6d9,_0x528a4a||'next',_0x2e8c3b);_0xe3d65['next'](_0x2e8c3b);}else{logger[_0x5e4d('0x16')](_0x5e4d('0x1d'),_0xa4c6d9,_0x528a4a||_0x5e4d('0x19'));_0xe3d65['stop']();}}else{_0xe3d65['next']();}}catch(_0x13680d){logger[_0x5e4d('0x1e')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0xa4c6d9,_0x13680d[_0x5e4d('0x11')]);_0xe3d65[_0x5e4d('0x13')]();}}}catch(_0x55f71a){logger[_0x5e4d('0x1e')]('[%s][GOTOIF]\x20%s',_0xa4c6d9,JSON[_0x5e4d('0x1f')](_0x55f71a));_0xe3d65[_0x5e4d('0x13')]();}};}; \ No newline at end of file +var _0x9f8d=['findIndex','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','html-to-text','./utils','string','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','message','join','stop','condition','priorityTrue','info','next'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x9f8d,0xc3));var _0xd9f8=function(_0x2cd03c,_0x3f4fb2){_0x2cd03c=_0x2cd03c-0x0;var _0x13c28b=_0x9f8d[_0x2cd03c];return _0x13c28b;};'use strict';var schema=require(_0xd9f8('0x0'));var _=require(_0xd9f8('0x1'));var htmlToText=require(_0xd9f8('0x2'));var utils=require(_0xd9f8('0x3'));var logger=require('../../../../config/logger')('routing');var gotoif=schema({'condition':{'type':_0xd9f8('0x4'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0xd9f8('0x5'),'message':_0xd9f8('0x6')},'priorityFalse':{'type':_0xd9f8('0x5'),'message':_0xd9f8('0x7')}});exports['consequence']=function(_0x3f0517,_0x2fb07b){return function(_0x32243c){try{var _0x3c4060={'condition':htmlToText[_0xd9f8('0x8')](utils[_0xd9f8('0x9')](_0x2fb07b[0x0],this),{'wordwrap':![]})[_0xd9f8('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x2fb07b[0x1],'priorityFalse':_0x2fb07b[0x2]};var _0x44f9b3=gotoif[_0xd9f8('0x0')](_0x3c4060,{'typecast':!![]});if(_0x44f9b3[_0xd9f8('0xb')]){logger[_0xd9f8('0xc')](_0xd9f8('0xd'),_0x3f0517,_['map'](_0x44f9b3,_0xd9f8('0xe'))[_0xd9f8('0xf')](',\x20'));_0x32243c[_0xd9f8('0x10')]();}else{try{var _0x58b021=eval('('+_0x3c4060[_0xd9f8('0x11')]+')');var _0x1cc4a9=_0x58b021?_0x3c4060[_0xd9f8('0x12')]:_0x3c4060['priorityFalse'];logger[_0xd9f8('0x13')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x3f0517,_0x3c4060[_0xd9f8('0x11')],_0x58b021,_0x1cc4a9||_0xd9f8('0x14'));if(_0x1cc4a9){var _0x4a1902=_[_0xd9f8('0x15')](_0x32243c['rules'](),{'p':_0x1cc4a9});if(_0x4a1902>=0x0){logger[_0xd9f8('0x13')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x3f0517,_0x1cc4a9||_0xd9f8('0x14'),_0x4a1902);_0x32243c[_0xd9f8('0x14')](_0x4a1902);}else{logger[_0xd9f8('0x13')](_0xd9f8('0x16'),_0x3f0517,_0x1cc4a9||'next');_0x32243c[_0xd9f8('0x10')]();}}else{_0x32243c[_0xd9f8('0x14')]();}}catch(_0x4f0acb){logger[_0xd9f8('0xc')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x3f0517,_0x4f0acb[_0xd9f8('0xe')]);_0x32243c[_0xd9f8('0x10')]();}}}catch(_0x1bb538){logger[_0xd9f8('0xc')](_0xd9f8('0xd'),_0x3f0517,JSON[_0xd9f8('0x17')](_0x1bb538));_0x32243c[_0xd9f8('0x10')]();}};}; \ 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 c0f750e..d681d9a 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 _0x7d44=['consequence','length','error','[%s][GOTOP]\x20%s','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','[%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','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x7d44,0x135));var _0x47d4=function(_0x495b8c,_0x315470){_0x495b8c=_0x495b8c-0x0;var _0x3aca7a=_0x7d44[_0x495b8c];return _0x3aca7a;};'use strict';var schema=require(_0x47d4('0x0'));var _=require(_0x47d4('0x1'));var logger=require(_0x47d4('0x2'))(_0x47d4('0x3'));var gotop=schema({'priority':{'type':_0x47d4('0x4'),'required':!![],'message':_0x47d4('0x5')}});exports[_0x47d4('0x6')]=function(_0x32d99f,_0x396a50){return function(_0x579011){try{var _0x426941={'priority':_0x396a50[0x0]};var _0x5f1869=gotop['validate'](_0x426941,{'typecast':!![]});if(_0x5f1869[_0x47d4('0x7')]){logger[_0x47d4('0x8')](_0x47d4('0x9'),_0x32d99f,_[_0x47d4('0xa')](_0x5f1869,_0x47d4('0xb'))[_0x47d4('0xc')](',\x20'));_0x579011[_0x47d4('0xd')]();}else{logger[_0x47d4('0xe')](_0x47d4('0xf'),_0x32d99f,_0x426941[_0x47d4('0x10')]);if(_0x426941[_0x47d4('0x10')]){var _0x1a4344=_['findIndex'](_0x579011['rules'](),{'p':_0x426941[_0x47d4('0x10')]});if(_0x1a4344>=0x0){logger[_0x47d4('0xe')](_0x47d4('0x11'),_0x32d99f,_0x426941['priority']||_0x47d4('0x12'),_0x1a4344);_0x579011[_0x47d4('0x12')](_0x1a4344);}else{logger[_0x47d4('0xe')](_0x47d4('0x13'),_0x32d99f,_0x426941[_0x47d4('0x10')]||_0x47d4('0x12'));_0x579011[_0x47d4('0xd')]();}}else{_0x579011['next']();}}}catch(_0x3f8b5d){logger[_0x47d4('0x8')](_0x47d4('0x9'),_0x32d99f,JSON[_0x47d4('0x14')](_0x3f8b5d));_0x579011[_0x47d4('0xd')]();}};}; \ No newline at end of file +var _0x4961=['validate','error','[%s][GOTOP]\x20%s','map','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','lodash','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence'];(function(_0xf51396,_0x1a5403){var _0x99db1f=function(_0x503d07){while(--_0x503d07){_0xf51396['push'](_0xf51396['shift']());}};_0x99db1f(++_0x1a5403);}(_0x4961,0xc9));var _0x1496=function(_0x4b2693,_0x216bfe){_0x4b2693=_0x4b2693-0x0;var _0x332210=_0x4961[_0x4b2693];return _0x332210;};'use strict';var schema=require('validate');var _=require(_0x1496('0x0'));var logger=require('../../../../config/logger')('routing');var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x1496('0x1')}});exports[_0x1496('0x2')]=function(_0x7b4f07,_0x2cec8a){return function(_0x12b126){try{var _0xa4ab2a={'priority':_0x2cec8a[0x0]};var _0x5452b7=gotop[_0x1496('0x3')](_0xa4ab2a,{'typecast':!![]});if(_0x5452b7['length']){logger[_0x1496('0x4')](_0x1496('0x5'),_0x7b4f07,_[_0x1496('0x6')](_0x5452b7,'message')[_0x1496('0x7')](',\x20'));_0x12b126[_0x1496('0x8')]();}else{logger[_0x1496('0x9')](_0x1496('0xa'),_0x7b4f07,_0xa4ab2a[_0x1496('0xb')]);if(_0xa4ab2a[_0x1496('0xb')]){var _0x50bc18=_[_0x1496('0xc')](_0x12b126['rules'](),{'p':_0xa4ab2a[_0x1496('0xb')]});if(_0x50bc18>=0x0){logger[_0x1496('0x9')](_0x1496('0xd'),_0x7b4f07,_0xa4ab2a['priority']||_0x1496('0xe'),_0x50bc18);_0x12b126[_0x1496('0xe')](_0x50bc18);}else{logger[_0x1496('0x9')](_0x1496('0xf'),_0x7b4f07,_0xa4ab2a[_0x1496('0xb')]||'next');_0x12b126[_0x1496('0x8')]();}}else{_0x12b126[_0x1496('0xe')]();}}}catch(_0x16db1a){logger[_0x1496('0x4')](_0x1496('0x5'),_0x7b4f07,JSON[_0x1496('0x10')](_0x16db1a));_0x12b126[_0x1496('0x8')]();}};}; \ 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 7dbf58b..d52d9e9 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 _0x3fe7=['consequence','contact','channel','ChatWebsiteId','account','upperFirst','AccountId','interaction','Message','create','then','[%s][MESSAGE]\x20%s','body','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/smsMessage'];(function(_0x1c3a1a,_0xfa88ee){var _0x37eb4e=function(_0x48c7c0){while(--_0x48c7c0){_0x1c3a1a['push'](_0x1c3a1a['shift']());}};_0x37eb4e(++_0xfa88ee);}(_0x3fe7,0x125));var _0x73fe=function(_0x33feca,_0x2bd9ae){_0x33feca=_0x33feca-0x0;var _0x3c558f=_0x3fe7[_0x33feca];return _0x3c558f;};'use strict';var _=require(_0x73fe('0x0'));var utils=require(_0x73fe('0x1'));var logger=require(_0x73fe('0x2'))(_0x73fe('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x73fe('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x73fe('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x73fe('0x6')]=function(_0x269f7b,_0x556b87){return function(_0x44df50){try{var _0x1bf8c8={'body':utils['getMustacheRender'](_0x556b87[0x0],this),'ContactId':this[_0x73fe('0x7')]['id']};if(this[_0x73fe('0x8')]==='chat'){_0x1bf8c8[_0x73fe('0x9')]=this[_0x73fe('0xa')]['id'];}else{_0x1bf8c8[_[_0x73fe('0xb')](this[_0x73fe('0x8')])+_0x73fe('0xc')]=this[_0x73fe('0xa')]['id'];}_0x1bf8c8[_[_0x73fe('0xb')](this[_0x73fe('0x8')])+'InteractionId']=this[_0x73fe('0xd')]['id'];if(rpc[this[_0x73fe('0x8')]+_0x73fe('0xe')]){return rpc[this[_0x73fe('0x8')]+'Message'][_0x73fe('0xf')](_0x1bf8c8)[_0x73fe('0x10')](function(_0x14be38){logger['info'](_0x73fe('0x11'),_0x269f7b,_0x1bf8c8[_0x73fe('0x12')]);_0x44df50['next']();})[_0x73fe('0x13')](function(_0x434877){logger[_0x73fe('0x14')](_0x73fe('0x11'),_0x269f7b,JSON[_0x73fe('0x15')](_0x434877));_0x44df50['stop']();});}}catch(_0x1e24b1){logger['error'](_0x73fe('0x11'),_0x269f7b,JSON[_0x73fe('0x15')](_0x1e24b1));_0x44df50[_0x73fe('0x16')]();}};}; \ No newline at end of file +var _0xb9fc=['InteractionId','interaction','Message','create','info','[%s][MESSAGE]\x20%s','next','error','stringify','stop','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','contact','channel','chat','account','upperFirst','AccountId'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xb9fc,0x6e));var _0xcb9f=function(_0xfe8d30,_0x2d78af){_0xfe8d30=_0xfe8d30-0x0;var _0x272fd3=_0xb9fc[_0xfe8d30];return _0x272fd3;};'use strict';var _=require('lodash');var utils=require('./utils');var logger=require(_0xcb9f('0x0'))(_0xcb9f('0x1'));var rpc={'chatMessage':require(_0xcb9f('0x2')),'openchannelMessage':require(_0xcb9f('0x3')),'mailMessage':require(_0xcb9f('0x4')),'smsMessage':require(_0xcb9f('0x5')),'faxMessage':require(_0xcb9f('0x6')),'whatsappMessage':require(_0xcb9f('0x7'))};exports['consequence']=function(_0x1ebbb8,_0x564de9){return function(_0x317e21){try{var _0x3420a3={'body':utils[_0xcb9f('0x8')](_0x564de9[0x0],this),'ContactId':this[_0xcb9f('0x9')]['id']};if(this[_0xcb9f('0xa')]===_0xcb9f('0xb')){_0x3420a3['ChatWebsiteId']=this[_0xcb9f('0xc')]['id'];}else{_0x3420a3[_[_0xcb9f('0xd')](this[_0xcb9f('0xa')])+_0xcb9f('0xe')]=this[_0xcb9f('0xc')]['id'];}_0x3420a3[_['upperFirst'](this['channel'])+_0xcb9f('0xf')]=this[_0xcb9f('0x10')]['id'];if(rpc[this[_0xcb9f('0xa')]+_0xcb9f('0x11')]){return rpc[this[_0xcb9f('0xa')]+_0xcb9f('0x11')][_0xcb9f('0x12')](_0x3420a3)['then'](function(_0xf15aaa){logger[_0xcb9f('0x13')](_0xcb9f('0x14'),_0x1ebbb8,_0x3420a3['body']);_0x317e21[_0xcb9f('0x15')]();})['catch'](function(_0x5c01c8){logger[_0xcb9f('0x16')](_0xcb9f('0x14'),_0x1ebbb8,JSON[_0xcb9f('0x17')](_0x5c01c8));_0x317e21[_0xcb9f('0x18')]();});}}catch(_0x20bb1c){logger[_0xcb9f('0x16')](_0xcb9f('0x14'),_0x1ebbb8,JSON[_0xcb9f('0x17')](_0x20bb1c));_0x317e21[_0xcb9f('0x18')]();}};}; \ 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 3b92ac1..62b83fe 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 _0xfecf=['stop','./utils','../../../../config/logger','routing','consequence','getMustacheRender','[%s][NOOP]\x20%s'];(function(_0x1e808b,_0x2f4083){var _0x298e3a=function(_0x43edb2){while(--_0x43edb2){_0x1e808b['push'](_0x1e808b['shift']());}};_0x298e3a(++_0x2f4083);}(_0xfecf,0x151));var _0xffec=function(_0x1ee563,_0x19e6b8){_0x1ee563=_0x1ee563-0x0;var _0x237ebb=_0xfecf[_0x1ee563];return _0x237ebb;};'use strict';var utils=require(_0xffec('0x0'));var logger=require(_0xffec('0x1'))(_0xffec('0x2'));exports[_0xffec('0x3')]=function(_0x3eff89,_0x3a8dc0){return function(_0x142c43){try{logger['info']('[%s][NOOP]\x20%s',_0x3eff89,utils[_0xffec('0x4')](_0x3a8dc0[0x0],this));_0x142c43['next']();}catch(_0x2338d6){logger['error'](_0xffec('0x5'),_0x3eff89,JSON['stringify'](_0x2338d6));_0x142c43[_0xffec('0x6')]();}};}; \ No newline at end of file +var _0x3316=['error','stringify','stop','../../../../config/logger','routing','info','[%s][NOOP]\x20%s','getMustacheRender','next'];(function(_0x1c414b,_0x1161cf){var _0x1aa0a0=function(_0x4b7703){while(--_0x4b7703){_0x1c414b['push'](_0x1c414b['shift']());}};_0x1aa0a0(++_0x1161cf);}(_0x3316,0x78));var _0x6331=function(_0x32ab72,_0x47dd1b){_0x32ab72=_0x32ab72-0x0;var _0x83eea5=_0x3316[_0x32ab72];return _0x83eea5;};'use strict';var utils=require('./utils');var logger=require(_0x6331('0x0'))(_0x6331('0x1'));exports['consequence']=function(_0x381580,_0x27c08){return function(_0x4e7a4c){try{logger[_0x6331('0x2')](_0x6331('0x3'),_0x381580,utils[_0x6331('0x4')](_0x27c08[0x0],this));_0x4e7a4c[_0x6331('0x5')]();}catch(_0xdee70f){logger[_0x6331('0x6')](_0x6331('0x3'),_0x381580,JSON[_0x6331('0x7')](_0xdee70f));_0x4e7a4c[_0x6331('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 de5ba8d..02c83d4 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 _0x624e=['join','find','LOG\x20~\x20returnfunction\x20~\x20q','timeout','createQueue','atimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','stop','[%s][QUEUE]\x20APPLICATION\x20END','close','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','localhost','account','queue','from','joinAt','emit','queue_id','push','capitalize','format','pick','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','channel','interaction','MessageId','message','chat','AccountId','WebsiteId','info','name','QueueReport','create','catch','error','YYYY-MM-DD\x20HH:mm:ss','accepted','Interaction','update','then','update\x20queue\x20report','log','LOG\x20~\x20endRouting\x20~\x20queue','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map'];(function(_0x1799c7,_0x21fc1f){var _0x1fb260=function(_0x4aec29){while(--_0x4aec29){_0x1799c7['push'](_0x1799c7['shift']());}};_0x1fb260(++_0x21fc1f);}(_0x624e,0xbd));var _0xe624=function(_0x21eaa8,_0x22fd8e){_0x21eaa8=_0x21eaa8-0x0;var _0x3f73d0=_0x624e[_0x21eaa8];return _0x3f73d0;};'use strict';var schema=require(_0xe624('0x0'));var _=require('lodash');var util=require(_0xe624('0x1'));var seqqueue=require(_0xe624('0x2'));var moment=require(_0xe624('0x3'));var Redis=require(_0xe624('0x4'));var config=require(_0xe624('0x5'));var logger=require(_0xe624('0x6'))(_0xe624('0x7'));var strategy=require(_0xe624('0x8'));config[_0xe624('0x9')]=_['defaults'](config[_0xe624('0x9')],{'host':_0xe624('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe624('0x9')]));var attributes=['id','queue_id',_0xe624('0xb'),_0xe624('0xc'),_0xe624('0xd'),_0xe624('0xe')];function emit(_0x2e3858,_0x3ee386,_0x42cf98){io['to'](_0x2e3858)[_0xe624('0xf')](_0x3ee386,_0x42cf98);}function emitChannelQueueInteraction(_0x36c2b9,_0x3a0460,_0x4cb2ad,_0x36de77,_0x34439c,_0x3ba7ee,_0x4357d7,_0x419801){var _0x249e6e=_['clone'](_0x4cb2ad);_0x249e6e[_0xe624('0x10')]=_0x419801;_0x249e6e[_0xe624('0xc')]=_0x3a0460;_0x249e6e[_0xe624('0xb')]=_0x36de77;_0x249e6e['id']=_0x34439c;if(_0x3ba7ee){attributes[_0xe624('0x11')](_[_0xe624('0x12')](_0x36c2b9)+'InteractionId');_0x4357d7[util[_0xe624('0x13')]('%sQueuesWaitingInteractions',_0x36c2b9)][_0x34439c]=_[_0xe624('0x14')](_0x249e6e,attributes);}else{delete _0x4357d7[util[_0xe624('0x13')](_0xe624('0x15'),_0x36c2b9)][_0x34439c];}emit(util[_0xe624('0x13')](_0xe624('0x16'),_0x36c2b9,_0x3a0460),util[_0xe624('0x13')](_0xe624('0x17'),_0x36c2b9,_0x3ba7ee?_0xe624('0x18'):_0xe624('0x19')),_[_0xe624('0x14')](_0x249e6e,attributes));}var rpc={'openchannelQueueReport':require(_0xe624('0x1a')),'mailQueueReport':require(_0xe624('0x1b')),'chatQueueReport':require(_0xe624('0x1c')),'smsQueueReport':require(_0xe624('0x1d')),'faxQueueReport':require(_0xe624('0x1e')),'whatsappQueueReport':require(_0xe624('0x1f')),'chatInteraction':require(_0xe624('0x20')),'faxInteraction':require('../../rpc/faxInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'openchannelInteraction':require(_0xe624('0x21')),'smsInteraction':require('../../rpc/smsInteraction'),'whatsappInteraction':require(_0xe624('0x22'))};var queue=schema({'name':{'type':_0xe624('0x23'),'required':!![],'message':_0xe624('0x24')},'timeout':{'type':'number','message':_0xe624('0x25')}});function startRouting(_0x29697f,_0xa4e28c,_0x36ef27,_0x12aee1){if(_0x29697f&&_0xa4e28c&&_0x36ef27){_0xa4e28c[_0xe624('0x26')]+=0x1;var _0x3c6a1e={'uniqueid':_0x29697f,'from':_0x36ef27[_0xe624('0x27')]?_0x36ef27['body'][_0xe624('0xd')]:'','joinAt':moment()[_0xe624('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x36ef27[_0xe624('0x28')]?_0x36ef27[_0xe624('0x28')]['id']:null,'ListId':_0x36ef27[_0xe624('0x29')]?_0x36ef27[_0xe624('0x29')]['id']:null};_0x3c6a1e[_[_0xe624('0x2a')](_0x36ef27['channel'])+'QueueId']=_0xa4e28c['id']||null;_0x3c6a1e[_['upperFirst'](_0x36ef27[_0xe624('0x2b')])+'InteractionId']=_0x36ef27[_0xe624('0x2c')]?_0x36ef27['interaction']['id']:null;_0x3c6a1e[_[_0xe624('0x2a')](_0x36ef27[_0xe624('0x2b')])+_0xe624('0x2d')]=_0x36ef27[_0xe624('0x2e')]?_0x36ef27[_0xe624('0x2e')]['id']:null;_0x3c6a1e[_['upperFirst'](_0x36ef27[_0xe624('0x2b')])+(_0x36ef27['channel']!==_0xe624('0x2f')?_0xe624('0x30'):_0xe624('0x31'))]=_0x36ef27[_0xe624('0xb')]?_0x36ef27['account']['id']:null;logger[_0xe624('0x32')](util[_0xe624('0x13')]('[%s][START:QUEUE][NAME:%s]',_0x29697f,_0xa4e28c[_0xe624('0x33')]));emitChannelQueueInteraction(_0x36ef27[_0xe624('0x2b')],_0xa4e28c['name'],_0x3c6a1e,_0x36ef27['account'][_0xe624('0x33')],_0x36ef27[_0xe624('0x2e')]['id'],!![],_0x12aee1,_0xa4e28c['id']);if(rpc[_0x36ef27[_0xe624('0x2b')]+'QueueReport']){return rpc[_0x36ef27[_0xe624('0x2b')]+_0xe624('0x34')][_0xe624('0x35')](_0x3c6a1e)[_0xe624('0x36')](function(_0x10dc55){logger[_0xe624('0x37')]('create\x20queue\x20report');});}}}function stopRouting(_0x34f080,_0x954844,_0x212d59,_0x770a64){if(_0x34f080&&_0x954844){_0x954844[_0xe624('0x26')]-=0x1;var _0x4eec32={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0xe624('0x13')](_0xe624('0x38')),'reason':_0xe624('0x39')};logger[_0xe624('0x32')](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x34f080,_0x954844[_0xe624('0x33')]));emitChannelQueueInteraction(_0x212d59[_0xe624('0x2b')],_0x954844[_0xe624('0x33')],_0x212d59[_0xe624('0x27')],_0x212d59['account'][_0xe624('0x33')],_0x212d59['message']['id'],![],_0x770a64,_0x954844['id']);return rpc[_0x212d59[_0xe624('0x2b')]+_0xe624('0x3a')][_0xe624('0x3b')](_0x212d59[_0xe624('0x2c')]['id'],{'queueId':_0x954844['id']})[_0xe624('0x3c')](function(){if(rpc[_0x212d59[_0xe624('0x2b')]+_0xe624('0x34')]){return rpc[_0x212d59[_0xe624('0x2b')]+_0xe624('0x34')]['update'](_0x34f080,_0x4eec32)['catch'](function(_0x56da17){logger[_0xe624('0x37')](_0xe624('0x3d'));});}});}}function endRouting(_0x371438,_0x3d7b86,_0x3c3ef3,_0x427989){if(_0x371438&&_0x3d7b86){_0x3d7b86[_0xe624('0x26')]-=0x1;var _0x307fe6={'leaveAt':moment()[_0xe624('0x13')](_0xe624('0x38')),'exitAt':moment()[_0xe624('0x13')](_0xe624('0x38')),'reason':'timeout'};logger[_0xe624('0x32')](util[_0xe624('0x13')]('[%s][END:QUEUE][NAME:%s]',_0x371438,_0x3d7b86['name']));emitChannelQueueInteraction(_0x3c3ef3['channel'],_0x3d7b86['name'],_0x3c3ef3[_0xe624('0x27')],_0x3c3ef3[_0xe624('0xb')][_0xe624('0x33')],_0x3c3ef3[_0xe624('0x2e')]['id'],![],_0x427989);console[_0xe624('0x3e')](_0xe624('0x3f'),_0x3d7b86);if(rpc[_0x3c3ef3['channel']+_0xe624('0x34')]){return rpc[_0x3c3ef3['channel']+_0xe624('0x34')][_0xe624('0x3b')](_0x371438,_0x307fe6)[_0xe624('0x36')](function(_0x4ce389){logger[_0xe624('0x37')](_0xe624('0x3d'));});}}}function handleFindQueue(_0x2c840b){return function(_0x2eda16){return _0x2eda16[_0xe624('0x33')][_0xe624('0x40')]()===_0x2c840b[_0xe624('0x40')]();};}exports[_0xe624('0x41')]=function(_0x383c88,_0x8e9d66,_0x3a52,_0xb1740e){return function(_0x346f64){try{var _0x5074d4={'name':_0x8e9d66[0x0],'timeout':_0x8e9d66[0x1]};var _0x3dac36=queue['validate'](_0x5074d4,{'typecast':!![]});if(_0x3dac36[_0xe624('0x42')]){logger[_0xe624('0x37')](_0xe624('0x43'),_0x383c88,_[_0xe624('0x44')](_0x3dac36,_0xe624('0x2e'))[_0xe624('0x45')](',\x20'));_0x346f64['stop']();}else{var _0x3b4e68=_[_0xe624('0x46')](_0x3a52[_0xb1740e[_0xe624('0x2b')]+'Queues'],handleFindQueue(_0x5074d4[_0xe624('0x33')]));console[_0xe624('0x3e')](_0xe624('0x47'),_0x3b4e68);if(_0x3b4e68){startRouting(_0x383c88,_0x3b4e68,_0xb1740e,_0x3a52);var _0x570524=(_0x3b4e68['timeout']||0xa)*0x3e8;var _0x18ddd6=(_0x5074d4[_0xe624('0x48')]||0x14)*0x3e8;var _0x326193;if(_0x570524>_0x18ddd6){_0x18ddd6=_0x570524;}var _0x124bc8=seqqueue[_0xe624('0x49')](_0x570524);_0x124bc8['id']=_0x383c88;_0x124bc8[_0xe624('0x4a')]=_0x570524;_0x124bc8['qtimeout']=_0x18ddd6;_0x124bc8[_0xe624('0x2b')]=_0xb1740e[_0xe624('0x2b')];_0x3a52[_0xe624('0x4b')][_0x383c88]['on']('end',function(){logger['info'](_0xe624('0x4c'),_0x383c88);stopRouting(_0x383c88,_0x3b4e68,_0xb1740e,_0x3a52);clearTimeout(_0x326193);_0x326193=undefined;_0x124bc8['close'](!![]);if(_0x3a52[_0xe624('0x4b')][_0x383c88]){delete _0x3a52['rules'][_0x383c88];}_0x346f64[_0xe624('0x4d')]();});_0x3a52[_0xe624('0x4b')][_0x383c88]['on']('complete',function(){if(_0x3a52[_0xe624('0x4b')][_0x383c88]){delete _0x3a52[_0xe624('0x4b')][_0x383c88];}});_0x326193=setTimeout(function(){logger['info'](_0xe624('0x4e'),_0x383c88);endRouting(_0x383c88,_0x3b4e68,_0xb1740e,_0x3a52);clearTimeout(_0x326193);_0x124bc8[_0xe624('0x4f')](!![]);_0x346f64[_0xe624('0x50')]();},_0x18ddd6);switch(_0x3b4e68[_0xe624('0x51')]){case _0xe624('0x52'):strategy[_0xe624('0x52')](_0x124bc8,_0x3b4e68,_0x3a52,_0xb1740e);break;default:strategy[_0xe624('0x53')](_0x124bc8,_0x3b4e68,_0x3a52,_0xb1740e);}}else{logger[_0xe624('0x37')](_0xe624('0x54'),_0x383c88,_0x5074d4[_0xe624('0x33')]);_0x346f64[_0xe624('0x4d')]();}}}catch(_0x4b04d5){console['log'](_0x4b04d5);logger[_0xe624('0x37')](_0xe624('0x43'),_0x383c88,_0x4b04d5[_0xe624('0x55')]);_0x346f64[_0xe624('0x4d')]();}};}; \ No newline at end of file +var _0x5c2a=['length','[%s][QUEUE]\x20%s','map','join','Queues','LOG\x20~\x20returnfunction\x20~\x20q','createQueue','atimeout','qtimeout','rules','end','close','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','rrmemory','beepall','validate','lodash','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','queue','joinAt','emit','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/faxQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','MessageId','message','chat','AccountId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','error','timeout','log','LOG\x20~\x20endRouting\x20~\x20queue','catch','toLowerCase','consequence'];(function(_0x2c1f76,_0x23ba84){var _0x2107ee=function(_0x5d1b2a){while(--_0x5d1b2a){_0x2c1f76['push'](_0x2c1f76['shift']());}};_0x2107ee(++_0x23ba84);}(_0x5c2a,0x16d));var _0xa5c2=function(_0x21b36c,_0x543483){_0x21b36c=_0x21b36c-0x0;var _0x236627=_0x5c2a[_0x21b36c];return _0x236627;};'use strict';var schema=require(_0xa5c2('0x0'));var _=require(_0xa5c2('0x1'));var util=require('util');var seqqueue=require(_0xa5c2('0x2'));var moment=require(_0xa5c2('0x3'));var Redis=require(_0xa5c2('0x4'));var config=require(_0xa5c2('0x5'));var logger=require(_0xa5c2('0x6'))(_0xa5c2('0x7'));var strategy=require(_0xa5c2('0x8'));config[_0xa5c2('0x9')]=_[_0xa5c2('0xa')](config[_0xa5c2('0x9')],{'host':_0xa5c2('0xb'),'port':0x18eb});var io=require(_0xa5c2('0xc'))(new Redis(config['redis']));var attributes=['id',_0xa5c2('0xd'),'account',_0xa5c2('0xe'),'from',_0xa5c2('0xf')];function emit(_0x3554e3,_0x355331,_0x219eb2){io['to'](_0x3554e3)[_0xa5c2('0x10')](_0x355331,_0x219eb2);}function emitChannelQueueInteraction(_0xbf6720,_0x4f22be,_0x1e74d8,_0x3469ab,_0x35ae5e,_0x5c27e4,_0x26831f,_0x2ef4e0){var _0x4ff89f=_['clone'](_0x1e74d8);_0x4ff89f[_0xa5c2('0xd')]=_0x2ef4e0;_0x4ff89f[_0xa5c2('0xe')]=_0x4f22be;_0x4ff89f[_0xa5c2('0x11')]=_0x3469ab;_0x4ff89f['id']=_0x35ae5e;if(_0x5c27e4){attributes[_0xa5c2('0x12')](_[_0xa5c2('0x13')](_0xbf6720)+_0xa5c2('0x14'));_0x26831f[util[_0xa5c2('0x15')](_0xa5c2('0x16'),_0xbf6720)][_0x35ae5e]=_[_0xa5c2('0x17')](_0x4ff89f,attributes);}else{delete _0x26831f[util[_0xa5c2('0x15')]('%sQueuesWaitingInteractions',_0xbf6720)][_0x35ae5e];}emit(util[_0xa5c2('0x15')](_0xa5c2('0x18'),_0xbf6720,_0x4f22be),util[_0xa5c2('0x15')](_0xa5c2('0x19'),_0xbf6720,_0x5c27e4?'save':_0xa5c2('0x1a')),_[_0xa5c2('0x17')](_0x4ff89f,attributes));}var rpc={'openchannelQueueReport':require(_0xa5c2('0x1b')),'mailQueueReport':require(_0xa5c2('0x1c')),'chatQueueReport':require(_0xa5c2('0x1d')),'smsQueueReport':require(_0xa5c2('0x1e')),'faxQueueReport':require(_0xa5c2('0x1f')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport'),'chatInteraction':require(_0xa5c2('0x20')),'faxInteraction':require(_0xa5c2('0x21')),'mailInteraction':require(_0xa5c2('0x22')),'openchannelInteraction':require(_0xa5c2('0x23')),'smsInteraction':require(_0xa5c2('0x24')),'whatsappInteraction':require(_0xa5c2('0x25'))};var queue=schema({'name':{'type':_0xa5c2('0x26'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x5adad4,_0x741275,_0x7162ea,_0x375b92){if(_0x5adad4&&_0x741275&&_0x7162ea){_0x741275[_0xa5c2('0x27')]+=0x1;var _0x81dafe={'uniqueid':_0x5adad4,'from':_0x7162ea['body']?_0x7162ea[_0xa5c2('0x28')]['from']:'','joinAt':moment()[_0xa5c2('0x15')](_0xa5c2('0x29')),'ContactId':_0x7162ea[_0xa5c2('0x2a')]?_0x7162ea[_0xa5c2('0x2a')]['id']:null,'ListId':_0x7162ea[_0xa5c2('0x2b')]?_0x7162ea[_0xa5c2('0x2b')]['id']:null};_0x81dafe[_[_0xa5c2('0x2c')](_0x7162ea[_0xa5c2('0x2d')])+_0xa5c2('0x2e')]=_0x741275['id']||null;_0x81dafe[_[_0xa5c2('0x2c')](_0x7162ea[_0xa5c2('0x2d')])+_0xa5c2('0x14')]=_0x7162ea[_0xa5c2('0x2f')]?_0x7162ea['interaction']['id']:null;_0x81dafe[_[_0xa5c2('0x2c')](_0x7162ea[_0xa5c2('0x2d')])+_0xa5c2('0x30')]=_0x7162ea[_0xa5c2('0x31')]?_0x7162ea['message']['id']:null;_0x81dafe[_[_0xa5c2('0x2c')](_0x7162ea[_0xa5c2('0x2d')])+(_0x7162ea['channel']!==_0xa5c2('0x32')?_0xa5c2('0x33'):'WebsiteId')]=_0x7162ea['account']?_0x7162ea[_0xa5c2('0x11')]['id']:null;logger[_0xa5c2('0x34')](util[_0xa5c2('0x15')](_0xa5c2('0x35'),_0x5adad4,_0x741275[_0xa5c2('0x36')]));emitChannelQueueInteraction(_0x7162ea[_0xa5c2('0x2d')],_0x741275[_0xa5c2('0x36')],_0x81dafe,_0x7162ea[_0xa5c2('0x11')]['name'],_0x7162ea[_0xa5c2('0x31')]['id'],!![],_0x375b92,_0x741275['id']);if(rpc[_0x7162ea[_0xa5c2('0x2d')]+_0xa5c2('0x37')]){return rpc[_0x7162ea[_0xa5c2('0x2d')]+_0xa5c2('0x37')][_0xa5c2('0x38')](_0x81dafe)['catch'](function(_0x59754b){logger['error'](_0xa5c2('0x39'));});}}}function stopRouting(_0x4fee3b,_0x574df2,_0x4e3059,_0x5b7393){if(_0x4fee3b&&_0x574df2){_0x574df2[_0xa5c2('0x27')]-=0x1;var _0x20b5b7={'leaveAt':moment()[_0xa5c2('0x15')](_0xa5c2('0x29')),'acceptAt':moment()['format'](_0xa5c2('0x29')),'reason':_0xa5c2('0x3a')};logger[_0xa5c2('0x34')](util[_0xa5c2('0x15')](_0xa5c2('0x3b'),_0x4fee3b,_0x574df2[_0xa5c2('0x36')]));emitChannelQueueInteraction(_0x4e3059[_0xa5c2('0x2d')],_0x574df2[_0xa5c2('0x36')],_0x4e3059[_0xa5c2('0x28')],_0x4e3059['account']['name'],_0x4e3059[_0xa5c2('0x31')]['id'],![],_0x5b7393,_0x574df2['id']);return rpc[_0x4e3059[_0xa5c2('0x2d')]+_0xa5c2('0x3c')][_0xa5c2('0x3d')](_0x4e3059[_0xa5c2('0x2f')]['id'],{'queueId':_0x574df2['id']})[_0xa5c2('0x3e')](function(){if(rpc[_0x4e3059['channel']+_0xa5c2('0x37')]){return rpc[_0x4e3059[_0xa5c2('0x2d')]+_0xa5c2('0x37')][_0xa5c2('0x3d')](_0x4fee3b,_0x20b5b7)['catch'](function(_0x30e51e){logger[_0xa5c2('0x3f')]('update\x20queue\x20report');});}});}}function endRouting(_0x58a2be,_0x4d3634,_0x2f886c,_0x1917f7){if(_0x58a2be&&_0x4d3634){_0x4d3634[_0xa5c2('0x27')]-=0x1;var _0x24c47c={'leaveAt':moment()[_0xa5c2('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0xa5c2('0x15')](_0xa5c2('0x29')),'reason':_0xa5c2('0x40')};logger[_0xa5c2('0x34')](util[_0xa5c2('0x15')]('[%s][END:QUEUE][NAME:%s]',_0x58a2be,_0x4d3634[_0xa5c2('0x36')]));emitChannelQueueInteraction(_0x2f886c[_0xa5c2('0x2d')],_0x4d3634[_0xa5c2('0x36')],_0x2f886c['body'],_0x2f886c[_0xa5c2('0x11')][_0xa5c2('0x36')],_0x2f886c[_0xa5c2('0x31')]['id'],![],_0x1917f7);console[_0xa5c2('0x41')](_0xa5c2('0x42'),_0x4d3634);if(rpc[_0x2f886c[_0xa5c2('0x2d')]+_0xa5c2('0x37')]){return rpc[_0x2f886c[_0xa5c2('0x2d')]+_0xa5c2('0x37')]['update'](_0x58a2be,_0x24c47c)[_0xa5c2('0x43')](function(_0x47d054){logger[_0xa5c2('0x3f')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x20520d){return function(_0x3a566b){return _0x3a566b['name'][_0xa5c2('0x44')]()===_0x20520d[_0xa5c2('0x44')]();};}exports[_0xa5c2('0x45')]=function(_0x15fe0a,_0x22e4a2,_0x4bed9e,_0x6af4e1){return function(_0x569f94){try{var _0x13b5dd={'name':_0x22e4a2[0x0],'timeout':_0x22e4a2[0x1]};var _0x3fd69b=queue[_0xa5c2('0x0')](_0x13b5dd,{'typecast':!![]});if(_0x3fd69b[_0xa5c2('0x46')]){logger[_0xa5c2('0x3f')](_0xa5c2('0x47'),_0x15fe0a,_[_0xa5c2('0x48')](_0x3fd69b,_0xa5c2('0x31'))[_0xa5c2('0x49')](',\x20'));_0x569f94['stop']();}else{var _0x322e19=_['find'](_0x4bed9e[_0x6af4e1['channel']+_0xa5c2('0x4a')],handleFindQueue(_0x13b5dd[_0xa5c2('0x36')]));console[_0xa5c2('0x41')](_0xa5c2('0x4b'),_0x322e19);if(_0x322e19){startRouting(_0x15fe0a,_0x322e19,_0x6af4e1,_0x4bed9e);var _0x4ec00d=(_0x322e19[_0xa5c2('0x40')]||0xa)*0x3e8;var _0x21cfa6=(_0x13b5dd[_0xa5c2('0x40')]||0x14)*0x3e8;var _0x4a900d;if(_0x4ec00d>_0x21cfa6){_0x21cfa6=_0x4ec00d;}var _0x3e4c6c=seqqueue[_0xa5c2('0x4c')](_0x4ec00d);_0x3e4c6c['id']=_0x15fe0a;_0x3e4c6c[_0xa5c2('0x4d')]=_0x4ec00d;_0x3e4c6c[_0xa5c2('0x4e')]=_0x21cfa6;_0x3e4c6c['channel']=_0x6af4e1[_0xa5c2('0x2d')];_0x4bed9e[_0xa5c2('0x4f')][_0x15fe0a]['on'](_0xa5c2('0x50'),function(){logger[_0xa5c2('0x34')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x15fe0a);stopRouting(_0x15fe0a,_0x322e19,_0x6af4e1,_0x4bed9e);clearTimeout(_0x4a900d);_0x4a900d=undefined;_0x3e4c6c[_0xa5c2('0x51')](!![]);if(_0x4bed9e[_0xa5c2('0x4f')][_0x15fe0a]){delete _0x4bed9e['rules'][_0x15fe0a];}_0x569f94[_0xa5c2('0x52')]();});_0x4bed9e[_0xa5c2('0x4f')][_0x15fe0a]['on'](_0xa5c2('0x53'),function(){if(_0x4bed9e['rules'][_0x15fe0a]){delete _0x4bed9e[_0xa5c2('0x4f')][_0x15fe0a];}});_0x4a900d=setTimeout(function(){logger[_0xa5c2('0x34')](_0xa5c2('0x54'),_0x15fe0a);endRouting(_0x15fe0a,_0x322e19,_0x6af4e1,_0x4bed9e);clearTimeout(_0x4a900d);_0x3e4c6c[_0xa5c2('0x51')](!![]);_0x569f94['next']();},_0x21cfa6);switch(_0x322e19['strategy']){case'rrmemory':strategy[_0xa5c2('0x55')](_0x3e4c6c,_0x322e19,_0x4bed9e,_0x6af4e1);break;default:strategy[_0xa5c2('0x56')](_0x3e4c6c,_0x322e19,_0x4bed9e,_0x6af4e1);}}else{logger['error']('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x15fe0a,_0x13b5dd['name']);_0x569f94[_0xa5c2('0x52')]();}}}catch(_0x52264a){console[_0xa5c2('0x41')](_0x52264a);logger[_0xa5c2('0x3f')](_0xa5c2('0x47'),_0x15fe0a,_0x52264a['stack']);_0x569f94[_0xa5c2('0x52')]();}};}; \ 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 f15ec46..477d8e8 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 _0x032e=['hideNotification','removeWaitingNotification','STOP','exports','lodash','./util','../../../../../config/logger','notificationId','squeue','agent','realtime','routing','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','saveWaitingNotification','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s'];(function(_0x4a73bf,_0x1912f0){var _0x9122d=function(_0x1c3d29){while(--_0x1c3d29){_0x4a73bf['push'](_0x4a73bf['shift']());}};_0x9122d(++_0x1912f0);}(_0x032e,0x124));var _0xe032=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x032e[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0xe032('0x0'));var uuid=require('uuid');var util=require(_0xe032('0x1'));var logger=require(_0xe032('0x2'))('routing');var Agent=function(_0x4afba2,_0x45ab5b,_0x2ce001,_0x2f44f6){this[_0xe032('0x3')]=uuid['v4']();this[_0xe032('0x4')]=_0x4afba2;this[_0xe032('0x5')]=_0x45ab5b;this[_0xe032('0x6')]=_0x2ce001;this[_0xe032('0x7')]=_0x2f44f6;this[_0xe032('0x4')][_0xe032('0x8')](this[_0xe032('0x9')][_0xe032('0xa')](this),this[_0xe032('0xb')][_0xe032('0xa')](this));this[_0xe032('0x4')]['on'](_0xe032('0xc'),this[_0xe032('0xb')][_0xe032('0xa')](this));this['squeue']['on'](_0xe032('0xd'),this[_0xe032('0xe')][_0xe032('0xa')](this));};Agent[_0xe032('0xf')][_0xe032('0x8')]=function(){this[_0xe032('0x4')][_0xe032('0x8')](this['handleRun'][_0xe032('0xa')](this),this[_0xe032('0xb')][_0xe032('0xa')](this));};Agent[_0xe032('0xf')]['handleDrained']=function(){this[_0xe032('0xb')](!![]);};Agent[_0xe032('0xf')][_0xe032('0x9')]=function(){logger[_0xe032('0x10')](_0xe032('0x11'),this[_0xe032('0x4')]['id'],this[_0xe032('0x5')]['id']);if(_['isNil'](this[_0xe032('0x6')][_0xe032('0x12')][this[_0xe032('0x5')]['id']])){logger[_0xe032('0x10')](_0xe032('0x13'),this[_0xe032('0x4')]['id'],this['agent']['id']);setTimeout(this[_0xe032('0x8')][_0xe032('0xa')](this),0x3e8);}else{if(this[_0xe032('0x7')][_0xe032('0x14')]||util[_0xe032('0x15')](this['squeue']['id'],this['realtime']['agents'][this[_0xe032('0x5')]['id']],this['squeue'][_0xe032('0x16')],![])){this[_0xe032('0x6')][_0xe032('0x12')][this[_0xe032('0x5')]['id']][_0xe032('0x17')]=!![];this[_0xe032('0x6')][_0xe032('0x12')][this['agent']['id']][_0xe032('0x18')]=undefined;util[_0xe032('0x19')](this[_0xe032('0x6')],this[_0xe032('0x7')],this[_0xe032('0x5')],this[_0xe032('0x4')][_0xe032('0x16')]);util[_0xe032('0x1a')](this['notificationId'],this['squeue']['id'],this['realtime'][_0xe032('0x12')][this[_0xe032('0x5')]['id']],null,this[_0xe032('0x7')]);util[_0xe032('0x1b')](this[_0xe032('0x4')]['id'],this[_0xe032('0x6')][_0xe032('0x12')][this[_0xe032('0x5')]['id']],_0xe032('0x1c')+(this[_0xe032('0x7')]['forcedOwnership']?_0xe032('0x1d'):''));}else{logger[_0xe032('0x10')](_0xe032('0x1e'),this[_0xe032('0x4')]['id'],this['agent']['id']);setTimeout(this['push'][_0xe032('0xa')](this),0x3e8);}}};Agent[_0xe032('0xf')][_0xe032('0xb')]=function(_0xae116e){if(_['isNil'](this['realtime']['agents'][this[_0xe032('0x5')]['id']])){return logger[_0xe032('0x10')](_0xe032('0x13'),this[_0xe032('0x4')]['id'],this['agent']['id']);}else{logger[_0xe032('0x10')](_0xe032('0x1f'),this[_0xe032('0x4')]['id'],this[_0xe032('0x5')]['id']);util[_0xe032('0x20')](this['notificationId'],this[_0xe032('0x4')]['id'],this[_0xe032('0x6')][_0xe032('0x12')][this[_0xe032('0x5')]['id']],null,this['routing']);this[_0xe032('0x6')]['agents'][this[_0xe032('0x5')]['id']]['busy']=![];this[_0xe032('0x6')]['agents'][this[_0xe032('0x5')]['id']]['busyQueue']=undefined;util[_0xe032('0x21')](this[_0xe032('0x6')],this['routing'],this[_0xe032('0x5')],this[_0xe032('0x4')][_0xe032('0x16')]);util[_0xe032('0x1b')](this['squeue']['id'],this[_0xe032('0x6')]['agents'][this[_0xe032('0x5')]['id']],_0xae116e?_0xe032('0x22'):'TIMEOUT');}if(!_0xae116e){setTimeout(this[_0xe032('0x8')][_0xe032('0xa')](this),0x3e8);}};function agent(_0x4a4447,_0x3efdef,_0x2cfc49,_0x3cc437){return new Agent(_0x4a4447,_0x3efdef,_0x2cfc49,_0x3cc437);}module[_0xe032('0x23')]=agent; \ No newline at end of file +var _0x7a2c=['squeue','isNil','agents','forcedOwnership','busy','busyQueue','saveWaitingNotification','showNotification','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification','channel','STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','notificationId','agent','realtime','handleRun','bind','handleTimeout','timeout','drained','prototype','push','handleDrained','debug','[%s][AGENT]\x20try\x20with\x20%s'];(function(_0x4b9a37,_0x5d996f){var _0xea8c4a=function(_0x12fa4a){while(--_0x12fa4a){_0x4b9a37['push'](_0x4b9a37['shift']());}};_0xea8c4a(++_0x5d996f);}(_0x7a2c,0x17b));var _0xc7a2=function(_0x1daeb6,_0x4dc75d){_0x1daeb6=_0x1daeb6-0x0;var _0x2f255c=_0x7a2c[_0x1daeb6];return _0x2f255c;};'use strict';var _=require(_0xc7a2('0x0'));var uuid=require('uuid');var util=require(_0xc7a2('0x1'));var logger=require(_0xc7a2('0x2'))(_0xc7a2('0x3'));var Agent=function(_0x26fb61,_0x44d702,_0x2abba8,_0x3f2b0d){this[_0xc7a2('0x4')]=uuid['v4']();this['squeue']=_0x26fb61;this[_0xc7a2('0x5')]=_0x44d702;this[_0xc7a2('0x6')]=_0x2abba8;this['routing']=_0x3f2b0d;this['squeue']['push'](this[_0xc7a2('0x7')][_0xc7a2('0x8')](this),this[_0xc7a2('0x9')][_0xc7a2('0x8')](this));this['squeue']['on'](_0xc7a2('0xa'),this[_0xc7a2('0x9')][_0xc7a2('0x8')](this));this['squeue']['on'](_0xc7a2('0xb'),this['handleDrained'][_0xc7a2('0x8')](this));};Agent[_0xc7a2('0xc')][_0xc7a2('0xd')]=function(){this['squeue'][_0xc7a2('0xd')](this[_0xc7a2('0x7')][_0xc7a2('0x8')](this),this['handleTimeout'][_0xc7a2('0x8')](this));};Agent[_0xc7a2('0xc')][_0xc7a2('0xe')]=function(){this[_0xc7a2('0x9')](!![]);};Agent[_0xc7a2('0xc')][_0xc7a2('0x7')]=function(){logger[_0xc7a2('0xf')](_0xc7a2('0x10'),this[_0xc7a2('0x11')]['id'],this[_0xc7a2('0x5')]['id']);if(_[_0xc7a2('0x12')](this[_0xc7a2('0x6')][_0xc7a2('0x13')][this[_0xc7a2('0x5')]['id']])){logger[_0xc7a2('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xc7a2('0x11')]['id'],this['agent']['id']);setTimeout(this[_0xc7a2('0xd')][_0xc7a2('0x8')](this),0x3e8);}else{if(this[_0xc7a2('0x3')][_0xc7a2('0x14')]||util['isAgentAvailable'](this['squeue']['id'],this[_0xc7a2('0x6')][_0xc7a2('0x13')][this['agent']['id']],this['squeue']['channel'],![])){this[_0xc7a2('0x6')]['agents'][this[_0xc7a2('0x5')]['id']][_0xc7a2('0x15')]=!![];this['realtime'][_0xc7a2('0x13')][this[_0xc7a2('0x5')]['id']][_0xc7a2('0x16')]=undefined;util[_0xc7a2('0x17')](this[_0xc7a2('0x6')],this[_0xc7a2('0x3')],this[_0xc7a2('0x5')],this['squeue']['channel']);util[_0xc7a2('0x18')](this[_0xc7a2('0x4')],this['squeue']['id'],this[_0xc7a2('0x6')][_0xc7a2('0x13')][this[_0xc7a2('0x5')]['id']],null,this[_0xc7a2('0x3')]);util[_0xc7a2('0x19')](this[_0xc7a2('0x11')]['id'],this[_0xc7a2('0x6')][_0xc7a2('0x13')][this['agent']['id']],_0xc7a2('0x1a')+(this['routing'][_0xc7a2('0x14')]?':FORCED':''));}else{logger[_0xc7a2('0xf')](_0xc7a2('0x1b'),this[_0xc7a2('0x11')]['id'],this[_0xc7a2('0x5')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent[_0xc7a2('0xc')][_0xc7a2('0x9')]=function(_0x272c6b){if(_[_0xc7a2('0x12')](this[_0xc7a2('0x6')][_0xc7a2('0x13')][this[_0xc7a2('0x5')]['id']])){return logger['debug'](_0xc7a2('0x1c'),this[_0xc7a2('0x11')]['id'],this['agent']['id']);}else{logger[_0xc7a2('0xf')](_0xc7a2('0x1d'),this[_0xc7a2('0x11')]['id'],this['agent']['id']);util[_0xc7a2('0x1e')](this['notificationId'],this[_0xc7a2('0x11')]['id'],this['realtime']['agents'][this[_0xc7a2('0x5')]['id']],null,this['routing']);this['realtime'][_0xc7a2('0x13')][this['agent']['id']][_0xc7a2('0x15')]=![];this['realtime'][_0xc7a2('0x13')][this[_0xc7a2('0x5')]['id']][_0xc7a2('0x16')]=undefined;util[_0xc7a2('0x1f')](this[_0xc7a2('0x6')],this[_0xc7a2('0x3')],this[_0xc7a2('0x5')],this[_0xc7a2('0x11')][_0xc7a2('0x20')]);util[_0xc7a2('0x19')](this['squeue']['id'],this[_0xc7a2('0x6')][_0xc7a2('0x13')][this['agent']['id']],_0x272c6b?_0xc7a2('0x21'):_0xc7a2('0x22'));}if(!_0x272c6b){setTimeout(this[_0xc7a2('0xd')][_0xc7a2('0x8')](this),0x3e8);}};function agent(_0x178c3e,_0x46a665,_0x3a7845,_0x4972a4){return new Agent(_0x178c3e,_0x46a665,_0x3a7845,_0x4972a4);}module[_0xc7a2('0x23')]=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 82b6a43..dd9d792 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 _0xb8e2=['drained','prototype','handleDrained','isNil','Agents','length','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','squeue','isAgentAvailable','RINGING','busy','busyQueue','saveWaitingNotification','routing','showNotification','notificationId','debug','hideNotification','writeLog','STOP','TIMEOUT','exports','lodash','uuid','./util','queue','realtime','push','handleRun','handleTimeout','bind','timeout'];(function(_0x54edc9,_0x345f01){var _0x2ae7a9=function(_0x24a545){while(--_0x24a545){_0x54edc9['push'](_0x54edc9['shift']());}};_0x2ae7a9(++_0x345f01);}(_0xb8e2,0xdd));var _0x2b8e=function(_0x4a8418,_0x39078a){_0x4a8418=_0x4a8418-0x0;var _0x390174=_0xb8e2[_0x4a8418];return _0x390174;};'use strict';var _=require(_0x2b8e('0x0'));var uuid=require(_0x2b8e('0x1'));var util=require(_0x2b8e('0x2'));var logger=require('../../../../../config/logger')('routing');var Beepall=function(_0x23d0b0,_0xed8a8e,_0x10539a,_0x13b7fd){this['notificationId']=uuid['v4']();this['squeue']=_0x23d0b0;this[_0x2b8e('0x3')]=_0xed8a8e;this[_0x2b8e('0x4')]=_0x10539a;this['routing']=_0x13b7fd;this['squeue'][_0x2b8e('0x5')](this[_0x2b8e('0x6')]['bind'](this),this[_0x2b8e('0x7')][_0x2b8e('0x8')](this));this['squeue']['on'](_0x2b8e('0x9'),this['handleTimeout']['bind'](this));this['squeue']['on'](_0x2b8e('0xa'),this['handleDrained'][_0x2b8e('0x8')](this));};Beepall[_0x2b8e('0xb')][_0x2b8e('0x5')]=function(){this['squeue'][_0x2b8e('0x5')](this['handleRun']['bind'](this),this[_0x2b8e('0x7')][_0x2b8e('0x8')](this));};Beepall[_0x2b8e('0xb')][_0x2b8e('0xc')]=function(){this[_0x2b8e('0x7')](!![]);};Beepall[_0x2b8e('0xb')][_0x2b8e('0x6')]=function(){var _0x412d42=!![];if(!_[_0x2b8e('0xd')](this[_0x2b8e('0x3')])&&!_[_0x2b8e('0xd')](this[_0x2b8e('0x3')][_0x2b8e('0xe')])&&this[_0x2b8e('0x3')][_0x2b8e('0xe')][_0x2b8e('0xf')]>0x0){for(var _0x5a0f11=0x0,_0x2dcb65;_0x5a0f110x0){for(var _0x3a7099=0x0,_0x586e15;_0x3a70990x0&&_0x1a1ab9[_0x13f9b6+_0x7d1f('0x21')]>=_0x1a1ab9[_0x13f9b6+'Capacity']){writeLog(_0x21b79f,_0x1a1ab9,_0x13f9b6[_0x7d1f('0x22')]()+_0x7d1f('0x23'));return![];}}return!![];};exports[_0x7d1f('0x24')]=function(_0x1bf67b,_0x163738,_0x3ae8b1,_0x28348f,_0x24f00f){return sendNotification(!![],_0x1bf67b,_0x163738,_0x3ae8b1,_0x28348f,_0x24f00f);};exports['hideNotification']=function(_0x3070fe,_0x285961,_0xc573bc,_0x8a92a3,_0x4d45b3){return sendNotification(![],_0x3070fe,_0x285961,_0xc573bc,_0x8a92a3,_0x4d45b3);};exports[_0x7d1f('0x25')]=function(_0x19c72a,_0x345f93,_0x77383e){var _0x284688=_0x345f93[_0x7d1f('0x26')]['UserId'];if(!_0x284688&&_0x77383e){_0x284688=_0x77383e['id'];}var _0x508b0e=_[_0x7d1f('0x27')](_0x19c72a[_0x345f93[_0x7d1f('0x28')]+_0x7d1f('0x29')],function(_0x1107fb){var _0x262e90=_['capitalize'](_0x345f93[_0x7d1f('0x28')])+_0x7d1f('0x2a');return _0x1107fb[_0x262e90]===_0x345f93[_0x7d1f('0x26')]['id'];});if(!_0x508b0e&&_0x284688){_0x508b0e=_[_0x7d1f('0x27')](_0x19c72a[_0x7d1f('0x2b')][_0x284688][_0x345f93[_0x7d1f('0x28')]+_0x7d1f('0x2c')],function(_0x2b88ab){return _0x2b88ab['id']===_0x345f93['interaction']['id'];});}return _0x508b0e;};exports[_0x7d1f('0x2d')]=function(_0x172bdb,_0x2dec1d,_0x3ecbaf,_0x25ace9){_0x172bdb['agents'][_0x3ecbaf['id']][_0x25ace9+_0x7d1f('0x2c')][_0x2dec1d['message']['id']]={'id':_0x2dec1d[_0x7d1f('0x26')]['id']};};exports[_0x7d1f('0x2e')]=function(_0x1c8ab3,_0x19f39c,_0x1dba5a,_0x583a12){delete _0x1c8ab3[_0x7d1f('0x2b')][_0x1dba5a['id']][_0x583a12+_0x7d1f('0x2c')][_0x19f39c[_0x7d1f('0x2f')]['id']];};exports['writeLog']=writeLog; \ No newline at end of file +var _0x919f=['isAgentAvailable','BUSY','online','OFFLINE','Pause','PAUSE','Capacity','hasOwnProperty','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','checkWaitingNotifications','interaction','UserId','channel','QueuesWaitingInteractions','InteractionId','some','agents','saveWaitingNotification','WaitingInteractions','message','removeWaitingNotification','writeLog','lodash','util','../utils','ioredis','../../../../../config/logger','routing','redis','localhost','socket.io-emitter','format','user:%s','name','emit','split','\x20interaction','notificationSound','account','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','notification:%s','save','remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x919f,0x170));var _0xf919=function(_0x1e6037,_0x104582){_0x1e6037=_0x1e6037-0x0;var _0x1079f7=_0x919f[_0x1e6037];return _0x1079f7;};'use strict';var _=require(_0xf919('0x0'));var util=require(_0xf919('0x1'));var utils=require(_0xf919('0x2'));var Redis=require(_0xf919('0x3'));var config=require('../../../../../config/environment');var logger=require(_0xf919('0x4'))(_0xf919('0x5'));config[_0xf919('0x6')]=_['defaults'](config['redis'],{'host':_0xf919('0x7'),'port':0x18eb});var io=require(_0xf919('0x8'))(new Redis(config[_0xf919('0x6')]));function sendNotification(_0x206929,_0x54ce72,_0x50718b,_0x90d607,_0x34337a,_0x45b590){io['to'](util[_0xf919('0x9')](_0xf919('0xa'),_0x90d607[_0xf919('0xb')]))[_0xf919('0xc')]('user:save',_0x90d607);var _0x505f73=_0x45b590||{};var _0xdd9030=_0x50718b[_0xf919('0xd')]('.');var _0x554169={'uniqueid':_0x54ce72,'channel':_0xdd9030[0x0],'id':_0xdd9030[0x1],'title':_0xdd9030[0x0]+_0xf919('0xe'),'interactionId':_0xdd9030[0x2],'queue':_0x34337a?_0x34337a[_0xf919('0xb')]:null,'sound':_0x505f73['account'][_0xf919('0xf')],'shake':_0x505f73[_0xf919('0x10')][_0xf919('0x11')]};try{if(!_0x505f73[_0xf919('0x12')]){_0x505f73[_0xf919('0x12')]={};}if(_0x34337a){_0x505f73[_0xf919('0x12')][_0xf919('0x13')]=_0x34337a;}else if(_0x505f73[_0xf919('0x12')][_0xf919('0x13')]){delete _0x505f73[_0xf919('0x12')][_0xf919('0x13')];}_0x554169[_0xf919('0x14')]=utils[_0xf919('0x15')](_0x505f73[_0xf919('0x10')][_0xf919('0x16')],_0x505f73);}catch(_0x2d742b){_0x554169['msg']=_0xf919('0x17');logger[_0xf919('0x18')](util[_0xf919('0x9')](_0xf919('0x19'),_0x54ce72,_0x2d742b['message']));}io['to'](util['format'](_0xf919('0xa'),_0x90d607[_0xf919('0xb')]))[_0xf919('0xc')](util['format'](_0xf919('0x1a'),_0x206929?_0xf919('0x1b'):_0xf919('0x1c')),_0x554169);}function writeLog(_0x32a8de,_0x304c7b,_0x5c188f){return logger[_0xf919('0x1d')](util[_0xf919('0x9')](_0xf919('0x1e'),_0x32a8de,_0x304c7b[_0xf919('0xb')],_0x5c188f));}exports[_0xf919('0x1f')]=function(_0x41efc1,_0xf208ad,_0x57b186,_0x52fd5d){if(_0xf208ad['busy']){writeLog(_0x41efc1,_0xf208ad,_0xf919('0x20'));return![];}if(!_0xf208ad[_0xf919('0x21')]){writeLog(_0x41efc1,_0xf208ad,_0xf919('0x22'));return![];}if(_0xf208ad[_0x57b186+_0xf919('0x23')]){writeLog(_0x41efc1,_0xf208ad,_0xf919('0x24'));return![];}if(_0x52fd5d&&_0xf208ad['hasOwnProperty'](_0x57b186+_0xf919('0x25'))&&_0xf208ad[_0xf919('0x26')](_0x57b186+_0xf919('0x27'))){if(_0xf208ad[_0x57b186+_0xf919('0x25')]>0x0&&_0xf208ad[_0x57b186+_0xf919('0x27')]>=_0xf208ad[_0x57b186+_0xf919('0x25')]){writeLog(_0x41efc1,_0xf208ad,_0x57b186[_0xf919('0x28')]()+_0xf919('0x29'));return![];}}return!![];};exports[_0xf919('0x2a')]=function(_0x2ab360,_0x114057,_0xa7eb08,_0x36a2eb,_0x100f2d){return sendNotification(!![],_0x2ab360,_0x114057,_0xa7eb08,_0x36a2eb,_0x100f2d);};exports[_0xf919('0x2b')]=function(_0x4d328e,_0x30987b,_0xc5ca45,_0x4e1b03,_0xe8019d){return sendNotification(![],_0x4d328e,_0x30987b,_0xc5ca45,_0x4e1b03,_0xe8019d);};exports[_0xf919('0x2c')]=function(_0x2778bb,_0x59b69c,_0x170e2d){var _0x4330e4=_0x59b69c[_0xf919('0x2d')][_0xf919('0x2e')];if(!_0x4330e4&&_0x170e2d){_0x4330e4=_0x170e2d['id'];}var _0xfc6e5e=_['some'](_0x2778bb[_0x59b69c[_0xf919('0x2f')]+_0xf919('0x30')],function(_0x177663){var _0x5a9582=_['capitalize'](_0x59b69c[_0xf919('0x2f')])+_0xf919('0x31');return _0x177663[_0x5a9582]===_0x59b69c[_0xf919('0x2d')]['id'];});if(!_0xfc6e5e&&_0x4330e4){_0xfc6e5e=_[_0xf919('0x32')](_0x2778bb[_0xf919('0x33')][_0x4330e4][_0x59b69c[_0xf919('0x2f')]+'WaitingInteractions'],function(_0xb67a09){return _0xb67a09['id']===_0x59b69c['interaction']['id'];});}return _0xfc6e5e;};exports[_0xf919('0x34')]=function(_0x114389,_0x11c84b,_0x1f1b63,_0x669a4d){_0x114389[_0xf919('0x33')][_0x1f1b63['id']][_0x669a4d+_0xf919('0x35')][_0x11c84b[_0xf919('0x36')]['id']]={'id':_0x11c84b[_0xf919('0x2d')]['id']};};exports[_0xf919('0x37')]=function(_0x228fe7,_0x24bb80,_0x323b1c,_0x2aa4bb){delete _0x228fe7[_0xf919('0x33')][_0x323b1c['id']][_0x2aa4bb+_0xf919('0x35')][_0x24bb80[_0xf919('0x36')]['id']];};exports[_0xf919('0x38')]=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 12528a6..d7f8792 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 _0x5377=['../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','next','getMustacheRender','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','shelljs','lodash','./utils'];(function(_0x590b26,_0x3cac50){var _0x18f88f=function(_0x42a780){while(--_0x42a780){_0x590b26['push'](_0x590b26['shift']());}};_0x18f88f(++_0x3cac50);}(_0x5377,0x131));var _0x7537=function(_0x4832d1,_0x1da0f5){_0x4832d1=_0x4832d1-0x0;var _0x1ddf87=_0x5377[_0x4832d1];return _0x1ddf87;};'use strict';var schema=require('validate');var sh=require(_0x7537('0x0'));var _=require(_0x7537('0x1'));var utils=require(_0x7537('0x2'));var logger=require(_0x7537('0x3'))(_0x7537('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':_0x7537('0x5')}});exports[_0x7537('0x6')]=function(_0x35945d,_0x536a06){return function(_0x460f8f){try{var _0x111ddf={'command':_0x536a06[0x0]};var _0x446d7a=system[_0x7537('0x7')](_0x111ddf,{'typecast':!![]});if(_0x446d7a[_0x7537('0x8')]){logger[_0x7537('0x9')](_0x7537('0xa'),_0x35945d,_[_0x7537('0xb')](_0x446d7a,_0x7537('0xc'))[_0x7537('0xd')](',\x20'));logger[_0x7537('0xe')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x35945d);_0x460f8f[_0x7537('0xf')]();}else{var _0x1e0cf4=this;var _0x26d552=utils[_0x7537('0x10')](_0x536a06[0x0],this);logger['info']('[%s][SYSTEM]\x20commnad:\x20%s',_0x35945d,_0x26d552);sh[_0x7537('0x11')](_[_0x7537('0x12')](_0x26d552),function(_0x5aa65d,_0x5cd1ae){logger[_0x7537('0xe')](_0x7537('0x13'),_0x35945d,_0x5aa65d);if(_0x5aa65d==0x0){var _0x5ebdf0=_0x5cd1ae[_0x7537('0x14')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x536a06[0x1])||_[_0x7537('0x15')](_0x536a06[0x1])){logger[_0x7537('0xe')](_0x7537('0x16'),_0x35945d);_0x1e0cf4[_0x7537('0x17')][_0x536a06[0x1]]=_0x5ebdf0;}else{logger[_0x7537('0xe')](_0x7537('0x18'),_0x35945d,_0x536a06[0x1],_0x5ebdf0);_0x1e0cf4[_0x7537('0x17')][_0x536a06[0x1]]=_0x5ebdf0;}}_0x460f8f[_0x7537('0xf')]();});}}catch(_0x422ff9){logger[_0x7537('0x9')]('[%s][SYSTEM]\x20%s',_0x35945d,_[_0x7537('0x19')](_0x422ff9)?JSON[_0x7537('0x1a')](_0x422ff9):_0x422ff9);logger['info'](_0x7537('0x1b'),_0x35945d);_0x460f8f['next']();}};}; \ No newline at end of file +var _0x6464=['getMustacheRender','exec','trim','info','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','validate','shelljs','lodash','./utils','../../../../config/logger','routing','length','error','[%s][SYSTEM]\x20%s','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next'];(function(_0x5582d8,_0x30c47e){var _0x4cec88=function(_0x48dd09){while(--_0x48dd09){_0x5582d8['push'](_0x5582d8['shift']());}};_0x4cec88(++_0x30c47e);}(_0x6464,0x16f));var _0x4646=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6464[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0x4646('0x0'));var sh=require(_0x4646('0x1'));var _=require(_0x4646('0x2'));var utils=require(_0x4646('0x3'));var logger=require(_0x4646('0x4'))(_0x4646('0x5'));var system=schema({'command':{'type':'string','required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x560b15,_0x26749c){return function(_0x482111){try{var _0x4758fd={'command':_0x26749c[0x0]};var _0x571456=system[_0x4646('0x0')](_0x4758fd,{'typecast':!![]});if(_0x571456[_0x4646('0x6')]){logger[_0x4646('0x7')](_0x4646('0x8'),_0x560b15,_['map'](_0x571456,'message')['join'](',\x20'));logger['info'](_0x4646('0x9'),_0x560b15);_0x482111[_0x4646('0xa')]();}else{var _0x523721=this;var _0x544566=utils[_0x4646('0xb')](_0x26749c[0x0],this);logger['info']('[%s][SYSTEM]\x20commnad:\x20%s',_0x560b15,_0x544566);sh[_0x4646('0xc')](_[_0x4646('0xd')](_0x544566),function(_0x246328,_0x2de704){logger[_0x4646('0xe')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x560b15,_0x246328);if(_0x246328==0x0){var _0x42611e=_0x2de704[_0x4646('0xf')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x26749c[0x1])||_[_0x4646('0x10')](_0x26749c[0x1])){logger[_0x4646('0xe')](_0x4646('0x11'),_0x560b15);_0x523721[_0x4646('0x12')][_0x26749c[0x1]]=_0x42611e;}else{logger[_0x4646('0xe')](_0x4646('0x13'),_0x560b15,_0x26749c[0x1],_0x42611e);_0x523721[_0x4646('0x12')][_0x26749c[0x1]]=_0x42611e;}}_0x482111[_0x4646('0xa')]();});}}catch(_0x3fbc62){logger[_0x4646('0x7')](_0x4646('0x8'),_0x560b15,_[_0x4646('0x14')](_0x3fbc62)?JSON['stringify'](_0x3fbc62):_0x3fbc62);logger[_0x4646('0xe')](_0x4646('0x9'),_0x560b15);_0x482111[_0x4646('0xa')]();}};}; \ 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 1d56e5d..2096a35 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 _0x9150=['number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','map','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','[%s][TAG]\x20%s','stringify','finally','isObject','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction'];(function(_0x2ae3d0,_0x50c2b9){var _0x516191=function(_0x208860){while(--_0x208860){_0x2ae3d0['push'](_0x2ae3d0['shift']());}};_0x516191(++_0x50c2b9);}(_0x9150,0x14a));var _0x0915=function(_0x539aad,_0xf34036){_0x539aad=_0x539aad-0x0;var _0x258693=_0x9150[_0x539aad];return _0x258693;};'use strict';var schema=require('validate');var _=require(_0x0915('0x0'));var rpc={'chatInteraction':require(_0x0915('0x1')),'openchannelInteraction':require(_0x0915('0x2')),'smsInteraction':require(_0x0915('0x3')),'mailInteraction':require(_0x0915('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x0915('0x5'))};var logger=require('../../../../config/logger')('routing');var tag=schema({'tag':{'type':_0x0915('0x6'),'required':!![],'message':_0x0915('0x7')}});exports[_0x0915('0x8')]=function(_0x2f9874,_0x59005d,_0x52d53c,_0xad8500){return function(_0x2f90a1){try{var _0x1b5d2d={'tag':_0x59005d[0x0]};var _0x3daac0=tag[_0x0915('0x9')](_0x1b5d2d,{'typecast':!![]});if(_0x3daac0[_0x0915('0xa')]){logger[_0x0915('0xb')]('[%s][TAG]\x20%s',_0x2f9874,_[_0x0915('0xc')](_0x3daac0,'message')[_0x0915('0xd')](',\x20'));logger[_0x0915('0xe')](_0x0915('0xf'),_0x2f9874);_0x2f90a1[_0x0915('0x10')]();}else{var _0x1dae0e={'ids':[_0x59005d[0x0]]};if(rpc[_0xad8500[_0x0915('0x11')]+_0x0915('0x12')]){rpc[_0xad8500[_0x0915('0x11')]+_0x0915('0x12')][_0x0915('0x13')](_0xad8500['interaction']['id'],_0x1dae0e)[_0x0915('0x14')](function(_0x31fbda){logger[_0x0915('0xe')](_0x0915('0x15'),_0x2f9874,_0x59005d[0x1],_0xad8500[_0x0915('0x11')],_0xad8500[_0x0915('0x16')]['id']);})[_0x0915('0x17')](function(_0xa64fe1){logger['error'](_0x0915('0x18'),_0x2f9874,JSON[_0x0915('0x19')](_0xa64fe1));logger['info'](_0x0915('0xf'),_0x2f9874);})[_0x0915('0x1a')](function(){_0x2f90a1['next']();});}}}catch(_0x15347c){logger[_0x0915('0xb')](_0x0915('0x18'),_0x2f9874,_[_0x0915('0x1b')](_0x15347c)?JSON[_0x0915('0x19')](_0x15347c):_0x15347c);logger[_0x0915('0xe')](_0x0915('0xf'),_0x2f9874);_0x2f90a1[_0x0915('0x10')]();}};}; \ No newline at end of file +var _0x7a20=['[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][TAG]\x20%s','map','join','info'];(function(_0xfc36d8,_0x233b0b){var _0x234f42=function(_0xad4ac4){while(--_0xad4ac4){_0xfc36d8['push'](_0xfc36d8['shift']());}};_0x234f42(++_0x233b0b);}(_0x7a20,0x136));var _0x07a2=function(_0x51509a,_0x4dc939){_0x51509a=_0x51509a-0x0;var _0x50d53e=_0x7a20[_0x51509a];return _0x50d53e;};'use strict';var schema=require(_0x07a2('0x0'));var _=require(_0x07a2('0x1'));var rpc={'chatInteraction':require(_0x07a2('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x07a2('0x3')),'mailInteraction':require(_0x07a2('0x4')),'faxInteraction':require(_0x07a2('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x07a2('0x6'))(_0x07a2('0x7'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x07a2('0x8')}});exports['consequence']=function(_0x41d2ef,_0x4ccc90,_0xfb0700,_0x27b72e){return function(_0x5c32c7){try{var _0x866a90={'tag':_0x4ccc90[0x0]};var _0xffd232=tag[_0x07a2('0x0')](_0x866a90,{'typecast':!![]});if(_0xffd232[_0x07a2('0x9')]){logger[_0x07a2('0xa')](_0x07a2('0xb'),_0x41d2ef,_[_0x07a2('0xc')](_0xffd232,'message')[_0x07a2('0xd')](',\x20'));logger[_0x07a2('0xe')](_0x07a2('0xf'),_0x41d2ef);_0x5c32c7[_0x07a2('0x10')]();}else{var _0x208c57={'ids':[_0x4ccc90[0x0]]};if(rpc[_0x27b72e[_0x07a2('0x11')]+_0x07a2('0x12')]){rpc[_0x27b72e[_0x07a2('0x11')]+_0x07a2('0x12')][_0x07a2('0x13')](_0x27b72e[_0x07a2('0x14')]['id'],_0x208c57)['then'](function(_0x3ebf3b){logger['info'](_0x07a2('0x15'),_0x41d2ef,_0x4ccc90[0x1],_0x27b72e[_0x07a2('0x11')],_0x27b72e[_0x07a2('0x14')]['id']);})[_0x07a2('0x16')](function(_0x538433){logger[_0x07a2('0xa')](_0x07a2('0xb'),_0x41d2ef,JSON[_0x07a2('0x17')](_0x538433));logger[_0x07a2('0xe')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x41d2ef);})[_0x07a2('0x18')](function(){_0x5c32c7[_0x07a2('0x10')]();});}}}catch(_0x44f551){logger[_0x07a2('0xa')](_0x07a2('0xb'),_0x41d2ef,_['isObject'](_0x44f551)?JSON[_0x07a2('0x17')](_0x44f551):_0x44f551);logger[_0x07a2('0xe')](_0x07a2('0xf'),_0x41d2ef);_0x5c32c7[_0x07a2('0x10')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 2f7f0a9..19334d8 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 _0xeb3b=['request-promise','../../../../config/logger','routing','lodash','replace','includes','push','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','2.0','params','stringify','utf8','POST','application/json-rpc','then','parse','result','logged','channelId=','&serviceId=','&sessionId=','&data=','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','isObject','info'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xeb3b,0xe0));var _0xbeb3=function(_0x173452,_0x3aa870){_0x173452=_0x173452-0x0;var _0xee3fd0=_0xeb3b[_0x173452];return _0xee3fd0;};'use strict';var rp=require(_0xbeb3('0x0'));var logger=require(_0xbeb3('0x1'))(_0xbeb3('0x2'));var _=require(_0xbeb3('0x3'));var arr=[];exports['consequence']=function(_0x334d1b,_0x706d22){return function(_0x42bf5f){var _0x8a4079=_0x706d22[0xa];var _0x3a1cb2=_0x706d22[0xb];var _0x42896a=_0x706d22[0xc];var _0x242c8e=_0x706d22[0xd];var _0x1ecfef=_0x706d22[0xe];var _0x261c80=_0x706d22[0xf][_0xbeb3('0x4')](/\n/g,'\x20-\x20');var _0x27f12c=_0x706d22[0x10][_0xbeb3('0x4')](/\n/g,'\x20');if(!arr[_0xbeb3('0x5')](_0x3a1cb2)){arr[_0xbeb3('0x6')](_0x3a1cb2);var _0x404dce=_0x706d22[0x3];var _0x44f85b=_0x706d22[0x4];var _0x5cbc5a=_0x706d22[0x1];var _0x533c62=_0x706d22[0x0];var _0x5497bf={};_0x5497bf[_0xbeb3('0x7')]=_0x706d22[0x8]+_0xbeb3('0x8')+_0x42896a+'|'+_0x8a4079+'|'+_0x242c8e+'|'+_0x3a1cb2+'|'+_0x1ecfef;_0x5497bf[_0xbeb3('0x9')]=_0x706d22[0x7]+'?params='+_0x42896a+'|'+_0x8a4079+'|'+_0x242c8e+'|'+_0x3a1cb2+'|'+_0x1ecfef+'|'+_0x261c80+'|'+_0x27f12c;_0x5497bf[_0xbeb3('0xa')]=_0x706d22[0x9];var _0x3b33a7={};_0x3b33a7[_0xbeb3('0xb')]=_0xbeb3('0xc');_0x3b33a7['method']='login';var _0x37a43c=[];_0x37a43c[_0xbeb3('0x6')](_0x706d22[0x2]);_0x37a43c[_0xbeb3('0x6')](_0x706d22[0x5]);_0x37a43c['push'](_0x706d22[0x6]);_0x3b33a7[_0xbeb3('0xd')]=_0x37a43c;_0x3b33a7['id']=0x1;var _0x54c17b=JSON[_0xbeb3('0xe')](_0x3b33a7);var _0x1da80c={'encoding':_0xbeb3('0xf'),'method':_0xbeb3('0x10'),'timeout':0x2710,'url':_0x404dce,'headers':{'Content-Type':_0xbeb3('0x11')},'body':_0x54c17b};return rp(_0x1da80c)[_0xbeb3('0x12')](function(_0x271018){const _0x114fa7=JSON[_0xbeb3('0x13')](_0x271018);if(!_0x114fa7[_0xbeb3('0x14')][_0xbeb3('0x15')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x565620=_0x3a1cb2;var _0x2e0bd8=_0xbeb3('0x16')+_0x5cbc5a+_0xbeb3('0x17')+_0x533c62+_0xbeb3('0x18')+_0x565620+_0xbeb3('0x19')+JSON[_0xbeb3('0xe')](_0x5497bf);var _0x44ac59=_0x44f85b+'?'+_0x2e0bd8;return rp(_0x44ac59);})['then'](function(_0x3d6a62){logger['info'](_0xbeb3('0x1a'),_0x334d1b,_0x3d6a62);_0x42bf5f[_0xbeb3('0x1b')]();})[_0xbeb3('0x1c')](function(_0x3892a5){logger[_0xbeb3('0x1d')]('[%s][TVOX]\x20%s',_0x334d1b,_[_0xbeb3('0x1e')](_0x3892a5)?JSON[_0xbeb3('0xe')](_0x3892a5):_0x3892a5);_0x42bf5f[_0xbeb3('0x1b')]();});}else{logger[_0xbeb3('0x1f')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x334d1b);_0x42bf5f['next']();}};}; \ No newline at end of file +var _0xacd7=['stop','catch','error','[%s][TVOX]\x20%s','isObject','info','next','request-promise','../../../../config/logger','routing','lodash','replace','includes','push','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','method','login','utf8','POST','application/json-rpc','then','parse','result','logged','channelId=','&serviceId=','&sessionId=','stringify','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s'];(function(_0x10ea02,_0x15dd1a){var _0x44d271=function(_0x73febd){while(--_0x73febd){_0x10ea02['push'](_0x10ea02['shift']());}};_0x44d271(++_0x15dd1a);}(_0xacd7,0x193));var _0x7acd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xacd7[_0x3dd15e];return _0x231fd0;};'use strict';var rp=require(_0x7acd('0x0'));var logger=require(_0x7acd('0x1'))(_0x7acd('0x2'));var _=require(_0x7acd('0x3'));var arr=[];exports['consequence']=function(_0x50f6bf,_0x2cdf57){return function(_0x445367){var _0x43e53c=_0x2cdf57[0xa];var _0x18f84e=_0x2cdf57[0xb];var _0x145781=_0x2cdf57[0xc];var _0x38d1a3=_0x2cdf57[0xd];var _0xf28400=_0x2cdf57[0xe];var _0x9d2e0d=_0x2cdf57[0xf][_0x7acd('0x4')](/\n/g,'\x20-\x20');var _0x329be7=_0x2cdf57[0x10][_0x7acd('0x4')](/\n/g,'\x20');if(!arr[_0x7acd('0x5')](_0x18f84e)){arr[_0x7acd('0x6')](_0x18f84e);var _0x367946=_0x2cdf57[0x3];var _0x41f317=_0x2cdf57[0x4];var _0x408ea5=_0x2cdf57[0x1];var _0x3e008=_0x2cdf57[0x0];var _0x2683b0={};_0x2683b0[_0x7acd('0x7')]=_0x2cdf57[0x8]+_0x7acd('0x8')+_0x145781+'|'+_0x43e53c+'|'+_0x38d1a3+'|'+_0x18f84e+'|'+_0xf28400;_0x2683b0[_0x7acd('0x9')]=_0x2cdf57[0x7]+'?params='+_0x145781+'|'+_0x43e53c+'|'+_0x38d1a3+'|'+_0x18f84e+'|'+_0xf28400+'|'+_0x9d2e0d+'|'+_0x329be7;_0x2683b0[_0x7acd('0xa')]=_0x2cdf57[0x9];var _0x2a624a={};_0x2a624a[_0x7acd('0xb')]='2.0';_0x2a624a[_0x7acd('0xc')]=_0x7acd('0xd');var _0x5edec3=[];_0x5edec3[_0x7acd('0x6')](_0x2cdf57[0x2]);_0x5edec3[_0x7acd('0x6')](_0x2cdf57[0x5]);_0x5edec3[_0x7acd('0x6')](_0x2cdf57[0x6]);_0x2a624a['params']=_0x5edec3;_0x2a624a['id']=0x1;var _0x587f76=JSON['stringify'](_0x2a624a);var _0x1e78c8={'encoding':_0x7acd('0xe'),'method':_0x7acd('0xf'),'timeout':0x2710,'url':_0x367946,'headers':{'Content-Type':_0x7acd('0x10')},'body':_0x587f76};return rp(_0x1e78c8)[_0x7acd('0x11')](function(_0x176d45){const _0x1742e3=JSON[_0x7acd('0x12')](_0x176d45);if(!_0x1742e3[_0x7acd('0x13')][_0x7acd('0x14')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x35e2e0=_0x18f84e;var _0x2f0aa5=_0x7acd('0x15')+_0x408ea5+_0x7acd('0x16')+_0x3e008+_0x7acd('0x17')+_0x35e2e0+'&data='+JSON[_0x7acd('0x18')](_0x2683b0);var _0x178680=_0x41f317+'?'+_0x2f0aa5;return rp(_0x178680);})[_0x7acd('0x11')](function(_0x169ae7){logger['info'](_0x7acd('0x19'),_0x50f6bf,_0x169ae7);_0x445367[_0x7acd('0x1a')]();})[_0x7acd('0x1b')](function(_0xe31a9f){logger[_0x7acd('0x1c')](_0x7acd('0x1d'),_0x50f6bf,_[_0x7acd('0x1e')](_0xe31a9f)?JSON['stringify'](_0xe31a9f):_0xe31a9f);_0x445367[_0x7acd('0x1a')]();});}else{logger[_0x7acd('0x1f')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x50f6bf);_0x445367[_0x7acd('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 c8bd78c..1d17c11 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x1b04d2,_0x3bfa3a){var _0x4bb8ec=function(_0x56a7d8){while(--_0x56a7d8){_0x1b04d2['push'](_0x1b04d2['shift']());}};_0x4bb8ec(++_0x3bfa3a);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0xb34bdb,_0x2f1099){var _0x1c8522=function(_0x389fc0){while(--_0x389fc0){_0xb34bdb['push'](_0xb34bdb['shift']());}};_0x1c8522(++_0x2f1099);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'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 a63d9bf..c9bcb04 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 _0x67bd=['paused','waiting','mailQueues','available','name','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','map','interval','channel','message','interaction','checkWaitingNotifications','applications','isArray','length','existsSync','join','app','.js','appdata','split','mail','push','slice','dialogflow','dialogflowv2','amazonlex','TagId','tvox','account','ContactId','body','%s:%s:%s','./interval','intervals','consequence','priority','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','info','stringify','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','busy','agents','busyQueue','end','QueueReport','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','loggedIn'];(function(_0x71492b,_0x2b1e0f){var _0x1a1c69=function(_0x2991e8){while(--_0x2991e8){_0x71492b['push'](_0x71492b['shift']());}};_0x1a1c69(++_0x2b1e0f);}(_0x67bd,0x149));var _0xd67b=function(_0x533030,_0xe44036){_0x533030=_0x533030-0x0;var _0x8ab186=_0x67bd[_0x533030];return _0x8ab186;};'use strict';var _=require('lodash');var util=require('util');var path=require(_0xd67b('0x0'));var fs=require('fs');var jayson=require(_0xd67b('0x1'));var BPromise=require(_0xd67b('0x2'));var utils=require(_0xd67b('0x3'));var sUtils=require(_0xd67b('0x4'));var logger=require(_0xd67b('0x5'))(_0xd67b('0x6'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xd67b('0x7')),'chatQueueReport':require(_0xd67b('0x8')),'smsQueueReport':require(_0xd67b('0x9')),'faxQueueReport':require(_0xd67b('0xa')),'whatsappQueueReport':require(_0xd67b('0xb'))};var RuleEngine=require(_0xd67b('0xc'));function getId(_0x4be529,_0x3bedbe,_0x2d6096){return util[_0xd67b('0xd')]('%s.%s.%s',_0x4be529,_0x3bedbe||0x0,_0x2d6096||0x0);}function getIntervals(_0x50e662,_0x331985){var _0x102eaa=[];if(!_[_0xd67b('0xe')](_0x331985[_0xd67b('0xf')])&&!_[_0xd67b('0xe')](_0x50e662[_0x331985[_0xd67b('0xf')]])&&!_[_0xd67b('0xe')](_0x50e662[_0x331985[_0xd67b('0xf')]][_0xd67b('0x10')])){_0x102eaa=_[_0xd67b('0x11')](_0x50e662[_0x331985['IntervalId']][_0xd67b('0x10')],'interval');}else if(!_[_0xd67b('0xe')](_0x331985[_0xd67b('0x12')])){_0x102eaa=[_0x331985[_0xd67b('0x12')]];}return _0x102eaa;}exports['listen']=function(_0xeeb943){_0xeeb943['rules']={};return new BPromise(function(_0x32fae9,_0x38f101){var _0x3fe32e={'Start':function(_0x1af8e7){var _0x4abe97=this;return new Promise(function(_0x462308,_0x5d9761){if(_0x1af8e7){try{var _0x41512b=[];var _0x436aaf=getId(_0x1af8e7[_0xd67b('0x13')],_0x1af8e7[_0xd67b('0x14')]?_0x1af8e7[_0xd67b('0x14')]['id']:0x0,_0x1af8e7[_0xd67b('0x15')]?_0x1af8e7[_0xd67b('0x15')]['id']:0x0);var _0x1c0f73=sUtils[_0xd67b('0x16')](_0xeeb943,_0x1af8e7);if(!_0x1c0f73&&_0x1af8e7[_0xd67b('0x17')]&&_[_0xd67b('0x18')](_0x1af8e7[_0xd67b('0x17')])&&_0x1af8e7[_0xd67b('0x17')]['length']){for(var _0x56d8b5=0x0;_0x56d8b5<_0x1af8e7[_0xd67b('0x17')][_0xd67b('0x19')];_0x56d8b5+=0x1){var _0x193627=_0x1af8e7[_0xd67b('0x17')][_0x56d8b5];if(fs[_0xd67b('0x1a')](path[_0xd67b('0x1b')](__dirname,_0xd67b('0x17'),_0x193627[_0xd67b('0x1c')]+_0xd67b('0x1d')))){var _0x2c95f6=[];switch(_0x193627['app']['toLowerCase']()){case'autoreply':var _0x4abe02=_0x193627[_0xd67b('0x1e')][_0xd67b('0x1f')](',');if(_0x1af8e7[_0xd67b('0x13')]===_0xd67b('0x20')){_0x2c95f6['push'](_0x4abe02[0x0]);_0x2c95f6[_0xd67b('0x21')](_0x4abe02[0x1]);_0x2c95f6[_0xd67b('0x21')](_0x4abe02[_0xd67b('0x22')](0x2,_0x4abe02[_0xd67b('0x19')])[_0xd67b('0x1b')](','));}else{_0x2c95f6[_0xd67b('0x21')](_0x4abe02[0x0]);_0x2c95f6[_0xd67b('0x21')](_0x4abe02[_0xd67b('0x22')](0x1,_0x4abe02[_0xd67b('0x19')])[_0xd67b('0x1b')](','));}break;case _0xd67b('0x23'):var _0xe9ecf9=_0x193627[_0xd67b('0x1e')][_0xd67b('0x1f')](',');_0x2c95f6[_0xd67b('0x21')](_0xe9ecf9[0x0]);_0x2c95f6[_0xd67b('0x21')](_0xe9ecf9[0x1]);_0x2c95f6[_0xd67b('0x21')](_0xe9ecf9[_0xd67b('0x22')](0x2,_0xe9ecf9[_0xd67b('0x19')])[_0xd67b('0x1b')](','));break;case _0xd67b('0x24'):var _0x7507b9=_0x193627['appdata'][_0xd67b('0x1f')](',');_0x2c95f6[_0xd67b('0x21')](_0x7507b9[0x0]);_0x2c95f6[_0xd67b('0x21')](_0x7507b9[0x1]);_0x2c95f6[_0xd67b('0x21')](_0x7507b9[0x2]);_0x2c95f6[_0xd67b('0x21')](_0x7507b9[0x3]);_0x2c95f6[_0xd67b('0x21')](_0x7507b9[_0xd67b('0x22')](0x4,_0x7507b9[_0xd67b('0x19')])['join'](','));break;case _0xd67b('0x25'):var _0x989901=_0x193627[_0xd67b('0x1e')][_0xd67b('0x1f')](',');_0x2c95f6[_0xd67b('0x21')](_0x989901[0x0]);_0x2c95f6[_0xd67b('0x21')](_0x989901[0x1]);_0x2c95f6[_0xd67b('0x21')](_0x989901[0x2]);_0x2c95f6['push'](_0x989901[0x3]);_0x2c95f6[_0xd67b('0x21')](_0x989901[_0xd67b('0x22')](0x4,_0x989901[_0xd67b('0x19')])[_0xd67b('0x1b')](','));break;case'message':_0x2c95f6[_0xd67b('0x21')](_0x193627['appdata']);break;case'tag':_0x2c95f6[_0xd67b('0x21')](_0x193627[_0xd67b('0x26')]);_0x2c95f6[_0xd67b('0x21')](_0x193627[_0xd67b('0x1e')]);break;case _0xd67b('0x27'):var _0xcd6ba5=utils['getMustacheRender'](_0x1af8e7[_0xd67b('0x28')]['notificationTemplate'],_0x1af8e7);var _0x2d1262=_0x193627[_0xd67b('0x1e')][_0xd67b('0x1f')](',');_0x2c95f6['push'](_0x2d1262[0x0]);_0x2c95f6[_0xd67b('0x21')](_0x2d1262[0x1]);_0x2c95f6[_0xd67b('0x21')](_0x2d1262[0x2]);_0x2c95f6[_0xd67b('0x21')](_0x2d1262[0x3]);_0x2c95f6[_0xd67b('0x21')](_0x2d1262[0x4]);_0x2c95f6[_0xd67b('0x21')](_0x2d1262[0x5]);_0x2c95f6[_0xd67b('0x21')](_0x2d1262[0x6]);_0x2c95f6[_0xd67b('0x21')](_0x2d1262[0x7]);_0x2c95f6[_0xd67b('0x21')](_0x2d1262[0x8]);_0x2c95f6['push'](_0x2d1262[0x9]);_0x2c95f6[_0xd67b('0x21')](_0x2d1262[0xa]);_0x2c95f6['push'](_0x1af8e7[_0xd67b('0x15')]['id']);_0x2c95f6[_0xd67b('0x21')](_0x1af8e7['message']['id']);_0x2c95f6[_0xd67b('0x21')](_0x193627['ChatWebsiteId']);_0x2c95f6[_0xd67b('0x21')](_0x1af8e7[_0xd67b('0x15')][_0xd67b('0x29')]);_0x2c95f6[_0xd67b('0x21')](_0x1af8e7[_0xd67b('0x2a')][_0xd67b('0x2a')]);_0x2c95f6[_0xd67b('0x21')](_0xcd6ba5);break;default:_0x2c95f6=_[_0xd67b('0xe')](_0x193627['appdata'])?[]:_0x193627[_0xd67b('0x1e')][_0xd67b('0x1f')](',');}var _0x2392e2={'id':util['format'](_0xd67b('0x2b'),_0x436aaf,_0x193627['id'],_0x193627[_0xd67b('0x1c')]),'condition':require(_0xd67b('0x2c'))['condition'](_0x436aaf,getIntervals(_0xeeb943[_0xd67b('0x2d')],_0x193627),_0xeeb943),'consequence':require('./applications/'+_0x193627[_0xd67b('0x1c')])[_0xd67b('0x2e')](_0x436aaf,_0x2c95f6,_0xeeb943,_0x1af8e7),'p':_0x193627[_0xd67b('0x2f')]||0x0};logger['info'](_0xd67b('0x30'),_0x2392e2['id'],_0xd67b('0x31'),getIntervals(_0xeeb943['intervals'],_0x193627)['join'](_0xd67b('0x32')));_0x41512b['push'](_0x2392e2);}else{logger[_0xd67b('0x33')](_0xd67b('0x34'),path['join'](__dirname,_0xd67b('0x17'),_0x193627['app']+_0xd67b('0x1d')));}}_0xeeb943[_0xd67b('0x35')][_0x436aaf]=new RuleEngine(_0x41512b);_0xeeb943[_0xd67b('0x35')][_0x436aaf][_0xd67b('0x36')](_0x1af8e7,function(_0x3758ea){logger[_0xd67b('0x37')]('Applications\x20executed',JSON[_0xd67b('0x38')](_0x3758ea[_0xd67b('0x39')]));if(_0xeeb943[_0xd67b('0x35')][_0x436aaf]){_0xeeb943[_0xd67b('0x35')][_0x436aaf][_0xd67b('0x3a')](_0xd67b('0x3b'));}});return _0x462308({'code':0xc8,'message':_0x1af8e7});}else{if(_0x1c0f73){logger[_0xd67b('0x37')](util['format'](_0xd67b('0x3c'),_0x436aaf));}else{logger[_0xd67b('0x37')](_0xd67b('0x3d'));}return _0x462308({'code':0xc8,'message':_0x1af8e7});}}catch(_0x3dd178){logger[_0xd67b('0x33')](_0x3dd178[_0xd67b('0x3e')]);return _0x5d9761(_0x4abe97[_0xd67b('0x33')](0x1f4,_0x3dd178));}}return _0x5d9761(_0xd67b('0x3f'));});},'AcceptMessage':function(_0x1cb00e){var _0x2e3555=this;return new Promise(function(_0x4a0713,_0x1dba0f){if(_0x1cb00e[_0xd67b('0x40')]&&_0x1cb00e[_0xd67b('0x40')]['id']){if(_0xeeb943['agents'][_0x1cb00e[_0xd67b('0x40')]['id']]){_0xeeb943['agents'][_0x1cb00e['agent']['id']][_0xd67b('0x41')]=![];_0xeeb943[_0xd67b('0x42')][_0x1cb00e[_0xd67b('0x40')]['id']][_0xd67b('0x43')]=undefined;}}if(_0x1cb00e['message']&&_0x1cb00e[_0xd67b('0x14')]['id']){try{var _0x92b916=getId(_0x1cb00e[_0xd67b('0x13')],_0x1cb00e[_0xd67b('0x14')]?_0x1cb00e[_0xd67b('0x14')]['id']:0x0,_0x1cb00e['interaction']?_0x1cb00e['interaction']['id']:0x0);if(_0xeeb943[_0xd67b('0x35')][_0x92b916]){_0xeeb943[_0xd67b('0x35')][_0x92b916]['emit'](_0xd67b('0x44'));if(rpc[_0x1cb00e[_0xd67b('0x13')]+_0xd67b('0x45')]){rpc[_0x1cb00e['channel']+_0xd67b('0x45')]['update'](_0x92b916,{'UserId':_0x1cb00e[_0xd67b('0x14')][_0xd67b('0x46')]})[_0xd67b('0x47')](function(){logger['error'](_0xd67b('0x48'));});}}return _0x4a0713({'code':0xc8,'message':_0x1cb00e});}catch(_0xe12806){logger[_0xd67b('0x33')](_0xe12806['stack']);return _0x1dba0f(_0x2e3555[_0xd67b('0x33')](0x1f4,_0xe12806));}}logger[_0xd67b('0x33')]('message\x20is\x20empty');return _0x1dba0f(_0x2e3555[_0xd67b('0x33')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x6b24bb){var _0x5363fe=this;return new Promise(function(_0x1facd2,_0x5768cb){if(_0x6b24bb[_0xd67b('0x40')]&&_0x6b24bb[_0xd67b('0x40')]['id']){try{if(_0xeeb943[_0xd67b('0x42')][_0x6b24bb[_0xd67b('0x40')]['id']]){_0xeeb943[_0xd67b('0x42')][_0x6b24bb[_0xd67b('0x40')]['id']][_0xd67b('0x41')]=![];_0xeeb943[_0xd67b('0x42')][_0x6b24bb['agent']['id']][_0xd67b('0x43')]=undefined;}return _0x1facd2({'code':0xc8,'message':_0x6b24bb});}catch(_0x63ab10){logger['error'](_0x63ab10['stack']);return _0x5768cb(_0x5363fe[_0xd67b('0x33')](0x1f4,_0x63ab10));}}logger['error'](_0xd67b('0x49'));return _0x5768cb(_0x5363fe[_0xd67b('0x33')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x5f4bb2){var _0x2afbcd=this;return new Promise(function(_0x6236ec,_0x544b9c){if(_0x5f4bb2['channel']&&_0x5f4bb2[_0xd67b('0x15')]&&_0x5f4bb2[_0xd67b('0x15')]['id']){try{var _0x49b4cd=getId(_0x5f4bb2['channel'],_0x5f4bb2[_0xd67b('0x14')]?_0x5f4bb2['message']['id']:0x0,_0x5f4bb2[_0xd67b('0x15')]?_0x5f4bb2[_0xd67b('0x15')]['id']:0x0);if(_0xeeb943[_0xd67b('0x35')][_0x49b4cd]){_0xeeb943['rules'][_0x49b4cd][_0xd67b('0x3a')](_0xd67b('0x44'));}return _0x6236ec({'code':0xc8,'message':_0x5f4bb2});}catch(_0x15ad1b){logger['error'](_0x15ad1b[_0xd67b('0x3e')]);return _0x544b9c(_0x2afbcd[_0xd67b('0x33')](0x1f4,_0x15ad1b));}}logger['error'](_0xd67b('0x49'));return _0x544b9c(_0x2afbcd['error'](0x1f4,_0xd67b('0x49')));});},'AgentCapacity':function(_0x3a564d){var _0x64ffcf=this;return new Promise(function(_0x2a34c4,_0x3b031c){if(_0xeeb943[_0xd67b('0x42')][_0xd67b('0x4a')](_0x3a564d['id'])){for(var _0x3da41a in _0x3a564d[_0xd67b('0x4b')]){if(_0x3a564d['capacity'][_0xd67b('0x4a')](_0x3da41a)){if(_0xeeb943[_0xd67b('0x42')][_0x3a564d['id']]['hasOwnProperty'](_0x3da41a+'CurrentCapacity')){_0xeeb943[_0xd67b('0x42')][_0x3a564d['id']][_0x3da41a+_0xd67b('0x4c')]=parseInt(_0x3a564d[_0xd67b('0x4b')][_0x3da41a],0xa);}}}_0xeeb943['agents'][_0x3a564d['id']][_0xd67b('0x4d')]();return _0x2a34c4({'code':0xc8,'message':_0xeeb943[_0xd67b('0x42')][_0x3a564d['id']]});}else{return _0x3b031c(_0x64ffcf[_0xd67b('0x33')](0x1f4,_0xd67b('0x4e')));}});},'Agents':function(_0x41b837){return new Promise(function(_0x4bd2db){var _0x127330=_[_0xd67b('0x4f')](_0xeeb943[_0xd67b('0x42')]);if(_0x41b837&&_0x41b837['id']){var _0x34f2f2=_[_0xd67b('0x50')](_0x127330,function(_0x6b4e6){return _0x6b4e6['id']===_0x41b837['id'];});_0x4bd2db(_0x34f2f2);}else{_0x4bd2db({'count':_0x127330[_0xd67b('0x19')],'rows':_0x127330});}});},'ChatQueues':function(){return new Promise(function(_0x45ecec){var _0xb68d72=[];for(var _0x5614a5 in _0xeeb943[_0xd67b('0x51')]){if(_0xeeb943['chatQueues'][_0xd67b('0x4a')](_0x5614a5)){var _0x2e4d05=_0xeeb943[_0xd67b('0x51')][_0x5614a5];var _0xb002dd={'id':_0x2e4d05['id'],'available':_0x2e4d05['available'],'loggedIn':_0x2e4d05[_0xd67b('0x52')],'name':_0x2e4d05['name'],'paused':_0x2e4d05[_0xd67b('0x53')],'waiting':_0x2e4d05[_0xd67b('0x54')]};_0xb68d72[_0xd67b('0x21')](_0xb002dd);}}_0x45ecec({'count':_0xb68d72['length'],'rows':_0xb68d72});});},'MailQueues':function(){return new Promise(function(_0x1bba6d){var _0x125458=[];for(var _0x18c3ad in _0xeeb943[_0xd67b('0x55')]){if(_0xeeb943[_0xd67b('0x55')][_0xd67b('0x4a')](_0x18c3ad)){var _0x5cec3c=_0xeeb943[_0xd67b('0x55')][_0x18c3ad];var _0x1fcb2b={'id':_0x5cec3c['id'],'available':_0x5cec3c[_0xd67b('0x56')],'loggedIn':_0x5cec3c['loggedIn'],'name':_0x5cec3c[_0xd67b('0x57')],'paused':_0x5cec3c[_0xd67b('0x53')],'waiting':_0x5cec3c[_0xd67b('0x54')]};_0x125458[_0xd67b('0x21')](_0x1fcb2b);}}_0x1bba6d({'count':_0x125458[_0xd67b('0x19')],'rows':_0x125458});});},'OpenchannelQueues':function(){return new Promise(function(_0x34b13c){var _0x15e65d=[];for(var _0x3d0c27 in _0xeeb943[_0xd67b('0x58')]){if(_0xeeb943['openchannelQueues'][_0xd67b('0x4a')](_0x3d0c27)){var _0x486173=_0xeeb943[_0xd67b('0x58')][_0x3d0c27];var _0x5f0d9e={'id':_0x486173['id'],'available':_0x486173[_0xd67b('0x56')],'loggedIn':_0x486173['loggedIn'],'name':_0x486173['name'],'paused':_0x486173[_0xd67b('0x53')],'waiting':_0x486173[_0xd67b('0x54')]};_0x15e65d[_0xd67b('0x21')](_0x5f0d9e);}}_0x34b13c({'count':_0x15e65d[_0xd67b('0x19')],'rows':_0x15e65d});});},'SmsQueues':function(){return new Promise(function(_0x203fec){var _0x26617a=[];for(var _0x43faea in _0xeeb943[_0xd67b('0x59')]){if(_0xeeb943[_0xd67b('0x59')][_0xd67b('0x4a')](_0x43faea)){var _0x50631c=_0xeeb943['smsQueues'][_0x43faea];var _0x41f9e7={'id':_0x50631c['id'],'available':_0x50631c[_0xd67b('0x56')],'loggedIn':_0x50631c[_0xd67b('0x52')],'name':_0x50631c[_0xd67b('0x57')],'paused':_0x50631c[_0xd67b('0x53')],'waiting':_0x50631c[_0xd67b('0x54')]};_0x26617a[_0xd67b('0x21')](_0x41f9e7);}}_0x203fec({'count':_0x26617a['length'],'rows':_0x26617a});});},'FaxQueues':function(){return new Promise(function(_0x4c27d7){var _0x55120f=[];for(var _0x464a54 in _0xeeb943[_0xd67b('0x5a')]){if(_0xeeb943['faxQueues'][_0xd67b('0x4a')](_0x464a54)){var _0x44eb2c=_0xeeb943[_0xd67b('0x5a')][_0x464a54];var _0x26e615={'id':_0x44eb2c['id'],'available':_0x44eb2c[_0xd67b('0x56')],'loggedIn':_0x44eb2c[_0xd67b('0x52')],'name':_0x44eb2c[_0xd67b('0x57')],'paused':_0x44eb2c[_0xd67b('0x53')],'waiting':_0x44eb2c[_0xd67b('0x54')]};_0x55120f['push'](_0x26e615);}}_0x4c27d7({'count':_0x55120f[_0xd67b('0x19')],'rows':_0x55120f});});},'WhatsappQueues':function(){return new Promise(function(_0x485782){var _0x2f1a99=[];for(var _0x14a02c in _0xeeb943['whatsappQueues']){if(_0xeeb943[_0xd67b('0x5b')][_0xd67b('0x4a')](_0x14a02c)){var _0x2e9b12=_0xeeb943['whatsappQueues'][_0x14a02c];var _0x88cee7={'id':_0x2e9b12['id'],'available':_0x2e9b12[_0xd67b('0x56')],'loggedIn':_0x2e9b12[_0xd67b('0x52')],'name':_0x2e9b12[_0xd67b('0x57')],'paused':_0x2e9b12['paused'],'waiting':_0x2e9b12[_0xd67b('0x54')]};_0x2f1a99[_0xd67b('0x21')](_0x88cee7);}}_0x485782({'count':_0x2f1a99[_0xd67b('0x19')],'rows':_0x2f1a99});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0xc5cca3){var _0x44e5cf=_[_0xd67b('0x4f')](_0xeeb943[_0xd67b('0x5c')]);_0xc5cca3({'count':_0x44e5cf[_0xd67b('0x19')],'rows':_0x44e5cf});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x403f40){var _0x59f7aa=_[_0xd67b('0x4f')](_0xeeb943[_0xd67b('0x5d')]);_0x403f40({'count':_0x59f7aa['length'],'rows':_0x59f7aa});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x350631){var _0x52cebe=_[_0xd67b('0x4f')](_0xeeb943[_0xd67b('0x5e')]);_0x350631({'count':_0x52cebe[_0xd67b('0x19')],'rows':_0x52cebe});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x341cc8){var _0x492c49=_[_0xd67b('0x4f')](_0xeeb943[_0xd67b('0x5f')]);_0x341cc8({'count':_0x492c49['length'],'rows':_0x492c49});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x55808e){var _0x29c414=_['values'](_0xeeb943['faxQueuesWaitingInteractions']);_0x55808e({'count':_0x29c414['length'],'rows':_0x29c414});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0xf9d45f){var _0x2974b4=_[_0xd67b('0x4f')](_0xeeb943[_0xd67b('0x60')]);_0xf9d45f({'count':_0x2974b4[_0xd67b('0x19')],'rows':_0x2974b4});});}};var _0x1561f5=jayson[_0xd67b('0x61')](_0x3fe32e)[_0xd67b('0x62')]();_0x1561f5['on'](_0xd67b('0x33'),function(_0x3119b0){logger[_0xd67b('0x33')](JSON['stringify'](_0x3119b0));return _0x38f101(_0x3119b0);});_0x1561f5['listen'](0x232c,_0xd67b('0x63'),function(){console[_0xd67b('0x64')](_0xd67b('0x65'),0x232c);return _0x32fae9(_0xd67b('0x66')+0x232c);});});}; \ No newline at end of file +var _0x36d9=['agent','agents','busyQueue','emit','end','QueueReport','update','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','paused','waiting','mailQueues','loggedIn','name','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','server','http','listen','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format','isNil','IntervalId','Intervals','interval','channel','message','interaction','checkWaitingNotifications','isArray','applications','length','existsSync','join','app','.js','autoreply','appdata','push','slice','split','dialogflowv2','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','body','./interval','condition','consequence','priority','on\x20interval','intervals','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','info','stringify','matchPath','complete','Skipped\x20routing\x20for\x20%s','stack','error','routing\x20is\x20empty'];(function(_0x5df209,_0x227d81){var _0x4a2dc2=function(_0x6e92a1){while(--_0x6e92a1){_0x5df209['push'](_0x5df209['shift']());}};_0x4a2dc2(++_0x227d81);}(_0x36d9,0x1aa));var _0x936d=function(_0x4d8743,_0x111ca3){_0x4d8743=_0x4d8743-0x0;var _0x50b047=_0x36d9[_0x4d8743];return _0x50b047;};'use strict';var _=require('lodash');var util=require(_0x936d('0x0'));var path=require(_0x936d('0x1'));var fs=require('fs');var jayson=require(_0x936d('0x2'));var BPromise=require(_0x936d('0x3'));var utils=require(_0x936d('0x4'));var sUtils=require(_0x936d('0x5'));var logger=require(_0x936d('0x6'))('routing');var rpc={'openchannelQueueReport':require(_0x936d('0x7')),'mailQueueReport':require(_0x936d('0x8')),'chatQueueReport':require(_0x936d('0x9')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x936d('0xa')),'whatsappQueueReport':require(_0x936d('0xb'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x1bbf33,_0x567c1f,_0x2f0c70){return util[_0x936d('0xc')]('%s.%s.%s',_0x1bbf33,_0x567c1f||0x0,_0x2f0c70||0x0);}function getIntervals(_0x29c1a4,_0x5b464d){var _0x3e9311=[];if(!_[_0x936d('0xd')](_0x5b464d[_0x936d('0xe')])&&!_[_0x936d('0xd')](_0x29c1a4[_0x5b464d[_0x936d('0xe')]])&&!_['isNil'](_0x29c1a4[_0x5b464d['IntervalId']][_0x936d('0xf')])){_0x3e9311=_['map'](_0x29c1a4[_0x5b464d[_0x936d('0xe')]][_0x936d('0xf')],_0x936d('0x10'));}else if(!_[_0x936d('0xd')](_0x5b464d[_0x936d('0x10')])){_0x3e9311=[_0x5b464d[_0x936d('0x10')]];}return _0x3e9311;}exports['listen']=function(_0x6775db){_0x6775db['rules']={};return new BPromise(function(_0x18606b,_0x1f14c7){var _0x51186e={'Start':function(_0xe9cfe7){var _0x8289ba=this;return new Promise(function(_0x4eb47f,_0x5c231a){if(_0xe9cfe7){try{var _0x1626ee=[];var _0xfdf1cf=getId(_0xe9cfe7[_0x936d('0x11')],_0xe9cfe7[_0x936d('0x12')]?_0xe9cfe7['message']['id']:0x0,_0xe9cfe7[_0x936d('0x13')]?_0xe9cfe7[_0x936d('0x13')]['id']:0x0);var _0x500a57=sUtils[_0x936d('0x14')](_0x6775db,_0xe9cfe7);if(!_0x500a57&&_0xe9cfe7['applications']&&_[_0x936d('0x15')](_0xe9cfe7[_0x936d('0x16')])&&_0xe9cfe7[_0x936d('0x16')][_0x936d('0x17')]){for(var _0x172963=0x0;_0x172963<_0xe9cfe7[_0x936d('0x16')][_0x936d('0x17')];_0x172963+=0x1){var _0x32bc4b=_0xe9cfe7[_0x936d('0x16')][_0x172963];if(fs[_0x936d('0x18')](path[_0x936d('0x19')](__dirname,'applications',_0x32bc4b[_0x936d('0x1a')]+_0x936d('0x1b')))){var _0x4edcac=[];switch(_0x32bc4b['app']['toLowerCase']()){case _0x936d('0x1c'):var _0x2708dc=_0x32bc4b[_0x936d('0x1d')]['split'](',');if(_0xe9cfe7[_0x936d('0x11')]==='mail'){_0x4edcac[_0x936d('0x1e')](_0x2708dc[0x0]);_0x4edcac['push'](_0x2708dc[0x1]);_0x4edcac['push'](_0x2708dc['slice'](0x2,_0x2708dc[_0x936d('0x17')])[_0x936d('0x19')](','));}else{_0x4edcac[_0x936d('0x1e')](_0x2708dc[0x0]);_0x4edcac[_0x936d('0x1e')](_0x2708dc[_0x936d('0x1f')](0x1,_0x2708dc['length'])[_0x936d('0x19')](','));}break;case'dialogflow':var _0x3e44ff=_0x32bc4b[_0x936d('0x1d')][_0x936d('0x20')](',');_0x4edcac[_0x936d('0x1e')](_0x3e44ff[0x0]);_0x4edcac[_0x936d('0x1e')](_0x3e44ff[0x1]);_0x4edcac[_0x936d('0x1e')](_0x3e44ff[_0x936d('0x1f')](0x2,_0x3e44ff[_0x936d('0x17')])['join'](','));break;case _0x936d('0x21'):var _0x1ef9d7=_0x32bc4b[_0x936d('0x1d')]['split'](',');_0x4edcac['push'](_0x1ef9d7[0x0]);_0x4edcac[_0x936d('0x1e')](_0x1ef9d7[0x1]);_0x4edcac['push'](_0x1ef9d7[0x2]);_0x4edcac[_0x936d('0x1e')](_0x1ef9d7[0x3]);_0x4edcac[_0x936d('0x1e')](_0x1ef9d7['slice'](0x4,_0x1ef9d7[_0x936d('0x17')])[_0x936d('0x19')](','));break;case'amazonlex':var _0xf8660b=_0x32bc4b['appdata'][_0x936d('0x20')](',');_0x4edcac[_0x936d('0x1e')](_0xf8660b[0x0]);_0x4edcac[_0x936d('0x1e')](_0xf8660b[0x1]);_0x4edcac[_0x936d('0x1e')](_0xf8660b[0x2]);_0x4edcac[_0x936d('0x1e')](_0xf8660b[0x3]);_0x4edcac[_0x936d('0x1e')](_0xf8660b[_0x936d('0x1f')](0x4,_0xf8660b[_0x936d('0x17')])[_0x936d('0x19')](','));break;case _0x936d('0x12'):_0x4edcac['push'](_0x32bc4b[_0x936d('0x1d')]);break;case _0x936d('0x22'):_0x4edcac[_0x936d('0x1e')](_0x32bc4b[_0x936d('0x23')]);_0x4edcac['push'](_0x32bc4b['appdata']);break;case _0x936d('0x24'):var _0x3c44cb=utils[_0x936d('0x25')](_0xe9cfe7[_0x936d('0x26')][_0x936d('0x27')],_0xe9cfe7);var _0x12b446=_0x32bc4b[_0x936d('0x1d')]['split'](',');_0x4edcac[_0x936d('0x1e')](_0x12b446[0x0]);_0x4edcac[_0x936d('0x1e')](_0x12b446[0x1]);_0x4edcac[_0x936d('0x1e')](_0x12b446[0x2]);_0x4edcac[_0x936d('0x1e')](_0x12b446[0x3]);_0x4edcac['push'](_0x12b446[0x4]);_0x4edcac['push'](_0x12b446[0x5]);_0x4edcac[_0x936d('0x1e')](_0x12b446[0x6]);_0x4edcac[_0x936d('0x1e')](_0x12b446[0x7]);_0x4edcac['push'](_0x12b446[0x8]);_0x4edcac['push'](_0x12b446[0x9]);_0x4edcac[_0x936d('0x1e')](_0x12b446[0xa]);_0x4edcac[_0x936d('0x1e')](_0xe9cfe7[_0x936d('0x13')]['id']);_0x4edcac[_0x936d('0x1e')](_0xe9cfe7[_0x936d('0x12')]['id']);_0x4edcac['push'](_0x32bc4b[_0x936d('0x28')]);_0x4edcac['push'](_0xe9cfe7[_0x936d('0x13')]['ContactId']);_0x4edcac['push'](_0xe9cfe7[_0x936d('0x29')][_0x936d('0x29')]);_0x4edcac[_0x936d('0x1e')](_0x3c44cb);break;default:_0x4edcac=_[_0x936d('0xd')](_0x32bc4b[_0x936d('0x1d')])?[]:_0x32bc4b[_0x936d('0x1d')][_0x936d('0x20')](',');}var _0xc70307={'id':util[_0x936d('0xc')]('%s:%s:%s',_0xfdf1cf,_0x32bc4b['id'],_0x32bc4b[_0x936d('0x1a')]),'condition':require(_0x936d('0x2a'))[_0x936d('0x2b')](_0xfdf1cf,getIntervals(_0x6775db['intervals'],_0x32bc4b),_0x6775db),'consequence':require('./applications/'+_0x32bc4b[_0x936d('0x1a')])[_0x936d('0x2c')](_0xfdf1cf,_0x4edcac,_0x6775db,_0xe9cfe7),'p':_0x32bc4b[_0x936d('0x2d')]||0x0};logger['info']('Push\x20new\x20rule',_0xc70307['id'],_0x936d('0x2e'),getIntervals(_0x6775db[_0x936d('0x2f')],_0x32bc4b)['join']('\x20|\x20'));_0x1626ee[_0x936d('0x1e')](_0xc70307);}else{logger['error'](_0x936d('0x30'),path['join'](__dirname,'applications',_0x32bc4b[_0x936d('0x1a')]+_0x936d('0x1b')));}}_0x6775db[_0x936d('0x31')][_0xfdf1cf]=new RuleEngine(_0x1626ee);_0x6775db[_0x936d('0x31')][_0xfdf1cf][_0x936d('0x32')](_0xe9cfe7,function(_0x327a63){logger[_0x936d('0x33')]('Applications\x20executed',JSON[_0x936d('0x34')](_0x327a63[_0x936d('0x35')]));if(_0x6775db[_0x936d('0x31')][_0xfdf1cf]){_0x6775db['rules'][_0xfdf1cf]['emit'](_0x936d('0x36'));}});return _0x4eb47f({'code':0xc8,'message':_0xe9cfe7});}else{if(_0x500a57){logger[_0x936d('0x33')](util[_0x936d('0xc')](_0x936d('0x37'),_0xfdf1cf));}else{logger[_0x936d('0x33')]('No\x20applications\x20to\x20execute');}return _0x4eb47f({'code':0xc8,'message':_0xe9cfe7});}}catch(_0x72b596){logger['error'](_0x72b596[_0x936d('0x38')]);return _0x5c231a(_0x8289ba[_0x936d('0x39')](0x1f4,_0x72b596));}}return _0x5c231a(_0x936d('0x3a'));});},'AcceptMessage':function(_0x5b3dcf){var _0x5ab500=this;return new Promise(function(_0x135080,_0x485acf){if(_0x5b3dcf[_0x936d('0x3b')]&&_0x5b3dcf[_0x936d('0x3b')]['id']){if(_0x6775db['agents'][_0x5b3dcf['agent']['id']]){_0x6775db['agents'][_0x5b3dcf[_0x936d('0x3b')]['id']]['busy']=![];_0x6775db[_0x936d('0x3c')][_0x5b3dcf[_0x936d('0x3b')]['id']][_0x936d('0x3d')]=undefined;}}if(_0x5b3dcf[_0x936d('0x12')]&&_0x5b3dcf[_0x936d('0x12')]['id']){try{var _0x553458=getId(_0x5b3dcf[_0x936d('0x11')],_0x5b3dcf[_0x936d('0x12')]?_0x5b3dcf[_0x936d('0x12')]['id']:0x0,_0x5b3dcf['interaction']?_0x5b3dcf[_0x936d('0x13')]['id']:0x0);if(_0x6775db[_0x936d('0x31')][_0x553458]){_0x6775db[_0x936d('0x31')][_0x553458][_0x936d('0x3e')](_0x936d('0x3f'));if(rpc[_0x5b3dcf[_0x936d('0x11')]+_0x936d('0x40')]){rpc[_0x5b3dcf[_0x936d('0x11')]+_0x936d('0x40')][_0x936d('0x41')](_0x553458,{'UserId':_0x5b3dcf['message'][_0x936d('0x42')]})['catch'](function(){logger[_0x936d('0x39')](_0x936d('0x43'));});}}return _0x135080({'code':0xc8,'message':_0x5b3dcf});}catch(_0x3ba59b){logger[_0x936d('0x39')](_0x3ba59b[_0x936d('0x38')]);return _0x485acf(_0x5ab500['error'](0x1f4,_0x3ba59b));}}logger[_0x936d('0x39')]('message\x20is\x20empty');return _0x485acf(_0x5ab500[_0x936d('0x39')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x2bc514){var _0x3f118d=this;return new Promise(function(_0x11c7d0,_0x3a6447){if(_0x2bc514[_0x936d('0x3b')]&&_0x2bc514[_0x936d('0x3b')]['id']){try{if(_0x6775db[_0x936d('0x3c')][_0x2bc514['agent']['id']]){_0x6775db[_0x936d('0x3c')][_0x2bc514[_0x936d('0x3b')]['id']]['busy']=![];_0x6775db[_0x936d('0x3c')][_0x2bc514[_0x936d('0x3b')]['id']][_0x936d('0x3d')]=undefined;}return _0x11c7d0({'code':0xc8,'message':_0x2bc514});}catch(_0x414296){logger['error'](_0x414296[_0x936d('0x38')]);return _0x3a6447(_0x3f118d[_0x936d('0x39')](0x1f4,_0x414296));}}logger[_0x936d('0x39')](_0x936d('0x44'));return _0x3a6447(_0x3f118d[_0x936d('0x39')](0x1f4,_0x936d('0x44')));});},'AbandonInteraction':function(_0x523d43){var _0x4cd5e9=this;return new Promise(function(_0x1c690e,_0x278757){if(_0x523d43['channel']&&_0x523d43['interaction']&&_0x523d43[_0x936d('0x13')]['id']){try{var _0x57dc63=getId(_0x523d43[_0x936d('0x11')],_0x523d43[_0x936d('0x12')]?_0x523d43[_0x936d('0x12')]['id']:0x0,_0x523d43[_0x936d('0x13')]?_0x523d43[_0x936d('0x13')]['id']:0x0);if(_0x6775db[_0x936d('0x31')][_0x57dc63]){_0x6775db['rules'][_0x57dc63][_0x936d('0x3e')](_0x936d('0x3f'));}return _0x1c690e({'code':0xc8,'message':_0x523d43});}catch(_0x92301d){logger[_0x936d('0x39')](_0x92301d[_0x936d('0x38')]);return _0x278757(_0x4cd5e9['error'](0x1f4,_0x92301d));}}logger[_0x936d('0x39')]('message\x20is\x20empty');return _0x278757(_0x4cd5e9[_0x936d('0x39')](0x1f4,_0x936d('0x44')));});},'AgentCapacity':function(_0x419db6){var _0x5974b2=this;return new Promise(function(_0x500661,_0x5a4974){if(_0x6775db[_0x936d('0x3c')][_0x936d('0x45')](_0x419db6['id'])){for(var _0x2feb6d in _0x419db6[_0x936d('0x46')]){if(_0x419db6['capacity'][_0x936d('0x45')](_0x2feb6d)){if(_0x6775db[_0x936d('0x3c')][_0x419db6['id']][_0x936d('0x45')](_0x2feb6d+_0x936d('0x47'))){_0x6775db[_0x936d('0x3c')][_0x419db6['id']][_0x2feb6d+'CurrentCapacity']=parseInt(_0x419db6['capacity'][_0x2feb6d],0xa);}}}_0x6775db[_0x936d('0x3c')][_0x419db6['id']][_0x936d('0x48')]();return _0x500661({'code':0xc8,'message':_0x6775db[_0x936d('0x3c')][_0x419db6['id']]});}else{return _0x5a4974(_0x5974b2[_0x936d('0x39')](0x1f4,_0x936d('0x49')));}});},'Agents':function(_0x2865e2){return new Promise(function(_0xbe9617){var _0x11cc85=_[_0x936d('0x4a')](_0x6775db[_0x936d('0x3c')]);if(_0x2865e2&&_0x2865e2['id']){var _0x4609ba=_[_0x936d('0x4b')](_0x11cc85,function(_0x4cc389){return _0x4cc389['id']===_0x2865e2['id'];});_0xbe9617(_0x4609ba);}else{_0xbe9617({'count':_0x11cc85[_0x936d('0x17')],'rows':_0x11cc85});}});},'ChatQueues':function(){return new Promise(function(_0x1e4628){var _0x22dff9=[];for(var _0x2303e4 in _0x6775db[_0x936d('0x4c')]){if(_0x6775db[_0x936d('0x4c')][_0x936d('0x45')](_0x2303e4)){var _0x164e9c=_0x6775db[_0x936d('0x4c')][_0x2303e4];var _0x262d6b={'id':_0x164e9c['id'],'available':_0x164e9c[_0x936d('0x4d')],'loggedIn':_0x164e9c['loggedIn'],'name':_0x164e9c['name'],'paused':_0x164e9c[_0x936d('0x4e')],'waiting':_0x164e9c[_0x936d('0x4f')]};_0x22dff9['push'](_0x262d6b);}}_0x1e4628({'count':_0x22dff9[_0x936d('0x17')],'rows':_0x22dff9});});},'MailQueues':function(){return new Promise(function(_0x13092b){var _0x541bf4=[];for(var _0x22e2f2 in _0x6775db['mailQueues']){if(_0x6775db[_0x936d('0x50')]['hasOwnProperty'](_0x22e2f2)){var _0x248ef7=_0x6775db['mailQueues'][_0x22e2f2];var _0x3badec={'id':_0x248ef7['id'],'available':_0x248ef7[_0x936d('0x4d')],'loggedIn':_0x248ef7[_0x936d('0x51')],'name':_0x248ef7[_0x936d('0x52')],'paused':_0x248ef7[_0x936d('0x4e')],'waiting':_0x248ef7[_0x936d('0x4f')]};_0x541bf4[_0x936d('0x1e')](_0x3badec);}}_0x13092b({'count':_0x541bf4[_0x936d('0x17')],'rows':_0x541bf4});});},'OpenchannelQueues':function(){return new Promise(function(_0x301cb5){var _0x2b3938=[];for(var _0x5764b2 in _0x6775db['openchannelQueues']){if(_0x6775db[_0x936d('0x53')]['hasOwnProperty'](_0x5764b2)){var _0x59f004=_0x6775db[_0x936d('0x53')][_0x5764b2];var _0x5bb6ee={'id':_0x59f004['id'],'available':_0x59f004[_0x936d('0x4d')],'loggedIn':_0x59f004[_0x936d('0x51')],'name':_0x59f004[_0x936d('0x52')],'paused':_0x59f004[_0x936d('0x4e')],'waiting':_0x59f004[_0x936d('0x4f')]};_0x2b3938[_0x936d('0x1e')](_0x5bb6ee);}}_0x301cb5({'count':_0x2b3938[_0x936d('0x17')],'rows':_0x2b3938});});},'SmsQueues':function(){return new Promise(function(_0x44adb8){var _0xf412b1=[];for(var _0x1354ed in _0x6775db[_0x936d('0x54')]){if(_0x6775db[_0x936d('0x54')]['hasOwnProperty'](_0x1354ed)){var _0x15e031=_0x6775db['smsQueues'][_0x1354ed];var _0xb0ba82={'id':_0x15e031['id'],'available':_0x15e031['available'],'loggedIn':_0x15e031['loggedIn'],'name':_0x15e031[_0x936d('0x52')],'paused':_0x15e031['paused'],'waiting':_0x15e031[_0x936d('0x4f')]};_0xf412b1[_0x936d('0x1e')](_0xb0ba82);}}_0x44adb8({'count':_0xf412b1[_0x936d('0x17')],'rows':_0xf412b1});});},'FaxQueues':function(){return new Promise(function(_0x55dc92){var _0xbd161a=[];for(var _0x5a6ede in _0x6775db[_0x936d('0x55')]){if(_0x6775db['faxQueues'][_0x936d('0x45')](_0x5a6ede)){var _0x402e1a=_0x6775db[_0x936d('0x55')][_0x5a6ede];var _0x118e50={'id':_0x402e1a['id'],'available':_0x402e1a[_0x936d('0x4d')],'loggedIn':_0x402e1a[_0x936d('0x51')],'name':_0x402e1a['name'],'paused':_0x402e1a[_0x936d('0x4e')],'waiting':_0x402e1a[_0x936d('0x4f')]};_0xbd161a[_0x936d('0x1e')](_0x118e50);}}_0x55dc92({'count':_0xbd161a[_0x936d('0x17')],'rows':_0xbd161a});});},'WhatsappQueues':function(){return new Promise(function(_0x4ea214){var _0xae6e10=[];for(var _0xca60ae in _0x6775db[_0x936d('0x56')]){if(_0x6775db[_0x936d('0x56')][_0x936d('0x45')](_0xca60ae)){var _0x407d0b=_0x6775db['whatsappQueues'][_0xca60ae];var _0x189d7c={'id':_0x407d0b['id'],'available':_0x407d0b[_0x936d('0x4d')],'loggedIn':_0x407d0b[_0x936d('0x51')],'name':_0x407d0b['name'],'paused':_0x407d0b[_0x936d('0x4e')],'waiting':_0x407d0b[_0x936d('0x4f')]};_0xae6e10['push'](_0x189d7c);}}_0x4ea214({'count':_0xae6e10[_0x936d('0x17')],'rows':_0xae6e10});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x8485bb){var _0x1a82ed=_[_0x936d('0x4a')](_0x6775db[_0x936d('0x57')]);_0x8485bb({'count':_0x1a82ed[_0x936d('0x17')],'rows':_0x1a82ed});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x254bb1){var _0x41fe9f=_[_0x936d('0x4a')](_0x6775db[_0x936d('0x58')]);_0x254bb1({'count':_0x41fe9f[_0x936d('0x17')],'rows':_0x41fe9f});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x183b33){var _0x8095e0=_[_0x936d('0x4a')](_0x6775db[_0x936d('0x59')]);_0x183b33({'count':_0x8095e0[_0x936d('0x17')],'rows':_0x8095e0});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x33e5d5){var _0x1dcecb=_[_0x936d('0x4a')](_0x6775db[_0x936d('0x5a')]);_0x33e5d5({'count':_0x1dcecb[_0x936d('0x17')],'rows':_0x1dcecb});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x387498){var _0x52cada=_['values'](_0x6775db['faxQueuesWaitingInteractions']);_0x387498({'count':_0x52cada['length'],'rows':_0x52cada});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x626d0f){var _0x94fd2c=_[_0x936d('0x4a')](_0x6775db['whatsappQueuesWaitingInteractions']);_0x626d0f({'count':_0x94fd2c[_0x936d('0x17')],'rows':_0x94fd2c});});}};var _0x3c7919=jayson[_0x936d('0x5b')](_0x51186e)[_0x936d('0x5c')]();_0x3c7919['on']('error',function(_0x443f3d){logger[_0x936d('0x39')](JSON[_0x936d('0x34')](_0x443f3d));return _0x1f14c7(_0x443f3d);});_0x3c7919[_0x936d('0x5d')](0x232c,_0x936d('0x5e'),function(){console['log'](_0x936d('0x5f'),0x232c);return _0x18606b(_0x936d('0x60')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 29ead25..938f5a8 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 _0xf9aa=['bluebird','jayson/promise','lodash','routing','client','http','request','error','message','result','catch','condition','length','push','iftime\x20%s','then','indexOf','true','[%s][INTERVAL]\x20%s','some','[%s][INTERVAL]\x20%s\x20%s','join','when','log','stack','stop','util'];(function(_0x5d063a,_0x13510e){var _0x3bc356=function(_0x33c766){while(--_0x33c766){_0x5d063a['push'](_0x5d063a['shift']());}};_0x3bc356(++_0x13510e);}(_0xf9aa,0x1e5));var _0xaf9a=function(_0x295143,_0x105ade){_0x295143=_0x295143-0x0;var _0x7982e4=_0xf9aa[_0x295143];return _0x7982e4;};'use strict';var util=require(_0xaf9a('0x0'));var BPromise=require(_0xaf9a('0x1'));var jayson=require(_0xaf9a('0x2'));var _=require(_0xaf9a('0x3'));var logger=require('../../../config/logger')(_0xaf9a('0x4'));var client=jayson[_0xaf9a('0x5')][_0xaf9a('0x6')]({'port':0x232a});function request(_0x54b3e2,_0x42da47){return new BPromise(function(_0x209fa1,_0x3da433){return client[_0xaf9a('0x7')](_0x54b3e2,_0x42da47)['then'](function(_0x1c3763){if(_0x1c3763[_0xaf9a('0x8')]){return _0x3da433(_0x1c3763[_0xaf9a('0x8')][_0xaf9a('0x9')]);}else{return _0x209fa1(_0x1c3763[_0xaf9a('0xa')]);}})[_0xaf9a('0xb')](function(_0x2eded9){return _0x3da433(_0x2eded9);});});}exports[_0xaf9a('0xc')]=function(_0x5b90cc,_0x2eb531,_0x5af012){return function(_0x3783ef){if(_0x5af012['rules']&&!_0x5af012['rules'][_0x5b90cc]){logger['info']('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x5b90cc);return _0x3783ef['stop']();}var _0x4f5a9b=[];for(var _0x99cfbf=0x0;_0x99cfbf<_0x2eb531[_0xaf9a('0xd')];_0x99cfbf+=0x1){_0x4f5a9b[_0xaf9a('0xe')](request('Command',{'command':util['format'](_0xaf9a('0xf'),_0x2eb531[_0x99cfbf])})[_0xaf9a('0x10')](function(_0x115b36){return _0x115b36&&_0x115b36[_0xaf9a('0x9')]&&_0x115b36[_0xaf9a('0x9')][_0xaf9a('0x11')](_0xaf9a('0x12'))>=0x0?!![]:![];})[_0xaf9a('0xb')](function(_0x203795){logger[_0xaf9a('0x8')](_0xaf9a('0x13'),_0x5b90cc,_0x2eb531[_0x99cfbf]);}));}BPromise['all'](_0x4f5a9b)[_0xaf9a('0x10')](function(_0x4c9d0b){var _0x41bb76=_[_0xaf9a('0x14')](_0x4c9d0b);logger['info'](_0xaf9a('0x15'),_0x5b90cc,_0x2eb531[_0xaf9a('0x16')]('\x20|\x20'),_0x41bb76);_0x3783ef[_0xaf9a('0x17')](_0x41bb76);})[_0xaf9a('0xb')](function(_0x1facc5){console[_0xaf9a('0x18')](_0x1facc5);logger[_0xaf9a('0x8')](_0xaf9a('0x15'),_0x5b90cc,_0x2eb531[_0xaf9a('0x16')]('\x20|\x20'),_0x1facc5[_0xaf9a('0x19')]);_0x3783ef[_0xaf9a('0x1a')]();});};}; \ No newline at end of file +var _0x1e4d=['[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','iftime\x20%s','indexOf','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','util','../../../config/logger','routing','client','http','then','error','message','result','catch','condition','info'];(function(_0xeea5ca,_0x2d569b){var _0x1fdf07=function(_0x86809){while(--_0x86809){_0xeea5ca['push'](_0xeea5ca['shift']());}};_0x1fdf07(++_0x2d569b);}(_0x1e4d,0x96));var _0xd1e4=function(_0xd8113d,_0x26b002){_0xd8113d=_0xd8113d-0x0;var _0x58e165=_0x1e4d[_0xd8113d];return _0x58e165;};'use strict';var util=require(_0xd1e4('0x0'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var _=require('lodash');var logger=require(_0xd1e4('0x1'))(_0xd1e4('0x2'));var client=jayson[_0xd1e4('0x3')][_0xd1e4('0x4')]({'port':0x232a});function request(_0x2efc25,_0x34ed3f){return new BPromise(function(_0x15eb34,_0x33be05){return client['request'](_0x2efc25,_0x34ed3f)[_0xd1e4('0x5')](function(_0x13ec9b){if(_0x13ec9b['error']){return _0x33be05(_0x13ec9b[_0xd1e4('0x6')][_0xd1e4('0x7')]);}else{return _0x15eb34(_0x13ec9b[_0xd1e4('0x8')]);}})[_0xd1e4('0x9')](function(_0x2e4d38){return _0x33be05(_0x2e4d38);});});}exports[_0xd1e4('0xa')]=function(_0x2c1ec5,_0x1c773d,_0x1e09e8){return function(_0x1e276c){if(_0x1e09e8['rules']&&!_0x1e09e8['rules'][_0x2c1ec5]){logger[_0xd1e4('0xb')](_0xd1e4('0xc'),_0x2c1ec5);return _0x1e276c[_0xd1e4('0xd')]();}var _0x3111c3=[];for(var _0x3a07d0=0x0;_0x3a07d0<_0x1c773d[_0xd1e4('0xe')];_0x3a07d0+=0x1){_0x3111c3[_0xd1e4('0xf')](request(_0xd1e4('0x10'),{'command':util['format'](_0xd1e4('0x11'),_0x1c773d[_0x3a07d0])})[_0xd1e4('0x5')](function(_0x84360d){return _0x84360d&&_0x84360d[_0xd1e4('0x7')]&&_0x84360d['message'][_0xd1e4('0x12')]('true')>=0x0?!![]:![];})['catch'](function(_0x4269c1){logger[_0xd1e4('0x6')]('[%s][INTERVAL]\x20%s',_0x2c1ec5,_0x1c773d[_0x3a07d0]);}));}BPromise[_0xd1e4('0x13')](_0x3111c3)['then'](function(_0x297023){var _0x23a543=_[_0xd1e4('0x14')](_0x297023);logger[_0xd1e4('0xb')](_0xd1e4('0x15'),_0x2c1ec5,_0x1c773d[_0xd1e4('0x16')](_0xd1e4('0x17')),_0x23a543);_0x1e276c[_0xd1e4('0x18')](_0x23a543);})[_0xd1e4('0x9')](function(_0x1369fe){console[_0xd1e4('0x19')](_0x1369fe);logger[_0xd1e4('0x6')](_0xd1e4('0x15'),_0x2c1ec5,_0x1c773d[_0xd1e4('0x16')](_0xd1e4('0x17')),_0x1369fe[_0xd1e4('0x1a')]);_0x1e276c[_0xd1e4('0xd')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index a18c1cc..4b7d060 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 _0x5c00=['queuecallerabandon','forIn','includes','agentringnoanswer','now','abandoned','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','agentringnoanswerAt','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentcompleteAt','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','blind','transferexten','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','transfertype','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','agent','lodash','util','./utils','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','interface','calleridnum','connectedlinenum','queue','getVoiceQueueByName','type','agentacw','agentcomplete','acw','acwTimeout','CreateVoiceAgentReport','request','destuniqueid','debug','[%s][agents][agentcalled]','agentcalledAt','lastevent','called','connectedlinename','info','error','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','timeout','reason','holdtime','ringtime','talktime','push'];(function(_0x3702ba,_0x460951){var _0x115695=function(_0x13d972){while(--_0x13d972){_0x3702ba['push'](_0x3702ba['shift']());}};_0x115695(++_0x460951);}(_0x5c00,0x17e));var _0x05c0=function(_0xf64e53,_0x4db24b){_0xf64e53=_0xf64e53-0x0;var _0x1e185e=_0x5c00[_0xf64e53];return _0x1e185e;};'use strict';var _=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var utils=require(_0x05c0('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x4e54ec,_0x1e76da){utils['info'](util[_0x05c0('0x3')](_0x05c0('0x4'),_0x4e54ec[_0x05c0('0x5')],_0x4e54ec[_0x05c0('0x6')],_0x4e54ec['queue'],_0x4e54ec[_0x05c0('0x7')],_0x4e54ec[_0x05c0('0x8')],_0x4e54ec[_0x05c0('0x9')],_0x4e54ec[_0x05c0('0xa')],_0x4e54ec['lastevent']));if(_0x4e54ec[_0x05c0('0xb')]){utils[_0x05c0('0xc')](_0x4e54ec[_0x05c0('0xb')])['then'](function(_0x32a795){if(_0x32a795){_0x4e54ec[_0x05c0('0xd')]=_0x32a795[_0x05c0('0xd')];_0x4e54ec[_0x05c0('0xe')]=_0x4e54ec[_0x05c0('0xf')]?_0x32a795[_0x05c0('0x10')]:![];_0x4e54ec['acwtime']=_0x4e54ec['agentacw']?_0x32a795[_0x05c0('0x11')]:0x0;}utils['request'](_0x05c0('0x12'),_0x4e54ec);});}else{utils[_0x05c0('0x13')](_0x05c0('0x12'),_0x4e54ec);}if(_0x1e76da){delete transfers[_0x4e54ec['uniqueid']];}else{delete agents[_0x4e54ec[_0x05c0('0x14')]];}}exports['agentcalled']=function(_0x16a290){try{utils[_0x05c0('0x15')](util[_0x05c0('0x3')](_0x05c0('0x16'),_0x16a290[_0x05c0('0x5')]),_0x16a290);agents[_0x16a290[_0x05c0('0x14')]]=_0x16a290;agents[_0x16a290[_0x05c0('0x14')]][_0x05c0('0x17')]=utils['now']();agents[_0x16a290[_0x05c0('0x14')]][_0x05c0('0x18')]=_0x05c0('0x19');agents[_0x16a290[_0x05c0('0x14')]][_0x05c0('0xa')]=null;agents[_0x16a290[_0x05c0('0x14')]][_0x05c0('0x1a')]=null;utils[_0x05c0('0x1b')](util[_0x05c0('0x3')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x16a290[_0x05c0('0x5')],agents[_0x16a290[_0x05c0('0x14')]][_0x05c0('0x7')],_0x16a290['destuniqueid']));}catch(_0x40d905){utils[_0x05c0('0x1c')](util[_0x05c0('0x3')](_0x05c0('0x16'),_0x16a290[_0x05c0('0x5')]),_0x40d905);}};exports['agentringnoanswer']=function(_0x407c1f){try{if(!_[_0x05c0('0x1d')](agents[_0x407c1f['destuniqueid']])){utils['debug'](util['format'](_0x05c0('0x1e'),_0x407c1f[_0x05c0('0x5')]),_0x407c1f);utils[_0x05c0('0x1b')](util[_0x05c0('0x3')](_0x05c0('0x1f'),_0x407c1f[_0x05c0('0x5')],agents[_0x407c1f[_0x05c0('0x14')]]['membername'],_0x407c1f[_0x05c0('0x14')]));agents[_0x407c1f[_0x05c0('0x14')]]['agentringnoanswer']=!![];agents[_0x407c1f['destuniqueid']]['agentringnoanswerAt']=utils['now']();agents[_0x407c1f['destuniqueid']][_0x05c0('0x18')]=_0x05c0('0x20');agents[_0x407c1f['destuniqueid']][_0x05c0('0x21')]=_0x05c0('0x20');agents[_0x407c1f[_0x05c0('0x14')]][_0x05c0('0x22')]=_0x407c1f['ringtime']?parseInt(_0x407c1f[_0x05c0('0x23')])/0x3e8:0x0;agents[_0x407c1f[_0x05c0('0x14')]][_0x05c0('0x24')]=0x0;unanswered[_0x05c0('0x25')](_0x407c1f[_0x05c0('0x14')]);}}catch(_0x5d12e0){utils['error'](util['format'](_0x05c0('0x1e'),_0x407c1f[_0x05c0('0x5')]),_0x5d12e0);}};exports[_0x05c0('0x26')]=function(_0xd6574e){try{_[_0x05c0('0x27')](agents,function(_0x1e00c5,_0x1c4c8f){if(_0x1e00c5[_0x05c0('0x5')]==_0xd6574e[_0x05c0('0x5')]&&!_[_0x05c0('0x28')](unanswered,_0x1e00c5[_0x05c0('0x14')])){utils[_0x05c0('0x15')](util['format']('[%s][agents][queuecallerabandon]',_0xd6574e[_0x05c0('0x5')]),_0xd6574e);utils[_0x05c0('0x1b')](util[_0x05c0('0x3')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0xd6574e[_0x05c0('0x5')],_0x1e00c5[_0x05c0('0x7')],_0x1e00c5['destuniqueid']));_0x1e00c5[_0x05c0('0x29')]=!![];_0x1e00c5['agentringnoanswerAt']=utils[_0x05c0('0x2a')]();_0x1e00c5[_0x05c0('0x18')]=_0x05c0('0x2b');_0x1e00c5[_0x05c0('0x21')]=_0x05c0('0x2b');_0x1e00c5[_0x05c0('0x22')]=_0xd6574e[_0x05c0('0x22')];_0x1e00c5[_0x05c0('0x24')]=0x0;writeDB(_0x1e00c5);}});}catch(_0x3d8d76){utils[_0x05c0('0x1c')](util[_0x05c0('0x3')](_0x05c0('0x2c'),_0xd6574e[_0x05c0('0x5')]),_0x3d8d76);}};exports[_0x05c0('0x2d')]=function(_0x185d05){try{if(agents[_0x185d05[_0x05c0('0x14')]]){utils[_0x05c0('0x15')](util[_0x05c0('0x3')](_0x05c0('0x2e'),_0x185d05[_0x05c0('0x5')]),_0x185d05);utils[_0x05c0('0x1b')](util[_0x05c0('0x3')](_0x05c0('0x2f'),_0x185d05[_0x05c0('0x5')],agents[_0x185d05[_0x05c0('0x14')]][_0x05c0('0x7')],_0x185d05[_0x05c0('0x14')]));agents[_0x185d05[_0x05c0('0x14')]][_0x05c0('0x30')]=utils[_0x05c0('0x2a')]();agents[_0x185d05[_0x05c0('0x14')]][_0x05c0('0xa')]=_0x185d05[_0x05c0('0xa')];agents[_0x185d05['destuniqueid']][_0x05c0('0x1a')]=_0x185d05[_0x05c0('0x1a')];agents[_0x185d05[_0x05c0('0x14')]][_0x05c0('0x22')]=_0x185d05['ringtime'];agents[_0x185d05['destuniqueid']][_0x05c0('0x18')]=_0x05c0('0x31');_[_0x05c0('0x27')](agents,function(_0x4ced8e,_0x29dc87){if(_0x4ced8e[_0x05c0('0x14')]!=_0x185d05[_0x05c0('0x14')]&&_0x4ced8e[_0x05c0('0x5')]==_0x185d05['uniqueid']){_0x4ced8e[_0x05c0('0x24')]=0x0;_0x4ced8e[_0x05c0('0x22')]=_0x185d05['ringtime'];_0x4ced8e[_0x05c0('0x29')]=!![];_0x4ced8e[_0x05c0('0x32')]=utils[_0x05c0('0x2a')]();_0x4ced8e[_0x05c0('0x18')]=_0x05c0('0x33');_0x4ced8e[_0x05c0('0x21')]=_0x05c0('0x33');_0x4ced8e['answeredelsewheredestinationuniqueid']=_0x185d05['destuniqueid'];_0x4ced8e[_0x05c0('0x34')]=_0x185d05[_0x05c0('0x7')];writeDB(_0x4ced8e);}});}}catch(_0xaa5d53){utils[_0x05c0('0x1c')](util[_0x05c0('0x3')]('[%s][agents][agentconnect]',_0x185d05[_0x05c0('0x5')]),_0xaa5d53);}};exports[_0x05c0('0xf')]=function(_0x2fdfe8){try{if(!_[_0x05c0('0x1d')](agents[_0x2fdfe8[_0x05c0('0x14')]])){utils[_0x05c0('0x15')](util[_0x05c0('0x3')]('[%s][agents][agentcomplete]',_0x2fdfe8[_0x05c0('0x5')]),_0x2fdfe8);utils[_0x05c0('0x1b')](util[_0x05c0('0x3')](_0x05c0('0x35'),_0x2fdfe8[_0x05c0('0x5')],agents[_0x2fdfe8[_0x05c0('0x14')]][_0x05c0('0x7')],_0x2fdfe8[_0x05c0('0x14')]));agents[_0x2fdfe8[_0x05c0('0x14')]][_0x05c0('0xf')]=!![];agents[_0x2fdfe8[_0x05c0('0x14')]]['agentcompleteAt']=utils['now']();agents[_0x2fdfe8[_0x05c0('0x14')]][_0x05c0('0x24')]=utils[_0x05c0('0x36')](agents[_0x2fdfe8[_0x05c0('0x14')]][_0x05c0('0x37')],agents[_0x2fdfe8[_0x05c0('0x14')]]['agentconnectAt']);agents[_0x2fdfe8[_0x05c0('0x14')]][_0x05c0('0x21')]=_0x2fdfe8[_0x05c0('0x21')];agents[_0x2fdfe8[_0x05c0('0x14')]]['lastevent']=_0x05c0('0x38');writeDB(agents[_0x2fdfe8[_0x05c0('0x14')]]);}}catch(_0x3ec0bf){utils[_0x05c0('0x1c')](util['format'](_0x05c0('0x39'),_0x2fdfe8[_0x05c0('0x5')]),_0x3ec0bf);}};exports[_0x05c0('0x3a')]=function(_0x9b521b){try{if(!_['isNil'](agents[_0x9b521b[_0x05c0('0x3b')]])){utils[_0x05c0('0x15')](util['format'](_0x05c0('0x3c'),_0x9b521b['uniqueid']),_0x9b521b);utils['info'](util[_0x05c0('0x3')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x9b521b[_0x05c0('0x5')],agents[_0x9b521b[_0x05c0('0x3b')]][_0x05c0('0x7')],agents[_0x9b521b[_0x05c0('0x3b')]][_0x05c0('0x5')]));agents[_0x9b521b[_0x05c0('0x3b')]]['transfer']=!![];agents[_0x9b521b[_0x05c0('0x3b')]]['transfertype']=_0x05c0('0x3d');agents[_0x9b521b[_0x05c0('0x3b')]][_0x05c0('0x3e')]=_0x9b521b[_0x05c0('0x3f')];agents[_0x9b521b[_0x05c0('0x3b')]][_0x05c0('0x40')]=agents[_0x9b521b[_0x05c0('0x3b')]]['uniqueid'];}}catch(_0x5215b4){utils['error'](util[_0x05c0('0x3')](_0x05c0('0x3c'),_0x9b521b['uniqueid']),_0x5215b4);}};exports['attendedtransfer']=function(_0xbfb9cb){try{utils[_0x05c0('0x15')](util[_0x05c0('0x3')](_0x05c0('0x41'),_0xbfb9cb[_0x05c0('0x42')]),_0xbfb9cb);if(_0xbfb9cb[_0x05c0('0x42')]==_0xbfb9cb[_0x05c0('0x43')]){if(!_['isNil'](agents[_0xbfb9cb[_0x05c0('0x44')]])){utils[_0x05c0('0x1b')](util[_0x05c0('0x3')](_0x05c0('0x45'),_0xbfb9cb['origtransfereruniqueid'],agents[_0xbfb9cb[_0x05c0('0x44')]]['membername']));agents[_0xbfb9cb[_0x05c0('0x44')]][_0x05c0('0x46')]=!![];agents[_0xbfb9cb['secondtransfereruniqueid']][_0x05c0('0x47')]='ATTENDED';agents[_0xbfb9cb[_0x05c0('0x44')]][_0x05c0('0x3e')]=_0xbfb9cb[_0x05c0('0x48')];agents[_0xbfb9cb[_0x05c0('0x44')]][_0x05c0('0x40')]=_0xbfb9cb[_0x05c0('0x42')];}if(_0xbfb9cb['transfereeuniqueid']&&agents[_0xbfb9cb[_0x05c0('0x49')]]){agents[_0xbfb9cb[_0x05c0('0x49')]][_0x05c0('0x4a')]=0x1;transfers[_0xbfb9cb[_0x05c0('0x49')]]=_[_0x05c0('0x4b')](agents[_0xbfb9cb[_0x05c0('0x49')]]);transfers[_0xbfb9cb['transfereeuniqueid']][_0x05c0('0x9')]=agents[_0xbfb9cb[_0x05c0('0x44')]][_0x05c0('0x9')];transfers[_0xbfb9cb[_0x05c0('0x49')]][_0x05c0('0x4c')]=agents[_0xbfb9cb[_0x05c0('0x44')]][_0x05c0('0x4c')];transfers[_0xbfb9cb[_0x05c0('0x49')]][_0x05c0('0x17')]=utils[_0x05c0('0x2a')]();transfers[_0xbfb9cb[_0x05c0('0x49')]][_0x05c0('0x30')]=utils['now']();transfers[_0xbfb9cb['transfereeuniqueid']]['holdtime']=0x0;transfers[_0xbfb9cb[_0x05c0('0x49')]][_0x05c0('0x4a')]=0x2;}}else if(_0xbfb9cb[_0x05c0('0x44')]==_0xbfb9cb['secondtransfererlinkedid']){if(!_[_0x05c0('0x1d')](agents[_0xbfb9cb[_0x05c0('0x42')]])){utils[_0x05c0('0x1b')](util[_0x05c0('0x3')](_0x05c0('0x45'),_0xbfb9cb[_0x05c0('0x42')],agents[_0xbfb9cb[_0x05c0('0x42')]]['membername']));agents[_0xbfb9cb[_0x05c0('0x42')]][_0x05c0('0x46')]=!![];agents[_0xbfb9cb[_0x05c0('0x42')]][_0x05c0('0x47')]='ATTENDED';agents[_0xbfb9cb['origtransfereruniqueid']]['transferexten']=_0xbfb9cb[_0x05c0('0x4d')];agents[_0xbfb9cb[_0x05c0('0x42')]][_0x05c0('0x40')]=_0xbfb9cb[_0x05c0('0x44')];}if(_0xbfb9cb[_0x05c0('0x4e')]&&agents[_0xbfb9cb[_0x05c0('0x4e')]]){agents[_0xbfb9cb[_0x05c0('0x4e')]]['agententerreason']=0x1;transfers[_0xbfb9cb[_0x05c0('0x4e')]]=_[_0x05c0('0x4b')](agents[_0xbfb9cb[_0x05c0('0x4e')]]);transfers[_0xbfb9cb[_0x05c0('0x4e')]][_0x05c0('0x9')]=agents[_0xbfb9cb['origtransfereruniqueid']]['calleridnum'];transfers[_0xbfb9cb[_0x05c0('0x4e')]][_0x05c0('0x4c')]=agents[_0xbfb9cb['origtransfereruniqueid']][_0x05c0('0x4c')];transfers[_0xbfb9cb['transfertargetuniqueid']]['agentcalledAt']=utils[_0x05c0('0x2a')]();transfers[_0xbfb9cb[_0x05c0('0x4e')]][_0x05c0('0x30')]=utils['now']();transfers[_0xbfb9cb['transfertargetuniqueid']][_0x05c0('0x22')]=0x0;transfers[_0xbfb9cb[_0x05c0('0x4e')]][_0x05c0('0x4a')]=0x2;}}}catch(_0x5b39cb){utils['error'](util['format']('[%s][agents][attendedtransfer]',_0xbfb9cb['origtransfereruniqueid']),_0x5b39cb);}};exports[_0x05c0('0x4f')]=function(_0x4f43ae){try{utils['debug'](util['format'](_0x05c0('0x50'),_0x4f43ae[_0x05c0('0x5')]),_0x4f43ae);if(agents[_0x4f43ae[_0x05c0('0x5')]]&&agents[_0x4f43ae['uniqueid']][_0x05c0('0x21')]===_0x05c0('0x20')){if(_0x4f43ae['cause']==='21'){agents[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x21')]=_0x05c0('0x51');agents[_0x4f43ae[_0x05c0('0x5')]]['lastevent']=_0x05c0('0x51');}utils[_0x05c0('0x1b')](util[_0x05c0('0x3')](_0x05c0('0x52'),_0x4f43ae[_0x05c0('0x5')],agents[_0x4f43ae['uniqueid']]['membername'],agents[_0x4f43ae[_0x05c0('0x5')]]['reason'],agents[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x18')]));writeDB(agents[_0x4f43ae['uniqueid']]);var _0x3135bd=unanswered['indexOf'](_0x4f43ae['uniqueid']);if(_0x3135bd>-0x1){unanswered['splice'](_0x3135bd,0x1);}}if(transfers[_0x4f43ae['uniqueid']]){transfers[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0xf')]=!![];transfers[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x37')]=utils['now']();transfers[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x24')]=utils[_0x05c0('0x36')](transfers[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x37')],transfers[_0x4f43ae['uniqueid']][_0x05c0('0x30')]);transfers[_0x4f43ae['uniqueid']]['reason']=_0x05c0('0x53');transfers[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x18')]=_0x05c0('0x38');utils[_0x05c0('0x1b')](util[_0x05c0('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x4f43ae['uniqueid'],transfers[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x7')],transfers[_0x4f43ae[_0x05c0('0x5')]]['reason'],transfers[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x18')]));writeDB(transfers[_0x4f43ae[_0x05c0('0x5')]],!![]);}if(agents[_0x4f43ae[_0x05c0('0x5')]]&&agents[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x30')]){agents[_0x4f43ae['uniqueid']][_0x05c0('0xf')]=!![];agents[_0x4f43ae[_0x05c0('0x5')]]['agentcompleteAt']=utils[_0x05c0('0x2a')]();agents[_0x4f43ae[_0x05c0('0x5')]]['talktime']=utils[_0x05c0('0x36')](agents[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x37')],agents[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x30')]);agents[_0x4f43ae[_0x05c0('0x5')]]['reason']=agents[_0x4f43ae[_0x05c0('0x5')]]['transfer']?_0x05c0('0x46'):_0x05c0('0x53');agents[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x18')]=_0x05c0('0x38');utils[_0x05c0('0x1b')](util[_0x05c0('0x3')](_0x05c0('0x52'),_0x4f43ae[_0x05c0('0x5')],agents[_0x4f43ae[_0x05c0('0x5')]]['membername'],agents[_0x4f43ae[_0x05c0('0x5')]]['reason'],agents[_0x4f43ae[_0x05c0('0x5')]]['lastevent']));writeDB(agents[_0x4f43ae[_0x05c0('0x5')]]);}}catch(_0x36f82a){utils[_0x05c0('0x1c')](util[_0x05c0('0x3')](_0x05c0('0x50'),_0x4f43ae[_0x05c0('0x5')]),_0x36f82a);}}; \ No newline at end of file +var _0x9aea=['[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','error','agentringnoanswer','isNil','debug','agentringnoanswerAt','timeout','reason','holdtime','ringtime','[%s][agents][agentringnoanswer]','forIn','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','talktime','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','transfertype','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','transfer','origtransfererexten','transfereeuniqueid','clone','calleridname','agententerreason','transferexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','indexOf','splice','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','lodash','./utils','info','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','request','CreateVoiceAgentReport','destuniqueid','agentcalled','format'];(function(_0x37a4fe,_0x5c925d){var _0x3ffb4c=function(_0x3f417f){while(--_0x3f417f){_0x37a4fe['push'](_0x37a4fe['shift']());}};_0x3ffb4c(++_0x5c925d);}(_0x9aea,0xdd));var _0xa9ae=function(_0x4060a5,_0x433032){_0x4060a5=_0x4060a5-0x0;var _0x2adfed=_0x9aea[_0x4060a5];return _0x2adfed;};'use strict';var _=require(_0xa9ae('0x0'));var util=require('util');var utils=require(_0xa9ae('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x5e1d51,_0x2b5e0c){utils[_0xa9ae('0x2')](util['format'](_0xa9ae('0x3'),_0x5e1d51[_0xa9ae('0x4')],_0x5e1d51[_0xa9ae('0x5')],_0x5e1d51[_0xa9ae('0x6')],_0x5e1d51[_0xa9ae('0x7')],_0x5e1d51['interface'],_0x5e1d51[_0xa9ae('0x8')],_0x5e1d51[_0xa9ae('0x9')],_0x5e1d51[_0xa9ae('0xa')]));if(_0x5e1d51['queue']){utils[_0xa9ae('0xb')](_0x5e1d51[_0xa9ae('0x6')])[_0xa9ae('0xc')](function(_0x44cf1b){if(_0x44cf1b){_0x5e1d51[_0xa9ae('0xd')]=_0x44cf1b[_0xa9ae('0xd')];_0x5e1d51[_0xa9ae('0xe')]=_0x5e1d51[_0xa9ae('0xf')]?_0x44cf1b[_0xa9ae('0x10')]:![];_0x5e1d51['acwtime']=_0x5e1d51[_0xa9ae('0xe')]?_0x44cf1b['acwTimeout']:0x0;}utils[_0xa9ae('0x11')](_0xa9ae('0x12'),_0x5e1d51);});}else{utils[_0xa9ae('0x11')](_0xa9ae('0x12'),_0x5e1d51);}if(_0x2b5e0c){delete transfers[_0x5e1d51[_0xa9ae('0x4')]];}else{delete agents[_0x5e1d51[_0xa9ae('0x13')]];}}exports[_0xa9ae('0x14')]=function(_0x2b511a){try{utils['debug'](util[_0xa9ae('0x15')](_0xa9ae('0x16'),_0x2b511a[_0xa9ae('0x4')]),_0x2b511a);agents[_0x2b511a[_0xa9ae('0x13')]]=_0x2b511a;agents[_0x2b511a['destuniqueid']][_0xa9ae('0x17')]=utils[_0xa9ae('0x18')]();agents[_0x2b511a[_0xa9ae('0x13')]][_0xa9ae('0xa')]=_0xa9ae('0x19');agents[_0x2b511a[_0xa9ae('0x13')]]['connectedlinenum']=null;agents[_0x2b511a[_0xa9ae('0x13')]][_0xa9ae('0x1a')]=null;utils[_0xa9ae('0x2')](util['format']('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x2b511a[_0xa9ae('0x4')],agents[_0x2b511a['destuniqueid']]['membername'],_0x2b511a[_0xa9ae('0x13')]));}catch(_0x3b8245){utils[_0xa9ae('0x1b')](util[_0xa9ae('0x15')]('[%s][agents][agentcalled]',_0x2b511a[_0xa9ae('0x4')]),_0x3b8245);}};exports[_0xa9ae('0x1c')]=function(_0x39f133){try{if(!_[_0xa9ae('0x1d')](agents[_0x39f133[_0xa9ae('0x13')]])){utils[_0xa9ae('0x1e')](util[_0xa9ae('0x15')]('[%s][agents][agentringnoanswer]',_0x39f133[_0xa9ae('0x4')]),_0x39f133);utils['info'](util['format']('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x39f133['uniqueid'],agents[_0x39f133[_0xa9ae('0x13')]]['membername'],_0x39f133[_0xa9ae('0x13')]));agents[_0x39f133['destuniqueid']][_0xa9ae('0x1c')]=!![];agents[_0x39f133[_0xa9ae('0x13')]][_0xa9ae('0x1f')]=utils[_0xa9ae('0x18')]();agents[_0x39f133[_0xa9ae('0x13')]][_0xa9ae('0xa')]=_0xa9ae('0x20');agents[_0x39f133['destuniqueid']][_0xa9ae('0x21')]=_0xa9ae('0x20');agents[_0x39f133[_0xa9ae('0x13')]][_0xa9ae('0x22')]=_0x39f133[_0xa9ae('0x23')]?parseInt(_0x39f133[_0xa9ae('0x23')])/0x3e8:0x0;agents[_0x39f133[_0xa9ae('0x13')]]['talktime']=0x0;unanswered['push'](_0x39f133[_0xa9ae('0x13')]);}}catch(_0x3c324e){utils[_0xa9ae('0x1b')](util[_0xa9ae('0x15')](_0xa9ae('0x24'),_0x39f133['uniqueid']),_0x3c324e);}};exports['queuecallerabandon']=function(_0x1892b5){try{_[_0xa9ae('0x25')](agents,function(_0x372ec7,_0x3a48b7){if(_0x372ec7[_0xa9ae('0x4')]==_0x1892b5[_0xa9ae('0x4')]&&!_['includes'](unanswered,_0x372ec7['destuniqueid'])){utils[_0xa9ae('0x1e')](util[_0xa9ae('0x15')](_0xa9ae('0x26'),_0x1892b5[_0xa9ae('0x4')]),_0x1892b5);utils[_0xa9ae('0x2')](util[_0xa9ae('0x15')](_0xa9ae('0x27'),_0x1892b5[_0xa9ae('0x4')],_0x372ec7['membername'],_0x372ec7[_0xa9ae('0x13')]));_0x372ec7['agentringnoanswer']=!![];_0x372ec7[_0xa9ae('0x1f')]=utils[_0xa9ae('0x18')]();_0x372ec7[_0xa9ae('0xa')]='abandoned';_0x372ec7[_0xa9ae('0x21')]=_0xa9ae('0x28');_0x372ec7[_0xa9ae('0x22')]=_0x1892b5[_0xa9ae('0x22')];_0x372ec7[_0xa9ae('0x29')]=0x0;writeDB(_0x372ec7);}});}catch(_0x4cb3ae){utils[_0xa9ae('0x1b')](util[_0xa9ae('0x15')](_0xa9ae('0x26'),_0x1892b5['uniqueid']),_0x4cb3ae);}};exports['agentconnect']=function(_0x2155c8){try{if(agents[_0x2155c8[_0xa9ae('0x13')]]){utils[_0xa9ae('0x1e')](util[_0xa9ae('0x15')]('[%s][agents][agentconnect]',_0x2155c8[_0xa9ae('0x4')]),_0x2155c8);utils[_0xa9ae('0x2')](util[_0xa9ae('0x15')](_0xa9ae('0x2a'),_0x2155c8[_0xa9ae('0x4')],agents[_0x2155c8['destuniqueid']][_0xa9ae('0x7')],_0x2155c8['destuniqueid']));agents[_0x2155c8[_0xa9ae('0x13')]][_0xa9ae('0x2b')]=utils[_0xa9ae('0x18')]();agents[_0x2155c8['destuniqueid']][_0xa9ae('0x9')]=_0x2155c8[_0xa9ae('0x9')];agents[_0x2155c8[_0xa9ae('0x13')]]['connectedlinename']=_0x2155c8[_0xa9ae('0x1a')];agents[_0x2155c8[_0xa9ae('0x13')]]['holdtime']=_0x2155c8[_0xa9ae('0x23')];agents[_0x2155c8['destuniqueid']][_0xa9ae('0xa')]=_0xa9ae('0x2c');_['forIn'](agents,function(_0x37da9b,_0x15ce12){if(_0x37da9b[_0xa9ae('0x13')]!=_0x2155c8[_0xa9ae('0x13')]&&_0x37da9b[_0xa9ae('0x4')]==_0x2155c8[_0xa9ae('0x4')]){_0x37da9b['talktime']=0x0;_0x37da9b[_0xa9ae('0x22')]=_0x2155c8[_0xa9ae('0x23')];_0x37da9b['agentringnoanswer']=!![];_0x37da9b['agentringnoanswerAt']=utils[_0xa9ae('0x18')]();_0x37da9b[_0xa9ae('0xa')]=_0xa9ae('0x2d');_0x37da9b[_0xa9ae('0x21')]='answered_elsewhere';_0x37da9b[_0xa9ae('0x2e')]=_0x2155c8[_0xa9ae('0x13')];_0x37da9b[_0xa9ae('0x2f')]=_0x2155c8[_0xa9ae('0x7')];writeDB(_0x37da9b);}});}}catch(_0x23c91d){utils[_0xa9ae('0x1b')](util[_0xa9ae('0x15')]('[%s][agents][agentconnect]',_0x2155c8[_0xa9ae('0x4')]),_0x23c91d);}};exports[_0xa9ae('0xf')]=function(_0x566cb0){try{if(!_[_0xa9ae('0x1d')](agents[_0x566cb0['destuniqueid']])){utils[_0xa9ae('0x1e')](util[_0xa9ae('0x15')](_0xa9ae('0x30'),_0x566cb0[_0xa9ae('0x4')]),_0x566cb0);utils[_0xa9ae('0x2')](util[_0xa9ae('0x15')](_0xa9ae('0x31'),_0x566cb0['uniqueid'],agents[_0x566cb0[_0xa9ae('0x13')]][_0xa9ae('0x7')],_0x566cb0['destuniqueid']));agents[_0x566cb0[_0xa9ae('0x13')]][_0xa9ae('0xf')]=!![];agents[_0x566cb0[_0xa9ae('0x13')]][_0xa9ae('0x32')]=utils[_0xa9ae('0x18')]();agents[_0x566cb0[_0xa9ae('0x13')]]['talktime']=utils[_0xa9ae('0x33')](agents[_0x566cb0['destuniqueid']][_0xa9ae('0x32')],agents[_0x566cb0[_0xa9ae('0x13')]]['agentconnectAt']);agents[_0x566cb0['destuniqueid']][_0xa9ae('0x21')]=_0x566cb0[_0xa9ae('0x21')];agents[_0x566cb0[_0xa9ae('0x13')]][_0xa9ae('0xa')]=_0xa9ae('0x34');writeDB(agents[_0x566cb0[_0xa9ae('0x13')]]);}}catch(_0x2961e4){utils[_0xa9ae('0x1b')](util['format']('[%s][agents][agentcomplete]',_0x566cb0[_0xa9ae('0x4')]),_0x2961e4);}};exports[_0xa9ae('0x35')]=function(_0x4efe55){try{if(!_[_0xa9ae('0x1d')](agents[_0x4efe55[_0xa9ae('0x36')]])){utils[_0xa9ae('0x1e')](util[_0xa9ae('0x15')](_0xa9ae('0x37'),_0x4efe55[_0xa9ae('0x4')]),_0x4efe55);utils[_0xa9ae('0x2')](util[_0xa9ae('0x15')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x4efe55[_0xa9ae('0x4')],agents[_0x4efe55[_0xa9ae('0x36')]]['membername'],agents[_0x4efe55[_0xa9ae('0x36')]]['uniqueid']));agents[_0x4efe55['transfereruniqueid']]['transfer']=!![];agents[_0x4efe55[_0xa9ae('0x36')]][_0xa9ae('0x38')]='blind';agents[_0x4efe55['transfereruniqueid']]['transferexten']=_0x4efe55[_0xa9ae('0x39')];agents[_0x4efe55['transfereruniqueid']][_0xa9ae('0x3a')]=agents[_0x4efe55[_0xa9ae('0x36')]]['uniqueid'];}}catch(_0x1be415){utils['error'](util[_0xa9ae('0x15')](_0xa9ae('0x37'),_0x4efe55[_0xa9ae('0x4')]),_0x1be415);}};exports[_0xa9ae('0x3b')]=function(_0x371760){try{utils[_0xa9ae('0x1e')](util[_0xa9ae('0x15')](_0xa9ae('0x3c'),_0x371760[_0xa9ae('0x3d')]),_0x371760);if(_0x371760[_0xa9ae('0x3d')]==_0x371760[_0xa9ae('0x3e')]){if(!_[_0xa9ae('0x1d')](agents[_0x371760['secondtransfereruniqueid']])){utils[_0xa9ae('0x2')](util[_0xa9ae('0x15')](_0xa9ae('0x3f'),_0x371760[_0xa9ae('0x3d')],agents[_0x371760[_0xa9ae('0x40')]]['membername']));agents[_0x371760['secondtransfereruniqueid']][_0xa9ae('0x41')]=!![];agents[_0x371760[_0xa9ae('0x40')]]['transfertype']='ATTENDED';agents[_0x371760[_0xa9ae('0x40')]]['transferexten']=_0x371760[_0xa9ae('0x42')];agents[_0x371760[_0xa9ae('0x40')]][_0xa9ae('0x3a')]=_0x371760['origtransfereruniqueid'];}if(_0x371760[_0xa9ae('0x43')]&&agents[_0x371760['transfereeuniqueid']]){agents[_0x371760[_0xa9ae('0x43')]]['agententerreason']=0x1;transfers[_0x371760[_0xa9ae('0x43')]]=_[_0xa9ae('0x44')](agents[_0x371760[_0xa9ae('0x43')]]);transfers[_0x371760[_0xa9ae('0x43')]][_0xa9ae('0x8')]=agents[_0x371760[_0xa9ae('0x40')]]['calleridnum'];transfers[_0x371760[_0xa9ae('0x43')]][_0xa9ae('0x45')]=agents[_0x371760[_0xa9ae('0x40')]][_0xa9ae('0x45')];transfers[_0x371760['transfereeuniqueid']][_0xa9ae('0x17')]=utils[_0xa9ae('0x18')]();transfers[_0x371760[_0xa9ae('0x43')]][_0xa9ae('0x2b')]=utils[_0xa9ae('0x18')]();transfers[_0x371760[_0xa9ae('0x43')]][_0xa9ae('0x22')]=0x0;transfers[_0x371760[_0xa9ae('0x43')]][_0xa9ae('0x46')]=0x2;}}else if(_0x371760[_0xa9ae('0x40')]==_0x371760['secondtransfererlinkedid']){if(!_[_0xa9ae('0x1d')](agents[_0x371760[_0xa9ae('0x3d')]])){utils[_0xa9ae('0x2')](util[_0xa9ae('0x15')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x371760[_0xa9ae('0x3d')],agents[_0x371760[_0xa9ae('0x3d')]]['membername']));agents[_0x371760[_0xa9ae('0x3d')]][_0xa9ae('0x41')]=!![];agents[_0x371760[_0xa9ae('0x3d')]]['transfertype']='ATTENDED';agents[_0x371760[_0xa9ae('0x3d')]][_0xa9ae('0x47')]=_0x371760['secondtransfererexten'];agents[_0x371760['origtransfereruniqueid']][_0xa9ae('0x3a')]=_0x371760[_0xa9ae('0x40')];}if(_0x371760[_0xa9ae('0x48')]&&agents[_0x371760['transfertargetuniqueid']]){agents[_0x371760[_0xa9ae('0x48')]][_0xa9ae('0x46')]=0x1;transfers[_0x371760[_0xa9ae('0x48')]]=_[_0xa9ae('0x44')](agents[_0x371760[_0xa9ae('0x48')]]);transfers[_0x371760[_0xa9ae('0x48')]][_0xa9ae('0x8')]=agents[_0x371760[_0xa9ae('0x3d')]][_0xa9ae('0x8')];transfers[_0x371760[_0xa9ae('0x48')]]['calleridname']=agents[_0x371760['origtransfereruniqueid']][_0xa9ae('0x45')];transfers[_0x371760[_0xa9ae('0x48')]][_0xa9ae('0x17')]=utils['now']();transfers[_0x371760[_0xa9ae('0x48')]][_0xa9ae('0x2b')]=utils[_0xa9ae('0x18')]();transfers[_0x371760['transfertargetuniqueid']]['holdtime']=0x0;transfers[_0x371760[_0xa9ae('0x48')]]['agententerreason']=0x2;}}}catch(_0x14a720){utils[_0xa9ae('0x1b')](util[_0xa9ae('0x15')](_0xa9ae('0x3c'),_0x371760[_0xa9ae('0x3d')]),_0x14a720);}};exports[_0xa9ae('0x49')]=function(_0x1bf8e3){try{utils[_0xa9ae('0x1e')](util[_0xa9ae('0x15')](_0xa9ae('0x4a'),_0x1bf8e3['uniqueid']),_0x1bf8e3);if(agents[_0x1bf8e3[_0xa9ae('0x4')]]&&agents[_0x1bf8e3['uniqueid']][_0xa9ae('0x21')]===_0xa9ae('0x20')){if(_0x1bf8e3[_0xa9ae('0x4b')]==='21'){agents[_0x1bf8e3[_0xa9ae('0x4')]][_0xa9ae('0x21')]='rejected';agents[_0x1bf8e3[_0xa9ae('0x4')]][_0xa9ae('0xa')]=_0xa9ae('0x4c');}utils[_0xa9ae('0x2')](util[_0xa9ae('0x15')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x1bf8e3[_0xa9ae('0x4')],agents[_0x1bf8e3[_0xa9ae('0x4')]][_0xa9ae('0x7')],agents[_0x1bf8e3[_0xa9ae('0x4')]][_0xa9ae('0x21')],agents[_0x1bf8e3['uniqueid']]['lastevent']));writeDB(agents[_0x1bf8e3[_0xa9ae('0x4')]]);var _0x2f4a73=unanswered[_0xa9ae('0x4d')](_0x1bf8e3[_0xa9ae('0x4')]);if(_0x2f4a73>-0x1){unanswered[_0xa9ae('0x4e')](_0x2f4a73,0x1);}}if(transfers[_0x1bf8e3['uniqueid']]){transfers[_0x1bf8e3['uniqueid']][_0xa9ae('0xf')]=!![];transfers[_0x1bf8e3[_0xa9ae('0x4')]]['agentcompleteAt']=utils['now']();transfers[_0x1bf8e3[_0xa9ae('0x4')]][_0xa9ae('0x29')]=utils[_0xa9ae('0x33')](transfers[_0x1bf8e3[_0xa9ae('0x4')]]['agentcompleteAt'],transfers[_0x1bf8e3['uniqueid']][_0xa9ae('0x2b')]);transfers[_0x1bf8e3['uniqueid']]['reason']='agent';transfers[_0x1bf8e3['uniqueid']][_0xa9ae('0xa')]=_0xa9ae('0x34');utils[_0xa9ae('0x2')](util[_0xa9ae('0x15')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x1bf8e3[_0xa9ae('0x4')],transfers[_0x1bf8e3[_0xa9ae('0x4')]]['membername'],transfers[_0x1bf8e3[_0xa9ae('0x4')]]['reason'],transfers[_0x1bf8e3[_0xa9ae('0x4')]][_0xa9ae('0xa')]));writeDB(transfers[_0x1bf8e3[_0xa9ae('0x4')]],!![]);}if(agents[_0x1bf8e3[_0xa9ae('0x4')]]&&agents[_0x1bf8e3[_0xa9ae('0x4')]][_0xa9ae('0x2b')]){agents[_0x1bf8e3['uniqueid']][_0xa9ae('0xf')]=!![];agents[_0x1bf8e3[_0xa9ae('0x4')]][_0xa9ae('0x32')]=utils[_0xa9ae('0x18')]();agents[_0x1bf8e3[_0xa9ae('0x4')]][_0xa9ae('0x29')]=utils[_0xa9ae('0x33')](agents[_0x1bf8e3[_0xa9ae('0x4')]]['agentcompleteAt'],agents[_0x1bf8e3[_0xa9ae('0x4')]][_0xa9ae('0x2b')]);agents[_0x1bf8e3[_0xa9ae('0x4')]][_0xa9ae('0x21')]=agents[_0x1bf8e3[_0xa9ae('0x4')]][_0xa9ae('0x41')]?_0xa9ae('0x41'):_0xa9ae('0x4f');agents[_0x1bf8e3[_0xa9ae('0x4')]][_0xa9ae('0xa')]=_0xa9ae('0x34');utils[_0xa9ae('0x2')](util[_0xa9ae('0x15')](_0xa9ae('0x50'),_0x1bf8e3[_0xa9ae('0x4')],agents[_0x1bf8e3[_0xa9ae('0x4')]][_0xa9ae('0x7')],agents[_0x1bf8e3[_0xa9ae('0x4')]][_0xa9ae('0x21')],agents[_0x1bf8e3['uniqueid']][_0xa9ae('0xa')]));writeDB(agents[_0x1bf8e3[_0xa9ae('0x4')]]);}}catch(_0x1f6465){utils[_0xa9ae('0x1b')](util[_0xa9ae('0x15')](_0xa9ae('0x4a'),_0x1bf8e3[_0xa9ae('0x4')]),_0x1f6465);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 963b4bf..e2cb972 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 _0x2384=['[%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','request','CreateVoiceCallReport','recording','newchannel','debug','linkedid','OutgoingSpoolFailed','info','format','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','now','DOCUMENTATION','error','[%s][calls][newchannel]','newstate','[%s][calls][newstate]','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','channelstate','transfer','destinationchannel','answertime','toNumber','hangup','isNil','[%s][calls][hangup]','callerid','calleridname','cause-txt','duration','diffTime','endtime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','_attended','origtransfererchannel','userfield','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','[%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','xmd-callerid-preview','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','lastapplication','Queue','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','sipcallid','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','application','cdr','split','substring','lastIndexOf','includes','noop','execif','gotoif','toLowerCase','lodash','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0x2384,0x1aa));var _0x4238=function(_0x22f80c,_0x23b594){_0x22f80c=_0x22f80c-0x0;var _0x4c646e=_0x2384[_0x22f80c];return _0x4c646e;};'use strict';var _=require(_0x4238('0x0'));var util=require('util');var utils=require(_0x4238('0x1'));var transfers=require(_0x4238('0x2'));var dispositions=[_0x4238('0x3'),_0x4238('0x4'),_0x4238('0x4'),'NO\x20ANSWER',_0x4238('0x3'),'NO\x20ANSWER',_0x4238('0x5'),_0x4238('0x6'),_0x4238('0x4'),_0x4238('0x4'),_0x4238('0x4')];var channels={};function writeDB(_0x39a90f){var _0x448dfe;if(transfers[_0x4238('0x7')][_0x39a90f[_0x4238('0x8')]]){_0x448dfe=_0x39a90f['uniqueid'];_0x39a90f[_0x4238('0x8')]=transfers[_0x4238('0x7')][_0x39a90f['uniqueid']][_0x4238('0x9')];}utils['info'](util['format'](_0x4238('0xa'),_0x39a90f[_0x4238('0x8')],_0x39a90f[_0x4238('0xb')],_0x39a90f[_0x4238('0xc')],_0x39a90f[_0x4238('0xd')],_0x39a90f[_0x4238('0xe')],_0x39a90f[_0x4238('0xf')],_0x39a90f[_0x4238('0x10')],_0x39a90f[_0x4238('0x11')]));if(_0x39a90f[_0x4238('0x12')]){utils[_0x4238('0x13')](_0x39a90f[_0x4238('0x12')])[_0x4238('0x14')](function(_0xd0ec7){if(_0xd0ec7){_0x39a90f[_0x4238('0x15')]=_0xd0ec7['id'];}utils[_0x4238('0x16')]('CreateVoiceCallReport',_0x39a90f);});}else{utils[_0x4238('0x16')](_0x4238('0x17'),_0x39a90f);}if(channels[_0x39a90f['uniqueid']]){delete channels[_0x39a90f[_0x4238('0x8')]];}else if(_0x448dfe&&channels[_0x448dfe]){if(!transfers[_0x4238('0x7')][_0x448dfe][_0x4238('0x18')])delete transfers['blinds'][_0x448dfe];delete channels[_0x448dfe];}}exports[_0x4238('0x19')]=function(_0x30d210){try{utils[_0x4238('0x1a')](util['format']('[%s][calls][newchannel]',_0x30d210[_0x4238('0x8')]),_0x30d210);if(_0x30d210['uniqueid']==_0x30d210[_0x4238('0x1b')]&&_0x30d210[_0x4238('0xb')]!=_0x4238('0x1c')){utils[_0x4238('0x1d')](util[_0x4238('0x1e')](_0x4238('0x1f'),_0x30d210[_0x4238('0x8')],_0x30d210['context'],_0x30d210[_0x4238('0x20')]));channels[_0x30d210[_0x4238('0x8')]]={'uniqueid':_0x30d210[_0x4238('0x8')],'accountcode':_0x30d210[_0x4238('0x12')],'source':_0x30d210['calleridnum'],'destination':_0x30d210[_0x4238('0x20')],'destinationcontext':_0x30d210[_0x4238('0x21')],'channel':_0x30d210[_0x4238('0xb')],'starttime':utils[_0x4238('0x22')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x4238('0x23')};}}catch(_0x381e1f){utils[_0x4238('0x24')](util[_0x4238('0x1e')](_0x4238('0x25'),_0x30d210['uniqueid']),_0x381e1f);}};exports[_0x4238('0x26')]=function(_0xded23f){try{utils['debug'](util[_0x4238('0x1e')](_0x4238('0x27'),_0xded23f[_0x4238('0x8')]),_0xded23f);if(!_['isNil'](channels[_0xded23f[_0x4238('0x8')]])&&_0xded23f['channelstate']==0x6){utils[_0x4238('0x1d')](util[_0x4238('0x1e')](_0x4238('0x28'),_0xded23f[_0x4238('0x8')],_0xded23f[_0x4238('0x21')],_0xded23f[_0x4238('0xb')]));if(_['isNil'](channels[_0xded23f[_0x4238('0x8')]][_0x4238('0x29')])){channels[_0xded23f[_0x4238('0x8')]][_0x4238('0x29')]=utils[_0x4238('0x22')]();}}else if(!_['isNil'](channels[_0xded23f['linkedid']])&&_0xded23f[_0x4238('0x2a')]==0x6&&_0xded23f[_0x4238('0x21')]!=_0x4238('0x2b')){utils['info'](util[_0x4238('0x1e')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0xded23f[_0x4238('0x8')],_0xded23f[_0x4238('0x1b')],_0xded23f['context'],_0xded23f[_0x4238('0xb')]));channels[_0xded23f[_0x4238('0x1b')]]['accountcode']=_0xded23f[_0x4238('0x12')];channels[_0xded23f['linkedid']][_0x4238('0x2c')]=_0xded23f[_0x4238('0xb')];if(_['isNil'](channels[_0xded23f['linkedid']]['answertime'])){channels[_0xded23f[_0x4238('0x1b')]][_0x4238('0x2d')]=utils['now']();}channels[_0xded23f[_0x4238('0x1b')]]['disposition']=dispositions[_[_0x4238('0x2e')](_0xded23f[_0x4238('0x2a')])]||'ANSWERED';}}catch(_0x252ff0){utils[_0x4238('0x24')](util[_0x4238('0x1e')](_0x4238('0x27'),_0xded23f[_0x4238('0x8')]),_0x252ff0);}};exports[_0x4238('0x2f')]=function(_0xf8aeb5){try{if(!_[_0x4238('0x30')](channels[_0xf8aeb5['uniqueid']])){utils[_0x4238('0x1a')](util[_0x4238('0x1e')](_0x4238('0x31'),_0xf8aeb5[_0x4238('0x8')]),_0xf8aeb5);if(_[_0x4238('0x30')](channels[_0xf8aeb5[_0x4238('0x8')]][_0x4238('0x32')])){channels[_0xf8aeb5[_0x4238('0x8')]]['callerid']=_0xf8aeb5[_0x4238('0x33')]+'\x20<'+_0xf8aeb5[_0x4238('0xf')]+'>';}utils[_0x4238('0x1d')](util[_0x4238('0x1e')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0xf8aeb5[_0x4238('0x8')],channels[_0xf8aeb5[_0x4238('0x8')]][_0x4238('0x32')],_0xf8aeb5[_0x4238('0x34')]));channels[_0xf8aeb5[_0x4238('0x8')]]['endtime']=utils[_0x4238('0x22')]();channels[_0xf8aeb5[_0x4238('0x8')]][_0x4238('0x35')]=utils[_0x4238('0x36')](channels[_0xf8aeb5['uniqueid']][_0x4238('0x37')],channels[_0xf8aeb5[_0x4238('0x8')]]['starttime']);channels[_0xf8aeb5[_0x4238('0x8')]]['billableseconds']=channels[_0xf8aeb5['uniqueid']]['answertime']?utils[_0x4238('0x36')](channels[_0xf8aeb5[_0x4238('0x8')]][_0x4238('0x37')],channels[_0xf8aeb5[_0x4238('0x8')]][_0x4238('0x2d')]):0x0;writeDB(channels[_0xf8aeb5['uniqueid']]);}}catch(_0x36d730){utils[_0x4238('0x24')](util[_0x4238('0x1e')](_0x4238('0x31'),_0xf8aeb5[_0x4238('0x8')]),_0x36d730);}};exports[_0x4238('0x38')]=function(_0x15819b){try{if(!_['isNil'](channels[_0x15819b[_0x4238('0x39')]])){utils[_0x4238('0x1a')](util[_0x4238('0x1e')](_0x4238('0x3a'),_0x15819b['origtransfereruniqueid']),_0x15819b);if(channels[_0x15819b[_0x4238('0x39')]][_0x4238('0xb')]==_0x15819b[_0x4238('0x3b')]){utils['info'](util[_0x4238('0x1e')](_0x4238('0x3c'),_0x15819b[_0x4238('0x3d')],_0x15819b[_0x4238('0x39')],_0x15819b[_0x4238('0x3e')]));channels[_0x15819b[_0x4238('0x39')]][_0x4238('0x2c')]=_0x15819b['secondtransfererchannel'];channels[_0x15819b['localtwolinkedid']]['userfield']=_0x4238('0x3f');}else if(channels[_0x15819b[_0x4238('0x39')]][_0x4238('0xb')]=_0x15819b['transfertargetchannel']){utils[_0x4238('0x1d')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x15819b['origtransfereruniqueid'],_0x15819b['localtwolinkedid'],_0x15819b[_0x4238('0x40')]));channels[_0x15819b[_0x4238('0x39')]][_0x4238('0x2c')]=_0x15819b[_0x4238('0x40')];channels[_0x15819b[_0x4238('0x39')]][_0x4238('0x41')]=_0x4238('0x3f');}}}catch(_0x411edd){utils['error'](util[_0x4238('0x1e')](_0x4238('0x3a'),_0x15819b[_0x4238('0x3d')]),_0x411edd);}};exports['musiconholdstart']=function(_0x120287){try{if(!_[_0x4238('0x30')](channels[_0x120287[_0x4238('0x8')]])){utils[_0x4238('0x1a')](util[_0x4238('0x1e')](_0x4238('0x42'),_0x120287['uniqueid']),_0x120287);channels[_0x120287[_0x4238('0x8')]]['musiconholdstartAt']=utils[_0x4238('0x22')]();utils[_0x4238('0x1d')](util[_0x4238('0x1e')](_0x4238('0x43'),_0x120287[_0x4238('0x8')],channels[_0x120287[_0x4238('0x8')]][_0x4238('0x44')]));}}catch(_0x57c7b4){utils['error'](util[_0x4238('0x1e')](_0x4238('0x42'),_0x120287[_0x4238('0x8')]),_0x57c7b4);}};exports[_0x4238('0x45')]=function(_0x4c5118){try{if(!_['isNil'](channels[_0x4c5118['uniqueid']])){utils[_0x4238('0x1a')](util['format'](_0x4238('0x46'),_0x4c5118['uniqueid']),_0x4c5118);if(!_[_0x4238('0x30')](channels[_0x4c5118[_0x4238('0x8')]][_0x4238('0x44')])){channels[_0x4c5118[_0x4238('0x8')]][_0x4238('0x47')]+=utils[_0x4238('0x36')](utils[_0x4238('0x22')](),channels[_0x4c5118[_0x4238('0x8')]][_0x4238('0x44')]);utils['info'](util[_0x4238('0x1e')](_0x4238('0x48'),_0x4c5118[_0x4238('0x8')],channels[_0x4c5118[_0x4238('0x8')]][_0x4238('0x47')]));delete channels[_0x4c5118[_0x4238('0x8')]][_0x4238('0x44')];}}}catch(_0x223b4e){utils['error'](util[_0x4238('0x1e')](_0x4238('0x46'),_0x4c5118[_0x4238('0x8')]),_0x223b4e);}};exports[_0x4238('0x49')]=function(_0x696d65){try{if(!_[_0x4238('0x30')](channels[_0x696d65[_0x4238('0x8')]])){utils[_0x4238('0x1a')](util[_0x4238('0x1e')](_0x4238('0x4a'),_0x696d65['uniqueid']),_0x696d65);if(!_[_0x4238('0x30')](_0x696d65[_0x4238('0x4b')]['xmd-originatecalleridnum'])){utils['info'](util[_0x4238('0x1e')](_0x4238('0x4c'),_0x696d65['uniqueid'],_0x696d65[_0x4238('0x4d')]));channels[_0x696d65[_0x4238('0x8')]][_0x4238('0x4e')]=_0x696d65[_0x4238('0x4d')];}if(!_['isNil'](_0x696d65['variable'][_0x4238('0x4f')])){utils[_0x4238('0x1d')](util[_0x4238('0x1e')](_0x4238('0x50'),_0x696d65['uniqueid'],_0x696d65['value']));channels[_0x696d65[_0x4238('0x8')]][_0x4238('0x51')]=_0x696d65['value'];channels[_0x696d65[_0x4238('0x8')]][_0x4238('0x32')]='\x22'+_0x696d65[_0x4238('0x4d')]+_0x4238('0x52')+_0x696d65[_0x4238('0x4d')]+'>';}if(!_[_0x4238('0x30')](_0x696d65[_0x4238('0x4b')]['xmd-callerid-preview'])||!_[_0x4238('0x30')](_0x696d65['variable'][_0x4238('0x53')])){utils[_0x4238('0x1d')](util[_0x4238('0x1e')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x696d65[_0x4238('0x8')],!_[_0x4238('0x30')](_0x696d65['variable'][_0x4238('0x54')])?_0x4238('0x54'):'xmd-callerid',_0x696d65[_0x4238('0x4d')]));channels[_0x696d65[_0x4238('0x8')]]['callerid']=_0x696d65[_0x4238('0x4d')];}if(!_[_0x4238('0x30')](_0x696d65[_0x4238('0x4b')]['xmd-queue'])||!_[_0x4238('0x30')](_0x696d65[_0x4238('0x4b')][_0x4238('0x55')])){utils['info'](util[_0x4238('0x1e')](_0x4238('0x56'),_0x696d65[_0x4238('0x8')],!_['isNil'](_0x696d65['variable'][_0x4238('0x57')])?_0x4238('0x57'):_0x4238('0x55'),_0x696d65[_0x4238('0x4d')]));channels[_0x696d65[_0x4238('0x8')]][_0x4238('0x58')]=_0x4238('0x59');channels[_0x696d65[_0x4238('0x8')]][_0x4238('0x5a')]=_0x696d65[_0x4238('0x4d')];channels[_0x696d65['uniqueid']][_0x4238('0xc')]=!![];}if(!_['isNil'](_0x696d65[_0x4238('0x4b')]['xmd-contactid'])){utils['info'](util[_0x4238('0x1e')](_0x4238('0x5b'),_0x696d65['uniqueid'],_0x696d65['value']));channels[_0x696d65[_0x4238('0x8')]][_0x4238('0x5c')]=_0x696d65['value'];}if(!_[_0x4238('0x30')](_0x696d65[_0x4238('0x4b')][_0x4238('0x5d')])){utils['info'](util[_0x4238('0x1e')](_0x4238('0x5e'),_0x696d65[_0x4238('0x8')],_0x696d65['value']));channels[_0x696d65[_0x4238('0x8')]][_0x4238('0x5f')]=_0x696d65['value'];}if(!_[_0x4238('0x30')](_0x696d65[_0x4238('0x4b')]['outboundrouteid'])){utils['info'](util[_0x4238('0x1e')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x696d65[_0x4238('0x8')],_0x696d65[_0x4238('0x4d')]));channels[_0x696d65[_0x4238('0x8')]]['routeid']=_0x696d65[_0x4238('0x4d')];}if(!_['isNil'](_0x696d65['variable'][_0x4238('0x60')])){utils['info'](util[_0x4238('0x1e')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x696d65[_0x4238('0x8')],_0x696d65[_0x4238('0x4d')]));channels[_0x696d65['uniqueid']][_0x4238('0x60')]=_0x696d65[_0x4238('0x4d')];}}}catch(_0x29ac76){utils[_0x4238('0x24')](util[_0x4238('0x1e')](_0x4238('0x4a'),_0x696d65['uniqueid']),_0x29ac76);}};exports['newexten']=function(_0x4fa733){try{if(!_['isNil'](channels[_0x4fa733[_0x4238('0x8')]])){utils['debug'](util[_0x4238('0x1e')]('[%s][calls][newexten]',_0x4fa733[_0x4238('0x8')]),_0x4fa733);utils[_0x4238('0x1d')](util['format'](_0x4238('0x61'),_0x4fa733[_0x4238('0x8')],_0x4fa733['application'],_0x4fa733[_0x4238('0x62')]));if(_0x4fa733[_0x4238('0x63')]['toLowerCase']()=='set'&&_['startsWith'](_0x4fa733[_0x4238('0x62')]['toLowerCase'](),_0x4238('0x64'))){var _0x30555a=_0x4fa733[_0x4238('0x62')][_0x4238('0x65')]('=');var _0x1bbeed=_0x30555a[0x0][_0x4238('0x66')](_0x30555a[0x0][_0x4238('0x67')]('(')+0x1,_0x30555a[0x0][_0x4238('0x67')](')'));var _0x35a145=_0x30555a[0x1];channels[_0x4fa733[_0x4238('0x8')]][_0x1bbeed]=_0x35a145;}if(!_[_0x4238('0x68')](['hangup',_0x4238('0x69'),_0x4238('0x6a'),'set',_0x4238('0x6b')],_0x4fa733[_0x4238('0x63')][_0x4238('0x6c')]())){channels[_0x4fa733[_0x4238('0x8')]][_0x4238('0x58')]=_0x4fa733[_0x4238('0x63')];channels[_0x4fa733['uniqueid']][_0x4238('0x5a')]=_0x4fa733[_0x4238('0x62')];}}}catch(_0x147798){utils[_0x4238('0x24')](util[_0x4238('0x1e')]('[%s][calls][newexten]',_0x4fa733[_0x4238('0x8')]),_0x147798);}}; \ No newline at end of file +var _0x160c=['[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','musiconholdstartAt','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmd-queue','xmcs-queue','Queue','lastdata','xmd-contactid','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','application','set','startsWith','toLowerCase','cdr','lastIndexOf','includes','hangup','noop','gotoif','lastapplication','util','./utils','./transfers.controller','NO\x20ANSWER','ANSWERED','BUSY','FAILED','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','connectedlinenum','lastevent','getUserByInternal','accountcode','then','UserId','CreateVoiceCallReport','request','recording','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','diffTime','starttime','billableseconds','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel'];(function(_0x55d06b,_0x1897ba){var _0x564654=function(_0x262ec9){while(--_0x262ec9){_0x55d06b['push'](_0x55d06b['shift']());}};_0x564654(++_0x1897ba);}(_0x160c,0x181));var _0xc160=function(_0x5e4958,_0x1e8006){_0x5e4958=_0x5e4958-0x0;var _0x462fa6=_0x160c[_0x5e4958];return _0x462fa6;};'use strict';var _=require('lodash');var util=require(_0xc160('0x0'));var utils=require(_0xc160('0x1'));var transfers=require(_0xc160('0x2'));var dispositions=['NO\x20ANSWER','FAILED','FAILED',_0xc160('0x3'),'NO\x20ANSWER',_0xc160('0x3'),_0xc160('0x4'),_0xc160('0x5'),'FAILED',_0xc160('0x6'),'FAILED'];var channels={};function writeDB(_0x26e1f4){var _0x549651;if(transfers[_0xc160('0x7')][_0x26e1f4[_0xc160('0x8')]]){_0x549651=_0x26e1f4['uniqueid'];_0x26e1f4[_0xc160('0x8')]=transfers[_0xc160('0x7')][_0x26e1f4['uniqueid']][_0xc160('0x9')];}utils[_0xc160('0xa')](util[_0xc160('0xb')](_0xc160('0xc'),_0x26e1f4[_0xc160('0x8')],_0x26e1f4[_0xc160('0xd')],_0x26e1f4[_0xc160('0xe')],_0x26e1f4[_0xc160('0xf')],_0x26e1f4[_0xc160('0x10')],_0x26e1f4['calleridnum'],_0x26e1f4[_0xc160('0x11')],_0x26e1f4[_0xc160('0x12')]));if(_0x26e1f4['accountcode']){utils[_0xc160('0x13')](_0x26e1f4[_0xc160('0x14')])[_0xc160('0x15')](function(_0x548660){if(_0x548660){_0x26e1f4[_0xc160('0x16')]=_0x548660['id'];}utils['request'](_0xc160('0x17'),_0x26e1f4);});}else{utils[_0xc160('0x18')]('CreateVoiceCallReport',_0x26e1f4);}if(channels[_0x26e1f4[_0xc160('0x8')]]){delete channels[_0x26e1f4['uniqueid']];}else if(_0x549651&&channels[_0x549651]){if(!transfers[_0xc160('0x7')][_0x549651][_0xc160('0x19')])delete transfers[_0xc160('0x7')][_0x549651];delete channels[_0x549651];}}exports['newchannel']=function(_0x562ad2){try{utils[_0xc160('0x1a')](util[_0xc160('0xb')](_0xc160('0x1b'),_0x562ad2['uniqueid']),_0x562ad2);if(_0x562ad2[_0xc160('0x8')]==_0x562ad2[_0xc160('0x1c')]&&_0x562ad2[_0xc160('0xd')]!=_0xc160('0x1d')){utils['info'](util[_0xc160('0xb')](_0xc160('0x1e'),_0x562ad2['uniqueid'],_0x562ad2[_0xc160('0x1f')],_0x562ad2[_0xc160('0x20')]));channels[_0x562ad2[_0xc160('0x8')]]={'uniqueid':_0x562ad2[_0xc160('0x8')],'accountcode':_0x562ad2[_0xc160('0x14')],'source':_0x562ad2['calleridnum'],'destination':_0x562ad2[_0xc160('0x20')],'destinationcontext':_0x562ad2[_0xc160('0x1f')],'channel':_0x562ad2[_0xc160('0xd')],'starttime':utils[_0xc160('0x21')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xc160('0x3'),'amaflags':_0xc160('0x22')};}}catch(_0x2804ad){utils[_0xc160('0x23')](util[_0xc160('0xb')](_0xc160('0x1b'),_0x562ad2['uniqueid']),_0x2804ad);}};exports['newstate']=function(_0x3541ec){try{utils['debug'](util[_0xc160('0xb')](_0xc160('0x24'),_0x3541ec[_0xc160('0x8')]),_0x3541ec);if(!_['isNil'](channels[_0x3541ec[_0xc160('0x8')]])&&_0x3541ec[_0xc160('0x25')]==0x6){utils[_0xc160('0xa')](util[_0xc160('0xb')](_0xc160('0x26'),_0x3541ec['uniqueid'],_0x3541ec[_0xc160('0x1f')],_0x3541ec[_0xc160('0xd')]));if(_[_0xc160('0x27')](channels[_0x3541ec[_0xc160('0x8')]][_0xc160('0x28')])){channels[_0x3541ec[_0xc160('0x8')]][_0xc160('0x28')]=utils['now']();}}else if(!_[_0xc160('0x27')](channels[_0x3541ec[_0xc160('0x1c')]])&&_0x3541ec[_0xc160('0x25')]==0x6&&_0x3541ec['context']!='transfer'){utils[_0xc160('0xa')](util['format'](_0xc160('0x29'),_0x3541ec[_0xc160('0x8')],_0x3541ec[_0xc160('0x1c')],_0x3541ec['context'],_0x3541ec['channel']));channels[_0x3541ec['linkedid']]['accountcode']=_0x3541ec[_0xc160('0x14')];channels[_0x3541ec[_0xc160('0x1c')]][_0xc160('0x2a')]=_0x3541ec['channel'];if(_[_0xc160('0x27')](channels[_0x3541ec['linkedid']]['answertime'])){channels[_0x3541ec[_0xc160('0x1c')]][_0xc160('0x2b')]=utils['now']();}channels[_0x3541ec[_0xc160('0x1c')]][_0xc160('0x2c')]=dispositions[_[_0xc160('0x2d')](_0x3541ec[_0xc160('0x25')])]||_0xc160('0x4');}}catch(_0x43a47d){utils[_0xc160('0x23')](util['format']('[%s][calls][newstate]',_0x3541ec[_0xc160('0x8')]),_0x43a47d);}};exports['hangup']=function(_0x3c9ee1){try{if(!_[_0xc160('0x27')](channels[_0x3c9ee1[_0xc160('0x8')]])){utils[_0xc160('0x1a')](util[_0xc160('0xb')]('[%s][calls][hangup]',_0x3c9ee1['uniqueid']),_0x3c9ee1);if(_[_0xc160('0x27')](channels[_0x3c9ee1[_0xc160('0x8')]][_0xc160('0x2e')])){channels[_0x3c9ee1[_0xc160('0x8')]]['callerid']=_0x3c9ee1['calleridname']+'\x20<'+_0x3c9ee1['calleridnum']+'>';}utils[_0xc160('0xa')](util[_0xc160('0xb')](_0xc160('0x2f'),_0x3c9ee1[_0xc160('0x8')],channels[_0x3c9ee1['uniqueid']][_0xc160('0x2e')],_0x3c9ee1[_0xc160('0x30')]));channels[_0x3c9ee1['uniqueid']][_0xc160('0x31')]=utils['now']();channels[_0x3c9ee1[_0xc160('0x8')]]['duration']=utils[_0xc160('0x32')](channels[_0x3c9ee1[_0xc160('0x8')]][_0xc160('0x31')],channels[_0x3c9ee1[_0xc160('0x8')]][_0xc160('0x33')]);channels[_0x3c9ee1['uniqueid']][_0xc160('0x34')]=channels[_0x3c9ee1[_0xc160('0x8')]][_0xc160('0x2b')]?utils[_0xc160('0x32')](channels[_0x3c9ee1[_0xc160('0x8')]][_0xc160('0x31')],channels[_0x3c9ee1[_0xc160('0x8')]][_0xc160('0x2b')]):0x0;writeDB(channels[_0x3c9ee1['uniqueid']]);}}catch(_0x29d14d){utils[_0xc160('0x23')](util['format'](_0xc160('0x35'),_0x3c9ee1[_0xc160('0x8')]),_0x29d14d);}};exports[_0xc160('0x36')]=function(_0x2a50e7){try{if(!_[_0xc160('0x27')](channels[_0x2a50e7[_0xc160('0x37')]])){utils[_0xc160('0x1a')](util['format'](_0xc160('0x38'),_0x2a50e7[_0xc160('0x39')]),_0x2a50e7);if(channels[_0x2a50e7[_0xc160('0x37')]][_0xc160('0xd')]==_0x2a50e7[_0xc160('0x3a')]){utils['info'](util['format'](_0xc160('0x3b'),_0x2a50e7[_0xc160('0x39')],_0x2a50e7['localtwolinkedid'],_0x2a50e7['secondtransfererchannel']));channels[_0x2a50e7[_0xc160('0x37')]][_0xc160('0x2a')]=_0x2a50e7['secondtransfererchannel'];channels[_0x2a50e7[_0xc160('0x37')]][_0xc160('0x3c')]=_0xc160('0x3d');}else if(channels[_0x2a50e7[_0xc160('0x37')]]['channel']=_0x2a50e7[_0xc160('0x3e')]){utils[_0xc160('0xa')](util[_0xc160('0xb')](_0xc160('0x3b'),_0x2a50e7[_0xc160('0x39')],_0x2a50e7['localtwolinkedid'],_0x2a50e7['origtransfererchannel']));channels[_0x2a50e7[_0xc160('0x37')]][_0xc160('0x2a')]=_0x2a50e7[_0xc160('0x3f')];channels[_0x2a50e7[_0xc160('0x37')]][_0xc160('0x3c')]='_attended';}}}catch(_0x5b1873){utils[_0xc160('0x23')](util[_0xc160('0xb')](_0xc160('0x38'),_0x2a50e7[_0xc160('0x39')]),_0x5b1873);}};exports[_0xc160('0x40')]=function(_0x1f0592){try{if(!_[_0xc160('0x27')](channels[_0x1f0592['uniqueid']])){utils[_0xc160('0x1a')](util[_0xc160('0xb')](_0xc160('0x41'),_0x1f0592[_0xc160('0x8')]),_0x1f0592);channels[_0x1f0592[_0xc160('0x8')]]['musiconholdstartAt']=utils[_0xc160('0x21')]();utils['info'](util[_0xc160('0xb')](_0xc160('0x42'),_0x1f0592[_0xc160('0x8')],channels[_0x1f0592['uniqueid']]['musiconholdstartAt']));}}catch(_0x3b2e8c){utils[_0xc160('0x23')](util[_0xc160('0xb')](_0xc160('0x41'),_0x1f0592[_0xc160('0x8')]),_0x3b2e8c);}};exports[_0xc160('0x43')]=function(_0x5be3d1){try{if(!_[_0xc160('0x27')](channels[_0x5be3d1[_0xc160('0x8')]])){utils[_0xc160('0x1a')](util[_0xc160('0xb')](_0xc160('0x44'),_0x5be3d1['uniqueid']),_0x5be3d1);if(!_[_0xc160('0x27')](channels[_0x5be3d1['uniqueid']][_0xc160('0x45')])){channels[_0x5be3d1[_0xc160('0x8')]][_0xc160('0x46')]+=utils[_0xc160('0x32')](utils[_0xc160('0x21')](),channels[_0x5be3d1[_0xc160('0x8')]][_0xc160('0x45')]);utils[_0xc160('0xa')](util[_0xc160('0xb')](_0xc160('0x47'),_0x5be3d1[_0xc160('0x8')],channels[_0x5be3d1[_0xc160('0x8')]]['mohtime']));delete channels[_0x5be3d1[_0xc160('0x8')]][_0xc160('0x45')];}}}catch(_0x530358){utils[_0xc160('0x23')](util['format'](_0xc160('0x44'),_0x5be3d1['uniqueid']),_0x530358);}};exports['varset']=function(_0x37d6ff){try{if(!_[_0xc160('0x27')](channels[_0x37d6ff[_0xc160('0x8')]])){utils[_0xc160('0x1a')](util['format'](_0xc160('0x48'),_0x37d6ff[_0xc160('0x8')]),_0x37d6ff);if(!_['isNil'](_0x37d6ff[_0xc160('0x49')]['xmd-originatecalleridnum'])){utils['info'](util[_0xc160('0xb')](_0xc160('0x4a'),_0x37d6ff[_0xc160('0x8')],_0x37d6ff['value']));channels[_0x37d6ff[_0xc160('0x8')]][_0xc160('0x4b')]=_0x37d6ff[_0xc160('0x4c')];}if(!_[_0xc160('0x27')](_0x37d6ff['variable'][_0xc160('0x4d')])){utils['info'](util[_0xc160('0xb')](_0xc160('0x4e'),_0x37d6ff[_0xc160('0x8')],_0x37d6ff['value']));channels[_0x37d6ff[_0xc160('0x8')]][_0xc160('0x4f')]=_0x37d6ff[_0xc160('0x4c')];channels[_0x37d6ff[_0xc160('0x8')]]['callerid']='\x22'+_0x37d6ff[_0xc160('0x4c')]+_0xc160('0x50')+_0x37d6ff[_0xc160('0x4c')]+'>';}if(!_[_0xc160('0x27')](_0x37d6ff[_0xc160('0x49')][_0xc160('0x51')])||!_['isNil'](_0x37d6ff[_0xc160('0x49')]['xmd-callerid'])){utils[_0xc160('0xa')](util[_0xc160('0xb')](_0xc160('0x52'),_0x37d6ff[_0xc160('0x8')],!_[_0xc160('0x27')](_0x37d6ff[_0xc160('0x49')][_0xc160('0x51')])?'xmd-callerid-preview':_0xc160('0x53'),_0x37d6ff['value']));channels[_0x37d6ff[_0xc160('0x8')]]['callerid']=_0x37d6ff['value'];}if(!_[_0xc160('0x27')](_0x37d6ff[_0xc160('0x49')][_0xc160('0x54')])||!_['isNil'](_0x37d6ff[_0xc160('0x49')][_0xc160('0x55')])){utils[_0xc160('0xa')](util[_0xc160('0xb')](_0xc160('0x52'),_0x37d6ff[_0xc160('0x8')],!_[_0xc160('0x27')](_0x37d6ff[_0xc160('0x49')]['xmd-queue'])?_0xc160('0x54'):_0xc160('0x55'),_0x37d6ff[_0xc160('0x4c')]));channels[_0x37d6ff['uniqueid']]['lastapplication']=_0xc160('0x56');channels[_0x37d6ff[_0xc160('0x8')]][_0xc160('0x57')]=_0x37d6ff[_0xc160('0x4c')];channels[_0x37d6ff[_0xc160('0x8')]][_0xc160('0xe')]=!![];}if(!_[_0xc160('0x27')](_0x37d6ff[_0xc160('0x49')][_0xc160('0x58')])){utils['info'](util['format']('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x37d6ff[_0xc160('0x8')],_0x37d6ff[_0xc160('0x4c')]));channels[_0x37d6ff['uniqueid']][_0xc160('0x59')]=_0x37d6ff[_0xc160('0x4c')];}if(!_['isNil'](_0x37d6ff[_0xc160('0x49')]['xmd-cdrtype'])){utils['info'](util['format'](_0xc160('0x5a'),_0x37d6ff[_0xc160('0x8')],_0x37d6ff[_0xc160('0x4c')]));channels[_0x37d6ff['uniqueid']][_0xc160('0x5b')]=_0x37d6ff[_0xc160('0x4c')];}if(!_[_0xc160('0x27')](_0x37d6ff[_0xc160('0x49')][_0xc160('0x5c')])){utils[_0xc160('0xa')](util[_0xc160('0xb')](_0xc160('0x5d'),_0x37d6ff['uniqueid'],_0x37d6ff[_0xc160('0x4c')]));channels[_0x37d6ff[_0xc160('0x8')]][_0xc160('0x5e')]=_0x37d6ff['value'];}if(!_[_0xc160('0x27')](_0x37d6ff[_0xc160('0x49')][_0xc160('0x5f')])){utils[_0xc160('0xa')](util[_0xc160('0xb')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x37d6ff[_0xc160('0x8')],_0x37d6ff[_0xc160('0x4c')]));channels[_0x37d6ff[_0xc160('0x8')]][_0xc160('0x5f')]=_0x37d6ff[_0xc160('0x4c')];}}}catch(_0x494597){utils[_0xc160('0x23')](util['format'](_0xc160('0x48'),_0x37d6ff[_0xc160('0x8')]),_0x494597);}};exports[_0xc160('0x60')]=function(_0x44b858){try{if(!_[_0xc160('0x27')](channels[_0x44b858[_0xc160('0x8')]])){utils['debug'](util[_0xc160('0xb')](_0xc160('0x61'),_0x44b858[_0xc160('0x8')]),_0x44b858);utils[_0xc160('0xa')](util[_0xc160('0xb')](_0xc160('0x62'),_0x44b858[_0xc160('0x8')],_0x44b858['application'],_0x44b858[_0xc160('0x63')]));if(_0x44b858[_0xc160('0x64')]['toLowerCase']()==_0xc160('0x65')&&_[_0xc160('0x66')](_0x44b858[_0xc160('0x63')][_0xc160('0x67')](),_0xc160('0x68'))){var _0x2b03d5=_0x44b858[_0xc160('0x63')]['split']('=');var _0x2d5434=_0x2b03d5[0x0]['substring'](_0x2b03d5[0x0][_0xc160('0x69')]('(')+0x1,_0x2b03d5[0x0][_0xc160('0x69')](')'));var _0x1d0963=_0x2b03d5[0x1];channels[_0x44b858[_0xc160('0x8')]][_0x2d5434]=_0x1d0963;}if(!_[_0xc160('0x6a')]([_0xc160('0x6b'),_0xc160('0x6c'),'execif',_0xc160('0x65'),_0xc160('0x6d')],_0x44b858[_0xc160('0x64')][_0xc160('0x67')]())){channels[_0x44b858[_0xc160('0x8')]][_0xc160('0x6e')]=_0x44b858[_0xc160('0x64')];channels[_0x44b858['uniqueid']][_0xc160('0x57')]=_0x44b858[_0xc160('0x63')];}}}catch(_0x1f2c03){utils[_0xc160('0x23')](util[_0xc160('0xb')](_0xc160('0x61'),_0x44b858[_0xc160('0x8')]),_0x1f2c03);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index a2aecee..4b5259a 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 _0x5708=['error','[core]\x20error','close','managerevent','./utils','info','[core]\x20connected','shutdown','fullybooted','[core]\x20fullybooted'];(function(_0x19a11f,_0x6d8be7){var _0x51485f=function(_0x1394a1){while(--_0x1394a1){_0x19a11f['push'](_0x19a11f['shift']());}};_0x51485f(++_0x6d8be7);}(_0x5708,0x1e4));var _0x8570=function(_0x3272b2,_0x2805b8){_0x3272b2=_0x3272b2-0x0;var _0x21b73a=_0x5708[_0x3272b2];return _0x21b73a;};'use strict';var utils=require(_0x8570('0x0'));exports['connect']=function(){utils[_0x8570('0x1')](_0x8570('0x2'));};exports[_0x8570('0x3')]=function(){utils[_0x8570('0x1')]('[core]\x20shutdown');};exports[_0x8570('0x4')]=function(){utils[_0x8570('0x1')](_0x8570('0x5'));};exports[_0x8570('0x6')]=function(_0xa5c3a){utils['error'](_0x8570('0x7'),_0xa5c3a);};exports[_0x8570('0x8')]=function(){utils[_0x8570('0x1')]('[core]\x20close');};exports[_0x8570('0x9')]=function(_0x4fb099){}; \ No newline at end of file +var _0x2281=['shutdown','[core]\x20shutdown','info','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','connect'];(function(_0x331ce0,_0xe335b9){var _0x31c3c7=function(_0x2bf43c){while(--_0x2bf43c){_0x331ce0['push'](_0x331ce0['shift']());}};_0x31c3c7(++_0xe335b9);}(_0x2281,0xef));var _0x1228=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2281[_0x2dafbe];return _0x58a45a;};'use strict';var utils=require('./utils');exports[_0x1228('0x0')]=function(){utils['info']('[core]\x20connected');};exports[_0x1228('0x1')]=function(){utils['info'](_0x1228('0x2'));};exports['fullybooted']=function(){utils[_0x1228('0x3')](_0x1228('0x4'));};exports[_0x1228('0x5')]=function(_0x4b0b6a){utils[_0x1228('0x5')](_0x1228('0x6'),_0x4b0b6a);};exports[_0x1228('0x7')]=function(){utils[_0x1228('0x3')](_0x1228('0x8'));};exports[_0x1228('0x9')]=function(_0x4be546){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 9629317..342eea9 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 _0x73ba=['billableseconds','lodash','util','./utils','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','uniqueid','newexten','debug','[%s][dials][newexten]','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','split','error','varset','[%s][dials][varset]','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','isNil','[%s][dials][dialend]','ANSWER','answertime','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','calleridname','now','complete','diffTime','endtime'];(function(_0x1bd0c4,_0x2405e0){var _0x13a3af=function(_0xe18df9){while(--_0xe18df9){_0x1bd0c4['push'](_0x1bd0c4['shift']());}};_0x13a3af(++_0x2405e0);}(_0x73ba,0x1b9));var _0xa73b=function(_0xfd0ce9,_0x33256e){_0xfd0ce9=_0xfd0ce9-0x0;var _0xd94586=_0x73ba[_0xfd0ce9];return _0xd94586;};'use strict';var _=require(_0xa73b('0x0'));var util=require(_0xa73b('0x1'));var utils=require(_0xa73b('0x2'));var dials={};function writeDB(_0x41bbaa){utils['info'](util[_0xa73b('0x3')](_0xa73b('0x4'),_0x41bbaa['uniqueid'],_0x41bbaa[_0xa73b('0x5')],_0x41bbaa[_0xa73b('0x6')],_0x41bbaa[_0xa73b('0x7')],_0x41bbaa[_0xa73b('0x8')],_0x41bbaa[_0xa73b('0x9')]));utils[_0xa73b('0xa')](_0xa73b('0xb'),_0x41bbaa);delete dials[_0x41bbaa[_0xa73b('0xc')]];}exports[_0xa73b('0xd')]=function(_0x16c9da){try{utils[_0xa73b('0xe')](util[_0xa73b('0x3')](_0xa73b('0xf'),_0x16c9da[_0xa73b('0xc')]),_0x16c9da);utils[_0xa73b('0x10')](util[_0xa73b('0x3')](_0xa73b('0x11'),_0x16c9da[_0xa73b('0xc')],_0x16c9da[_0xa73b('0x12')],_0x16c9da[_0xa73b('0x13')]));if(_0x16c9da['application'][_0xa73b('0x14')]()==_0xa73b('0x15')&&_[_0xa73b('0x16')](_0x16c9da[_0xa73b('0x13')][_0xa73b('0x14')](),_0xa73b('0x17'))){var _0x620031=_0x16c9da[_0xa73b('0x13')][_0xa73b('0x18')]('=');dials[_0x16c9da[_0xa73b('0xc')]]={'routeId':_0x620031[0x1]};}}catch(_0x44c61e){utils[_0xa73b('0x19')](util['format'](_0xa73b('0xf'),_0x16c9da[_0xa73b('0xc')]),_0x44c61e);}};exports[_0xa73b('0x1a')]=function(_0x87c51){try{utils[_0xa73b('0xe')](util['format'](_0xa73b('0x1b'),_0x87c51[_0xa73b('0xc')]),_0x87c51);if(!_['isNil'](_0x87c51[_0xa73b('0x1c')][_0xa73b('0x1d')])){utils[_0xa73b('0x10')](util[_0xa73b('0x3')](_0xa73b('0x1e'),_0x87c51[_0xa73b('0xc')],_0x87c51[_0xa73b('0x1f')]));dials[_0x87c51[_0xa73b('0xc')]]={'routeId':_0x87c51[_0xa73b('0x1f')]};}}catch(_0x30a3ec){utils[_0xa73b('0x19')](util['format'](_0xa73b('0x1b'),_0x87c51['uniqueid']),_0x30a3ec);}};exports[_0xa73b('0x20')]=function(_0x363883){try{if(!_['isNil'](dials[_0x363883[_0xa73b('0xc')]])){utils[_0xa73b('0xe')](util['format'](_0xa73b('0x21'),_0x363883[_0xa73b('0xc')]),_0x363883);dials[_0x363883[_0xa73b('0xc')]]=_[_0xa73b('0x22')](dials[_0x363883[_0xa73b('0xc')]],_0x363883);dials[_0x363883[_0xa73b('0xc')]][_0xa73b('0x23')]=utils['now']();dials[_0x363883[_0xa73b('0xc')]]['lastevent']=_0xa73b('0x24');utils[_0xa73b('0x10')](util[_0xa73b('0x3')](_0xa73b('0x25'),_0x363883[_0xa73b('0xc')],dials[_0x363883[_0xa73b('0xc')]][_0xa73b('0x23')]));}}catch(_0x19e3db){utils['error'](util[_0xa73b('0x3')]('[%s][dials][dialbegin]',_0x363883[_0xa73b('0xc')]),_0x19e3db);}};exports[_0xa73b('0x26')]=function(_0x4aeb78){try{if(!_[_0xa73b('0x27')](dials[_0x4aeb78['uniqueid']])){utils[_0xa73b('0xe')](util[_0xa73b('0x3')](_0xa73b('0x28'),_0x4aeb78['uniqueid']),_0x4aeb78);dials[_0x4aeb78[_0xa73b('0xc')]][_0xa73b('0x9')]=_0x4aeb78[_0xa73b('0x9')];if(_0x4aeb78[_0xa73b('0x9')]==_0xa73b('0x29')){dials[_0x4aeb78[_0xa73b('0xc')]]=_['assign'](dials[_0x4aeb78[_0xa73b('0xc')]],_0x4aeb78);dials[_0x4aeb78[_0xa73b('0xc')]][_0xa73b('0x2a')]=utils['now']();dials[_0x4aeb78[_0xa73b('0xc')]][_0xa73b('0x2b')]=_0xa73b('0x2c');utils['info'](util[_0xa73b('0x3')](_0xa73b('0x2d'),_0x4aeb78['uniqueid'],_0x4aeb78['dialstatus'],dials[_0x4aeb78[_0xa73b('0xc')]]['answertime']));}else{utils['info'](util[_0xa73b('0x3')](_0xa73b('0x2e'),_0x4aeb78[_0xa73b('0xc')],_0x4aeb78[_0xa73b('0x9')]));}}}catch(_0x4b03bb){utils['error'](util[_0xa73b('0x3')](_0xa73b('0x28'),_0x4aeb78[_0xa73b('0xc')]),_0x4b03bb);}};exports[_0xa73b('0x2f')]=function(_0x1b7096){try{if(!_['isNil'](dials[_0x1b7096['uniqueid']])){utils[_0xa73b('0xe')](util[_0xa73b('0x3')](_0xa73b('0x30'),_0x1b7096[_0xa73b('0xc')]),_0x1b7096);utils[_0xa73b('0x10')](util[_0xa73b('0x3')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x1b7096[_0xa73b('0xc')],_0x1b7096[_0xa73b('0x7')],_0x1b7096[_0xa73b('0x31')],_0x1b7096['cause-txt']));dials[_0x1b7096[_0xa73b('0xc')]]=_[_0xa73b('0x22')](dials[_0x1b7096[_0xa73b('0xc')]],{'endtime':utils[_0xa73b('0x32')](),'lastevent':_0xa73b('0x33')});dials[_0x1b7096[_0xa73b('0xc')]]['duration']=utils[_0xa73b('0x34')](dials[_0x1b7096[_0xa73b('0xc')]][_0xa73b('0x35')],dials[_0x1b7096['uniqueid']][_0xa73b('0x23')]);dials[_0x1b7096[_0xa73b('0xc')]]['holdtime']=utils[_0xa73b('0x34')](dials[_0x1b7096['uniqueid']][_0xa73b('0x2a')]||dials[_0x1b7096[_0xa73b('0xc')]][_0xa73b('0x35')],dials[_0x1b7096['uniqueid']][_0xa73b('0x23')]);dials[_0x1b7096['uniqueid']][_0xa73b('0x36')]=dials[_0x1b7096['uniqueid']]['answertime']?utils[_0xa73b('0x34')](dials[_0x1b7096[_0xa73b('0xc')]]['endtime'],dials[_0x1b7096[_0xa73b('0xc')]][_0xa73b('0x2a')]):0x0;writeDB(dials[_0x1b7096[_0xa73b('0xc')]]);}}catch(_0x423c36){utils[_0xa73b('0x19')](util[_0xa73b('0x3')](_0xa73b('0x30'),_0x1b7096[_0xa73b('0xc')]),_0x423c36);}}; \ No newline at end of file +var _0xcdbf=['endtime','[%s][dials][hangup]','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','dialstatus','request','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','toLowerCase','set','appdata','cdr(routeid)','error','[%s][dials][varset]','outboundrouteid','value','dialbegin','isNil','[%s][dials][dialbegin]','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]\x20dialstatus:%s','[%s][dials][dialend]','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','holdtime','billableseconds'];(function(_0x12d013,_0x286e4c){var _0x54220c=function(_0x31d518){while(--_0x31d518){_0x12d013['push'](_0x12d013['shift']());}};_0x54220c(++_0x286e4c);}(_0xcdbf,0xf2));var _0xfcdb=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xcdbf[_0x1d1779];return _0x2377e9;};'use strict';var _=require('lodash');var util=require(_0xfcdb('0x0'));var utils=require(_0xfcdb('0x1'));var dials={};function writeDB(_0x31125d){utils[_0xfcdb('0x2')](util[_0xfcdb('0x3')](_0xfcdb('0x4'),_0x31125d[_0xfcdb('0x5')],_0x31125d[_0xfcdb('0x6')],_0x31125d[_0xfcdb('0x7')],_0x31125d['calleridnum'],_0x31125d['connectedlinenum'],_0x31125d[_0xfcdb('0x8')]));utils[_0xfcdb('0x9')]('CreateVoiceDialReport',_0x31125d);delete dials[_0x31125d[_0xfcdb('0x5')]];}exports['newexten']=function(_0x105182){try{utils[_0xfcdb('0xa')](util[_0xfcdb('0x3')](_0xfcdb('0xb'),_0x105182[_0xfcdb('0x5')]),_0x105182);utils[_0xfcdb('0x2')](util['format'](_0xfcdb('0xc'),_0x105182['uniqueid'],_0x105182['application'],_0x105182['appdata']));if(_0x105182['application'][_0xfcdb('0xd')]()==_0xfcdb('0xe')&&_['startsWith'](_0x105182[_0xfcdb('0xf')][_0xfcdb('0xd')](),_0xfcdb('0x10'))){var _0x254b63=_0x105182[_0xfcdb('0xf')]['split']('=');dials[_0x105182[_0xfcdb('0x5')]]={'routeId':_0x254b63[0x1]};}}catch(_0x391da3){utils[_0xfcdb('0x11')](util[_0xfcdb('0x3')](_0xfcdb('0xb'),_0x105182['uniqueid']),_0x391da3);}};exports['varset']=function(_0x583d24){try{utils[_0xfcdb('0xa')](util[_0xfcdb('0x3')](_0xfcdb('0x12'),_0x583d24['uniqueid']),_0x583d24);if(!_['isNil'](_0x583d24['variable'][_0xfcdb('0x13')])){utils[_0xfcdb('0x2')](util['format']('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x583d24[_0xfcdb('0x5')],_0x583d24['value']));dials[_0x583d24[_0xfcdb('0x5')]]={'routeId':_0x583d24[_0xfcdb('0x14')]};}}catch(_0x30f393){utils[_0xfcdb('0x11')](util[_0xfcdb('0x3')]('[%s][dials][varset]',_0x583d24[_0xfcdb('0x5')]),_0x30f393);}};exports[_0xfcdb('0x15')]=function(_0x2e1c3a){try{if(!_[_0xfcdb('0x16')](dials[_0x2e1c3a['uniqueid']])){utils[_0xfcdb('0xa')](util[_0xfcdb('0x3')](_0xfcdb('0x17'),_0x2e1c3a[_0xfcdb('0x5')]),_0x2e1c3a);dials[_0x2e1c3a['uniqueid']]=_[_0xfcdb('0x18')](dials[_0x2e1c3a[_0xfcdb('0x5')]],_0x2e1c3a);dials[_0x2e1c3a['uniqueid']][_0xfcdb('0x19')]=utils['now']();dials[_0x2e1c3a[_0xfcdb('0x5')]][_0xfcdb('0x1a')]=_0xfcdb('0x1b');utils[_0xfcdb('0x2')](util[_0xfcdb('0x3')](_0xfcdb('0x1c'),_0x2e1c3a['uniqueid'],dials[_0x2e1c3a['uniqueid']][_0xfcdb('0x19')]));}}catch(_0x46588c){utils['error'](util[_0xfcdb('0x3')](_0xfcdb('0x17'),_0x2e1c3a['uniqueid']),_0x46588c);}};exports[_0xfcdb('0x1d')]=function(_0x45ae4a){try{if(!_[_0xfcdb('0x16')](dials[_0x45ae4a[_0xfcdb('0x5')]])){utils[_0xfcdb('0xa')](util['format']('[%s][dials][dialend]',_0x45ae4a[_0xfcdb('0x5')]),_0x45ae4a);dials[_0x45ae4a[_0xfcdb('0x5')]][_0xfcdb('0x8')]=_0x45ae4a[_0xfcdb('0x8')];if(_0x45ae4a[_0xfcdb('0x8')]==_0xfcdb('0x1e')){dials[_0x45ae4a['uniqueid']]=_[_0xfcdb('0x18')](dials[_0x45ae4a[_0xfcdb('0x5')]],_0x45ae4a);dials[_0x45ae4a[_0xfcdb('0x5')]][_0xfcdb('0x1f')]=utils[_0xfcdb('0x20')]();dials[_0x45ae4a['uniqueid']][_0xfcdb('0x1a')]=_0xfcdb('0x21');utils[_0xfcdb('0x2')](util['format'](_0xfcdb('0x22'),_0x45ae4a[_0xfcdb('0x5')],_0x45ae4a[_0xfcdb('0x8')],dials[_0x45ae4a[_0xfcdb('0x5')]][_0xfcdb('0x1f')]));}else{utils[_0xfcdb('0x2')](util[_0xfcdb('0x3')](_0xfcdb('0x23'),_0x45ae4a[_0xfcdb('0x5')],_0x45ae4a[_0xfcdb('0x8')]));}}}catch(_0x13fe1d){utils[_0xfcdb('0x11')](util[_0xfcdb('0x3')](_0xfcdb('0x24'),_0x45ae4a[_0xfcdb('0x5')]),_0x13fe1d);}};exports[_0xfcdb('0x25')]=function(_0x576211){try{if(!_[_0xfcdb('0x16')](dials[_0x576211[_0xfcdb('0x5')]])){utils['debug'](util['format']('[%s][dials][hangup]',_0x576211[_0xfcdb('0x5')]),_0x576211);utils[_0xfcdb('0x2')](util['format'](_0xfcdb('0x26'),_0x576211[_0xfcdb('0x5')],_0x576211['calleridnum'],_0x576211[_0xfcdb('0x27')],_0x576211[_0xfcdb('0x28')]));dials[_0x576211['uniqueid']]=_[_0xfcdb('0x18')](dials[_0x576211[_0xfcdb('0x5')]],{'endtime':utils[_0xfcdb('0x20')](),'lastevent':_0xfcdb('0x29')});dials[_0x576211[_0xfcdb('0x5')]][_0xfcdb('0x2a')]=utils[_0xfcdb('0x2b')](dials[_0x576211[_0xfcdb('0x5')]]['endtime'],dials[_0x576211[_0xfcdb('0x5')]][_0xfcdb('0x19')]);dials[_0x576211[_0xfcdb('0x5')]][_0xfcdb('0x2c')]=utils[_0xfcdb('0x2b')](dials[_0x576211['uniqueid']][_0xfcdb('0x1f')]||dials[_0x576211[_0xfcdb('0x5')]]['endtime'],dials[_0x576211[_0xfcdb('0x5')]][_0xfcdb('0x19')]);dials[_0x576211[_0xfcdb('0x5')]][_0xfcdb('0x2d')]=dials[_0x576211['uniqueid']]['answertime']?utils[_0xfcdb('0x2b')](dials[_0x576211['uniqueid']][_0xfcdb('0x2e')],dials[_0x576211['uniqueid']][_0xfcdb('0x1f')]):0x0;writeDB(dials[_0x576211[_0xfcdb('0x5')]]);}}catch(_0x12c40c){utils[_0xfcdb('0x11')](util[_0xfcdb('0x3')](_0xfcdb('0x2f'),_0x576211[_0xfcdb('0x5')]),_0x12c40c);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index d91927e..dedb23d 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 _0xa7c4=['[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','local','asterisk','port','keepConnected','XDR\x20DISABLED','info','./agents.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','[%s][index][agentcalled]','uniqueid','agentcalled','agentringnoanswer','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa7c4,0x1e3));var _0x4a7c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa7c4[_0x3dd15e];return _0x231fd0;};var AsteriskManager=require(_0x4a7c('0x0'));var config=require(_0x4a7c('0x1'));var utils=require(_0x4a7c('0x2'));var util=require(_0x4a7c('0x3'));var isXDREnabled=config['xdr']&&config[_0x4a7c('0x4')][_0x4a7c('0x5')]?!config['xdr'][_0x4a7c('0x5')]:!![];var isProduction=config[_0x4a7c('0x6')]==='production'||![];var isLocalAsterisk=config[_0x4a7c('0x4')]&&config[_0x4a7c('0x4')][_0x4a7c('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x4a7c('0x8')][_0x4a7c('0x9')],config[_0x4a7c('0x8')]['ip'],config[_0x4a7c('0x8')]['username'],config[_0x4a7c('0x8')]['password'],!![]);ami[_0x4a7c('0xa')]();if(!isXDREnabled){utils['info'](_0x4a7c('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x4a7c('0xc')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0x4a7c('0xd'));var calls=require('./calls.controller');var queues=require('./queues.controller');var recordings=require(_0x4a7c('0xe'));var members=require(_0x4a7c('0xf'));var dials=require(_0x4a7c('0x10'));var transfers=require(_0x4a7c('0x11'));var core=require(_0x4a7c('0x12'));ami['on'](_0x4a7c('0x13'),core[_0x4a7c('0x13')]);ami['on']('shutdown',core['shutdown']);ami['on'](_0x4a7c('0x14'),core['fullybooted']);ami['on']('error',core[_0x4a7c('0x15')]);ami['on'](_0x4a7c('0x16'),core['close']);ami['on'](_0x4a7c('0x17'),core[_0x4a7c('0x17')]);ami['on'](_0x4a7c('0x18'),function(_0x29f9a0){try{utils[_0x4a7c('0x19')](util[_0x4a7c('0x1a')]('[%s][index][devicestatechange]',_0x29f9a0['device']),_0x29f9a0);members['devicestatechange'](_0x29f9a0);}catch(_0x5ed593){utils[_0x4a7c('0x15')](util[_0x4a7c('0x1a')](_0x4a7c('0x1b'),_0x29f9a0[_0x4a7c('0x1c')]),_0x5ed593);}});ami['on']('agentcalled',function(_0x392c65){try{utils[_0x4a7c('0x19')](util[_0x4a7c('0x1a')](_0x4a7c('0x1d'),_0x392c65[_0x4a7c('0x1e')]),_0x392c65);agents[_0x4a7c('0x1f')](_0x392c65);}catch(_0x40d592){utils['error'](util[_0x4a7c('0x1a')](_0x4a7c('0x1d'),_0x392c65[_0x4a7c('0x1e')]),_0x40d592);}});ami['on'](_0x4a7c('0x20'),function(_0x3bd284){try{utils[_0x4a7c('0x19')](util[_0x4a7c('0x1a')]('[%s][index][agentringnoanswer]',_0x3bd284[_0x4a7c('0x1e')]),_0x3bd284);agents[_0x4a7c('0x20')](_0x3bd284);}catch(_0x139e31){utils[_0x4a7c('0x15')](util['format']('[%s][index][agentringnoanswer]',_0x3bd284[_0x4a7c('0x1e')]),_0x139e31);}});ami['on'](_0x4a7c('0x21'),function(_0x5a4a46){try{utils[_0x4a7c('0x19')](util[_0x4a7c('0x1a')](_0x4a7c('0x22'),_0x5a4a46[_0x4a7c('0x1e')]),_0x5a4a46);agents['agentconnect'](_0x5a4a46);queues[_0x4a7c('0x21')](_0x5a4a46);}catch(_0xbc2f0b){utils[_0x4a7c('0x15')](util[_0x4a7c('0x1a')](_0x4a7c('0x22'),_0x5a4a46['uniqueid']),_0xbc2f0b);}});ami['on'](_0x4a7c('0x23'),function(_0x33a006){try{utils['debug'](util[_0x4a7c('0x1a')](_0x4a7c('0x24'),_0x33a006[_0x4a7c('0x1e')]),_0x33a006);agents['agentcomplete'](_0x33a006);queues['agentcomplete'](_0x33a006);members['agentcomplete'](_0x33a006);}catch(_0x32046c){utils['error'](util[_0x4a7c('0x1a')](_0x4a7c('0x24'),_0x33a006[_0x4a7c('0x1e')]),_0x32046c);}});ami['on']('queuecallerabandon',function(_0x5a9e46){try{utils[_0x4a7c('0x19')](util[_0x4a7c('0x1a')](_0x4a7c('0x25'),_0x5a9e46[_0x4a7c('0x1e')]),_0x5a9e46);agents[_0x4a7c('0x26')](_0x5a9e46);queues[_0x4a7c('0x26')](_0x5a9e46);}catch(_0x1b201d){utils[_0x4a7c('0x15')](util[_0x4a7c('0x1a')](_0x4a7c('0x25'),_0x5a9e46[_0x4a7c('0x1e')]),_0x1b201d);}});ami['on'](_0x4a7c('0x27'),function(_0x2cea18){try{utils[_0x4a7c('0x19')](util[_0x4a7c('0x1a')](_0x4a7c('0x28'),_0x2cea18[_0x4a7c('0x1e')]),_0x2cea18);queues['queuecallerjoin'](_0x2cea18);recordings[_0x4a7c('0x27')](_0x2cea18);}catch(_0x98f7c0){utils[_0x4a7c('0x15')](util[_0x4a7c('0x1a')]('[%s][index][queuecallerjoin]',_0x2cea18[_0x4a7c('0x1e')]),_0x98f7c0);}});ami['on']('queuecallerleave',function(_0x145ec5){try{utils['debug'](util[_0x4a7c('0x1a')](_0x4a7c('0x29'),_0x145ec5['uniqueid']),_0x145ec5);queues['queuecallerleave'](_0x145ec5);}catch(_0x313a00){utils[_0x4a7c('0x15')](util['format'](_0x4a7c('0x29'),_0x145ec5[_0x4a7c('0x1e')]),_0x313a00);}});ami['on'](_0x4a7c('0x2a'),function(_0x47754a){try{utils['debug'](util[_0x4a7c('0x1a')](_0x4a7c('0x2b'),_0x47754a['uniqueid']),_0x47754a);queues['musiconholdstart'](_0x47754a);calls[_0x4a7c('0x2a')](_0x47754a);}catch(_0x511da8){utils[_0x4a7c('0x15')](util[_0x4a7c('0x1a')](_0x4a7c('0x2b'),_0x47754a[_0x4a7c('0x1e')]),_0x511da8);}});ami['on'](_0x4a7c('0x2c'),function(_0x656fb4){try{utils['debug'](util[_0x4a7c('0x1a')](_0x4a7c('0x2d'),_0x656fb4['uniqueid']),_0x656fb4);queues[_0x4a7c('0x2c')](_0x656fb4);calls[_0x4a7c('0x2c')](_0x656fb4);}catch(_0x4c31af){utils[_0x4a7c('0x15')](util['format'](_0x4a7c('0x2d'),_0x656fb4[_0x4a7c('0x1e')]),_0x4c31af);}});ami['on'](_0x4a7c('0x2e'),function(_0x143904){try{utils[_0x4a7c('0x19')](util[_0x4a7c('0x1a')](_0x4a7c('0x2f'),_0x143904[_0x4a7c('0x1e')]),_0x143904);calls[_0x4a7c('0x2e')](_0x143904);recordings[_0x4a7c('0x2e')](_0x143904);}catch(_0x4a3eb7){utils['error'](util[_0x4a7c('0x1a')]('[%s][index][newstate]',_0x143904[_0x4a7c('0x1e')]),_0x4a3eb7);}});ami['on'](_0x4a7c('0x30'),function(_0x5cc1be){try{utils[_0x4a7c('0x19')](util['format']('[%s][index][hangup]',_0x5cc1be[_0x4a7c('0x1e')]),_0x5cc1be);calls[_0x4a7c('0x30')](_0x5cc1be);recordings[_0x4a7c('0x30')](_0x5cc1be);dials['hangup'](_0x5cc1be);agents[_0x4a7c('0x30')](_0x5cc1be);queues[_0x4a7c('0x30')](_0x5cc1be);}catch(_0x55a361){utils[_0x4a7c('0x15')](util[_0x4a7c('0x1a')](_0x4a7c('0x31'),_0x5cc1be[_0x4a7c('0x1e')]),_0x55a361);}});ami['on'](_0x4a7c('0x32'),function(_0x100804){try{utils['debug'](util[_0x4a7c('0x1a')](_0x4a7c('0x33'),_0x100804['uniqueid']),_0x100804);members[_0x4a7c('0x32')](_0x100804);}catch(_0x3d63a2){utils['error'](util[_0x4a7c('0x1a')](_0x4a7c('0x33'),_0x100804['uniqueid']),_0x3d63a2);}});ami['on'](_0x4a7c('0x34'),function(_0x228c08){try{utils['debug'](util['format']('[%s][index][blindtransfer]',_0x228c08[_0x4a7c('0x1e')]),_0x228c08);queues[_0x4a7c('0x34')](_0x228c08);agents[_0x4a7c('0x34')](_0x228c08);transfers[_0x4a7c('0x34')](_0x228c08);recordings[_0x4a7c('0x34')](_0x228c08);}catch(_0x9b7b3b){utils[_0x4a7c('0x15')](util[_0x4a7c('0x1a')](_0x4a7c('0x35'),_0x228c08['uniqueid']),_0x9b7b3b);}});ami['on'](_0x4a7c('0x36'),function(_0x6dbc68){try{utils[_0x4a7c('0x19')](util[_0x4a7c('0x1a')]('[%s][index][attendedtransfer]',_0x6dbc68[_0x4a7c('0x37')]),_0x6dbc68);queues[_0x4a7c('0x36')](_0x6dbc68);transfers[_0x4a7c('0x36')](_0x6dbc68);agents[_0x4a7c('0x36')](_0x6dbc68);calls['attendedtransfer'](_0x6dbc68);}catch(_0x38281d){utils['error'](util[_0x4a7c('0x1a')](_0x4a7c('0x38'),_0x6dbc68[_0x4a7c('0x37')]),_0x38281d);}});ami['on'](_0x4a7c('0x39'),function(_0x3d48da){try{utils[_0x4a7c('0x19')](util[_0x4a7c('0x1a')]('[%s][index][varset]',_0x3d48da[_0x4a7c('0x1e')]),_0x3d48da);queues[_0x4a7c('0x39')](_0x3d48da);recordings['varset'](_0x3d48da);calls['varset'](_0x3d48da);dials[_0x4a7c('0x39')](_0x3d48da);}catch(_0xb21836){utils['error'](util[_0x4a7c('0x1a')](_0x4a7c('0x3a'),_0x3d48da[_0x4a7c('0x1e')]),_0xb21836);}});ami['on'](_0x4a7c('0x3b'),function(_0x3eb1df){try{utils[_0x4a7c('0x19')](util['format'](_0x4a7c('0x3c'),_0x3eb1df[_0x4a7c('0x1e')]),_0x3eb1df);calls[_0x4a7c('0x3b')](_0x3eb1df);recordings['newexten'](_0x3eb1df);dials[_0x4a7c('0x3b')](_0x3eb1df);}catch(_0x29ebd5){utils[_0x4a7c('0x15')](util[_0x4a7c('0x1a')](_0x4a7c('0x3c'),_0x3eb1df[_0x4a7c('0x1e')]),_0x29ebd5);}});ami['on'](_0x4a7c('0x3d'),function(_0x52ced4){try{utils['debug'](util['format'](_0x4a7c('0x3e'),_0x52ced4[_0x4a7c('0x1e')]),_0x52ced4);calls['newchannel'](_0x52ced4);recordings['newchannel'](_0x52ced4);}catch(_0x4bc185){utils[_0x4a7c('0x15')](util[_0x4a7c('0x1a')](_0x4a7c('0x3e'),_0x52ced4[_0x4a7c('0x1e')]),_0x4bc185);}});ami['on'](_0x4a7c('0x3f'),function(_0xc8c6a7){try{utils['debug'](util[_0x4a7c('0x1a')](_0x4a7c('0x40'),_0xc8c6a7[_0x4a7c('0x1e')]),_0xc8c6a7);dials[_0x4a7c('0x3f')](_0xc8c6a7);}catch(_0x16e9d3){utils[_0x4a7c('0x15')](util[_0x4a7c('0x1a')]('[%s]dialbegin',_0xc8c6a7[_0x4a7c('0x1e')]),_0x16e9d3);}});ami['on'](_0x4a7c('0x41'),function(_0x1fccc1){try{utils[_0x4a7c('0x19')](util[_0x4a7c('0x1a')]('[%s][index][dialend]',_0x1fccc1[_0x4a7c('0x1e')]),_0x1fccc1);dials['dialend'](_0x1fccc1);}catch(_0x3cb937){utils['error'](util[_0x4a7c('0x1a')](_0x4a7c('0x42'),_0x1fccc1[_0x4a7c('0x1e')]),_0x3cb937);}});} \ No newline at end of file +var _0xb7d8=['[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','asterisk','port','username','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./members.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','debug','[%s][index][devicestatechange]','device','format','agentcalled','[%s][index][agentcalled]','uniqueid','[%s][index][agentringnoanswer]','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]','musiconholdstop','[%s][index][newstate]','newstate','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]'];(function(_0x2527de,_0x458a1e){var _0x5ea129=function(_0x64e9a6){while(--_0x64e9a6){_0x2527de['push'](_0x2527de['shift']());}};_0x5ea129(++_0x458a1e);}(_0xb7d8,0xe6));var _0x8b7d=function(_0x554d1d,_0x72d6a){_0x554d1d=_0x554d1d-0x0;var _0x3b0dbf=_0xb7d8[_0x554d1d];return _0x3b0dbf;};var AsteriskManager=require(_0x8b7d('0x0'));var config=require(_0x8b7d('0x1'));var utils=require(_0x8b7d('0x2'));var util=require(_0x8b7d('0x3'));var isXDREnabled=config[_0x8b7d('0x4')]&&config[_0x8b7d('0x4')][_0x8b7d('0x5')]?!config[_0x8b7d('0x4')]['disabled']:!![];var isProduction=config[_0x8b7d('0x6')]===_0x8b7d('0x7')||![];var isLocalAsterisk=config[_0x8b7d('0x4')]&&config[_0x8b7d('0x4')]['local']===!![]||![];var ami=new AsteriskManager(config[_0x8b7d('0x8')][_0x8b7d('0x9')],config[_0x8b7d('0x8')]['ip'],config[_0x8b7d('0x8')][_0x8b7d('0xa')],config['asterisk'][_0x8b7d('0xb')],!![]);ami[_0x8b7d('0xc')]();if(!isXDREnabled){utils[_0x8b7d('0xd')](_0x8b7d('0xe'));}else if(!isProduction&&!isLocalAsterisk){utils['info'](_0x8b7d('0xf'));}else{var agents=require(_0x8b7d('0x10'));var calls=require(_0x8b7d('0x11'));var queues=require(_0x8b7d('0x12'));var recordings=require('./recordings.controller');var members=require(_0x8b7d('0x13'));var dials=require(_0x8b7d('0x14'));var transfers=require('./transfers.controller');var core=require(_0x8b7d('0x15'));ami['on'](_0x8b7d('0x16'),core[_0x8b7d('0x16')]);ami['on'](_0x8b7d('0x17'),core[_0x8b7d('0x17')]);ami['on'](_0x8b7d('0x18'),core[_0x8b7d('0x18')]);ami['on'](_0x8b7d('0x19'),core[_0x8b7d('0x19')]);ami['on']('close',core[_0x8b7d('0x1a')]);ami['on']('managerevent',core[_0x8b7d('0x1b')]);ami['on']('devicestatechange',function(_0x521ea3){try{utils[_0x8b7d('0x1c')](util['format'](_0x8b7d('0x1d'),_0x521ea3[_0x8b7d('0x1e')]),_0x521ea3);members['devicestatechange'](_0x521ea3);}catch(_0x49b1e9){utils[_0x8b7d('0x19')](util[_0x8b7d('0x1f')](_0x8b7d('0x1d'),_0x521ea3[_0x8b7d('0x1e')]),_0x49b1e9);}});ami['on'](_0x8b7d('0x20'),function(_0x267d11){try{utils[_0x8b7d('0x1c')](util[_0x8b7d('0x1f')](_0x8b7d('0x21'),_0x267d11[_0x8b7d('0x22')]),_0x267d11);agents[_0x8b7d('0x20')](_0x267d11);}catch(_0x4f5ab4){utils[_0x8b7d('0x19')](util['format'](_0x8b7d('0x21'),_0x267d11[_0x8b7d('0x22')]),_0x4f5ab4);}});ami['on']('agentringnoanswer',function(_0x5ab9cc){try{utils[_0x8b7d('0x1c')](util[_0x8b7d('0x1f')](_0x8b7d('0x23'),_0x5ab9cc[_0x8b7d('0x22')]),_0x5ab9cc);agents[_0x8b7d('0x24')](_0x5ab9cc);}catch(_0x55bfa7){utils['error'](util['format'](_0x8b7d('0x23'),_0x5ab9cc['uniqueid']),_0x55bfa7);}});ami['on'](_0x8b7d('0x25'),function(_0x2a5b91){try{utils[_0x8b7d('0x1c')](util[_0x8b7d('0x1f')](_0x8b7d('0x26'),_0x2a5b91[_0x8b7d('0x22')]),_0x2a5b91);agents['agentconnect'](_0x2a5b91);queues[_0x8b7d('0x25')](_0x2a5b91);}catch(_0x2cda8d){utils[_0x8b7d('0x19')](util[_0x8b7d('0x1f')](_0x8b7d('0x26'),_0x2a5b91[_0x8b7d('0x22')]),_0x2cda8d);}});ami['on'](_0x8b7d('0x27'),function(_0x14c8de){try{utils[_0x8b7d('0x1c')](util['format'](_0x8b7d('0x28'),_0x14c8de[_0x8b7d('0x22')]),_0x14c8de);agents[_0x8b7d('0x27')](_0x14c8de);queues[_0x8b7d('0x27')](_0x14c8de);members[_0x8b7d('0x27')](_0x14c8de);}catch(_0x340f0d){utils[_0x8b7d('0x19')](util['format'](_0x8b7d('0x28'),_0x14c8de[_0x8b7d('0x22')]),_0x340f0d);}});ami['on'](_0x8b7d('0x29'),function(_0x257004){try{utils[_0x8b7d('0x1c')](util[_0x8b7d('0x1f')](_0x8b7d('0x2a'),_0x257004[_0x8b7d('0x22')]),_0x257004);agents[_0x8b7d('0x29')](_0x257004);queues[_0x8b7d('0x29')](_0x257004);}catch(_0x2d1df5){utils[_0x8b7d('0x19')](util['format'](_0x8b7d('0x2a'),_0x257004['uniqueid']),_0x2d1df5);}});ami['on'](_0x8b7d('0x2b'),function(_0x52e1a0){try{utils[_0x8b7d('0x1c')](util[_0x8b7d('0x1f')](_0x8b7d('0x2c'),_0x52e1a0[_0x8b7d('0x22')]),_0x52e1a0);queues[_0x8b7d('0x2b')](_0x52e1a0);recordings[_0x8b7d('0x2b')](_0x52e1a0);}catch(_0x41b9d3){utils[_0x8b7d('0x19')](util['format']('[%s][index][queuecallerjoin]',_0x52e1a0[_0x8b7d('0x22')]),_0x41b9d3);}});ami['on'](_0x8b7d('0x2d'),function(_0x2f8064){try{utils[_0x8b7d('0x1c')](util[_0x8b7d('0x1f')](_0x8b7d('0x2e'),_0x2f8064[_0x8b7d('0x22')]),_0x2f8064);queues[_0x8b7d('0x2d')](_0x2f8064);}catch(_0x28822f){utils[_0x8b7d('0x19')](util[_0x8b7d('0x1f')](_0x8b7d('0x2e'),_0x2f8064[_0x8b7d('0x22')]),_0x28822f);}});ami['on'](_0x8b7d('0x2f'),function(_0x59c9c4){try{utils[_0x8b7d('0x1c')](util[_0x8b7d('0x1f')](_0x8b7d('0x30'),_0x59c9c4[_0x8b7d('0x22')]),_0x59c9c4);queues['musiconholdstart'](_0x59c9c4);calls[_0x8b7d('0x2f')](_0x59c9c4);}catch(_0x47bcd3){utils[_0x8b7d('0x19')](util[_0x8b7d('0x1f')](_0x8b7d('0x30'),_0x59c9c4[_0x8b7d('0x22')]),_0x47bcd3);}});ami['on'](_0x8b7d('0x31'),function(_0x41f98f){try{utils[_0x8b7d('0x1c')](util[_0x8b7d('0x1f')]('[%s][index][musiconholdstop]',_0x41f98f[_0x8b7d('0x22')]),_0x41f98f);queues[_0x8b7d('0x31')](_0x41f98f);calls[_0x8b7d('0x31')](_0x41f98f);}catch(_0x1dad0c){utils[_0x8b7d('0x19')](util[_0x8b7d('0x1f')]('[%s][index][musiconholdstop]',_0x41f98f['uniqueid']),_0x1dad0c);}});ami['on']('newstate',function(_0x3e4ece){try{utils['debug'](util['format'](_0x8b7d('0x32'),_0x3e4ece[_0x8b7d('0x22')]),_0x3e4ece);calls['newstate'](_0x3e4ece);recordings[_0x8b7d('0x33')](_0x3e4ece);}catch(_0x5783af){utils[_0x8b7d('0x19')](util[_0x8b7d('0x1f')](_0x8b7d('0x32'),_0x3e4ece['uniqueid']),_0x5783af);}});ami['on'](_0x8b7d('0x34'),function(_0x25e65e){try{utils[_0x8b7d('0x1c')](util['format'](_0x8b7d('0x35'),_0x25e65e[_0x8b7d('0x22')]),_0x25e65e);calls[_0x8b7d('0x34')](_0x25e65e);recordings['hangup'](_0x25e65e);dials['hangup'](_0x25e65e);agents[_0x8b7d('0x34')](_0x25e65e);queues[_0x8b7d('0x34')](_0x25e65e);}catch(_0x11eb1d){utils[_0x8b7d('0x19')](util[_0x8b7d('0x1f')](_0x8b7d('0x35'),_0x25e65e[_0x8b7d('0x22')]),_0x11eb1d);}});ami['on'](_0x8b7d('0x36'),function(_0x5f3666){try{utils['debug'](util['format'](_0x8b7d('0x37'),_0x5f3666[_0x8b7d('0x22')]),_0x5f3666);members[_0x8b7d('0x36')](_0x5f3666);}catch(_0x57988f){utils['error'](util[_0x8b7d('0x1f')](_0x8b7d('0x37'),_0x5f3666[_0x8b7d('0x22')]),_0x57988f);}});ami['on'](_0x8b7d('0x38'),function(_0x128693){try{utils[_0x8b7d('0x1c')](util[_0x8b7d('0x1f')](_0x8b7d('0x39'),_0x128693['uniqueid']),_0x128693);queues[_0x8b7d('0x38')](_0x128693);agents[_0x8b7d('0x38')](_0x128693);transfers[_0x8b7d('0x38')](_0x128693);recordings['blindtransfer'](_0x128693);}catch(_0x67bffa){utils[_0x8b7d('0x19')](util[_0x8b7d('0x1f')](_0x8b7d('0x39'),_0x128693[_0x8b7d('0x22')]),_0x67bffa);}});ami['on']('attendedtransfer',function(_0x5c1339){try{utils[_0x8b7d('0x1c')](util[_0x8b7d('0x1f')](_0x8b7d('0x3a'),_0x5c1339[_0x8b7d('0x3b')]),_0x5c1339);queues[_0x8b7d('0x3c')](_0x5c1339);transfers[_0x8b7d('0x3c')](_0x5c1339);agents[_0x8b7d('0x3c')](_0x5c1339);calls[_0x8b7d('0x3c')](_0x5c1339);}catch(_0x2ccadf){utils[_0x8b7d('0x19')](util[_0x8b7d('0x1f')](_0x8b7d('0x3a'),_0x5c1339[_0x8b7d('0x3b')]),_0x2ccadf);}});ami['on'](_0x8b7d('0x3d'),function(_0x4f69b6){try{utils['debug'](util[_0x8b7d('0x1f')](_0x8b7d('0x3e'),_0x4f69b6[_0x8b7d('0x22')]),_0x4f69b6);queues[_0x8b7d('0x3d')](_0x4f69b6);recordings[_0x8b7d('0x3d')](_0x4f69b6);calls[_0x8b7d('0x3d')](_0x4f69b6);dials[_0x8b7d('0x3d')](_0x4f69b6);}catch(_0x3e1672){utils[_0x8b7d('0x19')](util[_0x8b7d('0x1f')](_0x8b7d('0x3e'),_0x4f69b6['uniqueid']),_0x3e1672);}});ami['on']('newexten',function(_0x52585d){try{utils[_0x8b7d('0x1c')](util[_0x8b7d('0x1f')](_0x8b7d('0x3f'),_0x52585d[_0x8b7d('0x22')]),_0x52585d);calls[_0x8b7d('0x40')](_0x52585d);recordings[_0x8b7d('0x40')](_0x52585d);dials[_0x8b7d('0x40')](_0x52585d);}catch(_0x5075af){utils[_0x8b7d('0x19')](util[_0x8b7d('0x1f')]('[%s][index][newexten]',_0x52585d[_0x8b7d('0x22')]),_0x5075af);}});ami['on'](_0x8b7d('0x41'),function(_0x5aeac7){try{utils[_0x8b7d('0x1c')](util[_0x8b7d('0x1f')]('[%s][index][newchannel]',_0x5aeac7['uniqueid']),_0x5aeac7);calls[_0x8b7d('0x41')](_0x5aeac7);recordings['newchannel'](_0x5aeac7);}catch(_0x50df05){utils['error'](util[_0x8b7d('0x1f')](_0x8b7d('0x42'),_0x5aeac7[_0x8b7d('0x22')]),_0x50df05);}});ami['on'](_0x8b7d('0x43'),function(_0x31d7d0){try{utils[_0x8b7d('0x1c')](util['format'](_0x8b7d('0x44'),_0x31d7d0[_0x8b7d('0x22')]),_0x31d7d0);dials[_0x8b7d('0x43')](_0x31d7d0);}catch(_0x45e3a2){utils['error'](util[_0x8b7d('0x1f')](_0x8b7d('0x45'),_0x31d7d0[_0x8b7d('0x22')]),_0x45e3a2);}});ami['on'](_0x8b7d('0x46'),function(_0x47b0d7){try{utils[_0x8b7d('0x1c')](util[_0x8b7d('0x1f')](_0x8b7d('0x47'),_0x47b0d7[_0x8b7d('0x22')]),_0x47b0d7);dials[_0x8b7d('0x46')](_0x47b0d7);}catch(_0xb5d44b){utils[_0x8b7d('0x19')](util[_0x8b7d('0x1f')](_0x8b7d('0x47'),_0x47b0d7['uniqueid']),_0xb5d44b);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index a283d08..cee451d 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 _0x6f0d=['util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','data2','type','getUserByInterface','membername','name','internal','request','getUserByName','split','then','CreateMemberReport','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','TALKING','agent','NOT_INUSE','exitAt','duration','enterAt','agentcomplete','isNil','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][cdr]','data1','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','source'];(function(_0x13d676,_0x5b7204){var _0x5678ba=function(_0x2d466b){while(--_0x2d466b){_0x13d676['push'](_0x13d676['shift']());}};_0x5678ba(++_0x5b7204);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x4963b4,_0x2711f9){_0x4963b4=_0x4963b4-0x0;var _0x523b63=_0x6f0d[_0x4963b4];return _0x523b63;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var utils=require(_0xd6f0('0x1'));var members={};var exclude=[_0xd6f0('0x2'),_0xd6f0('0x3')];function writeDB(_0x573473){utils[_0xd6f0('0x4')](util[_0xd6f0('0x5')](_0xd6f0('0x6'),_0x573473[_0xd6f0('0x7')],_0x573473[_0xd6f0('0x8')],_0x573473['channel'],_0x573473[_0xd6f0('0x9')],_0x573473['membername'],_0x573473[_0xd6f0('0xa')]));if(_0x573473[_0xd6f0('0x8')]){utils[_0xd6f0('0xb')](_0x573473[_0xd6f0('0x8')])['then'](function(_0x507048){if(_0x507048){_0x573473[_0xd6f0('0xc')]=_0x507048[_0xd6f0('0xd')];_0x573473[_0xd6f0('0xe')]=_0x507048[_0xd6f0('0xe')];utils[_0xd6f0('0xf')]('CreateMemberReport',_0x573473);}else{utils[_0xd6f0('0x10')](_0x573473[_0xd6f0('0x8')][_0xd6f0('0x11')]('/')[0x1])[_0xd6f0('0x12')](function(_0x4d10a1){if(_0x4d10a1){_0x573473[_0xd6f0('0xc')]=_0x4d10a1[_0xd6f0('0xd')];_0x573473[_0xd6f0('0xe')]=_0x4d10a1[_0xd6f0('0xe')];utils[_0xd6f0('0xf')](_0xd6f0('0x13'),_0x573473);}});}})[_0xd6f0('0x14')](function(_0x250999){utils[_0xd6f0('0x15')](util['format'](_0xd6f0('0x16'),_0x573473[_0xd6f0('0x7')]),_0x250999);});}delete members[_0x573473['interface']];}function startsWith(_0x419b7e,_0x593abe){return _[_0xd6f0('0x17')](_0x419b7e,function(_0x154e3e){return _[_0xd6f0('0x18')](_0x593abe,_0x154e3e);});}exports[_0xd6f0('0x19')]=function(_0x64ff5f){try{utils[_0xd6f0('0x1a')](util[_0xd6f0('0x5')](_0xd6f0('0x1b'),members[_0x64ff5f[_0xd6f0('0x1c')]]?members[_0x64ff5f[_0xd6f0('0x1c')]][_0xd6f0('0x7')]:_0x64ff5f[_0xd6f0('0x1c')]),_0x64ff5f);utils[_0xd6f0('0x4')](util[_0xd6f0('0x5')](_0xd6f0('0x1d'),members[_0x64ff5f[_0xd6f0('0x1c')]]?members[_0x64ff5f['device']]['uniqueid']:_0x64ff5f[_0xd6f0('0x1c')],_0x64ff5f[_0xd6f0('0x1e')],_0x64ff5f[_0xd6f0('0x1c')]));switch(_0x64ff5f['state']){case _0xd6f0('0x1f'):case _0xd6f0('0x20'):if(!startsWith(exclude,_0x64ff5f['device'])){members[_0x64ff5f[_0xd6f0('0x1c')]]={'channel':'voice','interface':_0x64ff5f[_0xd6f0('0x1c')],'type':_0xd6f0('0x21'),'enterAt':utils['now'](),'role':_0xd6f0('0x22')};}break;case _0xd6f0('0x23'):if(!_['isNil'](members[_0x64ff5f[_0xd6f0('0x1c')]])){members[_0x64ff5f[_0xd6f0('0x1c')]][_0xd6f0('0x24')]=utils['now']();members[_0x64ff5f[_0xd6f0('0x1c')]][_0xd6f0('0x25')]=utils['diffTime'](members[_0x64ff5f[_0xd6f0('0x1c')]]['exitAt'],members[_0x64ff5f[_0xd6f0('0x1c')]][_0xd6f0('0x26')]);if(members[_0x64ff5f[_0xd6f0('0x1c')]][_0xd6f0('0x7')]){writeDB(members[_0x64ff5f[_0xd6f0('0x1c')]]);}}break;default:break;}}catch(_0x715aab){utils[_0xd6f0('0x15')](util[_0xd6f0('0x5')]('[%s][members][devicestatechange]',members[_0x64ff5f[_0xd6f0('0x1c')]]?members[_0x64ff5f[_0xd6f0('0x1c')]]['uniqueid']:_0x64ff5f[_0xd6f0('0x1c')]),_0x715aab);}};exports[_0xd6f0('0x27')]=function(_0x27db5e){try{if(!_[_0xd6f0('0x28')](members[_0x27db5e[_0xd6f0('0x8')]])){utils[_0xd6f0('0x1a')](util[_0xd6f0('0x5')](_0xd6f0('0x29'),_0x27db5e[_0xd6f0('0x7')]),_0x27db5e);utils[_0xd6f0('0x4')](util[_0xd6f0('0x5')](_0xd6f0('0x2a'),_0x27db5e[_0xd6f0('0x7')],_0x27db5e[_0xd6f0('0x8')],_0x27db5e[_0xd6f0('0x2b')]));members[_0x27db5e[_0xd6f0('0x8')]]=_[_0xd6f0('0x2c')](members[_0x27db5e[_0xd6f0('0x8')]],{'data4':_0x27db5e[_0xd6f0('0x2b')],'uniqueid':_0x27db5e[_0xd6f0('0x7')]});}}catch(_0x3906ca){utils[_0xd6f0('0x15')](util['format'](_0xd6f0('0x29'),_0x27db5e['uniqueid']),_0x3906ca);}};exports['cdr']=function(_0x43d588){try{utils[_0xd6f0('0x1a')](util[_0xd6f0('0x5')](_0xd6f0('0x2d'),_0x43d588[_0xd6f0('0x7')]),_0x43d588);if(_0x43d588['channel']){var _0x15d856=_0x43d588['channel'][_0xd6f0('0x11')]('-')[0x0];if(!_[_0xd6f0('0x28')](members[_0x15d856])){members[_0x15d856]=_[_0xd6f0('0x2c')](members[_0x15d856],{'data1':members[_0x15d856][_0xd6f0('0x2e')]||_0x43d588[_0xd6f0('0xa')],'data2':members[_0x15d856]['data2']||_0x43d588['source'],'data3':members[_0x15d856][_0xd6f0('0x2f')]||_0x43d588[_0xd6f0('0x30')],'uniqueid':members[_0x15d856]['uniqueid']||_0x43d588[_0xd6f0('0x7')]});utils['info'](util[_0xd6f0('0x5')](_0xd6f0('0x31'),_0x43d588[_0xd6f0('0x7')],members[_0x15d856][_0xd6f0('0x2e')],members[_0x15d856][_0xd6f0('0x9')],members[_0x15d856][_0xd6f0('0x2f')]));if(members[_0x15d856][_0xd6f0('0x24')]){writeDB(members[_0x15d856]);}}}if(_0x43d588['destinationchannel']){var _0x52203d=_0x43d588[_0xd6f0('0x32')][_0xd6f0('0x11')]('-')[0x0];if(!_[_0xd6f0('0x28')](members[_0x52203d])){members[_0x52203d]=_['assign'](members[_0x52203d],{'data1':members[_0x52203d]['data1']||_0x43d588[_0xd6f0('0xa')],'data2':members[_0x52203d][_0xd6f0('0x9')]||_0x43d588[_0xd6f0('0x33')],'data3':members[_0x52203d][_0xd6f0('0x2f')]||_0x43d588[_0xd6f0('0x30')],'uniqueid':members[_0x52203d][_0xd6f0('0x7')]||_0x43d588[_0xd6f0('0x7')]});utils[_0xd6f0('0x4')](util['format'](_0xd6f0('0x31'),_0x43d588[_0xd6f0('0x7')],members[_0x52203d][_0xd6f0('0x2e')],members[_0x52203d][_0xd6f0('0x9')],members[_0x52203d]['data3']));if(members[_0x52203d][_0xd6f0('0x24')]){writeDB(members[_0x52203d]);}}}}catch(_0x94ec6d){utils[_0xd6f0('0x15')](util[_0xd6f0('0x5')](_0xd6f0('0x2d'),_0x43d588['uniqueid']),_0x94ec6d);}}; \ No newline at end of file +var _0xdc85=['debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','isNil','exitAt','diffTime','enterAt','[%s][members][devicestatechange]','agentcomplete','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','[%s][members][agentcomplete]','data1','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','data3','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','type','getUserByInterface','then','name','internal','request','split','CreateMemberReport','catch','error','[%s][members][writeDB]','startsWith','devicestatechange'];(function(_0x1991b5,_0x3ae379){var _0x374f6d=function(_0x4b5763){while(--_0x4b5763){_0x1991b5['push'](_0x1991b5['shift']());}};_0x374f6d(++_0x3ae379);}(_0xdc85,0x1b1));var _0x5dc8=function(_0x5d9646,_0x559941){_0x5d9646=_0x5d9646-0x0;var _0x27f0b1=_0xdc85[_0x5d9646];return _0x27f0b1;};'use strict';var _=require(_0x5dc8('0x0'));var util=require(_0x5dc8('0x1'));var utils=require(_0x5dc8('0x2'));var members={};var exclude=[_0x5dc8('0x3'),_0x5dc8('0x4')];function writeDB(_0x100781){utils[_0x5dc8('0x5')](util[_0x5dc8('0x6')](_0x5dc8('0x7'),_0x100781[_0x5dc8('0x8')],_0x100781[_0x5dc8('0x9')],_0x100781[_0x5dc8('0xa')],_0x100781[_0x5dc8('0xb')],_0x100781[_0x5dc8('0xc')],_0x100781[_0x5dc8('0xd')]));if(_0x100781[_0x5dc8('0x9')]){utils[_0x5dc8('0xe')](_0x100781[_0x5dc8('0x9')])[_0x5dc8('0xf')](function(_0x2b8a26){if(_0x2b8a26){_0x100781[_0x5dc8('0xc')]=_0x2b8a26[_0x5dc8('0x10')];_0x100781[_0x5dc8('0x11')]=_0x2b8a26[_0x5dc8('0x11')];utils[_0x5dc8('0x12')]('CreateMemberReport',_0x100781);}else{utils['getUserByName'](_0x100781[_0x5dc8('0x9')][_0x5dc8('0x13')]('/')[0x1])['then'](function(_0x3a250f){if(_0x3a250f){_0x100781[_0x5dc8('0xc')]=_0x3a250f[_0x5dc8('0x10')];_0x100781[_0x5dc8('0x11')]=_0x3a250f[_0x5dc8('0x11')];utils[_0x5dc8('0x12')](_0x5dc8('0x14'),_0x100781);}});}})[_0x5dc8('0x15')](function(_0x29fec2){utils[_0x5dc8('0x16')](util[_0x5dc8('0x6')](_0x5dc8('0x17'),_0x100781[_0x5dc8('0x8')]),_0x29fec2);});}delete members[_0x100781['interface']];}function startsWith(_0xfb32cd,_0x29228d){return _['some'](_0xfb32cd,function(_0x1511f0){return _[_0x5dc8('0x18')](_0x29228d,_0x1511f0);});}exports[_0x5dc8('0x19')]=function(_0x8ca4e1){try{utils[_0x5dc8('0x1a')](util[_0x5dc8('0x6')]('[%s][members][devicestatechange]',members[_0x8ca4e1['device']]?members[_0x8ca4e1['device']][_0x5dc8('0x8')]:_0x8ca4e1[_0x5dc8('0x1b')]),_0x8ca4e1);utils[_0x5dc8('0x5')](util[_0x5dc8('0x6')](_0x5dc8('0x1c'),members[_0x8ca4e1[_0x5dc8('0x1b')]]?members[_0x8ca4e1['device']][_0x5dc8('0x8')]:_0x8ca4e1[_0x5dc8('0x1b')],_0x8ca4e1[_0x5dc8('0x1d')],_0x8ca4e1['device']));switch(_0x8ca4e1[_0x5dc8('0x1d')]){case _0x5dc8('0x1e'):case _0x5dc8('0x1f'):if(!startsWith(exclude,_0x8ca4e1[_0x5dc8('0x1b')])){members[_0x8ca4e1[_0x5dc8('0x1b')]]={'channel':_0x5dc8('0x20'),'interface':_0x8ca4e1[_0x5dc8('0x1b')],'type':_0x5dc8('0x21'),'enterAt':utils[_0x5dc8('0x22')](),'role':'agent'};}break;case'NOT_INUSE':if(!_[_0x5dc8('0x23')](members[_0x8ca4e1[_0x5dc8('0x1b')]])){members[_0x8ca4e1['device']][_0x5dc8('0x24')]=utils['now']();members[_0x8ca4e1[_0x5dc8('0x1b')]]['duration']=utils[_0x5dc8('0x25')](members[_0x8ca4e1[_0x5dc8('0x1b')]][_0x5dc8('0x24')],members[_0x8ca4e1[_0x5dc8('0x1b')]][_0x5dc8('0x26')]);if(members[_0x8ca4e1[_0x5dc8('0x1b')]][_0x5dc8('0x8')]){writeDB(members[_0x8ca4e1[_0x5dc8('0x1b')]]);}}break;default:break;}}catch(_0x8812db){utils[_0x5dc8('0x16')](util[_0x5dc8('0x6')](_0x5dc8('0x27'),members[_0x8ca4e1['device']]?members[_0x8ca4e1[_0x5dc8('0x1b')]][_0x5dc8('0x8')]:_0x8ca4e1[_0x5dc8('0x1b')]),_0x8812db);}};exports[_0x5dc8('0x28')]=function(_0x1efbe4){try{if(!_[_0x5dc8('0x23')](members[_0x1efbe4[_0x5dc8('0x9')]])){utils[_0x5dc8('0x1a')](util[_0x5dc8('0x6')]('[%s][members][agentcomplete]',_0x1efbe4[_0x5dc8('0x8')]),_0x1efbe4);utils['info'](util[_0x5dc8('0x6')](_0x5dc8('0x29'),_0x1efbe4[_0x5dc8('0x8')],_0x1efbe4['interface'],_0x1efbe4['queue']));members[_0x1efbe4[_0x5dc8('0x9')]]=_[_0x5dc8('0x2a')](members[_0x1efbe4[_0x5dc8('0x9')]],{'data4':_0x1efbe4[_0x5dc8('0x2b')],'uniqueid':_0x1efbe4['uniqueid']});}}catch(_0x274213){utils[_0x5dc8('0x16')](util['format'](_0x5dc8('0x2c'),_0x1efbe4['uniqueid']),_0x274213);}};exports['cdr']=function(_0x227b52){try{utils[_0x5dc8('0x1a')](util['format']('[%s][members][cdr]',_0x227b52[_0x5dc8('0x8')]),_0x227b52);if(_0x227b52[_0x5dc8('0xa')]){var _0x1e2776=_0x227b52[_0x5dc8('0xa')][_0x5dc8('0x13')]('-')[0x0];if(!_[_0x5dc8('0x23')](members[_0x1e2776])){members[_0x1e2776]=_[_0x5dc8('0x2a')](members[_0x1e2776],{'data1':members[_0x1e2776][_0x5dc8('0x2d')]||_0x227b52[_0x5dc8('0xd')],'data2':members[_0x1e2776][_0x5dc8('0xb')]||_0x227b52[_0x5dc8('0x2e')],'data3':members[_0x1e2776]['data3']||_0x227b52[_0x5dc8('0x2f')],'uniqueid':members[_0x1e2776][_0x5dc8('0x8')]||_0x227b52[_0x5dc8('0x8')]});utils[_0x5dc8('0x5')](util['format'](_0x5dc8('0x30'),_0x227b52['uniqueid'],members[_0x1e2776]['data1'],members[_0x1e2776][_0x5dc8('0xb')],members[_0x1e2776]['data3']));if(members[_0x1e2776][_0x5dc8('0x24')]){writeDB(members[_0x1e2776]);}}}if(_0x227b52[_0x5dc8('0x31')]){var _0x549404=_0x227b52['destinationchannel'][_0x5dc8('0x13')]('-')[0x0];if(!_[_0x5dc8('0x23')](members[_0x549404])){members[_0x549404]=_[_0x5dc8('0x2a')](members[_0x549404],{'data1':members[_0x549404][_0x5dc8('0x2d')]||_0x227b52[_0x5dc8('0xd')],'data2':members[_0x549404][_0x5dc8('0xb')]||_0x227b52[_0x5dc8('0x2e')],'data3':members[_0x549404][_0x5dc8('0x32')]||_0x227b52['destination'],'uniqueid':members[_0x549404][_0x5dc8('0x8')]||_0x227b52[_0x5dc8('0x8')]});utils[_0x5dc8('0x5')](util[_0x5dc8('0x6')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x227b52['uniqueid'],members[_0x549404][_0x5dc8('0x2d')],members[_0x549404][_0x5dc8('0xb')],members[_0x549404][_0x5dc8('0x32')]));if(members[_0x549404]['exitAt']){writeDB(members[_0x549404]);}}}}catch(_0x5d1652){utils['error'](util[_0x5dc8('0x6')]('[%s][members][cdr]',_0x227b52[_0x5dc8('0x8')]),_0x5d1652);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 48ce731..ce7150c 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 _0xee7b=['lastAssignedTo','accountcode','getVoiceQueueByName','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','isNil','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerexitreason','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','varset','variable','queuestatus','value','CONTINUE','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','EXITWITHKEY','[%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]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','diffTime','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','[%s][queues][agentcomplete]','transfer','TRANSFER','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','ATTENDED','origtransfererexten','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','queuecallerenterreason','clone','transfertargetuniqueid','calleridnum','calleridname','queuecallerjoinAt','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','info','format','queue'];(function(_0x296d2f,_0x5ae90c){var _0x45499d=function(_0xef773c){while(--_0xef773c){_0x296d2f['push'](_0x296d2f['shift']());}};_0x45499d(++_0x5ae90c);}(_0xee7b,0x195));var _0xbee7=function(_0x10b9b5,_0x408dfe){_0x10b9b5=_0x10b9b5-0x0;var _0x51a8ce=_0xee7b[_0x10b9b5];return _0x51a8ce;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var queues={};function writeDB(_0x114cec){utils[_0xbee7('0x0')](util[_0xbee7('0x1')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x114cec['uniqueid'],_0x114cec['channel'],_0x114cec[_0xbee7('0x2')],_0x114cec[_0xbee7('0x3')],_0x114cec['calleridnum'],_0x114cec[_0xbee7('0x4')],_0x114cec['queuecallerexitreason']));if(_0x114cec['queue']){utils[_0xbee7('0x5')](_0x114cec[_0xbee7('0x2')])['then'](function(_0x111573){if(_0x111573){_0x114cec['type']=_0x111573['type'];}utils[_0xbee7('0x6')]('CreateVoiceQueueReport',_0x114cec);});}else{utils[_0xbee7('0x6')](_0xbee7('0x7'),_0x114cec);}if(_0x114cec[_0xbee7('0x8')]){delete queues[_0x114cec[_0xbee7('0x8')]];}else{delete queues[_0x114cec[_0xbee7('0x9')]];}}exports[_0xbee7('0xa')]=function(_0x1210d5){try{utils['debug'](util[_0xbee7('0x1')](_0xbee7('0xb'),_0x1210d5[_0xbee7('0x9')]),_0x1210d5);utils[_0xbee7('0x0')](util[_0xbee7('0x1')](_0xbee7('0xc'),_0x1210d5[_0xbee7('0x9')],_0x1210d5[_0xbee7('0x2')],_0x1210d5[_0xbee7('0xd')]));queues[_0x1210d5[_0xbee7('0x9')]]=_[_0xbee7('0xe')](_0x1210d5,{'originalposition':_0x1210d5[_0xbee7('0xd')],'queuecallerjoinAt':utils[_0xbee7('0xf')](),'mohtime':0x0});}catch(_0x1048fe){utils[_0xbee7('0x10')](util[_0xbee7('0x1')](_0xbee7('0xb'),_0x1210d5[_0xbee7('0x9')]),_0x1048fe);}};exports[_0xbee7('0x11')]=function(_0x3e030c){try{if(!_[_0xbee7('0x12')](queues[_0x3e030c[_0xbee7('0x9')]])){utils[_0xbee7('0x13')](util[_0xbee7('0x1')](_0xbee7('0x14'),_0x3e030c[_0xbee7('0x9')]),_0x3e030c);if(queues[_0x3e030c['uniqueid']][_0xbee7('0x15')]){if(!queues[_0x3e030c[_0xbee7('0x9')]]['queuecallerabandon']&&!queues[_0x3e030c[_0xbee7('0x9')]][_0xbee7('0x16')]){queues[_0x3e030c[_0xbee7('0x9')]][_0xbee7('0x17')]=!![];queues[_0x3e030c[_0xbee7('0x9')]][_0xbee7('0x18')]=utils['now']();queues[_0x3e030c[_0xbee7('0x9')]]['queuecallerexitreason']='COMPLETEDBYAGENT';}utils[_0xbee7('0x0')](util[_0xbee7('0x1')](_0xbee7('0x19'),_0x3e030c['uniqueid'],queues[_0x3e030c[_0xbee7('0x9')]][_0xbee7('0x1a')],queues[_0x3e030c['uniqueid']][_0xbee7('0x1b')]));writeDB(queues[_0x3e030c[_0xbee7('0x9')]]);}else if(queues[_0x3e030c[_0xbee7('0x9')]][_0xbee7('0x8')]){utils[_0xbee7('0x0')](util['format'](_0xbee7('0x1c'),_0x3e030c[_0xbee7('0x9')],queues[_0x3e030c['uniqueid']][_0xbee7('0x1a')],queues[_0x3e030c[_0xbee7('0x9')]][_0xbee7('0x8')]));queues[queues[_0x3e030c['uniqueid']][_0xbee7('0x8')]]=queues[_0x3e030c['uniqueid']];queues[queues[_0x3e030c['uniqueid']][_0xbee7('0x8')]]['queuecallerenterreason']=0x2;delete queues[_0x3e030c[_0xbee7('0x9')]];}}}catch(_0x30b0ca){utils[_0xbee7('0x10')](util[_0xbee7('0x1')](_0xbee7('0x14'),_0x3e030c['uniqueid']),_0x30b0ca);}};exports[_0xbee7('0x1d')]=function(_0x40c95a){try{utils[_0xbee7('0x13')](util[_0xbee7('0x1')]('[%s][queues][varset]',_0x40c95a[_0xbee7('0x9')]),_0x40c95a);if(!_[_0xbee7('0x12')](_0x40c95a[_0xbee7('0x1e')][_0xbee7('0x1f')])&&_0x40c95a[_0xbee7('0x20')]['toUpperCase']()!==_0xbee7('0x21')){if(!_[_0xbee7('0x12')](queues[_0x40c95a[_0xbee7('0x9')]])){queues[_0x40c95a[_0xbee7('0x9')]]['queuecallerabandon']=![];queues[_0x40c95a[_0xbee7('0x9')]]['queuecallerabandonAt']=null;queues[_0x40c95a[_0xbee7('0x9')]]['queuecallerexit']=!![];queues[_0x40c95a['uniqueid']]['queuecallerexitAt']=utils[_0xbee7('0xf')]();queues[_0x40c95a['uniqueid']][_0xbee7('0x1b')]=_0x40c95a[_0xbee7('0x20')][_0xbee7('0x22')]();utils['info'](util['format'](_0xbee7('0x23'),_0x40c95a[_0xbee7('0x9')],queues[_0x40c95a[_0xbee7('0x9')]]['name'],_0x40c95a[_0xbee7('0x20')],queues[_0x40c95a['uniqueid']][_0xbee7('0x1b')]));writeDB(queues[_0x40c95a[_0xbee7('0x9')]]);}}else if(!_[_0xbee7('0x12')](_0x40c95a[_0xbee7('0x1e')]['queueposition'])){if(!_[_0xbee7('0x12')](queues[_0x40c95a['uniqueid']])&&!queues[_0x40c95a['uniqueid']]['queuecallerabandon']){queues[_0x40c95a[_0xbee7('0x9')]][_0xbee7('0x24')]=![];queues[_0x40c95a[_0xbee7('0x9')]][_0xbee7('0x25')]=null;queues[_0x40c95a[_0xbee7('0x9')]][_0xbee7('0x16')]=!![];queues[_0x40c95a[_0xbee7('0x9')]][_0xbee7('0x26')]=utils[_0xbee7('0xf')]();queues[_0x40c95a['uniqueid']][_0xbee7('0x1b')]=_0xbee7('0x27');utils[_0xbee7('0x0')](util['format'](_0xbee7('0x28'),_0x40c95a[_0xbee7('0x9')],queues[_0x40c95a[_0xbee7('0x9')]][_0xbee7('0x1a')],_0x40c95a[_0xbee7('0x20')],queues[_0x40c95a[_0xbee7('0x9')]]['queuecallerexitreason']));}}}catch(_0x1f1a90){utils['error'](util[_0xbee7('0x1')](_0xbee7('0x29'),_0x40c95a[_0xbee7('0x9')]),_0x1f1a90);}};exports[_0xbee7('0x24')]=function(_0x10ba0d){try{if(!_[_0xbee7('0x12')](queues[_0x10ba0d['uniqueid']])){utils[_0xbee7('0x13')](util['format'](_0xbee7('0x2a'),_0x10ba0d[_0xbee7('0x9')]),_0x10ba0d);queues[_0x10ba0d['uniqueid']][_0xbee7('0x16')]=![];queues[_0x10ba0d[_0xbee7('0x9')]]['queuecallerexitAt']=null;queues[_0x10ba0d[_0xbee7('0x9')]]['queuecallerabandon']=!![];queues[_0x10ba0d['uniqueid']][_0xbee7('0x25')]=utils['now']();queues[_0x10ba0d[_0xbee7('0x9')]][_0xbee7('0x1b')]=_0xbee7('0x2b');utils[_0xbee7('0x0')](util[_0xbee7('0x1')](_0xbee7('0x2c'),_0x10ba0d[_0xbee7('0x9')],queues[_0x10ba0d['uniqueid']][_0xbee7('0x1a')],queues[_0x10ba0d['uniqueid']][_0xbee7('0x1b')]));}}catch(_0x42512f){utils[_0xbee7('0x10')](util[_0xbee7('0x1')](_0xbee7('0x2a'),_0x10ba0d[_0xbee7('0x9')]),_0x42512f);}};exports[_0xbee7('0x2d')]=function(_0x183619){try{if(!_[_0xbee7('0x12')](queues[_0x183619[_0xbee7('0x9')]])){utils[_0xbee7('0x13')](util[_0xbee7('0x1')](_0xbee7('0x2e'),_0x183619[_0xbee7('0x9')]),_0x183619);utils['info'](util['format'](_0xbee7('0x2f'),_0x183619['uniqueid'],queues[_0x183619[_0xbee7('0x9')]]['name'],_0x183619['connectedlinenum'],_0x183619[_0xbee7('0x30')]));queues[_0x183619[_0xbee7('0x9')]][_0xbee7('0x2d')]=!![];queues[_0x183619[_0xbee7('0x9')]]['queuecallerleaveAt']=utils[_0xbee7('0xf')]();queues[_0x183619['uniqueid']]['holdtime']=utils[_0xbee7('0x31')](queues[_0x183619[_0xbee7('0x9')]][_0xbee7('0x15')],queues[_0x183619['uniqueid']]['queuecallerjoinAt']);queues[_0x183619['uniqueid']][_0xbee7('0xd')]=_0x183619[_0xbee7('0xd')];queues[_0x183619['uniqueid']][_0xbee7('0x32')]=_0x183619[_0xbee7('0x32')];queues[_0x183619['uniqueid']]['connectedlinenum']=_0x183619['connectedlinenum'];queues[_0x183619[_0xbee7('0x9')]][_0xbee7('0x30')]=_0x183619[_0xbee7('0x30')];}}catch(_0x5b0e1b){utils[_0xbee7('0x10')](util['format'](_0xbee7('0x2e'),_0x183619[_0xbee7('0x9')]),_0x5b0e1b);}};exports[_0xbee7('0x33')]=function(_0x3c2cd3){try{if(!_['isNil'](queues[_0x3c2cd3[_0xbee7('0x9')]])){utils[_0xbee7('0x13')](util['format'](_0xbee7('0x34'),_0x3c2cd3[_0xbee7('0x9')]),_0x3c2cd3);utils['info'](util['format'](_0xbee7('0x35'),_0x3c2cd3[_0xbee7('0x9')],queues[_0x3c2cd3[_0xbee7('0x9')]][_0xbee7('0x1a')],_0x3c2cd3[_0xbee7('0x36')],_0x3c2cd3[_0xbee7('0x37')]));queues[_0x3c2cd3['uniqueid']][_0xbee7('0x24')]=![];queues[_0x3c2cd3[_0xbee7('0x9')]][_0xbee7('0x24')]=![];queues[_0x3c2cd3['uniqueid']][_0xbee7('0x25')]=null;queues[_0x3c2cd3[_0xbee7('0x9')]][_0xbee7('0x16')]=![];queues[_0x3c2cd3[_0xbee7('0x9')]][_0xbee7('0x1b')]=null;queues[_0x3c2cd3['uniqueid']][_0xbee7('0x26')]=null;queues[_0x3c2cd3['uniqueid']][_0xbee7('0x38')]=!![];queues[_0x3c2cd3['uniqueid']][_0xbee7('0x4')]=_0x3c2cd3[_0xbee7('0x37')];queues[_0x3c2cd3['uniqueid']]['lastAssignedTo']=_0x3c2cd3['membername'];}}catch(_0xba118){utils[_0xbee7('0x10')](util[_0xbee7('0x1')]('[%s][queues][agentconnect]',_0x3c2cd3[_0xbee7('0x9')]),_0xba118);}};exports['agentcomplete']=function(_0x41cd2f){try{if(!_[_0xbee7('0x12')](queues[_0x41cd2f[_0xbee7('0x9')]])){if(queues[_0x41cd2f[_0xbee7('0x9')]][_0xbee7('0x15')]){utils['debug'](util[_0xbee7('0x1')](_0xbee7('0x39'),_0x41cd2f[_0xbee7('0x9')]),_0x41cd2f);queues[_0x41cd2f[_0xbee7('0x9')]]['queuecallerabandon']=![];queues[_0x41cd2f[_0xbee7('0x9')]][_0xbee7('0x24')]=![];queues[_0x41cd2f['uniqueid']][_0xbee7('0x25')]=null;queues[_0x41cd2f[_0xbee7('0x9')]]['queuecallerexit']=![];queues[_0x41cd2f[_0xbee7('0x9')]][_0xbee7('0x26')]=null;queues[_0x41cd2f['uniqueid']]['assigned']=!![];queues[_0x41cd2f[_0xbee7('0x9')]][_0xbee7('0x3')]=_0x41cd2f['membername'];queues[_0x41cd2f['uniqueid']]['queuecallercomplete']=!![];queues[_0x41cd2f['uniqueid']][_0xbee7('0x18')]=utils[_0xbee7('0xf')]();if(_0x41cd2f['reason']==_0xbee7('0x3a')){if(!queues[_0x41cd2f[_0xbee7('0x9')]][_0xbee7('0x3a')]){queues[_0x41cd2f[_0xbee7('0x9')]][_0xbee7('0x1b')]=_0xbee7('0x3b');}}else{queues[_0x41cd2f['uniqueid']][_0xbee7('0x1b')]='COMPLETEDBY'+_0x41cd2f[_0xbee7('0x3c')]['toUpperCase']();}utils[_0xbee7('0x0')](util[_0xbee7('0x1')](_0xbee7('0x3d'),_0x41cd2f['uniqueid'],queues[_0x41cd2f[_0xbee7('0x9')]][_0xbee7('0x1a')],_0x41cd2f[_0xbee7('0x36')],queues[_0x41cd2f[_0xbee7('0x9')]][_0xbee7('0x1b')]));writeDB(queues[_0x41cd2f[_0xbee7('0x9')]]);}}}catch(_0x51aceb){utils[_0xbee7('0x10')](util['format'](_0xbee7('0x39'),_0x41cd2f['uniqueid']),_0x51aceb);}};exports[_0xbee7('0x3e')]=function(_0x2658ef){try{if(!_[_0xbee7('0x12')](queues[_0x2658ef[_0xbee7('0x3f')]])){utils[_0xbee7('0x13')](util[_0xbee7('0x1')](_0xbee7('0x40'),_0x2658ef[_0xbee7('0x9')]),_0x2658ef);queues[_0x2658ef[_0xbee7('0x3f')]][_0xbee7('0x3a')]=!![];queues[_0x2658ef[_0xbee7('0x3f')]][_0xbee7('0x41')]=_0xbee7('0x42');queues[_0x2658ef[_0xbee7('0x3f')]][_0xbee7('0x43')]=_0x2658ef[_0xbee7('0x44')];queues[_0x2658ef[_0xbee7('0x3f')]][_0xbee7('0x45')]=_0x2658ef[_0xbee7('0x3f')];queues[_0x2658ef[_0xbee7('0x3f')]][_0xbee7('0x1b')]=_0xbee7('0x46');utils['info'](util[_0xbee7('0x1')](_0xbee7('0x47'),_0x2658ef['uniqueid'],queues[_0x2658ef['transfereeuniqueid']][_0xbee7('0x1a')],_0x2658ef['transfereeuniqueid'],_0x2658ef['extension']));}}catch(_0x41ed01){utils[_0xbee7('0x10')](util[_0xbee7('0x1')](_0xbee7('0x40'),_0x2658ef['uniqueid']),_0x41ed01);}};exports['attendedtransfer']=function(_0x535072){try{utils[_0xbee7('0x13')](util[_0xbee7('0x1')](_0xbee7('0x48'),_0x535072['origtransfereruniqueid']),_0x535072);if(_0x535072[_0xbee7('0x49')]==_0x535072['origtransfererlinkedid']){if(!_[_0xbee7('0x12')](queues[_0x535072[_0xbee7('0x4a')]])){utils[_0xbee7('0x0')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x535072[_0xbee7('0x49')],queues[_0x535072[_0xbee7('0x4a')]][_0xbee7('0x1a')],_0x535072['origtransfererexten']));queues[_0x535072[_0xbee7('0x4a')]][_0xbee7('0x3a')]=!![];queues[_0x535072['secondtransfererlinkedid']][_0xbee7('0x41')]=_0xbee7('0x4b');queues[_0x535072[_0xbee7('0x4a')]][_0xbee7('0x43')]=_0x535072[_0xbee7('0x4c')];queues[_0x535072['secondtransfererlinkedid']]['transferuniqueid']=_0x535072[_0xbee7('0x49')];queues[_0x535072[_0xbee7('0x4a')]][_0xbee7('0x1b')]=_0xbee7('0x4d');}if(!_[_0xbee7('0x12')](queues[_0x535072[_0xbee7('0x4e')]])){if(_0x535072[_0xbee7('0x4f')]&&queues[_0x535072[_0xbee7('0x4f')]]){queues[_0x535072[_0xbee7('0x4f')]][_0xbee7('0x50')]=0x1;queues[_0x535072[_0xbee7('0x3f')]]=_[_0xbee7('0x51')](queues[_0x535072[_0xbee7('0x4f')]]);queues[_0x535072[_0xbee7('0x3f')]][_0xbee7('0x8')]=_0x535072[_0xbee7('0x52')];queues[_0x535072[_0xbee7('0x3f')]][_0xbee7('0x50')]=0x2;queues[_0x535072[_0xbee7('0x3f')]][_0xbee7('0x53')]=queues[_0x535072['secondtransfererlinkedid']][_0xbee7('0x53')];queues[_0x535072[_0xbee7('0x3f')]][_0xbee7('0x54')]=queues[_0x535072['secondtransfererlinkedid']][_0xbee7('0x54')];queues[_0x535072[_0xbee7('0x3f')]][_0xbee7('0x55')]=utils[_0xbee7('0xf')]();queues[_0x535072[_0xbee7('0x3f')]][_0xbee7('0x15')]=utils['now']();queues[_0x535072[_0xbee7('0x3f')]]['holdtime']=0x0;queues[_0x535072[_0xbee7('0x3f')]]['mohtime']=0x0;utils[_0xbee7('0x0')](util['format'](_0xbee7('0x56'),_0x535072[_0xbee7('0x49')],queues[_0x535072['transfereeuniqueid']]['name'],queues[_0x535072['transfereeuniqueid']][_0xbee7('0x53')],queues[_0x535072[_0xbee7('0x3f')]][_0xbee7('0x54')]));}else{utils[_0xbee7('0x0')](util[_0xbee7('0x1')](_0xbee7('0x57'),_0x535072[_0xbee7('0x49')],queues[_0x535072[_0xbee7('0x4e')]][_0xbee7('0x1a')],_0x535072['secondtransfererlinkedid']));queues[_0x535072[_0xbee7('0x4e')]][_0xbee7('0x8')]=_0x535072['secondtransfererlinkedid'];}}}else if(_0x535072[_0xbee7('0x58')]==_0x535072['secondtransfererlinkedid']){if(!_[_0xbee7('0x12')](queues[_0x535072[_0xbee7('0x4e')]])){utils['info'](util['format'](_0xbee7('0x59'),_0x535072['origtransfereruniqueid'],queues[_0x535072[_0xbee7('0x4e')]][_0xbee7('0x1a')],_0x535072[_0xbee7('0x58')],_0x535072['secondtransfererexten']));queues[_0x535072['origtransfererlinkedid']]['transfer']=!![];queues[_0x535072[_0xbee7('0x4e')]]['transfertype']=_0xbee7('0x4b');queues[_0x535072[_0xbee7('0x4e')]][_0xbee7('0x43')]=_0x535072[_0xbee7('0x5a')];queues[_0x535072[_0xbee7('0x4e')]][_0xbee7('0x45')]=_0x535072['secondtransfereruniqueid'];queues[_0x535072[_0xbee7('0x4e')]][_0xbee7('0x1b')]=_0xbee7('0x4d');}if(!_[_0xbee7('0x12')](queues[_0x535072[_0xbee7('0x4a')]])){if(_0x535072[_0xbee7('0x5b')]&&queues[_0x535072[_0xbee7('0x5b')]]){queues[_0x535072[_0xbee7('0x5b')]][_0xbee7('0x50')]=0x1;queues[_0x535072[_0xbee7('0x52')]]=_[_0xbee7('0x51')](queues[_0x535072[_0xbee7('0x5b')]]);queues[_0x535072[_0xbee7('0x52')]][_0xbee7('0x8')]=_0x535072[_0xbee7('0x52')];queues[_0x535072['transfertargetuniqueid']][_0xbee7('0x50')]=0x2;queues[_0x535072['transfertargetuniqueid']]['calleridnum']=queues[_0x535072[_0xbee7('0x4e')]][_0xbee7('0x53')];queues[_0x535072[_0xbee7('0x52')]][_0xbee7('0x54')]=queues[_0x535072[_0xbee7('0x4e')]][_0xbee7('0x54')];queues[_0x535072[_0xbee7('0x52')]][_0xbee7('0x55')]=utils[_0xbee7('0xf')]();queues[_0x535072[_0xbee7('0x52')]]['queuecallerleaveAt']=utils[_0xbee7('0xf')]();queues[_0x535072['transfertargetuniqueid']][_0xbee7('0x5c')]=0x0;queues[_0x535072[_0xbee7('0x52')]][_0xbee7('0x5d')]=0x0;utils[_0xbee7('0x0')](util[_0xbee7('0x1')](_0xbee7('0x5e'),_0x535072[_0xbee7('0x49')],queues[_0x535072['transfertargetuniqueid']]['name'],queues[_0x535072['transfertargetuniqueid']][_0xbee7('0x8')],queues[_0x535072[_0xbee7('0x52')]][_0xbee7('0x53')],queues[_0x535072[_0xbee7('0x52')]]['calleridname']));}else{utils[_0xbee7('0x0')](util[_0xbee7('0x1')](_0xbee7('0x57'),_0x535072['origtransfereruniqueid'],queues[_0x535072[_0xbee7('0x4a')]][_0xbee7('0x1a')],_0x535072[_0xbee7('0x4e')]));queues[_0x535072['secondtransfererlinkedid']][_0xbee7('0x8')]=_0x535072[_0xbee7('0x4e')];}}}}catch(_0x348ea7){utils[_0xbee7('0x10')](util[_0xbee7('0x1')](_0xbee7('0x48'),_0x535072[_0xbee7('0x49')]),_0x348ea7);}};exports[_0xbee7('0x5f')]=function(_0x346d81){try{if(!_[_0xbee7('0x12')](queues[_0x346d81[_0xbee7('0x9')]])){utils[_0xbee7('0x13')](util[_0xbee7('0x1')](_0xbee7('0x60'),_0x346d81[_0xbee7('0x9')]),_0x346d81);queues[_0x346d81['uniqueid']][_0xbee7('0x61')]=utils[_0xbee7('0xf')]();utils[_0xbee7('0x0')](util[_0xbee7('0x1')](_0xbee7('0x62'),_0x346d81[_0xbee7('0x9')],queues[_0x346d81[_0xbee7('0x9')]][_0xbee7('0x1a')],queues[_0x346d81[_0xbee7('0x9')]][_0xbee7('0x61')]));}}catch(_0x4e05f6){utils[_0xbee7('0x10')](util[_0xbee7('0x1')](_0xbee7('0x60'),_0x346d81[_0xbee7('0x9')]),_0x4e05f6);}};exports[_0xbee7('0x63')]=function(_0x2473ad){try{if(!_[_0xbee7('0x12')](queues[_0x2473ad['uniqueid']])){if(!_[_0xbee7('0x12')](queues[_0x2473ad['uniqueid']]['musiconholdstartAt'])){utils[_0xbee7('0x13')](util[_0xbee7('0x1')](_0xbee7('0x64'),_0x2473ad[_0xbee7('0x9')]),_0x2473ad);queues[_0x2473ad[_0xbee7('0x9')]][_0xbee7('0x5d')]+=utils[_0xbee7('0x31')](utils['now'](),queues[_0x2473ad[_0xbee7('0x9')]][_0xbee7('0x61')]);utils[_0xbee7('0x0')](util[_0xbee7('0x1')](_0xbee7('0x65'),_0x2473ad['uniqueid'],queues[_0x2473ad[_0xbee7('0x9')]][_0xbee7('0x1a')],queues[_0x2473ad[_0xbee7('0x9')]][_0xbee7('0x5d')]));delete queues[_0x2473ad[_0xbee7('0x9')]][_0xbee7('0x61')];}}}catch(_0x4a2854){utils[_0xbee7('0x10')](util[_0xbee7('0x1')](_0xbee7('0x64'),_0x2473ad[_0xbee7('0x9')]),_0x4a2854);}}; \ No newline at end of file +var _0xc1c6=['[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','connectedlinename','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','lastAssignedTo','agentcomplete','[%s][queues][agentcomplete]','assigned','queuecallercomplete','reason','transfer','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','ATTENDED','transferexten','origtransfererexten','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','musiconholdstart','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','accountcode','getVoiceQueueByName','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercompleteAt','queuecallerexitreason','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','now','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','name','[%s][queues][varset]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s'];(function(_0x3a60b8,_0x47caab){var _0x4eb583=function(_0x2251b5){while(--_0x2251b5){_0x3a60b8['push'](_0x3a60b8['shift']());}};_0x4eb583(++_0x47caab);}(_0xc1c6,0x1d9));var _0x6c1c=function(_0x59ecaa,_0x4b8005){_0x59ecaa=_0x59ecaa-0x0;var _0x3d82fc=_0xc1c6[_0x59ecaa];return _0x3d82fc;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var utils=require(_0x6c1c('0x2'));var queues={};function writeDB(_0x139b0c){utils['info'](util[_0x6c1c('0x3')](_0x6c1c('0x4'),_0x139b0c[_0x6c1c('0x5')],_0x139b0c[_0x6c1c('0x6')],_0x139b0c[_0x6c1c('0x7')],_0x139b0c['lastAssignedTo'],_0x139b0c['calleridnum'],_0x139b0c[_0x6c1c('0x8')],_0x139b0c['queuecallerexitreason']));if(_0x139b0c[_0x6c1c('0x7')]){utils[_0x6c1c('0x9')](_0x139b0c[_0x6c1c('0x7')])['then'](function(_0x198c06){if(_0x198c06){_0x139b0c[_0x6c1c('0xa')]=_0x198c06[_0x6c1c('0xa')];}utils['request'](_0x6c1c('0xb'),_0x139b0c);});}else{utils[_0x6c1c('0xc')](_0x6c1c('0xb'),_0x139b0c);}if(_0x139b0c[_0x6c1c('0xd')]){delete queues[_0x139b0c[_0x6c1c('0xd')]];}else{delete queues[_0x139b0c['uniqueid']];}}exports[_0x6c1c('0xe')]=function(_0x11f67d){try{utils[_0x6c1c('0xf')](util['format'](_0x6c1c('0x10'),_0x11f67d['uniqueid']),_0x11f67d);utils[_0x6c1c('0x11')](util[_0x6c1c('0x3')](_0x6c1c('0x12'),_0x11f67d[_0x6c1c('0x5')],_0x11f67d[_0x6c1c('0x7')],_0x11f67d[_0x6c1c('0x13')]));queues[_0x11f67d[_0x6c1c('0x5')]]=_[_0x6c1c('0x14')](_0x11f67d,{'originalposition':_0x11f67d['position'],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x376314){utils[_0x6c1c('0x15')](util[_0x6c1c('0x3')](_0x6c1c('0x10'),_0x11f67d['uniqueid']),_0x376314);}};exports[_0x6c1c('0x16')]=function(_0x2b22a8){try{if(!_[_0x6c1c('0x17')](queues[_0x2b22a8[_0x6c1c('0x5')]])){utils['debug'](util[_0x6c1c('0x3')](_0x6c1c('0x18'),_0x2b22a8['uniqueid']),_0x2b22a8);if(queues[_0x2b22a8[_0x6c1c('0x5')]][_0x6c1c('0x19')]){if(!queues[_0x2b22a8[_0x6c1c('0x5')]][_0x6c1c('0x1a')]&&!queues[_0x2b22a8[_0x6c1c('0x5')]][_0x6c1c('0x1b')]){queues[_0x2b22a8['uniqueid']]['queuecallercomplete']=!![];queues[_0x2b22a8[_0x6c1c('0x5')]][_0x6c1c('0x1c')]=utils['now']();queues[_0x2b22a8[_0x6c1c('0x5')]][_0x6c1c('0x1d')]='COMPLETEDBYAGENT';}utils[_0x6c1c('0x11')](util[_0x6c1c('0x3')](_0x6c1c('0x1e'),_0x2b22a8['uniqueid'],queues[_0x2b22a8[_0x6c1c('0x5')]]['name'],queues[_0x2b22a8['uniqueid']][_0x6c1c('0x1d')]));writeDB(queues[_0x2b22a8['uniqueid']]);}else if(queues[_0x2b22a8[_0x6c1c('0x5')]][_0x6c1c('0xd')]){utils['info'](util[_0x6c1c('0x3')](_0x6c1c('0x1f'),_0x2b22a8[_0x6c1c('0x5')],queues[_0x2b22a8[_0x6c1c('0x5')]]['name'],queues[_0x2b22a8[_0x6c1c('0x5')]][_0x6c1c('0xd')]));queues[queues[_0x2b22a8[_0x6c1c('0x5')]]['transfereduniqueid']]=queues[_0x2b22a8['uniqueid']];queues[queues[_0x2b22a8[_0x6c1c('0x5')]][_0x6c1c('0xd')]][_0x6c1c('0x20')]=0x2;delete queues[_0x2b22a8['uniqueid']];}}}catch(_0x29489d){utils[_0x6c1c('0x15')](util[_0x6c1c('0x3')](_0x6c1c('0x18'),_0x2b22a8[_0x6c1c('0x5')]),_0x29489d);}};exports[_0x6c1c('0x21')]=function(_0x2a1df6){try{utils[_0x6c1c('0xf')](util[_0x6c1c('0x3')]('[%s][queues][varset]',_0x2a1df6[_0x6c1c('0x5')]),_0x2a1df6);if(!_['isNil'](_0x2a1df6[_0x6c1c('0x22')][_0x6c1c('0x23')])&&_0x2a1df6[_0x6c1c('0x24')][_0x6c1c('0x25')]()!==_0x6c1c('0x26')){if(!_[_0x6c1c('0x17')](queues[_0x2a1df6[_0x6c1c('0x5')]])){queues[_0x2a1df6[_0x6c1c('0x5')]][_0x6c1c('0x1a')]=![];queues[_0x2a1df6['uniqueid']][_0x6c1c('0x27')]=null;queues[_0x2a1df6[_0x6c1c('0x5')]][_0x6c1c('0x1b')]=!![];queues[_0x2a1df6[_0x6c1c('0x5')]][_0x6c1c('0x28')]=utils[_0x6c1c('0x29')]();queues[_0x2a1df6['uniqueid']]['queuecallerexitreason']=_0x2a1df6[_0x6c1c('0x24')][_0x6c1c('0x25')]();utils['info'](util[_0x6c1c('0x3')](_0x6c1c('0x2a'),_0x2a1df6[_0x6c1c('0x5')],queues[_0x2a1df6[_0x6c1c('0x5')]][_0x6c1c('0x2b')],_0x2a1df6[_0x6c1c('0x24')],queues[_0x2a1df6['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x2a1df6['uniqueid']]);}}else if(!_['isNil'](_0x2a1df6[_0x6c1c('0x22')]['queueposition'])){if(!_[_0x6c1c('0x17')](queues[_0x2a1df6[_0x6c1c('0x5')]])&&!queues[_0x2a1df6[_0x6c1c('0x5')]]['queuecallerabandon']){queues[_0x2a1df6['uniqueid']]['queuecallerabandon']=![];queues[_0x2a1df6['uniqueid']][_0x6c1c('0x27')]=null;queues[_0x2a1df6[_0x6c1c('0x5')]][_0x6c1c('0x1b')]=!![];queues[_0x2a1df6[_0x6c1c('0x5')]][_0x6c1c('0x28')]=utils['now']();queues[_0x2a1df6[_0x6c1c('0x5')]]['queuecallerexitreason']='EXITWITHKEY';utils[_0x6c1c('0x11')](util[_0x6c1c('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x2a1df6['uniqueid'],queues[_0x2a1df6[_0x6c1c('0x5')]][_0x6c1c('0x2b')],_0x2a1df6[_0x6c1c('0x24')],queues[_0x2a1df6['uniqueid']][_0x6c1c('0x1d')]));}}}catch(_0x1c93f9){utils[_0x6c1c('0x15')](util[_0x6c1c('0x3')](_0x6c1c('0x2c'),_0x2a1df6[_0x6c1c('0x5')]),_0x1c93f9);}};exports['queuecallerabandon']=function(_0x51ffdd){try{if(!_[_0x6c1c('0x17')](queues[_0x51ffdd['uniqueid']])){utils[_0x6c1c('0xf')](util[_0x6c1c('0x3')]('[%s][queues][queuecallerabandon]',_0x51ffdd[_0x6c1c('0x5')]),_0x51ffdd);queues[_0x51ffdd['uniqueid']]['queuecallerexit']=![];queues[_0x51ffdd[_0x6c1c('0x5')]][_0x6c1c('0x28')]=null;queues[_0x51ffdd[_0x6c1c('0x5')]][_0x6c1c('0x1a')]=!![];queues[_0x51ffdd[_0x6c1c('0x5')]]['queuecallerabandonAt']=utils[_0x6c1c('0x29')]();queues[_0x51ffdd[_0x6c1c('0x5')]][_0x6c1c('0x1d')]=_0x6c1c('0x2d');utils[_0x6c1c('0x11')](util[_0x6c1c('0x3')](_0x6c1c('0x2e'),_0x51ffdd[_0x6c1c('0x5')],queues[_0x51ffdd[_0x6c1c('0x5')]][_0x6c1c('0x2b')],queues[_0x51ffdd[_0x6c1c('0x5')]]['queuecallerexitreason']));}}catch(_0x187e6f){utils[_0x6c1c('0x15')](util['format'](_0x6c1c('0x2f'),_0x51ffdd[_0x6c1c('0x5')]),_0x187e6f);}};exports[_0x6c1c('0x30')]=function(_0x248274){try{if(!_[_0x6c1c('0x17')](queues[_0x248274[_0x6c1c('0x5')]])){utils[_0x6c1c('0xf')](util[_0x6c1c('0x3')](_0x6c1c('0x31'),_0x248274[_0x6c1c('0x5')]),_0x248274);utils['info'](util[_0x6c1c('0x3')](_0x6c1c('0x32'),_0x248274[_0x6c1c('0x5')],queues[_0x248274[_0x6c1c('0x5')]][_0x6c1c('0x2b')],_0x248274['connectedlinenum'],_0x248274['connectedlinename']));queues[_0x248274[_0x6c1c('0x5')]][_0x6c1c('0x30')]=!![];queues[_0x248274[_0x6c1c('0x5')]][_0x6c1c('0x19')]=utils[_0x6c1c('0x29')]();queues[_0x248274['uniqueid']][_0x6c1c('0x33')]=utils[_0x6c1c('0x34')](queues[_0x248274[_0x6c1c('0x5')]][_0x6c1c('0x19')],queues[_0x248274[_0x6c1c('0x5')]][_0x6c1c('0x35')]);queues[_0x248274['uniqueid']][_0x6c1c('0x13')]=_0x248274[_0x6c1c('0x13')];queues[_0x248274[_0x6c1c('0x5')]][_0x6c1c('0x36')]=_0x248274[_0x6c1c('0x36')];queues[_0x248274[_0x6c1c('0x5')]][_0x6c1c('0x37')]=_0x248274[_0x6c1c('0x37')];queues[_0x248274[_0x6c1c('0x5')]][_0x6c1c('0x38')]=_0x248274['connectedlinename'];}}catch(_0x478851){utils[_0x6c1c('0x15')](util[_0x6c1c('0x3')]('[%s][queues][queuecallerleave]',_0x248274[_0x6c1c('0x5')]),_0x478851);}};exports[_0x6c1c('0x39')]=function(_0x4efd3d){try{if(!_[_0x6c1c('0x17')](queues[_0x4efd3d[_0x6c1c('0x5')]])){utils[_0x6c1c('0xf')](util[_0x6c1c('0x3')](_0x6c1c('0x3a'),_0x4efd3d['uniqueid']),_0x4efd3d);utils[_0x6c1c('0x11')](util[_0x6c1c('0x3')](_0x6c1c('0x3b'),_0x4efd3d[_0x6c1c('0x5')],queues[_0x4efd3d[_0x6c1c('0x5')]][_0x6c1c('0x2b')],_0x4efd3d[_0x6c1c('0x3c')],_0x4efd3d[_0x6c1c('0x3d')]));queues[_0x4efd3d[_0x6c1c('0x5')]][_0x6c1c('0x1a')]=![];queues[_0x4efd3d['uniqueid']][_0x6c1c('0x1a')]=![];queues[_0x4efd3d[_0x6c1c('0x5')]][_0x6c1c('0x27')]=null;queues[_0x4efd3d[_0x6c1c('0x5')]][_0x6c1c('0x1b')]=![];queues[_0x4efd3d['uniqueid']]['queuecallerexitreason']=null;queues[_0x4efd3d[_0x6c1c('0x5')]][_0x6c1c('0x28')]=null;queues[_0x4efd3d[_0x6c1c('0x5')]]['assigned']=!![];queues[_0x4efd3d[_0x6c1c('0x5')]][_0x6c1c('0x8')]=_0x4efd3d[_0x6c1c('0x3d')];queues[_0x4efd3d[_0x6c1c('0x5')]][_0x6c1c('0x3e')]=_0x4efd3d['membername'];}}catch(_0x36126e){utils[_0x6c1c('0x15')](util['format'](_0x6c1c('0x3a'),_0x4efd3d[_0x6c1c('0x5')]),_0x36126e);}};exports[_0x6c1c('0x3f')]=function(_0xb018f4){try{if(!_[_0x6c1c('0x17')](queues[_0xb018f4[_0x6c1c('0x5')]])){if(queues[_0xb018f4['uniqueid']][_0x6c1c('0x19')]){utils[_0x6c1c('0xf')](util[_0x6c1c('0x3')](_0x6c1c('0x40'),_0xb018f4[_0x6c1c('0x5')]),_0xb018f4);queues[_0xb018f4[_0x6c1c('0x5')]][_0x6c1c('0x1a')]=![];queues[_0xb018f4[_0x6c1c('0x5')]][_0x6c1c('0x1a')]=![];queues[_0xb018f4[_0x6c1c('0x5')]][_0x6c1c('0x27')]=null;queues[_0xb018f4[_0x6c1c('0x5')]][_0x6c1c('0x1b')]=![];queues[_0xb018f4[_0x6c1c('0x5')]][_0x6c1c('0x28')]=null;queues[_0xb018f4[_0x6c1c('0x5')]][_0x6c1c('0x41')]=!![];queues[_0xb018f4[_0x6c1c('0x5')]]['lastAssignedTo']=_0xb018f4[_0x6c1c('0x3c')];queues[_0xb018f4[_0x6c1c('0x5')]][_0x6c1c('0x42')]=!![];queues[_0xb018f4[_0x6c1c('0x5')]][_0x6c1c('0x1c')]=utils[_0x6c1c('0x29')]();if(_0xb018f4[_0x6c1c('0x43')]==_0x6c1c('0x44')){if(!queues[_0xb018f4[_0x6c1c('0x5')]][_0x6c1c('0x44')]){queues[_0xb018f4['uniqueid']][_0x6c1c('0x1d')]='TRANSFER';}}else{queues[_0xb018f4['uniqueid']]['queuecallerexitreason']='COMPLETEDBY'+_0xb018f4[_0x6c1c('0x43')][_0x6c1c('0x25')]();}utils[_0x6c1c('0x11')](util['format']('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0xb018f4[_0x6c1c('0x5')],queues[_0xb018f4[_0x6c1c('0x5')]][_0x6c1c('0x2b')],_0xb018f4['membername'],queues[_0xb018f4[_0x6c1c('0x5')]][_0x6c1c('0x1d')]));writeDB(queues[_0xb018f4['uniqueid']]);}}}catch(_0x51edad){utils[_0x6c1c('0x15')](util[_0x6c1c('0x3')](_0x6c1c('0x40'),_0xb018f4[_0x6c1c('0x5')]),_0x51edad);}};exports[_0x6c1c('0x45')]=function(_0x5e380f){try{if(!_[_0x6c1c('0x17')](queues[_0x5e380f[_0x6c1c('0x46')]])){utils[_0x6c1c('0xf')](util[_0x6c1c('0x3')](_0x6c1c('0x47'),_0x5e380f['uniqueid']),_0x5e380f);queues[_0x5e380f['transfereeuniqueid']][_0x6c1c('0x44')]=!![];queues[_0x5e380f[_0x6c1c('0x46')]][_0x6c1c('0x48')]=_0x6c1c('0x49');queues[_0x5e380f[_0x6c1c('0x46')]]['transferexten']=_0x5e380f[_0x6c1c('0x4a')];queues[_0x5e380f['transfereeuniqueid']][_0x6c1c('0x4b')]=_0x5e380f['transfereeuniqueid'];queues[_0x5e380f[_0x6c1c('0x46')]]['queuecallerexitreason']=_0x6c1c('0x4c');utils['info'](util['format'](_0x6c1c('0x4d'),_0x5e380f[_0x6c1c('0x5')],queues[_0x5e380f[_0x6c1c('0x46')]][_0x6c1c('0x2b')],_0x5e380f['transfereeuniqueid'],_0x5e380f[_0x6c1c('0x4a')]));}}catch(_0x3446ab){utils[_0x6c1c('0x15')](util[_0x6c1c('0x3')](_0x6c1c('0x47'),_0x5e380f[_0x6c1c('0x5')]),_0x3446ab);}};exports[_0x6c1c('0x4e')]=function(_0x1134dd){try{utils[_0x6c1c('0xf')](util[_0x6c1c('0x3')](_0x6c1c('0x4f'),_0x1134dd[_0x6c1c('0x50')]),_0x1134dd);if(_0x1134dd['origtransfereruniqueid']==_0x1134dd['origtransfererlinkedid']){if(!_[_0x6c1c('0x17')](queues[_0x1134dd[_0x6c1c('0x51')]])){utils['info'](util['format'](_0x6c1c('0x52'),_0x1134dd[_0x6c1c('0x50')],queues[_0x1134dd[_0x6c1c('0x51')]][_0x6c1c('0x2b')],_0x1134dd['origtransfererexten']));queues[_0x1134dd[_0x6c1c('0x51')]][_0x6c1c('0x44')]=!![];queues[_0x1134dd[_0x6c1c('0x51')]][_0x6c1c('0x48')]=_0x6c1c('0x53');queues[_0x1134dd[_0x6c1c('0x51')]][_0x6c1c('0x54')]=_0x1134dd[_0x6c1c('0x55')];queues[_0x1134dd[_0x6c1c('0x51')]][_0x6c1c('0x4b')]=_0x1134dd['origtransfereruniqueid'];queues[_0x1134dd[_0x6c1c('0x51')]]['queuecallerexitreason']=_0x6c1c('0x56');}if(!_[_0x6c1c('0x17')](queues[_0x1134dd[_0x6c1c('0x57')]])){if(_0x1134dd[_0x6c1c('0x58')]&&queues[_0x1134dd[_0x6c1c('0x58')]]){queues[_0x1134dd[_0x6c1c('0x58')]][_0x6c1c('0x20')]=0x1;queues[_0x1134dd[_0x6c1c('0x46')]]=_[_0x6c1c('0x59')](queues[_0x1134dd[_0x6c1c('0x58')]]);queues[_0x1134dd['transfereeuniqueid']][_0x6c1c('0xd')]=_0x1134dd[_0x6c1c('0x5a')];queues[_0x1134dd[_0x6c1c('0x46')]][_0x6c1c('0x20')]=0x2;queues[_0x1134dd[_0x6c1c('0x46')]][_0x6c1c('0x5b')]=queues[_0x1134dd[_0x6c1c('0x51')]]['calleridnum'];queues[_0x1134dd[_0x6c1c('0x46')]][_0x6c1c('0x5c')]=queues[_0x1134dd[_0x6c1c('0x51')]][_0x6c1c('0x5c')];queues[_0x1134dd[_0x6c1c('0x46')]][_0x6c1c('0x35')]=utils[_0x6c1c('0x29')]();queues[_0x1134dd['transfereeuniqueid']][_0x6c1c('0x19')]=utils['now']();queues[_0x1134dd[_0x6c1c('0x46')]][_0x6c1c('0x33')]=0x0;queues[_0x1134dd['transfereeuniqueid']][_0x6c1c('0x5d')]=0x0;utils['info'](util[_0x6c1c('0x3')](_0x6c1c('0x5e'),_0x1134dd[_0x6c1c('0x50')],queues[_0x1134dd[_0x6c1c('0x46')]][_0x6c1c('0x2b')],queues[_0x1134dd[_0x6c1c('0x46')]]['calleridnum'],queues[_0x1134dd['transfereeuniqueid']][_0x6c1c('0x5c')]));}else{utils[_0x6c1c('0x11')](util[_0x6c1c('0x3')](_0x6c1c('0x5f'),_0x1134dd[_0x6c1c('0x50')],queues[_0x1134dd[_0x6c1c('0x57')]][_0x6c1c('0x2b')],_0x1134dd[_0x6c1c('0x51')]));queues[_0x1134dd[_0x6c1c('0x57')]][_0x6c1c('0xd')]=_0x1134dd['secondtransfererlinkedid'];}}}else if(_0x1134dd[_0x6c1c('0x60')]==_0x1134dd['secondtransfererlinkedid']){if(!_[_0x6c1c('0x17')](queues[_0x1134dd[_0x6c1c('0x57')]])){utils[_0x6c1c('0x11')](util[_0x6c1c('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x1134dd['origtransfereruniqueid'],queues[_0x1134dd['origtransfererlinkedid']][_0x6c1c('0x2b')],_0x1134dd[_0x6c1c('0x60')],_0x1134dd[_0x6c1c('0x61')]));queues[_0x1134dd[_0x6c1c('0x57')]][_0x6c1c('0x44')]=!![];queues[_0x1134dd[_0x6c1c('0x57')]][_0x6c1c('0x48')]='ATTENDED';queues[_0x1134dd[_0x6c1c('0x57')]][_0x6c1c('0x54')]=_0x1134dd[_0x6c1c('0x61')];queues[_0x1134dd[_0x6c1c('0x57')]]['transferuniqueid']=_0x1134dd[_0x6c1c('0x60')];queues[_0x1134dd[_0x6c1c('0x57')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_[_0x6c1c('0x17')](queues[_0x1134dd['secondtransfererlinkedid']])){if(_0x1134dd[_0x6c1c('0x62')]&&queues[_0x1134dd['transfertargetlinkedid']]){queues[_0x1134dd[_0x6c1c('0x62')]][_0x6c1c('0x20')]=0x1;queues[_0x1134dd[_0x6c1c('0x5a')]]=_[_0x6c1c('0x59')](queues[_0x1134dd['transfertargetlinkedid']]);queues[_0x1134dd[_0x6c1c('0x5a')]][_0x6c1c('0xd')]=_0x1134dd[_0x6c1c('0x5a')];queues[_0x1134dd[_0x6c1c('0x5a')]]['queuecallerenterreason']=0x2;queues[_0x1134dd[_0x6c1c('0x5a')]]['calleridnum']=queues[_0x1134dd[_0x6c1c('0x57')]]['calleridnum'];queues[_0x1134dd[_0x6c1c('0x5a')]][_0x6c1c('0x5c')]=queues[_0x1134dd[_0x6c1c('0x57')]][_0x6c1c('0x5c')];queues[_0x1134dd[_0x6c1c('0x5a')]][_0x6c1c('0x35')]=utils[_0x6c1c('0x29')]();queues[_0x1134dd[_0x6c1c('0x5a')]][_0x6c1c('0x19')]=utils[_0x6c1c('0x29')]();queues[_0x1134dd[_0x6c1c('0x5a')]][_0x6c1c('0x33')]=0x0;queues[_0x1134dd[_0x6c1c('0x5a')]][_0x6c1c('0x5d')]=0x0;utils['info'](util[_0x6c1c('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x1134dd[_0x6c1c('0x50')],queues[_0x1134dd[_0x6c1c('0x5a')]][_0x6c1c('0x2b')],queues[_0x1134dd['transfertargetuniqueid']][_0x6c1c('0xd')],queues[_0x1134dd['transfertargetuniqueid']]['calleridnum'],queues[_0x1134dd[_0x6c1c('0x5a')]][_0x6c1c('0x5c')]));}else{utils[_0x6c1c('0x11')](util[_0x6c1c('0x3')](_0x6c1c('0x5f'),_0x1134dd[_0x6c1c('0x50')],queues[_0x1134dd[_0x6c1c('0x51')]][_0x6c1c('0x2b')],_0x1134dd[_0x6c1c('0x57')]));queues[_0x1134dd[_0x6c1c('0x51')]]['transfereduniqueid']=_0x1134dd['origtransfererlinkedid'];}}}}catch(_0x3b4a4b){utils['error'](util[_0x6c1c('0x3')]('[%s][queues][attendedtransfer]',_0x1134dd[_0x6c1c('0x50')]),_0x3b4a4b);}};exports[_0x6c1c('0x63')]=function(_0x1a3269){try{if(!_[_0x6c1c('0x17')](queues[_0x1a3269[_0x6c1c('0x5')]])){utils[_0x6c1c('0xf')](util[_0x6c1c('0x3')]('[%s][queues][musiconholdstart]',_0x1a3269['uniqueid']),_0x1a3269);queues[_0x1a3269[_0x6c1c('0x5')]][_0x6c1c('0x64')]=utils['now']();utils[_0x6c1c('0x11')](util[_0x6c1c('0x3')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x1a3269[_0x6c1c('0x5')],queues[_0x1a3269[_0x6c1c('0x5')]][_0x6c1c('0x2b')],queues[_0x1a3269[_0x6c1c('0x5')]][_0x6c1c('0x64')]));}}catch(_0x4e0cf2){utils[_0x6c1c('0x15')](util[_0x6c1c('0x3')]('[%s][queues][musiconholdstart]',_0x1a3269[_0x6c1c('0x5')]),_0x4e0cf2);}};exports[_0x6c1c('0x65')]=function(_0x4e9165){try{if(!_[_0x6c1c('0x17')](queues[_0x4e9165[_0x6c1c('0x5')]])){if(!_['isNil'](queues[_0x4e9165[_0x6c1c('0x5')]][_0x6c1c('0x64')])){utils[_0x6c1c('0xf')](util[_0x6c1c('0x3')](_0x6c1c('0x66'),_0x4e9165[_0x6c1c('0x5')]),_0x4e9165);queues[_0x4e9165['uniqueid']][_0x6c1c('0x5d')]+=utils['diffTime'](utils[_0x6c1c('0x29')](),queues[_0x4e9165[_0x6c1c('0x5')]]['musiconholdstartAt']);utils[_0x6c1c('0x11')](util['format'](_0x6c1c('0x67'),_0x4e9165[_0x6c1c('0x5')],queues[_0x4e9165['uniqueid']][_0x6c1c('0x2b')],queues[_0x4e9165['uniqueid']][_0x6c1c('0x5d')]));delete queues[_0x4e9165[_0x6c1c('0x5')]][_0x6c1c('0x64')];}}}catch(_0x102564){utils[_0x6c1c('0x15')](util[_0x6c1c('0x3')]('[%s][queues][musiconholdstop]',_0x4e9165['uniqueid']),_0x102564);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 4456bc9..e81481a 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 _0x4860=['.wav49','replace','.WAV','find','monitors','hangup','calleridname','calleridnum','connectedlinenum','connectedlinename','type','forEach','clone','[%s][recordings][hangup]','application','appdata','toLowerCase','set','startsWith','cdr','split','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','blindtransfer','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','lodash','./utils','info','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','format','[%s][recordings][newchannel]','linkedid','context','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x4860,0x13f));var _0x0486=function(_0x50e0c3,_0x11cc61){_0x50e0c3=_0x50e0c3-0x0;var _0x267d49=_0x4860[_0x50e0c3];return _0x267d49;};'use strict';var _=require(_0x0486('0x0'));var util=require('util');var utils=require(_0x0486('0x1'));var transfers=require('./transfers.controller');var recordings={};function writeDB(_0x25fe7c){var _0x221662;utils[_0x0486('0x2')](util['format'](_0x0486('0x3'),_0x25fe7c[_0x0486('0x4')]));if(transfers[_0x0486('0x5')][_0x25fe7c[_0x0486('0x4')]]){_0x221662=_0x25fe7c[_0x0486('0x4')];_0x25fe7c[_0x0486('0x4')]=transfers[_0x0486('0x5')][_0x25fe7c[_0x0486('0x4')]][_0x0486('0x6')];}if(_0x25fe7c[_0x0486('0x7')]){utils[_0x0486('0x8')](_0x25fe7c[_0x0486('0x7')])[_0x0486('0x9')](function(_0x1efed1){if(_0x1efed1){_0x25fe7c[_0x0486('0xa')]=_0x1efed1[_0x0486('0xb')];_0x25fe7c[_0x0486('0xc')]=_0x1efed1['id'];}utils[_0x0486('0xd')](_0x0486('0xe'),_0x25fe7c);});}else{utils[_0x0486('0xd')](_0x0486('0xe'),_0x25fe7c);}if(_0x221662)delete transfers[_0x0486('0x5')][_0x221662];}exports[_0x0486('0xf')]=function(_0x4749fd){try{utils[_0x0486('0x10')](util[_0x0486('0x11')](_0x0486('0x12'),_0x4749fd[_0x0486('0x4')]),_0x4749fd);if(_0x4749fd[_0x0486('0x4')]==_0x4749fd[_0x0486('0x13')]){utils['info'](util['format']('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x4749fd[_0x0486('0x4')],_0x4749fd[_0x0486('0x14')],_0x4749fd['exten']));recordings[_0x4749fd[_0x0486('0x4')]]={'uniqueid':_0x4749fd['uniqueid'],'accountcode':_0x4749fd[_0x0486('0x7')],'exten':_0x4749fd['exten'],'context':_0x4749fd[_0x0486('0x14')],'channel':_0x4749fd[_0x0486('0x15')],'monitors':[]};}}catch(_0x3d21cc){utils[_0x0486('0x16')](util[_0x0486('0x11')](_0x0486('0x12'),_0x4749fd[_0x0486('0x4')]),_0x3d21cc);}};exports[_0x0486('0x17')]=function(_0x1bf8e4){try{utils[_0x0486('0x10')](util[_0x0486('0x11')](_0x0486('0x18'),_0x1bf8e4[_0x0486('0x4')]),_0x1bf8e4);if(!_[_0x0486('0x19')](recordings[_0x1bf8e4[_0x0486('0x4')]])&&_0x1bf8e4[_0x0486('0x1a')]==0x6){utils[_0x0486('0x2')](util[_0x0486('0x11')](_0x0486('0x1b'),_0x1bf8e4['uniqueid'],_0x1bf8e4[_0x0486('0x14')],_0x1bf8e4[_0x0486('0x15')]));}else if(!_[_0x0486('0x19')](recordings[_0x1bf8e4['linkedid']])&&_0x1bf8e4[_0x0486('0x1a')]==0x6&&_0x1bf8e4[_0x0486('0x14')]!=_0x0486('0x1c')){utils[_0x0486('0x2')](util[_0x0486('0x11')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x1bf8e4[_0x0486('0x4')],_0x1bf8e4['linkedid'],_0x1bf8e4[_0x0486('0x14')],_0x1bf8e4[_0x0486('0x15')]));recordings[_0x1bf8e4[_0x0486('0x13')]][_0x0486('0x7')]=_0x1bf8e4[_0x0486('0x7')];}}catch(_0xa9dc0a){utils[_0x0486('0x16')](util['format'](_0x0486('0x18'),_0x1bf8e4[_0x0486('0x4')]),_0xa9dc0a);}};exports[_0x0486('0x1d')]=function(_0x5ead3f){try{if(!_['isNil'](_0x5ead3f['variable'])&&!_[_0x0486('0x19')](_0x5ead3f[_0x0486('0x1e')][_0x0486('0x1f')])){utils[_0x0486('0x10')](util[_0x0486('0x11')](_0x0486('0x20'),_0x5ead3f[_0x0486('0x4')]),_0x5ead3f);utils['info'](util[_0x0486('0x11')](_0x0486('0x21'),_0x5ead3f[_0x0486('0x4')],_0x5ead3f[_0x0486('0x1e')],_0x5ead3f[_0x0486('0x22')]));if(_[_0x0486('0x23')](_0x5ead3f[_0x0486('0x22')],_0x0486('0x24'))){_0x5ead3f[_0x0486('0x22')]=_0x5ead3f['value'][_0x0486('0x25')](_0x0486('0x24'),_0x0486('0x26'));}if(recordings[_0x5ead3f[_0x0486('0x13')]]){var _0x4849f8=_[_0x0486('0x27')](recordings[_0x5ead3f[_0x0486('0x13')]][_0x0486('0x28')],{'value':_0x5ead3f[_0x0486('0x22')]});if(_['isNil'](_0x4849f8)){recordings[_0x5ead3f[_0x0486('0x13')]][_0x0486('0x28')]['push']({'value':_0x5ead3f[_0x0486('0x22')]});}}}}catch(_0x364385){utils[_0x0486('0x16')](util['format'](_0x0486('0x20'),_0x5ead3f[_0x0486('0x4')]),_0x364385);}};exports[_0x0486('0x29')]=function(_0x2435c1){try{if(!_[_0x0486('0x19')](recordings[_0x2435c1[_0x0486('0x4')]])){utils[_0x0486('0x10')](util['format']('[%s][recordings][hangup]',_0x2435c1[_0x0486('0x4')]),_0x2435c1);utils[_0x0486('0x2')](util[_0x0486('0x11')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x2435c1['uniqueid'],_0x2435c1['calleridnum'],_0x2435c1[_0x0486('0x2a')],_0x2435c1['cause-txt']));recordings[_0x2435c1[_0x0486('0x4')]][_0x0486('0x2b')]=_0x2435c1[_0x0486('0x2b')];recordings[_0x2435c1[_0x0486('0x4')]]['calleridname']=_0x2435c1[_0x0486('0x2a')];recordings[_0x2435c1[_0x0486('0x4')]][_0x0486('0x2c')]=_0x2435c1[_0x0486('0x2c')];recordings[_0x2435c1[_0x0486('0x4')]][_0x0486('0x2d')]=_0x2435c1[_0x0486('0x2d')];if(recordings[_0x2435c1['uniqueid']][_0x0486('0x2e')]=='outbound'&&recordings[_0x2435c1['uniqueid']]['accountcode']){recordings[_0x2435c1[_0x0486('0x4')]][_0x0486('0x2c')]=recordings[_0x2435c1[_0x0486('0x4')]][_0x0486('0x7')];recordings[_0x2435c1[_0x0486('0x4')]][_0x0486('0x2d')]='';}recordings[_0x2435c1[_0x0486('0x4')]]['monitors'][_0x0486('0x2f')](function(_0x379fa6){var _0x543af0=_[_0x0486('0x30')](recordings[_0x2435c1['uniqueid']]);_0x543af0['value']=_0x379fa6['value'];writeDB(_0x543af0);});delete recordings[_0x2435c1[_0x0486('0x4')]];}}catch(_0x1ca7c2){utils[_0x0486('0x16')](util[_0x0486('0x11')](_0x0486('0x31'),_0x2435c1[_0x0486('0x4')]),_0x1ca7c2);}};exports['newexten']=function(_0x3c6543){try{if(!_[_0x0486('0x19')](recordings[_0x3c6543['uniqueid']])){utils[_0x0486('0x10')](util[_0x0486('0x11')]('[%s][recordings][newexten]',_0x3c6543[_0x0486('0x4')]),_0x3c6543);utils[_0x0486('0x2')](util[_0x0486('0x11')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x3c6543[_0x0486('0x4')],_0x3c6543[_0x0486('0x32')],_0x3c6543[_0x0486('0x33')]));if(_0x3c6543[_0x0486('0x32')][_0x0486('0x34')]()==_0x0486('0x35')&&_[_0x0486('0x36')](_0x3c6543[_0x0486('0x33')][_0x0486('0x34')](),_0x0486('0x37'))){var _0x51908b=_0x3c6543[_0x0486('0x33')][_0x0486('0x38')]('=');var _0x13dbfa=_0x51908b[0x0]['substring'](_0x51908b[0x0][_0x0486('0x39')]('(')+0x1,_0x51908b[0x0][_0x0486('0x39')](')'));var _0xd4a2eb=_0x51908b[0x1];recordings[_0x3c6543[_0x0486('0x4')]][_0x13dbfa]=_0xd4a2eb;}}}catch(_0xa59d98){utils[_0x0486('0x16')](util['format'](_0x0486('0x3a'),_0x3c6543[_0x0486('0x4')]),_0xa59d98);}};exports[_0x0486('0x3b')]=function(_0x16e958){try{if(!_['isNil'](recordings[_0x16e958[_0x0486('0x4')]])){utils[_0x0486('0x10')](util[_0x0486('0x11')]('[%s][recordings][queuecallerjoin]',_0x16e958['uniqueid']),_0x16e958);utils[_0x0486('0x2')](util['format'](_0x0486('0x3c'),_0x16e958[_0x0486('0x4')],_0x16e958[_0x0486('0x3d')]));recordings[_0x16e958[_0x0486('0x4')]]['queue']=_0x16e958[_0x0486('0x3d')];}}catch(_0xac3424){utils['error'](util[_0x0486('0x11')](_0x0486('0x3e'),_0x16e958['uniqueid']),_0xac3424);}};exports[_0x0486('0x3f')]=function(_0x44c9f4){try{utils[_0x0486('0x10')](util[_0x0486('0x11')]('[%s][recordings][blindtransfer]',_0x44c9f4[_0x0486('0x4')]),_0x44c9f4);utils['info'](util['format'](_0x0486('0x40'),_0x44c9f4[_0x0486('0x4')],_0x44c9f4[_0x0486('0x41')],_0x44c9f4[_0x0486('0x42')],_0x44c9f4[_0x0486('0x43')],_0x44c9f4[_0x0486('0x44')]));if(recordings[_0x44c9f4[_0x0486('0x45')]]&&transfers['blinds'][_0x44c9f4[_0x0486('0x45')]]){transfers[_0x0486('0x5')][_0x44c9f4['transfereruniqueid']][_0x0486('0x46')]=!![];}}catch(_0x52e742){utils[_0x0486('0x16')](util[_0x0486('0x11')]('[%s][recordings][blindtransfer]',_0x44c9f4['uniqueid']),_0x52e742);}}; \ No newline at end of file +var _0x846f=['lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','transferercalleridnum','transferercalleridname','transfereecalleridname','transfereruniqueid','recording','[%s][recordings][blindtransfer]','lodash','util','./utils','info','format','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','membername','name','UserId','request','CreateVoiceRecording','debug','[%s][recordings][newchannel]','linkedid','context','exten','channel','error','newstate','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','monitors','push','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','split','substring'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x846f,0x163));var _0xf846=function(_0x603b18,_0x587375){_0x603b18=_0x603b18-0x0;var _0x22854e=_0x846f[_0x603b18];return _0x22854e;};'use strict';var _=require(_0xf846('0x0'));var util=require(_0xf846('0x1'));var utils=require(_0xf846('0x2'));var transfers=require('./transfers.controller');var recordings={};function writeDB(_0x55bddc){var _0xc92be1;utils[_0xf846('0x3')](util[_0xf846('0x4')]('[%s][recordings][writeDB]',_0x55bddc[_0xf846('0x5')]));if(transfers[_0xf846('0x6')][_0x55bddc['uniqueid']]){_0xc92be1=_0x55bddc[_0xf846('0x5')];_0x55bddc[_0xf846('0x5')]=transfers['blinds'][_0x55bddc[_0xf846('0x5')]][_0xf846('0x7')];}if(_0x55bddc[_0xf846('0x8')]){utils[_0xf846('0x9')](_0x55bddc['accountcode'])['then'](function(_0xb45ec8){if(_0xb45ec8){_0x55bddc[_0xf846('0xa')]=_0xb45ec8[_0xf846('0xb')];_0x55bddc[_0xf846('0xc')]=_0xb45ec8['id'];}utils[_0xf846('0xd')](_0xf846('0xe'),_0x55bddc);});}else{utils[_0xf846('0xd')](_0xf846('0xe'),_0x55bddc);}if(_0xc92be1)delete transfers[_0xf846('0x6')][_0xc92be1];}exports['newchannel']=function(_0x296fc0){try{utils[_0xf846('0xf')](util['format'](_0xf846('0x10'),_0x296fc0['uniqueid']),_0x296fc0);if(_0x296fc0[_0xf846('0x5')]==_0x296fc0[_0xf846('0x11')]){utils['info'](util[_0xf846('0x4')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x296fc0['uniqueid'],_0x296fc0[_0xf846('0x12')],_0x296fc0[_0xf846('0x13')]));recordings[_0x296fc0[_0xf846('0x5')]]={'uniqueid':_0x296fc0['uniqueid'],'accountcode':_0x296fc0[_0xf846('0x8')],'exten':_0x296fc0[_0xf846('0x13')],'context':_0x296fc0['context'],'channel':_0x296fc0[_0xf846('0x14')],'monitors':[]};}}catch(_0x594a44){utils[_0xf846('0x15')](util[_0xf846('0x4')](_0xf846('0x10'),_0x296fc0[_0xf846('0x5')]),_0x594a44);}};exports[_0xf846('0x16')]=function(_0x562aae){try{utils[_0xf846('0xf')](util[_0xf846('0x4')]('[%s][recordings][newstate]',_0x562aae[_0xf846('0x5')]),_0x562aae);if(!_[_0xf846('0x17')](recordings[_0x562aae[_0xf846('0x5')]])&&_0x562aae['channelstate']==0x6){utils['info'](util['format'](_0xf846('0x18'),_0x562aae[_0xf846('0x5')],_0x562aae['context'],_0x562aae['channel']));}else if(!_[_0xf846('0x17')](recordings[_0x562aae['linkedid']])&&_0x562aae[_0xf846('0x19')]==0x6&&_0x562aae[_0xf846('0x12')]!=_0xf846('0x1a')){utils[_0xf846('0x3')](util['format'](_0xf846('0x1b'),_0x562aae[_0xf846('0x5')],_0x562aae['linkedid'],_0x562aae[_0xf846('0x12')],_0x562aae[_0xf846('0x14')]));recordings[_0x562aae[_0xf846('0x11')]][_0xf846('0x8')]=_0x562aae[_0xf846('0x8')];}}catch(_0x50de36){utils[_0xf846('0x15')](util['format']('[%s][recordings][newstate]',_0x562aae[_0xf846('0x5')]),_0x50de36);}};exports['varset']=function(_0x54b46f){try{if(!_[_0xf846('0x17')](_0x54b46f[_0xf846('0x1c')])&&!_[_0xf846('0x17')](_0x54b46f['variable'][_0xf846('0x1d')])){utils['debug'](util[_0xf846('0x4')](_0xf846('0x1e'),_0x54b46f[_0xf846('0x5')]),_0x54b46f);utils[_0xf846('0x3')](util[_0xf846('0x4')](_0xf846('0x1f'),_0x54b46f[_0xf846('0x5')],_0x54b46f[_0xf846('0x1c')],_0x54b46f[_0xf846('0x20')]));if(_[_0xf846('0x21')](_0x54b46f['value'],_0xf846('0x22'))){_0x54b46f[_0xf846('0x20')]=_0x54b46f[_0xf846('0x20')][_0xf846('0x23')](_0xf846('0x22'),'.WAV');}if(recordings[_0x54b46f['linkedid']]){var _0x1a8983=_['find'](recordings[_0x54b46f['linkedid']]['monitors'],{'value':_0x54b46f[_0xf846('0x20')]});if(_['isNil'](_0x1a8983)){recordings[_0x54b46f[_0xf846('0x11')]][_0xf846('0x24')][_0xf846('0x25')]({'value':_0x54b46f[_0xf846('0x20')]});}}}}catch(_0x2273ba){utils[_0xf846('0x15')](util[_0xf846('0x4')]('[%s][recordings][varset]',_0x54b46f[_0xf846('0x5')]),_0x2273ba);}};exports['hangup']=function(_0x29d154){try{if(!_[_0xf846('0x17')](recordings[_0x29d154[_0xf846('0x5')]])){utils[_0xf846('0xf')](util[_0xf846('0x4')]('[%s][recordings][hangup]',_0x29d154[_0xf846('0x5')]),_0x29d154);utils[_0xf846('0x3')](util['format'](_0xf846('0x26'),_0x29d154[_0xf846('0x5')],_0x29d154[_0xf846('0x27')],_0x29d154['calleridname'],_0x29d154[_0xf846('0x28')]));recordings[_0x29d154[_0xf846('0x5')]][_0xf846('0x27')]=_0x29d154[_0xf846('0x27')];recordings[_0x29d154[_0xf846('0x5')]][_0xf846('0x29')]=_0x29d154[_0xf846('0x29')];recordings[_0x29d154[_0xf846('0x5')]][_0xf846('0x2a')]=_0x29d154[_0xf846('0x2a')];recordings[_0x29d154[_0xf846('0x5')]]['connectedlinename']=_0x29d154[_0xf846('0x2b')];if(recordings[_0x29d154[_0xf846('0x5')]][_0xf846('0x2c')]==_0xf846('0x2d')&&recordings[_0x29d154[_0xf846('0x5')]][_0xf846('0x8')]){recordings[_0x29d154[_0xf846('0x5')]]['connectedlinenum']=recordings[_0x29d154[_0xf846('0x5')]]['accountcode'];recordings[_0x29d154['uniqueid']][_0xf846('0x2b')]='';}recordings[_0x29d154['uniqueid']][_0xf846('0x24')][_0xf846('0x2e')](function(_0x566401){var _0x4b7a9a=_[_0xf846('0x2f')](recordings[_0x29d154['uniqueid']]);_0x4b7a9a['value']=_0x566401[_0xf846('0x20')];writeDB(_0x4b7a9a);});delete recordings[_0x29d154[_0xf846('0x5')]];}}catch(_0x1ebd70){utils[_0xf846('0x15')](util[_0xf846('0x4')](_0xf846('0x30'),_0x29d154[_0xf846('0x5')]),_0x1ebd70);}};exports[_0xf846('0x31')]=function(_0x5dd164){try{if(!_['isNil'](recordings[_0x5dd164['uniqueid']])){utils[_0xf846('0xf')](util[_0xf846('0x4')](_0xf846('0x32'),_0x5dd164['uniqueid']),_0x5dd164);utils[_0xf846('0x3')](util[_0xf846('0x4')](_0xf846('0x33'),_0x5dd164[_0xf846('0x5')],_0x5dd164[_0xf846('0x34')],_0x5dd164['appdata']));if(_0x5dd164[_0xf846('0x34')][_0xf846('0x35')]()==_0xf846('0x36')&&_[_0xf846('0x37')](_0x5dd164[_0xf846('0x38')][_0xf846('0x35')](),'cdr')){var _0x3a3fcb=_0x5dd164[_0xf846('0x38')][_0xf846('0x39')]('=');var _0x47ce53=_0x3a3fcb[0x0][_0xf846('0x3a')](_0x3a3fcb[0x0][_0xf846('0x3b')]('(')+0x1,_0x3a3fcb[0x0][_0xf846('0x3b')](')'));var _0x3af8fc=_0x3a3fcb[0x1];recordings[_0x5dd164[_0xf846('0x5')]][_0x47ce53]=_0x3af8fc;}}}catch(_0x28778c){utils['error'](util[_0xf846('0x4')](_0xf846('0x32'),_0x5dd164[_0xf846('0x5')]),_0x28778c);}};exports['queuecallerjoin']=function(_0x1c1b2e){try{if(!_['isNil'](recordings[_0x1c1b2e[_0xf846('0x5')]])){utils['debug'](util['format'](_0xf846('0x3c'),_0x1c1b2e['uniqueid']),_0x1c1b2e);utils[_0xf846('0x3')](util[_0xf846('0x4')](_0xf846('0x3d'),_0x1c1b2e[_0xf846('0x5')],_0x1c1b2e[_0xf846('0x3e')]));recordings[_0x1c1b2e[_0xf846('0x5')]][_0xf846('0x3e')]=_0x1c1b2e['queue'];}}catch(_0x360fe1){utils[_0xf846('0x15')](util['format'](_0xf846('0x3c'),_0x1c1b2e[_0xf846('0x5')]),_0x360fe1);}};exports['blindtransfer']=function(_0x17251c){try{utils['debug'](util['format']('[%s][recordings][blindtransfer]',_0x17251c[_0xf846('0x5')]),_0x17251c);utils[_0xf846('0x3')](util[_0xf846('0x4')]('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x17251c[_0xf846('0x5')],_0x17251c[_0xf846('0x3f')],_0x17251c[_0xf846('0x40')],_0x17251c['transfereecalleridnum'],_0x17251c[_0xf846('0x41')]));if(recordings[_0x17251c[_0xf846('0x42')]]&&transfers[_0xf846('0x6')][_0x17251c[_0xf846('0x42')]]){transfers[_0xf846('0x6')][_0x17251c['transfereruniqueid']][_0xf846('0x43')]=!![];}}catch(_0x4e3f42){utils[_0xf846('0x15')](util[_0xf846('0x4')](_0xf846('0x44'),_0x17251c[_0xf846('0x5')]),_0x4e3f42);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index a4f3996..caad75b 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 _0x2399=['secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransfererexten','transfereechannel','assign','transfertargetchannel','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','[%s][transfers][attendedtransfer]','./utils','info','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','format','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','transfertargetcalleridnum','transfertargetcalleridname','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum'];(function(_0x529718,_0x288fa4){var _0x389265=function(_0x3eddc7){while(--_0x3eddc7){_0x529718['push'](_0x529718['shift']());}};_0x389265(++_0x288fa4);}(_0x2399,0x175));var _0x9239=function(_0x200608,_0x2d64c6){_0x200608=_0x200608-0x0;var _0x5a5772=_0x2399[_0x200608];return _0x5a5772;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x9239('0x0'));function writeDB(_0x24f9c9){utils[_0x9239('0x1')](util['format'](_0x9239('0x2'),_0x24f9c9[_0x9239('0x3')]===_0x9239('0x4')?_0x24f9c9[_0x9239('0x5')]:_0x24f9c9[_0x9239('0x6')],_0x24f9c9[_0x9239('0x3')]));utils[_0x9239('0x7')]('CreateVoiceTransferReport',_0x24f9c9);}exports[_0x9239('0x8')]={};exports[_0x9239('0x9')]=function(_0x4a2f79){try{utils[_0x9239('0xa')](util['format'](_0x9239('0xb'),_0x4a2f79[_0x9239('0x6')]),_0x4a2f79);utils[_0x9239('0x1')](util[_0x9239('0xc')](_0x9239('0xd'),_0x4a2f79[_0x9239('0x6')],_0x4a2f79[_0x9239('0xe')],_0x4a2f79[_0x9239('0xf')],_0x4a2f79[_0x9239('0x10')],_0x4a2f79['transfereecalleridname']));_0x4a2f79[_0x9239('0x3')]='blind';exports[_0x9239('0x8')][_0x4a2f79[_0x9239('0x11')]]=_0x4a2f79;writeDB(_0x4a2f79);}catch(_0x44f35d){utils[_0x9239('0x12')](util[_0x9239('0xc')]('[%s][transfers][blindtransfer]',_0x4a2f79[_0x9239('0x6')]),_0x44f35d);}};exports[_0x9239('0x13')]=function(_0x54d859){try{utils['debug'](util['format']('[%s][transfers][attendedtransfer]',_0x54d859[_0x9239('0x5')]),_0x54d859);utils[_0x9239('0x1')](util[_0x9239('0xc')](_0x9239('0x14'),_0x54d859[_0x9239('0x5')],_0x54d859[_0x9239('0x15')],_0x54d859['origtransferercalleridname'],_0x54d859[_0x9239('0x16')],_0x54d859[_0x9239('0x17')]));_0x54d859=_['assign'](_0x54d859,{'transfererchannel':_0x54d859[_0x9239('0x18')],'transferercalleridnum':_0x54d859[_0x9239('0x15')],'transferercalleridname':_0x54d859[_0x9239('0x19')],'transfererconnectedlinenum':_0x54d859[_0x9239('0x1a')],'transfererconnectedlinename':_0x54d859[_0x9239('0x1b')],'transfereraccountcode':_0x54d859[_0x9239('0x1c')],'transferercontext':_0x54d859['secondtransferercontext'],'transfererexten':_0x54d859[_0x9239('0x1d')],'transfererlinkedid':_0x54d859[_0x9239('0x1e')],'context':_0x54d859['origtransferercontext'],'extension':_0x54d859[_0x9239('0x1f')],'type':_0x9239('0x4')});if(_['isNil'](_0x54d859[_0x9239('0x20')])){_0x54d859=_[_0x9239('0x21')](_0x54d859,{'transfereechannel':_0x54d859[_0x9239('0x22')],'transfereecalleridnum':_0x54d859[_0x9239('0x16')],'transfereecalleridname':_0x54d859[_0x9239('0x17')],'transfereeconnectedlinenum':_0x54d859[_0x9239('0x23')],'transfereeconnectedlinename':_0x54d859['transfertargetconnectedlinename'],'transfereeaccountcode':_0x54d859[_0x9239('0x24')],'transfereecontext':_0x54d859['transfertargetcontext'],'transfereeexten':_0x54d859[_0x9239('0x25')],'transfereelinkedid':_0x54d859[_0x9239('0x26')]});}writeDB(_0x54d859);}catch(_0x2f6001){utils[_0x9239('0x12')](util[_0x9239('0xc')](_0x9239('0x27'),_0x54d859['origtransfereruniqueid']),_0x2f6001);}}; \ No newline at end of file +var _0xf208=['attended','uniqueid','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','transferercalleridnum','transferercalleridname','transfereecalleridname','blind','transfereruniqueid','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','error','[%s][transfers][attendedtransfer]','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0xf208,0x13a));var _0x8f20=function(_0x89caaa,_0x2136b1){_0x89caaa=_0x89caaa-0x0;var _0x404993=_0xf208[_0x89caaa];return _0x404993;};'use strict';var _=require('lodash');var util=require(_0x8f20('0x0'));var utils=require(_0x8f20('0x1'));function writeDB(_0x46c015){utils[_0x8f20('0x2')](util[_0x8f20('0x3')](_0x8f20('0x4'),_0x46c015[_0x8f20('0x5')]===_0x8f20('0x6')?_0x46c015['origtransfereruniqueid']:_0x46c015[_0x8f20('0x7')],_0x46c015['type']));utils['request']('CreateVoiceTransferReport',_0x46c015);}exports[_0x8f20('0x8')]={};exports[_0x8f20('0x9')]=function(_0x12f35b){try{utils[_0x8f20('0xa')](util[_0x8f20('0x3')](_0x8f20('0xb'),_0x12f35b[_0x8f20('0x7')]),_0x12f35b);utils[_0x8f20('0x2')](util[_0x8f20('0x3')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x12f35b[_0x8f20('0x7')],_0x12f35b[_0x8f20('0xc')],_0x12f35b[_0x8f20('0xd')],_0x12f35b['transfereecalleridnum'],_0x12f35b[_0x8f20('0xe')]));_0x12f35b[_0x8f20('0x5')]=_0x8f20('0xf');exports[_0x8f20('0x8')][_0x12f35b[_0x8f20('0x10')]]=_0x12f35b;writeDB(_0x12f35b);}catch(_0x57776a){utils['error'](util[_0x8f20('0x3')](_0x8f20('0xb'),_0x12f35b[_0x8f20('0x7')]),_0x57776a);}};exports['attendedtransfer']=function(_0x589c29){try{utils[_0x8f20('0xa')](util[_0x8f20('0x3')]('[%s][transfers][attendedtransfer]',_0x589c29[_0x8f20('0x11')]),_0x589c29);utils[_0x8f20('0x2')](util[_0x8f20('0x3')](_0x8f20('0x12'),_0x589c29[_0x8f20('0x11')],_0x589c29['origtransferercalleridnum'],_0x589c29[_0x8f20('0x13')],_0x589c29[_0x8f20('0x14')],_0x589c29[_0x8f20('0x15')]));_0x589c29=_[_0x8f20('0x16')](_0x589c29,{'transfererchannel':_0x589c29[_0x8f20('0x17')],'transferercalleridnum':_0x589c29[_0x8f20('0x18')],'transferercalleridname':_0x589c29[_0x8f20('0x13')],'transfererconnectedlinenum':_0x589c29[_0x8f20('0x19')],'transfererconnectedlinename':_0x589c29[_0x8f20('0x1a')],'transfereraccountcode':_0x589c29['origtransfereraccountcode'],'transferercontext':_0x589c29[_0x8f20('0x1b')],'transfererexten':_0x589c29[_0x8f20('0x1c')],'transfererlinkedid':_0x589c29['origtransfererlinkedid'],'context':_0x589c29[_0x8f20('0x1d')],'extension':_0x589c29[_0x8f20('0x1e')],'type':_0x8f20('0x6')});if(_['isNil'](_0x589c29[_0x8f20('0x1f')])){_0x589c29=_['assign'](_0x589c29,{'transfereechannel':_0x589c29[_0x8f20('0x20')],'transfereecalleridnum':_0x589c29[_0x8f20('0x14')],'transfereecalleridname':_0x589c29[_0x8f20('0x15')],'transfereeconnectedlinenum':_0x589c29[_0x8f20('0x21')],'transfereeconnectedlinename':_0x589c29[_0x8f20('0x22')],'transfereeaccountcode':_0x589c29['transfertargetaccountcode'],'transfereecontext':_0x589c29[_0x8f20('0x23')],'transfereeexten':_0x589c29[_0x8f20('0x24')],'transfereelinkedid':_0x589c29[_0x8f20('0x25')]});}writeDB(_0x589c29);}catch(_0x54be46){utils[_0x8f20('0x26')](util[_0x8f20('0x3')](_0x8f20('0x27'),_0x589c29['origtransfereruniqueid']),_0x54be46);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index f1b300c..fbefa3c 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 _0x3c2b=['type','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','addTime','add','seconds','format','subtract','YYYY-MM-DD\x20HH:mm:ss','diff','now','isAfter','isBefore','jayson/promise','moment','util','client','../../config/logger','info','debug','inspect','request','[utils][request]\x20name:%s','catch','error','GetUser','internal','name','interface','then','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue'];(function(_0x9720b9,_0x578c4f){var _0xf1778b=function(_0x56c89a){while(--_0x56c89a){_0x9720b9['push'](_0x9720b9['shift']());}};_0xf1778b(++_0x578c4f);}(_0x3c2b,0x91));var _0xb3c2=function(_0x4ec891,_0x18a97c){_0x4ec891=_0x4ec891-0x0;var _0x4c158f=_0x3c2b[_0x4ec891];return _0x4c158f;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xb3c2('0x0'));var moment=require(_0xb3c2('0x1'));var util=require(_0xb3c2('0x2'));var client=jayson[_0xb3c2('0x3')]['http']({'port':0x2329});var logger=require(_0xb3c2('0x4'))('xdr');exports[_0xb3c2('0x5')]=function(_0x55ee00,_0x539c09){logger[_0xb3c2('0x5')](_0x55ee00,_0x539c09?util['inspect'](_0x539c09,{'showHidden':![],'depth':null}):'');};exports[_0xb3c2('0x6')]=function(_0x2e87e2,_0x1a07fc){logger[_0xb3c2('0x6')](_0x2e87e2,_0x1a07fc?util[_0xb3c2('0x7')](_0x1a07fc,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x75aa3c,_0x21865d){logger['error'](_0x75aa3c,_0x21865d?util[_0xb3c2('0x7')](_0x21865d,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x4293d4,_0xe7c7ac){return client[_0xb3c2('0x8')](_0x4293d4,{'body':_0xe7c7ac})['then'](function(_0x3f9036){logger[_0xb3c2('0x6')](_0xb3c2('0x9'),_0x4293d4,_0x3f9036?util[_0xb3c2('0x7')](_0x3f9036,{'showHidden':![],'depth':null}):'');})[_0xb3c2('0xa')](function(_0x269acd){logger[_0xb3c2('0xb')]('[utils][request]\x20name:%s',_0x4293d4,_0x269acd?util['inspect'](_0x269acd,{'showHidden':![],'depth':null}):'');});};function getUser(_0x50689d){return client[_0xb3c2('0x8')](_0xb3c2('0xc'),{'options':{'raw':!![],'attributes':['id',_0xb3c2('0xd'),_0xb3c2('0xe'),_0xb3c2('0xf')],'where':_0x50689d,'limit':0x1}})[_0xb3c2('0x10')](function(_0x140b90){logger['debug']('[utils][getUser]\x20where:%s',JSON['stringify'](_0x50689d),_0x140b90?util[_0xb3c2('0x7')](_0x140b90,{'showHidden':![],'depth':null}):'');return _0x140b90[_0xb3c2('0x11')][_0xb3c2('0x12')]?_0x140b90[_0xb3c2('0x11')][0x0]:null;});}exports[_0xb3c2('0x13')]=function(_0x2c1e74){return new BPromise(function(_0x2755e8,_0x1c137d){if(_0x2c1e74){return getUser({'internal':_0x2c1e74})[_0xb3c2('0x10')](function(_0x3beb24){logger[_0xb3c2('0x5')](_0xb3c2('0x14'),_0x2c1e74,_0x3beb24?_0xb3c2('0x15'):_0xb3c2('0x16'));return _0x2755e8(_0x3beb24);})[_0xb3c2('0xa')](function(_0x1d0475){logger[_0xb3c2('0xb')]('[utils][getUserByInternal]',_0x1d0475?util[_0xb3c2('0x7')](_0x1d0475,{'showHidden':![],'depth':null}):'');return _0x2755e8(null);});}return _0x2755e8(null);});};exports[_0xb3c2('0x17')]=function(_0x5d7f7f){return new BPromise(function(_0x564e28,_0x855d23){if(_0x5d7f7f){return getUser({'interface':_0x5d7f7f})[_0xb3c2('0x10')](function(_0x61a27d){logger['info'](_0xb3c2('0x18'),_0x5d7f7f,_0x61a27d?_0xb3c2('0x15'):_0xb3c2('0x16'));return _0x564e28(_0x61a27d);})[_0xb3c2('0xa')](function(_0x3b13a0){logger[_0xb3c2('0xb')](_0xb3c2('0x19'),_0x3b13a0?util[_0xb3c2('0x7')](_0x3b13a0,{'showHidden':![],'depth':null}):'');return _0x564e28(null);});}return _0x564e28(null);});};exports[_0xb3c2('0x1a')]=function(_0x5b3960){return new BPromise(function(_0x290048,_0x147033){if(_0x5b3960){return getUser({'name':_0x5b3960})[_0xb3c2('0x10')](function(_0x79fd67){logger['info'](_0xb3c2('0x1b'),_0x5b3960,_0x79fd67?_0xb3c2('0x15'):_0xb3c2('0x16'));return _0x290048(_0x79fd67);})[_0xb3c2('0xa')](function(_0x21823d){logger[_0xb3c2('0xb')](_0xb3c2('0x1c'),_0x21823d?util[_0xb3c2('0x7')](_0x21823d,{'showHidden':![],'depth':null}):'');return _0x290048(null);});}return _0x290048(null);});};exports[_0xb3c2('0x1d')]=function(_0xf189f8){return new BPromise(function(_0x3fe696,_0x117526){if(_0xf189f8){return client['request'](_0xb3c2('0x1e'),{'options':{'raw':!![],'attributes':['id','name',_0xb3c2('0x1f'),'acw','acwTimeout'],'where':{'name':_0xf189f8},'limit':0x1}})[_0xb3c2('0x10')](function(_0xbe2e88){logger[_0xb3c2('0x6')](_0xb3c2('0x20'),_0xf189f8,_0xbe2e88?util[_0xb3c2('0x7')](_0xbe2e88,{'showHidden':![],'depth':null}):'');logger[_0xb3c2('0x5')](_0xb3c2('0x21'),_0xf189f8,_0xbe2e88?'found':_0xb3c2('0x16'));return _0x3fe696(_0xbe2e88[_0xb3c2('0x11')]['length']?_0xbe2e88[_0xb3c2('0x11')][0x0]:null);})[_0xb3c2('0xa')](function(_0x2fc85f){logger[_0xb3c2('0xb')]('[utils][getVoiceQueueByName]',_0x2fc85f?util[_0xb3c2('0x7')](_0x2fc85f,{'showHidden':![],'depth':null}):'');return _0x3fe696(null);});}return _0x3fe696(null);});};exports[_0xb3c2('0x22')]=function(_0x2adf00,_0x35d2f2){return moment(_0x2adf00)[_0xb3c2('0x23')](_0x35d2f2,_0xb3c2('0x24'))[_0xb3c2('0x25')]('YYYY-MM-DD\x20HH:mm:ss');};exports['subtractTime']=function(_0x28ecf0,_0x318033){return moment(_0x28ecf0)[_0xb3c2('0x26')](_0x318033,_0xb3c2('0x24'))[_0xb3c2('0x25')](_0xb3c2('0x27'));};exports['diffTime']=function(_0x3a6424,_0x117d94){return moment(_0x3a6424)[_0xb3c2('0x28')](moment(_0x117d94),'seconds');};exports['sumTime']=function(_0x16bf7c,_0xd5085a){return parseInt(_0x16bf7c,0xa)+parseInt(_0xd5085a,0xa);};exports[_0xb3c2('0x29')]=function(){return moment()[_0xb3c2('0x25')](_0xb3c2('0x27'));};exports[_0xb3c2('0x2a')]=function(_0x26cc36,_0x18d00a){if(_0x18d00a){return moment(_0x26cc36)['isAfter'](_0x18d00a);}return!![];};exports[_0xb3c2('0x2b')]=function(_0x2c8470,_0x1ba1a6){if(_0x1ba1a6){return moment(_0x2c8470)['isBefore'](_0x1ba1a6);}else if(_0x2c8470){return!![];}return![];}; \ No newline at end of file +var _0x202a=['now','format','isAfter','isBefore','jayson/promise','moment','util','http','debug','inspect','error','request','[utils][request]\x20name:%s','catch','GetUser','name','interface','then','stringify','result','length','getUserByInternal','info','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','addTime','add','subtractTime','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','diff','sumTime'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x202a,0xc0));var _0xa202=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x202a[_0x321bb2];return _0x9c12ed;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xa202('0x0'));var moment=require(_0xa202('0x1'));var util=require(_0xa202('0x2'));var client=jayson['client'][_0xa202('0x3')]({'port':0x2329});var logger=require('../../config/logger')('xdr');exports['info']=function(_0x32f8b7,_0x1ce932){logger['info'](_0x32f8b7,_0x1ce932?util['inspect'](_0x1ce932,{'showHidden':![],'depth':null}):'');};exports[_0xa202('0x4')]=function(_0x4cb469,_0x4f0a59){logger['debug'](_0x4cb469,_0x4f0a59?util[_0xa202('0x5')](_0x4f0a59,{'showHidden':![],'depth':null}):'');};exports[_0xa202('0x6')]=function(_0x26ad43,_0x16951a){logger['error'](_0x26ad43,_0x16951a?util['inspect'](_0x16951a,{'showHidden':![],'depth':null}):'');};exports[_0xa202('0x7')]=function(_0x351e18,_0x32ae0b){return client[_0xa202('0x7')](_0x351e18,{'body':_0x32ae0b})['then'](function(_0x45ecc8){logger['debug'](_0xa202('0x8'),_0x351e18,_0x45ecc8?util[_0xa202('0x5')](_0x45ecc8,{'showHidden':![],'depth':null}):'');})[_0xa202('0x9')](function(_0x5bef49){logger[_0xa202('0x6')](_0xa202('0x8'),_0x351e18,_0x5bef49?util[_0xa202('0x5')](_0x5bef49,{'showHidden':![],'depth':null}):'');});};function getUser(_0x417e31){return client[_0xa202('0x7')](_0xa202('0xa'),{'options':{'raw':!![],'attributes':['id','internal',_0xa202('0xb'),_0xa202('0xc')],'where':_0x417e31,'limit':0x1}})[_0xa202('0xd')](function(_0x28953b){logger[_0xa202('0x4')]('[utils][getUser]\x20where:%s',JSON[_0xa202('0xe')](_0x417e31),_0x28953b?util[_0xa202('0x5')](_0x28953b,{'showHidden':![],'depth':null}):'');return _0x28953b[_0xa202('0xf')][_0xa202('0x10')]?_0x28953b[_0xa202('0xf')][0x0]:null;});}exports[_0xa202('0x11')]=function(_0x5d348c){return new BPromise(function(_0x44a1b6,_0x53ff78){if(_0x5d348c){return getUser({'internal':_0x5d348c})[_0xa202('0xd')](function(_0x55d39b){logger[_0xa202('0x12')](_0xa202('0x13'),_0x5d348c,_0x55d39b?_0xa202('0x14'):_0xa202('0x15'));return _0x44a1b6(_0x55d39b);})[_0xa202('0x9')](function(_0x5e96a9){logger[_0xa202('0x6')](_0xa202('0x16'),_0x5e96a9?util[_0xa202('0x5')](_0x5e96a9,{'showHidden':![],'depth':null}):'');return _0x44a1b6(null);});}return _0x44a1b6(null);});};exports[_0xa202('0x17')]=function(_0x188195){return new BPromise(function(_0x587cb7,_0x55c9a5){if(_0x188195){return getUser({'interface':_0x188195})[_0xa202('0xd')](function(_0x46cfa4){logger[_0xa202('0x12')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x188195,_0x46cfa4?_0xa202('0x14'):_0xa202('0x15'));return _0x587cb7(_0x46cfa4);})['catch'](function(_0x565685){logger[_0xa202('0x6')](_0xa202('0x18'),_0x565685?util['inspect'](_0x565685,{'showHidden':![],'depth':null}):'');return _0x587cb7(null);});}return _0x587cb7(null);});};exports[_0xa202('0x19')]=function(_0x5a1ea3){return new BPromise(function(_0x5373b6,_0x72fe3e){if(_0x5a1ea3){return getUser({'name':_0x5a1ea3})[_0xa202('0xd')](function(_0x397553){logger[_0xa202('0x12')](_0xa202('0x1a'),_0x5a1ea3,_0x397553?_0xa202('0x14'):'notfound');return _0x5373b6(_0x397553);})['catch'](function(_0x55f478){logger['error'](_0xa202('0x1b'),_0x55f478?util[_0xa202('0x5')](_0x55f478,{'showHidden':![],'depth':null}):'');return _0x5373b6(null);});}return _0x5373b6(null);});};exports[_0xa202('0x1c')]=function(_0x57f049){return new BPromise(function(_0x35ae40,_0x390633){if(_0x57f049){return client[_0xa202('0x7')](_0xa202('0x1d'),{'options':{'raw':!![],'attributes':['id',_0xa202('0xb'),_0xa202('0x1e'),_0xa202('0x1f'),_0xa202('0x20')],'where':{'name':_0x57f049},'limit':0x1}})[_0xa202('0xd')](function(_0x106b89){logger[_0xa202('0x4')](_0xa202('0x21'),_0x57f049,_0x106b89?util[_0xa202('0x5')](_0x106b89,{'showHidden':![],'depth':null}):'');logger[_0xa202('0x12')](_0xa202('0x22'),_0x57f049,_0x106b89?_0xa202('0x14'):'notfound');return _0x35ae40(_0x106b89[_0xa202('0xf')][_0xa202('0x10')]?_0x106b89[_0xa202('0xf')][0x0]:null);})[_0xa202('0x9')](function(_0x374590){logger[_0xa202('0x6')]('[utils][getVoiceQueueByName]',_0x374590?util[_0xa202('0x5')](_0x374590,{'showHidden':![],'depth':null}):'');return _0x35ae40(null);});}return _0x35ae40(null);});};exports[_0xa202('0x23')]=function(_0x556591,_0x18c2f7){return moment(_0x556591)[_0xa202('0x24')](_0x18c2f7,'seconds')['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xa202('0x25')]=function(_0x3d84a9,_0x353014){return moment(_0x3d84a9)[_0xa202('0x26')](_0x353014,_0xa202('0x27'))['format'](_0xa202('0x28'));};exports['diffTime']=function(_0x2cb87a,_0x4a242f){return moment(_0x2cb87a)[_0xa202('0x29')](moment(_0x4a242f),'seconds');};exports[_0xa202('0x2a')]=function(_0x516526,_0x5ebac8){return parseInt(_0x516526,0xa)+parseInt(_0x5ebac8,0xa);};exports[_0xa202('0x2b')]=function(){return moment()[_0xa202('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xa202('0x2d')]=function(_0x488e88,_0x56cd45){if(_0x56cd45){return moment(_0x488e88)[_0xa202('0x2d')](_0x56cd45);}return!![];};exports[_0xa202('0x2e')]=function(_0x56b5f5,_0x20df00){if(_0x20df00){return moment(_0x56b5f5)[_0xa202('0x2e')](_0x20df00);}else if(_0x56b5f5){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 62fa84e..82b190b 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 _0x86c0=['url','statusCode','responseTime','name','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','other','agent_id','agent_name','setupLoggers','fs-extra','express-winston','path','util','fileLogger','./safe-template','safeTemplate','maskSensitiveData','join','/var','log','xcally','client','role','ensureDir','user','then','no-user','data','timestamp','error','api','auth','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','format','method','headers','x-forwarded-for','connection','remoteAddress'];(function(_0x22926d,_0x4071ff){var _0x3ae465=function(_0x398db6){while(--_0x398db6){_0x22926d['push'](_0x22926d['shift']());}};_0x3ae465(++_0x4071ff);}(_0x86c0,0x184));var _0x086c=function(_0x11b4ab,_0x23e9f5){_0x11b4ab=_0x11b4ab-0x0;var _0xeb0f65=_0x86c0[_0x11b4ab];return _0xeb0f65;};var fs=require(_0x086c('0x0'));var _=require('lodash');var ewinston=require(_0x086c('0x1'));var path=require(_0x086c('0x2'));var util=require(_0x086c('0x3'));var fileLogger=require('./loggers')[_0x086c('0x4')];var safeTemplate=require(_0x086c('0x5'))[_0x086c('0x6')];var maskSensitiveData=require('./mask-sensitive-data')[_0x086c('0x7')];function ClientSideLogger(){function _0x569d09(_0xbee50a){var _0x13b4f1=path[_0x086c('0x8')](_0x086c('0x9'),_0x086c('0xa'),_0x086c('0xb'));var _0x563ff8=path[_0x086c('0x8')](_0x086c('0xc'),_0xbee50a[_0x086c('0xd')]+'-'+_0xbee50a['name']);return fs[_0x086c('0xe')](path[_0x086c('0x8')](_0x13b4f1,_0x563ff8))['then'](function(){var _0x4b9e78=fileLogger(_0x086c('0xc'),path[_0x086c('0x8')](_0x13b4f1,_0x563ff8));return _0x4b9e78;})['catch'](function(_0x546803){throw _0x546803;});}this[_0x086c('0xa')]=function(_0x54129d,_0x2e58d7,_0x19a9aa,_0x5011da){return _0x569d09(_0x54129d[_0x086c('0xf')])[_0x086c('0x10')](function(_0x35f02d){var _0x448309=_0x35f02d[_0x2e58d7];return _0x448309;})[_0x086c('0x10')](function(_0x4cf770){var _0x17af0f=_0x54129d['user']?_0x54129d[_0x086c('0xf')]['id']:_0x086c('0x11');var _0xd07132=_0x5011da[_0x086c('0x12')];var _0x4ffec6=_0x5011da[_0x086c('0x13')];var _0xd14f28=new Date(Number(_0x4ffec6));return _0x4cf770(_0x17af0f,_0xd14f28,_0x19a9aa,_0xd07132);})['catch'](function(_0x4d5a6b){fileLogger('client')[_0x086c('0x14')](_0x4d5a6b);});};}function setupLoggers(_0x54d86b){return new Promise(function(_0x2b860b){var _0x1882fb=new ClientSideLogger();var _0x410394=fileLogger(_0x086c('0x15'));var _0x2fd121=fileLogger(_0x086c('0x16'));_0x54d86b[_0x086c('0x17')](_0x086c('0x18'),_0x1882fb);_0x54d86b[_0x086c('0x19')](ewinston[_0x086c('0x1a')]({'winstonInstance':_0x410394,'meta':![],'statusLevels':!![],'msg':function(_0x506faa,_0x2b9e0e){var _0x4819b0=_0x086c('0x1b');if(!_['isEmpty'](_0x506faa[_0x086c('0x1c')])){_0x4819b0+='\x20body=%s';var _0x4158ef=_0x506faa[_0x086c('0x1c')];maskSensitiveData(_0x4158ef);}return safeTemplate(util[_0x086c('0x1d')](_0x4819b0,_0x506faa[_0x086c('0x1e')],_0x506faa[_0x086c('0x1f')][_0x086c('0x20')]?_0x506faa[_0x086c('0x1f')]['x-forwarded-for']:_0x506faa[_0x086c('0x21')][_0x086c('0x22')]||_0x506faa['ip'],_0x506faa[_0x086c('0x23')],_0x2b9e0e[_0x086c('0x24')],_0x2b9e0e[_0x086c('0x25')],_0x506faa['user']?_0x506faa[_0x086c('0xf')]['id']:null,_0x506faa['user']?_0x506faa['user'][_0x086c('0x26')]:null,_0x506faa[_0x086c('0xf')]?_0x506faa[_0x086c('0xf')][_0x086c('0xd')]:null,_0x4158ef?util[_0x086c('0x27')](_0x4158ef,![],null):''));}}));_0x54d86b[_0x086c('0x19')](ewinston[_0x086c('0x1a')]({'winstonInstance':_0x2fd121,'meta':![],'statusLevels':!![],'msg':function(_0x2e0f5a,_0x1d7912){var _0x3d7638=_0x086c('0x28');if(_0x2e0f5a['body']&&_0x2e0f5a['body'][_0x086c('0x29')]&&_0x2e0f5a[_0x086c('0x1c')]['agent_id']){_0x3d7638=_0x086c('0x2a');}return util[_0x086c('0x1d')](_0x3d7638,_0x2e0f5a[_0x086c('0x1e')],_0x2e0f5a[_0x086c('0x1f')]['x-forwarded-for']?_0x2e0f5a[_0x086c('0x1f')]['x-forwarded-for']:_0x2e0f5a[_0x086c('0x21')][_0x086c('0x22')]||_0x2e0f5a['ip'],_0x2e0f5a['url'],_0x1d7912['statusCode'],_0x1d7912['responseTime'],_0x2e0f5a['user']?_0x2e0f5a[_0x086c('0xf')]['id']:null,_0x2e0f5a['user']?_0x2e0f5a[_0x086c('0xf')][_0x086c('0x26')]:null,_0x2e0f5a[_0x086c('0xf')]?_0x2e0f5a[_0x086c('0xf')][_0x086c('0xd')]:null,_0x2e0f5a[_0x086c('0x1c')]&&_0x2e0f5a[_0x086c('0x1c')][_0x086c('0x29')]?_0x2e0f5a['body'][_0x086c('0x29')]:_0x086c('0x2b'),_0x2e0f5a[_0x086c('0x1c')]&&_0x2e0f5a['body'][_0x086c('0x2c')]?_0x2e0f5a['body'][_0x086c('0x2c')]:'',_0x2e0f5a[_0x086c('0x1c')]&&_0x2e0f5a['body'][_0x086c('0x2d')]?_0x2e0f5a[_0x086c('0x1c')]['agent_name']:'');},'ignoreRoute':function(_0x39a28d){var _0x2c4a2d=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x2c4a2d['test'](_0x39a28d[_0x086c('0x23')]);}}));return _0x2b860b();});}exports[_0x086c('0x2e')]=setupLoggers; \ No newline at end of file +var _0xc574=['xcally','role','name','ensureDir','client','catch','user','then','no-user','timestamp','api','set','client-side-logger','use','logger','%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','responseTime','inspect','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','other','agent_name','fs-extra','express-winston','path','util','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var'];(function(_0xac1eb8,_0x55935b){var _0x311eb4=function(_0x59e52a){while(--_0x59e52a){_0xac1eb8['push'](_0xac1eb8['shift']());}};_0x311eb4(++_0x55935b);}(_0xc574,0x76));var _0x4c57=function(_0x7ab863,_0x22f1bb){_0x7ab863=_0x7ab863-0x0;var _0x17fc7c=_0xc574[_0x7ab863];return _0x17fc7c;};var fs=require(_0x4c57('0x0'));var _=require('lodash');var ewinston=require(_0x4c57('0x1'));var path=require(_0x4c57('0x2'));var util=require(_0x4c57('0x3'));var fileLogger=require('./loggers')[_0x4c57('0x4')];var safeTemplate=require(_0x4c57('0x5'))[_0x4c57('0x6')];var maskSensitiveData=require(_0x4c57('0x7'))[_0x4c57('0x8')];function ClientSideLogger(){function _0x2aaede(_0x124321){var _0x5edd4f=path[_0x4c57('0x9')](_0x4c57('0xa'),'log',_0x4c57('0xb'));var _0x4f5097=path[_0x4c57('0x9')]('client',_0x124321[_0x4c57('0xc')]+'-'+_0x124321[_0x4c57('0xd')]);return fs[_0x4c57('0xe')](path['join'](_0x5edd4f,_0x4f5097))['then'](function(){var _0x576451=fileLogger(_0x4c57('0xf'),path['join'](_0x5edd4f,_0x4f5097));return _0x576451;})[_0x4c57('0x10')](function(_0x3dfa40){throw _0x3dfa40;});}this['log']=function(_0x2e7114,_0x77990e,_0x35499c,_0x5ed2a9){return _0x2aaede(_0x2e7114[_0x4c57('0x11')])[_0x4c57('0x12')](function(_0x2e26c9){var _0x4df486=_0x2e26c9[_0x77990e];return _0x4df486;})[_0x4c57('0x12')](function(_0x5ec696){var _0x4917ed=_0x2e7114[_0x4c57('0x11')]?_0x2e7114[_0x4c57('0x11')]['id']:_0x4c57('0x13');var _0x5b700e=_0x5ed2a9['data'];var _0x19901f=_0x5ed2a9[_0x4c57('0x14')];var _0x5108a2=new Date(Number(_0x19901f));return _0x5ec696(_0x4917ed,_0x5108a2,_0x35499c,_0x5b700e);})['catch'](function(_0x2785f9){fileLogger(_0x4c57('0xf'))['error'](_0x2785f9);});};}function setupLoggers(_0xcbf0bf){return new Promise(function(_0x3606fd){var _0x173c00=new ClientSideLogger();var _0x2252b0=fileLogger(_0x4c57('0x15'));var _0x181740=fileLogger('auth');_0xcbf0bf[_0x4c57('0x16')](_0x4c57('0x17'),_0x173c00);_0xcbf0bf[_0x4c57('0x18')](ewinston[_0x4c57('0x19')]({'winstonInstance':_0x2252b0,'meta':![],'statusLevels':!![],'msg':function(_0x30d866,_0x4335b4){var _0x2b5ae6=_0x4c57('0x1a');if(!_['isEmpty'](_0x30d866[_0x4c57('0x1b')])){_0x2b5ae6+='\x20body=%s';var _0x9ccc0c=_0x30d866[_0x4c57('0x1b')];maskSensitiveData(_0x9ccc0c);}return safeTemplate(util[_0x4c57('0x1c')](_0x2b5ae6,_0x30d866[_0x4c57('0x1d')],_0x30d866['headers']['x-forwarded-for']?_0x30d866[_0x4c57('0x1e')][_0x4c57('0x1f')]:_0x30d866[_0x4c57('0x20')][_0x4c57('0x21')]||_0x30d866['ip'],_0x30d866[_0x4c57('0x22')],_0x4335b4[_0x4c57('0x23')],_0x4335b4[_0x4c57('0x24')],_0x30d866[_0x4c57('0x11')]?_0x30d866[_0x4c57('0x11')]['id']:null,_0x30d866[_0x4c57('0x11')]?_0x30d866[_0x4c57('0x11')][_0x4c57('0xd')]:null,_0x30d866['user']?_0x30d866[_0x4c57('0x11')]['role']:null,_0x9ccc0c?util[_0x4c57('0x25')](_0x9ccc0c,![],null):''));}}));_0xcbf0bf['use'](ewinston[_0x4c57('0x19')]({'winstonInstance':_0x181740,'meta':![],'statusLevels':!![],'msg':function(_0xd0821c,_0x33b99e){var _0x441c5f='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0xd0821c['body']&&_0xd0821c[_0x4c57('0x1b')][_0x4c57('0x26')]&&_0xd0821c[_0x4c57('0x1b')][_0x4c57('0x27')]){_0x441c5f=_0x4c57('0x28');}return util[_0x4c57('0x1c')](_0x441c5f,_0xd0821c['method'],_0xd0821c[_0x4c57('0x1e')][_0x4c57('0x1f')]?_0xd0821c[_0x4c57('0x1e')]['x-forwarded-for']:_0xd0821c[_0x4c57('0x20')]['remoteAddress']||_0xd0821c['ip'],_0xd0821c[_0x4c57('0x22')],_0x33b99e['statusCode'],_0x33b99e[_0x4c57('0x24')],_0xd0821c['user']?_0xd0821c[_0x4c57('0x11')]['id']:null,_0xd0821c[_0x4c57('0x11')]?_0xd0821c['user'][_0x4c57('0xd')]:null,_0xd0821c[_0x4c57('0x11')]?_0xd0821c['user'][_0x4c57('0xc')]:null,_0xd0821c['body']&&_0xd0821c[_0x4c57('0x1b')]['device']?_0xd0821c[_0x4c57('0x1b')][_0x4c57('0x26')]:_0x4c57('0x29'),_0xd0821c[_0x4c57('0x1b')]&&_0xd0821c[_0x4c57('0x1b')][_0x4c57('0x27')]?_0xd0821c[_0x4c57('0x1b')][_0x4c57('0x27')]:'',_0xd0821c['body']&&_0xd0821c[_0x4c57('0x1b')][_0x4c57('0x2a')]?_0xd0821c[_0x4c57('0x1b')][_0x4c57('0x2a')]:'');},'ignoreRoute':function(_0x5de6bf){var _0x4be498=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x4be498['test'](_0x5de6bf[_0x4c57('0x22')]);}}));return _0x3606fd();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 61b4798..cac467d 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xad99=['exports','circularDoWInterval','monthsShort','clone','hours','minutes','isBefore','startOf','endOf','day','isBetween','timeCompare','format','ddd','includes','dowCompare','date','daysInMonth','min','max','monthCompare','guess','test','isMoment','padStart','length','iftime','lodash','Date\x20not\x20valid','split','map','weekdaysShort','toLowerCase','locale','indexOf','slice','concat'];(function(_0x2ade6f,_0x18d576){var _0x28fa0f=function(_0x4ad67c){while(--_0x4ad67c){_0x2ade6f['push'](_0x2ade6f['shift']());}};_0x28fa0f(++_0x18d576);}(_0xad99,0x65));var _0x9ad9=function(_0x3a676b,_0x297c77){_0x3a676b=_0x3a676b-0x0;var _0x1aac22=_0xad99[_0x3a676b];return _0x1aac22;};var _=require(_0x9ad9('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(_0xa34538){return _0xa34538['source'];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING='Interval\x20string\x20not\x20valid';var EINVALID_DATE=_0x9ad9('0x1');function throwIfDateNotValid(_0x3bc8e0){if(!_0x3bc8e0['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x3c6732){var _0x17a55c=_0x3c6732[_0x9ad9('0x2')](':')[_0x9ad9('0x3')](function(_0x4af6a0){return parseInt(_0x4af6a0,0xa);});var _0x2c0591=_0x17a55c[0x0];var _0x22a2cc=_0x17a55c[0x1];if(_0x2c0591<0x0||_0x2c0591>0x17||_0x22a2cc<0x0||_0x22a2cc>0x3b){throw new Error(EINVALID_DATE);}return[_0x2c0591,_0x22a2cc];}function circularDoWInterval(_0x34c0f4,_0x44c87c){if(_0x34c0f4===_0x44c87c){return[_0x34c0f4];}else{var _0x5b98d5=moment['locale']();moment['locale']('en');var _0x262812=moment[_0x9ad9('0x4')]()[_0x9ad9('0x3')](function(_0x1bc6c4){return _0x1bc6c4[_0x9ad9('0x5')]();});moment[_0x9ad9('0x6')](_0x5b98d5);var _0x1d3896=_0x262812['indexOf'](_0x34c0f4);var _0x1fb8c9=_0x262812[_0x9ad9('0x7')](_0x44c87c);if(_0x1fb8c9>_0x1d3896){return _0x262812[_0x9ad9('0x8')](_0x1d3896,_0x1fb8c9+0x1);}else{var _0x28bb92=_0x262812['slice'](0x0,_0x1fb8c9+0x1);var _0x4f0ce7=_0x262812['slice'](_0x1d3896);return _0x4f0ce7[_0x9ad9('0x9')](_0x28bb92);}}}module[_0x9ad9('0xa')][_0x9ad9('0xb')]=circularDoWInterval;function circularMonthInterval(_0x38da5f,_0x1db47a){if(_0x38da5f===_0x1db47a){return[_0x38da5f];}else{var _0x1f0f8b=moment['locale']();moment[_0x9ad9('0x6')]('en');var _0x514893=moment[_0x9ad9('0xc')]()[_0x9ad9('0x3')](function(_0x3e5f08){return _0x3e5f08[_0x9ad9('0x5')]();});moment[_0x9ad9('0x6')](_0x1f0f8b);var _0x394717=_0x514893[_0x9ad9('0x7')](_0x38da5f);var _0xe7e7bb=_0x514893[_0x9ad9('0x7')](_0x1db47a);if(_0xe7e7bb>_0x394717){return _0x514893['slice'](_0x394717,_0xe7e7bb+0x1);}else{var _0x21d128=_0x514893[_0x9ad9('0x8')](0x0,_0xe7e7bb+0x1);var _0x516728=_0x514893['slice'](_0x394717);return _0x516728[_0x9ad9('0x9')](_0x21d128);}}}module['exports']['circularMonthInterval']=circularMonthInterval;function parseDom(_0x907580){var _0x4e0b75=parseInt(_0x907580,0xa);if(_0x4e0b75<0x1||_0x4e0b75>0x1f){throw new Error(EINVALID_DATE);}return _0x4e0b75;}function timeCompare(_0x51b361,_0x3dcbf2,_0x2178e){var _0x432118=_0x51b361[_0x9ad9('0xd')]();var _0x2a0eeb=extractTime(_0x3dcbf2);var _0xfe874f=_0x2a0eeb[0x0];var _0x236108=_0x2a0eeb[0x1];var _0x34efaf=_0x51b361[_0x9ad9('0xd')]()[_0x9ad9('0xe')](_0xfe874f)[_0x9ad9('0xf')](_0x236108);throwIfDateNotValid(_0x34efaf);var _0x9b1ab1=extractTime(_0x2178e);var _0x32ea29=_0x9b1ab1[0x0];var _0x419b0c=_0x9b1ab1[0x1];var _0x463a51=_0x51b361[_0x9ad9('0xd')]()['hours'](_0x32ea29)['minutes'](_0x419b0c);throwIfDateNotValid(_0x463a51);if(_0x463a51[_0x9ad9('0x10')](_0x34efaf)){var _0x2a2780=_0x432118[_0x9ad9('0xd')]()[_0x9ad9('0x11')]('day');var _0x15fe14=_0x432118[_0x9ad9('0xd')]()[_0x9ad9('0x12')](_0x9ad9('0x13'));return _0x432118[_0x9ad9('0x14')](_0x34efaf,_0x15fe14,undefined,'[]')||_0x432118['isBetween'](_0x2a2780,_0x463a51,undefined,'[]');}else{return _0x432118[_0x9ad9('0x14')](_0x34efaf,_0x463a51,undefined,'[]');}}module['exports'][_0x9ad9('0x15')]=timeCompare;function dowCompare(_0x59bb32,_0x2be540,_0x57f4db){var _0x130d7a=_0x59bb32[_0x9ad9('0x6')]('en')[_0x9ad9('0x16')](_0x9ad9('0x17'))[_0x9ad9('0x5')]();return circularDoWInterval(_0x2be540,_0x57f4db)[_0x9ad9('0x18')](_0x130d7a);}module['exports'][_0x9ad9('0x19')]=dowCompare;function domCompare(_0x358a28,_0x1569db,_0x5cf638){var _0x4b6a8d=_0x358a28[_0x9ad9('0x1a')]();if(_0x1569db===_0x5cf638){return _0x4b6a8d===_0x1569db;}else{var _0x4b0ad2=_0x358a28[_0x9ad9('0x1b')]();var _0x3db8a3=_0x1569db<_0x5cf638;let _0x99fac8=![];var _0x2a425e=0x0;var _0x2725db=0x0;if(_0x3db8a3){_0x2a425e=Math['max'](0x1,_0x1569db);_0x2725db=Math['min'](_0x5cf638,_0x4b0ad2);_0x99fac8=_0x4b6a8d>=_0x2a425e&&_0x4b6a8d<=_0x2725db;}else{_0x2a425e=Math[_0x9ad9('0x1c')](_0x1569db,_0x4b0ad2);_0x2725db=Math[_0x9ad9('0x1d')](0x1,_0x5cf638);_0x99fac8=_0x4b6a8d>=_0x2a425e||_0x4b6a8d<=_0x2725db;}return _0x99fac8;}}module[_0x9ad9('0xa')]['domCompare']=domCompare;function monthCompare(_0x38d78e,_0x2d4897,_0x290678){var _0x54e798=_0x38d78e['locale']('en')['format']('MMM')[_0x9ad9('0x5')]();return circularMonthInterval(_0x2d4897,_0x290678)['includes'](_0x54e798);}module[_0x9ad9('0xa')][_0x9ad9('0x1e')]=monthCompare;function iftime(_0x2013ac,_0x96c4ba=moment['tz'][_0x9ad9('0x1f')](),_0x49423b=moment()){if(!validateRx[_0x9ad9('0x20')](_0x2013ac)){throw new Error(EINVALID_STRING);}else{var _0x392863=(moment[_0x9ad9('0x21')](_0x49423b)?_0x49423b[_0x9ad9('0xd')]():moment(_0x49423b))['tz'](_0x96c4ba)[_0x9ad9('0x6')]('en');throwIfDateNotValid(_0x392863);var _0x15c5ac=_0x2013ac[_0x9ad9('0x2')](',');var _0x486ef3=_0x15c5ac[0x0];var _0x1792ac=_0x15c5ac[0x1];var _0x325ac1=_0x15c5ac[0x2];var _0x30d007=_0x15c5ac[0x3];let _0x107210=!![];if(_0x486ef3!=='*'){var _0x3b5a7b=_0x486ef3[_0x9ad9('0x2')]('-');var _0x84d0c7=_[_0x9ad9('0x22')](_0x3b5a7b[0x0],0x5,'0');var _0x3e91f4=_0x3b5a7b[_0x9ad9('0x23')]===0x2?_[_0x9ad9('0x22')](_0x3b5a7b[0x1],0x5,'0'):_0x84d0c7;_0x107210=timeCompare(_0x392863,_0x84d0c7,_0x3e91f4);}let _0x447d21=!![];if(_0x1792ac!=='*'){var _0xc4c868=_0x1792ac['split']('-');var _0x169328=_0xc4c868[0x0];var _0x3aa359=_0xc4c868[_0x9ad9('0x23')]===0x2?_0xc4c868[0x1]:_0x169328;_0x447d21=dowCompare(_0x392863,_0x169328,_0x3aa359);}let _0x2d0983=!![];if(_0x325ac1!=='*'){var _0x3f1ff3=_0x325ac1[_0x9ad9('0x2')]('-');var _0x3a386c=parseDom(_0x3f1ff3[0x0]);var _0x2c5beb=_0x3f1ff3[_0x9ad9('0x23')]===0x2?parseDom(_0x3f1ff3[0x1]):_0x3a386c;_0x2d0983=domCompare(_0x392863,_0x3a386c,_0x2c5beb);}let _0x22f5ce=!![];if(_0x30d007!=='*'){var _0x1ae8b3=_0x30d007[_0x9ad9('0x2')]('-');var _0xc0cd66=_0x1ae8b3[0x0];var _0x431fad=_0x1ae8b3[_0x9ad9('0x23')]===0x2?_0x1ae8b3[0x1]:_0x1ae8b3[0x0];_0x22f5ce=monthCompare(_0x392863,_0xc0cd66,_0x431fad);}return _0x107210&&_0x447d21&&_0x2d0983&&_0x22f5ce;}}module['exports'][_0x9ad9('0x24')]=iftime; \ No newline at end of file +var _0xc649=['max','min','domCompare','MMM','monthCompare','guess','isMoment','padStart','length','iftime','lodash','moment-timezone','map','source','join','Interval\x20string\x20not\x20valid','isValid','split','weekdaysShort','toLowerCase','locale','indexOf','slice','concat','monthsShort','exports','clone','minutes','hours','isBefore','day','isBetween','format','ddd','includes','dowCompare','date'];(function(_0x395b0d,_0x4b8bbf){var _0x35ec86=function(_0x4b1a89){while(--_0x4b1a89){_0x395b0d['push'](_0x395b0d['shift']());}};_0x35ec86(++_0x4b8bbf);}(_0xc649,0x157));var _0x9c64=function(_0x34d296,_0xdf4ee4){_0x34d296=_0x34d296-0x0;var _0x2bd2ce=_0xc649[_0x34d296];return _0x2bd2ce;};var _=require(_0x9c64('0x0'));var moment=require(_0x9c64('0x1'));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][_0x9c64('0x2')](function(_0x5670f9){return _0x5670f9[_0x9c64('0x3')];})[_0x9c64('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x9c64('0x5');var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x12a515){if(!_0x12a515[_0x9c64('0x6')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x43c278){var _0xda4700=_0x43c278[_0x9c64('0x7')](':')['map'](function(_0x3239db){return parseInt(_0x3239db,0xa);});var _0x2779b9=_0xda4700[0x0];var _0x27ee86=_0xda4700[0x1];if(_0x2779b9<0x0||_0x2779b9>0x17||_0x27ee86<0x0||_0x27ee86>0x3b){throw new Error(EINVALID_DATE);}return[_0x2779b9,_0x27ee86];}function circularDoWInterval(_0x148298,_0x137082){if(_0x148298===_0x137082){return[_0x148298];}else{var _0x45abef=moment['locale']();moment['locale']('en');var _0x555f5a=moment[_0x9c64('0x8')]()[_0x9c64('0x2')](function(_0x1252c2){return _0x1252c2[_0x9c64('0x9')]();});moment[_0x9c64('0xa')](_0x45abef);var _0x4cb05d=_0x555f5a[_0x9c64('0xb')](_0x148298);var _0x5d5a05=_0x555f5a[_0x9c64('0xb')](_0x137082);if(_0x5d5a05>_0x4cb05d){return _0x555f5a['slice'](_0x4cb05d,_0x5d5a05+0x1);}else{var _0x114992=_0x555f5a[_0x9c64('0xc')](0x0,_0x5d5a05+0x1);var _0x4b66f5=_0x555f5a['slice'](_0x4cb05d);return _0x4b66f5[_0x9c64('0xd')](_0x114992);}}}module['exports']['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x6be12c,_0x48e13e){if(_0x6be12c===_0x48e13e){return[_0x6be12c];}else{var _0x479c56=moment[_0x9c64('0xa')]();moment[_0x9c64('0xa')]('en');var _0x1ff919=moment[_0x9c64('0xe')]()[_0x9c64('0x2')](function(_0x1340ac){return _0x1340ac['toLowerCase']();});moment['locale'](_0x479c56);var _0x4e4f73=_0x1ff919[_0x9c64('0xb')](_0x6be12c);var _0x4cbdd2=_0x1ff919[_0x9c64('0xb')](_0x48e13e);if(_0x4cbdd2>_0x4e4f73){return _0x1ff919[_0x9c64('0xc')](_0x4e4f73,_0x4cbdd2+0x1);}else{var _0x58b8cc=_0x1ff919['slice'](0x0,_0x4cbdd2+0x1);var _0x14ce6d=_0x1ff919['slice'](_0x4e4f73);return _0x14ce6d['concat'](_0x58b8cc);}}}module[_0x9c64('0xf')]['circularMonthInterval']=circularMonthInterval;function parseDom(_0x19e945){var _0x511e2f=parseInt(_0x19e945,0xa);if(_0x511e2f<0x1||_0x511e2f>0x1f){throw new Error(EINVALID_DATE);}return _0x511e2f;}function timeCompare(_0x465af5,_0x12c177,_0x535401){var _0x5ef590=_0x465af5[_0x9c64('0x10')]();var _0x3dd5fe=extractTime(_0x12c177);var _0x428cd7=_0x3dd5fe[0x0];var _0x1e3971=_0x3dd5fe[0x1];var _0x26a88f=_0x465af5[_0x9c64('0x10')]()['hours'](_0x428cd7)[_0x9c64('0x11')](_0x1e3971);throwIfDateNotValid(_0x26a88f);var _0x4c308b=extractTime(_0x535401);var _0x2e32a0=_0x4c308b[0x0];var _0x500d53=_0x4c308b[0x1];var _0x32b644=_0x465af5[_0x9c64('0x10')]()[_0x9c64('0x12')](_0x2e32a0)[_0x9c64('0x11')](_0x500d53);throwIfDateNotValid(_0x32b644);if(_0x32b644[_0x9c64('0x13')](_0x26a88f)){var _0x3767a7=_0x5ef590[_0x9c64('0x10')]()['startOf'](_0x9c64('0x14'));var _0x5c0257=_0x5ef590[_0x9c64('0x10')]()['endOf'](_0x9c64('0x14'));return _0x5ef590['isBetween'](_0x26a88f,_0x5c0257,undefined,'[]')||_0x5ef590[_0x9c64('0x15')](_0x3767a7,_0x32b644,undefined,'[]');}else{return _0x5ef590[_0x9c64('0x15')](_0x26a88f,_0x32b644,undefined,'[]');}}module[_0x9c64('0xf')]['timeCompare']=timeCompare;function dowCompare(_0x11843a,_0xda545f,_0x1f5ae7){var _0x3d36d3=_0x11843a[_0x9c64('0xa')]('en')[_0x9c64('0x16')](_0x9c64('0x17'))['toLowerCase']();return circularDoWInterval(_0xda545f,_0x1f5ae7)[_0x9c64('0x18')](_0x3d36d3);}module[_0x9c64('0xf')][_0x9c64('0x19')]=dowCompare;function domCompare(_0x50746b,_0x29091e,_0x431fb4){var _0x1fa540=_0x50746b[_0x9c64('0x1a')]();if(_0x29091e===_0x431fb4){return _0x1fa540===_0x29091e;}else{var _0x34161a=_0x50746b['daysInMonth']();var _0x949644=_0x29091e<_0x431fb4;let _0xd82c78=![];var _0x84f534=0x0;var _0x55830e=0x0;if(_0x949644){_0x84f534=Math[_0x9c64('0x1b')](0x1,_0x29091e);_0x55830e=Math['min'](_0x431fb4,_0x34161a);_0xd82c78=_0x1fa540>=_0x84f534&&_0x1fa540<=_0x55830e;}else{_0x84f534=Math[_0x9c64('0x1c')](_0x29091e,_0x34161a);_0x55830e=Math['max'](0x1,_0x431fb4);_0xd82c78=_0x1fa540>=_0x84f534||_0x1fa540<=_0x55830e;}return _0xd82c78;}}module[_0x9c64('0xf')][_0x9c64('0x1d')]=domCompare;function monthCompare(_0x524c39,_0x41c4c8,_0xacc969){var _0x2c0dfe=_0x524c39[_0x9c64('0xa')]('en')[_0x9c64('0x16')](_0x9c64('0x1e'))[_0x9c64('0x9')]();return circularMonthInterval(_0x41c4c8,_0xacc969)['includes'](_0x2c0dfe);}module['exports'][_0x9c64('0x1f')]=monthCompare;function iftime(_0x292cb1,_0x2b7fee=moment['tz'][_0x9c64('0x20')](),_0x9093bb=moment()){if(!validateRx['test'](_0x292cb1)){throw new Error(EINVALID_STRING);}else{var _0xc757d=(moment[_0x9c64('0x21')](_0x9093bb)?_0x9093bb[_0x9c64('0x10')]():moment(_0x9093bb))['tz'](_0x2b7fee)['locale']('en');throwIfDateNotValid(_0xc757d);var _0x3e93f2=_0x292cb1[_0x9c64('0x7')](',');var _0x2b380c=_0x3e93f2[0x0];var _0x33d180=_0x3e93f2[0x1];var _0x3c34c2=_0x3e93f2[0x2];var _0x2797d2=_0x3e93f2[0x3];let _0xdf563=!![];if(_0x2b380c!=='*'){var _0x2b13fa=_0x2b380c[_0x9c64('0x7')]('-');var _0x1c233d=_['padStart'](_0x2b13fa[0x0],0x5,'0');var _0x57e5a5=_0x2b13fa['length']===0x2?_[_0x9c64('0x22')](_0x2b13fa[0x1],0x5,'0'):_0x1c233d;_0xdf563=timeCompare(_0xc757d,_0x1c233d,_0x57e5a5);}let _0x4dbf53=!![];if(_0x33d180!=='*'){var _0xc6e618=_0x33d180[_0x9c64('0x7')]('-');var _0x1cfc5e=_0xc6e618[0x0];var _0x3a242c=_0xc6e618[_0x9c64('0x23')]===0x2?_0xc6e618[0x1]:_0x1cfc5e;_0x4dbf53=dowCompare(_0xc757d,_0x1cfc5e,_0x3a242c);}let _0x1ebc13=!![];if(_0x3c34c2!=='*'){var _0x4b1423=_0x3c34c2[_0x9c64('0x7')]('-');var _0x529bb0=parseDom(_0x4b1423[0x0]);var _0x2806a3=_0x4b1423[_0x9c64('0x23')]===0x2?parseDom(_0x4b1423[0x1]):_0x529bb0;_0x1ebc13=domCompare(_0xc757d,_0x529bb0,_0x2806a3);}let _0x2b82fd=!![];if(_0x2797d2!=='*'){var _0x8d1c1c=_0x2797d2[_0x9c64('0x7')]('-');var _0x1f65b6=_0x8d1c1c[0x0];var _0x257ded=_0x8d1c1c[_0x9c64('0x23')]===0x2?_0x8d1c1c[0x1]:_0x8d1c1c[0x0];_0x2b82fd=monthCompare(_0xc757d,_0x1f65b6,_0x257ded);}return _0xdf563&&_0x4dbf53&&_0x1ebc13&&_0x2b82fd;}}module['exports'][_0x9c64('0x24')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index c145ec2..0c0ebbc 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8295=['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','level','toUpperCase','}}}','meta','keys','length','stringify','Logger','Console','warn','transports','File','%s-%s','consoleLogger','fileLogger','path','util','moment','winston','../config/environment','debugLevel','redBG\x20white','red','bold\x20yellow','white','bold\x20white'];(function(_0x205e5a,_0x5c19fb){var _0x10da58=function(_0x1ba35d){while(--_0x1ba35d){_0x205e5a['push'](_0x205e5a['shift']());}};_0x10da58(++_0x5c19fb);}(_0x8295,0x106));var _0x5829=function(_0x36d25e,_0x1a047d){_0x36d25e=_0x36d25e-0x0;var _0x4b95b8=_0x8295[_0x36d25e];return _0x4b95b8;};'use strict';var path=require(_0x5829('0x0'));var util=require(_0x5829('0x1'));var moment=require(_0x5829('0x2'));var winston=require(_0x5829('0x3'));var config=require(_0x5829('0x4'));var debugLevel=config[_0x5829('0x5')]?config['debugLevel']['toLowerCase']():'info';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':_0x5829('0x6'),'error':_0x5829('0x7'),'warn':_0x5829('0x8'),'info':_0x5829('0x9'),'print':_0x5829('0xa'),'success':'bold\x20green','http':'gray','verbose':_0x5829('0xb'),'debug':_0x5829('0xc'),'silly':_0x5829('0xd')};winston[_0x5829('0xe')](XC_LOG_COLORS);function getLogFileName(_0x480841,_0x37529b,_0x48eee8){var _0x2b1d52=_0x480841||_0x5829('0xf');return path[_0x5829('0x10')](_0x2b1d52,util[_0x5829('0x11')](_0x5829('0x12'),_0x37529b,_0x48eee8));}function formatter(_0x58d36b,_0x20fb8a){_0x20fb8a[_0x5829('0x13')]=_0x20fb8a[_0x5829('0x13')][_0x5829('0x14')](/@@{/g,_0x5829('0x15'))[_0x5829('0x14')](/}@@/g,'}}}')[_0x5829('0x14')](/@{/g,'{{')['replace'](/}@/g,'}}');return util['format'](_0x5829('0x16'),moment()[_0x5829('0x11')](_0x5829('0x17')),_0x20fb8a[_0x5829('0x18')][_0x5829('0x19')](),_0x58d36b,_0x20fb8a[_0x5829('0x13')]);}function fileFormat(_0x218b37,_0x9b197e){_0x9b197e[_0x5829('0x13')]=_0x9b197e['message']['replace'](/@@{/g,_0x5829('0x15'))['replace'](/}@@/g,_0x5829('0x1a'))[_0x5829('0x14')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x200302=_0x9b197e[_0x5829('0x1b')]&&Object[_0x5829('0x1c')](_0x9b197e[_0x5829('0x1b')])[_0x5829('0x1d')]?'\x0a\x09'+JSON[_0x5829('0x1e')](_0x9b197e[_0x5829('0x1b')]):'';return util[_0x5829('0x11')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()['format'](_0x5829('0x17')),_0x9b197e[_0x5829('0x18')][_0x5829('0x19')](),_0x218b37,_0x9b197e[_0x5829('0x13')],_0x200302);}function consoleLogger(){var _0x1569cc=new winston[(_0x5829('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x5829('0x20'))]({'level':_0x5829('0x21'),'json':![],'formatter':function(_0x36a4c0){return formatter('',_0x36a4c0);}})]});return _0x1569cc;}function fileLogger(_0x5b4b03,_0x1b2a6e){var _0x4695da=new winston[(_0x5829('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x5829('0x22'))][(_0x5829('0x23'))]({'name':util[_0x5829('0x11')]('%s-%s',_0x5b4b03,'error'),'filename':getLogFileName(_0x1b2a6e,_0x5b4b03,'error'),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x238f5b){return fileFormat(_0x5b4b03,_0x238f5b);}}),new winston['transports'][(_0x5829('0x23'))]({'name':util[_0x5829('0x11')](_0x5829('0x24'),_0x5b4b03,debugLevel),'filename':getLogFileName(_0x1b2a6e,_0x5b4b03,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4358d6){return fileFormat(_0x5b4b03,_0x4358d6);}}),new winston['transports'][(_0x5829('0x20'))]({'level':'warn','json':![],'formatter':function(_0x4b96f1){return fileFormat(_0x5b4b03,_0x4b96f1);}})]});return _0x4695da;}exports[_0x5829('0x25')]=consoleLogger;exports[_0x5829('0x26')]=fileLogger; \ No newline at end of file +var _0xa45e=['debugLevel','toLowerCase','red','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','/var/log/xcally','join','format','%s-%s.log','message','replace','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','{{{','meta','keys','Logger','transports','Console','%s-%s','error','File','warn','consoleLogger','fileLogger','path','util','moment','../config/environment'];(function(_0x485c12,_0x63ee16){var _0x5c87ad=function(_0x5bb3cf){while(--_0x5bb3cf){_0x485c12['push'](_0x485c12['shift']());}};_0x5c87ad(++_0x63ee16);}(_0xa45e,0x1f4));var _0xea45=function(_0x3517fd,_0x1c24d4){_0x3517fd=_0x3517fd-0x0;var _0x1db0ef=_0xa45e[_0x3517fd];return _0x1db0ef;};'use strict';var path=require(_0xea45('0x0'));var util=require(_0xea45('0x1'));var moment=require(_0xea45('0x2'));var winston=require('winston');var config=require(_0xea45('0x3'));var debugLevel=config[_0xea45('0x4')]?config[_0xea45('0x4')][_0xea45('0x5')]():'info';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':'redBG\x20white','error':_0xea45('0x6'),'warn':_0xea45('0x7'),'info':_0xea45('0x8'),'print':_0xea45('0x9'),'success':_0xea45('0xa'),'http':_0xea45('0xb'),'verbose':_0xea45('0xc'),'debug':_0xea45('0xd'),'silly':'bold\x20cyan'};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x46534d,_0x1b968e,_0x1b973c){var _0x6554e9=_0x46534d||_0xea45('0xe');return path[_0xea45('0xf')](_0x6554e9,util[_0xea45('0x10')](_0xea45('0x11'),_0x1b968e,_0x1b973c));}function formatter(_0x3cbb2d,_0x2f323f){_0x2f323f[_0xea45('0x12')]=_0x2f323f[_0xea45('0x12')][_0xea45('0x13')](/@@{/g,'{{{')[_0xea45('0x13')](/}@@/g,'}}}')['replace'](/@{/g,'{{')[_0xea45('0x13')](/}@/g,'}}');return util['format'](_0xea45('0x14'),moment()[_0xea45('0x10')](_0xea45('0x15')),_0x2f323f[_0xea45('0x16')][_0xea45('0x17')](),_0x3cbb2d,_0x2f323f['message']);}function fileFormat(_0x49692e,_0x50b712){_0x50b712[_0xea45('0x12')]=_0x50b712[_0xea45('0x12')][_0xea45('0x13')](/@@{/g,_0xea45('0x18'))[_0xea45('0x13')](/}@@/g,'}}}')[_0xea45('0x13')](/@{/g,'{{')[_0xea45('0x13')](/}@/g,'}}');var _0x35c5a4=_0x50b712[_0xea45('0x19')]&&Object[_0xea45('0x1a')](_0x50b712['meta'])['length']?'\x0a\x09'+JSON['stringify'](_0x50b712[_0xea45('0x19')]):'';return util[_0xea45('0x10')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0xea45('0x10')](_0xea45('0x15')),_0x50b712['level'][_0xea45('0x17')](),_0x49692e,_0x50b712[_0xea45('0x12')],_0x35c5a4);}function consoleLogger(){var _0x1dcc1c=new winston[(_0xea45('0x1b'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xea45('0x1c'))][(_0xea45('0x1d'))]({'level':'warn','json':![],'formatter':function(_0x54ded4){return formatter('',_0x54ded4);}})]});return _0x1dcc1c;}function fileLogger(_0x5a5312,_0x1650a2){var _0x2b0863=new winston[(_0xea45('0x1b'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xea45('0x1c'))]['File']({'name':util[_0xea45('0x10')](_0xea45('0x1e'),_0x5a5312,'error'),'filename':getLogFileName(_0x1650a2,_0x5a5312,_0xea45('0x1f')),'level':_0xea45('0x1f'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x26bf75){return fileFormat(_0x5a5312,_0x26bf75);}}),new winston[(_0xea45('0x1c'))][(_0xea45('0x20'))]({'name':util['format'](_0xea45('0x1e'),_0x5a5312,debugLevel),'filename':getLogFileName(_0x1650a2,_0x5a5312,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x75a772){return fileFormat(_0x5a5312,_0x75a772);}}),new winston[(_0xea45('0x1c'))][(_0xea45('0x1d'))]({'level':_0xea45('0x21'),'json':![],'formatter':function(_0x14be50){return fileFormat(_0x5a5312,_0x14be50);}})]});return _0x2b0863;}exports[_0xea45('0x22')]=consoleLogger;exports[_0xea45('0x23')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 0d2037f..111ba18 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 _0x57ca=['accesskeyid','secretaccesskey','key','user','accountSid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','isString','@@{','replace','}@@','includes','exports','username','password','apiKey','firstName','lastName','street','phone','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','channelSecret','accessTokenSecret','authToken','consumerSecret','calleridname','calleridnum','vidaooApiKey','privateKey'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x57ca,0x108));var _0xa57c=function(_0x484f93,_0x5e9972){_0x484f93=_0x484f93-0x0;var _0x4c4796=_0x57ca[_0x484f93];return _0x4c4796;};var _=require('lodash');var sensitiveFields=[_0xa57c('0x0'),_0xa57c('0x1'),'newPassword',_0xa57c('0x2'),_0xa57c('0x3'),_0xa57c('0x4'),_0xa57c('0x5'),_0xa57c('0x6'),'mobile',_0xa57c('0x7'),_0xa57c('0x8'),_0xa57c('0x9'),_0xa57c('0xa'),_0xa57c('0xb'),_0xa57c('0xc'),_0xa57c('0xd'),_0xa57c('0xe'),'token',_0xa57c('0xf'),'accessToken',_0xa57c('0x10'),_0xa57c('0x11'),'consumerKey',_0xa57c('0x12'),'membername',_0xa57c('0x13'),_0xa57c('0x14'),'exten',_0xa57c('0x15'),'clientEmail',_0xa57c('0x16'),_0xa57c('0x17'),_0xa57c('0x18'),_0xa57c('0x19'),_0xa57c('0x1a'),'pass',_0xa57c('0x1b'),'localstationid',_0xa57c('0x1c'),_0xa57c('0x1d'),_0xa57c('0x1e'),_0xa57c('0x1f')];function maskSensitiveData(_0x3238ff){const _0x37a323=/(?!^)[\s\S](?!$)/g;if(_[_0xa57c('0x20')](_0x3238ff)){for(const _0x4b4bdb in _0x3238ff){if(_[_0xa57c('0x21')](_0x3238ff[_0x4b4bdb])){for(let _0xdf7ff6=0x0;_0xdf7ff6<_0x3238ff[_0x4b4bdb][_0xa57c('0x22')];_0xdf7ff6++){maskSensitiveData(_0x3238ff[_0x4b4bdb][_0xdf7ff6]);}}else if(_['isPlainObject'](_0x3238ff[_0x4b4bdb])){maskSensitiveData(_0x3238ff[_0x4b4bdb]);}else if(_[_0xa57c('0x23')](_0x3238ff[_0x4b4bdb])){_0x3238ff[_0x4b4bdb]=_0x3238ff[_0x4b4bdb]['replace'](/{{{/g,_0xa57c('0x24'))[_0xa57c('0x25')](/}}}/g,_0xa57c('0x26'))[_0xa57c('0x25')](/{{/g,'@{')[_0xa57c('0x25')](/}}/g,'}@');if(_[_0xa57c('0x27')](sensitiveFields,_0x4b4bdb)){_0x3238ff[_0x4b4bdb]=_0x3238ff[_0x4b4bdb][_0xa57c('0x25')](_0x37a323,'*');}}}}}module[_0xa57c('0x28')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x5f2f=['tenantId','token','channelSecret','accessTokenSecret','authToken','consumerKey','membername','exten','vidaooApiKey','privateKey','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','isString','replace','@@{','}@@','includes','exports','lodash','username','password','newPassword','apiKey','firstName','lastName','street','fax','email','clientId','clientSecret','securityToken','code'];(function(_0xd1cff2,_0x4cf4dc){var _0x5637d4=function(_0x5348b0){while(--_0x5348b0){_0xd1cff2['push'](_0xd1cff2['shift']());}};_0x5637d4(++_0x4cf4dc);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5c86f2,_0x464b85){_0x5c86f2=_0x5c86f2-0x0;var _0x1d2c66=_0x5f2f[_0x5c86f2];return _0x1d2c66;};var _=require(_0xf5f2('0x0'));var sensitiveFields=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3'),_0xf5f2('0x4'),_0xf5f2('0x5'),_0xf5f2('0x6'),_0xf5f2('0x7'),'phone','mobile',_0xf5f2('0x8'),_0xf5f2('0x9'),_0xf5f2('0xa'),_0xf5f2('0xb'),_0xf5f2('0xc'),_0xf5f2('0xd'),'accessKey',_0xf5f2('0xe'),_0xf5f2('0xf'),_0xf5f2('0x10'),'accessToken',_0xf5f2('0x11'),_0xf5f2('0x12'),_0xf5f2('0x13'),'consumerSecret',_0xf5f2('0x14'),'calleridname','calleridnum',_0xf5f2('0x15'),_0xf5f2('0x16'),'clientEmail',_0xf5f2('0x17'),_0xf5f2('0x18'),_0xf5f2('0x19'),_0xf5f2('0x1a'),_0xf5f2('0x1b'),_0xf5f2('0x1c'),'accountSid',_0xf5f2('0x1d'),_0xf5f2('0x1e'),_0xf5f2('0x1f'),_0xf5f2('0x20'),_0xf5f2('0x21')];function maskSensitiveData(_0x4d97fc){const _0xafe430=/(?!^)[\s\S](?!$)/g;if(_[_0xf5f2('0x22')](_0x4d97fc)){for(const _0x17d656 in _0x4d97fc){if(_[_0xf5f2('0x23')](_0x4d97fc[_0x17d656])){for(let _0x23e23a=0x0;_0x23e23a<_0x4d97fc[_0x17d656][_0xf5f2('0x24')];_0x23e23a++){maskSensitiveData(_0x4d97fc[_0x17d656][_0x23e23a]);}}else if(_[_0xf5f2('0x22')](_0x4d97fc[_0x17d656])){maskSensitiveData(_0x4d97fc[_0x17d656]);}else if(_[_0xf5f2('0x25')](_0x4d97fc[_0x17d656])){_0x4d97fc[_0x17d656]=_0x4d97fc[_0x17d656][_0xf5f2('0x26')](/{{{/g,_0xf5f2('0x27'))[_0xf5f2('0x26')](/}}}/g,_0xf5f2('0x28'))[_0xf5f2('0x26')](/{{/g,'@{')[_0xf5f2('0x26')](/}}/g,'}@');if(_[_0xf5f2('0x29')](sensitiveFields,_0x17d656)){_0x4d97fc[_0x17d656]=_0x4d97fc[_0x17d656][_0xf5f2('0x26')](_0xafe430,'*');}}}}}module[_0xf5f2('0x2a')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index fe5e76d..d30a135 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 _0xda2d=['exports','safeTemplate','{\x20{\x20','\x20}\x20}','map','isPlainObject','keys','reduce'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xda2d,0x102));var _0xdda2=function(_0x30370d,_0x4482ef){_0x30370d=_0x30370d-0x0;var _0x443edd=_0xda2d[_0x30370d];return _0x443edd;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x14e970){return _0x14e970==='{{'?_0xdda2('0x0'):_0xdda2('0x1');}function safeTemplate(_0x1f1fcc){var _0x329c5e=_0x1f1fcc;if(typeof _0x1f1fcc==='string'){_0x329c5e=_0x1f1fcc['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x1f1fcc)){_0x329c5e=_0x1f1fcc[_0xdda2('0x2')](function(_0x319129){return safeTemplate(_0x319129);});}else if(_[_0xdda2('0x3')](_0x1f1fcc)){_0x329c5e=Object[_0xdda2('0x4')](_0x1f1fcc)[_0xdda2('0x5')](function(_0xf38e58,_0x2f55dc){_0xf38e58[_0x2f55dc]=safeTemplate(_0x1f1fcc[_0x2f55dc]);return _0xf38e58;},{});}return _0x329c5e;}module[_0xdda2('0x6')][_0xdda2('0x7')]=safeTemplate; \ No newline at end of file +var _0x93e9=['string','map','isPlainObject','keys','reduce','exports','lodash','{\x20{\x20','\x20}\x20}'];(function(_0x2beef9,_0x308d39){var _0x1fdfc8=function(_0x53a72e){while(--_0x53a72e){_0x2beef9['push'](_0x2beef9['shift']());}};_0x1fdfc8(++_0x308d39);}(_0x93e9,0xcc));var _0x993e=function(_0x1ed935,_0x151a05){_0x1ed935=_0x1ed935-0x0;var _0x829d02=_0x93e9[_0x1ed935];return _0x829d02;};var _=require(_0x993e('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0xcf3bfd){return _0xcf3bfd==='{{'?_0x993e('0x1'):_0x993e('0x2');}function safeTemplate(_0x43b7b0){var _0x2a63eb=_0x43b7b0;if(typeof _0x43b7b0===_0x993e('0x3')){_0x2a63eb=_0x43b7b0['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x43b7b0)){_0x2a63eb=_0x43b7b0[_0x993e('0x4')](function(_0x255045){return safeTemplate(_0x255045);});}else if(_[_0x993e('0x5')](_0x43b7b0)){_0x2a63eb=Object[_0x993e('0x6')](_0x43b7b0)[_0x993e('0x7')](function(_0x2366d9,_0x12ac94){_0x2366d9[_0x12ac94]=safeTemplate(_0x43b7b0[_0x12ac94]);return _0x2366d9;},{});}return _0x2a63eb;}module[_0x993e('0x8')]['safeTemplate']=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 70a4eca..2187c60 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 _0xbe6e=['name','motion2','env','NODE_PATH','string','pathExists','then','readJSON','updated','info','writeJSON','path','../config/environment','resolve','server/app.json','legacy-libs','isArray','apps','findIndex'];(function(_0x43c587,_0x3108a9){var _0x2c68b3=function(_0x2e7e98){while(--_0x2e7e98){_0x43c587['push'](_0x43c587['shift']());}};_0x2c68b3(++_0x3108a9);}(_0xbe6e,0xb6));var _0xebe6=function(_0x2c2dca,_0x66c62e){_0x2c2dca=_0x2c2dca-0x0;var _0x401569=_0xbe6e[_0x2c2dca];return _0x401569;};var fs=require('fs-extra');var path=require(_0xebe6('0x0'));var config=require(_0xebe6('0x1'));var root=config['root'];var APP_JSON_PATH=path[_0xebe6('0x2')](root,_0xebe6('0x3'));var NODEPATH=path[_0xebe6('0x2')](root,_0xebe6('0x4'));function setLegacyLibsNodeEnvPath(_0x2c15a9){let _0x471aea=![];if(Array[_0xebe6('0x5')](_0x2c15a9[_0xebe6('0x6')])){var _0x246bd5=_0x2c15a9[_0xebe6('0x6')][_0xebe6('0x7')](function(_0x46449e){return _0x46449e[_0xebe6('0x8')]===_0xebe6('0x9');});if(_0x246bd5>-0x1){var _0x52c5df=_0x2c15a9[_0xebe6('0x6')][_0x246bd5];if(typeof _0x52c5df[_0xebe6('0xa')][_0xebe6('0xb')]!==_0xebe6('0xc')){_0x52c5df['env'][_0xebe6('0xb')]=NODEPATH;_0x471aea=!![];}}return{'appConfig':_0x2c15a9,'updated':_0x471aea};}}function updateAppConfig(_0x45ed45){return fs[_0xebe6('0xd')](APP_JSON_PATH)[_0xebe6('0xe')](function(_0x4d328c){if(_0x4d328c){return fs[_0xebe6('0xf')](APP_JSON_PATH)[_0xebe6('0xe')](function(_0x32f256){var _0x4a44ef=setLegacyLibsNodeEnvPath(_0x32f256);if(_0x4a44ef[_0xebe6('0x10')]){_0x45ed45[_0xebe6('0x11')]('Updating\x20app.json');return fs[_0xebe6('0x12')](APP_JSON_PATH,_0x32f256,{'spaces':0x2});}else{return Promise[_0xebe6('0x2')]();}});}else{return Promise[_0xebe6('0x2')]();}});}module['exports']=updateAppConfig; \ No newline at end of file +var _0x1ca6=['then','readJSON','updated','info','writeJSON','exports','fs-extra','../config/environment','root','resolve','legacy-libs','isArray','apps','name','motion2','env','string','NODE_PATH'];(function(_0x263908,_0x134d8f){var _0x2bed68=function(_0x103ec8){while(--_0x103ec8){_0x263908['push'](_0x263908['shift']());}};_0x2bed68(++_0x134d8f);}(_0x1ca6,0x72));var _0x61ca=function(_0x36ce3d,_0x474a85){_0x36ce3d=_0x36ce3d-0x0;var _0x5e9d11=_0x1ca6[_0x36ce3d];return _0x5e9d11;};var fs=require(_0x61ca('0x0'));var path=require('path');var config=require(_0x61ca('0x1'));var root=config[_0x61ca('0x2')];var APP_JSON_PATH=path['resolve'](root,'server/app.json');var NODEPATH=path[_0x61ca('0x3')](root,_0x61ca('0x4'));function setLegacyLibsNodeEnvPath(_0x15253f){let _0x5c150f=![];if(Array[_0x61ca('0x5')](_0x15253f[_0x61ca('0x6')])){var _0xc61017=_0x15253f['apps']['findIndex'](function(_0x3c7d3f){return _0x3c7d3f[_0x61ca('0x7')]===_0x61ca('0x8');});if(_0xc61017>-0x1){var _0x465363=_0x15253f[_0x61ca('0x6')][_0xc61017];if(typeof _0x465363[_0x61ca('0x9')]['NODE_PATH']!==_0x61ca('0xa')){_0x465363[_0x61ca('0x9')][_0x61ca('0xb')]=NODEPATH;_0x5c150f=!![];}}return{'appConfig':_0x15253f,'updated':_0x5c150f};}}function updateAppConfig(_0x175e46){return fs['pathExists'](APP_JSON_PATH)[_0x61ca('0xc')](function(_0x19f6a1){if(_0x19f6a1){return fs[_0x61ca('0xd')](APP_JSON_PATH)['then'](function(_0x2d7259){var _0x4f84c2=setLegacyLibsNodeEnvPath(_0x2d7259);if(_0x4f84c2[_0x61ca('0xe')]){_0x175e46[_0x61ca('0xf')]('Updating\x20app.json');return fs[_0x61ca('0x10')](APP_JSON_PATH,_0x2d7259,{'spaces':0x2});}else{return Promise[_0x61ca('0x3')]();}});}else{return Promise['resolve']();}});}module[_0x61ca('0x11')]=updateAppConfig; \ No newline at end of file